[vlc-devel] [PATCH] dxva2: support IMC3
Rafaël Carré
funman at videolan.org
Mon Feb 6 21:52:42 CET 2012
It's the only output format on my GMA 3150
It is identical to YV12 except:
- U & V are swapped
- U & V pitch is identical to Y pitch (first half is plane data,
second plane is padding)
---
modules/codec/avcodec/dxva2.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index b60ffea..240d772 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -280,6 +280,7 @@ typedef struct {
static const d3d_format_t d3d_formats[] = {
{ "YV12", MAKEFOURCC('Y','V','1','2'), VLC_CODEC_YV12 },
{ "NV12", MAKEFOURCC('N','V','1','2'), VLC_CODEC_NV12 },
+ { "IMC3", MAKEFOURCC('I','M','C','3'), VLC_CODEC_YV12 },
{ NULL, 0, 0 }
};
@@ -467,6 +468,24 @@ static int Extract(vlc_va_t *external, picture_t *picture, AVFrame *ff)
CopyFromYv12(picture, plane, pitch,
va->width, va->height,
&va->surface_cache);
+ } else if (va->render == MAKEFOURCC('I','M','C','3')) {
+ uint8_t *plane[3] = {
+ lock.pBits,
+ (uint8_t*)lock.pBits + lock.Pitch * va->surface_height,
+ (uint8_t*)lock.pBits + lock.Pitch * va->surface_height
+ + lock.Pitch * (va->surface_height/2)
+ };
+ size_t pitch[3] = {
+ lock.Pitch,
+ lock.Pitch,
+ lock.Pitch,
+ };
+ CopyFromYv12(picture, plane, pitch,
+ va->width, va->height,
+ &va->surface_cache);
+ uint8_t *v = picture->p[1].p_pixels;
+ picture->p[1].p_pixels = picture->p[2].p_pixels;
+ picture->p[2].p_pixels = v;
} else {
assert(va->render == MAKEFOURCC('N','V','1','2'));
uint8_t *plane[2] = {
@@ -1062,6 +1081,7 @@ static void DxCreateVideoConversion(vlc_va_dxva2_t *va)
{
switch (va->render) {
case MAKEFOURCC('N','V','1','2'):
+ case MAKEFOURCC('I','M','C','3'):
va->output = MAKEFOURCC('Y','V','1','2');
break;
default:
--
1.7.8.3
More information about the vlc-devel
mailing list