40 int w =
r->s.width,
h =
r->s.height;
56 if (rpr >
r->max_rpr) {
63 "Insufficient extradata - need at least %d bytes, got %d\n",
68 w =
r->s.avctx->extradata[6 + rpr*2] << 2;
69 h =
r->s.avctx->extradata[7 + rpr*2] << 2;
76 mb_size = ((
w + 15) >> 4) * ((
h + 15) >> 4);
90 for(
i = 0;
i < 4;
i++, dst +=
r->intra_types_stride - 4){
91 for(j = 0; j < 4; j+= 2){
97 for(k = 0; k < 2; k++){
98 int A = dst[-
r->intra_types_stride] + 1;
131 return rv30_p_types[
code];
133 return rv30_b_types[
code];
137 const int stride,
const int lim)
142 for(
i = 0;
i < 4;
i++){
143 diff = ((
src[-2*step] -
src[1*step]) - (
src[-1*step] -
src[0*step])*4) >> 3;
157 int loc_lim, cur_lim, left_lim = 0, top_lim = 0;
159 mb_pos = row *
s->mb_stride;
160 for(mb_x = 0; mb_x <
s->mb_width; mb_x++, mb_pos++){
161 int mbtype =
s->current_picture_ptr->mb_type[mb_pos];
163 r->deblock_coefs[mb_pos] = 0xFFFF;
165 r->cbp_chroma[mb_pos] = 0xFF;
171 mb_pos = row *
s->mb_stride;
172 for(mb_x = 0; mb_x <
s->mb_width; mb_x++, mb_pos++){
176 for(j = 0; j < 16; j += 4){
177 Y =
s->current_picture_ptr->f->data[0] + mb_x*16 + (row*16 + j) *
s->linesize + 4 * !mb_x;
178 for(
i = !mb_x;
i < 4;
i++,
Y += 4){
181 if(
r->deblock_coefs[mb_pos] & (1 << ij))
183 else if(!
i &&
r->deblock_coefs[mb_pos - 1] & (1 << (ij + 3)))
185 else if(
i &&
r->deblock_coefs[mb_pos] & (1 << (ij - 1)))
191 for(k = 0; k < 2; k++){
192 int cur_cbp, left_cbp = 0;
193 cur_cbp = (
r->cbp_chroma[mb_pos] >> (k*4)) & 0xF;
195 left_cbp = (
r->cbp_chroma[mb_pos - 1] >> (k*4)) & 0xF;
196 for(j = 0; j < 8; j += 4){
197 C =
s->current_picture_ptr->f->data[k + 1] + mb_x*8 + (row*8 + j) *
s->uvlinesize + 4 * !mb_x;
198 for(
i = !mb_x;
i < 2;
i++,
C += 4){
199 int ij =
i + (j >> 1);
201 if (cur_cbp & (1 << ij))
203 else if(!
i && left_cbp & (1 << (ij + 1)))
205 else if(
i && cur_cbp & (1 << (ij - 1)))
213 mb_pos = row *
s->mb_stride;
214 for(mb_x = 0; mb_x <
s->mb_width; mb_x++, mb_pos++){
218 for(j = 4*!row; j < 16; j += 4){
219 Y =
s->current_picture_ptr->f->data[0] + mb_x*16 + (row*16 + j) *
s->linesize;
220 for(
i = 0;
i < 4;
i++,
Y += 4){
223 if(
r->deblock_coefs[mb_pos] & (1 << ij))
225 else if(!j &&
r->deblock_coefs[mb_pos -
s->mb_stride] & (1 << (ij + 12)))
227 else if( j &&
r->deblock_coefs[mb_pos] & (1 << (ij - 4)))
233 for(k = 0; k < 2; k++){
234 int cur_cbp, top_cbp = 0;
235 cur_cbp = (
r->cbp_chroma[mb_pos] >> (k*4)) & 0xF;
237 top_cbp = (
r->cbp_chroma[mb_pos -
s->mb_stride] >> (k*4)) & 0xF;
238 for(j = 4*!row; j < 8; j += 4){
239 C =
s->current_picture_ptr->f->data[k+1] + mb_x*8 + (row*8 + j) *
s->uvlinesize;
240 for(
i = 0;
i < 2;
i++,
C += 4){
241 int ij =
i + (j >> 1);
243 if (
r->cbp_chroma[mb_pos] & (1 << ij))
245 else if(!j && top_cbp & (1 << (ij + 2)))
247 else if( j && cur_cbp & (1 << (ij - 2)))
static void flush(AVCodecContext *avctx)
Libavcodec external API header.
static av_cold int init(AVCodecContext *avctx)
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits1(GetBitContext *s)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static unsigned get_interleaved_ue_golomb(GetBitContext *gb)
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
@ AV_PICTURE_TYPE_B
Bi-dir predicted.
#define FF_CODEC_CAP_ALLOCATE_PROGRESS
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
#define ONLY_IF_THREADS_ENABLED(x)
Define a function with only the non-default version specified.
static enum AVPixelFormat pix_fmts[]
void ff_mpeg_flush(AVCodecContext *avctx)
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
static void rv30_weak_loop_filter(uint8_t *src, const int step, const int stride, const int lim)
static int rv30_decode_intra_types(RV34DecContext *r, GetBitContext *gb, int8_t *dst)
Decode 4x4 intra types array.
static int rv30_parse_slice_header(RV34DecContext *r, GetBitContext *gb, SliceInfo *si)
static void rv30_loop_filter(RV34DecContext *r, int row)
static int rv30_decode_mb_info(RV34DecContext *r)
Decode macroblock information.
static av_cold int rv30_decode_init(AVCodecContext *avctx)
Initialize decoder.
miscellaneous RV30 tables
static const uint8_t rv30_luma_dc_quant[32]
DC quantizer mapping for RV30.
static const uint8_t rv30_itype_from_context[900]
This table is used for retrieving the current intra type based on its neighbors and adjustment provid...
static const uint8_t rv30_itype_code[9 *9 *2]
This table is used for storing the differences between the predicted and the real intra type.
static const uint8_t rv30_loop_filt_lim[32]
Loop filter limits are taken from this table.
av_cold int ff_rv34_decode_end(AVCodecContext *avctx)
int ff_rv34_get_start_offset(GetBitContext *gb, int mb_size)
Decode starting slice position.
int ff_rv34_decode_frame(AVCodecContext *avctx, void *data, int *got_picture_ptr, AVPacket *avpkt)
av_cold int ff_rv34_decode_init(AVCodecContext *avctx)
Initialize decoder.
int ff_rv34_decode_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
RV30 and RV40 decoder common data declarations.
#define IS_SEPARATE_DC(a)
@ RV34_MB_TYPE_INTRA
Intra macroblock.
@ RV34_MB_B_BACKWARD
B-frame macroblock, backward prediction.
@ RV34_MB_B_DIRECT
Bidirectionally predicted B-frame macroblock, no motion vectors.
@ RV34_MB_P_16x16
P-frame macroblock, one motion frame.
@ RV34_MB_P_8x8
P-frame macroblock, 8x8 motion compensation partitions.
@ RV34_MB_B_FORWARD
B-frame macroblock, forward prediction.
@ RV34_MB_TYPE_INTRA16x16
Intra macroblock with DCs in a separate 4x4 block.
@ RV34_MB_SKIP
Skipped block.
main external API structure.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
int coded_width
Bitstream width / height, may be different from width/height e.g.
const char * name
Name of the codec implementation.
essential slice information
int quant
quantizer used for this slice
int type
slice type (intra, inter)
static av_always_inline int diff(const uint32_t a, const uint32_t b)