[FFmpeg-devel] [PATCH v5 1/9] cbs_av1: fix incorrect data type

2021-10-12 Thread Fei Wang
Since order_hint_bits_minus_1 range is 0~7, cur_frame_hint can be
most 128. And similar return value for cbs_av1_get_relative_dist.
So if plus them and use int8_t for the result may lose its precision.

Signed-off-by: Fei Wang 
---
update:
1. move additional film grain frame from av1dec.c to vaapi_av1.c
2. patch 3~5 can fix clip:
https://drive.google.com/file/d/1Qdx_18_BFcFf_5_XXSZOVohLpaAb-yIw/view?usp=sharing

 libavcodec/cbs_av1_syntax_template.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/cbs_av1_syntax_template.c 
b/libavcodec/cbs_av1_syntax_template.c
index 6fe6e9a4f3..d98d3d42de 100644
--- a/libavcodec/cbs_av1_syntax_template.c
+++ b/libavcodec/cbs_av1_syntax_template.c
@@ -355,7 +355,7 @@ static int FUNC(set_frame_refs)(CodedBitstreamContext *ctx, 
RWContext *rw,
 AV1_REF_FRAME_ALTREF2, AV1_REF_FRAME_ALTREF
 };
 int8_t ref_frame_idx[AV1_REFS_PER_FRAME], used_frame[AV1_NUM_REF_FRAMES];
-int8_t shifted_order_hints[AV1_NUM_REF_FRAMES];
+int16_t shifted_order_hints[AV1_NUM_REF_FRAMES];
 int cur_frame_hint, latest_order_hint, earliest_order_hint, ref;
 int i, j;
 
-- 
2.25.1

___
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 v5 2/9] avcodec/av1: extend some definitions in spec section 3

2021-10-12 Thread Fei Wang
Signed-off-by: Fei Wang 
---
 libavcodec/av1.h | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/libavcodec/av1.h b/libavcodec/av1.h
index 0f99ae4829..951a18ecb2 100644
--- a/libavcodec/av1.h
+++ b/libavcodec/av1.h
@@ -114,6 +114,13 @@ enum {
 AV1_WARP_MODEL_TRANSLATION = 1,
 AV1_WARP_MODEL_ROTZOOM = 2,
 AV1_WARP_MODEL_AFFINE  = 3,
+AV1_WARP_PARAM_REDUCE_BITS = 6,
+
+AV1_DIV_LUT_BITS  = 8,
+AV1_DIV_LUT_PREC_BITS = 14,
+AV1_DIV_LUT_NUM   = 257,
+
+AV1_MAX_LOOP_FILTER = 63,
 };
 
 
-- 
2.25.1

___
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 v5 3/9] avcodec/av1dec: support setup shear process

2021-10-12 Thread Fei Wang
Defined in spec 7.11.3.6/7.11.3.7.

Signed-off-by: Fei Wang 
---
 libavcodec/av1dec.c | 98 +
 libavcodec/av1dec.h |  1 +
 2 files changed, 99 insertions(+)

diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index a69808f7b6..db110c50c7 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -28,6 +28,34 @@
 #include "internal.h"
 #include "profiles.h"
 
+/**< same with Div_Lut defined in spec 7.11.3.7 */
+static const uint16_t div_lut[AV1_DIV_LUT_NUM] = {
+  16384, 16320, 16257, 16194, 16132, 16070, 16009, 15948, 15888, 15828, 15768,
+  15709, 15650, 15592, 15534, 15477, 15420, 15364, 15308, 15252, 15197, 15142,
+  15087, 15033, 14980, 14926, 14873, 14821, 14769, 14717, 14665, 14614, 14564,
+  14513, 14463, 14413, 14364, 14315, 14266, 14218, 14170, 14122, 14075, 14028,
+  13981, 13935, 13888, 13843, 13797, 13752, 13707, 13662, 13618, 13574, 13530,
+  13487, 13443, 13400, 13358, 13315, 13273, 13231, 13190, 13148, 13107, 13066,
+  13026, 12985, 12945, 12906, 12866, 12827, 12788, 12749, 12710, 12672, 12633,
+  12596, 12558, 12520, 12483, 12446, 12409, 12373, 12336, 12300, 12264, 12228,
+  12193, 12157, 12122, 12087, 12053, 12018, 11984, 11950, 11916, 11882, 11848,
+  11815, 11782, 11749, 11716, 11683, 11651, 11619, 11586, 11555, 11523, 11491,
+  11460, 11429, 11398, 11367, 11336, 11305, 11275, 11245, 11215, 11185, 11155,
+  11125, 11096, 11067, 11038, 11009, 10980, 10951, 10923, 10894, 10866, 10838,
+  10810, 10782, 10755, 10727, 10700, 10673, 10645, 10618, 10592, 10565, 10538,
+  10512, 10486, 10460, 10434, 10408, 10382, 10356, 10331, 10305, 10280, 10255,
+  10230, 10205, 10180, 10156, 10131, 10107, 10082, 10058, 10034, 10010, 9986,
+  9963,  9939,  9916,  9892,  9869,  9846,  9823,  9800,  9777,  9754,  9732,
+  9709,  9687,  9664,  9642,  9620,  9598,  9576,  9554,  9533,  9511,  9489,
+  9468,  9447,  9425,  9404,  9383,  9362,  9341,  9321,  9300,  9279,  9259,
+  9239,  9218,  9198,  9178,  9158,  9138,  9118,  9098,  9079,  9059,  9039,
+  9020,  9001,  8981,  8962,  8943,  8924,  8905,  8886,  8867,  8849,  8830,
+  8812,  8793,  8775,  8756,  8738,  8720,  8702,  8684,  8666,  8648,  8630,
+  8613,  8595,  8577,  8560,  8542,  8525,  8508,  8490,  8473,  8456,  8439,
+  8422,  8405,  8389,  8372,  8355,  8339,  8322,  8306,  8289,  8273,  8257,
+  8240,  8224,  8208,  8192
+};
+
 static uint32_t inverse_recenter(int r, uint32_t v)
 {
 if (v > 2 * r)
@@ -97,6 +125,70 @@ static void read_global_param(AV1DecContext *s, int type, 
int ref, int idx)
-mx, mx + 1, r) << prec_diff) + round;
 }
 
+static uint64_t round_two(uint64_t x, uint16_t n)
+{
+if (n == 0)
+return x;
+return ((x + ((uint64_t)1 << (n - 1))) >> n);
+}
+
+static int64_t round_two_signed(int64_t x, uint16_t n)
+{
+return ((x<0) ? -((int64_t)round_two(-x, n)) : (int64_t)round_two(x, n));
+}
+
+/**
+ * Resolve divisor process.
+ * see spec 7.11.3.7
+ */
+static int16_t resolve_divisor(uint32_t d, uint16_t *shift)
+{
+int32_t e, f;
+
+*shift = av_log2(d);
+e = d - (1 << (*shift));
+if (*shift > AV1_DIV_LUT_BITS)
+f = round_two(e, *shift - AV1_DIV_LUT_BITS);
+else
+f = e << (AV1_DIV_LUT_BITS - (*shift));
+
+*shift += AV1_DIV_LUT_PREC_BITS;
+
+return div_lut[f];
+}
+
+/**
+ * check if global motion params is valid.
+ * see spec 7.11.3.6
+ */
+static uint8_t get_shear_params_valid(AV1DecContext *s, int idx)
+{
+int16_t alpha, beta, gamma, delta, divf, divs;
+int64_t v, w;
+int32_t *param = &s->cur_frame.gm_params[idx][0];
+if (param[2] < 0)
+return 0;
+
+alpha = av_clip_int16(param[2] - (1 << AV1_WARPEDMODEL_PREC_BITS));
+beta  = av_clip_int16(param[3]);
+divf  = resolve_divisor(abs(param[2]), &divs);
+v = (int64_t)param[4] * (1 << AV1_WARPEDMODEL_PREC_BITS);
+w = (int64_t)param[3] * param[4];
+gamma = av_clip_int16((int)round_two_signed((v * divf), divs));
+delta = av_clip_int16(param[5] - (int)round_two_signed((w * divf), divs) - 
(1 << AV1_WARPEDMODEL_PREC_BITS));
+
+alpha = round_two_signed(alpha, AV1_WARP_PARAM_REDUCE_BITS) << 
AV1_WARP_PARAM_REDUCE_BITS;
+beta  = round_two_signed(beta,  AV1_WARP_PARAM_REDUCE_BITS) << 
AV1_WARP_PARAM_REDUCE_BITS;
+gamma = round_two_signed(gamma, AV1_WARP_PARAM_REDUCE_BITS) << 
AV1_WARP_PARAM_REDUCE_BITS;
+delta = round_two_signed(delta, AV1_WARP_PARAM_REDUCE_BITS) << 
AV1_WARP_PARAM_REDUCE_BITS;
+
+if ((4 * abs(alpha) + 7 * abs(beta)) >= (1 << AV1_WARPEDMODEL_PREC_BITS) ||
+(4 * abs(gamma) + 4 * abs(delta)) >= (1 << AV1_WARPEDMODEL_PREC_BITS))
+return 0;
+
+return 1;
+}
+
 /**
 * update gm type/params, since cbs already implemented part of this funcation,
 * so we don't need to full implement spec.
@@ -144,6 +236,9 @@ static void global_motion_params(AV1DecContext *s)
 read_global_param(s, type, ref, 0);
 read_global_param(s, 

[FFmpeg-devel] [PATCH v5 4/9] avcodec/av1_vaapi: add gm params valid check

2021-10-12 Thread Fei Wang
Signed-off-by: Fei Wang 
---
 libavcodec/vaapi_av1.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/vaapi_av1.c b/libavcodec/vaapi_av1.c
index 16b7e35747..f577447be4 100644
--- a/libavcodec/vaapi_av1.c
+++ b/libavcodec/vaapi_av1.c
@@ -213,7 +213,8 @@ static int vaapi_av1_start_frame(AVCodecContext *avctx,
 frame_header->height_in_sbs_minus_1[i];
 }
 for (int i = AV1_REF_FRAME_LAST; i <= AV1_REF_FRAME_ALTREF; i++) {
-pic_param.wm[i - 1].wmtype = s->cur_frame.gm_type[i];
+pic_param.wm[i - 1].invalid = s->cur_frame.gm_invalid[i];
+pic_param.wm[i - 1].wmtype  = s->cur_frame.gm_type[i];
 for (int j = 0; j < 6; j++)
 pic_param.wm[i - 1].wmmat[j] = s->cur_frame.gm_params[i][j];
 }
-- 
2.25.1

___
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 v5 5/9] avcodec/dxva2_av1: fix global motion params

2021-10-12 Thread Fei Wang
From: Tong Wu 

Defined in spec 5.9.24/5.9.25. Since function void
global_motion_params(AV1DecContext *s) already updates
gm type/params, the wminvalid parameter only need to get
the value from cur_frame.gm_invalid.

Signed-off-by: Tong Wu 
---
 libavcodec/dxva2_av1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/dxva2_av1.c b/libavcodec/dxva2_av1.c
index c30b57799c..8a912bf6c1 100644
--- a/libavcodec/dxva2_av1.c
+++ b/libavcodec/dxva2_av1.c
@@ -139,7 +139,7 @@ static int fill_picture_parameters(const AVCodecContext 
*avctx, AVDXVAContext *c
 pp->frame_refs[i].Index  = ref_frame->buf[0] ? ref_idx : 0xFF;
 
 /* Global Motion */
-pp->frame_refs[i].wminvalid = (h->cur_frame.gm_type[AV1_REF_FRAME_LAST 
+ i] == AV1_WARP_MODEL_IDENTITY);
+pp->frame_refs[i].wminvalid = 
h->cur_frame.gm_invalid[AV1_REF_FRAME_LAST + i];
 pp->frame_refs[i].wmtype= h->cur_frame.gm_type[AV1_REF_FRAME_LAST 
+ i];
 for (j = 0; j < 6; ++j) {
  pp->frame_refs[i].wmmat[j] = 
h->cur_frame.gm_params[AV1_REF_FRAME_LAST + i][j];
-- 
2.25.1

___
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 v5 8/9] avcodec/av1_vaapi: enable segmentation features

2021-10-12 Thread Fei Wang
Signed-off-by: Fei Wang 
---
 libavcodec/vaapi_av1.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/libavcodec/vaapi_av1.c b/libavcodec/vaapi_av1.c
index 26476c7738..c57d1b898a 100644
--- a/libavcodec/vaapi_av1.c
+++ b/libavcodec/vaapi_av1.c
@@ -126,6 +126,9 @@ static int vaapi_av1_start_frame(AVCodecContext *avctx,
 int err = 0;
 int apply_grain = !(avctx->export_side_data & 
AV_CODEC_EXPORT_DATA_FILM_GRAIN) && film_grain->apply_grain;
 uint8_t remap_lr_type[4] = {AV1_RESTORE_NONE, AV1_RESTORE_SWITCHABLE, 
AV1_RESTORE_WIENER, AV1_RESTORE_SGRPROJ};
+uint8_t segmentation_feature_signed[AV1_SEG_LVL_MAX] = {1, 1, 1, 1, 1, 0, 
0, 0};
+uint8_t segmentation_feature_max[AV1_SEG_LVL_MAX] = {255, 
AV1_MAX_LOOP_FILTER,
+AV1_MAX_LOOP_FILTER, AV1_MAX_LOOP_FILTER, AV1_MAX_LOOP_FILTER, 7 , 0 , 
0 };
 
 bit_depth_idx = vaapi_av1_get_bit_depth_idx(avctx);
 if (bit_depth_idx < 0)
@@ -293,6 +296,17 @@ static int vaapi_av1_start_frame(AVCodecContext *avctx,
 for (int j = 0; j < 6; j++)
 pic_param.wm[i - 1].wmmat[j] = s->cur_frame.gm_params[i][j];
 }
+for (int i = 0; i < AV1_MAX_SEGMENTS; i++) {
+for (int j = 0; j < AV1_SEG_LVL_MAX; j++) {
+pic_param.seg_info.feature_mask[i] |= 
(frame_header->feature_enabled[i][j] << j);
+if (segmentation_feature_signed[j])
+pic_param.seg_info.feature_data[i][j] = 
av_clip(frame_header->feature_value[i][j],
+-segmentation_feature_max[j], segmentation_feature_max[j]);
+else
+pic_param.seg_info.feature_data[i][j] = 
av_clip(frame_header->feature_value[i][j],
+0, segmentation_feature_max[j]);
+}
+}
 if (apply_grain) {
 for (int i = 0; i < film_grain->num_y_points; i++) {
 pic_param.film_grain_info.point_y_value[i] =
-- 
2.25.1

___
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 v5 6/9] avcodec/vaapi: increase av1 decode pool size

2021-10-12 Thread Fei Wang
For film grain clip, vaapi_av1 decoder will cache additional 8
surfaces that will be used to store frames which apply film grain.
So increase the pool size by plus 8 to avoid leak of surface.

Signed-off-by: Fei Wang 
---
 libavcodec/vaapi_decode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c
index 958ddf49da..665af370ed 100644
--- a/libavcodec/vaapi_decode.c
+++ b/libavcodec/vaapi_decode.c
@@ -577,10 +577,10 @@ static int vaapi_decode_make_config(AVCodecContext *avctx,
 switch (avctx->codec_id) {
 case AV_CODEC_ID_H264:
 case AV_CODEC_ID_HEVC:
+case AV_CODEC_ID_AV1:
 frames->initial_pool_size += 16;
 break;
 case AV_CODEC_ID_VP9:
-case AV_CODEC_ID_AV1:
 frames->initial_pool_size += 8;
 break;
 case AV_CODEC_ID_VP8:
-- 
2.25.1

___
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 v5 9/9] avcodec/av1_vaapi: improve decode quality

2021-10-12 Thread Fei Wang
- quantizer delta and matrix level specific.
- support loop filter delta.
- support use superres.

Signed-off-by: Fei Wang 
---
 libavcodec/vaapi_av1.c | 68 +-
 1 file changed, 41 insertions(+), 27 deletions(-)

diff --git a/libavcodec/vaapi_av1.c b/libavcodec/vaapi_av1.c
index c57d1b898a..5985493b8d 100644
--- a/libavcodec/vaapi_av1.c
+++ b/libavcodec/vaapi_av1.c
@@ -147,27 +147,35 @@ static int vaapi_av1_start_frame(AVCodecContext *avctx,
 
 memset(&pic_param, 0, sizeof(VADecPictureParameterBufferAV1));
 pic_param = (VADecPictureParameterBufferAV1) {
-.profile = seq->seq_profile,
-.order_hint_bits_minus_1 = seq->order_hint_bits_minus_1,
-.bit_depth_idx   = bit_depth_idx,
-.current_frame   = pic->output_surface,
-.current_display_picture = pic->output_surface,
-.current_display_picture = vaapi_av1_surface_id(&s->cur_frame),
-.frame_width_minus1  = frame_header->frame_width_minus_1,
-.frame_height_minus1 = frame_header->frame_height_minus_1,
-.primary_ref_frame   = frame_header->primary_ref_frame,
-.order_hint  = frame_header->order_hint,
-.tile_cols   = frame_header->tile_cols,
-.tile_rows   = frame_header->tile_rows,
-.context_update_tile_id  = frame_header->context_update_tile_id,
-.interp_filter   = frame_header->interpolation_filter,
-.filter_level[0] = frame_header->loop_filter_level[0],
-.filter_level[1] = frame_header->loop_filter_level[1],
-.filter_level_u  = frame_header->loop_filter_level[2],
-.filter_level_v  = frame_header->loop_filter_level[3],
-.base_qindex = frame_header->base_q_idx,
-.cdef_damping_minus_3= frame_header->cdef_damping_minus_3,
-.cdef_bits   = frame_header->cdef_bits,
+.profile= seq->seq_profile,
+.order_hint_bits_minus_1= seq->order_hint_bits_minus_1,
+.bit_depth_idx  = bit_depth_idx,
+.matrix_coefficients= seq->color_config.matrix_coefficients,
+.current_frame  = pic->output_surface,
+.current_display_picture= vaapi_av1_surface_id(&s->cur_frame),
+.frame_width_minus1 = frame_header->frame_width_minus_1,
+.frame_height_minus1= frame_header->frame_height_minus_1,
+.primary_ref_frame  = frame_header->primary_ref_frame,
+.order_hint = frame_header->order_hint,
+.tile_cols  = frame_header->tile_cols,
+.tile_rows  = frame_header->tile_rows,
+.context_update_tile_id = frame_header->context_update_tile_id,
+.superres_scale_denominator = frame_header->use_superres ?
+frame_header->coded_denom + 
AV1_SUPERRES_DENOM_MIN :
+AV1_SUPERRES_NUM,
+.interp_filter  = frame_header->interpolation_filter,
+.filter_level[0]= frame_header->loop_filter_level[0],
+.filter_level[1]= frame_header->loop_filter_level[1],
+.filter_level_u = frame_header->loop_filter_level[2],
+.filter_level_v = frame_header->loop_filter_level[3],
+.base_qindex= frame_header->base_q_idx,
+.y_dc_delta_q   = frame_header->delta_q_y_dc,
+.u_dc_delta_q   = frame_header->delta_q_u_dc,
+.u_ac_delta_q   = frame_header->delta_q_u_ac,
+.v_dc_delta_q   = frame_header->delta_q_v_dc,
+.v_ac_delta_q   = frame_header->delta_q_v_ac,
+.cdef_damping_minus_3   = frame_header->cdef_damping_minus_3,
+.cdef_bits  = frame_header->cdef_bits,
 .seq_info_fields.fields = {
 .still_picture  = seq->still_picture,
 .use_128x128_superblock = seq->use_128x128_superblock,
@@ -238,12 +246,15 @@ static int vaapi_av1_start_frame(AVCodecContext *avctx,
 .mode_ref_delta_update  = frame_header->loop_filter_delta_update,
 },
 .mode_control_fields.bits = {
-.delta_q_present_flag = frame_header->delta_q_present,
-.log2_delta_q_res = frame_header->delta_q_res,
-.tx_mode  = frame_header->tx_mode,
-.reference_select = frame_header->reference_select,
-.reduced_tx_set_used  = frame_header->reduced_tx_set,
-.skip_mode_present= frame_header->skip_mode_present,
+.delta_q_present_flag  = frame_header->delta_q_present,
+.log2_delta_q_res  = frame_header->delta_q_res,
+.delta_lf_present_flag = frame_header->delta_lf_present,
+ 

[FFmpeg-devel] [PATCH v5 7/9] avcodec/av1_vaapi: setting 2 output surface for film grain

2021-10-12 Thread Fei Wang
VAAPI needs 2 output surface for film grain frame. One used for
reference and the other used for applying film grain and pushing
to downstream.

Signed-off-by: Fei Wang 
---
 libavcodec/vaapi_av1.c | 115 ++---
 1 file changed, 108 insertions(+), 7 deletions(-)

diff --git a/libavcodec/vaapi_av1.c b/libavcodec/vaapi_av1.c
index f577447be4..26476c7738 100644
--- a/libavcodec/vaapi_av1.c
+++ b/libavcodec/vaapi_av1.c
@@ -21,8 +21,28 @@
 #include "libavutil/pixdesc.h"
 #include "hwconfig.h"
 #include "vaapi_decode.h"
+#include "internal.h"
 #include "av1dec.h"
 
+typedef struct VAAPIAV1FrameRef {
+ThreadFrame frame;
+int valid;
+} VAAPIAV1FrameRef;
+
+typedef struct VAAPIAV1DecContext {
+VAAPIDecodeContext base;
+
+/**
+ * For film grain case, VAAPI generate 2 output for each frame,
+ * current_frame will not apply film grain, and will be used for
+ * references for next frames. Maintain the reference list without
+ * applying film grain here. And current_display_picture will be
+ * used to apply film grain and push to downstream.
+*/
+VAAPIAV1FrameRef ref_tab[AV1_NUM_REF_FRAMES];
+ThreadFrame tmp_frame;
+} VAAPIAV1DecContext;
+
 static VASurfaceID vaapi_av1_surface_id(AV1Frame *vf)
 {
 if (vf)
@@ -49,6 +69,48 @@ static int8_t vaapi_av1_get_bit_depth_idx(AVCodecContext 
*avctx)
 return bit_depth == 8 ? 0 : bit_depth == 10 ? 1 : 2;
 }
 
+static int vaapi_av1_decode_init(AVCodecContext *avctx)
+{
+VAAPIAV1DecContext *ctx = avctx->internal->hwaccel_priv_data;
+
+ctx->tmp_frame.f = av_frame_alloc();
+if (!ctx->tmp_frame.f) {
+av_log(avctx, AV_LOG_ERROR,
+   "Failed to allocate frame.\n");
+return AVERROR(ENOMEM);
+}
+
+for (int i = 0; i < FF_ARRAY_ELEMS(ctx->ref_tab); i++) {
+ctx->ref_tab[i].frame.f = av_frame_alloc();
+if (!ctx->ref_tab[i].frame.f) {
+av_log(avctx, AV_LOG_ERROR,
+   "Failed to allocate reference table frame %d.\n", i);
+return AVERROR(ENOMEM);
+}
+ctx->ref_tab[i].valid = 0;
+}
+
+return ff_vaapi_decode_init(avctx);
+}
+
+static int vaapi_av1_decode_uninit(AVCodecContext *avctx)
+{
+VAAPIAV1DecContext *ctx = avctx->internal->hwaccel_priv_data;
+
+if (ctx->tmp_frame.f->buf[0])
+ff_thread_release_buffer(avctx, &ctx->tmp_frame);
+av_frame_free(&ctx->tmp_frame.f);
+
+for (int i = 0; i < FF_ARRAY_ELEMS(ctx->ref_tab); i++) {
+if (ctx->ref_tab[i].frame.f->buf[0])
+ff_thread_release_buffer(avctx, &ctx->ref_tab[i].frame);
+av_frame_free(&ctx->ref_tab[i].frame.f);
+}
+
+return ff_vaapi_decode_uninit(avctx);
+}
+
+
 static int vaapi_av1_start_frame(AVCodecContext *avctx,
  av_unused const uint8_t *buffer,
  av_unused uint32_t size)
@@ -58,18 +120,28 @@ static int vaapi_av1_start_frame(AVCodecContext *avctx,
 const AV1RawFrameHeader *frame_header = s->raw_frame_header;
 const AV1RawFilmGrainParams *film_grain = &s->cur_frame.film_grain;
 VAAPIDecodePicture *pic = s->cur_frame.hwaccel_picture_private;
+VAAPIAV1DecContext *ctx = avctx->internal->hwaccel_priv_data;
 VADecPictureParameterBufferAV1 pic_param;
 int8_t bit_depth_idx;
 int err = 0;
 int apply_grain = !(avctx->export_side_data & 
AV_CODEC_EXPORT_DATA_FILM_GRAIN) && film_grain->apply_grain;
 uint8_t remap_lr_type[4] = {AV1_RESTORE_NONE, AV1_RESTORE_SWITCHABLE, 
AV1_RESTORE_WIENER, AV1_RESTORE_SGRPROJ};
 
-pic->output_surface = vaapi_av1_surface_id(&s->cur_frame);
-
 bit_depth_idx = vaapi_av1_get_bit_depth_idx(avctx);
 if (bit_depth_idx < 0)
 goto fail;
 
+if (apply_grain) {
+if (ctx->tmp_frame.f->buf[0])
+ff_thread_release_buffer(avctx, &ctx->tmp_frame);
+err = ff_thread_get_buffer(avctx, &ctx->tmp_frame, 
AV_GET_BUFFER_FLAG_REF);
+if (err < 0)
+goto fail;
+pic->output_surface = ff_vaapi_get_surface_id(ctx->tmp_frame.f);
+} else {
+pic->output_surface = vaapi_av1_surface_id(&s->cur_frame);
+}
+
 memset(&pic_param, 0, sizeof(VADecPictureParameterBufferAV1));
 pic_param = (VADecPictureParameterBufferAV1) {
 .profile = seq->seq_profile,
@@ -77,6 +149,7 @@ static int vaapi_av1_start_frame(AVCodecContext *avctx,
 .bit_depth_idx   = bit_depth_idx,
 .current_frame   = pic->output_surface,
 .current_display_picture = pic->output_surface,
+.current_display_picture = vaapi_av1_surface_id(&s->cur_frame),
 .frame_width_minus1  = frame_header->frame_width_minus_1,
 .frame_height_minus1 = frame_header->frame_height_minus_1,
 .primary_ref_frame   = frame_header->primary_ref_frame,
@@ -185,7 +258,9 @@ static int vaapi_av1_start_frame(AVCodecContext *avctx,
 if (pic_param.pic_info_

Re: [FFmpeg-devel] [PATCH] avformat/mxf: support MCA audio information

2021-10-12 Thread Tomas Härdin
mån 2021-10-11 klockan 18:32 +0200 skrev Marc-Antoine Arnaud:
> ---
>  libavformat/mxf.h    |   1 +
>  libavformat/mxfdec.c | 276
> ++-
>  2 files changed, 271 insertions(+), 6 deletions(-)

Did we reach a consensus on this? While I think signalling ffmpeg to
create a remap filter is a good idea, I don't know whether we have any
mechanism for that at the moment. If we don't then perhaps that
shouldn't hold up this patch?

/Tomas

___
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 1/1] avutil/frame: Document the possibility of negative line sizes

2021-10-12 Thread Michael Niedermayer
On Thu, Sep 30, 2021 at 03:30:54AM +, Soft Works wrote:
> Signed-off-by: softworkz 
> ---
>  libavutil/frame.h | 13 +++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/libavutil/frame.h b/libavutil/frame.h
> index ff2540a20f..f07e690410 100644
> --- a/libavutil/frame.h
> +++ b/libavutil/frame.h
> @@ -304,7 +304,8 @@ typedef struct AVFrame {
>  #define AV_NUM_DATA_POINTERS 8
>  /**
>   * pointer to the picture/channel planes.
> - * This might be different from the first allocated byte
> + * This might be different from the first allocated byte. For video,
> + * it could even point to the end of the image data.
>   *
>   * Some decoders access areas outside 0,0 - width,height, please
>   * see avcodec_align_dimensions2(). Some filters and swscale can read
> @@ -313,11 +314,16 @@ typedef struct AVFrame {
>   *
>   * NOTE: Except for hwaccel formats, pointers not needed by the format
>   * MUST be set to NULL.
> + *
> + * @attention In case of video, the data[] pointers can point to the
> + * end of image data in order to reverse line order, when used in
> + * combination with negative values in the linesize[] array.
>   */
>  uint8_t *data[AV_NUM_DATA_POINTERS];
>  
>  /**
> - * For video, size in bytes of each picture line.
> + * For video, a positive or negative value, the ABS() value of which is 
> indicating
> + * the size in bytes of each picture line.

from an API point of view linesize really can be anything as long as
1. alignment at the start is legal
2. width*pixelsize is within the array for height times linesize

linesize definitly can be multiple actual lines both positive and negative
so as to acccess even and odd fields of a frame
negative for fliping
but there is more
linesize could be 0 for a more compact representation of a read only
constant color frame.
someone might even point out that one can compress gradients with 
|linesize|

signature.asc
Description: PGP 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".


[FFmpeg-devel] [PATCH v2 1/3] avformat/argo_asf: cleanup and NULL-terminate name field in header

2021-10-12 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 libavformat/argo_asf.c | 8 
 libavformat/argo_asf.h | 3 ++-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/libavformat/argo_asf.c b/libavformat/argo_asf.c
index 7e759c7c0c..acf30839b9 100644
--- a/libavformat/argo_asf.c
+++ b/libavformat/argo_asf.c
@@ -52,8 +52,8 @@ void ff_argo_asf_parse_file_header(ArgoASFFileHeader *hdr, 
const uint8_t *buf)
 hdr->version_minor  = AV_RL16(buf + 6);
 hdr->num_chunks = AV_RL32(buf + 8);
 hdr->chunk_offset   = AV_RL32(buf + 12);
-for (int i = 0; i < FF_ARRAY_ELEMS(hdr->name); i++)
-hdr->name[i]= AV_RL8(buf + 16 + i);
+memcpy(hdr->name, buf + 16, ASF_NAME_SIZE);
+hdr->name[ASF_NAME_SIZE] = '\0';
 }
 
 int ff_argo_asf_validate_file_header(AVFormatContext *s, const 
ArgoASFFileHeader *hdr)
@@ -331,7 +331,7 @@ static void argo_asf_write_file_header(const 
ArgoASFFileHeader *fhdr, AVIOContex
 avio_wl16( pb, fhdr->version_minor);
 avio_wl32( pb, fhdr->num_chunks);
 avio_wl32( pb, fhdr->chunk_offset);
-avio_write(pb, fhdr->name, sizeof(fhdr->name));
+avio_write(pb, fhdr->name, ASF_NAME_SIZE);
 }
 
 static void argo_asf_write_chunk_header(const ArgoASFChunkHeader *ckhdr, 
AVIOContext *pb)
@@ -368,7 +368,7 @@ static int argo_asf_write_header(AVFormatContext *s)
 } else {
 len = end - name;
 }
-memcpy(fhdr.name, name, FFMIN(len, sizeof(fhdr.name)));
+memcpy(fhdr.name, name, FFMIN(len, ASF_NAME_SIZE));
 
 chdr.num_blocks= 0;
 chdr.num_samples   = ASF_SAMPLE_COUNT;
diff --git a/libavformat/argo_asf.h b/libavformat/argo_asf.h
index e65125fb79..1fab31a90b 100644
--- a/libavformat/argo_asf.h
+++ b/libavformat/argo_asf.h
@@ -33,6 +33,7 @@
 #define ASF_CHUNK_HEADER_SIZE   20
 #define ASF_SAMPLE_COUNT32
 #define ASF_MIN_BUFFER_SIZE FFMAX(ASF_FILE_HEADER_SIZE, 
ASF_CHUNK_HEADER_SIZE)
+#define ASF_NAME_SIZE   8
 
 typedef struct ArgoASFFileHeader {
 uint32_tmagic;  /*< Magic Number, {'A', 'S', 'F', '\0'} */
@@ -40,7 +41,7 @@ typedef struct ArgoASFFileHeader {
 uint16_tversion_minor;  /*< File Minor Version. */
 uint32_tnum_chunks; /*< No. chunks in the file. */
 uint32_tchunk_offset;   /*< Offset to the first chunk from the start 
of the file. */
-int8_t  name[8];/*< Name. */
+charname[ASF_NAME_SIZE + 1]; /*< Name, +1 for NULL-terminator. */
 } ArgoASFFileHeader;
 
 typedef struct ArgoASFChunkHeader {
-- 
2.31.1

___
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] avformat/argo_asf: use title metadata when muxing

2021-10-12 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 libavformat/argo_asf.c | 16 
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/libavformat/argo_asf.c b/libavformat/argo_asf.c
index 740680ece1..2b3569ebc3 100644
--- a/libavformat/argo_asf.c
+++ b/libavformat/argo_asf.c
@@ -358,14 +358,22 @@ static int argo_asf_write_header(AVFormatContext *s)
 .num_chunks= 1,
 .chunk_offset  = ASF_FILE_HEADER_SIZE
 };
-const char *name = ctx->name, *end;
+AVDictionaryEntry *t;
+const char *name, *end;
 size_t len;
 
 /*
- * If the user specified a name, use it as is. Otherwise take the
- * basename and lop off the extension (if any).
+ * If the user specified a name, use it as is. Otherwise,
+ * try to use metadata (if present), then fall back to the
+ * filename (minus extension).
  */
-if (name || !(end = strrchr((name = av_basename(s->url)), '.'))) {
+if (ctx->name) {
+name = ctx->name;
+len  = strlen(ctx->name);
+} else if ((t = av_dict_get(s->metadata, "title", NULL, 0))) {
+name = t->value;
+len  = strlen(t->value);
+} else if (!(end = strrchr((name = av_basename(s->url)), '.'))) {
 len = strlen(name);
 } else {
 len = end - name;
-- 
2.31.1

___
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/3] avformat/argo_asf: pass name through as metadata

2021-10-12 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 libavformat/argo_asf.c  | 2 ++
 tests/ref/acodec/adpcm-argo | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/argo_asf.c b/libavformat/argo_asf.c
index acf30839b9..740680ece1 100644
--- a/libavformat/argo_asf.c
+++ b/libavformat/argo_asf.c
@@ -209,6 +209,8 @@ static int argo_asf_read_header(AVFormatContext *s)
 
 ff_argo_asf_parse_chunk_header(&asf->ckhdr, buf);
 
+av_dict_set(&s->metadata, "title", asf->fhdr.name, 0);
+
 return ff_argo_asf_fill_stream(s, st, &asf->fhdr, &asf->ckhdr);
 }
 
diff --git a/tests/ref/acodec/adpcm-argo b/tests/ref/acodec/adpcm-argo
index 127153c081..4032a8f1fe 100644
--- a/tests/ref/acodec/adpcm-argo
+++ b/tests/ref/acodec/adpcm-argo
@@ -1,4 +1,4 @@
 14b2507d14e95c20bb7ae49b4fcbcbf1 *tests/data/fate/acodec-adpcm-argo.argo_asf
 281190 tests/data/fate/acodec-adpcm-argo.argo_asf
-cc5e5c695adeaebaa2b1f0df5ebd59ee *tests/data/fate/acodec-adpcm-argo.out.wav
+446f28460bdb7ff4361cf7d82ac22c3e *tests/data/fate/acodec-adpcm-argo.out.wav
 stddev: 1542.05 PSNR: 32.57 MAXDIFF:59667 bytes:  1058400/  1058432
-- 
2.31.1

___
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] avformat/avio{, buf}: introduce public AVIOContext::bytes_read

2021-10-12 Thread Michael Niedermayer
On Mon, Oct 11, 2021 at 10:24:47PM +0300, Jan Ekström wrote:
> On Mon, Oct 4, 2021 at 12:12 PM Jan Ekström  wrote:
> >
> > On Mon, Oct 4, 2021 at 1:06 AM Michael Niedermayer
> >  wrote:
> > >
> > > On Mon, Oct 04, 2021 at 12:25:26AM +0300, Jan Ekström wrote:
> > > > On Sat, Oct 2, 2021 at 2:51 PM Michael Niedermayer
> > > >  wrote:
> > > > >
> > > > > On Sat, Oct 02, 2021 at 02:42:52PM +0300, Jan Ekström wrote:
> > > > > > On Sat, Oct 2, 2021 at 1:32 PM Michael Niedermayer
> > > > > >  wrote:
> > > > > > >
> > > > > > > On Sun, Sep 26, 2021 at 06:48:18PM +0300, Jan Ekström wrote:
> > > > > > > > Such a field can be seen as generally useful in cases where the
> > > > > > > > API user is not implementing custom AVIO callbacks, but still 
> > > > > > > > would
> > > > > > > > like to know if data is being read even if AVPackets are not 
> > > > > > > > being
> > > > > > > > returned.
> > > > > > > > ---
> > > > > > > > Originally I thought about making an accessor for the private 
> > > > > > > > field, to
> > > > > > > > not grow the public struct's size (and have a duplicate field, 
> > > > > > > > as well
> > > > > > > > as making sure the value was read-only). But an objection was 
> > > > > > > > raised
> > > > > > > > that such accessors should be refrained from as they 
> > > > > > > > unnecessarily
> > > > > > > > filled the function symbol space or so. Together with the 
> > > > > > > > objection, a
> > > > > > > > proposal of making it a field on the public struct that was 
> > > > > > > > only written
> > > > > > > > to was proposed.
> > > > > > > >
> > > > > > > > This patch follows that proposal.
> > > > > > > >
> > > > > > > >  doc/APIchanges| 3 +++
> > > > > > > >  libavformat/avio.h| 5 +
> > > > > > > >  libavformat/aviobuf.c | 2 ++
> > > > > > > >  libavformat/version.h | 2 +-
> > > > > > > >  4 files changed, 11 insertions(+), 1 deletion(-)
> > > > > > >
> > > > > > > There are 3 statistics, read, write and seek
> > > > > > > shouldnt all 3 be provided to the user?
> > > > > > >
> > > > > > > thx
> > > > > > >
> > > > > >
> > > > > > I added one which I have seen actually utilized by at least one API
> > > > > > client, and then others could be added as per responses.
> > > > > >
> > > > > > That is why I pinged, as I had not received any responses - either
> > > > > > positive or negative.
> > > > > >
> > > > >
> > > > > > Writing I can see a use for, seek I am not as sure of. But if you
> > > > > > believe all of them should be exposed I am fine with that.
> > > > >
> > > > > seek is timeconsuming especially if its over a network due to
> > > > > latency.
> > > > > So for example if suddenly the number of seeks changes that
> > > > > could be interresting.
> > > > >
> > > > > thx
> > > >
> > > > I would prefer to add fields which were noted as specifically private
> > > > and then cleaned up when there are actual API client users that would
> > > > see them as useful, or if there are clear use cases where they'd be
> > > > useful. I have seen the read bytes statistic actually being utilized
> > > > by an API client with a comment:
> > >
> > > Assume a network protocol, TCP, UDP, HTTP, RT*P whatever
> > > how do you tune the buffer sizes ?
> > > Can the number of seeks be used ?
> > > or from a different point of view, if there are alot of seeks should
> > > a user app try to increase the buffer sizes ?
> > >
> > > maybe iam missing something but when playing a not perfectly interleaved 
> > > file
> > > over the network the buffer size should be what makes the difference 
> > > between
> > > that working or not working
> > > ideally a user app shouldnt need to mess with this, of course and these 
> > > values
> > > should all be automagically adjusted
> > >
> > > If a user app fails to get packets in realtime over the network, it would
> > > fail to play that stream. Some user apps could display a warning message 
> > > to
> > > the user about it.
> > > If now the user app has access to the number of seeks it could be more
> > > specific in the warning to the user.
> > > "Unable to play network is maybe too slow"
> > > "Unable to play buffer is maybe too small or file is poorly interleaved"
> > > ...
> > >
> > > Maybe iam just seeing all this from the wrong side i dunno but to me it 
> > > seems
> > > usefull to a user app to have access to the number of seeks and these seem
> > > non contrived use cases to me ... Ive gotten random point to nowhere
> > > warnings about playback issues and restarting the computer obviously that
> > > never was the issue.
> > >
> > > thx
> > >
> >
> > OK, I think this is now focusing on the wrong point, sorry.
> >
> > I think it's just better for me to note that I am not the best person
> > to post (and thus be the one to argue for the usefulness in reviews if
> > someone asks why I am bringing those private entries that were once
> > removed back to the public struct) of those other entries.
> 
> Ping? Is this now in a purgatory state due to

[FFmpeg-devel] [PATCH 2/2] tools/target_dec_fuzzer: Adjust threshold for MXPEG

2021-10-12 Thread Michael Niedermayer
Fixes: Timeout
Fixes: 
39813/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MXPEG_fuzzer-6010298067189760

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 tools/target_dec_fuzzer.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index 88002316916..1a790f66427 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -184,6 +184,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 case AV_CODEC_ID_MSRLE:   maxpixels  /= 16;break;
 case AV_CODEC_ID_MSS2:maxpixels  /= 16384; break;
 case AV_CODEC_ID_MSZH:maxpixels  /= 128;   break;
+case AV_CODEC_ID_MXPEG:   maxpixels  /= 128;   break;
 case AV_CODEC_ID_OPUS:maxsamples /= 16384; break;
 case AV_CODEC_ID_PNG: maxpixels  /= 128;   break;
 case AV_CODEC_ID_APNG:maxpixels  /= 128;   break;
-- 
2.17.1

___
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/2] avcodec/speexdec: Seed should be unsigned otherwise the operations done on it are undefined

2021-10-12 Thread Michael Niedermayer
Fixes: signed integer overflow: 1664525000 + 1013904223 cannot be represented 
in type 'int'
Fixes: 
39865/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SPEEX_fuzzer-4979694508834816

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/speexdec.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/speexdec.c b/libavcodec/speexdec.c
index fccceab74cb..4c50f54f27b 100644
--- a/libavcodec/speexdec.c
+++ b/libavcodec/speexdec.c
@@ -140,7 +140,7 @@ typedef void (*innovation_quant_func)(float *, float *,
 
 /** Innovation unquantization function */
 typedef void (*innovation_unquant_func)(float *, const void *, int,
-GetBitContext *, int32_t *);
+GetBitContext *, uint32_t *);
 
 typedef struct SpeexSubmode {
 int lbr_pitch; /**< Set to -1 for "normal" modes, otherwise encode pitch 
using
@@ -191,7 +191,7 @@ typedef struct DecoderState {
 /* This is used in packet loss concealment */
 int last_pitch; /**< Pitch of last correctly decoded frame */
 float last_pitch_gain; /**< Pitch gain of last correctly decoded frame */
-int32_t seed; /** Seed used for random number generation */
+uint32_t seed; /** Seed used for random number generation */
 
 int encode_submode;
 const SpeexSubmode *const *submodes; /**< Sub-mode data */
@@ -293,7 +293,7 @@ static void forced_pitch_unquant(float *exc, float 
*exc_out, int start, int end,
 gain_val[1] = pitch_coef;
 }
 
-static inline float speex_rand(float std, int32_t *seed)
+static inline float speex_rand(float std, uint32_t *seed)
 {
 const uint32_t jflone = 0x3f80;
 const uint32_t jflmsk = 0x007f;
@@ -308,14 +308,14 @@ static inline float speex_rand(float std, int32_t *seed)
 }
 
 static void noise_codebook_unquant(float *exc, const void *par, int nsf,
-   GetBitContext *gb, int32_t *seed)
+   GetBitContext *gb, uint32_t *seed)
 {
 for (int i = 0; i < nsf; i++)
 exc[i] = speex_rand(1.f, seed);
 }
 
 static void split_cb_shape_sign_unquant(float *exc, const void *par, int nsf,
-GetBitContext *gb, int32_t *seed)
+GetBitContext *gb, uint32_t *seed)
 {
 int subvect_size, nb_subvect, have_sign, shape_bits;
 const SplitCodebookParams *params;
-- 
2.17.1

___
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] avformat/mov: Do not hard fail if bit rate calculation overflows unless in explode mode

2021-10-12 Thread Derek Buitenhuis
bit_rate is not a critical field, and we shouln't hard fail if we
can't caluclate it due to a large timebase - it needlessly breaks
valid files.

Signed-off-by: Derek Buitenhuis 
---
 libavformat/mov.c | 20 +++-
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index d0b8b2595b..99d10c2b33 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -7666,11 +7666,12 @@ static int mov_read_header(AVFormatContext *s)
 MOVStreamContext *sc = st->priv_data;
 if (st->duration > 0) {
 if (sc->data_size > INT64_MAX / sc->time_scale / 8) {
-av_log(s, AV_LOG_ERROR, "Overflow during bit rate 
calculation %"PRId64" * 8 * %d\n",
+av_log(s, AV_LOG_WARNING, "Overflow during bit rate 
calculation %"PRId64" * 8 * %d\n",
sc->data_size, sc->time_scale);
-return AVERROR_INVALIDDATA;
-}
-st->codecpar->bit_rate = sc->data_size * 8 * sc->time_scale / 
st->duration;
+if (s->error_recognition & AV_EF_EXPLODE)
+return AVERROR_INVALIDDATA;
+} else
+st->codecpar->bit_rate = sc->data_size * 8 * 
sc->time_scale / st->duration;
 }
 }
 }
@@ -7681,12 +7682,13 @@ static int mov_read_header(AVFormatContext *s)
 MOVStreamContext *sc = st->priv_data;
 if (sc->duration_for_fps > 0) {
 if (sc->data_size > INT64_MAX / sc->time_scale / 8) {
-av_log(s, AV_LOG_ERROR, "Overflow during bit rate 
calculation %"PRId64" * 8 * %d\n",
+av_log(s, AV_LOG_WARNING, "Overflow during bit rate 
calculation %"PRId64" * 8 * %d\n",
sc->data_size, sc->time_scale);
-return AVERROR_INVALIDDATA;
-}
-st->codecpar->bit_rate = sc->data_size * 8 * sc->time_scale /
-sc->duration_for_fps;
+if (s->error_recognition & AV_EF_EXPLODE)
+return AVERROR_INVALIDDATA;
+} else
+st->codecpar->bit_rate = sc->data_size * 8 * 
sc->time_scale /
+sc->duration_for_fps;
 }
 }
 }
-- 
2.32.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] avformat/mov: Do not hard fail if bit rate calculation overflows unless in explode mode

2021-10-12 Thread Michael Niedermayer
On Tue, Oct 12, 2021 at 02:50:40PM +0100, Derek Buitenhuis wrote:
> bit_rate is not a critical field, and we shouln't hard fail if we
> can't caluclate it due to a large timebase - it needlessly breaks
> valid files.
> 
> Signed-off-by: Derek Buitenhuis 
> ---
>  libavformat/mov.c | 20 +++-
>  1 file changed, 11 insertions(+), 9 deletions(-)
> 
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index d0b8b2595b..99d10c2b33 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -7666,11 +7666,12 @@ static int mov_read_header(AVFormatContext *s)
>  MOVStreamContext *sc = st->priv_data;
>  if (st->duration > 0) {
>  if (sc->data_size > INT64_MAX / sc->time_scale / 8) {
> -av_log(s, AV_LOG_ERROR, "Overflow during bit rate 
> calculation %"PRId64" * 8 * %d\n",
> +av_log(s, AV_LOG_WARNING, "Overflow during bit rate 
> calculation %"PRId64" * 8 * %d\n",
> sc->data_size, sc->time_scale);
> -return AVERROR_INVALIDDATA;
> -}
> -st->codecpar->bit_rate = sc->data_size * 8 * sc->time_scale 
> / st->duration;
> +if (s->error_recognition & AV_EF_EXPLODE)
> +return AVERROR_INVALIDDATA;
> +} else
> +st->codecpar->bit_rate = sc->data_size * 8 * 
> sc->time_scale / st->duration;
>  }

this should be using av_rescale() i think

thx


[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates


signature.asc
Description: PGP 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] avformat/mov: Do not hard fail if bit rate calculation overflows unless in explode mode

2021-10-12 Thread Derek Buitenhuis
On 10/12/2021 3:43 PM, Michael Niedermayer wrote:
> this should be using av_rescale() i think

That seems unrelated to this patch - but I can send a second patch
that does that, if you want.

Is your intent something like this;

if (sc->data_size > INT64_MAX / 8) {
av_log(s, AV_LOG_WARNING, "Overflow during bit rate calculation 
%"PRId64" * 8 > INT64_MAX\n",
   sc->data_size);
if (s->error_recognition & AV_EF_EXPLODE)
return AVERROR_INVALIDDATA;
} else
st->codecpar->bit_rate = av_rescale(sc->data_size * 8, c->time_scale, 
st->duration);

- Derek
___
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 v3 1/1] avformat: Add probe_streams option

2021-10-12 Thread Nicolas Gaullier
Allow user to disable codec probing:
- spdif (and s337m incl. s-adm in the future) is not sub-demuxed and
  may pass-through to a muxer
- disable any stream probing in wav files (dts detection).
- mpeg-ts files missing PAT/PMT are considered invalid.

Signed-off-by: Nicolas Gaullier 
---
 doc/formats.texi|  3 +++
 libavformat/avformat.h  |  9 +
 libavformat/mpeg.c  |  5 +++--
 libavformat/mpegts.c| 10 ++
 libavformat/options_table.h |  1 +
 libavformat/version.h   |  2 +-
 libavformat/wavdec.c|  8 +---
 7 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/doc/formats.texi b/doc/formats.texi
index 640b23b790..272a6a71e7 100644
--- a/doc/formats.texi
+++ b/doc/formats.texi
@@ -27,6 +27,9 @@ stream information. A higher value will enable detecting more
 information in case it is dispersed into the stream, but will increase
 latency. Must be an integer not lesser than 32. It is 500 by default.
 
+@item probe_streams @var{bool} (@emph{input})
+Enable codec probing if set to 1. Default is 1.
+
 @item max_probe_packets @var{integer} (@emph{input})
 Set the maximum number of buffered packets when probing a codec.
 Default is 2500 packets.
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index a2af7e9f89..daf37420d0 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1702,6 +1702,15 @@ typedef struct AVFormatContext {
  * - decoding: set by user
  */
 int max_probe_packets;
+
+/**
+ * Enable codec probing.
+ * When disabled: always trust the descriptors and allows pass-through of 
data such as spdif.
+ * @note mpegts missing PAT/PMT are considered invalid if codec probing is 
disabled.
+ * - encoding: unused
+ * - decoding: set by user
+ */
+int probe_streams;
 } AVFormatContext;
 
 /**
diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
index ca15d9f241..f795a258d6 100644
--- a/libavformat/mpeg.c
+++ b/libavformat/mpeg.c
@@ -557,7 +557,7 @@ redo:
 avio_seek(s->pb, -8, SEEK_CUR);
 if (!memcmp(buf, avs_seqh, 4) && (buf[6] != 0 || buf[7] != 1))
 codec_id = AV_CODEC_ID_CAVS;
-else
+else if (s->probe_streams)
 request_probe= 1;
 type = AVMEDIA_TYPE_VIDEO;
 } else if (startcode == PRIVATE_STREAM_2) {
@@ -568,7 +568,8 @@ redo:
 if (m->sofdec > 0) {
 codec_id = AV_CODEC_ID_ADPCM_ADX;
 // Auto-detect AC-3
-request_probe = 50;
+if (s->probe_streams)
+request_probe = 50;
 } else if (m->imkh_cctv && startcode == 0x1c0 && len > 80) {
 codec_id = AV_CODEC_ID_PCM_ALAW;
 request_probe = 50;
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 9a6bbb1c93..f9c23c49d3 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -917,7 +917,7 @@ static int mpegts_set_stream_info(AVStream *st, PESContext 
*pes,
 st->codecpar->codec_tag = pes->stream_type;
 
 mpegts_find_stream_type(st, pes->stream_type, ISO_types);
-if (pes->stream_type == 4 || pes->stream_type == 0x0f)
+if (pes->stream->probe_streams && (pes->stream_type == 4 || 
pes->stream_type == 0x0f))
 sti->request_probe = 50;
 if ((prog_reg_desc == AV_RL32("HDMV") ||
  prog_reg_desc == AV_RL32("HDPR")) &&
@@ -960,7 +960,8 @@ static int mpegts_set_stream_info(AVStream *st, PESContext 
*pes,
 stream_type == STREAM_TYPE_PRIVATE_DATA) {
 st->codecpar->codec_type = AVMEDIA_TYPE_DATA;
 st->codecpar->codec_id   = AV_CODEC_ID_BIN_DATA;
-sti->request_probe = AVPROBE_SCORE_STREAM_RETRY / 5;
+if (pes->stream->probe_streams)
+sti->request_probe = AVPROBE_SCORE_STREAM_RETRY / 5;
 }
 
 /* queue a context update if properties changed */
@@ -1195,7 +1196,8 @@ static int mpegts_push_data(MpegTSFilter *filter,
 pes->stream_id != STREAM_ID_TYPE_E_STREAM) {
 FFStream *const pes_sti = ffstream(pes->st);
 pes->state = MPEGTS_PESHEADER;
-if (pes->st->codecpar->codec_id == AV_CODEC_ID_NONE && 
!pes_sti->request_probe) {
+if (pes->stream->probe_streams &&
+pes->st->codecpar->codec_id == AV_CODEC_ID_NONE && 
!pes_sti->request_probe) {
 av_log(pes->stream, AV_LOG_TRACE,
 "pid=%x stream_type=%x probing\n",
 pes->pid,
@@ -2002,7 +2004,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, 
AVStream *st, int stream_type
 av_log(fc, AV_LOG_TRACE, "reg_desc=%.4s\n", (char 
*)&st->codecpar->codec_tag);
 if (st->codecpar->codec_id == AV_CODEC_ID_NONE || sti->request_probe > 
0) {
 mpegts_find_stream_type(st, st->codecpar->codec_tag, REGD_types);
-if (st->codecpar->codec_tag == MKTAG('B', 'S', 'S', 'D'

[FFmpeg-devel] [PATCH v3 0/1] Add-probe_streams-option

2021-10-12 Thread Nicolas Gaullier
>This is a following to a precedent work which was a too long patch serie:
>https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=2593
>At the end, s337m will be probed (if the user choose to) in WAV files.
>But it is important to maintain workfows where typically WAV files are remuxed 
>in MXF with s337m going through.
>
>I have reworked on what I think a user might expect when disabling codec 
>auto-detection.
>I have not disabled stream probing for some very specific or legacy cases 
>(asf, avi, mpg/Hikvision,sofdec) but maybe I should have.
>The main idea is to always trust the descriptors, even if it means crashing.
>Typically, an mpegts file having no PAT/PMT will not be supported at all. 
>There is a clear use case for that, for example when using ffprobe in front of 
>a transcoder that is not ffmpeg and not able to handle such files.

I am surprised there was no reaction to this patch: there is for sure things to 
discuss about what is a proposal for now.
This patch is required for me before rolling out my patch serie for s337m 
support in WAV files.
(This v3 is just a rebased version)

Thank you!
Nicolas


Nicolas Gaullier (1):
  avformat: Add probe_streams option

 doc/formats.texi|  3 +++
 libavformat/avformat.h  |  9 +
 libavformat/mpeg.c  |  5 +++--
 libavformat/mpegts.c| 10 ++
 libavformat/options_table.h |  1 +
 libavformat/version.h   |  2 +-
 libavformat/wavdec.c|  8 +---
 7 files changed, 28 insertions(+), 10 deletions(-)

-- 
2.33.0.windows.2

___
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/1] avutil/frame: Document the possibility of negative line sizes

2021-10-12 Thread Soft Works
Signed-off-by: softworkz 
---
 libavutil/frame.h | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/libavutil/frame.h b/libavutil/frame.h
index ff2540a20f..f07e690410 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -304,7 +304,8 @@ typedef struct AVFrame {
 #define AV_NUM_DATA_POINTERS 8
 /**
  * pointer to the picture/channel planes.
- * This might be different from the first allocated byte
+ * This might be different from the first allocated byte. For video,
+ * it could even point to the end of the image data.
  *
  * Some decoders access areas outside 0,0 - width,height, please
  * see avcodec_align_dimensions2(). Some filters and swscale can read
@@ -313,11 +314,16 @@ typedef struct AVFrame {
  *
  * NOTE: Except for hwaccel formats, pointers not needed by the format
  * MUST be set to NULL.
+ *
+ * @attention In case of video, the data[] pointers can point to the
+ * end of image data in order to reverse line order, when used in
+ * combination with negative values in the linesize[] array.
  */
 uint8_t *data[AV_NUM_DATA_POINTERS];
 
 /**
- * For video, size in bytes of each picture line.
+ * For video, a positive or negative value, which is typically indicating
+ * the size in bytes of each picture line, but it can also be:
+ * - the negative byte size of lines for vertical flipping
+ *   (with data[n] pointing to the end of the data
+ * - a positive or negative multiple of the byte size as for accessing
+ *   even and odd fields of a frame (possibly flipped)
+ * - 0 for a more compact representation of a read only
+ *   constant color frame
+ *
  * For audio, size in bytes of each plane.
  *
  * For audio, only linesize[0] may be set. For planar audio, each channel
@@ -330,6 +336,9 @@ typedef struct AVFrame {
  *
  * @note The linesize may be larger than the size of usable data -- there
  * may be extra padding present for performance reasons.
+ *
+ * @attention In case of video, line size values can be negative to achieve
+ * a vertically inverted iteration over image lines.
  */
 int linesize[AV_NUM_DATA_POINTERS];
 
-- 
2.30.2.windows.1

___
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] avformat/westwood_vqa: Store VQFL codebook chunks

2021-10-12 Thread Pekka Väänänen

Hi, still waiting for this to get merged.
I'm happy to make any changes if you still find something off.

Paul, I CC'd you since you've done function changes to this file in 2012.

Note that this is a prerequisite for a larger decoder patch:
https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2021-September/285843.html

See the review thread of this patch:
https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2021-September/285682.html
And for the bigger one:
https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2021-September/285685.html

Sincerely,
Pekka Väänänen
___
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 1/2] avcodec/speexdec: Seed should be unsigned otherwise the operations done on it are undefined

2021-10-12 Thread Paul B Mahol
ok
___
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] avformat/mov: Do not hard fail if bit rate calculation overflows unless in explode mode

2021-10-12 Thread Michael Niedermayer
On Tue, Oct 12, 2021 at 04:17:31PM +0100, Derek Buitenhuis wrote:
> On 10/12/2021 3:43 PM, Michael Niedermayer wrote:
> > this should be using av_rescale() i think
> 
> That seems unrelated to this patch - but I can send a second patch
> that does that, if you want.
> 
> Is your intent something like this;
> 
> if (sc->data_size > INT64_MAX / 8) {
> av_log(s, AV_LOG_WARNING, "Overflow during bit rate calculation 
> %"PRId64" * 8 > INT64_MAX\n",
>sc->data_size);
> if (s->error_recognition & AV_EF_EXPLODE)
> return AVERROR_INVALIDDATA;
> } else
> st->codecpar->bit_rate = av_rescale(sc->data_size * 8, c->time_scale, 
> st->duration);

i was thinking of something like
st->codecpar->bit_rate = av_rescale(sc->data_size, c->time_scale * 8LL, 
st->duration);

because i thought that would fix the overflow
but i didnt look beyond the code in this patch
this may still require some check so the value fits in bit_rate, i didnt
investigate that

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 


signature.asc
Description: PGP 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] avformat/mxf: support MCA audio information

2021-10-12 Thread Marton Balint



On Tue, 12 Oct 2021, Tomas Härdin wrote:


mån 2021-10-11 klockan 18:32 +0200 skrev Marc-Antoine Arnaud:

---
 libavformat/mxf.h    |   1 +
 libavformat/mxfdec.c | 276
++-
 2 files changed, 271 insertions(+), 6 deletions(-)


Did we reach a consensus on this? While I think signalling ffmpeg to
create a remap filter is a good idea, I don't know whether we have any
mechanism for that at the moment. If we don't then perhaps that
shouldn't hold up this patch?


I don't think there is any support for such rerouting in ffmpeg, so I 
believe a demuxer option to turn on/off in-demuxer rerouting is the best 
we can come up with if we don't want to delay this feature.


On the other hand, as far as I see, my comments have not been addressed 
yet:


http://ffmpeg.org/pipermail/ffmpeg-devel/2021-September/285856.html

Regards,
Marton
___
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] avformat/mxf: support MCA audio information

2021-10-12 Thread Pierre-Anthony Lemieux
On Tue, Oct 12, 2021 at 12:29 PM Marton Balint  wrote:
>
>
>
> On Tue, 12 Oct 2021, Tomas Härdin wrote:
>
> > mån 2021-10-11 klockan 18:32 +0200 skrev Marc-Antoine Arnaud:
> >> ---
> >>  libavformat/mxf.h|   1 +
> >>  libavformat/mxfdec.c | 276
> >> ++-
> >>  2 files changed, 271 insertions(+), 6 deletions(-)
> >
> > Did we reach a consensus on this? While I think signalling ffmpeg to
> > create a remap filter is a good idea, I don't know whether we have any
> > mechanism for that at the moment. If we don't then perhaps that
> > shouldn't hold up this patch?
>
> I don't think there is any support for such rerouting in ffmpeg, so I
> believe a demuxer option to turn on/off in-demuxer rerouting is the best
> we can come up with if we don't want to delay this feature.

I recommend that rerouting be enabled by default if MCA subdescriptors
are present since MCA subdescriptors are optional in MXF and, by
including them, the author explicitly signals a specific channel
order.

>
> On the other hand, as far as I see, my comments have not been addressed
> yet:
>
> http://ffmpeg.org/pipermail/ffmpeg-devel/2021-September/285856.html
>
> Regards,
> Marton
> ___
> 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 1/1] mov: read track title

2021-10-12 Thread Dong Nguyen
this change fixes issue [9438](https://trac.ffmpeg.org/ticket/9438)

after commit da9cc22d5bd5f59756c2037b02966376da2cf323
ffmpeg is able to write track title metadata to mov/mp4 format file
but it is not able to read back the metadata

if `udta` box is inside track box then update AvStream's metadata
instead of AVFormatContext.

Signed-off-by: Dong Nguyen 
---
 libavformat/mov.c | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index a811bc7677..26d33db5cd 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -380,6 +380,12 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
 case MKTAG(0xa9,'l','y','r'): key = "lyrics";break;
 case MKTAG(0xa9,'m','a','k'): key = "make";  break;
 case MKTAG(0xa9,'m','o','d'): key = "model"; break;
+case MKTAG('n','a','m','e') :
+if (c->trak_index >= 0) { // meta inside track
+key = "title";
+raw = 1;
+}
+break;
 case MKTAG(0xa9,'n','a','m'): key = "title"; break;
 case MKTAG(0xa9,'o','p','e'): key = "original_artist"; break;
 case MKTAG(0xa9,'p','r','d'): key = "producer";  break;
@@ -520,8 +526,13 @@ retry:
 }
 str[str_size] = 0;
 }
-c->fc->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED;
-av_dict_set(&c->fc->metadata, key, str, 0);
+if (c->trak_index >= 0) {
+c->fc->streams[c->trak_index]->event_flags |= 
AVSTREAM_EVENT_FLAG_METADATA_UPDATED;
+av_dict_set(&c->fc->streams[c->trak_index]->metadata, key, str, 0);
+} else {
+c->fc->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED;
+av_dict_set(&c->fc->metadata, key, str, 0);
+}
 if (*language && strcmp(language, "und")) {
 snprintf(key2, sizeof(key2), "%s-%s", key, language);
 av_dict_set(&c->fc->metadata, key2, str, 0);
-- 
2.27.0.rc0

___
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/5] avfilter/avfilter: Add avfilter_alloc() and avfilter_query_formats() for initializing filters without a graph

2021-10-12 Thread Soft Works
The purpose of these additions is for being able to programatically retrieve
the supported formats of a filter for each input and output without adding
the filter to a graph and creating connections.

Signed-off-by: softworkz 
---
 doc/APIchanges  |  3 +++
 libavfilter/avfilter.c  |  4 ++--
 libavfilter/avfilter.h  | 22 ++
 libavfilter/avfiltergraph.c | 18 ++
 libavfilter/version.h   |  2 +-
 5 files changed, 42 insertions(+), 7 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 7b267a79ac..903de43365 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,9 @@ libavutil: 2021-04-27
 
 API changes, most recent first:
 
+2021-10-12 - xx - lavf 8.13.100 - avfilter.h
+  Add avfilter_alloc() and avfilter_query_formats().
+
 2021-09-21 - xx - lavu 57.7.100 - pixfmt.h
   Add AV_PIX_FMT_X2BGR10.
 
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 7362bcdab5..645af2cb11 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -769,12 +769,12 @@ void avfilter_free(AVFilterContext *filter)
 
 for (i = 0; i < filter->nb_inputs; i++) {
 free_link(filter->inputs[i]);
-if (filter->input_pads[i].flags  & AVFILTERPAD_FLAG_FREE_NAME)
+if (filter->input_pads && filter->input_pads[i].flags  & 
AVFILTERPAD_FLAG_FREE_NAME)
 av_freep(&filter->input_pads[i].name);
 }
 for (i = 0; i < filter->nb_outputs; i++) {
 free_link(filter->outputs[i]);
-if (filter->output_pads[i].flags & AVFILTERPAD_FLAG_FREE_NAME)
+if (filter->output_pads && filter->output_pads[i].flags & 
AVFILTERPAD_FLAG_FREE_NAME)
 av_freep(&filter->output_pads[i].name);
 }
 
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index f7208754a7..24119993d6 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -911,6 +911,28 @@ typedef struct AVFilterGraph {
 unsigned disable_auto_convert;
 } AVFilterGraph;
 
+/**
+ * Allocate a new filter context and return it.
+ *
+ * @param filter what filter to create an instance of
+ * @param inst_name name to give to the new filter context
+ *
+ * @return newly created filter context or NULL on failure
+ *
+ * @note for adding a filter to a filtergraph, use
+ *   avfilter_graph_alloc_filter() instead.
+ */
+AVFilterContext *avfilter_alloc(const AVFilter *filter, const char *inst_name);
+
+/**
+ * Query the formats of a filter.
+ *
+ * @param filter the filter context
+ *
+ * @return 0 on success
+ */
+int avfilter_query_formats(AVFilterContext *filter);
+
 /**
  * Allocate a filter graph.
  *
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index b8b432e98b..64379782fc 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -81,6 +81,11 @@ int ff_graph_thread_init(AVFilterGraph *graph)
 }
 #endif
 
+AVFilterContext *avfilter_alloc(const AVFilter *filter, const char *inst_name)
+{
+return ff_filter_alloc(filter, inst_name);
+}
+
 AVFilterGraph *avfilter_graph_alloc(void)
 {
 AVFilterGraph *ret = av_mallocz(sizeof(*ret));
@@ -395,6 +400,14 @@ static int formats_declared(AVFilterContext *f)
 return 1;
 }
 
+int avfilter_query_formats(AVFilterContext *filter)
+{
+if (filter->filter->formats_state == FF_FILTER_FORMATS_QUERY_FUNC)
+return filter_query_formats(filter);
+
+return ff_default_query_formats(filter);
+}
+
 /**
  * Perform one round of query_formats() and merging formats lists on the
  * filter graph.
@@ -418,10 +431,7 @@ static int query_formats(AVFilterGraph *graph, void 
*log_ctx)
 AVFilterContext *f = graph->filters[i];
 if (formats_declared(f))
 continue;
-if (f->filter->formats_state == FF_FILTER_FORMATS_QUERY_FUNC)
-ret = filter_query_formats(f);
-else
-ret = ff_default_query_formats(f);
+ret = avfilter_query_formats(f);
 if (ret < 0 && ret != AVERROR(EAGAIN))
 return ret;
 /* note: EAGAIN could indicate a partial success, not counted yet */
diff --git a/libavfilter/version.h b/libavfilter/version.h
index e4c25b9225..dca5aacb45 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -30,7 +30,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVFILTER_VERSION_MAJOR   8
-#define LIBAVFILTER_VERSION_MINOR  12
+#define LIBAVFILTER_VERSION_MINOR  13
 #define LIBAVFILTER_VERSION_MICRO 100
 
 
-- 
2.30.2.windows.1

___
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/5] fftools/cmdutils: Print filter input/output formats in help output

2021-10-12 Thread Soft Works
Exmaple command: ffmpeg -h filters=overlay

Output:

Filter overlay
  Overlay a video source on top of the input.
slice threading supported
Inputs:
   #0: main (video) [yuv420p, yuvj420p, yuva420p, nv12, nv21]
   #1: overlay (video) [yuva420p]
Outputs:
   #0: default (video) [yuv420p, yuvj420p, yuva420p, nv12, nv21]
overlay AVOptions:
  x [...]

Signed-off-by: softworkz 
---
 fftools/cmdutils.c | 89 +++---
 1 file changed, 84 insertions(+), 5 deletions(-)

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index aa706c33ab..a112998574 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -33,6 +33,7 @@
 #include "compat/va_copy.h"
 #include "libavformat/avformat.h"
 #include "libavfilter/avfilter.h"
+#include 
 #include "libavdevice/avdevice.h"
 #include "libswscale/swscale.h"
 #include "libswresample/swresample.h"
@@ -1922,11 +1923,38 @@ static void show_help_muxer(const char *name)
 }
 
 #if CONFIG_AVFILTER
+static void print_link_formats(enum AVMediaType mediaType, AVFilterFormats* 
formats)
+{
+if (formats == NULL)
+return;
+
+printf(" [");
+
+for (unsigned i = 0; i < formats->nb_formats; i++) {
+if (formats->formats[i] >= 0) {
+if (i > 0)
+printf(", ");
+if (mediaType == AVMEDIA_TYPE_VIDEO) {
+printf("%s", av_get_pix_fmt_name(formats->formats[i]));
+} else if (mediaType == AVMEDIA_TYPE_AUDIO) {
+printf("%s", av_get_sample_fmt_name(formats->formats[i]));
+// TODO: Uncomment once subtitle filtering is added
+} else if (mediaType == AVMEDIA_TYPE_SUBTITLE) {
+printf("%s", 
av_get_subtitle_fmt_name(formats->formats[i]));
+}
+}
+}
+
+printf("]");
+}
+
 static void show_help_filter(const char *name)
 {
 #if CONFIG_AVFILTER
 const AVFilter *f = avfilter_get_by_name(name);
-int i, count;
+unsigned i, count;
+int got_formats = 0;
+AVFilterContext *filter_context;
 
 if (!name) {
 av_log(NULL, AV_LOG_ERROR, "No filter name specified.\n");
@@ -1943,12 +1971,50 @@ static void show_help_filter(const char *name)
 if (f->flags & AVFILTER_FLAG_SLICE_THREADS)
 printf("slice threading supported\n");
 
+filter_context = avfilter_alloc(f, "filter");
+if (!filter_context) {
+av_log(NULL, AV_LOG_ERROR, "Failed create filtercontext\n");
+return;
+}
+
+if (filter_context->nb_outputs == 0) {
+filter_context->outputs= av_calloc(1, sizeof(AVFilterLink*));
+filter_context->outputs[0] = (AVFilterLink 
*)av_mallocz(sizeof(AVFilterLink));
+}
+
+if (filter_context->nb_inputs == 0) {
+filter_context->inputs= av_calloc(1, sizeof(AVFilterLink*));
+filter_context->inputs[0] = (AVFilterLink 
*)av_mallocz(sizeof(AVFilterLink));
+}
+
+for (i = 0; i < filter_context->nb_inputs; i++)
+filter_context->inputs[i] = (AVFilterLink 
*)av_mallocz(sizeof(AVFilterLink));
+
+for (i = 0; i < filter_context->nb_outputs; i++)
+filter_context->outputs[i] = (AVFilterLink 
*)av_mallocz(sizeof(AVFilterLink));
+
+if (filter_context->filter->nb_inputs)
+filter_context->inputs[0]->type = avfilter_pad_get_type(f->inputs, 0);
+
+if (filter_context->filter->nb_outputs)
+filter_context->outputs[0]->type = avfilter_pad_get_type(f->outputs, 
0);
+
+if (filter_context->nb_inputs > 0 || filter_context->nb_outputs > 0)
+got_formats = !avfilter_query_formats(filter_context);
+
 printf("Inputs:\n");
 count = avfilter_filter_pad_count(f, 0);
 for (i = 0; i < count; i++) {
-printf("   #%d: %s (%s)\n", i, avfilter_pad_get_name(f->inputs, i),
-   media_type_string(avfilter_pad_get_type(f->inputs, i)));
+const enum AVMediaType media_type = avfilter_pad_get_type(f->inputs, 
i);
+
+printf("   #%d: %s (%s)", i, avfilter_pad_get_name(f->inputs, i),
+   media_type_string(media_type));
+
+if (got_formats && (i < filter_context->nb_inputs))
+print_link_formats(media_type, 
filter_context->inputs[i]->outcfg.formats);
+printf("\n");
 }
+
 if (f->flags & AVFILTER_FLAG_DYNAMIC_INPUTS)
 printf("dynamic (depending on the options)\n");
 else if (!count)
@@ -1957,8 +2023,13 @@ static void show_help_filter(const char *name)
 printf("Outputs:\n");
 count = avfilter_filter_pad_count(f, 1);
 for (i = 0; i < count; i++) {
-printf("   #%d: %s (%s)\n", i, avfilter_pad_get_name(f->outputs, 
i),
-   media_type_string(avfilter_pad_get_type(f->outputs, i)));
+const enum AVMediaType media_type = avfilter_pad_get_type(f->outputs, 
i);
+printf("   #%d: %s (%s)", i, avfilter_pad_get_name(f->outputs, i),
+   media_type_string(media_type));
+ 
+if (got_formats && i 

[FFmpeg-devel] [PATCH 3/5] avfilter/aphasemeter: add null check

2021-10-12 Thread Soft Works
Signed-off-by: softworkz 
---
 libavfilter/avf_aphasemeter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/avf_aphasemeter.c b/libavfilter/avf_aphasemeter.c
index d9302cf867..eca8751258 100644
--- a/libavfilter/avf_aphasemeter.c
+++ b/libavfilter/avf_aphasemeter.c
@@ -111,7 +111,7 @@ static int query_formats(AVFilterContext *ctx)
 (ret = ff_formats_ref(formats, &outlink->incfg.samplerates)) < 0)
 return ret;
 
-if (s->do_video) {
+if (s->do_video && ctx->nb_outputs >= 2) {
 AVFilterLink *outlink = ctx->outputs[1];
 
 formats = ff_make_format_list(pix_fmts);
-- 
2.30.2.windows.1

___
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/5] avfilter/ocr: add null check

2021-10-12 Thread Soft Works
Signed-off-by: softworkz 
---
 libavfilter/vf_ocr.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_ocr.c b/libavfilter/vf_ocr.c
index f6249e61fc..a8be529033 100644
--- a/libavfilter/vf_ocr.c
+++ b/libavfilter/vf_ocr.c
@@ -115,8 +115,10 @@ static av_cold void uninit(AVFilterContext *ctx)
 {
 OCRContext *s = ctx->priv;
 
-TessBaseAPIEnd(s->tess);
-TessBaseAPIDelete(s->tess);
+if (s->tess) {
+TessBaseAPIEnd(s->tess);
+TessBaseAPIDelete(s->tess);
+}
 }
 
 AVFILTER_DEFINE_CLASS(ocr);
-- 
2.30.2.windows.1

___
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 5/5] avfilter/movie: add null check

2021-10-12 Thread Soft Works
Signed-off-by: softworkz 
---
 libavfilter/src_movie.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
index 573f363705..2002e176b3 100644
--- a/libavfilter/src_movie.c
+++ b/libavfilter/src_movie.c
@@ -332,7 +332,7 @@ static av_cold void movie_uninit(AVFilterContext *ctx)
 int i;
 
 for (i = 0; i < ctx->nb_outputs; i++) {
-if (movie->st[i].st)
+if (movie->st && movie->st[i].st)
 avcodec_free_context(&movie->st[i].codec_ctx);
 }
 av_freep(&movie->st);
-- 
2.30.2.windows.1

___
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 1/4] libavcodec/adts_header: add frame_length field and avpriv function to parse AAC ADTS header

2021-10-12 Thread Steven Liu


> 2021年9月22日 上午2:40,Nachiket Tarate  写道:
> 
> These will be used by HLS demuxer in case of sample decryption.
> 
> Signed-off-by: Nachiket Tarate 
> ---
> libavcodec/adts_header.c |  1 +
> libavcodec/adts_header.h | 15 +++
> libavcodec/adts_parser.c | 31 +++
> 3 files changed, 47 insertions(+)
> 
> diff --git a/libavcodec/adts_header.c b/libavcodec/adts_header.c
> index 0889820f8a..e4454529c4 100644
> --- a/libavcodec/adts_header.c
> +++ b/libavcodec/adts_header.c
> @@ -66,6 +66,7 @@ int ff_adts_header_parse(GetBitContext *gbc, 
> AACADTSHeaderInfo *hdr)
> hdr->sample_rate= avpriv_mpeg4audio_sample_rates[sr];
> hdr->samples= (rdb + 1) * 1024;
> hdr->bit_rate   = size * 8 * hdr->sample_rate / hdr->samples;
> +hdr->frame_length   = size;
> 
> return size;
> }
> diff --git a/libavcodec/adts_header.h b/libavcodec/adts_header.h
> index f615f6a9f9..354d07e1f8 100644
> --- a/libavcodec/adts_header.h
> +++ b/libavcodec/adts_header.h
> @@ -34,6 +34,7 @@ typedef struct AACADTSHeaderInfo {
> uint8_t  sampling_index;
> uint8_t  chan_config;
> uint8_t  num_aac_frames;
> +uint32_t frame_length;
> } AACADTSHeaderInfo;
> 
> /**
> @@ -47,4 +48,18 @@ typedef struct AACADTSHeaderInfo {
>  */
> int ff_adts_header_parse(GetBitContext *gbc, AACADTSHeaderInfo *hdr);
> 
> +/**
> + * Parse the ADTS frame header contained in the buffer, which is
> + * the first 54 bits.
> + * @param[in]  buf  Pointer to buffer containing the first 54 bits of the 
> frame.
> + * @param[in]  size Size of buffer containing the first 54 bits of the frame.
> + * @param[out] phdr Pointer to pointer to struct AACADTSHeaderInfo for which
> + * memory is allocated and header info is written into it. After using the 
> header
> + * information, the allocated memory must be freed by using av_free.
> + * @return Returns 0 on success, -1 if there is a sync word mismatch,
> + * -2 if the version element is invalid, -3 if the sample rate
> + * element is invalid, or -4 if the bit rate element is invalid.
> + */
> +int avpriv_adts_header_parse(AACADTSHeaderInfo **phdr, const uint8_t *buf, 
> size_t size);
> +
> #endif /* AVCODEC_ADTS_HEADER_H */
> diff --git a/libavcodec/adts_parser.c b/libavcodec/adts_parser.c
> index 5c9f8ff6f2..4a1a8fd5f4 100644
> --- a/libavcodec/adts_parser.c
> +++ b/libavcodec/adts_parser.c
> @@ -42,3 +42,34 @@ int av_adts_header_parse(const uint8_t *buf, uint32_t 
> *samples, uint8_t *frames)
> return AVERROR(ENOSYS);
> #endif
> }
> +
> +int avpriv_adts_header_parse(AACADTSHeaderInfo **phdr, const uint8_t *buf, 
> size_t size)
> +{
> +#if CONFIG_ADTS_HEADER
> +int ret = 0;
> +GetBitContext gb;
> +
> +if (!phdr || !buf || size < AV_AAC_ADTS_HEADER_SIZE)
> +return AVERROR_INVALIDDATA;
> +
> +*phdr = av_mallocz(sizeof(AACADTSHeaderInfo));
> +if (!*phdr)
> +return AVERROR(ENOMEM);
> +
> +ret = init_get_bits8(&gb, buf, AV_AAC_ADTS_HEADER_SIZE);
> +if (ret < 0) {
> +av_freep(phdr);
> +return ret;
> +}
> +
> +ret = ff_adts_header_parse(&gb, *phdr);
> +if (ret < 0) {
> +av_freep(phdr);
> +return ret;
> +}
> +
> +return 0;
> +#else
> +return AVERROR(ENOSYS);
> +#endif
> +}
> -- 
> 2.17.1
> 
> ___
> 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".
> 


Patchset pushed.

Thanks

Steven Liu

___
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/1] Print bit depth when executing 'ffmpeg -pix_fmts'

2021-10-12 Thread Soft Works
New output looks like this:

Pixel formats:
I = Supported Input  format for conversion
.O... = Supported Output format for conversion
..H.. = Hardware accelerated format
...P. = Paletted format
B = Bitstream format
FLAGS NAMENB_COMPONENTS BITS_PER_PIXEL BIT_DEPTH
-
IO... yuv420p3 12 8
IO... yuyv4223 16 8
IO... rgb24  3 24 8
IO... bgr24  3 24 8

[..]

Signed-off-by: softworkz 
---
 fftools/cmdutils.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 2c8e98982f..aa706c33ab 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -1754,7 +1754,7 @@ int show_pix_fmts(void *optctx, const char *opt, const 
char *arg)
"..H.. = Hardware accelerated format\n"
"...P. = Paletted format\n"
"B = Bitstream format\n"
-   "FLAGS NAMENB_COMPONENTS BITS_PER_PIXEL\n"
+   "FLAGS NAMENB_COMPONENTS BITS_PER_PIXEL BIT_DEPTH\n"
"-\n");
 
 #if !CONFIG_SWSCALE
@@ -1764,7 +1764,7 @@ int show_pix_fmts(void *optctx, const char *opt, const 
char *arg)
 
 while ((pix_desc = av_pix_fmt_desc_next(pix_desc))) {
 enum AVPixelFormat av_unused pix_fmt = 
av_pix_fmt_desc_get_id(pix_desc);
-printf("%c%c%c%c%c %-16s   %d%2d\n",
+printf("%c%c%c%c%c %-16s   %d%3d%2d\n",
sws_isSupportedInput (pix_fmt)  ? 'I' : '.',
sws_isSupportedOutput(pix_fmt)  ? 'O' : '.',
pix_desc->flags & AV_PIX_FMT_FLAG_HWACCEL   ? 'H' : '.',
@@ -1772,7 +1772,8 @@ int show_pix_fmts(void *optctx, const char *opt, const 
char *arg)
pix_desc->flags & AV_PIX_FMT_FLAG_BITSTREAM ? 'B' : '.',
pix_desc->name,
pix_desc->nb_components,
-   av_get_bits_per_pixel(pix_desc));
+   av_get_bits_per_pixel(pix_desc),
+   pix_desc->comp[0].depth);
 }
 return 0;
 }
-- 
2.30.2.windows.1

___
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/1] libavutil/opt: fix mis-alignment of option and constant values for filter help

2021-10-12 Thread Soft Works
Before:

overlay AVOptions:
  x  ..FV... set the x expression (default "0")
  y  ..FV... set the y expression (default "0")
  eof_action..FV... Action to take when encountering 
EOF from secondary input  (from 0 to 2) (default repeat)
 repeat  0..FV... Repeat the previous frame.
 endall  1..FV... End both streams.
 pass2..FV... Pass through the main input.
  eval  ..FV... specify when to evaluate 
expressions (from 0 to 1) (default frame)

After:
a
overlay AVOptions:
   x  ..FV... set the x expression (default "0")
   y  ..FV... set the y expression (default "0")
   eof_action..FV... Action to take when encountering 
EOF from secondary input  (from 0 to 2) (default repeat)
 repeat  0..FV... Repeat the previous frame.
 endall  1..FV... End both streams.
 pass2..FV... Pass through the main input.
   eval  ..FV... specify when to evaluate 
expressions (from 0 to 1) (default frame)

Signed-off-by: softworkz 
---
 libavutil/opt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index c7001dbcd3..8d866d8a3c 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -1170,7 +1170,7 @@ static void opt_list(void *obj, void *av_log_obj, const 
char *unit,
 av_log(av_log_obj, AV_LOG_INFO, " %-15s ", opt->name);
 else
 av_log(av_log_obj, AV_LOG_INFO, "  %s%-17s ",
-   (opt->flags & AV_OPT_FLAG_FILTERING_PARAM) ? "" : "-",
+   (opt->flags & AV_OPT_FLAG_FILTERING_PARAM) ? " " : "-",
opt->name);
 
 switch (opt->type) {
-- 
2.30.2.windows.1

___
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 1/1] Print bit depth when executing 'ffmpeg -pix_fmts'

2021-10-12 Thread Tobias Rapp

On 13/10/2021 06:58, Soft Works wrote:

New output looks like this:

Pixel formats:
I = Supported Input  format for conversion
.O... = Supported Output format for conversion
..H.. = Hardware accelerated format
...P. = Paletted format
B = Bitstream format
FLAGS NAMENB_COMPONENTS BITS_PER_PIXEL BIT_DEPTH
-
IO... yuv420p3 12 8
IO... yuyv4223 16 8
IO... rgb24  3 24 8
IO... bgr24  3 24 8

[...]

@@ -1772,7 +1772,8 @@ int show_pix_fmts(void *optctx, const char *opt, const 
char *arg)
 pix_desc->flags & AV_PIX_FMT_FLAG_BITSTREAM ? 'B' : '.',
 pix_desc->name,
 pix_desc->nb_components,
-   av_get_bits_per_pixel(pix_desc));
+   av_get_bits_per_pixel(pix_desc),
+   pix_desc->comp[0].depth);
  }
  return 0;
  }



I think it is misleading to only print the bit-depth of the first 
component. You can already get bit-depth information for all components 
in different data formats with "ffprobe -show_pixel_formats".


Regards,
Tobias

___
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".