[FFmpeg-devel] [PATCH] PAFF: Derivation process for chroma motion vector

Måns Rullgård mans
Mon Oct 15 09:57:07 CEST 2007


Carl Eugen Hoyos <cehoyos at ag.or.at> writes:

> Hi Michael!
>
> Michael Niedermayer wrote:
>
>>>>> Attached is a patch that removes smearing from PAFF test files I use. It
>>>>> implements Table 8-10 (Derivation of the vertical component of the
>>>>> chroma vector in field coding mode) by only allowing my to be changed if
>>>>> the reference picture is a field. (Cosmetic patch will be applied if
>>>>> accepted.)
>>>>>
>>>>> For my sample, it has the same effect as Martin Zlomeks patch: I can't
>>>>> see any bottom fields being referenced.
>>>> but if fields of different parity will be referenced then its wrong or
>>>> am i missing something?
>>> If the original code works apart from changing my also for non interlaced
>>> reference frames (if h->ref_cache[list][scan8[n]]&1 really shows the parity of
>>> the referenced field) it will correctly calculate my += +/- 2
>>>
>>> I can s/h->ref_cache[list][scan8[n]]/pic->reference
>>> but that is a separate issue IMO.
>> 
>> well if h->ref_cache[list][scan8[n]]&1 where correct in PAFF with
>> the current code then your change should not be needed at all
>> 
>> so no i dont think these are seperate issues
>> as far as i understand the issue and i didnt extensively study the current
>> h264.c or the h.264 spec, (so i could be wrong) is that
>> h->ref_cache[list][scan8[n]]&1 matches field parity in MBAFF but not in PAFF
>
> New patch attached.
>
> Carl Eugen
> Index: libavcodec/h264.c
> ===================================================================
> --- libavcodec/h264.c	(Revision 10738)
> +++ libavcodec/h264.c	(Arbeitskopie)
> @@ -1729,7 +1729,10 @@
>
>      if(MB_FIELD){
>          // chroma offset when predicting from a field of opposite parity
> +        if(MB_MBAFF)
>          my += 2 * ((s->mb_y & 1) - (h->ref_cache[list][scan8[n]] & 1));
> +        else if(pic->reference != PICT_FRAME)
> +            my += 2 * ((s->mb_y & 1) - (pic->reference & 1));
>          emu |= (my>>3) < 0 || (my>>3) + 8 >= (pic_height>>1);
>      }

Is that if() needed?  Wouldn't pic->reference work also for MBAFF?

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list