diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2012-02-05 16:00:46 +0400 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2012-02-05 16:00:46 +0400 |
commit | 9701202bc2346baa0ace21370e2922ace78e232e (patch) | |
tree | 20b4e4bba2a37325a3e6d946d47ccc1b908384ed /decoder/LAVVideo/pixconv | |
parent | 0fba6a6ac0c744a91bfc493a6df573e392cc6e48 (diff) |
Increase YUV420 10-bit -> YV12/NV12 dithering randomness
Diffstat (limited to 'decoder/LAVVideo/pixconv')
-rw-r--r-- | decoder/LAVVideo/pixconv/yuv2yuv_unscaled.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/decoder/LAVVideo/pixconv/yuv2yuv_unscaled.cpp b/decoder/LAVVideo/pixconv/yuv2yuv_unscaled.cpp index c787da2b..59380697 100644 --- a/decoder/LAVVideo/pixconv/yuv2yuv_unscaled.cpp +++ b/decoder/LAVVideo/pixconv/yuv2yuv_unscaled.cpp @@ -42,7 +42,7 @@ DECLARE_CONV_FUNC_IMPL(convert_yuv_yv_nv12_dither_le) int chromaHeight = height; LAVDitherMode ditherMode = m_pSettings->GetDitherMode(); - const uint16_t *dithers = GetRandomDitherCoeffs(height, 2, 8, 0); + const uint16_t *dithers = GetRandomDitherCoeffs(height, 4, 8, 0); if (dithers == NULL) ditherMode = LAVDither_Ordered; @@ -65,23 +65,29 @@ DECLARE_CONV_FUNC_IMPL(convert_yuv_yv_nv12_dither_le) for (line = 0; line < height; ++line) { // Load dithering coefficients for this line if (ditherMode == LAVDither_Random) { - xmm4 = _mm_load_si128((const __m128i *)(dithers + (line << 4) + 0)); - xmm5 = _mm_load_si128((const __m128i *)(dithers + (line << 4) + 8)); + xmm4 = _mm_load_si128((const __m128i *)(dithers + (line << 5) + 0)); + xmm5 = _mm_load_si128((const __m128i *)(dithers + (line << 5) + 8)); + xmm6 = _mm_load_si128((const __m128i *)(dithers + (line << 5) + 16)); + xmm7 = _mm_load_si128((const __m128i *)(dithers + (line << 5) + 24)); } else { - PIXCONV_LOAD_DITHER_COEFFS(xmm4,line,8,dithers); - xmm5 = xmm4; + PIXCONV_LOAD_DITHER_COEFFS(xmm7,line,8,dithers); + xmm4 = xmm5 = xmm6 = xmm7; } __m128i *dst128Y = (__m128i *)(dst + line * outLumaStride); - for (i = 0; i < width; i+=16) { + for (i = 0; i < width; i+=32) { // Load pixels into registers, and apply dithering - PIXCONV_LOAD_PIXEL16_DITHER(xmm0, xmm4, (y+i), shift); /* Y0Y0Y0Y0 */ - PIXCONV_LOAD_PIXEL16_DITHER(xmm1, xmm5, (y+i+8), shift); /* Y0Y0Y0Y0 */ - xmm0 = _mm_packus_epi16(xmm0, xmm1); /* YYYYYYYY */ + PIXCONV_LOAD_PIXEL16_DITHER(xmm0, xmm4, (y+i+ 0), shift); /* Y0Y0Y0Y0 */ + PIXCONV_LOAD_PIXEL16_DITHER(xmm1, xmm5, (y+i+ 8), shift); /* Y0Y0Y0Y0 */ + PIXCONV_LOAD_PIXEL16_DITHER(xmm2, xmm6, (y+i+16), shift); /* Y0Y0Y0Y0 */ + PIXCONV_LOAD_PIXEL16_DITHER(xmm3, xmm7, (y+i+24), shift); /* Y0Y0Y0Y0 */ + xmm0 = _mm_packus_epi16(xmm0, xmm1); /* YYYYYYYY */ + xmm2 = _mm_packus_epi16(xmm2, xmm3); /* YYYYYYYY */ // Write data back _mm_stream_si128(dst128Y++, xmm0); + _mm_stream_si128(dst128Y++, xmm2); } y += inYStride; |