aizvorski / h264bitstream

A complete set of functions to read and write H.264 video bitstreams, in particular to examine or modify headers.
GNU Lesser General Public License v2.1
713 stars 237 forks source link

Fix scaling list parsing when chroma_format_idc is equal to 3 #22

Closed kradhub closed 6 years ago

kradhub commented 7 years ago

In this case we can have up to 12 scaling list according to specification section 7.3.2.1.1.

aizvorski commented 7 years ago

@kradhub Great catch!

I think this will also need the following change in h264_stream.h to not overrun buffers:

    int seq_scaling_matrix_present_flag;
      int seq_scaling_list_present_flag[12];
      int ScalingList4x4[6][16];
      int UseDefaultScalingMatrix4x4Flag[6];
      int ScalingList8x8[6][64];
      int UseDefaultScalingMatrix8x8Flag[6];

Does that look right to you?

I'll merge this PR after a few little changes needed in the SVC code (otherwise it will be a merge conflict).

kradhub commented 7 years ago

I think this will also need the following change in h264_stream.h to not overrun buffers:

int seq_scaling_matrix_present_flag;
  int seq_scaling_list_present_flag[12];
  int ScalingList4x4[6][16];
  int UseDefaultScalingMatrix4x4Flag[6];
  int ScalingList8x8[6][64];
  int UseDefaultScalingMatrix8x8Flag[6];

Does that look right to you?

Indeed. I updated the patch and I rebased it on the current master.