On 2012-12-18 07:30:03 -0800, Ronald S. Bultje wrote:
> Hi,
> 
> On Mon, Dec 17, 2012 at 10:55 PM, Janne Grunau <[email protected]> wrote:
> > On 2012-12-17 18:24:37 -0800, Ronald S. Bultje wrote:
> >> Hi,
> >> On Dec 17, 2012 1:02 PM, "Janne Grunau" <[email protected]> wrote:
> >> >
> >> > Compute dist_scale_factor_field only for MBAFF since that is the only
> >> > case in which it is used.
> >>
> >> The patch also increases an array size - why?
> >
> > to handle up to 32 references for field pictures. Alternatively both
> > arrays can probably be merged to the usual 16 + 32 size.
> 
> Check the code:

omitting the important:
  +    if (FRAME_MBAFF)

> +            for (i = 0; i < 2 * h->ref_count[0]; i++)
> +                h->dist_scale_factor_field[field][i^field] =
> +                    get_scale_factor(h, poc, poc1, i+16);
> +        }
> +
> +    for (i = 0; i < h->ref_count[0]; i++){
>          h->dist_scale_factor[i] = get_scale_factor(h, poc, poc1, i);
>      }
> 
> For arrays of size:
> 
> -    int dist_scale_factor[16];
> +    int dist_scale_factor[32];
>      int dist_scale_factor_field[2][32];
> 
> If i for setting dist_scale_factor_field is [0, ref_count * 2] and
> that's [0, 32], them ref_count is 16, thus the second loop i [0,
> ref_count] is [0, 16], thus dist_scale_factor[] only needs to be of
> size 16.

dist_scale_factor_field is only used for MBAFF. The max reference count
for MBAFF is 16 (!field_pic_flag). For field_pic_flag maximal reference
count is 32.

The naming of the variables is unfortunate. In other cases we use arrays
sizes like ...[16 + 32] to handle normal and field references for MBAFF
in the same array. That one would be large enough to 32 field pic
references too.

Janne
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to