Re: [FFmpeg-devel] [PATCH 3/3] avcodec/rasc: unref both frames on reinit
On 10/2/18, Michael Niedermayer wrote: > Fixes: integer overflow > Fixes: inconsistent frame dimensions > Fixes: > 10454/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RASC_fuzzer-5656301162463232 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- LGTM ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/3] avcodec/rasc: Fix off by 1 error in vertical coordinate
On 10/2/18, Michael Niedermayer wrote: > Fixes: out of array read > Fixes: > 10311/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RASC_fuzzer-4856330905452544 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- LGTM ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/3] avcodec/tiff: check remaining packet size for strips
On 10/2/18, Michael Niedermayer wrote: > Fixes: Timeout > Fixes: > 10280/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5676217211027456 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/tiff.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > LGTM ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2 4/5] h265_metadata: Add option to set the level of the stream
On Sun, Sep 30, 2018 at 11:26:11PM +0100, Mark Thompson wrote: > --- > doc/bitstream_filters.texi | 9 +++ > libavcodec/h265_metadata_bsf.c | 136 + > 2 files changed, 145 insertions(+) this seems to also fail to link: make distclean ; ./configure && make -j12 LD ffmpeg_g libavcodec/libavcodec.a(h265_metadata_bsf.o): In function `h265_metadata_guess_level': ffmpeg/libavcodec/h265_metadata_bsf.c:133: undefined reference to `ff_h265_guess_level' collect2: error: ld returned 1 exit status make: *** [ffmpeg_g] Error 1 [...] -- 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 http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v1 1/3] lavc/libxavs2: keep uniform with xavs2 api
Signed-off-by: hwren --- libavcodec/libxavs2.c | 18 -- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c index 2b47d0c..a3cd588 100644 --- a/libavcodec/libxavs2.c +++ b/libavcodec/libxavs2.c @@ -78,16 +78,14 @@ static av_cold int xavs2_init(AVCodecContext *avctx) return AVERROR(ENOMEM); } -xavs2_opt_set2("width", "%d", avctx->width); -xavs2_opt_set2("height","%d", avctx->height); -xavs2_opt_set2("bframes", "%d", avctx->max_b_frames); -xavs2_opt_set2("bitdepth", "%d", bit_depth); -xavs2_opt_set2("log", "%d", cae->log_level); -xavs2_opt_set2("preset","%d", cae->preset_level); - -/* not the same parameter as the IntraPeriod in xavs2 log */ -xavs2_opt_set2("intraperiod", "%d", avctx->gop_size); - +xavs2_opt_set2("Width", "%d", avctx->width); +xavs2_opt_set2("Height","%d", avctx->height); +xavs2_opt_set2("BFrames", "%d", avctx->max_b_frames); +xavs2_opt_set2("BitDepth", "%d", bit_depth); +xavs2_opt_set2("Log", "%d", cae->log_level); +xavs2_opt_set2("Preset","%d", cae->preset_level); + +xavs2_opt_set2("IntraPeriodMax","%d", avctx->gop_size); xavs2_opt_set2("thread_frames", "%d", avctx->thread_count); xavs2_opt_set2("thread_rows", "%d", cae->lcu_row_threads); -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v1 2/3] lavc/libxavs2: enable open_gop option
Signed-off-by: hwren --- libavcodec/libxavs2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c index a3cd588..cb01291 100644 --- a/libavcodec/libxavs2.c +++ b/libavcodec/libxavs2.c @@ -89,7 +89,7 @@ static av_cold int xavs2_init(AVCodecContext *avctx) xavs2_opt_set2("thread_frames", "%d", avctx->thread_count); xavs2_opt_set2("thread_rows", "%d", cae->lcu_row_threads); -xavs2_opt_set2("OpenGOP", "%d", 1); +xavs2_opt_set2("OpenGOP", "%d", !(avctx->flags & AV_CODEC_FLAG_CLOSED_GOP)); if (cae->xavs2_opts) { AVDictionary *dict= NULL; -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v1 3/3] lavc/libxavs2: unified option descriptions format
Signed-off-by: hwren --- libavcodec/libxavs2.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c index cb01291..6267b98 100644 --- a/libavcodec/libxavs2.c +++ b/libavcodec/libxavs2.c @@ -249,14 +249,14 @@ static av_cold int xavs2_close(AVCodecContext *avctx) #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { -{ "lcu_row_threads" , "number of parallel threads for rows" , OFFSET(lcu_row_threads) , AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, VE }, +{ "lcu_row_threads" , "Number of parallel threads for rows" , OFFSET(lcu_row_threads) , AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, VE }, { "initial_qp" , "Quantization initial parameter" , OFFSET(initial_qp) , AV_OPT_TYPE_INT, {.i64 = 34 }, 1, 63, VE }, { "qp" , "Quantization parameter" , OFFSET(qp) , AV_OPT_TYPE_INT, {.i64 = 34 }, 1, 63, VE }, -{ "max_qp" , "max qp for rate control" , OFFSET(max_qp) , AV_OPT_TYPE_INT, {.i64 = 55 }, 0, 63, VE }, -{ "min_qp" , "min qp for rate control" , OFFSET(min_qp) , AV_OPT_TYPE_INT, {.i64 = 20 }, 0, 63, VE }, +{ "max_qp" , "Max qp for rate control" , OFFSET(max_qp) , AV_OPT_TYPE_INT, {.i64 = 55 }, 0, 63, VE }, +{ "min_qp" , "Min qp for rate control" , OFFSET(min_qp) , AV_OPT_TYPE_INT, {.i64 = 20 }, 0, 63, VE }, { "speed_level" , "Speed level, higher is better but slower", OFFSET(preset_level), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 9, VE }, -{ "log_level" , "log level: -1: none, 0: error, 1: warning, 2: info, 3: debug", OFFSET(log_level), AV_OPT_TYPE_INT, {.i64 = 0 }, -1, 3, VE }, -{ "xavs2-params", "set the xavs2 configuration using a :-separated list of key=value parameters", OFFSET(xavs2_opts), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE }, +{ "log_level" , "Log level: -1: none, 0: error, 1: warning, 2: info, 3: debug", OFFSET(log_level), AV_OPT_TYPE_INT, {.i64 = 0 }, -1, 3, VE }, +{ "xavs2-params", "Set the xavs2 configuration using a :-separated list of key=value parameters", OFFSET(xavs2_opts), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE }, { NULL }, }; -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc/libaomenc: Add -tile-columns/-tile-rows
Hi, Max value for both the tile rows and tile columns is 64 (so the max log2 value would be 6). This is consistent in the public header: https://aomedia.googlesource.com/aom/+/master/aom/aomcx.h#291 and spec: https://aomediacodec.github.io/av1-spec/av1-spec.pdf (see page 7). On Fri, Aug 31, 2018 at 6:08 PM James Zern wrote: > On Fri, Aug 31, 2018 at 9:40 AM James Almer wrote: > > > > On 8/31/2018 1:00 PM, Kagami Hiiragi wrote: > > > On 31/08/18 18:18, James Almer wrote: > > >> On 8/31/2018 11:52 AM, Kagami Hiiragi wrote: > > >>> On 31/08/18 02:58, James Almer wrote: > > On 8/20/2018 2:56 PM, Kagami Hiiragi wrote: > > > These options are required for multithreaded encoding, because > they set > > > to zero by default in av1_cx_iface.c. > > > > > > Signed-off-by: Kagami Hiiragi > > > > > > diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c > > > index 9431179886..55cb7ff72e 100644 > > > --- a/libavcodec/libaomenc.c > > > +++ b/libavcodec/libaomenc.c > > > @@ -68,6 +68,8 @@ typedef struct AOMEncoderContext { > > > int static_thresh; > > > int drop_threshold; > > > int noise_sensitivity; > > > +int tile_columns; > > > +int tile_rows; > > > } AOMContext; > > > > > > static const char *const ctlidstr[] = { > > > @@ -75,6 +77,8 @@ static const char *const ctlidstr[] = { > > > [AOME_SET_CQ_LEVEL] = "AOME_SET_CQ_LEVEL", > > > [AOME_SET_ENABLEAUTOALTREF] = "AOME_SET_ENABLEAUTOALTREF", > > > [AOME_SET_STATIC_THRESHOLD] = "AOME_SET_STATIC_THRESHOLD", > > > +[AV1E_SET_TILE_COLUMNS] = "AV1E_SET_TILE_COLUMNS", > > > +[AV1E_SET_TILE_ROWS]= "AV1E_SET_TILE_ROWS", > > > [AV1E_SET_COLOR_RANGE] = "AV1E_SET_COLOR_RANGE", > > > [AV1E_SET_COLOR_PRIMARIES] = "AV1E_SET_COLOR_PRIMARIES", > > > [AV1E_SET_MATRIX_COEFFICIENTS] = > "AV1E_SET_MATRIX_COEFFICIENTS", > > > @@ -449,6 +453,11 @@ static av_cold int aom_init(AVCodecContext > *avctx, > > > if (ctx->crf >= 0) > > > codecctl_int(avctx, AOME_SET_CQ_LEVEL, ctx->crf); > > > > > > +if (ctx->tile_columns >= 0) > > > +codecctl_int(avctx, AV1E_SET_TILE_COLUMNS, > ctx->tile_columns); > > > +if (ctx->tile_rows >= 0) > > > +codecctl_int(avctx, AV1E_SET_TILE_ROWS, ctx->tile_rows); > > > + > > > codecctl_int(avctx, AV1E_SET_COLOR_PRIMARIES, > avctx->color_primaries); > > > codecctl_int(avctx, AV1E_SET_MATRIX_COEFFICIENTS, > avctx->colorspace); > > > codecctl_int(avctx, AV1E_SET_TRANSFER_CHARACTERISTICS, > avctx->color_trc); > > > @@ -746,6 +755,8 @@ static const AVOption options[] = { > > > { "static-thresh","A change threshold on blocks below > which they will be skipped by the encoder", OFFSET(static_thresh), > AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE }, > > > { "drop-threshold", "Frame drop threshold", > offsetof(AOMContext, drop_threshold), AV_OPT_TYPE_INT, {.i64 = 0 }, > INT_MIN, INT_MAX, VE }, > > > { "noise-sensitivity", "Noise sensitivity", > OFFSET(noise_sensitivity), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 4, VE}, > > > +{ "tile-columns", "Number of tile columns to use, log2", > OFFSET(tile_columns), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6, VE}, > > > > Why 6? The libaom API doesn't mention a limit, just says the > argument > > should be in log2 unit, and that it will be capped based on the > image size. > > >>> > > >>> > https://aomedia.googlesource.com/aom/+/1742b043e2269dc1927afe428fbf5a46493e741e/av1/av1_cx_iface.c#298 > > >>> > > > +{ "tile-rows", "Number of tile rows to use, log2", > OFFSET(tile_rows), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6, VE}, > > > > And for this one it says the range is [0-2]. > > >>> > > >>> Who says it? I can pass --tile-rows=6 to aomenc. > > >> > > >> The doxy in the public header: > > >> https://aomedia.googlesource.com/aom/+/master/aom/aomcx.h#312 > > > > > > I guess it wasn't fixed after > > > > https://aomedia.googlesource.com/aom/+/492c545fad1e1f980d23d79d0372857c60d31458 > ^!/#F1 > > > > > > I don't think ffmpeg should deal with libaom documentation issues... > > > > Seeing it's effectively a documentation issue, and that the change you > > quoted was made before libaom 1.0.0 was tagged, then i guess the patch > > is ok. > > > > I reported it to libaom bug tracker as well. > > Thanks for filing the bug, I posted a fix. Note AV1 supports > non-uniform tiles now and there's another way to specify absolute > widths and heights (--tile-width/height). This parameter wasn't > descaled to allow the encoder to choose the layout unfortunately [1]. > > [1] https://bugs.chromium.org/p/aomedia/issues/detail?id=2124 > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >
[FFmpeg-devel] A query on FFmpeg OpenMAX IL supported backends
Hello guys, I had posted this earlier on the ffmpeg-user mailing list (and received no response) and it'd seem that this is the right place for this, due to the subject matter. From the documentation available on FFmpeg's support for OpenMAX IL, the only backend I can confirm to be officially supported (correct me if I'm wrong) is the library provided for the Raspberry Pi, namely libbcm_host.so and libopenmaxil.so, satisfied by the packages libraspberrypi0 libraspberrypi-dev libraspberrypi-doc libraspberrypi-bin on raspbian. See line 140-145 in libavcodec/omx.c , doxygen entry https://www.ffmpeg.org/doxygen/3.1/omx_8c_source.html. The named packages above are related to Broadcom's VideoCore SIPs on the Raspberry hardware. When it comes to encoders, there is h264_omx. My questions are: 1. What platforms are supported by the current OMX implementation in FFmpeg, Bellagio? Is Xilinx-based hardware supported? 2. Can another OpenMAX IL backend, such as the library offered by Xilinx, see https://github.com/Xilinx/vcu-omx-il be added to FFmpeg in the same way as Bellagio's? That way, hardware such as Xilinx's Zync MPSoCs can be supported by encoders such as h264_omx above as an alternative to this solution shown here: http://fftrac-bg.ffmpeg.org/ticket/7214 The h264_onx encoder also offers an option for selecting a library name and prefix via the -omx_libname and -omx_libprefix arguments respectively, though I'm yet to test this option. Warm regards, Dennis. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] avfilter: add ff_inlink_queued_samples()
Signed-off-by: Paul B Mahol --- libavfilter/avfilter.c | 6 ++ libavfilter/filters.h | 7 +++ 2 files changed, 13 insertions(+) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 85eff0aa1d..2dcaabf545 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#define ASSERT_LEVEL 5 #include "libavutil/avassert.h" #include "libavutil/avstring.h" #include "libavutil/buffer.h" @@ -1453,6 +1454,11 @@ int ff_inlink_check_available_frame(AVFilterLink *link) return ff_framequeue_queued_frames(&link->fifo) > 0; } +int ff_inlink_queued_samples(AVFilterLink *link) +{ +return ff_framequeue_queued_samples(&link->fifo); +} + int ff_inlink_check_available_samples(AVFilterLink *link, unsigned min) { uint64_t samples = ff_framequeue_queued_samples(&link->fifo); diff --git a/libavfilter/filters.h b/libavfilter/filters.h index 4e2652ebe5..06a0f5896b 100644 --- a/libavfilter/filters.h +++ b/libavfilter/filters.h @@ -66,6 +66,13 @@ int ff_inlink_evaluate_timeline_at_frame(AVFilterLink *link, const AVFrame *fram */ int ff_inlink_check_available_frame(AVFilterLink *link); + +/*** + * Get the number of samples available on the link. + * @retrun the numer of samples available on the link. + */ +int ff_inlink_queued_samples(AVFilterLink *link); + /** * Test if enough samples are available on the link. * @return >0 if enough samples are available -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] avfilter/af_headphone: use lavfi internal queue instead
On 10/2/18, Paul B Mahol wrote: > Signed-off-by: Paul B Mahol > --- > libavfilter/af_headphone.c | 46 -- > 1 file changed, 9 insertions(+), 37 deletions(-) > Unfortunately this asserts for unexplained reason. Is there way with filters with multiple inputs to not hang when not consuming all frames from some inputs? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] avfilter/af_headphone: use lavfi internal queue instead
Signed-off-by: Paul B Mahol --- libavfilter/af_headphone.c | 46 -- 1 file changed, 9 insertions(+), 37 deletions(-) diff --git a/libavfilter/af_headphone.c b/libavfilter/af_headphone.c index 6b210e1436..f13f5bedcc 100644 --- a/libavfilter/af_headphone.c +++ b/libavfilter/af_headphone.c @@ -20,7 +20,6 @@ #include -#include "libavutil/audio_fifo.h" #include "libavutil/avstring.h" #include "libavutil/channel_layout.h" #include "libavutil/float_dsp.h" @@ -79,7 +78,6 @@ typedef struct HeadphoneContext { AVFloatDSPContext *fdsp; struct headphone_inputs { -AVAudioFifo *fifo; AVFrame *frame; int ir_len; int delay_l; @@ -328,20 +326,13 @@ static int headphone_fast_convolute(AVFilterContext *ctx, void *arg, int jobnr, return 0; } -static int read_ir(AVFilterLink *inlink, int input_number, AVFrame *frame) +static int check_ir(AVFilterLink *inlink, int input_number) { AVFilterContext *ctx = inlink->dst; HeadphoneContext *s = ctx->priv; -int ir_len, max_ir_len, ret; +int ir_len, max_ir_len; -ret = av_audio_fifo_write(s->in[input_number].fifo, (void **)frame->extended_data, - frame->nb_samples); -av_frame_free(&frame); - -if (ret < 0) -return ret; - -ir_len = av_audio_fifo_size(s->in[input_number].fifo); +ir_len = ff_inlink_queued_samples(inlink); max_ir_len = 65536; if (ir_len > max_ir_len) { av_log(ctx, AV_LOG_ERROR, "Too big length of IRs: %d > %d.\n", ir_len, max_ir_len); @@ -457,14 +448,6 @@ static int convert_coeffs(AVFilterContext *ctx, AVFilterLink *inlink) goto fail; } -for (i = 0; i < s->nb_inputs - 1; i++) { -s->in[i + 1].frame = ff_get_audio_buffer(ctx->inputs[i + 1], s->ir_len); -if (!s->in[i + 1].frame) { -ret = AVERROR(ENOMEM); -goto fail; -} -} - if (s->type == TIME_DOMAIN) { s->temp_src[0] = av_calloc(FFALIGN(ir_len, 16), sizeof(float)); s->temp_src[1] = av_calloc(FFALIGN(ir_len, 16), sizeof(float)); @@ -490,7 +473,9 @@ static int convert_coeffs(AVFilterContext *ctx, AVFilterLink *inlink) int delay_r = s->in[i + 1].delay_r; float *ptr; -av_audio_fifo_read(s->in[i + 1].fifo, (void **)s->in[i + 1].frame->extended_data, len); +ret = ff_inlink_consume_samples(ctx->inputs[i + 1], len, len, &s->in[i + 1].frame); +if (ret < 0) +return ret; ptr = (float *)s->in[i + 1].frame->extended_data[0]; if (s->hrir_fmt == HRIR_STEREO) { @@ -623,23 +608,17 @@ static int activate(AVFilterContext *ctx) FF_FILTER_FORWARD_STATUS_BACK_ALL(ctx->outputs[0], ctx); if (!s->eof_hrirs) { for (i = 1; i < s->nb_inputs; i++) { -AVFrame *ir = NULL; int64_t pts; int status; if (s->in[i].eof) continue; -if ((ret = ff_inlink_consume_frame(ctx->inputs[i], &ir)) > 0) { -ret = read_ir(ctx->inputs[i], i, ir); -if (ret < 0) -return ret; -} -if (ret < 0) +if ((ret = check_ir(ctx->inputs[i], i)) < 0) return ret; if (!s->in[i].eof) { -if (ff_inlink_acknowledge_status(ctx->inputs[i], &status, &pts)) { +if (ff_inlink_acknowledge_status(ctx->inputs[i], &status, &pts) > 0) { if (status == AVERROR_EOF) { s->in[i].eof = 1; } @@ -659,6 +638,7 @@ static int activate(AVFilterContext *ctx) ff_inlink_request_frame(ctx->inputs[i]); } } + return 0; } else { s->eof_hrirs = 1; @@ -803,7 +783,6 @@ static int config_output(AVFilterLink *outlink) AVFilterContext *ctx = outlink->src; HeadphoneContext *s = ctx->priv; AVFilterLink *inlink = ctx->inputs[0]; -int i; if (s->hrir_fmt == HRIR_MULTI) { AVFilterLink *hrir_link = ctx->inputs[1]; @@ -814,11 +793,6 @@ static int config_output(AVFilterLink *outlink) } } -for (i = 0; i < s->nb_inputs; i++) { -s->in[i].fifo = av_audio_fifo_alloc(ctx->inputs[i]->format, ctx->inputs[i]->channels, 1024); -if (!s->in[i].fifo) -return AVERROR(ENOMEM); -} s->gain_lfe = expf((s->gain - 3 * inlink->channels - 6 + s->lfe_gain) / 20 * M_LN10); return 0; @@ -848,8 +822,6 @@ static av_cold void uninit(AVFilterContext *ctx) av_freep(&s->fdsp); for (i = 0; i < s->nb_inputs; i++) { -av_frame_free(&s->in[i].frame); -av_audio_fifo_free(s->in[i].fifo); if (ctx->input_pads && i) av_freep(&ctx->input_pads[i].name); } -- 2.17.1 ___ ffmpeg-devel mailing li
[FFmpeg-devel] [PATCHv2 4/7] avformat/udp: add support for generic source filtering
This allows getting data only from a specific source IP. This is useful not only for unicast but for multicast as well because multicast source subscriptions do not act as source filters for the incoming packets. v2: fixed addrlen value when calling recvfrom. Signed-off-by: Marton Balint --- doc/protocols.texi | 8 libavformat/udp.c | 17 + 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/doc/protocols.texi b/doc/protocols.texi index fad6c44c24..7173bb173a 100644 --- a/doc/protocols.texi +++ b/doc/protocols.texi @@ -1569,12 +1569,12 @@ For receiving, this gives the benefit of only receiving packets from the specified peer address/port. @item sources=@var{address}[,@var{address}] -Only receive packets sent to the multicast group from one of the -specified sender IP addresses. +Only receive packets sent from the specified addresses. In case of multicast, +also subscribe to multicast traffic coming from these addresses only. @item block=@var{address}[,@var{address}] -Ignore packets sent to the multicast group from the specified -sender IP addresses. +Ignore packets sent from the specified addresses. In case of multicast, also +exclude the source addresses in the multicast subscription. @item fifo_size=@var{units} Set the UDP receiving circular buffer size, expressed as a number of diff --git a/libavformat/udp.c b/libavformat/udp.c index 427128c431..8d0f7f1519 100644 --- a/libavformat/udp.c +++ b/libavformat/udp.c @@ -458,13 +458,15 @@ static void *circular_buffer_task_rx( void *_URLContext) } while(1) { int len; +struct sockaddr_storage addr; +socklen_t addr_len = sizeof(addr); pthread_mutex_unlock(&s->mutex); /* Blocking operations are always cancellation points; see "General Information" / "Thread Cancelation Overview" in Single Unix. */ pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &old_cancelstate); -len = recv(s->udp_fd, s->tmp+4, sizeof(s->tmp)-4, 0); +len = recvfrom(s->udp_fd, s->tmp+4, sizeof(s->tmp)-4, 0, (struct sockaddr *)&addr, &addr_len); pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &old_cancelstate); pthread_mutex_lock(&s->mutex); if (len < 0) { @@ -474,6 +476,8 @@ static void *circular_buffer_task_rx( void *_URLContext) } continue; } +if (ff_ip_check_source_lists(&addr, &s->filters)) +continue; AV_WL32(s->tmp, len); if(av_fifo_space(s->fifo) < len + 4) { @@ -926,6 +930,8 @@ static int udp_read(URLContext *h, uint8_t *buf, int size) { UDPContext *s = h->priv_data; int ret; +struct sockaddr_storage addr; +socklen_t addr_len = sizeof(addr); #if HAVE_PTHREAD_CANCEL int avail, nonblock = h->flags & AVIO_FLAG_NONBLOCK; @@ -976,9 +982,12 @@ static int udp_read(URLContext *h, uint8_t *buf, int size) if (ret < 0) return ret; } -ret = recv(s->udp_fd, buf, size, 0); - -return ret < 0 ? ff_neterrno() : ret; +ret = recvfrom(s->udp_fd, buf, size, 0, (struct sockaddr *)&addr, &addr_len); +if (ret < 0) +return ff_neterrno(); +if (ff_ip_check_source_lists(&addr, &s->filters)) +return AVERROR(EINTR); +return ret; } static int udp_write(URLContext *h, const uint8_t *buf, int size) -- 2.16.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] libaomenc: Add support for tiles
Adds an option to specify the number of tile rows and columns, then uses a uniform tiling if possible and otherwise a fixed tiling with equal-sized tiles to fill the frame. Also adds -tile-columns and -tile-rows options to make tilings with power-of-two numbers of tiles, matching the behaviour of the libvpx/VP9 encoder. --- On 23/09/18 23:55, Mark Thompson wrote: > On 19/09/18 00:15, James Almer wrote: >> On 9/18/2018 7:55 PM, Mark Thompson wrote: >>> On 18/09/18 01:12, James Almer wrote: On 9/17/2018 8:47 PM, Mark Thompson wrote: > Adds an option to specify the number of tile rows and columns, then uses > equal-sized tiles to fill the frame. > --- > libavcodec/libaomenc.c | 54 ++ > 1 file changed, 54 insertions(+) > > diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c > index 6a79d9b873..3ccff0e0fb 100644 > --- a/libavcodec/libaomenc.c > +++ b/libavcodec/libaomenc.c > ... > @@ -742,6 +795,7 @@ static const AVOption options[] = { > { "static-thresh","A change threshold on blocks below which they > will be skipped by the encoder", OFFSET(static_thresh), AV_OPT_TYPE_INT, > { .i64 = 0 }, 0, INT_MAX, VE }, > { "drop-threshold", "Frame drop threshold", offsetof(AOMContext, > drop_threshold), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, VE }, > { "noise-sensitivity", "Noise sensitivity", > OFFSET(noise_sensitivity), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 4, VE}, > +{ "tiles","Tile rows x columns", OFFSET(tile_cols), > AV_OPT_TYPE_IMAGE_SIZE, { .str = NULL }, 0, 0, VE }, Using separate tile-columns and tile-rows AV_OPT_TYPE_INT options would be more consistent with the libvpx wrapper, which already has them called like that and also shares a lot of other option names with the libaom. >>> >>> The options on libvpx-vp9 are actually log2 of the value, so "-tile-rows 3 >>> -tile-columns 2" gives you 8x4 tiles. (VP9 requires that the number of >>> tiles in each dimension is a power of two, while AV1 lets you set arbitrary >>> sizes.) >>> >>> I don't really mind how this works - I just thought the IMAGE_SIZE method >>> looked nicer. What do you prefer? >> >> I usually prefer consistency in options for similar modules, but the >> equivalent of the VP9 options would be to set the AV1E_SET_TILE_* codec >> control IDs instead of what you're doing here, so your IMAGE_SIZE method >> is fine. >> >> There's for that matter a conflicting patch called "lavc/libaomenc: Add >> -tile-columns/-tile-rows" by Kagami Hiiragi that sets the aforementioned >> codec control IDs with the same option names as the VP9 ones. Maybe both >> patches can be applied, and have the encoder abort if they are used at >> the same time? Otherwise apply yours alone since it allows arbitrary sizes. > > I think having both would make sense - the two different options are > reflecting the different values of uniform_tile_spacing_flag. The explicit > sizing can get the same result with the flag off as it being on, but will > require more bits in every frame header to do so. > > On matching behaviour with libvpx, I don't think tile_cols/rows_log2 in VP9 > and AV1 (with uniform_tile_spacing_flag = 1) actually do have the same effect > - VP9 ensures that you get exactly 2^tile_cols_log2 tile columns, while for > AV1 it's an upper bound and depends on the width. For example, given a width > of 576 (as 9 64x64 superblocks) and tile_cols_log2 = 2, VP9 looks like it > gives you { 2, 2, 2, 3 } while AV1 will give you { 3, 3, 3 } as the tile > column widths. That probably wants to be mentioned in the documentation, and > maybe merits the options not matching precisely. > > So, I'll look into supporting both cases in some consistent way. Here we go; hopefully this covers all of the cases. I went for making the options match precisely for the power-of-two values in VP9 - we can determine what arrangements a uniform tiling will produce and decide from that whether to use one or not. - Mark libavcodec/libaomenc.c | 189 + 1 file changed, 189 insertions(+) diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c index 6a79d9b873..50abc6a5db 100644 --- a/libavcodec/libaomenc.c +++ b/libavcodec/libaomenc.c @@ -34,6 +34,7 @@ #include "libavutil/opt.h" #include "libavutil/pixdesc.h" +#include "av1.h" #include "avcodec.h" #include "internal.h" #include "profiles.h" @@ -68,6 +69,11 @@ typedef struct AOMEncoderContext { int static_thresh; int drop_threshold; int noise_sensitivity; +int tile_cols, tile_rows; +int tile_cols_log2, tile_rows_log2; + +aom_superblock_size_t superblock_size; +int uniform_tiles; } AOMContext; static const char *const ctlidstr[] = { @@ -79,6 +85,9 @@ static const char *const ctlidstr[] = { [AV1E_SET_COLOR_PRIMARIES] = "AV1E_SET_COL
[FFmpeg-devel] [PATCH 2/2] avformat/ivfenc: use the av1_metadata bsf to insert Temporal Delimiter OBUs if needed
Signed-off-by: James Almer --- libavformat/ivfenc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c index 66441a2a43..adf72117e9 100644 --- a/libavformat/ivfenc.c +++ b/libavformat/ivfenc.c @@ -97,6 +97,8 @@ static int ivf_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt) if (st->codecpar->codec_id == AV_CODEC_ID_VP9) ret = ff_stream_add_bitstream_filter(st, "vp9_superframe", NULL); +else if (st->codecpar->codec_id == AV_CODEC_ID_AV1) +ret = ff_stream_add_bitstream_filter(st, "av1_metadata", "td=insert"); return ret; } -- 2.19.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] avcodec/av1_metadata: add an option to insert and remove Temporal Delimiter OBUs
Signed-off-by: James Almer --- libavcodec/av1_metadata_bsf.c | 37 ++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/libavcodec/av1_metadata_bsf.c b/libavcodec/av1_metadata_bsf.c index ed2f018fb6..20c3a39da7 100644 --- a/libavcodec/av1_metadata_bsf.c +++ b/libavcodec/av1_metadata_bsf.c @@ -23,12 +23,20 @@ #include "cbs.h" #include "cbs_av1.h" +enum { +PASS, +INSERT, +REMOVE, +}; + typedef struct AV1MetadataContext { const AVClass *class; CodedBitstreamContext *cbc; CodedBitstreamFragment access_unit; +int td; + int color_primaries; int transfer_characteristics; int matrix_coefficients; @@ -115,7 +123,7 @@ static int av1_metadata_filter(AVBSFContext *bsf, AVPacket *out) AV1MetadataContext *ctx = bsf->priv_data; AVPacket *in = NULL; CodedBitstreamFragment *frag = &ctx->access_unit; -AV1RawOBU *obu; +AV1RawOBU td, *obu; int err, i; err = ff_bsf_get_packet(bsf, &in); @@ -137,6 +145,23 @@ static int av1_metadata_filter(AVBSFContext *bsf, AVPacket *out) } } +// If a Temporal Delimiter is present, it must be the first OBU. +if (frag->units[0].type == AV1_OBU_TEMPORAL_DELIMITER) { +if (ctx->td == REMOVE) +ff_cbs_delete_unit(ctx->cbc, frag, 0); +} else if (ctx->td == INSERT) { +td = (AV1RawOBU) { +.header.obu_type = AV1_OBU_TEMPORAL_DELIMITER, +}; + +err = ff_cbs_insert_unit_content(ctx->cbc, frag, 0, AV1_OBU_TEMPORAL_DELIMITER, + &td, NULL); +if (err < 0) { +av_log(bsf, AV_LOG_ERROR, "Failed to insert Temporal Delimiter.\n"); +goto fail; +} +} + err = ff_cbs_write_packet(ctx->cbc, out, frag); if (err < 0) { av_log(bsf, AV_LOG_ERROR, "Failed to write packet.\n"); @@ -207,6 +232,16 @@ static void av1_metadata_close(AVBSFContext *bsf) #define OFFSET(x) offsetof(AV1MetadataContext, x) #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_BSF_PARAM) static const AVOption av1_metadata_options[] = { +{ "td", "Temporal Delimiter OBU", +OFFSET(td), AV_OPT_TYPE_INT, +{ .i64 = PASS }, PASS, REMOVE, FLAGS, "td" }, +{ "pass", NULL, 0, AV_OPT_TYPE_CONST, +{ .i64 = PASS }, .flags = FLAGS, .unit = "td" }, +{ "insert", NULL, 0, AV_OPT_TYPE_CONST, +{ .i64 = INSERT }, .flags = FLAGS, .unit = "td" }, +{ "remove", NULL, 0, AV_OPT_TYPE_CONST, +{ .i64 = REMOVE }, .flags = FLAGS, .unit = "td" }, + { "color_primaries", "Set color primaries (section 6.4.2)", OFFSET(color_primaries), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 255, FLAGS }, -- 2.19.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 4/5] avutil/tests/parseutils: add some big duration tests
On Sun, Sep 30, 2018 at 10:45:12PM +0200, Marton Balint wrote: > These are buggy for now... > > Signed-off-by: Marton Balint > --- > libavutil/tests/parseutils.c | 4 > tests/ref/fate/parseutils| 4 > 2 files changed, 8 insertions(+) This patch should only be pushed when the one fixing these issues is otherwise we might have test failures from these buggy cases behaving differently across platforms [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Let us carefully observe those good qualities wherein our enemies excel us and endeavor to excel them, by avoiding what is faulty, and imitating what is excellent in them. -- Plutarch signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2] avcodec: add an AV1 parser
Simple parser to set keyframes, frame type, structure, width, height, and pixel format, plus stream profile and level. Signed-off-by: James Almer --- Missing Changelog entry and version bump still. configure | 1 + libavcodec/Makefile | 1 + libavcodec/av1_parser.c | 226 libavcodec/parsers.c| 1 + 4 files changed, 229 insertions(+) create mode 100644 libavcodec/av1_parser.c diff --git a/configure b/configure index 8168ca4369..ea0182d0aa 100755 --- a/configure +++ b/configure @@ -3020,6 +3020,7 @@ wmv3_crystalhd_decoder_select="crystalhd" # parsers aac_parser_select="adts_header" +av1_parser_select="cbs_av1" h264_parser_select="golomb h264dsp h264parse" hevc_parser_select="hevcparse" mpegaudio_parser_select="mpegaudioheader" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index b2c6995f9a..dc28892e64 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -1006,6 +1006,7 @@ OBJS-$(CONFIG_AAC_PARSER) += aac_parser.o aac_ac3_parser.o \ mpeg4audio.o OBJS-$(CONFIG_AC3_PARSER) += ac3tab.o aac_ac3_parser.o OBJS-$(CONFIG_ADX_PARSER) += adx_parser.o adx.o +OBJS-$(CONFIG_AV1_PARSER) += av1_parser.o OBJS-$(CONFIG_AVS2_PARSER) += avs2_parser.o OBJS-$(CONFIG_BMP_PARSER) += bmp_parser.o OBJS-$(CONFIG_CAVSVIDEO_PARSER)+= cavs_parser.o diff --git a/libavcodec/av1_parser.c b/libavcodec/av1_parser.c new file mode 100644 index 00..0dee3e9d2e --- /dev/null +++ b/libavcodec/av1_parser.c @@ -0,0 +1,226 @@ +/* + * AV1 parser + * + * Copyright (C) 2018 James Almer + * + * 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 "av1_parse.h" +#include "cbs.h" +#include "cbs_av1.h" +#include "parser.h" + +typedef struct AV1ParseContext { +CodedBitstreamContext *cbc; +CodedBitstreamFragment temporal_unit; +int parsed_extradata; +} AV1ParseContext; + +static const enum AVPixelFormat pix_fmts_8bit[2][2] = { +{ AV_PIX_FMT_YUV444P, AV_PIX_FMT_NONE }, +{ AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV420P }, +}; +static const enum AVPixelFormat pix_fmts_10bit[2][2] = { +{ AV_PIX_FMT_YUV444P10, AV_PIX_FMT_NONE }, +{ AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV420P10 }, +}; +static const enum AVPixelFormat pix_fmts_12bit[2][2] = { +{ AV_PIX_FMT_YUV444P12, AV_PIX_FMT_NONE }, +{ AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV420P12 }, +}; + +static int av1_parser_parse(AVCodecParserContext *ctx, +AVCodecContext *avctx, +const uint8_t **out_data, int *out_size, +const uint8_t *data, int size) +{ +AV1ParseContext *s = ctx->priv_data; +CodedBitstreamFragment *td = &s->temporal_unit; +CodedBitstreamAV1Context *av1 = s->cbc->priv_data; +int ret; + +*out_data = data; +*out_size = size; + +ctx->key_frame = -1; +ctx->pict_type = AV_PICTURE_TYPE_NONE; +ctx->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN; + +s->cbc->log_ctx = avctx; + +if (avctx->extradata_size && !s->parsed_extradata) { +s->parsed_extradata = 1; + +ret = ff_cbs_read(s->cbc, td, avctx->extradata, avctx->extradata_size); +if (ret < 0) { +av_log(avctx, AV_LOG_ERROR, "Failed to parse extradata.\n"); +return size; +} + +ff_cbs_fragment_uninit(s->cbc, td); +} + +ret = ff_cbs_read(s->cbc, td, data, size); +if (ret < 0) { +av_log(avctx, AV_LOG_ERROR, "Failed to parse temporal unit.\n"); +return size; +} + +if (!av1->sequence_header) { +av_log(avctx, AV_LOG_ERROR, "No sequence header available\n"); +goto end; +} + +for (int i = 0; i < td->nb_units; i++) { +CodedBitstreamUnit *unit = &td->units[i]; +AV1RawOBU *obu = unit->content; +AV1RawSequenceHeader *seq = av1->sequence_header; +AV1RawColorConfig *color = &seq->color_config; +AV1RawFrameHeader *frame; +int frame_type; + +if (unit->type == AV1_OBU_FRAME) +frame = &obu->obu.frame.header; +else if (unit->type == AV1_OBU_FRAME_HEADER) +frame