[FFmpeg-cvslog] avfilter/vf_chromanr: fix rounding of final output
ffmpeg | branch: master | Paul B Mahol | Tue Mar 1 09:22:15 2022 +0100| [5ffad29d626ec14d050d07009eed8ae3887287d2] | committer: Paul B Mahol avfilter/vf_chromanr: fix rounding of final output > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5ffad29d626ec14d050d07009eed8ae3887287d2 --- libavfilter/vf_chromanr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_chromanr.c b/libavfilter/vf_chromanr.c index 63ec8ff075..385a26c8a6 100644 --- a/libavfilter/vf_chromanr.c +++ b/libavfilter/vf_chromanr.c @@ -161,8 +161,8 @@ static int distance ## _slice##name(AVFilterContext *ctx, void *arg, } \ } \ \ -out_uptr[x] = su / cn; \ -out_vptr[x] = sv / cn; \ +out_uptr[x] = (su + (cn >> 1)) / cn; \ +out_vptr[x] = (sv + (cn >> 1)) / cn; \ } \ \ out_uptr += out_ulinesize / sizeof(type); \ ___ 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_v360: improve rounding in xyz_to_dfisheye()
ffmpeg | branch: master | Paul B Mahol | Tue Mar 1 10:14:03 2022 +0100| [e1974622e1e07bee1f6324be60bd0a97f1811b3f] | committer: Paul B Mahol avfilter/vf_v360: improve rounding in xyz_to_dfisheye() > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e1974622e1e07bee1f6324be60bd0a97f1811b3f --- libavfilter/vf_v360.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c index a216aeebdd..7f377dd8f2 100644 --- a/libavfilter/vf_v360.c +++ b/libavfilter/vf_v360.c @@ -3468,7 +3468,7 @@ static int xyz_to_dfisheye(const V360Context *s, u_shift = ceilf(ew); } else { u_shift = 0; -uf = ew - uf; +uf = ew - uf - 1.f; } ui = floorf(uf); ___ 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_unsharp: add support for alpha formats
ffmpeg | branch: master | Paul B Mahol | Tue Mar 1 12:33:56 2022 +0100| [84f5583078699e96b040f4f41b39720b683326d0] | committer: Paul B Mahol avfilter/vf_unsharp: add support for alpha formats > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=84f5583078699e96b040f4f41b39720b683326d0 --- doc/filters.texi | 17 + libavfilter/unsharp.h| 5 - libavfilter/vf_unsharp.c | 28 3 files changed, 41 insertions(+), 9 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index c3623dee89..c5cba2aa2d 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -21585,6 +21585,23 @@ sharpen it, a value of zero will disable the effect. Default value is 0.0. +@item alpha_msize_x, ax +Set the alpha matrix horizontal size. It must be an odd integer +between 3 and 23. The default value is 5. + +@item alpha_msize_y, ay +Set the alpha matrix vertical size. It must be an odd integer +between 3 and 23. The default value is 5. + +@item alpha_amount, aa +Set the alpha effect strength. It must be a floating point number, reasonable +values lay between -1.5 and 1.5. + +Negative values will blur the input video, while positive values will +sharpen it, a value of zero will disable the effect. + +Default value is 0.0. + @end table All parameters are optional and default to the equivalent of the diff --git a/libavfilter/unsharp.h b/libavfilter/unsharp.h index 253e32dd19..0da6f05036 100644 --- a/libavfilter/unsharp.h +++ b/libavfilter/unsharp.h @@ -44,14 +44,17 @@ typedef struct UnsharpFilterParam { typedef struct UnsharpContext { const AVClass *class; int lmsize_x, lmsize_y, cmsize_x, cmsize_y; +int amsize_x, amsize_y; float lamount, camount; +float aamount; UnsharpFilterParam luma; ///< luma parameters (width, height, amount) UnsharpFilterParam chroma; ///< chroma parameters (width, height, amount) +UnsharpFilterParam alpha; ///< alpha parameters (width, height, amount) int hsub, vsub; +int nb_planes; int bitdepth; int bps; int nb_threads; -int opencl; int (* apply_unsharp)(AVFilterContext *ctx, AVFrame *in, AVFrame *out); int (* unsharp_slice)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs); } UnsharpContext; diff --git a/libavfilter/vf_unsharp.c b/libavfilter/vf_unsharp.c index 9a31045116..e88e732c9e 100644 --- a/libavfilter/vf_unsharp.c +++ b/libavfilter/vf_unsharp.c @@ -146,17 +146,18 @@ static int apply_unsharp_c(AVFilterContext *ctx, AVFrame *in, AVFrame *out) { AVFilterLink *inlink = ctx->inputs[0]; UnsharpContext *s = ctx->priv; -int i, plane_w[3], plane_h[3]; -UnsharpFilterParam *fp[3]; +int i, plane_w[4], plane_h[4]; +UnsharpFilterParam *fp[4]; ThreadData td; -plane_w[0] = inlink->w; +plane_w[0] = plane_w[3] = inlink->w; plane_w[1] = plane_w[2] = AV_CEIL_RSHIFT(inlink->w, s->hsub); -plane_h[0] = inlink->h; +plane_h[0] = plane_h[3] = inlink->h; plane_h[1] = plane_h[2] = AV_CEIL_RSHIFT(inlink->h, s->vsub); fp[0] = &s->luma; fp[1] = fp[2] = &s->chroma; -for (i = 0; i < 3; i++) { +fp[3] = &s->alpha; +for (i = 0; i < s->nb_planes; i++) { td.fp = fp[i]; td.dst = out->data[i]; td.src = in->data[i]; @@ -188,9 +189,10 @@ static av_cold int init(AVFilterContext *ctx) set_filter_param(&s->luma, s->lmsize_x, s->lmsize_y, s->lamount); set_filter_param(&s->chroma, s->cmsize_x, s->cmsize_y, s->camount); +set_filter_param(&s->alpha, s->amsize_x, s->amsize_y, s->aamount); -if (s->luma.scalebits >= 26 || s->chroma.scalebits >= 26) { -av_log(ctx, AV_LOG_ERROR, "luma or chroma matrix size too big\n"); +if (s->luma.scalebits >= 26 || s->chroma.scalebits >= 26 || s->alpha.scalebits >= 26) { +av_log(ctx, AV_LOG_ERROR, "luma or chroma or alpha matrix size too big\n"); return AVERROR(EINVAL); } s->apply_unsharp = apply_unsharp_c; @@ -198,6 +200,10 @@ static av_cold int init(AVFilterContext *ctx) } static const enum AVPixelFormat pix_fmts[] = { +AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA444P, +AV_PIX_FMT_YUVA444P9, AV_PIX_FMT_YUVA444P10, AV_PIX_FMT_YUVA444P12, AV_PIX_FMT_YUVA444P16, +AV_PIX_FMT_YUVA422P9, AV_PIX_FMT_YUVA422P10, AV_PIX_FMT_YUVA422P12, AV_PIX_FMT_YUVA422P16, +AV_PIX_FMT_YUVA420P9, AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUV420P9, AV_PIX_FMT_YUV422P9, AV_PIX_FMT_YUV444P9, @@ -242,6 +248,7 @@ static int config_input(AVFilterLink *inlink) const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); int ret; +s->nb_planes = desc->nb_components; s->hsub = desc->log2_chroma_w; s->vsub = desc->log2_chroma_h; s->bitdept
[FFmpeg-cvslog] doc/bitstream_filters: add missing entry for the time_base setts option
ffmpeg | branch: master | James Almer | Tue Mar 1 18:24:03 2022 -0300| [a1fff6566b84b4f53d459ca9532ba8ee43a18d38] | committer: James Almer doc/bitstream_filters: add missing entry for the time_base setts option Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a1fff6566b84b4f53d459ca9532ba8ee43a18d38 --- doc/bitstream_filters.texi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/bitstream_filters.texi b/doc/bitstream_filters.texi index b11d357941..a0092878c8 100644 --- a/doc/bitstream_filters.texi +++ b/doc/bitstream_filters.texi @@ -738,6 +738,8 @@ It accepts the following parameters: Set expressions for PTS, DTS or both. @item duration Set expression for duration. +@item time_base +Set output time base. @end table The expressions are evaluated through the eval API and can contain the following ___ 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 Hevc_mc_uni/w with LSX.
ffmpeg | branch: master | Lu Wang | Thu Feb 17 19:11:51 2022 +0800| [72604b10f4e1debebc4830bd94830e7066ea] | committer: Michael Niedermayer avcodec: [loongarch] Optimize Hevc_mc_uni/w with LSX. ffmpeg -i 5_h265_1080p_60fps_3Mbps.mkv -f rawvideo -y /dev/null -an before: 182fps after : 191fps Signed-off-by: Hao Chen Reviewed-by: 殷时友 Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=72604b10f4e1debebc4830bd94830e7066ea --- libavcodec/loongarch/Makefile |4 +- libavcodec/loongarch/hevc_mc_uni_lsx.c| 1423 + libavcodec/loongarch/hevc_mc_uniw_lsx.c | 298 ++ libavcodec/loongarch/hevcdsp_init_loongarch.c | 30 + libavcodec/loongarch/hevcdsp_lsx.h| 59 + 5 files changed, 1813 insertions(+), 1 deletion(-) diff --git a/libavcodec/loongarch/Makefile b/libavcodec/loongarch/Makefile index 620fba7192..c1b5de5c44 100644 --- a/libavcodec/loongarch/Makefile +++ b/libavcodec/loongarch/Makefile @@ -28,4 +28,6 @@ LSX-OBJS-$(CONFIG_VP9_DECODER)+= loongarch/vp9_mc_lsx.o \ LSX-OBJS-$(CONFIG_HEVC_DECODER) += loongarch/hevcdsp_lsx.o \ loongarch/hevc_idct_lsx.o \ loongarch/hevc_lpf_sao_lsx.o \ - loongarch/hevc_mc_bi_lsx.o + loongarch/hevc_mc_bi_lsx.o \ + loongarch/hevc_mc_uni_lsx.o \ + loongarch/hevc_mc_uniw_lsx.o diff --git a/libavcodec/loongarch/hevc_mc_uni_lsx.c b/libavcodec/loongarch/hevc_mc_uni_lsx.c new file mode 100644 index 00..a15c86268f --- /dev/null +++ b/libavcodec/loongarch/hevc_mc_uni_lsx.c @@ -0,0 +1,1423 @@ +/* + * Copyright (c) 2022 Loongson Technology Corporation Limited + * Contributed by Lu Wang + *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/loongson_intrinsics.h" +#include "hevcdsp_lsx.h" + +static const uint8_t ff_hevc_mask_arr[16 * 3] __attribute__((aligned(0x40))) = { +/* 8 width cases */ +0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, +/* 4 width cases */ +0, 1, 1, 2, 2, 3, 3, 4, 16, 17, 17, 18, 18, 19, 19, 20, +/* 4 width cases */ +8, 9, 9, 10, 10, 11, 11, 12, 24, 25, 25, 26, 26, 27, 27, 28 +}; + +static av_always_inline +void common_hz_8t_64w_lsx(uint8_t *src, int32_t src_stride, + uint8_t *dst, int32_t dst_stride, + const int8_t *filter, int32_t height) +{ +int32_t loop_cnt; +__m128i mask0, mask1, mask2, mask3, out1, out2; +__m128i src0, src1, src2, src3, src4, src5, src6, src7; +__m128i vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7; +__m128i filt0, filt1, filt2, filt3; +__m128i res0, res1, res2, res3; + +mask0 = __lsx_vld(ff_hevc_mask_arr, 0); +src -= 3; + +/* rearranging filter */ +DUP4_ARG2(__lsx_vldrepl_h, filter, 0, filter, 2, filter, 4, filter, 6, + filt0, filt1, filt2, filt3); + +DUP2_ARG2(__lsx_vaddi_bu, mask0, 2, mask0, 4, mask1, mask2); +mask3 = __lsx_vaddi_bu(mask0, 6); + +for (loop_cnt = height; loop_cnt--;) { +DUP4_ARG2(__lsx_vld, src, 0, src, 8, src, 16, src, 24, + src0, src1, src2, src3); +DUP4_ARG2(__lsx_vld, src, 32, src, 40, src, 48, src, 56, + src4, src5, src6, src7); +src += src_stride; + +DUP2_ARG3(__lsx_vshuf_b, src0, src0, mask0, src1, src1, mask0, + vec0, vec1); +DUP2_ARG3(__lsx_vshuf_b, src2, src2, mask0, src3, src3, mask0, + vec2, vec3); +DUP4_ARG2(__lsx_vdp2_h_bu_b, vec0, filt0, vec1, filt0, vec2, filt0, + vec3, filt0, res0, res1, res2, res3); +DUP2_ARG3(__lsx_vshuf_b, src0, src0, mask2, src1, src1, mask2, + vec0, vec1); +DUP2_ARG3(__lsx_vshuf_b, src2, src2, mask2, src3, src3, mask2, + vec2, vec3); +DUP4_ARG3(__lsx_vdp2add_h_bu_b, res0, vec0, filt2, res1, vec1, filt2, + res2, vec2, filt2, res3, vec3, filt2, res0, res1, res2, res3); +DUP2_A
[FFmpeg-cvslog] avfilter/drawtext: change reload value to an interval
ffmpeg | branch: master | Gyan Doshi | Mon Feb 28 13:13:42 2022 +0530| [4b72bca6ca3f982614ac2f94160c55abe3778555] | committer: Gyan Doshi avfilter/drawtext: change reload value to an interval Allows user to specify a frame interval at which textfile is reloaded. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4b72bca6ca3f982614ac2f94160c55abe3778555 --- doc/filters.texi | 6 -- libavfilter/vf_drawtext.c | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index c5cba2aa2d..8cba7f744d 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -11278,8 +11278,10 @@ text data in detection bboxes of side data. So please do not use this parameter if you are not sure about the text source. @item reload -If set to 1, the @var{textfile} will be reloaded before each frame. -Be sure to update it atomically, or it may be read partially, or even fail. +The @var{textfile} will be reloaded at specified frame interval. +Be sure to update @var{textfile} atomically, or it may be read partially, +or even fail. +Range is 0 to INT_MAX. Default is 0. @item x @item y diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c index 2a88692cbd..6ba3f6622a 100644 --- a/libavfilter/vf_drawtext.c +++ b/libavfilter/vf_drawtext.c @@ -198,7 +198,7 @@ typedef struct DrawTextContext { AVRational tc_rate;///< frame rate for timecode AVTimecode tc; ///< timecode context int tc24hmax; ///< 1 if timecode is wrapped to 24 hours, 0 otherwise -int reload; ///< reload text file for each frame +int reload; ///< reload text file at specified frame interval int start_number; ///< starting frame number for n/frame_num var char *text_source_string; ///< the string to specify text data source enum AVFrameSideDataType text_source; @@ -245,7 +245,7 @@ static const AVOption drawtext_options[]= { {"timecode_rate", "set rate (timecode only)", OFFSET(tc_rate), AV_OPT_TYPE_RATIONAL, {.dbl=0}, 0, INT_MAX, FLAGS}, {"r", "set rate (timecode only)", OFFSET(tc_rate), AV_OPT_TYPE_RATIONAL, {.dbl=0}, 0, INT_MAX, FLAGS}, {"rate","set rate (timecode only)", OFFSET(tc_rate), AV_OPT_TYPE_RATIONAL, {.dbl=0}, 0, INT_MAX, FLAGS}, -{"reload", "reload text file for each frame", OFFSET(reload), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS}, +{"reload", "reload text file at specified frame interval", OFFSET(reload), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGS}, { "alpha", "apply alpha while rendering", OFFSET(a_expr), AV_OPT_TYPE_STRING, { .str = "1" }, .flags = FLAGS }, {"fix_bounds", "check and fix text coords to avoid clipping", OFFSET(fix_bounds), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS}, {"start_number", "start frame number for n/frame_num variable", OFFSET(start_number), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGS}, @@ -1565,7 +1565,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) } } -if (s->reload) { +if (s->reload && !(inlink->frame_count_out % s->reload)) { if ((ret = load_textfile(ctx)) < 0) { av_frame_free(&frame); 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".