[FFmpeg-devel] [PATCH 7/9] avcodec/vc2enc: Don't use bitcount when byte-aligned
(There is a small issue that is now being treated differently: The earlier code would record a position in a buffer that is being written to via put_bits(), then write data, then overwrite the byte at the position recorded earlier and only then flush the PutBitContext. In case there was no writeout in the meantime, said flush would overwrite what one has just written. This never happened in my tests, but maybe it can happen. In this case this commit fixes this issue by flushing before overwriting the old data.) Signed-off-by: Andreas Rheinhardt --- libavcodec/vc2enc.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/libavcodec/vc2enc.c b/libavcodec/vc2enc.c index 5cb6e0d198..82d11462aa 100644 --- a/libavcodec/vc2enc.c +++ b/libavcodec/vc2enc.c @@ -233,7 +233,7 @@ static void encode_parse_info(VC2EncContext *s, enum DiracParseCodes pcode) align_put_bits(>pb); -cur_pos = put_bits_count(>pb) >> 3; +cur_pos = put_bytes_count(>pb, 0); /* Magic string */ ff_put_string(>pb, "BBCD", 0); @@ -746,7 +746,7 @@ static int encode_hq_slice(AVCodecContext *avctx, void *arg) /* Luma + 2 Chroma planes */ for (p = 0; p < 3; p++) { int bytes_start, bytes_len, pad_s, pad_c; -bytes_start = put_bits_count(pb) >> 3; +bytes_start = put_bytes_count(pb, 0); put_bits(pb, 8, 0); for (level = 0; level < s->wavelet_depth; level++) { for (orientation = !!level; orientation < 4; orientation++) { @@ -755,10 +755,10 @@ static int encode_hq_slice(AVCodecContext *avctx, void *arg) quants[level][orientation]); } } -align_put_bits(pb); -bytes_len = (put_bits_count(pb) >> 3) - bytes_start - 1; +flush_put_bits(pb); +bytes_len = put_bytes_output(pb) - bytes_start - 1; if (p == 2) { -int len_diff = slice_bytes_max - (put_bits_count(pb) >> 3); +int len_diff = slice_bytes_max - put_bytes_output(pb); pad_s = FFALIGN((bytes_len + len_diff), s->size_scaler)/s->size_scaler; pad_c = (pad_s*s->size_scaler) - bytes_len; } else { @@ -766,7 +766,6 @@ static int encode_hq_slice(AVCodecContext *avctx, void *arg) pad_c = (pad_s*s->size_scaler) - bytes_len; } pb->buf[bytes_start] = pad_s; -flush_put_bits(pb); /* vc2-reference uses that padding that decodes to '0' coeffs */ memset(put_bits_ptr(pb), 0xFF, pad_c); skip_put_bytes(pb, pad_c); -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 9/9] avcodec/mjpegenc_common: Don't flush unnecessarily
The PutBitContext has already been flushed a few lines above and nothing has been written to it in the meantime. Signed-off-by: Andreas Rheinhardt --- libavcodec/mjpegenc_common.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavcodec/mjpegenc_common.c b/libavcodec/mjpegenc_common.c index 0076e94296..c37c964931 100644 --- a/libavcodec/mjpegenc_common.c +++ b/libavcodec/mjpegenc_common.c @@ -423,7 +423,6 @@ void ff_mjpeg_escape_FF(PutBitContext *pb, int start) if(ff_count==0) return; -flush_put_bits(pb); skip_put_bytes(pb, ff_count); for(i=size-1; ff_count; i--){ -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 8/9] avcodec/speedhqenc: Remove unnecessary headers
Signed-off-by: Andreas Rheinhardt --- libavcodec/speedhqenc.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/libavcodec/speedhqenc.h b/libavcodec/speedhqenc.h index 5100bb2d34..0c52e6a380 100644 --- a/libavcodec/speedhqenc.h +++ b/libavcodec/speedhqenc.h @@ -31,10 +31,7 @@ #include -#include "mjpeg.h" -#include "mjpegenc_common.h" #include "mpegvideo.h" -#include "put_bits.h" int ff_speedhq_encode_init(MpegEncContext *s); void ff_speedhq_encode_close(MpegEncContext *s); -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 6/9] avcodec/me_cmp: Mark ff_square_tab as hidden
ff_square_tab is always used with an offset; if this table is marked as hidden, the compiler can infer that it and therefore also ff_square_tab + 256 have a fixed offset from the code. This allows to avoid performing "+ 256" at runtime by baking it into the offset from the code to the table. Signed-off-by: Andreas Rheinhardt --- libavcodec/me_cmp.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/me_cmp.h b/libavcodec/me_cmp.h index c6de2d0061..90ea76c891 100644 --- a/libavcodec/me_cmp.h +++ b/libavcodec/me_cmp.h @@ -21,9 +21,11 @@ #include +#include "libavutil/attributes_internal.h" + #include "avcodec.h" -extern const uint32_t ff_square_tab[512]; +extern const uint32_t attribute_visibility_hidden ff_square_tab[512]; /* minimum alignment rules ;) -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 5/9] avcodec/asvdec: Remove unnecessary emms_c()
This codec uses BswapDSP, BlockDSP and IDCTDSP. The former never used MMX, the latter does not use it for idct_put since bfb28b5ce89f3e950214b67ea95b45e3355c2caf and BlockDSP does not use it since commit ee551a21ddcbf81afe183d9489c534ee80f263a0. Therefore this emms_c() is can be removed. (It was actually always redundant, because its caller (decode_simple_internal()) calls emms_c() itself afterwards.) Signed-off-by: Andreas Rheinhardt --- libavcodec/asvdec.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavcodec/asvdec.c b/libavcodec/asvdec.c index 7dafc115b3..be89544732 100644 --- a/libavcodec/asvdec.c +++ b/libavcodec/asvdec.c @@ -293,8 +293,6 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p, *got_frame = 1; -emms_c(); - return (get_bits_count(>gb) + 31) / 32 * 4; } -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 4/9] avcodec/ljpegenc: Remove unnecessary emms_c()
This encoder does not use any DSP function at all. Signed-off-by: Andreas Rheinhardt --- libavcodec/ljpegenc.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavcodec/ljpegenc.c b/libavcodec/ljpegenc.c index 4b88218990..81c52a7c78 100644 --- a/libavcodec/ljpegenc.c +++ b/libavcodec/ljpegenc.c @@ -248,8 +248,6 @@ static int ljpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt, if (ret < 0) return ret; -emms_c(); - ff_mjpeg_escape_FF(, header_bits >> 3); ff_mjpeg_encode_picture_trailer(, header_bits); -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 3/9] avcodec/ljpegenc: Remove unused IDCTDSPContext
It is basically write-only. Signed-off-by: Andreas Rheinhardt --- configure | 2 +- libavcodec/ljpegenc.c | 14 ++ 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/configure b/configure index 957b7fe13e..ab6ff27249 100755 --- a/configure +++ b/configure @@ -2869,7 +2869,7 @@ ipu_decoder_select="mpegvideodec" jpegls_decoder_select="mjpeg_decoder" jv_decoder_select="blockdsp" lagarith_decoder_select="llviddsp" -ljpeg_encoder_select="idctdsp jpegtables" +ljpeg_encoder_select="jpegtables" lscr_decoder_select="inflate_wrapper" magicyuv_decoder_select="llviddsp" magicyuv_encoder_select="llvidencdsp" diff --git a/libavcodec/ljpegenc.c b/libavcodec/ljpegenc.c index a708d71220..4b88218990 100644 --- a/libavcodec/ljpegenc.c +++ b/libavcodec/ljpegenc.c @@ -33,22 +33,16 @@ #include "libavutil/frame.h" #include "libavutil/mem.h" #include "libavutil/opt.h" -#include "libavutil/pixdesc.h" #include "avcodec.h" #include "codec_internal.h" #include "encode.h" -#include "idctdsp.h" #include "jpegtables.h" -#include "mathops.h" #include "mjpegenc_common.h" #include "mjpeg.h" typedef struct LJpegEncContext { AVClass *class; -IDCTDSPContext idsp; -ScanTable scantable; -uint16_t matrix[64]; int vsample[4]; int hsample[4]; @@ -240,8 +234,8 @@ static int ljpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt, init_put_bits(, pkt->data, pkt->size); -ff_mjpeg_encode_picture_header(avctx, , pict, NULL, >scantable, - s->pred, s->matrix, s->matrix, 0); +ff_mjpeg_encode_picture_header(avctx, , pict, NULL, NULL, + s->pred, NULL, NULL, 0); header_bits = put_bits_count(); @@ -287,10 +281,6 @@ static av_cold int ljpeg_encode_init(AVCodecContext *avctx) if (!s->scratch) return AVERROR(ENOMEM); -ff_idctdsp_init(>idsp, avctx); -ff_init_scantable(s->idsp.idct_permutation, >scantable, - ff_zigzag_direct); - ff_mjpeg_init_hvsample(avctx, s->hsample, s->vsample); ff_mjpeg_build_huffman_codes(s->huff_size_dc_luminance, -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/9] avcodec/mjpegenc_common: Don't check luma/chroma matrices unnecessarily
These matrices are only used for MJPEG, not for LJPEG. So only check them for the former. This is in preparation for removing said matrices from LJPEG altogether (i.e. sending NULL matrices). Signed-off-by: Andreas Rheinhardt --- libavcodec/mjpegenc_common.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/libavcodec/mjpegenc_common.c b/libavcodec/mjpegenc_common.c index 98c464fc62..0076e94296 100644 --- a/libavcodec/mjpegenc_common.c +++ b/libavcodec/mjpegenc_common.c @@ -61,15 +61,13 @@ static void jpeg_table_header(AVCodecContext *avctx, PutBitContext *p, ScanTable *intra_scantable, uint16_t luma_intra_matrix[64], uint16_t chroma_intra_matrix[64], - int hsample[3], int use_slices) + int hsample[3], int use_slices, int matrices_differ) { int i, j, size; uint8_t *ptr; if (m) { -int matrix_count = 1 + !!memcmp(luma_intra_matrix, -chroma_intra_matrix, -sizeof(luma_intra_matrix[0]) * 64); +int matrix_count = 1 + matrices_differ; if (m->force_duplicated_matrix) matrix_count = 2; /* quant matrixes */ @@ -285,9 +283,7 @@ void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb, const int lossless = !m; int hsample[4], vsample[4]; int components = 3 + (avctx->pix_fmt == AV_PIX_FMT_BGRA); -int chroma_matrix = !!memcmp(luma_intra_matrix, - chroma_intra_matrix, - sizeof(luma_intra_matrix[0])*64); +int chroma_matrix; ff_mjpeg_init_hvsample(avctx, hsample, vsample); @@ -299,9 +295,12 @@ void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb, jpeg_put_comments(avctx, pb, frame); +chroma_matrix = !lossless && !!memcmp(luma_intra_matrix, + chroma_intra_matrix, + sizeof(luma_intra_matrix[0]) * 64); jpeg_table_header(avctx, pb, m, intra_scantable, luma_intra_matrix, chroma_intra_matrix, hsample, - use_slices); + use_slices, chroma_matrix); switch (avctx->codec_id) { case AV_CODEC_ID_MJPEG: put_marker(pb, SOF0 ); break; -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/9] avcodec/x86/simple_idct: Empty MMX state in ff_simple_idct_mmx
We currently mostly do not empty the MMX state in our MMX DSP functions; instead we only do so before code that might be using x87 code. This is a violation of the System V i386 ABI (and maybe of other ABIs, too): "The CPU shall be in x87 mode upon entry to a function. Therefore, every function that uses the MMX registers is required to issue an emms or femms instruction after using MMX registers, before returning or calling another function." (See 2.2.1 in [1]) This patch does not intend to change all these functions to abide by the ABI; it only does so for ff_simple_idct_mmx(), as this function can by called by external users, because it is exported via AVDCT (i.e. via avcodec_dct_init()). Without this, the following fragment will assert (in i386): av_force_cpu_flags(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT); int16_t *blk = av_malloc(64 * sizeof(*blk)); AVDCT *avdct = avcodec_dct_alloc(); avcodec_dct_init(avdct); avdct->idct(blk); av_assert0_fpu(); [1]: https://raw.githubusercontent.com/wiki/hjl-tools/x86-psABI/intel386-psABI-1.1.pdf Signed-off-by: Andreas Rheinhardt --- libavcodec/x86/simple_idct.asm | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/x86/simple_idct.asm b/libavcodec/x86/simple_idct.asm index dcf0da6df1..e3a29efc33 100644 --- a/libavcodec/x86/simple_idct.asm +++ b/libavcodec/x86/simple_idct.asm @@ -845,6 +845,7 @@ INIT_MMX mmx cglobal simple_idct, 1, 2, 8, 128, block, t0 IDCT +emms RET INIT_XMM sse2 -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/3] lavc/encode: make sure frame timebase matches encoder, when set
On Tue, 4 Oct 2022, Anton Khirnov wrote: Quoting Marton Balint (2022-09-28 21:54:11) On Wed, 28 Sep 2022, Anton Khirnov wrote: AVFrame.time_base has been added recently, but is currently not used for anything. Prepare for its use in encoders by rejecting frames where time_base is set, but differs from the AVCodecContext one. How is that not an API break? Users can encode AVFrames with anything in the AVFrame->time_base right now, if you change that behaviour, that will surely break some code. That is why it was explicitly documented that it will be ignored by encoders by default. Why would there be anything in that field? No code we have currently sets that field or does anything with it. It is a public field which was explicitly documented to be ignored by filters or encoders. The user could store any data in it, because the documentation of the field ensured it will not be a problem. If you read back the old threads which added AVFrame->time_base you will find the reasoning behind the original comments, in fact, you suggested the actual wording for the documentation of the field, and now you want now to change the semantics of the field which contradicts the existing documentation... Usually we introduce a new field and deprecate the old if we want to do something like this. One could argue that this break is "small" enough, to not dance around it, but I don't really see the benefit of the change in the first place. So the real question is why do you want to start using AVFrame->time_base in encoders, and what is the feature which is undoable with the current AVCodecContext->time_base? Thanks, Marton There is no valid reason for the users to be setting it on the frames they send to lavc. As for "it would have worked before', there are many precedents where some nonsensical parameter combination would "work", but then we'd add a check and it would start returning errors. Callers should not be setting random fields to random values and expect things to work. Would applying this patch after a major bump alleviate your concerns? We wanted to have one for a few months already. -- Anton Khirnov ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 4/4] lavc/opusdsp: RISC-V V (512-bit) postfilter
This adds a variant of the postfilter for use with 512-bit vectors. Half a vector is enough to perform the scalar product. Normally a whole vector would be used anyhow. Indeed fractional multiplers are no faster than the unit multipler. But in this particular function, a full vector makes up 16 samples, which would be loaded at each iteration of the outer loop. The minimum guaranteed CELT postfilter period is only 15. Accounting for the edges, we can only safely preload up to 13 samples. The fractional multipler is thus used to cap the selected vector length to a safe value of 8 elements or 256 bits. Likewise, we have the 1024-bit variant with the quarter multipler. In theory, a 2048-bit one would be possible with the eigth multipler, but that length is not even defined in the specifications as of yet, nor is it supported by any emulator - forget actual hardware. --- libavcodec/riscv/opusdsp_init.c | 8 libavcodec/riscv/opusdsp_rvv.S | 10 ++ 2 files changed, 18 insertions(+) diff --git a/libavcodec/riscv/opusdsp_init.c b/libavcodec/riscv/opusdsp_init.c index e6f9505f77..d564cca50c 100644 --- a/libavcodec/riscv/opusdsp_init.c +++ b/libavcodec/riscv/opusdsp_init.c @@ -27,6 +27,8 @@ void ff_opus_postfilter_rvv_128(float *data, int period, float *g, int len); void ff_opus_postfilter_rvv_256(float *data, int period, float *g, int len); +void ff_opus_postfilter_rvv_512(float *data, int period, float *g, int len); +void ff_opus_postfilter_rvv_1024(float *data, int period, float *g, int len); av_cold void ff_opus_dsp_init_riscv(OpusDSP *d) { @@ -41,6 +43,12 @@ av_cold void ff_opus_dsp_init_riscv(OpusDSP *d) case 32: d->postfilter = ff_opus_postfilter_rvv_256; break; +case 64: +d->postfilter = ff_opus_postfilter_rvv_512; +break; +case 128: +d->postfilter = ff_opus_postfilter_rvv_512; +break; } #endif } diff --git a/libavcodec/riscv/opusdsp_rvv.S b/libavcodec/riscv/opusdsp_rvv.S index 243c9a5e52..b3d23a9de5 100644 --- a/libavcodec/riscv/opusdsp_rvv.S +++ b/libavcodec/riscv/opusdsp_rvv.S @@ -25,6 +25,16 @@ func ff_opus_postfilter_rvv_128, zve32f j 1f endfunc +func ff_opus_postfilter_rvv_512, zve32f +lvtypei a5, e32, mf2, ta, ma +j 1f +endfunc + +func ff_opus_postfilter_rvv_1024, zve32f +lvtypei a5, e32, mf4, ta, ma +j 1f +endfunc + func ff_opus_postfilter_rvv_256, zve32f lvtypei a5, e32, m1, ta, ma 1: -- 2.37.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 3/4] lavc/opusdsp: RISC-V V (256-bit) postfilter
This adds a variant of the postfilter for use with 256-bit vectors. As a single vector is then large enough to perform the scalar product, the group multipler is reduced to just one at run-time. The different vector type is passed via register. Unfortunately, there is no VSETIVL instruction, so the constant vector size (5) also needs to be passed via a register. --- libavcodec/riscv/opusdsp_init.c | 4 libavcodec/riscv/opusdsp_rvv.S | 16 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/libavcodec/riscv/opusdsp_init.c b/libavcodec/riscv/opusdsp_init.c index f1d2c871e3..e6f9505f77 100644 --- a/libavcodec/riscv/opusdsp_init.c +++ b/libavcodec/riscv/opusdsp_init.c @@ -26,6 +26,7 @@ #include "libavcodec/opusdsp.h" void ff_opus_postfilter_rvv_128(float *data, int period, float *g, int len); +void ff_opus_postfilter_rvv_256(float *data, int period, float *g, int len); av_cold void ff_opus_dsp_init_riscv(OpusDSP *d) { @@ -37,6 +38,9 @@ av_cold void ff_opus_dsp_init_riscv(OpusDSP *d) case 16: d->postfilter = ff_opus_postfilter_rvv_128; break; +case 32: +d->postfilter = ff_opus_postfilter_rvv_256; +break; } #endif } diff --git a/libavcodec/riscv/opusdsp_rvv.S b/libavcodec/riscv/opusdsp_rvv.S index 79b46696cd..243c9a5e52 100644 --- a/libavcodec/riscv/opusdsp_rvv.S +++ b/libavcodec/riscv/opusdsp_rvv.S @@ -21,30 +21,38 @@ #include "libavutil/riscv/asm.S" func ff_opus_postfilter_rvv_128, zve32f +lvtypei a5, e32, m2, ta, ma +j 1f +endfunc + +func ff_opus_postfilter_rvv_256, zve32f +lvtypei a5, e32, m1, ta, ma +1: +li a4, 5 addi a1, a1, 2 slli a1, a1, 2 lw t1, 4(a2) vsetivli zero, 3, e32, m1, ta, ma vle32.v v24, (a2) sub a1, a0, a1 // a1 = = [-(period + 2)] -vsetivli zero, 5, e32, m2, ta, ma +vsetvl zero, a4, a5 vslide1up.vx v8, v24, t1 lw t2, 8(a2) vle32.v v16, (a1) vslide1up.vx v24, v8, t2 // v24 = { g[2], g[1], g[0], g[1], g[2] } 2: -vsetvli t0, a3, e32, m2, ta, ma +vsetvl t0, a3, a5 vle32.v v0, (a0) sub a3, a3, t0 3: -vsetivli zero, 5, e32, m2, ta, ma +vsetvl zero, a4, a5 lw t2, 20(a1) vfmul.vv v8, v24, v16 addi a0, a0, 4 vslide1down.vx v16, v16, t2 addi a1, a1, 4 vfredusum.vs v0, v8, v0 -vsetvlizero, t0, e32, m2, ta, ma +vsetvl zero, t0, a5 vmv.x.st1, v0 addi t0, t0, -1 vslide1down.vx v0, v0, zero -- 2.37.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/4] lavc/opusdsp: RISC-V V (128-bit) postfilter
This is implemented for a vector size of 128-bit. Since the scalar product in the inner loop covers 5 samples or 160 bits, we need a group multipler of 2. To avoid reconfiguring the vector type, the outer loop, which loads multiple input samples sticks to the same multipler. Consequently, the outer loop loads 8 samples per iteration. This is safe since the minimum period of the CELT codec is 15 samples. The same code would also work, albeit needlessly inefficiently with a vector length of 256 bits. A proper implementation will follow instead. --- libavcodec/opusdsp.c| 2 ++ libavcodec/opusdsp.h| 1 + libavcodec/riscv/Makefile | 2 ++ libavcodec/riscv/opusdsp_init.c | 42 libavcodec/riscv/opusdsp_rvv.S | 57 + 5 files changed, 104 insertions(+) create mode 100644 libavcodec/riscv/opusdsp_init.c create mode 100644 libavcodec/riscv/opusdsp_rvv.S diff --git a/libavcodec/opusdsp.c b/libavcodec/opusdsp.c index badcfcc884..0764d712e4 100644 --- a/libavcodec/opusdsp.c +++ b/libavcodec/opusdsp.c @@ -58,6 +58,8 @@ av_cold void ff_opus_dsp_init(OpusDSP *ctx) #if ARCH_AARCH64 ff_opus_dsp_init_aarch64(ctx); +#elif ARCH_RISCV +ff_opus_dsp_init_riscv(ctx); #elif ARCH_X86 ff_opus_dsp_init_x86(ctx); #endif diff --git a/libavcodec/opusdsp.h b/libavcodec/opusdsp.h index 3ea3d14bf0..c2a301e832 100644 --- a/libavcodec/opusdsp.h +++ b/libavcodec/opusdsp.h @@ -30,5 +30,6 @@ void ff_opus_dsp_init(OpusDSP *ctx); void ff_opus_dsp_init_x86(OpusDSP *ctx); void ff_opus_dsp_init_aarch64(OpusDSP *ctx); +void ff_opus_dsp_init_riscv(OpusDSP *ctx); #endif /* AVCODEC_OPUSDSP_H */ diff --git a/libavcodec/riscv/Makefile b/libavcodec/riscv/Makefile index eae87ea231..965942f4df 100644 --- a/libavcodec/riscv/Makefile +++ b/libavcodec/riscv/Makefile @@ -12,6 +12,8 @@ OBJS-$(CONFIG_FMTCONVERT) += riscv/fmtconvert_init.o RVV-OBJS-$(CONFIG_FMTCONVERT) += riscv/fmtconvert_rvv.o OBJS-$(CONFIG_IDCTDSP) += riscv/idctdsp_init.o RVV-OBJS-$(CONFIG_IDCTDSP) += riscv/idctdsp_rvv.o +OBJS-$(CONFIG_OPUS_DECODER) += riscv/opusdsp_init.o +RVV-OBJS-$(CONFIG_OPUS_DECODER) += riscv/opusdsp_rvv.o OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_init.o \ riscv/pixblockdsp_rvi.o RVV-OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_rvv.o diff --git a/libavcodec/riscv/opusdsp_init.c b/libavcodec/riscv/opusdsp_init.c new file mode 100644 index 00..f1d2c871e3 --- /dev/null +++ b/libavcodec/riscv/opusdsp_init.c @@ -0,0 +1,42 @@ +/* + * Copyright © 2022 Rémi Denis-Courmont. + * + * 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 "config.h" + +#include "libavutil/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/riscv/cpu.h" +#include "libavcodec/opusdsp.h" + +void ff_opus_postfilter_rvv_128(float *data, int period, float *g, int len); + +av_cold void ff_opus_dsp_init_riscv(OpusDSP *d) +{ +#if HAVE_RVV +int flags = av_get_cpu_flags(); + +if (flags & AV_CPU_FLAG_RVV_F32) +switch (ff_get_rv_vlenb()) { +case 16: +d->postfilter = ff_opus_postfilter_rvv_128; +break; +} +#endif +} diff --git a/libavcodec/riscv/opusdsp_rvv.S b/libavcodec/riscv/opusdsp_rvv.S new file mode 100644 index 00..79b46696cd --- /dev/null +++ b/libavcodec/riscv/opusdsp_rvv.S @@ -0,0 +1,57 @@ +/* + * Copyright © 2022 Rémi Denis-Courmont. + * + * 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/riscv/asm.S"
[FFmpeg-devel] [PATCH 2/4] lavu/riscv: helper macro for VTYPE encoding
On most cases, the vector type (VTYPE) for the RISC-V Vector extension is supplied as an immediate value, with either of the VSETVLI or VSETIVLI instructions. There is however a third instruction VSETVL which takes the vector type from a general purpose register. That is so the type can be selected at run-time. This introduces a macro to load a (valid) vector type into a register. The syntax follows that of VSETVLI and VSETIVLI, with element size, group multiplier, then tail and mask policies. --- libavutil/riscv/asm.S | 75 +++ 1 file changed, 75 insertions(+) diff --git a/libavutil/riscv/asm.S b/libavutil/riscv/asm.S index ffa0bd9068..6ca74f263a 100644 --- a/libavutil/riscv/asm.S +++ b/libavutil/riscv/asm.S @@ -92,3 +92,78 @@ shnadd 3, \rd, \rs1, \rs2 .endm #endif + +/* Convenience macro to load a Vector type (vtype) as immediate */ +.macro lvtypei rd, e, m=m1, tp=tu, mp=mu + +.ifc \e,e8 +.equ ei, 0 +.else +.ifc \e,e16 +.equ ei, 8 +.else +.ifc \e,e32 +.equ ei, 16 +.else +.ifc \e,e64 +.equ ei, 24 +.else +.error "Unknown element type" +.endif +.endif +.endif +.endif + +.ifc \m,m1 +.equ mi, 0 +.else +.ifc \m,m2 +.equ mi, 1 +.else +.ifc \m,m4 +.equ mi, 2 +.else +.ifc \m,m8 +.equ mi, 3 +.else +.ifc \m,mf8 +.equ mi, 5 +.else +.ifc \m,mf4 +.equ mi, 6 +.else +.ifc \m,mf2 +.equ mi, 7 +.else +.error "Unknown multiplier" +.equ mi, 3 +.endif +.endif +.endif +.endif +.endif +.endif +.endif + +.ifc \tp,tu +.equ tpi, 0 +.else +.ifc \tp,ta +.equ tpi, 64 +.else +.error "Unknown tail policy" +.endif +.endif + +.ifc \mp,mu +.equ mpi, 0 +.else +.ifc \mp,ma +.equ mpi, 128 +.else +.error "Unknown mask policy" +.endif +.endif + +li \rd, (ei | mi | tpi | mpi) +.endm -- 2.37.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCHv2 0/4] RISC-V V Opus postfilter
Hello, This should address the issues found in the previous version, and vectors loading the unfiltered data. The following changes since commit 451b310d4f0ba5a38c3f67ec2ce39bcb62fcf59b: avcodec/fraps: Fix segfault with negative linesizes (2022-10-05 14:39:10 +0200) are available in the Git repository at: git.remlab.net:git/ffmpeg.git rvv-vtype for you to fetch changes up to 026b9eff9d11ff59601e8823ff961ac0fabf55f1: lavc/opusdsp: RISC-V V (512-bit) postfilter (2022-10-05 19:09:01 +0300) Rémi Denis-Courmont (4): lavc/opusdsp: RISC-V V (128-bit) postfilter lavu/riscv: helper macro for VTYPE encoding lavc/opusdsp: RISC-V V (256-bit) postfilter lavc/opusdsp: RISC-V V (512-bit) postfilter libavcodec/opusdsp.c| 2 ++ libavcodec/opusdsp.h| 1 + libavcodec/riscv/Makefile | 2 ++ libavcodec/riscv/opusdsp_init.c | 54 + libavcodec/riscv/opusdsp_rvv.S | 75 + libavutil/riscv/asm.S | 75 + 6 files changed, 209 insertions(+) create mode 100644 libavcodec/riscv/opusdsp_init.c create mode 100644 libavcodec/riscv/opusdsp_rvv.S -- 雷米‧德尼-库尔蒙 http://www.remlab.net/ ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat/mxfdec: do not log warning of multiple ANC packets if count is 0
On 09/09/2022 16:33, Gavin Smith wrote: On 09/09/2022 10:45, Tomas Härdin wrote: ons 2022-09-07 klockan 15:28 +0100 skrev Gavin Smith: On 06/08/2022 21:44, Tomas Härdin wrote: fre 2022-08-05 klockan 00:03 +0100 skrev Gavin Smith: Some NLVEs may insert a KLV packet for EIA-608 data even though the number of encapsulated ANC packets is zero. --- libavformat/mxfdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Looks OK. Also I'm looking at maybe adding S436m support to mxfenc, but it's going to require a bit of plumbing in ffmpeg.c I think. /Tomas Can this be merged since there have been no objections? Probably but I'm recovering from surgery, so some time next week for me unless someone else feels like pushing. I see there are other MXF patches too that I don't have the energy to deal with at the moment /Tomas Thanks for the update. I wish you a speedy recovery. Gavin. Any update on this? Thanks. Gavin. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat/hls: fix spelling and grammar on wrap warning
Tristan Matthews 于2022年10月5日周三 22:44写道: > > --- > libavformat/hls.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavformat/hls.c b/libavformat/hls.c > index e622425e80..402eb2b5a0 100644 > --- a/libavformat/hls.c > +++ b/libavformat/hls.c > @@ -1527,7 +1527,7 @@ reload: > return AVERROR_EOF; > } > } else { > -av_log(v->parent, AV_LOG_WARNING, "maybe the m3u8 list sequence > have been wraped.\n"); > +av_log(v->parent, AV_LOG_WARNING, "The m3u8 list sequence may > have been wrapped.\n"); > } > if (v->cur_seq_no >= v->start_seq_no + v->n_segments) { > if (v->finished) > -- > 2.34.1 > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". English is not my native language, but this look ok to me. Waiting for familiarity with English reviewer comments. Thanks Steven ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v2] avcodec/audiotoolboxenc: return external error if encode failed
Andreas Rheinhardt 于2022年10月5日周三 20:14写道: > > Steven Liu: > > "zhilizhao(赵志立)" 于2022年8月22日周一 10:49写道: > >> > >> > >> > >>> On Aug 19, 2022, at 11:14 PM, James Almer wrote: > >>> > >>> On 6/24/2022 4:05 AM, Steven Liu wrote: > "zhilizhao(赵志立)" 于2022年6月24日周五 14:59写道: > > > > > > > >> On Jun 24, 2022, at 1:59 PM, Steven Liu wrote: > >> > >> because the AudioConverterFillComplexBuffer can return 0 or 1 if > >> success. > >> so set the ret to 0 it AudioConverterFillComplexBuffer success and > >> return ret value for success or return AVERROR_EXTERNAL when > >> AudioConverterFillComplexBuffer failed. > >> BTW change the error message log level from warning to error. > >> > >> Signed-off-by: Steven Liu > >> --- > >> libavcodec/audiotoolboxenc.c | 6 -- > >> 1 file changed, 4 insertions(+), 2 deletions(-) > >> > >> diff --git a/libavcodec/audiotoolboxenc.c > >> b/libavcodec/audiotoolboxenc.c > >> index f8305ab89b..00293154bf 100644 > >> --- a/libavcodec/audiotoolboxenc.c > >> +++ b/libavcodec/audiotoolboxenc.c > >> @@ -554,11 +554,13 @@ static int ffat_encode(AVCodecContext *avctx, > >> AVPacket *avpkt, > >> avctx->frame_size, > >>>pts, > >>>duration); > >> +ret = 0; > >> } else if (ret && ret != 1) { > >> -av_log(avctx, AV_LOG_WARNING, "Encode error: %i\n", ret); > >> +av_log(avctx, AV_LOG_ERROR, "Encode error: %i\n", ret); > >> +ret = AVERROR_EXTERNAL; > >> } > >> > >> -return 0; > >> +return ret; > >> } > >> > > > > LGTM. > Applied, Thanks > >>> > >>> This is probably the source of the regression described in > >>> https://trac.ffmpeg.org/ticket/9866 > >>> > >>> Can you look at it? > >> > >> There is a patch which doesn’t get apply yet: > >> > >> http://ffmpeg.org/pipermail/ffmpeg-devel/2022-June/298199.html > > > > commit as 627543f58a3166810b9cd9c8b483678c82a99be9 > >> > > You should backport this fix to 5.1. See ticket #9960. Ok, cherry-picked. Thanks Steven ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avformat/hls: fix spelling and grammar on wrap warning
--- libavformat/hls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/hls.c b/libavformat/hls.c index e622425e80..402eb2b5a0 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -1527,7 +1527,7 @@ reload: return AVERROR_EOF; } } else { -av_log(v->parent, AV_LOG_WARNING, "maybe the m3u8 list sequence have been wraped.\n"); +av_log(v->parent, AV_LOG_WARNING, "The m3u8 list sequence may have been wrapped.\n"); } if (v->cur_seq_no >= v->start_seq_no + v->n_segments) { if (v->finished) -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 2/2] ibavformat/mov: Add support for exporting poster time.
From: Bryce Chester Newman Change demuxer option name from poster_time_location to export_poster_time_location. Export the poster_time_location if available. The poster_time_location is calculated using the poster_time / time_scale = X seconds. The value of poster_time_location indicates where in the video the poster frame is. Addresses feedback from https://www.mail-archive.com/ffmpeg-devel@ffmpeg.org/msg138122.html. Signed-off-by: Bryce Chester Newman bryce.new...@gettyimages.com --- doc/demuxers.texi | 4 ++-- libavformat/isom.h | 2 +- libavformat/mov.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/demuxers.texi b/doc/demuxers.texi index b1f4926c40..447287357d 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -750,10 +750,10 @@ cast to int32 are used to adjust onward dts. Unit is the track time scale. Range is 0 to UINT_MAX. Default is @code{UINT_MAX - 48000*10} which allows upto a 10 second dts correction for 48 kHz audio streams while accommodating 99.9% of @code{uint32} range. -@item poster_time_location +@item export_poster_time_location Export the poster_time_location if available. The poster_time_location is calculated using the poster_time / time_scale = X seconds. -The value of poster_time_location indicates where in the video the poster frame is. +The value of the poster_time_location key indicates where in the video the poster frame is. Default is false. @end table diff --git a/libavformat/isom.h b/libavformat/isom.h index fb3d8d5618..f621abec76 100644 --- a/libavformat/isom.h +++ b/libavformat/isom.h @@ -326,7 +326,7 @@ typedef struct MOVContext { int64_t extent_offset; } *avif_info; int avif_info_size; -int poster_time_location; +int export_poster_time_location; } MOVContext; int ff_mp4_read_descr_len(AVIOContext *pb); diff --git a/libavformat/mov.c b/libavformat/mov.c index b914bbc96a..be939f6cc2 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1542,7 +1542,7 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) avio_rb32(pb); /* current time */ avio_rb32(pb); /* next track ID */ -if(c->poster_time_location && poster_time && c->time_scale && c->time_scale > 0) { +if(c->export_poster_time_location && poster_time && c->time_scale && c->time_scale > 0) { av_log(c->fc, AV_LOG_TRACE, "poster_time = %i, time_scale = %i\n", poster_time, c->time_scale); char buffer[32]; int poster_time_location = poster_time / c->time_scale; @@ -9123,7 +9123,7 @@ static const AVOption mov_options[] = { { "enable_drefs", "Enable external track support.", OFFSET(enable_drefs), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS }, { "max_stts_delta", "treat offsets above this value as invalid", OFFSET(max_stts_delta), AV_OPT_TYPE_INT, {.i64 = UINT_MAX-48000*10 }, 0, UINT_MAX, .flags = AV_OPT_FLAG_DECODING_PARAM }, -{ "poster_time_location", "Export the poster time location.", OFFSET(poster_time_location), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS | AV_OPT_FLAG_EXPORT }, +{ "export_poster_time_location", "Export the poster time location.", OFFSET(export_poster_time_location), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS | AV_OPT_FLAG_EXPORT }, { NULL }, }; -- ffmpeg-codebot ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 1/2] libavformat/mov: Add support for exporting poster time.
From: Bryce Chester Newman Export the poster_time_location if available. The poster_time_location is calculated using the poster_time / time_scale = X seconds. The value of poster_time_location indicates where in the video the poster frame is. Addresses feedback from https://www.mail-archive.com/ffmpeg-devel@ffmpeg.org/msg138122.html. Signed-off-by: Bryce Chester Newman bryce.new...@gettyimages.com --- doc/demuxers.texi | 6 ++ libavformat/isom.h | 1 + libavformat/mov.c | 13 +++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/doc/demuxers.texi b/doc/demuxers.texi index 2b6dd86c2a..b1f4926c40 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -749,6 +749,12 @@ cast to int32 are used to adjust onward dts. Unit is the track time scale. Range is 0 to UINT_MAX. Default is @code{UINT_MAX - 48000*10} which allows upto a 10 second dts correction for 48 kHz audio streams while accommodating 99.9% of @code{uint32} range. + +@item poster_time_location +Export the poster_time_location if available. +The poster_time_location is calculated using the poster_time / time_scale = X seconds. +The value of poster_time_location indicates where in the video the poster frame is. +Default is false. @end table @subsection Audible AAX diff --git a/libavformat/isom.h b/libavformat/isom.h index 64fb7065d5..fb3d8d5618 100644 --- a/libavformat/isom.h +++ b/libavformat/isom.h @@ -326,6 +326,7 @@ typedef struct MOVContext { int64_t extent_offset; } *avif_info; int avif_info_size; +int poster_time_location; } MOVContext; int ff_mp4_read_descr_len(AVIOContext *pb); diff --git a/libavformat/mov.c b/libavformat/mov.c index 1f436e21d6..b914bbc96a 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1501,6 +1501,7 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) { int i; int64_t creation_time; +int32_t poster_time; int version = avio_r8(pb); /* version */ avio_rb24(pb); /* flags */ @@ -1535,12 +1536,20 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) avio_rb32(pb); /* preview time */ avio_rb32(pb); /* preview duration */ -avio_rb32(pb); /* poster time */ +poster_time = avio_rb32(pb); /* poster time */ avio_rb32(pb); /* selection time */ avio_rb32(pb); /* selection duration */ avio_rb32(pb); /* current time */ avio_rb32(pb); /* next track ID */ +if(c->poster_time_location && poster_time && c->time_scale && c->time_scale > 0) { +av_log(c->fc, AV_LOG_TRACE, "poster_time = %i, time_scale = %i\n", poster_time, c->time_scale); +char buffer[32]; +int poster_time_location = poster_time / c->time_scale; +snprintf(buffer, sizeof(buffer), "%i", poster_time_location); +av_dict_set(>fc->metadata, "poster_time_location", buffer, 0); +} + return 0; } @@ -9114,7 +9123,7 @@ static const AVOption mov_options[] = { { "enable_drefs", "Enable external track support.", OFFSET(enable_drefs), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS }, { "max_stts_delta", "treat offsets above this value as invalid", OFFSET(max_stts_delta), AV_OPT_TYPE_INT, {.i64 = UINT_MAX-48000*10 }, 0, UINT_MAX, .flags = AV_OPT_FLAG_DECODING_PARAM }, - +{ "poster_time_location", "Export the poster time location.", OFFSET(poster_time_location), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS | AV_OPT_FLAG_EXPORT }, { NULL }, }; -- ffmpeg-codebot ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 0/2] libavformat/mov: Add support for exporting poster time.
Export the poster_time_location if available. The poster_time_location is calculated using the poster_time / time_scale = X seconds. The value of poster_time_location indicates where in the video the poster frame is. Addresses feedback from https://www.mail-archive.com/ffmpeg-devel@ffmpeg.org/msg138122.html. Signed-off-by: Bryce Chester Newman bryce.new...@gettyimages.com Bryce Chester Newman (2): libavformat/mov: Add support for exporting poster time. ibavformat/mov: Add support for exporting poster time. doc/demuxers.texi | 6 ++ libavformat/isom.h | 1 + libavformat/mov.c | 13 +++-- 3 files changed, 18 insertions(+), 2 deletions(-) base-commit: 5f02a261a2ddca7c79198869b45d35019baac819 Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-41%2Fbrycechesternewman%2Fadd_poster_time_location_mov-v2 Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-41/brycechesternewman/add_poster_time_location_mov-v2 Pull-Request: https://github.com/ffstaging/FFmpeg/pull/41 Range-diff vs v1: 1: c10a75a9ed = 1: c10a75a9ed libavformat/mov: Add support for exporting poster time. -: -- > 2: c8f54a5d86 ibavformat/mov: Add support for exporting poster time. -- ffmpeg-codebot ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] Encrypted SMPTE DC MXF - additional UL needed to unpack EKLV packet
> > mån 2022-10-03 klockan 11:47 + skrev Richard Ayres: > > Thanks, Pierre-Anthony. I've updated the patch to remove the > > unnecessary UL and it's now using mxf_match_uid() to detect the EKLV > > packet. > > > > Signed-off-by: Richard Ayres > > --- > > libavformat/mxfdec.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c > > index badd2be224..b1ab90f25f 100644 > > --- a/libavformat/mxfdec.c > > +++ b/libavformat/mxfdec.c > > @@ -3737,7 +3737,7 @@ static int mxf_read_header(AVFormatContext *s) > > > > PRINT_KEY(s, "read header", klv.key); > > av_log(s, AV_LOG_TRACE, "size %"PRIu64" offset > > %#"PRIx64"\n", klv.length, klv.offset); > > -if (IS_KLV_KEY(klv.key, mxf_encrypted_triplet_key) || > > +if (mxf_match_uid(klv.key, mxf_encrypted_triplet_key, > > sizeof(mxf_encrypted_triplet_key)) || > > IS_KLV_KEY(klv.key, mxf_essence_element_key) || > > IS_KLV_KEY(klv.key, mxf_canopus_essence_element_key) || > > IS_KLV_KEY(klv.key, mxf_avid_essence_element_key) || > > @@ -3983,7 +3983,7 @@ static int mxf_read_packet(AVFormatContext *s, > > AVPacket *pkt) > > pos = klv.next_klv - klv.length; > > PRINT_KEY(s, "read packet", klv.key); > > av_log(s, AV_LOG_TRACE, "size %"PRIu64" offset > > %#"PRIx64"\n", klv.length, klv.offset); > > -if (IS_KLV_KEY(klv.key, mxf_encrypted_triplet_key)) { > > +if (mxf_match_uid(klv.key, mxf_encrypted_triplet_key, > > sizeof(mxf_encrypted_triplet_key))) { > > Passes FATE. Will push later today > > /Tomas Great. Thank you. Richard Ayres This e-mail and any attachments are intended only for use by the addressee(s) named herein and may contain confidential information. If you are not the intended recipient of this e-mail, you are hereby notified any dissemination, distribution or copying of this email and any attachments is strictly prohibited. If you receive this email in error, please immediately notify the sender by return email and permanently delete the original, any copy and any printout thereof. The integrity and security of e-mail cannot be guaranteed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v2] lavc/cbs_av1: restore CodedBitstreamAV1Context when AVERROR(ENOSPC)
On 9/27/2022 10:39 PM, Xiang, Haihao wrote: From: Haihao Xiang The current pbc might be small for an obu frame, so a new pbc is required then parse this obu frame again. Because CodedBitstreamAV1Context has already been updated for this obu frame, we need to restore CodedBitstreamAV1Context, otherwise CodedBitstreamAV1Context doesn't match this obu frame when parsing obu frame again, e.g. CodedBitstreamAV1Context.order_hint. $ ffmpeg -i input.ivf -c:v copy -f null - [...] [av1_frame_merge @ 0x558bc3d6f880] ref_order_hint[i] does not match inferred value: 20, but should be 22. [av1_frame_merge @ 0x558bc3d6f880] Failed to write unit 1 (type 6). [av1_frame_merge @ 0x558bc3d6f880] Failed to write packet. [obu @ 0x558bc3d6e040] av1_frame_merge filter failed to send output packet --- libavcodec/cbs_av1.c | 64 1 file changed, 47 insertions(+), 17 deletions(-) Should be ok. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v2] avcodec/audiotoolboxenc: return external error if encode failed
Steven Liu: > "zhilizhao(赵志立)" 于2022年8月22日周一 10:49写道: >> >> >> >>> On Aug 19, 2022, at 11:14 PM, James Almer wrote: >>> >>> On 6/24/2022 4:05 AM, Steven Liu wrote: "zhilizhao(赵志立)" 于2022年6月24日周五 14:59写道: > > > >> On Jun 24, 2022, at 1:59 PM, Steven Liu wrote: >> >> because the AudioConverterFillComplexBuffer can return 0 or 1 if >> success. >> so set the ret to 0 it AudioConverterFillComplexBuffer success and >> return ret value for success or return AVERROR_EXTERNAL when >> AudioConverterFillComplexBuffer failed. >> BTW change the error message log level from warning to error. >> >> Signed-off-by: Steven Liu >> --- >> libavcodec/audiotoolboxenc.c | 6 -- >> 1 file changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/libavcodec/audiotoolboxenc.c b/libavcodec/audiotoolboxenc.c >> index f8305ab89b..00293154bf 100644 >> --- a/libavcodec/audiotoolboxenc.c >> +++ b/libavcodec/audiotoolboxenc.c >> @@ -554,11 +554,13 @@ static int ffat_encode(AVCodecContext *avctx, >> AVPacket *avpkt, >> avctx->frame_size, >>>pts, >>>duration); >> +ret = 0; >> } else if (ret && ret != 1) { >> -av_log(avctx, AV_LOG_WARNING, "Encode error: %i\n", ret); >> +av_log(avctx, AV_LOG_ERROR, "Encode error: %i\n", ret); >> +ret = AVERROR_EXTERNAL; >> } >> >> -return 0; >> +return ret; >> } >> > > LGTM. Applied, Thanks >>> >>> This is probably the source of the regression described in >>> https://trac.ffmpeg.org/ticket/9866 >>> >>> Can you look at it? >> >> There is a patch which doesn’t get apply yet: >> >> http://ffmpeg.org/pipermail/ffmpeg-devel/2022-June/298199.html > > commit as 627543f58a3166810b9cd9c8b483678c82a99be9 >> You should backport this fix to 5.1. See ticket #9960. - Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/6] fate/vcodec: Add speedhq tests
Andreas Rheinhardt: > The vsynth3 tests are disabled, because the encoder produces garbage. > > Signed-off-by: Andreas Rheinhardt > --- > tests/fate/vcodec.mak | 9 - > tests/ref/vsynth/vsynth1-speedhq-420p | 4 > tests/ref/vsynth/vsynth1-speedhq-422p | 4 > tests/ref/vsynth/vsynth1-speedhq-444p | 4 > tests/ref/vsynth/vsynth2-speedhq-420p | 4 > tests/ref/vsynth/vsynth2-speedhq-422p | 4 > tests/ref/vsynth/vsynth2-speedhq-444p | 4 > tests/ref/vsynth/vsynth_lena-speedhq-420p | 4 > tests/ref/vsynth/vsynth_lena-speedhq-422p | 4 > tests/ref/vsynth/vsynth_lena-speedhq-444p | 4 > 10 files changed, 44 insertions(+), 1 deletion(-) > create mode 100644 tests/ref/vsynth/vsynth1-speedhq-420p > create mode 100644 tests/ref/vsynth/vsynth1-speedhq-422p > create mode 100644 tests/ref/vsynth/vsynth1-speedhq-444p > create mode 100644 tests/ref/vsynth/vsynth2-speedhq-420p > create mode 100644 tests/ref/vsynth/vsynth2-speedhq-422p > create mode 100644 tests/ref/vsynth/vsynth2-speedhq-444p > create mode 100644 tests/ref/vsynth/vsynth_lena-speedhq-420p > create mode 100644 tests/ref/vsynth/vsynth_lena-speedhq-422p > create mode 100644 tests/ref/vsynth/vsynth_lena-speedhq-444p > > diff --git a/tests/fate/vcodec.mak b/tests/fate/vcodec.mak > index 8ca17950ea..1a47fc8bf6 100644 > --- a/tests/fate/vcodec.mak > +++ b/tests/fate/vcodec.mak > @@ -413,6 +413,12 @@ FATE_VCODEC-$(call ENCDEC, SNOW, AVI) += snow-ll > fate-vsynth%-snow-ll:ENCOPTS = -qscale .001 -pred 1 \ > -flags +mv4+qpel > > +FATE_VCODEC-$(call ENCDEC, SPEEDHQ, AVI) += speedhq-420p > +FATE_VCODEC_SCALE-$(call ENCDEC, SPEEDHQ, AVI) += speedhq-422p speedhq-444p > +fate-vsynth%-speedhq-420p: ENCOPTS = -pix_fmt yuv420p -b 600k > +fate-vsynth%-speedhq-422p: ENCOPTS = -pix_fmt yuv422p -noise_reduction > 1000 > +fate-vsynth%-speedhq-444p: ENCOPTS = -pix_fmt yuv444p > + > FATE_VCODEC_SCALE-$(call ENCDEC, SVQ1, MOV) += svq1 > fate-vsynth%-svq1: ENCOPTS = -qscale 3 -pix_fmt yuv410p > fate-vsynth%-svq1: FMT = mov > @@ -466,7 +472,8 @@ RESIZE_OFF = dnxhd-720p dnxhd-720p-rd dnxhd-720p-10bit > dnxhd-1080i \ > vc2-444p vc2-444p10 vc2-444p12 vc2-thaar vc2-t5_3 > # Incorrect parameters - usually size or color format restrictions > INC_PAR_OFF = cinepak h261 h261-trellis h263 h263p h263-obmc msvideo1 \ > - roqvideo rv10 rv20 y41p qtrlegray > + roqvideo rv10 rv20 speedhq-420p speedhq-422p speedhq-444p \ > + y41p qtrlegray > VSYNTH3_OFF = $(RESIZE_OFF) $(INC_PAR_OFF) > > FATE_VCODEC3 = $(filter-out $(VSYNTH3_OFF),$(FATE_VCODEC)) > diff --git a/tests/ref/vsynth/vsynth1-speedhq-420p > b/tests/ref/vsynth/vsynth1-speedhq-420p > new file mode 100644 > index 00..cd44ef662b > --- /dev/null > +++ b/tests/ref/vsynth/vsynth1-speedhq-420p > @@ -0,0 +1,4 @@ > +f905e05eabc8be20438d416722c34ed7 *tests/data/fate/vsynth1-speedhq-420p.avi > +919156 tests/data/fate/vsynth1-speedhq-420p.avi > +31e9b07d5e8ce0c8b7749e53fba05b1c > *tests/data/fate/vsynth1-speedhq-420p.out.rawvideo > +stddev: 14.06 PSNR: 25.17 MAXDIFF: 145 bytes: 7603200/ 7603200 > diff --git a/tests/ref/vsynth/vsynth1-speedhq-422p > b/tests/ref/vsynth/vsynth1-speedhq-422p > new file mode 100644 > index 00..adb7aa389f > --- /dev/null > +++ b/tests/ref/vsynth/vsynth1-speedhq-422p > @@ -0,0 +1,4 @@ > +8f094b75b93b641c214bfaf743e584ad *tests/data/fate/vsynth1-speedhq-422p.avi > +1028244 tests/data/fate/vsynth1-speedhq-422p.avi > +967315914486c7ea979e4ce9ada04a6c > *tests/data/fate/vsynth1-speedhq-422p.out.rawvideo > +stddev: 13.86 PSNR: 25.29 MAXDIFF: 148 bytes: 7603200/ 7603200 > diff --git a/tests/ref/vsynth/vsynth1-speedhq-444p > b/tests/ref/vsynth/vsynth1-speedhq-444p > new file mode 100644 > index 00..8c7abca7f2 > --- /dev/null > +++ b/tests/ref/vsynth/vsynth1-speedhq-444p > @@ -0,0 +1,4 @@ > +5008149f0dd3d05d05f8f0f9100d39ec *tests/data/fate/vsynth1-speedhq-444p.avi > +1347864 tests/data/fate/vsynth1-speedhq-444p.avi > +23c5db6ca2bdbc52e402cd72ad2fff27 > *tests/data/fate/vsynth1-speedhq-444p.out.rawvideo > +stddev: 12.84 PSNR: 25.95 MAXDIFF: 145 bytes: 7603200/ 7603200 > diff --git a/tests/ref/vsynth/vsynth2-speedhq-420p > b/tests/ref/vsynth/vsynth2-speedhq-420p > new file mode 100644 > index 00..6f7d4a2a2e > --- /dev/null > +++ b/tests/ref/vsynth/vsynth2-speedhq-420p > @@ -0,0 +1,4 @@ > +41795a070c6a13727cd1de7c65abd121 *tests/data/fate/vsynth2-speedhq-420p.avi > +570618 tests/data/fate/vsynth2-speedhq-420p.avi > +9f76f7f523a1b1efa99e55ebc874b58d > *tests/data/fate/vsynth2-speedhq-420p.out.rawvideo > +stddev:8.67 PSNR: 29.37 MAXDIFF: 142 bytes: 7603200/ 7603200 > diff --git a/tests/ref/vsynth/vsynth2-speedhq-422p > b/tests/ref/vsynth/vsynth2-speedhq-422p > new file mode 100644 >
Re: [FFmpeg-devel] [PATCH] Encrypted SMPTE DC MXF - additional UL needed to unpack EKLV packet
mån 2022-10-03 klockan 11:47 + skrev Richard Ayres: > Thanks, Pierre-Anthony. I've updated the patch to remove the > unnecessary UL and it's now using mxf_match_uid() to detect the EKLV > packet. > > Signed-off-by: Richard Ayres > --- > libavformat/mxfdec.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c > index badd2be224..b1ab90f25f 100644 > --- a/libavformat/mxfdec.c > +++ b/libavformat/mxfdec.c > @@ -3737,7 +3737,7 @@ static int mxf_read_header(AVFormatContext *s) > > PRINT_KEY(s, "read header", klv.key); > av_log(s, AV_LOG_TRACE, "size %"PRIu64" offset > %#"PRIx64"\n", klv.length, klv.offset); > - if (IS_KLV_KEY(klv.key, mxf_encrypted_triplet_key) || > + if (mxf_match_uid(klv.key, mxf_encrypted_triplet_key, > sizeof(mxf_encrypted_triplet_key)) || > IS_KLV_KEY(klv.key, mxf_essence_element_key) || > IS_KLV_KEY(klv.key, mxf_canopus_essence_element_key) || > IS_KLV_KEY(klv.key, mxf_avid_essence_element_key) || > @@ -3983,7 +3983,7 @@ static int mxf_read_packet(AVFormatContext *s, > AVPacket *pkt) > pos = klv.next_klv - klv.length; > PRINT_KEY(s, "read packet", klv.key); > av_log(s, AV_LOG_TRACE, "size %"PRIu64" offset > %#"PRIx64"\n", klv.length, klv.offset); > - if (IS_KLV_KEY(klv.key, mxf_encrypted_triplet_key)) { > + if (mxf_match_uid(klv.key, mxf_encrypted_triplet_key, > sizeof(mxf_encrypted_triplet_key))) { Passes FATE. Will push later today /Tomas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 4/4] lavc/bswapdsp: RISC-V V bswap16_buf
Oct 2, 2022, 13:55 by r...@remlab.net: > From: Rémi Denis-Courmont > > --- > libavcodec/riscv/bswapdsp_init.c | 5 - > libavcodec/riscv/bswapdsp_rvv.S | 17 + > 2 files changed, 21 insertions(+), 1 deletion(-) > > diff --git a/libavcodec/riscv/bswapdsp_init.c > b/libavcodec/riscv/bswapdsp_init.c > index c17b6b75bb..abe84ec1f7 100644 > --- a/libavcodec/riscv/bswapdsp_init.c > +++ b/libavcodec/riscv/bswapdsp_init.c > @@ -27,6 +27,7 @@ > > void ff_bswap32_buf_rvb(uint32_t *dst, const uint32_t *src, int len); > void ff_bswap32_buf_rvv(uint32_t *dst, const uint32_t *src, int len); > +void ff_bswap16_buf_rvv(uint16_t *dst, const uint16_t *src, int len); > > av_cold void ff_bswapdsp_init_riscv(BswapDSPContext *c) > { > @@ -37,7 +38,9 @@ av_cold void ff_bswapdsp_init_riscv(BswapDSPContext *c) > c->bswap_buf = ff_bswap32_buf_rvb; > #endif > #if HAVE_RVV > -if (cpu_flags & AV_CPU_FLAG_RVV_I32) > +if (cpu_flags & AV_CPU_FLAG_RVV_I32) { > c->bswap_buf = ff_bswap32_buf_rvv; > +c->bswap16_buf = ff_bswap16_buf_rvv; > +} > #endif > } > diff --git a/libavcodec/riscv/bswapdsp_rvv.S b/libavcodec/riscv/bswapdsp_rvv.S > index 7ea747b3ce..ef2999c1be 100644 > --- a/libavcodec/riscv/bswapdsp_rvv.S > +++ b/libavcodec/riscv/bswapdsp_rvv.S > @@ -43,3 +43,20 @@ func ff_bswap32_buf_rvv, zve32x > > ret > endfunc > + > +func ff_bswap16_buf_rvv, zve32x > +li t2, 2 > +addit1, a0, 1 > +1: > +vsetvlit0, a2, e8, m1, ta, ma > +vlseg2e8.v v8, (a1) > +suba2, a2, t0 > +sh1add a1, t0, a1 > +vsse8.vv8, (t1), t2 > +sh1add t1, t0, t1 > +vsse8.vv9, (a0), t2 > +sh1add a0, t0, a0 > +bnez a2, 1b > + > +ret > +endfunc > Pushed patchset with a minor bump and apichanges Thanks ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".