History

swscale: Add input support for 12-bit formats

Implemented for AV_PIX_FMT_GBRP12.

Michael Niedermayer committed 14 years ago

Commit 328ea6a1 parent 1e93aa65 files · +43 −3Browse files

Unified · Split

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

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