diff options
65 files changed, 6788 insertions, 6788 deletions
diff --git a/audio/filter/af_center.c b/audio/filter/af_center.c index 2e626bffb6..106e08412e 100644 --- a/audio/filter/af_center.c +++ b/audio/filter/af_center.c @@ -35,7 +35,7 @@ // Data for specific instances of this filter typedef struct af_center_s { - int ch; // Channel number which to insert the filtered data + int ch; // Channel number which to insert the filtered data }af_center_t; // Initialization and runtime control @@ -61,12 +61,12 @@ static int control(struct af_instance* af, int cmd, void* arg) // Filter data through filter static int filter(struct af_instance* af, struct mp_audio* data, int flags) { - struct mp_audio* c = data; // Current working data + struct mp_audio* c = data; // Current working data af_center_t* s = af->priv; // Setup for this instance - float* a = c->planes[0]; // Audio data - int nch = c->nch; // Number of channels - int len = c->samples*c->nch; // Number of samples in current audio block - int ch = s->ch; // Channel in which to insert the center audio + float* a = c->planes[0]; // Audio data + int nch = c->nch; // Number of channels + int len = c->samples*c->nch; // Number of samples in current audio block + int ch = s->ch; // Channel in which to insert the center audio register int i; // Run filter diff --git a/audio/filter/af_channels.c b/audio/filter/af_channels.c index 6db44ba024..118607b66f 100644 --- a/audio/filter/af_channels.c +++ b/audio/filter/af_channels.c @@ -114,7 +114,7 @@ static void copy(struct af_instance *af, void* in, void* out, } default: MP_ERR(af, "Unsupported number of bytes/sample: %i" - " please report this error on the MPlayer mailing list. \n",bps); + " please report this error on the MPlayer mailing list. \n",bps); } } @@ -125,7 +125,7 @@ static int check_routes(struct af_instance *af, int nin, int nout) int i; if((s->nr < 1) || (s->nr > AF_NCH)){ MP_ERR(af, "The number of routing pairs must be" - " between 1 and %i. Current value is %i\n",AF_NCH,s->nr); + " between 1 and %i. Current value is %i\n",AF_NCH,s->nr); return AF_ERROR; } @@ -154,22 +154,22 @@ static int control(struct af_instance* af, int cmd, void* arg) int i; // Make sure this filter isn't redundant if(af->data->nch == ((struct mp_audio*)arg)->nch) - return AF_DETACH; + return AF_DETACH; // If mono: fake stereo if(((struct mp_audio*)arg)->nch == 1){ - s->nr = MPMIN(af->data->nch,2); - for(i=0;i<s->nr;i++){ - s->route[i][FR] = 0; - s->route[i][TO] = i; - } + s->nr = MPMIN(af->data->nch,2); + for(i=0;i<s->nr;i++){ + s->route[i][FR] = 0; + s->route[i][TO] = i; + } } else{ - s->nr = MPMIN(af->data->nch, ((struct mp_audio*)arg)->nch); - for(i=0;i<s->nr;i++){ - s->route[i][FR] = i; - s->route[i][TO] = i; - } + s->nr = MPMIN(af->data->nch, ((struct mp_audio*)arg)->nch); + for(i=0;i<s->nr;i++){ + s->route[i][FR] = i; + s->route[i][TO] = i; + } } } @@ -184,10 +184,10 @@ static int control(struct af_instance* af, int cmd, void* arg) // Filter data through filter static int filter(struct af_instance* af, struct mp_audio* data, int flags) { - struct mp_audio* c = data; // Current working data - struct mp_audio* l = af->data; // Local data + struct mp_audio* c = data; // Current working data + struct mp_audio* l = af->data; // Local data af_channels_t* s = af->priv; - int i; + int i; mp_audio_realloc_min(af->data, data->samples); @@ -197,7 +197,7 @@ static int filter(struct af_instance* af, struct mp_audio* data, int flags) if(AF_OK == check_routes(af,c->nch,l->nch)) for(i=0;i<s->nr;i++) copy(af, c->planes[0],l->planes[0],c->nch,s->route[i][FR], - l->nch,s->route[i][TO],mp_audio_psize(c),c->bps); + l->nch,s->route[i][TO],mp_audio_psize(c),c->bps); // Set output data c->planes[0] = l->planes[0]; diff --git a/audio/filter/af_delay.c b/audio/filter/af_delay.c index a8cd79f117..b16cdc1f63 100644 --- a/audio/filter/af_delay.c +++ b/audio/filter/af_delay.c @@ -37,10 +37,10 @@ // Data for specific instances of this filter typedef struct af_delay_s { - void* q[AF_NCH]; // Circular queues used for delaying audio signal - int wi[AF_NCH]; // Write index - int ri; // Read index - float d[AF_NCH]; // Delay [ms] + void* q[AF_NCH]; // Circular queues used for delaying audio signal + int wi[AF_NCH]; // Write index + int ri; // Read index + float d[AF_NCH]; // Delay [ms] char *delaystr; }af_delay_t; @@ -69,7 +69,7 @@ static int control(struct af_instance* af, int cmd, void* arg) for(i=0;i<af->data->nch;i++){ s->q[i] = calloc(L,af->data->bps); if(NULL == s->q[i]) - MP_FATAL(af, "Out of memory\n"); + MP_FATAL(af, "Out of memory\n"); } if(AF_OK != af_from_ms(AF_NCH, s->d, s->wi, af->data->rate, 0.0, 1000.0)) @@ -99,12 +99,12 @@ static void uninit(struct af_instance* af) // Filter data through filter static int filter(struct af_instance* af, struct mp_audio* data, int flags) { - struct mp_audio* c = data; // Current working data - af_delay_t* s = af->priv; // Setup for this instance - int nch = c->nch; // Number of channels - int len = mp_audio_psize(c)/c->bps; // Number of sample in data chunk - int ri = 0; - int ch,i; + struct mp_audio* c = data; // Current working data + af_delay_t* s = af->priv; // Setup for this instance + int nch = c->nch; // Number of channels + int len = mp_audio_psize(c)/c->bps; // Number of sample in data chunk + int ri = 0; + int ch,i; for(ch=0;ch<nch;ch++){ switch(c->bps){ case 1:{ @@ -113,10 +113,10 @@ static int filter(struct af_instance* af, struct mp_audio* data, int flags) int wi = s->wi[ch]; ri = s->ri; for(i=ch;i<len;i+=nch){ - q[wi] = a[i]; - a[i] = q[ri]; - UPDATEQI(wi); - UPDATEQI(ri); + q[wi] = a[i]; + a[i] = q[ri]; + UPDATEQI(wi); + UPDATEQI(ri); } s->wi[ch] = wi; break; @@ -127,10 +127,10 @@ static int filter(struct af_instance* af, struct mp_audio* data, int flags) int wi = s->wi[ch]; ri = s->ri; for(i=ch;i<len;i+=nch){ - q[wi] = a[i]; - a[i] = q[ri]; - UPDATEQI(wi); - UPDATEQI(ri); + q[wi] = a[i]; + a[i] = q[ri]; + UPDATEQI(wi); + UPDATEQI(ri); } s->wi[ch] = wi; break; @@ -141,10 +141,10 @@ static int filter(struct af_instance* af, struct mp_audio* data, int flags) int wi = s->wi[ch]; ri = s->ri; for(i=ch;i<len;i+=nch){ - q[wi] = a[i]; - a[i] = q[ri]; - UPDATEQI(wi); - UPDATEQI(ri); + q[wi] = a[i]; + a[i] = q[ri]; + UPDATEQI(wi); + UPDATEQI(ri); } s->wi[ch] = wi; break; diff --git a/audio/filter/af_drc.c b/audio/filter/af_drc.c index fad34ba500..3bcd368d4d 100644 --- a/audio/filter/af_drc.c +++ b/audio/filter/af_drc.c @@ -70,8 +70,8 @@ typedef struct af_volume_s // method 2 int idx; struct { - float avg; // average level of the sample - int len; // sample size (weight) + float avg; // average level of the sample + int len; // sample size (weight) } mem[NSAMPLES]; // "Ideal" level float mid_s16; @@ -100,8 +100,8 @@ static int control(struct af_instance* af, int cmd, void* arg) static void method1_int16(af_drc_t *s, struct mp_audio *c) { register int i = 0; - int16_t *data = (int16_t*)c->planes[0]; // Audio data - int len = c->samples*c->nch; // Number of samples + int16_t *data = (int16_t*)c->planes[0]; // Audio data + int len = c->samples*c->nch; // Number of samples float curavg = 0.0, newavg, neededmul; int tmp; @@ -142,8 +142,8 @@ static void method1_int16(af_drc_t *s, struct mp_audio *c) static void method1_float(af_drc_t *s, struct mp_audio *c) { register int i = 0; - float *data = (float*)c->planes[0]; // Audio data - int len = c->samples*c->nch; // Number of samples + float *data = (float*)c->planes[0]; // Audio data + int len = c->samples*c->nch; // Number of samples float curavg = 0.0, newavg, neededmul, tmp; for (i = 0; i < len; i++) @@ -179,8 +179,8 @@ static void method1_float(af_drc_t *s, struct mp_audio *c) static void method2_int16(af_drc_t *s, struct mp_audio *c) { register int i = 0; - int16_t *data = (int16_t*)c->planes[0]; // Audio data - int len = c->samples*c->nch; // Number of samples + int16_t *data = (int16_t*)c->planes[0]; // Audio data + int len = c->samples*c->nch; // Number of samples float curavg = 0.0, newavg, avg = 0.0; int tmp, totallen = 0; @@ -204,8 +204,8 @@ static void method2_int16(af_drc_t *s, struct mp_audio *c) avg /= (float)totallen; if (avg >= SIL_S16) { - s->mul = s->mid_s16 / avg; - s->mul = MPCLAMP(s->mul, MUL_MIN, MUL_MAX); + s->mul = s->mid_s16 / avg; + s->mul = MPCLAMP(s->mul, MUL_MIN, MUL_MAX); } } @@ -229,8 +229,8 @@ static void method2_int16(af_drc_t *s, struct mp_audio *c) static void method2_float(af_drc_t *s, struct mp_audio *c) { register int i = 0; - float *data = (float*)c->planes[0]; // Audio data - int len = c->samples*c->nch; // Number of samples + float *data = (float*)c->planes[0]; // Audio data + int len = c->samples*c->nch; // Number of samples float curavg = 0.0, newavg, avg = 0.0, tmp; int totallen = 0; @@ -254,8 +254,8 @@ static void method2_float(af_drc_t *s, struct mp_audio *c) avg /= (float)totallen; if (avg >= SIL_FLOAT) { - s->mul = s->mid_float / avg; - s->mul = MPCLAMP(s->mul, MUL_MIN, MUL_MAX); + s->mul = s->mid_float / avg; + s->mul = MPCLAMP(s->mul, MUL_MIN, MUL_MAX); } } @@ -279,16 +279,16 @@ static int filter(struct af_instance* af, struct mp_audio* data, int flags) if(af->data->format == (AF_FORMAT_S16)) { if (s->method == 2) - method2_int16(s, data); + method2_int16(s, data); else - method1_int16(s, data); + method1_int16(s, data); } else if(af->data->format == (AF_FORMAT_FLOAT)) { if (s->method == 2) - method2_float(s, data); + method2_float(s, data); else - method1_float(s, data); + method1_float(s, data); } return 0; } diff --git a/audio/filter/af_dummy.c b/audio/filter/af_dummy.c index c13c32b968..d920480e01 100644 --- a/audio/filter/af_dummy.c +++ b/audio/filter/af_dummy.c @@ -34,7 +34,7 @@ static int control(struct af_instance* af, int cmd, void* arg) case AF_CONTROL_REINIT: ; *af->data = *(struct mp_audio*)arg; MP_VERBOSE(af, "Was reinitialized: %iHz/%ich/%s\n", - af->data->rate,af->data->nch,af_fmt_to_str(af->data->format)); + af->data->rate,af->data->nch,af_fmt_to_str(af->data->format)); return AF_OK; } return AF_UNKNOWN; diff --git a/audio/filter/af_equalizer.c b/audio/filter/af_equalizer.c index 4f5a29706e..83fa80f2b3 100644 --- a/audio/filter/af_equalizer.c +++ b/audio/filter/af_equalizer.c @@ -32,41 +32,41 @@ #include "common/common.h" #include "af.h" -#define L 2 // Storage for filter taps -#define KM 10 // Max number of bands +#define L 2 // Storage for filter taps +#define KM 10 // Max number of bands #define Q 1.2247449 /* Q value for band-pass filters 1.2247=(3/2)^(1/2) - gives 4dB suppression @ Fc*2 and Fc/2 */ + gives 4dB suppression @ Fc*2 and Fc/2 */ /* Center frequencies for band-pass filters The different frequency bands are: - nr. center frequency - 0 31.25 Hz - 1 62.50 Hz - 2 125.0 Hz - 3 250.0 Hz - 4 500.0 Hz - 5 1.000 kHz - 6 2.000 kHz - 7 4.000 kHz - 8 8.000 kHz - 9 16.00 kHz + nr. center frequency + 0 31.25 Hz + 1 62.50 Hz + 2 125.0 Hz + 3 250.0 Hz + 4 500.0 Hz + 5 1.000 kHz + 6 2.000 kHz + 7 4.000 kHz + 8 8.000 kHz + 9 16.00 kHz */ -#define CF {31.25,62.5,125,250,500,1000,2000,4000,8000,16000} +#define CF {31.25,62.5,125,250,500,1000,2000,4000,8000,16000} // Maximum and minimum gain for the bands -#define G_MAX +12.0 -#define G_MIN -12.0 +#define G_MAX +12.0 +#define G_MIN -12.0 // Data for specific instances of this filter typedef struct af_equalizer_s { - float a[KM][L]; // A weights - float b[KM][L]; // B weights - float wq[AF_NCH][KM][L]; // Circular buffer for W data - float g[AF_NCH][KM]; // Gain factor for each channel and band - int K; // Number of used eq bands - int channels; // Number of channels + float a[KM][L]; // A weights + float b[KM][L]; // B weights + float wq[AF_NCH][KM][L]; // Circular buffer for W data + float g[AF_NCH][KM]; // Gain factor for each channel and band + int K; // Number of used eq bands + int channels; // Number of channels float gain_factor; // applied at output to avoid clipping double p[KM]; } af_equalizer_t; @@ -108,7 +108,7 @@ static int control(struct af_instance* af, int cmd, void* arg) if(s->K != KM) MP_INFO(af, "Limiting the number of filters to" - " %i due to low sample rate.\n",s->K); + " %i due to low sample rate.\n",s->K); // Generate filter taps for(k=0;k<s->K;k++) @@ -144,33 +144,33 @@ static int control(struct af_instance* af, int cmd, void* arg) // Filter data through filter static int filter(struct af_instance* af, struct mp_audio* data, int flags) { - struct mp_audio* c = data; // Current working data - af_equalizer_t* s = (af_equalizer_t*)af->priv; // Setup - uint32_t ci = af->data->nch; // Index for channels - uint32_t nch = af->data->nch; // Number of channels + struct mp_audio* c = data; // Current working data + af_equalizer_t* s = (af_equalizer_t*)af->priv; // Setup + uint32_t ci = af->data->nch; // Index for channels + uint32_t nch = af->data->nch; // Number of channels while(ci--){ - float* g = s->g[ci]; // Gain factor - float* in = ((float*)c->planes[0])+ci; - float* out = ((float*)c->planes[0])+ci; - float* end = in + c->samples*c->nch; // Block loop end + float* g = s->g[ci]; // Gain factor + float* in = ((float*)c->planes[0])+ci; + float* out = ((float*)c->planes[0])+ci; + float* end = in + c->samples*c->nch; // Block loop end while(in < end){ - register int k = 0; // Frequency band index - register float yt = *in; // Current input sample + register int k = 0; // Frequency band index + register float yt = *in; // Current input sample in+=nch; // Run the filters for(;k<s->K;k++){ - // Pointer to circular buffer wq - register float* wq = s->wq[ci][k]; - // Calculate output from AR part of current filter - register float w=yt*s->b[k][0] + wq[0]*s->a[k][0] + wq[1]*s->a[k][1]; - // Calculate output form MA part of current filter - yt+=(w + wq[1]*s->b[k][1])*g[k]; - // Update circular buffer - wq[1] = wq[0]; - wq[0] = w; + // Pointer to circular buffer wq + register float* wq = s->wq[ci][k]; + // Calculate output from AR part of current filter + register float w=yt*s->b[k][0] + wq[0]*s->a[k][0] + wq[1]*s->a[k][1]; + // Calculate output form MA part of current filter + yt+=(w + wq[1]*s->b[k][1])*g[k]; + // Update circular buffer + wq[1] = wq[0]; + wq[0] = w; } // Calculate output *out=yt*s->gain_factor; diff --git a/audio/filter/af_export.c b/audio/filter/af_export.c index 542b2a1f9f..faa09bf927 100644 --- a/audio/filter/af_export.c +++ b/audio/filter/af_export.c @@ -47,7 +47,7 @@ #define DEF_SZ 512 // default buffer size (in samples) #define SHARED_FILE "mpv-af_export" /* default file name - (relative to ~/.mpv/ */ + (relative to ~/.mpv/ */ #define SIZE_HEADER (2 * sizeof(int) + sizeof(unsigned long long)) @@ -55,12 +55,12 @@ typedef struct af_export_s { unsigned long long count; // Used for sync - void* buf[AF_NCH]; // Buffers for storing the data before it is exported - int sz; // Size of buffer in samples - int wi; // Write index - int fd; // File descriptor to shared memory area - char* filename; // File to export data - uint8_t *mmap_area; // MMap shared area + void* buf[AF_NCH]; // Buffers for storing the data before it is exported + int sz; // Size of buffer in samples + int wi; // Write index + int fd; // File descriptor to shared memory area + char* filename; // File to export data + uint8_t *mmap_area; // MMap shared area } af_export_t; @@ -109,7 +109,7 @@ static int control(struct af_instance* af, int cmd, void* arg) MP_INFO(af, "Exporting to file: %s\n", s->filename); if(s->fd < 0) { MP_FATAL(af, "Could not open/create file: %s\n", - s->filename); + s->filename); return AF_ERROR; } @@ -127,7 +127,7 @@ static int control(struct af_instance* af, int cmd, void* arg) if(s->mmap_area == NULL) MP_FATAL(af, "Could not mmap file %s\n", s->filename); MP_INFO(af, "Memory mapped to file: %s (%p)\n", - s->filename, s->mmap_area); + s->filename, s->mmap_area); // Initialize header *((int*)s->mmap_area) = af->data->nch; @@ -164,27 +164,27 @@ static void uninit( struct af_instance* af ) */ static int filter( struct af_instance* af, struct mp_audio* data, int flags) { - struct mp_audio* c = data; // Current working data - af_export_t* s = af->priv; // Setup for this instance - int16_t* a = c->planes[0]; // Incomming sound - int nch = c->nch; // Number of channels - int len = c->samples*c->nch; // Number of sample in data chunk - int sz = s->sz; // buffer size (in samples) - int flag = 0; // Set to 1 if buffer is filled + struct mp_audio* c = data; // Current working data + af_export_t* s = af->priv; // Setup for this instance + int16_t* a = c->planes[0]; // Incomming sound + int nch = c->nch; // Number of channels + int len = c->samples*c->nch; // Number of sample in data chunk + int sz = s->sz; // buffer size (in samples) + int flag = 0; // Set to 1 if bu |