[FFmpeg-cvslog] avfilter/vf_scale: test return code of scale_frame()
ffmpeg | branch: master | Niklas Haas | Tue Jul 9 11:32:42 2024 +0200| [0deb301ba9cd71a4d35384c9584b800161777852] | committer: Niklas Haas avfilter/vf_scale: test return code of scale_frame() Instead of testing the returned frame against NULL, test the return code itself, going more in line with the usual behavior of such functions. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0deb301ba9cd71a4d35384c9584b800161777852 --- libavfilter/vf_scale.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c index a1a322ed9e..ae7356fd7b 100644 --- a/libavfilter/vf_scale.c +++ b/libavfilter/vf_scale.c @@ -883,7 +883,6 @@ static int scale_frame(AVFilterLink *link, AVFrame **frame_in, int frame_changed; *frame_in = NULL; -*frame_out = NULL; if (in->colorspace == AVCOL_SPC_YCGCO) av_log(link->dst, AV_LOG_WARNING, "Detected unsupported YCgCo colorspace.\n"); @@ -1064,14 +1063,15 @@ FF_ENABLE_DEPRECATION_WARNINGS } ret = scale_frame(ctx->inputs[0], &in, &out); -if (out) { -out->pts = av_rescale_q(fs->pts, fs->time_base, outlink->time_base); -return ff_filter_frame(outlink, out); -} +if (ret < 0) +goto err; + +av_assert0(out); +out->pts = av_rescale_q(fs->pts, fs->time_base, outlink->time_base); +return ff_filter_frame(outlink, out); err: -if (ret < 0) -av_frame_free(&in); +av_frame_free(&in); 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] avfilter/vf_scale: fix frame lifetimes
ffmpeg | branch: master | Niklas Haas | Tue Jul 9 11:28:41 2024 +0200| [084e0b364df3dad4bc1aa44887b49d9fa1e4011f] | committer: Niklas Haas avfilter/vf_scale: fix frame lifetimes scale_frame() inconsistently handled the lifetime of `in`. Fixes a possible double free and a possible memory leak. The new code always has `scale_frame` take over ownership of the input frame. I first tried writing this code in a way where the calling code retains ownership, but this is nontrivial due to the presence of the no-op short-circuit condition in which the input frame is directly returned. (As an alternative, we could use av_frame_clone() instead, but I wanted to avoid touching the original behavior in this commit) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=084e0b364df3dad4bc1aa44887b49d9fa1e4011f --- libavfilter/vf_scale.c | 29 + 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c index 841075193e..a1a322ed9e 100644 --- a/libavfilter/vf_scale.c +++ b/libavfilter/vf_scale.c @@ -869,17 +869,20 @@ static int scale_field(ScaleContext *scale, AVFrame *dst, AVFrame *src, return 0; } -static int scale_frame(AVFilterLink *link, AVFrame *in, AVFrame **frame_out) +/* Takes over ownership of *frame_in, passes ownership of *frame_out to caller */ +static int scale_frame(AVFilterLink *link, AVFrame **frame_in, + AVFrame **frame_out) { AVFilterContext *ctx = link->dst; ScaleContext *scale = ctx->priv; AVFilterLink *outlink = ctx->outputs[0]; -AVFrame *out; +AVFrame *out, *in = *frame_in; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format); char buf[32]; int ret; int frame_changed; +*frame_in = NULL; *frame_out = NULL; if (in->colorspace == AVCOL_SPC_YCGCO) av_log(link->dst, AV_LOG_WARNING, "Detected unsupported YCgCo colorspace.\n"); @@ -922,11 +925,11 @@ static int scale_frame(AVFilterLink *link, AVFrame *in, AVFrame **frame_out) ret = scale_parse_expr(ctx, NULL, &scale->w_pexpr, "width", scale->w_expr); if (ret < 0) -return ret; +goto err; ret = scale_parse_expr(ctx, NULL, &scale->h_pexpr, "height", scale->h_expr); if (ret < 0) -return ret; +goto err; } if (ctx->filter == &ff_vf_scale2ref) { @@ -957,7 +960,7 @@ FF_ENABLE_DEPRECATION_WARNINGS link->dst->inputs[0]->sample_aspect_ratio.num = in->sample_aspect_ratio.num; if ((ret = config_props(outlink)) < 0) -return ret; +goto err; } scale: @@ -971,10 +974,9 @@ scale: out = ff_get_video_buffer(outlink, outlink->w, outlink->h); if (!out) { -av_frame_free(&in); -return AVERROR(ENOMEM); +ret = AVERROR(ENOMEM); +goto err; } -*frame_out = out; av_frame_copy_props(out, in); out->width = outlink->w; @@ -999,9 +1001,12 @@ scale: ret = sws_scale_frame(scale->sws, out, in); } -av_frame_free(&in); if (ret < 0) -av_frame_free(frame_out); +av_frame_free(&out); +*frame_out = out; + +err: +av_frame_free(&in); return ret; } @@ -1058,7 +1063,7 @@ FF_ENABLE_DEPRECATION_WARNINGS } } -ret = scale_frame(ctx->inputs[0], in, &out); +ret = scale_frame(ctx->inputs[0], &in, &out); if (out) { out->pts = av_rescale_q(fs->pts, fs->time_base, outlink->time_base); return ff_filter_frame(outlink, out); @@ -1077,7 +1082,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) AVFrame *out; int ret; -ret = scale_frame(link, in, &out); +ret = scale_frame(link, &in, &out); if (out) return ff_filter_frame(outlink, out); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] swscale: remove unconditional #define DITHER1XBPP
ffmpeg | branch: master | Ramiro Polla | Thu Jul 4 11:40:17 2024 +0200| [4f7f9b102699306b449be27e7f3197f62cc1092d] | committer: Ramiro Polla swscale: remove unconditional #define DITHER1XBPP This seems to have had an use in the past, but it is now defined unconditionally. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4f7f9b102699306b449be27e7f3197f62cc1092d --- libswscale/swscale_internal.h | 2 -- libswscale/utils.c| 4 libswscale/x86/swscale.c | 2 -- libswscale/x86/swscale_template.c | 20 libswscale/x86/yuv2rgb.c | 2 -- libswscale/x86/yuv2rgb_template.c | 4 6 files changed, 34 deletions(-) diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 0818f50c7f..e5610161d0 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -46,8 +46,6 @@ #define MAX_FILTER_SIZE SWS_MAX_FILTER_SIZE -#define DITHER1XBPP - #if HAVE_BIGENDIAN #define ALT32_CORR (-1) #else diff --git a/libswscale/utils.c b/libswscale/utils.c index 12dba712c1..bc8d7627e2 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -1952,14 +1952,10 @@ static av_cold int sws_init_single_context(SwsContext *c, SwsFilter *srcFilter, av_log(c, AV_LOG_INFO, "%s scaler, from %s to %s%s ", scaler, av_get_pix_fmt_name(srcFormat), -#ifdef DITHER1XBPP dstFormat == AV_PIX_FMT_BGR555 || dstFormat == AV_PIX_FMT_BGR565 || dstFormat == AV_PIX_FMT_RGB444BE || dstFormat == AV_PIX_FMT_RGB444LE || dstFormat == AV_PIX_FMT_BGR444BE || dstFormat == AV_PIX_FMT_BGR444LE ? "dithered " : "", -#else - "", -#endif av_get_pix_fmt_name(dstFormat)); if (INLINE_MMXEXT(cpu_flags)) diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c index ad7f67f90e..43319fd6b2 100644 --- a/libswscale/x86/swscale.c +++ b/libswscale/x86/swscale.c @@ -40,8 +40,6 @@ const DECLARE_ALIGNED(8, uint64_t, ff_dither8)[2] = { #if HAVE_INLINE_ASM -#define DITHER1XBPP - DECLARE_ASM_CONST(8, uint64_t, bF8)= 0xF8F8F8F8F8F8F8F8LL; DECLARE_ASM_CONST(8, uint64_t, bFC)= 0xFCFCFCFCFCFCFCFCLL; diff --git a/libswscale/x86/swscale_template.c b/libswscale/x86/swscale_template.c index 6190fcb4fe..6bff2a44aa 100644 --- a/libswscale/x86/swscale_template.c +++ b/libswscale/x86/swscale_template.c @@ -384,11 +384,9 @@ static void RENAME(yuv2rgb565_X_ar)(SwsContext *c, const int16_t *lumFilter, YSCALEYUV2RGBX "pxor %%mm7, %%mm7 \n\t" /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ -#ifdef DITHER1XBPP "paddusb "BLUE_DITHER"(%0), %%mm2\n\t" "paddusb "GREEN_DITHER"(%0), %%mm4\n\t" "paddusb "RED_DITHER"(%0), %%mm5\n\t" -#endif WRITERGB16(%4, "%5", %%FF_REGa) YSCALEYUV2PACKEDX_END } @@ -408,11 +406,9 @@ static void RENAME(yuv2rgb565_X)(SwsContext *c, const int16_t *lumFilter, YSCALEYUV2RGBX "pxor %%mm7, %%mm7 \n\t" /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ -#ifdef DITHER1XBPP "paddusb "BLUE_DITHER"(%0), %%mm2 \n\t" "paddusb "GREEN_DITHER"(%0), %%mm4 \n\t" "paddusb "RED_DITHER"(%0), %%mm5 \n\t" -#endif WRITERGB16(%4, "%5", %%FF_REGa) YSCALEYUV2PACKEDX_END } @@ -461,11 +457,9 @@ static void RENAME(yuv2rgb555_X_ar)(SwsContext *c, const int16_t *lumFilter, YSCALEYUV2RGBX "pxor %%mm7, %%mm7 \n\t" /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ -#ifdef DITHER1XBPP "paddusb "BLUE_DITHER"(%0), %%mm2\n\t" "paddusb "GREEN_DITHER"(%0), %%mm4\n\t" "paddusb "RED_DITHER"(%0), %%mm5\n\t" -#endif WRITERGB15(%4, "%5", %%FF_REGa) YSCALEYUV2PACKEDX_END } @@ -485,11 +479,9 @@ static void RENAME(yuv2rgb555_X)(SwsContext *c, const int16_t *lumFilter, YSCALEYUV2RGBX "pxor %%mm7, %%mm7 \n\t" /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ -#ifdef DITHER1XBPP "paddusb "BLUE_DITHER"(%0), %%mm2 \n\t" "paddusb "GREEN_DITHER"(%0), %%mm4 \n\t" "paddusb "RED_DITHER"(%0), %%mm5 \n\t" -#endif WRITERGB15(%4, "%5", %%FF_REGa) YSCALEYUV2PACKEDX_END } @@ -891,11 +883,9 @@ static void RENAME(yuv2rgb555_2)(SwsContext *c, const int16_t *buf[2], YSCALEYUV2RGB(%%FF_REGBP, %5) "pxor%%mm7, %%mm7 \n\t" /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ -#ifdef DITHER1XBPP "paddusb "BLUE_DITHER"(%5), %%mm2 \n\t" "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t" "paddusb "RED_DITHER"(%5), %%mm5\n\t" -#endif WRITERGB15(%%FF_REGb, DSTW_OFFSET"(%5)", %%FF_REGBP) "pop %%"FF_REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"FF_REG_b" \n\t" @@ -920,11 +910,9 @@ static void RENAME(yuv2rgb565_2)(SwsContext *c, const int16_t *buf[2], YSCALEYUV2RGB(%%FF_REGBP, %5) "pxor%%mm7, %%mm7 \n\t" /* m
[FFmpeg-cvslog] configure: restore autodetection of v4l2 and fbdev
ffmpeg | branch: master | Ramiro Polla | Wed Jul 3 00:30:08 2024 +0200| [7405f1ad5351cc24b91a0227aeeaf24ff9d12278] | committer: Ramiro Polla configure: restore autodetection of v4l2 and fbdev The detection logic for v4l2 and fbdev was accidentally modified to depend on v4l2-m2m in 43b3412. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7405f1ad5351cc24b91a0227aeeaf24ff9d12278 --- configure | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/configure b/configure index b28221f258..fa2e384350 100755 --- a/configure +++ b/configure @@ -7145,11 +7145,12 @@ pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout xmllint --version > /dev/null 2>&1 && enable xmllint || disable xmllint +check_headers linux/fb.h +check_headers linux/videodev2.h +test_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete + # check V4L2 codecs available in the API if enabled v4l2_m2m; then -check_headers linux/fb.h -check_headers linux/videodev2.h -test_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete check_cc v4l2_m2m linux/videodev2.h "int i = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_VIDEO_M2M | V4L2_BUF_FLAG_LAST;" check_cc vc1_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VC1_ANNEX_G;" check_cc mpeg1_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG1;" ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] swscale/x86/yuv2rgb: Detemplatize
ffmpeg | branch: master | Ramiro Polla | Thu Jul 4 11:40:18 2024 +0200| [ac6263945ae802605635c99534d23c3c681a0f34] | committer: Ramiro Polla swscale/x86/yuv2rgb: Detemplatize Every function in yuv2rgb_template.c is only compiled exactly once, so detemplatize it. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ac6263945ae802605635c99534d23c3c681a0f34 --- libswscale/x86/yuv2rgb.c | 167 - libswscale/x86/yuv2rgb_template.c | 188 -- 2 files changed, 162 insertions(+), 193 deletions(-) diff --git a/libswscale/x86/yuv2rgb.c b/libswscale/x86/yuv2rgb.c index ddc7cca2c8..68e903c6ad 100644 --- a/libswscale/x86/yuv2rgb.c +++ b/libswscale/x86/yuv2rgb.c @@ -1,7 +1,8 @@ /* * software YUV to RGB converter * - * Copyright (C) 2009 Konstantin Shishkov + * Copyright (C) 2001-2007 Michael Niedermayer + * Copyright (C) 2009-2010 Konstantin Shishkov * * MMX/MMXEXT template stuff (needed for fast movntq support), * 1,4,8bpp support and context / deglobalize stuff @@ -39,10 +40,166 @@ #if HAVE_X86ASM -//SSSE3 versions -#undef RENAME -#define RENAME(a) a ## _ssse3 -#include "yuv2rgb_template.c" +#define YUV2RGB_LOOP(depth) \ +h_size = (c->dstW + 7) & ~7; \ +if (h_size * depth > FFABS(dstStride[0]))\ +h_size -= 8; \ + \ +vshift = c->srcFormat != AV_PIX_FMT_YUV422P; \ + \ +for (y = 0; y < srcSliceH; y++) {\ +uint8_t *image= dst[0] + (y + srcSliceY) * dstStride[0]; \ +const uint8_t *py = src[0] + y * srcStride[0]; \ +const uint8_t *pu = src[1] + (y >> vshift) * srcStride[1]; \ +const uint8_t *pv = src[2] + (y >> vshift) * srcStride[2]; \ +x86_reg index = -h_size / 2; \ + +extern void ff_yuv_420_rgb24_ssse3(x86_reg index, uint8_t *image, const uint8_t *pu_index, + const uint8_t *pv_index, const uint64_t *pointer_c_dither, + const uint8_t *py_2index); +extern void ff_yuv_420_bgr24_ssse3(x86_reg index, uint8_t *image, const uint8_t *pu_index, + const uint8_t *pv_index, const uint64_t *pointer_c_dither, + const uint8_t *py_2index); + +extern void ff_yuv_420_rgb15_ssse3(x86_reg index, uint8_t *image, const uint8_t *pu_index, + const uint8_t *pv_index, const uint64_t *pointer_c_dither, + const uint8_t *py_2index); +extern void ff_yuv_420_rgb16_ssse3(x86_reg index, uint8_t *image, const uint8_t *pu_index, + const uint8_t *pv_index, const uint64_t *pointer_c_dither, + const uint8_t *py_2index); +extern void ff_yuv_420_rgb32_ssse3(x86_reg index, uint8_t *image, const uint8_t *pu_index, + const uint8_t *pv_index, const uint64_t *pointer_c_dither, + const uint8_t *py_2index); +extern void ff_yuv_420_bgr32_ssse3(x86_reg index, uint8_t *image, const uint8_t *pu_index, + const uint8_t *pv_index, const uint64_t *pointer_c_dither, + const uint8_t *py_2index); +extern void ff_yuva_420_rgb32_ssse3(x86_reg index, uint8_t *image, const uint8_t *pu_index, +const uint8_t *pv_index, const uint64_t *pointer_c_dither, +const uint8_t *py_2index, const uint8_t *pa_2index); +extern void ff_yuva_420_bgr32_ssse3(x86_reg index, uint8_t *image, const uint8_t *pu_index, +const uint8_t *pv_index, const uint64_t *pointer_c_dither, +const uint8_t *py_2index, const uint8_t *pa_2index); + +static inline int yuv420_rgb15_ssse3(SwsContext *c, const uint8_t *src[], + int srcStride[], + int srcSliceY, int srcSliceH, + uint8_t *dst[], int dstStride[]) +{ +int y, h_size, vshift; + +YUV2RGB_LOOP(2) + +c->blueDither = ff_dither8[y & 1]; +c->greenDither = ff_dither8[y & 1]; +c->redDither = ff_dither8[(y + 1) & 1]; + +ff_yuv_420_rgb15_ssse3(index, image, pu - index, pv - index, &(c->redDither), py - 2 * index); +} +return srcSliceH; +} + +static inline int yuv420_rgb16_ssse3(SwsContext *c, const uint8_t *src[], + int srcStride[], +
[FFmpeg-cvslog] doc/examples/vaapi_encode: Try to check fwrite() for failure
ffmpeg | branch: master | Michael Niedermayer | Tue Jul 2 01:47:33 2024 +0200| [3e4bfff21192aed328c906c85424737128b108f1] | committer: Michael Niedermayer doc/examples/vaapi_encode: Try to check fwrite() for failure Fixes: CID1604548 Unused value Sponsored-by: Sovereign Tech Fund Reviewed-by: "Xiang, Haihao" Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3e4bfff21192aed328c906c85424737128b108f1 --- doc/examples/vaapi_encode.c | 4 1 file changed, 4 insertions(+) diff --git a/doc/examples/vaapi_encode.c b/doc/examples/vaapi_encode.c index d5f472f6dd..ff3ebb1e2b 100644 --- a/doc/examples/vaapi_encode.c +++ b/doc/examples/vaapi_encode.c @@ -88,6 +88,10 @@ static int encode_write(AVCodecContext *avctx, AVFrame *frame, FILE *fout) enc_pkt->stream_index = 0; ret = fwrite(enc_pkt->data, enc_pkt->size, 1, fout); av_packet_unref(enc_pkt); +if (ret != enc_pkt->size) { +ret = AVERROR(errno); +break; +} } end: ___ 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] lavfi/perlin: Fix out of bounds stack buffer write
ffmpeg | branch: master | Marvin Scholz | Tue Jul 2 20:38:00 2024 +0200| [6d9c4bd69e81b614cf1e1a809679a7ab840b2b3d] | committer: Michael Niedermayer lavfi/perlin: Fix out of bounds stack buffer write An incorrect calculation in ff_perlin_init causes a write to the stack array at index 256, which is out of bounds. Fixes: CID1608711 Reviewed-by: Stefano Sabatini Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6d9c4bd69e81b614cf1e1a809679a7ab840b2b3d --- libavfilter/perlin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/perlin.c b/libavfilter/perlin.c index 09bae7ad33..ffad8c1e4e 100644 --- a/libavfilter/perlin.c +++ b/libavfilter/perlin.c @@ -129,7 +129,7 @@ int ff_perlin_init(FFPerlin *perlin, double period, int octaves, double persiste for (i = 0; i < 256; i++) { unsigned int random_idx = av_lfg_get(&lfg) % (256-i); uint8_t random_val = random_permutations[random_idx]; -random_permutations[random_idx] = random_permutations[256-i]; +random_permutations[random_idx] = random_permutations[255-i]; perlin->permutations[i] = perlin->permutations[i+256] = random_val; } ___ 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] MAINTAINERS: add myself as d3d12va_encode maintainer
ffmpeg | branch: master | Tong Wu | Tue Jul 2 23:22:50 2024 +0800| [f2f2b275171d9e3c1c94cdaa87dbbfb3007820c0] | committer: Michael Niedermayer MAINTAINERS: add myself as d3d12va_encode maintainer Signed-off-by: Tong Wu Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f2f2b275171d9e3c1c94cdaa87dbbfb3007820c0 --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index bca5f45467..6ce8bc8639 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -260,6 +260,7 @@ Codecs: Hardware acceleration: dxva2*Hendrik Leppkes, Laurent Aimar, Steve Lhomme d3d11va* Steve Lhomme + d3d12va_encode* Tong Wu mediacodec* Matthieu Bouron, Aman Gupta, Zhao Zhili vaapi*Haihao Xiang vaapi_encode* Mark Thompson, Haihao Xiang ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avutil/hwcontext_d3d11va: Free AVD3D11FrameDescriptor on error
ffmpeg | branch: master | Michael Niedermayer | Sun Jun 9 17:47:42 2024 +0200| [cf22f944d55c8eb0119fb20354a625f8c41eb11f] | committer: Michael Niedermayer avutil/hwcontext_d3d11va: Free AVD3D11FrameDescriptor on error Fixes: CID1598558 Resource leak Sponsored-by: Sovereign Tech Fund Reviewed-by: Steve Lhomme Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cf22f944d55c8eb0119fb20354a625f8c41eb11f --- libavutil/hwcontext_d3d11va.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c index c04ab01a28..9b3c5f389f 100644 --- a/libavutil/hwcontext_d3d11va.c +++ b/libavutil/hwcontext_d3d11va.c @@ -190,6 +190,7 @@ static AVBufferRef *wrap_texture_buf(AVHWFramesContext *ctx, ID3D11Texture2D *te sizeof(*frames_hwctx->texture_infos)); if (!frames_hwctx->texture_infos) { ID3D11Texture2D_Release(tex); +av_free(desc); return NULL; } s->nb_surfaces = s->nb_surfaces_used + 1; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/vvc/refs: Use unsigned mask
ffmpeg | branch: master | Michael Niedermayer | Sun Jul 7 20:47:26 2024 +0200| [eb552ecd543ad656c40849c6b2bcaf5fd667c9b9] | committer: Michael Niedermayer avcodec/vvc/refs: Use unsigned mask Not a bugfix, but might fix CID1604361 Overflowed constant Sponsored-by: Sovereign Tech Fund Reviewed-by: Nuo Mi Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=eb552ecd543ad656c40849c6b2bcaf5fd667c9b9 --- libavcodec/vvc/refs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vvc/refs.c b/libavcodec/vvc/refs.c index 26a5b0b34c..c1fc6132c2 100644 --- a/libavcodec/vvc/refs.c +++ b/libavcodec/vvc/refs.c @@ -310,7 +310,7 @@ void ff_vvc_bump_frame(VVCContext *s, VVCFrameContext *fc) static VVCFrame *find_ref_idx(VVCContext *s, VVCFrameContext *fc, int poc, uint8_t use_msb) { -const int mask = use_msb ? ~0 : fc->ps.sps->max_pic_order_cnt_lsb - 1; +const unsigned mask = use_msb ? ~0 : fc->ps.sps->max_pic_order_cnt_lsb - 1; for (int i = 0; i < FF_ARRAY_ELEMS(fc->DPB); i++) { VVCFrame *ref = &fc->DPB[i]; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avutil/hwcontext_d3d11va: correct sizeof AVD3D11FrameDescriptor
ffmpeg | branch: master | Michael Niedermayer | Sun Jun 9 17:47:41 2024 +0200| [698ed0d5a5a3a1219179facb5538eea463fae13f] | committer: Michael Niedermayer avutil/hwcontext_d3d11va: correct sizeof AVD3D11FrameDescriptor Fixes: CID1591909 Wrong sizeof argument Sponsored-by: Sovereign Tech Fund Reviewed-by: Steve Lhomme Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=698ed0d5a5a3a1219179facb5538eea463fae13f --- libavutil/hwcontext_d3d11va.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c index 8963c9fc85..c04ab01a28 100644 --- a/libavutil/hwcontext_d3d11va.c +++ b/libavutil/hwcontext_d3d11va.c @@ -202,7 +202,7 @@ static AVBufferRef *wrap_texture_buf(AVHWFramesContext *ctx, ID3D11Texture2D *te desc->texture = tex; desc->index = index; -buf = av_buffer_create((uint8_t *)desc, sizeof(desc), free_texture, tex, 0); +buf = av_buffer_create((uint8_t *)desc, sizeof(*desc), free_texture, tex, 0); if (!buf) { ID3D11Texture2D_Release(tex); av_free(desc); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avutil/wchar_filename: Correct sizeof
ffmpeg | branch: master | Michael Niedermayer | Sun Jun 9 17:47:44 2024 +0200| [e9e8bea2e79bc3c481a6f81f75f6c871e3e0f367] | committer: Michael Niedermayer avutil/wchar_filename: Correct sizeof Fixes: CID1591930 Wrong sizeof argument Sponsored-by: Sovereign Tech Fund Reviewed-by: Steve Lhomme Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e9e8bea2e79bc3c481a6f81f75f6c871e3e0f367 --- libavutil/wchar_filename.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/wchar_filename.h b/libavutil/wchar_filename.h index 868a30b532..23cc92aa2d 100644 --- a/libavutil/wchar_filename.h +++ b/libavutil/wchar_filename.h @@ -57,7 +57,7 @@ static inline int wchartocp(unsigned int code_page, const wchar_t *filename_w, errno = EINVAL; return -1; } -*filename = (char*)av_malloc_array(num_chars, sizeof *filename); +*filename = av_malloc_array(num_chars, sizeof **filename); if (!*filename) { errno = ENOMEM; return -1; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] swscale: prevent undefined behaviour in the PUTRGBA macro
ffmpeg | branch: master | Sean McGovern | Tue Jul 9 17:41:32 2024 -0400| [34b4ca8696de64ca756e7aed7bdefa9ff6bb5fac] | committer: Michael Niedermayer swscale: prevent undefined behaviour in the PUTRGBA macro For even small values of 'asrc[x]', shifting them by 24 bits or more will cause arithmetic overflow and be caught by GCC's undefined behaviour sanitizer. Ensure the values do not overflow by up-casting the bracketed expressions involving 'asrc' to uint32_t. Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=34b4ca8696de64ca756e7aed7bdefa9ff6bb5fac --- libswscale/yuv2rgb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c index 977eb3a7dd..cfbc54abd0 100644 --- a/libswscale/yuv2rgb.c +++ b/libswscale/yuv2rgb.c @@ -100,9 +100,9 @@ const int *sws_getCoefficients(int colorspace) #define PUTRGBA(dst, ysrc, asrc, i, abase) \ Y = ysrc[2 * i]; \ -dst[2 * i] = r[Y] + g[Y] + b[Y] + (asrc[2 * i] << abase); \ +dst[2 * i] = r[Y] + g[Y] + b[Y] + ((uint32_t)(asrc[2 * i]) << abase); \ Y = ysrc[2 * i + 1]; \ -dst[2 * i + 1] = r[Y] + g[Y] + b[Y] + (asrc[2 * i + 1] << abase); +dst[2 * i + 1] = r[Y] + g[Y] + b[Y] + ((uint32_t)(asrc[2 * i + 1]) << abase); #define PUTRGB48(dst, src, asrc, i, abase) \ Y= src[ 2 * i]; \ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avutil/hwcontext_d3d11va: correct sizeof IDirect3DSurface9
ffmpeg | branch: master | Michael Niedermayer | Sun Jun 9 17:47:43 2024 +0200| [628ba061c8d5ae018c3e8aa8ce05b8dfcdfd8410] | committer: Michael Niedermayer avutil/hwcontext_d3d11va: correct sizeof IDirect3DSurface9 Fixes: CID1591944 Wrong sizeof argument Sponsored-by: Sovereign Tech Fund Reviewed-by: Steve Lhomme Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=628ba061c8d5ae018c3e8aa8ce05b8dfcdfd8410 --- libavutil/hwcontext_dxva2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/hwcontext_dxva2.c b/libavutil/hwcontext_dxva2.c index 03cb739a7f..0b76966ebf 100644 --- a/libavutil/hwcontext_dxva2.c +++ b/libavutil/hwcontext_dxva2.c @@ -147,7 +147,7 @@ static AVBufferRef *dxva2_pool_alloc(void *opaque, size_t size) if (s->nb_surfaces_used < hwctx->nb_surfaces) { s->nb_surfaces_used++; return av_buffer_create((uint8_t*)s->surfaces_internal[s->nb_surfaces_used - 1], -sizeof(*hwctx->surfaces), dxva2_pool_release_dummy, 0, 0); +sizeof(**hwctx->surfaces), dxva2_pool_release_dummy, 0, 0); } return NULL; ___ 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] x86/intreadwrite: use intrinsics instead of inline asm for AV_COPY128
ffmpeg | branch: master | James Almer | Wed Jul 10 13:00:20 2024 -0300| [bd1bcb07e0f29c135103a402d71b343a09ad1690] | committer: James Almer x86/intreadwrite: use intrinsics instead of inline asm for AV_COPY128 This has the benefit of removing any SSE -> AVX penalty that may happen when the compiler emits VEX encoded instructions. Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bd1bcb07e0f29c135103a402d71b343a09ad1690 --- configure| 5 - libavutil/x86/intreadwrite.h | 20 +++- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/configure b/configure index f84fefeaab..7151ed1de3 100755 --- a/configure +++ b/configure @@ -2314,6 +2314,7 @@ HEADERS_LIST=" INTRINSICS_LIST=" intrinsics_neon +intrinsics_sse intrinsics_sse2 " @@ -2744,7 +2745,8 @@ armv6t2_deps="arm" armv8_deps="aarch64" neon_deps_any="aarch64 arm" intrinsics_neon_deps="neon" -intrinsics_sse2_deps="sse2" +intrinsics_sse_deps="sse" +intrinsics_sse2_deps="sse2 intrinsics_sse" vfp_deps="arm" vfpv3_deps="vfp" setend_deps="arm" @@ -6446,6 +6448,7 @@ elif enabled loongarch; then fi check_cc intrinsics_neon arm_neon.h "int16x8_t test = vdupq_n_s16(0)" +check_cc intrinsics_sse immintrin.h "__m128 test = _mm_setzero_ps()" check_cc intrinsics_sse2 emmintrin.h "__m128i test = _mm_setzero_si128()" check_ldflags -Wl,--as-needed diff --git a/libavutil/x86/intreadwrite.h b/libavutil/x86/intreadwrite.h index 9bbef00dba..6546eb016c 100644 --- a/libavutil/x86/intreadwrite.h +++ b/libavutil/x86/intreadwrite.h @@ -22,29 +22,25 @@ #define AVUTIL_X86_INTREADWRITE_H #include +#if HAVE_INTRINSICS_SSE +#include +#endif #if HAVE_INTRINSICS_SSE2 #include #endif #include "config.h" #include "libavutil/attributes.h" -#if HAVE_MMX - -#ifdef __SSE__ +#if HAVE_INTRINSICS_SSE #define AV_COPY128 AV_COPY128 static av_always_inline void AV_COPY128(void *d, const void *s) { -struct v {uint64_t v[2];}; - -__asm__("movaps %1, %%xmm0 \n\t" -"movaps %%xmm0, %0 \n\t" -: "=m"(*(struct v*)d) -: "m" (*(const struct v*)s) -: "xmm0"); +__m128 tmp = _mm_load_ps(s); +_mm_store_ps(d, tmp); } -#endif /* __SSE__ */ +#endif /* HAVE_INTRINSICS_SSE */ #if HAVE_INTRINSICS_SSE2 @@ -57,6 +53,4 @@ static av_always_inline void AV_ZERO128(void *d) #endif /* HAVE_INTRINSICS_SSE2 */ -#endif /* HAVE_MMX */ - #endif /* AVUTIL_X86_INTREADWRITE_H */ ___ 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] x86/intreadwrite: use intrinsics instead of inline asm for AV_ZERO128
ffmpeg | branch: master | James Almer | Mon Nov 14 02:32:33 2022 -0300| [4a04cca69af807ccf831da977a94350611967c4c] | committer: James Almer x86/intreadwrite: use intrinsics instead of inline asm for AV_ZERO128 When called inside a loop, the inline asm version results in one pxor unnecessarely emitted per iteration, as the contents of the __asm__() block are opaque to the compiler's instruction scheduler. This is not the case with intrinsics, where pxor will be emitted once with any half decent compiler. This also has the benefit of removing any SSE -> AVX penalty that may happen when the compiler emits VEX encoded instructions. Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4a04cca69af807ccf831da977a94350611967c4c --- configure| 3 +++ libavutil/x86/intreadwrite.h | 15 +++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/configure b/configure index fa2e384350..f84fefeaab 100755 --- a/configure +++ b/configure @@ -2314,6 +2314,7 @@ HEADERS_LIST=" INTRINSICS_LIST=" intrinsics_neon +intrinsics_sse2 " MATH_FUNCS=" @@ -2743,6 +2744,7 @@ armv6t2_deps="arm" armv8_deps="aarch64" neon_deps_any="aarch64 arm" intrinsics_neon_deps="neon" +intrinsics_sse2_deps="sse2" vfp_deps="arm" vfpv3_deps="vfp" setend_deps="arm" @@ -6444,6 +6446,7 @@ elif enabled loongarch; then fi check_cc intrinsics_neon arm_neon.h "int16x8_t test = vdupq_n_s16(0)" +check_cc intrinsics_sse2 emmintrin.h "__m128i test = _mm_setzero_si128()" check_ldflags -Wl,--as-needed check_ldflags -Wl,-z,noexecstack diff --git a/libavutil/x86/intreadwrite.h b/libavutil/x86/intreadwrite.h index 5e57d6a8cd..9bbef00dba 100644 --- a/libavutil/x86/intreadwrite.h +++ b/libavutil/x86/intreadwrite.h @@ -22,6 +22,9 @@ #define AVUTIL_X86_INTREADWRITE_H #include +#if HAVE_INTRINSICS_SSE2 +#include +#endif #include "config.h" #include "libavutil/attributes.h" @@ -43,20 +46,16 @@ static av_always_inline void AV_COPY128(void *d, const void *s) #endif /* __SSE__ */ -#ifdef __SSE2__ +#if HAVE_INTRINSICS_SSE2 #define AV_ZERO128 AV_ZERO128 static av_always_inline void AV_ZERO128(void *d) { -struct v {uint64_t v[2];}; - -__asm__("pxor %%xmm0, %%xmm0 \n\t" -"movdqa %%xmm0, %0 \n\t" -: "=m"(*(struct v*)d) -:: "xmm0"); +__m128i zero = _mm_setzero_si128(); +_mm_store_si128(d, zero); } -#endif /* __SSE2__ */ +#endif /* HAVE_INTRINSICS_SSE2 */ #endif /* HAVE_MMX */ ___ 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] x86/intreadwrite.h: add missing preprocessor checks
ffmpeg | branch: master | James Almer | Wed Jul 10 13:48:42 2024 -0300| [15056dd65026023352069f58403c997be7fb9496] | committer: James Almer x86/intreadwrite.h: add missing preprocessor checks Removed by accident in the previous commits. This makes the code only run when compiled with GCC and Clang like before. Support for other compilers like msvc can be added later. Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=15056dd65026023352069f58403c997be7fb9496 --- libavutil/x86/intreadwrite.h | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavutil/x86/intreadwrite.h b/libavutil/x86/intreadwrite.h index 6546eb016c..fd21143dd9 100644 --- a/libavutil/x86/intreadwrite.h +++ b/libavutil/x86/intreadwrite.h @@ -22,16 +22,16 @@ #define AVUTIL_X86_INTREADWRITE_H #include -#if HAVE_INTRINSICS_SSE +#if HAVE_INTRINSICS_SSE && defined(__SSE__) #include #endif -#if HAVE_INTRINSICS_SSE2 +#if HAVE_INTRINSICS_SSE2 && defined(__SSE2__) #include #endif #include "config.h" #include "libavutil/attributes.h" -#if HAVE_INTRINSICS_SSE +#if HAVE_INTRINSICS_SSE && defined(__SSE__) #define AV_COPY128 AV_COPY128 static av_always_inline void AV_COPY128(void *d, const void *s) @@ -40,9 +40,9 @@ static av_always_inline void AV_COPY128(void *d, const void *s) _mm_store_ps(d, tmp); } -#endif /* HAVE_INTRINSICS_SSE */ +#endif /* HAVE_INTRINSICS_SSE && defined(__SSE__) */ -#if HAVE_INTRINSICS_SSE2 +#if HAVE_INTRINSICS_SSE2 && defined(__SSE2__) #define AV_ZERO128 AV_ZERO128 static av_always_inline void AV_ZERO128(void *d) @@ -51,6 +51,6 @@ static av_always_inline void AV_ZERO128(void *d) _mm_store_si128(d, zero); } -#endif /* HAVE_INTRINSICS_SSE2 */ +#endif /* HAVE_INTRINSICS_SSE2 && defined(__SSE2__) */ #endif /* AVUTIL_X86_INTREADWRITE_H */ ___ 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] x86/intreadwrite: fix include of config.h
ffmpeg | branch: master | James Almer | Wed Jul 10 13:52:52 2024 -0300| [1a86a7a48d60aaa64ff55c109ee64512576d7e8b] | committer: James Almer x86/intreadwrite: fix include of config.h Should fix make checkheaders. Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1a86a7a48d60aaa64ff55c109ee64512576d7e8b --- libavutil/x86/intreadwrite.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/x86/intreadwrite.h b/libavutil/x86/intreadwrite.h index fd21143dd9..d916410e14 100644 --- a/libavutil/x86/intreadwrite.h +++ b/libavutil/x86/intreadwrite.h @@ -22,13 +22,13 @@ #define AVUTIL_X86_INTREADWRITE_H #include +#include "config.h" #if HAVE_INTRINSICS_SSE && defined(__SSE__) #include #endif #if HAVE_INTRINSICS_SSE2 && defined(__SSE2__) #include #endif -#include "config.h" #include "libavutil/attributes.h" #if HAVE_INTRINSICS_SSE && defined(__SSE__) ___ 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".