Commit d09ead66 authored by Rafaël Carré's avatar Rafaël Carré Committed by 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 b2fc6dc9)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 37acc4f2
...@@ -258,6 +258,7 @@ typedef struct { ...@@ -258,6 +258,7 @@ typedef struct {
static const d3d_format_t d3d_formats[] = { static const d3d_format_t d3d_formats[] = {
{ "YV12", MAKEFOURCC('Y','V','1','2'), VLC_CODEC_YV12 }, { "YV12", MAKEFOURCC('Y','V','1','2'), VLC_CODEC_YV12 },
{ "NV12", MAKEFOURCC('N','V','1','2'), VLC_CODEC_NV12 }, { "NV12", MAKEFOURCC('N','V','1','2'), VLC_CODEC_NV12 },
{ "IMC3", MAKEFOURCC('I','M','C','3'), VLC_CODEC_YV12 },
{ NULL, 0, 0 } { NULL, 0, 0 }
}; };
...@@ -430,18 +431,29 @@ static int Extract(vlc_va_t *external, picture_t *picture, AVFrame *ff) ...@@ -430,18 +431,29 @@ static int Extract(vlc_va_t *external, picture_t *picture, AVFrame *ff)
return VLC_EGENERIC; return VLC_EGENERIC;
} }
if (va->render == MAKEFOURCC('Y','V','1','2')) { if (va->render == MAKEFOURCC('Y','V','1','2') ||
uint8_t *plane[3] = { va->render == MAKEFOURCC('I','M','C','3')) {
lock.pBits, bool imc3 = va->render == MAKEFOURCC('I','M','C','3');
(uint8_t*)lock.pBits + lock.Pitch * va->surface_height, size_t chroma_pitch = imc3 ? lock.Pitch : lock.Pitch / 2;
(uint8_t*)lock.pBits + lock.Pitch * va->surface_height
+ (lock.Pitch/2) * (va->surface_height/2)
};
size_t pitch[3] = { size_t pitch[3] = {
lock.Pitch, lock.Pitch,
lock.Pitch / 2, chroma_pitch,
lock.Pitch / 2, 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, CopyFromYv12(picture, plane, pitch,
va->width, va->height, va->width, va->height,
&va->surface_cache); &va->surface_cache);
...@@ -1040,6 +1052,7 @@ static void DxCreateVideoConversion(vlc_va_dxva2_t *va) ...@@ -1040,6 +1052,7 @@ static void DxCreateVideoConversion(vlc_va_dxva2_t *va)
{ {
switch (va->render) { switch (va->render) {
case MAKEFOURCC('N','V','1','2'): case MAKEFOURCC('N','V','1','2'):
case MAKEFOURCC('I','M','C','3'):
va->output = MAKEFOURCC('Y','V','1','2'); va->output = MAKEFOURCC('Y','V','1','2');
break; break;
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment