Hi,
On Thu, Nov 3, 2011 at 4:25 PM, Alex Converse <[email protected]> wrote:
> On Thu, Nov 3, 2011 at 4:10 PM, Ronald S. Bultje <[email protected]> wrote:
>> Hi,
>>
>> On Thu, Nov 3, 2011 at 4:03 PM, Alex Converse <[email protected]>
>> wrote:
>>> ---
>>> libavcodec/vp6.c | 6 ++++--
>>> 1 files changed, 4 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/libavcodec/vp6.c b/libavcodec/vp6.c
>>> index e29f901..698b396 100644
>>> --- a/libavcodec/vp6.c
>>> +++ b/libavcodec/vp6.c
>>> @@ -413,8 +413,10 @@ static void vp6_parse_coeff_huffman(VP56Context *s)
>>> }
>>> }
>>> coeff_idx+=run;
>>> - cg = FFMIN(vp6_coeff_groups[coeff_idx], 3);
>>> - vlc_coeff = &s->ract_vlc[pt][ct][cg];
>>> + if (coeff_idx < 64) {
>>> + cg = FFMIN(vp6_coeff_groups[coeff_idx], 3);
>>> + vlc_coeff = &s->ract_vlc[pt][ct][cg];
>>> + }
>>
>> Do you want to return an error? I.e. else return -1 or so, perhaps
>> under error_resilience>=EXPLODE? Or is this something that happens in
>> regular streams?
>>
>
> This seems to happen in 'normal' streams for the last element. A
> little more context shows that the loop breaks immediately afterward.
>
> for (coeff_idx=0; coeff_idx<64; ) {
> int run = 1;
> if (coeff_idx<2 && s->nb_null[coeff_idx][pt]) {
> s->nb_null[coeff_idx][pt]--;
> if (coeff_idx)
> break;
> } else {
> if (get_bits_count(&s->gb) >= s->gb.size_in_bits)
> return;
> coeff = get_vlc2(&s->gb, vlc_coeff->table, 9, 3);
> if (coeff == 0) {
> if (coeff_idx) {
> int pt = (coeff_idx >= 6);
> run += get_vlc2(&s->gb, s->runv_vlc[pt].table, 9, 3);
> if (run >= 9)
> run += get_bits(&s->gb, 6);
> } else
> s->nb_null[0][pt] = vp6_get_nb_null(s);
> ct = 0;
> } else if (coeff == 11) { /* end of block */
> if (coeff_idx == 1) /* first AC coeff ? */
> s->nb_null[1][pt] = vp6_get_nb_null(s);
> break;
> } else {
> int coeff2 = vp56_coeff_bias[coeff];
> if (coeff > 4)
> coeff2 += get_bits(&s->gb, coeff <= 9 ? coeff - 4 :
> 11);
> ct = 1 + (coeff2 > 1);
> sign = get_bits1(&s->gb);
> coeff2 = (coeff2 ^ -sign) + sign;
> if (coeff_idx)
> coeff2 *= s->dequant_ac;
> idx = model->coeff_index_to_pos[coeff_idx];
> s->block_coeff[b][permute[idx]] = coeff2;
> }
> }
> coeff_idx+=run;
> if (coeff_idx < 64) {
> cg = FFMIN(vp6_coeff_groups[coeff_idx], 3);
> vlc_coeff = &s->ract_vlc[pt][ct][cg];
> }
> }
Ah, so you could merge the two conditions:
for (coeff_idx = 0;;) {
..
coeff_idx += run;
if (coeff_idx >= 64)
break;
vlc_coeff = &s->ract_vlc[pt][ct][FFMIN(....)];
}
Patch OK whichever variant you choose.
Ronald
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel