Split the mpeg4 encoder and decoder off h263.c
Originally committed as revision 21079 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
		@@ -124,10 +124,10 @@ OBJS-$(CONFIG_H261_ENCODER)            += h261enc.o h261.o             \
 | 
			
		||||
                                          mpegvideo_enc.o motion_est.o \
 | 
			
		||||
                                          ratecontrol.o mpeg12data.o   \
 | 
			
		||||
                                          mpegvideo.o
 | 
			
		||||
OBJS-$(CONFIG_H263_DECODER)            += h263dec.o h263.o flvdec.o intelh263dec.o \
 | 
			
		||||
OBJS-$(CONFIG_H263_DECODER)            += h263dec.o h263.o mpeg4video.o mpeg4videodec.o flvdec.o intelh263dec.o \
 | 
			
		||||
                                          mpegvideo.o error_resilience.o
 | 
			
		||||
OBJS-$(CONFIG_H263_VAAPI_HWACCEL)      += vaapi_mpeg4.o
 | 
			
		||||
OBJS-$(CONFIG_H263_ENCODER)            += mpegvideo_enc.o motion_est.o      \
 | 
			
		||||
OBJS-$(CONFIG_H263_ENCODER)            += mpegvideo_enc.o mpeg4video.o mpeg4videoenc.o motion_est.o      \
 | 
			
		||||
                                          ratecontrol.o h263.o flvenc.o mpeg12data.o \
 | 
			
		||||
                                          mpegvideo.o error_resilience.o
 | 
			
		||||
OBJS-$(CONFIG_H264_DECODER)            += h264.o h264idct.o h264pred.o cabac.o \
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										3742
									
								
								libavcodec/h263.c
									
									
									
									
									
								
							
							
						
						
									
										3742
									
								
								libavcodec/h263.c
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										178
									
								
								libavcodec/h263.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										178
									
								
								libavcodec/h263.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,178 @@
 | 
			
		||||
/*
 | 
			
		||||
 * H263 internal header
 | 
			
		||||
 *
 | 
			
		||||
 * This file is part of FFmpeg.
 | 
			
		||||
 *
 | 
			
		||||
 * FFmpeg is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
 * License as published by the Free Software Foundation; either
 | 
			
		||||
 * version 2.1 of the License, or (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * FFmpeg is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with FFmpeg; if not, write to the Free Software
 | 
			
		||||
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 | 
			
		||||
 */
 | 
			
		||||
#ifndef AVCODEC_H263_H
 | 
			
		||||
#define AVCODEC_H263_H
 | 
			
		||||
 | 
			
		||||
// The defines below define the number of bits that are read at once for
 | 
			
		||||
// reading vlc values. Changing these may improve speed and data cache needs
 | 
			
		||||
// be aware though that decreasing them may need the number of stages that is
 | 
			
		||||
// passed to get_vlc* to be increased.
 | 
			
		||||
#define INTRA_MCBPC_VLC_BITS 6
 | 
			
		||||
#define INTER_MCBPC_VLC_BITS 7
 | 
			
		||||
#define CBPY_VLC_BITS 6
 | 
			
		||||
#define TEX_VLC_BITS 9
 | 
			
		||||
 | 
			
		||||
extern const AVRational ff_h263_pixel_aspect[16];
 | 
			
		||||
extern const uint8_t cbpy_tab[16][2];
 | 
			
		||||
 | 
			
		||||
extern const uint8_t mvtab[33][2];
 | 
			
		||||
 | 
			
		||||
extern const uint8_t intra_MCBPC_code[9];
 | 
			
		||||
extern const uint8_t intra_MCBPC_bits[9];
 | 
			
		||||
 | 
			
		||||
extern const uint8_t inter_MCBPC_code[28];
 | 
			
		||||
extern const uint8_t inter_MCBPC_bits[28];
 | 
			
		||||
 | 
			
		||||
extern VLC intra_MCBPC_vlc;
 | 
			
		||||
extern VLC inter_MCBPC_vlc;
 | 
			
		||||
extern VLC cbpy_vlc;
 | 
			
		||||
 | 
			
		||||
extern RLTable rl_inter;
 | 
			
		||||
 | 
			
		||||
int h263_decode_motion(MpegEncContext * s, int pred, int f_code);
 | 
			
		||||
av_const int ff_h263_aspect_to_info(AVRational aspect);
 | 
			
		||||
 | 
			
		||||
static inline int h263_get_motion_length(MpegEncContext * s, int val, int f_code){
 | 
			
		||||
    int l, bit_size, code;
 | 
			
		||||
 | 
			
		||||
    if (val == 0) {
 | 
			
		||||
        return mvtab[0][1];
 | 
			
		||||
    } else {
 | 
			
		||||
        bit_size = f_code - 1;
 | 
			
		||||
        /* modulo encoding */
 | 
			
		||||
        l= INT_BIT - 6 - bit_size;
 | 
			
		||||
        val = (val<<l)>>l;
 | 
			
		||||
        val--;
 | 
			
		||||
        code = (val >> bit_size) + 1;
 | 
			
		||||
 | 
			
		||||
        return mvtab[code][1] + 1 + bit_size;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline void ff_h263_encode_motion_vector(MpegEncContext * s, int x, int y, int f_code){
 | 
			
		||||
    if(s->flags2 & CODEC_FLAG2_NO_OUTPUT){
 | 
			
		||||
        skip_put_bits(&s->pb,
 | 
			
		||||
            h263_get_motion_length(s, x, f_code)
 | 
			
		||||
           +h263_get_motion_length(s, y, f_code));
 | 
			
		||||
    }else{
 | 
			
		||||
        ff_h263_encode_motion(s, x, f_code);
 | 
			
		||||
        ff_h263_encode_motion(s, y, f_code);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline int get_p_cbp(MpegEncContext * s,
 | 
			
		||||
                      DCTELEM block[6][64],
 | 
			
		||||
                      int motion_x, int motion_y){
 | 
			
		||||
    int cbp, i;
 | 
			
		||||
 | 
			
		||||
    if(s->flags & CODEC_FLAG_CBP_RD){
 | 
			
		||||
        int best_cbpy_score= INT_MAX;
 | 
			
		||||
        int best_cbpc_score= INT_MAX;
 | 
			
		||||
        int cbpc = (-1), cbpy= (-1);
 | 
			
		||||
        const int offset= (s->mv_type==MV_TYPE_16X16 ? 0 : 16) + (s->dquant ? 8 : 0);
 | 
			
		||||
        const int lambda= s->lambda2 >> (FF_LAMBDA_SHIFT - 6);
 | 
			
		||||
 | 
			
		||||
        for(i=0; i<4; i++){
 | 
			
		||||
            int score= inter_MCBPC_bits[i + offset] * lambda;
 | 
			
		||||
            if(i&1) score += s->coded_score[5];
 | 
			
		||||
            if(i&2) score += s->coded_score[4];
 | 
			
		||||
 | 
			
		||||
            if(score < best_cbpc_score){
 | 
			
		||||
                best_cbpc_score= score;
 | 
			
		||||
                cbpc= i;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        for(i=0; i<16; i++){
 | 
			
		||||
            int score= cbpy_tab[i ^ 0xF][1] * lambda;
 | 
			
		||||
            if(i&1) score += s->coded_score[3];
 | 
			
		||||
            if(i&2) score += s->coded_score[2];
 | 
			
		||||
            if(i&4) score += s->coded_score[1];
 | 
			
		||||
            if(i&8) score += s->coded_score[0];
 | 
			
		||||
 | 
			
		||||
            if(score < best_cbpy_score){
 | 
			
		||||
                best_cbpy_score= score;
 | 
			
		||||
                cbpy= i;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        cbp= cbpc + 4*cbpy;
 | 
			
		||||
        if ((motion_x | motion_y | s->dquant) == 0 && s->mv_type==MV_TYPE_16X16){
 | 
			
		||||
            if(best_cbpy_score + best_cbpc_score + 2*lambda >= 0)
 | 
			
		||||
                cbp= 0;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        for (i = 0; i < 6; i++) {
 | 
			
		||||
            if (s->block_last_index[i] >= 0 && ((cbp >> (5 - i))&1)==0 ){
 | 
			
		||||
                s->block_last_index[i]= -1;
 | 
			
		||||
                s->dsp.clear_block(s->block[i]);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }else{
 | 
			
		||||
        cbp= 0;
 | 
			
		||||
        for (i = 0; i < 6; i++) {
 | 
			
		||||
            if (s->block_last_index[i] >= 0)
 | 
			
		||||
                cbp |= 1 << (5 - i);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return cbp;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline int get_b_cbp(MpegEncContext * s, DCTELEM block[6][64],
 | 
			
		||||
                            int motion_x, int motion_y, int mb_type){
 | 
			
		||||
    int cbp=0, i;
 | 
			
		||||
 | 
			
		||||
    if(s->flags & CODEC_FLAG_CBP_RD){
 | 
			
		||||
        int score=0;
 | 
			
		||||
        const int lambda= s->lambda2 >> (FF_LAMBDA_SHIFT - 6);
 | 
			
		||||
 | 
			
		||||
        for(i=0; i<6; i++){
 | 
			
		||||
            if(s->coded_score[i] < 0){
 | 
			
		||||
                score += s->coded_score[i];
 | 
			
		||||
                cbp |= 1 << (5 - i);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if(cbp){
 | 
			
		||||
            int zero_score= -6;
 | 
			
		||||
            if ((motion_x | motion_y | s->dquant | mb_type) == 0){
 | 
			
		||||
                zero_score-= 4; //2*MV + mb_type + cbp bit
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            zero_score*= lambda;
 | 
			
		||||
            if(zero_score <= score){
 | 
			
		||||
                cbp=0;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        for (i = 0; i < 6; i++) {
 | 
			
		||||
            if (s->block_last_index[i] >= 0 && ((cbp >> (5 - i))&1)==0 ){
 | 
			
		||||
                s->block_last_index[i]= -1;
 | 
			
		||||
                s->dsp.clear_block(s->block[i]);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }else{
 | 
			
		||||
        for (i = 0; i < 6; i++) {
 | 
			
		||||
            if (s->block_last_index[i] >= 0)
 | 
			
		||||
                cbp |= 1 << (5 - i);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return cbp;
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
@@ -177,7 +177,7 @@ const int8_t inter_run[102] = {
 | 
			
		||||
 35, 36, 37, 38, 39, 40,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static RLTable rl_inter = {
 | 
			
		||||
RLTable rl_inter = {
 | 
			
		||||
    102,
 | 
			
		||||
    58,
 | 
			
		||||
    inter_vlc,
 | 
			
		||||
@@ -313,4 +313,23 @@ const uint8_t ff_h263_loop_filter_strength[32]={
 | 
			
		||||
    0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9,10,10,10,11,11,11,12,12,12
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const AVRational ff_h263_pixel_aspect[16]={
 | 
			
		||||
 {0, 1},
 | 
			
		||||
 {1, 1},
 | 
			
		||||
 {12, 11},
 | 
			
		||||
 {10, 11},
 | 
			
		||||
 {16, 11},
 | 
			
		||||
 {40, 33},
 | 
			
		||||
 {0, 1},
 | 
			
		||||
 {0, 1},
 | 
			
		||||
 {0, 1},
 | 
			
		||||
 {0, 1},
 | 
			
		||||
 {0, 1},
 | 
			
		||||
 {0, 1},
 | 
			
		||||
 {0, 1},
 | 
			
		||||
 {0, 1},
 | 
			
		||||
 {0, 1},
 | 
			
		||||
 {0, 1},
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif /* AVCODEC_H263DATA_H */
 | 
			
		||||
 
 | 
			
		||||
@@ -34,6 +34,7 @@
 | 
			
		||||
#include "msmpeg4.h"
 | 
			
		||||
#include "vdpau_internal.h"
 | 
			
		||||
#include "flv.h"
 | 
			
		||||
#include "mpeg4video.h"
 | 
			
		||||
 | 
			
		||||
//#define DEBUG
 | 
			
		||||
//#define PRINT_FRAME_TIME
 | 
			
		||||
@@ -64,11 +65,6 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
 | 
			
		||||
        avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
 | 
			
		||||
        break;
 | 
			
		||||
    case CODEC_ID_MPEG4:
 | 
			
		||||
        s->decode_mb= ff_mpeg4_decode_mb;
 | 
			
		||||
        s->time_increment_bits = 4; /* default value for broken headers */
 | 
			
		||||
        s->h263_pred = 1;
 | 
			
		||||
        s->low_delay = 0; //default, might be overriden in the vol header during header parsing
 | 
			
		||||
        avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
 | 
			
		||||
        break;
 | 
			
		||||
    case CODEC_ID_MSMPEG4V1:
 | 
			
		||||
        s->h263_msmpeg4 = 1;
 | 
			
		||||
@@ -731,21 +727,6 @@ av_log(avctx, AV_LOG_DEBUG, "%"PRId64"\n", rdtsc()-time);
 | 
			
		||||
    return get_consumed_bytes(s, buf_size);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
AVCodec mpeg4_decoder = {
 | 
			
		||||
    "mpeg4",
 | 
			
		||||
    CODEC_TYPE_VIDEO,
 | 
			
		||||
    CODEC_ID_MPEG4,
 | 
			
		||||
    sizeof(MpegEncContext),
 | 
			
		||||
    ff_h263_decode_init,
 | 
			
		||||
    NULL,
 | 
			
		||||
    ff_h263_decode_end,
 | 
			
		||||
    ff_h263_decode_frame,
 | 
			
		||||
    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,
 | 
			
		||||
    .flush= ff_mpeg_flush,
 | 
			
		||||
    .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2"),
 | 
			
		||||
    .pix_fmts= ff_hwaccel_pixfmt_list_420,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
AVCodec h263_decoder = {
 | 
			
		||||
    "h263",
 | 
			
		||||
    CODEC_TYPE_VIDEO,
 | 
			
		||||
@@ -816,19 +797,3 @@ AVCodec wmv1_decoder = {
 | 
			
		||||
    .long_name= NULL_IF_CONFIG_SMALL("Windows Media Video 7"),
 | 
			
		||||
    .pix_fmts= ff_pixfmt_list_420,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#if CONFIG_MPEG4_VDPAU_DECODER
 | 
			
		||||
AVCodec mpeg4_vdpau_decoder = {
 | 
			
		||||
    "mpeg4_vdpau",
 | 
			
		||||
    CODEC_TYPE_VIDEO,
 | 
			
		||||
    CODEC_ID_MPEG4,
 | 
			
		||||
    sizeof(MpegEncContext),
 | 
			
		||||
    ff_h263_decode_init,
 | 
			
		||||
    NULL,
 | 
			
		||||
    ff_h263_decode_end,
 | 
			
		||||
    ff_h263_decode_frame,
 | 
			
		||||
    CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY | CODEC_CAP_HWACCEL_VDPAU,
 | 
			
		||||
    .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 (VDPAU)"),
 | 
			
		||||
    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_VDPAU_MPEG4, PIX_FMT_NONE},
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -31,43 +31,6 @@
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
#include "mpegvideo.h"
 | 
			
		||||
 | 
			
		||||
// shapes
 | 
			
		||||
#define RECT_SHAPE       0
 | 
			
		||||
#define BIN_SHAPE        1
 | 
			
		||||
#define BIN_ONLY_SHAPE   2
 | 
			
		||||
#define GRAY_SHAPE       3
 | 
			
		||||
 | 
			
		||||
#define SIMPLE_VO_TYPE             1
 | 
			
		||||
#define CORE_VO_TYPE               3
 | 
			
		||||
#define MAIN_VO_TYPE               4
 | 
			
		||||
#define NBIT_VO_TYPE               5
 | 
			
		||||
#define ARTS_VO_TYPE               10
 | 
			
		||||
#define ACE_VO_TYPE                12
 | 
			
		||||
#define ADV_SIMPLE_VO_TYPE         17
 | 
			
		||||
 | 
			
		||||
// aspect_ratio_info
 | 
			
		||||
#define EXTENDED_PAR 15
 | 
			
		||||
 | 
			
		||||
//vol_sprite_usage / sprite_enable
 | 
			
		||||
#define STATIC_SPRITE 1
 | 
			
		||||
#define GMC_SPRITE 2
 | 
			
		||||
 | 
			
		||||
#define MOTION_MARKER 0x1F001
 | 
			
		||||
#define DC_MARKER     0x6B001
 | 
			
		||||
 | 
			
		||||
static const int mb_type_b_map[4]= {
 | 
			
		||||
    MB_TYPE_DIRECT2 | MB_TYPE_L0L1,
 | 
			
		||||
    MB_TYPE_L0L1 | MB_TYPE_16x16,
 | 
			
		||||
    MB_TYPE_L1 | MB_TYPE_16x16,
 | 
			
		||||
    MB_TYPE_L0 | MB_TYPE_16x16,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define VOS_STARTCODE        0x1B0
 | 
			
		||||
#define USER_DATA_STARTCODE  0x1B2
 | 
			
		||||
#define GOP_STARTCODE        0x1B3
 | 
			
		||||
#define VISUAL_OBJ_STARTCODE 0x1B5
 | 
			
		||||
#define VOP_STARTCODE        0x1B6
 | 
			
		||||
 | 
			
		||||
/* dc encoding for mpeg4 */
 | 
			
		||||
const uint8_t DCtab_lum[13][2] =
 | 
			
		||||
{
 | 
			
		||||
@@ -143,7 +106,7 @@ const int8_t intra_run[102] = {
 | 
			
		||||
 15, 16, 17, 18, 19, 20,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static RLTable rl_intra = {
 | 
			
		||||
RLTable rl_intra = {
 | 
			
		||||
    102,
 | 
			
		||||
    67,
 | 
			
		||||
    intra_vlc,
 | 
			
		||||
@@ -152,7 +115,7 @@ static RLTable rl_intra = {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/* Note this is identical to the intra rvlc except that it is reordered. */
 | 
			
		||||
static const uint16_t inter_rvlc[170][2]={
 | 
			
		||||
const uint16_t inter_rvlc[170][2]={
 | 
			
		||||
{0x0006,  3},{0x0001,  4},{0x0004,  5},{0x001C,  7},
 | 
			
		||||
{0x003C,  8},{0x003D,  8},{0x007C,  9},{0x00FC, 10},
 | 
			
		||||
{0x00FD, 10},{0x01FC, 11},{0x01FD, 11},{0x03FC, 12},
 | 
			
		||||
@@ -198,7 +161,7 @@ static const uint16_t inter_rvlc[170][2]={
 | 
			
		||||
{0x3F7C, 15},{0x3F7D, 15},{0x0000, 4}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static const int8_t inter_rvlc_run[169]={
 | 
			
		||||
const int8_t inter_rvlc_run[169]={
 | 
			
		||||
 0,  0,  0,  0,  0,  0,  0,  0,
 | 
			
		||||
 0,  0,  0,  0,  0,  0,  0,  0,
 | 
			
		||||
 0,  0,  0,  1,  1,  1,  1,  1,
 | 
			
		||||
@@ -223,7 +186,7 @@ static const int8_t inter_rvlc_run[169]={
 | 
			
		||||
43, 44,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static const int8_t inter_rvlc_level[169]={
 | 
			
		||||
const int8_t inter_rvlc_level[169]={
 | 
			
		||||
 1,  2,  3,  4,  5,  6,  7,  8,
 | 
			
		||||
 9, 10, 11, 12, 13, 14, 15, 16,
 | 
			
		||||
17, 18, 19,  1,  2,  3,  4,  5,
 | 
			
		||||
@@ -248,7 +211,7 @@ static const int8_t inter_rvlc_level[169]={
 | 
			
		||||
 1,  1,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static RLTable rvlc_rl_inter = {
 | 
			
		||||
RLTable rvlc_rl_inter = {
 | 
			
		||||
    169,
 | 
			
		||||
    103,
 | 
			
		||||
    inter_rvlc,
 | 
			
		||||
@@ -256,7 +219,7 @@ static RLTable rvlc_rl_inter = {
 | 
			
		||||
    inter_rvlc_level,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static const uint16_t intra_rvlc[170][2]={
 | 
			
		||||
const uint16_t intra_rvlc[170][2]={
 | 
			
		||||
{0x0006,  3},{0x0007,  3},{0x000A,  4},{0x0009,  5},
 | 
			
		||||
{0x0014,  6},{0x0015,  6},{0x0034,  7},{0x0074,  8},
 | 
			
		||||
{0x0075,  8},{0x00DD,  9},{0x00EC,  9},{0x01EC, 10},
 | 
			
		||||
@@ -302,7 +265,7 @@ static const uint16_t intra_rvlc[170][2]={
 | 
			
		||||
{0x3F7C, 15},{0x3F7D, 15},{0x0000,  4}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static const int8_t intra_rvlc_run[169]={
 | 
			
		||||
const int8_t intra_rvlc_run[169]={
 | 
			
		||||
 0,  0,  0,  0,  0,  0,  0,  0,
 | 
			
		||||
 0,  0,  0,  0,  0,  0,  0,  0,
 | 
			
		||||
 0,  0,  0,  0,  0,  0,  0,  0,
 | 
			
		||||
@@ -327,7 +290,7 @@ static const int8_t intra_rvlc_run[169]={
 | 
			
		||||
43, 44,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static const int8_t intra_rvlc_level[169]={
 | 
			
		||||
const int8_t intra_rvlc_level[169]={
 | 
			
		||||
 1,  2,  3,  4,  5,  6,  7,  8,
 | 
			
		||||
 9, 10, 11, 12, 13, 14, 15, 16,
 | 
			
		||||
17, 18, 19, 20, 21, 22, 23, 24,
 | 
			
		||||
@@ -352,7 +315,7 @@ static const int8_t intra_rvlc_level[169]={
 | 
			
		||||
 1,  1,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static RLTable rvlc_rl_intra = {
 | 
			
		||||
RLTable rvlc_rl_intra = {
 | 
			
		||||
    169,
 | 
			
		||||
    103,
 | 
			
		||||
    intra_rvlc,
 | 
			
		||||
@@ -360,35 +323,16 @@ static RLTable rvlc_rl_intra = {
 | 
			
		||||
    intra_rvlc_level,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static const uint16_t sprite_trajectory_tab[15][2] = {
 | 
			
		||||
const uint16_t sprite_trajectory_tab[15][2] = {
 | 
			
		||||
 {0x00, 2}, {0x02, 3},  {0x03, 3},  {0x04, 3}, {0x05, 3}, {0x06, 3},
 | 
			
		||||
 {0x0E, 4}, {0x1E, 5},  {0x3E, 6},  {0x7E, 7}, {0xFE, 8},
 | 
			
		||||
 {0x1FE, 9},{0x3FE, 10},{0x7FE, 11},{0xFFE, 12},
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static const uint8_t mb_type_b_tab[4][2] = {
 | 
			
		||||
const uint8_t mb_type_b_tab[4][2] = {
 | 
			
		||||
 {1, 1}, {1, 2}, {1, 3}, {1, 4},
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static const AVRational pixel_aspect[16]={
 | 
			
		||||
 {0, 1},
 | 
			
		||||
 {1, 1},
 | 
			
		||||
 {12, 11},
 | 
			
		||||
 {10, 11},
 | 
			
		||||
 {16, 11},
 | 
			
		||||
 {40, 33},
 | 
			
		||||
 {0, 1},
 | 
			
		||||
 {0, 1},
 | 
			
		||||
 {0, 1},
 | 
			
		||||
 {0, 1},
 | 
			
		||||
 {0, 1},
 | 
			
		||||
 {0, 1},
 | 
			
		||||
 {0, 1},
 | 
			
		||||
 {0, 1},
 | 
			
		||||
 {0, 1},
 | 
			
		||||
 {0, 1},
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/* these matrixes will be permuted for the idct */
 | 
			
		||||
const int16_t ff_mpeg4_default_intra_matrix[64] = {
 | 
			
		||||
  8, 17, 18, 19, 21, 23, 25, 27,
 | 
			
		||||
@@ -425,7 +369,7 @@ const uint16_t ff_mpeg4_resync_prefix[8]={
 | 
			
		||||
    0x7F00, 0x7E00, 0x7C00, 0x7800, 0x7000, 0x6000, 0x4000, 0x0000
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static const uint8_t mpeg4_dc_threshold[8]={
 | 
			
		||||
const uint8_t mpeg4_dc_threshold[8]={
 | 
			
		||||
    99, 13, 15, 17, 19, 21, 23, 0
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										72
									
								
								libavcodec/mpeg4video.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										72
									
								
								libavcodec/mpeg4video.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,72 @@
 | 
			
		||||
/*
 | 
			
		||||
 * MPEG4 decoder / encoder common code.
 | 
			
		||||
 * Copyright (c) 2000,2001 Fabrice Bellard
 | 
			
		||||
 * Copyright (c) 2002-2010 Michael Niedermayer <michaelni@gmx.at>
 | 
			
		||||
 *
 | 
			
		||||
 * This file is part of FFmpeg.
 | 
			
		||||
 *
 | 
			
		||||
 * FFmpeg is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
 * License as published by the Free Software Foundation; either
 | 
			
		||||
 * version 2.1 of the License, or (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * FFmpeg is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with FFmpeg; if not, write to the Free Software
 | 
			
		||||
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "mpegvideo.h"
 | 
			
		||||
#include "mpeg4video.h"
 | 
			
		||||
#include "mpeg4data.h"
 | 
			
		||||
 | 
			
		||||
uint8_t ff_mpeg4_static_rl_table_store[3][2][2*MAX_RUN + MAX_LEVEL + 3];
 | 
			
		||||
 | 
			
		||||
int ff_mpeg4_get_video_packet_prefix_length(MpegEncContext *s){
 | 
			
		||||
    switch(s->pict_type){
 | 
			
		||||
        case FF_I_TYPE:
 | 
			
		||||
            return 16;
 | 
			
		||||
        case FF_P_TYPE:
 | 
			
		||||
        case FF_S_TYPE:
 | 
			
		||||
            return s->f_code+15;
 | 
			
		||||
        case FF_B_TYPE:
 | 
			
		||||
            return FFMAX3(s->f_code, s->b_code, 2) + 15;
 | 
			
		||||
        default:
 | 
			
		||||
            return -1;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ff_mpeg4_clean_buffers(MpegEncContext *s)
 | 
			
		||||
{
 | 
			
		||||
    int c_wrap, c_xy, l_wrap, l_xy;
 | 
			
		||||
 | 
			
		||||
    l_wrap= s->b8_stride;
 | 
			
		||||
    l_xy= (2*s->mb_y-1)*l_wrap + s->mb_x*2 - 1;
 | 
			
		||||
    c_wrap= s->mb_stride;
 | 
			
		||||
    c_xy= (s->mb_y-1)*c_wrap + s->mb_x - 1;
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
    /* clean DC */
 | 
			
		||||
    memsetw(s->dc_val[0] + l_xy, 1024, l_wrap*2+1);
 | 
			
		||||
    memsetw(s->dc_val[1] + c_xy, 1024, c_wrap+1);
 | 
			
		||||
    memsetw(s->dc_val[2] + c_xy, 1024, c_wrap+1);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    /* clean AC */
 | 
			
		||||
    memset(s->ac_val[0] + l_xy, 0, (l_wrap*2+1)*16*sizeof(int16_t));
 | 
			
		||||
    memset(s->ac_val[1] + c_xy, 0, (c_wrap  +1)*16*sizeof(int16_t));
 | 
			
		||||
    memset(s->ac_val[2] + c_xy, 0, (c_wrap  +1)*16*sizeof(int16_t));
 | 
			
		||||
 | 
			
		||||
    /* clean MV */
 | 
			
		||||
    // we can't clear the MVs as they might be needed by a b frame
 | 
			
		||||
//    memset(s->motion_val + l_xy, 0, (l_wrap*2+1)*2*sizeof(int16_t));
 | 
			
		||||
//    memset(s->motion_val, 0, 2*sizeof(int16_t)*(2 + s->mb_width*2)*(2 + s->mb_height*2));
 | 
			
		||||
    s->last_mv[0][0][0]=
 | 
			
		||||
    s->last_mv[0][0][1]=
 | 
			
		||||
    s->last_mv[1][0][0]=
 | 
			
		||||
    s->last_mv[1][0][1]= 0;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										197
									
								
								libavcodec/mpeg4video.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										197
									
								
								libavcodec/mpeg4video.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,197 @@
 | 
			
		||||
/*
 | 
			
		||||
 * MPEG4 encoder/decoder internal header.
 | 
			
		||||
 * Copyright (c) 2000,2001 Fabrice Bellard
 | 
			
		||||
 * Copyright (c) 2002-2010 Michael Niedermayer <michaelni@gmx.at>
 | 
			
		||||
 *
 | 
			
		||||
 * This file is part of FFmpeg.
 | 
			
		||||
 *
 | 
			
		||||
 * FFmpeg is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
 * License as published by the Free Software Foundation; either
 | 
			
		||||
 * version 2.1 of the License, or (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * FFmpeg is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with FFmpeg; if not, write to the Free Software
 | 
			
		||||
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef AVCODEC_MPEG4VIDEO_H
 | 
			
		||||
#define AVCODEC_MPEG4VIDEO_H
 | 
			
		||||
 | 
			
		||||
// shapes
 | 
			
		||||
#define RECT_SHAPE       0
 | 
			
		||||
#define BIN_SHAPE        1
 | 
			
		||||
#define BIN_ONLY_SHAPE   2
 | 
			
		||||
#define GRAY_SHAPE       3
 | 
			
		||||
 | 
			
		||||
#define SIMPLE_VO_TYPE             1
 | 
			
		||||
#define CORE_VO_TYPE               3
 | 
			
		||||
#define MAIN_VO_TYPE               4
 | 
			
		||||
#define NBIT_VO_TYPE               5
 | 
			
		||||
#define ARTS_VO_TYPE               10
 | 
			
		||||
#define ACE_VO_TYPE                12
 | 
			
		||||
#define ADV_SIMPLE_VO_TYPE         17
 | 
			
		||||
 | 
			
		||||
// aspect_ratio_info
 | 
			
		||||
#define EXTENDED_PAR 15
 | 
			
		||||
 | 
			
		||||
//vol_sprite_usage / sprite_enable
 | 
			
		||||
#define STATIC_SPRITE 1
 | 
			
		||||
#define GMC_SPRITE 2
 | 
			
		||||
 | 
			
		||||
#define MOTION_MARKER 0x1F001
 | 
			
		||||
#define DC_MARKER     0x6B001
 | 
			
		||||
 | 
			
		||||
#define VOS_STARTCODE        0x1B0
 | 
			
		||||
#define USER_DATA_STARTCODE  0x1B2
 | 
			
		||||
#define GOP_STARTCODE        0x1B3
 | 
			
		||||
#define VISUAL_OBJ_STARTCODE 0x1B5
 | 
			
		||||
#define VOP_STARTCODE        0x1B6
 | 
			
		||||
 | 
			
		||||
/* dc encoding for mpeg4 */
 | 
			
		||||
extern const uint8_t DCtab_lum[13][2];
 | 
			
		||||
extern const uint8_t DCtab_chrom[13][2];
 | 
			
		||||
 | 
			
		||||
extern const uint16_t intra_vlc[103][2];
 | 
			
		||||
extern const int8_t intra_level[102];
 | 
			
		||||
extern const int8_t intra_run[102];
 | 
			
		||||
extern RLTable rl_intra;
 | 
			
		||||
 | 
			
		||||
/* Note this is identical to the intra rvlc except that it is reordered. */
 | 
			
		||||
extern const uint16_t inter_rvlc[170][2];
 | 
			
		||||
extern const int8_t inter_rvlc_run[169];
 | 
			
		||||
extern const int8_t inter_rvlc_level[169];
 | 
			
		||||
extern RLTable rvlc_rl_inter;
 | 
			
		||||
 | 
			
		||||
extern const uint16_t intra_rvlc[170][2];
 | 
			
		||||
extern const int8_t intra_rvlc_run[169];
 | 
			
		||||
extern const int8_t intra_rvlc_level[169];
 | 
			
		||||
extern RLTable rvlc_rl_intra;
 | 
			
		||||
 | 
			
		||||
extern const uint16_t sprite_trajectory_tab[15][2];
 | 
			
		||||
extern const uint8_t mb_type_b_tab[4][2];
 | 
			
		||||
extern const AVRational pixel_aspect[16];
 | 
			
		||||
 | 
			
		||||
/* these matrixes will be permuted for the idct */
 | 
			
		||||
extern const int16_t ff_mpeg4_default_intra_matrix[64];
 | 
			
		||||
extern const int16_t ff_mpeg4_default_non_intra_matrix[64];
 | 
			
		||||
 | 
			
		||||
extern const uint8_t ff_mpeg4_y_dc_scale_table[32];
 | 
			
		||||
extern const uint8_t ff_mpeg4_c_dc_scale_table[32];
 | 
			
		||||
extern const uint16_t ff_mpeg4_resync_prefix[8];
 | 
			
		||||
 | 
			
		||||
extern const uint8_t mpeg4_dc_threshold[8];
 | 
			
		||||
 | 
			
		||||
void mpeg4_encode_mb(MpegEncContext *s,
 | 
			
		||||
                    DCTELEM block[6][64],
 | 
			
		||||
                    int motion_x, int motion_y);
 | 
			
		||||
void mpeg4_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
 | 
			
		||||
                   int dir);
 | 
			
		||||
void ff_set_mpeg4_time(MpegEncContext * s);
 | 
			
		||||
void mpeg4_encode_picture_header(MpegEncContext *s, int picture_number);
 | 
			
		||||
 | 
			
		||||
int ff_mpeg4_decode_picture_header(MpegEncContext * s, GetBitContext *gb);
 | 
			
		||||
void ff_mpeg4_encode_video_packet_header(MpegEncContext *s);
 | 
			
		||||
void ff_mpeg4_clean_buffers(MpegEncContext *s);
 | 
			
		||||
void ff_mpeg4_stuffing(PutBitContext * pbc);
 | 
			
		||||
void ff_mpeg4_init_partitions(MpegEncContext *s);
 | 
			
		||||
void ff_mpeg4_merge_partitions(MpegEncContext *s);
 | 
			
		||||
void ff_clean_mpeg4_qscales(MpegEncContext *s);
 | 
			
		||||
int ff_mpeg4_decode_partitions(MpegEncContext *s);
 | 
			
		||||
int ff_mpeg4_get_video_packet_prefix_length(MpegEncContext *s);
 | 
			
		||||
int mpeg4_decode_video_packet_header(MpegEncContext *s);
 | 
			
		||||
 | 
			
		||||
extern uint8_t ff_mpeg4_static_rl_table_store[3][2][2*MAX_RUN + MAX_LEVEL + 3];
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#if 0 //3IV1 is quite rare and it slows things down a tiny bit
 | 
			
		||||
#define IS_3IV1 s->codec_tag == AV_RL32("3IV1")
 | 
			
		||||
#else
 | 
			
		||||
#define IS_3IV1 0
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * predicts the dc.
 | 
			
		||||
 * encoding quantized level -> quantized diff
 | 
			
		||||
 * decoding quantized diff -> quantized level
 | 
			
		||||
 * @param n block index (0-3 are luma, 4-5 are chroma)
 | 
			
		||||
 * @param dir_ptr pointer to an integer where the prediction direction will be stored
 | 
			
		||||
 */
 | 
			
		||||
static inline int ff_mpeg4_pred_dc(MpegEncContext * s, int n, int level, int *dir_ptr, int encoding)
 | 
			
		||||
{
 | 
			
		||||
    int a, b, c, wrap, pred, scale, ret;
 | 
			
		||||
    int16_t *dc_val;
 | 
			
		||||
 | 
			
		||||
    /* find prediction */
 | 
			
		||||
    if (n < 4) {
 | 
			
		||||
        scale = s->y_dc_scale;
 | 
			
		||||
    } else {
 | 
			
		||||
        scale = s->c_dc_scale;
 | 
			
		||||
    }
 | 
			
		||||
    if(IS_3IV1)
 | 
			
		||||
        scale= 8;
 | 
			
		||||
 | 
			
		||||
    wrap= s->block_wrap[n];
 | 
			
		||||
    dc_val = s->dc_val[0] + s->block_index[n];
 | 
			
		||||
 | 
			
		||||
    /* B C
 | 
			
		||||
     * A X
 | 
			
		||||
     */
 | 
			
		||||
    a = dc_val[ - 1];
 | 
			
		||||
    b = dc_val[ - 1 - wrap];
 | 
			
		||||
    c = dc_val[ - wrap];
 | 
			
		||||
 | 
			
		||||
    /* outside slice handling (we can't do that by memset as we need the dc for error resilience) */
 | 
			
		||||
    if(s->first_slice_line && n!=3){
 | 
			
		||||
        if(n!=2) b=c= 1024;
 | 
			
		||||
        if(n!=1 && s->mb_x == s->resync_mb_x) b=a= 1024;
 | 
			
		||||
    }
 | 
			
		||||
    if(s->mb_x == s->resync_mb_x && s->mb_y == s->resync_mb_y+1){
 | 
			
		||||
        if(n==0 || n==4 || n==5)
 | 
			
		||||
            b=1024;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (abs(a - b) < abs(b - c)) {
 | 
			
		||||
        pred = c;
 | 
			
		||||
        *dir_ptr = 1; /* top */
 | 
			
		||||
    } else {
 | 
			
		||||
        pred = a;
 | 
			
		||||
        *dir_ptr = 0; /* left */
 | 
			
		||||
    }
 | 
			
		||||
    /* we assume pred is positive */
 | 
			
		||||
    pred = FASTDIV((pred + (scale >> 1)), scale);
 | 
			
		||||
 | 
			
		||||
    if(encoding){
 | 
			
		||||
        ret = level - pred;
 | 
			
		||||
    }else{
 | 
			
		||||
        level += pred;
 | 
			
		||||
        ret= level;
 | 
			
		||||
        if(s->error_recognition>=3){
 | 
			
		||||
            if(level<0){
 | 
			
		||||
                av_log(s->avctx, AV_LOG_ERROR, "dc<0 at %dx%d\n", s->mb_x, s->mb_y);
 | 
			
		||||
                return -1;
 | 
			
		||||
            }
 | 
			
		||||
            if(level*scale > 2048 + scale){
 | 
			
		||||
                av_log(s->avctx, AV_LOG_ERROR, "dc overflow at %dx%d\n", s->mb_x, s->mb_y);
 | 
			
		||||
                return -1;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    level *=scale;
 | 
			
		||||
    if(level&(~2047)){
 | 
			
		||||
        if(level<0)
 | 
			
		||||
            level=0;
 | 
			
		||||
        else if(!(s->workaround_bugs&FF_BUG_DC_CLIP))
 | 
			
		||||
            level=2047;
 | 
			
		||||
    }
 | 
			
		||||
    dc_val[0]= level;
 | 
			
		||||
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										2262
									
								
								libavcodec/mpeg4videodec.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2262
									
								
								libavcodec/mpeg4videodec.c
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1351
									
								
								libavcodec/mpeg4videoenc.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1351
									
								
								libavcodec/mpeg4videoenc.c
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -782,11 +782,7 @@ void ff_mpeg1_encode_slice_header(MpegEncContext *s);
 | 
			
		||||
void ff_mpeg1_clean_buffers(MpegEncContext *s);
 | 
			
		||||
int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size, AVCodecParserContext *s);
 | 
			
		||||
 | 
			
		||||
extern const uint8_t ff_mpeg4_y_dc_scale_table[32];
 | 
			
		||||
extern const uint8_t ff_mpeg4_c_dc_scale_table[32];
 | 
			
		||||
extern const uint8_t ff_aic_dc_scale_table[32];
 | 
			
		||||
extern const int16_t ff_mpeg4_default_intra_matrix[64];
 | 
			
		||||
extern const int16_t ff_mpeg4_default_non_intra_matrix[64];
 | 
			
		||||
extern const uint8_t ff_h263_chroma_qscale_table[32];
 | 
			
		||||
extern const uint8_t ff_h263_loop_filter_strength[32];
 | 
			
		||||
 | 
			
		||||
@@ -810,22 +806,14 @@ int ff_h263_decode_end(AVCodecContext *avctx);
 | 
			
		||||
void h263_encode_mb(MpegEncContext *s,
 | 
			
		||||
                    DCTELEM block[6][64],
 | 
			
		||||
                    int motion_x, int motion_y);
 | 
			
		||||
void mpeg4_encode_mb(MpegEncContext *s,
 | 
			
		||||
                    DCTELEM block[6][64],
 | 
			
		||||
                    int motion_x, int motion_y);
 | 
			
		||||
void h263_encode_picture_header(MpegEncContext *s, int picture_number);
 | 
			
		||||
void h263_encode_gob_header(MpegEncContext * s, int mb_line);
 | 
			
		||||
int16_t *h263_pred_motion(MpegEncContext * s, int block, int dir,
 | 
			
		||||
                        int *px, int *py);
 | 
			
		||||
void mpeg4_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
 | 
			
		||||
                   int dir);
 | 
			
		||||
void ff_set_mpeg4_time(MpegEncContext * s);
 | 
			
		||||
void mpeg4_encode_picture_header(MpegEncContext *s, int picture_number);
 | 
			
		||||
void h263_encode_init(MpegEncContext *s);
 | 
			
		||||
void h263_decode_init_vlc(MpegEncContext *s);
 | 
			
		||||
int h263_decode_picture_header(MpegEncContext *s);
 | 
			
		||||
int ff_h263_decode_gob_header(MpegEncContext *s);
 | 
			
		||||
int ff_mpeg4_decode_picture_header(MpegEncContext * s, GetBitContext *gb);
 | 
			
		||||
void ff_h263_update_motion_val(MpegEncContext * s);
 | 
			
		||||
void ff_h263_loop_filter(MpegEncContext * s);
 | 
			
		||||
void ff_set_qscale(MpegEncContext * s, int qscale);
 | 
			
		||||
@@ -840,8 +828,6 @@ void ff_h263_show_pict_info(MpegEncContext *s);
 | 
			
		||||
int ff_intel_h263_decode_picture_header(MpegEncContext *s);
 | 
			
		||||
int ff_h263_decode_mb(MpegEncContext *s,
 | 
			
		||||
                      DCTELEM block[6][64]);
 | 
			
		||||
int ff_mpeg4_decode_mb(MpegEncContext *s,
 | 
			
		||||
                      DCTELEM block[6][64]);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Returns the value of the 3bit "source format" syntax element.
 | 
			
		||||
@@ -850,15 +836,7 @@ int ff_mpeg4_decode_mb(MpegEncContext *s,
 | 
			
		||||
 */
 | 
			
		||||
int av_const h263_get_picture_format(int width, int height);
 | 
			
		||||
 | 
			
		||||
void ff_mpeg4_encode_video_packet_header(MpegEncContext *s);
 | 
			
		||||
void ff_mpeg4_clean_buffers(MpegEncContext *s);
 | 
			
		||||
void ff_mpeg4_stuffing(PutBitContext * pbc);
 | 
			
		||||
void ff_mpeg4_init_partitions(MpegEncContext *s);
 | 
			
		||||
void ff_mpeg4_merge_partitions(MpegEncContext *s);
 | 
			
		||||
void ff_clean_mpeg4_qscales(MpegEncContext *s);
 | 
			
		||||
void ff_clean_h263_qscales(MpegEncContext *s);
 | 
			
		||||
int ff_mpeg4_decode_partitions(MpegEncContext *s);
 | 
			
		||||
int ff_mpeg4_get_video_packet_prefix_length(MpegEncContext *s);
 | 
			
		||||
int ff_h263_resync(MpegEncContext *s);
 | 
			
		||||
const uint8_t *ff_h263_find_resync_marker(const uint8_t *p, const uint8_t *end);
 | 
			
		||||
int ff_h263_get_gob_height(MpegEncContext *s);
 | 
			
		||||
 
 | 
			
		||||
@@ -36,6 +36,7 @@
 | 
			
		||||
#include "faandct.h"
 | 
			
		||||
#include "aandcttab.h"
 | 
			
		||||
#include "flv.h"
 | 
			
		||||
#include "mpeg4video.h"
 | 
			
		||||
#include <limits.h>
 | 
			
		||||
 | 
			
		||||
//#undef NDEBUG
 | 
			
		||||
@@ -3781,19 +3782,6 @@ AVCodec h263p_encoder = {
 | 
			
		||||
    .long_name= NULL_IF_CONFIG_SMALL("H.263+ / H.263-1998 / H.263 version 2"),
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
AVCodec mpeg4_encoder = {
 | 
			
		||||
    "mpeg4",
 | 
			
		||||
    CODEC_TYPE_VIDEO,
 | 
			
		||||
    CODEC_ID_MPEG4,
 | 
			
		||||
    sizeof(MpegEncContext),
 | 
			
		||||
    MPV_encode_init,
 | 
			
		||||
    MPV_encode_picture,
 | 
			
		||||
    MPV_encode_end,
 | 
			
		||||
    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
 | 
			
		||||
    .capabilities= CODEC_CAP_DELAY,
 | 
			
		||||
    .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2"),
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
AVCodec msmpeg4v1_encoder = {
 | 
			
		||||
    "msmpeg4v1",
 | 
			
		||||
    CODEC_TYPE_VIDEO,
 | 
			
		||||
 
 | 
			
		||||
@@ -32,6 +32,8 @@
 | 
			
		||||
#include "mpegvideo.h"
 | 
			
		||||
#include "msmpeg4.h"
 | 
			
		||||
#include "libavutil/x86_cpu.h"
 | 
			
		||||
#include "h263.h"
 | 
			
		||||
#include "mpeg4video.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * You can also call this codec : MPEG4 with a twist !
 | 
			
		||||
@@ -43,7 +45,6 @@
 | 
			
		||||
//#define DEBUG
 | 
			
		||||
 | 
			
		||||
#define DC_VLC_BITS 9
 | 
			
		||||
#define CBPY_VLC_BITS 6
 | 
			
		||||
#define V1_INTRA_CBPC_VLC_BITS 6
 | 
			
		||||
#define V1_INTER_CBPC_VLC_BITS 6
 | 
			
		||||
#define V2_INTRA_CBPC_VLC_BITS 3
 | 
			
		||||
@@ -1059,7 +1060,6 @@ else
 | 
			
		||||
VLC ff_mb_non_intra_vlc[4];
 | 
			
		||||
static VLC v2_dc_lum_vlc;
 | 
			
		||||
static VLC v2_dc_chroma_vlc;
 | 
			
		||||
static VLC cbpy_vlc;
 | 
			
		||||
static VLC v2_intra_cbpc_vlc;
 | 
			
		||||
static VLC v2_mb_type_vlc;
 | 
			
		||||
static VLC v2_mv_vlc;
 | 
			
		||||
 
 | 
			
		||||
@@ -52,19 +52,6 @@ extern VLC ff_msmp4_dc_chroma_vlc[2];
 | 
			
		||||
/* intra picture macroblock coded block pattern */
 | 
			
		||||
extern const uint16_t ff_msmp4_mb_i_table[64][2];
 | 
			
		||||
 | 
			
		||||
extern const uint8_t cbpy_tab[16][2];
 | 
			
		||||
 | 
			
		||||
extern const uint8_t DCtab_lum[13][2];
 | 
			
		||||
extern const uint8_t DCtab_chrom[13][2];
 | 
			
		||||
 | 
			
		||||
extern const uint8_t mvtab[33][2];
 | 
			
		||||
 | 
			
		||||
extern const uint8_t intra_MCBPC_code[9];
 | 
			
		||||
extern const uint8_t intra_MCBPC_bits[9];
 | 
			
		||||
 | 
			
		||||
extern const uint8_t inter_MCBPC_code[28];
 | 
			
		||||
extern const uint8_t inter_MCBPC_bits[28];
 | 
			
		||||
 | 
			
		||||
#define WMV1_SCANTABLE_COUNT 4
 | 
			
		||||
 | 
			
		||||
extern const uint8_t wmv1_scantable[WMV1_SCANTABLE_COUNT][64];
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user