]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/rv34.h
utvideodec: Convert to the new bitstream reader
[ffmpeg] / libavcodec / rv34.h
index 0cb76de70778283fade3c507d08cd685447bb884..0ac24bfaba4e0d440680964b7353ea3572f69dff 100644 (file)
@@ -2,36 +2,39 @@
  * RV30/40 decoder common data declarations
  * Copyright (c) 2007 Mike Melanson, Konstantin Shishkov
  *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 /**
- * @file rv34.h
+ * @file
  * RV30 and RV40 decoder common data declarations
  */
 
-#ifndef FFMPEG_RV34_H
-#define FFMPEG_RV34_H
+#ifndef AVCODEC_RV34_H
+#define AVCODEC_RV34_H
 
 #include "avcodec.h"
-#include "dsputil.h"
 #include "mpegvideo.h"
 
 #include "h264pred.h"
+#include "rv34dsp.h"
+
+#define MB_TYPE_SEPARATE_DC 0x01000000
+#define IS_SEPARATE_DC(a)   ((a) & MB_TYPE_SEPARATE_DC)
 
 /**
  * RV30 and RV40 Macroblock types
@@ -74,18 +77,20 @@ typedef struct SliceInfo{
     int start, end;        ///< start and end macroblocks of the slice
     int width;             ///< coded width
     int height;            ///< coded height
+    int pts;               ///< frame timestamp
 }SliceInfo;
 
 /** decoder context */
 typedef struct RV34DecContext{
     MpegEncContext s;
+    RV34DSPContext rdsp;
     int8_t *intra_types_hist;///< old block types, used for prediction
     int8_t *intra_types;     ///< block types
-    uint8_t *luma_dc_quant_i;///< luma subblock DC quantizer for intraframes
-    uint8_t *luma_dc_quant_p;///< luma subblock DC quantizer for interframes
+    int    intra_types_stride;///< block types array stride
+    const uint8_t *luma_dc_quant_i;///< luma subblock DC quantizer for intraframes
+    const uint8_t *luma_dc_quant_p;///< luma subblock DC quantizer for interframes
 
     RV34VLC *cur_vlcs;       ///< VLC set used for current frame decoding
-    int bits;                ///< slice size in bits
     H264PredContext h;       ///< functions for 4x4 and 16x16 intra block prediction
     SliceInfo si;            ///< current slice information
 
@@ -96,19 +101,30 @@ typedef struct RV34DecContext{
     int is16;                ///< current block has additional 16x16 specific features or not
     int dmv[4][2];           ///< differential motion vectors for the current macroblock
 
-    int rv30;                ///< indicates which RV variasnt is currently decoded
+    int rv30;                ///< indicates which RV variant is currently decoded
     int rpr;                 ///< one field size in RV30 slice header
 
+    int cur_pts, last_pts, next_pts;
+    int scaled_weight;
+    int weight1, weight2;    ///< B-frame distance fractions (0.14) used in motion compensation
+    int mv_weight1, mv_weight2;
+
     uint16_t *cbp_luma;      ///< CBP values for luma subblocks
     uint8_t  *cbp_chroma;    ///< CBP values for chroma subblocks
+    uint16_t *deblock_coefs; ///< deblock coefficients for each macroblock
 
     /** 8x8 block available flags (for MV prediction) */
-    DECLARE_ALIGNED_8(uint32_t, avail_cache[3*4]);
+    DECLARE_ALIGNED(8, uint32_t, avail_cache)[3*4];
+
+    /** temporary blocks for RV4 weighted MC */
+    uint8_t *tmp_b_block_y[2];
+    uint8_t *tmp_b_block_uv[4];
+    uint8_t *tmp_b_block_base;
 
     int (*parse_slice_header)(struct RV34DecContext *r, GetBitContext *gb, SliceInfo *si);
     int (*decode_mb_info)(struct RV34DecContext *r);
     int (*decode_intra_types)(struct RV34DecContext *r, GetBitContext *gb, int8_t *dst);
-    void (*loop_filter)(struct RV34DecContext *r);
+    void (*loop_filter)(struct RV34DecContext *r, int row);
 }RV34DecContext;
 
 /**
@@ -116,7 +132,9 @@ typedef struct RV34DecContext{
  */
 int ff_rv34_get_start_offset(GetBitContext *gb, int blocks);
 int ff_rv34_decode_init(AVCodecContext *avctx);
-int ff_rv34_decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size);
+int ff_rv34_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt);
 int ff_rv34_decode_end(AVCodecContext *avctx);
+int ff_rv34_decode_init_thread_copy(AVCodecContext *avctx);
+int ff_rv34_decode_update_thread_context(AVCodecContext *dst, const AVCodecContext *src);
 
-#endif /* FFMPEG_RV34_H */
+#endif /* AVCODEC_RV34_H */