Commit c9038784 authored by michael's avatar michael

Split H263 encoder and decoder from common code.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@21109 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 0dbd5a88
...@@ -124,11 +124,11 @@ OBJS-$(CONFIG_H261_ENCODER) += h261enc.o h261.o \ ...@@ -124,11 +124,11 @@ OBJS-$(CONFIG_H261_ENCODER) += h261enc.o h261.o \
mpegvideo_enc.o motion_est.o \ mpegvideo_enc.o motion_est.o \
ratecontrol.o mpeg12data.o \ ratecontrol.o mpeg12data.o \
mpegvideo.o mpegvideo.o
OBJS-$(CONFIG_H263_DECODER) += h263dec.o h263.o mpeg4video.o mpeg4videodec.o flvdec.o intelh263dec.o \ OBJS-$(CONFIG_H263_DECODER) += h263dec.o h263.o ituh263dec.o mpeg4video.o mpeg4videodec.o flvdec.o intelh263dec.o \
mpegvideo.o error_resilience.o mpegvideo.o error_resilience.o
OBJS-$(CONFIG_H263_VAAPI_HWACCEL) += vaapi_mpeg4.o OBJS-$(CONFIG_H263_VAAPI_HWACCEL) += vaapi_mpeg4.o
OBJS-$(CONFIG_H263_ENCODER) += mpegvideo_enc.o mpeg4video.o mpeg4videoenc.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 \ ratecontrol.o h263.o ituh263enc.o flvenc.o mpeg12data.o \
mpegvideo.o error_resilience.o mpegvideo.o error_resilience.o
OBJS-$(CONFIG_H264_DECODER) += h264.o h264idct.o h264pred.o cabac.o \ OBJS-$(CONFIG_H264_DECODER) += h264.o h264idct.o h264pred.o cabac.o \
mpegvideo.o error_resilience.o mpegvideo.o error_resilience.o
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
#include "mpegvideo.h" #include "mpegvideo.h"
#include "h263.h"
#include "flv.h" #include "flv.h"
void ff_flv2_decode_ac_esc(GetBitContext *gb, int *level, int *run, int *last){ void ff_flv2_decode_ac_esc(GetBitContext *gb, int *level, int *run, int *last){
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
#include "mpegvideo.h" #include "mpegvideo.h"
#include "h263.h"
#include "flv.h" #include "flv.h"
void ff_flv_encode_picture_header(MpegEncContext * s, int picture_number) void ff_flv_encode_picture_header(MpegEncContext * s, int picture_number)
......
This diff is collapsed.
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
extern const AVRational ff_h263_pixel_aspect[16]; extern const AVRational ff_h263_pixel_aspect[16];
extern const uint8_t ff_h263_cbpy_tab[16][2]; extern const uint8_t ff_h263_cbpy_tab[16][2];
extern const uint8_t cbpc_b_tab[4][2];
extern const uint8_t mvtab[33][2]; extern const uint8_t mvtab[33][2];
extern const uint8_t ff_h263_intra_MCBPC_code[9]; extern const uint8_t ff_h263_intra_MCBPC_code[9];
...@@ -39,6 +41,7 @@ extern const uint8_t ff_h263_intra_MCBPC_bits[9]; ...@@ -39,6 +41,7 @@ extern const uint8_t ff_h263_intra_MCBPC_bits[9];
extern const uint8_t ff_h263_inter_MCBPC_code[28]; extern const uint8_t ff_h263_inter_MCBPC_code[28];
extern const uint8_t ff_h263_inter_MCBPC_bits[28]; extern const uint8_t ff_h263_inter_MCBPC_bits[28];
extern const uint8_t h263_mbtype_b_tab[15][2];
extern VLC ff_h263_intra_MCBPC_vlc; extern VLC ff_h263_intra_MCBPC_vlc;
extern VLC ff_h263_inter_MCBPC_vlc; extern VLC ff_h263_inter_MCBPC_vlc;
...@@ -46,8 +49,66 @@ extern VLC ff_h263_cbpy_vlc; ...@@ -46,8 +49,66 @@ extern VLC ff_h263_cbpy_vlc;
extern RLTable ff_h263_rl_inter; extern RLTable ff_h263_rl_inter;
extern RLTable rl_intra_aic;
extern const uint16_t h263_format[8][2];
extern const uint8_t modified_quant_tab[2][32];
extern uint16_t ff_mba_max[6];
extern uint8_t ff_mba_length[7];
extern uint8_t ff_h263_static_rl_table_store[2][2][2*MAX_RUN + MAX_LEVEL + 3];
int h263_decode_motion(MpegEncContext * s, int pred, int f_code); int h263_decode_motion(MpegEncContext * s, int pred, int f_code);
av_const int ff_h263_aspect_to_info(AVRational aspect); av_const int ff_h263_aspect_to_info(AVRational aspect);
int ff_h263_decode_init(AVCodecContext *avctx);
int ff_h263_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
AVPacket *avpkt);
int ff_h263_decode_end(AVCodecContext *avctx);
void h263_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 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);
void ff_h263_update_motion_val(MpegEncContext * s);
void ff_h263_loop_filter(MpegEncContext * s);
void ff_set_qscale(MpegEncContext * s, int qscale);
int ff_h263_decode_mba(MpegEncContext *s);
void ff_h263_encode_mba(MpegEncContext *s);
void ff_init_qscale_tab(MpegEncContext *s);
int h263_pred_dc(MpegEncContext * s, int n, int16_t **dc_val_ptr);
void h263_pred_acdc(MpegEncContext * s, DCTELEM *block, int n);
/**
* Prints picture info if FF_DEBUG_PICT_INFO is set.
*/
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]);
/**
* Returns the value of the 3bit "source format" syntax element.
* that represents some standard picture dimensions or indicates that
* width&height are explicitly stored later.
*/
int av_const h263_get_picture_format(int width, int height);
void ff_clean_h263_qscales(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);
void ff_h263_encode_motion(MpegEncContext * s, int val, int f_code);
static inline int h263_get_motion_length(MpegEncContext * s, int val, int f_code){ static inline int h263_get_motion_length(MpegEncContext * s, int val, int f_code){
int l, bit_size, code; int l, bit_size, code;
...@@ -175,4 +236,11 @@ static inline int get_b_cbp(MpegEncContext * s, DCTELEM block[6][64], ...@@ -175,4 +236,11 @@ static inline int get_b_cbp(MpegEncContext * s, DCTELEM block[6][64],
} }
return cbp; return cbp;
} }
static inline void memsetw(short *tab, int val, int n)
{
int i;
for(i=0;i<n;i++)
tab[i] = val;
}
#endif #endif
...@@ -57,7 +57,7 @@ const uint8_t ff_h263_inter_MCBPC_bits[28] = { ...@@ -57,7 +57,7 @@ const uint8_t ff_h263_inter_MCBPC_bits[28] = {
11, 13, 13, 13,/* inter4Q*/ 11, 13, 13, 13,/* inter4Q*/
}; };
static const uint8_t h263_mbtype_b_tab[15][2] = { const uint8_t h263_mbtype_b_tab[15][2] = {
{1, 1}, {1, 1},
{3, 3}, {3, 3},
{1, 5}, {1, 5},
...@@ -75,25 +75,7 @@ static const uint8_t h263_mbtype_b_tab[15][2] = { ...@@ -75,25 +75,7 @@ static const uint8_t h263_mbtype_b_tab[15][2] = {
{1, 8}, {1, 8},
}; };
static const int h263_mb_type_b_map[15]= { const uint8_t cbpc_b_tab[4][2] = {
MB_TYPE_DIRECT2 | MB_TYPE_L0L1,
MB_TYPE_DIRECT2 | MB_TYPE_L0L1 | MB_TYPE_CBP,
MB_TYPE_DIRECT2 | MB_TYPE_L0L1 | MB_TYPE_CBP | MB_TYPE_QUANT,
MB_TYPE_L0 | MB_TYPE_16x16,
MB_TYPE_L0 | MB_TYPE_CBP | MB_TYPE_16x16,
MB_TYPE_L0 | MB_TYPE_CBP | MB_TYPE_QUANT | MB_TYPE_16x16,
MB_TYPE_L1 | MB_TYPE_16x16,
MB_TYPE_L1 | MB_TYPE_CBP | MB_TYPE_16x16,
MB_TYPE_L1 | MB_TYPE_CBP | MB_TYPE_QUANT | MB_TYPE_16x16,
MB_TYPE_L0L1 | MB_TYPE_16x16,
MB_TYPE_L0L1 | MB_TYPE_CBP | MB_TYPE_16x16,
MB_TYPE_L0L1 | MB_TYPE_CBP | MB_TYPE_QUANT | MB_TYPE_16x16,
0, //stuffing
MB_TYPE_INTRA4x4 | MB_TYPE_CBP,
MB_TYPE_INTRA4x4 | MB_TYPE_CBP | MB_TYPE_QUANT,
};
static const uint8_t cbpc_b_tab[4][2] = {
{0, 1}, {0, 1},
{2, 2}, {2, 2},
{7, 3}, {7, 3},
...@@ -246,7 +228,7 @@ static const int8_t intra_level_aic[102] = { ...@@ -246,7 +228,7 @@ static const int8_t intra_level_aic[102] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
}; };
static RLTable rl_intra_aic = { RLTable rl_intra_aic = {
102, 102,
58, 58,
intra_vlc_aic, intra_vlc_aic,
...@@ -254,25 +236,7 @@ static RLTable rl_intra_aic = { ...@@ -254,25 +236,7 @@ static RLTable rl_intra_aic = {
intra_level_aic, intra_level_aic,
}; };
#if CONFIG_ENCODERS const uint16_t h263_format[8][2] = {
static const uint8_t wrong_run[102] = {
1, 2, 3, 5, 4, 10, 9, 8,
11, 15, 17, 16, 23, 22, 21, 20,
19, 18, 25, 24, 27, 26, 11, 7,
6, 1, 2, 13, 2, 2, 2, 2,
6, 12, 3, 9, 1, 3, 4, 3,
7, 4, 1, 1, 5, 5, 14, 6,
1, 7, 1, 8, 1, 1, 1, 1,
10, 1, 1, 5, 9, 17, 25, 24,
29, 33, 32, 41, 2, 23, 28, 31,
3, 22, 30, 4, 27, 40, 8, 26,
6, 39, 7, 38, 16, 37, 15, 10,
11, 12, 13, 14, 1, 21, 20, 18,
19, 2, 1, 34, 35, 36
};
#endif
static const uint16_t h263_format[8][2] = {
{ 0, 0 }, { 0, 0 },
{ 128, 96 }, { 128, 96 },
{ 176, 144 }, { 176, 144 },
...@@ -286,7 +250,7 @@ const uint8_t ff_aic_dc_scale_table[32]={ ...@@ -286,7 +250,7 @@ const uint8_t ff_aic_dc_scale_table[32]={
0, 2, 4, 6, 8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62 0, 2, 4, 6, 8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62
}; };
static const uint8_t modified_quant_tab[2][32]={ const uint8_t modified_quant_tab[2][32]={
// 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 30 31 // 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 30 31
{ {
0, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9,10,11,12,13,14,15,16,17,18,18,19,20,21,22,23,24,25,26,27,28 0, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9,10,11,12,13,14,15,16,17,18,18,19,20,21,22,23,24,25,26,27,28
...@@ -300,11 +264,11 @@ const uint8_t ff_h263_chroma_qscale_table[32]={ ...@@ -300,11 +264,11 @@ const uint8_t ff_h263_chroma_qscale_table[32]={
0, 1, 2, 3, 4, 5, 6, 6, 7, 8, 9, 9,10,10,11,11,12,12,12,13,13,13,14,14,14,14,14,15,15,15,15,15 0, 1, 2, 3, 4, 5, 6, 6, 7, 8, 9, 9,10,10,11,11,12,12,12,13,13,13,14,14,14,14,14,15,15,15,15,15
}; };
const uint16_t ff_mba_max[6]={ uint16_t ff_mba_max[6]={
47, 98, 395,1583,6335,9215 47, 98, 395,1583,6335,9215
}; };
const uint8_t ff_mba_length[7]={ uint8_t ff_mba_length[7]={
6, 7, 9, 11, 13, 14, 14 6, 7, 9, 11, 13, 14, 14
}; };
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "avcodec.h" #include "avcodec.h"
#include "dsputil.h" #include "dsputil.h"
#include "mpegvideo.h" #include "mpegvideo.h"
#include "h263.h"
#include "h263_parser.h" #include "h263_parser.h"
#include "mpeg4video_parser.h" #include "mpeg4video_parser.h"
#include "msmpeg4.h" #include "msmpeg4.h"
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
*/ */
#include "mpegvideo.h" #include "mpegvideo.h"
#include "h263.h"
/* don't understand why they choose a different header ! */ /* don't understand why they choose a different header ! */
int ff_intel_h263_decode_picture_header(MpegEncContext *s) int ff_intel_h263_decode_picture_header(MpegEncContext *s)
......
This diff is collapsed.
This diff is collapsed.
...@@ -797,53 +797,6 @@ void ff_h261_encode_init(MpegEncContext *s); ...@@ -797,53 +797,6 @@ void ff_h261_encode_init(MpegEncContext *s);
int ff_h261_get_picture_format(int width, int height); int ff_h261_get_picture_format(int width, int height);
/* h263.c, h263dec.c */
int ff_h263_decode_init(AVCodecContext *avctx);
int ff_h263_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
AVPacket *avpkt);
int ff_h263_decode_end(AVCodecContext *avctx);
void h263_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 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);
void ff_h263_update_motion_val(MpegEncContext * s);
void ff_h263_loop_filter(MpegEncContext * s);
void ff_set_qscale(MpegEncContext * s, int qscale);
int ff_h263_decode_mba(MpegEncContext *s);
void ff_h263_encode_mba(MpegEncContext *s);
/**
* Prints picture info if FF_DEBUG_PICT_INFO is set.
*/
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]);
/**
* Returns the value of the 3bit "source format" syntax element.
* that represents some standard picture dimensions or indicates that
* width&height are explicitly stored later.
*/
int av_const h263_get_picture_format(int width, int height);
void ff_clean_h263_qscales(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);
void ff_h263_encode_motion(MpegEncContext * s, int val, int f_code);
void ff_init_qscale_tab(MpegEncContext *s);
/* rv10.c */ /* rv10.c */
void rv10_encode_picture_header(MpegEncContext *s, int picture_number); void rv10_encode_picture_header(MpegEncContext *s, int picture_number);
int rv_decode_dc(MpegEncContext *s, int n); int rv_decode_dc(MpegEncContext *s, int n);
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "avcodec.h" #include "avcodec.h"
#include "dsputil.h" #include "dsputil.h"
#include "mpegvideo.h" #include "mpegvideo.h"
#include "h263.h"
//#define DEBUG //#define DEBUG
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "avcodec.h" #include "avcodec.h"
#include "dsputil.h" #include "dsputil.h"
#include "mpegvideo.h" #include "mpegvideo.h"
#include "h263.h"
#include "svq1.h" #include "svq1.h"
#include "svq1enc_cb.h" #include "svq1enc_cb.h"
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "avcodec.h" #include "avcodec.h"
#include "dsputil.h" #include "dsputil.h"
#include "mpegvideo.h" #include "mpegvideo.h"
#include "h263.h"
#include "mathops.h" #include "mathops.h"
#include "msmpeg4.h" #include "msmpeg4.h"
#include "msmpeg4data.h" #include "msmpeg4data.h"
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "mpegvideo.h" #include "mpegvideo.h"
#include "msmpeg4.h" #include "msmpeg4.h"
#include "msmpeg4data.h" #include "msmpeg4data.h"
#include "h263.h"
#include "wmv2.h" #include "wmv2.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment