[FFmpeg-devel] [PATCH] lavc/hevc_ps: parse constraint flags for HEVC REXT

Linjie Fu linjie.fu at intel.com
Mon Apr 1 12:43:20 EEST 2019


Parse all the constraint flags.

It can be passed to hw decoders to detemine the exact profile for Range
Extension HEVC.

Signed-off-by: Linjie Fu <linjie.fu at intel.com>
---
 libavcodec/hevc_ps.c | 18 +++++++++++++++---
 libavcodec/hevc_ps.h | 10 ++++++++++
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index 80df417e4f..1365a9d640 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -295,9 +295,21 @@ static int decode_profile_tier_level(GetBitContext *gb, AVCodecContext *avctx,
     ptl->non_packed_constraint_flag = get_bits1(gb);
     ptl->frame_only_constraint_flag = get_bits1(gb);
 
-    skip_bits(gb, 16); // XXX_reserved_zero_44bits[0..15]
-    skip_bits(gb, 16); // XXX_reserved_zero_44bits[16..31]
-    skip_bits(gb, 12); // XXX_reserved_zero_44bits[32..43]
+    ptl->max_12bit_constraint_flag        = get_bits1(gb);
+    ptl->max_10bit_constraint_flag        = get_bits1(gb);
+    ptl->max_8bit_constraint_flag         = get_bits1(gb);
+    ptl->max_422chroma_constraint_flag    = get_bits1(gb);
+    ptl->max_420chroma_constraint_flag    = get_bits1(gb);
+    ptl->max_monochrome_constraint_flag   = get_bits1(gb);
+    ptl->intra_constraint_flag            = get_bits1(gb);
+    ptl->one_picture_only_constraint_flag = get_bits1(gb);
+    ptl->lower_bit_rate_constraint_flag   = get_bits1(gb);
+
+    skip_bits(gb, 16); // XXX_reserved_zero_34bits[0..15]
+    skip_bits(gb, 16); // XXX_reserved_zero_34bits[16..31]
+    skip_bits(gb, 2);  // XXX_reserved_zero_34bits[32..33]
+
+    ptl->inbld_flag = get_bits1(gb);
 
     return 0;
 }
diff --git a/libavcodec/hevc_ps.h b/libavcodec/hevc_ps.h
index bbaa9205ef..1c95a1848b 100644
--- a/libavcodec/hevc_ps.h
+++ b/libavcodec/hevc_ps.h
@@ -182,6 +182,16 @@ typedef struct PTLCommon {
     uint8_t interlaced_source_flag;
     uint8_t non_packed_constraint_flag;
     uint8_t frame_only_constraint_flag;
+    uint8_t max_12bit_constraint_flag;
+    uint8_t max_10bit_constraint_flag;
+    uint8_t max_8bit_constraint_flag;
+    uint8_t max_422chroma_constraint_flag;
+    uint8_t max_420chroma_constraint_flag;
+    uint8_t max_monochrome_constraint_flag;
+    uint8_t intra_constraint_flag;
+    uint8_t one_picture_only_constraint_flag;
+    uint8_t lower_bit_rate_constraint_flag;
+    uint8_t inbld_flag;
 } PTLCommon;
 
 typedef struct PTL {
-- 
2.17.1



More information about the ffmpeg-devel mailing list