Re: [FFmpeg-devel] [PATCH v2 1/3] avfilter: add v360 filter

2019-08-14 Thread Li, Zhong
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> Of Eugene Lyapustin
> Sent: Wednesday, August 14, 2019 9:14 AM
> To: ffmpeg-devel@ffmpeg.org
> Subject: [FFmpeg-devel] [PATCH v2 1/3] avfilter: add v360 filter
> 
> Signed-off-by: Eugene Lyapustin 
> ---
>  doc/filters.texi |  137 +++
>  libavfilter/Makefile |1 +
>  libavfilter/allfilters.c |1 +
>  libavfilter/vf_v360.c| 1847
> ++

Probably you also want to update the Changelog?

>  4 files changed, 1986 insertions(+)
>  create mode 100644 libavfilter/vf_v360.c
>
> diff --git a/doc/filters.texi b/doc/filters.texi
> index e081cdc7bc..6168a3502a 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -17879,6 +17879,143 @@ Force a constant quantization parameter. If
> not set, the filter will use the QP
>  from the video stream (if available).
>  @end table
> 
> +@section v360
> +
> +Convert 360 videos between various formats.
> +
> +The filter accepts the following options:
> +
> +@table @option
> +
> +@item input
> +@item output
> +Set format of the input/output video.
> +
> +Available formats:
> +
> +@table @samp
> +
> +@item e
> +Equirectangular projection.
> +
> +@item c3x2
> +@item c6x1
> +Cubemap with 3x2/6x1 layout.
> +
> +Format specific options:
> +
> +@table @option
> +@item in_forder
> +@item out_forder
> +Set order of faces for the input/output cubemap. Choose one direction for
> each position.
> +
> +Designation of directions:
> +@table @samp
> +@item r
> +right
> +@item l
> +left
> +@item u
> +up
> +@item d
> +down
> +@item f
> +forward
> +@item b
> +back
> +@end table
> +
> +Default value is @b{@samp{rludfb}}.
> +
> +@item in_frot
> +@item out_frot
> +Set rotation of faces for the input/output cubemap. Choose one angle for
> each position.
> +
> +Designation of angles:
> +@table @samp
> +@item 0
> +0 degrees clockwise
> +@item 1
> +90 degrees clockwise
> +@item 2
> +180 degrees clockwise
> +@item 4
> +270 degrees clockwise
> +@end table
> +
> +Default value is @b{@samp{00}}.
> +@end table
> +
> +@item eac
> +Equi-Angular Cubemap.
> +
> +@item flat
> +Regular video. @i{(output only)}
> +
> +Format specific options:
> +@table @option
> +@item h_fov
> +@item v_fov
> +Set horizontal/vertical field of view. Values in degrees.
> +@end table
> +@end table
> +
> +@item interp
> +Set interpolation method.@*
> +@i{Note: more complex interpolation methods require much more memory
> to run.}
> +
> +Available methods:
> +
> +@table @samp
> +@item near
> +@item nearest
> +Nearest neighbour.
> +@item line
> +@item linear
> +Bilinear interpolation.
> +@item cube
> +@item cubic
> +Bicubic interpolation.
> +@item lanc
> +@item lanczos
> +Lanczos interpolation.
> +@end table
> +
> +Default value is @b{@samp{line}}.
> +
> +@item w
> +@item h
> +Set the output video resolution.
> +
> +Default resolution depends on formats.
> +
> +@item yaw
> +@item pitch
> +@item roll
> +Set rotation for the output video. Values in degrees.
> +
> +@item hflip
> +@item vflip
> +@item dflip
> +Flip the output video horizontally/vertically/in-depth. Boolean values.
> +
> +@end table
> +
> +@subsection Examples
> +
> +@itemize
> +@item
> +Convert equirectangular video to cubemap with 3x2 layout using bicubic
> interpolation:
> +@example
> +ffmpeg -i input.mkv -vf v360=e:c3x2:cubic output.mkv
> +@end example
> +@item
> +Extract back view of Equi-Angular Cubemap:
> +@example
> +ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
> +@end example
> +@end itemize
> +
>  @section vaguedenoiser
> 
>  Apply a wavelet based denoiser.
> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index efc7bbb153..345f7c95cd 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -410,6 +410,7 @@ OBJS-$(CONFIG_UNSHARP_FILTER)
> += vf_unsharp.o
>  OBJS-$(CONFIG_UNSHARP_OPENCL_FILTER) +=
> vf_unsharp_opencl.o opencl.o \
> 
> opencl/unsharp.o
>  OBJS-$(CONFIG_USPP_FILTER)   += vf_uspp.o
> +OBJS-$(CONFIG_V360_FILTER)   += vf_v360.o
>  OBJS-$(CONFIG_VAGUEDENOISER_FILTER)  +=
> vf_vaguedenoiser.o
>  OBJS-$(CONFIG_VECTORSCOPE_FILTER)+= vf_vectorscope.o
>  OBJS-$(CONFIG_VFLIP_FILTER)  += vf_vflip.o
> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> index abd726d616..5799fb4b3c 100644
> --- a/libavfilter/allfilters.c
> +++ b/libavfilter/allfilters.c
> @@ -390,6 +390,7 @@ extern AVFilter ff_vf_unpremultiply;
>  extern AVFilter ff_vf_unsharp;
>  extern AVFilter ff_vf_unsharp_opencl;
>  extern AVFilter ff_vf_uspp;
> +extern AVFilter ff_vf_v360;
>  extern AVFilter ff_vf_vaguedenoiser;
>  extern AVFilter ff_vf_vectorscope;
>  extern AVFilter ff_vf_vflip;
> diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
> new file mode 100644
> index 00..5c377827b0
> --- /dev/null
> +++ b/libavfilter/vf_v360.c
> @@ -0,0 +1,1847 @@
> +/*
> + * Copyright (c) 2019 Eugene Lyapustin
> + *
> + * This file is pa

[FFmpeg-devel] [PATCH 1/3] tools/target_dec_fuzzer: Adjust GDV pixel threshold down by a factor of 2

2019-08-14 Thread Michael Niedermayer
Fixes: Timeout (7sec -> 1sec)
Fixes: 
14709/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_GDV_fuzzer-5704215281795072

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 tools/target_dec_fuzzer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index e6eed88781..b3a12f8a63 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -173,7 +173,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 case AV_CODEC_ID_QTRLE: maxpixels /= 16;  break;
 case AV_CODEC_ID_GIF:   maxpixels /= 16;  break;
 // Performs slow frame rescaling in C
-case AV_CODEC_ID_GDV:   maxpixels /= 256; break;
+case AV_CODEC_ID_GDV:   maxpixels /= 512; break;
 // Postprocessing in C
 case AV_CODEC_ID_HNM4_VIDEO:maxpixels /= 128; break;
 }
-- 
2.22.1

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

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

[FFmpeg-devel] [PATCH 3/3] avcodec/ivi: Allocate bufs later

2019-08-14 Thread Michael Niedermayer
Fixes: Timeout (24sec->2sec)
Fixes: 
15951/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INDEO5_fuzzer-5095433266790400

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

diff --git a/libavcodec/ivi.c b/libavcodec/ivi.c
index 73fcf51b7b..18192cbf23 100644
--- a/libavcodec/ivi.c
+++ b/libavcodec/ivi.c
@@ -354,23 +354,11 @@ av_cold int ff_ivi_init_planes(AVCodecContext *avctx, 
IVIPlaneDesc *planes, cons
 band->height   = b_height;
 band->pitch= width_aligned;
 band->aheight  = height_aligned;
-band->bufs[0]  = av_mallocz(buf_size);
-band->bufs[1]  = av_mallocz(buf_size);
+av_assert0(!band->bufs[0] && !band->bufs[1] &&
+   !band->bufs[2] && !band->bufs[3]);
 band->bufsize  = buf_size/2;
-if (!band->bufs[0] || !band->bufs[1])
-return AVERROR(ENOMEM);
+av_assert0(buf_size % 2 == 0);
 
-/* allocate the 3rd band buffer for scalability mode */
-if (cfg->luma_bands > 1) {
-band->bufs[2] = av_mallocz(buf_size);
-if (!band->bufs[2])
-return AVERROR(ENOMEM);
-}
-if (is_indeo4) {
-band->bufs[3]  = av_mallocz(buf_size);
-if (!band->bufs[3])
-return AVERROR(ENOMEM);
-}
 /* reset custom vlc */
 planes[p].bands[0].blk_vlc.cust_desc.num_rows = 0;
 }
@@ -945,6 +933,15 @@ static void ivi_output_plane(IVIPlaneDesc *plane, uint8_t 
*dst, ptrdiff_t dst_pi
 }
 }
 
+static void *prepare_buf(IVI45DecContext *ctx, IVIBandDesc *band, int i)
+{
+if (ctx->pic_conf.luma_bands <= 1 && i == 2)
+return NULL;
+if (!band->bufs[i])
+band->bufs[i] = av_mallocz(2 * band->bufsize);
+return band->bufs[i];
+}
+
 /**
  *  Decode an Indeo 4 or 5 band.
  *
@@ -959,18 +956,22 @@ static int decode_band(IVI45DecContext *ctx,
 int result, i, t, idx1, idx2, pos;
 IVITile *tile;
 
-band->buf = band->bufs[ctx->dst_buf];
+band->buf = prepare_buf(ctx, band, ctx->dst_buf);
 if (!band->buf) {
 av_log(avctx, AV_LOG_ERROR, "Band buffer points to no data!\n");
 return AVERROR_INVALIDDATA;
 }
 if (ctx->is_indeo4 && ctx->frame_type == IVI4_FRAMETYPE_BIDIR) {
-band->ref_buf   = band->bufs[ctx->b_ref_buf];
-band->b_ref_buf = band->bufs[ctx->ref_buf];
+band->ref_buf   = prepare_buf(ctx, band, ctx->b_ref_buf);
+band->b_ref_buf = prepare_buf(ctx, band, ctx->ref_buf);
+if (!band->b_ref_buf)
+return AVERROR(ENOMEM);
 } else {
-band->ref_buf   = band->bufs[ctx->ref_buf];
+band->ref_buf   = prepare_buf(ctx, band, ctx->ref_buf);
 band->b_ref_buf = 0;
 }
+if (!band->ref_buf)
+return AVERROR(ENOMEM);
 band->data_ptr  = ctx->frame_data + (get_bits_count(&ctx->gb) >> 3);
 
 result = ctx->decode_band_hdr(ctx, band, avctx);
-- 
2.22.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] tools/target_dec_fuzzer: Adjust maxpixels for indeo4

2019-08-14 Thread Michael Niedermayer
Fixes: Timeout (131sec -> 4sec)
Fixes: 
15581/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INDEO4_fuzzer-5651105515569152

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 tools/target_dec_fuzzer.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index b3a12f8a63..5f288dc9f9 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -176,6 +176,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 case AV_CODEC_ID_GDV:   maxpixels /= 512; break;
 // Postprocessing in C
 case AV_CODEC_ID_HNM4_VIDEO:maxpixels /= 128; break;
+// Cliping in C, generally slow even with small input
+case AV_CODEC_ID_INDEO4:maxpixels /= 128; break;
 }
 
 
-- 
2.22.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] libavfilter/dnn/dnn_backend_tf: add tf.pad support for tensorflow backend with native model.

2019-08-14 Thread Guo, Yejun
Signed-off-by: Guo, Yejun 
---
 libavfilter/dnn/dnn_backend_tf.c | 47 
 1 file changed, 19 insertions(+), 28 deletions(-)

diff --git a/libavfilter/dnn/dnn_backend_tf.c b/libavfilter/dnn/dnn_backend_tf.c
index ca7434a..75dbe5e 100644
--- a/libavfilter/dnn/dnn_backend_tf.c
+++ b/libavfilter/dnn/dnn_backend_tf.c
@@ -27,6 +27,7 @@
 #include "dnn_backend_native.h"
 #include "libavformat/avio.h"
 #include "libavutil/avassert.h"
+#include "dnn_backend_native_layer_pad.h"
 
 #include 
 
@@ -347,23 +348,8 @@ static DNNReturnType add_depth_to_space_layer(TFModel 
*tf_model, TF_Operation **
 return DNN_SUCCESS;
 }
 
-static int calculate_pad(const ConvolutionalNetwork *conv_network)
-{
-ConvolutionalParams *params;
-int32_t layer;
-int pad = 0;
-
-for (layer = 0; layer < conv_network->layers_num; ++layer){
-if (conv_network->layers[layer].type == CONV){
-params = (ConvolutionalParams *)conv_network->layers[layer].params;
-pad += params->kernel_size >> 1;
-}
-}
-
-return pad;
-}
-
-static DNNReturnType add_pad_op(TFModel *tf_model, TF_Operation **cur_op, 
const int32_t pad)
+static DNNReturnType add_pad_layer(TFModel *tf_model, TF_Operation **cur_op,
+  LayerPadParams *params, const 
int layer)
 {
 TF_Operation *op;
 TF_Tensor *tensor;
@@ -374,14 +360,21 @@ static DNNReturnType add_pad_op(TFModel *tf_model, 
TF_Operation **cur_op, const
 
 input.index = 0;
 
-op_desc = TF_NewOperation(tf_model->graph, "Const", "pads");
+char name_buffer[NAME_BUFFER_SIZE];
+snprintf(name_buffer, NAME_BUFFER_SIZE, "pad%d", layer);
+
+op_desc = TF_NewOperation(tf_model->graph, "Const", name_buffer);
 TF_SetAttrType(op_desc, "dtype", TF_INT32);
 tensor = TF_AllocateTensor(TF_INT32, pads_shape, 2, 4 * 2 * 
sizeof(int32_t));
 pads = (int32_t *)TF_TensorData(tensor);
-pads[0] = 0;   pads[1] = 0;
-pads[2] = pad; pads[3] = pad;
-pads[4] = pad; pads[5] = pad;
-pads[6] = 0;   pads[7] = 0;
+pads[0] = params->paddings[0][0];
+pads[1] = params->paddings[0][1];
+pads[2] = params->paddings[1][0];
+pads[3] = params->paddings[1][1];
+pads[4] = params->paddings[2][0];
+pads[5] = params->paddings[2][1];
+pads[6] = params->paddings[3][0];
+pads[7] = params->paddings[3][1];
 TF_SetAttrTensor(op_desc, "value", tensor, tf_model->status);
 if (TF_GetCode(tf_model->status) != TF_OK){
 return DNN_ERROR;
@@ -418,7 +411,6 @@ static DNNReturnType load_native_model(TFModel *tf_model, 
const char *model_file
 int32_t *transpose_perm;
 int64_t transpose_perm_shape[] = {4};
 int64_t input_shape[] = {1, -1, -1, -1};
-int32_t pad;
 DNNReturnType layer_add_res;
 DNNModel *native_model = NULL;
 ConvolutionalNetwork *conv_network;
@@ -429,7 +421,6 @@ static DNNReturnType load_native_model(TFModel *tf_model, 
const char *model_file
 }
 
 conv_network = (ConvolutionalNetwork *)native_model->model;
-pad = calculate_pad(conv_network);
 tf_model->graph = TF_NewGraph();
 tf_model->status = TF_NewStatus();
 
@@ -448,10 +439,6 @@ static DNNReturnType load_native_model(TFModel *tf_model, 
const char *model_file
 CLEANUP_ON_ERROR(tf_model);
 }
 
-if (add_pad_op(tf_model, &op, pad) != DNN_SUCCESS){
-CLEANUP_ON_ERROR(tf_model);
-}
-
 op_desc = TF_NewOperation(tf_model->graph, "Const", "transpose_perm");
 TF_SetAttrType(op_desc, "dtype", TF_INT32);
 tensor = TF_AllocateTensor(TF_INT32, transpose_perm_shape, 1, 4 * 
sizeof(int32_t));
@@ -479,6 +466,10 @@ static DNNReturnType load_native_model(TFModel *tf_model, 
const char *model_file
 layer_add_res = add_depth_to_space_layer(tf_model, &op,
  (DepthToSpaceParams 
*)conv_network->layers[layer].params, layer);
 break;
+case MIRROR_PAD:
+layer_add_res = add_pad_layer(tf_model, &op,
+  (LayerPadParams 
*)conv_network->layers[layer].params, layer);
+break;
 default:
 CLEANUP_ON_ERROR(tf_model);
 }
-- 
2.7.4

___
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] libavfilter/dnn/dnn_backend_tf: fix typo that variable uninitialized.

2019-08-14 Thread Guo, Yejun
if it is not initialized with zero, the tensorflow lib will report
error message such as:
Attempt to add output -7920 of depth_to_space4 not in range [0, 1) to node with 
type Identity

Signed-off-by: Guo, Yejun 
---
 libavfilter/dnn/dnn_backend_tf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/dnn/dnn_backend_tf.c b/libavfilter/dnn/dnn_backend_tf.c
index ba959ae..ca7434a 100644
--- a/libavfilter/dnn/dnn_backend_tf.c
+++ b/libavfilter/dnn/dnn_backend_tf.c
@@ -490,6 +490,7 @@ static DNNReturnType load_native_model(TFModel *tf_model, 
const char *model_file
 
 op_desc = TF_NewOperation(tf_model->graph, "Identity", "y");
 input.oper = op;
+input.index = 0;
 TF_AddInput(op_desc, input);
 TF_FinishOperation(op_desc, tf_model->status);
 if (TF_GetCode(tf_model->status) != TF_OK){
-- 
2.7.4

___
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: AVEncodeInfo data structures

2019-08-14 Thread Nicolas George
James Almer (12019-08-13):
> I'm fairly sure this was discussed before, but invalid arguments
> shouldn't crash an user's application. They even have their own
> standardized errno value for this purpose.
> asserts() are to catch bugs in our code, not in theirs. Returning a NULL
> pointer is the preferred behavior.

I do not agree. Asserts are to catch all bugs that can be catched
statically. There is no sense in making some bugs harder to catch just
because they involve separate developers.

Nobody can predict whether a disk will make a I/O error, whether there
will be enough memory, etc., that kind of error MUST be handled
gracefully.

On the other hand, it is easy to make sure that a buffer given to read()
is not NULL, and therefore it is very acceptable to just crash when that
happens.

EINVAL is for cases where the acceptable value cannot be easily
predicted by the caller. For example, setting an unsupported sample rate
for the sound device: the caller could check in advance, but that would
be cumbersome.

Now, please tell me, according to you, "idx is not smaller than
nb_blocks", is it more akin to a disk I/O error, a NULL buffer or an
invalid sample rate?

Another argument:

Instead of providing utility code, we could just document the
arithmetic. In that case, the application would have code that says, in
essence: "block = info + offset + idx * block_size". No check. What
would happen if idx was too big? Not a graceful error: a crash, or
worse.

The assert mimics that, in a more convenient way since it gives the
reason and line number, and does not allow the bug to devolve into
something more serious than a crash.

Regards,

-- 
  Nicolas George


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] lavu/hwcontext_vaapi: cope with race map for YUV420P

2019-08-14 Thread Li, Zhong
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> Of Fu, Linjie
> Sent: Wednesday, August 14, 2019 9:59 AM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH] lavu/hwcontext_vaapi: cope with race
> map for YUV420P
> 
> > -Original Message-
> > From: Fu, Linjie
> > Sent: Thursday, August 1, 2019 12:45
> > To: ffmpeg-devel@ffmpeg.org
> > Cc: Fu, Linjie 
> > Subject: [PATCH] lavu/hwcontext_vaapi: cope with race map for YUV420P
> >
> > There is a race condition for AV_PIX_FMT_YUV420P when mapping from
> > pix_fmt to fourcc, both VA_FOURCC_I420 and VA_FOURCC_YV12 could be
> > find by pix_fmt.

find -> found

> > Currently, vaapi_get_image_format will go through the query results of
> > pix_fmt and returned the first matched result according to the
> > declared order in driver.This may leads to a wrong image_format.
> >
> > Modify to find image_format via fourcc.
> >
> > Fix vaapi CSC to I420:
> > ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -f rawvideo
> > -pix_fmt nv12 -s:v 1280x720 -i NV12.yuv -vf
> >
> 'format=nv12,hwupload,scale_vaapi=format=yuv420p,hwdownload,format=
> > yuv420p'
> > -f rawvideo -vsync passthrough -vframes 10 -y aa.yuv
> >
> > Signed-off-by: Linjie Fu 
> > ---
> >  libavutil/hwcontext_vaapi.c | 14 +++---
> >  1 file changed, 11 insertions(+), 3 deletions(-)
> >
> > diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
> > index cf11764..64f14de 100644
> > --- a/libavutil/hwcontext_vaapi.c
> > +++ b/libavutil/hwcontext_vaapi.c
> > @@ -63,6 +63,7 @@ typedef struct VAAPIDevicePriv {  typedef struct
> > VAAPISurfaceFormat {
> >  enum AVPixelFormat pix_fmt;
> >  VAImageFormat image_format;
> > +unsigned int fourcc;
> >  } VAAPISurfaceFormat;
> >
> >  typedef struct VAAPIDeviceContext {
> > @@ -171,15 +172,21 @@ static int
> > vaapi_get_image_format(AVHWDeviceContext *hwdev,
> >VAImageFormat
> **image_format)  {
> >  VAAPIDeviceContext *ctx = hwdev->internal->priv;
> > +VAAPIFormatDescriptor *desc;
> >  int i;
> >
> > +desc = vaapi_format_from_pix_fmt(pix_fmt);
> > +if (!desc || !image_format)
> > +goto fail;
> > +
> >  for (i = 0; i < ctx->nb_formats; i++) {
> > -if (ctx->formats[i].pix_fmt == pix_fmt) {
> > -if (image_format)
> > -*image_format = &ctx->formats[i].image_format;
> > +if (ctx->formats[i].fourcc == desc->fourcc) {
> > +*image_format = &ctx->formats[i].image_format;
> >  return 0;
> >  }
> >  }
> > +
> > +fail:
> >  return AVERROR(EINVAL);
> >  }
> >
> > @@ -368,6 +375,7 @@ static int vaapi_device_init(AVHWDeviceContext
> > *hwdev)
> >  av_log(hwdev, AV_LOG_DEBUG, "Format %#x -> %s.\n",
> > fourcc, av_get_pix_fmt_name(pix_fmt));
> >  ctx->formats[ctx->nb_formats].pix_fmt  = pix_fmt;
> > +ctx->formats[ctx->nb_formats].fourcc   = fourcc;
> >  ctx->formats[ctx->nb_formats].image_format =
> image_list[i];
> >  ++ctx->nb_formats;
> >  }
> > --
> > 2.7.4
> A gentle ping.

Patch LGTM

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

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

Re: [FFmpeg-devel] [PATCH v1] fftoos/ffmpeg_opt: avoid to display the hwaccels name twice

2019-08-14 Thread Moritz Barsnick
On Tue, Aug 13, 2019 at 21:38:41 +0800, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> fftoos/ffmpeg_opt: avoid to display the hwaccels name twice
  ^
Nit: fftools/ffmpeg_opt

Moritz
___
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 v6] avfilter/avf_aphasemeter: Add out-of-phase and mono detection

2019-08-14 Thread Moritz Barsnick
On Tue, Aug 13, 2019 at 18:01:29 +0200, Romane Lafon wrote:

> +{ "duration", "set minimum mono or out-of-phase duration in seconds", 
> OFFSET(duration), AV_OPT_TYPE_DOUBLE, {.dbl=2.}, 0, 24*60*60, FLAGS },

ffmpeg also provides a AV_OPT_TYPE_DURATION. (This may have been
discussed before - sorry if so.)

> +static inline float get_index(AVFilterLink *inlink, AVFrame *in)
> +{
> +char *index_str = av_ts2timestr(in->pts, &inlink->time_base);
> +return atof(index_str);
> +}

Just wondering: Are you sure this works? The av_ts2timestr() macro is
specifically documented as such:

  [...] the return value should be used only directly in
  function arguments but never stand-alone

Likely because it defines a buffer locally which goes out of scope.

Cheers,
Moritz
___
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] libavfilter/vf_scale: Ensure scaled video is divisible by n

2019-08-14 Thread Lars Kiesow
Hi Michael,

> will apply

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 0/1] Parsing quicktime tracks in matroska containers

2019-08-14 Thread Stanislav Ionascu
It affects all codecs which need the data stored in stsd sub-atoms (and
which mkvtoolnix is unable to extract). So far it's the case for dvh1, and
these are hvcC and dvcC.
The patch proposes to rely on the existing methods from
avformat/isom, instead of parsing those (again) in matroskadec.

Thanks!
Stan.



On Tue, Aug 13, 2019 at 9:35 PM Kieran O Leary 
wrote:

> On Tue, 13 Aug 2019, 20:25 Stanislav Ionascu,  >
> wrote:
>
> > Hi All,
> >
> > when remuxing some of the mp4 files into the mkv container, not all
> > video codecs can be properly represented.
>
>
> Purely out of curiosity, what other codes does this affect?
>
> Best,
>
> Kieran O'Leary
> Irish Film Institute
> ___
> 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] MJPEG FPS

2019-08-14 Thread Daniel Kučera
Hi guys,

I'm trying to lower the latency when playing mjpeg multipart http
stream and I came to this line:
https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/mpjpegdec.c#L157

Does it mean each mjpeg stream is decoded as 25FPS? Is this desired feature?

-- 

S pozdravom / Best regards
Daniel Kucera.
___
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] lavu/hwcontext_vaapi: provide detailed warning if directly mapping fails

2019-08-14 Thread Linjie Fu
Detailed message could be helpful when using hwmap=mode=direct,format=xxx
for both qsv and vaapi.

Signed-off-by: Linjie Fu 
---
 libavutil/hwcontext_vaapi.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index cf117640f2..30c42e4385 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -747,19 +747,22 @@ static int vaapi_map_frame(AVHWFramesContext *hwfc,
 av_log(hwfc, AV_LOG_DEBUG, "Map surface %#x.\n", surface_id);
 
 if (!ctx->derive_works && (flags & AV_HWFRAME_MAP_DIRECT)) {
-// Requested direct mapping but it is not possible.
+av_log(hwfc, AV_LOG_WARNING, "Requested direct mapping but "
+"it is not possible.\n");
 return AVERROR(EINVAL);
 }
 if (dst->format == AV_PIX_FMT_NONE)
 dst->format = hwfc->sw_format;
 if (dst->format != hwfc->sw_format && (flags & AV_HWFRAME_MAP_DIRECT)) {
-// Requested direct mapping but the formats do not match.
+av_log(hwfc, AV_LOG_WARNING, "Requested direct mapping but "
+"the formats do not match.\n");
 return AVERROR(EINVAL);
 }
 
 err = vaapi_get_image_format(hwfc->device_ctx, dst->format, &image_format);
 if (err < 0) {
-// Requested format is not a valid output format.
+av_log(hwfc, AV_LOG_WARNING, "Requested format is "
+"not a valid output format.\n");
 return AVERROR(EINVAL);
 }
 
-- 
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 v2 1/3] avfilter: add v360 filter

2019-08-14 Thread Paul B Mahol
On Wed, Aug 14, 2019 at 9:01 AM Li, Zhong  wrote:

> > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> > Of Eugene Lyapustin
> > Sent: Wednesday, August 14, 2019 9:14 AM
> > To: ffmpeg-devel@ffmpeg.org
> > Subject: [FFmpeg-devel] [PATCH v2 1/3] avfilter: add v360 filter
> >
> > Signed-off-by: Eugene Lyapustin 
> > ---
> >  doc/filters.texi |  137 +++
> >  libavfilter/Makefile |1 +
> >  libavfilter/allfilters.c |1 +
> >  libavfilter/vf_v360.c| 1847
> > ++
>
> Probably you also want to update the Changelog?
>

That is job for comitter.


>
> >  4 files changed, 1986 insertions(+)
> >  create mode 100644 libavfilter/vf_v360.c
> >
> > diff --git a/doc/filters.texi b/doc/filters.texi
> > index e081cdc7bc..6168a3502a 100644
> > --- a/doc/filters.texi
> > +++ b/doc/filters.texi
> > @@ -17879,6 +17879,143 @@ Force a constant quantization parameter. If
> > not set, the filter will use the QP
> >  from the video stream (if available).
> >  @end table
> >
> > +@section v360
> > +
> > +Convert 360 videos between various formats.
> > +
> > +The filter accepts the following options:
> > +
> > +@table @option
> > +
> > +@item input
> > +@item output
> > +Set format of the input/output video.
> > +
> > +Available formats:
> > +
> > +@table @samp
> > +
> > +@item e
> > +Equirectangular projection.
> > +
> > +@item c3x2
> > +@item c6x1
> > +Cubemap with 3x2/6x1 layout.
> > +
> > +Format specific options:
> > +
> > +@table @option
> > +@item in_forder
> > +@item out_forder
> > +Set order of faces for the input/output cubemap. Choose one direction
> for
> > each position.
> > +
> > +Designation of directions:
> > +@table @samp
> > +@item r
> > +right
> > +@item l
> > +left
> > +@item u
> > +up
> > +@item d
> > +down
> > +@item f
> > +forward
> > +@item b
> > +back
> > +@end table
> > +
> > +Default value is @b{@samp{rludfb}}.
> > +
> > +@item in_frot
> > +@item out_frot
> > +Set rotation of faces for the input/output cubemap. Choose one angle for
> > each position.
> > +
> > +Designation of angles:
> > +@table @samp
> > +@item 0
> > +0 degrees clockwise
> > +@item 1
> > +90 degrees clockwise
> > +@item 2
> > +180 degrees clockwise
> > +@item 4
> > +270 degrees clockwise
> > +@end table
> > +
> > +Default value is @b{@samp{00}}.
> > +@end table
> > +
> > +@item eac
> > +Equi-Angular Cubemap.
> > +
> > +@item flat
> > +Regular video. @i{(output only)}
> > +
> > +Format specific options:
> > +@table @option
> > +@item h_fov
> > +@item v_fov
> > +Set horizontal/vertical field of view. Values in degrees.
> > +@end table
> > +@end table
> > +
> > +@item interp
> > +Set interpolation method.@*
> > +@i{Note: more complex interpolation methods require much more memory
> > to run.}
> > +
> > +Available methods:
> > +
> > +@table @samp
> > +@item near
> > +@item nearest
> > +Nearest neighbour.
> > +@item line
> > +@item linear
> > +Bilinear interpolation.
> > +@item cube
> > +@item cubic
> > +Bicubic interpolation.
> > +@item lanc
> > +@item lanczos
> > +Lanczos interpolation.
> > +@end table
> > +
> > +Default value is @b{@samp{line}}.
> > +
> > +@item w
> > +@item h
> > +Set the output video resolution.
> > +
> > +Default resolution depends on formats.
> > +
> > +@item yaw
> > +@item pitch
> > +@item roll
> > +Set rotation for the output video. Values in degrees.
> > +
> > +@item hflip
> > +@item vflip
> > +@item dflip
> > +Flip the output video horizontally/vertically/in-depth. Boolean values.
> > +
> > +@end table
> > +
> > +@subsection Examples
> > +
> > +@itemize
> > +@item
> > +Convert equirectangular video to cubemap with 3x2 layout using bicubic
> > interpolation:
> > +@example
> > +ffmpeg -i input.mkv -vf v360=e:c3x2:cubic output.mkv
> > +@end example
> > +@item
> > +Extract back view of Equi-Angular Cubemap:
> > +@example
> > +ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
> > +@end example
> > +@end itemize
> > +
> >  @section vaguedenoiser
> >
> >  Apply a wavelet based denoiser.
> > diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> > index efc7bbb153..345f7c95cd 100644
> > --- a/libavfilter/Makefile
> > +++ b/libavfilter/Makefile
> > @@ -410,6 +410,7 @@ OBJS-$(CONFIG_UNSHARP_FILTER)
> > += vf_unsharp.o
> >  OBJS-$(CONFIG_UNSHARP_OPENCL_FILTER) +=
> > vf_unsharp_opencl.o opencl.o \
> >
> > opencl/unsharp.o
> >  OBJS-$(CONFIG_USPP_FILTER)   += vf_uspp.o
> > +OBJS-$(CONFIG_V360_FILTER)   += vf_v360.o
> >  OBJS-$(CONFIG_VAGUEDENOISER_FILTER)  +=
> > vf_vaguedenoiser.o
> >  OBJS-$(CONFIG_VECTORSCOPE_FILTER)+= vf_vectorscope.o
> >  OBJS-$(CONFIG_VFLIP_FILTER)  += vf_vflip.o
> > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> > index abd726d616..5799fb4b3c 100644
> > --- a/libavfilter/allfilters.c
> > +++ b/libavfilter/allfilters.c
> > @@ -390,6 +390,7 @@ extern AVFilter ff_vf_unpremultiply;
> >  extern AVFilter ff_vf_unsharp;
> > 

Re: [FFmpeg-devel] [REQUEST] ffmpeg-security subscription

2019-08-14 Thread Paul B Mahol
On Wed, Aug 14, 2019 at 8:04 AM Reimar Döffinger 
wrote:

> On 13.08.2019, at 09:45, Paul B Mahol  wrote:
>
> > On Mon, Aug 12, 2019 at 6:15 PM Michael Niedermayer
> 
> > wrote:
> >
> >> Hi Paul
> >>
> >> On Mon, Aug 05, 2019 at 11:50:04AM +0200, Paul B Mahol wrote:
> >>> Hi,
> >>>
> >>> I here hereby request from lead FFmpeg entity to give me subscription
> to
> >>> ffmpeg-security mailing list.
> >>
> >> I am not sure who or what a "lead FFmpeg entity" is, But as iam being
> >> highlighted
> >> on IRC by you in relation to this, and as iam the most active developer
> on
> >> security issues in ffmpeg it would be inpolite from me if i didnt say
> >> something.
> >>
> >
> > You are the only one working on this.
>
> What is "this"? Michael is handling things coming in very quickly so there
> rarely is any need,
> but I believe there are more people around with experience of handling
> reported issues.
>
> >> About ffmpeg-security,
> >> Theres currently no need for more manpower to handle security issues. We
> >> have
> >> a backlog of a few days of fuzzing issues only which is shrinking. And
> no
> >> other
> >> issues besides fuzzing issues. (part of the backlog probably was the
> >> result
> >> of distractions and some longer review cycles on some patches recently)
> >> Also all patches are being posted in public so no access is needed for
> >> reviews.
> >>
> >
> > I strongly disagree. And I haven't asked if you need help.
>
> Wait, is this about the fuzzing?
> If so, I really disagree with throwing that in one pot with the handling of
> security reports that might come with a polished exploit or even are
> active in the wild
> (well, so far we've been lucky on that front to be spared that, but still).
> Maybe people disagree, but I see the fuzzing as a development tool
> primarily,
> and as such would probably consider quite different criteria applicable
> for access
> compared to the security alias in general.
> (which is again a different question from what wishes make sense to
> accomodate purely
> from an effort point of view, but there might be a point that I believe
> Michael is the only one
> with experience dealing with the fuzzer which is a non-optimal "single
> point of failure")
>
> For non-fuzzing security issues, that usually is done on a pretty much
> need-to-know basis,
> often based on who might be unavoidable to involve anyway, or who has
> access anyway.
> Thus Michael's reply of not needing help is relevant - without a need the
> default response is likely
> to involve people only on a case-by-case basis (generally, maintainers
> would and should be involved if the issue is related to their code).
>
> That is my point of view at least, not sure if distinguishing fuzzing and
> other things is controversial.
>

I strongly disagree with you. Why some people have subscription to security
mailing list and I'm not allowed also?


>
> Best regards,
> Reimar Döffinger
> ___
> 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 v2 1/3] avfilter: add v360 filter

2019-08-14 Thread Thilo Borgmann
[...]

>>> +static int config_output(AVFilterLink *outlink)
>>> +{
>>> +AVFilterContext *ctx = outlink->src;
>>> +AVFilterLink *inlink = ctx->inputs[0];
>>> +V360Context *s = ctx->priv;
>>> +const AVPixFmtDescriptor *desc =
>>> av_pix_fmt_desc_get(inlink->format);
>>> +const int depth = desc->comp[0].depth;
>>> +float remap_data_size = 0.f;
>>> +int sizeof_remap;
>>> +int err;
>>> +int p, h, w;
>>> +float hf, wf;
>>> +float mirror_modifier[3];
>>> +void (*in_transform)(const V360Context *s,
>>> + const float *vec, int width, int height,
>>> + uint16_t us[4][4], uint16_t vs[4][4], float
>>> *du, float *dv);
>>> +void (*out_transform)(const V360Context *s,
>>> +  int i, int j, int width, int height,
>>> +  float *vec);
>>> +void (*calculate_kernel)(float du, float dv, int shift, const
>> XYRemap4
>>> *r_tmp, void *r);
>>> +float rot_mat[3][3];
>>> +
>>> +switch (s->interp) {
>>> +case NEAREST:
>>> +calculate_kernel = nearest_kernel;
>>> +s->remap_slice = depth <= 8 ? remap1_8bit_slice :
>>> remap1_16bit_slice;
>>> +sizeof_remap = sizeof(XYRemap1);
>>> +break;
>>> +case BILINEAR:
>>> +calculate_kernel = bilinear_kernel;
>>> +s->remap_slice = depth <= 8 ? remap2_8bit_slice :
>>> remap2_16bit_slice;
>>> +sizeof_remap = sizeof(XYRemap2);
>>> +break;
>>> +case BICUBIC:
>>> +calculate_kernel = bicubic_kernel;
>>> +s->remap_slice = depth <= 8 ? remap4_8bit_slice :
>>> remap4_16bit_slice;
>>> +sizeof_remap = sizeof(XYRemap4);
>>> +break;
>>> +case LANCZOS:
>>> +calculate_kernel = lanczos_kernel;
>>> +s->remap_slice = depth <= 8 ? remap4_8bit_slice :
>>> remap4_16bit_slice;
>>> +sizeof_remap = sizeof(XYRemap4);
>>> +break;
>>> +}
>>> +
>>> +switch (s->in) {
>>> +case EQUIRECTANGULAR:
>>> +in_transform = xyz_to_equirect;
>>> +err = 0;
>>> +wf = inlink->w;
>>> +hf = inlink->h;
>>> +break;
>>> +case CUBEMAP_3_2:
>>> +in_transform = xyz_to_cube3x2;
>>> +err = prepare_cube_in(ctx);
>>> +wf = inlink->w / 3.f * 4.f;
>>> +hf = inlink->h;
>>> +break;
>>> +case CUBEMAP_6_1:
>>> +in_transform = xyz_to_cube6x1;
>>> +err = prepare_cube_in(ctx);
>>> +wf = inlink->w / 3.f * 2.f;
>>> +hf = inlink->h * 2.f;
>>> +break;
>>> +case EQUIANGULAR:
>>> +in_transform = xyz_to_eac;
>>> +err = prepare_eac_in(ctx);
>>> +wf = inlink->w;
>>> +hf = inlink->h / 9.f * 8.f;
>>> +break;
>>> +case FLAT:
>>> +av_log(ctx, AV_LOG_ERROR, "Flat format is not accepted as
>>> input.\n");
>>> +return AVERROR(EINVAL);
>>> +}
>>> +
>>> +if (err != 0) {
>>> +return err;
>>> +}
>>> +
>>> +switch (s->out) {
>>> +case EQUIRECTANGULAR:
>>> +out_transform = equirect_to_xyz;
>>> +err = 0;
>>> +w = roundf(wf);
>>> +h = roundf(hf);
>>> +break;
>>> +case CUBEMAP_3_2:
>>> +out_transform = cube3x2_to_xyz;
>>> +err = prepare_cube_out(ctx);
>>> +w = roundf(wf / 4.f * 3.f);
>>> +h = roundf(hf);
>>> +break;
>>> +case CUBEMAP_6_1:
>>> +out_transform = cube6x1_to_xyz;
>>> +err = prepare_cube_out(ctx);
>>> +w = roundf(wf / 2.f * 3.f);
>>> +h = roundf(hf / 2.f);
>>> +break;
>>> +case EQUIANGULAR:
>>> +out_transform = eac_to_xyz;
>>> +err = prepare_eac_out(ctx);
>>> +w = roundf(wf);
>>> +h = roundf(hf / 8.f * 9.f);
>>> +break;
>>> +case FLAT:
>>> +out_transform = flat_to_xyz;
>>> +err = prepare_flat_out(ctx);
>>> +w = roundf(wf * s->flat_range[0] / s->flat_range[1] / 2.f);
>>> +h = roundf(hf);
>>> +break;
>>> +}
>>> +
>>> +if (err != 0) {
>>> +return err;
>>> +}
>>> +
>>> +if (s->width > 0 && s->height > 0) {
>>> +w = s->width;
>>> +h = s->height;
>>> +}
>>
>> If s->width/height are checked, should handle the case of no ture,
>> Else w/h may be used but not initialized.
>>
> 
> Please try more hard to write english. I do not understand what is typed
> above.

If w and h don't have initial values at declaration. So they might never get 
set if that last if statement evaluates to false.

So he suggests to add an else case like

if (s->width > 0 && s->height > 0) {
 w = s->width;
 h = s->height;
} else {
 w = 0;
 h = 0;
}

or whatever values might make sense.

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

Re: [FFmpeg-devel] [PATCH v2 1/3] avfilter: add v360 filter

2019-08-14 Thread Paul B Mahol
On Wed, Aug 14, 2019 at 11:56 AM Thilo Borgmann 
wrote:

> [...]
>
> >>> +static int config_output(AVFilterLink *outlink)
> >>> +{
> >>> +AVFilterContext *ctx = outlink->src;
> >>> +AVFilterLink *inlink = ctx->inputs[0];
> >>> +V360Context *s = ctx->priv;
> >>> +const AVPixFmtDescriptor *desc =
> >>> av_pix_fmt_desc_get(inlink->format);
> >>> +const int depth = desc->comp[0].depth;
> >>> +float remap_data_size = 0.f;
> >>> +int sizeof_remap;
> >>> +int err;
> >>> +int p, h, w;
> >>> +float hf, wf;
> >>> +float mirror_modifier[3];
> >>> +void (*in_transform)(const V360Context *s,
> >>> + const float *vec, int width, int height,
> >>> + uint16_t us[4][4], uint16_t vs[4][4], float
> >>> *du, float *dv);
> >>> +void (*out_transform)(const V360Context *s,
> >>> +  int i, int j, int width, int height,
> >>> +  float *vec);
> >>> +void (*calculate_kernel)(float du, float dv, int shift, const
> >> XYRemap4
> >>> *r_tmp, void *r);
> >>> +float rot_mat[3][3];
> >>> +
> >>> +switch (s->interp) {
> >>> +case NEAREST:
> >>> +calculate_kernel = nearest_kernel;
> >>> +s->remap_slice = depth <= 8 ? remap1_8bit_slice :
> >>> remap1_16bit_slice;
> >>> +sizeof_remap = sizeof(XYRemap1);
> >>> +break;
> >>> +case BILINEAR:
> >>> +calculate_kernel = bilinear_kernel;
> >>> +s->remap_slice = depth <= 8 ? remap2_8bit_slice :
> >>> remap2_16bit_slice;
> >>> +sizeof_remap = sizeof(XYRemap2);
> >>> +break;
> >>> +case BICUBIC:
> >>> +calculate_kernel = bicubic_kernel;
> >>> +s->remap_slice = depth <= 8 ? remap4_8bit_slice :
> >>> remap4_16bit_slice;
> >>> +sizeof_remap = sizeof(XYRemap4);
> >>> +break;
> >>> +case LANCZOS:
> >>> +calculate_kernel = lanczos_kernel;
> >>> +s->remap_slice = depth <= 8 ? remap4_8bit_slice :
> >>> remap4_16bit_slice;
> >>> +sizeof_remap = sizeof(XYRemap4);
> >>> +break;
> >>> +}
> >>> +
> >>> +switch (s->in) {
> >>> +case EQUIRECTANGULAR:
> >>> +in_transform = xyz_to_equirect;
> >>> +err = 0;
> >>> +wf = inlink->w;
> >>> +hf = inlink->h;
> >>> +break;
> >>> +case CUBEMAP_3_2:
> >>> +in_transform = xyz_to_cube3x2;
> >>> +err = prepare_cube_in(ctx);
> >>> +wf = inlink->w / 3.f * 4.f;
> >>> +hf = inlink->h;
> >>> +break;
> >>> +case CUBEMAP_6_1:
> >>> +in_transform = xyz_to_cube6x1;
> >>> +err = prepare_cube_in(ctx);
> >>> +wf = inlink->w / 3.f * 2.f;
> >>> +hf = inlink->h * 2.f;
> >>> +break;
> >>> +case EQUIANGULAR:
> >>> +in_transform = xyz_to_eac;
> >>> +err = prepare_eac_in(ctx);
> >>> +wf = inlink->w;
> >>> +hf = inlink->h / 9.f * 8.f;
> >>> +break;
> >>> +case FLAT:
> >>> +av_log(ctx, AV_LOG_ERROR, "Flat format is not accepted as
> >>> input.\n");
> >>> +return AVERROR(EINVAL);
> >>> +}
> >>> +
> >>> +if (err != 0) {
> >>> +return err;
> >>> +}
> >>> +
> >>> +switch (s->out) {
> >>> +case EQUIRECTANGULAR:
> >>> +out_transform = equirect_to_xyz;
> >>> +err = 0;
> >>> +w = roundf(wf);
> >>> +h = roundf(hf);
> >>> +break;
> >>> +case CUBEMAP_3_2:
> >>> +out_transform = cube3x2_to_xyz;
> >>> +err = prepare_cube_out(ctx);
> >>> +w = roundf(wf / 4.f * 3.f);
> >>> +h = roundf(hf);
> >>> +break;
> >>> +case CUBEMAP_6_1:
> >>> +out_transform = cube6x1_to_xyz;
> >>> +err = prepare_cube_out(ctx);
> >>> +w = roundf(wf / 2.f * 3.f);
> >>> +h = roundf(hf / 2.f);
> >>> +break;
> >>> +case EQUIANGULAR:
> >>> +out_transform = eac_to_xyz;
> >>> +err = prepare_eac_out(ctx);
> >>> +w = roundf(wf);
> >>> +h = roundf(hf / 8.f * 9.f);
> >>> +break;
> >>> +case FLAT:
> >>> +out_transform = flat_to_xyz;
> >>> +err = prepare_flat_out(ctx);
> >>> +w = roundf(wf * s->flat_range[0] / s->flat_range[1] / 2.f);
> >>> +h = roundf(hf);
> >>> +break;
> >>> +}
> >>> +
> >>> +if (err != 0) {
> >>> +return err;
> >>> +}
> >>> +
> >>> +if (s->width > 0 && s->height > 0) {
> >>> +w = s->width;
> >>> +h = s->height;
> >>> +}
> >>
> >> If s->width/height are checked, should handle the case of no ture,
> >> Else w/h may be used but not initialized.
> >>
> >
> > Please try more hard to write english. I do not understand what is typed
> > above.
>
> If w and h don't have initial values at declaration. So they might never
> get set if that last if statement evaluates to false.
>
> So he suggests to add an else case like
>
> if (s->width > 0 && s->height > 0) {
>  w 

Re: [FFmpeg-devel] [PATCH 1/8] avcodec/cinepak: Require 1 bit per 4x4 block as minimum input

2019-08-14 Thread Tomas Härdin
mån 2019-08-12 klockan 21:17 +0200 skrev Michael Niedermayer:
> Fixes: Timeout (12sec -> 32ms)
> Fixes: 16078/clusterfuzz-testcase-minimized-
> ffmpeg_AV_CODEC_ID_CINEPAK_fuzzer-5695832885559296
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/cinepak.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavcodec/cinepak.c b/libavcodec/cinepak.c
> index aeb15de0ed..62eb794332 100644
> --- a/libavcodec/cinepak.c
> +++ b/libavcodec/cinepak.c
> @@ -356,6 +356,9 @@ static int cinepak_predecode_check
> (CinepakContext *s)
>  if (s->size < 10 + s->sega_film_skip_bytes + num_strips * 12)
>  return AVERROR_INVALIDDATA;
>  
> +if (s->size < (s->avctx->width * s->avctx->height) / (4*4*8))
> +return AVERROR_INVALIDDATA;

This is wrong if num_strips == 0, and if the MB area is != 0 mod 8. You
could merge it with the check above into something like:

if (s->size < 10 + s->sega_film_skip_bytes + num_strips * 12 +
(num_strips ? ((s->avctx->width * s->avctx->height) / 16 + 7)/8 :
0)) {
return AVERROR_INVALIDDATA;
}

The check further down could also check each strip's size, not just the
first one.

Finally, I don't think we should accept files with num_strips >
MAX_STRIPS in cinepak_decode(). We should ask for samples of them
instead.

/Tomas


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

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

Re: [FFmpeg-devel] [PATCH] libavformat/mxfenc: Allow more bitrates for NTSC IMX50

2019-08-14 Thread Tomas Härdin
tis 2019-08-13 klockan 22:03 +0200 skrev Thomas Mundt:
> Hi,
> 
> attached patch fixes ticket #8077.
> Please comment.

Probably OK, bitrates lower than 5000 are fine in D-10 according to
S356m.

> } else if ((sc->video_bit_rate >= 4840) && (sc->video_bit_rate <=
> 5000) && (mxf->time_base.den != 25)) {

You could drop the extra parentheses, else it should be fine.

The real fix is of course to add an explicit CBR mode to lavc, but
that's a bit more involved than this fix. Removing the padding from the
old code was probably a mistake, we should come up with a better
solution. Baptiste?

It bears repeating that S356m explicitly allows VBR (still intra-only)
so long as the frames are no larger than 25 and 208541 for PAL and
NTSC respectively. I don't recall whether the MXF file itself needs to
be CBR (via KLV fill).

/Tomas

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

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

Re: [FFmpeg-devel] [PATCH] avcodec/videotoolbox_hevc: avoid leaking cached_hw_frames_ctx

2019-08-14 Thread Pavel Koshevoy
On Tue, Aug 6, 2019 at 8:50 PM Pavel Koshevoy  wrote:
>
> vtctx->cached_hw_frames_ctx is unref'd in videotoolbox_uninit,
> but videotoolbox_hevc used ff_videotoolbox_uninit which
> doesn't unref cache_hw_frames_ctx.
> ---
>  libavcodec/videotoolbox.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
> index c718e82cc5..acaeef77dd 100644
> --- a/libavcodec/videotoolbox.c
> +++ b/libavcodec/videotoolbox.c
> @@ -1143,7 +1143,7 @@ const AVHWAccel ff_hevc_videotoolbox_hwaccel = {
>  .end_frame  = videotoolbox_hevc_end_frame,
>  .frame_params   = videotoolbox_frame_params,
>  .init   = videotoolbox_common_init,
> -.uninit = ff_videotoolbox_uninit,
> +.uninit = videotoolbox_uninit,
>  .priv_data_size = sizeof(VTContext),
>  };
>
> --
> 2.16.4
>


Ping.  It's a 1-line leak fix ... is there any reason this should not
be applied?

Thank you,
Pavel.
___
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] fftoos/ffmpeg_opt: avoid to display the hwaccels name twice

2019-08-14 Thread Limin Wang
On Wed, Aug 14, 2019 at 10:22:26AM +0200, Moritz Barsnick wrote:
> On Tue, Aug 13, 2019 at 21:38:41 +0800, lance.lmw...@gmail.com wrote:
> > From: Limin Wang 
> > fftoos/ffmpeg_opt: avoid to display the hwaccels name twice
>   ^
> Nit: fftools/ffmpeg_opt

Sorry, have updated the patch.

> 
> Moritz
> ___
> 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 v1] fftoos/ffmpeg_opt: avoid to display the hwaccels name twice

2019-08-14 Thread Carl Eugen Hoyos
Am Di., 13. Aug. 2019 um 15:39 Uhr schrieb :
>
> From: Limin Wang 
>
> videotoolbox and qsv have been defined by hw_type_names[] in hwcontext.c

Please mention ticket #7464 in the commit message if this patch
is supposed to fix it.

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 v1] fftools/ffmpeg_opt: avoid to display the hwaccels name twice

2019-08-14 Thread lance . lmwang
From: Limin Wang 

videotoolbox and qsv have been defined by hw_type_names[] in hwcontext.c

Signed-off-by: Limin Wang 
---
 fftools/ffmpeg_opt.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index f5ca18a..8baa898 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -66,12 +66,6 @@
 }
 
 const HWAccel hwaccels[] = {
-#if CONFIG_VIDEOTOOLBOX
-{ "videotoolbox", videotoolbox_init, HWACCEL_VIDEOTOOLBOX, 
AV_PIX_FMT_VIDEOTOOLBOX },
-#endif
-#if CONFIG_LIBMFX
-{ "qsv",   qsv_init,   HWACCEL_QSV,   AV_PIX_FMT_QSV },
-#endif
 #if CONFIG_CUVID
 { "cuvid", cuvid_init, HWACCEL_CUVID, AV_PIX_FMT_CUDA },
 #endif
-- 
2.6.4

___
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/1] Support new SRT streamid specification

2019-08-14 Thread Aaron Boxer
This patch supports the new SRT streamid spec allowing caller to send
key/value pairs
of parameters to the listener, including user name. A callback parses the
streamid
 - in this case, the parsers chooses the passphrase for the user based on
specified list
of passphrases.

Thanks,
Aaron
From a28ef3c7d7d02b273786a659f9e1d468fd29d0a5 Mon Sep 17 00:00:00 2001
From: Aaron Boxer 
Date: Wed, 14 Aug 2019 08:26:17 -0400
Subject: [PATCH] libsrt: support streamid spec

---
 libavformat/libsrt.c | 131 +++
 1 file changed, 131 insertions(+)

diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
index b5568089fa..02fd840b37 100644
--- a/libavformat/libsrt.c
+++ b/libavformat/libsrt.c
@@ -34,6 +34,9 @@
 #include "os_support.h"
 #include "url.h"
 
+
+static srt_listen_callback_fn libsrt_listen_callback;
+
 /* This is for MPEG-TS and it's a default SRTO_PAYLOADSIZE for SRTT_LIVE (8 TS packets) */
 #ifndef SRT_LIVE_DEFAULT_PAYLOAD_SIZE
 #define SRT_LIVE_DEFAULT_PAYLOAD_SIZE 1316
@@ -62,6 +65,7 @@ typedef struct SRTContext {
 int64_t maxbw;
 int pbkeylen;
 char *passphrase;
+char* user_passphrase_list;
 int mss;
 int ffs;
 int ipttl;
@@ -101,6 +105,7 @@ static const AVOption libsrt_options[] = {
 { "maxbw",  "Maximum bandwidth (bytes per second) that the connection can use", OFFSET(maxbw),AV_OPT_TYPE_INT64,{ .i64 = -1 }, -1, INT64_MAX, .flags = D|E },
 { "pbkeylen",   "Crypto key len in bytes {16,24,32} Default: 16 (128-bit)", OFFSET(pbkeylen), AV_OPT_TYPE_INT,  { .i64 = -1 }, -1, 32,.flags = D|E },
 { "passphrase", "Crypto PBKDF2 Passphrase size[0,10..64] 0:disable crypto", OFFSET(passphrase),   AV_OPT_TYPE_STRING,   { .str = NULL },  .flags = D|E },
+{ "user_passphrase_list", "Comma separated list users and passphrases, of form usrr1=pass1,usr2=pass2,...", OFFSET(user_passphrase_list),   AV_OPT_TYPE_STRING,   { .str = NULL },  .flags = D|E },
 { "mss","The Maximum Segment Size", OFFSET(mss),  AV_OPT_TYPE_INT,  { .i64 = -1 }, -1, 1500,  .flags = D|E },
 { "ffs","Flight flag size (window size) (in bytes)",OFFSET(ffs),  AV_OPT_TYPE_INT,  { .i64 = -1 }, -1, INT_MAX,   .flags = D|E },
 { "ipttl",  "IP Time To Live",  OFFSET(ipttl),AV_OPT_TYPE_INT,  { .i64 = -1 }, -1, 255,   .flags = D|E },
@@ -196,6 +201,128 @@ static int libsrt_network_wait_fd_timeout(URLContext *h, int eid, int fd, int wr
 }
 }
 
+typedef struct _libsrt_parsed_param {
+char *key;
+char *val;
+} libsrt_parsed_param;
+
+
+/**
+ * Parse a key-value string into an array of key/value structs.
+ *
+ * The key-value string should be a null terminated string of parameters separated
+ * by a delimiter. Each parameter are checked for the equal sign character.
+ * If the equal sign character appears in the parameter, it will be used as a null terminator
+ * and the part that comes after it will be the value of the parameter.
+ *
+ *
+ * param: keyvalue: the key-value string to parse. The string will be modified.
+ * param: delimiter:the character that separates the key/value pairs
+ *  from each other.
+ * param: params:   an array of parsed_param structs to hold the result.
+ * param: max_params: maximum number of parameters to parse.
+ *
+ * Return:the number of parsed items. -1 if there was an error.
+ */
+static int libsrt_parse_key_value(char *keyvalue, const char* delimiter,
+libsrt_parsed_param *params, int max_params)
+{
+int i = 0;
+char *token = NULL;
+
+if (!keyvalue || *keyvalue == '\0')
+return -1;
+if (!params || max_params == 0)
+return 0;
+
+token = strtok( keyvalue, delimiter );
+while (token != NULL && i < max_params) {
+params[i].key = token;
+params[i].val = NULL;
+if ((params[i].val = strchr( params[i].key, '=' )) != NULL) {
+size_t val_len = strlen( params[i].val );
+/* make key into a zero-delimited string */
+*(params[i].val) = '\0';
+/* make sure val is not empty */
+if (val_len > 1) {
+params[i].val++;
+/* make sure key is not empty */
+if (params[i].key[0])
+i++;
+};
+}
+token = strtok( NULL, delimiter );
+}
+
+return i;
+}
+
+/* callback to parse streamid */
+static int libsrt_listen_callback(void* opaq, SRTSOCKET ns, int hsversion, const struct sockaddr* peeraddr, const char* streamid)
+{
+const char* username = NULL;
+const char* expected_passphrase = NULL;
+static const char stdhdr [] = "#!::";
+uint32_t* pattern

Re: [FFmpeg-devel] [PATCH v2 1/3] avfilter: add v360 filter

2019-08-14 Thread Eugene

On 14.08.2019 13:06, Paul B Mahol wrote:


On Wed, Aug 14, 2019 at 11:56 AM Thilo Borgmann 
wrote:


[...]


+static int config_output(AVFilterLink *outlink)
+{
+AVFilterContext *ctx = outlink->src;
+AVFilterLink *inlink = ctx->inputs[0];
+V360Context *s = ctx->priv;
+const AVPixFmtDescriptor *desc =
av_pix_fmt_desc_get(inlink->format);
+const int depth = desc->comp[0].depth;
+float remap_data_size = 0.f;
+int sizeof_remap;
+int err;
+int p, h, w;
+float hf, wf;
+float mirror_modifier[3];
+void (*in_transform)(const V360Context *s,
+ const float *vec, int width, int height,
+ uint16_t us[4][4], uint16_t vs[4][4], float
*du, float *dv);
+void (*out_transform)(const V360Context *s,
+  int i, int j, int width, int height,
+  float *vec);
+void (*calculate_kernel)(float du, float dv, int shift, const

XYRemap4

*r_tmp, void *r);
+float rot_mat[3][3];
+
+switch (s->interp) {
+case NEAREST:
+calculate_kernel = nearest_kernel;
+s->remap_slice = depth <= 8 ? remap1_8bit_slice :
remap1_16bit_slice;
+sizeof_remap = sizeof(XYRemap1);
+break;
+case BILINEAR:
+calculate_kernel = bilinear_kernel;
+s->remap_slice = depth <= 8 ? remap2_8bit_slice :
remap2_16bit_slice;
+sizeof_remap = sizeof(XYRemap2);
+break;
+case BICUBIC:
+calculate_kernel = bicubic_kernel;
+s->remap_slice = depth <= 8 ? remap4_8bit_slice :
remap4_16bit_slice;
+sizeof_remap = sizeof(XYRemap4);
+break;
+case LANCZOS:
+calculate_kernel = lanczos_kernel;
+s->remap_slice = depth <= 8 ? remap4_8bit_slice :
remap4_16bit_slice;
+sizeof_remap = sizeof(XYRemap4);
+break;
+}
+
+switch (s->in) {
+case EQUIRECTANGULAR:
+in_transform = xyz_to_equirect;
+err = 0;
+wf = inlink->w;
+hf = inlink->h;
+break;
+case CUBEMAP_3_2:
+in_transform = xyz_to_cube3x2;
+err = prepare_cube_in(ctx);
+wf = inlink->w / 3.f * 4.f;
+hf = inlink->h;
+break;
+case CUBEMAP_6_1:
+in_transform = xyz_to_cube6x1;
+err = prepare_cube_in(ctx);
+wf = inlink->w / 3.f * 2.f;
+hf = inlink->h * 2.f;
+break;
+case EQUIANGULAR:
+in_transform = xyz_to_eac;
+err = prepare_eac_in(ctx);
+wf = inlink->w;
+hf = inlink->h / 9.f * 8.f;
+break;
+case FLAT:
+av_log(ctx, AV_LOG_ERROR, "Flat format is not accepted as
input.\n");
+return AVERROR(EINVAL);
+}
+
+if (err != 0) {
+return err;
+}
+
+switch (s->out) {
+case EQUIRECTANGULAR:
+out_transform = equirect_to_xyz;
+err = 0;
+w = roundf(wf);
+h = roundf(hf);
+break;
+case CUBEMAP_3_2:
+out_transform = cube3x2_to_xyz;
+err = prepare_cube_out(ctx);
+w = roundf(wf / 4.f * 3.f);
+h = roundf(hf);
+break;
+case CUBEMAP_6_1:
+out_transform = cube6x1_to_xyz;
+err = prepare_cube_out(ctx);
+w = roundf(wf / 2.f * 3.f);
+h = roundf(hf / 2.f);
+break;
+case EQUIANGULAR:
+out_transform = eac_to_xyz;
+err = prepare_eac_out(ctx);
+w = roundf(wf);
+h = roundf(hf / 8.f * 9.f);
+break;
+case FLAT:
+out_transform = flat_to_xyz;
+err = prepare_flat_out(ctx);
+w = roundf(wf * s->flat_range[0] / s->flat_range[1] / 2.f);
+h = roundf(hf);
+break;
+}
+
+if (err != 0) {
+return err;
+}
+
+if (s->width > 0 && s->height > 0) {
+w = s->width;
+h = s->height;
+}

If s->width/height are checked, should handle the case of no ture,
Else w/h may be used but not initialized.


Please try more hard to write english. I do not understand what is typed
above.

If w and h don't have initial values at declaration. So they might never
get set if that last if statement evaluates to false.

So he suggests to add an else case like

if (s->width > 0 && s->height > 0) {
  w = s->width;
  h = s->height;
} else {
  w = 0;
  h = 0;
}

or whatever values might make sense.


else case should have assert or return AVERROR_BUG.


This "if" branch overrides default values with user values. Default 
values are calculated just above this code based on input/output formats.

So w and h do get initialized in any case.





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

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

To unsubscribe, v

Re: [FFmpeg-devel] MJPEG FPS

2019-08-14 Thread Moritz Barsnick
On Wed, Aug 14, 2019 at 11:23:09 +0200, Daniel Kučera wrote:
> I'm trying to lower the latency when playing mjpeg multipart http
> stream and I came to this line:
> https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/mpjpegdec.c#L157
>
> Does it mean each mjpeg stream is decoded as 25FPS?

Yes.

> Is this desired feature?

Probably. I believe every demuxer needs to provide an fps (does it?).
mpjpeg can't determine an fps, and needs to guess. Actually, it doesn't
even get timestamps from the source.

So either you provide the correct fps for a stream which originates as
CFR, or you use "-use_wallclock_as_timestamps 1" when capturing from
HTTP (and possibly "-vsync vfr") to cover unknown or VFR rates. (My
mpjpeg sources are true VFR, they switch between e.g. 1 and 5 fps, plus
the incoming jitter via HTTP.)

Moritz
___
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] avfilter: add v360 filter

2019-08-14 Thread Thilo Borgmann
Am 14.08.19 um 15:14 schrieb Eugene:
> On 14.08.2019 13:06, Paul B Mahol wrote:
> 
>> On Wed, Aug 14, 2019 at 11:56 AM Thilo Borgmann 
>> wrote:
>>
>>> [...]
>>>
>> +static int config_output(AVFilterLink *outlink)
>> +{
>> +    AVFilterContext *ctx = outlink->src;
>> +    AVFilterLink *inlink = ctx->inputs[0];
>> +    V360Context *s = ctx->priv;
>> +    const AVPixFmtDescriptor *desc =
>> av_pix_fmt_desc_get(inlink->format);
>> +    const int depth = desc->comp[0].depth;
>> +    float remap_data_size = 0.f;
>> +    int sizeof_remap;
>> +    int err;
>> +    int p, h, w;
>> +    float hf, wf;
>> +    float mirror_modifier[3];
>> +    void (*in_transform)(const V360Context *s,
>> + const float *vec, int width, int height,
>> + uint16_t us[4][4], uint16_t vs[4][4], float
>> *du, float *dv);
>> +    void (*out_transform)(const V360Context *s,
>> +  int i, int j, int width, int height,
>> +  float *vec);
>> +    void (*calculate_kernel)(float du, float dv, int shift, const
> XYRemap4
>> *r_tmp, void *r);
>> +    float rot_mat[3][3];
>> +
>> +    switch (s->interp) {
>> +    case NEAREST:
>> +    calculate_kernel = nearest_kernel;
>> +    s->remap_slice = depth <= 8 ? remap1_8bit_slice :
>> remap1_16bit_slice;
>> +    sizeof_remap = sizeof(XYRemap1);
>> +    break;
>> +    case BILINEAR:
>> +    calculate_kernel = bilinear_kernel;
>> +    s->remap_slice = depth <= 8 ? remap2_8bit_slice :
>> remap2_16bit_slice;
>> +    sizeof_remap = sizeof(XYRemap2);
>> +    break;
>> +    case BICUBIC:
>> +    calculate_kernel = bicubic_kernel;
>> +    s->remap_slice = depth <= 8 ? remap4_8bit_slice :
>> remap4_16bit_slice;
>> +    sizeof_remap = sizeof(XYRemap4);
>> +    break;
>> +    case LANCZOS:
>> +    calculate_kernel = lanczos_kernel;
>> +    s->remap_slice = depth <= 8 ? remap4_8bit_slice :
>> remap4_16bit_slice;
>> +    sizeof_remap = sizeof(XYRemap4);
>> +    break;
>> +    }
>> +
>> +    switch (s->in) {
>> +    case EQUIRECTANGULAR:
>> +    in_transform = xyz_to_equirect;
>> +    err = 0;
>> +    wf = inlink->w;
>> +    hf = inlink->h;
>> +    break;
>> +    case CUBEMAP_3_2:
>> +    in_transform = xyz_to_cube3x2;
>> +    err = prepare_cube_in(ctx);
>> +    wf = inlink->w / 3.f * 4.f;
>> +    hf = inlink->h;
>> +    break;
>> +    case CUBEMAP_6_1:
>> +    in_transform = xyz_to_cube6x1;
>> +    err = prepare_cube_in(ctx);
>> +    wf = inlink->w / 3.f * 2.f;
>> +    hf = inlink->h * 2.f;
>> +    break;
>> +    case EQUIANGULAR:
>> +    in_transform = xyz_to_eac;
>> +    err = prepare_eac_in(ctx);
>> +    wf = inlink->w;
>> +    hf = inlink->h / 9.f * 8.f;
>> +    break;
>> +    case FLAT:
>> +    av_log(ctx, AV_LOG_ERROR, "Flat format is not accepted as
>> input.\n");
>> +    return AVERROR(EINVAL);
>> +    }
>> +
>> +    if (err != 0) {
>> +    return err;
>> +    }
>> +
>> +    switch (s->out) {
>> +    case EQUIRECTANGULAR:
>> +    out_transform = equirect_to_xyz;
>> +    err = 0;
>> +    w = roundf(wf);
>> +    h = roundf(hf);
>> +    break;
>> +    case CUBEMAP_3_2:
>> +    out_transform = cube3x2_to_xyz;
>> +    err = prepare_cube_out(ctx);
>> +    w = roundf(wf / 4.f * 3.f);
>> +    h = roundf(hf);
>> +    break;
>> +    case CUBEMAP_6_1:
>> +    out_transform = cube6x1_to_xyz;
>> +    err = prepare_cube_out(ctx);
>> +    w = roundf(wf / 2.f * 3.f);
>> +    h = roundf(hf / 2.f);
>> +    break;
>> +    case EQUIANGULAR:
>> +    out_transform = eac_to_xyz;
>> +    err = prepare_eac_out(ctx);
>> +    w = roundf(wf);
>> +    h = roundf(hf / 8.f * 9.f);
>> +    break;
>> +    case FLAT:
>> +    out_transform = flat_to_xyz;
>> +    err = prepare_flat_out(ctx);
>> +    w = roundf(wf * s->flat_range[0] / s->flat_range[1] / 2.f);
>> +    h = roundf(hf);
>> +    break;
>> +    }
>> +
>> +    if (err != 0) {
>> +    return err;
>> +    }
>> +
>> +    if (s->width > 0 && s->height > 0) {
>> +    w = s->width;
>> +    h = s->height;
>> +    }
> If s->width/height are checked, should handle the case of no ture,
> Else w/h may be used but not initialized.
>
 Please try more hard to write english. I do not understand what is typed
 above.
>>>

Re: [FFmpeg-devel] [PATCH v2 1/3] avfilter: add v360 filter

2019-08-14 Thread Paul B Mahol
On Wed, Aug 14, 2019 at 4:06 PM Thilo Borgmann 
wrote:

> Am 14.08.19 um 15:14 schrieb Eugene:
> > On 14.08.2019 13:06, Paul B Mahol wrote:
> >
> >> On Wed, Aug 14, 2019 at 11:56 AM Thilo Borgmann  >
> >> wrote:
> >>
> >>> [...]
> >>>
> >> +static int config_output(AVFilterLink *outlink)
> >> +{
> >> +AVFilterContext *ctx = outlink->src;
> >> +AVFilterLink *inlink = ctx->inputs[0];
> >> +V360Context *s = ctx->priv;
> >> +const AVPixFmtDescriptor *desc =
> >> av_pix_fmt_desc_get(inlink->format);
> >> +const int depth = desc->comp[0].depth;
> >> +float remap_data_size = 0.f;
> >> +int sizeof_remap;
> >> +int err;
> >> +int p, h, w;
> >> +float hf, wf;
> >> +float mirror_modifier[3];
> >> +void (*in_transform)(const V360Context *s,
> >> + const float *vec, int width, int height,
> >> + uint16_t us[4][4], uint16_t vs[4][4],
> float
> >> *du, float *dv);
> >> +void (*out_transform)(const V360Context *s,
> >> +  int i, int j, int width, int height,
> >> +  float *vec);
> >> +void (*calculate_kernel)(float du, float dv, int shift, const
> > XYRemap4
> >> *r_tmp, void *r);
> >> +float rot_mat[3][3];
> >> +
> >> +switch (s->interp) {
> >> +case NEAREST:
> >> +calculate_kernel = nearest_kernel;
> >> +s->remap_slice = depth <= 8 ? remap1_8bit_slice :
> >> remap1_16bit_slice;
> >> +sizeof_remap = sizeof(XYRemap1);
> >> +break;
> >> +case BILINEAR:
> >> +calculate_kernel = bilinear_kernel;
> >> +s->remap_slice = depth <= 8 ? remap2_8bit_slice :
> >> remap2_16bit_slice;
> >> +sizeof_remap = sizeof(XYRemap2);
> >> +break;
> >> +case BICUBIC:
> >> +calculate_kernel = bicubic_kernel;
> >> +s->remap_slice = depth <= 8 ? remap4_8bit_slice :
> >> remap4_16bit_slice;
> >> +sizeof_remap = sizeof(XYRemap4);
> >> +break;
> >> +case LANCZOS:
> >> +calculate_kernel = lanczos_kernel;
> >> +s->remap_slice = depth <= 8 ? remap4_8bit_slice :
> >> remap4_16bit_slice;
> >> +sizeof_remap = sizeof(XYRemap4);
> >> +break;
> >> +}
> >> +
> >> +switch (s->in) {
> >> +case EQUIRECTANGULAR:
> >> +in_transform = xyz_to_equirect;
> >> +err = 0;
> >> +wf = inlink->w;
> >> +hf = inlink->h;
> >> +break;
> >> +case CUBEMAP_3_2:
> >> +in_transform = xyz_to_cube3x2;
> >> +err = prepare_cube_in(ctx);
> >> +wf = inlink->w / 3.f * 4.f;
> >> +hf = inlink->h;
> >> +break;
> >> +case CUBEMAP_6_1:
> >> +in_transform = xyz_to_cube6x1;
> >> +err = prepare_cube_in(ctx);
> >> +wf = inlink->w / 3.f * 2.f;
> >> +hf = inlink->h * 2.f;
> >> +break;
> >> +case EQUIANGULAR:
> >> +in_transform = xyz_to_eac;
> >> +err = prepare_eac_in(ctx);
> >> +wf = inlink->w;
> >> +hf = inlink->h / 9.f * 8.f;
> >> +break;
> >> +case FLAT:
> >> +av_log(ctx, AV_LOG_ERROR, "Flat format is not accepted as
> >> input.\n");
> >> +return AVERROR(EINVAL);
> >> +}
> >> +
> >> +if (err != 0) {
> >> +return err;
> >> +}
> >> +
> >> +switch (s->out) {
> >> +case EQUIRECTANGULAR:
> >> +out_transform = equirect_to_xyz;
> >> +err = 0;
> >> +w = roundf(wf);
> >> +h = roundf(hf);
> >> +break;
> >> +case CUBEMAP_3_2:
> >> +out_transform = cube3x2_to_xyz;
> >> +err = prepare_cube_out(ctx);
> >> +w = roundf(wf / 4.f * 3.f);
> >> +h = roundf(hf);
> >> +break;
> >> +case CUBEMAP_6_1:
> >> +out_transform = cube6x1_to_xyz;
> >> +err = prepare_cube_out(ctx);
> >> +w = roundf(wf / 2.f * 3.f);
> >> +h = roundf(hf / 2.f);
> >> +break;
> >> +case EQUIANGULAR:
> >> +out_transform = eac_to_xyz;
> >> +err = prepare_eac_out(ctx);
> >> +w = roundf(wf);
> >> +h = roundf(hf / 8.f * 9.f);
> >> +break;
> >> +case FLAT:
> >> +out_transform = flat_to_xyz;
> >> +err = prepare_flat_out(ctx);
> >> +w = roundf(wf * s->flat_range[0] / s->flat_range[1] / 2.f);
> >> +h = roundf(hf);
> >> +break;
> >> +}
> >> +
> >> +if (err != 0) {
> >> +return err;
> >> +}
> >> +
> >> +if (s

Re: [FFmpeg-devel] [PATCH v2 1/3] avfilter: add v360 filter

2019-08-14 Thread Thilo Borgmann
Am 14.08.19 um 16:09 schrieb Paul B Mahol:
> On Wed, Aug 14, 2019 at 4:06 PM Thilo Borgmann 
> wrote:
> 
>> Am 14.08.19 um 15:14 schrieb Eugene:
>>> On 14.08.2019 13:06, Paul B Mahol wrote:
>>>
 On Wed, Aug 14, 2019 at 11:56 AM Thilo Borgmann >>
 wrote:

> [...]
>
 +static int config_output(AVFilterLink *outlink)
 +{
 +AVFilterContext *ctx = outlink->src;
 +AVFilterLink *inlink = ctx->inputs[0];
 +V360Context *s = ctx->priv;
 +const AVPixFmtDescriptor *desc =
 av_pix_fmt_desc_get(inlink->format);
 +const int depth = desc->comp[0].depth;
 +float remap_data_size = 0.f;
 +int sizeof_remap;
 +int err;
 +int p, h, w;
 +float hf, wf;
 +float mirror_modifier[3];
 +void (*in_transform)(const V360Context *s,
 + const float *vec, int width, int height,
 + uint16_t us[4][4], uint16_t vs[4][4],
>> float
 *du, float *dv);
 +void (*out_transform)(const V360Context *s,
 +  int i, int j, int width, int height,
 +  float *vec);
 +void (*calculate_kernel)(float du, float dv, int shift, const
>>> XYRemap4
 *r_tmp, void *r);
 +float rot_mat[3][3];
 +
 +switch (s->interp) {
 +case NEAREST:
 +calculate_kernel = nearest_kernel;
 +s->remap_slice = depth <= 8 ? remap1_8bit_slice :
 remap1_16bit_slice;
 +sizeof_remap = sizeof(XYRemap1);
 +break;
 +case BILINEAR:
 +calculate_kernel = bilinear_kernel;
 +s->remap_slice = depth <= 8 ? remap2_8bit_slice :
 remap2_16bit_slice;
 +sizeof_remap = sizeof(XYRemap2);
 +break;
 +case BICUBIC:
 +calculate_kernel = bicubic_kernel;
 +s->remap_slice = depth <= 8 ? remap4_8bit_slice :
 remap4_16bit_slice;
 +sizeof_remap = sizeof(XYRemap4);
 +break;
 +case LANCZOS:
 +calculate_kernel = lanczos_kernel;
 +s->remap_slice = depth <= 8 ? remap4_8bit_slice :
 remap4_16bit_slice;
 +sizeof_remap = sizeof(XYRemap4);
 +break;
 +}
 +
 +switch (s->in) {
 +case EQUIRECTANGULAR:
 +in_transform = xyz_to_equirect;
 +err = 0;
 +wf = inlink->w;
 +hf = inlink->h;
 +break;
 +case CUBEMAP_3_2:
 +in_transform = xyz_to_cube3x2;
 +err = prepare_cube_in(ctx);
 +wf = inlink->w / 3.f * 4.f;
 +hf = inlink->h;
 +break;
 +case CUBEMAP_6_1:
 +in_transform = xyz_to_cube6x1;
 +err = prepare_cube_in(ctx);
 +wf = inlink->w / 3.f * 2.f;
 +hf = inlink->h * 2.f;
 +break;
 +case EQUIANGULAR:
 +in_transform = xyz_to_eac;
 +err = prepare_eac_in(ctx);
 +wf = inlink->w;
 +hf = inlink->h / 9.f * 8.f;
 +break;
 +case FLAT:
 +av_log(ctx, AV_LOG_ERROR, "Flat format is not accepted as
 input.\n");
 +return AVERROR(EINVAL);
 +}
 +
 +if (err != 0) {
 +return err;
 +}
 +
 +switch (s->out) {
 +case EQUIRECTANGULAR:
 +out_transform = equirect_to_xyz;
 +err = 0;
 +w = roundf(wf);
 +h = roundf(hf);
 +break;
 +case CUBEMAP_3_2:
 +out_transform = cube3x2_to_xyz;
 +err = prepare_cube_out(ctx);
 +w = roundf(wf / 4.f * 3.f);
 +h = roundf(hf);
 +break;
 +case CUBEMAP_6_1:
 +out_transform = cube6x1_to_xyz;
 +err = prepare_cube_out(ctx);
 +w = roundf(wf / 2.f * 3.f);
 +h = roundf(hf / 2.f);
 +break;
 +case EQUIANGULAR:
 +out_transform = eac_to_xyz;
 +err = prepare_eac_out(ctx);
 +w = roundf(wf);
 +h = roundf(hf / 8.f * 9.f);
 +break;
 +case FLAT:
 +out_transform = flat_to_xyz;
 +err = prepare_flat_out(ctx);
 +w = roundf(wf * s->flat_range[0] / s->flat_range[1] / 2.f);
 +h = roundf(hf);
 +break;
 +}
 +
 +if (err != 0) {
 +return 

Re: [FFmpeg-devel] [PATCH] libavformat/rtspdec: Don't send teardown if rtsp_hd_out is null

2019-08-14 Thread Moritz Barsnick
On Mon, Aug 05, 2019 at 08:18:32 +0100, Ross Nicholson wrote:
> Example stream that does not work: 
> rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov
>
> Extending the condition allows the stream to be processed correctly.

Can you give a bit more detail? Decoding this stream works for me (at
last the first 20 seconds or so).

> On Mon, 5 Aug 2019 at 08:17, Ross Nicholson  wrote:
> > From: phunkyfish 

Do you want your real name or this pseudonym registered in the repo? It
can't be changed afterwards.

Moritz
___
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] avfilter: add v360 filter

2019-08-14 Thread Li, Zhong
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> Of Thilo Borgmann
> Sent: Wednesday, August 14, 2019 10:06 PM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v2 1/3] avfilter: add v360 filter
> 
> Am 14.08.19 um 15:14 schrieb Eugene:
> > On 14.08.2019 13:06, Paul B Mahol wrote:
> >
> >> On Wed, Aug 14, 2019 at 11:56 AM Thilo Borgmann
> >> 
> >> wrote:
> >>
> >>> [...]
> >>>
> >> +static int config_output(AVFilterLink *outlink) {
> >> +    AVFilterContext *ctx = outlink->src;
> >> +    AVFilterLink *inlink = ctx->inputs[0];
> >> +    V360Context *s = ctx->priv;
> >> +    const AVPixFmtDescriptor *desc =
> >> av_pix_fmt_desc_get(inlink->format);
> >> +    const int depth = desc->comp[0].depth;
> >> +    float remap_data_size = 0.f;
> >> +    int sizeof_remap;
> >> +    int err;
> >> +    int p, h, w;
> >> +    float hf, wf;
> >> +    float mirror_modifier[3];
> >> +    void (*in_transform)(const V360Context *s,
> >> + const float *vec, int width, int
> >> +height,
> >> + uint16_t us[4][4], uint16_t
> vs[4][4],
> >> +float
> >> *du, float *dv);
> >> +    void (*out_transform)(const V360Context *s,
> >> +  int i, int j, int width, int
> height,
> >> +  float *vec);
> >> +    void (*calculate_kernel)(float du, float dv, int shift,
> >> +const
> > XYRemap4
> >> *r_tmp, void *r);
> >> +    float rot_mat[3][3];
> >> +
> >> +    switch (s->interp) {
> >> +    case NEAREST:
> >> +    calculate_kernel = nearest_kernel;
> >> +    s->remap_slice = depth <= 8 ? remap1_8bit_slice :
> >> remap1_16bit_slice;
> >> +    sizeof_remap = sizeof(XYRemap1);
> >> +    break;
> >> +    case BILINEAR:
> >> +    calculate_kernel = bilinear_kernel;
> >> +    s->remap_slice = depth <= 8 ? remap2_8bit_slice :
> >> remap2_16bit_slice;
> >> +    sizeof_remap = sizeof(XYRemap2);
> >> +    break;
> >> +    case BICUBIC:
> >> +    calculate_kernel = bicubic_kernel;
> >> +    s->remap_slice = depth <= 8 ? remap4_8bit_slice :
> >> remap4_16bit_slice;
> >> +    sizeof_remap = sizeof(XYRemap4);
> >> +    break;
> >> +    case LANCZOS:
> >> +    calculate_kernel = lanczos_kernel;
> >> +    s->remap_slice = depth <= 8 ? remap4_8bit_slice :
> >> remap4_16bit_slice;
> >> +    sizeof_remap = sizeof(XYRemap4);
> >> +    break;
> >> +    }
> >> +
> >> +    switch (s->in) {
> >> +    case EQUIRECTANGULAR:
> >> +    in_transform = xyz_to_equirect;
> >> +    err = 0;
> >> +    wf = inlink->w;
> >> +    hf = inlink->h;
> >> +    break;
> >> +    case CUBEMAP_3_2:
> >> +    in_transform = xyz_to_cube3x2;
> >> +    err = prepare_cube_in(ctx);
> >> +    wf = inlink->w / 3.f * 4.f;
> >> +    hf = inlink->h;
> >> +    break;
> >> +    case CUBEMAP_6_1:
> >> +    in_transform = xyz_to_cube6x1;
> >> +    err = prepare_cube_in(ctx);
> >> +    wf = inlink->w / 3.f * 2.f;
> >> +    hf = inlink->h * 2.f;
> >> +    break;
> >> +    case EQUIANGULAR:
> >> +    in_transform = xyz_to_eac;
> >> +    err = prepare_eac_in(ctx);
> >> +    wf = inlink->w;
> >> +    hf = inlink->h / 9.f * 8.f;
> >> +    break;
> >> +    case FLAT:
> >> +    av_log(ctx, AV_LOG_ERROR, "Flat format is not
> accepted
> >> +as
> >> input.\n");
> >> +    return AVERROR(EINVAL);
> >> +    }
> >> +
> >> +    if (err != 0) {
> >> +    return err;
> >> +    }
> >> +
> >> +    switch (s->out) {
> >> +    case EQUIRECTANGULAR:
> >> +    out_transform = equirect_to_xyz;
> >> +    err = 0;
> >> +    w = roundf(wf);
> >> +    h = roundf(hf);
> >> +    break;
> >> +    case CUBEMAP_3_2:
> >> +    out_transform = cube3x2_to_xyz;
> >> +    err = prepare_cube_out(ctx);
> >> +    w = roundf(wf / 4.f * 3.f);
> >> +    h = roundf(hf);
> >> +    break;
> >> +    case CUBEMAP_6_1:
> >> +    out_transform = cube6x1_to_xyz;
> >> +    err = prepare_cube_out(ctx);
> >> +    w = roundf(wf / 2.f * 3.f);
> >> +    h = roundf(hf / 2.f);
> >> +    break;
> >> +    case EQUIANGULAR:
> >> +    out_transform = eac_to_xyz;
> >> +    err = prepare_eac_out(ctx);
> >> +    w = roundf(wf);
> >> +    h = roundf(hf / 8.f * 9.f);
> >> +    break;
> >> +    case FLAT:
> >> +    out_transform = flat_to_xyz;
> >> +    err = prepare_flat_out(ctx);
> >> +    w = roundf(wf * s->flat_range[0

Re: [FFmpeg-devel] [PATCH] lavu/hwcontext_vaapi: provide detailed warning if directly mapping fails

2019-08-14 Thread Li, Zhong
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> Of Linjie Fu
> Sent: Wednesday, August 14, 2019 5:25 PM
> To: ffmpeg-devel@ffmpeg.org
> Cc: Fu, Linjie 
> Subject: [FFmpeg-devel] [PATCH] lavu/hwcontext_vaapi: provide detailed
> warning if directly mapping fails
> 
> Detailed message could be helpful when using
> hwmap=mode=direct,format=xxx for both qsv and vaapi.
> 
> Signed-off-by: Linjie Fu 
> ---
>  libavutil/hwcontext_vaapi.c | 9 ++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c index
> cf117640f2..30c42e4385 100644
> --- a/libavutil/hwcontext_vaapi.c
> +++ b/libavutil/hwcontext_vaapi.c
> @@ -747,19 +747,22 @@ static int vaapi_map_frame(AVHWFramesContext
> *hwfc,
>  av_log(hwfc, AV_LOG_DEBUG, "Map surface %#x.\n", surface_id);
> 
>  if (!ctx->derive_works && (flags & AV_HWFRAME_MAP_DIRECT)) {
> -// Requested direct mapping but it is not possible.
> +av_log(hwfc, AV_LOG_WARNING, "Requested direct mapping but
> "
> +"it is not
> possible.\n");
>  return AVERROR(EINVAL);
>  }
>  if (dst->format == AV_PIX_FMT_NONE)
>  dst->format = hwfc->sw_format;
>  if (dst->format != hwfc->sw_format && (flags &
> AV_HWFRAME_MAP_DIRECT)) {
> -// Requested direct mapping but the formats do not match.
> +av_log(hwfc, AV_LOG_WARNING, "Requested direct mapping but
> "
> +"the formats do not
> match.\n");
>  return AVERROR(EINVAL);
>  }
> 
>  err = vaapi_get_image_format(hwfc->device_ctx, dst->format,
> &image_format);
>  if (err < 0) {
> -// Requested format is not a valid output format.
> +av_log(hwfc, AV_LOG_WARNING, "Requested format is "
> +"not a valid output
> + format.\n");
>  return AVERROR(EINVAL);
>  }
> 
> --
> 2.17.1

Why just give a warning message when you need to return an error? 
___
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 5/8] avcodec/flicvideo: Optimize and Simplify FLI_COPY in flic_decode_frame_24BPP() by using bytestream2_get_buffer()

2019-08-14 Thread Tomas Härdin
mån 2019-08-12 klockan 21:17 +0200 skrev Michael Niedermayer:
> Fixes: Timeout (31sec  -> 22sec)

Is this a large test case? 22sec still sounds excessive

> -pixel_countdown = s->avctx->width;
> -pixel_ptr = 0;
> -while (pixel_countdown > 0) {
> -pixel = bytestream2_get_le24(&g2);
> -AV_WL24(&pixels[y_ptr + pixel_ptr], pixel);
> -pixel_ptr += 3;
> -pixel_countdown--;
> -}
> +bytestream2_get_buffer(&g2, pixels + y_ptr, 3*s-
> >avctx->width);

Looks OK

/Tomas

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

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

Re: [FFmpeg-devel] [PATCH] ffplay: properly detect all window size changes

2019-08-14 Thread Paul B Mahol
LGTM

On Tue, Aug 13, 2019 at 11:20 PM Marton Balint  wrote:

> SDL_WINDOWEVENT_SIZE_CHANGED should be used instead of
> SDL_WINDOWEVENT_RESIZED
> because SDL_WINDOWEVENT_RESIZED is only emitted if the resize happened due
> to
> an external event.
>
> Fixes ticket #8072.
>
> Additional references:
> https://bugzilla.libsdl.org/show_bug.cgi?id=4760
> https://wiki.libsdl.org/SDL_WindowEventID
>
> Signed-off-by: Marton Balint 
> ---
>  fftools/ffplay.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fftools/ffplay.c b/fftools/ffplay.c
> index 8fb8faeb06..fee0619f7c 100644
> --- a/fftools/ffplay.c
> +++ b/fftools/ffplay.c
> @@ -3436,7 +3436,7 @@ static void event_loop(VideoState *cur_stream)
>  break;
>  case SDL_WINDOWEVENT:
>  switch (event.window.event) {
> -case SDL_WINDOWEVENT_RESIZED:
> +case SDL_WINDOWEVENT_SIZE_CHANGED:
>  screen_width  = cur_stream->width  =
> event.window.data1;
>  screen_height = cur_stream->height =
> event.window.data2;
>  if (cur_stream->vis_texture) {
> --
> 2.16.4
>
> ___
> 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] [PATCHv2 1/3] avformat/avio: add avio_print_string_array and avio_print

2019-08-14 Thread Paul B Mahol
LGTM

On Mon, Aug 12, 2019 at 10:32 AM Marton Balint  wrote:

> These functions can be used to print a variable number of strings
> consecutively
> to the IO context. Unlike av_bprintf, no temporary buffer is necessary.
>
> Signed-off-by: Marton Balint 
> ---
>  doc/APIchanges|  3 +++
>  libavformat/avio.h| 17 +
>  libavformat/aviobuf.c |  6 ++
>  libavformat/version.h |  2 +-
>  4 files changed, 27 insertions(+), 1 deletion(-)
>
> diff --git a/doc/APIchanges b/doc/APIchanges
> index 6603a8229e..ba35b847d9 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -15,6 +15,9 @@ libavutil: 2017-10-21
>
>  API changes, most recent first:
>
> +2019-08-xx - xx - lavf 58.31.100 - avio.h
> +  Add avio_print_string_array and avio_print.
> +
>  2019-07-27 - xx - lavu 56.33.100 - tx.h
>Add AV_TX_DOUBLE_FFT and AV_TX_DOUBLE_MDCT
>
> diff --git a/libavformat/avio.h b/libavformat/avio.h
> index dcb8dcdf93..910e4f1b48 100644
> --- a/libavformat/avio.h
> +++ b/libavformat/avio.h
> @@ -574,6 +574,23 @@ int avio_feof(AVIOContext *s);
>  /** @warning Writes up to 4 KiB per call */
>  int avio_printf(AVIOContext *s, const char *fmt, ...) av_printf_format(2,
> 3);
>
> +/**
> + * Write a NULL terminated array of strings to the context.
> + * Usually you don't need to use this function directly but its macro
> wrapper,
> + * avio_print.
> + */
> +void avio_print_string_array(AVIOContext *s, const char *strings[]);
> +
> +/**
> + * Write strings (const char *) to the context.
> + * This is a convenience macro around avio_print_string_array and it
> + * automatically creates the string array from the variable argument list.
> + * For simple string concatenations this function is more performant than
> using
> + * avio_printf since it does not need a temporary buffer.
> + */
> +#define avio_print(s, ...) \
> +avio_print_string_array(s, (const char*[]){__VA_ARGS__, NULL})
> +
>  /**
>   * Force flushing of buffered data.
>   *
> diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
> index 2d011027c9..be4c97f827 100644
> --- a/libavformat/aviobuf.c
> +++ b/libavformat/aviobuf.c
> @@ -1225,6 +1225,12 @@ int avio_printf(AVIOContext *s, const char *fmt,
> ...)
>  return ret;
>  }
>
> +void avio_print_string_array(AVIOContext *s, const char *strings[])
> +{
> +for(; *strings; strings++)
> +avio_write(s, (const unsigned char *)*strings, strlen(*strings));
> +}
> +
>  int avio_pause(AVIOContext *s, int pause)
>  {
>  if (!s->read_pause)
> diff --git a/libavformat/version.h b/libavformat/version.h
> index 45efaff9b9..feceaedc08 100644
> --- a/libavformat/version.h
> +++ b/libavformat/version.h
> @@ -32,7 +32,7 @@
>  // Major bumping may affect Ticket5467, 5421, 5451(compatibility with
> Chromium)
>  // Also please add any ticket numbers that you believe might be affected
> here
>  #define LIBAVFORMAT_VERSION_MAJOR  58
> -#define LIBAVFORMAT_VERSION_MINOR  30
> +#define LIBAVFORMAT_VERSION_MINOR  31
>  #define LIBAVFORMAT_VERSION_MICRO 100
>
>  #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR,
> \
> --
> 2.16.4
>
> ___
> 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] [PATCHv2 3/3] avformat/avio: remove 4k limit from avio_printf

2019-08-14 Thread Paul B Mahol
LGTM

On Sat, Aug 10, 2019 at 10:56 PM Marton Balint  wrote:

> We do this by switching to AVBPrint.
>
> v2: Also set IO context error flag in case of ENOMEM.
>
> Signed-off-by: Marton Balint 
> ---
>  doc/APIchanges|  3 +++
>  libavformat/avio.h|  5 -
>  libavformat/aviobuf.c | 16 +++-
>  libavformat/version.h |  2 +-
>  4 files changed, 19 insertions(+), 7 deletions(-)
>
> diff --git a/doc/APIchanges b/doc/APIchanges
> index 0b19fb067d..fe36c34b90 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -15,6 +15,9 @@ libavutil: 2017-10-21
>
>  API changes, most recent first:
>
> +2019-08-xx - xx - lavf 58.31.101 - avio.h
> +  4K limit removed from avio_printf.
> +
>  2019-08-xx - xx - lavf 58.31.100 - avio.h
>Add avio_print_n_strings and avio_print.
>
> diff --git a/libavformat/avio.h b/libavformat/avio.h
> index 0c622f44bd..f3a35004d2 100644
> --- a/libavformat/avio.h
> +++ b/libavformat/avio.h
> @@ -571,7 +571,10 @@ int64_t avio_size(AVIOContext *s);
>   */
>  int avio_feof(AVIOContext *s);
>
> -/** @warning Writes up to 4 KiB per call */
> +/**
> + * Writes a formatted string to the context.
> + * @return number of bytes written, < 0 on error.
> + */
>  int avio_printf(AVIOContext *s, const char *fmt, ...) av_printf_format(2,
> 3);
>
>  /**
> diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
> index 4a37a13d7a..2a0f033c45 100644
> --- a/libavformat/aviobuf.c
> +++ b/libavformat/aviobuf.c
> @@ -1215,14 +1215,20 @@ int avio_closep(AVIOContext **s)
>  int avio_printf(AVIOContext *s, const char *fmt, ...)
>  {
>  va_list ap;
> -char buf[4096]; /* update doc entry in avio.h if changed */
> -int ret;
> +AVBPrint bp;
>
> +av_bprint_init(&bp, 0, INT_MAX);
>  va_start(ap, fmt);
> -ret = vsnprintf(buf, sizeof(buf), fmt, ap);
> +av_vbprintf(&bp, fmt, ap);
>  va_end(ap);
> -avio_write(s, buf, strlen(buf));
> -return ret;
> +if (!av_bprint_is_complete(&bp)) {
> +av_bprint_finalize(&bp, NULL);
> +s->error = AVERROR(ENOMEM);
> +return AVERROR(ENOMEM);
> +}
> +avio_write(s, bp.str, bp.len);
> +av_bprint_finalize(&bp, NULL);
> +return bp.len;
>  }
>
>  void avio_print_n_strings(AVIOContext *s, int nb_strings, ...)
> diff --git a/libavformat/version.h b/libavformat/version.h
> index feceaedc08..9814db8633 100644
> --- a/libavformat/version.h
> +++ b/libavformat/version.h
> @@ -33,7 +33,7 @@
>  // Also please add any ticket numbers that you believe might be affected
> here
>  #define LIBAVFORMAT_VERSION_MAJOR  58
>  #define LIBAVFORMAT_VERSION_MINOR  31
> -#define LIBAVFORMAT_VERSION_MICRO 100
> +#define LIBAVFORMAT_VERSION_MICRO 101
>
>  #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR,
> \
> LIBAVFORMAT_VERSION_MINOR,
> \
> --
> 2.16.4
>
> ___
> 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 V1] libavdevice: Update the class name as uniform style

2019-08-14 Thread Paul B Mahol
LGTM

On Tue, Aug 13, 2019 at 12:53 PM Jun Zhao  wrote:

> From: Jun Zhao 
>
> Update the class name to uniform indev/outdev style.
>
> Signed-off-by: Jun Zhao 
> ---
>  libavdevice/alsa_dec.c|2 +-
>  libavdevice/alsa_enc.c|2 +-
>  libavdevice/avfoundation.m|2 +-
>  libavdevice/bktr.c|2 +-
>  libavdevice/caca.c|2 +-
>  libavdevice/decklink_dec_c.c  |2 +-
>  libavdevice/decklink_enc_c.c  |2 +-
>  libavdevice/openal-dec.c  |2 +-
>  libavdevice/oss_dec.c |2 +-
>  libavdevice/oss_enc.c |2 +-
>  libavdevice/pulse_audio_dec.c |2 +-
>  libavdevice/pulse_audio_enc.c |2 +-
>  12 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/libavdevice/alsa_dec.c b/libavdevice/alsa_dec.c
> index c50ce71..36494e9 100644
> --- a/libavdevice/alsa_dec.c
> +++ b/libavdevice/alsa_dec.c
> @@ -148,7 +148,7 @@ static const AVOption options[] = {
>  };
>
>  static const AVClass alsa_demuxer_class = {
> -.class_name = "ALSA demuxer",
> +.class_name = "ALSA indev",
>  .item_name  = av_default_item_name,
>  .option = options,
>  .version= LIBAVUTIL_VERSION_INT,
> diff --git a/libavdevice/alsa_enc.c b/libavdevice/alsa_enc.c
> index 0bef625..1a6d01e 100644
> --- a/libavdevice/alsa_enc.c
> +++ b/libavdevice/alsa_enc.c
> @@ -151,7 +151,7 @@ static int audio_get_device_list(AVFormatContext *h,
> AVDeviceInfoList *device_li
>  }
>
>  static const AVClass alsa_muxer_class = {
> -.class_name = "ALSA muxer",
> +.class_name = "ALSA outdev",
>  .item_name  = av_default_item_name,
>  .version= LIBAVUTIL_VERSION_INT,
>  .category   = AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT,
> diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m
> index 08deecf..af8fe31 100644
> --- a/libavdevice/avfoundation.m
> +++ b/libavdevice/avfoundation.m
> @@ -1140,7 +1140,7 @@ static const AVOption options[] = {
>  };
>
>  static const AVClass avf_class = {
> -.class_name = "AVFoundation input device",
> +.class_name = "AVFoundation indev",
>  .item_name  = av_default_item_name,
>  .option = options,
>  .version= LIBAVUTIL_VERSION_INT,
> diff --git a/libavdevice/bktr.c b/libavdevice/bktr.c
> index 993cc19..2601adb 100644
> --- a/libavdevice/bktr.c
> +++ b/libavdevice/bktr.c
> @@ -341,7 +341,7 @@ static const AVOption options[] = {
>  };
>
>  static const AVClass bktr_class = {
> -.class_name = "BKTR grab interface",
> +.class_name = "BKTR grab indev",
>  .item_name  = av_default_item_name,
>  .option = options,
>  .version= LIBAVUTIL_VERSION_INT,
> diff --git a/libavdevice/caca.c b/libavdevice/caca.c
> index 47de824..be3ff79 100644
> --- a/libavdevice/caca.c
> +++ b/libavdevice/caca.c
> @@ -220,7 +220,7 @@ static const AVOption options[] = {
>  };
>
>  static const AVClass caca_class = {
> -.class_name = "caca_outdev",
> +.class_name = "caca outdev",
>  .item_name  = av_default_item_name,
>  .option = options,
>  .version= LIBAVUTIL_VERSION_INT,
> diff --git a/libavdevice/decklink_dec_c.c b/libavdevice/decklink_dec_c.c
> index 91d2839..7aceaf9 100644
> --- a/libavdevice/decklink_dec_c.c
> +++ b/libavdevice/decklink_dec_c.c
> @@ -89,7 +89,7 @@ static const AVOption options[] = {
>  };
>
>  static const AVClass decklink_demuxer_class = {
> -.class_name = "Blackmagic DeckLink demuxer",
> +.class_name = "Blackmagic DeckLink indev",
>  .item_name  = av_default_item_name,
>  .option = options,
>  .version= LIBAVUTIL_VERSION_INT,
> diff --git a/libavdevice/decklink_enc_c.c b/libavdevice/decklink_enc_c.c
> index 63cbd39..682c714 100644
> --- a/libavdevice/decklink_enc_c.c
> +++ b/libavdevice/decklink_enc_c.c
> @@ -41,7 +41,7 @@ static const AVOption options[] = {
>  };
>
>  static const AVClass decklink_muxer_class = {
> -.class_name = "Blackmagic DeckLink muxer",
> +.class_name = "Blackmagic DeckLink outdev",
>  .item_name  = av_default_item_name,
>  .option = options,
>  .version= LIBAVUTIL_VERSION_INT,
> diff --git a/libavdevice/openal-dec.c b/libavdevice/openal-dec.c
> index c19048e..57de665 100644
> --- a/libavdevice/openal-dec.c
> +++ b/libavdevice/openal-dec.c
> @@ -241,7 +241,7 @@ static const AVOption options[] = {
>  };
>
>  static const AVClass class = {
> -.class_name = "openal",
> +.class_name = "openal indev",
>  .item_name = av_default_item_name,
>  .option = options,
>  .version = LIBAVUTIL_VERSION_INT,
> diff --git a/libavdevice/oss_dec.c b/libavdevice/oss_dec.c
> index d0dc327..13ace70 100644
> --- a/libavdevice/oss_dec.c
> +++ b/libavdevice/oss_dec.c
> @@ -125,7 +125,7 @@ static const AVOption options[] = {
>  };
>
>  static const AVClass oss_demuxer_class = {
> -.class_name = "OSS demuxer",
> +.class_name = "OSS indev",
>  .item_name  = av_default_item_name

Re: [FFmpeg-devel] [PATCH 06/13] avformat/mux: Use av_packet_rescale_ts

2019-08-14 Thread Paul B Mahol
LGTM

On Tue, Aug 13, 2019 at 4:55 AM Andreas Rheinhardt <
andreas.rheinha...@gmail.com> wrote:

> ff_write_chained essentially duplicated the functionality of
> av_packet_rescale_ts. This has been changed.
>
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavformat/mux.c | 16 
>  1 file changed, 4 insertions(+), 12 deletions(-)
>
> diff --git a/libavformat/mux.c b/libavformat/mux.c
> index 44ce099cbf..efe2e94f40 100644
> --- a/libavformat/mux.c
> +++ b/libavformat/mux.c
> @@ -1317,18 +1317,10 @@ int ff_write_chained(AVFormatContext *dst, int
> dst_stream, AVPacket *pkt,
>
>  local_pkt = *pkt;
>  local_pkt.stream_index = dst_stream;
> -if (pkt->pts != AV_NOPTS_VALUE)
> -local_pkt.pts = av_rescale_q(pkt->pts,
> -
>  src->streams[pkt->stream_index]->time_base,
> - dst->streams[dst_stream]->time_base);
> -if (pkt->dts != AV_NOPTS_VALUE)
> -local_pkt.dts = av_rescale_q(pkt->dts,
> -
>  src->streams[pkt->stream_index]->time_base,
> - dst->streams[dst_stream]->time_base);
> -if (pkt->duration)
> -local_pkt.duration = av_rescale_q(pkt->duration,
> -
> src->streams[pkt->stream_index]->time_base,
> -
> dst->streams[dst_stream]->time_base);
> +
> +av_packet_rescale_ts(&local_pkt,
> + src->streams[pkt->stream_index]->time_base,
> + dst->streams[dst_stream]->time_base);
>
>  if (interleave) ret = av_interleaved_write_frame(dst, &local_pkt);
>  elseret = av_write_frame(dst, &local_pkt);
> --
> 2.21.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 mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 4/8] avcodec/loco: Check left column value

2019-08-14 Thread Paul B Mahol
LGTM

On Mon, Aug 12, 2019 at 9:20 PM Michael Niedermayer 
wrote:

> Fixes: Timeout (42sec -> 379 ms)
> Fixes:
> 16323/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LOCO_fuzzer-5679178099195904
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by
> :
> Michael Niedermayer 
> ---
>  libavcodec/loco.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/libavcodec/loco.c b/libavcodec/loco.c
> index 5fb414b411..d8bf68a100 100644
> --- a/libavcodec/loco.c
> +++ b/libavcodec/loco.c
> @@ -161,6 +161,8 @@ static int loco_decode_plane(LOCOContext *l, uint8_t
> *data, int width, int heigh
>  for (j = 1; j < height; j++) {
>  /* restore left column */
>  val = loco_get_rice(&rc);
> +if (val == INT_MIN)
> +   return AVERROR_INVALIDDATA;
>  data[0] = data[-stride] + val;
>  /* restore all other pixels */
>  for (i = 1; i < width; i++) {
> --
> 2.22.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 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 8/8] avcodec/nuv: Avoid duplicating frames

2019-08-14 Thread Paul B Mahol
On Mon, Aug 12, 2019 at 9:20 PM Michael Niedermayer 
wrote:

> Fixes: Timeout (14sec -> 133ms)
> Fixes:
> 14843/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_NUV_fuzzer-5661969614372864
> Fixes:
> 16257/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_NUV_fuzzer-5769175464673280
> (35sec ->0.5sec)
>
>
Why? This is bad idea, same like for qtrle and bunch of other cases.



> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by
> :
> Michael Niedermayer 
> ---
>  libavcodec/nuv.c  | 37 ++---
>  tests/ref/fate/nuv-rtjpeg |  1 -
>  2 files changed, 34 insertions(+), 4 deletions(-)
>
> diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c
> index 75b14bce5b..0952b537b7 100644
> --- a/libavcodec/nuv.c
> +++ b/libavcodec/nuv.c
> @@ -42,6 +42,8 @@ typedef struct NuvContext {
>  unsigned char *decomp_buf;
>  uint32_t lq[64], cq[64];
>  RTJpegContext rtj;
> +int need_flush;
> +AVPacket flush_pkt;
>  } NuvContext;
>
>  static const uint8_t fallback_lquant[] = {
> @@ -66,6 +68,12 @@ static const uint8_t fallback_cquant[] = {
>  99, 99, 99, 99, 99, 99, 99, 99
>  };
>
> +static void decode_flush(AVCodecContext *avctx){
> +NuvContext *s = avctx->priv_data;
> +
> +s->need_flush = 0;
> +}
> +
>  /**
>   * @brief copy frame data from buffer to AVFrame, handling stride.
>   * @param f destination AVFrame
> @@ -172,6 +180,26 @@ static int decode_frame(AVCodecContext *avctx, void
> *data, int *got_frame,
>  NUV_COPY_LAST = 'L'
>  } comptype;
>
> +if (!avpkt->data) {
> +if (c->need_flush) {
> +c->need_flush = 0;
> +if ((ret = ff_reget_buffer(avctx, c->pic)) < 0)
> +return ret;
> +c->pic->pkt_pos  = c->flush_pkt.pos;
> +c->pic->pkt_duration = c->flush_pkt.duration;
> +c->pic->pkt_dts  = c->flush_pkt.dts;
> +c->pic->pkt_pts  =
> +c->pic->pts  = c->flush_pkt.pts;
> +if ((ret = av_frame_ref(data, c->pic)) < 0)
> +return ret;
> +*got_frame = 1;
> +}
> +return 0;
> +}
> +c->flush_pkt = *avpkt;
> +c->pic->pkt_dts = c->flush_pkt.dts;
> +
> +
>  if (buf_size < 12) {
>  av_log(avctx, AV_LOG_ERROR, "coded frame too small\n");
>  return AVERROR_INVALIDDATA;
> @@ -204,8 +232,8 @@ static int decode_frame(AVCodecContext *avctx, void
> *data, int *got_frame,
>  }
>  break;
>  case NUV_COPY_LAST:
> -keyframe = 0;
> -break;
> +c->need_flush = 1;
> +return buf_size;
>  default:
>  keyframe = 1;
>  break;
> @@ -313,6 +341,7 @@ retry:
>  if ((result = av_frame_ref(picture, c->pic)) < 0)
>  return result;
>
> +c->need_flush = 0;
>  *got_frame = 1;
>  return orig_size;
>  }
> @@ -364,6 +393,8 @@ AVCodec ff_nuv_decoder = {
>  .init   = decode_init,
>  .close  = decode_end,
>  .decode = decode_frame,
> -.capabilities   = AV_CODEC_CAP_DR1,
> +.flush  = decode_flush,
> +.caps_internal  = FF_CODEC_CAP_SETS_PKT_DTS,
> +.capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
>  .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
>  };
> diff --git a/tests/ref/fate/nuv-rtjpeg b/tests/ref/fate/nuv-rtjpeg
> index b6f3b080dc..0914b985ec 100644
> --- a/tests/ref/fate/nuv-rtjpeg
> +++ b/tests/ref/fate/nuv-rtjpeg
> @@ -6,7 +6,6 @@
>  0,118,118,0,   460800, 0x54aedafe
>  0,152,152,0,   460800, 0xb7aa8b56
>  0,177,177,0,   460800, 0x283ea3b5
> -0,202,202,0,   460800, 0x283ea3b5
>  0,235,235,0,   460800, 0x10e577de
>  0,269,269,0,   460800, 0x4e091ee2
>  0,302,302,0,   460800, 0x2ea88828
> --
> 2.22.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 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 7/8] avcodec/qtrle: return last frame even if unchanged

2019-08-14 Thread Paul B Mahol
On Wed, Aug 14, 2019 at 6:04 PM Paul B Mahol  wrote:

>
>
> On Mon, Aug 12, 2019 at 9:19 PM Michael Niedermayer 
> wrote:
>
>> Fixes: Ticket7880
>>
>> Signed-off-by: Michael Niedermayer 
>> ---
>>  libavcodec/qtrle.c| 44 +++
>>  tests/ref/fate/qtrle-8bit |  1 +
>>  2 files changed, 41 insertions(+), 4 deletions(-)
>>
>> diff --git a/libavcodec/qtrle.c b/libavcodec/qtrle.c
>> index 2c29547e5a..ab620cdb55 100644
>> --- a/libavcodec/qtrle.c
>> +++ b/libavcodec/qtrle.c
>> @@ -45,6 +45,8 @@ typedef struct QtrleContext {
>>
>>  GetByteContext g;
>>  uint32_t pal[256];
>> +int need_flush;
>> +AVPacket flush_pkt;
>>  } QtrleContext;
>>
>>  #define CHECK_PIXEL_PTR(n)
>>   \
>> @@ -444,6 +446,12 @@ static av_cold int qtrle_decode_init(AVCodecContext
>> *avctx)
>>  return 0;
>>  }
>>
>> +static void qtrle_flush(AVCodecContext *avctx){
>> +QtrleContext *s = avctx->priv_data;
>> +
>> +s->need_flush = 0;
>> +}
>> +
>>  static int qtrle_decode_frame(AVCodecContext *avctx,
>>void *data, int *got_frame,
>>AVPacket *avpkt)
>> @@ -454,11 +462,33 @@ static int qtrle_decode_frame(AVCodecContext *avctx,
>>  int has_palette = 0;
>>  int ret, size;
>>
>> +if (!avpkt->data) {
>> +if (s->need_flush) {
>> +s->need_flush = 0;
>> +if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
>> +return ret;
>> +s->frame->pkt_pos  = s->flush_pkt.pos;
>> +s->frame->pkt_duration = s->flush_pkt.duration;
>> +s->frame->pkt_dts  = s->flush_pkt.dts;
>> +s->frame->pkt_pts  =
>> +s->frame->pts  = s->flush_pkt.pts;
>> +if ((ret = av_frame_ref(data, s->frame)) < 0)
>> +return ret;
>> +*got_frame = 1;
>> +}
>> +return 0;
>> +}
>> +s->flush_pkt = *avpkt;
>> +s->frame->pkt_dts = s->flush_pkt.dts;
>> +
>>  bytestream2_init(&s->g, avpkt->data, avpkt->size);
>>
>>  /* check if this frame is even supposed to change */
>> -if (avpkt->size < 8)
>> +if (avpkt->size < 8) {
>> +s->need_flush = 1;
>>  return avpkt->size;
>> +}
>> +s->need_flush = 0;
>>
>>  /* start after the chunk size */
>>  size = bytestream2_get_be32(&s->g) & 0x3FFF;
>> @@ -471,14 +501,18 @@ static int qtrle_decode_frame(AVCodecContext *avctx,
>>
>>  /* if a header is present, fetch additional decoding parameters */
>>  if (header & 0x0008) {
>> -if (avpkt->size < 14)
>> +if (avpkt->size < 14) {
>> +s->need_flush = 1;
>>  return avpkt->size;
>> +}
>>  start_line = bytestream2_get_be16(&s->g);
>>  bytestream2_skip(&s->g, 2);
>>  height = bytestream2_get_be16(&s->g);
>>  bytestream2_skip(&s->g, 2);
>> -if (height > s->avctx->height - start_line)
>> +if (height > s->avctx->height - start_line) {
>> +s->need_flush = 1;
>>  return avpkt->size;
>> +}
>>  } else {
>>  start_line = 0;
>>  height = s->avctx->height;
>> @@ -572,5 +606,7 @@ AVCodec ff_qtrle_decoder = {
>>  .init   = qtrle_decode_init,
>>  .close  = qtrle_decode_end,
>>  .decode = qtrle_decode_frame,
>> -.capabilities   = AV_CODEC_CAP_DR1,
>> +.flush  = qtrle_flush,
>> +.caps_internal  = FF_CODEC_CAP_SETS_PKT_DTS,
>> +.capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
>>  };
>> diff --git a/tests/ref/fate/qtrle-8bit b/tests/ref/fate/qtrle-8bit
>> index 27bb8aad71..39a03b7b6c 100644
>> --- a/tests/ref/fate/qtrle-8bit
>> +++ b/tests/ref/fate/qtrle-8bit
>> @@ -61,3 +61,4 @@
>>  0,160,160,1,   921600, 0xcfd6ad2b
>>  0,163,163,1,   921600, 0x3b372379
>>  0,165,165,1,   921600, 0x36f245f5
>> +0,166,166,1,   921600, 0x36f245f5
>> --
>>
>
>
> I dislike this hack and I'm for removing hack that removes dupe frames all
> together.
>

To all codecs that exhibit it. Not just qtrle


> 2.22.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 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] fftools: Use right function signature and pointers

2019-08-14 Thread Paul B Mahol
LGTM

On Mon, Aug 12, 2019 at 11:59 PM Andreas Rheinhardt <
andreas.rheinha...@gmail.com> wrote:

> Andreas Rheinhardt:
> > The option tables of the various fftools (in particular ffprobe) are
> > arrays of OptionDef; said type contains a union of a pointer to void and
> > a function pointer of type int (*)(void *, const char *, const char *)
> > as well as a size_t. Some entries (namely the common entry for writing a
> > report as well as several more of ffprobe's entries) used the pointer to
> > void to store a pointer to functions of type int (*)(const char *) or
> > type int (*)(const char *, const char *); nevertheless, when the
> functions
> > are actually called in write_option (in cmdutils.c), it is done via a
> > pointer of the first type.
> >
> > There are two things wrong here:
> > 1. Pointer to void can be converted to any pointer to incomplete or
> > object type and back; but they are nevertheless not completely generic
> > pointers: There is no provision in the C standard that guarantees their
> > convertibility with function pointers. C90 lacks a generic function
> > pointer, C99 made every function pointer a generic function pointer and
> > still disallows the convertibility with void *.
> > 2. The signature of the called function differs from the signature
> > of the pointed-to type. This is undefined behaviour in C99 (given that
> > C90 lacks a way to convert function pointers at all, it doesn't say
> > anything about such a situation). It only works because none of the
> > functions this patch is about make any use of their parameters at all.
> >
> > Therefore this commit changes the type of the relevant functions
> > to match the type used for the call and uses the union's function
> > pointer to store it. This is legal even in C90.
> >
> > Signed-off-by: Andreas Rheinhardt 
> > ---
> > There are other places in the codebase that use a pointer to void to
> > store a function pointer. Should they be changed or not?
> >
> >  fftools/cmdutils.c |  2 +-
> >  fftools/cmdutils.h |  4 ++--
> >  fftools/ffprobe.c  | 26 +-
> >  3 files changed, 16 insertions(+), 16 deletions(-)
> >
> > diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
> > index 9cfbc45c2b..fdcd376b76 100644
> > --- a/fftools/cmdutils.c
> > +++ b/fftools/cmdutils.c
> > @@ -1046,7 +1046,7 @@ static int init_report(const char *env)
> >  return 0;
> >  }
> >
> > -int opt_report(const char *opt)
> > +int opt_report(void *optctx, const char *opt, const char *arg)
> >  {
> >  return init_report(NULL);
> >  }
> > diff --git a/fftools/cmdutils.h b/fftools/cmdutils.h
> > index 6e2e0a2acb..1917510589 100644
> > --- a/fftools/cmdutils.h
> > +++ b/fftools/cmdutils.h
> > @@ -99,7 +99,7 @@ int opt_default(void *optctx, const char *opt, const
> char *arg);
> >   */
> >  int opt_loglevel(void *optctx, const char *opt, const char *arg);
> >
> > -int opt_report(const char *opt);
> > +int opt_report(void *optctx, const char *opt, const char *arg);
> >
> >  int opt_max_alloc(void *optctx, const char *opt, const char *arg);
> >
> > @@ -236,7 +236,7 @@ void show_help_options(const OptionDef *options,
> const char *msg, int req_flags,
> >  { "colors",  OPT_EXIT, { .func_arg = show_colors
> },  "show available color names" },\
> >  { "loglevel",HAS_ARG,  { .func_arg = opt_loglevel
> }, "set logging level", "loglevel" }, \
> >  { "v",   HAS_ARG,  { .func_arg = opt_loglevel
> }, "set logging level", "loglevel" }, \
> > -{ "report",  0,{ (void*)opt_report },
>   "generate a report" }, \
> > +{ "report",  0,{ .func_arg = opt_report },
>  "generate a report" }, \
> >  { "max_alloc",   HAS_ARG,  { .func_arg = opt_max_alloc
> },"set maximum size of a single allocated block", "bytes" }, \
> >  { "cpuflags",HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags
> }, "force specific cpu flags", "flags" }, \
> >  { "hide_banner", OPT_BOOL | OPT_EXPERT, {&hide_banner}, "do not
> show program banner", "hide_banner" },  \
> > diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> > index 5aaddb0308..2380417229 100644
> > --- a/fftools/ffprobe.c
> > +++ b/fftools/ffprobe.c
> > @@ -3471,7 +3471,7 @@ static int opt_sections(void *optctx, const char
> *opt, const char *arg)
> >  return 0;
> >  }
> >
> > -static int opt_show_versions(const char *opt, const char *arg)
> > +static int opt_show_versions(void *optctx, const char *opt, const char
> *arg)
> >  {
> >  mark_section_show_entries(SECTION_ID_PROGRAM_VERSION, 1, NULL);
> >  mark_section_show_entries(SECTION_ID_LIBRARY_VERSION, 1, NULL);
> > @@ -3479,7 +3479,7 @@ static int opt_show_versions(const char *opt,
> const char *arg)
> >  }
> >
> >  #define DEFINE_OPT_SHOW_SECTION(section, target_section_id)
>  \
> > -static in

Re: [FFmpeg-devel] [PATCH 08/13] avformat/avformat.h: Correct some comments

2019-08-14 Thread Paul B Mahol
On Tue, Aug 13, 2019 at 12:03 PM Carl Eugen Hoyos 
wrote:

> Am Di., 13. Aug. 2019 um 04:49 Uhr schrieb Andreas Rheinhardt
> :
> >
> > 1. When set_parameters was removed from AVOutputFormat in 2fb75019, it
> > was forgotten to remove the comment pertaining to it. Said comment now
> > appeared to apply to interleave_packet; it is of course nonsense and has
> > been replaced by an accurate description.
> > 2. The description of av_write_uncoded_frame suggested
> > av_interleaved_write_frame as a replacement if the input is not
> > already correctly interleaved; it also referred to said function for
> > details. Given that said function can't write AVFrames and that the
> > stuff specific to writing uncoded frames is explained in the description
> > of av_interleaved_write_uncoded_frame, both references have been fixed.
> > 3. Removed an outdated comment about avformat_seek_file.
> >
> > Signed-off-by: Andreas Rheinhardt 
> > ---
> >  libavformat/avformat.h | 9 -
> >  libavformat/version.h  | 2 +-
> >  2 files changed, 5 insertions(+), 6 deletions(-)
> >
> > diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> > index 6eb329f13f..92c3a89f4b 100644
> > --- a/libavformat/avformat.h
> > +++ b/libavformat/avformat.h
> > @@ -556,7 +556,8 @@ typedef struct AVOutputFormat {
> >  int (*write_packet)(struct AVFormatContext *, AVPacket *pkt);
> >  int (*write_trailer)(struct AVFormatContext *);
> >  /**
> > - * Currently only used to set pixel format if not YUV420P.
> > + * A format-specific function for interleavement.
> > + * If unset, packets will be interleaved by dts.
> >   */
> >  int (*interleave_packet)(struct AVFormatContext *, AVPacket *out,
> >   AVPacket *in, int flush);
> > @@ -2449,8 +2450,6 @@ int av_seek_frame(AVFormatContext *s, int
> stream_index, int64_t timestamp,
> >   * @return >=0 on success, error code otherwise
> >   *
> >   * @note This is part of the new seek API which is still under
> construction.
> > - *   Thus do not use this yet. It may change at any time, do not
> expect
> > - *   ABI compatibility yet!
> >   */
> >  int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t
> min_ts, int64_t ts, int64_t max_ts, int flags);
> >
> > @@ -2637,9 +2636,9 @@ int av_interleaved_write_frame(AVFormatContext *s,
> AVPacket *pkt);
> >   * Write an uncoded frame to an output media file.
> >   *
> >   * The frame must be correctly interleaved according to the container
> > - * specification; if not, then av_interleaved_write_frame() must be
> used.
> > + * specification; if not, av_interleaved_write_uncoded_frame() must be
> used.
> >   *
> > - * See av_interleaved_write_frame() for details.
> > + * See av_interleaved_write_uncoded_frame() for details.
> >   */
> >  int av_write_uncoded_frame(AVFormatContext *s, int stream_index,
> > AVFrame *frame);
> > diff --git a/libavformat/version.h b/libavformat/version.h
> > index 45efaff9b9..feceaedc08 100644
> > --- a/libavformat/version.h
> > +++ b/libavformat/version.h
> > @@ -32,7 +32,7 @@
> >  // Major bumping may affect Ticket5467, 5421, 5451(compatibility with
> Chromium)
> >  // Also please add any ticket numbers that you believe might be
> affected here
> >  #define LIBAVFORMAT_VERSION_MAJOR  58
>
> > -#define LIBAVFORMAT_VERSION_MINOR  30
> > +#define LIBAVFORMAT_VERSION_MINOR  31
>
> Seems unneeded to me.
>

Yes, minor is too much, at most micro, but even that is unneeded.


>
> 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 03/13] avformat/mux: Use const AVPacket * in compare functions

2019-08-14 Thread Paul B Mahol
LGTM

On Tue, Aug 13, 2019 at 4:49 AM Andreas Rheinhardt <
andreas.rheinha...@gmail.com> wrote:

> There is no reason for these functions to modify the given packets at
> all.
>
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavformat/audiointerleave.c | 2 +-
>  libavformat/audiointerleave.h | 2 +-
>  libavformat/gxfenc.c  | 5 +++--
>  libavformat/internal.h| 2 +-
>  libavformat/mux.c | 6 +++---
>  libavformat/mxfenc.c  | 3 ++-
>  6 files changed, 11 insertions(+), 9 deletions(-)
>
> diff --git a/libavformat/audiointerleave.c b/libavformat/audiointerleave.c
> index dea5d99821..b602eb7105 100644
> --- a/libavformat/audiointerleave.c
> +++ b/libavformat/audiointerleave.c
> @@ -108,7 +108,7 @@ static int interleave_new_audio_packet(AVFormatContext
> *s, AVPacket *pkt,
>
>  int ff_audio_rechunk_interleave(AVFormatContext *s, AVPacket *out,
> AVPacket *pkt, int flush,
>  int (*get_packet)(AVFormatContext *, AVPacket *,
> AVPacket *, int),
> -int (*compare_ts)(AVFormatContext *, AVPacket *,
> AVPacket *))
> +int (*compare_ts)(AVFormatContext *, const
> AVPacket *, const AVPacket *))
>  {
>  int i, ret;
>
> diff --git a/libavformat/audiointerleave.h b/libavformat/audiointerleave.h
> index 4d77832fa1..f28d5fefcc 100644
> --- a/libavformat/audiointerleave.h
> +++ b/libavformat/audiointerleave.h
> @@ -50,6 +50,6 @@ void ff_audio_interleave_close(AVFormatContext *s);
>   */
>  int ff_audio_rechunk_interleave(AVFormatContext *s, AVPacket *out,
> AVPacket *pkt, int flush,
>  int (*get_packet)(AVFormatContext *, AVPacket *,
> AVPacket *, int),
> -int (*compare_ts)(AVFormatContext *, AVPacket *,
> AVPacket *));
> +int (*compare_ts)(AVFormatContext *, const
> AVPacket *, const AVPacket *));
>
>  #endif /* AVFORMAT_AUDIOINTERLEAVE_H */
> diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c
> index 3507c00b40..ad9ddea887 100644
> --- a/libavformat/gxfenc.c
> +++ b/libavformat/gxfenc.c
> @@ -987,10 +987,11 @@ static int gxf_write_packet(AVFormatContext *s,
> AVPacket *pkt)
>  return 0;
>  }
>
> -static int gxf_compare_field_nb(AVFormatContext *s, AVPacket *next,
> AVPacket *cur)
> +static int gxf_compare_field_nb(AVFormatContext *s, const AVPacket *next,
> +const AVPacket *cur)
>  {
>  GXFContext *gxf = s->priv_data;
> -AVPacket *pkt[2] = { cur, next };
> +const AVPacket *pkt[2] = { cur, next };
>  int i, field_nb[2];
>  GXFStreamContext *sc[2];
>
> diff --git a/libavformat/internal.h b/libavformat/internal.h
> index cf8c16579c..d6a039c497 100644
> --- a/libavformat/internal.h
> +++ b/libavformat/internal.h
> @@ -237,7 +237,7 @@ int ff_hex_to_data(uint8_t *data, const char *p);
>   * @return 0, or < 0 on error
>   */
>  int ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt,
> - int (*compare)(AVFormatContext *, AVPacket
> *, AVPacket *));
> + int (*compare)(AVFormatContext *, const
> AVPacket *, const AVPacket *));
>
>  void ff_read_frame_flush(AVFormatContext *s);
>
> diff --git a/libavformat/mux.c b/libavformat/mux.c
> index 870e716950..2728c62de5 100644
> --- a/libavformat/mux.c
> +++ b/libavformat/mux.c
> @@ -917,7 +917,7 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt)
>  #define CHUNK_START 0x1000
>
>  int ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt,
> - int (*compare)(AVFormatContext *, AVPacket
> *, AVPacket *))
> + int (*compare)(AVFormatContext *, const
> AVPacket *, const AVPacket *))
>  {
>  int ret;
>  AVPacketList **next_point, *this_pktl;
> @@ -991,8 +991,8 @@ next_non_null:
>  return 0;
>  }
>
> -static int interleave_compare_dts(AVFormatContext *s, AVPacket *next,
> -  AVPacket *pkt)
> +static int interleave_compare_dts(AVFormatContext *s, const AVPacket
> *next,
> +  const AVPacket *pkt)
>  {
>  AVStream *st  = s->streams[pkt->stream_index];
>  AVStream *st2 = s->streams[next->stream_index];
> diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
> index 2e54320cf0..8b3d599a6f 100644
> --- a/libavformat/mxfenc.c
> +++ b/libavformat/mxfenc.c
> @@ -3148,7 +3148,8 @@ static int mxf_interleave_get_packet(AVFormatContext
> *s, AVPacket *out, AVPacket
>  }
>  }
>
> -static int mxf_compare_timestamps(AVFormatContext *s, AVPacket *next,
> AVPacket *pkt)
> +static int mxf_compare_timestamps(AVFormatContext *s, const AVPacket
> *next,
> +  const AVPacket *pkt)
>  {
>  MXFStreamContext *sc  = s->streams[pkt ->stream_index]->priv_data;
>  MXFStreamContext *sc2 = s->streams[next->stream_index]->priv_data;
> --
> 2.21.0
>
> 

Re: [FFmpeg-devel] [PATCH 09/13] avformat/mux: Don't use av_ prefix for static functions

2019-08-14 Thread Paul B Mahol
LGTM

On Tue, Aug 13, 2019 at 4:50 AM Andreas Rheinhardt <
andreas.rheinha...@gmail.com> wrote:

> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavformat/mux.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/libavformat/mux.c b/libavformat/mux.c
> index efe2e94f40..5b67a793ac 100644
> --- a/libavformat/mux.c
> +++ b/libavformat/mux.c
> @@ -1330,8 +1330,8 @@ int ff_write_chained(AVFormatContext *dst, int
> dst_stream, AVPacket *pkt,
>  return ret;
>  }
>
> -static int av_write_uncoded_frame_internal(AVFormatContext *s, int
> stream_index,
> -   AVFrame *frame, int
> interleaved)
> +static int write_uncoded_frame_internal(AVFormatContext *s, int
> stream_index,
> +AVFrame *frame, int interleaved)
>  {
>  AVPacket pkt, *pktp;
>
> @@ -1360,13 +1360,13 @@ static int
> av_write_uncoded_frame_internal(AVFormatContext *s, int stream_index,
>  int av_write_uncoded_frame(AVFormatContext *s, int stream_index,
> AVFrame *frame)
>  {
> -return av_write_uncoded_frame_internal(s, stream_index, frame, 0);
> +return write_uncoded_frame_internal(s, stream_index, frame, 0);
>  }
>
>  int av_interleaved_write_uncoded_frame(AVFormatContext *s, int
> stream_index,
> AVFrame *frame)
>  {
> -return av_write_uncoded_frame_internal(s, stream_index, frame, 1);
> +return write_uncoded_frame_internal(s, stream_index, frame, 1);
>  }
>
>  int av_write_uncoded_frame_query(AVFormatContext *s, int stream_index)
> --
> 2.21.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 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 7/8] avcodec/qtrle: return last frame even if unchanged

2019-08-14 Thread Paul B Mahol
On Mon, Aug 12, 2019 at 9:19 PM Michael Niedermayer 
wrote:

> Fixes: Ticket7880
>
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/qtrle.c| 44 +++
>  tests/ref/fate/qtrle-8bit |  1 +
>  2 files changed, 41 insertions(+), 4 deletions(-)
>
> diff --git a/libavcodec/qtrle.c b/libavcodec/qtrle.c
> index 2c29547e5a..ab620cdb55 100644
> --- a/libavcodec/qtrle.c
> +++ b/libavcodec/qtrle.c
> @@ -45,6 +45,8 @@ typedef struct QtrleContext {
>
>  GetByteContext g;
>  uint32_t pal[256];
> +int need_flush;
> +AVPacket flush_pkt;
>  } QtrleContext;
>
>  #define CHECK_PIXEL_PTR(n)
> \
> @@ -444,6 +446,12 @@ static av_cold int qtrle_decode_init(AVCodecContext
> *avctx)
>  return 0;
>  }
>
> +static void qtrle_flush(AVCodecContext *avctx){
> +QtrleContext *s = avctx->priv_data;
> +
> +s->need_flush = 0;
> +}
> +
>  static int qtrle_decode_frame(AVCodecContext *avctx,
>void *data, int *got_frame,
>AVPacket *avpkt)
> @@ -454,11 +462,33 @@ static int qtrle_decode_frame(AVCodecContext *avctx,
>  int has_palette = 0;
>  int ret, size;
>
> +if (!avpkt->data) {
> +if (s->need_flush) {
> +s->need_flush = 0;
> +if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
> +return ret;
> +s->frame->pkt_pos  = s->flush_pkt.pos;
> +s->frame->pkt_duration = s->flush_pkt.duration;
> +s->frame->pkt_dts  = s->flush_pkt.dts;
> +s->frame->pkt_pts  =
> +s->frame->pts  = s->flush_pkt.pts;
> +if ((ret = av_frame_ref(data, s->frame)) < 0)
> +return ret;
> +*got_frame = 1;
> +}
> +return 0;
> +}
> +s->flush_pkt = *avpkt;
> +s->frame->pkt_dts = s->flush_pkt.dts;
> +
>  bytestream2_init(&s->g, avpkt->data, avpkt->size);
>
>  /* check if this frame is even supposed to change */
> -if (avpkt->size < 8)
> +if (avpkt->size < 8) {
> +s->need_flush = 1;
>  return avpkt->size;
> +}
> +s->need_flush = 0;
>
>  /* start after the chunk size */
>  size = bytestream2_get_be32(&s->g) & 0x3FFF;
> @@ -471,14 +501,18 @@ static int qtrle_decode_frame(AVCodecContext *avctx,
>
>  /* if a header is present, fetch additional decoding parameters */
>  if (header & 0x0008) {
> -if (avpkt->size < 14)
> +if (avpkt->size < 14) {
> +s->need_flush = 1;
>  return avpkt->size;
> +}
>  start_line = bytestream2_get_be16(&s->g);
>  bytestream2_skip(&s->g, 2);
>  height = bytestream2_get_be16(&s->g);
>  bytestream2_skip(&s->g, 2);
> -if (height > s->avctx->height - start_line)
> +if (height > s->avctx->height - start_line) {
> +s->need_flush = 1;
>  return avpkt->size;
> +}
>  } else {
>  start_line = 0;
>  height = s->avctx->height;
> @@ -572,5 +606,7 @@ AVCodec ff_qtrle_decoder = {
>  .init   = qtrle_decode_init,
>  .close  = qtrle_decode_end,
>  .decode = qtrle_decode_frame,
> -.capabilities   = AV_CODEC_CAP_DR1,
> +.flush  = qtrle_flush,
> +.caps_internal  = FF_CODEC_CAP_SETS_PKT_DTS,
> +.capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
>  };
> diff --git a/tests/ref/fate/qtrle-8bit b/tests/ref/fate/qtrle-8bit
> index 27bb8aad71..39a03b7b6c 100644
> --- a/tests/ref/fate/qtrle-8bit
> +++ b/tests/ref/fate/qtrle-8bit
> @@ -61,3 +61,4 @@
>  0,160,160,1,   921600, 0xcfd6ad2b
>  0,163,163,1,   921600, 0x3b372379
>  0,165,165,1,   921600, 0x36f245f5
> +0,166,166,1,   921600, 0x36f245f5
> --
>


I dislike this hack and I'm for removing hack that removes dupe frames all
together.

2.22.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 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] libavformat/rtspdec: Don't send teardown if rtsp_hd_out is null

2019-08-14 Thread Ross Nicholson
I would imagine that the way Kodi handles the stream, rtsp_hd_out is null
as per the following:

URLContext  *
rtsp_hd_out

  Additional output handle, used when input and output are done separately,
eg for HTTP tunneling.
In your case it would not be.

On Wed, 14 Aug 2019 at 09:50, Ross Nicholson  wrote:

>
>
> On Wed, 14 Aug 2019 at 07:20, Moritz Barsnick  wrote:
>
>> On Mon, Aug 05, 2019 at 08:18:32 +0100, Ross Nicholson wrote:
>> > Example stream that does not work: rtsp://
>> 184.72.239.149/vod/mp4:BigBuckBunny_115k.mov
>> >
>> > Extending the condition allows the stream to be processed correctly.
>>
>> Can you give a bit more detail? Decoding this stream works for me (at
>> last the first 20 seconds or so).
>>
>>
> We made some changes in Kodi regardless handling TS streams the right way.
> An unfortunate side effect was that we caused an issue with RTSP streams
> due to an issue in rtsp_send_cmd_with_content_async. The issue can be
> avoided once sending teardown is skipped if rtsp_hd_out is null.
>
>
>> > On Mon, 5 Aug 2019 at 08:17, Ross Nicholson 
>> wrote:
>> > > From: phunkyfish 
>>
>> Do you want your real name or this pseudonym registered in the repo? It
>> can't be changed afterwards.
>>
>
> Yes, that email is registered on github if that's what you mean.
>
>>
>> Moritz
>> ___
>> 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] libavformat/rtspdec: Don't send teardown if rtsp_hd_out is null

2019-08-14 Thread Ross Nicholson
On Wed, 14 Aug 2019 at 07:20, Moritz Barsnick  wrote:

> On Mon, Aug 05, 2019 at 08:18:32 +0100, Ross Nicholson wrote:
> > Example stream that does not work: rtsp://
> 184.72.239.149/vod/mp4:BigBuckBunny_115k.mov
> >
> > Extending the condition allows the stream to be processed correctly.
>
> Can you give a bit more detail? Decoding this stream works for me (at
> last the first 20 seconds or so).
>
>
We made some changes in Kodi regardless handling TS streams the right way.
An unfortunate side effect was that we caused an issue with RTSP streams
due to an issue in rtsp_send_cmd_with_content_async. The issue can be
avoided once sending teardown is skipped if rtsp_hd_out is null.


> > On Mon, 5 Aug 2019 at 08:17, Ross Nicholson 
> wrote:
> > > From: phunkyfish 
>
> Do you want your real name or this pseudonym registered in the repo? It
> can't be changed afterwards.
>

Yes, that email is registered on github if that's what you mean.

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

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

Re: [FFmpeg-devel] [PATCH 2/8] tools/target_dec_fuzzer: adjust pixel threshold for MSRLE, as it allows coding gigantic images on tiny input

2019-08-14 Thread Paul B Mahol
lgtm

On Mon, Aug 12, 2019 at 9:19 PM Michael Niedermayer 
wrote:

> Fixes: Timeout (12sec ->2sec)
> Fixes:
> 16125/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MSRLE_fuzzer-5650846364205056
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by
> :
> Michael Niedermayer 
> ---
>  tools/target_dec_fuzzer.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
> index e6eed88781..d83039417c 100644
> --- a/tools/target_dec_fuzzer.c
> +++ b/tools/target_dec_fuzzer.c
> @@ -170,6 +170,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t
> size) {
>  maxpixels = maxpixels_per_frame * maxiteration;
>  switch (c->id) {
>  // Allows a small input to generate gigantic output
> +case AV_CODEC_ID_MSRLE: maxpixels /= 16;  break;
>  case AV_CODEC_ID_QTRLE: maxpixels /= 16;  break;
>  case AV_CODEC_ID_GIF:   maxpixels /= 16;  break;
>  // Performs slow frame rescaling in C
> --
> 2.22.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 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/8] tools/target_dec_fuzzer: adjust pixel threshold for MSRLE, as it allows coding gigantic images on tiny input

2019-08-14 Thread Michael Niedermayer
On Wed, Aug 14, 2019 at 07:02:29PM +0200, Paul B Mahol wrote:
> lgtm

will apply

thx

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

What does censorship reveal? It reveals fear. -- Julian Assange


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

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

Re: [FFmpeg-devel] [PATCH 4/8] avcodec/loco: Check left column value

2019-08-14 Thread Michael Niedermayer
On Wed, Aug 14, 2019 at 06:00:01PM +0200, Paul B Mahol wrote:
> LGTM

will apply

thx

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

The worst form of inequality is to try to make unequal things equal.
-- Aristotle


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 6/8] avcodec/decode: Do not overwrite AVFrame.pkt_pos if its already set

2019-08-14 Thread Michael Niedermayer
On Mon, Aug 12, 2019 at 09:03:22PM -0300, James Almer wrote:
> On 8/12/2019 5:31 PM, Michael Niedermayer wrote:
> > On Mon, Aug 12, 2019 at 09:21:59PM +0200, Vittorio Giovara wrote:
> >> On Mon, Aug 12, 2019 at 9:19 PM Michael Niedermayer 
> >> 
> >> wrote:
> >>
> >>> Signed-off-by: Michael Niedermayer 
> >>> ---
> >>>  libavcodec/decode.c | 2 +-
> >>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>>
> >>> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> >>> index 6c31166ec2..09a509d659 100644
> >>> --- a/libavcodec/decode.c
> >>> +++ b/libavcodec/decode.c
> >>> @@ -435,7 +435,7 @@ static int decode_simple_internal(AVCodecContext
> >>> *avctx, AVFrame *frame)
> >>>  if (!(avctx->codec->caps_internal & FF_CODEC_CAP_SETS_PKT_DTS))
> >>>  frame->pkt_dts = pkt->dts;
> >>>  if (avctx->codec->type == AVMEDIA_TYPE_VIDEO) {
> >>> -if(!avctx->has_b_frames)
> >>> +if(!avctx->has_b_frames && frame->pkt_pos < 0)
> >>>  frame->pkt_pos = pkt->pos;
> >>>  //FIXME these should be under if(!avctx->has_b_frames)
> >>>  /* get_buffer is supposed to set frame parameters */
> >>> --
> >>>
> >>
> >> sure but why?
> > 
> > the next 2 patches need this
> > [FFmpeg-devel] [PATCH 7/8] avcodec/qtrle: return last frame even if 
> > unchanged
> > [FFmpeg-devel] [PATCH 8/8] avcodec/nuv: Avoid duplicating frames
> > 
> > without it the common code overwrites the pkt_pos set by the decoder
> 
> What about rawdec.c? It's also setting frame->pkt_pos.

That looks redundant (will send patch after testing)


> 
> And cant' this be handled with a new internal codec cap like the pkt_dts
> one used above?

yes, if thats preferred ?

Thanks

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

If you drop bombs on a foreign country and kill a hundred thousand
innocent people, expect your government to call the consequence
"unprovoked inhuman terrorist attacks" and use it to justify dropping
more bombs and killing more people. The technology changed, the idea is old.


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 5/8] avcodec/flicvideo: Optimize and Simplify FLI_COPY in flic_decode_frame_24BPP() by using bytestream2_get_buffer()

2019-08-14 Thread Michael Niedermayer
On Wed, Aug 14, 2019 at 05:21:49PM +0200, Tomas Härdin wrote:
> mån 2019-08-12 klockan 21:17 +0200 skrev Michael Niedermayer:
> > Fixes: Timeout (31sec  -> 22sec)
> 
> Is this a large test case? 22sec still sounds excessive

the input is about 240kbyte so 22sec is not great but thats what you get
copying large frames around


> 
> > -pixel_countdown = s->avctx->width;
> > -pixel_ptr = 0;
> > -while (pixel_countdown > 0) {
> > -pixel = bytestream2_get_le24(&g2);
> > -AV_WL24(&pixels[y_ptr + pixel_ptr], pixel);
> > -pixel_ptr += 3;
> > -pixel_countdown--;
> > -}
> > +bytestream2_get_buffer(&g2, pixels + y_ptr, 3*s-
> > >avctx->width);
> 
> Looks OK

will apply

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you fake or manipulate statistics in a paper in physics you will never
get a job again.
If you fake or manipulate statistics in a paper in medicin you will get
a job for life at the pharma industry.


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] libavutil: AVEncodeInfo data structures

2019-08-14 Thread Juan De León
On Wed, Aug 14, 2019 at 12:10 AM Nicolas George  wrote:

> James Almer (12019-08-13):
> > I'm fairly sure this was discussed before, but invalid arguments
> > shouldn't crash an user's application. They even have their own
> > standardized errno value for this purpose.
> > asserts() are to catch bugs in our code, not in theirs. Returning a NULL
> > pointer is the preferred behavior.
>
> I do not agree. Asserts are to catch all bugs that can be catched
> statically. There is no sense in making some bugs harder to catch just
> because they involve separate developers.
>
> Nobody can predict whether a disk will make a I/O error, whether there
> will be enough memory, etc., that kind of error MUST be handled
> gracefully.
>
> On the other hand, it is easy to make sure that a buffer given to read()
> is not NULL, and therefore it is very acceptable to just crash when that
> happens.
>
> EINVAL is for cases where the acceptable value cannot be easily
> predicted by the caller. For example, setting an unsupported sample rate
> for the sound device: the caller could check in advance, but that would
> be cumbersome.
>
> Now, please tell me, according to you, "idx is not smaller than
> nb_blocks", is it more akin to a disk I/O error, a NULL buffer or an
> invalid sample rate?
>
> Another argument:
>
> Instead of providing utility code, we could just document the
> arithmetic. In that case, the application would have code that says, in
> essence: "block = info + offset + idx * block_size". No check. What
> would happen if idx was too big? Not a graceful error: a crash, or
> worse.
>
> The assert mimics that, in a more convenient way since it gives the
> reason and line number, and does not allow the bug to devolve into
> something more serious than a crash.
>
> Regards,
>
> --
>   Nicolas George
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


In that case, I believe documenting the size of the array and behaviour of
undefined indexes should be enough. Have the pointers return NULL,
and let the user handle the result, instead of stopping the execution.

I would prefer to discuss the actual data structure for now.
___
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 8/8] avcodec/nuv: Avoid duplicating frames

2019-08-14 Thread Michael Niedermayer
On Wed, Aug 14, 2019 at 06:02:13PM +0200, Paul B Mahol wrote:
> On Mon, Aug 12, 2019 at 9:20 PM Michael Niedermayer 
> wrote:
> 
> > Fixes: Timeout (14sec -> 133ms)
> > Fixes:
> > 14843/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_NUV_fuzzer-5661969614372864
> > Fixes:
> > 16257/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_NUV_fuzzer-5769175464673280
> > (35sec ->0.5sec)
> >
> >
> Why? This is bad idea, same like for qtrle and bunch of other cases.

This was discussed previously IIRC
Either a codec can be used to turn tiny input to huge number of output frames 
by frame duplication. or
it doesnt do the duplication and rather provides metadata of some sort

In the first case if the next step is a filter it can be slower
In the first case if the next step is a variable fps encoder it can be slower
in the first case it can make a DOS attack less expensive for an attacker

The second case, that is with metadata for example not returning a frame but
relying on timestamps these issues are reduced
thats why i suggest that way but if the community prefers something else then
sure it can be done. But from what i remember the oppinions where mixed on
which way is preferred

thanks

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

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data


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

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

Re: [FFmpeg-devel] [PATCH 1/2] avutil: Add Simple loop detector

2019-08-14 Thread Michael Niedermayer
On Tue, Aug 13, 2019 at 12:11:30PM +0200, Lynne wrote:
> Aug 12, 2019, 20:53 by mich...@niedermayer.cc:
> 
> > On Sun, Aug 11, 2019 at 08:30:51PM +0200, Reimar Döffinger wrote:
> >
> >> On 08.08.2019, at 10:36, Michael Niedermayer  
> >> wrote:
> >>
> >> > This provides an alternative to retry counters.
> >> > Useful if there is no reasonable maximum number of iterations and
> >> > no ordering that naturally avoids loops.
> >>
> >> Going by the old principle of "an API is not tested until it has at least 
> >> 3 users"
> >> might it make sense to delay this until we've found and tested it in a few 
> >> use-cases?
> >> Depending on how much hurry there is to get the bug-fix in.
> >>
> >> I assume there is also an actual bug-fix patch somewhere, maybe we should 
> >> have that
> >> in the same patch series to make it easier to review the actual usage?
> >>
> >
> > sure will repost this eventually with 3+ bugfixes.
> > But wont search for such bugs ATM as ive too many other things to do
> > so it might take a bit of time before i do
> >
> >
> >>
> >> > diff --git a/doc/APIchanges b/doc/APIchanges
> >> > index 6603a8229e..eee4c30ec5 100644
> >> > --- a/doc/APIchanges
> >> > +++ b/doc/APIchanges
> >> > @@ -15,6 +15,9 @@ libavutil: 2017-10-21
> >> > 
> >> > API changes, most recent first:
> >> > 
> >> > +2019-XX-XX - XX - lavu 56.XX.XXX - loop_detector.h
> >> > +  Add loop_detector.h, av_is_loop(), AVSimpleLoopDetector
> >>
> >> Does is mean it is a public/installed header?
> >>
> >
> > that was intended, but it can of course be trivially be kept local if people
> > prefer when i repost with 3+ dependant fixes 
> >
> 
> You are ignoring 2 developers, and this isn't the first time you're doing 
> this, nor even the second.
> I still do no think even with 3 bugfixes this deserves to be in lavu but 
> rather in every library as a non-installed header, at the very most. I still 
> prefer for code to be duplicated for such a small amount of fixes.
> Iit could encourage other developers to put this in their code when it isn't 
> needed when a properly written loop would never go infinite.
> And, regardless where this code goes, its still as its been pointed out, a 
> hack.

why are you agressive ?
this is just a patch that is not ready to be applied as reimar asked for 3
dependant bugfixes.
We can discuss where to put the header when theres actual code that can be
commited. discussing it before we can see the whole patchset makes no real
sense.
I mean you complain that something would have been done thats not even
possible ATM given the peoples requests in the review ...

thanks

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

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates


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

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

Re: [FFmpeg-devel] [PATCH 1/1] avformat/matroska: fully parse stsd atom in v_quicktime tracks

2019-08-14 Thread Stanislav Ionascu
On Tue, Aug 13, 2019 at 10:22 PM Andreas Rheinhardt
 wrote:
>
> Stanislav Ionascu:
> > Per matroska spec, v_quicktime contains the complete stsd atom, after
> > the mandatory size + fourcc. By properly parsing the hvcc sub-atoms of
> > the track, it becomes possible to demux/decode mp4/mov tracks stored as is
> > in matroska containers.
> >
> > Also dvh1 in stsd in matroska is more likely hevc codec than dv.
> >
> > Signed-off-by: Stanislav Ionascu 
> > ---
> >  libavformat/matroskadec.c | 51 +++
> >  1 file changed, 36 insertions(+), 15 deletions(-)
> >
> > diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> > index 4e20f15792..88bc89c545 100644
> > --- a/libavformat/matroskadec.c
> > +++ b/libavformat/matroskadec.c
> > @@ -2473,25 +2473,46 @@ static int matroska_parse_tracks(AVFormatContext *s)
> >  } else if (!strcmp(track->codec_id, "V_QUICKTIME") &&
> > (track->codec_priv.size >= 21)  &&
> > (track->codec_priv.data)) {
> > +MOVStreamContext *msc;
> > +MOVContext *mc = NULL;
> > +AVIOContext *stsd_ctx = NULL;
> > +void *priv_data;
> > +int nb_streams;
> >  int ret = get_qt_codec(track, &fourcc, &codec_id);
> >  if (ret < 0)
> >  return ret;
> > -if (codec_id == AV_CODEC_ID_NONE && 
> > AV_RL32(track->codec_priv.data+4) == AV_RL32("SMI ")) {
> > -fourcc = MKTAG('S','V','Q','3');
> > -codec_id = ff_codec_get_id(ff_codec_movvideo_tags, fourcc);
> > +av_log(matroska->ctx, AV_LOG_TRACE,
> > +   "FourCC found %s.\n", av_fourcc2str(fourcc));
> > +priv_data = st->priv_data;
> > +nb_streams = s->nb_streams;
> > +mc = av_mallocz(sizeof(*mc));
> > +if (!mc)
> > +return AVERROR(ENOMEM);
> > +stsd_ctx = avio_alloc_context(track->codec_priv.data,
> > +track->codec_priv.size,
> > +0, NULL, NULL, NULL, NULL);
> > +if (!stsd_ctx)
> > +return AVERROR(ENOMEM);
> I haven't looked at this patch deeply yet, but it seems to me that you
> should rather use ffio_init_context like it is done in the code that
> you intend to delete. That saves allocating and freeing stsd_ctx. You
> can even reuse the AVIOContext b that already exists on the stack.

Done.

> > +mc->fc = s;
> > +st->priv_data = msc = av_mallocz(sizeof(MOVStreamContext));
> > +if (!msc) {
> > +av_free(mc);
> > +st->priv_data = priv_data;
> > +return AVERROR(ENOMEM);
> >  }
> > -if (codec_id == AV_CODEC_ID_NONE)
> > -av_log(matroska->ctx, AV_LOG_ERROR,
> > -   "mov FourCC not found %s.\n", 
> > av_fourcc2str(fourcc));
> > -if (track->codec_priv.size >= 86) {
> > -bit_depth = AV_RB16(track->codec_priv.data + 82);
> > -ffio_init_context(&b, track->codec_priv.data,
> > -  track->codec_priv.size,
> > -  0, NULL, NULL, NULL, NULL);
> > -if (ff_get_qtpalette(codec_id, &b, track->palette)) {
> > -bit_depth &= 0x1F;
> > -track->has_palette = 1;
> Why are you removing this code? What about tracks that ought to have a
> palette?

The palette parsing is done in the stsd parser, but it still has to be
copied back into the track,
which is done in the later patch.

> > -}
> > +/* ff_mov_read_stsd_entries updates stream s->nb_streams-1,
> > + * so set it temporarily to indicate which stream to update. */
> > +s->nb_streams = st->index + 1;
> > +ff_mov_read_stsd_entries(mc, stsd_ctx, 1);
> > +av_free(msc);
> > +av_free(mc);
> > +avio_context_free(&stsd_ctx);
> > +st->priv_data = priv_data;
> > +s->nb_streams = nb_streams;
> > +
> > +// dvh1 in mkv is likely HEVC
> > +if (st->codecpar->codec_tag == MKTAG('d','v','h','1')) {
> > +codec_id = AV_CODEC_ID_HEVC;
> >  }
> >  } else if (codec_id == AV_CODEC_ID_PCM_S16BE) {
> >  switch (track->audio.bitdepth) {
> >
>
> Also, your patch should refer to the exact component that is about to
> be changed: avformat/matroskadec.

Done.

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


0001-avformat-matroskadec-properly-parse-stsd-in-v_quickt.patch
Description: Binary data
___

[FFmpeg-devel] [PATCH] libavutil: AVEncodeInfo data structures

2019-08-14 Thread Juan De León
AVEncodeInfoFrame data structure to store as AVFrameSideData of type
AV_FRAME_DATA_ENCODE_INFO.
The structure stores quantization index for each plane, DC/AC deltas
for luma and chroma planes, and an array of AVEncodeInfoBlock type
denoting position, size, and delta quantizer for each block in the
frame.
Can be extended to support extraction of other block information.

Signed-off-by: Juan De León 
---
 libavutil/Makefile  |   2 +
 libavutil/encode_info.c |  68 
 libavutil/encode_info.h | 112 
 libavutil/frame.c   |   1 +
 libavutil/frame.h   |   7 +++
 5 files changed, 190 insertions(+)
 create mode 100644 libavutil/encode_info.c
 create mode 100644 libavutil/encode_info.h

diff --git a/libavutil/Makefile b/libavutil/Makefile
index 57e6e3d7e8..37cfb099e9 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -24,6 +24,7 @@ HEADERS = adler32.h   
  \
   dict.h\
   display.h \
   downmix_info.h\
+  encode_info.h \
   encryption_info.h \
   error.h   \
   eval.h\
@@ -111,6 +112,7 @@ OBJS = adler32.o
\
dict.o   \
display.o\
downmix_info.o   \
+   encode_info.o\
encryption_info.o\
error.o  \
eval.o   \
diff --git a/libavutil/encode_info.c b/libavutil/encode_info.c
new file mode 100644
index 00..351333cf43
--- /dev/null
+++ b/libavutil/encode_info.c
@@ -0,0 +1,68 @@
+/*
+ * 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 "libavutil/encode_info.h"
+#include "libavutil/mem.h"
+
+static int init_encode_info_data(AVEncodeInfoFrame *info, int nb_blocks) {
+info->nb_blocks = nb_blocks;
+info->block_size = sizeof(AVEncodeInfoBlock);
+info->blocks_offset = offsetof(AVEncodeInfoFrame, blocks);
+
+for(int i = 0; i < AV_NUM_DATA_POINTERS; i++)
+info->plane_q[i] = -1;
+
+return 0;
+}
+
+AVEncodeInfoFrame *av_encode_info_alloc(int nb_blocks)
+{
+AVEncodeInfoFrame *ptr;
+//AVEncodeInfoFrame already allocates size for one element of 
AVEncodeInfoBlock
+size_t size = sizeof(AVEncodeInfoFrame) + 
sizeof(AVEncodeInfoBlock)*FFMAX(nb_blocks - 1, 0);
+
+if (nb_blocks < 0 || size >= INT_MAX)
+return NULL;
+
+ptr = av_mallocz(size);
+if (!ptr)
+return NULL;
+
+init_encode_info_data(ptr, nb_blocks);
+
+return ptr;
+}
+
+AVEncodeInfoFrame *av_encode_info_create_side_data(AVFrame *frame, int 
nb_blocks)
+{
+size_t size = sizeof(AVEncodeInfoFrame) + 
sizeof(AVEncodeInfoBlock)*FFMAX(nb_blocks - 1, 0);
+
+if (nb_blocks < 0 || size >= INT_MAX)
+return NULL;
+
+AVFrameSideData *sd = av_frame_new_side_data(frame,
+ AV_FRAME_DATA_ENCODE_INFO,
+ size);
+if (!sd)
+return NULL;
+
+memset(sd->data, 0, size);
+init_encode_info_data((AVEncodeInfoFrame*)sd->data, nb_blocks);
+
+return (AVEncodeInfoFrame*)sd->data;
+}
diff --git a/libavutil/encode_info.h b/libavutil/encode_info.h
new file mode 100644
index 00..ae0a6563dc
--- /dev/null
+++ b/libavutil/encode_info.h
@@ -0,0 +1,112 @@
+/*
+ * 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; e

Re: [FFmpeg-devel] [PATCH] ffplay: properly detect all window size changes

2019-08-14 Thread Reino Wijnsma
On 2019-08-13T23:20:08+0200, Marton Balint  wrote:
> SDL_WINDOWEVENT_SIZE_CHANGED should be used instead of SDL_WINDOWEVENT_RESIZED
> because SDL_WINDOWEVENT_RESIZED is only emitted if the resize happened due to
> an external event.
>
> Fixes ticket #8072.
>
> Additional references:
> https://bugzilla.libsdl.org/show_bug.cgi?id=4760
> https://wiki.libsdl.org/SDL_WindowEventID
>
> Signed-off-by: Marton Balint 
> ---
>  fftools/ffplay.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fftools/ffplay.c b/fftools/ffplay.c
> index 8fb8faeb06..fee0619f7c 100644
> --- a/fftools/ffplay.c
> +++ b/fftools/ffplay.c
> @@ -3436,7 +3436,7 @@ static void event_loop(VideoState *cur_stream)
>  break;
>  case SDL_WINDOWEVENT:
>  switch (event.window.event) {
> -case SDL_WINDOWEVENT_RESIZED:
> +case SDL_WINDOWEVENT_SIZE_CHANGED:
>  screen_width  = cur_stream->width  = event.window.data1;
>  screen_height = cur_stream->height = event.window.data2;
>  if (cur_stream->vis_texture) {

Applied patch and compiled ffplay locally. I can confirm this patch fixes 
ticket #8072.

-- Reino

___
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] avdevice/decklink: adjust for timecode lag

2019-08-14 Thread Marton Balint



On Wed, 14 Aug 2019, Gyan wrote:




On 09-08-2019 04:59 PM, Ilinca Tudose wrote:

Hi Marton,

The issue with the out of sync TC was reproducible on all tapes and decks
that we tested. I don't have the exact number now, but a few dozens, less
than 100. They all had between 7 and 17 frames out of sync. We were not
able to obtain anything more in sync than 7 frames.

The TC sync was tested by setting up the deck to "burn" the TC with the
image while capturing the content with TC through ffmpeg. We then play the
file in a player that supports timecodes and compare the burned-in TC with
the one captured in the metadata.

We used Decklink quad 2 and several Sony decks: J30, J3, JH3. We tested on
multiple decks from each model and confirmed the issue was present + that
Gyan's patch seemed to fix it. We have used several types of Betacam tapes
and HDCAM tapes. I can not comment on whether this is the best solution,
but can confirm it works.

Let me know if you need more info.

Thanks,
ilinca


Ping.


Sorry, I need a bit more time to investigate.

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

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

Re: [FFmpeg-devel] [REQUEST] ffmpeg-security subscription

2019-08-14 Thread Reimar Döffinger
On 14.08.2019, at 11:45, Paul B Mahol  wrote:
> I strongly disagree with you. Why some people have subscription to security
> mailing list and I'm not allowed also?

Long version, explaining to the best of my knowledge and memory:
The people on it are on it because at some point it was considered necessary to 
have them on it.
You have not brought an argument why the project would need you to be on it in 
order to deal with issues in a satisfactory way.
Generally only basic technical skills are needed, enough to discuss the issue 
and potentially hand over to the maintainer. And whoever is involved in the 
releases is generally needed.
Beyond that I would describe it as a PR function (giving a polite and level 
headed response to a security researcher claiming something that is obvious 
nonsense to an FFmpeg developer tends to make things go much smoother), which I 
would have assumed to not be among your aspirations.
It's definitely not about a "right" or a "priviledge" or having "earned" it, 
it's about need.
And when possible a bit of trust (the personal kind, not just the "not 
malicious" kind which is of course an absolute requirement), though that might 
be more relevant for projects like Linux where really bad stuff causing stress 
and possibly conflicts tends to hit. Flame wars is the last thing one needs in 
the middle of dealing with a bad issue.

TL;DR is probably: one doesn't end up on security lists by asking to be on it 
but by persons Y and Z saying "we should/need to have person X on the list".
I am not aware of any such wishes (though admittedly I wouldn't be the one 
contacted about it I guess).
___
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] libavformat/mxfenc: Allow more bitrates for NTSC IMX50

2019-08-14 Thread Thomas Mundt
Hi Tomas,

Am Mi., 14. Aug. 2019 um 12:42 Uhr schrieb Tomas Härdin :

> tis 2019-08-13 klockan 22:03 +0200 skrev Thomas Mundt:
> > Hi,
> >
> > attached patch fixes ticket #8077.
> > Please comment.
>
> Probably OK, bitrates lower than 5000 are fine in D-10 according to
> S356m.
>
> > } else if ((sc->video_bit_rate >= 4840) && (sc->video_bit_rate <=
> > 5000) && (mxf->time_base.den != 25)) {
>
> You could drop the extra parentheses, else it should be fine.
>

New patch attached.

The real fix is of course to add an explicit CBR mode to lavc, but
> that's a bit more involved than this fix.


IMX is being used less and less. Maybe it´s not worth the effort.

Regards,
Thomas


0001-libavformat-mxfenc-Allow-more-bitrates-for-NTSC-IMX5.patch
Description: Binary data
___
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] ffplay: properly detect all window size changes

2019-08-14 Thread Marton Balint



On Wed, 14 Aug 2019, Reino Wijnsma wrote:


On 2019-08-13T23:20:08+0200, Marton Balint  wrote:

SDL_WINDOWEVENT_SIZE_CHANGED should be used instead of SDL_WINDOWEVENT_RESIZED
because SDL_WINDOWEVENT_RESIZED is only emitted if the resize happened due to
an external event.

Fixes ticket #8072.

Additional references:
https://bugzilla.libsdl.org/show_bug.cgi?id=4760
https://wiki.libsdl.org/SDL_WindowEventID

Signed-off-by: Marton Balint 
---
 fftools/ffplay.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index 8fb8faeb06..fee0619f7c 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -3436,7 +3436,7 @@ static void event_loop(VideoState *cur_stream)
 break;
 case SDL_WINDOWEVENT:
 switch (event.window.event) {
-case SDL_WINDOWEVENT_RESIZED:
+case SDL_WINDOWEVENT_SIZE_CHANGED:
 screen_width  = cur_stream->width  = event.window.data1;
 screen_height = cur_stream->height = event.window.data2;
 if (cur_stream->vis_texture) {


Applied patch and compiled ffplay locally. I can confirm this patch fixes 
ticket #8072.


Thanks for testing, pushed to git master and 4.2 release branch.

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

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

Re: [FFmpeg-devel] [PATCH 1/2] avutil: Add Simple loop detector

2019-08-14 Thread Lynne
Aug 14, 2019, 19:29 by mich...@niedermayer.cc:

> On Tue, Aug 13, 2019 at 12:11:30PM +0200, Lynne wrote:
>
>> Aug 12, 2019, 20:53 by mich...@niedermayer.cc:
>>
>> > On Sun, Aug 11, 2019 at 08:30:51PM +0200, Reimar Döffinger wrote:
>> >
>> >> On 08.08.2019, at 10:36, Michael Niedermayer  
>> >> wrote:
>> >>
>> >> > This provides an alternative to retry counters.
>> >> > Useful if there is no reasonable maximum number of iterations and
>> >> > no ordering that naturally avoids loops.
>> >>
>> >> Going by the old principle of "an API is not tested until it has at least 
>> >> 3 users"
>> >> might it make sense to delay this until we've found and tested it in a 
>> >> few use-cases?
>> >> Depending on how much hurry there is to get the bug-fix in.
>> >>
>> >> I assume there is also an actual bug-fix patch somewhere, maybe we should 
>> >> have that
>> >> in the same patch series to make it easier to review the actual usage?
>> >>
>> >
>> > sure will repost this eventually with 3+ bugfixes.
>> > But wont search for such bugs ATM as ive too many other things to do
>> > so it might take a bit of time before i do
>> >
>> >
>> >>
>> >> > diff --git a/doc/APIchanges b/doc/APIchanges
>> >> > index 6603a8229e..eee4c30ec5 100644
>> >> > --- a/doc/APIchanges
>> >> > +++ b/doc/APIchanges
>> >> > @@ -15,6 +15,9 @@ libavutil: 2017-10-21
>> >> > 
>> >> > API changes, most recent first:
>> >> > 
>> >> > +2019-XX-XX - XX - lavu 56.XX.XXX - loop_detector.h
>> >> > +  Add loop_detector.h, av_is_loop(), AVSimpleLoopDetector
>> >>
>> >> Does is mean it is a public/installed header?
>> >>
>> >
>> > that was intended, but it can of course be trivially be kept local if 
>> > people
>> > prefer when i repost with 3+ dependant fixes 
>> >
>>
>> You are ignoring 2 developers, and this isn't the first time you're doing 
>> this, nor even the second.
>> I still do no think even with 3 bugfixes this deserves to be in lavu but 
>> rather in every library as a non-installed header, at the very most. I still 
>> prefer for code to be duplicated for such a small amount of fixes.
>> Iit could encourage other developers to put this in their code when it isn't 
>> needed when a properly written loop would never go infinite.
>> And, regardless where this code goes, its still as its been pointed out, a 
>> hack.
>>
>
> why are you agressive ?
>

I can't find a single hint of aggression in my email. I'm being direct and 
factual.
If you see this as aggression you shouldn't read any specifications or reports, 
you'll find yourself very offended.



> this is just a patch that is not ready to be applied as reimar asked for 3
> dependant bugfixes.
> We can discuss where to put the header when theres actual code that can be
> commited. discussing it before we can see the whole patchset makes no real
> sense.
> I mean you complain that something would have been done thats not even
> possible ATM given the peoples requests in the review ...
>

I couldn't help but perceive the discussion you were having and your intentions 
to post another version as ignoring others' opinions.

___
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] [PATCHv2 5/6] avformat/mpegtsenc: fix PCR generation intervals

2019-08-14 Thread Marton Balint



On Mon, 12 Aug 2019, Andreas Håkon wrote:


Hi Marton,


‐‐‐ Original Message ‐‐‐
On Sunday, 11 de August de 2019 22:14, Marton Balint  wrote:


> > +/* For VBR we select the highest multiple of frame duration 
which is less than 100 ms. */
>
> Don't you think it's a good idea to use the parameter "pcr_period" as the 
limit,
> instead of a fixed value of 100ms?

Yes, but I think it is better make that feature a separate patch.


OK. Waiting for it.



> And I think you've forgotten the file "muxers.texi" in this v2 version of the 
patch.
> (the original patch 5 has it).

That is intentional. The existing behaviour is preserved, so no change is
required in the docs. When I make a separate patch to add support for
setting pcr_period for VBR (should be trivial to do on top of the existing
patchset), then I will update the docs.


OK. Then no problem.


I pushed this series, will post the patch which enables setting pcr period 
for VBR.


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

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

Re: [FFmpeg-devel] [PATCH 1/1] avformat/matroska: fully parse stsd atom in v_quicktime tracks

2019-08-14 Thread Michael Niedermayer
On Wed, Aug 14, 2019 at 08:44:11PM +0200, Stanislav Ionascu wrote:
> On Tue, Aug 13, 2019 at 10:22 PM Andreas Rheinhardt
>  wrote:
> >
> > Stanislav Ionascu:
> > > Per matroska spec, v_quicktime contains the complete stsd atom, after
> > > the mandatory size + fourcc. By properly parsing the hvcc sub-atoms of
> > > the track, it becomes possible to demux/decode mp4/mov tracks stored as is
> > > in matroska containers.
> > >
> > > Also dvh1 in stsd in matroska is more likely hevc codec than dv.
> > >
> > > Signed-off-by: Stanislav Ionascu 
> > > ---
> > >  libavformat/matroskadec.c | 51 +++
> > >  1 file changed, 36 insertions(+), 15 deletions(-)
> > >
> > > diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> > > index 4e20f15792..88bc89c545 100644
> > > --- a/libavformat/matroskadec.c
> > > +++ b/libavformat/matroskadec.c
> > > @@ -2473,25 +2473,46 @@ static int matroska_parse_tracks(AVFormatContext 
> > > *s)
> > >  } else if (!strcmp(track->codec_id, "V_QUICKTIME") &&
> > > (track->codec_priv.size >= 21)  &&
> > > (track->codec_priv.data)) {
> > > +MOVStreamContext *msc;
> > > +MOVContext *mc = NULL;
> > > +AVIOContext *stsd_ctx = NULL;
> > > +void *priv_data;
> > > +int nb_streams;
> > >  int ret = get_qt_codec(track, &fourcc, &codec_id);
> > >  if (ret < 0)
> > >  return ret;
> > > -if (codec_id == AV_CODEC_ID_NONE && 
> > > AV_RL32(track->codec_priv.data+4) == AV_RL32("SMI ")) {
> > > -fourcc = MKTAG('S','V','Q','3');
> > > -codec_id = ff_codec_get_id(ff_codec_movvideo_tags, 
> > > fourcc);
> > > +av_log(matroska->ctx, AV_LOG_TRACE,
> > > +   "FourCC found %s.\n", av_fourcc2str(fourcc));
> > > +priv_data = st->priv_data;
> > > +nb_streams = s->nb_streams;
> > > +mc = av_mallocz(sizeof(*mc));
> > > +if (!mc)
> > > +return AVERROR(ENOMEM);
> > > +stsd_ctx = avio_alloc_context(track->codec_priv.data,
> > > +track->codec_priv.size,
> > > +0, NULL, NULL, NULL, NULL);
> > > +if (!stsd_ctx)
> > > +return AVERROR(ENOMEM);
> > I haven't looked at this patch deeply yet, but it seems to me that you
> > should rather use ffio_init_context like it is done in the code that
> > you intend to delete. That saves allocating and freeing stsd_ctx. You
> > can even reuse the AVIOContext b that already exists on the stack.
> 
> Done.
> 
> > > +mc->fc = s;
> > > +st->priv_data = msc = av_mallocz(sizeof(MOVStreamContext));
> > > +if (!msc) {
> > > +av_free(mc);
> > > +st->priv_data = priv_data;
> > > +return AVERROR(ENOMEM);
> > >  }
> > > -if (codec_id == AV_CODEC_ID_NONE)
> > > -av_log(matroska->ctx, AV_LOG_ERROR,
> > > -   "mov FourCC not found %s.\n", 
> > > av_fourcc2str(fourcc));
> > > -if (track->codec_priv.size >= 86) {
> > > -bit_depth = AV_RB16(track->codec_priv.data + 82);
> > > -ffio_init_context(&b, track->codec_priv.data,
> > > -  track->codec_priv.size,
> > > -  0, NULL, NULL, NULL, NULL);
> > > -if (ff_get_qtpalette(codec_id, &b, track->palette)) {
> > > -bit_depth &= 0x1F;
> > > -track->has_palette = 1;
> > Why are you removing this code? What about tracks that ought to have a
> > palette?
> 
> The palette parsing is done in the stsd parser, but it still has to be
> copied back into the track,
> which is done in the later patch.
> 
> > > -}
> > > +/* ff_mov_read_stsd_entries updates stream s->nb_streams-1,
> > > + * so set it temporarily to indicate which stream to update. 
> > > */
> > > +s->nb_streams = st->index + 1;
> > > +ff_mov_read_stsd_entries(mc, stsd_ctx, 1);
> > > +av_free(msc);
> > > +av_free(mc);
> > > +avio_context_free(&stsd_ctx);
> > > +st->priv_data = priv_data;
> > > +s->nb_streams = nb_streams;
> > > +
> > > +// dvh1 in mkv is likely HEVC
> > > +if (st->codecpar->codec_tag == MKTAG('d','v','h','1')) {
> > > +codec_id = AV_CODEC_ID_HEVC;
> > >  }
> > >  } else if (codec_id == AV_CODEC_ID_PCM_S16BE) {
> > >  switch (track->audio.bitdepth) {
> > >
> >
> > Also, your patch should refer to the exact component that is about to
> > be changed: avformat/matroskadec.
> 
> Done.
> 
> >
> > - Andreas
> >
> > ___
> > ffmpeg

[FFmpeg-devel] [PATCH] avcodec/rawdec: Remove redundant code

2019-08-14 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 libavcodec/rawdec.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index 53f5b76e93..35d7653174 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -239,9 +239,6 @@ static int raw_decode(AVCodecContext *avctx, void *data, 
int *got_frame,
 if (res < 0)
 return res;
 
-frame->pkt_pos  = avctx->internal->last_pkt_props->pos;
-frame->pkt_duration = avctx->internal->last_pkt_props->duration;
-
 if (context->tff >= 0) {
 frame->interlaced_frame = 1;
 frame->top_field_first  = context->tff;
-- 
2.22.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] avutil/mips: remove redundant code in TRANSPOSE16x8_UB_UB.

2019-08-14 Thread Michael Niedermayer
On Tue, Aug 13, 2019 at 07:13:12PM +0800, Shiyou Yin wrote:
> ---
>  libavutil/mips/generic_macros_msa.h | 2 --
>  1 file changed, 2 deletions(-)

will apply

thx

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

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein


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 06/13] avformat/mux: Use av_packet_rescale_ts

2019-08-14 Thread Michael Niedermayer
On Wed, Aug 14, 2019 at 05:59:13PM +0200, Paul B Mahol wrote:
> LGTM

will apply

thx

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

If you fake or manipulate statistics in a paper in physics you will never
get a job again.
If you fake or manipulate statistics in a paper in medicin you will get
a job for life at the pharma industry.


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 03/13] avformat/mux: Use const AVPacket * in compare functions

2019-08-14 Thread Michael Niedermayer
On Wed, Aug 14, 2019 at 06:31:23PM +0200, Paul B Mahol wrote:
> LGTM

will apply

thx

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

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato


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

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

Re: [FFmpeg-devel] [PATCH 1/2] fftools: Use right function signature and pointers

2019-08-14 Thread Michael Niedermayer
On Wed, Aug 14, 2019 at 06:06:04PM +0200, Paul B Mahol wrote:
> LGTM

will apply

thx

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

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.


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

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

Re: [FFmpeg-devel] [PATCH 4/8] avcodec/ffwavesynth: Fixes invalid shift with pink noise seeking

2019-08-14 Thread Michael Niedermayer
On Mon, Aug 12, 2019 at 10:49:56PM +0200, Nicolas George wrote:
> Michael Niedermayer (12019-08-10):
> > Fixes: left shift of negative value -961533698048
> > Fixes: 
> > 16242/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5738550670131200
> > 
> > Found-by: continuous fuzzing process 
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/ffwavesynth.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> No objection for either of these patches.

will apply

thx

> 
> But I want to be on record that I think they were a waste of time, as
> these undefined behaviors have no chance of devolving into anything
> except possibly garbled output on strange architectures for an obscure
> format. Compilers are practical tools, not an axiomatic system.
> 
> Regards,
> 
> -- 
>   Nicolas George

[...]


-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Avoid a single point of failure, be that a person or equipment.


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 1/4] avformat/mpegtsenc: rename pcr_period variable to pcr_period_ms

2019-08-14 Thread Marton Balint
Signed-off-by: Marton Balint 
---
 libavformat/mpegtsenc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index d4dd4abb12..5cdd9d3313 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -97,7 +97,7 @@ typedef struct MpegTSWrite {
 int start_pid;
 int m2ts_mode;
 
-int pcr_period;
+int pcr_period_ms;
 #define MPEGTS_FLAG_REEMIT_PAT_PMT  0x01
 #define MPEGTS_FLAG_AAC_LATM0x02
 #define MPEGTS_FLAG_PAT_PMT_AT_FRAMES   0x04
@@ -791,7 +791,7 @@ static void 
enable_pcr_generation_for_stream(AVFormatContext *s, AVStream *pcr_s
 MpegTSWriteStream *ts_st = pcr_st->priv_data;
 
 if (ts->mux_rate > 1) {
-ts_st->pcr_period = av_rescale(ts->pcr_period, PCR_TIME_BASE, 1000);
+ts_st->pcr_period = av_rescale(ts->pcr_period_ms, PCR_TIME_BASE, 1000);
 } else {
 /* For VBR we select the highest multiple of frame duration which is 
less than 100 ms. */
 int64_t frame_period = 0;
@@ -1963,7 +1963,7 @@ static const AVOption options[] = {
   offsetof(MpegTSWrite, omit_video_pes_length), AV_OPT_TYPE_BOOL,
   { .i64 = 1 }, 0, 1, AV_OPT_FLAG_ENCODING_PARAM },
 { "pcr_period", "PCR retransmission time in milliseconds",
-  offsetof(MpegTSWrite, pcr_period), AV_OPT_TYPE_INT,
+  offsetof(MpegTSWrite, pcr_period_ms), AV_OPT_TYPE_INT,
   { .i64 = PCR_RETRANS_TIME }, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
 { "pat_period", "PAT/PMT retransmission time limit in seconds",
   offsetof(MpegTSWrite, pat_period), AV_OPT_TYPE_DOUBLE,
-- 
2.16.4

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

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

[FFmpeg-devel] [PATCH 2/4] avformat/mpegtsenc: add support for setting PCR interval for VBR streams

2019-08-14 Thread Marton Balint
Also document the algorithm for the default PCR interval.

Fixes ticket #8061.

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

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 019eee6145..c27bfee4f5 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -1619,8 +1619,10 @@ is @code{-1}, which results in shifting timestamps so 
that they start from 0.
 Omit the PES packet length for video packets. Default is @code{1} (true).
 
 @item pcr_period @var{integer}
-Override the default PCR retransmission time in milliseconds. Ignored if
-variable muxrate is selected. Default is @code{20}.
+Override the default PCR retransmission time in milliseconds. Default is
+@code{-1} which means that the PCR interval will be determined automatically:
+20 ms is used for CBR streams, the highest multiple of the frame duration which
+is less than 100 ms is used for VBR streams.
 
 @item pat_period @var{double}
 Maximum time in seconds between PAT/PMT tables.
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 5cdd9d3313..9dee5fa1d0 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -790,8 +790,9 @@ static void 
enable_pcr_generation_for_stream(AVFormatContext *s, AVStream *pcr_s
 MpegTSWrite *ts = s->priv_data;
 MpegTSWriteStream *ts_st = pcr_st->priv_data;
 
-if (ts->mux_rate > 1) {
-ts_st->pcr_period = av_rescale(ts->pcr_period_ms, PCR_TIME_BASE, 1000);
+if (ts->mux_rate > 1 || ts->pcr_period_ms >= 0) {
+int pcr_period_ms = ts->pcr_period_ms == -1 ? PCR_RETRANS_TIME : 
ts->pcr_period_ms;
+ts_st->pcr_period = av_rescale(pcr_period_ms, PCR_TIME_BASE, 1000);
 } else {
 /* For VBR we select the highest multiple of frame duration which is 
less than 100 ms. */
 int64_t frame_period = 0;
@@ -1964,7 +1965,7 @@ static const AVOption options[] = {
   { .i64 = 1 }, 0, 1, AV_OPT_FLAG_ENCODING_PARAM },
 { "pcr_period", "PCR retransmission time in milliseconds",
   offsetof(MpegTSWrite, pcr_period_ms), AV_OPT_TYPE_INT,
-  { .i64 = PCR_RETRANS_TIME }, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
+  { .i64 = -1 }, -1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
 { "pat_period", "PAT/PMT retransmission time limit in seconds",
   offsetof(MpegTSWrite, pat_period), AV_OPT_TYPE_DOUBLE,
   { .dbl = INT_MAX }, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
-- 
2.16.4

___
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/4] avformat/mpegtsenc: move some code around and simplify a bit

2019-08-14 Thread Marton Balint
PCR does not need to be recalcualted for CBR when inserting a NULL or PCR only
packet.

Signed-off-by: Marton Balint 
---
 libavformat/mpegtsenc.c | 20 +---
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 9dee5fa1d0..04da081ac0 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -1221,6 +1221,15 @@ static void mpegts_write_pes(AVFormatContext *s, 
AVStream *st,
 }
 ts->next_pcr = next_pcr;
 }
+if (dts != AV_NOPTS_VALUE && (dts - pcr / 300) > delay) {
+/* pcr insert gets priority over null packet insert */
+if (write_pcr)
+mpegts_insert_pcr_only(s, st);
+else
+mpegts_insert_null_packet(s);
+/* recalculate write_pcr and possibly retransmit si_info */
+continue;
+}
 } else if (ts_st->pcr_period && dts != AV_NOPTS_VALUE) {
 pcr = (dts - delay) * 300;
 if (pcr - ts_st->last_pcr >= ts_st->pcr_period && is_start) {
@@ -1229,17 +1238,6 @@ static void mpegts_write_pes(AVFormatContext *s, 
AVStream *st,
 }
 }
 
-if (ts->mux_rate > 1 && dts != AV_NOPTS_VALUE &&
-(dts - get_pcr(ts, s->pb) / 300) > delay) {
-/* pcr insert gets priority over null packet insert */
-if (write_pcr)
-mpegts_insert_pcr_only(s, st);
-else
-mpegts_insert_null_packet(s);
-/* recalculate write_pcr and possibly retransmit si_info */
-continue;
-}
-
 /* prepare packet header */
 q= buf;
 *q++ = 0x47;
-- 
2.16.4

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

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

[FFmpeg-devel] [PATCH 4/4] avformat/mpegtsenc: get rid of packet counting for sdt/pat/pmt

2019-08-14 Thread Marton Balint
The packet counting based approach caused excessive sdt/pat/pmt for VBR, so
let's use a timestamp based approach instead similar to how we emit PCRs.
SDT/PAT/PMT period should be consistent for both VBR and CBR from now on.

Also change the type of sdt_period and pat_period to AV_OPT_TYPE_DURATION so no
floating point math is necessary.

Fixes ticket #3714.

Signed-off-by: Marton Balint 
---
 doc/muxers.texi   |   8 +-
 libavformat/mpegtsenc.c   |  94 ---
 tests/ref/acodec/s302m|   4 +-
 tests/ref/fate/concat-demuxer-simple2-lavf-ts | 130 +-
 tests/ref/lavf/ts |   4 +-
 tests/ref/seek/lavf-ts|  26 +++---
 6 files changed, 124 insertions(+), 142 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index c27bfee4f5..20d31b279c 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -1624,11 +1624,11 @@ Override the default PCR retransmission time in 
milliseconds. Default is
 20 ms is used for CBR streams, the highest multiple of the frame duration which
 is less than 100 ms is used for VBR streams.
 
-@item pat_period @var{double}
-Maximum time in seconds between PAT/PMT tables.
+@item pat_period @var{duration}
+Maximum time in seconds between PAT/PMT tables. Default is @code{0.1}.
 
-@item sdt_period @var{double}
-Maximum time in seconds between SDT tables.
+@item sdt_period @var{duration}
+Maximum time in seconds between SDT tables. Default is @code{0.5}.
 
 @item tables_version @var{integer}
 Set PAT, PMT and SDT version (default @code{0}, valid values are from 0 to 31, 
inclusively).
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 04da081ac0..1ed1b1cd22 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -76,10 +76,8 @@ typedef struct MpegTSWrite {
 MpegTSSection pat; /* MPEG-2 PAT table */
 MpegTSSection sdt; /* MPEG-2 SDT table context */
 MpegTSService **services;
-int sdt_packet_count;
-int sdt_packet_period;
-int pat_packet_count;
-int pat_packet_period;
+int64_t sdt_period; /* SDT period in PCR time base */
+int64_t pat_period; /* PAT/PMT period in PCR time base */
 int nb_services;
 int onid;
 int tsid;
@@ -106,8 +104,8 @@ typedef struct MpegTSWrite {
 int flags;
 int copyts;
 int tables_version;
-double pat_period;
-double sdt_period;
+int64_t pat_period_us;
+int64_t sdt_period_us;
 int64_t last_pat_ts;
 int64_t last_sdt_ts;
 
@@ -978,17 +976,6 @@ static int mpegts_init(AVFormatContext *s)
 
 av_freep(&pids);
 
-if (ts->mux_rate > 1) {
-ts->sdt_packet_period  = (int64_t)ts->mux_rate * SDT_RETRANS_TIME /
- (TS_PACKET_SIZE * 8 * 1000);
-ts->pat_packet_period  = (int64_t)ts->mux_rate * PAT_RETRANS_TIME /
- (TS_PACKET_SIZE * 8 * 1000);
-} else {
-/* Arbitrary values, PAT/PMT will also be written on video key frames 
*/
-ts->sdt_packet_period = 200;
-ts->pat_packet_period = 40;
-}
-
 if (ts->copyts < 1)
 ts->first_pcr = av_rescale(s->max_delay, PCR_TIME_BASE, AV_TIME_BASE);
 
@@ -996,24 +983,17 @@ static int mpegts_init(AVFormatContext *s)
 
 ts->last_pat_ts = AV_NOPTS_VALUE;
 ts->last_sdt_ts = AV_NOPTS_VALUE;
-// The user specified a period, use only it
-if (ts->pat_period < INT_MAX/2) {
-ts->pat_packet_period = INT_MAX;
-}
-if (ts->sdt_period < INT_MAX/2) {
-ts->sdt_packet_period = INT_MAX;
-}
-
-ts->pat_packet_count  = ts->pat_packet_period - 1;
-ts->sdt_packet_count  = ts->sdt_packet_period - 1;
+ts->pat_period = av_rescale(ts->pat_period_us, PCR_TIME_BASE, 
AV_TIME_BASE);
+ts->sdt_period = av_rescale(ts->sdt_period_us, PCR_TIME_BASE, 
AV_TIME_BASE);
 
 if (ts->mux_rate == 1)
 av_log(s, AV_LOG_VERBOSE, "muxrate VBR, ");
 else
 av_log(s, AV_LOG_VERBOSE, "muxrate %d, ", ts->mux_rate);
 av_log(s, AV_LOG_VERBOSE,
-   "sdt every %d, pat/pmt every %d pkts\n",
-   ts->sdt_packet_period, ts->pat_packet_period);
+   "sdt every %"PRId64" ms, pat/pmt every %"PRId64" ms\n",
+   av_rescale(ts->sdt_period, 1000, PCR_TIME_BASE),
+   av_rescale(ts->pat_period, 1000, PCR_TIME_BASE));
 
 if (ts->m2ts_mode == -1) {
 if (av_match_ext(s->url, "m2ts")) {
@@ -1031,27 +1011,24 @@ fail:
 }
 
 /* send SDT, PAT and PMT tables regularly */
-static void retransmit_si_info(AVFormatContext *s, int force_pat, int64_t dts)
+static void retransmit_si_info(AVFormatContext *s, int force_pat, int 
force_sdt, int64_t pcr)
 {
 MpegTSWrite *ts = s->priv_data;
 int i;
 
-if (++ts->sdt_packet_count == ts->sdt_packet_period ||
-(dts != AV_NOPTS_VALUE && ts->last_sdt_ts == AV_NOPTS_VALUE) ||
-(dts != AV_NOPTS_VALUE && dts - ts->last_s

[FFmpeg-devel] [PATCH] avcodec/takdec: Fix integer overflow in decorrelate()

2019-08-14 Thread Michael Niedermayer
Fixes: signed integer overflow: -2424832 - 2145653689 cannot be represented in 
type 'int'
Fixes: 
16138/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TAK_fuzzer-5643451346976768

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/takdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/takdec.c b/libavcodec/takdec.c
index 0439a3ac9b..4fb5825532 100644
--- a/libavcodec/takdec.c
+++ b/libavcodec/takdec.c
@@ -653,7 +653,7 @@ static int decorrelate(TAKDecContext *s, int c1, int c2, 
int length)
  s->residues[i] * s->filter[0];
 }
 
-v = av_clip_intp2(v >> 10, 13) * (1 << dshift) - *p1;
+v = av_clip_intp2(v >> 10, 13) * (1U << dshift) - *p1;
 *p1++ = v;
 }
 
-- 
2.22.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] Change libaom default to crf=28.

2019-08-14 Thread James Zern
Hi,

On Tue, Aug 13, 2019 at 8:23 PM elliottk
 wrote:
>
> Current default is 256kbps, which produces inconsistent
> results (too high for low-res, too low for hi-res).
> Use CRF instead, which will adapt.
> ---
>  libavcodec/libaomenc.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
>

I think this is OK as it's similar to what is done for x264/5 [1].

> diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
> index 9b4fb3b4eb..a18d11c8aa 100644
> --- a/libavcodec/libaomenc.c
> +++ b/libavcodec/libaomenc.c
> @@ -575,10 +575,10 @@ static av_cold int aom_init(AVCodecContext *avctx,
>  if (enccfg.rc_end_usage == AOM_CQ) {
>  enccfg.rc_target_bitrate = 100;
>  } else {
> -avctx->bit_rate = enccfg.rc_target_bitrate * 1000;
> +enccfg.rc_end_usage = AOM_Q;
> +ctx->crf = 28;
>

Can we take a library default here or does it default to bitrate and
have cq_level cleared?

>  av_log(avctx, AV_LOG_WARNING,
> -   "Neither bitrate nor constrained quality specified, using 
> default bitrate of %dkbit/sec\n",
> -   enccfg.rc_target_bitrate);
> +   "Neither bitrate nor constrained quality specified, using 
> default CRF of 28\n");
>

You may want to use the variable to produce the output in case it changes.

[1] https://bugs.chromium.org/p/aomedia/issues/detail?id=2219#c9
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

[FFmpeg-devel] [PATCH v3 0/3] add v360 filter

2019-08-14 Thread Eugene Lyapustin
v3:
 - Fix switch/case alignment
 - Add more checks for filter options

Eugene Lyapustin (3):
  avfilter: add v360 filter
  avfilter/vf_v360: add padding option for cubemap
  avfilter/vf_v360: add dual fisheye format

 doc/filters.texi |  171 
 libavfilter/Makefile |1 +
 libavfilter/allfilters.c |1 +
 libavfilter/vf_v360.c| 1974 ++
 4 files changed, 2147 insertions(+)
 create mode 100644 libavfilter/vf_v360.c

-- 
2.22.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 v3 2/3] avfilter/vf_v360: add padding option for cubemap

2019-08-14 Thread Eugene Lyapustin
Signed-off-by: Eugene Lyapustin 
---
 doc/filters.texi  |  18 +++-
 libavfilter/vf_v360.c | 100 --
 2 files changed, 93 insertions(+), 25 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 6168a3502a..6c70ffceb1 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -17905,6 +17905,20 @@ Cubemap with 3x2/6x1 layout.
 Format specific options:
 
 @table @option
+@item in_pad
+@item out_pad
+Set padding proprtion for the input/output cubemap. Values in decimals.
+
+Example values:
+@table @samp
+@item 0
+No padding.
+@item 0.01
+1% of face is padding. For example, with 1920x1280 resolution face size would 
be 640x640 and padding would be 3 pixels from each side. (640 * 0.01 = 6 pixels)
+@end table
+
+Default value is @b{@samp{0}}.
+
 @item in_forder
 @item out_forder
 Set order of faces for the input/output cubemap. Choose one direction for each 
position.
@@ -18005,9 +18019,9 @@ Flip the output video horizontally/vertically/in-depth. 
Boolean values.
 
 @itemize
 @item
-Convert equirectangular video to cubemap with 3x2 layout using bicubic 
interpolation:
+Convert equirectangular video to cubemap with 3x2 layout and 1% padding using 
bicubic interpolation:
 @example
-ffmpeg -i input.mkv -vf v360=e:c3x2:cubic output.mkv
+ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
 @end example
 @item
 Extract back view of Equi-Angular Cubemap:
diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
index d23bcd32f8..22e1f726a7 100644
--- a/libavfilter/vf_v360.c
+++ b/libavfilter/vf_v360.c
@@ -102,6 +102,8 @@ typedef struct V360Context {
 int in_cubemap_face_rotation[6];
 int out_cubemap_face_rotation[6];
 
+float in_pad, out_pad;
+
 float yaw, pitch, roll;
 
 int h_flip, v_flip, d_flip;
@@ -155,6 +157,8 @@ static const AVOption v360_options[] = {
 {"out_forder", "output cubemap face order", OFFSET(out_forder), 
AV_OPT_TYPE_STRING, {.str="rludfb"},0, NB_DIRECTIONS-1, FLAGS, 
"out_forder"},
 {   "in_frot", "input cubemap face rotation",  OFFSET(in_frot), 
AV_OPT_TYPE_STRING, {.str="00"},0, NB_DIRECTIONS-1, FLAGS, 
"in_frot"},
 {  "out_frot", "output cubemap face rotation",OFFSET(out_frot), 
AV_OPT_TYPE_STRING, {.str="00"},0, NB_DIRECTIONS-1, FLAGS, 
"out_frot"},
+{"in_pad", "input cubemap pads",OFFSET(in_pad), 
AV_OPT_TYPE_FLOAT,  {.dbl=0.f},   0.f, 1.f, FLAGS, 
"in_pad"},
+{   "out_pad", "output cubemap pads",  OFFSET(out_pad), 
AV_OPT_TYPE_FLOAT,  {.dbl=0.f},   0.f, 1.f, FLAGS, 
"out_pad"},
 {   "yaw", "yaw rotation", OFFSET(yaw), 
AV_OPT_TYPE_FLOAT,  {.dbl=0.f},-180.f,   180.f, FLAGS, 
"yaw"},
 { "pitch", "pitch rotation", OFFSET(pitch), 
AV_OPT_TYPE_FLOAT,  {.dbl=0.f},-180.f,   180.f, FLAGS, 
"pitch"},
 {  "roll", "roll rotation",   OFFSET(roll), 
AV_OPT_TYPE_FLOAT,  {.dbl=0.f},-180.f,   180.f, FLAGS, 
"roll"},
@@ -734,6 +738,9 @@ static void cube_to_xyz(const V360Context *s,
 float norm;
 float l_x, l_y, l_z;
 
+uf /= (1.f - s->out_pad);
+vf /= (1.f - s->out_pad);
+
 rotate_cube_face_inverse(&uf, &vf, s->out_cubemap_face_rotation[face]);
 
 switch (direction) {
@@ -1091,6 +1098,9 @@ static void xyz_to_cube3x2(const V360Context *s,
 
 xyz_to_cube(s, vec, &uf, &vf, &direction);
 
+uf *= (1.f - s->in_pad);
+vf *= (1.f - s->in_pad);
+
 face = s->in_cubemap_face_order[direction];
 u_face = face % 3;
 v_face = face / 3;
@@ -1108,22 +1118,44 @@ static void xyz_to_cube3x2(const V360Context *s,
 
 for (i = -1; i < 3; i++) {
 for (j = -1; j < 3; j++) {
-float u, v;
+int new_ui = ui + j;
+int new_vi = vi + i;
 int u_shift, v_shift;
 int new_ewi, new_ehi;
 
-process_cube_coordinates(s, 2.f * (ui + j) / ewi - 1.f,
-2.f * (vi + i) / ehi - 1.f,
-direction, &u, &v, &face);
-u_face = face % 3;
-v_face = face / 3;
-u_shift = ceilf(ew * u_face);
-v_shift = ceilf(eh * v_face);
-new_ewi = ceilf(ew * (u_face + 1)) - u_shift;
-new_ehi = ceilf(eh * (v_face + 1)) - v_shift;
-
-us[i + 1][j + 1] = u_shift + av_clip(roundf(0.5f * new_ewi * (u + 
1.f)), 0, new_ewi - 1);
-vs[i + 1][j + 1] = v_shift + av_clip(roundf(0.5f * new_ehi * (v + 
1.f)), 0, new_ehi - 1);
+if (new_ui >= 0 && new_ui < ewi && new_vi >= 0 && new_vi < ehi) {
+face = s->in_cubemap_face_order[direction];
+
+u_face = face % 3;
+v_face = face / 3;
+u_shift = ceilf(ew * u_face);
+v_shift = ceilf(eh * v_face);
+

[FFmpeg-devel] [PATCH v3 3/3] avfilter/vf_v360: add dual fisheye format

2019-08-14 Thread Eugene Lyapustin
Signed-off-by: Eugene Lyapustin 
---
 doc/filters.texi  | 20 ++
 libavfilter/vf_v360.c | 63 +++
 2 files changed, 83 insertions(+)

diff --git a/doc/filters.texi b/doc/filters.texi
index 6c70ffceb1..feb3a123b6 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -17972,6 +17972,26 @@ Format specific options:
 @item v_fov
 Set horizontal/vertical field of view. Values in degrees.
 @end table
+
+@item dfisheye
+Dual fisheye. @i{(input only)}
+
+Format specific options:
+@table @option
+@item in_pad
+Set padding proprtion. Values in decimals.
+
+Example values:
+@table @samp
+@item 0
+No padding.
+@item 0.01
+1% padding.
+@end table
+
+Default value is @b{@samp{0}}.
+@end table
+
 @end table
 
 @item interp
diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
index 22e1f726a7..e8ce4e790d 100644
--- a/libavfilter/vf_v360.c
+++ b/libavfilter/vf_v360.c
@@ -48,6 +48,7 @@ enum Projections {
 CUBEMAP_6_1,
 EQUIANGULAR,
 FLAT,
+DUAL_FISHEYE,
 NB_PROJECTIONS,
 };
 
@@ -136,6 +137,7 @@ static const AVOption v360_options[] = {
 {  "c3x2", "cubemap3x2", 0, 
AV_OPT_TYPE_CONST,  {.i64=CUBEMAP_3_2}, 0,   0, FLAGS, "in" 
},
 {  "c6x1", "cubemap6x1", 0, 
AV_OPT_TYPE_CONST,  {.i64=CUBEMAP_6_1}, 0,   0, FLAGS, "in" 
},
 {   "eac", "equi-angular",   0, 
AV_OPT_TYPE_CONST,  {.i64=EQUIANGULAR}, 0,   0, FLAGS, "in" 
},
+{  "dfisheye", "dual fisheye",   0, 
AV_OPT_TYPE_CONST,  {.i64=DUAL_FISHEYE},0,   0, FLAGS, "in" 
},
 {"output", "set output projection",OFFSET(out), 
AV_OPT_TYPE_INT,{.i64=CUBEMAP_3_2}, 0,NB_PROJECTIONS-1, FLAGS, 
"out" },
 { "e", "equirectangular",0, 
AV_OPT_TYPE_CONST,  {.i64=EQUIRECTANGULAR}, 0,   0, FLAGS, 
"out" },
 {  "c3x2", "cubemap3x2", 0, 
AV_OPT_TYPE_CONST,  {.i64=CUBEMAP_3_2}, 0,   0, FLAGS, 
"out" },
@@ -1593,6 +1595,58 @@ static void flat_to_xyz(const V360Context *s,
 vec[2] = l_z / norm;
 }
 
+/**
+ * Calculate frame position in dual fisheye format for corresponding 3D 
coordinates on sphere.
+ *
+ * @param s filter context
+ * @param vec coordinates on sphere
+ * @param width frame width
+ * @param height frame height
+ * @param us horizontal coordinates for interpolation window
+ * @param vs vertical coordinates for interpolation window
+ * @param du horizontal relative coordinate
+ * @param dv vertical relative coordinate
+ */
+static void xyz_to_dfisheye(const V360Context *s,
+const float *vec, int width, int height,
+uint16_t us[4][4], uint16_t vs[4][4], float *du, 
float *dv)
+{
+const float scale = 1.f - s->in_pad;
+
+const float ew = width / 2.f;
+const float eh = height;
+
+const float phi   = atan2f(-vec[1], -vec[0]);
+const float theta = acosf(fabsf(vec[2])) / M_PI;
+
+float uf = (theta * cosf(phi) * scale + 0.5f) * ew;
+float vf = (theta * sinf(phi) * scale + 0.5f) * eh;
+
+int ui, vi;
+int u_shift;
+int i, j;
+
+if (vec[2] >= 0) {
+u_shift = 0;
+} else {
+u_shift = ceilf(ew);
+uf = ew - uf;
+}
+
+ui = floorf(uf);
+vi = floorf(vf);
+
+*du = uf - ui;
+*dv = vf - vi;
+
+for (i = -1; i < 3; i++) {
+for (j = -1; j < 3; j++) {
+us[i + 1][j + 1] = av_clip(u_shift + ui + j, 0, width  - 1);
+vs[i + 1][j + 1] = av_clip(  vi + i, 0, height - 1);
+}
+}
+}
+
 /**
  * Calculate rotation matrix for yaw/pitch/roll angles.
  */
@@ -1730,6 +1784,12 @@ static int config_output(AVFilterLink *outlink)
 case FLAT:
 av_log(ctx, AV_LOG_ERROR, "Flat format is not accepted as input.\n");
 return AVERROR(EINVAL);
+case DUAL_FISHEYE:
+in_transform = xyz_to_dfisheye;
+err = 0;
+wf = inlink->w;
+hf = inlink->h;
+break;
 default:
 av_log(ctx, AV_LOG_ERROR, "Specified input format is not handled.\n");
 return AVERROR_BUG;
@@ -1770,6 +1830,9 @@ static int config_output(AVFilterLink *outlink)
 w = roundf(wf * s->flat_range[0] / s->flat_range[1] / 2.f);
 h = roundf(hf);
 break;
+case DUAL_FISHEYE:
+av_log(ctx, AV_LOG_ERROR, "Dual fisheye format is not accepted as 
output.\n");
+return AVERROR(EINVAL);
 default:
 av_log(ctx, AV_LOG_ERROR, "Specified output format is not handled.\n");
 return AVERROR_BUG;
-- 
2.22.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-devel] [PATCH v3 1/3] avfilter: add v360 filter

2019-08-14 Thread Eugene Lyapustin
Signed-off-by: Eugene Lyapustin 
---
 doc/filters.texi |  137 +++
 libavfilter/Makefile |1 +
 libavfilter/allfilters.c |1 +
 libavfilter/vf_v360.c| 1857 ++
 4 files changed, 1996 insertions(+)
 create mode 100644 libavfilter/vf_v360.c

diff --git a/doc/filters.texi b/doc/filters.texi
index e081cdc7bc..6168a3502a 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -17879,6 +17879,143 @@ Force a constant quantization parameter. If not set, 
the filter will use the QP
 from the video stream (if available).
 @end table
 
+@section v360
+
+Convert 360 videos between various formats.
+
+The filter accepts the following options:
+
+@table @option
+
+@item input
+@item output
+Set format of the input/output video.
+
+Available formats:
+
+@table @samp
+
+@item e
+Equirectangular projection.
+
+@item c3x2
+@item c6x1
+Cubemap with 3x2/6x1 layout.
+
+Format specific options:
+
+@table @option
+@item in_forder
+@item out_forder
+Set order of faces for the input/output cubemap. Choose one direction for each 
position.
+
+Designation of directions:
+@table @samp
+@item r
+right
+@item l
+left
+@item u
+up
+@item d
+down
+@item f
+forward
+@item b
+back
+@end table
+
+Default value is @b{@samp{rludfb}}.
+
+@item in_frot
+@item out_frot
+Set rotation of faces for the input/output cubemap. Choose one angle for each 
position.
+
+Designation of angles:
+@table @samp
+@item 0
+0 degrees clockwise
+@item 1
+90 degrees clockwise
+@item 2
+180 degrees clockwise
+@item 4
+270 degrees clockwise
+@end table
+
+Default value is @b{@samp{00}}.
+@end table
+
+@item eac
+Equi-Angular Cubemap.
+
+@item flat
+Regular video. @i{(output only)}
+
+Format specific options:
+@table @option
+@item h_fov
+@item v_fov
+Set horizontal/vertical field of view. Values in degrees.
+@end table
+@end table
+
+@item interp
+Set interpolation method.@*
+@i{Note: more complex interpolation methods require much more memory to run.}
+
+Available methods:
+
+@table @samp
+@item near
+@item nearest
+Nearest neighbour.
+@item line
+@item linear
+Bilinear interpolation.
+@item cube
+@item cubic
+Bicubic interpolation.
+@item lanc
+@item lanczos
+Lanczos interpolation.
+@end table
+
+Default value is @b{@samp{line}}.
+
+@item w
+@item h
+Set the output video resolution.
+
+Default resolution depends on formats.
+
+@item yaw
+@item pitch
+@item roll
+Set rotation for the output video. Values in degrees.
+
+@item hflip
+@item vflip
+@item dflip
+Flip the output video horizontally/vertically/in-depth. Boolean values.
+
+@end table
+
+@subsection Examples
+
+@itemize
+@item
+Convert equirectangular video to cubemap with 3x2 layout using bicubic 
interpolation:
+@example
+ffmpeg -i input.mkv -vf v360=e:c3x2:cubic output.mkv
+@end example
+@item
+Extract back view of Equi-Angular Cubemap:
+@example
+ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
+@end example
+@end itemize
+
 @section vaguedenoiser
 
 Apply a wavelet based denoiser.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index efc7bbb153..345f7c95cd 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -410,6 +410,7 @@ OBJS-$(CONFIG_UNSHARP_FILTER)+= vf_unsharp.o
 OBJS-$(CONFIG_UNSHARP_OPENCL_FILTER) += vf_unsharp_opencl.o opencl.o \
 opencl/unsharp.o
 OBJS-$(CONFIG_USPP_FILTER)   += vf_uspp.o
+OBJS-$(CONFIG_V360_FILTER)   += vf_v360.o
 OBJS-$(CONFIG_VAGUEDENOISER_FILTER)  += vf_vaguedenoiser.o
 OBJS-$(CONFIG_VECTORSCOPE_FILTER)+= vf_vectorscope.o
 OBJS-$(CONFIG_VFLIP_FILTER)  += vf_vflip.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index abd726d616..5799fb4b3c 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -390,6 +390,7 @@ extern AVFilter ff_vf_unpremultiply;
 extern AVFilter ff_vf_unsharp;
 extern AVFilter ff_vf_unsharp_opencl;
 extern AVFilter ff_vf_uspp;
+extern AVFilter ff_vf_v360;
 extern AVFilter ff_vf_vaguedenoiser;
 extern AVFilter ff_vf_vectorscope;
 extern AVFilter ff_vf_vflip;
diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
new file mode 100644
index 00..d23bcd32f8
--- /dev/null
+++ b/libavfilter/vf_v360.c
@@ -0,0 +1,1857 @@
+/*
+ * Copyright (c) 2019 Eugene Lyapustin
+ *
+ * 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 al

Re: [FFmpeg-devel] [PATCH] avcodec/libdav1d: allow setting frame size limit in pixels

2019-08-14 Thread James Almer
On 8/6/2019 9:06 PM, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  configure | 2 +-
>  libavcodec/libdav1d.c | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index 34c2adb4a4..eceb21b315 100755
> --- a/configure
> +++ b/configure
> @@ -6196,7 +6196,7 @@ enabled libcelt   && require libcelt 
> celt/celt.h celt_decode -lcelt0 &&
> die "ERROR: libcelt must be installed and 
> version must be >= 0.11.0."; }
>  enabled libcaca   && require_pkg_config libcaca caca caca.h 
> caca_create_canvas
>  enabled libcodec2 && require libcodec2 codec2/codec2.h codec2_create 
> -lcodec2
> -enabled libdav1d  && require_pkg_config libdav1d "dav1d >= 0.2.1" 
> "dav1d/dav1d.h" dav1d_version
> +enabled libdav1d  && require_pkg_config libdav1d "dav1d >= 0.4.0" 
> "dav1d/dav1d.h" dav1d_version
>  enabled libdavs2  && require_pkg_config libdavs2 "davs2 >= 1.6.0" 
> davs2.h davs2_decoder_open
>  enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 
> dc1394/dc1394.h dc1394_new
>  enabled libdrm&& require_pkg_config libdrm libdrm xf86drm.h 
> drmGetVersion
> diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
> index 12c63245f8..8335751b7b 100644
> --- a/libavcodec/libdav1d.c
> +++ b/libavcodec/libdav1d.c
> @@ -130,6 +130,7 @@ static av_cold int libdav1d_init(AVCodecContext *c)
>  s.allocator.cookie = dav1d;
>  s.allocator.alloc_picture_callback = libdav1d_picture_allocator;
>  s.allocator.release_picture_callback = libdav1d_picture_release;
> +s.frame_size_limit = c->max_pixels;
>  s.apply_grain = dav1d->apply_grain;
>  
>  s.n_tile_threads = dav1d->tile_threads

Applied.
___
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] fftoos/ffmpeg_opt: avoid to display the hwaccels name twice

2019-08-14 Thread Limin Wang
On Wed, Aug 14, 2019 at 01:46:29PM +0200, Carl Eugen Hoyos wrote:
> Am Di., 13. Aug. 2019 um 15:39 Uhr schrieb :
> >
> > From: Limin Wang 
> >
> > videotoolbox and qsv have been defined by hw_type_names[] in hwcontext.c
> 
> Please mention ticket #7464 in the commit message if this patch
> is supposed to fix it.
The patch should fix ticket #7464 although I got the issue myself in my iMac,
I'll update the commit message to mention it.

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

[FFmpeg-devel] [PATCH v1] fftools/ffmpeg_opt: avoid to display the hwaccels name twice

2019-08-14 Thread lance . lmwang
From: Limin Wang 

videotoolbox and qsv have been defined by hw_type_names[] in hwcontext.c

Fixes ticket #7464

Signed-off-by: Limin Wang 
---
 fftools/ffmpeg_opt.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index f5ca18a..8baa898 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -66,12 +66,6 @@
 }
 
 const HWAccel hwaccels[] = {
-#if CONFIG_VIDEOTOOLBOX
-{ "videotoolbox", videotoolbox_init, HWACCEL_VIDEOTOOLBOX, 
AV_PIX_FMT_VIDEOTOOLBOX },
-#endif
-#if CONFIG_LIBMFX
-{ "qsv",   qsv_init,   HWACCEL_QSV,   AV_PIX_FMT_QSV },
-#endif
 #if CONFIG_CUVID
 { "cuvid", cuvid_init, HWACCEL_CUVID, AV_PIX_FMT_CUDA },
 #endif
-- 
2.6.4

___
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] libavdevice: Update the class name as uniform style

2019-08-14 Thread myp...@gmail.com
On Wed, Aug 14, 2019 at 11:57 PM Paul B Mahol  wrote:
>
> LGTM
>
will apply, 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 6/8] avcodec/decode: Do not overwrite AVFrame.pkt_pos if its already set

2019-08-14 Thread James Almer
On 8/14/2019 2:39 PM, Michael Niedermayer wrote:
> On Mon, Aug 12, 2019 at 09:03:22PM -0300, James Almer wrote:
>> On 8/12/2019 5:31 PM, Michael Niedermayer wrote:
>>> On Mon, Aug 12, 2019 at 09:21:59PM +0200, Vittorio Giovara wrote:
 On Mon, Aug 12, 2019 at 9:19 PM Michael Niedermayer 
 
 wrote:

> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/decode.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> index 6c31166ec2..09a509d659 100644
> --- a/libavcodec/decode.c
> +++ b/libavcodec/decode.c
> @@ -435,7 +435,7 @@ static int decode_simple_internal(AVCodecContext
> *avctx, AVFrame *frame)
>  if (!(avctx->codec->caps_internal & FF_CODEC_CAP_SETS_PKT_DTS))
>  frame->pkt_dts = pkt->dts;
>  if (avctx->codec->type == AVMEDIA_TYPE_VIDEO) {
> -if(!avctx->has_b_frames)
> +if(!avctx->has_b_frames && frame->pkt_pos < 0)
>  frame->pkt_pos = pkt->pos;
>  //FIXME these should be under if(!avctx->has_b_frames)
>  /* get_buffer is supposed to set frame parameters */
> --
>

 sure but why?
>>>
>>> the next 2 patches need this
>>> [FFmpeg-devel] [PATCH 7/8] avcodec/qtrle: return last frame even if 
>>> unchanged
>>> [FFmpeg-devel] [PATCH 8/8] avcodec/nuv: Avoid duplicating frames
>>>
>>> without it the common code overwrites the pkt_pos set by the decoder
>>
>> What about rawdec.c? It's also setting frame->pkt_pos.
> 
> That looks redundant (will send patch after testing)
> 
> 
>>
>> And cant' this be handled with a new internal codec cap like the pkt_dts
>> one used above?
> 
> yes, if thats preferred ?

I think it would be better, but not sure if others agree.

A well defined way for decoders/encoders to inform the generic code what
to expect is imo nicer than it assuming that a given value in a frame
means that it was not touched, even if said value is the default.
Perhaps it could be simplified into a single codec cap to sell all pkt_*
fields and other props (like size and duration), rather than one cap per
field. And since it's all internal, it can be removed as easily and
quickly as it was added.

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

___
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] lavu/hwcontext_vaapi: provide detailed warning if directly mapping fails

2019-08-14 Thread Fu, Linjie
> -Original Message-
> From: Li, Zhong
> Sent: Wednesday, August 14, 2019 22:37
> To: FFmpeg development discussions and patches  de...@ffmpeg.org>
> Cc: Fu, Linjie 
> Subject: RE: [FFmpeg-devel] [PATCH] lavu/hwcontext_vaapi: provide
> detailed warning if directly mapping fails
> 
> > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On
> Behalf
> > Of Linjie Fu
> > Sent: Wednesday, August 14, 2019 5:25 PM
> > To: ffmpeg-devel@ffmpeg.org
> > Cc: Fu, Linjie 
> > Subject: [FFmpeg-devel] [PATCH] lavu/hwcontext_vaapi: provide detailed
> > warning if directly mapping fails
> >
> > Detailed message could be helpful when using
> > hwmap=mode=direct,format=xxx for both qsv and vaapi.
> >
> > Signed-off-by: Linjie Fu 
> > ---
> >  libavutil/hwcontext_vaapi.c | 9 ++---
> >  1 file changed, 6 insertions(+), 3 deletions(-)
> >
> 
> Why just give a warning message when you need to return an error?

Previously these messages are hidden in the code, thus a warning info  could be
a more gentle improvement IMHO. (since there will be other error logs prompted
when av_hwframe_map() fails)

It sounds  an error message is necessary. 

___
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]lavf/rawenc: Only accept the appropriate stream type for raw muxers

2019-08-14 Thread myp...@gmail.com
On Sun, Aug 11, 2019 at 8:26 AM Carl Eugen Hoyos  wrote:
>
> Am Mo., 1. Juli 2019 um 00:47 Uhr schrieb Carl Eugen Hoyos 
> :
> >
> > Am Mo., 1. Juli 2019 um 00:40 Uhr schrieb Carl Eugen Hoyos 
> > :
> > >
> > > Hi!
> > >
> > > Attached patch fixes ticket #7979 for me.
> >
> > Now attached.
>
> Ping.
>
> Carl Eugen
LGTM, tested and verified
___
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] lavu/hwcontext_vaapi: provide detailed error msg if directly mapping fails

2019-08-14 Thread Linjie Fu
Detailed message could be helpful when using hwmap=mode=direct,format=xxx
for both qsv and vaapi.

Signed-off-by: Linjie Fu 
---
 libavutil/hwcontext_vaapi.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index cf117640f2..3fbeb4954e 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -747,19 +747,22 @@ static int vaapi_map_frame(AVHWFramesContext *hwfc,
 av_log(hwfc, AV_LOG_DEBUG, "Map surface %#x.\n", surface_id);
 
 if (!ctx->derive_works && (flags & AV_HWFRAME_MAP_DIRECT)) {
-// Requested direct mapping but it is not possible.
+av_log(hwfc, AV_LOG_ERROR, "Requested direct mapping but "
+"it is not possible.\n");
 return AVERROR(EINVAL);
 }
 if (dst->format == AV_PIX_FMT_NONE)
 dst->format = hwfc->sw_format;
 if (dst->format != hwfc->sw_format && (flags & AV_HWFRAME_MAP_DIRECT)) {
-// Requested direct mapping but the formats do not match.
+av_log(hwfc, AV_LOG_ERROR, "Requested direct mapping but "
+"the formats do not match.\n");
 return AVERROR(EINVAL);
 }
 
 err = vaapi_get_image_format(hwfc->device_ctx, dst->format, &image_format);
 if (err < 0) {
-// Requested format is not a valid output format.
+av_log(hwfc, AV_LOG_ERROR, "Requested format is "
+"not a valid output format.\n");
 return AVERROR(EINVAL);
 }
 
-- 
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 1/2] lavu/hwcontext_vaapi: cope with race map for YUV420P

2019-08-14 Thread Linjie Fu
There is a race condition for AV_PIX_FMT_YUV420P when mapping from pix_fmt
to fourcc, both VA_FOURCC_I420 and VA_FOURCC_YV12 could be found by pix_fmt.

Currently, vaapi_get_image_format will go through the query results of
pix_fmt and returned the first matched result according to the declared
order in driver.This may leads to a wrong image_format.

Modify to find image_format via fourcc.

Fix vaapi CSC to I420:
ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -f rawvideo
-pix_fmt nv12 -s:v 1280x720 -i NV12.yuv -vf
'format=nv12,hwupload,scale_vaapi=format=yuv420p,hwdownload,format=yuv420p'
-f rawvideo -vsync passthrough -vframes 10 -y aa.yuv

Reviewed-by: Zhong Li 
Signed-off-by: Linjie Fu 
---
 libavutil/hwcontext_vaapi.c | 14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index cf11764..64f14de 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -63,6 +63,7 @@ typedef struct VAAPIDevicePriv {
 typedef struct VAAPISurfaceFormat {
 enum AVPixelFormat pix_fmt;
 VAImageFormat image_format;
+unsigned int fourcc;
 } VAAPISurfaceFormat;
 
 typedef struct VAAPIDeviceContext {
@@ -171,15 +172,21 @@ static int vaapi_get_image_format(AVHWDeviceContext 
*hwdev,
   VAImageFormat **image_format)
 {
 VAAPIDeviceContext *ctx = hwdev->internal->priv;
+VAAPIFormatDescriptor *desc;
 int i;
 
+desc = vaapi_format_from_pix_fmt(pix_fmt);
+if (!desc || !image_format)
+goto fail;
+
 for (i = 0; i < ctx->nb_formats; i++) {
-if (ctx->formats[i].pix_fmt == pix_fmt) {
-if (image_format)
-*image_format = &ctx->formats[i].image_format;
+if (ctx->formats[i].fourcc == desc->fourcc) {
+*image_format = &ctx->formats[i].image_format;
 return 0;
 }
 }
+
+fail:
 return AVERROR(EINVAL);
 }
 
@@ -368,6 +375,7 @@ static int vaapi_device_init(AVHWDeviceContext *hwdev)
 av_log(hwdev, AV_LOG_DEBUG, "Format %#x -> %s.\n",
fourcc, av_get_pix_fmt_name(pix_fmt));
 ctx->formats[ctx->nb_formats].pix_fmt  = pix_fmt;
+ctx->formats[ctx->nb_formats].fourcc   = fourcc;
 ctx->formats[ctx->nb_formats].image_format = image_list[i];
 ++ctx->nb_formats;
 }
-- 
2.7.4

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

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

[FFmpeg-devel] [PATCH 2/2] lavu/hwcontext_vaapi: remove redundant check in vaapi_map_to_memory

2019-08-14 Thread Linjie Fu
vaapi_get_image_format() will be called in vaapi_map_frame(), so it's
redundant here. Also, NULL for VAImageFormat **image_format could be
a bit improper since the function is supposed to be used to get the
image format.

Remove vaapi_get_image_format() in vaapi_map_to_memory().

Signed-off-by: Linjie Fu 
---
 libavutil/hwcontext_vaapi.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index 64f14de..3b0f671 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -940,12 +940,6 @@ static int vaapi_map_to_memory(AVHWFramesContext *hwfc, 
AVFrame *dst,
 {
 int err;
 
-if (dst->format != AV_PIX_FMT_NONE) {
-err = vaapi_get_image_format(hwfc->device_ctx, dst->format, NULL);
-if (err < 0)
-return AVERROR(ENOSYS);
-}
-
 err = vaapi_map_frame(hwfc, dst, src, flags);
 if (err)
 return err;
-- 
2.7.4

___
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] lavf/mov: Fix timestamp rescale on sidx atom

2019-08-14 Thread Jun Li
On Thu, Jun 20, 2019 at 2:02 AM Jun Li  wrote:

>
>
> On Tue, May 21, 2019 at 1:05 AM Jun Li  wrote:
>
>>
>>
>> On Thu, May 16, 2019 at 1:00 AM Jun Li  wrote:
>>
>>>
>>>
>>> On Sun, May 12, 2019 at 7:44 PM Jun Li  wrote:
>>>


 On Fri, May 10, 2019 at 7:25 PM Jun Li  wrote:

>
> On Thu, May 9, 2019 at 2:08 AM Jun Li  wrote:
>
>> Fix #5090
>> Fix the timestamp rescale issue, from sidx timebase to
>> stream's timebase.
>> ---
>>  libavformat/mov.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavformat/mov.c b/libavformat/mov.c
>> index 78f692872b..d058855e6c 100644
>> --- a/libavformat/mov.c
>> +++ b/libavformat/mov.c
>> @@ -5017,7 +5017,7 @@ static int mov_read_sidx(MOVContext *c,
>> AVIOContext *pb, MOVAtom atom)
>>  return AVERROR_PATCHWELCOME;
>>  }
>>  avio_rb32(pb); // sap_flags
>> -timestamp = av_rescale_q(pts, st->time_base, timescale);
>> +timestamp = av_rescale_q(pts, timescale, st->time_base);
>>
>>  index = update_frag_index(c, offset);
>>  frag_stream_info = get_frag_stream_info(&c->frag_index,
>> index, track_id);
>> --
>> 2.17.1
>>
>
> Ping
>

 This change is for fix the issue of calculating sidx_pts.
 Sidx box has "earliest_presentation_time", used as pts of  the referent
 track, sidx also has timescale field.
 So the operation should convert from sidx's timescale to track's
 timescale, this patch is for addressing this, as well as fixing #5090.

 Of course this is based on my understanding, so please correct me if I
 am wrong. Thanks !


>>> Ping.
>>> I believe this is a bug and triggered whenever sidx box's timescale is
>>> different from track's timescale.
>>> Created this kind of content and verified that ffplay couldn't play
>>> while VLC plays well.
>>> Then I checked VLC's implementation:
>>>
>>> https://github.com/videolan/vlc/blob/5609c1b41d6fbca6323103619c6139caf7bc9e6e/modules/demux/mp4/mp4.c#L4735
>>>
>>> Hope someone could help to have a review ? Thanks ! :)
>>>
>>> Best Regards,
>>> -Jun
>>>
>>>
 Best Regards,
 Jun

>>>
>> Ping x 3
>>
>
> Ping x 4.
> I believe this is an obvious bug and happened whenever sidx box's
> timescale is different from track's timescale.
> I created this kind of content and verified that ffplay couldn't play
> while VLC plays well.
> This is  VLC's implementation:
>
> https://github.com/videolan/vlc/blob/5609c1b41d6fbca6323103619c6139caf7bc9e6e/modules/demux/mp4/mp4.c#L4735
>

Ping x 5
___
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] avformat/matroskadec: properly parse stsd in v_quicktime

2019-08-14 Thread Stanislav Ionascu
Per matroska spec, v_quicktime contains the complete stsd atom, after
the mandatory size + fourcc. By properly parsing the hvcc sub-atoms of
the track, it becomes possible to demux/decode mp4/mov tracks stored as is
in matroska containers.

Also dvh1 in stsd in matroska is more likely hevc codec than dv.
QuickTime palette parsing is reused from the stsd parser results.

Signed-off-by: Stanislav Ionascu 
---
 libavformat/matroskadec.c | 62 +++
 1 file changed, 44 insertions(+), 18 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 4e20f15792..9ca9efe6b1 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -2473,25 +2473,51 @@ static int matroska_parse_tracks(AVFormatContext *s)
 } else if (!strcmp(track->codec_id, "V_QUICKTIME") &&
(track->codec_priv.size >= 21)  &&
(track->codec_priv.data)) {
-int ret = get_qt_codec(track, &fourcc, &codec_id);
-if (ret < 0)
-return ret;
-if (codec_id == AV_CODEC_ID_NONE && 
AV_RL32(track->codec_priv.data+4) == AV_RL32("SMI ")) {
-fourcc = MKTAG('S','V','Q','3');
-codec_id = ff_codec_get_id(ff_codec_movvideo_tags, fourcc);
+MOVStreamContext *msc;
+MOVContext *mc = NULL;
+void *priv_data;
+int nb_streams;
+priv_data = st->priv_data;
+nb_streams = s->nb_streams;
+mc = av_mallocz(sizeof(*mc));
+if (!mc)
+return AVERROR(ENOMEM);
+mc->fc = s;
+st->priv_data = msc = av_mallocz(sizeof(MOVStreamContext));
+if (!msc) {
+av_free(mc);
+st->priv_data = priv_data;
+return AVERROR(ENOMEM);
 }
-if (codec_id == AV_CODEC_ID_NONE)
-av_log(matroska->ctx, AV_LOG_ERROR,
-   "mov FourCC not found %s.\n", av_fourcc2str(fourcc));
-if (track->codec_priv.size >= 86) {
-bit_depth = AV_RB16(track->codec_priv.data + 82);
-ffio_init_context(&b, track->codec_priv.data,
-  track->codec_priv.size,
-  0, NULL, NULL, NULL, NULL);
-if (ff_get_qtpalette(codec_id, &b, track->palette)) {
-bit_depth &= 0x1F;
-track->has_palette = 1;
-}
+ffio_init_context(&b, track->codec_priv.data,
+  track->codec_priv.size,
+  0, NULL, NULL, NULL, NULL);
+
+/* ff_mov_read_stsd_entries updates stream s->nb_streams-1,
+ * so set it temporarily to indicate which stream to update. */
+s->nb_streams = st->index + 1;
+ff_mov_read_stsd_entries(mc, &b, 1);
+
+/* copy palette from MOVStreamContext */
+track->has_palette = msc->has_palette;
+if (track->has_palette) {
+/* leave bit_depth = -1, to reuse bits_per_coded_sample  */
+memcpy(track->palette, msc->palette, AVPALETTE_COUNT);
+}
+
+av_free(msc);
+av_free(mc);
+st->priv_data = priv_data;
+s->nb_streams = nb_streams;
+fourcc = st->codecpar->codec_tag;
+codec_id = st->codecpar->codec_id;
+
+av_log(matroska->ctx, AV_LOG_TRACE,
+   "mov FourCC found %s.\n", av_fourcc2str(fourcc));
+
+// dvh1 in mkv is likely HEVC
+if (st->codecpar->codec_tag == MKTAG('d','v','h','1')) {
+codec_id = AV_CODEC_ID_HEVC;
 }
 } else if (codec_id == AV_CODEC_ID_PCM_S16BE) {
 switch (track->audio.bitdepth) {
-- 
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 1/1] avformat/matroska: fully parse stsd atom in v_quicktime tracks

2019-08-14 Thread Stanislav Ionascu
Hi,

On Wed, Aug 14, 2019 at 11:50 PM Michael Niedermayer
 wrote:
>
> On Wed, Aug 14, 2019 at 08:44:11PM +0200, Stanislav Ionascu wrote:
> > On Tue, Aug 13, 2019 at 10:22 PM Andreas Rheinhardt
> >  wrote:
> > >
> > > Stanislav Ionascu:
> > > > Per matroska spec, v_quicktime contains the complete stsd atom, after
> > > > the mandatory size + fourcc. By properly parsing the hvcc sub-atoms of
> > > > the track, it becomes possible to demux/decode mp4/mov tracks stored as 
> > > > is
> > > > in matroska containers.
> > > >
> > > > Also dvh1 in stsd in matroska is more likely hevc codec than dv.
> > > >
> > > > Signed-off-by: Stanislav Ionascu 
> > > > ---
> > > >  libavformat/matroskadec.c | 51 +++
> > > >  1 file changed, 36 insertions(+), 15 deletions(-)
> > > >
> > > > diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> > > > index 4e20f15792..88bc89c545 100644
> > > > --- a/libavformat/matroskadec.c
> > > > +++ b/libavformat/matroskadec.c
> > > > @@ -2473,25 +2473,46 @@ static int 
> > > > matroska_parse_tracks(AVFormatContext *s)
> > > >  } else if (!strcmp(track->codec_id, "V_QUICKTIME") &&
> > > > (track->codec_priv.size >= 21)  &&
> > > > (track->codec_priv.data)) {
> > > > +MOVStreamContext *msc;
> > > > +MOVContext *mc = NULL;
> > > > +AVIOContext *stsd_ctx = NULL;
> > > > +void *priv_data;
> > > > +int nb_streams;
> > > >  int ret = get_qt_codec(track, &fourcc, &codec_id);
> > > >  if (ret < 0)
> > > >  return ret;
> > > > -if (codec_id == AV_CODEC_ID_NONE && 
> > > > AV_RL32(track->codec_priv.data+4) == AV_RL32("SMI ")) {
> > > > -fourcc = MKTAG('S','V','Q','3');
> > > > -codec_id = ff_codec_get_id(ff_codec_movvideo_tags, 
> > > > fourcc);
> > > > +av_log(matroska->ctx, AV_LOG_TRACE,
> > > > +   "FourCC found %s.\n", av_fourcc2str(fourcc));
> > > > +priv_data = st->priv_data;
> > > > +nb_streams = s->nb_streams;
> > > > +mc = av_mallocz(sizeof(*mc));
> > > > +if (!mc)
> > > > +return AVERROR(ENOMEM);
> > > > +stsd_ctx = avio_alloc_context(track->codec_priv.data,
> > > > +track->codec_priv.size,
> > > > +0, NULL, NULL, NULL, NULL);
> > > > +if (!stsd_ctx)
> > > > +return AVERROR(ENOMEM);
> > > I haven't looked at this patch deeply yet, but it seems to me that you
> > > should rather use ffio_init_context like it is done in the code that
> > > you intend to delete. That saves allocating and freeing stsd_ctx. You
> > > can even reuse the AVIOContext b that already exists on the stack.
> >
> > Done.
> >
> > > > +mc->fc = s;
> > > > +st->priv_data = msc = av_mallocz(sizeof(MOVStreamContext));
> > > > +if (!msc) {
> > > > +av_free(mc);
> > > > +st->priv_data = priv_data;
> > > > +return AVERROR(ENOMEM);
> > > >  }
> > > > -if (codec_id == AV_CODEC_ID_NONE)
> > > > -av_log(matroska->ctx, AV_LOG_ERROR,
> > > > -   "mov FourCC not found %s.\n", 
> > > > av_fourcc2str(fourcc));
> > > > -if (track->codec_priv.size >= 86) {
> > > > -bit_depth = AV_RB16(track->codec_priv.data + 82);
> > > > -ffio_init_context(&b, track->codec_priv.data,
> > > > -  track->codec_priv.size,
> > > > -  0, NULL, NULL, NULL, NULL);
> > > > -if (ff_get_qtpalette(codec_id, &b, track->palette)) {
> > > > -bit_depth &= 0x1F;
> > > > -track->has_palette = 1;
> > > Why are you removing this code? What about tracks that ought to have a
> > > palette?
> >
> > The palette parsing is done in the stsd parser, but it still has to be
> > copied back into the track,
> > which is done in the later patch.
> >
> > > > -}
> > > > +/* ff_mov_read_stsd_entries updates stream s->nb_streams-1,
> > > > + * so set it temporarily to indicate which stream to 
> > > > update. */
> > > > +s->nb_streams = st->index + 1;
> > > > +ff_mov_read_stsd_entries(mc, stsd_ctx, 1);
> > > > +av_free(msc);
> > > > +av_free(mc);
> > > > +avio_context_free(&stsd_ctx);
> > > > +st->priv_data = priv_data;
> > > > +s->nb_streams = nb_streams;
> > > > +
> > > > +// dvh1 in mkv is likely HEVC
> > > > +if (st->codecpar->codec_tag == MKTAG('d','v','h','1')) {
> > > > +codec_id = AV_CODEC_ID_HEVC;
> > > >  }
> > > >  } else if (codec_id == AV_CODEC_ID_PCM_S16BE)