[FFmpeg-devel] [PATCH] Support > 8 bit input in yuv2rgb.
Michael Niedermayer
michaelni at gmx.at
Sat Nov 9 12:37:48 CET 2013
On Fri, Nov 08, 2013 at 10:47:20PM +0100, Reimar Döffinger wrote:
> Significantly faster than the default path (which defaults to
> bicubic scaling even if no real scaling happens), though
> the templating is kind of ugly and increases code size a bit.
>
> Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
> ---
> libswscale/swscale_unscaled.c | 3 +
> libswscale/yuv2rgb.c | 550 ++++++------------------------------------
> libswscale/yuv2rgb_template.c | 458 +++++++++++++++++++++++++++++++++++
> 3 files changed, 537 insertions(+), 474 deletions(-)
> create mode 100644 libswscale/yuv2rgb_template.c
>
> diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
> index 83086f7..8842f35 100644
> --- a/libswscale/swscale_unscaled.c
> +++ b/libswscale/swscale_unscaled.c
> @@ -1217,6 +1217,9 @@ void ff_get_unscaled_swscale(SwsContext *c)
> }
> /* yuv2bgr */
> if ((srcFormat == AV_PIX_FMT_YUV420P || srcFormat == AV_PIX_FMT_YUV422P ||
> + srcFormat == AV_PIX_FMT_YUV420P9 || srcFormat == AV_PIX_FMT_YUV422P9 ||
> + srcFormat == AV_PIX_FMT_YUV420P10 || srcFormat == AV_PIX_FMT_YUV422P10 ||
> + srcFormat == AV_PIX_FMT_YUV420P16 || srcFormat == AV_PIX_FMT_YUV422P16 ||
> srcFormat == AV_PIX_FMT_YUVA420P) && isAnyRGB(dstFormat) &&
> !(flags & SWS_ACCURATE_RND) && (c->dither == SWS_DITHER_BAYER || c->dither == SWS_DITHER_AUTO) && !(dstH & 1)) {
> c->swscale = ff_yuv2rgb_get_func_ptr(c);
> diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c
> index 77c56a9..28de37e 100644
> --- a/libswscale/yuv2rgb.c
> +++ b/libswscale/yuv2rgb.c
> @@ -54,72 +54,72 @@ const int *sws_getCoefficients(int colorspace)
> }
>
> #define LOADCHROMA(i) \
> - U = pu[i]; \
> - V = pv[i]; \
> + U = pu[i] >> shift; \
> + V = pv[i] >> shift; \
> r = (void *)c->table_rV[V+YUVRGB_TABLE_HEADROOM]; \
> g = (void *)(c->table_gU[U+YUVRGB_TABLE_HEADROOM] + c->table_gV[V+YUVRGB_TABLE_HEADROOM]); \
> b = (void *)c->table_bU[U+YUVRGB_TABLE_HEADROOM];
are the shifts faster than bigger tables ?
(it would be slightly more accurate with bigger tables)
otherwise the patch looks fine and all cases i tested work fine as
well
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Old school: Use the lowest level language in which you can solve the problem
conveniently.
New school: Use the highest level language in which the latest supercomputer
can solve the problem without the user falling asleep waiting.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131109/42f5b86f/attachment.asc>
More information about the ffmpeg-devel
mailing list