Re: [FFmpeg-devel] [PATCH] avfilter: add bilateral_cuda filter

2022-08-28 Thread Timo Rothenpieler

On 22.08.2022 22:03, Mohamed Khaled Mohamed wrote:

avfilter: add bilateral_cuda filter
GSoC'22

libavfilter/vf_bilateral_cuda.cu:the CUDA kernel for the filter
libavfilter/vf_bilateral_cuda.c: the C side that calls the kernel and gets user 
input
libavfilter/allfilters.c: added the filter to it
libavfilter/Makefile: added the filter to it
cuda/cuda_runtime.h: added two math CUDA functions that are used in the filter
configure: add cuda dependencies for the filter

Signed-off-by: Mohamed Khaled 
---
  Changelog|   1 +
  compat/cuda/cuda_runtime.h   |   1 +
  configure|   2 +
  doc/filters.texi |  39 +++
  libavfilter/Makefile |   1 +
  libavfilter/allfilters.c |   1 +
  libavfilter/version.h|   2 +-
  libavfilter/vf_bilateral_cuda.c  | 479 +++
  libavfilter/vf_bilateral_cuda.cu | 177 
  9 files changed, 702 insertions(+), 1 deletion(-)
  create mode 100644 libavfilter/vf_bilateral_cuda.c
  create mode 100644 libavfilter/vf_bilateral_cuda.cu

diff --git a/Changelog b/Changelog
index 121cfc3d90..d008be1577 100644
--- a/Changelog
+++ b/Changelog
@@ -28,6 +28,7 @@ version 5.1:
  - PHM image format support
  - remap_opencl filter
  - added chromakey_cuda filter
+- added bilateral_cuda filter
  
  
  version 5.0:

diff --git a/compat/cuda/cuda_runtime.h b/compat/cuda/cuda_runtime.h
index 5837c1ad37..58bc4c41af 100644
--- a/compat/cuda/cuda_runtime.h
+++ b/compat/cuda/cuda_runtime.h
@@ -182,6 +182,7 @@ static inline __device__ float fabsf(float a) { return 
__builtin_fabsf(a); }
  static inline __device__ float fabs(float a) { return __builtin_fabsf(a); }
  static inline __device__ double fabs(double a) { return __builtin_fabs(a); }
  static inline __device__ float sqrtf(float a) { return __builtin_sqrtf(a); }
+static inline __device__ float powf(float a,float  y) { return 
__builtin_powf(a,y); }


nit: space after ','


  static inline __device__ float __saturatef(float a) { return 
__nvvm_saturate_f(a); }
  static inline __device__ float __sinf(float a) { return 
__nvvm_sin_approx_f(a); }
diff --git a/configure b/configure
index 9d6457d81b..c71cb11fda 100755
--- a/configure
+++ b/configure
@@ -3144,6 +3144,8 @@ v4l2_m2m_deps="linux_videodev2_h sem_timedwait"
  
  chromakey_cuda_filter_deps="ffnvcodec"

  chromakey_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
+bilateral_cuda_filter_deps="ffnvcodec"
+bilateral_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
  hwupload_cuda_filter_deps="ffnvcodec"
  scale_npp_filter_deps="ffnvcodec libnpp"
  scale2ref_npp_filter_deps="ffnvcodec libnpp"
diff --git a/doc/filters.texi b/doc/filters.texi
index 40f21fb34c..70c1f60291 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -7965,6 +7965,45 @@ Set planes to filter. Default is first only.
  
  This filter supports the all above options as @ref{commands}.
  
+@section bilateral_cuda

+CUDA accelerated bilateral filter, an edge pereseving filter.


preserving I assume?


+This filter is mathematically accurate thanks to the use of GPU.
+For best output quality, use one to one chroma subsampling like yuv444 format.
+
+The filter accepts the following options:
+@table @option
+@item sigmaS
+Set sigma of gaussian function to calculate spatial weight.
+Allowed range is 0 to 512. Default is 0.1.
+
+@item sigmaR
+Set sigma of gaussian function to calculate range weight.
+Allowed range is 0 to 1. Default is 0.1.
+
+@item window_size
+Set window size of the bilateral function to determine the number of 
neighbours to loop on.
+If the number entered is even, a one will be added automatically.
+Allowed range is 1 to 255. Default is 1.
+@end table
+@subsection Examples
+
+@itemize
+@item
+Apply the bilateral filter on a video.
+
+@example
+./ffmpeg -v verbose \
+-hwaccel cuda -hwaccel_output_format cuda -i input.mp4  \
+-init_hw_device cuda \
+-filter_complex \
+" \
+[0:v]scale_cuda=format=yuv444p[scaled_video];
+[scaled_video]bilateral_cuda=window_size=9:sigmaS=3.0:sigmaR=50.0" \
+-an -sn -c:v h264_nvenc -cq 20 out.mp4
+@end example
+
+@end itemize
+
  @section bitplanenoise
  
  Show and measure bit plane noise.

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 30cc329fb6..d3284e2511 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -194,6 +194,7 @@ OBJS-$(CONFIG_AVGBLUR_VULKAN_FILTER) += 
vf_avgblur_vulkan.o vulkan.o vul
  OBJS-$(CONFIG_BBOX_FILTER)   += bbox.o vf_bbox.o
  OBJS-$(CONFIG_BENCH_FILTER)  += f_bench.o
  OBJS-$(CONFIG_BILATERAL_FILTER)  += vf_bilateral.o
+OBJS-$(CONFIG_BILATERAL_CUDA_FILTER) += vf_bilateral_cuda.o 
vf_bilateral_cuda.ptx.o
  OBJS-$(CONFIG_BITPLANENOISE_FILTER)  += vf_bitplanenoise.o
  OBJS-$(CONFIG_BLACKDETECT_FILTER)+= vf_blackdetect.o
  OBJS-$(CONFIG_BLACKFRAME_FILTER) += vf_blackframe.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
i

Re: [FFmpeg-devel] [PATCH] ipfsgateway: Remove default gateway

2022-08-28 Thread Tomas Härdin
lör 2022-08-27 klockan 10:34 -0700 skrev Baptiste Coudurier:
> On Aug 27, 2022, at 4:30 AM, Tomas Härdin  wrote:
> > 
> > lör 2022-08-27 klockan 09:53 +0200 skrev Paul B Mahol:
> > > On Sat, Aug 27, 2022 at 9:30 AM Tomas Härdin 
> > > wrote:
> > > 
> > > > ons 2022-08-24 klockan 23:03 +0200 skrev Michael Niedermayer:
> > > > > Also we have regression tests, external libs make that
> > > > > impossible
> > > > > as the version of external libs can change the behavior.
> > > > > Again
> > > > > this
> > > > > is a issue for mxf maybe less so libxml. You can also see
> > > > > that we
> > > > > have no
> > > > > tests involving  any of the external encoder libs, for that
> > > > > very
> > > > > reason.
> > > > > With each external lib that is needed for core features this
> > > > > would
> > > > > become a quickly growing problem
> > > > 
> > > > Testing is certainly a challenge, but almost certainly easier
> > > > than
> > > > reimplementing certain formats and codecs poorly, especially
> > > > MXF.
> > > > 
> > > > 
> > > Than why you are so called maintainer of thing you do not want to
> > > maintain?
> > 
> > Me maintaining mxfdec is precisely why I want to switch to bmx
> 
> I strongly oppose to that.
> Didn’t we just merge IMF support ? That seems to indicate that people
> are fine with FFmpeg MXF implementation.
> 
> If the need arises, I will maintain the MXF code, I use it everyday
> after all :)

Happy to see you still on this list Baptiste :)

My point is that both of us and the other few people in the free
software scene who care about MXF should focus our attention on bmx.

A similar argument can be made for j2k which I've been working on
lately. While the improvements I have made for the lavc decoder make it
considerably faster, it's still only about half as fast as openjpeg.
The effort currently being spent by the student implementing htj2k
support in our decoder might be better spent merging openjpeg and
implementing codeblock level multithreading like I have done for lavc's
j2k decoder..

/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] ipfsgateway: Remove default gateway

2022-08-28 Thread Michael Niedermayer
On Sat, Aug 27, 2022 at 09:05:06AM +0200, Tomas Härdin wrote:
> ons 2022-08-24 klockan 22:54 +0200 skrev Michael Niedermayer:
> > On Wed, Aug 24, 2022 at 06:35:04PM +0200, Tomas Härdin wrote:
> > > But for some reason the notion
> > > that the same applies to *all* parsers, including decoders and
> > > demuxers, this notion is hard to swallow. And similarly for
> > > encoders
> > > and muxers. I have yet to see a justification that is anything but
> > > cargo culting.
> > 
> > Its not hard to swallow, it simply is wrong.
> > Why is there Tesla ?
> > to build cars ?
> > no
> > "Tesla’s mission is to accelerate the world’s transition to
> > sustainable energy."
> 
> Tesla's mission is to generate profit, nothing else.

I am sorry but Teslas mission is what i said, and its the first line
on their About page

https://www.tesla.com/about

Thats an official statement and as such I would presume we can trust it.
If the first line of their about page was untrue i presume Tesla would
open itself up for some lawsuits


> 
> > they could outsource everything, from chip design to batteries to
> > software to
> > the car seats and so on but they dont because its better to reach
> > their goal
> > to do them internally
> 
> This has everything to do with economics of scale and ultimately
> economizing on labour, thus lowering the value of Tesla's lithium-ion
> cells and increasing profit.
> 
> For software the situation is very different, because the cost of
> reproducing a program is effectively zero. All labour goes into
> development. The goal of FFmpeg like every free software project is to
> create use-values. Any labour spent in excess of what is necessary to
> say be able to play MXF files is simply make-work.

With software there is cost in maintaining external libraries, not just
API, features, distribution issues, security, but also developers being
unhappy for example. This is not all that different from physical goods
its different terms but a software project that integrates 500 libraries
maintained by 500 external teams is going to be a huge pain than if you
habd the 500 things internally. Its 500 not well known codebases, each
could become unmaintained, may be unavailable or outdated on some platform
not that different from a car manufactor having to deal with supply chain
issues and other things from 500 external companies

Also even if the analogy would fail that doesnt make moving core
functionally to externally maintained libs a good idea.

thx

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

Does the universe only have a finite lifespan? No, its going to go on
forever, its just that you wont like living in it. -- Hiranya Peiri


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 v1] avformat/mxf: set stream frame rates for ST 422 essence containers

2022-08-28 Thread pal
From: Pierre-Anthony Lemieux 

The MXF demuxer does not currently set AVStream::avg_frame_rate and 
::r_frame_rate
when J2K essence is wrapped according to SMPTE ST 422.

---
 libavformat/mxfdec.c | 25 +
 1 file changed, 25 insertions(+)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index feebff67aa..043e2e06ec 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -2140,6 +2140,13 @@ finish_decoding_index:
 return ret;
 }
 
+static int mxf_is_st_422(const UID *essence_container_ul) {
+static const uint8_t st_422_essence_container_ul[] = { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x0c };
+
+return essence_container_ul && mxf_match_uid(*essence_container_ul, 
st_422_essence_container_ul,
+ 
sizeof(st_422_essence_container_ul));
+}
+
 static int mxf_is_intra_only(MXFDescriptor *descriptor)
 {
 return mxf_get_codec_ul(mxf_intra_only_essence_container_uls,
@@ -2892,6 +2899,24 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
 av_log(mxf->fc, AV_LOG_INFO, "Unknown frame layout type: 
%d\n", descriptor->frame_layout);
 }
 
+if (mxf_is_st_422(essence_container_ul)) {
+switch ((*essence_container_ul)[14]) {
+case 2: /* Cn: Clip- wrapped Picture Element */
+case 3: /* I1: Interlaced Frame, 1 field/KLV */
+case 4: /* I2: Interlaced Frame, 2 fields/KLV */
+case 6: /* P1: Frame- wrapped Picture Element */
+st->avg_frame_rate = source_track->edit_rate;
+st->r_frame_rate = st->avg_frame_rate;
+break;
+case 5: /* F1: Field-wrapped Picture Element */
+st->avg_frame_rate = av_mul_q(av_make_q(2, 1), 
source_track->edit_rate);
+st->r_frame_rate = st->avg_frame_rate;
+break;
+default:
+break;
+}
+}
+
 if (st->codecpar->codec_id == AV_CODEC_ID_PRORES) {
 switch (descriptor->essence_codec_ul[14]) {
 case 1: st->codecpar->codec_tag = MKTAG('a','p','c','o'); 
break;
-- 
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]lavc/j2kdec: Do not ignore colour association for packed formats

2022-08-28 Thread Carl Eugen Hoyos
Hi everybody!

Attached patch fixes ticket #9468 for me.

Please review, Carl Eugen
From a28a5e26892adf56a0bb9b33de2fb76b2405cc97 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Sun, 28 Aug 2022 17:47:23 +0200
Subject: [PATCH] lavc/j2kdec: Do not ignore colour association for packed
 formats.

Fixes ticket #9468.
---
 libavcodec/jpeg2000dec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 2c1191035c..c6187d6c43 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -2047,7 +2047,8 @@ static inline void tile_codeblocks(const Jpeg2000DecoderContext *s, Jpeg2000Tile
   \
 x   = tile->comp[compno].coord[0][0] -\
   ff_jpeg2000_ceildiv(s->image_offset_x, s->cdx[compno]); \
-dst = line + x * pixelsize + compno*!planar;  \
+dst = line + x * pixelsize +  \
+  (s->cdef[compno] ? s->cdef[compno] - 1 : compno) * !planar; \
   \
 if (codsty->transform == FF_DWT97) {  \
 for (; x < w; x++) {  \
-- 
2.30.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] avcodec/vpx_rac: Adjust vpx_rac_is_end) threshold

2022-08-28 Thread Michael Niedermayer
A threshold of 180 is needed and sufficient for the sample, twice this is used 
to
cover potentially worse samples

fate/vp5 changes as the sample file is truncated and the damaged part is handled
differently

Fixes: ticket #9754

Signed-off-by: Michael Niedermayer 
---
 libavcodec/vpx_rac.h | 2 +-
 tests/ref/fate/vp5   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/vpx_rac.h b/libavcodec/vpx_rac.h
index b158cc0754..2f5486f501 100644
--- a/libavcodec/vpx_rac.h
+++ b/libavcodec/vpx_rac.h
@@ -52,7 +52,7 @@ static av_always_inline int vpx_rac_is_end(VPXRangeCoder *c)
 {
 if (c->end <= c->buffer && c->bits >= 0)
 c->end_reached ++;
-return c->end_reached > 10;
+return c->end_reached > 360;
 }
 
 static av_always_inline unsigned int vpx_rac_renorm(VPXRangeCoder *c)
diff --git a/tests/ref/fate/vp5 b/tests/ref/fate/vp5
index 09ebe62b25..2116fb9b81 100644
--- a/tests/ref/fate/vp5
+++ b/tests/ref/fate/vp5
@@ -249,4 +249,4 @@
 0,243,243,1,   233472, 0x6f530ac6
 0,244,244,1,   233472, 0x94f7466c
 0,245,245,1,   233472, 0xa8c1d365
-0,246,246,1,   233472, 0x4f3ef38c
+0,246,246,1,   233472, 0xedcff050
-- 
2.17.1

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

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


Re: [FFmpeg-devel] [PATCH] avformat/avidec: Prevent entity expansion attacks

2022-08-28 Thread Michael Niedermayer
On Thu, Aug 18, 2022 at 12:32:57AM +0200, Michael Niedermayer wrote:
> Fixes: Timeout
> Fixes no testcase, this is the same idea as similar attacks against XML 
> parsers
> 
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/avidec.c | 12 +++-
>  1 file changed, 11 insertions(+), 1 deletion(-)

will apply

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

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu


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 4/4] avcodec/speedhq: Check width

2022-08-28 Thread Michael Niedermayer
On Sun, Aug 21, 2022 at 04:23:09PM +0200, Michael Niedermayer wrote:
> On Sun, Aug 21, 2022 at 12:54:57PM +0200, Paul B Mahol wrote:
> > On Fri, Aug 19, 2022 at 12:36 AM Michael Niedermayer 
> > 
> > wrote:
> > 
> > > Fixes: out of array access
> > > Fixes:
> > > 50014/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SPEEDHQ_fuzzer-4748914632294400
> > >
> > > Alternatively the buffer size can be increased
> > >
> > > Found-by: continuous fuzzing process
> > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > > Signed-off-by
> > > :
> > > Michael Niedermayer 
> > > ---
> > >  libavcodec/speedhq.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/libavcodec/speedhq.c b/libavcodec/speedhq.c
> > > index c43de4f199..ffee5f973b 100644
> > > --- a/libavcodec/speedhq.c
> > > +++ b/libavcodec/speedhq.c
> > > @@ -499,7 +499,7 @@ static int speedhq_decode_frame(AVCodecContext *avctx,
> > > AVFrame *frame,
> > >  uint32_t second_field_offset;
> > >  int ret;
> > >
> > > -if (buf_size < 4 || avctx->width < 8)
> > > +if (buf_size < 4 || avctx->width < 8 || avctx->width % 8 != 0)
> > >  return AVERROR_INVALIDDATA;
> > >
> > 
> > Is this right thing to do?
> 
> We can increase the buffer size or change how the %8 != 0 case is handled
> WIthout a non fuzzed file with such dimensions, I do not know what the
> correct handling of such a file is.

> What do you prefer to be done ?

ping

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides


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 2/4] avcodec/bethsoftvideo: Check block_type before frame alloc

2022-08-28 Thread Michael Niedermayer
On Fri, Aug 19, 2022 at 12:35:33AM +0200, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/bethsoftvideo.c | 8 ++--
>  1 file changed, 6 insertions(+), 2 deletions(-)

will apply

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

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu


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/4] avcodec/bethsoftvideo: Pass GetByteContext into set_palette()

2022-08-28 Thread Michael Niedermayer
On Fri, Aug 19, 2022 at 12:35:32AM +0200, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/bethsoftvideo.c | 13 +++--
>  1 file changed, 7 insertions(+), 6 deletions(-)

will apply

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

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact


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] tools/target_dec_fuzzer: Adjust threshold for bethsoftvid

2022-08-28 Thread Michael Niedermayer
On Fri, Aug 19, 2022 at 12:35:34AM +0200, Michael Niedermayer wrote:
> Fixes: Timeout
> Fixes: 
> 49791/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BETHSOFTVID_fuzzer-4583956145635328
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  tools/target_dec_fuzzer.c | 1 +
>  1 file changed, 1 insertion(+)

will apply

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

I have often repented speaking, but never of holding my tongue.
-- Xenocrates


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/2] avcodec/m101: Move checks before ff_get_buffer()

2022-08-28 Thread Michael Niedermayer
On Mon, Aug 22, 2022 at 04:58:32PM +0200, Michael Niedermayer wrote:
> Fixes: Timeout
> Fixes: 
> 50109/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_M101_fuzzer-6553193986785280
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/m101.c | 9 -
>  1 file changed, 4 insertions(+), 5 deletions(-)

will apply patchset

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

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides


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/4] libavformat/iff: Check for overflow in body_end calculation

2022-08-28 Thread Michael Niedermayer
On Tue, Aug 23, 2022 at 12:55:44AM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: -6322983228386819992 - 5557477266266529857 
> cannot be represented in type 'long'
> Fixes: 
> 50112/clusterfuzz-testcase-minimized-ffmpeg_dem_IFF_fuzzer-6329186221948928
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/iff.c | 3 +++
>  1 file changed, 3 insertions(+)

will apply patchset

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

The real ebay dictionary, page 1
"Used only once"- "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."


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 v2] doc/git-howto.texi: Document commit signing

2022-08-28 Thread Michael Niedermayer
On Tue, Aug 23, 2022 at 03:07:53PM -0300, James Almer wrote:
> On 8/23/2022 3:00 PM, Michael Niedermayer wrote:
> > On Wed, Aug 10, 2022 at 12:19:02AM +0200, Michael Niedermayer wrote:
> > > On Tue, Aug 09, 2022 at 04:38:56PM -0300, James Almer wrote:
> > > > On 8/9/2022 4:34 PM, Michael Niedermayer wrote:
> > > > > From: Michael Niedermayer 
> > [...]
> > > 
> > > > 
> > > > > +github consider mismatches a reason to declare such commits 
> > > > > unverified. After generating a key you
> > > > > +can add it to the MAINTAINER file and upload it to a keyserver.
> > > > 
> > > > Maybe link some external documentation about gpg keys, explaining the
> > > > difference between public and private keys,
> > > 
> > > what do you recommend ?
> > 
> > ping ?
> > we could link to the gpg docs but that seems kind of silly
> 
> I have no recommendation.
> 
> > 
> > 
> > > 
> > > 
> > > > how to encrypt the private one
> > > > with a passphrase, etc.
> > > 
> > > Have you tried to generate a gpg key without a passphrase ?
> 
> I probably mixed it in my mind with ssh keys, where you can store a private
> key unencrypted.
> 
> > > I just tried, and failed, gpg keeps asking for a passphrase until you 
> > > enter
> > > one or kill it. It kept haunting me and asking for a passphrase even after
> > > trying ctrl-c
> > > 
> > > 
> > > > Sites like gitlab tell you to not attempt to upload private keys,
> > > 
> > > ok
> > > 
> > > 
> > > > so i
> > > > imagine quite a lot of people have mistakenly done so in the past.
> > > 
> > > imagine?
> 
> "Every sign has a story". If Gitlab tells you to make sure to not attempt to
> upload a private key, then it could be that it has happened at some point.
> 
> > > 
> > > but what do you suggest? we can document how someone can create a key
> > > upload it and so on. You can provide me with a url that describes a
> > > working documentation for that, i surely do not have one. alot of
> > > documentations are somewhat bad. Many keyservers have died recently
> > > some existing keys like DSA seem to have some affinity to SHA1, and
> > > SHA1 is rejected today while at the same time still default on many
> > > setups, the one documentation i saw today to fix that DSA/SHA1 issue
> > > requires you to have a backup as it breaks your keys and is wrong.
> 
> If there's no good documentation or tutorial for this, then lets not bother
> with it. Your patch should be fine as is.

There may be a good one, its just that i dont know what to link to

will apply

thx

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

Never trust a computer, one day, it may think you are the virus. -- Compn


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

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


Re: [FFmpeg-devel] [PATCH] avformat/mov: Check count sums in build_open_gop_key_points()

2022-08-28 Thread Michael Niedermayer
On Tue, Aug 23, 2022 at 09:37:37PM +0200, Michael Niedermayer wrote:
> Fixes: ffmpeg.md
> Fixes: Out of array access
> Fixes: CVE-2022-2566
> 
> Found-by: Andy Nguyen 
> Found-by: 3pvd <3...@google.com>
> Reviewed-by: Andy Nguyen 
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/mov.c | 12 ++--
>  1 file changed, 10 insertions(+), 2 deletions(-)

will apply

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

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope


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] avcodec/videotoolboxenc: Add CBR option to H264 and HEVC encoder

2022-08-28 Thread Rick Kern
On Fri, Aug 26, 2022 at 7:42 AM Sebastian Beckmann <
beckmann.sebast...@outlook.de> wrote:

> Adds an option to use constant bitrate instead of average bitrate to the
> videotoolbox encoders. This is enabled via -constant_bit_rate true.
> macOS 13 is required for this option to work.
>
> Signed-off-by: Sebastian Beckmann 
> ---
> libavcodec/videotoolboxenc.c | 37 +---
> 1 file changed, 34 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
> index 823e5ad94e..9eb6fe09a2 100644
> --- a/libavcodec/videotoolboxenc.c
> +++ b/libavcodec/videotoolboxenc.c
> @@ -101,6 +101,7 @@ static struct{
> CFStringRef kVTCompressionPropertyKey_RealTime;
> CFStringRef kVTCompressionPropertyKey_TargetQualityForAlpha;
> CFStringRef
> kVTCompressionPropertyKey_PrioritizeEncodingSpeedOverQuality;
> +CFStringRef kVTCompressionPropertyKey_ConstantBitRate;
>
> CFStringRef
> kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder;
> CFStringRef
> kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder;
> @@ -164,6 +165,7 @@ static void loadVTEncSymbols(){
> "TargetQualityForAlpha");
> GET_SYM(kVTCompressionPropertyKey_PrioritizeEncodingSpeedOverQuality,
> "PrioritizeEncodingSpeedOverQuality");
> +GET_SYM(kVTCompressionPropertyKey_ConstantBitRate, "ConstantBitRate");
>
>
> GET_SYM(kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder,
> "EnableHardwareAcceleratedVideoEncoder");
> @@ -236,6 +238,7 @@ typedef struct VTEncContext {
> int realtime;
> int frames_before;
> int frames_after;
> +bool constant_bit_rate;
>
> int allow_sw;
> int require_sw;
> @@ -1073,12 +1076,22 @@ static bool vtenc_qscale_enabled(void)
> return !TARGET_OS_IPHONE && TARGET_CPU_ARM64;
> }
>
> +// constant bit rate only on Macs with Apple Silicon running macOS 13
> (Ventura) or newer
> +static bool vtenc_constant_bit_rate_enabled(void)
>

It's possible that Apple adds support for CBR on iOS or Intel-based Macs in
the future, so it would be more future-proof to avoid hard-coding here.
Then you could always try to set the property, and print an error message
if it returns an error.  See PrioritizeEncodingSpeedOverQuality for an
example.

I see the same hard-coded logic is used in vtenc_qscale_enabled(). Thanks
for following the patterns in this file, because that's usually the right
thing to do. However, the qscale issue slipped through the cracks and also
needs to be changed.


> +{
> +if (__builtin_available(macOS 13, *))

+return !TARGET_OS_IPHONE && TARGET_CPU_ARM64;
> +else
> +return false;
> +}
> +
> static int vtenc_create_encoder(AVCodecContext   *avctx,
> CMVideoCodecType codec_type,
> CFStringRef  profile_level,
> CFNumberRef  gamma_level,
> CFDictionaryRef  enc_info,
> CFDictionaryRef  pixel_buffer_info,
> +bool constant_bit_rate,
> VTCompressionSessionRef *session)
> {
> VTEncContext *vtctx = avctx->priv_data;
> @@ -1122,6 +1135,11 @@ static int vtenc_create_encoder(AVCodecContext
>  *avctx,
> return AVERROR_EXTERNAL;
> }
>
> +if (constant_bit_rate && !vtenc_constant_bit_rate_enabled()) {
> +av_log(avctx, AV_LOG_ERROR, "Error: -constant_bit_rate true not
> available for encoder.\n");
> +return AVERROR_EXTERNAL;
> +}
> +
> if (avctx->flags & AV_CODEC_FLAG_QSCALE) {
> quality = quality >= 100 ? 1.0 : quality / 100;
> quality_num = CFNumberCreate(kCFAllocatorDefault,
> @@ -1139,9 +1157,16 @@ static int vtenc_create_encoder(AVCodecContext
>  *avctx,
>   &bit_rate);
> if (!bit_rate_num) return AVERROR(ENOMEM);
>
> -status = VTSessionSetProperty(vtctx->session,
> -
> kVTCompressionPropertyKey_AverageBitRate,
> -  bit_rate_num);
> +if (constant_bit_rate) {
> +status = VTSessionSetProperty(vtctx->session,
> +
> compat_keys.kVTCompressionPropertyKey_ConstantBitRate,
> +  bit_rate_num);
>

For example, you could check status here, and output a message about no CBR
support.


> +} else {
> +status = VTSessionSetProperty(vtctx->session,
> +
> kVTCompressionPropertyKey_AverageBitRate,
> +  bit_rate_num);
> +}
> +
> CFRelease(bit_rate_num);
> }
>
> @@ -1530,6 +1555,7 @@ static int vtenc_configure_encoder(AVCodecContext
> *avctx)
>   gamma_level,
>   enc_info,
>   pixel_buffer_info,
> +  vtctx-

[FFmpeg-devel] [PATCH v3] avcodec/videotoolboxenc: Add CBR option to H264 and HEVC encoder

2022-08-28 Thread Sebastian Beckmann
Adds an option to use constant bitrate instead of average bitrate to the
videotoolbox encoders. This is enabled via -constant_bit_rate true.
macOS 13 is required for this option to work.

Signed-off-by: Sebastian Beckmann 
---
Removed the hard-coded check for Apple Silicon CPUs.

libavcodec/videotoolboxenc.c | 27 ---
1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index 823e5ad94e..9de86cc4d9 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -101,6 +101,7 @@ static struct{
CFStringRef kVTCompressionPropertyKey_RealTime;
CFStringRef kVTCompressionPropertyKey_TargetQualityForAlpha;
CFStringRef kVTCompressionPropertyKey_PrioritizeEncodingSpeedOverQuality;
+CFStringRef kVTCompressionPropertyKey_ConstantBitRate;

CFStringRef 
kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder;
CFStringRef 
kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder;
@@ -164,6 +165,7 @@ static void loadVTEncSymbols(){
"TargetQualityForAlpha");
GET_SYM(kVTCompressionPropertyKey_PrioritizeEncodingSpeedOverQuality,
"PrioritizeEncodingSpeedOverQuality");
+GET_SYM(kVTCompressionPropertyKey_ConstantBitRate, "ConstantBitRate");

GET_SYM(kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder,
"EnableHardwareAcceleratedVideoEncoder");
@@ -236,6 +238,7 @@ typedef struct VTEncContext {
int realtime;
int frames_before;
int frames_after;
+bool constant_bit_rate;

int allow_sw;
int require_sw;
@@ -1079,6 +1082,7 @@ static int vtenc_create_encoder(AVCodecContext   *avctx,
CFNumberRef  gamma_level,
CFDictionaryRef  enc_info,
CFDictionaryRef  pixel_buffer_info,
+bool constant_bit_rate,
VTCompressionSessionRef *session)
{
VTEncContext *vtctx = avctx->priv_data;
@@ -1139,9 +1143,20 @@ static int vtenc_create_encoder(AVCodecContext   *avctx,
  &bit_rate);
if (!bit_rate_num) return AVERROR(ENOMEM);

-status = VTSessionSetProperty(vtctx->session,
-  kVTCompressionPropertyKey_AverageBitRate,
-  bit_rate_num);
+if (constant_bit_rate) {
+status = VTSessionSetProperty(vtctx->session,
+  
compat_keys.kVTCompressionPropertyKey_ConstantBitRate,
+  bit_rate_num);
+if (status == kVTPropertyNotSupportedErr) {
+av_log(avctx, AV_LOG_ERROR, "Error: -constant_bit_rate true is 
not supported by the encoder.\n");
+return AVERROR_EXTERNAL;
+}
+} else {
+status = VTSessionSetProperty(vtctx->session,
+  
kVTCompressionPropertyKey_AverageBitRate,
+  bit_rate_num);
+}
+
CFRelease(bit_rate_num);
}

@@ -1530,6 +1545,7 @@ static int vtenc_configure_encoder(AVCodecContext *avctx)
  gamma_level,
  enc_info,
  pixel_buffer_info,
+  vtctx->constant_bit_rate,
  &vtctx->session);

init_cleanup:
@@ -2532,6 +2548,7 @@ static int vtenc_populate_extradata(AVCodecContext   
*avctx,
  gamma_level,
  enc_info,
  pixel_buffer_info,
+  vtctx->constant_bit_rate,
  &vtctx->session);
if (status)
goto pe_cleanup;
@@ -2727,6 +2744,8 @@ static const AVOption h264_options[] = {

{ "a53cc", "Use A53 Closed Captions (if available)", OFFSET(a53_cc), 
AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, VE },

+{ "constant_bit_rate", "Require constant bit rate (macOS 13 or newer)", 
OFFSET(constant_bit_rate), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
+
COMMON_OPTIONS
{ NULL },
};
@@ -2760,6 +2779,8 @@ static const AVOption hevc_options[] = {

{ "alpha_quality", "Compression quality for the alpha channel", 
OFFSET(alpha_quality), AV_OPT_TYPE_DOUBLE, { .dbl = 0.0 }, 0.0, 1.0, VE },

+{ "constant_bit_rate", "Require constant bit rate (macOS 13 or newer)", 
OFFSET(constant_bit_rate), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
+
COMMON_OPTIONS
{ NULL },
};
-- 
2.37.0 (Apple Git-136)

___
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 01/11] avcodec/mpeg4video: Factor non-codec stuff out into a header of its own

2022-08-28 Thread Andreas Rheinhardt
This avoids including mpegvideo.h in mpeg4_unpack_bframes_bsf.c.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/h263dec.c  |  1 +
 libavcodec/ituh263dec.c   |  1 +
 libavcodec/mpeg4_unpack_bframes_bsf.c |  2 +-
 libavcodec/mpeg4video.h   | 42 -
 libavcodec/mpeg4video_parser.c|  2 +-
 libavcodec/mpeg4videodec.c|  1 +
 libavcodec/mpeg4videodefs.h   | 68 +++
 libavcodec/mpeg4videoenc.c|  1 +
 libavcodec/nvdec_mpeg4.c  |  2 +-
 9 files changed, 75 insertions(+), 45 deletions(-)
 create mode 100644 libavcodec/mpeg4videodefs.h

diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 8b4101272a..a08329a121 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -43,6 +43,7 @@
 #include "mpeg_er.h"
 #include "mpeg4video.h"
 #include "mpeg4videodec.h"
+#include "mpeg4videodefs.h"
 #if FF_API_FLAG_TRUNCATED
 #include "mpeg4video_parser.h"
 #endif
diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c
index af054360d8..200de8527e 100644
--- a/libavcodec/ituh263dec.c
+++ b/libavcodec/ituh263dec.c
@@ -50,6 +50,7 @@
 #include "mpegvideodata.h"
 #include "mpegvideodec.h"
 #include "mpeg4videodec.h"
+#include "mpeg4videodefs.h"
 
 // The defines below define the number of bits that are read at once for
 // reading vlc values. Changing these may improve speed and data cache needs
diff --git a/libavcodec/mpeg4_unpack_bframes_bsf.c 
b/libavcodec/mpeg4_unpack_bframes_bsf.c
index 5493dafa97..3a3aad795f 100644
--- a/libavcodec/mpeg4_unpack_bframes_bsf.c
+++ b/libavcodec/mpeg4_unpack_bframes_bsf.c
@@ -21,7 +21,7 @@
 
 #include "bsf.h"
 #include "bsf_internal.h"
-#include "mpeg4video.h"
+#include "mpeg4videodefs.h"
 #include "startcode.h"
 
 typedef struct UnpackBFramesBSFContext {
diff --git a/libavcodec/mpeg4video.h b/libavcodec/mpeg4video.h
index ab65280756..29b11eb92e 100644
--- a/libavcodec/mpeg4video.h
+++ b/libavcodec/mpeg4video.h
@@ -27,48 +27,6 @@
 
 #include "mpegvideo.h"
 
-// shapes
-#define RECT_SHAPE   0
-#define BIN_SHAPE1
-#define BIN_ONLY_SHAPE   2
-#define GRAY_SHAPE   3
-
-#define SIMPLE_VO_TYPE   1
-#define CORE_VO_TYPE 3
-#define MAIN_VO_TYPE 4
-#define NBIT_VO_TYPE 5
-#define ARTS_VO_TYPE10
-#define ACE_VO_TYPE 12
-#define SIMPLE_STUDIO_VO_TYPE   14
-#define CORE_STUDIO_VO_TYPE 15
-#define ADV_SIMPLE_VO_TYPE  17
-
-#define VOT_VIDEO_ID 1
-#define VOT_STILL_TEXTURE_ID 2
-
-// aspect_ratio_info
-#define EXTENDED_PAR 15
-
-//vol_sprite_usage / sprite_enable
-#define STATIC_SPRITE 1
-#define GMC_SPRITE 2
-
-#define MOTION_MARKER 0x1F001
-#define DC_MARKER 0x6B001
-
-#define VOS_STARTCODE0x1B0
-#define USER_DATA_STARTCODE  0x1B2
-#define GOP_STARTCODE0x1B3
-#define VISUAL_OBJ_STARTCODE 0x1B5
-#define VOP_STARTCODE0x1B6
-#define SLICE_STARTCODE  0x1B7
-#define EXT_STARTCODE0x1B8
-
-#define QUANT_MATRIX_EXT_ID  0x3
-
-/* smaller packets likely don't contain a real frame */
-#define MAX_NVOP_SIZE 19
-
 void ff_mpeg4_clean_buffers(MpegEncContext *s);
 int ff_mpeg4_get_video_packet_prefix_length(MpegEncContext *s);
 void ff_mpeg4_init_direct_mv(MpegEncContext *s);
diff --git a/libavcodec/mpeg4video_parser.c b/libavcodec/mpeg4video_parser.c
index bbdb2209cf..e32a93d296 100644
--- a/libavcodec/mpeg4video_parser.c
+++ b/libavcodec/mpeg4video_parser.c
@@ -25,8 +25,8 @@
 #include "decode.h"
 #include "parser.h"
 #include "mpegvideo.h"
-#include "mpeg4video.h"
 #include "mpeg4videodec.h"
+#include "mpeg4videodefs.h"
 #if FF_API_FLAG_TRUNCATED
 /* Nuke this header when removing FF_API_FLAG_TRUNCATED */
 #include "mpeg4video_parser.h"
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index d89adf8d63..65f3c89c47 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -38,6 +38,7 @@
 #include "mpeg4video.h"
 #include "mpeg4videodata.h"
 #include "mpeg4videodec.h"
+#include "mpeg4videodefs.h"
 #include "h263.h"
 #include "h263data.h"
 #include "h263dec.h"
diff --git a/libavcodec/mpeg4videodefs.h b/libavcodec/mpeg4videodefs.h
new file mode 100644
index 00..27155eae5c
--- /dev/null
+++ b/libavcodec/mpeg4videodefs.h
@@ -0,0 +1,68 @@
+/*
+ * MPEG-4 definitions.
+ * Copyright (c) 2000,2001 Fabrice Bellard
+ * Copyright (c) 2002-2010 Michael Niedermayer 
+ *
+ * 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.
+ 

[FFmpeg-devel] [PATCH 02/11] avcodec/flac: Remove unnecessary FLACSTREAMINFO define

2022-08-28 Thread Andreas Rheinhardt
Possible since 38f5a266eed1160e87da8e832a0a07818d7673cb.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/flac.h | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/libavcodec/flac.h b/libavcodec/flac.h
index cb220ab4c0..315df492a3 100644
--- a/libavcodec/flac.h
+++ b/libavcodec/flac.h
@@ -69,14 +69,11 @@ enum FLACExtradataFormat {
  * Data needed from the Streaminfo header for use by the raw FLAC demuxer
  * and/or the FLAC decoder.
  */
-#define FLACSTREAMINFO \
-FLACCOMMONINFO \
-int max_blocksize;  /**< maximum block size, in samples  */\
-int max_framesize;  /**< maximum frame size, in bytes*/\
-int64_t samples;/**< total number of samples */\
-
 typedef struct FLACStreaminfo {
-FLACSTREAMINFO
+FLACCOMMONINFO
+int max_blocksize;  /**< maximum block size, in samples  */
+int max_framesize;  /**< maximum frame size, in bytes*/
+int64_t samples;/**< total number of samples */
 } FLACStreaminfo;
 
 typedef struct FLACFrameInfo {
-- 
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 03/11] avcodec/flacdec: Shorten name

2022-08-28 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/flacdec.c | 80 ++--
 1 file changed, 40 insertions(+), 40 deletions(-)

diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
index 5ddc5a34d2..d03369eb6d 100644
--- a/libavcodec/flacdec.c
+++ b/libavcodec/flacdec.c
@@ -50,7 +50,7 @@
 
 typedef struct FLACContext {
 AVClass *class;
-struct FLACStreaminfo flac_stream_info;
+FLACStreaminfo stream_info;
 
 AVCodecContext *avctx;  ///< parent AVCodecContext
 GetBitContext gb;   ///< GetBitContext initialized to 
start at the current frame
@@ -73,7 +73,7 @@ static int allocate_buffers(FLACContext *s);
 static void flac_set_bps(FLACContext *s)
 {
 enum AVSampleFormat req = s->avctx->request_sample_fmt;
-int need32 = s->flac_stream_info.bps > 16;
+int need32 = s->stream_info.bps > 16;
 int want32 = av_get_bytes_per_sample(req) > 2;
 int planar = av_sample_fmt_is_planar(req);
 
@@ -82,13 +82,13 @@ static void flac_set_bps(FLACContext *s)
 s->avctx->sample_fmt = AV_SAMPLE_FMT_S32P;
 else
 s->avctx->sample_fmt = AV_SAMPLE_FMT_S32;
-s->sample_shift = 32 - s->flac_stream_info.bps;
+s->sample_shift = 32 - s->stream_info.bps;
 } else {
 if (planar)
 s->avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
 else
 s->avctx->sample_fmt = AV_SAMPLE_FMT_S16;
-s->sample_shift = 16 - s->flac_stream_info.bps;
+s->sample_shift = 16 - s->stream_info.bps;
 }
 }
 
@@ -109,7 +109,7 @@ static av_cold int flac_decode_init(AVCodecContext *avctx)
 return AVERROR_INVALIDDATA;
 
 /* initialize based on the demuxer-supplied streamdata header */
-ret = ff_flac_parse_streaminfo(avctx, &s->flac_stream_info, streaminfo);
+ret = ff_flac_parse_streaminfo(avctx, &s->stream_info, streaminfo);
 if (ret < 0)
 return ret;
 ret = allocate_buffers(s);
@@ -117,7 +117,7 @@ static av_cold int flac_decode_init(AVCodecContext *avctx)
 return ret;
 flac_set_bps(s);
 ff_flacdsp_init(&s->dsp, avctx->sample_fmt,
-s->flac_stream_info.channels);
+s->stream_info.channels);
 s->got_streaminfo = 1;
 
 return 0;
@@ -137,10 +137,10 @@ static int allocate_buffers(FLACContext *s)
 int buf_size;
 int ret;
 
-av_assert0(s->flac_stream_info.max_blocksize);
+av_assert0(s->stream_info.max_blocksize);
 
-buf_size = av_samples_get_buffer_size(NULL, s->flac_stream_info.channels,
-  s->flac_stream_info.max_blocksize,
+buf_size = av_samples_get_buffer_size(NULL, s->stream_info.channels,
+  s->stream_info.max_blocksize,
   AV_SAMPLE_FMT_S32P, 0);
 if (buf_size < 0)
 return buf_size;
@@ -151,8 +151,8 @@ static int allocate_buffers(FLACContext *s)
 
 ret = av_samples_fill_arrays((uint8_t **)s->decoded, NULL,
  s->decoded_buffer,
- s->flac_stream_info.channels,
- s->flac_stream_info.max_blocksize,
+ s->stream_info.channels,
+ s->stream_info.max_blocksize,
  AV_SAMPLE_FMT_S32P, 0);
 return ret < 0 ? ret : 0;
 }
@@ -177,7 +177,7 @@ static int parse_streaminfo(FLACContext *s, const uint8_t 
*buf, int buf_size)
 metadata_size != FLAC_STREAMINFO_SIZE) {
 return AVERROR_INVALIDDATA;
 }
-ret = ff_flac_parse_streaminfo(s->avctx, &s->flac_stream_info, &buf[8]);
+ret = ff_flac_parse_streaminfo(s->avctx, &s->stream_info, &buf[8]);
 if (ret < 0)
 return ret;
 ret = allocate_buffers(s);
@@ -185,7 +185,7 @@ static int parse_streaminfo(FLACContext *s, const uint8_t 
*buf, int buf_size)
 return ret;
 flac_set_bps(s);
 ff_flacdsp_init(&s->dsp, s->avctx->sample_fmt,
-s->flac_stream_info.channels);
+s->stream_info.channels);
 s->got_streaminfo = 1;
 
 return 0;
@@ -389,13 +389,13 @@ static int decode_subframe_lpc(FLACContext *s, int32_t 
*decoded, int pred_order,
 if ((ret = decode_residuals(s, decoded, pred_order)) < 0)
 return ret;
 
-if (   (s->buggy_lpc && s->flac_stream_info.bps <= 16)
+if (   (s->buggy_lpc && s->stream_info.bps <= 16)
 || (   !s->buggy_lpc && bps <= 16
 && bps + coeff_prec + av_log2(pred_order) <= 32)) {
 s->dsp.lpc16(decoded, coeffs, pred_order, qlevel, s->blocksize);
 } else {
 s->dsp.lpc32(decoded, coeffs, pred_order, qlevel, s->blocksize);
-if (s->flac_stream_info.bps <= 16)
+if (s->stream_info.bps <= 16)
 lpc_analyze_remodulate(decoded, coeffs, pred_order, qlevel, 
s->blocksize, bps);
 }
 
@@ -406,7 +406,7 @@ s

[FFmpeg-devel] [PATCH 04/11] avcodec/flacdec: Don't infer max_framesize unnecessarily

2022-08-28 Thread Andreas Rheinhardt
This field is not really used by the decoder at all:
It is only output in some debug log message, but this debug
log message should better use the value read from the streaminfo
instead of a second-guessed value from the decoder.

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

diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
index d03369eb6d..3b16426e73 100644
--- a/libavcodec/flacdec.c
+++ b/libavcodec/flacdec.c
@@ -565,12 +565,6 @@ static int flac_decode_frame(AVCodecContext *avctx, 
AVFrame *frame,
 
 *got_frame_ptr = 0;
 
-if (s->stream_info.max_framesize == 0) {
-s->stream_info.max_framesize =
-ff_flac_get_max_frame_size(s->stream_info.max_blocksize ? 
s->stream_info.max_blocksize : FLAC_MAX_BLOCKSIZE,
-   FLAC_MAX_CHANNELS, 32);
-}
-
 if (buf_size > 5 && !memcmp(buf, "\177FLAC", 5)) {
 av_log(s->avctx, AV_LOG_DEBUG, "skipping flac header packet 1\n");
 return buf_size;
-- 
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 05/11] avcodec/flac: Move ff_flac_get_max_frame_size() to flacenc.c

2022-08-28 Thread Andreas Rheinhardt
It is its only user.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/Makefile  |  2 +-
 libavcodec/flac.c| 21 -
 libavcodec/flac.h|  8 
 libavcodec/flacenc.c | 40 ++--
 4 files changed, 35 insertions(+), 36 deletions(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index cb80f73d99..945908e3b8 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -347,7 +347,7 @@ OBJS-$(CONFIG_FIC_DECODER) += fic.o
 OBJS-$(CONFIG_FITS_DECODER)+= fitsdec.o fits.o
 OBJS-$(CONFIG_FITS_ENCODER)+= fitsenc.o
 OBJS-$(CONFIG_FLAC_DECODER)+= flacdec.o flacdata.o flacdsp.o flac.o
-OBJS-$(CONFIG_FLAC_ENCODER)+= flacenc.o flacdata.o flacencdsp.o 
flac.o
+OBJS-$(CONFIG_FLAC_ENCODER)+= flacenc.o flacdata.o flacencdsp.o
 OBJS-$(CONFIG_FLASHSV_DECODER) += flashsv.o
 OBJS-$(CONFIG_FLASHSV_ENCODER) += flashsvenc.o
 OBJS-$(CONFIG_FLASHSV2_ENCODER)+= flashsv2enc.o
diff --git a/libavcodec/flac.c b/libavcodec/flac.c
index dd68830622..03c7bfb9e6 100644
--- a/libavcodec/flac.c
+++ b/libavcodec/flac.c
@@ -145,27 +145,6 @@ int ff_flac_decode_frame_header(AVCodecContext *avctx, 
GetBitContext *gb,
 return 0;
 }
 
-int ff_flac_get_max_frame_size(int blocksize, int ch, int bps)
-{
-/* Technically, there is no limit to FLAC frame size, but an encoder
-   should not write a frame that is larger than if verbatim encoding mode
-   were to be used. */
-
-int count;
-
-count = 16;  /* frame header */
-count += ch * ((7+bps+7)/8); /* subframe headers */
-if (ch == 2) {
-/* for stereo, need to account for using decorrelation */
-count += (( 2*bps+1) * blocksize + 7) / 8;
-} else {
-count += ( ch*bps* blocksize + 7) / 8;
-}
-count += 2; /* frame footer */
-
-return count;
-}
-
 int ff_flac_is_extradata_valid(AVCodecContext *avctx,
enum FLACExtradataFormat *format,
uint8_t **streaminfo_start)
diff --git a/libavcodec/flac.h b/libavcodec/flac.h
index 315df492a3..239e842716 100644
--- a/libavcodec/flac.h
+++ b/libavcodec/flac.h
@@ -109,14 +109,6 @@ int ff_flac_is_extradata_valid(AVCodecContext *avctx,
enum FLACExtradataFormat *format,
uint8_t **streaminfo_start);
 
-/**
- * Calculate an estimate for the maximum frame size based on verbatim mode.
- * @param blocksize block size, in samples
- * @param ch number of channels
- * @param bps bits-per-sample
- */
-int ff_flac_get_max_frame_size(int blocksize, int ch, int bps);
-
 /**
  * Validate and decode a frame header.
  * @param  avctx AVCodecContext to use as av_log() context
diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c
index 73cf185314..0170e02ae8 100644
--- a/libavcodec/flacenc.c
+++ b/libavcodec/flacenc.c
@@ -157,6 +157,34 @@ static void write_streaminfo(FlacEncodeContext *s, uint8_t 
*header)
 }
 
 
+/**
+ * Calculate an estimate for the maximum frame size based on verbatim mode.
+ * @param blocksize block size, in samples
+ * @param ch number of channels
+ * @param bps bits-per-sample
+ */
+static int flac_get_max_frame_size(int blocksize, int ch, int bps)
+{
+/* Technically, there is no limit to FLAC frame size, but an encoder
+   should not write a frame that is larger than if verbatim encoding mode
+   were to be used. */
+
+int count;
+
+count = 16;  /* frame header */
+count += ch * ((7+bps+7)/8); /* subframe headers */
+if (ch == 2) {
+/* for stereo, need to account for using decorrelation */
+count += (( 2*bps+1) * blocksize + 7) / 8;
+} else {
+count += ( ch*bps* blocksize + 7) / 8;
+}
+count += 2; /* frame footer */
+
+return count;
+}
+
+
 /**
  * Set blocksize based on samplerate.
  * Choose the closest predefined blocksize >= BLOCK_TIME_MS milliseconds.
@@ -378,9 +406,9 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
 s->max_blocksize = s->avctx->frame_size;
 
 /* set maximum encoded frame size in verbatim mode */
-s->max_framesize = ff_flac_get_max_frame_size(s->avctx->frame_size,
-  s->channels,
-  
s->avctx->bits_per_raw_sample);
+s->max_framesize = flac_get_max_frame_size(s->avctx->frame_size,
+   s->channels,
+   s->avctx->bits_per_raw_sample);
 
 /* initialize MD5 context */
 s->md5ctx = av_md5_alloc();
@@ -1353,9 +1381,9 @@ static int flac_encode_frame(AVCodecContext *avctx, 
AVPacket *avpkt,
 
 /* change max_framesize for small final frame */
 if (frame->nb_samples < s->frame.blocksize) {
-s->max_framesize = ff_flac_get_max_frame_size(frame->nb_samples,

[FFmpeg-devel] [PATCH 07/11] avcodec/flac: Remove pointless define

2022-08-28 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/flac.h | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/libavcodec/flac.h b/libavcodec/flac.h
index 7d6286bf0f..dbfca546cf 100644
--- a/libavcodec/flac.h
+++ b/libavcodec/flac.h
@@ -55,24 +55,23 @@ enum {
 FLAC_METADATA_TYPE_INVALID = 127
 };
 
-#define FLACCOMMONINFO \
-int samplerate; /**< sample rate */\
-int channels;   /**< number of channels  */\
-int bps;/**< bits-per-sample */\
-
 /**
  * Data needed from the Streaminfo header for use by the raw FLAC demuxer
  * and/or the FLAC decoder.
  */
 typedef struct FLACStreaminfo {
-FLACCOMMONINFO
+int samplerate; /**< sample rate */
+int channels;   /**< number of channels  */
+int bps;/**< bits-per-sample */
 int max_blocksize;  /**< maximum block size, in samples  */
 int max_framesize;  /**< maximum frame size, in bytes*/
 int64_t samples;/**< total number of samples */
 } FLACStreaminfo;
 
 typedef struct FLACFrameInfo {
-FLACCOMMONINFO
+int samplerate; /**< sample rate */
+int channels;   /**< number of channels  */
+int bps;/**< bits-per-sample */
 int blocksize;  /**< block size of the frame */
 int ch_mode;/**< channel decorrelation mode  */
 int64_t frame_or_sample_num;/**< frame number or sample number   */
-- 
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 08/11] avcodec/flac: Move decoder+parser stuff into a new header, flac_parse.h

2022-08-28 Thread Andreas Rheinhardt
(The FLAC parser currently ignores the streaminfo block;
therefore some of this is decoder-only. Given that the FLAC
parser should probably use the streaminfo block, this stuff
is moved to flac_parse.h.)

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/flac.c|  1 +
 libavcodec/flac.h| 66 +
 libavcodec/flac_parse.h  | 89 
 libavcodec/flac_parser.c |  2 +-
 libavcodec/flacdec.c |  1 +
 5 files changed, 94 insertions(+), 65 deletions(-)
 create mode 100644 libavcodec/flac_parse.h

diff --git a/libavcodec/flac.c b/libavcodec/flac.c
index 1da8aed21b..352d663c67 100644
--- a/libavcodec/flac.c
+++ b/libavcodec/flac.c
@@ -26,6 +26,7 @@
 #include "get_bits.h"
 #include "flac.h"
 #include "flacdata.h"
+#include "flac_parse.h"
 
 static const int8_t sample_size_table[] = { 0, 8, 12, 0, 16, 20, 24, 0 };
 
diff --git a/libavcodec/flac.h b/libavcodec/flac.h
index dbfca546cf..fd899ef72c 100644
--- a/libavcodec/flac.h
+++ b/libavcodec/flac.h
@@ -1,5 +1,5 @@
 /*
- * FLAC (Free Lossless Audio Codec) decoder/demuxer common functions
+ * FLAC (Free Lossless Audio Codec) common stuff
  * Copyright (c) 2008 Justin Ruggles
  *
  * This file is part of FFmpeg.
@@ -21,15 +21,13 @@
 
 /**
  * @file
- * FLAC (Free Lossless Audio Codec) decoder/demuxer common functions
+ * FLAC (Free Lossless Audio Codec) common stuff
  */
 
 #ifndef AVCODEC_FLAC_H
 #define AVCODEC_FLAC_H
 
-#include "avcodec.h"
 #include "bytestream.h"
-#include "get_bits.h"
 
 #define FLAC_STREAMINFO_SIZE   34
 #define FLAC_MAX_CHANNELS   8
@@ -55,66 +53,6 @@ enum {
 FLAC_METADATA_TYPE_INVALID = 127
 };
 
-/**
- * Data needed from the Streaminfo header for use by the raw FLAC demuxer
- * and/or the FLAC decoder.
- */
-typedef struct FLACStreaminfo {
-int samplerate; /**< sample rate */
-int channels;   /**< number of channels  */
-int bps;/**< bits-per-sample */
-int max_blocksize;  /**< maximum block size, in samples  */
-int max_framesize;  /**< maximum frame size, in bytes*/
-int64_t samples;/**< total number of samples */
-} FLACStreaminfo;
-
-typedef struct FLACFrameInfo {
-int samplerate; /**< sample rate */
-int channels;   /**< number of channels  */
-int bps;/**< bits-per-sample */
-int blocksize;  /**< block size of the frame */
-int ch_mode;/**< channel decorrelation mode  */
-int64_t frame_or_sample_num;/**< frame number or sample number   */
-int is_var_size;/**< specifies if the stream uses variable
- block sizes or a fixed block size;
- also determines the meaning of
- frame_or_sample_num */
-} FLACFrameInfo;
-
-/**
- * Parse the Streaminfo metadata block
- * @param[out] avctx   codec context to set basic stream parameters
- * @param[out] s   where parsed information is stored
- * @param[in]  buffer  pointer to start of 34-byte streaminfo data
- *
- * @return negative error code on faiure or >= 0 on success
- */
-int ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
-  const uint8_t *buffer);
-
-/**
- * Validate the FLAC extradata.
- * @param[in]  avctx codec context containing the extradata.
- * @param[out] format extradata format.
- * @param[out] streaminfo_start pointer to start of 34-byte STREAMINFO data.
- * @return 1 if valid, 0 if not valid.
- */
-int ff_flac_is_extradata_valid(AVCodecContext *avctx,
-   uint8_t **streaminfo_start);
-
-/**
- * Validate and decode a frame header.
- * @param  avctx AVCodecContext to use as av_log() context
- * @param  gbGetBitContext from which to read frame header
- * @param[out] fiframe information
- * @param  log_level_offset  log level offset. can be used to silence 
error messages.
- * @return non-zero on error, 0 if ok
- */
-int ff_flac_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb,
-FLACFrameInfo *fi, int log_level_offset);
-
-void ff_flac_set_channel_layout(AVCodecContext *avctx, int channels);
-
 /**
  * Parse the metadata block parameters from the header.
  * @param[in]  block_header header data, at least 4 bytes
diff --git a/libavcodec/flac_parse.h b/libavcodec/flac_parse.h
new file mode 100644
index 00..67a7320bea
--- /dev/null
+++ b/libavcodec/flac_parse.h
@@ -0,0 +1,89 @@
+/*
+ * FLAC (Free Lossless Audio Codec) decoder/parser common functions
+ * Copyright (c) 2008 Justin Ruggles
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free sof

[FFmpeg-devel] [PATCH 09/11] avcodec/flac: Don't use bytestream API unnecessarily

2022-08-28 Thread Andreas Rheinhardt
It makes no sense here, as flac_parse_block_header()
is not even supposed to advance the caller's pointer.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/flac.h | 6 +++---
 libavformat/flacdec.c | 1 +
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavcodec/flac.h b/libavcodec/flac.h
index fd899ef72c..f118dbbff3 100644
--- a/libavcodec/flac.h
+++ b/libavcodec/flac.h
@@ -27,7 +27,7 @@
 #ifndef AVCODEC_FLAC_H
 #define AVCODEC_FLAC_H
 
-#include "bytestream.h"
+#include "libavutil/intreadwrite.h"
 
 #define FLAC_STREAMINFO_SIZE   34
 #define FLAC_MAX_CHANNELS   8
@@ -63,13 +63,13 @@ enum {
 static av_always_inline void flac_parse_block_header(const uint8_t 
*block_header,
   int *last, int *type, 
int *size)
 {
-int tmp = bytestream_get_byte(&block_header);
+int tmp = *block_header;
 if (last)
 *last = tmp & 0x80;
 if (type)
 *type = tmp & 0x7F;
 if (size)
-*size = bytestream_get_be24(&block_header);
+*size = AV_RB24(block_header + 1);
 }
 
 #endif /* AVCODEC_FLAC_H */
diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c
index 09404b67bb..eadd41fc36 100644
--- a/libavformat/flacdec.c
+++ b/libavformat/flacdec.c
@@ -20,6 +20,7 @@
  */
 
 #include "libavutil/channel_layout.h"
+#include "libavcodec/bytestream.h"
 #include "libavcodec/flac.h"
 #include "avformat.h"
 #include "demux.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 10/11] avcodec/encode: Avoid unreferencing blank AVFrames

2022-08-28 Thread Andreas Rheinhardt
ff_thread_video_encode_frame() already returns blank frames.

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

diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index 2c02b24cf2..8c6d81286c 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -263,18 +263,17 @@ static int encode_simple_internal(AVCodecContext *avctx, 
AVPacket *avpkt)
 av_assert0(codec->cb_type == FF_CODEC_CB_TYPE_ENCODE);
 
 if (CONFIG_FRAME_THREAD_ENCODER && avci->frame_thread_encoder)
-/* This might unref frame. */
+/* This will unref frame. */
 ret = ff_thread_video_encode_frame(avctx, avpkt, frame, &got_packet);
 else {
 ret = ff_encode_encode_cb(avctx, avpkt, frame, &got_packet);
+if (frame)
+av_frame_unref(frame);
 }
 
 if (avci->draining && !got_packet)
 avci->draining_done = 1;
 
-if (frame)
-av_frame_unref(frame);
-
 return ret;
 }
 
-- 
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 11/11] avcodec/frame_thread_encoder: Stop serializing unreferencing AVFrames

2022-08-28 Thread Andreas Rheinhardt
Currently, the frame-threaded decoding API still supports thread-unsafe
callbacks. If one uses a thread-unsafe get_buffer2() callback,
calls to av_frame_unref() by the decoder are serialized, because
it is presumed that the underlying deallocator is thread-unsafe.

The frame-threaded encoder seems to have been written with this
restriction in mind: It always serializes unreferencing its AVFrames,
although no documentation forces it to do so.

This commit schedules to change this behaviour as soon as thread-unsafe
callbacks are removed. For this reason, the FF_API_THREAD_SAFE_CALLBACKS
define is reused.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/encode.c   |  8 +++-
 libavcodec/encode.h   |  2 +-
 libavcodec/frame_thread_encoder.c | 14 ++
 3 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index 8c6d81286c..ade4d458e7 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -190,7 +190,7 @@ int ff_encode_get_frame(AVCodecContext *avctx, AVFrame 
*frame)
 }
 
 int ff_encode_encode_cb(AVCodecContext *avctx, AVPacket *avpkt,
-const AVFrame *frame, int *got_packet)
+AVFrame *frame, int *got_packet)
 {
 const FFCodec *const codec = ffcodec(avctx->codec);
 int ret;
@@ -227,6 +227,10 @@ int ff_encode_encode_cb(AVCodecContext *avctx, AVPacket 
*avpkt,
 unref:
 av_packet_unref(avpkt);
 }
+#if !FF_API_THREAD_SAFE_CALLBACKS
+if (frame)
+av_frame_unref(frame);
+#endif
 
 return ret;
 }
@@ -267,8 +271,10 @@ static int encode_simple_internal(AVCodecContext *avctx, 
AVPacket *avpkt)
 ret = ff_thread_video_encode_frame(avctx, avpkt, frame, &got_packet);
 else {
 ret = ff_encode_encode_cb(avctx, avpkt, frame, &got_packet);
+#if FF_API_THREAD_SAFE_CALLBACKS
 if (frame)
 av_frame_unref(frame);
+#endif
 }
 
 if (avci->draining && !got_packet)
diff --git a/libavcodec/encode.h b/libavcodec/encode.h
index 296ffd312e..81d18d6ead 100644
--- a/libavcodec/encode.h
+++ b/libavcodec/encode.h
@@ -76,7 +76,7 @@ int ff_alloc_packet(AVCodecContext *avctx, AVPacket *avpkt, 
int64_t size);
 int ff_encode_preinit(AVCodecContext *avctx);
 
 int ff_encode_encode_cb(AVCodecContext *avctx, AVPacket *avpkt,
-const AVFrame *frame, int *got_packet);
+AVFrame *frame, int *got_packet);
 
 /**
  * Rescale from sample rate to AVCodecContext.time_base.
diff --git a/libavcodec/frame_thread_encoder.c 
b/libavcodec/frame_thread_encoder.c
index 1faaef522e..35775ae823 100644
--- a/libavcodec/frame_thread_encoder.c
+++ b/libavcodec/frame_thread_encoder.c
@@ -48,7 +48,9 @@ typedef struct{
 
 typedef struct{
 AVCodecContext *parent_avctx;
+#if FF_API_THREAD_SAFE_CALLBACKS
 pthread_mutex_t buffer_mutex;
+#endif
 
 pthread_mutex_t task_fifo_mutex; /* Used to guard (next_)task_index */
 pthread_cond_t task_fifo_cond;
@@ -68,9 +70,15 @@ typedef struct{
 } ThreadContext;
 
 #define OFF(member) offsetof(ThreadContext, member)
+#if FF_API_THREAD_SAFE_CALLBACKS
 DEFINE_OFFSET_ARRAY(ThreadContext, thread_ctx, pthread_init_cnt,
 (OFF(buffer_mutex), OFF(task_fifo_mutex), 
OFF(finished_task_mutex)),
 (OFF(task_fifo_cond), OFF(finished_task_cond)));
+#else
+DEFINE_OFFSET_ARRAY(ThreadContext, thread_ctx, pthread_init_cnt,
+(OFF(task_fifo_mutex), OFF(finished_task_mutex)),
+(OFF(task_fifo_cond),  OFF(finished_task_cond)));
+#endif
 #undef OFF
 
 static void * attribute_align_arg worker(void *v){
@@ -104,9 +112,11 @@ static void * attribute_align_arg worker(void *v){
 pkt   = task->outdata;
 
 ret = ff_encode_encode_cb(avctx, pkt, frame, &task->got_packet);
+#if FF_API_THREAD_SAFE_CALLBACKS
 pthread_mutex_lock(&c->buffer_mutex);
 av_frame_unref(frame);
 pthread_mutex_unlock(&c->buffer_mutex);
+#endif
 pthread_mutex_lock(&c->finished_task_mutex);
 task->return_code = ret;
 task->finished= 1;
@@ -114,9 +124,13 @@ static void * attribute_align_arg worker(void *v){
 pthread_mutex_unlock(&c->finished_task_mutex);
 }
 end:
+#if FF_API_THREAD_SAFE_CALLBACKS
 pthread_mutex_lock(&c->buffer_mutex);
+#endif
 avcodec_close(avctx);
+#if FF_API_THREAD_SAFE_CALLBACKS
 pthread_mutex_unlock(&c->buffer_mutex);
+#endif
 av_freep(&avctx);
 return NULL;
 }
-- 
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 06/11] avcodec/flac: Remove unused parameter from ff_flac_is_extradata_valid()

2022-08-28 Thread Andreas Rheinhardt
format is write-only.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/flac.c| 3 ---
 libavcodec/flac.h| 6 --
 libavcodec/flacdec.c | 3 +--
 3 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/libavcodec/flac.c b/libavcodec/flac.c
index 03c7bfb9e6..1da8aed21b 100644
--- a/libavcodec/flac.c
+++ b/libavcodec/flac.c
@@ -146,7 +146,6 @@ int ff_flac_decode_frame_header(AVCodecContext *avctx, 
GetBitContext *gb,
 }
 
 int ff_flac_is_extradata_valid(AVCodecContext *avctx,
-   enum FLACExtradataFormat *format,
uint8_t **streaminfo_start)
 {
 if (!avctx->extradata || avctx->extradata_size < FLAC_STREAMINFO_SIZE) {
@@ -159,14 +158,12 @@ int ff_flac_is_extradata_valid(AVCodecContext *avctx,
 av_log(avctx, AV_LOG_WARNING, "extradata contains %d bytes too 
many.\n",
FLAC_STREAMINFO_SIZE-avctx->extradata_size);
 }
-*format = FLAC_EXTRADATA_FORMAT_STREAMINFO;
 *streaminfo_start = avctx->extradata;
 } else {
 if (avctx->extradata_size < 8+FLAC_STREAMINFO_SIZE) {
 av_log(avctx, AV_LOG_ERROR, "extradata too small.\n");
 return 0;
 }
-*format = FLAC_EXTRADATA_FORMAT_FULL_HEADER;
 *streaminfo_start = &avctx->extradata[8];
 }
 return 1;
diff --git a/libavcodec/flac.h b/libavcodec/flac.h
index 239e842716..7d6286bf0f 100644
--- a/libavcodec/flac.h
+++ b/libavcodec/flac.h
@@ -55,11 +55,6 @@ enum {
 FLAC_METADATA_TYPE_INVALID = 127
 };
 
-enum FLACExtradataFormat {
-FLAC_EXTRADATA_FORMAT_STREAMINFO  = 0,
-FLAC_EXTRADATA_FORMAT_FULL_HEADER = 1
-};
-
 #define FLACCOMMONINFO \
 int samplerate; /**< sample rate */\
 int channels;   /**< number of channels  */\
@@ -106,7 +101,6 @@ int ff_flac_parse_streaminfo(AVCodecContext *avctx, struct 
FLACStreaminfo *s,
  * @return 1 if valid, 0 if not valid.
  */
 int ff_flac_is_extradata_valid(AVCodecContext *avctx,
-   enum FLACExtradataFormat *format,
uint8_t **streaminfo_start);
 
 /**
diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
index 3b16426e73..23e9eba4ad 100644
--- a/libavcodec/flacdec.c
+++ b/libavcodec/flacdec.c
@@ -94,7 +94,6 @@ static void flac_set_bps(FLACContext *s)
 
 static av_cold int flac_decode_init(AVCodecContext *avctx)
 {
-enum FLACExtradataFormat format;
 uint8_t *streaminfo;
 int ret;
 FLACContext *s = avctx->priv_data;
@@ -105,7 +104,7 @@ static av_cold int flac_decode_init(AVCodecContext *avctx)
 if (!avctx->extradata)
 return 0;
 
-if (!ff_flac_is_extradata_valid(avctx, &format, &streaminfo))
+if (!ff_flac_is_extradata_valid(avctx, &streaminfo))
 return AVERROR_INVALIDDATA;
 
 /* initialize based on the demuxer-supplied streamdata header */
-- 
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] Converting build to CMake

2022-08-28 Thread Jaime Rios
Sorry if this has been asked before in the past.

I am wondering if there has been any conversation around changing the
current build setup of ffmpeg to CMake.

The reason I ask is that I am not a fan of having to install MinGW just to
build on Windows, and my experience so far with CMake has been a pleasant
one, when having to build on multiple platforms (Windows/Linux/macOS).

If there has been conversation about moving to CMake, where can I find the
thread?

Thank you.



-Jaime
___
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] Converting build to CMake

2022-08-28 Thread Gonzalo Garramuño


On 28/8/22 20:17, Jaime Rios wrote:

Sorry if this has been asked before in the past.

I am wondering if there has been any conversation around changing the
current build setup of ffmpeg to CMake.

The reason I ask is that I am not a fan of having to install MinGW just to
build on Windows, and my experience so far with CMake has been a pleasant
one, when having to build on multiple platforms (Windows/Linux/macOS).

If there has been conversation about moving to CMake, where can I find the
thread?


I would love that to happen myself too.  The main issue is all the 
dependencies that ffmpeg has to take care of. You need to have 
FindLib*.cmake and/or BuldLib*cmake, plus you need to take care of which 
libraries are open source, BSD, GPL, etc. and whether you need to locate 
them with pkgconfig.


It is overall a lot of work, so something would need to get paid to do 
so fulltime.


I have to wonder, as I only have Windows 8.1 so far, doesn't Windows 10 
WSL2 solve the compilation issues by having the lib be compiled on an 
Ubuntu distro?


--
Gonzalo Garramuño
ggarr...@gmail.com

___
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 12/16] avutil/internal: Remove unused ff_rint64_clip()

2022-08-28 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavutil/internal.h | 36 
 1 file changed, 36 deletions(-)

diff --git a/libavutil/internal.h b/libavutil/internal.h
index b44cbaaa7b..c118936598 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -217,42 +217,6 @@ void avpriv_request_sample(void *avc,
 #define SUINT32 uint32_t
 #endif
 
-/**
- * Clip and convert a double value into the long long amin-amax range.
- * This function is needed because conversion of floating point to integers 
when
- * it does not fit in the integer's representation does not necessarily 
saturate
- * correctly (usually converted to a cvttsd2si on x86) which saturates numbers
- * > INT64_MAX to INT64_MIN. The standard marks such conversions as undefined
- * behavior, allowing this sort of mathematically bogus conversions. This 
provides
- * a safe alternative that is slower obviously but assures safety and better
- * mathematical behavior.
- * @param a value to clip
- * @param amin minimum value of the clip range
- * @param amax maximum value of the clip range
- * @return clipped value
- */
-static av_always_inline av_const int64_t ff_rint64_clip(double a, int64_t 
amin, int64_t amax)
-{
-int64_t res;
-#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
-if (amin > amax) abort();
-#endif
-// INT64_MAX+1,INT64_MIN are exactly representable as IEEE doubles
-// do range checks first
-if (a >=  9223372036854775808.0)
-return amax;
-if (a <= -9223372036854775808.0)
-return amin;
-
-// safe to call llrint and clip accordingly
-res = llrint(a);
-if (res > amax)
-return amax;
-if (res < amin)
-return amin;
-return res;
-}
-
 /**
  * A wrapper for open() setting O_CLOEXEC.
  */
-- 
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 13/16] avutil/internal: Remove unused FF_SYMVER

2022-08-28 Thread Andreas Rheinhardt
It is unused since d63443b9684fa7b3e086634f7b44b203b6d9221e.
Furthermore, it was always in the wrong header:
libavutil/internal.h is auto-included almost everywhere, but
FF_SYMVER would only ever be used at a few places, so a proper
header of its own would be appropriate for it.

Signed-off-by: Andreas Rheinhardt 
---
 libavutil/internal.h | 28 
 1 file changed, 28 deletions(-)

diff --git a/libavutil/internal.h b/libavutil/internal.h
index c118936598..8ee5a101c6 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -117,34 +117,6 @@
 #   define NULL_IF_CONFIG_SMALL(x) x
 #endif
 
-/**
- * Define a function with only the non-default version specified.
- *
- * On systems with ELF shared libraries, all symbols exported from
- * FFmpeg libraries are tagged with the name and major version of the
- * library to which they belong.  If a function is moved from one
- * library to another, a wrapper must be retained in the original
- * location to preserve binary compatibility.
- *
- * Functions defined with this macro will never be used to resolve
- * symbols by the build-time linker.
- *
- * @param type return type of function
- * @param name name of function
- * @param args argument list of function
- * @param ver  version tag to assign function
- */
-#if HAVE_SYMVER_ASM_LABEL
-#   define FF_SYMVER(type, name, args, ver) \
-type ff_##name args __asm__ (EXTERN_PREFIX #name "@" ver);  \
-type ff_##name args
-#elif HAVE_SYMVER_GNU_ASM
-#   define FF_SYMVER(type, name, args, ver) \
-__asm__ (".symver ff_" #name "," EXTERN_PREFIX #name "@" ver);  \
-type ff_##name args;\
-type ff_##name args
-#endif
-
 /**
  * Return NULL if a threading library has not been enabled.
  * Used to disable threading functions in AVCodec definitions
-- 
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 14/16] avutil/dict: Move avpriv_dict_set_timestamp() to a header of its own

2022-08-28 Thread Andreas Rheinhardt
It is used almost nowhere, so it needn't be auto-included
almost everywhere.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/flvdec.c  |  1 +
 libavformat/ifv.c |  1 +
 libavformat/matroskadec.c |  1 +
 libavformat/mov.c |  1 +
 libavformat/mux_utils.c   |  1 +
 libavformat/mxfdec.c  |  1 +
 libavutil/dict.c  |  1 +
 libavutil/dict_internal.h | 37 +
 libavutil/internal.h  | 12 
 9 files changed, 44 insertions(+), 12 deletions(-)
 create mode 100644 libavutil/dict_internal.h

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 10f0ea7736..7f9d795044 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -28,6 +28,7 @@
 #include "libavutil/avstring.h"
 #include "libavutil/channel_layout.h"
 #include "libavutil/dict.h"
+#include "libavutil/dict_internal.h"
 #include "libavutil/opt.h"
 #include "libavutil/internal.h"
 #include "libavutil/intfloat.h"
diff --git a/libavformat/ifv.c b/libavformat/ifv.c
index 490608c5de..694abd951b 100644
--- a/libavformat/ifv.c
+++ b/libavformat/ifv.c
@@ -21,6 +21,7 @@
  */
 
 #include "libavutil/channel_layout.h"
+#include "libavutil/dict_internal.h"
 #include "avformat.h"
 #include "internal.h"
 #include "avio_internal.h"
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index ad7ee390a2..16a3e93611 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -38,6 +38,7 @@
 #include "libavutil/base64.h"
 #include "libavutil/bprint.h"
 #include "libavutil/dict.h"
+#include "libavutil/dict_internal.h"
 #include "libavutil/display.h"
 #include "libavutil/intfloat.h"
 #include "libavutil/intreadwrite.h"
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 35e2271b14..df45408060 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -32,6 +32,7 @@
 #include "libavutil/attributes.h"
 #include "libavutil/bprint.h"
 #include "libavutil/channel_layout.h"
+#include "libavutil/dict_internal.h"
 #include "libavutil/internal.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/intfloat.h"
diff --git a/libavformat/mux_utils.c b/libavformat/mux_utils.c
index 8b95fc5e7e..764c834fa2 100644
--- a/libavformat/mux_utils.c
+++ b/libavformat/mux_utils.c
@@ -20,6 +20,7 @@
  */
 
 #include "libavutil/dict.h"
+#include "libavutil/dict_internal.h"
 #include "libavutil/internal.h"
 #include "libavutil/log.h"
 #include "libavutil/mem.h"
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index feebff67aa..e63e803aa5 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -53,6 +53,7 @@
 #include "libavcodec/bytestream.h"
 #include "libavcodec/internal.h"
 #include "libavutil/channel_layout.h"
+#include "libavutil/dict_internal.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/timecode.h"
diff --git a/libavutil/dict.c b/libavutil/dict.c
index 9d3d96c58b..a4f638a1fc 100644
--- a/libavutil/dict.c
+++ b/libavutil/dict.c
@@ -22,6 +22,7 @@
 
 #include "avstring.h"
 #include "dict.h"
+#include "dict_internal.h"
 #include "internal.h"
 #include "mem.h"
 #include "time_internal.h"
diff --git a/libavutil/dict_internal.h b/libavutil/dict_internal.h
new file mode 100644
index 00..6d5b0dc2b0
--- /dev/null
+++ b/libavutil/dict_internal.h
@@ -0,0 +1,37 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_DICT_INTERNAL_H
+#define AVUTIL_DICT_INTERNAL_H
+
+#include 
+
+#include "dict.h"
+
+/**
+ * Set a dictionary value to an ISO-8601 compliant timestamp string.
+ *
+ * @param dict pointer to a pointer to a dictionary struct. If *dict is NULL
+ * a dictionary struct is allocated and put in *dict.
+ * @param key metadata key
+ * @param timestamp unix timestamp in microseconds
+ * @return <0 on error
+ */
+int avpriv_dict_set_timestamp(AVDictionary **dict, const char *key, int64_t 
timestamp);
+
+#endif /* AVUTIL_DICT_INTERNAL_H */
diff --git a/libavutil/internal.h b/libavutil/internal.h
index 8ee5a101c6..8bdc7b3ac8 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -41,7 +41,6 @@
 #include "config.h"
 #include "attributes.h"
 #include "timer.h"
-#include "dict.h"
 #include "macros.h"
 #include "pixfmt.h"
 
@@ -230,15 +229,4 @@ static av_always_inl

[FFmpeg-devel] [PATCH 15/16] avutil/internal: Move avpriv-file API to a header of its own

2022-08-28 Thread Andreas Rheinhardt
It is not used by the large majority of files that include
lavu/internal.h.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/dvdsubdec.c|  1 +
 libavcodec/libxvid.c  |  2 +-
 libavdevice/bktr.c|  1 +
 libavdevice/fbdev_common.c|  1 +
 libavdevice/fbdev_dec.c   |  1 +
 libavdevice/fbdev_enc.c   |  1 +
 libavdevice/oss.c |  1 +
 libavfilter/af_arnndn.c   |  4 +--
 libavfilter/af_firequalizer.c |  1 +
 libavfilter/opencl.c  |  1 +
 libavfilter/vf_curves.c   |  2 +-
 libavfilter/vf_deshake.c  |  2 +-
 libavfilter/vf_dnn_classify.c |  6 +---
 libavfilter/vf_dnn_detect.c   |  6 +---
 libavfilter/vf_fieldhint.c|  1 +
 libavfilter/vf_lut3d.c|  4 +--
 libavfilter/vf_nnedi.c|  2 +-
 libavfilter/vf_paletteuse.c   |  1 +
 libavfilter/vf_psnr.c |  3 +-
 libavfilter/vf_signature.c|  4 +--
 libavfilter/vf_ssim.c |  3 +-
 libavfilter/vf_vidstabdetect.c|  3 +-
 libavfilter/vf_vidstabtransform.c |  3 +-
 libavfilter/vf_vmafmotion.c   |  1 +
 libavformat/cache.c   |  4 +--
 libavformat/file.c|  3 +-
 libavformat/ipfsgateway.c |  1 +
 libavutil/file.c  |  1 +
 libavutil/file_open.c |  3 +-
 libavutil/file_open.h | 57 +++
 libavutil/internal.h  | 28 ---
 libavutil/random_seed.c   |  1 +
 32 files changed, 92 insertions(+), 61 deletions(-)
 create mode 100644 libavutil/file_open.h

diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index 3338cd6b92..e1ae441880 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -27,6 +27,7 @@
 
 #include "libavutil/attributes.h"
 #include "libavutil/colorspace.h"
+#include "libavutil/file_open.h"
 #include "libavutil/opt.h"
 #include "libavutil/bswap.h"
 
diff --git a/libavcodec/libxvid.c b/libavcodec/libxvid.c
index aed8699fe1..384590 100644
--- a/libavcodec/libxvid.c
+++ b/libavcodec/libxvid.c
@@ -30,7 +30,7 @@
 #include 
 
 #include "libavutil/avassert.h"
-#include "libavutil/file.h"
+#include "libavutil/file_open.h"
 #include "libavutil/internal.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/mathematics.h"
diff --git a/libavdevice/bktr.c b/libavdevice/bktr.c
index e96c4a359e..196637852f 100644
--- a/libavdevice/bktr.c
+++ b/libavdevice/bktr.c
@@ -25,6 +25,7 @@
  */
 
 #include "libavformat/internal.h"
+#include "libavutil/file_open.h"
 #include "libavutil/internal.h"
 #include "libavutil/log.h"
 #include "libavutil/opt.h"
diff --git a/libavdevice/fbdev_common.c b/libavdevice/fbdev_common.c
index 91bd8e1a91..47e7edde5c 100644
--- a/libavdevice/fbdev_common.c
+++ b/libavdevice/fbdev_common.c
@@ -26,6 +26,7 @@
 #include 
 #include "fbdev_common.h"
 #include "libavutil/common.h"
+#include "libavutil/file_open.h"
 #include "avdevice.h"
 
 struct rgb_pixfmt_map_entry {
diff --git a/libavdevice/fbdev_dec.c b/libavdevice/fbdev_dec.c
index 368907037b..460a71d13f 100644
--- a/libavdevice/fbdev_dec.c
+++ b/libavdevice/fbdev_dec.c
@@ -34,6 +34,7 @@
 #include 
 #include 
 
+#include "libavutil/file_open.h"
 #include "libavutil/internal.h"
 #include "libavutil/log.h"
 #include "libavutil/opt.h"
diff --git a/libavdevice/fbdev_enc.c b/libavdevice/fbdev_enc.c
index 84ec6733ff..77233880e7 100644
--- a/libavdevice/fbdev_enc.c
+++ b/libavdevice/fbdev_enc.c
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include "libavutil/file_open.h"
 #include "libavutil/pixdesc.h"
 #include "libavutil/log.h"
 #include "libavutil/opt.h"
diff --git a/libavdevice/oss.c b/libavdevice/oss.c
index b042f58875..5c3eb6d4c3 100644
--- a/libavdevice/oss.c
+++ b/libavdevice/oss.c
@@ -30,6 +30,7 @@
 #include 
 #include 
 
+#include "libavutil/file_open.h"
 #include "libavutil/log.h"
 
 #include "avdevice.h"
diff --git a/libavfilter/af_arnndn.c b/libavfilter/af_arnndn.c
index 5e3403ca6a..3ef222bc8e 100644
--- a/libavfilter/af_arnndn.c
+++ b/libavfilter/af_arnndn.c
@@ -31,10 +31,8 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include 
-
 #include "libavutil/avassert.h"
-#include "libavutil/avstring.h"
+#include "libavutil/file_open.h"
 #include "libavutil/float_dsp.h"
 #include "libavutil/mem_internal.h"
 #include "libavutil/opt.h"
diff --git a/libavfilter/af_firequalizer.c b/libavfilter/af_firequalizer.c
index 85bdb59209..e0f35c139e 100644
--- a/libavfilter/af_firequalizer.c
+++ b/libavfilter/af_firequalizer.c
@@ -19,6 +19,7 @@
  */
 
 #include "libavutil/channel_layout.h"
+#include "libavutil/file_open.h"
 #include "libavutil/opt.h"
 #include "libavutil/eval.h"
 #include "libavutil/avassert.h"
diff --git a/libavfilter/opencl.c b/libavfilter/opencl.c
index c8e7e6e1a5..5d1e297af8 100644
--- a/libavfilter/opencl.c
+++ b/libavfilter/opencl.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 
+#include "libavutil/file_open.h"
 #include 

[FFmpeg-devel] [PATCH 16/16] avutil/fifo: Properly deprecate av_tempfile()

2022-08-28 Thread Andreas Rheinhardt
It has been deprecated in b4f59beeb4c2171879d0d7607a4a7d6165f07791,
but the attribute_deprecated was not set and there was no entry
in APIchanges. This commit adds these and schedules it for removal.
Given that the reason behind the deprecation is exactly the same
as in av_fopen_utf8(), reuse its FF_API_AV_FOPEN_UTF8.

Signed-off-by: Andreas Rheinhardt 
---
 doc/APIchanges   | 3 +++
 libavutil/file.c | 2 ++
 libavutil/file.h | 4 
 3 files changed, 9 insertions(+)

diff --git a/doc/APIchanges b/doc/APIchanges
index 1cd13d4ed3..45fd8f251d 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,9 @@ libavutil: 2021-04-27
 
 API changes, most recent first:
 
+2022-08-28 - xx - lavu 57.xx.100 - file.h
+  Deprecate av_tempfile() without replacement.
+
 2022-08-03 - xx - lavu 57.34.100 - pixfmt.h
   Add AV_PIX_FMT_VUYX.
 
diff --git a/libavutil/file.c b/libavutil/file.c
index edee6aaf80..6a2f3aa91c 100644
--- a/libavutil/file.c
+++ b/libavutil/file.c
@@ -155,6 +155,8 @@ void av_file_unmap(uint8_t *bufptr, size_t size)
 #endif
 }
 
+#if FF_API_AV_FOPEN_UTF8
 int av_tempfile(const char *prefix, char **filename, int log_offset, void 
*log_ctx) {
 return avpriv_tempfile(prefix, filename, log_offset, log_ctx);
 }
+#endif
diff --git a/libavutil/file.h b/libavutil/file.h
index 8ec210e783..511c100db4 100644
--- a/libavutil/file.h
+++ b/libavutil/file.h
@@ -22,6 +22,7 @@
 #include 
 #include 
 
+#include "version.h"
 #include "attributes.h"
 
 /**
@@ -55,6 +56,7 @@ int av_file_map(const char *filename, uint8_t **bufptr, 
size_t *size,
  */
 void av_file_unmap(uint8_t *bufptr, size_t size);
 
+#if FF_API_AV_FOPEN_UTF8
 /**
  * Wrapper to work around the lack of mkstemp() on mingw.
  * Also, tries to create file in /tmp first, if possible.
@@ -67,6 +69,8 @@ void av_file_unmap(uint8_t *bufptr, size_t size);
  *   libraries and could interfere with the calling application.
  * @deprecated as fd numbers cannot be passed saftely between libs on some 
platforms
  */
+attribute_deprecated
 int av_tempfile(const char *prefix, char **filename, int log_offset, void 
*log_ctx);
+#endif
 
 #endif /* AVUTIL_FILE_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 0/9] avisynth: add user options

2022-08-28 Thread Stephen Hutchinson
The introduction of reading _SARNum/Den values spurred
the idea of making sure that users can turn the frameprop
value reading ability on and off.

Resizing is a much more common activity in AviSynth scripts
than the kind of broad color work that would potentially
severely impact the usage of the color-related frameprops.
Since the source filter sets the SAR values, but then it
would be quite possible for a user to manipulate the resolution
without updating the prop values for _SARNum and _SARDen, it
would become extremely easy to get it wrong.

So reading _SARNum/_SARDen is *possible*, but requires
user opt-in with the -read_frameprop_sar boolean option.
And that then lead to fleshing out the others into their
own options, and a mass frameprop on/off setting.

Stephen Hutchinson (9):
  avformat/avisynth: read _SARNum/_SARDen from frame properties
  avformat/avisynth: add read_frameprop_sar option
  avformat/avisynth: add read_frameprops option
  avformat/avisynth: add read_frameprop_field_order option
  avformat/avisynth: add read_frameprop_range option
  avformat/avisynth: add read_frameprop_primaries option
  avformat/avisynth: add read_frameprop_transfer option
  avformat/avisynth: add read_frameprop_matrix option
  avformat/avisynth: add read_frameprop_chroma_location option

 libavformat/avisynth.c | 462 +++--
 1 file changed, 259 insertions(+), 203 deletions(-)

-- 
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 1/9] avformat/avisynth: read _SARNum/_SARDen from frame properties

2022-08-28 Thread Stephen Hutchinson
Initialized to 1:1, but if the script sets these properties, it
will be set to those instead (0:0 disables it, apparently).

Signed-off-by: Stephen Hutchinson 
---
 libavformat/avisynth.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
index 3d9fa2be50..d978e6ec40 100644
--- a/libavformat/avisynth.c
+++ b/libavformat/avisynth.c
@@ -251,6 +251,8 @@ static int avisynth_create_stream_video(AVFormatContext *s, 
AVStream *st)
 AVS_VideoFrame *frame;
 int error;
 int planar = 0; // 0: packed, 1: YUV, 2: Y8, 3: Planar RGB, 4: YUVA, 5: 
Planar RGBA
+int sar_num = 1;
+int sar_den = 1;
 
 st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
 st->codecpar->codec_id   = AV_CODEC_ID_RAWVIDEO;
@@ -728,6 +730,12 @@ static int avisynth_create_stream_video(AVFormatContext 
*s, AVStream *st)
 st->codecpar->chroma_location = AVCHROMA_LOC_UNSPECIFIED;
 }
 }
+
+/* Sample aspect ratio */
+sar_num = avs_library.avs_prop_get_int(avs->env, avsmap, "_SARNum", 0, 
&error);
+sar_den = avs_library.avs_prop_get_int(avs->env, avsmap, "_SARDen", 0, 
&error);
+st->sample_aspect_ratio = (AVRational){ sar_num, sar_den };
+
 avs_library.avs_release_video_frame(frame);
 } else {
 st->codecpar->field_order = AV_FIELD_UNKNOWN;
-- 
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/9] avformat/avisynth: add read_frameprop_sar option

2022-08-28 Thread Stephen Hutchinson
Because SAR is much more likely to be negatively affected by
operations made in-script, given that resizing is probably far more
common than the sort of color manipulation involved in most of the
other frame properties, the safest option is to disable reading
it by default, allowing users to opt in.

Signed-off-by: Stephen Hutchinson 
---
 libavformat/avisynth.c | 27 ---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
index d978e6ec40..d503c7ed40 100644
--- a/libavformat/avisynth.c
+++ b/libavformat/avisynth.c
@@ -21,6 +21,7 @@
 
 #include "libavutil/attributes.h"
 #include "libavutil/internal.h"
+#include "libavutil/opt.h"
 
 #include "libavcodec/internal.h"
 
@@ -86,6 +87,7 @@ typedef struct AviSynthLibrary {
 } AviSynthLibrary;
 
 typedef struct AviSynthContext {
+const AVClass *class;
 AVS_ScriptEnvironment *env;
 AVS_Clip *clip;
 const AVS_VideoInfo *vi;
@@ -100,6 +102,9 @@ typedef struct AviSynthContext {
 
 int error;
 
+/* (de)activate reading frame properties */
+int frameprop_sar;
+
 /* Linked list pointers. */
 struct AviSynthContext *next;
 } AviSynthContext;
@@ -732,9 +737,11 @@ static int avisynth_create_stream_video(AVFormatContext 
*s, AVStream *st)
 }
 
 /* Sample aspect ratio */
-sar_num = avs_library.avs_prop_get_int(avs->env, avsmap, "_SARNum", 0, 
&error);
-sar_den = avs_library.avs_prop_get_int(avs->env, avsmap, "_SARDen", 0, 
&error);
-st->sample_aspect_ratio = (AVRational){ sar_num, sar_den };
+if (avs->frameprop_sar) {
+sar_num = avs_library.avs_prop_get_int(avs->env, avsmap, 
"_SARNum", 0, &error);
+sar_den = avs_library.avs_prop_get_int(avs->env, avsmap, 
"_SARDen", 0, &error);
+st->sample_aspect_ratio = (AVRational){ sar_num, sar_den };
+}
 
 avs_library.avs_release_video_frame(frame);
 } else {
@@ -1140,6 +1147,19 @@ static int avisynth_read_seek(AVFormatContext *s, int 
stream_index,
 return 0;
 }
 
+#define OFFSET(x) offsetof(AviSynthContext, x)
+static const AVOption avisynth_options[] = {
+{ "read_frameprop_sar", "Read SAR from script's frame properties 
(AviSynth+ v3.7.1+).", OFFSET(frameprop_sar), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 
1, AV_OPT_FLAG_DECODING_PARAM },
+{ NULL },
+};
+
+static const AVClass avisynth_demuxer_class = {
+.class_name = "AviSynth demuxer",
+.item_name  = av_default_item_name,
+.option = avisynth_options,
+.version= LIBAVUTIL_VERSION_INT,
+};
+
 const AVInputFormat ff_avisynth_demuxer = {
 .name   = "avisynth",
 .long_name  = NULL_IF_CONFIG_SMALL("AviSynth script"),
@@ -1149,4 +1169,5 @@ const AVInputFormat ff_avisynth_demuxer = {
 .read_close = avisynth_read_close,
 .read_seek  = avisynth_read_seek,
 .extensions = "avs",
+.priv_class = &avisynth_demuxer_class,
 };
-- 
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 3/9] avformat/avisynth: add read_frameprops option

2022-08-28 Thread Stephen Hutchinson
Allows turning the reading of frame properties entirely on and off.
Defaults to reading frame properties.

Signed-off-by: Stephen Hutchinson 
---
 libavformat/avisynth.c | 355 +
 1 file changed, 179 insertions(+), 176 deletions(-)

diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
index d503c7ed40..5d726d70a5 100644
--- a/libavformat/avisynth.c
+++ b/libavformat/avisynth.c
@@ -103,6 +103,7 @@ typedef struct AviSynthContext {
 int error;
 
 /* (de)activate reading frame properties */
+int frameprops;
 int frameprop_sar;
 
 /* Linked list pointers. */
@@ -522,227 +523,228 @@ static int avisynth_create_stream_video(AVFormatContext 
*s, AVStream *st)
 frame  = avs_library.avs_get_frame(avs->clip, 0);
 avsmap = avs_library.avs_get_frame_props_ro(avs->env, frame);
 
-/* Field order */
-if(avs_library.avs_prop_get_type(avs->env, avsmap, "_FieldBased") == 
AVS_PROPTYPE_UNSET) {
-st->codecpar->field_order = AV_FIELD_UNKNOWN;
-} else {
-switch (avs_library.avs_prop_get_int(avs->env, avsmap, 
"_FieldBased", 0, &error)) {
-case 0:
-st->codecpar->field_order = AV_FIELD_PROGRESSIVE;
-break;
-case 1:
-st->codecpar->field_order = AV_FIELD_BB;
-break;
-case 2:
-st->codecpar->field_order = AV_FIELD_TT;
-break;
-default:
+if(avs->frameprops) {
+/* Field order */
+if(avs_library.avs_prop_get_type(avs->env, avsmap, "_FieldBased") 
== AVS_PROPTYPE_UNSET) {
 st->codecpar->field_order = AV_FIELD_UNKNOWN;
+} else {
+switch (avs_library.avs_prop_get_int(avs->env, avsmap, 
"_FieldBased", 0, &error)) {
+case 0:
+st->codecpar->field_order = AV_FIELD_PROGRESSIVE;
+break;
+case 1:
+st->codecpar->field_order = AV_FIELD_BB;
+break;
+case 2:
+st->codecpar->field_order = AV_FIELD_TT;
+break;
+default:
+st->codecpar->field_order = AV_FIELD_UNKNOWN;
+}
 }
-}
 
-/* Color Range */
-if(avs_library.avs_prop_get_type(avs->env, avsmap, "_ColorRange") == 
AVS_PROPTYPE_UNSET) {
-st->codecpar->color_range = AVCOL_RANGE_UNSPECIFIED;
-} else {
-switch (avs_library.avs_prop_get_int(avs->env, avsmap, 
"_ColorRange", 0, &error)) {
-case 0:
-st->codecpar->color_range = AVCOL_RANGE_JPEG;
-break;
-case 1:
-st->codecpar->color_range = AVCOL_RANGE_MPEG;
-break;
-default:
+/* Color Range */
+if(avs_library.avs_prop_get_type(avs->env, avsmap, "_ColorRange") 
== AVS_PROPTYPE_UNSET) {
 st->codecpar->color_range = AVCOL_RANGE_UNSPECIFIED;
+} else {
+switch (avs_library.avs_prop_get_int(avs->env, avsmap, 
"_ColorRange", 0, &error)) {
+case 0:
+st->codecpar->color_range = AVCOL_RANGE_JPEG;
+break;
+case 1:
+st->codecpar->color_range = AVCOL_RANGE_MPEG;
+break;
+default:
+st->codecpar->color_range = AVCOL_RANGE_UNSPECIFIED;
+}
 }
-}
 
-/* Color Primaries */
-switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_Primaries", 
0, &error)) {
-case 1:
-st->codecpar->color_primaries = AVCOL_PRI_BT709;
-break;
-case 2:
-st->codecpar->color_primaries = AVCOL_PRI_UNSPECIFIED;
-break;
-case 4:
-st->codecpar->color_primaries = AVCOL_PRI_BT470M;
-break;
-case 5:
-st->codecpar->color_primaries = AVCOL_PRI_BT470BG;
-break;
-case 6:
-st->codecpar->color_primaries = AVCOL_PRI_SMPTE170M;
-break;
-case 7:
-st->codecpar->color_primaries = AVCOL_PRI_SMPTE240M;
-break;
-case 8:
-st->codecpar->color_primaries = AVCOL_PRI_FILM;
-break;
-case 9:
-st->codecpar->color_primaries = AVCOL_PRI_BT2020;
-break;
-case 10:
-st->codecpar->color_primaries = AVCOL_PRI_SMPTE428;
-break;
-case 11:
-st->codecpar->color_primaries = AVCOL_PRI_SMPTE431;
-break;
-case 12:
-st->codecpar->color_primaries = AVCOL_PRI_SMPTE432;
-break;
-case 22:
-st->codecpar->color_primaries = AVCOL_PRI_EBU3213;
-break;
-default:
-st->codecp

[FFmpeg-devel] [PATCH 4/9] avformat/avisynth: add read_frameprop_field_order option

2022-08-28 Thread Stephen Hutchinson
Signed-off-by: Stephen Hutchinson 
---
 libavformat/avisynth.c | 32 ++--
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
index 5d726d70a5..c76b50421c 100644
--- a/libavformat/avisynth.c
+++ b/libavformat/avisynth.c
@@ -104,6 +104,7 @@ typedef struct AviSynthContext {
 
 /* (de)activate reading frame properties */
 int frameprops;
+int frameprop_field_order;
 int frameprop_sar;
 
 /* Linked list pointers. */
@@ -525,21 +526,23 @@ static int avisynth_create_stream_video(AVFormatContext 
*s, AVStream *st)
 
 if(avs->frameprops) {
 /* Field order */
-if(avs_library.avs_prop_get_type(avs->env, avsmap, "_FieldBased") 
== AVS_PROPTYPE_UNSET) {
-st->codecpar->field_order = AV_FIELD_UNKNOWN;
-} else {
-switch (avs_library.avs_prop_get_int(avs->env, avsmap, 
"_FieldBased", 0, &error)) {
-case 0:
-st->codecpar->field_order = AV_FIELD_PROGRESSIVE;
-break;
-case 1:
-st->codecpar->field_order = AV_FIELD_BB;
-break;
-case 2:
-st->codecpar->field_order = AV_FIELD_TT;
-break;
-default:
+if(avs->frameprop_field_order) {
+if(avs_library.avs_prop_get_type(avs->env, avsmap, 
"_FieldBased") == AVS_PROPTYPE_UNSET) {
 st->codecpar->field_order = AV_FIELD_UNKNOWN;
+} else {
+switch (avs_library.avs_prop_get_int(avs->env, avsmap, 
"_FieldBased", 0, &error)) {
+case 0:
+st->codecpar->field_order = AV_FIELD_PROGRESSIVE;
+break;
+case 1:
+st->codecpar->field_order = AV_FIELD_BB;
+break;
+case 2:
+st->codecpar->field_order = AV_FIELD_TT;
+break;
+default:
+st->codecpar->field_order = AV_FIELD_UNKNOWN;
+}
 }
 }
 
@@ -1152,6 +1155,7 @@ static int avisynth_read_seek(AVFormatContext *s, int 
stream_index,
 #define OFFSET(x) offsetof(AviSynthContext, x)
 static const AVOption avisynth_options[] = {
 { "read_frameprops", "Read frame properties from script (AviSynth+ 
v3.7.1+).", OFFSET(frameprops), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, 
AV_OPT_FLAG_DECODING_PARAM },
+{ "read_frameprop_field_order", "Read field order from script's frame 
properties (AviSynth+ v3.7.1+).", OFFSET(frameprop_field_order), 
AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
 { "read_frameprop_sar", "Read SAR from script's frame properties 
(AviSynth+ v3.7.1+).", OFFSET(frameprop_sar), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 
1, AV_OPT_FLAG_DECODING_PARAM },
 { NULL },
 };
-- 
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 5/9] avformat/avisynth: add read_frameprop_range option

2022-08-28 Thread Stephen Hutchinson
Signed-off-by: Stephen Hutchinson 
---
 libavformat/avisynth.c | 26 +++---
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
index c76b50421c..65d8448e89 100644
--- a/libavformat/avisynth.c
+++ b/libavformat/avisynth.c
@@ -105,6 +105,7 @@ typedef struct AviSynthContext {
 /* (de)activate reading frame properties */
 int frameprops;
 int frameprop_field_order;
+int frameprop_range;
 int frameprop_sar;
 
 /* Linked list pointers. */
@@ -547,18 +548,20 @@ static int avisynth_create_stream_video(AVFormatContext 
*s, AVStream *st)
 }
 
 /* Color Range */
-if(avs_library.avs_prop_get_type(avs->env, avsmap, "_ColorRange") 
== AVS_PROPTYPE_UNSET) {
-st->codecpar->color_range = AVCOL_RANGE_UNSPECIFIED;
-} else {
-switch (avs_library.avs_prop_get_int(avs->env, avsmap, 
"_ColorRange", 0, &error)) {
-case 0:
-st->codecpar->color_range = AVCOL_RANGE_JPEG;
-break;
-case 1:
-st->codecpar->color_range = AVCOL_RANGE_MPEG;
-break;
-default:
+if(avs->frameprop_range) {
+if(avs_library.avs_prop_get_type(avs->env, avsmap, 
"_ColorRange") == AVS_PROPTYPE_UNSET) {
 st->codecpar->color_range = AVCOL_RANGE_UNSPECIFIED;
+} else {
+switch (avs_library.avs_prop_get_int(avs->env, avsmap, 
"_ColorRange", 0, &error)) {
+case 0:
+st->codecpar->color_range = AVCOL_RANGE_JPEG;
+break;
+case 1:
+st->codecpar->color_range = AVCOL_RANGE_MPEG;
+break;
+default:
+st->codecpar->color_range = AVCOL_RANGE_UNSPECIFIED;
+}
 }
 }
 
@@ -1156,6 +1159,7 @@ static int avisynth_read_seek(AVFormatContext *s, int 
stream_index,
 static const AVOption avisynth_options[] = {
 { "read_frameprops", "Read frame properties from script (AviSynth+ 
v3.7.1+).", OFFSET(frameprops), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, 
AV_OPT_FLAG_DECODING_PARAM },
 { "read_frameprop_field_order", "Read field order from script's frame 
properties (AviSynth+ v3.7.1+).", OFFSET(frameprop_field_order), 
AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
+{ "read_frameprop_range", "Read color range from script's frame properties 
(AviSynth+ v3.7.1+).", OFFSET(frameprop_range), AV_OPT_TYPE_BOOL, {.i64 = 1}, 
0, 1, AV_OPT_FLAG_DECODING_PARAM },
 { "read_frameprop_sar", "Read SAR from script's frame properties 
(AviSynth+ v3.7.1+).", OFFSET(frameprop_sar), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 
1, AV_OPT_FLAG_DECODING_PARAM },
 { NULL },
 };
-- 
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/9] avformat/avisynth: add read_frameprop_primaries option

2022-08-28 Thread Stephen Hutchinson
Signed-off-by: Stephen Hutchinson 
---
 libavformat/avisynth.c | 82 ++
 1 file changed, 43 insertions(+), 39 deletions(-)

diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
index 65d8448e89..945ce0e245 100644
--- a/libavformat/avisynth.c
+++ b/libavformat/avisynth.c
@@ -106,6 +106,7 @@ typedef struct AviSynthContext {
 int frameprops;
 int frameprop_field_order;
 int frameprop_range;
+int frameprop_primaries;
 int frameprop_sar;
 
 /* Linked list pointers. */
@@ -566,45 +567,47 @@ static int avisynth_create_stream_video(AVFormatContext 
*s, AVStream *st)
 }
 
 /* Color Primaries */
-switch (avs_library.avs_prop_get_int(avs->env, avsmap, 
"_Primaries", 0, &error)) {
-case 1:
-st->codecpar->color_primaries = AVCOL_PRI_BT709;
-break;
-case 2:
-st->codecpar->color_primaries = AVCOL_PRI_UNSPECIFIED;
-break;
-case 4:
-st->codecpar->color_primaries = AVCOL_PRI_BT470M;
-break;
-case 5:
-st->codecpar->color_primaries = AVCOL_PRI_BT470BG;
-break;
-case 6:
-st->codecpar->color_primaries = AVCOL_PRI_SMPTE170M;
-break;
-case 7:
-st->codecpar->color_primaries = AVCOL_PRI_SMPTE240M;
-break;
-case 8:
-st->codecpar->color_primaries = AVCOL_PRI_FILM;
-break;
-case 9:
-st->codecpar->color_primaries = AVCOL_PRI_BT2020;
-break;
-case 10:
-st->codecpar->color_primaries = AVCOL_PRI_SMPTE428;
-break;
-case 11:
-st->codecpar->color_primaries = AVCOL_PRI_SMPTE431;
-break;
-case 12:
-st->codecpar->color_primaries = AVCOL_PRI_SMPTE432;
-break;
-case 22:
-st->codecpar->color_primaries = AVCOL_PRI_EBU3213;
-break;
-default:
-st->codecpar->color_primaries = AVCOL_PRI_UNSPECIFIED;
+if(avs->frameprop_primaries) {
+switch (avs_library.avs_prop_get_int(avs->env, avsmap, 
"_Primaries", 0, &error)) {
+case 1:
+st->codecpar->color_primaries = AVCOL_PRI_BT709;
+break;
+case 2:
+st->codecpar->color_primaries = AVCOL_PRI_UNSPECIFIED;
+break;
+case 4:
+st->codecpar->color_primaries = AVCOL_PRI_BT470M;
+break;
+case 5:
+st->codecpar->color_primaries = AVCOL_PRI_BT470BG;
+break;
+case 6:
+st->codecpar->color_primaries = AVCOL_PRI_SMPTE170M;
+break;
+case 7:
+st->codecpar->color_primaries = AVCOL_PRI_SMPTE240M;
+break;
+case 8:
+st->codecpar->color_primaries = AVCOL_PRI_FILM;
+break;
+case 9:
+st->codecpar->color_primaries = AVCOL_PRI_BT2020;
+break;
+case 10:
+st->codecpar->color_primaries = AVCOL_PRI_SMPTE428;
+break;
+case 11:
+st->codecpar->color_primaries = AVCOL_PRI_SMPTE431;
+break;
+case 12:
+st->codecpar->color_primaries = AVCOL_PRI_SMPTE432;
+break;
+case 22:
+st->codecpar->color_primaries = AVCOL_PRI_EBU3213;
+break;
+default:
+st->codecpar->color_primaries = AVCOL_PRI_UNSPECIFIED;
+}
 }
 
 /* Color Transfer Characteristics */
@@ -1160,6 +1163,7 @@ static const AVOption avisynth_options[] = {
 { "read_frameprops", "Read frame properties from script (AviSynth+ 
v3.7.1+).", OFFSET(frameprops), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, 
AV_OPT_FLAG_DECODING_PARAM },
 { "read_frameprop_field_order", "Read field order from script's frame 
properties (AviSynth+ v3.7.1+).", OFFSET(frameprop_field_order), 
AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
 { "read_frameprop_range", "Read color range from script's frame properties 
(AviSynth+ v3.7.1+).", OFFSET(frameprop_range), AV_OPT_TYPE_BOOL, {.i64 = 1}, 
0, 1, AV_OPT_FLAG_DECODING_PARAM },
+{ "read_frameprop_primaries", "Read color primaries from script's frame 
properties (AviSynth+ v3.7.1+).", OFFSET(frameprop_primaries), 
AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
 { "read_frameprop_sar", "Read SAR from script's frame prope

[FFmpeg-devel] [PATCH 7/9] avformat/avisynth: add read_frameprop_transfer option

2022-08-28 Thread Stephen Hutchinson
Signed-off-by: Stephen Hutchinson 
---
 libavformat/avisynth.c | 112 +
 1 file changed, 58 insertions(+), 54 deletions(-)

diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
index 945ce0e245..ff4435758e 100644
--- a/libavformat/avisynth.c
+++ b/libavformat/avisynth.c
@@ -107,6 +107,7 @@ typedef struct AviSynthContext {
 int frameprop_field_order;
 int frameprop_range;
 int frameprop_primaries;
+int frameprop_transfer;
 int frameprop_sar;
 
 /* Linked list pointers. */
@@ -611,60 +612,62 @@ static int avisynth_create_stream_video(AVFormatContext 
*s, AVStream *st)
 }
 
 /* Color Transfer Characteristics */
-switch (avs_library.avs_prop_get_int(avs->env, avsmap, 
"_Transfer", 0, &error)) {
-case 1:
-st->codecpar->color_trc = AVCOL_TRC_BT709;
-break;
-case 2:
-st->codecpar->color_trc = AVCOL_TRC_UNSPECIFIED;
-break;
-case 4:
-st->codecpar->color_trc = AVCOL_TRC_GAMMA22;
-break;
-case 5:
-st->codecpar->color_trc = AVCOL_TRC_GAMMA28;
-break;
-case 6:
-st->codecpar->color_trc = AVCOL_TRC_SMPTE170M;
-break;
-case 7:
-st->codecpar->color_trc = AVCOL_TRC_SMPTE240M;
-break;
-case 8:
-st->codecpar->color_trc = AVCOL_TRC_LINEAR;
-break;
-case 9:
-st->codecpar->color_trc = AVCOL_TRC_LOG;
-break;
-case 10:
-st->codecpar->color_trc = AVCOL_TRC_LOG_SQRT;
-break;
-case 11:
-st->codecpar->color_trc = AVCOL_TRC_IEC61966_2_4;
-break;
-case 12:
-st->codecpar->color_trc = AVCOL_TRC_BT1361_ECG;
-break;
-case 13:
-st->codecpar->color_trc = AVCOL_TRC_IEC61966_2_1;
-break;
-case 14:
-st->codecpar->color_trc = AVCOL_TRC_BT2020_10;
-break;
-case 15:
-st->codecpar->color_trc = AVCOL_TRC_BT2020_12;
-break;
-case 16:
-st->codecpar->color_trc = AVCOL_TRC_SMPTE2084;
-break;
-case 17:
-st->codecpar->color_trc = AVCOL_TRC_SMPTE428;
-break;
-case 18:
-st->codecpar->color_trc = AVCOL_TRC_ARIB_STD_B67;
-break;
-default:
-st->codecpar->color_trc = AVCOL_TRC_UNSPECIFIED;
+if(avs->frameprop_transfer) {
+switch (avs_library.avs_prop_get_int(avs->env, avsmap, 
"_Transfer", 0, &error)) {
+case 1:
+st->codecpar->color_trc = AVCOL_TRC_BT709;
+break;
+case 2:
+st->codecpar->color_trc = AVCOL_TRC_UNSPECIFIED;
+break;
+case 4:
+st->codecpar->color_trc = AVCOL_TRC_GAMMA22;
+break;
+case 5:
+st->codecpar->color_trc = AVCOL_TRC_GAMMA28;
+break;
+case 6:
+st->codecpar->color_trc = AVCOL_TRC_SMPTE170M;
+break;
+case 7:
+st->codecpar->color_trc = AVCOL_TRC_SMPTE240M;
+break;
+case 8:
+st->codecpar->color_trc = AVCOL_TRC_LINEAR;
+break;
+case 9:
+st->codecpar->color_trc = AVCOL_TRC_LOG;
+break;
+case 10:
+st->codecpar->color_trc = AVCOL_TRC_LOG_SQRT;
+break;
+case 11:
+st->codecpar->color_trc = AVCOL_TRC_IEC61966_2_4;
+break;
+case 12:
+st->codecpar->color_trc = AVCOL_TRC_BT1361_ECG;
+break;
+case 13:
+st->codecpar->color_trc = AVCOL_TRC_IEC61966_2_1;
+break;
+case 14:
+st->codecpar->color_trc = AVCOL_TRC_BT2020_10;
+break;
+case 15:
+st->codecpar->color_trc = AVCOL_TRC_BT2020_12;
+break;
+case 16:
+st->codecpar->color_trc = AVCOL_TRC_SMPTE2084;
+break;
+case 17:
+st->codecpar->color_trc = AVCOL_TRC_SMPTE428;
+break;
+case 18:
+st->codecpar->color_trc = AVCOL_TRC_ARIB_STD_B67;
+break;
+default:
+

[FFmpeg-devel] [PATCH 8/9] avformat/avisynth: add read_frameprop_matrix option

2022-08-28 Thread Stephen Hutchinson
Signed-off-by: Stephen Hutchinson 
---
 libavformat/avisynth.c | 98 ++
 1 file changed, 51 insertions(+), 47 deletions(-)

diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
index ff4435758e..99173a8d51 100644
--- a/libavformat/avisynth.c
+++ b/libavformat/avisynth.c
@@ -108,6 +108,7 @@ typedef struct AviSynthContext {
 int frameprop_range;
 int frameprop_primaries;
 int frameprop_transfer;
+int frameprop_matrix;
 int frameprop_sar;
 
 /* Linked list pointers. */
@@ -671,54 +672,56 @@ static int avisynth_create_stream_video(AVFormatContext 
*s, AVStream *st)
 }
 
 /* Matrix coefficients */
-if(avs_library.avs_prop_get_type(avs->env, avsmap, "_Matrix") == 
AVS_PROPTYPE_UNSET) {
-st->codecpar->color_space = AVCOL_SPC_UNSPECIFIED;
-} else {
-switch (avs_library.avs_prop_get_int(avs->env, avsmap, 
"_Matrix", 0, &error)) {
-case 0:
-st->codecpar->color_space = AVCOL_SPC_RGB;
-break;
-case 1:
-st->codecpar->color_space = AVCOL_SPC_BT709;
-break;
-case 2:
-st->codecpar->color_space = AVCOL_SPC_UNSPECIFIED;
-break;
-case 4:
-st->codecpar->color_space = AVCOL_SPC_FCC;
-break;
-case 5:
-st->codecpar->color_space = AVCOL_SPC_BT470BG;
-break;
-case 6:
-st->codecpar->color_space = AVCOL_SPC_SMPTE170M;
-break;
-case 7:
-st->codecpar->color_space = AVCOL_SPC_SMPTE240M;
-break;
-case 8:
-st->codecpar->color_space = AVCOL_SPC_YCGCO;
-break;
-case 9:
-st->codecpar->color_space = AVCOL_SPC_BT2020_NCL;
-break;
-case 10:
-st->codecpar->color_space = AVCOL_SPC_BT2020_CL;
-break;
-case 11:
-st->codecpar->color_space = AVCOL_SPC_SMPTE2085;
-break;
-case 12:
-st->codecpar->color_space = AVCOL_SPC_CHROMA_DERIVED_NCL;
-break;
-case 13:
-st->codecpar->color_space = AVCOL_SPC_CHROMA_DERIVED_CL;
-break;
-case 14:
-st->codecpar->color_space = AVCOL_SPC_ICTCP;
-break;
-default:
+if(avs->frameprop_matrix) {
+if(avs_library.avs_prop_get_type(avs->env, avsmap, "_Matrix") 
== AVS_PROPTYPE_UNSET) {
 st->codecpar->color_space = AVCOL_SPC_UNSPECIFIED;
+} else {
+switch (avs_library.avs_prop_get_int(avs->env, avsmap, 
"_Matrix", 0, &error)) {
+case 0:
+st->codecpar->color_space = AVCOL_SPC_RGB;
+break;
+case 1:
+st->codecpar->color_space = AVCOL_SPC_BT709;
+break;
+case 2:
+st->codecpar->color_space = AVCOL_SPC_UNSPECIFIED;
+break;
+case 4:
+st->codecpar->color_space = AVCOL_SPC_FCC;
+break;
+case 5:
+st->codecpar->color_space = AVCOL_SPC_BT470BG;
+break;
+case 6:
+st->codecpar->color_space = AVCOL_SPC_SMPTE170M;
+break;
+case 7:
+st->codecpar->color_space = AVCOL_SPC_SMPTE240M;
+break;
+case 8:
+st->codecpar->color_space = AVCOL_SPC_YCGCO;
+break;
+case 9:
+st->codecpar->color_space = AVCOL_SPC_BT2020_NCL;
+break;
+case 10:
+st->codecpar->color_space = AVCOL_SPC_BT2020_CL;
+break;
+case 11:
+st->codecpar->color_space = AVCOL_SPC_SMPTE2085;
+break;
+case 12:
+st->codecpar->color_space = 
AVCOL_SPC_CHROMA_DERIVED_NCL;
+break;
+case 13:
+st->codecpar->color_space = 
AVCOL_SPC_CHROMA_DERIVED_CL;
+break;
+case 14:
+st->codecpar->color_space = AVCOL_SPC_ICTCP;
+break;
+default:
+

[FFmpeg-devel] [PATCH 9/9] avformat/avisynth: add read_frameprop_chroma_location option

2022-08-28 Thread Stephen Hutchinson
Signed-off-by: Stephen Hutchinson 
---
 libavformat/avisynth.c | 50 +++---
 1 file changed, 27 insertions(+), 23 deletions(-)

diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
index 99173a8d51..4e7395c22b 100644
--- a/libavformat/avisynth.c
+++ b/libavformat/avisynth.c
@@ -109,6 +109,7 @@ typedef struct AviSynthContext {
 int frameprop_primaries;
 int frameprop_transfer;
 int frameprop_matrix;
+int frameprop_chroma_location;
 int frameprop_sar;
 
 /* Linked list pointers. */
@@ -726,30 +727,32 @@ static int avisynth_create_stream_video(AVFormatContext 
*s, AVStream *st)
 }
 
 /* Chroma Location */
-if(avs_library.avs_prop_get_type(avs->env, avsmap, 
"_ChromaLocation") == AVS_PROPTYPE_UNSET) {
-st->codecpar->chroma_location = AVCHROMA_LOC_UNSPECIFIED;
-} else {
-switch (avs_library.avs_prop_get_int(avs->env, avsmap, 
"_ChromaLocation", 0, &error)) {
-case 0:
-st->codecpar->chroma_location = AVCHROMA_LOC_LEFT;
-break;
-case 1:
-st->codecpar->chroma_location = AVCHROMA_LOC_CENTER;
-break;
-case 2:
-st->codecpar->chroma_location = AVCHROMA_LOC_TOPLEFT;
-break;
-case 3:
-st->codecpar->chroma_location = AVCHROMA_LOC_TOP;
-break;
-case 4:
-st->codecpar->chroma_location = AVCHROMA_LOC_BOTTOMLEFT;
-break;
-case 5:
-st->codecpar->chroma_location = AVCHROMA_LOC_BOTTOM;
-break;
-default:
+if(avs->frameprop_chroma_location) {
+if(avs_library.avs_prop_get_type(avs->env, avsmap, 
"_ChromaLocation") == AVS_PROPTYPE_UNSET) {
 st->codecpar->chroma_location = AVCHROMA_LOC_UNSPECIFIED;
+} else {
+switch (avs_library.avs_prop_get_int(avs->env, avsmap, 
"_ChromaLocation", 0, &error)) {
+case 0:
+st->codecpar->chroma_location = AVCHROMA_LOC_LEFT;
+break;
+case 1:
+st->codecpar->chroma_location = AVCHROMA_LOC_CENTER;
+break;
+case 2:
+st->codecpar->chroma_location = AVCHROMA_LOC_TOPLEFT;
+break;
+case 3:
+st->codecpar->chroma_location = AVCHROMA_LOC_TOP;
+break;
+case 4:
+st->codecpar->chroma_location = 
AVCHROMA_LOC_BOTTOMLEFT;
+break;
+case 5:
+st->codecpar->chroma_location = AVCHROMA_LOC_BOTTOM;
+break;
+default:
+st->codecpar->chroma_location = 
AVCHROMA_LOC_UNSPECIFIED;
+}
 }
 }
 
@@ -1172,6 +1175,7 @@ static const AVOption avisynth_options[] = {
 { "read_frameprop_primaries", "Read color primaries from script's frame 
properties (AviSynth+ v3.7.1+).", OFFSET(frameprop_primaries), 
AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
 { "read_frameprop_transfer", "Read color transfer characteristics from 
script's frame properties (AviSynth+ v3.7.1+).", OFFSET(frameprop_transfer), 
AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
 { "read_frameprop_matrix", "Read matrix coefficients from script's frame 
properties (AviSynth+ v3.7.1+).", OFFSET(frameprop_matrix), AV_OPT_TYPE_BOOL, 
{.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
+{ "read_frameprop_chroma_location", "Read chroma location from script's 
frame properties (AviSynth+ v3.7.1+).", OFFSET(frameprop_chroma_location), 
AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
 { "read_frameprop_sar", "Read SAR from script's frame properties 
(AviSynth+ v3.7.1+).", OFFSET(frameprop_sar), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 
1, AV_OPT_FLAG_DECODING_PARAM },
 { NULL },
 };
-- 
2.34.1

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

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


Re: [FFmpeg-devel] Converting build to CMake

2022-08-28 Thread Gerion Entrup
Am Montag, 29. August 2022, 01:31:12 CEST schrieb Gonzalo Garramuño:
> 
> On 28/8/22 20:17, Jaime Rios wrote:
> > Sorry if this has been asked before in the past.
> >
> > I am wondering if there has been any conversation around changing the
> > current build setup of ffmpeg to CMake.
> >
> > The reason I ask is that I am not a fan of having to install MinGW just to
> > build on Windows, and my experience so far with CMake has been a pleasant
> > one, when having to build on multiple platforms (Windows/Linux/macOS).
> >
> > If there has been conversation about moving to CMake, where can I find the
> > thread?
> 
> I would love that to happen myself too.  The main issue is all the 
> dependencies that ffmpeg has to take care of. You need to have 
> FindLib*.cmake and/or BuldLib*cmake, plus you need to take care of which 
> libraries are open source, BSD, GPL, etc. and whether you need to locate 
> them with pkgconfig.
> 
> It is overall a lot of work, so something would need to get paid to do 
> so fulltime.
> 
> I have to wonder, as I only have Windows 8.1 so far, doesn't Windows 10 
> WSL2 solve the compilation issues by having the lib be compiled on an 
> Ubuntu distro?

There is a (maintained) fork of FFMpeg with Meson (similar to CMake):
https://gitlab.freedesktop.org/gstreamer/meson-ports/ffmpeg

However, this has nothing to do with the original project (AFAIK).

Best,
Gerion



signature.asc
Description: This is a digitally signed message part.
___
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/9] avformat/avisynth: add read_frameprops option

2022-08-28 Thread Andreas Rheinhardt
Stephen Hutchinson:
> Allows turning the reading of frame properties entirely on and off.
> Defaults to reading frame properties.
> 
> Signed-off-by: Stephen Hutchinson 
> ---
>  libavformat/avisynth.c | 355 +
>  1 file changed, 179 insertions(+), 176 deletions(-)
> 
> diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
> index d503c7ed40..5d726d70a5 100644
> --- a/libavformat/avisynth.c
> +++ b/libavformat/avisynth.c
> @@ -103,6 +103,7 @@ typedef struct AviSynthContext {
>  int error;
>  
>  /* (de)activate reading frame properties */
> +int frameprops;
>  int frameprop_sar;
>  
>  /* Linked list pointers. */
> @@ -522,227 +523,228 @@ static int 
> avisynth_create_stream_video(AVFormatContext *s, AVStream *st)
>  frame  = avs_library.avs_get_frame(avs->clip, 0);
>  avsmap = avs_library.avs_get_frame_props_ro(avs->env, frame);
>  
> -/* Field order */
> -if(avs_library.avs_prop_get_type(avs->env, avsmap, "_FieldBased") == 
> AVS_PROPTYPE_UNSET) {
> -st->codecpar->field_order = AV_FIELD_UNKNOWN;
> -} else {
> -switch (avs_library.avs_prop_get_int(avs->env, avsmap, 
> "_FieldBased", 0, &error)) {
> -case 0:
> -st->codecpar->field_order = AV_FIELD_PROGRESSIVE;
> -break;
> -case 1:
> -st->codecpar->field_order = AV_FIELD_BB;
> -break;
> -case 2:
> -st->codecpar->field_order = AV_FIELD_TT;
> -break;
> -default:
> +if(avs->frameprops) {

This will make frameprops a global on-off which overrides everything
else even if some of the "else" stuff has been enabled explicitly. Worse
yet, if you want to disable everything except exactly one field, you
have to leave frameprops enabled and disable everything else explicitly.

Why not use a bitfield (with AV_OPT_TYPE_FLAGS and AV_OPT_TYPE_CONST)?
These properties certainly seem like a bitfield and the above would be
easily achievable with it.

> +/* Field order */
> +if(avs_library.avs_prop_get_type(avs->env, avsmap, 
> "_FieldBased") == AVS_PROPTYPE_UNSET) {
>  st->codecpar->field_order = AV_FIELD_UNKNOWN;
> +} else {
> +switch (avs_library.avs_prop_get_int(avs->env, avsmap, 
> "_FieldBased", 0, &error)) {
> +case 0:
> +st->codecpar->field_order = AV_FIELD_PROGRESSIVE;
> +break;
> +case 1:
> +st->codecpar->field_order = AV_FIELD_BB;
> +break;
> +case 2:
> +st->codecpar->field_order = AV_FIELD_TT;
> +break;
> +default:
> +st->codecpar->field_order = AV_FIELD_UNKNOWN;
> +}
>  }
> -}
>  
> -/* Color Range */
> -if(avs_library.avs_prop_get_type(avs->env, avsmap, "_ColorRange") == 
> AVS_PROPTYPE_UNSET) {
> -st->codecpar->color_range = AVCOL_RANGE_UNSPECIFIED;
> -} else {
> -switch (avs_library.avs_prop_get_int(avs->env, avsmap, 
> "_ColorRange", 0, &error)) {
> -case 0:
> -st->codecpar->color_range = AVCOL_RANGE_JPEG;
> -break;
> -case 1:
> -st->codecpar->color_range = AVCOL_RANGE_MPEG;
> -break;
> -default:
> +/* Color Range */
> +if(avs_library.avs_prop_get_type(avs->env, avsmap, 
> "_ColorRange") == AVS_PROPTYPE_UNSET) {
>  st->codecpar->color_range = AVCOL_RANGE_UNSPECIFIED;
> +} else {
> +switch (avs_library.avs_prop_get_int(avs->env, avsmap, 
> "_ColorRange", 0, &error)) {
> +case 0:
> +st->codecpar->color_range = AVCOL_RANGE_JPEG;
> +break;
> +case 1:
> +st->codecpar->color_range = AVCOL_RANGE_MPEG;
> +break;
> +default:
> +st->codecpar->color_range = AVCOL_RANGE_UNSPECIFIED;
> +}
>  }
> -}
>  
> -/* Color Primaries */
> -switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_Primaries", 
> 0, &error)) {
> -case 1:
> -st->codecpar->color_primaries = AVCOL_PRI_BT709;
> -break;
> -case 2:
> -st->codecpar->color_primaries = AVCOL_PRI_UNSPECIFIED;
> -break;
> -case 4:
> -st->codecpar->color_primaries = AVCOL_PRI_BT470M;
> -break;
> -case 5:
> -st->codecpar->color_primaries = AVCOL_PRI_BT470BG;
> -break;
> -case 6:
> -st->codecpar->color_primaries = AVCOL_PRI_SMPTE170M;
> -break;
> -case 7:
> -st->codecpa

Re: [FFmpeg-devel] [PATCH 1/2] lavc/qsvenc: ignore video signal info buffer for VP9

2022-08-28 Thread Xiang, Haihao
On Tue, 2022-08-23 at 14:19 +0800, Xiang, Haihao wrote:
> From: Haihao Xiang 
> 
> The SDK doesn't support this type of buffer for vp9 encoding
> 
> Signed-off-by: Haihao Xiang 
> ---
>  libavcodec/qsvenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> index 202a645ea2..f1838ce597 100644
> --- a/libavcodec/qsvenc.c
> +++ b/libavcodec/qsvenc.c
> @@ -970,7 +970,7 @@ static int init_video_param(AVCodecContext *avctx,
> QSVEncContext *q)
>  q->extvsi.MatrixCoefficients = avctx->colorspace;
>  }
>  
> -if (q->extvsi.VideoFullRange || q->extvsi.ColourDescriptionPresent) {
> +if ((avctx->codec_id != AV_CODEC_ID_VP9) && (q->extvsi.VideoFullRange ||
> q->extvsi.ColourDescriptionPresent)) {
>  q->extvsi.Header.BufferId = MFX_EXTBUFF_VIDEO_SIGNAL_INFO;
>  q->extvsi.Header.BufferSz = sizeof(q->extvsi);
>  q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer *)&q-
> >extvsi;

patchset applied,

- Haihao

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

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


Re: [FFmpeg-devel] Converting build to CMake

2022-08-28 Thread Martijn van Beurden
Op ma 29 aug. 2022 om 01:17 schreef Jaime Rios :

> The reason I ask is that I am not a fan of having to install MinGW just to
> build on Windows
>

There's no need to install MinGW, just MSYS will do:
https://trac.ffmpeg.org/wiki/CompilationGuide/MSVC
___
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".