[vlc-commits] dxva2: support IMC3
Rafaël Carré
git at videolan.org
Sun Feb 12 14:40:56 CET 2012
vlc/vlc-2.0 | branch: master | Rafaël Carré <funman at videolan.org> | Mon Feb 6 15:50:50 2012 -0500| [d09ead662339b5c8495d5096532395876460d824] | committer: Jean-Baptiste Kempf
dxva2: support IMC3
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)
(cherry picked from commit b2fc6dc9c0393ab149dc5ea13d9a86c107a9b163)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=d09ead662339b5c8495d5096532395876460d824
---
modules/codec/avcodec/dxva2.c | 33 +++++++++++++++++++++++----------
1 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 316c9cf..a46c0c3 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -258,6 +258,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 }
};
@@ -430,18 +431,29 @@ static int Extract(vlc_va_t *external, picture_t *picture, AVFrame *ff)
return VLC_EGENERIC;
}
- if (va->render == MAKEFOURCC('Y','V','1','2')) {
- 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/2) * (va->surface_height/2)
- };
- size_t pitch[3] = {
+ if (va->render == MAKEFOURCC('Y','V','1','2') ||
+ va->render == MAKEFOURCC('I','M','C','3')) {
+ bool imc3 = va->render == MAKEFOURCC('I','M','C','3');
+ size_t chroma_pitch = imc3 ? lock.Pitch : lock.Pitch / 2;
+
+ size_t pitch[3] = {
lock.Pitch,
- lock.Pitch / 2,
- lock.Pitch / 2,
+ chroma_pitch,
+ chroma_pitch,
};
+
+ uint8_t *plane[3] = {
+ (uint8_t*)lock.pBits,
+ (uint8_t*)lock.pBits + pitch[0] * va->surface_height,
+ (uint8_t*)lock.pBits + pitch[0] * va->surface_height
+ + pitch[1] * va->surface_height / 2,
+ };
+
+ if (imc3) {
+ uint8_t *V = plane[1];
+ plane[1] = plane[2];
+ plane[2] = V;
+ }
CopyFromYv12(picture, plane, pitch,
va->width, va->height,
&va->surface_cache);
@@ -1040,6 +1052,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:
More information about the vlc-commits
mailing list