diff options
author | 2009-07-07 02:26:13 +0300 | |
---|---|---|
committer | 2009-07-07 02:34:35 +0300 | |
commit | 0eb321bf2c1cc0e048faff26a01f86cdd3ec254f (patch) | |
tree | 71cb9bd9ed121156d3382066c0722c73189afe04 /libmpcodecs | |
parent | 6d908205fbadbdf7ccdc6c5e0eb918f0b43f16e0 (diff) |
Remove trailing whitespace from most files
Diffstat (limited to 'libmpcodecs')
127 files changed, 1260 insertions, 1308 deletions
diff --git a/libmpcodecs/ad_acm.c b/libmpcodecs/ad_acm.c index 870c9a986f..b5a416b145 100644 --- a/libmpcodecs/ad_acm.c +++ b/libmpcodecs/ad_acm.c @@ -46,12 +46,12 @@ static int preinit(sh_audio_t *sh_audio) WAVEFORMATEX *in_fmt = sh_audio->wf; DWORD srcsize = 0; acm_context_t *priv; - + priv = malloc(sizeof(acm_context_t)); if (!priv) return 0; sh_audio->context = priv; - + mp_msg(MSGT_WIN32, MSGL_V, "======= Win32 (ACM) AUDIO Codec init =======\n"); // priv->handle = NULL; @@ -71,7 +71,7 @@ static int preinit(sh_audio_t *sh_audio) priv->o_wf->wBitsPerSample = 16; // priv->o_wf->wBitsPerSample = inf_fmt->wBitsPerSample; priv->o_wf->cbSize = 0; - + if ( mp_msg_test(MSGT_DECAUDIO,MSGL_V) ) { mp_msg(MSGT_DECAUDIO, MSGL_V, "Input format:\n"); @@ -94,7 +94,7 @@ static int preinit(sh_audio_t *sh_audio) return 0; } mp_msg(MSGT_WIN32, MSGL_V, "Audio codec opened OK! ;-)\n"); - + acmStreamSize(priv->handle, in_fmt->nBlockAlign, &srcsize, ACM_STREAMSIZEF_SOURCE); //if ( mp_msg_test(MSGT_DECAUDIO,MSGL_V) ) printf("Audio ACM output buffer min. size: %ld (reported by codec)\n", srcsize); srcsize *= 2; @@ -122,7 +122,7 @@ static int preinit(sh_audio_t *sh_audio) mp_msg(MSGT_WIN32,MSGL_V,"Audio ACM input buffer min. size: %ld\n",srcsize); sh_audio->audio_in_minsize=2*srcsize; // audio input min. size - + sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec; sh_audio->channels=priv->o_wf->nChannels; sh_audio->samplerate=priv->o_wf->nSamplesPerSec; @@ -136,10 +136,10 @@ static void uninit(sh_audio_t *sh) { HRESULT ret; acm_context_t *priv = sh->context; - + retry: ret = acmStreamClose(priv->handle, 0); - + if (ret) switch(ret) { @@ -155,7 +155,7 @@ retry: mp_msg(MSGT_WIN32, MSGL_WARN, "ACM_Decoder: unknown error occurred: %ld\n", ret); return; } - + MSACM_UnregisterAllDrivers(); free(priv->o_wf); @@ -207,7 +207,7 @@ static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int m memset(&ash, 0, sizeof(ash)); ash.cbStruct=sizeof(ash); ash.fdwStatus=0; - ash.dwUser=0; + ash.dwUser=0; ash.pbSrc=sh_audio->a_in_buffer; ash.cbSrcLength=sh_audio->a_in_buffer_len; ash.pbDst=buf; diff --git a/libmpcodecs/ad_dk3adpcm.c b/libmpcodecs/ad_dk3adpcm.c index b4eec81b5f..0db12138d6 100644 --- a/libmpcodecs/ad_dk3adpcm.c +++ b/libmpcodecs/ad_dk3adpcm.c @@ -2,7 +2,7 @@ DK3 ADPCM Decoder for MPlayer by Mike Melanson - "This format number was used by Duck Corp. but not officially + "This format number was used by Duck Corp. but not officially registered with Microsoft" This file is responsible for decoding audio data encoded with @@ -71,7 +71,7 @@ static int adpcm_index[16] = static int preinit(sh_audio_t *sh_audio) { sh_audio->audio_out_minsize = sh_audio->wf->nBlockAlign * 6; - sh_audio->ds->ss_div = + sh_audio->ds->ss_div = (sh_audio->wf->nBlockAlign - DK3_ADPCM_PREAMBLE_SIZE) * 8 / 3; sh_audio->audio_in_minsize= sh_audio->ds->ss_mul = sh_audio->wf->nBlockAlign; @@ -233,8 +233,8 @@ static int dk3_adpcm_decode_block(unsigned short *output, unsigned char *input, static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen) { if (demux_read_data(sh_audio->ds, sh_audio->a_in_buffer, - sh_audio->ds->ss_mul) != - sh_audio->ds->ss_mul) + sh_audio->ds->ss_mul) != + sh_audio->ds->ss_mul) return -1; /* EOF */ if (maxlen < 2 * 4 * sh_audio->wf->nBlockAlign * 2 / 3) { diff --git a/libmpcodecs/ad_dvdpcm.c b/libmpcodecs/ad_dvdpcm.c index 943ce73bf0..ca56eeea1e 100644 --- a/libmpcodecs/ad_dvdpcm.c +++ b/libmpcodecs/ad_dvdpcm.c @@ -40,7 +40,7 @@ static int init(sh_audio_t *sh) case 1: mp_tmsg(MSGT_DECAUDIO, MSGL_INFO, "Samples of this format are needed to improve support. Please contact the developers.\n"); sh->i_bps = sh->channels * sh->samplerate * 5 / 2; - case 2: + case 2: sh->sample_format = AF_FORMAT_S24_BE; sh->samplesize = 3; break; @@ -139,7 +139,7 @@ static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int m } len = j; } - } else + } else len=demux_read_data(sh_audio->ds,buf,(minlen+3)&(~3)); return len; } diff --git a/libmpcodecs/ad_faad.c b/libmpcodecs/ad_faad.c index a7b9fbf84e..905decd977 100644 --- a/libmpcodecs/ad_faad.c +++ b/libmpcodecs/ad_faad.c @@ -48,9 +48,9 @@ LIBAD_EXTERN(faad) /* configure maximum supported channels, * * this is theoretically max. 64 chans */ #define FAAD_MAX_CHANNELS 6 -#define FAAD_BUFFLEN (FAAD_MIN_STREAMSIZE*FAAD_MAX_CHANNELS) +#define FAAD_BUFFLEN (FAAD_MIN_STREAMSIZE*FAAD_MAX_CHANNELS) -//#define AAC_DUMP_COMPRESSED +//#define AAC_DUMP_COMPRESSED static faacDecHandle faac_hdec; static faacDecFrameInfo faac_finfo; @@ -80,7 +80,7 @@ static int aac_probe(unsigned char *buffer, int len) mp_msg(MSGT_DECAUDIO,MSGL_V, "\nAAC_PROBE: ret %d\n", pos); return pos; } - + static int init(sh_audio_t *sh) { unsigned long faac_samplerate; @@ -151,7 +151,7 @@ static int init(sh_audio_t *sh) faac_conf->downMatrix = 1; faacDecSetConfiguration(faac_hdec, faac_conf); } - + /*int i; for(i = 0; i < sh_audio->codecdata_len; i++) printf("codecdata_dump %d: 0x%02X\n", i, sh_audio->codecdata[i]);*/ @@ -175,9 +175,9 @@ static int init(sh_audio_t *sh) if(!sh->i_bps) { mp_msg(MSGT_DECAUDIO,MSGL_WARN,"FAAD: compressed input bitrate missing, assuming 128kbit/s!\n"); sh->i_bps = 128*1000/8; // XXX: HACK!!! ::atmos - } else + } else mp_msg(MSGT_DECAUDIO,MSGL_V,"FAAD: got %dkbit/s bitrate from MP4 header!\n",sh->i_bps*8/1000); - } + } return 1; } @@ -213,7 +213,7 @@ static int control(sh_audio_t *sh,int cmd,void* arg, ...) case ADCTRL_RESYNC_STREAM: aac_sync(sh); return CONTROL_TRUE; -#if 0 +#if 0 case ADCTRL_SKIP_FRAME: return CONTROL_TRUE; #endif @@ -237,7 +237,7 @@ static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen) demux_read_data(sh->ds,&sh->a_in_buffer[sh->a_in_buffer_len], sh->a_in_buffer_size - sh->a_in_buffer_len); } - + #ifdef DUMP_AAC_COMPRESSED {int i; for (i = 0; i < 16; i++) @@ -249,7 +249,7 @@ static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen) // raw aac stream: do { faac_sample_buffer = faacDecDecode(faac_hdec, &faac_finfo, sh->a_in_buffer, sh->a_in_buffer_len); - + /* update buffer index after faacDecDecode */ if(faac_finfo.bytesconsumed >= sh->a_in_buffer_len) { sh->a_in_buffer_len=0; @@ -271,7 +271,7 @@ static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen) errors++; } else break; - } while(errors < MAX_FAAD_ERRORS); + } while(errors < MAX_FAAD_ERRORS); } else { // packetized (.mp4) aac stream: unsigned char* bufptr=NULL; @@ -285,7 +285,7 @@ static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen) faac_sample_buffer = faacDecDecode(faac_hdec, &faac_finfo, bufptr, buflen); } //for (j=0;j<faac_finfo.channels;j++) printf("%d:%d\n", j, faac_finfo.channel_position[j]); - + if(faac_finfo.error > 0) { mp_msg(MSGT_DECAUDIO,MSGL_WARN,"FAAD: Failed to decode frame: %s \n", faacDecGetErrorMessage(faac_finfo.error)); diff --git a/libmpcodecs/ad_ffmpeg.c b/libmpcodecs/ad_ffmpeg.c index af512368a5..0a4db6c600 100644 --- a/libmpcodecs/ad_ffmpeg.c +++ b/libmpcodecs/ad_ffmpeg.c @@ -46,13 +46,13 @@ static int init(sh_audio_t *sh_audio) avcodec_register_all(); avcodec_initialized=1; } - + lavc_codec = (AVCodec *)avcodec_find_decoder_by_name(sh_audio->codec->dll); if(!lavc_codec){ mp_tmsg(MSGT_DECAUDIO,MSGL_ERR,"Cannot find codec '%s' in libavcodec...\n",sh_audio->codec->dll); return 0; } - + lavc_context = avcodec_alloc_context(); sh_audio->context=lavc_context; @@ -73,7 +73,7 @@ static int init(sh_audio_t *sh_audio) if (sh_audio->wf && sh_audio->wf->cbSize > 0) { lavc_context->extradata = av_mallocz(sh_audio->wf->cbSize + FF_INPUT_BUFFER_PADDING_SIZE); lavc_context->extradata_size = sh_audio->wf->cbSize; - memcpy(lavc_context->extradata, (char *)sh_audio->wf + sizeof(WAVEFORMATEX), + memcpy(lavc_context->extradata, (char *)sh_audio->wf + sizeof(WAVEFORMATEX), lavc_context->extradata_size); } @@ -82,8 +82,8 @@ static int init(sh_audio_t *sh_audio) { lavc_context->extradata = av_malloc(sh_audio->codecdata_len); lavc_context->extradata_size = sh_audio->codecdata_len; - memcpy(lavc_context->extradata, (char *)sh_audio->codecdata, - lavc_context->extradata_size); + memcpy(lavc_context->extradata, (char *)sh_audio->codecdata, + lavc_context->extradata_size); } /* open it */ @@ -92,7 +92,7 @@ static int init(sh_audio_t *sh_audio) return 0; } mp_msg(MSGT_DECAUDIO,MSGL_V,"INFO: libavcodec init OK!\n"); - + // printf("\nFOURCC: 0x%X\n",sh_audio->format); if(sh_audio->format==0x3343414D){ // MACE 3:1 @@ -176,7 +176,7 @@ static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int m int src_ch_layout = AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT; const char *codec=((AVCodecContext*)sh_audio->context)->codec->name; if (!strcasecmp(codec, "ac3") - || !strcasecmp(codec, "eac3")) + || !strcasecmp(codec, "eac3")) src_ch_layout = AF_CHANNEL_LAYOUT_LAVC_AC3_DEFAULT; else if (!strcasecmp(codec, "dca")) src_ch_layout = AF_CHANNEL_LAYOUT_LAVC_DCA_DEFAULT; diff --git a/libmpcodecs/ad_hwac3.c b/libmpcodecs/ad_hwac3.c index 6750ae0f0a..14f884be54 100644 --- a/libmpcodecs/ad_hwac3.c +++ b/libmpcodecs/ad_hwac3.c @@ -80,7 +80,7 @@ static int ac3dts_fillbuff(sh_audio_t *sh_audio) else { length = a52_syncinfo(sh_audio->a_in_buffer, &flags, &sample_rate, &bit_rate); - if(length >= 7 && length <= 3840) + if(length >= 7 && length <= 3840) { if(isdts != 0) { @@ -100,13 +100,13 @@ static int ac3dts_fillbuff(sh_audio_t *sh_audio) sh_audio->i_bps = bit_rate / 8; demux_read_data(sh_audio->ds, sh_audio->a_in_buffer + 12, length - 12); sh_audio->a_in_buffer_len = length; - + // TODO: is DTS also checksummed? #ifdef CONFIG_LIBA52_INTERNAL if(isdts == 0 && crc16_block(sh_audio->a_in_buffer + 2, length - 2) != 0) mp_msg(MSGT_DECAUDIO, MSGL_STATUS, "a52: CRC check failed! \n"); #endif - + return length; } @@ -162,7 +162,7 @@ static int control(sh_audio_t *sh,int cmd,void* arg, ...) static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen) { int len = sh_audio->a_in_buffer_len; - + if(len <= 0) if((len = ac3dts_fillbuff(sh_audio)) <= 0) return len; /*EOF*/ @@ -305,7 +305,7 @@ static int dts_decode_header(uint8_t *indata_ptr, int *rate, int *nblks, int *sf Frame type ( 1: Normal frame; 0: Termination frame ) */ ftype = indata_ptr[4+le_mode] >> 7; - if(ftype != 1) + if(ftype != 1) { mp_msg(MSGT_DECAUDIO, MSGL_ERR, "DTS: Termination frames not handled, REPORT BUG\n"); return -1; @@ -384,29 +384,29 @@ static int dts_decode_header(uint8_t *indata_ptr, int *rate, int *nblks, int *sf *rate = (indata_ptr[10+le_mode] & 0x3f) >> 1; } #if 0 - if(*sfreq != 13) + if(*sfreq != 13) { mp_msg(MSGT_DECAUDIO, MSGL_ERR, "DTS: Only 48kHz supported, REPORT BUG\n"); return -1; } #endif - if((fsize > 8192) || (fsize < 96)) + if((fsize > 8192) || (fsize < 96)) { mp_msg(MSGT_DECAUDIO, MSGL_ERR, "DTS: fsize: %d invalid, REPORT BUG\n", fsize); return -1; } - + if(*nblks != 8 && *nblks != 16 && *nblks != 32 && *nblks != 64 && *nblks != 128 && - ftype == 1) + ftype == 1) { mp_msg(MSGT_DECAUDIO, MSGL_ERR, "DTS: nblks %d not valid for normal frame, REPORT BUG\n", *nblks); return -1; } - + return fsize; } @@ -416,7 +416,7 @@ static int dts_syncinfo(uint8_t *indata_ptr, int *flags, int *sample_rate, int * int fsize; int rate; int sfreq; - + fsize = dts_decode_header(indata_ptr, &rate, &nblks, &sfreq); if(fsize >= 0) { @@ -479,7 +479,7 @@ static int decode_audio_dts(unsigned char *indata_ptr, int len, unsigned char *b buf16[0] = 0xf872; /* iec 61937 */ buf16[1] = 0x4e1f; /* syncword */ - switch(nr_samples) + switch(nr_samples) { case 512: buf16[2] = 0x000b; /* DTS-1 (512-sample bursts) */ @@ -495,7 +495,7 @@ static int decode_audio_dts(unsigned char *indata_ptr, int len, unsigned char *b buf16[2] = 0x0000; break; } - + if(fsize + 8 > nr_samples * 2 * 2) { // dts wav (14bits LE) match this condition, one way to passthrough diff --git a/libmpcodecs/ad_hwmpa.c b/libmpcodecs/ad_hwmpa.c index e17f994ead..7cb25afab2 100644 --- a/libmpcodecs/ad_hwmpa.c +++ b/libmpcodecs/ad_hwmpa.c @@ -74,7 +74,7 @@ static int init(sh_audio_t *sh) sh->samplerate = srate; sh->i_bps = br * 125; sh->samplesize = 2; - + mp_msg(MSGT_DECAUDIO,MSGL_V,"AC_HWMPA initialized, bitrate: %d kb/s\r\n", len); return 1; } diff --git a/libmpcodecs/ad_imaadpcm.c b/libmpcodecs/ad_imaadpcm.c index 7c7f2362e5..12c5ca8811 100644 --- a/libmpcodecs/ad_imaadpcm.c +++ b/libmpcodecs/ad_imaadpcm.c @@ -84,7 +84,7 @@ static int preinit(sh_audio_t *sh_audio) if ((sh_audio->format == 0x11) || (sh_audio->format == 0x61) || (sh_audio->format == 0x1100736d)) { - sh_audio->ds->ss_div = (sh_audio->wf->nBlockAlign - + sh_audio->ds->ss_div = (sh_audio->wf->nBlockAlign - (MS_IMA_ADPCM_PREAMBLE_SIZE * sh_audio->wf->nChannels)) * 2; sh_audio->ds->ss_mul = sh_audio->wf->nBlockAlign; } @@ -103,7 +103,7 @@ static int init(sh_audio_t *sh_audio) sh_audio->channels=sh_audio->wf->nChannels; sh_audio->samplerate=sh_audio->wf->nSamplesPerSec; /* decodes 34 byte -> 64 short*/ - sh_audio->i_bps = + sh_audio->i_bps = (sh_audio->ds->ss_mul * sh_audio->samplerate) / sh_audio->ds->ss_div; sh_audio->samplesize=2; @@ -263,7 +263,7 @@ static int ms_ima_adpcm_decode_block(unsigned short *output, } } } - + decode_nibbles(output, (block_size - MS_IMA_ADPCM_PREAMBLE_SIZE * channels) * 2, channels, @@ -310,8 +310,8 @@ static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int m int res = -1; int (*decode_func)(unsigned short *output, unsigned char *input, int channels, int block_size) = qt_ima_adpcm_decode_block; if (demux_read_data(sh_audio->ds, sh_audio->a_in_buffer, - sh_audio->ds->ss_mul) != - sh_audio->ds->ss_mul) + sh_audio->ds->ss_mul) != + sh_audio->ds->ss_mul) return -1; if ((sh_audio->format == 0x11) || (sh_audio->format == 0x1100736d)) diff --git a/libmpcodecs/ad_liba52.c b/libmpcodecs/ad_liba52.c index 8ddbff8520..315ac1d4c9 100644 --- a/libmpcodecs/ad_liba52.c +++ b/libmpcodecs/ad_liba52.c @@ -85,12 +85,12 @@ while(1){ demux_read_data(sh_audio->ds,sh_audio->a_in_buffer+8,length-8); if(sh_audio->format!=0x2000) swab(sh_audio->a_in_buffer+8,sh_audio->a_in_buffer+8,length-8); - + #ifdef CONFIG_LIBA52_INTERNAL if(crc16_block(sh_audio->a_in_buffer+2,length-2)!=0) mp_msg(MSGT_DECAUDIO,MSGL_STATUS,"a52: CRC check failed! \n"); #endif - + return length; } @@ -312,7 +312,7 @@ static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int m int i,len=-1; if (sh_audio->sample_format == AF_FORMAT_FLOAT_NE) bias = 0; - if(!sh_audio->a_in_buffer_len) + if(!sh_audio->a_in_buffer_len) if(a52_fillbuff(sh_audio)<0) return len; /* EOF */ sh_audio->a_in_buffer_len=0; if (a52_frame (a52_state, sh_audio->a_in_buffer, &flags, &level, bias)){ diff --git a/libmpcodecs/ad_libdv.c b/libmpcodecs/ad_libdv.c index b6f077b844..868d67303f 100644 --- a/libmpcodecs/ad_libdv.c +++ b/libmpcodecs/ad_libdv.c @@ -48,7 +48,7 @@ static int init(sh_audio_t *sh) WAVEFORMATEX *h=sh->wf; if(!h) return 0; - + sh->i_bps=h->nAvgBytesPerSec; sh->channels=h->nChannels; sh->samplerate=h->nSamplesPerSec; @@ -84,7 +84,7 @@ static int decode_audio(sh_audio_t *audio, unsigned char *buf, int minlen, int m if(xx<=0 || !dv_audio_frame) return 0; // EOF? dv_parse_header(decoder, dv_audio_frame); - + if(xx!=decoder->frame_size) mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[AD_LIBDV] Warning! Audio framesize differs! read=%d hdr=%d.\n", xx, decoder->frame_size); @@ -94,7 +94,7 @@ static int decode_audio(sh_audio_t *audio, unsigned char *buf, int minlen, int m /* Interleave the audio into a single buffer */ int i=0; int16_t *bufP=(int16_t*)buf; - + // printf("samples=%d/%d chans=%d mem=%d \n",decoder->audio->samples_this_frame,DV_AUDIO_MAX_SAMPLES, // decoder->audio->num_channels, decoder->audio->samples_this_frame*decoder->audio->num_channels*2); diff --git a/libmpcodecs/ad_libmad.c b/libmpcodecs/ad_libmad.c index fb20f2a77f..ffc8faf94b 100644 --- a/libmpcodecs/ad_libmad.c +++ b/libmpcodecs/ad_libmad.c @@ -22,10 +22,10 @@ LIBAD_EXTERN(libmad) typedef struct mad_decoder_s { - struct mad_synth synth; + struct mad_synth synth; struct mad_stream stream; struct mad_frame frame; - + int have_frame; int output_sampling_rate; @@ -39,14 +39,14 @@ static int preinit(sh_audio_t *sh){ mad_decoder_t *this = (mad_decoder_t *) malloc(sizeof(mad_decoder_t)); memset(this,0,sizeof(mad_decoder_t)); sh->context = this; - + mad_synth_init (&this->synth); mad_stream_init (&this->stream); mad_frame_init (&this->frame); - + sh->audio_out_minsize=2*4608; sh->audio_in_minsize=4096; - + return 1; } @@ -82,12 +82,12 @@ static int init(sh_audio_t *sh){ this->have_frame=read_frame(sh); if(!this->have_frame) return 0; // failed to sync... - + sh->channels=(this->frame.header.mode == MAD_MODE_SINGLE_CHANNEL) ? 1 : 2; sh->samplerate=this->frame.header.samplerate; sh->i_bps=this->frame.header.bitrate/8; sh->samplesize=2; - + return 1; } @@ -137,19 +137,19 @@ static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen) len+=2*nchannels*nsamples; buf+=2*nchannels*nsamples; - + while (nsamples--) { /* output sample(s) in 16-bit signed little-endian PCM */ - + *output++ = scale(*left_ch++); - - if (nchannels == 2) + + if (nchannels == 2) *output++ = scale(*right_ch++); } } } - + return len?len:-1; } diff --git a/libmpcodecs/ad_libvorbis.c b/libmpcodecs/ad_libvorbis.c index 520b07f50a..a10d101126 100644 --- a/libmpcodecs/ad_libvorbis.c +++ b/libmpcodecs/ad_libvorbis.c @@ -162,7 +162,7 @@ static int init(sh_audio_t *sh) if(ov->rg_scale * rg_peak > 1.f) ov->rg_scale = 1.f / rg_peak; /* replaygain: security */ - if(ov->rg_scale > 15.) + if(ov->rg_scale > 15.) ov->rg_scale = 15.; #ifdef CONFIG_TREMOR ov->rg_scale_int = (int)(ov->rg_scale*64.f); @@ -180,7 +180,7 @@ static int init(sh_audio_t *sh) // printf("lower=%d upper=%d \n",(int)ov->vi.bitrate_lower,(int)ov->vi.bitrate_upper); // Setup the decoder - sh->channels=ov->vi.channels; + sh->channels=ov->vi.channels; sh->samplerate=ov->vi.rate; sh->samplesize=2; // assume 128kbit if bitrate not specified in the header @@ -208,7 +208,7 @@ static int control(sh_audio_t *sh,int cmd,void* arg, ...) { switch(cmd) { -#if 0 +#if 0 case ADCTRL_RESYNC_STREAM: return CONTROL_TRUE; case ADCTRL_SKIP_FRAME: @@ -249,7 +249,7 @@ static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen) int clipflag=0; int convsize=(maxlen-len)/(2*ov->vi.channels); // max size! int bout=((samples<convsize)?samples:convsize); - + if(bout<=0) break; // no buffer space /* convert floats to 16 bit signed ints (host order) and @@ -307,7 +307,7 @@ static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen) } } } - + if(clipflag) mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"Clipping in frame %ld\n",(long)(ov->vd.sequence)); len+=2*ov->vi.channels*bout; diff --git a/libmpcodecs/ad_mpc.c b/libmpcodecs/ad_mpc.c index d994951368..0a7b08a618 100644 --- a/libmpcodecs/ad_mpc.c +++ b/libmpcodecs/ad_mpc.c @@ -158,7 +158,7 @@ static int decode_audio(sh_audio_t *sh, unsigned char *buf, int status, len; MPC_SAMPLE_FORMAT *sample_buffer = (MPC_SAMPLE_FORMAT *)buf; mpc_uint32_t *packet = NULL; - + context_t *cd = (context_t *) sh->context; if (maxlen < MAX_FRAMESIZE) { mp_msg(MSGT_DECAUDIO, MSGL_V, "maxlen too small in decode_audio\n"); @@ -215,4 +215,3 @@ static int control(sh_audio_t *sh, int cmd, void* arg, ...) { } return CONTROL_UNKNOWN; } - diff --git a/libmpcodecs/ad_msadpcm.c b/libmpcodecs/ad_msadpcm.c index 641992e18d..57beb9a84c 100644 --- a/libmpcodecs/ad_msadpcm.c +++ b/libmpcodecs/ad_msadpcm.c @@ -60,7 +60,7 @@ static const int8_t ms_adapt_coeff2[] = static int preinit(sh_audio_t *sh_audio) { sh_audio->audio_out_minsize = sh_audio->wf->nBlockAlign * 4; - sh_audio->ds->ss_div = + sh_audio->ds->ss_div = (sh_audio->wf->nBlockAlign - MS_ADPCM_PREAMBLE_SIZE) * 2; sh_audio->audio_in_minsize = sh_audio->ds->ss_mul = sh_audio->wf->nBlockAlign; @@ -208,8 +208,8 @@ static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int m { int res; if (demux_read_data(sh_audio->ds, sh_audio->a_in_buffer, - sh_audio->ds->ss_mul) != - sh_audio->ds->ss_mul) + sh_audio->ds->ss_mul) != + sh_audio->ds->ss_mul) return -1; /* EOF */ res = ms_adpcm_decode_block( diff --git a/libmpcodecs/ad_qtaudio.c b/libmpcodecs/ad_qtaudio.c index 6feeee25b3..f3386957b5 100644 --- a/libmpcodecs/ad_qtaudio.c +++ b/libmpcodecs/ad_qtaudio.c @@ -45,14 +45,14 @@ typedef int (__cdecl* LPFUNC1)(long flag); typedef int (__cdecl* LPFUNC2)(const SoundComponentData *, const SoundComponentData *,SoundConverter *); typedef int (__cdecl* LPFUNC3)(SoundConverter sc); typedef int (__cdecl* LPFUNC4)(void); -typedef int (__cdecl* LPFUNC5)(SoundConverter sc, OSType selector,void * infoPtr); -typedef int (__cdecl* LPFUNC6)(SoundConverter sc, +typedef int (__cdecl* LPFUNC5)(SoundConverter sc, OSType selector,void * infoPtr); +typedef int (__cdecl* LPFUNC6)(SoundConverter sc, unsigned long inputBytesTarget, unsigned long *inputFrames, unsigned long *inputBytes, unsigned long *outputBytes ); -typedef int (__cdecl* LPFUNC7)(SoundConverter sc, - const void *inputPtr, +typedef int (__cdecl* LPFUNC7)(SoundConverter sc, + const void *inputPtr, unsigned long inputFrames, void *outputPtr, unsigned long *outputFrames, @@ -61,7 +61,7 @@ typedef int (__cdecl* LPFUNC8)(SoundConverter sc, void *outputPtr, unsigned long *outputFrames, unsigned long *outputBytes); -typedef int (__cdecl* LPFUNC9)(SoundConverter sc) ; +typedef int (__cdecl* LPFUNC9)(SoundConverter sc) ; static HINSTANCE qtime_qts; // handle to the preloaded quicktime.qts static HINSTANCE qtml_dll; @@ -179,7 +179,7 @@ static int preinit(sh_audio_t *sh){ EnterMovies(); #else if(loader_init()) return 0; // failed to load DLL - + mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"loader_init DONE!\n"); error = InitializeQTML(6+16); @@ -188,7 +188,7 @@ static int preinit(sh_audio_t *sh){ return 0; } #endif - + #if 1 OutputFormatInfo.flags = InputFormatInfo.flags = 0; OutputFormatInfo.sampleCount = InputFormatInfo.sampleCount = 0; @@ -219,7 +219,7 @@ static int preinit(sh_audio_t *sh){ mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"InputBufferSize = %li\n",InputBufferSize); mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"OutputBufferSize = %li\n",OutputBufferSize); mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"FramesToGet = %li\n",FramesToGet); - + InFrameSize=(InputBufferSize+FramesToGet-1)/FramesToGet; OutFrameSize=OutputBufferSize/FramesToGet; @@ -231,7 +231,7 @@ static int preinit(sh_audio_t *sh){ sh->audio_out_minsize=OutputBufferSize; sh->audio_in_minsize=InputBufferSize; - + sh->channels=sh->wf->nChannels; sh->samplerate=sh->wf->nSamplesPerSec; sh->samplesize=2; //(sh->wf->wBitsPerSample+7)/8; @@ -286,7 +286,7 @@ static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen) unsigned long InputBufferSize=0; //size of the input buffer unsigned long ConvertedFrames=0; unsigned long ConvertedBytes=0; - + FramesToGet=minlen/OutFrameSize; if(FramesToGet*OutFrameSize<minlen && (FramesToGet+1)*OutFrameSize<=maxlen) ++FramesToGet; @@ -305,7 +305,7 @@ static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen) if(InputBufferSize>sh->a_in_buffer_len) FramesToGet=sh->a_in_buffer_len/InFrameSize; // not enough data! } - + // printf("\nSoundConverterConvertBuffer(myConv=%p,inbuf=%p,frames=%d,outbuf=%p,&convframes=%p,&convbytes=%p)\n", // myConverter,sh->a_in_buffer,FramesToGet,buf,&ConvertedFrames,&ConvertedBytes); error = SoundConverterConvertBuffer(myConverter,sh->a_in_buffer, @@ -313,7 +313,7 @@ static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen) // printf("SoundConverterConvertBuffer:%i\n",error); // printf("ConvertedFrames = %li\n",ConvertedFrames); // printf("ConvertedBytes = %li\n",ConvertedBytes); - + // InputBufferSize=(ConvertedBytes/OutFrameSize)*InFrameSize; // FIXME!! InputBufferSize=FramesToGet*InFrameSize; sh->a_in_buffer_len-=InputBufferSize; diff --git a/libmpcodecs/ad_realaud.c b/libmpcodecs/ad_realaud.c index e5cab0763e..28ce717a5c 100644 --- a/libmpcodecs/ad_realaud.c +++ b/libmpcodecs/ad_realaud.c @@ -80,7 +80,7 @@ typedef struct { Probably the linux .so-s were compiled with old GCC without setting packing, so it adds 2 bytes padding after the quality field. In windows it seems that there's no padding in it. - + -- alex */ @@ -132,7 +132,7 @@ static int load_syms_linux(char *path) raSetFlavor = dlsym(handle, "RASetFlavor"); raSetDLLAccessPath = dlsym(handle, "SetDLLAccessPath"); raSetPwd = dlsym(handle, "RASetPwd"); // optional, used by SIPR - + if (raCloseCodec && raDecode && raFreeDecoder && (raOpenCodec||raOpenCodec2) && raSetFlavor && /*raSetDLLAccessPath &&*/ raInitDecoder) @@ -140,12 +140,12 @@ static int load_syms_linux(char *path) rv_handle = handle; return 1; } - + mp_msg(MSGT_DECAUDIO,MSGL_WARN,"Cannot resolve symbols - incompatible dll: %s\n",path); dlclose(handle); return 0; } -#endif +#endif #ifdef CONFIG_WIN32DLL @@ -159,7 +159,7 @@ int WINAPI FreeLibrary(void *handle); static int load_syms_windows(char *path) { void *handle; - + mp_msg(MSGT_DECVIDEO, MSGL_V, "opening win32 dll '%s'\n", path); #ifdef WIN32_LOADER Setup_LDT_Keeper(); @@ -180,7 +180,7 @@ static int load_syms_windows(char *path) wraSetFlavor = GetProcAddress(handle, "RASetFlavor"); wraSetDLLAccessPath = GetProcAddress(handle, "SetDLLAccessPath"); wraSetPwd = GetProcAddress(handle, "RASetPwd"); // optional, used by SIPR - + if (wraCloseCodec && wraDecode && wraFreeDecoder && (wraOpenCodec || wraOpenCodec2) && wraSetFlavor && /*wraSetDLLAccessPath &&*/ wraInitDecoder) @@ -189,11 +189,11 @@ static int load_syms_windows(char *path) dll_type = 1; return 1; } - + mp_msg(MSGT_DECAUDIO,MSGL_WARN,"Cannot resolve symbols - incompatible dll: %s\n",path); FreeLibrary(handle); return 0; - + } #endif @@ -210,8 +210,8 @@ static int preinit(sh_audio_t *sh){ /* first try to load linux dlls, if failed and we're supporting win32 dlls, then try to load the windows ones */ - -#ifdef HAVE_LIBDL + +#ifdef HAVE_LIBDL if (strstr(sh->codec->dll,".dll") || !load_syms_linux(path)) #endif #ifdef CONFIG_WIN32DLL @@ -273,7 +273,7 @@ static int preinit(sh_audio_t *sh){ sh->samplesize=sh->wf->wBitsPerSample/8; sh->channels=sh->wf->nChannels; - { + { ra_init_t init_data={ sh->wf->nSamplesPerSec, sh->wf->wBitsPerSample, @@ -323,10 +323,10 @@ static int preinit(sh_audio_t *sh){ #endif raSetPwd(sh->context,"Ardubancel Quazanga"); // set password... lol. } - + if (sh->format == mmioFOURCC('s','i','p','r')) { short flavor; - + if (sh->wf->nAvgBytesPerSec > 1531) flavor = 3; else if (sh->wf->nAvgBytesPerSec > 937) @@ -350,10 +350,10 @@ static int preinit(sh_audio_t *sh){ } // sipr flavor sh->i_bps=sh->wf->nAvgBytesPerSec; - + sh->audio_out_minsize=128000; // no idea how to get... :( sh->audio_in_minsize = sh->wf->nBlockAlign; - + return 1; // return values: 1=OK 0=ERROR } @@ -362,7 +362,7 @@ static int init(sh_audio_t *sh_audio){ // you can store HANDLE or private struct pointer at sh->context // you can access WAVEFORMATEX header at sh->wf - + // set sample format/rate parameters if you didn't do it in preinit() yet. return 1; // return values: 1=OK 0=ERROR @@ -406,7 +406,7 @@ static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen) sh->a_in_buffer_size= sh->a_in_buffer_len=sh->wf->nBlockAlign; } - + #ifdef CONFIG_WIN32DLL if (dll_type == 1) result=wraDecode(sh->context, sh->a_in_buffer+sh->a_in_buffer_size-sh->a_in_buffer_len, sh->wf->nBlockAlign, @@ -416,7 +416,7 @@ static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen) result=raDecode(sh->context, sh->a_in_buffer+sh->a_in_buffer_size-sh->a_in_buffer_len, sh->wf->nBlockAlign, buf, &len, -1); sh->a_in_buffer_len-=sh->wf->nBlockAlign; - + // printf("radecode: %d bytes, res=0x%X \n",len,result); return len; // return value: number of _bytes_ written to output buffer, diff --git a/libmpcodecs/ad_sample.c b/libmpcodecs/ad_sample.c index 69d1440987..74e2a19f18 100644 --- a/libmpcodecs/ad_sample.c +++ b/libmpcodecs/ad_sample.c @@ -23,18 +23,18 @@ static int preinit(sh_audio_t *sh){ // let's check if the driver is available, return 0 if not. // (you should do that if you use external lib(s) which is optional) ... - + // there are default values set for buffering, but you can override them: - + // minimum output buffer size (should be the uncompressed max. frame size) sh->audio_out_minsize=4*2*1024; // in this sample, we assume max 4 channels, // 2 bytes/sample and 1024 samples/frame // Default: 8192 - + // minimum input buffer size (set only if you need input buffering) // (should be the max compressed frame size) sh->audio_in_minsize=2048; // Default: 0 (no input buffer) - + // if you set audio_in_minsize non-zero, the buffer will be allocated // before the init() call by the core, and you can access it via // pointer: sh->audio_in_buffer @@ -43,17 +43,17 @@ static int preinit(sh_audio_t *sh){ // the next few parameters define the audio format (channels, sample type, // in/out bitrate etc.). it's OK to move these to init() if you can set // them only after some initialization: - + sh->samplesize=2; // bytes (not bits!) per sample per channel sh->channels=2; // number of channels sh->samplerate=44100; // samplerate sh->sample_format=AF_FORMAT_S16_LE; // sample format, see libao2/afmt.h - + sh->i_bps=64000/8; // input data rate (compressed bytes per second) // Note: if you have VBR or unknown input rate, set it to some common or // average value, instead of zero. it's used to predict time delay of // buffered compressed bytes, so it must be more-or-less real! - + //sh->o_bps=... // output data rate (uncompressed bytes per second) // Note: you DON'T need to set o_bps in most cases, as it defaults to: // sh->samplesize*sh->channels*sh->samplerate; @@ -62,7 +62,7 @@ static int preinit(sh_audio_t *sh){ // set the compressed and uncompressed packet size (used by the demuxer): sh->ds->ss_mul = 34; // compressed packet size sh->ds->ss_div = 64; // samples per packet - + return 1; // return values: 1=OK 0=ERROR } @@ -71,7 +71,7 @@ static int init(sh_audio_t *sh_audio){ // you can store HANDLE or private struct pointer at sh->context // you can access WAVEFORMATEX header at sh->wf - + // set sample format/rate parameters if you didn't do it in preinit() yet. return 1; // return values: 1=OK 0=ERROR @@ -86,7 +86,7 @@ static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int m // audio decoding. the most important thing :) // parameters you get: - // buf = pointer to the output buffer, you have to store uncompressed + // buf = pointer to the output buffer, you have to store uncompressed // samples there // minlen = requested minimum size (in bytes!) of output. it's just a // _recommendation_, you can decode more or less, it just tell you that @@ -96,8 +96,8 @@ static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int m // buffer, it's the upper-most limit! // note: maxlen will be always greater or equal to sh->audio_out_minsize - // now, let's decode... - + // now, let's decode... + // you can read the compressed stream using the demux stream functions: // demux_read_data(sh->ds, buffer, length) - read 'length' bytes to 'buffer' // ds_get_packet(sh->ds, &buffer) - set ptr buffer to next data packet diff --git a/libmpcodecs/ad_speex.c b/libmpcodecs/ad_speex.c index f77b0b7e89..430d10a61d 100644 --- a/libmpcodecs/ad_speex.c +++ b/libmpcodecs/ad_speex.c @@ -118,4 +118,3 @@ static int decode_audio(sh_audio_t *sh, unsigned char *buf, static int control(sh_audio_t *sh, int cmd, void *arg, ...) { return CONTROL_UNKNOWN; } - diff --git a/libmpcodecs/ad_twin.c b/libmpcodecs/ad_twin.c index 64dc4bbf78..395567128a 100644 --- a/libmpcodecs/ad_twin.c +++ b/libmpcodecs/ad_twin.c @@ -204,7 +204,7 @@ static int bread(char *data, /* Output: Output data array */ unsigned char mask, tmpdat; int retval; vqf_priv_t *priv=sh->context; - + /*--- Main operation ---*/ retval = 0; mask = 0x1; @@ -223,7 +223,7 @@ static int bread(char *data, /* Output: Output data array */ tmpdat = (unsigned char)priv->buf[ibufadr]; tmpdat >>= (BYTE_BIT-ibufbit-1); /* current data bit */ - + idata = ibits*size; /* output data address */ data[idata] = (char)(tmpdat & mask); /* set output data */ for (icl=1; icl<size; icl++) @@ -249,7 +249,7 @@ static int get_bstm(int *data, /* Input: input data */ unsigned work; char tmpbit[BITS_INT]; int retval; - + if ( nbits > BITS_INT ){ mp_msg(MSGT_DECAUDIO, MSGL_ERR, "get_bstm(): %d: %d Error.\n", nbits, BITS_INT); @@ -346,7 +346,7 @@ static int GetPpcInfo( tvqConfInfo *cf, INDEX *index, sh_audio_t *sh) int idiv, i_sup; int bitcount = 0; vqf_priv_t*priv=sh->context; - + for ( idiv=0; idiv<cf->N_DIV_P; idiv++ ){ bitcount += get_bstm(&(index->pls[idiv]), priv->bits_0[BLK_PPC][idiv],sh); /*CB0*/ bitcount += get_bstm(&(index->pls[idiv+cf->N_DIV_P]), priv->bits_1[BLK_PPC][idiv],sh);/*CB1*/ @@ -355,7 +355,7 @@ static int GetPpcInfo( tvqConfInfo *cf, INDEX *index, sh_audio_t *sh) bitcount += get_bstm(&(index->pit[i_sup]), cf->BASF_BIT,sh); bitcount += get_bstm(&(index->pgain[i_sup]), cf->PGAIN_BIT,sh); } - + return bitcount; } @@ -372,7 +372,7 @@ static int GetEbcInfo( tvqConfInfo *cf, tvqConfInfoSubBlock *cfg, INDEX *index, } } } - + return bitcount; } @@ -385,7 +385,7 @@ static int vqf_read_frame(sh_audio_t *sh,INDEX *index) int numFixedBitsPerFrame = TvqGetNumFixedBitsPerFrame(); int btype; vqf_priv_t *priv=sh->context; - + /*--- Initialization ---*/ variableBits = 0; bitcount = 0; @@ -403,10 +403,10 @@ static int vqf_read_frame(sh_audio_t *sh,INDEX *index) cfg = &priv->cf.cfg[btype]; // set the block dependent paremeters table bitcount += variableBits; - + /* Interleaved vector quantization */ bitcount += GetVqInfo( cfg, priv->bits_0[btype], priv->bits_1[btype], variableBits, index, sh ); - + /* Bark-scale envelope */ bitcount += GetBseInfo( &priv->cf, cfg, index, sh ); /* Gain */ @@ -421,7 +421,7 @@ static int vqf_read_frame(sh_audio_t *sh,INDEX *index) if ( cfg->ebc_enable ){ bitcount += GetEbcInfo( &priv->cf, cfg, index, sh ); } - + return bitcount == numFixedBitsPerFrame ? bitcount/8 : 0; } @@ -434,7 +434,7 @@ static void frtobuf_s16(float out[], /* Input --- input data frame */ unsigned ismp, ich; float *ptr; float dtmp; - + for ( ich=0; ich<numChannels; ich++ ){ ptr = out+ich*frameSize; for ( ismp=0; ismp<frameSize; ismp++ ){ @@ -461,7 +461,7 @@ static void frtobuf_float(float out[], /* Input --- input data frame */ unsigned ismp, ich; float *ptr; float dtmp; - + for ( ich=0; ich<numChannels; ich++ ){ ptr = out+ich*frameSize; for ( ismp=0; ismp<frameSize; ismp++ ){ diff --git a/libmpcodecs/ae.c b/libmpcodecs/ae.c index 5e7b76b4e9..425c6c5ff9 100644 --- a/libmpcodecs/ae.c +++ b/libmpcodecs/ae.c @@ -40,11 +40,11 @@ audio_encoder_t *new_audio_encoder(muxer_stream_t *stream, audio_encoding_params audio_encoder_t *encoder; if(! params) return NULL; - + encoder = (audio_encoder_t *) calloc(1, sizeof(audio_encoder_t)); memcpy(&encoder->params, params, sizeof(audio_encoding_params_t)); encoder->stream = stream; - + switch(stream->codec) { case ACODEC_PCM: @@ -79,7 +79,7 @@ audio_encoder_t *new_audio_encoder(muxer_stream_t *stream, audio_encoding_params ris = 0; break; } - + if(! ris) { free(encoder); @@ -92,9 +92,7 @@ audio_encoder_t *new_audio_encoder(muxer_stream_t *stream, audio_encoding_params free(encoder); return NULL; } - + encoder->codec = stream->codec; return encoder; } - - diff --git a/libmpcodecs/ae_faac.c b/libmpcodecs/ae_faac.c index 86ada0ebfb..3ed02d3f05 100644 --- a/libmpcodecs/ae_faac.c +++ b/libmpcodecs/ae_faac.c @@ -18,7 +18,7 @@ static faacEncHandle faac; static faacEncConfigurationPtr config = NULL; -static int +static int param_bitrate = 128, param_quality = 0, param_object_type = 1, @@ -58,11 +58,11 @@ static int bind_faac(audio_encoder_t *encoder, muxer_stream_t *mux_a) mux_a->h.dwScale=encoder->params.samples_per_frame; mux_a->wf->nSamplesPerSec=mux_a->h.dwRate; mux_a->wf->nAvgBytesPerSec = encoder->params.bitrate / 8; - + mux_a->wf->nBlockAlign = mux_a->h.dwScale; mux_a->h.dwSuggestedBufferSize = (encoder->params.audio_preload*mux_a->wf->nAvgBytesPerSec)/1000; mux_a->h.dwSuggestedBufferSize -= mux_a->h.dwSuggestedBufferSize % mux_a->wf->nBlockAlign; - + mux_a->wf->cbSize = decoder_specific_len; mux_a->wf->wBitsPerSample = 0; /* does not apply */ ((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->wID = 1; @@ -70,23 +70,23 @@ static int bind_faac(audio_encoder_t *encoder, muxer_stream_t *mux_a) ((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->nBlockSize = mux_a->wf->nBlockAlign; ((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->nFramesPerBlock = 1; ((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->nCodecDelay = 0; - - // Fix allocation + + // Fix allocation mux_a->wf = realloc(mux_a->wf, sizeof(WAVEFORMATEX)+mux_a->wf->cbSize); - + if(config->inputFormat == FAAC_INPUT_FLOAT) encoder->input_format = AF_FORMAT_FLOAT_NE; else if(config->inputFormat == FAAC_INPUT_32BIT) encoder->input_format = AF_FORMAT_S32_NE; else encoder->input_format = AF_FORMAT_S16_NE; - + encoder->min_buffer_size = mux_a->h.dwSuggestedBufferSize; encoder->max_buffer_size = mux_a->h.dwSuggestedBufferSize*2; if(decoder_specific_buffer && decoder_specific_len) memcpy(mux_a->wf + 1, decoder_specific_buffer, decoder_specific_len); - + return 1; } @@ -107,7 +107,7 @@ static int encode_faac(audio_encoder_t *encoder, uint8_t *dest, void *src, int l // len is divided by the number of bytes per sample enc_frame_size = faacEncEncode(faac, (int32_t*) src, len / divisor, dest, max_size); - + return enc_frame_size; } @@ -117,13 +117,13 @@ int close_faac(audio_encoder_t *encoder) } int mpae_init_faac(audio_encoder_t *encoder) -{ +{ if(encoder->params.channels < 1 || encoder->params.channels > 6 || (param_mpeg != 2 && param_mpeg != 4)) { mp_msg(MSGT_MENCODER, MSGL_FATAL, "AE_FAAC, unsupported number of channels: %d, or mpeg version: %d, exit\n", encoder->params.channels, param_mpeg); return 0; } - + faac = faacEncOpen(encoder->params.sample_rate, encoder->params.channels, &samples_input, &max_bytes_output); if(!faac) { @@ -143,7 +143,7 @@ int mpae_init_faac(audio_encoder_t *encoder) config->quantqual = param_quality; else config->bitRate = param_bitrate / encoder->params.channels; - + if(param_format==33) { config->inputFormat = FAAC_INPUT_FLOAT; @@ -172,26 +172,26 @@ int mpae_init_faac(audio_encoder_t *encoder) config->bandWidth = param_cutoff; if(encoder->params.channels == 6) config->useLfe = 1; - - if(!faacEncSetConfiguration(faac, config)) + + if(!faacEncSetConfiguration(faac, config)) { mp_msg(MSGT_MENCODER, MSGL_FATAL, "AE_FAAC, counldn't set specified parameters, exiting\n"); return 0; } - + if(param_raw) - faacEncGetDecoderSpecificInfo(faac, &decoder_specific_buffer, &decoder_specific_len); + faacEncGetDecoderSpecificInfo(faac, &decoder_specific_buffer, &decoder_specific_len); else decoder_specific_len = 0; - + encoder->params.bitrate = param_bitrate; encoder->params.samples_per_frame = 1024; encoder->decode_buffer_size = divisor * samples_input; //samples * 16 bits_per_sample - + encoder->bind = bind_faac; encoder->get_frame_size = get_frame_size; encoder->encode = encode_faac; encoder->close = close_faac; - + return 1; } diff --git a/libmpcodecs/ae_lame.c b/libmpcodecs/ae_lame.c index 6300a68efb..b719ce3865 100644 --- a/libmpcodecs/ae_lame.c +++ b/libmpcodecs/ae_lame.c @@ -142,11 +142,11 @@ static int bind_lame(audio_encoder_t *encoder, muxer_stream_t *mux_a) ((MPEGLAYER3WAVEFORMAT*)(mux_a->wf))->nBlockSize=encoder->params.samples_per_frame; // ??? ((MPEGLAYER3WAVEFORMAT*)(mux_a->wf))->nFramesPerBlock=1; ((MPEGLAYER3WAVEFORMAT*)(mux_a->wf))->nCodecDelay=0; - + encoder->input_format = AF_FORMAT_S16_NE; encoder->min_buffer_size = 4608; encoder->max_buffer_size = mux_a->h.dwRate * mux_a->wf->nChannels * 2; - + return 1; } @@ -246,7 +246,7 @@ int mpae_init_lame(audio_encoder_t *encoder) lame_print_config(lame); lame_print_internals(lame); } - + encoder->bind = bind_lame; encoder->get_frame_size = get_frame_size; encoder->encode = encode_lame; @@ -256,7 +256,7 @@ int mpae_init_lame(audio_encoder_t *encoder) } #ifdef CONFIG_MP3LAME_PRESET -/* lame_presets_set +/* lame_presets_set taken out of presets_set in lame-3.93.1/frontend/parse.c and modified */ static int lame_presets_set( lame_t gfp, int fast, int cbr, const char* preset_name ) { @@ -395,7 +395,7 @@ static int lame_presets_set( lame_t gfp, int fast, int cbr, const char* preset_ return 0; } #endif - + if (strcmp(preset_name, "standard") == 0) { if (fast > 0) lame_set_preset(gfp, STANDARD_FAST); @@ -404,7 +404,7 @@ static int lame_presets_set( lame_t gfp, int fast, int cbr, const char* preset_ return 0; } - + else if (strcmp(preset_name, "extreme") == 0){ if (fast > 0) lame_set_preset(gfp, EXTREME_FAST); @@ -413,12 +413,12 @@ static int lame_presets_set( lame_t gfp, int fast, int cbr, const char* preset_ return 0; } - - else if (((strcmp(preset_name, "insane") == 0) || + + else if (((strcmp(preset_name, "insane") == 0) || (strcmp(preset_name, "320" ) == 0)) && (fast < 1)) { lame_set_preset(gfp, INSANE); - + return 0; } diff --git a/libmpcodecs/ae_lavc.c b/libmpcodecs/ae_lavc.c index 57f3c29a50..6806287e57 100644 --- a/libmpcodecs/ae_lavc.c +++ b/libmpcodecs/ae_lavc.c @@ -42,18 +42,18 @@ static int bind_lavc(audio_encoder_t *encoder, muxer_stream_t *mux_a) mux_a->h.dwRate = mux_a->wf->nAvgBytesPerSec; if(lavc_actx->block_align) mux_a->h.dwSampleSize = mux_a->h.dwScale = lavc_actx->block_align; - else + else { mux_a->h.dwScale = (mux_a->wf->nAvgBytesPerSec * lavc_actx->frame_size)/ mux_a->wf->nSamplesPerSec; /* for cbr */ - + if ((mux_a->wf->nAvgBytesPerSec * - lavc_actx->frame_size) % mux_a->wf->nSamplesPerSec) + lavc_actx->frame_size) % mux_a->wf->nSamplesPerSec) { mux_a->h.dwScale = lavc_actx->frame_size; mux_a->h.dwRate = lavc_actx->sample_rate; mux_a->h.dwSampleSize = 0; // Blocksize not constant - } - else + } + else mux_a->h.dwSampleSize = 0; } if(mux_a->h.dwSampleSize) @@ -63,7 +63,7 @@ static int bind_lavc(audio_encoder_t *encoder, muxer_stream_t *mux_a) mux_a->h.dwSuggestedBufferSize = (encoder->params.audio_preload*mux_a->wf->nAvgBytesPerSec)/1000; mux_a->h.dwSuggestedBufferSize -= mux_a->h.dwSuggestedBufferSize % mux_a->wf->nBlockAlign; - switch(lavc_param_atag) + switch(lavc_param_atag) { case 0x11: /* imaadpcm */ mux_a->wf->wBitsPerSample = 4; @@ -91,13 +91,13 @@ static int bind_lavc(audio_encoder_t *encoder, muxer_stream_t *mux_a) break; } - // Fix allocation + // Fix allocation mux_a->wf = realloc(mux_a->wf, sizeof(WAVEFORMATEX)+mux_a->wf->cbSize); - + encoder->input_format = AF_FORMAT_S16_NE; encoder->min_buffer_size = mux_a->h.dwSuggestedBufferSize; encoder->max_buffer_size = mux_a->h.dwSuggestedBufferSize*2; - + return 1; } @@ -163,7 +163,7 @@ int mpae_init_lavc(audio_encoder_t *encoder) { encoder->params.samples_per_frame = encoder->params.sample_rate; encoder->params.bitrate = encoder->params.sample_rate * encoder->params.channels * 2 * 8; - + if(!lavc_param_acodec) { mp_tmsg(MSGT_MENCODER, MSGL_FATAL, "Audio LAVC, Missing codec name!\n"); @@ -202,7 +202,7 @@ int mpae_init_lavc(audio_encoder_t *encoder) mp_tmsg(MSGT_MENCODER, MSGL_FATAL, "Audio LAVC, couldn't allocate context!\n"); return 0; } - + // put sample parameters lavc_actx->channels = encoder->params.channels; lavc_actx->sample_rate = encoder->params.sample_rate; @@ -212,7 +212,7 @@ int mpae_init_lavc(audio_encoder_t *encoder) lavc_actx->bit_rate = encoder->params.bitrate = lavc_param_abitrate * 1000; else lavc_actx->bit_rate = encoder->params.bitrate = lavc_param_abitrate; - + /* * Special case for adpcm_ima_wav. @@ -256,4 +256,3 @@ int mpae_init_lavc(audio_encoder_t *encoder) return 1; } - diff --git a/libmpcodecs/ae_pcm.c b/libmpcodecs/ae_pcm.c index 2fcc5e32e0..d18381bf46 100644 --- a/libmpcodecs/ae_pcm.c +++ b/libmpcodecs/ae_pcm.c @@ -28,11 +28,11 @@ static int bind_pcm(audio_encoder_t *encoder, muxer_stream_t *mux_a) mux_a->wf->nAvgBytesPerSec=mux_a->h.dwSampleSize*mux_a->wf->nSamplesPerSec; mux_a->wf->wBitsPerSample=16; mux_a->wf->cbSize=0; // FIXME for l3codeca.acm - + encoder->input_format = (mux_a->wf->wBitsPerSample==8) ? AF_FORMAT_U8 : AF_FORMAT_S16_LE; encoder->min_buffer_size = 16384; encoder->max_buffer_size = mux_a->wf->nAvgBytesPerSec; - + return 1; } @@ -70,14 +70,13 @@ int mpae_init_pcm(audio_encoder_t *encoder) { encoder->params.samples_per_frame = encoder->params.sample_rate; encoder->params.bitrate = encoder->params.sample_rate * encoder->params.channels * 2 * 8; - + encoder->decode_buffer_size = encoder->params.bitrate / 8; encoder->bind = bind_pcm; encoder->get_frame_size = get_frame_size; encoder->set_decoded_len = set_decoded_len; encoder->encode = encode_pcm; encoder->close = close_pcm; - + return 1; } - diff --git a/libmpcodecs/ae_toolame.c b/libmpcodecs/ae_toolame.c index e74f52eea9..04adc1e479 100644 --- a/libmpcodecs/ae_toolame.c +++ b/libmpcodecs/ae_toolame.c @@ -15,16 +15,16 @@ #include "libmpdemux/mp3_hdr.h" -static int +static int param_bitrate = 192, param_psy = 3, param_maxvbr = 0, param_errprot = 0, param_debug = 0; - + static float param_vbr = 0; static char *param_mode = "stereo"; - + m_option_t toolameopts_conf[] = { {"br", ¶m_bitrate, CONF_TYPE_INT, 0, 0, 0, NULL}, {"mode", ¶m_mode, CONF_TYPE_STRING, 0, 0, 0, NULL}, @@ -40,13 +40,13 @@ m_option_t toolameopts_conf[] = { static int bind_toolame(audio_encoder_t *encoder, muxer_stream_t *mux_a) { mpae_toolame_ctx *ctx = (mpae_toolame_ctx *) encoder->priv; - + mux_a->wf = malloc(sizeof(WAVEFORMATEX)+256); mux_a->wf->wFormatTag = 0x50; mux_a->wf->nChannels = encoder->params.channels; mux_a->wf->nSamplesPerSec = encoder->params.sample_rate; mux_a->wf->nAvgBytesPerSec = 125 * encoder->params.bitrate; - + if(ctx->vbr || ((mux_a->wf->nAvgBytesPerSec * encoder->params.samples_per_frame) % mux_a->wf->nSamplesPerSec)) { mux_a->h.dwScale = encoder->params.samples_per_frame; @@ -62,7 +62,7 @@ static int bind_toolame(audio_encoder_t *encoder, muxer_stream_t *mux_a) mux_a->wf->nBlockAlign = mux_a->h.dwScale; mux_a->h.dwSuggestedBufferSize = (encoder->params.audio_preload*mux_a->wf->nAvgBytesPerSec)/1000; mux_a->h.dwSuggestedBufferSize -= mux_a->h.dwSuggestedBufferSize % mux_a->wf->nBlockAlign; - + mux_a->wf->cbSize = 0; //12; mux_a->wf->wBitsPerSample = 0; /* does not apply */ ((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->wID = 1; @@ -70,10 +70,10 @@ static int bind_toolame(audio_encoder_t *encoder, muxer_stream_t *mux_a) ((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->nBlockSize = mux_a->wf->nBlockAlign; ((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->nFramesPerBlock = 1; ((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->nCodecDelay = 0; - - // Fix allocation + + // Fix allocation mux_a->wf = realloc(mux_a->wf, sizeof(WAVEFORMATEX)+mux_a->wf->cbSize); - + encoder->input_format = AF_FORMAT_S16_NE; encoder->min_buffer_size = mux_a->h.dwSuggestedBufferSize; encoder->max_buffer_size = mux_a->h.dwSuggestedBufferSize*2; @@ -86,7 +86,7 @@ static int encode_toolame(audio_encoder_t *encoder, uint8_t *dest, void *src, in mpae_toolame_ctx *ctx = (mpae_toolame_ctx *)encoder->priv; int ret_size = 0, r2, i, nsamples; int16_t *buffer; - + nsamples = len / (2*encoder->params.channels); buffer = (uint16_t *) src; for(i = 0; i < nsamples; i++) @@ -94,9 +94,9 @@ static int encode_toolame(audio_encoder_t *encoder, uint8_t *dest, void *src, in ctx->left_pcm[i] = buffer[ctx->channels * i]; ctx->right_pcm[i] = buffer[(ctx->channels * i) + (ctx->channels - 1)]; } - + toolame_encode_buffer(ctx->toolame_ctx, ctx->left_pcm, ctx->right_pcm, nsamples, dest, max_size, &ret_size); - r2 = mp_decode_mp3_header(dest); + r2 = mp_decode_mp3_header(dest); mp_msg(MSGT_MENCODER, MSGL_DBG2, "\nSIZE: %d, max: %d, r2: %d\n", ret_size, max_size, r2); if(r2 > 0) ret_size = r2; @@ -125,7 +125,7 @@ int mpae_init_toolame(audio_encoder_t *encoder) { int mode; mpae_toolame_ctx *ctx = NULL; - + if(encoder->params.channels == 1) { mp_msg(MSGT_MENCODER, MSGL_INFO, "ae_toolame, 1 audio channel, forcing mono mode\n"); @@ -146,14 +146,14 @@ int mpae_init_toolame(audio_encoder_t *encoder) } else mp_msg(MSGT_MENCODER, MSGL_ERR, "ae_toolame, Toolame can't encode > 2 channels, exiting\n"); - + ctx = (mpae_toolame_ctx *) calloc(1, sizeof(mpae_toolame_ctx)); if(ctx == NULL) { mp_msg(MSGT_MENCODER, MSGL_ERR, "ae_toolame, couldn't alloc a %d bytes context, exiting\n", sizeof(mpae_toolame_ctx)); return 0; } - + ctx->toolame_ctx = toolame_init(); if(ctx->toolame_ctx == NULL) { @@ -167,20 +167,20 @@ int mpae_init_toolame(audio_encoder_t *encoder) if(toolame_setMode(ctx->toolame_ctx, mode) != 0) return 0; - + if(toolame_setPsymodel(ctx->toolame_ctx, param_psy) != 0) return 0; - + if(toolame_setSampleFreq(ctx->toolame_ctx, encoder->params.sample_rate) != 0) return 0; - + if(toolame_setBitrate(ctx->toolame_ctx, param_bitrate) != 0) return 0; - + if(param_errprot) if(toolame_setErrorProtection(ctx->toolame_ctx, TRUE) != 0) return 0; - + if(param_vbr != 0) { if(toolame_setVBR(ctx->toolame_ctx, TRUE) != 0) @@ -196,24 +196,23 @@ int mpae_init_toolame(audio_encoder_t *encoder) } ctx->vbr = 1; } - + if(toolame_setVerbosity(ctx->toolame_ctx, param_debug) != 0) return 0; - + if(toolame_init_params(ctx->toolame_ctx) != 0) return 0; - + ctx->bitrate = param_bitrate; encoder->params.bitrate = ctx->bitrate; encoder->params.samples_per_frame = 1152; encoder->priv = ctx; encoder->decode_buffer_size = 1152 * 2 * encoder->params.channels; - + encoder->bind = bind_toolame; encoder->get_frame_size = get_frame_size; encoder->encode = encode_toolame; encoder->close = close_toolame; - + return 1; } - diff --git a/libmpcodecs/ae_twolame.c b/libmpcodecs/ae_twolame.c index cb0330e18c..37122933ea 100644 --- a/libmpcodecs/ae_twolame.c +++ b/libmpcodecs/ae_twolame.c @@ -15,16 +15,16 @@ #include "libmpdemux/mp3_hdr.h" -static int +static int param_bitrate = 192, param_psy = 3, param_maxvbr = 0, param_errprot = 0, param_debug = 0; - + static float param_vbr = 0; static char *param_mode = "stereo"; - + m_option_t twolameopts_conf[] = { {"br", ¶m_bitrate, CONF_TYPE_INT, 0, 0, 0, NULL}, {"mode", ¶m_mode, CONF_TYPE_STRING, 0, 0, 0, NULL}, @@ -40,13 +40,13 @@ m_option_t twolameopts_conf[] = { static int bind_twolame(audio_encoder_t *encoder, muxer_stream_t *mux_a) { mpae_twolame_ctx *ctx = encoder->priv; - + mux_a->wf = malloc(sizeof(WAVEFORMATEX)+256); mux_a->wf->wFormatTag = 0x50; mux_a->wf->nChannels = encoder->params.channels; mux_a->wf->nSamplesPerSec = encoder->params.sample_rate; mux_a->wf->nAvgBytesPerSec = encoder->params.bitrate / 8; - + if(ctx->vbr || ((mux_a->wf->nAvgBytesPerSec * encoder->params.samples_per_frame) % mux_a->wf->nSamplesPerSec)) { mux_a->h.dwScale = encoder->params.samples_per_frame; @@ -62,7 +62,7 @@ static int bind_twolame(audio_encoder_t *encoder, muxer_stream_t *mux_a) mux_a->wf->nBlockAlign = mux_a->h.dwScale; mux_a->h.dwSuggestedBufferSize = (encoder->params.audio_preload*mux_a->wf->nAvgBytesPerSec)/1000; mux_a->h.dwSuggestedBufferSize -= mux_a->h.dwSuggestedBufferSize % mux_a->wf->nBlockAlign; - + mux_a->wf->cbSize = 0; //12; mux_a->wf->wBitsPerSample = 0; /* does not apply */ ((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->wID = 1; @@ -70,10 +70,10 @@ static int bind_twolame(audio_encoder_t *encoder, muxer_stream_t *mux_a) ((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->nBlockSize = mux_a->wf->nBlockAlign; ((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->nFramesPerBlock = 1; ((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->nCodecDelay = 0; - - // Fix allocation + + // Fix allocation mux_a->wf = realloc(mux_a->wf, sizeof(WAVEFORMATEX)+mux_a->wf->cbSize); - + encoder->input_format = AF_FORMAT_S16_NE; encoder->min_buffer_size = mux_a->h.dwSuggestedBufferSize; encoder->max_buffer_size = mux_a->h.dwSuggestedBufferSize*2; @@ -85,10 +85,10 @@ static int encode_twolame(audio_encoder_t *encoder, uint8_t *dest, void *src, in { mpae_twolame_ctx *ctx = encoder->priv; int ret_size = 0, r2; - + len /= (2*encoder->params.channels); ret_size = twolame_encode_buffer_interleaved(ctx->twolame_ctx, src, len, dest, max_size); - r2 = mp_decode_mp3_header(dest); + r2 = mp_decode_mp3_header(dest); mp_msg(MSGT_MENCODER, MSGL_DBG2, "\nSIZE: %d, max: %d, r2: %d\n", ret_size, max_size, r2); if(r2 > 0) ret_size = r2; @@ -117,7 +117,7 @@ int mpae_init_twolame(audio_encoder_t *encoder) { int mode; mpae_twolame_ctx *ctx = NULL; - + if(encoder->params.channels == 1) { mp_msg(MSGT_MENCODER, MSGL_INFO, "ae_twolame, 1 audio channel, forcing mono mode\n"); @@ -138,14 +138,14 @@ int mpae_init_twolame(audio_encoder_t *encoder) } else mp_msg(MSGT_MENCODER, MSGL_ERR, "ae_twolame, Twolame can't encode > 2 channels, exiting\n"); - + ctx = calloc(1, sizeof(mpae_twolame_ctx)); if(ctx == NULL) { mp_msg(MSGT_MENCODER, MSGL_ERR, "ae_twolame, couldn't alloc a %d bytes context, exiting\n", sizeof(mpae_twolame_ctx)); return 0; } - + ctx->twolame_ctx = twolame_init(); if(ctx->twolame_ctx == NULL) { @@ -159,28 +159,28 @@ int mpae_init_twolame(audio_encoder_t *encoder) return 0; if(twolame_set_mode(ctx->twolame_ctx, mode) != 0) return 0; - + if(twolame_set_in_samplerate(ctx->twolame_ctx, encoder->params.sample_rate) != 0) return 0; - + if(twolame_set_out_samplerate(ctx->twolame_ctx, encoder->params.sample_rate) != 0) return 0; - + if(encoder->params.sample_rate < 32000) twolame_set_version(ctx->twolame_ctx, TWOLAME_MPEG2); else twolame_set_version(ctx->twolame_ctx, TWOLAME_MPEG1); - + if(twolame_set_psymodel(ctx->twolame_ctx, param_psy) != 0) return 0; - + if(twolame_set_bitrate(ctx->twolame_ctx, param_bitrate) != 0) return 0; - + if(param_errprot) if(twolame_set_error_protection(ctx->twolame_ctx, TRUE) != 0) return 0; - + if(param_vbr != 0) { if(twolame_set_VBR(ctx->twolame_ctx, TRUE) != 0) @@ -196,23 +196,22 @@ int mpae_init_twolame(audio_encoder_t *encoder) } ctx->vbr = 1; } - + if(twolame_set_verbosity(ctx->twolame_ctx, param_debug) != 0) return 0; - + if(twolame_init_params(ctx->twolame_ctx) != 0) return 0; - + encoder->params.bitrate = param_bitrate * 1000; encoder->params.samples_per_frame = 1152; encoder->priv = ctx; encoder->decode_buffer_size = 1152 * 2 * encoder->params.channels; - + encoder->bind = bind_twolame; encoder->get_frame_size = get_frame_size; encoder->encode = encode_twolame; encoder->close = close_twolame; - + return 1; } - diff --git a/libmpcodecs/mp_image.c b/libmpcodecs/mp_image.c index fd1b3c3997..3eb524d491 100644 --- a/libmpcodecs/mp_image.c +++ b/libmpcodecs/mp_image.c @@ -45,7 +45,7 @@ mp_image_t* alloc_mpi(int w, int h, unsigned long int fmt) { if(!mpi->stride[0]) mpi->stride[0]=mpi->width*mpi->bpp/8; } mpi->flags|=MP_IMGFLAG_ALLOCATED; - + return mpi; } @@ -58,7 +58,7 @@ void copy_mpi(mp_image_t *dmpi, mp_image_t *mpi) { memcpy_pic(dmpi->planes[2], mpi->planes[2], mpi->chroma_width, mpi->chroma_height, dmpi->stride[2],mpi->stride[2]); } else { - memcpy_pic(dmpi->planes[0],mpi->planes[0], + memcpy_pic(dmpi->planes[0],mpi->planes[0], mpi->w*(dmpi->bpp/8), mpi->h, dmpi->stride[0],mpi->stride[0]); } diff --git a/libmpcodecs/native/rtjpegn.c b/libmpcodecs/native/rtjpegn.c index 0eea073b61..66089b0ecf 100644 --- a/libmpcodecs/native/rtjpegn.c +++ b/libmpcodecs/native/rtjpegn.c @@ -1,6 +1,6 @@ -/* +/* RTjpeg (C) Justin Schoeman 1998 (justin@suntiger.ee.up.ac.za) - + With modifications by: (c) 1998, 1999 by Joerg Walter <trouble@moes.pmnet.uni-oldenburg.de> and @@ -55,14 +55,14 @@ static const unsigned char RTjpeg_ZZ[64]={ 63 }; static const __u64 RTjpeg_aan_tab[64]={ -4294967296ULL, 5957222912ULL, 5611718144ULL, 5050464768ULL, 4294967296ULL, 3374581504ULL, 2324432128ULL, 1184891264ULL, -5957222912ULL, 8263040512ULL, 7783580160ULL, 7005009920ULL, 5957222912ULL, 4680582144ULL, 3224107520ULL, 1643641088ULL, -5611718144ULL, 7783580160ULL, 7331904512ULL, 6598688768ULL, 5611718144ULL, 4408998912ULL, 3036936960ULL, 1548224000ULL, -5050464768ULL, 7005009920ULL, 6598688768ULL, 5938608128ULL, 5050464768ULL, 3968072960ULL, 2733115392ULL, 1393296000ULL, -4294967296ULL, 5957222912ULL, 5611718144ULL, 5050464768ULL, 4294967296ULL, 3374581504ULL, 2324432128ULL, 1184891264ULL, -3374581504ULL, 4680582144ULL, 4408998912ULL, 3968072960ULL, 3374581504ULL, 2651326208ULL, 1826357504ULL, 931136000ULL, -2324432128ULL, 3224107520ULL, 3036936960ULL, 2733115392ULL, 2324432128ULL, 1826357504ULL, 1258030336ULL, 641204288ULL, -1184891264ULL, 1643641088ULL, 1548224000ULL, 1393296000ULL, 1184891264ULL, 931136000ULL, 641204288ULL, 326894240ULL, +4294967296ULL, 5957222912ULL, 5611718144ULL, 5050464768ULL, 4294967296ULL, 3374581504ULL, 2324432128ULL, 1184891264ULL, +5957222912ULL, 8263040512ULL, 7783580160ULL, 7005009920ULL, 5957222912ULL, 4680582144ULL, 3224107520ULL, 1643641088ULL, +5611718144ULL, 7783580160ULL, 7331904512ULL, 6598688768ULL, 5611718144ULL, 4408998912ULL, 3036936960ULL, 1548224000ULL, +5050464768ULL, 7005009920ULL, 6598688768ULL, 5938608128ULL, 5050464768ULL, 3968072960ULL, 2733115392ULL, 1393296000ULL, +4294967296ULL, 5957222912ULL, 5611718144ULL, 5050464768ULL, 4294967296ULL, 3374581504ULL, 2324432128ULL, 1184891264ULL, +3374581504ULL, 4680582144ULL, 4408998912ULL, 3968072960ULL, 3374581504ULL, 2651326208ULL, 1826357504ULL, 931136000ULL, +2324432128ULL, 3224107520ULL, 3036936960ULL, 2733115392ULL, 2324432128ULL, 1826357504ULL, 1258030336ULL, 641204288ULL, +1184891264ULL, 1643641088ULL, 1548224000ULL, 1393296000ULL, 1184891264ULL, 931136000ULL, 641204288ULL, 326894240ULL, }; #if !HAVE_MMX @@ -115,7 +115,7 @@ static const unsigned char RTjpeg_chrom_quant_tbl[64] = { 99, 99, 99, 99, 99, 99, 99, 99 }; -#ifdef BETTERCOMPRESSION +#ifdef BETTERCOMPRESSION /*--------------------------------------------------*/ /* better encoding, but needs a lot more cpu time */ @@ -160,19 +160,19 @@ static int RTjpeg_b2s(__s16 *data, __s8 *strm, __u8 bt8) bitten = ((unsigned char)ci) << 2; if (ci==0) { - ((__u8*)strm)[1]= bitten; + ((__u8*)strm)[1]= bitten; co = 2; return (int)co; } - - /* bitoff=0 because the high 6bit contain first non zero position */ + + /* bitoff=0 because the high 6bit contain first non zero position */ bitoff = 0; co = 1; for(; ci>0; ci--) { ZZvalue = data[RTjpeg_ZZ[ci]]; - + switch(ZZvalue) { case 0: break; @@ -189,21 +189,21 @@ static int RTjpeg_b2s(__s16 *data, __s8 *strm, __u8 bt8) } if( bitoff == 0 ) { - ((__u8*)strm)[co]= bitten; + ((__u8*)strm)[co]= bitten; bitten = 0; - bitoff = 8; + bitoff = 8; co++; } /* "fall through" */ - bitoff-=2; + bitoff-=2; } - + /* ci must be 0 */ if(bitoff != 6) { - ((__u8*)strm)[co]= bitten; + ((__u8*)strm)[co]= bitten; co++; - + } goto BAUCHWEH; @@ -218,7 +218,7 @@ HERZWEH: break; case 2: case 0: - ((__u8*)strm)[co]= bitten; + ((__u8*)strm)[co]= bitten; bitoff = 4; co++; bitten = 0; // clear half nibble values in bitten @@ -234,48 +234,48 @@ HERZWEH: if( (ZZvalue > 7) || (ZZvalue < -7) ) { bitten |= (0x08<<bitoff); goto HIRNWEH; - } - + } + bitten |= (ZZvalue&0xf)<<bitoff; if( bitoff == 0 ) { - ((__u8*)strm)[co]= bitten; + ((__u8*)strm)[co]= bitten; bitten = 0; bitoff = 8; co++; } /* "fall thru" */ bitoff-=4; } - + /* ci must be 0 */ if( bitoff == 0 ) { - ((__u8*)strm)[co]= bitten; + ((__u8*)strm)[co]= bitten; co++; - } + } goto BAUCHWEH; HIRNWEH: - ((__u8*)strm)[co]= bitten; + ((__u8*)strm)[co]= bitten; co++; - + /* bitting is over now we bite */ for(; ci>0; ci--) { ZZvalue = data[RTjpeg_ZZ[ci]]; - if(ZZvalue>0) + if(ZZvalue>0) { strm[co++]=(__s8)(ZZvalue>127)?127:ZZvalue; - } - else + } + else { strm[co++]=(__s8)(ZZvalue<-128)?-128:ZZvalue; } } - + BAUCHWEH: /* we gotoo much now we are ill */ @@ -312,39 +312,39 @@ static int RTjpeg_b2s(__s16 *data, __s8 *strm, __u8 bt8) (__u8)strm[0]=(__u8)(data[RTjpeg_ZZ[0]]>254) ? 254:((data[RTjpeg_ZZ[0]]<0)?0:data[RTjpeg_ZZ[0]]); - for(ci=1; ci<=bt8; ci++) + for(ci=1; ci<=bt8; ci++) { ZZvalue = data[RTjpeg_ZZ[ci]]; - if(ZZvalue>0) + if(ZZvalue>0) { strm[co++]=(__s8)(ZZvalue>127)?127:ZZvalue; - } - else + } + else { strm[co++]=(__s8)(ZZvalue<-128)?-128:ZZvalue; } } - for(; ci<64; ci++) + for(; ci<64; ci++) { ZZvalue = data[RTjpeg_ZZ[ci]]; if(ZZvalue>0) { strm[co++]=(__s8)(ZZvalue>63)?63:ZZvalue; - } + } else if(ZZvalue<0) { strm[co++]=(__s8)(ZZvalue<-64)?-64:ZZvalue; - } + } else /* compress zeros */ { tmp=ci; do { ci++; - } + } while((ci<64)&&(data[RTjpeg_ZZ[ci]]==0)); strm[co++]=(__s8)(63+(ci-tmp)); @@ -367,7 +367,7 @@ static int RTjpeg_s2b(__s16 *data, __s8 *strm, __u8 bt8, __u32 *qtbl) i=RTjpeg_ZZ[co]; data[i]=strm[ci++]*qtbl[i]; } - + for(; co<64; co++) { if(strm[ci]>63) @@ -391,7 +391,7 @@ static void RTjpeg_quant_init(void) { int i; __s16 *qtbl; - + qtbl=(__s16 *)RTjpeg_lqt; for(i=0; i<64; i++)qtbl[i]=(__s16)RTjpeg_lqt[i]; @@ -406,36 +406,36 @@ static void RTjpeg_quant(__s16 *block, __s32 *qtbl) { int i; mmx_t *bl, *ql; - + ql=(mmx_t *)qtbl; bl=(mmx_t *)block; - + movq_m2r(RTjpeg_ones, mm6); movq_m2r(RTjpeg_half, mm7); - for(i=16; i; i--) + for(i=16; i; i--) { movq_m2r(*(ql++), mm0); /* quant vals (4) */ movq_m2r(*bl, mm2); /* block vals (4) */ movq_r2r(mm0, mm1); movq_r2r(mm2, mm3); - + punpcklwd_r2r(mm6, mm0); /* 1 qb 1 qa */ punpckhwd_r2r(mm6, mm1); /* 1 qd 1 qc */ - + punpcklwd_r2r(mm7, mm2); /* 32767 bb 32767 ba */ punpckhwd_r2r(mm7, mm3); /* 32767 bd 32767 bc */ - + pmaddwd_r2r(mm2, mm0); /* 32767+bb*qb 32767+ba*qa */ pmaddwd_r2r(mm3, mm1); /* 32767+bd*qd 32767+bc*qc */ - + psrad_i2r(16, mm0); psrad_i2r(16, mm1); - + packssdw_r2r(mm1, mm0); - + movq_r2m(mm0, *(bl++)); - + } } #else @@ -446,7 +446,7 @@ static void RTjpeg_quant_init(void) static void RTjpeg_quant(__s16 *block, __s32 *qtbl) { int i; - + for(i=0; i<64; i++) block[i]=(__s16)((block[i]*qtbl[i]+32767)>>16); } @@ -477,7 +477,7 @@ static mmx_t RTjpeg_zero ={0x0000000000000000LL}; static void RTjpeg_dct_init(void) { int i; - + for(i=0; i<64; i++) { RTjpeg_lqt[i]=(((__u64)RTjpeg_lqt[i]<<32)/RTjpeg_aan_tab[i]); @@ -507,19 +507,19 @@ static void RTjpeg_dctY(__u8 *idata, __s16 *odata, int rskip) tmp5 = idataptr[2] - idataptr[5]; tmp3 = idataptr[3] + idataptr[4]; tmp4 = idataptr[3] - idataptr[4]; - + tmp10 = (tmp0 + tmp3); /* phase 2 */ tmp13 = tmp0 - tmp3; tmp11 = (tmp1 + tmp2); tmp12 = tmp1 - tmp2; - + wsptr[0] = (tmp10 + tmp11)<<8; /* phase 3 */ wsptr[4] = (tmp10 - tmp11)<<8; - + z1 = D_MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */ wsptr[2] = (tmp13<<8) + z1; /* phase 5 */ wsptr[6] = (tmp13<<8) - z1; - + tmp10 = tmp4 + tmp5; /* phase 2 */ tmp11 = tmp5 + tmp6; tmp12 = tmp6 + tmp7; @@ -552,15 +552,15 @@ static void RTjpeg_dctY(__u8 *idata, __s16 *odata, int rskip) tmp5 = wsptr[16] - wsptr[40]; tmp3 = wsptr[24] + wsptr[32]; tmp4 = wsptr[24] - wsptr[32]; - + tmp10 = tmp0 + tmp3; /* phase 2 */ tmp13 = tmp0 - tmp3; tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; - + odataptr[0] = DESCALE10(tmp10 + tmp11); /* phase 3 */ odataptr[32] = DESCALE10(tmp10 - tmp11); - + z1 = D_MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */ odataptr[16] = DESCALE20((tmp13<<8) + z1); /* phase 5 */ odataptr[48] = DESCALE20((tmp13<<8) - z1); @@ -595,85 +595,85 @@ static void RTjpeg_dctY(__u8 *idata, __s16 *odata, int rskip) movq_m2r(RTjpeg_zero, mm2); - movq_m2r(*idata2, mm0); - movq_r2r(mm0, mm1); + movq_m2r(*idata2, mm0); + movq_r2r(mm0, mm1); punpcklbw_r2r(mm2, mm0); movq_r2m(mm0, *(dataptr)); punpckhbw_r2r(mm2, mm1); movq_r2m(mm1, *(dataptr+1)); - + idata2 += rskip; - movq_m2r(*idata2, mm0); - movq_r2r(mm0, mm1); + movq_m2r(*idata2, mm0); + movq_r2r(mm0, mm1); punpcklbw_r2r(mm2, mm0); movq_r2m(mm0, *(dataptr+2)); punpckhbw_r2r(mm2, mm1); movq_r2m(mm1, *(dataptr+3)); - + idata2 += rskip; - movq_m2r(*idata2, mm0); - movq_r2r(mm0, mm1); + movq_m2r(*idata2, mm0); + movq_r2r(mm0, mm1); punpcklbw_r2r(mm2, mm0); movq_r2m(mm0, *(dataptr+4)); punpckhbw_r2r(mm2, mm1); movq_r2m(mm1, *(dataptr+5)); - + idata2 += rskip; - movq_m2r(*idata2, mm0); - movq_r2r(mm0, mm1); + movq_m2r(*idata2, mm0); + movq_r2r(mm0, mm1); punpcklbw_r2r(mm2, mm0); movq_r2m(mm0, *(dataptr+6)); punpckhbw_r2r(mm2, mm1); movq_r2m(mm1, *(dataptr+7)); - + idata2 += rskip; - movq_m2r(*idata2, mm0); - movq_r2r(mm0, mm1); + movq_m2r(*idata2, mm0); + movq_r2r(mm0, mm1); punpcklbw_r2r(mm2, mm0); movq_r2m(mm0, *(dataptr+8)); punpckhbw_r2r(mm2, mm1); movq_r2m(mm1, *(dataptr+9)); - + idata2 += rskip; - movq_m2r(*idata2, mm0); - movq_r2r(mm0, mm1); + movq_m2r(*idata2, mm0); + movq_r2r(mm0, mm1); punpcklbw_r2r(mm2, mm0); movq_r2m(mm0, *(dataptr+10)); punpckhbw_r2r(mm2, mm1); movq_r2m(mm1, *(dataptr+11)); - + idata2 += rskip; - movq_m2r(*idata2, mm0); - movq_r2r(mm0, mm1); + movq_m2r(*idata2, mm0); + movq_r2r(mm0, mm1); punpcklbw_r2r(mm2, mm0); movq_r2m(mm0, *(dataptr+12)); punpckhbw_r2r(mm2, mm1); movq_r2m(mm1, *(dataptr+13)); - + idata2 += rskip; - movq_m2r(*idata2, mm0); - movq_r2r(mm0, mm1); + movq_m2r(*idata2, mm0); + movq_r2r(mm0, mm1); punpcklbw_r2r(mm2, mm0); movq_r2m(mm0, *(dataptr+14)); @@ -686,15 +686,15 @@ static void RTjpeg_dctY(__u8 *idata, __s16 *odata, int rskip) movq_m2r(*(dataptr+9), mm7); // m03:m02|m01:m00 - first line (line 4)and copy into m5 movq_m2r(*(dataptr+13), mm6); // m23:m22|m21:m20 - third line (line 6)and copy into m2 - movq_r2r(mm7, mm5); + movq_r2r(mm7, mm5); punpcklwd_m2r(*(dataptr+11), mm7); // m11:m01|m10:m00 - interleave first and second lines - movq_r2r(mm6, mm2); + movq_r2r(mm6, mm2); punpcklwd_m2r(*(dataptr+15), mm6); // m31:m21|m30:m20 - interleave third and fourth lines movq_r2r(mm7, mm1); - movq_m2r(*(dataptr+11), mm3); // m13:m13|m11:m10 - second line + movq_m2r(*(dataptr+11), mm3); // m13:m13|m11:m10 - second line punpckldq_r2r(mm6, mm7); // m30:m20|m10:m00 - interleave to produce result 1 movq_m2r(*(dataptr+15), mm0); // m13:m13|m11:m10 - fourth line @@ -702,7 +702,7 @@ static void RTjpeg_dctY(__u8 *idata, __s16 *odata, int rskip) movq_r2m(mm7,*(dataptr+9)); // write result 1 punpckhwd_r2r(mm3, mm5); // m13:m03|m12:m02 - interleave first and second lines - + movq_r2m(mm1,*(dataptr+11)); // write result 2 punpckhwd_r2r(mm0, mm2); // m33:m23|m32:m22 - interleave third and fourth lines @@ -728,7 +728,7 @@ static void RTjpeg_dctY(__u8 *idata, __s16 *odata, int rskip) movq_r2r(mm0, mm4); // - movq_m2r(*(dataptr+8), mm1); // n03:n02|n01:n00 - first line + movq_m2r(*(dataptr+8), mm1); // n03:n02|n01:n00 - first line punpckldq_r2r(mm2, mm0); // m30:m20|m10:m00 - interleave to produce first result movq_m2r(*(dataptr+12), mm3); // n23:n22|n21:n20 - third line @@ -843,14 +843,14 @@ static void RTjpeg_dctY(__u8 *idata, __s16 *odata, int rskip) movq_r2r(mm0, mm3); psllw_i2r(2, mm6); // m8 * 2^2 - paddw_r2r(mm1, mm0); + paddw_r2r(mm1, mm0); pmulhw_m2r(RTjpeg_C4, mm6); // z1 - psubw_r2r(mm1, mm3); + psubw_r2r(mm1, mm3); movq_r2m(mm0, *dataptr); movq_r2r(mm7, mm0); - + /* Odd part */ movq_r2m(mm3, *(dataptr+8)); paddw_r2r(mm5, mm4); // tmp10 @@ -872,7 +872,7 @@ static void RTjpeg_dctY(__u8 *idata, __s16 *odata, int rskip) psubw_r2r(mm2, mm1); // tmp10 - tmp12 psllw_i2r(2, mm4); // m8 * 2^2 - movq_m2r(RTjpeg_C2mC6, mm0); + movq_m2r(RTjpeg_C2mC6, mm0); psllw_i2r(2, mm1); pmulhw_m2r(RTjpeg_C6, mm1); // z5 @@ -972,7 +972,7 @@ static void RTjpeg_dctY(__u8 *idata, __s16 *odata, int rskip) movq_r2m(mm0, *(dataptr+1)); //save y0 movq_r2r(mm7, mm0); // copy tmp13 - + /* odd part */ movq_r2m(mm3, *(dataptr+9)); //save y4 @@ -999,14 +999,14 @@ static void RTjpeg_dctY(__u8 *idata, __s16 *odata, int rskip) psllw_i2r(2, mm1); // shift (tmp10-tmp12) pmulhw_m2r(RTjpeg_C6, mm1); // z5 - psllw_i2r(2, mm5); // prepare for multiply + psllw_i2r(2, mm5); // prepare for multiply pmulhw_r2r(mm0, mm4); // multiply by converted real /* stage 5 */ pmulhw_m2r(RTjpeg_C4, mm5); // z3 - psllw_i2r(2, mm2); // prepare for multiply + psllw_i2r(2, mm2); // prepare for multiply pmulhw_m2r(RTjpeg_C2pC6, mm2); // multiply movq_r2r(mm3, mm0); // copy tmp7 @@ -1032,7 +1032,7 @@ static void RTjpeg_dctY(__u8 *idata, __s16 *odata, int rskip) movq_r2m(mm6, *(dataptr+3)); //save y1 psubw_r2r(mm2, mm0); // y7 - + /************************************************************************************************ Start of Transpose ************************************************************************************************/ @@ -1077,9 +1077,9 @@ static void RTjpeg_dctY(__u8 *idata, __s16 *odata, int rskip) punpcklwd_m2r(*(dataptr+7), mm2); // m31:m21|m30:m20 - interleave third and fourth lines movq_r2r(mm0, mm4); // copy first intermediate result - - movq_m2r(*(dataptr+8), mm1); // n03:n02|n01:n00 - first line + + movq_m2r(*(dataptr+8), mm1); // n03:n02|n01:n00 - first line punpckldq_r2r(mm2, mm0); // m30:m20|m10:m00 - interleave to produce first result movq_m2r(*(dataptr+12), mm3); // n23:n22|n21:n20 - third line @@ -1106,7 +1106,7 @@ static void RTjpeg_dctY(__u8 *idata, __s16 *odata, int rskip) movq_r2r(mm1, mm4); // copy second intermediate result movq_r2m(mm6, *(dataptr+12)); // write result 3 out - punpckldq_r2r(mm3, mm1); // + punpckldq_r2r(mm3, mm1); // punpckhwd_m2r(*(dataptr+14), mm0); // n33:n23|n32:n22 - interleave third and fourth lines movq_r2r(mm2, mm6); // copy second intermediate result @@ -1133,7 +1133,7 @@ static void RTjpeg_dctY(__u8 *idata, __s16 *odata, int rskip) punpcklwd_m2r(*(dataptr+2), mm0); // m11:m01|m10:m00 - interleave first and second lines movq_r2r(mm7, mm4); // copy third line - + punpcklwd_m2r(*(dataptr+6), mm7); // m31:m21|m30:m20 - interleave third and fourth lines movq_r2r(mm0, mm1); // copy first intermediate result @@ -1193,14 +1193,14 @@ static void RTjpeg_dctY(__u8 *idata, __s16 *odata, int rskip) movq_r2r(mm0, mm3); psllw_i2r(2, mm6); // m8 * 2^2 - paddw_r2r(mm1, mm0); + paddw_r2r(mm1, mm0); pmulhw_m2r(RTjpeg_C4, mm6); // z1 - psubw_r2r(mm1, mm3); + psubw_r2r(mm1, mm3); movq_r2m(mm0, *dataptr); movq_r2r(mm7, mm0); - + /* Odd part */ movq_r2m(mm3, *(dataptr+8)); paddw_r2r(mm5, mm4); // tmp10 @@ -1321,7 +1321,7 @@ static void RTjpeg_dctY(__u8 *idata, __s16 *odata, int rskip) movq_r2m(mm0, *(dataptr+1)); //save y0 movq_r2r(mm7, mm0); // copy tmp13 - + /* odd part */ movq_r2m(mm3, *(dataptr+9)); //save y4 @@ -1348,14 +1348,14 @@ static void RTjpeg_dctY(__u8 *idata, __s16 *odata, int rskip) psllw_i2r(2, mm1); // shift (tmp10-tmp12) pmulhw_m2r(RTjpeg_C6, mm1); // z5 - psllw_i2r(2, mm5); // prepare for multiply + psllw_i2r(2, mm5); // prepare for multiply pmulhw_r2r(mm0, mm4); // multiply by converted real /* stage 5 */ pmulhw_m2r(RTjpeg_C4, mm5); // z3 - psllw_i2r(2, mm2); // prepare for multiply + psllw_i2r(2, mm2); // prepare for multiply pmulhw_m2r(RTjpeg_C2pC6, mm2); // multiply movq_r2r(mm3, mm0); // copy tmp7 @@ -1385,7 +1385,7 @@ static void RTjpeg_dctY(__u8 *idata, __s16 *odata, int rskip) movq_r2m(mm6, *(dataptr+3)); //save y1 movq_r2m(mm0, *(dataptr+15)); //save y7 - + #endif } @@ -1411,12 +1411,12 @@ Initialise all the cache-aliged data blocks static void RTjpeg_init_data(void) { unsigned long dptr; - + dptr=(unsigned long)&(RTjpeg_alldata[0]); dptr+=32; dptr=dptr>>5; dptr=dptr<<5; /* cache align data */ - + RTjpeg_block=(__s16 *)dptr; dptr+=sizeof(__s16)*64; RTjpeg_lqt=(__s32 *)dptr; @@ -1443,7 +1443,7 @@ static void RTjpeg_init_Q(__u8 Q) { int i; __u64 qual; - + qual=(__u64)Q<<(32-7); /* 32 bit FP, 255=2, 0=0 */ for(i=0; i<64; i++) @@ -1457,7 +1457,7 @@ static void RTjpeg_init_Q(__u8 Q) RTjpeg_lqt[i]=((1<<16)/RTjpeg_liqt[i])>>3; RTjpeg_cqt[i]=((1<<16)/RTjpeg_ciqt[i])>>3; } - + RTjpeg_lb8=0; while(RTjpeg_liqt[RTjpeg_ZZ[++RTjpeg_lb8]]<=8); RTjpeg_lb8--; @@ -1475,21 +1475,21 @@ External Function Initialise compression. -Input: buf -> pointer to 128 ints for quant values store to pass back to +Input: buf -> pointer to 128 ints for quant values store to pass back to init_decompress. width -> width of image height -> height of image Q -> quality factor (192=best, 32=worst) - + */ void RTjpeg_init_compress(__u32 *buf, int width, int height, __u8 Q) { int i; __u64 qual; - + RTjpeg_init_data(); - + RTjpeg_width=width; RTjpeg_height=height; RTjpeg_Ywidth = RTjpeg_width>>3; @@ -1510,14 +1510,14 @@ void RTjpeg_init_compress(__u32 *buf, int width, int height, __u8 Q) RTjpeg_lqt[i]=((1<<16)/RTjpeg_liqt[i])>>3; RTjpeg_cqt[i]=((1<<16)/RTjpeg_ciqt[i])>>3; } - + RTjpeg_lb8=0; while(RTjpeg_liqt[RTjpeg_ZZ[++RTjpeg_lb8]]<=8); RTjpeg_lb8--; RTjpeg_cb8=0; while(RTjpeg_ciqt[RTjpeg_ZZ[++RTjpeg_cb8]]<=8); RTjpeg_cb8--; - + RTjpeg_dct_init(); RTjpeg_quant_init(); @@ -1573,7 +1573,7 @@ int RTjpeg_compressYUV420(__s8 *sp, unsigned char *bp) bp1+=RTjpeg_width<<4; bp2+=RTjpeg_width<<2; bp3+=RTjpeg_width<<2; - + } #if HAVE_MMX emms(); @@ -1617,11 +1617,11 @@ static int RTjpeg_bcomp(__s16 *old, mmx_t *mask) mmx_t *mblock=(mmx_t *)RTjpeg_block; volatile mmx_t result; static mmx_t neg={0xffffffffffffffffULL}; - + movq_m2r(*mask, mm7); movq_m2r(neg, mm6); pxor_r2r(mm5, mm5); - + for(i=0; i<8; i++) { movq_m2r(*(mblock++), mm0); @@ -1644,7 +1644,7 @@ static int RTjpeg_bcomp(__s16 *old, mmx_t *mask) por_r2r(mm3, mm5); } movq_r2m(mm5, result); - + if(result.q) { return 0; @@ -1683,7 +1683,7 @@ int RTjpeg_mcompressYUV420(__s8 *sp, unsigned char *bp, __u16 lmask, __u16 cmask RTjpeg_lmask=lmask; RTjpeg_cmask=cmask; #endif - + sb=sp; block=RTjpeg_old; /* Y */ @@ -1696,7 +1696,7 @@ int RTjpeg_mcompressYUV420(__s8 *sp, unsigned char *bp, __u16 lmask, __u16 cmask if(RTjpeg_bcomp(block, &RTjpeg_lmask)) { *((__u8 *)sp++)=255; - } + } else sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8); block+=64; @@ -1705,7 +1705,7 @@ int RTjpeg_mcompressYUV420(__s8 *sp, unsigned char *bp, __u16 lmask, __u16 cmask if(RTjpeg_bcomp(block, &RTjpeg_lmask)) { *((__u8 *)sp++)=255; - } + } else sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8); block+=64; @@ -1714,7 +1714,7 @@ int RTjpeg_mcompressYUV420(__s8 *sp, unsigned char *bp, __u16 lmask, __u16 cmask if(RTjpeg_bcomp(block, &RTjpeg_lmask)) { *((__u8 *)sp++)=255; - } + } else sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8); block+=64; @@ -1723,7 +1723,7 @@ int RTjpeg_mcompressYUV420(__s8 *sp, unsigned char *bp, __u16 lmask, __u16 cmask if(RTjpeg_bcomp(block, &RTjpeg_lmask)) { *((__u8 *)sp++)=255; - } + } else sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8); block+=64; @@ -1732,7 +1732,7 @@ int RTjpeg_mcompressYUV420(__s8 *sp, unsigned char *bp, __u16 lmask, __u16 cmask if(RTjpeg_bcomp(block, &RTjpeg_cmask)) { *((__u8 *)sp++)=255; - } + } else sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_cb8); block+=64; @@ -1741,7 +1741,7 @@ int RTjpeg_mcompressYUV420(__s8 *sp, unsigned char *bp, __u16 lmask, __u16 cmask if(RTjpeg_bcomp(block, &RTjpeg_cmask)) { *((__u8 *)sp++)=255; - } + } else sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_cb8); block+=64; } @@ -1749,7 +1749,7 @@ int RTjpeg_mcompressYUV420(__s8 *sp, unsigned char *bp, __u16 lmask, __u16 cmask bp1+=RTjpeg_width<<4; bp2+=RTjpeg_width<<2; bp3+=RTjpeg_width<<2; - + } #if HAVE_MMX emms(); diff --git a/libmpcodecs/native/rtjpegn.h b/libmpcodecs/native/rtjpegn.h index 859b8238f8..590b172a38 100644 --- a/libmpcodecs/native/rtjpegn.h +++ b/libmpcodecs/native/rtjpegn.h @@ -1,6 +1,6 @@ -/* +/* RTjpeg (C) Justin Schoeman 1998 (justin@suntiger.ee.up.ac.za) - + With modifications by: (c) 1998, 1999 by Joerg Walter <trouble@moes.pmnet.uni-oldenburg.de> and diff --git a/libmpcodecs/native/xa_gsm.c b/libmpcodecs/native/xa_gsm.c index 86cedeb48b..2fc2357c13 100644 --- a/libmpcodecs/native/xa_gsm.c +++ b/libmpcodecs/native/xa_gsm.c @@ -74,7 +74,7 @@ word b; /****************/ static word gsm_asr (a,n) -word a; +word a; int n; { if (n >= 16) return -(a < 0); @@ -91,7 +91,7 @@ int n; /****************/ static word gsm_asl (a,n) -word a; +word a; int n; { if (n >= 16) return 0; @@ -151,7 +151,7 @@ register word * xMc; /* [0..12] IN */ word mant; word exp; register word * xMp; /* [0..12] OUT */ -/* +/* * This part is for decoding the RPE sequence of coded xMc[0..12] * samples to obtain the xMp[0..12] array. Table 4.6 is used to get * the mantissa of xmaxc (FAC[0..7]). @@ -161,7 +161,7 @@ register word * xMp; /* [0..12] OUT */ word temp, temp1, temp2, temp3; longword ltmp; - assert( mant >= 0 && mant <= 7 ); + assert( mant >= 0 && mant <= 7 ); temp1 = gsm_FAC[ mant ]; /* see 4.2-15 for mant */ temp2 = gsm_sub( 6, exp ); /* see 4.2-15 for exp */ @@ -248,7 +248,7 @@ register word * s; register longword ltmp; /* for GSM_ADD */ register word tmp; - for (k = 160; k--; s++) + for (k = 160; k--; s++) { tmp = GSM_MULT_R( msr, 28180 ); msr = GSM_ADD(*s, tmp); /* Deemphasis */ @@ -285,7 +285,7 @@ register word * drp; /* [-120..-1] IN, [-120..40] OUT */ */ brp = gsm_QLB[ bcr ]; - /* Computation of the reconstructed short term residual + /* Computation of the reconstructed short term residual * signal drp[0..39] */ assert(brp != MIN_WORD); @@ -398,7 +398,7 @@ word * LARpp; /* out: decoded .. */ } /* 4.2.9 */ -/* Computation of the quantized reflection coefficients +/* Computation of the quantized reflection coefficients */ /* 4.2.9.1 Interpolation of the LARpp[1..8] to get the LARp[1..8] @@ -564,7 +564,7 @@ word *s; /* [0..159] OUT */ word erp[40], wt[160]; word *drp = S->dp0 + 120; - for (j=0; j <= 3; j++, xmaxcr++, bcr++, Ncr++, Mcr++, xMcr += 13) + for (j=0; j <= 3; j++, xmaxcr++, bcr++, Ncr++, Mcr++, xMcr += 13) { Gsm_RPE_Decoding( S, *xmaxcr, *Mcr, xMcr, erp ); Gsm_Long_Term_Synthesis_Filtering( S, *Ncr, *bcr, erp, drp ); @@ -583,7 +583,7 @@ word *s; /* [0..159] OUT */ ****-------------------------------------------------------------------****/ void XA_MSGSM_Decoder(unsigned char *ibuf,unsigned short *obuf) { word sr; - word LARc[8], Nc[4], Mc[4], bc[4], xmaxc[4], xmc[13*4]; + word LARc[8], Nc[4], Mc[4], bc[4], xmaxc[4], xmc[13*4]; sr = *ibuf++; @@ -773,7 +773,7 @@ void XA_MSGSM_Decoder(unsigned char *ibuf,unsigned short *obuf) xmaxc[2] = sr & 0x3f; sr >>= 6; xmc[26] = sr & 0x7; sr >>= 3; xmc[27] = sr & 0x7; sr >>= 3; - sr |= (word)*ibuf++ << 1; + sr |= (word)*ibuf++ << 1; xmc[28] = sr & 0x7; sr >>= 3; xmc[29] = sr & 0x7; sr >>= 3; xmc[30] = sr & 0x7; sr >>= 3; @@ -790,7 +790,7 @@ void XA_MSGSM_Decoder(unsigned char *ibuf,unsigned short *obuf) xmc[38] = sr & 0x7; sr >>= 3; sr = *ibuf++; Nc[3] = sr & 0x7f; sr >>= 7; - sr |= (word)*ibuf++ << 1; + sr |= (word)*ibuf++ << 1; bc[3] = sr & 0x3; sr >>= 2; Mc[3] = sr & 0x3; sr >>= 2; sr |= (word)*ibuf++ << 5; @@ -816,7 +816,7 @@ void XA_MSGSM_Decoder(unsigned char *ibuf,unsigned short *obuf) GSM_Decode(&gsm_state, LARc, Nc, bc, Mc, xmaxc, xmc, &obuf[160]); /* Return number of source bytes consumed and output samples produced */ -// *icnt = 65; +// *icnt = 65; // *ocnt = 320; return; } @@ -824,7 +824,7 @@ void XA_MSGSM_Decoder(unsigned char *ibuf,unsigned short *obuf) #define GSM_MAGIC 0xd void XA_GSM_Decoder(unsigned char *ibuf,unsigned short *obuf) -{ word LARc[8], Nc[4], Mc[4], bc[4], xmaxc[4], xmc[13*4]; +{ word LARc[8], Nc[4], Mc[4], bc[4], xmaxc[4], xmc[13*4]; /* Sanity */ if (((*ibuf >> 4) & 0x0F) != GSM_MAGIC) diff --git a/libmpcodecs/native/xa_gsm_int.h b/libmpcodecs/native/xa_gsm_int.h index 40a31a8cb3..a6412440b6 100644 --- a/libmpcodecs/native/xa_gsm_int.h +++ b/libmpcodecs/native/xa_gsm_int.h @@ -76,10 +76,10 @@ typedef struct { /* - * Inlined functions from add.h + * Inlined functions from add.h */ -/* +/* * #define GSM_MULT_R(a, b) (* word a, word b, !(a == b == MIN_WORD) *) \ * (0x0FFFF & SASR(((longword)(a) * (longword)(b) + 16384), 15)) */ diff --git a/libmpcodecs/pullup.c b/libmpcodecs/pullup.c index b4b8f2c17d..90aa2b87b7 100644 --- a/libmpcodecs/pullup.c +++ b/libmpcodecs/pullup.c @@ -18,9 +18,9 @@ static int diff_y_mmx(unsigned char *a, unsigned char *b, int s) "movl $4, %%ecx \n\t" "pxor %%mm4, %%mm4 \n\t" "pxor %%mm7, %%mm7 \n\t" - + "1: \n\t" - + "movq (%%"REG_S"), %%mm0 \n\t" "movq (%%"REG_S"), %%mm2 \n\t" "add %%"REG_a", %%"REG_S" \n\t" @@ -38,7 +38,7 @@ static int diff_y_mmx(unsigned char *a, unsigned char *b, int s) "paddw %%mm1, %%mm4 \n\t" "paddw %%mm2, %%mm4 \n\t" "paddw %%mm3, %%mm4 \n\t" - + "decl %%ecx \n\t" "jnz 1b \n\t" @@ -66,7 +66,7 @@ static int licomb_y_mmx(unsigned char *a, unsigned char *b, int s) "pxor %%mm6, %%mm6 \n\t" "pxor %%mm7, %%mm7 \n\t" "sub %%"REG_a", %%"REG_D" \n\t" - + "2: \n\t" "movq (%%"REG_D"), %%mm0 \n\t" @@ -96,7 +96,7 @@ static int licomb_y_mmx(unsigned char *a, unsigned char *b, int s) "psubusw %%mm2, %%mm1 \n\t" "paddw %%mm0, %%mm6 \n\t" "paddw %%mm1, %%mm6 \n\t" - + "movq (%%"REG_D",%%"REG_a"), %%mm0 \n\t" "movq (%%"REG_S"), %%mm1 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" @@ -110,7 +110,7 @@ static int licomb_y_mmx(unsigned char *a, unsigned char *b, int s) "psubusw %%mm2, %%mm1 \n\t" "paddw %%mm0, %%mm6 \n\t" "paddw %%mm1, %%mm6 \n\t" - + "movq (%%"REG_D",%%"REG_a"), %%mm0 \n\t" "movq (%%"REG_S"), %%mm1 \n\t" "punpckhbw %%mm7, %%mm0 \n\t" @@ -129,7 +129,7 @@ static int licomb_y_mmx(unsigned char *a, unsigned char *b, int s) "add %%"REG_a", %%"REG_D" \n\t" "decl %%ecx \n\t" "jnz 2b \n\t" - + "movq %%mm6, %%mm5 \n\t" "punpcklwd %%mm7, %%mm6 \n\t" "punpckhwd %%mm7, %%mm5 \n\t" @@ -138,7 +138,7 @@ static int licomb_y_mmx(unsigned char *a, unsigned char *b, int s) "psrlq $32, %%mm5 \n\t" "movd %%mm5, %%edx \n\t" "addl %%edx, %%eax \n\t" - + "emms \n\t" : "=a" (ret) : "S" (a), "D" (b), "a" (s) @@ -154,9 +154,9 @@ static int var_y_mmx(unsigned char *a, unsigned char *b, int s) "movl $3, %%ecx \n\t" "pxor %%mm4, %%mm4 \n\t" "pxor %%mm7, %%mm7 \n\t" - + "1: \n\t" - + "movq (%%"REG_S"), %%mm0 \n\t" "movq (%%"REG_S"), %%mm2 \n\t" "movq (%%"REG_S",%%"REG_a"), %%mm1 \n\t" @@ -173,7 +173,7 @@ static int var_y_mmx(unsigned char *a, unsigned char *b, int s) "paddw %%mm1, %%mm4 \n\t" "paddw %%mm2, %%mm4 \n\t" "paddw %%mm3, %%mm4 \n\t" - + "decl %%ecx \n\t" "jnz 1b \n\t" @@ -297,7 +297,7 @@ struct pullup_buffer *pullup_get_buffer(struct pullup_context *c, int parity) alloc_buffer(c, c->last->buffer); return pullup_lock_buffer(c->last->buffer, parity); } - + /* Prefer a buffer with both fields open */ for (i = 0; i < c->nbuffers; i++) { if (c->buffers[i].lock[0]) continue; @@ -307,7 +307,7 @@ struct pullup_buffer *pullup_get_buffer(struct pullup_context *c, int parity) } if (parity == 2) return 0; - + /* Search for any half-free buffer */ for (i = 0; i < c->nbuffers; i++) { if (((parity+1) & 1) && c->buffers[i].lock[0]) continue; @@ -315,7 +315,7 @@ struct pullup_buffer *pullup_get_buffer(struct pullup_context *c, int parity) alloc_buffer(c, &c->buffers[i]); return pullup_lock_buffer(&c->buffers[i], parity); } - + return 0; } @@ -399,10 +399,10 @@ static void check_field_queue(struct pullup_context *c) void pullup_submit_field(struct pullup_context *c, struct pullup_buffer *b, int parity) { struct pullup_field *f; - + /* Grow the circular list if needed */ check_field_queue(c); - + /* Cannot have two fields of same parity in a row; drop the new one */ if (c->last && c->last->parity == parity) return; @@ -426,7 +426,7 @@ void pullup_submit_field(struct pullup_context *c, struct pullup_buffer *b, int void pullup_flush_fields(struct pullup_context *c) { struct pullup_field *f; - + for (f = c->first; f && f != c->head; f = f->next) { pullup_release_buffer(f->buffer, f->parity); f->buffer = 0; @@ -455,7 +455,7 @@ static int queue_length(struct pullup_field *begin, struct pullup_field *end) { int count = 1; struct pullup_field *f; - + if (!begin || !end) return 0; for (f = begin; f != end; f = f->next) count++; return count; @@ -567,7 +567,7 @@ static int decide_frame_length(struct pullup_context *c) struct pullup_field *f1 = f0->next; struct pullup_field *f2 = f1->next; int l; - + if (queue_length(c->first, c->last) < 4) return 0; foo(c); @@ -575,7 +575,7 @@ static int decide_frame_length(struct pullup_context *c) l = find_first_break(f0, 3); if (l == 1 && c->strict_breaks < 0) l = 0; - + switch (l) { case 1: if (c->strict_breaks < 1 && f0->affinity == 1 && f1->affinity == -1) @@ -653,7 +653,7 @@ struct pullup_frame *pullup_get_frame(struct pullup_context *c) c->first->buffer = 0; c->first = c->first->next; } - + if (n == 1) { fr->ofields[fr->parity] = fr->ifields[0]; fr->ofields[fr->parity^1] = 0; @@ -669,7 +669,7 @@ struct pullup_frame *pullup_get_frame(struct pullup_context *c) } pullup_lock_buffer(fr->ofields[0], 0); pullup_lock_buffer(fr->ofields[1], 1); - + if (fr->ofields[0] == fr->ofields[1]) { fr->buffer = fr->ofields[0]; pullup_lock_buffer(fr->buffer, 2); @@ -756,7 +756,7 @@ void pullup_init_context(struct pullup_context *c) c->metric_h = (c->h[mp] - ((c->junk_top + c->junk_bottom) << 1)) >> 3; c->metric_offset = c->junk_left*c->bpp[mp] + (c->junk_top<<1)*c->stride[mp]; c->metric_len = c->metric_w * c->metric_h; - + c->head = make_field_queue(c, 8); c->frame = calloc(1, sizeof (struct pullup_frame)); @@ -804,12 +804,3 @@ void pullup_free_context(struct pullup_context *c) free(c->frame); free(c); } - - - - - - - - - diff --git a/libmpcodecs/vd_dmo.c b/libmpcodecs/vd_dmo.c index 4a91187782..4bc3570607 100644 --- a/libmpcodecs/vd_dmo.c +++ b/libmpcodecs/vd_dmo.c @@ -65,16 +65,16 @@ static void uninit(sh_video_t *sh){ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ mp_image_t* mpi; if(len<=0) return NULL; // skipped frame - + if(flags&3){ // framedrop: DMO_VideoDecoder_DecodeInternal(sh->context, data, len, 0, 0); return NULL; } - - mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, 0 /*MP_IMGFLAG_ACCEPT_STRIDE*/, + + mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, 0 /*MP_IMGFLAG_ACCEPT_STRIDE*/, sh->disp_w, sh->disp_h); - + if(!mpi){ // temporary! mp_tmsg(MSGT_DECVIDEO,MSGL_WARN,"[VD_DMO] Couldn't allocate image for cinepak codec.\n"); return NULL; diff --git a/libmpcodecs/vd_dshow.c b/libmpcodecs/vd_dshow.c index db303c1db4..00f9ab4332 100644 --- a/libmpcodecs/vd_dshow.c +++ b/libmpcodecs/vd_dshow.c @@ -94,16 +94,16 @@ static void uninit(sh_video_t *sh){ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ mp_image_t* mpi; if(len<=0) return NULL; // skipped frame - + if(flags&3){ // framedrop: DS_VideoDecoder_DecodeInternal(sh->context, data, len, 0, 0); return NULL; } - - mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, 0 /*MP_IMGFLAG_ACCEPT_STRIDE*/, + + mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, 0 /*MP_IMGFLAG_ACCEPT_STRIDE*/, sh->disp_w, sh->disp_h); - + if(!mpi){ // temporary! mp_tmsg(MSGT_DECVIDEO,MSGL_WARN,"[VD_DMO] Couldn't allocate image for cinepak codec.\n"); return NULL; diff --git a/libmpcodecs/vd_hmblck.c b/libmpcodecs/vd_hmblck.c index 096f081d18..f3b7a71026 100644 --- a/libmpcodecs/vd_hmblck.c +++ b/libmpcodecs/vd_hmblck.c @@ -90,7 +90,7 @@ static int nv12_to_yv12(unsigned char *data, int len, mp_image_t* mpi, int swapp // chroma data is interlaced UVUV... so deinterlace it for(idx=0; idx<UV_size; idx++ ) { - *(dst_U + idx) = *(src + (idx<<1) + (swapped ? 1 : 0)); + *(dst_U + idx) = *(src + (idx<<1) + (swapped ? 1 : 0)); *(dst_V + idx) = *(src + (idx<<1) + (swapped ? 0 : 1)); } return 1; diff --git a/libmpcodecs/vd_libdv.c b/libmpcodecs/vd_libdv.c index 8f5c6996ed..7332629325 100644 --- a/libmpcodecs/vd_libdv.c +++ b/libmpcodecs/vd_libdv.c @@ -62,7 +62,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags) { mp_image_t* mpi; dv_decoder_t *decoder=sh->context; - + if(len<=0 || (flags&3)){ // fprintf(stderr,"decode() (rawdv) SKIPPED\n"); return NULL; // skipped frame @@ -71,13 +71,13 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags) dv_parse_header(decoder, data); mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, sh->disp_w, sh->disp_h); - + if(!mpi){ // temporary! fprintf(stderr,"couldn't allocate image for stderr codec\n"); return NULL; } dv_decode_full_frame(decoder, data, e_dv_color_yuv, mpi->planes, mpi->stride); - + return mpi; } diff --git a/libmpcodecs/vd_libmpeg2.c b/libmpcodecs/vd_libmpeg2.c index 1a8fd6f214..cc170c5034 100644 --- a/libmpcodecs/vd_libmpeg2.c +++ b/libmpcodecs/vd_libmpeg2.c @@ -56,7 +56,7 @@ static int control(sh_video_t *sh,int cmd,void* arg,...){ return CONTROL_TRUE; return CONTROL_FALSE; } - + return CONTROL_UNKNOWN; } @@ -120,7 +120,7 @@ static void uninit(sh_video_t *sh){ free(sh->context); } -static void draw_slice (void * _sh, uint8_t * const * src, unsigned int y){ +static void draw_slice (void * _sh, uint8_t * const * src, unsigned int y){ sh_video_t* sh = (sh_video_t*) _sh; vd_libmpeg2_ctx_t *context = sh->context; mpeg2dec_t* mpeg2dec = context->mpeg2dec; @@ -147,9 +147,9 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ // MPlayer registers its own draw_slice callback, prevent libmpeg2 from freeing the context mpeg2dec->decoder.convert=NULL; mpeg2dec->decoder.convert_id=NULL; - + if(len<=0) return NULL; // skipped null frame - + // append extra 'end of frame' code: ((char*)data+len)[0]=0; ((char*)data+len)[1]=0; @@ -162,14 +162,14 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ } else { mpeg2_buffer (mpeg2dec, data, (uint8_t *)data+len); } - + while(1){ int state=mpeg2_parse (mpeg2dec); int type, use_callback; mp_image_t* mpi_new; unsigned long pw, ph; int imgfmt; - + switch(state){ case STATE_BUFFER: if (mpeg2dec->pending_length) { @@ -209,7 +209,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ break; case STATE_PICTURE: type=info->current_picture->flags&PIC_MASK_CODING_TYPE; - + drop_frame = framedrop && (mpeg2dec->decoder.coding_type == B_TYPE); drop_frame |= framedrop>=2; // hard drop if (drop_frame) { @@ -268,7 +268,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ mpeg2dec->decoder.convert=NULL; mpeg2dec->decoder.convert_id=NULL; } - + break; case STATE_SLICE: case STATE_END: diff --git a/libmpcodecs/vd_lzo.c b/libmpcodecs/vd_lzo.c index a60436cbe5..ac291cf446 100644 --- a/libmpcodecs/vd_lzo.c +++ b/libmpcodecs/vd_lzo.c @@ -45,7 +45,7 @@ static int init(sh_video_t *sh) if (sh->bih->biSizeImage <= 0) { mp_msg (MSGT_DECVIDEO, MSGL_ERR, "[%s] Invalid frame size\n", MOD_NAME); - return 0; + return 0; } priv = malloc(sizeof(lzo_context_t)); @@ -66,7 +66,7 @@ static int init(sh_video_t *sh) static void uninit(sh_video_t *sh) { lzo_context_t *priv = sh->context; - + if (priv) { free(priv->buffer); @@ -87,11 +87,11 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags) if (len <= 0) { return NULL; // skipped frame } - + r = av_lzo1x_decode(priv->buffer, &w, data, &len); if (r) { /* this should NEVER happen */ - mp_msg (MSGT_DECVIDEO, MSGL_ERR, + mp_msg (MSGT_DECVIDEO, MSGL_ERR, "[%s] internal error - decompression failed: %d\n", MOD_NAME, r); return NULL; } @@ -140,7 +140,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags) mpi->stride[1] = sh->disp_w / 2; } - mp_msg (MSGT_DECVIDEO, MSGL_DBG2, + mp_msg (MSGT_DECVIDEO, MSGL_DBG2, "[%s] decompressed %lu bytes into %lu bytes\n", MOD_NAME, (long) len, (long)w); diff --git a/libmpcodecs/vd_mpegpes.c b/libmpcodecs/vd_mpegpes.c index 598b1203ba..7d2a206564 100644 --- a/libmpcodecs/vd_mpegpes.c +++ b/libmpcodecs/vd_mpegpes.c @@ -55,7 +55,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ return 0; } } - + mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0, sh->disp_w, sh->disp_h); packet.data=data; packet.size=len; diff --git a/libmpcodecs/vd_mpng.c b/libmpcodecs/vd_mpng.c index cab4cf66d4..487e33d2de 100644 --- a/libmpcodecs/vd_mpng.c +++ b/libmpcodecs/vd_mpng.c @@ -79,7 +79,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ unsigned char *p; if(len<=0) return NULL; // skipped frame - + png=png_create_read_struct( PNG_LIBPNG_VER_STRING,NULL,NULL,NULL ); info=png_create_info_struct( png ); endinfo=png_create_info_struct( png ); @@ -131,13 +131,13 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ } #endif - mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, + mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, png_width,png_height); if(!mpi) return NULL; // Let's DECODE! row_p=malloc( sizeof( png_bytep ) * png_height ); -//png_get_rowbytes( png,info ) +//png_get_rowbytes( png,info ) for ( i=0; i < png_height; i++ ) row_p[i]=mpi->planes[0] + mpi->stride[0]*i; png_read_image( png,row_p ); free( row_p ); @@ -153,7 +153,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ *p++ = 0; } } - + png_read_end( png,endinfo ); png_destroy_read_struct( &png,&info,&endinfo ); diff --git a/libmpcodecs/vd_mtga.c b/libmpcodecs/vd_mtga.c index 61022c71c8..fb5fa6e807 100644 --- a/libmpcodecs/vd_mtga.c +++ b/libmpcodecs/vd_mtga.c @@ -42,10 +42,10 @@ typedef struct { unsigned char id_len; unsigned short img_type; - + unsigned short width; unsigned short height; - + unsigned char bpp; unsigned char origin; /* 0 = lower left, 1 = upper left */ unsigned short start_row; @@ -100,17 +100,17 @@ static void decode_rle_tga(TGAInfo *info, unsigned char *data, mp_image_t *mpi) for (row = info->start_row; (!info->origin && row) || (info->origin && row < info->height); row += info->increment) { final = mpi->planes[0] + mpi->stride[0] * row; - + for (col = 0; col < info->width; col += repetitions) { packet_header = *data++; repetitions = (1 + (packet_header & 0x7f)); replen = repetitions * num_bytes; - + if (packet_header & 0x80) /* runlength encoded packet */ { memcpy(final, data, num_bytes); - + // Note: this will be slow when DR to vram! i=num_bytes; while(2*i<=replen){ @@ -125,11 +125,11 @@ static void decode_rle_tga(TGAInfo *info, unsigned char *data, mp_image_t *mpi) fast_memcpy(final, data, replen); data += replen; } - + final += replen; } } - + return; } @@ -138,7 +138,7 @@ static void decode_uncompressed_tga(TGAInfo *info, unsigned char *data, mp_image { unsigned char *final; int row, num_bytes = info->bpp / 8; - + /* see line 207 to see why this loop is set up like this */ for (row = info->start_row; (!info->origin && row) || (info->origin && row < info->height); row += info->increment) { @@ -154,7 +154,7 @@ static void decode_uncompressed_tga(TGAInfo *info, unsigned char *data, mp_image static short read_tga_header(unsigned char *buf, TGAInfo *info) { info->id_len = buf[0]; - + info->img_type = buf[2]; /* targa data is always stored in little endian byte order */ @@ -162,11 +162,11 @@ static short read_tga_header(unsigned char *buf, TGAInfo *info) info->height = le2me_16(*(unsigned short *) &buf[14]); info->bpp = buf[16]; - + info->origin = (buf[17] & 0x20) >> 5; /* FIXME check for valid targa data */ - + return 0; } @@ -177,13 +177,13 @@ static mp_image_t *decode(sh_video_t *sh, void *raw, int len, int flags) TGAInfo *info = sh->context; unsigned char *data = raw; mp_image_t *mpi; - - + + if (len <= 0) return NULL; /* skip frame */ read_tga_header(data, info); /* read information about the file */ - + if (info->bpp == 24) out_fmt = IMGFMT_BGR24; else if (info->bpp == 32) @@ -193,7 +193,7 @@ static mp_image_t *decode(sh_video_t *sh, void *raw, int len, int flags) mp_msg(MSGT_DECVIDEO, MSGL_INFO, "Unsupported TGA type! depth=%d\n",info->bpp); return NULL; } - + if (info->img_type != TGA_UNCOMP_TRUECOLOR && info->img_type != TGA_RLE_TRUECOLOR) /* not a true color image */ { mp_msg(MSGT_DECVIDEO, MSGL_INFO, "Unsupported TGA type: %i!\n", info->img_type); @@ -206,21 +206,21 @@ static mp_image_t *decode(sh_video_t *sh, void *raw, int len, int flags) /* set data to the beginning of the image data */ data += 18 + info->id_len; - + /* (re)init libvo if image parameters changed (width/height/colorspace) */ if (last_w != info->width || last_h != info->height || last_c != out_fmt) { last_w = info->width; last_h = info->height; last_c = out_fmt; - + if (!out_fmt || !mpcodecs_config_vo(sh, info->width, info->height, out_fmt)) return NULL; } if (!(mpi = mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, info->width, info->height))) return NULL; - + /* finally decode the image */ if (info->img_type == TGA_UNCOMP_TRUECOLOR) decode_uncompressed_tga(info, data, mpi); @@ -231,4 +231,3 @@ static mp_image_t *decode(sh_video_t *sh, void *raw, int len, int flags) return mpi; } - diff --git a/libmpcodecs/vd_null.c b/libmpcodecs/vd_null.c index 34392962b1..b842967323 100644 --- a/libmpcodecs/vd_null.c +++ b/libmpcodecs/vd_null.c @@ -36,4 +36,3 @@ static void uninit(sh_video_t *sh){ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ return NULL; } - diff --git a/libmpcodecs/vd_qtvideo.c b/libmpcodecs/vd_qtvideo.c index 8b32cf9a6d..f97c85571b 100644 --- a/libmpcodecs/vd_qtvideo.c +++ b/libmpcodecs/vd_qtvideo.c @@ -30,7 +30,7 @@ LIBVD_EXTERN(qtvideo) static ComponentInstance ci=NULL; // codec handle //static CodecInfo cinfo; // for ImageCodecGetCodecInfo() //Component prev=NULL; -//ComponentResult cres; // +//ComponentResult cres; // static CodecCapabilities codeccap; // for decpar static CodecDecompressParams decpar; // for ImageCodecPreDecompress() //static ImageSubCodecDecompressCapabilities icap; // for ImageCodecInitialize() @@ -63,7 +63,7 @@ static ComponentResult (*ImageCodecPreDecompress)(ComponentInstance ci, CodecDecompressParams * params); static ComponentResult (*ImageCodecBandDecompress)(ComponentInstance ci, CodecDecompressParams * params); -static PixMapHandle (*GetGWorldPixMap)(GWorldPtr offscreenGWorld); +static PixMapHandle (*GetGWorldPixMap)(GWorldPtr offscreenGWorld); static OSErr (*QTNewGWorldFromPtr)(GWorldPtr *gw, OSType pixelFormat, const Rect *boundsRect, @@ -71,8 +71,8 @@ static OSErr (*QTNewGWorldFromPtr)(GWorldPtr *gw, /*GDHandle*/void* aGDevice, //unused anyway GWorldFlags flags, void *baseAddr, - long rowBytes); -static OSErr (*NewHandleClear)(Size byteCount); + long rowBytes); +static OSErr (*NewHandleClear)(Size byteCount); #endif /* #ifndef CONFIG_QUICKTIME */ // to set/get/query special features/parameters @@ -108,7 +108,7 @@ static int init(sh_video_t *sh){ mp_msg(MSGT_DECVIDEO,MSGL_ERR,"unable to load QuickTime.qts\n" ); return 0; } - + handler = LoadLibraryA("qtmlClient.dll"); if(!handler){ mp_msg(MSGT_DECVIDEO,MSGL_ERR,"unable to load qtmlClient.dll\n"); @@ -130,7 +130,7 @@ static int init(sh_video_t *sh){ QTNewGWorldFromPtr = (OSErr(*)(GWorldPtr *,OSType,const Rect *,CTabHandle,void*,GWorldFlags,void *,long))GetProcAddress(handler, "QTNewGWorldFromPtr"); NewHandleClear = (OSErr(*)(Size))GetProcAddress(handler, "NewHandleClear"); // = GetProcAddress(handler, ""); - + if(!InitializeQTML || !EnterMovies || !FindNextComponent || !ImageCodecBandDecompress){ mp_msg(MSGT_DECVIDEO,MSGL_ERR,"invalid qtmlClient.dll!\n"); return 0; @@ -167,7 +167,7 @@ static int init(sh_video_t *sh){ (((unsigned char)'d')<<8)| (((unsigned char)'c')); #if 0 - desc.componentSubType= + desc.componentSubType= (((unsigned char)'S'<<24))| (((unsigned char)'V')<<16)| (((unsigned char)'Q')<<8)| @@ -193,7 +193,7 @@ static int init(sh_video_t *sh){ memset(&icap,0,sizeof(icap)); cres=ImageCodecInitialize(ci,&icap); mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"ImageCodecInitialize->%#x size=%d (%d)\n",cres,icap.recordSize,icap.decompressRecordSize); - + memset(&cinfo,0,sizeof(cinfo)); cres=ImageCodecGetCodecInfo(ci,&cinfo); mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"Flags: compr: 0x%X decomp: 0x%X format: 0x%X\n", @@ -225,7 +225,7 @@ static int init(sh_video_t *sh){ dump_ImageDescription(*framedescHandle); #endif //Find codecscomponent for video decompression -// result = FindCodec ('SVQ1',anyCodec,&compressor,&decompressor ); +// result = FindCodec ('SVQ1',anyCodec,&compressor,&decompressor ); // printf("FindCodec SVQ1 returned:%i compressor: 0x%X decompressor: 0x%X\n",result,compressor,decompressor); sh->context = (void *)kYUVSPixelFormat; @@ -291,10 +291,10 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ int i; mp_image_t* mpi; ComponentResult cres; - + if(len<=0) return NULL; // skipped frame - mpi=mpcodecs_get_image(sh, MP_IMGTYPE_STATIC, MP_IMGFLAG_PRESERVE, + mpi=mpcodecs_get_image(sh, MP_IMGTYPE_STATIC, MP_IMGFLAG_PRESERVE, sh->disp_w, sh->disp_h); if(!mpi) return NULL; @@ -304,13 +304,13 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ if(!codec_initialized){ result = QTNewGWorldFromPtr( - &OutBufferGWorld, + &OutBufferGWorld, // kYUVSPixelFormat, //pixel format of new GWorld == YUY2 (OSType)sh->context, &OutBufferRect, //we should benchmark if yvu9 is faster for svq3, too - 0, - 0, - 0, + 0, + 0, + 0, mpi->planes[0], mpi->stride[0]); mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"NewGWorldFromPtr returned:%ld\n",65536-(result&0xffff)); @@ -333,7 +333,7 @@ if(!codec_initialized){ decpar.accuracy = codecNormalQuality; // decpar.port = OutBufferGWorld; // decpar.preferredOffscreenPixelSize=17207; - + // decpar.sequenceID=malloc(1000); // memset(decpar.sequenceID,0,1000); @@ -344,13 +344,13 @@ if(!codec_initialized){ // decpar.srcRect = SrcRect; decpar.srcRect = OutBufferRect; - + decpar.transferMode = srcCopy; - decpar.dstPixMap = **GetGWorldPixMap( OutBufferGWorld);//destPixmap; - + decpar.dstPixMap = **GetGWorldPixMap( OutBufferGWorld);//destPixmap; + cres=ImageCodecPreDecompress(ci,&decpar); mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"ImageCodecPreDecompress cres=0x%X\n",cres); - + if(decpar.wantedDestinationPixelTypes) { OSType *p=*(decpar.wantedDestinationPixelTypes); if(p) while(*p){ @@ -358,7 +358,7 @@ if(!codec_initialized){ ++p; } } - + // decpar.conditionFlags=0x10FFF; // first // decpar.preferredOffscreenPixelSize=17207; @@ -388,7 +388,7 @@ if(!codec_initialized){ mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"ImageCodecBandDecompress cres=0x%X (-0x%X) %d\n",cres,-cres,cres); return NULL; } - + // for(i=0;i<8;i++) // printf("img_base[%d]=%p\n",i,((int*)decpar.dstPixMap.baseAddr)[i]); @@ -418,7 +418,7 @@ if((int)sh->context==0x73797639){ // Sorenson 16-bit YUV -> std YVU9 for(x=0;x<mpi->w/4;x++) dst[x]=src[x]; src+=((mpi->w+63)&(~63))/4; } - + } diff --git a/libmpcodecs/vd_raw.c b/libmpcodecs/vd_raw.c index 7eeda88c00..53a736b29b 100644 --- a/libmpcodecs/vd_raw.c +++ b/libmpcodecs/vd_raw.c @@ -59,10 +59,10 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ mp_image_t* mpi; int frame_size; int format = sh->bih ? sh->bih->biCompression : sh->format; - + if(len<=0) return NULL; // skipped frame - mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0, + mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0, sh->disp_w, sh->disp_h); if(!mpi) return NULL; @@ -119,6 +119,6 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ len,frame_size); return NULL; } - + return mpi; } diff --git a/libmpcodecs/vd_realvid.c b/libmpcodecs/vd_realvid.c index 867d1b857d..575728388f 100644 --- a/libmpcodecs/vd_realvid.c +++ b/libmpcodecs/vd_realvid.c @@ -123,7 +123,7 @@ static int load_syms_linux(char *path) { rv_handle = handle; return 1; } - + rvyuv_custom_message = dlsym(handle, "RV40toYUV420CustomMessage"); rvyuv_free = dlsym(handle, "RV40toYUV420Free"); rvyuv_init = dlsym(handle, "RV40toYUV420Init"); @@ -281,7 +281,7 @@ static int init(sh_video_t *sh){ /* first try to load linux dlls, if failed and we're supporting win32 dlls, then try to load the windows ones */ -#ifdef HAVE_LIBDL +#ifdef HAVE_LIBDL if(strstr(sh->codec->dll,".dll") || !load_syms_linux(path)) #endif #ifdef CONFIG_WIN32DLL @@ -393,7 +393,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ buffer=malloc(bufsz); if (!buffer) return 0; } - + for (i=0; i<2*(chunks+1); i++) extra[i] = le2me_32(extra[i]); @@ -412,7 +412,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ sh->disp_h=transform_out[4]; if (!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_I420)) return 0; initialized=1; - } + } mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0 /*MP_IMGFLAG_ACCEPT_STRIDE*/, sh->disp_w, sh->disp_h); if(!mpi) return NULL; @@ -426,6 +426,6 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ if(transform_out[0] && (sh->disp_w != transform_out[3] || sh->disp_h != transform_out[4])) initialized = 0; - + return result ? NULL : mpi; } diff --git a/libmpcodecs/vd_sgi.c b/libmpcodecs/vd_sgi.c index e4e72285b9..3ab1ed18fa 100644 --- a/libmpcodecs/vd_sgi.c +++ b/libmpcodecs/vd_sgi.c @@ -51,7 +51,7 @@ static unsigned short last_y = -1; /* to set/get/query special features/parameters */ static int control(sh_video_t* sh, int cmd, void *arg, ...) -{ +{ switch (cmd) { case VDCTRL_QUERY_FORMAT: @@ -90,10 +90,10 @@ expandrow(unsigned char *optr, unsigned char *iptr, int chan_offset) { unsigned char pixel, count; optr += chan_offset; - + while (1) { pixel = *iptr++; - + if (!(count = (pixel & 0x7f))) { return; } @@ -105,7 +105,7 @@ expandrow(unsigned char *optr, unsigned char *iptr, int chan_offset) } } else { pixel = *iptr++; - + while (count--) { *optr = pixel; optr += OUT_PIXEL_STRIDE; @@ -116,16 +116,16 @@ expandrow(unsigned char *optr, unsigned char *iptr, int chan_offset) /* expand an rle row into all 3 channels. - a separate function for grayscale so we don't slow down the + a separate function for grayscale so we don't slow down the more common case rgb function with a bunch of ifs. */ static void expandrow_gs(unsigned char *optr, unsigned char *iptr) { unsigned char pixel, count; - + while (1) { pixel = *iptr++; - + if (!(count = (pixel & 0x7f))) { return; } @@ -139,7 +139,7 @@ expandrow_gs(unsigned char *optr, unsigned char *iptr) } } else { pixel = *iptr++; - + while (count--) { optr[0] = pixel; optr[1] = pixel; @@ -159,29 +159,29 @@ decode_rle_sgi(SGIInfo *info, unsigned char *data, mp_image_t *mpi) uint32_t *starttab; int y, z, xsize, ysize, zsize, chan_offset; long start_offset; - + xsize = info->xsize; ysize = info->ysize; zsize = info->zsize; /* rle offset table is right after the header */ - starttab = (uint32_t*)(data + SGI_HEADER_LEN); - + starttab = (uint32_t*)(data + SGI_HEADER_LEN); + for (z = 0; z < zsize; z++) { /* set chan_offset so RGB ends up BGR */ chan_offset = (zsize - 1) - z; - + /* The origin for SGI images is the lower-left corner so read scan lines from bottom to top */ for (y = ysize - 1; y >= 0; y--) { dest_row = mpi->planes[0] + mpi->stride[0] * (ysize - 1 - y); - + /* set start of next run (offsets are from start of header) */ start_offset = be2me_32(*(uint32_t*) &starttab[y + z * ysize]); - + rle_data = &data[start_offset]; - + if(info->zsize == SGI_GRAYSCALE_IMAGE) { expandrow_gs(dest_row, rle_data); } else { @@ -191,21 +191,21 @@ decode_rle_sgi(SGIInfo *info, unsigned char *data, mp_image_t *mpi) } } - + /* decode an sgi image */ static void decode_uncompressed_sgi(SGIInfo *info, unsigned char *data, mp_image_t *mpi) { unsigned char *src_row, *dest_row; int x, y, z, xsize, ysize, zsize, chan_offset; - + xsize = info->xsize; ysize = info->ysize; zsize = info->zsize; - - /* skip header */ + + /* skip header */ data += SGI_HEADER_LEN; - + for (z = 0; z < zsize; z++) { /* set row ptr to start of current plane */ @@ -213,13 +213,13 @@ decode_uncompressed_sgi(SGIInfo *info, unsigned char *data, mp_image_t *mpi) /* set chan_offset for RGB -> BGR */ chan_offset = (zsize - 1) - z; - - /* the origin for SGI images is the lower-left corner + + /* the origin for SGI images is the lower-left corner so read scan lines from bottom to top. */ for (y = ysize - 1; y >= 0; y--) { dest_row = mpi->planes[0] + mpi->stride[0] * y; for (x = 0; x < xsize; x++) { - + /* we only do 24 bit output so promote 8 bit pixels to 24 */ if (zsize == SGI_GRAYSCALE_IMAGE) { /* write greyscale value into all channels */ @@ -229,7 +229,7 @@ decode_uncompressed_sgi(SGIInfo *info, unsigned char *data, mp_image_t *mpi) } else { dest_row[chan_offset] = src_row[x]; } - + dest_row += OUT_PIXEL_STRIDE; } @@ -245,13 +245,13 @@ static void read_sgi_header(unsigned char *buf, SGIInfo *info) { /* sgi data is always stored in big endian byte order */ - info->magic = be2me_16(*(unsigned short *) &buf[0]); + info->magic = be2me_16(*(unsigned short *) &buf[0]); info->rle = buf[2]; info->bytes_per_channel = buf[3]; - info->dimension = be2me_16(*(unsigned short *) &buf[4]); - info->xsize = be2me_16(*(unsigned short *) &buf[6]); - info->ysize = be2me_16(*(unsigned short *) &buf[8]); - info->zsize = be2me_16(*(unsigned short *) &buf[10]); + info->dimension = be2me_16(*(unsigned short *) &buf[4]); + info->xsize = be2me_16(*(unsigned short *) &buf[6]); + info->ysize = be2me_16(*(unsigned short *) &buf[8]); + info->zsize = be2me_16(*(unsigned short *) &buf[10]); } @@ -266,9 +266,9 @@ mp_image_t *decode(sh_video_t *sh, void *raw, int len, int flags) if (len <= 0) { return NULL; /* skip frame */ } - - read_sgi_header(data, info); - + + read_sgi_header(data, info); + /* make sure this is an SGI image file */ if (info->magic != SGI_MAGIC) { mp_msg(MSGT_DECVIDEO, MSGL_INFO, "Bad magic number in image.\n"); @@ -277,19 +277,19 @@ mp_image_t *decode(sh_video_t *sh, void *raw, int len, int flags) /* check image depth */ if (info->bytes_per_channel != 1) { - mp_msg(MSGT_DECVIDEO, MSGL_INFO, + mp_msg(MSGT_DECVIDEO, MSGL_INFO, "Unsupported bytes per channel value %i.\n", info->bytes_per_channel); return NULL; } /* check image dimension */ if (info->dimension != 2 && info->dimension != 3) { - mp_msg(MSGT_DECVIDEO, MSGL_INFO, "Unsupported image dimension %i.\n", + mp_msg(MSGT_DECVIDEO, MSGL_INFO, "Unsupported image dimension %i.\n", info->dimension); return NULL; } - /* change rgba images to rgb so alpha channel will be ignored */ + /* change rgba images to rgb so alpha channel will be ignored */ if (info->zsize == SGI_RGBA_IMAGE) { info->zsize = SGI_RGB_IMAGE; } @@ -299,30 +299,29 @@ mp_image_t *decode(sh_video_t *sh, void *raw, int len, int flags) mp_msg(MSGT_DECVIDEO, MSGL_INFO, "Unsupported image depth.\n"); return NULL; } - + /* (re)init libvo if image size is changed */ if (last_x != info->xsize || last_y != info->ysize) { last_x = info->xsize; last_y = info->ysize; - + if (!mpcodecs_config_vo(sh, info->xsize, info->ysize, outfmt)) { mp_msg(MSGT_DECVIDEO, MSGL_INFO, "Config vo failed:\n"); return NULL; } } - - if (!(mpi = mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, + + if (!(mpi = mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, info->xsize, info->ysize))) { return NULL; } - + if (info->rle) { decode_rle_sgi(info, data, mpi); } else { decode_uncompressed_sgi(info, data, mpi); } - + return mpi; } - diff --git a/libmpcodecs/vd_theora.c b/libmpcodecs/vd_theora.c index 69beb08198..83123c89cb 100644 --- a/libmpcodecs/vd_theora.c +++ b/libmpcodecs/vd_theora.c @@ -31,7 +31,7 @@ static int control(sh_video_t *sh,int cmd,void* arg,...){ return CONTROL_TRUE; return CONTROL_FALSE; } - + return CONTROL_UNKNOWN; } @@ -55,7 +55,7 @@ static int init(sh_video_t *sh){ switch(sh->codec->outfmt[sh->outfmtidx]) { case IMGFMT_YV12: /* well, this should work... */ break; - default: + default: mp_msg (MSGT_DECVIDEO,MSGL_ERR,"Unsupported out_fmt: 0x%X\n", sh->codec->outfmt[sh->outfmtidx]); return 0; @@ -71,7 +71,7 @@ static int init(sh_video_t *sh){ theora_info_init(&context->inf); theora_comment_init(&context->cc); - + /* Read all header packets, pass them to theora_decode_header. */ for (i = 0; i < THEORA_NUM_HEADER_PACKETS; i++) { @@ -112,13 +112,13 @@ static int init(sh_video_t *sh){ sh->aspect = (float)(context->inf.aspect_numerator * context->inf.frame_width)/ (context->inf.aspect_denominator * context->inf.frame_height); } - + mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Theora video init ok!\n"); return mpcodecs_config_vo (sh,context->inf.frame_width,context->inf.frame_height,IMGFMT_YV12); } -/* +/* * uninit driver */ static void uninit(sh_video_t *sh) @@ -137,7 +137,7 @@ static void uninit(sh_video_t *sh) /* * decode frame */ -static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags) +static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags) { theora_struct_t *context = (theora_struct_t *)sh->context; int errorCode = 0; @@ -175,6 +175,6 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags) mpi->stride[1]=yuv.uv_stride; mpi->planes[2]=yuv.v; mpi->stride[2]=yuv.uv_stride; - + return mpi; } diff --git a/libmpcodecs/vd_vfw.c b/libmpcodecs/vd_vfw.c index 0dd42d1ce5..197ead6bae 100644 --- a/libmpcodecs/vd_vfw.c +++ b/libmpcodecs/vd_vfw.c @@ -142,7 +142,7 @@ static int init(sh_video_t *sh){ // unsigned int outfmt=sh->codec->outfmt[sh->outfmtidx]; int i, o_bih_len; vd_vfw_ctx *priv; - + /* Hack for VSSH codec: new dll can't decode old files * In my samples old files have no extradata, so use that info * to decide what dll should be used (here and in vd_dshow). @@ -171,7 +171,7 @@ static int init(sh_video_t *sh){ // sh->bih->biBitCount=32; o_bih_len = ICDecompressGetFormatSize(priv->handle, sh->bih); - + if(o_bih_len < sizeof(BITMAPINFOHEADER)){ mp_msg(MSGT_WIN32,MSGL_ERR,"ICDecompressGetFormatSize returned a bogus value: %d\n", o_bih_len); return 0; @@ -268,7 +268,7 @@ static int init(sh_video_t *sh){ static void uninit(sh_video_t *sh){ HRESULT ret; vd_vfw_ctx *priv = sh->context; - + #ifdef BUILD_VFWEX ret = ICDecompressEndEx(priv->handle); #else @@ -286,7 +286,7 @@ static void uninit(sh_video_t *sh){ mp_msg(MSGT_WIN32, MSGL_WARN, "ICClose failed: %ld\n", ret); return; } - + free(priv->o_bih); free(priv); } @@ -299,9 +299,9 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ if(len<=0) return NULL; // skipped frame - mpi=mpcodecs_get_image(sh, + mpi=mpcodecs_get_image(sh, (sh->codec->outflags[sh->outfmtidx] & CODECS_FLAG_STATIC) ? - MP_IMGTYPE_STATIC : MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_WIDTH, + MP_IMGTYPE_STATIC : MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_WIDTH, sh->disp_w, sh->disp_h); if(!mpi){ // temporary! mp_tmsg(MSGT_DECVIDEO,MSGL_WARN,"[VD_DMO] Couldn't allocate image for cinepak codec.\n"); @@ -315,9 +315,9 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ sh->bih->biSizeImage = len; #ifdef BUILD_VFWEX - ret = ICDecompressEx(priv->handle, + ret = ICDecompressEx(priv->handle, #else - ret = ICDecompress(priv->handle, + ret = ICDecompress(priv->handle, #endif ( (sh->ds->flags&1) ? 0 : ICDECOMPRESS_NOTKEYFRAME ) | ( ((flags&3)==2 && !(sh->ds->flags&1))?(ICDECOMPRESS_HURRYUP|ICDECOMPRESS_PREROL):0 ), @@ -327,7 +327,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Error decompressing frame, err=%ld\n",ret); return NULL; } - + // export palette: if(mpi->imgfmt==IMGFMT_RGB8 || mpi->imgfmt==IMGFMT_BGR8){ if (priv->palette) @@ -339,6 +339,6 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ else mpi->planes[1]=NULL; } - + return mpi; } diff --git a/libmpcodecs/vd_xanim.c b/libmpcodecs/vd_xanim.c index eb06eef122..4922d9d590 100644 --- a/libmpcodecs/vd_xanim.c +++ b/libmpcodecs/vd_xanim.c @@ -221,7 +221,7 @@ static int xacodec_load(sh_video_t *sh, char *filename) dlclose(priv->file_handler); return 0; } - + mod_hdr = what_the(); if (!mod_hdr) { @@ -229,7 +229,7 @@ static int xacodec_load(sh_video_t *sh, char *filename) dlclose(priv->file_handler); return 0; } - + mp_msg(MSGT_DECVIDEO, MSGL_V, "=== XAnim Codec ===\n"); mp_msg(MSGT_DECVIDEO, MSGL_V, " Filename: %s (API revision: %x)\n", filename, mod_hdr->api_rev); mp_msg(MSGT_DECVIDEO, MSGL_V, " Codec: %s. Rev: %s\n", mod_hdr->desc, mod_hdr->rev); @@ -255,7 +255,7 @@ static int xacodec_load(sh_video_t *sh, char *filename) dlclose(priv->file_handler); return 0; } - + mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "Exported functions by codec: [functable: %p entries: %d]\n", mod_hdr->funcs, mod_hdr->num_funcs); for (i = 0; i < (int)mod_hdr->num_funcs; i++) @@ -637,7 +637,7 @@ static int init(sh_video_t *sh) char dll[1024]; XA_CODEC_HDR codec_hdr; int i; - + priv = malloc(sizeof(vd_xanim_ctx)); if (!priv) return 0; @@ -645,7 +645,7 @@ static int init(sh_video_t *sh) memset(priv, 0, sizeof(vd_xanim_ctx)); if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YV12)) return 0; - + priv->iq_func = NULL; priv->dec_func = NULL; @@ -751,7 +751,7 @@ static mp_image_t* decode(sh_video_t *sh, void *data, int len, int flags) { vd_xanim_ctx *priv = sh->context; unsigned int ret; - + if (len <= 0) return NULL; // skipped frame @@ -759,7 +759,7 @@ static mp_image_t* decode(sh_video_t *sh, void *data, int len, int flags) if(sh->codec->outflags[sh->outfmtidx] & CODECS_FLAG_STATIC){ // allocate static buffer for cvid-like codecs: - priv->mpi = mpcodecs_get_image(sh, MP_IMGTYPE_STATIC, + priv->mpi = mpcodecs_get_image(sh, MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_PREFER_ALIGNED_STRIDE, (sh->disp_w+3)&(~3), (sh->disp_h+3)&(~3)); if (!priv->mpi) return NULL; @@ -817,6 +817,6 @@ static mp_image_t* decode(sh_video_t *sh, void *data, int len, int flags) mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "body\n"); return NULL; } - + return priv->mpi; } diff --git a/libmpcodecs/vd_xvid4.c b/libmpcodecs/vd_xvid4.c index 54d3a2a563..62eab8c3ed 100644 --- a/libmpcodecs/vd_xvid4.c +++ b/libmpcodecs/vd_xvid4.c @@ -103,10 +103,10 @@ static int init(sh_video_t *sh) memset(&xvid_gbl_info, 0, sizeof(xvid_gbl_info_t)); xvid_gbl_info.version = XVID_VERSION; - + memset(&xvid_ini, 0, sizeof(xvid_gbl_init_t)); xvid_ini.version = XVID_VERSION; - + memset(&dec_p, 0, sizeof(xvid_dec_create_t)); dec_p.version = XVID_VERSION; @@ -123,16 +123,16 @@ static int init(sh_video_t *sh) case IMGFMT_UYVY: cs = XVID_CSP_UYVY; break; - case IMGFMT_I420: + case IMGFMT_I420: case IMGFMT_IYUV: /* We will use our own buffers, this speeds decoding avoiding * frame memcpy's overhead */ cs = (do_dr2)?XVID_CSP_INTERNAL:XVID_CSP_USER; break; - case IMGFMT_BGR15: + case IMGFMT_BGR15: cs = XVID_CSP_RGB555; break; - case IMGFMT_BGR16: + case IMGFMT_BGR16: cs = XVID_CSP_RGB565; break; case IMGFMT_BGR32: @@ -157,7 +157,7 @@ static int init(sh_video_t *sh) XVID_VERSION_PATCH(xvid_gbl_info.actual_version), xvid_gbl_info.build); } - + /* Initialize the xvidcore library */ if(xvid_global(NULL, XVID_GBL_INIT, &xvid_ini, NULL)) return 0; @@ -241,7 +241,7 @@ static mp_image_t* decode(sh_video_t *sh, void* data, int len, int flags) dec.general |= (lumadering ? XVID_DEBLOCKY|XVID_DERINGY : 0 ); dec.general |= (chromadering ? XVID_DEBLOCKUV|XVID_DERINGUV : 0 ); #endif - dec.output.csp = p->cs; + dec.output.csp = p->cs; /* Decoding loop because xvidcore may return VOL information for * on the fly buffer resizing. In that case we must decode VOL, @@ -256,18 +256,18 @@ static mp_image_t* decode(sh_video_t *sh, void* data, int len, int flags) mpi = mpcodecs_get_image(sh, p->img_type, MP_IMGFLAG_ACCEPT_STRIDE, sh->disp_w, sh->disp_h); - + if(p->cs != XVID_CSP_INTERNAL) { dec.output.plane[0] = mpi->planes[0]; dec.output.plane[1] = mpi->planes[1]; dec.output.plane[2] = mpi->planes[2]; - dec.output.stride[0] = mpi->stride[0]; - dec.output.stride[1] = mpi->stride[1]; + dec.output.stride[0] = mpi->stride[0]; + dec.output.stride[1] = mpi->stride[1]; dec.output.stride[2] = mpi->stride[2]; } } - + /* Decode data */ consumed = xvid_decore(p->hdl, XVID_DEC_DECODE, &dec, &stats); if (consumed < 0) { @@ -281,7 +281,7 @@ static mp_image_t* decode(sh_video_t *sh, void* data, int len, int flags) sh->aspect = stats2aspect(&stats); if(!mpcodecs_config_vo(sh, stats.data.vol.width, stats.data.vol.height, IMGFMT_YV12)) return NULL; - + /* Don't take this path twice */ p->vo_initialized = !p->vo_initialized; } @@ -294,7 +294,7 @@ static mp_image_t* decode(sh_video_t *sh, void* data, int len, int flags) /* There are two ways to get out of the decoding loop: * - a frame has been returned * - no more data in buffer and no frames returned */ - + /* If mpi is NULL, it proves nothing has been returned by the decoder * so don't try to display internal buffers. */ if (mpi != NULL && p->cs == XVID_CSP_INTERNAL) { @@ -324,12 +324,12 @@ static float stats2aspect(xvid_dec_stats_t *stats) float wpar; float hpar; float dar; - + /* MPEG4 strem stores PAR (Pixel Aspect Ratio), mplayer uses * DAR (Display Aspect Ratio) - * + * * Both are related thanks to the equation: - * width + * width * DAR = ----- x PAR * height * diff --git a/libmpcodecs/vd_zrmjpeg.c b/libmpcodecs/vd_zrmjpeg.c index 2d35ec1420..8dd460ab5b 100644 --- a/libmpcodecs/vd_zrmjpeg.c +++ b/libmpcodecs/vd_zrmjpeg.c @@ -59,7 +59,7 @@ static int query_format(sh_video_t *sh, unsigned int format) { if (format == ctx->preferred_csp) return VFCAP_CSP_SUPPORTED; return CONTROL_FALSE; } - + // to set/get/query special features/parameters static int control(sh_video_t *sh, int cmd, void* arg, ...) { switch (cmd) { @@ -80,9 +80,9 @@ static int init(sh_video_t *sh) { sh->context = ctx; /* defer init of vo until the first frame is known */ - return 1; + return 1; #if 0 - return mpcodecs_config_vo(sh, sh->disp_w, sh->disp_h, IMGFMT_ZRMJPEGIT); + return mpcodecs_config_vo(sh, sh->disp_w, sh->disp_h, IMGFMT_ZRMJPEGIT); #endif } @@ -122,7 +122,7 @@ static unsigned int guess_mjpeg_type(unsigned char *data, unsigned int size, ERROR("JPEG data must start with FFD8, but doesn't\n"); return 0; } - + p = 2; /* pointer within jpeg data */ while (p < size) { @@ -131,7 +131,7 @@ static unsigned int guess_mjpeg_type(unsigned char *data, unsigned int size, p++; if (p >= size) return 0; } - + /* get marker code, skip duplicate FF's */ while(data[p] == 0xFF) { p++; @@ -142,7 +142,7 @@ static unsigned int guess_mjpeg_type(unsigned char *data, unsigned int size, /* marker may have an associated length */ if (p <= size - 2) length = get_int2(data+p); - else length = 0; + else length = 0; switch (marker) { case M_SOF0: @@ -163,10 +163,10 @@ static unsigned int guess_mjpeg_type(unsigned char *data, unsigned int size, /* these markers shouldn't have parameters, * i.e. we don't need to skip anaything */ - if (marker == 0 || marker == 1 || + if (marker == 0 || marker == 1 || (marker >= 0xd0 && marker < 0xd8)) - continue; - + continue; + if (p + length <= size) p += length; else { ERROR("input JPEG too short, data missing\n"); @@ -223,9 +223,9 @@ static unsigned int guess_mjpeg_type(unsigned char *data, unsigned int size, return IMGFMT_ZRMJPEGIT; } - + return 0; -} +} // decode a frame static mp_image_t* decode(sh_video_t *sh, void* data, int len, int flags) { @@ -235,12 +235,12 @@ static mp_image_t* decode(sh_video_t *sh, void* data, int len, int flags) { if (!ctx->vo_initialized) { ctx->preferred_csp = guess_mjpeg_type(data, len, sh->disp_h); if (ctx->preferred_csp == 0) return NULL; - mpcodecs_config_vo(sh, sh->disp_w, sh->disp_h, + mpcodecs_config_vo(sh, sh->disp_w, sh->disp_h, ctx->preferred_csp); ctx->vo_initialized = 1; } - mpi = mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0, + mpi = mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0, sh->disp_w, sh->disp_h); /* abuse of mpi */ mpi->planes[0]=(uint8_t*)data; diff --git a/libmpcodecs/ve.c b/libmpcodecs/ve.c index 9d083f5d86..9781bfc0d8 100644 --- a/libmpcodecs/ve.c +++ b/libmpcodecs/ve.c @@ -55,4 +55,3 @@ vf_instance_t* vf_open_encoder(struct MPOpts *opts, vf_instance_t* next, const c char* vf_args[] = { "_oldargs_", args, NULL }; return vf_open_plugin(opts, encoder_list,next,name,vf_args); } - diff --git a/libmpcodecs/ve_lavc.c b/libmpcodecs/ve_lavc.c index 44b1029443..c9d60a202a 100644 --- a/libmpcodecs/ve_lavc.c +++ b/libmpcodecs/ve_lavc.c @@ -332,7 +332,7 @@ static int config(struct vf_instance* vf, unsigned int flags, unsigned int outfmt){ int size, i; void *p; - + mux_v->bih->biWidth=width; mux_v->bih->biHeight=height; mux_v->bih->biSizeImage=mux_v->bih->biWidth*mux_v->bih->biHeight*(mux_v->bih->biBitCount/8); @@ -428,7 +428,7 @@ static int config(struct vf_instance* vf, break; lavc_venc_context->intra_matrix[i++] = atoi(tmp); } - + if (i != 64) av_freep(&lavc_venc_context->intra_matrix); else @@ -448,7 +448,7 @@ static int config(struct vf_instance* vf, break; lavc_venc_context->inter_matrix[i++] = atoi(tmp); } - + if (i != 64) av_freep(&lavc_venc_context->inter_matrix); else @@ -463,7 +463,7 @@ static int config(struct vf_instance* vf, mp_msg(MSGT_MENCODER,MSGL_ERR,"error parsing vrc_q\n"); return 0; } - lavc_venc_context->rc_override= + lavc_venc_context->rc_override= realloc(lavc_venc_context->rc_override, sizeof(RcOverride)*(i+1)); lavc_venc_context->rc_override[i].start_frame= start; lavc_venc_context->rc_override[i].end_frame = end; @@ -496,7 +496,7 @@ static int config(struct vf_instance* vf, { int par_width, par_height, e; float ratio=0; - + e= sscanf (lavc_param_aspect, "%d/%d", &par_width, &par_height); if(e==2){ if(par_height) @@ -507,7 +507,7 @@ static int config(struct vf_instance* vf, if (e && ratio > 0.1 && ratio < 10.0) { lavc_venc_context->sample_aspect_ratio= av_d2q(ratio * height / width, 255); - mp_dbg(MSGT_MENCODER, MSGL_DBG2, "sample_aspect_ratio: %d/%d\n", + mp_dbg(MSGT_MENCODER, MSGL_DBG2, "sample_aspect_ratio: %d/%d\n", lavc_venc_context->sample_aspect_ratio.num, lavc_venc_context->sample_aspect_ratio.den); mux_v->aspect = ratio; @@ -540,7 +540,7 @@ static int config(struct vf_instance* vf, lavc_venc_context->mb_cmp= lavc_param_mb_cmp; #ifdef FF_CMP_VSAD lavc_venc_context->ildct_cmp= lavc_param_ildct_cmp; -#endif +#endif lavc_venc_context->dia_size= lavc_param_dia_size; lavc_venc_context->flags|= lavc_param_qpel; lavc_venc_context->trellis = lavc_param_trell; @@ -562,7 +562,7 @@ static int config(struct vf_instance* vf, lavc_venc_context->flags|= lavc_param_gmc; #ifdef CODEC_FLAG_CLOSED_GOP lavc_venc_context->flags|= lavc_param_closed_gop; -#endif +#endif if(lavc_param_gray) lavc_venc_context->flags|= CODEC_FLAG_GRAY; if(lavc_param_normalize_aqp) lavc_venc_context->flags|= CODEC_FLAG_NORMALIZE_AQP; @@ -623,7 +623,7 @@ static int config(struct vf_instance* vf, switch(lavc_param_vpass){ case 2: case 3: - lavc_venc_context->flags|= CODEC_FLAG_PASS2; + lavc_venc_context->flags|= CODEC_FLAG_PASS2; stats_file= fopen(passtmpfile, "rb"); if(stats_file==NULL){ mp_msg(MSGT_MENCODER,MSGL_ERR,"2pass failed: filename=%s\n", passtmpfile); @@ -632,21 +632,21 @@ static int config(struct vf_instance* vf, fseek(stats_file, 0, SEEK_END); size= ftell(stats_file); fseek(stats_file, 0, SEEK_SET); - + lavc_venc_context->stats_in= av_malloc(size + 1); lavc_venc_context->stats_in[size]=0; if(fread(lavc_venc_context->stats_in, size, 1, stats_file)<1){ mp_msg(MSGT_MENCODER,MSGL_ERR,"2pass failed: reading from filename=%s\n", passtmpfile); return 0; - } + } if(lavc_param_vpass == 2) break; else fclose(stats_file); /* fall through */ - case 1: - lavc_venc_context->flags|= CODEC_FLAG_PASS1; + case 1: + lavc_venc_context->flags|= CODEC_FLAG_PASS1; stats_file= fopen(passtmpfile, "wb"); if(stats_file==NULL){ mp_msg(MSGT_MENCODER,MSGL_ERR,"2pass failed: filename=%s\n", passtmpfile); @@ -685,7 +685,7 @@ static int config(struct vf_instance* vf, { mp_tmsg(MSGT_MENCODER, MSGL_INFO, "[VE_LAVC] Using constant qscale = %f (VBR).\n", lavc_param_vqscale); lavc_venc_context->flags |= CODEC_FLAG_QSCALE; - lavc_venc_context->global_quality= + lavc_venc_context->global_quality= vf->priv->pic->quality = (int)(FF_QP2LAMBDA * lavc_param_vqscale + 0.5); } @@ -701,7 +701,7 @@ static int config(struct vf_instance* vf, mp_msg(MSGT_MENCODER,MSGL_ERR,"avcodec init failed (ctx->codec->encode == NULL)!\n"); return 0; } - + /* free second pass buffer, its not needed anymore */ av_freep(&lavc_venc_context->stats_in); if(lavc_venc_context->bits_per_coded_sample) @@ -711,9 +711,9 @@ static int config(struct vf_instance* vf, memcpy(mux_v->bih + 1, lavc_venc_context->extradata, lavc_venc_context->extradata_size); mux_v->bih->biSize= sizeof(BITMAPINFOHEADER) + lavc_venc_context->extradata_size; } - + mux_v->decoder_delay = lavc_venc_context->max_b_frames ? 1 : 0; - + return 1; } @@ -779,9 +779,9 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ if(lavc_param_interlaced_dct){ if((mpi->fields & MP_IMGFIELD_ORDERED) && (mpi->fields & MP_IMGFIELD_INTERLACED)) pic->top_field_first= !!(mpi->fields & MP_IMGFIELD_TOP_FIRST); - else + else pic->top_field_first= 1; - + if(lavc_param_top!=-1) pic->top_field_first= lavc_param_top; } @@ -811,7 +811,7 @@ static int encode_frame(struct vf_instance* vf, AVFrame *pic, double pts){ out_size = avcodec_encode_video(lavc_venc_context, mux_v->buffer, mux_v->buffer_size, pic); - if(pts != MP_NOPTS_VALUE) + if(pts != MP_NOPTS_VALUE) dts= pts - lavc_venc_context->delay * av_q2d(lavc_venc_context->time_base); else dts= MP_NOPTS_VALUE; @@ -831,12 +831,12 @@ static int encode_frame(struct vf_instance* vf, AVFrame *pic, double pts){ ++mux_v->encoder_delay; return 0; } - - muxer_write_chunk(mux_v,out_size,lavc_venc_context->coded_frame->key_frame?0x10:0, + + muxer_write_chunk(mux_v,out_size,lavc_venc_context->coded_frame->key_frame?0x10:0, dts, pts); free(lavc_venc_context->coded_frame->opaque); lavc_venc_context->coded_frame->opaque= NULL; - + /* store psnr / pict size / type / qscale */ if(lavc_param_psnr){ static FILE *fvstats=NULL; @@ -861,7 +861,7 @@ static int encode_frame(struct vf_instance* vf, AVFrame *pic, double pts){ /*exit(1);*/ } } - + // average MB quantizer q = lavc_venc_context->coded_frame->qscale_table; if(q) { @@ -874,7 +874,7 @@ static int encode_frame(struct vf_instance* vf, AVFrame *pic, double pts){ q += lavc_venc_context->coded_frame->qstride; } quality /= w * h; - } else + } else quality = lavc_venc_context->coded_frame->quality / (float)FF_QP2LAMBDA; fprintf(fvstats, "%6d, %2.2f, %6d, %2.2f, %2.2f, %2.2f, %2.2f %c\n", @@ -889,7 +889,7 @@ static int encode_frame(struct vf_instance* vf, AVFrame *pic, double pts){ ); } /* store stats if there are any */ - if(lavc_venc_context->stats_out && stats_file) + if(lavc_venc_context->stats_out && stats_file) fprintf(stats_file, "%s", lavc_venc_context->stats_out); return out_size; } @@ -899,7 +899,7 @@ static void uninit(struct vf_instance* vf){ if(lavc_param_psnr){ double f= lavc_venc_context->width*lavc_venc_context->height*255.0*255.0; f*= lavc_venc_context->coded_frame->coded_picture_number; - + mp_msg(MSGT_MENCODER, MSGL_INFO, "PSNR: Y:%2.2f, Cb:%2.2f, Cr:%2.2f, All:%2.2f\n", psnr(lavc_venc_context->error[0]/f), psnr(lavc_venc_context->error[1]*4/f), @@ -914,7 +914,7 @@ static void uninit(struct vf_instance* vf){ avcodec_close(lavc_venc_context); if(stats_file) fclose(stats_file); - + /* free rc_override */ av_freep(&lavc_venc_context->rc_override); diff --git a/libmpcodecs/ve_libdv.c b/libmpcodecs/ve_libdv.c index da0f261d58..23733e70e7 100644 --- a/libmpcodecs/ve_libdv.c +++ b/libmpcodecs/ve_libdv.c @@ -31,7 +31,7 @@ struct vf_priv_s { muxer_stream_t* mux; dv_encoder_t* enc; - + }; #define mux_v (vf->priv->mux) @@ -44,7 +44,7 @@ static int config(struct vf_instance* vf, if(width!=DV_WIDTH || (height!=DV_PAL_HEIGHT && height!=DV_NTSC_HEIGHT)){ mp_msg(MSGT_VFILTER,MSGL_ERR,"DV: only 720x480 (NTSC) and 720x576 (PAL) resolutions allowed! Try with -vf scale=720:480\n"); } - + vf->priv->enc->isPAL=(height==DV_PAL_HEIGHT); vf->priv->enc->is16x9=(d_width/(float)d_height > 1.7); // 16:9=1.777777 vf->priv->enc->vlc_encode_passes=3; @@ -72,7 +72,7 @@ static int query_format(struct vf_instance* vf, unsigned int fmt){ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ - dv_encode_full_frame(vf->priv->enc, mpi->planes, + dv_encode_full_frame(vf->priv->enc, mpi->planes, (mpi->flags&MP_IMGFLAG_YUV) ? e_dv_color_yuv : e_dv_color_rgb, mux_v->buffer); @@ -91,10 +91,10 @@ static int vf_open(vf_instance_t *vf, char* args){ vf->priv=malloc(sizeof(struct vf_priv_s)); memset(vf->priv,0,sizeof(struct vf_priv_s)); vf->priv->mux=(muxer_stream_t*)args; - + vf->priv->enc=dv_encoder_new(0,1,1); // FIXME, parse some options! if(!vf->priv->enc) return 0; - + mux_v->bih=calloc(1, sizeof(BITMAPINFOHEADER)); mux_v->bih->biSize=sizeof(BITMAPINFOHEADER); mux_v->bih->biWidth=0; diff --git a/libmpcodecs/ve_nuv.c b/libmpcodecs/ve_nuv.c index 7131d19278..67cc8b532d 100644 --- a/libmpcodecs/ve_nuv.c +++ b/libmpcodecs/ve_nuv.c @@ -62,7 +62,7 @@ m_option_t nuvopts_conf[]={ {"l", &nuv_priv_dflt.l, CONF_TYPE_INT, M_OPT_RANGE,0,20, NULL}, {"c", &nuv_priv_dflt.c, CONF_TYPE_INT, M_OPT_RANGE,0,20, NULL}, {NULL, NULL, 0, 0, 0, 0, NULL} -}; +}; //===========================================================================// @@ -112,16 +112,16 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ memset(header, 0, FRAMEHEADERSIZE); // Reset the header if(vf->priv->lzo) memset(vf->priv->zbuffer,0,FRAMEHEADERSIZE); - + // This has to be don here otherwise tv with sound doesn't work - if(!vf->priv->tbl_wrote) { + if(!vf->priv->tbl_wrote) { RTjpeg_init_compress((uint32_t *)data,mpi->width,mpi->height,vf->priv->q); RTjpeg_init_mcompress(); header[0] = 'D'; // frametype: compressor data header[1] = 'R'; // comptype: compressor data for RTjpeg AV_WL32(header + 8, COMPDATASIZE); // packetlength - + mux_v->buffer=vf->priv->buffer; muxer_write_chunk(mux_v,FRAMEHEADERSIZE + COMPDATASIZE, 0x10, MP_NOPTS_VALUE, MP_NOPTS_VALUE); vf->priv->tbl_wrote = 1; @@ -175,7 +175,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ } } - + header[0] = 'V'; // frametype: video frame AV_WL32(header + 8, len); // packetlength mux_v->buffer = header; @@ -206,7 +206,7 @@ static int vf_open(vf_instance_t *vf, char* args){ vf->priv=malloc(sizeof(struct vf_priv_s)); memcpy(vf->priv, &nuv_priv_dflt,sizeof(struct vf_priv_s)); vf->priv->mux=(muxer_stream_t*)args; - + mux_v->bih=calloc(1, sizeof(BITMAPINFOHEADER)); mux_v->bih->biSize=sizeof(BITMAPINFOHEADER); mux_v->bih->biWidth=0; diff --git a/libmpcodecs/ve_qtvideo.c b/libmpcodecs/ve_qtvideo.c index 9e890a348b..92b76fb252 100644 --- a/libmpcodecs/ve_qtvideo.c +++ b/libmpcodecs/ve_qtvideo.c @@ -30,9 +30,9 @@ #include "mp_msg.h" #include "mpbswap.h" -#ifdef WIN32_LOADER +#ifdef WIN32_LOADER #include "loader/ldt_keeper.h" -#endif +#endif #include "loader/qtx/qtxsdk/components.h" #include "loader/wine/windef.h" @@ -321,7 +321,7 @@ static int vf_open(vf_instance_t *vf, char* args){ mp_msg(MSGT_MENCODER,MSGL_ERR,"unable to load QuickTime.qts\n" ); return 0; } - + handler = LoadLibraryA("qtmlClient.dll"); if(!handler){ mp_msg(MSGT_MENCODER,MSGL_ERR,"unable to load qtmlClient.dll\n"); diff --git a/libmpcodecs/ve_raw.c b/libmpcodecs/ve_raw.c index b3bb51b251..5e438f727d 100644 --- a/libmpcodecs/ve_raw.c +++ b/libmpcodecs/ve_raw.c @@ -29,7 +29,7 @@ struct vf_priv_s { static int set_format(struct vf_instance *vf, unsigned int fmt) { if (!force_fourcc) mux_v->bih->biCompression = fmt; - + mux_v->bih->biPlanes = 1; if (IMGFMT_IS_RGB(fmt)) { if (IMGFMT_RGB_DEPTH(fmt) < 8 && !(fmt&128)) @@ -140,7 +140,7 @@ static int vf_open(vf_instance_t *vf, char* args){ vf->priv = malloc(sizeof(struct vf_priv_s)); memset(vf->priv, 0, sizeof(struct vf_priv_s)); vf->priv->mux = (muxer_stream_t*)args; - + mux_v->bih = calloc(1, sizeof(BITMAPINFOHEADER)); mux_v->bih->biSize = sizeof(BITMAPINFOHEADER); mux_v->bih->biWidth = 0; diff --git a/libmpcodecs/ve_vfw.c b/libmpcodecs/ve_vfw.c index 0517666776..bc116df2bc 100644 --- a/libmpcodecs/ve_vfw.c +++ b/libmpcodecs/ve_vfw.c @@ -167,7 +167,7 @@ static int vfw_start_encoder(BITMAPINFOHEADER *input_bih, BITMAPINFOHEADER *outp return 0; } mp_msg(MSGT_WIN32,MSGL_V,"ICCompressGetFormat OK\n"); - + if (temp_len > sizeof(BITMAPINFOHEADER)) { unsigned char* temp=(unsigned char*)output_bih; @@ -220,7 +220,7 @@ static int vfw_start_encoder(BITMAPINFOHEADER *input_bih, BITMAPINFOHEADER *outp mp_msg(MSGT_WIN32,MSGL_INFO," biBitCount %d\n", output_bih->biBitCount); mp_msg(MSGT_WIN32,MSGL_INFO," biCompression 0x%lx ('%.4s')\n", output_bih->biCompression, (char *)&output_bih->biCompression); mp_msg(MSGT_WIN32,MSGL_INFO," biSizeImage %ld\n", output_bih->biSizeImage); - + encoder_buf_size=input_bih->biSizeImage; encoder_buf=malloc(encoder_buf_size); encoder_frameno=0; diff --git a/libmpcodecs/ve_x264.c b/libmpcodecs/ve_x264.c index 724619ad04..51da237169 100644 --- a/libmpcodecs/ve_x264.c +++ b/libmpcodecs/ve_x264.c @@ -158,7 +158,7 @@ static int config(struct vf_instance* vf, int width, int height, int d_width, in mod->mux->bih->biHeight = height; mod->mux->bih->biSizeImage = width * height * 3; mod->mux->aspect = (float)d_width/d_height; - + // make sure param is initialized x264enc_set_param(NULL, ""); param.i_width = width; @@ -181,7 +181,7 @@ static int config(struct vf_instance* vf, int width, int height, int d_width, in mp_msg(MSGT_MENCODER, MSGL_ERR, "Wrong colorspace.\n"); return 0; } - + mod->x264 = x264_encoder_open(¶m); if(!mod->x264) { mp_msg(MSGT_MENCODER, MSGL_ERR, "x264_encoder_open failed.\n"); @@ -206,12 +206,12 @@ static int config(struct vf_instance* vf, int width, int height, int d_width, in memcpy(mod->mux->bih + 1, extradata, extradata_size); mod->mux->bih->biSize= sizeof(BITMAPINFOHEADER) + extradata_size; } - + if (param.i_bframe > 1 && param.b_bframe_pyramid) mod->mux->decoder_delay = 2; else mod->mux->decoder_delay = param.i_bframe ? 1 : 0; - + return 1; } @@ -251,7 +251,7 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) { h264_module_t *mod=(h264_module_t*)vf->priv; int i; - + memset(&mod->pic, 0, sizeof(x264_picture_t)); mod->pic.img.i_csp=param.i_csp; mod->pic.img.i_plane=3; @@ -278,7 +278,7 @@ static int encode_frame(struct vf_instance *vf, x264_picture_t *pic_in) mp_msg(MSGT_MENCODER, MSGL_ERR, "x264_encoder_encode failed\n"); return -1; } - + for(i=0; i < i_nal; i++) { int i_data = mod->mux->buffer_size - i_size; i_size += x264_nal_encode(mod->mux->buffer + i_size, &i_data, 1, &nal[i]); diff --git a/libmpcodecs/ve_xvid4.c b/libmpcodecs/ve_xvid4.c index 2b55f7744f..858ca903f4 100644 --- a/libmpcodecs/ve_xvid4.c +++ b/libmpcodecs/ve_xvid4.c @@ -256,7 +256,7 @@ m_option_t xvidencopts_conf[] = {"frame_drop_ratio", &xvidenc_frame_drop_ratio, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL}, {"max_key_interval", &xvidenc_max_key_interval, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL}, {"greyscale", &xvidenc_greyscale, CONF_TYPE_FLAG, 0, 0, 1, NULL}, /* kept for backward compatibility */ - {"grayscale", &xvidenc_greyscale, CONF_TYPE_FLAG, 0, 0, 1, NULL}, + {"grayscale", &xvidenc_greyscale, CONF_TYPE_FLAG, 0, 0, 1, NULL}, {"nogreyscale", &xvidenc_greyscale, CONF_TYPE_FLAG, 0, 1, 0, NULL}, {"lumi_mask", &xvidenc_luminance_masking, CONF_TYPE_FLAG, 0, 0, 1, NULL}, {"nolumi_mask", &xvidenc_luminance_masking, CONF_TYPE_FLAG, 0, 1, 0, NULL}, @@ -347,9 +347,9 @@ typedef struct xvid_mplayer_module_t int max_sse_u; int max_sse_v; int max_framenum; - + int pixels; - + /* DAR/PAR and all that thingies */ int d_width; int d_height; @@ -380,11 +380,11 @@ config(struct vf_instance* vf, { int err; xvid_mplayer_module_t *mod = (xvid_mplayer_module_t *)vf->priv; - + /* Complete the muxer initialization */ mod->mux->bih->biWidth = width; mod->mux->bih->biHeight = height; - mod->mux->bih->biSizeImage = + mod->mux->bih->biSizeImage = mod->mux->bih->biWidth * mod->mux->bih->biHeight * 3 / 2; mod->mux->aspect = (float)d_width/d_height; @@ -425,7 +425,7 @@ config(struct vf_instance* vf, "xvid: xvidcore returned a '%s' error\n", errorstring(err)); return BAD; } - + /* Store the encoder instance into the private data */ mod->instance = mod->create.handle; @@ -517,7 +517,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts) { int size; - xvid_enc_stats_t stats; + xvid_enc_stats_t stats; xvid_mplayer_module_t *mod = (xvid_mplayer_module_t *)vf->priv; /* Prepare the stats */ @@ -630,7 +630,7 @@ vf_open(vf_instance_t *vf, char* args) XVID_VERSION_PATCH(xvid_gbl_info.actual_version), xvid_gbl_info.build); } - + /* Initialize the xvid_gbl_init structure */ memset(&xvid_gbl_init, 0, sizeof(xvid_gbl_init_t)); xvid_gbl_init.version = XVID_VERSION; @@ -681,7 +681,7 @@ static int dispatch_settings(xvid_mplayer_module_t *mod) "xvid:[ERROR] \"%s\" is an invalid profile name\n", xvidenc_profile); return BAD; } - + /* ------------------------------------------------------------------- * Dispatch all settings having an impact on the "create" structure * This includes plugins as they are passed to encore through the @@ -736,7 +736,7 @@ static int dispatch_settings(xvid_mplayer_module_t *mod) if(selected_profile->flags & PROFILE_DXN) create->global |= XVID_GLOBAL_DIVX5_USERDATA; #endif - + create->max_key_interval = xvidenc_max_key_interval; create->frame_drop_ratio = xvidenc_frame_drop_ratio; create->min_quant[0] = xvidenc_min_quant[0]; @@ -899,12 +899,12 @@ static int dispatch_settings(xvid_mplayer_module_t *mod) if( !(selected_profile->flags & PROFILE_DXN) ) { - if(xvidenc_dar_aspect > 0) + if(xvidenc_dar_aspect > 0) ar = av_d2q(xvidenc_dar_aspect * mod->mux->bih->biHeight / mod->mux->bih->biWidth, 255); else if(xvidenc_autoaspect) ar = av_d2q((float)mod->d_width / mod->d_height * mod->mux->bih->biHeight / mod->mux->bih->biWidth, 255); else ar.num = ar.den = 0; - + if(ar.den != 0) { if(ar.num == 12 && ar.den == 11) frame->par = XVID_PAR_43_PAL; @@ -915,12 +915,12 @@ static int dispatch_settings(xvid_mplayer_module_t *mod) else if(ar.num == 40 && ar.den == 33) frame->par = XVID_PAR_169_NTSC; else - { + { frame->par = XVID_PAR_EXT; frame->par_width = ar.num; frame->par_height= ar.den; } - + } else if(xvidenc_par != NULL) { if(strcasecmp(xvidenc_par, "pal43") == 0) frame->par = XVID_PAR_43_PAL; @@ -947,7 +947,7 @@ static int dispatch_settings(xvid_mplayer_module_t *mod) } /* Display par information */ - mp_msg(MSGT_MENCODER, MSGL_INFO, "xvid: par=%d/%d (%s), displayed=%dx%d, sampled=%dx%d\n", + mp_msg(MSGT_MENCODER, MSGL_INFO, "xvid: par=%d/%d (%s), displayed=%dx%d, sampled=%dx%d\n", ar.num, ar.den, par_string(frame->par), mod->d_width, mod->d_height, mod->mux->bih->biWidth, mod->mux->bih->biHeight); } @@ -1101,7 +1101,7 @@ static int set_create_struct(xvid_mplayer_module_t *mod) squant.num, squant.den, (float)(squant.num)/(float)(squant.den)); - + } else { mp_msg(MSGT_MENCODER, MSGL_INFO, "xvid: CBR Rate Control -- bitrate=%dkbit/s\n", @@ -1272,7 +1272,7 @@ static int set_frame_struct(xvid_mplayer_module_t *mod, mp_image_t *mpi) } static void -flush_internal_buffers(xvid_mplayer_module_t *mod) +flush_internal_buffers(xvid_mplayer_module_t *mod) { int size; xvid_enc_frame_t *frame = &mod->frame; @@ -1336,7 +1336,7 @@ update_stats(xvid_mplayer_module_t *mod, xvid_enc_stats_t *stats) mod->max_sse_v = stats->sse_v; mod->max_framenum = mod->frames; } - + if (xvidenc_psnr) { if (!mod->fvstats) { char filename[20]; @@ -1408,7 +1408,7 @@ static void *read_matrix(unsigned char *filename) int i; unsigned char *matrix; FILE *input; - + /* Allocate matrix space */ if((matrix = malloc(64*sizeof(unsigned char))) == NULL) return NULL; @@ -1450,7 +1450,7 @@ static void *read_matrix(unsigned char *filename) fclose(input); return matrix; - + } diff --git a/libmpcodecs/vf.c b/libmpcodecs/vf.c index 7bd14ff831..72d2bfe488 100644 --- a/libmpcodecs/vf.c +++ b/libmpcodecs/vf.c @@ -267,12 +267,12 @@ mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, if (h == -1) h = vf->h; w2=(mp_imgflag&MP_IMGFLAG_ACCEPT_ALIGNED_STRIDE)?((w+15)&(~15)):w; - + if(vf->put_image==vf_next_put_image){ // passthru mode, if the filter uses the fallback/default put_image() code return vf_get_image(vf->next,outfmt,mp_imgtype,mp_imgflag,w,h); } - + // Note: we should call libvo first to check if it supports direct rendering // and if not, then fallback to software buffers: switch(mp_imgtype & 0xff){ @@ -342,7 +342,7 @@ mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, // check libvo first! if(vf->get_image) vf->get_image(vf,mpi); - + if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ // non-direct and not yet allocated image. allocate it! if (!mpi->bpp) { // no way we can allocate this @@ -350,8 +350,8 @@ mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, "vf_get_image: Tried to allocate a format that can not be allocated!\n"); return NULL; } - - // check if codec prefer aligned stride: + + // check if codec prefer aligned stride: if(mp_imgflag&MP_IMGFLAG_PREFER_ALIGNED_STRIDE){ int align=(mpi->flags&MP_IMGFLAG_PLANAR && mpi->flags&MP_IMGFLAG_YUV) ? @@ -368,7 +368,7 @@ mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, } } } - + // IF09 - allocate space for 4. plane delta info - unused if (mpi->imgfmt == IMGFMT_IF09) { @@ -381,9 +381,9 @@ mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, mpi->planes[0]=memalign(64, mpi->bpp*mpi->width*(mpi->height+2)/8); if(mpi->flags&MP_IMGFLAG_PLANAR){ // YV12/I420/YVU9/IF09. feel free to add other planar formats here... - //if(!mpi->stride[0]) + //if(!mpi->stride[0]) mpi->stride[0]=mpi->width; - //if(!mpi->stride[1]) + //if(!mpi->stride[1]) if(mpi->num_planes > 2){ mpi->stride[1]=mpi->stride[2]=mpi->chroma_width; if(mpi->flags&MP_IMGFLAG_SWAPPED){ @@ -401,7 +401,7 @@ mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, mpi->planes[1]=mpi->planes[0]+mpi->width*mpi->height; } } else { - //if(!mpi->stride[0]) + //if(!mpi->stride[0]) mpi->stride[0]=mpi->width*mpi->bpp/8; } // printf("clearing img!\n"); @@ -716,7 +716,7 @@ vf_instance_t *append_filters(vf_instance_t* last, { struct MPOpts *opts = last->opts; vf_instance_t* vf; - int i; + int i; if(vf_settings) { // We want to add them in the 'right order' diff --git a/libmpcodecs/vf.h b/libmpcodecs/vf.h index 95e4ff51e7..99321b3afa 100644 --- a/libmpcodecs/vf.h +++ b/libmpcodecs/vf.h @@ -69,7 +69,7 @@ typedef struct vf_instance { // control codes: #include "mpc_info.h" -typedef struct vf_seteq_s +typedef struct vf_seteq_s { const char *item; int value; diff --git a/libmpcodecs/vf_1bpp.c b/libmpcodecs/vf_1bpp.c index c4fd04c338..3dd544bfd9 100644 --- a/libmpcodecs/vf_1bpp.c +++ b/libmpcodecs/vf_1bpp.c @@ -25,7 +25,7 @@ static const unsigned int bgr_list[]={ IMGFMT_IYUV, IMGFMT_422P, IMGFMT_444P, - + IMGFMT_YUY2, IMGFMT_BGR15, IMGFMT_RGB15, @@ -105,7 +105,7 @@ static void convert(mp_image_t *mpi, mp_image_t *dmpi, int value0, int value1,in static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ mp_image_t *dmpi; - + // hope we'll get DR buffer: dmpi=vf_get_image(vf->next,vf->priv->fmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, diff --git a/libmpcodecs/vf_2xsai.c b/libmpcodecs/vf_2xsai.c index 7405606697..2b2d435be6 100644 --- a/libmpcodecs/vf_2xsai.c +++ b/libmpcodecs/vf_2xsai.c @@ -30,11 +30,11 @@ static int Init_2xSaI(int d) int minr = 0, ming = 0, minb = 0; int i; - + // if (d != 15 && d != 16 && d != 24 && d != 32) // return -1; - /* Get lowest color bit */ + /* Get lowest color bit */ for (i = 0; i < 255; i++) { if (!minr) minr = makecol(i, 0, 0); @@ -52,7 +52,7 @@ static int Init_2xSaI(int d) greenMask = makecol_depth(d, 0, 255, 0); PixelsPerMask = (d <= 16) ? 2 : 1; - + if (PixelsPerMask == 2) { colorMask |= (colorMask << 16); qcolorMask |= (qcolorMask << 16); @@ -64,7 +64,7 @@ static int Init_2xSaI(int d) // TRACE("Low Pixel Mask: 0x%lX\n", lowPixelMask); // TRACE("QColor Mask: 0x%lX\n", qcolorMask); // TRACE("QLow Pixel Mask: 0x%lX\n", qlowpixelMask); - + return 0; } @@ -77,7 +77,7 @@ static int Init_2xSaI(int d) + ((((A & qlowpixelMask) + (B & qlowpixelMask) + (C & qlowpixelMask) + (D & qlowpixelMask)) >> 2) & qlowpixelMask) -static void Super2xSaI_ex(uint8_t *src, uint32_t src_pitch, +static void Super2xSaI_ex(uint8_t *src, uint32_t src_pitch, uint8_t *dst, uint32_t dst_pitch, uint32_t width, uint32_t height, int sbpp) { @@ -90,9 +90,9 @@ static void Super2xSaI_ex(uint8_t *src, uint32_t src_pitch, src_line[1] = src; src_line[2] = src + src_pitch; src_line[3] = src + src_pitch * 2; - + x = 0, y = 0; - + if (PixelsPerMask == 2) { unsigned short *sbp; sbp = (unsigned short*)src_line[0]; @@ -119,9 +119,9 @@ static void Super2xSaI_ex(uint8_t *src, uint32_t src_pitch, dst_line[0] = dst + dst_pitch*2*y; dst_line[1] = dst + dst_pitch*(2*y+1); - + /* Todo: x = width - 2, x = width - 1 */ - + for (x = 0; x < width; x++) { uint32_t product1a, product1b, product2a, product2b; @@ -152,7 +152,7 @@ static void Super2xSaI_ex(uint8_t *src, uint32_t src_pitch, product1b = color[5]; else product1b = INTERPOLATE(color[5], color[6]); - + product2b = product1b; } @@ -185,7 +185,7 @@ static void Super2xSaI_ex(uint8_t *src, uint32_t src_pitch, product1a = INTERPOLATE(color[9], color[5]); else product1a = color[5]; - + if (PixelsPerMask == 2) { *((uint32_t *) (&dst_line[0][x * 4])) = product1a | (product1b << 16); *((uint32_t *) (&dst_line[1][x * 4])) = product2a | (product2b << 16); @@ -196,16 +196,16 @@ static void Super2xSaI_ex(uint8_t *src, uint32_t src_pitch, *((uint32_t *) (&dst_line[1][x * 8])) = product2a; *((uint32_t *) (&dst_line[1][x * 8 + 4])) = product2b; } - + /* Move color matrix forward */ color[0] = color[1]; color[4] = color[5]; color[8] = color[9]; color[12] = color[13]; color[1] = color[2]; color[5] = color[6]; color[9] = color[10]; color[13] = color[14]; color[2] = color[3]; color[6] = color[7]; color[10] = color[11]; color[14] = color[15]; - + if (x < width - 3) { x += 3; if (PixelsPerMask == 2) { - color[3] = *(((unsigned short*)src_line[0]) + x); + color[3] = *(((unsigned short*)src_line[0]) + x); color[7] = *(((unsigned short*)src_line[1]) + x); color[11] = *(((unsigned short*)src_line[2]) + x); color[15] = *(((unsigned short*)src_line[3]) + x); @@ -223,14 +223,14 @@ static void Super2xSaI_ex(uint8_t *src, uint32_t src_pitch, /* We're done with one line, so we shift the source lines up */ src_line[0] = src_line[1]; src_line[1] = src_line[2]; - src_line[2] = src_line[3]; + src_line[2] = src_line[3]; /* Read next line */ if (y + 3 >= height) src_line[3] = src_line[2]; else src_line[3] = src_line[2] + src_pitch; - + /* Then shift the color matrix up */ if (PixelsPerMask == 2) { unsigned short *sbp; @@ -254,9 +254,9 @@ static void Super2xSaI_ex(uint8_t *src, uint32_t src_pitch, lbp = (uint32_t*)src_line[3]; color[12] = *lbp; color[13] = color[12]; color[14] = *(lbp + 1); color[15] = *(lbp + 2); } - + } // y loop - + } @@ -282,7 +282,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ Super2xSaI_ex(mpi->planes[0], mpi->stride[0], dmpi->planes[0], dmpi->stride[0], mpi->w, mpi->h, mpi->bpp/8); - + return vf_next_put_image(vf,dmpi, pts); } diff --git a/libmpcodecs/vf_ass.c b/libmpcodecs/vf_ass.c index 904d4deaae..b13b148600 100644 --- a/libmpcodecs/vf_ass.c +++ b/libmpcodecs/vf_ass.c @@ -89,12 +89,12 @@ static int config(struct vf_instance* vf, if (!opts->screen_size_x && !opts->screen_size_y) { d_width = d_width * vf->priv->outw / width; d_height = d_height * vf->priv->outh / height; - } + } vf->priv->planes[1] = malloc(vf->priv->outw * vf->priv->outh); vf->priv->planes[2] = malloc(vf->priv->outw * vf->priv->outh); vf->priv->line_limits = malloc((vf->priv->outh + 1) / 2 * sizeof(*vf->priv->line_limits)); - + if (vf->priv->ass_priv) { ass_configure(vf->priv->ass_priv, vf->priv->outw, vf->priv->outh, 0); ass_set_aspect_ratio(vf->priv->ass_priv, ((double)d_width) / d_height); @@ -108,10 +108,10 @@ static void get_image(struct vf_instance* vf, mp_image_t *mpi) if(mpi->type == MP_IMGTYPE_IPB) return; if(mpi->flags & MP_IMGFLAG_PRESERVE) return; if(mpi->imgfmt != vf->priv->outfmt) return; // colorspace differ - + // width never changes, always try full DR mpi->priv = vf->dmpi = vf_get_image(vf->next, mpi->imgfmt, - mpi->type, mpi->flags | MP_IMGFLAG_READABLE, + mpi->type, mpi->flags | MP_IMGFLAG_READABLE, vf->priv->outw, vf->priv->outh); @@ -233,7 +233,7 @@ static void copy_from_image(struct vf_instance* vf) for (pl = 1; pl < 3; ++pl) { int dst_stride = vf->priv->outw; int src_stride = vf->dmpi->stride[pl]; - + unsigned char* src = vf->dmpi->planes[pl]; unsigned char* dst = vf->priv->planes[pl]; for (int i = 0; i < (vf->priv->outh + 1) / 2; i++) { @@ -262,7 +262,7 @@ static void copy_to_image(struct vf_instance* vf) for (pl = 1; pl < 3; ++pl) { int dst_stride = vf->dmpi->stride[pl]; int src_stride = vf->priv->outw; - + unsigned char* dst = vf->dmpi->planes[pl]; unsigned char* src = vf->priv->planes[pl]; unsigned char* src_next = vf->priv->planes[pl] + src_stride; @@ -307,7 +307,7 @@ static void my_draw_bitmap(struct vf_instance* vf, unsigned char* bitmap, int bi dsty += dmpi->stride[0]; dstu += vf->priv->outw; dstv += vf->priv->outw; - } + } } static int render_frame(struct vf_instance* vf, mp_image_t *mpi, const ass_image_t* img) @@ -333,7 +333,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts) ass_image_t* images = 0; if (sub_visibility && vf->priv->ass_priv && ass_track && (pts != MP_NOPTS_VALUE)) images = ass_mp_render_frame(vf->priv->ass_priv, ass_track, (pts+sub_delay) * 1000 + .5, NULL); - + prepare_image(vf, mpi); if (images) render_frame(vf, mpi, images); @@ -394,10 +394,10 @@ static int open(vf_instance_t *vf, char* args) uninit(vf); return 0; } - + if (vf->priv->auto_insert) mp_msg(MSGT_ASS, MSGL_INFO, "[ass] auto-open\n"); - + vf->config = config; vf->query_format = query_format; vf->uninit = uninit; @@ -429,4 +429,3 @@ const vf_info_t vf_info_ass = { open, &vf_opts }; - diff --git a/libmpcodecs/vf_bmovl.c b/libmpcodecs/vf_bmovl.c index 0412779cb5..0277751527 100644 --- a/libmpcodecs/vf_bmovl.c +++ b/libmpcodecs/vf_bmovl.c @@ -211,7 +211,7 @@ _read_cmd(int fd, char *cmd, char *args) { } return TRUE; } - + static int put_image(struct vf_instance* vf, mp_image_t* mpi, double pts){ @@ -318,7 +318,7 @@ put_image(struct vf_instance* vf, mp_image_t* mpi, double pts){ vf->priv->x2 = av_clip(imgx + imgw, vf->priv->x2, vf->priv->w); vf->priv->y2 = av_clip(imgy + imgh, vf->priv->y2, vf->priv->h); } - + if( command == CMD_CLEAR ) { sscanf( args, "%d %d %d %d", &imgw, &imgh, &imgx, &imgy); mp_msg(MSGT_VFILTER, MSGL_DBG2, "\nDEBUG: CLEAR: %d %d %d %d\n\n", imgw, imgh, imgx, imgy); @@ -435,19 +435,19 @@ put_image(struct vf_instance* vf, mp_image_t* mpi, double pts){ dmpi->planes[2][pos] = vf->priv->bitmap.v[pos]; } } else { // Alphablended pixel - dmpi->planes[0][pos] = - ((255 - alpha) * (int)dmpi->planes[0][pos] + + dmpi->planes[0][pos] = + ((255 - alpha) * (int)dmpi->planes[0][pos] + alpha * (int)vf->priv->bitmap.y[pos]) >> 8; - + if ((ypos%2) && (xpos%2)) { pos = ( (ypos/2) * dmpi->stride[1] ) + (xpos/2); - dmpi->planes[1][pos] = - ((255 - alpha) * (int)dmpi->planes[1][pos] + + dmpi->planes[1][pos] = + ((255 - alpha) * (int)dmpi->planes[1][pos] + alpha * (int)vf->priv->bitmap.u[pos]) >> 8; - - dmpi->planes[2][pos] = - ((255 - alpha) * (int)dmpi->planes[2][pos] + + + dmpi->planes[2][pos] = + ((255 - alpha) * (int)dmpi->planes[2][pos] + alpha * (int)vf->priv->bitmap.v[pos]) >> 8; } } diff --git a/libmpcodecs/vf_boxblur.c b/libmpcodecs/vf_boxblur.c index 8b2cab2d9b..e75f261375 100644 --- a/libmpcodecs/vf_boxblur.c +++ b/libmpcodecs/vf_boxblur.c @@ -84,7 +84,7 @@ static inline void blur(uint8_t *dst, uint8_t *src, int w, int radius, int dstSt static inline void blur2(uint8_t *dst, uint8_t *src, int w, int radius, int power, int dstStep, int srcStep){ uint8_t temp[2][4096]; uint8_t *a= temp[0], *b=temp[1]; - + if(radius){ blur(a, src, w, radius, 1, srcStep); for(; power>2; power--){ @@ -108,9 +108,9 @@ static inline void blur2(uint8_t *dst, uint8_t *src, int w, int radius, int powe static void hBlur(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int srcStride, int radius, int power){ int y; - + if(radius==0 && dst==src) return; - + for(y=0; y<h; y++){ blur2(dst + y*dstStride, src + y*srcStride, w, radius, power, 1, 1); } @@ -119,7 +119,7 @@ static void hBlur(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int s //FIXME optimize (x before y !!!) static void vBlur(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int srcStride, int radius, int power){ int x; - + if(radius==0 && dst==src) return; for(x=0; x<w; x++){ @@ -136,21 +136,21 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ mpi->w,mpi->h); assert(mpi->flags&MP_IMGFLAG_PLANAR); - - hBlur(dmpi->planes[0], mpi->planes[0], mpi->w,mpi->h, + + hBlur(dmpi->planes[0], mpi->planes[0], mpi->w,mpi->h, dmpi->stride[0], mpi->stride[0], vf->priv->lumaParam.radius, vf->priv->lumaParam.power); - hBlur(dmpi->planes[1], mpi->planes[1], cw,ch, + hBlur(dmpi->planes[1], mpi->planes[1], cw,ch, dmpi->stride[1], mpi->stride[1], vf->priv->chromaParam.radius, vf->priv->chromaParam.power); - hBlur(dmpi->planes[2], mpi->planes[2], cw,ch, + hBlur(dmpi->planes[2], mpi->planes[2], cw,ch, dmpi->stride[2], mpi->stride[2], vf->priv->chromaParam.radius, vf->priv->chromaParam.power); - - vBlur(dmpi->planes[0], dmpi->planes[0], mpi->w,mpi->h, + + vBlur(dmpi->planes[0], dmpi->planes[0], mpi->w,mpi->h, dmpi->stride[0], dmpi->stride[0], vf->priv->lumaParam.radius, vf->priv->lumaParam.power); - vBlur(dmpi->planes[1], dmpi->planes[1], cw,ch, + vBlur(dmpi->planes[1], dmpi->planes[1], cw,ch, dmpi->stride[1], dmpi->stride[1], vf->priv->chromaParam.radius, vf->priv->chromaParam.power); - vBlur(dmpi->planes[2], dmpi->planes[2], cw,ch, + vBlur(dmpi->planes[2], dmpi->planes[2], cw,ch, dmpi->stride[2], dmpi->stride[2], vf->priv->chromaParam.radius, vf->priv->chromaParam.power); - + return vf_next_put_image(vf,dmpi, pts); } @@ -182,14 +182,14 @@ static int open(vf_instance_t *vf, char* args){ memset(vf->priv, 0, sizeof(struct vf_priv_s)); if(args==NULL) return 0; - + e=sscanf(args, "%d:%d:%d:%d", &vf->priv->lumaParam.radius, &vf->priv->lumaParam.power, &vf->priv->chromaParam.radius, &vf->priv->chromaParam.power ); - + if(e==2){ vf->priv->chromaParam.radius= vf->priv->lumaParam.radius; vf->priv->chromaParam.power = vf->priv->lumaParam.power; @@ -198,7 +198,7 @@ static int open(vf_instance_t *vf, char* args){ if(vf->priv->lumaParam.radius < 0) return 0; if(vf->priv->chromaParam.radius < 0) return 0; - + return 1; } diff --git a/libmpcodecs/vf_crop.c b/libmpcodecs/vf_crop.c index 0b8eee7d04..14bbcd9d7c 100644 --- a/libmpcodecs/vf_crop.c +++ b/libmpcodecs/vf_crop.c @@ -151,7 +151,7 @@ static int open(vf_instance_t *vf, char* args){ vf->priv->crop_w= vf->priv->crop_h=-1; } //if(!vf->priv) - if(args) sscanf(args, "%d:%d:%d:%d", + if(args) sscanf(args, "%d:%d:%d:%d", &vf->priv->crop_w, &vf->priv->crop_h, &vf->priv->crop_x, diff --git a/libmpcodecs/vf_cropdetect.c b/libmpcodecs/vf_cropdetect.c index e81b46c32a..e91f537a04 100644 --- a/libmpcodecs/vf_cropdetect.c +++ b/libmpcodecs/vf_cropdetect.c @@ -73,7 +73,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ dmpi->height=mpi->height; if(++vf->priv->fno>2){ // ignore first 2 frames - they may be empty - + for(y=0;y<vf->priv->y1;y++){ if(checkline(mpi->planes[0]+mpi->stride[0]*y,bpp,mpi->w,bpp)>vf->priv->limit){ vf->priv->y1=y; @@ -106,7 +106,7 @@ if(++vf->priv->fno>2){ // ignore first 2 frames - they may be empty // make sure they stay rounded! x=(vf->priv->x1+1)&(~1); y=(vf->priv->y1+1)&(~1); - + w = vf->priv->x2 - x + 1; h = vf->priv->y2 - y + 1; diff --git a/libmpcodecs/vf_decimate.c b/libmpcodecs/vf_decimate.c index f8961e9a09..616085115b 100644 --- a/libmpcodecs/vf_decimate.c +++ b/libmpcodecs/vf_decimate.c @@ -27,10 +27,10 @@ static int diff_MMX(unsigned char *old, unsigned char *new, int os, int ns) "movl $8, %%ecx \n\t" "pxor %%mm4, %%mm4 \n\t" "pxor %%mm7, %%mm7 \n\t" - + ASMALIGN(4) "1: \n\t" - + "movq (%%"REG_S"), %%mm0 \n\t" "movq (%%"REG_S"), %%mm2 \n\t" "add %%"REG_a", %%"REG_S" \n\t" @@ -48,12 +48,12 @@ static int diff_MMX(unsigned char *old, unsigned char *new, int os, int ns) "paddw %%mm1, %%mm4 \n\t" "paddw %%mm2, %%mm4 \n\t" "paddw %%mm3, %%mm4 \n\t" - + "decl %%ecx \n\t" "jnz 1b \n\t" "movq %%mm4, (%%"REG_d") \n\t" "emms \n\t" - : + : : "S" (old), "D" (new), "a" ((long)os), "b" ((long)ns), "d" (out) : "%ecx", "memory" ); @@ -132,7 +132,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts) } vf->priv->last++; vf->priv->cnt=0; - + memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, dmpi->stride[0], mpi->stride[0]); if (mpi->flags & MP_IMGFLAG_PLANAR) { @@ -178,5 +178,3 @@ const vf_info_t vf_info_decimate = { open, NULL }; - - diff --git a/libmpcodecs/vf_delogo.c b/libmpcodecs/vf_delogo.c index 842dc6691c..d9234b6eab 100644 --- a/libmpcodecs/vf_delogo.c +++ b/libmpcodecs/vf_delogo.c @@ -54,11 +54,11 @@ static void delogo(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int int y, x; int interp, dist; uint8_t *xdst, *xsrc; - + uint8_t *topleft, *botleft, *topright; int xclipl, xclipr, yclipt, yclipb; int logo_x1, logo_x2, logo_y1, logo_y2; - + xclipl = MAX(-logo_x, 0); xclipr = MAX(logo_x+logo_w-width, 0); yclipt = MAX(-logo_y, 0); @@ -77,7 +77,7 @@ static void delogo(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int dst += (logo_y1+1)*dstStride; src += (logo_y1+1)*srcStride; - + for(y = logo_y1+1; y < logo_y2-1; y++) { for (x = logo_x1+1, xdst = dst+logo_x1+1, xsrc = src+logo_x1+1; x < logo_x2-1; x++, xdst++, xsrc++) { @@ -198,7 +198,7 @@ static const unsigned int fmt_list[]={ static int open(vf_instance_t *vf, char* args){ int res; - + vf->config=config; vf->put_image=put_image; vf->get_image=get_image; @@ -230,7 +230,7 @@ static int open(vf_instance_t *vf, char* args){ vf->priv->band = 4; vf->priv->show = 1; } - + vf->priv->lw += vf->priv->band*2; vf->priv->lh += vf->priv->band*2; diff --git a/libmpcodecs/vf_detc.c b/libmpcodecs/vf_detc.c index 4e935cd01b..d46218b688 100644 --- a/libmpcodecs/vf_detc.c +++ b/libmpcodecs/vf_detc.c @@ -144,11 +144,11 @@ static int analyze_fixed_pattern(struct vf_priv_s *p, mp_image_t *new, mp_image_ static int analyze_aggressive(struct vf_priv_s *p, mp_image_t *new, mp_image_t *old) { struct metrics m, pm; - + if (p->frame >= 0) p->frame = (p->frame+1)%5; - + diff_fields(&m, old, new); - + status(p->frame, &m); pm = p->pm; @@ -173,7 +173,7 @@ static int analyze_aggressive(struct vf_priv_s *p, mp_image_t *new, mp_image_t * p->pm = pm; /* hack :) */ p->frame = 3; return TC_IL1; - } + } } else { mp_msg(MSGT_VFILTER, MSGL_V, "mismatched telecine fields!\n"); p->frame = -1; @@ -283,7 +283,7 @@ static int do_put_image(struct vf_instance* vf, mp_image_t *dmpi) dropflag = (++p->lastdrop >= 5) && (4*p->inframes <= 5*p->outframes); break; } - + if (dropflag) { mp_msg(MSGT_VFILTER, MSGL_V, "drop! [%d/%d=%g]\n", p->outframes, p->inframes, (float)p->outframes/p->inframes); @@ -311,7 +311,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts) else dmpi = vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PRESERVE, mpi->width, mpi->height); - + switch (p->analyze(p, mpi, dmpi)) { case TC_DROP: /* Don't copy anything unless we'll need to read it. */ @@ -433,5 +433,3 @@ const vf_info_t vf_info_detc = { open, NULL }; - - diff --git a/libmpcodecs/vf_down3dright.c b/libmpcodecs/vf_down3dright.c index 3ad2209d33..7db8900133 100644 --- a/libmpcodecs/vf_down3dright.c +++ b/libmpcodecs/vf_down3dright.c @@ -146,4 +146,3 @@ const vf_info_t vf_info_down3dright = { open, NULL }; - diff --git a/libmpcodecs/vf_dsize.c b/libmpcodecs/vf_dsize.c index 2ec4acfe3d..ad298d0d19 100644 --- a/libmpcodecs/vf_dsize.c +++ b/libmpcodecs/vf_dsize.c @@ -103,4 +103,3 @@ const vf_info_t vf_info_dsize = { open, NULL }; - diff --git a/libmpcodecs/vf_dvbscale.c b/libmpcodecs/vf_dvbscale.c index d54490d6fc..3a28984fc1 100644 --- a/libmpcodecs/vf_dvbscale.c +++ b/libmpcodecs/vf_dvbscale.c @@ -21,7 +21,7 @@ static int config(struct vf_instance* vf, unsigned int flags, unsigned int outfmt){ int scaled_y=vf->priv->aspect*d_height/d_width; - + d_width=width; // do X-scaling by hardware d_height=scaled_y; diff --git a/libmpcodecs/vf_eq.c b/libmpcodecs/vf_eq.c index d1183fc379..c038355f52 100644 --- a/libmpcodecs/vf_eq.c +++ b/libmpcodecs/vf_eq.c @@ -42,7 +42,7 @@ static void process_MMX(unsigned char *dest, int dstride, unsigned char *src, in brvec[0] = brvec[1] = brvec[2] = brvec[3] = brightness; contvec[0] = contvec[1] = contvec[2] = contvec[3] = contrast; - + while (h--) { __asm__ volatile ( "movq (%5), %%mm3 \n\t" @@ -121,7 +121,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts) dmpi=vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_EXPORT, 0, mpi->w, mpi->h); - + dmpi->stride[0] = mpi->stride[0]; dmpi->planes[1] = mpi->planes[1]; dmpi->planes[2] = mpi->planes[2]; @@ -129,7 +129,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts) dmpi->stride[2] = mpi->stride[2]; if (!vf->priv->buf) vf->priv->buf = malloc(mpi->stride[0]*mpi->h); - + if ((vf->priv->brightness == 0) && (vf->priv->contrast == 0)) dmpi->planes[0] = mpi->planes[0]; else { @@ -207,7 +207,7 @@ static int open(vf_instance_t *vf, char* args) vf->query_format=query_format; vf->put_image=put_image; vf->uninit=uninit; - + if(!vf->priv) { vf->priv = malloc(sizeof(struct vf_priv_s)); memset(vf->priv, 0, sizeof(struct vf_priv_s)); @@ -218,7 +218,7 @@ static int open(vf_instance_t *vf, char* args) #if HAVE_MMX if(gCpuCaps.hasMMX) process = process_MMX; #endif - + return 1; } @@ -244,4 +244,3 @@ const vf_info_t vf_info_eq = { open, &vf_opts }; - diff --git a/libmpcodecs/vf_eq2.c b/libmpcodecs/vf_eq2.c index ee66acde77..e7ee9a4b0c 100644 --- a/libmpcodecs/vf_eq2.c +++ b/libmpcodecs/vf_eq2.c @@ -117,7 +117,7 @@ void affine_1d_MMX (eq2_param_t *par, unsigned char *dst, unsigned char *src, int pel; short brvec[4]; short contvec[4]; - + // printf("\nmmx: src=%p dst=%p w=%d h=%d ds=%d ss=%d\n",src,dst,w,h,dstride,sstride); contrast = (int) (par->c * 256 * 16); diff --git a/libmpcodecs/vf_expand.c b/libmpcodecs/vf_expand.c index d0ab49f4f7..dc3928b0da 100644 --- a/libmpcodecs/vf_expand.c +++ b/libmpcodecs/vf_expand.c @@ -254,8 +254,8 @@ static void get_image(struct vf_instance* vf, mp_image_t *mpi){ (mpi->flags&(MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_ACCEPT_WIDTH)) ){ // try full DR ! mpi->priv=vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, - mpi->type, mpi->flags, - MAX(vf->priv->exp_w, mpi->width +vf->priv->exp_x), + mpi->type, mpi->flags, + MAX(vf->priv->exp_w, mpi->width +vf->priv->exp_x), MAX(vf->priv->exp_h, mpi->height+vf->priv->exp_y)); #if 1 if((vf->dmpi->flags & MP_IMGFLAG_DRAW_CALLBACK) && @@ -297,8 +297,8 @@ static void start_slice(struct vf_instance* vf, mp_image_t *mpi){ if(!mpi->priv) mpi->priv=vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, // MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE, - MP_IMGTYPE_TEMP, mpi->flags, - MAX(vf->priv->exp_w, mpi->width +vf->priv->exp_x), + MP_IMGTYPE_TEMP, mpi->flags, + MAX(vf->priv->exp_w, mpi->width +vf->priv->exp_x), MAX(vf->priv->exp_h, mpi->height+vf->priv->exp_y)); if(!(vf->dmpi->flags&MP_IMGFLAG_DRAW_CALLBACK)) mp_tmsg(MSGT_VFILTER, MSGL_WARN, "WARNING! Next filter doesn't support SLICES, get ready for sig11...\n"); // shouldn't happen. @@ -311,7 +311,7 @@ static void draw_top_blackbar_slice(struct vf_instance* vf, vf_next_draw_slice(vf, vf->dmpi->planes, vf->dmpi->stride, vf->dmpi->w,vf->priv->exp_y,0,0); } - + } static void draw_bottom_blackbar_slice(struct vf_instance* vf, @@ -337,7 +337,7 @@ static void draw_bottom_blackbar_slice(struct vf_instance* vf, static void draw_slice(struct vf_instance* vf, unsigned char** src, int* stride, int w,int h, int x, int y){ // printf("draw_slice() called %d at %d\n",h,y); - + if (y == 0 && y+h == vf->h) { // special case - only one slice draw_top_blackbar_slice(vf, src, stride, w, h, x, y); @@ -382,7 +382,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, vf->priv->exp_w, vf->priv->exp_h); - + // copy mpi->dmpi... if(mpi->flags&MP_IMGFLAG_PLANAR){ memcpy_pic(vf->dmpi->planes[0]+ diff --git a/libmpcodecs/vf_field.c b/libmpcodecs/vf_field.c index cbbb7bc104..48e4cb0f21 100644 --- a/libmpcodecs/vf_field.c +++ b/libmpcodecs/vf_field.c @@ -24,7 +24,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE, mpi->width, mpi->height/2); - + // set up mpi as a double-stride image of dmpi: vf->dmpi->planes[0]=mpi->planes[0]+mpi->stride[0]*vf->priv->field; vf->dmpi->stride[0]=2*mpi->stride[0]; @@ -37,7 +37,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ vf->dmpi->stride[2]=2*mpi->stride[2]; } else vf->dmpi->planes[1]=mpi->planes[1]; // passthru bgr8 palette!!! - + return vf_next_put_image(vf,vf->dmpi, pts); } diff --git a/libmpcodecs/vf_fil.c b/libmpcodecs/vf_fil.c index 5e36c4774d..089ec29409 100644 --- a/libmpcodecs/vf_fil.c +++ b/libmpcodecs/vf_fil.c @@ -27,9 +27,9 @@ static int config(struct vf_instance* vf, pixel_stride= mpi->stride[0]; else pixel_stride= 8*mpi->stride[0] / mpi->bpp; - -#endif - + +#endif + if(vf->priv->interleave){ vf->priv->height= 2*height; vf->priv->width= width - (pixel_stride/2); @@ -54,7 +54,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE, vf->priv->width, vf->priv->height); - + // set up mpi as a double-stride image of dmpi: vf->dmpi->planes[0]=mpi->planes[0]; vf->dmpi->stride[0]=(mpi->stride[0]*vf->priv->stridefactor)>>1; @@ -65,7 +65,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ vf->dmpi->stride[2]=(mpi->stride[2]*vf->priv->stridefactor)>>1; } else vf->dmpi->planes[1]=mpi->planes[1]; // passthru bgr8 palette!!! - + return vf_next_put_image(vf,vf->dmpi, pts); } diff --git a/libmpcodecs/vf_filmdint.c b/libmpcodecs/vf_filmdint.c index b15990bd97..bdb8d57bdb 100644 --- a/libmpcodecs/vf_filmdint.c +++ b/libmpcodecs/vf_filmdint.c @@ -243,7 +243,7 @@ get_metrics_faster_c(unsigned char *a, unsigned char *b, int as, int bs, a += 2*as; b += 2*bs; } while (--lines); - + } static inline void diff --git a/libmpcodecs/vf_flip.c b/libmpcodecs/vf_flip.c index 061c727eb9..40e895a022 100644 --- a/libmpcodecs/vf_flip.c +++ b/libmpcodecs/vf_flip.c @@ -52,7 +52,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE, mpi->width, mpi->height); - + // set up mpi as a upside-down image of dmpi: vf->dmpi->planes[0]=mpi->planes[0]+ mpi->stride[0]*(mpi->height-1); @@ -66,7 +66,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ vf->dmpi->stride[2]=-mpi->stride[2]; } else vf->dmpi->planes[1]=mpi->planes[1]; // passthru bgr8 palette!!! - + return vf_next_put_image(vf,vf->dmpi, pts); } diff --git a/libmpcodecs/vf_format.c b/libmpcodecs/vf_format.c index aac8dfd411..deb0e8fb02 100644 --- a/libmpcodecs/vf_format.c +++ b/libmpcodecs/vf_format.c @@ -68,7 +68,7 @@ static int open(vf_instance_t *vf, char* args){ if(!strcasecmp(args,"abgr")) vf->priv->fmt=IMGFMT_ABGR; else { mp_tmsg(MSGT_VFILTER, MSGL_WARN, "[VF_FORMAT] Unknown format name: '%s'.\n", args);return 0;} } - + return 1; } diff --git a/libmpcodecs/vf_framestep.c b/libmpcodecs/vf_framestep.c index a0ae4c310e..28daa3f804 100644 --- a/libmpcodecs/vf_framestep.c +++ b/libmpcodecs/vf_framestep.c @@ -187,5 +187,3 @@ const vf_info_t vf_info_framestep = { open, NULL }; - - diff --git a/libmpcodecs/vf_fspp.c b/libmpcodecs/vf_fspp.c index b281453c82..b8f17bb0e3 100644 --- a/libmpcodecs/vf_fspp.c +++ b/libmpcodecs/vf_fspp.c @@ -21,7 +21,7 @@ /* * This implementation is based on an algorithm described in - * "Aria Nosratinia Embedded Post-Processing for + * "Aria Nosratinia Embedded Post-Processing for * Enhancement of Compressed Images (1999)" * (http://citeseer.nj.nec.com/nosratinia99embedded.html) * Futher, with splitting (i)dct into hor/ver passes, one of them can be @@ -31,7 +31,7 @@ /* Heavily optimized version of SPP filter by Nikolaj */ - + #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -110,7 +110,7 @@ static void store_slice_c(uint8_t *dst, int16_t *src, int dst_stride, int src_st src[x + pos]=src[x + pos - 8*src_stride]=0; \ if(temp & 0x100) temp= ~(temp>>31); \ dst[x + pos]= temp; - + for(y=0; y<height; y++){ const uint8_t *d= dither[y]; for(x=0; x<width; x+=8){ @@ -122,7 +122,7 @@ static void store_slice_c(uint8_t *dst, int16_t *src, int dst_stride, int src_st STORE(4); STORE(5); STORE(6); - STORE(7); + STORE(7); } src+=src_stride; dst+=dst_stride; @@ -137,7 +137,7 @@ static void store_slice2_c(uint8_t *dst, int16_t *src, int dst_stride, int src_s src[x + pos + 16*src_stride]=0; \ if(temp & 0x100) temp= ~(temp>>31); \ dst[x + pos]= temp; - + for(y=0; y<height; y++){ const uint8_t *d= dither[y]; for(x=0; x<width; x+=8){ @@ -149,7 +149,7 @@ static void store_slice2_c(uint8_t *dst, int16_t *src, int dst_stride, int src_s STORE2(4); STORE2(5); STORE2(6); - STORE2(7); + STORE2(7); } src+=src_stride; dst+=dst_stride; @@ -243,7 +243,7 @@ static void store_slice_mmx(uint8_t *dst, int16_t *src, long dst_stride, long sr : "m" (width), "m" (src_stride), "g" (od), "m" (dst_stride), "g" (end), "m" (log2_scale), "m" (src), "m" (dst) //input : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D - ); + ); } //This func reads from 2 slices, 0 & 2 and clears 2-nd @@ -311,7 +311,7 @@ static void store_slice2_mmx(uint8_t *dst, int16_t *src, long dst_stride, long s : "m" (width), "m" (src_stride), "g" (od), "m" (dst_stride), "g" (end), "m" (log2_scale), "m" (src), "m" (dst) //input : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_D, "%"REG_S - ); + ); } static void mul_thrmat_mmx(struct vf_priv_s *p, int q) @@ -393,7 +393,7 @@ static void mul_thrmat_mmx(struct vf_priv_s *p, int q) } static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, int cnt); -static void row_idct_mmx(DCTELEM* workspace, +static void row_idct_mmx(DCTELEM* workspace, int16_t* output_adr, int output_stride, int cnt); static void row_fdct_mmx(DCTELEM *data, const uint8_t *pixels, int line_size, int cnt); @@ -413,19 +413,19 @@ static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int x, x0, y, es, qy, t; const int stride= is_luma ? p->temp_stride : (width+16);//((width+16+15)&(~15)) const int step=6-p->log2_count; - const int qps= 3 + is_luma; + const int qps= 3 + is_luma; int32_t __attribute__((aligned(32))) block_align[4*8*BLOCKSZ+ 4*8*BLOCKSZ]; DCTELEM *block= (DCTELEM *)block_align; - DCTELEM *block3=(DCTELEM *)(block_align+4*8*BLOCKSZ); + DCTELEM *block3=(DCTELEM *)(block_align+4*8*BLOCKSZ); memset(block3, 0, 4*8*BLOCKSZ); - //p->src=src-src_stride*8-8;//! + //p->src=src-src_stride*8-8;//! if (!src || !dst) return; // HACK avoid crash for Y8 colourspace for(y=0; y<height; y++){ int index= 8 + 8*stride + y*stride; fast_memcpy(p->src + index, src + y*src_stride, width);//this line can be avoided by using DR & user fr.buffers - for(x=0; x<8; x++){ + for(x=0; x<8; x++){ p->src[index - x - 1]= p->src[index + x ]; p->src[index + width + x ]= p->src[index + width - x - 1]; } @@ -447,11 +447,11 @@ static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, row_fdct_s(block, p->src + y*stride +2-(y&1), stride, 2); for(x0=0; x0<width+8-8*(BLOCKSZ-1); x0+=8*(BLOCKSZ-1)){ row_fdct_s(block+8*8, p->src + y*stride+8+x0 +2-(y&1), stride, 2*(BLOCKSZ-1)); - if(p->qp) + if(p->qp) column_fidct_s((int16_t*)(&p->threshold_mtx[0]), block+0*8, block3+0*8, 8*(BLOCKSZ-1)); //yes, this is a HOTSPOT else for (x=0; x<8*(BLOCKSZ-1); x+=8) { - t=x+x0-2; //correct t=x+x0-2-(y&1), but its the same + t=x+x0-2; //correct t=x+x0-2-(y&1), but its the same if (t<0) t=0;//t always < width-2 t=qp_store[qy+(t>>qps)]; if(p->mpeg2) t>>=1; //copy p->mpeg2,prev_q to locals? @@ -463,24 +463,24 @@ static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, memmove(block3, block3+(BLOCKSZ-1)*64, 6*8*sizeof(DCTELEM)); } // - es=width+8-x0; // 8, ... + es=width+8-x0; // 8, ... if (es>8) row_fdct_s(block+8*8, p->src + y*stride+8+x0 +2-(y&1), stride, (es-4)>>2); column_fidct_s((int16_t*)(&p->threshold_mtx[0]), block, block3, es&(~1)); row_idct_s(block3+0*8, p->temp + (y&15)*stride+x0+2-(y&1), stride, es>>2); {const int y1=y-8+step;//l5-7 l4-6 if (!(y1&7) && y1) { - if (y1&8) store_slice_s(dst + (y1-8)*dst_stride, p->temp+ 8 +8*stride, + if (y1&8) store_slice_s(dst + (y1-8)*dst_stride, p->temp+ 8 +8*stride, dst_stride, stride, width, 8, 5-p->log2_count); - else store_slice2_s(dst + (y1-8)*dst_stride, p->temp+ 8 +0*stride, - dst_stride, stride, width, 8, 5-p->log2_count); + else store_slice2_s(dst + (y1-8)*dst_stride, p->temp+ 8 +0*stride, + dst_stride, stride, width, 8, 5-p->log2_count); } } } if (y&7) { // == height & 7 - if (y&8) store_slice_s(dst + ((y-8)&~7)*dst_stride, p->temp+ 8 +8*stride, + if (y&8) store_slice_s(dst + ((y-8)&~7)*dst_stride, p->temp+ 8 +8*stride, dst_stride, stride, width, y&7, 5-p->log2_count); - else store_slice2_s(dst + ((y-8)&~7)*dst_stride, p->temp+ 8 +0*stride, + else store_slice2_s(dst + ((y-8)&~7)*dst_stride, p->temp+ 8 +0*stride, dst_stride, stride, width, y&7, 5-p->log2_count); } } @@ -577,7 +577,7 @@ static void uninit(struct vf_instance* vf) //vf->priv->avctx= NULL; if(vf->priv->non_b_qp) free(vf->priv->non_b_qp); vf->priv->non_b_qp= NULL; - + av_free(vf->priv); vf->priv=NULL; } @@ -621,23 +621,23 @@ static int open(vf_instance_t *vf, char* args) int i=0, bias; int custom_threshold_m[64]; int log2c=-1; - + vf->config=config; vf->put_image=put_image; vf->get_image=get_image; vf->query_format=query_format; vf->uninit=uninit; vf->control= control; - vf->priv=av_mallocz(sizeof(struct vf_priv_s));//assumes align 16 ! - + vf->priv=av_mallocz(sizeof(struct vf_priv_s));//assumes align 16 ! + avcodec_init(); //vf->priv->avctx= avcodec_alloc_context(); //dsputil_init(&vf->priv->dsp, vf->priv->avctx); - + vf->priv->log2_count= 4; vf->priv->bframes = 0; - + if (args) sscanf(args, "%d:%d:%d:%d", &log2c, &vf->priv->qp, &i, &vf->priv->bframes); if( log2c >=4 && log2c <=5 ) @@ -650,7 +650,7 @@ static int open(vf_instance_t *vf, char* args) if (i < -15) i = -15; if (i > 32) i = 32; - + bias= (1<<4)+i; //regulable vf->priv->prev_q=0; // @@ -702,21 +702,21 @@ const vf_info_t vf_info_fspp = { #if HAVE_MMX -DECLARE_ASM_CONST(8, uint64_t, MM_FIX_0_382683433)=FIX64(0.382683433, 14); -DECLARE_ASM_CONST(8, uint64_t, MM_FIX_0_541196100)=FIX64(0.541196100, 14); -DECLARE_ASM_CONST(8, uint64_t, MM_FIX_0_707106781)=FIX64(0.707106781, 14); -DECLARE_ASM_CONST(8, uint64_t, MM_FIX_1_306562965)=FIX64(1.306562965, 14); +DECLARE_ASM_CONST(8, uint64_t, MM_FIX_0_382683433)=FIX64(0.382683433, 14); +DECLARE_ASM_CONST(8, uint64_t, MM_FIX_0_541196100)=FIX64(0.541196100, 14); +DECLARE_ASM_CONST(8, uint64_t, MM_FIX_0_707106781)=FIX64(0.707106781, 14); +DECLARE_ASM_CONST(8, uint64_t, MM_FIX_1_306562965)=FIX64(1.306562965, 14); -DECLARE_ASM_CONST(8, uint64_t, MM_FIX_1_414213562_A)=FIX64(1.414213562, 14); +DECLARE_ASM_CONST(8, uint64_t, MM_FIX_1_414213562_A)=FIX64(1.414213562, 14); -DECLARE_ASM_CONST(8, uint64_t, MM_FIX_1_847759065)=FIX64(1.847759065, 13); +DECLARE_ASM_CONST(8, uint64_t, MM_FIX_1_847759065)=FIX64(1.847759065, 13); DECLARE_ASM_CONST(8, uint64_t, MM_FIX_2_613125930)=FIX64(-2.613125930, 13); //- -DECLARE_ASM_CONST(8, uint64_t, MM_FIX_1_414213562)=FIX64(1.414213562, 13); +DECLARE_ASM_CONST(8, uint64_t, MM_FIX_1_414213562)=FIX64(1.414213562, 13); DECLARE_ASM_CONST(8, uint64_t, MM_FIX_1_082392200)=FIX64(1.082392200, 13); //for t3,t5,t7 == 0 shortcut -DECLARE_ASM_CONST(8, uint64_t, MM_FIX_0_847759065)=FIX64(0.847759065, 14); -DECLARE_ASM_CONST(8, uint64_t, MM_FIX_0_566454497)=FIX64(0.566454497, 14); -DECLARE_ASM_CONST(8, uint64_t, MM_FIX_0_198912367)=FIX64(0.198912367, 14); +DECLARE_ASM_CONST(8, uint64_t, MM_FIX_0_847759065)=FIX64(0.847759065, 14); +DECLARE_ASM_CONST(8, uint64_t, MM_FIX_0_566454497)=FIX64(0.566454497, 14); +DECLARE_ASM_CONST(8, uint64_t, MM_FIX_0_198912367)=FIX64(0.198912367, 14); DECLARE_ASM_CONST(8, uint64_t, MM_DESCALE_RND)=C64(4); DECLARE_ASM_CONST(8, uint64_t, MM_2)=C64(2); @@ -724,14 +724,14 @@ DECLARE_ASM_CONST(8, uint64_t, MM_2)=C64(2); #else /* !HAVE_MMX */ typedef int32_t int_simd16_t; -static const int16_t FIX_0_382683433=FIX(0.382683433, 14); -static const int16_t FIX_0_541196100=FIX(0.541196100, 14); -static const int16_t FIX_0_707106781=FIX(0.707106781, 14); -static const int16_t FIX_1_306562965=FIX(1.306562965, 14); -static const int16_t FIX_1_414213562_A=FIX(1.414213562, 14); -static const int16_t FIX_1_847759065=FIX(1.847759065, 13); +static const int16_t FIX_0_382683433=FIX(0.382683433, 14); +static const int16_t FIX_0_541196100=FIX(0.541196100, 14); +static const int16_t FIX_0_707106781=FIX(0.707106781, 14); +static const int16_t FIX_1_306562965=FIX(1.306562965, 14); +static const int16_t FIX_1_414213562_A=FIX(1.414213562, 14); +static const int16_t FIX_1_847759065=FIX(1.847759065, 13); static const int16_t FIX_2_613125930=FIX(-2.613125930, 13); //- -static const int16_t FIX_1_414213562=FIX(1.414213562, 13); +static const int16_t FIX_1_414213562=FIX(1.414213562, 13); static const int16_t FIX_1_082392200=FIX(1.082392200, 13); #endif @@ -749,46 +749,46 @@ static void column_fidct_c(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, int DCTELEM* wsptr; int16_t *threshold; int ctr; - + dataptr = data; wsptr = output; for (; cnt > 0; cnt-=2) { //start positions threshold=(int16_t*)thr_adr;//threshold_mtx - for (ctr = DCTSIZE; ctr > 0; ctr--) { - // Process columns from input, add to output. + for (ctr = DCTSIZE; ctr > 0; ctr--) { + // Process columns from input, add to output. tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7]; tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7]; - + tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6]; tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6]; - + tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5]; tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5]; - + tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4]; tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4]; // Even part of FDCT - + tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; - d0 = tmp10 + tmp11; + d0 = tmp10 + tmp11; d4 = tmp10 - tmp11; - - z1 = MULTIPLY16H((tmp12 + tmp13) <<2, FIX_0_707106781); - d2 = tmp13 + z1; - d6 = tmp13 - z1; + + z1 = MULTIPLY16H((tmp12 + tmp13) <<2, FIX_0_707106781); + d2 = tmp13 + z1; + d6 = tmp13 - z1; // Even part of IDCT THRESHOLD(tmp0, d0, threshold[0*8]); THRESHOLD(tmp1, d2, threshold[2*8]); THRESHOLD(tmp2, d4, threshold[4*8]); - THRESHOLD(tmp3, d6, threshold[6*8]); + THRESHOLD(tmp3, d6, threshold[6*8]); tmp0+=2; tmp10 = (tmp0 + tmp2)>>2; tmp11 = (tmp0 - tmp2)>>2; @@ -803,22 +803,22 @@ static void column_fidct_c(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, int // Odd part of FDCT - tmp10 = tmp4 + tmp5; + tmp10 = tmp4 + tmp5; tmp11 = tmp5 + tmp6; tmp12 = tmp6 + tmp7; - - z5 = MULTIPLY16H((tmp10 - tmp12)<<2, FIX_0_382683433); - z2 = MULTIPLY16H(tmp10 <<2, FIX_0_541196100) + z5; - z4 = MULTIPLY16H(tmp12 <<2, FIX_1_306562965) + z5; - z3 = MULTIPLY16H(tmp11 <<2, FIX_0_707106781); - z11 = tmp7 + z3; + z5 = MULTIPLY16H((tmp10 - tmp12)<<2, FIX_0_382683433); + z2 = MULTIPLY16H(tmp10 <<2, FIX_0_541196100) + z5; + z4 = MULTIPLY16H(tmp12 <<2, FIX_1_306562965) + z5; + z3 = MULTIPLY16H(tmp11 <<2, FIX_0_707106781); + + z11 = tmp7 + z3; z13 = tmp7 - z3; - d5 = z13 + z2; + d5 = z13 + z2; d3 = z13 - z2; d1 = z11 + z4; - d7 = z11 - z4; + d7 = z11 - z4; // Odd part of IDCT @@ -857,7 +857,7 @@ static void column_fidct_c(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, int threshold++; } dataptr+=8; //skip each second start pos - wsptr +=8; + wsptr +=8; } } @@ -874,7 +874,7 @@ static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, "movq "DCTSIZE_S"*3*2(%%"REG_S"), %%mm7 \n\t" "movq %%mm1, %%mm0 \n\t" - "paddw "DCTSIZE_S"*7*2(%%"REG_S"), %%mm1 \n\t" //t0 + "paddw "DCTSIZE_S"*7*2(%%"REG_S"), %%mm1 \n\t" //t0 "movq %%mm7, %%mm3 \n\t" "paddw "DCTSIZE_S"*4*2(%%"REG_S"), %%mm7 \n\t" //t3 @@ -892,13 +892,13 @@ static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, "paddw "DCTSIZE_S"*5*2(%%"REG_S"), %%mm2 \n\t" //t2 "movq %%mm6, %%mm7 \n\t" - "paddw %%mm2, %%mm6 \n\t" //t11 + "paddw %%mm2, %%mm6 \n\t" //t11 "psubw %%mm2, %%mm7 \n\t" //t12 "movq %%mm5, %%mm2 \n\t" "paddw %%mm6, %%mm5 \n\t" //d0 // i0 t13 t12 i3 i1 d0 - d4 - "psubw %%mm6, %%mm2 \n\t" //d4 + "psubw %%mm6, %%mm2 \n\t" //d4 "paddw %%mm1, %%mm7 \n\t" "movq 4*16(%%"REG_d"), %%mm6 \n\t" @@ -938,7 +938,7 @@ static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, "paddusw 2*16(%%"REG_d"), %%mm1 \n\t" "psubw %%mm7, %%mm6 \n\t" - // t7 d2 /t11 t4 t6 - d6 /t10 + // t7 d2 /t11 t4 t6 - d6 /t10 "paddw 2*16(%%"REG_d"), %%mm1 \n\t" "paddusw %%mm7, %%mm6 \n\t" @@ -950,7 +950,7 @@ static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, "psubusw %%mm7, %%mm6 \n\t" //movq [edi+"DCTSIZE_S"*2*2], mm1 - //movq [edi+"DCTSIZE_S"*6*2], mm6 + //movq [edi+"DCTSIZE_S"*6*2], mm6 "movq %%mm1, %%mm7 \n\t" "psraw $2, %%mm2 \n\t" @@ -970,7 +970,7 @@ static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, "psubw %%mm6, %%mm7 \n\t" //'t3 "movq "DCTSIZE_S"*2*2(%%"REG_S"), %%mm2 \n\t" - "psubw %%mm6, %%mm1 \n\t" //'t12 + "psubw %%mm6, %%mm1 \n\t" //'t12 "psubw "DCTSIZE_S"*5*2(%%"REG_S"), %%mm2 \n\t" //t5 "movq %%mm5, %%mm6 \n\t" @@ -1000,7 +1000,7 @@ static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, "psubw %%mm1, %%mm6 \n\t" //'t2 // t7 't12 't11 t4 t6 - 't13 't10 --- - "paddw %%mm3, %%mm7 \n\t" //z2 + "paddw %%mm3, %%mm7 \n\t" //z2 "movq %%mm5, 1*8+%3 \n\t" "paddw %%mm3, %%mm4 \n\t" //z4 @@ -1009,10 +1009,10 @@ static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, "movq %%mm0, %%mm1 \n\t" "movq %%mm6, 2*8+%3 \n\t" - "psubw %%mm2, %%mm1 \n\t" //z13 + "psubw %%mm2, %%mm1 \n\t" //z13 //=== - "paddw %%mm2, %%mm0 \n\t" //z11 + "paddw %%mm2, %%mm0 \n\t" //z11 "movq %%mm1, %%mm5 \n\t" "movq 5*16(%%"REG_d"), %%mm2 \n\t" @@ -1025,12 +1025,12 @@ static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, "psubw %%mm2, %%mm5 \n\t" "movq %%mm0, %%mm6 \n\t" - "paddw %%mm4, %%mm0 \n\t" //d1 + "paddw %%mm4, %%mm0 \n\t" //d1 "paddusw %%mm3, %%mm1 \n\t" - "psubw %%mm4, %%mm6 \n\t" //d7 + "psubw %%mm4, %%mm6 \n\t" //d7 - // d1 d3 - - - d5 d7 - + // d1 d3 - - - d5 d7 - "movq 7*16(%%"REG_d"), %%mm4 \n\t" "psubw %%mm7, %%mm0 \n\t" @@ -1082,7 +1082,7 @@ static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, "movq 1*8+%3, %%mm6 \n\t" //paddw mm3, MM_2 - "psraw $2, %%mm3 \n\t" //tmp7 + "psraw $2, %%mm3 \n\t" //tmp7 "pmulhw "MANGLE(MM_FIX_0_198912367)", %%mm2 \n\t" //-tmp4 "psubw %%mm3, %%mm4 \n\t" @@ -1135,7 +1135,7 @@ static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, "2: \n\t" //--- non DC2 //psraw mm1, 2 w/o it -> offset. thr1, thr1, thr1 (actually thr1, thr1, thr1-1) - //psraw mm5, 2 + //psraw mm5, 2 //psraw mm0, 2 //psraw mm6, 2 "movq %%mm5, %%mm3 \n\t" @@ -1205,7 +1205,7 @@ static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, "paddw %%mm2, %%mm7 \n\t" "movq %%mm3, "DCTSIZE_S"*1*2(%%"REG_D") \n\t" - "paddw %%mm2, %%mm0 \n\t" //'t4 + "paddw %%mm2, %%mm0 \n\t" //'t4 // 't4 't6 't5 - - - - 't7 "movq %%mm7, "DCTSIZE_S"*2*2(%%"REG_D") \n\t" @@ -1226,13 +1226,13 @@ static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, "add $8, %%"REG_D" \n\t" "4: \n\t" -//=part 2 (the same)=========================================================== +//=part 2 (the same)=========================================================== "movq "DCTSIZE_S"*0*2(%%"REG_S"), %%mm1 \n\t" // "movq "DCTSIZE_S"*3*2(%%"REG_S"), %%mm7 \n\t" "movq %%mm1, %%mm0 \n\t" - "paddw "DCTSIZE_S"*7*2(%%"REG_S"), %%mm1 \n\t" //t0 + "paddw "DCTSIZE_S"*7*2(%%"REG_S"), %%mm1 \n\t" //t0 "movq %%mm7, %%mm3 \n\t" "paddw "DCTSIZE_S"*4*2(%%"REG_S"), %%mm7 \n\t" //t3 @@ -1250,13 +1250,13 @@ static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, "paddw "DCTSIZE_S"*5*2(%%"REG_S"), %%mm2 \n\t" //t2 "movq %%mm6, %%mm7 \n\t" - "paddw %%mm2, %%mm6 \n\t" //t11 + "paddw %%mm2, %%mm6 \n\t" //t11 "psubw %%mm2, %%mm7 \n\t" //t12 "movq %%mm5, %%mm2 \n\t" "paddw %%mm6, %%mm5 \n\t" //d0 // i0 t13 t12 i3 i1 d0 - d4 - "psubw %%mm6, %%mm2 \n\t" //d4 + "psubw %%mm6, %%mm2 \n\t" //d4 "paddw %%mm1, %%mm7 \n\t" "movq 1*8+4*16(%%"REG_d"), %%mm6 \n\t" @@ -1296,7 +1296,7 @@ static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, "paddusw 1*8+2*16(%%"REG_d"), %%mm1 \n\t" "psubw %%mm7, %%mm6 \n\t" - // t7 d2 /t11 t4 t6 - d6 /t10 + // t7 d2 /t11 t4 t6 - d6 /t10 "paddw 1*8+2*16(%%"REG_d"), %%mm1 \n\t" "paddusw %%mm7, %%mm6 \n\t" @@ -1308,7 +1308,7 @@ static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, "psubusw %%mm7, %%mm6 \n\t" //movq [edi+"DCTSIZE_S"*2*2], mm1 - //movq [edi+"DCTSIZE_S"*6*2], mm6 + //movq [edi+"DCTSIZE_S"*6*2], mm6 "movq %%mm1, %%mm7 \n\t" "psraw $2, %%mm2 \n\t" @@ -1328,7 +1328,7 @@ static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, "psubw %%mm6, %%mm7 \n\t" //'t3 "movq "DCTSIZE_S"*2*2(%%"REG_S"), %%mm2 \n\t" - "psubw %%mm6, %%mm1 \n\t" //'t12 + "psubw %%mm6, %%mm1 \n\t" //'t12 "psubw "DCTSIZE_S"*5*2(%%"REG_S"), %%mm2 \n\t" //t5 "movq %%mm5, %%mm6 \n\t" @@ -1358,7 +1358,7 @@ static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, "psubw %%mm1, %%mm6 \n\t" //'t2 // t7 't12 't11 t4 t6 - 't13 't10 --- - "paddw %%mm3, %%mm7 \n\t" //z2 + "paddw %%mm3, %%mm7 \n\t" //z2 "movq %%mm5, 1*8+%3 \n\t" "paddw %%mm3, %%mm4 \n\t" //z4 @@ -1367,10 +1367,10 @@ static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, "movq %%mm0, %%mm1 \n\t" "movq %%mm6, 2*8+%3 \n\t" - "psubw %%mm2, %%mm1 \n\t" //z13 + "psubw %%mm2, %%mm1 \n\t" //z13 //=== - "paddw %%mm2, %%mm0 \n\t" //z11 + "paddw %%mm2, %%mm0 \n\t" //z11 "movq %%mm1, %%mm5 \n\t" "movq 1*8+5*16(%%"REG_d"), %%mm2 \n\t" @@ -1383,12 +1383,12 @@ static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, "psubw %%mm2, %%mm5 \n\t" "movq %%mm0, %%mm6 \n\t" - "paddw %%mm4, %%mm0 \n\t" //d1 + "paddw %%mm4, %%mm0 \n\t" //d1 "paddusw %%mm3, %%mm1 \n\t" - "psubw %%mm4, %%mm6 \n\t" //d7 + "psubw %%mm4, %%mm6 \n\t" //d7 - // d1 d3 - - - d5 d7 - + // d1 d3 - - - d5 d7 - "movq 1*8+7*16(%%"REG_d"), %%mm4 \n\t" "psubw %%mm7, %%mm0 \n\t" @@ -1440,7 +1440,7 @@ static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, "movq 1*8+%3, %%mm6 \n\t" //paddw mm3, MM_2 - "psraw $2, %%mm3 \n\t" //tmp7 + "psraw $2, %%mm3 \n\t" //tmp7 "pmulhw "MANGLE(MM_FIX_0_198912367)", %%mm2 \n\t" //-tmp4 "psubw %%mm3, %%mm4 \n\t" @@ -1495,7 +1495,7 @@ static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, "3: \n\t" //--- non DC2 //psraw mm1, 2 w/o it -> offset. thr1, thr1, thr1 (actually thr1, thr1, thr1-1) - //psraw mm5, 2 + //psraw mm5, 2 //psraw mm0, 2 //psraw mm6, 2 "movq %%mm5, %%mm3 \n\t" @@ -1565,7 +1565,7 @@ static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, "paddw %%mm2, %%mm7 \n\t" "movq %%mm3, "DCTSIZE_S"*1*2(%%"REG_D") \n\t" - "paddw %%mm2, %%mm0 \n\t" //'t4 + "paddw %%mm2, %%mm0 \n\t" //'t4 // 't4 't6 't5 - - - - 't7 "movq %%mm7, "DCTSIZE_S"*2*2(%%"REG_D") \n\t" @@ -1606,13 +1606,13 @@ static void row_idct_c(DCTELEM* workspace, int_simd16_t z5, z10, z11, z12, z13; int16_t* outptr; DCTELEM* wsptr; - + cnt*=4; wsptr = workspace; outptr = output_adr; - for (; cnt > 0; cnt--) { - // Even part - //Simd version reads 4x4 block and transposes it + for (; cnt > 0; cnt--) { + // Even part + //Simd version reads 4x4 block and transposes it tmp10 = ( wsptr[2] + wsptr[3]); tmp11 = ( wsptr[2] - wsptr[3]); @@ -1624,7 +1624,7 @@ static void row_idct_c(DCTELEM* workspace, tmp1 = tmp11 + tmp12; tmp2 = tmp11 - tmp12; - // Odd part + // Odd part //Also transpose, with previous: // ---- ---- |||| // ---- ---- idct |||| @@ -1635,7 +1635,7 @@ static void row_idct_c(DCTELEM* workspace, z11 = wsptr[6] + wsptr[7]; z12 = wsptr[6] - wsptr[7]; - tmp7 = z11 + z13; + tmp7 = z11 + z13; tmp11 = MULTIPLY16H(z11 - z13, FIX_1_414213562); z5 = MULTIPLY16H(z10 + z12, FIX_1_847759065); @@ -1657,13 +1657,13 @@ static void row_idct_c(DCTELEM* workspace, outptr[7*output_stride]+= DESCALE(tmp0 - tmp7, 3); //no += ? outptr++; - wsptr += DCTSIZE; // advance pointer to next row + wsptr += DCTSIZE; // advance pointer to next row } } #else /* HAVE_MMX */ -static void row_idct_mmx (DCTELEM* workspace, +static void row_idct_mmx (DCTELEM* workspace, int16_t* output_adr, int output_stride, int cnt) { uint64_t __attribute__((aligned(8))) temps[4]; @@ -1728,14 +1728,14 @@ static void row_idct_mmx (DCTELEM* workspace, "movq %%mm6, 1*8+%3 \n\t" //t3 "punpcklwd %%mm2, %%mm3 \n\t" - //transpose 4x4 + //transpose 4x4 "movq "DCTSIZE_S"*3*2+"DCTSIZE_S"(%%"REG_S"), %%mm6 \n\t" "punpckhwd %%mm2, %%mm4 \n\t" "movq %%mm5, %%mm2 \n\t" "punpcklwd %%mm6, %%mm5 \n\t" - "psubw %%mm0, %%mm7 \n\t" //t2 + "psubw %%mm0, %%mm7 \n\t" //t2 "punpckhwd %%mm6, %%mm2 \n\t" "movq %%mm3, %%mm0 \n\t" @@ -1749,13 +1749,13 @@ static void row_idct_mmx (DCTELEM* workspace, "punpckldq %%mm2, %%mm4 \n\t" //6 "psubw %%mm0, %%mm3 \n\t" //z10 - "punpckhdq %%mm2, %%mm5 \n\t" //7 + "punpckhdq %%mm2, %%mm5 \n\t" //7 "paddw %%mm0, %%mm6 \n\t" //z13 "movq %%mm4, %%mm2 \n\t" "movq %%mm3, %%mm0 \n\t" - "psubw %%mm5, %%mm4 \n\t" //z12 + "psubw %%mm5, %%mm4 \n\t" //z12 "pmulhw "MANGLE(MM_FIX_2_613125930)", %%mm0 \n\t" //- "paddw %%mm4, %%mm3 \n\t" @@ -1769,11 +1769,11 @@ static void row_idct_mmx (DCTELEM* workspace, "psubw %%mm6, %%mm2 \n\t" "paddw %%mm6, %%mm5 \n\t" //t7 - "pmulhw "MANGLE(MM_FIX_1_414213562)", %%mm2 \n\t" //t11 + "pmulhw "MANGLE(MM_FIX_1_414213562)", %%mm2 \n\t" //t11 "paddw %%mm3, %%mm0 \n\t" //t12 "psllw $3, %%mm0 \n\t" - "psubw %%mm3, %%mm4 \n\t" //t10 + "psubw %%mm3, %%mm4 \n\t" //t10 "movq 0*8+%3, %%mm6 \n\t" "movq %%mm1, %%mm3 \n\t" @@ -1785,7 +1785,7 @@ static void row_idct_mmx (DCTELEM* workspace, "paddw %%mm0, %%mm1 \n\t" //d1 "psubw %%mm0, %%mm2 \n\t" //t5 - "psubw %%mm0, %%mm3 \n\t" //d6 + "psubw %%mm0, %%mm3 \n\t" //d6 "paddw %%mm2, %%mm4 \n\t" //t4 "movq %%mm7, %%mm0 \n\t" @@ -1832,7 +1832,7 @@ static void row_idct_mmx (DCTELEM* workspace, "paddw (%%"REG_D",%%"REG_d",), %%mm3 \n\t" "psraw $3, %%mm6 \n\t" - "paddw 1*8+%3, %%mm4 \n\t" //d4 + "paddw 1*8+%3, %%mm4 \n\t" //d4 "paddw %%mm2, %%mm5 \n\t" "paddw (%%"REG_D",%%"REG_a",4), %%mm6 \n\t" @@ -1872,13 +1872,13 @@ static void row_fdct_c(DCTELEM *data, const uint8_t *pixels, int line_size, int int_simd16_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; int_simd16_t tmp10, tmp11, tmp12, tmp13; int_simd16_t z1, z2, z3, z4, z5, z11, z13; - DCTELEM *dataptr; - + DCTELEM *dataptr; + cnt*=4; - // Pass 1: process rows. - + // Pass 1: process rows. + dataptr = data; - for (; cnt > 0; cnt--) { + for (; cnt > 0; cnt--) { tmp0 = pixels[line_size*0] + pixels[line_size*7]; tmp7 = pixels[line_size*0] - pixels[line_size*7]; tmp1 = pixels[line_size*1] + pixels[line_size*6]; @@ -1887,26 +1887,26 @@ static void row_fdct_c(DCTELEM *data, const uint8_t *pixels, int line_size, int tmp5 = pixels[line_size*2] - pixels[line_size*5]; tmp3 = pixels[line_size*3] + pixels[line_size*4]; tmp4 = pixels[line_size*3] - pixels[line_size*4]; - - // Even part - - tmp10 = tmp0 + tmp3; + + // Even part + + tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; - //Even columns are written first, this leads to different order of columns + //Even columns are written first, this leads to different order of columns //in column_fidct(), but they are processed independently, so all ok. //Later in the row_idct() columns readed at the same order. - dataptr[2] = tmp10 + tmp11; + dataptr[2] = tmp10 + tmp11; dataptr[3] = tmp10 - tmp11; - + z1 = MULTIPLY16H((tmp12 + tmp13)<<2, FIX_0_707106781); - dataptr[0] = tmp13 + z1; + dataptr[0] = tmp13 + z1; dataptr[1] = tmp13 - z1; - - // Odd part - tmp10 = (tmp4 + tmp5) <<2; + // Odd part + + tmp10 = (tmp4 + tmp5) <<2; tmp11 = (tmp5 + tmp6) <<2; tmp12 = (tmp6 + tmp7) <<2; @@ -1924,7 +1924,7 @@ static void row_fdct_c(DCTELEM *data, const uint8_t *pixels, int line_size, int dataptr[7] = z11 - z4; pixels++; // advance pointer to next column - dataptr += DCTSIZE; + dataptr += DCTSIZE; } } @@ -1949,7 +1949,7 @@ static void row_fdct_mmx(DCTELEM *data, const uint8_t *pixels, int line_size, "add %%"REG_d", %%"REG_S" \n\t" "movq %%mm0, %%mm5 \n\t" - // + // "movd (%%"REG_S",%%"REG_a",4), %%mm3 \n\t" //7 ;prefetch! "movq %%mm1, %%mm6 \n\t" @@ -1991,7 +1991,7 @@ static void row_fdct_mmx(DCTELEM *data, const uint8_t *pixels, int line_size, "psubw %%mm5, %%mm0 \n\t" //t13 "psubw %%mm2, %%mm1 \n\t" - "paddw %%mm2, %%mm7 \n\t" //t11 + "paddw %%mm2, %%mm7 \n\t" //t11 "paddw %%mm0, %%mm1 \n\t" "movq %%mm7, %%mm2 \n\t" @@ -2012,7 +2012,7 @@ static void row_fdct_mmx(DCTELEM *data, const uint8_t *pixels, int line_size, "paddw %%mm1, %%mm0 \n\t" //d0 "punpckhwd %%mm6, %%mm2 \n\t" - "psubw %%mm1, %%mm5 \n\t" //d1 + "psubw %%mm1, %%mm5 \n\t" //d1 "movq %%mm0, %%mm6 \n\t" "movq 1*8+%3, %%mm1 \n\t" @@ -2028,16 +2028,16 @@ static void row_fdct_mmx(DCTELEM *data, const uint8_t *pixels, int line_size, "movq %%mm6, %%mm7 \n\t" "movq %%mm0, "DCTSIZE_S"*0*2(%%"REG_D") \n\t" - "punpckldq %%mm2, %%mm6 \n\t" //2 + "punpckldq %%mm2, %%mm6 \n\t" //2 "movq %%mm5, "DCTSIZE_S"*1*2(%%"REG_D") \n\t" - "punpckhdq %%mm2, %%mm7 \n\t" //3 + "punpckhdq %%mm2, %%mm7 \n\t" //3 "movq %%mm6, "DCTSIZE_S"*2*2(%%"REG_D") \n\t" "paddw %%mm1, %%mm4 \n\t" "movq %%mm7, "DCTSIZE_S"*3*2(%%"REG_D") \n\t" - "psllw $2, %%mm3 \n\t" //t10 + "psllw $2, %%mm3 \n\t" //t10 "movq 0*8+%3, %%mm2 \n\t" "psllw $2, %%mm4 \n\t" //t11 @@ -2064,17 +2064,17 @@ static void row_fdct_mmx(DCTELEM *data, const uint8_t *pixels, int line_size, "movq %%mm5, %%mm7 \n\t" "paddw %%mm0, %%mm2 \n\t" //d4 - "psubw %%mm0, %%mm6 \n\t" //d5 + "psubw %%mm0, %%mm6 \n\t" //d5 "movq %%mm2, %%mm4 \n\t" - "paddw %%mm3, %%mm1 \n\t" //z4 + "paddw %%mm3, %%mm1 \n\t" //z4 //transpose 4x4 "punpcklwd %%mm6, %%mm2 \n\t" "paddw %%mm1, %%mm5 \n\t" //d6 "punpckhwd %%mm6, %%mm4 \n\t" - "psubw %%mm1, %%mm7 \n\t" //d7 + "psubw %%mm1, %%mm7 \n\t" //d7 "movq %%mm5, %%mm6 \n\t" "punpcklwd %%mm7, %%mm5 \n\t" @@ -2092,13 +2092,13 @@ static void row_fdct_mmx(DCTELEM *data, const uint8_t *pixels, int line_size, "punpckldq %%mm6, %%mm4 \n\t" //6 "movq %%mm7, "DCTSIZE_S"*1*2+"DCTSIZE_S"(%%"REG_D") \n\t" - "punpckhdq %%mm6, %%mm5 \n\t" //7 + "punpckhdq %%mm6, %%mm5 \n\t" //7 "movq %%mm4, "DCTSIZE_S"*2*2+"DCTSIZE_S"(%%"REG_D") \n\t" "add $4, %%"REG_S" \n\t" "movq %%mm5, "DCTSIZE_S"*3*2+"DCTSIZE_S"(%%"REG_D") \n\t" - "add $"DCTSIZE_S"*2*4, %%"REG_D" \n\t" //4 rows + "add $"DCTSIZE_S"*2*4, %%"REG_D" \n\t" //4 rows "dec %%"REG_c" \n\t" "jnz 6b \n\t" diff --git a/libmpcodecs/vf_halfpack.c b/libmpcodecs/vf_halfpack.c index 15997941f4..682b80a91e 100644 --- a/libmpcodecs/vf_halfpack.c +++ b/libmpcodecs/vf_halfpack.c @@ -53,7 +53,7 @@ static void halfpack_MMX(unsigned char *dst, unsigned char *src[3], "paddw %%mm4, %%mm2 \n\t" "psrlw $1, %%mm1 \n\t" "psrlw $1, %%mm2 \n\t" - + "movq (%2), %%mm3 \n\t" "movq (%3), %%mm5 \n\t" "punpcklbw %%mm0, %%mm3 \n\t" @@ -198,11 +198,11 @@ static int open(vf_instance_t *vf, char* args) vf->query_format=query_format; vf->put_image=put_image; vf->uninit=uninit; - + vf->priv = calloc(1, sizeof (struct vf_priv_s)); vf->priv->field = 2; if (args) sscanf(args, "%d", &vf->priv->field); - + halfpack = halfpack_C; #if HAVE_MMX if(gCpuCaps.hasMMX) halfpack = halfpack_MMX; @@ -218,4 +218,3 @@ const vf_info_t vf_info_halfpack = { open, NULL }; - diff --git a/libmpcodecs/vf_harddup.c b/libmpcodecs/vf_harddup.c index 6bb84143d3..94fbcc2563 100644 --- a/libmpcodecs/vf_harddup.c +++ b/libmpcodecs/vf_harddup.c @@ -18,7 +18,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts) mp_image_t *dmpi; vf->priv->last_mpi = mpi; - + dmpi = vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_EXPORT, 0, mpi->width, mpi->height); @@ -30,7 +30,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts) dmpi->planes[2] = mpi->planes[2]; dmpi->stride[2] = mpi->stride[2]; } - + return vf_next_put_image(vf, dmpi, pts); } @@ -72,5 +72,3 @@ const vf_info_t vf_info_harddup = { open, NULL }; - - diff --git a/libmpcodecs/vf_hqdn3d.c b/libmpcodecs/vf_hqdn3d.c index acd24e6100..8906060719 100644 --- a/libmpcodecs/vf_hqdn3d.c +++ b/libmpcodecs/vf_hqdn3d.c @@ -101,7 +101,7 @@ static void deNoiseSpacial( int sLineOffs = 0, dLineOffs = 0; unsigned int PixelAnt; unsigned int PixelDst; - + /* First pixel has no left nor top neighbor. */ PixelDst = LineAnt[0] = PixelAnt = Frame[0]<<16; FrameDest[0]= ((PixelDst+0x10007FFF)>>16); @@ -142,7 +142,7 @@ static void deNoise(unsigned char *Frame, // mpi->planes[x] unsigned int PixelAnt; unsigned int PixelDst; unsigned short* FrameAnt=(*FrameAntPtr); - + if(!FrameAnt){ (*FrameAntPtr)=FrameAnt=malloc(W*H*sizeof(unsigned short)); for (Y = 0; Y < H; Y++){ diff --git a/libmpcodecs/vf_hue.c b/libmpcodecs/vf_hue.c index 32d2c46680..a289543c48 100644 --- a/libmpcodecs/vf_hue.c +++ b/libmpcodecs/vf_hue.c @@ -65,7 +65,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts) dmpi=vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_EXPORT, 0, mpi->w, mpi->h); - + dmpi->planes[0] = mpi->planes[0]; dmpi->stride[0] = mpi->stride[0]; dmpi->stride[1] = mpi->stride[1]; @@ -75,7 +75,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts) vf->priv->buf[0] = malloc(mpi->stride[1]*mpi->h >> mpi->chroma_y_shift); vf->priv->buf[1] = malloc(mpi->stride[2]*mpi->h >> mpi->chroma_y_shift); } - + if (vf->priv->hue == 0 && vf->priv->saturation == 1){ dmpi->planes[1] = mpi->planes[1]; dmpi->planes[2] = mpi->planes[2]; @@ -85,7 +85,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts) process(dmpi->planes[1], dmpi->planes[2], mpi->planes[1], mpi->planes[2], dmpi->stride[1],mpi->stride[1], - mpi->w>> mpi->chroma_x_shift, mpi->h>> mpi->chroma_y_shift, + mpi->w>> mpi->chroma_x_shift, mpi->h>> mpi->chroma_y_shift, vf->priv->hue, vf->priv->saturation); } @@ -151,7 +151,7 @@ static int open(vf_instance_t *vf, char* args) vf->query_format=query_format; vf->put_image=put_image; vf->uninit=uninit; - + if(!vf->priv) { vf->priv = malloc(sizeof(struct vf_priv_s)); memset(vf->priv, 0, sizeof(struct vf_priv_s)); @@ -185,4 +185,3 @@ const vf_info_t vf_info_hue = { open, &vf_opts }; - diff --git a/libmpcodecs/vf_il.c b/libmpcodecs/vf_il.c index de99c8a224..724dedb2d0 100644 --- a/libmpcodecs/vf_il.c +++ b/libmpcodecs/vf_il.c @@ -87,19 +87,19 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ else w= mpi->w * mpi->bpp/8; - interleave(dmpi->planes[0], mpi->planes[0], + interleave(dmpi->planes[0], mpi->planes[0], w, mpi->h, dmpi->stride[0], mpi->stride[0], luma->interleave, luma->swap); if(mpi->flags&MP_IMGFLAG_PLANAR){ int cw= mpi->w >> mpi->chroma_x_shift; int ch= mpi->h >> mpi->chroma_y_shift; - interleave(dmpi->planes[1], mpi->planes[1], cw,ch, + interleave(dmpi->planes[1], mpi->planes[1], cw,ch, dmpi->stride[1], mpi->stride[1], chroma->interleave, luma->swap); - interleave(dmpi->planes[2], mpi->planes[2], cw,ch, + interleave(dmpi->planes[2], mpi->planes[2], cw,ch, dmpi->stride[2], mpi->stride[2], chroma->interleave, luma->swap); } - + return vf_next_put_image(vf,dmpi, pts); } @@ -125,7 +125,7 @@ static int open(vf_instance_t *vf, char* args){ // vf->get_image=get_image; vf->priv=malloc(sizeof(struct vf_priv_s)); memset(vf->priv, 0, sizeof(struct vf_priv_s)); - + if(args) { char *arg2= strchr(args,':'); diff --git a/libmpcodecs/vf_ilpack.c b/libmpcodecs/vf_ilpack.c index 1f25e054f5..dc586762b4 100644 --- a/libmpcodecs/vf_ilpack.c +++ b/libmpcodecs/vf_ilpack.c @@ -71,7 +71,7 @@ static void pack_nn_MMX(unsigned char *dst, unsigned char *y, "punpcklbw %%mm6, %%mm4 \n\t" "punpcklbw %%mm4, %%mm1 \n\t" "punpckhbw %%mm4, %%mm2 \n\t" - + "add $8, %0 \n\t" "add $4, %1 \n\t" "add $4, %2 \n\t" @@ -81,7 +81,7 @@ static void pack_nn_MMX(unsigned char *dst, unsigned char *y, "decl %4 \n\t" "jnz 1b \n\t" "emms \n\t" - : + : : "r" (y), "r" (u), "r" (v), "r" (dst), "r" (w/8) : "memory" ); @@ -100,12 +100,12 @@ static void pack_li_0_MMX(unsigned char *dst, unsigned char *y, "movl (%%"REG_d"), %%"REG_d" \n\t" #endif "pxor %%mm0, %%mm0 \n\t" - + ASMALIGN(4) ".Lli0: \n\t" "movq (%%"REG_S"), %%mm1 \n\t" "movq (%%"REG_S"), %%mm2 \n\t" - + "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t" "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t" "punpcklbw %%mm0, %%mm4 \n\t" @@ -135,13 +135,13 @@ static void pack_li_0_MMX(unsigned char *dst, unsigned char *y, "punpcklbw %%mm6, %%mm4 \n\t" "punpcklbw %%mm4, %%mm1 \n\t" "punpckhbw %%mm4, %%mm2 \n\t" - + "movq %%mm1, (%%"REG_D") \n\t" "movq %%mm2, 8(%%"REG_D") \n\t" - + "movq 8(%%"REG_S"), %%mm1 \n\t" "movq 8(%%"REG_S"), %%mm2 \n\t" - + "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t" "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t" "punpckhbw %%mm0, %%mm4 \n\t" @@ -171,20 +171,20 @@ static void pack_li_0_MMX(unsigned char *dst, unsigned char *y, "punpcklbw %%mm6, %%mm4 \n\t" "punpcklbw %%mm4, %%mm1 \n\t" "punpckhbw %%mm4, %%mm2 \n\t" - + "add $16, %%"REG_S" \n\t" "add $8, %%"REG_a" \n\t" "add $8, %%"REG_b" \n\t" - + "movq %%mm1, 16(%%"REG_D") \n\t" "movq %%mm2, 24(%%"REG_D") \n\t" "add $32, %%"REG_D" \n\t" - + "decl %%ecx \n\t" "jnz .Lli0 \n\t" "emms \n\t" "pop %%"REG_BP" \n\t" - : + : : "S" (y), "D" (dst), "a" (u), "b" (v), "c" (w/16), #if ARCH_X86_64 "d" ((x86_reg)us), "r" ((x86_reg)vs) @@ -208,12 +208,12 @@ static void pack_li_1_MMX(unsigned char *dst, unsigned char *y, "movl (%%"REG_d"), %%"REG_d" \n\t" #endif "pxor %%mm0, %%mm0 \n\t" - + ASMALIGN(4) ".Lli1: \n\t" "movq (%%"REG_S"), %%mm1 \n\t" "movq (%%"REG_S"), %%mm2 \n\t" - + "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t" "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t" "punpcklbw %%mm0, %%mm4 \n\t" @@ -245,13 +245,13 @@ static void pack_li_1_MMX(unsigned char *dst, unsigned char *y, "punpcklbw %%mm6, %%mm4 \n\t" "punpcklbw %%mm4, %%mm1 \n\t" "punpckhbw %%mm4, %%mm2 \n\t" - + "movq %%mm1, (%%"REG_D") \n\t" "movq %%mm2, 8(%%"REG_D") \n\t" - + "movq 8(%%"REG_S"), %%mm1 \n\t" "movq 8(%%"REG_S"), %%mm2 \n\t" - + "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t" "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t" "punpckhbw %%mm0, %%mm4 \n\t" @@ -283,20 +283,20 @@ static void pack_li_1_MMX(unsigned char *dst, unsigned char *y, "punpcklbw %%mm6, %%mm4 \n\t" "punpcklbw %%mm4, %%mm1 \n\t" "punpckhbw %%mm4, %%mm2 \n\t" - + "add $16, %%"REG_S" \n\t" "add $8, %%"REG_a" \n\t" "add $8, %%"REG_b" \n\t" - + "movq %%mm1, 16(%%"REG_D") \n\t" "movq %%mm2, 24(%%"REG_D") \n\t" "add $32, %%"REG_D" \n\t" - + "decl %%ecx \n\t" "jnz .Lli1 \n\t" "emms \n\t" "pop %%"REG_BP" \n\t" - : + : : "S" (y), "D" (dst), "a" (u), "b" (v), "c" (w/16), #if ARCH_X86_64 "d" ((x86_reg)us), "r" ((x86_reg)vs) @@ -392,7 +392,7 @@ static int open(vf_instance_t *vf, char* args) vf->priv = calloc(1, sizeof(struct vf_priv_s)); vf->priv->mode = 1; if (args) sscanf(args, "%d", &vf->priv->mode); - + pack_nn = (pack_func_t *)pack_nn_C; pack_li_0 = pack_li_0_C; pack_li_1 = pack_li_1_C; @@ -417,7 +417,7 @@ static int open(vf_instance_t *vf, char* args) vf->priv->pack[1] = pack_li_1; break; } - + return 1; } @@ -429,4 +429,3 @@ const vf_info_t vf_info_ilpack = { open, NULL }; - diff --git a/libmpcodecs/vf_ivtc.c b/libmpcodecs/vf_ivtc.c index 222b9fec4e..a5e2356eaa 100644 --- a/libmpcodecs/vf_ivtc.c +++ b/libmpcodecs/vf_ivtc.c @@ -45,16 +45,16 @@ static void block_diffs_MMX(struct metrics *m, unsigned char *old, unsigned char { int i; short out[24]; // output buffer for the partial metrics from the mmx code - + __asm__ ( "movl $4, %%ecx \n\t" "pxor %%mm4, %%mm4 \n\t" // 4 even difference sums "pxor %%mm5, %%mm5 \n\t" // 4 odd difference sums "pxor %%mm7, %%mm7 \n\t" // all zeros - + ASMALIGN(4) "1: \n\t" - + // Even difference "movq (%%"REG_S"), %%mm0 \n\t" "movq (%%"REG_S"), %%mm2 \n\t" @@ -73,7 +73,7 @@ static void block_diffs_MMX(struct metrics *m, unsigned char *old, unsigned char "paddw %%mm1, %%mm4 \n\t" "paddw %%mm2, %%mm4 \n\t" "paddw %%mm3, %%mm4 \n\t" - + // Odd difference "movq (%%"REG_S"), %%mm0 \n\t" "movq (%%"REG_S"), %%mm2 \n\t" @@ -92,12 +92,12 @@ static void block_diffs_MMX(struct metrics *m, unsigned char *old, unsigned char "paddw %%mm1, %%mm5 \n\t" "paddw %%mm2, %%mm5 \n\t" "paddw %%mm3, %%mm5 \n\t" - + "decl %%ecx \n\t" "jnz 1b \n\t" "movq %%mm4, (%%"REG_d") \n\t" "movq %%mm5, 8(%%"REG_d") \n\t" - : + : : "S" (old), "D" (new), "a" (os), "b" (ns), "d" (out) : "memory" ); @@ -111,10 +111,10 @@ static void block_diffs_MMX(struct metrics *m, unsigned char *old, unsigned char "pxor %%mm4, %%mm4 \n\t" // Past spacial noise "pxor %%mm5, %%mm5 \n\t" // Temporal noise "pxor %%mm6, %%mm6 \n\t" // Current spacial noise - + ASMALIGN(4) "2: \n\t" - + "movq (%%"REG_S"), %%mm0 \n\t" "movq (%%"REG_S",%%"REG_a"), %%mm1 \n\t" "add %%"REG_a", %%"REG_S" \n\t" @@ -133,10 +133,10 @@ static void block_diffs_MMX(struct metrics *m, unsigned char *old, unsigned char "psubw %%mm0, %%mm4 \n\t" "psubw %%mm2, %%mm5 \n\t" "psubw %%mm2, %%mm6 \n\t" - + "decl %%ecx \n\t" "jnz 2b \n\t" - + "movq %%mm0, %%mm1 \n\t" "movq %%mm0, %%mm2 \n\t" "movq %%mm0, %%mm3 \n\t" @@ -165,10 +165,10 @@ static void block_diffs_MMX(struct metrics *m, unsigned char *old, unsigned char "pxor %%mm4, %%mm4 \n\t" "pxor %%mm5, %%mm5 \n\t" "pxor %%mm6, %%mm6 \n\t" - + ASMALIGN(4) "3: \n\t" - + "movq (%%"REG_S"), %%mm0 \n\t" "movq (%%"REG_S",%%"REG_a"), %%mm1 \n\t" "add %%"REG_a", %%"REG_S" \n\t" @@ -187,10 +187,10 @@ static void block_diffs_MMX(struct metrics *m, unsigned char *old, unsigned char "psubw %%mm0, %%mm4 \n\t" "psubw %%mm2, %%mm5 \n\t" "psubw %%mm2, %%mm6 \n\t" - + "decl %%ecx \n\t" "jnz 3b \n\t" - + "movq %%mm0, %%mm1 \n\t" "movq %%mm0, %%mm2 \n\t" "movq %%mm0, %%mm3 \n\t" @@ -208,7 +208,7 @@ static void block_diffs_MMX(struct metrics *m, unsigned char *old, unsigned char "movq %%mm6, 40(%%"REG_d") \n\t" "emms \n\t" - : + : : "S" (old), "D" (new), "a" ((long)os), "b" ((long)ns), "d" (out) : "memory" ); @@ -328,7 +328,7 @@ static int foo(struct vf_priv_s *p, mp_image_t *new, mp_image_t *cur) p->dropnext = 0; return F_DROP; } - + // Sometimes a pulldown frame comes all by itself, so both // its top and bottom field are duplicates from the adjacent // two frames. We can just drop such a frame, but we @@ -338,7 +338,7 @@ static int foo(struct vf_priv_s *p, mp_image_t *new, mp_image_t *cur) p->dropnext = 1; return F_NEXT; } - + // If none of these conditions hold, we will consider the frame // progressive and just show it as-is. if (!( (3*f[0].r.e < f[0].r.o) || @@ -424,7 +424,7 @@ static int do_put_image(struct vf_instance* vf, mp_image_t *dmpi) dropflag = (++p->lastdrop >= 5) && (4*p->inframes <= 5*p->outframes); break; } - + if (dropflag) { //mp_msg(MSGT_VFILTER, MSGL_V, "drop! [%d/%d=%g]\n", // p->outframes, p->inframes, (float)p->outframes/p->inframes); @@ -457,7 +457,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts) p->dmpi->qscale = mpi->qscale; p->dmpi->qstride = mpi->qstride; p->dmpi->qscale_type = mpi->qscale_type; - + switch (foo(p, mpi, p->dmpi)) { case F_DROP: copy_image(p->dmpi, mpi, 2); @@ -530,5 +530,3 @@ const vf_info_t vf_info_ivtc = { open, NULL }; - - diff --git a/libmpcodecs/vf_lavc.c b/libmpcodecs/vf_lavc.c index e2b1ae54af..4583e4372e 100644 --- a/libmpcodecs/vf_lavc.c +++ b/libmpcodecs/vf_lavc.c @@ -34,7 +34,7 @@ static int config(struct vf_instance* vf, lavc_venc_context.width = width; lavc_venc_context.height = height; - + if(!lavc_venc_context.time_base.num || !lavc_venc_context.time_base.den){ // guess FPS: switch(height){ @@ -81,7 +81,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ pic->linesize[1]=mpi->stride[1]; pic->linesize[2]=mpi->stride[2]; - out_size = avcodec_encode_video(&lavc_venc_context, + out_size = avcodec_encode_video(&lavc_venc_context, vf->priv->outbuf, vf->priv->outbuf_size, pic); if(out_size<=0) return 1; @@ -89,14 +89,14 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ dmpi=vf_get_image(vf->next,IMGFMT_MPEGPES, MP_IMGTYPE_EXPORT, 0, mpi->w, mpi->h); - + vf->priv->pes.data=vf->priv->outbuf; vf->priv->pes.size=out_size; vf->priv->pes.id=0x1E0; vf->priv->pes.timestamp=-1; // dunno - + dmpi->planes[0]=(unsigned char*)&vf->priv->pes; - + return vf_next_put_image(vf,dmpi, MP_NOPTS_VALUE); } @@ -115,7 +115,7 @@ static int query_format(struct vf_instance* vf, unsigned int fmt){ static int open(vf_instance_t *vf, char* args){ int p_quality=0; float p_fps=0; - + vf->config=config; vf->put_image=put_image; vf->query_format=query_format; @@ -133,7 +133,7 @@ static int open(vf_instance_t *vf, char* args){ mp_tmsg(MSGT_MENCODER,MSGL_ERR,"Cannot find codec '%s' in libavcodec...\n", "mpeg1video"); return 0; } - + vf->priv->context=avcodec_alloc_context(); vf->priv->pic = avcodec_alloc_frame(); diff --git a/libmpcodecs/vf_lavcdeint.c b/libmpcodecs/vf_lavcdeint.c index ff8aea54dd..1e0a3f2d32 100644 --- a/libmpcodecs/vf_lavcdeint.c +++ b/libmpcodecs/vf_lavcdeint.c @@ -14,7 +14,7 @@ extern int avcodec_initialized; -struct vf_priv_s +struct vf_priv_s { int width, height; int pix_fmt; @@ -69,7 +69,7 @@ imgfmt_to_pixfmt (int imgfmt) } -static int +static int config (struct vf_instance* vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt) @@ -79,7 +79,7 @@ config (struct vf_instance* vf, priv->pix_fmt = imgfmt_to_pixfmt(outfmt); if(priv->pix_fmt == -1) return 0; - + /* The deinterlacer will fail if this is false */ if ((width & 3) != 0 || (height & 3) != 0) return 0; @@ -95,21 +95,21 @@ config (struct vf_instance* vf, flags, outfmt); } -static int +static int put_image (struct vf_instance* vf, mp_image_t *mpi, double pts) { struct vf_priv_s *priv = vf->priv; mp_image_t* dmpi; AVPicture pic; AVPicture lavc_picture; - + lavc_picture.data[0] = mpi->planes[0]; lavc_picture.data[1] = mpi->planes[1]; lavc_picture.data[2] = mpi->planes[2]; lavc_picture.linesize[0] = mpi->stride[0]; lavc_picture.linesize[1] = mpi->stride[1]; lavc_picture.linesize[2] = mpi->stride[2]; - + dmpi = vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, priv->width, priv->height); @@ -121,18 +121,18 @@ put_image (struct vf_instance* vf, mp_image_t *mpi, double pts) pic.linesize[1] = dmpi->stride[1]; pic.linesize[2] = dmpi->stride[2]; - if (avpicture_deinterlace(&pic, &lavc_picture, + if (avpicture_deinterlace(&pic, &lavc_picture, priv->pix_fmt, priv->width, priv->height) < 0) { /* This should not happen -- see config() */ return 0; } - + return vf_next_put_image(vf, dmpi, pts); } -static int +static int query_format (struct vf_instance* vf, unsigned int fmt) { if(imgfmt_to_pixfmt(fmt) == -1) @@ -142,7 +142,7 @@ query_format (struct vf_instance* vf, unsigned int fmt) } -static int +static int open (vf_instance_t *vf, char* args) { /* We don't have any args */ diff --git a/libmpcodecs/vf_mcdeint.c b/libmpcodecs/vf_mcdeint.c index 63e22cac8d..0b6547359a 100644 --- a/libmpcodecs/vf_mcdeint.c +++ b/libmpcodecs/vf_mcdeint.c @@ -25,7 +25,7 @@ Known Issues: frames are created purely based on spatial interpolation then for example a thin black line or another random and not interpolateable pattern will cause problems - Note: completly ignoring the "unavailable" lines during motion estimation + Note: completly ignoring the "unavailable" lines during motion estimation didnt look any better, so the most obvious solution would be to improve tfields or penalize problematic motion vectors ... @@ -33,7 +33,7 @@ Known Issues: and as a result sometimes creates artifacts * only past frames are used, we should ideally use future frames too, something - like filtering the whole movie in forward and then backward direction seems + like filtering the whole movie in forward and then backward direction seems like a interresting idea but the current filter framework is FAR from supporting such things diff --git a/libmpcodecs/vf_mirror.c b/libmpcodecs/vf_mirror.c index 5d7d3be80d..267d9fe407 100644 --- a/libmpcodecs/vf_mirror.c +++ b/libmpcodecs/vf_mirror.c @@ -89,7 +89,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ dmpi->w,dmpi->h,dmpi->bpp>>3,mpi->imgfmt); dmpi->planes[1]=mpi->planes[1]; // passthrough rgb8 palette } - + return vf_next_put_image(vf,dmpi, pts); } diff --git a/libmpcodecs/vf_noformat.c b/libmpcodecs/vf_noformat.c index 5accc265eb..4d6a9b106b 100644 --- a/libmpcodecs/vf_noformat.c +++ b/libmpcodecs/vf_noformat.c @@ -68,7 +68,7 @@ static int open(vf_instance_t *vf, char* args){ if(!strcasecmp(args,"abgr")) vf->priv->fmt=IMGFMT_ABGR; else { mp_tmsg(MSGT_VFILTER, MSGL_WARN, "[VF_FORMAT] Unknown format name: '%s'.\n", args);return 0;} } - + return 1; } diff --git a/libmpcodecs/vf_noise.c b/libmpcodecs/vf_noise.c index 0d4a089d5e..6fdc5e20c5 100644 --- a/libmpcodecs/vf_noise.c +++ b/libmpcodecs/vf_noise.c @@ -110,7 +110,7 @@ static int8_t *initNoise(FilterParam *fp){ x2 = 2.0 * rand()/(float)RAND_MAX - 1.0; w = x1 * x1 + x2 * x2; } while ( w >= 1.0 ); - + w = sqrt( (-2.0 * log( w ) ) / w ); y1= x1 * w; y1*= strength / sqrt(3.0); @@ -125,7 +125,7 @@ static int8_t *initNoise(FilterParam *fp){ } if (RAND_N(6) == 0) j--; } - + for (i = 0; i < MAX_RES; i++) for (j = 0; j < 3; j++) @@ -246,7 +246,7 @@ static inline void lineNoiseAvg_MMX(uint8_t *dst, uint8_t *src, int len, int8_t "movq %%mm1, (%4, %%"REG_a") \n\t" "add $8, %%"REG_a" \n\t" " js 1b \n\t" - :: "r" (src+mmx_len), "r" (shift[0]+mmx_len), "r" (shift[1]+mmx_len), "r" (shift[2]+mmx_len), + :: "r" (src+mmx_len), "r" (shift[0]+mmx_len), "r" (shift[1]+mmx_len), "r" (shift[2]+mmx_len), "r" (dst+mmx_len), "g" (-mmx_len) : "%"REG_a ); @@ -261,7 +261,7 @@ static inline void lineNoiseAvg_MMX(uint8_t *dst, uint8_t *src, int len, int8_t static inline void lineNoiseAvg_C(uint8_t *dst, uint8_t *src, int len, int8_t **shift){ int i; int8_t *src2= (int8_t*)src; - + for(i=0; i<len; i++) { const int n= shift[0][i] + shift[1][i] + shift[2][i]; @@ -374,7 +374,7 @@ static void uninit(struct vf_instance* vf){ if(vf->priv->lumaParam.noise) free(vf->priv->lumaParam.noise); vf->priv->lumaParam.noise= NULL; - + free(vf->priv); vf->priv=NULL; } @@ -446,7 +446,7 @@ static int open(vf_instance_t *vf, char* args){ return 0; // no csp match :( } - + #if HAVE_MMX if(gCpuCaps.hasMMX){ lineNoise= lineNoise_MMX; @@ -457,7 +457,7 @@ static int open(vf_instance_t *vf, char* args){ if(gCpuCaps.hasMMX2) lineNoise= lineNoise_MMX2; // if(gCpuCaps.hasMMX) lineNoiseAvg= lineNoiseAvg_MMX2; #endif - + return 1; } diff --git a/libmpcodecs/vf_ow.c b/libmpcodecs/vf_ow.c index eba1ad673e..16d6ccbc56 100644 --- a/libmpcodecs/vf_ow.c +++ b/libmpcodecs/vf_ow.c @@ -26,7 +26,7 @@ * @todo use QP to decide filter strength * @todo wavelet normalization / least squares optimal signal vs. noise thresholds */ - + #include <stdio.h> #include <string.h> #include <inttypes.h> diff --git a/libmpcodecs/vf_palette.c b/libmpcodecs/vf_palette.c index 838acd9211..a867a4ce44 100644 --- a/libmpcodecs/vf_palette.c +++ b/libmpcodecs/vf_palette.c @@ -76,7 +76,7 @@ static int config(struct vf_instance* vf, static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ mp_image_t *dmpi; - + // hope we'll get DR buffer: dmpi=vf_get_image(vf->next,vf->priv->fmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, @@ -152,7 +152,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ } } } - + return vf_next_put_image(vf,dmpi, pts); } diff --git a/libmpcodecs/vf_perspective.c b/libmpcodecs/vf_perspective.c index e99c8dbf6e..daba3cd2a9 100644 --- a/libmpcodecs/vf_perspective.c +++ b/libmpcodecs/vf_perspective.c @@ -64,18 +64,18 @@ static void initPv(struct vf_priv_s *priv, int W, int H){ - (ref[0][0] - ref[1][0] - ref[2][0] + ref[3][0])*(ref[1][1] - ref[3][1]))*W; D= (ref[1][0] - ref[3][0])*(ref[2][1] - ref[3][1]) - (ref[2][0] - ref[3][0])*(ref[1][1] - ref[3][1]); - + a= D*(ref[1][0] - ref[0][0])*H + g*ref[1][0]; b= D*(ref[2][0] - ref[0][0])*W + h*ref[2][0]; c= D*ref[0][0]*W*H; d= D*(ref[1][1] - ref[0][1])*H + g*ref[1][1]; e= D*(ref[2][1] - ref[0][1])*W + h*ref[2][1]; f= D*ref[0][1]*W*H; - + for(y=0; y<H; y++){ for(x=0; x<W; x++){ int u, v; - + u= (int)floor( SUB_PIXELS*(a*x + b*y + c)/(g*x + h*y + D*W*H) + 0.5); v= (int)floor( SUB_PIXELS*(d*x + e*y + f)/(g*x + h*y + D*W*H) + 0.5); @@ -88,7 +88,7 @@ static void initPv(struct vf_priv_s *priv, int W, int H){ static double getCoeff(double d){ double A= -0.60; double coeff; - + d= fabs(d); // Equation is from VirtualDub @@ -98,7 +98,7 @@ static double getCoeff(double d){ coeff = (-4.0*A + 8.0*A*d - 5.0*A*d*d + A*d*d*d); else coeff=0.0; - + return coeff; } @@ -110,18 +110,18 @@ static int config(struct vf_instance* vf, vf->priv->pvStride= width; vf->priv->pv= (void*)memalign(8, width*height*2*sizeof(int32_t)); initPv(vf->priv, width, height); - + for(i=0; i<SUB_PIXELS; i++){ double d= i/(double)SUB_PIXELS; double temp[4]; double sum=0; - + for(j=0; j<4; j++) temp[j]= getCoeff(j - d - 1); - + for(j=0; j<4; j++) sum+= temp[j]; - + for(j=0; j<4; j++) vf->priv->coeff[i][j]= (int)floor((1<<COEFF_BITS)*temp[j]/sum + 0.5); } @@ -142,7 +142,7 @@ static void uninit(struct vf_instance* vf){ static inline void resampleCubic(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int srcStride, struct vf_priv_s *privParam, int xShift, int yShift){ int x, y; struct vf_priv_s priv= *privParam; - + for(y=0; y<h; y++){ for(x=0; x<w; x++){ int u, v, subU, subV, sum, sx, sy; @@ -162,7 +162,7 @@ static inline void resampleCubic(uint8_t *dst, uint8_t *src, int w, int h, int d const int b= priv.coeff[subU][1]; const int c= priv.coeff[subU][2]; const int d= priv.coeff[subU][3]; - + sum= priv.coeff[subV][0]*( a*src[index - 1 - srcStride] + b*src[index - 0 - srcStride] + c*src[index + 1 - srcStride] + d*src[index + 2 - srcStride]) @@ -184,7 +184,7 @@ static inline void resampleCubic(uint8_t *dst, uint8_t *src, int w, int h, int d int ix= u + dx - 1; if (ix< 0) ix=0; else if(ix>=w) ix=w-1; - + sum+= priv.coeff[subU][dx]*priv.coeff[subV][dy] *src[ ix + iy*srcStride]; } @@ -200,11 +200,11 @@ static inline void resampleCubic(uint8_t *dst, uint8_t *src, int w, int h, int d } } -static inline void resampleLinear(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int srcStride, +static inline void resampleLinear(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int srcStride, struct vf_priv_s *privParam, int xShift, int yShift){ int x, y; struct vf_priv_s priv= *privParam; - + for(y=0; y<h; y++){ for(x=0; x<w; x++){ int u, v, subU, subV, sum, sx, sy, index, subUI, subVI; @@ -220,7 +220,7 @@ static inline void resampleLinear(uint8_t *dst, uint8_t *src, int w, int h, int index= u + v*srcStride; subUI= SUB_PIXELS - subU; subVI= SUB_PIXELS - subV; - + if((unsigned)u < (unsigned)(w - 1)){ if((unsigned)v < (unsigned)(h - 1)){ sum= subVI*(subUI*src[index ] + subU*src[index +1]) @@ -267,20 +267,20 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ mpi->w,mpi->h); assert(mpi->flags&MP_IMGFLAG_PLANAR); - + if(vf->priv->cubic){ - resampleCubic(dmpi->planes[0], mpi->planes[0], mpi->w,mpi->h, dmpi->stride[0], mpi->stride[0], + resampleCubic(dmpi->planes[0], mpi->planes[0], mpi->w,mpi->h, dmpi->stride[0], mpi->stride[0], vf->priv, 0, 0); - resampleCubic(dmpi->planes[1], mpi->planes[1], cw , ch , dmpi->stride[1], mpi->stride[1], + resampleCubic(dmpi->planes[1], mpi->planes[1], cw , ch , dmpi->stride[1], mpi->stride[1], vf->priv, mpi->chroma_x_shift, mpi->chroma_y_shift); - resampleCubic(dmpi->planes[2], mpi->planes[2], cw , ch , dmpi->stride[2], mpi->stride[2], + resampleCubic(dmpi->planes[2], mpi->planes[2], cw , ch , dmpi->stride[2], mpi->stride[2], vf->priv, mpi->chroma_x_shift, mpi->chroma_y_shift); }else{ - resampleLinear(dmpi->planes[0], mpi->planes[0], mpi->w,mpi->h, dmpi->stride[0], mpi->stride[0], + resampleLinear(dmpi->planes[0], mpi->planes[0], mpi->w,mpi->h, dmpi->stride[0], mpi->stride[0], vf->priv, 0, 0); - resampleLinear(dmpi->planes[1], mpi->planes[1], cw , ch , dmpi->stride[1], mpi->stride[1], + resampleLinear(dmpi->planes[1], mpi->planes[1], cw , ch , dmpi->stride[1], mpi->stride[1], vf->priv, mpi->chroma_x_shift, mpi->chroma_y_shift); - resampleLinear(dmpi->planes[2], mpi->planes[2], cw , ch , dmpi->stride[2], mpi->stride[2], + resampleLinear(dmpi->planes[2], mpi->planes[2], cw , ch , dmpi->stride[2], mpi->stride[2], vf->priv, mpi->chroma_x_shift, mpi->chroma_y_shift); } @@ -316,7 +316,7 @@ static int open(vf_instance_t *vf, char* args){ memset(vf->priv, 0, sizeof(struct vf_priv_s)); if(args==NULL) return 0; - + e=sscanf(args, "%lf:%lf:%lf:%lf:%lf:%lf:%lf:%lf:%d", &vf->priv->ref[0][0], &vf->priv->ref[0][1], &vf->priv->ref[1][0], &vf->priv->ref[1][1], diff --git a/libmpcodecs/vf_phase.c b/libmpcodecs/vf_phase.c index 86d57bfc7f..bdb5c19383 100644 --- a/libmpcodecs/vf_phase.c +++ b/libmpcodecs/vf_phase.c @@ -36,7 +36,7 @@ static void do_plane(unsigned char *to, unsigned char *from, { unsigned char *buf, *end; int top; - + if(!*bufp) { mode=PROGRESSIVE; @@ -81,7 +81,7 @@ static enum mode analyze_plane(unsigned char *old, unsigned char *new, else if(mode==AUTO_ANALYZE) mode=fields&MP_IMGFIELD_ORDERED?fields&MP_IMGFIELD_TOP_FIRST? TOP_FIRST_ANALYZE:BOTTOM_FIRST_ANALYZE:FULL_ANALYZE; - + if(fixed_mode(mode)) bdiff=pdiff=tdiff=65536.0; else @@ -116,7 +116,7 @@ static enum mode analyze_plane(unsigned char *old, unsigned char *new, pdif+=diff(new, ns, new, ns), bdif+=diff(new, ns, old, os); break; - + case ANALYZE: if(top) for(rend=new+w; new<rend; new++, old++) @@ -144,20 +144,20 @@ static enum mode analyze_plane(unsigned char *old, unsigned char *new, pdiff+=(double)pdif; tdiff+=(double)tdif; bdiff+=(double)bdif; - } + } scale=1.0/(w*(h-3))/25.0; pdiff*=scale; tdiff*=scale; bdiff*=scale; - + if(mode==TOP_FIRST_ANALYZE) bdiff=65536.0; else if(mode==BOTTOM_FIRST_ANALYZE) tdiff=65536.0; else if(mode==ANALYZE) pdiff=65536.0; - + if(bdiff<pdiff && bdiff<tdiff) mode=BOTTOM_FIRST; else if(tdiff<pdiff && tdiff<bdiff) @@ -205,7 +205,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts) do_plane(dmpi->planes[0], mpi->planes[0], w, dmpi->h, dmpi->stride[0], mpi->stride[0], - &vf->priv->buf[0], mode); + &vf->priv->buf[0], mode); if(dmpi->flags&MP_IMGFLAG_PLANAR) { @@ -241,10 +241,10 @@ static int open(vf_instance_t *vf, char* args) uninit(vf); return 0; } - + vf->priv->mode=AUTO_ANALYZE; vf->priv->verbose=0; - + while(args && *args) { switch(*args) diff --git a/libmpcodecs/vf_pp.c b/libmpcodecs/vf_pp.c index 1012112660..933688d1e6 100644 --- a/libmpcodecs/vf_pp.c +++ b/libmpcodecs/vf_pp.c @@ -48,7 +48,7 @@ static int config(struct vf_instance* vf, case IMGFMT_411P: flags|= PP_FORMAT_411; break; default: flags|= PP_FORMAT_420; break; } - + if(vf->priv->context) pp_free_context(vf->priv->context); vf->priv->context= pp_get_context(width, height, flags); @@ -90,7 +90,7 @@ static int control(struct vf_instance* vf, int request, void* data){ static void get_image(struct vf_instance* vf, mp_image_t *mpi){ if(vf->priv->pp&0xFFFF) return; // non-local filters enabled - if((mpi->type==MP_IMGTYPE_IPB || vf->priv->pp) && + if((mpi->type==MP_IMGTYPE_IPB || vf->priv->pp) && mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change if(!(mpi->flags&MP_IMGFLAG_ACCEPT_STRIDE) && mpi->imgfmt!=vf->priv->outfmt) return; // colorspace differ @@ -120,7 +120,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ (mpi->width+7)&(~7),(mpi->height+7)&(~7)); vf->dmpi->w=mpi->w; vf->dmpi->h=mpi->h; // display w;h } - + if(vf->priv->pp || !(mpi->flags&MP_IMGFLAG_DIRECT)){ // do the postprocessing! (or copy if no DR) pp_postprocess(mpi->planes ,mpi->stride, @@ -155,7 +155,7 @@ static int open(vf_instance_t *vf, char* args){ char *endptr, *name; int i; int hex_mode=0; - + vf->query_format=query_format; vf->control=control; vf->config=config; @@ -169,7 +169,7 @@ static int open(vf_instance_t *vf, char* args){ // check csp: vf->priv->outfmt=vf_match_csp(&vf->next,fmt_list,IMGFMT_YV12); if(!vf->priv->outfmt) return 0; // no csp match :( - + if(args){ hex_mode= strtol(args, &endptr, 0); if(*endptr){ @@ -192,9 +192,9 @@ static int open(vf_instance_t *vf, char* args){ /* hex mode for compatibility */ for(i=0; i<=PP_QUALITY_MAX; i++){ PPMode *ppMode; - + ppMode= (PPMode*)memalign(8, sizeof(PPMode)); - + ppMode->lumMode= hex_mode; ppMode->chromMode= ((hex_mode&0xFF)>>4) | (hex_mode&0xFFFFFF00); ppMode->maxTmpNoise[0]= 700; @@ -204,12 +204,12 @@ static int open(vf_instance_t *vf, char* args){ ppMode->minAllowedY= 16; ppMode->baseDcDiff= 256/4; ppMode->flatnessThreshold=40; - + vf->priv->ppMode[i]= ppMode; } } #endif - + vf->priv->pp=PP_QUALITY_MAX; return 1; } @@ -224,4 +224,3 @@ const vf_info_t vf_info_pp = { }; //===========================================================================// - diff --git a/libmpcodecs/vf_pp7.c b/libmpcodecs/vf_pp7.c index fed2b83fae..472838ecd6 100644 --- a/libmpcodecs/vf_pp7.c +++ b/libmpcodecs/vf_pp7.c @@ -18,7 +18,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - + #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -227,9 +227,9 @@ static void init_thres2(void){ } static int hardthresh_c(DCTELEM *src, int qp){ - int i; + int i; int a; - + a= src[0] * factor[0]; for(i=1; i<16; i++){ unsigned int threshold1= thres2[qp][i]; @@ -243,9 +243,9 @@ static int hardthresh_c(DCTELEM *src, int qp){ } static int mediumthresh_c(DCTELEM *src, int qp){ - int i; + int i; int a; - + a= src[0] * factor[0]; for(i=1; i<16; i++){ unsigned int threshold1= thres2[qp][i]; @@ -264,9 +264,9 @@ static int mediumthresh_c(DCTELEM *src, int qp){ } static int softthresh_c(DCTELEM *src, int qp){ - int i; + int i; int a; - + a= src[0] * factor[0]; for(i=1; i<16; i++){ unsigned int threshold1= thres2[qp][i]; @@ -293,7 +293,7 @@ static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stri for(y=0; y<height; y++){ int index= 8 + 8*stride + y*stride; fast_memcpy(p_src + index, src + y*src_stride, width); - for(x=0; x<8; x++){ + for(x=0; x<8; x++){ p_src[index - x - 1]= p_src[index + x ]; p_src[index + width + x ]= p_src[index + width - x - 1]; } @@ -309,14 +309,14 @@ static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stri const int index= x + y*stride + (8-3)*(1+stride) + 8; //FIXME silly offset uint8_t *src = p_src + index; DCTELEM *tp= temp+4*x; - + dctA_c(tp+4*8, src, stride); - } + } for(x=0; x<width; ){ const int qps= 3 + is_luma; int qp; int end= XMIN(x+8, width); - + if(p->qp) qp= p->qp; else{ @@ -328,12 +328,12 @@ static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stri uint8_t *src = p_src + index; DCTELEM *tp= temp+4*x; int v; - + if((x&3)==0) dctA_c(tp+4*8, src, stride); - + dctB(block, tp); - + v= requantize(block, qp); v= (v + dither[y&7][x&7])>>6; if((unsigned)v > 255) @@ -351,7 +351,7 @@ static int config(struct vf_instance* vf, vf->priv->temp_stride= (width+16+15)&(~15); vf->priv->src = memalign(8, vf->priv->temp_stride*(h+8)*sizeof(uint8_t)); - + return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } @@ -412,7 +412,7 @@ static void uninit(struct vf_instance* vf){ if(vf->priv->src) free(vf->priv->src); vf->priv->src= NULL; - + free(vf->priv); vf->priv=NULL; } @@ -449,14 +449,14 @@ static int open(vf_instance_t *vf, char* args){ vf->control= control; vf->priv=malloc(sizeof(struct vf_priv_s)); memset(vf->priv, 0, sizeof(struct vf_priv_s)); - + if (args) sscanf(args, "%d:%d", &vf->priv->qp, &vf->priv->mode); if(vf->priv->qp < 0) vf->priv->qp = 0; init_thres2(); - + switch(vf->priv->mode){ case 0: requantize= hardthresh_c; break; case 1: requantize= softthresh_c; break; @@ -477,7 +477,7 @@ static int open(vf_instance_t *vf, char* args){ } } #endif - + return 1; } diff --git a/libmpcodecs/vf_pullup.c b/libmpcodecs/vf_pullup.c index faf195b613..efd5a56d80 100644 --- a/libmpcodecs/vf_pullup.c +++ b/libmpcodecs/vf_pullup.c @@ -51,7 +51,7 @@ static void init_pullup(struct vf_instance* vf, mp_image_t *mpi) if (gCpuCaps.has3DNowExt) c->cpu |= PULLUP_CPU_3DNOWEXT; if (gCpuCaps.hasSSE) c->cpu |= PULLUP_CPU_SSE; if (gCpuCaps.hasSSE2) c->cpu |= PULLUP_CPU_SSE2; - + pullup_init_context(c); vf->priv->init = 1; @@ -64,7 +64,7 @@ static void get_image(struct vf_instance* vf, mp_image_t *mpi) { struct pullup_context *c = vf->priv->ctx; struct pullup_buffer *b; - + if (mpi->type == MP_IMGTYPE_STATIC) return; if (!vf->priv->init) init_pullup(vf, mpi); @@ -73,7 +73,7 @@ static void get_image(struct vf_instance* vf, mp_image_t *mpi) if (!b) return; /* shouldn't happen... */ mpi->priv = b; - + mpi->planes[0] = b->planes[0]; mpi->planes[1] = b->planes[1]; mpi->planes[2] = b->planes[2]; @@ -95,9 +95,9 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts) int ret; int p; int i; - + if (!vf->priv->init) init_pullup(vf, mpi); - + if (mpi->flags & MP_IMGFLAG_DIRECT) { b = mpi->priv; mpi->priv = 0; @@ -221,11 +221,11 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts) dmpi->planes[0] = f->buffer->planes[0]; dmpi->planes[1] = f->buffer->planes[1]; dmpi->planes[2] = f->buffer->planes[2]; - + dmpi->stride[0] = c->stride[0]; dmpi->stride[1] = c->stride[1]; dmpi->stride[2] = c->stride[2]; - + if (mpi->qscale) { dmpi->qscale = vf->priv->qbuf; dmpi->qstride = mpi->qstride; @@ -294,5 +294,3 @@ const vf_info_t vf_info_pullup = { open, NULL }; - - diff --git a/libmpcodecs/vf_qp.c b/libmpcodecs/vf_qp.c index a06bc05e31..ec0646265f 100644 --- a/libmpcodecs/vf_qp.c +++ b/libmpcodecs/vf_qp.c @@ -50,7 +50,7 @@ static int config(struct vf_instance* vf, vf->priv->qp_stride= (width+15)>>4; vf->priv->qp= av_malloc(vf->priv->qp_stride*h*sizeof(int8_t)); - + for(i=-129; i<128; i++){ double const_values[]={ M_PI, @@ -105,7 +105,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ } dmpi= vf->dmpi; - + if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, dmpi->stride[0], mpi->stride[0]); if(mpi->flags&MP_IMGFLAG_PLANAR){ @@ -114,13 +114,13 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ } } vf_clone_mpi_attributes(dmpi, mpi); - + dmpi->qscale = vf->priv->qp; dmpi->qstride= vf->priv->qp_stride; if(mpi->qscale){ for(y=0; y<((dmpi->h+15)>>4); y++){ for(x=0; x<vf->priv->qp_stride; x++){ - dmpi->qscale[x + dmpi->qstride*y]= + dmpi->qscale[x + dmpi->qstride*y]= vf->priv->lut[ 129 + ((int8_t)mpi->qscale[x + mpi->qstride*y]) ]; } } @@ -141,7 +141,7 @@ static void uninit(struct vf_instance* vf){ if(vf->priv->qp) av_free(vf->priv->qp); vf->priv->qp= NULL; - + av_free(vf->priv); vf->priv=NULL; } @@ -154,11 +154,11 @@ static int open(vf_instance_t *vf, char* args){ vf->uninit=uninit; vf->priv=av_malloc(sizeof(struct vf_priv_s)); memset(vf->priv, 0, sizeof(struct vf_priv_s)); - + // avcodec_init(); if (args) strncpy(vf->priv->eq, args, 199); - + return 1; } diff --git a/libmpcodecs/vf_rectangle.c b/libmpcodecs/vf_rectangle.c index 221f9dbe8e..4251540476 100644 --- a/libmpcodecs/vf_rectangle.c +++ b/libmpcodecs/vf_rectangle.c @@ -74,7 +74,7 @@ put_image(struct vf_instance* vf, mp_image_t* mpi, double pts){ mpi->w, mpi->h); memcpy_pic(dmpi->planes[0],mpi->planes[0],mpi->w*bpp, mpi->h, - dmpi->stride[0],mpi->stride[0]); + dmpi->stride[0],mpi->stride[0]); if(mpi->flags&MP_IMGFLAG_PLANAR && mpi->flags&MP_IMGFLAG_YUV){ memcpy_pic(dmpi->planes[1],mpi->planes[1], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, @@ -148,7 +148,7 @@ open(vf_instance_t* vf, char* args) { vf->priv->w = -1; vf->priv->h = -1; if (args) - sscanf(args, "%d:%d:%d:%d", + sscanf(args, "%d:%d:%d:%d", &vf->priv->w, &vf->priv->h, &vf->priv->x, &vf->priv->y); return 1; } diff --git a/libmpcodecs/vf_remove_logo.c b/libmpcodecs/vf_remove_logo.c index 919c17455d..8397ae53cf 100644 --- a/libmpcodecs/vf_remove_logo.c +++ b/libmpcodecs/vf_remove_logo.c @@ -23,7 +23,7 @@ /** * \file vf_remove_logo.c - * + * * \brief Advanced blur-based logo removing filter. * Hello and welcome. This code implements a filter to remove annoying TV @@ -195,7 +195,7 @@ static void calculate_bounding_rectangle(int * posx1, int * posy1, int * posx2, int x; /* Temporary variables to run */ int y; /* through each row or column. */ int start_x; - int start_y; + int start_y; int end_x = filter->width - 1; int end_y = filter->height - 1; int did_we_find_a_logo_pixel = 0; @@ -318,7 +318,7 @@ static void initialize_masks(vf_instance_t * vf) if ((b * b) + (c * c) <= (a * a)) /* Circular 0/1 mask. */ mask[a][b + a][c + a] = 1; else - mask[a][b + a][c + a] = 0; + mask[a][b + a][c + a] = 0; } } } @@ -766,7 +766,7 @@ static void convert_yv12(const vf_instance_t * const vf, const char * const sour */ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ mp_image_t *dmpi; - + dmpi=vf_get_image(vf->next,((vf_priv_s *)vf->priv)->fmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w, mpi->h); diff --git a/libmpcodecs/vf_rgb2bgr.c b/libmpcodecs/vf_rgb2bgr.c index bf00ab7f07..f3cbfaed86 100644 --- a/libmpcodecs/vf_rgb2bgr.c +++ b/libmpcodecs/vf_rgb2bgr.c @@ -33,7 +33,7 @@ static unsigned int getfmt(unsigned int outfmt,int forced){ case IMGFMT_BGR24: return IMGFMT_RGB24; case IMGFMT_BGR32: return IMGFMT_RGB32; } - return 0; + return 0; } static int config(struct vf_instance* vf, diff --git a/libmpcodecs/vf_rgbtest.c b/libmpcodecs/vf_rgbtest.c index c9f134ad6a..4910e703cc 100644 --- a/libmpcodecs/vf_rgbtest.c +++ b/libmpcodecs/vf_rgbtest.c @@ -31,7 +31,7 @@ static unsigned int getfmt(unsigned int outfmt){ case IMGFMT_ABGR: return outfmt; } - return 0; + return 0; } static void put_pixel(uint8_t *buf, int x, int y, int stride, int r, int g, int b, int fmt){ @@ -44,7 +44,7 @@ static void put_pixel(uint8_t *buf, int x, int y, int stride, int r, int g, int break; case IMGFMT_RGB16: ((uint16_t*)(buf + y*stride))[x]= ((b>>3)<<11) | ((g>>2)<<5) | (r>>3); break; - case IMGFMT_RGB24: + case IMGFMT_RGB24: buf[3*x + y*stride + 0]= r; buf[3*x + y*stride + 1]= g; buf[3*x + y*stride + 2]= b; @@ -102,11 +102,11 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ for(x=0; x<w; x++){ int c= 256*x/w; int r=0,g=0,b=0; - + if(3*y<h) r=c; else if(3*y<2*h) g=c; else b=c; - + put_pixel(dmpi->planes[0], x, y, dmpi->stride[0], r, g, b, vf->priv->fmt); } } diff --git a/libmpcodecs/vf_rotate.c b/libmpcodecs/vf_rotate.c index 24015d250b..33b8392d20 100644 --- a/libmpcodecs/vf_rotate.c +++ b/libmpcodecs/vf_rotate.c @@ -87,10 +87,10 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ } else { rotate(dmpi->planes[0],mpi->planes[0], dmpi->stride[0],mpi->stride[0], - dmpi->w,dmpi->h,dmpi->bpp>>3,vf->priv->direction); + dmpi->w,dmpi->h,dmpi->bpp>>3,vf->priv->direction); dmpi->planes[1] = mpi->planes[1]; // passthrough rgb8 palette } - + return vf_next_put_image(vf,dmpi, pts); } diff --git a/libmpcodecs/vf_sab.c b/libmpcodecs/vf_sab.c index be1b8db515..839392d9e0 100644 --- a/libmpcodecs/vf_sab.c +++ b/libmpcodecs/vf_sab.c @@ -103,16 +103,16 @@ static int allocStuff(FilterParam *f, int width, int height){ swsF.chrH= swsF.chrV= NULL; f->preFilterContext= sws_getContext( width, height, PIX_FMT_GRAY8, width, height, PIX_FMT_GRAY8, get_sws_cpuflags()|SWS_POINT, &swsF, NULL, NULL); - + sws_freeVec(vec); vec = sws_getGaussianVec(f->strength, 5.0); for(i=0; i<512; i++){ double d; int index= i-256 + vec->length/2; - + if(index<0 || index>=vec->length) d= 0.0; else d= vec->coeff[index]; - + f->colorDiffCoeff[i]= (int)(d/vec->coeff[vec->length/2]*(1<<12) + 0.5); } sws_freeVec(vec); @@ -124,25 +124,25 @@ static int allocStuff(FilterParam *f, int width, int height){ for(y=0; y<vec->length; y++){ for(x=0; x<vec->length; x++){ double d= vec->coeff[x] * vec->coeff[y]; - + f->distCoeff[x + y*f->distStride]= (int)(d*(1<<10) + 0.5); // if(y==vec->length/2) // printf("%6d ", f->distCoeff[x + y*f->distStride]); } } sws_freeVec(vec); - + return 0; } static int config(struct vf_instance* vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt){ - + int sw, sh; //__asm__ volatile("emms\n\t"); allocStuff(&vf->priv->luma, width, height); - + getSubSampleFactors(&sw, &sh, outfmt); allocStuff(&vf->priv->chroma, width>>sw, height>>sh); @@ -152,10 +152,10 @@ static int config(struct vf_instance* vf, static void freeBuffers(FilterParam *f){ if(f->preFilterContext) sws_freeContext(f->preFilterContext); f->preFilterContext=NULL; - + if(f->preFilterBuf) free(f->preFilterBuf); f->preFilterBuf=NULL; - + if(f->distCoeff) free(f->distCoeff); f->distCoeff=NULL; } @@ -181,7 +181,7 @@ static inline void blur(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, // f.preFilterContext->swScale(f.preFilterContext, srcArray, srcStrideArray, 0, h, dstArray, dstStrideArray); sws_scale(f.preFilterContext, srcArray, srcStrideArray, 0, h, dstArray, dstStrideArray); - + for(y=0; y<h; y++){ for(x=0; x<w; x++){ int sum=0; @@ -247,11 +247,11 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ mpi->w,mpi->h); assert(mpi->flags&MP_IMGFLAG_PLANAR); - + blur(dmpi->planes[0], mpi->planes[0], mpi->w,mpi->h, dmpi->stride[0], mpi->stride[0], &vf->priv->luma); blur(dmpi->planes[1], mpi->planes[1], cw , ch , dmpi->stride[1], mpi->stride[1], &vf->priv->chroma); blur(dmpi->planes[2], mpi->planes[2], cw , ch , dmpi->stride[2], mpi->stride[2], &vf->priv->chroma); - + return vf_next_put_image(vf,dmpi, pts); } @@ -284,7 +284,7 @@ static int open(vf_instance_t *vf, char* args){ memset(vf->priv, 0, sizeof(struct vf_priv_s)); if(args==NULL) return 0; - + e=sscanf(args, "%f:%f:%f:%f:%f:%f", &vf->priv->luma.radius, &vf->priv->luma.preFilterRadius, @@ -295,7 +295,7 @@ static int open(vf_instance_t *vf, char* args){ ); vf->priv->luma.quality = vf->priv->chroma.quality= 3.0; - + if(e==3){ vf->priv->chroma.radius= vf->priv->luma.radius; vf->priv->chroma.preFilterRadius = vf->priv->luma.preFilterRadius; @@ -305,7 +305,7 @@ static int open(vf_instance_t *vf, char* args){ // if(vf->priv->luma.radius < 0) return 0; // if(vf->priv->chroma.radius < 0) return 0; - + return 1; } diff --git a/libmpcodecs/vf_scale.c b/libmpcodecs/vf_scale.c index b453114475..f1388fb1b0 100644 --- a/libmpcodecs/vf_scale.c +++ b/libmpcodecs/vf_scale.c @@ -94,13 +94,13 @@ static unsigned int find_best_out(vf_instance_t *vf){ ret= vf_next_query_format(vf, outfmt_list[i]); vf->priv->query_format_cache[i]= ret+1; } - + mp_msg(MSGT_VFILTER,MSGL_DBG2,"scale: query(%s) -> %d\n",vo_format_name(format),ret&3); if(ret&VFCAP_CSP_SUPPORTED_BY_HW){ best=format; // no conversion -> bingo! break; - } - if(ret&VFCAP_CSP_SUPPORTED && !best) + } + if(ret&VFCAP_CSP_SUPPORTED && !best) best=format; // best with conversion } return best; @@ -117,7 +117,7 @@ static int config(struct vf_instance* vf, int i; SwsFilter *srcFilter, *dstFilter; enum PixelFormat dfmt, sfmt; - + if(!best){ mp_msg(MSGT_VFILTER,MSGL_WARN,"SwScale: no supported outfmt found :(\n"); return 0; @@ -125,15 +125,15 @@ static int config(struct vf_instance* vf, sfmt = imgfmt2pixfmt(outfmt); if (outfmt == IMGFMT_RGB8 || outfmt == IMGFMT_BGR8) sfmt = PIX_FMT_PAL8; dfmt = imgfmt2pixfmt(best); - + vo_flags=vf->next->query_format(vf->next,best); - + // scaling to dwidth*d_height, if all these TRUE: // - option -zoom // - no other sw/hw up/down scaling avail. // - we're after postproc // - user didn't set w:h - if(!(vo_flags&VFCAP_POSTPROC) && (flags&4) && + if(!(vo_flags&VFCAP_POSTPROC) && (flags&4) && vf->priv->w<0 && vf->priv->h<0){ // -zoom int x=(vo_flags&VFCAP_SWSCALE) ? 0 : 1; if(d_width<width || d_height<height){ @@ -212,7 +212,7 @@ static int config(struct vf_instance* vf, case IMGFMT_UYVY: vf->priv->w = (vf->priv->w + 1) & ~1; } - + mp_msg(MSGT_VFILTER,MSGL_DBG2,"SwScale: scaling %dx%d %s to %dx%d %s \n", width,height,vo_format_name(outfmt), vf->priv->w,vf->priv->h,vo_format_name(best)); @@ -220,7 +220,7 @@ static int config(struct vf_instance* vf, // free old ctx: if(vf->priv->ctx) sws_freeContext(vf->priv->ctx); if(vf->priv->ctx2)sws_freeContext(vf->priv->ctx2); - + // new swscaler: sws_getFlagsAndFilterFromCmdLine(&int_sws_flags, &srcFilter, &dstFilter); int_sws_flags|= vf->priv->v_chr_drop << SWS_SRC_V_CHR_DROP_SHIFT; @@ -269,7 +269,7 @@ static int config(struct vf_instance* vf, vf->priv->palette[4*i+3]=0; } break; } - case IMGFMT_BGR4: + case IMGFMT_BGR4: case IMGFMT_BG4B: { vf->priv->palette=malloc(4*16); for(i=0; i<16; i++){ @@ -279,7 +279,7 @@ static int config(struct vf_instance* vf, vf->priv->palette[4*i+3]=0; } break; } - case IMGFMT_RGB4: + case IMGFMT_RGB4: case IMGFMT_RG4B: { vf->priv->palette=malloc(4*16); for(i=0; i<16; i++){ @@ -345,7 +345,7 @@ static void scale(struct SwsContext *sws1, struct SwsContext *sws2, uint8_t *src sws_scale_ordered(sws2, src2, src_stride2, y>>1, h>>1, dst2, dst_stride2); }else{ sws_scale_ordered(sws1, src2, src_stride, y, h, dst, dst_stride); - } + } } static void draw_slice(struct vf_instance* vf, @@ -364,14 +364,14 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ // printf("vf_scale::put_image(): processing whole frame! dmpi=%p flag=%d\n", // dmpi, (mpi->flags&MP_IMGFLAG_DRAW_CALLBACK)); - + if(!(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK && dmpi)){ - + // hope we'll get DR buffer: dmpi=vf_get_image(vf->next,vf->priv->fmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE, vf->priv->w, vf->priv->h); - + scale(vf->priv->ctx, vf->priv->ctx, mpi->planes,mpi->stride,0,mpi->h,dmpi->planes,dmpi->stride, vf->priv->interlaced); } @@ -382,7 +382,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ } if(vf->priv->palette) dmpi->planes[1]=vf->priv->palette; // export palette! - + return vf_next_put_image(vf,dmpi, pts); } @@ -441,7 +441,7 @@ static int control(struct vf_instance* vf, int request, void* data){ default: break; } - + return vf_next_control(vf,request,data); } @@ -462,17 +462,17 @@ static int query_format(struct vf_instance* vf, unsigned int fmt){ case IMGFMT_BGR15: case IMGFMT_RGB32: case IMGFMT_RGB24: - case IMGFMT_Y800: - case IMGFMT_Y8: - case IMGFMT_YVU9: - case IMGFMT_IF09: - case IMGFMT_444P: - case IMGFMT_422P: - case IMGFMT_411P: - case IMGFMT_BGR8: - case IMGFMT_RGB8: - case IMGFMT_BG4B: - case IMGFMT_RG4B: + case IMGFMT_Y800: + case IMGFMT_Y8: + case IMGFMT_YVU9: + case IMGFMT_IF09: + case IMGFMT_444P: + case IMGFMT_422P: + case IMGFMT_411P: + case IMGFMT_BGR8: + case IMGFMT_RGB8: + case IMGFMT_BG4B: + case IMGFMT_RG4B: { unsigned int best=find_best_out(vf); int flags; @@ -525,7 +525,7 @@ static int open(vf_instance_t *vf, char* args){ mp_msg(MSGT_VFILTER,MSGL_V,"SwScale params: %d x %d (-1=no scaling)\n", vf->priv->w, vf->priv->h); - + return 1; } @@ -543,7 +543,7 @@ float sws_chr_sharpen= 0.0; float sws_lum_sharpen= 0.0; int get_sws_cpuflags(void){ - return + return (gCpuCaps.hasMMX ? SWS_CPU_CAPS_MMX : 0) | (gCpuCaps.hasMMX2 ? SWS_CPU_CAPS_MMX2 : 0) | (gCpuCaps.has3DNow ? SWS_CPU_CAPS_3DNOW : 0) @@ -572,7 +572,7 @@ void sws_getFlagsAndFilterFromCmdLine(int *flags, SwsFilter **srcFilterParam, Sw sws_lum_gblur, sws_chr_gblur, sws_lum_sharpen, sws_chr_sharpen, sws_chr_hshift, sws_chr_vshift, verbose>1); - + switch(sws_flags) { case 0: *flags|= SWS_FAST_BILINEAR; break; @@ -588,7 +588,7 @@ void sws_getFlagsAndFilterFromCmdLine(int *flags, SwsFilter **srcFilterParam, Sw case 10:*flags|= SWS_SPLINE; break; default:*flags|= SWS_BILINEAR; break; } - + *srcFilterParam= src_filter; *dstFilterParam= NULL; } diff --git a/libmpcodecs/vf_smartblur.c b/libmpcodecs/vf_smartblur.c index 3f7cd9abe0..92aeece529 100644 --- a/libmpcodecs/vf_smartblur.c +++ b/libmpcodecs/vf_smartblur.c @@ -97,11 +97,11 @@ static int allocStuff(FilterParam *f, int width, int height){ static int config(struct vf_instance* vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt){ - + int sw, sh; allocStuff(&vf->priv->luma, width, height); - + getSubSampleFactors(&sw, &sh, outfmt); allocStuff(&vf->priv->chroma, width>>sw, height>>sh); @@ -132,14 +132,14 @@ static inline void blur(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int dstStrideArray[MP_MAX_PLANES]= {dstStride}; sws_scale(f.filterContext, srcArray, srcStrideArray, 0, h, dstArray, dstStrideArray); - + if(f.threshold > 0){ for(y=0; y<h; y++){ for(x=0; x<w; x++){ const int orig= src[x + y*srcStride]; const int filtered= dst[x + y*dstStride]; const int diff= orig - filtered; - + if(diff > 0){ if(diff > 2*f.threshold){ dst[x + y*dstStride]= orig; @@ -161,7 +161,7 @@ static inline void blur(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, const int orig= src[x + y*srcStride]; const int filtered= dst[x + y*dstStride]; const int diff= orig - filtered; - + if(diff > 0){ if(diff > -2*f.threshold){ }else if(diff > -f.threshold){ @@ -191,11 +191,11 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ mpi->w,mpi->h); assert(mpi->flags&MP_IMGFLAG_PLANAR); - + blur(dmpi->planes[0], mpi->planes[0], mpi->w,mpi->h, dmpi->stride[0], mpi->stride[0], &vf->priv->luma); blur(dmpi->planes[1], mpi->planes[1], cw , ch , dmpi->stride[1], mpi->stride[1], &vf->priv->chroma); blur(dmpi->planes[2], mpi->planes[2], cw , ch , dmpi->stride[2], mpi->stride[2], &vf->priv->chroma); - + return vf_next_put_image(vf,dmpi, pts); } @@ -228,7 +228,7 @@ static int open(vf_instance_t *vf, char* args){ memset(vf->priv, 0, sizeof(struct vf_priv_s)); if(args==NULL) return 0; - + e=sscanf(args, "%f:%f:%d:%f:%f:%d", &vf->priv->luma.radius, &vf->priv->luma.strength, @@ -239,7 +239,7 @@ static int open(vf_instance_t *vf, char* args){ ); vf->priv->luma.quality = vf->priv->chroma.quality= 3.0; - + if(e==3){ vf->priv->chroma.radius= vf->priv->luma.radius; vf->priv->chroma.strength= vf->priv->luma.strength; diff --git a/libmpcodecs/vf_softskip.c b/libmpcodecs/vf_softskip.c index 62fd0ce5ae..4e69b3eb8b 100644 --- a/libmpcodecs/vf_softskip.c +++ b/libmpcodecs/vf_softskip.c @@ -16,7 +16,7 @@ struct vf_priv_s { static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts) { mp_image_t *dmpi; - + if (vf->priv->skipflag) return vf->priv->skipflag = 0; @@ -32,7 +32,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts) dmpi->planes[2] = mpi->planes[2]; dmpi->stride[2] = mpi->stride[2]; } - + return vf_next_put_image(vf, dmpi, pts); } @@ -82,5 +82,3 @@ const vf_info_t vf_info_softskip = { open, NULL }; - - diff --git a/libmpcodecs/vf_spp.c b/libmpcodecs/vf_spp.c index 01a3d87bdf..73c9e54ee6 100644 --- a/libmpcodecs/vf_spp.c +++ b/libmpcodecs/vf_spp.c @@ -20,12 +20,12 @@ /* * This implementation is based on an algorithm described in - * "Aria Nosratinia Embedded Post-Processing for + * "Aria Nosratinia Embedded Post-Processing for * Enhancement of Compressed Images (1999)" * (http://citeseer.nj.nec.com/nosratinia99embedded.html) */ - + #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -69,23 +69,23 @@ static const uint8_t offset[127][2]= { {0,0}, {0,0}, {4,4}, {0,0}, {2,2}, {6,4}, {4,6}, -{0,0}, {5,1}, {2,2}, {7,3}, {4,4}, {1,5}, {6,6}, {3,7}, - -{0,0}, {4,0}, {1,1}, {5,1}, {3,2}, {7,2}, {2,3}, {6,3}, -{0,4}, {4,4}, {1,5}, {5,5}, {3,6}, {7,6}, {2,7}, {6,7}, - -{0,0}, {0,2}, {0,4}, {0,6}, {1,1}, {1,3}, {1,5}, {1,7}, -{2,0}, {2,2}, {2,4}, {2,6}, {3,1}, {3,3}, {3,5}, {3,7}, -{4,0}, {4,2}, {4,4}, {4,6}, {5,1}, {5,3}, {5,5}, {5,7}, -{6,0}, {6,2}, {6,4}, {6,6}, {7,1}, {7,3}, {7,5}, {7,7}, - -{0,0}, {4,4}, {0,4}, {4,0}, {2,2}, {6,6}, {2,6}, {6,2}, -{0,2}, {4,6}, {0,6}, {4,2}, {2,0}, {6,4}, {2,4}, {6,0}, -{1,1}, {5,5}, {1,5}, {5,1}, {3,3}, {7,7}, {3,7}, {7,3}, -{1,3}, {5,7}, {1,7}, {5,3}, {3,1}, {7,5}, {3,5}, {7,1}, -{0,1}, {4,5}, {0,5}, {4,1}, {2,3}, {6,7}, {2,7}, {6,3}, -{0,3}, {4,7}, {0,7}, {4,3}, {2,1}, {6,5}, {2,5}, {6,1}, -{1,0}, {5,4}, {1,4}, {5,0}, {3,2}, {7,6}, {3,6}, {7,2}, +{0,0}, {5,1}, {2,2}, {7,3}, {4,4}, {1,5}, {6,6}, {3,7}, + +{0,0}, {4,0}, {1,1}, {5,1}, {3,2}, {7,2}, {2,3}, {6,3}, +{0,4}, {4,4}, {1,5}, {5,5}, {3,6}, {7,6}, {2,7}, {6,7}, + +{0,0}, {0,2}, {0,4}, {0,6}, {1,1}, {1,3}, {1,5}, {1,7}, +{2,0}, {2,2}, {2,4}, {2,6}, {3,1}, {3,3}, {3,5}, {3,7}, +{4,0}, {4,2}, {4,4}, {4,6}, {5,1}, {5,3}, {5,5}, {5,7}, +{6,0}, {6,2}, {6,4}, {6,6}, {7,1}, {7,3}, {7,5}, {7,7}, + +{0,0}, {4,4}, {0,4}, {4,0}, {2,2}, {6,6}, {2,6}, {6,2}, +{0,2}, {4,6}, {0,6}, {4,2}, {2,0}, {6,4}, {2,4}, {6,0}, +{1,1}, {5,5}, {1,5}, {5,1}, {3,3}, {7,7}, {3,7}, {7,3}, +{1,3}, {5,7}, {1,7}, {5,3}, {3,1}, {7,5}, {3,5}, {7,1}, +{0,1}, {4,5}, {0,5}, {4,1}, {2,3}, {6,7}, {2,7}, {6,3}, +{0,3}, {4,7}, {0,7}, {4,3}, {2,1}, {6,5}, {2,5}, {6,1}, +{1,0}, {5,4}, {1,4}, {5,0}, {3,2}, {7,6}, {3,6}, {7,2}, {1,2}, {5,6}, {1,6}, {5,2}, {3,0}, {7,4}, {3,4}, {7,0}, }; @@ -105,13 +105,13 @@ struct vf_priv_s { #define SHIFT 22 static void hardthresh_c(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *permutation){ - int i; + int i; int bias= 0; //FIXME unsigned int threshold1, threshold2; - + threshold1= qp*((1<<4) - bias) - 1; threshold2= (threshold1<<1); - + memset(dst, 0, 64*sizeof(DCTELEM)); dst[0]= (src[0] + 4)>>3; @@ -125,13 +125,13 @@ static void hardthresh_c(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *perm } static void softthresh_c(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *permutation){ - int i; + int i; int bias= 0; //FIXME unsigned int threshold1, threshold2; - + threshold1= qp*((1<<4) - bias) - 1; threshold2= (threshold1<<1); - + memset(dst, 0, 64*sizeof(DCTELEM)); dst[0]= (src[0] + 4)>>3; @@ -151,9 +151,9 @@ static void softthresh_c(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *perm static void hardthresh_mmx(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *permutation){ int bias= 0; //FIXME unsigned int threshold1; - + threshold1= qp*((1<<4) - bias) - 1; - + __asm__ volatile( #define REQUANT_CORE(dst0, dst1, dst2, dst3, src0, src1, src2, src3) \ "movq " #src0 ", %%mm0 \n\t"\ @@ -197,7 +197,7 @@ static void hardthresh_mmx(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *pe "movq %%mm7, " #dst1 " \n\t"\ "movq %%mm3, " #dst2 " \n\t"\ "movq %%mm1, " #dst3 " \n\t" - + "movd %2, %%mm4 \n\t" "movd %3, %%mm5 \n\t" "movd %4, %%mm6 \n\t" @@ -221,7 +221,7 @@ static void softthresh_mmx(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *pe unsigned int threshold1; threshold1= qp*((1<<4) - bias) - 1; - + __asm__ volatile( #undef REQUANT_CORE #define REQUANT_CORE(dst0, dst1, dst2, dst3, src0, src1, src2, src3) \ @@ -275,7 +275,7 @@ static void softthresh_mmx(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *pe "movq %%mm7, " #dst1 " \n\t"\ "movq %%mm3, " #dst2 " \n\t"\ "movq %%mm1, " #dst3 " \n\t" - + "movd %2, %%mm4 \n\t" "movd %3, %%mm5 \n\t" "packssdw %%mm4, %%mm4 \n\t" @@ -295,7 +295,7 @@ static void softthresh_mmx(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *pe static inline void add_block(int16_t *dst, int stride, DCTELEM block[64]){ int y; - + for(y=0; y<8; y++){ *(uint32_t*)&dst[0 + y*stride]+= *(uint32_t*)&block[0 + y*8]; *(uint32_t*)&dst[2 + y*stride]+= *(uint32_t*)&block[2 + y*8]; @@ -385,7 +385,7 @@ static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stri for(y=0; y<height; y++){ int index= 8 + 8*stride + y*stride; fast_memcpy(p->src + index, src + y*src_stride, width); - for(x=0; x<8; x++){ + for(x=0; x<8; x++){ p->src[index - x - 1]= p->src[index + x ]; p->src[index + width + x ]= p->src[index + width - x - 1]; } @@ -401,7 +401,7 @@ static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stri for(x=0; x<width+8; x+=8){ const int qps= 3 + is_luma; int qp; - + if(p->qp) qp= p->qp; else{ @@ -443,7 +443,7 @@ static int config(struct vf_instance* vf, vf->priv->temp_stride= (width+16+15)&(~15); vf->priv->temp= malloc(vf->priv->temp_stride*h*sizeof(int16_t)); vf->priv->src = malloc(vf->priv->temp_stride*h*sizeof(uint8_t)); - + return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } @@ -521,7 +521,7 @@ static void uninit(struct vf_instance* vf){ vf->priv->avctx= NULL; if(vf->priv->non_b_qp) free(vf->priv->non_b_qp); vf->priv->non_b_qp= NULL; - + free(vf->priv); vf->priv=NULL; } @@ -559,7 +559,7 @@ static int control(struct vf_instance* vf, int request, void* data){ static int open(vf_instance_t *vf, char* args){ int log2c=-1; - + vf->config=config; vf->put_image=put_image; vf->get_image=get_image; @@ -568,14 +568,14 @@ static int open(vf_instance_t *vf, char* args){ vf->control= control; vf->priv=malloc(sizeof(struct vf_priv_s)); memset(vf->priv, 0, sizeof(struct vf_priv_s)); - + avcodec_init(); vf->priv->avctx= avcodec_alloc_context(); dsputil_init(&vf->priv->dsp, vf->priv->avctx); - + vf->priv->log2_count= 3; - + if (args) sscanf(args, "%d:%d:%d", &log2c, &vf->priv->qp, &vf->priv->mode); if( log2c >=0 && log2c <=6 ) @@ -599,7 +599,7 @@ static int open(vf_instance_t *vf, char* args){ } } #endif - + return 1; } diff --git a/libmpcodecs/vf_swapuv.c b/libmpcodecs/vf_swapuv.c index 667019c670..5276c752f4 100644 --- a/libmpcodecs/vf_swapuv.c +++ b/libmpcodecs/vf_swapuv.c @@ -33,7 +33,7 @@ //===========================================================================// static void get_image(struct vf_instance* vf, mp_image_t *mpi){ - mp_image_t *dmpi= vf_get_image(vf->next, mpi->imgfmt, + mp_image_t *dmpi= vf_get_image(vf->next, mpi->imgfmt, mpi->type, mpi->flags, mpi->w, mpi->h); mpi->planes[0]=dmpi->planes[0]; @@ -50,7 +50,7 @@ static void get_image(struct vf_instance* vf, mp_image_t *mpi){ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ mp_image_t *dmpi; - + if(mpi->flags&MP_IMGFLAG_DIRECT){ dmpi=(mp_image_t*)mpi->priv; } else { @@ -64,7 +64,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ dmpi->stride[2]=mpi->stride[1]; dmpi->width=mpi->width; } - + vf_clone_mpi_attributes(dmpi, mpi); return vf_next_put_image(vf,dmpi, pts); diff --git a/libmpcodecs/vf_telecine.c b/libmpcodecs/vf_telecine.c index b524f395b6..a30ab8121b 100644 --- a/libmpcodecs/vf_telecine.c +++ b/libmpcodecs/vf_telecine.c @@ -21,7 +21,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts) int ret; vf->priv->frame = (vf->priv->frame+1)%4; - + dmpi = vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PRESERVE, mpi->width, mpi->height); @@ -135,5 +135,3 @@ const vf_info_t vf_info_telecine = { open, NULL }; - - diff --git a/libmpcodecs/vf_tfields.c b/libmpcodecs/vf_tfields.c index 3203054d85..5ec60e3cde 100644 --- a/libmpcodecs/vf_tfields.c +++ b/libmpcodecs/vf_tfields.c @@ -206,7 +206,7 @@ static void qpel_4tap_MMX(unsigned char *d, unsigned char *s, int w, int h, int "pmullw %%mm6, %%mm3 \n\t" "movq (%%"REG_S",%%"REG_a",2), %%mm2 \n\t" "psubusw %%mm3, %%mm1 \n\t" - "punpcklbw %%mm0, %%mm2 \n\t" + "punpcklbw %%mm0, %%mm2 \n\t" "pmullw %%mm7, %%mm2 \n\t" "psubusw %%mm2, %%mm1 \n\t" "psrlw $7, %%mm1 \n\t" @@ -223,12 +223,12 @@ static void qpel_4tap_MMX(unsigned char *d, unsigned char *s, int w, int h, int "pmullw %%mm6, %%mm3 \n\t" "psubusw %%mm3, %%mm2 \n\t" "movq (%%"REG_S",%%"REG_a",2), %%mm3 \n\t" - "punpckhbw %%mm0, %%mm3 \n\t" + "punpckhbw %%mm0, %%mm3 \n\t" "add $8, %%"REG_S" \n\t" "pmullw %%mm7, %%mm3 \n\t" "psubusw %%mm3, %%mm2 \n\t" "psrlw $7, %%mm2 \n\t" - + "packuswb %%mm2, %%mm1 \n\t" "movq %%mm1, (%%"REG_D") \n\t" "add $8, %%"REG_D" \n\t" @@ -501,5 +501,3 @@ const vf_info_t vf_info_tfields = { open, NULL }; - - diff --git a/libmpcodecs/vf_tinterlace.c b/libmpcodecs/vf_tinterlace.c index 0658b2b322..fa69986856 100644 --- a/libmpcodecs/vf_tinterlace.c +++ b/libmpcodecs/vf_tinterlace.c @@ -124,13 +124,13 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts) // rate and preserving image height. dmpi = vf->priv->dmpi; - + // @@ Need help: Should I set dmpi->fields to indicate // that the (new) frame will be interlaced!? E.g. ... // dmpi->fields |= MP_IMGFIELD_INTERLACED; // dmpi->fields |= MP_IMGFIELD_TOP_FIRST; // etc. - + if (dmpi == NULL) { dmpi = vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE | @@ -152,16 +152,16 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts) } else { vf->priv->dmpi = NULL; - my_memcpy_pic(dmpi->planes[0]+dmpi->stride[0], + my_memcpy_pic(dmpi->planes[0]+dmpi->stride[0], mpi->planes[0]+mpi->stride[0], - mpi->w, mpi->h/2, + mpi->w, mpi->h/2, dmpi->stride[0]*2, mpi->stride[0]*2); if (mpi->flags & MP_IMGFLAG_PLANAR) { - my_memcpy_pic(dmpi->planes[1]+dmpi->stride[1], + my_memcpy_pic(dmpi->planes[1]+dmpi->stride[1], mpi->planes[1]+mpi->stride[1], mpi->chroma_width, mpi->chroma_height/2, dmpi->stride[1]*2, mpi->stride[1]*2); - my_memcpy_pic(dmpi->planes[2]+dmpi->stride[2], + my_memcpy_pic(dmpi->planes[2]+dmpi->stride[2], mpi->planes[2]+mpi->stride[2], mpi->chroma_width, mpi->chroma_height/2, dmpi->stride[2]*2, mpi->stride[2]*2); diff --git a/libmpcodecs/vf_unsharp.c b/libmpcodecs/vf_unsharp.c index d4db10248a..09d276d3d7 100644 --- a/libmpcodecs/vf_unsharp.c +++ b/libmpcodecs/vf_unsharp.c @@ -85,7 +85,7 @@ static void unsharp( uint8_t *dst, uint8_t *src, int dstStride, int srcStride, i if( !fp->amount ) { if( src == dst ) return; - if( dstStride == srcStride ) + if( dstStride == srcStride ) fast_memcpy( dst, src, srcStride*height ); else for( y=0; y<height; y++, dst+=dstStride, src+=srcStride ) @@ -112,7 +112,7 @@ static void unsharp( uint8_t *dst, uint8_t *src, int dstStride, int srcStride, i if( x>=stepsX && y>=stepsY ) { uint8_t* srx = src - stepsY*srcStride + x - stepsX; uint8_t* dsx = dst - stepsY*dstStride + x - stepsX; - + res = (int32_t)*srx + ( ( ( (int32_t)*srx - (int32_t)((Tmp1+halfscale) >> scalebits) ) * amount ) >> 16 ); *dsx = res>255 ? 255 : res<0 ? 0 : (uint8_t)res; } @@ -160,7 +160,7 @@ static int config( struct vf_instance* vf, //===========================================================================// static void get_image( struct vf_instance* vf, mp_image_t *mpi ) { - if( mpi->flags & MP_IMGFLAG_PRESERVE ) + if( mpi->flags & MP_IMGFLAG_PRESERVE ) return; // don't change if( mpi->imgfmt!=vf->priv->outfmt ) return; // colorspace differ @@ -185,13 +185,13 @@ static int put_image( struct vf_instance* vf, mp_image_t *mpi, double pts) { // no DR, so get a new image! hope we'll get DR buffer: vf->dmpi = vf_get_image( vf->next,vf->priv->outfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w, mpi->h); dmpi= vf->dmpi; - + unsharp( dmpi->planes[0], mpi->planes[0], dmpi->stride[0], mpi->stride[0], mpi->w, mpi->h, &vf->priv->lumaParam ); unsharp( dmpi->planes[1], mpi->planes[1], dmpi->stride[1], mpi->stride[1], mpi->w/2, mpi->h/2, &vf->priv->chromaParam ); unsharp( dmpi->planes[2], mpi->planes[2], dmpi->stride[2], mpi->stride[2], mpi->w/2, mpi->h/2, &vf->priv->chromaParam ); - + vf_clone_mpi_attributes(dmpi, mpi); - + #if HAVE_MMX if(gCpuCaps.hasMMX) __asm__ volatile ("emms\n\t"); @@ -200,7 +200,7 @@ static int put_image( struct vf_instance* vf, mp_image_t *mpi, double pts) { if(gCpuCaps.hasMMX2) __asm__ volatile ("sfence\n\t"); #endif - + return vf_next_put_image( vf, dmpi, pts); } @@ -284,17 +284,17 @@ static int open( vf_instance_t *vf, char* args ) { if( args2 ) parse( &vf->priv->lumaParam, args2 ); else { - vf->priv->lumaParam.amount = - vf->priv->lumaParam.msizeX = + vf->priv->lumaParam.amount = + vf->priv->lumaParam.msizeX = vf->priv->lumaParam.msizeY = 0; } args2 = strchr( args, 'c' ); - if( args2 ) + if( args2 ) parse( &vf->priv->chromaParam, args2 ); else { - vf->priv->chromaParam.amount = - vf->priv->chromaParam.msizeX = + vf->priv->chromaParam.amount = + vf->priv->chromaParam.msizeX = vf->priv->chromaParam.msizeY = 0; } diff --git a/libmpcodecs/vf_uspp.c b/libmpcodecs/vf_uspp.c index 863b3921fc..db67ec775f 100644 --- a/libmpcodecs/vf_uspp.c +++ b/libmpcodecs/vf_uspp.c @@ -54,46 +54,46 @@ static const uint8_t __attribute__((aligned(8))) dither[8][8]={ }; static const uint8_t offset[511][2]= { -{ 0, 0}, -{ 0, 0}, { 8, 8}, -{ 0, 0}, { 4, 4}, {12, 8}, { 8,12}, -{ 0, 0}, {10, 2}, { 4, 4}, {14, 6}, { 8, 8}, { 2,10}, {12,12}, { 6,14}, +{ 0, 0}, +{ 0, 0}, { 8, 8}, +{ 0, 0}, { 4, 4}, {12, 8}, { 8,12}, +{ 0, 0}, {10, 2}, { 4, 4}, {14, 6}, { 8, 8}, { 2,10}, {12,12}, { 6,14}, -{ 0, 0}, {10, 2}, { 4, 4}, {14, 6}, { 8, 8}, { 2,10}, {12,12}, { 6,14}, +{ 0, 0}, {10, 2}, { 4, 4}, {14, 6}, { 8, 8}, { 2,10}, {12,12}, { 6,14}, { 5, 1}, {15, 3}, { 9, 5}, { 3, 7}, {13, 9}, { 7,11}, { 1,13}, {11,15}, -{ 0, 0}, { 8, 0}, { 0, 8}, { 8, 8}, { 5, 1}, {13, 1}, { 5, 9}, {13, 9}, -{ 2, 2}, {10, 2}, { 2,10}, {10,10}, { 7, 3}, {15, 3}, { 7,11}, {15,11}, -{ 4, 4}, {12, 4}, { 4,12}, {12,12}, { 1, 5}, { 9, 5}, { 1,13}, { 9,13}, -{ 6, 6}, {14, 6}, { 6,14}, {14,14}, { 3, 7}, {11, 7}, { 3,15}, {11,15}, - -{ 0, 0}, { 8, 0}, { 0, 8}, { 8, 8}, { 4, 0}, {12, 0}, { 4, 8}, {12, 8}, -{ 1, 1}, { 9, 1}, { 1, 9}, { 9, 9}, { 5, 1}, {13, 1}, { 5, 9}, {13, 9}, -{ 3, 2}, {11, 2}, { 3,10}, {11,10}, { 7, 2}, {15, 2}, { 7,10}, {15,10}, -{ 2, 3}, {10, 3}, { 2,11}, {10,11}, { 6, 3}, {14, 3}, { 6,11}, {14,11}, -{ 0, 4}, { 8, 4}, { 0,12}, { 8,12}, { 4, 4}, {12, 4}, { 4,12}, {12,12}, -{ 1, 5}, { 9, 5}, { 1,13}, { 9,13}, { 5, 5}, {13, 5}, { 5,13}, {13,13}, -{ 3, 6}, {11, 6}, { 3,14}, {11,14}, { 7, 6}, {15, 6}, { 7,14}, {15,14}, -{ 2, 7}, {10, 7}, { 2,15}, {10,15}, { 6, 7}, {14, 7}, { 6,15}, {14,15}, - -{ 0, 0}, { 8, 0}, { 0, 8}, { 8, 8}, { 0, 2}, { 8, 2}, { 0,10}, { 8,10}, -{ 0, 4}, { 8, 4}, { 0,12}, { 8,12}, { 0, 6}, { 8, 6}, { 0,14}, { 8,14}, -{ 1, 1}, { 9, 1}, { 1, 9}, { 9, 9}, { 1, 3}, { 9, 3}, { 1,11}, { 9,11}, -{ 1, 5}, { 9, 5}, { 1,13}, { 9,13}, { 1, 7}, { 9, 7}, { 1,15}, { 9,15}, -{ 2, 0}, {10, 0}, { 2, 8}, {10, 8}, { 2, 2}, {10, 2}, { 2,10}, {10,10}, -{ 2, 4}, {10, 4}, { 2,12}, {10,12}, { 2, 6}, {10, 6}, { 2,14}, {10,14}, -{ 3, 1}, {11, 1}, { 3, 9}, {11, 9}, { 3, 3}, {11, 3}, { 3,11}, {11,11}, -{ 3, 5}, {11, 5}, { 3,13}, {11,13}, { 3, 7}, {11, 7}, { 3,15}, {11,15}, -{ 4, 0}, {12, 0}, { 4, 8}, {12, 8}, { 4, 2}, {12, 2}, { 4,10}, {12,10}, -{ 4, 4}, {12, 4}, { 4,12}, {12,12}, { 4, 6}, {12, 6}, { 4,14}, {12,14}, -{ 5, 1}, {13, 1}, { 5, 9}, {13, 9}, { 5, 3}, {13, 3}, { 5,11}, {13,11}, -{ 5, 5}, {13, 5}, { 5,13}, {13,13}, { 5, 7}, {13, 7}, { 5,15}, {13,15}, -{ 6, 0}, {14, 0}, { 6, 8}, {14, 8}, { 6, 2}, {14, 2}, { 6,10}, {14,10}, -{ 6, 4}, {14, 4}, { 6,12}, {14,12}, { 6, 6}, {14, 6}, { 6,14}, {14,14}, -{ 7, 1}, {15, 1}, { 7, 9}, {15, 9}, { 7, 3}, {15, 3}, { 7,11}, {15,11}, -{ 7, 5}, {15, 5}, { 7,13}, {15,13}, { 7, 7}, {15, 7}, { 7,15}, {15,15}, - -{ 0, 0}, { 8, 0}, { 0, 8}, { 8, 8}, { 4, 4}, {12, 4}, { 4,12}, {12,12}, { 0, 4}, { 8, 4}, { 0,12}, { 8,12}, { 4, 0}, {12, 0}, { 4, 8}, {12, 8}, { 2, 2}, {10, 2}, { 2,10}, {10,10}, { 6, 6}, {14, 6}, { 6,14}, {14,14}, { 2, 6}, {10, 6}, { 2,14}, {10,14}, { 6, 2}, {14, 2}, { 6,10}, {14,10}, { 0, 2}, { 8, 2}, { 0,10}, { 8,10}, { 4, 6}, {12, 6}, { 4,14}, {12,14}, { 0, 6}, { 8, 6}, { 0,14}, { 8,14}, { 4, 2}, {12, 2}, { 4,10}, {12,10}, { 2, 0}, {10, 0}, { 2, 8}, {10, 8}, { 6, 4}, {14, 4}, { 6,12}, {14,12}, { 2, 4}, {10, 4}, { 2,12}, {10,12}, { 6, 0}, {14, 0}, { 6, 8}, {14, 8}, { 1, 1}, { 9, 1}, { 1, 9}, { 9, 9}, { 5, 5}, {13, 5}, { 5,13}, {13,13}, { 1, 5}, { 9, 5}, { 1,13}, { 9,13}, { 5, 1}, {13, 1}, { 5, 9}, {13, 9}, { 3, 3}, {11, 3}, { 3,11}, {11,11}, { 7, 7}, {15, 7}, { 7,15}, {15,15}, { 3, 7}, {11, 7}, { 3,15}, {11,15}, { 7, 3}, {15, 3}, { 7,11}, {15,11}, { 1, 3}, { 9, 3}, { 1,11}, { 9,11}, { 5, 7}, {13, 7}, { 5,15}, {13,15}, { 1, 7}, { 9, 7}, { 1,15}, { 9,15}, { 5, 3}, {13, 3}, { 5,11}, {13,11}, { 3, 1}, {11, 1}, { 3, 9}, {11, 9}, { 7, 5}, {15, 5}, { 7,13}, {15,13}, { 3, 5}, {11, 5}, { 3,13}, {11,13}, { 7, 1}, {15, 1}, { 7, 9}, {15, 9}, { 0, 1}, { 8, 1}, { 0, 9}, { 8, 9}, { 4, 5}, {12, 5}, { 4,13}, {12,13}, { 0, 5}, { 8, 5}, { 0,13}, { 8,13}, { 4, 1}, {12, 1}, { 4, 9}, {12, 9}, { 2, 3}, {10, 3}, { 2,11}, {10,11}, { 6, 7}, {14, 7}, { 6,15}, {14,15}, { 2, 7}, {10, 7}, { 2,15}, {10,15}, { 6, 3}, {14, 3}, { 6,11}, {14,11}, { 0, 3}, { 8, 3}, { 0,11}, { 8,11}, { 4, 7}, {12, 7}, { 4,15}, {12,15}, { 0, 7}, { 8, 7}, { 0,15}, { 8,15}, { 4, 3}, {12, 3}, { 4,11}, {12,11}, { 2, 1}, {10, 1}, { 2, 9}, {10, 9}, { 6, 5}, {14, 5}, { 6,13}, {14,13}, { 2, 5}, {10, 5}, { 2,13}, {10,13}, { 6, 1}, {14, 1}, { 6, 9}, {14, 9}, { 1, 0}, { 9, 0}, { 1, 8}, { 9, 8}, { 5, 4}, {13, 4}, { 5,12}, {13,12}, { 1, 4}, { 9, 4}, { 1,12}, { 9,12}, { 5, 0}, {13, 0}, { 5, 8}, {13, 8}, { 3, 2}, {11, 2}, { 3,10}, {11,10}, { 7, 6}, {15, 6}, { 7,14}, {15,14}, { 3, 6}, {11, 6}, { 3,14}, {11,14}, { 7, 2}, {15, 2}, { 7,10}, {15,10}, { 1, 2}, { 9, 2}, { 1,10}, { 9,10}, { 5, 6}, {13, 6}, { 5,14}, {13,14}, { 1, 6}, { 9, 6}, { 1,14}, { 9,14}, { 5, 2}, {13, 2}, { 5,10}, {13,10}, { 3, 0}, {11, 0}, { 3, 8}, {11, 8}, { 7, 4}, {15, 4}, { 7,12}, {15,12}, { 3, 4}, {11, 4}, { 3,12}, {11,12}, { 7, 0}, {15, 0}, { 7, 8}, {15, 8}, +{ 0, 0}, { 8, 0}, { 0, 8}, { 8, 8}, { 5, 1}, {13, 1}, { 5, 9}, {13, 9}, +{ 2, 2}, {10, 2}, { 2,10}, {10,10}, { 7, 3}, {15, 3}, { 7,11}, {15,11}, +{ 4, 4}, {12, 4}, { 4,12}, {12,12}, { 1, 5}, { 9, 5}, { 1,13}, { 9,13}, +{ 6, 6}, {14, 6}, { 6,14}, {14,14}, { 3, 7}, {11, 7}, { 3,15}, {11,15}, + +{ 0, 0}, { 8, 0}, { 0, 8}, { 8, 8}, { 4, 0}, {12, 0}, { 4, 8}, {12, 8}, +{ 1, 1}, { 9, 1}, { 1, 9}, { 9, 9}, { 5, 1}, {13, 1}, { 5, 9}, {13, 9}, +{ 3, 2}, {11, 2}, { 3,10}, {11,10}, { 7, 2}, {15, 2}, { 7,10}, {15,10}, +{ 2, 3}, {10, 3}, { 2,11}, {10,11}, { 6, 3}, {14, 3}, { 6,11}, {14,11}, +{ 0, 4}, { 8, 4}, { 0,12}, { 8,12}, { 4, 4}, {12, 4}, { 4,12}, {12,12}, +{ 1, 5}, { 9, 5}, { 1,13}, { 9,13}, { 5, 5}, {13, 5}, { 5,13}, {13,13}, +{ 3, 6}, {11, 6}, { 3,14}, {11,14}, { 7, 6}, {15, 6}, { 7,14}, {15,14}, +{ 2, 7}, {10, 7}, { 2,15}, {10,15}, { 6, 7}, {14, 7}, { 6,15}, {14,15}, + +{ 0, 0}, { 8, 0}, { 0, 8}, { 8, 8}, { 0, 2}, { 8, 2}, { 0,10}, { 8,10}, +{ 0, 4}, { 8, 4}, { 0,12}, { 8,12}, { 0, 6}, { 8, 6}, { 0,14}, { 8,14}, +{ 1, 1}, { 9, 1}, { 1, 9}, { 9, 9}, { 1, 3}, { 9, 3}, { 1,11}, { 9,11}, +{ 1, 5}, { 9, 5}, { 1,13}, { 9,13}, { 1, 7}, { 9, 7}, { 1,15}, { 9,15}, +{ 2, 0}, {10, 0}, { 2, 8}, {10, 8}, { 2, 2}, {10, 2}, { 2,10}, {10,10}, +{ 2, 4}, {10, 4}, { 2,12}, {10,12}, { 2, 6}, {10, 6}, { 2,14}, {10,14}, +{ 3, 1}, {11, 1}, { 3, 9}, {11, 9}, { 3, 3}, {11, 3}, { 3,11}, {11,11}, +{ 3, 5}, {11, 5}, { 3,13}, {11,13}, { 3, 7}, {11, 7}, { 3,15}, {11,15}, +{ 4, 0}, {12, 0}, { 4, 8}, {12, 8}, { 4, 2}, {12, 2}, { 4,10}, {12,10}, +{ 4, 4}, {12, 4}, { 4,12}, {12,12}, { 4, 6}, {12, 6}, { 4,14}, {12,14}, +{ 5, 1}, {13, 1}, { 5, 9}, {13, 9}, { 5, 3}, {13, 3}, { 5,11}, {13,11}, +{ 5, 5}, {13, 5}, { 5,13}, {13,13}, { 5, 7}, {13, 7}, { 5,15}, {13,15}, +{ 6, 0}, {14, 0}, { 6, 8}, {14, 8}, { 6, 2}, {14, 2}, { 6,10}, {14,10}, +{ 6, 4}, {14, 4}, { 6,12}, {14,12}, { 6, 6}, {14, 6}, { 6,14}, {14,14}, +{ 7, 1}, {15, 1}, { 7, 9}, {15, 9}, { 7, 3}, {15, 3}, { 7,11}, {15,11}, +{ 7, 5}, {15, 5}, { 7,13}, {15,13}, { 7, 7}, {15, 7}, { 7,15}, {15,15}, + +{ 0, 0}, { 8, 0}, { 0, 8}, { 8, 8}, { 4, 4}, {12, 4}, { 4,12}, {12,12}, { 0, 4}, { 8, 4}, { 0,12}, { 8,12}, { 4, 0}, {12, 0}, { 4, 8}, {12, 8}, { 2, 2}, {10, 2}, { 2,10}, {10,10}, { 6, 6}, {14, 6}, { 6,14}, {14,14}, { 2, 6}, {10, 6}, { 2,14}, {10,14}, { 6, 2}, {14, 2}, { 6,10}, {14,10}, { 0, 2}, { 8, 2}, { 0,10}, { 8,10}, { 4, 6}, {12, 6}, { 4,14}, {12,14}, { 0, 6}, { 8, 6}, { 0,14}, { 8,14}, { 4, 2}, {12, 2}, { 4,10}, {12,10}, { 2, 0}, {10, 0}, { 2, 8}, {10, 8}, { 6, 4}, {14, 4}, { 6,12}, {14,12}, { 2, 4}, {10, 4}, { 2,12}, {10,12}, { 6, 0}, {14, 0}, { 6, 8}, {14, 8}, { 1, 1}, { 9, 1}, { 1, 9}, { 9, 9}, { 5, 5}, {13, 5}, { 5,13}, {13,13}, { 1, 5}, { 9, 5}, { 1,13}, { 9,13}, { 5, 1}, {13, 1}, { 5, 9}, {13, 9}, { 3, 3}, {11, 3}, { 3,11}, {11,11}, { 7, 7}, {15, 7}, { 7,15}, {15,15}, { 3, 7}, {11, 7}, { 3,15}, {11,15}, { 7, 3}, {15, 3}, { 7,11}, {15,11}, { 1, 3}, { 9, 3}, { 1,11}, { 9,11}, { 5, 7}, {13, 7}, { 5,15}, {13,15}, { 1, 7}, { 9, 7}, { 1,15}, { 9,15}, { 5, 3}, {13, 3}, { 5,11}, {13,11}, { 3, 1}, {11, 1}, { 3, 9}, {11, 9}, { 7, 5}, {15, 5}, { 7,13}, {15,13}, { 3, 5}, {11, 5}, { 3,13}, {11,13}, { 7, 1}, {15, 1}, { 7, 9}, {15, 9}, { 0, 1}, { 8, 1}, { 0, 9}, { 8, 9}, { 4, 5}, {12, 5}, { 4,13}, {12,13}, { 0, 5}, { 8, 5}, { 0,13}, { 8,13}, { 4, 1}, {12, 1}, { 4, 9}, {12, 9}, { 2, 3}, {10, 3}, { 2,11}, {10,11}, { 6, 7}, {14, 7}, { 6,15}, {14,15}, { 2, 7}, {10, 7}, { 2,15}, {10,15}, { 6, 3}, {14, 3}, { 6,11}, {14,11}, { 0, 3}, { 8, 3}, { 0,11}, { 8,11}, { 4, 7}, {12, 7}, { 4,15}, {12,15}, { 0, 7}, { 8, 7}, { 0,15}, { 8,15}, { 4, 3}, {12, 3}, { 4,11}, {12,11}, { 2, 1}, {10, 1}, { 2, 9}, {10, 9}, { 6, 5}, {14, 5}, { 6,13}, {14,13}, { 2, 5}, {10, 5}, { 2,13}, {10,13}, { 6, 1}, {14, 1}, { 6, 9}, {14, 9}, { 1, 0}, { 9, 0}, { 1, 8}, { 9, 8}, { 5, 4}, {13, 4}, { 5,12}, {13,12}, { 1, 4}, { 9, 4}, { 1,12}, { 9,12}, { 5, 0}, {13, 0}, { 5, 8}, {13, 8}, { 3, 2}, {11, 2}, { 3,10}, {11,10}, { 7, 6}, {15, 6}, { 7,14}, {15,14}, { 3, 6}, {11, 6}, { 3,14}, {11,14}, { 7, 2}, {15, 2}, { 7,10}, {15,10}, { 1, 2}, { 9, 2}, { 1,10}, { 9,10}, { 5, 6}, {13, 6}, { 5,14}, {13,14}, { 1, 6}, { 9, 6}, { 1,14}, { 9,14}, { 5, 2}, {13, 2}, { 5,10}, {13,10}, { 3, 0}, {11, 0}, { 3, 8}, {11, 8}, { 7, 4}, {15, 4}, { 7,12}, {15,12}, { 3, 4}, {11, 4}, { 3,12}, {11,12}, { 7, 0}, {15, 0}, { 7, 8}, {15, 8}, }; struct vf_priv_s { @@ -146,12 +146,12 @@ static void filter(struct vf_priv_s *p, uint8_t *dst[3], uint8_t *src[3], int ds int stride= p->temp_stride[i]; int block= BLOCK>>is_chroma; - if (!src[i] || !dst[i]) + if (!src[i] || !dst[i]) continue; // HACK avoid crash for Y8 colourspace for(y=0; y<h; y++){ int index= block + block*stride + y*stride; fast_memcpy(p->src[i] + index, src[i] + y*src_stride[i], w); - for(x=0; x<block; x++){ + for(x=0; x<block; x++){ p->src[i][index - x - 1]= p->src[i][index + x ]; p->src[i][index + w + x ]= p->src[i][index + w - x - 1]; } @@ -343,7 +343,7 @@ static int control(struct vf_instance* vf, int request, void* data){ static int open(vf_instance_t *vf, char* args){ int log2c=-1; - + vf->config=config; vf->put_image=put_image; vf->get_image=get_image; @@ -352,12 +352,12 @@ static int open(vf_instance_t *vf, char* args){ vf->control= control; vf->priv=malloc(sizeof(struct vf_priv_s)); memset(vf->priv, 0, sizeof(struct vf_priv_s)); - + avcodec_init(); avcodec_register_all(); - + vf->priv->log2_count= 4; - + if (args) sscanf(args, "%d:%d:%d", &log2c, &vf->priv->qp, &vf->priv->mode); if( log2c >=0 && log2c <=8 ) diff --git a/libmpcodecs/vf_yuvcsp.c b/libmpcodecs/vf_yuvcsp.c index 891bc095df..06cf31ce28 100644 --- a/libmpcodecs/vf_yuvcsp.c +++ b/libmpcodecs/vf_yuvcsp.c @@ -38,7 +38,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->width, mpi->height); - + y_in = mpi->planes[0]; cb_in = mpi->planes[1]; cr_in = mpi->planes[2]; @@ -46,7 +46,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ y_out = vf->dmpi->planes[0]; cb_out = vf->dmpi->planes[1]; cr_out = vf->dmpi->planes[2]; - + for (i = 0; i < mpi->height; i++) for (j = 0; j < mpi->width; j++) y_out[i*vf->dmpi->stride[0]+j] = clamp_y(y_in[i*mpi->stride[0]+j]); @@ -57,7 +57,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ cb_out[i*vf->dmpi->stride[1]+j] = clamp_c(cb_in[i*mpi->stride[1]+j]); cr_out[i*vf->dmpi->stride[2]+j] = clamp_c(cr_in[i*mpi->stride[2]+j]); } - + return vf_next_put_image(vf,vf->dmpi, pts); } diff --git a/libmpcodecs/vf_yuy2.c b/libmpcodecs/vf_yuy2.c index 5f23bf1f94..e19461f387 100644 --- a/libmpcodecs/vf_yuy2.c +++ b/libmpcodecs/vf_yuy2.c @@ -21,12 +21,12 @@ static int config(struct vf_instance* vf, unsigned int flags, unsigned int outfmt){ sws_rgb2rgb_init(get_sws_cpuflags()); - + if(vf_next_query_format(vf,IMGFMT_YUY2)<=0){ mp_tmsg(MSGT_VFILTER, MSGL_WARN, "%s not supported by next filter/vo :(\n", "YUY2"); return 0; } - + return vf_next_config(vf,width,height,d_width,d_height,flags,IMGFMT_YUY2); } @@ -44,9 +44,9 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ else yv12toyuy2(mpi->planes[0],mpi->planes[1],mpi->planes[2], dmpi->planes[0], mpi->w,mpi->h, mpi->stride[0],mpi->stride[1],dmpi->stride[0]); - + vf_clone_mpi_attributes(dmpi, mpi); - + return vf_next_put_image(vf,dmpi, pts); } diff --git a/libmpcodecs/vf_yvu9.c b/libmpcodecs/vf_yvu9.c index 12aa4dad61..19976da5da 100644 --- a/libmpcodecs/vf_yvu9.c +++ b/libmpcodecs/vf_yvu9.c @@ -18,12 +18,12 @@ static int config(struct vf_instance* vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt){ - + if(vf_next_query_format(vf,IMGFMT_YV12)<=0){ mp_tmsg(MSGT_VFILTER, MSGL_WARN, "%s not supported by next filter/vo :(\n", "YVU9"); return 0; } - + return vf_next_config(vf,width,height,d_width,d_height,flags,IMGFMT_YV12); } @@ -56,7 +56,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ } vf_clone_mpi_attributes(dmpi, mpi); - + return vf_next_put_image(vf,dmpi, pts); } diff --git a/libmpcodecs/vf_zrmjpeg.c b/libmpcodecs/vf_zrmjpeg.c index 4e33409585..87c50351d9 100644 --- a/libmpcodecs/vf_zrmjpeg.c +++ b/libmpcodecs/vf_zrmjpeg.c @@ -1066,4 +1066,3 @@ const vf_info_t vf_info_zrmjpeg = { open, NULL }; - diff --git a/libmpcodecs/vqf.h b/libmpcodecs/vqf.h index 118f7ea06f..139b578da7 100644 --- a/libmpcodecs/vqf.h +++ b/libmpcodecs/vqf.h @@ -215,9 +215,9 @@ typedef struct { #ifdef V2PLUS_SUPPORT // TwinVQ FB coding tool control -DllPort void TvqFbCountUsedBits(int nbit); // count number of used bits +DllPort void TvqFbCountUsedBits(int nbit); // count number of used bits DllPort float TvqGetFbCurrentBitrate(void); // query average bitrate for the tool -DllPort int TvqGetFbTotalBits(void); // query total number of used bits +DllPort int TvqGetFbTotalBits(void); // query total number of used bits #endif #ifdef __cplusplus |