diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-01-28 14:06:22 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-01-28 14:11:31 +0100 |
commit | bb2f4ae434223e99f131100f4bc71762b79eb6c5 (patch) | |
tree | c852670be02a3ec5972b389a238eabcf59f04095 /libswscale | |
parent | 51e9d2dbc8f8e7aed216222a496cc7e588afa217 (diff) | |
parent | 05b0998f511ffa699407465d48c7d5805f746ad2 (diff) | |
download | ffmpeg-bb2f4ae434223e99f131100f4bc71762b79eb6c5.tar.gz |
Merge commit '05b0998f511ffa699407465d48c7d5805f746ad2'
* commit '05b0998f511ffa699407465d48c7d5805f746ad2':
dsputil: Fix error by not using redzone and register name
swscale: GBRP output support
Conflicts:
libswscale/output.c
libswscale/swscale.c
libswscale/swscale_internal.h
libswscale/utils.c
tests/ref/lavfi/pixdesc
tests/ref/lavfi/pixfmts_copy
tests/ref/lavfi/pixfmts_null
tests/ref/lavfi/pixfmts_scale
tests/ref/lavfi/pixfmts_vflip
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale')
-rw-r--r-- | libswscale/output.c | 36 | ||||
-rw-r--r-- | libswscale/swscale_internal.h | 12 | ||||
-rw-r--r-- | libswscale/utils.c | 4 |
3 files changed, 29 insertions, 23 deletions
diff --git a/libswscale/output.c b/libswscale/output.c index e49cb73f15..d1a3bee59e 100644 --- a/libswscale/output.c +++ b/libswscale/output.c @@ -1374,11 +1374,11 @@ YUV2RGBWRAPPERX(yuv2, rgb_full, rgb8_full, AV_PIX_FMT_RGB8, 0) static void yuv2gbrp_full_X_c(SwsContext *c, const int16_t *lumFilter, - const int16_t **lumSrc, int lumFilterSize, - const int16_t *chrFilter, const int16_t **chrUSrc, - const int16_t **chrVSrc, int chrFilterSize, - const int16_t **alpSrc, uint8_t **dest, - int dstW, int y) + const int16_t **lumSrc, int lumFilterSize, + const int16_t *chrFilter, const int16_t **chrUSrc, + const int16_t **chrVSrc, int chrFilterSize, + const int16_t **alpSrc, uint8_t **dest, + int dstW, int y) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->dstFormat); int i; @@ -1388,36 +1388,42 @@ yuv2gbrp_full_X_c(SwsContext *c, const int16_t *lumFilter, for (i = 0; i < dstW; i++) { int j; - int Y = 1<<9; - int U = (1<<9)-(128 << 19); - int V = (1<<9)-(128 << 19); + int Y = 1 << 9; + int U = (1 << 9) - (128 << 19); + int V = (1 << 9) - (128 << 19); int R, G, B, A; - for (j = 0; j < lumFilterSize; j++) { + for (j = 0; j < lumFilterSize; j++) Y += lumSrc[j][i] * lumFilter[j]; - } + for (j = 0; j < chrFilterSize; j++) { U += chrUSrc[j][i] * chrFilter[j]; V += chrVSrc[j][i] * chrFilter[j]; } + Y >>= 10; U >>= 10; V >>= 10; + if (hasAlpha) { A = 1 << 18; - for (j = 0; j < lumFilterSize; j++) { + + for (j = 0; j < lumFilterSize; j++) A += alpSrc[j][i] * lumFilter[j]; - } + A >>= 19; + if (A & 0x100) A = av_clip_uint8(A); } + Y -= c->yuv2rgb_y_offset; Y *= c->yuv2rgb_y_coeff; Y += 1 << 21; - R = Y + V*c->yuv2rgb_v2r_coeff; - G = Y + V*c->yuv2rgb_v2g_coeff + U*c->yuv2rgb_u2g_coeff; - B = Y + U*c->yuv2rgb_u2b_coeff; + R = Y + V * c->yuv2rgb_v2r_coeff; + G = Y + V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff; + B = Y + U * c->yuv2rgb_u2b_coeff; + if ((R | G | B) & 0xC0000000) { R = av_clip_uintp2(R, 30); G = av_clip_uintp2(G, 30); diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 0a320c2da4..83d3a0049c 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -250,12 +250,12 @@ typedef void (*yuv2packedX_fn)(struct SwsContext *c, const int16_t *lumFilter, * or some output formats. */ typedef void (*yuv2anyX_fn)(struct SwsContext *c, const int16_t *lumFilter, - const int16_t **lumSrc, int lumFilterSize, - const int16_t *chrFilter, - const int16_t **chrUSrc, - const int16_t **chrVSrc, int chrFilterSize, - const int16_t **alpSrc, uint8_t **dest, - int dstW, int y); + const int16_t **lumSrc, int lumFilterSize, + const int16_t *chrFilter, + const int16_t **chrUSrc, + const int16_t **chrVSrc, int chrFilterSize, + const int16_t **alpSrc, uint8_t **dest, + int dstW, int y); /* This struct should be aligned on at least a 32-byte boundary. */ typedef struct SwsContext { diff --git a/libswscale/utils.c b/libswscale/utils.c index c10bd7ce73..9e73adce38 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -1022,8 +1022,8 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, if (isPlanarRGB(dstFormat)) { if (!(flags & SWS_FULL_CHR_H_INT)) { av_log(c, AV_LOG_DEBUG, - "%s output is not supported with half chroma resolution, switching to full\n", - av_get_pix_fmt_name(dstFormat)); + "%s output is not supported with half chroma resolution, switching to full\n", + av_get_pix_fmt_name(dstFormat)); flags |= SWS_FULL_CHR_H_INT; c->flags = flags; } |