1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/texturedspenc: Fix indexing in color distribution determination

Fixes CID1396405

MSE and PSNR is slightly improved, and some noticable corruptions disappear as
well.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Marton Balint <cus@passwd.hu>
(cherry picked from commit ade36d61de)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2017-01-02 00:28:33 +01:00
parent 62dab58b94
commit dc4d0f630b
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64

View File

@ -255,11 +255,11 @@ static void optimize_colors(const uint8_t *block, ptrdiff_t stride,
muv = minv = maxv = bp[0];
for (y = 0; y < 4; y++) {
for (x = 4; x < 4; x += 4) {
for (x = 0; x < 4; x++) {
muv += bp[x * 4 + y * stride];
if (bp[x] < minv)
if (bp[x * 4 + y * stride] < minv)
minv = bp[x * 4 + y * stride];
else if (bp[x] > maxv)
else if (bp[x * 4 + y * stride] > maxv)
maxv = bp[x * 4 + y * stride];
}
}