View Issue Details

IDProjectCategoryView StatusLast Update
0000350JVT JM H.264/AVC reference softwaredecoderpublic2015-04-30 08:57
ReporterShevach Riabtsev Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product VersionJM 18.0 
Summary0000350: new values of log2_max_frame_num are not accepted
DescriptionHi all

While working with JM18.0 decoder i encounter the following problem:

i have a h264-file test file (attached as test_max_frame_num_bug.264), the file consists of two GOPs (18 frames of each, totally 36 frames).
The first GOP has log2_max_frame_num_minus4=12 (MaxFrameNum=64k) while the second GOP has log2_max_frame_num_minus4=0 (MaxFrameNum=16).
 
The JM18.0 decoder fails processing the test file, it abnormally exits at frame 0000033 with the following error:
…..
Picture 32, Type P
00014( P ) 28 14 28 0.0000 0.0000 0.0000 4:2:0 1
Picture 33, Type P
00015( P ) 30 15 28 0.0000 0.0000 0.0000 4:2:0 1
An unintentional loss of pictures occurs! Exit
 
 
The test file is compliant, because it actually is a concatenation of two compliant self-contained GOPs.

The reason of failure is:
JM18.0 accepts log2_max_frame_num only at the start of stream, if a SPS with a different log2_max_frame_num is present in the middle of the stream, the new value of log2_max_frame_num is ignored (unlike to other parameters of SPS/PPS).

More precisely, the value of MaxFrameNum is assigned at the function ‘set_coding_par’ (parset.c) only:
 
   cps->MaxFrameNum = 1<<(sps->log2_max_frame_num_minus4+4);
 
The function ‘set_coding_par’ in turn is called in the function ‘activate_sps’ only:
 
    if(p_Vid->dpb_layer_id==0 && is_BL_profile(sps->profile_idc) &&
      !p_Vid->p_Dpb_layer[0]->init_done)
    {
      set_coding_par(sps, p_Vid->p_EncodePar[0]);
      setup_layer_info( p_Vid, sps, p_Vid->p_LayerPar[0]);
    }
    else if(p_Vid->dpb_layer_id==1 && is_EL_profile(sps->profile_idc) &&
    !p_Vid->p_Dpb_layer[1]->init_done)
    {
      set_coding_par(sps, p_Vid->p_EncodePar[1]);
      setup_layer_info(p_Vid, sps, p_Vid->p_LayerPar[1]);
    }
 
Upon activation of the very first SPS, MaxFrameNum is set and the flag p_Vid->p_Dpb_layer[0]->init_done is set to 1. As a result new values of log2_max_frame_num are ignored. Actually the decoder processes a stream with obsolete log2_max_frame_num.
 
Regarding to the failure of the test file, log2_max_frame_num in the first SPS is 16 (or MaxFrameNum=64k) and this value is adopted (since it is present in the very first SPS). When the JM18.0 decoder starts processing the second GOP
it expects that after frame_num=15 the following frame_num is 16, however frame_num values in the second GOP are incremented modulo 16, hence the following frame_num is 0. Consequently the decoder considers the situation as frame(s) loss and reports error respectively.
 
We suggest removing the condition !p_Vid->p_Dpb_layer[0]->init_done in activate_sps function. We propose to replace the condition:
 
if(p_Vid->dpb_layer_id==0 && is_BL_profile(sps->profile_idc) && !p_Vid->p_Dpb_layer[0]->init_done)
    {
      set_coding_par(sps, p_Vid->p_EncodePar[0]);
      setup_layer_info( p_Vid, sps, p_Vid->p_LayerPar[0]);
    }
    else if(p_Vid->dpb_layer_id==1 && is_EL_profile(sps->profile_idc) && !p_Vid->p_Dpb_layer[1]->init_done)
    {
      set_coding_par(sps, p_Vid->p_EncodePar[1]);
      setup_layer_info(p_Vid, sps, p_Vid->p_LayerPar[1]);
    }
 
With
 
if(p_Vid->dpb_layer_id==0 && is_BL_profile(sps->profile_idc) )
    {
      set_coding_par(sps, p_Vid->p_EncodePar[0]);
      setup_layer_info( p_Vid, sps, p_Vid->p_LayerPar[0]);
    }
    else if(p_Vid->dpb_layer_id==1 && is_EL_profile(sps->profile_idc))
    {
      set_coding_par(sps, p_Vid->p_EncodePar[1]);
      setup_layer_info(p_Vid, sps, p_Vid->p_LayerPar[1]);
    }
 
 
TagsNo tags attached.

Activities

Shevach Riabtsev

2015-04-30 08:57

reporter  

Issue History

Date Modified Username Field Change
2015-04-30 08:57 Shevach Riabtsev New Issue
2015-04-30 08:57 Shevach Riabtsev File Added: test_max_frame_num_bug.264