mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2025-02-16 09:58:19 +00:00
more #ifdef CONFIG_ENCODERS patch by (Wolfgang Hesseler <qv at multimediaware dot com>) with modifications by me (s/WOLFGANG/CONFIG_ENCODERS/ and some other fixes)
Originally committed as revision 1588 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
0a6de063b0
commit
7604246d1a
@ -76,7 +76,7 @@ static int dvvideo_decode_init(AVCodecContext *avctx)
|
|||||||
{
|
{
|
||||||
DVVideoDecodeContext *s = avctx->priv_data;
|
DVVideoDecodeContext *s = avctx->priv_data;
|
||||||
MpegEncContext s2;
|
MpegEncContext s2;
|
||||||
static int done;
|
static int done=0;
|
||||||
|
|
||||||
if (!done) {
|
if (!done) {
|
||||||
int i;
|
int i;
|
||||||
|
@ -73,19 +73,21 @@ static inline int mpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr);
|
|||||||
static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
|
static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
|
||||||
int n, int coded, int intra);
|
int n, int coded, int intra);
|
||||||
static int h263_pred_dc(MpegEncContext * s, int n, uint16_t **dc_val_ptr);
|
static int h263_pred_dc(MpegEncContext * s, int n, uint16_t **dc_val_ptr);
|
||||||
|
#ifdef CONFIG_ENCODERS
|
||||||
static void mpeg4_inv_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
|
static void mpeg4_inv_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
|
||||||
int dir);
|
int dir);
|
||||||
|
#endif //CONFIG_ENCODERS
|
||||||
static void mpeg4_decode_sprite_trajectory(MpegEncContext * s);
|
static void mpeg4_decode_sprite_trajectory(MpegEncContext * s);
|
||||||
static inline int ff_mpeg4_pred_dc(MpegEncContext * s, int n, uint16_t **dc_val_ptr, int *dir_ptr);
|
static inline int ff_mpeg4_pred_dc(MpegEncContext * s, int n, uint16_t **dc_val_ptr, int *dir_ptr);
|
||||||
|
|
||||||
extern uint32_t inverse[256];
|
extern uint32_t inverse[256];
|
||||||
|
|
||||||
|
#ifdef CONFIG_ENCODERS
|
||||||
static uint8_t uni_DCtab_lum_len[512];
|
static uint8_t uni_DCtab_lum_len[512];
|
||||||
static uint8_t uni_DCtab_chrom_len[512];
|
static uint8_t uni_DCtab_chrom_len[512];
|
||||||
static uint16_t uni_DCtab_lum_bits[512];
|
static uint16_t uni_DCtab_lum_bits[512];
|
||||||
static uint16_t uni_DCtab_chrom_bits[512];
|
static uint16_t uni_DCtab_chrom_bits[512];
|
||||||
|
|
||||||
#ifdef CONFIG_ENCODERS
|
|
||||||
static uint16_t (*mv_penalty)[MAX_MV*2+1]= NULL;
|
static uint16_t (*mv_penalty)[MAX_MV*2+1]= NULL;
|
||||||
static uint8_t fcode_tab[MAX_MV*2+1];
|
static uint8_t fcode_tab[MAX_MV*2+1];
|
||||||
static uint8_t umv_fcode_tab[MAX_MV*2+1];
|
static uint8_t umv_fcode_tab[MAX_MV*2+1];
|
||||||
@ -129,6 +131,8 @@ int h263_get_picture_format(int width, int height)
|
|||||||
return format;
|
return format;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_ENCODERS
|
||||||
|
|
||||||
static void float_aspect_to_info(MpegEncContext * s, float aspect){
|
static void float_aspect_to_info(MpegEncContext * s, float aspect){
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -397,6 +401,8 @@ void ff_clean_mpeg4_qscales(MpegEncContext *s){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif //CONFIG_ENCODERS
|
||||||
|
|
||||||
void ff_mpeg4_set_direct_mv(MpegEncContext *s, int mx, int my){
|
void ff_mpeg4_set_direct_mv(MpegEncContext *s, int mx, int my){
|
||||||
const int mb_index= s->mb_x + s->mb_y*s->mb_width;
|
const int mb_index= s->mb_x + s->mb_y*s->mb_width;
|
||||||
int xy= s->block_index[0];
|
int xy= s->block_index[0];
|
||||||
@ -1010,7 +1016,6 @@ static int h263_pred_dc(MpegEncContext * s, int n, uint16_t **dc_val_ptr)
|
|||||||
return pred_dc;
|
return pred_dc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void h263_pred_acdc(MpegEncContext * s, DCTELEM *block, int n)
|
static void h263_pred_acdc(MpegEncContext * s, DCTELEM *block, int n)
|
||||||
{
|
{
|
||||||
int x, y, wrap, a, c, pred_dc, scale, i;
|
int x, y, wrap, a, c, pred_dc, scale, i;
|
||||||
@ -1290,6 +1295,8 @@ static void init_mv_penalty_and_fcode(MpegEncContext *s)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_ENCODERS
|
||||||
|
|
||||||
static void init_uni_dc_tab(void)
|
static void init_uni_dc_tab(void)
|
||||||
{
|
{
|
||||||
int level, uni_code, uni_len;
|
int level, uni_code, uni_len;
|
||||||
@ -1342,6 +1349,8 @@ static void init_uni_dc_tab(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif //CONFIG_ENCODERS
|
||||||
|
|
||||||
#ifdef CONFIG_ENCODERS
|
#ifdef CONFIG_ENCODERS
|
||||||
static void init_uni_mpeg4_rl_tab(RLTable *rl, uint32_t *bits_tab, uint8_t *len_tab){
|
static void init_uni_mpeg4_rl_tab(RLTable *rl, uint32_t *bits_tab, uint8_t *len_tab){
|
||||||
int slevel, run, last;
|
int slevel, run, last;
|
||||||
@ -1549,6 +1558,8 @@ static void h263_encode_block(MpegEncContext * s, DCTELEM * block, int n)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_ENCODERS
|
||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
/**
|
/**
|
||||||
* add mpeg4 stuffing bits (01...1)
|
* add mpeg4 stuffing bits (01...1)
|
||||||
@ -1798,6 +1809,8 @@ void mpeg4_encode_picture_header(MpegEncContext * s, int picture_number)
|
|||||||
s->v_edge_pos= s->height;
|
s->v_edge_pos= s->height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif //CONFIG_ENCODERS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* change qscale by given dquant and update qscale dependant variables.
|
* change qscale by given dquant and update qscale dependant variables.
|
||||||
*/
|
*/
|
||||||
@ -1938,6 +1951,8 @@ void mpeg4_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_ENCODERS
|
||||||
|
|
||||||
static void mpeg4_inv_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
|
static void mpeg4_inv_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
|
||||||
int dir)
|
int dir)
|
||||||
{
|
{
|
||||||
@ -2025,7 +2040,7 @@ static inline void mpeg4_encode_dc(PutBitContext * s, int level, int n)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_ENCODERS
|
|
||||||
/**
|
/**
|
||||||
* encodes a 8x8 block
|
* encodes a 8x8 block
|
||||||
* @param n block index (0-3 are luma, 4-5 are chroma)
|
* @param n block index (0-3 are luma, 4-5 are chroma)
|
||||||
@ -2363,6 +2378,8 @@ static inline void memsetw(short *tab, int val, int n)
|
|||||||
tab[i] = val;
|
tab[i] = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_ENCODERS
|
||||||
|
|
||||||
void ff_mpeg4_init_partitions(MpegEncContext *s)
|
void ff_mpeg4_init_partitions(MpegEncContext *s)
|
||||||
{
|
{
|
||||||
init_put_bits(&s->tex_pb, s->tex_pb_buffer, PB_BUFFER_SIZE, NULL, NULL);
|
init_put_bits(&s->tex_pb, s->tex_pb_buffer, PB_BUFFER_SIZE, NULL, NULL);
|
||||||
@ -2394,6 +2411,8 @@ void ff_mpeg4_merge_partitions(MpegEncContext *s)
|
|||||||
s->last_bits= get_bit_count(&s->pb);
|
s->last_bits= get_bit_count(&s->pb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif //CONFIG_ENCODERS
|
||||||
|
|
||||||
int ff_mpeg4_get_video_packet_prefix_length(MpegEncContext *s){
|
int ff_mpeg4_get_video_packet_prefix_length(MpegEncContext *s){
|
||||||
switch(s->pict_type){
|
switch(s->pict_type){
|
||||||
case I_TYPE:
|
case I_TYPE:
|
||||||
@ -2408,6 +2427,8 @@ int ff_mpeg4_get_video_packet_prefix_length(MpegEncContext *s){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_ENCODERS
|
||||||
|
|
||||||
void ff_mpeg4_encode_video_packet_header(MpegEncContext *s)
|
void ff_mpeg4_encode_video_packet_header(MpegEncContext *s)
|
||||||
{
|
{
|
||||||
int mb_num_bits= av_log2(s->mb_num - 1) + 1;
|
int mb_num_bits= av_log2(s->mb_num - 1) + 1;
|
||||||
@ -2421,6 +2442,8 @@ void ff_mpeg4_encode_video_packet_header(MpegEncContext *s)
|
|||||||
put_bits(&s->pb, 1, 0); /* no HEC */
|
put_bits(&s->pb, 1, 0); /* no HEC */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif //CONFIG_ENCODERS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* check if the next stuff is a resync marker or the end.
|
* check if the next stuff is a resync marker or the end.
|
||||||
* @return 0 if not
|
* @return 0 if not
|
||||||
|
@ -325,6 +325,7 @@ static void common_init(MpegEncContext *s)
|
|||||||
s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
|
s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_ENCODERS
|
||||||
void mpeg1_encode_picture_header(MpegEncContext *s, int picture_number)
|
void mpeg1_encode_picture_header(MpegEncContext *s, int picture_number)
|
||||||
{
|
{
|
||||||
mpeg1_encode_sequence_header(s);
|
mpeg1_encode_sequence_header(s);
|
||||||
@ -511,7 +512,7 @@ void mpeg1_encode_mb(MpegEncContext *s,
|
|||||||
else
|
else
|
||||||
{ // No coded bloc pattern
|
{ // No coded bloc pattern
|
||||||
if (s->mv_dir == (MV_DIR_FORWARD | MV_DIR_BACKWARD))
|
if (s->mv_dir == (MV_DIR_FORWARD | MV_DIR_BACKWARD))
|
||||||
{ // Bi-directional motion
|
{ // Bi-directional motion
|
||||||
put_bits(&s->pb, 2, 2); /* backward & forward motion */
|
put_bits(&s->pb, 2, 2); /* backward & forward motion */
|
||||||
mpeg1_encode_motion(s, s->mv[0][0][0] - s->last_mv[0][0][0], s->f_code);
|
mpeg1_encode_motion(s, s->mv[0][0][0] - s->last_mv[0][0][0], s->f_code);
|
||||||
mpeg1_encode_motion(s, s->mv[0][0][1] - s->last_mv[0][0][1], s->f_code);
|
mpeg1_encode_motion(s, s->mv[0][0][1] - s->last_mv[0][0][1], s->f_code);
|
||||||
@ -792,6 +793,7 @@ static void mpeg1_encode_block(MpegEncContext *s,
|
|||||||
/* end of block */
|
/* end of block */
|
||||||
put_bits(&s->pb, 2, 0x2);
|
put_bits(&s->pb, 2, 0x2);
|
||||||
}
|
}
|
||||||
|
#endif //CONFIG_ENCODERS
|
||||||
|
|
||||||
/******************************************/
|
/******************************************/
|
||||||
/* decoding */
|
/* decoding */
|
||||||
|
@ -33,7 +33,9 @@
|
|||||||
//#undef NDEBUG
|
//#undef NDEBUG
|
||||||
//#include <assert.h>
|
//#include <assert.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_ENCODERS
|
||||||
static void encode_picture(MpegEncContext *s, int picture_number);
|
static void encode_picture(MpegEncContext *s, int picture_number);
|
||||||
|
#endif //CONFIG_ENCODERS
|
||||||
static void dct_unquantize_mpeg1_c(MpegEncContext *s,
|
static void dct_unquantize_mpeg1_c(MpegEncContext *s,
|
||||||
DCTELEM *block, int n, int qscale);
|
DCTELEM *block, int n, int qscale);
|
||||||
static void dct_unquantize_mpeg2_c(MpegEncContext *s,
|
static void dct_unquantize_mpeg2_c(MpegEncContext *s,
|
||||||
@ -41,8 +43,10 @@ static void dct_unquantize_mpeg2_c(MpegEncContext *s,
|
|||||||
static void dct_unquantize_h263_c(MpegEncContext *s,
|
static void dct_unquantize_h263_c(MpegEncContext *s,
|
||||||
DCTELEM *block, int n, int qscale);
|
DCTELEM *block, int n, int qscale);
|
||||||
static void draw_edges_c(uint8_t *buf, int wrap, int width, int height, int w);
|
static void draw_edges_c(uint8_t *buf, int wrap, int width, int height, int w);
|
||||||
|
#ifdef CONFIG_ENCODERS
|
||||||
static int dct_quantize_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow);
|
static int dct_quantize_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow);
|
||||||
static int dct_quantize_trellis_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow);
|
static int dct_quantize_trellis_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow);
|
||||||
|
#endif //CONFIG_ENCODERS
|
||||||
|
|
||||||
void (*draw_edges)(uint8_t *buf, int wrap, int width, int height, int w)= draw_edges_c;
|
void (*draw_edges)(uint8_t *buf, int wrap, int width, int height, int w)= draw_edges_c;
|
||||||
|
|
||||||
@ -85,6 +89,7 @@ static const uint8_t h263_chroma_roundtab[16] = {
|
|||||||
0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
|
0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef CONFIG_ENCODERS
|
||||||
static uint16_t (*default_mv_penalty)[MAX_MV*2+1]=NULL;
|
static uint16_t (*default_mv_penalty)[MAX_MV*2+1]=NULL;
|
||||||
static uint8_t default_fcode_tab[MAX_MV*2+1];
|
static uint8_t default_fcode_tab[MAX_MV*2+1];
|
||||||
|
|
||||||
@ -137,6 +142,8 @@ static void convert_matrix(MpegEncContext *s, int (*qmat)[64], uint16_t (*qmat16
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif //CONFIG_ENCODERS
|
||||||
|
|
||||||
// move into common.c perhaps
|
// move into common.c perhaps
|
||||||
#define CHECKED_ALLOCZ(p, size)\
|
#define CHECKED_ALLOCZ(p, size)\
|
||||||
{\
|
{\
|
||||||
@ -198,12 +205,14 @@ int DCT_common_init(MpegEncContext *s)
|
|||||||
s->dct_unquantize_h263 = dct_unquantize_h263_c;
|
s->dct_unquantize_h263 = dct_unquantize_h263_c;
|
||||||
s->dct_unquantize_mpeg1 = dct_unquantize_mpeg1_c;
|
s->dct_unquantize_mpeg1 = dct_unquantize_mpeg1_c;
|
||||||
s->dct_unquantize_mpeg2 = dct_unquantize_mpeg2_c;
|
s->dct_unquantize_mpeg2 = dct_unquantize_mpeg2_c;
|
||||||
|
#ifdef CONFIG_ENCODERS
|
||||||
s->dct_quantize= dct_quantize_c;
|
s->dct_quantize= dct_quantize_c;
|
||||||
|
|
||||||
if(s->avctx->dct_algo==FF_DCT_FASTINT)
|
if(s->avctx->dct_algo==FF_DCT_FASTINT)
|
||||||
s->fdct = fdct_ifast;
|
s->fdct = fdct_ifast;
|
||||||
else
|
else
|
||||||
s->fdct = ff_jpeg_fdct_islow; //slow/accurate/default
|
s->fdct = ff_jpeg_fdct_islow; //slow/accurate/default
|
||||||
|
#endif //CONFIG_ENCODERS
|
||||||
|
|
||||||
if(s->avctx->idct_algo==FF_IDCT_INT){
|
if(s->avctx->idct_algo==FF_IDCT_INT){
|
||||||
s->idct_put= ff_jref_idct_put;
|
s->idct_put= ff_jref_idct_put;
|
||||||
@ -234,12 +243,15 @@ int DCT_common_init(MpegEncContext *s)
|
|||||||
MPV_common_init_ppc(s);
|
MPV_common_init_ppc(s);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_ENCODERS
|
||||||
s->fast_dct_quantize= s->dct_quantize;
|
s->fast_dct_quantize= s->dct_quantize;
|
||||||
|
|
||||||
if(s->flags&CODEC_FLAG_TRELLIS_QUANT){
|
if(s->flags&CODEC_FLAG_TRELLIS_QUANT){
|
||||||
s->dct_quantize= dct_quantize_trellis_c; //move before MPV_common_init_*
|
s->dct_quantize= dct_quantize_trellis_c; //move before MPV_common_init_*
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif //CONFIG_ENCODERS
|
||||||
|
|
||||||
switch(s->idct_permutation_type){
|
switch(s->idct_permutation_type){
|
||||||
case FF_NO_IDCT_PERM:
|
case FF_NO_IDCT_PERM:
|
||||||
for(i=0; i<64; i++)
|
for(i=0; i<64; i++)
|
||||||
@ -544,6 +556,8 @@ void MPV_common_end(MpegEncContext *s)
|
|||||||
s->context_initialized = 0;
|
s->context_initialized = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_ENCODERS
|
||||||
|
|
||||||
/* init video encoder */
|
/* init video encoder */
|
||||||
int MPV_encode_init(AVCodecContext *avctx)
|
int MPV_encode_init(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
@ -810,6 +824,8 @@ int MPV_encode_end(AVCodecContext *avctx)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif //CONFIG_ENCODERS
|
||||||
|
|
||||||
void init_rl(RLTable *rl)
|
void init_rl(RLTable *rl)
|
||||||
{
|
{
|
||||||
int8_t max_level[MAX_RUN+1], max_run[MAX_LEVEL+1];
|
int8_t max_level[MAX_RUN+1], max_run[MAX_LEVEL+1];
|
||||||
@ -1019,6 +1035,8 @@ void MPV_frame_end(MpegEncContext *s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_ENCODERS
|
||||||
|
|
||||||
static int get_sae(uint8_t *src, int ref, int stride){
|
static int get_sae(uint8_t *src, int ref, int stride){
|
||||||
int x,y;
|
int x,y;
|
||||||
int acc=0;
|
int acc=0;
|
||||||
@ -1323,6 +1341,8 @@ int MPV_encode_picture(AVCodecContext *avctx,
|
|||||||
return pbBufPtr(&s->pb) - s->pb.buf;
|
return pbBufPtr(&s->pb) - s->pb.buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif //CONFIG_ENCODERS
|
||||||
|
|
||||||
static inline void gmc1_motion(MpegEncContext *s,
|
static inline void gmc1_motion(MpegEncContext *s,
|
||||||
uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
|
uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
|
||||||
int dest_offset,
|
int dest_offset,
|
||||||
@ -2188,6 +2208,8 @@ void MPV_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_ENCODERS
|
||||||
|
|
||||||
static inline void dct_single_coeff_elimination(MpegEncContext *s, int n, int threshold)
|
static inline void dct_single_coeff_elimination(MpegEncContext *s, int n, int threshold)
|
||||||
{
|
{
|
||||||
static const char tab[64]=
|
static const char tab[64]=
|
||||||
@ -2391,6 +2413,8 @@ static int pix_diff_vcmp16x8(uint8_t *s1, uint8_t*s2, int stride){ //FIXME move
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif //CONFIG_ENCODERS
|
||||||
|
|
||||||
void ff_draw_horiz_band(MpegEncContext *s){
|
void ff_draw_horiz_band(MpegEncContext *s){
|
||||||
if ( s->avctx->draw_horiz_band
|
if ( s->avctx->draw_horiz_band
|
||||||
&& (s->last_picture.data[0] || s->low_delay) ) {
|
&& (s->last_picture.data[0] || s->low_delay) ) {
|
||||||
@ -2422,6 +2446,8 @@ void ff_draw_horiz_band(MpegEncContext *s){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_ENCODERS
|
||||||
|
|
||||||
static void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
|
static void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
|
||||||
{
|
{
|
||||||
const int mb_x= s->mb_x;
|
const int mb_x= s->mb_x;
|
||||||
@ -2658,7 +2684,6 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
|
|||||||
s->block[5][0]= (1024 + s->c_dc_scale/2)/ s->c_dc_scale;
|
s->block[5][0]= (1024 + s->c_dc_scale/2)/ s->c_dc_scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_ENCODERS
|
|
||||||
/* huffman encode */
|
/* huffman encode */
|
||||||
switch(s->codec_id){ //FIXME funct ptr could be slightly faster
|
switch(s->codec_id){ //FIXME funct ptr could be slightly faster
|
||||||
case CODEC_ID_MPEG1VIDEO:
|
case CODEC_ID_MPEG1VIDEO:
|
||||||
@ -2682,9 +2707,10 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
|
|||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif //CONFIG_ENCODERS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* combines the (truncated) bitstream to a complete frame
|
* combines the (truncated) bitstream to a complete frame
|
||||||
* @returns -1 if no complete frame could be created
|
* @returns -1 if no complete frame could be created
|
||||||
@ -2714,6 +2740,7 @@ int ff_combine_frame( MpegEncContext *s, int next, uint8_t **buf, int *buf_size)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_ENCODERS
|
||||||
void ff_copy_bits(PutBitContext *pb, uint8_t *src, int length)
|
void ff_copy_bits(PutBitContext *pb, uint8_t *src, int length)
|
||||||
{
|
{
|
||||||
int bytes= length>>4;
|
int bytes= length>>4;
|
||||||
@ -3819,6 +3846,8 @@ static int dct_quantize_c(MpegEncContext *s,
|
|||||||
return last_non_zero;
|
return last_non_zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif //CONFIG_ENCODERS
|
||||||
|
|
||||||
static void dct_unquantize_mpeg1_c(MpegEncContext *s,
|
static void dct_unquantize_mpeg1_c(MpegEncContext *s,
|
||||||
DCTELEM *block, int n, int qscale)
|
DCTELEM *block, int n, int qscale)
|
||||||
{
|
{
|
||||||
@ -3988,6 +4017,7 @@ static void dct_unquantize_h263_c(MpegEncContext *s,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char ff_get_pict_type_char(int pict_type){
|
char ff_get_pict_type_char(int pict_type){
|
||||||
switch(pict_type){
|
switch(pict_type){
|
||||||
case I_TYPE: return 'I';
|
case I_TYPE: return 'I';
|
||||||
@ -4022,6 +4052,8 @@ static const AVOption mpeg4_options[] =
|
|||||||
AVOPTION_END()
|
AVOPTION_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef CONFIG_ENCODERS
|
||||||
|
|
||||||
AVCodec mpeg1video_encoder = {
|
AVCodec mpeg1video_encoder = {
|
||||||
"mpeg1video",
|
"mpeg1video",
|
||||||
CODEC_TYPE_VIDEO,
|
CODEC_TYPE_VIDEO,
|
||||||
@ -4126,3 +4158,6 @@ AVCodec mjpeg_encoder = {
|
|||||||
MPV_encode_picture,
|
MPV_encode_picture,
|
||||||
MPV_encode_end,
|
MPV_encode_end,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif //CONFIG_ENCODERS
|
||||||
|
|
||||||
|
@ -53,16 +53,22 @@
|
|||||||
static uint32_t v2_dc_lum_table[512][2];
|
static uint32_t v2_dc_lum_table[512][2];
|
||||||
static uint32_t v2_dc_chroma_table[512][2];
|
static uint32_t v2_dc_chroma_table[512][2];
|
||||||
|
|
||||||
|
#ifdef CONFIG_ENCODERS
|
||||||
static inline void msmpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n);
|
static inline void msmpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n);
|
||||||
|
#endif //CONFIG_ENCODERS
|
||||||
static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
|
static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
|
||||||
int n, int coded, const uint8_t *scantable);
|
int n, int coded, const uint8_t *scantable);
|
||||||
static int msmpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr);
|
static int msmpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr);
|
||||||
static int msmpeg4_decode_motion(MpegEncContext * s,
|
static int msmpeg4_decode_motion(MpegEncContext * s,
|
||||||
int *mx_ptr, int *my_ptr);
|
int *mx_ptr, int *my_ptr);
|
||||||
|
#ifdef CONFIG_ENCODERS
|
||||||
static void msmpeg4v2_encode_motion(MpegEncContext * s, int val);
|
static void msmpeg4v2_encode_motion(MpegEncContext * s, int val);
|
||||||
|
#endif //CONFIG_ENCODERS
|
||||||
static void init_h263_dc_for_msmpeg4(void);
|
static void init_h263_dc_for_msmpeg4(void);
|
||||||
static inline void msmpeg4_memsetw(short *tab, int val, int n);
|
static inline void msmpeg4_memsetw(short *tab, int val, int n);
|
||||||
|
#ifdef CONFIG_ENCODERS
|
||||||
static int get_size_of_code(MpegEncContext * s, RLTable *rl, int last, int run, int level, int intra);
|
static int get_size_of_code(MpegEncContext * s, RLTable *rl, int last, int run, int level, int intra);
|
||||||
|
#endif //CONFIG_ENCODERS
|
||||||
static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64]);
|
static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64]);
|
||||||
static int msmpeg4v34_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]);
|
static int wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64]);
|
||||||
@ -185,6 +191,8 @@ static void common_init(MpegEncContext * s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_ENCODERS
|
||||||
|
|
||||||
/* build the table which associate a (x,y) motion vector to a vlc */
|
/* build the table which associate a (x,y) motion vector to a vlc */
|
||||||
static void init_mv_table(MVTable *tab)
|
static void init_mv_table(MVTable *tab)
|
||||||
{
|
{
|
||||||
@ -433,6 +441,8 @@ void msmpeg4_encode_ext_header(MpegEncContext * s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif //CONFIG_ENCODERS
|
||||||
|
|
||||||
/* predict coded block */
|
/* predict coded block */
|
||||||
static inline int coded_block_pred(MpegEncContext * s, int n, uint8_t **coded_block_ptr)
|
static inline int coded_block_pred(MpegEncContext * s, int n, uint8_t **coded_block_ptr)
|
||||||
{
|
{
|
||||||
@ -460,6 +470,8 @@ static inline int coded_block_pred(MpegEncContext * s, int n, uint8_t **coded_bl
|
|||||||
return pred;
|
return pred;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_ENCODERS
|
||||||
|
|
||||||
static void msmpeg4_encode_motion(MpegEncContext * s,
|
static void msmpeg4_encode_motion(MpegEncContext * s,
|
||||||
int mx, int my)
|
int mx, int my)
|
||||||
{
|
{
|
||||||
@ -624,6 +636,8 @@ void msmpeg4_encode_mb(MpegEncContext * s,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif //CONFIG_ENCODERS
|
||||||
|
|
||||||
/* old ffmpeg msmpeg4v3 mode */
|
/* old ffmpeg msmpeg4v3 mode */
|
||||||
static void ff_old_msmpeg4_dc_scale(MpegEncContext * s)
|
static void ff_old_msmpeg4_dc_scale(MpegEncContext * s)
|
||||||
{
|
{
|
||||||
@ -817,6 +831,8 @@ static inline int msmpeg4_pred_dc(MpegEncContext * s, int n,
|
|||||||
|
|
||||||
#define DC_MAX 119
|
#define DC_MAX 119
|
||||||
|
|
||||||
|
#ifdef CONFIG_ENCODERS
|
||||||
|
|
||||||
static void msmpeg4_encode_dc(MpegEncContext * s, int level, int n, int *dir_ptr)
|
static void msmpeg4_encode_dc(MpegEncContext * s, int level, int n, int *dir_ptr)
|
||||||
{
|
{
|
||||||
int sign, code;
|
int sign, code;
|
||||||
@ -1009,6 +1025,8 @@ else
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif //CONFIG_ENCODERS
|
||||||
|
|
||||||
/****************************************/
|
/****************************************/
|
||||||
/* decoding stuff */
|
/* decoding stuff */
|
||||||
|
|
||||||
@ -1391,6 +1409,8 @@ static inline void msmpeg4_memsetw(short *tab, int val, int n)
|
|||||||
tab[i] = val;
|
tab[i] = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_ENCODERS
|
||||||
|
|
||||||
static void msmpeg4v2_encode_motion(MpegEncContext * s, int val)
|
static void msmpeg4v2_encode_motion(MpegEncContext * s, int val)
|
||||||
{
|
{
|
||||||
int range, bit_size, sign, code, bits;
|
int range, bit_size, sign, code, bits;
|
||||||
@ -1424,6 +1444,8 @@ static void msmpeg4v2_encode_motion(MpegEncContext * s, int val)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif //CONFIG_ENCODERS
|
||||||
|
|
||||||
/* this is identical to h263 except that its range is multiplied by 2 */
|
/* this is identical to h263 except that its range is multiplied by 2 */
|
||||||
static int msmpeg4v2_decode_motion(MpegEncContext * s, int pred, int f_code)
|
static int msmpeg4v2_decode_motion(MpegEncContext * s, int pred, int f_code)
|
||||||
{
|
{
|
||||||
|
@ -220,6 +220,8 @@ int rv_decode_dc(MpegEncContext *s, int n)
|
|||||||
return -code;
|
return -code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_ENCODERS
|
||||||
|
|
||||||
/* write RV 1.0 compatible frame header */
|
/* write RV 1.0 compatible frame header */
|
||||||
void rv10_encode_picture_header(MpegEncContext *s, int picture_number)
|
void rv10_encode_picture_header(MpegEncContext *s, int picture_number)
|
||||||
{
|
{
|
||||||
@ -262,6 +264,8 @@ static int get_num(GetBitContext *gb)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif //CONFIG_ENCODERS
|
||||||
|
|
||||||
/* read RV 1.0 compatible frame header */
|
/* read RV 1.0 compatible frame header */
|
||||||
static int rv10_decode_picture_header(MpegEncContext *s)
|
static int rv10_decode_picture_header(MpegEncContext *s)
|
||||||
{
|
{
|
||||||
@ -330,7 +334,7 @@ static int rv10_decode_picture_header(MpegEncContext *s)
|
|||||||
static int rv10_decode_init(AVCodecContext *avctx)
|
static int rv10_decode_init(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
MpegEncContext *s = avctx->priv_data;
|
MpegEncContext *s = avctx->priv_data;
|
||||||
static int done;
|
static int done=0;
|
||||||
|
|
||||||
s->avctx= avctx;
|
s->avctx= avctx;
|
||||||
s->out_format = FMT_H263;
|
s->out_format = FMT_H263;
|
||||||
|
@ -79,6 +79,7 @@ static int encode_ext_header(Wmv2Context *w){
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_ENCODERS
|
||||||
static int wmv2_encode_init(AVCodecContext *avctx){
|
static int wmv2_encode_init(AVCodecContext *avctx){
|
||||||
Wmv2Context * const w= avctx->priv_data;
|
Wmv2Context * const w= avctx->priv_data;
|
||||||
|
|
||||||
@ -255,6 +256,7 @@ void ff_wmv2_encode_mb(MpegEncContext * s,
|
|||||||
msmpeg4_encode_block(s, block[i], i);
|
msmpeg4_encode_block(s, block[i], i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif //CONFIG_ENCODERS
|
||||||
|
|
||||||
static void parse_mb_skip(Wmv2Context * w){
|
static void parse_mb_skip(Wmv2Context * w){
|
||||||
int mb_x, mb_y;
|
int mb_x, mb_y;
|
||||||
@ -828,6 +830,7 @@ AVCodec wmv2_decoder = {
|
|||||||
CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
|
CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef CONFIG_ENCODERS
|
||||||
AVCodec wmv2_encoder = {
|
AVCodec wmv2_encoder = {
|
||||||
"wmv2",
|
"wmv2",
|
||||||
CODEC_TYPE_VIDEO,
|
CODEC_TYPE_VIDEO,
|
||||||
@ -837,4 +840,4 @@ AVCodec wmv2_encoder = {
|
|||||||
MPV_encode_picture,
|
MPV_encode_picture,
|
||||||
MPV_encode_end,
|
MPV_encode_end,
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user