annotate ffmpeg/libavcodec/rv34.h @ 13:844d341cf643 tip

Back up before ISMIR
author Yading Song <yading.song@eecs.qmul.ac.uk>
date Thu, 31 Oct 2013 13:17:06 +0000
parents 6840f77b83aa
children
rev   line source
yading@10 1 /*
yading@10 2 * RV30/40 decoder common data declarations
yading@10 3 * Copyright (c) 2007 Mike Melanson, Konstantin Shishkov
yading@10 4 *
yading@10 5 * This file is part of FFmpeg.
yading@10 6 *
yading@10 7 * FFmpeg is free software; you can redistribute it and/or
yading@10 8 * modify it under the terms of the GNU Lesser General Public
yading@10 9 * License as published by the Free Software Foundation; either
yading@10 10 * version 2.1 of the License, or (at your option) any later version.
yading@10 11 *
yading@10 12 * FFmpeg is distributed in the hope that it will be useful,
yading@10 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
yading@10 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
yading@10 15 * Lesser General Public License for more details.
yading@10 16 *
yading@10 17 * You should have received a copy of the GNU Lesser General Public
yading@10 18 * License along with FFmpeg; if not, write to the Free Software
yading@10 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
yading@10 20 */
yading@10 21
yading@10 22 /**
yading@10 23 * @file
yading@10 24 * RV30 and RV40 decoder common data declarations
yading@10 25 */
yading@10 26
yading@10 27 #ifndef AVCODEC_RV34_H
yading@10 28 #define AVCODEC_RV34_H
yading@10 29
yading@10 30 #include "avcodec.h"
yading@10 31 #include "mpegvideo.h"
yading@10 32
yading@10 33 #include "h264pred.h"
yading@10 34 #include "rv34dsp.h"
yading@10 35
yading@10 36 #define MB_TYPE_SEPARATE_DC 0x01000000
yading@10 37 #define IS_SEPARATE_DC(a) ((a) & MB_TYPE_SEPARATE_DC)
yading@10 38
yading@10 39 /**
yading@10 40 * RV30 and RV40 Macroblock types
yading@10 41 */
yading@10 42 enum RV40BlockTypes{
yading@10 43 RV34_MB_TYPE_INTRA, ///< Intra macroblock
yading@10 44 RV34_MB_TYPE_INTRA16x16, ///< Intra macroblock with DCs in a separate 4x4 block
yading@10 45 RV34_MB_P_16x16, ///< P-frame macroblock, one motion frame
yading@10 46 RV34_MB_P_8x8, ///< P-frame macroblock, 8x8 motion compensation partitions
yading@10 47 RV34_MB_B_FORWARD, ///< B-frame macroblock, forward prediction
yading@10 48 RV34_MB_B_BACKWARD, ///< B-frame macroblock, backward prediction
yading@10 49 RV34_MB_SKIP, ///< Skipped block
yading@10 50 RV34_MB_B_DIRECT, ///< Bidirectionally predicted B-frame macroblock, no motion vectors
yading@10 51 RV34_MB_P_16x8, ///< P-frame macroblock, 16x8 motion compensation partitions
yading@10 52 RV34_MB_P_8x16, ///< P-frame macroblock, 8x16 motion compensation partitions
yading@10 53 RV34_MB_B_BIDIR, ///< Bidirectionally predicted B-frame macroblock, two motion vectors
yading@10 54 RV34_MB_P_MIX16x16, ///< P-frame macroblock with DCs in a separate 4x4 block, one motion vector
yading@10 55 RV34_MB_TYPES
yading@10 56 };
yading@10 57
yading@10 58 /**
yading@10 59 * VLC tables used by the decoder
yading@10 60 *
yading@10 61 * Intra frame VLC sets do not contain some of those tables.
yading@10 62 */
yading@10 63 typedef struct RV34VLC{
yading@10 64 VLC cbppattern[2]; ///< VLCs used for pattern of coded block patterns decoding
yading@10 65 VLC cbp[2][4]; ///< VLCs used for coded block patterns decoding
yading@10 66 VLC first_pattern[4]; ///< VLCs used for decoding coefficients in the first subblock
yading@10 67 VLC second_pattern[2]; ///< VLCs used for decoding coefficients in the subblocks 2 and 3
yading@10 68 VLC third_pattern[2]; ///< VLCs used for decoding coefficients in the last subblock
yading@10 69 VLC coefficient; ///< VLCs used for decoding big coefficients
yading@10 70 }RV34VLC;
yading@10 71
yading@10 72 /** essential slice information */
yading@10 73 typedef struct SliceInfo{
yading@10 74 int type; ///< slice type (intra, inter)
yading@10 75 int quant; ///< quantizer used for this slice
yading@10 76 int vlc_set; ///< VLCs used for this slice
yading@10 77 int start, end; ///< start and end macroblocks of the slice
yading@10 78 int width; ///< coded width
yading@10 79 int height; ///< coded height
yading@10 80 int pts; ///< frame timestamp
yading@10 81 }SliceInfo;
yading@10 82
yading@10 83 /** decoder context */
yading@10 84 typedef struct RV34DecContext{
yading@10 85 MpegEncContext s;
yading@10 86 RV34DSPContext rdsp;
yading@10 87 int8_t *intra_types_hist;///< old block types, used for prediction
yading@10 88 int8_t *intra_types; ///< block types
yading@10 89 int intra_types_stride;///< block types array stride
yading@10 90 const uint8_t *luma_dc_quant_i;///< luma subblock DC quantizer for intraframes
yading@10 91 const uint8_t *luma_dc_quant_p;///< luma subblock DC quantizer for interframes
yading@10 92
yading@10 93 RV34VLC *cur_vlcs; ///< VLC set used for current frame decoding
yading@10 94 H264PredContext h; ///< functions for 4x4 and 16x16 intra block prediction
yading@10 95 SliceInfo si; ///< current slice information
yading@10 96
yading@10 97 int *mb_type; ///< internal macroblock types
yading@10 98 int block_type; ///< current block type
yading@10 99 int luma_vlc; ///< which VLC set will be used for decoding of luma blocks
yading@10 100 int chroma_vlc; ///< which VLC set will be used for decoding of chroma blocks
yading@10 101 int is16; ///< current block has additional 16x16 specific features or not
yading@10 102 int dmv[4][2]; ///< differential motion vectors for the current macroblock
yading@10 103
yading@10 104 int rv30; ///< indicates which RV variasnt is currently decoded
yading@10 105 int rpr; ///< one field size in RV30 slice header
yading@10 106
yading@10 107 int cur_pts, last_pts, next_pts;
yading@10 108 int scaled_weight;
yading@10 109 int weight1, weight2; ///< B frame distance fractions (0.14) used in motion compensation
yading@10 110 int mv_weight1, mv_weight2;
yading@10 111
yading@10 112 uint16_t *cbp_luma; ///< CBP values for luma subblocks
yading@10 113 uint8_t *cbp_chroma; ///< CBP values for chroma subblocks
yading@10 114 uint16_t *deblock_coefs; ///< deblock coefficients for each macroblock
yading@10 115
yading@10 116 /** 8x8 block available flags (for MV prediction) */
yading@10 117 DECLARE_ALIGNED(8, uint32_t, avail_cache)[3*4];
yading@10 118
yading@10 119 /** temporary blocks for RV4 weighted MC */
yading@10 120 uint8_t *tmp_b_block_y[2];
yading@10 121 uint8_t *tmp_b_block_uv[4];
yading@10 122 uint8_t *tmp_b_block_base;
yading@10 123
yading@10 124 int (*parse_slice_header)(struct RV34DecContext *r, GetBitContext *gb, SliceInfo *si);
yading@10 125 int (*decode_mb_info)(struct RV34DecContext *r);
yading@10 126 int (*decode_intra_types)(struct RV34DecContext *r, GetBitContext *gb, int8_t *dst);
yading@10 127 void (*loop_filter)(struct RV34DecContext *r, int row);
yading@10 128 }RV34DecContext;
yading@10 129
yading@10 130 /**
yading@10 131 * common decoding functions
yading@10 132 */
yading@10 133 int ff_rv34_get_start_offset(GetBitContext *gb, int blocks);
yading@10 134 int ff_rv34_decode_init(AVCodecContext *avctx);
yading@10 135 int ff_rv34_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt);
yading@10 136 int ff_rv34_decode_end(AVCodecContext *avctx);
yading@10 137 int ff_rv34_decode_init_thread_copy(AVCodecContext *avctx);
yading@10 138 int ff_rv34_decode_update_thread_context(AVCodecContext *dst, const AVCodecContext *src);
yading@10 139
yading@10 140 #endif /* AVCODEC_RV34_H */