Re: [FFmpeg-devel] [PATCH] avcodec/prores_ks reduce twice fdct calls
I seems to be lame as failed to find how to run fate to check prores_ks :( On Mon, Dec 31, 2018 at 4:46 AM Michael Niedermayer wrote: > On Sun, Dec 30, 2018 at 10:57:23PM +0200, Alex Mogurenko wrote: > > fdct done twice for each block. first time during quant calculation, > second during slice encoding. so if we pre-save dct coefficients no need to > do fdct second time. > > disadvantages: requires more memory > > advantages: improves performance ~4-5% > > --- > > libavcodec/proresenc_kostya.c | 74 --- > > 1 file changed, 52 insertions(+), 22 deletions(-) > > breaks fate > > TESTvsynth1-prores_ks > --- ./tests/ref/vsynth/vsynth1-prores_ks2018-12-28 > 17:54:41.361383177 +0100 > +++ tests/data/fate/vsynth1-prores_ks 2018-12-31 03:45:17.207673799 +0100 > @@ -1,4 +1,4 @@ > -fe41a284da97ea5ec8866ca9a55b84da *tests/data/fate/vsynth1-prores_ks.mov > -3858911 tests/data/fate/vsynth1-prores_ks.mov > -100eb002413fe7a632d440dfbdf7e3ff > *tests/data/fate/vsynth1-prores_ks.out.rawvideo > -stddev:3.17 PSNR: 38.09 MAXDIFF: 39 bytes: 7603200/ 7603200 > +ba6294d95b96f032b90f804f112ab98a *tests/data/fate/vsynth1-prores_ks.mov > +3867422 tests/data/fate/vsynth1-prores_ks.mov > +e85510eadb1ff115e85c480d8e1011a4 > *tests/data/fate/vsynth1-prores_ks.out.rawvideo > +stddev: 19.38 PSNR: 22.38 MAXDIFF: 210 bytes: 7603200/ 7603200 > Test vsynth1-prores_ks failed. Look at > tests/data/fate/vsynth1-prores_ks.err for details. > make: *** [fate-vsynth1-prores_ks] Error 1 > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > "You are 36 times more likely to die in a bathtub than at the hands of a > terrorist. Also, you are 2.5 times more likely to become a president and > 2 times more likely to become an astronaut, than to die in a terrorist > attack." -- Thoughty2 > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/prores_ks reduce twice fdct calls
On 31/12/2018 09:12, Alex Mogurenko wrote: > I seems to be lame as failed to find how to run fate to check prores_ks :( General way to run all of FATE: $ configure --samples=/home/path/for/samples/ --enable-gpl [...] $ make fate-rsync $ make fate There are sub-targets, too, as listed in Michaels mail, like fate-vsynth1. - Derek ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libavcodec: Remove dynamic relocs from aarch64/h264idct_neon.S
On Fri, Dec 28, 2018 at 03:12:53PM -0800, Manoj Gupta wrote: > Hi All, > > I recently had a problem building ffmpeg for AArch64 where lld linker > complained about text relocations in readonly segment. The following > patch fixes the linker complains by referring to a local label instead > of function name. > > This is similar in nature as the following previous commits: > https://www.mail-archive.com/ffmpeg-cvslog@ffmpeg.org/msg34290.html > https://www.mail-archive.com/ffmpeg-cvslog@ffmpeg.org/msg34419.html > > Thanks, > Manoj > > Patch: > > libavcodec: Remove dynamic relocs from aarch64/h264idct_neon.S > > Some of the assembly functions e.g. ff_h264_idct_dc_add_neon > has code like: > movrel x14, X(ff_h264_idct_add_neon) > > Linker cannot resolve them fully at link time and emits dynamic > relocations. > Use explicit labels instead so that no dynamic relocations are > needed at all. > > This avoids lld complains about text relocations. > > For background, see https://crbug.com/917919 > > Signed-off-by: Manoj Gupta > --- > libavcodec/aarch64/h264idct_neon.S | 20 > 1 file changed, 12 insertions(+), 8 deletions(-) Has this been tested on all common aarch64 platforms ? Also git doesnt separate the mail from the commit message and would put the wholw email as the commit message, i assume that is not intended. thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Modern terrorism, a quick summary: Need oil, start war with country that has oil, kill hundread thousand in war. Let country fall into chaos, be surprised about raise of fundamantalists. Drop more bombs, kill more people, be surprised about them taking revenge and drop even more bombs and strip your own citizens of their rights and freedoms. to be continued signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] avcodec/rangecoder: Add and test ff_rac_check_termination()
On Sun, Dec 23, 2018 at 07:24:49PM +0100, Michael Niedermayer wrote: > Signed-off-by: Michael Niedermayer > --- > libavcodec/rangecoder.c | 19 +++ > libavcodec/rangecoder.h | 9 + > libavcodec/tests/rangecoder.c | 7 +-- > 3 files changed, 33 insertions(+), 2 deletions(-) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Whats the most studid thing your enemy could do ? Blow himself up Whats the most studid thing you could do ? Give up your rights and freedom because your enemy blew himself up. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/3] avcodec/scpr: Use local variables in decode_run_i()
On Thu, Dec 27, 2018 at 11:40:56AM +0100, Michael Niedermayer wrote: > This improves the speed of decode_run_i() > > Before: > clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-5656821117747200 > in 17420 ms > After: > clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-5656821117747200 > in 14018 ms > > Improves: > 11270/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-5656821117747200 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/scpr.h | 125 +- > 1 file changed, 67 insertions(+), 58 deletions(-) will apply patchset [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Observe your enemies, for they first find out your faults. -- Antisthenes signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] avcodec/rangecoder: Add and test ff_rac_check_termination()
On 12/31/2018 1:40 PM, Michael Niedermayer wrote: > On Sun, Dec 23, 2018 at 07:24:49PM +0100, Michael Niedermayer wrote: >> Signed-off-by: Michael Niedermayer >> --- >> libavcodec/rangecoder.c | 19 +++ >> libavcodec/rangecoder.h | 9 + >> libavcodec/tests/rangecoder.c | 7 +-- >> 3 files changed, 33 insertions(+), 2 deletions(-) > > will apply Is this function called from a hot loop? If so, it may be worth making it inline instead, seeing how the version argument in the only cases it's used is a constant. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 10/16] avcodec/alac: Avoid unspecific error codes and forward error codes
Signed-off-by: Michael Niedermayer --- libavcodec/alac.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/alac.c b/libavcodec/alac.c index 93cf198eea..d6b87db734 100644 --- a/libavcodec/alac.c +++ b/libavcodec/alac.c @@ -121,7 +121,7 @@ static int rice_decompress(ALACContext *alac, int32_t *output_buffer, unsigned int x; if(get_bits_left(&alac->gb) <= 0) -return -1; +return AVERROR_INVALIDDATA; /* calculate rice param and decode next value */ k = av_log2((history >> 9) + 3); @@ -317,7 +317,7 @@ static int decode_element(AVCodecContext *avctx, AVFrame *frame, int ch_index, if (alac->extra_bits) { for (i = 0; i < alac->nb_samples; i++) { if(get_bits_left(&alac->gb) <= 0) -return -1; +return AVERROR_INVALIDDATA; for (ch = 0; ch < channels; ch++) alac->extra_bits_buffer[ch][i] = get_bits(&alac->gb, alac->extra_bits); } @@ -353,7 +353,7 @@ static int decode_element(AVCodecContext *avctx, AVFrame *frame, int ch_index, /* not compressed, easy case */ for (i = 0; i < alac->nb_samples; i++) { if(get_bits_left(&alac->gb) <= 0) -return -1; +return AVERROR_INVALIDDATA; for (ch = 0; ch < channels; ch++) { alac->output_samples_buffer[ch][i] = get_sbits_long(&alac->gb, alac->sample_size); @@ -555,9 +555,9 @@ static av_cold int alac_decode_init(AVCodecContext * avctx) av_log(avctx, AV_LOG_ERROR, "extradata is too small\n"); return AVERROR_INVALIDDATA; } -if (alac_set_info(alac)) { +if ((ret = alac_set_info(alac)) < 0) { av_log(avctx, AV_LOG_ERROR, "set_info failed\n"); -return -1; +return ret; } switch (alac->sample_size) { -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 11/16] avcodec/adpcm: use assert for codec id instead or error return
A unsupported codec_id is a internal error and should not happen Signed-off-by: Michael Niedermayer --- libavcodec/adpcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index cd3bbd33c2..aa9c7c5c4f 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -1679,7 +1679,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data, break; default: -return -1; +av_assert0(0); // unsupported codec_id should not happen } if (avpkt->size && bytestream2_tell(&gb) == 0) { -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 13/16] avcodec/dct: Propagate error code from ff_rdft_init()
Signed-off-by: Michael Niedermayer --- libavcodec/dct.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/dct.c b/libavcodec/dct.c index cca51eeaf8..52f082d062 100644 --- a/libavcodec/dct.c +++ b/libavcodec/dct.c @@ -178,6 +178,7 @@ av_cold int ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType inverse) { int n = 1 << nbits; int i; +int ret; memset(s, 0, sizeof(*s)); @@ -194,9 +195,9 @@ av_cold int ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType inverse) if (!s->csc2) return AVERROR(ENOMEM); -if (ff_rdft_init(&s->rdft, nbits, inverse == DCT_III) < 0) { +if ((ret = ff_rdft_init(&s->rdft, nbits, inverse == DCT_III)) < 0) { av_freep(&s->csc2); -return -1; +return ret; } for (i = 0; i < n / 2; i++) -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 14/16] avcodec/dcaenc: Return specific error code from subband_bufer_alloc()
Signed-off-by: Michael Niedermayer --- libavcodec/dcaenc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/dcaenc.c b/libavcodec/dcaenc.c index 4b4ceeff05..34b3e94165 100644 --- a/libavcodec/dcaenc.c +++ b/libavcodec/dcaenc.c @@ -136,7 +136,7 @@ static int subband_bufer_alloc(DCAEncContext *c) (SUBBAND_SAMPLES + DCA_ADPCM_COEFFS), sizeof(int32_t)); if (!bufer) -return -1; +return AVERROR(ENOMEM); /* we need a place for DCA_ADPCM_COEFF samples from previous frame * to calc prediction coefficients for each subband */ @@ -166,8 +166,8 @@ static int encode_init(AVCodecContext *avctx) int i, j, k, min_frame_bits; int ret; -if (subband_bufer_alloc(c)) -return AVERROR(ENOMEM); +if ((ret = subband_bufer_alloc(c)) < 0) +return ret; c->fullband_channels = c->channels = avctx->channels; c->lfe_channel = (avctx->channels == 3 || avctx->channels == 6); -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 06/16] avcodec/asvenc: Replace bitstream space check by assert
This should never be untrue, if it is, thats a bug Signed-off-by: Michael Niedermayer --- libavcodec/asvenc.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/libavcodec/asvenc.c b/libavcodec/asvenc.c index c4eca2a13d..3cc94bf91a 100644 --- a/libavcodec/asvenc.c +++ b/libavcodec/asvenc.c @@ -173,10 +173,7 @@ static inline int encode_mb(ASV1Context *a, int16_t block[6][64]) { int i; -if (a->pb.buf_end - a->pb.buf - (put_bits_count(&a->pb) >> 3) < MAX_MB_SIZE) { -av_log(a->avctx, AV_LOG_ERROR, "encoded frame too large\n"); -return -1; -} +av_assert0(a->pb.buf_end - a->pb.buf - (put_bits_count(&a->pb) >> 3) >= MAX_MB_SIZE); if (a->avctx->codec_id == AV_CODEC_ID_ASV1) { for (i = 0; i < 6; i++) -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 12/16] avcodec/binkaudio: Use assert instead of return for use of compile time disabled codecs
Signed-off-by: Michael Niedermayer --- libavcodec/binkaudio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c index e0f3d14eef..96cf968c66 100644 --- a/libavcodec/binkaudio.c +++ b/libavcodec/binkaudio.c @@ -139,7 +139,7 @@ static av_cold int decode_init(AVCodecContext *avctx) else if (CONFIG_BINKAUDIO_DCT_DECODER) ff_dct_init(&s->trans.dct, frame_len_bits, DCT_III); else -return -1; +av_assert0(0); s->pkt = av_packet_alloc(); if (!s->pkt) -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 08/16] avcodec/ac3enc: Use specific error code in validate_float_option()
Signed-off-by: Michael Niedermayer --- libavcodec/ac3enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index 636ca72050..e7e18af92d 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -1800,7 +1800,7 @@ static int validate_float_option(float v, const float *v_list, int v_list_size) break; } if (i == v_list_size) -return -1; +return AVERROR(EINVAL); return i; } -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 03/16] avcodec/aacps: Return more specific error codes.
Signed-off-by: Michael Niedermayer --- libavcodec/aacps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/aacps.c b/libavcodec/aacps.c index b16c3393d1..d5dca64b0f 100644 --- a/libavcodec/aacps.c +++ b/libavcodec/aacps.c @@ -118,7 +118,7 @@ static int read_ ## PAR ## _data(AVCodecContext *avctx, GetBitContext *gb, PSCon return 0; \ err: \ av_log(avctx, AV_LOG_ERROR, "illegal "#PAR"\n"); \ -return -1; \ +return AVERROR_INVALIDDATA; \ } READ_PAR_DATA(iid,huff_offset[table_idx],0, FFABS(ps->iid_par[e][b]) > 7 + 8 * ps->iid_quant) -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 02/16] swscale/yuv2rgb: Return a more specific error code from ff_yuv2rgb_c_init_tables()
Signed-off-by: Michael Niedermayer --- libswscale/yuv2rgb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c index 737cbb06c8..d0df061e4d 100644 --- a/libswscale/yuv2rgb.c +++ b/libswscale/yuv2rgb.c @@ -993,7 +993,7 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], default: if(!isPlanar(c->dstFormat) || bpp <= 24) av_log(c, AV_LOG_ERROR, "%ibpp not supported by yuv2rgb\n", bpp); -return -1; +return AVERROR(EINVAL); } return 0; } -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 16/16] avcodec/eacmv: Return more specific error codes and forward error codes
Signed-off-by: Michael Niedermayer --- libavcodec/eacmv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/eacmv.c b/libavcodec/eacmv.c index bf4404ce42..6f39d72b88 100644 --- a/libavcodec/eacmv.c +++ b/libavcodec/eacmv.c @@ -191,12 +191,12 @@ static int cmv_decode_frame(AVCodecContext *avctx, if (ret < 0) return ret; if (size > buf_end - buf - EA_PREAMBLE_SIZE) -return -1; +return AVERROR_INVALIDDATA; buf += size; } -if (av_image_check_size(s->width, s->height, 0, s->avctx)) -return -1; +if ((ret = av_image_check_size(s->width, s->height, 0, s->avctx)) < 0) +return ret; if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) return ret; -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 15/16] avcodec/eatqi: Return more specific error code from tqi_decode_mb()
Signed-off-by: Michael Niedermayer --- libavcodec/eatqi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/eatqi.c b/libavcodec/eatqi.c index 1a847a35da..0002d45457 100644 --- a/libavcodec/eatqi.c +++ b/libavcodec/eatqi.c @@ -83,7 +83,7 @@ static int tqi_decode_mb(TqiContext *t, int16_t (*block)[64]) if (ret < 0) { av_log(t->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", t->mb_x, t->mb_y); -return -1; +return ret; } } -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 05/16] avcodec/avpacket: Avoid unspecific return -1 for av_grow_packet()
Signed-off-by: Michael Niedermayer --- libavcodec/avpacket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index e160ad3033..11ac4e80cd 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -112,7 +112,7 @@ int av_grow_packet(AVPacket *pkt, int grow_by) av_assert0((unsigned)pkt->size <= INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE); if ((unsigned)grow_by > INT_MAX - (pkt->size + AV_INPUT_BUFFER_PADDING_SIZE)) -return -1; +return AVERROR(ENOMEM); new_size = pkt->size + grow_by + AV_INPUT_BUFFER_PADDING_SIZE; if (pkt->buf) { @@ -124,7 +124,7 @@ int av_grow_packet(AVPacket *pkt, int grow_by) } else { data_offset = pkt->data - pkt->buf->data; if (data_offset > INT_MAX - new_size) -return -1; +return AVERROR(ENOMEM); } if (new_size + data_offset > pkt->buf->size) { -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 01/16] avcodec/4xm: Fix returned error codes
Signed-off-by: Michael Niedermayer --- libavcodec/4xm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c index 7440dccf1f..2b88c899d0 100644 --- a/libavcodec/4xm.c +++ b/libavcodec/4xm.c @@ -498,7 +498,7 @@ static int decode_i_block(FourXContext *f, int16_t *block) if (get_bits_left(&f->gb) < 2){ av_log(f->avctx, AV_LOG_ERROR, "%d bits left before decode_i_block()\n", get_bits_left(&f->gb)); -return -1; +return AVERROR_INVALIDDATA; } /* DC coef */ @@ -732,7 +732,7 @@ static int decode_i2_frame(FourXContext *f, const uint8_t *buf, int length) for (x = 0; x < width; x += 16) { unsigned int color[4] = { 0 }, bits; if (buf_end - buf < 8) -return -1; +return AVERROR_INVALIDDATA; // warning following is purely guessed ... color[0] = bytestream2_get_le16u(&g3); color[1] = bytestream2_get_le16u(&g3); -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 04/16] avcodec/bitstream: Return specific error codes when building vlc tables
Signed-off-by: Michael Niedermayer --- libavcodec/bitstream.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c index ed528fe4af..8762e5f4b2 100644 --- a/libavcodec/bitstream.c +++ b/libavcodec/bitstream.c @@ -164,7 +164,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes, table_size = 1 << table_nb_bits; if (table_nb_bits > 30) - return -1; + return AVERROR(EINVAL); table_index = alloc_table(vlc, table_size, flags & INIT_VLC_USE_NEW_STATIC); ff_dlog(NULL, "new table index=%d size=%d\n", table_index, table_size); if (table_index < 0) @@ -306,7 +306,7 @@ int ff_init_vlc_sparse(VLC *vlc_arg, int nb_bits, int nb_codes, av_log(NULL, AV_LOG_ERROR, "Too long VLC (%d) in init_vlc\n", buf[j].bits);\ if (!(flags & INIT_VLC_USE_NEW_STATIC)) \ av_free(buf); \ -return -1; \ +return AVERROR(EINVAL); \ } \ GET_DATA(buf[j].code, codes, i, codes_wrap, codes_size);\ if (buf[j].code >= (1LL
[FFmpeg-devel] [PATCH 09/16] libavcodec/ac3dec.c: Avoid unspecific -1 error code
Signed-off-by: Michael Niedermayer --- libavcodec/ac3dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index 71419458fa..ba731314b4 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -452,7 +452,7 @@ static int decode_exponents(AC3DecodeContext *s, prevexp += dexp[i] - 2; if (prevexp > 24U) { av_log(s->avctx, AV_LOG_ERROR, "exponent %d is out-of-range\n", prevexp); -return -1; +return AVERROR_INVALIDDATA; } switch (group_size) { case 4: dexps[j++] = prevexp; -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 07/16] avcodec/assenc: Return more specific error codes for ass_encode_frame()
Signed-off-by: Michael Niedermayer --- libavcodec/assenc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/assenc.c b/libavcodec/assenc.c index dc4f0ffa97..e54c1d8ec3 100644 --- a/libavcodec/assenc.c +++ b/libavcodec/assenc.c @@ -57,7 +57,7 @@ static int ass_encode_frame(AVCodecContext *avctx, if (sub->rects[i]->type != SUBTITLE_ASS) { av_log(avctx, AV_LOG_ERROR, "Only SUBTITLE_ASS type supported.\n"); -return -1; +return AVERROR(EINVAL); } #if FF_API_ASS_TIMING @@ -93,7 +93,7 @@ static int ass_encode_frame(AVCodecContext *avctx, if (len > bufsize-total_len-1) { av_log(avctx, AV_LOG_ERROR, "Buffer too small for ASS event.\n"); -return -1; +return AVERROR(EINVAL); } total_len += len; -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avcodec/prores_ks reduce twice fdct calls
fdct done twice for each block. first time during quant calculation, second during slice encoding. so if we pre-save dct coefficients no need to do fdct second time. disadvantages: requires more memory advantages: improves performance ~4-5% --- libavcodec/proresenc_kostya.c | 74 --- 1 file changed, 52 insertions(+), 22 deletions(-) diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c index e045a972f1..d2f81e73f4 100644 --- a/libavcodec/proresenc_kostya.c +++ b/libavcodec/proresenc_kostya.c @@ -219,7 +219,6 @@ struct TrellisNode { #define MAX_STORED_Q 16 typedef struct ProresThreadData { -DECLARE_ALIGNED(16, int16_t, blocks)[MAX_PLANES][64 * 4 * MAX_MBS_PER_SLICE]; DECLARE_ALIGNED(16, uint16_t, emu_buf)[16 * 16]; int16_t custom_q[64]; int16_t custom_chroma_q[64]; @@ -228,7 +227,6 @@ typedef struct ProresThreadData { typedef struct ProresContext { AVClass *class; -DECLARE_ALIGNED(16, int16_t, blocks)[MAX_PLANES][64 * 4 * MAX_MBS_PER_SLICE]; DECLARE_ALIGNED(16, uint16_t, emu_buf)[16*16]; int16_t quants[MAX_STORED_Q][64]; int16_t quants_chroma[MAX_STORED_Q][64]; @@ -237,6 +235,7 @@ typedef struct ProresContext { const uint8_t *quant_mat; const uint8_t *quant_chroma_mat; const uint8_t *scantable; +int16_t *blocks[MAX_PLANES]; void (*fdct)(FDCTDSPContext *fdsp, const uint16_t *src, ptrdiff_t linesize, int16_t *block); @@ -562,6 +561,8 @@ static int encode_slice(AVCodecContext *avctx, const AVFrame *pic, int plane_factor, is_chroma; uint16_t *qmat; uint16_t *qmat_chroma; +int16_t *blocks; +DECLARE_ALIGNED(16, int16_t, dct_blocks)[16 * 16 * MAX_MBS_PER_SLICE]; if (ctx->pictures_per_frame == 1) line_add = 0; @@ -604,28 +605,38 @@ static int encode_slice(AVCodecContext *avctx, const AVFrame *pic, src = (const uint16_t*)(pic->data[i] + yp * linesize + line_add * pic->linesize[i]) + xp; +if (!ctx->force_quant) { +blocks = ctx->blocks[i] + (y * ctx->slices_width * ctx->mbs_per_slice + x) * 16 * 16; +} else { +blocks = dct_blocks; +} + if (i < 3) { -get_slice_data(ctx, src, linesize, xp, yp, - pwidth, avctx->height / ctx->pictures_per_frame, - ctx->blocks[0], ctx->emu_buf, - mbs_per_slice, num_cblocks, is_chroma); +if (ctx->force_quant) { +get_slice_data(ctx, src, linesize, xp, yp, + pwidth, avctx->height / ctx->pictures_per_frame, + blocks, ctx->emu_buf, + mbs_per_slice, num_cblocks, is_chroma); +} if (!is_chroma) {/* luma quant */ sizes[i] = encode_slice_plane(ctx, pb, src, linesize, - mbs_per_slice, ctx->blocks[0], + mbs_per_slice, blocks, num_cblocks, plane_factor, qmat); } else { /* chroma plane */ sizes[i] = encode_slice_plane(ctx, pb, src, linesize, - mbs_per_slice, ctx->blocks[0], + mbs_per_slice, blocks, num_cblocks, plane_factor, qmat_chroma); } } else { -get_alpha_data(ctx, src, linesize, xp, yp, - pwidth, avctx->height / ctx->pictures_per_frame, - ctx->blocks[0], mbs_per_slice, ctx->alpha_bits); +if (ctx->force_quant) { +get_alpha_data(ctx, src, linesize, xp, yp, + pwidth, avctx->height / ctx->pictures_per_frame, + blocks, mbs_per_slice, ctx->alpha_bits); +} sizes[i] = encode_alpha_plane(ctx, pb, mbs_per_slice, - ctx->blocks[0], quant); + blocks, quant); } total_size += sizes[i]; if (put_bits_left(pb) < 0) { @@ -730,15 +741,15 @@ static int estimate_slice_plane(ProresContext *ctx, int *error, int plane, const uint16_t *src, ptrdiff_t linesize, int mbs_per_slice, int blocks_per_mb, int plane_size_factor, -const int16_t *qmat, ProresThreadData *td) +const int16_t *qmat, int16_t *blocks) { int blocks_per_slice; int bits; blocks_per_slice = mbs_per_slice * blocks_per_mb; -bits = estimate_dcs(error
Re: [FFmpeg-devel] [PATCH] avcodec/prores_ks reduce twice fdct calls
thanks, just sent new patch On Mon, Dec 31, 2018 at 5:56 PM Derek Buitenhuis wrote: > On 31/12/2018 09:12, Alex Mogurenko wrote: > > I seems to be lame as failed to find how to run fate to check prores_ks > :( > > General way to run all of FATE: > > $ configure --samples=/home/path/for/samples/ --enable-gpl [...] > $ make fate-rsync > $ make fate > > There are sub-targets, too, as listed in Michaels mail, like fate-vsynth1. > > - Derek > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 05/11] avfilter/af_biquads: minor simplification by using ff_exp10()
Signed-off-by: Michael Niedermayer --- libavfilter/af_biquads.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavfilter/af_biquads.c b/libavfilter/af_biquads.c index ae5e1c6ade..86cd10df3b 100644 --- a/libavfilter/af_biquads.c +++ b/libavfilter/af_biquads.c @@ -63,6 +63,7 @@ */ #include "libavutil/avassert.h" +#include "libavutil/ffmath.h" #include "libavutil/opt.h" #include "audio.h" #include "avfilter.h" @@ -245,7 +246,7 @@ static int config_filter(AVFilterLink *outlink, int reset) AVFilterContext *ctx= outlink->src; BiquadsContext *s = ctx->priv; AVFilterLink *inlink= ctx->inputs[0]; -double A = exp(s->gain / 40 * log(10.)); +double A = ff_exp10(s->gain / 40); double w0 = 2 * M_PI * s->frequency / inlink->sample_rate; double alpha, beta; -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 01/11] doc/indevs: fix upto typo
Signed-off-by: Michael Niedermayer --- doc/indevs.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/indevs.texi b/doc/indevs.texi index 294ffa137c..af3173217f 100644 --- a/doc/indevs.texi +++ b/doc/indevs.texi @@ -374,7 +374,7 @@ Defaults to @option{false}. @item timestamp_align Capture start time alignment in seconds. If set to nonzero, input frames are dropped till the system timestamp aligns with configured value. -Alignment difference of upto one frame duration is tolerated. +Alignment difference of up to one frame duration is tolerated. This is useful for maintaining input synchronization across N different hardware devices deployed for 'N-way' redundancy. The system time of different hardware devices should be synchronized with protocols such as NTP or PTP, -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 03/11] avfilter/ebur128: Simplify by using log10()
Signed-off-by: Michael Niedermayer --- libavfilter/ebur128.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/ebur128.c b/libavfilter/ebur128.c index e11008078d..c8986fb5e1 100644 --- a/libavfilter/ebur128.c +++ b/libavfilter/ebur128.c @@ -368,7 +368,7 @@ EBUR128_FILTER(double, 1.0) static double ebur128_energy_to_loudness(double energy) { -return 10 * (log(energy) / log(10.0)) - 0.691; +return 10 * log10(energy) - 0.691; } static size_t find_histogram_index(double energy) -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 09/11] avcodec/mss2: Provide non NULL context to av_log()
Signed-off-by: Michael Niedermayer --- libavcodec/mss2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c index 3180af1d60..2eb366ee78 100644 --- a/libavcodec/mss2.c +++ b/libavcodec/mss2.c @@ -174,7 +174,7 @@ static int decode_pal_v2(MSS12Context *ctx, const uint8_t *buf, int buf_size) return 1 + ncol * 3; } -static int decode_555(GetByteContext *gB, uint16_t *dst, ptrdiff_t stride, +static int decode_555(AVCodecContext *avctx, GetByteContext *gB, uint16_t *dst, ptrdiff_t stride, int keyframe, int w, int h) { int last_symbol = 0, repeat = 0, prev_avail = 0; @@ -212,7 +212,7 @@ static int decode_555(GetByteContext *gB, uint16_t *dst, ptrdiff_t stride, repeat = 0; while (b-- > 130) { if (repeat >= (INT_MAX >> 8) - 1) { -av_log(NULL, AV_LOG_ERROR, "repeat overflow\n"); +av_log(avctx, AV_LOG_ERROR, "repeat overflow\n"); return AVERROR_INVALIDDATA; } repeat = (repeat << 8) + bytestream2_get_byte(gB) + 1; @@ -634,7 +634,7 @@ static int mss2_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, if (is_555) { bytestream2_init(&gB, buf, buf_size); -if (decode_555(&gB, (uint16_t *)c->rgb_pic, c->rgb_stride >> 1, +if (decode_555(avctx, &gB, (uint16_t *)c->rgb_pic, c->rgb_stride >> 1, keyframe, avctx->width, avctx->height)) return AVERROR_INVALIDDATA; -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 07/11] avcodec/aacdec_fixed: Provide context to av_log()
Signed-off-by: Michael Niedermayer --- libavcodec/aac.h | 2 +- libavcodec/aacdec_fixed.c| 4 ++-- libavcodec/aacdec_template.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/aac.h b/libavcodec/aac.h index 05bc95385f..c2b9c980cb 100644 --- a/libavcodec/aac.h +++ b/libavcodec/aac.h @@ -368,7 +368,7 @@ struct AACContext { INTFLOAT *in, IndividualChannelStream *ics); void (*update_ltp)(AACContext *ac, SingleChannelElement *sce); void (*vector_pow43)(int *coefs, int len); -void (*subband_scale)(int *dst, int *src, int scale, int offset, int len); +void (*subband_scale)(int *dst, int *src, int scale, int offset, int len, void *log_context); }; diff --git a/libavcodec/aacdec_fixed.c b/libavcodec/aacdec_fixed.c index 1bdb93f5bc..2c594c6792 100644 --- a/libavcodec/aacdec_fixed.c +++ b/libavcodec/aacdec_fixed.c @@ -162,7 +162,7 @@ static void vector_pow43(int *coefs, int len) } } -static void subband_scale(int *dst, int *src, int scale, int offset, int len) +static void subband_scale(int *dst, int *src, int scale, int offset, int len, void *log_context) { int ssign = scale < 0 ? -1 : 1; int s = FFABS(scale); @@ -189,7 +189,7 @@ static void subband_scale(int *dst, int *src, int scale, int offset, int len) dst[i] = out * (unsigned)ssign; } } else { -av_log(NULL, AV_LOG_ERROR, "Overflow in subband_scale()\n"); +av_log(log_context, AV_LOG_ERROR, "Overflow in subband_scale()\n"); } } diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index dce6035d67..721511c5e9 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -1927,7 +1927,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, INTFLOAT coef[1024], if (cbt_m1 < NOISE_BT - 1) { for (group = 0; group < (int)g_len; group++, cfo+=128) { ac->vector_pow43(cfo, off_len); -ac->subband_scale(cfo, cfo, sf[idx], 34, off_len); +ac->subband_scale(cfo, cfo, sf[idx], 34, off_len, ac->avctx); } } } @@ -2158,7 +2158,7 @@ static void apply_intensity_stereo(AACContext *ac, coef0 + group * 128 + offsets[i], scale, 23, - offsets[i + 1] - offsets[i]); + offsets[i + 1] - offsets[i] ,ac->avctx); #else ac->fdsp->vector_fmul_scalar(coef1 + group * 128 + offsets[i], coef0 + group * 128 + offsets[i], -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 06/11] avcodec/acelp_pitch_delay: Minor simplification by using ff_exp10()
Signed-off-by: Michael Niedermayer --- libavcodec/acelp_pitch_delay.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/acelp_pitch_delay.c b/libavcodec/acelp_pitch_delay.c index c345a99c81..a070d1b25d 100644 --- a/libavcodec/acelp_pitch_delay.c +++ b/libavcodec/acelp_pitch_delay.c @@ -118,7 +118,7 @@ int16_t ff_acelp_decode_gain_code( (mr_energy >> 15) - 25 ); #else -mr_energy = gain_corr_factor * exp(M_LN10 / (20 << 23) * mr_energy) / +mr_energy = gain_corr_factor * ff_exp10((double)mr_energy / (20 << 23)) / sqrt(adsp->scalarproduct_int16(fc_v, fc_v, subframe_size)); return mr_energy >> 12; #endif -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 08/11] avcodec/imc: Provide non NULL context to av_log()
Signed-off-by: Michael Niedermayer --- libavcodec/imc.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavcodec/imc.c b/libavcodec/imc.c index 7cd6db930b..82a908160a 100644 --- a/libavcodec/imc.c +++ b/libavcodec/imc.c @@ -104,6 +104,8 @@ typedef struct IMCContext { int8_t cyclTab[32], cyclTab2[32]; float weights1[31], weights2[31]; + +AVCodecContext *avctx; } IMCContext; static VLC huffman_vlc[4][4]; @@ -466,7 +468,7 @@ static int bit_allocation(IMCContext *q, IMCChannel *chctx, for (i = 0; i < BANDS - 1; i++) { if (chctx->flcoeffs5[i] <= 0) { -av_log(NULL, AV_LOG_ERROR, "flcoeffs5 %f invalid\n", chctx->flcoeffs5[i]); +av_log(q->avctx, AV_LOG_ERROR, "flcoeffs5 %f invalid\n", chctx->flcoeffs5[i]); return AVERROR_INVALIDDATA; } chctx->flcoeffs4[i] = chctx->flcoeffs3[i] - log2f(chctx->flcoeffs5[i]); @@ -1022,6 +1024,8 @@ static int imc_decode_frame(AVCodecContext *avctx, void *data, LOCAL_ALIGNED_16(uint16_t, buf16, [(IMC_BLOCK_SIZE + AV_INPUT_BUFFER_PADDING_SIZE) / 2]); +q->avctx = avctx; + if (buf_size < IMC_BLOCK_SIZE * avctx->channels) { av_log(avctx, AV_LOG_ERROR, "frame too small!\n"); return AVERROR_INVALIDDATA; -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 02/11] avfilter/vf_tonemap_opencl: Make static tables const
Signed-off-by: Michael Niedermayer --- libavfilter/vf_tonemap_opencl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_tonemap_opencl.c b/libavfilter/vf_tonemap_opencl.c index cd293c2522..ae3f98d817 100644 --- a/libavfilter/vf_tonemap_opencl.c +++ b/libavfilter/vf_tonemap_opencl.c @@ -98,12 +98,12 @@ static const struct LumaCoefficients luma_coefficients[AVCOL_SPC_NB] = { [AVCOL_SPC_BT2020_NCL] = { 0.2627, 0.6780, 0.0593 }, }; -static struct PrimaryCoefficients primaries_table[AVCOL_PRI_NB] = { +static const struct PrimaryCoefficients primaries_table[AVCOL_PRI_NB] = { [AVCOL_PRI_BT709] = { 0.640, 0.330, 0.300, 0.600, 0.150, 0.060 }, [AVCOL_PRI_BT2020] = { 0.708, 0.292, 0.170, 0.797, 0.131, 0.046 }, }; -static struct WhitepointCoefficients whitepoint_table[AVCOL_PRI_NB] = { +static const struct WhitepointCoefficients whitepoint_table[AVCOL_PRI_NB] = { [AVCOL_PRI_BT709] = { 0.3127, 0.3290 }, [AVCOL_PRI_BT2020] = { 0.3127, 0.3290 }, }; -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 10/11] avcodec/bink: Provide non NULL context to av_log()
Signed-off-by: Michael Niedermayer --- libavcodec/bink.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libavcodec/bink.c b/libavcodec/bink.c index 9c17dedcba..6673afa789 100644 --- a/libavcodec/bink.c +++ b/libavcodec/bink.c @@ -609,7 +609,7 @@ static inline int binkb_get_value(BinkContext *c, int bundle_num) * @param quant_matrices quantization matrices * @return 0 for success, negative value in other cases */ -static int read_dct_coeffs(GetBitContext *gb, int32_t block[64], +static int read_dct_coeffs(BinkContext *c, GetBitContext *gb, int32_t block[64], const uint8_t *scan, int *coef_count_, int coef_idx[64], int q) { @@ -692,7 +692,7 @@ static int read_dct_coeffs(GetBitContext *gb, int32_t block[64], } else { quant_idx = q; if (quant_idx > 15U) { -av_log(NULL, AV_LOG_ERROR, "quant_index %d out of range\n", quant_idx); +av_log(c->avctx, AV_LOG_ERROR, "quant_index %d out of range\n", quant_idx); return AVERROR_INVALIDDATA; } } @@ -885,7 +885,7 @@ static int binkb_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb, memset(dctblock, 0, sizeof(*dctblock) * 64); dctblock[0] = binkb_get_value(c, BINKB_SRC_INTRA_DC); qp = binkb_get_value(c, BINKB_SRC_INTRA_Q); -if ((quant_idx = read_dct_coeffs(gb, dctblock, bink_scan, &coef_count, coef_idx, qp)) < 0) +if ((quant_idx = read_dct_coeffs(c, gb, dctblock, bink_scan, &coef_count, coef_idx, qp)) < 0) return quant_idx; unquantize_dct_coeffs(dctblock, binkb_intra_quant[quant_idx], coef_count, coef_idx, bink_scan); c->binkdsp.idct_put(dst, stride, dctblock); @@ -920,7 +920,7 @@ static int binkb_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb, memset(dctblock, 0, sizeof(*dctblock) * 64); dctblock[0] = binkb_get_value(c, BINKB_SRC_INTER_DC); qp = binkb_get_value(c, BINKB_SRC_INTER_Q); -if ((quant_idx = read_dct_coeffs(gb, dctblock, bink_scan, &coef_count, coef_idx, qp)) < 0) +if ((quant_idx = read_dct_coeffs(c, gb, dctblock, bink_scan, &coef_count, coef_idx, qp)) < 0) return quant_idx; unquantize_dct_coeffs(dctblock, binkb_inter_quant[quant_idx], coef_count, coef_idx, bink_scan); c->binkdsp.idct_add(dst, stride, dctblock); @@ -1093,7 +1093,7 @@ static int bink_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb, case INTRA_BLOCK: memset(dctblock, 0, sizeof(*dctblock) * 64); dctblock[0] = get_value(c, BINK_SRC_INTRA_DC); -if ((quant_idx = read_dct_coeffs(gb, dctblock, bink_scan, &coef_count, coef_idx, -1)) < 0) +if ((quant_idx = read_dct_coeffs(c, gb, dctblock, bink_scan, &coef_count, coef_idx, -1)) < 0) return quant_idx; unquantize_dct_coeffs(dctblock, bink_intra_quant[quant_idx], coef_count, coef_idx, bink_scan); c->binkdsp.idct_put(ublock, 8, dctblock); @@ -1168,7 +1168,7 @@ static int bink_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb, case INTRA_BLOCK: memset(dctblock, 0, sizeof(*dctblock) * 64); dctblock[0] = get_value(c, BINK_SRC_INTRA_DC); -if ((quant_idx = read_dct_coeffs(gb, dctblock, bink_scan, &coef_count, coef_idx, -1)) < 0) +if ((quant_idx = read_dct_coeffs(c, gb, dctblock, bink_scan, &coef_count, coef_idx, -1)) < 0) return quant_idx; unquantize_dct_coeffs(dctblock, bink_intra_quant[quant_idx], coef_count, coef_idx, bink_scan); c->binkdsp.idct_put(dst, stride, dctblock); @@ -1184,7 +1184,7 @@ static int bink_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb, return ret; memset(dctblock, 0, sizeof(*dctblock) * 64); dctblock[0] = get_value(c, BINK_SRC_INTER_DC); -if ((quant_idx = read_dct_coeffs(gb, dctblock, bink_scan, &coef_count, coef_idx, -1)) < 0) +if ((quant_idx = read_dct_coeffs(c, gb, dctblock, bink_scan, &coef_count, coef_idx, -1)) < 0) return quant_idx; unquantize_dct_coeffs(dctblock, bink_inter_quant[quant_idx], coef_count, coef_idx, bink_scan); c->binkdsp.idct_add(dst, stride, dctblock); -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 11/11] avcodec/bfi: Provide non NULL context to av_log()
Signed-off-by: Michael Niedermayer --- libavcodec/bfi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/bfi.c b/libavcodec/bfi.c index 233a1d27a8..a4cb002053 100644 --- a/libavcodec/bfi.c +++ b/libavcodec/bfi.c @@ -71,7 +71,7 @@ static int bfi_decode_frame(AVCodecContext *avctx, void *data, frame->key_frame = 1; /* Setting the palette */ if (avctx->extradata_size > 768) { -av_log(NULL, AV_LOG_ERROR, "Palette is too large.\n"); +av_log(avctx, AV_LOG_ERROR, "Palette is too large.\n"); return AVERROR_INVALIDDATA; } pal = (uint32_t *)frame->data[1]; -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 04/11] avfilter/af_crossfeed: Use ff_exp10()
Signed-off-by: Michael Niedermayer --- libavfilter/af_crossfeed.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavfilter/af_crossfeed.c b/libavfilter/af_crossfeed.c index a0af280432..beee67964d 100644 --- a/libavfilter/af_crossfeed.c +++ b/libavfilter/af_crossfeed.c @@ -17,6 +17,7 @@ */ #include "libavutil/channel_layout.h" +#include "libavutil/ffmath.h" #include "libavutil/opt.h" #include "avfilter.h" #include "audio.h" @@ -57,7 +58,7 @@ static int config_input(AVFilterLink *inlink) { AVFilterContext *ctx = inlink->dst; CrossfeedContext *s = ctx->priv; -double A = exp(s->strength * -30 / 40 * log(10.)); +double A = ff_exp10(s->strength * -30 / 40); double w0 = 2 * M_PI * (1. - s->range) * 2100 / inlink->sample_rate; double alpha; -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] avcodec/rangecoder: Add and test ff_rac_check_termination()
On Mon, Dec 31, 2018 at 02:50:26PM -0300, James Almer wrote: > On 12/31/2018 1:40 PM, Michael Niedermayer wrote: > > On Sun, Dec 23, 2018 at 07:24:49PM +0100, Michael Niedermayer wrote: > >> Signed-off-by: Michael Niedermayer > >> --- > >> libavcodec/rangecoder.c | 19 +++ > >> libavcodec/rangecoder.h | 9 + > >> libavcodec/tests/rangecoder.c | 7 +-- > >> 3 files changed, 33 insertions(+), 2 deletions(-) > > > > will apply > > Is this function called from a hot loop? If so, it may be worth making > it inline instead, seeing how the version argument in the only cases > it's used is a constant. its only called per slice, so call overhead / an extra if() should not matter [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB It is what and why we do it that matters, not just one of them. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] Can you implement OPENCL or CUDA support option for motion estimation in NVENC HEVC and AVC?
Hello FFMPEG developers! I asked Nvidia forum about that topic. What do you think about it? What is your own opinion about this idea? The content of the post: https://devtalk.nvidia.com/default/topic/1045756/can-you-implement-opencl-or-cuda-support-option-for-motion-estimation-in-nvenc-hevc-and-avc-/ "Hello Nvidia codec developers! The X264 codec developers had a great idea, when they gave an option for OPENCL motion estimation in their codec. I know that you can use for example: CUDA for weighted prediction in the NVENC. So it means that you can creatively use the various parts of the GPU in cooperative way. "When OPENCL is enabled, lookahead thread is mostly off-loaded to your OpenCL capable GPU device. Lowres intra cost prediction, lowres motion search (including subpel) and bidir cost predictions are all done on the GPU. " You can add motion perdiction too. However it went trough the CPU and caused bottleneck. However you can avoild this in such way, that all of that computings go trough in the videocard only. You can use OPENCL or CUDA acceleration for these stuff, it could greatly improve the quality of the best compression modes. Motion estimation modes: 1. dia, 2. hex, 3. UMH, 4. star, 5. sea, 6. full Sub pixel precision: 1 half pixel only. 2. half and quarter pixel, 3. 2X half + 1X quartel pixel, 4. 2X(SATD half) + 1Xquarter pixel 5. 2X(SATD half) + 2Xquarter pixel, 6. (SATD half)+ and quarter pixel deep 7. 2X(SATD half)+ quarter pixel deep 8. 2X(SATD half) 2X quarter pixel deep MAx pixel search range option for temporar motion perdiction How can it look in command prompt? OP = accelerated OPENCL or Cu= if you choose Cuda Opencl Motion estimation mode =opmem Opencl Sub pixel precision = opspp OpenCL Max pixel search range = opmpsr An example if you want to implement OPENCL: -opmem 4 -opspp 6 -opmpsr 57 An example if you want to implement rather the CUDA : -cumem 4 -cuspp 6 -cumpsr 57 Of course it would be part of quality encoding, so it wouldn't matter if it is not enough fast for 4K live streaming etc. It would be only *an option/extension for people who like the better quality encoding* like transcoding blu-ray or compressing own video files on the computer. So even the lack of very ultrafast speed encoding is not a huge propblem. Those who care about speed (live streaming of high res video) don't use such options. I think the Opencl or Cuda motion estimation can be enough fast even for high resolution videos too, and more importantly it can make* a much better quality motion prediction/estimation* than the motion estimation / prediction technology of the NVENC fixed HW unit! So OPENCL and CUDA support for NVENC HW encoding would be a great leap in video quality!" Thank you for your reply! Best regards! ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] introduce new AVPacket (or modify the existing pkt->data) while muxing
Hello, I am trying to create and push packet in the muxer but new packet is not reflected at all after packaging. Pipeline looks like below, [image: image.png] While doing this, I am loosing existing packet also. Can you please help me by pointing some of example codes? is there any restrictions with the DATA type? similarly I was able to change VIDEO type, the pkt->data in the hls context. If introduction of new AVPacket does not exist, can we have this implemented support please? Thank you, -S ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] Improved the performance of 1 decode + N filter graphs and adaptive bitrate.
With new option "-abr_pipeline" It enabled multiple filter graph concurrency, which bring obvious improvement in some 1:N scenarios by CPU and GPU acceleration Below are some test cases and comparison as reference. (Hardware platform: Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz) (Software: Intel iHD driver - 16.9.00100, CentOS 7) For Intel GPU acceleration case, 1 decode to N scaling, by vaapi: ./ffmpeg -vaapi_device /dev/dri/renderD128 -hwaccel vaapi \ -hwaccel_output_format vaapi \ -i ~/Videos/1920x1080p_30.00_x264_qp28.h264 \ -vf "scale_vaapi=1280:720:format=nv12,hwdownload" \ -pix_fmt nv12 -f null /dev/null \ -vf "scale_vaapi=720:480:format=nv12,hwdownload" \ -pix_fmt nv12 -f null /dev/null \ -abr_pipeline test results: 2 scale 5 scale 10 scale Improved 34%184% 240% For Intel GPU acceleration case, 1 decode to N scaling, by QSV: ./ffmpeg -hwaccel qsv -c:v h264_qsv \ -i ~/Videos/1920x1080p_30.00_x264_qp28.h264 \ -vf "scale_qsv=1280:720:format=nv12,hwdownload" -pix_fmt nv12 -f null /dev/null \ -vf "scale_qsv=720:480:format=nv12,hwdownload" -pix_fmt nv12 -f null /dev/null test results: 2 scale 5 scale 10 scale Improved 12% 21%21% For CPU only 1 decode to N scaling: ./ffmpeg -i ~/Videos/1920x1080p_30.00_x264_qp28.h264 \ -vf "scale=1280:720" -pix_fmt nv12 -f null /dev/null \ -vf "scale=720:480" -pix_fmt nv12 -f null /dev/null \ -abr_pipeline test results: 2 scale 5 scale 10 scale Improved 25%107% 148% For 1:N transcode by GPU acceleration with vaapi: ./ffmpeg -vaapi_device /dev/dri/renderD128 -hwaccel vaapi \ -hwaccel_output_format vaapi \ -i ~/Videos/1920x1080p_30.00_x264_qp28.h264 \ -vf "scale_vaapi=1280:720" -c:v h264_vaapi -f null /dev/null \ -vf "scale_vaapi=720:480" -c:v h264_vaapi -f null /dev/null \ -abr_pipeline test results: 2 encoders 5 encoders 10 encoders Improved 6.1%6.9% 5.5% For 1:N transcode by GPU acceleration with QSV: ./ffmpeg -hwaccel qsv -c:v h264_qsv \ -i ~/Videos/1920x1080p_30.00_x264_qp28.h264 \ -vf "scale_qsv=1280:720:format=nv12" -c:v h264_qsv -f null /dev/null \ -vf "scale_qsv=720:480:format=nv12" -c:v h264_qsv -f null /dev/null test results: 2 encoders 5 encoders 10 encoders Improved 6% 4% 15% Signed-off-by: Wang, Shaofei Reviewed-by: Zhao, Jun --- fftools/ffmpeg.c| 239 +--- fftools/ffmpeg.h| 12 +++ fftools/ffmpeg_filter.c | 6 ++ fftools/ffmpeg_opt.c| 6 +- 4 files changed, 249 insertions(+), 14 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 544f1a1..6131782 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1523,6 +1523,112 @@ static int reap_filters(int flush) return 0; } +static int pipeline_reap_filters(int flush, InputFilter * ifilter) +{ +AVFrame *filtered_frame = NULL; +int i; + +for (i = 0; i < nb_output_streams; i++) { +if (ifilter == output_streams[i]->filter->graph->inputs[0]) break; +} +OutputStream *ost = output_streams[i]; +OutputFile*of = output_files[ost->file_index]; +AVFilterContext *filter; +AVCodecContext *enc = ost->enc_ctx; +int ret = 0; + +if (!ost->filter || !ost->filter->graph->graph) +return 0; +filter = ost->filter->filter; + +if (!ost->initialized) { +char error[1024] = ""; +ret = init_output_stream(ost, error, sizeof(error)); +if (ret < 0) { +av_log(NULL, AV_LOG_ERROR, "Error initializing output stream %d:%d -- %s\n", + ost->file_index, ost->index, error); +exit_program(1); +} +} + +if (!ost->filtered_frame && !(ost->filtered_frame = av_frame_alloc())) { +return AVERROR(ENOMEM); +} +filtered_frame = ost->filtered_frame; + +while (1) { +double float_pts = AV_NOPTS_VALUE; // this is identical to filtered_frame.pts but with higher precision +ret = av_buffersink_get_frame_flags(filter, filtered_frame, + AV_BUFFERSINK_FLAG_NO_REQUEST); +if (ret < 0) { +if (ret != AVERROR(EAGAIN) && ret != AVERROR_EOF) { +av_log(NULL, AV_LOG_WARNING, + "Error in av_buffersink_get_frame_flags(): %s\n", av_err2str(ret)); +} else if (flush && ret == AVERROR_EOF) { +if (av_buffersink_get_type(filter) == AVMEDIA_TYPE_VIDEO) +do_video_out(of, ost, NULL, AV_NOPTS_VALUE); +} +break; +} +if (ost->finished) { +av_frame_unref(filtered_frame); +continue; +} +if (filtered_frame->pts != AV_NOPTS_VALUE) { +int64_t start_time = (of->start_time == AV_NOPTS