Mailing List Archive

Typo in ffmpeg h264 parser?
Hello: When I feed h264 from UK DVB-T2 recordings into ffmpeg I almost
always get error reports of 'illegal reordering of pic_nums_idc' or
'reference count overflow.' I'm running 30-pre-579

These reports apparently come from libavcodec/h264_parser.c, lines 186
and 194, and the if/else if combination at lines 182/184 looks very strange.

unsigned int reordering_of_pic_nums_idc =
get_ue_golomb_31(gb);

if (reordering_of_pic_nums_idc < 3)
get_ue_golomb_long(gb);
else if (reordering_of_pic_nums_idc > 3) {

while libavcodec/golomb.h has this at line 82:

/**
* read unsigned exp golomb code, constraint to a max of 31.
* the return value is undefined if the stored value exceeds 31.
*/
static inline int get_ue_golomb_31(GetBitContext *gb)
{

I think that the '3' in the 'else if' line in the parser should be 31;
any comments? Suggested action? I haven't yet tried a patch.

John P




_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-dev
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Typo in ffmpeg h264 parser? [ In reply to ]
You may be right…

If you check ITU H264 (04/2017) (I can make this document available to you if you don’t have it)

7.3.2.13 Slice layer extension RBSP syntax

there you’ll find the whole slice header syntax.

What ffmpeg calls reordering_of_pic_nums_idc is in the spec num_ref_idx_10_active_minus1, per the spec, that value is either between 0-7 or 0-15.. There’s an exception where it can be 0 to 31. So anything over 31 would be an error

You should ask that in #ffmpeg-devel

JY

> On 25 Apr 2018, at 9:14 pm, John Pilkington <johnpilk222@gmail.com> wrote:
>
> Hello: When I feed h264 from UK DVB-T2 recordings into ffmpeg I almost always get error reports of 'illegal reordering of pic_nums_idc' or 'reference count overflow.' I'm running 30-pre-579
>
> These reports apparently come from libavcodec/h264_parser.c, lines 186 and 194, and the if/else if combination at lines 182/184 looks very strange.
>
> unsigned int reordering_of_pic_nums_idc = get_ue_golomb_31(gb);
>
> if (reordering_of_pic_nums_idc < 3)
> get_ue_golomb_long(gb);
> else if (reordering_of_pic_nums_idc > 3) {
>
> while libavcodec/golomb.h has this at line 82:
>
> /**
> * read unsigned exp golomb code, constraint to a max of 31.
> * the return value is undefined if the stored value exceeds 31.
> */
> static inline int get_ue_golomb_31(GetBitContext *gb)
> {
>
> I think that the '3' in the 'else if' line in the parser should be 31; any comments? Suggested action? I haven't yet tried a patch.
>
> John P
>
>
>
>
> _______________________________________________
> mythtv-dev mailing list
> mythtv-dev@mythtv.org
> http://lists.mythtv.org/mailman/listinfo/mythtv-dev
> http://wiki.mythtv.org/Mailing_List_etiquette
> MythTV Forums: https://forum.mythtv.org
Re: Typo in ffmpeg h264 parser? [ In reply to ]
On 26/04/18 11:06, Jean-Yves Avenard wrote:
> You may be right…
>
> If you check ITU H264 (04/2017) (I can make this document available to
> you if you don’t have it)

Thanks, JY. I have it in my downloads folder. Good soporific stuff.

I'm running with the patch and have seen no problems as yet.
Experiments in progress.

John
>
> 7.3.2.13 Slice layer extension RBSP syntax
>
> there you’ll find the whole slice header syntax.
>
> What ffmpeg calls reordering_of_pic_nums_idc is in the spec
> num_ref_idx_10_active_minus1, per the spec, that value is either between
> 0-7 or 0-15.. There’s an exception where it can be 0 to 31. So anything
> over 31 would be an error
>
> You should ask that in #ffmpeg-devel
>
> JY
>
>> On 25 Apr 2018, at 9:14 pm, John Pilkington <johnpilk222@gmail.com
>> <mailto:johnpilk222@gmail.com>> wrote:
>>
>> Hello:  When I feed h264 from UK DVB-T2 recordings into ffmpeg I
>> almost always get error reports of 'illegal reordering of
>> pic_nums_idc' or 'reference count overflow.' I'm running 30-pre-579
>>
>> These reports apparently come from libavcodec/h264_parser.c, lines 186
>> and 194, and the if/else if combination at lines 182/184 looks very
>> strange.
>>
>>                   unsigned int reordering_of_pic_nums_idc =
>> get_ue_golomb_31(gb);
>>
>>                    if (reordering_of_pic_nums_idc < 3)
>>                        get_ue_golomb_long(gb);
>>                    else if (reordering_of_pic_nums_idc > 3) {
>>
>> while libavcodec/golomb.h has this at line 82:
>>
>> /**
>> * read unsigned exp golomb code, constraint to a max of 31.
>> * the return value is undefined if the stored value exceeds 31.
>> */
>> static inline int get_ue_golomb_31(GetBitContext *gb)
>> {
>>
>> I think that the '3' in the 'else if' line in the parser should be 31;
>> any comments?  Suggested action?  I haven't yet tried a patch.
>>
>> John P
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-dev
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Typo in ffmpeg h264 parser? [ In reply to ]
On 26/04/18 11:06, Jean-Yves Avenard wrote:
> You may be right…
>
> If you check ITU H264 (04/2017) (I can make this document available to
> you if you don’t have it)

Thanks, JY. I have it in my downloads folder. Good soporific stuff.

I'm running with the patch and have seen no problems as yet. Experiments
in progress.

John
>
> 7.3.2.13 Slice layer extension RBSP syntax
>
> there you’ll find the whole slice header syntax.
>
> What ffmpeg calls reordering_of_pic_nums_idc is in the spec
> num_ref_idx_10_active_minus1, per the spec, that value is either between
> 0-7 or 0-15.. There’s an exception where it can be 0 to 31. So anything
> over 31 would be an error
>
> You should ask that in #ffmpeg-devel
>
> JY

I'm told that it isn't a typo. Ref 7.3.3.1

"Valid meaningful values are 0-2, and 3 ends the list. Any other value
is invalid."

Continuing...

This is 'edited as new' from my Sent folder: gmail quirk. Testing to
see if it continues the thread.
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-dev
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org