Re: [FFmpeg-devel] [PATCH 059/281] flic: convert to new channel layout API

2022-01-26 Thread Anton Khirnov
Quoting James Almer (2022-01-13 02:50:21)
> From: Vittorio Giovara 
> 
> Signed-off-by: Vittorio Giovara 
> Signed-off-by: James Almer 
> ---
>  libavformat/flic.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/flic.c b/libavformat/flic.c
> index 44ed696421..496402aa94 100644
> --- a/libavformat/flic.c
> +++ b/libavformat/flic.c
> @@ -157,10 +157,10 @@ static int flic_read_header(AVFormatContext *s)
>  ast->codecpar->codec_id = AV_CODEC_ID_PCM_U8;
>  ast->codecpar->codec_tag = 0;
>  ast->codecpar->sample_rate = FLIC_TFTD_SAMPLE_RATE;
> -ast->codecpar->channels = 1;
> +ast->codecpar->format   = AV_SAMPLE_FMT_U8;

This is unrelated.

Setting the format was removed in ffmpeg (but not in libav) in
7b007a7c1fad57e9ed4b685c1d3b4222f02d9720, with the comment
"It is supposed to be set from lavc only."
At the time it was still done on the AVStream-embedded codec context, so
it might have been true, but today there is no issue with setting the
AVCodecParameters format from the demuxer, several other demuxers do so.

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

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


Re: [FFmpeg-devel] [PATCH v2 1/3] lavc/qsv: allow to add more parameter buffers to QSV frame

2022-01-26 Thread Xiang, Haihao
On Mon, 2022-01-24 at 16:24 +0800, Xiang, Haihao wrote:
> From: Haihao Xiang 
> 
> Signed-off-by: Haihao Xiang 
> ---
> v2: rebased the patchset against the latest FFmpeg and added code to
> make sure the corresponding extra parameter buffer is added for AV1
> only.
> 
>  libavcodec/qsv.c  | 27 +++
>  libavcodec/qsv_internal.h |  8 +++-
>  libavcodec/qsvdec.c   |  8 +---
>  3 files changed, 39 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
> index 9d08485c92..1a432dbd82 100644
> --- a/libavcodec/qsv.c
> +++ b/libavcodec/qsv.c
> @@ -828,3 +828,30 @@ int ff_qsv_close_internal_session(QSVSession *qs)
>  #endif
>  return 0;
>  }
> +
> +void ff_qsv_frame_add_ext_param (AVCodecContext *avctx, QSVFrame *frame,
> + mfxExtBuffer * param)
> +{
> +int i;
> +
> +for (i = 0; i < frame->num_ext_params; i++) {
> +mfxExtBuffer *ext_buffer = frame->ext_param[i];
> +
> +if (ext_buffer->BufferId == param->BufferId) {
> +av_log(avctx, AV_LOG_WARNING, "A buffer with the same type has
> been "
> +   "added\n");
> +return;
> +}
> +}
> +
> +if (frame->num_ext_params < QSV_MAX_FRAME_EXT_PARAMS) {
> +frame->ext_param[frame->num_ext_params] = param;
> +frame->num_ext_params++;
> +frame->surface.Data.NumExtParam = frame->num_ext_params;
> +} else {
> +av_log(avctx, AV_LOG_WARNING, "Ignore this extra buffer because do
> not "
> +   "have enough space\n");
> +}
> +
> +
> +}
> diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h
> index fe9d5319c4..6a38e87d23 100644
> --- a/libavcodec/qsv_internal.h
> +++ b/libavcodec/qsv_internal.h
> @@ -52,6 +52,8 @@
>  
>  #define QSV_MAX_ENC_PAYLOAD 2   // # of mfxEncodeCtrl payloads supported
>  
> +#define QSV_MAX_FRAME_EXT_PARAMS 4
> +
>  #define QSV_VERSION_ATLEAST(MAJOR, MINOR)   \
>  (MFX_VERSION_MAJOR > (MAJOR) || \
>   MFX_VERSION_MAJOR == (MAJOR) && MFX_VERSION_MINOR >= (MINOR))
> @@ -74,7 +76,8 @@ typedef struct QSVFrame {
>  mfxFrameSurface1 surface;
>  mfxEncodeCtrl enc_ctrl;
>  mfxExtDecodedFrameInfo dec_info;
> -mfxExtBuffer *ext_param;
> +mfxExtBuffer *ext_param[QSV_MAX_FRAME_EXT_PARAMS];
> +int num_ext_params;
>  
>  mfxPayload *payloads[QSV_MAX_ENC_PAYLOAD]; ///< used for enc_ctrl.Payload
>  
> @@ -138,4 +141,7 @@ int ff_qsv_init_session_frames(AVCodecContext *avctx,
> mfxSession *session,
>  
>  int ff_qsv_find_surface_idx(QSVFramesContext *ctx, QSVFrame *frame);
>  
> +void ff_qsv_frame_add_ext_param(AVCodecContext *avctx, QSVFrame *frame,
> +mfxExtBuffer *param);
> +
>  #endif /* AVCODEC_QSV_INTERNAL_H */
> diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
> index d9e0fef1f1..783d252002 100644
> --- a/libavcodec/qsvdec.c
> +++ b/libavcodec/qsvdec.c
> @@ -423,11 +423,13 @@ static int alloc_frame(AVCodecContext *avctx, QSVContext
> *q, QSVFrame *frame)
>  
>  frame->surface.Data.MemId = >frames_ctx.mids[ret];
>  }
> -frame->surface.Data.ExtParam= >ext_param;
> -frame->surface.Data.NumExtParam = 1;
> -frame->ext_param= (mfxExtBuffer*)>dec_info;
> +
> +frame->surface.Data.ExtParam= frame->ext_param;
> +frame->surface.Data.NumExtParam = 0;
> +frame->num_ext_params   = 0;
>  frame->dec_info.Header.BufferId = MFX_EXTBUFF_DECODED_FRAME_INFO;
>  frame->dec_info.Header.BufferSz = sizeof(frame->dec_info);
> +ff_qsv_frame_add_ext_param(avctx, frame, (mfxExtBuffer *)
> >dec_info);
>  
>  frame->used = 1;

Will apply

-Haihao

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

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


Re: [FFmpeg-devel] [PATCH V5 2/2] libavutil/hwcontext_opencl: fix a bug for mapping qsv frame to opencl

2022-01-26 Thread Xiang, Haihao
On Tue, 2022-01-11 at 14:55 +0800, Wenbin Chen wrote:
> From: nyanmisaka 
> 
> mfxHDLPair was added to qsv, so modify qsv->opencl map function as well.
> Now the following commandline works:
> 
> ffmpeg -v verbose -init_hw_device vaapi=va:/dev/dri/renderD128 \
> -init_hw_device qsv=qs@va -init_hw_device opencl=ocl@va -filter_hw_device ocl
> \
> -hwaccel qsv -hwaccel_output_format qsv -hwaccel_device qs -c:v h264_qsv \
> -i input.264 -vf "hwmap=derive_device=opencl,format=opencl,avgblur_opencl, \
> hwmap=derive_device=qsv:reverse=1:extra_hw_frames=32,format=qsv" \
> -c:v h264_qsv output.264
> 
> Signed-off-by: nyanmisaka 
> Signed-off-by: Wenbin Chen 
> ---
>  libavutil/hwcontext_opencl.c | 14 +-
>  libavutil/hwcontext_qsv.c| 34 ++
>  2 files changed, 47 insertions(+), 1 deletion(-)
> 
> diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c
> index 26a3a24593..4e2ab18ede 100644
> --- a/libavutil/hwcontext_opencl.c
> +++ b/libavutil/hwcontext_opencl.c
> @@ -72,6 +72,12 @@
>  #include "hwcontext_drm.h"
>  #endif
>  
> +#if HAVE_OPENCL_VAAPI_INTEL_MEDIA && CONFIG_LIBMFX
> +extern int ff_qsv_get_surface_base_handle(mfxFrameSurface1 *surf,
> +  enum AVHWDeviceType base_dev_typ,
> +  void **base_handle);
> +#endif
> +
>  
>  typedef struct OpenCLDeviceContext {
>  // Default command queue to use for transfer/mapping operations on
> @@ -2248,8 +2254,14 @@ static int opencl_map_from_qsv(AVHWFramesContext
> *dst_fc, AVFrame *dst,
>  
>  #if CONFIG_LIBMFX
>  if (src->format == AV_PIX_FMT_QSV) {
> +void *base_handle;
>  mfxFrameSurface1 *mfx_surface = (mfxFrameSurface1*)src->data[3];
> -va_surface = *(VASurfaceID*)mfx_surface->Data.MemId;
> +err = ff_qsv_get_surface_base_handle(mfx_surface,
> + AV_HWDEVICE_TYPE_VAAPI,
> + _handle);
> +if (err < 0)
> +return err;
> +va_surface = *(VASurfaceID *)base_handle;
>  } else
>  #endif
>  if (src->format == AV_PIX_FMT_VAAPI) {
> diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
> index 853fb7f60d..6d9b8324c2 100644
> --- a/libavutil/hwcontext_qsv.c
> +++ b/libavutil/hwcontext_qsv.c
> @@ -112,6 +112,40 @@ static const struct {
>  #endif
>  };
>  
> +extern int ff_qsv_get_surface_base_handle(mfxFrameSurface1 *surf,
> +  enum AVHWDeviceType base_dev_type,
> +  void **base_handle);
> +
> +/**
> + * Caller needs to allocate enough space for base_handle pointer.
> + **/
> +int ff_qsv_get_surface_base_handle(mfxFrameSurface1 *surf,
> +   enum AVHWDeviceType base_dev_type,
> +   void **base_handle)
> +{
> +mfxHDLPair *handle_pair;
> +handle_pair = surf->Data.MemId;
> +switch (base_dev_type) {
> +#if CONFIG_VAAPI
> +case AV_HWDEVICE_TYPE_VAAPI:
> +base_handle[0] = handle_pair->first;
> +return 0;
> +#endif
> +#if CONFIG_D3D11VA
> +case AV_HWDEVICE_TYPE_D3D11VA:
> +base_handle[0] = handle_pair->first;
> +base_handle[1] = handle_pair->secode;
> +return 0;
> +#endif
> +#if CONFIG_DXVA2
> +case AV_HWDEVICE_TYPE_DXVA2:
> +base_handle[0] = handle_pair->first;
> +return 0;
> +#endif
> +}
> +return AVERROR(EINVAL);
> +}
> +
>  static uint32_t qsv_fourcc_from_pix_fmt(enum AVPixelFormat pix_fmt)
>  {
>  int i;

LGTM, will apply

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


[FFmpeg-devel] [PATCH] avformat/udp: Fix IP_MULTICAST_TTL for BSD compatibility

2022-01-26 Thread lance . lmwang
From: Limin Wang 

Fix #ticket9449
Signed-off-by: Limin Wang 
---
Make it as real patch so that you can test it easily as I don't have BSD system 
for testing.

 libavformat/udp.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavformat/udp.c b/libavformat/udp.c
index 83c042d..a52a489 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -163,8 +163,15 @@ static int udp_set_multicast_ttl(int sockfd, int mcastTTL,
  void *logctx)
 {
 #ifdef IP_MULTICAST_TTL
+int ret = 0;
 if (addr->sa_family == AF_INET) {
-if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
sizeof(mcastTTL)) < 0) {
+ret = setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
sizeof(mcastTTL));
+if (ret < 0 && errno == EINVAL) {
+/* BSD compatibility */
+unsigned char ttl = (unsigned char) ((mcastTTL > 255) ? 255 : 
mcastTTL);
+ret = setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
sizeof(ttl));
+}
+if (ret < 0) {
 ff_log_net_error(logctx, AV_LOG_ERROR, 
"setsockopt(IP_MULTICAST_TTL)");
 return ff_neterrno();
 }
-- 
1.8.3.1

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

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


Re: [FFmpeg-devel] [PATCH 1/2] lavf/udp: set ttl upper bound to 255

2022-01-26 Thread zhilizhao(赵志立)


> On Jan 27, 2022, at 12:22 AM, Zhao Zhili  wrote:
> 
> ---
> libavformat/udp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/udp.c b/libavformat/udp.c
> index 83c042d079..b441d2ea0d 100644
> --- a/libavformat/udp.c
> +++ b/libavformat/udp.c
> @@ -134,7 +134,7 @@ static const AVOption options[] = {
> { "reuse",  "explicitly allow reusing UDP sockets",
> OFFSET(reuse_socket),   AV_OPT_TYPE_BOOL,   { .i64 = -1 },-1, 1,   
> D|E },
> { "reuse_socket",   "explicitly allow reusing UDP sockets",
> OFFSET(reuse_socket),   AV_OPT_TYPE_BOOL,   { .i64 = -1 },-1, 1,   
> .flags = D|E },
> { "broadcast", "explicitly allow or disallow broadcast destination",   
> OFFSET(is_broadcast),   AV_OPT_TYPE_BOOL,   { .i64 = 0  }, 0, 1,   E 
> },
> -{ "ttl","Time to live (multicast only)",   
> OFFSET(ttl),AV_OPT_TYPE_INT,{ .i64 = 16 }, 0, INT_MAX, E 
> },
> +{ "ttl","Time to live (multicast only)",   
> OFFSET(ttl),AV_OPT_TYPE_INT,{ .i64 = 16 }, 0, 255, E 
> },
> { "connect","set if connect() should be called on socket", 
> OFFSET(is_connected),   AV_OPT_TYPE_BOOL,   { .i64 =  0 }, 0, 1,   
> .flags = D|E },
> { "fifo_size",  "set the UDP receiving circular buffer size, 
> expressed as a number of packets with size of 188 bytes", 
> OFFSET(circular_buffer_size), AV_OPT_TYPE_INT, {.i64 = 7*4096}, 0, INT_MAX, D 
> },
> { "overrun_nonfatal", "survive in case of UDP receiving circular buffer 
> overrun", OFFSET(overrun_nonfatal), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1,D 
> },
> -- 
> 2.29.2
> 

This patchset is related to 'Fix setsockopt IP_MULTICAST_TTL on OpenBSD’.

https://patchwork.ffmpeg.org/project/ffmpeg/patch/yd5jaxbcd6gp7...@humpty.home.comstyle.com/

Looks like it’s impossible to avoid casting int to unsigned char, so integer
overflow/truncation must be handled. Since the maximum value of TTL is 255
limited by IPv4/IPv6, set the upper bound of AVOption to fail early for
invalid value.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH v2] configure: add libplacebo to help message

2022-01-26 Thread Zhao Zhili
---
 configure | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure b/configure
index 493493b4c5..5b19a35f59 100755
--- a/configure
+++ b/configure
@@ -255,6 +255,7 @@ External library support:
   --enable-libopenvino enable OpenVINO as a DNN module backend
for DNN based filters like dnn_processing [no]
   --enable-libopus enable Opus de/encoding via libopus [no]
+  --enable-libplacebo  enable libplacebo library [no]
   --enable-libpulseenable Pulseaudio input via libpulse [no]
   --enable-librabbitmq enable RabbitMQ library [no]
   --enable-librav1eenable AV1 encoding via rav1e [no]
-- 
2.31.1

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

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


Re: [FFmpeg-devel] [PATCH] configure: add libplacebo to help message

2022-01-26 Thread Gyan Doshi




On 2022-01-27 09:58 am, Zhao Zhili wrote:

---
  configure | 1 +
  1 file changed, 1 insertion(+)

diff --git a/configure b/configure
index 493493b4c5..23c5837e9b 100755
--- a/configure
+++ b/configure
@@ -255,6 +255,7 @@ External library support:
--enable-libopenvino enable OpenVINO as a DNN module backend
 for DNN based filters like dnn_processing [no]
--enable-libopus enable Opus de/encoding via libopus [no]
+  --enable-libplacebo  enable libplacebo filter [no]


filter --> library.

The filter i.e. the native component can still be disabled manually 
(usually in error).


Regards,
Gyan
___
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] configure: add libplacebo to help message

2022-01-26 Thread Zhao Zhili
---
 configure | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure b/configure
index 493493b4c5..23c5837e9b 100755
--- a/configure
+++ b/configure
@@ -255,6 +255,7 @@ External library support:
   --enable-libopenvino enable OpenVINO as a DNN module backend
for DNN based filters like dnn_processing [no]
   --enable-libopus enable Opus de/encoding via libopus [no]
+  --enable-libplacebo  enable libplacebo filter [no]
   --enable-libpulseenable Pulseaudio input via libpulse [no]
   --enable-librabbitmq enable RabbitMQ library [no]
   --enable-librav1eenable AV1 encoding via rav1e [no]
-- 
2.31.1

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

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


[FFmpeg-devel] [PATCH] hwcontext_vulkan: use VkPhysicalDeviceTimelineSemaphoreFeatures to check for timeline semaphore supporting

2022-01-26 Thread Zhao Zhili
VkPhysicalDeviceVulkan12Features isn't implemented on MoltenVK yet.
VkPhysicalDeviceTimelineSemaphoreFeatures is less versatile but
simple. None of device_features_1_1 nor device_features_1_2 has real
usage yet, keep the code for future.
---
 libavutil/hwcontext_vulkan.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index ae19fc2ab6..2e219511c9 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -1321,8 +1321,16 @@ static int 
vulkan_device_create_internal(AVHWDeviceContext *ctx,
 VulkanDevicePriv *p = ctx->internal->priv;
 FFVulkanFunctions *vk = >vkfn;
 AVVulkanDeviceContext *hwctx = ctx->hwctx;
+/* VkPhysicalDeviceVulkan12Features has a timelineSemaphore field, but
+ * MoltenVK doesn't implement VkPhysicalDeviceVulkan12Features yet, so we
+ * use VkPhysicalDeviceTimelineSemaphoreFeatures directly.
+ */
+VkPhysicalDeviceTimelineSemaphoreFeatures timeline_features = {
+.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES,
+};
 VkPhysicalDeviceVulkan12Features dev_features_1_2 = {
 .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES,
+.pNext = _features,
 };
 VkPhysicalDeviceVulkan11Features dev_features_1_1 = {
 .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES,
@@ -1366,7 +1374,7 @@ static int 
vulkan_device_create_internal(AVHWDeviceContext *ctx,
 #undef COPY_FEATURE
 
 /* We require timeline semaphores */
-if (!dev_features_1_2.timelineSemaphore) {
+if (!timeline_features.timelineSemaphore) {
 av_log(ctx, AV_LOG_ERROR, "Device does not support timeline 
semaphores!\n");
 err = AVERROR(ENOSYS);
 goto end;
-- 
2.31.1

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

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


Re: [FFmpeg-devel] [PATCH] Fix setsockopt IP_MULTICAST_TTL on OpenBSD

2022-01-26 Thread lance . lmwang
On Thu, Jan 27, 2022 at 10:30:10AM +0800, "zhilizhao(赵志立)" wrote:
> 
> 
> > On Jan 27, 2022, at 9:59 AM, lance.lmw...@gmail.com wrote:
> > 
> > On Wed, Jan 26, 2022 at 09:50:47PM +0100, Marton Balint wrote:
> >> 
> >> 
> >> On Wed, 26 Jan 2022, Brad Smith wrote:
> >> 
> >>> On Wed, Jan 12, 2022 at 12:13:14AM -0500, Brad Smith wrote:
>  Fix setsockopt() usage on OpenBSD with IP_MULTICAST_TTL. The field
>  type should be an unsigned char on anything but Linux.
> >>> 
> >>> Based on feedback so far. Here is a much simpler approach to this issue..
> >> 
> >> Win32 needs DWORD unfortunately. I missed it earlier, sorry.
> >> 
> >> https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ip-socket-options
> > 
> > From my testing on Mac system, it support one byte only, but at least, it'll
> > report "Invalid argument" only if the ttl > 255. Maybe we can try with one 
> > byte
> > again if the errno is invalid like below. I tested it with ttl > 255 on Mac 
> > system
> > and without "Invalid argument" anymore.
> 
> 
> MacOS support int and unsigned char from my test. The upper bound of TTL is 
> limited
> to 255 (limited by protocol design), I guess it’s unrelated to int or 
> unsigned char.

Yes, MacOS isn't caused by one byte or int. By #Ticket9449, it'll failed for 
ttl=10,
so I guess my proposal which try with one byte again should be work for Openbsd 
system.
But you can't limit to 255 only as some system support for int like Win32.

> 
> 
> > 
> > #ifdef IP_MULTICAST_TTL
> > +int ret = 0;
> > if (addr->sa_family == AF_INET) {
> > -if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
> > sizeof(mcastTTL)) < 0) {
> > +ret = setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
> > sizeof(mcastTTL));
> > +/* try with byte also for IP_MULTICAST_TTL for some system like 
> > OpenBSD */
> > +if (ret < 0 && errno == EINVAL) {
> > +unsigned char ttl = mcastTTL;
> > +ff_log_net_error(logctx, AV_LOG_ERROR, 
> > "setsockopt(IP_MULTICAST_TTL): ");
> > +ret = setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
> > sizeof(ttl));
> > +}
> > +if (ret < 0) {
> > ff_log_net_error(logctx, AV_LOG_ERROR, 
> > "setsockopt(IP_MULTICAST_TTL)");
> > return ff_neterrno();
> > 
> > 
> >> 
> >> Regards,
> >> Marton
> >> 
> >>> 
> >>> 
> >>> diff --git a/libavformat/udp.c b/libavformat/udp.c
> >>> index 83c042d079..da1b98890b 100644
> >>> --- a/libavformat/udp.c
> >>> +++ b/libavformat/udp.c
> >>> @@ -164,7 +164,9 @@ static int udp_set_multicast_ttl(int sockfd, int 
> >>> mcastTTL,
> >>> {
> >>> #ifdef IP_MULTICAST_TTL
> >>>if (addr->sa_family == AF_INET) {
> >>> -if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
> >>> sizeof(mcastTTL)) < 0) {
> >>> +unsigned char ttl = mcastTTL;  /* ignore the outdated Linux 
> >>> documentation */
> >>> +
> >>> +if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
> >>> sizeof(ttl)) < 0) {
> >>>ff_log_net_error(logctx, AV_LOG_ERROR, 
> >>> "setsockopt(IP_MULTICAST_TTL)");
> >>>return ff_neterrno();
> >>>}
> >>> ___
> >>> ffmpeg-devel mailing list
> >>> ffmpeg-devel@ffmpeg.org
> >>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >>> 
> >>> To unsubscribe, visit link above, or email
> >>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> >>> 
> >> ___
> >> ffmpeg-devel mailing list
> >> ffmpeg-devel@ffmpeg.org
> >> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >> 
> >> To unsubscribe, visit link above, or email
> >> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> > 
> > -- 
> > Thanks,
> > Limin Wang
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > 
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

-- 
Thanks,
Limin Wang
___
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] Fix setsockopt IP_MULTICAST_TTL on OpenBSD

2022-01-26 Thread zhilizhao(赵志立)


> On Jan 27, 2022, at 9:59 AM, lance.lmw...@gmail.com wrote:
> 
> On Wed, Jan 26, 2022 at 09:50:47PM +0100, Marton Balint wrote:
>> 
>> 
>> On Wed, 26 Jan 2022, Brad Smith wrote:
>> 
>>> On Wed, Jan 12, 2022 at 12:13:14AM -0500, Brad Smith wrote:
 Fix setsockopt() usage on OpenBSD with IP_MULTICAST_TTL. The field
 type should be an unsigned char on anything but Linux.
>>> 
>>> Based on feedback so far. Here is a much simpler approach to this issue..
>> 
>> Win32 needs DWORD unfortunately. I missed it earlier, sorry.
>> 
>> https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ip-socket-options
> 
> From my testing on Mac system, it support one byte only, but at least, it'll
> report "Invalid argument" only if the ttl > 255. Maybe we can try with one 
> byte
> again if the errno is invalid like below. I tested it with ttl > 255 on Mac 
> system
> and without "Invalid argument" anymore.


MacOS support int and unsigned char from my test. The upper bound of TTL is 
limited
to 255 (limited by protocol design), I guess it’s unrelated to int or unsigned 
char.


> 
> #ifdef IP_MULTICAST_TTL
> +int ret = 0;
> if (addr->sa_family == AF_INET) {
> -if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
> sizeof(mcastTTL)) < 0) {
> +ret = setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
> sizeof(mcastTTL));
> +/* try with byte also for IP_MULTICAST_TTL for some system like 
> OpenBSD */
> +if (ret < 0 && errno == EINVAL) {
> +unsigned char ttl = mcastTTL;
> +ff_log_net_error(logctx, AV_LOG_ERROR, 
> "setsockopt(IP_MULTICAST_TTL): ");
> +ret = setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
> sizeof(ttl));
> +}
> +if (ret < 0) {
> ff_log_net_error(logctx, AV_LOG_ERROR, 
> "setsockopt(IP_MULTICAST_TTL)");
> return ff_neterrno();
> 
> 
>> 
>> Regards,
>> Marton
>> 
>>> 
>>> 
>>> diff --git a/libavformat/udp.c b/libavformat/udp.c
>>> index 83c042d079..da1b98890b 100644
>>> --- a/libavformat/udp.c
>>> +++ b/libavformat/udp.c
>>> @@ -164,7 +164,9 @@ static int udp_set_multicast_ttl(int sockfd, int 
>>> mcastTTL,
>>> {
>>> #ifdef IP_MULTICAST_TTL
>>>if (addr->sa_family == AF_INET) {
>>> -if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
>>> sizeof(mcastTTL)) < 0) {
>>> +unsigned char ttl = mcastTTL;  /* ignore the outdated Linux 
>>> documentation */
>>> +
>>> +if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
>>> sizeof(ttl)) < 0) {
>>>ff_log_net_error(logctx, AV_LOG_ERROR, 
>>> "setsockopt(IP_MULTICAST_TTL)");
>>>return ff_neterrno();
>>>}
>>> ___
>>> ffmpeg-devel mailing list
>>> ffmpeg-devel@ffmpeg.org
>>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>> 
>>> To unsubscribe, visit link above, or email
>>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>>> 
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>> 
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> 
> -- 
> Thanks,
> Limin Wang
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

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

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


Re: [FFmpeg-devel] [PATCH] Fix setsockopt IP_MULTICAST_TTL on OpenBSD

2022-01-26 Thread zhilizhao(赵志立)



> On Jan 27, 2022, at 9:59 AM, lance.lmw...@gmail.com wrote:
> 
> On Wed, Jan 26, 2022 at 09:50:47PM +0100, Marton Balint wrote:
>> 
>> 
>> On Wed, 26 Jan 2022, Brad Smith wrote:
>> 
>>> On Wed, Jan 12, 2022 at 12:13:14AM -0500, Brad Smith wrote:
 Fix setsockopt() usage on OpenBSD with IP_MULTICAST_TTL. The field
 type should be an unsigned char on anything but Linux.
>>> 
>>> Based on feedback so far. Here is a much simpler approach to this issue..
>> 
>> Win32 needs DWORD unfortunately. I missed it earlier, sorry.
>> 
>> https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ip-socket-options
> 
> From my testing on Mac system, it support one byte only, but at least, it'll
> report "Invalid argument" only if the ttl > 255. Maybe we can try with one 
> byte
> again if the errno is invalid like below. I tested it with ttl > 255 on Mac 
> system
> and without "Invalid argument" anymore.
> 
> #ifdef IP_MULTICAST_TTL
> +int ret = 0;
> if (addr->sa_family == AF_INET) {
> -if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
> sizeof(mcastTTL)) < 0) {
> +ret = setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
> sizeof(mcastTTL));
> +/* try with byte also for IP_MULTICAST_TTL for some system like 
> OpenBSD */
> +if (ret < 0 && errno == EINVAL) {
> +unsigned char ttl = mcastTTL;
> +ff_log_net_error(logctx, AV_LOG_ERROR, 
> "setsockopt(IP_MULTICAST_TTL): ");
> +ret = setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
> sizeof(ttl));
> +}
> +if (ret < 0) {
> ff_log_net_error(logctx, AV_LOG_ERROR, 
> "setsockopt(IP_MULTICAST_TTL)");
> return ff_neterrno();
> 
> 
>> 
>> Regards,
>> Marton
>> 
>>> 
>>> 
>>> diff --git a/libavformat/udp.c b/libavformat/udp.c
>>> index 83c042d079..da1b98890b 100644
>>> --- a/libavformat/udp.c
>>> +++ b/libavformat/udp.c
>>> @@ -164,7 +164,9 @@ static int udp_set_multicast_ttl(int sockfd, int 
>>> mcastTTL,
>>> {
>>> #ifdef IP_MULTICAST_TTL
>>>if (addr->sa_family == AF_INET) {
>>> -if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
>>> sizeof(mcastTTL)) < 0) {
>>> +unsigned char ttl = mcastTTL;  /* ignore the outdated Linux 
>>> documentation */
>>> +
>>> +if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
>>> sizeof(ttl)) < 0) {
>>>ff_log_net_error(logctx, AV_LOG_ERROR, 
>>> "setsockopt(IP_MULTICAST_TTL)");
>>>return ff_neterrno();
>>>}
>>> ___
>>> ffmpeg-devel mailing list
>>> ffmpeg-devel@ffmpeg.org
>>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>> 
>>> To unsubscribe, visit link above, or email
>>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>>> 
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>> 
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> 
> -- 
> Thanks,
> Limin Wang
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

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

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


[FFmpeg-devel] [PATCH] Check codec whitelist in av_find_best_stream

2022-01-26 Thread Eric Juteau
Modified the function av_find_best_stream() such that, when a list of
allowed codecs is supplied in the format context, and when the caller is
requesting a decoder be returned, the function will select the best
stream that has a decoder in the allowed decoders list.

Signed-off-by: Eric Juteau 
---
 libavformat/utils.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index e643821fc9..5a96f16c0f 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -529,7 +529,8 @@ int av_find_best_stream(AVFormatContext *ic, enum 
AVMediaType type,
 continue;
 if (decoder_ret) {
 decoder = ff_find_decoder(ic, st, par->codec_id);
-if (!decoder) {
+if ((!decoder) ||
+(ic->codec_whitelist && av_match_list(decoder->name, 
ic->codec_whitelist, ',') <= 0)) {
 if (ret < 0)
 ret = AVERROR_DECODER_NOT_FOUND;
 continue;
-- 
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".


Re: [FFmpeg-devel] [PATCH] Fix setsockopt IP_MULTICAST_TTL on OpenBSD

2022-01-26 Thread lance . lmwang
On Wed, Jan 26, 2022 at 09:50:47PM +0100, Marton Balint wrote:
> 
> 
> On Wed, 26 Jan 2022, Brad Smith wrote:
> 
> > On Wed, Jan 12, 2022 at 12:13:14AM -0500, Brad Smith wrote:
> > > Fix setsockopt() usage on OpenBSD with IP_MULTICAST_TTL. The field
> > > type should be an unsigned char on anything but Linux.
> > 
> > Based on feedback so far. Here is a much simpler approach to this issue..
> 
> Win32 needs DWORD unfortunately. I missed it earlier, sorry.
> 
> https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ip-socket-options

>From my testing on Mac system, it support one byte only, but at least, it'll
report "Invalid argument" only if the ttl > 255. Maybe we can try with one byte
again if the errno is invalid like below. I tested it with ttl > 255 on Mac 
system
and without "Invalid argument" anymore.

 #ifdef IP_MULTICAST_TTL
+int ret = 0;
 if (addr->sa_family == AF_INET) {
-if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
sizeof(mcastTTL)) < 0) {
+ret = setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
sizeof(mcastTTL));
+/* try with byte also for IP_MULTICAST_TTL for some system like 
OpenBSD */
+if (ret < 0 && errno == EINVAL) {
+unsigned char ttl = mcastTTL;
+ff_log_net_error(logctx, AV_LOG_ERROR, 
"setsockopt(IP_MULTICAST_TTL): ");
+ret = setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
sizeof(ttl));
+}
+if (ret < 0) {
 ff_log_net_error(logctx, AV_LOG_ERROR, 
"setsockopt(IP_MULTICAST_TTL)");
 return ff_neterrno();


> 
> Regards,
> Marton
> 
> > 
> > 
> > diff --git a/libavformat/udp.c b/libavformat/udp.c
> > index 83c042d079..da1b98890b 100644
> > --- a/libavformat/udp.c
> > +++ b/libavformat/udp.c
> > @@ -164,7 +164,9 @@ static int udp_set_multicast_ttl(int sockfd, int 
> > mcastTTL,
> > {
> > #ifdef IP_MULTICAST_TTL
> > if (addr->sa_family == AF_INET) {
> > -if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
> > sizeof(mcastTTL)) < 0) {
> > +unsigned char ttl = mcastTTL;  /* ignore the outdated Linux 
> > documentation */
> > +
> > +if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
> > sizeof(ttl)) < 0) {
> > ff_log_net_error(logctx, AV_LOG_ERROR, 
> > "setsockopt(IP_MULTICAST_TTL)");
> > return ff_neterrno();
> > }
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > 
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> > 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

-- 
Thanks,
Limin Wang
___
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] Fix setsockopt IP_MULTICAST_TTL on OpenBSD

2022-01-26 Thread Chad Fraleigh

On 1/26/2022 12:50 PM, Marton Balint wrote:
> 
> 
> On Wed, 26 Jan 2022, Brad Smith wrote:
> 
>> On Wed, Jan 12, 2022 at 12:13:14AM -0500, Brad Smith wrote:
>>> Fix setsockopt() usage on OpenBSD with IP_MULTICAST_TTL. The field
>>> type should be an unsigned char on anything but Linux.
>>
>> Based on feedback so far. Here is a much simpler approach to this issue..
> 
> Win32 needs DWORD unfortunately. I missed it earlier, sorry.
> 
> https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ip-socket-options

It gets worse from there. Since I can't look at the real Win32 source to see if 
it handles it both way, I had to go with Wine and ReactOS..

In Wine, the tests seem to use just an 'int' (which is probably always the same 
as 'DWORD'). But then, it proceeds to check it using a 1, 2, 3, and 4 byte 
optlen. In the implementation, it appears to just pass the values as-is to the 
underlying OS, rather than explicitly translate it to the appropriate type.

For ReactOS, it blindly treats it as an unsigned char (regardless of optlen, as 
long as it at least 1) when setting/getting the value. But then in a debug line 
just below that, it treats optval as an 'int *'.

Maybe some tests need to be done on Win32 to see if it works with either size 
(i.e. set as uchar, get as DWORD, then in reverse and make sure the 
input/output match in all cases).

I didn't check to see what msys/mingw* does, if anything.

> 
> Regards,
> Marton
> 
>>
>>
>> diff --git a/libavformat/udp.c b/libavformat/udp.c
>> index 83c042d079..da1b98890b 100644
>> --- a/libavformat/udp.c
>> +++ b/libavformat/udp.c
>> @@ -164,7 +164,9 @@ static int udp_set_multicast_ttl(int sockfd, int 
>> mcastTTL,
>> {
>> #ifdef IP_MULTICAST_TTL
>>     if (addr->sa_family == AF_INET) {
>> -    if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
>> sizeof(mcastTTL)) < 0) {
>> +    unsigned char ttl = mcastTTL;  /* ignore the outdated Linux 
>> documentation */
>> +
>> +    if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
>> sizeof(ttl)) < 0) {
>>     ff_log_net_error(logctx, AV_LOG_ERROR, 
>> "setsockopt(IP_MULTICAST_TTL)");
>>     return ff_neterrno();
>>     }
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH] avcodec/libxvid: Don't set AVCodecContext.codec_id

2022-01-26 Thread Andreas Rheinhardt
Unnecessary since 2325bdad7b67b1c8539ef6beebb99d3247f08669
(and crazy even before then).

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/libxvid.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavcodec/libxvid.c b/libavcodec/libxvid.c
index 7cf9d7661c..94746d0bda 100644
--- a/libavcodec/libxvid.c
+++ b/libavcodec/libxvid.c
@@ -657,7 +657,6 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx)
 if (xvid_flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
 /* In this case, we are claiming to be MPEG-4 */
 x->quicktime_format = 1;
-avctx->codec_id = AV_CODEC_ID_MPEG4;
 } else {
 /* We are claiming to be Xvid */
 x->quicktime_format = 0;
-- 
2.32.0

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

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


Re: [FFmpeg-devel] [PATCH] x86/tx_float: do not build tx_float_init.c if x86 assembly is disabled

2022-01-26 Thread James Almer




On 1/26/2022 7:44 PM, Lynne wrote:

This broke builds with --disable-mmx, which also disabled assembly
entirely, but ARCH_X86 was still true, so the init file tried to find
assembly that didn't exist.
Instead of checking for architecture, check if x86 assembly is enabled.

Patch attached.




From 97e91aea87876a542a0f075e7093708f38f38a8c Mon Sep 17 00:00:00 2001
From: Lynne 
Date: Wed, 26 Jan 2022 23:40:35 +0100
Subject: [PATCH] x86/tx_float: do not build tx_float_init.c if x86 assembly is
 disabled

This broke builds with --disable-mmx, which also disabled assembly
entirely, but ARCH_X86 was still true, so the init file tried to find
assembly that didn't exist.
Instead of checking for architecture, check if x86 assembly is enabled.
---
 libavutil/tx.c | 2 +-
 libavutil/x86/Makefile | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavutil/tx.c b/libavutil/tx.c
index cac7815231..5c1ac20c92 100644
--- a/libavutil/tx.c
+++ b/libavutil/tx.c
@@ -439,7 +439,7 @@ av_cold int ff_tx_init_subtx(AVTXContext *s, enum AVTXType 
type,
 ff_tx_codelet_list_double_c,
 ff_tx_codelet_list_int32_c,
 ff_tx_null_list,
-#if ARCH_X86
+#if HAVE_X86ASM
 ff_tx_codelet_list_float_x86,
 #endif
 };
diff --git a/libavutil/x86/Makefile b/libavutil/x86/Makefile
index d747c37049..d66839e35d 100644
--- a/libavutil/x86/Makefile
+++ b/libavutil/x86/Makefile
@@ -3,7 +3,8 @@ OBJS += x86/cpu.o   
\
 x86/float_dsp_init.o\
 x86/imgutils_init.o \
 x86/lls_init.o  \
-x86/tx_float_init.o \
+
+OBJS-$(HAVE_X86ASM) += x86/tx_float_init.o  \


This is not how we normally handle things. Init files for a given target 
arch should compile regardless of what is enabled at configure time. DCE 
with all the EXTERNAL_ checks should take care of not referencing 
symbols that nasm will not assemble.


 
 OBJS-$(CONFIG_PIXELUTILS) += x86/pixelutils_init.o  \
 
--

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] x86/tx_float: do not build tx_float_init.c if x86 assembly is disabled

2022-01-26 Thread Lynne
This broke builds with --disable-mmx, which also disabled assembly
entirely, but ARCH_X86 was still true, so the init file tried to find
assembly that didn't exist.
Instead of checking for architecture, check if x86 assembly is enabled.

Patch attached.

>From 97e91aea87876a542a0f075e7093708f38f38a8c Mon Sep 17 00:00:00 2001
From: Lynne 
Date: Wed, 26 Jan 2022 23:40:35 +0100
Subject: [PATCH] x86/tx_float: do not build tx_float_init.c if x86 assembly is
 disabled

This broke builds with --disable-mmx, which also disabled assembly
entirely, but ARCH_X86 was still true, so the init file tried to find
assembly that didn't exist.
Instead of checking for architecture, check if x86 assembly is enabled.
---
 libavutil/tx.c | 2 +-
 libavutil/x86/Makefile | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavutil/tx.c b/libavutil/tx.c
index cac7815231..5c1ac20c92 100644
--- a/libavutil/tx.c
+++ b/libavutil/tx.c
@@ -439,7 +439,7 @@ av_cold int ff_tx_init_subtx(AVTXContext *s, enum AVTXType type,
 ff_tx_codelet_list_double_c,
 ff_tx_codelet_list_int32_c,
 ff_tx_null_list,
-#if ARCH_X86
+#if HAVE_X86ASM
 ff_tx_codelet_list_float_x86,
 #endif
 };
diff --git a/libavutil/x86/Makefile b/libavutil/x86/Makefile
index d747c37049..d66839e35d 100644
--- a/libavutil/x86/Makefile
+++ b/libavutil/x86/Makefile
@@ -3,7 +3,8 @@ OBJS += x86/cpu.o   \
 x86/float_dsp_init.o\
 x86/imgutils_init.o \
 x86/lls_init.o  \
-x86/tx_float_init.o \
+
+OBJS-$(HAVE_X86ASM) += x86/tx_float_init.o  \
 
 OBJS-$(CONFIG_PIXELUTILS) += x86/pixelutils_init.o  \
 
-- 
2.34.1

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

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


Re: [FFmpeg-devel] [PATCH v1 1/9] lavu/pix_fmt: add P012 pixel format

2022-01-26 Thread Carl Eugen Hoyos
Am Mi., 26. Jan. 2022 um 09:33 Uhr schrieb Xiang, Haihao
:

> > Did you already explain why you cannot use P016 or in which situation
> > it would create a different output?
>
> $ ffmpeg -hwaccel vaapi -f rawvideo -pix_fmt p016 -s 1920x1080 -i input.yuv
> -vf "hwupload,format=vaapi" -c:v hevc_vaapi -f null -
>
> If using P016, how will we know the input is 12bit indeed

Thank you for explaining this, at least I didn't realize this reason earlier!

I hope we can find another solution than to add an additional pix_fmt.
I believe I had suggested an additional property bit_depth for raw video
a long time ago.

Carl Eugen
___
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 33/33] avcodec/mpeg4videodec: Move use_intra_dc_vlc to stack, fix data race

2022-01-26 Thread Andreas Rheinhardt
use_intra_dc_vlc is currently kept in sync between frame threads
in mpeg4_update_thread_context(), yet it is set when decoding
blocks, i.e. after ff_thread_finish_setup(). This is a data race
and therefore undefined behaviour.

This race can be fixed easily by moving the variable from the context
to the stack: use_intra_dc_vlc is only read in
mpeg4_decode_block() and only if one is decoding an intra block.
There are three callsites for this function: One in
mpeg4_decode_partitioned_mb() which always sets use_intra_dc_vlc
before the call and two in mpeg4_decode_mb(). One of these callsites
is for intra blocks and use_intra_dc_vlc is set before it;
the last callsite is for non-intra blocks, where use_intra_dc_vlc
is ignored. So if it is used, it always uses a new value and can
therefore be moved to the stack.

The above also explains why this data race did not lead to
FATE-test failures.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/mpeg4video.h|  1 -
 libavcodec/mpeg4videodec.c | 24 ++--
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/libavcodec/mpeg4video.h b/libavcodec/mpeg4video.h
index 9fc79b1a22..14fc5e1396 100644
--- a/libavcodec/mpeg4video.h
+++ b/libavcodec/mpeg4video.h
@@ -94,7 +94,6 @@ typedef struct Mpeg4DecContext {
 int new_pred;
 int enhancement_type;
 int scalability;
-int use_intra_dc_vlc;
 
 /// QP above which the ac VLC should be used for intra dc
 int intra_dc_threshold;
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index b8118ff2d2..2aea845580 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -1105,7 +1105,8 @@ int ff_mpeg4_decode_partitions(Mpeg4DecContext *ctx)
  * @return <0 if an error occurred
  */
 static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block,
- int n, int coded, int intra, int rvlc)
+ int n, int coded, int intra,
+ int use_intra_dc_vlc, int rvlc)
 {
 MpegEncContext *s = >m;
 int level, i, last, run, qmul, qadd;
@@ -1117,7 +1118,7 @@ static inline int mpeg4_decode_block(Mpeg4DecContext 
*ctx, int16_t *block,
 // Note intra & rvlc should be optimized away if this is inlined
 
 if (intra) {
-if (ctx->use_intra_dc_vlc) {
+if (use_intra_dc_vlc) {
 /* DC coef */
 if (s->partitioned_frame) {
 level = s->dc_val[0][s->block_index[n]];
@@ -1357,7 +1358,7 @@ static inline int mpeg4_decode_block(Mpeg4DecContext 
*ctx, int16_t *block,
 
 not_coded:
 if (intra) {
-if (!ctx->use_intra_dc_vlc) {
+if (!use_intra_dc_vlc) {
 block[0] = ff_mpeg4_pred_dc(s, n, block[0], _pred_dir, 0);
 
 i -= i >> 31;  // if (i == -1) i = 0;
@@ -1378,7 +1379,7 @@ not_coded:
 static int mpeg4_decode_partitioned_mb(MpegEncContext *s, int16_t block[6][64])
 {
 Mpeg4DecContext *ctx = s->avctx->priv_data;
-int cbp, mb_type;
+int cbp, mb_type, use_intra_dc_vlc;
 const int xy = s->mb_x + s->mb_y * s->mb_stride;
 
 av_assert2(s == (void*)ctx);
@@ -1386,7 +1387,7 @@ static int mpeg4_decode_partitioned_mb(MpegEncContext *s, 
int16_t block[6][64])
 mb_type = s->current_picture.mb_type[xy];
 cbp = s->cbp_table[xy];
 
-ctx->use_intra_dc_vlc = s->qscale < ctx->intra_dc_threshold;
+use_intra_dc_vlc = s->qscale < ctx->intra_dc_threshold;
 
 if (s->current_picture.qscale_table[xy] != s->qscale)
 ff_set_qscale(s, s->current_picture.qscale_table[xy]);
@@ -1436,7 +1437,8 @@ static int mpeg4_decode_partitioned_mb(MpegEncContext *s, 
int16_t block[6][64])
 s->bdsp.clear_blocks(s->block[0]);
 /* decode each block */
 for (i = 0; i < 6; i++) {
-if (mpeg4_decode_block(ctx, block[i], i, cbp & 32, s->mb_intra, 
ctx->rvlc) < 0) {
+if (mpeg4_decode_block(ctx, block[i], i, cbp & 32, s->mb_intra,
+   use_intra_dc_vlc, ctx->rvlc) < 0) {
 av_log(s->avctx, AV_LOG_ERROR,
"texture corrupted at %d %d %d\n",
s->mb_x, s->mb_y, s->mb_intra);
@@ -1763,6 +1765,8 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t 
block[6][64])
 }
 s->current_picture.mb_type[xy] = mb_type;
 } else { /* I-Frame */
+int use_intra_dc_vlc;
+
 do {
 cbpc = get_vlc2(>gb, ff_h263_intra_MCBPC_vlc.table, 
INTRA_MCBPC_VLC_BITS, 2);
 if (cbpc < 0) {
@@ -1790,7 +1794,7 @@ intra:
 }
 cbp = (cbpc & 3) | (cbpy << 2);
 
-ctx->use_intra_dc_vlc = s->qscale < ctx->intra_dc_threshold;
+use_intra_dc_vlc = s->qscale < ctx->intra_dc_threshold;
 
 if (dquant)
 ff_set_qscale(s, s->qscale + quant_tab[get_bits(>gb, 2)]);
@@ -1801,7 +1805,8 @@ intra:
 s->bdsp.clear_blocks(s->block[0]);
 /* decode each block */
   

[FFmpeg-devel] [PATCH 32/33] avcodec/mpegvideo: Use offset instead of pointer for vbv_delay

2022-01-26 Thread Andreas Rheinhardt
An offset has the advantage of not needing to be updated
when the buffer is reallocated. Furthermore, the way the pointer
is currently updated is undefined behaviour in case the pointer
is not already set (i.e. when not encoding MPEG-1/2), because
it calculates the nonsense NULL - s->pb.buf.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/mpeg12enc.c |  2 +-
 libavcodec/mpegvideo.h |  2 +-
 libavcodec/mpegvideo_enc.c | 15 +++
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index ecb90d1a41..9c0be69ded 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -465,7 +465,7 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s, int 
picture_number)
  (s->picture_number - mpeg12->gop_picture_number) & 0x3ff);
 put_bits(>pb, 3, s->pict_type);
 
-s->vbv_delay_ptr = s->pb.buf + put_bytes_count(>pb, 0);
+s->vbv_delay_pos = put_bytes_count(>pb, 0);
 put_bits(>pb, 16, 0x);   /* vbv_delay */
 
 // RAL: Forward f_code also needed for B-frames
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 325f62e01f..fa0ea51046 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -429,7 +429,7 @@ typedef struct MpegEncContext {
 
 /* MPEG-1 specific */
 int last_mv_dir; ///< last mv_dir, used for B-frame encoding
-uint8_t *vbv_delay_ptr;  ///< pointer to vbv_delay in the bitstream
+int vbv_delay_pos;   ///< offset of vbv_delay in the bitstream
 
 /* MPEG-2-specific - I wished not to have to support this mess. */
 int progressive_sequence;
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index baa45d20ab..d27a74f9e0 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -1840,8 +1840,9 @@ vbv_retry:
 double inbits  = avctx->rc_max_rate *
  av_q2d(avctx->time_base);
 intminbits = s->frame_bits - 8 *
- (s->vbv_delay_ptr - s->pb.buf - 1);
+ (s->vbv_delay_pos - 1);
 double bits= s->rc_context.buffer_index + minbits - inbits;
+uint8_t *const vbv_delay_ptr = s->pb.buf + s->vbv_delay_pos;
 
 if (bits < 0)
 av_log(avctx, AV_LOG_ERROR,
@@ -1857,11 +1858,11 @@ vbv_retry:
 
 av_assert0(vbv_delay < 0x);
 
-s->vbv_delay_ptr[0] &= 0xF8;
-s->vbv_delay_ptr[0] |= vbv_delay >> 13;
-s->vbv_delay_ptr[1]  = vbv_delay >> 5;
-s->vbv_delay_ptr[2] &= 0x07;
-s->vbv_delay_ptr[2] |= vbv_delay << 3;
+vbv_delay_ptr[0] &= 0xF8;
+vbv_delay_ptr[0] |= vbv_delay >> 13;
+vbv_delay_ptr[1]  = vbv_delay >> 5;
+vbv_delay_ptr[2] &= 0x07;
+vbv_delay_ptr[2] |= vbv_delay << 3;
 
 props = av_cpb_properties_alloc(_size);
 if (!props)
@@ -2721,7 +2722,6 @@ int ff_mpv_reallocate_putbitbuffer(MpegEncContext *s, 
size_t threshold, size_t s
 && s->slice_context_count == 1
 && s->pb.buf == s->avctx->internal->byte_buffer) {
 int lastgob_pos = s->ptr_lastgob - s->pb.buf;
-int vbv_pos = s->vbv_delay_ptr - s->pb.buf;
 
 uint8_t *new_buffer = NULL;
 int new_buffer_size = 0;
@@ -2744,7 +2744,6 @@ int ff_mpv_reallocate_putbitbuffer(MpegEncContext *s, 
size_t threshold, size_t s
 s->avctx->internal->byte_buffer_size = new_buffer_size;
 rebase_put_bits(>pb, new_buffer, new_buffer_size);
 s->ptr_lastgob   = s->pb.buf + lastgob_pos;
-s->vbv_delay_ptr = s->pb.buf + vbv_pos;
 }
 if (put_bytes_left(>pb, 0) < threshold)
 return AVERROR(EINVAL);
-- 
2.32.0

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

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


[FFmpeg-devel] [PATCH 31/33] avcodec/h264data: Add missing rational.h inclusion

2022-01-26 Thread Andreas Rheinhardt
Fixes checkheaders.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/h264data.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/h264data.h b/libavcodec/h264data.h
index 988352aa9a..4efe76a34d 100644
--- a/libavcodec/h264data.h
+++ b/libavcodec/h264data.h
@@ -21,6 +21,7 @@
 
 #include 
 
+#include "libavutil/rational.h"
 #include "h264.h"
 
 extern const uint8_t ff_h264_golomb_to_pict_type[5];
-- 
2.32.0

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

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


[FFmpeg-devel] [PATCH 30/33] avcodec/mpegpicture: Add function to completely free MPEG-Picture

2022-01-26 Thread Andreas Rheinhardt
Also use said function in mpegvideo.c and mpegvideo_enc.c;
and make ff_free_picture_tables() static as it isn't needed anymore
outside of mpegpicture.c.

Signed-off-by: Andreas Rheinhardt 
---
The new_picture is actually only used by encoders;
if it were not for svq1enc (which relies on ff_mpv_common_init()
and ff_mpv_common_end() to allocate and free it), I'd have moved
everything related to it to mpegvideo_enc.c. I probably do it later
anyway.
(And yes, I am aware of the fact that freeing this frame in
ff_mpv_encode_end() is redundant.)

 libavcodec/mpegpicture.c   | 47 +-
 libavcodec/mpegpicture.h   |  2 +-
 libavcodec/mpegvideo.c | 25 +---
 libavcodec/mpegvideo_enc.c |  3 +--
 4 files changed, 34 insertions(+), 43 deletions(-)

diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c
index f78a3c23e3..349ab81055 100644
--- a/libavcodec/mpegpicture.c
+++ b/libavcodec/mpegpicture.c
@@ -30,6 +30,24 @@
 #include "mpegpicture.h"
 #include "mpegutils.h"
 
+static void av_noinline free_picture_tables(Picture *pic)
+{
+pic->alloc_mb_width  =
+pic->alloc_mb_height = 0;
+
+av_buffer_unref(>mb_var_buf);
+av_buffer_unref(>mc_mb_var_buf);
+av_buffer_unref(>mb_mean_buf);
+av_buffer_unref(>mbskip_table_buf);
+av_buffer_unref(>qscale_table_buf);
+av_buffer_unref(>mb_type_buf);
+
+for (int i = 0; i < 2; i++) {
+av_buffer_unref(>motion_val_buf[i]);
+av_buffer_unref(>ref_index_buf[i]);
+}
+}
+
 static int make_tables_writable(Picture *pic)
 {
 int ret, i;
@@ -240,7 +258,7 @@ int ff_alloc_picture(AVCodecContext *avctx, Picture *pic, 
MotionEstContext *me,
 if (pic->qscale_table_buf)
 if (   pic->alloc_mb_width  != mb_width
 || pic->alloc_mb_height != mb_height)
-ff_free_picture_tables(pic);
+free_picture_tables(pic);
 
 if (shared) {
 av_assert0(pic->f->data[0]);
@@ -285,7 +303,7 @@ int ff_alloc_picture(AVCodecContext *avctx, Picture *pic, 
MotionEstContext *me,
 fail:
 av_log(avctx, AV_LOG_ERROR, "Error allocating a picture.\n");
 ff_mpeg_unref_picture(avctx, pic);
-ff_free_picture_tables(pic);
+free_picture_tables(pic);
 return AVERROR(ENOMEM);
 }
 
@@ -310,7 +328,7 @@ void ff_mpeg_unref_picture(AVCodecContext *avctx, Picture 
*pic)
 av_buffer_unref(>hwaccel_priv_buf);
 
 if (pic->needs_realloc)
-ff_free_picture_tables(pic);
+free_picture_tables(pic);
 
 memset((uint8_t*)pic + off, 0, sizeof(*pic) - off);
 }
@@ -331,7 +349,7 @@ int ff_update_picture_tables(Picture *dst, Picture *src)
 }
 
 if (ret < 0) {
-ff_free_picture_tables(dst);
+free_picture_tables(dst);
 return ret;
 }
 
@@ -450,22 +468,9 @@ int ff_find_unused_picture(AVCodecContext *avctx, Picture 
*picture, int shared)
 return ret;
 }
 
-void ff_free_picture_tables(Picture *pic)
+void av_cold ff_free_picture(AVCodecContext *avctx, Picture *pic)
 {
-int i;
-
-pic->alloc_mb_width  =
-pic->alloc_mb_height = 0;
-
-av_buffer_unref(>mb_var_buf);
-av_buffer_unref(>mc_mb_var_buf);
-av_buffer_unref(>mb_mean_buf);
-av_buffer_unref(>mbskip_table_buf);
-av_buffer_unref(>qscale_table_buf);
-av_buffer_unref(>mb_type_buf);
-
-for (i = 0; i < 2; i++) {
-av_buffer_unref(>motion_val_buf[i]);
-av_buffer_unref(>ref_index_buf[i]);
-}
+free_picture_tables(pic);
+ff_mpeg_unref_picture(avctx, pic);
+av_frame_free(>f);
 }
diff --git a/libavcodec/mpegpicture.h b/libavcodec/mpegpicture.h
index a354c2a83c..cee16c07d3 100644
--- a/libavcodec/mpegpicture.h
+++ b/libavcodec/mpegpicture.h
@@ -108,7 +108,7 @@ int ff_mpeg_framesize_alloc(AVCodecContext *avctx, 
MotionEstContext *me,
 int ff_mpeg_ref_picture(AVCodecContext *avctx, Picture *dst, Picture *src);
 void ff_mpeg_unref_picture(AVCodecContext *avctx, Picture *picture);
 
-void ff_free_picture_tables(Picture *pic);
+void ff_free_picture(AVCodecContext *avctx, Picture *pic);
 int ff_update_picture_tables(Picture *dst, Picture *src);
 
 int ff_find_unused_picture(AVCodecContext *avctx, Picture *picture, int 
shared);
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 3b889e0791..7c63c738f3 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -874,8 +874,6 @@ void ff_mpv_free_context_frame(MpegEncContext *s)
 /* init common structure for both encoder and decoder */
 void ff_mpv_common_end(MpegEncContext *s)
 {
-int i;
-
 if (!s)
 return;
 
@@ -895,25 +893,14 @@ void ff_mpv_common_end(MpegEncContext *s)
 return;
 
 if (s->picture) {
-for (i = 0; i < MAX_PICTURE_COUNT; i++) {
-ff_free_picture_tables(>picture[i]);
-ff_mpeg_unref_picture(s->avctx, >picture[i]);
-av_frame_free(>picture[i].f);
-}
+for (int i = 0; i < MAX_PICTURE_COUNT; i++)
+ff_free_picture(s->avctx, 

[FFmpeg-devel] [PATCH 29/33] avcodec/mpegpicture: Let ff_mpeg_unref_picture() free picture tables

2022-01-26 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/mpegpicture.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c
index 0652b7c879..f78a3c23e3 100644
--- a/libavcodec/mpegpicture.c
+++ b/libavcodec/mpegpicture.c
@@ -290,7 +290,8 @@ fail:
 }
 
 /**
- * Deallocate a picture.
+ * Deallocate a picture; frees the picture tables in case they
+ * need to be reallocated anyway.
  */
 void ff_mpeg_unref_picture(AVCodecContext *avctx, Picture *pic)
 {
@@ -443,8 +444,6 @@ int ff_find_unused_picture(AVCodecContext *avctx, Picture 
*picture, int shared)
 
 if (ret >= 0 && ret < MAX_PICTURE_COUNT) {
 if (picture[ret].needs_realloc) {
-picture[ret].needs_realloc = 0;
-ff_free_picture_tables([ret]);
 ff_mpeg_unref_picture(avctx, [ret]);
 }
 }
-- 
2.32.0

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

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


[FFmpeg-devel] [PATCH 28/33] avcodec/mpegvideo: Move MPEG-4 Simple Studio Profile fields to mpeg4video

2022-01-26 Thread Andreas Rheinhardt
This is possible now that dealing with the Simple Studio Profile
has been moved to mpeg4videodec.c. It also allows to avoid
allocations, because one can simply put the required buffers
on the context (if one made these buffers part of MpegEncContext,
the memory would be wasted for every codec other than MPEG-4).

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/mpeg4video.h|  5 +
 libavcodec/mpeg4videodec.c | 44 --
 libavcodec/mpegvideo.c | 13 ---
 libavcodec/mpegvideo.h |  4 
 4 files changed, 28 insertions(+), 38 deletions(-)

diff --git a/libavcodec/mpeg4video.h b/libavcodec/mpeg4video.h
index 08beb7f29f..9fc79b1a22 100644
--- a/libavcodec/mpeg4video.h
+++ b/libavcodec/mpeg4video.h
@@ -117,6 +117,11 @@ typedef struct Mpeg4DecContext {
 int cplx_estimation_trash_b;
 
 int rgb;
+
+int32_t block32[12][64];
+// 0 = DCT, 1 = DPCM top to bottom scan, -1 = DPCM bottom to top scan
+int dpcm_direction;
+int16_t dpcm_macroblock[3][256];
 } Mpeg4DecContext;
 
 
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index fb43ad2d17..b8118ff2d2 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -71,32 +71,33 @@ void ff_mpeg4_decode_studio(MpegEncContext *s, uint8_t 
*dest_y, uint8_t *dest_cb
 uint8_t *dest_cr, int block_size, int uvlinesize,
 int dct_linesize, int dct_offset)
 {
+Mpeg4DecContext *const ctx = (Mpeg4DecContext*)s;
 const int act_block_size = block_size * 2;
 
-if (s->dpcm_direction == 0) {
-s->idsp.idct_put(dest_y,   dct_linesize, 
(int16_t*)(*s->block32)[0]);
-s->idsp.idct_put(dest_y  + act_block_size, dct_linesize, 
(int16_t*)(*s->block32)[1]);
-s->idsp.idct_put(dest_y + dct_offset,  dct_linesize, 
(int16_t*)(*s->block32)[2]);
-s->idsp.idct_put(dest_y + dct_offset + act_block_size, dct_linesize, 
(int16_t*)(*s->block32)[3]);
+if (ctx->dpcm_direction == 0) {
+s->idsp.idct_put(dest_y,   dct_linesize, 
(int16_t*)ctx->block32[0]);
+s->idsp.idct_put(dest_y  + act_block_size, dct_linesize, 
(int16_t*)ctx->block32[1]);
+s->idsp.idct_put(dest_y + dct_offset,  dct_linesize, 
(int16_t*)ctx->block32[2]);
+s->idsp.idct_put(dest_y + dct_offset + act_block_size, dct_linesize, 
(int16_t*)ctx->block32[3]);
 
 dct_linesize = uvlinesize << s->interlaced_dct;
 dct_offset   = s->interlaced_dct ? uvlinesize : uvlinesize*block_size;
 
-s->idsp.idct_put(dest_cb,  dct_linesize, 
(int16_t*)(*s->block32)[4]);
-s->idsp.idct_put(dest_cr,  dct_linesize, 
(int16_t*)(*s->block32)[5]);
-s->idsp.idct_put(dest_cb + dct_offset, dct_linesize, 
(int16_t*)(*s->block32)[6]);
-s->idsp.idct_put(dest_cr + dct_offset, dct_linesize, 
(int16_t*)(*s->block32)[7]);
+s->idsp.idct_put(dest_cb,  dct_linesize, 
(int16_t*)ctx->block32[4]);
+s->idsp.idct_put(dest_cr,  dct_linesize, 
(int16_t*)ctx->block32[5]);
+s->idsp.idct_put(dest_cb + dct_offset, dct_linesize, 
(int16_t*)ctx->block32[6]);
+s->idsp.idct_put(dest_cr + dct_offset, dct_linesize, 
(int16_t*)ctx->block32[7]);
 if (!s->chroma_x_shift){ //Chroma444
-s->idsp.idct_put(dest_cb + act_block_size,  
dct_linesize, (int16_t*)(*s->block32)[8]);
-s->idsp.idct_put(dest_cr + act_block_size,  
dct_linesize, (int16_t*)(*s->block32)[9]);
-s->idsp.idct_put(dest_cb + act_block_size + dct_offset, 
dct_linesize, (int16_t*)(*s->block32)[10]);
-s->idsp.idct_put(dest_cr + act_block_size + dct_offset, 
dct_linesize, (int16_t*)(*s->block32)[11]);
+s->idsp.idct_put(dest_cb + act_block_size,  
dct_linesize, (int16_t*)ctx->block32[8]);
+s->idsp.idct_put(dest_cr + act_block_size,  
dct_linesize, (int16_t*)ctx->block32[9]);
+s->idsp.idct_put(dest_cb + act_block_size + dct_offset, 
dct_linesize, (int16_t*)ctx->block32[10]);
+s->idsp.idct_put(dest_cr + act_block_size + dct_offset, 
dct_linesize, (int16_t*)ctx->block32[11]);
 }
-} else if(s->dpcm_direction == 1) {
+} else if (ctx->dpcm_direction == 1) {
 uint16_t *dest_pcm[3] = {(uint16_t*)dest_y, (uint16_t*)dest_cb, 
(uint16_t*)dest_cr};
 int linesize[3] = {dct_linesize, uvlinesize, uvlinesize};
 for (int i = 0; i < 3; i++) {
-const uint16_t *src = (*s->dpcm_macroblock)[i];
+const uint16_t *src = ctx->dpcm_macroblock[i];
 int vsub = i ? s->chroma_y_shift : 0;
 int hsub = i ? s->chroma_x_shift : 0;
 int lowres = s->avctx->lowres;
@@ -111,9 +112,9 @@ void ff_mpeg4_decode_studio(MpegEncContext *s, uint8_t 
*dest_y, uint8_t 

[FFmpeg-devel] [PATCH 27/33] avcodec/mpegvideo: Move handling Simple Studio Profile to mpeg4videodec

2022-01-26 Thread Andreas Rheinhardt
This is its only user.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/mpeg4video.h|  4 +++
 libavcodec/mpeg4videodec.c | 62 +++
 libavcodec/mpegvideo.c | 66 +++---
 3 files changed, 71 insertions(+), 61 deletions(-)

diff --git a/libavcodec/mpeg4video.h b/libavcodec/mpeg4video.h
index fd6b6f2863..08beb7f29f 100644
--- a/libavcodec/mpeg4video.h
+++ b/libavcodec/mpeg4video.h
@@ -119,6 +119,10 @@ typedef struct Mpeg4DecContext {
 int rgb;
 } Mpeg4DecContext;
 
+
+void ff_mpeg4_decode_studio(MpegEncContext *s, uint8_t *dest_y, uint8_t 
*dest_cb,
+uint8_t *dest_cr, int block_size, int uvlinesize,
+int dct_linesize, int dct_offset);
 void ff_mpeg4_encode_mb(MpegEncContext *s,
 int16_t block[6][64],
 int motion_x, int motion_y);
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index bdd320b1df..fb43ad2d17 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -67,6 +67,68 @@ static const int mb_type_b_map[4] = {
 MB_TYPE_L0  | MB_TYPE_16x16,
 };
 
+void ff_mpeg4_decode_studio(MpegEncContext *s, uint8_t *dest_y, uint8_t 
*dest_cb,
+uint8_t *dest_cr, int block_size, int uvlinesize,
+int dct_linesize, int dct_offset)
+{
+const int act_block_size = block_size * 2;
+
+if (s->dpcm_direction == 0) {
+s->idsp.idct_put(dest_y,   dct_linesize, 
(int16_t*)(*s->block32)[0]);
+s->idsp.idct_put(dest_y  + act_block_size, dct_linesize, 
(int16_t*)(*s->block32)[1]);
+s->idsp.idct_put(dest_y + dct_offset,  dct_linesize, 
(int16_t*)(*s->block32)[2]);
+s->idsp.idct_put(dest_y + dct_offset + act_block_size, dct_linesize, 
(int16_t*)(*s->block32)[3]);
+
+dct_linesize = uvlinesize << s->interlaced_dct;
+dct_offset   = s->interlaced_dct ? uvlinesize : uvlinesize*block_size;
+
+s->idsp.idct_put(dest_cb,  dct_linesize, 
(int16_t*)(*s->block32)[4]);
+s->idsp.idct_put(dest_cr,  dct_linesize, 
(int16_t*)(*s->block32)[5]);
+s->idsp.idct_put(dest_cb + dct_offset, dct_linesize, 
(int16_t*)(*s->block32)[6]);
+s->idsp.idct_put(dest_cr + dct_offset, dct_linesize, 
(int16_t*)(*s->block32)[7]);
+if (!s->chroma_x_shift){ //Chroma444
+s->idsp.idct_put(dest_cb + act_block_size,  
dct_linesize, (int16_t*)(*s->block32)[8]);
+s->idsp.idct_put(dest_cr + act_block_size,  
dct_linesize, (int16_t*)(*s->block32)[9]);
+s->idsp.idct_put(dest_cb + act_block_size + dct_offset, 
dct_linesize, (int16_t*)(*s->block32)[10]);
+s->idsp.idct_put(dest_cr + act_block_size + dct_offset, 
dct_linesize, (int16_t*)(*s->block32)[11]);
+}
+} else if(s->dpcm_direction == 1) {
+uint16_t *dest_pcm[3] = {(uint16_t*)dest_y, (uint16_t*)dest_cb, 
(uint16_t*)dest_cr};
+int linesize[3] = {dct_linesize, uvlinesize, uvlinesize};
+for (int i = 0; i < 3; i++) {
+const uint16_t *src = (*s->dpcm_macroblock)[i];
+int vsub = i ? s->chroma_y_shift : 0;
+int hsub = i ? s->chroma_x_shift : 0;
+int lowres = s->avctx->lowres;
+int step = 1 << lowres;
+for (int h = 0; h < (16 >> (vsub + lowres)); h++){
+for (int w = 0, idx = 0; w < (16 >> (hsub + lowres)); w++, idx 
+= step)
+dest_pcm[i][w] = src[idx];
+dest_pcm[i] += linesize[i] / 2;
+src += (16 >> hsub) * step;
+}
+}
+} else {
+uint16_t *dest_pcm[3] = {(uint16_t*)dest_y, (uint16_t*)dest_cb, 
(uint16_t*)dest_cr};
+int linesize[3] = {dct_linesize, uvlinesize, uvlinesize};
+av_assert2(s->dpcm_direction == -1);
+for (int i = 0; i < 3; i++) {
+const uint16_t *src = (*s->dpcm_macroblock)[i];
+int vsub = i ? s->chroma_y_shift : 0;
+int hsub = i ? s->chroma_x_shift : 0;
+int lowres = s->avctx->lowres;
+int step = 1 << lowres;
+dest_pcm[i] += (linesize[i] / 2) * ((16 >> vsub) - 1);
+for (int h = (16 >> (vsub + lowres)) - 1; h >= 0; h--){
+for (int w = (16 >> (hsub + lowres)) - 1, idx = 0; w >= 0; 
w--, idx += step)
+dest_pcm[i][w] = src[idx];
+src += step * (16 >> hsub);
+dest_pcm[i] -= linesize[i] / 2;
+}
+}
+}
+}
+
 /**
  * Predict the ac.
  * @param n block index (0-3 are luma, 4-5 are chroma)
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 40494fe115..a231ee52b7 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -40,6 +40,7 @@
 #include "mpeg_er.h"
 #include "mpegutils.h"
 #include 

[FFmpeg-devel] [PATCH 26/33] fate/mpeg4: Add test for MPEG-4 Simple Studio Profile

2022-01-26 Thread Andreas Rheinhardt
The sample mpeg4/mpeg4_sstp_dpcm.m4v existed in the FATE-suite,
but it was surprisingly unused.

Signed-off-by: Andreas Rheinhardt 
---
Will hopefully work on all arches.

 tests/fate/mpeg4.mak   | 5 +
 tests/ref/fate/mpeg4-simple-studio-profile | 6 ++
 2 files changed, 11 insertions(+)
 create mode 100644 tests/ref/fate/mpeg4-simple-studio-profile

diff --git a/tests/fate/mpeg4.mak b/tests/fate/mpeg4.mak
index 26007f82f0..05c26b9be5 100644
--- a/tests/fate/mpeg4.mak
+++ b/tests/fate/mpeg4.mak
@@ -11,6 +11,11 @@ FATE_MPEG4-$(call ALLYES, AVI_DEMUXER 
MPEG4_UNPACK_BFRAMES_BSF AVI_MUXER) += fat
 fate-mpeg4-packed: CMD = framecrc -flags +bitexact -idct simple -i 
$(TARGET_SAMPLES)/mpeg4/packed_bframes.avi -flags +bitexact -fflags +bitexact 
-vsync cfr
 FATE_MPEG4-$(call ALLYES, AVI_DEMUXER MPEG4_DECODER) += fate-mpeg4-packed
 
+FATE_MPEG4-$(call ALLYES, FILE_PROTOCOL M4V_DEMUXER MPEG4_DECODER SCALE_FILTER 
\
+  RAWVIDEO_ENCODER FRAMECRC_MUXER PIPE_PROTOCOL) \
+  += fate-mpeg4-simple-studio-profile
+fate-mpeg4-simple-studio-profile: CMD = framecrc -bitexact -idct simple -i 
$(TARGET_SAMPLES)/mpeg4/mpeg4_sstp_dpcm.m4v -sws_flags +accurate_rnd+bitexact 
-pix_fmt yuv422p10le -vf scale
+
 FATE_MPEG4-$(call DEMDEC, M4V, MPEG4) += fate-m4v  fate-m4v-cfr
 fate-m4v: CMD = framecrc -flags +bitexact -idct simple -i 
$(TARGET_SAMPLES)/mpeg4/demo.m4v
 fate-m4v-cfr: CMD = framecrc -flags +bitexact -idct simple -i 
$(TARGET_SAMPLES)/mpeg4/demo.m4v -vf fps=5
diff --git a/tests/ref/fate/mpeg4-simple-studio-profile 
b/tests/ref/fate/mpeg4-simple-studio-profile
new file mode 100644
index 00..303265ae1a
--- /dev/null
+++ b/tests/ref/fate/mpeg4-simple-studio-profile
@@ -0,0 +1,6 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 720x480
+#sar 0: 1/1
+0,  0,  0,1,  1382400, 0x3d252879
-- 
2.32.0

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

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


[FFmpeg-devel] [PATCH 25/33] avcodec/mpegvideo: Fix crash when using lowres with 10bit MPEG-4

2022-01-26 Thread Andreas Rheinhardt
In this case the macroblocks written to are smaller, yet
the MPEG-4 Simple Studio Profile code for 10bit DPCM ignored this;
e.g. in case of lowres = 2 or = 3, the sample mpeg4_sstp_dpcm.m4v
from the FATE-suite reads beyond the end of the buffer.

This commit fixes this by taking lowres into account.
The DPCM macroblocks of the aforementioned sample look
as good as can be expected after this patch; yet the non-DPCM
coded macroblocks are simply corrupt.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/mpegvideo.c | 20 ++--
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 47603c2991..40494fe115 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1629,13 +1629,17 @@ void mpv_reconstruct_mb_internal(MpegEncContext *s, 
int16_t block[12][64],
 uint16_t *dest_pcm[3] = {(uint16_t*)dest_y, 
(uint16_t*)dest_cb, (uint16_t*)dest_cr};
 int linesize[3] = {dct_linesize, uvlinesize, uvlinesize};
 for(i = 0; i < 3; i++) {
+const int16_t *src = (*s->dpcm_macroblock)[i];
 int idx = 0;
 int vsub = i ? s->chroma_y_shift : 0;
 int hsub = i ? s->chroma_x_shift : 0;
-for(h = 0; h < (16 >> vsub); h++){
-for(w = 0; w < (16 >> hsub); w++)
-dest_pcm[i][w] = 
(*s->dpcm_macroblock)[i][idx++];
+int lowres = lowres_flag ? s->avctx->lowres : 0;
+int step = 1 << lowres;
+for (h = 0; h < (16 >> (vsub + lowres)); h++){
+for (w = 0, idx = 0; w < (16 >> (hsub + lowres)); 
w++, idx += step)
+dest_pcm[i][w] = src[idx];
 dest_pcm[i] += linesize[i] / 2;
+src += (16 >> hsub) * step;
 }
 }
 } else {
@@ -1644,13 +1648,17 @@ void mpv_reconstruct_mb_internal(MpegEncContext *s, 
int16_t block[12][64],
 int linesize[3] = {dct_linesize, uvlinesize, uvlinesize};
 av_assert2(s->dpcm_direction == -1);
 for(i = 0; i < 3; i++) {
+const int16_t *src = (*s->dpcm_macroblock)[i];
 int idx = 0;
 int vsub = i ? s->chroma_y_shift : 0;
 int hsub = i ? s->chroma_x_shift : 0;
+int lowres = lowres_flag ? s->avctx->lowres : 0;
+int step = 1 << lowres;
 dest_pcm[i] += (linesize[i] / 2) * ((16 >> vsub) - 1);
-for (h = (16 >> vsub) - 1; h >= 0; h--) {
-for (w = (16 >> hsub) - 1; w >= 0; w--)
-dest_pcm[i][w] = 
(*s->dpcm_macroblock)[i][idx++];
+for (h = (16 >> (vsub + lowres)) - 1; h >= 0; h--){
+for (w = (16 >> (hsub + lowres)) - 1, idx = 0; w 
>= 0; w--, idx += step)
+dest_pcm[i][w] = src[idx];
+src += step * (16 >> hsub);
 dest_pcm[i] -= linesize[i] / 2;
 }
 }
-- 
2.32.0

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

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


[FFmpeg-devel] [PATCH 24/33] avcodec/mpegvideo: Fix off-by-one error when decoding >8 bit MPEG-4

2022-01-26 Thread Andreas Rheinhardt
Fixes visual corruptions on two macroblocks from two frames from
https://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket4447/A003C003_SR_422_23.98p.mxf

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

diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index e9f2fb212a..47603c2991 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1648,8 +1648,8 @@ void mpv_reconstruct_mb_internal(MpegEncContext *s, 
int16_t block[12][64],
 int vsub = i ? s->chroma_y_shift : 0;
 int hsub = i ? s->chroma_x_shift : 0;
 dest_pcm[i] += (linesize[i] / 2) * ((16 >> vsub) - 1);
-for(h = (16 >> vsub)-1; h >= 1; h--){
-for(w = (16 >> hsub)-1; w >= 1; w--)
+for (h = (16 >> vsub) - 1; h >= 0; h--) {
+for (w = (16 >> hsub) - 1; w >= 0; w--)
 dest_pcm[i][w] = 
(*s->dpcm_macroblock)[i][idx++];
 dest_pcm[i] -= linesize[i] / 2;
 }
-- 
2.32.0

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

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


[FFmpeg-devel] [PATCH 23/33] avcodec/mpegvideo_enc: Don't hardcode list of codecs supporting bframes

2022-01-26 Thread Andreas Rheinhardt
Check for the encoder's AV_CODEC_CAP_DELAY instead.

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

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 920cb337a1..9a5634c505 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -357,10 +357,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
 }
 s->max_b_frames = avctx->max_b_frames;
 s->codec_id = avctx->codec->id;
-if (s->max_b_frames&&
-s->codec_id != AV_CODEC_ID_MPEG4  &&
-s->codec_id != AV_CODEC_ID_MPEG1VIDEO &&
-s->codec_id != AV_CODEC_ID_MPEG2VIDEO) {
+if (s->max_b_frames && !(avctx->codec->capabilities & AV_CODEC_CAP_DELAY)) 
{
 av_log(avctx, AV_LOG_ERROR, "B-frames not supported by codec\n");
 return AVERROR(EINVAL);
 }
-- 
2.32.0

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

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


[FFmpeg-devel] [PATCH 22/33] avcodec/mpegvideo_enc: Localize check for invalid number of b-frames

2022-01-26 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/mpegvideo_enc.c | 25 -
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 044c675014..920cb337a1 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -350,9 +350,21 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
 av_log(avctx, AV_LOG_ERROR, "Too many B-frames requested, maximum "
"is %d.\n", MAX_B_FRAMES);
 avctx->max_b_frames = MAX_B_FRAMES;
+} else if (avctx->max_b_frames < 0) {
+av_log(avctx, AV_LOG_ERROR,
+   "max b frames must be 0 or positive for mpegvideo based 
encoders\n");
+return AVERROR(EINVAL);
 }
 s->max_b_frames = avctx->max_b_frames;
 s->codec_id = avctx->codec->id;
+if (s->max_b_frames&&
+s->codec_id != AV_CODEC_ID_MPEG4  &&
+s->codec_id != AV_CODEC_ID_MPEG1VIDEO &&
+s->codec_id != AV_CODEC_ID_MPEG2VIDEO) {
+av_log(avctx, AV_LOG_ERROR, "B-frames not supported by codec\n");
+return AVERROR(EINVAL);
+}
+
 s->strict_std_compliance = avctx->strict_std_compliance;
 s->quarter_sample = (avctx->flags & AV_CODEC_FLAG_QPEL) != 0;
 s->rtp_mode   = !!s->rtp_payload_size;
@@ -499,19 +511,6 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
 return AVERROR(EINVAL);
 }
 
-if (s->max_b_frames&&
-s->codec_id != AV_CODEC_ID_MPEG4  &&
-s->codec_id != AV_CODEC_ID_MPEG1VIDEO &&
-s->codec_id != AV_CODEC_ID_MPEG2VIDEO) {
-av_log(avctx, AV_LOG_ERROR, "B-frames not supported by codec\n");
-return AVERROR(EINVAL);
-}
-if (s->max_b_frames < 0) {
-av_log(avctx, AV_LOG_ERROR,
-   "max b frames must be 0 or positive for mpegvideo based 
encoders\n");
-return AVERROR(EINVAL);
-}
-
 if ((s->codec_id == AV_CODEC_ID_MPEG4 ||
  s->codec_id == AV_CODEC_ID_H263  ||
  s->codec_id == AV_CODEC_ID_H263P) &&
-- 
2.32.0

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

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


Re: [FFmpeg-devel] [PATCH] Fix setsockopt IP_MULTICAST_TTL on OpenBSD

2022-01-26 Thread Marton Balint




On Wed, 26 Jan 2022, Brad Smith wrote:


On Wed, Jan 12, 2022 at 12:13:14AM -0500, Brad Smith wrote:

Fix setsockopt() usage on OpenBSD with IP_MULTICAST_TTL. The field
type should be an unsigned char on anything but Linux.


Based on feedback so far. Here is a much simpler approach to this issue..


Win32 needs DWORD unfortunately. I missed it earlier, sorry.

https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ip-socket-options

Regards,
Marton




diff --git a/libavformat/udp.c b/libavformat/udp.c
index 83c042d079..da1b98890b 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -164,7 +164,9 @@ static int udp_set_multicast_ttl(int sockfd, int mcastTTL,
{
#ifdef IP_MULTICAST_TTL
if (addr->sa_family == AF_INET) {
-if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
sizeof(mcastTTL)) < 0) {
+unsigned char ttl = mcastTTL;  /* ignore the outdated Linux 
documentation */
+
+if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , sizeof(ttl)) 
< 0) {
ff_log_net_error(logctx, AV_LOG_ERROR, 
"setsockopt(IP_MULTICAST_TTL)");
return ff_neterrno();
}
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


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

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


Re: [FFmpeg-devel] configure error: pkg not found even though it is available

2022-01-26 Thread Helmut K. C. Tessarek
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512



On 2022-01-26 03:00, Gyan Doshi wrote:
> Might there be a stale header in an cflags path with earlier precedence?

Argh, why haven't I thought of that. It was way too late for me yesterday
and apparently I couldn't think straight anymore.

Sorry for the noise. Yes, there was an old header file in the folder above.
Sometimes I wish that "make install" would take care of such things.

Once again, I am sorry.

Cheers,
 K. C.

- -- 
regards Helmut K. C. Tessarek  KeyID 0x172380A011EF4944
Key fingerprint = 8A55 70C1 BD85 D34E ADBC 386C 1723 80A0 11EF 4944

/*
   Thou shalt not follow the NULL pointer for chaos and madness
   await thee at its end.
*/
-BEGIN PGP SIGNATURE-

iQIzBAEBCgAdFiEE191csiqpm8f5Ln9WvgmFNJ1E3QAFAmHxsSoACgkQvgmFNJ1E
3QDc/Q/+KeXHbDzKEJGPvjSZvKmsnZWHdPYcNdD5N54E79SOeR98memswXTdUYuZ
f1jXNGaJ9BR2RJXahOcOW9XOfOdAZcI+f79RvIuI9lnOpfmt5y6popPMBZuovgzh
3D+h7X6oTFj6J8VtdSGgnc4MQ1Po0KPeqUYwUCsv3/Nef6DDSi3hW5sQIF/K0dyv
gAVwyrcGLW9VQqNxiPLT5CUcqElXMJnBDsRBoY8+BUt/l9CCjRMkdsIxXmP+gjvd
t5COmf7UlYeMyOy5EdFltdl/rBX22320NTLrcK3pbIY9kc16b7yVJiVVviaKQxnT
6zGmQiaxm9e88wH35/DJbI9UK9KNRneG+FOVeLByYIhF9HAltPKdGNNstSAABiIS
9ljQ6W2sz1GWXj6W7FGxt6kEEnoWQ6gQ92B4h6Y4oN/4cY4bSBEX2PHRMPTP2Xto
+FN5pPl2goFjznvZlcyJT0+MHdCSL3YoDqMP6EyiUD/JstqQL7gxWBKckkMoTs+7
PA0jfkGkyE5JZF9oGZi9ghqVfofws0K+mh3uIMulqrQv2thQ4OowyU8alF+yAI98
PKYPQmtb+o3k+iRpySlA/l8Pf5Sz+S03mrrskoPermOCPjagHSJhRjMHLrCFNWy5
pti6Whtx1TqbJQYlBTVV3nvoxtHc5dNCPs4bI9S9rk5bwxdmCUs=
=a5F4
-END 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 2/2] lavf/rtpproto: set ttl upper bound to 255

2022-01-26 Thread Zhao Zhili
---
 libavformat/rtpproto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c
index c92cda63bb..561d10c9f2 100644
--- a/libavformat/rtpproto.c
+++ b/libavformat/rtpproto.c
@@ -68,7 +68,7 @@ typedef struct RTPContext {
 #define D AV_OPT_FLAG_DECODING_PARAM
 #define E AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {
-{ "ttl","Time to live (in milliseconds, multicast only)",  
 OFFSET(ttl), AV_OPT_TYPE_INT,{ .i64 = -1 },
-1, INT_MAX, .flags = D|E },
+{ "ttl","Time to live (in milliseconds, multicast only)",  
 OFFSET(ttl), AV_OPT_TYPE_INT,{ .i64 = -1 },
-1, 255, .flags = D|E },
 { "buffer_size","Send/Receive buffer size (in bytes)", 
 OFFSET(buffer_size), AV_OPT_TYPE_INT,{ .i64 = -1 },
-1, INT_MAX, .flags = D|E },
 { "rtcp_port",  "Custom rtcp port",
 OFFSET(rtcp_port),   AV_OPT_TYPE_INT,{ .i64 = -1 },
-1, INT_MAX, .flags = D|E },
 { "local_rtpport",  "Local rtp port",  
 OFFSET(local_rtpport),   AV_OPT_TYPE_INT,{ .i64 = -1 },
-1, INT_MAX, .flags = D|E },
-- 
2.29.2

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

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


[FFmpeg-devel] [PATCH 1/2] lavf/udp: set ttl upper bound to 255

2022-01-26 Thread Zhao Zhili
---
 libavformat/udp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/udp.c b/libavformat/udp.c
index 83c042d079..b441d2ea0d 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -134,7 +134,7 @@ static const AVOption options[] = {
 { "reuse",  "explicitly allow reusing UDP sockets",
OFFSET(reuse_socket),   AV_OPT_TYPE_BOOL,   { .i64 = -1 },-1, 1,   D|E 
},
 { "reuse_socket",   "explicitly allow reusing UDP sockets",
OFFSET(reuse_socket),   AV_OPT_TYPE_BOOL,   { .i64 = -1 },-1, 1,   
.flags = D|E },
 { "broadcast", "explicitly allow or disallow broadcast destination",   
OFFSET(is_broadcast),   AV_OPT_TYPE_BOOL,   { .i64 = 0  }, 0, 1,   E },
-{ "ttl","Time to live (multicast only)",   
OFFSET(ttl),AV_OPT_TYPE_INT,{ .i64 = 16 }, 0, INT_MAX, E },
+{ "ttl","Time to live (multicast only)",   
OFFSET(ttl),AV_OPT_TYPE_INT,{ .i64 = 16 }, 0, 255, E },
 { "connect","set if connect() should be called on socket", 
OFFSET(is_connected),   AV_OPT_TYPE_BOOL,   { .i64 =  0 }, 0, 1,   
.flags = D|E },
 { "fifo_size",  "set the UDP receiving circular buffer size, expressed 
as a number of packets with size of 188 bytes", OFFSET(circular_buffer_size), 
AV_OPT_TYPE_INT, {.i64 = 7*4096}, 0, INT_MAX, D },
 { "overrun_nonfatal", "survive in case of UDP receiving circular buffer 
overrun", OFFSET(overrun_nonfatal), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1,D },
-- 
2.29.2

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

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


Re: [FFmpeg-devel] [PATCH] Fix setsockopt IP_MULTICAST_TTL on OpenBSD

2022-01-26 Thread Brad Smith
On Wed, Jan 12, 2022 at 12:13:14AM -0500, Brad Smith wrote:
> Fix setsockopt() usage on OpenBSD with IP_MULTICAST_TTL. The field
> type should be an unsigned char on anything but Linux.

Based on feedback so far. Here is a much simpler approach to this issue..


diff --git a/libavformat/udp.c b/libavformat/udp.c
index 83c042d079..da1b98890b 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -164,7 +164,9 @@ static int udp_set_multicast_ttl(int sockfd, int mcastTTL,
 {
 #ifdef IP_MULTICAST_TTL
 if (addr->sa_family == AF_INET) {
-if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
sizeof(mcastTTL)) < 0) {
+unsigned char ttl = mcastTTL;  /* ignore the outdated Linux 
documentation */
+
+if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
sizeof(ttl)) < 0) {
 ff_log_net_error(logctx, AV_LOG_ERROR, 
"setsockopt(IP_MULTICAST_TTL)");
 return ff_neterrno();
 }
___
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] Allow to recognize SCTE-35 stream in MPEG TS if Registration descriptor put on stream section instead of program. Some muxers (Harmonic for example) do it

2022-01-26 Thread Leonid V.Panoff

Signed-off-by: Leonid V.Panoff 
---
 libavformat/mpegts.c | 48 
 1 file changed, 44 insertions(+), 4 deletions(-)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 2479cb6f7d..0774b53b18 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -2301,6 +2301,42 @@ static int is_pes_stream(int stream_type, 
uint32_t prog_reg_desc)

  (stream_type == 0x86 && prog_reg_desc == AV_RL32("CUEI")) );
 }
 +static int is_scte35_descr_in_stream(const uint8_t *p, const uint8_t 
*p_end, int stream_type)

+{
+int desc_list_len, desc_tag, desc_len;
+const uint8_t *desc_list_end, *desc_end;
+
+const uint8_t *ppp = p;
+desc_list_len = get16(, p_end);
+if (desc_list_len < 0)
+return 0;
+desc_list_len &= 0xfff;
+desc_list_end = ppp + desc_list_len;
+while (desc_list_end <= p_end)
+{
+desc_tag = get8(, desc_list_end);
+if (desc_tag < 0)
+return 0;
+
+desc_len = get8(, desc_list_end);
+if (desc_len < 0)
+return 0;
+
+desc_end = ppp + desc_len;
+if (desc_end > desc_list_end)
+return 0;
+
+if (desc_tag == REGISTRATION_DESCRIPTOR)
+{
+uint32_t codec_tag = bytestream_get_le32();
+if (stream_type == 0x86 && codec_tag == AV_RL32("CUEI"))
+return 1;
+}
+ppp = desc_end;
+}
+return 0;
+}
+
 static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int 
section_len)

 {
 MpegTSContext *ts = filter->u.section_filter.opaque;
@@ -2316,6 +2352,7 @@ static void pmt_cb(MpegTSFilter *filter, const 
uint8_t *section, int section_len

 int stream_identifier = -1;
 struct Program *prg;
 +int is_scte35_hack = 0;
 int mp4_descr_count = 0;
 Mp4Descr mp4_descr[MAX_MP4_DESCR_COUNT] = { { 0 } };
 int i;
@@ -2404,6 +2441,7 @@ static void pmt_cb(MpegTSFilter *filter, const 
uint8_t *section, int section_len

 for (i = 0; i < MAX_STREAMS_PER_PROGRAM; i++) {
 st = 0;
 pes = NULL;
+
 stream_type = get8(, p_end);
 if (stream_type < 0)
 break;
@@ -2416,10 +2454,12 @@ static void pmt_cb(MpegTSFilter *filter, const 
uint8_t *section, int section_len

  stream_identifier = parse_stream_identifier_desc(p, p_end) + 1;
 +is_scte35_hack = prog_reg_desc == 0 ? 
is_scte35_descr_in_stream(p,p_end, stream_type) : 0;

+
 /* now create stream */
-if (ts->pids[pid] && ts->pids[pid]->type == MPEGTS_PES) {
+if ( ! is_scte35_hack && ts->pids[pid] && ts->pids[pid]->type 
== MPEGTS_PES) {

 pes = ts->pids[pid]->u.pes_filter.opaque;
-if (ts->merge_pmt_versions && !pes->st) {
+if (!is_scte35_hack && ts->merge_pmt_versions && !pes->st) {
 st = find_matching_stream(ts, pid, h->id, 
stream_identifier, i, _program);

 if (st) {
 pes->st = st;
@@ -2434,7 +2474,7 @@ static void pmt_cb(MpegTSFilter *filter, const 
uint8_t *section, int section_len

 pes->st->id = pes->pid;
 }
 st = pes->st;
-} else if (is_pes_stream(stream_type, prog_reg_desc)) {
+} else if (! is_scte35_hack && is_pes_stream(stream_type, 
prog_reg_desc)) {

 if (ts->pids[pid])
 mpegts_close_filter(ts, ts->pids[pid]); // wrongly 
added sdt filter probably

 pes = add_pes_stream(ts, pid, pcr_pid);
@@ -2466,7 +2506,7 @@ static void pmt_cb(MpegTSFilter *filter, const 
uint8_t *section, int section_len

 goto out;
 st->id = pid;
 st->codecpar->codec_type = AVMEDIA_TYPE_DATA;
-if (stream_type == 0x86 && prog_reg_desc == 
AV_RL32("CUEI")) {
+if (is_scte35_hack || ( stream_type == 0x86 && 
prog_reg_desc == AV_RL32("CUEI"))) {

 mpegts_find_stream_type(st, stream_type, SCTE_types);
 mpegts_open_section_filter(ts, pid, scte_data_cb, 
ts, 1);

 }
--
2.30.2

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

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


Re: [FFmpeg-devel] [PATCH v2 14/18] lavc/svq3: stop including h264dec.h

2022-01-26 Thread Andreas Rheinhardt
Anton Khirnov:
> Quoting Andreas Rheinhardt (2022-01-24 21:09:27)
>> From: Anton Khirnov 
>>
>> The only thing that is actually used directly from there is the
>> PART_NOT_AVAILABLE constant, which can be trivially copied to svq3
>> decoder itself.
>>
>> Otherwise it only depends on other indirectly included headers.
>> ---
>>  libavcodec/svq3.c | 7 ++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
>> index a3f434ff8d..f06404da9d 100644
>> --- a/libavcodec/svq3.c
>> +++ b/libavcodec/svq3.c
>> @@ -49,13 +49,16 @@
>>  #include "internal.h"
>>  #include "avcodec.h"
>>  #include "mpegutils.h"
>> -#include "h264dec.h"
>>  #include "h264data.h"
>> +#include "h264dsp.h"
>> +#include "h264pred.h"
>> +#include "h264_parse.h"
>>  #include "golomb.h"
>>  #include "hpeldsp.h"
>>  #include "mathops.h"
>>  #include "rectangle.h"
>>  #include "tpeldsp.h"
>> +#include "videodsp.h"
>>  
>>  #if CONFIG_ZLIB
>>  #include 
>> @@ -63,6 +66,8 @@
>>  
>>  #include "svq1.h"
>>  
>> +#define PART_NOT_AVAILABLE -2
> 
> Didn't you want to move it to h264pred? I'm fine with that.
> 

Yes, I wanted to so, but I didn't want to do it behind your back. Will
do now.

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

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


Re: [FFmpeg-devel] [PATCH] configure: Fix Microsoft tools detection

2022-01-26 Thread Martin Storsjö

Hi,

On Sat, 22 Jan 2022, Kacper Michajłow wrote:


LLVM tools print installation path upon execution. If one uses LLVM
tools bundled with Microsoft Visual Studio installation, they would be
incorrectly detected as Microsoft's ones.

Signed-off-by: Kacper Michajłow 
---
configure | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)


While the patch description seems to make sense, I wanted to try it out to 
see the practical effect for myself, and I fail to observe any difference.


Can you provide your exact configure command line you use, where it makes 
a difference? I tried with "--cc=clang-cl --ld=lld-link --toolchain=msvc" 
and that works just as fine before this patch.


In particular, the commands that you adjust run "$_cc -nologo-" and grep 
for "Microsoft" in the output of that. When I run that with clang-cl, it 
doesn't print a string containing "Microsoft".


// Martin
___
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 045/281] dash: convert to new channel layout API

2022-01-26 Thread Anton Khirnov
Quoting James Almer (2022-01-13 02:50:07)
> From: Vittorio Giovara 
> 
> Signed-off-by: Vittorio Giovara 
> Signed-off-by: James Almer 
> ---
>  libavformat/dashenc.c | 2 +-
>  libavformat/dauddec.c | 3 +--
>  libavformat/daudenc.c | 2 +-

The latter two don't have anything to do with dash

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

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


Re: [FFmpeg-devel] [PATCH 043/281] cdxl: convert to new channel layout API

2022-01-26 Thread Anton Khirnov
Quoting James Almer (2022-01-13 02:50:05)
> From: Vittorio Giovara 
> 
> Signed-off-by: Vittorio Giovara 
> Signed-off-by: James Almer 
> ---
>  libavformat/cdxl.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/cdxl.c b/libavformat/cdxl.c
> index c42e0d3545..76dc1d18c9 100644
> --- a/libavformat/cdxl.c
> +++ b/libavformat/cdxl.c
> @@ -171,6 +171,7 @@ static int cdxl_read_packet(AVFormatContext *s, AVPacket 
> *pkt)
>  
>  if (cdxl->read_chunk && audio_size) {
>  if (cdxl->audio_stream_index == -1) {
> +int channels = !!(cdxl->header[1] & 0x10) + 1;

redundant after cba716f55e79ebb2db9627c6e3e11d6fc77ae737

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

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


Re: [FFmpeg-devel] [PATCH 027/281] apc: convert to new channel layout API

2022-01-26 Thread Anton Khirnov
Quoting James Almer (2022-01-13 02:49:49)
> From: Vittorio Giovara 
> 
> Signed-off-by: Vittorio Giovara 
> Signed-off-by: James Almer 
> ---
>  libavformat/apc.c | 12 
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/libavformat/apc.c b/libavformat/apc.c
> index 56151bb59a..192e115278 100644
> --- a/libavformat/apc.c
> +++ b/libavformat/apc.c
> @@ -38,6 +38,7 @@ static int apc_read_header(AVFormatContext *s)
>  AVIOContext *pb = s->pb;
>  AVStream *st;
>  int ret;
> +int channels;
>  
>  avio_rl32(pb); /* CRYO */
>  avio_rl32(pb); /* _APC */
> @@ -57,16 +58,11 @@ static int apc_read_header(AVFormatContext *s)
>  if ((ret = ff_get_extradata(s, st->codecpar, pb, 2 * 4)) < 0)
>  return ret;
>  
> -if (avio_rl32(pb)) {
> -st->codecpar->channels   = 2;
> -st->codecpar->channel_layout = AV_CH_LAYOUT_STEREO;
> -} else {
> -st->codecpar->channels   = 1;
> -st->codecpar->channel_layout = AV_CH_LAYOUT_MONO;
> -}
> +channels = avio_rl32(pb) + 1;

This changes behavior in case the value read is > 1. No idea if that
ever happens, but still better make it !!avio_rl32.

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

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


Re: [FFmpeg-devel] [PATCH] configure: link to libatomic when it's present

2022-01-26 Thread Anton Khirnov
Quoting Brad Smith (2022-01-23 20:40:30)
> 
> Testing this commit out it does as I had suspected and even with --as-needed
> causes a false positive on OpenBSD / FreeBSD.

Why?

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

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


Re: [FFmpeg-devel] [PATCH] libavutil: include assembly with full path from source root

2022-01-26 Thread Alexander Kanavin
Ping :-)

Alex

On Tue, 18 Jan 2022 at 23:06, Alexander Kanavin 
wrote:

> From: Alexander Kanavin 
>
> Otherwise nasm writes the full host-specific paths into .o
> output, which breaks binary reproducibility.
>
> Signed-off-by: Alexander Kanavin 
> ---
>  libavutil/x86/cpuid.asm  | 2 +-
>  libavutil/x86/emms.asm   | 2 +-
>  libavutil/x86/fixed_dsp.asm  | 2 +-
>  libavutil/x86/float_dsp.asm  | 2 +-
>  libavutil/x86/lls.asm| 2 +-
>  libavutil/x86/pixelutils.asm | 2 +-
>  libavutil/x86/tx_float.asm   | 2 +-
>  7 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/libavutil/x86/cpuid.asm b/libavutil/x86/cpuid.asm
> index c3f7866ec7..766f77fcdf 100644
> --- a/libavutil/x86/cpuid.asm
> +++ b/libavutil/x86/cpuid.asm
> @@ -21,7 +21,7 @@
>  ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301 USA
>
>  
> ;**
>
> -%include "x86util.asm"
> +%include "libavutil/x86/x86util.asm"
>
>  SECTION .text
>
> diff --git a/libavutil/x86/emms.asm b/libavutil/x86/emms.asm
> index 8611762d73..df84f2221b 100644
> --- a/libavutil/x86/emms.asm
> +++ b/libavutil/x86/emms.asm
> @@ -18,7 +18,7 @@
>  ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301 USA
>
>  
> ;**
>
> -%include "x86util.asm"
> +%include "libavutil/x86/x86util.asm"
>
>  SECTION .text
>
> diff --git a/libavutil/x86/fixed_dsp.asm b/libavutil/x86/fixed_dsp.asm
> index 979dd5c334..2f411850f4 100644
> --- a/libavutil/x86/fixed_dsp.asm
> +++ b/libavutil/x86/fixed_dsp.asm
> @@ -20,7 +20,7 @@
>  ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301 USA
>
>  
> ;**
>
> -%include "x86util.asm"
> +%include "libavutil/x86/x86util.asm"
>
>  SECTION .text
>
> diff --git a/libavutil/x86/float_dsp.asm b/libavutil/x86/float_dsp.asm
> index 517fd63638..b773e61a64 100644
> --- a/libavutil/x86/float_dsp.asm
> +++ b/libavutil/x86/float_dsp.asm
> @@ -20,7 +20,7 @@
>  ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301 USA
>
>  
> ;**
>
> -%include "x86util.asm"
> +%include "libavutil/x86/x86util.asm"
>
>  SECTION_RODATA 32
>  pd_reverse: dd 7, 6, 5, 4, 3, 2, 1, 0
> diff --git a/libavutil/x86/lls.asm b/libavutil/x86/lls.asm
> index 317fba6fca..d2526d1ff4 100644
> --- a/libavutil/x86/lls.asm
> +++ b/libavutil/x86/lls.asm
> @@ -20,7 +20,7 @@
>  ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301 USA
>
>  
> ;**
>
> -%include "x86util.asm"
> +%include "libavutil/x86/x86util.asm"
>
>  SECTION .text
>
> diff --git a/libavutil/x86/pixelutils.asm b/libavutil/x86/pixelutils.asm
> index 36c57c5f7f..8b45ead78b 100644
> --- a/libavutil/x86/pixelutils.asm
> +++ b/libavutil/x86/pixelutils.asm
> @@ -21,7 +21,7 @@
>  ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301 USA
>
>  
> ;**
>
> -%include "x86util.asm"
> +%include "libavutil/x86/x86util.asm"
>
>  SECTION .text
>
> diff --git a/libavutil/x86/tx_float.asm b/libavutil/x86/tx_float.asm
> index 4d2283fae1..ea39f2172a 100644
> --- a/libavutil/x86/tx_float.asm
> +++ b/libavutil/x86/tx_float.asm
> @@ -29,7 +29,7 @@
>  ;   replace some shuffles with vblends?
>  ;   avx512 split-radix
>
> -%include "x86util.asm"
> +%include "libavutil/x86/x86util.asm"
>
>  %if ARCH_X86_64
>  %define ptr resq
> --
> 2.20.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] fix bs2b parameter description

2022-01-26 Thread Yue Wang
Hi Gyan

The reference is bs2b's header file available here:
https://sourceforge.net/p/bs2b/code/HEAD/tree/trunk/libbs2b/src/bs2b.h

Between line 102-112, particularly these two APIs:

/* Sets a new coefficients by new cut frecuency value (Hz). */
void bs2b_set_level_fcut( t_bs2bdp bs2bdp, int fcut );

and

/* Sets a new coefficients by new crossfeeding level value (dB * 10). */
void bs2b_set_level_feed( t_bs2bdp bs2bdp, int feed );

which correspond to the following two parameters in ffmpeg:

-  "fcut", "Set cut frequency (in Hz)",
-  "feed", "Set feed level (in db * 10)",

Yue
___
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 01/18] avcodec/h264dec: Move find_start_code() to its only user

2022-01-26 Thread Anton Khirnov
Patchset LGMT, except for the trivial comments I sent.
-- 
Anton Khirnov
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH v2 14/18] lavc/svq3: stop including h264dec.h

2022-01-26 Thread Anton Khirnov
Quoting Andreas Rheinhardt (2022-01-24 21:09:27)
> From: Anton Khirnov 
> 
> The only thing that is actually used directly from there is the
> PART_NOT_AVAILABLE constant, which can be trivially copied to svq3
> decoder itself.
> 
> Otherwise it only depends on other indirectly included headers.
> ---
>  libavcodec/svq3.c | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
> index a3f434ff8d..f06404da9d 100644
> --- a/libavcodec/svq3.c
> +++ b/libavcodec/svq3.c
> @@ -49,13 +49,16 @@
>  #include "internal.h"
>  #include "avcodec.h"
>  #include "mpegutils.h"
> -#include "h264dec.h"
>  #include "h264data.h"
> +#include "h264dsp.h"
> +#include "h264pred.h"
> +#include "h264_parse.h"
>  #include "golomb.h"
>  #include "hpeldsp.h"
>  #include "mathops.h"
>  #include "rectangle.h"
>  #include "tpeldsp.h"
> +#include "videodsp.h"
>  
>  #if CONFIG_ZLIB
>  #include 
> @@ -63,6 +66,8 @@
>  
>  #include "svq1.h"
>  
> +#define PART_NOT_AVAILABLE -2

Didn't you want to move it to h264pred? I'm fine with that.

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

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


Re: [FFmpeg-devel] [PATCH v2 04/18] lavc/h264dec.h: Move MMCOOpcode to h264_parse.h

2022-01-26 Thread Anton Khirnov
Quoting Andreas Rheinhardt (2022-01-24 21:09:17)
> From: Anton Khirnov 
> 
> Both parser and decoder use these, so h264_parse is the proper place for
  ^
  it

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

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


Re: [FFmpeg-devel] avformat/mkv: add mkv tags for AVS2 and AVS3 codecs.

2022-01-26 Thread Ze Yuan
Let’s merge it.
___
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 v1 1/9] lavu/pix_fmt: add P012 pixel format

2022-01-26 Thread Xiang, Haihao
On Sun, 2022-01-23 at 01:06 +0100, Carl Eugen Hoyos wrote:
> Am Fr., 21. Jan. 2022 um 06:56 Uhr schrieb Xiang, Haihao
> :
> > 
> > > -Original Message-
> > > From: ffmpeg-devel  On Behalf Of Xiang,
> > > Haihao
> > > Sent: Tuesday, June 30, 2020 15:34
> > > To: ffmpeg-devel@ffmpeg.org
> > > Subject: Re: [FFmpeg-devel] [PATCH v1 1/9] lavu/pix_fmt: add P012 pixel
> > > format
> > > 
> > > > Am So., 28. Juni 2020 um 23:01 Uhr schrieb Mark Thompson 
> > > > :
> > > > 
> > > > > FFmpeg has always used pixfmt as defining both the memory layout
> > > > > and which bits are used in that (so, for example, ARGB and 0RGB
> > > > > are not the same thing)
> > > > 
> > > > But they have the same bitdepth per component...
> > > Agree with Mark. P012 and P016 have different significant bits, we should
> > > use
> > > different pixfmts, otherwise an extra field in AVFrame is needed for bit
> > > depth.
> > > 
> > > BTW there are the YUV420P variants for 10 / 12 / 14 / 16 bit in FFmpeg, it
> > > would be better to follow FFmpeg's style to introduce P012 format instead
> > > of reusing P016.
> 
> I was under the impression that YUV420P12 is much more different from
> YUV420P16 than P012 from P016: Did I misunderstand?
> (Reading the thread again, I don't think I did)

I understand YUV420P12 is a LSB format, so YUV420P12 can't be taken
as YUV420P16. The style here means FFmpeg uses pixfmt for both memory layout and
bit depth. 

> 
> > Sorry for picking up this old thread.
> > 
> > We'd like to add the support for 12bit decoding / encoding in VAAPI and QSV.
> > Is there any other concern if adding P012 in FFmpeg ?
> 
> Did you already explain why you cannot use P016 or in which situation
> it would create a different output?

$ ffmpeg -hwaccel vaapi -f rawvideo -pix_fmt p016 -s 1920x1080 -i input.yuv -vf
"hwupload,format=vaapi" -c:v hevc_vaapi -f null -

If using P016, how will we know the input is 12bit indeed, not 14/16bit if
hevc_vaapi may support both 12bit and 14/16bit inputs in the future ? Will we
add a new option to ffmpeg to specify the bit depth and a new flag in AVFrame ?

Thanks
Haihao

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

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


Re: [FFmpeg-devel] configure error: pkg not found even though it is available

2022-01-26 Thread Gyan Doshi



On 2022-01-26 01:27 pm, Helmut K. C. Tessarek wrote:


On 2022-01-26 02:36, Gyan Doshi wrote:
> Confirm that /Users/Shared/ffmpeg/sw/include/libvmaf  has current header
> which declares vmaf_init()

Yes, the header file exists in the directory and the function 
vmaf_init() is

declared.

The vmaf version commit hash is aa1dd0b3. I compiled this version right
before ffmpeg and all libvmaf files have the correct timestamp (todays).


Might there be a stale header in an cflags path with earlier precedence?

Regards,
Gyan
___
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".