Skip to content

Commit 560bf40

Browse files
committed
dshow: fixed nv12->uyvy chroma convert
refers to GH-369 chroma from first row was used for every column \+ use ptrdiff_t vars to fix a warning for narrow type multiplication
1 parent 49ddf94 commit 560bf40

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/video_capture/DirectShowGrabber.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -1229,10 +1229,11 @@ void
12291229
nv12_to_uyvy(int width, int height, const unsigned char *in, unsigned char *out)
12301230
{
12311231
const int uyvy_linesize = vc_get_linesize(width, UYVY);
1232-
for (int y = 0; y < height; ++y) {
1232+
for (ptrdiff_t y = 0; y < height; ++y) {
12331233
const unsigned char *src_y = in + width * y;
1234-
const unsigned char *src_cbcr = in + width * height;
1235-
unsigned char *dst = out + y * uyvy_linesize;
1234+
const unsigned char *src_cbcr =
1235+
in + (ptrdiff_t) width * height + width * (y / 2);
1236+
unsigned char *dst = out + y * uyvy_linesize;
12361237

12371238
OPTIMIZED_FOR(int x = 0; x < width / 2; ++x)
12381239
{

0 commit comments

Comments
 (0)