mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
H264 decoder & demuxer
Originally committed as revision 1732 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
6aafe463e5
commit
0da71265d8
2
ffmpeg.c
2
ffmpeg.c
@ -2008,7 +2008,7 @@ static void opt_input_file(const char *filename)
|
||||
enc->debug= debug;
|
||||
/* if(enc->codec->capabilities & CODEC_CAP_TRUNCATED)
|
||||
enc->flags|= CODEC_FLAG_TRUNCATED; */
|
||||
if(/*enc->codec_id==CODEC_ID_MPEG4 || */enc->codec_id==CODEC_ID_MPEG1VIDEO)
|
||||
if(/*enc->codec_id==CODEC_ID_MPEG4 || */enc->codec_id==CODEC_ID_MPEG1VIDEO || enc->codec_id==CODEC_ID_H264)
|
||||
enc->flags|= CODEC_FLAG_TRUNCATED;
|
||||
|
||||
if(bitexact)
|
||||
|
@ -16,7 +16,7 @@ OBJS= common.o utils.o mem.o allcodecs.o \
|
||||
motion_est.o imgconvert.o imgresample.o \
|
||||
mpeg12.o mpegaudiodec.o pcm.o simple_idct.o \
|
||||
ratecontrol.o adpcm.o eval.o dv.o error_resilience.o \
|
||||
fft.o mdct.o mace.o huffyuv.o cyuv.o opts.o raw.o
|
||||
fft.o mdct.o mace.o huffyuv.o cyuv.o opts.o raw.o h264.o golomb.o
|
||||
ASM_OBJS=
|
||||
|
||||
# codecs which are patented in some non free countries like the us
|
||||
|
@ -50,6 +50,7 @@ void avcodec_register_all(void)
|
||||
register_avcodec(&oggvorbis_decoder);
|
||||
#endif
|
||||
register_avcodec(&mpeg1video_encoder);
|
||||
// register_avcodec(&h264_encoder);
|
||||
#ifdef CONFIG_RISKY
|
||||
register_avcodec(&h263_encoder);
|
||||
register_avcodec(&h263p_encoder);
|
||||
@ -93,6 +94,7 @@ void avcodec_register_all(void)
|
||||
register_avcodec(&mace6_decoder);
|
||||
register_avcodec(&huffyuv_decoder);
|
||||
register_avcodec(&cyuv_decoder);
|
||||
register_avcodec(&h264_decoder);
|
||||
#ifdef CONFIG_AC3
|
||||
register_avcodec(&ac3_decoder);
|
||||
#endif
|
||||
|
@ -49,6 +49,7 @@ enum CodecID {
|
||||
CODEC_ID_MACE6,
|
||||
CODEC_ID_HUFFYUV,
|
||||
CODEC_ID_CYUV,
|
||||
CODEC_ID_H264,
|
||||
|
||||
/* various pcm "codecs" */
|
||||
CODEC_ID_PCM_S16LE,
|
||||
@ -210,7 +211,7 @@ static const int Motion_Est_QTab[] = { ME_ZERO, ME_PHODS, ME_LOG,
|
||||
int key_frame;\
|
||||
\
|
||||
/**\
|
||||
* picture type of the frame, see ?_TYPE below\
|
||||
* picture type of the frame, see ?_TYPE below.\
|
||||
* - encoding: set by lavc for coded_picture (and set by user for input)\
|
||||
* - decoding: set by lavc\
|
||||
*/\
|
||||
@ -320,7 +321,12 @@ static const int Motion_Est_QTab[] = { ME_ZERO, ME_PHODS, ME_LOG,
|
||||
#define FF_P_TYPE 2 // Predicted
|
||||
#define FF_B_TYPE 3 // Bi-dir predicted
|
||||
#define FF_S_TYPE 4 // S(GMC)-VOP MPEG4
|
||||
#define FF_SI_TYPE 5
|
||||
#define FF_SP_TYPE 6
|
||||
|
||||
/**
|
||||
* Audio Video Frame.
|
||||
*/
|
||||
typedef struct AVFrame {
|
||||
FF_COMMON_FRAME
|
||||
} AVFrame;
|
||||
@ -906,6 +912,7 @@ typedef struct AVCodecContext {
|
||||
#define FF_DEBUG_STARTCODE 0x00000100
|
||||
#define FF_DEBUG_PTS 0x00000200
|
||||
#define FF_DEBUG_ER 0x00000400
|
||||
#define FF_DEBUG_MMCO 0x00000800
|
||||
|
||||
/**
|
||||
* error.
|
||||
@ -1149,6 +1156,7 @@ extern AVCodec msmpeg4v3_encoder;
|
||||
extern AVCodec wmv1_encoder;
|
||||
extern AVCodec wmv2_encoder;
|
||||
extern AVCodec huffyuv_encoder;
|
||||
extern AVCodec h264_encoder;
|
||||
|
||||
extern AVCodec h263_decoder;
|
||||
extern AVCodec mpeg4_decoder;
|
||||
@ -1174,6 +1182,7 @@ extern AVCodec mace6_decoder;
|
||||
extern AVCodec huffyuv_decoder;
|
||||
extern AVCodec oggvorbis_decoder;
|
||||
extern AVCodec cyuv_decoder;
|
||||
extern AVCodec h264_decoder;
|
||||
|
||||
/* pcm codecs */
|
||||
#define PCM_CODEC(id, name) \
|
||||
|
@ -466,6 +466,14 @@ CALL_2X_PIXELS(OPNAME ## _no_rnd_pixels16_xy2_c, OPNAME ## _no_rnd_pixels_xy2_c,
|
||||
#else // 64 bit variant
|
||||
|
||||
#define PIXOP2(OPNAME, OP) \
|
||||
static void OPNAME ## _pixels4_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
|
||||
int i;\
|
||||
for(i=0; i<h; i++){\
|
||||
OP(*((uint32_t*)(block )), LD32(pixels ));\
|
||||
pixels+=line_size;\
|
||||
block +=line_size;\
|
||||
}\
|
||||
}\
|
||||
static void OPNAME ## _pixels8_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
|
||||
int i;\
|
||||
for(i=0; i<h; i++){\
|
||||
@ -507,6 +515,17 @@ static inline void OPNAME ## _pixels8_l2(uint8_t *dst, const uint8_t *src1, cons
|
||||
}\
|
||||
}\
|
||||
\
|
||||
static inline void OPNAME ## _pixels4_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, \
|
||||
int src_stride1, int src_stride2, int h){\
|
||||
int i;\
|
||||
for(i=0; i<h; i++){\
|
||||
uint32_t a,b;\
|
||||
a= LD32(&src1[i*src_stride1 ]);\
|
||||
b= LD32(&src2[i*src_stride2 ]);\
|
||||
OP(*((uint32_t*)&dst[i*dst_stride ]), (a|b) - (((a^b)&0xFEFEFEFEUL)>>1));\
|
||||
}\
|
||||
}\
|
||||
\
|
||||
static inline void OPNAME ## _pixels16_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, \
|
||||
int src_stride1, int src_stride2, int h){\
|
||||
OPNAME ## _pixels8_l2(dst , src1 , src2 , dst_stride, src_stride1, src_stride2, h);\
|
||||
@ -800,6 +819,113 @@ static void gmc_c(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy,
|
||||
oy += dyy;
|
||||
}
|
||||
}
|
||||
#define H264_CHROMA_MC(OPNAME, OP)\
|
||||
static void OPNAME ## h264_chroma_mc2_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){\
|
||||
const int A=(8-x)*(8-y);\
|
||||
const int B=( x)*(8-y);\
|
||||
const int C=(8-x)*( y);\
|
||||
const int D=( x)*( y);\
|
||||
int i;\
|
||||
\
|
||||
assert(x<8 && y<8 && x>=0 && y>=0);\
|
||||
\
|
||||
for(i=0; i<h; i++)\
|
||||
{\
|
||||
OP(dst[0], (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1]));\
|
||||
OP(dst[1], (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2]));\
|
||||
dst+= stride;\
|
||||
src+= stride;\
|
||||
}\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## h264_chroma_mc4_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){\
|
||||
const int A=(8-x)*(8-y);\
|
||||
const int B=( x)*(8-y);\
|
||||
const int C=(8-x)*( y);\
|
||||
const int D=( x)*( y);\
|
||||
int i;\
|
||||
\
|
||||
assert(x<8 && y<8 && x>=0 && y>=0);\
|
||||
\
|
||||
for(i=0; i<h; i++)\
|
||||
{\
|
||||
OP(dst[0], (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1]));\
|
||||
OP(dst[1], (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2]));\
|
||||
OP(dst[2], (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3]));\
|
||||
OP(dst[3], (A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4]));\
|
||||
dst+= stride;\
|
||||
src+= stride;\
|
||||
}\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## h264_chroma_mc8_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){\
|
||||
const int A=(8-x)*(8-y);\
|
||||
const int B=( x)*(8-y);\
|
||||
const int C=(8-x)*( y);\
|
||||
const int D=( x)*( y);\
|
||||
int i;\
|
||||
\
|
||||
assert(x<8 && y<8 && x>=0 && y>=0);\
|
||||
\
|
||||
for(i=0; i<h; i++)\
|
||||
{\
|
||||
OP(dst[0], (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1]));\
|
||||
OP(dst[1], (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2]));\
|
||||
OP(dst[2], (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3]));\
|
||||
OP(dst[3], (A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4]));\
|
||||
OP(dst[4], (A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5]));\
|
||||
OP(dst[5], (A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6]));\
|
||||
OP(dst[6], (A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7]));\
|
||||
OP(dst[7], (A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8]));\
|
||||
dst+= stride;\
|
||||
src+= stride;\
|
||||
}\
|
||||
}
|
||||
|
||||
#define op_avg(a, b) a = (((a)+(((b) + 32)>>6)+1)>>1)
|
||||
#define op_put(a, b) a = (((b) + 32)>>6)
|
||||
|
||||
H264_CHROMA_MC(put_ , op_put)
|
||||
H264_CHROMA_MC(avg_ , op_avg)
|
||||
#undef op_avg
|
||||
#undef op_put
|
||||
|
||||
static inline void copy_block4(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h)
|
||||
{
|
||||
int i;
|
||||
for(i=0; i<h; i++)
|
||||
{
|
||||
ST32(dst , LD32(src ));
|
||||
dst+=dstStride;
|
||||
src+=srcStride;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void copy_block8(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h)
|
||||
{
|
||||
int i;
|
||||
for(i=0; i<h; i++)
|
||||
{
|
||||
ST32(dst , LD32(src ));
|
||||
ST32(dst+4 , LD32(src+4 ));
|
||||
dst+=dstStride;
|
||||
src+=srcStride;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void copy_block16(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h)
|
||||
{
|
||||
int i;
|
||||
for(i=0; i<h; i++)
|
||||
{
|
||||
ST32(dst , LD32(src ));
|
||||
ST32(dst+4 , LD32(src+4 ));
|
||||
ST32(dst+8 , LD32(src+8 ));
|
||||
ST32(dst+12, LD32(src+12));
|
||||
dst+=dstStride;
|
||||
src+=srcStride;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void copy_block17(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h)
|
||||
{
|
||||
@ -1327,6 +1453,368 @@ QPEL_MC(0, avg_ , _ , op_avg)
|
||||
#undef op_put
|
||||
#undef op_put_no_rnd
|
||||
|
||||
#if 1
|
||||
#define H264_LOWPASS(OPNAME, OP, OP2) \
|
||||
static void OPNAME ## h264_qpel4_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
|
||||
const int h=4;\
|
||||
uint8_t *cm = cropTbl + MAX_NEG_CROP;\
|
||||
int i;\
|
||||
for(i=0; i<h; i++)\
|
||||
{\
|
||||
OP(dst[0], (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3]));\
|
||||
OP(dst[1], (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4]));\
|
||||
OP(dst[2], (src[2]+src[3])*20 - (src[1 ]+src[4])*5 + (src[0 ]+src[5]));\
|
||||
OP(dst[3], (src[3]+src[4])*20 - (src[2 ]+src[5])*5 + (src[1 ]+src[6]));\
|
||||
dst+=dstStride;\
|
||||
src+=srcStride;\
|
||||
}\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## h264_qpel4_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
|
||||
const int w=4;\
|
||||
uint8_t *cm = cropTbl + MAX_NEG_CROP;\
|
||||
int i;\
|
||||
for(i=0; i<w; i++)\
|
||||
{\
|
||||
const int srcB= src[-2*srcStride];\
|
||||
const int srcA= src[-1*srcStride];\
|
||||
const int src0= src[0 *srcStride];\
|
||||
const int src1= src[1 *srcStride];\
|
||||
const int src2= src[2 *srcStride];\
|
||||
const int src3= src[3 *srcStride];\
|
||||
const int src4= src[4 *srcStride];\
|
||||
const int src5= src[5 *srcStride];\
|
||||
const int src6= src[6 *srcStride];\
|
||||
OP(dst[0*dstStride], (src0+src1)*20 - (srcA+src2)*5 + (srcB+src3));\
|
||||
OP(dst[1*dstStride], (src1+src2)*20 - (src0+src3)*5 + (srcA+src4));\
|
||||
OP(dst[2*dstStride], (src2+src3)*20 - (src1+src4)*5 + (src0+src5));\
|
||||
OP(dst[3*dstStride], (src3+src4)*20 - (src2+src5)*5 + (src1+src6));\
|
||||
dst++;\
|
||||
src++;\
|
||||
}\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## h264_qpel4_hv_lowpass(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
|
||||
const int h=4;\
|
||||
const int w=4;\
|
||||
uint8_t *cm = cropTbl + MAX_NEG_CROP;\
|
||||
int i;\
|
||||
src -= 2*srcStride;\
|
||||
for(i=0; i<h+5; i++)\
|
||||
{\
|
||||
tmp[0]= (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3]);\
|
||||
tmp[1]= (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4]);\
|
||||
tmp[2]= (src[2]+src[3])*20 - (src[1 ]+src[4])*5 + (src[0 ]+src[5]);\
|
||||
tmp[3]= (src[3]+src[4])*20 - (src[2 ]+src[5])*5 + (src[1 ]+src[6]);\
|
||||
tmp+=tmpStride;\
|
||||
src+=srcStride;\
|
||||
}\
|
||||
tmp -= tmpStride*(h+5-2);\
|
||||
for(i=0; i<w; i++)\
|
||||
{\
|
||||
const int tmpB= tmp[-2*tmpStride];\
|
||||
const int tmpA= tmp[-1*tmpStride];\
|
||||
const int tmp0= tmp[0 *tmpStride];\
|
||||
const int tmp1= tmp[1 *tmpStride];\
|
||||
const int tmp2= tmp[2 *tmpStride];\
|
||||
const int tmp3= tmp[3 *tmpStride];\
|
||||
const int tmp4= tmp[4 *tmpStride];\
|
||||
const int tmp5= tmp[5 *tmpStride];\
|
||||
const int tmp6= tmp[6 *tmpStride];\
|
||||
OP2(dst[0*dstStride], (tmp0+tmp1)*20 - (tmpA+tmp2)*5 + (tmpB+tmp3));\
|
||||
OP2(dst[1*dstStride], (tmp1+tmp2)*20 - (tmp0+tmp3)*5 + (tmpA+tmp4));\
|
||||
OP2(dst[2*dstStride], (tmp2+tmp3)*20 - (tmp1+tmp4)*5 + (tmp0+tmp5));\
|
||||
OP2(dst[3*dstStride], (tmp3+tmp4)*20 - (tmp2+tmp5)*5 + (tmp1+tmp6));\
|
||||
dst++;\
|
||||
tmp++;\
|
||||
}\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## h264_qpel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
|
||||
const int h=8;\
|
||||
uint8_t *cm = cropTbl + MAX_NEG_CROP;\
|
||||
int i;\
|
||||
for(i=0; i<h; i++)\
|
||||
{\
|
||||
OP(dst[0], (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3 ]));\
|
||||
OP(dst[1], (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4 ]));\
|
||||
OP(dst[2], (src[2]+src[3])*20 - (src[1 ]+src[4])*5 + (src[0 ]+src[5 ]));\
|
||||
OP(dst[3], (src[3]+src[4])*20 - (src[2 ]+src[5])*5 + (src[1 ]+src[6 ]));\
|
||||
OP(dst[4], (src[4]+src[5])*20 - (src[3 ]+src[6])*5 + (src[2 ]+src[7 ]));\
|
||||
OP(dst[5], (src[5]+src[6])*20 - (src[4 ]+src[7])*5 + (src[3 ]+src[8 ]));\
|
||||
OP(dst[6], (src[6]+src[7])*20 - (src[5 ]+src[8])*5 + (src[4 ]+src[9 ]));\
|
||||
OP(dst[7], (src[7]+src[8])*20 - (src[6 ]+src[9])*5 + (src[5 ]+src[10]));\
|
||||
dst+=dstStride;\
|
||||
src+=srcStride;\
|
||||
}\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## h264_qpel8_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
|
||||
const int w=8;\
|
||||
uint8_t *cm = cropTbl + MAX_NEG_CROP;\
|
||||
int i;\
|
||||
for(i=0; i<w; i++)\
|
||||
{\
|
||||
const int srcB= src[-2*srcStride];\
|
||||
const int srcA= src[-1*srcStride];\
|
||||
const int src0= src[0 *srcStride];\
|
||||
const int src1= src[1 *srcStride];\
|
||||
const int src2= src[2 *srcStride];\
|
||||
const int src3= src[3 *srcStride];\
|
||||
const int src4= src[4 *srcStride];\
|
||||
const int src5= src[5 *srcStride];\
|
||||
const int src6= src[6 *srcStride];\
|
||||
const int src7= src[7 *srcStride];\
|
||||
const int src8= src[8 *srcStride];\
|
||||
const int src9= src[9 *srcStride];\
|
||||
const int src10=src[10*srcStride];\
|
||||
OP(dst[0*dstStride], (src0+src1)*20 - (srcA+src2)*5 + (srcB+src3));\
|
||||
OP(dst[1*dstStride], (src1+src2)*20 - (src0+src3)*5 + (srcA+src4));\
|
||||
OP(dst[2*dstStride], (src2+src3)*20 - (src1+src4)*5 + (src0+src5));\
|
||||
OP(dst[3*dstStride], (src3+src4)*20 - (src2+src5)*5 + (src1+src6));\
|
||||
OP(dst[4*dstStride], (src4+src5)*20 - (src3+src6)*5 + (src2+src7));\
|
||||
OP(dst[5*dstStride], (src5+src6)*20 - (src4+src7)*5 + (src3+src8));\
|
||||
OP(dst[6*dstStride], (src6+src7)*20 - (src5+src8)*5 + (src4+src9));\
|
||||
OP(dst[7*dstStride], (src7+src8)*20 - (src6+src9)*5 + (src5+src10));\
|
||||
dst++;\
|
||||
src++;\
|
||||
}\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## h264_qpel8_hv_lowpass(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
|
||||
const int h=8;\
|
||||
const int w=8;\
|
||||
uint8_t *cm = cropTbl + MAX_NEG_CROP;\
|
||||
int i;\
|
||||
src -= 2*srcStride;\
|
||||
for(i=0; i<h+5; i++)\
|
||||
{\
|
||||
tmp[0]= (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3 ]);\
|
||||
tmp[1]= (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4 ]);\
|
||||
tmp[2]= (src[2]+src[3])*20 - (src[1 ]+src[4])*5 + (src[0 ]+src[5 ]);\
|
||||
tmp[3]= (src[3]+src[4])*20 - (src[2 ]+src[5])*5 + (src[1 ]+src[6 ]);\
|
||||
tmp[4]= (src[4]+src[5])*20 - (src[3 ]+src[6])*5 + (src[2 ]+src[7 ]);\
|
||||
tmp[5]= (src[5]+src[6])*20 - (src[4 ]+src[7])*5 + (src[3 ]+src[8 ]);\
|
||||
tmp[6]= (src[6]+src[7])*20 - (src[5 ]+src[8])*5 + (src[4 ]+src[9 ]);\
|
||||
tmp[7]= (src[7]+src[8])*20 - (src[6 ]+src[9])*5 + (src[5 ]+src[10]);\
|
||||
tmp+=tmpStride;\
|
||||
src+=srcStride;\
|
||||
}\
|
||||
tmp -= tmpStride*(h+5-2);\
|
||||
for(i=0; i<w; i++)\
|
||||
{\
|
||||
const int tmpB= tmp[-2*tmpStride];\
|
||||
const int tmpA= tmp[-1*tmpStride];\
|
||||
const int tmp0= tmp[0 *tmpStride];\
|
||||
const int tmp1= tmp[1 *tmpStride];\
|
||||
const int tmp2= tmp[2 *tmpStride];\
|
||||
const int tmp3= tmp[3 *tmpStride];\
|
||||
const int tmp4= tmp[4 *tmpStride];\
|
||||
const int tmp5= tmp[5 *tmpStride];\
|
||||
const int tmp6= tmp[6 *tmpStride];\
|
||||
const int tmp7= tmp[7 *tmpStride];\
|
||||
const int tmp8= tmp[8 *tmpStride];\
|
||||
const int tmp9= tmp[9 *tmpStride];\
|
||||
const int tmp10=tmp[10*tmpStride];\
|
||||
OP2(dst[0*dstStride], (tmp0+tmp1)*20 - (tmpA+tmp2)*5 + (tmpB+tmp3));\
|
||||
OP2(dst[1*dstStride], (tmp1+tmp2)*20 - (tmp0+tmp3)*5 + (tmpA+tmp4));\
|
||||
OP2(dst[2*dstStride], (tmp2+tmp3)*20 - (tmp1+tmp4)*5 + (tmp0+tmp5));\
|
||||
OP2(dst[3*dstStride], (tmp3+tmp4)*20 - (tmp2+tmp5)*5 + (tmp1+tmp6));\
|
||||
OP2(dst[4*dstStride], (tmp4+tmp5)*20 - (tmp3+tmp6)*5 + (tmp2+tmp7));\
|
||||
OP2(dst[5*dstStride], (tmp5+tmp6)*20 - (tmp4+tmp7)*5 + (tmp3+tmp8));\
|
||||
OP2(dst[6*dstStride], (tmp6+tmp7)*20 - (tmp5+tmp8)*5 + (tmp4+tmp9));\
|
||||
OP2(dst[7*dstStride], (tmp7+tmp8)*20 - (tmp6+tmp9)*5 + (tmp5+tmp10));\
|
||||
dst++;\
|
||||
tmp++;\
|
||||
}\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## h264_qpel16_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
|
||||
OPNAME ## h264_qpel8_v_lowpass(dst , src , dstStride, srcStride);\
|
||||
OPNAME ## h264_qpel8_v_lowpass(dst+8, src+8, dstStride, srcStride);\
|
||||
src += 8*srcStride;\
|
||||
dst += 8*dstStride;\
|
||||
OPNAME ## h264_qpel8_v_lowpass(dst , src , dstStride, srcStride);\
|
||||
OPNAME ## h264_qpel8_v_lowpass(dst+8, src+8, dstStride, srcStride);\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## h264_qpel16_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
|
||||
OPNAME ## h264_qpel8_h_lowpass(dst , src , dstStride, srcStride);\
|
||||
OPNAME ## h264_qpel8_h_lowpass(dst+8, src+8, dstStride, srcStride);\
|
||||
src += 8*srcStride;\
|
||||
dst += 8*dstStride;\
|
||||
OPNAME ## h264_qpel8_h_lowpass(dst , src , dstStride, srcStride);\
|
||||
OPNAME ## h264_qpel8_h_lowpass(dst+8, src+8, dstStride, srcStride);\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## h264_qpel16_hv_lowpass(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
|
||||
OPNAME ## h264_qpel8_hv_lowpass(dst , tmp , src , dstStride, tmpStride, srcStride);\
|
||||
OPNAME ## h264_qpel8_hv_lowpass(dst+8, tmp+8, src+8, dstStride, tmpStride, srcStride);\
|
||||
src += 8*srcStride;\
|
||||
tmp += 8*tmpStride;\
|
||||
dst += 8*dstStride;\
|
||||
OPNAME ## h264_qpel8_hv_lowpass(dst , tmp , src , dstStride, tmpStride, srcStride);\
|
||||
OPNAME ## h264_qpel8_hv_lowpass(dst+8, tmp+8, src+8, dstStride, tmpStride, srcStride);\
|
||||
}\
|
||||
|
||||
#define H264_MC(OPNAME, SIZE) \
|
||||
static void OPNAME ## h264_qpel ## SIZE ## _mc00_c (uint8_t *dst, uint8_t *src, int stride){\
|
||||
OPNAME ## pixels ## SIZE ## _c(dst, src, stride, SIZE);\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## h264_qpel ## SIZE ## _mc10_c(uint8_t *dst, uint8_t *src, int stride){\
|
||||
uint8_t half[SIZE*SIZE];\
|
||||
put_h264_qpel ## SIZE ## _h_lowpass(half, src, SIZE, stride);\
|
||||
OPNAME ## pixels ## SIZE ## _l2(dst, src, half, stride, stride, SIZE, SIZE);\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## h264_qpel ## SIZE ## _mc20_c(uint8_t *dst, uint8_t *src, int stride){\
|
||||
OPNAME ## h264_qpel ## SIZE ## _h_lowpass(dst, src, stride, stride);\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## h264_qpel ## SIZE ## _mc30_c(uint8_t *dst, uint8_t *src, int stride){\
|
||||
uint8_t half[SIZE*SIZE];\
|
||||
put_h264_qpel ## SIZE ## _h_lowpass(half, src, SIZE, stride);\
|
||||
OPNAME ## pixels ## SIZE ## _l2(dst, src+1, half, stride, stride, SIZE, SIZE);\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## h264_qpel ## SIZE ## _mc01_c(uint8_t *dst, uint8_t *src, int stride){\
|
||||
uint8_t full[SIZE*(SIZE+5)];\
|
||||
uint8_t * const full_mid= full + SIZE*2;\
|
||||
uint8_t half[SIZE*SIZE];\
|
||||
copy_block ## SIZE (full, src - stride*2, SIZE, stride, SIZE + 5);\
|
||||
put_h264_qpel ## SIZE ## _v_lowpass(half, full_mid, SIZE, SIZE);\
|
||||
OPNAME ## pixels ## SIZE ## _l2(dst, full_mid, half, stride, SIZE, SIZE, SIZE);\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## h264_qpel ## SIZE ## _mc02_c(uint8_t *dst, uint8_t *src, int stride){\
|
||||
uint8_t full[SIZE*(SIZE+5)];\
|
||||
uint8_t * const full_mid= full + SIZE*2;\
|
||||
copy_block ## SIZE (full, src - stride*2, SIZE, stride, SIZE + 5);\
|
||||
OPNAME ## h264_qpel ## SIZE ## _v_lowpass(dst, full_mid, stride, SIZE);\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## h264_qpel ## SIZE ## _mc03_c(uint8_t *dst, uint8_t *src, int stride){\
|
||||
uint8_t full[SIZE*(SIZE+5)];\
|
||||
uint8_t * const full_mid= full + SIZE*2;\
|
||||
uint8_t half[SIZE*SIZE];\
|
||||
copy_block ## SIZE (full, src - stride*2, SIZE, stride, SIZE + 5);\
|
||||
put_h264_qpel ## SIZE ## _v_lowpass(half, full_mid, SIZE, SIZE);\
|
||||
OPNAME ## pixels ## SIZE ## _l2(dst, full_mid+SIZE, half, stride, SIZE, SIZE, SIZE);\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## h264_qpel ## SIZE ## _mc11_c(uint8_t *dst, uint8_t *src, int stride){\
|
||||
uint8_t full[SIZE*(SIZE+5)];\
|
||||
uint8_t * const full_mid= full + SIZE*2;\
|
||||
uint8_t halfH[SIZE*SIZE];\
|
||||
uint8_t halfV[SIZE*SIZE];\
|
||||
put_h264_qpel ## SIZE ## _h_lowpass(halfH, src, SIZE, stride);\
|
||||
copy_block ## SIZE (full, src - stride*2, SIZE, stride, SIZE + 5);\
|
||||
put_h264_qpel ## SIZE ## _v_lowpass(halfV, full_mid, SIZE, SIZE);\
|
||||
OPNAME ## pixels ## SIZE ## _l2(dst, halfH, halfV, stride, SIZE, SIZE, SIZE);\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## h264_qpel ## SIZE ## _mc31_c(uint8_t *dst, uint8_t *src, int stride){\
|
||||
uint8_t full[SIZE*(SIZE+5)];\
|
||||
uint8_t * const full_mid= full + SIZE*2;\
|
||||
uint8_t halfH[SIZE*SIZE];\
|
||||
uint8_t halfV[SIZE*SIZE];\
|
||||
put_h264_qpel ## SIZE ## _h_lowpass(halfH, src, SIZE, stride);\
|
||||
copy_block ## SIZE (full, src - stride*2 + 1, SIZE, stride, SIZE + 5);\
|
||||
put_h264_qpel ## SIZE ## _v_lowpass(halfV, full_mid, SIZE, SIZE);\
|
||||
OPNAME ## pixels ## SIZE ## _l2(dst, halfH, halfV, stride, SIZE, SIZE, SIZE);\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## h264_qpel ## SIZE ## _mc13_c(uint8_t *dst, uint8_t *src, int stride){\
|
||||
uint8_t full[SIZE*(SIZE+5)];\
|
||||
uint8_t * const full_mid= full + SIZE*2;\
|
||||
uint8_t halfH[SIZE*SIZE];\
|
||||
uint8_t halfV[SIZE*SIZE];\
|
||||
put_h264_qpel ## SIZE ## _h_lowpass(halfH, src + stride, SIZE, stride);\
|
||||
copy_block ## SIZE (full, src - stride*2, SIZE, stride, SIZE + 5);\
|
||||
put_h264_qpel ## SIZE ## _v_lowpass(halfV, full_mid, SIZE, SIZE);\
|
||||
OPNAME ## pixels ## SIZE ## _l2(dst, halfH, halfV, stride, SIZE, SIZE, SIZE);\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## h264_qpel ## SIZE ## _mc33_c(uint8_t *dst, uint8_t *src, int stride){\
|
||||
uint8_t full[SIZE*(SIZE+5)];\
|
||||
uint8_t * const full_mid= full + SIZE*2;\
|
||||
uint8_t halfH[SIZE*SIZE];\
|
||||
uint8_t halfV[SIZE*SIZE];\
|
||||
put_h264_qpel ## SIZE ## _h_lowpass(halfH, src + stride, SIZE, stride);\
|
||||
copy_block ## SIZE (full, src - stride*2 + 1, SIZE, stride, SIZE + 5);\
|
||||
put_h264_qpel ## SIZE ## _v_lowpass(halfV, full_mid, SIZE, SIZE);\
|
||||
OPNAME ## pixels ## SIZE ## _l2(dst, halfH, halfV, stride, SIZE, SIZE, SIZE);\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## h264_qpel ## SIZE ## _mc22_c(uint8_t *dst, uint8_t *src, int stride){\
|
||||
int16_t tmp[SIZE*(SIZE+5)];\
|
||||
OPNAME ## h264_qpel ## SIZE ## _hv_lowpass(dst, tmp, src, stride, SIZE, stride);\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## h264_qpel ## SIZE ## _mc21_c(uint8_t *dst, uint8_t *src, int stride){\
|
||||
int16_t tmp[SIZE*(SIZE+5)];\
|
||||
uint8_t halfH[SIZE*SIZE];\
|
||||
uint8_t halfHV[SIZE*SIZE];\
|
||||
put_h264_qpel ## SIZE ## _h_lowpass(halfH, src, SIZE, stride);\
|
||||
put_h264_qpel ## SIZE ## _hv_lowpass(halfHV, tmp, src, SIZE, SIZE, stride);\
|
||||
OPNAME ## pixels ## SIZE ## _l2(dst, halfH, halfHV, stride, SIZE, SIZE, SIZE);\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## h264_qpel ## SIZE ## _mc23_c(uint8_t *dst, uint8_t *src, int stride){\
|
||||
int16_t tmp[SIZE*(SIZE+5)];\
|
||||
uint8_t halfH[SIZE*SIZE];\
|
||||
uint8_t halfHV[SIZE*SIZE];\
|
||||
put_h264_qpel ## SIZE ## _h_lowpass(halfH, src + stride, SIZE, stride);\
|
||||
put_h264_qpel ## SIZE ## _hv_lowpass(halfHV, tmp, src, SIZE, SIZE, stride);\
|
||||
OPNAME ## pixels ## SIZE ## _l2(dst, halfH, halfHV, stride, SIZE, SIZE, SIZE);\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## h264_qpel ## SIZE ## _mc12_c(uint8_t *dst, uint8_t *src, int stride){\
|
||||
uint8_t full[SIZE*(SIZE+5)];\
|
||||
uint8_t * const full_mid= full + SIZE*2;\
|
||||
int16_t tmp[SIZE*(SIZE+5)];\
|
||||
uint8_t halfV[SIZE*SIZE];\
|
||||
uint8_t halfHV[SIZE*SIZE];\
|
||||
copy_block ## SIZE (full, src - stride*2, SIZE, stride, SIZE + 5);\
|
||||
put_h264_qpel ## SIZE ## _v_lowpass(halfV, full_mid, SIZE, SIZE);\
|
||||
put_h264_qpel ## SIZE ## _hv_lowpass(halfHV, tmp, src, SIZE, SIZE, stride);\
|
||||
OPNAME ## pixels ## SIZE ## _l2(dst, halfV, halfHV, stride, SIZE, SIZE, SIZE);\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## h264_qpel ## SIZE ## _mc32_c(uint8_t *dst, uint8_t *src, int stride){\
|
||||
uint8_t full[SIZE*(SIZE+5)];\
|
||||
uint8_t * const full_mid= full + SIZE*2;\
|
||||
int16_t tmp[SIZE*(SIZE+5)];\
|
||||
uint8_t halfV[SIZE*SIZE];\
|
||||
uint8_t halfHV[SIZE*SIZE];\
|
||||
copy_block ## SIZE (full, src - stride*2 + 1, SIZE, stride, SIZE + 5);\
|
||||
put_h264_qpel ## SIZE ## _v_lowpass(halfV, full_mid, SIZE, SIZE);\
|
||||
put_h264_qpel ## SIZE ## _hv_lowpass(halfHV, tmp, src, SIZE, SIZE, stride);\
|
||||
OPNAME ## pixels ## SIZE ## _l2(dst, halfV, halfHV, stride, SIZE, SIZE, SIZE);\
|
||||
}\
|
||||
|
||||
#define op_avg(a, b) a = (((a)+cm[((b) + 16)>>5]+1)>>1)
|
||||
//#define op_avg2(a, b) a = (((a)*w1+cm[((b) + 16)>>5]*w2 + o + 64)>>7)
|
||||
#define op_put(a, b) a = cm[((b) + 16)>>5]
|
||||
#define op2_avg(a, b) a = (((a)+cm[((b) + 512)>>10]+1)>>1)
|
||||
#define op2_put(a, b) a = cm[((b) + 512)>>10]
|
||||
|
||||
H264_LOWPASS(put_ , op_put, op2_put)
|
||||
H264_LOWPASS(avg_ , op_avg, op2_avg)
|
||||
H264_MC(put_, 4)
|
||||
H264_MC(put_, 8)
|
||||
H264_MC(put_, 16)
|
||||
H264_MC(avg_, 4)
|
||||
H264_MC(avg_, 8)
|
||||
H264_MC(avg_, 16)
|
||||
|
||||
#undef op_avg
|
||||
#undef op_put
|
||||
#undef op2_avg
|
||||
#undef op2_put
|
||||
#endif
|
||||
|
||||
static void wmv2_mspel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){
|
||||
uint8_t *cm = cropTbl + MAX_NEG_CROP;
|
||||
int i;
|
||||
@ -2107,7 +2595,21 @@ void dsputil_init(DSPContext* c, AVCodecContext *avctx)
|
||||
|
||||
dspfunc(avg_qpel, 1, 8);
|
||||
/* dspfunc(avg_no_rnd_qpel, 1, 8); */
|
||||
|
||||
dspfunc(put_h264_qpel, 0, 16);
|
||||
dspfunc(put_h264_qpel, 1, 8);
|
||||
dspfunc(put_h264_qpel, 2, 4);
|
||||
dspfunc(avg_h264_qpel, 0, 16);
|
||||
dspfunc(avg_h264_qpel, 1, 8);
|
||||
dspfunc(avg_h264_qpel, 2, 4);
|
||||
|
||||
#undef dspfunc
|
||||
c->put_h264_chroma_pixels_tab[0]= put_h264_chroma_mc8_c;
|
||||
c->put_h264_chroma_pixels_tab[1]= put_h264_chroma_mc4_c;
|
||||
c->put_h264_chroma_pixels_tab[2]= put_h264_chroma_mc2_c;
|
||||
c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_c;
|
||||
c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_c;
|
||||
c->avg_h264_chroma_pixels_tab[2]= avg_h264_chroma_mc2_c;
|
||||
|
||||
c->put_mspel_pixels_tab[0]= put_mspel8_mc00_c;
|
||||
c->put_mspel_pixels_tab[1]= put_mspel8_mc10_c;
|
||||
|
@ -76,6 +76,7 @@ void clear_blocks_c(DCTELEM *blocks);
|
||||
// blocksizes for op_pixels_func are 8x4,8x8 16x8 16x16
|
||||
typedef void (*op_pixels_func)(uint8_t *block/*align width (8 or 16)*/, const uint8_t *pixels/*align 1*/, int line_size, int h);
|
||||
typedef void (*qpel_mc_func)(uint8_t *dst/*align width (8 or 16)*/, uint8_t *src/*align 1*/, int stride);
|
||||
typedef void (*h264_chroma_mc_func)(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int srcStride, int h, int x, int y);
|
||||
|
||||
#define DEF_OLD_QPEL(name)\
|
||||
void ff_put_ ## name (uint8_t *dst/*align width (8 or 16)*/, uint8_t *src/*align 1*/, int stride);\
|
||||
@ -107,6 +108,7 @@ typedef int (*op_pixels_abs_func)(uint8_t *blk1/*align width (8 or 16)*/, uint8_
|
||||
|
||||
typedef int (*me_cmp_func)(void /*MpegEncContext*/ *s, uint8_t *blk1/*align width (8 or 16)*/, uint8_t *blk2/*align 1*/, int line_size)/* __attribute__ ((const))*/;
|
||||
|
||||
|
||||
/**
|
||||
* DSPContext.
|
||||
*/
|
||||
@ -188,6 +190,15 @@ typedef struct DSPContext {
|
||||
qpel_mc_func avg_no_rnd_qpel_pixels_tab[2][16];
|
||||
qpel_mc_func put_mspel_pixels_tab[8];
|
||||
|
||||
/**
|
||||
* h264 Chram MC
|
||||
*/
|
||||
h264_chroma_mc_func put_h264_chroma_pixels_tab[3];
|
||||
h264_chroma_mc_func avg_h264_chroma_pixels_tab[3];
|
||||
|
||||
qpel_mc_func put_h264_qpel_pixels_tab[3][16];
|
||||
qpel_mc_func avg_h264_qpel_pixels_tab[3][16];
|
||||
|
||||
op_pixels_abs_func pix_abs16x16;
|
||||
op_pixels_abs_func pix_abs16x16_x2;
|
||||
op_pixels_abs_func pix_abs16x16_y2;
|
||||
|
97
libavcodec/golomb.c
Normal file
97
libavcodec/golomb.c
Normal file
@ -0,0 +1,97 @@
|
||||
/*
|
||||
* exp golomb vlc stuff
|
||||
* Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
|
||||
*
|
||||
* This library 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 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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 this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file golomb.c
|
||||
* @brief
|
||||
* exp golomb vlc stuff
|
||||
* @author Michael Niedermayer <michaelni@gmx.at>
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
const uint8_t ff_golomb_vlc_len[512]={
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
|
||||
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
|
||||
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
|
||||
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
|
||||
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
|
||||
};
|
||||
|
||||
const uint8_t ff_ue_golomb_vlc_code[512]={
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,
|
||||
7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
const int8_t ff_se_golomb_vlc_code[512]={
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, -8, 9, -9, 10,-10, 11,-11, 12,-12, 13,-13, 14,-14, 15,-15,
|
||||
4, 4, 4, 4, -4, -4, -4, -4, 5, 5, 5, 5, -5, -5, -5, -5, 6, 6, 6, 6, -6, -6, -6, -6, 7, 7, 7, 7, -7, -7, -7, -7,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
};
|
||||
|
||||
|
||||
const uint8_t ff_ue_golomb_len[256]={
|
||||
1, 3, 3, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,11,
|
||||
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,13,
|
||||
13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
|
||||
13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,15,
|
||||
15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
|
||||
15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
|
||||
15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
|
||||
15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,17,
|
||||
};
|
215
libavcodec/golomb.h
Normal file
215
libavcodec/golomb.h
Normal file
@ -0,0 +1,215 @@
|
||||
/*
|
||||
* exp golomb vlc stuff
|
||||
* Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
|
||||
*
|
||||
* This library 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 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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 this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file golomb.h
|
||||
* @brief
|
||||
* exp golomb vlc stuff
|
||||
* @author Michael Niedermayer <michaelni@gmx.at>
|
||||
*/
|
||||
|
||||
extern const uint8_t ff_golomb_vlc_len[512];
|
||||
extern const uint8_t ff_ue_golomb_vlc_code[512];
|
||||
extern const int8_t ff_se_golomb_vlc_code[512];
|
||||
extern const uint8_t ff_ue_golomb_len[256];
|
||||
|
||||
|
||||
/**
|
||||
* read unsigned exp golomb code.
|
||||
*/
|
||||
static inline int get_ue_golomb(GetBitContext *gb){
|
||||
unsigned int buf;
|
||||
int log;
|
||||
|
||||
OPEN_READER(re, gb);
|
||||
UPDATE_CACHE(re, gb);
|
||||
buf=GET_CACHE(re, gb);
|
||||
|
||||
if(buf >= (1<<27)){
|
||||
buf >>= 32 - 9;
|
||||
LAST_SKIP_BITS(re, gb, ff_golomb_vlc_len[buf]);
|
||||
CLOSE_READER(re, gb);
|
||||
|
||||
return ff_ue_golomb_vlc_code[buf];
|
||||
}else{
|
||||
log= 2*av_log2(buf) - 31;
|
||||
buf>>= log;
|
||||
buf--;
|
||||
LAST_SKIP_BITS(re, gb, 32 - log);
|
||||
CLOSE_READER(re, gb);
|
||||
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* read unsigned truncated exp golomb code.
|
||||
*/
|
||||
static inline int get_te0_golomb(GetBitContext *gb, int range){
|
||||
assert(range >= 1);
|
||||
|
||||
if(range==1) return 0;
|
||||
else if(range==2) return get_bits1(gb);
|
||||
else return get_ue_golomb(gb);
|
||||
}
|
||||
|
||||
/**
|
||||
* read unsigned truncated exp golomb code.
|
||||
*/
|
||||
static inline int get_te_golomb(GetBitContext *gb, int range){
|
||||
assert(range >= 1);
|
||||
|
||||
if(range==2) return get_bits1(gb);
|
||||
else return get_ue_golomb(gb);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* read signed exp golomb code.
|
||||
*/
|
||||
static inline int get_se_golomb(GetBitContext *gb){
|
||||
unsigned int buf;
|
||||
int log;
|
||||
|
||||
OPEN_READER(re, gb);
|
||||
UPDATE_CACHE(re, gb);
|
||||
buf=GET_CACHE(re, gb);
|
||||
|
||||
if(buf >= (1<<27)){
|
||||
buf >>= 32 - 9;
|
||||
LAST_SKIP_BITS(re, gb, ff_golomb_vlc_len[buf]);
|
||||
CLOSE_READER(re, gb);
|
||||
|
||||
return ff_se_golomb_vlc_code[buf];
|
||||
}else{
|
||||
log= 2*av_log2(buf) - 31;
|
||||
buf>>= log;
|
||||
|
||||
LAST_SKIP_BITS(re, gb, 32 - log);
|
||||
CLOSE_READER(re, gb);
|
||||
|
||||
if(buf&1) buf= -(buf>>1);
|
||||
else buf= (buf>>1);
|
||||
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef TRACE
|
||||
|
||||
static inline int get_ue(GetBitContext *s, char *file, char *func, int line){
|
||||
int show= show_bits(s, 24);
|
||||
int pos= get_bits_count(s);
|
||||
int i= get_ue_golomb(s);
|
||||
int len= get_bits_count(s) - pos;
|
||||
int bits= show>>(24-len);
|
||||
|
||||
print_bin(bits, len);
|
||||
|
||||
printf("%5d %2d %3d ue @%5d in %s %s:%d\n", bits, len, i, pos, file, func, line);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
static inline int get_se(GetBitContext *s, char *file, char *func, int line){
|
||||
int show= show_bits(s, 24);
|
||||
int pos= get_bits_count(s);
|
||||
int i= get_se_golomb(s);
|
||||
int len= get_bits_count(s) - pos;
|
||||
int bits= show>>(24-len);
|
||||
|
||||
print_bin(bits, len);
|
||||
|
||||
printf("%5d %2d %3d se @%5d in %s %s:%d\n", bits, len, i, pos, file, func, line);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
static inline int get_te(GetBitContext *s, int r, char *file, char *func, int line){
|
||||
int show= show_bits(s, 24);
|
||||
int pos= get_bits_count(s);
|
||||
int i= get_te0_golomb(s, r);
|
||||
int len= get_bits_count(s) - pos;
|
||||
int bits= show>>(24-len);
|
||||
|
||||
print_bin(bits, len);
|
||||
|
||||
printf("%5d %2d %3d te @%5d in %s %s:%d\n", bits, len, i, pos, file, func, line);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
#define get_ue_golomb(a) get_ue(a, __FILE__, __PRETTY_FUNCTION__, __LINE__)
|
||||
#define get_se_golomb(a) get_se(a, __FILE__, __PRETTY_FUNCTION__, __LINE__)
|
||||
#define get_te_golomb(a, r) get_te(a, r, __FILE__, __PRETTY_FUNCTION__, __LINE__)
|
||||
#define get_te0_golomb(a, r) get_te(a, r, __FILE__, __PRETTY_FUNCTION__, __LINE__)
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* write unsigned exp golomb code.
|
||||
*/
|
||||
static inline void set_ue_golomb(PutBitContext *pb, int i){
|
||||
int e;
|
||||
|
||||
assert(i>=0);
|
||||
|
||||
#if 0
|
||||
if(i=0){
|
||||
put_bits(pb, 1, 1);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if(i<256)
|
||||
put_bits(pb, ff_ue_golomb_len[i], i+1);
|
||||
else{
|
||||
e= av_log2(i+1);
|
||||
|
||||
put_bits(pb, 2*e+1, i+1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* write truncated unsigned exp golomb code.
|
||||
*/
|
||||
static inline void set_te_golomb(PutBitContext *pb, int i, int range){
|
||||
assert(range >= 1);
|
||||
assert(i<=range);
|
||||
|
||||
if(range==2) put_bits(pb, 1, i);
|
||||
else set_ue_golomb(pb, i);
|
||||
}
|
||||
|
||||
/**
|
||||
* write signed exp golomb code.
|
||||
*/
|
||||
static inline void set_se_golomb(PutBitContext *pb, int i){
|
||||
#if 0
|
||||
if(i<=0) i= -2*i;
|
||||
else i= 2*i-1;
|
||||
#elif 1
|
||||
i= 2*i-1;
|
||||
if(i<0) i^= -1; //FIXME check if gcc does the right thing
|
||||
#else
|
||||
i= 2*i-1;
|
||||
i^= (i>>31);
|
||||
#endif
|
||||
set_ue_golomb(pb, i);
|
||||
}
|
4418
libavcodec/h264.c
Normal file
4418
libavcodec/h264.c
Normal file
File diff suppressed because it is too large
Load Diff
527
libavcodec/h264data.h
Normal file
527
libavcodec/h264data.h
Normal file
@ -0,0 +1,527 @@
|
||||
/*
|
||||
* H26L/H264/AVC/JVT/14496-10/... encoder/decoder
|
||||
* Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
|
||||
*
|
||||
* This library 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 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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 this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file h264data.h
|
||||
* @brief
|
||||
* H264 / AVC / MPEG4 part10 codec data table
|
||||
* @author Michael Niedermayer <michaelni@gmx.at>
|
||||
*/
|
||||
|
||||
#define VERT_PRED 0
|
||||
#define HOR_PRED 1
|
||||
#define DC_PRED 2
|
||||
#define DIAG_DOWN_LEFT_PRED 3
|
||||
#define DIAG_DOWN_RIGHT_PRED 4
|
||||
#define VERT_RIGHT_PRED 5
|
||||
#define HOR_DOWN_PRED 6
|
||||
#define VERT_LEFT_PRED 7
|
||||
#define HOR_UP_PRED 8
|
||||
|
||||
#define LEFT_DC_PRED 9
|
||||
#define TOP_DC_PRED 10
|
||||
#define DC_128_PRED 11
|
||||
|
||||
|
||||
#define DC_PRED8x8 0
|
||||
#define HOR_PRED8x8 1
|
||||
#define VERT_PRED8x8 2
|
||||
#define PLANE_PRED8x8 3
|
||||
|
||||
#define LEFT_DC_PRED8x8 4
|
||||
#define TOP_DC_PRED8x8 5
|
||||
#define DC_128_PRED8x8 6
|
||||
|
||||
#define EXTENDED_SAR 255
|
||||
|
||||
static const uint16_t pixel_aspect[16][2]={
|
||||
{0, 0},
|
||||
{1, 1},
|
||||
{12, 11},
|
||||
{10, 11},
|
||||
{16, 11},
|
||||
{40, 33},
|
||||
{24, 11},
|
||||
{20, 11},
|
||||
{32, 11},
|
||||
{80, 33},
|
||||
{18, 11},
|
||||
{15, 11},
|
||||
{64, 33},
|
||||
{160,99},
|
||||
};
|
||||
|
||||
static const uint8_t golomb_to_pict_type[5]=
|
||||
{P_TYPE, B_TYPE, I_TYPE, SP_TYPE, SI_TYPE};
|
||||
|
||||
static const uint8_t pict_type_to_golomb[7]=
|
||||
{-1, 2, 0, 1, -1, 4, 3};
|
||||
|
||||
static const uint8_t chroma_qp[52]={
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,
|
||||
12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,
|
||||
28,29,29,30,31,32,32,33,34,34,35,35,36,36,37,37,
|
||||
37,38,38,38,39,39,39,39
|
||||
|
||||
};
|
||||
|
||||
static const uint8_t golomb_to_intra4x4_cbp[48]={
|
||||
47, 31, 15, 0, 23, 27, 29, 30, 7, 11, 13, 14, 39, 43, 45, 46,
|
||||
16, 3, 5, 10, 12, 19, 21, 26, 28, 35, 37, 42, 44, 1, 2, 4,
|
||||
8, 17, 18, 20, 24, 6, 9, 22, 25, 32, 33, 34, 36, 40, 38, 41
|
||||
};
|
||||
|
||||
static const uint8_t golomb_to_inter_cbp[48]={
|
||||
0, 16, 1, 2, 4, 8, 32, 3, 5, 10, 12, 15, 47, 7, 11, 13,
|
||||
14, 6, 9, 31, 35, 37, 42, 44, 33, 34, 36, 40, 39, 43, 45, 46,
|
||||
17, 18, 20, 24, 19, 21, 26, 28, 23, 27, 29, 30, 22, 25, 38, 41
|
||||
};
|
||||
|
||||
static const uint8_t intra4x4_cbp_to_golomb[48]={
|
||||
3, 29, 30, 17, 31, 18, 37, 8, 32, 38, 19, 9, 20, 10, 11, 2,
|
||||
16, 33, 34, 21, 35, 22, 39, 4, 36, 40, 23, 5, 24, 6, 7, 1,
|
||||
41, 42, 43, 25, 44, 26, 46, 12, 45, 47, 27, 13, 28, 14, 15, 0
|
||||
};
|
||||
|
||||
static const uint8_t inter_cbp_to_golomb[48]={
|
||||
0, 2, 3, 7, 4, 8, 17, 13, 5, 18, 9, 14, 10, 15, 16, 11,
|
||||
1, 32, 33, 36, 34, 37, 44, 40, 35, 45, 38, 41, 39, 42, 43, 19,
|
||||
6, 24, 25, 20, 26, 21, 46, 28, 27, 47, 22, 29, 23, 30, 31, 12
|
||||
};
|
||||
|
||||
static const uint8_t chroma_dc_coeff_token_len[4*5]={
|
||||
2, 0, 0, 0,
|
||||
6, 1, 0, 0,
|
||||
6, 6, 3, 0,
|
||||
6, 7, 7, 6,
|
||||
6, 8, 8, 7,
|
||||
};
|
||||
|
||||
static const uint8_t chroma_dc_coeff_token_bits[4*5]={
|
||||
1, 0, 0, 0,
|
||||
7, 1, 0, 0,
|
||||
4, 6, 1, 0,
|
||||
3, 3, 2, 5,
|
||||
2, 3, 2, 0,
|
||||
};
|
||||
|
||||
static const uint8_t coeff_token_len[4][4*17]={
|
||||
{
|
||||
1, 0, 0, 0,
|
||||
6, 2, 0, 0, 8, 6, 3, 0, 9, 8, 7, 5, 10, 9, 8, 6,
|
||||
11,10, 9, 7, 13,11,10, 8, 13,13,11, 9, 13,13,13,10,
|
||||
14,14,13,11, 14,14,14,13, 15,15,14,14, 15,15,15,14,
|
||||
16,15,15,15, 16,16,16,15, 16,16,16,16, 16,16,16,16,
|
||||
},
|
||||
{
|
||||
2, 0, 0, 0,
|
||||
6, 2, 0, 0, 6, 5, 3, 0, 7, 6, 6, 4, 8, 6, 6, 4,
|
||||
8, 7, 7, 5, 9, 8, 8, 6, 11, 9, 9, 6, 11,11,11, 7,
|
||||
12,11,11, 9, 12,12,12,11, 12,12,12,11, 13,13,13,12,
|
||||
13,13,13,13, 13,14,13,13, 14,14,14,13, 14,14,14,14,
|
||||
},
|
||||
{
|
||||
4, 0, 0, 0,
|
||||
6, 4, 0, 0, 6, 5, 4, 0, 6, 5, 5, 4, 7, 5, 5, 4,
|
||||
7, 5, 5, 4, 7, 6, 6, 4, 7, 6, 6, 4, 8, 7, 7, 5,
|
||||
8, 8, 7, 6, 9, 8, 8, 7, 9, 9, 8, 8, 9, 9, 9, 8,
|
||||
10, 9, 9, 9, 10,10,10,10, 10,10,10,10, 10,10,10,10,
|
||||
},
|
||||
{
|
||||
6, 0, 0, 0,
|
||||
6, 6, 0, 0, 6, 6, 6, 0, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||
}
|
||||
};
|
||||
|
||||
static const uint8_t coeff_token_bits[4][4*17]={
|
||||
{
|
||||
1, 0, 0, 0,
|
||||
5, 1, 0, 0, 7, 4, 1, 0, 7, 6, 5, 3, 7, 6, 5, 3,
|
||||
7, 6, 5, 4, 15, 6, 5, 4, 11,14, 5, 4, 8,10,13, 4,
|
||||
15,14, 9, 4, 11,10,13,12, 15,14, 9,12, 11,10,13, 8,
|
||||
15, 1, 9,12, 11,14,13, 8, 7,10, 9,12, 4, 6, 5, 8,
|
||||
},
|
||||
{
|
||||
3, 0, 0, 0,
|
||||
11, 2, 0, 0, 7, 7, 3, 0, 7,10, 9, 5, 7, 6, 5, 4,
|
||||
4, 6, 5, 6, 7, 6, 5, 8, 15, 6, 5, 4, 11,14,13, 4,
|
||||
15,10, 9, 4, 11,14,13,12, 8,10, 9, 8, 15,14,13,12,
|
||||
11,10, 9,12, 7,11, 6, 8, 9, 8,10, 1, 7, 6, 5, 4,
|
||||
},
|
||||
{
|
||||
15, 0, 0, 0,
|
||||
15,14, 0, 0, 11,15,13, 0, 8,12,14,12, 15,10,11,11,
|
||||
11, 8, 9,10, 9,14,13, 9, 8,10, 9, 8, 15,14,13,13,
|
||||
11,14,10,12, 15,10,13,12, 11,14, 9,12, 8,10,13, 8,
|
||||
13, 7, 9,12, 9,12,11,10, 5, 8, 7, 6, 1, 4, 3, 2,
|
||||
},
|
||||
{
|
||||
3, 0, 0, 0,
|
||||
0, 1, 0, 0, 4, 5, 6, 0, 8, 9,10,11, 12,13,14,15,
|
||||
16,17,18,19, 20,21,22,23, 24,25,26,27, 28,29,30,31,
|
||||
32,33,34,35, 36,37,38,39, 40,41,42,43, 44,45,46,47,
|
||||
48,49,50,51, 52,53,54,55, 56,57,58,59, 60,61,62,63,
|
||||
}
|
||||
};
|
||||
|
||||
static const uint8_t total_zeros_len[16][16]= {
|
||||
{1,3,3,4,4,5,5,6,6,7,7,8,8,9,9,9},
|
||||
{3,3,3,3,3,4,4,4,4,5,5,6,6,6,6},
|
||||
{4,3,3,3,4,4,3,3,4,5,5,6,5,6},
|
||||
{5,3,4,4,3,3,3,4,3,4,5,5,5},
|
||||
{4,4,4,3,3,3,3,3,4,5,4,5},
|
||||
{6,5,3,3,3,3,3,3,4,3,6},
|
||||
{6,5,3,3,3,2,3,4,3,6},
|
||||
{6,4,5,3,2,2,3,3,6},
|
||||
{6,6,4,2,2,3,2,5},
|
||||
{5,5,3,2,2,2,4},
|
||||
{4,4,3,3,1,3},
|
||||
{4,4,2,1,3},
|
||||
{3,3,1,2},
|
||||
{2,2,1},
|
||||
{1,1},
|
||||
};
|
||||
|
||||
static const uint8_t total_zeros_bits[16][16]= {
|
||||
{1,3,2,3,2,3,2,3,2,3,2,3,2,3,2,1},
|
||||
{7,6,5,4,3,5,4,3,2,3,2,3,2,1,0},
|
||||
{5,7,6,5,4,3,4,3,2,3,2,1,1,0},
|
||||
{3,7,5,4,6,5,4,3,3,2,2,1,0},
|
||||
{5,4,3,7,6,5,4,3,2,1,1,0},
|
||||
{1,1,7,6,5,4,3,2,1,1,0},
|
||||
{1,1,5,4,3,3,2,1,1,0},
|
||||
{1,1,1,3,3,2,2,1,0},
|
||||
{1,0,1,3,2,1,1,1},
|
||||
{1,0,1,3,2,1,1},
|
||||
{0,1,1,2,1,3},
|
||||
{0,1,1,1,1},
|
||||
{0,1,1,1},
|
||||
{0,1,1},
|
||||
{0,1},
|
||||
};
|
||||
|
||||
static const uint8_t chroma_dc_total_zeros_len[3][4]= {
|
||||
{ 1, 2, 3, 3,},
|
||||
{ 1, 2, 2, 0,},
|
||||
{ 1, 1, 0, 0,},
|
||||
};
|
||||
|
||||
static const uint8_t chroma_dc_total_zeros_bits[3][4]= {
|
||||
{ 1, 1, 1, 0,},
|
||||
{ 1, 1, 0, 0,},
|
||||
{ 1, 0, 0, 0,},
|
||||
};
|
||||
|
||||
static const uint8_t run_len[7][16]={
|
||||
{1,1},
|
||||
{1,2,2},
|
||||
{2,2,2,2},
|
||||
{2,2,2,3,3},
|
||||
{2,2,3,3,3,3},
|
||||
{2,3,3,3,3,3,3},
|
||||
{3,3,3,3,3,3,3,4,5,6,7,8,9,10,11},
|
||||
};
|
||||
|
||||
static const uint8_t run_bits[7][16]={
|
||||
{1,0},
|
||||
{1,1,0},
|
||||
{3,2,1,0},
|
||||
{3,2,1,1,0},
|
||||
{3,2,3,2,1,0},
|
||||
{3,0,1,3,2,5,4},
|
||||
{7,6,5,4,3,2,1,1,1,1,1,1,1,1,1},
|
||||
};
|
||||
|
||||
/*
|
||||
o-o o-o
|
||||
/ / /
|
||||
o-o o-o
|
||||
,---'
|
||||
o-o o-o
|
||||
/ / /
|
||||
o-o o-o
|
||||
*/
|
||||
|
||||
static const uint8_t scan8[16 + 2*4]={
|
||||
4+1*8, 5+1*8, 4+2*8, 5+2*8,
|
||||
6+1*8, 7+1*8, 6+2*8, 7+2*8,
|
||||
4+3*8, 5+3*8, 4+4*8, 5+4*8,
|
||||
6+3*8, 7+3*8, 6+4*8, 7+4*8,
|
||||
1+1*8, 2+1*8,
|
||||
1+2*8, 2+2*8,
|
||||
1+4*8, 2+4*8,
|
||||
1+5*8, 2+5*8,
|
||||
};
|
||||
|
||||
static const uint8_t zigzag_scan[16]={
|
||||
0+0*4, 1+0*4, 0+1*4, 0+2*4,
|
||||
1+1*4, 2+0*4, 3+0*4, 2+1*4,
|
||||
1+2*4, 0+3*4, 1+3*4, 2+2*4,
|
||||
3+1*4, 3+2*4, 2+3*4, 3+3*4,
|
||||
};
|
||||
|
||||
static const uint8_t field_scan[16]={
|
||||
0+0*4, 0+1*4, 1+0*4, 0+2*4,
|
||||
0+3*4, 1+1*4, 1+2*4, 1+3*4,
|
||||
2+0*4, 2+1*4, 2+2*4, 2+3*4,
|
||||
3+0*4, 3+1*4, 3+2*4, 3+3*4,
|
||||
};
|
||||
|
||||
static const uint8_t luma_dc_zigzag_scan[16]={
|
||||
0*16 + 0*64, 1*16 + 0*64, 2*16 + 0*64, 0*16 + 2*64,
|
||||
3*16 + 0*64, 0*16 + 1*64, 1*16 + 1*64, 2*16 + 1*64,
|
||||
1*16 + 2*64, 2*16 + 2*64, 3*16 + 2*64, 0*16 + 3*64,
|
||||
3*16 + 1*64, 1*16 + 3*64, 2*16 + 3*64, 3*16 + 3*64,
|
||||
};
|
||||
|
||||
static const uint8_t luma_dc_field_scan[16]={
|
||||
0*16 + 0*64, 2*16 + 0*64, 1*16 + 0*64, 0*16 + 2*64,
|
||||
2*16 + 2*64, 3*16 + 0*64, 1*16 + 2*64, 3*16 + 2*64,
|
||||
0*16 + 1*64, 2*16 + 1*64, 0*16 + 3*64, 2*16 + 3*64,
|
||||
1*16 + 1*64, 3*16 + 1*64, 1*16 + 3*64, 3*16 + 3*64,
|
||||
};
|
||||
|
||||
static const uint8_t chroma_dc_scan[4]={
|
||||
(0+0*2)*16, (1+0*2)*16,
|
||||
(0+1*2)*16, (1+1*2)*16, //FIXME
|
||||
};
|
||||
|
||||
typedef struct IMbInfo{
|
||||
uint16_t type;
|
||||
uint8_t pred_mode;
|
||||
uint8_t cbp;
|
||||
} IMbInfo;
|
||||
|
||||
static const IMbInfo i_mb_type_info[26]={
|
||||
{MB_TYPE_INTRA4x4 , -1, -1},
|
||||
{MB_TYPE_INTRA16x16, 2, 0},
|
||||
{MB_TYPE_INTRA16x16, 1, 0},
|
||||
{MB_TYPE_INTRA16x16, 0, 0},
|
||||
{MB_TYPE_INTRA16x16, 3, 0},
|
||||
{MB_TYPE_INTRA16x16, 2, 16},
|
||||
{MB_TYPE_INTRA16x16, 1, 16},
|
||||
{MB_TYPE_INTRA16x16, 0, 16},
|
||||
{MB_TYPE_INTRA16x16, 3, 16},
|
||||
{MB_TYPE_INTRA16x16, 2, 32},
|
||||
{MB_TYPE_INTRA16x16, 1, 32},
|
||||
{MB_TYPE_INTRA16x16, 0, 32},
|
||||
{MB_TYPE_INTRA16x16, 3, 32},
|
||||
{MB_TYPE_INTRA16x16, 2, 15+0},
|
||||
{MB_TYPE_INTRA16x16, 1, 15+0},
|
||||
{MB_TYPE_INTRA16x16, 0, 15+0},
|
||||
{MB_TYPE_INTRA16x16, 3, 15+0},
|
||||
{MB_TYPE_INTRA16x16, 2, 15+16},
|
||||
{MB_TYPE_INTRA16x16, 1, 15+16},
|
||||
{MB_TYPE_INTRA16x16, 0, 15+16},
|
||||
{MB_TYPE_INTRA16x16, 3, 15+16},
|
||||
{MB_TYPE_INTRA16x16, 2, 15+32},
|
||||
{MB_TYPE_INTRA16x16, 1, 15+32},
|
||||
{MB_TYPE_INTRA16x16, 0, 15+32},
|
||||
{MB_TYPE_INTRA16x16, 3, 15+32},
|
||||
{MB_TYPE_INTRA_PCM , -1, -1},
|
||||
};
|
||||
|
||||
typedef struct PMbInfo{
|
||||
uint16_t type;
|
||||
uint8_t partition_count;
|
||||
} PMbInfo;
|
||||
|
||||
static const PMbInfo p_mb_type_info[5]={
|
||||
{MB_TYPE_16x16|MB_TYPE_P0L0 , 1},
|
||||
{MB_TYPE_16x8 |MB_TYPE_P0L0|MB_TYPE_P1L0, 2},
|
||||
{MB_TYPE_8x16 |MB_TYPE_P0L0|MB_TYPE_P1L0, 2},
|
||||
{MB_TYPE_8x8 , 4},
|
||||
{MB_TYPE_8x8 |MB_TYPE_REF0 , 4},
|
||||
};
|
||||
|
||||
static const PMbInfo p_sub_mb_type_info[4]={
|
||||
{MB_TYPE_16x16|MB_TYPE_P0L0 , 1},
|
||||
{MB_TYPE_16x8 |MB_TYPE_P0L0 , 2},
|
||||
{MB_TYPE_8x16 |MB_TYPE_P0L0 , 2},
|
||||
{MB_TYPE_8x8 |MB_TYPE_P0L0 , 4},
|
||||
};
|
||||
|
||||
static const PMbInfo b_mb_type_info[23]={
|
||||
{MB_TYPE_DIRECT , 1, },
|
||||
{MB_TYPE_16x16|MB_TYPE_P0L0 , 1, },
|
||||
{MB_TYPE_16x16 |MB_TYPE_P0L1 , 1, },
|
||||
{MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1 , 1, },
|
||||
{MB_TYPE_16x8 |MB_TYPE_P0L0 |MB_TYPE_P1L0 , 2, },
|
||||
{MB_TYPE_8x16 |MB_TYPE_P0L0 |MB_TYPE_P1L0 , 2, },
|
||||
{MB_TYPE_16x8 |MB_TYPE_P0L1 |MB_TYPE_P1L1, 2, },
|
||||
{MB_TYPE_8x16 |MB_TYPE_P0L1 |MB_TYPE_P1L1, 2, },
|
||||
{MB_TYPE_16x8 |MB_TYPE_P0L0 |MB_TYPE_P1L1, 2, },
|
||||
{MB_TYPE_8x16 |MB_TYPE_P0L0 |MB_TYPE_P1L1, 2, },
|
||||
{MB_TYPE_16x8 |MB_TYPE_P0L1|MB_TYPE_P1L0 , 2, },
|
||||
{MB_TYPE_8x16 |MB_TYPE_P0L1|MB_TYPE_P1L0 , 2, },
|
||||
{MB_TYPE_16x8 |MB_TYPE_P0L0 |MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
|
||||
{MB_TYPE_8x16 |MB_TYPE_P0L0 |MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
|
||||
{MB_TYPE_16x8 |MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
|
||||
{MB_TYPE_8x16 |MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
|
||||
{MB_TYPE_16x8 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0 , 2, },
|
||||
{MB_TYPE_8x16 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0 , 2, },
|
||||
{MB_TYPE_16x8 |MB_TYPE_P0L0|MB_TYPE_P0L1 |MB_TYPE_P1L1, 2, },
|
||||
{MB_TYPE_8x16 |MB_TYPE_P0L0|MB_TYPE_P0L1 |MB_TYPE_P1L1, 2, },
|
||||
{MB_TYPE_16x8 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
|
||||
{MB_TYPE_8x16 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
|
||||
{MB_TYPE_8x8 , 4, },
|
||||
};
|
||||
|
||||
static const PMbInfo b_sub_mb_type_info[13]={
|
||||
{MB_TYPE_DIRECT , 1, },
|
||||
{MB_TYPE_16x16|MB_TYPE_P0L0 , 1, },
|
||||
{MB_TYPE_16x16 |MB_TYPE_P0L1 , 1, },
|
||||
{MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1 , 1, },
|
||||
{MB_TYPE_16x8 |MB_TYPE_P0L0 |MB_TYPE_P1L0 , 2, },
|
||||
{MB_TYPE_8x16 |MB_TYPE_P0L0 |MB_TYPE_P1L0 , 2, },
|
||||
{MB_TYPE_16x8 |MB_TYPE_P0L1 |MB_TYPE_P1L1, 2, },
|
||||
{MB_TYPE_8x16 |MB_TYPE_P0L1 |MB_TYPE_P1L1, 2, },
|
||||
{MB_TYPE_16x8 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
|
||||
{MB_TYPE_8x16 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
|
||||
{MB_TYPE_8x8 |MB_TYPE_P0L0 |MB_TYPE_P1L0 , 4, },
|
||||
{MB_TYPE_8x8 |MB_TYPE_P0L1 |MB_TYPE_P1L1, 4, },
|
||||
{MB_TYPE_8x8 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 4, },
|
||||
};
|
||||
|
||||
|
||||
static const uint8_t rem6[52]={
|
||||
0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3,
|
||||
};
|
||||
|
||||
static const uint8_t div6[52]={
|
||||
0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8,
|
||||
};
|
||||
|
||||
static const uint16_t dequant_coeff[52][16]={
|
||||
{ 10, 13, 10, 13, 13, 16, 13, 16, 10, 13, 10, 13, 13, 16, 13, 16, },
|
||||
{ 11, 14, 11, 14, 14, 18, 14, 18, 11, 14, 11, 14, 14, 18, 14, 18, },
|
||||
{ 13, 16, 13, 16, 16, 20, 16, 20, 13, 16, 13, 16, 16, 20, 16, 20, },
|
||||
{ 14, 18, 14, 18, 18, 23, 18, 23, 14, 18, 14, 18, 18, 23, 18, 23, },
|
||||
{ 16, 20, 16, 20, 20, 25, 20, 25, 16, 20, 16, 20, 20, 25, 20, 25, },
|
||||
{ 18, 23, 18, 23, 23, 29, 23, 29, 18, 23, 18, 23, 23, 29, 23, 29, },
|
||||
{ 20, 26, 20, 26, 26, 32, 26, 32, 20, 26, 20, 26, 26, 32, 26, 32, },
|
||||
{ 22, 28, 22, 28, 28, 36, 28, 36, 22, 28, 22, 28, 28, 36, 28, 36, },
|
||||
{ 26, 32, 26, 32, 32, 40, 32, 40, 26, 32, 26, 32, 32, 40, 32, 40, },
|
||||
{ 28, 36, 28, 36, 36, 46, 36, 46, 28, 36, 28, 36, 36, 46, 36, 46, },
|
||||
{ 32, 40, 32, 40, 40, 50, 40, 50, 32, 40, 32, 40, 40, 50, 40, 50, },
|
||||
{ 36, 46, 36, 46, 46, 58, 46, 58, 36, 46, 36, 46, 46, 58, 46, 58, },
|
||||
{ 40, 52, 40, 52, 52, 64, 52, 64, 40, 52, 40, 52, 52, 64, 52, 64, },
|
||||
{ 44, 56, 44, 56, 56, 72, 56, 72, 44, 56, 44, 56, 56, 72, 56, 72, },
|
||||
{ 52, 64, 52, 64, 64, 80, 64, 80, 52, 64, 52, 64, 64, 80, 64, 80, },
|
||||
{ 56, 72, 56, 72, 72, 92, 72, 92, 56, 72, 56, 72, 72, 92, 72, 92, },
|
||||
{ 64, 80, 64, 80, 80, 100, 80, 100, 64, 80, 64, 80, 80, 100, 80, 100, },
|
||||
{ 72, 92, 72, 92, 92, 116, 92, 116, 72, 92, 72, 92, 92, 116, 92, 116, },
|
||||
{ 80, 104, 80, 104, 104, 128, 104, 128, 80, 104, 80, 104, 104, 128, 104, 128, },
|
||||
{ 88, 112, 88, 112, 112, 144, 112, 144, 88, 112, 88, 112, 112, 144, 112, 144, },
|
||||
{ 104, 128, 104, 128, 128, 160, 128, 160, 104, 128, 104, 128, 128, 160, 128, 160, },
|
||||
{ 112, 144, 112, 144, 144, 184, 144, 184, 112, 144, 112, 144, 144, 184, 144, 184, },
|
||||
{ 128, 160, 128, 160, 160, 200, 160, 200, 128, 160, 128, 160, 160, 200, 160, 200, },
|
||||
{ 144, 184, 144, 184, 184, 232, 184, 232, 144, 184, 144, 184, 184, 232, 184, 232, },
|
||||
{ 160, 208, 160, 208, 208, 256, 208, 256, 160, 208, 160, 208, 208, 256, 208, 256, },
|
||||
{ 176, 224, 176, 224, 224, 288, 224, 288, 176, 224, 176, 224, 224, 288, 224, 288, },
|
||||
{ 208, 256, 208, 256, 256, 320, 256, 320, 208, 256, 208, 256, 256, 320, 256, 320, },
|
||||
{ 224, 288, 224, 288, 288, 368, 288, 368, 224, 288, 224, 288, 288, 368, 288, 368, },
|
||||
{ 256, 320, 256, 320, 320, 400, 320, 400, 256, 320, 256, 320, 320, 400, 320, 400, },
|
||||
{ 288, 368, 288, 368, 368, 464, 368, 464, 288, 368, 288, 368, 368, 464, 368, 464, },
|
||||
{ 320, 416, 320, 416, 416, 512, 416, 512, 320, 416, 320, 416, 416, 512, 416, 512, },
|
||||
{ 352, 448, 352, 448, 448, 576, 448, 576, 352, 448, 352, 448, 448, 576, 448, 576, },
|
||||
{ 416, 512, 416, 512, 512, 640, 512, 640, 416, 512, 416, 512, 512, 640, 512, 640, },
|
||||
{ 448, 576, 448, 576, 576, 736, 576, 736, 448, 576, 448, 576, 576, 736, 576, 736, },
|
||||
{ 512, 640, 512, 640, 640, 800, 640, 800, 512, 640, 512, 640, 640, 800, 640, 800, },
|
||||
{ 576, 736, 576, 736, 736, 928, 736, 928, 576, 736, 576, 736, 736, 928, 736, 928, },
|
||||
{ 640, 832, 640, 832, 832,1024, 832,1024, 640, 832, 640, 832, 832,1024, 832,1024, },
|
||||
{ 704, 896, 704, 896, 896,1152, 896,1152, 704, 896, 704, 896, 896,1152, 896,1152, },
|
||||
{ 832,1024, 832,1024, 1024,1280,1024,1280, 832,1024, 832,1024, 1024,1280,1024,1280, },
|
||||
{ 896,1152, 896,1152, 1152,1472,1152,1472, 896,1152, 896,1152, 1152,1472,1152,1472, },
|
||||
{1024,1280,1024,1280, 1280,1600,1280,1600, 1024,1280,1024,1280, 1280,1600,1280,1600, },
|
||||
{1152,1472,1152,1472, 1472,1856,1472,1856, 1152,1472,1152,1472, 1472,1856,1472,1856, },
|
||||
{1280,1664,1280,1664, 1664,2048,1664,2048, 1280,1664,1280,1664, 1664,2048,1664,2048, },
|
||||
{1408,1792,1408,1792, 1792,2304,1792,2304, 1408,1792,1408,1792, 1792,2304,1792,2304, },
|
||||
{1664,2048,1664,2048, 2048,2560,2048,2560, 1664,2048,1664,2048, 2048,2560,2048,2560, },
|
||||
{1792,2304,1792,2304, 2304,2944,2304,2944, 1792,2304,1792,2304, 2304,2944,2304,2944, },
|
||||
{2048,2560,2048,2560, 2560,3200,2560,3200, 2048,2560,2048,2560, 2560,3200,2560,3200, },
|
||||
{2304,2944,2304,2944, 2944,3712,2944,3712, 2304,2944,2304,2944, 2944,3712,2944,3712, },
|
||||
{2560,3328,2560,3328, 3328,4096,3328,4096, 2560,3328,2560,3328, 3328,4096,3328,4096, },
|
||||
{2816,3584,2816,3584, 3584,4608,3584,4608, 2816,3584,2816,3584, 3584,4608,3584,4608, },
|
||||
{3328,4096,3328,4096, 4096,5120,4096,5120, 3328,4096,3328,4096, 4096,5120,4096,5120, },
|
||||
{3584,4608,3584,4608, 4608,5888,4608,5888, 3584,4608,3584,4608, 4608,5888,4608,5888, },
|
||||
//{4096,5120,4096,5120, 5120,6400,5120,6400, 4096,5120,4096,5120, 5120,6400,5120,6400, },
|
||||
//{4608,5888,4608,5888, 5888,7424,5888,7424, 4608,5888,4608,5888, 5888,7424,5888,7424, },
|
||||
};
|
||||
|
||||
#define QUANT_SHIFT 22
|
||||
|
||||
static const int quant_coeff[52][16]={
|
||||
{ 419430,258111,419430,258111,258111,167772,258111,167772,419430,258111,419430,258111,258111,167772,258111,167772,},
|
||||
{ 381300,239675,381300,239675,239675,149131,239675,149131,381300,239675,381300,239675,239675,149131,239675,149131,},
|
||||
{ 322639,209715,322639,209715,209715,134218,209715,134218,322639,209715,322639,209715,209715,134218,209715,134218,},
|
||||
{ 299593,186414,299593,186414,186414,116711,186414,116711,299593,186414,299593,186414,186414,116711,186414,116711,},
|
||||
{ 262144,167772,262144,167772,167772,107374,167772,107374,262144,167772,262144,167772,167772,107374,167772,107374,},
|
||||
{ 233017,145889,233017,145889,145889, 92564,145889, 92564,233017,145889,233017,145889,145889, 92564,145889, 92564,},
|
||||
{ 209715,129056,209715,129056,129056, 83886,129056, 83886,209715,129056,209715,129056,129056, 83886,129056, 83886,},
|
||||
{ 190650,119837,190650,119837,119837, 74565,119837, 74565,190650,119837,190650,119837,119837, 74565,119837, 74565,},
|
||||
{ 161319,104858,161319,104858,104858, 67109,104858, 67109,161319,104858,161319,104858,104858, 67109,104858, 67109,},
|
||||
{ 149797, 93207,149797, 93207, 93207, 58356, 93207, 58356,149797, 93207,149797, 93207, 93207, 58356, 93207, 58356,},
|
||||
{ 131072, 83886,131072, 83886, 83886, 53687, 83886, 53687,131072, 83886,131072, 83886, 83886, 53687, 83886, 53687,},
|
||||
{ 116508, 72944,116508, 72944, 72944, 46282, 72944, 46282,116508, 72944,116508, 72944, 72944, 46282, 72944, 46282,},
|
||||
{ 104858, 64528,104858, 64528, 64528, 41943, 64528, 41943,104858, 64528,104858, 64528, 64528, 41943, 64528, 41943,},
|
||||
{ 95325, 59919, 95325, 59919, 59919, 37283, 59919, 37283, 95325, 59919, 95325, 59919, 59919, 37283, 59919, 37283,},
|
||||
{ 80660, 52429, 80660, 52429, 52429, 33554, 52429, 33554, 80660, 52429, 80660, 52429, 52429, 33554, 52429, 33554,},
|
||||
{ 74898, 46603, 74898, 46603, 46603, 29178, 46603, 29178, 74898, 46603, 74898, 46603, 46603, 29178, 46603, 29178,},
|
||||
{ 65536, 41943, 65536, 41943, 41943, 26844, 41943, 26844, 65536, 41943, 65536, 41943, 41943, 26844, 41943, 26844,},
|
||||
{ 58254, 36472, 58254, 36472, 36472, 23141, 36472, 23141, 58254, 36472, 58254, 36472, 36472, 23141, 36472, 23141,},
|
||||
{ 52429, 32264, 52429, 32264, 32264, 20972, 32264, 20972, 52429, 32264, 52429, 32264, 32264, 20972, 32264, 20972,},
|
||||
{ 47663, 29959, 47663, 29959, 29959, 18641, 29959, 18641, 47663, 29959, 47663, 29959, 29959, 18641, 29959, 18641,},
|
||||
{ 40330, 26214, 40330, 26214, 26214, 16777, 26214, 16777, 40330, 26214, 40330, 26214, 26214, 16777, 26214, 16777,},
|
||||
{ 37449, 23302, 37449, 23302, 23302, 14589, 23302, 14589, 37449, 23302, 37449, 23302, 23302, 14589, 23302, 14589,},
|
||||
{ 32768, 20972, 32768, 20972, 20972, 13422, 20972, 13422, 32768, 20972, 32768, 20972, 20972, 13422, 20972, 13422,},
|
||||
{ 29127, 18236, 29127, 18236, 18236, 11570, 18236, 11570, 29127, 18236, 29127, 18236, 18236, 11570, 18236, 11570,},
|
||||
{ 26214, 16132, 26214, 16132, 16132, 10486, 16132, 10486, 26214, 16132, 26214, 16132, 16132, 10486, 16132, 10486,},
|
||||
{ 23831, 14980, 23831, 14980, 14980, 9321, 14980, 9321, 23831, 14980, 23831, 14980, 14980, 9321, 14980, 9321,},
|
||||
{ 20165, 13107, 20165, 13107, 13107, 8389, 13107, 8389, 20165, 13107, 20165, 13107, 13107, 8389, 13107, 8389,},
|
||||
{ 18725, 11651, 18725, 11651, 11651, 7294, 11651, 7294, 18725, 11651, 18725, 11651, 11651, 7294, 11651, 7294,},
|
||||
{ 16384, 10486, 16384, 10486, 10486, 6711, 10486, 6711, 16384, 10486, 16384, 10486, 10486, 6711, 10486, 6711,},
|
||||
{ 14564, 9118, 14564, 9118, 9118, 5785, 9118, 5785, 14564, 9118, 14564, 9118, 9118, 5785, 9118, 5785,},
|
||||
{ 13107, 8066, 13107, 8066, 8066, 5243, 8066, 5243, 13107, 8066, 13107, 8066, 8066, 5243, 8066, 5243,},
|
||||
{ 11916, 7490, 11916, 7490, 7490, 4660, 7490, 4660, 11916, 7490, 11916, 7490, 7490, 4660, 7490, 4660,},
|
||||
{ 10082, 6554, 10082, 6554, 6554, 4194, 6554, 4194, 10082, 6554, 10082, 6554, 6554, 4194, 6554, 4194,},
|
||||
{ 9362, 5825, 9362, 5825, 5825, 3647, 5825, 3647, 9362, 5825, 9362, 5825, 5825, 3647, 5825, 3647,},
|
||||
{ 8192, 5243, 8192, 5243, 5243, 3355, 5243, 3355, 8192, 5243, 8192, 5243, 5243, 3355, 5243, 3355,},
|
||||
{ 7282, 4559, 7282, 4559, 4559, 2893, 4559, 2893, 7282, 4559, 7282, 4559, 4559, 2893, 4559, 2893,},
|
||||
{ 6554, 4033, 6554, 4033, 4033, 2621, 4033, 2621, 6554, 4033, 6554, 4033, 4033, 2621, 4033, 2621,},
|
||||
{ 5958, 3745, 5958, 3745, 3745, 2330, 3745, 2330, 5958, 3745, 5958, 3745, 3745, 2330, 3745, 2330,},
|
||||
{ 5041, 3277, 5041, 3277, 3277, 2097, 3277, 2097, 5041, 3277, 5041, 3277, 3277, 2097, 3277, 2097,},
|
||||
{ 4681, 2913, 4681, 2913, 2913, 1824, 2913, 1824, 4681, 2913, 4681, 2913, 2913, 1824, 2913, 1824,},
|
||||
{ 4096, 2621, 4096, 2621, 2621, 1678, 2621, 1678, 4096, 2621, 4096, 2621, 2621, 1678, 2621, 1678,},
|
||||
{ 3641, 2280, 3641, 2280, 2280, 1446, 2280, 1446, 3641, 2280, 3641, 2280, 2280, 1446, 2280, 1446,},
|
||||
{ 3277, 2016, 3277, 2016, 2016, 1311, 2016, 1311, 3277, 2016, 3277, 2016, 2016, 1311, 2016, 1311,},
|
||||
{ 2979, 1872, 2979, 1872, 1872, 1165, 1872, 1165, 2979, 1872, 2979, 1872, 1872, 1165, 1872, 1165,},
|
||||
{ 2521, 1638, 2521, 1638, 1638, 1049, 1638, 1049, 2521, 1638, 2521, 1638, 1638, 1049, 1638, 1049,},
|
||||
{ 2341, 1456, 2341, 1456, 1456, 912, 1456, 912, 2341, 1456, 2341, 1456, 1456, 912, 1456, 912,},
|
||||
{ 2048, 1311, 2048, 1311, 1311, 839, 1311, 839, 2048, 1311, 2048, 1311, 1311, 839, 1311, 839,},
|
||||
{ 1820, 1140, 1820, 1140, 1140, 723, 1140, 723, 1820, 1140, 1820, 1140, 1140, 723, 1140, 723,},
|
||||
{ 1638, 1008, 1638, 1008, 1008, 655, 1008, 655, 1638, 1008, 1638, 1008, 1008, 655, 1008, 655,},
|
||||
{ 1489, 936, 1489, 936, 936, 583, 936, 583, 1489, 936, 1489, 936, 936, 583, 936, 583,},
|
||||
{ 1260, 819, 1260, 819, 819, 524, 819, 524, 1260, 819, 1260, 819, 819, 524, 819, 524,},
|
||||
{ 1170, 728, 1170, 728, 728, 456, 728, 456, 1170, 728, 1170, 728, 728, 456, 728, 456,},
|
||||
};
|
@ -227,6 +227,8 @@ int DCT_common_init(MpegEncContext *s)
|
||||
* The pixels are allocated/set by calling get_buffer() if shared=0
|
||||
*/
|
||||
static int alloc_picture(MpegEncContext *s, Picture *pic, int shared){
|
||||
const int big_mb_num= (s->mb_width+1)*(s->mb_height+1);
|
||||
int i;
|
||||
|
||||
if(shared){
|
||||
assert(pic->data[0]);
|
||||
@ -268,6 +270,14 @@ static int alloc_picture(MpegEncContext *s, Picture *pic, int shared){
|
||||
|
||||
CHECKED_ALLOCZ(pic->mbskip_table , s->mb_num * sizeof(uint8_t)+1) //the +1 is for the slice end check
|
||||
CHECKED_ALLOCZ(pic->qscale_table , s->mb_num * sizeof(uint8_t))
|
||||
if(s->out_format == FMT_H264){
|
||||
CHECKED_ALLOCZ(pic->mb_type_base , big_mb_num * sizeof(uint16_t))
|
||||
pic->mb_type= pic->mb_type_base + s->mb_width+2;
|
||||
for(i=0; i<2; i++){
|
||||
CHECKED_ALLOCZ(pic->motion_val[i], 2 * 16 * s->mb_num * sizeof(uint16_t))
|
||||
CHECKED_ALLOCZ(pic->ref_index[i] , 4 * s->mb_num * sizeof(uint8_t))
|
||||
}
|
||||
}
|
||||
pic->qstride= s->mb_width;
|
||||
}
|
||||
|
||||
@ -298,6 +308,12 @@ static void free_picture(MpegEncContext *s, Picture *pic){
|
||||
av_freep(&pic->mb_cmp_score);
|
||||
av_freep(&pic->mbskip_table);
|
||||
av_freep(&pic->qscale_table);
|
||||
av_freep(&pic->mb_type_base);
|
||||
pic->mb_type= NULL;
|
||||
for(i=0; i<2; i++){
|
||||
av_freep(&pic->motion_val[i]);
|
||||
av_freep(&pic->ref_index[i]);
|
||||
}
|
||||
|
||||
if(pic->type == FF_BUFFER_TYPE_INTERNAL){
|
||||
for(i=0; i<4; i++){
|
||||
@ -855,7 +871,7 @@ static int find_unused_picture(MpegEncContext *s, int shared){
|
||||
}
|
||||
}else{
|
||||
for(i=0; i<MAX_PICTURE_COUNT; i++){
|
||||
if(s->picture[i].data[0]==NULL && s->picture[i].type!=0) break;
|
||||
if(s->picture[i].data[0]==NULL && s->picture[i].type!=0) break; //FIXME
|
||||
}
|
||||
for(i=0; i<MAX_PICTURE_COUNT; i++){
|
||||
if(s->picture[i].data[0]==NULL) break;
|
||||
@ -874,6 +890,8 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
|
||||
|
||||
s->mb_skiped = 0;
|
||||
|
||||
assert(s->last_picture_ptr==NULL || s->out_format != FMT_H264);
|
||||
|
||||
/* mark&release old frames */
|
||||
if (s->pict_type != B_TYPE && s->last_picture_ptr) {
|
||||
avctx->release_buffer(avctx, (AVFrame*)s->last_picture_ptr);
|
||||
@ -895,7 +913,7 @@ alloc:
|
||||
i= find_unused_picture(s, 0);
|
||||
|
||||
pic= (AVFrame*)&s->picture[i];
|
||||
pic->reference= s->pict_type != B_TYPE;
|
||||
pic->reference= s->pict_type != B_TYPE ? 3 : 0;
|
||||
|
||||
if(s->current_picture_ptr)
|
||||
pic->coded_picture_number= s->current_picture_ptr->coded_picture_number+1;
|
||||
@ -905,11 +923,12 @@ alloc:
|
||||
s->current_picture_ptr= &s->picture[i];
|
||||
}
|
||||
|
||||
s->current_picture= *s->current_picture_ptr;
|
||||
if(s->out_format != FMT_H264){
|
||||
if (s->pict_type != B_TYPE) {
|
||||
s->last_picture_ptr= s->next_picture_ptr;
|
||||
s->next_picture_ptr= s->current_picture_ptr;
|
||||
}
|
||||
s->current_picture= *s->current_picture_ptr;
|
||||
if(s->last_picture_ptr) s->last_picture= *s->last_picture_ptr;
|
||||
if(s->next_picture_ptr) s->next_picture= *s->next_picture_ptr;
|
||||
if(s->new_picture_ptr ) s->new_picture = *s->new_picture_ptr;
|
||||
@ -931,6 +950,7 @@ alloc:
|
||||
assert(s->pict_type != B_TYPE); //these should have been dropped if we dont have a reference
|
||||
goto alloc;
|
||||
}
|
||||
}
|
||||
|
||||
s->hurry_up= s->avctx->hurry_up;
|
||||
s->error_resilience= avctx->error_resilience;
|
||||
@ -1059,7 +1079,7 @@ static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg){
|
||||
i= find_unused_picture(s, 1);
|
||||
|
||||
pic= (AVFrame*)&s->picture[i];
|
||||
pic->reference= 1;
|
||||
pic->reference= 3;
|
||||
|
||||
for(i=0; i<4; i++){
|
||||
pic->data[i]= pic_arg->data[i];
|
||||
@ -1070,7 +1090,7 @@ static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg){
|
||||
i= find_unused_picture(s, 0);
|
||||
|
||||
pic= (AVFrame*)&s->picture[i];
|
||||
pic->reference= 1;
|
||||
pic->reference= 3;
|
||||
|
||||
alloc_picture(s, (Picture*)pic, 0);
|
||||
for(i=0; i<4; i++){
|
||||
@ -1215,7 +1235,7 @@ static void select_input_picture(MpegEncContext *s){
|
||||
}
|
||||
|
||||
if(s->reordered_input_picture[0]){
|
||||
s->reordered_input_picture[0]->reference= s->reordered_input_picture[0]->pict_type!=B_TYPE;
|
||||
s->reordered_input_picture[0]->reference= s->reordered_input_picture[0]->pict_type!=B_TYPE ? 3 : 0;
|
||||
|
||||
s->new_picture= *s->reordered_input_picture[0];
|
||||
|
||||
@ -3944,6 +3964,8 @@ char ff_get_pict_type_char(int pict_type){
|
||||
case P_TYPE: return 'P';
|
||||
case B_TYPE: return 'B';
|
||||
case S_TYPE: return 'S';
|
||||
case SI_TYPE:return 'i';
|
||||
case SP_TYPE:return 'p';
|
||||
default: return '?';
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ enum OutputFormat {
|
||||
FMT_MPEG1,
|
||||
FMT_H263,
|
||||
FMT_MJPEG,
|
||||
FMT_H264,
|
||||
};
|
||||
|
||||
#define EDGE_WIDTH 16
|
||||
@ -59,6 +60,8 @@ enum OutputFormat {
|
||||
#define P_TYPE FF_P_TYPE ///< Predicted
|
||||
#define B_TYPE FF_B_TYPE ///< Bi-dir predicted
|
||||
#define S_TYPE FF_S_TYPE ///< S(GMC)-VOP MPEG4
|
||||
#define SI_TYPE FF_SI_TYPE ///< Switching Intra
|
||||
#define SP_TYPE FF_SP_TYPE ///< Switching Predicted
|
||||
|
||||
typedef struct Predictor{
|
||||
double coeff;
|
||||
@ -127,6 +130,57 @@ typedef struct ScanTable{
|
||||
typedef struct Picture{
|
||||
FF_COMMON_FRAME
|
||||
|
||||
/**
|
||||
* halfpel luma planes.
|
||||
*/
|
||||
uint8_t *interpolated[3];
|
||||
|
||||
int16_t (*motion_val[2])[2];
|
||||
int8_t *ref_index[2];
|
||||
uint16_t *mb_type_base;
|
||||
uint16_t *mb_type; ///< mb_type_base + mb_width + 2
|
||||
#define MB_TYPE_INTRA4x4 0x0001
|
||||
#define MB_TYPE_INTRA16x16 0x0002
|
||||
#define MB_TYPE_INTRA_PCM 0x0004
|
||||
#define MB_TYPE_16x16 0x0008
|
||||
#define MB_TYPE_16x8 0x0010
|
||||
#define MB_TYPE_8x16 0x0020
|
||||
#define MB_TYPE_8x8 0x0040
|
||||
#define MB_TYPE_INTERLACED 0x0080
|
||||
#define MB_TYPE_DIRECT2 0x0100 //FIXME
|
||||
#define MB_TYPE_REF0 0x0200
|
||||
#define MB_TYPE_GMC2 0x0400 //FIXME
|
||||
#define MB_TYPE_P0L0 0x1000
|
||||
#define MB_TYPE_P1L0 0x2000
|
||||
#define MB_TYPE_P0L1 0x4000
|
||||
#define MB_TYPE_P1L1 0x8000
|
||||
|
||||
#define IS_INTRA4x4(a) ((a)&MB_TYPE_INTRA4x4)
|
||||
#define IS_INTRA16x16(a) ((a)&MB_TYPE_INTRA16x16)
|
||||
#define IS_INTRA(a) ((a)&3)
|
||||
#define IS_INTER(a) ((a)&(MB_TYPE_16x16|MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_8x8))
|
||||
#define IS_INTRA_PCM(a) ((a)&MB_TYPE_INTRA_PCM)
|
||||
#define IS_INTERLACED(a) ((a)&MB_TYPE_INTERLACED)
|
||||
#define IS_DIRECT(a) ((a)&MB_TYPE_DIRECT2)
|
||||
#define IS_16X16(a) ((a)&MB_TYPE_16x16)
|
||||
#define IS_16X8(a) ((a)&MB_TYPE_16x8)
|
||||
#define IS_8X16(a) ((a)&MB_TYPE_8x16)
|
||||
#define IS_8X8(a) ((a)&MB_TYPE_8x8)
|
||||
#define IS_SUB_8X8(a) ((a)&MB_TYPE_16x16) //note reused
|
||||
#define IS_SUB_8X4(a) ((a)&MB_TYPE_16x8) //note reused
|
||||
#define IS_SUB_4X8(a) ((a)&MB_TYPE_8x16) //note reused
|
||||
#define IS_SUB_4X4(a) ((a)&MB_TYPE_8x8) //note reused
|
||||
#define IS_REF0(a) ((a)&MB_TYPE_REF0)
|
||||
#define IS_DIR(a, part, list) ((a) & (MB_TYPE_P0L0<<((part)+2*(list))))
|
||||
#define USES_LIST(a, list) ((a) & ((MB_TYPE_P0L0|MB_TYPE_P1L0)<<(2*(list)))) ///< does this mb use listX, note doesnt work if subMBs
|
||||
|
||||
|
||||
int field_poc[2]; ///< h264 top/bottom POC
|
||||
int poc; ///< h264 frame POC
|
||||
int frame_num; ///< h264 frame_num
|
||||
int pic_id; ///< h264 pic_num or long_term_pic_idx
|
||||
int long_ref; ///< 1->long term reference 0->short term reference
|
||||
|
||||
int mb_var_sum; ///< sum of MB variance for current frame
|
||||
int mc_mb_var_sum; ///< motion compensated MB variance for current frame
|
||||
uint16_t *mb_var; ///< Table for MB variances
|
||||
@ -267,6 +321,7 @@ typedef struct MpegEncContext {
|
||||
Picture *current_picture_ptr; ///< pointer to the current picture
|
||||
int last_dc[3]; ///< last DC values for MPEG1
|
||||
int16_t *dc_val[3]; ///< used for mpeg4 DC prediction, all 3 arrays must be continuous
|
||||
int16_t dc_cache[4*5];
|
||||
int y_dc_scale, c_dc_scale;
|
||||
uint8_t *y_dc_scale_table; ///< qscale -> y_dc_scale table
|
||||
uint8_t *c_dc_scale_table; ///< qscale -> c_dc_scale table
|
||||
@ -295,6 +350,7 @@ typedef struct MpegEncContext {
|
||||
/* motion compensation */
|
||||
int unrestricted_mv; ///< mv can point outside of the coded picture
|
||||
int h263_long_vectors; ///< use horrible h263v1 long vector mode
|
||||
int decode; ///< if 0 then decoding will be skiped (for encoding b frames for example)
|
||||
|
||||
DSPContext dsp; ///< pointers for accelerated dsp fucntions
|
||||
int f_code; ///< forward MV resolution
|
||||
@ -470,9 +526,9 @@ typedef struct MpegEncContext {
|
||||
int enhancement_type;
|
||||
int new_pred;
|
||||
int reduced_res_vop;
|
||||
int aspect_ratio_info;
|
||||
int aspected_width;
|
||||
int aspected_height;
|
||||
int aspect_ratio_info; //FIXME remove
|
||||
int aspected_width; //FIXME remove
|
||||
int aspected_height; //FIXME remove
|
||||
int sprite_warping_accuracy;
|
||||
int low_latency_sprite;
|
||||
int data_partitioning; ///< data partitioning flag from header
|
||||
@ -546,6 +602,7 @@ typedef struct MpegEncContext {
|
||||
int fake_picture_number; ///< picture number at the bitstream frame rate
|
||||
int gop_picture_number; ///< index of the first picture of a GOP based on fake_pic_num & mpeg1 specific
|
||||
int last_mv_dir; ///< last mv_dir, used for b frame encoding
|
||||
int broken_link; ///< no_output_of_prior_pics_flag
|
||||
|
||||
/* MPEG2 specific - I wish I had not to support this mess. */
|
||||
int progressive_sequence;
|
||||
|
@ -280,6 +280,31 @@ AVOutputFormat m4v_oformat = {
|
||||
raw_write_trailer,
|
||||
};
|
||||
|
||||
AVInputFormat h264_iformat = {
|
||||
"h264",
|
||||
"raw H264 video format",
|
||||
0,
|
||||
NULL /*mpegvideo_probe*/,
|
||||
video_read_header,
|
||||
raw_read_packet,
|
||||
raw_read_close,
|
||||
.extensions = "h26l,h264", //FIXME remove after writing mpeg4_probe
|
||||
.value = CODEC_ID_H264,
|
||||
};
|
||||
|
||||
AVOutputFormat h264_oformat = {
|
||||
"h264",
|
||||
"raw H264 video format",
|
||||
NULL,
|
||||
"h264",
|
||||
0,
|
||||
CODEC_ID_NONE,
|
||||
CODEC_ID_H264,
|
||||
raw_write_header,
|
||||
raw_write_packet,
|
||||
raw_write_trailer,
|
||||
};
|
||||
|
||||
AVInputFormat mpegvideo_iformat = {
|
||||
"mpegvideo",
|
||||
"MPEG video",
|
||||
@ -495,6 +520,9 @@ int raw_init(void)
|
||||
av_register_input_format(&m4v_iformat);
|
||||
av_register_output_format(&m4v_oformat);
|
||||
|
||||
av_register_input_format(&h264_iformat);
|
||||
av_register_output_format(&h264_oformat);
|
||||
|
||||
av_register_input_format(&mpegvideo_iformat);
|
||||
av_register_output_format(&mpeg1video_oformat);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user