avcodec/gdv: Eliminate 50% of the reads in the first inner loop in rescale()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2018-08-05 17:06:44 +02:00
parent d021729efc
commit 5f84fbce08
1 changed files with 7 additions and 1 deletions

View File

@ -85,9 +85,15 @@ static void rescale(GDVContext *gdv, uint8_t *dst, int w, int h, int scale_v, in
int y = h - j - 1;
uint8_t *dst1 = dst + PREAMBLE_SIZE + y * w;
uint8_t *src1 = dst + PREAMBLE_SIZE + (y>>!!gdv->scale_h) * (w>>1);
for (x = w - 1; x >= 0; x--) {
for (x = w - 1; x >= 0 && !(x&1); x--) {
dst1[x] = src1[(x>>1)];
}
for (x--; x >= 0; x-=2) {
dst1[x ] =
dst1[x+1] = src1[(x>>1)];
}
}
} else if (gdv->scale_h) {
for (j = 0; j < h; j++) {