[FFmpeg-devel] [PATCH] VC1: Respect rounding flag for chroma MC in B frames

David Conrad lessen42
Wed Apr 15 01:57:05 CEST 2009


On Apr 14, 2009, at 4:10 PM, Michael Niedermayer wrote:

> On Tue, Apr 14, 2009 at 03:36:49PM -0400, David Conrad wrote:
>> On Apr 14, 2009, at 7:51 AM, Michael Niedermayer wrote:
>>
>>> On Tue, Apr 14, 2009 at 12:09:45AM -0400, David Conrad wrote:
>>>> Hi,
>>>>
>>>> As in subject, this fixes some minor errors in
>>>> planet-vc1-bframe-bitexact.mkv
>>>
>>> [...]
>>>> diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
>>>> index e9c2bfc..0a480ae 100644
>>>> --- a/libavcodec/dsputil.h
>>>> +++ b/libavcodec/dsputil.h
>>>> @@ -319,6 +319,7 @@ typedef struct DSPContext {
>>>>    /* This is really one func used in VC-1 decoding */
>>>>    h264_chroma_mc_func put_no_rnd_h264_chroma_pixels_tab[3];
>>>>    h264_chroma_mc_func avg_h264_chroma_pixels_tab[3];
>>>> +    h264_chroma_mc_func avg_no_rnd_h264_chroma_pixels_tab[3];
>>>>
>>>>    qpel_mc_func put_h264_qpel_pixels_tab[4][16];
>>>>    qpel_mc_func avg_h264_qpel_pixels_tab[4][16];
>>>> diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c
>>>> index ef6f8b2..15cb323 100644
>>>> --- a/libavcodec/vc1.c
>>>> +++ b/libavcodec/vc1.c
>>>> @@ -1915,8 +1915,13 @@ static void vc1_interp_mc(VC1Context *v)
>>>>    uvdxy = ((uvmy & 3) << 2) | (uvmx & 3);
>>>>    uvmx = (uvmx&3)<<1;
>>>>    uvmy = (uvmy&3)<<1;
>>>> -    dsp->avg_h264_chroma_pixels_tab[0](s->dest[1], srcU, s- 
>>>> >uvlinesize,
>>>> 8, uvmx, uvmy);
>>>> -    dsp->avg_h264_chroma_pixels_tab[0](s->dest[2], srcV, s- 
>>>> >uvlinesize,
>>>> 8, uvmx, uvmy);
>>>> +    if(!v->rnd){
>>>> +        dsp->avg_h264_chroma_pixels_tab[0](s->dest[1], srcU,
>>>> s->uvlinesize, 8, uvmx, uvmy);
>>>> +        dsp->avg_h264_chroma_pixels_tab[0](s->dest[2], srcV,
>>>> s->uvlinesize, 8, uvmx, uvmy);
>>>> +    }else{
>>>> +        dsp->avg_no_rnd_h264_chroma_pixels_tab[0](s->dest[1],  
>>>> srcU,
>>>> s->uvlinesize, 8, uvmx, uvmy);
>>>> +        dsp->avg_no_rnd_h264_chroma_pixels_tab[0](s->dest[2],  
>>>> srcV,
>>>> s->uvlinesize, 8, uvmx, uvmy);
>>>> +    }
>>>
>>> maybe the use of the slower code should be under bitexact (i  
>>> assume b
>>> frames
>>> are never used as references)
>>> also i dont like to have h264 in the name of a function that is  
>>> never
>>> used by h264
>>
>> How about optimizing the function instead? Also I'll rename them to
>
> well, if you want ...
>
>
>> (put|avg)_no_rnd_vc1_chroma* afterwards (or before if you prefer.)
>
> before commit

Done, no speed loss observed on x86, and I'll send an Altivec patch  
shortly as it's not as trivial as MMX was.



More information about the ffmpeg-devel mailing list