Implemented for AV_PIX_FMT_GBRP12.
Unified · Split
| @@ -691,6 +691,16 @@ static void planar_rgb10be_to_y(uint8_t *dst, const uint8_t *src[4], int w) · 690 unmodified lines | ||
| 691 | 691 | planar_rgb16_to_y(dst, src, w, 10, 1); |
| 692 | 692 | } |
| 693 | 693 | |
| 694 | +static void planar_rgb12le_to_y(uint8_t *dst, const uint8_t *src[4], int w) | |
| 695 | +{ | |
| 696 | + planar_rgb16_to_y(dst, src, w, 12, 0); | |
| 697 | +} | |
| 698 | + | |
| 699 | +static void planar_rgb12be_to_y(uint8_t *dst, const uint8_t *src[4], int w) | |
| 700 | +{ | |
| 701 | + planar_rgb16_to_y(dst, src, w, 12, 1); | |
| 702 | +} | |
| 703 | + | |
| 694 | 704 | static void planar_rgb16le_to_y(uint8_t *dst, const uint8_t *src[4], int w) |
| 695 | 705 | { |
| 696 | 706 | planar_rgb16_to_y(dst, src, w, 16, 0); |
| @@ -744,6 +754,18 @@ static void planar_rgb10be_to_uv(uint8_t *dstU, uint8_t *dstV, · 47 unmodified lines | ||
| 744 | 754 | planar_rgb16_to_uv(dstU, dstV, src, w, 10, 1); |
| 745 | 755 | } |
| 746 | 756 | |
| 757 | +static void planar_rgb12le_to_uv(uint8_t *dstU, uint8_t *dstV, | |
| 758 | + const uint8_t *src[4], int w) | |
| 759 | +{ | |
| 760 | + planar_rgb16_to_uv(dstU, dstV, src, w, 12, 0); | |
| 761 | +} | |
| 762 | + | |
| 763 | +static void planar_rgb12be_to_uv(uint8_t *dstU, uint8_t *dstV, | |
| 764 | + const uint8_t *src[4], int w) | |
| 765 | +{ | |
| 766 | + planar_rgb16_to_uv(dstU, dstV, src, w, 12, 1); | |
| 767 | +} | |
| 768 | + | |
| 747 | 769 | static void planar_rgb16le_to_uv(uint8_t *dstU, uint8_t *dstV, |
| 748 | 770 | const uint8_t *src[4], int w) |
| 749 | 771 | { |
| @@ -790,6 +812,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) · 40 unmodified lines | ||
| 790 | 812 | case AV_PIX_FMT_GBRP10LE: |
| 791 | 813 | c->readChrPlanar = planar_rgb10le_to_uv; |
| 792 | 814 | break; |
| 815 | + case AV_PIX_FMT_GBRP12LE: | |
| 816 | + c->readChrPlanar = planar_rgb12le_to_uv; | |
| 817 | + break; | |
| 793 | 818 | case AV_PIX_FMT_GBRAP16LE: |
| 794 | 819 | case AV_PIX_FMT_GBRP16LE: |
| 795 | 820 | c->readChrPlanar = planar_rgb16le_to_uv; |
| @@ -800,6 +825,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) · 4 unmodified lines | ||
| 800 | 825 | case AV_PIX_FMT_GBRP10BE: |
| 801 | 826 | c->readChrPlanar = planar_rgb10be_to_uv; |
| 802 | 827 | break; |
| 828 | + case AV_PIX_FMT_GBRP12BE: | |
| 829 | + c->readChrPlanar = planar_rgb12be_to_uv; | |
| 830 | + break; | |
| 803 | 831 | case AV_PIX_FMT_GBRAP16BE: |
| 804 | 832 | case AV_PIX_FMT_GBRP16BE: |
| 805 | 833 | c->readChrPlanar = planar_rgb16be_to_uv; |
| @@ -1013,6 +1041,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) · 207 unmodified lines | ||
| 1013 | 1041 | case AV_PIX_FMT_GBRP10LE: |
| 1014 | 1042 | c->readLumPlanar = planar_rgb10le_to_y; |
| 1015 | 1043 | break; |
| 1044 | + case AV_PIX_FMT_GBRP12LE: | |
| 1045 | + c->readLumPlanar = planar_rgb12le_to_y; | |
| 1046 | + break; | |
| 1016 | 1047 | case AV_PIX_FMT_GBRAP16LE: |
| 1017 | 1048 | case AV_PIX_FMT_GBRP16LE: |
| 1018 | 1049 | c->readLumPlanar = planar_rgb16le_to_y; |
| @@ -1023,6 +1054,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) · 4 unmodified lines | ||
| 1023 | 1054 | case AV_PIX_FMT_GBRP10BE: |
| 1024 | 1055 | c->readLumPlanar = planar_rgb10be_to_y; |
| 1025 | 1056 | break; |
| 1057 | + case AV_PIX_FMT_GBRP12BE: | |
| 1058 | + c->readLumPlanar = planar_rgb12be_to_y; | |
| 1059 | + break; | |
| 1026 | 1060 | case AV_PIX_FMT_GBRAP16BE: |
| 1027 | 1061 | case AV_PIX_FMT_GBRP16BE: |
| 1028 | 1062 | c->readLumPlanar = planar_rgb16be_to_y; |
| @@ -295,7 +295,7 @@ av_cold void ff_sws_init_swscale_ppc(SwsContext *c) · 294 unmodified lines | ||
| 295 | 295 | if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC)) |
| 296 | 296 | return; |
| 297 | 297 | |
| 298 | − if (c->srcBpc == 8 && c->dstBpc <= 10) { | |
| 298 | + if (c->srcBpc == 8 && c->dstBpc <= 12) { | |
| 299 | 299 | c->hyScale = c->hcScale = hScale_altivec_real; |
| 300 | 300 | } |
| 301 | 301 | if (!is16BPS(dstFormat) && !is9_15BPS(dstFormat) && |
| @@ -184,6 +184,8 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = { · 183 unmodified lines | ||
| 184 | 184 | [AV_PIX_FMT_GBRP9BE] = { 1, 1 }, |
| 185 | 185 | [AV_PIX_FMT_GBRP10LE] = { 1, 1 }, |
| 186 | 186 | [AV_PIX_FMT_GBRP10BE] = { 1, 1 }, |
| 187 | + [AV_PIX_FMT_GBRP12LE] = { 1, 0 }, | |
| 188 | + [AV_PIX_FMT_GBRP12BE] = { 1, 0 }, | |
| 187 | 189 | [AV_PIX_FMT_GBRP16LE] = { 1, 0 }, |
| 188 | 190 | [AV_PIX_FMT_GBRP16BE] = { 1, 0 }, |
| 189 | 191 | [AV_PIX_FMT_GBRAP] = { 1, 1 }, |
| @@ -1015,6 +1017,7 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, · 825 unmodified lines | ||
| 1015 | 1017 | srcFormat != AV_PIX_FMT_RGB4_BYTE && srcFormat != AV_PIX_FMT_BGR4_BYTE && |
| 1016 | 1018 | srcFormat != AV_PIX_FMT_GBRP9BE && srcFormat != AV_PIX_FMT_GBRP9LE && |
| 1017 | 1019 | srcFormat != AV_PIX_FMT_GBRP10BE && srcFormat != AV_PIX_FMT_GBRP10LE && |
| 1020 | + srcFormat != AV_PIX_FMT_GBRP12BE && srcFormat != AV_PIX_FMT_GBRP12LE && | |
| 1018 | 1021 | srcFormat != AV_PIX_FMT_GBRP16BE && srcFormat != AV_PIX_FMT_GBRP16LE && |
| 1019 | 1022 | ((dstW >> c->chrDstHSubSample) <= (srcW >> 1) || |
| 1020 | 1023 | (flags & SWS_FAST_BILINEAR))) |
| @@ -1051,7 +1054,7 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, · 30 unmodified lines | ||
| 1051 | 1054 | FF_ALLOC_OR_GOTO(c, c->formatConvBuffer, |
| 1052 | 1055 | (FFALIGN(srcW, 16) * 2 * FFALIGN(c->srcBpc, 8) >> 3) + 16, |
| 1053 | 1056 | fail); |
| 1054 | − if (INLINE_MMXEXT(cpu_flags) && c->srcBpc == 8 && c->dstBpc <= 10) { | |
| 1057 | + if (INLINE_MMXEXT(cpu_flags) && c->srcBpc == 8 && c->dstBpc <= 12) { | |
| 1055 | 1058 | c->canMMXEXTBeUsed = (dstW >= srcW && (dstW & 31) == 0 && |
| 1056 | 1059 | (srcW & 15) == 0) ? 1 : 0; |
| 1057 | 1060 | if (!c->canMMXEXTBeUsed && dstW >= srcW && (srcW & 15) == 0 |
| @@ -324,6 +324,9 @@ av_cold void ff_sws_init_swscale_x86(SwsContext *c) · 323 unmodified lines | ||
| 324 | 324 | } else if (c->srcBpc == 10) { \ |
| 325 | 325 | hscalefn = c->dstBpc <= 15 ? ff_hscale10to15_ ## filtersize ## _ ## opt2 : \ |
| 326 | 326 | ff_hscale10to19_ ## filtersize ## _ ## opt1; \ |
| 327 | + } else if (c->srcBpc == 12) { \ | |
| 328 | + hscalefn = c->dstBpc <= 15 ? ff_hscale16to15_ ## filtersize ## _ ## opt2 : \ | |
| 329 | + ff_hscale16to19_ ## filtersize ## _ ## opt1; \ | |
| 327 | 330 | } else if (c->srcBpc == 16) { \ |
| 328 | 331 | hscalefn = c->dstBpc <= 15 ? ff_hscale16to15_ ## filtersize ## _ ## opt2 : \ |
| 329 | 332 | ff_hscale16to19_ ## filtersize ## _ ## opt1; \ |
| @@ -1619,7 +1619,7 @@ static av_cold void RENAME(sws_init_swscale)(SwsContext *c) · 1618 unmodified lines | ||
| 1619 | 1619 | } |
| 1620 | 1620 | } |
| 1621 | 1621 | |
| 1622 | − if (c->srcBpc == 8 && c->dstBpc <= 10) { | |
| 1622 | + if (c->srcBpc == 8 && c->dstBpc <= 12) { | |
| 1623 | 1623 | // Use the new MMX scaler if the MMXEXT one can't be used (it is faster than the x86 ASM one). |
| 1624 | 1624 | #if COMPILE_TEMPLATE_MMXEXT |
| 1625 | 1625 | if (c->flags & SWS_FAST_BILINEAR && c->canMMXEXTBeUsed) { |