static void rescale(GDVContext *gdv, uint8_t *dst, int w, int h, int scale_v, int scale_h)
{
- int i, j, y, x;
+ int j, y, x;
if ((gdv->scale_v == scale_v) && (gdv->scale_h == scale_h)) {
return;
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++) {
break;
}
}
+
+ if (bytestream2_get_bytes_left_p(pb) > 0)
+ return AVERROR_INVALIDDATA;
+
return 0;
}
default:
av_assert0(0);
}
+ if (ret < 0)
+ return ret;
memcpy(frame->data[1], gdv->pal, AVPALETTE_SIZE);
dst = frame->data[0];
if (!gdv->scale_v && !gdv->scale_h) {
int sidx = PREAMBLE_SIZE, didx = 0;
- int y, x;
+ int y;
for (y = 0; y < avctx->height; y++) {
- for (x = 0; x < avctx->width; x++) {
- dst[x+didx] = gdv->frame[x+sidx];
- }
+ memcpy(dst + didx, gdv->frame + sidx, avctx->width);
sidx += avctx->width;
didx += frame->linesize[0];
}
for (y = 0; y < avctx->height; y++) {
if (!gdv->scale_v) {
- for (x = 0; x < avctx->width; x++) {
- dst[didx + x] = gdv->frame[sidx + x];
- }
+ memcpy(dst + didx, gdv->frame + sidx, avctx->width);
} else {
- for (x = 0; x < avctx->width; x++) {
- dst[didx + x] = gdv->frame[sidx + x/2];
+ for (x = 0; x < avctx->width - 1; x+=2) {
+ dst[didx + x ] =
+ dst[didx + x + 1] = gdv->frame[sidx + (x>>1)];
+ }
+ for (; x < avctx->width; x++) {
+ dst[didx + x] = gdv->frame[sidx + (x>>1)];
}
}
if (!gdv->scale_h || ((y & 1) == 1)) {