summaryrefslogtreecommitdiff
path: root/libavcodec/gdv.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-08-05 17:06:44 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2018-09-28 01:25:17 +0200
commit5f84fbce08769fb21d8459b81e9aad53635008b7 (patch)
treef0660eff0c6fc00d09b308a7a96ab70bab06726b /libavcodec/gdv.c
parentd021729efc1fe3480326c29f7dbb8d0e56ea4c71 (diff)
avcodec/gdv: Eliminate 50% of the reads in the first inner loop in rescale()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/gdv.c')
-rw-r--r--libavcodec/gdv.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libavcodec/gdv.c b/libavcodec/gdv.c
index 595d8ff4e4..aea15a88ef 100644
--- a/libavcodec/gdv.c
+++ b/libavcodec/gdv.c
@@ -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++) {