mirror of
https://gitee.com/openharmony/third_party_ffmpeg
synced 2024-11-23 19:30:05 +00:00
CONFIG_ENCODERS cleanup
Originally committed as revision 1984 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
4fb518c392
commit
2a250222e6
@ -95,8 +95,6 @@ static inline int get_level(GetBitContext *gb){
|
||||
else return code - 3;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ENCODERS
|
||||
|
||||
static inline void put_level(PutBitContext *pb, int level){
|
||||
unsigned int index= level + 3;
|
||||
|
||||
@ -107,8 +105,6 @@ static inline void put_level(PutBitContext *pb, int level){
|
||||
}
|
||||
}
|
||||
|
||||
#endif //CONFIG_ENCODERS
|
||||
|
||||
static inline int decode_block(ASV1Context *a, DCTELEM block[64]){
|
||||
int i;
|
||||
|
||||
@ -134,8 +130,6 @@ static inline int decode_block(ASV1Context *a, DCTELEM block[64]){
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ENCODERS
|
||||
|
||||
static inline void encode_block(ASV1Context *a, DCTELEM block[64]){
|
||||
int i;
|
||||
int nc_count=0;
|
||||
@ -169,8 +163,6 @@ static inline void encode_block(ASV1Context *a, DCTELEM block[64]){
|
||||
put_bits(&a->pb, ccp_tab[16][1], ccp_tab[16][0]);
|
||||
}
|
||||
|
||||
#endif //CONFIG_ENCODERS
|
||||
|
||||
static inline int decode_mb(ASV1Context *a, DCTELEM block[6][64]){
|
||||
int i;
|
||||
|
||||
@ -183,8 +175,6 @@ static inline int decode_mb(ASV1Context *a, DCTELEM block[6][64]){
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ENCODERS
|
||||
|
||||
static inline void encode_mb(ASV1Context *a, DCTELEM block[6][64]){
|
||||
int i;
|
||||
|
||||
@ -192,8 +182,6 @@ static inline void encode_mb(ASV1Context *a, DCTELEM block[6][64]){
|
||||
encode_block(a, block[i]);
|
||||
}
|
||||
}
|
||||
|
||||
#endif //CONFIG_ENCODERS
|
||||
|
||||
static inline void idct_put(ASV1Context *a, int mb_x, int mb_y){
|
||||
DCTELEM (*block)[64]= a->block;
|
||||
@ -214,8 +202,6 @@ static inline void idct_put(ASV1Context *a, int mb_x, int mb_y){
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ENCODERS
|
||||
|
||||
static inline void dct_get(ASV1Context *a, int mb_x, int mb_y){
|
||||
DCTELEM (*block)[64]= a->block;
|
||||
int linesize= a->picture.linesize[0];
|
||||
@ -240,8 +226,6 @@ static inline void dct_get(ASV1Context *a, int mb_x, int mb_y){
|
||||
}
|
||||
}
|
||||
|
||||
#endif //CONFIG_ENCODERS
|
||||
|
||||
static int decode_frame(AVCodecContext *avctx,
|
||||
void *data, int *data_size,
|
||||
uint8_t *buf, int buf_size)
|
||||
@ -324,8 +308,6 @@ for(i=0; i<s->avctx->extradata_size; i++){
|
||||
return (get_bits_count(&a->gb)+31)/32*4;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ENCODERS
|
||||
|
||||
static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){
|
||||
ASV1Context * const a = avctx->priv_data;
|
||||
AVFrame *pict = data;
|
||||
@ -374,8 +356,6 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
|
||||
return size*4;
|
||||
}
|
||||
|
||||
#endif //CONFIG_ENCODERS
|
||||
|
||||
static void common_init(AVCodecContext *avctx){
|
||||
ASV1Context * const a = avctx->priv_data;
|
||||
|
||||
@ -416,8 +396,6 @@ static int decode_init(AVCodecContext *avctx){
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ENCODERS
|
||||
|
||||
static int encode_init(AVCodecContext *avctx){
|
||||
ASV1Context * const a = avctx->priv_data;
|
||||
int i;
|
||||
@ -441,8 +419,6 @@ static int encode_init(AVCodecContext *avctx){
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif //CONFIG_ENCODERS
|
||||
|
||||
static int decode_end(AVCodecContext *avctx){
|
||||
ASV1Context * const a = avctx->priv_data;
|
||||
|
||||
|
@ -905,6 +905,7 @@ AVCodec ffv1_decoder = {
|
||||
NULL
|
||||
};
|
||||
|
||||
#ifdef CONFIG_ENCODERS
|
||||
AVCodec ffv1_encoder = {
|
||||
"ffv1",
|
||||
CODEC_TYPE_VIDEO,
|
||||
@ -914,3 +915,4 @@ AVCodec ffv1_encoder = {
|
||||
encode_frame,
|
||||
encode_end,
|
||||
};
|
||||
#endif
|
||||
|
@ -153,7 +153,6 @@ static inline void add_median_prediction(uint8_t *dst, uint8_t *src1, uint8_t *d
|
||||
*left_top= lt;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ENCODERS
|
||||
//FIXME optimize
|
||||
static inline void sub_median_prediction(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w, int *left, int *left_top){
|
||||
int i;
|
||||
@ -173,8 +172,6 @@ static inline void sub_median_prediction(uint8_t *dst, uint8_t *src1, uint8_t *s
|
||||
*left_top= lt;
|
||||
}
|
||||
|
||||
#endif //CONFIG_ENCODERS
|
||||
|
||||
static inline void add_left_prediction_bgr32(uint8_t *dst, uint8_t *src, int w, int *red, int *green, int *blue){
|
||||
int i;
|
||||
int r,g,b;
|
||||
@ -197,7 +194,6 @@ static inline void add_left_prediction_bgr32(uint8_t *dst, uint8_t *src, int w,
|
||||
*blue= b;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ENCODERS
|
||||
static inline int sub_left_prediction(HYuvContext *s, uint8_t *dst, uint8_t *src, int w, int left){
|
||||
int i;
|
||||
if(w<32){
|
||||
@ -217,7 +213,7 @@ static inline int sub_left_prediction(HYuvContext *s, uint8_t *dst, uint8_t *src
|
||||
return src[w-1];
|
||||
}
|
||||
}
|
||||
#endif //CONFIG_ENCODERS
|
||||
|
||||
static void read_len_table(uint8_t *dst, GetBitContext *gb){
|
||||
int i, val, repeat;
|
||||
|
||||
@ -250,8 +246,6 @@ static int generate_bits_table(uint32_t *dst, uint8_t *len_table){
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ENCODERS
|
||||
|
||||
static void generate_len_table(uint8_t *dst, uint64_t *stats, int size){
|
||||
uint64_t counts[2*size];
|
||||
int up[2*size];
|
||||
@ -308,8 +302,6 @@ static void generate_len_table(uint8_t *dst, uint64_t *stats, int size){
|
||||
}
|
||||
}
|
||||
|
||||
#endif //CONFIG_ENCODERS
|
||||
|
||||
static int read_huffman_tables(HYuvContext *s, uint8_t *src, int length){
|
||||
GetBitContext gb;
|
||||
int i;
|
||||
@ -460,8 +452,6 @@ s->bgr32=1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ENCODERS
|
||||
|
||||
static void store_table(HYuvContext *s, uint8_t *len){
|
||||
int i;
|
||||
int index= s->avctx->extradata_size;
|
||||
@ -583,8 +573,6 @@ static int encode_init(AVCodecContext *avctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif //CONFIG_ENCODERS
|
||||
|
||||
static void decode_422_bitstream(HYuvContext *s, int count){
|
||||
int i;
|
||||
|
||||
@ -609,8 +597,6 @@ static void decode_gray_bitstream(HYuvContext *s, int count){
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ENCODERS
|
||||
|
||||
static void encode_422_bitstream(HYuvContext *s, int count){
|
||||
int i;
|
||||
|
||||
@ -649,8 +635,6 @@ static void encode_gray_bitstream(HYuvContext *s, int count){
|
||||
}
|
||||
}
|
||||
|
||||
#endif //CONFIG_ENCODERS
|
||||
|
||||
static void decode_bgr_bitstream(HYuvContext *s, int count){
|
||||
int i;
|
||||
|
||||
@ -961,8 +945,6 @@ static int decode_end(AVCodecContext *avctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ENCODERS
|
||||
|
||||
static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){
|
||||
HYuvContext *s = avctx->priv_data;
|
||||
AVFrame *pict = data;
|
||||
@ -1130,8 +1112,6 @@ static const AVOption huffyuv_options[] =
|
||||
AVOPTION_END()
|
||||
};
|
||||
|
||||
#endif //CONFIG_ENCODERS
|
||||
|
||||
AVCodec huffyuv_decoder = {
|
||||
"huffyuv",
|
||||
CODEC_TYPE_VIDEO,
|
||||
|
@ -292,6 +292,7 @@ void mjpeg_close(MpegEncContext *s)
|
||||
case 7: ret= (left + top)>>1; break;\
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ENCODERS
|
||||
static inline void put_marker(PutBitContext *p, int code)
|
||||
{
|
||||
put_bits(p, 8, 0xff);
|
||||
@ -575,7 +576,7 @@ static inline void mjpeg_encode_dc(MpegEncContext *s, int val,
|
||||
mant--;
|
||||
}
|
||||
|
||||
nbits= av_log2(val) + 1;
|
||||
nbits= av_log2_16bit(val) + 1;
|
||||
|
||||
put_bits(&s->pb, huff_size[nbits], huff_code[nbits]);
|
||||
|
||||
@ -789,6 +790,7 @@ static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, in
|
||||
// return (get_bit_count(&f->pb)+7)/8;
|
||||
}
|
||||
|
||||
#endif //CONFIG_ENCODERS
|
||||
|
||||
/******************************************/
|
||||
/* decoding */
|
||||
@ -2038,6 +2040,7 @@ AVCodec mjpegb_decoder = {
|
||||
NULL
|
||||
};
|
||||
|
||||
#ifdef CONFIG_ENCODERS
|
||||
AVCodec ljpeg_encoder = { //FIXME avoid MPV_* lossless jpeg shouldnt need them
|
||||
"ljpeg",
|
||||
CODEC_TYPE_VIDEO,
|
||||
@ -2047,3 +2050,4 @@ AVCodec ljpeg_encoder = { //FIXME avoid MPV_* lossless jpeg shouldnt need them
|
||||
encode_picture_lossless,
|
||||
MPV_encode_end,
|
||||
};
|
||||
#endif
|
||||
|
@ -73,6 +73,13 @@ static uint8_t fcode_tab[MAX_MV*2+1];
|
||||
|
||||
static uint32_t uni_mpeg1_ac_vlc_bits[64*64*2];
|
||||
static uint8_t uni_mpeg1_ac_vlc_len [64*64*2];
|
||||
|
||||
/* simple include everything table for dc, first byte is bits number next 3 are code*/
|
||||
static uint32_t mpeg1_lum_dc_uni[512];
|
||||
static uint32_t mpeg1_chr_dc_uni[512];
|
||||
|
||||
static uint8_t mpeg1_index_run[2][64];
|
||||
static int8_t mpeg1_max_level[2][64];
|
||||
#endif
|
||||
|
||||
static void init_2d_vlc_rl(RLTable *rl)
|
||||
@ -114,6 +121,7 @@ static void init_2d_vlc_rl(RLTable *rl)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ENCODERS
|
||||
static void init_uni_ac_vlc(RLTable *rl, uint32_t *uni_ac_vlc_bits, uint8_t *uni_ac_vlc_len){
|
||||
int i;
|
||||
|
||||
@ -309,6 +317,7 @@ static void mpeg1_skip_picture(MpegEncContext *s, int pict_num)
|
||||
put_bits(&s->pb, 1, 1);
|
||||
put_bits(&s->pb, 1, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void common_init(MpegEncContext *s)
|
||||
{
|
||||
@ -316,6 +325,13 @@ static void common_init(MpegEncContext *s)
|
||||
s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
|
||||
}
|
||||
|
||||
void ff_mpeg1_clean_buffers(MpegEncContext *s){
|
||||
s->last_dc[0] = 1 << (7 + s->intra_dc_precision);
|
||||
s->last_dc[1] = s->last_dc[0];
|
||||
s->last_dc[2] = s->last_dc[0];
|
||||
memset(s->last_mv, 0, sizeof(s->last_mv));
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ENCODERS
|
||||
|
||||
void ff_mpeg1_encode_slice_header(MpegEncContext *s){
|
||||
@ -324,13 +340,6 @@ void ff_mpeg1_encode_slice_header(MpegEncContext *s){
|
||||
put_bits(&s->pb, 1, 0); /* slice extra information */
|
||||
}
|
||||
|
||||
void ff_mpeg1_clean_buffers(MpegEncContext *s){
|
||||
s->last_dc[0] = 1 << (7 + s->intra_dc_precision);
|
||||
s->last_dc[1] = s->last_dc[0];
|
||||
s->last_dc[2] = s->last_dc[0];
|
||||
memset(s->last_mv, 0, sizeof(s->last_mv));
|
||||
}
|
||||
|
||||
void mpeg1_encode_picture_header(MpegEncContext *s, int picture_number)
|
||||
{
|
||||
mpeg1_encode_sequence_header(s);
|
||||
|
@ -25,7 +25,7 @@ const int16_t ff_mpeg1_default_non_intra_matrix[64] = {
|
||||
16, 16, 16, 16, 16, 16, 16, 16,
|
||||
};
|
||||
|
||||
const unsigned char vlc_dc_table[256] = {
|
||||
static const unsigned char vlc_dc_table[256] = {
|
||||
0, 1, 2, 2,
|
||||
3, 3, 3, 3,
|
||||
4, 4, 4, 4, 4, 4, 4, 4,
|
||||
@ -48,10 +48,10 @@ const unsigned char vlc_dc_table[256] = {
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
};
|
||||
|
||||
const uint16_t vlc_dc_lum_code[12] = {
|
||||
static const uint16_t vlc_dc_lum_code[12] = {
|
||||
0x4, 0x0, 0x1, 0x5, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe, 0x1ff,
|
||||
};
|
||||
const unsigned char vlc_dc_lum_bits[12] = {
|
||||
static const unsigned char vlc_dc_lum_bits[12] = {
|
||||
3, 2, 2, 3, 3, 4, 5, 6, 7, 8, 9, 9,
|
||||
};
|
||||
|
||||
@ -62,10 +62,6 @@ const unsigned char vlc_dc_chroma_bits[12] = {
|
||||
2, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10,
|
||||
};
|
||||
|
||||
/* simple include everything table for dc, first byte is bits number next 3 are code*/
|
||||
static uint32_t mpeg1_lum_dc_uni[512];
|
||||
static uint32_t mpeg1_chr_dc_uni[512];
|
||||
|
||||
static const uint16_t mpeg1_vlc[113][2] = {
|
||||
{ 0x3, 2 }, { 0x4, 4 }, { 0x5, 5 }, { 0x6, 7 },
|
||||
{ 0x26, 8 }, { 0x21, 8 }, { 0xa, 10 }, { 0x1d, 12 },
|
||||
@ -166,9 +162,6 @@ static const int8_t mpeg1_run[111] = {
|
||||
25, 26, 27, 28, 29, 30, 31,
|
||||
};
|
||||
|
||||
static uint8_t mpeg1_index_run[2][64];
|
||||
static int8_t mpeg1_max_level[2][64];
|
||||
|
||||
static RLTable rl_mpeg1 = {
|
||||
111,
|
||||
111,
|
||||
|
@ -58,17 +58,13 @@
|
||||
static uint32_t v2_dc_lum_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);
|
||||
#endif //CONFIG_ENCODERS
|
||||
static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
|
||||
int n, int coded, const uint8_t *scantable);
|
||||
static int msmpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr);
|
||||
static int msmpeg4_decode_motion(MpegEncContext * s,
|
||||
int *mx_ptr, int *my_ptr);
|
||||
#ifdef CONFIG_ENCODERS
|
||||
static void msmpeg4v2_encode_motion(MpegEncContext * s, int val);
|
||||
#endif //CONFIG_ENCODERS
|
||||
static void init_h263_dc_for_msmpeg4(void);
|
||||
static inline void msmpeg4_memsetw(short *tab, int val, int n);
|
||||
#ifdef CONFIG_ENCODERS
|
||||
@ -86,7 +82,9 @@ int frame_count = 0;
|
||||
|
||||
#include "msmpeg4data.h"
|
||||
|
||||
#ifdef CONFIG_ENCODERS //strangely gcc includes this even if its not references
|
||||
static uint8_t rl_length[NB_RL_TABLES][MAX_LEVEL+1][MAX_RUN+1][2];
|
||||
#endif //CONFIG_ENCODERS
|
||||
|
||||
#ifdef STATS
|
||||
|
||||
@ -850,8 +848,6 @@ static inline int msmpeg4_pred_dc(MpegEncContext * s, int n,
|
||||
|
||||
#define DC_MAX 119
|
||||
|
||||
#ifdef CONFIG_ENCODERS
|
||||
|
||||
static void msmpeg4_encode_dc(MpegEncContext * s, int level, int n, int *dir_ptr)
|
||||
{
|
||||
int sign, code;
|
||||
@ -1044,8 +1040,6 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
#endif //CONFIG_ENCODERS
|
||||
|
||||
/****************************************/
|
||||
/* decoding stuff */
|
||||
|
||||
@ -1428,8 +1422,6 @@ static inline void msmpeg4_memsetw(short *tab, int val, int n)
|
||||
tab[i] = val;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ENCODERS
|
||||
|
||||
static void msmpeg4v2_encode_motion(MpegEncContext * s, int val)
|
||||
{
|
||||
int range, bit_size, sign, code, bits;
|
||||
@ -1463,8 +1455,6 @@ 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 */
|
||||
static int msmpeg4v2_decode_motion(MpegEncContext * s, int pred, int f_code)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user