* [FFmpeg-devel] [PATCH 1/5] avfilter/drawutils: ban XYZ formats @ 2023-10-26 12:18 Niklas Haas 2023-10-26 12:18 ` [FFmpeg-devel] [PATCH 2/5] avutil/pixdesc: add AV_PIX_FMT_FLAG_XYZ Niklas Haas ` (3 more replies) 0 siblings, 4 replies; 10+ messages in thread From: Niklas Haas @ 2023-10-26 12:18 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Niklas Haas From: Niklas Haas <git@haasn.dev> These are not supported by the drawing functions at all, and were incorrectly advertised as supported in the past. --- libavfilter/drawutils.c | 3 +++ tests/ref/fate/filter-pixfmts-pad | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libavfilter/drawutils.c b/libavfilter/drawutils.c index 1081938d86..c31ab6bd5a 100644 --- a/libavfilter/drawutils.c +++ b/libavfilter/drawutils.c @@ -22,6 +22,7 @@ #include <string.h> #include "libavutil/avassert.h" +#include "libavutil/avstring.h" #include "libavutil/avutil.h" #include "libavutil/csp.h" #include "libavutil/intreadwrite.h" @@ -93,6 +94,8 @@ int ff_draw_init2(FFDrawContext *draw, enum AVPixelFormat format, enum AVColorSp return AVERROR(ENOSYS); if (desc->flags & ~(AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA)) return AVERROR(ENOSYS); + if (av_strstart(desc->name, "xyz", NULL)) + return AVERROR(ENOSYS); if (csp == AVCOL_SPC_UNSPECIFIED) csp = (desc->flags & AV_PIX_FMT_FLAG_RGB) ? AVCOL_SPC_RGB : AVCOL_SPC_SMPTE170M; if (!(desc->flags & AV_PIX_FMT_FLAG_RGB) && !(luma = av_csp_luma_coeffs_from_avcsp(csp))) diff --git a/tests/ref/fate/filter-pixfmts-pad b/tests/ref/fate/filter-pixfmts-pad index dd01059c59..b4d236d408 100644 --- a/tests/ref/fate/filter-pixfmts-pad +++ b/tests/ref/fate/filter-pixfmts-pad @@ -43,7 +43,6 @@ rgb48le ed08db9b1aa50d69b8c3d73db93e390e rgba b157c90191463d34fb3ce77b36c96386 vuya 44368c0a758ee68e24ce976e3b1b8535 vuyx bc7c4f693a22cd1ac95e33d473086474 -xyz12le 23dadbbba70b2925ce75fb8ba8080ba3 ya16le 8dbfcb586abf626da7d1aca887a581b9 ya8 495daaca2dcb4f7aeba7652768b41ced yuv410p cb871dcc1e84a7ef1d21f9237b88cf6e -- 2.42.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 10+ messages in thread
* [FFmpeg-devel] [PATCH 2/5] avutil/pixdesc: add AV_PIX_FMT_FLAG_XYZ 2023-10-26 12:18 [FFmpeg-devel] [PATCH 1/5] avfilter/drawutils: ban XYZ formats Niklas Haas @ 2023-10-26 12:18 ` Niklas Haas 2023-10-26 12:18 ` [FFmpeg-devel] [PATCH 3/5] avfilter/drawutils: simplify xyz format check Niklas Haas ` (2 subsequent siblings) 3 siblings, 0 replies; 10+ messages in thread From: Niklas Haas @ 2023-10-26 12:18 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Niklas Haas From: Niklas Haas <git@haasn.dev> There are already several places in the codebase that match desc->name against "xyz", and many downstream clients replicate this behavior. I have no idea why this is not just a flag. Motivated by my desire to add yet another check for XYZ to the codebase, and I'd rather not keep copy/pasting a string comparison hack. --- doc/APIchanges | 3 +++ libavutil/pixdesc.c | 6 +++--- libavutil/pixdesc.h | 5 +++++ libavutil/version.h | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 9b109e6fa7..c0d6ee0b29 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09 API changes, most recent first: +2023-10-26 - xxxxxxxxxx - lavu 58.28.100 - pixdesc.h + Add AV_PIX_FMT_FLAG_XYZ. + 2023-10-06 - xxxxxxxxxx - lavc 60.30.101 - avcodec.h AVCodecContext.coded_side_data may now be used during decoding, to be set by user before calling avcodec_open2() for initialization. diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index 6ded9467b0..f2647d3d55 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -1977,8 +1977,8 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { { 0, 6, 0, 4, 12 }, /* X */ { 0, 6, 2, 4, 12 }, /* Y */ { 0, 6, 4, 4, 12 }, /* Z */ - }, - /*.flags = -- not used*/ + }, + .flags = AV_PIX_FMT_FLAG_XYZ, }, [AV_PIX_FMT_XYZ12BE] = { .name = "xyz12be", @@ -1990,7 +1990,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { { 0, 6, 2, 4, 12 }, /* Y */ { 0, 6, 4, 4, 12 }, /* Z */ }, - .flags = AV_PIX_FMT_FLAG_BE, + .flags = AV_PIX_FMT_FLAG_XYZ | AV_PIX_FMT_FLAG_BE, }, #define BAYER8_DESC_COMMON \ diff --git a/libavutil/pixdesc.h b/libavutil/pixdesc.h index 0df73e6efe..ba2f632814 100644 --- a/libavutil/pixdesc.h +++ b/libavutil/pixdesc.h @@ -157,6 +157,11 @@ typedef struct AVPixFmtDescriptor { */ #define AV_PIX_FMT_FLAG_FLOAT (1 << 9) +/** + * The pixel format contains XYZ-like data (as opposed to YUV/RGB/grayscale). + */ +#define AV_PIX_FMT_FLAG_XYZ (1 << 10) + /** * Return the number of bits per pixel used by the pixel format * described by pixdesc. Note that this is not the same as the number diff --git a/libavutil/version.h b/libavutil/version.h index 4c0c545d40..279e54c394 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 58 -#define LIBAVUTIL_VERSION_MINOR 27 +#define LIBAVUTIL_VERSION_MINOR 28 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ -- 2.42.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 10+ messages in thread
* [FFmpeg-devel] [PATCH 3/5] avfilter/drawutils: simplify xyz format check 2023-10-26 12:18 [FFmpeg-devel] [PATCH 1/5] avfilter/drawutils: ban XYZ formats Niklas Haas 2023-10-26 12:18 ` [FFmpeg-devel] [PATCH 2/5] avutil/pixdesc: add AV_PIX_FMT_FLAG_XYZ Niklas Haas @ 2023-10-26 12:18 ` Niklas Haas 2023-10-26 12:23 ` Nicolas George 2023-10-26 12:19 ` [FFmpeg-devel] [PATCH 4/5] avutil/pixdesc: simplify xyz pixfmt check Niklas Haas 2023-10-26 12:19 ` [FFmpeg-devel] [PATCH 5/5] avformat/vf_vapoursynth: simplify xyz format check Niklas Haas 3 siblings, 1 reply; 10+ messages in thread From: Niklas Haas @ 2023-10-26 12:18 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Niklas Haas From: Niklas Haas <git@haasn.dev> --- libavfilter/drawutils.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/libavfilter/drawutils.c b/libavfilter/drawutils.c index c31ab6bd5a..1081938d86 100644 --- a/libavfilter/drawutils.c +++ b/libavfilter/drawutils.c @@ -22,7 +22,6 @@ #include <string.h> #include "libavutil/avassert.h" -#include "libavutil/avstring.h" #include "libavutil/avutil.h" #include "libavutil/csp.h" #include "libavutil/intreadwrite.h" @@ -94,8 +93,6 @@ int ff_draw_init2(FFDrawContext *draw, enum AVPixelFormat format, enum AVColorSp return AVERROR(ENOSYS); if (desc->flags & ~(AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA)) return AVERROR(ENOSYS); - if (av_strstart(desc->name, "xyz", NULL)) - return AVERROR(ENOSYS); if (csp == AVCOL_SPC_UNSPECIFIED) csp = (desc->flags & AV_PIX_FMT_FLAG_RGB) ? AVCOL_SPC_RGB : AVCOL_SPC_SMPTE170M; if (!(desc->flags & AV_PIX_FMT_FLAG_RGB) && !(luma = av_csp_luma_coeffs_from_avcsp(csp))) -- 2.42.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [FFmpeg-devel] [PATCH 3/5] avfilter/drawutils: simplify xyz format check 2023-10-26 12:18 ` [FFmpeg-devel] [PATCH 3/5] avfilter/drawutils: simplify xyz format check Niklas Haas @ 2023-10-26 12:23 ` Nicolas George 2023-10-26 13:13 ` James Almer 0 siblings, 1 reply; 10+ messages in thread From: Nicolas George @ 2023-10-26 12:23 UTC (permalink / raw) To: FFmpeg development discussions and patches; +Cc: Niklas Haas Niklas Haas (12023-10-26): > From: Niklas Haas <git@haasn.dev> > > --- > libavfilter/drawutils.c | 3 --- > 1 file changed, 3 deletions(-) Please merge this with patch 1. Regards, -- Nicolas George _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [FFmpeg-devel] [PATCH 3/5] avfilter/drawutils: simplify xyz format check 2023-10-26 12:23 ` Nicolas George @ 2023-10-26 13:13 ` James Almer 2023-10-26 13:30 ` Nicolas George 2023-10-26 14:05 ` Niklas Haas 0 siblings, 2 replies; 10+ messages in thread From: James Almer @ 2023-10-26 13:13 UTC (permalink / raw) To: ffmpeg-devel On 10/26/2023 9:23 AM, Nicolas George wrote: > Niklas Haas (12023-10-26): >> From: Niklas Haas <git@haasn.dev> >> >> --- >> libavfilter/drawutils.c | 3 --- >> 1 file changed, 3 deletions(-) > > Please merge this with patch 1. This patch reverts patch 1, so merging is basically just dropping both. I assume the reason he did things this way is to prevent patch 2 (an avutil patch adding new API) from changing the output filter-pixfmts-pad. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [FFmpeg-devel] [PATCH 3/5] avfilter/drawutils: simplify xyz format check 2023-10-26 13:13 ` James Almer @ 2023-10-26 13:30 ` Nicolas George 2023-10-26 14:05 ` Niklas Haas 1 sibling, 0 replies; 10+ messages in thread From: Nicolas George @ 2023-10-26 13:30 UTC (permalink / raw) To: FFmpeg development discussions and patches James Almer (12023-10-26): > This patch reverts patch 1, so merging is basically just dropping both. > I assume the reason he did things this way is to prevent patch 2 (an avutil > patch adding new API) from changing the output filter-pixfmts-pad. Oh, I read the commit message while your read the actual patch. Niklas: patch 3 is incorrect, please fix it and drop patch 1. Regards, -- Nicolas George _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [FFmpeg-devel] [PATCH 3/5] avfilter/drawutils: simplify xyz format check 2023-10-26 13:13 ` James Almer 2023-10-26 13:30 ` Nicolas George @ 2023-10-26 14:05 ` Niklas Haas 2023-10-26 14:13 ` epirat07 1 sibling, 1 reply; 10+ messages in thread From: Niklas Haas @ 2023-10-26 14:05 UTC (permalink / raw) To: ffmpeg-devel On Thu, 26 Oct 2023 10:13:03 -0300 James Almer <jamrial@gmail.com> wrote: > On 10/26/2023 9:23 AM, Nicolas George wrote: > > Niklas Haas (12023-10-26): > >> From: Niklas Haas <git@haasn.dev> > >> > >> --- > >> libavfilter/drawutils.c | 3 --- > >> 1 file changed, 3 deletions(-) > > > > Please merge this with patch 1. > > This patch reverts patch 1, so merging is basically just dropping both. > I assume the reason he did things this way is to prevent patch 2 (an > avutil patch adding new API) from changing the output filter-pixfmts-pad. Yes, exactly. But if you want, I can merge the FATE ref change into patch 2. I just thought this way separates the logic change (bugfix in drawutils) from the new API addition, which is IMO cleaner. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [FFmpeg-devel] [PATCH 3/5] avfilter/drawutils: simplify xyz format check 2023-10-26 14:05 ` Niklas Haas @ 2023-10-26 14:13 ` epirat07 0 siblings, 0 replies; 10+ messages in thread From: epirat07 @ 2023-10-26 14:13 UTC (permalink / raw) To: FFmpeg development discussions and patches On 26 Oct 2023, at 16:05, Niklas Haas wrote: > On Thu, 26 Oct 2023 10:13:03 -0300 James Almer <jamrial@gmail.com> wrote: >> On 10/26/2023 9:23 AM, Nicolas George wrote: >>> Niklas Haas (12023-10-26): >>>> From: Niklas Haas <git@haasn.dev> >>>> >>>> --- >>>> libavfilter/drawutils.c | 3 --- >>>> 1 file changed, 3 deletions(-) >>> >>> Please merge this with patch 1. >> >> This patch reverts patch 1, so merging is basically just dropping both. >> I assume the reason he did things this way is to prevent patch 2 (an >> avutil patch adding new API) from changing the output filter-pixfmts-pad. > > Yes, exactly. But if you want, I can merge the FATE ref change into > patch 2. I just thought this way separates the logic change (bugfix in > drawutils) from the new API addition, which is IMO cleaner. IMO it’s easier to understand with the patches separated. Maybe clarify the commit message a bit though about this being replaced by the new flag in a follow-up commit? Also I am confused about this patch (simplify xyz format check), as the message says „simplify“ but you just remove it? Is it covered already by an existing check in this file not touched by the patch? Then the message should probably be „remove redundant check“ and clarify why it is redundant now? > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 10+ messages in thread
* [FFmpeg-devel] [PATCH 4/5] avutil/pixdesc: simplify xyz pixfmt check 2023-10-26 12:18 [FFmpeg-devel] [PATCH 1/5] avfilter/drawutils: ban XYZ formats Niklas Haas 2023-10-26 12:18 ` [FFmpeg-devel] [PATCH 2/5] avutil/pixdesc: add AV_PIX_FMT_FLAG_XYZ Niklas Haas 2023-10-26 12:18 ` [FFmpeg-devel] [PATCH 3/5] avfilter/drawutils: simplify xyz format check Niklas Haas @ 2023-10-26 12:19 ` Niklas Haas 2023-10-26 12:19 ` [FFmpeg-devel] [PATCH 5/5] avformat/vf_vapoursynth: simplify xyz format check Niklas Haas 3 siblings, 0 replies; 10+ messages in thread From: Niklas Haas @ 2023-10-26 12:19 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Niklas Haas From: Niklas Haas <git@haasn.dev> --- libavutil/pixdesc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index f2647d3d55..4e4a63e287 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -3055,13 +3055,13 @@ static int get_color_type(const AVPixFmtDescriptor *desc) { if (desc->name) { if (av_strstart(desc->name, "yuvj", NULL)) return FF_COLOR_YUV_JPEG; - - if (av_strstart(desc->name, "xyz", NULL)) - return FF_COLOR_XYZ; } if(desc->flags & AV_PIX_FMT_FLAG_RGB) - return FF_COLOR_RGB; + return FF_COLOR_RGB; + + if(desc->flags & AV_PIX_FMT_FLAG_XYZ) + return FF_COLOR_XYZ; if(desc->nb_components == 0) return FF_COLOR_NA; -- 2.42.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 10+ messages in thread
* [FFmpeg-devel] [PATCH 5/5] avformat/vf_vapoursynth: simplify xyz format check 2023-10-26 12:18 [FFmpeg-devel] [PATCH 1/5] avfilter/drawutils: ban XYZ formats Niklas Haas ` (2 preceding siblings ...) 2023-10-26 12:19 ` [FFmpeg-devel] [PATCH 4/5] avutil/pixdesc: simplify xyz pixfmt check Niklas Haas @ 2023-10-26 12:19 ` Niklas Haas 3 siblings, 0 replies; 10+ messages in thread From: Niklas Haas @ 2023-10-26 12:19 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Niklas Haas From: Niklas Haas <git@haasn.dev> --- libavformat/vapoursynth.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libavformat/vapoursynth.c b/libavformat/vapoursynth.c index 965d36dc2e..b79ecfcf1b 100644 --- a/libavformat/vapoursynth.c +++ b/libavformat/vapoursynth.c @@ -118,7 +118,8 @@ static av_cold enum AVPixelFormat match_pixfmt(const VSFormat *vsf, int c_order[ pixfmt = av_pix_fmt_desc_get_id(pd); if (pd->flags & (AV_PIX_FMT_FLAG_BAYER | AV_PIX_FMT_FLAG_ALPHA | - AV_PIX_FMT_FLAG_HWACCEL | AV_PIX_FMT_FLAG_BITSTREAM)) + AV_PIX_FMT_FLAG_HWACCEL | AV_PIX_FMT_FLAG_BITSTREAM | + AV_PIX_FMT_FLAG_XYZ)) continue; if (pd->log2_chroma_w != vsf->subSamplingW || @@ -141,9 +142,6 @@ static av_cold enum AVPixelFormat match_pixfmt(const VSFormat *vsf, int c_order[ if (av_pix_fmt_count_planes(pixfmt) != vsf->numPlanes) continue; - if (strncmp(pd->name, "xyz", 3) == 0) - continue; - if (!is_native_endian(pixfmt)) continue; -- 2.42.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2023-10-26 14:13 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-10-26 12:18 [FFmpeg-devel] [PATCH 1/5] avfilter/drawutils: ban XYZ formats Niklas Haas 2023-10-26 12:18 ` [FFmpeg-devel] [PATCH 2/5] avutil/pixdesc: add AV_PIX_FMT_FLAG_XYZ Niklas Haas 2023-10-26 12:18 ` [FFmpeg-devel] [PATCH 3/5] avfilter/drawutils: simplify xyz format check Niklas Haas 2023-10-26 12:23 ` Nicolas George 2023-10-26 13:13 ` James Almer 2023-10-26 13:30 ` Nicolas George 2023-10-26 14:05 ` Niklas Haas 2023-10-26 14:13 ` epirat07 2023-10-26 12:19 ` [FFmpeg-devel] [PATCH 4/5] avutil/pixdesc: simplify xyz pixfmt check Niklas Haas 2023-10-26 12:19 ` [FFmpeg-devel] [PATCH 5/5] avformat/vf_vapoursynth: simplify xyz format check Niklas Haas
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git