[FFmpeg-cvslog] avcodec: add initial exr image encoder
ffmpeg | branch: master | Paul B Mahol | Sun Feb 14 23:11:59 2021 +0100| [67c8c863c70f2989add027ffbe4b87988415] | committer: Paul B Mahol avcodec: add initial exr image encoder > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=67c8c863c70f2989add027ffbe4b87988415 --- Changelog | 1 + configure | 1 + libavcodec/Makefile| 1 + libavcodec/allcodecs.c | 1 + libavcodec/exrenc.c| 481 + libavcodec/version.h | 2 +- libavformat/img2enc.c | 2 +- 7 files changed, 487 insertions(+), 2 deletions(-) diff --git a/Changelog b/Changelog index 6471b35417..ed8f1f448d 100644 --- a/Changelog +++ b/Changelog @@ -74,6 +74,7 @@ version : - monochrome video filter - setts bitstream filter - vif video filter +- OpenEXR image encoder version 4.3: diff --git a/configure b/configure index a76c2ec4ae..336301cb40 100755 --- a/configure +++ b/configure @@ -2716,6 +2716,7 @@ eamad_decoder_select="aandcttables blockdsp bswapdsp idctdsp mpegvideo" eatgq_decoder_select="aandcttables" eatqi_decoder_select="aandcttables blockdsp bswapdsp idctdsp" exr_decoder_deps="zlib" +exr_encoder_deps="zlib" ffv1_decoder_select="rangecoder" ffv1_encoder_select="rangecoder" ffvhuff_decoder_select="huffyuv_decoder" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 3341801b97..dac76f4465 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -321,6 +321,7 @@ OBJS-$(CONFIG_ESCAPE124_DECODER) += escape124.o OBJS-$(CONFIG_ESCAPE130_DECODER) += escape130.o OBJS-$(CONFIG_EVRC_DECODER)+= evrcdec.o acelp_vectors.o lsp.o OBJS-$(CONFIG_EXR_DECODER) += exr.o exrdsp.o +OBJS-$(CONFIG_EXR_ENCODER) += exrenc.o OBJS-$(CONFIG_FASTAUDIO_DECODER) += fastaudio.o OBJS-$(CONFIG_FFV1_DECODER)+= ffv1dec.o ffv1.o OBJS-$(CONFIG_FFV1_ENCODER)+= ffv1enc.o ffv1.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 16ec182a52..cb3f0e7c18 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -109,6 +109,7 @@ extern AVCodec ff_eightsvx_exp_decoder; extern AVCodec ff_eightsvx_fib_decoder; extern AVCodec ff_escape124_decoder; extern AVCodec ff_escape130_decoder; +extern AVCodec ff_exr_encoder; extern AVCodec ff_exr_decoder; extern AVCodec ff_ffv1_encoder; extern AVCodec ff_ffv1_decoder; diff --git a/libavcodec/exrenc.c b/libavcodec/exrenc.c new file mode 100644 index 00..305d44ad2d --- /dev/null +++ b/libavcodec/exrenc.c @@ -0,0 +1,481 @@ +/* + * Copyright (c) 2021 Paul B Mahol + * + * 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 + */ + +/** + * @file + * OpenEXR encoder + */ + +#include +#include + +#include "libavutil/avassert.h" +#include "libavutil/opt.h" +#include "libavutil/intreadwrite.h" +#include "libavutil/imgutils.h" +#include "libavutil/pixdesc.h" +#include "avcodec.h" +#include "bytestream.h" +#include "internal.h" + +enum ExrCompr { +EXR_RAW, +EXR_RLE, +EXR_ZIP1, +EXR_ZIP16, +EXR_NBCOMPR, +}; + +enum ExrPixelType { +EXR_UINT, +EXR_HALF, +EXR_FLOAT, +EXR_UNKNOWN, +}; + +static const char abgr_chlist[4] = { 'A', 'B', 'G', 'R' }; +static const char bgr_chlist[4] = { 'B', 'G', 'R', 'A' }; +static const uint8_t gbra_order[4] = { 3, 1, 0, 2 }; +static const uint8_t gbr_order[4] = { 1, 0, 2, 0 }; + +typedef struct EXRScanlineData { +uint8_t *compressed_data; +unsigned int compressed_size; + +uint8_t *uncompressed_data; +unsigned int uncompressed_size; + +uint8_t *tmp; +unsigned int tmp_size; + +int64_t actual_size; +} EXRScanlineData; + +typedef struct EXRContext { +const AVClass *class; + +int compression; +int planes; +int nb_scanlines; +int scanline_height; +float gamma; +const char *ch_names; +const uint8_t *ch_order; +PutByteContext pb; + +EXRScanlineData *scanline; +} EXRContext; + +static int encode_init(AVCodecContext *avctx) +{ +EXRContext *s = avctx->priv_data; + +switch (avctx->pix_fmt) { +case AV_PIX_FMT_GBRPF32: +s->planes = 3; +s->ch_names = bgr_chlist; +s->ch_order = gbr_order; +break; +case AV_PIX_FMT_GBRAPF32: +s->planes
[FFmpeg-cvslog] lavc/aarch64: port HEVC add_residual NEON
ffmpeg | branch: master | Reimar Döffinger | Sun Jan 10 10:27:00 2021 +| [00c916ef61873cdbd3558e48b03a9d054f0b90f7] | committer: Josh Dekker lavc/aarch64: port HEVC add_residual NEON Speedup is fairly small, around 1.5%, but these are fairly simple. Signed-off-by: Josh Dekker > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=00c916ef61873cdbd3558e48b03a9d054f0b90f7 --- libavcodec/aarch64/hevcdsp_idct_neon.S| 190 ++ libavcodec/aarch64/hevcdsp_init_aarch64.c | 24 2 files changed, 214 insertions(+) diff --git a/libavcodec/aarch64/hevcdsp_idct_neon.S b/libavcodec/aarch64/hevcdsp_idct_neon.S index 992ea5dd06..ef574d243c 100644 --- a/libavcodec/aarch64/hevcdsp_idct_neon.S +++ b/libavcodec/aarch64/hevcdsp_idct_neon.S @@ -36,6 +36,196 @@ const trans, align=4 .short 31, 22, 13, 4 endconst +.macro clip10 in1, in2, c1, c2 +smax\in1, \in1, \c1 +smax\in2, \in2, \c1 +smin\in1, \in1, \c2 +smin\in2, \in2, \c2 +.endm + +function ff_hevc_add_residual_4x4_8_neon, export=1 +ld1 {v0.8h-v1.8h}, [x1] +ld1 {v2.s}[0], [x0], x2 +ld1 {v2.s}[1], [x0], x2 +ld1 {v2.s}[2], [x0], x2 +ld1 {v2.s}[3], [x0], x2 +sub x0, x0, x2, lsl #2 +uxtl v6.8h, v2.8b +uxtl2v7.8h, v2.16b +sqaddv0.8h, v0.8h, v6.8h +sqaddv1.8h, v1.8h, v7.8h +sqxtun v0.8b, v0.8h +sqxtun2 v0.16b, v1.8h +st1 {v0.s}[0], [x0], x2 +st1 {v0.s}[1], [x0], x2 +st1 {v0.s}[2], [x0], x2 +st1 {v0.s}[3], [x0], x2 +ret +endfunc + +function ff_hevc_add_residual_4x4_10_neon, export=1 +mov x12, x0 +ld1 {v0.8h-v1.8h}, [x1] +ld1 {v2.d}[0], [x12], x2 +ld1 {v2.d}[1], [x12], x2 +ld1 {v3.d}[0], [x12], x2 +sqaddv0.8h, v0.8h, v2.8h +ld1 {v3.d}[1], [x12], x2 +movi v4.8h, #0 +sqaddv1.8h, v1.8h, v3.8h +mvni v5.8h, #0xFC, lsl #8 // movi #0x3FF +clip10 v0.8h, v1.8h, v4.8h, v5.8h +st1 {v0.d}[0], [x0], x2 +st1 {v0.d}[1], [x0], x2 +st1 {v1.d}[0], [x0], x2 +st1 {v1.d}[1], [x0], x2 +ret +endfunc + +function ff_hevc_add_residual_8x8_8_neon, export=1 +add x12, x0, x2 +add x2, x2, x2 +mov x3, #8 +1: subs x3, x3, #2 +ld1 {v2.d}[0], [x0] +ld1 {v2.d}[1],[x12] +uxtl v3.8h, v2.8b +ld1 {v0.8h-v1.8h}, [x1], #32 +uxtl2v2.8h, v2.16b +sqaddv0.8h, v0.8h, v3.8h +sqaddv1.8h, v1.8h, v2.8h +sqxtun v0.8b, v0.8h +sqxtun2 v0.16b, v1.8h +st1 {v0.d}[0], [x0], x2 +st1 {v0.d}[1],[x12], x2 +bne 1b +ret +endfunc + +function ff_hevc_add_residual_8x8_10_neon, export=1 +add x12, x0, x2 +add x2, x2, x2 +mov x3, #8 +movi v4.8h, #0 +mvni v5.8h, #0xFC, lsl #8 // movi #0x3FF +1: subs x3, x3, #2 +ld1 {v0.8h-v1.8h}, [x1], #32 +ld1 {v2.8h}, [x0] +sqaddv0.8h, v0.8h, v2.8h +ld1 {v3.8h}, [x12] +sqaddv1.8h, v1.8h, v3.8h +clip10 v0.8h, v1.8h, v4.8h, v5.8h +st1 {v0.8h}, [x0], x2 +st1 {v1.8h}, [x12], x2 +bne 1b +ret +endfunc + +function ff_hevc_add_residual_16x16_8_neon, export=1 +mov x3, #16 +add x12, x0, x2 +add x2, x2, x2 +1: subs x3, x3, #2 +ld1 {v16.16b}, [x0] +ld1 {v0.8h-v3.8h}, [x1], #64 +ld1 {v19.16b},[x12] +uxtlv17.8h, v16.8b +uxtl2 v18.8h, v16.16b +uxtlv20.8h, v19.8b +uxtl2 v21.8h, v19.16b +sqaddv0.8h, v0.8h, v17.8h +sqaddv1.8h, v1.8h, v18.8h +sqaddv2.8h, v2.8h, v20.8h +sqaddv3.8h, v3.8h, v21.8h +sqxtun v0.8b, v0.8h +sqxtun2 v0.16b, v1.8h +sqxtun v1.8b, v2.8h +sqxtun2 v1.16b, v3.8h +st1 {v0.16b}, [x0], x2 +
[FFmpeg-cvslog] lavc/aarch64: add HEVC sao_band NEON
ffmpeg | branch: master | Josh Dekker | Thu Jan 7 11:55:44 2021 +| [7ac41e0db2a03f749f43b69f370461bc6bfee38f] | committer: Josh Dekker lavc/aarch64: add HEVC sao_band NEON Only works for 8x8. Signed-off-by: Josh Dekker > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7ac41e0db2a03f749f43b69f370461bc6bfee38f --- libavcodec/aarch64/Makefile | 3 +- libavcodec/aarch64/hevcdsp_init_aarch64.c | 7 +++ libavcodec/aarch64/hevcdsp_sao_neon.S | 87 +++ 3 files changed, 96 insertions(+), 1 deletion(-) diff --git a/libavcodec/aarch64/Makefile b/libavcodec/aarch64/Makefile index 2ea1d74a38..954461f81d 100644 --- a/libavcodec/aarch64/Makefile +++ b/libavcodec/aarch64/Makefile @@ -62,4 +62,5 @@ NEON-OBJS-$(CONFIG_VP9_DECODER) += aarch64/vp9itxfm_16bpp_neon.o \ aarch64/vp9mc_16bpp_neon.o \ aarch64/vp9mc_neon.o NEON-OBJS-$(CONFIG_HEVC_DECODER)+= aarch64/hevcdsp_idct_neon.o \ - aarch64/hevcdsp_init_aarch64.o + aarch64/hevcdsp_init_aarch64.o \ + aarch64/hevcdsp_sao_neon.o diff --git a/libavcodec/aarch64/hevcdsp_init_aarch64.c b/libavcodec/aarch64/hevcdsp_init_aarch64.c index fe111bd1ac..c785e46f79 100644 --- a/libavcodec/aarch64/hevcdsp_init_aarch64.c +++ b/libavcodec/aarch64/hevcdsp_init_aarch64.c @@ -53,6 +53,12 @@ void ff_hevc_idct_4x4_dc_10_neon(int16_t *coeffs); void ff_hevc_idct_8x8_dc_10_neon(int16_t *coeffs); void ff_hevc_idct_16x16_dc_10_neon(int16_t *coeffs); void ff_hevc_idct_32x32_dc_10_neon(int16_t *coeffs); +void ff_hevc_sao_band_filter_8x8_8_neon(uint8_t *_dst, uint8_t *_src, + ptrdiff_t stride_dst, ptrdiff_t stride_src, + int16_t *sao_offset_val, int sao_left_class, + int width, int height); + + av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth) { @@ -69,6 +75,7 @@ av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth) c->idct_dc[1] = ff_hevc_idct_8x8_dc_8_neon; c->idct_dc[2] = ff_hevc_idct_16x16_dc_8_neon; c->idct_dc[3] = ff_hevc_idct_32x32_dc_8_neon; +c->sao_band_filter[0] = ff_hevc_sao_band_filter_8x8_8_neon; } if (bit_depth == 10) { c->add_residual[0] = ff_hevc_add_residual_4x4_10_neon; diff --git a/libavcodec/aarch64/hevcdsp_sao_neon.S b/libavcodec/aarch64/hevcdsp_sao_neon.S new file mode 100644 index 00..f9fed8345b --- /dev/null +++ b/libavcodec/aarch64/hevcdsp_sao_neon.S @@ -0,0 +1,87 @@ +/* -*-arm64-*- + * vim: syntax=arm64asm + * + * AArch64 NEON optimised SAO functions for HEVC decoding + * + * Copyright (c) 2020 Josh Dekker + * + * 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/aarch64/asm.S" + +// void sao_band_filter(uint8_t *_dst, uint8_t *_src, +// ptrdiff_t stride_dst, ptrdiff_t stride_src, +// int16_t *sao_offset_val, int sao_left_class, +// int width, int height) +function ff_hevc_sao_band_filter_8x8_8_neon, export=1 +sub sp, sp, #64 +stpxzr, xzr, [sp] +stpxzr, xzr, [sp, #16] +stpxzr, xzr, [sp, #32] +stpxzr, xzr, [sp, #48] +mov w8, #4 +0: +ldrsh x9, [x4, x8, lsl #1] // x9 = sao_offset_val[k+1] +subsw8, w8, #1 +addw10, w8, w5 // x10 = k + sao_left_class +andw10, w10, #0x1F +strhw9, [sp, x10, lsl #1] +bne 0b +ld1{v16.16b-v19.16b}, [sp], #64 +movi v20.8h, #1 +1: // beginning of line +mov w8, w6 +2: +// Simple layout for accessing 16bit values +// with 8bit LUT. +// +// 00 01 02 03 04 05 06 07 +// +-
[FFmpeg-cvslog] lavc/aarch64: add HEVC idct_dc NEON
ffmpeg | branch: master | Josh Dekker | Mon Feb 1 10:30:52 2021 +| [75c2ddfa6160a6b1508859a571191f8e6f39a3f4] | committer: Josh Dekker lavc/aarch64: add HEVC idct_dc NEON Signed-off-by: Josh Dekker > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=75c2ddfa6160a6b1508859a571191f8e6f39a3f4 --- libavcodec/aarch64/hevcdsp_idct_neon.S| 51 +++ libavcodec/aarch64/hevcdsp_init_aarch64.c | 16 ++ 2 files changed, 67 insertions(+) diff --git a/libavcodec/aarch64/hevcdsp_idct_neon.S b/libavcodec/aarch64/hevcdsp_idct_neon.S index ef574d243c..28c11e632c 100644 --- a/libavcodec/aarch64/hevcdsp_idct_neon.S +++ b/libavcodec/aarch64/hevcdsp_idct_neon.S @@ -5,6 +5,7 @@ * * Ported from arm/hevcdsp_idct_neon.S by * Copyright (c) 2020 Reimar Döffinger + * Copyright (c) 2020 Josh Dekker * * This file is part of FFmpeg. * @@ -568,3 +569,53 @@ tr_16x4 secondpass_10, 20 - 10, 512, 1 idct_16x16 8 idct_16x16 10 + +// void ff_hevc_idct_NxN_dc_DEPTH_neon(int16_t *coeffs) +.macro idct_dc size, bitdepth +function ff_hevc_idct_\size\()x\size\()_dc_\bitdepth\()_neon, export=1 +movi v1.8h, #((1 << (14 - \bitdepth))+1) +ld1r {v4.8h}, [x0] +add v4.8h, v4.8h, v1.8h +sshr v0.8h, v4.8h, #(15 - \bitdepth) +sshr v1.8h, v4.8h, #(15 - \bitdepth) +.if \size > 4 +sshr v2.8h, v4.8h, #(15 - \bitdepth) +sshr v3.8h, v4.8h, #(15 - \bitdepth) +.if \size > 16 /* dc 32x32 */ +mov x2, #4 +1: +subs x2, x2, #1 +.endif +add x12, x0, #64 +mov x13, #128 +.if \size > 8 /* dc 16x16 */ +st1{v0.8h-v3.8h}, [x0], x13 +st1{v0.8h-v3.8h}, [x12], x13 +st1{v0.8h-v3.8h}, [x0], x13 +st1{v0.8h-v3.8h}, [x12], x13 +st1{v0.8h-v3.8h}, [x0], x13 +st1{v0.8h-v3.8h}, [x12], x13 +.endif /* dc 8x8 */ +st1{v0.8h-v3.8h}, [x0], x13 +st1{v0.8h-v3.8h}, [x12], x13 +.if \size > 16 /* dc 32x32 */ +bne 1b +.endif +.else /* dc 4x4 */ +st1{v0.8h-v1.8h}, [x0] +.endif +ret +endfunc +.endm + +idct_dc 4, 8 +idct_dc 4, 10 + +idct_dc 8, 8 +idct_dc 8, 10 + +idct_dc 16, 8 +idct_dc 16, 10 + +idct_dc 32, 8 +idct_dc 32, 10 diff --git a/libavcodec/aarch64/hevcdsp_init_aarch64.c b/libavcodec/aarch64/hevcdsp_init_aarch64.c index 4c29daa6d5..fe111bd1ac 100644 --- a/libavcodec/aarch64/hevcdsp_init_aarch64.c +++ b/libavcodec/aarch64/hevcdsp_init_aarch64.c @@ -45,6 +45,14 @@ void ff_hevc_idct_8x8_8_neon(int16_t *coeffs, int col_limit); void ff_hevc_idct_8x8_10_neon(int16_t *coeffs, int col_limit); void ff_hevc_idct_16x16_8_neon(int16_t *coeffs, int col_limit); void ff_hevc_idct_16x16_10_neon(int16_t *coeffs, int col_limit); +void ff_hevc_idct_4x4_dc_8_neon(int16_t *coeffs); +void ff_hevc_idct_8x8_dc_8_neon(int16_t *coeffs); +void ff_hevc_idct_16x16_dc_8_neon(int16_t *coeffs); +void ff_hevc_idct_32x32_dc_8_neon(int16_t *coeffs); +void ff_hevc_idct_4x4_dc_10_neon(int16_t *coeffs); +void ff_hevc_idct_8x8_dc_10_neon(int16_t *coeffs); +void ff_hevc_idct_16x16_dc_10_neon(int16_t *coeffs); +void ff_hevc_idct_32x32_dc_10_neon(int16_t *coeffs); av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth) { @@ -57,6 +65,10 @@ av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth) c->add_residual[3] = ff_hevc_add_residual_32x32_8_neon; c->idct[1] = ff_hevc_idct_8x8_8_neon; c->idct[2] = ff_hevc_idct_16x16_8_neon; +c->idct_dc[0] = ff_hevc_idct_4x4_dc_8_neon; +c->idct_dc[1] = ff_hevc_idct_8x8_dc_8_neon; +c->idct_dc[2] = ff_hevc_idct_16x16_dc_8_neon; +c->idct_dc[3] = ff_hevc_idct_32x32_dc_8_neon; } if (bit_depth == 10) { c->add_residual[0] = ff_hevc_add_residual_4x4_10_neon; @@ -65,5 +77,9 @@ av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth) c->add_residual[3] = ff_hevc_add_residual_32x32_10_neon; c->idct[1] = ff_hevc_idct_8x8_10_neon; c->idct[2] = ff_hevc_idct_16x16_10_neon; +c->idct_dc[0] = ff_hevc_idct_4x4_dc_10_neon; +c->idct_dc[1] = ff_hevc_idct_8x8_dc_10_neon; +c->idct_dc[2] = ff_hevc_idct_16x16_dc_10_neon; +c->idct_dc[3] = ff_hevc_idct_32x32_dc_10_neon; } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvsl
[FFmpeg-cvslog] lavc/aarch64: port HEVC SIMD idct NEON
ffmpeg | branch: master | Reimar Döffinger | Sat Jan 16 02:03:45 2021 +0100| [30f80d855bb0eb3742ac51d8900f636968d0b70b] | committer: Josh Dekker lavc/aarch64: port HEVC SIMD idct NEON Makes SIMD-optimized 8x8 and 16x16 idcts for 8 and 10 bit depth available on aarch64. For a UHD HDR (10 bit) sample video these were consuming the most time and this optimization reduced overall decode time from 19.4s to 16.4s, approximately 15% speedup. Test sample was the first 300 frames of "LG 4K HDR Demo - New York.ts", running on Apple M1. Signed-off-by: Josh Dekker > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=30f80d855bb0eb3742ac51d8900f636968d0b70b --- libavcodec/aarch64/Makefile | 2 + libavcodec/aarch64/hevcdsp_idct_neon.S| 380 ++ libavcodec/aarch64/hevcdsp_init_aarch64.c | 45 libavcodec/hevcdsp.c | 2 + libavcodec/hevcdsp.h | 1 + 5 files changed, 430 insertions(+) diff --git a/libavcodec/aarch64/Makefile b/libavcodec/aarch64/Makefile index f6434e40da..2ea1d74a38 100644 --- a/libavcodec/aarch64/Makefile +++ b/libavcodec/aarch64/Makefile @@ -61,3 +61,5 @@ NEON-OBJS-$(CONFIG_VP9_DECODER) += aarch64/vp9itxfm_16bpp_neon.o \ aarch64/vp9lpf_neon.o \ aarch64/vp9mc_16bpp_neon.o \ aarch64/vp9mc_neon.o +NEON-OBJS-$(CONFIG_HEVC_DECODER)+= aarch64/hevcdsp_idct_neon.o \ + aarch64/hevcdsp_init_aarch64.o diff --git a/libavcodec/aarch64/hevcdsp_idct_neon.S b/libavcodec/aarch64/hevcdsp_idct_neon.S new file mode 100644 index 00..992ea5dd06 --- /dev/null +++ b/libavcodec/aarch64/hevcdsp_idct_neon.S @@ -0,0 +1,380 @@ +/* + * ARM NEON optimised IDCT functions for HEVC decoding + * Copyright (c) 2014 Seppo Tomperi + * Copyright (c) 2017 Alexandra Hájková + * + * Ported from arm/hevcdsp_idct_neon.S by + * Copyright (c) 2020 Reimar Döffinger + * + * 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/aarch64/asm.S" + +const trans, align=4 +.short 64, 83, 64, 36 +.short 89, 75, 50, 18 +.short 90, 87, 80, 70 +.short 57, 43, 25, 9 +.short 90, 90, 88, 85 +.short 82, 78, 73, 67 +.short 61, 54, 46, 38 +.short 31, 22, 13, 4 +endconst + +.macro sum_sub out, in, c, op, p + .ifc \op, + +smlal\p \out, \in, \c + .else +smlsl\p \out, \in, \c + .endif +.endm + +.macro fixsqrshrn d, dt, n, m + .ifc \dt, .8h +sqrshrn2\d\dt, \n\().4s, \m + .else +sqrshrn \n\().4h, \n\().4s, \m +mov \d\().d[0], \n\().d[0] + .endif +.endm + +// uses and clobbers v28-v31 as temp registers +.macro tr_4x4_8 in0, in1, in2, in3, out0, out1, out2, out3, p1, p2 + sshll\p1 v28.4s, \in0, #6 + movv29.16b, v28.16b + smull\p1 v30.4s, \in1, v0.h[1] + smull\p1 v31.4s, \in1, v0.h[3] + smlal\p2 v28.4s, \in2, v0.h[0] //e0 + smlsl\p2 v29.4s, \in2, v0.h[0] //e1 + smlal\p2 v30.4s, \in3, v0.h[3] //o0 + smlsl\p2 v31.4s, \in3, v0.h[1] //o1 + + add\out0, v28.4s, v30.4s + add\out1, v29.4s, v31.4s + sub\out2, v29.4s, v31.4s + sub\out3, v28.4s, v30.4s +.endm + +.macro transpose8_4x4 r0, r1, r2, r3 +trn1v2.8h, \r0\().8h, \r1\().8h +trn2v3.8h, \r0\().8h, \r1\().8h +trn1v4.8h, \r2\().8h, \r3\().8h +trn2v5.8h, \r2\().8h, \r3\().8h +trn1\r0\().4s, v2.4s, v4.4s +trn2\r2\().4s, v2.4s, v4.4s +trn1\r1\().4s, v3.4s, v5.4s +trn2\r3\().4s, v3.4s, v5.4s +.endm + +.macro transpose_8x8 r0, r1, r2, r3, r4, r5, r6, r7 +transpose8_4x4 \r0, \r1, \r2, \r3 +transpose8_4x4 \r4, \r5, \r6, \r7 +.endm + +.macro tr_8x4 shift, in0,in0t, in1,in1t, in2,in2t, in3,in3t, in4,in4t, in5,in5t, in6,in6t, in7,in7t, p1, p2 +
[FFmpeg-cvslog] swscale/x86/swscale: fix mix of inline and external function definitions
ffmpeg | branch: master | James Almer | Thu Feb 18 11:35:08 2021 -0300| [c00567647e9002094255df755e18c719e75b] | committer: James Almer swscale/x86/swscale: fix mix of inline and external function definitions This includes removing pointless static function forward declarations. Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c00567647e9002094255df755e18c719e75b --- libswscale/x86/swscale.c | 44 ++- libswscale/x86/swscale_template.c | 1 - 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c index 316a824e87..1e865914cb 100644 --- a/libswscale/x86/swscale.c +++ b/libswscale/x86/swscale.c @@ -63,16 +63,6 @@ DECLARE_ASM_ALIGNED(8, const uint64_t, ff_bgr2UVOffset) = 0x8080808080808080ULL; DECLARE_ASM_ALIGNED(8, const uint64_t, ff_w)= 0x0001000100010001ULL; -#define YUV2YUVX_FUNC_DECL(opt) \ -static void yuv2yuvX_ ##opt(const int16_t *filter, int filterSize, const int16_t **src, \ - uint8_t *dest, int dstW, \ - const uint8_t *dither, int offset); \ - -YUV2YUVX_FUNC_DECL(mmx) -YUV2YUVX_FUNC_DECL(mmxext) -YUV2YUVX_FUNC_DECL(sse3) -YUV2YUVX_FUNC_DECL(avx2) - //MMX versions #if HAVE_MMX_INLINE #undef RENAME @@ -206,8 +196,8 @@ void ff_updateMMXDitherTables(SwsContext *c, int dstY) } } } +#endif /* HAVE_INLINE_ASM */ -#if HAVE_MMXEXT #define YUV2YUVX_FUNC_MMX(opt, step) \ void ff_yuv2yuvX_ ##opt(const int16_t *filter, int filterSize, int srcOffset, \ uint8_t *dest, int dstW, \ @@ -241,17 +231,19 @@ static void yuv2yuvX_ ##opt(const int16_t *filter, int filterSize, \ return; \ } +#if HAVE_MMX_EXTERNAL YUV2YUVX_FUNC_MMX(mmx, 16) +#endif +#if HAVE_MMXEXT_EXTERNAL YUV2YUVX_FUNC_MMX(mmxext, 16) +#endif +#if HAVE_SSE3_EXTERNAL YUV2YUVX_FUNC(sse3, 32) +#endif #if HAVE_AVX2_EXTERNAL YUV2YUVX_FUNC(avx2, 64) #endif -#endif - -#endif /* HAVE_INLINE_ASM */ - #define SCALE_FUNC(filter_n, from_bpc, to_bpc, opt) \ void ff_hscale ## from_bpc ## to ## to_bpc ## _ ## filter_n ## _ ## opt( \ SwsContext *c, int16_t *data, \ @@ -379,20 +371,24 @@ av_cold void ff_sws_init_swscale_x86(SwsContext *c) if (INLINE_MMXEXT(cpu_flags)) sws_init_swscale_mmxext(c); #endif -#if HAVE_SSSE3_EXTERNAL -if (EXTERNAL_SSSE3(cpu_flags)) { -if(c->use_mmx_vfilter && !(c->flags & SWS_ACCURATE_RND)){ +if(c->use_mmx_vfilter && !(c->flags & SWS_ACCURATE_RND)) { +#if HAVE_MMX_EXTERNAL +if (EXTERNAL_MMX(cpu_flags)) +c->yuv2planeX = yuv2yuvX_mmx; +#endif +#if HAVE_MMXEXT_EXTERNAL +if (EXTERNAL_MMXEXT(cpu_flags)) +c->yuv2planeX = yuv2yuvX_mmxext; +#endif +#if HAVE_SSE3_EXTERNAL +if (EXTERNAL_SSE3(cpu_flags)) c->yuv2planeX = yuv2yuvX_sse3; -} -} #endif #if HAVE_AVX2_EXTERNAL -if (EXTERNAL_AVX2_FAST(cpu_flags)) { -if(c->use_mmx_vfilter && !(c->flags & SWS_ACCURATE_RND)){ +if (EXTERNAL_AVX2_FAST(cpu_flags)) c->yuv2planeX = yuv2yuvX_avx2; -} -} #endif +} #define ASSIGN_SCALE_FUNC2(hscalefn, filtersize, opt1, opt2) do { \ if (c->srcBpc == 8) { \ diff --git a/libswscale/x86/swscale_template.c b/libswscale/x86/swscale_template.c index cb33af97e4..97d8cae613 100644 --- a/libswscale/x86/swscale_template.c +++ b/libswscale/x86/swscale_template.c @@ -1435,7 +1435,6 @@ static av_cold void RENAME(sws_init_swscale)(SwsContext *c) } } else { c->use_mmx_vfilter= 1; -c->yuv2planeX = RENAME(yuv2yuvX); if (!(c->flags & SWS_FULL_CHR_H_INT)) { switch (c->dstFormat) { case AV_PIX_FMT_RGB32: c->yuv2packedX = RENAME(yuv2rgb32_X); break; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] swscale/x86/yuv2yuvX: use the movsxdifnidn helper macro
ffmpeg | branch: master | James Almer | Thu Feb 18 12:09:27 2021 -0300| [1a555d3c604804dcedacd230d410cfc822da3f4c] | committer: James Almer swscale/x86/yuv2yuvX: use the movsxdifnidn helper macro Simplifies code Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1a555d3c604804dcedacd230d410cfc822da3f4c --- libswscale/x86/yuv2yuvX.asm | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libswscale/x86/yuv2yuvX.asm b/libswscale/x86/yuv2yuvX.asm index 062028471a..521880dabe 100644 --- a/libswscale/x86/yuv2yuvX.asm +++ b/libswscale/x86/yuv2yuvX.asm @@ -40,11 +40,9 @@ cglobal yuv2yuvX, 7, 7, 8, filter, filterSize, src, dest, dstW, dither, offset %else %define movr movdqu %endif -%if ARCH_X86_64 -movsxd dstWq, dstWd -movsxd offsetq, offsetd -movsxd srcq, srcd -%endif ; x86-64 +movsxdifnidn dstWq, dstWd +movsxdifnidn offsetq, offsetd +movsxdifnidn srcq, srcd %if cpuflag(avx2) vpbroadcastq m3, [ditherq] %else ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] swscale/x86/yuv2yuvX: use the SPLATW helper macro
ffmpeg | branch: master | James Almer | Thu Feb 18 12:07:45 2021 -0300| [d512ebbaedefc977d7628da4dc3ecfe4e52a066a] | committer: James Almer swscale/x86/yuv2yuvX: use the SPLATW helper macro Simplifies code Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d512ebbaedefc977d7628da4dc3ecfe4e52a066a --- libswscale/x86/yuv2yuvX.asm | 14 ++ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/libswscale/x86/yuv2yuvX.asm b/libswscale/x86/yuv2yuvX.asm index 6d3ba96204..a6b70d5247 100644 --- a/libswscale/x86/yuv2yuvX.asm +++ b/libswscale/x86/yuv2yuvX.asm @@ -62,18 +62,8 @@ cglobal yuv2yuvX, 7, 7, 8, filter, filterSize, src, dest, dstW, dither, offset .offset: add offsetq, srcq -%if cpuflag(avx2) -movd xmm1, filterSized -vpbroadcastw m1, xmm1 -%elif cpuflag(sse3) -movd xmm1, filterSized -pshuflw m1, m1, q -punpcklqdq m1, m1 -%else -movd m1, filterSized -punpcklwd m1, m1 -punpckldq m1, m1 -%endif ; avx2 +movd xm1, filterSized +SPLATW m1, xm1, 0 pxor m0, m0, m0 mov filterSizeq, filterq mov srcq, [filterSizeq] ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] swscale/x86/yuv2yuvX: use movq to load 8 bytes in all non-AVX2 functions
ffmpeg | branch: master | James Almer | Thu Feb 18 12:09:11 2021 -0300| [ebb48d85a07551ca82965bb66b88e50606683b4d] | committer: James Almer swscale/x86/yuv2yuvX: use movq to load 8 bytes in all non-AVX2 functions mova expands to movq on non-XMM functions Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ebb48d85a07551ca82965bb66b88e50606683b4d --- libswscale/x86/yuv2yuvX.asm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libswscale/x86/yuv2yuvX.asm b/libswscale/x86/yuv2yuvX.asm index a6b70d5247..062028471a 100644 --- a/libswscale/x86/yuv2yuvX.asm +++ b/libswscale/x86/yuv2yuvX.asm @@ -47,10 +47,8 @@ cglobal yuv2yuvX, 7, 7, 8, filter, filterSize, src, dest, dstW, dither, offset %endif ; x86-64 %if cpuflag(avx2) vpbroadcastq m3, [ditherq] -%elif cpuflag(sse3) -movq xmm3, [ditherq] %else -mova m3, [ditherq] +movq xm3, [ditherq] %endif ; avx2 cmp offsetd, 0 jz .offset ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avutil/video_enc_params: Check for truncation before creating buffer
ffmpeg | branch: master | Andreas Rheinhardt | Sun Feb 14 19:47:45 2021 +0100| [c9d9c6074689ec11b0ba12dd8c895d3564b06ed7] | committer: Andreas Rheinhardt avutil/video_enc_params: Check for truncation before creating buffer Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c9d9c6074689ec11b0ba12dd8c895d3564b06ed7 --- libavutil/video_enc_params.c | 4 1 file changed, 4 insertions(+) diff --git a/libavutil/video_enc_params.c b/libavutil/video_enc_params.c index b9cdafddbb..635176ab91 100644 --- a/libavutil/video_enc_params.c +++ b/libavutil/video_enc_params.c @@ -63,6 +63,10 @@ av_video_enc_params_create_side_data(AVFrame *frame, enum AVVideoEncParamsType t par = av_video_enc_params_alloc(type, nb_blocks, &size); if (!par) return NULL; +if (size > INT_MAX) { +av_free(par); +return NULL; +} buf = av_buffer_create((uint8_t *)par, size, NULL, NULL, 0); if (!buf) { av_freep(&par); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/mpegenc: Ensure packet queue stays valid
ffmpeg | branch: master | Andreas Rheinhardt | Mon Feb 15 03:26:04 2021 +0100| [cfce16449cb815132f829d5a07beb138dfb2cba6] | committer: Andreas Rheinhardt avformat/mpegenc: Ensure packet queue stays valid The MPEG-PS muxer uses a custom queue of custom packets. To keep track of it, it has a pointer (named predecode_packet) to the head of the queue and a pointer to where the next packet is to be added (it points to the next-pointer of the last element of the queue); furthermore, there is also a pointer that points into the queue (called premux_packet). The exact behaviour was as follows: If premux_packet was NULL when a packet is received, it is taken to mean that the old queue is empty and a new queue is started. premux_packet will point to the head of said queue and the next_packet-pointer points to its next pointer. If predecode_packet is NULL, it will also made to point to the newly allocated element. But if premux_packet is NULL and predecode_packet is not, then there will be two queues with head elements premux_packet and predecode_packet. Yet only elements reachable from predecode_packet are ever freed, so the premux_packet queue leaks. Worse yet, when the predecode_packet queue will be eventually exhausted, predecode_packet will be made to point into the other queue and when predecode_packet will be freed, the next pointer of the preceding element of the queue will still point to the element just freed. This element might very well be still reachable from premux_packet which leads to use-after-frees lateron. This happened in the tickets mentioned below. Fix this by never creating two queues in the first place by checking for predecode_packet to know whether the queue is empty. If premux_packet is NULL, then it is set to the newly allocated element of the queue. Fixes tickets #6887, #8188 and #8266. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cfce16449cb815132f829d5a07beb138dfb2cba6 --- libavformat/mpegenc.c | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index 9bd0a555d4..810dd717ca 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -48,9 +48,9 @@ typedef struct StreamInfo { uint8_t id; int max_buffer_size; /* in bytes */ int buffer_index; -PacketDesc *predecode_packet; +PacketDesc *predecode_packet; /* start of packet queue */ +PacketDesc *last_packet; /* end of packet queue */ PacketDesc *premux_packet; -PacketDesc **next_packet; int packet_number; uint8_t lpcm_header[3]; int lpcm_align; @@ -986,6 +986,8 @@ static int remove_decoded_packets(AVFormatContext *ctx, int64_t scr) } stream->buffer_index-= pkt_desc->size; stream->predecode_packet = pkt_desc->next; +if (!stream->predecode_packet) +stream->last_packet = NULL; av_freep(&pkt_desc); } } @@ -1177,12 +1179,16 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt) av_log(ctx, AV_LOG_TRACE, "dts:%f pts:%f flags:%d stream:%d nopts:%d\n", dts / 9.0, pts / 9.0, pkt->flags, pkt->stream_index, pts != AV_NOPTS_VALUE); -if (!stream->premux_packet) -stream->next_packet = &stream->premux_packet; -*stream->next_packet = pkt_desc = av_mallocz(sizeof(PacketDesc)); if (!pkt_desc) return AVERROR(ENOMEM); +if (!stream->predecode_packet) { +stream->predecode_packet = pkt_desc; +} else +stream->last_packet->next = pkt_desc; +stream->last_packet = pkt_desc; +if (!stream->premux_packet) +stream->premux_packet = pkt_desc; pkt_desc->pts= pts; pkt_desc->dts= dts; @@ -1200,9 +1206,6 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt) pkt_desc->unwritten_size = pkt_desc->size = size; -if (!stream->predecode_packet) -stream->predecode_packet = pkt_desc; -stream->next_packet = &pkt_desc->next; if (av_fifo_realloc2(stream->fifo, av_fifo_size(stream->fifo) + size) < 0) return -1; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/mpegenc: Fix leak in case trailer is never written
ffmpeg | branch: master | Andreas Rheinhardt | Mon Feb 15 03:41:20 2021 +0100| [54987a37daccbeec28d3f2ec58ff4d5656acd9b1] | committer: Andreas Rheinhardt avformat/mpegenc: Fix leak in case trailer is never written Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=54987a37daccbeec28d3f2ec58ff4d5656acd9b1 --- libavformat/mpegenc.c | 5 + 1 file changed, 5 insertions(+) diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index 810dd717ca..1204e57f04 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -1262,6 +1262,11 @@ static void mpeg_mux_deinit(AVFormatContext *ctx) StreamInfo *stream = ctx->streams[i]->priv_data; if (!stream) continue; +for (PacketDesc *pkt = stream->predecode_packet; pkt; ) { +PacketDesc *tmp = pkt->next; +av_free(pkt); +pkt = tmp; +} av_fifo_freep(&stream->fifo); } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/mpegenc: Avoid adding invalid packet to queue
ffmpeg | branch: master | Andreas Rheinhardt | Mon Feb 15 03:44:52 2021 +0100| [4294f64d578e14b3f65a6a2cd064461cb74bb122] | committer: Andreas Rheinhardt avformat/mpegenc: Avoid adding invalid packet to queue Do this by moving the check before the allocation. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4294f64d578e14b3f65a6a2cd064461cb74bb122 --- libavformat/mpegenc.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index 1204e57f04..14b904b152 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -1179,18 +1179,6 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt) av_log(ctx, AV_LOG_TRACE, "dts:%f pts:%f flags:%d stream:%d nopts:%d\n", dts / 9.0, pts / 9.0, pkt->flags, pkt->stream_index, pts != AV_NOPTS_VALUE); -pkt_desc = av_mallocz(sizeof(PacketDesc)); -if (!pkt_desc) -return AVERROR(ENOMEM); -if (!stream->predecode_packet) { -stream->predecode_packet = pkt_desc; -} else -stream->last_packet->next = pkt_desc; -stream->last_packet = pkt_desc; -if (!stream->premux_packet) -stream->premux_packet = pkt_desc; -pkt_desc->pts= pts; -pkt_desc->dts= dts; if (st->codecpar->codec_id == AV_CODEC_ID_PCM_DVD) { if (size < 3) { @@ -1204,6 +1192,18 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt) size -= 3; } +pkt_desc = av_mallocz(sizeof(PacketDesc)); +if (!pkt_desc) +return AVERROR(ENOMEM); +if (!stream->predecode_packet) { +stream->predecode_packet = pkt_desc; +} else +stream->last_packet->next = pkt_desc; +stream->last_packet = pkt_desc; +if (!stream->premux_packet) +stream->premux_packet = pkt_desc; +pkt_desc->pts= pts; +pkt_desc->dts= dts; pkt_desc->unwritten_size = pkt_desc->size = size; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avutil/video_enc_params: Combine overflow checks
ffmpeg | branch: master | Andreas Rheinhardt | Sun Feb 14 19:43:56 2021 +0100| [39df279c741928c6adf223890ff19b457f96b9bf] | committer: Andreas Rheinhardt avutil/video_enc_params: Combine overflow checks This patch also fixes a -Wtautological-constant-out-of-range-compare warning from Clang and a -Wtype-limits warning from GCC on systems where size_t is 64bits and unsigned 32bits. The reason for this seems to be that variable (whose value derives from sizeof() and can therefore be known at compile-time) is used instead of using sizeof() directly in the comparison. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=39df279c741928c6adf223890ff19b457f96b9bf --- libavutil/video_enc_params.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavutil/video_enc_params.c b/libavutil/video_enc_params.c index c46c0f1dc6..b9cdafddbb 100644 --- a/libavutil/video_enc_params.c +++ b/libavutil/video_enc_params.c @@ -33,8 +33,7 @@ AVVideoEncParams *av_video_enc_params_alloc(enum AVVideoEncParamsType type, size_t size; size = sizeof(*par); -if (nb_blocks > SIZE_MAX / sizeof(AVVideoBlockParams) || -nb_blocks * sizeof(AVVideoBlockParams) > SIZE_MAX - size) +if (nb_blocks > (SIZE_MAX - size) / sizeof(AVVideoBlockParams)) return NULL; size += sizeof(AVVideoBlockParams) * nb_blocks; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/mpegenc: Forward error code
ffmpeg | branch: master | Andreas Rheinhardt | Mon Feb 15 13:55:07 2021 +0100| [d150c2038d18d0cab6e646b3990d63920d20fb3b] | committer: Andreas Rheinhardt avformat/mpegenc: Forward error code Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d150c2038d18d0cab6e646b3990d63920d20fb3b --- libavformat/mpegenc.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index 14b904b152..d37f181eaa 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -1151,7 +1151,7 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt) StreamInfo *stream = st->priv_data; int64_t pts, dts; PacketDesc *pkt_desc; -int preload; +int preload, ret; const int is_iframe = st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && (pkt->flags & AV_PKT_FLAG_KEY); @@ -1207,8 +1207,9 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt) pkt_desc->unwritten_size = pkt_desc->size = size; -if (av_fifo_realloc2(stream->fifo, av_fifo_size(stream->fifo) + size) < 0) -return -1; +ret = av_fifo_realloc2(stream->fifo, av_fifo_size(stream->fifo) + size); +if (ret < 0) +return ret; if (s->is_dvd) { // min VOBU length 0.4 seconds (mpucoder) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/vf_vif: Remove superfluous ';'
ffmpeg | branch: master | Andreas Rheinhardt | Fri Feb 19 08:34:57 2021 +0100| [14dc28e969f642a8ba0dd28431f6ba30c5e30d7c] | committer: Andreas Rheinhardt avfilter/vf_vif: Remove superfluous ';' Inside a function a superfluous ';' is just a null-statement; yet outside it is invalid, even though compilers happen to accept them. They (at least GCC and Clang) only warn about this when on -pedantic. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=14dc28e969f642a8ba0dd28431f6ba30c5e30d7c --- libavfilter/vf_vif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_vif.c b/libavfilter/vf_vif.c index c1079c75d9..876c7c9120 100644 --- a/libavfilter/vf_vif.c +++ b/libavfilter/vf_vif.c @@ -429,8 +429,8 @@ static void offset_##bits##bit(VIFContext *s,\ } \ } -offset_fn(uint8_t, 8); -offset_fn(uint16_t, 10); +offset_fn(uint8_t, 8) +offset_fn(uint16_t, 10) static void set_meta(AVDictionary **metadata, const char *key, float d) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".