Re: [FFmpeg-devel] [PATCH 2/2] libavcodec/v4l2: use libdrm
> On Dec 15, 2024, at 12:14, Scott Theisen wrote: > > Based on patches by Lukas Rusak from > https://github.com/lrusak/FFmpeg/commits/v4l2-drmprime-v4 > > libavcodec: v4l2m2m: output AVDRMFrameDescriptor > https://github.com/lrusak/FFmpeg/commit/2cb8052ac65a56d8a3f347a1e6f12d4449a5a614 > > libavcodec: v4l2m2m: depends on libdrm > https://github.com/lrusak/FFmpeg/commit/ab4cf3e6fb37cffdebccca52e36a7b2deb7e729f > > libavcodec: v4l2m2m: set format_modifier to DRM_FORMAT_MOD_LINEAR > https://github.com/lrusak/FFmpeg/commit/9438a6efa29c7c7ec80c39c9b013b9a12d7b5f33 > > libavcodec: v4l2m2m: only mmap the buffer when it is output type and drm > prime is used > https://github.com/lrusak/FFmpeg/commit/093656607863e47630de2d1cfcf0ac8e4b93a69e > > libavcodec: v4l2m2m: allow using software pixel formats > https://github.com/lrusak/FFmpeg/commit/8405b573e83838e6b2fea99825fbef32ee9f7767 > > libavcodec: v4l2m2m: implement hwcontext > https://github.com/lrusak/FFmpeg/commit/b2c1f1eb39b54bf034497a7f2a7f23855d0a7cde > > libavcodec: v4l2m2m: implement flush > https://github.com/lrusak/FFmpeg/commit/e793ef82727d6d6f55c40844463d476e7e84efad > > Originally added to MythTV in: > FFmpeg: Patch FFmpeg for V4L2 codecs DRM PRIME support > https://github.com/MythTV/mythtv/commit/cc7572f9b26189ad5d5d504c05f08e53e4e61b54 > > FFmpeg: Re-apply v4l2 memory to memory DRM_PRIME support > https://github.com/MythTV/mythtv/commit/1c942720591b5b7820abe9ed0d805afabbdffe3c > > modified in: > V4L2 Codecs: Fix lockup when seeking > https://github.com/MythTV/mythtv/commit/fdc0645aba9a9ad373888bd62ebcbc83a3feb7e5 > > v4l2_buffers: Add some libdrm ifdef's > https://github.com/MythTV/mythtv/commit/336df1067abfa4fe7cf611541e5b6f3561fc81a2 > > > NB: libavcodec/v4l2_m2m_dec.c: v4l2_decode_init(): I'm returning -1 > since I don't know what error code I should use. > > Note also Lucas Rusak's v5 series: > closer diff to current state, otherwise unchanged > libavcodec: v4l2m2m: output AVDRMFrameDescriptor > https://github.com/lrusak/FFmpeg/commit/c6b85ed30f06ea99513b13cc768a922ebe4d68c2 > > new option: > libavcodec: v4l2m2m: add option to specify pixel format used by the decoder > https://github.com/lrusak/FFmpeg/commit/ffc4419f456c00ab71cf93f792b0473c6de14e64 > > additional code vs v4 > libavcodec: v4l2m2m: implement flush > https://github.com/lrusak/FFmpeg/commit/8595d06d4909bbec0aa14625fcfc869c6bcef696 > --- > configure | 1 + > libavcodec/v4l2_buffers.c | 206 +++--- > libavcodec/v4l2_buffers.h | 4 + > libavcodec/v4l2_context.c | 43 +++- > libavcodec/v4l2_context.h | 2 + > libavcodec/v4l2_m2m.h | 5 + > libavcodec/v4l2_m2m_dec.c | 62 > 7 files changed, 305 insertions(+), 18 deletions(-) > > diff --git a/configure b/configure > index bf55ba67fa..5f02cf3b51 100755 > --- a/configure > +++ b/configure > @@ -3770,6 +3770,7 @@ sndio_indev_deps="sndio" > sndio_outdev_deps="sndio" > v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h" > v4l2_indev_suggest="libv4l2" > +v4l2_outdev_deps="libdrm" Why v4l2_outdev when the patch is for libavcodec? > v4l2_outdev_deps_any="linux_videodev2_h sys_videoio_h" > v4l2_outdev_suggest="libv4l2" > vfwcap_indev_deps="vfw32 vfwcap_defines" > diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c > index 56a8f0825c..1a1a29c4e6 100644 > --- a/libavcodec/v4l2_buffers.c > +++ b/libavcodec/v4l2_buffers.c > @@ -21,6 +21,10 @@ > * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 > USA > */ > > +#include "config.h" > +#if CONFIG_LIBDRM > +#include > +#endif > #include > #include > #include > @@ -29,6 +33,8 @@ > #include > #include "libavcodec/avcodec.h" > #include "libavutil/pixdesc.h" > +#include "libavutil/hwcontext.h" > +#include "libavutil/buffer.h" > #include "refstruct.h" > #include "v4l2_context.h" > #include "v4l2_buffers.h" > @@ -247,6 +253,80 @@ FF_ENABLE_DEPRECATION_WARNINGS > } > } > > +#if CONFIG_LIBDRM > +static uint8_t * v4l2_get_drm_frame(V4L2Buffer *avbuf) > +{ > +AVDRMFrameDescriptor *drm_desc = &avbuf->drm_frame; > +AVDRMLayerDescriptor *layer; > + > +/* fill the DRM frame descriptor */ > +drm_desc->nb_objects = avbuf->num_planes; > +drm_desc->nb_layers = 1; > + > +layer = &drm_desc->layers[0]; > +layer->nb_planes = avbuf->num_planes; > + > +for (int i = 0; i < avbuf->num_planes; i++) { > +layer->planes[i].object_index = i; > +layer->planes[i].offset = 0; > +layer->planes[i].pitch = avbuf->plane_info[i].bytesperline; > +} > + > +switch (avbuf->context->av_pix_fmt) { > +case AV_PIX_FMT_YUYV422: > + > +layer->format = DRM_FORMAT_YUYV; > +layer->nb_planes = 1; > + > +break; > + > +case AV_PIX_FMT_NV12: > +case AV_PIX_FMT_NV21: > + > +layer->format = avbuf->context->av_pix_fmt == AV_PIX_FMT_NV12 ? > +DRM_FORMAT_NV12 : DRM_FORMAT_NV21; > + > +if (
Re: [FFmpeg-devel] [PATCH 1/2] libavcodec/v4l2_buffers.c: set AVFrame interlaced flags
On 12/15/2024 1:14 AM, Scott Theisen wrote: Originally from: https://github.com/MythTV/mythtv/commit/669955c6cb29196b4b5120451b5b998d67a65749 --- libavcodec/v4l2_buffers.c | 38 ++ 1 file changed, 38 insertions(+) diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c index 23474ee143..56a8f0825c 100644 --- a/libavcodec/v4l2_buffers.c +++ b/libavcodec/v4l2_buffers.c @@ -210,6 +210,43 @@ static enum AVColorTransferCharacteristic v4l2_get_color_trc(V4L2Buffer *buf) return AVCOL_TRC_UNSPECIFIED; } +static void v4l2_get_interlacing(AVFrame *frame, V4L2Buffer *buf) +{ +enum v4l2_field field; +field = V4L2_TYPE_IS_MULTIPLANAR(buf->buf.type) ? +buf->context->format.fmt.pix_mp.field : +buf->context->format.fmt.pix.field; + +if (field == V4L2_FIELD_INTERLACED || field == V4L2_FIELD_INTERLACED_TB) { +frame->flags |= AV_FRAME_FLAG_INTERLACED; +frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST; +#if FF_API_INTERLACED_FRAME +FF_DISABLE_DEPRECATION_WARNINGS +frame->interlaced_frame = 1; +frame->top_field_first = 1; No need to set these two fields. It's done by the generic code. +FF_ENABLE_DEPRECATION_WARNINGS +#endif +} else if (field == V4L2_FIELD_INTERLACED_BT) { +frame->flags |= AV_FRAME_FLAG_INTERLACED; +frame->flags &= ~AV_FRAME_FLAG_TOP_FIELD_FIRST; +#if FF_API_INTERLACED_FRAME +FF_DISABLE_DEPRECATION_WARNINGS +frame->interlaced_frame = 1; +frame->top_field_first = 0; +FF_ENABLE_DEPRECATION_WARNINGS +#endif +} else { +frame->flags &= ~AV_FRAME_FLAG_INTERLACED; +frame->flags &= ~AV_FRAME_FLAG_TOP_FIELD_FIRST; +#if FF_API_INTERLACED_FRAME +FF_DISABLE_DEPRECATION_WARNINGS +frame->interlaced_frame = 0; +frame->top_field_first = 0; +FF_ENABLE_DEPRECATION_WARNINGS +#endif +} +} + static void v4l2_free_buffer(void *opaque, uint8_t *unused) { V4L2Buffer* avbuf = opaque; @@ -434,6 +471,7 @@ int ff_v4l2_buffer_buf_to_avframe(AVFrame *frame, V4L2Buffer *avbuf) frame->color_trc = v4l2_get_color_trc(avbuf); frame->pts = v4l2_get_pts(avbuf); frame->pkt_dts = AV_NOPTS_VALUE; +v4l2_get_interlacing(frame, avbuf); /* these values are updated also during re-init in v4l2_process_driver_event */ frame->height = avbuf->context->height; OpenPGP_signature.asc Description: OpenPGP digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2_2 3/6] lavc/riscv: Move VVC macro to h26x
From: sunyuechi --- libavcodec/riscv/h26x/asm.S | 127 ++ libavcodec/riscv/vvc/vvc_mc_rvv.S | 117 ++- 2 files changed, 132 insertions(+), 112 deletions(-) create mode 100644 libavcodec/riscv/h26x/asm.S diff --git a/libavcodec/riscv/h26x/asm.S b/libavcodec/riscv/h26x/asm.S new file mode 100644 index 00..1b8453d825 --- /dev/null +++ b/libavcodec/riscv/h26x/asm.S @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2024 Institue of Software Chinese Academy of Sciences (ISCAS). + * + * 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" + +.macro vsetvlstatic8 w, vlen +.if \w == 2 && \vlen == 128 +vsetivlizero, \w, e8, mf8, ta, ma +.elseif \w <= 4 && \vlen == 128 +vsetivlizero, \w, e8, mf4, ta, ma +.elseif \w <= 8 && \vlen == 128 +vsetivlizero, \w, e8, mf2, ta, ma +.elseif \w <= 16 && \vlen == 128 +vsetivlizero, \w, e8, m1, ta, ma +.elseif \w <= 32 && \vlen == 128 +li t0, \w +vsetvli zero, t0, e8, m2, ta, ma +.elseif \w <= 4 && \vlen == 256 +vsetivlizero, \w, e8, mf8, ta, ma +.elseif \w <= 8 && \vlen == 256 +vsetivlizero, \w, e8, mf4, ta, ma +.elseif \w <= 16 && \vlen == 256 +vsetivlizero, \w, e8, mf2, ta, ma +.elseif \w <= 32 && \vlen == 256 +li t0, \w +vsetvli zero, t0, e8, m1, ta, ma +.elseif \w <= 64 && \vlen == 256 +li t0, \w +vsetvli zero, t0, e8, m2, ta, ma +.else +li t0, \w +vsetvli zero, t0, e8, m4, ta, ma +.endif +.endm + +.macro vsetvlstatic16 w, vlen +.if \w == 2 && \vlen == 128 +vsetivlizero, \w, e16, mf4, ta, ma +.elseif \w <= 4 && \vlen == 128 +vsetivlizero, \w, e16, mf2, ta, ma +.elseif \w <= 8 && \vlen == 128 +vsetivlizero, \w, e16, m1, ta, ma +.elseif \w <= 16 && \vlen == 128 +vsetivlizero, \w, e16, m2, ta, ma +.elseif \w <= 32 && \vlen == 128 +li t0, \w +vsetvli zero, t0, e16, m4, ta, ma +.elseif \w <= 4 && \vlen == 256 +vsetivlizero, \w, e16, mf4, ta, ma +.elseif \w <= 8 && \vlen == 256 +vsetivlizero, \w, e16, mf2, ta, ma +.elseif \w <= 16 && \vlen == 256 +vsetivlizero, \w, e16, m1, ta, ma +.elseif \w <= 32 && \vlen == 256 +li t0, \w +vsetvli zero, t0, e16, m2, ta, ma +.elseif \w <= 64 && \vlen == 256 +li t0, \w +vsetvli zero, t0, e16, m4, ta, ma +.else +li t0, \w +vsetvli zero, t0, e16, m8, ta, ma +.endif +.endm + +.macro vsetvlstatic32 w, vlen +.if \w == 2 +vsetivlizero, \w, e32, mf2, ta, ma +.elseif \w <= 4 && \vlen == 128 +vsetivlizero, \w, e32, m1, ta, ma +.elseif \w <= 8 && \vlen == 128 +vsetivlizero, \w, e32, m2, ta, ma +.elseif \w <= 16 && \vlen == 128 +vsetivlizero, \w, e32, m4, ta, ma +.elseif \w <= 4 && \vlen == 256 +vsetivlizero, \w, e32, mf2, ta, ma +.elseif \w <= 8 && \vlen == 256 +vsetivlizero, \w, e32, m1, ta, ma +.elseif \w <= 16 && \vlen == 256 +vsetivlizero, \w, e32, m2, ta, ma +.elseif \w <= 32 && \vlen == 256 +li t0, \w +vsetvli zero, t0, e32, m4, ta, ma +.else +li t0, \w +vsetvli zero, t0, e32, m8, ta, ma +.endif +.endm + +.macro POW2_JMP_TABLE id, vlen +const jmp_table_\id\vlen +.
[FFmpeg-devel] [PATCH v2_2 2/6] lavc/vvc_mc: R-V V dmvr
From: sunyuechi k230 banana_f3 dmvr_8_12x20_c: 619.3 ( 1.00x)624.1 ( 1.00x) dmvr_8_12x20_rvv_i32: 128.6 ( 4.82x)103.4 ( 6.04x) dmvr_8_20x12_c: 610.0 ( 1.00x)665.6 ( 1.00x) dmvr_8_20x12_rvv_i32: 137.6 ( 4.44x)92.9 ( 7.17x) dmvr_8_20x20_c: 1008.0 ( 1.00x)1082.7 ( 1.00x) dmvr_8_20x20_rvv_i32: 221.1 ( 4.56x)155.4 ( 6.97x) dmvr_h_8_12x20_c:2008.0 ( 1.00x)2009.7 ( 1.00x) dmvr_h_8_12x20_rvv_i32: 239.6 ( 8.38x)186.7 (10.77x) dmvr_h_8_20x12_c:1989.5 ( 1.00x)2009.4 ( 1.00x) dmvr_h_8_20x12_rvv_i32: 230.3 ( 8.64x)155.4 (12.93x) dmvr_h_8_20x20_c:3304.1 ( 1.00x)3342.9 ( 1.00x) dmvr_h_8_20x20_rvv_i32: 378.3 ( 8.73x)248.9 (13.43x) dmvr_hv_8_12x20_c: 3609.8 ( 1.00x)3603.4 ( 1.00x) dmvr_hv_8_12x20_rvv_i32: 369.1 ( 9.78x)322.1 (11.19x) dmvr_hv_8_20x12_c: 3628.3 ( 1.00x)3624.2 ( 1.00x) dmvr_hv_8_20x12_rvv_i32: 322.8 (11.24x)238.7 (15.19x) dmvr_hv_8_20x20_c: 5933.8 ( 1.00x)5936.6 ( 1.00x) dmvr_hv_8_20x20_rvv_i32: 526.5 (11.27x)374.1 (15.87x) dmvr_v_8_12x20_c:2156.3 ( 1.00x)2155.4 ( 1.00x) dmvr_v_8_12x20_rvv_i32: 239.6 ( 9.00x)176.2 (12.24x) dmvr_v_8_20x12_c:2137.6 ( 1.00x)2165.9 ( 1.00x) dmvr_v_8_20x12_rvv_i32: 230.3 ( 9.28x)155.2 (13.96x) dmvr_v_8_20x20_c:4183.8 ( 1.00x)3592.9 ( 1.00x) dmvr_v_8_20x20_rvv_i32: 369.3 (11.33x)249.2 (14.42x) --- libavcodec/riscv/vvc/vvc_mc_rvv.S | 122 + libavcodec/riscv/vvc/vvcdsp_init.c | 22 ++ 2 files changed, 144 insertions(+) diff --git a/libavcodec/riscv/vvc/vvc_mc_rvv.S b/libavcodec/riscv/vvc/vvc_mc_rvv.S index 18532616d9..1dcbaf7d5b 100644 --- a/libavcodec/riscv/vvc/vvc_mc_rvv.S +++ b/libavcodec/riscv/vvc/vvc_mc_rvv.S @@ -285,3 +285,125 @@ endfunc func_w_avg 128 func_w_avg 256 #endif + +func dmvr zve32x, zbb, zba +lpad0 +lit0, 4 +1: +add t1, a1, a2 +addi t4, a0, 128*2 +vle8.vv0, (a1) +vle8.vv4, (t1) +addi a3, a3, -2 +vwmulu.vx v16, v0, t0 +vwmulu.vx v20, v4, t0 +vse16.v v16, (a0) +vse16.v v20, (t4) +sh1adda1, a2, a1 +add a0, a0, 128*2*2 +bnez a3, 1b +ret +endfunc + +.macro dmvr_h_v mn, type, w, vlen +func dmvr_\type\vlen\w, zve32x, zbb, zba +lla t4, ff_vvc_inter_luma_dmvr_filters +sh1addt4, \mn, t4 +lbu t5, (t4) +lbu t6, 1(t4) +1: +vsetvlstatic8 \w, \vlen +.ifc \type,h +addi t0, a1, 1 +addi t1, a1, 2 +.else +add t0, a1, a2 +add t1, t0, a2 +.endif +vle8.vv0, (a1) +vle8.vv4, (t0) +vle8.vv8, (t1) +addi a3, a3, -2 +addi t2, a0, 128*2 +vwmulu.vx v12, v0, t5 +vwmulu.vx v24, v4, t5 +vwmaccu.vxv12, t6, v4 +vwmaccu.vxv24, t6, v8 +vsetvlstatic16\w, \vlen +vssrl.vi v12, v12, 2 +vssrl.vi v24, v24, 2 +vse16.v v12, (a0) +vse16.v v24, (t2) +add a0, a0, 128*4 +sh1adda1, a2, a1 +bnez a3, 1b +ret +endfunc +.endm + +.macro dmvr_load_h dst, filter0, filter1, w, vlen +vsetvlstatic8 \w, \vlen +addi a6, a1, 1 +vle8.v\dst, (a1) +vle8.vv2, (a6) +vwmulu.vx v4, \dst, \filter0 +vwmaccu.vxv4, \filter1, v2 +vsetvlstatic16\w, \vlen +vssrl.vi \dst, v4, 2 +.endm + +.macro dmvr_hv w, vlen +func dmvr_hv\vlen\w, zve32x, zbb, zba +lla t0, ff_vvc_inter_luma_dmvr_filters +sh1addt1, a4, t0 +sh1addt2, a5, t0 +lbu t3, (t1) // filter[mx][0] +lbu t4, 1(t1) // filter[mx][1] +lbu t5, (t2) // filter[my][0] +lbu t6, 1(t2) // filter[my][1] +dmvr_load_h v12, t3, t4, \w, \vlen +add a1, a1, a2 +1: +vmul.vx v28, v12, t5 +addi a3, a3, -1 +dmvr_load_h v12, t3, t4, \w, \vlen +vmacc
[FFmpeg-devel] [PATCH v2_2 1/6] Update R-V V vvc_mc vset to support more lengths
From: sunyuechi --- libavcodec/riscv/vvc/vvc_mc_rvv.S | 46 +++ 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/libavcodec/riscv/vvc/vvc_mc_rvv.S b/libavcodec/riscv/vvc/vvc_mc_rvv.S index 45f4750f82..18532616d9 100644 --- a/libavcodec/riscv/vvc/vvc_mc_rvv.S +++ b/libavcodec/riscv/vvc/vvc_mc_rvv.S @@ -23,25 +23,25 @@ .macro vsetvlstatic8 w, vlen .if \w == 2 && \vlen == 128 vsetivlizero, \w, e8, mf8, ta, ma -.elseif \w == 4 && \vlen == 128 +.elseif \w <= 4 && \vlen == 128 vsetivlizero, \w, e8, mf4, ta, ma -.elseif \w == 8 && \vlen == 128 +.elseif \w <= 8 && \vlen == 128 vsetivlizero, \w, e8, mf2, ta, ma -.elseif \w == 16 && \vlen == 128 +.elseif \w <= 16 && \vlen == 128 vsetivlizero, \w, e8, m1, ta, ma -.elseif \w == 32 && \vlen == 128 +.elseif \w <= 32 && \vlen == 128 li t0, \w vsetvli zero, t0, e8, m2, ta, ma .elseif \w <= 4 && \vlen == 256 vsetivlizero, \w, e8, mf8, ta, ma -.elseif \w == 8 && \vlen == 256 +.elseif \w <= 8 && \vlen == 256 vsetivlizero, \w, e8, mf4, ta, ma -.elseif \w == 16 && \vlen == 256 +.elseif \w <= 16 && \vlen == 256 vsetivlizero, \w, e8, mf2, ta, ma -.elseif \w == 32 && \vlen == 256 +.elseif \w <= 32 && \vlen == 256 li t0, \w vsetvli zero, t0, e8, m1, ta, ma -.elseif \w == 64 && \vlen == 256 +.elseif \w <= 64 && \vlen == 256 li t0, \w vsetvli zero, t0, e8, m2, ta, ma .else @@ -53,25 +53,25 @@ .macro vsetvlstatic16 w, vlen .if \w == 2 && \vlen == 128 vsetivlizero, \w, e16, mf4, ta, ma -.elseif \w == 4 && \vlen == 128 +.elseif \w <= 4 && \vlen == 128 vsetivlizero, \w, e16, mf2, ta, ma -.elseif \w == 8 && \vlen == 128 +.elseif \w <= 8 && \vlen == 128 vsetivlizero, \w, e16, m1, ta, ma -.elseif \w == 16 && \vlen == 128 +.elseif \w <= 16 && \vlen == 128 vsetivlizero, \w, e16, m2, ta, ma -.elseif \w == 32 && \vlen == 128 +.elseif \w <= 32 && \vlen == 128 li t0, \w vsetvli zero, t0, e16, m4, ta, ma .elseif \w <= 4 && \vlen == 256 vsetivlizero, \w, e16, mf4, ta, ma -.elseif \w == 8 && \vlen == 256 +.elseif \w <= 8 && \vlen == 256 vsetivlizero, \w, e16, mf2, ta, ma -.elseif \w == 16 && \vlen == 256 +.elseif \w <= 16 && \vlen == 256 vsetivlizero, \w, e16, m1, ta, ma -.elseif \w == 32 && \vlen == 256 +.elseif \w <= 32 && \vlen == 256 li t0, \w vsetvli zero, t0, e16, m2, ta, ma -.elseif \w == 64 && \vlen == 256 +.elseif \w <= 64 && \vlen == 256 li t0, \w vsetvli zero, t0, e16, m4, ta, ma .else @@ -83,19 +83,19 @@ .macro vsetvlstatic32 w, vlen .if \w == 2 vsetivlizero, \w, e32, mf2, ta, ma -.elseif \w == 4 && \vlen == 128 +.elseif \w <= 4 && \vlen == 128 vsetivlizero, \w, e32, m1, ta, ma -.elseif \w == 8 && \vlen == 128 +.elseif \w <= 8 && \vlen == 128 vsetivlizero, \w, e32, m2, ta, ma -.elseif \w == 16 && \vlen == 128 +.elseif \w <= 16 && \vlen == 128 vsetivlizero, \w, e32, m4, ta, ma -.elseif \w == 4 && \vlen == 256 +.elseif \w <= 4 && \vlen == 256 vsetivlizero, \w, e32, mf2, ta, ma -.elseif \w == 8 && \vlen == 256 +.elseif \w <= 8 && \vlen == 256 vsetivlizero, \w, e32, m1, ta, ma -.elseif \w == 16 && \vlen == 256 +.elseif \w <= 16 && \vlen == 256 vsetivlizero, \w, e32, m2, ta, ma -.elseif \w == 32 && \vlen == 256 +.elseif \w <= 32 && \vlen == 256 li t0, \w vsetvli zero, t0, e32, m4, ta, ma .else -- 2.47.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 6/6] lavc/vvc_mc R-V V sad
From: sunyuechi k230 banana_f3 sad_8x16_c: 387.7 ( 1.00x)394.9 ( 1.00x) sad_8x16_rvv_i32: 109.7 ( 3.53x)103.5 ( 3.82x) sad_16x8_c: 378.2 ( 1.00x)384.7 ( 1.00x) sad_16x8_rvv_i32:82.0 ( 4.61x)61.7 ( 6.24x) sad_16x16_c:748.7 ( 1.00x)759.7 ( 1.00x) sad_16x16_rvv_i32: 128.5 ( 5.83x)113.7 ( 6.68x) --- libavcodec/riscv/vvc/Makefile | 3 +- libavcodec/riscv/vvc/vvc_sad_rvv.S | 61 ++ libavcodec/riscv/vvc/vvcdsp_init.c | 7 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 libavcodec/riscv/vvc/vvc_sad_rvv.S diff --git a/libavcodec/riscv/vvc/Makefile b/libavcodec/riscv/vvc/Makefile index 582b051579..6b9c618b33 100644 --- a/libavcodec/riscv/vvc/Makefile +++ b/libavcodec/riscv/vvc/Makefile @@ -1,2 +1,3 @@ OBJS-$(CONFIG_VVC_DECODER) += riscv/vvc/vvcdsp_init.o -RVV-OBJS-$(CONFIG_VVC_DECODER) += riscv/vvc/vvc_mc_rvv.o +RVV-OBJS-$(CONFIG_VVC_DECODER) += riscv/vvc/vvc_mc_rvv.o \ + riscv/vvc/vvc_sad_rvv.o diff --git a/libavcodec/riscv/vvc/vvc_sad_rvv.S b/libavcodec/riscv/vvc/vvc_sad_rvv.S new file mode 100644 index 00..341167be1f --- /dev/null +++ b/libavcodec/riscv/vvc/vvc_sad_rvv.S @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2024 Institue of Software Chinese Academy of Sciences (ISCAS). + * + * 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 "libavcodec/riscv/h26x/asm.S" + +.macro func_sad vlen +func ff_vvc_sad_rvv_\vlen, zve32x, zbb, zba +lpad0 +slli t2, a3, 7 // dy * 128 +lit1, 4*128+4 +add t3, t2, a2 // dy * 128 + dx +sub t1, t1, t2 +sub t1, t1, a2 +sh1adda0, t3, a0 +sh1adda1, t1, a1 +lit3, 16 +beq a4, t3, SADVSET\vlen\()16 +.irp w,8,16 +SADVSET\vlen\w: +vsetvlstatic32\w, \vlen +vmv.v.i v0, 0 +vmv.s.x v24, zero +vsetvlstatic16\w, \vlen +SAD\vlen\w: +addi a5, a5, -2 +vle16.v v8, (a0) +vle16.v v16, (a1) +vsub.vv v8, v8, v16 +vneg.vv16, v8 +addi a0, a0, 2 * 128 * 2 +vmax.vv v8, v8, v16 +vwaddu.wv v0, v0, v8 +addi a1, a1, 2 * 128 * 2 +bnez a5, SAD\vlen\w +vsetvlstatic32\w, \vlen +vredsum.vsv24, v0, v24 +vmv.x.s a0, v24 +ret +.endr +endfunc +.endm + +func_sad 256 +func_sad 128 diff --git a/libavcodec/riscv/vvc/vvcdsp_init.c b/libavcodec/riscv/vvc/vvcdsp_init.c index 2fe93029aa..1b228cc9f5 100644 --- a/libavcodec/riscv/vvc/vvcdsp_init.c +++ b/libavcodec/riscv/vvc/vvcdsp_init.c @@ -59,6 +59,9 @@ DMVR_PROTOTYPES(8, rvv_256) c->inter.dmvr[1][1] = ff_vvc_dmvr_hv_##bd##_##opt; \ } while (0) +int ff_vvc_sad_rvv_128(const int16_t *src0, const int16_t *src1, int dx, int dy, int block_w, int block_h); +int ff_vvc_sad_rvv_256(const int16_t *src0, const int16_t *src1, int dx, int dy, int block_w, int block_h); + #define PUT_PIXELS_PROTOTYPES2(bd, opt) \ void bf(ff_vvc_put_pixels, bd, opt)(int16_t *dst, \ const uint8_t *_src, const ptrdiff_t _src_stride, \ @@ -97,6 +100,8 @@ void ff_vvc_dsp_init_riscv(VVCDSPContext *const c, const int bd) FUNCS(LUMA, rvv_256); FUNCS(CHROMA, rvv_256); break; +case 10: +c->inter.sad = ff_vvc_sad_rvv_256; default: break; } @@ -111,6 +116,8 @@ void ff_vvc_dsp_init_riscv(VVCDSPContext *const c, const int bd) FUNCS(LUMA, rvv_128); FUNCS(CHROMA, rvv_128); break; +case 10: +c->inter.sad = ff_vvc_sad_rvv_128; default: break; } -- 2.47.1
[FFmpeg-devel] [PATCH v2_2 4/6] lavc/vvc_mc: R-V V put_pixels
From: sunyuechi k230 banana_f3 put_chroma_pixels_8_4x4_c: 63.5 ( 1.00x)59.2 ( 1.00x) put_chroma_pixels_8_4x4_rvv_i32:26.5 ( 2.39x)28.0 ( 2.12x) put_chroma_pixels_8_8x8_c: 211.8 ( 1.00x)215.5 ( 1.00x) put_chroma_pixels_8_8x8_rvv_i32:54.3 ( 3.90x)48.8 ( 4.42x) put_chroma_pixels_8_16x16_c: 841.3 ( 1.00x)830.0 ( 1.00x) put_chroma_pixels_8_16x16_rvv_i32: 137.5 ( 6.12x)121.8 ( 6.82x) put_chroma_pixels_8_32x32_c: 3248.8 ( 1.00x)3288.2 ( 1.00x) put_chroma_pixels_8_32x32_rvv_i32: 350.5 ( 9.27x)288.5 (11.40x) put_chroma_pixels_8_64x64_c: 12998.3 ( 1.00x) 12976.2 ( 1.00x) put_chroma_pixels_8_64x64_rvv_i32:1100.5 (11.81x)924.0 (14.04x) put_chroma_pixels_8_128x128_c: 54284.0 ( 1.00x) 52654.5 ( 1.00x) put_chroma_pixels_8_128x128_rvv_i32: 7192.8 ( 7.55x)2934.2 (17.94x) put_luma_pixels_8_4x4_c:63.5 ( 1.00x)69.5 ( 1.00x) put_luma_pixels_8_4x4_rvv_i32: 26.5 ( 2.39x)28.0 ( 2.48x) put_luma_pixels_8_8x8_c: 211.5 ( 1.00x)225.8 ( 1.00x) put_luma_pixels_8_8x8_rvv_i32: 54.3 ( 3.90x)38.5 ( 5.86x) put_luma_pixels_8_16x16_c: 850.5 ( 1.00x)830.0 ( 1.00x) put_luma_pixels_8_16x16_rvv_i32: 137.5 ( 6.18x)100.8 ( 8.24x) put_luma_pixels_8_32x32_c:3248.8 ( 1.00x)3257.2 ( 1.00x) put_luma_pixels_8_32x32_rvv_i32: 341.3 ( 9.52x)246.8 (13.20x) put_luma_pixels_8_64x64_c: 13007.5 ( 1.00x) 13038.8 ( 1.00x) put_luma_pixels_8_64x64_rvv_i32: 1119.0 (11.62x)684.2 (19.06x) put_luma_pixels_8_128x128_c: 54219.3 ( 1.00x) 52060.8 ( 1.00x) put_luma_pixels_8_128x128_rvv_i32:6813.5 ( 7.96x)2548.8 (20.43x) --- libavcodec/riscv/h26x/asm.S| 42 ++ libavcodec/riscv/h26x/h2656dsp.h | 27 +++ libavcodec/riscv/vvc/vvc_mc_rvv.S | 3 +++ libavcodec/riscv/vvc/vvcdsp_init.c | 23 4 files changed, 95 insertions(+) create mode 100644 libavcodec/riscv/h26x/h2656dsp.h diff --git a/libavcodec/riscv/h26x/asm.S b/libavcodec/riscv/h26x/asm.S index 1b8453d825..d37b459f66 100644 --- a/libavcodec/riscv/h26x/asm.S +++ b/libavcodec/riscv/h26x/asm.S @@ -125,3 +125,45 @@ endconst add t1, t1, t5 jrt1 .endm + +.macro put_pixels w, vlen, id, MAX_PB_SIZE +\id\w\vlen: +vsetvlstatic8 \w, \vlen +lit2, 1<<6 +.if \w == 128 && \vlen == 128 +1: +addi t0, a1, 64 +addi t1, a0, 64*2 +vle8.vv0, (a1) +vle8.vv16, (t0) +vwmulu.vx v8, v0, t2 +vwmulu.vx v24, v16, t2 +vse16.v v8, (a0) +vse16.v v24, (t1) +add a1, a1, a2 +addi a3, a3, -1 +addi a0, a0, 128*2 +bnez a3, 1b +.else +1: +vle8.vv0, (a1) +vwmulu.vx v8, v0, t2 +vse16.v v8, (a0) +add a1, a1, a2 +addi a3, a3, -1 +addi a0, a0, \MAX_PB_SIZE<<1 +bnez a3, 1b +.endif +ret +.endm + +.macro func_put_pixels vlen, MAX_PB_SIZE, name +func ff_\name\()_put_pixels_8_rvv_\vlen\(), zve32x, zbb, zba +lpad0 +POW2_JMP_TABLE3, \vlen +POW2_J\vlen, 3, a6 +.irp w,2,4,8,16,32,64,128 +put_pixels\w, \vlen, 3, \MAX_PB_SIZE +.endr +endfunc +.endm diff --git a/libavcodec/riscv/h26x/h2656dsp.h b/libavcodec/riscv/h26x/h2656dsp.h new file mode 100644 index 00..5ddfb99881 --- /dev/null +++ b/libavcodec/riscv/h26x/h2656dsp.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2024 Institue of Software Chinese Academy of Sciences (ISCAS). + * + * 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 G
[FFmpeg-devel] [PATCH v2_2 5/6] lavc/hevc: R-V V put_pixels(pow2)
From: sunyuechi k230 banana_f3 put_hevc_pel_pixels4_8_c: 61.6 ( 1.00x)69.5 ( 1.00x) put_hevc_pel_pixels4_8_rvv_i32: 24.6 ( 2.50x)28.0 ( 2.48x) put_hevc_pel_pixels8_8_c: 209.8 ( 1.00x)215.5 ( 1.00x) put_hevc_pel_pixels8_8_rvv_i32: 52.6 ( 3.99x)38.2 ( 5.64x) put_hevc_pel_pixels16_8_c: 839.4 ( 1.00x)830.0 ( 1.00x) put_hevc_pel_pixels16_8_rvv_i32: 126.6 ( 6.63x)90.5 ( 9.17x) put_hevc_pel_pixels32_8_c:3246.6 ( 1.00x)3246.7 ( 1.00x) put_hevc_pel_pixels32_8_rvv_i32: 311.6 (10.42x)257.0 (12.63x) put_hevc_pel_pixels64_8_c: 12894.6 ( 1.00x)12892.7 ( 1.00x) put_hevc_pel_pixels64_8_rvv_i32: 1135.8 (11.35x)778.0 (16.57x) --- libavcodec/hevc/dsp.c | 2 + libavcodec/hevc/dsp.h | 1 + libavcodec/riscv/Makefile | 2 + libavcodec/riscv/h26x/h2656_inter_rvv.S | 24 + libavcodec/riscv/hevcdsp_init.c | 67 + 5 files changed, 96 insertions(+) create mode 100644 libavcodec/riscv/h26x/h2656_inter_rvv.S create mode 100644 libavcodec/riscv/hevcdsp_init.c diff --git a/libavcodec/hevc/dsp.c b/libavcodec/hevc/dsp.c index 2b347781df..a154fab2bf 100644 --- a/libavcodec/hevc/dsp.c +++ b/libavcodec/hevc/dsp.c @@ -265,6 +265,8 @@ int i = 0; ff_hevc_dsp_init_arm(hevcdsp, bit_depth); #elif ARCH_PPC ff_hevc_dsp_init_ppc(hevcdsp, bit_depth); +#elif ARCH_RISCV +ff_hevc_dsp_init_riscv(hevcdsp, bit_depth); #elif ARCH_WASM ff_hevc_dsp_init_wasm(hevcdsp, bit_depth); #elif ARCH_X86 diff --git a/libavcodec/hevc/dsp.h b/libavcodec/hevc/dsp.h index 4277d695ba..a63586c3a2 100644 --- a/libavcodec/hevc/dsp.h +++ b/libavcodec/hevc/dsp.h @@ -133,6 +133,7 @@ extern const int8_t ff_hevc_qpel_filters[4][16]; void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth); void ff_hevc_dsp_init_arm(HEVCDSPContext *c, const int bit_depth); void ff_hevc_dsp_init_ppc(HEVCDSPContext *c, const int bit_depth); +void ff_hevc_dsp_init_riscv(HEVCDSPContext *c, const int bit_depth); void ff_hevc_dsp_init_wasm(HEVCDSPContext *c, const int bit_depth); void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth); void ff_hevc_dsp_init_mips(HEVCDSPContext *c, const int bit_depth); diff --git a/libavcodec/riscv/Makefile b/libavcodec/riscv/Makefile index 1f1fa03329..a80d2fa2e7 100644 --- a/libavcodec/riscv/Makefile +++ b/libavcodec/riscv/Makefile @@ -35,6 +35,8 @@ RVV-OBJS-$(CONFIG_H264DSP) += riscv/h264addpx_rvv.o riscv/h264dsp_rvv.o \ riscv/h264idct_rvv.o OBJS-$(CONFIG_H264QPEL) += riscv/h264qpel_init.o RVV-OBJS-$(CONFIG_H264QPEL) += riscv/h264qpel_rvv.o +OBJS-$(CONFIG_HEVC_DECODER) += riscv/hevcdsp_init.o +RVV-OBJS-$(CONFIG_HEVC_DECODER) += riscv/h26x/h2656_inter_rvv.o OBJS-$(CONFIG_HUFFYUV_DECODER) += riscv/huffyuvdsp_init.o RVV-OBJS-$(CONFIG_HUFFYUV_DECODER) += riscv/huffyuvdsp_rvv.o OBJS-$(CONFIG_IDCTDSP) += riscv/idctdsp_init.o diff --git a/libavcodec/riscv/h26x/h2656_inter_rvv.S b/libavcodec/riscv/h26x/h2656_inter_rvv.S new file mode 100644 index 00..9aba14ae2b --- /dev/null +++ b/libavcodec/riscv/h26x/h2656_inter_rvv.S @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2024 Institue of Software Chinese Academy of Sciences (ISCAS). + * + * 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 "libavcodec/riscv/h26x/asm.S" + +func_put_pixels 256, 64, h2656 +func_put_pixels 128, 64, h2656 diff --git a/libavcodec/riscv/hevcdsp_init.c b/libavcodec/riscv/hevcdsp_init.c new file mode 100644 index 00..1d8326a573 --- /dev/null +++ b/libavcodec/riscv/hevcdsp_init.c @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2024 Institue of Software Chinese Academy of Sciences (ISCAS). + * + * 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 + * MERCHANT
Re: [FFmpeg-devel] [PATCH v2_2 1/6] Update R-V V vvc_mc vset to support more lengths
Resolved the conflict (because #elif ARCH_WASM was newly added in master). 于2024年12月15日周日 23:56写道: > From: sunyuechi > > --- > libavcodec/riscv/vvc/vvc_mc_rvv.S | 46 +++ > 1 file changed, 23 insertions(+), 23 deletions(-) > > diff --git a/libavcodec/riscv/vvc/vvc_mc_rvv.S > b/libavcodec/riscv/vvc/vvc_mc_rvv.S > index 45f4750f82..18532616d9 100644 > --- a/libavcodec/riscv/vvc/vvc_mc_rvv.S > +++ b/libavcodec/riscv/vvc/vvc_mc_rvv.S > @@ -23,25 +23,25 @@ > .macro vsetvlstatic8 w, vlen > .if \w == 2 && \vlen == 128 > vsetivlizero, \w, e8, mf8, ta, ma > -.elseif \w == 4 && \vlen == 128 > +.elseif \w <= 4 && \vlen == 128 > vsetivlizero, \w, e8, mf4, ta, ma > -.elseif \w == 8 && \vlen == 128 > +.elseif \w <= 8 && \vlen == 128 > vsetivlizero, \w, e8, mf2, ta, ma > -.elseif \w == 16 && \vlen == 128 > +.elseif \w <= 16 && \vlen == 128 > vsetivlizero, \w, e8, m1, ta, ma > -.elseif \w == 32 && \vlen == 128 > +.elseif \w <= 32 && \vlen == 128 > li t0, \w > vsetvli zero, t0, e8, m2, ta, ma > .elseif \w <= 4 && \vlen == 256 > vsetivlizero, \w, e8, mf8, ta, ma > -.elseif \w == 8 && \vlen == 256 > +.elseif \w <= 8 && \vlen == 256 > vsetivlizero, \w, e8, mf4, ta, ma > -.elseif \w == 16 && \vlen == 256 > +.elseif \w <= 16 && \vlen == 256 > vsetivlizero, \w, e8, mf2, ta, ma > -.elseif \w == 32 && \vlen == 256 > +.elseif \w <= 32 && \vlen == 256 > li t0, \w > vsetvli zero, t0, e8, m1, ta, ma > -.elseif \w == 64 && \vlen == 256 > +.elseif \w <= 64 && \vlen == 256 > li t0, \w > vsetvli zero, t0, e8, m2, ta, ma > .else > @@ -53,25 +53,25 @@ > .macro vsetvlstatic16 w, vlen > .if \w == 2 && \vlen == 128 > vsetivlizero, \w, e16, mf4, ta, ma > -.elseif \w == 4 && \vlen == 128 > +.elseif \w <= 4 && \vlen == 128 > vsetivlizero, \w, e16, mf2, ta, ma > -.elseif \w == 8 && \vlen == 128 > +.elseif \w <= 8 && \vlen == 128 > vsetivlizero, \w, e16, m1, ta, ma > -.elseif \w == 16 && \vlen == 128 > +.elseif \w <= 16 && \vlen == 128 > vsetivlizero, \w, e16, m2, ta, ma > -.elseif \w == 32 && \vlen == 128 > +.elseif \w <= 32 && \vlen == 128 > li t0, \w > vsetvli zero, t0, e16, m4, ta, ma > .elseif \w <= 4 && \vlen == 256 > vsetivlizero, \w, e16, mf4, ta, ma > -.elseif \w == 8 && \vlen == 256 > +.elseif \w <= 8 && \vlen == 256 > vsetivlizero, \w, e16, mf2, ta, ma > -.elseif \w == 16 && \vlen == 256 > +.elseif \w <= 16 && \vlen == 256 > vsetivlizero, \w, e16, m1, ta, ma > -.elseif \w == 32 && \vlen == 256 > +.elseif \w <= 32 && \vlen == 256 > li t0, \w > vsetvli zero, t0, e16, m2, ta, ma > -.elseif \w == 64 && \vlen == 256 > +.elseif \w <= 64 && \vlen == 256 > li t0, \w > vsetvli zero, t0, e16, m4, ta, ma > .else > @@ -83,19 +83,19 @@ > .macro vsetvlstatic32 w, vlen > .if \w == 2 > vsetivlizero, \w, e32, mf2, ta, ma > -.elseif \w == 4 && \vlen == 128 > +.elseif \w <= 4 && \vlen == 128 > vsetivlizero, \w, e32, m1, ta, ma > -.elseif \w == 8 && \vlen == 128 > +.elseif \w <= 8 && \vlen == 128 > vsetivlizero, \w, e32, m2, ta, ma > -.elseif \w == 16 && \vlen == 128 > +.elseif \w <= 16 && \vlen == 128 > vsetivlizero, \w, e32, m4, ta, ma > -.elseif \w == 4 && \vlen == 256 > +.elseif \w <= 4 && \vlen == 256 > vsetivlizero, \w, e32, mf2, ta, ma > -.elseif \w == 8 && \vlen == 256 > +.elseif \w <= 8 && \vlen == 256 > vsetivlizero, \w, e32, m1, ta, ma > -.elseif \w == 16 && \vlen == 256 > +.elseif \w <= 16 && \vlen == 256 > vsetivlizero, \w, e32, m2, ta, ma > -.elseif \w == 32 && \vlen == 256 > +.elseif \w <= 32 && \vlen == 256 > li t0, \w > vsetvli zero, t0, e32, m4, ta, ma > .else > -- > 2.47.1 > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org >
Re: [FFmpeg-devel] [PATCH v2 1/6] Update R-V V vvc_mc vset to support more lengths
On Sat, Dec 14, 2024 at 10:43 AM Nuo Mi wrote: > > > On Tue, Dec 10, 2024 at 10:37 PM flow gg wrote: > >> Thank you, this approach can indeed address similar if else scenarios. >> >> vsetvlstatic \w, \vlen, e8, mf8, mf4, mf2, m1, m2, m4 >> vsetvlstatic \w, \vlen, e16, mf4, mf2, m1, m2, m4, m8 >> vsetvlstatic \w, \vlen, e32, mf2, m1, m2, m4, m8, m8 >> >> I plan to submit it after this patch set gets merged. >> > Sure, will merge this in 2 days if no objections. > Hi Yuechi, The patch set has conflicts with the master branch. Could you help rebase it? Thank you > > Thank you. > >> >> Nuo Mi 于2024年12月10日周二 21:52写道: >> >> > Hi Yuechi, >> > The performance is good. >> > >> > There are many similar .if blocks in vsetvlstatic8, vsetvlstatic16, and >> > vsetvlstatic32. >> > Could we define an intermediate macro, vsetvlstatic, and use it to >> > implement the above macros? >> > like: >> > .macro vsetvlstatic8 w, vlen >> > vsetvlstatic 8, w, vlen, mf8, mf4, mf2, m1, m2, m3, m4 >> > .endm >> > >> > This can be addressed with another patch set. >> > >> > On Sun, Dec 1, 2024 at 1:11 PM wrote: >> > >> > > From: sunyuechi >> > > >> > > --- >> > > libavcodec/riscv/vvc/vvc_mc_rvv.S | 46 >> +++ >> > > 1 file changed, 23 insertions(+), 23 deletions(-) >> > > >> > > diff --git a/libavcodec/riscv/vvc/vvc_mc_rvv.S >> > > b/libavcodec/riscv/vvc/vvc_mc_rvv.S >> > > index 45f4750f82..18532616d9 100644 >> > > --- a/libavcodec/riscv/vvc/vvc_mc_rvv.S >> > > +++ b/libavcodec/riscv/vvc/vvc_mc_rvv.S >> > > @@ -23,25 +23,25 @@ >> > > .macro vsetvlstatic8 w, vlen >> > > .if \w == 2 && \vlen == 128 >> > > vsetivlizero, \w, e8, mf8, ta, ma >> > > -.elseif \w == 4 && \vlen == 128 >> > > +.elseif \w <= 4 && \vlen == 128 >> > > vsetivlizero, \w, e8, mf4, ta, ma >> > > -.elseif \w == 8 && \vlen == 128 >> > > +.elseif \w <= 8 && \vlen == 128 >> > > vsetivlizero, \w, e8, mf2, ta, ma >> > > -.elseif \w == 16 && \vlen == 128 >> > > +.elseif \w <= 16 && \vlen == 128 >> > > vsetivlizero, \w, e8, m1, ta, ma >> > > -.elseif \w == 32 && \vlen == 128 >> > > +.elseif \w <= 32 && \vlen == 128 >> > > li t0, \w >> > > vsetvli zero, t0, e8, m2, ta, ma >> > > .elseif \w <= 4 && \vlen == 256 >> > > vsetivlizero, \w, e8, mf8, ta, ma >> > > -.elseif \w == 8 && \vlen == 256 >> > > +.elseif \w <= 8 && \vlen == 256 >> > > vsetivlizero, \w, e8, mf4, ta, ma >> > > -.elseif \w == 16 && \vlen == 256 >> > > +.elseif \w <= 16 && \vlen == 256 >> > > vsetivlizero, \w, e8, mf2, ta, ma >> > > -.elseif \w == 32 && \vlen == 256 >> > > +.elseif \w <= 32 && \vlen == 256 >> > > li t0, \w >> > > vsetvli zero, t0, e8, m1, ta, ma >> > > -.elseif \w == 64 && \vlen == 256 >> > > +.elseif \w <= 64 && \vlen == 256 >> > > li t0, \w >> > > vsetvli zero, t0, e8, m2, ta, ma >> > > .else >> > > @@ -53,25 +53,25 @@ >> > > .macro vsetvlstatic16 w, vlen >> > > .if \w == 2 && \vlen == 128 >> > > vsetivlizero, \w, e16, mf4, ta, ma >> > > -.elseif \w == 4 && \vlen == 128 >> > > +.elseif \w <= 4 && \vlen == 128 >> > > vsetivlizero, \w, e16, mf2, ta, ma >> > > -.elseif \w == 8 && \vlen == 128 >> > > +.elseif \w <= 8 && \vlen == 128 >> > > vsetivlizero, \w, e16, m1, ta, ma >> > > -.elseif \w == 16 && \vlen == 128 >> > > +.elseif \w <= 16 && \vlen == 128 >> > > vsetivlizero, \w, e16, m2, ta, ma >> > > -.elseif \w == 32 && \vlen == 128 >> > > +.elseif \w <= 32 && \vlen == 128 >> > > li t0, \w >> > > vsetvli zero, t0, e16, m4, ta, ma >> > > .elseif \w <= 4 && \vlen == 256 >> > > vsetivlizero, \w, e16, mf4, ta, ma >> > > -.elseif \w == 8 && \vlen == 256 >> > > +.elseif \w <= 8 && \vlen == 256 >> > > vsetivlizero, \w, e16, mf2, ta, ma >> > > -.elseif \w == 16 && \vlen == 256 >> > > +.elseif \w <= 16 && \vlen == 256 >> > > vsetivlizero, \w, e16, m1, ta, ma >> > > -.elseif \w == 32 && \vlen == 256 >> > > +.elseif \w <= 32 && \vlen == 256 >> > > li t0, \w >> > > vsetvli zero, t0, e16, m2, ta, ma >> > > -.elseif \w == 64 && \vlen == 256 >> > > +.elseif \w <= 64 && \vlen == 256 >> > > li t0, \w >> > > vse
Re: [FFmpeg-devel] [PATCH v2 2/3] avcodec/rawenc: propagate the Producer Reference time
Hi Michael, On Fri, 29 Nov 2024 at 20:22, Michael Niedermayer wrote: > > Hi > > On Fri, Nov 01, 2024 at 06:21:23PM +0100, Clément Péron wrote: > > The Producer Reference time contains the source time when the frame > > has been produced. This is usefull in the muxer so propagate it. > > > > Signed-off-by: Clément Péron > > --- > > libavcodec/rawenc.c | 12 > > 1 file changed, 12 insertions(+) > > > > diff --git a/libavcodec/rawenc.c b/libavcodec/rawenc.c > > index 8c577006d9..f238c8e165 100644 > > --- a/libavcodec/rawenc.c > > +++ b/libavcodec/rawenc.c > > @@ -49,6 +49,8 @@ static av_cold int raw_encode_init(AVCodecContext *avctx) > > static int raw_encode(AVCodecContext *avctx, AVPacket *pkt, > >const AVFrame *frame, int *got_packet) > > { > > +AVFrameSideData *side_data; > > + > > int ret = av_image_get_buffer_size(frame->format, > > frame->width, frame->height, 1); > > > > @@ -78,6 +80,16 @@ static int raw_encode(AVCodecContext *avctx, AVPacket > > *pkt, > > } > > } > > *got_packet = 1; > > + > > +// Forward the PRFT to Mux > > +side_data = av_frame_get_side_data(frame, AV_FRAME_DATA_PRFT); > > +if (side_data && side_data->size) { > > +uint8_t *buf = av_packet_new_side_data(pkt, AV_PKT_DATA_PRFT, > > side_data->size); > > +if (!buf) > > +return AVERROR(ENOMEM); > > +memcpy(buf, side_data->data, side_data->size); > > +} > > It feels like there should be a simpler mechanism to forward side data > but if theres not, then this is probably ok assuming the addition of PRFT > and the rest of teh patchset is ok I look a bit more to make this series more acceptable and avoid this ugly code block. One candidate could have been the ff_sd_global_map, unfortunately there is no function that calls this map at each packet at the encoding stage. I would expect something like "ff_eencode_frame_props_from_frame()". I looked a bit in the Git history and saw some work in progress by Anton, maybe you have a better suggestion? I would be interested to have some kind of automatic side data forwarding between frame and packet at the encoding stage. Thanks for your help, Regards Clement > > thx > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > Those who are too smart to engage in politics are punished by being > governed by those who are dumber. -- Plato > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 0/7] RFC: complete rework of s337m support
Hi guys sorry for replying a little late to this, i just now was notifified or rather i just now noticed that i was. On Fri, Dec 13, 2024 at 11:00:43AM +0100, Nicolas George wrote: > Kieran Kunhya via ffmpeg-devel (12024-12-13): > > Where is the second sample rate stored in wav? Given that you know, that there is not a 2nd sample rate stored in wav, this is a provocative question. > > Nowhere, obviously. And thats the correct awnser. > I am surprised somebody who has been in the project > for more than 12 years still does not know how it works. And this is unneccessary and offensive. thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I have never wished to cater to the crowd; for what I know they do not approve, and what they approve I do not know. -- Epicurus signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v3 1/2] avcodec/libjxlenc: add animated JPEG XL encoder
libjxl supports animated encoding, so we add a wrapper to the library using the receive_packet callback method. This code was based largely on a patch sent by Zsolt Vadász, although it was updated to use more recent coding practices and many of the leaks and issues were fixed. Co-authored-by: Zsolt Vadász Signed-off-by: Leo Izen --- configure | 2 + libavcodec/allcodecs.c | 2 + libavcodec/codec_desc.c| 8 + libavcodec/codec_id.h | 1 + libavcodec/jpegxl_parser.c | 2 +- libavcodec/libjxldec.c | 16 ++ libavcodec/libjxlenc.c | 392 - 7 files changed, 330 insertions(+), 93 deletions(-) diff --git a/configure b/configure index bf55ba67fa..44297285f5 100755 --- a/configure +++ b/configure @@ -3558,6 +3558,8 @@ libgsm_ms_decoder_deps="libgsm" libgsm_ms_encoder_deps="libgsm" libilbc_decoder_deps="libilbc" libilbc_encoder_deps="libilbc" +libjxl_anim_decoder_deps="libjxl libjxl_threads" +libjxl_anim_encoder_deps="libjxl libjxl_threads" libjxl_decoder_deps="libjxl libjxl_threads" libjxl_encoder_deps="libjxl libjxl_threads" libkvazaar_encoder_deps="libkvazaar" diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 0b559dfc58..4bc41239c7 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -777,6 +777,8 @@ extern const FFCodec ff_libgsm_ms_encoder; extern const FFCodec ff_libgsm_ms_decoder; extern const FFCodec ff_libilbc_encoder; extern const FFCodec ff_libilbc_decoder; +extern const FFCodec ff_libjxl_anim_decoder; +extern const FFCodec ff_libjxl_anim_encoder; extern const FFCodec ff_libjxl_decoder; extern const FFCodec ff_libjxl_encoder; extern const FFCodec ff_liblc3_encoder; diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index bc9163bf98..fc075ffd7f 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -1977,6 +1977,14 @@ static const AVCodecDescriptor codec_descriptors[] = { .long_name = NULL_IF_CONFIG_SMALL("RealVideo 6.0"), .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_REORDER, }, +{ +.id= AV_CODEC_ID_JPEGXL_ANIM, +.type = AVMEDIA_TYPE_VIDEO, +.name = "jpegxl_anim", +.long_name = NULL_IF_CONFIG_SMALL("JPEG XL animated"), +.props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS, +.mime_types= MT("image/jxl"), +}, /* various PCM "codecs" */ { diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h index 6bfaa02601..ba0480aa09 100644 --- a/libavcodec/codec_id.h +++ b/libavcodec/codec_id.h @@ -328,6 +328,7 @@ enum AVCodecID { AV_CODEC_ID_LEAD, AV_CODEC_ID_DNXUC, AV_CODEC_ID_RV60, +AV_CODEC_ID_JPEGXL_ANIM, /* various PCM "codecs" */ AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the start of audio codecs diff --git a/libavcodec/jpegxl_parser.c b/libavcodec/jpegxl_parser.c index 76122af54a..a888e9ae6e 100644 --- a/libavcodec/jpegxl_parser.c +++ b/libavcodec/jpegxl_parser.c @@ -1534,7 +1534,7 @@ flush: } const AVCodecParser ff_jpegxl_parser = { -.codec_ids = { AV_CODEC_ID_JPEGXL }, +.codec_ids = { AV_CODEC_ID_JPEGXL, AV_CODEC_ID_JPEGXL_ANIM }, .priv_data_size = sizeof(JXLParseContext), .parser_parse = jpegxl_parse, .parser_close = ff_parse_close, diff --git a/libavcodec/libjxldec.c b/libavcodec/libjxldec.c index 9dfc261e3d..96c338d1b4 100644 --- a/libavcodec/libjxldec.c +++ b/libavcodec/libjxldec.c @@ -549,3 +549,19 @@ const FFCodec ff_libjxl_decoder = { FF_CODEC_CAP_ICC_PROFILES, .p.wrapper_name = "libjxl", }; + +const FFCodec ff_libjxl_anim_decoder = { +.p.name = "libjxl_anim", +CODEC_LONG_NAME("libjxl JPEG XL animated"), +.p.type = AVMEDIA_TYPE_VIDEO, +.p.id = AV_CODEC_ID_JPEGXL_ANIM, +.priv_data_size = sizeof(LibJxlDecodeContext), +.init = libjxl_decode_init, +FF_CODEC_RECEIVE_FRAME_CB(libjxl_receive_frame), +.close= libjxl_decode_close, +.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_OTHER_THREADS, +.caps_internal= FF_CODEC_CAP_NOT_INIT_THREADSAFE | +FF_CODEC_CAP_AUTO_THREADS | FF_CODEC_CAP_INIT_CLEANUP | +FF_CODEC_CAP_ICC_PROFILES, +.p.wrapper_name = "libjxl", +}; diff --git a/libavcodec/libjxlenc.c b/libavcodec/libjxlenc.c index 8b0e60df6f..7e1abe385d 100644 --- a/libavcodec/libjxlenc.c +++ b/libavcodec/libjxlenc.c @@ -56,6 +56,12 @@ typedef struct LibJxlEncodeContext { int xyb; uint8_t *buffer; size_t buffer_size; +JxlPixelFormat jxl_fmt; + +/* animation stuff */ +AVFrame *frame; +AVFrame *prev; +int64_t duration; } LibJxlEncodeContext; /** @@ -87,9 +93,9 @@ static float quality_to_distance(float quality) } /** - * Initalize the encoder on a per-frame basis. All of these need to be set - * once each time the en
[FFmpeg-devel] [PATCH v3 0/2] Animated JPEG XL (via libjxl)
Changes since v2: - Replaced "goto end;" with "return ret;" when unnecessary - removed *data from JXLEncodeContext and added it as an argument to libjxl_preprocess_frame as that's the only place it was used - Added some comments Changes since v1: - Fixed FATE failures Leo Izen (2): avcodec/libjxlenc: add animated JPEG XL encoder avformat/jpegxl_anim_dec: use new animated JPEG XL codec ID configure| 2 + libavcodec/allcodecs.c | 2 + libavcodec/codec_desc.c | 8 + libavcodec/codec_id.h| 1 + libavcodec/jpegxl_parser.c | 2 +- libavcodec/libjxldec.c | 16 ++ libavcodec/libjxlenc.c | 392 --- libavformat/jpegxl_anim_dec.c| 2 +- tests/ref/fate/jxl-anim-demux-icos4d | 2 +- tests/ref/fate/jxl-anim-demux-newton | 2 +- 10 files changed, 333 insertions(+), 96 deletions(-) -- 2.47.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 11/14] avformat/rtmpproto: add more enhanced rtmp codecs
Hi On Thu, Dec 12, 2024 at 08:55:36PM +0100, Timo Rothenpieler wrote: > --- > libavformat/rtmpproto.c | 11 +-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c > index b3b1eedacb..a56fec759f 100644 > --- a/libavformat/rtmpproto.c > +++ b/libavformat/rtmpproto.c > @@ -356,9 +356,16 @@ static int gen_connect(URLContext *s, RTMPContext *rt) > > while(fourcc_data - rt->enhanced_codecs < fourcc_str_len) { > unsigned char fourcc[5]; > -if (!strncmp(fourcc_data, "hvc1", 4) || > +if (!strncmp(fourcc_data, "avc1", 4) || > +!strncmp(fourcc_data, "hvc1", 4) || > !strncmp(fourcc_data, "av01", 4) || > +!strncmp(fourcc_data, "vp09", 4) || > +!strncmp(fourcc_data, "mp4a", 4) || > +!strncmp(fourcc_data, "Opus", 4) || > +!strncmp(fourcc_data, "fLaC", 4) || > +!strncmp(fourcc_data, ".mp3", 4) || > +!strncmp(fourcc_data, "ac-3", 4) || > +!strncmp(fourcc_data, "ec-3", 4)) { > -!strncmp(fourcc_data, "vp09", 4)) { maybe this should be sorted alphabetically otherwise it should be fine thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you think the mosad wants you dead since a long time then you are either wrong or dead since a long time. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 06/14] avformat/flvenc: refactor fourcc writing
Hi Timo On Thu, Dec 12, 2024 at 08:55:31PM +0100, Timo Rothenpieler wrote: > --- > libavformat/flvenc.c | 96 ++-- > 1 file changed, 47 insertions(+), 49 deletions(-) > > diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c > index 21e2bca5be..fbe5416353 100644 > --- a/libavformat/flvenc.c > +++ b/libavformat/flvenc.c > @@ -493,6 +493,45 @@ static void write_metadata(AVFormatContext *s, unsigned > int ts) > avio_wb32(pb, flv->metadata_totalsize + 11); > } > > +static void write_codec_fourcc(AVIOContext *pb, enum AVCodecID codec_id) > +{ > +switch (codec_id) { > +case AV_CODEC_ID_AAC: > +avio_write(pb, "mp4a", 4); > +return; > +case AV_CODEC_ID_OPUS: > +avio_write(pb, "Opus", 4); > +return; > +case AV_CODEC_ID_FLAC: > +avio_write(pb, "fLaC", 4); > +return; > +case AV_CODEC_ID_MP3: > +avio_write(pb, ".mp3", 4); > +return; > +case AV_CODEC_ID_AC3: > +avio_write(pb, "ac-3", 4); > +return; > +case AV_CODEC_ID_EAC3: > +avio_write(pb, "ec-3", 4); > +return; > +case AV_CODEC_ID_H264: > +avio_write(pb, "avc1", 4); > +return; > +case AV_CODEC_ID_HEVC: > +avio_write(pb, "hvc1", 4); > +return; > +case AV_CODEC_ID_AV1: > +avio_write(pb, "av01", 4); > +return; > +case AV_CODEC_ID_VP9: > +avio_write(pb, "vp09", 4); > +return; > +default: > +av_log(NULL, AV_LOG_ERROR, "Invalid codec FourCC write > requested.\n"); > +av_assert0(0); > +} > +} from the commit message i would have thought i would see something similar to ff_codec_bmp_tags[] such a table is more compact and can be used in both directions thx [..] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User questions about the command line tools should be sent to the ffmpeg-user ML. And questions about how to use libav* should be sent to the libav-user ML. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 14/14] avformat/rtmpproto: reserve enough space for statusmsg
Hi On Thu, Dec 12, 2024 at 08:55:39PM +0100, Timo Rothenpieler wrote: > --- > libavformat/rtmpproto.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c > index a56fec759f..a5e877cc55 100644 > --- a/libavformat/rtmpproto.c > +++ b/libavformat/rtmpproto.c > @@ -2004,7 +2004,7 @@ static int send_invoke_response(URLContext *s, > RTMPPacket *pkt) > pp = spkt.data; > ff_amf_write_string(&pp, "onFCPublish"); > } else if (!strcmp(command, "publish")) { > -char statusmsg[128]; > +char statusmsg[160]; can you explain why this is enough and an example why the 128 was not (not important but if you have that info it would make the comit message more informative) thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB It is what and why we do it that matters, not just one of them. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org 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 14/14] avformat/rtmpproto: reserve enough space for statusmsg
Michael Niedermayer 於 2024年12月16日 週一,06:43寫道: > Hi > > On Thu, Dec 12, 2024 at 08:55:39PM +0100, Timo Rothenpieler wrote: > > --- > > libavformat/rtmpproto.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c > > index a56fec759f..a5e877cc55 100644 > > --- a/libavformat/rtmpproto.c > > +++ b/libavformat/rtmpproto.c > > @@ -2004,7 +2004,7 @@ static int send_invoke_response(URLContext *s, > RTMPPacket *pkt) > > pp = spkt.data; > > ff_amf_write_string(&pp, "onFCPublish"); > > } else if (!strcmp(command, "publish")) { > > -char statusmsg[128]; > > +char statusmsg[160]; > > can you explain why this is enough and an example why the 128 was not > (not important but if you have that info it would make the comit message > more informative) > > thx > > [...] > > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > It is what and why we do it that matters, not just one of them. > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 04/14] avformat/flvenc: remove !size check for audio packets
On 12/14/2024 5:49 PM, Timo Rothenpieler wrote: On 14.12.2024 10:16, Anton Khirnov wrote: This could use some explanation. I unfortunately don't remember the exact reason, but it ran into this check in normal operation, and empty audio packets are a perfectly valid thing to package. I think Opus or something generates them? The flac encoder generates a side data only packet as the very last packet that muxers are meant to use to write initialization data in place of the blank extradata generated during the encoder's init(). No idea if other encoders do the same, but afaik the only valid scenario for pkt->size == 0 is if pkt->side_data_elems != 0. OpenPGP_signature.asc Description: OpenPGP digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [ANNOUNCE] upcoming vote: CC election
Hi all, this is a reminder that the CC election starts tomorrow morning (CET), with the following candidates: * Vittorio Giovara * James Almer * Marth64 * Anton Khirnov * compn * Jean-Baptiste Kempf * Rémi Denis-Courmont Cheers, -- 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] [PATCH] Add SRV3 decoder/demuxer
This commit adds preliminary support for decoding the SRV3 subtitle format. SRV3 is the internal format YouTube uses for their captions. Supporting it in ffmpeg allows video players to play a significant subset of SRV3 mostly correctly by converting it to ASS. Currently the following features are unsupported: - Vertical text - Scrolling text - Ruby text - Background box support is janky These issues are mostly due to limitations of the ASSv3 format. --- This is my first time interacting with the ffmpeg-devel mailing list so please bear with me, I've been sitting on these changes for almost a year and only now managed to kind of overcome the intimidating nature of ffmpeg-devel. At first it seemed to me like the demuxer should take care of parsing the subtitle file so I did it this way and added opaque side data that contains pointers to an internal representation of SRV3 metadata. I don't know whether this is the right approach though, please correct me if it isn't. I haven't added tests since I haven't looked into how that would be done, but I've been using it in my mpv build for almost a year now and it seems to work fine. Although as if specifically to inconvenience me libass appears to have introduced what seems to be a bug into their background rendering that I just discovered as I'm writing this. I don't think this patch is at fault though. configure| 2 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/codec_desc.c | 7 + libavcodec/codec_id.h| 1 + libavcodec/packet.c | 2 + libavcodec/packet.h | 12 + libavcodec/srv3dec.c | 260 +++ libavformat/Makefile | 1 + libavformat/allformats.c | 1 + libavformat/srv3.h | 95 +++ libavformat/srv3dec.c| 542 +++ 12 files changed, 925 insertions(+) create mode 100644 libavcodec/srv3dec.c create mode 100644 libavformat/srv3.h create mode 100644 libavformat/srv3dec.c diff --git a/configure b/configure index bf55ba67fa..a61333a93d 100755 --- a/configure +++ b/configure @@ -3724,6 +3724,8 @@ wtv_demuxer_select="mpegts_demuxer riffdec" wtv_muxer_select="mpegts_muxer riffenc" xmv_demuxer_select="riffdec" xwma_demuxer_select="riffdec" +srv3_demuxer_deps="libxml2" +srv3_demuxer_select="srv3dec" # indevs / outdevs android_camera_indev_deps="android camera2ndk mediandk pthreads" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index c946444175..a89b5c27f2 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -707,6 +707,7 @@ OBJS-$(CONFIG_SP5X_DECODER)+= sp5xdec.o OBJS-$(CONFIG_SRGC_DECODER)+= mscc.o OBJS-$(CONFIG_SRT_DECODER) += srtdec.o ass.o htmlsubtitles.o OBJS-$(CONFIG_SRT_ENCODER) += srtenc.o ass_split.o +OBJS-$(CONFIG_SRV3_DECODER)+= srv3dec.o ass.o OBJS-$(CONFIG_STL_DECODER) += textdec.o ass.o OBJS-$(CONFIG_SUBRIP_DECODER) += srtdec.o ass.o htmlsubtitles.o OBJS-$(CONFIG_SUBRIP_ENCODER) += srtenc.o ass_split.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 0b559dfc58..7bb2a4170d 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -738,6 +738,7 @@ extern const FFCodec ff_webvtt_encoder; extern const FFCodec ff_webvtt_decoder; extern const FFCodec ff_xsub_encoder; extern const FFCodec ff_xsub_decoder; +extern const FFCodec ff_srv3_decoder; /* external libraries */ extern const FFCodec ff_aac_at_encoder; diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index bc9163bf98..2832e817b5 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -3634,6 +3634,13 @@ static const AVCodecDescriptor codec_descriptors[] = { .long_name = NULL_IF_CONFIG_SMALL("ARIB STD-B24 caption"), .profiles = NULL_IF_CONFIG_SMALL(ff_arib_caption_profiles), }, +{ +.id= AV_CODEC_ID_SRV3, +.type = AVMEDIA_TYPE_SUBTITLE, +.name = "srv3", +.long_name = NULL_IF_CONFIG_SMALL("SRV3 subtitle"), +.props = AV_CODEC_PROP_TEXT_SUB, +}, /* other kind of codecs and pseudo-codecs */ { diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h index 6bfaa02601..774de43f4d 100644 --- a/libavcodec/codec_id.h +++ b/libavcodec/codec_id.h @@ -579,6 +579,7 @@ enum AVCodecID { AV_CODEC_ID_HDMV_TEXT_SUBTITLE, AV_CODEC_ID_TTML, AV_CODEC_ID_ARIB_CAPTION, +AV_CODEC_ID_SRV3, /* other specific kind of codecs (generally used for attachments) */ AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs. diff --git a/libavcodec/packet.c b/libavcodec/packet.c index 5104eb98b1..c6425c8c1d 100644 --- a/libavcodec/packet.c +++ b/libavcodec/packet.c @@ -288,6 +288,8 @@ const char *av_packet_side_data_name(enum AVPacketSideDataType type) case AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL: return "Matroska Block
[FFmpeg-devel] [PATCH v3 2/2] avformat/jpegxl_anim_dec: use new animated JPEG XL codec ID
A new codec ID has been added to avcodec for animated JPEG XL, so we should use that in the animated JPEG XL demuxer. Signed-off-by: Leo Izen --- libavformat/jpegxl_anim_dec.c| 2 +- tests/ref/fate/jxl-anim-demux-icos4d | 2 +- tests/ref/fate/jxl-anim-demux-newton | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libavformat/jpegxl_anim_dec.c b/libavformat/jpegxl_anim_dec.c index 2338a2e8c0..612f8a9fb2 100644 --- a/libavformat/jpegxl_anim_dec.c +++ b/libavformat/jpegxl_anim_dec.c @@ -136,7 +136,7 @@ static int jpegxl_anim_read_header(AVFormatContext *s) return AVERROR(ENOMEM); st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; -st->codecpar->codec_id = AV_CODEC_ID_JPEGXL; +st->codecpar->codec_id = AV_CODEC_ID_JPEGXL_ANIM; avpriv_set_pts_info(st, 1, meta.timebase.num, meta.timebase.den); ffstream(st)->need_parsing = AVSTREAM_PARSE_FULL; diff --git a/tests/ref/fate/jxl-anim-demux-icos4d b/tests/ref/fate/jxl-anim-demux-icos4d index eff6ff1f1b..fc37b035a8 100644 --- a/tests/ref/fate/jxl-anim-demux-icos4d +++ b/tests/ref/fate/jxl-anim-demux-icos4d @@ -1,6 +1,6 @@ #tb 0: 1/1000 #media_type 0: video -#codec_id 0: jpegxl +#codec_id 0: jpegxl_anim #dimensions 0: 48x48 #sar 0: 0/1 0, 0, 0,0,67898, 0x53b6516b diff --git a/tests/ref/fate/jxl-anim-demux-newton b/tests/ref/fate/jxl-anim-demux-newton index 6fcb85c41e..8a44d8e255 100644 --- a/tests/ref/fate/jxl-anim-demux-newton +++ b/tests/ref/fate/jxl-anim-demux-newton @@ -1,6 +1,6 @@ #tb 0: 1/1000 #media_type 0: video -#codec_id 0: jpegxl +#codec_id 0: jpegxl_anim #dimensions 0: 128x96 #sar 0: 0/1 0, 0, 0,0,43376, 0xb2296182 -- 2.47.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] swscale/slice: fix init of 32 bpc planes
Hi Niklas On Wed, Dec 11, 2024 at 09:25:12AM +0100, Niklas Haas wrote: > From: Niklas Haas > > In input.c and output.c and many other places, swscale follows the rule of > using > 15-bit intermediate if output bpc is <= 8, and 19-bit (inside int32_t) > intermediate otherwise. See e.g. the comments on hyScale() on > swscale_internal.h. These are also the coefficients that > yuv2gbrpf32_full_X_c() > is using. > > In contrast to this, the plane init code in slice.c (function fill_ones) is > assuming that we use 35-bit intermediates (inside 64-bit integers) for this > case, seemingly added by commit b4967fc71c63eae8cd96f9c46cd3e1fbd705bbf9 with > no further justification. > > This causes a mismatch whenever the implicitly initialized plane contents leak > out to the output, e.g. when converting from grayscale to RGB. > > Fixes: ticket #10716 > Signed-off-by: Niklas Haas > Sponsored-by: Sovereign Tech Fund > --- > libswscale/slice.c | 6 +- > 1 file changed, 1 insertion(+), 5 deletions(-) ultimately 32bit on teh input or output side require more than 32bit internally to maintain precission. if this patch makes it all match up, its ok for now but 18bit dont seem enough for 32bit data thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB What is money laundering? Its paying someone and not telling the government. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v1] lavc/aarch64: Fix ff_pred8x8_plane_neon_10
Fix test failure on aarch64: ./tests/checkasm/checkasm --test=h264pred 479612 The mismatch between neon and C functions can also be reproduced using the following bitstream and command line. wget https://streams.videolan.org/ffmpeg/incoming/intra8x8pred_10bit.264 ./ffmpeg -cpuflags 0 -threads 1 -i intra8x8pred_10bit.264 -f framemd5 -y md5_ref ./ffmpeg -threads 1 -i intra8x8pred_10bit.264 -f framemd5 -y md5_neon Signed-off-by: Bin Peng --- libavcodec/aarch64/h264pred_neon.S | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavcodec/aarch64/h264pred_neon.S b/libavcodec/aarch64/h264pred_neon.S index ea37689f34..168f8191ad 100644 --- a/libavcodec/aarch64/h264pred_neon.S +++ b/libavcodec/aarch64/h264pred_neon.S @@ -595,12 +595,11 @@ function ff_pred8x8_plane_neon_10, export=1 ssubl v2.4s, v2.4h, v3.4h ext v0.16b, v0.16b, v0.16b, #14 mov v0.h[0], wzr -mul v0.8h, v0.8h, v5.h[0] dup v1.4s, v2.s[0] dup v2.4s, v2.s[0] dup v3.8h, v5.h[1] -saddw v1.4s, v1.4s, v0.4h -saddw2 v2.4s, v2.4s, v0.8h +smlal v1.4s, v0.4h, v5.h[0] +smlal2 v2.4s, v0.8h, v5.h[0] mov w3, #8 mvniv4.8h, #0xFC, lsl #8 // 1023 for clipping 1: -- 2.25.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] SCaLE booth
Hi Rémi! On 2024-11-19 19:10 +0200, Rémi Denis-Courmont wrote: > > I plan to solicit an FFmpeg booth at SCaLE 22x to be held early next March. > Booths for open-source communities are free and include 5 full conference > passes. The exhibition area is open, and needs to be manned, on Friday > afternoon (14-18), Saturday (10-18) and Sunday morning (10-14). > > If anyone is interested in participating, please contact me off list. Please > note that: > 1) Although I don't expect any issue, this is not confirmed yet. > 2) SCaLE will not sponsor anyone. If you need sponsorship, please check with > FFmpeg's treasurer (who is not me). Sounds cool! Did you ask for a both? If you did it would be best to add an entry in the conferences page: https://trac.ffmpeg.org/wiki/Conferences Greetings, Alexander ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/5] lavc/container_fifo: move to lavu and make public
On 2024-12-11 15:05 +0100, Anton Khirnov wrote: > This can be useful in other places, e.g. it can replace objpool in > fftools. > > The API is modified in the following nontrivial ways: > * opaque pointers can be passed through to all user callbacks > * read and write were previously separate callbacks in order to > accomodate the caller wishing to write a new reference to the FIFO and > keep the original one; the two callbacks are now merged into one, and > a flags argument is added that allows to request such behaviour on a > per-call basis > * new peek and drain functions > --- > doc/APIchanges | 5 +- > libavcodec/Makefile| 2 +- > libavcodec/container_fifo.h| 89 -- > libavcodec/hevc/hevcdec.c | 10 +- > libavcodec/hevc/hevcdec.h | 2 +- > libavcodec/hevc/refs.c | 4 +- > libavutil/Makefile | 2 + > {libavcodec => libavutil}/container_fifo.c | 116 ++ > libavutil/container_fifo.h | 130 + > 9 files changed, 215 insertions(+), 145 deletions(-) > delete mode 100644 libavcodec/container_fifo.h > rename {libavcodec => libavutil}/container_fifo.c (51%) > create mode 100644 libavutil/container_fifo.h > > diff --git a/doc/APIchanges b/doc/APIchanges > index 13789fcea4..5d75b6077d 100644 > --- a/doc/APIchanges > +++ b/doc/APIchanges > @@ -2,10 +2,13 @@ The last version increases of all libraries were on > 2024-03-07 > > API changes, most recent first: > > -2024-12-xx - xx - lavu 59.50.100 - refstruct.h > +2024-12-xx - xx - lavu 59.50.100 - refstruct.h container_fifo.h >Add a new public header refstruct.h with new API for >reference-counted objects. > > + Add a new public header container_fifo.h with new API for > + a FIFO of container objects (e.g. AVFrame or AVPacket). I see this was already pushed. I wanted to comment mainly because of the naming. Didn't deeply check the series as a whole, but AFAICS it looks legit. I find the "container" part of the naming consusing, especially in a multimedia project. Didn't yet have brilliant ideas. Some suggestions to get started follow in no particular order: * objpool_fifo * reusable_obj_fifo * refstruct_fifo Best regards, Alexander ___ 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] lavc/videotoolboxenc: Add spatial_aq option
Hi On Fri, Dec 13, 2024 at 04:26:58PM +0100, Dennis Sädtler via ffmpeg-devel wrote: > From: Dennis Sädtler > > Added in macOS 15 "Sequoia". > > Signed-off-by: Dennis Sädtler > --- > libavcodec/videotoolboxenc.c | 12 > 1 file changed, 12 insertions(+) > > diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c > index da7b291b03..fb2de7b960 100644 > --- a/libavcodec/videotoolboxenc.c > +++ b/libavcodec/videotoolboxenc.c > @@ -121,6 +121,7 @@ static struct{ > CFStringRef > kVTCompressionPropertyKey_PrioritizeEncodingSpeedOverQuality; > CFStringRef kVTCompressionPropertyKey_ConstantBitRate; > CFStringRef kVTCompressionPropertyKey_EncoderID; > +CFStringRef kVTCompressionPropertyKey_SpatialAdaptiveQPLevel; > CFStringRef > kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder; > CFStringRef > kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder; This patch is corrupted by line breaks please make sure your editor and MUA dont break lines of patches or use git send-email thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Modern terrorism, a quick summary: Need oil, start war with country that has oil, kill hundread thousand in war. Let country fall into chaos, be surprised about raise of fundamantalists. Drop more bombs, kill more people, be surprised about them taking revenge and drop even more bombs and strip your own citizens of their rights and freedoms. to be continued signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".