[FFmpeg-cvslog] avfilter/libplacebo: use a transparent default fillcolor

2025-02-19 Thread Niklas Haas
ffmpeg | branch: master | Niklas Haas  | Mon Feb 17 15:17:20 
2025 +0100| [cd81f084917dacaffda3112fee6876501d399898] | committer: Niklas Haas

avfilter/libplacebo: use a transparent default fillcolor

This will leave the background transparent when the target format
contains an alpha channel, without affecting the behavior on formats
without one.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cd81f084917dacaffda3112fee6876501d399898
---

 doc/filters.texi| 2 +-
 libavfilter/vf_libplacebo.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 9b9f393fb6..f281053965 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -16458,7 +16458,7 @@ approaches.
 Set the color used to fill the output area not covered by the output image, for
 example as a result of @option{normalize_sar}. For the general syntax of this
 option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils
-manual,ffmpeg-utils}. Defaults to @code{black}.
+manual,ffmpeg-utils}. Defaults to @code{black@@0}.
 
 @item corner_rounding
 Render frames with rounded corners. The value, given as a float ranging from
diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c
index e1c6629f6d..cc07ccd8be 100644
--- a/libavfilter/vf_libplacebo.c
+++ b/libavfilter/vf_libplacebo.c
@@ -1288,7 +1288,7 @@ static const AVOption libplacebo_options[] = {
 { "force_divisible_by", "enforce that the output resolution is divisible 
by a defined integer when force_original_aspect_ratio is used", 
OFFSET(force_divisible_by), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, 256, STATIC },
 { "normalize_sar", "force SAR normalization to 1:1 by adjusting 
pos_x/y/w/h", OFFSET(normalize_sar), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, STATIC 
},
 { "pad_crop_ratio", "ratio between padding and cropping when normalizing 
SAR (0=pad, 1=crop)", OFFSET(pad_crop_ratio), AV_OPT_TYPE_FLOAT, {.dbl=0.0}, 
0.0, 1.0, DYNAMIC },
-{ "fillcolor", "Background fill color", OFFSET(fillcolor), 
AV_OPT_TYPE_STRING, {.str = "black"}, .flags = DYNAMIC },
+{ "fillcolor", "Background fill color", OFFSET(fillcolor), 
AV_OPT_TYPE_STRING, {.str = "black@0"}, .flags = DYNAMIC },
 { "corner_rounding", "Corner rounding radius", OFFSET(corner_rounding), 
AV_OPT_TYPE_FLOAT, {.dbl = 0.0}, 0.0, 1.0, .flags = DYNAMIC },
 { "extra_opts", "Pass extra libplacebo-specific options using a 
:-separated list of key=value pairs", OFFSET(extra_opts), AV_OPT_TYPE_DICT, 
.flags = DYNAMIC },
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/oggenc: don't discard empty packets with no side data

2025-02-19 Thread James Almer
ffmpeg | branch: master | James Almer  | Thu Feb 13 19:47:45 
2025 -0300| [84d85e7ad4ace228265af0c8c5caccc0730042fd] | committer: James Almer

avformat/oggenc: don't discard empty packets with no side data

Theora signals "Output last frame again" with an empty packet.
To keep the behaviour of 18f24527eb of ignoring side data only packets, as
generated by the FLAC encoder to propagate updated extradata, also check for
pkt->side_data_size to choose wheter to mux the paket or not.

Fixes part of ticket #11451.

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=84d85e7ad4ace228265af0c8c5caccc0730042fd
---

 libavformat/oggenc.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c
index 224519a4da..0647111396 100644
--- a/libavformat/oggenc.c
+++ b/libavformat/oggenc.c
@@ -241,7 +241,8 @@ static int ogg_buffer_data(AVFormatContext *s, AVStream *st,
 
 len = FFMIN(size, segments*255);
 page->segments[page->segments_count++] = len - (segments-1)*255;
-memcpy(page->data+page->size, p, len);
+if (len)
+memcpy(page->data+page->size, p, len);
 p += len;
 size -= len;
 i += segments;
@@ -690,7 +691,7 @@ static int ogg_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 int i;
 
 if (pkt)
-return pkt->size ? ogg_write_packet_internal(s, pkt) : 0;
+return pkt->size || !pkt->side_data_elems ? 
ogg_write_packet_internal(s, pkt) : 0;
 
 for (i = 0; i < s->nb_streams; i++) {
 OGGStreamContext *oggstream = s->streams[i]->priv_data;
@@ -710,7 +711,7 @@ static int ogg_write_trailer(AVFormatContext *s)
 for (i = 0; i < s->nb_streams; i++) {
 OGGStreamContext *oggstream = s->streams[i]->priv_data;
 
-if (oggstream->page.size > 0)
+if (oggstream->page.segments_count)
 ogg_buffer_page(s, oggstream);
 }
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/mov: further ensure mov_build_index isn't run twice

2025-02-19 Thread James Almer
ffmpeg | branch: master | James Almer  | Thu Feb 13 23:49:20 
2025 -0300| [261ec6c35e306d0582f58b6842436839db837822] | committer: James Almer

avformat/mov: further ensure mov_build_index isn't run twice

If sc->tts_count is not 0, then the sample index has already been built.

Fixes: Null-dereference READ
Fixes: 
396192874/clusterfuzz-testcase-minimized-audio_decoder_fuzzer-4589309789143040

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=261ec6c35e306d0582f58b6842436839db837822
---

 libavformat/mov.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 85aef33b19..1c4b13864e 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4688,7 +4688,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
 
 /* only use old uncompressed audio chunk demuxing when stts specifies it */
 if (!(st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO &&
-  sc->stts_count == 1 && sc->stts_data[0].duration == 1)) {
+  sc->stts_count == 1 && sc->stts_data && sc->stts_data[0].duration == 
1)) {
 unsigned int current_sample = 0;
 unsigned int stts_sample = 0;
 unsigned int sample_size;
@@ -4700,7 +4700,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
 
 current_dts -= sc->dts_shift;
 
-if (!sc->sample_count || sti->nb_index_entries)
+if (!sc->sample_count || sti->nb_index_entries || sc->tts_count)
 return;
 if (sc->sample_count >= UINT_MAX / sizeof(*sti->index_entries) - 
sti->nb_index_entries)
 return;
@@ -4811,11 +4811,11 @@ static void mov_build_index(MOVContext *mov, AVStream 
*st)
 } else {
 unsigned chunk_samples, total = 0;
 
-ret = mov_merge_tts_data(mov, st, MOV_MERGE_CTTS);
-if (ret < 0)
+if (!sc->chunk_count || sc->tts_count)
 return;
 
-if (!sc->chunk_count)
+ret = mov_merge_tts_data(mov, st, MOV_MERGE_CTTS);
+if (ret < 0)
 return;
 
 // compute total chunk count

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/iamf_parse: add missing constrains for num_parameters in audio_element_oub()

2025-02-19 Thread James Almer
ffmpeg | branch: master | James Almer  | Mon Feb 17 11:41:24 
2025 -0300| [0526535cd58444dd264e810b2f3348b4d96cff3b] | committer: James Almer

avformat/iamf_parse: add missing constrains for num_parameters in 
audio_element_oub()

Fixes ticket #11475.

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0526535cd58444dd264e810b2f3348b4d96cff3b
---

 libavformat/iamf_parse.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/iamf_parse.c b/libavformat/iamf_parse.c
index 316093b35f..f71ea5315b 100644
--- a/libavformat/iamf_parse.c
+++ b/libavformat/iamf_parse.c
@@ -733,6 +733,12 @@ static int audio_element_obu(void *s, IAMFContext *c, 
AVIOContext *pb, int len)
 }
 
 num_parameters = ffio_read_leb(pbc);
+if (num_parameters > 2 && audio_element_type == 0) {
+av_log(s, AV_LOG_ERROR, "Audio Element parameter count %u is invalid"
+" for Channel representations\n", 
num_parameters);
+ret = AVERROR_INVALIDDATA;
+goto fail;
+}
 if (num_parameters && audio_element_type != 0) {
 av_log(s, AV_LOG_ERROR, "Audio Element parameter count %u is invalid"
 " for Scene representations\n", 
num_parameters);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/iamf_parse: ensure there's at most one of each parameter types in audio elements

2025-02-19 Thread James Almer
ffmpeg | branch: master | James Almer  | Mon Feb 17 11:41:25 
2025 -0300| [5470d024e18968b3bdef2b745966f7617f1eb9f2] | committer: James Almer

avformat/iamf_parse: ensure there's at most one of each parameter types in 
audio elements

Should prevent potential memory leaks on invalid files.

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5470d024e18968b3bdef2b745966f7617f1eb9f2
---

 libavformat/iamf_parse.c | 14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/libavformat/iamf_parse.c b/libavformat/iamf_parse.c
index f71ea5315b..db40ae37ab 100644
--- a/libavformat/iamf_parse.c
+++ b/libavformat/iamf_parse.c
@@ -752,11 +752,19 @@ static int audio_element_obu(void *s, IAMFContext *c, 
AVIOContext *pb, int len)
 type = ffio_read_leb(pbc);
 if (type == AV_IAMF_PARAMETER_DEFINITION_MIX_GAIN)
 ret = AVERROR_INVALIDDATA;
-else if (type == AV_IAMF_PARAMETER_DEFINITION_DEMIXING)
+else if (type == AV_IAMF_PARAMETER_DEFINITION_DEMIXING) {
+if (element->demixing_info) {
+ret = AVERROR_INVALIDDATA;
+goto fail;
+}
 ret = param_parse(s, c, pbc, type, audio_element, 
&element->demixing_info);
-else if (type == AV_IAMF_PARAMETER_DEFINITION_RECON_GAIN)
+} else if (type == AV_IAMF_PARAMETER_DEFINITION_RECON_GAIN) {
+if (element->recon_gain_info) {
+ret = AVERROR_INVALIDDATA;
+goto fail;
+}
 ret = param_parse(s, c, pbc, type, audio_element, 
&element->recon_gain_info);
-else {
+} else {
 unsigned param_definition_size = ffio_read_leb(pbc);
 avio_skip(pbc, param_definition_size);
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/demux: don't discard empty Theora packets

2025-02-19 Thread James Almer
ffmpeg | branch: master | James Almer  | Fri Feb 14 00:14:35 
2025 -0300| [6e26f57f672b05e7b8b052007a83aef99dc81ccb] | committer: James Almer

avformat/demux: don't discard empty Theora packets

Theora signals "Output last frame again" with an empty packet.

Finishes fixing ticket #11451.

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6e26f57f672b05e7b8b052007a83aef99dc81ccb
---

 libavformat/demux.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libavformat/demux.c b/libavformat/demux.c
index d8ab29431e..0e39346f62 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -1173,7 +1173,15 @@ static int parse_packet(AVFormatContext *s, AVPacket 
*pkt,
 
 if (!size && !flush && sti->parser->flags & PARSER_FLAG_COMPLETE_FRAMES) {
 // preserve 0-size sync packets
-compute_pkt_fields(s, st, sti->parser, pkt, AV_NOPTS_VALUE, 
AV_NOPTS_VALUE);
+compute_pkt_fields(s, st, sti->parser, pkt, pkt->dts, pkt->pts);
+
+// Theora has valid 0-sized packets that need to be output
+if (st->codecpar->codec_id == AV_CODEC_ID_THEORA) {
+ret = avpriv_packet_list_put(&fci->parse_queue,
+ pkt, NULL, 0);
+if (ret < 0)
+goto fail;
+}
 }
 
 while (size > 0 || (flush && got_output)) {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/codec_internal: remove unnecessary avcodec.h include

2025-02-19 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Feb 18 12:39:56 
2025 -0300| [7e84865cff2d174beede69a2018c0d81c8cc3b02] | committer: James Almer

avcodec/codec_internal: remove unnecessary avcodec.h include

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7e84865cff2d174beede69a2018c0d81c8cc3b02
---

 libavcodec/allcodecs.c  | 1 +
 libavcodec/codec_internal.h | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 4e1b1c9b45..3be33f5cc4 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -29,6 +29,7 @@
 
 #include "config.h"
 #include "libavutil/thread.h"
+#include "avcodec.h"
 #include "codec.h"
 #include "codec_id.h"
 #include "codec_internal.h"
diff --git a/libavcodec/codec_internal.h b/libavcodec/codec_internal.h
index 5b2db74590..473d72fdbb 100644
--- a/libavcodec/codec_internal.h
+++ b/libavcodec/codec_internal.h
@@ -22,7 +22,6 @@
 #include 
 
 #include "libavutil/attributes.h"
-#include "avcodec.h"
 #include "codec.h"
 #include "config.h"
 
@@ -102,6 +101,7 @@ typedef struct FFCodecDefault {
 struct AVCodecContext;
 struct AVSubtitle;
 struct AVPacket;
+enum AVCodecConfig;
 
 enum FFCodecType {
 /* The codec is a decoder using the decode callback;
@@ -268,7 +268,7 @@ typedef struct FFCodec {
  * ff_default_get_supported_config() will be used. `out_num_configs` will
  * always be set to a valid pointer.
  */
-int (*get_supported_config)(const AVCodecContext *avctx,
+int (*get_supported_config)(const struct AVCodecContext *avctx,
 const AVCodec *codec,
 enum AVCodecConfig config,
 unsigned flags,
@@ -283,7 +283,7 @@ typedef struct FFCodec {
  * For AVCODEC_CONFIG_COLOR_RANGE, the output will depend on the bitmask in
  * FFCodec.color_ranges, with a value of 0 returning NULL.
  */
-int ff_default_get_supported_config(const AVCodecContext *avctx,
+int ff_default_get_supported_config(const struct AVCodecContext *avctx,
 const AVCodec *codec,
 enum AVCodecConfig config,
 unsigned flags,

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/hevc: Add support for output_corrupt/showall flags

2025-02-19 Thread Zhao Zhili
ffmpeg | branch: master | Zhao Zhili  | Thu Feb 20 
11:39:15 2025 +0800| [bc1a3bfd2cbc01ffa386312662af8a014890d861] | committer: 
Zhao Zhili

avcodec/hevc: Add support for output_corrupt/showall flags

Also handle gradual decoding refresh stream.

Signed-off-by: Zhao Zhili 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bc1a3bfd2cbc01ffa386312662af8a014890d861
---

 libavcodec/hevc/hevcdec.c | 22 +-
 libavcodec/hevc/hevcdec.h |  6 ++
 libavcodec/hevc/refs.c| 24 +++-
 libavcodec/hevc/sei.c |  1 +
 libavcodec/hevc/sei.h |  1 +
 tests/fate/hevc.mak   |  4 ++--
 6 files changed, 54 insertions(+), 4 deletions(-)

diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c
index b22bb9f39a..da8fdc5935 100644
--- a/libavcodec/hevc/hevcdec.c
+++ b/libavcodec/hevc/hevcdec.c
@@ -3306,9 +3306,19 @@ static int hevc_frame_start(HEVCContext *s, 
HEVCLayerContext *l,
 s->first_nal_type= s->nal_unit_type;
 s->poc   = s->sh.poc;
 
-if (IS_IRAP(s))
+if (IS_IRAP(s)) {
 s->no_rasl_output_flag = IS_IDR(s) || IS_BLA(s) ||
  (s->nal_unit_type == HEVC_NAL_CRA_NUT && 
s->last_eos);
+s->recovery_poc = HEVC_RECOVERY_END;
+}
+
+if (s->recovery_poc != HEVC_RECOVERY_END &&
+s->sei.recovery_point.has_recovery_poc) {
+if (s->recovery_poc == HEVC_RECOVERY_UNSPECIFIED)
+s->recovery_poc = s->poc + s->sei.recovery_point.recovery_poc_cnt;
+else if (s->poc >= s->recovery_poc)
+s->recovery_poc = HEVC_RECOVERY_END;
+}
 
 /* 8.3.1 */
 if (s->temporal_id == 0 &&
@@ -3684,6 +3694,12 @@ fail:
 return ret;
 }
 
+static void decode_reset_recovery_point(HEVCContext *s)
+{
+s->recovery_poc = HEVC_RECOVERY_UNSPECIFIED;
+s->sei.recovery_point.has_recovery_poc = 0;
+}
+
 static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length)
 {
 int i, ret = 0;
@@ -3694,6 +3710,8 @@ static int decode_nal_units(HEVCContext *s, const uint8_t 
*buf, int length)
 s->last_eos = s->eos;
 s->eos = 0;
 s->slice_initialized = 0;
+if (s->last_eos)
+decode_reset_recovery_point(s);
 
 for (int i = 0; i < FF_ARRAY_ELEMS(s->layers); i++) {
 HEVCLayerContext *l = &s->layers[i];
@@ -3715,6 +3733,7 @@ static int decode_nal_units(HEVCContext *s, const uint8_t 
*buf, int length)
 s->pkt.nals[i].type == HEVC_NAL_EOS_NUT) {
 if (eos_at_start) {
 s->last_eos = 1;
+decode_reset_recovery_point(s);
 } else {
 s->eos = 1;
 }
@@ -4088,6 +4107,7 @@ static int hevc_update_thread_context(AVCodecContext *dst,
 s->sei.common.alternative_transfer = s0->sei.common.alternative_transfer;
 s->sei.tdrdi   = s0->sei.tdrdi;
 s->sei.recovery_point  = s0->sei.recovery_point;
+s->recovery_poc= s0->recovery_poc;
 
 return 0;
 }
diff --git a/libavcodec/hevc/hevcdec.h b/libavcodec/hevc/hevcdec.h
index b2b725b5cd..5bfaf89d79 100644
--- a/libavcodec/hevc/hevcdec.h
+++ b/libavcodec/hevc/hevcdec.h
@@ -78,6 +78,10 @@
(s)->nal_unit_type == HEVC_NAL_BLA_N_LP)
 #define IS_IRAP(s) ((s)->nal_unit_type >= HEVC_NAL_BLA_W_LP && 
(s)->nal_unit_type <= HEVC_NAL_RSV_IRAP_VCL23)
 
+#define HEVC_RECOVERY_UNSPECIFIED INT_MAX
+#define HEVC_RECOVERY_END INT_MIN
+#define HEVC_IS_RECOVERING(s) ((s)->recovery_poc != HEVC_RECOVERY_UNSPECIFIED 
&& (s)->recovery_poc != HEVC_RECOVERY_END)
+
 enum RPSType {
 ST_CURR_BEF = 0,
 ST_CURR_AFT,
@@ -353,6 +357,7 @@ typedef struct DBParams {
 #define HEVC_FRAME_FLAG_SHORT_REF (1 << 1)
 #define HEVC_FRAME_FLAG_LONG_REF  (1 << 2)
 #define HEVC_FRAME_FLAG_UNAVAILABLE (1 << 3)
+#define HEVC_FRAME_FLAG_CORRUPT (1 << 4)
 
 typedef struct HEVCFrame {
 union {
@@ -523,6 +528,7 @@ typedef struct HEVCContext {
 int slice_idx; ///< number of the slice being currently decoded
 int eos;   ///< current packet contains an EOS/EOB NAL
 int last_eos;  ///< last packet contains an EOS/EOB NAL
+int recovery_poc;
 
 // NoRaslOutputFlag associated with the last IRAP frame
 int no_rasl_output_flag;
diff --git a/libavcodec/hevc/refs.c b/libavcodec/hevc/refs.c
index 1277cb2e7f..6f291bbf79 100644
--- a/libavcodec/hevc/refs.c
+++ b/libavcodec/hevc/refs.c
@@ -34,6 +34,8 @@
 void ff_hevc_unref_frame(HEVCFrame *frame, int flags)
 {
 frame->flags &= ~flags;
+if (!(frame->flags & ~HEVC_FRAME_FLAG_CORRUPT))
+frame->flags = 0;
 if (!frame->flags) {
 ff_progress_frame_unref(&frame->tf);
 av_frame_unref(frame->frame_grain);
@@ -208,6 +210,7 @@ int ff_hevc_set_new_ref(HEVCContext *s, HEVCLayerContext 
*l, int poc)
 {
 HEVCFrame *ref;
 int i;
+int no_output;
 
 /* check that this POC doesn't already exist */
 for (i = 0; i < FF_ARRAY_ELEMS(l->DPB); i++) {
@@ -231,7 

[FFmpeg-cvslog] avcodec/hevc: Parse recovery point SEI

2025-02-19 Thread Zhao Zhili
ffmpeg | branch: master | Zhao Zhili  | Thu Jan 23 
22:12:09 2025 +0800| [b6652115de64b6dee5a212643280e3c50c169935] | committer: 
Zhao Zhili

avcodec/hevc: Parse recovery point SEI

Signed-off-by: Zhao Zhili 

> 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;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".