History

swscale: implement >8bit scaling support.

This means that precision is retained when scaling between sample formats with >8 bits per component (48bit RGB, 16bit grayscale, 9/10/16bit YUV).

Ronald S. Bultje committed 15 years ago

Commit ef1ee361 parent f68069812 files · +545 −373Browse files

Unified · Split

12 files
  1. libswscale/ppc/swscale_altivec.c +3 −1
  2. libswscale/swscale.c +457 −237
  3. libswscale/swscale_internal.h +10 −0
  4. libswscale/utils.c +7 −2
  5. libswscale/x86/swscale_template.c +4 −69
  6. tests/ref/lavfi/pixdesc +8 −8
  7. tests/ref/lavfi/pixfmts_copy +8 −8
  8. tests/ref/lavfi/pixfmts_crop +8 −8
  9. tests/ref/lavfi/pixfmts_hflip +8 −8
  10. tests/ref/lavfi/pixfmts_null +8 −8
  11. tests/ref/lavfi/pixfmts_scale +16 −16
  12. tests/ref/lavfi/pixfmts_vflip +8 −8
libswscale/ppc/swscale_altivec.c+3−1
@@ -406,7 +406,9 @@ void ff_sws_init_swScale_altivec(SwsContext *c) · 405 unmodified lines
406 if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC))406 if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC))
407 return;407 return;
408 408
409 c->hScale = hScale_altivec_real;409 if (c->scalingBpp == 8) {
410 c->hScale = hScale_altivec_real;
411 }
410 if (!is16BPS(dstFormat) && !is9_OR_10BPS(dstFormat) &&412 if (!is16BPS(dstFormat) && !is9_OR_10BPS(dstFormat) &&
411 dstFormat != PIX_FMT_NV12 && dstFormat != PIX_FMT_NV21 &&413 dstFormat != PIX_FMT_NV12 && dstFormat != PIX_FMT_NV21 &&
412 !c->alpPixBuf) {414 !c->alpPixBuf) {
libswscale/swscale.c+457−237
@@ -195,18 +195,18 @@ DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[8][8]={ · 194 unmodified lines
195#endif195#endif
196 196
197static av_always_inline void197static av_always_inline void
198yuv2yuvX16_c_template(const int16_t *lumFilter, const int16_t **lumSrc,198yuv2yuvX16_c_template(const int16_t *lumFilter, const int32_t **lumSrc,
199 int lumFilterSize, const int16_t *chrFilter,199 int lumFilterSize, const int16_t *chrFilter,
200 const int16_t **chrUSrc, const int16_t **chrVSrc,200 const int32_t **chrUSrc, const int32_t **chrVSrc,
201 int chrFilterSize, const int16_t **alpSrc,201 int chrFilterSize, const int32_t **alpSrc,
202 uint16_t *dest[4], int dstW, int chrDstW,202 uint16_t *dest[4], int dstW, int chrDstW,
203 int big_endian, int output_bits)203 int big_endian, int output_bits)
204{204{
205 //FIXME Optimize (just quickly written not optimized..)205 //FIXME Optimize (just quickly written not optimized..)
206 int i;206 int i;
207 int shift = 11 + 16 - output_bits;
208 uint16_t *yDest = dest[0], *uDest = dest[1], *vDest = dest[2],207 uint16_t *yDest = dest[0], *uDest = dest[1], *vDest = dest[2],
209 *aDest = CONFIG_SWSCALE_ALPHA ? dest[3] : NULL;208 *aDest = CONFIG_SWSCALE_ALPHA ? dest[3] : NULL;
209 int shift = 15 + 16 - output_bits;
210 210
211#define output_pixel(pos, val) \211#define output_pixel(pos, val) \
212 if (big_endian) { \212 if (big_endian) { \
@@ -223,7 +223,7 @@ yuv2yuvX16_c_template(const int16_t *lumFilter, const int16_t **lumSrc, · 10 unmodified lines
223 } \223 } \
224 }224 }
225 for (i = 0; i < dstW; i++) {225 for (i = 0; i < dstW; i++) {
226 int val = 1 << (26-output_bits);226 int val = 1 << (30-output_bits);
227 int j;227 int j;
228 228
229 for (j = 0; j < lumFilterSize; j++)229 for (j = 0; j < lumFilterSize; j++)
@@ -234,8 +234,8 @@ yuv2yuvX16_c_template(const int16_t *lumFilter, const int16_t **lumSrc, · 4 unmodified lines
234 234
235 if (uDest) {235 if (uDest) {
236 for (i = 0; i < chrDstW; i++) {236 for (i = 0; i < chrDstW; i++) {
237 int u = 1 << (26-output_bits);237 int u = 1 << (30-output_bits);
238 int v = 1 << (26-output_bits);238 int v = 1 << (30-output_bits);
239 int j;239 int j;
240 240
241 for (j = 0; j < chrFilterSize; j++) {241 for (j = 0; j < chrFilterSize; j++) {
@@ -250,7 +250,7 @@ yuv2yuvX16_c_template(const int16_t *lumFilter, const int16_t **lumSrc, · 8 unmodified lines
250 250
251 if (CONFIG_SWSCALE_ALPHA && aDest) {251 if (CONFIG_SWSCALE_ALPHA && aDest) {
252 for (i = 0; i < dstW; i++) {252 for (i = 0; i < dstW; i++) {
253 int val = 1 << (26-output_bits);253 int val = 1 << (30-output_bits);
254 int j;254 int j;
255 255
256 for (j = 0; j < lumFilterSize; j++)256 for (j = 0; j < lumFilterSize; j++)
@@ -264,12 +264,16 @@ yuv2yuvX16_c_template(const int16_t *lumFilter, const int16_t **lumSrc, · 7 unmodified lines
264 264
265#define yuv2NBPS(bits, BE_LE, is_be) \265#define yuv2NBPS(bits, BE_LE, is_be) \
266static void yuv2yuvX ## bits ## BE_LE ## _c(SwsContext *c, const int16_t *lumFilter, \266static void yuv2yuvX ## bits ## BE_LE ## _c(SwsContext *c, const int16_t *lumFilter, \
267 const int16_t **lumSrc, int lumFilterSize, \267 const int16_t **_lumSrc, int lumFilterSize, \
268 const int16_t *chrFilter, const int16_t **chrUSrc, \268 const int16_t *chrFilter, const int16_t **_chrUSrc, \
269 const int16_t **chrVSrc, \269 const int16_t **_chrVSrc, \
270 int chrFilterSize, const int16_t **alpSrc, \270 int chrFilterSize, const int16_t **_alpSrc, \
271 uint8_t *_dest[4], int dstW, int chrDstW) \271 uint8_t *_dest[4], int dstW, int chrDstW) \
272{ \272{ \
273 const int32_t **lumSrc = (const int32_t **) _lumSrc, \
274 **chrUSrc = (const int32_t **) _chrUSrc, \
275 **chrVSrc = (const int32_t **) _chrVSrc, \
276 **alpSrc = (const int32_t **) _alpSrc; \
273 yuv2yuvX16_c_template(lumFilter, lumSrc, lumFilterSize, \277 yuv2yuvX16_c_template(lumFilter, lumSrc, lumFilterSize, \
274 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \278 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
275 alpSrc, (uint16_t **) _dest, \279 alpSrc, (uint16_t **) _dest, \
@@ -418,109 +422,121 @@ static void yuv2nv12X_c(SwsContext *c, const int16_t *lumFilter, · 142 unmodified lines
418 422
419static av_always_inline void423static av_always_inline void
420yuv2gray16_X_c_template(SwsContext *c, const int16_t *lumFilter,424yuv2gray16_X_c_template(SwsContext *c, const int16_t *lumFilter,
421 const int16_t **lumSrc, int lumFilterSize,425 const int32_t **lumSrc, int lumFilterSize,
422 const int16_t *chrFilter, const int16_t **chrUSrc,426 const int16_t *chrFilter, const int32_t **chrUSrc,
423 const int16_t **chrVSrc, int chrFilterSize,427 const int32_t **chrVSrc, int chrFilterSize,
424 const int16_t **alpSrc, uint8_t *dest, int dstW,428 const int32_t **alpSrc, uint16_t *dest, int dstW,
425 int y, enum PixelFormat target)429 int y, enum PixelFormat target)
426{430{
427 int i;431 int i;
428 432
429 for (i = 0; i < (dstW >> 1); i++) {433 for (i = 0; i < (dstW >> 1); i++) {
430 int j;434 int j;
431 int Y1 = 1 << 18;435 int Y1 = 1 << 14;
432 int Y2 = 1 << 18;436 int Y2 = 1 << 14;
433 const int i2 = 2 * i;
434 437
435 for (j = 0; j < lumFilterSize; j++) {438 for (j = 0; j < lumFilterSize; j++) {
436 Y1 += lumSrc[j][i2] * lumFilter[j];439 Y1 += lumSrc[j][i * 2] * lumFilter[j];
437 Y2 += lumSrc[j][i2+1] * lumFilter[j];440 Y2 += lumSrc[j][i * 2 + 1] * lumFilter[j];
438 }441 }
439 Y1 >>= 11;442 Y1 >>= 15;
440 Y2 >>= 11;443 Y2 >>= 15;
441 if ((Y1 | Y2) & 0x10000) {444 if ((Y1 | Y2) & 0x10000) {
442 Y1 = av_clip_uint16(Y1);445 Y1 = av_clip_uint16(Y1);
443 Y2 = av_clip_uint16(Y2);446 Y2 = av_clip_uint16(Y2);
444 }447 }
445 output_pixel(&dest[2 * i2 + 0], Y1);448 output_pixel(&dest[i * 2 + 0], Y1);
446 output_pixel(&dest[2 * i2 + 2], Y2);449 output_pixel(&dest[i * 2 + 1], Y2);
447 }450 }
448}451}
449 452
450static av_always_inline void453static av_always_inline void
451yuv2gray16_2_c_template(SwsContext *c, const int16_t *buf[2],454yuv2gray16_2_c_template(SwsContext *c, const int32_t *buf[2],
452 const int16_t *ubuf[2], const int16_t *vbuf[2],455 const int32_t *ubuf[2], const int32_t *vbuf[2],
453 const int16_t *abuf[2], uint8_t *dest, int dstW,456 const int32_t *abuf[2], uint16_t *dest, int dstW,
454 int yalpha, int uvalpha, int y,457 int yalpha, int uvalpha, int y,
455 enum PixelFormat target)458 enum PixelFormat target)
456{459{
457 int yalpha1 = 4095 - yalpha;460 int yalpha1 = 4095 - yalpha;
458 int i;461 int i;
459 const int16_t *buf0 = buf[0], *buf1 = buf[1];462 const int32_t *buf0 = buf[0], *buf1 = buf[1];
460 463
461 for (i = 0; i < (dstW >> 1); i++) {464 for (i = 0; i < (dstW >> 1); i++) {
462 const int i2 = 2 * i;465 int Y1 = (buf0[i * 2 ] * yalpha1 + buf1[i * 2 ] * yalpha) >> 15;
463 int Y1 = (buf0[i2 ] * yalpha1 + buf1[i2 ] * yalpha) >> 11;466 int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 15;
464 int Y2 = (buf0[i2+1] * yalpha1 + buf1[i2+1] * yalpha) >> 11;
465 467
466 output_pixel(&dest[2 * i2 + 0], Y1);468 output_pixel(&dest[i * 2 + 0], Y1);
467 output_pixel(&dest[2 * i2 + 2], Y2);469 output_pixel(&dest[i * 2 + 1], Y2);
468 }470 }
469}471}
470 472
471static av_always_inline void473static av_always_inline void
472yuv2gray16_1_c_template(SwsContext *c, const int16_t *buf0,474yuv2gray16_1_c_template(SwsContext *c, const int32_t *buf0,
473 const int16_t *ubuf[2], const int16_t *vbuf[2],475 const int32_t *ubuf[2], const int32_t *vbuf[2],
474 const int16_t *abuf0, uint8_t *dest, int dstW,476 const int32_t *abuf0, uint16_t *dest, int dstW,
475 int uvalpha, int y, enum PixelFormat target)477 int uvalpha, int y, enum PixelFormat target)
476{478{
477 int i;479 int i;
478 480
479 for (i = 0; i < (dstW >> 1); i++) {481 for (i = 0; i < (dstW >> 1); i++) {
480 const int i2 = 2 * i;482 int Y1 = buf0[i * 2 ] << 1;
481 int Y1 = buf0[i2 ] << 1;483 int Y2 = buf0[i * 2 + 1] << 1;
482 int Y2 = buf0[i2+1] << 1;
483 484
484 output_pixel(&dest[2 * i2 + 0], Y1);485 output_pixel(&dest[i * 2 + 0], Y1);
485 output_pixel(&dest[2 * i2 + 2], Y2);486 output_pixel(&dest[i * 2 + 1], Y2);
486 }487 }
487}488}
488 489
489#undef output_pixel490#undef output_pixel
490 491
491#define YUV2PACKEDWRAPPER(name, base, ext, fmt) \492#define YUV2PACKED16WRAPPER(name, base, ext, fmt) \
492static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \493static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \
493 const int16_t **lumSrc, int lumFilterSize, \494 const int16_t **_lumSrc, int lumFilterSize, \
494 const int16_t *chrFilter, const int16_t **chrUSrc, \495 const int16_t *chrFilter, const int16_t **_chrUSrc, \
495 const int16_t **chrVSrc, int chrFilterSize, \496 const int16_t **_chrVSrc, int chrFilterSize, \
496 const int16_t **alpSrc, uint8_t *dest, int dstW, \497 const int16_t **_alpSrc, uint8_t *_dest, int dstW, \
497 int y) \498 int y) \
498{ \499{ \
500 const int32_t **lumSrc = (const int32_t **) _lumSrc, \
501 **chrUSrc = (const int32_t **) _chrUSrc, \
502 **chrVSrc = (const int32_t **) _chrVSrc, \
503 **alpSrc = (const int32_t **) _alpSrc; \
504 uint16_t *dest = (uint16_t *) _dest; \
499 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \505 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
500 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \506 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
501 alpSrc, dest, dstW, y, fmt); \507 alpSrc, dest, dstW, y, fmt); \
502} \508} \
503 \509 \
504static void name ## ext ## _2_c(SwsContext *c, const int16_t *buf[2], \510static void name ## ext ## _2_c(SwsContext *c, const int16_t *_buf[2], \
505 const int16_t *ubuf[2], const int16_t *vbuf[2], \511 const int16_t *_ubuf[2], const int16_t *_vbuf[2], \
506 const int16_t *abuf[2], uint8_t *dest, int dstW, \512 const int16_t *_abuf[2], uint8_t *_dest, int dstW, \
507 int yalpha, int uvalpha, int y) \513 int yalpha, int uvalpha, int y) \
508{ \514{ \
515 const int32_t **buf = (const int32_t **) _buf, \
516 **ubuf = (const int32_t **) _ubuf, \
517 **vbuf = (const int32_t **) _vbuf, \
518 **abuf = (const int32_t **) _abuf; \
519 uint16_t *dest = (uint16_t *) _dest; \
509 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \520 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
510 dest, dstW, yalpha, uvalpha, y, fmt); \521 dest, dstW, yalpha, uvalpha, y, fmt); \
511} \522} \
512 \523 \
513static void name ## ext ## _1_c(SwsContext *c, const int16_t *buf0, \524static void name ## ext ## _1_c(SwsContext *c, const int16_t *_buf0, \
514 const int16_t *ubuf[2], const int16_t *vbuf[2], \525 const int16_t *_ubuf[2], const int16_t *_vbuf[2], \
515 const int16_t *abuf0, uint8_t *dest, int dstW, \526 const int16_t *_abuf0, uint8_t *_dest, int dstW, \
516 int uvalpha, int y) \527 int uvalpha, int y) \
517{ \528{ \
529 const int32_t *buf0 = (const int32_t *) _buf0, \
530 **ubuf = (const int32_t **) _ubuf, \
531 **vbuf = (const int32_t **) _vbuf, \
532 *abuf0 = (const int32_t *) _abuf0; \
533 uint16_t *dest = (uint16_t *) _dest; \
518 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \534 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
519 dstW, uvalpha, y, fmt); \535 dstW, uvalpha, y, fmt); \
520}536}
521 537
522YUV2PACKEDWRAPPER(yuv2gray16,, LE, PIX_FMT_GRAY16LE);538YUV2PACKED16WRAPPER(yuv2gray16,, LE, PIX_FMT_GRAY16LE);
523YUV2PACKEDWRAPPER(yuv2gray16,, BE, PIX_FMT_GRAY16BE);539YUV2PACKED16WRAPPER(yuv2gray16,, BE, PIX_FMT_GRAY16BE);
524 540
525#define output_pixel(pos, acc) \541#define output_pixel(pos, acc) \
526 if (target == PIX_FMT_MONOBLACK) { \542 if (target == PIX_FMT_MONOBLACK) { \
@@ -616,6 +632,38 @@ yuv2mono_1_c_template(SwsContext *c, const int16_t *buf0, · 89 unmodified lines
616 632
617#undef output_pixel633#undef output_pixel
618 634
635#define YUV2PACKEDWRAPPER(name, base, ext, fmt) \
636static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \
637 const int16_t **lumSrc, int lumFilterSize, \
638 const int16_t *chrFilter, const int16_t **chrUSrc, \
639 const int16_t **chrVSrc, int chrFilterSize, \
640 const int16_t **alpSrc, uint8_t *dest, int dstW, \
641 int y) \
642{ \
643 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
644 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
645 alpSrc, dest, dstW, y, fmt); \
646} \
647 \
648static void name ## ext ## _2_c(SwsContext *c, const int16_t *buf[2], \
649 const int16_t *ubuf[2], const int16_t *vbuf[2], \
650 const int16_t *abuf[2], uint8_t *dest, int dstW, \
651 int yalpha, int uvalpha, int y) \
652{ \
653 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
654 dest, dstW, yalpha, uvalpha, y, fmt); \
655} \
656 \
657static void name ## ext ## _1_c(SwsContext *c, const int16_t *buf0, \
658 const int16_t *ubuf[2], const int16_t *vbuf[2], \
659 const int16_t *abuf0, uint8_t *dest, int dstW, \
660 int uvalpha, int y) \
661{ \
662 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, \
663 abuf0, dest, dstW, uvalpha, \
664 y, fmt); \
665}
666
619YUV2PACKEDWRAPPER(yuv2mono,, white, PIX_FMT_MONOWHITE);667YUV2PACKEDWRAPPER(yuv2mono,, white, PIX_FMT_MONOWHITE);
620YUV2PACKEDWRAPPER(yuv2mono,, black, PIX_FMT_MONOBLACK);668YUV2PACKEDWRAPPER(yuv2mono,, black, PIX_FMT_MONOBLACK);
621 669
@@ -731,26 +779,32 @@ yuv2422_1_c_template(SwsContext *c, const int16_t *buf0, · 109 unmodified lines
731YUV2PACKEDWRAPPER(yuv2, 422, yuyv422, PIX_FMT_YUYV422);779YUV2PACKEDWRAPPER(yuv2, 422, yuyv422, PIX_FMT_YUYV422);
732YUV2PACKEDWRAPPER(yuv2, 422, uyvy422, PIX_FMT_UYVY422);780YUV2PACKEDWRAPPER(yuv2, 422, uyvy422, PIX_FMT_UYVY422);
733 781
734#define r_b ((target == PIX_FMT_RGB48LE || target == PIX_FMT_RGB48BE) ? r : b)782#define R_B ((target == PIX_FMT_RGB48LE || target == PIX_FMT_RGB48BE) ? R : B)
735#define b_r ((target == PIX_FMT_RGB48LE || target == PIX_FMT_RGB48BE) ? b : r)783#define B_R ((target == PIX_FMT_RGB48LE || target == PIX_FMT_RGB48BE) ? B : R)
784#define output_pixel(pos, val) \
785 if (isBE(target)) { \
786 AV_WB16(pos, val); \
787 } else { \
788 AV_WL16(pos, val); \
789 }
736 790
737static av_always_inline void791static av_always_inline void
738yuv2rgb48_X_c_template(SwsContext *c, const int16_t *lumFilter,792yuv2rgb48_X_c_template(SwsContext *c, const int16_t *lumFilter,
739 const int16_t **lumSrc, int lumFilterSize,793 const int32_t **lumSrc, int lumFilterSize,
740 const int16_t *chrFilter, const int16_t **chrUSrc,794 const int16_t *chrFilter, const int32_t **chrUSrc,
741 const int16_t **chrVSrc, int chrFilterSize,795 const int32_t **chrVSrc, int chrFilterSize,
742 const int16_t **alpSrc, uint8_t *dest, int dstW,796 const int32_t **alpSrc, uint16_t *dest, int dstW,
743 int y, enum PixelFormat target)797 int y, enum PixelFormat target)
744{798{
745 int i;799 int i;
746 800
747 for (i = 0; i < (dstW >> 1); i++) {801 for (i = 0; i < (dstW >> 1); i++) {
748 int j;802 int j;
749 int Y1 = 1 << 18;803 int Y1 = 0;
750 int Y2 = 1 << 18;804 int Y2 = 0;
751 int U = 1 << 18;805 int U = -128 << 23; // 19
752 int V = 1 << 18;806 int V = -128 << 23;
753 const uint8_t *r, *g, *b;807 int R, G, B;
754 808
755 for (j = 0; j < lumFilterSize; j++) {809 for (j = 0; j < lumFilterSize; j++) {
756 Y1 += lumSrc[j][i * 2] * lumFilter[j];810 Y1 += lumSrc[j][i * 2] * lumFilter[j];
@@ -760,40 +814,45 @@ yuv2rgb48_X_c_template(SwsContext *c, const int16_t *lumFilter, · 3 unmodified lines
760 U += chrUSrc[j][i] * chrFilter[j];814 U += chrUSrc[j][i] * chrFilter[j];
761 V += chrVSrc[j][i] * chrFilter[j];815 V += chrVSrc[j][i] * chrFilter[j];
762 }816 }
763 Y1 >>= 19;
764 Y2 >>= 19;
765 U >>= 19;
766 V >>= 19;
767 if ((Y1 | Y2 | U | V) & 0x100) {
768 Y1 = av_clip_uint8(Y1);
769 Y2 = av_clip_uint8(Y2);
770 U = av_clip_uint8(U);
771 V = av_clip_uint8(V);
772 }
773 817
774 /* FIXME fix tables so that clipping is not needed and then use _NOCLIP*/818 // 8bit: 12+15=27; 16-bit: 12+19=31
775 r = (const uint8_t *) c->table_rV[V];819 Y1 >>= 14; // 10
776 g = (const uint8_t *)(c->table_gU[U] + c->table_gV[V]);820 Y2 >>= 14;
777 b = (const uint8_t *) c->table_bU[U];821 U >>= 14;
822 V >>= 14;
823
824 // 8bit: 27 -> 17bit, 16bit: 31 - 14 = 17bit
825 Y1 -= c->yuv2rgb_y_offset;
826 Y2 -= c->yuv2rgb_y_offset;
827 Y1 *= c->yuv2rgb_y_coeff;
828 Y2 *= c->yuv2rgb_y_coeff;
829 Y1 += 1 << 13; // 21
830 Y2 += 1 << 13;
831 // 8bit: 17 + 13bit = 30bit, 16bit: 17 + 13bit = 30bit
832
833 R = V * c->yuv2rgb_v2r_coeff;
834 G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
835 B = U * c->yuv2rgb_u2b_coeff;
778 836
779 dest[ 0] = dest[ 1] = r_b[Y1];837 // 8bit: 30 - 22 = 8bit, 16bit: 30bit - 14 = 16bit
780 dest[ 2] = dest[ 3] = g[Y1];838 output_pixel(&dest[0], av_clip_uintp2(R_B + Y1, 30) >> 14);
781 dest[ 4] = dest[ 5] = b_r[Y1];839 output_pixel(&dest[1], av_clip_uintp2( G + Y1, 30) >> 14);
782 dest[ 6] = dest[ 7] = r_b[Y2];840 output_pixel(&dest[2], av_clip_uintp2(B_R + Y1, 30) >> 14);
783 dest[ 8] = dest[ 9] = g[Y2];841 output_pixel(&dest[3], av_clip_uintp2(R_B + Y2, 30) >> 14);
784 dest[10] = dest[11] = b_r[Y2];842 output_pixel(&dest[4], av_clip_uintp2( G + Y2, 30) >> 14);
785 dest += 12;843 output_pixel(&dest[5], av_clip_uintp2(B_R + Y2, 30) >> 14);
844 dest += 6;
786 }845 }
787}846}
788 847
789static av_always_inline void848static av_always_inline void
790yuv2rgb48_2_c_template(SwsContext *c, const int16_t *buf[2],849yuv2rgb48_2_c_template(SwsContext *c, const int32_t *buf[2],
791 const int16_t *ubuf[2], const int16_t *vbuf[2],850 const int32_t *ubuf[2], const int32_t *vbuf[2],
792 const int16_t *abuf[2], uint8_t *dest, int dstW,851 const int32_t *abuf[2], uint16_t *dest, int dstW,
793 int yalpha, int uvalpha, int y,852 int yalpha, int uvalpha, int y,
794 enum PixelFormat target)853 enum PixelFormat target)
795{854{
796 const int16_t *buf0 = buf[0], *buf1 = buf[1],855 const int32_t *buf0 = buf[0], *buf1 = buf[1],
797 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],856 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
798 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1];857 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1];
799 int yalpha1 = 4095 - yalpha;858 int yalpha1 = 4095 - yalpha;
@@ -801,80 +860,108 @@ yuv2rgb48_2_c_template(SwsContext *c, const int16_t *buf[2], · 1 unmodified line
801 int i;860 int i;
802 861
803 for (i = 0; i < (dstW >> 1); i++) {862 for (i = 0; i < (dstW >> 1); i++) {
804 int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 19;863 int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 14;
805 int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 19;864 int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 14;
806 int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha) >> 19;865 int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha + (-128 << 23)) >> 14;
807 int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha) >> 19;866 int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha + (-128 << 23)) >> 14;
808 const uint8_t *r = (const uint8_t *) c->table_rV[V],867 int R, G, B;
809 *g = (const uint8_t *)(c->table_gU[U] + c->table_gV[V]),
810 *b = (const uint8_t *) c->table_bU[U];
811 868
812 dest[ 0] = dest[ 1] = r_b[Y1];869 Y1 -= c->yuv2rgb_y_offset;
813 dest[ 2] = dest[ 3] = g[Y1];870 Y2 -= c->yuv2rgb_y_offset;
814 dest[ 4] = dest[ 5] = b_r[Y1];871 Y1 *= c->yuv2rgb_y_coeff;
815 dest[ 6] = dest[ 7] = r_b[Y2];872 Y2 *= c->yuv2rgb_y_coeff;
816 dest[ 8] = dest[ 9] = g[Y2];873 Y1 += 1 << 13;
817 dest[10] = dest[11] = b_r[Y2];874 Y2 += 1 << 13;
818 dest += 12;875
876 R = V * c->yuv2rgb_v2r_coeff;
877 G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
878 B = U * c->yuv2rgb_u2b_coeff;
879
880 output_pixel(&dest[0], av_clip_uintp2(R_B + Y1, 30) >> 14);
881 output_pixel(&dest[1], av_clip_uintp2( G + Y1, 30) >> 14);
882 output_pixel(&dest[2], av_clip_uintp2(B_R + Y1, 30) >> 14);
883 output_pixel(&dest[3], av_clip_uintp2(R_B + Y2, 30) >> 14);
884 output_pixel(&dest[4], av_clip_uintp2( G + Y2, 30) >> 14);
885 output_pixel(&dest[5], av_clip_uintp2(B_R + Y2, 30) >> 14);
886 dest += 6;
819 }887 }
820}888}
821 889
822static av_always_inline void890static av_always_inline void
823yuv2rgb48_1_c_template(SwsContext *c, const int16_t *buf0,891yuv2rgb48_1_c_template(SwsContext *c, const int32_t *buf0,
824 const int16_t *ubuf[2], const int16_t *vbuf[2],892 const int32_t *ubuf[2], const int32_t *vbuf[2],
825 const int16_t *abuf0, uint8_t *dest, int dstW,893 const int32_t *abuf0, uint16_t *dest, int dstW,
826 int uvalpha, int y, enum PixelFormat target)894 int uvalpha, int y, enum PixelFormat target)
827{895{
828 const int16_t *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],896 const int32_t *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
829 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1];897 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1];
830 int i;898 int i;
831 899
832 if (uvalpha < 2048) {900 if (uvalpha < 2048) {
833 for (i = 0; i < (dstW >> 1); i++) {901 for (i = 0; i < (dstW >> 1); i++) {
834 int Y1 = buf0[i * 2] >> 7;902 int Y1 = (buf0[i * 2] ) >> 2;
835 int Y2 = buf0[i * 2 + 1] >> 7;903 int Y2 = (buf0[i * 2 + 1]) >> 2;
836 int U = ubuf1[i] >> 7;904 int U = (ubuf0[i] + (-128 << 11)) >> 2;
837 int V = vbuf1[i] >> 7;905 int V = (vbuf0[i] + (-128 << 11)) >> 2;
838 const uint8_t *r = (const uint8_t *) c->table_rV[V],906 int R, G, B;
839 *g = (const uint8_t *)(c->table_gU[U] + c->table_gV[V]),907
840 *b = (const uint8_t *) c->table_bU[U];908 Y1 -= c->yuv2rgb_y_offset;
841 909 Y2 -= c->yuv2rgb_y_offset;
842 dest[ 0] = dest[ 1] = r_b[Y1];910 Y1 *= c->yuv2rgb_y_coeff;
843 dest[ 2] = dest[ 3] = g[Y1];911 Y2 *= c->yuv2rgb_y_coeff;
844 dest[ 4] = dest[ 5] = b_r[Y1];912 Y1 += 1 << 13;
845 dest[ 6] = dest[ 7] = r_b[Y2];913 Y2 += 1 << 13;
846 dest[ 8] = dest[ 9] = g[Y2];914
847 dest[10] = dest[11] = b_r[Y2];915 R = V * c->yuv2rgb_v2r_coeff;
848 dest += 12;916 G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
917 B = U * c->yuv2rgb_u2b_coeff;
918
919 output_pixel(&dest[0], av_clip_uintp2(R_B + Y1, 30) >> 14);
920 output_pixel(&dest[1], av_clip_uintp2( G + Y1, 30) >> 14);
921 output_pixel(&dest[2], av_clip_uintp2(B_R + Y1, 30) >> 14);
922 output_pixel(&dest[3], av_clip_uintp2(R_B + Y2, 30) >> 14);
923 output_pixel(&dest[4], av_clip_uintp2( G + Y2, 30) >> 14);
924 output_pixel(&dest[5], av_clip_uintp2(B_R + Y2, 30) >> 14);
925 dest += 6;
849 }926 }
850 } else {927 } else {
851 for (i = 0; i < (dstW >> 1); i++) {928 for (i = 0; i < (dstW >> 1); i++) {
852 int Y1 = buf0[i * 2] >> 7;929 int Y1 = (buf0[i * 2] ) >> 2;
853 int Y2 = buf0[i * 2 + 1] >> 7;930 int Y2 = (buf0[i * 2 + 1]) >> 2;
854 int U = (ubuf0[i] + ubuf1[i]) >> 8;931 int U = (ubuf0[i] + ubuf1[i] + (-128 << 11)) >> 3;
855 int V = (vbuf0[i] + vbuf1[i]) >> 8;932 int V = (vbuf0[i] + vbuf1[i] + (-128 << 11)) >> 3;
856 const uint8_t *r = (const uint8_t *) c->table_rV[V],933 int R, G, B;
857 *g = (const uint8_t *)(c->table_gU[U] + c->table_gV[V]),934
858 *b = (const uint8_t *) c->table_bU[U];935 Y1 -= c->yuv2rgb_y_offset;
859 936 Y2 -= c->yuv2rgb_y_offset;
860 dest[ 0] = dest[ 1] = r_b[Y1];937 Y1 *= c->yuv2rgb_y_coeff;
861 dest[ 2] = dest[ 3] = g[Y1];938 Y2 *= c->yuv2rgb_y_coeff;
862 dest[ 4] = dest[ 5] = b_r[Y1];939 Y1 += 1 << 13;
863 dest[ 6] = dest[ 7] = r_b[Y2];940 Y2 += 1 << 13;
864 dest[ 8] = dest[ 9] = g[Y2];941
865 dest[10] = dest[11] = b_r[Y2];942 R = V * c->yuv2rgb_v2r_coeff;
866 dest += 12;943 G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
944 B = U * c->yuv2rgb_u2b_coeff;
945
946 output_pixel(&dest[0], av_clip_uintp2(R_B + Y1, 30) >> 14);
947 output_pixel(&dest[1], av_clip_uintp2( G + Y1, 30) >> 14);
948 output_pixel(&dest[2], av_clip_uintp2(B_R + Y1, 30) >> 14);
949 output_pixel(&dest[3], av_clip_uintp2(R_B + Y2, 30) >> 14);
950 output_pixel(&dest[4], av_clip_uintp2( G + Y2, 30) >> 14);
951 output_pixel(&dest[5], av_clip_uintp2(B_R + Y2, 30) >> 14);
952 dest += 6;
867 }953 }
868 }954 }
869}955}
870 956
957#undef output_pixel
871#undef r_b958#undef r_b
872#undef b_r959#undef b_r
873 960
874YUV2PACKEDWRAPPER(yuv2, rgb48, rgb48be, PIX_FMT_RGB48BE);961YUV2PACKED16WRAPPER(yuv2, rgb48, rgb48be, PIX_FMT_RGB48BE);
875//YUV2PACKEDWRAPPER(yuv2, rgb48, rgb48le, PIX_FMT_RGB48LE);962YUV2PACKED16WRAPPER(yuv2, rgb48, rgb48le, PIX_FMT_RGB48LE);
876YUV2PACKEDWRAPPER(yuv2, rgb48, bgr48be, PIX_FMT_BGR48BE);963YUV2PACKED16WRAPPER(yuv2, rgb48, bgr48be, PIX_FMT_BGR48BE);
877//YUV2PACKEDWRAPPER(yuv2, rgb48, bgr48le, PIX_FMT_BGR48LE);964YUV2PACKED16WRAPPER(yuv2, rgb48, bgr48le, PIX_FMT_BGR48LE);
878 965
879static av_always_inline void966static av_always_inline void
880yuv2rgb_write(uint8_t *_dest, int i, int Y1, int Y2,967yuv2rgb_write(uint8_t *_dest, int i, int Y1, int Y2,
@@ -1025,7 +1112,7 @@ yuv2rgb_X_c_template(SwsContext *c, const int16_t *lumFilter, · 144 unmodified lines
1025 U = av_clip_uint8(U);1112 U = av_clip_uint8(U);
1026 V = av_clip_uint8(V);1113 V = av_clip_uint8(V);
1027 }1114 }
1028 if (hasAlpha) {\1115 if (hasAlpha) {
1029 A1 = 1 << 18;1116 A1 = 1 << 18;
1030 A2 = 1 << 18;1117 A2 = 1 << 18;
1031 for (j = 0; j < lumFilterSize; j++) {1118 for (j = 0; j < lumFilterSize; j++) {
@@ -1318,50 +1405,50 @@ static av_always_inline void fillPlane(uint8_t* plane, int stride, · 286 unmodified lines
1318#define b ((origin == PIX_FMT_BGR48BE || origin == PIX_FMT_BGR48LE) ? r_b : b_r)1405#define b ((origin == PIX_FMT_BGR48BE || origin == PIX_FMT_BGR48LE) ? r_b : b_r)
1319 1406
1320static av_always_inline void1407static av_always_inline void
1321rgb48ToY_c_template(uint8_t *dst, const uint8_t *src, int width,1408rgb48ToY_c_template(uint16_t *dst, const uint16_t *src, int width,
1322 enum PixelFormat origin)1409 enum PixelFormat origin)
1323{1410{
1324 int i;1411 int i;
1325 for (i = 0; i < width; i++) {1412 for (i = 0; i < width; i++) {
1326 int r_b = input_pixel(&src[i*6+0]) >> 8;1413 unsigned int r_b = input_pixel(&src[i*3+0]);
1327 int g = input_pixel(&src[i*6+2]) >> 8;1414 unsigned int g = input_pixel(&src[i*3+1]);
1328 int b_r = input_pixel(&src[i*6+4]) >> 8;1415 unsigned int b_r = input_pixel(&src[i*3+2]);
1329 1416
1330 dst[i] = (RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;1417 dst[i] = (RY*r + GY*g + BY*b + (0x2001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1331 }1418 }
1332}1419}
1333 1420
1334static av_always_inline void1421static av_always_inline void
1335rgb48ToUV_c_template(uint8_t *dstU, uint8_t *dstV,1422rgb48ToUV_c_template(uint16_t *dstU, uint16_t *dstV,
1336 const uint8_t *src1, const uint8_t *src2,1423 const uint16_t *src1, const uint16_t *src2,
1337 int width, enum PixelFormat origin)1424 int width, enum PixelFormat origin)
1338{1425{
1339 int i;1426 int i;
1340 assert(src1==src2);1427 assert(src1==src2);
1341 for (i = 0; i < width; i++) {1428 for (i = 0; i < width; i++) {
1342 int r_b = input_pixel(&src1[i*6+0]) >> 8;1429 int r_b = input_pixel(&src1[i*3+0]);
1343 int g = input_pixel(&src1[i*6+2]) >> 8;1430 int g = input_pixel(&src1[i*3+1]);
1344 int b_r = input_pixel(&src1[i*6+4]) >> 8;1431 int b_r = input_pixel(&src1[i*3+2]);
1345 1432
1346 dstU[i] = (RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;1433 dstU[i] = (RU*r + GU*g + BU*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1347 dstV[i] = (RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;1434 dstV[i] = (RV*r + GV*g + BV*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1348 }1435 }
1349}1436}
1350 1437
1351static av_always_inline void1438static av_always_inline void
1352rgb48ToUV_half_c_template(uint8_t *dstU, uint8_t *dstV,1439rgb48ToUV_half_c_template(uint16_t *dstU, uint16_t *dstV,
1353 const uint8_t *src1, const uint8_t *src2,1440 const uint16_t *src1, const uint16_t *src2,
1354 int width, enum PixelFormat origin)1441 int width, enum PixelFormat origin)
1355{1442{
1356 int i;1443 int i;
1357 assert(src1==src2);1444 assert(src1==src2);
1358 for (i = 0; i < width; i++) {1445 for (i = 0; i < width; i++) {
1359 int r_b = (input_pixel(&src1[12*i + 0]) >> 8) + (input_pixel(&src1[12*i + 6]) >> 8);1446 int r_b = (input_pixel(&src1[6 * i + 0]) + input_pixel(&src1[6 * i + 3]) + 1) >> 1;
1360 int g = (input_pixel(&src1[12*i + 2]) >> 8) + (input_pixel(&src1[12*i + 8]) >> 8);1447 int g = (input_pixel(&src1[6 * i + 1]) + input_pixel(&src1[6 * i + 4]) + 1) >> 1;
1361 int b_r = (input_pixel(&src1[12*i + 4]) >> 8) + (input_pixel(&src1[12*i + 10]) >> 8);1448 int b_r = (input_pixel(&src1[6 * i + 2]) + input_pixel(&src1[6 * i + 5]) + 1) >> 1;
1362 1449
1363 dstU[i]= (RU*r + GU*g + BU*b + (257<<RGB2YUV_SHIFT)) >> (RGB2YUV_SHIFT+1);1450 dstU[i]= (RU*r + GU*g + BU*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1364 dstV[i]= (RV*r + GV*g + BV*b + (257<<RGB2YUV_SHIFT)) >> (RGB2YUV_SHIFT+1);1451 dstV[i]= (RV*r + GV*g + BV*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1365 }1452 }
1366}1453}
1367 1454
@@ -1370,23 +1457,31 @@ rgb48ToUV_half_c_template(uint8_t *dstU, uint8_t *dstV, · 2 unmodified lines
1370#undef input_pixel1457#undef input_pixel
1371 1458
1372#define rgb48funcs(pattern, BE_LE, origin) \1459#define rgb48funcs(pattern, BE_LE, origin) \
1373static void pattern ## 48 ## BE_LE ## ToY_c(uint8_t *dst, const uint8_t *src, \1460static void pattern ## 48 ## BE_LE ## ToY_c(uint8_t *_dst, const uint8_t *_src, \
1374 int width, uint32_t *unused) \1461 int width, uint32_t *unused) \
1375{ \1462{ \
1463 const uint16_t *src = (const uint16_t *) _src; \
1464 uint16_t *dst = (uint16_t *) _dst; \
1376 rgb48ToY_c_template(dst, src, width, origin); \1465 rgb48ToY_c_template(dst, src, width, origin); \
1377} \1466} \
1378 \1467 \
1379static void pattern ## 48 ## BE_LE ## ToUV_c(uint8_t *dstU, uint8_t *dstV, \1468static void pattern ## 48 ## BE_LE ## ToUV_c(uint8_t *_dstU, uint8_t *_dstV, \
1380 const uint8_t *src1, const uint8_t *src2, \1469 const uint8_t *_src1, const uint8_t *_src2, \
1381 int width, uint32_t *unused) \1470 int width, uint32_t *unused) \
1382{ \1471{ \
1472 const uint16_t *src1 = (const uint16_t *) _src1, \
1473 *src2 = (const uint16_t *) _src2; \
1474 uint16_t *dstU = (uint16_t *) _dstU, *dstV = (uint16_t *) _dstV; \
1383 rgb48ToUV_c_template(dstU, dstV, src1, src2, width, origin); \1475 rgb48ToUV_c_template(dstU, dstV, src1, src2, width, origin); \
1384} \1476} \
1385 \1477 \
1386static void pattern ## 48 ## BE_LE ## ToUV_half_c(uint8_t *dstU, uint8_t *dstV, \1478static void pattern ## 48 ## BE_LE ## ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, \
1387 const uint8_t *src1, const uint8_t *src2, \1479 const uint8_t *_src1, const uint8_t *_src2, \
1388 int width, uint32_t *unused) \1480 int width, uint32_t *unused) \
1389{ \1481{ \
1482 const uint16_t *src1 = (const uint16_t *) _src1, \
1483 *src2 = (const uint16_t *) _src2; \
1484 uint16_t *dstU = (uint16_t *) _dstU, *dstV = (uint16_t *) _dstV; \
1390 rgb48ToUV_half_c_template(dstU, dstV, src1, src2, width, origin); \1485 rgb48ToUV_half_c_template(dstU, dstV, src1, src2, width, origin); \
1391}1486}
1392 1487
@@ -1601,13 +1696,26 @@ static void yuy2ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, · 208 unmodified lines
1601 assert(src1 == src2);1696 assert(src1 == src2);
1602}1697}
1603 1698
1604static void LEToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1,1699static void bswap16Y_c(uint8_t *_dst, const uint8_t *_src, int width, uint32_t *unused)
1605 const uint8_t *src2, int width, uint32_t *unused)
1606{1700{
1607 int i;1701 int i;
1702 const uint16_t *src = (const uint16_t *) _src;
1703 uint16_t *dst = (uint16_t *) _dst;
1608 for (i=0; i<width; i++) {1704 for (i=0; i<width; i++) {
1609 dstU[i]= src1[2*i + 1];1705 dst[i] = av_bswap16(src[i]);
1610 dstV[i]= src2[2*i + 1];1706 }
1707}
1708
1709static void bswap16UV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *_src1,
1710 const uint8_t *_src2, int width, uint32_t *unused)
1711{
1712 int i;
1713 const uint16_t *src1 = (const uint16_t *) _src1,
1714 *src2 = (const uint16_t *) _src2;
1715 uint16_t *dstU = (uint16_t *) _dstU, *dstV = (uint16_t *) _dstV;
1716 for (i=0; i<width; i++) {
1717 dstU[i] = av_bswap16(src1[i]);
1718 dstV[i] = av_bswap16(src2[i]);
1611 }1719 }
1612}1720}
1613 1721
@@ -1632,16 +1740,6 @@ static void uyvyToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, · 18 unmodified lines
1632 assert(src1 == src2);1740 assert(src1 == src2);
1633}1741}
1634 1742
1635static void BEToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1,
1636 const uint8_t *src2, int width, uint32_t *unused)
1637{
1638 int i;
1639 for (i=0; i<width; i++) {
1640 dstU[i]= src1[2*i];
1641 dstV[i]= src2[2*i];
1642 }
1643}
1644
1645static av_always_inline void nvXXtoUV_c(uint8_t *dst1, uint8_t *dst2,1743static av_always_inline void nvXXtoUV_c(uint8_t *dst1, uint8_t *dst2,
1646 const uint8_t *src, int width)1744 const uint8_t *src, int width)
1647{1745{
@@ -1670,43 +1768,49 @@ static void nv21ToUV_c(uint8_t *dstU, uint8_t *dstV, · 22 unmodified lines
1670 1768
1671// FIXME Maybe dither instead.1769// FIXME Maybe dither instead.
1672static av_always_inline void1770static av_always_inline void
1673yuv9_OR_10ToUV_c_template(uint8_t *dstU, uint8_t *dstV,1771yuv9_OR_10ToUV_c_template(uint16_t *dstU, uint16_t *dstV,
1674 const uint8_t *_srcU, const uint8_t *_srcV,1772 const uint16_t *srcU, const uint16_t *srcV,
1675 int width, enum PixelFormat origin, int depth)1773 int width, enum PixelFormat origin, int depth)
1676{1774{
1677 int i;1775 int i;
1678 const uint16_t *srcU = (const uint16_t *) _srcU;
1679 const uint16_t *srcV = (const uint16_t *) _srcV;
1680 1776
1681 for (i = 0; i < width; i++) {1777 for (i = 0; i < width; i++) {
1682 dstU[i] = input_pixel(&srcU[i]) >> (depth - 8);1778 int upx = input_pixel(&srcU[i]);
1683 dstV[i] = input_pixel(&srcV[i]) >> (depth - 8);1779 int vpx = input_pixel(&srcV[i]);
1780 dstU[i] = (upx << (16 - depth)) | (upx >> (2 * depth - 16));
1781 dstV[i] = (vpx << (16 - depth)) | (vpx >> (2 * depth - 16));
1684 }1782 }
1685}1783}
1686 1784
1687static av_always_inline void1785static av_always_inline void
1688yuv9_or_10ToY_c_template(uint8_t *dstY, const uint8_t *_srcY,1786yuv9_or_10ToY_c_template(uint16_t *dstY, const uint16_t *srcY,
1689 int width, enum PixelFormat origin, int depth)1787 int width, enum PixelFormat origin, int depth)
1690{1788{
1691 int i;1789 int i;
1692 const uint16_t *srcY = (const uint16_t*)_srcY;
1693 1790
1694 for (i = 0; i < width; i++)1791 for (i = 0; i < width; i++) {
1695 dstY[i] = input_pixel(&srcY[i]) >> (depth - 8);1792 int px = input_pixel(&srcY[i]);
1793 dstY[i] = (px << (16 - depth)) | (px >> (2 * depth - 16));
1794 }
1696}1795}
1697 1796
1698#undef input_pixel1797#undef input_pixel
1699 1798
1700#define YUV_NBPS(depth, BE_LE, origin) \1799#define YUV_NBPS(depth, BE_LE, origin) \
1701static void BE_LE ## depth ## ToUV_c(uint8_t *dstU, uint8_t *dstV, \1800static void BE_LE ## depth ## ToUV_c(uint8_t *_dstU, uint8_t *_dstV, \
1702 const uint8_t *srcU, const uint8_t *srcV, \1801 const uint8_t *_srcU, const uint8_t *_srcV, \
1703 int width, uint32_t *unused) \1802 int width, uint32_t *unused) \
1704{ \1803{ \
1804 uint16_t *dstU = (uint16_t *) _dstU, *dstV = (uint16_t *) _dstV; \
1805 const uint16_t *srcU = (const uint16_t *) _srcU, \
1806 *srcV = (const uint16_t *) _srcV; \
1705 yuv9_OR_10ToUV_c_template(dstU, dstV, srcU, srcV, width, origin, depth); \1807 yuv9_OR_10ToUV_c_template(dstU, dstV, srcU, srcV, width, origin, depth); \
1706} \1808} \
1707static void BE_LE ## depth ## ToY_c(uint8_t *dstY, const uint8_t *srcY, \1809static void BE_LE ## depth ## ToY_c(uint8_t *_dstY, const uint8_t *_srcY, \
1708 int width, uint32_t *unused) \1810 int width, uint32_t *unused) \
1709{ \1811{ \
1812 uint16_t *dstY = (uint16_t *) _dstY; \
1813 const uint16_t *srcY = (const uint16_t *) _srcY; \
1710 yuv9_or_10ToY_c_template(dstY, srcY, width, origin, depth); \1814 yuv9_or_10ToY_c_template(dstY, srcY, width, origin, depth); \
1711}1815}
1712 1816
@@ -1801,6 +1905,27 @@ static void rgb24ToUV_half_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, · 88 unmodified lines
1801 }1905 }
1802}1906}
1803 1907
1908static void hScale16_c(int16_t *_dst, int dstW, const uint8_t *_src,
1909 const int16_t *filter,
1910 const int16_t *filterPos, int filterSize)
1911{
1912 int i;
1913 int32_t *dst = (int32_t *) _dst;
1914 const uint16_t *src = (const uint16_t *) _src;
1915
1916 for (i = 0; i < dstW; i++) {
1917 int j;
1918 int srcPos = filterPos[i];
1919 unsigned int val = 0;
1920
1921 for (j = 0; j < filterSize; j++) {
1922 val += src[srcPos + j] * filter[filterSize * i + j];
1923 }
1924 // filter=14 bit, input=16 bit, output=30 bit, >> 11 makes 19 bit
1925 dst[i] = FFMIN(val >> 11, (1 << 19) - 1);
1926 }
1927}
1928
1804// bilinear / bicubic scaling1929// bilinear / bicubic scaling
1805static void hScale_c(int16_t *dst, int dstW, const uint8_t *src,1930static void hScale_c(int16_t *dst, int dstW, const uint8_t *src,
1806 const int16_t *filter, const int16_t *filterPos,1931 const int16_t *filter, const int16_t *filterPos,
@@ -1851,6 +1976,41 @@ static void lumRangeFromJpeg_c(int16_t *dst, int width) · 44 unmodified lines
1851 dst[i] = (dst[i]*14071 + 33561947)>>14;1976 dst[i] = (dst[i]*14071 + 33561947)>>14;
1852}1977}
1853 1978
1979static void chrRangeToJpeg16_c(int16_t *_dstU, int16_t *_dstV, int width)
1980{
1981 int i;
1982 int32_t *dstU = (int32_t *) _dstU;
1983 int32_t *dstV = (int32_t *) _dstV;
1984 for (i = 0; i < width; i++) {
1985 dstU[i] = (FFMIN(dstU[i],30775)*4663 - 9289992)>>12; //-264
1986 dstV[i] = (FFMIN(dstV[i],30775)*4663 - 9289992)>>12; //-264
1987 }
1988}
1989static void chrRangeFromJpeg16_c(int16_t *_dstU, int16_t *_dstV, int width)
1990{
1991 int i;
1992 int32_t *dstU = (int32_t *) _dstU;
1993 int32_t *dstV = (int32_t *) _dstV;
1994 for (i = 0; i < width; i++) {
1995 dstU[i] = (dstU[i]*1799 + 4081085)>>11; //1469
1996 dstV[i] = (dstV[i]*1799 + 4081085)>>11; //1469
1997 }
1998}
1999static void lumRangeToJpeg16_c(int16_t *_dst, int width)
2000{
2001 int i;
2002 int32_t *dst = (int32_t *) _dst;
2003 for (i = 0; i < width; i++)
2004 dst[i] = (FFMIN(dst[i],30189)*19077 - 39057361)>>14;
2005}
2006static void lumRangeFromJpeg16_c(int16_t *_dst, int width)
2007{
2008 int i;
2009 int32_t *dst = (int32_t *) _dst;
2010 for (i = 0; i < width; i++)
2011 dst[i] = (dst[i]*14071 + 33561947)>>14;
2012}
2013
1854static void hyscale_fast_c(SwsContext *c, int16_t *dst, int dstWidth,2014static void hyscale_fast_c(SwsContext *c, int16_t *dst, int dstWidth,
1855 const uint8_t *src, int srcW, int xInc)2015 const uint8_t *src, int srcW, int xInc)
1856{2016{
@@ -1864,8 +2024,25 @@ static void hyscale_fast_c(SwsContext *c, int16_t *dst, int dstWidth, · 7 unmodified lines
1864 }2024 }
1865}2025}
1866 2026
2027static void scale8To16Rv_c(uint16_t *_dst, const uint8_t *src, int len)
2028{
2029 int i;
2030 uint8_t *dst = (uint8_t *) _dst;
2031 for (i = len - 1; i >= 0; i--) {
2032 dst[i * 2] = dst[i * 2 + 1] = src[i];
2033 }
2034}
2035
2036static void scale19To15Fw_c(int16_t *dst, const int32_t *src, int len)
2037{
2038 int i;
2039 for (i = 0; i < len; i++) {
2040 dst[i] = src[i] >> 4;
2041 }
2042}
2043
1867// *** horizontal scale Y line to temp buffer2044// *** horizontal scale Y line to temp buffer
1868static av_always_inline void hyscale(SwsContext *c, uint16_t *dst, int dstWidth,2045static av_always_inline void hyscale(SwsContext *c, int16_t *dst, int dstWidth,
1869 const uint8_t *src, int srcW, int xInc,2046 const uint8_t *src, int srcW, int xInc,
1870 const int16_t *hLumFilter,2047 const int16_t *hLumFilter,
1871 const int16_t *hLumFilterPos, int hLumFilterSize,2048 const int16_t *hLumFilterPos, int hLumFilterSize,
@@ -1880,6 +2057,11 @@ static av_always_inline void hyscale(SwsContext *c, uint16_t *dst, int dstWidth, · 8 unmodified lines
1880 src= formatConvBuffer;2057 src= formatConvBuffer;
1881 }2058 }
1882 2059
2060 if (av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1 < 8 && c->scalingBpp == 16) {
2061 c->scale8To16Rv((uint16_t *) formatConvBuffer, src, srcW);
2062 src = formatConvBuffer;
2063 }
2064
1883 if (!c->hyscale_fast) {2065 if (!c->hyscale_fast) {
1884 c->hScale(dst, dstWidth, src, hLumFilter, hLumFilterPos, hLumFilterSize);2066 c->hScale(dst, dstWidth, src, hLumFilter, hLumFilterPos, hLumFilterSize);
1885 } else { // fast bilinear upscale / crap downscale2067 } else { // fast bilinear upscale / crap downscale
@@ -1888,6 +2070,10 @@ static av_always_inline void hyscale(SwsContext *c, uint16_t *dst, int dstWidth, · 2 unmodified lines
1888 2070
1889 if (convertRange)2071 if (convertRange)
1890 convertRange(dst, dstWidth);2072 convertRange(dst, dstWidth);
2073
2074 if (av_pix_fmt_descriptors[c->dstFormat].comp[0].depth_minus1 < 8 && c->scalingBpp == 16) {
2075 c->scale19To15Fw(dst, (int32_t *) dst, dstWidth);
2076 }
1891}2077}
1892 2078
1893static void hcscale_fast_c(SwsContext *c, int16_t *dst1, int16_t *dst2,2079static void hcscale_fast_c(SwsContext *c, int16_t *dst1, int16_t *dst2,
@@ -1905,19 +2091,27 @@ static void hcscale_fast_c(SwsContext *c, int16_t *dst1, int16_t *dst2, · 11 unmodified lines
1905 }2091 }
1906}2092}
1907 2093
1908static av_always_inline void hcscale(SwsContext *c, uint16_t *dst1, uint16_t *dst2, int dstWidth,2094static av_always_inline void hcscale(SwsContext *c, int16_t *dst1, int16_t *dst2, int dstWidth,
1909 const uint8_t *src1, const uint8_t *src2,2095 const uint8_t *src1, const uint8_t *src2,
1910 int srcW, int xInc, const int16_t *hChrFilter,2096 int srcW, int xInc, const int16_t *hChrFilter,
1911 const int16_t *hChrFilterPos, int hChrFilterSize,2097 const int16_t *hChrFilterPos, int hChrFilterSize,
1912 uint8_t *formatConvBuffer, uint32_t *pal)2098 uint8_t *formatConvBuffer, uint32_t *pal)
1913{2099{
1914 if (c->chrToYV12) {2100 if (c->chrToYV12) {
1915 uint8_t *buf2 = formatConvBuffer + FFALIGN(srcW, 16);2101 uint8_t *buf2 = formatConvBuffer + FFALIGN(srcW * c->scalingBpp >> 3, 16);
1916 c->chrToYV12(formatConvBuffer, buf2, src1, src2, srcW, pal);2102 c->chrToYV12(formatConvBuffer, buf2, src1, src2, srcW, pal);
1917 src1= formatConvBuffer;2103 src1= formatConvBuffer;
1918 src2= buf2;2104 src2= buf2;
1919 }2105 }
1920 2106
2107 if (av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1 < 8 && c->scalingBpp == 16) {
2108 uint8_t *buf2 = (formatConvBuffer + FFALIGN(srcW * 2, 16));
2109 c->scale8To16Rv((uint16_t *) formatConvBuffer, src1, srcW);
2110 c->scale8To16Rv((uint16_t *) buf2, src2, srcW);
2111 src1 = formatConvBuffer;
2112 src2 = buf2;
2113 }
2114
1921 if (!c->hcscale_fast) {2115 if (!c->hcscale_fast) {
1922 c->hScale(dst1, dstWidth, src1, hChrFilter, hChrFilterPos, hChrFilterSize);2116 c->hScale(dst1, dstWidth, src1, hChrFilter, hChrFilterPos, hChrFilterSize);
1923 c->hScale(dst2, dstWidth, src2, hChrFilter, hChrFilterPos, hChrFilterSize);2117 c->hScale(dst2, dstWidth, src2, hChrFilter, hChrFilterPos, hChrFilterSize);
@@ -1927,6 +2121,11 @@ static av_always_inline void hcscale(SwsContext *c, uint16_t *dst1, uint16_t *ds · 3 unmodified lines
1927 2121
1928 if (c->chrConvertRange)2122 if (c->chrConvertRange)
1929 c->chrConvertRange(dst1, dst2, dstWidth);2123 c->chrConvertRange(dst1, dst2, dstWidth);
2124
2125 if (av_pix_fmt_descriptors[c->dstFormat].comp[0].depth_minus1 < 8 && c->scalingBpp == 16) {
2126 c->scale19To15Fw(dst1, (int32_t *) dst1, dstWidth);
2127 c->scale19To15Fw(dst2, (int32_t *) dst2, dstWidth);
2128 }
1930}2129}
1931 2130
1932static av_always_inline void2131static av_always_inline void
@@ -2049,20 +2248,20 @@ find_c_packed_planar_out_funcs(SwsContext *c, · 116 unmodified lines
2049 *yuv2packedX = yuv2uyvy422_X_c;2248 *yuv2packedX = yuv2uyvy422_X_c;
2050 break;2249 break;
2051 case PIX_FMT_RGB48LE:2250 case PIX_FMT_RGB48LE:
2052 //*yuv2packed1 = yuv2rgb48le_1_c;2251 *yuv2packed1 = yuv2rgb48le_1_c;
2053 //*yuv2packed2 = yuv2rgb48le_2_c;2252 *yuv2packed2 = yuv2rgb48le_2_c;
2054 //*yuv2packedX = yuv2rgb48le_X_c;2253 *yuv2packedX = yuv2rgb48le_X_c;
2055 //break;2254 break;
2056 case PIX_FMT_RGB48BE:2255 case PIX_FMT_RGB48BE:
2057 *yuv2packed1 = yuv2rgb48be_1_c;2256 *yuv2packed1 = yuv2rgb48be_1_c;
2058 *yuv2packed2 = yuv2rgb48be_2_c;2257 *yuv2packed2 = yuv2rgb48be_2_c;
2059 *yuv2packedX = yuv2rgb48be_X_c;2258 *yuv2packedX = yuv2rgb48be_X_c;
2060 break;2259 break;
2061 case PIX_FMT_BGR48LE:2260 case PIX_FMT_BGR48LE:
2062 //*yuv2packed1 = yuv2bgr48le_1_c;2261 *yuv2packed1 = yuv2bgr48le_1_c;
2063 //*yuv2packed2 = yuv2bgr48le_2_c;2262 *yuv2packed2 = yuv2bgr48le_2_c;
2064 //*yuv2packedX = yuv2bgr48le_X_c;2263 *yuv2packedX = yuv2bgr48le_X_c;
2065 //break;2264 break;
2066 case PIX_FMT_BGR48BE:2265 case PIX_FMT_BGR48BE:
2067 *yuv2packed1 = yuv2bgr48be_1_c;2266 *yuv2packed1 = yuv2bgr48be_1_c;
2068 *yuv2packed2 = yuv2bgr48be_2_c;2267 *yuv2packed2 = yuv2bgr48be_2_c;
@@ -2435,13 +2634,6 @@ static av_cold void sws_init_swScale_c(SwsContext *c) · 366 unmodified lines
2435 &c->yuv2packed1, &c->yuv2packed2,2634 &c->yuv2packed1, &c->yuv2packed2,
2436 &c->yuv2packedX);2635 &c->yuv2packedX);
2437 2636
2438 c->hScale = hScale_c;
2439
2440 if (c->flags & SWS_FAST_BILINEAR) {
2441 c->hyscale_fast = hyscale_fast_c;
2442 c->hcscale_fast = hcscale_fast_c;
2443 }
2444
2445 c->chrToYV12 = NULL;2637 c->chrToYV12 = NULL;
2446 switch(srcFormat) {2638 switch(srcFormat) {
2447 case PIX_FMT_YUYV422 : c->chrToYV12 = yuy2ToUV_c; break;2639 case PIX_FMT_YUYV422 : c->chrToYV12 = yuy2ToUV_c; break;
@@ -2453,22 +2645,25 @@ static av_cold void sws_init_swScale_c(SwsContext *c) · 5 unmodified lines
2453 case PIX_FMT_PAL8 :2645 case PIX_FMT_PAL8 :
2454 case PIX_FMT_BGR4_BYTE:2646 case PIX_FMT_BGR4_BYTE:
2455 case PIX_FMT_RGB4_BYTE: c->chrToYV12 = palToUV_c; break;2647 case PIX_FMT_RGB4_BYTE: c->chrToYV12 = palToUV_c; break;
2456 case PIX_FMT_YUV444P9BE:
2457 case PIX_FMT_YUV420P9BE: c->chrToYV12 = BE9ToUV_c; break;
2458 case PIX_FMT_YUV444P9LE:2648 case PIX_FMT_YUV444P9LE:
2459 case PIX_FMT_YUV420P9LE: c->chrToYV12 = LE9ToUV_c; break;2649 case PIX_FMT_YUV420P9LE: c->chrToYV12 = LE9ToUV_c; break;
2460 case PIX_FMT_YUV444P10BE:
2461 case PIX_FMT_YUV422P10BE:
2462 case PIX_FMT_YUV420P10BE: c->chrToYV12 = BE10ToUV_c; break;
2463 case PIX_FMT_YUV422P10LE:2650 case PIX_FMT_YUV422P10LE:
2464 case PIX_FMT_YUV444P10LE:2651 case PIX_FMT_YUV444P10LE:
2465 case PIX_FMT_YUV420P10LE: c->chrToYV12 = LE10ToUV_c; break;2652 case PIX_FMT_YUV420P10LE: c->chrToYV12 = LE10ToUV_c; break;
2466 case PIX_FMT_YUV420P16BE:2653 case PIX_FMT_YUV444P9BE:
2467 case PIX_FMT_YUV422P16BE:2654 case PIX_FMT_YUV420P9BE: c->chrToYV12 = BE9ToUV_c; break;
2468 case PIX_FMT_YUV444P16BE: c->chrToYV12 = BEToUV_c; break;2655 case PIX_FMT_YUV444P10BE:
2656 case PIX_FMT_YUV422P10BE:
2657 case PIX_FMT_YUV420P10BE: c->chrToYV12 = BE10ToUV_c; break;
2658#if HAVE_BIGENDIAN
2469 case PIX_FMT_YUV420P16LE:2659 case PIX_FMT_YUV420P16LE:
2470 case PIX_FMT_YUV422P16LE:2660 case PIX_FMT_YUV422P16LE:
2471 case PIX_FMT_YUV444P16LE: c->chrToYV12 = LEToUV_c; break;2661 case PIX_FMT_YUV444P16LE: c->chrToYV12 = bswap16UV_c; break;
2662#else
2663 case PIX_FMT_YUV420P16BE:
2664 case PIX_FMT_YUV422P16BE:
2665 case PIX_FMT_YUV444P16BE: c->chrToYV12 = bswap16UV_c; break;
2666#endif
2472 }2667 }
2473 if (c->chrSrcHSubSample) {2668 if (c->chrSrcHSubSample) {
2474 switch(srcFormat) {2669 switch(srcFormat) {
@@ -2517,27 +2712,30 @@ static av_cold void sws_init_swScale_c(SwsContext *c) · 42 unmodified lines
2517 c->lumToYV12 = NULL;2712 c->lumToYV12 = NULL;
2518 c->alpToYV12 = NULL;2713 c->alpToYV12 = NULL;
2519 switch (srcFormat) {2714 switch (srcFormat) {
2520 case PIX_FMT_YUV444P9BE:
2521 case PIX_FMT_YUV420P9BE: c->lumToYV12 = BE9ToY_c; break;
2522 case PIX_FMT_YUV444P9LE:2715 case PIX_FMT_YUV444P9LE:
2523 case PIX_FMT_YUV420P9LE: c->lumToYV12 = LE9ToY_c; break;2716 case PIX_FMT_YUV420P9LE: c->lumToYV12 = LE9ToY_c; break;
2524 case PIX_FMT_YUV444P10BE:
2525 case PIX_FMT_YUV422P10BE:
2526 case PIX_FMT_YUV420P10BE: c->lumToYV12 = BE10ToY_c; break;
2527 case PIX_FMT_YUV444P10LE:2717 case PIX_FMT_YUV444P10LE:
2528 case PIX_FMT_YUV422P10LE:2718 case PIX_FMT_YUV422P10LE:
2529 case PIX_FMT_YUV420P10LE: c->lumToYV12 = LE10ToY_c; break;2719 case PIX_FMT_YUV420P10LE: c->lumToYV12 = LE10ToY_c; break;
2530 case PIX_FMT_YUYV422 :2720 case PIX_FMT_YUV444P9BE:
2531 case PIX_FMT_YUV420P16BE:2721 case PIX_FMT_YUV420P9BE: c->lumToYV12 = BE9ToY_c; break;
2532 case PIX_FMT_YUV422P16BE:2722 case PIX_FMT_YUV444P10BE:
2533 case PIX_FMT_YUV444P16BE:2723 case PIX_FMT_YUV422P10BE:
2534 case PIX_FMT_Y400A :2724 case PIX_FMT_YUV420P10BE: c->lumToYV12 = BE10ToY_c; break;
2535 case PIX_FMT_GRAY16BE : c->lumToYV12 = yuy2ToY_c; break;2725#if HAVE_BIGENDIAN
2536 case PIX_FMT_UYVY422 :
2537 case PIX_FMT_YUV420P16LE:2726 case PIX_FMT_YUV420P16LE:
2538 case PIX_FMT_YUV422P16LE:2727 case PIX_FMT_YUV422P16LE:
2539 case PIX_FMT_YUV444P16LE:2728 case PIX_FMT_YUV444P16LE:
2540 case PIX_FMT_GRAY16LE : c->lumToYV12 = uyvyToY_c; break;2729 case PIX_FMT_GRAY16LE: c->lumToYV12 = bswap16Y_c; break;
2730#else
2731 case PIX_FMT_YUV420P16BE:
2732 case PIX_FMT_YUV422P16BE:
2733 case PIX_FMT_YUV444P16BE:
2734 case PIX_FMT_GRAY16BE: c->lumToYV12 = bswap16Y_c; break;
2735#endif
2736 case PIX_FMT_YUYV422 :
2737 case PIX_FMT_Y400A : c->lumToYV12 = yuy2ToY_c; break;
2738 case PIX_FMT_UYVY422 : c->lumToYV12 = uyvyToY_c; break;
2541 case PIX_FMT_BGR24 : c->lumToYV12 = bgr24ToY_c; break;2739 case PIX_FMT_BGR24 : c->lumToYV12 = bgr24ToY_c; break;
2542 case PIX_FMT_BGR565LE : c->lumToYV12 = bgr16leToY_c; break;2740 case PIX_FMT_BGR565LE : c->lumToYV12 = bgr16leToY_c; break;
2543 case PIX_FMT_BGR565BE : c->lumToYV12 = bgr16beToY_c; break;2741 case PIX_FMT_BGR565BE : c->lumToYV12 = bgr16beToY_c; break;
@@ -2574,6 +2772,13 @@ static av_cold void sws_init_swScale_c(SwsContext *c) · 30 unmodified lines
2574 }2772 }
2575 }2773 }
2576 2774
2775 if (c->scalingBpp == 8) {
2776 c->hScale = hScale_c;
2777 if (c->flags & SWS_FAST_BILINEAR) {
2778 c->hyscale_fast = hyscale_fast_c;
2779 c->hcscale_fast = hcscale_fast_c;
2780 }
2781
2577 if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat)) {2782 if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat)) {
2578 if (c->srcRange) {2783 if (c->srcRange) {
2579 c->lumConvertRange = lumRangeFromJpeg_c;2784 c->lumConvertRange = lumRangeFromJpeg_c;
@@ -2583,6 +2788,21 @@ static av_cold void sws_init_swScale_c(SwsContext *c) · 3 unmodified lines
2583 c->chrConvertRange = chrRangeToJpeg_c;2788 c->chrConvertRange = chrRangeToJpeg_c;
2584 }2789 }
2585 }2790 }
2791 } else {
2792 c->hScale = hScale16_c;
2793 c->scale19To15Fw = scale19To15Fw_c;
2794 c->scale8To16Rv = scale8To16Rv_c;
2795
2796 if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat)) {
2797 if (c->srcRange) {
2798 c->lumConvertRange = lumRangeFromJpeg16_c;
2799 c->chrConvertRange = chrRangeFromJpeg16_c;
2800 } else {
2801 c->lumConvertRange = lumRangeToJpeg16_c;
2802 c->chrConvertRange = chrRangeToJpeg16_c;
2803 }
2804 }
2805 }
2586 2806
2587 if (!(isGray(srcFormat) || isGray(c->dstFormat) ||2807 if (!(isGray(srcFormat) || isGray(c->dstFormat) ||
2588 srcFormat == PIX_FMT_MONOBLACK || srcFormat == PIX_FMT_MONOWHITE))2808 srcFormat == PIX_FMT_MONOBLACK || srcFormat == PIX_FMT_MONOWHITE))
libswscale/swscale_internal.h+10−0
@@ -205,6 +205,7 @@ typedef struct SwsContext { · 204 unmodified lines
205 enum PixelFormat srcFormat; ///< Source pixel format.205 enum PixelFormat srcFormat; ///< Source pixel format.
206 int dstFormatBpp; ///< Number of bits per pixel of the destination pixel format.206 int dstFormatBpp; ///< Number of bits per pixel of the destination pixel format.
207 int srcFormatBpp; ///< Number of bits per pixel of the source pixel format.207 int srcFormatBpp; ///< Number of bits per pixel of the source pixel format.
208 int scalingBpp;
208 int chrSrcHSubSample; ///< Binary logarithm of horizontal subsampling factor between luma/alpha and chroma planes in source image.209 int chrSrcHSubSample; ///< Binary logarithm of horizontal subsampling factor between luma/alpha and chroma planes in source image.
209 int chrSrcVSubSample; ///< Binary logarithm of vertical subsampling factor between luma/alpha and chroma planes in source image.210 int chrSrcVSubSample; ///< Binary logarithm of vertical subsampling factor between luma/alpha and chroma planes in source image.
210 int chrDstHSubSample; ///< Binary logarithm of horizontal subsampling factor between luma/alpha and chroma planes in destination image.211 int chrDstHSubSample; ///< Binary logarithm of horizontal subsampling factor between luma/alpha and chroma planes in destination image.
@@ -446,6 +447,15 @@ typedef struct SwsContext { · 235 unmodified lines
446 void (*lumConvertRange)(int16_t *dst, int width); ///< Color range conversion function for luma plane if needed.447 void (*lumConvertRange)(int16_t *dst, int width); ///< Color range conversion function for luma plane if needed.
447 void (*chrConvertRange)(int16_t *dst1, int16_t *dst2, int width); ///< Color range conversion function for chroma planes if needed.448 void (*chrConvertRange)(int16_t *dst1, int16_t *dst2, int width); ///< Color range conversion function for chroma planes if needed.
448 449
450 /**
451 * dst[..] = (src[..] << 8) | src[..];
452 */
453 void (*scale8To16Rv)(uint16_t *dst, const uint8_t *src, int len);
454 /**
455 * dst[..] = src[..] >> 4;
456 */
457 void (*scale19To15Fw)(int16_t *dst, const int32_t *src, int len);
458
449 int needs_hcscale; ///< Set if there are chroma planes to be converted.459 int needs_hcscale; ///< Set if there are chroma planes to be converted.
450 460
451} SwsContext;461} SwsContext;
libswscale/utils.c+7−2
@@ -877,8 +877,13 @@ int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter) · 876 unmodified lines
877 }877 }
878 }878 }
879 879
880 FF_ALLOC_OR_GOTO(c, c->formatConvBuffer, FFALIGN(srcW, 16) * 2, fail);880 // FIXME it's even nicer if bpp isn't 16, but max({src,dst}formatbpp)
881 if (HAVE_MMX2 && cpu_flags & AV_CPU_FLAG_MMX2) {881 c->scalingBpp = FFMAX(av_pix_fmt_descriptors[srcFormat].comp[0].depth_minus1,
882 av_pix_fmt_descriptors[dstFormat].comp[0].depth_minus1) >= 8 ? 16 : 8;
883 if (c->scalingBpp == 16)
884 dst_stride <<= 1;
885 FF_ALLOC_OR_GOTO(c, c->formatConvBuffer, FFALIGN(srcW, 16) * 2 * c->scalingBpp >> 3, fail);
886 if (HAVE_MMX2 && cpu_flags & AV_CPU_FLAG_MMX2 && c->scalingBpp == 8) {
882 c->canMMX2BeUsed= (dstW >=srcW && (dstW&31)==0 && (srcW&15)==0) ? 1 : 0;887 c->canMMX2BeUsed= (dstW >=srcW && (dstW&31)==0 && (srcW&15)==0) ? 1 : 0;
883 if (!c->canMMX2BeUsed && dstW >=srcW && (srcW&15)==0 && (flags&SWS_FAST_BILINEAR)) {888 if (!c->canMMX2BeUsed && dstW >=srcW && (srcW&15)==0 && (flags&SWS_FAST_BILINEAR)) {
884 if (flags&SWS_PRINT_INFO)889 if (flags&SWS_PRINT_INFO)
libswscale/x86/swscale_template.c+4−69
@@ -1625,32 +1625,6 @@ static void RENAME(yuy2ToUV)(uint8_t *dstU, uint8_t *dstV, · 1624 unmodified lines
1625 assert(src1 == src2);1625 assert(src1 == src2);
1626}1626}
1627 1627
1628static void RENAME(LEToUV)(uint8_t *dstU, uint8_t *dstV,
1629 const uint8_t *src1, const uint8_t *src2,
1630 int width, uint32_t *unused)
1631{
1632 __asm__ volatile(
1633 "mov %0, %%"REG_a" \n\t"
1634 "1: \n\t"
1635 "movq (%1, %%"REG_a",2), %%mm0 \n\t"
1636 "movq 8(%1, %%"REG_a",2), %%mm1 \n\t"
1637 "movq (%2, %%"REG_a",2), %%mm2 \n\t"
1638 "movq 8(%2, %%"REG_a",2), %%mm3 \n\t"
1639 "psrlw $8, %%mm0 \n\t"
1640 "psrlw $8, %%mm1 \n\t"
1641 "psrlw $8, %%mm2 \n\t"
1642 "psrlw $8, %%mm3 \n\t"
1643 "packuswb %%mm1, %%mm0 \n\t"
1644 "packuswb %%mm3, %%mm2 \n\t"
1645 "movq %%mm0, (%3, %%"REG_a") \n\t"
1646 "movq %%mm2, (%4, %%"REG_a") \n\t"
1647 "add $8, %%"REG_a" \n\t"
1648 " js 1b \n\t"
1649 : : "g" ((x86_reg)-width), "r" (src1+width*2), "r" (src2+width*2), "r" (dstU+width), "r" (dstV+width)
1650 : "%"REG_a
1651 );
1652}
1653
1654/* This is almost identical to the previous, end exists only because1628/* This is almost identical to the previous, end exists only because
1655 * yuy2ToY/UV)(dst, src+1, ...) would have 100% unaligned accesses. */1629 * yuy2ToY/UV)(dst, src+1, ...) would have 100% unaligned accesses. */
1656static void RENAME(uyvyToY)(uint8_t *dst, const uint8_t *src,1630static void RENAME(uyvyToY)(uint8_t *dst, const uint8_t *src,
@@ -1700,33 +1674,6 @@ static void RENAME(uyvyToUV)(uint8_t *dstU, uint8_t *dstV, · 43 unmodified lines
1700 assert(src1 == src2);1674 assert(src1 == src2);
1701}1675}
1702 1676
1703static void RENAME(BEToUV)(uint8_t *dstU, uint8_t *dstV,
1704 const uint8_t *src1, const uint8_t *src2,
1705 int width, uint32_t *unused)
1706{
1707 __asm__ volatile(
1708 "movq "MANGLE(bm01010101)", %%mm4 \n\t"
1709 "mov %0, %%"REG_a" \n\t"
1710 "1: \n\t"
1711 "movq (%1, %%"REG_a",2), %%mm0 \n\t"
1712 "movq 8(%1, %%"REG_a",2), %%mm1 \n\t"
1713 "movq (%2, %%"REG_a",2), %%mm2 \n\t"
1714 "movq 8(%2, %%"REG_a",2), %%mm3 \n\t"
1715 "pand %%mm4, %%mm0 \n\t"
1716 "pand %%mm4, %%mm1 \n\t"
1717 "pand %%mm4, %%mm2 \n\t"
1718 "pand %%mm4, %%mm3 \n\t"
1719 "packuswb %%mm1, %%mm0 \n\t"
1720 "packuswb %%mm3, %%mm2 \n\t"
1721 "movq %%mm0, (%3, %%"REG_a") \n\t"
1722 "movq %%mm2, (%4, %%"REG_a") \n\t"
1723 "add $8, %%"REG_a" \n\t"
1724 " js 1b \n\t"
1725 : : "g" ((x86_reg)-width), "r" (src1+width*2), "r" (src2+width*2), "r" (dstU+width), "r" (dstV+width)
1726 : "%"REG_a
1727 );
1728}
1729
1730static av_always_inline void RENAME(nvXXtoUV)(uint8_t *dst1, uint8_t *dst2,1677static av_always_inline void RENAME(nvXXtoUV)(uint8_t *dst1, uint8_t *dst2,
1731 const uint8_t *src, int width)1678 const uint8_t *src, int width)
1732{1679{
@@ -2268,6 +2215,7 @@ static av_cold void RENAME(sws_init_swScale)(SwsContext *c) · 535 unmodified lines
2268 }2215 }
2269 }2216 }
2270 2217
2218 if (c->scalingBpp == 8) {
2271#if !COMPILE_TEMPLATE_MMX22219#if !COMPILE_TEMPLATE_MMX2
2272 c->hScale = RENAME(hScale );2220 c->hScale = RENAME(hScale );
2273#endif /* !COMPILE_TEMPLATE_MMX2 */2221#endif /* !COMPILE_TEMPLATE_MMX2 */
@@ -2285,6 +2233,7 @@ static av_cold void RENAME(sws_init_swScale)(SwsContext *c) · 11 unmodified lines
2285#if COMPILE_TEMPLATE_MMX22233#if COMPILE_TEMPLATE_MMX2
2286 }2234 }
2287#endif /* COMPILE_TEMPLATE_MMX2 */2235#endif /* COMPILE_TEMPLATE_MMX2 */
2236 }
2288 2237
2289#if !COMPILE_TEMPLATE_MMX22238#if !COMPILE_TEMPLATE_MMX2
2290 switch(srcFormat) {2239 switch(srcFormat) {
@@ -2292,12 +2241,6 @@ static av_cold void RENAME(sws_init_swScale)(SwsContext *c) · 1 unmodified line
2292 case PIX_FMT_UYVY422 : c->chrToYV12 = RENAME(uyvyToUV); break;2241 case PIX_FMT_UYVY422 : c->chrToYV12 = RENAME(uyvyToUV); break;
2293 case PIX_FMT_NV12 : c->chrToYV12 = RENAME(nv12ToUV); break;2242 case PIX_FMT_NV12 : c->chrToYV12 = RENAME(nv12ToUV); break;
2294 case PIX_FMT_NV21 : c->chrToYV12 = RENAME(nv21ToUV); break;2243 case PIX_FMT_NV21 : c->chrToYV12 = RENAME(nv21ToUV); break;
2295 case PIX_FMT_YUV420P16BE:
2296 case PIX_FMT_YUV422P16BE:
2297 case PIX_FMT_YUV444P16BE: c->chrToYV12 = RENAME(BEToUV); break;
2298 case PIX_FMT_YUV420P16LE:
2299 case PIX_FMT_YUV422P16LE:
2300 case PIX_FMT_YUV444P16LE: c->chrToYV12 = RENAME(LEToUV); break;
2301 default: break;2244 default: break;
2302 }2245 }
2303#endif /* !COMPILE_TEMPLATE_MMX2 */2246#endif /* !COMPILE_TEMPLATE_MMX2 */
@@ -2312,16 +2255,8 @@ static av_cold void RENAME(sws_init_swScale)(SwsContext *c) · 8 unmodified lines
2312 switch (srcFormat) {2255 switch (srcFormat) {
2313#if !COMPILE_TEMPLATE_MMX22256#if !COMPILE_TEMPLATE_MMX2
2314 case PIX_FMT_YUYV422 :2257 case PIX_FMT_YUYV422 :
2315 case PIX_FMT_YUV420P16BE:2258 case PIX_FMT_Y400A : c->lumToYV12 = RENAME(yuy2ToY); break;
2316 case PIX_FMT_YUV422P16BE:2259 case PIX_FMT_UYVY422 : c->lumToYV12 = RENAME(uyvyToY); break;
2317 case PIX_FMT_YUV444P16BE:
2318 case PIX_FMT_Y400A :
2319 case PIX_FMT_GRAY16BE : c->lumToYV12 = RENAME(yuy2ToY); break;
2320 case PIX_FMT_UYVY422 :
2321 case PIX_FMT_YUV420P16LE:
2322 case PIX_FMT_YUV422P16LE:
2323 case PIX_FMT_YUV444P16LE:
2324 case PIX_FMT_GRAY16LE : c->lumToYV12 = RENAME(uyvyToY); break;
2325#endif /* !COMPILE_TEMPLATE_MMX2 */2260#endif /* !COMPILE_TEMPLATE_MMX2 */
2326 case PIX_FMT_BGR24 : c->lumToYV12 = RENAME(bgr24ToY); break;2261 case PIX_FMT_BGR24 : c->lumToYV12 = RENAME(bgr24ToY); break;
2327 case PIX_FMT_RGB24 : c->lumToYV12 = RENAME(rgb24ToY); break;2262 case PIX_FMT_RGB24 : c->lumToYV12 = RENAME(rgb24ToY); break;
tests/ref/lavfi/pixdesc+8−8
@@ -1,8 +1,8 @@
1abgr 037bf9df6a765520ad6d490066bf4b891abgr 037bf9df6a765520ad6d490066bf4b89
2argb c442a8261c2265a07212ef0f72e35f5a2argb c442a8261c2265a07212ef0f72e35f5a
3bgr24 0d0cb38ab3fa0b2ec0865c14f78b217b3bgr24 0d0cb38ab3fa0b2ec0865c14f78b217b
4bgr48be 4ba0ff7fc9e011ea264610ad1585bb1f4bgr48be 74dedaaacae8fd1ef46e05f78cf29d62
5bgr48le d022bfdd6a07d5dcc693799322a386b45bgr48le 0eb7d30801eac6058814bddd330b3c76
6bgr4_byte 50d23cc82d9dcef2fd12adb81fb9b8066bgr4_byte 50d23cc82d9dcef2fd12adb81fb9b806
7bgr555be 49f01b1f1f0c84fd9e776dd34cc3c2807bgr555be 49f01b1f1f0c84fd9e776dd34cc3c280
8bgr555le 378d6ac4223651a1adcbf94a3d0d807b8bgr555le 378d6ac4223651a1adcbf94a3d0d807b
@@ -18,8 +18,8 @@ monow 9251497f3b0634f1165d12d5a289d943 · 9 unmodified lines
18nv12 e0af357888584d36eec5aa0f673793ef18nv12 e0af357888584d36eec5aa0f673793ef
19nv21 9a3297f3b34baa038b1f37cb202b512f19nv21 9a3297f3b34baa038b1f37cb202b512f
20rgb24 b41eba9651e1b5fe386289b50618810520rgb24 b41eba9651e1b5fe386289b506188105
21rgb48be 460b6de89b156290a12d3941db8bd73121rgb48be e3bc84c9af376fb6d0f0293cc7b713a6
22rgb48le cd93cb34d15996987367dabda3a1012822rgb48le f51c0e71638a822458329abb2f4052c7
23rgb4_byte c93ba89b74c504e7f5ae9d9ab1546c7323rgb4_byte c93ba89b74c504e7f5ae9d9ab1546c73
24rgb555be 912a62c5e53bfcbac2a0340e10973cf224rgb555be 912a62c5e53bfcbac2a0340e10973cf2
25rgb555le a937a0fc764fb57dc1b3af87cba0273c25rgb555le a937a0fc764fb57dc1b3af87cba0273c
@@ -38,12 +38,12 @@ yuv420p16le 2d59c4f1d0314a5a957a7cfc4b6fabcc · 12 unmodified lines
38yuv420p9be ce880fa07830e5297c22acf6e20555ce38yuv420p9be ce880fa07830e5297c22acf6e20555ce
39yuv420p9le 16543fda8f87d94a6cf857d2e8d4461a39yuv420p9le 16543fda8f87d94a6cf857d2e8d4461a
40yuv422p c9bba4529821d796a6ab09f6a5fd355a40yuv422p c9bba4529821d796a6ab09f6a5fd355a
41yuv422p16be 5499502e1c29534a158a1fe60e889f6041yuv422p16be 86ad3447f97969ce095afeef81fa9abf
42yuv422p16le e3d61fde6978591596bc36b91438662342yuv422p16le a53a9b451f4a81eeae33362c1bbd07f8
43yuv440p 5a064afe2b453bb52cdb3f176b1aa1cf43yuv440p 5a064afe2b453bb52cdb3f176b1aa1cf
44yuv444p 0a98447b78fd476aa39686da6a74fa2e44yuv444p 0a98447b78fd476aa39686da6a74fa2e
45yuv444p16be ea602a24b8e6969679265078bd8607b645yuv444p16be 95db370ae765dd3d10b7def14704ae73
46yuv444p16le 1262a0dc57ee147967fc896d0420631346yuv444p16le 36b969179b5ad9d312a0d1e1cd6bc402
47yuva420p a29884f3f3dfe1e00b961bc17bef3d4747yuva420p a29884f3f3dfe1e00b961bc17bef3d47
48yuvj420p 32eec78ba51857b16ce9b813a49b718948yuvj420p 32eec78ba51857b16ce9b813a49b7189
49yuvj422p 0dfa0ed434f73be51428758c69e082cb49yuvj422p 0dfa0ed434f73be51428758c69e082cb
tests/ref/lavfi/pixfmts_copy+8−8
@@ -1,8 +1,8 @@
1abgr 037bf9df6a765520ad6d490066bf4b891abgr 037bf9df6a765520ad6d490066bf4b89
2argb c442a8261c2265a07212ef0f72e35f5a2argb c442a8261c2265a07212ef0f72e35f5a
3bgr24 0d0cb38ab3fa0b2ec0865c14f78b217b3bgr24 0d0cb38ab3fa0b2ec0865c14f78b217b
4bgr48be 4ba0ff7fc9e011ea264610ad1585bb1f4bgr48be 74dedaaacae8fd1ef46e05f78cf29d62
5bgr48le d022bfdd6a07d5dcc693799322a386b45bgr48le 0eb7d30801eac6058814bddd330b3c76
6bgr4_byte 50d23cc82d9dcef2fd12adb81fb9b8066bgr4_byte 50d23cc82d9dcef2fd12adb81fb9b806
7bgr555be 49f01b1f1f0c84fd9e776dd34cc3c2807bgr555be 49f01b1f1f0c84fd9e776dd34cc3c280
8bgr555le 378d6ac4223651a1adcbf94a3d0d807b8bgr555le 378d6ac4223651a1adcbf94a3d0d807b
@@ -18,8 +18,8 @@ monow 9251497f3b0634f1165d12d5a289d943 · 9 unmodified lines
18nv12 e0af357888584d36eec5aa0f673793ef18nv12 e0af357888584d36eec5aa0f673793ef
19nv21 9a3297f3b34baa038b1f37cb202b512f19nv21 9a3297f3b34baa038b1f37cb202b512f
20rgb24 b41eba9651e1b5fe386289b50618810520rgb24 b41eba9651e1b5fe386289b506188105
21rgb48be 460b6de89b156290a12d3941db8bd73121rgb48be e3bc84c9af376fb6d0f0293cc7b713a6
22rgb48le cd93cb34d15996987367dabda3a1012822rgb48le f51c0e71638a822458329abb2f4052c7
23rgb4_byte c93ba89b74c504e7f5ae9d9ab1546c7323rgb4_byte c93ba89b74c504e7f5ae9d9ab1546c73
24rgb555be 912a62c5e53bfcbac2a0340e10973cf224rgb555be 912a62c5e53bfcbac2a0340e10973cf2
25rgb555le a937a0fc764fb57dc1b3af87cba0273c25rgb555le a937a0fc764fb57dc1b3af87cba0273c
@@ -38,12 +38,12 @@ yuv420p16le 2d59c4f1d0314a5a957a7cfc4b6fabcc · 12 unmodified lines
38yuv420p9be ce880fa07830e5297c22acf6e20555ce38yuv420p9be ce880fa07830e5297c22acf6e20555ce
39yuv420p9le 16543fda8f87d94a6cf857d2e8d4461a39yuv420p9le 16543fda8f87d94a6cf857d2e8d4461a
40yuv422p c9bba4529821d796a6ab09f6a5fd355a40yuv422p c9bba4529821d796a6ab09f6a5fd355a
41yuv422p16be 5499502e1c29534a158a1fe60e889f6041yuv422p16be 86ad3447f97969ce095afeef81fa9abf
42yuv422p16le e3d61fde6978591596bc36b91438662342yuv422p16le a53a9b451f4a81eeae33362c1bbd07f8
43yuv440p 5a064afe2b453bb52cdb3f176b1aa1cf43yuv440p 5a064afe2b453bb52cdb3f176b1aa1cf
44yuv444p 0a98447b78fd476aa39686da6a74fa2e44yuv444p 0a98447b78fd476aa39686da6a74fa2e
45yuv444p16be ea602a24b8e6969679265078bd8607b645yuv444p16be 95db370ae765dd3d10b7def14704ae73
46yuv444p16le 1262a0dc57ee147967fc896d0420631346yuv444p16le 36b969179b5ad9d312a0d1e1cd6bc402
47yuva420p a29884f3f3dfe1e00b961bc17bef3d4747yuva420p a29884f3f3dfe1e00b961bc17bef3d47
48yuvj420p 32eec78ba51857b16ce9b813a49b718948yuvj420p 32eec78ba51857b16ce9b813a49b7189
49yuvj422p 0dfa0ed434f73be51428758c69e082cb49yuvj422p 0dfa0ed434f73be51428758c69e082cb
tests/ref/lavfi/pixfmts_crop+8−8
@@ -1,8 +1,8 @@
1abgr cd761690872843d1b7ab0c695393c7511abgr cd761690872843d1b7ab0c695393c751
2argb 2ec6ef18769bcd651c2e8904d5a3ee672argb 2ec6ef18769bcd651c2e8904d5a3ee67
3bgr24 3450fd00cf1493d1ded75544d82ba3ec3bgr24 3450fd00cf1493d1ded75544d82ba3ec
4bgr48be 90cb5d373a1123432d63c6a10c101afa4bgr48be a9a7d177cef0914d3f1d266f00dff676
5bgr48le 9371f54ceda9010f1199e86f4930ac3f5bgr48le b475d1b529ed80c728ddbacd22d35281
6bgr4_byte 2f6ac3cdd4676ab4e2982bdf0664945b6bgr4_byte 2f6ac3cdd4676ab4e2982bdf0664945b
7bgr555be d3a7c273604723adeb7e5f5dd1c4272b7bgr555be d3a7c273604723adeb7e5f5dd1c4272b
8bgr555le d22442fc13b464f9ba455b08df4e981f8bgr555le d22442fc13b464f9ba455b08df4e981f
@@ -14,8 +14,8 @@ gray 8c4850e66562a587a292dc728a65ea4a · 5 unmodified lines
14gray16be daa5a6b98fb4a280c57c57bff1a2ab5a14gray16be daa5a6b98fb4a280c57c57bff1a2ab5a
15gray16le 84f5ea7259073edcb893113b42213c8e15gray16le 84f5ea7259073edcb893113b42213c8e
16rgb24 3b90ed64b687d3dc186c6ef521dc71a816rgb24 3b90ed64b687d3dc186c6ef521dc71a8
17rgb48be a808128041a1962deaa8620c7448feba17rgb48be b8f9fd6aaa24d75275ee2f8b8a7b9e55
18rgb48le ce92d02cc322608d5be377cb1940677b18rgb48le 3e52e831a040f086c3ae983241172cce
19rgb4_byte 6958029f73c6cdfed4f71020d816f02719rgb4_byte 6958029f73c6cdfed4f71020d816f027
20rgb555be 41a7d1836837bc90f2cae19a9c9df3b320rgb555be 41a7d1836837bc90f2cae19a9c9df3b3
21rgb555le eeb78f8ce6186fba55c941469e60ba6721rgb555le eeb78f8ce6186fba55c941469e60ba67
@@ -29,12 +29,12 @@ yuv420p bfea0188ddd4889787c403caae119cc7 · 7 unmodified lines
29yuv420p16be 8365eff38b8c329aeb95fc605fa229bb29yuv420p16be 8365eff38b8c329aeb95fc605fa229bb
30yuv420p16le 5e8dd38d973d5854abe1ad4efad20cc130yuv420p16le 5e8dd38d973d5854abe1ad4efad20cc1
31yuv422p f2f930a91fe00d4252c4720b5ecd896131yuv422p f2f930a91fe00d4252c4720b5ecd8961
32yuv422p16be 167e4338811a7d272925a4c6417d60da32yuv422p16be 6647fe1c381c148f8207c988c0e22bf0
33yuv422p16le 3359395d5875d581fa1e975013d3011433yuv422p16le e1548c9dc51202db38a9625c8954203f
34yuv440p 2472417d980e395ad6843cbb8b633b2934yuv440p 2472417d980e395ad6843cbb8b633b29
35yuv444p 1f151980486848c96bc5585ced99003e35yuv444p 1f151980486848c96bc5585ced99003e
36yuv444p16be d69280c2856865d2ea94bd5292aac1c636yuv444p16be ac3b159f8c858fcdf475a8c024ee79b6
37yuv444p16le 33f43e030bedf9723be4f63c3e9fc80e37yuv444p16le 9a6863bfc5faee206065c11dc994bf0c
38yuva420p 7536753dfbc7932560fb50c921369a0e38yuva420p 7536753dfbc7932560fb50c921369a0e
39yuvj420p 21f891093006d42d7683b0e1d773a65739yuvj420p 21f891093006d42d7683b0e1d773a657
40yuvj422p 9a43d474c407590ad8f213880586b45e40yuvj422p 9a43d474c407590ad8f213880586b45e
tests/ref/lavfi/pixfmts_hflip+8−8
@@ -1,8 +1,8 @@
1abgr 49468c6c9ceee5d52b08b1270a9093231abgr 49468c6c9ceee5d52b08b1270a909323
2argb 50ba9f16c6475530602f2983278b82d02argb 50ba9f16c6475530602f2983278b82d0
3bgr24 cc53d2011d097972db0d22756c3699e33bgr24 cc53d2011d097972db0d22756c3699e3
4bgr48be 11641cf0f4516a9aed98f7872720f8014bgr48be 90374bc92471f1bd4931d71ef8b73f50
5bgr48le b5440734eed128554dd9f83b34ba582f5bgr48le 696f628d0dd32121e60a0d61ac47d6e6
6bgr4_byte aac987e7d1a6a96477cfc0b48a4285de6bgr4_byte aac987e7d1a6a96477cfc0b48a4285de
7bgr555be bc07265898440116772200390d70c0927bgr555be bc07265898440116772200390d70c092
8bgr555le ccee08679bac84a1f960c6c9070c55388bgr555le ccee08679bac84a1f960c6c9070c5538
@@ -14,8 +14,8 @@ gray 03efcb4ab52a24c0af0e03cfd26c9377 · 5 unmodified lines
14gray16be 9bcbca979601ddc4869f846f08f3d1dd14gray16be 9bcbca979601ddc4869f846f08f3d1dd
15gray16le c1b8965adcc7f847ee343149ff50707315gray16le c1b8965adcc7f847ee343149ff507073
16rgb24 754f1722fc738590cc407ac65749bfe816rgb24 754f1722fc738590cc407ac65749bfe8
17rgb48be 10743e1577dc3198dbbc7c0b3b8f429e17rgb48be 2397b9d3c296ac15f8a2325a703f81c7
18rgb48le dd945a44f39119221407bf7a04f1bc4918rgb48le 527043c72546d8b4bb1ce2dea4b294c3
19rgb4_byte c8a3f995fcf3e0919239ea2c413ddc2919rgb4_byte c8a3f995fcf3e0919239ea2c413ddc29
20rgb555be 045ce8607d3910586f4d97481dda863220rgb555be 045ce8607d3910586f4d97481dda8632
21rgb555le 8778ee0cf58ce9ad1d99a1eca9f95e8721rgb555le 8778ee0cf58ce9ad1d99a1eca9f95e87
@@ -29,12 +29,12 @@ yuv420p 2d5c80f9ba2ddd85b2aeda3564cc7d64 · 7 unmodified lines
29yuv420p16be 758b0c1e2113b15e7afde48da4e4d02429yuv420p16be 758b0c1e2113b15e7afde48da4e4d024
30yuv420p16le 480ccd951dcb806bc875d307e02e50a030yuv420p16le 480ccd951dcb806bc875d307e02e50a0
31yuv422p 6e728f4eb9eae287c224f396d84be6ea31yuv422p 6e728f4eb9eae287c224f396d84be6ea
32yuv422p16be a05d43cd62b790087bd37083174557de32yuv422p16be 9dbe0af0eb877987611cf04bfa577202
33yuv422p16le 6954abebcbc62d81068d58d0c62bdd5b33yuv422p16le 2d8f37231110177cc5e1b61c8cb4b163
34yuv440p a99e2b57ed601f39852715c9d675d0d334yuv440p a99e2b57ed601f39852715c9d675d0d3
35yuv444p 947e47f7bb5fdccc659d19b7df2b6fc335yuv444p 947e47f7bb5fdccc659d19b7df2b6fc3
36yuv444p16be e5ef45bc3d2f5b0b2542d5151340c38236yuv444p16be debc96a7ec4fec0a412f9d8995bc48a2
37yuv444p16le 70793e3d66d0c23a0cdedabe9c24c2a737yuv444p16le 5b5e1348a631fc2206bb7ff851a52687
38yuva420p d83ec0c01498189f179ec574918185f138yuva420p d83ec0c01498189f179ec574918185f1
39yuvj420p df3aaaec3bb157c3bde5f0365af30f4f39yuvj420p df3aaaec3bb157c3bde5f0365af30f4f
40yuvj422p d113871528d510a192797af59df9c05c40yuvj422p d113871528d510a192797af59df9c05c
tests/ref/lavfi/pixfmts_null+8−8
@@ -1,8 +1,8 @@
1abgr 037bf9df6a765520ad6d490066bf4b891abgr 037bf9df6a765520ad6d490066bf4b89
2argb c442a8261c2265a07212ef0f72e35f5a2argb c442a8261c2265a07212ef0f72e35f5a
3bgr24 0d0cb38ab3fa0b2ec0865c14f78b217b3bgr24 0d0cb38ab3fa0b2ec0865c14f78b217b
4bgr48be 4ba0ff7fc9e011ea264610ad1585bb1f4bgr48be 74dedaaacae8fd1ef46e05f78cf29d62
5bgr48le d022bfdd6a07d5dcc693799322a386b45bgr48le 0eb7d30801eac6058814bddd330b3c76
6bgr4_byte 50d23cc82d9dcef2fd12adb81fb9b8066bgr4_byte 50d23cc82d9dcef2fd12adb81fb9b806
7bgr555be 49f01b1f1f0c84fd9e776dd34cc3c2807bgr555be 49f01b1f1f0c84fd9e776dd34cc3c280
8bgr555le 378d6ac4223651a1adcbf94a3d0d807b8bgr555le 378d6ac4223651a1adcbf94a3d0d807b
@@ -18,8 +18,8 @@ monow 9251497f3b0634f1165d12d5a289d943 · 9 unmodified lines
18nv12 e0af357888584d36eec5aa0f673793ef18nv12 e0af357888584d36eec5aa0f673793ef
19nv21 9a3297f3b34baa038b1f37cb202b512f19nv21 9a3297f3b34baa038b1f37cb202b512f
20rgb24 b41eba9651e1b5fe386289b50618810520rgb24 b41eba9651e1b5fe386289b506188105
21rgb48be 460b6de89b156290a12d3941db8bd73121rgb48be e3bc84c9af376fb6d0f0293cc7b713a6
22rgb48le cd93cb34d15996987367dabda3a1012822rgb48le f51c0e71638a822458329abb2f4052c7
23rgb4_byte c93ba89b74c504e7f5ae9d9ab1546c7323rgb4_byte c93ba89b74c504e7f5ae9d9ab1546c73
24rgb555be 912a62c5e53bfcbac2a0340e10973cf224rgb555be 912a62c5e53bfcbac2a0340e10973cf2
25rgb555le a937a0fc764fb57dc1b3af87cba0273c25rgb555le a937a0fc764fb57dc1b3af87cba0273c
@@ -38,12 +38,12 @@ yuv420p16le 2d59c4f1d0314a5a957a7cfc4b6fabcc · 12 unmodified lines
38yuv420p9be ce880fa07830e5297c22acf6e20555ce38yuv420p9be ce880fa07830e5297c22acf6e20555ce
39yuv420p9le 16543fda8f87d94a6cf857d2e8d4461a39yuv420p9le 16543fda8f87d94a6cf857d2e8d4461a
40yuv422p c9bba4529821d796a6ab09f6a5fd355a40yuv422p c9bba4529821d796a6ab09f6a5fd355a
41yuv422p16be 5499502e1c29534a158a1fe60e889f6041yuv422p16be 86ad3447f97969ce095afeef81fa9abf
42yuv422p16le e3d61fde6978591596bc36b91438662342yuv422p16le a53a9b451f4a81eeae33362c1bbd07f8
43yuv440p 5a064afe2b453bb52cdb3f176b1aa1cf43yuv440p 5a064afe2b453bb52cdb3f176b1aa1cf
44yuv444p 0a98447b78fd476aa39686da6a74fa2e44yuv444p 0a98447b78fd476aa39686da6a74fa2e
45yuv444p16be ea602a24b8e6969679265078bd8607b645yuv444p16be 95db370ae765dd3d10b7def14704ae73
46yuv444p16le 1262a0dc57ee147967fc896d0420631346yuv444p16le 36b969179b5ad9d312a0d1e1cd6bc402
47yuva420p a29884f3f3dfe1e00b961bc17bef3d4747yuva420p a29884f3f3dfe1e00b961bc17bef3d47
48yuvj420p 32eec78ba51857b16ce9b813a49b718948yuvj420p 32eec78ba51857b16ce9b813a49b7189
49yuvj422p 0dfa0ed434f73be51428758c69e082cb49yuvj422p 0dfa0ed434f73be51428758c69e082cb
tests/ref/lavfi/pixfmts_scale+16−16
@@ -1,8 +1,8 @@
1abgr d894cb97f6c80eb21bdbe8a4eea62d861abgr d894cb97f6c80eb21bdbe8a4eea62d86
2argb 54346f2b2eef10919e0f247241df3b242argb 54346f2b2eef10919e0f247241df3b24
3bgr24 570f8d6b51a838aed022ef67535f6bdc3bgr24 570f8d6b51a838aed022ef67535f6bdc
4bgr48be fcc0f2dbf45d325f84f816c74cbeeebe4bgr48be 07f7a0cc34feb3646434d47c0cec8cee
5bgr48le 3f9c2b23eed3b8d196d1c14b38ce50f55bgr48le 9abd2c3a66088e6c9078232064eba61e
6bgr4_byte ee1d35a7baf8e9016891929a2f565c0b6bgr4_byte ee1d35a7baf8e9016891929a2f565c0b
7bgr555be de8901c1358834fddea060fcb3a67beb7bgr555be de8901c1358834fddea060fcb3a67beb
8bgr555le 36b745067197f9ca8c1731cac51329c98bgr555le 36b745067197f9ca8c1731cac51329c9
@@ -11,15 +11,15 @@ bgr565le 3a514a298c6161a071ddf9963c06509d · 2 unmodified lines
11bgr8 7f007fa6c153a16e808a9c51605a401611bgr8 7f007fa6c153a16e808a9c51605a4016
12bgra a5e7040f9a80cccd65e5acf2ca09ace512bgra a5e7040f9a80cccd65e5acf2ca09ace5
13gray d7786a7d9d99ac74230cc045cab5632c13gray d7786a7d9d99ac74230cc045cab5632c
14gray16be af39ce3a497f6734b157c8b94544f53714gray16be bba98532da29a31599df2feec3b08e3e
15gray16le 7ac1b788bcc472010df7a97e762485e015gray16le 30267f127d5734c4767f3944f1729a33
16monob 88c4c050758e64d120f50c7eff69438116monob 88c4c050758e64d120f50c7eff694381
17monow d31772ebaa877fc2a78565937f7f967317monow d31772ebaa877fc2a78565937f7f9673
18nv12 4676d59db43d657dc12841f6bc3ab45218nv12 4676d59db43d657dc12841f6bc3ab452
19nv21 69c699510ff1fb777b118ebee1002f1419nv21 69c699510ff1fb777b118ebee1002f14
20rgb24 514692e28e8ff6860e415ce4fcf6eb8c20rgb24 514692e28e8ff6860e415ce4fcf6eb8c
21rgb48be 1894cd30dabcd3180518e4d5f09f25e721rgb48be f18841c19fc6d9c817a3095f557b9bc5
22rgb48le 1354e6e27ce3c1d4d4989ee56030c94b22rgb48le 819e7b8acd8965ba57ba46198a5cc9bf
23rgb4_byte d81ffd3add95842a618eec81024f0b5c23rgb4_byte d81ffd3add95842a618eec81024f0b5c
24rgb555be 4607309f9f217d51cbb53d13b84b453724rgb555be 4607309f9f217d51cbb53d13b84b4537
25rgb555le a350ef1dc2c9688ed49e7ba01884379525rgb555le a350ef1dc2c9688ed49e7ba018843795
@@ -31,19 +31,19 @@ uyvy422 314bd486277111a95d9369b944fa0400 · 5 unmodified lines
31yuv410p 7df8f6d69b56a8dcb6c7ee908e5018b531yuv410p 7df8f6d69b56a8dcb6c7ee908e5018b5
32yuv411p 1143e7c5cc28fe0922b051b17733bc4c32yuv411p 1143e7c5cc28fe0922b051b17733bc4c
33yuv420p fdad2d8df8985e3d17e73c71f713cb1433yuv420p fdad2d8df8985e3d17e73c71f713cb14
34yuv420p10be 6d335e75b553da590135cf8bb999610c34yuv420p10be 8b5ad855229840a8fa87786cab83f856
35yuv420p10le d510ddbabefd03ef39ec943fcb51b70935yuv420p10le 5264e87921d47b17411578d9c92672b1
36yuv420p16be 29a0265764530070f5cd3251cc01f66a36yuv420p16be f6ef3ba90f238b467c7e72ade927083d
37yuv420p16le 6f3a265b084a78baec229238d9f7945f37yuv420p16le faf6aab3b1c16e8afbe160686dd360e0
38yuv420p9be ec4983b7a949c0472110a7a2c58e278a38yuv420p9be c14bf746d161face61e1f39b491bf7ef
39yuv420p9le c136dce5913a722eee44ab72cff664b239yuv420p9le 59457f9a51768bf1d4342238d50a9be3
40yuv422p 918e37701ee7377d16a8a6c119c56a4040yuv422p 918e37701ee7377d16a8a6c119c56a40
41yuv422p16be ef3e865fc1d0c68977c735323c50af6e41yuv422p16be 837945d3a771366a5a72a4ed095a4f53
42yuv422p16le 428a9b96214c09cb5a983ce36d6961ff42yuv422p16le b8292ae9b52eb7afc3d8b93e8fd895b4
43yuv440p 461503fdb9b90451020aa3b25ddf041c43yuv440p 461503fdb9b90451020aa3b25ddf041c
44yuv444p 81b2eba962d12e8d64f003ac56f6faf244yuv444p 81b2eba962d12e8d64f003ac56f6faf2
45yuv444p16be 99a3738c70c8fbdc5a0e4ad4bf50648d45yuv444p16be cc7460f76477aa4b4c33442f67c06a89
46yuv444p16le 385d0cc5240d62da0871915be5d86f0a46yuv444p16le 9a5ed60d68c0a4a5155f9d376174cdf7
47yuva420p 8673a9131fb47de69788863f93a50eb747yuva420p 8673a9131fb47de69788863f93a50eb7
48yuvj420p 30427bd6caf5bda93a173dbebe759e0948yuvj420p 30427bd6caf5bda93a173dbebe759e09
49yuvj422p fc8288f64fd149573f73cf8da05d8e6d49yuvj422p fc8288f64fd149573f73cf8da05d8e6d
tests/ref/lavfi/pixfmts_vflip+8−8
@@ -1,8 +1,8 @@
1abgr 25e72e9dbd01ab00727c976d577f7be51abgr 25e72e9dbd01ab00727c976d577f7be5
2argb 19869bf1a5ac0b6af4d8bbe2c104533c2argb 19869bf1a5ac0b6af4d8bbe2c104533c
3bgr24 89108a4ba00201f79b75b9305c42352d3bgr24 89108a4ba00201f79b75b9305c42352d
4bgr48be ed82382da09b64a8e04728fcf76e68144bgr48be 908b4edb525fd154a95a3744c4ab5420
5bgr48le 0f1f135608c2ff24d26d03e939fc21125bgr48le 796c2072d6fa13a091f5c5b175417ed5
6bgr4_byte 407fcf564ed764c38e1d748f700ab9216bgr4_byte 407fcf564ed764c38e1d748f700ab921
7bgr555be f739d2519f7e9d494359bf67a38215377bgr555be f739d2519f7e9d494359bf67a3821537
8bgr555le bd7b3ec4d684dfad075d89a606cb8b748bgr555le bd7b3ec4d684dfad075d89a606cb8b74
@@ -18,8 +18,8 @@ monow ff9869d067ecb94eb9d90c9750c31fea · 9 unmodified lines
18nv12 046f00f598ce14d9854a3534a5c9911418nv12 046f00f598ce14d9854a3534a5c99114
19nv21 01ea369dd2d0d3ed7451dc5c8d61497f19nv21 01ea369dd2d0d3ed7451dc5c8d61497f
20rgb24 eaefabc168d0b14576bab45bc1e56e1e20rgb24 eaefabc168d0b14576bab45bc1e56e1e
21rgb48be 4e0c384163ebab06a08e74637beb02bc21rgb48be 8e347deca2902e7dc1ece261322577d8
22rgb48le a77bfeefcd96750cf0e1917a2e2bf1e722rgb48le 2034e485f946e4064b5fb9be09865e55
23rgb4_byte 8c6ff02df0b06dd2d574836c3741b2a223rgb4_byte 8c6ff02df0b06dd2d574836c3741b2a2
24rgb555be 40dc33cfb5cf56aac1c5a290ac486c3624rgb555be 40dc33cfb5cf56aac1c5a290ac486c36
25rgb555le 4f8eaad29a17e0f8e9d8ab743e76b99925rgb555le 4f8eaad29a17e0f8e9d8ab743e76b999
@@ -38,12 +38,12 @@ yuv420p16le 0f609e588e5a258644ef85170d70e030 · 12 unmodified lines
38yuv420p9be be40ec975fb2873891643cbbbddbc3b038yuv420p9be be40ec975fb2873891643cbbbddbc3b0
39yuv420p9le 7e606310d3f5ff12badf911e8f33347139yuv420p9le 7e606310d3f5ff12badf911e8f333471
40yuv422p d7f5cb44d9b0210d66d6a8762640ab3440yuv422p d7f5cb44d9b0210d66d6a8762640ab34
41yuv422p16be 9bd8f8c961822b586fa4cf992be54acc41yuv422p16be 8cdfbddf2dd4c44c3efef4ee00170eba
42yuv422p16le 9c4a1239605c7952b736ac3130163f1442yuv422p16le a2f421f6a1af950544081c1797de01ae
43yuv440p 876385e96165acf51271b20e5d85a41643yuv440p 876385e96165acf51271b20e5d85a416
44yuv444p 9c3c667d1613b72d15bc6d851c5eb8f744yuv444p 9c3c667d1613b72d15bc6d851c5eb8f7
45yuv444p16be 0f4afa4a4aacf4bb6b87641abde71ea945yuv444p16be b092690d22f0b26360fbf5cfd739be17
46yuv444p16le 8f31557bc52adfe00ae8b40a9b8c23f846yuv444p16le 18768b4ddca92d06f9713fef467276a9
47yuva420p c705d1cf061d8c6580ac690b55f9227647yuva420p c705d1cf061d8c6580ac690b55f92276
48yuvj420p 41fd02b204da0ab62452cd14b595e2e448yuvj420p 41fd02b204da0ab62452cd14b595e2e4
49yuvj422p 7f6ca9bc1812cde02036d7d29a7cce4349yuvj422p 7f6ca9bc1812cde02036d7d29a7cce43

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t