[FFmpeg-devel] [PATCH v2] swscale: add unscaled conversion from yuv420p to p010
timo at rothenpieler.org
Sun Sep 4 18:42:21 EEST 2016
On 9/4/2016 4:06 PM, Carl Eugen Hoyos wrote:
> 2016-09-04 16:02 GMT+02:00 Timo Rothenpieler <timo at rothenpieler.org>:
>> The purpose of this patch is to make conversion from
>> yuv420p (8 bit) to p010 (10 bit) fast.
> Do I understand you correctly that your patch is
> faster without the change I suggested?
With the &:
[bench @ 0x600045b80] t:0.011178 avg:0.011172 max:0.018297 min:0.010505
[bench @ 0x600045b80] t:0.008455 avg:0.008517 max:0.015815 min:0.007941
So it is quite a bit faster.
Tested with nvenc hevc10 encoding, and the output is visually identical,
and the file size is also exactly the same.
So it seems to cleanly ignore the unused bits.
Also, given that at least microsoft argues with upcasting to 16 bit, the
approach without zeroing the lsb would be more accurate, as
t << 8 | t
is how one would convert 8 bit to 16 bit.
So I'd say going with the faster approach here should be fine.
If at some point someone runs into something that chokes on the bits
being non-zero, which I think is highly unlikely, it can be changed back.
More information about the ffmpeg-devel