Skip to content

Commit

Permalink
Merge pull request webmproject#106 from skal65535/fix_cast
Browse files Browse the repository at this point in the history
fix cast
  • Loading branch information
skal65535 authored Feb 19, 2021
2 parents 15e653d + d484fec commit 44dfae7
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/enc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1907,15 +1907,16 @@ class EncoderNV12 : public Encoder {
UV = tmp_uv;
uv_step = 16;
}
// input samples are U/V/U/V/... for NV12 and V/U/V/U... for NV21
const uint8_t* u = &UV[is_nv12_ ? 0 : 1];
const uint8_t* v = &UV[is_nv12_ ? 1 : 0];
for (int y = 0; y < 8; ++y) {
// input samples are U/V/U/V/... for NV12 and V/U/V/U... for NV21
const uint8_t* const u = &UV[is_nv12_ ? 0 : 1];
const uint8_t* const v = &UV[is_nv12_ ? 1 : 0];
for (int x = 0; x < 8; ++x) {
U[x + y * 8] = (int16_t)(u[2 * x + 0]) - 128;
V[x + y * 8] = (int16_t)(v[2 * x + 1]) - 128;
U[x + y * 8] = static_cast<int16_t>(u[2 * x]) - 128;
V[x + y * 8] = static_cast<int16_t>(v[2 * x]) - 128;
}
UV += uv_step;
u += uv_step;
v += uv_step;
}
}

Expand Down

0 comments on commit 44dfae7

Please sign in to comment.