[FFmpeg-cvslog] avfilter/avf_showcwt: write also to alpha plane if available
ffmpeg | branch: master | Paul B Mahol | Sun Dec 4 11:15:21 2022 +0100| [ec32c62cadac6a8f8dfa5d56d0da2e49719d9802] | committer: Paul B Mahol avfilter/avf_showcwt: write also to alpha plane if available > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ec32c62cadac6a8f8dfa5d56d0da2e49719d9802 --- libavfilter/avf_showcwt.c | 42 +++--- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/libavfilter/avf_showcwt.c b/libavfilter/avf_showcwt.c index 315b8289a6..2c7c447305 100644 --- a/libavfilter/avf_showcwt.c +++ b/libavfilter/avf_showcwt.c @@ -300,6 +300,7 @@ static int draw(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) const ptrdiff_t ylinesize = s->outpicref->linesize[0]; const ptrdiff_t ulinesize = s->outpicref->linesize[1]; const ptrdiff_t vlinesize = s->outpicref->linesize[2]; +const ptrdiff_t alinesize = s->outpicref->linesize[3]; const float log_factor = 1.f/logf(s->logarithmic_basis); const int count = s->frequency_band_count; const int start = (count * jobnr) / nb_jobs; @@ -307,7 +308,7 @@ static int draw(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) const int ihop_index = s->ihop_index; const int ihop_size = s->ihop_size; const int direction = s->direction; -uint8_t *dstY, *dstU, *dstV; +uint8_t *dstY, *dstU, *dstV, *dstA; const int mode = s->mode; const int w_1 = s->w - 1; const int x = s->pos; @@ -323,12 +324,14 @@ static int draw(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) dstY = s->outpicref->data[0] + y * ylinesize; dstU = s->outpicref->data[1] + y * ulinesize; dstV = s->outpicref->data[2] + y * vlinesize; +dstA = s->outpicref->data[3] ? s->outpicref->data[3] + y * alinesize : NULL; break; case DIRECTION_UD: case DIRECTION_DU: dstY = s->outpicref->data[0] + x * ylinesize + w_1 - y; dstU = s->outpicref->data[1] + x * ulinesize + w_1 - y; dstV = s->outpicref->data[2] + x * vlinesize + w_1 - y; +dstA = s->outpicref->data[3] ? s->outpicref->data[3] + x * alinesize + w_1 - y : NULL; break; } @@ -343,11 +346,15 @@ static int draw(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) memmove(dstY, dstY + 1, w_1); memmove(dstU, dstU + 1, w_1); memmove(dstV, dstV + 1, w_1); +if (dstA != NULL) +memmove(dstA, dstA + 1, w_1); break; case DIRECTION_LR: memmove(dstY + 1, dstY, w_1); memmove(dstU + 1, dstU, w_1); memmove(dstV + 1, dstV, w_1); +if (dstA != NULL) +memmove(dstA + 1, dstA, w_1); break; } break; @@ -358,6 +365,8 @@ static int draw(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) dstY += x; dstU += x; dstV += x; +if (dstA != NULL) +dstA += x; } switch (mode) { @@ -382,6 +391,8 @@ static int draw(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) dstY[0] = av_clip_uint8(lrintf(Y * 255.f)); dstU[0] = av_clip_uint8(lrintf(U * 255.f)); dstV[0] = av_clip_uint8(lrintf(V * 255.f)); +if (dstA) +dstA[0] = dstY[0]; } break; case 3: @@ -407,6 +418,8 @@ static int draw(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) dstY[0] = av_clip_uint8(lrintf(Y * 255.f)); dstU[0] = av_clip_uint8(lrintf(U * 255.f)); dstV[0] = av_clip_uint8(lrintf(V * 255.f)); +if (dstA) +dstA[0] = dstY[0]; } break; case 2: @@ -419,18 +432,24 @@ static int draw(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) dstY[0] = av_clip_uint8(lrintf(Y * 255.f)); dstU[0] = av_clip_uint8(lrintf(U * 255.f)); dstV[0] = av_clip_uint8(lrintf(V * 255.f)); +if (dstA) +dstA[0] = dstY[0]; break; case 1: Y = atan2f(src[0].im, src[0].re); Y = 0.5f + 0.5f * Y / M_PI; dstY[0] = av_clip_uint8(lrintf(Y * 255.f)); +if (dstA) +dstA[0] = dstY[0]; break; case 0: Y = hypotf(src[0].re, src[0].im); Y = remap_log(Y, log_factor); dstY[0] = av_clip_uint8(lrintf(Y * 255.f)); +if (dstA) +dstA[0] = dstY[0]; break; } } @@ -704,13 +723,14 @@ static int output_frame(AVFilterContext *ctx) AVFilterLink *outlink = ctx->outputs[0]; AVFilterLink *inlink = ctx->inputs[0];
[FFmpeg-cvslog] avfilter/vf_exposure: ensure that scale is always > 0
ffmpeg | branch: master | Paul B Mahol | Sun Dec 4 13:19:50 2022 +0100| [fc016fd665903b61bcf37c5d23897fe951f5d8e6] | committer: Paul B Mahol avfilter/vf_exposure: ensure that scale is always > 0 > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fc016fd665903b61bcf37c5d23897fe951f5d8e6 --- libavfilter/vf_exposure.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavfilter/vf_exposure.c b/libavfilter/vf_exposure.c index 108fba7930..bbe951967b 100644 --- a/libavfilter/vf_exposure.c +++ b/libavfilter/vf_exposure.c @@ -67,8 +67,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) { AVFilterContext *ctx = inlink->dst; ExposureContext *s = ctx->priv; +float diff = fabsf(exp2f(-s->exposure) - s->black); -s->scale = 1.f / (exp2f(-s->exposure) - s->black); +diff = diff > 0.f ? diff : 1.f / 1024.f; +s->scale = 1.f / diff; ff_filter_execute(ctx, s->do_slice, frame, NULL, FFMIN(frame->height, ff_filter_get_nb_threads(ctx))); ___ 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_libplacebo: ensure filter hwdevice is a vulkan one
ffmpeg | branch: master | Timo Rothenpieler | Sun Dec 4 15:22:13 2022 +0100| [ee650398ec29861a1fe5c8d1a905cc340e82378d] | committer: Timo Rothenpieler avfilter/vf_libplacebo: ensure filter hwdevice is a vulkan one Before this, the filter blindly casts to AVVulkanDeviceContext and passes invalid values to libplacebo if it's not. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ee650398ec29861a1fe5c8d1a905cc340e82378d --- libavfilter/vf_libplacebo.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c index 3678b60b7d..d3c62d12a4 100644 --- a/libavfilter/vf_libplacebo.c +++ b/libavfilter/vf_libplacebo.c @@ -252,6 +252,7 @@ static int init_vulkan(AVFilterContext *avctx) { int err = 0; LibplaceboContext *s = avctx->priv; +const AVHWDeviceContext *avhwctx; const AVVulkanDeviceContext *hwctx; uint8_t *buf = NULL; size_t buf_len; @@ -261,7 +262,15 @@ static int init_vulkan(AVFilterContext *avctx) return AVERROR(EINVAL); } -hwctx = ((AVHWDeviceContext*) avctx->hw_device_ctx->data)->hwctx; +avhwctx = avctx->hw_device_ctx->data; + +if (avhwctx->type != AV_HWDEVICE_TYPE_VULKAN) { +av_log(s, AV_LOG_ERROR, "Expected vulkan hwdevice for vf_libplacebo, got %s.\n", +av_hwdevice_get_type_name(avhwctx->type)); +return AVERROR(EINVAL); +} + +hwctx = avhwctx->hwctx; /* Import libavfilter vulkan context into libplacebo */ s->vulkan = pl_vulkan_import(s->log, pl_vulkan_import_params( ___ 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/wavpack: Fix overflow in p=31
ffmpeg | branch: master | Michael Niedermayer | Sun Sep 11 12:00:31 2022 +0200| [9bfae838563b9cf7ced9053265cfdb4405bce7eb] | committer: Michael Niedermayer avcodec/wavpack: Fix overflow in p=31 Untested with "non fuzzed" samples as i have no such file The reference 5.6.0 decoder appears to also have undefined behavior in the lossless codepath for this Fixes: shift exponent 32 is too large for 32-bit type 'int' Fixes: 50930/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVPACK_fuzzer-6319201949712384 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=9bfae838563b9cf7ced9053265cfdb4405bce7eb --- libavcodec/wavpack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c index ea77ae7749..3cb4077550 100644 --- a/libavcodec/wavpack.c +++ b/libavcodec/wavpack.c @@ -126,7 +126,7 @@ static av_always_inline unsigned get_tail(GetBitContext *gb, unsigned k) if (k < 1) return 0; p = av_log2(k); -e = (1 << (p + 1)) - k - 1; +e = (1LL << (p + 1)) - k - 1; res = get_bits_long(gb, p); if (res >= e) res = (res << 1) - e + get_bits1(gb); ___ 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_bm3d: switch to TX from lavu
ffmpeg | branch: master | Paul B Mahol | Sun Dec 4 17:32:04 2022 +0100| [6c814093d8a0351d0a5f5264deba2285a436e88a] | committer: Paul B Mahol avfilter/vf_bm3d: switch to TX from lavu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6c814093d8a0351d0a5f5264deba2285a436e88a --- configure | 3 - libavfilter/vf_bm3d.c | 332 +- 2 files changed, 166 insertions(+), 169 deletions(-) diff --git a/configure b/configure index 0d754e7ae9..f4eedfc207 100755 --- a/configure +++ b/configure @@ -3629,8 +3629,6 @@ avgblur_vulkan_filter_deps="vulkan spirv_compiler" azmq_filter_deps="libzmq" blackframe_filter_deps="gpl" blend_vulkan_filter_deps="vulkan spirv_compiler" -bm3d_filter_deps="avcodec" -bm3d_filter_select="dct" boxblur_filter_deps="gpl" boxblur_opencl_filter_deps="opencl gpl" bs2b_filter_deps="libbs2b" @@ -7444,7 +7442,6 @@ enabled zlib && add_cppflags -DZLIB_CONST # conditional library dependencies, in any order enabled amovie_filter && prepend avfilter_deps "avformat avcodec" enabled aresample_filter&& prepend avfilter_deps "swresample" -enabled bm3d_filter && prepend avfilter_deps "avcodec" enabled cover_rect_filter && prepend avfilter_deps "avformat avcodec" enabled ebur128_filter && enabled swresample && prepend avfilter_deps "swresample" enabled elbg_filter && prepend avfilter_deps "avcodec" diff --git a/libavfilter/vf_bm3d.c b/libavfilter/vf_bm3d.c index 1167027535..14f94cf535 100644 --- a/libavfilter/vf_bm3d.c +++ b/libavfilter/vf_bm3d.c @@ -25,17 +25,17 @@ /** * @todo - * - non-power of 2 DCT * - opponent color space * - temporal support */ #include +#include "libavutil/cpu.h" #include "libavutil/imgutils.h" #include "libavutil/opt.h" #include "libavutil/pixdesc.h" -#include "libavcodec/avfft.h" +#include "libavutil/tx.h" #include "avfilter.h" #include "filters.h" #include "formats.h" @@ -69,16 +69,19 @@ typedef struct PosPairCode { } PosPairCode; typedef struct SliceContext { -DCTContext *gdctf, *gdcti; -DCTContext *dctf, *dcti; -FFTSample *bufferh; -FFTSample *bufferv; -FFTSample *bufferz; -FFTSample *buffer; -FFTSample *rbufferh; -FFTSample *rbufferv; -FFTSample *rbufferz; -FFTSample *rbuffer; +AVTXContext *gdctf, *gdcti; +av_tx_fn tx_fn_g, itx_fn_g; +AVTXContext *dctf, *dcti; +av_tx_fn tx_fn, itx_fn; +float *bufferh; +float *buffert; +float *bufferv; +float *bufferz; +float *buffer; +float *rbufferh; +float *rbufferv; +float *rbufferz; +float *rbuffer; float *num, *den; PosPairCode match_blocks[256]; int nb_match_blocks; @@ -105,7 +108,7 @@ typedef struct BM3DContext { int nb_planes; int planewidth[4]; int planeheight[4]; -int group_bits; +int pblock_size; int pgroup_size; SliceContext slices[MAX_NB_THREADS]; @@ -128,11 +131,12 @@ typedef struct BM3DContext { #define OFFSET(x) offsetof(BM3DContext, x) #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM + static const AVOption bm3d_options[] = { { "sigma", "set denoising strength", OFFSET(sigma), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 9.9, FLAGS }, -{ "block", "set log2(size) of local patch", -OFFSET(block_size), AV_OPT_TYPE_INT, {.i64=4}, 4, 6, FLAGS }, +{ "block", "set size of local patch", +OFFSET(block_size), AV_OPT_TYPE_INT, {.i64=16},8, 64, FLAGS }, { "bstep", "set sliding step for processing blocks", OFFSET(block_step), AV_OPT_TYPE_INT, {.i64=4}, 1, 64, FLAGS }, { "group", "set maximal number of similar blocks", @@ -273,9 +277,9 @@ static void do_block_matching_multi(BM3DContext *s, const uint8_t *src, int src_ double MSE2SSE = s->group_size * s->block_size * s->block_size * src_range * src_range / (s->max * s->max); double distMul = 1. / MSE2SSE; double th_sse = th_mse * MSE2SSE; -int i, index = sc->nb_match_blocks; +int index = sc->nb_match_blocks; -for (i = 0; i < search_size; i++) { +for (int i = 0; i < search_size; i++) { PosCode pos = search_pos[i]; double dist; @@ -316,10 +320,10 @@ static void block_matching_multi(BM3DContext *s, const uint8_t *ref, int ref_lin int r = search_boundary(width - block_size, range, step, 0, y, x); int t = search_boundary(0, range, step, 1, y, x); int b = search_boundary(height - block_size, range, step, 1, y, x); -int j, i, index = 0; +int index = 0; -for (j = t; j <= b; j += step) { -for (i = l; i <= r; i += step) { +for (int j = t; j <= b; j += step) { +for (int i = l; i <= r; i += step) { PosCode pos; if (exclude_cur_pos > 0 && j == y && i == x) { @@ -364,22 +368,18 @@ static void get_block_row(const uint8_t *srcp, int src_linesize