Re: [FFmpeg-devel] [PATCH WIP 5/5] avcodec/hevc: Add alpha layer support

2024-12-14 Thread Zhao Zhili


> On Dec 14, 2024, at 17:43, Anton Khirnov  wrote:
> 
> Quoting Zhao Zhili (2024-12-11 05:23:33)
>> From: Zhao Zhili 
>> 
>> ---
>> libavcodec/hevc/hevcdec.c | 75 ++-
>> libavcodec/hevc/hevcdec.h |  2 ++
>> libavcodec/hevc/refs.c| 10 +-
>> 3 files changed, 85 insertions(+), 2 deletions(-)
>> 
>> diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c
>> index be35a9de82..782c9382bc 100644
>> --- a/libavcodec/hevc/hevcdec.c
>> +++ b/libavcodec/hevc/hevcdec.c
>> @@ -458,6 +458,26 @@ static int export_multilayer(HEVCContext *s, const 
>> HEVCVPS *vps)
>> return 0;
>> }
>> 
>> +int ff_hevc_is_alpha_video(const HEVCContext *s) {
>> +const HEVCVPS *vps;
>> +int ret = 0;
>> +
>> +if (!s->vps)
>> +return 0;
> 
> This seems like something that should not happen.
> 
>> +vps = s->vps;
>> +if (vps->nb_layers != 2 || !vps->layer_id_in_nuh[1])
>> +return 0;
>> +
>> +ret = (s->vps->scalability_mask_flag & HEVC_SCALABILITY_AUXILIARY) &&
>> +  s->sei.alpha.has_alpha_channel_info;
> 
> Is the SEI really necessary? I thought it's enough to have an auxiliary
> picture with AuxId=AUX_ALPHA.
> 

V2 dropped the SEI patch.

> Also, I'd prefer the interaction with multiview to be clearer, with e.g.
> a warning message when both are present, and fewer assumptions about
> only one of them being present spread over the code.

V2 added a warning message in vps extension decode.

x265 set both MULTIVIEW and AUXILIARY for alpha video, which should be a 
mistake.

I don’t know how to create a multiview alpha video.

> 
> -- 
> Anton Khirnov
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org 
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org  with 
> subject "unsubscribe".

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

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


[FFmpeg-devel] [PATCH v2 3/3] avcodec/hevc: Add alpha layer support

2024-12-14 Thread Zhao Zhili
From: Zhao Zhili 

---
 libavcodec/hevc/hevcdec.c | 72 ++-
 libavcodec/hevc/hevcdec.h |  2 ++
 libavcodec/hevc/refs.c| 10 +-
 3 files changed, 82 insertions(+), 2 deletions(-)

diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c
index be35a9de82..3675ac1e2b 100644
--- a/libavcodec/hevc/hevcdec.c
+++ b/libavcodec/hevc/hevcdec.c
@@ -458,6 +458,24 @@ static int export_multilayer(HEVCContext *s, const HEVCVPS 
*vps)
 return 0;
 }
 
+int ff_hevc_is_alpha_video(const HEVCContext *s) {
+const HEVCVPS *vps = s->vps;
+int ret = 0;
+
+if (vps->nb_layers != 2 || !vps->layer_id_in_nuh[1])
+return 0;
+
+/* decode_vps_ext() guarantees that SCALABILITY_AUXILIARY with AuxId other
+ * than alpha cannot reach here.
+ */
+ret = (s->vps->scalability_mask_flag & HEVC_SCALABILITY_AUXILIARY);
+
+av_log(s->avctx, AV_LOG_DEBUG, "Multi layer video, %s alpha video\n",
+   ret ? "is" : "not");
+
+return ret;
+}
+
 static int setup_multilayer(HEVCContext *s, const HEVCVPS *vps)
 {
 unsigned layers_active_output = 0, highest_layer;
@@ -465,6 +483,18 @@ static int setup_multilayer(HEVCContext *s, const HEVCVPS 
*vps)
 s->layers_active_output = 1;
 s->layers_active_decode = 1;
 
+if (ff_hevc_is_alpha_video(s)) {
+const AVPixFmtDescriptor *desc = 
av_pix_fmt_desc_get(s->avctx->pix_fmt);
+
+if (!(desc->flags & AV_PIX_FMT_FLAG_ALPHA))
+return 0;
+
+s->layers_active_decode = (1 << vps->nb_layers) - 1;
+s->layers_active_output = 1;
+
+return 0;
+}
+
 // nothing requested - decode base layer only
 if (!s->nb_view_ids)
 return 0;
@@ -522,6 +552,34 @@ static int setup_multilayer(HEVCContext *s, const HEVCVPS 
*vps)
 return 0;
 }
 
+static enum AVPixelFormat map_to_alpha_format(HEVCContext *s,
+  enum AVPixelFormat pix_fmt)
+{
+switch (pix_fmt) {
+case AV_PIX_FMT_YUV420P:
+case AV_PIX_FMT_YUVJ420P:
+return AV_PIX_FMT_YUVA420P;
+case AV_PIX_FMT_YUV420P10:
+return AV_PIX_FMT_YUVA420P10;
+case AV_PIX_FMT_YUV444P:
+return AV_PIX_FMT_YUVA444P;
+case AV_PIX_FMT_YUV422P:
+return AV_PIX_FMT_YUVA422P;
+case AV_PIX_FMT_YUV422P10LE:
+return AV_PIX_FMT_YUVA422P10LE;
+case AV_PIX_FMT_YUV444P10:
+return AV_PIX_FMT_YUVA444P10;
+case AV_PIX_FMT_YUV444P12:
+return AV_PIX_FMT_YUVA444P12;
+case AV_PIX_FMT_YUV422P12:
+return AV_PIX_FMT_YUVA422P12;
+default:
+av_log(s->avctx, AV_LOG_WARNING, "No alpha pixel format map for %s\n",
+   av_get_pix_fmt_name(pix_fmt));
+return AV_PIX_FMT_NONE;
+}
+}
+
 static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps)
 {
 #define HWACCEL_MAX (CONFIG_HEVC_DXVA2_HWACCEL + \
@@ -532,9 +590,13 @@ static enum AVPixelFormat get_format(HEVCContext *s, const 
HEVCSPS *sps)
  CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL + \
  CONFIG_HEVC_VDPAU_HWACCEL + \
  CONFIG_HEVC_VULKAN_HWACCEL)
-enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmt = pix_fmts;
+enum AVPixelFormat pix_fmts[HWACCEL_MAX + 3], *fmt = pix_fmts;
+enum AVPixelFormat alpha_fmt = AV_PIX_FMT_NONE;
 int ret;
 
+if (ff_hevc_is_alpha_video(s))
+alpha_fmt = map_to_alpha_format(s, sps->pix_fmt);
+
 switch (sps->pix_fmt) {
 case AV_PIX_FMT_YUV420P:
 case AV_PIX_FMT_YUVJ420P:
@@ -650,6 +712,8 @@ static enum AVPixelFormat get_format(HEVCContext *s, const 
HEVCSPS *sps)
 break;
 }
 
+if (alpha_fmt != AV_PIX_FMT_NONE)
+*fmt++ = alpha_fmt;
 *fmt++ = sps->pix_fmt;
 *fmt = AV_PIX_FMT_NONE;
 
@@ -3182,6 +3246,12 @@ static int hevc_frame_start(HEVCContext *s, 
HEVCLayerContext *l,
 !sps->vui.common.video_signal_type_present_flag)
 pix_fmt = sps_base->pix_fmt;
 
+// Ignore range mismatch between base layer and alpha layer
+if (ff_hevc_is_alpha_video(s) &&
+sps_base->pix_fmt == AV_PIX_FMT_YUV420P &&
+pix_fmt == AV_PIX_FMT_YUVJ420P)
+pix_fmt = sps_base->pix_fmt;
+
 if (pix_fmt != sps_base->pix_fmt ||
 sps->width  != sps_base->width   ||
 sps->height != sps_base->height) {
diff --git a/libavcodec/hevc/hevcdec.h b/libavcodec/hevc/hevcdec.h
index 473709b4e8..f8ed156a1c 100644
--- a/libavcodec/hevc/hevcdec.h
+++ b/libavcodec/hevc/hevcdec.h
@@ -714,6 +714,8 @@ void ff_hevc_hls_residual_coding(HEVCLocalContext *lc, 
const HEVCPPS *pps,
 
 void ff_hevc_hls_mvd_coding(HEVCLocalContext *lc, int x0, int y0, int 
log2_cb_size);
 
+int ff_hevc_is_alpha_video(const HEVCContext *s);
+
 extern const uint8_t ff_hevc_qpel_extra_before[4];
 extern const uint8_t ff_hevc_qpel_extra_after[4];
 extern const uint8_t ff_hevc_qpel_extra[4];
diff --git a/lib

[FFmpeg-devel] [PATCH v2 2/3] avcodec/hevc/ps: Add basic HEVC_SCALABILITY_AUXILIARY support

2024-12-14 Thread Zhao Zhili
From: Zhao Zhili 

Only implementing what's needed for HEVC with alpha.
---
 libavcodec/hevc/hevc.h |   5 ++
 libavcodec/hevc/ps.c   | 126 +
 libavcodec/hevc/ps.h   |   4 ++
 3 files changed, 98 insertions(+), 37 deletions(-)

diff --git a/libavcodec/hevc/hevc.h b/libavcodec/hevc/hevc.h
index b2229fda40..710786a89d 100644
--- a/libavcodec/hevc/hevc.h
+++ b/libavcodec/hevc/hevc.h
@@ -170,4 +170,9 @@ enum HEVCScalabilityMask {
 HEVC_SCALABILITY_MASK_MAX   = 0x,
 };
 
+enum HEVCAuxId {
+HEVC_AUX_ALPHA = 1,
+HEVC_AUX_DEPTH = 2,
+};
+
 #endif /* AVCODEC_HEVC_HEVC_H */
diff --git a/libavcodec/hevc/ps.c b/libavcodec/hevc/ps.c
index 5b1bcd9b7c..4ece9f14dc 100644
--- a/libavcodec/hevc/ps.c
+++ b/libavcodec/hevc/ps.c
@@ -460,14 +460,17 @@ static int decode_vps_ext(GetBitContext *gb, 
AVCodecContext *avctx, HEVCVPS *vps
   uint64_t layer1_id_included)
 {
 PTL ptl_dummy;
-uint8_t max_sub_layers[HEVC_MAX_LAYERS];
+uint8_t max_sub_layers[HEVC_MAX_LAYERS] = {1, 1};
+uint8_t dimension_id_len[16] = {0};
+uint8_t dimension_id[16] = {0};
+unsigned n;
 
-int splitting_flag, dimension_id_len, view_id_len, num_add_olss, 
num_scalability_types,
+int splitting_flag, view_id_len, num_add_olss, num_scalability_types,
 default_output_layer_idc, direct_dep_type_len, direct_dep_type,
 sub_layers_max_present, sub_layer_flag_info_present_flag, nb_ptl;
 unsigned non_vui_extension_length;
 
-if (vps->vps_max_layers == 1 || vps->vps_num_layer_sets == 1) {
+if (vps->vps_max_layers == 1) {
 av_log(avctx, AV_LOG_VERBOSE, "Ignoring VPS extensions with a single 
layer\n");
 return 0;
 }
@@ -520,7 +523,8 @@ static int decode_vps_ext(GetBitContext *gb, AVCodecContext 
*avctx, HEVCVPS *vps
  */
 vps->nb_layers = 2;
 
-if (parse_ptl(gb, avctx, 0, &ptl_dummy, vps->vps_max_sub_layers) < 0)
+if (vps->vps_base_layer_internal_flag &&
+parse_ptl(gb, avctx, 0, &ptl_dummy, vps->vps_max_sub_layers) < 0)
 return AVERROR_INVALIDDATA;
 
 splitting_flag = get_bits1(gb);
@@ -529,20 +533,25 @@ static int decode_vps_ext(GetBitContext *gb, 
AVCodecContext *avctx, HEVCVPS *vps
 if (!num_scalability_types) {
 av_log(avctx, AV_LOG_ERROR, "Missing scalability mask\n");
 return AVERROR_INVALIDDATA;
-} else if (num_scalability_types > 1) {
-av_log(avctx, AV_LOG_ERROR, "Scalability number %d not supported\n",
-   num_scalability_types);
-return AVERROR_PATCHWELCOME;
 }
 
-if (!(vps->scalability_mask_flag & HEVC_SCALABILITY_MULTIVIEW)) {
+if (!(vps->scalability_mask_flag &
+  (HEVC_SCALABILITY_MULTIVIEW | HEVC_SCALABILITY_AUXILIARY))) {
 av_log(avctx, AV_LOG_ERROR, "Scalability type %d not supported\n",
15 - ff_ctz(vps->scalability_mask_flag));
 return AVERROR_PATCHWELCOME;
 }
+// x265 specify MULTIVIEW when the stream really is alpha video only.
+if (num_scalability_types > 1)
+av_log(avctx, AV_LOG_WARNING, "Multiple scalability types 
presented\n");
 
-if (!splitting_flag)
-dimension_id_len = get_bits(gb, 3) + 1;
+n = 0;
+for (int i = 0; i < num_scalability_types - splitting_flag; i++) {
+dimension_id_len[i] = get_bits(gb, 3) + 1;
+n += dimension_id_len[i];
+}
+if (splitting_flag)
+dimension_id_len[num_scalability_types - 1] = 5 - n;
 
 if (get_bits1(gb)) { /* vps_nuh_layer_id_present_flag */
 int layer_id_in_nuh = get_bits(gb, 6);
@@ -559,28 +568,57 @@ static int decode_vps_ext(GetBitContext *gb, 
AVCodecContext *avctx, HEVCVPS *vps
 }
 
 if (!splitting_flag) {
-int view_idx = get_bits(gb, dimension_id_len);
-if (view_idx != 1) {
-av_log(avctx, AV_LOG_ERROR, "Unexpected ViewOrderIdx: %d\n", 
view_idx);
+int index = 0;
+
+for (int i = 0; i < num_scalability_types; i++)
+dimension_id[i] = get_bits(gb, dimension_id_len[i]);
+
+if (vps->scalability_mask_flag & HEVC_SCALABILITY_MULTIVIEW)
+index++;
+
+/* AuxId 1 is alpha, 2 is depth. Only support alpha */
+if (vps->scalability_mask_flag & HEVC_SCALABILITY_AUXILIARY &&
+dimension_id[index] != HEVC_AUX_ALPHA) {
+av_log(avctx, AV_LOG_WARNING,
+   "Unsupported dimension_id %d for 
HEVC_SCALABILITY_AUXILIARY\n",
+   dimension_id[index]);
 return AVERROR_PATCHWELCOME;
 }
 }
 
 view_id_len = get_bits(gb, 4);
-if (view_id_len)
-for (int i = 0; i < 2 /* NumViews */; i++)
+if (view_id_len) {
+n = (vps->scalability_mask_flag & HEVC_SCALABILITY_MULTIVIEW) ? 2 : 1;
+for (int i = 0; i < n; i++)
 vps->view_id[i] = get_bits(gb, view_id_len);
+}
 
-if (!get_bits1(gb) /* direct_dependency_flag */) {
-av_log(avctx, AV_LOG_WARNI

[FFmpeg-devel] [PATCH v2 1/3] avcodec/hevc: Rewrite scalability_mask_flag parse in decode_vps_ext

2024-12-14 Thread Zhao Zhili
From: Zhao Zhili 

Remove a for loop and make it easy to extend to support other types
of scalability. Move ScalabilityMask to hevc header file so it can
be used in hevc decoder.
---
 libavcodec/hevc/hevc.h |  7 +++
 libavcodec/hevc/ps.c   | 33 +++--
 libavcodec/hevc/ps.h   |  2 ++
 3 files changed, 24 insertions(+), 18 deletions(-)

diff --git a/libavcodec/hevc/hevc.h b/libavcodec/hevc/hevc.h
index 8bd59142db..b2229fda40 100644
--- a/libavcodec/hevc/hevc.h
+++ b/libavcodec/hevc/hevc.h
@@ -162,5 +162,12 @@ enum {
 HEVC_MAX_PALETTE_PREDICTOR_SIZE = 128,
 };
 
+enum HEVCScalabilityMask {
+HEVC_SCALABILITY_DEPTH  = 1 << (15 - 0),
+HEVC_SCALABILITY_MULTIVIEW  = 1 << (15 - 1),
+HEVC_SCALABILITY_SPATIAL= 1 << (15 - 2),
+HEVC_SCALABILITY_AUXILIARY  = 1 << (15 - 3),
+HEVC_SCALABILITY_MASK_MAX   = 0x,
+};
 
 #endif /* AVCODEC_HEVC_HEVC_H */
diff --git a/libavcodec/hevc/ps.c b/libavcodec/hevc/ps.c
index a1d352eec5..5b1bcd9b7c 100644
--- a/libavcodec/hevc/ps.c
+++ b/libavcodec/hevc/ps.c
@@ -450,14 +450,6 @@ static void hevc_vps_free(FFRefStructOpaque opaque, void 
*obj)
 av_freep(&vps->data);
 }
 
-enum ScalabilityMask {
-HEVC_SCALABILITY_DEPTH  = 0,
-HEVC_SCALABILITY_MULTIVIEW  = 1,
-HEVC_SCALABILITY_SPATIAL= 2,
-HEVC_SCALABILITY_AUXILIARY  = 3,
-HEVC_SCALABILITY_MASK_MAX   = 15,
-};
-
 enum DependencyType {
 HEVC_DEP_TYPE_SAMPLE = 0,
 HEVC_DEP_TYPE_MV = 1,
@@ -532,17 +524,22 @@ static int decode_vps_ext(GetBitContext *gb, 
AVCodecContext *avctx, HEVCVPS *vps
 return AVERROR_INVALIDDATA;
 
 splitting_flag = get_bits1(gb);
-num_scalability_types = 0;
-for (int i = 0; i <= HEVC_SCALABILITY_MASK_MAX; i++) {
-int scalability_mask_flag = get_bits1(gb);
-if (scalability_mask_flag && (i != HEVC_SCALABILITY_MULTIVIEW)) {
-av_log(avctx, AV_LOG_ERROR, "Scalability type %d not supported\n", 
i);
-return AVERROR_PATCHWELCOME;
-}
-num_scalability_types += scalability_mask_flag;
-}
-if (num_scalability_types != 1)
+vps->scalability_mask_flag = get_bits(gb, 16);
+num_scalability_types = av_popcount(vps->scalability_mask_flag);
+if (!num_scalability_types) {
+av_log(avctx, AV_LOG_ERROR, "Missing scalability mask\n");
 return AVERROR_INVALIDDATA;
+} else if (num_scalability_types > 1) {
+av_log(avctx, AV_LOG_ERROR, "Scalability number %d not supported\n",
+   num_scalability_types);
+return AVERROR_PATCHWELCOME;
+}
+
+if (!(vps->scalability_mask_flag & HEVC_SCALABILITY_MULTIVIEW)) {
+av_log(avctx, AV_LOG_ERROR, "Scalability type %d not supported\n",
+   15 - ff_ctz(vps->scalability_mask_flag));
+return AVERROR_PATCHWELCOME;
+}
 
 if (!splitting_flag)
 dimension_id_len = get_bits(gb, 3) + 1;
diff --git a/libavcodec/hevc/ps.h b/libavcodec/hevc/ps.h
index 6f5b1f8755..d3465e3d27 100644
--- a/libavcodec/hevc/ps.h
+++ b/libavcodec/hevc/ps.h
@@ -205,6 +205,8 @@ typedef struct HEVCVPS {
  */
 int nb_layers;
 
+uint16_t scalability_mask_flag;
+
 // LayerIdxInVps[nuh_layer_id], i.e. a mapping of nuh_layer_id to VPS layer
 // indices. Valid values are between 0 and HEVC_VPS_MAX_LAYERS. Entries for
 // unmapped values of nuh_layer_id are set to -1.
-- 
2.46.0

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

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


[FFmpeg-devel] [PATCH v2 0/3] avcodec/hevc: Add alpha video decoding support

2024-12-14 Thread Zhao Zhili
From: Zhao Zhili 

v2:
1. It works with x265 streams
2. Remove the requirement on SEI. SEI alpha channel information is
required on the producer side but not for decoder.

Zhao Zhili (3):
  avcodec/hevc: Rewrite scalability_mask_flag parse in decode_vps_ext
  avcodec/hevc/ps: Add basic HEVC_SCALABILITY_AUXILIARY support
  avcodec/hevc: Add alpha layer support

 libavcodec/hevc/hevc.h|  12 +++
 libavcodec/hevc/hevcdec.c |  72 +-
 libavcodec/hevc/hevcdec.h |   2 +
 libavcodec/hevc/ps.c  | 149 +-
 libavcodec/hevc/ps.h  |   6 ++
 libavcodec/hevc/refs.c|  10 ++-
 6 files changed, 199 insertions(+), 52 deletions(-)

-- 
2.46.0

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

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


Re: [FFmpeg-devel] [PATCH WIP 4/5] avcodec/hevc/sei: Add support for alpha channel information

2024-12-14 Thread Zhao Zhili



> On Dec 14, 2024, at 23:20, James Almer  wrote:
> 
> On 12/11/2024 1:23 AM, Zhao Zhili wrote:
>> From: Zhao Zhili 
>> ---
>>  libavcodec/hevc/sei.c | 30 ++
>>  libavcodec/hevc/sei.h | 14 ++
>>  2 files changed, 44 insertions(+)
>> diff --git a/libavcodec/hevc/sei.c b/libavcodec/hevc/sei.c
>> index e11a33773c..56983fe96e 100644
>> --- a/libavcodec/hevc/sei.c
>> +++ b/libavcodec/hevc/sei.c
>> @@ -150,6 +150,34 @@ static int decode_nal_sei_timecode(HEVCSEITimeCode *s, 
>> GetBitContext *gb)
>>  return 0;
>>  }
>>  +static int decode_nal_sei_alpha_info(HEVCSEIAlphaChannelInfo *s, 
>> GetBitContext *gb)
>> +{
>> +int length;
>> +
>> +s->has_alpha_channel_info = true;
>> +
>> +s->alpha_channel_cancel_flag = get_bits1(gb);
>> +if (!s->alpha_channel_cancel_flag) {
> 
> This should trigger when alpha_channel_cancel_flag is 1.

Yes, I made a mistake.

> 
>> +s->alpha_channel_use_idc = 2;
>> +s->alpha_channel_incr_flag = 0;
>> +s->alpha_channel_clip_flag = 0;
>> +
>> +return 0;
>> +}
>> +
>> +s->alpha_channel_use_idc = get_bits(gb, 3);
>> +s->alpha_channel_bit_depth_minus8 = get_bits(gb, 3);
>> +length = s->alpha_channel_bit_depth_minus8 + 9;
>> +s->alpha_transparent_value = get_bits(gb, length);
>> +s->alpha_opaque_value = get_bits(gb, length);
>> +s->alpha_channel_incr_flag = get_bits1(gb);
>> +s->alpha_channel_clip_flag = get_bits1(gb);
>> +if (s->alpha_channel_clip_flag)
>> +s->alpha_channel_clip_type_flag = get_bits1(gb);
>> +
>> +return 0;
>> +}
>> +
>>  static int decode_nal_sei_3d_reference_displays_info(HEVCSEITDRDI *s, 
>> GetBitContext *gb)
>>  {
>>  s->prec_ref_display_width = get_ue_golomb(gb);
>> @@ -216,6 +244,8 @@ static int decode_nal_sei_prefix(GetBitContext *gb, 
>> GetByteContext *gbyte,
>>  return decode_nal_sei_active_parameter_sets(s, gb, logctx);
>>  case SEI_TYPE_TIME_CODE:
>>  return decode_nal_sei_timecode(&s->timecode, gb);
>> +case SEI_TYPE_ALPHA_CHANNEL_INFO:
>> +return decode_nal_sei_alpha_info(&s->alpha, gb);
>>  case SEI_TYPE_THREE_DIMENSIONAL_REFERENCE_DISPLAYS_INFO:
>>  return decode_nal_sei_3d_reference_displays_info(&s->tdrdi, gb);
>>  default: {
>> diff --git a/libavcodec/hevc/sei.h b/libavcodec/hevc/sei.h
>> index ee640003bc..54122c27df 100644
>> --- a/libavcodec/hevc/sei.h
>> +++ b/libavcodec/hevc/sei.h
>> @@ -21,6 +21,7 @@
>>  #ifndef AVCODEC_HEVC_SEI_H
>>  #define AVCODEC_HEVC_SEI_H
>>  +#include 
> 
> Are we using bool anywhere else? Afaik, we just use uint8_t everywhere since 
> it's going to be a whole byte anyway.

Patchset v2 xzdropped 

> 
>>  #include 
>>#include "libavutil/buffer.h"
>> @@ -95,6 +96,18 @@ typedef struct HEVCSEITDRDI {
>>  uint8_t three_dimensional_reference_displays_extension_flag;
>>  } HEVCSEITDRDI;
>>  +typedef struct HEVCSEIAlphaChannelInfo {
>> +bool has_alpha_channel_info;
>> +uint8_t  alpha_channel_cancel_flag;
>> +uint8_t  alpha_channel_use_idc;
>> +uint8_t  alpha_channel_bit_depth_minus8;
>> +uint16_t alpha_transparent_value;
>> +uint16_t alpha_opaque_value;
>> +uint8_t  alpha_channel_incr_flag;
>> +uint8_t  alpha_channel_clip_flag;
>> +uint8_t  alpha_channel_clip_type_flag;
>> +} HEVCSEIAlphaChannelInfo;
>> +
>>  typedef struct HEVCSEI {
>>  H2645SEI common;
>>  HEVCSEIPictureHash picture_hash;
>> @@ -102,6 +115,7 @@ typedef struct HEVCSEI {
>>  int active_seq_parameter_set_id;
>>  HEVCSEITimeCode timecode;
>>  HEVCSEITDRDI tdrdi;
>> +HEVCSEIAlphaChannelInfo alpha;
>>  } HEVCSEI;
>>struct HEVCParamSets;
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

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

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


[FFmpeg-devel] (no subject)

2024-12-14 Thread 阿儒


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

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


[FFmpeg-devel] [PATCH 2/2] libavcodec/v4l2: use libdrm

2024-12-14 Thread Scott Theisen
Based on patches by Lukas Rusak from
https://github.com/lrusak/FFmpeg/commits/v4l2-drmprime-v4

libavcodec: v4l2m2m: output AVDRMFrameDescriptor
https://github.com/lrusak/FFmpeg/commit/2cb8052ac65a56d8a3f347a1e6f12d4449a5a614

libavcodec: v4l2m2m: depends on libdrm
https://github.com/lrusak/FFmpeg/commit/ab4cf3e6fb37cffdebccca52e36a7b2deb7e729f

libavcodec: v4l2m2m: set format_modifier to DRM_FORMAT_MOD_LINEAR
https://github.com/lrusak/FFmpeg/commit/9438a6efa29c7c7ec80c39c9b013b9a12d7b5f33

libavcodec: v4l2m2m: only mmap the buffer when it is output type and drm prime 
is used
https://github.com/lrusak/FFmpeg/commit/093656607863e47630de2d1cfcf0ac8e4b93a69e

libavcodec: v4l2m2m: allow using software pixel formats
https://github.com/lrusak/FFmpeg/commit/8405b573e83838e6b2fea99825fbef32ee9f7767

libavcodec: v4l2m2m: implement hwcontext
https://github.com/lrusak/FFmpeg/commit/b2c1f1eb39b54bf034497a7f2a7f23855d0a7cde

libavcodec: v4l2m2m: implement flush
https://github.com/lrusak/FFmpeg/commit/e793ef82727d6d6f55c40844463d476e7e84efad

Originally added to MythTV in:
FFmpeg: Patch FFmpeg for V4L2 codecs DRM PRIME support
https://github.com/MythTV/mythtv/commit/cc7572f9b26189ad5d5d504c05f08e53e4e61b54

FFmpeg: Re-apply v4l2 memory to memory DRM_PRIME support
https://github.com/MythTV/mythtv/commit/1c942720591b5b7820abe9ed0d805afabbdffe3c

modified in:
V4L2 Codecs: Fix lockup when seeking
https://github.com/MythTV/mythtv/commit/fdc0645aba9a9ad373888bd62ebcbc83a3feb7e5

v4l2_buffers: Add some libdrm ifdef's
https://github.com/MythTV/mythtv/commit/336df1067abfa4fe7cf611541e5b6f3561fc81a2


NB: libavcodec/v4l2_m2m_dec.c: v4l2_decode_init(): I'm returning -1
since I don't know what error code I should use.

Note also Lucas Rusak's v5 series:
closer diff to current state, otherwise unchanged
libavcodec: v4l2m2m: output AVDRMFrameDescriptor
https://github.com/lrusak/FFmpeg/commit/c6b85ed30f06ea99513b13cc768a922ebe4d68c2

new option:
libavcodec: v4l2m2m: add option to specify pixel format used by the decoder
https://github.com/lrusak/FFmpeg/commit/ffc4419f456c00ab71cf93f792b0473c6de14e64

additional code vs v4
libavcodec: v4l2m2m: implement flush
https://github.com/lrusak/FFmpeg/commit/8595d06d4909bbec0aa14625fcfc869c6bcef696
---
 configure |   1 +
 libavcodec/v4l2_buffers.c | 206 +++---
 libavcodec/v4l2_buffers.h |   4 +
 libavcodec/v4l2_context.c |  43 +++-
 libavcodec/v4l2_context.h |   2 +
 libavcodec/v4l2_m2m.h |   5 +
 libavcodec/v4l2_m2m_dec.c |  62 
 7 files changed, 305 insertions(+), 18 deletions(-)

diff --git a/configure b/configure
index bf55ba67fa..5f02cf3b51 100755
--- a/configure
+++ b/configure
@@ -3770,6 +3770,7 @@ sndio_indev_deps="sndio"
 sndio_outdev_deps="sndio"
 v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
 v4l2_indev_suggest="libv4l2"
+v4l2_outdev_deps="libdrm"
 v4l2_outdev_deps_any="linux_videodev2_h sys_videoio_h"
 v4l2_outdev_suggest="libv4l2"
 vfwcap_indev_deps="vfw32 vfwcap_defines"
diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c
index 56a8f0825c..1a1a29c4e6 100644
--- a/libavcodec/v4l2_buffers.c
+++ b/libavcodec/v4l2_buffers.c
@@ -21,6 +21,10 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "config.h"
+#if CONFIG_LIBDRM
+#include 
+#endif
 #include 
 #include 
 #include 
@@ -29,6 +33,8 @@
 #include 
 #include "libavcodec/avcodec.h"
 #include "libavutil/pixdesc.h"
+#include "libavutil/hwcontext.h"
+#include "libavutil/buffer.h"
 #include "refstruct.h"
 #include "v4l2_context.h"
 #include "v4l2_buffers.h"
@@ -247,6 +253,80 @@ FF_ENABLE_DEPRECATION_WARNINGS
 }
 }
 
+#if CONFIG_LIBDRM
+static uint8_t * v4l2_get_drm_frame(V4L2Buffer *avbuf)
+{
+AVDRMFrameDescriptor *drm_desc = &avbuf->drm_frame;
+AVDRMLayerDescriptor *layer;
+
+/* fill the DRM frame descriptor */
+drm_desc->nb_objects = avbuf->num_planes;
+drm_desc->nb_layers = 1;
+
+layer = &drm_desc->layers[0];
+layer->nb_planes = avbuf->num_planes;
+
+for (int i = 0; i < avbuf->num_planes; i++) {
+layer->planes[i].object_index = i;
+layer->planes[i].offset = 0;
+layer->planes[i].pitch = avbuf->plane_info[i].bytesperline;
+}
+
+switch (avbuf->context->av_pix_fmt) {
+case AV_PIX_FMT_YUYV422:
+
+layer->format = DRM_FORMAT_YUYV;
+layer->nb_planes = 1;
+
+break;
+
+case AV_PIX_FMT_NV12:
+case AV_PIX_FMT_NV21:
+
+layer->format = avbuf->context->av_pix_fmt == AV_PIX_FMT_NV12 ?
+DRM_FORMAT_NV12 : DRM_FORMAT_NV21;
+
+if (avbuf->num_planes > 1)
+break;
+
+layer->nb_planes = 2;
+
+layer->planes[1].object_index = 0;
+layer->planes[1].offset = avbuf->plane_info[0].bytesperline *
+avbuf->context->format.fmt.pix.height;
+layer->planes[1].pitch = avbuf->plane_info[0].bytesperline;
+break;
+
+case AV_PIX_FMT_YUV420P

[FFmpeg-devel] [PATCH 1/2] libavcodec/v4l2_buffers.c: set AVFrame interlaced flags

2024-12-14 Thread Scott Theisen
Originally from:
https://github.com/MythTV/mythtv/commit/669955c6cb29196b4b5120451b5b998d67a65749
---
 libavcodec/v4l2_buffers.c | 38 ++
 1 file changed, 38 insertions(+)

diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c
index 23474ee143..56a8f0825c 100644
--- a/libavcodec/v4l2_buffers.c
+++ b/libavcodec/v4l2_buffers.c
@@ -210,6 +210,43 @@ static enum AVColorTransferCharacteristic 
v4l2_get_color_trc(V4L2Buffer *buf)
 return AVCOL_TRC_UNSPECIFIED;
 }
 
+static void v4l2_get_interlacing(AVFrame *frame, V4L2Buffer *buf)
+{
+enum v4l2_field field;
+field = V4L2_TYPE_IS_MULTIPLANAR(buf->buf.type) ?
+buf->context->format.fmt.pix_mp.field :
+buf->context->format.fmt.pix.field;
+
+if (field == V4L2_FIELD_INTERLACED || field == V4L2_FIELD_INTERLACED_TB) {
+frame->flags |=  AV_FRAME_FLAG_INTERLACED;
+frame->flags |=  AV_FRAME_FLAG_TOP_FIELD_FIRST;
+#if FF_API_INTERLACED_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
+frame->interlaced_frame = 1;
+frame->top_field_first  = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+} else if (field == V4L2_FIELD_INTERLACED_BT) {
+frame->flags |=  AV_FRAME_FLAG_INTERLACED;
+frame->flags &= ~AV_FRAME_FLAG_TOP_FIELD_FIRST;
+#if FF_API_INTERLACED_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
+frame->interlaced_frame = 1;
+frame->top_field_first  = 0;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+} else {
+frame->flags &= ~AV_FRAME_FLAG_INTERLACED;
+frame->flags &= ~AV_FRAME_FLAG_TOP_FIELD_FIRST;
+#if FF_API_INTERLACED_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
+frame->interlaced_frame = 0;
+frame->top_field_first  = 0;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+}
+}
+
 static void v4l2_free_buffer(void *opaque, uint8_t *unused)
 {
 V4L2Buffer* avbuf = opaque;
@@ -434,6 +471,7 @@ int ff_v4l2_buffer_buf_to_avframe(AVFrame *frame, 
V4L2Buffer *avbuf)
 frame->color_trc = v4l2_get_color_trc(avbuf);
 frame->pts = v4l2_get_pts(avbuf);
 frame->pkt_dts = AV_NOPTS_VALUE;
+v4l2_get_interlacing(frame, avbuf);
 
 /* these values are updated also during re-init in 
v4l2_process_driver_event */
 frame->height = avbuf->context->height;
-- 
2.43.0

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

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


Re: [FFmpeg-devel] [PATCH WIP 4/5] avcodec/hevc/sei: Add support for alpha channel information

2024-12-14 Thread Zhao Zhili


> On Dec 14, 2024, at 23:20, James Almer  wrote:
> 
> On 12/11/2024 1:23 AM, Zhao Zhili wrote:
>> From: Zhao Zhili 
>> ---
>>  libavcodec/hevc/sei.c | 30 ++
>>  libavcodec/hevc/sei.h | 14 ++
>>  2 files changed, 44 insertions(+)
>> diff --git a/libavcodec/hevc/sei.c b/libavcodec/hevc/sei.c
>> index e11a33773c..56983fe96e 100644
>> --- a/libavcodec/hevc/sei.c
>> +++ b/libavcodec/hevc/sei.c
>> @@ -150,6 +150,34 @@ static int decode_nal_sei_timecode(HEVCSEITimeCode *s, 
>> GetBitContext *gb)
>>  return 0;
>>  }
>>  +static int decode_nal_sei_alpha_info(HEVCSEIAlphaChannelInfo *s, 
>> GetBitContext *gb)
>> +{
>> +int length;
>> +
>> +s->has_alpha_channel_info = true;
>> +
>> +s->alpha_channel_cancel_flag = get_bits1(gb);
>> +if (!s->alpha_channel_cancel_flag) {
> 
> This should trigger when alpha_channel_cancel_flag is 1.

I made a mistake.

> 
>> +s->alpha_channel_use_idc = 2;
>> +s->alpha_channel_incr_flag = 0;
>> +s->alpha_channel_clip_flag = 0;
>> +
>> +return 0;
>> +}
>> +
>> +s->alpha_channel_use_idc = get_bits(gb, 3);
>> +s->alpha_channel_bit_depth_minus8 = get_bits(gb, 3);
>> +length = s->alpha_channel_bit_depth_minus8 + 9;
>> +s->alpha_transparent_value = get_bits(gb, length);
>> +s->alpha_opaque_value = get_bits(gb, length);
>> +s->alpha_channel_incr_flag = get_bits1(gb);
>> +s->alpha_channel_clip_flag = get_bits1(gb);
>> +if (s->alpha_channel_clip_flag)
>> +s->alpha_channel_clip_type_flag = get_bits1(gb);
>> +
>> +return 0;
>> +}
>> +
>>  static int decode_nal_sei_3d_reference_displays_info(HEVCSEITDRDI *s, 
>> GetBitContext *gb)
>>  {
>>  s->prec_ref_display_width = get_ue_golomb(gb);
>> @@ -216,6 +244,8 @@ static int decode_nal_sei_prefix(GetBitContext *gb, 
>> GetByteContext *gbyte,
>>  return decode_nal_sei_active_parameter_sets(s, gb, logctx);
>>  case SEI_TYPE_TIME_CODE:
>>  return decode_nal_sei_timecode(&s->timecode, gb);
>> +case SEI_TYPE_ALPHA_CHANNEL_INFO:
>> +return decode_nal_sei_alpha_info(&s->alpha, gb);
>>  case SEI_TYPE_THREE_DIMENSIONAL_REFERENCE_DISPLAYS_INFO:
>>  return decode_nal_sei_3d_reference_displays_info(&s->tdrdi, gb);
>>  default: {
>> diff --git a/libavcodec/hevc/sei.h b/libavcodec/hevc/sei.h
>> index ee640003bc..54122c27df 100644
>> --- a/libavcodec/hevc/sei.h
>> +++ b/libavcodec/hevc/sei.h
>> @@ -21,6 +21,7 @@
>>  #ifndef AVCODEC_HEVC_SEI_H
>>  #define AVCODEC_HEVC_SEI_H
>>  +#include 
> 
> Are we using bool anywhere else? Afaik, we just use uint8_t everywhere since 
> it's going to be a whole byte anyway.

Patchset v2 dropped this patch.

For something with only true/false state and has no other defect, I prefer to 
use bool for clarity.
Maybe we can list cases what’s forbidden or inappropriate to use bool, so bool 
can be used in
other cases.

> 
>>  #include 
>>#include "libavutil/buffer.h"
>> @@ -95,6 +96,18 @@ typedef struct HEVCSEITDRDI {
>>  uint8_t three_dimensional_reference_displays_extension_flag;
>>  } HEVCSEITDRDI;
>>  +typedef struct HEVCSEIAlphaChannelInfo {
>> +bool has_alpha_channel_info;
>> +uint8_t  alpha_channel_cancel_flag;
>> +uint8_t  alpha_channel_use_idc;
>> +uint8_t  alpha_channel_bit_depth_minus8;
>> +uint16_t alpha_transparent_value;
>> +uint16_t alpha_opaque_value;
>> +uint8_t  alpha_channel_incr_flag;
>> +uint8_t  alpha_channel_clip_flag;
>> +uint8_t  alpha_channel_clip_type_flag;
>> +} HEVCSEIAlphaChannelInfo;
>> +
>>  typedef struct HEVCSEI {
>>  H2645SEI common;
>>  HEVCSEIPictureHash picture_hash;
>> @@ -102,6 +115,7 @@ typedef struct HEVCSEI {
>>  int active_seq_parameter_set_id;
>>  HEVCSEITimeCode timecode;
>>  HEVCSEITDRDI tdrdi;
>> +HEVCSEIAlphaChannelInfo alpha;
>>  } HEVCSEI;
>>struct HEVCParamSets;
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

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

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


Re: [FFmpeg-devel] [ANNOUNCE] upcoming vote: TC election

2024-12-14 Thread Anton Khirnov
Hi all,
this is a reminder that the vote closes some time after Sunday midnight
(CET). So far we have just 24 votes out of 52, so please vote ASAP if
you have not done so yet.

Cheers,
-- 
Anton Khirnov
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] libavformat/prompeg.c: Add parameters to control FEC ports.

2024-12-14 Thread Romain Beauxis
Le ven. 13 déc. 2024 à 18:07, Kieran Kunhya via ffmpeg-devel
 a écrit :
>
> On Fri, 13 Dec 2024, 16:38 Romain Beauxis,  wrote:
>
> > Le ven. 13 déc. 2024 à 16:42, Romain Beauxis
> >  a écrit :
> > >
> > > This patch adds parameters to pick specific ports for the two FEC error-
> > > correction streams associated with a Pro-MPEG CoP #3-R2 FEC streams.
> > >
> > > Radio France is currently interested in using this technology to do
> > > error-correction on some of their stream. In this context, they may not
> > > have full control over their available UDP ports and would like to be
> > able to
> > > pick any two ports for these streams.
> > >
> > > The specifications for this protocol is available online:
> > https://www.yumpu.com/en/document/read/8808550/pro-mpeg-code-of-practice-3-release-2-pro-mpeg-forum
> > >
> > > In section 5.2, page 14, port assignments for the FEC streams are under
> > > "shall" thus the changes in this patch should still be valid w.r.t. the
> > > specs.
> >
> > A bit surprised, as I re-read the specs now, to learn that "shall" is
> > to be interpreted as a mandatory requirement while, usually, "must" is
> > used. My understanding of the English language has failed me once
> > more!
> >
> > Still, I believe that this patch should be useful (shall, if
> > considering the use-case I came from!).
> >
> >
> What FEC receivers allow custom port selection? All the ones I've seen
> expect +2 and +4. If they are internally mapping to +2 and +4, I am not
> sure it's a good idea that FFmpeg features are added to work around
> someone's firewall limitation.

I am not aware of any.

I can see your point.

> Kieran
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [ANNOUNCE] upcoming vote: TC election

2024-12-14 Thread Gyan Doshi




On 2024-12-14 06:00 pm, Anton Khirnov wrote:

Hi all,
this is a reminder that the vote closes some time after Sunday midnight
(CET). So far we have just 24 votes out of 52, so please vote ASAP if
you have not done so yet.


The CIVS email says, "The poll has been announced to end 2024-12-17."

Is that wrong?

Regards,
Gyan

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

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


Re: [FFmpeg-devel] [ANNOUNCE] upcoming vote: TC election

2024-12-14 Thread Anton Khirnov
Quoting Gyan Doshi (2024-12-14 13:43:52)
> 
> 
> On 2024-12-14 06:00 pm, Anton Khirnov wrote:
> > Hi all,
> > this is a reminder that the vote closes some time after Sunday midnight
> > (CET). So far we have just 24 votes out of 52, so please vote ASAP if
> > you have not done so yet.
> 
> The CIVS email says, "The poll has been announced to end 2024-12-17."
> 
> Is that wrong?

Ah right, I forgot the start was delayed so the end will be as well. In
that case it will end some time after 2024-12-17T00:00 CET

-- 
Anton Khirnov
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 0/2] Animated JPEG XL Encoder

2024-12-14 Thread Leo Izen

On 12/11/24 5:32 PM, Marth64 wrote:

Hi Leo,

In libjxl_anim_encode_frame():


+if (!ctx->prev) {
+ret = AVERROR(ENOMEM);
+goto end;
+}
+ret = ff_encode_get_frame(avctx, ctx->prev);
+if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
+goto end;
+ret = libjxl_preprocess_stream(avctx, ctx->prev, 1);
+if (ret < 0)
+goto end;


and


+if (ret == AVERROR(EAGAIN))
+goto end;


As `end` block simply returns ret, can these gotos be eliminated and
replaced with a return on the spot?


They could be. There use to be a free statement there that was moved, 
and I didn't update the gotos. Good catch!


- Leo Izen (Traneptora)


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

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


Re: [FFmpeg-devel] [PATCH WIP 4/5] avcodec/hevc/sei: Add support for alpha channel information

2024-12-14 Thread James Almer

On 12/11/2024 1:23 AM, Zhao Zhili wrote:

From: Zhao Zhili 

---
  libavcodec/hevc/sei.c | 30 ++
  libavcodec/hevc/sei.h | 14 ++
  2 files changed, 44 insertions(+)

diff --git a/libavcodec/hevc/sei.c b/libavcodec/hevc/sei.c
index e11a33773c..56983fe96e 100644
--- a/libavcodec/hevc/sei.c
+++ b/libavcodec/hevc/sei.c
@@ -150,6 +150,34 @@ static int decode_nal_sei_timecode(HEVCSEITimeCode *s, 
GetBitContext *gb)
  return 0;
  }
  
+static int decode_nal_sei_alpha_info(HEVCSEIAlphaChannelInfo *s, GetBitContext *gb)

+{
+int length;
+
+s->has_alpha_channel_info = true;
+
+s->alpha_channel_cancel_flag = get_bits1(gb);
+if (!s->alpha_channel_cancel_flag) {


This should trigger when alpha_channel_cancel_flag is 1.


+s->alpha_channel_use_idc = 2;
+s->alpha_channel_incr_flag = 0;
+s->alpha_channel_clip_flag = 0;
+
+return 0;
+}
+
+s->alpha_channel_use_idc = get_bits(gb, 3);
+s->alpha_channel_bit_depth_minus8 = get_bits(gb, 3);
+length = s->alpha_channel_bit_depth_minus8 + 9;
+s->alpha_transparent_value = get_bits(gb, length);
+s->alpha_opaque_value = get_bits(gb, length);
+s->alpha_channel_incr_flag = get_bits1(gb);
+s->alpha_channel_clip_flag = get_bits1(gb);
+if (s->alpha_channel_clip_flag)
+s->alpha_channel_clip_type_flag = get_bits1(gb);
+
+return 0;
+}
+
  static int decode_nal_sei_3d_reference_displays_info(HEVCSEITDRDI *s, 
GetBitContext *gb)
  {
  s->prec_ref_display_width = get_ue_golomb(gb);
@@ -216,6 +244,8 @@ static int decode_nal_sei_prefix(GetBitContext *gb, 
GetByteContext *gbyte,
  return decode_nal_sei_active_parameter_sets(s, gb, logctx);
  case SEI_TYPE_TIME_CODE:
  return decode_nal_sei_timecode(&s->timecode, gb);
+case SEI_TYPE_ALPHA_CHANNEL_INFO:
+return decode_nal_sei_alpha_info(&s->alpha, gb);
  case SEI_TYPE_THREE_DIMENSIONAL_REFERENCE_DISPLAYS_INFO:
  return decode_nal_sei_3d_reference_displays_info(&s->tdrdi, gb);
  default: {
diff --git a/libavcodec/hevc/sei.h b/libavcodec/hevc/sei.h
index ee640003bc..54122c27df 100644
--- a/libavcodec/hevc/sei.h
+++ b/libavcodec/hevc/sei.h
@@ -21,6 +21,7 @@
  #ifndef AVCODEC_HEVC_SEI_H
  #define AVCODEC_HEVC_SEI_H
  
+#include 


Are we using bool anywhere else? Afaik, we just use uint8_t everywhere 
since it's going to be a whole byte anyway.



  #include 
  
  #include "libavutil/buffer.h"

@@ -95,6 +96,18 @@ typedef struct HEVCSEITDRDI {
  uint8_t three_dimensional_reference_displays_extension_flag;
  } HEVCSEITDRDI;
  
+typedef struct HEVCSEIAlphaChannelInfo {

+bool has_alpha_channel_info;
+uint8_t  alpha_channel_cancel_flag;
+uint8_t  alpha_channel_use_idc;
+uint8_t  alpha_channel_bit_depth_minus8;
+uint16_t alpha_transparent_value;
+uint16_t alpha_opaque_value;
+uint8_t  alpha_channel_incr_flag;
+uint8_t  alpha_channel_clip_flag;
+uint8_t  alpha_channel_clip_type_flag;
+} HEVCSEIAlphaChannelInfo;
+
  typedef struct HEVCSEI {
  H2645SEI common;
  HEVCSEIPictureHash picture_hash;
@@ -102,6 +115,7 @@ typedef struct HEVCSEI {
  int active_seq_parameter_set_id;
  HEVCSEITimeCode timecode;
  HEVCSEITDRDI tdrdi;
+HEVCSEIAlphaChannelInfo alpha;
  } HEVCSEI;
  
  struct HEVCParamSets;




OpenPGP_signature.asc
Description: OpenPGP digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH v2 0/3] Make fate tests succeed with zlib-ng

2024-12-14 Thread James Almer

On 12/14/2024 7:09 AM, Anton Khirnov wrote:

Quoting Alexander Strasser via ffmpeg-devel (2024-12-01 21:13:56)

This is a fixed up version of the series I sent before.

This worked for me on Ubuntu 20.04 but probably will break
with older zlib versions as Hendrik pointed out in the
previous thread. Either we must update zlib on affected
FATE clients or add more .alt files to them as well.

We could also go the further the "no_file_checksums" as
was demonstrated by James' series.

I still prefer this way because it's simpler and retains
the value of the tests.


This seems like a hack to me.

We should not be testing for bitexact output from code that is not under
our control and does not guarantee bitexactness.


I sent a patch to remove the crc and size output from the ref files, but 
it did not really get much traction.




OpenPGP_signature.asc
Description: OpenPGP digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] checkasm: Print benchmarks of C-only functions

2024-12-14 Thread Alexander Strasser via ffmpeg-devel
Hi Martin!

On 2024-12-11 10:47 +0200, Martin Storsjö wrote:
> On Wed, 23 Oct 2024, Martin Storsjö wrote:
>
> > This corresponds to commit 9278a14cf406f8edb5052c42b83750112bf5b515
> > in dav1d.
> >
> > Omitting the C-only functions doesn't speed up benchmarking
> > anyway (as those has to be benchmarked before we know if we have
> > any corresponding assembly functions), and being able to benchmark
> > those functions without corresponding assembly can be valuable in
> > a number of cases.
> > ---
> > tests/checkasm/checkasm.c | 48 +++
> > 1 file changed, 23 insertions(+), 25 deletions(-)
>
> Will push soon.
>
> The only concern about this change I heard was from Ramiro on irc, who
> wasn't familiar with how to use the --bench= parameter for limiting
> the set of functions to actually benchmark.
>
> (This patch doesn't cause checkasm to benchmark more than it did before, it
> just prints the numbers that already were benchmarked.)
>
> I'll also go ahead and backport this to the 7.1 branch. It's obviously not a
> regression fix or anything like that, but the change adds value for being
> able to use checkasm to benchmark compiler performance.

LGTM.

Tested on aarch64 .

Total run times match.
Output had only additional lines which all were for functions ending in `_c`


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

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


Re: [FFmpeg-devel] [PATCH v2 0/3] Make fate tests succeed with zlib-ng

2024-12-14 Thread Alexander Strasser via ffmpeg-devel
On 2024-12-14 11:09 +0100, Anton Khirnov wrote:
> Quoting Alexander Strasser via ffmpeg-devel (2024-12-01 21:13:56)
> > This is a fixed up version of the series I sent before.
> >
> > This worked for me on Ubuntu 20.04 but probably will break
> > with older zlib versions as Hendrik pointed out in the
> > previous thread. Either we must update zlib on affected
> > FATE clients or add more .alt files to them as well.
> >
> > We could also go the further the "no_file_checksums" as
> > was demonstrated by James' series.
> >
> > I still prefer this way because it's simpler and retains
> > the value of the tests.
>
> This seems like a hack to me.

Depends on what you precisely mean by hack.
It is a way to accommodate for shortcomings in older, but
still widely used zlib versions.


> We should not be testing for bitexact output from code that is not under
> our control and does not guarantee bitexactness.

Ideally!

OTOH we also indirectly test that other code like C std lib functions
work as expected.

In this case short of bugs in zlib/zlib-ng I do not see why the output
should differ with compression level 0. Maybe I'm missing something
I didn't look that deep into how zlib exactly works.


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

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


Re: [FFmpeg-devel] [PATCH 01/14] avformat/flvenc: implement support for multi-track video

2024-12-14 Thread Anton Khirnov
Quoting Timo Rothenpieler (2024-12-13 20:17:07)
> I intend to push this series soon.
> It's been tested to work, and no major changes to the spec have happened.

Some tests sure would be nice.

-- 
Anton Khirnov
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH WIP 0/5] avcodec/hevc: Add alpha video decoding support

2024-12-14 Thread Anton Khirnov
Quoting Zhao Zhili (2024-12-11 05:23:20)
> From: Zhao Zhili 
> 
> What works:
> 
> 1. Create a sample with macOS videotoolbox
> ffmpeg -i base.mp4 -i alpha.mp4 \
>   -c:v hevc_videotoolbox -alpha_quality 0.5 -b:v 2M \
>-filter_complex 
> '[0:v]scale,format=bgra[v0];[1:v]scale=640x480,format=gray[v1];[v0][v1]alphamerge[v2]'
>  \
>   -map '[v2]' -y hevc-alpha.ts
> 
> Then you can remux it to mp4 if you prefer.
> 
> 2. Decoding test
> 
> a. Check alpha plane
> ./ffmpeg -i hevc-alpha.ts -an -vf extractplanes=planes=a -f nut - |ffplay -
> 
> b. Check Y plane
> ./ffmpeg -i hevc-alpha.ts -an -vf extractplanes=planes=y -f nut - |ffplay -
> 
> What doesn't work:
> 
> 1. Encoding with videotoolbox and output as mp4 directly, due to missing PS.
> Can be fixed by
> 
> https://patchwork.ffmpeg.org/project/ffmpeg/patch/20241210191641.676-1-t...@rothenpieler.org/
> 
> 2. vps_extension is over-engineering and decode_vps_ext() is far from 
> complete.
> A complete implementation might take a week, and I don't have enough spare 
> time.
> I would greatly appreciate it if someone could help implement it.

Do we need a complete implementation, when we do not intend to support
all the possible combinations of all the possible multi-layer types? I'd
prefer not to handle all the insanity until we really need to.

-- 
Anton Khirnov
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH WIP 5/5] avcodec/hevc: Add alpha layer support

2024-12-14 Thread Anton Khirnov
Quoting Zhao Zhili (2024-12-11 05:23:33)
> From: Zhao Zhili 
> 
> ---
>  libavcodec/hevc/hevcdec.c | 75 ++-
>  libavcodec/hevc/hevcdec.h |  2 ++
>  libavcodec/hevc/refs.c| 10 +-
>  3 files changed, 85 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c
> index be35a9de82..782c9382bc 100644
> --- a/libavcodec/hevc/hevcdec.c
> +++ b/libavcodec/hevc/hevcdec.c
> @@ -458,6 +458,26 @@ static int export_multilayer(HEVCContext *s, const 
> HEVCVPS *vps)
>  return 0;
>  }
>  
> +int ff_hevc_is_alpha_video(const HEVCContext *s) {
> +const HEVCVPS *vps;
> +int ret = 0;
> +
> +if (!s->vps)
> +return 0;

This seems like something that should not happen.

> +vps = s->vps;
> +if (vps->nb_layers != 2 || !vps->layer_id_in_nuh[1])
> +return 0;
> +
> +ret = (s->vps->scalability_mask_flag & HEVC_SCALABILITY_AUXILIARY) &&
> +  s->sei.alpha.has_alpha_channel_info;

Is the SEI really necessary? I thought it's enough to have an auxiliary
picture with AuxId=AUX_ALPHA.

Also, I'd prefer the interaction with multiview to be clearer, with e.g.
a warning message when both are present, and fewer assumptions about
only one of them being present spread over the code.

-- 
Anton Khirnov
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] libavcodec/mpeg12dec.c: append CC data to a53_buf_ref

2024-12-14 Thread Anton Khirnov
Quoting Scott Theisen (2024-12-14 04:06:45)
> On 12/13/24 17:39, Marth64 wrote:
> > Hi Scott,
> >
> > Thanks for sharing this. I had read your original email also
> > ([RFC] libavcodec/mpeg12dec.c: CC data from skipped frames)
> > and was thinking about the statement. The patch helps
> > visualize the issue a bit better.
> >
> > I need to study this and test it to understand it better.
> > Meantime, I will apply locally and play around with it.
> >
> > If any more seasoned EIA608 experts have any thoughts please share.
> 
> The problem is the use of av_buffer_realloc() instead of av_buffer_alloc().
> 
> | old_size |
> realloc(new_size)
> | old_size + (undefined values) | (new_size total bytes) (new_size is 
> always > old_size)
> realloc copies data already in the buffer to the first old_size bytes.
> 
> The SCTE-20 code sets the extra space to 0, but the others leave it 
> undefined.
> 
> However, the old_size data is then overwritten, potentially partially, while
> the size of the array is still new_size when there are only new_size - 
> old_size
> valid bytes.
> 
> I think it is reasonable to concatenate the CC data until a frame can be 
> exported.
> Since I don't know if there is a frame exported when all of the video 
> frame's data slices
> have been skipped (e.g. B frame with open GOP),

what exactly do you mean by 'skipped' here?

-- 
Anton Khirnov
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 04/14] avformat/flvenc: remove !size check for audio packets

2024-12-14 Thread Anton Khirnov
This could use some explanation.

-- 
Anton Khirnov
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 02/14] avformat/flvdec: add support for demuxing multi-track FLV

2024-12-14 Thread Anton Khirnov
Quoting Timo Rothenpieler (2024-12-12 20:55:27)
> From: Dennis Sädtler 
> 
> Based on enhanced-rtmp v2 spec published by Veovera:
> https://veovera.github.io/enhanced-rtmp/docs/enhanced/enhanced-rtmp-v2
> 
> Signed-off-by: Dennis Sädtler 
> ---
>  libavformat/flvdec.c | 117 +++
>  1 file changed, 96 insertions(+), 21 deletions(-)

This could use some adapting to our coding style.

> @@ -1526,6 +1591,16 @@ retry_duration:
>  flv->new_extradata[stream_type]  = NULL;
>  flv->new_extradata_size[stream_type] = 0;
>  }
> +} else if (multitrack
> +   && flv->mt_extradata_cnt > track_idx
> +   && flv->mt_extradata[track_idx]) {
> +int ret = av_packet_add_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,
> +  flv->mt_extradata[track_idx],
> +  flv->mt_extradata_sz[track_idx]);
> +if (ret >= 0) {

This should fail when ret < 0

-- 
Anton Khirnov
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH WIP 4/5] avcodec/hevc/sei: Add support for alpha channel information

2024-12-14 Thread Anton Khirnov
Quoting Zhao Zhili (2024-12-11 05:23:31)
> @@ -95,6 +96,18 @@ typedef struct HEVCSEITDRDI {
>  uint8_t three_dimensional_reference_displays_extension_flag;
>  } HEVCSEITDRDI;
>  
> +typedef struct HEVCSEIAlphaChannelInfo {
> +bool has_alpha_channel_info;
> +uint8_t  alpha_channel_cancel_flag;
> +uint8_t  alpha_channel_use_idc;
> +uint8_t  alpha_channel_bit_depth_minus8;
> +uint16_t alpha_transparent_value;
> +uint16_t alpha_opaque_value;
> +uint8_t  alpha_channel_incr_flag;
> +uint8_t  alpha_channel_clip_flag;
> +uint8_t  alpha_channel_clip_type_flag;

We generally prefer not to duplicate the bitstream values/spec names
verbatim, because they are optimized for a different purpose.
Specifically
* 'alpha' in names is redundant with the struct name
* _flag is redundant
* store the actual bit depth, not _minus*

-- 
Anton Khirnov
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] avutil/file: fix av_file_map file mapping on Windows

2024-12-14 Thread Anton Khirnov
Quoting Kacper Michajłow (2024-12-09 20:20:02)
> This makes the behavior of av_file_map() the same on Windows as it is on
> other platforms. The file is opened as read-only, but the mapping is
> copy-on-write, allowing the user to write to the memory pages returned
> by av_file_map().
> 
> This commit fixes libavutil\tests\file.c test, which would crash when
> trying to write to a read-only memory page.
> 
> Signed-off-by: Kacper Michajłow 
> ---
>  libavutil/file.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Queued, will push soonish.

Thanks,
-- 
Anton Khirnov
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] libavfilter/af_amix: fixed amix format when graph load

2024-12-14 Thread Anton Khirnov
> libavfilter/af_amix: fixed amix format when graph load

This needs a better explanation of what is being done and why.

-- 
Anton Khirnov
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH v2 0/3] Make fate tests succeed with zlib-ng

2024-12-14 Thread Anton Khirnov
Quoting Alexander Strasser via ffmpeg-devel (2024-12-01 21:13:56)
> This is a fixed up version of the series I sent before.
> 
> This worked for me on Ubuntu 20.04 but probably will break
> with older zlib versions as Hendrik pointed out in the
> previous thread. Either we must update zlib on affected
> FATE clients or add more .alt files to them as well.
> 
> We could also go the further the "no_file_checksums" as
> was demonstrated by James' series.
> 
> I still prefer this way because it's simpler and retains
> the value of the tests.

This seems like a hack to me.

We should not be testing for bitexact output from code that is not under
our control and does not guarantee bitexactness.

-- 
Anton Khirnov
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] libavcodec/mpeg12dec.c: append CC data to a53_buf_ref

2024-12-14 Thread Scott Theisen

On 12/14/24 04:12, Anton Khirnov wrote:

Quoting Scott Theisen (2024-12-14 04:06:45)

On 12/13/24 17:39, Marth64 wrote:

Hi Scott,

Thanks for sharing this. I had read your original email also
([RFC] libavcodec/mpeg12dec.c: CC data from skipped frames)
and was thinking about the statement. The patch helps
visualize the issue a bit better.

I need to study this and test it to understand it better.
Meantime, I will apply locally and play around with it.

If any more seasoned EIA608 experts have any thoughts please share.

The problem is the use of av_buffer_realloc() instead of av_buffer_alloc().

| old_size |
realloc(new_size)
| old_size + (undefined values) | (new_size total bytes) (new_size is
always > old_size)
realloc copies data already in the buffer to the first old_size bytes.

The SCTE-20 code sets the extra space to 0, but the others leave it
undefined.

However, the old_size data is then overwritten, potentially partially, while
the size of the array is still new_size when there are only new_size -
old_size
valid bytes.

I think it is reasonable to concatenate the CC data until a frame can be
exported.
Since I don't know if there is a frame exported when all of the video
frame's data slices
have been skipped (e.g. B frame with open GOP),

what exactly do you mean by 'skipped' here?



In mpeg12dec.c, decode_chunks() (see lines 2400 - 2560) will skip the 
data slices when certain conditions are met and only when none are met 
will decode_chunks() call mpeg_field_start(), which attaches a53_buf_ref 
to the frame.


For example (line 2470),
```
if (!s2->last_pic.ptr) {
    /* Skip B-frames if we do not have reference frames and
 * GOP is not closed. */
    if (s2->pict_type == AV_PICTURE_TYPE_B) {
    if (!s->closed_gop) {
    skip_frame = 1;
    av_log(s2->avctx, AV_LOG_DEBUG,
   "Skipping B slice due to open GOP\n");
    break;
    }
    }
}
```

This skips all of the data slices of one or more coded pictures of the 
coded B-frames immediately following the coded I-frame which follows the 
GOP header when skipping or at the beginning of the file for my ATSC 
samples.


Since mpeg_field_start() is not called, a53_buf_ref is not NULL when the 
CC user data for the next coded picture is found.  Also, as far as I can 
tell, skip_frame = 1 causes slice_end() to not be called, preventing a 
frame from being exported.


Regards,

Scott Theisen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 04/14] avformat/flvenc: remove !size check for audio packets

2024-12-14 Thread Timo Rothenpieler

On 14.12.2024 10:16, Anton Khirnov wrote:

This could use some explanation.


I unfortunately don't remember the exact reason, but it ran into this 
check in normal operation, and empty audio packets are a perfectly valid 
thing to package.

I think Opus or something generates them?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] libavcodec/mpeg12dec.c: append CC data to a53_buf_ref

2024-12-14 Thread Scott Theisen

On 12/14/24 00:39, Marth64 wrote:

This makes sense to me now.
I think it makes more sense to follow the A53
approach and be consistent.

May I suggest the following in the patch to also
improve readability in this crowded area of code:

- SCTE-20 section: as you are declaring `cap` to be
`s1->a53_buf_ref->data + old_size` now, the memset
immediately following the declaration can be shortened
to `memset(cap, 0, cc_count * 3);`


I did see that but was trying to have a minimal patch; however, that is 
reasonable to also change.




- DVB 0502 section: rename `uint8_t* data` to `uint8_t *cap`
when you are setting up the final payload.
This makes it more consistent with the other sections.


I had thought about consistency, but I really didn't like the name 
`cap`.  However, I suppose it is short for `captions`, so I will also 
use `cap` for better consistency.


Regards,

Scott Theisen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 02/14] avformat/flvdec: add support for demuxing multi-track FLV

2024-12-14 Thread Timo Rothenpieler

On 14.12.2024 10:17, Anton Khirnov wrote:

Quoting Timo Rothenpieler (2024-12-12 20:55:27)

From: Dennis Sädtler 

Based on enhanced-rtmp v2 spec published by Veovera:
https://veovera.github.io/enhanced-rtmp/docs/enhanced/enhanced-rtmp-v2

Signed-off-by: Dennis Sädtler 
---
  libavformat/flvdec.c | 117 +++
  1 file changed, 96 insertions(+), 21 deletions(-)


This could use some adapting to our coding style.


Anything specific that seems off to you?
Generally looks to be following our style.

The only thing I saw was one use of
for (int i = ...)
Which I think we even allow now?


@@ -1526,6 +1591,16 @@ retry_duration:
  flv->new_extradata[stream_type]  = NULL;
  flv->new_extradata_size[stream_type] = 0;
  }
+} else if (multitrack
+   && flv->mt_extradata_cnt > track_idx
+   && flv->mt_extradata[track_idx]) {
+int ret = av_packet_add_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,
+  flv->mt_extradata[track_idx],
+  flv->mt_extradata_sz[track_idx]);
+if (ret >= 0) {


This should fail when ret < 0


It follows the scheme of the pre-existing call, so I'd probably rather 
change both in a separate commit.

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

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


[FFmpeg-devel] [PATCH v2] libavcodec/mpeg12dec.c: append CC data to a53_buf_ref

2024-12-14 Thread Scott Theisen
In mpeg_decode_a53_cc() only the A/53 part 4 CC data ("GA94") is saved between
frames.  The other formats incorrectly created a larger buffer than they use
since a705bcd763e344fac191e157ffeddc285388b7fa because they did not append to
the previous data.

A/53 and SCTE-20 specify a maximum of one CC user data per picture header.
(I assume the same is true for DVD and DVB 0502.)

The a53_buf_ref is added to the frame in mpeg_field_start() which will only be
called in decode_chunks() if not all of the picture data slices are skipped.

I have observed the A/53 code create a larger buffer at the start of a file or
after skipping; presumably the I-frame following a GOP header is the first
frame, then one or more B-frames have all of their slices skipped.  Otherwise,
old_size is always 0.
---
 libavcodec/mpeg12dec.c | 19 ++-
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 208ee28b04..3ab626accd 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1971,9 +1971,9 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx,
 ret = av_buffer_realloc(&s1->a53_buf_ref, new_size);
 if (ret >= 0) {
 uint8_t field, cc1, cc2;
-uint8_t *cap = s1->a53_buf_ref->data;
+uint8_t *cap = s1->a53_buf_ref->data + old_size;
 
-memset(s1->a53_buf_ref->data + old_size, 0, cc_count * 3);
+memset(cap, 0, cc_count * 3);
 for (i = 0; i < cc_count && get_bits_left(&gb) >= 26; i++) {
 skip_bits(&gb, 2); // priority
 field = get_bits(&gb, 2);
@@ -2043,7 +2043,7 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx,
 ret = av_buffer_realloc(&s1->a53_buf_ref, new_size);
 if (ret >= 0) {
 uint8_t field1 = !!(p[4] & 0x80);
-uint8_t *cap = s1->a53_buf_ref->data;
+uint8_t *cap = s1->a53_buf_ref->data + old_size;
 p += 5;
 for (i = 0; i < cc_count; i++) {
 cap[0] = (p[0] == 0xff && field1) ? 0xfc : 0xfd;
@@ -2109,13 +2109,14 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx,
 
 ret = av_buffer_realloc(&s1->a53_buf_ref, new_size);
 if (ret >= 0) {
-s1->a53_buf_ref->data[0] = cc_header;
-s1->a53_buf_ref->data[1] = cc_data[0];
-s1->a53_buf_ref->data[2] = cc_data[1];
+uint8_t* cap = s1->a53_buf_ref->data + old_size;
+cap[0] = cc_header;
+cap[1] = cc_data[0];
+cap[2] = cc_data[1];
 if (cc_count == 2) {
-s1->a53_buf_ref->data[3] = cc_header;
-s1->a53_buf_ref->data[4] = cc_data[2];
-s1->a53_buf_ref->data[5] = cc_data[3];
+cap[3] = cc_header;
+cap[4] = cc_data[2];
+cap[5] = cc_data[3];
 }
 }
 
-- 
2.43.0

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

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


[FFmpeg-devel] [PATCH v2 1/2] libavcodec: add AV_CODEC_ID_IVTV_VBI

2024-12-14 Thread Scott Theisen
---
 doc/APIchanges  | 3 +++
 libavcodec/codec_desc.c | 6 ++
 libavcodec/codec_id.h   | 1 +
 libavcodec/version.c| 2 +-
 4 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index b9af3de933..8fc55ad80b 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07
 
 API changes, most recent first:
 
+2024-12-14 - xx - lavc 61.26.100 - codec_id.h
+  Add AV_CODEC_ID_IVTV_VBI.
+
 2024-12-05 - xx - lavu 59.49.100 - csp.h
   Add av_csp_itu_eotf() and av_csp_itu_eotf_inv().
 
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index bc9163bf98..38aed994d9 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -3634,6 +3634,12 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("ARIB STD-B24 caption"),
 .profiles  = NULL_IF_CONFIG_SMALL(ff_arib_caption_profiles),
 },
+{
+.id= AV_CODEC_ID_IVTV_VBI,
+.type  = AVMEDIA_TYPE_SUBTITLE,
+.name  = "ivtv_vbi",
+.long_name = NULL_IF_CONFIG_SMALL("ivtv VBI captions"),
+},
 
 /* other kind of codecs and pseudo-codecs */
 {
diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h
index 6bfaa02601..69663cb24e 100644
--- a/libavcodec/codec_id.h
+++ b/libavcodec/codec_id.h
@@ -579,6 +579,7 @@ enum AVCodecID {
 AV_CODEC_ID_HDMV_TEXT_SUBTITLE,
 AV_CODEC_ID_TTML,
 AV_CODEC_ID_ARIB_CAPTION,
+AV_CODEC_ID_IVTV_VBI,
 
 /* other specific kind of codecs (generally used for attachments) */
 AV_CODEC_ID_FIRST_UNKNOWN = 0x18000,   ///< A dummy ID pointing at 
the start of various fake codecs.
diff --git a/libavcodec/version.c b/libavcodec/version.c
index 03dd95e5ba..8a0398f28f 100644
--- a/libavcodec/version.c
+++ b/libavcodec/version.c
@@ -36,7 +36,7 @@ unsigned avcodec_version(void)
   AV_CODEC_ID_ADPCM_XMD== 69683 &&
   AV_CODEC_ID_CBD2_DPCM== 81928 &&
   AV_CODEC_ID_QOA  == 86121 &&
-  AV_CODEC_ID_ARIB_CAPTION == 94233 &&
+  AV_CODEC_ID_IVTV_VBI == 94234 &&
   AV_CODEC_ID_SMPTE_2038   == 98315,
   "Don't insert new codec ids in the middle of a list");
 static_assert(LIBAVCODEC_VERSION_MICRO >= 100, "micro version starts at 
100");
-- 
2.43.0

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

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


[FFmpeg-devel] [PATCH v2 2/2] libavcodec/mpeg.c: demux ivtv captions

2024-12-14 Thread Scott Theisen
The packet starts 'IVT0' or 'ivt0'; for more details see
https://github.com/MythTV/mythtv/blob/master/mythtv/libs/libmythtv/decoders/avformatdecoder.cpp
'I' = 0x49, 'i' = 0x69
---
 libavformat/mpeg.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
index 2c766a4ee9..4d732aaf86 100644
--- a/libavformat/mpeg.c
+++ b/libavformat/mpeg.c
@@ -620,6 +620,9 @@ redo:
 } else if (startcode >= 0xfd55 && startcode <= 0xfd5f) {
 type = AVMEDIA_TYPE_VIDEO;
 codec_id = AV_CODEC_ID_VC1;
+} else if (startcode == 0x69 || startcode == 0x49) {
+type = AVMEDIA_TYPE_SUBTITLE;
+codec_id = AV_CODEC_ID_IVTV_VBI;
 } else {
 skip:
 /* skip packet */
-- 
2.43.0

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

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


[FFmpeg-devel] [PATCH 2/4] avcodec: set AV_FRAME_FLAG_LOSSLESS where supported

2024-12-14 Thread Marton Balint
Signed-off-by: Marton Balint 
---
 libavcodec/jpeg2000dec.c | 4 
 libavcodec/mjpegdec.c| 2 ++
 libavcodec/vp9.c | 4 
 libavcodec/webp.c| 1 +
 4 files changed, 11 insertions(+)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 84eebfd1b2..df13bea815 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -2891,6 +2891,10 @@ static int jpeg2000_decode_frame(AVCodecContext *avctx, 
AVFrame *picture,
 }
 }
 
+for (int x = 0; x < s->ncomponents && s->codsty[x].transform == FF_DWT53;)
+if (++x == s->ncomponents)
+picture->flags |= AV_FRAME_FLAG_LOSSLESS;
+
 avctx->execute2(avctx, jpeg2000_decode_tile, picture, NULL, s->numXtiles * 
s->numYtiles);
 
 jpeg2000_dec_cleanup(s);
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index ef4fc075b2..fefa5e7877 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -2561,6 +2561,8 @@ eoi_parser:
 }
 if ((ret = av_frame_ref(frame, s->picture_ptr)) < 0)
 return ret;
+if (s->lossless)
+frame->flags |= AV_FRAME_FLAG_LOSSLESS;
 *got_frame = 1;
 s->got_picture = 0;
 
diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index 8ede2e2eb3..b4b6fd933d 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -1592,6 +1592,10 @@ static int vp9_decode_frame(AVCodecContext *avctx, 
AVFrame *frame,
 f->flags |= AV_FRAME_FLAG_KEY;
 else
 f->flags &= ~AV_FRAME_FLAG_KEY;
+if (s->s.h.lossless)
+f->flags |= AV_FRAME_FLAG_LOSSLESS;
+else
+f->flags &= ~AV_FRAME_FLAG_LOSSLESS;
 f->pict_type = (s->s.h.keyframe || s->s.h.intraonly) ? AV_PICTURE_TYPE_I : 
AV_PICTURE_TYPE_P;
 
 // Non-existent frames have the implicit dimension 0x0 != CUR_FRAME
diff --git a/libavcodec/webp.c b/libavcodec/webp.c
index b624458d67..a965e50ac4 100644
--- a/libavcodec/webp.c
+++ b/libavcodec/webp.c
@@ -1191,6 +1191,7 @@ static int vp8_lossless_decode_frame(AVCodecContext 
*avctx, AVFrame *p,
 *got_frame   = 1;
 p->pict_type = AV_PICTURE_TYPE_I;
 p->flags |= AV_FRAME_FLAG_KEY;
+p->flags |= AV_FRAME_FLAG_LOSSLESS;
 ret  = data_size;
 
 free_and_return:
-- 
2.43.0

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

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


[FFmpeg-devel] [PATCH 1/4] avcodec/frame: add AV_FRAME_FLAG_LOSSLESS

2024-12-14 Thread Marton Balint
Signed-off-by: Marton Balint 
---
 doc/APIchanges   | 3 +++
 libavcodec/version.h | 2 +-
 libavutil/frame.h| 4 
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 3a75b803a9..bfba0946d3 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07
 
 API changes, most recent first:
 
+2024-12-xx - xx - lavc 61.27.100 - frame.h
+  Add AV_FRAME_FLAG_LOSSLESS.
+
 2024-12-13 - xx - lavu 59.50.100 - channel_layout.h
   Add AV_CH_LAYOUT_9POINT1POINT6 and AV_CHANNEL_LAYOUT_9POINT1POINT6.
 
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 26ee41eb1f..735c8b813c 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #include "version_major.h"
 
-#define LIBAVCODEC_VERSION_MINOR  26
+#define LIBAVCODEC_VERSION_MINOR  27
 #define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
diff --git a/libavutil/frame.h b/libavutil/frame.h
index c107f43bc0..a469e54e20 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -651,6 +651,10 @@ typedef struct AVFrame {
  * is interlaced.
  */
 #define AV_FRAME_FLAG_TOP_FIELD_FIRST (1 << 4)
+/**
+ * A flag to mark frames which were encoded losslessly from the input.
+ */
+#define AV_FRAME_FLAG_LOSSLESS(1 << 5)
 /**
  * @}
  */
-- 
2.43.0

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

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


[FFmpeg-devel] [PATCH 4/4] avcodec: deprecate AVCodecContext properties

2024-12-14 Thread Marton Balint
These properties are unreliable because they depend on the frames decoded so
far, users should check directly the presence of the decoded AVFrame side data
or AVFrame flags.

Signed-off-by: Marton Balint 
---
 doc/APIchanges | 3 +++
 libavcodec/av1dec.c| 8 
 libavcodec/avcodec.c   | 4 
 libavcodec/avcodec.h   | 3 +++
 libavcodec/h2645_sei.c | 8 
 libavcodec/hevc/hevcdec.c  | 8 
 libavcodec/jpeg2000dec.c   | 4 
 libavcodec/libdav1d.c  | 8 
 libavcodec/mjpegdec.c  | 8 
 libavcodec/mpeg12dec.c | 4 
 libavcodec/pthread_frame.c | 4 
 libavcodec/version.h   | 2 +-
 libavcodec/version_major.h | 1 +
 libavcodec/vp9.c   | 4 
 libavcodec/webp.c  | 4 
 libavformat/dump.c | 4 
 16 files changed, 76 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index bfba0946d3..52850d2cd4 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07
 
 API changes, most recent first:
 
+2024-12-xx - xx - lavc 61.28.100 - frame.h
+  Deprecate AVCodecContext->properties.
+
 2024-12-xx - xx - lavc 61.27.100 - frame.h
   Add AV_FRAME_FLAG_LOSSLESS.
 
diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index bc4ef63e68..93551d9d7b 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -788,10 +788,14 @@ static int set_context_with_sequence(AVCodecContext 
*avctx,
 break;
 }
 
+#if FF_API_CODEC_PROPS
+FF_DISABLE_DEPRECATION_WARNINGS
 if (seq->film_grain_params_present)
 avctx->properties |= FF_CODEC_PROPERTY_FILM_GRAIN;
 else
 avctx->properties &= ~FF_CODEC_PROPERTY_FILM_GRAIN;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
 
 if (avctx->width != width || avctx->height != height) {
 int ret = ff_set_dimensions(avctx, width, height);
@@ -983,7 +987,11 @@ static int export_itut_t35(AVCodecContext *avctx, AVFrame 
*frame,
 if (ret < 0)
 return ret;
 
+#if FF_API_CODEC_PROPS
+FF_DISABLE_DEPRECATION_WARNINGS
 avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
 break;
 }
 default: // ignore unsupported identifiers
diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index 1fa8704c9d..89001158ca 100644
--- a/libavcodec/avcodec.c
+++ b/libavcodec/avcodec.c
@@ -647,12 +647,16 @@ void avcodec_string(char *buf, int buf_size, 
AVCodecContext *enc, int encode)
 if (encode) {
 av_bprintf(&bprint, ", q=%d-%d", enc->qmin, enc->qmax);
 } else {
+#if FF_API_CODEC_PROPS
+FF_DISABLE_DEPRECATION_WARNINGS
 if (enc->properties & FF_CODEC_PROPERTY_CLOSED_CAPTIONS)
 av_bprintf(&bprint, ", Closed Captions");
 if (enc->properties & FF_CODEC_PROPERTY_FILM_GRAIN)
 av_bprintf(&bprint, ", Film Grain");
 if (enc->properties & FF_CODEC_PROPERTY_LOSSLESS)
 av_bprintf(&bprint, ", lossless");
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
 }
 break;
 case AVMEDIA_TYPE_AUDIO:
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 77ca8dee1f..cc6317075a 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1798,15 +1798,18 @@ typedef struct AVCodecContext {
 #define FF_LEVEL_UNKNOWN -99
 #endif
 
+#if FF_API_CODEC_PROPS
 /**
  * Properties of the stream that gets decoded
  * - encoding: unused
  * - decoding: set by libavcodec
  */
+attribute_deprecated
 unsigned properties;
 #define FF_CODEC_PROPERTY_LOSSLESS0x0001
 #define FF_CODEC_PROPERTY_CLOSED_CAPTIONS 0x0002
 #define FF_CODEC_PROPERTY_FILM_GRAIN  0x0004
+#endif
 
 /**
  * Skip loop filtering for selected frames.
diff --git a/libavcodec/h2645_sei.c b/libavcodec/h2645_sei.c
index 986d1d250a..d7a5a84790 100644
--- a/libavcodec/h2645_sei.c
+++ b/libavcodec/h2645_sei.c
@@ -807,7 +807,11 @@ int ff_h2645_sei_to_frame(AVFrame *frame, H2645SEI *sei,
 if (!sd)
 av_buffer_unref(&a53->buf_ref);
 a53->buf_ref = NULL;
+#if FF_API_CODEC_PROPS
+FF_DISABLE_DEPRECATION_WARNINGS
 avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
 }
 
 ret = h2645_sei_to_side_data(avctx, sei, &frame->side_data, 
&frame->nb_side_data);
@@ -900,7 +904,11 @@ FF_ENABLE_DEPRECATION_WARNINGS
 else
 fgc->present = fgc->persistence_flag;
 
+#if FF_API_CODEC_PROPS
+FF_DISABLE_DEPRECATION_WARNINGS
 avctx->properties |= FF_CODEC_PROPERTY_FILM_GRAIN;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
 }
 
 #if CONFIG_HEVC_SEI
diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c
index be35a9de82..8fbfc19ca3 100644
--- a/libavcodec/hevc/hevcdec.c
+++ b/libavcodec/hevc/hevcdec.c
@@ -403,8 +403,12 @@ static int export_stream_params_from_se

Re: [FFmpeg-devel] [PATCH 1/4] avcodec/frame: add AV_FRAME_FLAG_LOSSLESS

2024-12-14 Thread 阿儒
a0909518...@gmail.com 於 2024年12月15日 週日,08:03寫道:

> Signed-off-by: Marton Balint 
> ---
>  doc/APIchanges   | 3 +++
>  libavcodec/version.h | 2 +-
>  libavutil/frame.h| 4 
>  3 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/doc/APIchanges b/doc/APIchanges
> index 3a75b803a9..bfba0946d3 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -2,6 +2,9 @@ The last version increases of all libraries were on
> 2024-03-07
>
>  API changes, most recent first:
>
> +2024-12-xx - xx - lavc 61.27.100 - frame.h
> +  Add AV_FRAME_FLAG_LOSSLESS.
> +
>  2024-12-13 - xx - lavu 59.50.100 - channel_layout.h
>Add AV_CH_LAYOUT_9POINT1POINT6 and AV_CHANNEL_LAYOUT_9POINT1POINT6.
>
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index 26ee41eb1f..735c8b813c 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -29,7 +29,7 @@
>
>  #include "version_major.h"
>
> -#define LIBAVCODEC_VERSION_MINOR  26
> +#define LIBAVCODEC_VERSION_MINOR  27
>  #define LIBAVCODEC_VERSION_MICRO 100
>
>  #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
> diff --git a/libavutil/frame.h b/libavutil/frame.h
> index c107f43bc0..a469e54e20 100644
> --- a/libavutil/frame.h
> +++ b/libavutil/frame.h
> @@ -651,6 +651,10 @@ typedef struct AVFrame {
>   * is interlaced.
>   */
>  #define AV_FRAME_FLAG_TOP_FIELD_FIRST (1 << 4)
> +/**
> + * A flag to mark frames which were encoded losslessly from the input.
> + */
> +#define AV_FRAME_FLAG_LOSSLESS(1 << 5)
>  /**
>   * @}
>   */
> --
> 2.43.0
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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