From 451b4b86355216ee4b255ca86ea578864127e03a Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sat, 29 Jan 2011 17:14:29 +0000 Subject: Rearrange MpegEncContext to simplify access from asm This moves the fields needed by asm near the top, before any structs or other members which complicate the offset calculation. Modifying other structs will no longer require updating the offsets, and the asm code is slightly simpler due to the smaller offsets. Signed-off-by: Mans Rullgard (cherry picked from commit d461a4731781e492d83ef254f9c0fbd0ce6e47eb) --- libavcodec/mpegvideo.h | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'libavcodec/mpegvideo.h') diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 8cd20b7..53ab0f4 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -224,9 +224,6 @@ typedef struct MpegEncContext { int stream_codec_tag; ///< internal stream_codec_tag upper case converted from avctx stream_codec_tag /* the following fields are managed internally by the encoder */ - /** bit output */ - PutBitContext pb; - /* sequence parameters */ int context_initialized; int input_picture_number; ///< used to set pic->display_picture_number, should not be used for/by anything else @@ -247,6 +244,23 @@ typedef struct MpegEncContext { Picture **input_picture; ///< next pictures on display order for encoding Picture **reordered_input_picture; ///< pointer to the next pictures in codedorder for encoding + int y_dc_scale, c_dc_scale; + int ac_pred; + int block_last_index[12]; ///< last non zero coefficient in block + int h263_aic; ///< Advanded INTRA Coding (AIC) + + /* scantables */ + ScanTable inter_scantable; ///< if inter == intra then intra should be used to reduce tha cache usage + ScanTable intra_scantable; + ScanTable intra_h_scantable; + ScanTable intra_v_scantable; + + /* WARNING: changes above this line require updates to hardcoded + * offsets used in asm. */ + + /** bit output */ + PutBitContext pb; + int start_mb_y; ///< start mb_y of this thread (so current thread should process start_mb_y <= row < end_mb_y) int end_mb_y; ///< end mb_y of this thread (so current thread should process start_mb_y <= row < end_mb_y) struct MpegEncContext *thread_context[MAX_THREADS]; @@ -283,7 +297,6 @@ typedef struct MpegEncContext { int16_t *dc_val_base; 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; const uint8_t *y_dc_scale_table; ///< qscale -> y_dc_scale table const uint8_t *c_dc_scale_table; ///< qscale -> c_dc_scale table const uint8_t *chroma_qscale_table; ///< qscale -> chroma_qscale (h263) @@ -291,7 +304,6 @@ typedef struct MpegEncContext { uint8_t *coded_block; ///< used for coded block pattern prediction (msmpeg4v3, wmv1) int16_t (*ac_val_base)[16]; int16_t (*ac_val[3])[16]; ///< used for for mpeg4 AC prediction, all 3 arrays must be continuous - int ac_pred; uint8_t *prev_pict_types; ///< previous picture types in bitstream order, used for mb skip #define PREV_PICT_TYPES_BUFFER_SIZE 256 int mb_skipped; ///< MUST BE SET only during DECODING @@ -434,12 +446,6 @@ typedef struct MpegEncContext { /** identical to the above but for MMX & these are not permutated, second 64 entries are bias*/ uint16_t (*q_intra_matrix16)[2][64]; uint16_t (*q_inter_matrix16)[2][64]; - int block_last_index[12]; ///< last non zero coefficient in block - /* scantables */ - ScanTable intra_scantable; - ScanTable intra_h_scantable; - ScanTable intra_v_scantable; - ScanTable inter_scantable; ///< if inter == intra then intra should be used to reduce tha cache usage /* noise reduction */ int (*dct_error_sum)[64]; @@ -495,7 +501,6 @@ typedef struct MpegEncContext { /* H.263+ specific */ int umvplus; ///< == H263+ && unrestricted_mv - int h263_aic; ///< Advanded INTRA Coding (AIC) int h263_aic_dir; ///< AIC direction: 0 = left, 1 = top int h263_slice_structured; int alt_inter_vlc; ///< alternative inter vlc -- cgit v1.1