[FFmpeg-devel] [PATCH] lavu/hwcontext_vulkan: check both vendor and PCI IDs

2024-03-07 Thread Xiang, Haihao
From: Haihao Xiang 

Otherwise the derived device and the source device might have different
PCI ID or vendor ID in a multiple-device system.

Signed-off-by: Haihao Xiang 
---
 libavutil/hwcontext_vulkan.c | 31 +--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 855f099e26..9d94f74d78 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -975,6 +975,20 @@ static int find_device(AVHWDeviceContext *ctx, 
VulkanDeviceSelection *select)
select->name);
 err = AVERROR(ENODEV);
 goto end;
+} else if (select->vendor_id && select->pci_device) {
+av_log(ctx, AV_LOG_VERBOSE, "Requested vendor:device %04x:%04x\n",
+   select->vendor_id, select->pci_device);
+for (int i = 0; i < num; i++) {
+if (select->vendor_id == prop[i].properties.vendorID &&
+select->pci_device == prop[i].properties.deviceID) {
+choice = i;
+goto end;
+}
+}
+av_log(ctx, AV_LOG_ERROR, "Unable to find device with vendor ID 0x%x "
+   "and PCI ID 0x%x!\n", select->vendor_id, select->pci_device);
+err = AVERROR(EINVAL);
+goto end;
 } else if (select->pci_device) {
 av_log(ctx, AV_LOG_VERBOSE, "Requested device: 0x%x\n", 
select->pci_device);
 for (int i = 0; i < num; i++) {
@@ -1597,8 +1611,14 @@ static int vulkan_device_derive(AVHWDeviceContext *ctx,
 #if CONFIG_VAAPI
 case AV_HWDEVICE_TYPE_VAAPI: {
 AVVAAPIDeviceContext *src_hwctx = src_ctx->hwctx;
-
-const char *vendor = vaQueryVendorString(src_hwctx->display);
+VADisplay dpy = src_hwctx->display;
+#if VA_CHECK_VERSION(1, 15, 0)
+VAStatus vas;
+VADisplayAttribute attr = {
+.type = VADisplayPCIID,
+};
+#endif
+const char *vendor = vaQueryVendorString(dpy);
 if (!vendor) {
 av_log(ctx, AV_LOG_ERROR, "Unable to get device info from 
VAAPI!\n");
 return AVERROR_EXTERNAL;
@@ -1607,6 +1627,13 @@ static int vulkan_device_derive(AVHWDeviceContext *ctx,
 if (strstr(vendor, "AMD"))
 dev_select.vendor_id = 0x1002;
 
+#if VA_CHECK_VERSION(1, 15, 0)
+vas = vaGetDisplayAttributes(dpy, , 1);
+if (vas == VA_STATUS_SUCCESS && attr.flags != 
VA_DISPLAY_ATTRIB_NOT_SUPPORTED) {
+dev_select.vendor_id = ((attr.value >> 16) & 0x);
+dev_select.pci_device = (attr.value & 0x);
+}
+#endif
 return vulkan_device_create_internal(ctx, _select, 0, opts, flags);
 }
 #endif
-- 
2.34.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 02/18] fftools/ffmpeg_filter: refactor setting input timebase

2024-03-07 Thread Anton Khirnov
Quoting Michael Niedermayer (2024-03-07 21:37:39)
> On Wed, Mar 06, 2024 at 12:03:03PM +0100, Anton Khirnov wrote:
> > Treat it analogously to stream parameters like format/dimensions/etc.
> > This is functionally different from previous code in 2 ways:
> > * for non-CFR video, the frame timebase (set by the decoder) is used
> >   rather than the demuxer timebase
> > * for sub2video, AV_TIME_BASE_Q is used, which is hardcoded by the
> >   subtitle decoding API
> > 
> > These changes should avoid unnecessary and potentially lossy timestamp
> > conversions from decoder timebase into the demuxer one.
> > 
> > Changes the timebases used in sub2video tests.
> > ---
> >  fftools/ffmpeg_filter.c   |  17 ++-
> >  tests/ref/fate/sub2video_basic| 182 +-
> >  tests/ref/fate/sub2video_time_limited |   8 +-
> >  3 files changed, 106 insertions(+), 101 deletions(-)
> 
> breaks:
> 
> ./ffmpeg -i 
> \[a-s\]_full_metal_panic_fumoffu_-_01_-_the_man_from_the_south_-_a_hostage_with_no_compromises__rs2_\[1080p_bd-rip\]\[BBB48A25\].mkv
>   -filter_complex '[0:s:1]scale=800:600' -t 15 -qscale 2 -y a.avi
> 

Use a constant framerate.

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

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


[FFmpeg-devel] [PATCH] avcodec/hevc_cabac: Let compiler count offsets

2024-03-07 Thread Andreas Rheinhardt
This is easily possible with an X macro.
Using an enum for the offsets also allows to remove
two arrays which are not really needed and will typically
be optimized away by the compiler: The first just exists
to count the number of syntax elements*, the second one
exists to get offset[CONSTANT]. These constants were
of type enum SyntaxElement and this enum was only used
in hevc_cabac.c (although it was declared in hevcdec.h);
it is now no longer needed at all and has therefore been
removed.

The first of these arrays led to a warning from Clang
which is fixed by this commit:
warning: variable 'num_bins_in_se' is not needed and will
not be emitted [-Wunneeded-internal-declaration]

*: One could also just added a trailing SYNTAX_ELEMENT_NB
to the SyntaxElement enum for this purpose.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/hevc_cabac.c | 248 
 libavcodec/hevcdec.h|  52 -
 2 files changed, 100 insertions(+), 200 deletions(-)

diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c
index 6b38da84bd..63ffb3d37c 100644
--- a/libavcodec/hevc_cabac.c
+++ b/libavcodec/hevc_cabac.c
@@ -31,114 +31,66 @@
 
 #define CABAC_MAX_BIN 31
 
-/**
- * number of bin by SyntaxElement.
- */
-static const int8_t num_bins_in_se[] = {
- 1, // sao_merge_flag
- 1, // sao_type_idx
- 0, // sao_eo_class
- 0, // sao_band_position
- 0, // sao_offset_abs
- 0, // sao_offset_sign
- 0, // end_of_slice_flag
- 3, // split_coding_unit_flag
- 1, // cu_transquant_bypass_flag
- 3, // skip_flag
- 3, // cu_qp_delta
- 1, // pred_mode
- 4, // part_mode
- 0, // pcm_flag
- 1, // prev_intra_luma_pred_mode
- 0, // mpm_idx
- 0, // rem_intra_luma_pred_mode
- 2, // intra_chroma_pred_mode
- 1, // merge_flag
- 1, // merge_idx
- 5, // inter_pred_idc
- 2, // ref_idx_l0
- 2, // ref_idx_l1
- 2, // abs_mvd_greater0_flag
- 2, // abs_mvd_greater1_flag
- 0, // abs_mvd_minus2
- 0, // mvd_sign_flag
- 1, // mvp_lx_flag
- 1, // no_residual_data_flag
- 3, // split_transform_flag
- 2, // cbf_luma
- 5, // cbf_cb, cbf_cr
- 2, // transform_skip_flag[][]
- 2, // explicit_rdpcm_flag[][]
- 2, // explicit_rdpcm_dir_flag[][]
-18, // last_significant_coeff_x_prefix
-18, // last_significant_coeff_y_prefix
- 0, // last_significant_coeff_x_suffix
- 0, // last_significant_coeff_y_suffix
- 4, // significant_coeff_group_flag
-44, // significant_coeff_flag
-24, // coeff_abs_level_greater1_flag
- 6, // coeff_abs_level_greater2_flag
- 0, // coeff_abs_level_remaining
- 0, // coeff_sign_flag
- 8, // log2_res_scale_abs
- 2, // res_scale_sign_flag
- 1, // cu_chroma_qp_offset_flag
- 1, // cu_chroma_qp_offset_idx
-};
+// ELEM(NAME, NUM_BINS)
+#define CABAC_ELEMS(ELEM) \
+ELEM(SAO_MERGE_FLAG, 1)   \
+ELEM(SAO_TYPE_IDX, 1) \
+ELEM(SAO_EO_CLASS, 0) \
+ELEM(SAO_BAND_POSITION, 0)\
+ELEM(SAO_OFFSET_ABS, 0)   \
+ELEM(SAO_OFFSET_SIGN, 0)  \
+ELEM(END_OF_SLICE_FLAG, 0)\
+ELEM(SPLIT_CODING_UNIT_FLAG, 3)   \
+ELEM(CU_TRANSQUANT_BYPASS_FLAG, 1)\
+ELEM(SKIP_FLAG, 3)\
+ELEM(CU_QP_DELTA, 3)  \
+ELEM(PRED_MODE_FLAG, 1)   \
+ELEM(PART_MODE, 4)\
+ELEM(PCM_FLAG, 0) \
+ELEM(PREV_INTRA_LUMA_PRED_FLAG, 1)\
+ELEM(MPM_IDX, 0)  \
+ELEM(REM_INTRA_LUMA_PRED_MODE, 0) \
+ELEM(INTRA_CHROMA_PRED_MODE, 2)   \
+ELEM(MERGE_FLAG, 1)   \
+ELEM(MERGE_IDX, 1)\
+ELEM(INTER_PRED_IDC, 5)   \
+ELEM(REF_IDX_L0, 2)   \
+ELEM(REF_IDX_L1, 2)   \
+ELEM(ABS_MVD_GREATER0_FLAG, 2)\
+ELEM(ABS_MVD_GREATER1_FLAG, 2)\
+ELEM(ABS_MVD_MINUS2, 0)   \
+ELEM(MVD_SIGN_FLAG, 0)\
+ELEM(MVP_LX_FLAG, 1)  \
+ELEM(NO_RESIDUAL_DATA_FLAG, 1)\
+ELEM(SPLIT_TRANSFORM_FLAG, 3) \
+ELEM(CBF_LUMA, 2) \
+ELEM(CBF_CB_CR, 5)\
+ELEM(TRANSFORM_SKIP_FLAG, 2)  \
+ELEM(EXPLICIT_RDPCM_FLAG, 2)  \
+ELEM(EXPLICIT_RDPCM_DIR_FLAG, 2)  \
+ELEM(LAST_SIGNIFICANT_COEFF_X_PREFIX, 18) \
+ELEM(LAST_SIGNIFICANT_COEFF_Y_PREFIX, 18) \
+ELEM(LAST_SIGNIFICANT_COEFF_X_SUFFIX, 0)  \
+ELEM(LAST_SIGNIFICANT_COEFF_Y_SUFFIX, 0)  \
+ELEM(SIGNIFICANT_COEFF_GROUP_FLAG, 4) \
+ELEM(SIGNIFICANT_COEFF_FLAG, 44)  \
+ELEM(COEFF_ABS_LEVEL_GREATER1_FLAG, 24)   \
+

Re: [FFmpeg-devel] [PATCH] lavfi/vulkan_filter: fix input format

2024-03-07 Thread Xiang, Haihao
On Do, 2024-03-07 at 05:05 +0100, Lynne wrote:
> Mar 6, 2024, 06:26 by haihao.xiang-at-intel@ffmpeg.org:
> 
> > From: Haihao Xiang 
> > 
> > Otherwise s->input_format is always yuv420p.
> > 
> > This fixes invalid output format for hwframe download in the command
> > below:
> > ./ffmpeg -init_hw_device vulkan -f lavfi \
> >  -i testsrc=duration=1,format=nv12 \
> >  -vf 'hwupload,format=vulkan,scale_vulkan=1024:768,hwdownload,format=nv12' \
> >  -f null -
> > 
> > Signed-off-by: Haihao Xiang 
> > ---
> >  libavfilter/vulkan_filter.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/libavfilter/vulkan_filter.c b/libavfilter/vulkan_filter.c
> > index d3dc2fdacb..cef42eeb4d 100644
> > --- a/libavfilter/vulkan_filter.c
> > +++ b/libavfilter/vulkan_filter.c
> > @@ -187,6 +187,7 @@ int ff_vk_filter_config_input(AVFilterLink *inlink)
> >  s->input_frames_ref = inlink->hw_frames_ctx;
> >  
> >  /* Defaults */
> > +    s->input_format = input_frames->sw_format;
> >  s->output_format = input_frames->sw_format;
> >  s->output_width = inlink->w;
> >  s->output_height = inlink->h;
> > 
> 
> LGTM
> Thanks

Thanks for reviewing the patch, pushed.

BRs
Haihao

___
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/mxfenc: add h264_mp4toannexb bitstream filter if needed when muxing h264

2024-03-07 Thread Marton Balint



On Wed, 6 Mar 2024, Tomas Härdin wrote:


lör 2024-02-24 klockan 15:13 +0100 skrev Andreas Rheinhardt:

Tomas Härdin:
> > > > +static int mxf_check_bitstream(AVFormatContext *s, AVStream
> > > > *st,
> > > > const AVPacket *pkt)
> > > > +{
> > > > +    if (st->codecpar->codec_id == AV_CODEC_ID_H264) {
> > > > +    if (pkt->size >= 5 && AV_RB32(pkt->data) !=
> > > > 0x001 &&
> > > > +  AV_RB24(pkt->data) !=
> > > > 0x01)
> > > > +    return ff_stream_add_bitstream_filter(st,
> > > > "h264_mp4toannexb", NULL);
> 
> Regardless of the comments below, this is wrong. ST 381-3 says

> this:
> 
> > The byte stream format can be constructed from the NAL unit

> > stream by
> > prefixing each NAL unit with a start
> > code prefix and zero or more zero-valued bytes to form a stream
> > of
> > bytes.
> 
> Note the wording is "zero or more", not "zero or one".


IMO all the code should only look at extradata to decide whether a
stream is annex B or ISOBMFF (no extradata->annex B, no ISOBMFF
extradata->annex B, else ISOBMFF). But that is a separate issue.
(There is a slight possibility of misdetection here: E.g. a 0x00 00
01
at the start of a packet can actually be the start of the length code
of
an ISOBMFF NALU with length in the range 256-511; on the other hand,
it
is legal for an annex B packet to start with four or more zero bytes,
as
you mentioned.)

> The correct way to do this is to inspect byte 14 of the EC UL, per
> section 8.1 of ST 381-3.

This is a patch for the muxer, not the demuxer.


D'oh! Then it's an entirely different thing of course. Then the onus
falls on lavf internals to behave correctly.


There is no byte 14 of
the EC UL to inspect; or at least: It is what this muxer writes for
it.
This muxer always indicates that the output is an annex B (aka AVC
byte
stream), so it should always convert the input from the user to
actually
be annex B.


We could do that, or we could write an appropriate UL. Either is fine I
suppose.


Will apply.

Thanks,
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] avcodec/xbmenc: Avoid snprintf() for data->hex conversion

2024-03-07 Thread Marton Balint



On Fri, 8 Mar 2024, Andreas Rheinhardt wrote:


Marton Balint:



On Fri, 8 Mar 2024, Andreas Rheinhardt wrote:


Andreas Rheinhardt:

Use a small LUT instead. Improves performance.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/xbmenc.c | 21 +++--
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/libavcodec/xbmenc.c b/libavcodec/xbmenc.c
index cd8b73afa3..5231d4691d 100644
--- a/libavcodec/xbmenc.c
+++ b/libavcodec/xbmenc.c
@@ -20,11 +20,9 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
  */

-#include "libavutil/reverse.h"
 #include "avcodec.h"
 #include "codec_internal.h"
 #include "encode.h"
-#include "mathops.h"

 #define ANSI_MIN_READLINE 509

@@ -57,14 +55,25 @@ static int xbm_encode_frame(AVCodecContext
*avctx, AVPacket *pkt,
 buf += snprintf(buf, 39, "static unsigned char image_bits[] =
{\n");
 for (i = 0, l = lineout; i < avctx->height; i++) {
 for (j = 0; j < linesize; j++) {
-    buf += snprintf(buf, 6, " 0x%02X", ff_reverse[*ptr++]);
+    // 0..15 bitreversed as chars
+    static const char lut[] = {
+    '0', '8', '4', 'C', '2', 'A', '6', 'E',
+    '1', '9', '5', 'D', '3', 'B', '7', 'F'
+    };
+    buf[0] = ' ';
+    buf[1] = '0';
+    buf[2] = 'x';
+    buf[3] = lut[*ptr & 0xF];
+    buf[4] = lut[*ptr >> 4];


Maybe you could use *buf++ = ... here as well, to avoid the next line.
But fine either way I guess.



You mean *ptr++ to avoid the line after the next line? That would make
the two lut accesses unsymmetric. And actually I prefer that both
pointers are incremented side-by-side.



I meant this:

diff --git a/libavcodec/xbmenc.c b/libavcodec/xbmenc.c
index 5231d4691d..20f8951f93 100644
--- a/libavcodec/xbmenc.c
+++ b/libavcodec/xbmenc.c
@@ -60,12 +60,11 @@ static int xbm_encode_frame(AVCodecContext *avctx, AVPacket 
*pkt,
 '0', '8', '4', 'C', '2', 'A', '6', 'E',
 '1', '9', '5', 'D', '3', 'B', '7', 'F'
 };
-buf[0] = ' ';
-buf[1] = '0';
-buf[2] = 'x';
-buf[3] = lut[*ptr & 0xF];
-buf[4] = lut[*ptr >> 4];
-buf += 5;
+*buf++ = ' ';
+*buf++ = '0';
+*buf++ = 'x';
+*buf++ = lut[*ptr & 0xF];
+*buf++ = lut[*ptr >> 4];
 ptr++;
 if (--commas <= 0) {
 *buf++ = '\n';


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] [RFC] fateserver

2024-03-07 Thread Marth64
Hi Michael, all,

While awaiting direction I will go ahead and study this process further.
From an overall view, it is something I am comfortable to help maintain.
Perhaps my focus can be to get the current version in a stable place, and
work on a long term improvement strategy to the rewrite version.

If Docker is allowed, with regard to security updates within the Docker
container: I have known processes to do this and will be transparent with,
I also have experience with vulnerability management so I will apply that
lens proactively.

Thanks,


On Mon, Feb 26, 2024 at 8:30 AM Michael Niedermayer 
wrote:

> Hi
>
> On Sun, Feb 25, 2024 at 06:21:14PM -0600, Marth64 wrote:
> > Thank you Michael, for the opportunity.  I have some initial questions
> > while others add the remaining detail.
> >
> [...]
> > 2) Are you open to Docker containerization (with rootless)? In this way,
> > the application is jailed and can restart automatically on its own. Also,
> > more flexibility on the host machine itself.
>
> This depends on who maintains the setup. I dont volunteer to maintain
> a extra container layer. But if someone else does it and i never have
> to deal with it (and assuming baptiste has no objections) thats perfectly
> fine with me. But for example if you setup ssh (for the fate client
> connections) in a docker, apache / nginx in a docker, ...
> all this needs to get security updates.
>
> thx
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> If a bugfix only changes things apparently unrelated to the bug with no
> further explanation, that is a good sign that the bugfix is wrong.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] avcodec/xbmenc: Avoid snprintf() for data->hex conversion

2024-03-07 Thread Andreas Rheinhardt
Marton Balint:
> 
> 
> On Fri, 8 Mar 2024, Andreas Rheinhardt wrote:
> 
>> Andreas Rheinhardt:
>>> Use a small LUT instead. Improves performance.
>>>
>>> Signed-off-by: Andreas Rheinhardt 
>>> ---
>>>  libavcodec/xbmenc.c | 21 +++--
>>>  1 file changed, 15 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/libavcodec/xbmenc.c b/libavcodec/xbmenc.c
>>> index cd8b73afa3..5231d4691d 100644
>>> --- a/libavcodec/xbmenc.c
>>> +++ b/libavcodec/xbmenc.c
>>> @@ -20,11 +20,9 @@
>>>   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
>>> 02110-1301 USA
>>>   */
>>>
>>> -#include "libavutil/reverse.h"
>>>  #include "avcodec.h"
>>>  #include "codec_internal.h"
>>>  #include "encode.h"
>>> -#include "mathops.h"
>>>
>>>  #define ANSI_MIN_READLINE 509
>>>
>>> @@ -57,14 +55,25 @@ static int xbm_encode_frame(AVCodecContext
>>> *avctx, AVPacket *pkt,
>>>  buf += snprintf(buf, 39, "static unsigned char image_bits[] =
>>> {\n");
>>>  for (i = 0, l = lineout; i < avctx->height; i++) {
>>>  for (j = 0; j < linesize; j++) {
>>> -    buf += snprintf(buf, 6, " 0x%02X", ff_reverse[*ptr++]);
>>> +    // 0..15 bitreversed as chars
>>> +    static const char lut[] = {
>>> +    '0', '8', '4', 'C', '2', 'A', '6', 'E',
>>> +    '1', '9', '5', 'D', '3', 'B', '7', 'F'
>>> +    };
>>> +    buf[0] = ' ';
>>> +    buf[1] = '0';
>>> +    buf[2] = 'x';
>>> +    buf[3] = lut[*ptr & 0xF];
>>> +    buf[4] = lut[*ptr >> 4];
> 
> Maybe you could use *buf++ = ... here as well, to avoid the next line.
> But fine either way I guess.
> 

You mean *ptr++ to avoid the line after the next line? That would make
the two lut accesses unsymmetric. And actually I prefer that both
pointers are incremented side-by-side.

>>> +    buf += 5;
>>> +    ptr++;

___
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 v1 2/2] lavc/vvc_ps: Correct NoOutputBeforeRecoveryFlag of IDR

2024-03-07 Thread fei . w . wang-at-intel . com
From: Fei Wang 

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

diff --git a/libavcodec/vvc/vvc_ps.c b/libavcodec/vvc/vvc_ps.c
index e6e46d2039..7972803da6 100644
--- a/libavcodec/vvc/vvc_ps.c
+++ b/libavcodec/vvc/vvc_ps.c
@@ -742,7 +742,7 @@ static int decode_frame_ps(VVCFrameParamSets *fps, const 
VVCParamSets *ps,
 static void decode_recovery_flag(VVCContext *s)
 {
 if (IS_IDR(s))
-s->no_output_before_recovery_flag = 0;
+s->no_output_before_recovery_flag = 1;
 else if (IS_CRA(s) || IS_GDR(s))
 s->no_output_before_recovery_flag = s->last_eos;
 }
-- 
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 v2 7/9] avformat/pcm: factorize and improve determining the default packet size

2024-03-07 Thread Marton Balint
- Remove the 1024 cap on the number of samples, for high sample rate audio it
  was suboptimal, calculate the low neighbour power of two for the number of
  samples (audio blocks) instead.
- Make the function work correctly for non-pcm codecs by using
  av_get_audio_frame_duration2() to esimate the packet duration for a given
  size
- Fall back to 4096/block_align if av_get_audio_frame_duration2() is not
  supported

Signed-off-by: Marton Balint 
---
 libavformat/pcm.c  | 42 ++
 libavformat/pcm.h  |  1 +
 tests/ref/seek/lavf-al | 46 +-
 tests/ref/seek/lavf-ul | 46 +-
 4 files changed, 76 insertions(+), 59 deletions(-)

diff --git a/libavformat/pcm.c b/libavformat/pcm.c
index 9741f73667..b7728dd15e 100644
--- a/libavformat/pcm.c
+++ b/libavformat/pcm.c
@@ -19,32 +19,48 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavcodec/codec_par.h"
 #include "libavutil/mathematics.h"
 #include "avformat.h"
 #include "internal.h"
 #include "pcm.h"
 
-#define RAW_SAMPLES 1024
+#define PCM_DEMUX_TARGET_FPS  25
 
-int ff_pcm_read_packet(AVFormatContext *s, AVPacket *pkt)
+int ff_pcm_default_packet_size(AVCodecParameters *par)
 {
-AVCodecParameters *par = s->streams[0]->codecpar;
-int ret, size;
+int nb_samples, max_samples, target_duration;
 
 if (par->block_align <= 0)
 return AVERROR(EINVAL);
 
-/*
- * Compute read size to complete a read every 62ms.
- * Clamp to RAW_SAMPLES if larger.
- */
-size = FFMAX(par->sample_rate/25, 1);
-if (par->block_align <= INT_MAX / RAW_SAMPLES) {
-size = FFMIN(size, RAW_SAMPLES) * par->block_align;
-} else {
-size = par->block_align;
+max_samples = INT_MAX / par->block_align;
+target_duration = FFMAX(1, par->sample_rate / PCM_DEMUX_TARGET_FPS);
+nb_samples = 1 << av_log2(FFMIN(target_duration, max_samples));
+
+while (nb_samples > 1) {
+int duration = av_get_audio_frame_duration2(par, par->block_align * 
nb_samples);
+if (!duration) {
+/* Fallback to a size based method for a likely non-pcm codec */
+nb_samples = av_clip(4096 / par->block_align, 1, max_samples);
+break;
+}
+if (duration <= target_duration)
+break;
+nb_samples >>= 1;
 }
 
+return par->block_align * nb_samples;
+}
+
+int ff_pcm_read_packet(AVFormatContext *s, AVPacket *pkt)
+{
+int ret, size;
+
+size = ff_pcm_default_packet_size(s->streams[0]->codecpar);
+if (size < 0)
+return size;
+
 ret = av_get_packet(s->pb, pkt, size);
 
 pkt->flags &= ~AV_PKT_FLAG_CORRUPT;
diff --git a/libavformat/pcm.h b/libavformat/pcm.h
index 9af36d5a2e..1928497eed 100644
--- a/libavformat/pcm.h
+++ b/libavformat/pcm.h
@@ -24,6 +24,7 @@
 
 #include "avformat.h"
 
+int ff_pcm_default_packet_size(AVCodecParameters *par);
 int ff_pcm_read_packet(AVFormatContext *s, AVPacket *pkt);
 int ff_pcm_read_seek(AVFormatContext *s,
  int stream_index, int64_t timestamp, int flags);
diff --git a/tests/ref/seek/lavf-al b/tests/ref/seek/lavf-al
index 5a4085af4e..ebf7993425 100644
--- a/tests/ref/seek/lavf-al
+++ b/tests/ref/seek/lavf-al
@@ -1,50 +1,50 @@
-ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:  0 size:   
882
+ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:  0 size:   
512
 ret: 0 st:-1 flags:0  ts:-1.00
-ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:  0 size:   
882
+ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:  0 size:   
512
 ret: 0 st:-1 flags:1  ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.894150 pts: 1.894150 pos:  41766 size:   
882
+ret: 0 st: 0 flags:1 dts: 1.894150 pts: 1.894150 pos:  41766 size:   
512
 ret: 0 st: 0 flags:0  ts: 0.788345
-ret: 0 st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos:  17383 size:   
882
+ret: 0 st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos:  17383 size:   
512
 ret: 0 st: 0 flags:1  ts:-0.317506
-ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:  0 size:   
882
+ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:  0 size:   
512
 ret:-1 st:-1 flags:0  ts: 2.576668
 ret: 0 st:-1 flags:1  ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.470839 pts: 1.470839 pos:  32432 size:   
882
+ret: 0 st: 0 flags:1 dts: 1.470839 pts: 1.470839 pos:  32432 size:   
512
 ret: 0 st: 0 flags:0  ts: 0.364989
-ret: 0 st: 0 flags:1 dts: 0.364989 pts: 0.364989 pos:   8048 size:   
882
+ret: 0 st: 0 flags:1 dts: 0.364989 pts: 0.364989 pos:   8048 size:   
512
 ret: 0 st: 0 flags:1  ts:-0.740816
-ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:  0 size:   
882
+ret: 0 st: 0 flags:1 dts: 

[FFmpeg-devel] [PATCH v2 6/9] fate: use atrim filter instead of -frames:a 20 for fate-filter-tremolo

2024-03-07 Thread Marton Balint
To make it independent of incoming wav demuxer packet size.

Signed-off-by: Marton Balint 
---
 tests/fate/filter-audio.mak | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/fate/filter-audio.mak b/tests/fate/filter-audio.mak
index 78fec28b04..6ddc0baf57 100644
--- a/tests/fate/filter-audio.mak
+++ b/tests/fate/filter-audio.mak
@@ -190,10 +190,10 @@ FATE_AFILTER_SAMPLES-$(call FILTERDEMDECENCMUX, 
STEREOTOOLS, WAV, PCM_S16LE, PCM
 fate-filter-stereotools: SRC = 
$(TARGET_SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav
 fate-filter-stereotools: CMD = framecrc -i $(SRC) -frames:a 20 -af 
aresample,stereotools=mlev=0.015625,aresample
 
-FATE_AFILTER_SAMPLES-$(call FILTERDEMDECENCMUX, TREMOLO, WAV, PCM_S16LE, 
PCM_S16LE, WAV) += fate-filter-tremolo
+FATE_AFILTER_SAMPLES-$(call FILTERDEMDECENCMUX, TREMOLO ATRIM, WAV, PCM_S16LE, 
PCM_S16LE, WAV) += fate-filter-tremolo
 fate-filter-tremolo: tests/data/asynth-44100-2.wav
 fate-filter-tremolo: SRC = $(TARGET_PATH)/tests/data/asynth-44100-2.wav
-fate-filter-tremolo: CMD = ffmpeg -auto_conversion_filters -i $(SRC) -frames:a 
20 -af tremolo -f wav -f s16le -
+fate-filter-tremolo: CMD = ffmpeg -auto_conversion_filters -i $(SRC) -af 
tremolo,atrim=end_sample=20480 -f wav -f s16le -
 fate-filter-tremolo: REF = $(SAMPLES)/filter/tremolo.pcm
 fate-filter-tremolo: CMP = oneoff
 fate-filter-tremolo: CMP_UNIT = s16
-- 
2.35.3

___
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 5/9] fate: use a fixed wav demux packet size for amix tests

2024-03-07 Thread Marton Balint
The dropout transition feature of the amix filter depends on the incoming
packet size.

Signed-off-by: Marton Balint 
---
 tests/fate/filter-audio.mak | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/fate/filter-audio.mak b/tests/fate/filter-audio.mak
index 5b5d741f06..78fec28b04 100644
--- a/tests/fate/filter-audio.mak
+++ b/tests/fate/filter-audio.mak
@@ -229,17 +229,17 @@ fate-filter-hls-append: tests/data/hls-list-append.m3u8
 fate-filter-hls-append: CMD = framecrc -flags +bitexact -i 
$(TARGET_PATH)/tests/data/hls-list-append.m3u8 -af asetpts=N*23,aresample
 
 FATE_AMIX += fate-filter-amix-simple
-fate-filter-amix-simple: CMD = ffmpeg -auto_conversion_filters -filter_complex 
amix -i $(SRC) -ss 3 -i $(SRC1) -f f32le -
+fate-filter-amix-simple: CMD = ffmpeg -auto_conversion_filters -filter_complex 
amix -max_size 4096 -i $(SRC) -ss 3 -max_size 4096 -i $(SRC1) -f f32le -
 fate-filter-amix-simple: REF = $(SAMPLES)/filter/amix_simple.pcm
 
 FATE_AMIX += fate-filter-amix-first
-fate-filter-amix-first: CMD = ffmpeg -auto_conversion_filters -filter_complex 
amix=duration=first -ss 4 -i $(SRC) -i $(SRC1) -f f32le -
+fate-filter-amix-first: CMD = ffmpeg -auto_conversion_filters -filter_complex 
amix=duration=first -ss 4 -max_size 4096 -i $(SRC) -max_size 4096 -i $(SRC1) -f 
f32le -
 fate-filter-amix-first: REF = $(SAMPLES)/filter/amix_first.pcm
 
 FATE_AMIX += fate-filter-amix-transition
 fate-filter-amix-transition: tests/data/asynth-44100-2-3.wav
 fate-filter-amix-transition: SRC2 = 
$(TARGET_PATH)/tests/data/asynth-44100-2-3.wav
-fate-filter-amix-transition: CMD = ffmpeg -auto_conversion_filters 
-filter_complex amix=inputs=3:dropout_transition=0.5 -i $(SRC) -ss 2 -i $(SRC1) 
-ss 4 -i $(SRC2) -f f32le -
+fate-filter-amix-transition: CMD = ffmpeg -auto_conversion_filters 
-filter_complex amix=inputs=3:dropout_transition=0.5 -max_size 4096 -i $(SRC) 
-ss 2 -max_size 4096 -i $(SRC1) -ss 4 -max_size 4096 -i $(SRC2) -f f32le -
 fate-filter-amix-transition: REF = $(SAMPLES)/filter/amix_transition.pcm
 
 FATE_AFILTER_SAMPLES-$(call FILTERDEMDECENCMUX, AMIX, WAV, PCM_S16LE, 
PCM_F32LE, PCM_F32LE) += $(FATE_AMIX)
-- 
2.35.3

___
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 v1 1/2] lavc/vvcdec: Add missed chroma sampling factor for crop offset

2024-03-07 Thread fei . w . wang-at-intel . com
From: Fei Wang 

Signed-off-by: Fei Wang 
---
 libavcodec/vvc/vvc_refs.c | 8 
 libavcodec/vvc/vvcdec.c   | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavcodec/vvc/vvc_refs.c b/libavcodec/vvc/vvc_refs.c
index 99f2dcf3ec..afcfc09da7 100644
--- a/libavcodec/vvc/vvc_refs.c
+++ b/libavcodec/vvc/vvc_refs.c
@@ -185,10 +185,10 @@ int ff_vvc_set_new_ref(VVCContext *s, VVCFrameContext 
*fc, AVFrame **frame)
 
 ref->poc  = poc;
 ref->sequence = s->seq_decode;
-ref->frame->crop_left   = fc->ps.pps->r->pps_conf_win_left_offset;
-ref->frame->crop_right  = fc->ps.pps->r->pps_conf_win_right_offset;
-ref->frame->crop_top= fc->ps.pps->r->pps_conf_win_top_offset;
-ref->frame->crop_bottom = fc->ps.pps->r->pps_conf_win_bottom_offset;
+ref->frame->crop_left   = fc->ps.pps->r->pps_conf_win_left_offset << 
fc->ps.sps->hshift[CHROMA];
+ref->frame->crop_right  = fc->ps.pps->r->pps_conf_win_right_offset << 
fc->ps.sps->hshift[CHROMA];
+ref->frame->crop_top= fc->ps.pps->r->pps_conf_win_top_offset << 
fc->ps.sps->vshift[CHROMA];
+ref->frame->crop_bottom = fc->ps.pps->r->pps_conf_win_bottom_offset << 
fc->ps.sps->vshift[CHROMA];
 
 return 0;
 }
diff --git a/libavcodec/vvc/vvcdec.c b/libavcodec/vvc/vvcdec.c
index 570e2aa513..a979ebd41c 100644
--- a/libavcodec/vvc/vvcdec.c
+++ b/libavcodec/vvc/vvcdec.c
@@ -727,8 +727,8 @@ static void export_frame_params(VVCContext *s, const 
VVCFrameContext *fc)
 c->pix_fmt  = sps->pix_fmt;
 c->coded_width  = pps->width;
 c->coded_height = pps->height;
-c->width= pps->width  - pps->r->pps_conf_win_left_offset - 
pps->r->pps_conf_win_right_offset;
-c->height   = pps->height - pps->r->pps_conf_win_top_offset - 
pps->r->pps_conf_win_bottom_offset;
+c->width= pps->width  - ((pps->r->pps_conf_win_left_offset + 
pps->r->pps_conf_win_right_offset) << sps->hshift[CHROMA]);
+c->height   = pps->height - ((pps->r->pps_conf_win_top_offset + 
pps->r->pps_conf_win_bottom_offset) << sps->vshift[CHROMA]);
 }
 
 static int frame_setup(VVCFrameContext *fc, VVCContext *s)
-- 
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 v2 4/9] fate: make filter-channelsplit test use a fixed frame size

2024-03-07 Thread Marton Balint
Muxing multiple streams to raw files is allowed but the packets are
interleaved, so the output is dependant of packet size.

Signed-off-by: Marton Balint 
---
 tests/fate/filter-audio.mak | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/fate/filter-audio.mak b/tests/fate/filter-audio.mak
index 05df1bb213..5b5d741f06 100644
--- a/tests/fate/filter-audio.mak
+++ b/tests/fate/filter-audio.mak
@@ -306,10 +306,10 @@ fate-filter-channelmap-one-str: REF = 
0ea3052e482c95d5d3bd9da6dac1b5fa
 
 FATE_AFILTER-$(call FILTERDEMDECENCMUX, CHANNELMAP, WAV, PCM_S16LE, PCM_S16LE, 
WAV) += $(FATE_FILTER_CHANNELMAP)
 
-FATE_AFILTER-$(call FILTERDEMDECENCMUX, CHANNELSPLIT, WAV, PCM_S16LE, 
PCM_S16LE, PCM_S16LE) += fate-filter-channelsplit
+FATE_AFILTER-$(call FILTERDEMDECENCMUX, CHANNELSPLIT ASETNSAMPLES, WAV, 
PCM_S16LE, PCM_S16LE, PCM_S16LE) += fate-filter-channelsplit
 fate-filter-channelsplit: SRC = $(TARGET_PATH)/tests/data/asynth-44100-2.wav
 fate-filter-channelsplit: tests/data/asynth-44100-2.wav
-fate-filter-channelsplit: CMD = md5 -auto_conversion_filters -i $(SRC) 
-filter_complex channelsplit -f s16le
+fate-filter-channelsplit: CMD = md5 -auto_conversion_filters -i $(SRC) 
-filter_complex asetnsamples=n=1024:p=0,channelsplit -f s16le
 fate-filter-channelsplit: CMP = oneline
 fate-filter-channelsplit: REF = d92988d0fe2dd92236763f47b07ab597
 
-- 
2.35.3

___
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/9] avformat/daudenc: force 2000 sample packet size with a bsf

2024-03-07 Thread Marton Balint
The samples I found all have 2000 sample packets, and by forcing the packet
size with a bsf we could automagically make muxing work for packets containing
more than 3640 samples.

Signed-off-by: Marton Balint 
---
 configure |  1 +
 doc/muxers.texi   | 16 +---
 libavformat/daudenc.c | 11 +--
 tests/ref/fate/dcinema-encode | 31 +++
 4 files changed, 22 insertions(+), 37 deletions(-)

diff --git a/configure b/configure
index 05f8283af9..525902cf10 100755
--- a/configure
+++ b/configure
@@ -3517,6 +3517,7 @@ caf_demuxer_select="iso_media"
 caf_muxer_select="iso_media"
 dash_muxer_select="mp4_muxer"
 dash_demuxer_deps="libxml2"
+daud_muxer_select="pcm_rechunk_bsf"
 dirac_demuxer_select="dirac_parser"
 dts_demuxer_select="dca_parser"
 dtshd_demuxer_select="dca_parser"
diff --git a/doc/muxers.texi b/doc/muxers.texi
index 2104cc4a95..5b63eec552 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -1387,23 +1387,17 @@ D-Cinema audio muxer.
 It accepts a single 6-channels audio stream resampled at 96000 Hz
 encoded with the @samp{pcm_24daud} codec.
 
-In addition, each muxed packet size must not be greater than 65535 bytes.
-
 @subsection Example
 Use @command{ffmpeg} to mux input audio to a @samp{5.1} channel layout
 resampled at 96000Hz:
 @example
-ffmpeg -i INPUT -af aresample=96000,pan=5.1,asetnsamples=3640 slow.302
-@end example
-
-The @samp{asetnsamples} filter is used to reduce the number of samples
-of each audio packet, with a size computed according to the formula:
-@example
-65535 / (@var{channels} * @var{encoded_sample_size}) = 655535 / (6 * 3) = 3640
+ffmpeg -i INPUT -af aresample=96000,pan=5.1 slow.302
 @end example
 
-The @var{encoded_sample_size} = 3 factor is due to sample size of the
-@samp{pcm_24daud} encoder.
+For ffmpeg versions before 7.0 you might have to use the @samp{asetnsamples}
+filter to limit the muxed packet size, because this format does not support
+muxing packets larger than 65535 bytes (3640 samples). For newer ffmpeg
+versions audio is automatically packetized to 36000 byte (2000 sample) packets.
 
 @section dv
 DV (Digital Video) muxer.
diff --git a/libavformat/daudenc.c b/libavformat/daudenc.c
index 37c20618bd..a995838351 100644
--- a/libavformat/daudenc.c
+++ b/libavformat/daudenc.c
@@ -25,6 +25,7 @@
 static int daud_init(struct AVFormatContext *s)
 {
 AVCodecParameters *par = s->streams[0]->codecpar;
+int ret;
 
 if (par->ch_layout.nb_channels != 6) {
 av_log(s, AV_LOG_ERROR,
@@ -40,17 +41,15 @@ static int daud_init(struct AVFormatContext *s)
 return AVERROR(EINVAL);
 }
 
+ret = ff_stream_add_bitstream_filter(s->streams[0], "pcm_rechunk", 
"n=2000:pad=0");
+if (ret < 0)
+return ret;
+
 return 0;
 }
 
 static int daud_write_packet(struct AVFormatContext *s, AVPacket *pkt)
 {
-if (pkt->size > 65535) {
-av_log(s, AV_LOG_ERROR,
-   "Packet size %d too large for s302m, must be <= 65535.\n",
-   pkt->size);
-return AVERROR_INVALIDDATA;
-}
 avio_wb16(s->pb, pkt->size);
 avio_wb16(s->pb, 0x8010); // unknown
 avio_write(s->pb, pkt->data, pkt->size);
diff --git a/tests/ref/fate/dcinema-encode b/tests/ref/fate/dcinema-encode
index 566d8f5091..8eec68901e 100644
--- a/tests/ref/fate/dcinema-encode
+++ b/tests/ref/fate/dcinema-encode
@@ -7,23 +7,14 @@
 #sample_rate 0: 96000
 #channel_layout_name 0: 5.1(side)
 #stream#, dts,pts, duration, size, hash
-0,  0,  0, 1024,12288, 848250bf0a20e324f60151629134ebd5
-0,   1024,   1024, 1024,12288, cd3c42240d163a7e8835aeda9538f881
-0,   2048,   2048, 1024,12288, f213a268e7ab62b53a4a4acb9b303dfb
-0,   3072,   3072, 1024,12288, 14d4f3289b057394abc995bfea58912a
-0,   4096,   4096, 1024,12288, a69453c3f0c23abfacb49b15aedc432a
-0,   5120,   5120, 1024,12288, 6578b4a89b1fa4c8897b1376974b685d
-0,   6144,   6144, 1024,12288, 4893b62addf1bea4c03c173f173aa082
-0,   7168,   7168, 1024,12288, 992b70ea94c339dfda2d3514ac56c4a9
-0,   8192,   8192, 1024,12288, 543f85139b77d30f8a46fd22d63e3ec7
-0,   9216,   9216, 1024,12288, f52f825a2fe71f66786d5cd08487e271
-0,  10240,  10240, 1024,12288, 50ac352cd73a803f52bfd393e610f83b
-0,  11264,  11264, 1024,12288, e9475a9a8794b9b0b912b855bc05001f
-0,  12288,  12288, 1024,12288, bf205474f44a381583b1f077ab8a9d0c
-0,  13312,  13312, 1024,12288, f5655b1da90d808c7e05b4bda02233ca
-0,  14336,  14336, 1024,12288, f8493bb74a270b50706cace85549c317
-0,  15360,  15360, 1024,12288, c299fbbdcae68c97bca63210f6a1f7da
-0,  16384,  16384, 1024,12288, 2f263932e3d4c419853e3369d70ef8d9
-0,  17408,  17408, 1024,12288, 09862736b8a1a1ce5c8d23814fb054cd

[FFmpeg-devel] [PATCH v2 2/9] avcodec/bsf/pcm_rechunk: add some more supported PCM formats

2024-03-07 Thread Marton Balint
Signed-off-by: Marton Balint 
---
 libavcodec/bsf/pcm_rechunk.c | 20 +++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/libavcodec/bsf/pcm_rechunk.c b/libavcodec/bsf/pcm_rechunk.c
index 423c414d76..b1b57f96a9 100644
--- a/libavcodec/bsf/pcm_rechunk.c
+++ b/libavcodec/bsf/pcm_rechunk.c
@@ -108,6 +108,18 @@ static int get_next_nb_samples(AVBSFContext *ctx)
 }
 }
 
+static void set_silence(AVCodecParameters *par, uint8_t *buf, size_t size)
+{
+int c = 0;
+switch (par->codec_id) {
+case AV_CODEC_ID_PCM_ALAW:  c = 0xd5; break;
+case AV_CODEC_ID_PCM_MULAW:
+case AV_CODEC_ID_PCM_VIDC:  c = 0xff; break;
+case AV_CODEC_ID_PCM_U8:c = 0x80; break;
+}
+memset(buf, c, size);
+}
+
 static int rechunk_filter(AVBSFContext *ctx, AVPacket *pkt)
 {
 PCMContext *s = ctx->priv_data;
@@ -158,7 +170,7 @@ static int rechunk_filter(AVBSFContext *ctx, AVPacket *pkt)
 ret = ff_bsf_get_packet_ref(ctx, s->in_pkt);
 if (ret == AVERROR_EOF && s->out_pkt->size) {
 if (s->pad) {
-memset(s->out_pkt->data + s->out_pkt->size, 0, data_size - 
s->out_pkt->size);
+set_silence(ctx->par_in, s->out_pkt->data + s->out_pkt->size, 
data_size - s->out_pkt->size);
 s->out_pkt->size = data_size;
 } else {
 nb_samples = s->out_pkt->size / s->sample_size;
@@ -193,21 +205,27 @@ static const AVClass pcm_rechunk_class = {
 };
 
 static const enum AVCodecID codec_ids[] = {
+AV_CODEC_ID_PCM_ALAW,
 AV_CODEC_ID_PCM_F16LE,
 AV_CODEC_ID_PCM_F24LE,
 AV_CODEC_ID_PCM_F32BE,
 AV_CODEC_ID_PCM_F32LE,
 AV_CODEC_ID_PCM_F64BE,
 AV_CODEC_ID_PCM_F64LE,
+AV_CODEC_ID_PCM_MULAW,
 AV_CODEC_ID_PCM_S16BE,
 AV_CODEC_ID_PCM_S16LE,
 AV_CODEC_ID_PCM_S24BE,
+AV_CODEC_ID_PCM_S24DAUD,
 AV_CODEC_ID_PCM_S24LE,
 AV_CODEC_ID_PCM_S32BE,
 AV_CODEC_ID_PCM_S32LE,
 AV_CODEC_ID_PCM_S64BE,
 AV_CODEC_ID_PCM_S64LE,
 AV_CODEC_ID_PCM_S8,
+AV_CODEC_ID_PCM_SGA,
+AV_CODEC_ID_PCM_U8,
+AV_CODEC_ID_PCM_VIDC,
 AV_CODEC_ID_NONE,
 };
 
-- 
2.35.3

___
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/9] avcodec/bsf/pcm_rechunk: reorder supported codec list

2024-03-07 Thread Marton Balint
Use lexical order.

Signed-off-by: Marton Balint 
---
 libavcodec/bsf/pcm_rechunk.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/libavcodec/bsf/pcm_rechunk.c b/libavcodec/bsf/pcm_rechunk.c
index 28b5722ac9..423c414d76 100644
--- a/libavcodec/bsf/pcm_rechunk.c
+++ b/libavcodec/bsf/pcm_rechunk.c
@@ -193,21 +193,21 @@ static const AVClass pcm_rechunk_class = {
 };
 
 static const enum AVCodecID codec_ids[] = {
-AV_CODEC_ID_PCM_S16LE,
-AV_CODEC_ID_PCM_S16BE,
-AV_CODEC_ID_PCM_S8,
-AV_CODEC_ID_PCM_S32LE,
-AV_CODEC_ID_PCM_S32BE,
-AV_CODEC_ID_PCM_S24LE,
-AV_CODEC_ID_PCM_S24BE,
+AV_CODEC_ID_PCM_F16LE,
+AV_CODEC_ID_PCM_F24LE,
 AV_CODEC_ID_PCM_F32BE,
 AV_CODEC_ID_PCM_F32LE,
 AV_CODEC_ID_PCM_F64BE,
 AV_CODEC_ID_PCM_F64LE,
-AV_CODEC_ID_PCM_S64LE,
+AV_CODEC_ID_PCM_S16BE,
+AV_CODEC_ID_PCM_S16LE,
+AV_CODEC_ID_PCM_S24BE,
+AV_CODEC_ID_PCM_S24LE,
+AV_CODEC_ID_PCM_S32BE,
+AV_CODEC_ID_PCM_S32LE,
 AV_CODEC_ID_PCM_S64BE,
-AV_CODEC_ID_PCM_F16LE,
-AV_CODEC_ID_PCM_F24LE,
+AV_CODEC_ID_PCM_S64LE,
+AV_CODEC_ID_PCM_S8,
 AV_CODEC_ID_NONE,
 };
 
-- 
2.35.3

___
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/xbmenc: Avoid snprintf() for data->hex conversion

2024-03-07 Thread Marton Balint




On Fri, 8 Mar 2024, Andreas Rheinhardt wrote:


Andreas Rheinhardt:

Use a small LUT instead. Improves performance.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/xbmenc.c | 21 +++--
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/libavcodec/xbmenc.c b/libavcodec/xbmenc.c
index cd8b73afa3..5231d4691d 100644
--- a/libavcodec/xbmenc.c
+++ b/libavcodec/xbmenc.c
@@ -20,11 +20,9 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */

-#include "libavutil/reverse.h"
 #include "avcodec.h"
 #include "codec_internal.h"
 #include "encode.h"
-#include "mathops.h"

 #define ANSI_MIN_READLINE 509

@@ -57,14 +55,25 @@ static int xbm_encode_frame(AVCodecContext *avctx, AVPacket 
*pkt,
 buf += snprintf(buf, 39, "static unsigned char image_bits[] = {\n");
 for (i = 0, l = lineout; i < avctx->height; i++) {
 for (j = 0; j < linesize; j++) {
-buf += snprintf(buf, 6, " 0x%02X", ff_reverse[*ptr++]);
+// 0..15 bitreversed as chars
+static const char lut[] = {
+'0', '8', '4', 'C', '2', 'A', '6', 'E',
+'1', '9', '5', 'D', '3', 'B', '7', 'F'
+};
+buf[0] = ' ';
+buf[1] = '0';
+buf[2] = 'x';
+buf[3] = lut[*ptr & 0xF];
+buf[4] = lut[*ptr >> 4];


Maybe you could use *buf++ = ... here as well, to avoid the next line. But 
fine either way I guess.


Thanks,
Marton


+buf += 5;
+ptr++;
 if (--commas <= 0) {
-buf += snprintf(buf, 2, "\n");
+*buf++ = '\n';
 break;
 }
-buf += snprintf(buf, 2, ",");
+*buf++ = ',';
 if (--l <= 0) {
-buf += snprintf(buf, 2, "\n");
+*buf++ = '\n';
 l = lineout;
 }
 }


Will apply this patch tomorrow unless there are objections.

- Andreas

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

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


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

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


Re: [FFmpeg-devel] [PATCH 2/2] lavc/vc1dsp: R-V V mspel_pixels

2024-03-07 Thread flow gg
> Isn't it also faster to max LMUL for the adds here?

It requires the use of one more vset, making the time slightly longer:
147.7 (m1), 148.7 (m8 + vset).

Also this might not be much noticeable on C908, but avoiding sequential
dependencies on the address registers may help. I mean, avoid using as
address
operand a value that was calculated by the immediate previous instruction.

> Okay, but the test results haven't changed..
It would add more than ten lines of code, perhaps shorter code will better?

Rémi Denis-Courmont  于2024年3月8日周五 02:55写道:

> Le lauantaina 2. maaliskuuta 2024, 14.06.13 EET flow gg a écrit :
> > Here adjusting the order, rather than simply using .rept, will be 13%-24%
> > faster.
>
> Isn't it also faster to max LMUL for the adds here?
>
> Also this might not be much noticeable on C908, but avoiding sequential
> dependencies on the address registers may help. I mean, avoid using as
> address
> operand a value that was calculated by the immediate previous instruction.
>
> --
> Rémi Denis-Courmont
> http://www.remlab.net/
>
>
>
> ___
> 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] avformat/tests/movenc: Constify write functions

2024-03-07 Thread Andreas Rheinhardt
Forgotten in 2a68d945cd74265bb71c3d38b7a2e7f7d7e87be5.

Signed-off-by: Andreas Rheinhardt 
---
Sorry for this. Will apply this soon to fix FATE.

 libavformat/tests/movenc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/tests/movenc.c b/libavformat/tests/movenc.c
index fca3213285..1ec9b6729b 100644
--- a/libavformat/tests/movenc.c
+++ b/libavformat/tests/movenc.c
@@ -96,7 +96,7 @@ static void reset_count_warnings(void)
 av_log_set_callback(av_log_default_callback);
 }
 
-static int io_write(void *opaque, uint8_t *buf, int size)
+static int io_write(void *opaque, const uint8_t *buf, int size)
 {
 out_size += size;
 av_md5_update(md5, buf, size);
@@ -105,7 +105,7 @@ static int io_write(void *opaque, uint8_t *buf, int size)
 return size;
 }
 
-static int io_write_data_type(void *opaque, uint8_t *buf, int size,
+static int io_write_data_type(void *opaque, const uint8_t *buf, int size,
   enum AVIODataMarkerType type, int64_t time)
 {
 char timebuf[30], content[5] = { 0 };
-- 
2.40.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] avcodec/xpmdec: Avoid unnecessary size_t->int conversion

2024-03-07 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/xpmdec.c | 7 +++
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/xpmdec.c b/libavcodec/xpmdec.c
> index 5bc02378c8..e7f8a90fdc 100644
> --- a/libavcodec/xpmdec.c
> +++ b/libavcodec/xpmdec.c
> @@ -233,14 +233,12 @@ static size_t mod_strcspn(const char *string, const 
> char *reject)
>  return i;
>  }
>  
> -static uint32_t color_string_to_rgba(const char *p, int len)
> +static uint32_t color_string_to_rgba(const char *p, size_t len)
>  {
>  uint32_t ret = 0xFF00;
>  const ColorEntry *entry;
>  char color_name[100];
>  
> -len = FFMIN(FFMAX(len, 0), sizeof(color_name) - 1);
> -
>  if (*p == '#') {
>  p++;
>  len--;
> @@ -271,6 +269,7 @@ static uint32_t color_string_to_rgba(const char *p, int 
> len)
> (hex_char_to_number(p[0]) << 28);
>  }
>  } else {
> +len = FFMIN(len, sizeof(color_name) - 1);
>  strncpy(color_name, p, len);
>  color_name[len] = '\0';
>  
> @@ -375,7 +374,7 @@ static int xpm_decode_frame(AVCodecContext *avctx, 
> AVFrame *p,
>  
>  for (i = 0; i < ncolors; i++) {
>  const uint8_t *index;
> -int len;
> +size_t len;
>  
>  ptr += mod_strcspn(ptr, "\"") + 1;
>  if (end - ptr < cpp)

Will apply this patch tomorrow unless there are objections.

- Andreas

___
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/xbmenc: Avoid snprintf() for data->hex conversion

2024-03-07 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> Use a small LUT instead. Improves performance.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/xbmenc.c | 21 +++--
>  1 file changed, 15 insertions(+), 6 deletions(-)
> 
> diff --git a/libavcodec/xbmenc.c b/libavcodec/xbmenc.c
> index cd8b73afa3..5231d4691d 100644
> --- a/libavcodec/xbmenc.c
> +++ b/libavcodec/xbmenc.c
> @@ -20,11 +20,9 @@
>   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
>   */
>  
> -#include "libavutil/reverse.h"
>  #include "avcodec.h"
>  #include "codec_internal.h"
>  #include "encode.h"
> -#include "mathops.h"
>  
>  #define ANSI_MIN_READLINE 509
>  
> @@ -57,14 +55,25 @@ static int xbm_encode_frame(AVCodecContext *avctx, 
> AVPacket *pkt,
>  buf += snprintf(buf, 39, "static unsigned char image_bits[] = {\n");
>  for (i = 0, l = lineout; i < avctx->height; i++) {
>  for (j = 0; j < linesize; j++) {
> -buf += snprintf(buf, 6, " 0x%02X", ff_reverse[*ptr++]);
> +// 0..15 bitreversed as chars
> +static const char lut[] = {
> +'0', '8', '4', 'C', '2', 'A', '6', 'E',
> +'1', '9', '5', 'D', '3', 'B', '7', 'F'
> +};
> +buf[0] = ' ';
> +buf[1] = '0';
> +buf[2] = 'x';
> +buf[3] = lut[*ptr & 0xF];
> +buf[4] = lut[*ptr >> 4];
> +buf += 5;
> +ptr++;
>  if (--commas <= 0) {
> -buf += snprintf(buf, 2, "\n");
> +*buf++ = '\n';
>  break;
>  }
> -buf += snprintf(buf, 2, ",");
> +*buf++ = ',';
>  if (--l <= 0) {
> -buf += snprintf(buf, 2, "\n");
> +*buf++ = '\n';
>  l = lineout;
>  }
>  }

Will apply this patch tomorrow unless there are objections.

- Andreas

___
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 29/29] tests/fate/matroska: add tests for side data preference

2024-03-07 Thread Andreas Rheinhardt
From: Anton Khirnov 

Cf. #10857
---
Updated in light of the updated sample.

 tests/fate/matroska.mak   |   6 +
 tests/ref/fate/matroska-side-data-pref-codec  | 348 ++
 tests/ref/fate/matroska-side-data-pref-global | 348 ++
 3 files changed, 702 insertions(+)
 create mode 100644 tests/ref/fate/matroska-side-data-pref-codec
 create mode 100644 tests/ref/fate/matroska-side-data-pref-global

diff --git a/tests/fate/matroska.mak b/tests/fate/matroska.mak
index 9ab747184a..751ab55fe1 100644
--- a/tests/fate/matroska.mak
+++ b/tests/fate/matroska.mak
@@ -264,6 +264,12 @@ FATE_MATROSKA_FFMPEG_FFPROBE-$(call REMUX, MATROSKA, 
VP9_PARSER) \
+= fate-matroska-hdr10-plus-remux
 fate-matroska-hdr10-plus-remux: CMD = transcode webm 
$(TARGET_SAMPLES)/mkv/hdr10_plus_vp9_sample.webm matroska "-map 0 -c:v copy" 
"-map 0 -c:v copy" "-show_packets"
 
+fate-matroska-side-data-pref-codec: CMD = run ffprobe$(PROGSSUF)$(EXESUF) 
$(TARGET_SAMPLES)/mkv/hdr10tags-both.mkv \
+-select_streams v:0 -show_streams -show_frames -show_entries 
stream=stream_side_data:frame=frame_side_data_list
+fate-matroska-side-data-pref-global: CMD = run ffprobe$(PROGSSUF)$(EXESUF) 
$(TARGET_SAMPLES)/mkv/hdr10tags-both.mkv \
+-select_streams v:0 -show_streams -show_frames -show_entries 
stream=stream_side_data:frame=frame_side_data_list -side_data_prefer_global 
mastering_display_metadata,content_light_level
+FATE_MATROSKA_FFPROBE-$(call ALLYES MATROSKA_DEMUXER HEVC_DECODER) += 
fate-matroska-side-data-pref-codec fate-matroska-side-data-pref-global
+
 FATE_SAMPLES_AVCONV += $(FATE_MATROSKA-yes)
 FATE_SAMPLES_FFPROBE += $(FATE_MATROSKA_FFPROBE-yes)
 FATE_SAMPLES_FFMPEG_FFPROBE += $(FATE_MATROSKA_FFMPEG_FFPROBE-yes)
diff --git a/tests/ref/fate/matroska-side-data-pref-codec 
b/tests/ref/fate/matroska-side-data-pref-codec
new file mode 100644
index 00..128ecdd423
--- /dev/null
+++ b/tests/ref/fate/matroska-side-data-pref-codec
@@ -0,0 +1,348 @@
+[FRAME]
+[SIDE_DATA]
+side_data_type=3x3 displaymatrix
+displaymatrix=
+:0   65536   0
+0001:65536   0   0
+0002:0   0  1073741824
+
+rotation=-90
+[/SIDE_DATA]
+[SIDE_DATA]
+side_data_type=H.26[45] User Data Unregistered SEI message
+[/SIDE_DATA]
+[SIDE_DATA]
+side_data_type=Content light level metadata
+max_content=1000
+max_average=300
+[/SIDE_DATA]
+[SIDE_DATA]
+side_data_type=Mastering display metadata
+red_x=35400/5
+red_y=14599/5
+green_x=8500/5
+green_y=39850/5
+blue_x=6550/5
+blue_y=2300/5
+white_point_x=15634/5
+white_point_y=16450/5
+min_luminance=10/1
+max_luminance=1000/1
+[/SIDE_DATA]
+[/FRAME]
+[FRAME]
+[SIDE_DATA]
+side_data_type=3x3 displaymatrix
+displaymatrix=
+:0   65536   0
+0001:65536   0   0
+0002:0   0  1073741824
+
+rotation=-90
+[/SIDE_DATA]
+[SIDE_DATA]
+side_data_type=Content light level metadata
+max_content=1000
+max_average=300
+[/SIDE_DATA]
+[SIDE_DATA]
+side_data_type=Mastering display metadata
+red_x=35400/5
+red_y=14599/5
+green_x=8500/5
+green_y=39850/5
+blue_x=6550/5
+blue_y=2300/5
+white_point_x=15634/5
+white_point_y=16450/5
+min_luminance=10/1
+max_luminance=1000/1
+[/SIDE_DATA]
+[/FRAME]
+[FRAME]
+[SIDE_DATA]
+side_data_type=3x3 displaymatrix
+displaymatrix=
+:0   65536   0
+0001:65536   0   0
+0002:0   0  1073741824
+
+rotation=-90
+[/SIDE_DATA]
+[SIDE_DATA]
+side_data_type=Content light level metadata
+max_content=1000
+max_average=300
+[/SIDE_DATA]
+[SIDE_DATA]
+side_data_type=Mastering display metadata
+red_x=35400/5
+red_y=14599/5
+green_x=8500/5
+green_y=39850/5
+blue_x=6550/5
+blue_y=2300/5
+white_point_x=15634/5
+white_point_y=16450/5
+min_luminance=10/1
+max_luminance=1000/1
+[/SIDE_DATA]
+[/FRAME]
+[FRAME]
+[SIDE_DATA]
+side_data_type=3x3 displaymatrix
+displaymatrix=
+:0   65536   0
+0001:65536   0   0
+0002:0   0  1073741824
+
+rotation=-90
+[/SIDE_DATA]
+[SIDE_DATA]
+side_data_type=Content light level metadata
+max_content=1000
+max_average=300
+[/SIDE_DATA]
+[SIDE_DATA]
+side_data_type=Mastering display metadata
+red_x=35400/5
+red_y=14599/5
+green_x=8500/5
+green_y=39850/5
+blue_x=6550/5
+blue_y=2300/5
+white_point_x=15634/5
+white_point_y=16450/5
+min_luminance=10/1
+max_luminance=1000/1
+[/SIDE_DATA]
+[/FRAME]
+[FRAME]
+[SIDE_DATA]
+side_data_type=3x3 displaymatrix
+displaymatrix=
+:0   65536   0
+0001:65536   0   0
+0002:0   0  1073741824
+
+rotation=-90
+[/SIDE_DATA]

[FFmpeg-devel] [PATCH] af_tempo.c: fix checking of samples and zero frame counts

2024-03-07 Thread Rajiv Harlalka
Check for zeros equal to the total samples early, because in case the 
check is true we would already be leaving the first few frames out.


Signed-off-by: Rajiv Harlalka 
#10692
---
 libavfilter/af_atempo.c | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/libavfilter/af_atempo.c b/libavfilter/af_atempo.c
index 4621b67b03..8f31c5beaf 100644
--- a/libavfilter/af_atempo.c
+++ b/libavfilter/af_atempo.c
@@ -531,21 +531,20 @@ static int yae_load_frag(ATempoContext *atempo,
 dst = frag->data;
  start = atempo->position[0] - atempo->size;
-zeros = 0;
+// what we don't have we substitute with zeros:
+zeros = frag->position[0] < start ? FFMIN(start - 
frag->position[0], (int64_t)nsamples) : 0;

+
+if (zeros == nsamples) {
+return 0;
+}
  if (frag->position[0] < start) {
-// what we don't have we substitute with zeros:
-zeros = FFMIN(start - frag->position[0], (int64_t)nsamples);
 av_assert0(zeros != nsamples);
  memset(dst, 0, zeros * atempo->stride);
 dst += zeros * atempo->stride;
 }
 -if (zeros == nsamples) {
-return 0;
-}
-
 // get the remaining data from the ring buffer:
 na = (atempo->head < atempo->tail ?
   atempo->tail - atempo->head :
--
2.44.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] af_tempo.c: fix checking of samples and zero frame counts

2024-03-07 Thread Rajiv Harlalka
Check for zeros equal to the total samples early, because in case the check
is true we would already be leaving the first few frames out.

Signed-off-by: Rajiv Harlalka 
#10692
---
libavfilter/af_atempo.c | 13 ++---
1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/libavfilter/af_atempo.c b/libavfilter/af_atempo.c
index 4621b67b03..8f31c5beaf 100644
--- a/libavfilter/af_atempo.c
+++ b/libavfilter/af_atempo.c
@@ -531,21 +531,20 @@ static int yae_load_frag(ATempoContext *atempo,
dst = frag->data;
start = atempo->position[0] - atempo->size;
- zeros = 0;
+ // what we don't have we substitute with zeros:
+ zeros = frag->position[0] < start ? FFMIN(start - frag->position[0],
(int64_t)nsamples) : 0;
+
+ if (zeros == nsamples) {
+ return 0;
+ }
if (frag->position[0] < start) {
- // what we don't have we substitute with zeros:
- zeros = FFMIN(start - frag->position[0], (int64_t)nsamples);
av_assert0(zeros != nsamples);
memset(dst, 0, zeros * atempo->stride);
dst += zeros * atempo->stride;
}
- if (zeros == nsamples) {
- return 0;
- }
-
// get the remaining data from the ring buffer:
na = (atempo->head < atempo->tail ?
atempo->tail - atempo->head :
-- 
2.44.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 which requires a new library

2024-03-07 Thread Kieran Kunhya
On Thu, 7 Mar 2024, 20:16 Sergio Garcia Murillo, <
sergio.garcia.muri...@gmail.com> wrote:

> On Thu, Mar 7, 2024 at 7:02 PM Rémi Denis-Courmont 
> wrote:
>
> > Le torstaina 7. maaliskuuta 2024, 19.30.46 EET Sergio Garcia Murillo a
> > écrit :
> > > > The point is we don't want to use the external lib.
> > >
> > > For what? This is aws lib implementing the aws s3 signatures and using
> > > ffmpeg crypto libs.
> >
> > For not depending on an external library, especially one so small and so
> > specific that it is very unlikely to be shipped by the vast majority of
> > FFmpeg's downstreams.
> >
>
> That seems fair enough, however the downside is that sigv4 lib is supported
> and maintained by aws and it has a proper testing suite.
>

As with all these "SDKs", they are supported until the vendor gets bored
and/or the developers leave or get promoted.

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

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


Re: [FFmpeg-devel] [PATCH 02/18] fftools/ffmpeg_filter: refactor setting input timebase

2024-03-07 Thread Michael Niedermayer
On Wed, Mar 06, 2024 at 12:03:03PM +0100, Anton Khirnov wrote:
> Treat it analogously to stream parameters like format/dimensions/etc.
> This is functionally different from previous code in 2 ways:
> * for non-CFR video, the frame timebase (set by the decoder) is used
>   rather than the demuxer timebase
> * for sub2video, AV_TIME_BASE_Q is used, which is hardcoded by the
>   subtitle decoding API
> 
> These changes should avoid unnecessary and potentially lossy timestamp
> conversions from decoder timebase into the demuxer one.
> 
> Changes the timebases used in sub2video tests.
> ---
>  fftools/ffmpeg_filter.c   |  17 ++-
>  tests/ref/fate/sub2video_basic| 182 +-
>  tests/ref/fate/sub2video_time_limited |   8 +-
>  3 files changed, 106 insertions(+), 101 deletions(-)

breaks:

./ffmpeg -i 
\[a-s\]_full_metal_panic_fumoffu_-_01_-_the_man_from_the_south_-_a_hostage_with_no_compromises__rs2_\[1080p_bd-rip\]\[BBB48A25\].mkv
  -filter_complex '[0:s:1]scale=800:600' -t 15 -qscale 2 -y a.avi

Press [q] to stop, [?] for help
[aac @ 0x561991f96340] This stream seems to incorrectly report its last channel 
as LFE[3], mapping to LFE[0]
[mpeg4 @ 0x561991f7e440] timebase 1/100 not supported by MPEG 4 standard, 
the maximum admitted value for the timebase denominator is 65535
[vost#0:0/mpeg4 @ 0x561991f78f80] Error while opening encoder - maybe incorrect 
parameters such as bit_rate, rate, width or height.
[fc#0 @ 0x561991f4b9c0] Error sending frames to consumers: Invalid argument
[fc#0 @ 0x561991f4b9c0] Task finished with error code: -22 (Invalid argument)
[fc#0 @ 0x561991f4b9c0] Terminating thread with return code -22 (Invalid 
argument)
[vost#0:0/mpeg4 @ 0x561991f78f80] Could not open encoder before EOF
[vost#0:0/mpeg4 @ 0x561991f78f80] Task finished with error code: -22 (Invalid 
argument)
[vost#0:0/mpeg4 @ 0x561991f78f80] Terminating thread with return code -22 
(Invalid argument)
[libmp3lame @ 0x561992064180] Trying to remove 1152 samples, but the queue is 
empty
[out#0/avi @ 0x561991f98bc0] Nothing was written into output file, because at 
least one of its streams received no packets.
frame=0 fps=0.0 q=0.0 Lsize=   0KiB time=N/A bitrate=N/A speed=N/A
Conversion failed!

ill try to find a smaller testcase

thx


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Elect your leaders based on what they did after the last election, not
based on what they say before an election.



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 which requires a new library

2024-03-07 Thread Sergio Garcia Murillo
On Thu, Mar 7, 2024 at 7:02 PM Rémi Denis-Courmont  wrote:

> Le torstaina 7. maaliskuuta 2024, 19.30.46 EET Sergio Garcia Murillo a
> écrit :
> > > The point is we don't want to use the external lib.
> >
> > For what? This is aws lib implementing the aws s3 signatures and using
> > ffmpeg crypto libs.
>
> For not depending on an external library, especially one so small and so
> specific that it is very unlikely to be shipped by the vast majority of
> FFmpeg's downstreams.
>

That seems fair enough, however the downside is that sigv4 lib is supported
and maintained by aws and it has a proper testing suite.


> (sigv4 is just three thousand lines of C, and most of that is just
> boilerplate.)
>

Would it be then acceptable to just copy/paste the library code (with
ffmpeg coding style formatting) referencing the original library url in the
code?
Also, where should we include the sigv4 code, would libautil be the correct
place?

Best regards
Sergio
___
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/3] avcodec/dovi_rpu: implement support for profile 10

2024-03-07 Thread Niklas Haas
Will merge tomorrow without further comments.
___
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 23/29] avcodec/mpeg12dec: use ff_frame_new_side_data

2024-03-07 Thread Niklas Haas
On Tue, 05 Mar 2024 11:00:02 +0100 Anton Khirnov  wrote:
> I prefer consistency here, otherwise the decoder authors have to choose
> which function to use, and they are often not aware of the precise
> implications of thise choice. Better to always use just one function.

Regardless of my personal preference, these (consistency) patches are
strictly optional and do not gain us any functionality. Given that this
is blocking the (by now fairly urgent) 7.0 release, I am in favor of
dropping them if that helps speed the process along by avoiding
unnecessary discussion where it is not of high priority.

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

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


Re: [FFmpeg-devel] [PATCH 2/2] lavc/vc1dsp: R-V V mspel_pixels

2024-03-07 Thread Rémi Denis-Courmont
Le lauantaina 2. maaliskuuta 2024, 14.06.13 EET flow gg a écrit :
> Here adjusting the order, rather than simply using .rept, will be 13%-24%
> faster.

Isn't it also faster to max LMUL for the adds here?

Also this might not be much noticeable on C908, but avoiding sequential 
dependencies on the address registers may help. I mean, avoid using as address 
operand a value that was calculated by the immediate previous instruction.

-- 
Rémi Denis-Courmont
http://www.remlab.net/



___
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 which requires a new library

2024-03-07 Thread Rémi Denis-Courmont
Le torstaina 7. maaliskuuta 2024, 19.30.46 EET Sergio Garcia Murillo a écrit :
> > The point is we don't want to use the external lib.
> 
> For what? This is aws lib implementing the aws s3 signatures and using
> ffmpeg crypto libs.

For not depending on an external library, especially one so small and so 
specific that it is very unlikely to be shipped by the vast majority of 
FFmpeg's downstreams.

(sigv4 is just three thousand lines of C, and most of that is just 
boilerplate.)

-- 
Rémi Denis-Courmont
http://www.remlab.net/



___
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 v2] fftools/ffprobe: export Tile Grid Stream Group parameters

2024-03-07 Thread James Almer

On 3/7/2024 1:46 PM, Stefano Sabatini wrote:

On date Thursday 2024-03-07 17:17:06 +0100, Stefano Sabatini wrote:

On date Wednesday 2024-03-06 21:49:51 -0300, James Almer wrote:

Signed-off-by: James Almer 
---
  fftools/ffprobe.c | 53 ---
  tests/fate/mov.mak|  6 +--
  .../ref/fate/mov-heic-demux-still-image-grid  | 29 ++
  .../ref/fate/mov-heic-demux-still-image-iovl  | 19 +++
  .../fate/mov-heic-demux-still-image-iovl-2| 19 +++
  5 files changed, 115 insertions(+), 11 deletions(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 4d4a85b5b0..c2ed8336f9 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -113,6 +113,7 @@ static int do_show_frames  = 0;
  static int do_show_packets = 0;
  static int do_show_programs = 0;
  static int do_show_stream_groups = 0;
+static int do_show_stream_group_components = 0;
  static int do_show_streams = 0;
  static int do_show_stream_disposition = 0;
  static int do_show_stream_group_disposition = 0;
@@ -209,6 +210,10 @@ typedef enum {
  SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION,
  SECTION_ID_STREAM_GROUP_STREAM_TAGS,
  SECTION_ID_STREAM_GROUP,
+SECTION_ID_STREAM_GROUP_COMPONENTS,
+SECTION_ID_STREAM_GROUP_COMPONENT,
+SECTION_ID_STREAM_GROUP_SUB_COMPONENTS,
+SECTION_ID_STREAM_GROUP_SUB_COMPONENT,
  SECTION_ID_STREAM_GROUP_STREAMS,
  SECTION_ID_STREAM_GROUP_STREAM,
  SECTION_ID_STREAM_GROUP_DISPOSITION,
@@ -309,7 +314,11 @@ static struct section sections[] = {
  [SECTION_ID_PROGRAMS] =   { SECTION_ID_PROGRAMS, 
"programs", SECTION_FLAG_IS_ARRAY, { SECTION_ID_PROGRAM, -1 } },
  [SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION] = { SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION, 
"disposition", 0, { -1 }, .unique_name = "stream_group_stream_disposition" },
  [SECTION_ID_STREAM_GROUP_STREAM_TAGS] ={ SECTION_ID_STREAM_GROUP_STREAM_TAGS, "tags", 
SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = 
"stream_group_stream_tags" },
-[SECTION_ID_STREAM_GROUP] ={ SECTION_ID_STREAM_GROUP, 
"stream_group", SECTION_FLAG_HAS_TYPE, { SECTION_ID_STREAM_GROUP_TAGS, 
SECTION_ID_STREAM_GROUP_DISPOSITION, SECTION_ID_STREAM_GROUP_STREAMS, -1 }, .get_type = 
get_stream_group_type },
+[SECTION_ID_STREAM_GROUP] ={ SECTION_ID_STREAM_GROUP, 
"stream_group", 0, { SECTION_ID_STREAM_GROUP_TAGS, 
SECTION_ID_STREAM_GROUP_DISPOSITION, SECTION_ID_STREAM_GROUP_COMPONENTS, 
SECTION_ID_STREAM_GROUP_STREAMS, -1 } },
+[SECTION_ID_STREAM_GROUP_COMPONENTS] = { SECTION_ID_STREAM_GROUP_COMPONENTS, 
"components", SECTION_FLAG_IS_ARRAY, { SECTION_ID_STREAM_GROUP_COMPONENT, -1 }, .element_name = 
"component", .unique_name = "stream_group_components" },
+[SECTION_ID_STREAM_GROUP_COMPONENT] =  { SECTION_ID_STREAM_GROUP_COMPONENT, 
"component", SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { 
SECTION_ID_STREAM_GROUP_SUB_COMPONENTS, -1 }, .unique_name = "stream_group_component", 
.element_name = "component_entry", .get_type = get_stream_group_type },



+[SECTION_ID_STREAM_GROUP_SUB_COMPONENTS] = { SECTION_ID_STREAM_GROUP_SUB_COMPONENTS, 
"subcomponents", SECTION_FLAG_IS_ARRAY, { SECTION_ID_STREAM_GROUP_SUB_COMPONENT, -1 }, 
.element_name = "component" },
+[SECTION_ID_STREAM_GROUP_SUB_COMPONENT] =  { SECTION_ID_STREAM_GROUP_SUB_COMPONENT, 
"subcomponent", SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { -1 }, 
.element_name = "sub_component_entry", .get_type = get_raw_string_type },


consistency: subcomponent or sub_component (probably I'd go with
SUBCOMPONENT/subcomponent everywhere).


also, missing ffprobe.xsd update?


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 1/2 v2] fftools/ffprobe: export Tile Grid Stream Group parameters

2024-03-07 Thread James Almer

On 3/7/2024 1:17 PM, Stefano Sabatini wrote:

On date Wednesday 2024-03-06 21:49:51 -0300, James Almer wrote:

Signed-off-by: James Almer 
---
  fftools/ffprobe.c | 53 ---
  tests/fate/mov.mak|  6 +--
  .../ref/fate/mov-heic-demux-still-image-grid  | 29 ++
  .../ref/fate/mov-heic-demux-still-image-iovl  | 19 +++
  .../fate/mov-heic-demux-still-image-iovl-2| 19 +++
  5 files changed, 115 insertions(+), 11 deletions(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 4d4a85b5b0..c2ed8336f9 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -113,6 +113,7 @@ static int do_show_frames  = 0;
  static int do_show_packets = 0;
  static int do_show_programs = 0;
  static int do_show_stream_groups = 0;
+static int do_show_stream_group_components = 0;
  static int do_show_streams = 0;
  static int do_show_stream_disposition = 0;
  static int do_show_stream_group_disposition = 0;
@@ -209,6 +210,10 @@ typedef enum {
  SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION,
  SECTION_ID_STREAM_GROUP_STREAM_TAGS,
  SECTION_ID_STREAM_GROUP,
+SECTION_ID_STREAM_GROUP_COMPONENTS,
+SECTION_ID_STREAM_GROUP_COMPONENT,
+SECTION_ID_STREAM_GROUP_SUB_COMPONENTS,
+SECTION_ID_STREAM_GROUP_SUB_COMPONENT,
  SECTION_ID_STREAM_GROUP_STREAMS,
  SECTION_ID_STREAM_GROUP_STREAM,
  SECTION_ID_STREAM_GROUP_DISPOSITION,
@@ -309,7 +314,11 @@ static struct section sections[] = {
  [SECTION_ID_PROGRAMS] =   { SECTION_ID_PROGRAMS, 
"programs", SECTION_FLAG_IS_ARRAY, { SECTION_ID_PROGRAM, -1 } },
  [SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION] = { SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION, 
"disposition", 0, { -1 }, .unique_name = "stream_group_stream_disposition" },
  [SECTION_ID_STREAM_GROUP_STREAM_TAGS] ={ SECTION_ID_STREAM_GROUP_STREAM_TAGS, "tags", 
SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = 
"stream_group_stream_tags" },
-[SECTION_ID_STREAM_GROUP] ={ SECTION_ID_STREAM_GROUP, 
"stream_group", SECTION_FLAG_HAS_TYPE, { SECTION_ID_STREAM_GROUP_TAGS, 
SECTION_ID_STREAM_GROUP_DISPOSITION, SECTION_ID_STREAM_GROUP_STREAMS, -1 }, .get_type = 
get_stream_group_type },
+[SECTION_ID_STREAM_GROUP] ={ SECTION_ID_STREAM_GROUP, 
"stream_group", 0, { SECTION_ID_STREAM_GROUP_TAGS, 
SECTION_ID_STREAM_GROUP_DISPOSITION, SECTION_ID_STREAM_GROUP_COMPONENTS, 
SECTION_ID_STREAM_GROUP_STREAMS, -1 } },
+[SECTION_ID_STREAM_GROUP_COMPONENTS] = { SECTION_ID_STREAM_GROUP_COMPONENTS, 
"components", SECTION_FLAG_IS_ARRAY, { SECTION_ID_STREAM_GROUP_COMPONENT, -1 }, .element_name = 
"component", .unique_name = "stream_group_components" },
+[SECTION_ID_STREAM_GROUP_COMPONENT] =  { SECTION_ID_STREAM_GROUP_COMPONENT, 
"component", SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { 
SECTION_ID_STREAM_GROUP_SUB_COMPONENTS, -1 }, .unique_name = "stream_group_component", 
.element_name = "component_entry", .get_type = get_stream_group_type },



+[SECTION_ID_STREAM_GROUP_SUB_COMPONENTS] = { SECTION_ID_STREAM_GROUP_SUB_COMPONENTS, 
"subcomponents", SECTION_FLAG_IS_ARRAY, { SECTION_ID_STREAM_GROUP_SUB_COMPONENT, -1 }, 
.element_name = "component" },
+[SECTION_ID_STREAM_GROUP_SUB_COMPONENT] =  { SECTION_ID_STREAM_GROUP_SUB_COMPONENT, 
"subcomponent", SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { -1 }, 
.element_name = "sub_component_entry", .get_type = get_raw_string_type },


consistency: subcomponent or sub_component (probably I'd go with
SUBCOMPONENT/subcomponent everywhere).


Ok.




  [SECTION_ID_STREAM_GROUP_STREAMS] ={ SECTION_ID_STREAM_GROUP_STREAMS, 
"streams", SECTION_FLAG_IS_ARRAY, { SECTION_ID_STREAM_GROUP_STREAM, -1 }, .unique_name = 
"stream_group_streams" },
  [SECTION_ID_STREAM_GROUP_STREAM] = { SECTION_ID_STREAM_GROUP_STREAM, 
"stream", 0, { SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION, 
SECTION_ID_STREAM_GROUP_STREAM_TAGS, -1 }, .unique_name = "stream_group_stream" },
  [SECTION_ID_STREAM_GROUP_DISPOSITION] ={ SECTION_ID_STREAM_GROUP_DISPOSITION, 
"disposition", 0, { -1 }, .unique_name = "stream_group_disposition" },
@@ -3385,13 +3394,35 @@ static int show_programs(WriterContext *w, InputFile 
*ifile)
  return ret;
  }
  
+static void print_tile_grid_params(WriterContext *w, const AVStreamGroup *stg,

+   const AVStreamGroupTileGrid *tile_grid)
+{
+writer_print_section_header(w, stg, SECTION_ID_STREAM_GROUP_COMPONENT);
+print_int("nb_tiles",  tile_grid->nb_tiles);
+print_int("coded_width",   tile_grid->coded_width);
+print_int("coded_height",  tile_grid->coded_height);
+print_int("horizontal_offset", tile_grid->horizontal_offset);
+print_int("vertical_offset",   tile_grid->vertical_offset);
+print_int("width", 

Re: [FFmpeg-devel] [PATCH 2/2] fftools/ffprobe: export IAMF Stream Group parameters

2024-03-07 Thread James Almer

On 3/7/2024 1:45 PM, Stefano Sabatini wrote:

On date Wednesday 2024-03-06 21:49:52 -0300, James Almer wrote:

Signed-off-by: James Almer 
---
  fftools/ffprobe.c   | 157 +++-
  tests/fate/iamf.mak |   8 +-
  tests/fate/mov.mak  |   8 +-
  tests/ref/fate/iamf-5_1_4   |  92 ++
  tests/ref/fate/iamf-7_1_4   |  92 ++
  tests/ref/fate/iamf-ambisonic_1 |  39 ++
  tests/ref/fate/iamf-stereo  |  67 ++
  tests/ref/fate/mov-mp4-iamf-5_1_4   |  92 ++
  tests/ref/fate/mov-mp4-iamf-7_1_4   |  92 ++
  tests/ref/fate/mov-mp4-iamf-ambisonic_1 |  39 ++
  tests/ref/fate/mov-mp4-iamf-stereo  |  67 ++
  11 files changed, 741 insertions(+), 12 deletions(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index c2ed8336f9..393f8d2a99 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -41,6 +41,7 @@
  #include "libavutil/display.h"
  #include "libavutil/hash.h"
  #include "libavutil/hdr_dynamic_metadata.h"
+#include "libavutil/iamf.h"
  #include "libavutil/mastering_display_metadata.h"
  #include "libavutil/hdr_dynamic_vivid_metadata.h"
  #include "libavutil/dovi_meta.h"
@@ -214,6 +215,12 @@ typedef enum {
  SECTION_ID_STREAM_GROUP_COMPONENT,
  SECTION_ID_STREAM_GROUP_SUB_COMPONENTS,
  SECTION_ID_STREAM_GROUP_SUB_COMPONENT,
+SECTION_ID_STREAM_GROUP_PIECES,
+SECTION_ID_STREAM_GROUP_PIECE,
+SECTION_ID_STREAM_GROUP_SUB_PIECES,
+SECTION_ID_STREAM_GROUP_SUB_PIECE,
+SECTION_ID_STREAM_GROUP_BLOCKS,
+SECTION_ID_STREAM_GROUP_BLOCK,
  SECTION_ID_STREAM_GROUP_STREAMS,
  SECTION_ID_STREAM_GROUP_STREAM,
  SECTION_ID_STREAM_GROUP_DISPOSITION,
@@ -287,8 +294,8 @@ static struct section sections[] = {
  [SECTION_ID_FRAME_SIDE_DATA_TIMECODE] =   { 
SECTION_ID_FRAME_SIDE_DATA_TIMECODE, "timecode", 0, { -1 } },
  [SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST] = { SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST, 
"components", SECTION_FLAG_IS_ARRAY, { SECTION_ID_FRAME_SIDE_DATA_COMPONENT, -1 }, .element_name = 
"component", .unique_name = "frame_side_data_components" },
  [SECTION_ID_FRAME_SIDE_DATA_COMPONENT] =  { SECTION_ID_FRAME_SIDE_DATA_COMPONENT, 
"component", SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { 
SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST, -1 }, .unique_name = "frame_side_data_component", 
.element_name = "component_entry", .get_type = get_raw_string_type },
-[SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST] =   { SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST, 
"pieces", SECTION_FLAG_IS_ARRAY, { SECTION_ID_FRAME_SIDE_DATA_PIECE, -1 }, .element_name 
= "piece" },
-[SECTION_ID_FRAME_SIDE_DATA_PIECE] ={ SECTION_ID_FRAME_SIDE_DATA_PIECE, 
"piece", SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { -1 }, .element_name = 
"piece_entry", .get_type = get_raw_string_type },
+[SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST] =   { SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST, "pieces", 
SECTION_FLAG_IS_ARRAY, { SECTION_ID_FRAME_SIDE_DATA_PIECE, -1 }, .element_name = "piece", 
.unique_name = "frame_side_data_pieces" },
+[SECTION_ID_FRAME_SIDE_DATA_PIECE] ={ SECTION_ID_FRAME_SIDE_DATA_PIECE, "piece", 
SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { -1 }, .element_name = "piece_entry", 
.unique_name = "frame_side_data_piece", .get_type = get_raw_string_type },
  [SECTION_ID_FRAME_LOGS] = { SECTION_ID_FRAME_LOGS, "logs", 
SECTION_FLAG_IS_ARRAY, { SECTION_ID_FRAME_LOG, -1 } },
  [SECTION_ID_FRAME_LOG] =  { SECTION_ID_FRAME_LOG, "log", 0, { -1 
},  },
  [SECTION_ID_LIBRARY_VERSIONS] =   { SECTION_ID_LIBRARY_VERSIONS, 
"library_versions", SECTION_FLAG_IS_ARRAY, { SECTION_ID_LIBRARY_VERSION, -1 } },
@@ -318,7 +325,13 @@ static struct section sections[] = {
  [SECTION_ID_STREAM_GROUP_COMPONENTS] = { SECTION_ID_STREAM_GROUP_COMPONENTS, 
"components", SECTION_FLAG_IS_ARRAY, { SECTION_ID_STREAM_GROUP_COMPONENT, -1 }, .element_name = 
"component", .unique_name = "stream_group_components" },
  [SECTION_ID_STREAM_GROUP_COMPONENT] =  { SECTION_ID_STREAM_GROUP_COMPONENT, 
"component", SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { 
SECTION_ID_STREAM_GROUP_SUB_COMPONENTS, -1 }, .unique_name = "stream_group_component", 
.element_name = "component_entry", .get_type = get_stream_group_type },
  [SECTION_ID_STREAM_GROUP_SUB_COMPONENTS] = { SECTION_ID_STREAM_GROUP_SUB_COMPONENTS, 
"subcomponents", SECTION_FLAG_IS_ARRAY, { SECTION_ID_STREAM_GROUP_SUB_COMPONENT, -1 }, 
.element_name = "component" },
-[SECTION_ID_STREAM_GROUP_SUB_COMPONENT] =  { SECTION_ID_STREAM_GROUP_SUB_COMPONENT, 
"subcomponent", SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { -1 }, 
.element_name = "sub_component_entry", .get_type = get_raw_string_type },



+[SECTION_ID_STREAM_GROUP_SUB_COMPONENT] =  { 

Re: [FFmpeg-devel] Patch which requires a new library

2024-03-07 Thread Sergio Garcia Murillo
El jue, 7 mar 2024, 18:21, Kieran Kunhya  escribió:

> On Thu, 7 Mar 2024, 17:16 Sergio Garcia Murillo, <
> sergio.garcia.muri...@gmail.com> wrote:
>
> > El jue, 7 mar 2024, 16:30, Kieran Kunhya  escribió:
> >
> > > On Thu, 7 Mar 2024 at 15:07, Sergio Garcia Murillo <
> > > sergio.garcia.muri...@gmail.com> wrote:
> > >
> > > >
> > > > Could anyone give me any pointers on what is the best way of doing
> > this?
> > > >
> > >
> > > You should use a well known crypto library to implement this in FFmpeg
> > (e.g
> > > libgcrypt, openssl
> > >
> >
> > In fact, the sigv library allows to pass the crypto implementation you
> want
> > to use:
> >
> >
> >
> https://github.com/aws/SigV4-for-AWS-IoT-embedded-sdk/blob/dc530f7a21ec96db62afe73e21e3b7dfad0d648c/source/include/sigv4.h#L235
> >
> > So the patch is already using whatever crypto library ffmpeg is
> configured
> > to use.
> >
> > Anyway, not sure if i understood your feedback correctly, but my question
> > was about what is the best way of adding the sigv4 library as an optional
> > dependency in the configuration file and how to modify the patch so the
> > sigv4 specific code is only compiled if it is enabled by the
> configuration.
> >
>
> The point is we don't want to use the external lib.
>

For what? This is aws lib implementing the aws s3 signatures and using
ffmpeg crypto libs.

Best regards
Sergio

>
___
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 which requires a new library

2024-03-07 Thread Kieran Kunhya
On Thu, 7 Mar 2024, 17:16 Sergio Garcia Murillo, <
sergio.garcia.muri...@gmail.com> wrote:

> El jue, 7 mar 2024, 16:30, Kieran Kunhya  escribió:
>
> > On Thu, 7 Mar 2024 at 15:07, Sergio Garcia Murillo <
> > sergio.garcia.muri...@gmail.com> wrote:
> >
> > >
> > > Could anyone give me any pointers on what is the best way of doing
> this?
> > >
> >
> > You should use a well known crypto library to implement this in FFmpeg
> (e.g
> > libgcrypt, openssl
> >
>
> In fact, the sigv library allows to pass the crypto implementation you want
> to use:
>
>
> https://github.com/aws/SigV4-for-AWS-IoT-embedded-sdk/blob/dc530f7a21ec96db62afe73e21e3b7dfad0d648c/source/include/sigv4.h#L235
>
> So the patch is already using whatever crypto library ffmpeg is configured
> to use.
>
> Anyway, not sure if i understood your feedback correctly, but my question
> was about what is the best way of adding the sigv4 library as an optional
> dependency in the configuration file and how to modify the patch so the
> sigv4 specific code is only compiled if it is enabled by the configuration.
>

The point is we don't want to use the external lib.

Kieran

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

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


Re: [FFmpeg-devel] Patch which requires a new library

2024-03-07 Thread Sergio Garcia Murillo
El jue, 7 mar 2024, 16:30, Kieran Kunhya  escribió:

> On Thu, 7 Mar 2024 at 15:07, Sergio Garcia Murillo <
> sergio.garcia.muri...@gmail.com> wrote:
>
> >
> > Could anyone give me any pointers on what is the best way of doing this?
> >
>
> You should use a well known crypto library to implement this in FFmpeg (e.g
> libgcrypt, openssl
>

In fact, the sigv library allows to pass the crypto implementation you want
to use:

https://github.com/aws/SigV4-for-AWS-IoT-embedded-sdk/blob/dc530f7a21ec96db62afe73e21e3b7dfad0d648c/source/include/sigv4.h#L235

So the patch is already using whatever crypto library ffmpeg is configured
to use.

Anyway, not sure if i understood your feedback correctly, but my question
was about what is the best way of adding the sigv4 library as an optional
dependency in the configuration file and how to modify the patch so the
sigv4 specific code is only compiled if it is enabled by the configuration.

I have been looking at the contribution docs, but have found no info about
this.

Best regards
Sergio

>
___
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 v2] fftools/ffprobe: export Tile Grid Stream Group parameters

2024-03-07 Thread Stefano Sabatini
On date Thursday 2024-03-07 17:17:06 +0100, Stefano Sabatini wrote:
> On date Wednesday 2024-03-06 21:49:51 -0300, James Almer wrote:
> > Signed-off-by: James Almer 
> > ---
> >  fftools/ffprobe.c | 53 ---
> >  tests/fate/mov.mak|  6 +--
> >  .../ref/fate/mov-heic-demux-still-image-grid  | 29 ++
> >  .../ref/fate/mov-heic-demux-still-image-iovl  | 19 +++
> >  .../fate/mov-heic-demux-still-image-iovl-2| 19 +++
> >  5 files changed, 115 insertions(+), 11 deletions(-)
> > 
> > diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> > index 4d4a85b5b0..c2ed8336f9 100644
> > --- a/fftools/ffprobe.c
> > +++ b/fftools/ffprobe.c
> > @@ -113,6 +113,7 @@ static int do_show_frames  = 0;
> >  static int do_show_packets = 0;
> >  static int do_show_programs = 0;
> >  static int do_show_stream_groups = 0;
> > +static int do_show_stream_group_components = 0;
> >  static int do_show_streams = 0;
> >  static int do_show_stream_disposition = 0;
> >  static int do_show_stream_group_disposition = 0;
> > @@ -209,6 +210,10 @@ typedef enum {
> >  SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION,
> >  SECTION_ID_STREAM_GROUP_STREAM_TAGS,
> >  SECTION_ID_STREAM_GROUP,
> > +SECTION_ID_STREAM_GROUP_COMPONENTS,
> > +SECTION_ID_STREAM_GROUP_COMPONENT,
> > +SECTION_ID_STREAM_GROUP_SUB_COMPONENTS,
> > +SECTION_ID_STREAM_GROUP_SUB_COMPONENT,
> >  SECTION_ID_STREAM_GROUP_STREAMS,
> >  SECTION_ID_STREAM_GROUP_STREAM,
> >  SECTION_ID_STREAM_GROUP_DISPOSITION,
> > @@ -309,7 +314,11 @@ static struct section sections[] = {
> >  [SECTION_ID_PROGRAMS] =   { SECTION_ID_PROGRAMS, 
> > "programs", SECTION_FLAG_IS_ARRAY, { SECTION_ID_PROGRAM, -1 } },
> >  [SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION] = { 
> > SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION, "disposition", 0, { -1 }, 
> > .unique_name = "stream_group_stream_disposition" },
> >  [SECTION_ID_STREAM_GROUP_STREAM_TAGS] ={ 
> > SECTION_ID_STREAM_GROUP_STREAM_TAGS, "tags", 
> > SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", 
> > .unique_name = "stream_group_stream_tags" },
> > -[SECTION_ID_STREAM_GROUP] ={ 
> > SECTION_ID_STREAM_GROUP, "stream_group", SECTION_FLAG_HAS_TYPE, { 
> > SECTION_ID_STREAM_GROUP_TAGS, SECTION_ID_STREAM_GROUP_DISPOSITION, 
> > SECTION_ID_STREAM_GROUP_STREAMS, -1 }, .get_type = get_stream_group_type },
> > +[SECTION_ID_STREAM_GROUP] ={ 
> > SECTION_ID_STREAM_GROUP, "stream_group", 0, { SECTION_ID_STREAM_GROUP_TAGS, 
> > SECTION_ID_STREAM_GROUP_DISPOSITION, SECTION_ID_STREAM_GROUP_COMPONENTS, 
> > SECTION_ID_STREAM_GROUP_STREAMS, -1 } },
> > +[SECTION_ID_STREAM_GROUP_COMPONENTS] = { 
> > SECTION_ID_STREAM_GROUP_COMPONENTS, "components", SECTION_FLAG_IS_ARRAY, { 
> > SECTION_ID_STREAM_GROUP_COMPONENT, -1 }, .element_name = "component", 
> > .unique_name = "stream_group_components" },
> > +[SECTION_ID_STREAM_GROUP_COMPONENT] =  { 
> > SECTION_ID_STREAM_GROUP_COMPONENT, "component", 
> > SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { 
> > SECTION_ID_STREAM_GROUP_SUB_COMPONENTS, -1 }, .unique_name = 
> > "stream_group_component", .element_name = "component_entry", .get_type = 
> > get_stream_group_type },
> 
> > +[SECTION_ID_STREAM_GROUP_SUB_COMPONENTS] = { 
> > SECTION_ID_STREAM_GROUP_SUB_COMPONENTS, "subcomponents", 
> > SECTION_FLAG_IS_ARRAY, { SECTION_ID_STREAM_GROUP_SUB_COMPONENT, -1 }, 
> > .element_name = "component" },
> > +[SECTION_ID_STREAM_GROUP_SUB_COMPONENT] =  { 
> > SECTION_ID_STREAM_GROUP_SUB_COMPONENT, "subcomponent", 
> > SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { -1 }, 
> > .element_name = "sub_component_entry", .get_type = get_raw_string_type },
> 
> consistency: subcomponent or sub_component (probably I'd go with
> SUBCOMPONENT/subcomponent everywhere).

also, missing ffprobe.xsd update?
___
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/2] fftools/ffprobe: export IAMF Stream Group parameters

2024-03-07 Thread Stefano Sabatini
On date Wednesday 2024-03-06 21:49:52 -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  fftools/ffprobe.c   | 157 +++-
>  tests/fate/iamf.mak |   8 +-
>  tests/fate/mov.mak  |   8 +-
>  tests/ref/fate/iamf-5_1_4   |  92 ++
>  tests/ref/fate/iamf-7_1_4   |  92 ++
>  tests/ref/fate/iamf-ambisonic_1 |  39 ++
>  tests/ref/fate/iamf-stereo  |  67 ++
>  tests/ref/fate/mov-mp4-iamf-5_1_4   |  92 ++
>  tests/ref/fate/mov-mp4-iamf-7_1_4   |  92 ++
>  tests/ref/fate/mov-mp4-iamf-ambisonic_1 |  39 ++
>  tests/ref/fate/mov-mp4-iamf-stereo  |  67 ++
>  11 files changed, 741 insertions(+), 12 deletions(-)
> 
> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> index c2ed8336f9..393f8d2a99 100644
> --- a/fftools/ffprobe.c
> +++ b/fftools/ffprobe.c
> @@ -41,6 +41,7 @@
>  #include "libavutil/display.h"
>  #include "libavutil/hash.h"
>  #include "libavutil/hdr_dynamic_metadata.h"
> +#include "libavutil/iamf.h"
>  #include "libavutil/mastering_display_metadata.h"
>  #include "libavutil/hdr_dynamic_vivid_metadata.h"
>  #include "libavutil/dovi_meta.h"
> @@ -214,6 +215,12 @@ typedef enum {
>  SECTION_ID_STREAM_GROUP_COMPONENT,
>  SECTION_ID_STREAM_GROUP_SUB_COMPONENTS,
>  SECTION_ID_STREAM_GROUP_SUB_COMPONENT,
> +SECTION_ID_STREAM_GROUP_PIECES,
> +SECTION_ID_STREAM_GROUP_PIECE,
> +SECTION_ID_STREAM_GROUP_SUB_PIECES,
> +SECTION_ID_STREAM_GROUP_SUB_PIECE,
> +SECTION_ID_STREAM_GROUP_BLOCKS,
> +SECTION_ID_STREAM_GROUP_BLOCK,
>  SECTION_ID_STREAM_GROUP_STREAMS,
>  SECTION_ID_STREAM_GROUP_STREAM,
>  SECTION_ID_STREAM_GROUP_DISPOSITION,
> @@ -287,8 +294,8 @@ static struct section sections[] = {
>  [SECTION_ID_FRAME_SIDE_DATA_TIMECODE] =   { 
> SECTION_ID_FRAME_SIDE_DATA_TIMECODE, "timecode", 0, { -1 } },
>  [SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST] = { 
> SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST, "components", 
> SECTION_FLAG_IS_ARRAY, { SECTION_ID_FRAME_SIDE_DATA_COMPONENT, -1 }, 
> .element_name = "component", .unique_name = "frame_side_data_components" },
>  [SECTION_ID_FRAME_SIDE_DATA_COMPONENT] =  { 
> SECTION_ID_FRAME_SIDE_DATA_COMPONENT, "component", 
> SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { 
> SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST, -1 }, .unique_name = 
> "frame_side_data_component", .element_name = "component_entry", .get_type = 
> get_raw_string_type },
> -[SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST] =   { 
> SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST, "pieces", SECTION_FLAG_IS_ARRAY, { 
> SECTION_ID_FRAME_SIDE_DATA_PIECE, -1 }, .element_name = "piece" },
> -[SECTION_ID_FRAME_SIDE_DATA_PIECE] ={ 
> SECTION_ID_FRAME_SIDE_DATA_PIECE, "piece", 
> SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { -1 }, .element_name 
> = "piece_entry", .get_type = get_raw_string_type },
> +[SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST] =   { 
> SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST, "pieces", SECTION_FLAG_IS_ARRAY, { 
> SECTION_ID_FRAME_SIDE_DATA_PIECE, -1 }, .element_name = "piece", .unique_name 
> = "frame_side_data_pieces" },
> +[SECTION_ID_FRAME_SIDE_DATA_PIECE] ={ 
> SECTION_ID_FRAME_SIDE_DATA_PIECE, "piece", 
> SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { -1 }, .element_name 
> = "piece_entry", .unique_name = "frame_side_data_piece", .get_type = 
> get_raw_string_type },
>  [SECTION_ID_FRAME_LOGS] = { SECTION_ID_FRAME_LOGS, "logs", 
> SECTION_FLAG_IS_ARRAY, { SECTION_ID_FRAME_LOG, -1 } },
>  [SECTION_ID_FRAME_LOG] =  { SECTION_ID_FRAME_LOG, "log", 0, { -1 
> },  },
>  [SECTION_ID_LIBRARY_VERSIONS] =   { SECTION_ID_LIBRARY_VERSIONS, 
> "library_versions", SECTION_FLAG_IS_ARRAY, { SECTION_ID_LIBRARY_VERSION, -1 } 
> },
> @@ -318,7 +325,13 @@ static struct section sections[] = {
>  [SECTION_ID_STREAM_GROUP_COMPONENTS] = { 
> SECTION_ID_STREAM_GROUP_COMPONENTS, "components", SECTION_FLAG_IS_ARRAY, { 
> SECTION_ID_STREAM_GROUP_COMPONENT, -1 }, .element_name = "component", 
> .unique_name = "stream_group_components" },
>  [SECTION_ID_STREAM_GROUP_COMPONENT] =  { 
> SECTION_ID_STREAM_GROUP_COMPONENT, "component", 
> SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { 
> SECTION_ID_STREAM_GROUP_SUB_COMPONENTS, -1 }, .unique_name = 
> "stream_group_component", .element_name = "component_entry", .get_type = 
> get_stream_group_type },
>  [SECTION_ID_STREAM_GROUP_SUB_COMPONENTS] = { 
> SECTION_ID_STREAM_GROUP_SUB_COMPONENTS, "subcomponents", 
> SECTION_FLAG_IS_ARRAY, { SECTION_ID_STREAM_GROUP_SUB_COMPONENT, -1 }, 
> .element_name = "component" },
> -[SECTION_ID_STREAM_GROUP_SUB_COMPONENT] =  { 
> SECTION_ID_STREAM_GROUP_SUB_COMPONENT, "subcomponent", 
> SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { -1 }, .element_name 

[FFmpeg-devel] [PATCH] avcodec/librav1e: Don't unnecessarily create new references

2024-03-07 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
Absolutely untested (not even compiled).

 libavcodec/librav1e.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/libavcodec/librav1e.c b/libavcodec/librav1e.c
index dbd728a408..2a6d8bfbed 100644
--- a/libavcodec/librav1e.c
+++ b/libavcodec/librav1e.c
@@ -472,12 +472,8 @@ static int librav1e_receive_packet(AVCodecContext *avctx, 
AVPacket *pkt)
 
 if (avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) {
 fd->frame_opaque = frame->opaque;
-ret = av_buffer_replace(>frame_opaque_ref, 
frame->opaque_ref);
-if (ret < 0) {
-frame_data_free(fd);
-av_frame_unref(frame);
-return ret;
-}
+fd->frame_opaque_ref = frame->opaque_ref;
+frame->opaque_ref= NULL;
 }
 
 rframe = rav1e_frame_new(ctx->ctx);
-- 
2.40.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/2 v2] fftools/ffprobe: export Tile Grid Stream Group parameters

2024-03-07 Thread Stefano Sabatini
On date Wednesday 2024-03-06 21:49:51 -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  fftools/ffprobe.c | 53 ---
>  tests/fate/mov.mak|  6 +--
>  .../ref/fate/mov-heic-demux-still-image-grid  | 29 ++
>  .../ref/fate/mov-heic-demux-still-image-iovl  | 19 +++
>  .../fate/mov-heic-demux-still-image-iovl-2| 19 +++
>  5 files changed, 115 insertions(+), 11 deletions(-)
> 
> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> index 4d4a85b5b0..c2ed8336f9 100644
> --- a/fftools/ffprobe.c
> +++ b/fftools/ffprobe.c
> @@ -113,6 +113,7 @@ static int do_show_frames  = 0;
>  static int do_show_packets = 0;
>  static int do_show_programs = 0;
>  static int do_show_stream_groups = 0;
> +static int do_show_stream_group_components = 0;
>  static int do_show_streams = 0;
>  static int do_show_stream_disposition = 0;
>  static int do_show_stream_group_disposition = 0;
> @@ -209,6 +210,10 @@ typedef enum {
>  SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION,
>  SECTION_ID_STREAM_GROUP_STREAM_TAGS,
>  SECTION_ID_STREAM_GROUP,
> +SECTION_ID_STREAM_GROUP_COMPONENTS,
> +SECTION_ID_STREAM_GROUP_COMPONENT,
> +SECTION_ID_STREAM_GROUP_SUB_COMPONENTS,
> +SECTION_ID_STREAM_GROUP_SUB_COMPONENT,
>  SECTION_ID_STREAM_GROUP_STREAMS,
>  SECTION_ID_STREAM_GROUP_STREAM,
>  SECTION_ID_STREAM_GROUP_DISPOSITION,
> @@ -309,7 +314,11 @@ static struct section sections[] = {
>  [SECTION_ID_PROGRAMS] =   { SECTION_ID_PROGRAMS, 
> "programs", SECTION_FLAG_IS_ARRAY, { SECTION_ID_PROGRAM, -1 } },
>  [SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION] = { 
> SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION, "disposition", 0, { -1 }, 
> .unique_name = "stream_group_stream_disposition" },
>  [SECTION_ID_STREAM_GROUP_STREAM_TAGS] ={ 
> SECTION_ID_STREAM_GROUP_STREAM_TAGS, "tags", 
> SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name 
> = "stream_group_stream_tags" },
> -[SECTION_ID_STREAM_GROUP] ={ 
> SECTION_ID_STREAM_GROUP, "stream_group", SECTION_FLAG_HAS_TYPE, { 
> SECTION_ID_STREAM_GROUP_TAGS, SECTION_ID_STREAM_GROUP_DISPOSITION, 
> SECTION_ID_STREAM_GROUP_STREAMS, -1 }, .get_type = get_stream_group_type },
> +[SECTION_ID_STREAM_GROUP] ={ 
> SECTION_ID_STREAM_GROUP, "stream_group", 0, { SECTION_ID_STREAM_GROUP_TAGS, 
> SECTION_ID_STREAM_GROUP_DISPOSITION, SECTION_ID_STREAM_GROUP_COMPONENTS, 
> SECTION_ID_STREAM_GROUP_STREAMS, -1 } },
> +[SECTION_ID_STREAM_GROUP_COMPONENTS] = { 
> SECTION_ID_STREAM_GROUP_COMPONENTS, "components", SECTION_FLAG_IS_ARRAY, { 
> SECTION_ID_STREAM_GROUP_COMPONENT, -1 }, .element_name = "component", 
> .unique_name = "stream_group_components" },
> +[SECTION_ID_STREAM_GROUP_COMPONENT] =  { 
> SECTION_ID_STREAM_GROUP_COMPONENT, "component", 
> SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { 
> SECTION_ID_STREAM_GROUP_SUB_COMPONENTS, -1 }, .unique_name = 
> "stream_group_component", .element_name = "component_entry", .get_type = 
> get_stream_group_type },

> +[SECTION_ID_STREAM_GROUP_SUB_COMPONENTS] = { 
> SECTION_ID_STREAM_GROUP_SUB_COMPONENTS, "subcomponents", 
> SECTION_FLAG_IS_ARRAY, { SECTION_ID_STREAM_GROUP_SUB_COMPONENT, -1 }, 
> .element_name = "component" },
> +[SECTION_ID_STREAM_GROUP_SUB_COMPONENT] =  { 
> SECTION_ID_STREAM_GROUP_SUB_COMPONENT, "subcomponent", 
> SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { -1 }, .element_name 
> = "sub_component_entry", .get_type = get_raw_string_type },

consistency: subcomponent or sub_component (probably I'd go with
SUBCOMPONENT/subcomponent everywhere).

>  [SECTION_ID_STREAM_GROUP_STREAMS] ={ 
> SECTION_ID_STREAM_GROUP_STREAMS, "streams", SECTION_FLAG_IS_ARRAY, { 
> SECTION_ID_STREAM_GROUP_STREAM, -1 }, .unique_name = "stream_group_streams" },
>  [SECTION_ID_STREAM_GROUP_STREAM] = { 
> SECTION_ID_STREAM_GROUP_STREAM, "stream", 0, { 
> SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION, 
> SECTION_ID_STREAM_GROUP_STREAM_TAGS, -1 }, .unique_name = 
> "stream_group_stream" },
>  [SECTION_ID_STREAM_GROUP_DISPOSITION] ={ 
> SECTION_ID_STREAM_GROUP_DISPOSITION, "disposition", 0, { -1 }, .unique_name = 
> "stream_group_disposition" },
> @@ -3385,13 +3394,35 @@ static int show_programs(WriterContext *w, InputFile 
> *ifile)
>  return ret;
>  }
>  
> +static void print_tile_grid_params(WriterContext *w, const AVStreamGroup 
> *stg,
> +   const AVStreamGroupTileGrid *tile_grid)
> +{
> +writer_print_section_header(w, stg, SECTION_ID_STREAM_GROUP_COMPONENT);
> +print_int("nb_tiles",  tile_grid->nb_tiles);
> +print_int("coded_width",   tile_grid->coded_width);
> +print_int("coded_height",  tile_grid->coded_height);
> +print_int("horizontal_offset", tile_grid->horizontal_offset);
> +

[FFmpeg-devel] [PATCH] avcodec/libdav1d: Stop mangling AVPacket.opaque

2024-03-07 Thread Andreas Rheinhardt
Unnecessary since 67e7f0b0537eee1357769038270fda08fe32
as there are no longer two opaque fields.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/libdav1d.c | 27 ---
 1 file changed, 27 deletions(-)

diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
index 79478ae893..08fe7a841d 100644
--- a/libavcodec/libdav1d.c
+++ b/libavcodec/libdav1d.c
@@ -296,10 +296,6 @@ static void libdav1d_flush(AVCodecContext *c)
 dav1d_flush(dav1d->c);
 }
 
-typedef struct OpaqueData {
-void*pkt_orig_opaque;
-} OpaqueData;
-
 static void libdav1d_data_free(const uint8_t *data, void *opaque) {
 AVBufferRef *buf = opaque;
 
@@ -309,7 +305,6 @@ static void libdav1d_data_free(const uint8_t *data, void 
*opaque) {
 static void libdav1d_user_data_free(const uint8_t *data, void *opaque) {
 AVPacket *pkt = opaque;
 av_assert0(data == opaque);
-av_free(pkt->opaque);
 av_packet_free();
 }
 
@@ -332,8 +327,6 @@ static int libdav1d_receive_frame_internal(AVCodecContext 
*c, Dav1dPicture *p)
 }
 
 if (pkt->size) {
-OpaqueData *od = NULL;
-
 res = dav1d_data_wrap(data, pkt->data, pkt->size,
   libdav1d_data_free, pkt->buf);
 if (res < 0) {
@@ -343,21 +336,9 @@ static int libdav1d_receive_frame_internal(AVCodecContext 
*c, Dav1dPicture *p)
 
 pkt->buf = NULL;
 
-if (pkt->opaque && (c->flags & AV_CODEC_FLAG_COPY_OPAQUE)) {
-od = av_mallocz(sizeof(*od));
-if (!od) {
-av_packet_free();
-dav1d_data_unref(data);
-return AVERROR(ENOMEM);
-}
-od->pkt_orig_opaque  = pkt->opaque;
-}
-pkt->opaque = od;
-
 res = dav1d_data_wrap_user_data(data, (const uint8_t *)pkt,
 libdav1d_user_data_free, pkt);
 if (res < 0) {
-av_free(pkt->opaque);
 av_packet_free();
 dav1d_data_unref(data);
 return res;
@@ -396,7 +377,6 @@ static int libdav1d_receive_frame(AVCodecContext *c, 
AVFrame *frame)
 Libdav1dContext *dav1d = c->priv_data;
 Dav1dPicture pic = { 0 }, *p = 
 AVPacket *pkt;
-OpaqueData *od = NULL;
 #if FF_DAV1D_VERSION_AT_LEAST(5,1)
 enum Dav1dEventFlags event_flags = 0;
 #endif
@@ -451,16 +431,9 @@ static int libdav1d_receive_frame(AVCodecContext *c, 
AVFrame *frame)
 ff_set_sar(c, frame->sample_aspect_ratio);
 
 pkt = (AVPacket *)p->m.user_data.data;
-od  = pkt->opaque;
-
-// restore the original user opaque value for
-// ff_decode_frame_props_from_pkt()
-pkt->opaque = od ? od->pkt_orig_opaque : NULL;
-av_freep();
 
 // match timestamps and packet size
 res = ff_decode_frame_props_from_pkt(c, frame, pkt);
-pkt->opaque = NULL;
 if (res < 0)
 goto fail;
 
-- 
2.40.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 which requires a new library

2024-03-07 Thread Kieran Kunhya
On Thu, 7 Mar 2024 at 15:07, Sergio Garcia Murillo <
sergio.garcia.muri...@gmail.com> wrote:

>
> Could anyone give me any pointers on what is the best way of doing this?
>

You should use a well known crypto library to implement this in FFmpeg (e.g
libgcrypt, openssl etc).

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

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


[FFmpeg-devel] [PATCH v2] avcodec/libx264: fix extradata when config annexb=0

2024-03-07 Thread Zhao Zhili
From: Zhao Zhili 

---
 configure|   2 +-
 libavcodec/libx264.c | 134 +++
 2 files changed, 111 insertions(+), 25 deletions(-)

diff --git a/configure b/configure
index db7dc89755..24cb897d28 100755
--- a/configure
+++ b/configure
@@ -3491,7 +3491,7 @@ libwebp_encoder_deps="libwebp"
 libwebp_anim_encoder_deps="libwebp"
 libx262_encoder_deps="libx262"
 libx264_encoder_deps="libx264"
-libx264_encoder_select="atsc_a53"
+libx264_encoder_select="atsc_a53 h264parse"
 libx264rgb_encoder_deps="libx264"
 libx264rgb_encoder_select="libx264_encoder"
 libx265_encoder_deps="libx265"
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 10d646bd76..92c6d073fe 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -27,6 +27,7 @@
 #include "libavutil/opt.h"
 #include "libavutil/mem.h"
 #include "libavutil/pixdesc.h"
+#include "libavutil/reverse.h"
 #include "libavutil/stereo3d.h"
 #include "libavutil/time.h"
 #include "libavutil/intreadwrite.h"
@@ -34,6 +35,8 @@
 #include "avcodec.h"
 #include "codec_internal.h"
 #include "encode.h"
+#include "get_bits.h"
+#include "h264_ps.h"
 #include "internal.h"
 #include "packet_internal.h"
 #include "atsc_a53.h"
@@ -865,6 +868,110 @@ static int convert_pix_fmt(enum AVPixelFormat pix_fmt)
 return 0;
 }
 
+static int set_avcc_extradata(AVCodecContext *avctx, x264_nal_t *nal, int nnal)
+{
+X264Context *x4 = avctx->priv_data;
+x264_nal_t *sps_nal = NULL;
+x264_nal_t *pps_nal = NULL;
+uint8_t *p, *sps;
+int ret;
+
+/* We know it's in the order of SPS/PPS/SEI, but it's not documented in 
x264 API.
+ * The x264 param i_sps_id implies there is a single pair of SPS/PPS.
+ */
+for (int i = 0; i < nnal; i++) {
+if (nal[i].i_type == NAL_SPS)
+sps_nal = [i];
+else if (nal[i].i_type == NAL_PPS)
+pps_nal = [i];
+}
+if (!sps_nal || !pps_nal)
+return AVERROR_EXTERNAL;
+
+avctx->extradata_size = sps_nal->i_payload + pps_nal->i_payload + 7;
+avctx->extradata = av_mallocz(avctx->extradata_size + 
AV_INPUT_BUFFER_PADDING_SIZE);
+if (!avctx->extradata)
+return AVERROR(ENOMEM);
+
+// Now create AVCDecoderConfigurationRecord
+p = avctx->extradata;
+// Skip size part
+sps = sps_nal->p_payload + 4;
+*p++ = 1; // version
+*p++ = sps[1]; // AVCProfileIndication
+*p++ = sps[2]; // profile_compatibility
+*p++ = sps[3]; // AVCLevelIndication
+*p++ = 0xFF;
+*p++ = 0xE0 | 0x01; // 3 bits reserved (111) + 5 bits number of sps
+memcpy(p, sps_nal->p_payload + 2, sps_nal->i_payload - 2);
+// Make sps has AV_INPUT_BUFFER_PADDING_SIZE padding, so it can be used
+// with GetBitContext
+sps = p + 2;
+p += sps_nal->i_payload - 2;
+*p++ = 1;
+memcpy(p, pps_nal->p_payload + 2, pps_nal->i_payload - 2);
+p += pps_nal->i_payload - 2;
+
+if (sps[3] != 66 && sps[3] != 77 && sps[3] != 88) {
+GetBitContext gbc;
+H264ParamSets ps = { 0 };
+
+init_get_bits8(, sps, sps_nal->i_payload - 4);
+skip_bits(, 8);
+ret = ff_h264_decode_seq_parameter_set(, avctx, , 1);
+if (ret < 0)
+return ret;
+
+ps.sps = ps.sps_list[x4->params.i_sps_id];
+*p++ = 0xFC | ps.sps->chroma_format_idc;
+*p++ = 0xF8 | (ps.sps->bit_depth_luma - 8);
+*p++ = 0xF8 | (ps.sps->bit_depth_chroma - 8);
+*p++ = 0;
+ff_h264_ps_uninit();
+}
+av_assert0(avctx->extradata + avctx->extradata_size >= p);
+avctx->extradata_size = p - avctx->extradata;
+
+return 0;
+}
+
+static int set_extradata(AVCodecContext *avctx)
+{
+X264Context *x4 = avctx->priv_data;
+x264_nal_t *nal;
+uint8_t *p;
+int nnal, s;
+
+s = x264_encoder_headers(x4->enc, , );
+if (s < 0)
+return AVERROR_EXTERNAL;
+
+if (!x4->params.b_annexb)
+return set_avcc_extradata(avctx, nal, nnal);
+
+avctx->extradata = p = av_mallocz(s + AV_INPUT_BUFFER_PADDING_SIZE);
+if (!p)
+return AVERROR(ENOMEM);
+
+for (int i = 0; i < nnal; i++) {
+/* Don't put the SEI in extradata. */
+if (nal[i].i_type == NAL_SEI) {
+av_log(avctx, AV_LOG_INFO, "%s\n", nal[i].p_payload + 25);
+x4->sei_size = nal[i].i_payload;
+x4->sei = av_malloc(x4->sei_size);
+if (!x4->sei)
+return AVERROR(ENOMEM);
+memcpy(x4->sei, nal[i].p_payload, nal[i].i_payload);
+continue;
+}
+memcpy(p, nal[i].p_payload, nal[i].i_payload);
+p += nal[i].i_payload;
+}
+avctx->extradata_size = p - avctx->extradata;
+
+return 0;
+}
+
 #define PARSE_X264_OPT(name, var)\
 if (x4->var && x264_param_parse(>params, name, x4->var) < 0) {\
 av_log(avctx, AV_LOG_ERROR, "Error parsing option '%s' with value 
'%s'.\n", name, x4->var);\
@@ -1233,30 +1340,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
 

[FFmpeg-devel] [PATCH v2 06/29] lavu/opt: add array options

2024-03-07 Thread Anton Khirnov
---
 doc/APIchanges|   3 +
 libavutil/opt.c   | 360 +-
 libavutil/opt.h   |  56 ++-
 libavutil/tests/opt.c |  49 ++
 tests/ref/fate/opt|  35 +++-
 5 files changed, 458 insertions(+), 45 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 4f7612e449..6e2c851e31 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07
 
 API changes, most recent first:
 
+2024-02-xx - xx - lavu 58.xx.100 - opt.h
+  Add AV_OPT_TYPE_FLAG_ARRAY and AVOptionArrayDef.
+
 2024-03-06 - xx - lavf 60.25.100 - avformat.h
   Deprecate av_fmt_ctx_get_duration_estimation_method().
   The relevant field is public and needs no getter to access.
diff --git a/libavutil/opt.c b/libavutil/opt.c
index 06d3056a37..685206f416 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -43,6 +43,8 @@
 
 #include 
 
+#define TYPE_BASE(type) ((type) & ~AV_OPT_TYPE_FLAG_ARRAY)
+
 const AVOption *av_opt_next(const void *obj, const AVOption *last)
 {
 const AVClass *class;
@@ -100,6 +102,54 @@ static int opt_is_pod(enum AVOptionType type)
 return 0;
 }
 
+static uint8_t opt_array_sep(const AVOption *o)
+{
+const AVOptionArrayDef *d = o->default_val.arr;
+av_assert1(o->type & AV_OPT_TYPE_FLAG_ARRAY);
+return (d && d->sep) ? d->sep : ',';
+}
+
+static void *opt_array_pelem(const AVOption *o, void *array, unsigned idx)
+{
+av_assert1(o->type & AV_OPT_TYPE_FLAG_ARRAY);
+return (uint8_t *)array + idx * opt_elem_size[TYPE_BASE(o->type)];
+}
+
+static unsigned *opt_array_pcount(const void *parray)
+{
+return (unsigned *)((const void * const *)parray + 1);
+}
+
+static void opt_free_elem(const AVOption *o, void *ptr)
+{
+switch (TYPE_BASE(o->type)) {
+case AV_OPT_TYPE_STRING:
+case AV_OPT_TYPE_BINARY:
+av_freep(ptr);
+break;
+
+case AV_OPT_TYPE_DICT:
+av_dict_free((AVDictionary **)ptr);
+break;
+
+case AV_OPT_TYPE_CHLAYOUT:
+av_channel_layout_uninit((AVChannelLayout *)ptr);
+break;
+
+default:
+break;
+}
+}
+
+static void opt_free_array(const AVOption *o, void *parray, unsigned *count)
+{
+for (unsigned i = 0; i < *count; i++)
+opt_free_elem(o, opt_array_pelem(o, *(void **)parray, i));
+
+av_freep(parray);
+*count = 0;
+}
+
 static int read_number(const AVOption *o, const void *dst, double *num, int 
*den, int64_t *intnum)
 {
 switch (o->type) {
@@ -140,14 +190,16 @@ static int read_number(const AVOption *o, const void 
*dst, double *num, int *den
 
 static int write_number(void *obj, const AVOption *o, void *dst, double num, 
int den, int64_t intnum)
 {
-if (o->type != AV_OPT_TYPE_FLAGS &&
+const enum AVOptionType type = TYPE_BASE(o->type);
+
+if (type != AV_OPT_TYPE_FLAGS &&
 (!den || o->max * den < num * intnum || o->min * den > num * intnum)) {
 num = den ? num * intnum / den : (num && intnum ? INFINITY : NAN);
 av_log(obj, AV_LOG_ERROR, "Value %f for parameter '%s' out of range 
[%g - %g]\n",
num, o->name, o->min, o->max);
 return AVERROR(ERANGE);
 }
-if (o->type == AV_OPT_TYPE_FLAGS) {
+if (type == AV_OPT_TYPE_FLAGS) {
 double d = num*intnum/den;
 if (d < -1.5 || d > 0x+0.5 || (llrint(d*256) & 255)) {
 av_log(obj, AV_LOG_ERROR,
@@ -157,7 +209,7 @@ static int write_number(void *obj, const AVOption *o, void 
*dst, double num, int
 }
 }
 
-switch (o->type) {
+switch (type) {
 case AV_OPT_TYPE_PIXEL_FMT:
 *(enum AVPixelFormat *)dst = llrint(num / den) * intnum;
 break;
@@ -271,9 +323,10 @@ static int set_string(void *obj, const AVOption *o, const 
char *val, uint8_t **d
 
 static int set_string_number(void *obj, void *target_obj, const AVOption *o, 
const char *val, void *dst)
 {
+const enum AVOptionType type = TYPE_BASE(o->type);
 int ret = 0;
 
-if (o->type == AV_OPT_TYPE_RATIONAL || o->type == AV_OPT_TYPE_VIDEO_RATE) {
+if (type == AV_OPT_TYPE_RATIONAL || type == AV_OPT_TYPE_VIDEO_RATE) {
 int num, den;
 char c;
 if (sscanf(val, "%d%*1[:/]%d%c", , , ) == 2) {
@@ -290,7 +343,7 @@ static int set_string_number(void *obj, void *target_obj, 
const AVOption *o, con
 double d;
 int64_t intnum = 1;
 
-if (o->type == AV_OPT_TYPE_FLAGS) {
+if (type == AV_OPT_TYPE_FLAGS) {
 if (*val == '+' || *val == '-')
 cmd = *(val++);
 for (; i < sizeof(buf) - 1 && val[i] && val[i] != '+' && val[i] != 
'-'; i++)
@@ -346,7 +399,7 @@ static int set_string_number(void *obj, void *target_obj, 
const AVOption *o, con
 }
 }
 }
-if (o->type == AV_OPT_TYPE_FLAGS) {
+if (type == AV_OPT_TYPE_FLAGS) {
 intnum = *(unsigned int*)dst;
 if (cmd == '+')
   

Re: [FFmpeg-devel] [PATCH] avcodec/xvmc: Remove header

2024-03-07 Thread James Almer

On 3/7/2024 12:04 PM, Andreas Rheinhardt wrote:

Forgotten in a12cd3be98e8aba6e74274192ec6532988aa9444.

Signed-off-by: Andreas Rheinhardt 
---
  libavcodec/Makefile |   2 -
  libavcodec/xvmc.h   | 171 
  2 files changed, 173 deletions(-)
  delete mode 100644 libavcodec/xvmc.h

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 93f6cacf00..5d99120aa9 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -25,7 +25,6 @@ HEADERS = ac3_parser.h
  \
version_major.h   \
videotoolbox.h\
vorbis_parser.h   \
-  xvmc.h\
  
  OBJS = ac3_parser.o \

 adts_parser.o\
@@ -1278,7 +1277,6 @@ SKIPHEADERS-$(CONFIG_NVDEC)+= nvdec.h
  SKIPHEADERS-$(CONFIG_NVENC)+= nvenc.h
  SKIPHEADERS-$(CONFIG_QSV)  += qsv.h qsv_internal.h
  SKIPHEADERS-$(CONFIG_QSVENC)   += qsvenc.h
-SKIPHEADERS-$(CONFIG_XVMC) += xvmc.h
  SKIPHEADERS-$(CONFIG_VAAPI)+= vaapi_decode.h vaapi_hevc.h 
vaapi_encode.h
  SKIPHEADERS-$(CONFIG_VDPAU)+= vdpau.h vdpau_internal.h
  SKIPHEADERS-$(CONFIG_VIDEOTOOLBOX) += videotoolbox.h vt_internal.h
diff --git a/libavcodec/xvmc.h b/libavcodec/xvmc.h
deleted file mode 100644
index 52e70c0d77..00
--- a/libavcodec/xvmc.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright (C) 2003 Ivan Kalvachev
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_XVMC_H
-#define AVCODEC_XVMC_H
-
-/**
- * @file
- * @ingroup lavc_codec_hwaccel_xvmc
- * Public libavcodec XvMC header.
- */
-
-#pragma message("XvMC is no longer supported; this header is deprecated and will be 
removed")
-
-#include 
-
-#include "libavutil/attributes.h"
-#include "avcodec.h"
-
-/**
- * @defgroup lavc_codec_hwaccel_xvmc XvMC
- * @ingroup lavc_codec_hwaccel
- *
- * @{
- */
-
-#define AV_XVMC_ID0x1DC711C0  /**< special value to ensure 
that regular pixel routines haven't corrupted the struct
-   the number is 1337 
speak for the letters IDCT MCo (motion compensation) */
-
-struct attribute_deprecated xvmc_pix_fmt {
-/** The field contains the special constant value AV_XVMC_ID.
-It is used as a test that the application correctly uses the API,
-and that there is no corruption caused by pixel routines.
-- application - set during initialization
-- libavcodec  - unchanged
-*/
-int xvmc_id;
-
-/** Pointer to the block array allocated by XvMCCreateBlocks().
-The array has to be freed by XvMCDestroyBlocks().
-Each group of 64 values represents one data block of differential
-pixel information (in MoCo mode) or coefficients for IDCT.
-- application - set the pointer during initialization
-- libavcodec  - fills coefficients/pixel data into the array
-*/
-short*  data_blocks;
-
-/** Pointer to the macroblock description array allocated by
-XvMCCreateMacroBlocks() and freed by XvMCDestroyMacroBlocks().
-- application - set the pointer during initialization
-- libavcodec  - fills description data into the array
-*/
-XvMCMacroBlock* mv_blocks;
-
-/** Number of macroblock descriptions that can be stored in the mv_blocks
-array.
-- application - set during initialization
-- libavcodec  - unchanged
-*/
-int allocated_mv_blocks;
-
-/** Number of blocks that can be stored at once in the data_blocks array.
-- application - set during initialization
-- libavcodec  - unchanged
-*/
-int allocated_data_blocks;
-
-/** Indicate that the hardware would interpret data_blocks as IDCT
-coefficients and perform IDCT on them.
-- application - set during initialization
-- libavcodec  - 

[FFmpeg-devel] [PATCH] avcodec/xvmc: Remove header

2024-03-07 Thread Andreas Rheinhardt
Forgotten in a12cd3be98e8aba6e74274192ec6532988aa9444.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/Makefile |   2 -
 libavcodec/xvmc.h   | 171 
 2 files changed, 173 deletions(-)
 delete mode 100644 libavcodec/xvmc.h

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 93f6cacf00..5d99120aa9 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -25,7 +25,6 @@ HEADERS = ac3_parser.h
  \
   version_major.h   \
   videotoolbox.h\
   vorbis_parser.h   \
-  xvmc.h\
 
 OBJS = ac3_parser.o \
adts_parser.o\
@@ -1278,7 +1277,6 @@ SKIPHEADERS-$(CONFIG_NVDEC)+= nvdec.h
 SKIPHEADERS-$(CONFIG_NVENC)+= nvenc.h
 SKIPHEADERS-$(CONFIG_QSV)  += qsv.h qsv_internal.h
 SKIPHEADERS-$(CONFIG_QSVENC)   += qsvenc.h
-SKIPHEADERS-$(CONFIG_XVMC) += xvmc.h
 SKIPHEADERS-$(CONFIG_VAAPI)+= vaapi_decode.h vaapi_hevc.h 
vaapi_encode.h
 SKIPHEADERS-$(CONFIG_VDPAU)+= vdpau.h vdpau_internal.h
 SKIPHEADERS-$(CONFIG_VIDEOTOOLBOX) += videotoolbox.h vt_internal.h
diff --git a/libavcodec/xvmc.h b/libavcodec/xvmc.h
deleted file mode 100644
index 52e70c0d77..00
--- a/libavcodec/xvmc.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright (C) 2003 Ivan Kalvachev
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_XVMC_H
-#define AVCODEC_XVMC_H
-
-/**
- * @file
- * @ingroup lavc_codec_hwaccel_xvmc
- * Public libavcodec XvMC header.
- */
-
-#pragma message("XvMC is no longer supported; this header is deprecated and 
will be removed")
-
-#include 
-
-#include "libavutil/attributes.h"
-#include "avcodec.h"
-
-/**
- * @defgroup lavc_codec_hwaccel_xvmc XvMC
- * @ingroup lavc_codec_hwaccel
- *
- * @{
- */
-
-#define AV_XVMC_ID0x1DC711C0  /**< special value to ensure 
that regular pixel routines haven't corrupted the struct
-   the number is 1337 
speak for the letters IDCT MCo (motion compensation) */
-
-struct attribute_deprecated xvmc_pix_fmt {
-/** The field contains the special constant value AV_XVMC_ID.
-It is used as a test that the application correctly uses the API,
-and that there is no corruption caused by pixel routines.
-- application - set during initialization
-- libavcodec  - unchanged
-*/
-int xvmc_id;
-
-/** Pointer to the block array allocated by XvMCCreateBlocks().
-The array has to be freed by XvMCDestroyBlocks().
-Each group of 64 values represents one data block of differential
-pixel information (in MoCo mode) or coefficients for IDCT.
-- application - set the pointer during initialization
-- libavcodec  - fills coefficients/pixel data into the array
-*/
-short*  data_blocks;
-
-/** Pointer to the macroblock description array allocated by
-XvMCCreateMacroBlocks() and freed by XvMCDestroyMacroBlocks().
-- application - set the pointer during initialization
-- libavcodec  - fills description data into the array
-*/
-XvMCMacroBlock* mv_blocks;
-
-/** Number of macroblock descriptions that can be stored in the mv_blocks
-array.
-- application - set during initialization
-- libavcodec  - unchanged
-*/
-int allocated_mv_blocks;
-
-/** Number of blocks that can be stored at once in the data_blocks array.
-- application - set during initialization
-- libavcodec  - unchanged
-*/
-int allocated_data_blocks;
-
-/** Indicate that the hardware would interpret data_blocks as IDCT
-coefficients and perform IDCT on them.
-- application - set during initialization
-- libavcodec  - unchanged
-*/
-int idct;
-
-/** In MoCo mode it 

[FFmpeg-devel] Patch which requires a new library

2024-03-07 Thread Sergio Garcia Murillo
Hi all!

I would like to contribute a patch that adds sig v4 authentication (
https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html)
to the http module.

This would allow for example to play/store an MPEG DASH content stored on
an S3 Bucket which requires authentication.

I have the code ready, but it requires using
https://github.com/aws/SigV4-for-AWS-IoT-embedded-sdk library (which is
MIT, so there should be no license issues) and I am not sure what is the
best way of adding it to the configuration file and adding the conditional
compile flags to enable the feature or not.

Could anyone give me any pointers on what is the best way of doing this?

Best regards
Sergio
___
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 06/29] lavu/opt: add array options

2024-03-07 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> Anton Khirnov:
>> +/**
>> + * Must be set as default_val for AV_OPT_TYPE_FLAG_ARRAY options.
>> + */
>> +typedef struct AVOptionArrayDef {
>> +/**
>> + * Must be set to sizeof(AVOptionArrayDef), in order to allow extending 
>> this
>> + * struct without breaking ABI.
>> + */
>> +size_t  sizeof_self;
> 
> I do not really get the point of this field: It is not sufficient for
> detecting whether a user used a version that set a certain field due to
> trailing padding (i.e. an additional field need not increase
> sizeof(AVOptionArrayDef); this is actually relevant for this structure,
> because on x64 at least a new int/unsigned would fit into trailing padding).
> Luckily we already have a way to know the user's lavu version, as it is
> contained in the AVClass.
> 

I do not really see a reply to the above comment.

>> +
>> +/**
>> + * Native access only.
>> + *
>> + * Default value of the option, as would be serialized by av_opt_get() 
>> (i.e.
>> + * using the value of sep as the separator).
>> + */
>> +const char *def;
>> +
>> +/**
>> + * Minimum number of elements in the array. When this field is 
>> non-zero, def
>> + * must be non-NULL and contain at least this number of elements.
>> + */
>> +unsignedsize_min;
>> +/**
>> + * Maximum number of elements in the array, 0 when unlimited.
>> + */
>> +unsignedsize_max;
>> +
>> +/**
>> + * Separator between array elements in string representations of this
>> + * option, used by av_opt_set() and av_opt_get(). It must be a printable
>> + * ASCII character, excluding alphanumeric and the backslash. A comma is
>> + * used when sep=0.
>> + *
>> + * The separator and the backslash must be backslash-escaped in order to
>> + * appear in string representations of the option value.
>> + */
>> +uint8_t sep;
> 
> If this is a printable ASCII character, then it should be a char.
> 
>> +} AVOptionArrayDef;
>> +
>>  /**
>>   * AVOption
>>   */
>> @@ -320,8 +371,7 @@ typedef struct AVOption {
>>  enum AVOptionType type;
>>  
>>  /**
>> - * Native access only.
>> - *
>> + * Native access only, except when documented otherwise.
>>   * the default value for scalar options
>>   */
>>  union {
>> @@ -330,6 +380,14 @@ typedef struct AVOption {
>>  const char *str;
>>  /* TODO those are unused now */
>>  AVRational q;
>> +
>> +/**
>> + * Used for AV_OPT_TYPE_FLAG_ARRAY options. May be NULL.
>> + *
>> + * Foreign access to some members allowed, as noted in 
>> AVOptionArrayDef
>> + * documentation.
>> + */
>> +const AVOptionArrayDef *arr;
>>  } default_val;
>>  double min; ///< minimum valid value for the option
>>  double max; ///< maximum valid value for the option
> 
> ___
> 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 17/18] fftools/ffmpeg: add loopback decoding

2024-03-07 Thread Anton Khirnov
This allows to send an encoder's output back to decoding and feed the
result into a complex filtergraph.
---
Now using [dec:X] instead of [decX] in filtergraph link labels, as
suggested by Marvin on IRC.
---
 Changelog   |   1 +
 doc/ffmpeg.texi |  49 ++--
 fftools/cmdutils.c  |   2 +-
 fftools/cmdutils.h  |   7 +-
 fftools/ffmpeg.c|  26 +++
 fftools/ffmpeg.h|  22 ++
 fftools/ffmpeg_dec.c| 164 +++-
 fftools/ffmpeg_enc.c|  19 +
 fftools/ffmpeg_filter.c |  47 +++-
 fftools/ffmpeg_opt.c|  13 +++-
 10 files changed, 336 insertions(+), 14 deletions(-)

diff --git a/Changelog b/Changelog
index 0ba3a77c08..22186697fb 100644
--- a/Changelog
+++ b/Changelog
@@ -31,6 +31,7 @@ version :
 - removed deprecated ffmpeg CLI options -psnr and -map_channel
 - DVD-Video demuxer, powered by libdvdnav and libdvdread
 - ffprobe -show_stream_groups option
+- ffmpeg CLI loopback decoders
 
 
 version 6.1:
diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index bee3cd4c70..a38ef834e1 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -219,6 +219,40 @@ Since there is no decoding or encoding, it is very fast 
and there is no quality
 loss. However, it might not work in some cases because of many factors. 
Applying
 filters is obviously also impossible, since filters work on uncompressed data.
 
+@section Loopback decoders
+While decoders are normally associated with demuxer streams, it is also 
possible
+to create "loopback" decoders that decode the output from some encoder and 
allow
+it to be fed back to complex filtergraphs. This is done with the @code{-dec}
+directive, which takes as a parameter the index of the output stream that 
should
+be decoded. Every such directive creates a new loopback decoder, indexed with
+successive integers starting at zero. These indices should then be used to 
refer
+to loopback decoders in complex filtergraph link labels, as described in the
+documentation for @option{-filter_complex}.
+
+E.g. the following example:
+
+@example
+ffmpeg -i INPUT\
+  -map 0:v:0 -c:v libx264 -crf 45 -f null -\
+  -dec 0:0 -filter_complex '[0:v][dec:0]hstack[stack]' \
+  -map '[stack]' -c:v ffv1 OUTPUT
+@end example
+
+reads an input video and
+@itemize
+@item
+(line 2) encodes it with @code{libx264} at low quality;
+
+@item
+(line 3) decodes this encoded stream and places it side by side with the
+original input video;
+
+@item
+(line 4) combined video is then losslessly encoded and written into
+@file{OUTPUT}.
+
+@end itemize
+
 @c man end DETAILED DESCRIPTION
 
 @chapter Stream selection
@@ -2105,11 +2139,16 @@ type -- see the @option{-filter} options. 
@var{filtergraph} is a description of
 the filtergraph, as described in the ``Filtergraph syntax'' section of the
 ffmpeg-filters manual.
 
-Input link labels must refer to input streams using the
-@code{[file_index:stream_specifier]} syntax (i.e. the same as @option{-map}
-uses). If @var{stream_specifier} matches multiple streams, the first one will 
be
-used. An unlabeled input will be connected to the first unused input stream of
-the matching type.
+Input link labels must refer to either input streams or loopback decoders. For
+input streams, use the @code{[file_index:stream_specifier]} syntax (i.e. the
+same as @option{-map} uses). If @var{stream_specifier} matches multiple 
streams,
+the first one will be used.
+
+For decoders, the link label must be [dec:@var{dec_idx}], where @var{dec_idx} 
is
+the index of the loopback decoder to be connected to given input.
+
+An unlabeled input will be connected to the first unused input stream of the
+matching type.
 
 Output link labels are referred to with @option{-map}. Unlabeled outputs are
 added to the first output file.
diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 8efec942bd..f3c258bb99 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -528,7 +528,7 @@ static void check_options(const OptionDef *po)
 {
 while (po->name) {
 if (po->flags & OPT_PERFILE)
-av_assert0(po->flags & (OPT_INPUT | OPT_OUTPUT));
+av_assert0(po->flags & (OPT_INPUT | OPT_OUTPUT | OPT_DECODER));
 
 if (po->type == OPT_TYPE_FUNC)
 av_assert0(!(po->flags & (OPT_FLAG_OFFSET | OPT_FLAG_SPEC)));
diff --git a/fftools/cmdutils.h b/fftools/cmdutils.h
index 86428b3fa4..d0c773663b 100644
--- a/fftools/cmdutils.h
+++ b/fftools/cmdutils.h
@@ -144,8 +144,8 @@ typedef struct OptionDef {
 #define OPT_AUDIO   (1 << 4)
 #define OPT_SUBTITLE(1 << 5)
 #define OPT_DATA(1 << 6)
-/* The option is per-file (currently ffmpeg-only). At least one of OPT_INPUT or
- * OPT_OUTPUT must be set when this flag is in use.
+/* The option is per-file (currently ffmpeg-only). At least one of OPT_INPUT,
+ * OPT_OUTPUT, OPT_DECODER must be set when this flag is in use.
*/
 #define OPT_PERFILE (1 << 7)
 
@@ 

[FFmpeg-devel] [PATCH] fftools/ffmpeg_filter: do not assume av_buffersrc_get_nb_failed_requests()>0

2024-03-07 Thread Anton Khirnov
Apparently it can happen that avfilter_graph_request_oldest() returns
EAGAIN, yet av_buffersrc_get_nb_failed_requests() returns 0 for every
input.

Fixes #10795
---
 fftools/ffmpeg_filter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 13c5065191..dc7131c154 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -1889,7 +1889,7 @@ static void send_command(FilterGraph *fg, AVFilterGraph 
*graph,
 
 static int choose_input(const FilterGraph *fg, const FilterGraphThread *fgt)
 {
-int nb_requests, nb_requests_max = 0;
+int nb_requests, nb_requests_max = -1;
 int best_input = -1;
 
 for (int i = 0; i < fg->nb_inputs; i++) {
-- 
2.43.0

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

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


Re: [FFmpeg-devel] [RFC] clarifying the TC conflict of interest rule

2024-03-07 Thread Vittorio Giovara
On Thu, Mar 7, 2024 at 12:25 AM Michael Niedermayer via ffmpeg-devel <
ffmpeg-devel@ffmpeg.org> wrote:

> > instead of backroom deals, for a
> > change.
>
> iam sorry, but these accusations are not acceptable
> The application was and is on a public wiki
> the SoWs where collected by pierre and it was publically announced before.
> I tried to contact all people before the deadline who had incomplete
> submissions.
>

I think the backroom deals is referring to the months of silence between
*some people* knowing and the community being informed, plus the rushed 2
weeks voting time


> I think for a change you should say thanks to tara, pierre, SPI, STF and
> others
> doing all the work. Instead of accusations.
>

I don't see anybody thanking Anton for the work trying to solve the
contentious point on the rules
If anything he keeps being disparaged by conspiracy theorists, and getting
the discussion derailed


> And you should submit a proposal with SoW and all needed information
> next time. Similarly others should too. The idea of this was never to have
> just 2 people submit SoWs
>
>
> >
> > The application has apparently been submitted, with no public
> > announcement that it even happened, much less what was in it.
>
> whats in it, should simlpy be what was on the wiki application
> plus the fixes and cleanups mentioned above
>

Can you guys open a separate thread for these points? They have nothing to
do with the case at hand.
-- 
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 23/29] avcodec/mpeg12dec: use ff_frame_new_side_data

2024-03-07 Thread Anton Khirnov
Quoting James Almer (2024-03-07 13:25:07)
> I wouldn't. It adds an extra layer of abstraction for no real gain.

The gain is simpler API. What's the gain in forcing decoder authors to
call a different function to accomplish the same task, just because
frame threading happens to be used.

> And the name in this case is very specific and self explanatory in how
> it's different from the alternative.

>From decoder POV it's not different at all, it does exactly the same
thing.

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

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


Re: [FFmpeg-devel] [PATCH 23/29] avcodec/mpeg12dec: use ff_frame_new_side_data

2024-03-07 Thread James Almer

On 3/7/2024 9:18 AM, Anton Khirnov wrote:

Quoting Andreas Rheinhardt (2024-03-07 12:19:28)

Anton Khirnov:

Quoting Andreas Rheinhardt (2024-03-04 14:36:09)

Anton Khirnov:

From: Niklas Haas 

For consistency, even though this cannot be overriden at the packet
level.
---
  libavcodec/mpeg12dec.c | 18 ++
  1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 3a2f17e508..aa116336dd 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -2531,15 +2531,17 @@ static int mpeg_decode_frame(AVCodecContext *avctx, 
AVFrame *picture,
  
  if (s->timecode_frame_start != -1 && *got_output) {

  char tcbuf[AV_TIMECODE_STR_SIZE];
-AVFrameSideData *tcside = av_frame_new_side_data(picture,
- 
AV_FRAME_DATA_GOP_TIMECODE,
- sizeof(int64_t));
-if (!tcside)
-return AVERROR(ENOMEM);
-memcpy(tcside->data, >timecode_frame_start, sizeof(int64_t));
+AVFrameSideData *tcside;
+ret = ff_frame_new_side_data(avctx, picture, 
AV_FRAME_DATA_GOP_TIMECODE,
+ sizeof(int64_t), );
+if (ret < 0)
+return ret;
+if (tcside) {
+memcpy(tcside->data, >timecode_frame_start, 
sizeof(int64_t));
  
-av_timecode_make_mpeg_tc_string(tcbuf, s->timecode_frame_start);

-av_dict_set(>metadata, "timecode", tcbuf, 0);
+av_timecode_make_mpeg_tc_string(tcbuf, 
s->timecode_frame_start);
+av_dict_set(>metadata, "timecode", tcbuf, 0);
+}
  
  s->timecode_frame_start = -1;

  }


-1 to everything that is only done for consistency.


I prefer consistency here, otherwise the decoder authors have to choose
which function to use, and they are often not aware of the precise
implications of thise choice. Better to always use just one function.



It adds unnecessary checks and given that internal API is updated more
frequently it is likely to lead to unnecessary further changes lateron.
Furthermore, mjpeg still emits an allocation failure error message
without knowing whether it was really allocation failure.


"Could not allocate frame side data" seems appropriate to me, it really
is what happened, whatever the actual reason is.


Finally, if we really believed decoder authors to be that uninformed, we
should remove ff_get_buffer() from decoders altogether and only use the
ff_thread_get_buffer() wrapper.


I'd be in favor, fewer functions is better.


I wouldn't. It adds an extra layer of abstraction for no real gain. And 
the name in this case is very specific and self explanatory in how it's 
different from the alternative.

___
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 23/29] avcodec/mpeg12dec: use ff_frame_new_side_data

2024-03-07 Thread Anton Khirnov
Quoting Andreas Rheinhardt (2024-03-07 12:19:28)
> Anton Khirnov:
> > Quoting Andreas Rheinhardt (2024-03-04 14:36:09)
> >> Anton Khirnov:
> >>> From: Niklas Haas 
> >>>
> >>> For consistency, even though this cannot be overriden at the packet
> >>> level.
> >>> ---
> >>>  libavcodec/mpeg12dec.c | 18 ++
> >>>  1 file changed, 10 insertions(+), 8 deletions(-)
> >>>
> >>> diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
> >>> index 3a2f17e508..aa116336dd 100644
> >>> --- a/libavcodec/mpeg12dec.c
> >>> +++ b/libavcodec/mpeg12dec.c
> >>> @@ -2531,15 +2531,17 @@ static int mpeg_decode_frame(AVCodecContext 
> >>> *avctx, AVFrame *picture,
> >>>  
> >>>  if (s->timecode_frame_start != -1 && *got_output) {
> >>>  char tcbuf[AV_TIMECODE_STR_SIZE];
> >>> -AVFrameSideData *tcside = av_frame_new_side_data(picture,
> >>> - 
> >>> AV_FRAME_DATA_GOP_TIMECODE,
> >>> - 
> >>> sizeof(int64_t));
> >>> -if (!tcside)
> >>> -return AVERROR(ENOMEM);
> >>> -memcpy(tcside->data, >timecode_frame_start, 
> >>> sizeof(int64_t));
> >>> +AVFrameSideData *tcside;
> >>> +ret = ff_frame_new_side_data(avctx, picture, 
> >>> AV_FRAME_DATA_GOP_TIMECODE,
> >>> + sizeof(int64_t), );
> >>> +if (ret < 0)
> >>> +return ret;
> >>> +if (tcside) {
> >>> +memcpy(tcside->data, >timecode_frame_start, 
> >>> sizeof(int64_t));
> >>>  
> >>> -av_timecode_make_mpeg_tc_string(tcbuf, 
> >>> s->timecode_frame_start);
> >>> -av_dict_set(>metadata, "timecode", tcbuf, 0);
> >>> +av_timecode_make_mpeg_tc_string(tcbuf, 
> >>> s->timecode_frame_start);
> >>> +av_dict_set(>metadata, "timecode", tcbuf, 0);
> >>> +}
> >>>  
> >>>  s->timecode_frame_start = -1;
> >>>  }
> >>
> >> -1 to everything that is only done for consistency.
> > 
> > I prefer consistency here, otherwise the decoder authors have to choose
> > which function to use, and they are often not aware of the precise
> > implications of thise choice. Better to always use just one function.
> > 
> 
> It adds unnecessary checks and given that internal API is updated more
> frequently it is likely to lead to unnecessary further changes lateron.
> Furthermore, mjpeg still emits an allocation failure error message
> without knowing whether it was really allocation failure.

"Could not allocate frame side data" seems appropriate to me, it really
is what happened, whatever the actual reason is.

> Finally, if we really believed decoder authors to be that uninformed, we
> should remove ff_get_buffer() from decoders altogether and only use the
> ff_thread_get_buffer() wrapper.

I'd be in favor, fewer functions is better.

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

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


Re: [FFmpeg-devel] [PATCH 23/29] avcodec/mpeg12dec: use ff_frame_new_side_data

2024-03-07 Thread Andreas Rheinhardt
Anton Khirnov:
> Quoting Andreas Rheinhardt (2024-03-04 14:36:09)
>> Anton Khirnov:
>>> From: Niklas Haas 
>>>
>>> For consistency, even though this cannot be overriden at the packet
>>> level.
>>> ---
>>>  libavcodec/mpeg12dec.c | 18 ++
>>>  1 file changed, 10 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
>>> index 3a2f17e508..aa116336dd 100644
>>> --- a/libavcodec/mpeg12dec.c
>>> +++ b/libavcodec/mpeg12dec.c
>>> @@ -2531,15 +2531,17 @@ static int mpeg_decode_frame(AVCodecContext *avctx, 
>>> AVFrame *picture,
>>>  
>>>  if (s->timecode_frame_start != -1 && *got_output) {
>>>  char tcbuf[AV_TIMECODE_STR_SIZE];
>>> -AVFrameSideData *tcside = av_frame_new_side_data(picture,
>>> - 
>>> AV_FRAME_DATA_GOP_TIMECODE,
>>> - 
>>> sizeof(int64_t));
>>> -if (!tcside)
>>> -return AVERROR(ENOMEM);
>>> -memcpy(tcside->data, >timecode_frame_start, 
>>> sizeof(int64_t));
>>> +AVFrameSideData *tcside;
>>> +ret = ff_frame_new_side_data(avctx, picture, 
>>> AV_FRAME_DATA_GOP_TIMECODE,
>>> + sizeof(int64_t), );
>>> +if (ret < 0)
>>> +return ret;
>>> +if (tcside) {
>>> +memcpy(tcside->data, >timecode_frame_start, 
>>> sizeof(int64_t));
>>>  
>>> -av_timecode_make_mpeg_tc_string(tcbuf, 
>>> s->timecode_frame_start);
>>> -av_dict_set(>metadata, "timecode", tcbuf, 0);
>>> +av_timecode_make_mpeg_tc_string(tcbuf, 
>>> s->timecode_frame_start);
>>> +av_dict_set(>metadata, "timecode", tcbuf, 0);
>>> +}
>>>  
>>>  s->timecode_frame_start = -1;
>>>  }
>>
>> -1 to everything that is only done for consistency.
> 
> I prefer consistency here, otherwise the decoder authors have to choose
> which function to use, and they are often not aware of the precise
> implications of thise choice. Better to always use just one function.
> 

It adds unnecessary checks and given that internal API is updated more
frequently it is likely to lead to unnecessary further changes lateron.
Furthermore, mjpeg still emits an allocation failure error message
without knowing whether it was really allocation failure.
Finally, if we really believed decoder authors to be that uninformed, we
should remove ff_get_buffer() from decoders altogether and only use the
ff_thread_get_buffer() wrapper. Somehow I don't remember this difference
to ever be a problem.

- Andreas

___
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] lavc/vp9dsp: R-V V ipred dc

2024-03-07 Thread flow gg
updated it in the reply

flow gg  于2024年3月3日周日 23:31写道:

> > As noted eaerlier, I don't understand why you have two size parameters.
> It
> seems that \size is always either the same as (1 << (\size2 - 1)) a.k.a.
> ((1
> << \size2) / 2), or unused. The assembler *can* compute arithmetic
> constants.
>
> Thanks , I didn't know that before
>
> > Similarly, you can use \restore as a truth value directly: `.if
> \restore`.
>
> Okay
>
> FWIW, it seems that you could just as well include func/endfunc inside the
> macros.
>
> Do you mean to generate func/endfunc using macros?
>
> Rémi Denis-Courmont  于2024年3月3日周日 22:46写道:
>
>> Le sunnuntaina 3. maaliskuuta 2024, 3.59.00 EET flow gg a écrit :
>> > updated a little improve in this reply
>>
>> As noted eaerlier, I don't understand why you have two size parameters.
>> It
>> seems that \size is always either the same as (1 << (\size2 - 1)) a.k.a.
>> ((1
>> << \size2) / 2), or unused. The assembler *can* compute arithmetic
>> constants.
>>
>> Similarly, you can use \restore as a truth value directly: `.if \restore`.
>>
>> FWIW, it seems that you could just as well include func/endfunc inside
>> the
>> macros.
>>
>> --
>> レミ・デニ-クールモン
>> http://www.remlab.net/
>>
>>
>>
>> ___
>> 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".
>>
>
From ba101f21d108a906103c144bf0e67bd5f36fd6f1 Mon Sep 17 00:00:00 2001
From: sunyuechi 
Date: Mon, 26 Feb 2024 14:42:17 +0800
Subject: [PATCH 1/4] lavc/vp9dsp: R-V V ipred dc

C908:
vp9_dc_8x8_8bpp_c: 46.0
vp9_dc_8x8_8bpp_rvv_i64: 41.0
vp9_dc_16x16_8bpp_c: 109.2
vp9_dc_16x16_8bpp_rvv_i32: 72.7
vp9_dc_32x32_8bpp_c: 365.2
vp9_dc_32x32_8bpp_rvv_i32: 165.5
vp9_dc_127_8x8_8bpp_c: 23.0
vp9_dc_127_8x8_8bpp_rvv_i64: 22.0
vp9_dc_127_16x16_8bpp_c: 70.2
vp9_dc_127_16x16_8bpp_rvv_i32: 50.2
vp9_dc_127_32x32_8bpp_c: 295.2
vp9_dc_127_32x32_8bpp_rvv_i32: 136.7
vp9_dc_128_8x8_8bpp_c: 23.0
vp9_dc_128_8x8_8bpp_rvv_i64: 22.0
vp9_dc_128_16x16_8bpp_c: 70.2
vp9_dc_128_16x16_8bpp_rvv_i32: 50.2
vp9_dc_128_32x32_8bpp_c: 295.2
vp9_dc_128_32x32_8bpp_rvv_i32: 136.7
vp9_dc_129_8x8_8bpp_c: 23.0
vp9_dc_129_8x8_8bpp_rvv_i64: 22.0
vp9_dc_129_16x16_8bpp_c: 70.2
vp9_dc_129_16x16_8bpp_rvv_i32: 50.2
vp9_dc_129_32x32_8bpp_c: 295.2
vp9_dc_129_32x32_8bpp_rvv_i32: 136.7
vp9_dc_left_8x8_8bpp_c: 38.0
vp9_dc_left_8x8_8bpp_rvv_i64: 36.0
vp9_dc_left_16x16_8bpp_c: 93.2
vp9_dc_left_16x16_8bpp_rvv_i32: 67.7
vp9_dc_left_32x32_8bpp_c: 333.2
vp9_dc_left_32x32_8bpp_rvv_i32: 158.5
vp9_dc_top_8x8_8bpp_c: 38.7
vp9_dc_top_8x8_8bpp_rvv_i64: 36.0
vp9_dc_top_16x16_8bpp_c: 93.2
vp9_dc_top_16x16_8bpp_rvv_i32: 67.7
vp9_dc_top_32x32_8bpp_c: 333.2
vp9_dc_top_32x32_8bpp_rvv_i32: 156.2
---
 libavcodec/riscv/Makefile|   2 +
 libavcodec/riscv/vp9_intra_rvv.S | 171 +++
 libavcodec/riscv/vp9dsp.h|  64 
 libavcodec/riscv/vp9dsp_init.c   |  61 +++
 libavcodec/vp9dsp.c  |   2 +
 libavcodec/vp9dsp.h  |   1 +
 6 files changed, 301 insertions(+)
 create mode 100644 libavcodec/riscv/vp9_intra_rvv.S
 create mode 100644 libavcodec/riscv/vp9dsp.h
 create mode 100644 libavcodec/riscv/vp9dsp_init.c

diff --git a/libavcodec/riscv/Makefile b/libavcodec/riscv/Makefile
index dff8784102..c237e60800 100644
--- a/libavcodec/riscv/Makefile
+++ b/libavcodec/riscv/Makefile
@@ -60,5 +60,7 @@ OBJS-$(CONFIG_VC1DSP) += riscv/vc1dsp_init.o
 RVV-OBJS-$(CONFIG_VC1DSP) += riscv/vc1dsp_rvv.o
 OBJS-$(CONFIG_VP8DSP) += riscv/vp8dsp_init.o
 RVV-OBJS-$(CONFIG_VP8DSP) += riscv/vp8dsp_rvv.o
+OBJS-$(CONFIG_VP9_DECODER) += riscv/vp9dsp_init.o
+RVV-OBJS-$(CONFIG_VP9_DECODER) += riscv/vp9_intra_rvv.o
 OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_init.o
 RVV-OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_rvv.o
diff --git a/libavcodec/riscv/vp9_intra_rvv.S b/libavcodec/riscv/vp9_intra_rvv.S
new file mode 100644
index 00..b66f466f4b
--- /dev/null
+++ b/libavcodec/riscv/vp9_intra_rvv.S
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2024 Institue of Software Chinese Academy of Sciences (ISCAS).
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ 

Re: [FFmpeg-devel] [PATCH 1/3] avformat/dvdvideodec: add CLUT utilities and subtitle palette support

2024-03-07 Thread Andreas Rheinhardt
Anton Khirnov:
> Quoting Marth64 (2024-03-06 16:36:32)
>> Good morning,
>>
>> DVD subtitle palettes, which are natively YUV, are currently carried as
>> a hex string in their respective subtitle streams and have
>> no concept of colorspace tagging (even predating dvd demuxer). The
>> convention is to convert
>> them to RGB prior to storage. Common players will only render
>> the palettes properly if they are stored as RGB. Even ffmpeg itself
>> expects this, and already does -in libavformat- the YUV-RGB conversions,
>> specifically in mov.c and movenc.c.
>>
>> The point of this patch is to provide a consolidation of the code
>> that deals with creating the extradata as well as the RGB conversion.
>> That can then (1) enable usable palette support for DVD demuxer if it is
>> merged
>> and (2) start the process of consolidating the related conversions in
>> MOV muxer/demuxer and eventually find a way to properly tag
>> the colorspace.
> 
> Is there any reason ever to export YUV palette? Should this even be an
> option?
> 

Is the conversion lossless?

- Andreas

___
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/3] avformat/dvdvideodec: add CLUT utilities and subtitle palette support

2024-03-07 Thread Anton Khirnov
Quoting Marth64 (2024-03-06 16:36:32)
> Good morning,
> 
> DVD subtitle palettes, which are natively YUV, are currently carried as
> a hex string in their respective subtitle streams and have
> no concept of colorspace tagging (even predating dvd demuxer). The
> convention is to convert
> them to RGB prior to storage. Common players will only render
> the palettes properly if they are stored as RGB. Even ffmpeg itself
> expects this, and already does -in libavformat- the YUV-RGB conversions,
> specifically in mov.c and movenc.c.
> 
> The point of this patch is to provide a consolidation of the code
> that deals with creating the extradata as well as the RGB conversion.
> That can then (1) enable usable palette support for DVD demuxer if it is
> merged
> and (2) start the process of consolidating the related conversions in
> MOV muxer/demuxer and eventually find a way to properly tag
> the colorspace.

Is there any reason ever to export YUV palette? Should this even be an
option?

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

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


Re: [FFmpeg-devel] [PATCH] avutil/dict: Deduplicate freeing dictionary

2024-03-07 Thread epirat07
On 5 Mar 2024, at 16:53, Andreas Rheinhardt wrote:

> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavutil/dict.c | 10 --
>  1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/libavutil/dict.c b/libavutil/dict.c
> index 7f23d5336a..6fb09399ba 100644
> --- a/libavutil/dict.c
> +++ b/libavutil/dict.c
> @@ -145,11 +145,8 @@ int av_dict_set(AVDictionary **pm, const char *key, 
> const char *value,
>  m->elems[m->count].value = copy_value;
>  m->count++;
>  } else {
> -if (!m->count) {
> -av_freep(>elems);
> -av_freep(pm);
> -}
> -av_freep(_key);
> +err = 0;
> +goto end;
>  }
>
>  return 0;
> @@ -157,12 +154,13 @@ int av_dict_set(AVDictionary **pm, const char *key, 
> const char *value,
>  enomem:
>  err = AVERROR(ENOMEM);
>  err_out:
> +av_free(copy_value);
> +end:
>  if (m && !m->count) {
>  av_freep(>elems);
>  av_freep(pm);
>  }
>  av_free(copy_key);
> -av_free(copy_value);
>  return err;
>  }
>
> -- 
> 2.40.1

LGTM

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

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


Re: [FFmpeg-devel] [PATCH v5 1/3] avformat/flvdec: support enhanced flv PacketTypeMetadata

2024-03-07 Thread Steven Liu
zhupengfei via ffmpeg-devel  于2024年3月4日周一 21:52写道:
>
> From: Zhu Pengfei <411294...@qq.com>
>
> Signed-off-by: Zhu Pengfei <411294...@qq.com>
> ---
>  libavformat/flvdec.c | 177 ++-
>  1 file changed, 176 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
> index e25b5bd163..2a0aec7291 100644
> --- a/libavformat/flvdec.c
> +++ b/libavformat/flvdec.c
> @@ -33,6 +33,7 @@
>  #include "libavutil/internal.h"
>  #include "libavutil/intfloat.h"
>  #include "libavutil/intreadwrite.h"
> +#include "libavutil/mastering_display_metadata.h"
>  #include "libavutil/mathematics.h"
>  #include "avformat.h"
>  #include "demux.h"
> @@ -45,6 +46,28 @@
>
>  #define MAX_DEPTH 16  ///< arbitrary limit to prevent unbounded recursion
>
> +typedef struct FLVMasteringMeta {
> +double r_x;
> +double r_y;
> +double g_x;
> +double g_y;
> +double b_x;
> +double b_y;
> +double white_x;
> +double white_y;
> +double max_luminance;
> +double min_luminance;
> +} FLVMasteringMeta;
> +
> +typedef struct FLVMetaVideoColor {
> +uint64_t matrix_coefficients;
> +uint64_t transfer_characteristics;
> +uint64_t primaries;
> +uint64_t max_cll;
> +uint64_t max_fall;
> +FLVMasteringMeta mastering_meta;
> +} FLVMetaVideoColor;
> +
>  typedef struct FLVContext {
>  const AVClass *class; ///< Class for private options.
>  int trust_metadata;   ///< configure streams according onMetaData
> @@ -80,6 +103,8 @@ typedef struct FLVContext {
>  int64_t time_offset;
>  int64_t time_pos;
>
> +FLVMetaVideoColor *metaVideoColor;
> +int meta_color_info_flag;
>  } FLVContext;
>
>  /* AMF date type */
> @@ -524,6 +549,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream 
> *astream,
>  FLVContext *flv = s->priv_data;
>  AVIOContext *ioc;
>  AMFDataType amf_type;
> +FLVMetaVideoColor *meta_video_color = flv->metaVideoColor;
>  char str_val[1024];
>  double num_val;
>  amf_date date;
> @@ -672,6 +698,43 @@ static int amf_parse_object(AVFormatContext *s, AVStream 
> *astream,
>  }
>  }
>
> +if (meta_video_color) {
> +if (amf_type == AMF_DATA_TYPE_NUMBER ||
> +amf_type == AMF_DATA_TYPE_BOOL) {
> +if (!strcmp(key, "colorPrimaries")) {
> +meta_video_color->primaries = num_val;
> +} else if (!strcmp(key, "transferCharacteristics")) {
> +meta_video_color->transfer_characteristics = num_val;
> +} else if (!strcmp(key, "matrixCoefficients")) {
> +meta_video_color->matrix_coefficients = num_val;
> +} else if (!strcmp(key, "maxFall")) {
> +meta_video_color->max_fall = num_val;
> +} else if (!strcmp(key, "maxCLL")) {
> +meta_video_color->max_cll = num_val;
> +} else if (!strcmp(key, "redX")) {
> +meta_video_color->mastering_meta.r_x = num_val;
> +} else if (!strcmp(key, "redY")) {
> +meta_video_color->mastering_meta.r_y = num_val;
> +} else if (!strcmp(key, "greenX")) {
> +meta_video_color->mastering_meta.g_x = num_val;
> +} else if (!strcmp(key, "greenY")) {
> +meta_video_color->mastering_meta.g_y = num_val;
> +} else if (!strcmp(key, "blueX")) {
> +meta_video_color->mastering_meta.b_x = num_val;
> +} else if (!strcmp(key, "blueY")) {
> +meta_video_color->mastering_meta.b_y = num_val;
> +} else if (!strcmp(key, "whitePointX")) {
> +meta_video_color->mastering_meta.white_x = num_val;
> +} else if (!strcmp(key, "whitePointY")) {
> +meta_video_color->mastering_meta.white_y = num_val;
> +} else if (!strcmp(key, "maxLuminance")) {
> +meta_video_color->mastering_meta.max_luminance = num_val;
> +} else if (!strcmp(key, "minLuminance")) {
> +meta_video_color->mastering_meta.min_luminance = num_val;
> +}
> +}
> +}
> +
>  if (amf_type == AMF_DATA_TYPE_OBJECT && s->nb_streams == 1 &&
> ((!apar && !strcmp(key, "audiocodecid")) ||
>  (!vpar && !strcmp(key, "videocodecid"
> @@ -824,6 +887,7 @@ static int flv_read_close(AVFormatContext *s)
>  av_freep(>new_extradata[i]);
>  av_freep(>keyframe_times);
>  av_freep(>keyframe_filepositions);
> +av_freep(>metaVideoColor);
>  return 0;
>  }
>
> @@ -1028,6 +1092,103 @@ static int resync(AVFormatContext *s)
>  return AVERROR_EOF;
>  }
>
> +static int flv_parse_video_color_info(AVFormatContext *s, AVStream *st, 
> int64_t next_pos)
> +{
> +FLVContext *flv = 

Re: [FFmpeg-devel] [PATCH 01/29] lavu/opt: factor per-type dispatch out of av_opt_get()

2024-03-07 Thread Anton Khirnov
Will push the set tomorrow if nobody has further objections.

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

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


Re: [FFmpeg-devel] [PATCH] avcodec/ccaption_dec: Avoid relocations for strings

2024-03-07 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> The longest string here takes four bytes, so using an array
> of pointers is wasteful even when ignoring the cost of relocations;
> the lack of relocations also implies that this array
> will now be put into .rodata and not into .data.rel.ro.
> 
> Static asserts are used to ensure that all strings are always
> properly zero-terminated.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
> Now using static asserts to address the main point of
> criticism in 
> https://patchwork.ffmpeg.org/project/ffmpeg/patch/20210106081702.2495510-1-andreas.rheinha...@gmail.com/
> 
>  libavcodec/ccaption_dec.c | 215 --
>  1 file changed, 115 insertions(+), 100 deletions(-)
> 
> diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
> index 95143e7e46..1550e4b253 100644
> --- a/libavcodec/ccaption_dec.c
> +++ b/libavcodec/ccaption_dec.c
> @@ -67,108 +67,123 @@ enum cc_charset {
>  CCSET_EXTENDED_PORTUGUESE_GERMAN_DANISH,
>  };
>  
> -static const char *charset_overrides[4][128] =
> +#define CHARSET_OVERRIDE_LIST(START_SET, ENTRY, END_SET) \
> +START_SET(CCSET_BASIC_AMERICAN)  \
> +ENTRY(0x27, "\u2019")\
> +ENTRY(0x2a, "\u00e1")\
> +ENTRY(0x5c, "\u00e9")\
> +ENTRY(0x5e, "\u00ed")\
> +ENTRY(0x5f, "\u00f3")\
> +ENTRY(0x60, "\u00fa")\
> +ENTRY(0x7b, "\u00e7")\
> +ENTRY(0x7c, "\u00f7")\
> +ENTRY(0x7d, "\u00d1")\
> +ENTRY(0x7e, "\u00f1")\
> +ENTRY(0x7f, "\u2588")\
> +END_SET  \
> +START_SET(CCSET_SPECIAL_AMERICAN)\
> +ENTRY(0x30, "\u00ae")\
> +ENTRY(0x31, "\u00b0")\
> +ENTRY(0x32, "\u00bd")\
> +ENTRY(0x33, "\u00bf")\
> +ENTRY(0x34, "\u2122")\
> +ENTRY(0x35, "\u00a2")\
> +ENTRY(0x36, "\u00a3")\
> +ENTRY(0x37, "\u266a")\
> +ENTRY(0x38, "\u00e0")\
> +ENTRY(0x39, "\u00A0")\
> +ENTRY(0x3a, "\u00e8")\
> +ENTRY(0x3b, "\u00e2")\
> +ENTRY(0x3c, "\u00ea")\
> +ENTRY(0x3d, "\u00ee")\
> +ENTRY(0x3e, "\u00f4")\
> +ENTRY(0x3f, "\u00fb")\
> +END_SET  \
> +START_SET(CCSET_EXTENDED_SPANISH_FRENCH_MISC)\
> +ENTRY(0x20, "\u00c1")\
> +ENTRY(0x21, "\u00c9")\
> +ENTRY(0x22, "\u00d3")\
> +ENTRY(0x23, "\u00da")\
> +ENTRY(0x24, "\u00dc")\
> +ENTRY(0x25, "\u00fc")\
> +ENTRY(0x26, "\u00b4")\
> +ENTRY(0x27, "\u00a1")\
> +ENTRY(0x28, "*") \
> +ENTRY(0x29, "\u2018")\
> +ENTRY(0x2a, "-") \
> +ENTRY(0x2b, "\u00a9")\
> +ENTRY(0x2c, "\u2120")\
> +ENTRY(0x2d, "\u00b7")\
> +ENTRY(0x2e, "\u201c")\
> +ENTRY(0x2f, "\u201d")\
> +ENTRY(0x30, "\u00c0")\
> +ENTRY(0x31, "\u00c2")\
> +ENTRY(0x32, "\u00c7")\
> +ENTRY(0x33, "\u00c8")\
> +ENTRY(0x34, "\u00ca")\
> +ENTRY(0x35, "\u00cb")\
> +ENTRY(0x36, "\u00eb")\
> +ENTRY(0x37, "\u00ce")\
> +ENTRY(0x38, "\u00cf")\
> +ENTRY(0x39, "\u00ef")\
> +ENTRY(0x3a, "\u00d4")\
> +ENTRY(0x3b, "\u00d9")\
> +ENTRY(0x3c, "\u00f9")\
> +ENTRY(0x3d, "\u00db")\
> +ENTRY(0x3e, "\u00ab")

Re: [FFmpeg-devel] [PATCH] avutil/dict: Deduplicate freeing dictionary

2024-03-07 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavutil/dict.c | 10 --
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/libavutil/dict.c b/libavutil/dict.c
> index 7f23d5336a..6fb09399ba 100644
> --- a/libavutil/dict.c
> +++ b/libavutil/dict.c
> @@ -145,11 +145,8 @@ int av_dict_set(AVDictionary **pm, const char *key, 
> const char *value,
>  m->elems[m->count].value = copy_value;
>  m->count++;
>  } else {
> -if (!m->count) {
> -av_freep(>elems);
> -av_freep(pm);
> -}
> -av_freep(_key);
> +err = 0;
> +goto end;
>  }
>  
>  return 0;
> @@ -157,12 +154,13 @@ int av_dict_set(AVDictionary **pm, const char *key, 
> const char *value,
>  enomem:
>  err = AVERROR(ENOMEM);
>  err_out:
> +av_free(copy_value);
> +end:
>  if (m && !m->count) {
>  av_freep(>elems);
>  av_freep(pm);
>  }
>  av_free(copy_key);
> -av_free(copy_value);
>  return err;
>  }
>  

Will apply this patch tomorrow unless there are objections.

- Andreas

___
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/vdpau: Remove outdated comment

2024-03-07 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> Forgotten in b773a8d8c1dfe4cfc6eabf509e26ab011270b9ed.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/vdpau.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c
> index 2b9b78d8d0..c56ee1f44c 100644
> --- a/libavcodec/vdpau.c
> +++ b/libavcodec/vdpau.c
> @@ -34,9 +34,6 @@
>  #include "vdpau.h"
>  #include "vdpau_internal.h"
>  
> -// XXX: at the time of adding this ifdefery, av_assert* wasn't use outside.
> -// When dropping it, make sure other av_assert* were not added since then.
> -
>  /**
>   * @addtogroup VDPAU_Decoding
>   *

Will apply this patchset tomorrow unless there are objections.

- Andreas

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

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


Re: [FFmpeg-devel] [PATCH] checkasm/hevc_deblock: Initialize buffer

2024-03-07 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> Fixes the hevc_deblock checkasm test with Valgrind.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  tests/checkasm/hevc_deblock.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tests/checkasm/hevc_deblock.c b/tests/checkasm/hevc_deblock.c
> index 91e57f5cf5..04cf9d87ac 100644
> --- a/tests/checkasm/hevc_deblock.c
> +++ b/tests/checkasm/hevc_deblock.c
> @@ -227,6 +227,7 @@ static void check_deblock_luma(HEVCDSPContext *h, int 
> bit_depth, int c)
>  *ptr1 = buf1 + BUF_OFFSET;
>  
>  declare_func(void, uint8_t *pix, ptrdiff_t stride, int beta, int32_t 
> *tc, uint8_t *no_p, uint8_t *no_q);
> +memset(buf0, 0, BUF_SIZE);
>  
>  for (int j = 0; j < 3; j++) {
>  type = types[j];

Will apply this patch tomorrow unless there are objections.

- Andreas

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