[vlc-devel] [PATCH 1/3] nvdec: fix copy heights and increments
quentin.chateau at deepskycorp.com
quentin.chateau at deepskycorp.com
Tue Mar 24 17:38:38 CET 2020
From: Quentin Chateau <quentin.chateau at deepskycorp.com>
The srcY increment matches the copy height.
The fields WidthInBytes and Height both refer
to the same data source to be consistent.
---
modules/hw/nvdec/chroma.c | 7 ++++---
modules/hw/nvdec/nvdec.c | 4 ++--
modules/hw/nvdec/nvdec_gl.c | 2 +-
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/modules/hw/nvdec/chroma.c b/modules/hw/nvdec/chroma.c
index 88353f5cbe..638d8605ec 100644
--- a/modules/hw/nvdec/chroma.c
+++ b/modules/hw/nvdec/chroma.c
@@ -77,6 +77,7 @@ static picture_t * FilterCUDAToCPU( filter_t *p_filter, picture_t *src )
memset(plane.p_pixels, 0xFF, plane.i_pitch * plane.i_visible_lines);
continue;
}
+
CUDA_MEMCPY2D cu_cpy = {
.srcMemoryType = CU_MEMORYTYPE_DEVICE,
.srcDevice = srcpic->devicePtr,
@@ -85,13 +86,13 @@ static picture_t * FilterCUDAToCPU( filter_t *p_filter, picture_t *src )
.dstMemoryType = CU_MEMORYTYPE_HOST,
.dstHost = plane.p_pixels,
.dstPitch = plane.i_pitch,
- .WidthInBytes = __MIN(srcpic->bufferPitch, (unsigned)dst->p[0].i_pitch),
- .Height = __MIN(srcpic->bufferHeight, (unsigned)plane.i_visible_lines),
+ .WidthInBytes = plane.i_pitch,
+ .Height = plane.i_visible_lines,
};
result = CALL_CUDA(cuMemcpy2DAsync, &cu_cpy, 0);
if (result != VLC_SUCCESS)
goto done;
- srcY += srcpic->bufferHeight;
+ srcY += plane.i_visible_lines;
}
picture_CopyProperties(dst, src);
diff --git a/modules/hw/nvdec/nvdec.c b/modules/hw/nvdec/nvdec.c
index 76aec6a246..cff5a263d0 100644
--- a/modules/hw/nvdec/nvdec.c
+++ b/modules/hw/nvdec/nvdec.c
@@ -486,13 +486,13 @@ static int CUDAAPI HandlePictureDisplay(void *p_opaque, CUVIDPARSERDISPINFO *p_d
.dstMemoryType = CU_MEMORYTYPE_HOST,
.dstHost = plane.p_pixels,
.dstPitch = plane.i_pitch,
- .WidthInBytes = i_pitch,
+ .WidthInBytes = plane.i_pitch,
.Height = plane.i_visible_lines,
};
result = CALL_CUDA_DEC(cuMemcpy2DAsync, &cu_cpy, 0);
if (result != VLC_SUCCESS)
goto error;
- srcY += p_sys->decoderHeight;
+ srcY += plane.i_visible_lines;
}
}
diff --git a/modules/hw/nvdec/nvdec_gl.c b/modules/hw/nvdec/nvdec_gl.c
index 137e730028..dc69179aea 100644
--- a/modules/hw/nvdec/nvdec_gl.c
+++ b/modules/hw/nvdec/nvdec_gl.c
@@ -138,7 +138,7 @@ tc_nvdec_gl_update(const struct vlc_gl_interop *interop, GLuint textures[],
result = CALL_CUDA(cuMemcpy2DAsync, &cu_cpy, 0);
if (result != VLC_SUCCESS)
goto error;
- srcY += srcpic->bufferHeight;
+ srcY += tex_heights[i];
}
error:
--
2.17.1
More information about the vlc-devel
mailing list