Re: [FFmpeg-devel] [PATCH 2/4] doc/faq: Anwser some questions about he GA, which keep popping up

2025-01-06 Thread Ronald S. Bultje
On Mon, Jan 6, 2025 at 6:23 PM Michael Niedermayer 
wrote:

> +@subsection Can votes be bought?
>

Really? This is necessary? :-(
___
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] avfilter/scale_vulkan: add dynamic crop region and aspect ratio match

2025-01-06 Thread Lynne

On 27/11/2024 01:21, Koushik Dutta wrote:

The scale_vulkan filter initializes the shader once, with the crop
region set by the original frame. However, subsequent frames may
specify a different crop region than the first frame. This change
updates the cropping to match the behavior present on the other
hardware frame scale filters.

The scale filter should also allow negative values
that respect aspect ratio, similar to other scale filters.

Signed-off-by: Koushik Dutta 
---
  libavfilter/vf_scale_vulkan.c | 26 --
  1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/libavfilter/vf_scale_vulkan.c b/libavfilter/vf_scale_vulkan.c
index d675a309a8..2f4193ee85 100644
--- a/libavfilter/vf_scale_vulkan.c
+++ b/libavfilter/vf_scale_vulkan.c
@@ -46,6 +46,10 @@ typedef struct ScaleVulkanContext {
  /* Push constants / options */
  struct {
  float yuv_matrix[4][4];
+int crop_x;
+int crop_y;
+int crop_w;
+int crop_h;
  } opts;
  
  char *out_format_string;

@@ -121,10 +125,6 @@ static av_cold int init_filter(AVFilterContext *ctx, 
AVFrame *in)
  FFVkSPIRVCompiler *spv;
  FFVulkanDescriptorSetBinding *desc;
  
-int crop_x = in->crop_left;

-int crop_y = in->crop_top;
-int crop_w = in->width - (in->crop_left + in->crop_right);
-int crop_h = in->height - (in->crop_top + in->crop_bottom);
  int in_planes = av_pix_fmt_count_planes(s->vkctx.input_format);
  
  switch (s->scaler) {

@@ -153,6 +153,10 @@ static av_cold int init_filter(AVFilterContext *ctx, 
AVFrame *in)
  
  GLSLC(0, layout(push_constant, std430) uniform pushConstants {);

  GLSLC(1,mat4 yuv_matrix;  );
+GLSLC(1,int crop_x;   );
+GLSLC(1,int crop_y;   );
+GLSLC(1,int crop_w;   );
+GLSLC(1,int crop_h;   );
  GLSLC(0, };   );
  GLSLC(0,  );
  
@@ -199,8 +203,8 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in)

  GLSLC(1, ivec2 size; 
);
  GLSLC(1, ivec2 pos = ivec2(gl_GlobalInvocationID.xy);
);
  GLSLF(1, vec2 in_d = vec2(%i, %i); ,in->width, 
in->height);
-GLSLF(1, vec2 c_r = vec2(%i, %i) / in_d;  ,crop_w, crop_h);
-GLSLF(1, vec2 c_o = vec2(%i, %i) / in_d;   ,crop_x,crop_y);
+GLSLC(1, vec2 c_r = vec2(crop_w, crop_h) / in_d; );
+GLSLC(1, vec2 c_o = vec2(crop_x, crop_y) / in_d; );
  GLSLC(0, 
);
  
  if (s->vkctx.output_format == s->vkctx.input_format) {

@@ -280,6 +284,11 @@ static int scale_vulkan_filter_frame(AVFilterLink *link, 
AVFrame *in)
  if (!s->initialized)
  RET(init_filter(ctx, in));
  
+s->opts.crop_x = in->crop_left;

+s->opts.crop_y = in->crop_top;
+s->opts.crop_w = in->width - (in->crop_left + in->crop_right);
+s->opts.crop_h = in->height - (in->crop_top + in->crop_bottom);
+
  RET(ff_vk_filter_process_simple(&s->vkctx, &s->e, &s->shd, out, in,
  s->sampler, &s->opts, sizeof(s->opts)));
  
@@ -316,6 +325,11 @@ static int scale_vulkan_config_output(AVFilterLink *outlink)

  if (err < 0)
  return err;
  
+ff_scale_adjust_dimensions(inlink, &vkctx->output_width, &vkctx->output_height, 0, 1);

+
+outlink->w = vkctx->output_width;
+outlink->h = vkctx->output_height;
+
  if (s->out_format_string) {
  s->vkctx.output_format = av_get_pix_fmt(s->out_format_string);
  if (s->vkctx.output_format == AV_PIX_FMT_NONE) {


Thanks, pushed


OpenPGP_0xA2FEA5F03F034464.asc
Description: OpenPGP public key


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] avcodec/opus/parser: set duration when complete frames are fed

2025-01-06 Thread Lynne

On 04/01/2025 00:07, James Almer wrote:

Fixes a regression since 873a34c129869e551cb7d3d2445e28c0ba079948.

Signed-off-by: James Almer 
---
  libavcodec/opus/parser.c | 38 +-
  1 file changed, 29 insertions(+), 9 deletions(-)

diff --git a/libavcodec/opus/parser.c b/libavcodec/opus/parser.c
index e16b0f72a2..be011485f6 100644
--- a/libavcodec/opus/parser.c
+++ b/libavcodec/opus/parser.c
@@ -78,6 +78,25 @@ static const uint8_t *parse_opus_ts_header(const uint8_t 
*start, int *payload_le
  return buf + bytestream2_tell(&gb);
  }
  
+static int set_duration(AVCodecParserContext *ctx, AVCodecContext *avctx,

+const uint8_t *buf, int buf_size)
+{
+OpusParserContext *s = ctx->priv_data;
+ParseContext *pc= &s->pc;
+int ret;
+
+ret = ff_opus_parse_packet(&s->pkt, buf, buf_size, s->ctx.nb_streams > 1);
+if (ret < 0) {
+av_log(avctx, AV_LOG_ERROR, "Error parsing Opus packet header.\n");
+pc->frame_start_found = 0;
+return AVERROR_INVALIDDATA;
+}
+
+ctx->duration = s->pkt.frame_count * s->pkt.frame_duration;
+
+return 0;
+}
+
  /**
   * Find the end of the current frame in the bitstream.
   * @return the position of the first byte of the next frame, or -1
@@ -137,14 +156,9 @@ static int opus_find_frame_end(AVCodecParserContext *ctx, 
AVCodecContext *avctx,
  }
  
  if (payload_len <= buf_size && (!s->ts_framing || start_found)) {

-ret = ff_opus_parse_packet(&s->pkt, payload, payload_len, 
s->ctx.nb_streams > 1);
-if (ret < 0) {
-av_log(avctx, AV_LOG_ERROR, "Error parsing Opus packet header.\n");
-pc->frame_start_found = 0;
+ret = set_duration(ctx, avctx, payload, payload_len);
+if (ret < 0)
  return AVERROR_INVALIDDATA;
-}
-
-ctx->duration = s->pkt.frame_count * s->pkt.frame_duration;
  }
  
  if (s->ts_framing) {

@@ -174,9 +188,15 @@ static int opus_parse(AVCodecParserContext *ctx, 
AVCodecContext *avctx,
  
  avctx->sample_rate = 48000;
  
-if (ctx->flags & PARSER_FLAG_COMPLETE_FRAMES)

+if (ctx->flags & PARSER_FLAG_COMPLETE_FRAMES) {
  next = buf_size;
-else {
+
+if (set_duration(ctx, avctx, buf, buf_size) < 0) {
+*poutbuf  = NULL;
+*poutbuf_size = 0;
+return buf_size;
+}
+} else {
  next = opus_find_frame_end(ctx, avctx, buf, buf_size, &header_len);
  
  if (s->ts_framing && next != AVERROR_INVALIDDATA &&


LGTM


OpenPGP_0xA2FEA5F03F034464.asc
Description: OpenPGP public key


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


[FFmpeg-devel] [PATCH] [h264] Make slice header parse errors fatal under AV_EF_EXPLODE

2025-01-06 Thread Dale Curtis
This fixes timeout issues with https://crbug.com/383814043 and
seems like it was intended since the line emits an error log.

Signed-off-by: Dale Curtis 


slice_error_v0.patch
Description: Binary data
___
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/3] avcodec/mpegvideo_enc: fix qmat value comments

2025-01-06 Thread Marton Balint
The comments supposed to track the possible value of the qmat and qmat16
matrices, but they were not updated properly in the long history of the
mpegvideo encoder. Also they wrongly assumed the usage of built-in quantizer
matrices and linear quantization.

Signed-off-by: Marton Balint 
---
 libavcodec/mpegvideo_enc.c | 37 -
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index c5f20c2d85..7001d5a566 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -133,11 +133,11 @@ void ff_convert_matrix(MpegEncContext *s, int (*qmat)[64],
 for (i = 0; i < 64; i++) {
 const int j = s->idsp.idct_permutation[i];
 int64_t den = (int64_t) qscale2 * quant_matrix[j];
-/* 16 <= qscale * quant_matrix[i] <= 7905
- * Assume x = ff_aanscales[i] * qscale * quant_matrix[i]
- * 19952 <=  x  <= 249205026
- * (1 << 36) / 19952 >= (1 << 36) / (x) >= (1 << 36) / 
249205026
- *   3444240 >= (1 << 36) / (x) >= 275 */
+/* 1 * 1 <= qscale2 * quant_matrix[j] <= 112 * 255
+ * Assume x = qscale2 * quant_matrix[j]
+ * 1 <=  x  <= 28560
+ * (1 << 22) / 1 >= (1 << 22) / (x) >= (1 << 22) / 28560
+ *   4194304 >= (1 << 22) / (x) >= 146 */
 
 qmat[qscale][i] = (int)((UINT64_C(2) << QMAT_SHIFT) / den);
 }
@@ -145,11 +145,11 @@ void ff_convert_matrix(MpegEncContext *s, int (*qmat)[64],
 for (i = 0; i < 64; i++) {
 const int j = s->idsp.idct_permutation[i];
 int64_t den = ff_aanscales[i] * (int64_t) qscale2 * 
quant_matrix[j];
-/* 16 <= qscale * quant_matrix[i] <= 7905
- * Assume x = ff_aanscales[i] * qscale * quant_matrix[i]
- * 19952 <=  x  <= 249205026
- * (1 << 36) / 19952 >= (1 << 36) / (x) >= (1 << 36) / 
249205026
- *   3444240 >= (1 << 36) / (x) >= 275 */
+/* 1247 * 1 * 1 <= ff_aanscales[i] * qscale2 * quant_matrix[j] 
<= 31521 * 112 * 255
+ * Assume x = ff_aanscales[i] * qscale2 * quant_matrix[j]
+ *  1247 <=  x  <= 900239760
+ *  (1 << 36) / 1247 >= (1 << 36) / (x) >= (1 << 36) / 
900239760
+ *  55107840 >= (1 << 36) / (x) >= 76 */
 
 qmat[qscale][i] = (int)((UINT64_C(2) << (QMAT_SHIFT + 14)) / 
den);
 }
@@ -157,14 +157,17 @@ void ff_convert_matrix(MpegEncContext *s, int (*qmat)[64],
 for (i = 0; i < 64; i++) {
 const int j = s->idsp.idct_permutation[i];
 int64_t den = (int64_t) qscale2 * quant_matrix[j];
-/* We can safely suppose that 16 <= quant_matrix[i] <= 255
- * Assume x = qscale * quant_matrix[i]
- * So 16 <=  x  <= 7905
- * so (1 << 19) / 16 >= (1 << 19) / (x) >= (1 << 19) / 7905
- * so  32768 >= (1 << 19) / (x) >= 67 */
+/* 1 * 1 <= qscale2 * quant_matrix[j] <= 112 * 255
+ * Assume x = qscale2 * quant_matrix[j]
+ * 1 <=  x  <= 28560
+ * (1 << 22) / 1 >= (1 << 22) / (x) >= (1 << 22) / 28560
+ *   4194304 >= (1 << 22) / (x) >= 146
+ *
+ * 1 <=  x  <= 28560
+ * (1 << 17) / 1 >= (1 << 17) / (x) >= (1 << 17) / 28560
+ *131072 >= (1 << 17) / (x) >= 4 */
+
 qmat[qscale][i] = (int)((UINT64_C(2) << QMAT_SHIFT) / den);
-//qmat  [qscale][i] = (1 << QMAT_SHIFT_MMX) /
-//(qscale * quant_matrix[i]);
 qmat16[qscale][0][i] = (2 << QMAT_SHIFT_MMX) / den;
 
 if (qmat16[qscale][0][i] == 0 ||
-- 
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/3] avcodec/encode: add checks for custom inter/intra/chroma matrices

2025-01-06 Thread Marton Balint
All elements should be within 1-255.
---
 libavcodec/encode.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index 3baf5b8103..27edb00b04 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -646,6 +646,22 @@ FF_ENABLE_DEPRECATION_WARNINGS
 avctx->sw_pix_fmt = frames_ctx->sw_format;
 }
 
+{
+uint16_t  *matrices[] = {avctx->intra_matrix, avctx->inter_matrix, 
avctx->chroma_intra_matrix};
+const char   *names[] = {"Intra", "Inter", "Chroma Intra"};
+for (int m = 0; m < FF_ARRAY_ELEMS(matrices) && m < 
FF_ARRAY_ELEMS(names); m++) {
+uint16_t *matrix = matrices[m];
+if (matrix) {
+for (int i = 0; i < 64; i++) {
+if (matrix[i] == 0 || matrix[i] > 255) {
+av_log(avctx, AV_LOG_ERROR, "%s matrix[%d] is %d which 
is out of the allowed range [1-255].\n", names[m], i, matrix[i]);
+return AVERROR(EINVAL);
+}
+}
+}
+}
+}
+
 return 0;
 }
 
-- 
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 3/3] avcodec/mpegvideo_enc: use 64bit multiplication in dct_quantize_trellis_c and dct_quantize_c

2025-01-06 Thread Marton Balint
Fixes corruption with:

ffmpeg -t 1 -filter_complex 
"sine=f=21,showwaves=scale=cbrt:mode=line:colors=white:draw=full" -c:v 
mpeg2video -non_linear_quant 1 -qmin 1 -qmax 1 -cpuflags 0 out.mpg

or

ffmpeg -t 1 -filter_complex 
"sine=f=21,showwaves=scale=cbrt:mode=line:colors=white:draw=full" -c:v 
mpeg2video -non_linear_quant 1 -qmin 1 -qmax 1 -trellis 1 out.mpg

Signed-off-by: Marton Balint 
---
 libavcodec/mpegvideo_enc.c | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 7001d5a566..d844961a5d 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -3984,9 +3984,9 @@ static int dct_quantize_trellis_c(MpegEncContext *s,
 
 for(i=63; i>=start_i; i--) {
 const int j = scantable[i];
-int level = block[j] * qmat[j];
+int64_t level = (int64_t)block[j] * qmat[j];
 
-if(((unsigned)(level+threshold1))>threshold2){
+if(((uint64_t)(level+threshold1))>threshold2){
 last_non_zero = i;
 break;
 }
@@ -3994,11 +3994,11 @@ static int dct_quantize_trellis_c(MpegEncContext *s,
 
 for(i=start_i; i<=last_non_zero; i++) {
 const int j = scantable[i];
-int level = block[j] * qmat[j];
+int64_t level = (int64_t)block[j] * qmat[j];
 
 //if(   bias+level >= (1<<(QMAT_SHIFT - 3))
 //   || bias-level >= (1<<(QMAT_SHIFT - 3))){
-if(((unsigned)(level+threshold1))>threshold2){
+if(((uint64_t)(level+threshold1))>threshold2){
 if(level>0){
 level= (bias + level)>>QMAT_SHIFT;
 coeff[0][i]= level;
@@ -4587,7 +4587,7 @@ static int dct_quantize_c(MpegEncContext *s,
   int16_t *block, int n,
   int qscale, int *overflow)
 {
-int i, j, level, last_non_zero, q, start_i;
+int i, last_non_zero, q, start_i;
 const int *qmat;
 const uint8_t *scantable;
 int bias;
@@ -4627,10 +4627,10 @@ static int dct_quantize_c(MpegEncContext *s,
 threshold1= (1<=start_i;i--) {
-j = scantable[i];
-level = block[j] * qmat[j];
+const int j = scantable[i];
+int64_t level = (int64_t)block[j] * qmat[j];
 
-if(((unsigned)(level+threshold1))>threshold2){
+if(((uint64_t)(level+threshold1))>threshold2){
 last_non_zero = i;
 break;
 }else{
@@ -4638,12 +4638,12 @@ static int dct_quantize_c(MpegEncContext *s,
 }
 }
 for(i=start_i; i<=last_non_zero; i++) {
-j = scantable[i];
-level = block[j] * qmat[j];
+const int j = scantable[i];
+int64_t level = (int64_t)block[j] * qmat[j];
 
 //if(   bias+level >= (1<= (1threshold2){
 if(level>0){
 level= (bias + level)>>QMAT_SHIFT;
 block[j]= level;
-- 
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 3/4] doc/faq: Document the plan ahead for Governance

2025-01-06 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 doc/faq.texi | 8 
 1 file changed, 8 insertions(+)

diff --git a/doc/faq.texi b/doc/faq.texi
index 54c3fbb41fe..70002a8156d 100644
--- a/doc/faq.texi
+++ b/doc/faq.texi
@@ -702,4 +702,12 @@ In recent years, a significant number of developers 
contributing to the project
 unlike in the past. These employees are often compensated for specific tasks, 
and the voting rights,
 much like the copyrights, can typically be controlled by their employers.
 
+@section What is the future plan for FFmpeg Governance?
+
+Governance has 2 goals, 1st to make good decissions for FFmpeg. And 2nd is to 
create
+an inclusive and motivating environment where contributors feel valued and 
inspired to
+collaborate. The plan is to find out how to achieve these goals.
+For example for a system to make good decissions it needs to be hard to 
manipulate
+
+
 @bye
-- 
2.47.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] avfilter/af_pan: Fix sscanf() use

2025-01-06 Thread Michael Niedermayer
Fixes: Memory Data Leak

Found-by: Simcha Kosman 
Signed-off-by: Michael Niedermayer 
---
 libavfilter/af_pan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/af_pan.c b/libavfilter/af_pan.c
index 0d20b0307b3..3a11a7d324f 100644
--- a/libavfilter/af_pan.c
+++ b/libavfilter/af_pan.c
@@ -196,7 +196,7 @@ static av_cold int init(AVFilterContext *ctx)
 sign = 1;
 while (1) {
 gain = 1;
-if (sscanf(arg, "%lf%n *%n", &gain, &len, &len))
+if (sscanf(arg, "%lf%n *%n", &gain, &len, &len) == 1)
 arg += len;
 if (parse_channel_name(&arg, &in_ch_id, &named)){
 av_log(ctx, AV_LOG_ERROR,
-- 
2.47.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] doc/faq: Anwser some questions about he GA, which keep popping up

2025-01-06 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 doc/faq.texi | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/doc/faq.texi b/doc/faq.texi
index 477cc60533a..54c3fbb41fe 100644
--- a/doc/faq.texi
+++ b/doc/faq.texi
@@ -683,4 +683,23 @@ Do you happen to have a @code{~} character in the samples 
path to indicate a
 home directory? The value is used in ways where the shell cannot expand it,
 causing FATE to not find files. Just replace @code{~} by the full path.
 
+@chapter FFmpeg Governance
+
+@section General Assembly
+
+@subsection Can votes be bought?
+
+You can hire a developer (for example on fiver) to submit 20 patches within 
each 3 years,
+and vote as you ask her to.
+In the last votes (as of begin 2025) about 30 votes where cast, so hiring 
about 20-30 developers
+allows controlling any decision. These developers also can pass KYC and travel 
to conferences (which has
+been always paid). They also have a strong incentive not to reveal their 
nature as that would end
+this lucrative income stream for them.
+
+@subsection Why is the GA more corporate than community-oriented?
+
+In recent years, a significant number of developers contributing to the 
project are employed by companies,
+unlike in the past. These employees are often compensated for specific tasks, 
and the voting rights,
+much like the copyrights, can typically be controlled by their employers.
+
 @bye
-- 
2.47.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/jpeg2000dec: Reset nb_lengthinc

2025-01-06 Thread Michael Niedermayer
Fixes: NULL pointer dereference

Found-by: 丁zhengzheng 
Signed-off-by: Michael Niedermayer 
---
 libavcodec/jpeg2000dec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index e5e897a29f1..b82d85d5ee5 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -1521,6 +1521,7 @@ static int jpeg2000_decode_packet(Jpeg2000DecoderContext 
*s, Jpeg2000Tile *tile,
 }
 }
 av_freep(&cblk->lengthinc);
+cblk->nb_lengthinc = 0;
 }
 }
 // Save state of stream
-- 
2.47.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] [ANNOUNCE] upcoming vote: CC election

2025-01-06 Thread Vittorio Giovara
On Thu, Jan 2, 2025 at 3:12 PM Vittorio Giovara 
wrote:

>
>
> On Mon, Dec 30, 2024 at 11:29 AM Leo Izen  wrote:
>
>> On 12/28/24 11:53 AM, Ronald S. Bultje wrote:
>> > Hi all,
>> >
>> > (Prior note: the election was scheduled to end on the 23rd of December.
>> > Anton is currently taking a break so I've asked him to let me announce
>> the
>> > election results.)
>> >
>> > The poll has concluded, with 31 votes out of 52. Results are available
>> at
>> > [1], the winning committee is:
>> >
>> > * James Almer
>> > * Marth64
>> > * Jean-Baptiste Kempf
>> > * Anton Khirnov
>> > * Rémi Denis-Courmont
>> >
>> > Raw ballots in CSV format are attached for posterity.
>> >
>> > CC'ing root - please update the cc@ mailbox. Congratulations all, and
>> good
>> > luck to the new CC.
>> >
>> > Ronald
>> >
>> > [1]
>> https://vote.ffmpeg.org/cgi-bin/civs/results.pl?id=E_aa41735cb69c1c88
>> >
>> > On Thu, Nov 28, 2024 at 9:33 AM Anton Khirnov 
>> wrote:
>> >
>>
>>
>> It appears that shortly before you announced this email, James Almer
>> sent a email message (in another thread) stating he resigns from CC: [1]
>>
>> Is this from the newly elected CC or the previous CC? I just want to
>> confirm the current CC situation. Carbon-copying James to double check.
>>
>> [1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2024-December/337990.html
>>
>> - Leo Izen (Traneptora)
>>
>
> Congrats everybody! It's tough work ahead, but I hope we can all work
> towards some positive change for this community.
> --
>

S not to poke a bee's nest, but what's going on here? Are there any
blockers for the elected people to assume their roles?
-- 
Vittorio
___
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 2/4] doc/faq: Anwser some questions about he GA, which keep popping up

2025-01-06 Thread Kieran Kunhya via ffmpeg-devel
>
> +In recent years, a significant number of developers contributing to the
> project are employed by companies,
> +unlike in the past. These employees are often compensated for specific
> tasks, and the voting rights,
> +much like the copyrights, can typically be controlled by their employers.
> +
>  @bye
> --
>

Hi Michael,

Can you add that you are exempt from this as you are incorruptible?

Regards,
Kieran Kunhya

>
___
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] hwcontext_vulkan: fix recent lavapipe regression

2025-01-06 Thread Lynne
lavapipe indicates it supports external_semaphore_fd, but actually,
it does not support exporting such?

Ref: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12422
---
 libavutil/hwcontext_vulkan.c | 25 -
 libavutil/vulkan_functions.h |  1 +
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index c5f4de5684..f11243482b 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -111,6 +111,7 @@ typedef struct VulkanDevicePriv {
 VkPhysicalDeviceProperties2 props;
 VkPhysicalDeviceMemoryProperties mprops;
 VkPhysicalDeviceExternalMemoryHostPropertiesEXT hprops;
+VkExternalSemaphoreProperties ext_sem_props;
 
 /* Enabled features */
 VulkanDeviceFeatures feats;
@@ -1715,6 +1716,7 @@ static int vulkan_device_init(AVHWDeviceContext *ctx)
 FFVulkanFunctions *vk = &p->vkctx.vkfn;
 VkQueueFamilyProperties2 *qf;
 VkQueueFamilyVideoPropertiesKHR *qf_vid;
+VkPhysicalDeviceExternalSemaphoreInfo ext_sem_props_info;
 int graph_index, comp_index, tx_index, enc_index, dec_index;
 
 /* Set device extension flags */
@@ -1760,6 +1762,23 @@ static int vulkan_device_init(AVHWDeviceContext *ctx)
 return AVERROR_EXTERNAL;
 }
 
+ext_sem_props_info = (VkPhysicalDeviceExternalSemaphoreInfo) {
+.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO,
+#ifdef _WIN32
+.handleType = IsWindows8OrGreater()
+? VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT
+: VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT,
+#else
+.handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT,
+#endif
+};
+
+p->ext_sem_props.sType = VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES;
+
+vk->GetPhysicalDeviceExternalSemaphoreProperties(hwctx->phys_dev,
+ &ext_sem_props_info,
+ &p->ext_sem_props);
+
 qf = av_malloc_array(qf_num, sizeof(VkQueueFamilyProperties2));
 if (!qf)
 return AVERROR(ENOMEM);
@@ -2419,6 +2438,7 @@ static int create_frame(AVHWFramesContext *hwfc, 
AVVkFrame **frame,
 VulkanDevicePriv *p = ctx->hwctx;
 AVVulkanDeviceContext *hwctx = &p->p;
 FFVulkanFunctions *vk = &p->vkctx.vkfn;
+AVVkFrame *f;
 
 VkExportSemaphoreCreateInfo ext_sem_info = {
 .sType = VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO,
@@ -2447,7 +2467,10 @@ static int create_frame(AVHWFramesContext *hwfc, 
AVVkFrame **frame,
 .pNext = &sem_type_info,
 };
 
-AVVkFrame *f = av_vk_frame_alloc();
+if (!(p->ext_sem_props.externalSemaphoreFeatures & 
VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT))
+sem_type_info.pNext = NULL;
+
+f = av_vk_frame_alloc();
 if (!f) {
 av_log(ctx, AV_LOG_ERROR, "Unable to allocate memory for 
AVVkFrame!\n");
 return AVERROR(ENOMEM);
diff --git a/libavutil/vulkan_functions.h b/libavutil/vulkan_functions.h
index eb6f6b01c3..9c6f2d2641 100644
--- a/libavutil/vulkan_functions.h
+++ b/libavutil/vulkan_functions.h
@@ -82,6 +82,7 @@ typedef uint64_t FFVulkanExtensions;
 MACRO(1, 0, FF_VK_EXT_NO_FLAG,  CreateDevice)  
  \
 MACRO(1, 0, FF_VK_EXT_NO_FLAG,  GetPhysicalDeviceFeatures2)
  \
 MACRO(1, 0, FF_VK_EXT_NO_FLAG,  GetPhysicalDeviceProperties)   
  \
+MACRO(1, 0, FF_VK_EXT_NO_FLAG,  
GetPhysicalDeviceExternalSemaphoreProperties)  \
 MACRO(1, 0, FF_VK_EXT_VIDEO_QUEUE,  
GetPhysicalDeviceVideoCapabilitiesKHR) \
 MACRO(1, 0, FF_VK_EXT_VIDEO_QUEUE,  
GetPhysicalDeviceVideoFormatPropertiesKHR) \
 MACRO(1, 0, FF_VK_EXT_NO_FLAG,  DeviceWaitIdle)
  \
-- 
2.45.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] avcodec/mediacodecenc: Support config qp range

2025-01-06 Thread Zhao Zhili
From: Zhao Zhili 

---
 libavcodec/mediacodecenc.c | 64 +-
 libavcodec/version.h   |  2 +-
 2 files changed, 64 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c
index 464903d628..d1a0388d7e 100644
--- a/libavcodec/mediacodecenc.c
+++ b/libavcodec/mediacodecenc.c
@@ -95,6 +95,13 @@ typedef struct MediaCodecEncContext {
 AVCond output_cond;
 int encode_status;
 AVFifo *async_output;
+
+int qp_i_min;
+int qp_p_min;
+int qp_b_min;
+int qp_i_max;
+int qp_p_max;
+int qp_b_max;
 } MediaCodecEncContext;
 
 enum {
@@ -351,6 +358,39 @@ static void mediacodec_uninit_async_state(AVCodecContext 
*avctx)
 
 static int mediacodec_generate_extradata(AVCodecContext *avctx);
 
+static void mediacodec_set_qp_range(AVCodecContext *avctx,
+FFAMediaFormat *format)
+{
+MediaCodecEncContext *s = avctx->priv_data;
+
+// Handle common options in AVCodecContext first.
+if (avctx->qmin >= 0) {
+ff_AMediaFormat_setInt32(format, "video-qp-i-min", avctx->qmin);
+ff_AMediaFormat_setInt32(format, "video-qp-p-min", avctx->qmin);
+ff_AMediaFormat_setInt32(format, "video-qp-b-min", avctx->qmin);
+}
+
+if (avctx->qmax >= 0) {
+ff_AMediaFormat_setInt32(format, "video-qp-i-max", avctx->qmax);
+ff_AMediaFormat_setInt32(format, "video-qp-p-max", avctx->qmax);
+ff_AMediaFormat_setInt32(format, "video-qp-b-max", avctx->qmax);
+}
+
+if (s->qp_i_min >= 0)
+ff_AMediaFormat_setInt32(format, "video-qp-i-min", s->qp_i_min);
+if (s->qp_p_min >= 0)
+ff_AMediaFormat_setInt32(format, "video-qp-p-min", s->qp_p_min);
+if (s->qp_b_min >= 0)
+ff_AMediaFormat_setInt32(format, "video-qp-b-min", s->qp_b_min);
+
+if (s->qp_i_max >= 0)
+ff_AMediaFormat_setInt32(format, "video-qp-i-max", s->qp_i_max);
+if (s->qp_p_max >= 0)
+ff_AMediaFormat_setInt32(format, "video-qp-p-max", s->qp_p_max);
+if (s->qp_b_max >= 0)
+ff_AMediaFormat_setInt32(format, "video-qp-b-max", s->qp_b_max);
+}
+
 static av_cold int mediacodec_init(AVCodecContext *avctx)
 {
 const char *codec_mime = NULL;
@@ -484,6 +524,8 @@ static av_cold int mediacodec_init(AVCodecContext *avctx)
 if (s->bitrate_mode == BITRATE_MODE_CQ && avctx->global_quality > 0)
 ff_AMediaFormat_setInt32(format, "quality", avctx->global_quality);
 }
+mediacodec_set_qp_range(avctx, format);
+
 // frame-rate and i-frame-interval are required to configure codec
 if (avctx->framerate.num >= avctx->framerate.den && avctx->framerate.den > 
0) {
 s->fps = avctx->framerate.num / avctx->framerate.den;
@@ -989,6 +1031,12 @@ static const AVCodecHWConfigInternal *const 
mediacodec_hw_configs[] = {
 NULL
 };
 
+static const FFCodecDefault mediacodec_defaults[] = {
+{"qmin", "-1"},
+{"qmax", "-1"},
+{NULL},
+};
+
 #define OFFSET(x) offsetof(MediaCodecEncContext, x)
 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 #define COMMON_OPTION  
 \
@@ -1012,7 +1060,20 @@ static const AVCodecHWConfigInternal *const 
mediacodec_hw_configs[] = {
 "since most of Android devices don't output B frames by 
default.",  \
 OFFSET(pts_as_dts), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, 
VE }, \
 { "operating_rate", "The desired operating rate that the codec will need 
to operate at, zero for unspecified",\
-OFFSET(operating_rate), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, 
VE },  \
+OFFSET(operating_rate), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 
INT_MAX, VE },  \
+{ "qp_i_min", "minimum quantization parameter for I frame",
 \
+OFFSET(qp_i_min), AV_OPT_TYPE_INT, {.i64 = -1}, 0, 
INT_MAX, VE },   \
+{ "qp_p_min", "minimum quantization parameter for P frame",
 \
+OFFSET(qp_p_min), AV_OPT_TYPE_INT, {.i64 = -1}, 0, 
INT_MAX, VE },   \
+{ "qp_b_min", "minimum quantization parameter for B frame",
 \
+OFFSET(qp_b_min), AV_OPT_TYPE_INT, {.i64 = -1}, 0, 
INT_MAX, VE },   \
+{ "qp_i_max", "maximum quantization parameter for I frame",
 \
+OFFSET(qp_i_max), AV_OPT_TYPE_INT, {.i64 = -1}, 0, 
INT_MAX, VE },   \
+{ "qp_p_max", "maximum quantization parameter for P frame",
 \
+OFFSET(qp_p_max), AV_OPT_TYPE_INT, {.i64 = -1}, 0, 
INT_MAX, VE

Re: [FFmpeg-devel] [PATCH] avfilter/vf_grayworld: Use the correct pointer for av_log()

2025-01-06 Thread Alexander Strasser via ffmpeg-devel
On 2025-01-06 05:22 +0100, Michael Niedermayer wrote:
> Fixes: crash
>
> Found-by: Elias Myllymäki 
> Signed-off-by: Michael Niedermayer 
> ---
>  libavfilter/vf_grayworld.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavfilter/vf_grayworld.c b/libavfilter/vf_grayworld.c
> index a6a51dcb7db..91b097a4b80 100644
> --- a/libavfilter/vf_grayworld.c
> +++ b/libavfilter/vf_grayworld.c
> @@ -266,10 +266,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
> *in)
>  }
>  /* input and output transfer will be linear */
>  if (in->color_trc == AVCOL_TRC_UNSPECIFIED) {
> -av_log(s, AV_LOG_WARNING, "Untagged transfer, assuming linear 
> light.\n");
> +av_log(ctx, AV_LOG_WARNING, "Untagged transfer, assuming linear 
> light.\n");
>  out->color_trc = AVCOL_TRC_LINEAR;
>  } else if (in->color_trc != AVCOL_TRC_LINEAR) {
> -av_log(s, AV_LOG_WARNING, "Gray world color correction works on 
> linear light only.\n");
> +av_log(ctx, AV_LOG_WARNING, "Gray world color correction works on 
> linear light only.\n");
>  }
>
>  td.in = in;
> --

LGTM


  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] [RFC PATCH] avformat/rtpdec: fix another int overflow in start_time_realtime

2025-01-06 Thread Alexander Strasser via ffmpeg-devel
Hi Jonathan!

On 2025-01-05 04:26 -0500, Jonathan Baudanza wrote:
>
>
> On Tue, Nov 26, 2024, at 1:35 AM, j...@jonb.org wrote:
> >
> > This patch replaces av_rescale, which operates on int64_t, with 
> > ff_parse_ntp_time, which operates on uint65_t. This will give the correct 
> > values for timestamps back around the NTP epoch and present day timestamps.
> >
>
> Any feedback on this one-liner?

Patch looks plausible except for the uint65_t typo and the long
lines in the commit message.

Will give it a try and push if it works and there are no objections
from other developers.

Thanks for submitting this patch!


Best regards,
  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".


[FFmpeg-devel] [PATCH] avutil/vulkan_glslang: windows build improvements

2025-01-06 Thread Koushik Dutta
Searches pkg-config for glslang libraries.
Use libavutil thread.h wrapper rather than directly including pthread.h.

Signed-off-by: Koushik Dutta 
---
 configure  | 1 +
 libavutil/vulkan_glslang.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index b09e9d0436..9d7381de9c 100755
--- a/configure
+++ b/configure
@@ -6931,6 +6931,7 @@ enabled libharfbuzz   && require_pkg_config 
libharfbuzz harfbuzz hb.h hb_buf
 enabled libglslang && { check_lib spirv_compiler 
glslang/Include/glslang_c_interface.h glslang_initialize_process \
 -lglslang -lMachineIndependent -lGenericCodeGen \
 -lSPVRemapper -lSPIRV -lSPIRV-Tools-opt 
-lSPIRV-Tools -lpthread -lstdc++ -lm ||
+check_pkg_config spirv_compiler glslang 
"glslang/Include/glslang_c_interface.h glslang/build_info.h" 
glslang_initialize_process ||
 require spirv_compiler 
glslang/Include/glslang_c_interface.h glslang_initialize_process \
 -lglslang -lMachineIndependent -lOSDependent 
-lHLSL -lOGLCompiler -lGenericCodeGen \
 -lSPVRemapper -lSPIRV -lSPIRV-Tools-opt 
-lSPIRV-Tools -lpthread -lstdc++ -lm ; }
diff --git a/libavutil/vulkan_glslang.c b/libavutil/vulkan_glslang.c
index d116b35ec5..9a985a930f 100644
--- a/libavutil/vulkan_glslang.c
+++ b/libavutil/vulkan_glslang.c
@@ -16,7 +16,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include 
+#include "thread.h"
 
 #include 
 #include 
-- 
2.39.5 (Apple Git-154)

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