Rename VC9 to VC1 as there is no such thing as VC9
Originally committed as revision 5529 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
f33aa12011
commit
10b9c374cf
@ -194,8 +194,8 @@ endif
|
||||
ifeq ($(CONFIG_ULTI_DECODER),yes)
|
||||
OBJS+= ulti.o
|
||||
endif
|
||||
ifneq ($(CONFIG_VC9_DECODER)$(CONFIG_WMV3_DECODER),)
|
||||
OBJS+= vc9.o
|
||||
ifneq ($(CONFIG_VC1_DECODER)$(CONFIG_WMV3_DECODER),)
|
||||
OBJS+= vc1.o
|
||||
endif
|
||||
ifneq ($(CONFIG_VCR1_DECODER)$(CONFIG_VCR1_ENCODER),)
|
||||
OBJS+= vcr1.o
|
||||
|
@ -226,9 +226,9 @@ void avcodec_register_all(void)
|
||||
#ifdef CONFIG_WMV2_DECODER
|
||||
register_avcodec(&wmv2_decoder);
|
||||
#endif //CONFIG_WMV2_DECODER
|
||||
#ifdef CONFIG_VC9_DECODER
|
||||
register_avcodec(&vc9_decoder);
|
||||
#endif //CONFIG_VC9_DECODER
|
||||
#ifdef CONFIG_VC1_DECODER
|
||||
register_avcodec(&vc1_decoder);
|
||||
#endif //CONFIG_VC1_DECODER
|
||||
/* Reenable when it stops crashing on every file, causing bug report spam.
|
||||
#ifdef CONFIG_WMV3_DECODER
|
||||
register_avcodec(&wmv3_decoder);
|
||||
|
@ -101,7 +101,7 @@ enum CodecID {
|
||||
CODEC_ID_FFVHUFF,
|
||||
CODEC_ID_RV30,
|
||||
CODEC_ID_RV40,
|
||||
CODEC_ID_VC9,
|
||||
CODEC_ID_VC1,
|
||||
CODEC_ID_WMV3,
|
||||
CODEC_ID_LOCO,
|
||||
CODEC_ID_WNV1,
|
||||
@ -2112,7 +2112,7 @@ extern AVCodec msmpeg4v2_decoder;
|
||||
extern AVCodec msmpeg4v3_decoder;
|
||||
extern AVCodec wmv1_decoder;
|
||||
extern AVCodec wmv2_decoder;
|
||||
extern AVCodec vc9_decoder;
|
||||
extern AVCodec vc1_decoder;
|
||||
extern AVCodec wmv3_decoder;
|
||||
extern AVCodec mpeg1video_decoder;
|
||||
extern AVCodec mpeg2video_decoder;
|
||||
|
@ -75,7 +75,7 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64]);
|
||||
static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64]);
|
||||
static int wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64]);
|
||||
|
||||
/* vc9 externs */
|
||||
/* vc1 externs */
|
||||
extern uint8_t wmv3_dc_scale_table[32];
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -177,7 +177,7 @@ static void common_init(MpegEncContext * s)
|
||||
s->y_dc_scale_table= wmv1_y_dc_scale_table;
|
||||
s->c_dc_scale_table= wmv1_c_dc_scale_table;
|
||||
break;
|
||||
#if defined(CONFIG_WMV3_DECODER)||defined(CONFIG_VC9_DECODER)
|
||||
#if defined(CONFIG_WMV3_DECODER)||defined(CONFIG_VC1_DECODER)
|
||||
case 6:
|
||||
s->y_dc_scale_table= wmv3_dc_scale_table;
|
||||
s->c_dc_scale_table= wmv3_dc_scale_table;
|
||||
@ -1197,7 +1197,7 @@ int ff_msmpeg4_decode_init(MpegEncContext *s)
|
||||
case 5:
|
||||
s->decode_mb= wmv2_decode_mb;
|
||||
case 6:
|
||||
//FIXME + TODO VC9 decode mb
|
||||
//FIXME + TODO VC1 decode mb
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* VC-9 and WMV3 decoder
|
||||
* VC-1 and WMV3 decoder
|
||||
* Copyright (c) 2005 Anonymous
|
||||
* Copyright (c) 2005 Alex Beregszaszi
|
||||
* Copyright (c) 2005 Michael Niedermayer
|
||||
@ -21,8 +21,8 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file vc9.c
|
||||
* VC-9 and WMV3 decoder
|
||||
* @file vc1.c
|
||||
* VC-1 and WMV3 decoder
|
||||
*
|
||||
* TODO: most AP stuff, optimize, most of MB layer, transform, filtering and motion compensation, etc
|
||||
* TODO: use MPV_ !!
|
||||
@ -31,7 +31,7 @@
|
||||
#include "dsputil.h"
|
||||
#include "avcodec.h"
|
||||
#include "mpegvideo.h"
|
||||
#include "vc9data.h"
|
||||
#include "vc1data.h"
|
||||
|
||||
#undef NDEBUG
|
||||
#include <assert.h>
|
||||
@ -149,31 +149,31 @@ static const uint8_t pquant_table[3][32] = {
|
||||
}
|
||||
};
|
||||
|
||||
/** @name VC-9 VLC tables and defines
|
||||
/** @name VC-1 VLC tables and defines
|
||||
* @todo TODO move this into the context
|
||||
*/
|
||||
//@{
|
||||
#define VC9_BFRACTION_VLC_BITS 7
|
||||
static VLC vc9_bfraction_vlc;
|
||||
#define VC9_IMODE_VLC_BITS 4
|
||||
static VLC vc9_imode_vlc;
|
||||
#define VC9_NORM2_VLC_BITS 3
|
||||
static VLC vc9_norm2_vlc;
|
||||
#define VC9_NORM6_VLC_BITS 9
|
||||
static VLC vc9_norm6_vlc;
|
||||
#define VC1_BFRACTION_VLC_BITS 7
|
||||
static VLC vc1_bfraction_vlc;
|
||||
#define VC1_IMODE_VLC_BITS 4
|
||||
static VLC vc1_imode_vlc;
|
||||
#define VC1_NORM2_VLC_BITS 3
|
||||
static VLC vc1_norm2_vlc;
|
||||
#define VC1_NORM6_VLC_BITS 9
|
||||
static VLC vc1_norm6_vlc;
|
||||
/* Could be optimized, one table only needs 8 bits */
|
||||
#define VC9_TTMB_VLC_BITS 9 //12
|
||||
static VLC vc9_ttmb_vlc[3];
|
||||
#define VC9_MV_DIFF_VLC_BITS 9 //15
|
||||
static VLC vc9_mv_diff_vlc[4];
|
||||
#define VC9_CBPCY_P_VLC_BITS 9 //14
|
||||
static VLC vc9_cbpcy_p_vlc[4];
|
||||
#define VC9_4MV_BLOCK_PATTERN_VLC_BITS 6
|
||||
static VLC vc9_4mv_block_pattern_vlc[4];
|
||||
#define VC9_TTBLK_VLC_BITS 5
|
||||
static VLC vc9_ttblk_vlc[3];
|
||||
#define VC9_SUBBLKPAT_VLC_BITS 6
|
||||
static VLC vc9_subblkpat_vlc[3];
|
||||
#define VC1_TTMB_VLC_BITS 9 //12
|
||||
static VLC vc1_ttmb_vlc[3];
|
||||
#define VC1_MV_DIFF_VLC_BITS 9 //15
|
||||
static VLC vc1_mv_diff_vlc[4];
|
||||
#define VC1_CBPCY_P_VLC_BITS 9 //14
|
||||
static VLC vc1_cbpcy_p_vlc[4];
|
||||
#define VC1_4MV_BLOCK_PATTERN_VLC_BITS 6
|
||||
static VLC vc1_4mv_block_pattern_vlc[4];
|
||||
#define VC1_TTBLK_VLC_BITS 5
|
||||
static VLC vc1_ttblk_vlc[3];
|
||||
#define VC1_SUBBLKPAT_VLC_BITS 6
|
||||
static VLC vc1_subblkpat_vlc[3];
|
||||
//@}
|
||||
|
||||
/** Bitplane struct
|
||||
@ -190,11 +190,11 @@ typedef struct BitPlane {
|
||||
uint8_t is_raw; ///< Bit values must be read at MB level
|
||||
} BitPlane;
|
||||
|
||||
/** The VC9 Context
|
||||
/** The VC1 Context
|
||||
* @fixme Change size wherever another size is more efficient
|
||||
* Many members are only used for Advanced Profile
|
||||
*/
|
||||
typedef struct VC9Context{
|
||||
typedef struct VC1Context{
|
||||
MpegEncContext s;
|
||||
|
||||
/** Simple/Main Profile sequence header */
|
||||
@ -328,7 +328,7 @@ typedef struct VC9Context{
|
||||
uint8_t range_mapuv;
|
||||
//@}
|
||||
#endif
|
||||
} VC9Context;
|
||||
} VC1Context;
|
||||
|
||||
/**
|
||||
* Get unary code of limited length
|
||||
@ -373,11 +373,11 @@ static int get_prefix(GetBitContext *gb, int stop, int len)
|
||||
}
|
||||
|
||||
/**
|
||||
* Init VC-9 specific tables and VC9Context members
|
||||
* @param v The VC9Context to initialize
|
||||
* Init VC-1 specific tables and VC1Context members
|
||||
* @param v The VC1Context to initialize
|
||||
* @return Status
|
||||
*/
|
||||
static int vc9_init_common(VC9Context *v)
|
||||
static int vc1_init_common(VC1Context *v)
|
||||
{
|
||||
static int done = 0;
|
||||
int i = 0;
|
||||
@ -394,12 +394,12 @@ static int vc9_init_common(VC9Context *v)
|
||||
/* VLC tables */
|
||||
#if 0 // spec -> actual tables converter
|
||||
for(i=0; i<64; i++){
|
||||
int code= (vc9_norm6_spec[i][1] << vc9_norm6_spec[i][4]) + vc9_norm6_spec[i][3];
|
||||
int code= (vc1_norm6_spec[i][1] << vc1_norm6_spec[i][4]) + vc1_norm6_spec[i][3];
|
||||
av_log(NULL, AV_LOG_DEBUG, "0x%03X, ", code);
|
||||
if(i%16==15) av_log(NULL, AV_LOG_DEBUG, "\n");
|
||||
}
|
||||
for(i=0; i<64; i++){
|
||||
int code= vc9_norm6_spec[i][2] + vc9_norm6_spec[i][4];
|
||||
int code= vc1_norm6_spec[i][2] + vc1_norm6_spec[i][4];
|
||||
av_log(NULL, AV_LOG_DEBUG, "%2d, ", code);
|
||||
if(i%16==15) av_log(NULL, AV_LOG_DEBUG, "\n");
|
||||
}
|
||||
@ -407,41 +407,41 @@ static int vc9_init_common(VC9Context *v)
|
||||
if(!done)
|
||||
{
|
||||
done = 1;
|
||||
INIT_VLC(&vc9_bfraction_vlc, VC9_BFRACTION_VLC_BITS, 23,
|
||||
vc9_bfraction_bits, 1, 1,
|
||||
vc9_bfraction_codes, 1, 1, 1);
|
||||
INIT_VLC(&vc9_norm2_vlc, VC9_NORM2_VLC_BITS, 4,
|
||||
vc9_norm2_bits, 1, 1,
|
||||
vc9_norm2_codes, 1, 1, 1);
|
||||
INIT_VLC(&vc9_norm6_vlc, VC9_NORM6_VLC_BITS, 64,
|
||||
vc9_norm6_bits, 1, 1,
|
||||
vc9_norm6_codes, 2, 2, 1);
|
||||
INIT_VLC(&vc9_imode_vlc, VC9_IMODE_VLC_BITS, 7,
|
||||
vc9_imode_bits, 1, 1,
|
||||
vc9_imode_codes, 1, 1, 1);
|
||||
INIT_VLC(&vc1_bfraction_vlc, VC1_BFRACTION_VLC_BITS, 23,
|
||||
vc1_bfraction_bits, 1, 1,
|
||||
vc1_bfraction_codes, 1, 1, 1);
|
||||
INIT_VLC(&vc1_norm2_vlc, VC1_NORM2_VLC_BITS, 4,
|
||||
vc1_norm2_bits, 1, 1,
|
||||
vc1_norm2_codes, 1, 1, 1);
|
||||
INIT_VLC(&vc1_norm6_vlc, VC1_NORM6_VLC_BITS, 64,
|
||||
vc1_norm6_bits, 1, 1,
|
||||
vc1_norm6_codes, 2, 2, 1);
|
||||
INIT_VLC(&vc1_imode_vlc, VC1_IMODE_VLC_BITS, 7,
|
||||
vc1_imode_bits, 1, 1,
|
||||
vc1_imode_codes, 1, 1, 1);
|
||||
for (i=0; i<3; i++)
|
||||
{
|
||||
INIT_VLC(&vc9_ttmb_vlc[i], VC9_TTMB_VLC_BITS, 16,
|
||||
vc9_ttmb_bits[i], 1, 1,
|
||||
vc9_ttmb_codes[i], 2, 2, 1);
|
||||
INIT_VLC(&vc9_ttblk_vlc[i], VC9_TTBLK_VLC_BITS, 8,
|
||||
vc9_ttblk_bits[i], 1, 1,
|
||||
vc9_ttblk_codes[i], 1, 1, 1);
|
||||
INIT_VLC(&vc9_subblkpat_vlc[i], VC9_SUBBLKPAT_VLC_BITS, 15,
|
||||
vc9_subblkpat_bits[i], 1, 1,
|
||||
vc9_subblkpat_codes[i], 1, 1, 1);
|
||||
INIT_VLC(&vc1_ttmb_vlc[i], VC1_TTMB_VLC_BITS, 16,
|
||||
vc1_ttmb_bits[i], 1, 1,
|
||||
vc1_ttmb_codes[i], 2, 2, 1);
|
||||
INIT_VLC(&vc1_ttblk_vlc[i], VC1_TTBLK_VLC_BITS, 8,
|
||||
vc1_ttblk_bits[i], 1, 1,
|
||||
vc1_ttblk_codes[i], 1, 1, 1);
|
||||
INIT_VLC(&vc1_subblkpat_vlc[i], VC1_SUBBLKPAT_VLC_BITS, 15,
|
||||
vc1_subblkpat_bits[i], 1, 1,
|
||||
vc1_subblkpat_codes[i], 1, 1, 1);
|
||||
}
|
||||
for(i=0; i<4; i++)
|
||||
{
|
||||
INIT_VLC(&vc9_4mv_block_pattern_vlc[i], VC9_4MV_BLOCK_PATTERN_VLC_BITS, 16,
|
||||
vc9_4mv_block_pattern_bits[i], 1, 1,
|
||||
vc9_4mv_block_pattern_codes[i], 1, 1, 1);
|
||||
INIT_VLC(&vc9_cbpcy_p_vlc[i], VC9_CBPCY_P_VLC_BITS, 64,
|
||||
vc9_cbpcy_p_bits[i], 1, 1,
|
||||
vc9_cbpcy_p_codes[i], 2, 2, 1);
|
||||
INIT_VLC(&vc9_mv_diff_vlc[i], VC9_MV_DIFF_VLC_BITS, 73,
|
||||
vc9_mv_diff_bits[i], 1, 1,
|
||||
vc9_mv_diff_codes[i], 2, 2, 1);
|
||||
INIT_VLC(&vc1_4mv_block_pattern_vlc[i], VC1_4MV_BLOCK_PATTERN_VLC_BITS, 16,
|
||||
vc1_4mv_block_pattern_bits[i], 1, 1,
|
||||
vc1_4mv_block_pattern_codes[i], 1, 1, 1);
|
||||
INIT_VLC(&vc1_cbpcy_p_vlc[i], VC1_CBPCY_P_VLC_BITS, 64,
|
||||
vc1_cbpcy_p_bits[i], 1, 1,
|
||||
vc1_cbpcy_p_codes[i], 2, 2, 1);
|
||||
INIT_VLC(&vc1_mv_diff_vlc[i], VC1_MV_DIFF_VLC_BITS, 73,
|
||||
vc1_mv_diff_bits[i], 1, 1,
|
||||
vc1_mv_diff_codes[i], 2, 2, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -456,11 +456,11 @@ static int vc9_init_common(VC9Context *v)
|
||||
/**
|
||||
* Decode sequence header's Hypothetic Reference Decoder data
|
||||
* @see 6.2.1, p32
|
||||
* @param v The VC9Context to initialize
|
||||
* @param v The VC1Context to initialize
|
||||
* @param gb A GetBitContext initialized from AVCodecContext extra_data
|
||||
* @return Status
|
||||
*/
|
||||
static int decode_hrd(VC9Context *v, GetBitContext *gb)
|
||||
static int decode_hrd(VC1Context *v, GetBitContext *gb)
|
||||
{
|
||||
int i, num;
|
||||
|
||||
@ -530,13 +530,13 @@ static int decode_hrd(VC9Context *v, GetBitContext *gb)
|
||||
* Decode sequence header for Advanced Profile
|
||||
* @see Table 2, p18
|
||||
* @see 6.1.7, pp21-27
|
||||
* @param v The VC9Context to initialize
|
||||
* @param v The VC1Context to initialize
|
||||
* @param gb A GetBitContext initialized from AVCodecContext extra_data
|
||||
* @return Status
|
||||
*/
|
||||
static int decode_advanced_sequence_header(AVCodecContext *avctx, GetBitContext *gb)
|
||||
{
|
||||
VC9Context *v = avctx->priv_data;
|
||||
VC1Context *v = avctx->priv_data;
|
||||
int nr, dr, aspect_ratio;
|
||||
|
||||
v->postprocflag = get_bits(gb, 1);
|
||||
@ -582,7 +582,7 @@ static int decode_advanced_sequence_header(AVCodecContext *avctx, GetBitContext
|
||||
}
|
||||
else
|
||||
{
|
||||
avctx->sample_aspect_ratio = vc9_pixel_aspect[aspect_ratio];
|
||||
avctx->sample_aspect_ratio = vc1_pixel_aspect[aspect_ratio];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -705,7 +705,7 @@ static int decode_advanced_sequence_header(AVCodecContext *avctx, GetBitContext
|
||||
*/
|
||||
static int decode_sequence_header(AVCodecContext *avctx, GetBitContext *gb)
|
||||
{
|
||||
VC9Context *v = avctx->priv_data;
|
||||
VC1Context *v = avctx->priv_data;
|
||||
|
||||
av_log(avctx, AV_LOG_DEBUG, "Header: %0X\n", show_bits(gb, 32));
|
||||
v->profile = get_bits(gb, 2);
|
||||
@ -863,7 +863,7 @@ static int decode_sequence_header(AVCodecContext *avctx, GetBitContext *gb)
|
||||
*/
|
||||
static int advanced_entry_point_process(AVCodecContext *avctx, GetBitContext *gb)
|
||||
{
|
||||
VC9Context *v = avctx->priv_data;
|
||||
VC1Context *v = avctx->priv_data;
|
||||
int i;
|
||||
if (v->profile != PROFILE_ADVANCED)
|
||||
{
|
||||
@ -903,7 +903,7 @@ static int advanced_entry_point_process(AVCodecContext *avctx, GetBitContext *gb
|
||||
|
||||
/***********************************************************************/
|
||||
/**
|
||||
* @defgroup bitplane VC9 Bitplane decoding
|
||||
* @defgroup bitplane VC1 Bitplane decoding
|
||||
* @see 8.7, p56
|
||||
* @{
|
||||
*/
|
||||
@ -990,12 +990,12 @@ static void decode_colskip(uint8_t* plane, int width, int height, int stride, Ge
|
||||
|
||||
/** Decode a bitplane's bits
|
||||
* @param bp Bitplane where to store the decode bits
|
||||
* @param v VC9 context for bit reading and logging
|
||||
* @param v VC1 context for bit reading and logging
|
||||
* @return Status
|
||||
* @fixme FIXME: Optimize
|
||||
* @todo TODO: Decide if a struct is needed
|
||||
*/
|
||||
static int bitplane_decoding(BitPlane *bp, VC9Context *v)
|
||||
static int bitplane_decoding(BitPlane *bp, VC1Context *v)
|
||||
{
|
||||
GetBitContext *gb = &v->s.gb;
|
||||
|
||||
@ -1003,7 +1003,7 @@ static int bitplane_decoding(BitPlane *bp, VC9Context *v)
|
||||
uint8_t invert, *planep = bp->data;
|
||||
|
||||
invert = get_bits(gb, 1);
|
||||
imode = get_vlc2(gb, vc9_imode_vlc.table, VC9_IMODE_VLC_BITS, 2);
|
||||
imode = get_vlc2(gb, vc1_imode_vlc.table, VC1_IMODE_VLC_BITS, 2);
|
||||
|
||||
bp->is_raw = 0;
|
||||
switch (imode)
|
||||
@ -1025,14 +1025,14 @@ static int bitplane_decoding(BitPlane *bp, VC9Context *v)
|
||||
{
|
||||
for(; x<bp->width; x+=2)
|
||||
{
|
||||
code = get_vlc2(gb, vc9_norm2_vlc.table, VC9_NORM2_VLC_BITS, 2);
|
||||
code = get_vlc2(gb, vc1_norm2_vlc.table, VC1_NORM2_VLC_BITS, 2);
|
||||
*(++planep) = code&1; //lsb => left
|
||||
*(++planep) = (code>>1)&1; //msb => right
|
||||
}
|
||||
planep += bp->stride-bp->width;
|
||||
if ((bp->width-offset)&1) //Odd number previously processed
|
||||
{
|
||||
code = get_vlc2(gb, vc9_norm2_vlc.table, VC9_NORM2_VLC_BITS, 2);
|
||||
code = get_vlc2(gb, vc1_norm2_vlc.table, VC1_NORM2_VLC_BITS, 2);
|
||||
*planep = code&1;
|
||||
planep += bp->stride-bp->width;
|
||||
*planep = (code>>1)&1; //msb => right
|
||||
@ -1053,7 +1053,7 @@ static int bitplane_decoding(BitPlane *bp, VC9Context *v)
|
||||
|
||||
for(y= bp->height%tile_h; y< bp->height; y+=tile_h){
|
||||
for(x= bp->width%tile_w; x< bp->width; x+=tile_w){
|
||||
code = get_vlc2(gb, vc9_norm6_vlc.table, VC9_NORM6_VLC_BITS, 2);
|
||||
code = get_vlc2(gb, vc1_norm6_vlc.table, VC1_NORM6_VLC_BITS, 2);
|
||||
if(code<0){
|
||||
av_log(v->s.avctx, AV_LOG_DEBUG, "invalid NORM-6 VLC\n");
|
||||
return -1;
|
||||
@ -1120,9 +1120,9 @@ static int bitplane_decoding(BitPlane *bp, VC9Context *v)
|
||||
|
||||
/***********************************************************************/
|
||||
/** VOP Dquant decoding
|
||||
* @param v VC9 Context
|
||||
* @param v VC1 Context
|
||||
*/
|
||||
static int vop_dquant_decoding(VC9Context *v)
|
||||
static int vop_dquant_decoding(VC1Context *v)
|
||||
{
|
||||
GetBitContext *gb = &v->s.gb;
|
||||
int pqdiff;
|
||||
@ -1163,18 +1163,18 @@ static int vop_dquant_decoding(VC9Context *v)
|
||||
|
||||
/***********************************************************************/
|
||||
/**
|
||||
* @defgroup all_frame_hdr All VC9 profiles frame header
|
||||
* @defgroup all_frame_hdr All VC1 profiles frame header
|
||||
* @brief Part of the frame header decoding from all profiles
|
||||
* @warning Only pro/epilog differs between Simple/Main and Advanced => check caller
|
||||
* @{
|
||||
*/
|
||||
/** B and BI frame header decoding, primary part
|
||||
* @see Tables 11+12, p62-65
|
||||
* @param v VC9 context
|
||||
* @param v VC1 context
|
||||
* @return Status
|
||||
* @warning Also handles BI frames
|
||||
*/
|
||||
static int decode_b_picture_primary_header(VC9Context *v)
|
||||
static int decode_b_picture_primary_header(VC1Context *v)
|
||||
{
|
||||
GetBitContext *gb = &v->s.gb;
|
||||
int pqindex;
|
||||
@ -1185,8 +1185,8 @@ static int decode_b_picture_primary_header(VC9Context *v)
|
||||
av_log(v->s.avctx, AV_LOG_ERROR, "Found a B frame while in Simple Profile!\n");
|
||||
return FRAME_SKIPPED;
|
||||
}
|
||||
v->bfraction = vc9_bfraction_lut[get_vlc2(gb, vc9_bfraction_vlc.table,
|
||||
VC9_BFRACTION_VLC_BITS, 2)];
|
||||
v->bfraction = vc1_bfraction_lut[get_vlc2(gb, vc1_bfraction_vlc.table,
|
||||
VC1_BFRACTION_VLC_BITS, 2)];
|
||||
if (v->bfraction < -1)
|
||||
{
|
||||
av_log(v->s.avctx, AV_LOG_ERROR, "Invalid BFRaction\n");
|
||||
@ -1254,13 +1254,13 @@ static int decode_b_picture_primary_header(VC9Context *v)
|
||||
|
||||
/** B and BI frame header decoding, secondary part
|
||||
* @see Tables 11+12, p62-65
|
||||
* @param v VC9 context
|
||||
* @param v VC1 context
|
||||
* @return Status
|
||||
* @warning Also handles BI frames
|
||||
* @warning To call once all MB arrays are allocated
|
||||
* @todo Support Advanced Profile headers
|
||||
*/
|
||||
static int decode_b_picture_secondary_header(VC9Context *v)
|
||||
static int decode_b_picture_secondary_header(VC1Context *v)
|
||||
{
|
||||
GetBitContext *gb = &v->s.gb;
|
||||
int status;
|
||||
@ -1292,8 +1292,8 @@ static int decode_b_picture_secondary_header(VC9Context *v)
|
||||
#endif
|
||||
|
||||
/* FIXME: what is actually chosen for B frames ? */
|
||||
v->s.mv_table_index = get_bits(gb, 2); //but using vc9_ tables
|
||||
v->cbpcy_vlc = &vc9_cbpcy_p_vlc[get_bits(gb, 2)];
|
||||
v->s.mv_table_index = get_bits(gb, 2); //but using vc1_ tables
|
||||
v->cbpcy_vlc = &vc1_cbpcy_p_vlc[get_bits(gb, 2)];
|
||||
|
||||
if (v->dquant)
|
||||
{
|
||||
@ -1316,11 +1316,11 @@ static int decode_b_picture_secondary_header(VC9Context *v)
|
||||
|
||||
/** I frame header decoding, primary part
|
||||
* @see Tables 5+7, p53-54 and 55-57
|
||||
* @param v VC9 context
|
||||
* @param v VC1 context
|
||||
* @return Status
|
||||
* @todo Support Advanced Profile headers
|
||||
*/
|
||||
static int decode_i_picture_primary_header(VC9Context *v)
|
||||
static int decode_i_picture_primary_header(VC1Context *v)
|
||||
{
|
||||
GetBitContext *gb = &v->s.gb;
|
||||
int pqindex;
|
||||
@ -1349,12 +1349,12 @@ static int decode_i_picture_primary_header(VC9Context *v)
|
||||
}
|
||||
|
||||
/** I frame header decoding, secondary part
|
||||
* @param v VC9 context
|
||||
* @param v VC1 context
|
||||
* @return Status
|
||||
* @warning Not called in A/S/C profiles, it seems
|
||||
* @todo Support Advanced Profile headers
|
||||
*/
|
||||
static int decode_i_picture_secondary_header(VC9Context *v)
|
||||
static int decode_i_picture_secondary_header(VC1Context *v)
|
||||
{
|
||||
#if HAS_ADVANCED_PROFILE
|
||||
int status;
|
||||
@ -1389,11 +1389,11 @@ static int decode_i_picture_secondary_header(VC9Context *v)
|
||||
|
||||
/** P frame header decoding, primary part
|
||||
* @see Tables 5+7, p53-54 and 55-57
|
||||
* @param v VC9 context
|
||||
* @param v VC1 context
|
||||
* @todo Support Advanced Profile headers
|
||||
* @return Status
|
||||
*/
|
||||
static int decode_p_picture_primary_header(VC9Context *v)
|
||||
static int decode_p_picture_primary_header(VC1Context *v)
|
||||
{
|
||||
/* INTERFRM, FRMCNT, RANGEREDFRM read in caller */
|
||||
GetBitContext *gb = &v->s.gb;
|
||||
@ -1433,11 +1433,11 @@ static int decode_p_picture_primary_header(VC9Context *v)
|
||||
|
||||
/** P frame header decoding, secondary part
|
||||
* @see Tables 5+7, p53-54 and 55-57
|
||||
* @param v VC9 context
|
||||
* @param v VC1 context
|
||||
* @warning To call once all MB arrays are allocated
|
||||
* @return Status
|
||||
*/
|
||||
static int decode_p_picture_secondary_header(VC9Context *v)
|
||||
static int decode_p_picture_secondary_header(VC1Context *v)
|
||||
{
|
||||
GetBitContext *gb = &v->s.gb;
|
||||
int status = 0;
|
||||
@ -1461,8 +1461,8 @@ static int decode_p_picture_secondary_header(VC9Context *v)
|
||||
#endif
|
||||
|
||||
/* Hopefully this is correct for P frames */
|
||||
v->s.mv_table_index =get_bits(gb, 2); //but using vc9_ tables
|
||||
v->cbpcy_vlc = &vc9_cbpcy_p_vlc[get_bits(gb, 2)];
|
||||
v->s.mv_table_index =get_bits(gb, 2); //but using vc1_ tables
|
||||
v->cbpcy_vlc = &vc1_cbpcy_p_vlc[get_bits(gb, 2)];
|
||||
|
||||
if (v->dquant)
|
||||
{
|
||||
@ -1489,7 +1489,7 @@ static int decode_p_picture_secondary_header(VC9Context *v)
|
||||
|
||||
/***********************************************************************/
|
||||
/**
|
||||
* @defgroup std_frame_hdr VC9 Simple/Main Profiles header decoding
|
||||
* @defgroup std_frame_hdr VC1 Simple/Main Profiles header decoding
|
||||
* @brief Part of the frame header decoding belonging to Simple/Main Profiles
|
||||
* @warning Only pro/epilog differs between Simple/Main and Advanced =>
|
||||
* check caller
|
||||
@ -1498,12 +1498,12 @@ static int decode_p_picture_secondary_header(VC9Context *v)
|
||||
|
||||
/** Frame header decoding, first part, in Simple and Main profiles
|
||||
* @see Tables 5+7, p53-54 and 55-57
|
||||
* @param v VC9 context
|
||||
* @param v VC1 context
|
||||
* @todo FIXME: RANGEREDFRM element not read if BI frame from Table6, P54
|
||||
* However, 7.1.1.8 says "all frame types, for main profiles"
|
||||
* @return Status
|
||||
*/
|
||||
static int standard_decode_picture_primary_header(VC9Context *v)
|
||||
static int standard_decode_picture_primary_header(VC1Context *v)
|
||||
{
|
||||
GetBitContext *gb = &v->s.gb;
|
||||
int status = 0;
|
||||
@ -1540,11 +1540,11 @@ static int standard_decode_picture_primary_header(VC9Context *v)
|
||||
}
|
||||
|
||||
/** Frame header decoding, secondary part
|
||||
* @param v VC9 context
|
||||
* @param v VC1 context
|
||||
* @warning To call once all MB arrays are allocated
|
||||
* @return Status
|
||||
*/
|
||||
static int standard_decode_picture_secondary_header(VC9Context *v)
|
||||
static int standard_decode_picture_secondary_header(VC1Context *v)
|
||||
{
|
||||
GetBitContext *gb = &v->s.gb;
|
||||
int status = 0;
|
||||
@ -1574,17 +1574,17 @@ static int standard_decode_picture_secondary_header(VC9Context *v)
|
||||
#if HAS_ADVANCED_PROFILE
|
||||
/***********************************************************************/
|
||||
/**
|
||||
* @defgroup adv_frame_hdr VC9 Advanced Profile header decoding
|
||||
* @defgroup adv_frame_hdr VC1 Advanced Profile header decoding
|
||||
* @brief Part of the frame header decoding belonging to Advanced Profiles
|
||||
* @warning Only pro/epilog differs between Simple/Main and Advanced =>
|
||||
* check caller
|
||||
* @{
|
||||
*/
|
||||
/** Frame header decoding, primary part
|
||||
* @param v VC9 context
|
||||
* @param v VC1 context
|
||||
* @return Status
|
||||
*/
|
||||
static int advanced_decode_picture_primary_header(VC9Context *v)
|
||||
static int advanced_decode_picture_primary_header(VC1Context *v)
|
||||
{
|
||||
GetBitContext *gb = &v->s.gb;
|
||||
static const int type_table[4] = { P_TYPE, B_TYPE, I_TYPE, BI_TYPE };
|
||||
@ -1641,10 +1641,10 @@ static int advanced_decode_picture_primary_header(VC9Context *v)
|
||||
}
|
||||
|
||||
/** Frame header decoding, secondary part
|
||||
* @param v VC9 context
|
||||
* @param v VC1 context
|
||||
* @return Status
|
||||
*/
|
||||
static int advanced_decode_picture_secondary_header(VC9Context *v)
|
||||
static int advanced_decode_picture_secondary_header(VC1Context *v)
|
||||
{
|
||||
GetBitContext *gb = &v->s.gb;
|
||||
int status = 0;
|
||||
@ -1674,7 +1674,7 @@ static int advanced_decode_picture_secondary_header(VC9Context *v)
|
||||
|
||||
/***********************************************************************/
|
||||
/**
|
||||
* @defgroup block VC9 Block-level functions
|
||||
* @defgroup block VC1 Block-level functions
|
||||
* @see 7.1.4, p91 and 8.1.1.7, p(1)04
|
||||
* @todo TODO: Integrate to MpegEncContext facilities
|
||||
* @{
|
||||
@ -1714,8 +1714,8 @@ static int advanced_decode_picture_secondary_header(VC9Context *v)
|
||||
* @todo TODO: Use MpegEncContext arrays to store them
|
||||
*/
|
||||
#define GET_MVDATA(_dmv_x, _dmv_y) \
|
||||
index = 1 + get_vlc2(gb, vc9_mv_diff_vlc[s->mv_table_index].table,\
|
||||
VC9_MV_DIFF_VLC_BITS, 2); \
|
||||
index = 1 + get_vlc2(gb, vc1_mv_diff_vlc[s->mv_table_index].table,\
|
||||
VC1_MV_DIFF_VLC_BITS, 2); \
|
||||
if (index > 36) \
|
||||
{ \
|
||||
mb_has_coeffs = 1; \
|
||||
@ -1753,10 +1753,10 @@ static int advanced_decode_picture_secondary_header(VC9Context *v)
|
||||
* @param[in] n block index in the current MB
|
||||
* @param dc_val_ptr Pointer to DC predictor
|
||||
* @param dir_ptr Prediction direction for use in AC prediction
|
||||
* @todo TODO: Actually do it the VC9 way
|
||||
* @todo TODO: Actually do it the VC1 way
|
||||
* @todo TODO: Handle properly edges
|
||||
*/
|
||||
static inline int vc9_pred_dc(MpegEncContext *s, int n,
|
||||
static inline int vc1_pred_dc(MpegEncContext *s, int n,
|
||||
uint16_t **dc_val_ptr, int *dir_ptr)
|
||||
{
|
||||
int a, b, c, wrap, pred, scale;
|
||||
@ -1822,7 +1822,7 @@ static inline int vc9_pred_dc(MpegEncContext *s, int n,
|
||||
}
|
||||
|
||||
/** Decode one block, inter or intra
|
||||
* @param v The VC9 context
|
||||
* @param v The VC1 context
|
||||
* @param block 8x8 DCT block
|
||||
* @param n Block index in the current MB (<4=>luma)
|
||||
* @param coded If the block is coded
|
||||
@ -1832,7 +1832,7 @@ static inline int vc9_pred_dc(MpegEncContext *s, int n,
|
||||
* @todo TODO: Process the blocks
|
||||
* @todo TODO: Use M$ MPEG-4 cbp prediction
|
||||
*/
|
||||
static int vc9_decode_block(VC9Context *v, DCTELEM block[64], int n, int coded, int mquant)
|
||||
static int vc1_decode_block(VC1Context *v, DCTELEM block[64], int n, int coded, int mquant)
|
||||
{
|
||||
GetBitContext *gb = &v->s.gb;
|
||||
MpegEncContext *s = &v->s;
|
||||
@ -1884,7 +1884,7 @@ static int vc9_decode_block(VC9Context *v, DCTELEM block[64], int n, int coded,
|
||||
}
|
||||
|
||||
/* Prediction */
|
||||
dcdiff += vc9_pred_dc(s, n, &dc_val, &dc_pred_dir);
|
||||
dcdiff += vc1_pred_dc(s, n, &dc_val, &dc_pred_dir);
|
||||
*dc_val = dcdiff;
|
||||
/* Store the quantized DC coeff, used for prediction */
|
||||
|
||||
@ -1912,14 +1912,14 @@ static int vc9_decode_block(VC9Context *v, DCTELEM block[64], int n, int coded,
|
||||
|
||||
/* Get TTBLK */
|
||||
if (v->ttmb < 8) /* per block */
|
||||
ttblk = get_vlc2(gb, vc9_ttblk_vlc[v->tt_index].table, VC9_TTBLK_VLC_BITS, 2);
|
||||
ttblk = get_vlc2(gb, vc1_ttblk_vlc[v->tt_index].table, VC1_TTBLK_VLC_BITS, 2);
|
||||
else /* Per frame */
|
||||
ttblk = 0; //FIXME, depends on ttfrm
|
||||
|
||||
/* Get SUBBLKPAT */
|
||||
if (ttblk == v->ttblk4x4) /* 4x4 transform for that qp value */
|
||||
subblkpat = 1+get_vlc2(gb, vc9_subblkpat_vlc[v->tt_index].table,
|
||||
VC9_SUBBLKPAT_VLC_BITS, 2);
|
||||
subblkpat = 1+get_vlc2(gb, vc1_subblkpat_vlc[v->tt_index].table,
|
||||
VC1_SUBBLKPAT_VLC_BITS, 2);
|
||||
else /* All others: 8x8, 4x8, 8x4 */
|
||||
subblkpat = decode012(gb);
|
||||
}
|
||||
@ -1944,13 +1944,13 @@ static int vc9_decode_block(VC9Context *v, DCTELEM block[64], int n, int coded,
|
||||
|
||||
/***********************************************************************/
|
||||
/**
|
||||
* @defgroup std_mb VC9 Macroblock-level functions in Simple/Main Profiles
|
||||
* @defgroup std_mb VC1 Macroblock-level functions in Simple/Main Profiles
|
||||
* @see 7.1.4, p91 and 8.1.1.7, p(1)04
|
||||
* @todo TODO: Integrate to MpegEncContext facilities
|
||||
* @{
|
||||
*/
|
||||
|
||||
static inline int vc9_coded_block_pred(MpegEncContext * s, int n, uint8_t **coded_block_ptr)
|
||||
static inline int vc1_coded_block_pred(MpegEncContext * s, int n, uint8_t **coded_block_ptr)
|
||||
{
|
||||
int xy, wrap, pred, a, b, c;
|
||||
|
||||
@ -1979,7 +1979,7 @@ static inline int vc9_coded_block_pred(MpegEncContext * s, int n, uint8_t **code
|
||||
/** Decode one I-frame MB (in Simple/Main profile)
|
||||
* @todo TODO: Extend to AP
|
||||
*/
|
||||
static int vc9_decode_i_mb(VC9Context *v, DCTELEM block[6][64])
|
||||
static int vc1_decode_i_mb(VC1Context *v, DCTELEM block[6][64])
|
||||
{
|
||||
int i, cbp, val;
|
||||
uint8_t *coded_val;
|
||||
@ -1994,12 +1994,12 @@ static int vc9_decode_i_mb(VC9Context *v, DCTELEM block[6][64])
|
||||
{
|
||||
val = ((cbp >> (5 - i)) & 1);
|
||||
if (i < 4) {
|
||||
int pred = vc9_coded_block_pred(&v->s, i, &coded_val);
|
||||
int pred = vc1_coded_block_pred(&v->s, i, &coded_val);
|
||||
val = val ^ pred;
|
||||
*coded_val = val;
|
||||
}
|
||||
cbp |= val << (5 - i);
|
||||
if (vc9_decode_block(v, block[i], i, val, v->pq) < 0) //FIXME Should be mquant
|
||||
if (vc1_decode_block(v, block[i], i, val, v->pq) < 0) //FIXME Should be mquant
|
||||
{
|
||||
av_log(v->s.avctx, AV_LOG_ERROR,
|
||||
"\nerror while decoding block: %d x %d (%d)\n", v->s.mb_x, v->s.mb_y, i);
|
||||
@ -2013,7 +2013,7 @@ static int vc9_decode_i_mb(VC9Context *v, DCTELEM block[6][64])
|
||||
* @todo TODO: Extend to AP
|
||||
* @fixme FIXME: DC value for inter blocks not set
|
||||
*/
|
||||
static int vc9_decode_p_mb(VC9Context *v, DCTELEM block[6][64])
|
||||
static int vc1_decode_p_mb(VC1Context *v, DCTELEM block[6][64])
|
||||
{
|
||||
MpegEncContext *s = &v->s;
|
||||
GetBitContext *gb = &s->gb;
|
||||
@ -2059,14 +2059,14 @@ static int vc9_decode_p_mb(VC9Context *v, DCTELEM block[6][64])
|
||||
for (i=0; i<6; i++)
|
||||
{
|
||||
s->coded_block[s->block_index[i]] = 0;
|
||||
vc9_decode_block(v, block[i], i, 0, mquant);
|
||||
vc1_decode_block(v, block[i], i, 0, mquant);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else if (mb_has_coeffs)
|
||||
{
|
||||
if (s->mb_intra) s->ac_pred = get_bits(gb, 1);
|
||||
cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC9_CBPCY_P_VLC_BITS, 2);
|
||||
cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
|
||||
GET_MQUANT();
|
||||
}
|
||||
else
|
||||
@ -2078,18 +2078,18 @@ static int vc9_decode_p_mb(VC9Context *v, DCTELEM block[6][64])
|
||||
}
|
||||
|
||||
if (!v->ttmbf)
|
||||
ttmb = get_vlc2(gb, vc9_ttmb_vlc[v->tt_index].table,
|
||||
VC9_TTMB_VLC_BITS, 12);
|
||||
ttmb = get_vlc2(gb, vc1_ttmb_vlc[v->tt_index].table,
|
||||
VC1_TTMB_VLC_BITS, 12);
|
||||
|
||||
for (i=0; i<6; i++)
|
||||
{
|
||||
val = ((cbp >> (5 - i)) & 1);
|
||||
if (i < 4) {
|
||||
int pred = vc9_coded_block_pred(&v->s, i, &coded_val);
|
||||
int pred = vc1_coded_block_pred(&v->s, i, &coded_val);
|
||||
val = val ^ pred;
|
||||
*coded_val = val;
|
||||
}
|
||||
vc9_decode_block(v, block[i], i, val, mquant); //FIXME
|
||||
vc1_decode_block(v, block[i], i, val, mquant); //FIXME
|
||||
}
|
||||
}
|
||||
else //Skipped
|
||||
@ -2108,12 +2108,12 @@ static int vc9_decode_p_mb(VC9Context *v, DCTELEM block[6][64])
|
||||
if (!v->skip_mb_plane.data[mb_offset] /* unskipped MB */)
|
||||
{
|
||||
/* Get CBPCY */
|
||||
cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC9_CBPCY_P_VLC_BITS, 2);
|
||||
cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
|
||||
for (i=0; i<6; i++)
|
||||
{
|
||||
val = ((cbp >> (5 - i)) & 1);
|
||||
if (i < 4) {
|
||||
int pred = vc9_coded_block_pred(&v->s, i, &coded_val);
|
||||
int pred = vc1_coded_block_pred(&v->s, i, &coded_val);
|
||||
val = val ^ pred;
|
||||
*coded_val = val;
|
||||
}
|
||||
@ -2129,9 +2129,9 @@ static int vc9_decode_p_mb(VC9Context *v, DCTELEM block[6][64])
|
||||
index /* non-zero pred for that block */)
|
||||
s->ac_pred = get_bits(gb, 1);
|
||||
if (!v->ttmbf)
|
||||
ttmb = get_vlc2(gb, vc9_ttmb_vlc[v->tt_index].table,
|
||||
VC9_TTMB_VLC_BITS, 12);
|
||||
status = vc9_decode_block(v, block[i], i, val, mquant);
|
||||
ttmb = get_vlc2(gb, vc1_ttmb_vlc[v->tt_index].table,
|
||||
VC1_TTMB_VLC_BITS, 12);
|
||||
status = vc1_decode_block(v, block[i], i, val, mquant);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
@ -2142,10 +2142,10 @@ static int vc9_decode_p_mb(VC9Context *v, DCTELEM block[6][64])
|
||||
{
|
||||
if (v->mv_mode == MV_PMODE_MIXED_MV /* Hybrid pred */)
|
||||
hybrid_pred = get_bits(gb, 1);
|
||||
vc9_decode_block(v, block[i], i, 0, v->pq); //FIXME
|
||||
vc1_decode_block(v, block[i], i, 0, v->pq); //FIXME
|
||||
}
|
||||
vc9_decode_block(v, block[4], 4, 0, v->pq); //FIXME
|
||||
vc9_decode_block(v, block[5], 5, 0, v->pq); //FIXME
|
||||
vc1_decode_block(v, block[4], 4, 0, v->pq); //FIXME
|
||||
vc1_decode_block(v, block[5], 5, 0, v->pq); //FIXME
|
||||
/* TODO: blah */
|
||||
return 0;
|
||||
}
|
||||
@ -2160,7 +2160,7 @@ static int vc9_decode_p_mb(VC9Context *v, DCTELEM block[6][64])
|
||||
* @warning XXX: Used for decoding BI MBs
|
||||
* @fixme FIXME: DC value for inter blocks not set
|
||||
*/
|
||||
static int vc9_decode_b_mb(VC9Context *v, DCTELEM block[6][64])
|
||||
static int vc1_decode_b_mb(VC1Context *v, DCTELEM block[6][64])
|
||||
{
|
||||
MpegEncContext *s = &v->s;
|
||||
GetBitContext *gb = &v->s.gb;
|
||||
@ -2230,13 +2230,13 @@ static int vc9_decode_b_mb(VC9Context *v, DCTELEM block[6][64])
|
||||
|
||||
//End1
|
||||
if (v->ttmbf)
|
||||
ttmb = get_vlc2(gb, vc9_ttmb_vlc[v->tt_index].table,
|
||||
VC9_TTMB_VLC_BITS, 12);
|
||||
ttmb = get_vlc2(gb, vc1_ttmb_vlc[v->tt_index].table,
|
||||
VC1_TTMB_VLC_BITS, 12);
|
||||
|
||||
//End2
|
||||
for (i=0; i<6; i++)
|
||||
{
|
||||
vc9_decode_block(v, block[i], i, 0 /*cbp[i]*/, mquant); //FIXME
|
||||
vc1_decode_block(v, block[i], i, 0 /*cbp[i]*/, mquant); //FIXME
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -2245,7 +2245,7 @@ static int vc9_decode_b_mb(VC9Context *v, DCTELEM block[6][64])
|
||||
* @todo TODO: Move out of the loop the picture type case?
|
||||
(branch prediction should help there though)
|
||||
*/
|
||||
static int standard_decode_mbs(VC9Context *v)
|
||||
static int standard_decode_mbs(VC1Context *v)
|
||||
{
|
||||
MpegEncContext *s = &v->s;
|
||||
|
||||
@ -2290,10 +2290,10 @@ static int standard_decode_mbs(VC9Context *v)
|
||||
//TODO Move out of the loop
|
||||
switch (s->pict_type)
|
||||
{
|
||||
case I_TYPE: vc9_decode_i_mb(v, s->block); break;
|
||||
case P_TYPE: vc9_decode_p_mb(v, s->block); break;
|
||||
case I_TYPE: vc1_decode_i_mb(v, s->block); break;
|
||||
case P_TYPE: vc1_decode_p_mb(v, s->block); break;
|
||||
case BI_TYPE:
|
||||
case B_TYPE: vc9_decode_b_mb(v, s->block); break;
|
||||
case B_TYPE: vc1_decode_b_mb(v, s->block); break;
|
||||
}
|
||||
}
|
||||
//Add a check for overconsumption ?
|
||||
@ -2305,12 +2305,12 @@ static int standard_decode_mbs(VC9Context *v)
|
||||
#if HAS_ADVANCED_PROFILE
|
||||
/***********************************************************************/
|
||||
/**
|
||||
* @defgroup adv_mb VC9 Macroblock-level functions in Advanced Profile
|
||||
* @defgroup adv_mb VC1 Macroblock-level functions in Advanced Profile
|
||||
* @todo TODO: Integrate to MpegEncContext facilities
|
||||
* @todo TODO: Code P, B and BI
|
||||
* @{
|
||||
*/
|
||||
static int advanced_decode_i_mbs(VC9Context *v)
|
||||
static int advanced_decode_i_mbs(VC1Context *v)
|
||||
{
|
||||
MpegEncContext *s = &v->s;
|
||||
GetBitContext *gb = &v->s.gb;
|
||||
@ -2337,13 +2337,13 @@ static int advanced_decode_i_mbs(VC9Context *v)
|
||||
/** @} */ //End for group adv_mb
|
||||
#endif
|
||||
|
||||
/** Initialize a VC9/WMV3 decoder
|
||||
* @todo TODO: Handle VC-9 IDUs (Transport level?)
|
||||
/** Initialize a VC1/WMV3 decoder
|
||||
* @todo TODO: Handle VC-1 IDUs (Transport level?)
|
||||
* @todo TODO: Decypher remaining bits in extra_data
|
||||
*/
|
||||
static int vc9_decode_init(AVCodecContext *avctx)
|
||||
static int vc1_decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
VC9Context *v = avctx->priv_data;
|
||||
VC1Context *v = avctx->priv_data;
|
||||
MpegEncContext *s = &v->s;
|
||||
GetBitContext gb;
|
||||
|
||||
@ -2353,7 +2353,7 @@ static int vc9_decode_init(AVCodecContext *avctx)
|
||||
|
||||
if(ff_h263_decode_init(avctx) < 0)
|
||||
return -1;
|
||||
if (vc9_init_common(v) < 0) return -1;
|
||||
if (vc1_init_common(v) < 0) return -1;
|
||||
|
||||
av_log(avctx, AV_LOG_INFO, "This decoder is not supposed to produce picture. Dont report this as a bug!\n");
|
||||
|
||||
@ -2416,15 +2416,15 @@ static int vc9_decode_init(AVCodecContext *avctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Decode a VC9/WMV3 frame
|
||||
* @todo TODO: Handle VC-9 IDUs (Transport level?)
|
||||
/** Decode a VC1/WMV3 frame
|
||||
* @todo TODO: Handle VC-1 IDUs (Transport level?)
|
||||
* @warning Initial try at using MpegEncContext stuff
|
||||
*/
|
||||
static int vc9_decode_frame(AVCodecContext *avctx,
|
||||
static int vc1_decode_frame(AVCodecContext *avctx,
|
||||
void *data, int *data_size,
|
||||
uint8_t *buf, int buf_size)
|
||||
{
|
||||
VC9Context *v = avctx->priv_data;
|
||||
VC1Context *v = avctx->priv_data;
|
||||
MpegEncContext *s = &v->s;
|
||||
int ret = FRAME_SKIPPED, len;
|
||||
AVFrame *pict = data;
|
||||
@ -2440,7 +2440,7 @@ static int vc9_decode_frame(AVCodecContext *avctx,
|
||||
avpicture_fill((AVPicture *)pict, tmp_buf, avctx->pix_fmt,
|
||||
avctx->width, avctx->height);
|
||||
|
||||
if (avctx->codec_id == CODEC_ID_VC9)
|
||||
if (avctx->codec_id == CODEC_ID_VC1)
|
||||
{
|
||||
#if 0
|
||||
// search for IDU's
|
||||
@ -2630,12 +2630,12 @@ static int vc9_decode_frame(AVCodecContext *avctx,
|
||||
return buf_size; //Number of bytes consumed
|
||||
}
|
||||
|
||||
/** Close a VC9/WMV3 decoder
|
||||
/** Close a VC1/WMV3 decoder
|
||||
* @warning Initial try at using MpegEncContext stuff
|
||||
*/
|
||||
static int vc9_decode_end(AVCodecContext *avctx)
|
||||
static int vc1_decode_end(AVCodecContext *avctx)
|
||||
{
|
||||
VC9Context *v = avctx->priv_data;
|
||||
VC1Context *v = avctx->priv_data;
|
||||
|
||||
#if HAS_ADVANCED_PROFILE
|
||||
av_freep(&v->hrd_rate);
|
||||
@ -2648,15 +2648,15 @@ static int vc9_decode_end(AVCodecContext *avctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
AVCodec vc9_decoder = {
|
||||
"vc9",
|
||||
AVCodec vc1_decoder = {
|
||||
"vc1",
|
||||
CODEC_TYPE_VIDEO,
|
||||
CODEC_ID_VC9,
|
||||
sizeof(VC9Context),
|
||||
vc9_decode_init,
|
||||
CODEC_ID_VC1,
|
||||
sizeof(VC1Context),
|
||||
vc1_decode_init,
|
||||
NULL,
|
||||
vc9_decode_end,
|
||||
vc9_decode_frame,
|
||||
vc1_decode_end,
|
||||
vc1_decode_frame,
|
||||
CODEC_CAP_DELAY,
|
||||
NULL
|
||||
};
|
||||
@ -2665,11 +2665,11 @@ AVCodec wmv3_decoder = {
|
||||
"wmv3",
|
||||
CODEC_TYPE_VIDEO,
|
||||
CODEC_ID_WMV3,
|
||||
sizeof(VC9Context),
|
||||
vc9_decode_init,
|
||||
sizeof(VC1Context),
|
||||
vc1_decode_init,
|
||||
NULL,
|
||||
vc9_decode_end,
|
||||
vc9_decode_frame,
|
||||
vc1_decode_end,
|
||||
vc1_decode_frame,
|
||||
CODEC_CAP_DELAY,
|
||||
NULL
|
||||
};
|
@ -1,13 +1,13 @@
|
||||
/**
|
||||
* @file vc9data.h
|
||||
* VC9 tables.
|
||||
* @file vc1data.h
|
||||
* VC1 tables.
|
||||
*/
|
||||
|
||||
#ifndef VC9DATA_H
|
||||
#define VC9DATA_H
|
||||
#ifndef VC1DATA_H
|
||||
#define VC1DATA_H
|
||||
|
||||
/* bfraction is fractional, we scale to the GCD 3*5*7*8 = 840 */
|
||||
const int16_t vc9_bfraction_lut[23] = {
|
||||
const int16_t vc1_bfraction_lut[23] = {
|
||||
420 /*1/2*/, 280 /*1/3*/, 560 /*2/3*/, 210 /*1/4*/,
|
||||
630 /*3/4*/, 168 /*1/5*/, 336 /*2/5*/,
|
||||
504 /*3/5*/, 672 /*4/5*/, 140 /*1/6*/, 700 /*5/6*/,
|
||||
@ -16,7 +16,7 @@ const int16_t vc9_bfraction_lut[23] = {
|
||||
525 /*5/8*/, 735 /*7/8*/,
|
||||
-1 /*inv.*/, 0 /*BI fm*/
|
||||
};
|
||||
const uint8_t vc9_bfraction_bits[23] = {
|
||||
const uint8_t vc1_bfraction_bits[23] = {
|
||||
3, 3, 3, 3,
|
||||
3, 3, 3,
|
||||
7, 7, 7, 7,
|
||||
@ -25,7 +25,7 @@ const uint8_t vc9_bfraction_bits[23] = {
|
||||
7, 7,
|
||||
7, 7
|
||||
};
|
||||
const uint8_t vc9_bfraction_codes[23] = {
|
||||
const uint8_t vc1_bfraction_codes[23] = {
|
||||
0, 1, 2, 3,
|
||||
4, 5, 6,
|
||||
112, 113, 114, 115,
|
||||
@ -36,7 +36,7 @@ const uint8_t vc9_bfraction_codes[23] = {
|
||||
};
|
||||
|
||||
//Same as H.264
|
||||
static const AVRational vc9_pixel_aspect[16]={
|
||||
static const AVRational vc1_pixel_aspect[16]={
|
||||
{0, 1},
|
||||
{1, 1},
|
||||
{12, 11},
|
||||
@ -56,36 +56,36 @@ static const AVRational vc9_pixel_aspect[16]={
|
||||
};
|
||||
|
||||
/* BitPlane IMODE - such a small table... */
|
||||
static const uint8_t vc9_imode_codes[7] = {
|
||||
static const uint8_t vc1_imode_codes[7] = {
|
||||
0, 2, 1, 3, 1, 2, 3
|
||||
};
|
||||
static const uint8_t vc9_imode_bits[7] = {
|
||||
static const uint8_t vc1_imode_bits[7] = {
|
||||
4, 2, 3, 2, 4, 3, 3
|
||||
};
|
||||
|
||||
/* Normal-2 imode */
|
||||
static const uint8_t vc9_norm2_codes[4] = {
|
||||
static const uint8_t vc1_norm2_codes[4] = {
|
||||
0, 4, 5, 3
|
||||
};
|
||||
static const uint8_t vc9_norm2_bits[4] = {
|
||||
static const uint8_t vc1_norm2_bits[4] = {
|
||||
1, 3, 3, 2
|
||||
};
|
||||
|
||||
static const uint16_t vc9_norm6_codes[64] = {
|
||||
static const uint16_t vc1_norm6_codes[64] = {
|
||||
0x001, 0x002, 0x003, 0x000, 0x004, 0x001, 0x002, 0x047, 0x005, 0x003, 0x004, 0x04B, 0x005, 0x04D, 0x04E, 0x30E,
|
||||
0x006, 0x006, 0x007, 0x053, 0x008, 0x055, 0x056, 0x30D, 0x009, 0x059, 0x05A, 0x30C, 0x05C, 0x30B, 0x30A, 0x037,
|
||||
0x007, 0x00A, 0x00B, 0x043, 0x00C, 0x045, 0x046, 0x309, 0x00D, 0x049, 0x04A, 0x308, 0x04C, 0x307, 0x306, 0x036,
|
||||
0x00E, 0x051, 0x052, 0x305, 0x054, 0x304, 0x303, 0x035, 0x058, 0x302, 0x301, 0x034, 0x300, 0x033, 0x032, 0x007,
|
||||
};
|
||||
|
||||
static const uint8_t vc9_norm6_bits[64] = {
|
||||
static const uint8_t vc1_norm6_bits[64] = {
|
||||
1, 4, 4, 8, 4, 8, 8, 10, 4, 8, 8, 10, 8, 10, 10, 13,
|
||||
4, 8, 8, 10, 8, 10, 10, 13, 8, 10, 10, 13, 10, 13, 13, 9,
|
||||
4, 8, 8, 10, 8, 10, 10, 13, 8, 10, 10, 13, 10, 13, 13, 9,
|
||||
8, 10, 10, 13, 10, 13, 13, 9, 10, 13, 13, 9, 13, 9, 9, 6,
|
||||
};
|
||||
/* Normal-6 imode */
|
||||
static const uint8_t vc9_norm6_spec[64][5] = {
|
||||
static const uint8_t vc1_norm6_spec[64][5] = {
|
||||
{ 0, 1, 1 },
|
||||
{ 1, 2, 4 },
|
||||
{ 2, 3, 4 },
|
||||
@ -153,13 +153,13 @@ static const uint8_t vc9_norm6_spec[64][5] = {
|
||||
};
|
||||
|
||||
/* 4MV Block pattern VLC tables */
|
||||
static const uint8_t vc9_4mv_block_pattern_codes[4][16] = {
|
||||
static const uint8_t vc1_4mv_block_pattern_codes[4][16] = {
|
||||
{ 14, 58, 59, 25, 12, 26, 15, 15, 13, 24, 27, 0, 28, 1, 2, 2},
|
||||
{ 8, 18, 19, 4, 20, 5, 30, 11, 21, 31, 6, 12, 7, 13, 14, 0},
|
||||
{ 15, 6, 7, 2, 8, 3, 28, 9, 10, 29, 4, 11, 5, 12, 13, 0},
|
||||
{ 0, 11, 12, 4, 13, 5, 30, 16, 14, 31, 6, 17, 7, 18, 19, 19}
|
||||
};
|
||||
static const uint8_t vc9_4mv_block_pattern_bits[4][16] = {
|
||||
static const uint8_t vc1_4mv_block_pattern_bits[4][16] = {
|
||||
{ 5, 6, 6, 5, 5, 5, 5, 4, 5, 5, 5, 3, 5, 3, 3, 2},
|
||||
{ 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 4, 4, 4, 4, 4, 2},
|
||||
{ 4, 4, 4, 4, 4, 4, 5, 4, 4, 5, 4, 4, 4, 4, 4, 3},
|
||||
@ -171,7 +171,7 @@ const uint8_t wmv3_dc_scale_table[32]={
|
||||
};
|
||||
|
||||
/* P-Picture CBPCY VLC tables */
|
||||
static const uint16_t vc9_cbpcy_p_codes[4][64] = {
|
||||
static const uint16_t vc1_cbpcy_p_codes[4][64] = {
|
||||
{
|
||||
0, 1, 1, 4, 5, 1, 12, 4, 13, 14, 10, 11, 12, 7, 13, 2,
|
||||
15, 1, 96, 1, 49, 97, 2, 100, 3, 4, 5, 101, 102, 52, 53, 4,
|
||||
@ -197,7 +197,7 @@ static const uint16_t vc9_cbpcy_p_codes[4][64] = {
|
||||
44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 28, 29, 30, 31
|
||||
}
|
||||
};
|
||||
static const uint8_t vc9_cbpcy_p_bits[4][64] = {
|
||||
static const uint8_t vc1_cbpcy_p_bits[4][64] = {
|
||||
{
|
||||
13, 6, 5, 6, 6, 7, 7, 5, 7, 7, 6, 6, 6, 5, 6, 3,
|
||||
7, 8, 8, 13, 7, 8, 13, 8, 13, 13, 13, 8, 8, 7, 7, 3,
|
||||
@ -232,7 +232,7 @@ static const uint8_t vc9_cbpcy_p_bits[4][64] = {
|
||||
* 8x4:MB:btm 8x4:MB:top 8x4,MB,both
|
||||
* 4x8,MB,right 4x8,MB,left
|
||||
* 4x4,MB */
|
||||
static const uint16_t vc9_ttmb_codes[3][16] = {
|
||||
static const uint16_t vc1_ttmb_codes[3][16] = {
|
||||
{
|
||||
0x0003,
|
||||
0x002E, 0x005F, 0x0000,
|
||||
@ -262,7 +262,7 @@ static const uint16_t vc9_ttmb_codes[3][16] = {
|
||||
}
|
||||
};
|
||||
|
||||
static const uint8_t vc9_ttmb_bits[3][16] = {
|
||||
static const uint8_t vc1_ttmb_bits[3][16] = {
|
||||
{
|
||||
2,
|
||||
6, 7, 2,
|
||||
@ -293,31 +293,31 @@ static const uint8_t vc9_ttmb_bits[3][16] = {
|
||||
};
|
||||
|
||||
/* TTBLK (Transform Type per Block) tables */
|
||||
static const uint8_t vc9_ttblk_codes[3][8] = {
|
||||
static const uint8_t vc1_ttblk_codes[3][8] = {
|
||||
{ 0, 1, 3, 5, 16, 17, 18, 19},
|
||||
{ 3, 0, 1, 2, 3, 5, 8, 9},
|
||||
{ 1, 0, 1, 4, 6, 7, 10, 11}
|
||||
};
|
||||
static const uint8_t vc9_ttblk_bits[3][8] = {
|
||||
static const uint8_t vc1_ttblk_bits[3][8] = {
|
||||
{ 2, 2, 2, 3, 5, 5, 5, 5},
|
||||
{ 2, 3, 3, 3, 3, 3, 4, 4},
|
||||
{ 2, 3, 3, 3, 3, 3, 4, 4}
|
||||
};
|
||||
|
||||
/* SUBBLKPAT tables, p93-94, reordered */
|
||||
static const uint8_t vc9_subblkpat_codes[3][15] = {
|
||||
static const uint8_t vc1_subblkpat_codes[3][15] = {
|
||||
{ 14, 12, 7, 11, 9, 26, 2, 10, 27, 8, 0, 6, 1, 15, 1},
|
||||
{ 14, 0, 8, 15, 10, 4, 23, 13, 5, 9, 25, 3, 24, 22, 1},
|
||||
{ 5, 6, 2, 2, 8, 0, 28, 3, 1, 3, 29, 1, 19, 18, 15}
|
||||
};
|
||||
static const uint8_t vc9_subblkpat_bits[3][15] = {
|
||||
static const uint8_t vc1_subblkpat_bits[3][15] = {
|
||||
{ 5, 5, 5, 5, 5, 6, 4, 5, 6, 5, 4, 5, 4, 5, 1},
|
||||
{ 4, 3, 4, 4, 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 2},
|
||||
{ 3, 3, 4, 3, 4, 5, 5, 3, 5, 4, 5, 4, 5, 5, 4}
|
||||
};
|
||||
|
||||
/* MV differential tables, p265 */
|
||||
static const uint16_t vc9_mv_diff_codes[4][73] = {
|
||||
static const uint16_t vc1_mv_diff_codes[4][73] = {
|
||||
{
|
||||
0, 2, 3, 8, 576, 3, 2, 6,
|
||||
5, 577, 578, 7, 8, 9, 40, 19,
|
||||
@ -367,7 +367,7 @@ static const uint16_t vc9_mv_diff_codes[4][73] = {
|
||||
15 /* 73 elements */
|
||||
}
|
||||
};
|
||||
static const uint8_t vc9_mv_diff_bits[4][73] = {
|
||||
static const uint8_t vc1_mv_diff_bits[4][73] = {
|
||||
{
|
||||
6, 7, 7, 8, 14, 6, 5, 6, 7, 14, 14, 6, 6, 6, 8, 9,
|
||||
10, 9, 7, 7, 7, 14, 14, 10, 9, 10, 8, 10, 10, 14, 14, 14,
|
||||
@ -403,4 +403,4 @@ static const uint8_t vc9_mv_diff_bits[4][73] = {
|
||||
|
||||
/* Scantables/ZZ scan are at 11.9 (p262) and 8.1.1.12 (p10) */
|
||||
|
||||
#endif /* VC9DATA_H */
|
||||
#endif /* VC1DATA_H */
|
Loading…
x
Reference in New Issue
Block a user