[FFmpeg-cvslog] avfilter/vf_chromanr: improve filtering results
ffmpeg | branch: master | Paul B Mahol | Wed Nov 3 11:25:04 2021 +0100| [bf9950446d73e4c380bdc0ea8241bbd0f86d7983] | committer: Paul B Mahol avfilter/vf_chromanr: improve filtering results > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bf9950446d73e4c380bdc0ea8241bbd0f86d7983 --- doc/filters.texi | 8 libavfilter/vf_chromanr.c | 32 ++-- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 177f0774fc..62a580a245 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -8048,7 +8048,7 @@ Set threshold for averaging chrominance values. Sum of absolute difference of Y, U and V pixel components of current pixel and neighbour pixels lower than this threshold will be used in averaging. Luma component is left unchanged and is copied to output. -Default value is 30. Allowed range is from 1 to 5000. +Default value is 30. Allowed range is from 1 to 200. @item sizew Set horizontal radius of rectangle used for averaging. @@ -8072,19 +8072,19 @@ Mostly useful to speed-up filtering. Set Y threshold for averaging chrominance values. Set finer control for max allowed difference between Y components of current pixel and neigbour pixels. -Default value is 5000. Allowed range is from 1 to 5000. +Default value is 200. Allowed range is from 1 to 200. @item threu Set U threshold for averaging chrominance values. Set finer control for max allowed difference between U components of current pixel and neigbour pixels. -Default value is 5000. Allowed range is from 1 to 5000. +Default value is 200. Allowed range is from 1 to 200. @item threv Set V threshold for averaging chrominance values. Set finer control for max allowed difference between V components of current pixel and neigbour pixels. -Default value is 5000. Allowed range is from 1 to 5000. +Default value is 200. Allowed range is from 1 to 200. @item distance Set distance type used in calculations. diff --git a/libavfilter/vf_chromanr.c b/libavfilter/vf_chromanr.c index 9c36e02c00..63ec8ff075 100644 --- a/libavfilter/vf_chromanr.c +++ b/libavfilter/vf_chromanr.c @@ -72,7 +72,8 @@ static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_NONE }; -#define SQR(x) ((x)*(x)) +#define MANHATTAN_DISTANCE(x, y, z) ((x) + (y) + (z)) +#define EUCLIDEAN_DISTANCE(x, y, z) (sqrtf((x)*(x) + (y)*(y) + (z)*(z))) #define FILTER_FUNC(distance, name, ctype, type, fun) \ static int distance ## _slice##name(AVFilterContext *ctx, void *arg, \ @@ -136,19 +137,22 @@ static int distance ## _slice##name(AVFilterContext *ctx, void *arg, int sv = cv; \ int cn = 1; \ \ -for (int yy = FFMAX(0, y - sizeh); yy < FFMIN(y + sizeh, h); yy += steph) { \ +for (int yy = FFMAX(0, y - sizeh); yy <= FFMIN(y + sizeh, h - 1); yy += steph) { \ const type *in_yptr = (const type *)(in->data[0] + yy * chroma_h * in_ylinesize); \ const type *in_uptr = (const type *)(in->data[1] + yy * in_ulinesize);\ const type *in_vptr = (const type *)(in->data[2] + yy * in_vlinesize);\ \ -for (int xx = FFMAX(0, x - sizew); xx < FFMIN(x + sizew, w); xx += stepw) { \ +for (int xx = FFMAX(0, x - sizew); xx <= FFMIN(x + sizew, w - 1); xx += stepw) { \ const ctype Y = in_yptr[xx * chroma_w]; \ const ctype U = in_uptr[xx]; \ const ctype V = in_vptr[xx]; \ +const ctype cyY = FFABS(cy - Y); \ +const ctype cuU = FFABS(cu - U); \ +const ctype cvV = FFABS(cv - V); \ \ -if (fun(cu - U) + fun(cv - V) + fun(cy - Y) < thres && \ -fun(cu - U) < thres_u && fun(cv - V) < thres_v && \ -fun(cy - Y) < thres_y && \ +if (fun(cyY, cuU, cvV) < thres && \ +cuU < thres_u && cvV < thres_v && \ +cyY < thres_y && \
[FFmpeg-cvslog] avutil/hwcontext_videotoolbox: fix use of unknown builtin '__builtin_available'
ffmpeg | branch: master | Limin Wang | Sun Oct 31 19:34:33 2021 +0800| [6cab5206b0ad94990c435cb7c5cf3b29675e0231] | committer: Limin Wang avutil/hwcontext_videotoolbox: fix use of unknown builtin '__builtin_available' OSX version: 10.11.6 Apple LLVM version 8.0.0 (clang-800.0.42.1) Target: x86_64-apple-darwin15.6.0 Signed-off-by: Limin Wang > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6cab5206b0ad94990c435cb7c5cf3b29675e0231 --- configure | 8 ++ libavutil/hwcontext_videotoolbox.c | 54 +- 2 files changed, 38 insertions(+), 24 deletions(-) diff --git a/configure b/configure index ede8f9777b..c4fb1b7260 100755 --- a/configure +++ b/configure @@ -2329,6 +2329,10 @@ TYPES_LIST=" kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ kCVImageBufferTransferFunction_ITU_R_2100_HLG kCVImageBufferTransferFunction_Linear +kCVImageBufferYCbCrMatrix_ITU_R_2020 +kCVImageBufferColorPrimaries_ITU_R_2020 +kCVImageBufferTransferFunction_ITU_R_2020 +kCVImageBufferTransferFunction_SMPTE_ST_428_1 socklen_t struct_addrinfo struct_group_source_req @@ -6273,6 +6277,10 @@ enabled videotoolbox && { check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ "-framework CoreVideo" check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_ITU_R_2100_HLG "-framework CoreVideo" check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_Linear "-framework CoreVideo" +check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferYCbCrMatrix_ITU_R_2020 "-framework CoreVideo" +check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferColorPrimaries_ITU_R_2020 "-framework CoreVideo" +check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_ITU_R_2020 "-framework CoreVideo" +check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_SMPTE_ST_428_1 "-framework CoreVideo" } check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss diff --git a/libavutil/hwcontext_videotoolbox.c b/libavutil/hwcontext_videotoolbox.c index 58095a1fc9..25f4e17715 100644 --- a/libavutil/hwcontext_videotoolbox.c +++ b/libavutil/hwcontext_videotoolbox.c @@ -375,10 +375,11 @@ static int vt_pixbuf_set_colorspace(AVHWFramesContext *hwfc, switch (src->colorspace) { case AVCOL_SPC_BT2020_CL: case AVCOL_SPC_BT2020_NCL: -if (__builtin_available(macOS 10.11, *)) -colormatrix = kCVImageBufferYCbCrMatrix_ITU_R_2020; -else -colormatrix = CFSTR("ITU_R_2020"); +#if HAVE_KCVIMAGEBUFFERYCBCRMATRIX_ITU_R_2020 +colormatrix = kCVImageBufferYCbCrMatrix_ITU_R_2020; +#else +colormatrix = CFSTR("ITU_R_2020"); +#endif break; case AVCOL_SPC_BT470BG: case AVCOL_SPC_SMPTE170M: @@ -398,10 +399,11 @@ static int vt_pixbuf_set_colorspace(AVHWFramesContext *hwfc, switch (src->color_primaries) { case AVCOL_PRI_BT2020: -if (__builtin_available(macOS 10.11, *)) -colorpri = kCVImageBufferColorPrimaries_ITU_R_2020; -else -colorpri = CFSTR("ITU_R_2020"); +#if HAVE_KCVIMAGEBUFFERCOLORPRIMARIES_ITU_R_2020 +colorpri = kCVImageBufferColorPrimaries_ITU_R_2020; +#else +colorpri = CFSTR("ITU_R_2020"); +#endif break; case AVCOL_PRI_BT709: colorpri = kCVImageBufferColorPrimaries_ITU_R_709_2; @@ -420,17 +422,19 @@ static int vt_pixbuf_set_colorspace(AVHWFramesContext *hwfc, switch (src->color_trc) { case AVCOL_TRC_SMPTE2084: -if (__builtin_available(macOS 10.13, *)) -colortrc = kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ; -else -colortrc = CFSTR("SMPTE_ST_2084_PQ"); +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_SMPTE_ST_2084_PQ +colortrc = kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ; +#else +colortrc = CFSTR("SMPTE_ST_2084_PQ"); +#endif break; case AVCOL_TRC_BT2020_10: case AVCOL_TRC_BT2020_12: -if (__builtin_available(macOS 10.11, *)) -colortrc = kCVImageBufferTransferFunction_ITU_R_2020; -else -colortrc = CFSTR("ITU_R_2020"); +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_ITU_R_2020 +colortrc = kCVImageBufferTransferFunction_ITU_R_2020; +#else +colortrc = CFSTR("ITU_R_2020"); +#endif break; case AVCOL_TRC_BT709: colortrc = kCVImageBufferTransferFunction_ITU_R_709_2; @@ -439,16 +443,18 @@ static int vt_pixbuf_set_colorspace(AVHWFramesContext *hwfc, colortrc = kCVImageBufferTransferFunction_SMPTE_240M_1995; break; case AVCOL_TRC_SMPTE428: -if (__builtin_available(macOS 10.12, *)) -colortrc = kCVImageBufferTransferFunction_SMPTE_ST_428_1; -else -colortrc = CFSTR("SMPTE_ST_428_1"); +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_SMPTE_ST
[FFmpeg-cvslog] avformat/dashenc: Fix comparing double with 0
ffmpeg | branch: master | Limin Wang | Sun Oct 10 22:39:48 2021 +0800| [f05559554c41306698aa98618b140f06775e4bcb] | committer: Limin Wang avformat/dashenc: Fix comparing double with 0 Signed-off-by: Limin Wang > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f05559554c41306698aa98618b140f06775e4bcb --- libavformat/dashenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 06bbf36c95..94e77c7b8c 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -551,7 +551,7 @@ static void write_hls_media_playlist(OutputStream *os, AVFormatContext *s, for (i = start_index; i < os->nb_segments; i++) { Segment *seg = os->segments[i]; -if (prog_date_time == 0) { +if (fabs(prog_date_time) < 1e-7) { if (os->nb_segments == 1) prog_date_time = c->start_time_s; else ___ 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/parseutils: add qhd(Quad HD) or wqhd(Wide Quad HD) for 1440p
ffmpeg | branch: master | Limin Wang | Tue Oct 26 16:52:52 2021 +0800| [8dc8c01d6c237546be7d50b9c40a1440f43d8619] | committer: Limin Wang avutil/parseutils: add qhd(Quad HD) or wqhd(Wide Quad HD) for 1440p Signed-off-by: Limin Wang > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8dc8c01d6c237546be7d50b9c40a1440f43d8619 --- libavutil/parseutils.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c index 7f678cd85a..19bbdde611 100644 --- a/libavutil/parseutils.c +++ b/libavutil/parseutils.c @@ -102,6 +102,7 @@ static const VideoSizeAbbr video_size_abbrs[] = { { "wsxga",1600,1024 }, { "wuxga",1920,1200 }, { "woxga",2560,1600 }, +{ "wqhd", 2560,1440 }, { "wqsxga", 3200,2048 }, { "wquxga", 3840,2400 }, { "whsxga", 6400,4096 }, @@ -111,6 +112,7 @@ static const VideoSizeAbbr video_size_abbrs[] = { { "hd480", 852, 480 }, { "hd720",1280, 720 }, { "hd1080", 1920,1080 }, +{ "qhd", 2560,1440 }, { "2k", 2048,1080 }, /* Digital Cinema System Specification */ { "2kdci",2048,1080 }, { "2kflat", 1998,1080 }, ___ 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] avformat/isom_tags: fix 'ipcm' with samplesize equal to 16
ffmpeg | branch: master | Zhao Zhili | Fri Oct 29 15:49:07 2021 +0800| [82e3251dd269bdf3c45b991b12dab1ce7561d542] | committer: Paul B Mahol avformat/isom_tags: fix 'ipcm' with samplesize equal to 16 Use PCM_S16 so the codec_id will be updated later according to bits_per_coded_sample. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=82e3251dd269bdf3c45b991b12dab1ce7561d542 --- libavformat/isom_tags.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/isom_tags.c b/libavformat/isom_tags.c index d0400b18fc..62e60470a8 100644 --- a/libavformat/isom_tags.c +++ b/libavformat/isom_tags.c @@ -312,10 +312,10 @@ const AVCodecTag ff_codec_movaudio_tags[] = { { AV_CODEC_ID_PCM_S16LE, MKTAG('s', 'o', 'w', 't') }, { AV_CODEC_ID_PCM_S16BE, MKTAG('l', 'p', 'c', 'm') }, { AV_CODEC_ID_PCM_S16LE, MKTAG('l', 'p', 'c', 'm') }, +{ AV_CODEC_ID_PCM_S16BE, MKTAG('i', 'p', 'c', 'm') }, +{ AV_CODEC_ID_PCM_S16LE, MKTAG('i', 'p', 'c', 'm') }, { AV_CODEC_ID_PCM_S24BE, MKTAG('i', 'n', '2', '4') }, { AV_CODEC_ID_PCM_S24LE, MKTAG('i', 'n', '2', '4') }, -{ AV_CODEC_ID_PCM_S24BE, MKTAG('i', 'p', 'c', 'm') }, -{ AV_CODEC_ID_PCM_S24LE, MKTAG('i', 'p', 'c', 'm') }, { AV_CODEC_ID_PCM_S32BE, MKTAG('i', 'n', '3', '2') }, { AV_CODEC_ID_PCM_S32LE, MKTAG('i', 'n', '3', '2') }, { AV_CODEC_ID_PCM_S8, MKTAG('s', 'o', 'w', 't') }, ___ 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/scale_npp: add scale2ref_npp filter
ffmpeg | branch: master | Roman Arzumanyan | Mon Sep 6 15:25:51 2021 +0300| [08a501946f95f3a998000ee923aa7fcb35ec0d4e] | committer: Timo Rothenpieler avfilter/scale_npp: add scale2ref_npp filter Signed-off-by: Timo Rothenpieler > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=08a501946f95f3a998000ee923aa7fcb35ec0d4e --- configure | 1 + doc/filters.texi | 111 + libavfilter/Makefile | 1 + libavfilter/allfilters.c | 1 + libavfilter/version.h | 2 +- libavfilter/vf_scale_npp.c | 544 + 6 files changed, 620 insertions(+), 40 deletions(-) diff --git a/configure b/configure index c4fb1b7260..c01aa480c7 100755 --- a/configure +++ b/configure @@ -3095,6 +3095,7 @@ v4l2_m2m_deps="linux_videodev2_h sem_timedwait" hwupload_cuda_filter_deps="ffnvcodec" scale_npp_filter_deps="ffnvcodec libnpp" +scale2ref_npp_filter_deps="ffnvcodec libnpp" scale_cuda_filter_deps="ffnvcodec" scale_cuda_filter_deps_any="cuda_nvcc cuda_llvm" thumbnail_cuda_filter_deps="ffnvcodec" diff --git a/doc/filters.texi b/doc/filters.texi index 62a580a245..b537e421be 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -18494,6 +18494,7 @@ scale_cuda=passthrough=0 @end example @end itemize +@anchor{scale_npp} @section scale_npp Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel @@ -18570,6 +18571,61 @@ This option can be handy if you need to have a video fit within or exceed a defined resolution using @option{force_original_aspect_ratio} but also have encoder restrictions on width or height divisibility. +@item eval +Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values: + +@table @samp +@item init +Only evaluate expressions once during the filter initialization or when a command is processed. + +@item frame +Evaluate expressions for each incoming frame. + +@end table + +@end table + +The values of the @option{w} and @option{h} options are expressions +containing the following constants: + +@table @var +@item in_w +@item in_h +The input width and height + +@item iw +@item ih +These are the same as @var{in_w} and @var{in_h}. + +@item out_w +@item out_h +The output (scaled) width and height + +@item ow +@item oh +These are the same as @var{out_w} and @var{out_h} + +@item a +The same as @var{iw} / @var{ih} + +@item sar +input sample aspect ratio + +@item dar +The input display aspect ratio. Calculated from @code{(iw / ih) * sar}. + +@item n +The (sequential) number of the input frame, starting from 0. +Only available with @code{eval=frame}. + +@item t +The presentation timestamp of the input frame, expressed as a number of +seconds. Only available with @code{eval=frame}. + +@item pos +The position (byte offset) of the frame in the input stream, or NaN if +this information is unavailable and/or meaningless (for example in case of synthetic video). +Only available with @code{eval=frame}. @end table @section scale2ref @@ -18645,6 +18701,61 @@ If the specified expression is not valid, it is kept at its current value. @end table +@section scale2ref_npp + +Use the NVIDIA Performance Primitives (libnpp) to scale (resize) the input +video, based on a reference video. + +See the @ref{scale_npp} filter for available options, scale2ref_npp supports the same +but uses the reference video instead of the main input as basis. scale2ref_npp +also supports the following additional constants for the @option{w} and +@option{h} options: + +@table @var +@item main_w +@item main_h +The main input video's width and height + +@item main_a +The same as @var{main_w} / @var{main_h} + +@item main_sar +The main input video's sample aspect ratio + +@item main_dar, mdar +The main input video's display aspect ratio. Calculated from +@code{(main_w / main_h) * main_sar}. + +@item main_n +The (sequential) number of the main input frame, starting from 0. +Only available with @code{eval=frame}. + +@item main_t +The presentation timestamp of the main input frame, expressed as a number of +seconds. Only available with @code{eval=frame}. + +@item main_pos +The position (byte offset) of the frame in the main input stream, or NaN if +this information is unavailable and/or meaningless (for example in case of synthetic video). +Only available with @code{eval=frame}. +@end table + +@subsection Examples + +@itemize +@item +Scale a subtitle stream (b) to match the main video (a) in size before overlaying +@example +'scale2ref_npp[b][a];[a][b]overlay_cuda' +@end example + +@item +Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio. +@example +[logo-in][video-in]scale2ref_npp=w=oh*mdar:h=ih/10[logo-out][video-out] +@end example +@end itemize + @section scharr Apply scharr operator to input video stream. diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 933d9628ea..552bd4e286 100644 --- a/libavfilter/Makefile +++ b/lib