diff mbox series

[FFmpeg-devel,15/17] avformat/avc: Use the constraint_setx_flags as is

Message ID 20200709192022.9412-7-andreas.rheinhardt@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/7] avformat/avc: Fix undefined shift and assert when reading exp-golomb num
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt July 9, 2020, 7:20 p.m. UTC
and also keep the reserved_zero_2bits in the corresponding H264SPS member.
This simplifies parsing and will prove beneficial in ff_isom_write_avcc.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavformat/avc.c    | 8 +-------
 libavformat/avc.h    | 2 +-
 libavformat/mxfenc.c | 2 +-
 3 files changed, 3 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/avc.c b/libavformat/avc.c
index 6246410ad0..c106fe5792 100644
--- a/libavformat/avc.c
+++ b/libavformat/avc.c
@@ -410,13 +410,7 @@  int ff_avc_decode_sps(H264SPS *sps, const uint8_t *buf, int buf_size)
     memset(sps, 0, sizeof(*sps));
 
     sps->profile_idc = get_bits(&gb, 8);
-    sps->constraint_set_flags |= get_bits1(&gb) << 0; // constraint_set0_flag
-    sps->constraint_set_flags |= get_bits1(&gb) << 1; // constraint_set1_flag
-    sps->constraint_set_flags |= get_bits1(&gb) << 2; // constraint_set2_flag
-    sps->constraint_set_flags |= get_bits1(&gb) << 3; // constraint_set3_flag
-    sps->constraint_set_flags |= get_bits1(&gb) << 4; // constraint_set4_flag
-    sps->constraint_set_flags |= get_bits1(&gb) << 5; // constraint_set5_flag
-    skip_bits(&gb, 2); // reserved_zero_2bits
+    sps->constraint_set_flags = get_bits(&gb, 8);
     sps->level_idc = get_bits(&gb, 8);
     GET_UE_GOLOMB(sps->id, H264_MAX_SPS_COUNT - 1);
 
diff --git a/libavformat/avc.h b/libavformat/avc.h
index db1d3334dd..2c7004a5ef 100644
--- a/libavformat/avc.h
+++ b/libavformat/avc.h
@@ -42,7 +42,7 @@  typedef struct {
     uint8_t id;
     uint8_t profile_idc;
     uint8_t level_idc;
-    uint8_t constraint_set_flags;
+    uint8_t constraint_set_flags; /* Also contains the reserved_zero_*bits. */
     uint8_t chroma_format_idc;
     uint8_t bit_depth_luma_minus8;
     uint8_t bit_depth_chroma_minus8;
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 5eeeb9ab84..5168b17a2c 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -2204,7 +2204,7 @@  static int mxf_parse_h264_frame(AVFormatContext *s, AVStream *st,
             sc->aspect_ratio.den = st->codecpar->height * sps->sar.den;
             av_reduce(&sc->aspect_ratio.num, &sc->aspect_ratio.den,
                       sc->aspect_ratio.num, sc->aspect_ratio.den, 1024*1024);
-            intra_only = (sps->constraint_set_flags >> 3) & 1;
+            intra_only = (sps->constraint_set_flags >> 4) & 1;
             sc->interlaced = !sps->frame_mbs_only_flag;
             sc->component_depth = sps->bit_depth_luma_minus8 + 8;