Skip to content

Commit

Permalink
dshow: fixed nv12->uyvy chroma convert
Browse files Browse the repository at this point in the history
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
  • Loading branch information
MartinPulec committed Jan 22, 2024
1 parent 49ddf94 commit 560bf40
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/video_capture/DirectShowGrabber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1229,10 +1229,11 @@ void
nv12_to_uyvy(int width, int height, const unsigned char *in, unsigned char *out)
{
const int uyvy_linesize = vc_get_linesize(width, UYVY);
for (int y = 0; y < height; ++y) {
for (ptrdiff_t y = 0; y < height; ++y) {
const unsigned char *src_y = in + width * y;
const unsigned char *src_cbcr = in + width * height;
unsigned char *dst = out + y * uyvy_linesize;
const unsigned char *src_cbcr =
in + (ptrdiff_t) width * height + width * (y / 2);
unsigned char *dst = out + y * uyvy_linesize;

OPTIMIZED_FOR(int x = 0; x < width / 2; ++x)
{
Expand Down

0 comments on commit 560bf40

Please sign in to comment.