[FFmpeg-devel] [PATCH 16/17] swscale/format: add new format decode/encode logic

Michael Niedermayer michael at niedermayer.cc
Fri May 2 17:10:57 EEST 2025


On Sat, Apr 26, 2025 at 07:41:20PM +0200, Niklas Haas wrote:
> From: Niklas Haas <git at haasn.dev>
> 
> This patch adds format handling code for the new operations. This entails
> fully decoding a format to standardized RGB, and the inverse.
> 
> Handling it this way means we can always guarantee that a conversion path
> exists from A to B without having to explicitly cover logic for each path;
> and choosing RGB instead of YUV as the intermediate (as was done in swscale
> v1) is more flexible with regards to enabling further operations such as
> primaries conversions, linear scaling, etc.
> 
> In the case of YUV->YUV transform, the redundant matrix multiplication will
> be canceled out anyways.
> ---
>  libswscale/format.c | 925 ++++++++++++++++++++++++++++++++++++++++++++
>  libswscale/format.h |  23 ++
>  2 files changed, 948 insertions(+)

this or rather the equivalent from your repo breaks here:

In file included from libswscale/ops.h:24,
                 from libswscale/ops_internal.h:26,
                 from libswscale/format.c:28:
libswscale/format.c: In function ‘trc_is_hdr’:
libswscale/format.c:1249:9: error: a label can only be part of a statement and a declaration is not a statement
 1249 |         static_assert(AVCOL_TRC_NB == 19, "Update this list when adding TRCs");
      |         ^~~~~~~~~~~~~
make: *** [ffbuild/common.mak:81: libswscale/format.o] Error 1
make: *** Waiting for unfinished jobs....


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Some people wanted to paint the bikeshed green, some blue and some pink.
People argued and fought, when they finally agreed, only rust was left.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20250502/4f72e939/attachment.sig>


More information about the ffmpeg-devel mailing list