]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/eatgq.c
mov: Support edit list atom version 1.
[ffmpeg] / libavcodec / eatgq.c
index b65c8a5ce6e0d937d9ba1d7aa895f12280ad324f..d4f8b8fb5fbd5c28c256e790855811df6b64da2c 100644 (file)
@@ -2,25 +2,25 @@
  * Electronic Arts TGQ Video Decoder
  * Copyright (c) 2007-2008 Peter Ross <pross@xvid.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /**
- * @file eatgq.c
+ * @file
  * Electronic Arts TGQ Video Decoder
  * @author Peter Ross <pross@xvid.org>
  *
 
 #include "avcodec.h"
 #define ALT_BITSTREAM_READER_LE
-#include "bitstream.h"
+#include "get_bits.h"
 #include "bytestream.h"
 #include "dsputil.h"
-extern const uint16_t ff_inv_aanscales[64]; //mpegvideo_enc.c
+#include "aandcttab.h"
 
 typedef struct TgqContext {
     AVCodecContext *avctx;
@@ -42,6 +42,7 @@ typedef struct TgqContext {
     int width,height;
     ScanTable scantable;
     int qtable[64];
+    DECLARE_ALIGNED(16, DCTELEM, block)[6][64];
 } TgqContext;
 
 static av_cold int tgq_decode_init(AVCodecContext *avctx){
@@ -140,13 +141,12 @@ static void tgq_idct_put_mb_dconly(TgqContext *s, int mb_x, int mb_y, const int8
     }
 }
 
-static void tgq_decode_mb(TgqContext *s, int mb_y, int mb_x, const int8_t **bs, const int8_t *buf_end){
+static void tgq_decode_mb(TgqContext *s, int mb_y, int mb_x, const uint8_t **bs, const uint8_t *buf_end){
     int mode;
     int i;
     int8_t dc[6];
-    DCTELEM block[6][64];
 
-    mode = bytestream_get_byte((const uint8_t**)bs);
+    mode = bytestream_get_byte(bs);
     if (mode>buf_end-*bs) {
         av_log(s->avctx, AV_LOG_ERROR, "truncated macroblock\n");
         return;
@@ -156,8 +156,8 @@ static void tgq_decode_mb(TgqContext *s, int mb_y, int mb_x, const int8_t **bs,
         GetBitContext gb;
         init_get_bits(&gb, *bs, mode*8);
         for(i=0; i<6; i++)
-            tgq_decode_block(s, block[i], &gb);
-        tgq_idct_put_mb(s, block, mb_x, mb_y);
+            tgq_decode_block(s, s->block[i], &gb);
+        tgq_idct_put_mb(s, s->block, mb_x, mb_y);
     }else{
         if (mode==3) {
             memset(dc, (*bs)[0], 4);
@@ -190,7 +190,9 @@ static void tgq_calculate_qtable(TgqContext *s, int quant){
 
 static int tgq_decode_frame(AVCodecContext *avctx,
                             void *data, int *data_size,
-                            const uint8_t *buf, int buf_size){
+                            AVPacket *avpkt){
+    const uint8_t *buf = avpkt->data;
+    int buf_size = avpkt->size;
     const uint8_t *buf_start = buf;
     const uint8_t *buf_end = buf + buf_size;
     TgqContext *s = avctx->priv_data;
@@ -216,7 +218,7 @@ static int tgq_decode_frame(AVCodecContext *avctx,
 
     if (!s->frame.data[0]) {
         s->frame.key_frame = 1;
-        s->frame.pict_type = FF_I_TYPE;
+        s->frame.pict_type = AV_PICTURE_TYPE_I;
         s->frame.buffer_hints = FF_BUFFER_HINTS_VALID;
         if (avctx->get_buffer(avctx, &s->frame)) {
             av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
@@ -226,7 +228,7 @@ static int tgq_decode_frame(AVCodecContext *avctx,
 
     for (y=0; y<(avctx->height+15)/16; y++)
     for (x=0; x<(avctx->width+15)/16; x++)
-        tgq_decode_mb(s, y, x, (const int8_t**)&buf, (const int8_t*)buf_end);
+        tgq_decode_mb(s, y, x, &buf, buf_end);
 
     *data_size = sizeof(AVFrame);
     *(AVFrame*)data = s->frame;
@@ -241,9 +243,9 @@ static av_cold int tgq_decode_end(AVCodecContext *avctx){
     return 0;
 }
 
-AVCodec eatgq_decoder = {
+AVCodec ff_eatgq_decoder = {
     "eatgq",
-    CODEC_TYPE_VIDEO,
+    AVMEDIA_TYPE_VIDEO,
     CODEC_ID_TGQ,
     sizeof(TgqContext),
     tgq_decode_init,
@@ -251,5 +253,5 @@ AVCodec eatgq_decoder = {
     tgq_decode_end,
     tgq_decode_frame,
     CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts TGQ Video"),
+    .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts TGQ video"),
 };