[FFmpeg-cvslog] avcodec/hevc: Parse recovery point SEI
Zhao Zhili
git at videolan.org
Thu Feb 20 06:02:56 EET 2025
ffmpeg | branch: master | Zhao Zhili <zhilizhao at tencent.com> | Thu Jan 23 22:12:09 2025 +0800| [b6652115de64b6dee5a212643280e3c50c169935] | committer: Zhao Zhili
avcodec/hevc: Parse recovery point SEI
Signed-off-by: Zhao Zhili <zhilizhao at tencent.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b6652115de64b6dee5a212643280e3c50c169935
---
libavcodec/hevc/hevcdec.c | 1 +
libavcodec/hevc/sei.c | 16 ++++++++++++++++
libavcodec/hevc/sei.h | 7 +++++++
3 files changed, 24 insertions(+)
diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c
index f71edf213b..b22bb9f39a 100644
--- a/libavcodec/hevc/hevcdec.c
+++ b/libavcodec/hevc/hevcdec.c
@@ -4087,6 +4087,7 @@ static int hevc_update_thread_context(AVCodecContext *dst,
s->sei.common.display_orientation = s0->sei.common.display_orientation;
s->sei.common.alternative_transfer = s0->sei.common.alternative_transfer;
s->sei.tdrdi = s0->sei.tdrdi;
+ s->sei.recovery_point = s0->sei.recovery_point;
return 0;
}
diff --git a/libavcodec/hevc/sei.c b/libavcodec/hevc/sei.c
index e11a33773c..9c3594ac2f 100644
--- a/libavcodec/hevc/sei.c
+++ b/libavcodec/hevc/sei.c
@@ -79,6 +79,20 @@ static int decode_nal_sei_pic_timing(HEVCSEI *s, GetBitContext *gb,
return 0;
}
+static int decode_nal_sei_recovery_point(HEVCSEI *s, GetBitContext *gb)
+{
+ HEVCSEIRecoveryPoint *rec = &s->recovery_point;
+ int recovery_poc_cnt = get_se_golomb(gb);
+
+ if (recovery_poc_cnt > INT16_MAX || recovery_poc_cnt < INT16_MIN)
+ return AVERROR_INVALIDDATA;
+ rec->recovery_poc_cnt = recovery_poc_cnt;
+ rec->exact_match_flag = get_bits1(gb);
+ rec->broken_link_flag = get_bits1(gb);
+
+ return 0;
+}
+
static int decode_nal_sei_active_parameter_sets(HEVCSEI *s, GetBitContext *gb, void *logctx)
{
int num_sps_ids_minus1;
@@ -212,6 +226,8 @@ static int decode_nal_sei_prefix(GetBitContext *gb, GetByteContext *gbyte,
return decode_nal_sei_decoded_picture_hash(&s->picture_hash, gbyte);
case SEI_TYPE_PIC_TIMING:
return decode_nal_sei_pic_timing(s, gb, ps, logctx);
+ case SEI_TYPE_RECOVERY_POINT:
+ return decode_nal_sei_recovery_point(s, gb);
case SEI_TYPE_ACTIVE_PARAMETER_SETS:
return decode_nal_sei_active_parameter_sets(s, gb, logctx);
case SEI_TYPE_TIME_CODE:
diff --git a/libavcodec/hevc/sei.h b/libavcodec/hevc/sei.h
index ee640003bc..7e1a2b0756 100644
--- a/libavcodec/hevc/sei.h
+++ b/libavcodec/hevc/sei.h
@@ -95,6 +95,12 @@ typedef struct HEVCSEITDRDI {
uint8_t three_dimensional_reference_displays_extension_flag;
} HEVCSEITDRDI;
+typedef struct HEVCSEIRecoveryPoint {
+ int16_t recovery_poc_cnt;
+ uint8_t exact_match_flag;
+ uint8_t broken_link_flag;
+} HEVCSEIRecoveryPoint;
+
typedef struct HEVCSEI {
H2645SEI common;
HEVCSEIPictureHash picture_hash;
@@ -102,6 +108,7 @@ typedef struct HEVCSEI {
int active_seq_parameter_set_id;
HEVCSEITimeCode timecode;
HEVCSEITDRDI tdrdi;
+ HEVCSEIRecoveryPoint recovery_point;
} HEVCSEI;
struct HEVCParamSets;
More information about the ffmpeg-cvslog
mailing list