[FFmpeg-devel] [RFC] swscale RGB24->YUV420P

Michael Niedermayer michael at niedermayer.cc
Wed Aug 16 20:37:02 EEST 2023


On Wed, Aug 16, 2023 at 05:15:23PM +0100, John Cox wrote:
> Hi
> 
> The Pi has a use for a fast RGB24->YUV420P path for encoding camera
> video. There is an existing BGR24 converter but if I build a RGB24
> converter using the same logic (rearrange the conversion matrix and use
> the same code) I get a fate fail on filter-fps-cfr (and possibly others)
> which appears to decode a file to RGB24, convert to YUV420P and take the
> CRC of that so almost any change to the conversion breaks this
> (unrelated?) test.
> 
> My initial assumption was that if the code to conversion in
> libswscale/rgb2rgb_template:bgr24toyv12_c was good enough for BGR24->YUV
> then it should be good enough for RGB24->YUV too. However it breaks this
> fate case - what is an acceptable way to resolve this?

update the checksum (if needed), and put the code under appropriate bitexact flags checks
(there may be remaining issues but hard to say without seeing and being
abel to test the code)


> 
> A further question assuming that the above can be resolved - I have also
> written aarch64 asm for this (RGB24/BGR24->YUV420P). It costs nothing in
> the asm to round the output values to nearest rather than just rounding
> down as the C template does and doing so improves the accuracy reported
> by tests/swscale - however at that point the asm and the C don't produce
> identical results. I assume that the x86 asm for BGR24 conversion does
> match the C. What is the best thing to do here?

The more differences there are between implementations the more annoying
it is but there is a bitexact flag that allows differences

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 1
"Used only once"    - "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."
-------------- 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/20230816/7e863098/attachment.sig>


More information about the ffmpeg-devel mailing list