On Fri, Mar 25, 2016 at 11:46 PM, Matthieu Bouron <matthieu.bou...@gmail.com > wrote:
> From: Matthieu Bouron <matthieu.bou...@stupeflix.com> > > --- > libswscale/arm/swscale_unscaled.c | 16 +++---- > libswscale/arm/yuv2rgb_neon.S | 89 > +++++++++++++++++---------------------- > 2 files changed, 47 insertions(+), 58 deletions(-) > > Patch updated (resolve a conflict with the updated version of patch 06/10).
From 24b2371eb5ea859b2a68ef1ee3cf9a0098d9375a Mon Sep 17 00:00:00 2001 From: Matthieu Bouron <matthieu.bou...@stupeflix.com> Date: Wed, 23 Mar 2016 16:51:20 +0000 Subject: [PATCH 10/10] swscale/arm/yuv2rgb: make the code bitexact with its aarch64 counter part --- libswscale/arm/swscale_unscaled.c | 16 +++---- libswscale/arm/yuv2rgb_neon.S | 89 +++++++++++++++++---------------------- 2 files changed, 47 insertions(+), 58 deletions(-) diff --git a/libswscale/arm/swscale_unscaled.c b/libswscale/arm/swscale_unscaled.c index 149208c..1986d65 100644 --- a/libswscale/arm/swscale_unscaled.c +++ b/libswscale/arm/swscale_unscaled.c @@ -62,10 +62,10 @@ static int rgbx_to_nv12_neon_16_wrapper(SwsContext *context, const uint8_t *src[ } #define YUV_TO_RGB_TABLE \ - c->yuv2rgb_v2r_coeff / (1 << 7), \ - c->yuv2rgb_u2g_coeff / (1 << 7), \ - c->yuv2rgb_v2g_coeff / (1 << 7), \ - c->yuv2rgb_u2b_coeff / (1 << 7), \ + c->yuv2rgb_v2r_coeff, \ + c->yuv2rgb_u2g_coeff, \ + c->yuv2rgb_v2g_coeff, \ + c->yuv2rgb_u2b_coeff, \ #define DECLARE_FF_YUVX_TO_RGBX_FUNCS(ifmt, ofmt) \ int ff_##ifmt##_to_##ofmt##_neon(int w, int h, \ @@ -88,8 +88,8 @@ static int ifmt##_to_##ofmt##_neon_wrapper(SwsContext *c, const uint8_t *src[], src[1], srcStride[1], \ src[2], srcStride[2], \ yuv2rgb_table, \ - c->yuv2rgb_y_offset >> 9, \ - c->yuv2rgb_y_coeff / (1 << 7)); \ + c->yuv2rgb_y_offset >> 6, \ + c->yuv2rgb_y_coeff); \ \ return 0; \ } \ @@ -121,8 +121,8 @@ static int ifmt##_to_##ofmt##_neon_wrapper(SwsContext *c, const uint8_t *src[], dst[0] + srcSliceY * dstStride[0], dstStride[0], \ src[0], srcStride[0], src[1], srcStride[1], \ yuv2rgb_table, \ - c->yuv2rgb_y_offset >> 9, \ - c->yuv2rgb_y_coeff / (1 << 7)); \ + c->yuv2rgb_y_offset >> 6, \ + c->yuv2rgb_y_coeff); \ \ return 0; \ } \ diff --git a/libswscale/arm/yuv2rgb_neon.S b/libswscale/arm/yuv2rgb_neon.S index 4a5ce11..bd994e3 100644 --- a/libswscale/arm/yuv2rgb_neon.S +++ b/libswscale/arm/yuv2rgb_neon.S @@ -68,14 +68,14 @@ .macro load_chroma_nv12 vld2.8 {d2, d3}, [r6]! @ q1: interleaved chroma line - vsubl.u8 q14, d2, d10 @ q14 = U - 128 - vsubl.u8 q15, d3, d10 @ q15 = V - 128 + vshll.u8 q14, d2, #3 @ q14 = U * (1 << 3) + vshll.u8 q15, d3, #3 @ q15 = V * (1 << 3) .endm .macro load_chroma_nv21 vld2.8 {d2, d3}, [r6]! @ q1: interleaved chroma line - vsubl.u8 q14, d3, d10 @ q14 = U - 128 - vsubl.u8 q15, d2, d10 @ q15 = V - 128 + vshll.u8 q14, d3, #3 @ q14 = U * (1 << 3) + vshll.u8 q15, d2, #3 @ q15 = V * (1 << 3) .endm .macro load_chroma_yuv420p @@ -83,8 +83,8 @@ vld1.8 d2, [r6]! @ d2: chroma red line vld1.8 d3, [r10]! @ d3: chroma blue line - vsubl.u8 q14, d2, d10 @ q14 = U - 128 - vsubl.u8 q15, d3, d10 @ q15 = V - 128 + vshll.u8 q14, d2, #3 @ q14 = U * (1 << 3) + vshll.u8 q15, d3, #3 @ q15 = V * (1 << 3) .endm .macro load_chroma_yuv422p @@ -116,17 +116,17 @@ add r10,r10,r12 @ srcV += paddingV .endm -.macro compute_color dst_comp1 dst_comp2 pre1 pre2 - vadd.s16 q1, q14, \pre1 - vadd.s16 q2, q15, \pre2 - vqrshrun.s16 \dst_comp1, q1, #6 - vqrshrun.s16 \dst_comp2, q2, #6 +.macro compute_color dst_comp1 dst_comp2 pre + vadd.s16 q1, q14, \pre + vadd.s16 q2, q15, \pre + vqrshrun.s16 \dst_comp1, q1, #1 + vqrshrun.s16 \dst_comp2, q2, #1 .endm .macro compute_rgba r1 g1 b1 a1 r2 g2 b2 a2 - compute_color \r1, \r2, q8, q9 - compute_color \g1, \g2, q10, q11 - compute_color \b1, \b2, q12, q13 + compute_color \r1, \r2, q8 + compute_color \g1, \g2, q9 + compute_color \b1, \b2, q10 vmov.u8 \a1, #255 vmov.u8 \a2, #255 .endm @@ -134,48 +134,33 @@ .macro declare_func ifmt ofmt function ff_\ifmt\()_to_\ofmt\()_neon, export=1 load_args_\ifmt + vmov.u16 q11, #1024 @ q11 = 128 * (1 << 3) + vdup.16 q12, r9 @ q12 = y_offset + vmov d26, d0 @ q13 = y_coeff + vmov d27, d0 @ q13 = y_coeff 1: mov r8, r0 @ r8 = width 2: pld [r6, #64*3] pld [r4, #64*3] - vmov.i8 d10, #128 load_chroma_\ifmt - vmov d2, d28 @ copy left q14 to left q1 - vmov d3, d28 @ copy left q14 to right q1 - vmov d4, d29 @ copy right q14 to left q2 - vmov d5, d29 @ copy right q14 to right q2 - - vmov d6, d30 @ copy left q15 to left q3 - vmov d7, d30 @ copy left q15 to right q3 - vmov d8, d31 @ copy right q15 to left q4 - vmov d9, d31 @ copy right q15 to right q4 - - vzip.16 d2, d3 @ U1U1U2U2U3U3U4U4 - vzip.16 d4, d5 @ U5U5U6U6U7U7U8U8 - - vzip.16 d6, d7 @ V1V1V2V2V3V3V4V4 - vzip.16 d8, d9 @ V5V5V6V6V7V7V8V8 - - vmul.s16 q8, q3, d1[0] @ V * v2r (left, red) - vmul.s16 q9, q4, d1[0] @ V * v2r (right, red) - vmul.s16 q10, q1, d1[1] @ U * u2g - vmul.s16 q11, q2, d1[1] @ U * u2g - vmla.s16 q10, q3, d1[2] @ U * u2g + V * v2g (left, green) - vmla.s16 q11, q4, d1[2] @ U * u2g + V * v2g (right, green) - vmul.s16 q12, q1, d1[3] @ U * u2b (left, blue) - vmul.s16 q13, q2, d1[3] @ U * u2b (right, blue) - - vld1.8 {q7}, [r4]! - vmovl.u8 q14, d14 @ 8px of y - vmovl.u8 q15, d15 @ 8px of y - vdup.16 q5, r9 @ q5 = y_offset - vmov d14, d0 @ q7 = y_coeff - vmov d15, d0 @ q7 = y_coeff - vsub.s16 q14, q5 - vsub.s16 q15, q5 - vmul.s16 q14, q7 @ q14 = (srcY - y_offset) * y_coeff (left) - vmul.s16 q15, q7 @ q15 = (srcY - y_offset) * y_coeff (right) + vsub.u16 q14, q11 @ q14 = U * (1 << 3) - 128 * (1 << 3) + vsub.u16 q15, q11 @ q15 = V * (1 << 3) - 128 * (1 << 3) + vqdmulh.s16 q8, q15, d1[0] @ q8 = V * v2r + vqdmulh.s16 q9, q14, d1[1] @ q9 = U * u2g + vqdmulh.s16 q5, q15, d1[2] + vadd.s16 q9, q5 @ q9 = U * u2g + V * v2g + vqdmulh.s16 q10,q14, d1[3] @ q10 = U * u2b + + vld2.8 {d14, d15}, [r4]! @ q1 = Y (interleaved) + vshll.u8 q14, d14, #3 @ q14 = Y * (1 << 3) + vshll.u8 q15, d15, #3 @ q15 = Y * (1 << 3) + + vsub.s16 q14, q12 @ q14 = (srcY - y_offset) + vsub.s16 q15, q12 @ q15 = (srcY - y_offset) + + vqdmulh.s16 q14, q13 @ q14 = (srcY - y_offset) * y_coeff + vqdmulh.s16 q15, q13 @ q15 = (srcY - y_offset) * y_coeff .ifc \ofmt,argb compute_rgba d7, d8, d9, d6, d11, d12, d13, d10 @@ -193,6 +178,10 @@ function ff_\ifmt\()_to_\ofmt\()_neon, export=1 compute_rgba d8, d7, d6, d9, d12, d11, d10, d13 .endif + vzip.8 d6, d10 + vzip.8 d7, d11 + vzip.8 d8, d12 + vzip.8 d9, d13 vst4.8 {q3, q4}, [r2,:128]! vst4.8 {q5, q6}, [r2,:128]! subs r8, r8, #16 @ width -= 16 -- 2.7.4
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel