[FFmpeg-devel] [PATCH] make SVQ3 parts in h264.c conditional
Diego Biurrun
diego
Wed Jan 7 02:58:40 CET 2009
On Fri, Dec 19, 2008 at 12:06:16PM +0100, Michael Niedermayer wrote:
> On Fri, Dec 19, 2008 at 11:10:57AM +0100, Diego Biurrun wrote:
> > Here is another part of the h264.c/svq3.c separation. This one should
> > be uncontroversial. I have run no benchmarks as I doubt this can have
> > any sort of effect.
> >
> > --- libavcodec/h264.c (revision 16237)
> > +++ libavcodec/h264.c (working copy)
> > @@ -2143,7 +2143,7 @@
> > s->quarter_sample = 1;
> > s->low_delay= 1;
> >
> > - if(avctx->codec_id == CODEC_ID_SVQ3)
> > + if(ENABLE_SVQ3_DECODER && avctx->codec_id == CODEC_ID_SVQ3)
> > avctx->pix_fmt= PIX_FMT_YUVJ420P;
> > else
> > avctx->pix_fmt= PIX_FMT_YUV420P;
> > @@ -2210,7 +2210,7 @@
> > // SVQ3 as well as most other codecs have only last/next/current and thus
> > // get released even with set reference, besides SVQ3 and others do not
> > // mark frames as reference later "naturally".
> > - if(s->codec_id != CODEC_ID_SVQ3)
> > + if(!ENABLE_SVQ3_DECODER && s->codec_id != CODEC_ID_SVQ3)
> > s->current_picture_ptr->reference= 0;
> >
> > s->current_picture_ptr->field_poc[0]=
> > @@ -2492,7 +2492,7 @@
> > idct_dc_add(ptr, h->mb + i*16, linesize);
> > else
> > idct_add (ptr, h->mb + i*16, linesize);
> > - }else
> > + }else if(ENABLE_SVQ3_DECODER)
> > svq3_add_idct_c(ptr, h->mb + i*16, linesize, s->qscale, 0);
> > }
> > }
> > @@ -2504,7 +2504,7 @@
> > if(is_h264){
> > if(!transform_bypass)
> > h264_luma_dc_dequant_idct_c(h->mb, s->qscale, h->dequant4_coeff[0][s->qscale][0]);
> > - }else
> > + }else if(ENABLE_SVQ3_DECODER)
> > svq3_luma_dc_dequant_idct_c(h->mb, s->qscale);
> > }
> > if(h->deblocking_filter)
> > @@ -2549,7 +2549,7 @@
> > }
> > }
> > }
> > - }else{
> > + }else if(ENABLE_SVQ3_DECODER){
> > for(i=0; i<16; i++){
> > if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){ //FIXME benchmark weird rule, & below
> > uint8_t * const ptr= dest_y + block_offset[i];
> > @@ -2584,7 +2584,7 @@
> > else if(h->mb[i*16])
> > idct_dc_add(dest[(i&4)>>2] + block_offset[i], h->mb + i*16, uvlinesize);
> > }
> > - }else{
> > + }else if(ENABLE_SVQ3_DECODER){
> > for(i=16; i<16+8; i++){
> > if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){
> > uint8_t * const ptr= dest[(i&4)>>2] + block_offset[i];
>
> does following work too?
>
> +#ifdef CONFIG_SVQ3_DECODER
> const int is_h264 = simple || s->codec_id == CODEC_ID_H264;
> +#else
> + #define is_h264 0
> +#endif
>
> if yes it would be simpler
>
> or even
> const int is_h264 = !ENABLE_SVQ3_DECODER || simple || s->codec_id == CODEC_ID_H264;
The latter appears to work, so applied.
Diego
More information about the ffmpeg-devel
mailing list