Re: [FFmpeg-devel] [PATCH 2/5] avutil/log: factorize ansi_fputs

2020-02-03 Thread Michael Niedermayer
On Sun, Feb 02, 2020 at 10:15:31PM +0100, Marton Balint wrote:
> Signed-off-by: Marton Balint 
> ---
>  libavutil/log.c | 41 +++--
>  1 file changed, 23 insertions(+), 18 deletions(-)

LGTM

thx

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

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus


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

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

Re: [FFmpeg-devel] [PATCH] avfilter/vf_ssim: improve precision

2020-02-03 Thread Paul B Mahol
Will apply soon.

On 1/31/20, Paul B Mahol  wrote:
> Use doubles for accumulating floats.
>
> Signed-off-by: Paul B Mahol 
> ---
>  libavfilter/ssim.h|  2 +-
>  libavfilter/vf_ssim.c | 18 +--
>  libavfilter/x86/vf_ssim.asm   | 36 ++
>  libavfilter/x86/vf_ssim_init.c|  2 +-
>  tests/ref/fate/filter-refcmp-ssim-rgb | 44 +--
>  tests/ref/fate/filter-refcmp-ssim-yuv | 26 
>  6 files changed, 70 insertions(+), 58 deletions(-)
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 2/2] avformat/udp: cancel pending IO on win32 manually

2020-02-03 Thread Mark Himsley
On Sun, 26 Jan 2020 at 21:22, Marton Balint  wrote:
>
> recvfrom() is not a cancellation point in pthreads-win32, see
> https://sourceware.org/pthreads-win32/manual/pthread_cancel.html
>
> In order to be able to cancel the reader thread on Win32 properly we first
> shutdown the socket then call CancelIoEx to abort pending IO. Subsequent
> recvfrom() calls will fail with WSAESHUTDOWN causing the thread to exit.
>
> Fixes ticket #5717.
>
> Signed-off-by: Marton Balint 
> ---
>  libavformat/udp.c | 11 ++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/udp.c b/libavformat/udp.c
> index 85c9e3a900..23c3773c64 100644
> --- a/libavformat/udp.c
> +++ b/libavformat/udp.c
> @@ -1069,8 +1069,17 @@ static int udp_close(URLContext *h)
>  if (s->thread_started) {
>  int ret;
>  // Cancel only read, as write has been signaled as success to the 
> user
> -if (h->flags & AVIO_FLAG_READ)
> +if (h->flags & AVIO_FLAG_READ) {
> +#ifdef _WIN32
> +/* recvfrom() is not a cancellation point for win32, so we 
> shutdown
> + * the socket and abort pending IO, subsequent recvfrom() calls
> + * will fail with WSAESHUTDOWN causing the thread to exit. */
> +shutdown(s->udp_fd, SD_RECEIVE);
> +CancelIoEx((HANDLE)(SOCKET)s->udp_fd, NULL);
> +#else
>  pthread_cancel(s->circular_buffer_thread);
> +#endif
> +}
>  ret = pthread_join(s->circular_buffer_thread, NULL);
>  if (ret != 0)
>  av_log(h, AV_LOG_ERROR, "pthread_join(): %s\n", strerror(ret));
> --
> 2.16.4

This was applied as 53aa76686e7ff4f1f6625502503d7923cec8c10e, but that
commit fails to compile in my mingw cross-compile build.


x86_64-w64-mingw32-gcc -I. -I./ --static -DPTW32_STATIC_LIB
-D_WIN32_WINNT=0x0501 -I/opt/ffbuild/include -D_ISOC99_SOURCE
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U__STRICT_ANSI__
-D__USE_MINGW_ANSI_STDIO=1 -D__printf__=__gnu_printf__
-D_WIN32_WINNT=0x0600 -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
-DPIC -DOPJ_STATIC -DZLIB_CONST -DHAVE_AV_CONFIG_H -DBUILDING_avformat
--static -DPTW32_STATIC_LIB -D_WIN32_WINNT=0x0501
-I/opt/ffbuild/include  --static -DPTW32_STATIC_LIB
-D_WIN32_WINNT=0x0501 -std=c11 -fomit-frame-pointer -pthread
-I/opt/ffbuild/include -I/opt/ffbuild/include -I/opt/ffbuild/include
-I/opt/ffbuild/include/openjpeg-2.3 -I/opt/ffbuild/include/opus
-I/opt/ffbuild/include/opus -I/opt/ffbuild/include
-I/opt/ffbuild/include -I/opt/ffbuild/include -I/opt/ffbuild/include
-I/opt/ffbuild/include -I/opt/ffbuild/include -I/opt/ffbuild/include
-I/opt/ffbuild/include -I/opt/ffbuild/include -DLIBXML_STATIC
-I/opt/ffbuild/include/libxml2 -I/opt/ffbuild/include -g
-Wdeclaration-after-statement -Wall -Wdisabled-optimization
-Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits
-Wundef -Wmissing-prototypes -Wno-pointer-to-int-cast
-Wstrict-prototypes -Wempty-body -Wno-parentheses -Wno-switch
-Wno-format-zero-length -Wno-pointer-sign -Wno-char-subscripts -O3
-fno-math-errno -fno-signed-zeros -fno-tree-vectorize
-Werror=format-security -Werror=implicit-function-declaration
-Werror=missing-prototypes -Werror=return-type -Werror=vla -Wformat
-fdiagnostics-color=auto -Wno-maybe-uninitialized  -MMD -MF
libavformat/udp.d -MT libavformat/udp.o -c -o libavformat/udp.o
libavformat/udp.c
In file included from libavformat/udp.c:65:0:
/opt/ffbuild/include/pthread.h:108:0: warning: "PTW32_LEVEL" redefined
 #define PTW32_LEVEL PTW32_LEVEL_MAX
 ^
/opt/ffbuild/include/pthread.h:95:0: note: this is the location of the
previous definition
 #define PTW32_LEVEL 1
 ^
In file included from /opt/ffbuild/include/pthread.h:299:0,
 from libavformat/udp.c:65:
/opt/ffbuild/include/sched.h:64:0: warning: "PTW32_SCHED_LEVEL" redefined
 #define PTW32_SCHED_LEVEL PTW32_SCHED_LEVEL_MAX
 ^
/opt/ffbuild/include/sched.h:51:0: note: this is the location of the
previous definition
 #define PTW32_SCHED_LEVEL 1
 ^
libavformat/udp.c: In function 'udp_close':
libavformat/udp.c:1078:13: error: implicit declaration of function
'CancelIoEx' [-Werror=implicit-function-declaration]
 CancelIoEx((HANDLE)(SOCKET)s->udp_fd, NULL);
 ^
cc1: some warnings being treated as errors
ffbuild/common.mak:59: recipe for target 'libavformat/udp.o' failed
make: *** [libavformat/udp.o] Error 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".



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

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

Re: [FFmpeg-devel] [PATCH 2/2] avformat/udp: cancel pending IO on win32 manually

2020-02-03 Thread Marton Balint



On Mon, 3 Feb 2020, Mark Himsley wrote:


On Sun, 26 Jan 2020 at 21:22, Marton Balint  wrote:


recvfrom() is not a cancellation point in pthreads-win32, see
https://sourceware.org/pthreads-win32/manual/pthread_cancel.html

In order to be able to cancel the reader thread on Win32 properly we first
shutdown the socket then call CancelIoEx to abort pending IO. Subsequent
recvfrom() calls will fail with WSAESHUTDOWN causing the thread to exit.

Fixes ticket #5717.

Signed-off-by: Marton Balint 
---
 libavformat/udp.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/libavformat/udp.c b/libavformat/udp.c
index 85c9e3a900..23c3773c64 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -1069,8 +1069,17 @@ static int udp_close(URLContext *h)
 if (s->thread_started) {
 int ret;
 // Cancel only read, as write has been signaled as success to the user
-if (h->flags & AVIO_FLAG_READ)
+if (h->flags & AVIO_FLAG_READ) {
+#ifdef _WIN32
+/* recvfrom() is not a cancellation point for win32, so we shutdown
+ * the socket and abort pending IO, subsequent recvfrom() calls
+ * will fail with WSAESHUTDOWN causing the thread to exit. */
+shutdown(s->udp_fd, SD_RECEIVE);
+CancelIoEx((HANDLE)(SOCKET)s->udp_fd, NULL);
+#else
 pthread_cancel(s->circular_buffer_thread);
+#endif
+}
 ret = pthread_join(s->circular_buffer_thread, NULL);
 if (ret != 0)
 av_log(h, AV_LOG_ERROR, "pthread_join(): %s\n", strerror(ret));
--
2.16.4


This was applied as 53aa76686e7ff4f1f6625502503d7923cec8c10e, but that
commit fails to compile in my mingw cross-compile build.


x86_64-w64-mingw32-gcc -I. -I./ --static -DPTW32_STATIC_LIB
-D_WIN32_WINNT=0x0501 -I/opt/ffbuild/include -D_ISOC99_SOURCE


It looks like you are still building for Windows XP, but that is no longer 
supported. _WIN32_WINNT should be at least 0x0600.


Regards,
Marton



-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U__STRICT_ANSI__
-D__USE_MINGW_ANSI_STDIO=1 -D__printf__=__gnu_printf__
-D_WIN32_WINNT=0x0600 -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
-DPIC -DOPJ_STATIC -DZLIB_CONST -DHAVE_AV_CONFIG_H -DBUILDING_avformat
--static -DPTW32_STATIC_LIB -D_WIN32_WINNT=0x0501
-I/opt/ffbuild/include  --static -DPTW32_STATIC_LIB
-D_WIN32_WINNT=0x0501 -std=c11 -fomit-frame-pointer -pthread
-I/opt/ffbuild/include -I/opt/ffbuild/include -I/opt/ffbuild/include
-I/opt/ffbuild/include/openjpeg-2.3 -I/opt/ffbuild/include/opus
-I/opt/ffbuild/include/opus -I/opt/ffbuild/include
-I/opt/ffbuild/include -I/opt/ffbuild/include -I/opt/ffbuild/include
-I/opt/ffbuild/include -I/opt/ffbuild/include -I/opt/ffbuild/include
-I/opt/ffbuild/include -I/opt/ffbuild/include -DLIBXML_STATIC
-I/opt/ffbuild/include/libxml2 -I/opt/ffbuild/include -g
-Wdeclaration-after-statement -Wall -Wdisabled-optimization
-Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits
-Wundef -Wmissing-prototypes -Wno-pointer-to-int-cast
-Wstrict-prototypes -Wempty-body -Wno-parentheses -Wno-switch
-Wno-format-zero-length -Wno-pointer-sign -Wno-char-subscripts -O3
-fno-math-errno -fno-signed-zeros -fno-tree-vectorize
-Werror=format-security -Werror=implicit-function-declaration
-Werror=missing-prototypes -Werror=return-type -Werror=vla -Wformat
-fdiagnostics-color=auto -Wno-maybe-uninitialized  -MMD -MF
libavformat/udp.d -MT libavformat/udp.o -c -o libavformat/udp.o
libavformat/udp.c
In file included from libavformat/udp.c:65:0:
/opt/ffbuild/include/pthread.h:108:0: warning: "PTW32_LEVEL" redefined
#define PTW32_LEVEL PTW32_LEVEL_MAX
^
/opt/ffbuild/include/pthread.h:95:0: note: this is the location of the
previous definition
#define PTW32_LEVEL 1
^
In file included from /opt/ffbuild/include/pthread.h:299:0,
from libavformat/udp.c:65:
/opt/ffbuild/include/sched.h:64:0: warning: "PTW32_SCHED_LEVEL" redefined
#define PTW32_SCHED_LEVEL PTW32_SCHED_LEVEL_MAX
^
/opt/ffbuild/include/sched.h:51:0: note: this is the location of the
previous definition
#define PTW32_SCHED_LEVEL 1
^
libavformat/udp.c: In function 'udp_close':
libavformat/udp.c:1078:13: error: implicit declaration of function
'CancelIoEx' [-Werror=implicit-function-declaration]
CancelIoEx((HANDLE)(SOCKET)s->udp_fd, NULL);
^
cc1: some warnings being treated as errors
ffbuild/common.mak:59: recipe for target 'libavformat/udp.o' failed
make: *** [libavformat/udp.o] Error 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".




--
Mark Himsley
___
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 

[FFmpeg-devel] [PATCH v5 2/2] avcodec/libvpxenc: add a way to explicitly set temporal layer id

2020-02-03 Thread Wonkap Jang
In order for rate control to correctly allocate bitrate to each temporal
layer, correct temporal layer id has to be set to each frame. This
commit provides the ability to set correct temporal layer id for each
frame.
---
 libavcodec/libvpxenc.c | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 6fca05e6b1..2093aa8bca 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -1519,11 +1519,22 @@ static int vpx_encode(AVCodecContext *avctx, AVPacket 
*pkt,
 #endif
 if (frame->pict_type == AV_PICTURE_TYPE_I)
 flags |= VPX_EFLAG_FORCE_KF;
-if (CONFIG_LIBVPX_VP8_ENCODER && avctx->codec_id == AV_CODEC_ID_VP8 && 
frame->metadata) {
+if (frame->metadata) {
 AVDictionaryEntry* en = av_dict_get(frame->metadata, "vp8-flags", 
NULL, 0);
 if (en) {
 flags |= strtoul(en->value, NULL, 10);
 }
+
+memset(&layer_id, 0, sizeof(layer_id));
+
+en = av_dict_get(frame->metadata, "temporal_id", NULL, 0);
+if (en) {
+layer_id.temporal_layer_id = strtoul(en->value, NULL, 10);
+#ifdef VPX_CTRL_VP9E_SET_MAX_INTER_BITRATE_PCT
+layer_id.temporal_layer_id_per_spatial[0] = 
layer_id.temporal_layer_id;
+#endif
+layer_id_valid = 1;
+}
 }
 
 if (sd) {
-- 
2.25.0.341.g760bfbb309-goog

___
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 v5 1/2] avcodec/libvpxenc: add VP9 temporal scalability encoding option

2020-02-03 Thread Wonkap Jang
This commit reuses the configuration options for VP8 that enables
temporal scalability for VP9. It also adds a way to enable three
preset temporal structures (refer to the documentation for more
detail) that can be used in offline encoding.
---
 doc/encoders.texi  |  18 ++-
 libavcodec/libvpxenc.c | 250 +
 2 files changed, 242 insertions(+), 26 deletions(-)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 20bcb4e2d7..e26d6b5425 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1888,8 +1888,6 @@ Enable error resiliency features.
 Increase sharpness at the expense of lower PSNR.
 The valid range is [0, 7].
 
-@item VP8-specific options
-@table @option
 @item ts-parameters
 Sets the temporal scalability configuration using a :-separated list of
 key=value pairs. For example, to specify temporal scalability parameters
@@ -1897,7 +1895,7 @@ with @code{ffmpeg}:
 @example
 ffmpeg -i INPUT -c:v libvpx -ts-parameters ts_number_layers=3:\
 ts_target_bitrate=250,500,1000:ts_rate_decimator=4,2,1:\
-ts_periodicity=4:ts_layer_id=0,2,1,2 OUTPUT
+ts_periodicity=4:ts_layer_id=0,2,1,2:ts_layering_mode=3 OUTPUT
 @end example
 Below is a brief explanation of each of the parameters, please
 refer to @code{struct vpx_codec_enc_cfg} in @code{vpx/vpx_encoder.h} for more
@@ -1914,6 +1912,20 @@ Frame rate decimation factor for each temporal layer.
 Length of the sequence defining frame temporal layer membership.
 @item ts_layer_id
 Template defining the membership of frames to temporal layers.
+@item ts_layering_mode
+(optional) Selecting the temporal structure from a set of pre-defined temporal 
layering modes.
+Currently supports the following options.
+@table @option
+@item 0
+No temporal layering flags are provided internally,
+relies on flags being passed in using metadata in AVFrame.
+@item 2
+Two temporal layers. 0-1...
+@item 3
+Three temporal layers. 0-2-1-2...; with single reference frame.
+@item 4
+Same as option "3", except there is a dependency between
+the two temporal layer 2 frames within the temporal period.
 @end table
 @end table
 
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 0b8a070304..6fca05e6b1 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -100,7 +100,9 @@ typedef struct VPxEncoderContext {
 int rc_undershoot_pct;
 int rc_overshoot_pct;
 
-AVDictionary *vp8_ts_parameters;
+AVDictionary *vpx_ts_parameters;
+int *ts_layer_flags;
+int current_temporal_idx;
 
 // VP9-only
 int lossless;
@@ -137,6 +139,7 @@ static const char *const ctlidstr[] = {
 [VP8E_SET_CQ_LEVEL]  = "VP8E_SET_CQ_LEVEL",
 [VP8E_SET_MAX_INTRA_BITRATE_PCT] = "VP8E_SET_MAX_INTRA_BITRATE_PCT",
 [VP8E_SET_SHARPNESS]   = "VP8E_SET_SHARPNESS",
+[VP8E_SET_TEMPORAL_LAYER_ID]   = "VP8E_SET_TEMPORAL_LAYER_ID",
 #if CONFIG_LIBVPX_VP9_ENCODER
 [VP9E_SET_LOSSLESS]= "VP9E_SET_LOSSLESS",
 [VP9E_SET_TILE_COLUMNS]= "VP9E_SET_TILE_COLUMNS",
@@ -144,6 +147,11 @@ static const char *const ctlidstr[] = {
 [VP9E_SET_FRAME_PARALLEL_DECODING] = "VP9E_SET_FRAME_PARALLEL_DECODING",
 [VP9E_SET_AQ_MODE] = "VP9E_SET_AQ_MODE",
 [VP9E_SET_COLOR_SPACE] = "VP9E_SET_COLOR_SPACE",
+[VP9E_SET_SVC_LAYER_ID]= "VP9E_SET_SVC_LAYER_ID",
+#if VPX_ENCODER_ABI_VERSION >= 12
+[VP9E_SET_SVC_PARAMETERS]  = "VP9E_SET_SVC_PARAMETERS",
+#endif
+[VP9E_SET_SVC] = "VP9E_SET_SVC",
 #if VPX_ENCODER_ABI_VERSION >= 11
 [VP9E_SET_COLOR_RANGE] = "VP9E_SET_COLOR_RANGE",
 #endif
@@ -221,10 +229,22 @@ static av_cold void dump_enc_cfg(AVCodecContext *avctx,
width, "rc_overshoot_pct:",  cfg->rc_overshoot_pct);
 av_log(avctx, level, "temporal layering settings\n"
"  %*s%u\n", width, "ts_number_layers:", cfg->ts_number_layers);
-av_log(avctx, level,
-   "\n  %*s", width, "ts_target_bitrate:");
-for (i = 0; i < VPX_TS_MAX_LAYERS; i++)
-av_log(avctx, level, "%u ", cfg->ts_target_bitrate[i]);
+if (avctx->codec_id == AV_CODEC_ID_VP8) {
+av_log(avctx, level,
+   "\n  %*s", width, "ts_target_bitrate:");
+for (i = 0; i < VPX_TS_MAX_LAYERS; i++)
+av_log(avctx, level,
+   "%u ", cfg->ts_target_bitrate[i]);
+}
+#if (VPX_ENCODER_ABI_VERSION >= 12) && CONFIG_LIBVPX_VP9_ENCODER
+if (avctx->codec_id == AV_CODEC_ID_VP9) {
+av_log(avctx, level,
+   "\n  %*s", width, "layer_target_bitrate:");
+for (i = 0; i < VPX_TS_MAX_LAYERS; i++)
+av_log(avctx, level,
+   "%u ", cfg->layer_target_bitrate[i]);
+}
+#endif
 av_log(avctx, level, "\n");
 av_log(avctx, level,
"\n  %*s", width, "ts_rate_decimator:");
@@ -346,6 +366,8 @@ static av_cold int vpx_free(AVCodecContext *avctx)
 }
 #endif
 
+av_freep(&ctx->ts_layer_flag

[FFmpeg-devel] [PATCH v2 6/7] mlpenc: fix -fsanitize=integer errors

2020-02-03 Thread Jai Luthra
Signed-off-by: Jai Luthra 
---
 libavcodec/mlpenc.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

v2: fixes more integer issues

diff --git a/libavcodec/mlpenc.c b/libavcodec/mlpenc.c
index 347a43248c..173cf71956 100644
--- a/libavcodec/mlpenc.c
+++ b/libavcodec/mlpenc.c
@@ -87,11 +87,11 @@ typedef struct {
 } DecodingParams;
 
 typedef struct BestOffset {
-int16_t offset;
+int32_t offset;
 int bitcount;
 int lsb_bits;
-int16_t min;
-int16_t max;
+int32_t min;
+int32_t max;
 } BestOffset;
 
 #define HUFF_OFFSET_MIN(-16384)
@@ -568,7 +568,7 @@ static av_cold int mlp_encode_init(AVCodecContext *avctx)
 }
 ctx->coded_sample_fmt[1] = -1 & 0xf;
 
-ctx->dts = -avctx->frame_size;
+ctx->dts = (uint16_t) (-avctx->frame_size);
 
 ctx->num_channels = avctx->channels + 2; /* +2 noise channels */
 ctx->one_sample_buffer_size = avctx->frame_size
@@ -1249,7 +1249,7 @@ static void input_data_internal(MLPEncodeContext *ctx, 
const uint8_t *samples,
 uint32_t abs_sample;
 int32_t sample;
 
-sample = is24 ? *samples_32++ >> 8 : *samples_16++ * 256U;
+sample = is24 ? *samples_32++ >> 8 : *samples_16++ * 256;
 
 /* TODO Find out if number_sbits can be used for negative 
values. */
 abs_sample = FFABS(sample);
@@ -1589,7 +1589,7 @@ static void no_codebook_bits(MLPEncodeContext *ctx,
  BestOffset *bo)
 {
 DecodingParams *dp = ctx->cur_decoding_params;
-int16_t offset;
+int32_t offset;
 int32_t unsign = 0;
 uint32_t diff;
 int lsb_bits;
@@ -1611,7 +1611,7 @@ static void no_codebook_bits(MLPEncodeContext *ctx,
 
 /* If all samples are the same (lsb_bits == 0), offset must be
  * adjusted because of sign_shift. */
-offset = min + diff / 2 + !!lsb_bits;
+offset = min + (int) (diff / 2) + !!lsb_bits;
 
 bo->offset   = offset;
 bo->lsb_bits = lsb_bits;
@@ -1792,7 +1792,7 @@ static void determine_bits(MLPEncodeContext *ctx)
 #define SAMPLE_MAX(bitdepth) ((1 << (bitdepth - 1)) - 1)
 #define SAMPLE_MIN(bitdepth) (~SAMPLE_MAX(bitdepth))
 
-#define MSB_MASK(bits)  (-(1u << (bits)))
+#define MSB_MASK(bits)  (-(int)(1u << (bits)))
 
 /** Applies the filter to the current samples, and saves the residual back
  *  into the samples buffer. If the filter is too bad and overflows the
@@ -2280,8 +2280,8 @@ static int mlp_encode_frame(AVCodecContext *avctx, 
AVPacket *avpkt,
 
 bytes_written = write_access_unit(ctx, avpkt->data, avpkt->size, 
restart_frame);
 
-ctx->timestamp += ctx->frame_size[ctx->frame_index];
-ctx->dts   += ctx->frame_size[ctx->frame_index];
+ctx->timestamp = (uint16_t) (ctx->timestamp + 
ctx->frame_size[ctx->frame_index]);
+ctx->dts   = (uint16_t) (ctx->dts   + 
ctx->frame_size[ctx->frame_index]);
 
 input_and_return:
 
-- 
2.25.0

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

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

[FFmpeg-devel] [PATCH 3/3] lavc/dvdsubenc: accept palette from options

2020-02-03 Thread Michael Kuron
Previously, the default palette would always be used.
Now, we can accept a custom palette, just like dvdsubdec does.

Signed-off-by: Michael Kuron 
---
 doc/encoders.texi  | 8 
 libavcodec/Makefile| 1 +
 libavcodec/dvdsubenc.c | 8 +++-
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index eefd124751..a04f9f1b62 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -3116,6 +3116,14 @@ and they can also be used in Matroska files.
 @subsection Options
 
 @table @option
+@item palette
+Specify the global palette used by the bitmaps.
+
+The format for this option is a string containing 16 24-bits hexadecimal
+numbers (without 0x prefix) separated by commas, for example @code{0d00ee,
+ee450d, 101010, eaeaea, 0ce60b, ec14ed, ebff0b, 0d617a, 7b7b7b, d1d1d1,
+7b2a0e, 0d950c, 0f007b, cf0dec, cfa80c, 7c127b}.
+
 @item even_rows_fix
 When set to 1, enable a work-around that makes the number of pixel rows
 even in all subtitles.  This fixes a problem with some players that
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index ddc923304a..71ee8caeb3 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -284,6 +284,7 @@ OBJS-$(CONFIG_DVBSUB_ENCODER)  += dvbsub.o
 OBJS-$(CONFIG_DVDSUB_DECODER)  += dvdsubdec.o
 OBJS-$(CONFIG_DVDSUB_DECODER)  += dvdsub.o
 OBJS-$(CONFIG_DVDSUB_ENCODER)  += dvdsubenc.o
+OBJS-$(CONFIG_DVDSUB_ENCODER)  += dvdsub.o
 OBJS-$(CONFIG_DVAUDIO_DECODER) += dvaudiodec.o
 OBJS-$(CONFIG_DVVIDEO_DECODER) += dvdec.o dv.o dvdata.o
 OBJS-$(CONFIG_DVVIDEO_ENCODER) += dvenc.o dv.o dvdata.o
diff --git a/libavcodec/dvdsubenc.c b/libavcodec/dvdsubenc.c
index ff95ed2002..e54b5f0d7b 100644
--- a/libavcodec/dvdsubenc.c
+++ b/libavcodec/dvdsubenc.c
@@ -29,6 +29,7 @@
 typedef struct {
 AVClass *class;
 uint32_t global_palette[16];
+char *palette_str;
 int even_rows_fix;
 } DVDSubtitleContext;
 
@@ -436,7 +437,11 @@ static int dvdsub_init(AVCodecContext *avctx)
 int i, ret;
 
 av_assert0(sizeof(dvdc->global_palette) == sizeof(default_palette));
-memcpy(dvdc->global_palette, default_palette, 
sizeof(dvdc->global_palette));
+if (dvdc->palette_str) {
+ff_dvdsub_parse_palette(dvdc->global_palette, dvdc->palette_str);
+} else {
+memcpy(dvdc->global_palette, default_palette, 
sizeof(dvdc->global_palette));
+}
 
 av_bprint_init(&extradata, 0, AV_BPRINT_SIZE_AUTOMATIC);
 if (avctx->width && avctx->height)
@@ -467,6 +472,7 @@ static int dvdsub_encode(AVCodecContext *avctx,
 #define OFFSET(x) offsetof(DVDSubtitleContext, x)
 #define SE AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {
+{"palette", "set the global palette", OFFSET(palette_str), 
AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, SE },
 {"even_rows_fix", "Make number of rows even (workaround for some 
players)", OFFSET(even_rows_fix), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, SE},
 { NULL },
 };
-- 
2.24.1

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

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

[FFmpeg-devel] [PATCH 2/3] lavc/dvdsubdec: Move palette parsing to new function

2020-02-03 Thread Michael Kuron
Signed-off-by: Michael Kuron 
---
 libavcodec/Makefile|  1 +
 libavcodec/dvdsub.c| 33 +
 libavcodec/dvdsubdec.c | 22 ++
 libavcodec/internal.h  |  2 ++
 4 files changed, 42 insertions(+), 16 deletions(-)
 create mode 100644 libavcodec/dvdsub.c

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 3cd73fbcc6..ddc923304a 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -282,6 +282,7 @@ OBJS-$(CONFIG_DST_DECODER) += dstdec.o dsd.o
 OBJS-$(CONFIG_DVBSUB_DECODER)  += dvbsubdec.o
 OBJS-$(CONFIG_DVBSUB_ENCODER)  += dvbsub.o
 OBJS-$(CONFIG_DVDSUB_DECODER)  += dvdsubdec.o
+OBJS-$(CONFIG_DVDSUB_DECODER)  += dvdsub.o
 OBJS-$(CONFIG_DVDSUB_ENCODER)  += dvdsubenc.o
 OBJS-$(CONFIG_DVAUDIO_DECODER) += dvaudiodec.o
 OBJS-$(CONFIG_DVVIDEO_DECODER) += dvdec.o dv.o dvdata.o
diff --git a/libavcodec/dvdsub.c b/libavcodec/dvdsub.c
new file mode 100644
index 00..a03ff27754
--- /dev/null
+++ b/libavcodec/dvdsub.c
@@ -0,0 +1,33 @@
+/*
+ * DVD subtitle decoding/encoding
+ * Copyright (c) 2005 Fabrice Bellard
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "internal.h"
+#include "libavutil/avstring.h"
+#include 
+
+void ff_dvdsub_parse_palette(uint32_t *palette, const char *p)
+{
+for (int i = 0; i < 16; i++) {
+palette[i] = strtoul(p, &p, 16);
+while (*p == ',' || av_isspace(*p))
+p++;
+}
+}
diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index 741ea9fd1e..bf49788e1b 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -27,7 +27,6 @@
 #include "libavutil/colorspace.h"
 #include "libavutil/opt.h"
 #include "libavutil/imgutils.h"
-#include "libavutil/avstring.h"
 #include "libavutil/bswap.h"
 
 typedef struct DVDSubContext
@@ -626,18 +625,6 @@ static int dvdsub_decode(AVCodecContext *avctx,
 return buf_size;
 }
 
-static void parse_palette(DVDSubContext *ctx, char *p)
-{
-int i;
-
-ctx->has_palette = 1;
-for(i=0;i<16;i++) {
-ctx->palette[i] = strtoul(p, &p, 16);
-while(*p == ',' || av_isspace(*p))
-p++;
-}
-}
-
 static int parse_ifo_palette(DVDSubContext *ctx, char *p)
 {
 FILE *ifo;
@@ -719,7 +706,8 @@ static int dvdsub_parse_extradata(AVCodecContext *avctx)
 break;
 
 if (strncmp("palette:", data, 8) == 0) {
-parse_palette(ctx, data + 8);
+ctx->has_palette = 1;
+ff_dvdsub_parse_palette(ctx->palette, data + 8);
 } else if (strncmp("size:", data, 5) == 0) {
 int w, h;
 if (sscanf(data + 5, "%dx%d", &w, &h) == 2) {
@@ -748,8 +736,10 @@ static av_cold int dvdsub_init(AVCodecContext *avctx)
 
 if (ctx->ifo_str)
 parse_ifo_palette(ctx, ctx->ifo_str);
-if (ctx->palette_str)
-parse_palette(ctx, ctx->palette_str);
+if (ctx->palette_str) {
+ctx->has_palette = 1;
+ff_dvdsub_parse_palette(ctx->palette, ctx->palette_str);
+}
 if (ctx->has_palette) {
 int i;
 av_log(avctx, AV_LOG_DEBUG, "palette:");
diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index 5096ffa1d9..41281b1140 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -424,6 +424,8 @@ int64_t ff_guess_coded_bitrate(AVCodecContext *avctx);
 int ff_int_from_list_or_default(void *ctx, const char * val_name, int val,
 const int * array_valid_values, int 
default_value);
 
+void ff_dvdsub_parse_palette(uint32_t *palette, const char *p);
+
 #if defined(_WIN32) && CONFIG_SHARED && !defined(BUILDING_avcodec)
 #define av_export_avcodec __declspec(dllimport)
 #else
-- 
2.24.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 2/2] avformat/udp: cancel pending IO on win32 manually

2020-02-03 Thread Mark Himsley
On Mon, 3 Feb 2020 at 17:19, Marton Balint  wrote:
>
>
>
> On Mon, 3 Feb 2020, Mark Himsley wrote:
>
> > On Sun, 26 Jan 2020 at 21:22, Marton Balint  wrote:
> >>
> >> recvfrom() is not a cancellation point in pthreads-win32, see
> >> https://sourceware.org/pthreads-win32/manual/pthread_cancel.html
> >>
> >> In order to be able to cancel the reader thread on Win32 properly we first
> >> shutdown the socket then call CancelIoEx to abort pending IO. Subsequent
> >> recvfrom() calls will fail with WSAESHUTDOWN causing the thread to exit.
> >>
> >> Fixes ticket #5717.
> >>
> >> Signed-off-by: Marton Balint 
> >> ---
> >>  libavformat/udp.c | 11 ++-
> >>  1 file changed, 10 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/libavformat/udp.c b/libavformat/udp.c
> >> index 85c9e3a900..23c3773c64 100644
> >> --- a/libavformat/udp.c
> >> +++ b/libavformat/udp.c
> >> @@ -1069,8 +1069,17 @@ static int udp_close(URLContext *h)
> >>  if (s->thread_started) {
> >>  int ret;
> >>  // Cancel only read, as write has been signaled as success to the 
> >> user
> >> -if (h->flags & AVIO_FLAG_READ)
> >> +if (h->flags & AVIO_FLAG_READ) {
> >> +#ifdef _WIN32
> >> +/* recvfrom() is not a cancellation point for win32, so we 
> >> shutdown
> >> + * the socket and abort pending IO, subsequent recvfrom() 
> >> calls
> >> + * will fail with WSAESHUTDOWN causing the thread to exit. */
> >> +shutdown(s->udp_fd, SD_RECEIVE);
> >> +CancelIoEx((HANDLE)(SOCKET)s->udp_fd, NULL);
> >> +#else
> >>  pthread_cancel(s->circular_buffer_thread);
> >> +#endif
> >> +}
> >>  ret = pthread_join(s->circular_buffer_thread, NULL);
> >>  if (ret != 0)
> >>  av_log(h, AV_LOG_ERROR, "pthread_join(): %s\n", 
> >> strerror(ret));
> >> --
> >> 2.16.4
> >
> > This was applied as 53aa76686e7ff4f1f6625502503d7923cec8c10e, but that
> > commit fails to compile in my mingw cross-compile build.
> >
> >
> > x86_64-w64-mingw32-gcc -I. -I./ --static -DPTW32_STATIC_LIB
> > -D_WIN32_WINNT=0x0501 -I/opt/ffbuild/include -D_ISOC99_SOURCE
>
> It looks like you are still building for Windows XP, but that is no longer
> supported. _WIN32_WINNT should be at least 0x0600.

Thanks Marton.
I'll remember, Windows Vista and above only.
Thanks - I'll update my build script.


> Regards,
> Marton
>
>
> > -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U__STRICT_ANSI__
> > -D__USE_MINGW_ANSI_STDIO=1 -D__printf__=__gnu_printf__
> > -D_WIN32_WINNT=0x0600 -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
> > -DPIC -DOPJ_STATIC -DZLIB_CONST -DHAVE_AV_CONFIG_H -DBUILDING_avformat
> > --static -DPTW32_STATIC_LIB -D_WIN32_WINNT=0x0501
> > -I/opt/ffbuild/include  --static -DPTW32_STATIC_LIB
> > -D_WIN32_WINNT=0x0501 -std=c11 -fomit-frame-pointer -pthread
> > -I/opt/ffbuild/include -I/opt/ffbuild/include -I/opt/ffbuild/include
> > -I/opt/ffbuild/include/openjpeg-2.3 -I/opt/ffbuild/include/opus
> > -I/opt/ffbuild/include/opus -I/opt/ffbuild/include
> > -I/opt/ffbuild/include -I/opt/ffbuild/include -I/opt/ffbuild/include
> > -I/opt/ffbuild/include -I/opt/ffbuild/include -I/opt/ffbuild/include
> > -I/opt/ffbuild/include -I/opt/ffbuild/include -DLIBXML_STATIC
> > -I/opt/ffbuild/include/libxml2 -I/opt/ffbuild/include -g
> > -Wdeclaration-after-statement -Wall -Wdisabled-optimization
> > -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits
> > -Wundef -Wmissing-prototypes -Wno-pointer-to-int-cast
> > -Wstrict-prototypes -Wempty-body -Wno-parentheses -Wno-switch
> > -Wno-format-zero-length -Wno-pointer-sign -Wno-char-subscripts -O3
> > -fno-math-errno -fno-signed-zeros -fno-tree-vectorize
> > -Werror=format-security -Werror=implicit-function-declaration
> > -Werror=missing-prototypes -Werror=return-type -Werror=vla -Wformat
> > -fdiagnostics-color=auto -Wno-maybe-uninitialized  -MMD -MF
> > libavformat/udp.d -MT libavformat/udp.o -c -o libavformat/udp.o
> > libavformat/udp.c
> > In file included from libavformat/udp.c:65:0:
> > /opt/ffbuild/include/pthread.h:108:0: warning: "PTW32_LEVEL" redefined
> > #define PTW32_LEVEL PTW32_LEVEL_MAX
> > ^
> > /opt/ffbuild/include/pthread.h:95:0: note: this is the location of the
> > previous definition
> > #define PTW32_LEVEL 1
> > ^
> > In file included from /opt/ffbuild/include/pthread.h:299:0,
> > from libavformat/udp.c:65:
> > /opt/ffbuild/include/sched.h:64:0: warning: "PTW32_SCHED_LEVEL" redefined
> > #define PTW32_SCHED_LEVEL PTW32_SCHED_LEVEL_MAX
> > ^
> > /opt/ffbuild/include/sched.h:51:0: note: this is the location of the
> > previous definition
> > #define PTW32_SCHED_LEVEL 1
> > ^
> > libavformat/udp.c: In function 'udp_close':
> > libavformat/udp.c:1078:13: error: implicit declaration of function
> > 'CancelIoEx' [-Werror=implicit-function-declaration]
> > CancelIoEx((HANDLE)(SOCKET)s->udp_fd, NULL);
> > ^
> > cc1: some warnings being treated as errors
> > ffbui

[FFmpeg-devel] [PATCH 1/3] doc: Fix typo for dvdsubdec

2020-02-03 Thread Michael Kuron
Signed-off-by: Michael Kuron 
---
 doc/decoders.texi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/decoders.texi b/doc/decoders.texi
index 0582b018b0..83515ae363 100644
--- a/doc/decoders.texi
+++ b/doc/decoders.texi
@@ -280,7 +280,7 @@ palette is stored in the IFO file, and therefore not 
available when reading
 from dumped VOB files.
 
 The format for this option is a string containing 16 24-bits hexadecimal
-numbers (without 0x prefix) separated by comas, for example @code{0d00ee,
+numbers (without 0x prefix) separated by commas, for example @code{0d00ee,
 ee450d, 101010, eaeaea, 0ce60b, ec14ed, ebff0b, 0d617a, 7b7b7b, d1d1d1,
 7b2a0e, 0d950c, 0f007b, cf0dec, cfa80c, 7c127b}.
 
-- 
2.24.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 v5 2/2] avcodec/libvpxenc: add a way to explicitly set temporal layer id

2020-02-03 Thread James Zern
On Mon, Feb 3, 2020 at 10:02 AM Wonkap Jang
 wrote:
>
> In order for rate control to correctly allocate bitrate to each temporal
> layer, correct temporal layer id has to be set to each frame. This
> commit provides the ability to set correct temporal layer id for each
> frame.
> ---
>  libavcodec/libvpxenc.c | 13 -
>  1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
> index 6fca05e6b1..2093aa8bca 100644
> --- a/libavcodec/libvpxenc.c
> +++ b/libavcodec/libvpxenc.c
> @@ -1519,11 +1519,22 @@ static int vpx_encode(AVCodecContext *avctx, AVPacket 
> *pkt,
>  #endif
>  if (frame->pict_type == AV_PICTURE_TYPE_I)
>  flags |= VPX_EFLAG_FORCE_KF;
> -if (CONFIG_LIBVPX_VP8_ENCODER && avctx->codec_id == AV_CODEC_ID_VP8 
> && frame->metadata) {
> +if (frame->metadata) {
>  AVDictionaryEntry* en = av_dict_get(frame->metadata, 
> "vp8-flags", NULL, 0);

I think you'll want to check the codec being used for this one still.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH v5 1/2] avcodec/libvpxenc: add VP9 temporal scalability encoding option

2020-02-03 Thread James Zern
On Mon, Feb 3, 2020 at 10:02 AM Wonkap Jang
 wrote:
>
> This commit reuses the configuration options for VP8 that enables
> temporal scalability for VP9. It also adds a way to enable three
> preset temporal structures (refer to the documentation for more
> detail) that can be used in offline encoding.
> ---
>  doc/encoders.texi  |  18 ++-
>  libavcodec/libvpxenc.c | 250 +
>  2 files changed, 242 insertions(+), 26 deletions(-)
>

applied, thanks.
___
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] lavd/avfoundation: Add an option to drop late frames.

2020-02-03 Thread Thilo Borgmann
Am 19.01.20 um 17:41 schrieb Thilo Borgmann:
> $subject
> 
> If you record live sources like during screen capture, you want this enabled 
> (current behavior).
> For the case you're capturing from etc you want the most possible frames 
> captured no matter a possible delay.
> Was fixed behavior before, so make it an option with enabled to be default.

Will push soon.

-Thilo

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

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

Re: [FFmpeg-devel] [PATCH] avformat/dashenc: use AV_OPT_TYPE_DICT for http_opts

2020-02-03 Thread Marton Balint



On Sun, 2 Feb 2020, James Almer wrote:


On 2/2/2020 7:01 PM, Marton Balint wrote:

This changes the separator character from comma to colon, but since this option
was only added recently I think it should be done for consistency with other
similar options.

Signed-off-by: Marton Balint 
---
 doc/muxers.texi   | 3 ++-
 libavformat/dashenc.c | 7 +++
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 05bf483ba5..ef5c4b10bc 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -345,7 +345,8 @@ prft boxes in the underlying muxer. Applicable only when 
the @var{utc_url} optio
 Set one or more manifest profiles.

 @item -http_opts @var{http_opts}
-List of options to pass to the underlying HTTP protocol. Applicable only for 
HTTP output.
+A :-separated list of key=value options to pass to the underlying HTTP
+protocol. Applicable only for HTTP output.

 @item -target_latency @var{target_latency}
 Set an intended target latency in seconds (fractional value can be set) for 
serving. Applicable only when @var{streaming} and @var{write_prft} options are 
enabled.
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 3b651b9514..9a8dde98e9 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -167,7 +167,7 @@ typedef struct DASHContext {
 const char *utc_timing_url;
 const char *method;
 const char *user_agent;
-char *http_opts;
+AVDictionary *http_opts;
 int hls_playlist;
 int http_persistent;
 int master_playlist_created;
@@ -479,8 +479,7 @@ static void set_http_options(AVDictionary **options, 
DASHContext *c)
 {
 if (c->method)
 av_dict_set(options, "method", c->method, 0);
-if (c->http_opts)
-av_dict_parse_string(options, c->http_opts, "=", ",", 0);
+av_dict_copy(options, c->http_opts, 0);
 if (c->user_agent)
 av_dict_set(options, "user_agent", c->user_agent, 0);
 if (c->http_persistent)
@@ -2273,7 +2272,7 @@ static const AVOption options[] = {
 { "mpd_profile", "Set profiles. Elements and values used in the manifest may be 
constrained by them", OFFSET(profile), AV_OPT_TYPE_FLAGS, {.i64 = MPD_PROFILE_DASH }, 0, UINT_MAX, E, 
"mpd_profile"},
 { "dash", "MPEG-DASH ISO Base media file format live profile", 0, AV_OPT_TYPE_CONST, 
{.i64 = MPD_PROFILE_DASH }, 0, UINT_MAX, E, "mpd_profile"},
 { "dvb_dash", "DVB-DASH profile", 0, AV_OPT_TYPE_CONST, {.i64 = MPD_PROFILE_DVB }, 
0, UINT_MAX, E, "mpd_profile"},
-{ "http_opts", "HTTP protocol options", OFFSET(http_opts), 
AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E },
+{ "http_opts", "HTTP protocol options", OFFSET(http_opts), 
AV_OPT_TYPE_DICT, { .str = NULL }, 0, 0, E },
 { "target_latency", "Set desired target latency for Low-latency dash", 
OFFSET(target_latency), AV_OPT_TYPE_DURATION, { .i64 = 0 }, 0, INT_MAX, E },
 { NULL },
 };


LGTM.


Thanks, applied.

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

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

[FFmpeg-devel] [PATCH 1/2] libavcodec/amfenc_hevc.c: Fix Profile level option on AMF HEVC.

2020-02-03 Thread OvchinnikovDmitrii
From: Sitan Liu 

---
 libavcodec/amfenc_hevc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c
index 8b4d289fac..411d444a62 100644
--- a/libavcodec/amfenc_hevc.c
+++ b/libavcodec/amfenc_hevc.c
@@ -136,7 +136,7 @@ static av_cold int amf_encode_init_hevc(AVCodecContext 
*avctx)
 AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_TIER, 
ctx->tier);
 
 profile_level = avctx->level;
-if (profile_level == 0) {
+if (profile_level == FF_LEVEL_UNKNOWN) {
 profile_level = ctx->level;
 }
 if (profile_level != 0) {
-- 
2.19.1.windows.1

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

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

[FFmpeg-devel] [PATCH 2/2] libavcodec/amfenc_hevc.c: Fix Maximum Reference Frames option on AMF HEVC.

2020-02-03 Thread OvchinnikovDmitrii
From: Sitan Liu 

---
 libavcodec/amfenc_hevc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c
index 411d444a62..77e57d2461 100644
--- a/libavcodec/amfenc_hevc.c
+++ b/libavcodec/amfenc_hevc.c
@@ -144,7 +144,7 @@ static av_cold int amf_encode_init_hevc(AVCodecContext 
*avctx)
 }
 AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, 
AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET, ctx->quality);
 // Maximum Reference Frames
-if (avctx->refs != 0) {
+if (avctx->refs != -1) {
 AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, 
AMF_VIDEO_ENCODER_HEVC_MAX_NUM_REFRAMES, avctx->refs);
 }
 // Aspect Ratio
-- 
2.19.1.windows.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] avfilter/vf_ssim: improve precision

2020-02-03 Thread Carl Eugen Hoyos
Am Fr., 31. Jan. 2020 um 10:05 Uhr schrieb Paul B Mahol :
>
> Use doubles for accumulating floats.

Consider mentioning the horrible ticket.

Thank you for looking into this, 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".

Re: [FFmpeg-devel] [PATCH 1/3] doc: Fix typo for dvdsubdec

2020-02-03 Thread Carl Eugen Hoyos
Am Mo., 3. Feb. 2020 um 20:49 Uhr schrieb Michael Kuron
:
>
> Signed-off-by: Michael Kuron 
> ---
>  doc/decoders.texi | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/doc/decoders.texi b/doc/decoders.texi
> index 0582b018b0..83515ae363 100644
> --- a/doc/decoders.texi
> +++ b/doc/decoders.texi
> @@ -280,7 +280,7 @@ palette is stored in the IFO file, and therefore not 
> available when reading
>  from dumped VOB files.
>
>  The format for this option is a string containing 16 24-bits hexadecimal
> -numbers (without 0x prefix) separated by comas, for example @code{0d00ee,
> +numbers (without 0x prefix) separated by commas, for example @code{0d00ee,

Patch applied.

Thank you, 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".

Re: [FFmpeg-devel] [PATCH 2/2] libavcodec/amfenc_hevc.c: Fix Profile level option on AMF HEVC.

2020-02-03 Thread Дмитрий Овчинников
>
> > This looks right.
>
Thanks for accepting the patch!

> If you are not the author then please ensure that the git author field is
filled correctly.
> This looks unrelated?

I divided this patch into 2 parts and fixed the value of the author field.
I hope everything is correct now.
(https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=282)
___
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/flac_parser: Do not loose header count in find_headers_search()

2020-02-03 Thread Michael Niedermayer
Fixes: Timeout
Fixes: out of array access
Fixes: 
20274/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLAC_fuzzer-5649631988154368
Fixes: 
19275/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLAC_fuzzer-5757535722405888

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/flac_parser.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index 9ffa288548..3424583c49 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -208,16 +208,20 @@ static int find_headers_search(FLACParseContext *fpc, 
uint8_t *buf,
 uint32_t x;
 
 for (i = 0; i < mod_offset; i++) {
-if ((AV_RB16(buf + i) & 0xFFFE) == 0xFFF8)
-size = find_headers_search_validate(fpc, search_start + i);
+if ((AV_RB16(buf + i) & 0xFFFE) == 0xFFF8) {
+int ret = find_headers_search_validate(fpc, search_start + i);
+size = FFMAX(size, ret);
+}
 }
 
 for (; i < buf_size - 1; i += 4) {
 x = AV_RN32(buf + i);
 if (((x & ~(x + 0x01010101)) & 0x80808080)) {
 for (j = 0; j < 4; j++) {
-if ((AV_RB16(buf + i + j) & 0xFFFE) == 0xFFF8)
-size = find_headers_search_validate(fpc, search_start + i 
+ j);
+if ((AV_RB16(buf + i + j) & 0xFFFE) == 0xFFF8) {
+int ret = find_headers_search_validate(fpc, search_start + 
i + j);
+size = FFMAX(size, ret);
+}
 }
 }
 }
-- 
2.17.1

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

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

Re: [FFmpeg-devel] [PATCH 1/3] avcodec/apedec: Fix integer overflows in predictor_decode_mono_3950()

2020-02-03 Thread Michael Niedermayer
On Tue, Jan 28, 2020 at 08:32:15PM +0100, Michael Niedermayer wrote:
> Fixes: signed integer overflow: -2147407150 + -1871606 cannot be represented 
> in type 'int'
> Fixes: 
> 18702/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5679095417667584
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/apedec.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

will apply patchset

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

If a bugfix only changes things apparently unrelated to the bug with no
further explanation, that is a good sign that the bugfix is wrong.


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

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

[FFmpeg-devel] [PATCH v1 1/2] avformat/rtsp: apply rtcp attribute from sdp file

2020-02-03 Thread Jun Li
Fix #8479
Apply rtcpport from sdp file if it contains rtcp attribute.

Signed-off-by: Jun Li 
---
 libavformat/rtsp.c | 12 ++--
 libavformat/rtsp.h |  1 +
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index cd6fc32a29..c892f21142 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -577,6 +577,10 @@ static void sdp_parse_line(AVFormatContext *s, 
SDPParseState *s1,
 if (s1->seen_fmtp) {
 parse_fmtp(s, rt, payload_type, s1->delayed_fmtp);
 }
+} else if (av_strstart(p, "rtcp:", &p) && s->nb_streams > 0) {
+rtsp_st = rt->rtsp_streams[rt->nb_rtsp_streams - 1];
+get_word(buf1, sizeof(buf1), &p);
+rtsp_st->rtcp_port = strtol(buf1, NULL, 10);
 } else if (av_strstart(p, "fmtp:", &p) ||
av_strstart(p, "framesize:", &p)) {
 // let dynamic protocol handlers have a stab at the line.
@@ -2367,6 +2371,7 @@ static int sdp_read_header(AVFormatContext *s)
 
 if (!(rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO)) {
 AVDictionary *opts = map_to_opts(rt);
+int rtcp_port = rtsp_st->rtcp_port;
 
 err = getnameinfo((struct sockaddr*) &rtsp_st->sdp_ip,
   sizeof(rtsp_st->sdp_ip),
@@ -2377,10 +2382,13 @@ static int sdp_read_header(AVFormatContext *s)
 av_dict_free(&opts);
 goto fail;
 }
+
+if (rtcp_port <= 0)
+rtcp_port = rtsp_st->sdp_port + 1;
 ff_url_join(url, sizeof(url), "rtp", NULL,
 namebuf, rtsp_st->sdp_port,
-"?localport=%d&ttl=%d&connect=%d&write_to_source=%d",
-rtsp_st->sdp_port, rtsp_st->sdp_ttl,
+
"?localport=%d&localrtcpport=%d&ttl=%d&connect=%d&write_to_source=%d",
+rtsp_st->sdp_port, rtcp_port, rtsp_st->sdp_ttl,
 rt->rtsp_flags & RTSP_FLAG_FILTER_SRC ? 1 : 0,
 rt->rtsp_flags & RTSP_FLAG_RTCP_TO_SOURCE ? 1 : 0);
 
diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h
index 54a9a30c16..15747fe6d1 100644
--- a/libavformat/rtsp.h
+++ b/libavformat/rtsp.h
@@ -448,6 +448,7 @@ typedef struct RTSPStream {
 /** The following are used only in SDP, not RTSP */
 //@{
 int sdp_port; /**< port (from SDP content) */
+int rtcp_port;/**< rtcp port (from SDP content) */
 struct sockaddr_storage sdp_ip; /**< IP address (from SDP content) */
 int nb_include_source_addrs; /**< Number of source-specific multicast 
include source IP addresses (from SDP content) */
 struct RTSPSource **include_source_addrs; /**< Source-specific multicast 
include source IP addresses (from SDP content) */
-- 
2.17.1

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

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

[FFmpeg-devel] [PATCH v1 2/2] avformat/rtpproto, sdp: write rtcp port to sdp file

2020-02-03 Thread Jun Li
Fix #8474
Write rtcp port attribute to sdp file when necessary.

Signed-off-by: Jun Li 
---
 libavformat/rtpproto.c | 11 +++
 libavformat/rtpproto.h |  2 ++
 libavformat/sdp.c  | 12 ++--
 3 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c
index 1f0a82ac7e..81a39cc3de 100644
--- a/libavformat/rtpproto.c
+++ b/libavformat/rtpproto.c
@@ -524,6 +524,17 @@ int ff_rtp_get_local_rtp_port(URLContext *h)
 return ff_udp_get_local_port(s->rtp_hd);
 }
 
+/**
+ * Return the remote rtcp port used by the RTP connection
+ * @param h media file context
+ * @return the remote port number
+ */
+int ff_rtp_get_remote_rtcp_port(URLContext *h)
+{
+RTPContext *s = h->priv_data;
+return s->rtcp_port;
+}
+
 /**
  * Return the local rtcp port used by the RTP connection
  * @param h media file context
diff --git a/libavformat/rtpproto.h b/libavformat/rtpproto.h
index 131aac5f3c..d42327ea5c 100644
--- a/libavformat/rtpproto.h
+++ b/libavformat/rtpproto.h
@@ -27,4 +27,6 @@ int ff_rtp_set_remote_url(URLContext *h, const char *uri);
 
 int ff_rtp_get_local_rtp_port(URLContext *h);
 
+int ff_rtp_get_remote_rtcp_port(URLContext *h);
+
 #endif /* AVFORMAT_RTPPROTO_H */
diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index 34e9839b67..c3c2909090 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -26,11 +26,13 @@
 #include "libavutil/opt.h"
 #include "libavcodec/xiph.h"
 #include "libavcodec/mpeg4audio.h"
+#include "avio_internal.h"
 #include "avformat.h"
 #include "internal.h"
 #include "avc.h"
 #include "hevc.h"
 #include "rtp.h"
+#include "rtpproto.h"
 #if CONFIG_NETWORK
 #include "network.h"
 #endif
@@ -480,10 +482,16 @@ static char *latm_context2config(AVFormatContext *s, 
AVCodecParameters *par)
 return config;
 }
 
-static char *sdp_write_media_attributes(char *buff, int size, AVStream *st, 
int payload_type, AVFormatContext *fmt)
+static char *sdp_write_media_attributes(char *buff, int size, AVStream *st, 
int payload_type, AVFormatContext *fmt, int port)
 {
 char *config = NULL;
 AVCodecParameters *p = st->codecpar;
+URLContext* url_ctx = ffio_geturlcontext(fmt->pb);
+if (url_ctx) {
+int rtcp_port = ff_rtp_get_remote_rtcp_port(url_ctx);
+if (rtcp_port > 0 && rtcp_port != port+1)
+av_strlcatf(buff, size, "a=rtcp:%d\r\n", rtcp_port);
+}
 
 switch (p->codec_id) {
 case AV_CODEC_ID_DIRAC:
@@ -766,7 +774,7 @@ void ff_sdp_write_media(char *buff, int size, AVStream *st, 
int idx,
 av_strlcatf(buff, size, "b=AS:%"PRId64"\r\n", p->bit_rate / 1000);
 }
 
-sdp_write_media_attributes(buff, size, st, payload_type, fmt);
+sdp_write_media_attributes(buff, size, st, payload_type, fmt, port);
 }
 
 int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
-- 
2.17.1

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

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

Re: [FFmpeg-devel] [PATCH 1/3] avcodec: add an AVCodecContext field to signal types of packet, frame, and coded stream side data to export

2020-02-03 Thread Carl Eugen Hoyos
Am So., 2. Feb. 2020 um 23:31 Uhr schrieb James Almer :

> -{"export_mvs", "export motion vectors through frame side data", 0, 
> AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_EXPORT_MVS}, INT_MIN, INT_MAX, V|D, 
> "flags2"},
> +{"export_mvs", "export motion vectors through frame side data (Deprecated, 
> see export_side_data)", 0, AV_OPT_TYPE_CONST, {.i64 = 
> AV_CODEC_FLAG2_EXPORT_MVS}, INT_MIN, INT_MAX, V|D, "flags2"},

Is there a technical reason why this functionality has to be updated
every few years?

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] Reimbursement FOSDEM

2020-02-03 Thread Carl Eugen Hoyos
Hi!

For travelling from Vienna to FOSDEM and back, I request
re-imbursement of €282,16

Thank you, 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".

Re: [FFmpeg-devel] [PATCH 1/3] avcodec: add an AVCodecContext field to signal types of packet, frame, and coded stream side data to export

2020-02-03 Thread James Almer
On 2/3/2020 10:03 PM, Carl Eugen Hoyos wrote:
> Am So., 2. Feb. 2020 um 23:31 Uhr schrieb James Almer :
> 
>> -{"export_mvs", "export motion vectors through frame side data", 0, 
>> AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_EXPORT_MVS}, INT_MIN, INT_MAX, 
>> V|D, "flags2"},
>> +{"export_mvs", "export motion vectors through frame side data (Deprecated, 
>> see export_side_data)", 0, AV_OPT_TYPE_CONST, {.i64 = 
>> AV_CODEC_FLAG2_EXPORT_MVS}, INT_MIN, INT_MAX, V|D, "flags2"},
> 
> Is there a technical reason why this functionality has to be updated
> every few years?
> 
> Carl Eugen

I was suggested to move the flag from flags2 to the new field, as it was
a better fit for it.
It doesn't "have" to, but i guess based on your concern that this flag
had the bad luck of having been moved around before?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 1/3] avcodec: add an AVCodecContext field to signal types of packet, frame, and coded stream side data to export

2020-02-03 Thread Carl Eugen Hoyos
Am Di., 4. Feb. 2020 um 02:20 Uhr schrieb James Almer :
>
> On 2/3/2020 10:03 PM, Carl Eugen Hoyos wrote:
> > Am So., 2. Feb. 2020 um 23:31 Uhr schrieb James Almer :
> >
> >> -{"export_mvs", "export motion vectors through frame side data", 0, 
> >> AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_EXPORT_MVS}, INT_MIN, INT_MAX, 
> >> V|D, "flags2"},
> >> +{"export_mvs", "export motion vectors through frame side data 
> >> (Deprecated, see export_side_data)", 0, AV_OPT_TYPE_CONST, {.i64 = 
> >> AV_CODEC_FLAG2_EXPORT_MVS}, INT_MIN, INT_MAX, V|D, "flags2"},
> >
> > Is there a technical reason why this functionality has to be updated
> > every few years?

> I was suggested to move the flag from flags2 to the new field, as it was
> a better fit for it.

In my understanding (not being a native speaker) this sentence implies
that there (already) is another "field" that is more suitable for the
feature, I believe this is not the case.

> It doesn't "have" to, but i guess based on your concern that this flag
> had the bad luck of having been moved around before?

Correct.

In addition, I wonder how this - relatively simple - patch can block another
one. I suggest the blocked patch gets committed first, then we discuss if
this repeated movement of options makes any sense.

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

Re: [FFmpeg-devel] [PATCH v5 2/2] avcodec/libvpxenc: add a way to explicitly set temporal layer id

2020-02-03 Thread Wonkap Jang
Hi

On Mon, Feb 3, 2020 at 12:45 PM James Zern 
wrote:

> On Mon, Feb 3, 2020 at 10:02 AM Wonkap Jang
>  wrote:
> >
> > In order for rate control to correctly allocate bitrate to each temporal
> > layer, correct temporal layer id has to be set to each frame. This
> > commit provides the ability to set correct temporal layer id for each
> > frame.
> > ---
> >  libavcodec/libvpxenc.c | 13 -
> >  1 file changed, 12 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
> > index 6fca05e6b1..2093aa8bca 100644
> > --- a/libavcodec/libvpxenc.c
> > +++ b/libavcodec/libvpxenc.c
> > @@ -1519,11 +1519,22 @@ static int vpx_encode(AVCodecContext *avctx,
> AVPacket *pkt,
> >  #endif
> >  if (frame->pict_type == AV_PICTURE_TYPE_I)
> >  flags |= VPX_EFLAG_FORCE_KF;
> > -if (CONFIG_LIBVPX_VP8_ENCODER && avctx->codec_id ==
> AV_CODEC_ID_VP8 && frame->metadata) {
> > +if (frame->metadata) {
> >  AVDictionaryEntry* en = av_dict_get(frame->metadata,
> "vp8-flags", NULL, 0);
>
> I think you'll want to check the codec being used for this one still.
> ___
> 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".


You want me to check whether it is vp8 or vp9? because... the flags will
work for both, right?

If the flags work for both vp8 and vp9, the codec type doesn't have to be
checked, no?

Thanks,

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

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

Re: [FFmpeg-devel] [PATCH 1/3] avcodec: add an AVCodecContext field to signal types of packet, frame, and coded stream side data to export

2020-02-03 Thread James Almer
On 2/3/2020 10:23 PM, Carl Eugen Hoyos wrote:
> Am Di., 4. Feb. 2020 um 02:20 Uhr schrieb James Almer :
>>
>> On 2/3/2020 10:03 PM, Carl Eugen Hoyos wrote:
>>> Am So., 2. Feb. 2020 um 23:31 Uhr schrieb James Almer :
>>>
 -{"export_mvs", "export motion vectors through frame side data", 0, 
 AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_EXPORT_MVS}, INT_MIN, INT_MAX, 
 V|D, "flags2"},
 +{"export_mvs", "export motion vectors through frame side data 
 (Deprecated, see export_side_data)", 0, AV_OPT_TYPE_CONST, {.i64 = 
 AV_CODEC_FLAG2_EXPORT_MVS}, INT_MIN, INT_MAX, V|D, "flags2"},
>>>
>>> Is there a technical reason why this functionality has to be updated
>>> every few years?
> 
>> I was suggested to move the flag from flags2 to the new field, as it was
>> a better fit for it.
> 
> In my understanding (not being a native speaker) this sentence implies
> that there (already) is another "field" that is more suitable for the
> feature, I believe this is not the case.

What i tried to say is that the new field i'm introducing,
export_side_data, is a more adequate place for the export_mvs
flag/functionality than the generic flags2 field.

> 
>> It doesn't "have" to, but i guess based on your concern that this flag
>> had the bad luck of having been moved around before?
> 
> Correct.
> 
> In addition, I wonder how this - relatively simple - patch can block another
> one. I suggest the blocked patch gets committed first, then we discuss if
> this repeated movement of options makes any sense.

Sure, i can do that.

> 
> 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] [PATCH] Update HDR10+ metadata structure.

2020-02-03 Thread Mohammad Izadi
James, I am making another CL to comply with API.
I have a question about using GetBitContext and PutBitContext. Is there any
alternative to use in libavutil?
--
Best,
Mohammad


On Mon, Jan 27, 2020 at 11:50 AM James Almer  wrote:

> On 1/27/2020 4:08 PM, Mohammad Izadi wrote:
> > From: Mohammad Izadi 
> >
> > Trying to read HDR10+ metadata from HEVC/SEI and pass it to packet side
> data in the follow-up CLs.
> > ---
> >  libavutil/hdr_dynamic_metadata.c | 386 +++
> >  libavutil/hdr_dynamic_metadata.h |  51 +++-
> >  libavutil/version.h  |   2 +-
> >  3 files changed, 431 insertions(+), 8 deletions(-)
> >
> > diff --git a/libavutil/hdr_dynamic_metadata.c
> b/libavutil/hdr_dynamic_metadata.c
> > index 0fa1ee82de..e321a22af8 100644
> > --- a/libavutil/hdr_dynamic_metadata.c
> > +++ b/libavutil/hdr_dynamic_metadata.c
> > @@ -21,6 +21,19 @@
> >  #include "hdr_dynamic_metadata.h"
> >  #include "mem.h"
> >
> > +static const uint8_t usa_country_code = 0xB5;
> > +static const uint16_t smpte_provider_code = 0x003C;
> > +static const uint16_t smpte2094_40_provider_oriented_code = 0x0001;
> > +static const uint16_t smpte2094_40_application_identifier = 0x04;
> > +
> > +static const int64_t luminance_den = 1;
> > +static const int32_t peak_luminance_den = 15;
> > +static const int64_t rgb_den = 10;
> > +static const int32_t fraction_pixel_den = 1000;
> > +static const int32_t knee_point_den = 4095;
> > +static const int32_t bezier_anchor_den = 1023;
> > +static const int32_t saturation_weight_den = 8;
> > +
> >  AVDynamicHDRPlus *av_dynamic_hdr_plus_alloc(size_t *size)
> >  {
> >  AVDynamicHDRPlus *hdr_plus = av_mallocz(sizeof(AVDynamicHDRPlus));
> > @@ -33,6 +46,48 @@ AVDynamicHDRPlus *av_dynamic_hdr_plus_alloc(size_t
> *size)
> >  return hdr_plus;
> >  }
> >
> > +AVDynamicHDRPlus *av_dynamic_hdr_plus(GetBitContext *gb, size_t *size)
> > +{
> > +uint8_t country_code;
> > +uint16_t provider_code;
> > +uint16_t provider_oriented_code;
> > +uint8_t application_identifier;
> > +uint8_t application_version;
> > +AVDynamicHDRPlus *hdr_plus;
> > +int err;
> > +
> > +if (get_bits_left(gb) < 7)
> > +return NULL;
> > +
> > +country_code = get_bits(gb, 8);
> > +provider_code = get_bits(gb, 16);
> > +
> > +if (country_code != usa_country_code ||
> > +provider_code != smpte_provider_code)
> > +return NULL;
> > +
> > +// A/341 Amendment – 2094-40
> > +provider_oriented_code = get_bits(gb, 16);
> > +application_identifier = get_bits(gb, 8);
> > +application_version  = get_bits(gb, 8);
> > +if (provider_oriented_code != smpte2094_40_provider_oriented_code ||
> > +application_identifier != smpte2094_40_application_identifier)
> > +return NULL;
> > +
> > +hdr_plus = av_dynamic_hdr_plus_alloc(size);
> > +if (!hdr_plus)
> > +return NULL;
> > +
> > +hdr_plus->application_version = application_version;
> > +err = decode_itu_t_t35_to_dynamic_hdr_plus(gb, hdr_plus);
> > +if (err < 0) {
> > +av_freep(&hdr_plus);
> > +return NULL;
> > +}
> > +
> > +return hdr_plus;
> > +}
> > +
> >  AVDynamicHDRPlus *av_dynamic_hdr_plus_create_side_data(AVFrame *frame)
> >  {
> >  AVFrameSideData *side_data = av_frame_new_side_data(frame,
> > @@ -43,5 +98,336 @@ AVDynamicHDRPlus
> *av_dynamic_hdr_plus_create_side_data(AVFrame *frame)
> >
> >  memset(side_data->data, 0, sizeof(AVDynamicHDRPlus));
> >
> > +
> >  return (AVDynamicHDRPlus *)side_data->data;
> >  }
> > +
> > +int decode_itu_t_t35_to_dynamic_hdr_plus(GetBitContext *gb,
> AVDynamicHDRPlus *s)
> > +{
> > +int w, i, j;
> > +
> > +if (get_bits_left(gb) < 2)
> > +return AVERROR_INVALIDDATA;
> > +s->num_windows = get_bits(gb, 2);
> > +
> > +if (s->num_windows < 1 || s->num_windows > 3) {
> > +return AVERROR_INVALIDDATA;
> > +}
> > +
> > +if (get_bits_left(gb) < ((19 * 8 + 1) * (s->num_windows - 1)))
> > +return AVERROR_INVALIDDATA;
> > +for (w = 1; w < s->num_windows; w++) {
> > +s->params[w].window_upper_left_corner_x.num = get_bits(gb, 16);
> > +s->params[w].window_upper_left_corner_y.num = get_bits(gb, 16);
> > +s->params[w].window_lower_right_corner_x.num = get_bits(gb, 16);
> > +s->params[w].window_lower_right_corner_y.num = get_bits(gb, 16);
> > +// The corners are set to absolute coordinates here. They
> should be
> > +// converted to the relative coordinates (in [0, 1]) in the
> decoder.
> > +s->params[w].window_upper_left_corner_x.den = 1;
> > +s->params[w].window_upper_left_corner_y.den = 1;
> > +s->params[w].window_lower_right_corner_x.den = 1;
> > +s->params[w].window_lower_right_corner_y.den = 1;
> > +
> > +s->params[w].center_of_ellipse_x = get_bits(gb, 16);
> > +s->params[w].center_of_ellipse_y = get_bits(gb, 16);
> > +

[FFmpeg-devel] [PATCH] fate/adpcm: add adpcm_argo tests

2020-02-03 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 tests/fate/adpcm.mak | 6 ++
 tests/ref/fate/adpcm-argo-mono   | 1 +
 tests/ref/fate/adpcm-argo-stereo | 1 +
 3 files changed, 8 insertions(+)
 create mode 100644 tests/ref/fate/adpcm-argo-mono
 create mode 100644 tests/ref/fate/adpcm-argo-stereo

diff --git a/tests/fate/adpcm.mak b/tests/fate/adpcm.mak
index b64920d4fe..cbf276190e 100644
--- a/tests/fate/adpcm.mak
+++ b/tests/fate/adpcm.mak
@@ -88,5 +88,11 @@ fate-adpcm-vima: CMD = framecrc -i 
$(TARGET_SAMPLES)/smush/ronin_part.znm -vn
 FATE_ADPCM-$(call DEMDEC, STR, ADPCM_XA) += fate-adpcm-xa
 fate-adpcm-xa: CMD = framecrc -i $(TARGET_SAMPLES)/psx-str/abc000_cut.str -vn
 
+FATE_ADPCM-$(call DEMDEC, ARGO_ASF, ADPCM_ARGO) += fate-adpcm-argo-mono
+fate-adpcm-argo-mono: CMD = md5 -i $(TARGET_SAMPLES)/argo-asf/PWIN22M.ASF -f 
s16le
+
+FATE_ADPCM-$(call DEMDEC, ARGO_ASF, ADPCM_ARGO) += fate-adpcm-argo-stereo
+fate-adpcm-argo-stereo: CMD = md5 -i $(TARGET_SAMPLES)/argo-asf/CBK2_cut.asf 
-f s16le
+
 FATE_SAMPLES_AVCONV += $(FATE_ADPCM-yes)
 fate-adpcm: $(FATE_ADPCM-yes)
diff --git a/tests/ref/fate/adpcm-argo-mono b/tests/ref/fate/adpcm-argo-mono
new file mode 100644
index 00..b9a142f3f4
--- /dev/null
+++ b/tests/ref/fate/adpcm-argo-mono
@@ -0,0 +1 @@
+3876d24a376b1ab1f6d207b7abda635e
diff --git a/tests/ref/fate/adpcm-argo-stereo b/tests/ref/fate/adpcm-argo-stereo
new file mode 100644
index 00..e0efa5192b
--- /dev/null
+++ b/tests/ref/fate/adpcm-argo-stereo
@@ -0,0 +1 @@
+53ad310be0175583a5c3c0e5fe341b18
-- 
2.17.1


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

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

Re: [FFmpeg-devel] [PATCH] Update HDR10+ metadata structure.

2020-02-03 Thread James Almer
On 2/3/2020 11:01 PM, Mohammad Izadi wrote:
> James, I am making another CL to comply with API.
> I have a question about using GetBitContext and PutBitContext. Is there any
> alternative to use in libavutil?

You can use it in libavutil as long as it's not part of the public API.
So you should make the new public functions take size_t and uint8_t*
parameters, then use get/putbits internally in the implementation if needed.

Also, all public functions must use an av_ prefix.

> --
> Best,
> Mohammad
> 
> 
> On Mon, Jan 27, 2020 at 11:50 AM James Almer  wrote:
> 
>> On 1/27/2020 4:08 PM, Mohammad Izadi wrote:
>>> From: Mohammad Izadi 
>>>
>>> Trying to read HDR10+ metadata from HEVC/SEI and pass it to packet side
>> data in the follow-up CLs.
>>> ---
>>>  libavutil/hdr_dynamic_metadata.c | 386 +++
>>>  libavutil/hdr_dynamic_metadata.h |  51 +++-
>>>  libavutil/version.h  |   2 +-
>>>  3 files changed, 431 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/libavutil/hdr_dynamic_metadata.c
>> b/libavutil/hdr_dynamic_metadata.c
>>> index 0fa1ee82de..e321a22af8 100644
>>> --- a/libavutil/hdr_dynamic_metadata.c
>>> +++ b/libavutil/hdr_dynamic_metadata.c
>>> @@ -21,6 +21,19 @@
>>>  #include "hdr_dynamic_metadata.h"
>>>  #include "mem.h"
>>>
>>> +static const uint8_t usa_country_code = 0xB5;
>>> +static const uint16_t smpte_provider_code = 0x003C;
>>> +static const uint16_t smpte2094_40_provider_oriented_code = 0x0001;
>>> +static const uint16_t smpte2094_40_application_identifier = 0x04;
>>> +
>>> +static const int64_t luminance_den = 1;
>>> +static const int32_t peak_luminance_den = 15;
>>> +static const int64_t rgb_den = 10;
>>> +static const int32_t fraction_pixel_den = 1000;
>>> +static const int32_t knee_point_den = 4095;
>>> +static const int32_t bezier_anchor_den = 1023;
>>> +static const int32_t saturation_weight_den = 8;
>>> +
>>>  AVDynamicHDRPlus *av_dynamic_hdr_plus_alloc(size_t *size)
>>>  {
>>>  AVDynamicHDRPlus *hdr_plus = av_mallocz(sizeof(AVDynamicHDRPlus));
>>> @@ -33,6 +46,48 @@ AVDynamicHDRPlus *av_dynamic_hdr_plus_alloc(size_t
>> *size)
>>>  return hdr_plus;
>>>  }
>>>
>>> +AVDynamicHDRPlus *av_dynamic_hdr_plus(GetBitContext *gb, size_t *size)
>>> +{
>>> +uint8_t country_code;
>>> +uint16_t provider_code;
>>> +uint16_t provider_oriented_code;
>>> +uint8_t application_identifier;
>>> +uint8_t application_version;
>>> +AVDynamicHDRPlus *hdr_plus;
>>> +int err;
>>> +
>>> +if (get_bits_left(gb) < 7)
>>> +return NULL;
>>> +
>>> +country_code = get_bits(gb, 8);
>>> +provider_code = get_bits(gb, 16);
>>> +
>>> +if (country_code != usa_country_code ||
>>> +provider_code != smpte_provider_code)
>>> +return NULL;
>>> +
>>> +// A/341 Amendment – 2094-40
>>> +provider_oriented_code = get_bits(gb, 16);
>>> +application_identifier = get_bits(gb, 8);
>>> +application_version  = get_bits(gb, 8);
>>> +if (provider_oriented_code != smpte2094_40_provider_oriented_code ||
>>> +application_identifier != smpte2094_40_application_identifier)
>>> +return NULL;
>>> +
>>> +hdr_plus = av_dynamic_hdr_plus_alloc(size);
>>> +if (!hdr_plus)
>>> +return NULL;
>>> +
>>> +hdr_plus->application_version = application_version;
>>> +err = decode_itu_t_t35_to_dynamic_hdr_plus(gb, hdr_plus);
>>> +if (err < 0) {
>>> +av_freep(&hdr_plus);
>>> +return NULL;
>>> +}
>>> +
>>> +return hdr_plus;
>>> +}
>>> +
>>>  AVDynamicHDRPlus *av_dynamic_hdr_plus_create_side_data(AVFrame *frame)
>>>  {
>>>  AVFrameSideData *side_data = av_frame_new_side_data(frame,
>>> @@ -43,5 +98,336 @@ AVDynamicHDRPlus
>> *av_dynamic_hdr_plus_create_side_data(AVFrame *frame)
>>>
>>>  memset(side_data->data, 0, sizeof(AVDynamicHDRPlus));
>>>
>>> +
>>>  return (AVDynamicHDRPlus *)side_data->data;
>>>  }
>>> +
>>> +int decode_itu_t_t35_to_dynamic_hdr_plus(GetBitContext *gb,
>> AVDynamicHDRPlus *s)
>>> +{
>>> +int w, i, j;
>>> +
>>> +if (get_bits_left(gb) < 2)
>>> +return AVERROR_INVALIDDATA;
>>> +s->num_windows = get_bits(gb, 2);
>>> +
>>> +if (s->num_windows < 1 || s->num_windows > 3) {
>>> +return AVERROR_INVALIDDATA;
>>> +}
>>> +
>>> +if (get_bits_left(gb) < ((19 * 8 + 1) * (s->num_windows - 1)))
>>> +return AVERROR_INVALIDDATA;
>>> +for (w = 1; w < s->num_windows; w++) {
>>> +s->params[w].window_upper_left_corner_x.num = get_bits(gb, 16);
>>> +s->params[w].window_upper_left_corner_y.num = get_bits(gb, 16);
>>> +s->params[w].window_lower_right_corner_x.num = get_bits(gb, 16);
>>> +s->params[w].window_lower_right_corner_y.num = get_bits(gb, 16);
>>> +// The corners are set to absolute coordinates here. They
>> should be
>>> +// converted to the relative coordinates (in [0, 1]) in the
>> decoder.
>>> +s->params[w].window_upper_left_corner_x.den 

Re: [FFmpeg-devel] [PATCH] Update HDR10+ metadata structure.

2020-02-03 Thread Mohammad Izadi
Great! Thanks!

On Mon, Feb 3, 2020, 6:37 PM James Almer  wrote:

> On 2/3/2020 11:01 PM, Mohammad Izadi wrote:
> > James, I am making another CL to comply with API.
> > I have a question about using GetBitContext and PutBitContext. Is there
> any
> > alternative to use in libavutil?
>
> You can use it in libavutil as long as it's not part of the public API.
> So you should make the new public functions take size_t and uint8_t*
> parameters, then use get/putbits internally in the implementation if
> needed.
>
> Also, all public functions must use an av_ prefix.
>
> > --
> > Best,
> > Mohammad
> >
> >
> > On Mon, Jan 27, 2020 at 11:50 AM James Almer  wrote:
> >
> >> On 1/27/2020 4:08 PM, Mohammad Izadi wrote:
> >>> From: Mohammad Izadi 
> >>>
> >>> Trying to read HDR10+ metadata from HEVC/SEI and pass it to packet side
> >> data in the follow-up CLs.
> >>> ---
> >>>  libavutil/hdr_dynamic_metadata.c | 386 +++
> >>>  libavutil/hdr_dynamic_metadata.h |  51 +++-
> >>>  libavutil/version.h  |   2 +-
> >>>  3 files changed, 431 insertions(+), 8 deletions(-)
> >>>
> >>> diff --git a/libavutil/hdr_dynamic_metadata.c
> >> b/libavutil/hdr_dynamic_metadata.c
> >>> index 0fa1ee82de..e321a22af8 100644
> >>> --- a/libavutil/hdr_dynamic_metadata.c
> >>> +++ b/libavutil/hdr_dynamic_metadata.c
> >>> @@ -21,6 +21,19 @@
> >>>  #include "hdr_dynamic_metadata.h"
> >>>  #include "mem.h"
> >>>
> >>> +static const uint8_t usa_country_code = 0xB5;
> >>> +static const uint16_t smpte_provider_code = 0x003C;
> >>> +static const uint16_t smpte2094_40_provider_oriented_code = 0x0001;
> >>> +static const uint16_t smpte2094_40_application_identifier = 0x04;
> >>> +
> >>> +static const int64_t luminance_den = 1;
> >>> +static const int32_t peak_luminance_den = 15;
> >>> +static const int64_t rgb_den = 10;
> >>> +static const int32_t fraction_pixel_den = 1000;
> >>> +static const int32_t knee_point_den = 4095;
> >>> +static const int32_t bezier_anchor_den = 1023;
> >>> +static const int32_t saturation_weight_den = 8;
> >>> +
> >>>  AVDynamicHDRPlus *av_dynamic_hdr_plus_alloc(size_t *size)
> >>>  {
> >>>  AVDynamicHDRPlus *hdr_plus = av_mallocz(sizeof(AVDynamicHDRPlus));
> >>> @@ -33,6 +46,48 @@ AVDynamicHDRPlus *av_dynamic_hdr_plus_alloc(size_t
> >> *size)
> >>>  return hdr_plus;
> >>>  }
> >>>
> >>> +AVDynamicHDRPlus *av_dynamic_hdr_plus(GetBitContext *gb, size_t *size)
> >>> +{
> >>> +uint8_t country_code;
> >>> +uint16_t provider_code;
> >>> +uint16_t provider_oriented_code;
> >>> +uint8_t application_identifier;
> >>> +uint8_t application_version;
> >>> +AVDynamicHDRPlus *hdr_plus;
> >>> +int err;
> >>> +
> >>> +if (get_bits_left(gb) < 7)
> >>> +return NULL;
> >>> +
> >>> +country_code = get_bits(gb, 8);
> >>> +provider_code = get_bits(gb, 16);
> >>> +
> >>> +if (country_code != usa_country_code ||
> >>> +provider_code != smpte_provider_code)
> >>> +return NULL;
> >>> +
> >>> +// A/341 Amendment – 2094-40
> >>> +provider_oriented_code = get_bits(gb, 16);
> >>> +application_identifier = get_bits(gb, 8);
> >>> +application_version  = get_bits(gb, 8);
> >>> +if (provider_oriented_code != smpte2094_40_provider_oriented_code
> ||
> >>> +application_identifier != smpte2094_40_application_identifier)
> >>> +return NULL;
> >>> +
> >>> +hdr_plus = av_dynamic_hdr_plus_alloc(size);
> >>> +if (!hdr_plus)
> >>> +return NULL;
> >>> +
> >>> +hdr_plus->application_version = application_version;
> >>> +err = decode_itu_t_t35_to_dynamic_hdr_plus(gb, hdr_plus);
> >>> +if (err < 0) {
> >>> +av_freep(&hdr_plus);
> >>> +return NULL;
> >>> +}
> >>> +
> >>> +return hdr_plus;
> >>> +}
> >>> +
> >>>  AVDynamicHDRPlus *av_dynamic_hdr_plus_create_side_data(AVFrame *frame)
> >>>  {
> >>>  AVFrameSideData *side_data = av_frame_new_side_data(frame,
> >>> @@ -43,5 +98,336 @@ AVDynamicHDRPlus
> >> *av_dynamic_hdr_plus_create_side_data(AVFrame *frame)
> >>>
> >>>  memset(side_data->data, 0, sizeof(AVDynamicHDRPlus));
> >>>
> >>> +
> >>>  return (AVDynamicHDRPlus *)side_data->data;
> >>>  }
> >>> +
> >>> +int decode_itu_t_t35_to_dynamic_hdr_plus(GetBitContext *gb,
> >> AVDynamicHDRPlus *s)
> >>> +{
> >>> +int w, i, j;
> >>> +
> >>> +if (get_bits_left(gb) < 2)
> >>> +return AVERROR_INVALIDDATA;
> >>> +s->num_windows = get_bits(gb, 2);
> >>> +
> >>> +if (s->num_windows < 1 || s->num_windows > 3) {
> >>> +return AVERROR_INVALIDDATA;
> >>> +}
> >>> +
> >>> +if (get_bits_left(gb) < ((19 * 8 + 1) * (s->num_windows - 1)))
> >>> +return AVERROR_INVALIDDATA;
> >>> +for (w = 1; w < s->num_windows; w++) {
> >>> +s->params[w].window_upper_left_corner_x.num = get_bits(gb,
> 16);
> >>> +s->params[w].window_upper_left_corner_y.num = get_bits(gb,
> 16);
> >>> +s->params[w].window_lower_right_cor