From bad8e33dc92aa2abd39410be86159a1d4336ff90 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sun, 28 Oct 2012 20:44:53 -0700 Subject: [PATCH 1/6] x86: use PRED4x4/8x8/8x8L/16x16 macros to declare intrapred prototypes. --- libavcodec/x86/h264_intrapred.asm | 80 ++++---- libavcodec/x86/h264_intrapred_init.c | 296 ++++++++++++++------------- 2 files changed, 190 insertions(+), 186 deletions(-) diff --git a/libavcodec/x86/h264_intrapred.asm b/libavcodec/x86/h264_intrapred.asm index dc418f7416..7c6aa12dce 100644 --- a/libavcodec/x86/h264_intrapred.asm +++ b/libavcodec/x86/h264_intrapred.asm @@ -53,7 +53,7 @@ cextern pw_32 ; void pred16x16_vertical(uint8_t *src, int stride) ;----------------------------------------------------------------------------- -cglobal pred16x16_vertical_mmx, 2,3 +cglobal pred16x16_vertical_8_mmx, 2,3 sub r0, r1 mov r2, 8 movq mm0, [r0+0] @@ -68,7 +68,7 @@ cglobal pred16x16_vertical_mmx, 2,3 jg .loop REP_RET -cglobal pred16x16_vertical_sse, 2,3 +cglobal pred16x16_vertical_8_sse, 2,3 sub r0, r1 mov r2, 4 movaps xmm0, [r0] @@ -88,7 +88,7 @@ cglobal pred16x16_vertical_sse, 2,3 ;----------------------------------------------------------------------------- %macro PRED16x16_H 0 -cglobal pred16x16_horizontal, 2,3 +cglobal pred16x16_horizontal_8, 2,3 mov r2, 8 %if cpuflag(ssse3) mova m2, [pb_3] @@ -130,7 +130,7 @@ INIT_XMM ;----------------------------------------------------------------------------- %macro PRED16x16_DC 0 -cglobal pred16x16_dc, 2,7 +cglobal pred16x16_dc_8, 2,7 mov r4, r0 sub r0, r1 pxor mm0, mm0 @@ -193,7 +193,7 @@ INIT_XMM ;----------------------------------------------------------------------------- %macro PRED16x16_TM_MMX 0 -cglobal pred16x16_tm_vp8, 2,5 +cglobal pred16x16_tm_vp8_8, 2,5 sub r0, r1 pxor mm7, mm7 movq mm0, [r0+0] @@ -234,7 +234,7 @@ INIT_MMX mmx2 PRED16x16_TM_MMX INIT_MMX -cglobal pred16x16_tm_vp8_sse2, 2,6,6 +cglobal pred16x16_tm_vp8_8_sse2, 2,6,6 sub r0, r1 pxor xmm2, xmm2 movdqa xmm0, [r0] @@ -274,7 +274,7 @@ cglobal pred16x16_tm_vp8_sse2, 2,6,6 ;----------------------------------------------------------------------------- %macro H264_PRED16x16_PLANE 1 -cglobal pred16x16_plane_%1, 2,9,7 +cglobal pred16x16_plane_%1_8, 2,9,7 mov r2, r1 ; +stride neg r1 ; -stride @@ -556,7 +556,7 @@ INIT_XMM ;----------------------------------------------------------------------------- %macro H264_PRED8x8_PLANE 0 -cglobal pred8x8_plane, 2,9,7 +cglobal pred8x8_plane_8, 2,9,7 mov r2, r1 ; +stride neg r1 ; -stride @@ -730,7 +730,7 @@ INIT_XMM ; void pred8x8_vertical(uint8_t *src, int stride) ;----------------------------------------------------------------------------- -cglobal pred8x8_vertical_mmx, 2,2 +cglobal pred8x8_vertical_8_mmx, 2,2 sub r0, r1 movq mm0, [r0] %rep 3 @@ -747,7 +747,7 @@ cglobal pred8x8_vertical_mmx, 2,2 ;----------------------------------------------------------------------------- %macro PRED8x8_H 0 -cglobal pred8x8_horizontal, 2,3 +cglobal pred8x8_horizontal_8, 2,3 mov r2, 4 %if cpuflag(ssse3) mova m2, [pb_3] @@ -774,7 +774,7 @@ INIT_MMX ;----------------------------------------------------------------------------- ; void pred8x8_top_dc_mmxext(uint8_t *src, int stride) ;----------------------------------------------------------------------------- -cglobal pred8x8_top_dc_mmxext, 2,5 +cglobal pred8x8_top_dc_8_mmxext, 2,5 sub r0, r1 movq mm0, [r0] pxor mm1, mm1 @@ -809,7 +809,7 @@ cglobal pred8x8_top_dc_mmxext, 2,5 ;----------------------------------------------------------------------------- INIT_MMX -cglobal pred8x8_dc_mmxext, 2,5 +cglobal pred8x8_dc_8_mmxext, 2,5 sub r0, r1 pxor m7, m7 movd m0, [r0+0] @@ -869,7 +869,7 @@ cglobal pred8x8_dc_mmxext, 2,5 ; void pred8x8_dc_rv40(uint8_t *src, int stride) ;----------------------------------------------------------------------------- -cglobal pred8x8_dc_rv40_mmxext, 2,7 +cglobal pred8x8_dc_rv40_8_mmxext, 2,7 mov r4, r0 sub r0, r1 pxor mm0, mm0 @@ -906,7 +906,7 @@ cglobal pred8x8_dc_rv40_mmxext, 2,7 ;----------------------------------------------------------------------------- %macro PRED8x8_TM_MMX 0 -cglobal pred8x8_tm_vp8, 2,6 +cglobal pred8x8_tm_vp8_8, 2,6 sub r0, r1 pxor mm7, mm7 movq mm0, [r0] @@ -946,7 +946,7 @@ INIT_MMX mmx2 PRED8x8_TM_MMX INIT_MMX -cglobal pred8x8_tm_vp8_sse2, 2,6,4 +cglobal pred8x8_tm_vp8_8_sse2, 2,6,4 sub r0, r1 pxor xmm1, xmm1 movq xmm0, [r0] @@ -974,7 +974,7 @@ cglobal pred8x8_tm_vp8_sse2, 2,6,4 jg .loop REP_RET -cglobal pred8x8_tm_vp8_ssse3, 2,3,6 +cglobal pred8x8_tm_vp8_8_ssse3, 2,3,6 sub r0, r1 movdqa xmm4, [tm_shuf] pxor xmm1, xmm1 @@ -1016,7 +1016,7 @@ cglobal pred8x8_tm_vp8_ssse3, 2,3,6 ; void pred8x8l_top_dc(uint8_t *src, int has_topleft, int has_topright, int stride) ;----------------------------------------------------------------------------- %macro PRED8x8L_TOP_DC 1 -cglobal pred8x8l_top_dc_%1, 4,4 +cglobal pred8x8l_top_dc_8_%1, 4,4 sub r0, r3 pxor mm7, mm7 movq mm0, [r0-8] @@ -1073,7 +1073,7 @@ PRED8x8L_TOP_DC ssse3 ;----------------------------------------------------------------------------- %macro PRED8x8L_DC 1 -cglobal pred8x8l_dc_%1, 4,5 +cglobal pred8x8l_dc_8_%1, 4,5 sub r0, r3 lea r4, [r0+r3*2] movq mm0, [r0+r3*1-8] @@ -1176,7 +1176,7 @@ PRED8x8L_DC ssse3 ;----------------------------------------------------------------------------- %macro PRED8x8L_HORIZONTAL 1 -cglobal pred8x8l_horizontal_%1, 4,4 +cglobal pred8x8l_horizontal_8_%1, 4,4 sub r0, r3 lea r2, [r0+r3*2] movq mm0, [r0+r3*1-8] @@ -1248,7 +1248,7 @@ PRED8x8L_HORIZONTAL ssse3 ;----------------------------------------------------------------------------- %macro PRED8x8L_VERTICAL 1 -cglobal pred8x8l_vertical_%1, 4,4 +cglobal pred8x8l_vertical_8_%1, 4,4 sub r0, r3 movq mm0, [r0-8] movq mm3, [r0] @@ -1300,7 +1300,7 @@ PRED8x8L_VERTICAL ssse3 INIT_MMX %define PALIGNR PALIGNR_MMX -cglobal pred8x8l_down_left_mmxext, 4,5 +cglobal pred8x8l_down_left_8_mmxext, 4,5 sub r0, r3 movq mm0, [r0-8] movq mm3, [r0] @@ -1408,7 +1408,7 @@ cglobal pred8x8l_down_left_mmxext, 4,5 RET %macro PRED8x8L_DOWN_LEFT 1 -cglobal pred8x8l_down_left_%1, 4,4 +cglobal pred8x8l_down_left_8_%1, 4,4 sub r0, r3 movq mm0, [r0-8] movq mm3, [r0] @@ -1503,7 +1503,7 @@ PRED8x8L_DOWN_LEFT ssse3 INIT_MMX %define PALIGNR PALIGNR_MMX -cglobal pred8x8l_down_right_mmxext, 4,5 +cglobal pred8x8l_down_right_8_mmxext, 4,5 sub r0, r3 lea r4, [r0+r3*2] movq mm0, [r0+r3*1-8] @@ -1635,7 +1635,7 @@ cglobal pred8x8l_down_right_mmxext, 4,5 RET %macro PRED8x8L_DOWN_RIGHT 1 -cglobal pred8x8l_down_right_%1, 4,5 +cglobal pred8x8l_down_right_8_%1, 4,5 sub r0, r3 lea r4, [r0+r3*2] movq mm0, [r0+r3*1-8] @@ -1757,7 +1757,7 @@ PRED8x8L_DOWN_RIGHT ssse3 INIT_MMX %define PALIGNR PALIGNR_MMX -cglobal pred8x8l_vertical_right_mmxext, 4,5 +cglobal pred8x8l_vertical_right_8_mmxext, 4,5 sub r0, r3 lea r4, [r0+r3*2] movq mm0, [r0+r3*1-8] @@ -1864,7 +1864,7 @@ cglobal pred8x8l_vertical_right_mmxext, 4,5 RET %macro PRED8x8L_VERTICAL_RIGHT 1 -cglobal pred8x8l_vertical_right_%1, 4,5,7 +cglobal pred8x8l_vertical_right_8_%1, 4,5,7 ; manually spill XMM registers for Win64 because ; the code here is initialized with INIT_MMX WIN64_SPILL_XMM 7 @@ -1986,7 +1986,7 @@ PRED8x8L_VERTICAL_RIGHT ssse3 ;----------------------------------------------------------------------------- %macro PRED8x8L_VERTICAL_LEFT 1 -cglobal pred8x8l_vertical_left_%1, 4,4 +cglobal pred8x8l_vertical_left_8_%1, 4,4 sub r0, r3 movq mm0, [r0-8] movq mm3, [r0] @@ -2077,7 +2077,7 @@ PRED8x8L_VERTICAL_LEFT ssse3 ;----------------------------------------------------------------------------- %macro PRED8x8L_HORIZONTAL_UP 1 -cglobal pred8x8l_horizontal_up_%1, 4,4 +cglobal pred8x8l_horizontal_up_8_%1, 4,4 sub r0, r3 lea r2, [r0+r3*2] movq mm0, [r0+r3*1-8] @@ -2166,7 +2166,7 @@ PRED8x8L_HORIZONTAL_UP ssse3 INIT_MMX %define PALIGNR PALIGNR_MMX -cglobal pred8x8l_horizontal_down_mmxext, 4,5 +cglobal pred8x8l_horizontal_down_8_mmxext, 4,5 sub r0, r3 lea r4, [r0+r3*2] movq mm0, [r0+r3*1-8] @@ -2281,7 +2281,7 @@ cglobal pred8x8l_horizontal_down_mmxext, 4,5 RET %macro PRED8x8L_HORIZONTAL_DOWN 1 -cglobal pred8x8l_horizontal_down_%1, 4,5 +cglobal pred8x8l_horizontal_down_8_%1, 4,5 sub r0, r3 lea r4, [r0+r3*2] movq mm0, [r0+r3*1-8] @@ -2415,7 +2415,7 @@ PRED8x8L_HORIZONTAL_DOWN ssse3 ; void pred4x4_dc_mmxext(uint8_t *src, const uint8_t *topright, int stride) ;----------------------------------------------------------------------------- -cglobal pred4x4_dc_mmxext, 3,5 +cglobal pred4x4_dc_8_mmxext, 3,5 pxor mm7, mm7 mov r4, r0 sub r0, r2 @@ -2445,7 +2445,7 @@ cglobal pred4x4_dc_mmxext, 3,5 ;----------------------------------------------------------------------------- %macro PRED4x4_TM_MMX 0 -cglobal pred4x4_tm_vp8, 3,6 +cglobal pred4x4_tm_vp8_8, 3,6 sub r0, r2 pxor mm7, mm7 movd mm0, [r0] @@ -2486,7 +2486,7 @@ INIT_MMX mmx2 PRED4x4_TM_MMX INIT_MMX -cglobal pred4x4_tm_vp8_ssse3, 3,3 +cglobal pred4x4_tm_vp8_8_ssse3, 3,3 sub r0, r2 movq mm6, [tm_shuf] pxor mm1, mm1 @@ -2526,7 +2526,7 @@ cglobal pred4x4_tm_vp8_ssse3, 3,3 ;----------------------------------------------------------------------------- INIT_MMX -cglobal pred4x4_vertical_vp8_mmxext, 3,3 +cglobal pred4x4_vertical_vp8_8_mmxext, 3,3 sub r0, r2 movd m1, [r0-1] movd m0, [r0] @@ -2545,7 +2545,7 @@ cglobal pred4x4_vertical_vp8_mmxext, 3,3 ; void pred4x4_down_left_mmxext(uint8_t *src, const uint8_t *topright, int stride) ;----------------------------------------------------------------------------- INIT_MMX -cglobal pred4x4_down_left_mmxext, 3,3 +cglobal pred4x4_down_left_8_mmxext, 3,3 sub r0, r2 movq m1, [r0] punpckldq m1, [r1] @@ -2572,7 +2572,7 @@ cglobal pred4x4_down_left_mmxext, 3,3 ;----------------------------------------------------------------------------- INIT_MMX -cglobal pred4x4_vertical_left_mmxext, 3,3 +cglobal pred4x4_vertical_left_8_mmxext, 3,3 sub r0, r2 movq m1, [r0] punpckldq m1, [r1] @@ -2597,7 +2597,7 @@ cglobal pred4x4_vertical_left_mmxext, 3,3 ;----------------------------------------------------------------------------- INIT_MMX -cglobal pred4x4_horizontal_up_mmxext, 3,3 +cglobal pred4x4_horizontal_up_8_mmxext, 3,3 sub r0, r2 lea r1, [r0+r2*2] movd m0, [r0+r2*1-4] @@ -2631,7 +2631,7 @@ cglobal pred4x4_horizontal_up_mmxext, 3,3 INIT_MMX %define PALIGNR PALIGNR_MMX -cglobal pred4x4_horizontal_down_mmxext, 3,3 +cglobal pred4x4_horizontal_down_8_mmxext, 3,3 sub r0, r2 lea r1, [r0+r2*2] movh m0, [r0-4] ; lt .. @@ -2667,7 +2667,7 @@ cglobal pred4x4_horizontal_down_mmxext, 3,3 INIT_MMX %define PALIGNR PALIGNR_MMX -cglobal pred4x4_vertical_right_mmxext, 3,3 +cglobal pred4x4_vertical_right_8_mmxext, 3,3 sub r0, r2 lea r1, [r0+r2*2] movh m0, [r0] ; ........t3t2t1t0 @@ -2698,7 +2698,7 @@ cglobal pred4x4_vertical_right_mmxext, 3,3 INIT_MMX %define PALIGNR PALIGNR_MMX -cglobal pred4x4_down_right_mmxext, 3,3 +cglobal pred4x4_down_right_8_mmxext, 3,3 sub r0, r2 lea r1, [r0+r2*2] movq m1, [r1-8] diff --git a/libavcodec/x86/h264_intrapred_init.c b/libavcodec/x86/h264_intrapred_init.c index 7a6daac4f9..a686473d75 100644 --- a/libavcodec/x86/h264_intrapred_init.c +++ b/libavcodec/x86/h264_intrapred_init.c @@ -94,79 +94,83 @@ PRED16x16(vertical, 10, sse2) PRED16x16(horizontal, 10, mmx2) PRED16x16(horizontal, 10, sse2) -void ff_pred16x16_vertical_mmx (uint8_t *src, int stride); -void ff_pred16x16_vertical_sse (uint8_t *src, int stride); -void ff_pred16x16_horizontal_mmx (uint8_t *src, int stride); -void ff_pred16x16_horizontal_mmx2 (uint8_t *src, int stride); -void ff_pred16x16_horizontal_ssse3 (uint8_t *src, int stride); -void ff_pred16x16_dc_mmx2 (uint8_t *src, int stride); -void ff_pred16x16_dc_sse2 (uint8_t *src, int stride); -void ff_pred16x16_dc_ssse3 (uint8_t *src, int stride); -void ff_pred16x16_plane_h264_mmx (uint8_t *src, int stride); -void ff_pred16x16_plane_h264_mmx2 (uint8_t *src, int stride); -void ff_pred16x16_plane_h264_sse2 (uint8_t *src, int stride); -void ff_pred16x16_plane_h264_ssse3 (uint8_t *src, int stride); -void ff_pred16x16_plane_rv40_mmx (uint8_t *src, int stride); -void ff_pred16x16_plane_rv40_mmx2 (uint8_t *src, int stride); -void ff_pred16x16_plane_rv40_sse2 (uint8_t *src, int stride); -void ff_pred16x16_plane_rv40_ssse3 (uint8_t *src, int stride); -void ff_pred16x16_plane_svq3_mmx (uint8_t *src, int stride); -void ff_pred16x16_plane_svq3_mmx2 (uint8_t *src, int stride); -void ff_pred16x16_plane_svq3_sse2 (uint8_t *src, int stride); -void ff_pred16x16_plane_svq3_ssse3 (uint8_t *src, int stride); -void ff_pred16x16_tm_vp8_mmx (uint8_t *src, int stride); -void ff_pred16x16_tm_vp8_mmx2 (uint8_t *src, int stride); -void ff_pred16x16_tm_vp8_sse2 (uint8_t *src, int stride); -void ff_pred8x8_top_dc_mmxext (uint8_t *src, int stride); -void ff_pred8x8_dc_rv40_mmxext (uint8_t *src, int stride); -void ff_pred8x8_dc_mmxext (uint8_t *src, int stride); -void ff_pred8x8_vertical_mmx (uint8_t *src, int stride); -void ff_pred8x8_horizontal_mmx (uint8_t *src, int stride); -void ff_pred8x8_horizontal_mmx2 (uint8_t *src, int stride); -void ff_pred8x8_horizontal_ssse3 (uint8_t *src, int stride); -void ff_pred8x8_plane_mmx (uint8_t *src, int stride); -void ff_pred8x8_plane_mmx2 (uint8_t *src, int stride); -void ff_pred8x8_plane_sse2 (uint8_t *src, int stride); -void ff_pred8x8_plane_ssse3 (uint8_t *src, int stride); -void ff_pred8x8_tm_vp8_mmx (uint8_t *src, int stride); -void ff_pred8x8_tm_vp8_mmx2 (uint8_t *src, int stride); -void ff_pred8x8_tm_vp8_sse2 (uint8_t *src, int stride); -void ff_pred8x8_tm_vp8_ssse3 (uint8_t *src, int stride); -void ff_pred8x8l_top_dc_mmxext (uint8_t *src, int has_topleft, int has_topright, int stride); -void ff_pred8x8l_top_dc_ssse3 (uint8_t *src, int has_topleft, int has_topright, int stride); -void ff_pred8x8l_dc_mmxext (uint8_t *src, int has_topleft, int has_topright, int stride); -void ff_pred8x8l_dc_ssse3 (uint8_t *src, int has_topleft, int has_topright, int stride); -void ff_pred8x8l_horizontal_mmxext (uint8_t *src, int has_topleft, int has_topright, int stride); -void ff_pred8x8l_horizontal_ssse3 (uint8_t *src, int has_topleft, int has_topright, int stride); -void ff_pred8x8l_vertical_mmxext (uint8_t *src, int has_topleft, int has_topright, int stride); -void ff_pred8x8l_vertical_ssse3 (uint8_t *src, int has_topleft, int has_topright, int stride); -void ff_pred8x8l_down_left_mmxext (uint8_t *src, int has_topleft, int has_topright, int stride); -void ff_pred8x8l_down_left_sse2 (uint8_t *src, int has_topleft, int has_topright, int stride); -void ff_pred8x8l_down_left_ssse3 (uint8_t *src, int has_topleft, int has_topright, int stride); -void ff_pred8x8l_down_right_mmxext (uint8_t *src, int has_topleft, int has_topright, int stride); -void ff_pred8x8l_down_right_sse2 (uint8_t *src, int has_topleft, int has_topright, int stride); -void ff_pred8x8l_down_right_ssse3 (uint8_t *src, int has_topleft, int has_topright, int stride); -void ff_pred8x8l_vertical_right_mmxext(uint8_t *src, int has_topleft, int has_topright, int stride); -void ff_pred8x8l_vertical_right_sse2(uint8_t *src, int has_topleft, int has_topright, int stride); -void ff_pred8x8l_vertical_right_ssse3(uint8_t *src, int has_topleft, int has_topright, int stride); -void ff_pred8x8l_vertical_left_sse2(uint8_t *src, int has_topleft, int has_topright, int stride); -void ff_pred8x8l_vertical_left_ssse3(uint8_t *src, int has_topleft, int has_topright, int stride); -void ff_pred8x8l_horizontal_up_mmxext(uint8_t *src, int has_topleft, int has_topright, int stride); -void ff_pred8x8l_horizontal_up_ssse3(uint8_t *src, int has_topleft, int has_topright, int stride); -void ff_pred8x8l_horizontal_down_mmxext(uint8_t *src, int has_topleft, int has_topright, int stride); -void ff_pred8x8l_horizontal_down_sse2(uint8_t *src, int has_topleft, int has_topright, int stride); -void ff_pred8x8l_horizontal_down_ssse3(uint8_t *src, int has_topleft, int has_topright, int stride); -void ff_pred4x4_dc_mmxext (uint8_t *src, const uint8_t *topright, int stride); -void ff_pred4x4_down_left_mmxext (uint8_t *src, const uint8_t *topright, int stride); -void ff_pred4x4_down_right_mmxext (uint8_t *src, const uint8_t *topright, int stride); -void ff_pred4x4_vertical_left_mmxext(uint8_t *src, const uint8_t *topright, int stride); -void ff_pred4x4_vertical_right_mmxext(uint8_t *src, const uint8_t *topright, int stride); -void ff_pred4x4_horizontal_up_mmxext(uint8_t *src, const uint8_t *topright, int stride); -void ff_pred4x4_horizontal_down_mmxext(uint8_t *src, const uint8_t *topright, int stride); -void ff_pred4x4_tm_vp8_mmx (uint8_t *src, const uint8_t *topright, int stride); -void ff_pred4x4_tm_vp8_mmx2 (uint8_t *src, const uint8_t *topright, int stride); -void ff_pred4x4_tm_vp8_ssse3 (uint8_t *src, const uint8_t *topright, int stride); -void ff_pred4x4_vertical_vp8_mmxext(uint8_t *src, const uint8_t *topright, int stride); +/* 8-bit versions */ +PRED16x16(vertical, 8, mmx) +PRED16x16(vertical, 8, sse) +PRED16x16(horizontal, 8, mmx) +PRED16x16(horizontal, 8, mmx2) +PRED16x16(horizontal, 8, ssse3) +PRED16x16(dc, 8, mmx2) +PRED16x16(dc, 8, sse2) +PRED16x16(dc, 8, ssse3) +PRED16x16(plane_h264, 8, mmx) +PRED16x16(plane_h264, 8, mmx2) +PRED16x16(plane_h264, 8, sse2) +PRED16x16(plane_h264, 8, ssse3) +PRED16x16(plane_rv40, 8, mmx) +PRED16x16(plane_rv40, 8, mmx2) +PRED16x16(plane_rv40, 8, sse2) +PRED16x16(plane_rv40, 8, ssse3) +PRED16x16(plane_svq3, 8, mmx) +PRED16x16(plane_svq3, 8, mmx2) +PRED16x16(plane_svq3, 8, sse2) +PRED16x16(plane_svq3, 8, ssse3) +PRED16x16(tm_vp8, 8, mmx) +PRED16x16(tm_vp8, 8, mmx2) +PRED16x16(tm_vp8, 8, sse2) + +PRED8x8(top_dc, 8, mmxext) +PRED8x8(dc_rv40, 8, mmxext) +PRED8x8(dc, 8, mmxext) +PRED8x8(vertical, 8, mmx) +PRED8x8(horizontal, 8, mmx) +PRED8x8(horizontal, 8, mmx2) +PRED8x8(horizontal, 8, ssse3) +PRED8x8(plane, 8, mmx) +PRED8x8(plane, 8, mmx2) +PRED8x8(plane, 8, sse2) +PRED8x8(plane, 8, ssse3) +PRED8x8(tm_vp8, 8, mmx) +PRED8x8(tm_vp8, 8, mmx2) +PRED8x8(tm_vp8, 8, sse2) +PRED8x8(tm_vp8, 8, ssse3) + +PRED8x8L(top_dc, 8, mmxext) +PRED8x8L(top_dc, 8, ssse3) +PRED8x8L(dc, 8, mmxext) +PRED8x8L(dc, 8, ssse3) +PRED8x8L(horizontal, 8, mmxext) +PRED8x8L(horizontal, 8, ssse3) +PRED8x8L(vertical, 8, mmxext) +PRED8x8L(vertical, 8, ssse3) +PRED8x8L(down_left, 8, mmxext) +PRED8x8L(down_left, 8, sse2) +PRED8x8L(down_left, 8, ssse3) +PRED8x8L(down_right, 8, mmxext) +PRED8x8L(down_right, 8, sse2) +PRED8x8L(down_right, 8, ssse3) +PRED8x8L(vertical_right, 8, mmxext) +PRED8x8L(vertical_right, 8, sse2) +PRED8x8L(vertical_right, 8, ssse3) +PRED8x8L(vertical_left, 8, sse2) +PRED8x8L(vertical_left, 8, ssse3) +PRED8x8L(horizontal_up, 8, mmxext) +PRED8x8L(horizontal_up, 8, ssse3) +PRED8x8L(horizontal_down, 8, mmxext) +PRED8x8L(horizontal_down, 8, sse2) +PRED8x8L(horizontal_down, 8, ssse3) + +PRED4x4(dc, 8, mmxext) +PRED4x4(down_left, 8, mmxext) +PRED4x4(down_right, 8, mmxext) +PRED4x4(vertical_left, 8, mmxext) +PRED4x4(vertical_right, 8, mmxext) +PRED4x4(horizontal_up, 8, mmxext) +PRED4x4(horizontal_down, 8, mmxext) +PRED4x4(tm_vp8, 8, mmx) +PRED4x4(tm_vp8, 8, mmx2) +PRED4x4(tm_vp8, 8, ssse3) +PRED4x4(vertical_vp8, 8, mmxext) void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc) { @@ -174,136 +178,136 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth if (bit_depth == 8) { if (EXTERNAL_MMX(mm_flags)) { - h->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vertical_mmx; - h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_mmx; + h->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vertical_8_mmx; + h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_8_mmx; if (chroma_format_idc == 1) { - h->pred8x8 [VERT_PRED8x8 ] = ff_pred8x8_vertical_mmx; - h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_mmx; + h->pred8x8 [VERT_PRED8x8 ] = ff_pred8x8_vertical_8_mmx; + h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_8_mmx; } if (codec_id == AV_CODEC_ID_VP8) { - h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_mmx; - h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_mmx; - h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_mmx; + h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_8_mmx; + h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_8_mmx; + h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_8_mmx; } else { if (chroma_format_idc == 1) - h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_mmx; + h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_8_mmx; if (codec_id == AV_CODEC_ID_SVQ3) { if (mm_flags & AV_CPU_FLAG_CMOV) - h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_mmx; + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_8_mmx; } else if (codec_id == AV_CODEC_ID_RV40) { - h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_mmx; + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_8_mmx; } else { - h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_mmx; + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_8_mmx; } } } if (EXTERNAL_MMXEXT(mm_flags)) { - h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_mmx2; - h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_mmx2; + h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_8_mmx2; + h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_8_mmx2; if (chroma_format_idc == 1) - h->pred8x8[HOR_PRED8x8 ] = ff_pred8x8_horizontal_mmx2; - h->pred8x8l [TOP_DC_PRED ] = ff_pred8x8l_top_dc_mmxext; - h->pred8x8l [DC_PRED ] = ff_pred8x8l_dc_mmxext; - h->pred8x8l [HOR_PRED ] = ff_pred8x8l_horizontal_mmxext; - h->pred8x8l [VERT_PRED ] = ff_pred8x8l_vertical_mmxext; - h->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_mmxext; - h->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_mmxext; - h->pred8x8l [HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_mmxext; - h->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_mmxext; - h->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_mmxext; - h->pred4x4 [DIAG_DOWN_RIGHT_PRED ] = ff_pred4x4_down_right_mmxext; - h->pred4x4 [VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_mmxext; - h->pred4x4 [HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_mmxext; - h->pred4x4 [DC_PRED ] = ff_pred4x4_dc_mmxext; + h->pred8x8[HOR_PRED8x8 ] = ff_pred8x8_horizontal_8_mmx2; + h->pred8x8l [TOP_DC_PRED ] = ff_pred8x8l_top_dc_8_mmxext; + h->pred8x8l [DC_PRED ] = ff_pred8x8l_dc_8_mmxext; + h->pred8x8l [HOR_PRED ] = ff_pred8x8l_horizontal_8_mmxext; + h->pred8x8l [VERT_PRED ] = ff_pred8x8l_vertical_8_mmxext; + h->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_8_mmxext; + h->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_8_mmxext; + h->pred8x8l [HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_8_mmxext; + h->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_8_mmxext; + h->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_8_mmxext; + h->pred4x4 [DIAG_DOWN_RIGHT_PRED ] = ff_pred4x4_down_right_8_mmxext; + h->pred4x4 [VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_8_mmxext; + h->pred4x4 [HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_8_mmxext; + h->pred4x4 [DC_PRED ] = ff_pred4x4_dc_8_mmxext; if (codec_id == AV_CODEC_ID_VP8 || codec_id == AV_CODEC_ID_H264) { - h->pred4x4 [DIAG_DOWN_LEFT_PRED] = ff_pred4x4_down_left_mmxext; + h->pred4x4 [DIAG_DOWN_LEFT_PRED] = ff_pred4x4_down_left_8_mmxext; } if (codec_id == AV_CODEC_ID_SVQ3 || codec_id == AV_CODEC_ID_H264) { - h->pred4x4 [VERT_LEFT_PRED ] = ff_pred4x4_vertical_left_mmxext; + h->pred4x4 [VERT_LEFT_PRED ] = ff_pred4x4_vertical_left_8_mmxext; } if (codec_id != AV_CODEC_ID_RV40) { - h->pred4x4 [HOR_UP_PRED ] = ff_pred4x4_horizontal_up_mmxext; + h->pred4x4 [HOR_UP_PRED ] = ff_pred4x4_horizontal_up_8_mmxext; } if (codec_id == AV_CODEC_ID_SVQ3 || codec_id == AV_CODEC_ID_H264) { if (chroma_format_idc == 1) { - h->pred8x8[TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_mmxext; - h->pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_mmxext; + h->pred8x8[TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_8_mmxext; + h->pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_8_mmxext; } } if (codec_id == AV_CODEC_ID_VP8) { - h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_mmx2; - h->pred8x8 [DC_PRED8x8 ] = ff_pred8x8_dc_rv40_mmxext; - h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_mmx2; - h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_mmx2; - h->pred4x4 [VERT_PRED ] = ff_pred4x4_vertical_vp8_mmxext; + h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_8_mmx2; + h->pred8x8 [DC_PRED8x8 ] = ff_pred8x8_dc_rv40_8_mmxext; + h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_8_mmx2; + h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_8_mmx2; + h->pred4x4 [VERT_PRED ] = ff_pred4x4_vertical_vp8_8_mmxext; } else { if (chroma_format_idc == 1) - h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_mmx2; + h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_8_mmx2; if (codec_id == AV_CODEC_ID_SVQ3) { - h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_svq3_mmx2; + h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_svq3_8_mmx2; } else if (codec_id == AV_CODEC_ID_RV40) { - h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_rv40_mmx2; + h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_rv40_8_mmx2; } else { - h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_h264_mmx2; + h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_h264_8_mmx2; } } } if (EXTERNAL_SSE(mm_flags)) { - h->pred16x16[VERT_PRED8x8] = ff_pred16x16_vertical_sse; + h->pred16x16[VERT_PRED8x8] = ff_pred16x16_vertical_8_sse; } if (EXTERNAL_SSE2(mm_flags)) { - h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_sse2; - h->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_sse2; - h->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_sse2; - h->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_sse2; - h->pred8x8l [VERT_LEFT_PRED ] = ff_pred8x8l_vertical_left_sse2; - h->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_sse2; + h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_8_sse2; + h->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_8_sse2; + h->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_8_sse2; + h->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_8_sse2; + h->pred8x8l [VERT_LEFT_PRED ] = ff_pred8x8l_vertical_left_8_sse2; + h->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_8_sse2; if (codec_id == AV_CODEC_ID_VP8) { - h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_sse2; - h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_sse2; + h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_8_sse2; + h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_8_sse2; } else { if (chroma_format_idc == 1) - h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_sse2; + h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_8_sse2; if (codec_id == AV_CODEC_ID_SVQ3) { - h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_sse2; + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_8_sse2; } else if (codec_id == AV_CODEC_ID_RV40) { - h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_sse2; + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_8_sse2; } else { - h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_sse2; + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_8_sse2; } } } if (EXTERNAL_SSSE3(mm_flags)) { - h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_ssse3; - h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_ssse3; + h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_8_ssse3; + h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_8_ssse3; if (chroma_format_idc == 1) - h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_ssse3; - h->pred8x8l [TOP_DC_PRED ] = ff_pred8x8l_top_dc_ssse3; - h->pred8x8l [DC_PRED ] = ff_pred8x8l_dc_ssse3; - h->pred8x8l [HOR_PRED ] = ff_pred8x8l_horizontal_ssse3; - h->pred8x8l [VERT_PRED ] = ff_pred8x8l_vertical_ssse3; - h->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_ssse3; - h->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_ssse3; - h->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_ssse3; - h->pred8x8l [VERT_LEFT_PRED ] = ff_pred8x8l_vertical_left_ssse3; - h->pred8x8l [HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_ssse3; - h->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_ssse3; + h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_8_ssse3; + h->pred8x8l [TOP_DC_PRED ] = ff_pred8x8l_top_dc_8_ssse3; + h->pred8x8l [DC_PRED ] = ff_pred8x8l_dc_8_ssse3; + h->pred8x8l [HOR_PRED ] = ff_pred8x8l_horizontal_8_ssse3; + h->pred8x8l [VERT_PRED ] = ff_pred8x8l_vertical_8_ssse3; + h->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_8_ssse3; + h->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_8_ssse3; + h->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_8_ssse3; + h->pred8x8l [VERT_LEFT_PRED ] = ff_pred8x8l_vertical_left_8_ssse3; + h->pred8x8l [HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_8_ssse3; + h->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_8_ssse3; if (codec_id == AV_CODEC_ID_VP8) { - h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_ssse3; - h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_ssse3; + h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_8_ssse3; + h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_8_ssse3; } else { if (chroma_format_idc == 1) - h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_ssse3; + h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_8_ssse3; if (codec_id == AV_CODEC_ID_SVQ3) { - h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_ssse3; + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_8_ssse3; } else if (codec_id == AV_CODEC_ID_RV40) { - h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_ssse3; + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_8_ssse3; } else { - h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_ssse3; + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_8_ssse3; } } } From 95c89da36ebeeb96b7146c0d70f46c582397da7f Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sun, 28 Oct 2012 20:44:54 -0700 Subject: [PATCH 2/6] Use ptrdiff_t instead of int for intra pred "stride" function parameter. This way, SIMD-optimized functions don't have to sign-extend their stride argument manually to be able to do pointer arithmetic. --- libavcodec/arm/h264pred_init_arm.c | 36 ++--- libavcodec/h264pred.c | 79 ++++++--- libavcodec/h264pred.h | 18 ++- libavcodec/h264pred_template.c | 233 +++++++++++++++++++-------- libavcodec/x86/h264_intrapred_init.c | 15 +- 5 files changed, 264 insertions(+), 117 deletions(-) diff --git a/libavcodec/arm/h264pred_init_arm.c b/libavcodec/arm/h264pred_init_arm.c index 371b1a6733..39c012127d 100644 --- a/libavcodec/arm/h264pred_init_arm.c +++ b/libavcodec/arm/h264pred_init_arm.c @@ -23,25 +23,25 @@ #include "libavutil/arm/cpu.h" #include "libavcodec/h264pred.h" -void ff_pred16x16_vert_neon(uint8_t *src, int stride); -void ff_pred16x16_hor_neon(uint8_t *src, int stride); -void ff_pred16x16_plane_neon(uint8_t *src, int stride); -void ff_pred16x16_dc_neon(uint8_t *src, int stride); -void ff_pred16x16_128_dc_neon(uint8_t *src, int stride); -void ff_pred16x16_left_dc_neon(uint8_t *src, int stride); -void ff_pred16x16_top_dc_neon(uint8_t *src, int stride); +void ff_pred16x16_vert_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred16x16_hor_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred16x16_plane_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred16x16_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred16x16_128_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred16x16_left_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred16x16_top_dc_neon(uint8_t *src, ptrdiff_t stride); -void ff_pred8x8_vert_neon(uint8_t *src, int stride); -void ff_pred8x8_hor_neon(uint8_t *src, int stride); -void ff_pred8x8_plane_neon(uint8_t *src, int stride); -void ff_pred8x8_dc_neon(uint8_t *src, int stride); -void ff_pred8x8_128_dc_neon(uint8_t *src, int stride); -void ff_pred8x8_left_dc_neon(uint8_t *src, int stride); -void ff_pred8x8_top_dc_neon(uint8_t *src, int stride); -void ff_pred8x8_l0t_dc_neon(uint8_t *src, int stride); -void ff_pred8x8_0lt_dc_neon(uint8_t *src, int stride); -void ff_pred8x8_l00_dc_neon(uint8_t *src, int stride); -void ff_pred8x8_0l0_dc_neon(uint8_t *src, int stride); +void ff_pred8x8_vert_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_hor_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_plane_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_128_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_left_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_top_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_l0t_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_0lt_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_l00_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_0l0_dc_neon(uint8_t *src, ptrdiff_t stride); static void ff_h264_pred_init_neon(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc) { diff --git a/libavcodec/h264pred.c b/libavcodec/h264pred.c index fb44046b2e..94cf9d06d7 100644 --- a/libavcodec/h264pred.c +++ b/libavcodec/h264pred.c @@ -39,7 +39,9 @@ #include "h264pred_template.c" #undef BIT_DEPTH -static void pred4x4_vertical_vp8_c(uint8_t *src, const uint8_t *topright, int stride){ +static void pred4x4_vertical_vp8_c(uint8_t *src, const uint8_t *topright, + ptrdiff_t stride) +{ const unsigned lt = src[-1-1*stride]; LOAD_TOP_EDGE LOAD_TOP_RIGHT_EDGE @@ -54,7 +56,9 @@ static void pred4x4_vertical_vp8_c(uint8_t *src, const uint8_t *topright, int st AV_WN32A(src+3*stride, v); } -static void pred4x4_horizontal_vp8_c(uint8_t *src, const uint8_t *topright, int stride){ +static void pred4x4_horizontal_vp8_c(uint8_t *src, const uint8_t *topright, + ptrdiff_t stride) +{ const unsigned lt = src[-1-1*stride]; LOAD_LEFT_EDGE @@ -64,7 +68,9 @@ static void pred4x4_horizontal_vp8_c(uint8_t *src, const uint8_t *topright, int AV_WN32A(src+3*stride, ((l2 + 2*l3 + l3 + 2) >> 2)*0x01010101); } -static void pred4x4_down_left_svq3_c(uint8_t *src, const uint8_t *topright, int stride){ +static void pred4x4_down_left_svq3_c(uint8_t *src, const uint8_t *topright, + ptrdiff_t stride) +{ LOAD_TOP_EDGE LOAD_LEFT_EDGE @@ -86,7 +92,9 @@ static void pred4x4_down_left_svq3_c(uint8_t *src, const uint8_t *topright, int src[3+3*stride]=(l3 + t3)>>1; } -static void pred4x4_down_left_rv40_c(uint8_t *src, const uint8_t *topright, int stride){ +static void pred4x4_down_left_rv40_c(uint8_t *src, const uint8_t *topright, + ptrdiff_t stride) +{ LOAD_TOP_EDGE LOAD_TOP_RIGHT_EDGE LOAD_LEFT_EDGE @@ -110,7 +118,10 @@ static void pred4x4_down_left_rv40_c(uint8_t *src, const uint8_t *topright, int src[3+3*stride]=(t6 + t7 + 1 + l6 + l7 + 1)>>2; } -static void pred4x4_down_left_rv40_nodown_c(uint8_t *src, const uint8_t *topright, int stride){ +static void pred4x4_down_left_rv40_nodown_c(uint8_t *src, + const uint8_t *topright, + ptrdiff_t stride) +{ LOAD_TOP_EDGE LOAD_TOP_RIGHT_EDGE LOAD_LEFT_EDGE @@ -133,8 +144,11 @@ static void pred4x4_down_left_rv40_nodown_c(uint8_t *src, const uint8_t *toprigh src[3+3*stride]=(t6 + t7 + 1 + 2*l3 + 1)>>2; } -static void pred4x4_vertical_left_rv40(uint8_t *src, const uint8_t *topright, int stride, - const int l0, const int l1, const int l2, const int l3, const int l4){ +static void pred4x4_vertical_left_rv40(uint8_t *src, const uint8_t *topright, + ptrdiff_t stride, + const int l0, const int l1, const int l2, + const int l3, const int l4) +{ LOAD_TOP_EDGE LOAD_TOP_RIGHT_EDGE @@ -156,20 +170,27 @@ static void pred4x4_vertical_left_rv40(uint8_t *src, const uint8_t *topright, in src[3+3*stride]=(t4 + 2*t5 + t6 + 2)>>2; } -static void pred4x4_vertical_left_rv40_c(uint8_t *src, const uint8_t *topright, int stride){ +static void pred4x4_vertical_left_rv40_c(uint8_t *src, const uint8_t *topright, + ptrdiff_t stride) +{ LOAD_LEFT_EDGE LOAD_DOWN_LEFT_EDGE pred4x4_vertical_left_rv40(src, topright, stride, l0, l1, l2, l3, l4); } -static void pred4x4_vertical_left_rv40_nodown_c(uint8_t *src, const uint8_t *topright, int stride){ +static void pred4x4_vertical_left_rv40_nodown_c(uint8_t *src, + const uint8_t *topright, + ptrdiff_t stride) +{ LOAD_LEFT_EDGE pred4x4_vertical_left_rv40(src, topright, stride, l0, l1, l2, l3, l3); } -static void pred4x4_vertical_left_vp8_c(uint8_t *src, const uint8_t *topright, int stride){ +static void pred4x4_vertical_left_vp8_c(uint8_t *src, const uint8_t *topright, + ptrdiff_t stride) +{ LOAD_TOP_EDGE LOAD_TOP_RIGHT_EDGE @@ -191,7 +212,9 @@ static void pred4x4_vertical_left_vp8_c(uint8_t *src, const uint8_t *topright, i src[3+3*stride]=(t5 + 2*t6 + t7 + 2)>>2; } -static void pred4x4_horizontal_up_rv40_c(uint8_t *src, const uint8_t *topright, int stride){ +static void pred4x4_horizontal_up_rv40_c(uint8_t *src, const uint8_t *topright, + ptrdiff_t stride) +{ LOAD_LEFT_EDGE LOAD_DOWN_LEFT_EDGE LOAD_TOP_EDGE @@ -215,7 +238,10 @@ static void pred4x4_horizontal_up_rv40_c(uint8_t *src, const uint8_t *topright, src[3+3*stride]=(l4 + 2*l5 + l6 + 2)>>2; } -static void pred4x4_horizontal_up_rv40_nodown_c(uint8_t *src, const uint8_t *topright, int stride){ +static void pred4x4_horizontal_up_rv40_nodown_c(uint8_t *src, + const uint8_t *topright, + ptrdiff_t stride) +{ LOAD_LEFT_EDGE LOAD_TOP_EDGE LOAD_TOP_RIGHT_EDGE @@ -238,7 +264,9 @@ static void pred4x4_horizontal_up_rv40_nodown_c(uint8_t *src, const uint8_t *top src[3+3*stride]=l3; } -static void pred4x4_tm_vp8_c(uint8_t *src, const uint8_t *topright, int stride){ +static void pred4x4_tm_vp8_c(uint8_t *src, const uint8_t *topright, + ptrdiff_t stride) +{ uint8_t *cm = ff_cropTbl + MAX_NEG_CROP - src[-1-stride]; uint8_t *top = src-stride; int y; @@ -253,15 +281,18 @@ static void pred4x4_tm_vp8_c(uint8_t *src, const uint8_t *topright, int stride){ } } -static void pred16x16_plane_svq3_c(uint8_t *src, int stride){ +static void pred16x16_plane_svq3_c(uint8_t *src, ptrdiff_t stride) +{ pred16x16_plane_compat_8_c(src, stride, 1, 0); } -static void pred16x16_plane_rv40_c(uint8_t *src, int stride){ +static void pred16x16_plane_rv40_c(uint8_t *src, ptrdiff_t stride) +{ pred16x16_plane_compat_8_c(src, stride, 0, 1); } -static void pred16x16_tm_vp8_c(uint8_t *src, int stride){ +static void pred16x16_tm_vp8_c(uint8_t *src, ptrdiff_t stride) +{ uint8_t *cm = ff_cropTbl + MAX_NEG_CROP - src[-1-stride]; uint8_t *top = src-stride; int y; @@ -288,7 +319,8 @@ static void pred16x16_tm_vp8_c(uint8_t *src, int stride){ } } -static void pred8x8_left_dc_rv40_c(uint8_t *src, int stride){ +static void pred8x8_left_dc_rv40_c(uint8_t *src, ptrdiff_t stride) +{ int i; unsigned dc0; @@ -303,7 +335,8 @@ static void pred8x8_left_dc_rv40_c(uint8_t *src, int stride){ } } -static void pred8x8_top_dc_rv40_c(uint8_t *src, int stride){ +static void pred8x8_top_dc_rv40_c(uint8_t *src, ptrdiff_t stride) +{ int i; unsigned dc0; @@ -318,7 +351,8 @@ static void pred8x8_top_dc_rv40_c(uint8_t *src, int stride){ } } -static void pred8x8_dc_rv40_c(uint8_t *src, int stride){ +static void pred8x8_dc_rv40_c(uint8_t *src, ptrdiff_t stride) +{ int i; unsigned dc0 = 0; @@ -339,7 +373,8 @@ static void pred8x8_dc_rv40_c(uint8_t *src, int stride){ } } -static void pred8x8_tm_vp8_c(uint8_t *src, int stride){ +static void pred8x8_tm_vp8_c(uint8_t *src, ptrdiff_t stride) +{ uint8_t *cm = ff_cropTbl + MAX_NEG_CROP - src[-1-stride]; uint8_t *top = src-stride; int y; @@ -361,7 +396,9 @@ static void pred8x8_tm_vp8_c(uint8_t *src, int stride){ /** * Set the intra prediction function pointers. */ -void ff_h264_pred_init(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc){ +void ff_h264_pred_init(H264PredContext *h, int codec_id, const int bit_depth, + const int chroma_format_idc) +{ // MpegEncContext * const s = &h->s; #undef FUNC diff --git a/libavcodec/h264pred.h b/libavcodec/h264pred.h index a964ae394b..a8b3dba28b 100644 --- a/libavcodec/h264pred.h +++ b/libavcodec/h264pred.h @@ -90,21 +90,23 @@ * Context for storing H.264 prediction functions */ typedef struct H264PredContext { - void(*pred4x4[9 + 3 + 3])(uint8_t *src, const uint8_t *topright, int stride); //FIXME move to dsp? - void(*pred8x8l[9 + 3])(uint8_t *src, int topleft, int topright, int stride); - void(*pred8x8[4 + 3 + 4])(uint8_t *src, int stride); - void(*pred16x16[4 + 3 + 2])(uint8_t *src, int stride); + void(*pred4x4[9 + 3 + 3])(uint8_t *src, const uint8_t *topright, + ptrdiff_t stride); + void(*pred8x8l[9 + 3])(uint8_t *src, int topleft, int topright, + ptrdiff_t stride); + void(*pred8x8[4 + 3 + 4])(uint8_t *src, ptrdiff_t stride); + void(*pred16x16[4 + 3 + 2])(uint8_t *src, ptrdiff_t stride); void(*pred4x4_add[2])(uint8_t *pix /*align 4*/, - const DCTELEM *block /*align 16*/, int stride); + const DCTELEM *block /*align 16*/, ptrdiff_t stride); void(*pred8x8l_add[2])(uint8_t *pix /*align 8*/, - const DCTELEM *block /*align 16*/, int stride); + const DCTELEM *block /*align 16*/, ptrdiff_t stride); void(*pred8x8_add[3])(uint8_t *pix /*align 8*/, const int *block_offset, - const DCTELEM *block /*align 16*/, int stride); + const DCTELEM *block /*align 16*/, ptrdiff_t stride); void(*pred16x16_add[3])(uint8_t *pix /*align 16*/, const int *block_offset, - const DCTELEM *block /*align 16*/, int stride); + const DCTELEM *block /*align 16*/, ptrdiff_t stride); } H264PredContext; void ff_h264_pred_init(H264PredContext *h, int codec_id, diff --git a/libavcodec/h264pred_template.c b/libavcodec/h264pred_template.c index 19100b69a9..8ae13b0df7 100644 --- a/libavcodec/h264pred_template.c +++ b/libavcodec/h264pred_template.c @@ -29,7 +29,9 @@ #include "bit_depth_template.c" -static void FUNCC(pred4x4_vertical)(uint8_t *_src, const uint8_t *topright, int _stride){ +static void FUNCC(pred4x4_vertical)(uint8_t *_src, const uint8_t *topright, + ptrdiff_t _stride) +{ pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); const pixel4 a= AV_RN4PA(src-stride); @@ -40,7 +42,9 @@ static void FUNCC(pred4x4_vertical)(uint8_t *_src, const uint8_t *topright, int AV_WN4PA(src+3*stride, a); } -static void FUNCC(pred4x4_horizontal)(uint8_t *_src, const uint8_t *topright, int _stride){ +static void FUNCC(pred4x4_horizontal)(uint8_t *_src, const uint8_t *topright, + ptrdiff_t _stride) +{ pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); AV_WN4PA(src+0*stride, PIXEL_SPLAT_X4(src[-1+0*stride])); @@ -49,7 +53,9 @@ static void FUNCC(pred4x4_horizontal)(uint8_t *_src, const uint8_t *topright, in AV_WN4PA(src+3*stride, PIXEL_SPLAT_X4(src[-1+3*stride])); } -static void FUNCC(pred4x4_dc)(uint8_t *_src, const uint8_t *topright, int _stride){ +static void FUNCC(pred4x4_dc)(uint8_t *_src, const uint8_t *topright, + ptrdiff_t _stride) +{ pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); const int dc= ( src[-stride] + src[1-stride] + src[2-stride] + src[3-stride] @@ -62,7 +68,9 @@ static void FUNCC(pred4x4_dc)(uint8_t *_src, const uint8_t *topright, int _strid AV_WN4PA(src+3*stride, a); } -static void FUNCC(pred4x4_left_dc)(uint8_t *_src, const uint8_t *topright, int _stride){ +static void FUNCC(pred4x4_left_dc)(uint8_t *_src, const uint8_t *topright, + ptrdiff_t _stride) +{ pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); const int dc= ( src[-1+0*stride] + src[-1+1*stride] + src[-1+2*stride] + src[-1+3*stride] + 2) >>2; @@ -74,7 +82,9 @@ static void FUNCC(pred4x4_left_dc)(uint8_t *_src, const uint8_t *topright, int _ AV_WN4PA(src+3*stride, a); } -static void FUNCC(pred4x4_top_dc)(uint8_t *_src, const uint8_t *topright, int _stride){ +static void FUNCC(pred4x4_top_dc)(uint8_t *_src, const uint8_t *topright, + ptrdiff_t _stride) +{ pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); const int dc= ( src[-stride] + src[1-stride] + src[2-stride] + src[3-stride] + 2) >>2; @@ -86,7 +96,9 @@ static void FUNCC(pred4x4_top_dc)(uint8_t *_src, const uint8_t *topright, int _s AV_WN4PA(src+3*stride, a); } -static void FUNCC(pred4x4_128_dc)(uint8_t *_src, const uint8_t *topright, int _stride){ +static void FUNCC(pred4x4_128_dc)(uint8_t *_src, const uint8_t *topright, + ptrdiff_t _stride) +{ pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); const pixel4 a = PIXEL_SPLAT_X4(1<<(BIT_DEPTH-1)); @@ -97,7 +109,9 @@ static void FUNCC(pred4x4_128_dc)(uint8_t *_src, const uint8_t *topright, int _s AV_WN4PA(src+3*stride, a); } -static void FUNCC(pred4x4_127_dc)(uint8_t *_src, const uint8_t *topright, int _stride){ +static void FUNCC(pred4x4_127_dc)(uint8_t *_src, const uint8_t *topright, + ptrdiff_t _stride) +{ pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); const pixel4 a = PIXEL_SPLAT_X4((1<<(BIT_DEPTH-1))-1); @@ -108,7 +122,9 @@ static void FUNCC(pred4x4_127_dc)(uint8_t *_src, const uint8_t *topright, int _s AV_WN4PA(src+3*stride, a); } -static void FUNCC(pred4x4_129_dc)(uint8_t *_src, const uint8_t *topright, int _stride){ +static void FUNCC(pred4x4_129_dc)(uint8_t *_src, const uint8_t *topright, + ptrdiff_t _stride) +{ pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); const pixel4 a = PIXEL_SPLAT_X4((1<<(BIT_DEPTH-1))+1); @@ -144,7 +160,9 @@ static void FUNCC(pred4x4_129_dc)(uint8_t *_src, const uint8_t *topright, int _s const unsigned av_unused t2 = src[ 2-1*stride];\ const unsigned av_unused t3 = src[ 3-1*stride];\ -static void FUNCC(pred4x4_down_right)(uint8_t *_src, const uint8_t *topright, int _stride){ +static void FUNCC(pred4x4_down_right)(uint8_t *_src, const uint8_t *topright, + ptrdiff_t _stride) +{ pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); const int lt= src[-1-1*stride]; @@ -169,7 +187,9 @@ static void FUNCC(pred4x4_down_right)(uint8_t *_src, const uint8_t *topright, in src[3+0*stride]=(t1 + 2*t2 + t3 + 2)>>2; } -static void FUNCC(pred4x4_down_left)(uint8_t *_src, const uint8_t *_topright, int _stride){ +static void FUNCC(pred4x4_down_left)(uint8_t *_src, const uint8_t *_topright, + ptrdiff_t _stride) +{ pixel *src = (pixel*)_src; const pixel *topright = (const pixel*)_topright; int stride = _stride/sizeof(pixel); @@ -195,7 +215,10 @@ static void FUNCC(pred4x4_down_left)(uint8_t *_src, const uint8_t *_topright, in src[3+3*stride]=(t6 + 3*t7 + 2)>>2; } -static void FUNCC(pred4x4_vertical_right)(uint8_t *_src, const uint8_t *topright, int _stride){ +static void FUNCC(pred4x4_vertical_right)(uint8_t *_src, + const uint8_t *topright, + ptrdiff_t _stride) +{ pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); const int lt= src[-1-1*stride]; @@ -220,7 +243,10 @@ static void FUNCC(pred4x4_vertical_right)(uint8_t *_src, const uint8_t *topright src[0+3*stride]=(l0 + 2*l1 + l2 + 2)>>2; } -static void FUNCC(pred4x4_vertical_left)(uint8_t *_src, const uint8_t *_topright, int _stride){ +static void FUNCC(pred4x4_vertical_left)(uint8_t *_src, + const uint8_t *_topright, + ptrdiff_t _stride) +{ pixel *src = (pixel*)_src; const pixel *topright = (const pixel*)_topright; int stride = _stride/sizeof(pixel); @@ -245,7 +271,9 @@ static void FUNCC(pred4x4_vertical_left)(uint8_t *_src, const uint8_t *_topright src[3+3*stride]=(t4 + 2*t5 + t6 + 2)>>2; } -static void FUNCC(pred4x4_horizontal_up)(uint8_t *_src, const uint8_t *topright, int _stride){ +static void FUNCC(pred4x4_horizontal_up)(uint8_t *_src, const uint8_t *topright, + ptrdiff_t _stride) +{ pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); LOAD_LEFT_EDGE @@ -268,7 +296,10 @@ static void FUNCC(pred4x4_horizontal_up)(uint8_t *_src, const uint8_t *topright, src[3+3*stride]=l3; } -static void FUNCC(pred4x4_horizontal_down)(uint8_t *_src, const uint8_t *topright, int _stride){ +static void FUNCC(pred4x4_horizontal_down)(uint8_t *_src, + const uint8_t *topright, + ptrdiff_t _stride) +{ pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); const int lt= src[-1-1*stride]; @@ -293,7 +324,8 @@ static void FUNCC(pred4x4_horizontal_down)(uint8_t *_src, const uint8_t *toprigh src[1+3*stride]=(l1 + 2*l2 + l3 + 2)>>2; } -static void FUNCC(pred16x16_vertical)(uint8_t *_src, int _stride){ +static void FUNCC(pred16x16_vertical)(uint8_t *_src, ptrdiff_t _stride) +{ int i; pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); @@ -310,7 +342,8 @@ static void FUNCC(pred16x16_vertical)(uint8_t *_src, int _stride){ } } -static void FUNCC(pred16x16_horizontal)(uint8_t *_src, int stride){ +static void FUNCC(pred16x16_horizontal)(uint8_t *_src, ptrdiff_t stride) +{ int i; pixel *src = (pixel*)_src; stride /= sizeof(pixel); @@ -334,7 +367,8 @@ static void FUNCC(pred16x16_horizontal)(uint8_t *_src, int stride){ src += stride;\ } -static void FUNCC(pred16x16_dc)(uint8_t *_src, int stride){ +static void FUNCC(pred16x16_dc)(uint8_t *_src, ptrdiff_t stride) +{ int i, dc=0; pixel *src = (pixel*)_src; pixel4 dcsplat; @@ -352,7 +386,8 @@ static void FUNCC(pred16x16_dc)(uint8_t *_src, int stride){ PREDICT_16x16_DC(dcsplat); } -static void FUNCC(pred16x16_left_dc)(uint8_t *_src, int stride){ +static void FUNCC(pred16x16_left_dc)(uint8_t *_src, ptrdiff_t stride) +{ int i, dc=0; pixel *src = (pixel*)_src; pixel4 dcsplat; @@ -366,7 +401,8 @@ static void FUNCC(pred16x16_left_dc)(uint8_t *_src, int stride){ PREDICT_16x16_DC(dcsplat); } -static void FUNCC(pred16x16_top_dc)(uint8_t *_src, int stride){ +static void FUNCC(pred16x16_top_dc)(uint8_t *_src, ptrdiff_t stride) +{ int i, dc=0; pixel *src = (pixel*)_src; pixel4 dcsplat; @@ -381,7 +417,8 @@ static void FUNCC(pred16x16_top_dc)(uint8_t *_src, int stride){ } #define PRED16x16_X(n, v) \ -static void FUNCC(pred16x16_##n##_dc)(uint8_t *_src, int stride){\ +static void FUNCC(pred16x16_##n##_dc)(uint8_t *_src, ptrdiff_t stride)\ +{\ int i;\ pixel *src = (pixel*)_src;\ stride /= sizeof(pixel);\ @@ -392,7 +429,11 @@ PRED16x16_X(127, (1<<(BIT_DEPTH-1))-1) PRED16x16_X(128, (1<<(BIT_DEPTH-1))+0) PRED16x16_X(129, (1<<(BIT_DEPTH-1))+1) -static inline void FUNCC(pred16x16_plane_compat)(uint8_t *_src, int _stride, const int svq3, const int rv40){ +static inline void FUNCC(pred16x16_plane_compat)(uint8_t *_src, + ptrdiff_t _stride, + const int svq3, + const int rv40) +{ int i, j, k; int a; INIT_CLIP @@ -437,11 +478,13 @@ static inline void FUNCC(pred16x16_plane_compat)(uint8_t *_src, int _stride, con } } -static void FUNCC(pred16x16_plane)(uint8_t *src, int stride){ +static void FUNCC(pred16x16_plane)(uint8_t *src, ptrdiff_t stride) +{ FUNCC(pred16x16_plane_compat)(src, stride, 0, 0); } -static void FUNCC(pred8x8_vertical)(uint8_t *_src, int _stride){ +static void FUNCC(pred8x8_vertical)(uint8_t *_src, ptrdiff_t _stride) +{ int i; pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); @@ -454,7 +497,8 @@ static void FUNCC(pred8x8_vertical)(uint8_t *_src, int _stride){ } } -static void FUNCC(pred8x16_vertical)(uint8_t *_src, int _stride){ +static void FUNCC(pred8x16_vertical)(uint8_t *_src, ptrdiff_t _stride) +{ int i; pixel *src = (pixel*)_src; int stride = _stride>>(sizeof(pixel)-1); @@ -467,7 +511,8 @@ static void FUNCC(pred8x16_vertical)(uint8_t *_src, int _stride){ } } -static void FUNCC(pred8x8_horizontal)(uint8_t *_src, int stride){ +static void FUNCC(pred8x8_horizontal)(uint8_t *_src, ptrdiff_t stride) +{ int i; pixel *src = (pixel*)_src; stride /= sizeof(pixel); @@ -479,7 +524,8 @@ static void FUNCC(pred8x8_horizontal)(uint8_t *_src, int stride){ } } -static void FUNCC(pred8x16_horizontal)(uint8_t *_src, int stride){ +static void FUNCC(pred8x16_horizontal)(uint8_t *_src, ptrdiff_t stride) +{ int i; pixel *src = (pixel*)_src; stride >>= sizeof(pixel)-1; @@ -491,7 +537,8 @@ static void FUNCC(pred8x16_horizontal)(uint8_t *_src, int stride){ } #define PRED8x8_X(n, v)\ -static void FUNCC(pred8x8_##n##_dc)(uint8_t *_src, int stride){\ +static void FUNCC(pred8x8_##n##_dc)(uint8_t *_src, ptrdiff_t stride)\ +{\ int i;\ const pixel4 a = PIXEL_SPLAT_X4(v);\ pixel *src = (pixel*)_src;\ @@ -506,12 +553,14 @@ PRED8x8_X(127, (1<<(BIT_DEPTH-1))-1) PRED8x8_X(128, (1<<(BIT_DEPTH-1))+0) PRED8x8_X(129, (1<<(BIT_DEPTH-1))+1) -static void FUNCC(pred8x16_128_dc)(uint8_t *_src, int stride){ +static void FUNCC(pred8x16_128_dc)(uint8_t *_src, ptrdiff_t stride) +{ FUNCC(pred8x8_128_dc)(_src, stride); FUNCC(pred8x8_128_dc)(_src+8*stride, stride); } -static void FUNCC(pred8x8_left_dc)(uint8_t *_src, int stride){ +static void FUNCC(pred8x8_left_dc)(uint8_t *_src, ptrdiff_t stride) +{ int i; int dc0, dc2; pixel4 dc0splat, dc2splat; @@ -536,12 +585,14 @@ static void FUNCC(pred8x8_left_dc)(uint8_t *_src, int stride){ } } -static void FUNCC(pred8x16_left_dc)(uint8_t *_src, int stride){ +static void FUNCC(pred8x16_left_dc)(uint8_t *_src, ptrdiff_t stride) +{ FUNCC(pred8x8_left_dc)(_src, stride); FUNCC(pred8x8_left_dc)(_src+8*stride, stride); } -static void FUNCC(pred8x8_top_dc)(uint8_t *_src, int stride){ +static void FUNCC(pred8x8_top_dc)(uint8_t *_src, ptrdiff_t stride) +{ int i; int dc0, dc1; pixel4 dc0splat, dc1splat; @@ -566,7 +617,8 @@ static void FUNCC(pred8x8_top_dc)(uint8_t *_src, int stride){ } } -static void FUNCC(pred8x16_top_dc)(uint8_t *_src, int stride){ +static void FUNCC(pred8x16_top_dc)(uint8_t *_src, ptrdiff_t stride) +{ int i; int dc0, dc1; pixel4 dc0splat, dc1splat; @@ -587,7 +639,8 @@ static void FUNCC(pred8x16_top_dc)(uint8_t *_src, int stride){ } } -static void FUNCC(pred8x8_dc)(uint8_t *_src, int stride){ +static void FUNCC(pred8x8_dc)(uint8_t *_src, ptrdiff_t stride) +{ int i; int dc0, dc1, dc2; pixel4 dc0splat, dc1splat, dc2splat, dc3splat; @@ -615,7 +668,8 @@ static void FUNCC(pred8x8_dc)(uint8_t *_src, int stride){ } } -static void FUNCC(pred8x16_dc)(uint8_t *_src, int stride){ +static void FUNCC(pred8x16_dc)(uint8_t *_src, ptrdiff_t stride) +{ int i; int dc0, dc1, dc2, dc3, dc4; pixel4 dc0splat, dc1splat, dc2splat, dc3splat, dc4splat, dc5splat, dc6splat, dc7splat; @@ -657,51 +711,60 @@ static void FUNCC(pred8x16_dc)(uint8_t *_src, int stride){ } } -static void FUNC(pred8x8_mad_cow_dc_l0t)(uint8_t *src, int stride){ +static void FUNC(pred8x8_mad_cow_dc_l0t)(uint8_t *src, ptrdiff_t stride) +{ FUNCC(pred8x8_top_dc)(src, stride); FUNCC(pred4x4_dc)(src, NULL, stride); } -static void FUNC(pred8x16_mad_cow_dc_l0t)(uint8_t *src, int stride){ +static void FUNC(pred8x16_mad_cow_dc_l0t)(uint8_t *src, ptrdiff_t stride) +{ FUNCC(pred8x16_top_dc)(src, stride); FUNCC(pred4x4_dc)(src, NULL, stride); } -static void FUNC(pred8x8_mad_cow_dc_0lt)(uint8_t *src, int stride){ +static void FUNC(pred8x8_mad_cow_dc_0lt)(uint8_t *src, ptrdiff_t stride) +{ FUNCC(pred8x8_dc)(src, stride); FUNCC(pred4x4_top_dc)(src, NULL, stride); } -static void FUNC(pred8x16_mad_cow_dc_0lt)(uint8_t *src, int stride){ +static void FUNC(pred8x16_mad_cow_dc_0lt)(uint8_t *src, ptrdiff_t stride) +{ FUNCC(pred8x16_dc)(src, stride); FUNCC(pred4x4_top_dc)(src, NULL, stride); } -static void FUNC(pred8x8_mad_cow_dc_l00)(uint8_t *src, int stride){ +static void FUNC(pred8x8_mad_cow_dc_l00)(uint8_t *src, ptrdiff_t stride) +{ FUNCC(pred8x8_left_dc)(src, stride); FUNCC(pred4x4_128_dc)(src + 4*stride , NULL, stride); FUNCC(pred4x4_128_dc)(src + 4*stride + 4*sizeof(pixel), NULL, stride); } -static void FUNC(pred8x16_mad_cow_dc_l00)(uint8_t *src, int stride){ +static void FUNC(pred8x16_mad_cow_dc_l00)(uint8_t *src, ptrdiff_t stride) +{ FUNCC(pred8x16_left_dc)(src, stride); FUNCC(pred4x4_128_dc)(src + 4*stride , NULL, stride); FUNCC(pred4x4_128_dc)(src + 4*stride + 4*sizeof(pixel), NULL, stride); } -static void FUNC(pred8x8_mad_cow_dc_0l0)(uint8_t *src, int stride){ +static void FUNC(pred8x8_mad_cow_dc_0l0)(uint8_t *src, ptrdiff_t stride) +{ FUNCC(pred8x8_left_dc)(src, stride); FUNCC(pred4x4_128_dc)(src , NULL, stride); FUNCC(pred4x4_128_dc)(src + 4*sizeof(pixel), NULL, stride); } -static void FUNC(pred8x16_mad_cow_dc_0l0)(uint8_t *src, int stride){ +static void FUNC(pred8x16_mad_cow_dc_0l0)(uint8_t *src, ptrdiff_t stride) +{ FUNCC(pred8x16_left_dc)(src, stride); FUNCC(pred4x4_128_dc)(src , NULL, stride); FUNCC(pred4x4_128_dc)(src + 4*sizeof(pixel), NULL, stride); } -static void FUNCC(pred8x8_plane)(uint8_t *_src, int _stride){ +static void FUNCC(pred8x8_plane)(uint8_t *_src, ptrdiff_t _stride) +{ int j, k; int a; INIT_CLIP @@ -736,7 +799,8 @@ static void FUNCC(pred8x8_plane)(uint8_t *_src, int _stride){ } } -static void FUNCC(pred8x16_plane)(uint8_t *_src, int _stride){ +static void FUNCC(pred8x16_plane)(uint8_t *_src, ptrdiff_t _stride) +{ int j, k; int a; INIT_CLIP @@ -815,14 +879,16 @@ static void FUNCC(pred8x16_plane)(uint8_t *_src, int _stride){ src += stride; \ } -static void FUNCC(pred8x8l_128_dc)(uint8_t *_src, int has_topleft, int has_topright, int _stride) +static void FUNCC(pred8x8l_128_dc)(uint8_t *_src, int has_topleft, + int has_topright, ptrdiff_t _stride) { pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); PREDICT_8x8_DC(PIXEL_SPLAT_X4(1<<(BIT_DEPTH-1))); } -static void FUNCC(pred8x8l_left_dc)(uint8_t *_src, int has_topleft, int has_topright, int _stride) +static void FUNCC(pred8x8l_left_dc)(uint8_t *_src, int has_topleft, + int has_topright, ptrdiff_t _stride) { pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); @@ -831,7 +897,8 @@ static void FUNCC(pred8x8l_left_dc)(uint8_t *_src, int has_topleft, int has_topr const pixel4 dc = PIXEL_SPLAT_X4((l0+l1+l2+l3+l4+l5+l6+l7+4) >> 3); PREDICT_8x8_DC(dc); } -static void FUNCC(pred8x8l_top_dc)(uint8_t *_src, int has_topleft, int has_topright, int _stride) +static void FUNCC(pred8x8l_top_dc)(uint8_t *_src, int has_topleft, + int has_topright, ptrdiff_t _stride) { pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); @@ -840,7 +907,8 @@ static void FUNCC(pred8x8l_top_dc)(uint8_t *_src, int has_topleft, int has_topri const pixel4 dc = PIXEL_SPLAT_X4((t0+t1+t2+t3+t4+t5+t6+t7+4) >> 3); PREDICT_8x8_DC(dc); } -static void FUNCC(pred8x8l_dc)(uint8_t *_src, int has_topleft, int has_topright, int _stride) +static void FUNCC(pred8x8l_dc)(uint8_t *_src, int has_topleft, + int has_topright, ptrdiff_t _stride) { pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); @@ -851,7 +919,8 @@ static void FUNCC(pred8x8l_dc)(uint8_t *_src, int has_topleft, int has_topright, +t0+t1+t2+t3+t4+t5+t6+t7+8) >> 4); PREDICT_8x8_DC(dc); } -static void FUNCC(pred8x8l_horizontal)(uint8_t *_src, int has_topleft, int has_topright, int _stride) +static void FUNCC(pred8x8l_horizontal)(uint8_t *_src, int has_topleft, + int has_topright, ptrdiff_t _stride) { pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); @@ -864,7 +933,8 @@ static void FUNCC(pred8x8l_horizontal)(uint8_t *_src, int has_topleft, int has_t ROW(0); ROW(1); ROW(2); ROW(3); ROW(4); ROW(5); ROW(6); ROW(7); #undef ROW } -static void FUNCC(pred8x8l_vertical)(uint8_t *_src, int has_topleft, int has_topright, int _stride) +static void FUNCC(pred8x8l_vertical)(uint8_t *_src, int has_topleft, + int has_topright, ptrdiff_t _stride) { int y; pixel *src = (pixel*)_src; @@ -887,7 +957,8 @@ static void FUNCC(pred8x8l_vertical)(uint8_t *_src, int has_topleft, int has_top AV_WN4PA(((pixel4*)(src+y*stride))+1, b); } } -static void FUNCC(pred8x8l_down_left)(uint8_t *_src, int has_topleft, int has_topright, int _stride) +static void FUNCC(pred8x8l_down_left)(uint8_t *_src, int has_topleft, + int has_topright, ptrdiff_t _stride) { pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); @@ -909,7 +980,8 @@ static void FUNCC(pred8x8l_down_left)(uint8_t *_src, int has_topleft, int has_to SRC(6,7)=SRC(7,6)= (t13 + 2*t14 + t15 + 2) >> 2; SRC(7,7)= (t14 + 3*t15 + 2) >> 2; } -static void FUNCC(pred8x8l_down_right)(uint8_t *_src, int has_topleft, int has_topright, int _stride) +static void FUNCC(pred8x8l_down_right)(uint8_t *_src, int has_topleft, + int has_topright, ptrdiff_t _stride) { pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); @@ -932,7 +1004,8 @@ static void FUNCC(pred8x8l_down_right)(uint8_t *_src, int has_topleft, int has_t SRC(6,0)=SRC(7,1)= (t4 + 2*t5 + t6 + 2) >> 2; SRC(7,0)= (t5 + 2*t6 + t7 + 2) >> 2; } -static void FUNCC(pred8x8l_vertical_right)(uint8_t *_src, int has_topleft, int has_topright, int _stride) +static void FUNCC(pred8x8l_vertical_right)(uint8_t *_src, int has_topleft, + int has_topright, ptrdiff_t _stride) { pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); @@ -962,7 +1035,8 @@ static void FUNCC(pred8x8l_vertical_right)(uint8_t *_src, int has_topleft, int h SRC(7,1)= (t5 + 2*t6 + t7 + 2) >> 2; SRC(7,0)= (t6 + t7 + 1) >> 1; } -static void FUNCC(pred8x8l_horizontal_down)(uint8_t *_src, int has_topleft, int has_topright, int _stride) +static void FUNCC(pred8x8l_horizontal_down)(uint8_t *_src, int has_topleft, + int has_topright, ptrdiff_t _stride) { pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); @@ -992,7 +1066,8 @@ static void FUNCC(pred8x8l_horizontal_down)(uint8_t *_src, int has_topleft, int SRC(6,0)= (t5 + 2*t4 + t3 + 2) >> 2; SRC(7,0)= (t6 + 2*t5 + t4 + 2) >> 2; } -static void FUNCC(pred8x8l_vertical_left)(uint8_t *_src, int has_topleft, int has_topright, int _stride) +static void FUNCC(pred8x8l_vertical_left)(uint8_t *_src, int has_topleft, + int has_topright, ptrdiff_t _stride) { pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); @@ -1021,7 +1096,8 @@ static void FUNCC(pred8x8l_vertical_left)(uint8_t *_src, int has_topleft, int ha SRC(7,6)= (t10 + t11 + 1) >> 1; SRC(7,7)= (t10 + 2*t11 + t12 + 2) >> 2; } -static void FUNCC(pred8x8l_horizontal_up)(uint8_t *_src, int has_topleft, int has_topright, int _stride) +static void FUNCC(pred8x8l_horizontal_up)(uint8_t *_src, int has_topleft, + int has_topright, ptrdiff_t _stride) { pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); @@ -1055,7 +1131,9 @@ static void FUNCC(pred8x8l_horizontal_up)(uint8_t *_src, int has_topleft, int ha #undef PL #undef SRC -static void FUNCC(pred4x4_vertical_add)(uint8_t *_pix, const DCTELEM *_block, int stride){ +static void FUNCC(pred4x4_vertical_add)(uint8_t *_pix, const DCTELEM *_block, + ptrdiff_t stride) +{ int i; pixel *pix = (pixel*)_pix; const dctcoef *block = (const dctcoef*)_block; @@ -1072,7 +1150,9 @@ static void FUNCC(pred4x4_vertical_add)(uint8_t *_pix, const DCTELEM *_block, in } } -static void FUNCC(pred4x4_horizontal_add)(uint8_t *_pix, const DCTELEM *_block, int stride){ +static void FUNCC(pred4x4_horizontal_add)(uint8_t *_pix, const DCTELEM *_block, + ptrdiff_t stride) +{ int i; pixel *pix = (pixel*)_pix; const dctcoef *block = (const dctcoef*)_block; @@ -1088,7 +1168,9 @@ static void FUNCC(pred4x4_horizontal_add)(uint8_t *_pix, const DCTELEM *_block, } } -static void FUNCC(pred8x8l_vertical_add)(uint8_t *_pix, const DCTELEM *_block, int stride){ +static void FUNCC(pred8x8l_vertical_add)(uint8_t *_pix, const DCTELEM *_block, + ptrdiff_t stride) +{ int i; pixel *pix = (pixel*)_pix; const dctcoef *block = (const dctcoef*)_block; @@ -1109,7 +1191,9 @@ static void FUNCC(pred8x8l_vertical_add)(uint8_t *_pix, const DCTELEM *_block, i } } -static void FUNCC(pred8x8l_horizontal_add)(uint8_t *_pix, const DCTELEM *_block, int stride){ +static void FUNCC(pred8x8l_horizontal_add)(uint8_t *_pix, const DCTELEM *_block, + ptrdiff_t stride) +{ int i; pixel *pix = (pixel*)_pix; const dctcoef *block = (const dctcoef*)_block; @@ -1129,25 +1213,36 @@ static void FUNCC(pred8x8l_horizontal_add)(uint8_t *_pix, const DCTELEM *_block, } } -static void FUNCC(pred16x16_vertical_add)(uint8_t *pix, const int *block_offset, const DCTELEM *block, int stride){ +static void FUNCC(pred16x16_vertical_add)(uint8_t *pix, const int *block_offset, + const DCTELEM *block, + ptrdiff_t stride) +{ int i; for(i=0; i<16; i++) FUNCC(pred4x4_vertical_add)(pix + block_offset[i], block + i*16*sizeof(pixel), stride); } -static void FUNCC(pred16x16_horizontal_add)(uint8_t *pix, const int *block_offset, const DCTELEM *block, int stride){ +static void FUNCC(pred16x16_horizontal_add)(uint8_t *pix, + const int *block_offset, + const DCTELEM *block, + ptrdiff_t stride) +{ int i; for(i=0; i<16; i++) FUNCC(pred4x4_horizontal_add)(pix + block_offset[i], block + i*16*sizeof(pixel), stride); } -static void FUNCC(pred8x8_vertical_add)(uint8_t *pix, const int *block_offset, const DCTELEM *block, int stride){ +static void FUNCC(pred8x8_vertical_add)(uint8_t *pix, const int *block_offset, + const DCTELEM *block, ptrdiff_t stride) +{ int i; for(i=0; i<4; i++) FUNCC(pred4x4_vertical_add)(pix + block_offset[i], block + i*16*sizeof(pixel), stride); } -static void FUNCC(pred8x16_vertical_add)(uint8_t *pix, const int *block_offset, const DCTELEM *block, int stride){ +static void FUNCC(pred8x16_vertical_add)(uint8_t *pix, const int *block_offset, + const DCTELEM *block, ptrdiff_t stride) +{ int i; for(i=0; i<4; i++) FUNCC(pred4x4_vertical_add)(pix + block_offset[i], block + i*16*sizeof(pixel), stride); @@ -1155,13 +1250,19 @@ static void FUNCC(pred8x16_vertical_add)(uint8_t *pix, const int *block_offset, FUNCC(pred4x4_vertical_add)(pix + block_offset[i+4], block + i*16*sizeof(pixel), stride); } -static void FUNCC(pred8x8_horizontal_add)(uint8_t *pix, const int *block_offset, const DCTELEM *block, int stride){ +static void FUNCC(pred8x8_horizontal_add)(uint8_t *pix, const int *block_offset, + const DCTELEM *block, + ptrdiff_t stride) +{ int i; for(i=0; i<4; i++) FUNCC(pred4x4_horizontal_add)(pix + block_offset[i], block + i*16*sizeof(pixel), stride); } -static void FUNCC(pred8x16_horizontal_add)(uint8_t *pix, const int *block_offset, const DCTELEM *block, int stride){ +static void FUNCC(pred8x16_horizontal_add)(uint8_t *pix, + const int *block_offset, + const DCTELEM *block, ptrdiff_t stride) +{ int i; for(i=0; i<4; i++) FUNCC(pred4x4_horizontal_add)(pix + block_offset[i], block + i*16*sizeof(pixel), stride); diff --git a/libavcodec/x86/h264_intrapred_init.c b/libavcodec/x86/h264_intrapred_init.c index a686473d75..eebd137a6e 100644 --- a/libavcodec/x86/h264_intrapred_init.c +++ b/libavcodec/x86/h264_intrapred_init.c @@ -23,7 +23,9 @@ #include "libavcodec/h264pred.h" #define PRED4x4(TYPE, DEPTH, OPT) \ -void ff_pred4x4_ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *src, const uint8_t *topright, int stride); +void ff_pred4x4_ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *src, \ + const uint8_t *topright, \ + ptrdiff_t stride); PRED4x4(dc, 10, mmx2) PRED4x4(down_left, 10, sse2) @@ -42,7 +44,8 @@ PRED4x4(horizontal_down, 10, ssse3) PRED4x4(horizontal_down, 10, avx) #define PRED8x8(TYPE, DEPTH, OPT) \ -void ff_pred8x8_ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *src, int stride); +void ff_pred8x8_ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *src, \ + ptrdiff_t stride); PRED8x8(dc, 10, mmx2) PRED8x8(dc, 10, sse2) @@ -52,7 +55,10 @@ PRED8x8(vertical, 10, sse2) PRED8x8(horizontal, 10, sse2) #define PRED8x8L(TYPE, DEPTH, OPT)\ -void ff_pred8x8l_ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *src, int has_topleft, int has_topright, int stride); +void ff_pred8x8l_ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *src, \ + int has_topleft, \ + int has_topright, \ + ptrdiff_t stride); PRED8x8L(dc, 10, sse2) PRED8x8L(dc, 10, avx) @@ -79,7 +85,8 @@ PRED8x8L(horizontal_up, 10, ssse3) PRED8x8L(horizontal_up, 10, avx) #define PRED16x16(TYPE, DEPTH, OPT)\ -void ff_pred16x16_ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *src, int stride); +void ff_pred16x16_ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *src, \ + ptrdiff_t stride); PRED16x16(dc, 10, mmx2) PRED16x16(dc, 10, sse2) From 02e636425970fc9b9aebb31dcc7abbd36e54af2a Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 29 Oct 2012 21:26:46 +0100 Subject: [PATCH 3/6] FATE: fix (AD)PCM test dependencies broken in e519990 Signed-off-by: Diego Biurrun --- tests/fate/acodec.mak | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/fate/acodec.mak b/tests/fate/acodec.mak index 531f2f3f95..71521aba0e 100644 --- a/tests/fate/acodec.mak +++ b/tests/fate/acodec.mak @@ -19,7 +19,7 @@ FATE_ACODEC_PCM-$(call ENCDEC, PCM_F64BE, AU) += f64be FATE_ACODEC_PCM-$(call ENCDEC, PCM_F64LE, WAV) += f64le FATE_ACODEC_PCM := $(FATE_ACODEC_PCM-yes:%=fate-acodec-pcm-%) -FATE_AVCONV += $(FATE_ACODEC_PCM) +FATE_ACODEC += $(FATE_ACODEC_PCM) fate-acodec-pcm: $(FATE_ACODEC_PCM) fate-acodec-pcm-%: FMT = wav @@ -37,7 +37,7 @@ FATE_ACODEC_ADPCM-$(call ENCDEC, ADPCM_SWF, FLV) += swf FATE_ACODEC_ADPCM-$(call ENCDEC, ADPCM_YAMAHA, WAV) += yamaha FATE_ACODEC_ADPCM := $(FATE_ACODEC_ADPCM-yes:%=fate-acodec-adpcm-%) -FATE_AVCONV += $(FATE_ACODEC_ADPCM) +FATE_ACODEC += $(FATE_ACODEC_ADPCM) fate-acodec-adpcm: $(FATE_ACODEC_ADPCM) fate-acodec-adpcm-%: CODEC = adpcm_$(@:fate-acodec-adpcm-%=%) From f454e879238ce317c6d905d187e7608c461a7087 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sat, 27 Oct 2012 16:43:12 +0100 Subject: [PATCH 4/6] configure: rewrite print_config() function using awk This is much faster with slow shells and noticeably faster even with bash on a fast Linux system. Signed-off-by: Mans Rullgard --- configure | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/configure b/configure index 2abc465296..f215c76c08 100755 --- a/configure +++ b/configure @@ -566,31 +566,29 @@ check_deps(){ done } -print_config_h(){ - enabled $1 && v=1 || v=0 - echo "#define $2 $v" -} - -print_config_mak(){ - enabled $1 && v= || v=! - echo "$v$2=yes" -} - -print_config_asm(){ - enabled $1 && v=1 || v=0 - echo "%define $2 $v" -} - print_config(){ pfx=$1 files=$2 shift 2 - for cfg; do - ucname="$(toupper $cfg)" - for f in $files; do - "print_config_${f##*.}" $cfg ${pfx}${ucname} >>$f - done - done + map 'eval echo "$v \${$v:-no}"' "$@" | + awk "BEGIN { split(\"$files\", files) } + { + c = \"$pfx\" toupper(\$1); + v = \$2; + sub(/yes/, 1, v); + sub(/no/, 0, v); + for (f in files) { + file = files[f]; + if (file ~ /\\.h\$/) { + printf(\"#define %s %d\\n\", c, v) >>file; + } else if (file ~ /\\.asm\$/) { + printf(\"%%define %s %d\\n\", c, v) >>file; + } else if (file ~ /\\.mak\$/) { + n = +v ? \"\" : \"!\"; + printf(\"%s%s=yes\\n\", n, c) >>file; + } + } + }" } print_enabled(){ From 26b5ad2543305f0b148e5b91e9773b6a9a185922 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Mon, 29 Oct 2012 19:07:01 +0100 Subject: [PATCH 5/6] swscale: support gray to 9bit and 10bit formats With the input of Kostya and Ronald. --- libswscale/swscale.c | 38 +++++++++++++++++++++++++++++++++-- libswscale/swscale_unscaled.c | 32 +++++++++++++++++++++++++++-- 2 files changed, 66 insertions(+), 4 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 3f54e4dc55..c1920de0a6 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -61,6 +61,28 @@ static av_always_inline void fillPlane(uint8_t *plane, int stride, int width, } } +static void fill_plane9or10(uint8_t *plane, int stride, int width, + int height, int y, uint8_t val, + const int dst_depth, const int big_endian) +{ + int i, j; + uint16_t *dst = (uint16_t *) (plane + stride * y); +#define FILL8TO9_OR_10(wfunc) \ + for (i = 0; i < height; i++) { \ + for (j = 0; j < width; j++) { \ + wfunc(&dst[j], (val << (dst_depth - 8)) | \ + (val >> (16 - dst_depth))); \ + } \ + dst += stride / 2; \ + } + if (big_endian) { + FILL8TO9_OR_10(AV_WB16); + } else { + FILL8TO9_OR_10(AV_WL16); + } +} + + static void hScale16To19_c(SwsContext *c, int16_t *_dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize) @@ -658,8 +680,20 @@ static int swScale(SwsContext *c, const uint8_t *src[], } } - if (isPlanar(dstFormat) && isALPHA(dstFormat) && !alpPixBuf) - fillPlane(dst[3], dstStride[3], dstW, dstY - lastDstY, lastDstY, 255); + if (isPlanar(dstFormat) && isALPHA(dstFormat) && !alpPixBuf) { + int length = dstW; + int height = dstY - lastDstY; + if (is16BPS(c->dstFormat)) + length *= 2; + + if (is9_OR_10BPS(dstFormat)) { + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(dstFormat); + fill_plane9or10(dst[3], dstStride[3], length, height, lastDstY, + 255, desc->comp[3].depth_minus1 + 1, + isBE(dstFormat)); + } else + fillPlane(dst[3], dstStride[3], length, height, lastDstY, 255); + } #if HAVE_MMXEXT_INLINE if (av_get_cpu_flags() & AV_CPU_FLAG_MMXEXT) diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index 5efc647b08..9b919f8aa4 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -98,6 +98,27 @@ static void fillPlane(uint8_t *plane, int stride, int width, int height, int y, } } +static void fill_plane9or10(uint8_t *plane, int stride, int width, + int height, int y, uint8_t val, + const int dst_depth, const int big_endian) +{ + int i, j; + uint16_t *dst = (uint16_t *) (plane + stride * y); +#define FILL8TO9_OR_10(wfunc) \ + for (i = 0; i < height; i++) { \ + for (j = 0; j < width; j++) { \ + wfunc(&dst[j], (val << (dst_depth - 8)) | \ + (val >> (16 - dst_depth))); \ + } \ + dst += stride / 2; \ + } + if (big_endian) { + FILL8TO9_OR_10(AV_WB16); + } else { + FILL8TO9_OR_10(AV_WL16); + } +} + static void copyPlane(const uint8_t *src, int srcStride, int srcSliceY, int srcSliceH, int width, uint8_t *dst, int dstStride) @@ -677,10 +698,17 @@ static int planarCopyWrapper(SwsContext *c, const uint8_t *src[], // ignore palette for GRAY8 if (plane == 1 && !dst[2]) continue; if (!src[plane] || (plane == 1 && !src[2])) { + int val = (plane == 3) ? 255 : 128; if (is16BPS(c->dstFormat)) length *= 2; - fillPlane(dst[plane], dstStride[plane], length, height, y, - (plane == 3) ? 255 : 128); + if (is9_OR_10BPS(c->dstFormat)) { + fill_plane9or10(dst[plane], dstStride[plane], + length, height, y, val, + desc_dst->comp[plane].depth_minus1 + 1, + isBE(c->dstFormat)); + } else + fillPlane(dst[plane], dstStride[plane], length, height, y, + val); } else { if (is9_OR_10BPS(c->srcFormat)) { const int src_depth = desc_src->comp[plane].depth_minus1 + 1; From 7658295ba353b8bedb3af904f46cfb1ba0cea86a Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sun, 14 Oct 2012 08:06:27 +0200 Subject: [PATCH 6/6] pixfmt: support more yuva formats Signed-off-by: Luca Barbato --- libavcodec/raw.c | 19 +++ libavformat/nut.c | 28 ++++ libavutil/pixdesc.c | 234 ++++++++++++++++++++++++++++++++++ libavutil/pixfmt.h | 28 ++++ libswscale/utils.c | 18 +++ tests/ref/lavfi/pixdesc | 18 +++ tests/ref/lavfi/pixfmts_copy | 18 +++ tests/ref/lavfi/pixfmts_null | 18 +++ tests/ref/lavfi/pixfmts_scale | 18 +++ tests/ref/lavfi/pixfmts_vflip | 18 +++ 10 files changed, 417 insertions(+) diff --git a/libavcodec/raw.c b/libavcodec/raw.c index 6f0c9230b9..4ccc6cc075 100644 --- a/libavcodec/raw.c +++ b/libavcodec/raw.c @@ -124,6 +124,25 @@ const PixelFormatTag ff_raw_pix_fmt_tags[] = { { AV_PIX_FMT_YUVA420P, MKTAG('Y', '4', 11 , 8 ) }, { AV_PIX_FMT_Y400A, MKTAG('Y', '2', 0 , 8 ) }, + { AV_PIX_FMT_YUVA420P9LE, MKTAG('Y', '4', 11 , 9 ) }, + { AV_PIX_FMT_YUVA420P9BE, MKTAG( 9 , 11 , '4', 'Y') }, + { AV_PIX_FMT_YUVA422P9LE, MKTAG('Y', '4', 10 , 9 ) }, + { AV_PIX_FMT_YUVA422P9BE, MKTAG( 9 , 10 , '4', 'Y') }, + { AV_PIX_FMT_YUVA444P9LE, MKTAG('Y', '4', 0 , 9 ) }, + { AV_PIX_FMT_YUVA444P9BE, MKTAG( 9 , 0 , '4', 'Y') }, + { AV_PIX_FMT_YUVA420P10LE, MKTAG('Y', '4', 11 , 10 ) }, + { AV_PIX_FMT_YUVA420P10BE, MKTAG(10 , 11 , '4', 'Y') }, + { AV_PIX_FMT_YUVA422P10LE, MKTAG('Y', '4', 10 , 10 ) }, + { AV_PIX_FMT_YUVA422P10BE, MKTAG(10 , 10 , '4', 'Y') }, + { AV_PIX_FMT_YUVA444P10LE, MKTAG('Y', '4', 0 , 10 ) }, + { AV_PIX_FMT_YUVA444P10BE, MKTAG(10 , 0 , '4', 'Y') }, + { AV_PIX_FMT_YUVA420P16LE, MKTAG('Y', '4', 11 , 16 ) }, + { AV_PIX_FMT_YUVA420P16BE, MKTAG(16 , 11 , '4', 'Y') }, + { AV_PIX_FMT_YUVA422P16LE, MKTAG('Y', '4', 10 , 16 ) }, + { AV_PIX_FMT_YUVA422P16BE, MKTAG(16 , 10 , '4', 'Y') }, + { AV_PIX_FMT_YUVA444P16LE, MKTAG('Y', '4', 0 , 16 ) }, + { AV_PIX_FMT_YUVA444P16BE, MKTAG(16 , 0 , '4', 'Y') }, + /* quicktime */ { AV_PIX_FMT_UYVY422, MKTAG('2', 'v', 'u', 'y') }, { AV_PIX_FMT_UYVY422, MKTAG('2', 'V', 'u', 'y') }, diff --git a/libavformat/nut.c b/libavformat/nut.c index 85b126b3b1..65fadbfa47 100644 --- a/libavformat/nut.c +++ b/libavformat/nut.c @@ -92,6 +92,34 @@ const AVCodecTag ff_nut_video_tags[] = { { AV_CODEC_ID_RAWVIDEO, MKTAG(16 , 0 , '3', 'Y') }, { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 11 , 8 ) }, { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '2', 0 , 8 ) }, + + { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '1', 0 , 9 ) }, + { AV_CODEC_ID_RAWVIDEO, MKTAG( 9 , 0 , '1', 'Y') }, + { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 11 , 9 ) }, + { AV_CODEC_ID_RAWVIDEO, MKTAG( 9 , 11 , '4', 'Y') }, + { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 10 , 9 ) }, + { AV_CODEC_ID_RAWVIDEO, MKTAG( 9 , 10 , '4', 'Y') }, + { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 0 , 9 ) }, + { AV_CODEC_ID_RAWVIDEO, MKTAG( 9 , 0 , '4', 'Y') }, + + { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '1', 0 , 10 ) }, + { AV_CODEC_ID_RAWVIDEO, MKTAG(10 , 0 , '1', 'Y') }, + { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 11 , 10 ) }, + { AV_CODEC_ID_RAWVIDEO, MKTAG(10 , 11 , '4', 'Y') }, + { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 10 , 10 ) }, + { AV_CODEC_ID_RAWVIDEO, MKTAG(10 , 10 , '4', 'Y') }, + { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 0 , 10 ) }, + { AV_CODEC_ID_RAWVIDEO, MKTAG(10 , 0 , '4', 'Y') }, + + { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '1', 0 , 16 ) }, + { AV_CODEC_ID_RAWVIDEO, MKTAG(16 , 0 , '1', 'Y') }, + { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 11 , 16 ) }, + { AV_CODEC_ID_RAWVIDEO, MKTAG(16 , 11 , '4', 'Y') }, + { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 10 , 16 ) }, + { AV_CODEC_ID_RAWVIDEO, MKTAG(16 , 10 , '4', 'Y') }, + { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 0 , 16 ) }, + { AV_CODEC_ID_RAWVIDEO, MKTAG(16 , 0 , '4', 'Y') }, + { AV_CODEC_ID_NONE , 0 } }; diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index b8cfabd6ef..bc446b1fab 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -558,6 +558,240 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { }, .flags = PIX_FMT_PLANAR, }, + [AV_PIX_FMT_YUVA420P9BE] = { + .name = "yuva420p9be", + .nb_components = 4, + .log2_chroma_w = 1, + .log2_chroma_h = 1, + .comp = { + { 0, 1, 1, 0, 8 }, /* Y */ + { 1, 1, 1, 0, 8 }, /* U */ + { 2, 1, 1, 0, 8 }, /* V */ + { 3, 1, 1, 0, 8 }, /* A */ + }, + .flags = PIX_FMT_BE | PIX_FMT_PLANAR, + }, + [AV_PIX_FMT_YUVA420P9LE] = { + .name = "yuva420p9le", + .nb_components = 4, + .log2_chroma_w = 1, + .log2_chroma_h = 1, + .comp = { + { 0, 1, 1, 0, 8 }, /* Y */ + { 1, 1, 1, 0, 8 }, /* U */ + { 2, 1, 1, 0, 8 }, /* V */ + { 3, 1, 1, 0, 8 }, /* A */ + }, + .flags = PIX_FMT_PLANAR, + }, + [AV_PIX_FMT_YUVA422P9BE] = { + .name = "yuva422p9be", + .nb_components = 4, + .log2_chroma_w = 1, + .log2_chroma_h = 0, + .comp = { + { 0, 1, 1, 0, 8 }, /* Y */ + { 1, 1, 1, 0, 8 }, /* U */ + { 2, 1, 1, 0, 8 }, /* V */ + { 3, 1, 1, 0, 8 }, /* A */ + }, + .flags = PIX_FMT_BE | PIX_FMT_PLANAR, + }, + [AV_PIX_FMT_YUVA422P9LE] = { + .name = "yuva422p9le", + .nb_components = 4, + .log2_chroma_w = 1, + .log2_chroma_h = 0, + .comp = { + { 0, 1, 1, 0, 8 }, /* Y */ + { 1, 1, 1, 0, 8 }, /* U */ + { 2, 1, 1, 0, 8 }, /* V */ + { 3, 1, 1, 0, 8 }, /* A */ + }, + .flags = PIX_FMT_PLANAR, + }, + [AV_PIX_FMT_YUVA444P9BE] = { + .name = "yuva444p9be", + .nb_components = 4, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 1, 1, 0, 8 }, /* Y */ + { 1, 1, 1, 0, 8 }, /* U */ + { 2, 1, 1, 0, 8 }, /* V */ + { 3, 1, 1, 0, 8 }, /* A */ + }, + .flags = PIX_FMT_BE | PIX_FMT_PLANAR, + }, + [AV_PIX_FMT_YUVA444P9LE] = { + .name = "yuva444p9le", + .nb_components = 4, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 1, 1, 0, 8 }, /* Y */ + { 1, 1, 1, 0, 8 }, /* U */ + { 2, 1, 1, 0, 8 }, /* V */ + { 3, 1, 1, 0, 8 }, /* A */ + }, + .flags = PIX_FMT_PLANAR, + }, + [AV_PIX_FMT_YUVA420P10BE] = { + .name = "yuva420p10be", + .nb_components = 4, + .log2_chroma_w = 1, + .log2_chroma_h = 1, + .comp = { + { 0, 1, 1, 0, 9 }, /* Y */ + { 1, 1, 1, 0, 9 }, /* U */ + { 2, 1, 1, 0, 9 }, /* V */ + { 3, 1, 1, 0, 9 }, /* A */ + }, + .flags = PIX_FMT_BE | PIX_FMT_PLANAR, + }, + [AV_PIX_FMT_YUVA420P10LE] = { + .name = "yuva420p10le", + .nb_components = 4, + .log2_chroma_w = 1, + .log2_chroma_h = 1, + .comp = { + { 0, 1, 1, 0, 15 }, /* Y */ + { 1, 1, 1, 0, 15 }, /* U */ + { 2, 1, 1, 0, 15 }, /* V */ + { 3, 1, 1, 0, 15 }, /* A */ + }, + .flags = PIX_FMT_PLANAR, + }, + [AV_PIX_FMT_YUVA422P10BE] = { + .name = "yuva422p10be", + .nb_components = 4, + .log2_chroma_w = 1, + .log2_chroma_h = 0, + .comp = { + { 0, 1, 1, 0, 15 }, /* Y */ + { 1, 1, 1, 0, 15 }, /* U */ + { 2, 1, 1, 0, 15 }, /* V */ + { 3, 1, 1, 0, 15 }, /* A */ + }, + .flags = PIX_FMT_BE | PIX_FMT_PLANAR, + }, + [AV_PIX_FMT_YUVA422P10LE] = { + .name = "yuva422p10le", + .nb_components = 4, + .log2_chroma_w = 1, + .log2_chroma_h = 0, + .comp = { + { 0, 1, 1, 0, 15 }, /* Y */ + { 1, 1, 1, 0, 15 }, /* U */ + { 2, 1, 1, 0, 15 }, /* V */ + { 3, 1, 1, 0, 15 }, /* A */ + }, + .flags = PIX_FMT_PLANAR, + }, + [AV_PIX_FMT_YUVA444P10BE] = { + .name = "yuva444p10be", + .nb_components = 4, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 1, 1, 0, 15 }, /* Y */ + { 1, 1, 1, 0, 15 }, /* U */ + { 2, 1, 1, 0, 15 }, /* V */ + { 3, 1, 1, 0, 15 }, /* A */ + }, + .flags = PIX_FMT_BE | PIX_FMT_PLANAR, + }, + [AV_PIX_FMT_YUVA444P10LE] = { + .name = "yuva444p10le", + .nb_components = 4, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 1, 1, 0, 15 }, /* Y */ + { 1, 1, 1, 0, 15 }, /* U */ + { 2, 1, 1, 0, 15 }, /* V */ + { 3, 1, 1, 0, 15 }, /* A */ + }, + .flags = PIX_FMT_PLANAR, + }, + [AV_PIX_FMT_YUVA420P16BE] = { + .name = "yuva420p16be", + .nb_components = 4, + .log2_chroma_w = 1, + .log2_chroma_h = 1, + .comp = { + { 0, 1, 1, 0, 15 }, /* Y */ + { 1, 1, 1, 0, 15 }, /* U */ + { 2, 1, 1, 0, 15 }, /* V */ + { 3, 1, 1, 0, 15 }, /* A */ + }, + .flags = PIX_FMT_BE | PIX_FMT_PLANAR, + }, + [AV_PIX_FMT_YUVA420P16LE] = { + .name = "yuva420p16le", + .nb_components = 4, + .log2_chroma_w = 1, + .log2_chroma_h = 1, + .comp = { + { 0, 1, 1, 0, 15 }, /* Y */ + { 1, 1, 1, 0, 15 }, /* U */ + { 2, 1, 1, 0, 15 }, /* V */ + { 3, 1, 1, 0, 15 }, /* A */ + }, + .flags = PIX_FMT_PLANAR, + }, + [AV_PIX_FMT_YUVA422P16BE] = { + .name = "yuva422p16be", + .nb_components = 4, + .log2_chroma_w = 1, + .log2_chroma_h = 0, + .comp = { + { 0, 1, 1, 0, 15 }, /* Y */ + { 1, 1, 1, 0, 15 }, /* U */ + { 2, 1, 1, 0, 15 }, /* V */ + { 3, 1, 1, 0, 15 }, /* A */ + }, + .flags = PIX_FMT_BE | PIX_FMT_PLANAR, + }, + [AV_PIX_FMT_YUVA422P16LE] = { + .name = "yuva422p16le", + .nb_components = 4, + .log2_chroma_w = 1, + .log2_chroma_h = 0, + .comp = { + { 0, 1, 1, 0, 15 }, /* Y */ + { 1, 1, 1, 0, 15 }, /* U */ + { 2, 1, 1, 0, 15 }, /* V */ + { 3, 1, 1, 0, 15 }, /* A */ + }, + .flags = PIX_FMT_PLANAR, + }, + [AV_PIX_FMT_YUVA444P16BE] = { + .name = "yuva444p16be", + .nb_components = 4, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 1, 1, 0, 15 }, /* Y */ + { 1, 1, 1, 0, 15 }, /* U */ + { 2, 1, 1, 0, 15 }, /* V */ + { 3, 1, 1, 0, 15 }, /* A */ + }, + .flags = PIX_FMT_BE | PIX_FMT_PLANAR, + }, + [AV_PIX_FMT_YUVA444P16LE] = { + .name = "yuva444p16le", + .nb_components = 4, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 1, 1, 0, 15 }, /* Y */ + { 1, 1, 1, 0, 15 }, /* U */ + { 2, 1, 1, 0, 15 }, /* V */ + { 3, 1, 1, 0, 15 }, /* A */ + }, + .flags = PIX_FMT_PLANAR, + }, [AV_PIX_FMT_VDPAU_H264] = { .name = "vdpau_h264", .log2_chroma_w = 1, diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index b11a0340db..8e454a85ee 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -160,6 +160,24 @@ enum AVPixelFormat { AV_PIX_FMT_GBRP16LE, ///< planar GBR 4:4:4 48bpp, little endian AV_PIX_FMT_YUVA422P, ///< planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples) AV_PIX_FMT_YUVA444P, ///< planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples) + AV_PIX_FMT_YUVA420P9BE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), big endian + AV_PIX_FMT_YUVA420P9LE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), little endian + AV_PIX_FMT_YUVA422P9BE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big endian + AV_PIX_FMT_YUVA422P9LE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), little endian + AV_PIX_FMT_YUVA444P9BE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big endian + AV_PIX_FMT_YUVA444P9LE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), little endian + AV_PIX_FMT_YUVA420P10BE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big endian) + AV_PIX_FMT_YUVA420P10LE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little endian) + AV_PIX_FMT_YUVA422P10BE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big endian) + AV_PIX_FMT_YUVA422P10LE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little endian) + AV_PIX_FMT_YUVA444P10BE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big endian) + AV_PIX_FMT_YUVA444P10LE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little endian) + AV_PIX_FMT_YUVA420P16BE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big endian) + AV_PIX_FMT_YUVA420P16LE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little endian) + AV_PIX_FMT_YUVA422P16BE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big endian) + AV_PIX_FMT_YUVA422P16LE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little endian) + AV_PIX_FMT_YUVA444P16BE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big endian) + AV_PIX_FMT_YUVA444P16LE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little endian) AV_PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions #if FF_API_PIX_FMT @@ -202,6 +220,16 @@ enum AVPixelFormat { #define AV_PIX_FMT_GBRP10 AV_PIX_FMT_NE(GBRP10BE, GBRP10LE) #define AV_PIX_FMT_GBRP16 AV_PIX_FMT_NE(GBRP16BE, GBRP16LE) +#define AV_PIX_FMT_YUVA420P9 AV_PIX_FMT_NE(YUVA420P9BE , YUVA420P9LE) +#define AV_PIX_FMT_YUVA422P9 AV_PIX_FMT_NE(YUVA422P9BE , YUVA422P9LE) +#define AV_PIX_FMT_YUVA444P9 AV_PIX_FMT_NE(YUVA444P9BE , YUVA444P9LE) +#define AV_PIX_FMT_YUVA420P10 AV_PIX_FMT_NE(YUVA420P10BE, YUVA420P10LE) +#define AV_PIX_FMT_YUVA422P10 AV_PIX_FMT_NE(YUVA422P10BE, YUVA422P10LE) +#define AV_PIX_FMT_YUVA444P10 AV_PIX_FMT_NE(YUVA444P10BE, YUVA444P10LE) +#define AV_PIX_FMT_YUVA420P16 AV_PIX_FMT_NE(YUVA420P16BE, YUVA420P16LE) +#define AV_PIX_FMT_YUVA422P16 AV_PIX_FMT_NE(YUVA422P16BE, YUVA422P16LE) +#define AV_PIX_FMT_YUVA444P16 AV_PIX_FMT_NE(YUVA444P16BE, YUVA444P16LE) + #if FF_API_PIX_FMT #define PixelFormat AVPixelFormat diff --git a/libswscale/utils.c b/libswscale/utils.c index a40dfe7c00..f68f1207c4 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -110,6 +110,24 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = { [AV_PIX_FMT_YUVA420P] = { 1, 1 }, [AV_PIX_FMT_YUVA422P] = { 1, 1 }, [AV_PIX_FMT_YUVA444P] = { 1, 1 }, + [AV_PIX_FMT_YUVA420P9BE] = { 1, 1 }, + [AV_PIX_FMT_YUVA420P9LE] = { 1, 1 }, + [AV_PIX_FMT_YUVA422P9BE] = { 1, 1 }, + [AV_PIX_FMT_YUVA422P9LE] = { 1, 1 }, + [AV_PIX_FMT_YUVA444P9BE] = { 1, 1 }, + [AV_PIX_FMT_YUVA444P9LE] = { 1, 1 }, + [AV_PIX_FMT_YUVA420P10BE]= { 1, 1 }, + [AV_PIX_FMT_YUVA420P10LE]= { 1, 1 }, + [AV_PIX_FMT_YUVA422P10BE]= { 1, 1 }, + [AV_PIX_FMT_YUVA422P10LE]= { 1, 1 }, + [AV_PIX_FMT_YUVA444P10BE]= { 1, 1 }, + [AV_PIX_FMT_YUVA444P10LE]= { 1, 1 }, + [AV_PIX_FMT_YUVA420P16BE]= { 1, 1 }, + [AV_PIX_FMT_YUVA420P16LE]= { 1, 1 }, + [AV_PIX_FMT_YUVA422P16BE]= { 1, 1 }, + [AV_PIX_FMT_YUVA422P16LE]= { 1, 1 }, + [AV_PIX_FMT_YUVA444P16BE]= { 1, 1 }, + [AV_PIX_FMT_YUVA444P16LE]= { 1, 1 }, [AV_PIX_FMT_RGB48BE] = { 1, 1 }, [AV_PIX_FMT_RGB48LE] = { 1, 1 }, [AV_PIX_FMT_RGB565BE] = { 1, 1 }, diff --git a/tests/ref/lavfi/pixdesc b/tests/ref/lavfi/pixdesc index dc1b8572dc..5716cf11b1 100644 --- a/tests/ref/lavfi/pixdesc +++ b/tests/ref/lavfi/pixdesc @@ -57,8 +57,26 @@ yuv444p16le 20f86bc2f68d2b3f1f2b48b97b2189f4 yuv444p9be 6ab31f4c12b533ce318ecdff83cdd054 yuv444p9le f0606604a5c08becab6ba500124c4b7c yuva420p a29884f3f3dfe1e00b961bc17bef3d47 +yuva420p10be 145366ff1632de3e300d947f49844284 +yuva420p10le 242b310218a41aacc59f78f42f949d60 +yuva420p16be 25a335f66a0670911ced818aa42fb670 +yuva420p16le 97bf252e6c030f0f0412d3826c2ea259 +yuva420p9be 06b764d85bd3c22e9b7ca4babed84d4f +yuva420p9le 1f01cdd4fc46f98d4c11b2947307a0e3 yuva422p 92b6815f465297284cdb843711682cee +yuva422p10be c8722cb6e86d478f501d514a2d004867 +yuva422p10le 5c2767a47c94966052955bc48f72dd94 +yuva422p16be ef442b11b26e5e61f3c958fa309576dd +yuva422p16le 5789009759d7a44dacc6da2194e402b1 +yuva422p9be e0d2f45f7f5541eee988137c7ebb3495 +yuva422p9le a4ec81f328efd3856dec430fb27f2f56 yuva444p c523716e4900cfe515eaab1d7124fdd9 +yuva444p10be 03df7c3936c25626ea596c28e0466129 +yuva444p10le 55398bb467bc7957288d59af9f0bfadd +yuva444p16be ee7b9dd854e36b165d5b7cffb646ba6c +yuva444p16le ec93b2907923d5655e9fb085479260ef +yuva444p9be 03414257d78e72c28d03e3c247319b7c +yuva444p9le e421d753257e36a79c2c0ec1607ac9e6 yuvj420p 32eec78ba51857b16ce9b813a49b7189 yuvj422p 0dfa0ed434f73be51428758c69e082cb yuvj440p 657501a28004e27a592757a7509f5189 diff --git a/tests/ref/lavfi/pixfmts_copy b/tests/ref/lavfi/pixfmts_copy index dc1b8572dc..5716cf11b1 100644 --- a/tests/ref/lavfi/pixfmts_copy +++ b/tests/ref/lavfi/pixfmts_copy @@ -57,8 +57,26 @@ yuv444p16le 20f86bc2f68d2b3f1f2b48b97b2189f4 yuv444p9be 6ab31f4c12b533ce318ecdff83cdd054 yuv444p9le f0606604a5c08becab6ba500124c4b7c yuva420p a29884f3f3dfe1e00b961bc17bef3d47 +yuva420p10be 145366ff1632de3e300d947f49844284 +yuva420p10le 242b310218a41aacc59f78f42f949d60 +yuva420p16be 25a335f66a0670911ced818aa42fb670 +yuva420p16le 97bf252e6c030f0f0412d3826c2ea259 +yuva420p9be 06b764d85bd3c22e9b7ca4babed84d4f +yuva420p9le 1f01cdd4fc46f98d4c11b2947307a0e3 yuva422p 92b6815f465297284cdb843711682cee +yuva422p10be c8722cb6e86d478f501d514a2d004867 +yuva422p10le 5c2767a47c94966052955bc48f72dd94 +yuva422p16be ef442b11b26e5e61f3c958fa309576dd +yuva422p16le 5789009759d7a44dacc6da2194e402b1 +yuva422p9be e0d2f45f7f5541eee988137c7ebb3495 +yuva422p9le a4ec81f328efd3856dec430fb27f2f56 yuva444p c523716e4900cfe515eaab1d7124fdd9 +yuva444p10be 03df7c3936c25626ea596c28e0466129 +yuva444p10le 55398bb467bc7957288d59af9f0bfadd +yuva444p16be ee7b9dd854e36b165d5b7cffb646ba6c +yuva444p16le ec93b2907923d5655e9fb085479260ef +yuva444p9be 03414257d78e72c28d03e3c247319b7c +yuva444p9le e421d753257e36a79c2c0ec1607ac9e6 yuvj420p 32eec78ba51857b16ce9b813a49b7189 yuvj422p 0dfa0ed434f73be51428758c69e082cb yuvj440p 657501a28004e27a592757a7509f5189 diff --git a/tests/ref/lavfi/pixfmts_null b/tests/ref/lavfi/pixfmts_null index dc1b8572dc..5716cf11b1 100644 --- a/tests/ref/lavfi/pixfmts_null +++ b/tests/ref/lavfi/pixfmts_null @@ -57,8 +57,26 @@ yuv444p16le 20f86bc2f68d2b3f1f2b48b97b2189f4 yuv444p9be 6ab31f4c12b533ce318ecdff83cdd054 yuv444p9le f0606604a5c08becab6ba500124c4b7c yuva420p a29884f3f3dfe1e00b961bc17bef3d47 +yuva420p10be 145366ff1632de3e300d947f49844284 +yuva420p10le 242b310218a41aacc59f78f42f949d60 +yuva420p16be 25a335f66a0670911ced818aa42fb670 +yuva420p16le 97bf252e6c030f0f0412d3826c2ea259 +yuva420p9be 06b764d85bd3c22e9b7ca4babed84d4f +yuva420p9le 1f01cdd4fc46f98d4c11b2947307a0e3 yuva422p 92b6815f465297284cdb843711682cee +yuva422p10be c8722cb6e86d478f501d514a2d004867 +yuva422p10le 5c2767a47c94966052955bc48f72dd94 +yuva422p16be ef442b11b26e5e61f3c958fa309576dd +yuva422p16le 5789009759d7a44dacc6da2194e402b1 +yuva422p9be e0d2f45f7f5541eee988137c7ebb3495 +yuva422p9le a4ec81f328efd3856dec430fb27f2f56 yuva444p c523716e4900cfe515eaab1d7124fdd9 +yuva444p10be 03df7c3936c25626ea596c28e0466129 +yuva444p10le 55398bb467bc7957288d59af9f0bfadd +yuva444p16be ee7b9dd854e36b165d5b7cffb646ba6c +yuva444p16le ec93b2907923d5655e9fb085479260ef +yuva444p9be 03414257d78e72c28d03e3c247319b7c +yuva444p9le e421d753257e36a79c2c0ec1607ac9e6 yuvj420p 32eec78ba51857b16ce9b813a49b7189 yuvj422p 0dfa0ed434f73be51428758c69e082cb yuvj440p 657501a28004e27a592757a7509f5189 diff --git a/tests/ref/lavfi/pixfmts_scale b/tests/ref/lavfi/pixfmts_scale index acd40e3451..d8ae09cf09 100644 --- a/tests/ref/lavfi/pixfmts_scale +++ b/tests/ref/lavfi/pixfmts_scale @@ -57,8 +57,26 @@ yuv444p16le a0c5d3c7bf3f181db503cf8e450d1335 yuv444p9be 9ac2643ce7f7e5c4e17c8c9fd8494d4a yuv444p9le 896a1cc9cccca1ba410dd53942d33cc4 yuva420p 8673a9131fb47de69788863f93a50eb7 +yuva420p10be cf397b35db9407496093b2ad64f3106c +yuva420p10le 8a06c377b8aa2b2979054e074582a5b5 +yuva420p16be a61d8ddb646e2d26020fc7ed2a48c1a9 +yuva420p16le 90ef774f86ad3177ec57eca8744b4e09 +yuva420p9be b43d5d88a474c80abad8e887eb5a3317 +yuva420p9le ada2b719827059d70ebc57e2a3f9da92 yuva422p 3c76ebeca0a7d3aa5f8e31ef80a86ffe +yuva422p10be c12a427d2b8fc84f93fd3cf9fd5bcb14 +yuva422p10le aefcda062e7e3463c887faa9d926aca7 +yuva422p16be a31bd04c58c22690f2a7c745f34cf48f +yuva422p16le 0bc3720dba6076dcce3b74b1d3c6c4b7 +yuva422p9be b21d2aa97ff643c86bbc08b578729c39 +yuva422p9le c3eda8831e9b9c94a3eb487d33114103 yuva444p 3268c6abe5e3cdbd16552a1eddced816 +yuva444p10be 4f6eaf2bbe8a083773b9f061fec20e41 +yuva444p10le 2eeda83856df77760cd30e477e8ba00b +yuva444p16be 3587f05da58a8435aad648506562d39b +yuva444p16le 3a3df23feb60d8832b566fd9765983d0 +yuva444p9be d5342be0074975ea65907f5b65c7a335 +yuva444p9le c41849b0134670d6f6253c337defbb04 yuvj420p 30427bd6caf5bda93a173dbebe759e09 yuvj422p fc8288f64fd149573f73cf8da05d8e6d yuvj440p 508ac7a9ddeb6d1794a1100ba7a1664c diff --git a/tests/ref/lavfi/pixfmts_vflip b/tests/ref/lavfi/pixfmts_vflip index a4dffb9c22..d820518aa8 100644 --- a/tests/ref/lavfi/pixfmts_vflip +++ b/tests/ref/lavfi/pixfmts_vflip @@ -57,8 +57,26 @@ yuv444p16le 8e83323cf102d6c823a03ae8a7b7e033 yuv444p9be 6ac92b7dc9ab2fc59bee99204886899a yuv444p9le 85aef13a654953d3455d89770b0d74bd yuva420p c705d1cf061d8c6580ac690b55f92276 +yuva420p10be baa5e3b0ff6d0ebbb0958560cd763c6e +yuva420p10le 32473853156341586ed716090427fc10 +yuva420p16be bf3b134eb70878df9afba61d03e930b8 +yuva420p16le 105d375154329a381aa58379a0a6ec46 +yuva420p9be 8273d591e055f48990c29dd905a6cdfd +yuva420p9le 95ced0bb07e422d98db61a35cdb3fb8f yuva422p 6aed0ea657ed51cc047a4fbdd981aec8 +yuva422p10be b76d8be9b4035d3164c35a2fdb020636 +yuva422p10le 09aa2454075f999dbd3175b5c435dacf +yuva422p16be 39552c259ca242f2417e913ffc602fde +yuva422p16le 16faa558a34291ca32f6d94dce211ee2 +yuva422p9be a951eafb62c092c63f7566b6803f60df +yuva422p9le 00b39cfca78666e057ee527f5e174a04 yuva444p da5d64f2b2bd2013c186456f595fad65 +yuva444p10be 09375aa0c3a60436fc65ca0da76ca542 +yuva444p10le a4baf701134c7ff33f806ad00501d8f5 +yuva444p16be 7e9b799b057e1446dabbf0f738480cfb +yuva444p16le 556d58b91a617fe4a83af99a4aea1c2e +yuva444p9be b5a31de4fac408eeecaf3aff11f40e55 +yuva444p9le 67467f1e1d9edbd59d3984ebbfe24be6 yuvj420p 41fd02b204da0ab62452cd14b595e2e4 yuvj422p 7f6ca9bc1812cde02036d7d29a7cce43 yuvj440p 25711c3c0fd15ec19c59a10784fcfb96