[FFmpeg-cvslog] lavc/qsvenc: specify codec name when print profile
ffmpeg | branch: master | Zhong Li | Tue Dec 21 23:18:06 2021 +0800| [0598b38e9316391c76da24cc0f8c11d5e0292ae7] | committer: Haihao Xiang lavc/qsvenc: specify codec name when print profile It is more clear and easily to detect the issues similar to commit 3857ecbe70e81cb6ad7a7f155c311e8522b93b3e Signed-off-by: Zhong Li Signed-off-by: Haihao Xiang > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0598b38e9316391c76da24cc0f8c11d5e0292ae7 --- libavcodec/qsvenc.c | 38 +++--- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 92a8b49fe3..be5a541409 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -47,41 +47,41 @@ struct profile_names { }; static const struct profile_names avc_profiles[] = { -{ MFX_PROFILE_AVC_BASELINE, "baseline" }, -{ MFX_PROFILE_AVC_MAIN, "main" }, -{ MFX_PROFILE_AVC_EXTENDED, "extended" }, -{ MFX_PROFILE_AVC_HIGH, "high" }, +{ MFX_PROFILE_AVC_BASELINE, "avc baseline" }, +{ MFX_PROFILE_AVC_MAIN, "avc main" }, +{ MFX_PROFILE_AVC_EXTENDED, "avc extended" }, +{ MFX_PROFILE_AVC_HIGH, "avc high" }, #if QSV_VERSION_ATLEAST(1, 15) -{ MFX_PROFILE_AVC_HIGH_422, "high 422" }, +{ MFX_PROFILE_AVC_HIGH_422, "avc high 422" }, #endif #if QSV_VERSION_ATLEAST(1, 4) -{ MFX_PROFILE_AVC_CONSTRAINED_BASELINE, "constrained baseline" }, -{ MFX_PROFILE_AVC_CONSTRAINED_HIGH, "constrained high" }, -{ MFX_PROFILE_AVC_PROGRESSIVE_HIGH, "progressive high" }, +{ MFX_PROFILE_AVC_CONSTRAINED_BASELINE, "avc constrained baseline" }, +{ MFX_PROFILE_AVC_CONSTRAINED_HIGH, "avc constrained high" }, +{ MFX_PROFILE_AVC_PROGRESSIVE_HIGH, "avc progressive high" }, #endif }; static const struct profile_names mpeg2_profiles[] = { -{ MFX_PROFILE_MPEG2_SIMPLE, "simple"}, -{ MFX_PROFILE_MPEG2_MAIN, "main" }, -{ MFX_PROFILE_MPEG2_HIGH, "high" }, +{ MFX_PROFILE_MPEG2_SIMPLE, "mpeg2 simple" }, +{ MFX_PROFILE_MPEG2_MAIN, "mpeg2 main" }, +{ MFX_PROFILE_MPEG2_HIGH, "mpeg2 high" }, }; static const struct profile_names hevc_profiles[] = { #if QSV_VERSION_ATLEAST(1, 8) -{ MFX_PROFILE_HEVC_MAIN,"main" }, -{ MFX_PROFILE_HEVC_MAIN10, "main10"}, -{ MFX_PROFILE_HEVC_MAINSP, "mainsp"}, -{ MFX_PROFILE_HEVC_REXT,"rext" }, +{ MFX_PROFILE_HEVC_MAIN,"hevc main" }, +{ MFX_PROFILE_HEVC_MAIN10, "hevc main10"}, +{ MFX_PROFILE_HEVC_MAINSP, "hevc mainsp"}, +{ MFX_PROFILE_HEVC_REXT,"hevc rext" }, #endif }; static const struct profile_names vp9_profiles[] = { #if QSV_VERSION_ATLEAST(1, 19) -{ MFX_PROFILE_VP9_0,"0" }, -{ MFX_PROFILE_VP9_1,"1" }, -{ MFX_PROFILE_VP9_2,"2" }, -{ MFX_PROFILE_VP9_3,"3" }, +{ MFX_PROFILE_VP9_0,"vp9 0" }, +{ MFX_PROFILE_VP9_1,"vp9 1" }, +{ MFX_PROFILE_VP9_2,"vp9 2" }, +{ MFX_PROFILE_VP9_3,"vp9 3" }, #endif }; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] libavutil/hwcontext_qsv: clean padding when upload qsv frames
ffmpeg | branch: master | Wenbin Chen | Thu Dec 23 10:26:37 2021 +0800| [ed6c5c13b10930ea95c622d6ef6e32a6e2077018] | committer: Haihao Xiang libavutil/hwcontext_qsv: clean padding when upload qsv frames Fix #7830 When we upload a frame that is not padded as MSDK requires, we create a new AVFrame to copy data. The frame's padding data is uninitialized so it brings run to run problem. For example, If we run the following command serveral times we will get different outputs. ffmpeg -init_hw_device qsv=qsv:hw -qsv_device /dev/dri/renderD128 \ -filter_hw_device qsv -f rawvideo -s 192x200 -pix_fmt p010 \ -i 192x200_P010.yuv -vf "format=nv12,hwupload=extra_hw_frames=16" \ -c:v hevc_qsv output.265 According to https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md#encoding-procedures "Note: It is the application's responsibility to fill pixels outside of crop window when it is smaller than frame to be encoded. Especially in cases when crops are not aligned to minimum coding block size (16 for AVC, 8 for HEVC and VP9)" I add a function to fill padding area with border pixel to fix this run2run problem, and also move the new AVFrame to global structure to reduce redundant allocation operation to increase preformance. Signed-off-by: Wenbin Chen Signed-off-by: Haihao Xiang > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ed6c5c13b10930ea95c622d6ef6e32a6e2077018 --- libavutil/hwcontext_qsv.c | 96 --- 1 file changed, 83 insertions(+), 13 deletions(-) diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index a5d154a24d..853fb7f60d 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -47,6 +47,7 @@ #include "pixfmt.h" #include "pixdesc.h" #include "time.h" +#include "imgutils.h" #define QSV_VERSION_ATLEAST(MAJOR, MINOR) \ (MFX_VERSION_MAJOR > (MAJOR) || \ @@ -90,6 +91,7 @@ typedef struct QSVFramesContext { mfxExtOpaqueSurfaceAlloc opaque_alloc; mfxExtBuffer *ext_buffers[1]; +AVFrame realigned_tmp_frame; } QSVFramesContext; static const struct { @@ -137,6 +139,54 @@ static uint32_t qsv_get_d3d11va_bind_flags(int mem_type) } #endif +static int qsv_fill_border(AVFrame *dst, const AVFrame *src) +{ +const AVPixFmtDescriptor *desc; +int i, planes_nb = 0; +if (dst->format != src->format) +return AVERROR(EINVAL); + +desc = av_pix_fmt_desc_get(dst->format); + +for (i = 0; i < desc->nb_components; i++) +planes_nb = FFMAX(planes_nb, desc->comp[i].plane + 1); + +for (i = 0; i < planes_nb; i++) { +int sheight, dheight, y; +ptrdiff_t swidth = av_image_get_linesize(src->format, + src->width, + i); +ptrdiff_t dwidth = av_image_get_linesize(dst->format, + dst->width, + i); +const AVComponentDescriptor comp = desc->comp[i]; +if (swidth < 0 || dwidth < 0) { +av_log(NULL, AV_LOG_ERROR, "av_image_get_linesize failed\n"); +return AVERROR(EINVAL); +} +sheight = src->height; +dheight = dst->height; +if (i) { +sheight = AV_CEIL_RSHIFT(src->height, desc->log2_chroma_h); +dheight = AV_CEIL_RSHIFT(dst->height, desc->log2_chroma_h); +} +//fill right padding +for (y = 0; y < sheight; y++) { +void *line_ptr = dst->data[i] + y*dst->linesize[i] + swidth; +av_memcpy_backptr(line_ptr, + comp.depth > 8 ? 2 : 1, + dwidth - swidth); +} +//fill bottom padding +for (y = sheight; y < dheight; y++) { +memcpy(dst->data[i]+y*dst->linesize[i], + dst->data[i]+(sheight-1)*dst->linesize[i], + dwidth); +} +} +return 0; +} + static int qsv_device_init(AVHWDeviceContext *ctx) { AVQSVDeviceContext *hwctx = ctx->hwctx; @@ -220,6 +270,7 @@ static void qsv_frames_uninit(AVHWFramesContext *ctx) av_freep(&s->surface_ptrs); av_freep(&s->surfaces_internal); av_freep(&s->handle_pairs_internal); +av_frame_unref(&s->realigned_tmp_frame); av_buffer_unref(&s->child_frames_ref); } @@ -1014,12 +1065,13 @@ static int qsv_transfer_data_to(AVHWFramesContext *ctx, AVFrame *dst, QSVFramesContext *s = ctx->internal->priv; mfxFrameSurface1 in = {{ 0 }}; mfxFrameSurface1 *out = (mfxFrameSurface1*)dst->data[3]; +mfxFrameInfo tmp_info; mfxSyncPoint sync = NULL; mfxStatus err; int ret = 0; /* make a copy if the input is not padded as libmfx requires */ -AVFrame tmp_frame; +AVFrame *tmp_frame = &s->realigned_tmp_frame; const AVFrame *src_frame; int realigned = 0; @@ -1048,24 +1100,40 @@ static int qs
[FFmpeg-cvslog] lavc/qsvenc: enable lookahead for hevc encoding
ffmpeg | branch: master | Zhong Li | Tue Dec 21 23:22:25 2021 +0800| [7e4747ec504586658bf12a38c304659fa8d84a6a] | committer: Haihao Xiang lavc/qsvenc: enable lookahead for hevc encoding Update version based on the patch: https://patchwork.ffmpeg.org/project/ffmpeg/patch/20211009015949.1510-1-haihao.xi...@intel.com/ Signed-off-by: Daniel Socek Signed-off-by: Haihao Xiang Signed-off-by: Zhong Li > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7e4747ec504586658bf12a38c304659fa8d84a6a --- libavcodec/qsvenc.c | 10 ++ libavcodec/qsvenc_hevc.c | 3 +++ 2 files changed, 13 insertions(+) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index be5a541409..db6d397068 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -210,6 +210,11 @@ static void dump_video_param(AVCodecContext *avctx, QSVEncContext *q, av_log(avctx, AV_LOG_VERBOSE, "BufferSizeInKB: %"PRIu16"; InitialDelayInKB: %"PRIu16"; TargetKbps: %"PRIu16"; MaxKbps: %"PRIu16"; BRCParamMultiplier: %"PRIu16"\n", info->BufferSizeInKB, info->InitialDelayInKB, info->TargetKbps, info->MaxKbps, info->BRCParamMultiplier); +#if QSV_HAVE_LA +if (info->RateControlMethod == MFX_RATECONTROL_VBR && q->extbrc && q->look_ahead_depth > 0 ) { +av_log(avctx, AV_LOG_VERBOSE, "LookAheadDepth: %"PRIu16"\n",co2->LookAheadDepth); +} +#endif } else if (info->RateControlMethod == MFX_RATECONTROL_CQP) { av_log(avctx, AV_LOG_VERBOSE, "QPI: %"PRIu16"; QPP: %"PRIu16"; QPB: %"PRIu16"\n", info->QPI, info->QPP, info->QPB); @@ -742,6 +747,11 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) switch (q->param.mfx.RateControlMethod) { case MFX_RATECONTROL_CBR: case MFX_RATECONTROL_VBR: +#if QSV_HAVE_LA +if (q->extbrc) { +q->extco2.LookAheadDepth = q->look_ahead_depth; +} +#endif #if QSV_HAVE_VCM case MFX_RATECONTROL_VCM: #endif diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c index b7b2f5633e..5847ea21f7 100644 --- a/libavcodec/qsvenc_hevc.c +++ b/libavcodec/qsvenc_hevc.c @@ -235,6 +235,9 @@ static const AVOption options[] = { { "load_plugins", "A :-separate list of hexadecimal plugin UIDs to load in an internal session", OFFSET(qsv.load_plugins), AV_OPT_TYPE_STRING, { .str = "" }, 0, 0, VE }, +#if QSV_HAVE_LA +{ "look_ahead_depth", "Depth of look ahead in number frames, available when extbrc option is enabled", OFFSET(qsv.look_ahead_depth), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 100, VE }, +#endif { "profile", NULL, OFFSET(qsv.profile), AV_OPT_TYPE_INT, { .i64 = MFX_PROFILE_UNKNOWN }, 0, INT_MAX, VE, "profile" }, { "unknown", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_PROFILE_UNKNOWN }, INT_MIN, INT_MAX, VE, "profile" }, { "main",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_PROFILE_HEVC_MAIN }, INT_MIN, INT_MAX, VE, "profile" }, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec: [loongarch] Optimize vp8_lpf/mc with LSX.
ffmpeg | branch: master | yuanhecai | Sat Dec 18 22:27:54 2021 +0800| [72bcbe216ef3d47498392ed2bada83994cd9fc86] | committer: Michael Niedermayer avcodec: [loongarch] Optimize vp8_lpf/mc with LSX. ./ffmpeg -i ../9_vp8_1080p_30fps_2Mbps.webm -f rawvideo -y /dev/null -an before: 210fps after : 585fps Reviewed-by: Shiyou Yin Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=72bcbe216ef3d47498392ed2bada83994cd9fc86 --- libavcodec/loongarch/Makefile| 3 + libavcodec/loongarch/vp8_lpf_lsx.c | 591 + libavcodec/loongarch/vp8_mc_lsx.c| 951 +++ libavcodec/loongarch/vp8dsp_init_loongarch.c | 63 ++ libavcodec/loongarch/vp8dsp_loongarch.h | 90 +++ libavcodec/vp8dsp.c | 2 + libavcodec/vp8dsp.h | 1 + 7 files changed, 1701 insertions(+) diff --git a/libavcodec/loongarch/Makefile b/libavcodec/loongarch/Makefile index 30799e4e48..4e1d827e19 100644 --- a/libavcodec/loongarch/Makefile +++ b/libavcodec/loongarch/Makefile @@ -2,9 +2,12 @@ OBJS-$(CONFIG_H264CHROMA) += loongarch/h264chroma_init_loongarch.o OBJS-$(CONFIG_H264QPEL) += loongarch/h264qpel_init_loongarch.o OBJS-$(CONFIG_H264DSP)+= loongarch/h264dsp_init_loongarch.o OBJS-$(CONFIG_H264PRED) += loongarch/h264_intrapred_init_loongarch.o +OBJS-$(CONFIG_VP8_DECODER)+= loongarch/vp8dsp_init_loongarch.o LASX-OBJS-$(CONFIG_H264CHROMA)+= loongarch/h264chroma_lasx.o LASX-OBJS-$(CONFIG_H264QPEL) += loongarch/h264qpel_lasx.o LASX-OBJS-$(CONFIG_H264DSP) += loongarch/h264dsp_lasx.o \ loongarch/h264idct_lasx.o \ loongarch/h264_deblock_lasx.o LASX-OBJS-$(CONFIG_H264PRED) += loongarch/h264_intrapred_lasx.o +LSX-OBJS-$(CONFIG_VP8_DECODER)+= loongarch/vp8_mc_lsx.o \ + loongarch/vp8_lpf_lsx.o diff --git a/libavcodec/loongarch/vp8_lpf_lsx.c b/libavcodec/loongarch/vp8_lpf_lsx.c new file mode 100644 index 00..f0fc3f3a5b --- /dev/null +++ b/libavcodec/loongarch/vp8_lpf_lsx.c @@ -0,0 +1,591 @@ +/* + * Copyright (c) 2021 Loongson Technology Corporation Limited + * Contributed by Hecai Yuan + * + * 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/vp8dsp.h" +#include "vp8dsp_loongarch.h" +#include "libavutil/loongarch/loongson_intrinsics.h" + +#define VP8_LPF_FILTER4_4W(p1_in_out, p0_in_out, q0_in_out, q1_in_out, \ + mask_in, hev_in) \ +{ \ +__m128i p1_m, p0_m, q0_m, q1_m, q0_sub_p0, filt_sign; \ +__m128i filt, filt1, filt2, cnst4b, cnst3b; \ +__m128i q0_sub_p0_l, q0_sub_p0_h, filt_h, filt_l, cnst3h; \ +\ +p1_m = __lsx_vxori_b(p1_in_out, 0x80); \ +p0_m = __lsx_vxori_b(p0_in_out, 0x80); \ +q0_m = __lsx_vxori_b(q0_in_out, 0x80); \ +q1_m = __lsx_vxori_b(q1_in_out, 0x80); \ +filt = __lsx_vssub_b(p1_m, q1_m); \ +filt = filt & hev_in; \ +\ +q0_sub_p0 = __lsx_vsub_b(q0_m, p0_m); \ +filt_sign = __lsx_vslti_b(filt, 0); \ +\ +cnst3h = __lsx_vreplgr2vr_h(3); \ +q0_sub_p0_l = __lsx_vilvl_b(q0_sub_p0, q0_sub_p0); \ +q0_sub_p0_l = __lsx_vdp2_h_b(q0_sub_p0_l, cnst3h); \ +filt_l = __lsx_vilvl_b(filt_sign, filt);\ +filt_l = __lsx_vadd_h(filt_l, q0_sub_p0_l); \ +filt_l = __lsx_vsat_h(filt_l, 7);
[FFmpeg-cvslog] avcodec: [loongarch] Optimize vc1dsp with LASX.
ffmpeg | branch: master | Hao Chen | Sat Dec 18 22:27:57 2021 +0800| [60ead5cd68586d25bd6a0c285907f72b8a2534bf] | committer: Michael Niedermayer avcodec: [loongarch] Optimize vc1dsp with LASX. ./ffmpeg -i 11_wmv3_720p_24fps_7Mbps.wmv -f rawvideo -y /dev/null -an before:131fps after :229fps Reviewed-by: Shiyou Yin Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=60ead5cd68586d25bd6a0c285907f72b8a2534bf --- libavcodec/loongarch/Makefile|2 + libavcodec/loongarch/vc1dsp_init_loongarch.c | 67 ++ libavcodec/loongarch/vc1dsp_lasx.c | 1005 ++ libavcodec/loongarch/vc1dsp_loongarch.h | 79 ++ libavcodec/vc1dsp.c |2 + libavcodec/vc1dsp.h |1 + 6 files changed, 1156 insertions(+) diff --git a/libavcodec/loongarch/Makefile b/libavcodec/loongarch/Makefile index 4b83f20e92..baf5f92e84 100644 --- a/libavcodec/loongarch/Makefile +++ b/libavcodec/loongarch/Makefile @@ -4,12 +4,14 @@ OBJS-$(CONFIG_H264DSP)+= loongarch/h264dsp_init_loongarch.o OBJS-$(CONFIG_H264PRED) += loongarch/h264_intrapred_init_loongarch.o OBJS-$(CONFIG_VP8_DECODER)+= loongarch/vp8dsp_init_loongarch.o OBJS-$(CONFIG_VP9_DECODER)+= loongarch/vp9dsp_init_loongarch.o +OBJS-$(CONFIG_VC1DSP) += loongarch/vc1dsp_init_loongarch.o LASX-OBJS-$(CONFIG_H264CHROMA)+= loongarch/h264chroma_lasx.o LASX-OBJS-$(CONFIG_H264QPEL) += loongarch/h264qpel_lasx.o LASX-OBJS-$(CONFIG_H264DSP) += loongarch/h264dsp_lasx.o \ loongarch/h264idct_lasx.o \ loongarch/h264_deblock_lasx.o LASX-OBJS-$(CONFIG_H264PRED) += loongarch/h264_intrapred_lasx.o +LASX-OBJS-$(CONFIG_VC1_DECODER) += loongarch/vc1dsp_lasx.o LSX-OBJS-$(CONFIG_VP8_DECODER)+= loongarch/vp8_mc_lsx.o \ loongarch/vp8_lpf_lsx.o LSX-OBJS-$(CONFIG_VP9_DECODER)+= loongarch/vp9_mc_lsx.o \ diff --git a/libavcodec/loongarch/vc1dsp_init_loongarch.c b/libavcodec/loongarch/vc1dsp_init_loongarch.c new file mode 100644 index 00..e72a4a3203 --- /dev/null +++ b/libavcodec/loongarch/vc1dsp_init_loongarch.c @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2021 Loongson Technology Corporation Limited + * Contributed by Hao Chen + * + * 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/loongarch/cpu.h" +#include "libavutil/attributes.h" +#include "libavcodec/vc1dsp.h" +#include "vc1dsp_loongarch.h" + +#define FN_ASSIGN(OP, X, Y, INSN) \ +dsp->OP##vc1_mspel_pixels_tab[1][X+4*Y] = ff_##OP##vc1_mspel_mc##X##Y##INSN; \ +dsp->OP##vc1_mspel_pixels_tab[0][X+4*Y] = ff_##OP##vc1_mspel_mc##X##Y##_16##INSN + +#define FN_ASSIGN_V(OP, Y, INSN) \ +dsp->OP##vc1_mspel_pixels_tab[0][4*Y] = ff_##OP##vc1_mspel_mc0##Y##_16##INSN + +#define FN_ASSIGN_H(OP, X, INSN) \ +dsp->OP##vc1_mspel_pixels_tab[0][X] = ff_##OP##vc1_mspel_mc##X##0_16##INSN + +av_cold void ff_vc1dsp_init_loongarch(VC1DSPContext *dsp) +{ +int cpu_flags = av_get_cpu_flags(); + +if (have_lasx(cpu_flags)) { +dsp->vc1_inv_trans_8x8= ff_vc1_inv_trans_8x8_lasx; +dsp->vc1_inv_trans_4x8= ff_vc1_inv_trans_4x8_lasx; +dsp->vc1_inv_trans_8x4= ff_vc1_inv_trans_8x4_lasx; +dsp->vc1_inv_trans_4x4= ff_vc1_inv_trans_4x4_lasx; +dsp->vc1_inv_trans_8x8_dc = ff_vc1_inv_trans_8x8_dc_lasx; +dsp->vc1_inv_trans_4x8_dc = ff_vc1_inv_trans_4x8_dc_lasx; +dsp->vc1_inv_trans_8x4_dc = ff_vc1_inv_trans_8x4_dc_lasx; +dsp->vc1_inv_trans_4x4_dc = ff_vc1_inv_trans_4x4_dc_lasx; +FN_ASSIGN(put_, 1, 1, _lasx); +FN_ASSIGN(put_, 1, 2, _lasx); +FN_ASSIGN(put_, 1, 3, _lasx); +FN_ASSIGN(put_, 2, 1, _lasx); +FN_ASSIGN(put_, 2, 2, _lasx); +FN_ASSIGN(put_, 2, 3, _lasx); +FN_ASSIGN(put_, 3, 1, _lasx); +FN_ASSIGN(put_, 3, 2, _lasx); +FN_ASSIGN(put_, 3, 3, _lasx); +FN_ASSIGN_V(put_, 1, _lasx); +FN_ASSIGN_V(put_, 2, _lasx); +FN_ASSIGN_V(put_, 3, _lasx); +FN_ASSIGN_H(put_, 1
[FFmpeg-cvslog] avcodec/tiff: Pass max_pixels to mjpeg context
ffmpeg | branch: master | Michael Niedermayer | Fri Dec 17 20:43:15 2021 +0100| [d6c16f42ccebca917bb9861c619abcf71ab25762] | committer: Michael Niedermayer avcodec/tiff: Pass max_pixels to mjpeg context Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d6c16f42ccebca917bb9861c619abcf71ab25762 --- libavcodec/tiff.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 870e0666aa..9af602eef7 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -2155,6 +2155,7 @@ static av_cold int tiff_init(AVCodecContext *avctx) s->avctx_mjpeg->flags2 = avctx->flags2; s->avctx_mjpeg->dct_algo = avctx->dct_algo; s->avctx_mjpeg->idct_algo = avctx->idct_algo; +s->avctx_mjpeg->max_pixels = avctx->max_pixels; ret = avcodec_open2(s->avctx_mjpeg, codec, NULL); if (ret < 0) { return ret; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/tiff: Use ff_set_dimensions() for setting up mjpeg context dimensions
ffmpeg | branch: master | Michael Niedermayer | Fri Dec 17 20:52:32 2021 +0100| [cfa1f0e214d07f0fdc027f2ec760eb9fd3fac85e] | committer: Michael Niedermayer avcodec/tiff: Use ff_set_dimensions() for setting up mjpeg context dimensions sets coded_width / coded_height too to keep them consistent with width / height Fixes: OOM Fixes: 42263/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-565619113984 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cfa1f0e214d07f0fdc027f2ec760eb9fd3fac85e --- libavcodec/tiff.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 9af602eef7..60773d59ed 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -724,13 +724,14 @@ static int dng_decode_jpeg(AVCodecContext *avctx, AVFrame *frame, static int dng_decode_strip(AVCodecContext *avctx, AVFrame *frame) { TiffContext *s = avctx->priv_data; +int ret = ff_set_dimensions(s->avctx_mjpeg, s->width, s->height); + +if (ret < 0) +return ret; s->jpgframe->width = s->width; s->jpgframe->height = s->height; -s->avctx_mjpeg->width = s->width; -s->avctx_mjpeg->height = s->height; - return dng_decode_jpeg(avctx, frame, s->stripsize, 0, 0, s->width, s->height); } @@ -971,14 +972,14 @@ static int dng_decode_tiles(AVCodecContext *avctx, AVFrame *frame, int has_width_leftover, has_height_leftover; int tile_x = 0, tile_y = 0; int pos_x = 0, pos_y = 0; -int ret; +int ret = ff_set_dimensions(s->avctx_mjpeg, s->tile_width, s->tile_length); + +if (ret < 0) +return ret; s->jpgframe->width = s->tile_width; s->jpgframe->height = s->tile_length; -s->avctx_mjpeg->width = s->tile_width; -s->avctx_mjpeg->height = s->tile_length; - has_width_leftover = (s->width % s->tile_width != 0); has_height_leftover = (s->height % s->tile_length != 0); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/vqavideo: reset accounting on error
ffmpeg | branch: master | Michael Niedermayer | Sun Dec 19 22:26:00 2021 +0100| [d8ea7a67ba62f5d4520e75e56b9954d80e7ff223] | committer: Michael Niedermayer avcodec/vqavideo: reset accounting on error Fixes: Timeout (same growing chunk is decoded to failure repeatedly) Fixes: 42582/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VQA_fuzzer-6531195591065600 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d8ea7a67ba62f5d4520e75e56b9954d80e7ff223 --- libavcodec/vqavideo.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavcodec/vqavideo.c b/libavcodec/vqavideo.c index 7c1d42bcac..1d97855e60 100644 --- a/libavcodec/vqavideo.c +++ b/libavcodec/vqavideo.c @@ -608,13 +608,14 @@ static int vqa_decode_frame_pal8(VqaContext *s, AVFrame *frame) if (s->partial_countdown <= 0) { bytestream2_init(&s->gb, s->next_codebook_buffer, s->next_codebook_buffer_index); /* decompress codebook */ -if ((res = decode_format80(s, s->next_codebook_buffer_index, - s->codebook, s->codebook_size, 0)) < 0) -return res; +res = decode_format80(s, s->next_codebook_buffer_index, + s->codebook, s->codebook_size, 0); /* reset accounting */ s->next_codebook_buffer_index = 0; s->partial_countdown = s->partial_count; +if (res < 0) +return res; } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/mjpegdec: Fix exif rotation->displaymatrix conversion
ffmpeg | branch: master | Andreas Rheinhardt | Sat Dec 18 21:15:33 2021 +0100| [b8a4b273bea57c4004f2c90fd8a7618f3757eece] | committer: Andreas Rheinhardt avcodec/mjpegdec: Fix exif rotation->displaymatrix conversion The cases in which there was flipping together with a rotation that is not a multiple of the identity were wrong. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b8a4b273bea57c4004f2c90fd8a7618f3757eece --- libavcodec/mjpegdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 8b154ce0ab..0dbbc14bae 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -2896,14 +2896,14 @@ the_end: break; case 5: av_display_rotation_set(matrix, 90.0); -av_display_matrix_flip(matrix, 0, 1); +av_display_matrix_flip(matrix, 1, 0); break; case 6: av_display_rotation_set(matrix, 90.0); break; case 7: av_display_rotation_set(matrix, -90.0); -av_display_matrix_flip(matrix, 0, 1); +av_display_matrix_flip(matrix, 1, 0); break; case 8: av_display_rotation_set(matrix, -90.0); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] fftools/ffmpeg_filter: Fix autorotation
ffmpeg | branch: master | Andreas Rheinhardt | Sat Dec 18 21:40:26 2021 +0100| [4e21fff19d1df0ce75d0a19e44865be152197418] | committer: Andreas Rheinhardt fftools/ffmpeg_filter: Fix autorotation In case of an orthogonal transformation av_display_rotation_get() returns the (anticlockwise) degree that the unit vector in x-direction gets rotated by; get_rotation in cmdutils.c makes a clockwise degree out of this. So if one inserts a transpose filter corresponding to this degree, then the x-vector gets mapped correctly and there are two possibilities for image of the y-vector, namely the two unit vectors orthogonal to the image of the x-vector. E.g. if the x-vector gets rotated by 90° clockwise, then the two possibilities for the y-vector are the unit vector in x direction or its opposite. The latter case is a simple 90° rotation for both vectors* whereas the former is a simple 90° clockwise rotation followed by a horizontal flip. These two cases can be distinguished by looking at the x-coordinate of the image of the y-vector, i.e. by looking at displaymatrix[3]. Similarly for the case of a 270° clockwise rotation. These two cases were previously wrong (they were made to match wrongly parsed exif rotation tag values). *: For display matrices, the y-axis points downward. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4e21fff19d1df0ce75d0a19e44865be152197418 --- fftools/ffmpeg_filter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 501a0acd61..8c929ab9fa 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -761,12 +761,12 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter, theta = get_rotation(displaymatrix); if (fabs(theta - 90) < 1.0) { +ret = insert_filter(&last_filter, &pad_idx, "transpose", "clock"); if (displaymatrix[3] > 0) { ret = insert_filter(&last_filter, &pad_idx, "hflip", NULL); if (ret < 0) return ret; } -ret = insert_filter(&last_filter, &pad_idx, "transpose", "clock"); } else if (fabs(theta - 180) < 1.0) { if (displaymatrix[0] < 0) { ret = insert_filter(&last_filter, &pad_idx, "hflip", NULL); @@ -777,12 +777,12 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter, ret = insert_filter(&last_filter, &pad_idx, "vflip", NULL); } } else if (fabs(theta - 270) < 1.0) { +ret = insert_filter(&last_filter, &pad_idx, "transpose", "cclock"); if (displaymatrix[3] < 0) { ret = insert_filter(&last_filter, &pad_idx, "hflip", NULL); if (ret < 0) return ret; } -ret = insert_filter(&last_filter, &pad_idx, "transpose", "cclock"); } else if (fabs(theta) > 1.0) { char rotate_buf[64]; snprintf(rotate_buf, sizeof(rotate_buf), "%f*PI/180", theta); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] fftools/ffmpeg_filter: Avoid inserting hflip filter
ffmpeg | branch: master | Andreas Rheinhardt | Sat Dec 18 23:19:05 2021 +0100| [04133eb2d5c794a077125fbbf9b880060f2123a1] | committer: Andreas Rheinhardt fftools/ffmpeg_filter: Avoid inserting hflip filter The transpose filter has modes equivalent to "rotation by 90°/270°" followed by horizontal flips. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=04133eb2d5c794a077125fbbf9b880060f2123a1 --- fftools/ffmpeg_filter.c | 16 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 8c929ab9fa..1f6cba2c04 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -761,12 +761,8 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter, theta = get_rotation(displaymatrix); if (fabs(theta - 90) < 1.0) { -ret = insert_filter(&last_filter, &pad_idx, "transpose", "clock"); -if (displaymatrix[3] > 0) { -ret = insert_filter(&last_filter, &pad_idx, "hflip", NULL); -if (ret < 0) -return ret; -} +ret = insert_filter(&last_filter, &pad_idx, "transpose", +displaymatrix[3] > 0 ? "cclock_flip" : "clock"); } else if (fabs(theta - 180) < 1.0) { if (displaymatrix[0] < 0) { ret = insert_filter(&last_filter, &pad_idx, "hflip", NULL); @@ -777,12 +773,8 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter, ret = insert_filter(&last_filter, &pad_idx, "vflip", NULL); } } else if (fabs(theta - 270) < 1.0) { -ret = insert_filter(&last_filter, &pad_idx, "transpose", "cclock"); -if (displaymatrix[3] < 0) { -ret = insert_filter(&last_filter, &pad_idx, "hflip", NULL); -if (ret < 0) -return ret; -} +ret = insert_filter(&last_filter, &pad_idx, "transpose", +displaymatrix[3] < 0 ? "clock_flip" : "cclock"); } else if (fabs(theta) > 1.0) { char rotate_buf[64]; snprintf(rotate_buf, sizeof(rotate_buf), "%f*PI/180", theta); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/h2645: Fix SEI->display matrix transformation
ffmpeg | branch: master | Andreas Rheinhardt | Sat Dec 18 23:46:47 2021 +0100| [ab6f9d86a9db7d0743629ecab422cfb61f2a17e1] | committer: Andreas Rheinhardt avcodec/h2645: Fix SEI->display matrix transformation The earlier code did not account for the fact that av_display_rotation_set() wants the angle in the anticlockwise direction (despite what its documentation stated for a long time); furthermore, the H.2645 spec wants the flips applied first, whereas our code did it the other way around. This can be fixed by negating the angle once for every flip. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ab6f9d86a9db7d0743629ecab422cfb61f2a17e1 --- libavcodec/h264_metadata_bsf.c | 15 --- libavcodec/h264_slice.c| 9 + libavcodec/hevcdec.c | 10 ++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/libavcodec/h264_metadata_bsf.c b/libavcodec/h264_metadata_bsf.c index 452a8ec5dc..8c5d19c5a8 100644 --- a/libavcodec/h264_metadata_bsf.c +++ b/libavcodec/h264_metadata_bsf.c @@ -341,15 +341,24 @@ static int h264_metadata_handle_display_orientation(AVBSFContext *bsf, SEI_TYPE_DISPLAY_ORIENTATION, &message) == 0) { H264RawSEIDisplayOrientation *disp = message->payload; +double angle = disp->anticlockwise_rotation * 180.0 / 65536.0; int32_t *matrix; matrix = av_malloc(9 * sizeof(int32_t)); if (!matrix) return AVERROR(ENOMEM); -av_display_rotation_set(matrix, -disp->anticlockwise_rotation * -180.0 / 65536.0); +/* av_display_rotation_set() expects the angle in the clockwise + * direction, hence the first minus. + * The below code applies the flips after the rotation, yet + * the H.2645 specs require flipping to be applied first. + * Because of R O(phi) = O(-phi) R (where R is flipping around + * an arbitatry axis and O(phi) is the proper rotation by phi) + * we can create display matrices as desired by negating + * the degree once for every flip applied. */ +angle = -angle * (1 - 2 * !!disp->hor_flip) * (1 - 2 * !!disp->ver_flip); + +av_display_rotation_set(matrix, angle); av_display_matrix_flip(matrix, disp->hor_flip, disp->ver_flip); // If there are multiple display orientation messages in an diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index 4467882775..c21004df97 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -1305,6 +1305,15 @@ static int h264_export_frame_props(H264Context *h) AV_FRAME_DATA_DISPLAYMATRIX, sizeof(int32_t) * 9); if (rotation) { +/* av_display_rotation_set() expects the angle in the clockwise + * direction, hence the first minus. + * The below code applies the flips after the rotation, yet + * the H.2645 specs require flipping to be applied first. + * Because of R O(phi) = O(-phi) R (where R is flipping around + * an arbitatry axis and O(phi) is the proper rotation by phi) + * we can create display matrices as desired by negating + * the degree once for every flip applied. */ +angle = -angle * (1 - 2 * !!o->hflip) * (1 - 2 * !!o->vflip); av_display_rotation_set((int32_t *)rotation->data, angle); av_display_matrix_flip((int32_t *)rotation->data, o->hflip, o->vflip); diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index 46d9edf8eb..3aa70e2245 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -2769,6 +2769,16 @@ static int set_side_data(HEVCContext *s) if (!rotation) return AVERROR(ENOMEM); +/* av_display_rotation_set() expects the angle in the clockwise + * direction, hence the first minus. + * The below code applies the flips after the rotation, yet + * the H.2645 specs require flipping to be applied first. + * Because of R O(phi) = O(-phi) R (where R is flipping around + * an arbitatry axis and O(phi) is the proper rotation by phi) + * we can create display matrices as desired by negating + * the degree once for every flip applied. */ +angle = -angle * (1 - 2 * !!s->sei.display_orientation.hflip) + * (1 - 2 * !!s->sei.display_orientation.vflip); av_display_rotation_set((int32_t *)rotation->data, angle); av_display_matrix_flip((int32_t *)rotation->data, s->sei.display_orientation.hflip, ___ ffmpeg-cvslog mailing list ffmpeg-c
[FFmpeg-cvslog] configure: use pkg-config for sndio
ffmpeg | branch: master | Brad Smith | Fri Oct 29 16:41:27 2021 -0400| [bb813ccb458ea64a68feebcdfa76504fd6969f52] | committer: Timo Rothenpieler configure: use pkg-config for sndio > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bb813ccb458ea64a68feebcdfa76504fd6969f52 --- configure | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 410f7cb241..23ef2abc9b 100755 --- a/configure +++ b/configure @@ -6821,7 +6821,8 @@ enabled alsa && { check_pkg_config alsa alsa "alsa/asoundlib.h" snd_pcm_htimesta enabled libjack && require_pkg_config libjack jack jack/jack.h jack_port_get_latency_range -enabled sndio && check_lib sndio sndio.h sio_open -lsndio +enabled sndio && { check_pkg_config sndio sndio "sndio.h" sio_open || + check_lib sndio sndio.h sio_open -lsndio; } if enabled libcdio; then check_pkg_config libcdio libcdio_paranoia "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open || ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".