Imported Upstream version 6.1
[platform/upstream/ffmpeg.git] / libavcodec / fraps.c
index 7f69530..bed244e 100644 (file)
@@ -56,7 +56,6 @@ typedef struct FrapsContext {
     int tmpbuf_size;
 } FrapsContext;
 
-
 /**
  * initializes decoder
  * @param avctx codec context
@@ -123,13 +122,13 @@ static int fraps2_decode_plane(FrapsContext *s, uint8_t *dst, int stride, int w,
             else if (Uoff)
                 dst[i] += 0x80;
             if (get_bits_left(&gb) < 0) {
-                ff_free_vlc(&vlc);
+                ff_vlc_free(&vlc);
                 return AVERROR_INVALIDDATA;
             }
         }
         dst += stride;
     }
-    ff_free_vlc(&vlc);
+    ff_vlc_free(&vlc);
     return 0;
 }
 
@@ -141,7 +140,6 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *f,
     int buf_size           = avpkt->size;
     uint32_t header;
     unsigned int version,header_size;
-    unsigned int x, y;
     const uint32_t *buf32;
     uint32_t *luma1,*luma2,*cb,*cr;
     uint32_t offs[4];
@@ -217,7 +215,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *f,
     }
 
     f->pict_type = AV_PICTURE_TYPE_I;
-    f->key_frame = 1;
+    f->flags |= AV_FRAME_FLAG_KEY;
 
     avctx->pix_fmt = version & 1 ? is_pal ? AV_PIX_FMT_PAL8 : AV_PIX_FMT_BGR24 : AV_PIX_FMT_YUVJ420P;
     avctx->color_range = version & 1 ? AVCOL_RANGE_UNSPECIFIED
@@ -238,12 +236,12 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *f,
         }
 
         buf32 = (const uint32_t*)buf;
-        for (y = 0; y < avctx->height / 2; y++) {
+        for (ptrdiff_t y = 0; y < avctx->height / 2; y++) {
             luma1 = (uint32_t*)&f->data[0][  y * 2      * f->linesize[0] ];
             luma2 = (uint32_t*)&f->data[0][ (y * 2 + 1) * f->linesize[0] ];
             cr    = (uint32_t*)&f->data[1][  y          * f->linesize[1] ];
             cb    = (uint32_t*)&f->data[2][  y          * f->linesize[2] ];
-            for (x = 0; x < avctx->width; x += 8) {
+            for (ptrdiff_t x = 0; x < avctx->width; x += 8) {
                 *luma1++ = *buf32++;
                 *luma1++ = *buf32++;
                 *luma2++ = *buf32++;
@@ -258,18 +256,18 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *f,
         if (is_pal) {
             uint32_t *pal = (uint32_t *)f->data[1];
 
-            for (y = 0; y < 256; y++) {
+            for (unsigned y = 0; y < 256; y++) {
                 pal[y] = AV_RL32(buf) | 0xFF000000;
                 buf += 4;
             }
 
-            for (y = 0; y <avctx->height; y++)
+            for (ptrdiff_t y = 0; y < avctx->height; y++)
                 memcpy(&f->data[0][y * f->linesize[0]],
                        &buf[y * avctx->width],
                        avctx->width);
         } else {
         /* Fraps v1 is an upside-down BGR24 */
-            for (y = 0; y<avctx->height; y++)
+            for (ptrdiff_t y = 0; y < avctx->height; y++)
                 memcpy(&f->data[0][(avctx->height - y - 1) * f->linesize[0]],
                        &buf[y * avctx->width * 3],
                        3 * avctx->width);
@@ -324,7 +322,6 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *f,
     return buf_size;
 }
 
-
 /**
  * closes decoder
  * @param avctx codec context
@@ -332,16 +329,15 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *f,
  */
 static av_cold int decode_end(AVCodecContext *avctx)
 {
-    FrapsContext *s = (FrapsContext*)avctx->priv_data;
+    FrapsContext *s = avctx->priv_data;
 
     av_freep(&s->tmpbuf);
     return 0;
 }
 
-
 const FFCodec ff_fraps_decoder = {
     .p.name         = "fraps",
-    .p.long_name    = NULL_IF_CONFIG_SMALL("Fraps"),
+    CODEC_LONG_NAME("Fraps"),
     .p.type         = AVMEDIA_TYPE_VIDEO,
     .p.id           = AV_CODEC_ID_FRAPS,
     .priv_data_size = sizeof(FrapsContext),
@@ -349,5 +345,4 @@ const FFCodec ff_fraps_decoder = {
     .close          = decode_end,
     FF_CODEC_DECODE_CB(decode_frame),
     .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS,
-    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
 };