summaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideo.h
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2003-04-10 13:18:38 +0000
committerMichael Niedermayer <michaelni@gmx.at>2003-04-10 13:18:38 +0000
commit7bc9090a4176de2bc834e2a7df131047b944f3b5 (patch)
tree1d57ac078ac227d652202cc1077ac565b8e36122 /libavcodec/mpegvideo.h
parent84876d36774b6633c2950291fbfb3db5922273fb (diff)
simplified adressing of most mb based arrays (mb_x + mb_y*s->mb_stride) now instead of mb_x + mb_y*mb_width and 1+mb_x + (1+mb_y)*(mb_width+2) and ... mixture
more direct use of the new mb_type stuff instead of codec specific stuff runtime mb_type debug output h264/h263 variants/mpeg1/2/4 error concealment /resilience for mpeg1/2 various minor optimizations Originally committed as revision 1746 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpegvideo.h')
-rw-r--r--libavcodec/mpegvideo.h48
1 files changed, 33 insertions, 15 deletions
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 9b0df2856b..dc15a51f89 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -137,31 +137,40 @@ typedef struct Picture{
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
+ uint32_t *mb_type_base;
+ uint32_t *mb_type; ///< mb_type_base + mb_width + 2, note: only used for decoding currently
#define MB_TYPE_INTRA4x4 0x0001
-#define MB_TYPE_INTRA16x16 0x0002
-#define MB_TYPE_INTRA_PCM 0x0004
+#define MB_TYPE_INTRA16x16 0x0002 //FIXME h264 specific
+#define MB_TYPE_INTRA_PCM 0x0004 //FIXME h264 specific
#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_ACPRED 0x0200
+#define MB_TYPE_GMC 0x0400 //FIXME mpeg4 specific
+#define MB_TYPE_SKIP 0x0800
#define MB_TYPE_P0L0 0x1000
#define MB_TYPE_P1L0 0x2000
#define MB_TYPE_P0L1 0x4000
#define MB_TYPE_P1L1 0x8000
+#define MB_TYPE_L0 (MB_TYPE_P0L0 | MB_TYPE_P1L0)
+#define MB_TYPE_L1 (MB_TYPE_P0L1 | MB_TYPE_P1L1)
+#define MB_TYPE_L0L1 (MB_TYPE_L0 | MB_TYPE_L1)
+#define MB_TYPE_QUANT 0x00010000
+//Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 pat, ...)
#define IS_INTRA4x4(a) ((a)&MB_TYPE_INTRA4x4)
#define IS_INTRA16x16(a) ((a)&MB_TYPE_INTRA16x16)
-#define IS_INTRA(a) ((a)&3)
+#define IS_PCM(a) ((a)&MB_TYPE_INTRA_PCM)
+#define IS_INTRA(a) ((a)&7)
#define IS_INTER(a) ((a)&(MB_TYPE_16x16|MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_8x8))
+#define IS_SKIP(a) ((a)&MB_TYPE_SKIP)
#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_GMC(a) ((a)&MB_TYPE_GMC)
#define IS_16X16(a) ((a)&MB_TYPE_16x16)
#define IS_16X8(a) ((a)&MB_TYPE_16x8)
#define IS_8X16(a) ((a)&MB_TYPE_8x16)
@@ -170,7 +179,8 @@ typedef struct Picture{
#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_ACPRED(a) ((a)&MB_TYPE_ACPRED)
+#define IS_QUANT(a) ((a)&MB_TYPE_QUANT)
#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
@@ -283,6 +293,7 @@ typedef struct MpegEncContext {
int picture_in_gop_number; ///< 0-> first pic in gop, ...
int b_frames_since_non_b; ///< used for encoding, relative to not yet reordered input
int mb_width, mb_height; ///< number of MBs horizontally & vertically
+ int mb_stride; ///< mb_width+1 used for some arrays to allow simple addressng of left & top MBs withoutt sig11
int h_edge_pos, v_edge_pos;///< horizontal / vertical position of the right/bottom edge (pixel replicateion)
int mb_num; ///< number of MBs of a picture
int linesize; ///< line size, in bytes, may be different from width
@@ -355,7 +366,13 @@ typedef struct MpegEncContext {
DSPContext dsp; ///< pointers for accelerated dsp fucntions
int f_code; ///< forward MV resolution
int b_code; ///< backward MV resolution for B Frames (mpeg4)
- int16_t (*motion_val)[2]; ///< used for MV prediction (4MV per MB)
+ int16_t (*motion_val)[2];
+ int16_t (*p_mv_table_base)[2];
+ int16_t (*b_forw_mv_table_base)[2];
+ int16_t (*b_back_mv_table_base)[2];
+ int16_t (*b_bidir_forw_mv_table_base)[2];
+ int16_t (*b_bidir_back_mv_table_base)[2];
+ int16_t (*b_direct_mv_table_base)[2];
int16_t (*p_mv_table)[2]; ///< MV table (1MV per MB) p-frame encoding
int16_t (*b_forw_mv_table)[2]; ///< MV table (1MV per MB) forward mode b-frame encoding
int16_t (*b_back_mv_table)[2]; ///< MV table (1MV per MB) backward mode b-frame encoding
@@ -396,12 +413,12 @@ typedef struct MpegEncContext {
int mb_x, mb_y;
int mb_skip_run;
int mb_intra;
- uint8_t *mb_type; ///< Table for MB type
+ uint8_t *mb_type; ///< Table for MB type FIXME remove and use picture->mb_type
#define MB_TYPE_INTRA 0x01
#define MB_TYPE_INTER 0x02
#define MB_TYPE_INTER4V 0x04
#define MB_TYPE_SKIPED 0x08
-#define MB_TYPE_GMC 0x10
+//#define MB_TYPE_GMC 0x10
#define MB_TYPE_DIRECT 0x10
#define MB_TYPE_FORWARD 0x20
@@ -410,6 +427,8 @@ typedef struct MpegEncContext {
int block_index[6]; ///< index to current MB in block based arrays with edges
int block_wrap[6];
+
+ int *mb_index2xy; ///< mb_index -> mb_x + mb_y*mb_stride
/** matrix transmitted in the bitstream */
uint16_t intra_matrix[64];
@@ -467,6 +486,7 @@ typedef struct MpegEncContext {
int last_bits; ///< temp var used for calculating the above vars
/* error concealment / resync */
+ int error_count;
uint8_t *error_status_table; ///< table of the error status of each MB
#define VP_START 1 ///< current MB is the first after a resync marker
#define AC_ERROR 2
@@ -544,9 +564,6 @@ typedef struct MpegEncContext {
uint8_t *tex_pb_buffer;
uint8_t *pb2_buffer;
int mpeg_quant;
-#define CO_LOCATED_TYPE_4MV 1
-#define CO_LOCATED_TYPE_FIELDMV 2
- int8_t *co_located_type_table; ///< 4mv & field_mv info for next b frame
int16_t (*field_mv_table)[2][2]; ///< used for interlaced b frame decoding
int8_t (*field_select_table)[2]; ///< wtf, no really another table for interlaced b frames
int t_frame; ///< time distance of first I -> B, used for interlaced b frames
@@ -693,6 +710,7 @@ void ff_emulated_edge_mc(MpegEncContext *s, uint8_t *src, int linesize, int bloc
int src_x, int src_y, int w, int h);
char ff_get_pict_type_char(int pict_type);
int ff_combine_frame( MpegEncContext *s, int next, uint8_t **buf, int *buf_size);
+void ff_print_debug_info(MpegEncContext *s, Picture *pict);
void ff_er_frame_start(MpegEncContext *s);
void ff_er_frame_end(MpegEncContext *s);
@@ -827,7 +845,7 @@ int ff_mpeg4_decode_partitions(MpegEncContext *s);
int ff_mpeg4_get_video_packet_prefix_length(MpegEncContext *s);
int ff_h263_resync(MpegEncContext *s);
int ff_h263_get_gob_height(MpegEncContext *s);
-void ff_mpeg4_set_direct_mv(MpegEncContext *s, int mx, int my);
+int ff_mpeg4_set_direct_mv(MpegEncContext *s, int mx, int my);
inline int ff_h263_round_chroma(int x);