diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2011-07-08 14:52:52 -0700 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2011-07-08 15:15:30 -0700 |
commit | 42d622fab31dbcae91fd4b0810e0ac07027e2df1 (patch) | |
tree | 2bac1655381987933c453be6ef90bc7be4aa564a | |
parent | bda168d2b0210dda84f1a9d32c8aa4653d1674d5 (diff) | |
download | ffmpeg-streaming-42d622fab31dbcae91fd4b0810e0ac07027e2df1.zip ffmpeg-streaming-42d622fab31dbcae91fd4b0810e0ac07027e2df1.tar.gz |
swscale: fix 16-bit scaling when output is 8-bits.
We would use the second half of the U plane buffer, rather than the
V plane buffer, to output the V plane pixels.
-rw-r--r-- | libswscale/utils.c | 2 | ||||
-rw-r--r-- | libswscale/x86/swscale_template.c | 24 | ||||
-rw-r--r-- | tests/ref/lavfi/pixdesc | 4 | ||||
-rw-r--r-- | tests/ref/lavfi/pixfmts_copy | 4 | ||||
-rw-r--r-- | tests/ref/lavfi/pixfmts_crop | 4 | ||||
-rw-r--r-- | tests/ref/lavfi/pixfmts_hflip | 4 | ||||
-rw-r--r-- | tests/ref/lavfi/pixfmts_null | 4 | ||||
-rw-r--r-- | tests/ref/lavfi/pixfmts_scale | 4 | ||||
-rw-r--r-- | tests/ref/lavfi/pixfmts_vflip | 4 |
9 files changed, 27 insertions, 27 deletions
diff --git a/libswscale/utils.c b/libswscale/utils.c index 9f0bb7a..fd10fa0 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -1053,7 +1053,7 @@ int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter) for (i=0; i<c->vChrBufSize; i++) { FF_ALLOC_OR_GOTO(c, c->chrUPixBuf[i+c->vChrBufSize], dst_stride*2+1, fail); c->chrUPixBuf[i] = c->chrUPixBuf[i+c->vChrBufSize]; - c->chrVPixBuf[i] = c->chrVPixBuf[i+c->vChrBufSize] = c->chrUPixBuf[i] + dst_stride_px; + c->chrVPixBuf[i] = c->chrVPixBuf[i+c->vChrBufSize] = c->chrUPixBuf[i] + (dst_stride >> 1); } if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) for (i=0; i<c->vLumBufSize; i++) { diff --git a/libswscale/x86/swscale_template.c b/libswscale/x86/swscale_template.c index f58ac52..26cd274 100644 --- a/libswscale/x86/swscale_template.c +++ b/libswscale/x86/swscale_template.c @@ -81,7 +81,7 @@ static void RENAME(yuv2yuvX)(SwsContext *c, const int16_t *lumFilter, *aDest = CONFIG_SWSCALE_ALPHA ? dest[3] : NULL; if (uDest) { - x86_reg uv_off = c->uv_off; + x86_reg uv_off = c->uv_offx2 >> 1; YSCALEYUV2YV12X(CHR_MMX_FILTER_OFFSET, uDest, chrDstW, 0) YSCALEYUV2YV12X(CHR_MMX_FILTER_OFFSET, vDest - uv_off, chrDstW + uv_off, uv_off) } @@ -164,7 +164,7 @@ static void RENAME(yuv2yuvX_ar)(SwsContext *c, const int16_t *lumFilter, *aDest = CONFIG_SWSCALE_ALPHA ? dest[3] : NULL; if (uDest) { - x86_reg uv_off = c->uv_off; + x86_reg uv_off = c->uv_offx2 >> 1; YSCALEYUV2YV12X_ACCURATE(CHR_MMX_FILTER_OFFSET, uDest, chrDstW, 0) YSCALEYUV2YV12X_ACCURATE(CHR_MMX_FILTER_OFFSET, vDest - uv_off, chrDstW + uv_off, uv_off) } @@ -473,7 +473,7 @@ static void RENAME(yuv2rgb32_X_ar)(SwsContext *c, const int16_t *lumFilter, { x86_reg dummy=0; x86_reg dstW_reg = dstW; - x86_reg uv_off = c->uv_off << 1; + x86_reg uv_off = c->uv_offx2; if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) { YSCALEYUV2PACKEDX_ACCURATE @@ -506,7 +506,7 @@ static void RENAME(yuv2rgb32_X)(SwsContext *c, const int16_t *lumFilter, { x86_reg dummy=0; x86_reg dstW_reg = dstW; - x86_reg uv_off = c->uv_off << 1; + x86_reg uv_off = c->uv_offx2; if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) { YSCALEYUV2PACKEDX @@ -563,7 +563,7 @@ static void RENAME(yuv2rgb565_X_ar)(SwsContext *c, const int16_t *lumFilter, { x86_reg dummy=0; x86_reg dstW_reg = dstW; - x86_reg uv_off = c->uv_off << 1; + x86_reg uv_off = c->uv_offx2; YSCALEYUV2PACKEDX_ACCURATE YSCALEYUV2RGBX @@ -587,7 +587,7 @@ static void RENAME(yuv2rgb565_X)(SwsContext *c, const int16_t *lumFilter, { x86_reg dummy=0; x86_reg dstW_reg = dstW; - x86_reg uv_off = c->uv_off << 1; + x86_reg uv_off = c->uv_offx2; YSCALEYUV2PACKEDX YSCALEYUV2RGBX @@ -640,7 +640,7 @@ static void RENAME(yuv2rgb555_X_ar)(SwsContext *c, const int16_t *lumFilter, { x86_reg dummy=0; x86_reg dstW_reg = dstW; - x86_reg uv_off = c->uv_off << 1; + x86_reg uv_off = c->uv_offx2; YSCALEYUV2PACKEDX_ACCURATE YSCALEYUV2RGBX @@ -664,7 +664,7 @@ static void RENAME(yuv2rgb555_X)(SwsContext *c, const int16_t *lumFilter, { x86_reg dummy=0; x86_reg dstW_reg = dstW; - x86_reg uv_off = c->uv_off << 1; + x86_reg uv_off = c->uv_offx2; YSCALEYUV2PACKEDX YSCALEYUV2RGBX @@ -797,7 +797,7 @@ static void RENAME(yuv2bgr24_X_ar)(SwsContext *c, const int16_t *lumFilter, { x86_reg dummy=0; x86_reg dstW_reg = dstW; - x86_reg uv_off = c->uv_off << 1; + x86_reg uv_off = c->uv_offx2; YSCALEYUV2PACKEDX_ACCURATE YSCALEYUV2RGBX @@ -821,7 +821,7 @@ static void RENAME(yuv2bgr24_X)(SwsContext *c, const int16_t *lumFilter, { x86_reg dummy=0; x86_reg dstW_reg = dstW; - x86_reg uv_off = c->uv_off << 1; + x86_reg uv_off = c->uv_offx2; YSCALEYUV2PACKEDX YSCALEYUV2RGBX @@ -862,7 +862,7 @@ static void RENAME(yuv2yuyv422_X_ar)(SwsContext *c, const int16_t *lumFilter, { x86_reg dummy=0; x86_reg dstW_reg = dstW; - x86_reg uv_off = c->uv_off << 1; + x86_reg uv_off = c->uv_offx2; YSCALEYUV2PACKEDX_ACCURATE /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ @@ -883,7 +883,7 @@ static void RENAME(yuv2yuyv422_X)(SwsContext *c, const int16_t *lumFilter, { x86_reg dummy=0; x86_reg dstW_reg = dstW; - x86_reg uv_off = c->uv_off << 1; + x86_reg uv_off = c->uv_offx2; YSCALEYUV2PACKEDX /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ diff --git a/tests/ref/lavfi/pixdesc b/tests/ref/lavfi/pixdesc index 8695b1d..ee28c4b 100644 --- a/tests/ref/lavfi/pixdesc +++ b/tests/ref/lavfi/pixdesc @@ -42,8 +42,8 @@ yuv422p16be 86ad3447f97969ce095afeef81fa9abf yuv422p16le a53a9b451f4a81eeae33362c1bbd07f8 yuv440p 5a064afe2b453bb52cdb3f176b1aa1cf yuv444p 0a98447b78fd476aa39686da6a74fa2e -yuv444p16be 95db370ae765dd3d10b7def14704ae73 -yuv444p16le 36b969179b5ad9d312a0d1e1cd6bc402 +yuv444p16be 12554ba5f143126dc5e886b9a8be37e9 +yuv444p16le 35872903aefd0f545255a4452ccc262e yuva420p a29884f3f3dfe1e00b961bc17bef3d47 yuvj420p 32eec78ba51857b16ce9b813a49b7189 yuvj422p 0dfa0ed434f73be51428758c69e082cb diff --git a/tests/ref/lavfi/pixfmts_copy b/tests/ref/lavfi/pixfmts_copy index 8695b1d..ee28c4b 100644 --- a/tests/ref/lavfi/pixfmts_copy +++ b/tests/ref/lavfi/pixfmts_copy @@ -42,8 +42,8 @@ yuv422p16be 86ad3447f97969ce095afeef81fa9abf yuv422p16le a53a9b451f4a81eeae33362c1bbd07f8 yuv440p 5a064afe2b453bb52cdb3f176b1aa1cf yuv444p 0a98447b78fd476aa39686da6a74fa2e -yuv444p16be 95db370ae765dd3d10b7def14704ae73 -yuv444p16le 36b969179b5ad9d312a0d1e1cd6bc402 +yuv444p16be 12554ba5f143126dc5e886b9a8be37e9 +yuv444p16le 35872903aefd0f545255a4452ccc262e yuva420p a29884f3f3dfe1e00b961bc17bef3d47 yuvj420p 32eec78ba51857b16ce9b813a49b7189 yuvj422p 0dfa0ed434f73be51428758c69e082cb diff --git a/tests/ref/lavfi/pixfmts_crop b/tests/ref/lavfi/pixfmts_crop index c7b5952..fb5c838 100644 --- a/tests/ref/lavfi/pixfmts_crop +++ b/tests/ref/lavfi/pixfmts_crop @@ -33,8 +33,8 @@ yuv422p16be 6647fe1c381c148f8207c988c0e22bf0 yuv422p16le e1548c9dc51202db38a9625c8954203f yuv440p 2472417d980e395ad6843cbb8b633b29 yuv444p 1f151980486848c96bc5585ced99003e -yuv444p16be ac3b159f8c858fcdf475a8c024ee79b6 -yuv444p16le 9a6863bfc5faee206065c11dc994bf0c +yuv444p16be 02d78b564a23df2f68cf6895d3bfe6bf +yuv444p16le cbea9591b954ea31d6a0cb25a9aed599 yuva420p 7536753dfbc7932560fb50c921369a0e yuvj420p 21f891093006d42d7683b0e1d773a657 yuvj422p 9a43d474c407590ad8f213880586b45e diff --git a/tests/ref/lavfi/pixfmts_hflip b/tests/ref/lavfi/pixfmts_hflip index 7f4342f..7710252 100644 --- a/tests/ref/lavfi/pixfmts_hflip +++ b/tests/ref/lavfi/pixfmts_hflip @@ -33,8 +33,8 @@ yuv422p16be 9dbe0af0eb877987611cf04bfa577202 yuv422p16le 2d8f37231110177cc5e1b61c8cb4b163 yuv440p a99e2b57ed601f39852715c9d675d0d3 yuv444p 947e47f7bb5fdccc659d19b7df2b6fc3 -yuv444p16be debc96a7ec4fec0a412f9d8995bc48a2 -yuv444p16le 5b5e1348a631fc2206bb7ff851a52687 +yuv444p16be cdc7bfb08b8286d05d6a639d1bfc0d26 +yuv444p16le 969caecaaca795477874420540d21e8b yuva420p d83ec0c01498189f179ec574918185f1 yuvj420p df3aaaec3bb157c3bde5f0365af30f4f yuvj422p d113871528d510a192797af59df9c05c diff --git a/tests/ref/lavfi/pixfmts_null b/tests/ref/lavfi/pixfmts_null index 8695b1d..ee28c4b 100644 --- a/tests/ref/lavfi/pixfmts_null +++ b/tests/ref/lavfi/pixfmts_null @@ -42,8 +42,8 @@ yuv422p16be 86ad3447f97969ce095afeef81fa9abf yuv422p16le a53a9b451f4a81eeae33362c1bbd07f8 yuv440p 5a064afe2b453bb52cdb3f176b1aa1cf yuv444p 0a98447b78fd476aa39686da6a74fa2e -yuv444p16be 95db370ae765dd3d10b7def14704ae73 -yuv444p16le 36b969179b5ad9d312a0d1e1cd6bc402 +yuv444p16be 12554ba5f143126dc5e886b9a8be37e9 +yuv444p16le 35872903aefd0f545255a4452ccc262e yuva420p a29884f3f3dfe1e00b961bc17bef3d47 yuvj420p 32eec78ba51857b16ce9b813a49b7189 yuvj422p 0dfa0ed434f73be51428758c69e082cb diff --git a/tests/ref/lavfi/pixfmts_scale b/tests/ref/lavfi/pixfmts_scale index 8901fe9..0cb27ef 100644 --- a/tests/ref/lavfi/pixfmts_scale +++ b/tests/ref/lavfi/pixfmts_scale @@ -42,8 +42,8 @@ yuv422p16be 837945d3a771366a5a72a4ed095a4f53 yuv422p16le b8292ae9b52eb7afc3d8b93e8fd895b4 yuv440p 461503fdb9b90451020aa3b25ddf041c yuv444p 81b2eba962d12e8d64f003ac56f6faf2 -yuv444p16be cc7460f76477aa4b4c33442f67c06a89 -yuv444p16le 9a5ed60d68c0a4a5155f9d376174cdf7 +yuv444p16be fe2c4a3708c4f44a2d91f3c413f33caf +yuv444p16le 1b4fce808e546cd75ef01cdb91da26b5 yuva420p 8673a9131fb47de69788863f93a50eb7 yuvj420p 30427bd6caf5bda93a173dbebe759e09 yuvj422p fc8288f64fd149573f73cf8da05d8e6d diff --git a/tests/ref/lavfi/pixfmts_vflip b/tests/ref/lavfi/pixfmts_vflip index 89502d1..acead3d 100644 --- a/tests/ref/lavfi/pixfmts_vflip +++ b/tests/ref/lavfi/pixfmts_vflip @@ -42,8 +42,8 @@ yuv422p16be 8cdfbddf2dd4c44c3efef4ee00170eba yuv422p16le a2f421f6a1af950544081c1797de01ae yuv440p 876385e96165acf51271b20e5d85a416 yuv444p 9c3c667d1613b72d15bc6d851c5eb8f7 -yuv444p16be b092690d22f0b26360fbf5cfd739be17 -yuv444p16le 18768b4ddca92d06f9713fef467276a9 +yuv444p16be c73d2f57f90060d4126241aba04876d3 +yuv444p16le c9ab60ec1ae3ff50da524e83e3553add yuva420p c705d1cf061d8c6580ac690b55f92276 yuvj420p 41fd02b204da0ab62452cd14b595e2e4 yuvj422p 7f6ca9bc1812cde02036d7d29a7cce43 |