]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/dxtory.c
avfilter/vf_scale: store the offset in a local variable before adding it
[ffmpeg] / libavcodec / dxtory.c
index 3f3c23ff2a748ade6e16537e08769c69ec93534a..914131e74249d9d6936b3958b06b2446a64cdf8c 100644 (file)
@@ -44,9 +44,9 @@ static int64_t get_raw_size(enum AVPixelFormat fmt, int width, int height)
     case AV_PIX_FMT_YUV444P:
         return width * height * 3LL;
     case AV_PIX_FMT_YUV420P:
-        return (int64_t)(width * height) + AV_CEIL_RSHIFT(width, 1) * AV_CEIL_RSHIFT(height, 1);
+        return (int64_t)(width * height) + 2 * AV_CEIL_RSHIFT(width, 1) * AV_CEIL_RSHIFT(height, 1);
     case AV_PIX_FMT_YUV410P:
-        return (int64_t)(width * height) + AV_CEIL_RSHIFT(width, 2) * AV_CEIL_RSHIFT(height, 2);
+        return (int64_t)(width * height) + 2 * AV_CEIL_RSHIFT(width, 2) * AV_CEIL_RSHIFT(height, 2);
     }
 
     return 0;
@@ -177,10 +177,10 @@ static int dxtory_decode_v1_410(AVCodecContext *avctx, AVFrame *pic,
             V[huvborder] = src[1] + 0x80;
             src += 2;
         }
-        Y1 += pic->linesize[0] << 2;
-        Y2 += pic->linesize[0] << 2;
-        Y3 += pic->linesize[0] << 2;
-        Y4 += pic->linesize[0] << 2;
+        Y1 += pic->linesize[0] * 4;
+        Y2 += pic->linesize[0] * 4;
+        Y3 += pic->linesize[0] * 4;
+        Y4 += pic->linesize[0] * 4;
         U  += pic->linesize[1];
         V  += pic->linesize[2];
     }
@@ -264,8 +264,8 @@ static int dxtory_decode_v1_420(AVCodecContext *avctx, AVFrame *pic,
             V[huvborder] = src[3] + 0x80;
             src += 4;
         }
-        Y1 += pic->linesize[0] << 1;
-        Y2 += pic->linesize[0] << 1;
+        Y1 += pic->linesize[0] * 2;
+        Y2 += pic->linesize[0] * 2;
         U  += pic->linesize[1];
         V  += pic->linesize[2];
     }
@@ -637,7 +637,7 @@ static int dx2_decode_slice_410(GetBitContext *gb, AVFrame *frame,
             V[huvborder] = decode_sym(gb, lru[2]) ^ 0x80;
         }
 
-        Y += ystride << 2;
+        Y += ystride * 4;
         U += ustride;
         V += vstride;
     }
@@ -717,7 +717,7 @@ static int dx2_decode_slice_420(GetBitContext *gb, AVFrame *frame,
             V[huvborder] = decode_sym(gb, lru[2]) ^ 0x80;
         }
 
-        Y += ystride << 1;
+        Y += ystride * 2;
         U += ustride;
         V += vstride;
     }
@@ -876,7 +876,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
     return avpkt->size;
 }
 
-AVCodec ff_dxtory_decoder = {
+const AVCodec ff_dxtory_decoder = {
     .name           = "dxtory",
     .long_name      = NULL_IF_CONFIG_SMALL("Dxtory"),
     .type           = AVMEDIA_TYPE_VIDEO,