Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/LAVFilters.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2013-05-10 01:03:28 +0400
committerHendrik Leppkes <h.leppkes@gmail.com>2013-05-10 01:06:34 +0400
commitba20c2b394e85091d65ae2dd21c0a9955a972c44 (patch)
treefe976713a0109a4699c60f7f8453d274dc93bd18 /decoder
parent55b1456f50f0cb0e74be8d7faec76a09eb27e829 (diff)
Switch the internal RGB48 format to the more common RGB component order
Diffstat (limited to 'decoder')
-rw-r--r--decoder/LAVVideo/decoders/ILAVDecoder.h2
-rw-r--r--decoder/LAVVideo/decoders/avcodec.cpp4
-rw-r--r--decoder/LAVVideo/decoders/pixfmt.cpp2
-rw-r--r--decoder/LAVVideo/pixconv/rgb2rgb_unscaled.cpp14
4 files changed, 15 insertions, 7 deletions
diff --git a/decoder/LAVVideo/decoders/ILAVDecoder.h b/decoder/LAVVideo/decoders/ILAVDecoder.h
index fa015f3a..c35c953c 100644
--- a/decoder/LAVVideo/decoders/ILAVDecoder.h
+++ b/decoder/LAVVideo/decoders/ILAVDecoder.h
@@ -50,7 +50,7 @@ typedef enum LAVPixelFormat {
LAVPixFmt_RGB24, ///< RGB24, in BGR order
LAVPixFmt_RGB32, ///< RGB32, in BGRA order (A is invalid and should be 0xFF)
LAVPixFmt_ARGB32, ///< ARGB32, in BGRA order
- LAVPixFmt_RGB48, ///< RGB48, in BGR order (16-bit per pixel)
+ LAVPixFmt_RGB48, ///< RGB48, in RGB order (16-bit per pixel)
LAVPixFmt_DXVA2, ///< DXVA2 Surface
diff --git a/decoder/LAVVideo/decoders/avcodec.cpp b/decoder/LAVVideo/decoders/avcodec.cpp
index d8516b99..b3411e86 100644
--- a/decoder/LAVVideo/decoders/avcodec.cpp
+++ b/decoder/LAVVideo/decoders/avcodec.cpp
@@ -161,7 +161,7 @@ static struct PixelFormatMapping {
{ AV_PIX_FMT_YUVJ440P, LAVPixFmt_YUV444, TRUE },
{ AV_PIX_FMT_YUVA420P, LAVPixFmt_YUV420, TRUE },
{ AV_PIX_FMT_RGB48BE, LAVPixFmt_RGB48, TRUE },
- { AV_PIX_FMT_RGB48LE, LAVPixFmt_RGB48, TRUE },
+ { AV_PIX_FMT_RGB48LE, LAVPixFmt_RGB48, FALSE },
{ AV_PIX_FMT_RGB565BE, LAVPixFmt_RGB32, TRUE },
{ AV_PIX_FMT_RGB565LE, LAVPixFmt_RGB32, TRUE },
@@ -186,7 +186,7 @@ static struct PixelFormatMapping {
{ AV_PIX_FMT_BGR444BE, LAVPixFmt_RGB32, TRUE },
{ AV_PIX_FMT_GRAY8A, LAVPixFmt_YUV420, TRUE },
{ AV_PIX_FMT_BGR48BE, LAVPixFmt_RGB48, TRUE },
- { AV_PIX_FMT_BGR48LE, LAVPixFmt_RGB48, FALSE },
+ { AV_PIX_FMT_BGR48LE, LAVPixFmt_RGB48, TRUE },
{ AV_PIX_FMT_YUV420P9BE, LAVPixFmt_YUV420bX, TRUE, 9 },
{ AV_PIX_FMT_YUV420P9LE, LAVPixFmt_YUV420bX, FALSE, 9 },
diff --git a/decoder/LAVVideo/decoders/pixfmt.cpp b/decoder/LAVVideo/decoders/pixfmt.cpp
index 4a265c62..a9de2511 100644
--- a/decoder/LAVVideo/decoders/pixfmt.cpp
+++ b/decoder/LAVVideo/decoders/pixfmt.cpp
@@ -52,7 +52,7 @@ static struct {
{ LAVPixFmt_RGB24, AV_PIX_FMT_BGR24 },
{ LAVPixFmt_RGB32, AV_PIX_FMT_BGRA },
{ LAVPixFmt_ARGB32, AV_PIX_FMT_BGRA },
- { LAVPixFmt_RGB48, AV_PIX_FMT_BGR48LE },
+ { LAVPixFmt_RGB48, AV_PIX_FMT_RGB48LE },
};
AVPixelFormat getFFPixelFormatFromLAV(LAVPixelFormat pixFmt, int bpp)
diff --git a/decoder/LAVVideo/pixconv/rgb2rgb_unscaled.cpp b/decoder/LAVVideo/pixconv/rgb2rgb_unscaled.cpp
index 7fd9b6f5..47a75a91 100644
--- a/decoder/LAVVideo/pixconv/rgb2rgb_unscaled.cpp
+++ b/decoder/LAVVideo/pixconv/rgb2rgb_unscaled.cpp
@@ -39,7 +39,7 @@ DECLARE_CONV_FUNC_IMPL(convert_rgb48_rgb32_ssse3)
ditherMode = LAVDither_Ordered;
__m128i xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7;
- __m128i mask = _mm_setr_epi8(0,1,2,3,4,5,-1,-1,6,7,8,9,10,11,-1,-1);
+ __m128i mask = _mm_setr_epi8(4,5,2,3,0,1,-1,-1,10,11,8,9,6,7,-1,-1);
_mm_sfence();
for (line = 0; line < height; line++) {
@@ -86,11 +86,18 @@ DECLARE_CONV_FUNC_IMPL(convert_rgb48_rgb32_ssse3)
template <int out32>
DECLARE_CONV_FUNC_IMPL(convert_rgb48_rgb)
{
- const uint16_t *rgb = (const uint16_t *)src[0];
+ // Byte Swap to BGR layout
+ uint8_t *dstBS[4] = {NULL};
+ dstBS[0] = (BYTE *)av_malloc(height * srcStride[0]);
+
+ SwsContext *ctx = GetSWSContext(width, height, GetFFInput(), AV_PIX_FMT_BGR48LE, SWS_POINT);
+ sws_scale(ctx, src, srcStride, 0, height, dstBS, srcStride);
+
+ // Dither to RGB24/32 with SSE2
+ const uint16_t *rgb = (const uint16_t *)dstBS[0];
const ptrdiff_t inStride = srcStride[0] >> 1;
const ptrdiff_t outStride = dstStride * (out32 ? 4 : 3);
ptrdiff_t line, i;
-
int processWidth = width * 3;
LAVDitherMode ditherMode = m_pSettings->GetDitherMode();
@@ -154,6 +161,7 @@ DECLARE_CONV_FUNC_IMPL(convert_rgb48_rgb)
if (out32)
av_freep(&rgb24buffer);
+ av_freep(&dstBS[0]);
return S_OK;
}