Re: [FFmpeg-devel] [PATCH 1/3] avcodec/jpeg2000htdec: Avoid freeing uninitialized pointers in ff_jpeg2000_decode_htj2k()

2023-08-03 Thread Caleb Etemesi
Looks good, for the other two, I may need to check with a problematic
sample I had to see if it works

Kind regards,
Caleb Etemesi

On Thu, 3 Aug 2023, 23:58 Pierre-Anthony Lemieux,  wrote:

> On Thu, Aug 3, 2023 at 1:50 PM Tomas Härdin  wrote:
> >
> > tor 2023-08-03 klockan 17:36 +0200 skrev Michael Niedermayer:
> > > On Thu, Aug 03, 2023 at 10:20:29AM +0200, Tomas Härdin wrote:
> > > > ons 2023-08-02 klockan 02:01 +0200 skrev Michael Niedermayer:
> > > > > Fixes: freeing of uninitialized pointers
> > > > > Fixes: part of 58299
> > > > >
> > > > > Found-by: continuous fuzzing process
> > > > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > > > > Signed-off-by: Michael Niedermayer 
> > > > > ---
> > > > >  libavcodec/jpeg2000htdec.c | 4 ++--
> > > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > > >
> > > > > diff --git a/libavcodec/jpeg2000htdec.c
> > > > > b/libavcodec/jpeg2000htdec.c
> > > > > index 4c4e54710d..2b082b3b2f 100644
> > > > > --- a/libavcodec/jpeg2000htdec.c
> > > > > +++ b/libavcodec/jpeg2000htdec.c
> > > > > @@ -1174,8 +1174,8 @@ ff_jpeg2000_decode_htj2k(const
> > > > > Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c
> > > > >  int ret;
> > > > >
> > > > >  /* Temporary buffers */
> > > > > -int32_t *sample_buf;
> > > > > -uint8_t *block_states;
> > > > > +int32_t *sample_buf = NULL;
> > > > > +uint8_t *block_states = NULL;
> > > >
> > > > Looks OK
> > >
> > > will apply
> >
> > I should add that I don't know if the two other patches are fine
>
> I am working on them.
>
> >
> > /Tomas
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> ___
> 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 v4 1/9] libavutil: add hwcontext_d3d12va and AV_PIX_FMT_D3D12

2023-08-03 Thread Xiang, Haihao
On Wo, 2023-07-19 at 18:01 +0800, Tong Wu wrote:
> From: Wu Jianhua 
> 
> Signed-off-by: Wu Jianhua 
> Signed-off-by: Tong Wu 
> ---
>  configure  |   5 +
>  doc/APIchanges |   7 +
>  libavutil/Makefile |   3 +
>  libavutil/hwcontext.c  |   4 +
>  libavutil/hwcontext.h  |   1 +
>  libavutil/hwcontext_d3d12va.c  | 702 +
>  libavutil/hwcontext_d3d12va.h  | 167 ++
>  libavutil/hwcontext_d3d12va_internal.h |  54 ++
>  libavutil/hwcontext_internal.h |   1 +
>  libavutil/pixdesc.c    |   4 +
>  libavutil/pixfmt.h |   9 +
>  libavutil/tests/hwdevice.c |   2 +
>  12 files changed, 959 insertions(+)
>  create mode 100644 libavutil/hwcontext_d3d12va.c
>  create mode 100644 libavutil/hwcontext_d3d12va.h
>  create mode 100644 libavutil/hwcontext_d3d12va_internal.h
> 
> diff --git a/configure b/configure
> index b018abf139..5cbda83d4d 100755
> --- a/configure
> +++ b/configure
> @@ -338,6 +338,7 @@ External library support:
>    --disable-cuda-llvm  disable CUDA compilation using clang [autodetect]
>    --disable-cuvid  disable Nvidia CUVID support [autodetect]
>    --disable-d3d11va    disable Microsoft Direct3D 11 video acceleration
> code [autodetect]
> +  --disable-d3d12va    disable Microsoft Direct3D 12 video acceleration
> code [autodetect]
>    --disable-dxva2  disable Microsoft DirectX 9 video acceleration
> code [autodetect]
>    --disable-ffnvcodec  disable dynamically linked Nvidia code
> [autodetect]
>    --enable-libdrm  enable DRM code (Linux) [no]
> @@ -1926,6 +1927,7 @@ HWACCEL_AUTODETECT_LIBRARY_LIST="
>  cuda_llvm
>  cuvid
>  d3d11va
> +    d3d12va
>  dxva2
>  ffnvcodec
>  nvdec
> @@ -3054,6 +3056,7 @@ crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
>  cuda_deps="ffnvcodec"
>  cuvid_deps="ffnvcodec"
>  d3d11va_deps="dxva_h ID3D11VideoDecoder ID3D11VideoContext"
> +d3d12va_deps="dxva_h ID3D12Device ID3D12VideoDecoder"
>  dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode ole32 user32"
>  ffnvcodec_deps_any="libdl LoadLibrary"
>  mediacodec_deps="android"
> @@ -6541,6 +6544,8 @@ check_type "windows.h dxgi1_2.h" "IDXGIOutput1"
>  check_type "windows.h dxgi1_5.h" "IDXGIOutput5"
>  check_type "windows.h d3d11.h" "ID3D11VideoDecoder"
>  check_type "windows.h d3d11.h" "ID3D11VideoContext"
> +check_type "windows.h d3d12.h" "ID3D12Device"
> +check_type "windows.h d3d12video.h" "ID3D12VideoDecoder"
>  check_type "windows.h" "DPI_AWARENESS_CONTEXT" -D_WIN32_WINNT=0x0A00
>  check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -
> D_WIN32_WINNT=0x0602
>  check_func_headers mfapi.h MFCreateAlignedMemoryBuffer -lmfplat
> diff --git a/doc/APIchanges b/doc/APIchanges
> index 5afe8bcb75..c14ab0b394 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -2,6 +2,13 @@ The last version increases of all libraries were on 2023-02-
> 09
>  
>  API changes, most recent first:
>  
> +2023-07-xx - xx - lavu 58.15.100 - pixfmt.h hwcontext.h
> hwcontext_d3d12va.h

Seems you forgot to bump a new version in libavutil/version.h

Thanks
Haihao

> +  Add AV_HWDEVICE_TYPE_D3D12VA and AV_PIX_FMT_D3D12.
> +  Add AVD3D12VADeviceContext, AVD3D12VASyncContext, AVD3D12FrameDescriptor,
> +  and AVD3D12VAFramesContext.
> +  Add av_d3d12va_map_sw_to_hw_format, av_d3d12va_create_sync_context,
> +  av_d3d12va_release_sync_context, av_d3d12va_wait_idle, and
> av_d3d12va_wait_queue_idle.
> +
>  2023-07-xx - xx - lavc 60 - avcodec.h
>    Deprecate AV_CODEC_FLAG_DROPCHANGED without replacement.
>  
> diff --git a/libavutil/Makefile b/libavutil/Makefile
> index bd9c6f9e32..40d49d76dd 100644
> --- a/libavutil/Makefile
> +++ b/libavutil/Makefile
> @@ -41,6 +41,7 @@ HEADERS =
> adler32.h \
>    hwcontext.h   \
>    hwcontext_cuda.h  \
>    hwcontext_d3d11va.h   \
> +  hwcontext_d3d12va.h   \
>    hwcontext_drm.h   \
>    hwcontext_dxva2.h \
>    hwcontext_qsv.h   \
> @@ -186,6 +187,7 @@ OBJS =
> adler32.o    \
>  
>  OBJS-$(CONFIG_CUDA) += hwcontext_cuda.o
>  OBJS-$(CONFIG_D3D11VA)  += hwcontext_d3d11va.o
> +OBJS-$(CONFIG_D3D12VA)  += hwcontext_d3d12va.o
>  OBJS-$(CONFIG_DXVA2)    += hwcontext_dxva2.o
>  OBJS-$(CONFIG_LIBDRM)   += hwcontext_drm.o
>  OBJS-$(CONFIG_MACOS_KPERF)  += macos_kperf.o
> @@ -209,6 +211,7 @@ 

[FFmpeg-devel] [PATCH] avformat/flvdec: remove unused context member of flv

2023-08-03 Thread Steven Liu
The exheader is unnecessary after 207e9f4e505d969d6ff7545b449295a1b88d6d1c
Iust use local varible can do the same function.

Signed-off-by: Steven Liu 
---
 libavformat/flvdec.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index bdcf96b4ae..e25b5bd163 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -80,7 +80,6 @@ typedef struct FLVContext {
 int64_t time_offset;
 int64_t time_pos;
 
-uint8_t exheader;
 } FLVContext;
 
 /* AMF date type */
@@ -813,7 +812,6 @@ static int flv_read_header(AVFormatContext *s)
 s->start_time = 0;
 flv->sum_flv_tag_size = 0;
 flv->last_keyframe_stream_index = -1;
-flv->exheader = 0;
 
 return 0;
 }
@@ -1043,6 +1041,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 AVStream *st= NULL;
 int last = -1;
 int orig_size;
+int enhanced_flv = 0;
 uint32_t video_codec_id = 0;
 
 retry:
@@ -1095,9 +1094,9 @@ retry:
  * Reference Enhancing FLV 2023-03-v1.0.0-B.8
  * 
https://github.com/veovera/enhanced-rtmp/blob/main/enhanced-rtmp-v1.pdf
  * */
-flv->exheader = (flags >> 7) & 1;
+enhanced_flv = (flags >> 7) & 1;
 size--;
-if (flv->exheader) {
+if (enhanced_flv) {
 video_codec_id = avio_rb32(s->pb);
 size -= 4;
 }
@@ -1276,7 +1275,7 @@ retry_duration:
 st->codecpar->codec_id == AV_CODEC_ID_AV1 ||
 st->codecpar->codec_id == AV_CODEC_ID_VP9) {
 int type = 0;
-if (flv->exheader && stream_type == FLV_STREAM_TYPE_VIDEO) {
+if (enhanced_flv && stream_type == FLV_STREAM_TYPE_VIDEO) {
 type = flags & 0x0F;
 } else {
 type = avio_r8(s->pb);
-- 
2.40.0

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

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


[FFmpeg-devel] [PATCH v2 1/2] lavu/tx: add real to real and real to imaginary RDFT transforms

2023-08-03 Thread Lynne
These are in-place transforms, required for DCT-I and DST-I.

Templated as the mod2 variant requires minor modifications, and is
required specifically for DCT-I/DST-I.

>From c12c72e9de37a9eedf83e8ceb5ee444575420237 Mon Sep 17 00:00:00 2001
From: Lynne 
Date: Thu, 3 Aug 2023 18:21:23 +0200
Subject: [PATCH v2 1/2] lavu/tx: add real to real and real to imaginary RDFT
 transforms

These are in-place transforms, required for DCT-I and DST-I.

Templated as the mod2 variant requires minor modifications, and is
required specifically for DCT-I/DST-I.
---
 doc/APIchanges  |   3 +
 libavutil/tx.c  |  18 -
 libavutil/tx.h  |  10 +++
 libavutil/tx_template.c | 175 +++-
 libavutil/version.h |   2 +-
 5 files changed, 167 insertions(+), 41 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 5afe8bcb75..edd178be4f 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09
 
 API changes, most recent first:
 
+2023-07-xx - xx - lavu 58.15.100 - tx.h
+  Add AV_TX_REAL_TO_REAL and AV_TX_REAL_TO_IMAGINARY
+
 2023-07-xx - xx - lavc 60 - avcodec.h
   Deprecate AV_CODEC_FLAG_DROPCHANGED without replacement.
 
diff --git a/libavutil/tx.c b/libavutil/tx.c
index e25abf998f..e9826e6107 100644
--- a/libavutil/tx.c
+++ b/libavutil/tx.c
@@ -437,7 +437,9 @@ int ff_tx_decompose_length(int dst[TX_MAX_DECOMPOSITIONS], enum AVTXType type,
 
 /* Check direction for non-orthogonal codelets */
 if (((cd->flags & FF_TX_FORWARD_ONLY) && inv) ||
-((cd->flags & (FF_TX_INVERSE_ONLY | AV_TX_FULL_IMDCT)) && !inv))
+((cd->flags & (FF_TX_INVERSE_ONLY | AV_TX_FULL_IMDCT)) && !inv) ||
+((cd->flags & (FF_TX_FORWARD_ONLY | AV_TX_REAL_TO_REAL)) && inv) ||
+((cd->flags & (FF_TX_FORWARD_ONLY | AV_TX_REAL_TO_IMAGINARY)) && inv))
 continue;
 
 /* Check if the CPU supports the required ISA */
@@ -560,6 +562,10 @@ static void print_flags(AVBPrint *bp, uint64_t f)
 av_bprintf(bp, "%spreshuf", prev > 1 ? sep : "");
 if ((f & AV_TX_FULL_IMDCT) && ++prev)
 av_bprintf(bp, "%simdct_full", prev > 1 ? sep : "");
+if ((f & AV_TX_REAL_TO_REAL) && ++prev)
+av_bprintf(bp, "%sreal_to_real", prev > 1 ? sep : "");
+if ((f & AV_TX_REAL_TO_IMAGINARY) && ++prev)
+av_bprintf(bp, "%sreal_to_imaginary", prev > 1 ? sep : "");
 if ((f & FF_TX_ASM_CALL) && ++prev)
 av_bprintf(bp, "%sasm_call", prev > 1 ? sep : "");
 av_bprintf(bp, "]");
@@ -717,7 +723,11 @@ av_cold int ff_tx_init_subtx(AVTXContext *s, enum AVTXType type,
 uint64_t req_flags = flags;
 
 /* Flags the codelet may require to be present */
-uint64_t inv_req_mask = AV_TX_FULL_IMDCT | FF_TX_PRESHUFFLE | FF_TX_ASM_CALL;
+uint64_t inv_req_mask = AV_TX_FULL_IMDCT |
+AV_TX_REAL_TO_REAL |
+AV_TX_REAL_TO_IMAGINARY |
+FF_TX_PRESHUFFLE |
+FF_TX_ASM_CALL;
 
 /* Unaligned codelets are compatible with the aligned flag */
 if (req_flags & FF_TX_ALIGNED)
@@ -742,7 +752,9 @@ av_cold int ff_tx_init_subtx(AVTXContext *s, enum AVTXType type,
 
 /* Check direction for non-orthogonal codelets */
 if (((cd->flags & FF_TX_FORWARD_ONLY) && inv) ||
-((cd->flags & (FF_TX_INVERSE_ONLY | AV_TX_FULL_IMDCT)) && !inv))
+((cd->flags & (FF_TX_INVERSE_ONLY | AV_TX_FULL_IMDCT)) && !inv) ||
+((cd->flags & (FF_TX_FORWARD_ONLY | AV_TX_REAL_TO_REAL)) && inv) ||
+((cd->flags & (FF_TX_FORWARD_ONLY | AV_TX_REAL_TO_IMAGINARY)) && inv))
 continue;
 
 /* Check if the requested flags match from both sides */
diff --git a/libavutil/tx.h b/libavutil/tx.h
index 064edbc097..d178e8ee9d 100644
--- a/libavutil/tx.h
+++ b/libavutil/tx.h
@@ -149,6 +149,16 @@ enum AVTXFlags {
  * Ignored for all transforms but inverse MDCTs.
  */
 AV_TX_FULL_IMDCT = 1ULL << 2,
+
+/**
+ * Perform a real to half-complex RDFT.
+ * Only the real, or imaginary coefficients will
+ * be output, depending on the flag used. Only available for forward RDFTs.
+ * Output array must have enough space to hold N complex values
+ * (regular size for a real to complex transform).
+ */
+AV_TX_REAL_TO_REAL  = 1ULL << 3,
+AV_TX_REAL_TO_IMAGINARY = 1ULL << 4,
 };
 
 /**
diff --git a/libavutil/tx_template.c b/libavutil/tx_template.c
index c4ec9502e0..c56dcf0826 100644
--- a/libavutil/tx_template.c
+++ b/libavutil/tx_template.c
@@ -1613,14 +1613,17 @@ static av_cold int TX_NAME(ff_tx_rdft_init)(AVTXContext *s,
 int ret;
 double f, m;
 TXSample *tab;
+int len4 = FFALIGN(len, 4) / 4;
 
 s->scale_d = *((SCALE_TYPE *)scale);
 s->scale_f = s->scale_d;
 
+flags 

Re: [FFmpeg-devel] [PATCH 1/2] lavu/tx: add real to real and real to imaginary RDFT transforms

2023-08-03 Thread Lynne
Aug 3, 2023, 22:39 by andreas.rheinha...@outlook.com:

> Michael Niedermayer:
>
>> On Thu, Aug 03, 2023 at 06:26:16PM +0200, Lynne wrote:
>>
>>> These are in-place transforms, required for DCT-I and DST-I.
>>>
>>> Templated as the mod2 variant requires minor modifications, and is
>>> required specifically for DCT-I/DST-I.
>>>
>>> Quite optimized, as there's no need for any additional buffer storage.
>>>
>>> doc/APIchanges  |3 
>>>  libavutil/tx.c  |   18 
>>>  libavutil/tx.h  |   10 ++
>>>  libavutil/tx_template.c |  175 
>>> +---
>>>  libavutil/version.h |2 
>>>  5 files changed, 167 insertions(+), 41 deletions(-)
>>> 6e6308365cd78a84c7db5800207e6b5977945079  
>>> 0001-lavu-tx-add-real-to-real-and-real-to-imaginary-RDFT-.patch
>>> From 2ea5e2541c2551bf1b56e967d35946289a85aa49 Mon Sep 17 00:00:00 2001
>>> From: Lynne 
>>> Date: Thu, 3 Aug 2023 18:21:23 +0200
>>> Subject: [PATCH 1/2] lavu/tx: add real to real and real to imaginary RDFT
>>>  transforms
>>>
>>> These are in-place transforms, required for DCT-I and DST-I.
>>>
>>> Templated as the mod2 variant requires minor modifications, and is
>>> required specifically for DCT-I/DST-I.
>>>
>>
>> not sure if i forgot some patch but
>> this seems to break fate-binkaudio-dct
>>
>
> It's not just you; patchwork reported four failing tests:
> make: *** [fate-filter-firequalizer] Error 218
> make: *** [fate-binkaudio-rdft] Error 218
> make: *** [fate-binkaudio-dct] Error 218
> make: *** [fate-qdm2] Error 218
>
> - Andreas
>

Thanks, I had a typo on the standard, non-half RDFTs. One line change:

@@ -1711,7 +1703,7 @@ static const FFTXCodelet TX_NAME(ff_tx_rdft_ ##n## _def) 
= {   \
 .function   = TX_NAME(ff_tx_rdft_ ##n),    
\
 .type   = TX_TYPE(RDFT),   
\
 .flags  = AV_TX_UNALIGNED | AV_TX_INPLACE | FF_TX_OUT_OF_PLACE |   
\
-  inv ? FF_TX_INVERSE_ONLY : FF_TX_FORWARD_ONLY,   
\
+  (inv ? FF_TX_INVERSE_ONLY : FF_TX_FORWARD_ONLY), 
\
 .factors    = { 4, TX_FACTOR_ANY },    
\
 .nb_factors = 2,   
\
 .min_len    = 4,   
\

V2 sent.
___
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 7/7] avcodec/qsvenc: Remove unnecessary config_components.h inclusion

2023-08-03 Thread Andreas Rheinhardt
While just at it, also improve the other headers a bit.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/qsvenc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index df63c182b0..7ff9d333a2 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -21,12 +21,11 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "config_components.h"
-
 #include 
 #include 
 #include 
 
+#include "libavutil/avassert.h"
 #include "libavutil/common.h"
 #include "libavutil/hwcontext.h"
 #include "libavutil/hwcontext_qsv.h"
@@ -34,7 +33,6 @@
 #include "libavutil/log.h"
 #include "libavutil/time.h"
 #include "libavutil/imgutils.h"
-#include "libavcodec/bytestream.h"
 
 #include "avcodec.h"
 #include "internal.h"
-- 
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".


[FFmpeg-devel] [PATCH 6/7] avfilter: Remove unnecessary formats.h inclusions

2023-08-03 Thread Andreas Rheinhardt
A filter needs formats.h iff it uses FILTER_QUERY_FUNC();
since lots of filters have been switched to use something
else than FILTER_QUERY_FUNC, they don't need it any more,
but removing this header has been forgotten.
This commit does this; files with formats.h inclusion went down
from 304 to 139 here (it were 449 before the preceding commit).

While just at it, also improve the other headers a bit.

Signed-off-by: Andreas Rheinhardt 
---
 libavfilter/af_acontrast.c | 1 -
 libavfilter/af_adeclick.c  | 1 -
 libavfilter/af_adecorrelate.c  | 1 -
 libavfilter/af_adynamicsmooth.c| 1 -
 libavfilter/af_afftdn.c| 1 -
 libavfilter/af_afreqshift.c| 1 -
 libavfilter/af_afwtdn.c| 2 --
 libavfilter/af_alimiter.c  | 1 -
 libavfilter/af_amix.c  | 1 -
 libavfilter/af_amultiply.c | 2 --
 libavfilter/af_anlmdn.c| 2 --
 libavfilter/af_anlms.c | 1 -
 libavfilter/af_arls.c  | 1 -
 libavfilter/af_asdr.c  | 3 ---
 libavfilter/af_asetnsamples.c  | 1 -
 libavfilter/af_asoftclip.c | 1 -
 libavfilter/af_asubboost.c | 1 -
 libavfilter/af_asupercut.c | 1 -
 libavfilter/af_atilt.c | 1 -
 libavfilter/af_axcorrelate.c   | 1 -
 libavfilter/af_crystalizer.c   | 1 -
 libavfilter/af_deesser.c   | 1 -
 libavfilter/af_rubberband.c| 1 -
 libavfilter/af_silencedetect.c | 1 -
 libavfilter/af_silenceremove.c | 2 --
 libavfilter/afir_template.c| 1 -
 libavfilter/blend_modes.c  | 1 -
 libavfilter/edge_template.c| 1 -
 libavfilter/f_bench.c  | 1 -
 libavfilter/f_interleave.c | 1 -
 libavfilter/f_latency.c| 2 --
 libavfilter/f_loop.c   | 2 --
 libavfilter/f_metadata.c   | 1 -
 libavfilter/f_reverse.c| 3 ---
 libavfilter/f_sidedata.c   | 1 -
 libavfilter/median_template.c  | 1 -
 libavfilter/opencl.c   | 1 -
 libavfilter/phase_template.c   | 1 -
 libavfilter/split.c| 2 --
 libavfilter/vf_amplify.c   | 2 --
 libavfilter/vf_atadenoise.c| 1 -
 libavfilter/vf_avgblur.c   | 1 -
 libavfilter/vf_backgroundkey.c | 3 +--
 libavfilter/vf_bilateral.c | 1 -
 libavfilter/vf_bilateral_cuda.c| 4 
 libavfilter/vf_bitplanenoise.c | 3 +--
 libavfilter/vf_blackframe.c| 1 -
 libavfilter/vf_bm3d.c  | 1 -
 libavfilter/vf_bwdif.c | 3 ---
 libavfilter/vf_cas.c   | 1 -
 libavfilter/vf_chromakey.c | 4 +---
 libavfilter/vf_chromakey_cuda.c| 4 
 libavfilter/vf_chromanr.c  | 2 --
 libavfilter/vf_chromashift.c   | 4 
 libavfilter/vf_colorbalance.c  | 1 -
 libavfilter/vf_colorchannelmixer.c | 1 -
 libavfilter/vf_colorconstancy.c| 2 --
 libavfilter/vf_colorcontrast.c | 3 +--
 libavfilter/vf_colorcorrect.c  | 3 +--
 libavfilter/vf_colorize.c  | 3 +--
 libavfilter/vf_colorkey.c  | 4 +---
 libavfilter/vf_colorkey_opencl.c   | 2 --
 libavfilter/vf_colorlevels.c   | 2 --
 libavfilter/vf_colormatrix.c   | 2 --
 libavfilter/vf_colorspace_cuda.c   | 4 
 libavfilter/vf_colortemperature.c  | 3 +--
 libavfilter/vf_convolution.c   | 1 -
 libavfilter/vf_convolve.c  | 3 ---
 libavfilter/vf_corr.c  | 2 --
 libavfilter/vf_cropdetect.c| 1 -
 libavfilter/vf_dblur.c | 1 -
 libavfilter/vf_deblock.c   | 1 -
 libavfilter/vf_dedot.c | 2 --
 libavfilter/vf_deflicker.c | 1 -
 libavfilter/vf_deinterlace_vaapi.c | 1 -
 libavfilter/vf_delogo.c| 1 -
 libavfilter/vf_derain.c| 2 --
 libavfilter/vf_deshake_opencl.c| 3 +--
 libavfilter/vf_despill.c   | 4 +---
 libavfilter/vf_displace.c  | 2 --
 libavfilter/vf_dnn_processing.c| 2 --
 libavfilter/vf_drawbox.c   | 1 -
 libavfilter/vf_entropy.c   | 2 --
 libavfilter/vf_estdif.c| 1 -
 libavfilter/vf_exposure.c  | 2 --
 libavfilter/vf_fillborders.c   | 1 -
 libavfilter/vf_floodfill.c | 3 +--
 libavfilter/vf_framepack.c | 1 -
 libavfilter/vf_gblur.c | 1 -
 libavfilter/vf_gradfun.c   | 1 -
 libavfilter/vf_grayworld.c | 2 --
 libavfilter/vf_guided.c| 1 -
 libavfilter/vf_histeq.c| 1 -
 libavfilter/vf_hqdn3d.c| 1 -
 libavfilter/vf_hsvkey.c| 4 +---
 libavfilter/vf_hue.c   | 1 -
 libavfilter/vf_huesaturation.c | 3 +--
 libavfilter/vf_hysteresis.c| 1 -
 libavfilter/vf_identity.c  | 2 --
 libavfilter/vf_kerndeint.c | 1 -
 libavfilter/vf_lagfun.c| 2 --
 libavfilter/vf_lensfun.c   | 1 -
 libavfilter/vf_limitdiff.c | 1 -
 libavfilter/vf_limiter.c   | 1 -
 libavfilter/vf_lumakey.c   | 3 +--
 libavfilter/vf_maskedclamp.c   | 1 -
 

[FFmpeg-devel] [PATCH 5/7] avfilter/internal: Don't include formats.h

2023-08-03 Thread Andreas Rheinhardt
internal.h doesn't rely on it; instead include it directly
in every user that needs it (a filter needing it is basically
equivalent to it using FILTER_QUERY_FUNC, i.e. a majority of
filters doesn't need it).

Signed-off-by: Andreas Rheinhardt 
---
 libavfilter/aeval.c | 1 +
 libavfilter/af_aiir.c   | 1 +
 libavfilter/af_amerge.c | 1 +
 libavfilter/af_anequalizer.c| 1 +
 libavfilter/af_apulsator.c  | 1 +
 libavfilter/af_aresample.c  | 1 +
 libavfilter/af_asetrate.c   | 1 +
 libavfilter/af_asr.c| 1 +
 libavfilter/af_biquads.c| 1 +
 libavfilter/af_dialoguenhance.c | 1 +
 libavfilter/af_hdcd.c   | 1 +
 libavfilter/af_headphone.c  | 1 +
 libavfilter/af_ladspa.c | 1 +
 libavfilter/af_loudnorm.c   | 1 +
 libavfilter/af_lv2.c| 1 +
 libavfilter/af_replaygain.c | 1 +
 libavfilter/af_sofalizer.c  | 1 +
 libavfilter/af_virtualbass.c| 1 +
 libavfilter/asrc_afdelaysrc.c   | 1 +
 libavfilter/asrc_afirsrc.c  | 1 +
 libavfilter/asrc_anoisesrc.c| 1 +
 libavfilter/asrc_anullsrc.c | 1 +
 libavfilter/asrc_hilbert.c  | 1 +
 libavfilter/asrc_sinc.c | 1 +
 libavfilter/asrc_sine.c | 1 +
 libavfilter/avf_concat.c| 1 +
 libavfilter/avf_showcqt.c   | 1 +
 libavfilter/avf_showcwt.c   | 1 +
 libavfilter/avf_showfreqs.c | 1 +
 libavfilter/avf_showspatial.c   | 1 +
 libavfilter/avf_showspectrum.c  | 1 +
 libavfilter/buffersink.c| 1 +
 libavfilter/internal.h  | 1 -
 libavfilter/vf_copy.c   | 1 +
 libavfilter/vf_deband.c | 1 +
 libavfilter/vf_elbg.c   | 1 +
 libavfilter/vf_extractplanes.c  | 1 +
 libavfilter/vf_feedback.c   | 1 +
 libavfilter/vf_fieldhint.c  | 1 +
 libavfilter/vf_fieldmatch.c | 1 +
 libavfilter/vf_geq.c| 1 +
 libavfilter/vf_il.c | 1 +
 libavfilter/vf_libplacebo.c | 1 +
 libavfilter/vf_mergeplanes.c| 1 +
 libavfilter/vf_palettegen.c | 1 +
 libavfilter/vf_paletteuse.c | 1 +
 libavfilter/vf_shuffleplanes.c  | 1 +
 libavfilter/vf_weave.c  | 1 +
 48 files changed, 47 insertions(+), 1 deletion(-)

diff --git a/libavfilter/aeval.c b/libavfilter/aeval.c
index 94d7690ef4..b26d75f129 100644
--- a/libavfilter/aeval.c
+++ b/libavfilter/aeval.c
@@ -33,6 +33,7 @@
 #include "avfilter.h"
 #include "audio.h"
 #include "filters.h"
+#include "formats.h"
 #include "internal.h"
 
 static const char * const var_names[] = {
diff --git a/libavfilter/af_aiir.c b/libavfilter/af_aiir.c
index 28f452f4a1..41709aa360 100644
--- a/libavfilter/af_aiir.c
+++ b/libavfilter/af_aiir.c
@@ -26,6 +26,7 @@
 #include "libavutil/xga_font_data.h"
 #include "audio.h"
 #include "avfilter.h"
+#include "formats.h"
 #include "internal.h"
 #include "video.h"
 
diff --git a/libavfilter/af_amerge.c b/libavfilter/af_amerge.c
index 801e592870..6ef05e213f 100644
--- a/libavfilter/af_amerge.c
+++ b/libavfilter/af_amerge.c
@@ -30,6 +30,7 @@
 #include "avfilter.h"
 #include "filters.h"
 #include "audio.h"
+#include "formats.h"
 #include "internal.h"
 
 #define SWR_CH_MAX 64
diff --git a/libavfilter/af_anequalizer.c b/libavfilter/af_anequalizer.c
index c9b74aa344..69a9c629cd 100644
--- a/libavfilter/af_anequalizer.c
+++ b/libavfilter/af_anequalizer.c
@@ -25,6 +25,7 @@
 #include "libavutil/opt.h"
 #include "libavutil/parseutils.h"
 #include "avfilter.h"
+#include "formats.h"
 #include "internal.h"
 #include "audio.h"
 #include "video.h"
diff --git a/libavfilter/af_apulsator.c b/libavfilter/af_apulsator.c
index 51b4344a39..909a50215e 100644
--- a/libavfilter/af_apulsator.c
+++ b/libavfilter/af_apulsator.c
@@ -22,6 +22,7 @@
 #include "libavutil/channel_layout.h"
 #include "libavutil/opt.h"
 #include "avfilter.h"
+#include "formats.h"
 #include "internal.h"
 #include "audio.h"
 
diff --git a/libavfilter/af_aresample.c b/libavfilter/af_aresample.c
index ead85dd46d..f4bcc45616 100644
--- a/libavfilter/af_aresample.c
+++ b/libavfilter/af_aresample.c
@@ -33,6 +33,7 @@
 #include "avfilter.h"
 #include "audio.h"
 #include "filters.h"
+#include "formats.h"
 #include "internal.h"
 
 typedef struct AResampleContext {
diff --git a/libavfilter/af_asetrate.c b/libavfilter/af_asetrate.c
index f1e48b7087..50ccfc91b9 100644
--- a/libavfilter/af_asetrate.c
+++ b/libavfilter/af_asetrate.c
@@ -20,6 +20,7 @@
 
 #include "libavutil/opt.h"
 #include "avfilter.h"
+#include "formats.h"
 #include "internal.h"
 
 typedef struct ASetRateContext {
diff --git a/libavfilter/af_asr.c b/libavfilter/af_asr.c
index a9dd047cb3..884e17afb7 100644
--- a/libavfilter/af_asr.c
+++ b/libavfilter/af_asr.c
@@ -25,6 +25,7 @@
 #include "libavutil/opt.h"
 #include "audio.h"
 #include "avfilter.h"
+#include "formats.h"
 #include "internal.h"
 
 typedef struct ASRContext {
diff --git a/libavfilter/af_biquads.c b/libavfilter/af_biquads.c
index 1453f51a16..2bcc6fd4a5 100644
--- a/libavfilter/af_biquads.c
+++ b/libavfilter/af_biquads.c
@@ -71,6 +71,7 @@
 #include "audio.h"

Re: [FFmpeg-devel] [PATCH 3/4] avfilter: Deduplicate default video inputs/outputs

2023-08-03 Thread Andreas Rheinhardt
Marvin Scholz:
> 
> 
> On 3 Aug 2023, at 16:33, Andreas Rheinhardt wrote:
> 
>> Lots of video filters use a very simple input or output:
>> An array with a single AVFilterPad whose name is "default"
>> and whose type is AVMEDIA_TYPE_VIDEO; everything else is unset.
>>
>> Given that we never use pointer equality for inputs or outputs*,
>> we can simply use a single AVFilterPad instead of dozens; this
>> even saves .data.rel.ro (8312B here) as well as relocations.
>>
>> *: In fact, several filters (like the filters in vf_lut.c)
>> already use the same outputs; furthermore, ff_filter_alloc()
>> duplicates the input and output pads so that we do not even
>> work with the pads directly.
>>
>> Signed-off-by: Andreas Rheinhardt 
>> ---
> 
> [...]
> 
>> +#include "internal.h"
>> +
>> +/* An AVFilterPad array whose only entry has name "default"
>> + * and is of type video. */
>> +extern const AVFilterPad ff_video_default_filterpad[1];
> 
> This should probably be a Doxygen comment.
> 

Changed it and the audio one in patch #1 locally to:
/**
 * An AVFilterPad array whose only entry has name "default"
 * and is of type AVMEDIA_TYPE_VIDEO.
 */

- 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] avcodec/jpeg2000htdec: Avoid freeing uninitialized pointers in ff_jpeg2000_decode_htj2k()

2023-08-03 Thread Pierre-Anthony Lemieux
On Thu, Aug 3, 2023 at 1:50 PM Tomas Härdin  wrote:
>
> tor 2023-08-03 klockan 17:36 +0200 skrev Michael Niedermayer:
> > On Thu, Aug 03, 2023 at 10:20:29AM +0200, Tomas Härdin wrote:
> > > ons 2023-08-02 klockan 02:01 +0200 skrev Michael Niedermayer:
> > > > Fixes: freeing of uninitialized pointers
> > > > Fixes: part of 58299
> > > >
> > > > Found-by: continuous fuzzing process
> > > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > > > Signed-off-by: Michael Niedermayer 
> > > > ---
> > > >  libavcodec/jpeg2000htdec.c | 4 ++--
> > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/libavcodec/jpeg2000htdec.c
> > > > b/libavcodec/jpeg2000htdec.c
> > > > index 4c4e54710d..2b082b3b2f 100644
> > > > --- a/libavcodec/jpeg2000htdec.c
> > > > +++ b/libavcodec/jpeg2000htdec.c
> > > > @@ -1174,8 +1174,8 @@ ff_jpeg2000_decode_htj2k(const
> > > > Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c
> > > >  int ret;
> > > >
> > > >  /* Temporary buffers */
> > > > -int32_t *sample_buf;
> > > > -uint8_t *block_states;
> > > > +int32_t *sample_buf = NULL;
> > > > +uint8_t *block_states = NULL;
> > >
> > > Looks OK
> >
> > will apply
>
> I should add that I don't know if the two other patches are fine

I am working on them.

>
> /Tomas
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
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] What is FFmpeg and what should it be

2023-08-03 Thread Tomas Härdin
tor 2023-08-03 klockan 15:25 +0200 skrev Nicolas George:
> Tomas Härdin (12023-07-31):
> > As far as I recall libxml2 does not enable the fancier features of
> > XML
> > unless told to do so. And if it can't disable things like DTD then
> > a
> > ticket should be opened with them to make that possible.
> 
> You are missing the point: even if all these features are entirely
> disabled (which we cannot be really sure), the code and data
> structure
> have to be designed to make them possible.

The IMF code uses libxml2 successfully already. I'm not a huge fan of
IMF in lavf tbh since it borders on business logic, but at least we're
leveraging existing code to support it

> > It almost certainly means worse security, not better.
> 
> I am quite sure your estimation in this is wrong.

If you think libxml2's test suite is insufficient then open a ticket
with them about it. As far as I can tell it is comprehensive. One
improvement might be to make use of formal methods to prove code
correctness.


> You are not a boss directing the time of your employees towards the
> task
> most profitable for you. Michael is not hacking software defined
> radio
> to be profitable for somebody, he is having fun with it (probably
> because he recently got his hands on the hardware). And I want to
> write
> a  parser because it is an interesting challenge.

Interesting challenges for you are maintenance burdens for everyone
else, and therefore appropriating part of their time.

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

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


Re: [FFmpeg-devel] [PATCH 1/3] avcodec/jpeg2000htdec: Avoid freeing uninitialized pointers in ff_jpeg2000_decode_htj2k()

2023-08-03 Thread Tomas Härdin
tor 2023-08-03 klockan 17:36 +0200 skrev Michael Niedermayer:
> On Thu, Aug 03, 2023 at 10:20:29AM +0200, Tomas Härdin wrote:
> > ons 2023-08-02 klockan 02:01 +0200 skrev Michael Niedermayer:
> > > Fixes: freeing of uninitialized pointers
> > > Fixes: part of 58299
> > > 
> > > Found-by: continuous fuzzing process
> > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > > Signed-off-by: Michael Niedermayer 
> > > ---
> > >  libavcodec/jpeg2000htdec.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/libavcodec/jpeg2000htdec.c
> > > b/libavcodec/jpeg2000htdec.c
> > > index 4c4e54710d..2b082b3b2f 100644
> > > --- a/libavcodec/jpeg2000htdec.c
> > > +++ b/libavcodec/jpeg2000htdec.c
> > > @@ -1174,8 +1174,8 @@ ff_jpeg2000_decode_htj2k(const
> > > Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c
> > >  int ret;
> > >  
> > >  /* Temporary buffers */
> > > -    int32_t *sample_buf;
> > > -    uint8_t *block_states;
> > > +    int32_t *sample_buf = NULL;
> > > +    uint8_t *block_states = NULL;
> > 
> > Looks OK
> 
> will apply

I should add that I don't know if the two other patches are fine

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

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


Re: [FFmpeg-devel] [PATCH 1/2] lavu/tx: add real to real and real to imaginary RDFT transforms

2023-08-03 Thread Andreas Rheinhardt
Michael Niedermayer:
> On Thu, Aug 03, 2023 at 06:26:16PM +0200, Lynne wrote:
>> These are in-place transforms, required for DCT-I and DST-I.
>>
>> Templated as the mod2 variant requires minor modifications, and is
>> required specifically for DCT-I/DST-I.
>>
>> Quite optimized, as there's no need for any additional buffer storage.
>>
> 
>>  doc/APIchanges  |3 
>>  libavutil/tx.c  |   18 
>>  libavutil/tx.h  |   10 ++
>>  libavutil/tx_template.c |  175 
>> +---
>>  libavutil/version.h |2 
>>  5 files changed, 167 insertions(+), 41 deletions(-)
>> 6e6308365cd78a84c7db5800207e6b5977945079  
>> 0001-lavu-tx-add-real-to-real-and-real-to-imaginary-RDFT-.patch
>> From 2ea5e2541c2551bf1b56e967d35946289a85aa49 Mon Sep 17 00:00:00 2001
>> From: Lynne 
>> Date: Thu, 3 Aug 2023 18:21:23 +0200
>> Subject: [PATCH 1/2] lavu/tx: add real to real and real to imaginary RDFT
>>  transforms
>>
>> These are in-place transforms, required for DCT-I and DST-I.
>>
>> Templated as the mod2 variant requires minor modifications, and is
>> required specifically for DCT-I/DST-I.
> 
> not sure if i forgot some patch but
> this seems to break fate-binkaudio-dct
> 

It's not just you; patchwork reported four failing tests:
make: *** [fate-filter-firequalizer] Error 218
make: *** [fate-binkaudio-rdft] Error 218
make: *** [fate-binkaudio-dct] Error 218
make: *** [fate-qdm2] Error 218

- 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] lavu/tx: add real to real and real to imaginary RDFT transforms

2023-08-03 Thread Michael Niedermayer
On Thu, Aug 03, 2023 at 06:26:16PM +0200, Lynne wrote:
> These are in-place transforms, required for DCT-I and DST-I.
> 
> Templated as the mod2 variant requires minor modifications, and is
> required specifically for DCT-I/DST-I.
> 
> Quite optimized, as there's no need for any additional buffer storage.
> 

>  doc/APIchanges  |3 
>  libavutil/tx.c  |   18 
>  libavutil/tx.h  |   10 ++
>  libavutil/tx_template.c |  175 
> +---
>  libavutil/version.h |2 
>  5 files changed, 167 insertions(+), 41 deletions(-)
> 6e6308365cd78a84c7db5800207e6b5977945079  
> 0001-lavu-tx-add-real-to-real-and-real-to-imaginary-RDFT-.patch
> From 2ea5e2541c2551bf1b56e967d35946289a85aa49 Mon Sep 17 00:00:00 2001
> From: Lynne 
> Date: Thu, 3 Aug 2023 18:21:23 +0200
> Subject: [PATCH 1/2] lavu/tx: add real to real and real to imaginary RDFT
>  transforms
> 
> These are in-place transforms, required for DCT-I and DST-I.
> 
> Templated as the mod2 variant requires minor modifications, and is
> required specifically for DCT-I/DST-I.

not sure if i forgot some patch but
this seems to break fate-binkaudio-dct

make V=2 fate-binkaudio-dct -j32
...
[bink @ 0x559fc8d8dcc0] Failed to open codec in avformat_find_stream_info
[bink @ 0x559fc8d8dcc0] Packet corrupt (stream = 0, dts = NOPTS).
[bink @ 0x559fc8d8dcc0] Failed to open codec in avformat_find_stream_info
[bink @ 0x559fc8d8dcc0] Could not find codec parameters for stream 1 (Audio: 
binkaudio_dct, 44000 Hz, 0 channels, fltp): unspecified number of channels
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' 
(500) options
Input #0, bink, from 'fate/fate-suite//bink/binkaudio_dct.bik':
  Duration: 00:00:08.87, start: 0.00, bitrate: 183 kb/s
  Stream #0:0[0x0]: Video: binkvideo (BIKi / 0x694B4942), yuv420p(tv), 640x480, 
30 fps, 30 tbr, 30 tbn
  Stream #0:1[0x0]: Audio: binkaudio_dct, 44000 Hz, stereo, fltp
[aist#0:1/binkaudio_dct @ 0x559fc8d93080] Error while opening decoder: Function 
not implemented
[aost#0:0/pcm_s16le @ 0x559fc8de5c40] Error initializing a simple filtergraph
Error opening output file -.
Error opening output files: Function not implemented
threads=1
tests/Makefile:308: recipe for target 'fate-binkaudio-dct' failed
make: *** [fate-binkaudio-dct] Error 218



[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Nations do behave wisely once they have exhausted all other alternatives. 
-- Abba Eban


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

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


Re: [FFmpeg-devel] [PATCH] avformat/flvdec: handle exheader fourcc correctly in metadata

2023-08-03 Thread Marton Balint



On Wed, 2 Aug 2023, Steven Liu wrote:


Marton Balint  于2023年7月30日周日 01:49写道:


In metadata fourcc is carried in the AMF number, not as binary.

Partially based on a patch by Steven Liu.

Signed-off-by: Marton Balint 
---
 libavformat/flvdec.c | 76 +---
 1 file changed, 30 insertions(+), 46 deletions(-)




should be ok


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] What is FFmpeg and what should it be

2023-08-03 Thread Kieran Kunhya
On Thu, 3 Aug 2023, 15:25 Michael Niedermayer, 
wrote:

> On Thu, Aug 03, 2023 at 02:24:04PM -0400, Kieran Kunhya wrote:
> > >
> > >
> > > There are 2 things DAB and DVB both use mpeg ts
> > >
> >
> > DAB does not use mpegts. It has several layers of it's own framing.
>
> Well, i stand corrected then. I saw it on the ML and in some spec but that
> was about IP data in DAB or something it seems.
>
> but thats a good thing, because if the framing used is not MPEG-TS
> there will probably be noone objecting to it being removed and not
> output.
>

What does this sentence even mean? The framing is there for a reason (to
delimit programs amongst other things). You can't just remove it. It has
layers that some users will want.

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] What is FFmpeg and what should it be

2023-08-03 Thread Michael Niedermayer
On Thu, Aug 03, 2023 at 02:24:04PM -0400, Kieran Kunhya wrote:
> >
> >
> > There are 2 things DAB and DVB both use mpeg ts
> >
> 
> DAB does not use mpegts. It has several layers of it's own framing.

Well, i stand corrected then. I saw it on the ML and in some spec but that
was about IP data in DAB or something it seems.

but thats a good thing, because if the framing used is not MPEG-TS
there will probably be noone objecting to it being removed and not
output.

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety -- Benjamin Franklin


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] What is FFmpeg and what should it be

2023-08-03 Thread Kieran Kunhya
>
>
> There are 2 things DAB and DVB both use mpeg ts
>

DAB does not use mpegts. It has several layers of it's own framing.

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] What is FFmpeg and what should it be

2023-08-03 Thread Michael Niedermayer
On Wed, Aug 02, 2023 at 04:44:14PM +0200, Jean-Baptiste Kempf wrote:
> On Wed, 2 Aug 2023, at 16:20, Michael Niedermayer wrote:
> > There are multiple problems but the real problem is that
> > How many people discuss an SDR API ? (0)
> > How many people propose an SDR API ? (0)
> 
> Did you ask people to do that?
> 
> > How many people say what they want an SDR API to be able to do ? (0)
> 
> > Again we had 0 that is ZERO discussions about an SDR API.
> > where does it start ? a hw enumerate, a soapy device, a void *
> > representing a SDR data stream from something like soapy
> 
> Just enough to integrate into AVInputFormat and libavformat + libavdevice.
> Propose something and you will get more feedback

well, i did with all the patches i posted over the last 2 months
and what we now have in the libavradio repository (which equals these patches)

Theres libsoapy (100% external to us) which gives us device
enumeration, option enumeration and a path from a opened device to a
"IQ" stream of "radio frequency" samples
that is interfaced with by a AVInputFormat demuxer / input format and produces
AVPackets (raw audio and in the future for DAB, mp2 & AAC)

I have proposed 2 choices here
1. have this API in a separate library (libavradio)
2. have it in libavdevice like other input devices

The only comment i remember was that MPEG-TS would
cause problems (i think multiple people mentioned that)

The rest of this mail thus talks only about the MPEG-TS case because
no other issue with using the existing API was raised.


There are 2 things DAB and DVB both use mpeg ts

if i implement DAB fully without external libs, i can treat mpeg-ts
like the previous layers of modulations and error correction and
just remove it. (I probably will wakeup with a stake through my heart
surrounded by some broadcast guild) but theres no technical issue here

if OTOH i implement DAB through an external lib we get AAC frames
and never even see the MPEG-TS (that at least according to the
documentation i read). So these do teh same thing, they drop MPEG-TS
as soon as possible.
DAB thus has no MPEG-TS related issue

Now DVB (if i understand everything correctly)
the most popular SDR device AFAIK are the cheap RTLSDR sticks
they support DVB only thorugh a seperate hardware path and not in SDR
mode. The bandwidth in SDR mode is not big enough for DVB.
What this means is the majority of people will either use such a stick
in "DVB" mode for DVB which provides mpeg-ts from the kernel and no vissible 
"SDR"
or in "SDR" mode with no DVB so no question about mpeg-ts either

To really hit a problem with mpeg-ts we first needs a SDR device capable to
return the needed bandwidth (thats not the cheapest solution for the end user
so I question a bit how many users we have here) then we would need to
write a implementation of DVB demodulation (noone plans to implement that
AFAIK, i certainly dont plan to)
and then we would have a MPEG-TS stream with probably multiple programs
and multiple audio and video streams in it and that depending on
what parts are being demodulated.
We have other demuxers which handle MPEG-TS internally. So it can still
be done, if needed


To me the obvious solution here is just to not support DVB if people
want MPEG-TS from DVB
* It wont work with the cheap sticks
* It would be alot of work to implement the DVB demodulation
* It doesnt fit very nicely in the architecture and a architecture
  in which it fits will be messy and complex
* The kernel has a interface for it already AFAIK

and here we end, where we started, with my simple minded demuxer and input
device either in libavradio lib or in libavdevice
If someone wants to do DVB in the future she would have to change the
architecture or accept that no MPEG-TS will come out but theres no
"old API" that has to go through a deprecation cycle as its just the
AVInputFormat stuff.

Are people suggesting we design a new API around MPEG-TS even though noone
will implement anything that returns MPEG-TS and has no plans to implement that
even in the distant future ?

It seems a strange design goal to me and iam not even sure thats what people
ask for?

To me the input device API is covering everything you can do with this
If someone wants a different intermediate API, send a patch, i just dont
understand the issue that is supposed to fix.
It seems a bit like "hate" for the input device API, as in
"i want to use it but i sweared an oath not to use libavdevice APIs"

thx

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

Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato 


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 3/4] avfilter: Deduplicate default video inputs/outputs

2023-08-03 Thread Marvin Scholz



On 3 Aug 2023, at 16:33, Andreas Rheinhardt wrote:

> Lots of video filters use a very simple input or output:
> An array with a single AVFilterPad whose name is "default"
> and whose type is AVMEDIA_TYPE_VIDEO; everything else is unset.
>
> Given that we never use pointer equality for inputs or outputs*,
> we can simply use a single AVFilterPad instead of dozens; this
> even saves .data.rel.ro (8312B here) as well as relocations.
>
> *: In fact, several filters (like the filters in vf_lut.c)
> already use the same outputs; furthermore, ff_filter_alloc()
> duplicates the input and output pads so that we do not even
> work with the pads directly.
>
> Signed-off-by: Andreas Rheinhardt 
> ---

[...]

> +#include "internal.h"
> +
> +/* An AVFilterPad array whose only entry has name "default"
> + * and is of type video. */
> +extern const AVFilterPad ff_video_default_filterpad[1];

This should probably be a Doxygen comment.

>
>  AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h);
>  AVFrame *ff_default_get_video_buffer2(AVFilterLink *link, int w, int h, int 
> align);
> -- 
> 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".
___
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] lavu/tx: add real to real and real to imaginary RDFT transforms

2023-08-03 Thread Lynne
Aug 3, 2023, 18:26 by d...@lynne.ee:

> These are in-place transforms, required for DCT-I and DST-I.
>
> Templated as the mod2 variant requires minor modifications, and is
> required specifically for DCT-I/DST-I.
>
> Quite optimized, as there's no need for any additional buffer storage.
>

Specifically, for R2R, vs fftw
  26280 decicycles in   av_tx (r2c), 1048574 runs,  2 skips
  69940 decicycles in fftwf_execute, 1048576 runs,  0 skips

And for R2I
  25856 decicycles in   av_tx (r2c), 1048571 runs,  5 skips
  65561 decicycles in fftwf_execute, 1048576 runs,  0 skips
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH 2/2] lavu/tx: add DCT-I and DST-I transforms

2023-08-03 Thread Lynne
These are true, actual DCT-I and DST-I transforms, unlike the
libavcodec versions, which are plainly not.

Error tests via https://github.com/cyanreg/lavu_fft_test

RMS error on a 2048-sample DCT-I:
RMSE   av_tx = 0.00 (4096 matches, first mismatch at -1)
RMSE  fftw3f = 0.00 (4096 matches, first mismatch at -1)
RMSE   avfft = 0.011440 (0 matches, first mismatch at 0)

RMS error on a 2048-sample DST-I:
RMSE   av_tx = 0.00 (4096 matches, first mismatch at -1)
RMSE  fftw3f = 0.00 (4096 matches, first mismatch at -1)
RMSE   avfft = 0.015316 (0 matches, first mismatch at 0)

>From 0bbe264a0c597a5a871ffc2bfea06e717bc9e0a1 Mon Sep 17 00:00:00 2001
From: Lynne 
Date: Thu, 3 Aug 2023 18:23:02 +0200
Subject: [PATCH 2/2] lavu/tx: add DCT-I and DST-I transforms

These are true, actual DCT-I and DST-I transforms, unlike the
libavcodec versions, which are plainly not.
---
 libavutil/tx.h  |  24 ++
 libavutil/tx_template.c | 103 
 2 files changed, 127 insertions(+)

diff --git a/libavutil/tx.h b/libavutil/tx.h
index d178e8ee9d..4696988cae 100644
--- a/libavutil/tx.h
+++ b/libavutil/tx.h
@@ -105,6 +105,30 @@ enum AVTXType {
 AV_TX_DOUBLE_DCT = 10,
 AV_TX_INT32_DCT  = 11,
 
+/**
+ * Discrete Cosine Transform I
+ *
+ * The forward transform is a DCT-I.
+ * The inverse transform is a DCT-I multiplied by 2/(N + 1).
+ *
+ * The input array is always overwritten.
+ */
+AV_TX_FLOAT_DCT_I  = 12,
+AV_TX_DOUBLE_DCT_I = 13,
+AV_TX_INT32_DCT_I  = 14,
+
+/**
+ * Discrete Sine Transform I
+ *
+ * The forward transform is a DST-I.
+ * The inverse transform is a DST-I multiplied by 2/(N + 1).
+ *
+ * The input array is always overwritten.
+ */
+AV_TX_FLOAT_DST_I  = 15,
+AV_TX_DOUBLE_DST_I = 16,
+AV_TX_INT32_DST_I  = 17,
+
 /* Not part of the API, do not use */
 AV_TX_NB,
 };
diff --git a/libavutil/tx_template.c b/libavutil/tx_template.c
index 50c65d00b5..9bdac1e57d 100644
--- a/libavutil/tx_template.c
+++ b/libavutil/tx_template.c
@@ -2004,6 +2004,107 @@ static const FFTXCodelet TX_NAME(ff_tx_dctIII_def) = {
 .prio   = FF_TX_PRIO_BASE,
 };
 
+static av_cold int TX_NAME(ff_tx_dcstI_init)(AVTXContext *s,
+ const FFTXCodelet *cd,
+ uint64_t flags,
+ FFTXCodeletOptions *opts,
+ int len, int inv,
+ const void *scale)
+{
+int ret;
+SCALE_TYPE rsc = *((SCALE_TYPE *)scale);
+
+if (0 && inv) {
+len *= 2;
+s->len *= 2;
+rsc *= 0.5;
+}
+
+/* We want a half-complex RDFT */
+flags |= cd->type == TX_TYPE(DCT_I) ? AV_TX_REAL_TO_REAL :
+  AV_TX_REAL_TO_IMAGINARY;
+
+if ((ret = ff_tx_init_subtx(s, TX_TYPE(RDFT), flags, NULL,
+(len - 1 + 2*(cd->type == TX_TYPE(DST_I)))*2,
+0, )))
+return ret;
+
+s->tmp = av_mallocz((len + 1)*2*sizeof(TXSample));
+if (!s->tmp)
+return AVERROR(ENOMEM);
+
+return 0;
+}
+
+static void TX_NAME(ff_tx_dctI)(AVTXContext *s, void *_dst,
+void *_src, ptrdiff_t stride)
+{
+TXSample *dst = _dst;
+TXSample *src = _src;
+const int len = s->len - 1;
+TXSample *tmp = (TXSample *)s->tmp;
+
+stride /= sizeof(TXSample);
+
+for (int i = 0; i < len; i++)
+tmp[i] = tmp[2*len - i] = src[i * stride];
+
+tmp[len] = src[len * stride]; /* Middle */
+
+s->fn[0](>sub[0], dst, tmp, sizeof(TXSample));
+}
+
+static void TX_NAME(ff_tx_dstI)(AVTXContext *s, void *_dst,
+void *_src, ptrdiff_t stride)
+{
+TXSample *dst = _dst;
+TXSample *src = _src;
+const int len = s->len + 1;
+TXSample *tmp = (void *)s->tmp;
+
+stride /= sizeof(TXSample);
+
+tmp[0] = 0;
+
+for (int i = 1; i < len; i++) {
+TXSample a = src[(i - 1) * stride];
+tmp[i] = -a;
+tmp[2*len - i] = a;
+}
+
+tmp[len] = 0; /* i == n, Nyquist */
+
+s->fn[0](>sub[0], dst, tmp, sizeof(float));
+}
+
+static const FFTXCodelet TX_NAME(ff_tx_dctI_def) = {
+.name   = TX_NAME_STR("dctI"),
+.function   = TX_NAME(ff_tx_dctI),
+.type   = TX_TYPE(DCT_I),
+.flags  = AV_TX_UNALIGNED | AV_TX_INPLACE | FF_TX_OUT_OF_PLACE,
+.factors= { 2, TX_FACTOR_ANY },
+.nb_factors = 2,
+.min_len= 2,
+.max_len= TX_LEN_UNLIMITED,
+.init   = TX_NAME(ff_tx_dcstI_init),
+.cpu_flags  = FF_TX_CPU_FLAGS_ALL,
+.prio   = FF_TX_PRIO_BASE,
+};
+
+static const FFTXCodelet TX_NAME(ff_tx_dstI_def) = {
+.name   = TX_NAME_STR("dstI"),
+.function   = TX_NAME(ff_tx_dstI),
+.type   = TX_TYPE(DST_I),
+.flags

[FFmpeg-devel] [PATCH 1/2] lavu/tx: add real to real and real to imaginary RDFT transforms

2023-08-03 Thread Lynne
These are in-place transforms, required for DCT-I and DST-I.

Templated as the mod2 variant requires minor modifications, and is
required specifically for DCT-I/DST-I.

Quite optimized, as there's no need for any additional buffer storage.

>From 2ea5e2541c2551bf1b56e967d35946289a85aa49 Mon Sep 17 00:00:00 2001
From: Lynne 
Date: Thu, 3 Aug 2023 18:21:23 +0200
Subject: [PATCH 1/2] lavu/tx: add real to real and real to imaginary RDFT
 transforms

These are in-place transforms, required for DCT-I and DST-I.

Templated as the mod2 variant requires minor modifications, and is
required specifically for DCT-I/DST-I.
---
 doc/APIchanges  |   3 +
 libavutil/tx.c  |  18 -
 libavutil/tx.h  |  10 +++
 libavutil/tx_template.c | 175 +++-
 libavutil/version.h |   2 +-
 5 files changed, 167 insertions(+), 41 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 5afe8bcb75..edd178be4f 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09
 
 API changes, most recent first:
 
+2023-07-xx - xx - lavu 58.15.100 - tx.h
+  Add AV_TX_REAL_TO_REAL and AV_TX_REAL_TO_IMAGINARY
+
 2023-07-xx - xx - lavc 60 - avcodec.h
   Deprecate AV_CODEC_FLAG_DROPCHANGED without replacement.
 
diff --git a/libavutil/tx.c b/libavutil/tx.c
index e25abf998f..e9826e6107 100644
--- a/libavutil/tx.c
+++ b/libavutil/tx.c
@@ -437,7 +437,9 @@ int ff_tx_decompose_length(int dst[TX_MAX_DECOMPOSITIONS], enum AVTXType type,
 
 /* Check direction for non-orthogonal codelets */
 if (((cd->flags & FF_TX_FORWARD_ONLY) && inv) ||
-((cd->flags & (FF_TX_INVERSE_ONLY | AV_TX_FULL_IMDCT)) && !inv))
+((cd->flags & (FF_TX_INVERSE_ONLY | AV_TX_FULL_IMDCT)) && !inv) ||
+((cd->flags & (FF_TX_FORWARD_ONLY | AV_TX_REAL_TO_REAL)) && inv) ||
+((cd->flags & (FF_TX_FORWARD_ONLY | AV_TX_REAL_TO_IMAGINARY)) && inv))
 continue;
 
 /* Check if the CPU supports the required ISA */
@@ -560,6 +562,10 @@ static void print_flags(AVBPrint *bp, uint64_t f)
 av_bprintf(bp, "%spreshuf", prev > 1 ? sep : "");
 if ((f & AV_TX_FULL_IMDCT) && ++prev)
 av_bprintf(bp, "%simdct_full", prev > 1 ? sep : "");
+if ((f & AV_TX_REAL_TO_REAL) && ++prev)
+av_bprintf(bp, "%sreal_to_real", prev > 1 ? sep : "");
+if ((f & AV_TX_REAL_TO_IMAGINARY) && ++prev)
+av_bprintf(bp, "%sreal_to_imaginary", prev > 1 ? sep : "");
 if ((f & FF_TX_ASM_CALL) && ++prev)
 av_bprintf(bp, "%sasm_call", prev > 1 ? sep : "");
 av_bprintf(bp, "]");
@@ -717,7 +723,11 @@ av_cold int ff_tx_init_subtx(AVTXContext *s, enum AVTXType type,
 uint64_t req_flags = flags;
 
 /* Flags the codelet may require to be present */
-uint64_t inv_req_mask = AV_TX_FULL_IMDCT | FF_TX_PRESHUFFLE | FF_TX_ASM_CALL;
+uint64_t inv_req_mask = AV_TX_FULL_IMDCT |
+AV_TX_REAL_TO_REAL |
+AV_TX_REAL_TO_IMAGINARY |
+FF_TX_PRESHUFFLE |
+FF_TX_ASM_CALL;
 
 /* Unaligned codelets are compatible with the aligned flag */
 if (req_flags & FF_TX_ALIGNED)
@@ -742,7 +752,9 @@ av_cold int ff_tx_init_subtx(AVTXContext *s, enum AVTXType type,
 
 /* Check direction for non-orthogonal codelets */
 if (((cd->flags & FF_TX_FORWARD_ONLY) && inv) ||
-((cd->flags & (FF_TX_INVERSE_ONLY | AV_TX_FULL_IMDCT)) && !inv))
+((cd->flags & (FF_TX_INVERSE_ONLY | AV_TX_FULL_IMDCT)) && !inv) ||
+((cd->flags & (FF_TX_FORWARD_ONLY | AV_TX_REAL_TO_REAL)) && inv) ||
+((cd->flags & (FF_TX_FORWARD_ONLY | AV_TX_REAL_TO_IMAGINARY)) && inv))
 continue;
 
 /* Check if the requested flags match from both sides */
diff --git a/libavutil/tx.h b/libavutil/tx.h
index 064edbc097..d178e8ee9d 100644
--- a/libavutil/tx.h
+++ b/libavutil/tx.h
@@ -149,6 +149,16 @@ enum AVTXFlags {
  * Ignored for all transforms but inverse MDCTs.
  */
 AV_TX_FULL_IMDCT = 1ULL << 2,
+
+/**
+ * Perform a real to half-complex RDFT.
+ * Only the real, or imaginary coefficients will
+ * be output, depending on the flag used. Only available for forward RDFTs.
+ * Output array must have enough space to hold N complex values
+ * (regular size for a real to complex transform).
+ */
+AV_TX_REAL_TO_REAL  = 1ULL << 3,
+AV_TX_REAL_TO_IMAGINARY = 1ULL << 4,
 };
 
 /**
diff --git a/libavutil/tx_template.c b/libavutil/tx_template.c
index c4ec9502e0..50c65d00b5 100644
--- a/libavutil/tx_template.c
+++ b/libavutil/tx_template.c
@@ -1613,14 +1613,17 @@ static av_cold int TX_NAME(ff_tx_rdft_init)(AVTXContext *s,
 int ret;
 double f, m;
 TXSample *tab;
+int len4 = FFALIGN(len, 4) / 4;
 
 s->scale_d 

Re: [FFmpeg-devel] What is FFmpeg and what should it be

2023-08-03 Thread Michael Niedermayer
On Wed, Aug 02, 2023 at 03:46:29PM +, Cosmin Stejerean wrote:
> 
> 
> > On Aug 2, 2023, at 7:30 AM, Nicolas George  wrote:
> > 
> > Michael Niedermayer (12023-08-02):
> >> The libraries should be split into runtime loadable plugins
> >> Not only would that make tools alot smaller it also would allow
> >> development of code available in ffmpeg that is maintained outside
> >> FFmpeg.
> >> 
> >> I suggested this previosuly, it is of course not a "simple" thing
> >> to do.
> > 
> > No, it would be a terrible mistake.
> > 
> > And mostly, people who suggest or demand that do it based on
> > misconceptions about how linking works and/or have no actual scenario
> > where that would help.
> > 
> > But this is another discussion entirely.
> 
> This indeed feels like a separate discussion, but should we want to have that 
> discussion I'd be happy to both provide some use cases as well as contribute 
> code to facilitate the implementation. 
> 

> My understanding however is that the community is opposed to dynamically 
> loaded plugins on principle, because it would make it easier to distribute 
> proprietary plugins and sidestep the intent of the copyleft licensing.

I dont know if there is opposition or just inertia and more sexy things to work 
on
but if theres fear of proprietary plugins just do this:

1. give the plugin a license field
2. check that the license field matches a GPL compatible license before loading

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch


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 1/3] avfilter/avfilter: Also deprecate variable name

2023-08-03 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> Otherwise the var_names and the corresponding enum will be off
> and e.g. the array holding the variable values will be too small.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavfilter/avfilter.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
> index 04887b6ee5..b8e1523bdb 100644
> --- a/libavfilter/avfilter.c
> +++ b/libavfilter/avfilter.c
> @@ -478,7 +478,9 @@ static int ff_request_frame_to_filter(AVFilterLink *link)
>  static const char *const var_names[] = {
>  "t",
>  "n",
> +#if FF_API_FRAME_PKT
>  "pos",
> +#endif
>  "w",
>  "h",
>  NULL

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 1/3] avcodec/jpeg2000htdec: Avoid freeing uninitialized pointers in ff_jpeg2000_decode_htj2k()

2023-08-03 Thread Michael Niedermayer
On Thu, Aug 03, 2023 at 10:20:29AM +0200, Tomas Härdin wrote:
> ons 2023-08-02 klockan 02:01 +0200 skrev Michael Niedermayer:
> > Fixes: freeing of uninitialized pointers
> > Fixes: part of 58299
> > 
> > Found-by: continuous fuzzing process
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/jpeg2000htdec.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/libavcodec/jpeg2000htdec.c b/libavcodec/jpeg2000htdec.c
> > index 4c4e54710d..2b082b3b2f 100644
> > --- a/libavcodec/jpeg2000htdec.c
> > +++ b/libavcodec/jpeg2000htdec.c
> > @@ -1174,8 +1174,8 @@ ff_jpeg2000_decode_htj2k(const
> > Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c
> >  int ret;
> >  
> >  /* Temporary buffers */
> > -    int32_t *sample_buf;
> > -    uint8_t *block_states;
> > +    int32_t *sample_buf = NULL;
> > +    uint8_t *block_states = NULL;
> 
> Looks OK

will apply

thx

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

No snowflake in an avalanche ever feels responsible. -- Voltaire


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

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


[FFmpeg-devel] [PATCH 4/4] avfilter/vf_colorconstancy: Remove redundant CONFIG check

2023-08-03 Thread Andreas Rheinhardt
This file is only used by the greyedge filter and therefore
only compiled if said filter is enabled. This also allows
to remove a config_components.h inclusion, avoiding unnecessary
rebuilds.

Signed-off-by: Andreas Rheinhardt 
---
 libavfilter/vf_colorconstancy.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/libavfilter/vf_colorconstancy.c b/libavfilter/vf_colorconstancy.c
index af0356767f..b750087a9d 100644
--- a/libavfilter/vf_colorconstancy.c
+++ b/libavfilter/vf_colorconstancy.c
@@ -28,8 +28,6 @@
  * J. van de Weijer, Th. Gevers, A. Gijsenij "Edge-Based Color Constancy".
  */
 
-#include "config_components.h"
-
 #include "libavutil/imgutils.h"
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
@@ -719,8 +717,6 @@ static const AVFilterPad colorconstancy_inputs[] = {
 },
 };
 
-#if CONFIG_GREYEDGE_FILTER
-
 static const AVOption greyedge_options[] = {
 { "difford",  "set differentiation order", OFFSET(difford),  
AV_OPT_TYPE_INT,{.i64=1}, 0,   2,  FLAGS },
 { "minknorm", "set Minkowski norm",OFFSET(minknorm), 
AV_OPT_TYPE_INT,{.i64=1}, 0,   20, FLAGS },
@@ -743,5 +739,3 @@ const AVFilter ff_vf_greyedge = {
 FILTER_SINGLE_PIXFMT(AV_PIX_FMT_GBRP),
 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | 
AVFILTER_FLAG_SLICE_THREADS,
 };
-
-#endif /* CONFIG_GREY_EDGE_FILTER */
-- 
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".


[FFmpeg-devel] [PATCH 2/4] avfilter/internal: Don't include video.h

2023-08-03 Thread Andreas Rheinhardt
internal.h does not depend on video.h (and should not depend on it)
and therefore should not include video.h at all; instead all users
of video.h should include it directly.

Doing so also avoids unnecessary video.h inclusions in files that
don't need it, like most audio filters.

Signed-off-by: Andreas Rheinhardt 
---
This patch is actually preparatory for 3/4: Otherwise, I couldn't
include internal.h from video.h, because if a user included internal.h
first (as almost all of them do), video.h would be included in
internal.h above the definition of AVFilterPad, so that the declaration
of ff_video_default_filterpad would error out.

 libavfilter/af_afir.c | 1 +
 libavfilter/af_aiir.c | 1 +
 libavfilter/af_anequalizer.c  | 1 +
 libavfilter/avf_showcqt.c | 1 +
 libavfilter/avfilter.c| 1 +
 libavfilter/f_ebur128.c   | 1 +
 libavfilter/internal.h| 1 -
 libavfilter/vf_avgblur_vulkan.c   | 1 +
 libavfilter/vf_blend_vulkan.c | 1 +
 libavfilter/vf_chromaber_vulkan.c | 1 +
 libavfilter/vf_dctdnoiz.c | 1 +
 libavfilter/vf_derain.c   | 1 +
 libavfilter/vf_dnn_processing.c   | 1 +
 libavfilter/vf_epx.c  | 1 +
 libavfilter/vf_eq.c   | 3 ++-
 libavfilter/vf_extractplanes.c| 1 +
 libavfilter/vf_fftdnoiz.c | 1 +
 libavfilter/vf_fftfilt.c  | 3 ++-
 libavfilter/vf_fieldmatch.c   | 1 +
 libavfilter/vf_flip_vulkan.c  | 1 +
 libavfilter/vf_fspp.c | 1 +
 libavfilter/vf_gblur_vulkan.c | 1 +
 libavfilter/vf_geq.c  | 1 +
 libavfilter/vf_hqx.c  | 1 +
 libavfilter/vf_il.c   | 1 +
 libavfilter/vf_kerndeint.c| 1 +
 libavfilter/vf_libplacebo.c   | 1 +
 libavfilter/vf_mcdeint.c  | 1 +
 libavfilter/vf_mergeplanes.c  | 1 +
 libavfilter/vf_misc_vaapi.c   | 1 +
 libavfilter/vf_nlmeans_vulkan.c   | 1 +
 libavfilter/vf_overlay_vaapi.c| 1 +
 libavfilter/vf_overlay_vulkan.c   | 1 +
 libavfilter/vf_owdenoise.c| 1 +
 libavfilter/vf_palettegen.c   | 1 +
 libavfilter/vf_paletteuse.c   | 1 +
 libavfilter/vf_pp.c   | 1 +
 libavfilter/vf_pp7.c  | 1 +
 libavfilter/vf_procamp_vaapi.c| 1 +
 libavfilter/vf_sab.c  | 1 +
 libavfilter/vf_scale_vt.c | 1 +
 libavfilter/vf_scale_vulkan.c | 1 +
 libavfilter/vf_scroll.c   | 1 +
 libavfilter/vf_smartblur.c| 1 +
 libavfilter/vf_spp.c  | 1 +
 libavfilter/vf_sr.c   | 1 +
 libavfilter/vf_tinterlace.c   | 1 +
 libavfilter/vf_tonemap_vaapi.c| 1 +
 libavfilter/vf_tpad.c | 1 +
 libavfilter/vf_transpose_vaapi.c  | 1 +
 libavfilter/vf_transpose_vt.c | 1 +
 libavfilter/vf_transpose_vulkan.c | 1 +
 libavfilter/vf_uspp.c | 1 +
 libavfilter/vf_vidstabtransform.c | 1 +
 libavfilter/vf_weave.c| 1 +
 libavfilter/vf_xbr.c  | 1 +
 libavfilter/vf_xfade_vulkan.c | 1 +
 libavfilter/vf_yaepblur.c | 1 +
 libavfilter/vsrc_testsrc_vulkan.c | 1 +
 libavfilter/yadif_common.c| 1 +
 60 files changed, 61 insertions(+), 3 deletions(-)

diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c
index e00d14d084..5d3f4070a7 100644
--- a/libavfilter/af_afir.c
+++ b/libavfilter/af_afir.c
@@ -45,6 +45,7 @@
 #include "internal.h"
 #include "af_afir.h"
 #include "af_afirdsp.h"
+#include "video.h"
 
 static void drawtext(AVFrame *pic, int x, int y, const char *txt, uint32_t 
color)
 {
diff --git a/libavfilter/af_aiir.c b/libavfilter/af_aiir.c
index 3e7ec78b63..28f452f4a1 100644
--- a/libavfilter/af_aiir.c
+++ b/libavfilter/af_aiir.c
@@ -27,6 +27,7 @@
 #include "audio.h"
 #include "avfilter.h"
 #include "internal.h"
+#include "video.h"
 
 typedef struct ThreadData {
 AVFrame *in, *out;
diff --git a/libavfilter/af_anequalizer.c b/libavfilter/af_anequalizer.c
index c7b9a83d99..c9b74aa344 100644
--- a/libavfilter/af_anequalizer.c
+++ b/libavfilter/af_anequalizer.c
@@ -27,6 +27,7 @@
 #include "avfilter.h"
 #include "internal.h"
 #include "audio.h"
+#include "video.h"
 
 #define FILTER_ORDER 4
 
diff --git a/libavfilter/avf_showcqt.c b/libavfilter/avf_showcqt.c
index 21948db339..4d1937d139 100644
--- a/libavfilter/avf_showcqt.c
+++ b/libavfilter/avf_showcqt.c
@@ -32,6 +32,7 @@
 #include "internal.h"
 #include "lavfutils.h"
 #include "lswsutils.h"
+#include "video.h"
 
 #if CONFIG_LIBFREETYPE
 #include 
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 04887b6ee5..1ebfbce909 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -43,6 +43,7 @@
 #include "formats.h"
 #include "framepool.h"
 #include "internal.h"
+#include "video.h"
 
 static void tlog_ref(void *ctx, AVFrame *ref, int end)
 {
diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c
index 49f68c0e84..ca47a58334 100644
--- a/libavfilter/f_ebur128.c
+++ b/libavfilter/f_ebur128.c
@@ -43,6 +43,7 @@
 #include "filters.h"
 #include "formats.h"
 #include 

[FFmpeg-devel] [PATCH 1/4] avfilter: Deduplicate default audio inputs/outputs

2023-08-03 Thread Andreas Rheinhardt
Lots of audio filters use very simple inputs or outputs:
An array with a single AVFilterPad whose name is "default"
and whose type is AVMEDIA_TYPE_AUDIO; everything else is unset.

Given that we never use pointer equality for inputs or outputs*,
we can simply use a single AVFilterPad instead of dozens; this
even saves .data.rel.ro (4784B here) as well as relocations.

*: In fact, several filters (like the filters in af_biquads.c)
already use the same inputs; furthermore, ff_filter_alloc()
duplicates the input and output pads so that we do not even
work with the pads directly.

Signed-off-by: Andreas Rheinhardt 
---
 libavfilter/af_acontrast.c |  9 +
 libavfilter/af_acopy.c |  9 +
 libavfilter/af_acrusher.c  |  9 +
 libavfilter/af_adeclick.c  | 11 ++-
 libavfilter/af_adecorrelate.c  |  9 +
 libavfilter/af_adelay.c|  9 +
 libavfilter/af_aderivative.c   | 11 ++-
 libavfilter/af_adrc.c  |  9 +
 libavfilter/af_adynamicequalizer.c |  9 +
 libavfilter/af_adynamicsmooth.c|  9 +
 libavfilter/af_aecho.c |  9 +
 libavfilter/af_aemphasis.c |  9 +
 libavfilter/af_aexciter.c  |  9 +
 libavfilter/af_afftdn.c|  9 +
 libavfilter/af_afftfilt.c  |  9 +
 libavfilter/af_aformat.c   | 18 ++
 libavfilter/af_afreqshift.c| 11 ++-
 libavfilter/af_afwtdn.c|  9 +
 libavfilter/af_agate.c |  9 +
 libavfilter/af_anlmdn.c|  9 +
 libavfilter/af_anull.c | 18 ++
 libavfilter/af_apad.c  |  9 +
 libavfilter/af_apsyclip.c  |  9 +
 libavfilter/af_apulsator.c |  9 +
 libavfilter/af_aresample.c |  9 +
 libavfilter/af_arnndn.c|  9 +
 libavfilter/af_asetnsamples.c  | 18 ++
 libavfilter/af_ashowinfo.c |  9 +
 libavfilter/af_asoftclip.c |  9 +
 libavfilter/af_aspectralstats.c|  9 +
 libavfilter/af_asr.c   |  9 +
 libavfilter/af_asubboost.c |  9 +
 libavfilter/af_asupercut.c | 15 ---
 libavfilter/af_atilt.c |  9 +
 libavfilter/af_biquads.c   |  9 +
 libavfilter/af_channelmap.c|  9 +
 libavfilter/af_channelsplit.c  |  9 +
 libavfilter/af_compensationdelay.c |  9 +
 libavfilter/af_crossfeed.c |  9 +
 libavfilter/af_crystalizer.c   |  9 +
 libavfilter/af_dcshift.c   |  9 +
 libavfilter/af_deesser.c   |  9 +
 libavfilter/af_dialoguenhance.c|  9 +
 libavfilter/af_dynaudnorm.c|  9 +
 libavfilter/af_earwax.c|  9 +
 libavfilter/af_extrastereo.c   |  9 +
 libavfilter/af_flanger.c   |  9 +
 libavfilter/af_haas.c  |  9 +
 libavfilter/af_hdcd.c  |  9 +
 libavfilter/af_loudnorm.c  |  9 +
 libavfilter/af_pan.c   |  9 +
 libavfilter/af_rubberband.c|  9 +
 libavfilter/af_silencedetect.c |  9 +
 libavfilter/af_sofalizer.c |  9 +
 libavfilter/af_speechnorm.c|  9 +
 libavfilter/af_stereotools.c   |  9 +
 libavfilter/af_stereowiden.c   |  9 +
 libavfilter/af_tremolo.c   |  9 +
 libavfilter/af_vibrato.c   |  9 +
 libavfilter/af_virtualbass.c   |  9 +
 libavfilter/af_volumedetect.c  |  9 +
 libavfilter/audio.c|  7 +++
 libavfilter/audio.h|  4 
 libavfilter/avf_showcqt.c  | 10 ++
 libavfilter/avf_showcwt.c  |  9 +
 libavfilter/avf_showfreqs.c|  9 +
 libavfilter/avf_showspatial.c  |  9 +
 libavfilter/avf_showspectrum.c |  9 +
 libavfilter/avf_showwaves.c|  9 +
 libavfilter/buffersink.c   |  9 +
 libavfilter/f_bench.c  | 10 ++
 libavfilter/f_cue.c| 19 +++
 libavfilter/f_graphmonitor.c   | 10 ++
 libavfilter/f_latency.c| 19 +++
 libavfilter/f_loop.c   |  9 +
 libavfilter/f_metadata.c   |  9 +
 libavfilter/f_perms.c  |  9 +
 libavfilter/f_realtime.c   | 10 ++
 libavfilter/f_sendcmd.c|  9 +
 libavfilter/f_sidedata.c   | 10 ++
 libavfilter/f_zmq.c|  9 +
 libavfilter/setpts.c   |  9 +
 libavfilter/settb.c|  9 +
 libavfilter/split.c|  9 +
 libavfilter/trim.c

Re: [FFmpeg-devel] What is FFmpeg and what should it be

2023-08-03 Thread Nicolas George
Tomas Härdin (12023-08-03):
> I thought of another thing that bears mentioning: Michael has expressed
> interest in implementing DAB. This carries with it two problems:
> 
> * Each DAB ensemble is an MPEG-TS stream
> * There can be more than one ensemble on air
> 
> The first means mere demodulation is not enough - MPEG-TS must also be
> implemented somehow. This likely means a dependency on lavf, assuming
> we are not so insane as to have two independent MPEG-TS
> implementations. There might also be an impedance mismatch due to lavf
> pulling bytes from avio. There's no way to "push" bytes to a demuxer.
> Synchronization may be an issue, though I admit I'm not 100% sure here.
> Perhaps the device can pretend to be a protocol, entailing even tighter
> coupling with lavf? Also I don't think registering protocols from
> outside is allowed.
> 
> The second means that if such a DAB device is to work similar to the FM
> demodulator handling multiple stations, then somehow multiple MPEG-TS
> streams have to be dealt with. AFAIK lavd cannot do this. Merging MPEG-
> TS streams might be tempting, but is not guaranteed to work I think.

Or maybe Michael, being a very skilled hacker, will find a smart
solution that will make it work without code duplication.

You do not know what code he will submit. Why waste time speculating and
discussing nightmare scenarios that will probably not happen on this
mailing-list?


> I still don't understand why this must live in lavd rather than having
> a separate program that does this and does it well. There is useful DSP
> code in libav* that can then be motivated breaking out into a separate
> library.

Oh, yes, great idea! More administrative bloat.

You were complaining about wasting precious developer time on useless
tasks, you should start by yourself: wasting precious developer time on
maintaining extra build systems and packaging.

-- 
  Nicolas George
___
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] What is FFmpeg and what should it be

2023-08-03 Thread Nicolas George
Tomas Härdin (12023-07-31):
> As far as I recall libxml2 does not enable the fancier features of XML
> unless told to do so. And if it can't disable things like DTD then a
> ticket should be opened with them to make that possible.

You are missing the point: even if all these features are entirely
disabled (which we cannot be really sure), the code and data structure
have to be designed to make them possible. That means significantly more
complex code, much more prone to bugs, including security-relevant.

> It is foolish to spread scarce developer time more thinly.

For that, see below.

> It almost certainly means worse security, not better.

I am quite sure your estimation in this is wrong.

> The same goes for all things that FFmpeg reimplements. HTTP has already
> been mentioned. How many developer hours have been wasted on it when
> libcurl could be used instead, and a fraction of those hours going to
> improving it rather than a duplicate implementation?
> 
> I have been accused of being a "bean counter". But what are these beans
> that I count? They are developer time, the sole source of value of the
> free software movement as a whole. When I see things like HTTP or MXF
> being reimplemented I don't see features. I see liabilities.

You are neglecting a very important point here:

The time of other people is not yours to count.

You are not a boss directing the time of your employees towards the task
most profitable for you. Michael is not hacking software defined radio
to be profitable for somebody, he is having fun with it (probably
because he recently got his hands on the hardware). And I want to write
a  parser because it is an interesting challenge. But
since Michael is a very talented hacker, the result of he having fun
ends up being code that is in some way already better than existing
alternatives.

As a member of a community project, you do not have the authority to
choose what other developers work on. The only authority you have is to
decide whether you will welcome the fruit of their work as an useful new
feature (while being vigilant about code quality) or whether you will be
so annoying about it that they give up trying to contribute to FFmpeg.

As of now, you seem to be making the wrong choice.

And I can tell you about my own situation: for several months now, the
attitude of some developers here, including you very strongly, has
mostly disgusted me from contributing to FFmpeg.

The stupid farmer kills the goose with the golden eggs by opening up her
belly. The smart farmer kills the goose with the golden eggs by trying
to force her to lay on a schedule.

> Layering is not an end in itself as you rightfully point out. It is a
> tool. To what end?

> In the free software world we don't layer and segregate things for no
> reason. We do it so that programs can interact with each other through
> standardized interfaces. The effect is a comedy of the commons. More
> can be done with less labour. For an FM receiver program the
> appropriate interfaces are ALSA, PulseAudio and/or JACK. That way its
> audio can be piped to many programs.

As you point: layering is not an end. “The scope” is not the reason, it
is only a quick summary of the reasons when they are obvious and we all
agree.

So please stop invoking “the scope” as a reason.

Second, layering is indeed something to wish for in a complex project,
but it has to come organically, it has to appear progressively as the
code becomes more complex and the useful boundaries and interfaces
appear.

When people start with layering, the result looks like the OSI model for
network stacks: it makes a few nice paragraphs in textbooks and is
completely worthless in practice.

> It is true that we can add more features, and it is also certainly true
> that these are useful for a non-empty set of users. But is it a good
> use of scarce developer time? Were SDR limited to only Michael's time
> then there would be no problem. But it isn't. It unavoidably touches
> many other parts of the code, as we are already seeing.

It is the second time you say this, and it is the second time I have to
tell you: no, it is not true at all.

We are seeing exactly the opposite: Michael's code is big, but it is
self-contained and completely optional.

Furthermore, it is not wasting any developer time. Only these sterile
objections are wasting precious time.

-- 
  Nicolas George
___
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] What is FFmpeg and what should it be

2023-08-03 Thread Tomas Härdin
sön 2023-07-30 klockan 15:04 +0200 skrev Nicolas George:
> Michael's code seems pretty self-contained to me.
> 
> And once again:
> 
> *** IT DOES NOT HAVE TO BE COMPLETE TO BE USEFUL. ***

I thought of another thing that bears mentioning: Michael has expressed
interest in implementing DAB. This carries with it two problems:

* Each DAB ensemble is an MPEG-TS stream
* There can be more than one ensemble on air

The first means mere demodulation is not enough - MPEG-TS must also be
implemented somehow. This likely means a dependency on lavf, assuming
we are not so insane as to have two independent MPEG-TS
implementations. There might also be an impedance mismatch due to lavf
pulling bytes from avio. There's no way to "push" bytes to a demuxer.
Synchronization may be an issue, though I admit I'm not 100% sure here.
Perhaps the device can pretend to be a protocol, entailing even tighter
coupling with lavf? Also I don't think registering protocols from
outside is allowed.

The second means that if such a DAB device is to work similar to the FM
demodulator handling multiple stations, then somehow multiple MPEG-TS
streams have to be dealt with. AFAIK lavd cannot do this. Merging MPEG-
TS streams might be tempting, but is not guaranteed to work I think.

I still don't understand why this must live in lavd rather than having
a separate program that does this and does it well. There is useful DSP
code in libav* that can then be motivated breaking out into a separate
library.

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

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


Re: [FFmpeg-devel] [PATCH 1/3] avcodec/jpeg2000htdec: Avoid freeing uninitialized pointers in ff_jpeg2000_decode_htj2k()

2023-08-03 Thread Tomas Härdin
ons 2023-08-02 klockan 02:01 +0200 skrev Michael Niedermayer:
> Fixes: freeing of uninitialized pointers
> Fixes: part of 58299
> 
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/jpeg2000htdec.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/jpeg2000htdec.c b/libavcodec/jpeg2000htdec.c
> index 4c4e54710d..2b082b3b2f 100644
> --- a/libavcodec/jpeg2000htdec.c
> +++ b/libavcodec/jpeg2000htdec.c
> @@ -1174,8 +1174,8 @@ ff_jpeg2000_decode_htj2k(const
> Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c
>  int ret;
>  
>  /* Temporary buffers */
> -    int32_t *sample_buf;
> -    uint8_t *block_states;
> +    int32_t *sample_buf = NULL;
> +    uint8_t *block_states = NULL;

Looks OK

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

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


[FFmpeg-devel] [PATCH v3 6/6] lavc/vaapi_encode: Add VAAPI AV1 encoder

2023-08-03 Thread fei . w . wang-at-intel . com
From: Fei Wang 

Signed-off-by: Fei Wang 
---
 Changelog |1 +
 configure |3 +
 doc/encoders.texi |   13 +
 libavcodec/Makefile   |1 +
 libavcodec/allcodecs.c|1 +
 libavcodec/vaapi_encode.c |  125 +++-
 libavcodec/vaapi_encode.h |   12 +
 libavcodec/vaapi_encode_av1.c | 1229 +
 libavcodec/version.h  |2 +-
 9 files changed, 1368 insertions(+), 19 deletions(-)
 create mode 100644 libavcodec/vaapi_encode_av1.c

diff --git a/Changelog b/Changelog
index bbda4f4fd4..e86f742cd3 100644
--- a/Changelog
+++ b/Changelog
@@ -27,6 +27,7 @@ version :
 - Bitstream filter for converting VVC from MP4 to Annex B
 - scale_vt filter for videotoolbox
 - transpose_vt filter for videotoolbox
+- VAAPI AV1 encoder
 
 version 6.0:
 - Radiance HDR image support
diff --git a/configure b/configure
index 99388e7664..68a238a819 100755
--- a/configure
+++ b/configure
@@ -3322,6 +3322,8 @@ av1_qsv_decoder_select="qsvdec"
 av1_qsv_encoder_select="qsvenc"
 av1_qsv_encoder_deps="libvpl"
 av1_amf_encoder_deps="amf"
+av1_vaapi_encoder_deps="VAEncPictureParameterBufferAV1"
+av1_vaapi_encoder_select="cbs_av1 vaapi_encode"
 
 # parsers
 aac_parser_select="adts_header mpeg4audio"
@@ -7106,6 +7108,7 @@ if enabled vaapi; then
 check_type "va/va.h va/va_enc_jpeg.h" "VAEncPictureParameterBufferJPEG"
 check_type "va/va.h va/va_enc_vp8.h"  "VAEncPictureParameterBufferVP8"
 check_type "va/va.h va/va_enc_vp9.h"  "VAEncPictureParameterBufferVP9"
+check_type "va/va.h va/va_enc_av1.h"  "VAEncPictureParameterBufferAV1"
 fi
 
 if enabled_all opencl libdrm ; then
diff --git a/doc/encoders.texi b/doc/encoders.texi
index 25d6b7f09e..fb331ebd8e 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -3991,6 +3991,19 @@ Average variable bitrate.
 Each encoder also has its own specific options:
 @table @option
 
+@item av1_vaapi
+@option{profile} sets the value of @emph{seq_profile}.
+@option{tier} sets the value of @emph{seq_tier}.
+@option{level} sets the value of @emph{seq_level_idx}.
+
+@table @option
+@item tiles
+Set the number of tiles to encode the input video with, as columns x rows.
+(default is 1x1).
+@item tile_groups
+Set tile groups number (default is 1).
+@end table
+
 @item h264_vaapi
 @option{profile} sets the value of @emph{profile_idc} and the 
@emph{constraint_set*_flag}s.
 @option{level} sets the value of @emph{level_idc}.
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index a6b2ecbb22..473afb4471 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -258,6 +258,7 @@ OBJS-$(CONFIG_AV1_MEDIACODEC_DECODER)  += mediacodecdec.o
 OBJS-$(CONFIG_AV1_MEDIACODEC_ENCODER)  += mediacodecenc.o
 OBJS-$(CONFIG_AV1_NVENC_ENCODER)   += nvenc_av1.o nvenc.o
 OBJS-$(CONFIG_AV1_QSV_ENCODER) += qsvenc_av1.o
+OBJS-$(CONFIG_AV1_VAAPI_ENCODER)   += vaapi_encode_av1.o av1_levels.o
 OBJS-$(CONFIG_AVRN_DECODER)+= avrndec.o
 OBJS-$(CONFIG_AVRP_DECODER)+= r210dec.o
 OBJS-$(CONFIG_AVRP_ENCODER)+= r210enc.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 8775d15a4f..c43c1d7b48 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -844,6 +844,7 @@ extern const FFCodec ff_av1_nvenc_encoder;
 extern const FFCodec ff_av1_qsv_decoder;
 extern const FFCodec ff_av1_qsv_encoder;
 extern const FFCodec ff_av1_amf_encoder;
+extern const FFCodec ff_av1_vaapi_encoder;
 extern const FFCodec ff_libopenh264_encoder;
 extern const FFCodec ff_libopenh264_decoder;
 extern const FFCodec ff_h264_amf_encoder;
diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 2604f12b9e..2907e159fb 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -669,6 +669,15 @@ static int 
vaapi_encode_set_output_timestamp(AVCodecContext *avctx,
 {
 VAAPIEncodeContext *ctx = avctx->priv_data;
 
+// AV1 packs P frame and next B frame into one pkt, and uses the other
+// repeat frame header pkt at the display order position of the P frame
+// to indicate its frame index. Each frame has a corresponding pkt in its
+// display order position. So don't need to consider delay for AV1 
timestamp.
+if (avctx->codec_id == AV_CODEC_ID_AV1) {
+pkt->dts = pkt->pts - ctx->dts_pts_diff;
+return 0;
+}
+
 if (ctx->output_delay == 0) {
 pkt->dts = pkt->pts;
 } else if (pic->encode_order < ctx->decode_delay) {
@@ -689,9 +698,10 @@ static int vaapi_encode_output(AVCodecContext *avctx,
 {
 VAAPIEncodeContext *ctx = avctx->priv_data;
 VACodedBufferSegment *buf_list, *buf;
-VAStatus vas;
+AVPacket *pkt_ptr = pkt;
 int total_size = 0;
 uint8_t *ptr;
+VAStatus vas;
 int err;
 
 err = vaapi_encode_wait(avctx, pic);
@@ -711,11 +721,52 @@ static int vaapi_encode_output(AVCodecContext *avctx,
 for (buf = buf_list; buf; buf = buf->next)
 total_size += 

[FFmpeg-devel] [PATCH v3 5/6] lavc/vaapi_encode: Separate reference frame into previous/future list

2023-08-03 Thread fei . w . wang-at-intel . com
From: Fei Wang 

To support more reference frames from different directions.

Signed-off-by: Fei Wang 
---
 libavcodec/vaapi_encode.c   | 112 +---
 libavcodec/vaapi_encode.h   |  15 +++--
 libavcodec/vaapi_encode_h264.c  |  94 +--
 libavcodec/vaapi_encode_h265.c  |  76 +-
 libavcodec/vaapi_encode_mpeg2.c |   6 +-
 libavcodec/vaapi_encode_vp8.c   |   6 +-
 libavcodec/vaapi_encode_vp9.c   |  26 
 7 files changed, 208 insertions(+), 127 deletions(-)

diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index c8545cd8db..2604f12b9e 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -276,21 +276,34 @@ static int vaapi_encode_issue(AVCodecContext *avctx,
 av_log(avctx, AV_LOG_DEBUG, "Issuing encode for pic %"PRId64"/%"PRId64" "
"as type %s.\n", pic->display_order, pic->encode_order,
picture_type_name[pic->type]);
-if (pic->nb_refs == 0) {
+if (pic->nb_refs[0] == 0 && pic->nb_refs[1] == 0) {
 av_log(avctx, AV_LOG_DEBUG, "No reference pictures.\n");
 } else {
-av_log(avctx, AV_LOG_DEBUG, "Refers to:");
-for (i = 0; i < pic->nb_refs; i++) {
+av_log(avctx, AV_LOG_DEBUG, "L0 refers to");
+for (i = 0; i < pic->nb_refs[0]; i++) {
 av_log(avctx, AV_LOG_DEBUG, " %"PRId64"/%"PRId64,
-   pic->refs[i]->display_order, pic->refs[i]->encode_order);
+   pic->refs[0][i]->display_order, 
pic->refs[0][i]->encode_order);
 }
 av_log(avctx, AV_LOG_DEBUG, ".\n");
+
+if (pic->nb_refs[1]) {
+av_log(avctx, AV_LOG_DEBUG, "L1 refers to");
+for (i = 0; i < pic->nb_refs[1]; i++) {
+av_log(avctx, AV_LOG_DEBUG, " %"PRId64"/%"PRId64,
+   pic->refs[1][i]->display_order, 
pic->refs[1][i]->encode_order);
+}
+av_log(avctx, AV_LOG_DEBUG, ".\n");
+}
 }
 
 av_assert0(!pic->encode_issued);
-for (i = 0; i < pic->nb_refs; i++) {
-av_assert0(pic->refs[i]);
-av_assert0(pic->refs[i]->encode_issued);
+for (i = 0; i < pic->nb_refs[0]; i++) {
+av_assert0(pic->refs[0][i]);
+av_assert0(pic->refs[0][i]->encode_issued);
+}
+for (i = 0; i < pic->nb_refs[1]; i++) {
+av_assert0(pic->refs[1][i]);
+av_assert0(pic->refs[1][i]->encode_issued);
 }
 
 av_log(avctx, AV_LOG_DEBUG, "Input surface is %#x.\n", pic->input_surface);
@@ -832,8 +845,12 @@ static void vaapi_encode_add_ref(AVCodecContext *avctx,
 
 if (is_ref) {
 av_assert0(pic != target);
-av_assert0(pic->nb_refs < MAX_PICTURE_REFERENCES);
-pic->refs[pic->nb_refs++] = target;
+av_assert0(pic->nb_refs[0] < MAX_PICTURE_REFERENCES &&
+   pic->nb_refs[1] < MAX_PICTURE_REFERENCES);
+if (target->display_order < pic->display_order)
+pic->refs[0][pic->nb_refs[0]++] = target;
+else
+pic->refs[1][pic->nb_refs[1]++] = target;
 ++refs;
 }
 
@@ -862,10 +879,16 @@ static void vaapi_encode_remove_refs(AVCodecContext 
*avctx,
 if (pic->ref_removed[level])
 return;
 
-for (i = 0; i < pic->nb_refs; i++) {
-av_assert0(pic->refs[i]);
---pic->refs[i]->ref_count[level];
-av_assert0(pic->refs[i]->ref_count[level] >= 0);
+for (i = 0; i < pic->nb_refs[0]; i++) {
+av_assert0(pic->refs[0][i]);
+--pic->refs[0][i]->ref_count[level];
+av_assert0(pic->refs[0][i]->ref_count[level] >= 0);
+}
+
+for (i = 0; i < pic->nb_refs[1]; i++) {
+av_assert0(pic->refs[1][i]);
+--pic->refs[1][i]->ref_count[level];
+av_assert0(pic->refs[1][i]->ref_count[level] >= 0);
 }
 
 for (i = 0; i < pic->nb_dpb_pics; i++) {
@@ -910,7 +933,7 @@ static void vaapi_encode_set_b_pictures(AVCodecContext 
*avctx,
 vaapi_encode_add_ref(avctx, pic, end,   1, 1, 0);
 vaapi_encode_add_ref(avctx, pic, prev,  0, 0, 1);
 
-for (ref = end->refs[1]; ref; ref = ref->refs[1])
+for (ref = end->refs[1][0]; ref; ref = ref->refs[1][0])
 vaapi_encode_add_ref(avctx, pic, ref, 0, 1, 0);
 }
 *last = prev;
@@ -933,7 +956,7 @@ static void vaapi_encode_set_b_pictures(AVCodecContext 
*avctx,
 vaapi_encode_add_ref(avctx, pic, end,   1, 1, 0);
 vaapi_encode_add_ref(avctx, pic, prev,  0, 0, 1);
 
-for (ref = end->refs[1]; ref; ref = ref->refs[1])
+for (ref = end->refs[1][0]; ref; ref = ref->refs[1][0])
 vaapi_encode_add_ref(avctx, pic, ref, 0, 1, 0);
 
 if (i > 1)
@@ -947,11 +970,44 @@ static void vaapi_encode_set_b_pictures(AVCodecContext 
*avctx,
 }
 }
 
+static void vaapi_encode_add_next_prev(AVCodecContext *avctx,
+   VAAPIEncodePicture *pic)
+{
+VAAPIEncodeContext *ctx = 

[FFmpeg-devel] [PATCH v3 4/6] lavc/vaapi_encode: Extract set output pkt timestamp function

2023-08-03 Thread fei . w . wang-at-intel . com
From: Fei Wang 

Signed-off-by: Fei Wang 
---
 libavcodec/vaapi_encode.c | 37 -
 1 file changed, 24 insertions(+), 13 deletions(-)

diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 8c9f14df66..c8545cd8db 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -650,6 +650,27 @@ fail_at_end:
 return err;
 }
 
+static int vaapi_encode_set_output_timestamp(AVCodecContext *avctx,
+ VAAPIEncodePicture *pic,
+ AVPacket *pkt)
+{
+VAAPIEncodeContext *ctx = avctx->priv_data;
+
+if (ctx->output_delay == 0) {
+pkt->dts = pkt->pts;
+} else if (pic->encode_order < ctx->decode_delay) {
+if (ctx->ts_ring[pic->encode_order] < INT64_MIN + ctx->dts_pts_diff)
+pkt->dts = INT64_MIN;
+else
+pkt->dts = ctx->ts_ring[pic->encode_order] - ctx->dts_pts_diff;
+} else {
+pkt->dts = ctx->ts_ring[(pic->encode_order - ctx->decode_delay) %
+(3 * ctx->output_delay + ctx->async_depth)];
+}
+
+return 0;
+}
+
 static int vaapi_encode_output(AVCodecContext *avctx,
VAAPIEncodePicture *pic, AVPacket *pkt)
 {
@@ -1273,19 +1294,9 @@ int ff_vaapi_encode_receive_packet(AVCodecContext 
*avctx, AVPacket *pkt)
 return err;
 }
 
-if (ctx->output_delay == 0) {
-pkt->dts = pkt->pts;
-} else if (pic->encode_order < ctx->decode_delay) {
-if (ctx->ts_ring[pic->encode_order] < INT64_MIN + ctx->dts_pts_diff)
-pkt->dts = INT64_MIN;
-else
-pkt->dts = ctx->ts_ring[pic->encode_order] - ctx->dts_pts_diff;
-} else {
-pkt->dts = ctx->ts_ring[(pic->encode_order - ctx->decode_delay) %
-(3 * ctx->output_delay + ctx->async_depth)];
-}
-av_log(avctx, AV_LOG_DEBUG, "Output packet: pts %"PRId64" dts 
%"PRId64".\n",
-   pkt->pts, pkt->dts);
+vaapi_encode_set_output_timestamp(avctx, pic, pkt);
+av_log(avctx, AV_LOG_DEBUG, "Output packet: pts %"PRId64", dts %"PRId64", "
+   "size %u bytes.\n", pkt->pts, pkt->dts, pkt->size);
 
 ctx->output_order = pic->encode_order;
 vaapi_encode_clear_old(avctx);
-- 
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 v3 3/6] lavc/vaapi_encode: Init pic at the beginning of API

2023-08-03 Thread fei . w . wang-at-intel . com
From: Fei Wang 

Signed-off-by: Fei Wang 
---
 libavcodec/vaapi_encode.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index bfca315a7a..8c9f14df66 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -1205,7 +1205,7 @@ fail:
 int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
 {
 VAAPIEncodeContext *ctx = avctx->priv_data;
-VAAPIEncodePicture *pic;
+VAAPIEncodePicture *pic = NULL;
 AVFrame *frame = ctx->frame;
 int err;
 
@@ -1228,8 +1228,6 @@ int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, 
AVPacket *pkt)
 }
 
 if (ctx->has_sync_buffer_func) {
-pic = NULL;
-
 if (av_fifo_can_write(ctx->encode_fifo)) {
 err = vaapi_encode_pick_next(avctx, );
 if (!err) {
@@ -1255,7 +1253,6 @@ int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, 
AVPacket *pkt)
 av_fifo_read(ctx->encode_fifo, , 1);
 ctx->encode_order = pic->encode_order + 1;
 } else {
-pic = NULL;
 err = vaapi_encode_pick_next(avctx, );
 if (err < 0)
 return err;
-- 
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 v3 2/6] lavc/av1: Add common code and unit test for level handling

2023-08-03 Thread fei . w . wang-at-intel . com
From: Fei Wang 

Signed-off-by: Fei Wang 
---
update:
1. Rename libavcodec/av1_levels*.
2. Use array instead of handle for AV1LevelDescriptor.name.
3. Compile libavcodec/av1_levels* only when enable vaapi av1 encoder.

 libavcodec/Makefile   |   1 +
 libavcodec/av1_levels.c   |  92 +
 libavcodec/av1_levels.h   |  58 
 libavcodec/tests/.gitignore   |   1 +
 libavcodec/tests/av1_levels.c | 124 ++
 tests/fate/libavcodec.mak |   5 ++
 6 files changed, 281 insertions(+)
 create mode 100644 libavcodec/av1_levels.c
 create mode 100644 libavcodec/av1_levels.h
 create mode 100644 libavcodec/tests/av1_levels.c

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 3c16b51462..a6b2ecbb22 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1319,6 +1319,7 @@ TESTPROGS = avcodec   
  \
 jpeg2000dwt \
 mathops\
 
+TESTPROGS-$(CONFIG_AV1_VAAPI_ENCODER) += av1_levels
 TESTPROGS-$(CONFIG_CABAC) += cabac
 TESTPROGS-$(CONFIG_DCT)   += avfft
 TESTPROGS-$(CONFIG_FFT)   += fft fft-fixed32
diff --git a/libavcodec/av1_levels.c b/libavcodec/av1_levels.c
new file mode 100644
index 00..19b6ee1736
--- /dev/null
+++ b/libavcodec/av1_levels.c
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2023 Intel Corporation
+ *
+ * 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
+ */
+
+#include 
+#include "libavutil/macros.h"
+#include "av1_levels.h"
+
+/** ignore entries which named in spec but no details. Like level 2.2 and 7.0. 
*/
+static const AV1LevelDescriptor av1_levels[] = {
+// Name  MaxVSize   MainMbps   
   MaxTiles
+// |  level_idx | MaxDisplayRate| 
HighMbps | MaxTileCols
+// |  |   MaxPicSize|   | MaxDecodeRate || 
  MainCR|   |
+// |  | |MaxHSize   |   |   | MaxHeaderRate || 
| HighCR|   |
+// |  | ||  |   |   |   |   || 
|  ||   |
+{ "2.0",  0,   147456,  2048, 1152,   4423680, 5529600, 150,   1.5,
 0, 2, 0,   8,  4 },
+{ "2.1",  1,   278784,  2816, 1584,   8363520,10454400, 150,   3.0,
 0, 2, 0,   8,  4 },
+{ "3.0",  4,   665856,  4352, 2448,  19975680,24969600, 150,   6.0,
 0, 2, 0,  16,  6 },
+{ "3.1",  5,  1065024,  5504, 3096,  31950720,39938400, 150,  10.0,
 0, 2, 0,  16,  6 },
+{ "4.0",  8,  2359296,  6144, 3456,  70778880,77856768, 300,  12.0,  
30.0, 4, 4,  32,  8 },
+{ "4.1",  9,  2359296,  6144, 3456,  141557760,  155713536, 300,  20.0,  
50.0, 4, 4,  32,  8 },
+{ "5.0", 12,  8912896,  8192, 4352,  267386880,  273715200, 300,  30.0, 
100.0, 6, 4,  64,  8 },
+{ "5.1", 13,  8912896,  8192, 4352,  534773760,  547430400, 300,  40.0, 
160.0, 8, 4,  64,  8 },
+{ "5.2", 14,  8912896,  8192, 4352, 1069547520, 1094860800, 300,  60.0, 
240.0, 8, 4,  64,  8 },
+{ "5.3", 15,  8912896,  8192, 4352, 1069547520, 1176502272, 300,  60.0, 
240.0, 8, 4,  64,  8 },
+{ "6.0", 16, 35651584, 16384, 8704, 1069547520, 1176502272, 300,  60.0, 
240.0, 8, 4, 128, 16 },
+{ "6.1", 17, 35651584, 16384, 8704, 2139095040, 2189721600, 300, 100.0, 
480.0, 8, 4, 128, 16 },
+{ "6.2", 18, 35651584, 16384, 8704, 4278190080, 4379443200, 300, 160.0, 
800.0, 8, 4, 128, 16 },
+{ "6.3", 19, 35651584, 16384, 8704, 4278190080, 4706009088, 300, 160.0, 
800.0, 8, 4, 128, 16 },
+};
+
+const AV1LevelDescriptor *ff_av1_guess_level(int64_t bitrate,
+ int tier,
+ int width,
+ int height,
+ int tiles,
+ int tile_cols,
+ float fps)
+{
+int pic_size;
+uint64_t display_rate;
+float max_br;
+
+pic_size = width * height;
+display_rate = 

[FFmpeg-devel] [PATCH v3 1/6] avcodec/cbs_av1: Add tx mode enum values

2023-08-03 Thread fei . w . wang-at-intel . com
From: Fei Wang 

Signed-off-by: Fei Wang 
---
 libavcodec/av1.h | 7 +++
 libavcodec/cbs_av1_syntax_template.c | 4 ++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/libavcodec/av1.h b/libavcodec/av1.h
index 384f7cddc7..8704bc41c1 100644
--- a/libavcodec/av1.h
+++ b/libavcodec/av1.h
@@ -175,6 +175,13 @@ enum {
 AV1_RESTORE_SWITCHABLE = 3,
 };
 
+// TX mode (section 6.8.21)
+enum {
+AV1_ONLY_4X4= 0,
+AV1_TX_MODE_LARGEST = 1,
+AV1_TX_MODE_SELECT  = 2,
+};
+
 // Sequence Headers are actually unbounded because one can use
 // an arbitrary number of leading zeroes when encoding via uvlc.
 // The following estimate is based around using the lowest number
diff --git a/libavcodec/cbs_av1_syntax_template.c 
b/libavcodec/cbs_av1_syntax_template.c
index a747e17784..3a5cafbfb7 100644
--- a/libavcodec/cbs_av1_syntax_template.c
+++ b/libavcodec/cbs_av1_syntax_template.c
@@ -1028,9 +1028,9 @@ static int FUNC(read_tx_mode)(CodedBitstreamContext *ctx, 
RWContext *rw,
 int err;
 
 if (priv->coded_lossless)
-infer(tx_mode, 0);
+infer(tx_mode, AV1_ONLY_4X4);
 else
-increment(tx_mode, 1, 2);
+increment(tx_mode, AV1_TX_MODE_LARGEST, AV1_TX_MODE_SELECT);
 
 return 0;
 }
-- 
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".