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