00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00028 #ifndef AVCODEC_H264_H
00029 #define AVCODEC_H264_H
00030
00031 #include "libavutil/intreadwrite.h"
00032 #include "dsputil.h"
00033 #include "cabac.h"
00034 #include "mpegvideo.h"
00035 #include "h264dsp.h"
00036 #include "h264pred.h"
00037 #include "rectangle.h"
00038
00039 #define interlaced_dct interlaced_dct_is_a_bad_name
00040 #define mb_intra mb_intra_is_not_initialized_see_mb_type
00041
00042 #define LUMA_DC_BLOCK_INDEX 24
00043 #define CHROMA_DC_BLOCK_INDEX 25
00044
00045 #define CHROMA_DC_COEFF_TOKEN_VLC_BITS 8
00046 #define COEFF_TOKEN_VLC_BITS 8
00047 #define TOTAL_ZEROS_VLC_BITS 9
00048 #define CHROMA_DC_TOTAL_ZEROS_VLC_BITS 3
00049 #define RUN_VLC_BITS 3
00050 #define RUN7_VLC_BITS 6
00051
00052 #define MAX_SPS_COUNT 32
00053 #define MAX_PPS_COUNT 256
00054
00055 #define MAX_MMCO_COUNT 66
00056
00057 #define MAX_DELAYED_PIC_COUNT 16
00058
00059
00060
00061 #define ALLOW_INTERLACE
00062
00063 #define ALLOW_NOCHROMA
00064
00065 #define FMO 0
00066
00071 #define MAX_SLICES 16
00072
00073 #ifdef ALLOW_INTERLACE
00074 #define MB_MBAFF h->mb_mbaff
00075 #define MB_FIELD h->mb_field_decoding_flag
00076 #define FRAME_MBAFF h->mb_aff_frame
00077 #define FIELD_PICTURE (s->picture_structure != PICT_FRAME)
00078 #else
00079 #define MB_MBAFF 0
00080 #define MB_FIELD 0
00081 #define FRAME_MBAFF 0
00082 #define FIELD_PICTURE 0
00083 #undef IS_INTERLACED
00084 #define IS_INTERLACED(mb_type) 0
00085 #endif
00086 #define FIELD_OR_MBAFF_PICTURE (FRAME_MBAFF || FIELD_PICTURE)
00087
00088 #ifdef ALLOW_NOCHROMA
00089 #define CHROMA h->sps.chroma_format_idc
00090 #else
00091 #define CHROMA 1
00092 #endif
00093
00094 #ifndef CABAC
00095 #define CABAC h->pps.cabac
00096 #endif
00097
00098 #define EXTENDED_SAR 255
00099
00100 #define MB_TYPE_REF0 MB_TYPE_ACPRED //dirty but it fits in 16 bit
00101 #define MB_TYPE_8x8DCT 0x01000000
00102 #define IS_REF0(a) ((a) & MB_TYPE_REF0)
00103 #define IS_8x8DCT(a) ((a) & MB_TYPE_8x8DCT)
00104
00109 #define DELAYED_PIC_REF 4
00110
00111
00112
00113 enum {
00114 NAL_SLICE=1,
00115 NAL_DPA,
00116 NAL_DPB,
00117 NAL_DPC,
00118 NAL_IDR_SLICE,
00119 NAL_SEI,
00120 NAL_SPS,
00121 NAL_PPS,
00122 NAL_AUD,
00123 NAL_END_SEQUENCE,
00124 NAL_END_STREAM,
00125 NAL_FILLER_DATA,
00126 NAL_SPS_EXT,
00127 NAL_AUXILIARY_SLICE=19
00128 };
00129
00133 typedef enum {
00134 SEI_BUFFERING_PERIOD = 0,
00135 SEI_TYPE_PIC_TIMING = 1,
00136 SEI_TYPE_USER_DATA_UNREGISTERED = 5,
00137 SEI_TYPE_RECOVERY_POINT = 6
00138 } SEI_Type;
00139
00143 typedef enum {
00144 SEI_PIC_STRUCT_FRAME = 0,
00145 SEI_PIC_STRUCT_TOP_FIELD = 1,
00146 SEI_PIC_STRUCT_BOTTOM_FIELD = 2,
00147 SEI_PIC_STRUCT_TOP_BOTTOM = 3,
00148 SEI_PIC_STRUCT_BOTTOM_TOP = 4,
00149 SEI_PIC_STRUCT_TOP_BOTTOM_TOP = 5,
00150 SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM = 6,
00151 SEI_PIC_STRUCT_FRAME_DOUBLING = 7,
00152 SEI_PIC_STRUCT_FRAME_TRIPLING = 8
00153 } SEI_PicStructType;
00154
00158 typedef struct SPS{
00159
00160 int profile_idc;
00161 int level_idc;
00162 int chroma_format_idc;
00163 int transform_bypass;
00164 int log2_max_frame_num;
00165 int poc_type;
00166 int log2_max_poc_lsb;
00167 int delta_pic_order_always_zero_flag;
00168 int offset_for_non_ref_pic;
00169 int offset_for_top_to_bottom_field;
00170 int poc_cycle_length;
00171 int ref_frame_count;
00172 int gaps_in_frame_num_allowed_flag;
00173 int mb_width;
00174 int mb_height;
00175 int frame_mbs_only_flag;
00176 int mb_aff;
00177 int direct_8x8_inference_flag;
00178 int crop;
00179 unsigned int crop_left;
00180 unsigned int crop_right;
00181 unsigned int crop_top;
00182 unsigned int crop_bottom;
00183 int vui_parameters_present_flag;
00184 AVRational sar;
00185 int video_signal_type_present_flag;
00186 int full_range;
00187 int colour_description_present_flag;
00188 enum AVColorPrimaries color_primaries;
00189 enum AVColorTransferCharacteristic color_trc;
00190 enum AVColorSpace colorspace;
00191 int timing_info_present_flag;
00192 uint32_t num_units_in_tick;
00193 uint32_t time_scale;
00194 int fixed_frame_rate_flag;
00195 short offset_for_ref_frame[256];
00196 int bitstream_restriction_flag;
00197 int num_reorder_frames;
00198 int scaling_matrix_present;
00199 uint8_t scaling_matrix4[6][16];
00200 uint8_t scaling_matrix8[2][64];
00201 int nal_hrd_parameters_present_flag;
00202 int vcl_hrd_parameters_present_flag;
00203 int pic_struct_present_flag;
00204 int time_offset_length;
00205 int cpb_cnt;
00206 int initial_cpb_removal_delay_length;
00207 int cpb_removal_delay_length;
00208 int dpb_output_delay_length;
00209 int bit_depth_luma;
00210 int bit_depth_chroma;
00211 int residual_color_transform_flag;
00212 }SPS;
00213
00217 typedef struct PPS{
00218 unsigned int sps_id;
00219 int cabac;
00220 int pic_order_present;
00221 int slice_group_count;
00222 int mb_slice_group_map_type;
00223 unsigned int ref_count[2];
00224 int weighted_pred;
00225 int weighted_bipred_idc;
00226 int init_qp;
00227 int init_qs;
00228 int chroma_qp_index_offset[2];
00229 int deblocking_filter_parameters_present;
00230 int constrained_intra_pred;
00231 int redundant_pic_cnt_present;
00232 int transform_8x8_mode;
00233 uint8_t scaling_matrix4[6][16];
00234 uint8_t scaling_matrix8[2][64];
00235 uint8_t chroma_qp_table[2][64];
00236 int chroma_qp_diff;
00237 }PPS;
00238
00242 typedef enum MMCOOpcode{
00243 MMCO_END=0,
00244 MMCO_SHORT2UNUSED,
00245 MMCO_LONG2UNUSED,
00246 MMCO_SHORT2LONG,
00247 MMCO_SET_MAX_LONG,
00248 MMCO_RESET,
00249 MMCO_LONG,
00250 } MMCOOpcode;
00251
00255 typedef struct MMCO{
00256 MMCOOpcode opcode;
00257 int short_pic_num;
00258 int long_arg;
00259 } MMCO;
00260
00264 typedef struct H264Context{
00265 MpegEncContext s;
00266 H264DSPContext h264dsp;
00267 int chroma_qp[2];
00268
00269 int qp_thresh;
00270
00271 int prev_mb_skipped;
00272 int next_mb_skipped;
00273
00274
00275 int chroma_pred_mode;
00276 int intra16x16_pred_mode;
00277
00278 int topleft_mb_xy;
00279 int top_mb_xy;
00280 int topright_mb_xy;
00281 int left_mb_xy[2];
00282
00283 int topleft_type;
00284 int top_type;
00285 int topright_type;
00286 int left_type[2];
00287
00288 const uint8_t * left_block;
00289 int topleft_partition;
00290
00291 int8_t intra4x4_pred_mode_cache[5*8];
00292 int8_t (*intra4x4_pred_mode);
00293 H264PredContext hpc;
00294 unsigned int topleft_samples_available;
00295 unsigned int top_samples_available;
00296 unsigned int topright_samples_available;
00297 unsigned int left_samples_available;
00298 uint8_t (*top_borders[2])[16+2*8];
00299
00304 DECLARE_ALIGNED(8, uint8_t, non_zero_count_cache)[6*8];
00305
00306
00307
00308
00309
00310
00311
00312 uint8_t (*non_zero_count)[32];
00313
00317 DECLARE_ALIGNED(16, int16_t, mv_cache)[2][5*8][2];
00318 DECLARE_ALIGNED(8, int8_t, ref_cache)[2][5*8];
00319 #define LIST_NOT_USED -1 //FIXME rename?
00320 #define PART_NOT_AVAILABLE -2
00321
00325 int mv_cache_clean[2];
00326
00330 int neighbor_transform_size;
00331
00336 int block_offset[2*(16+8)];
00337
00338 uint32_t *mb2b_xy;
00339 uint32_t *mb2br_xy;
00340 int b_stride;
00341
00342 int mb_linesize;
00343 int mb_uvlinesize;
00344
00345 int emu_edge_width;
00346 int emu_edge_height;
00347
00348 SPS sps;
00349
00353 PPS pps;
00354
00355 uint32_t dequant4_buffer[6][52][16];
00356 uint32_t dequant8_buffer[2][52][64];
00357 uint32_t (*dequant4_coeff[6])[16];
00358 uint32_t (*dequant8_coeff[2])[64];
00359
00360 int slice_num;
00361 uint16_t *slice_table;
00362 int slice_type;
00363 int slice_type_nos;
00364 int slice_type_fixed;
00365
00366
00367 int mb_aff_frame;
00368 int mb_field_decoding_flag;
00369 int mb_mbaff;
00370
00371 DECLARE_ALIGNED(8, uint16_t, sub_mb_type)[4];
00372
00373
00374 int use_weight;
00375 int use_weight_chroma;
00376 int luma_log2_weight_denom;
00377 int chroma_log2_weight_denom;
00378
00379 int luma_weight[48][2][2];
00380 int chroma_weight[48][2][2][2];
00381 int implicit_weight[48][48][2];
00382
00383 int direct_spatial_mv_pred;
00384 int col_parity;
00385 int col_fieldoff;
00386 int dist_scale_factor[16];
00387 int dist_scale_factor_field[2][32];
00388 int map_col_to_list0[2][16+32];
00389 int map_col_to_list0_field[2][2][16+32];
00390
00394 unsigned int ref_count[2];
00395 unsigned int list_count;
00396 uint8_t *list_counts;
00397 Picture ref_list[2][48];
00400 int ref2frm[MAX_SLICES][2][64];
00401
00402
00403 GetBitContext intra_gb;
00404 GetBitContext inter_gb;
00405 GetBitContext *intra_gb_ptr;
00406 GetBitContext *inter_gb_ptr;
00407
00408 DECLARE_ALIGNED(16, DCTELEM, mb)[16*24];
00409 DECLARE_ALIGNED(16, DCTELEM, mb_luma_dc)[16];
00410 DECLARE_ALIGNED(16, DCTELEM, mb_chroma_dc)[2][4];
00411 DCTELEM mb_padding[256];
00412
00416 CABACContext cabac;
00417 uint8_t cabac_state[460];
00418
00419
00420 uint16_t *cbp_table;
00421 int cbp;
00422 int top_cbp;
00423 int left_cbp;
00424
00425 uint8_t *chroma_pred_mode_table;
00426 int last_qscale_diff;
00427 uint8_t (*mvd_table[2])[2];
00428 DECLARE_ALIGNED(16, uint8_t, mvd_cache)[2][5*8][2];
00429 uint8_t *direct_table;
00430 uint8_t direct_cache[5*8];
00431
00432 uint8_t zigzag_scan[16];
00433 uint8_t zigzag_scan8x8[64];
00434 uint8_t zigzag_scan8x8_cavlc[64];
00435 uint8_t field_scan[16];
00436 uint8_t field_scan8x8[64];
00437 uint8_t field_scan8x8_cavlc[64];
00438 const uint8_t *zigzag_scan_q0;
00439 const uint8_t *zigzag_scan8x8_q0;
00440 const uint8_t *zigzag_scan8x8_cavlc_q0;
00441 const uint8_t *field_scan_q0;
00442 const uint8_t *field_scan8x8_q0;
00443 const uint8_t *field_scan8x8_cavlc_q0;
00444
00445 int x264_build;
00446
00447 int mb_xy;
00448
00449 int is_complex;
00450
00451
00452 int deblocking_filter;
00453 int slice_alpha_c0_offset;
00454 int slice_beta_offset;
00455
00456
00457
00458
00459 int nal_ref_idc;
00460 int nal_unit_type;
00461 uint8_t *rbsp_buffer[2];
00462 unsigned int rbsp_buffer_size[2];
00463
00467 int is_avc;
00468 int nal_length_size;
00469 int got_first;
00470
00471 SPS *sps_buffers[MAX_SPS_COUNT];
00472 PPS *pps_buffers[MAX_PPS_COUNT];
00473
00474 int dequant_coeff_pps;
00475
00476 uint16_t *slice_table_base;
00477
00478
00479
00480 int poc_lsb;
00481 int poc_msb;
00482 int delta_poc_bottom;
00483 int delta_poc[2];
00484 int frame_num;
00485 int prev_poc_msb;
00486 int prev_poc_lsb;
00487 int frame_num_offset;
00488 int prev_frame_num_offset;
00489 int prev_frame_num;
00490
00494 int curr_pic_num;
00495
00499 int max_pic_num;
00500
00501 int redundant_pic_count;
00502
00503 Picture *short_ref[32];
00504 Picture *long_ref[32];
00505 Picture default_ref_list[2][32];
00506 Picture *delayed_pic[MAX_DELAYED_PIC_COUNT+2];
00507 int outputed_poc;
00508
00512 MMCO mmco[MAX_MMCO_COUNT];
00513 int mmco_index;
00514
00515 int long_ref_count;
00516 int short_ref_count;
00517
00518 int cabac_init_idc;
00519
00524 struct H264Context *thread_context[MAX_THREADS];
00525
00529 int current_slice;
00530
00537 int max_contexts;
00538
00543 int single_decode_warning;
00544
00545 int last_slice_type;
00551 SEI_PicStructType sei_pic_struct;
00552
00559 int prev_interlaced_frame;
00560
00566 int sei_ct_type;
00567
00571 int sei_dpb_output_delay;
00572
00576 int sei_cpb_removal_delay;
00577
00585 int sei_recovery_frame_cnt;
00586
00587 int luma_weight_flag[2];
00588 int chroma_weight_flag[2];
00589
00590
00591 int sei_buffering_period_present;
00592 int initial_cpb_removal_delay[32];
00593
00594
00595 int halfpel_flag;
00596 int thirdpel_flag;
00597 int unknown_svq3_flag;
00598 int next_slice_index;
00599 uint32_t svq3_watermark_key;
00600 }H264Context;
00601
00602
00603 extern const uint8_t ff_h264_chroma_qp[52];
00604
00608 int ff_h264_decode_sei(H264Context *h);
00609
00613 int ff_h264_decode_seq_parameter_set(H264Context *h);
00614
00618 int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length);
00619
00627 const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src, int *dst_length, int *consumed, int length);
00628
00633 int ff_h264_decode_rbsp_trailing(H264Context *h, const uint8_t *src);
00634
00638 av_cold void ff_h264_free_context(H264Context *h);
00639
00643 int ff_h264_get_slice_type(const H264Context *h);
00644
00649 int ff_h264_alloc_tables(H264Context *h);
00650
00654 int ff_h264_fill_default_ref_list(H264Context *h);
00655
00656 int ff_h264_decode_ref_pic_list_reordering(H264Context *h);
00657 void ff_h264_fill_mbaff_ref_list(H264Context *h);
00658 void ff_h264_remove_all_refs(H264Context *h);
00659
00663 int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count);
00664
00665 int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb);
00666
00667 void ff_generate_sliding_window_mmcos(H264Context *h);
00668
00669
00673 int ff_h264_check_intra4x4_pred_mode(H264Context *h);
00674
00678 int ff_h264_check_intra_pred_mode(H264Context *h, int mode);
00679
00680 void ff_h264_write_back_intra_pred_mode(H264Context *h);
00681 void ff_h264_hl_decode_mb(H264Context *h);
00682 int ff_h264_frame_start(H264Context *h);
00683 int ff_h264_decode_extradata(H264Context *h);
00684 av_cold int ff_h264_decode_init(AVCodecContext *avctx);
00685 av_cold int ff_h264_decode_end(AVCodecContext *avctx);
00686 av_cold void ff_h264_decode_init_vlc(void);
00687
00692 int ff_h264_decode_mb_cavlc(H264Context *h);
00693
00698 int ff_h264_decode_mb_cabac(H264Context *h);
00699
00700 void ff_h264_init_cabac_states(H264Context *h);
00701
00702 void ff_h264_direct_dist_scale_factor(H264Context * const h);
00703 void ff_h264_direct_ref_list_init(H264Context * const h);
00704 void ff_h264_pred_direct_motion(H264Context * const h, int *mb_type);
00705
00706 void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize);
00707 void ff_h264_filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize);
00708
00714 void ff_h264_reset_sei(H264Context *h);
00715
00716
00717
00718
00719
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733
00734
00735
00736
00737
00738
00739 static const uint8_t scan8[16 + 2*4 + 3]={
00740 4+1*8, 5+1*8, 4+2*8, 5+2*8,
00741 6+1*8, 7+1*8, 6+2*8, 7+2*8,
00742 4+3*8, 5+3*8, 4+4*8, 5+4*8,
00743 6+3*8, 7+3*8, 6+4*8, 7+4*8,
00744 1+1*8, 2+1*8,
00745 1+2*8, 2+2*8,
00746 1+4*8, 2+4*8,
00747 1+5*8, 2+5*8,
00748 4+5*8, 5+5*8, 6+5*8
00749 };
00750
00751 static av_always_inline uint32_t pack16to32(int a, int b){
00752 #if HAVE_BIGENDIAN
00753 return (b&0xFFFF) + (a<<16);
00754 #else
00755 return (a&0xFFFF) + (b<<16);
00756 #endif
00757 }
00758
00759 static av_always_inline uint16_t pack8to16(int a, int b){
00760 #if HAVE_BIGENDIAN
00761 return (b&0xFF) + (a<<8);
00762 #else
00763 return (a&0xFF) + (b<<8);
00764 #endif
00765 }
00766
00770 static inline int get_chroma_qp(H264Context *h, int t, int qscale){
00771 return h->pps.chroma_qp_table[t][qscale];
00772 }
00773
00774 static inline void pred_pskip_motion(H264Context * const h, int * const mx, int * const my);
00775
00776 static void fill_decode_neighbors(H264Context *h, int mb_type){
00777 MpegEncContext * const s = &h->s;
00778 const int mb_xy= h->mb_xy;
00779 int topleft_xy, top_xy, topright_xy, left_xy[2];
00780 static const uint8_t left_block_options[4][16]={
00781 {0,1,2,3,7,10,8,11,7+0*8, 7+1*8, 7+2*8, 7+3*8, 2+0*8, 2+3*8, 2+1*8, 2+2*8},
00782 {2,2,3,3,8,11,8,11,7+2*8, 7+2*8, 7+3*8, 7+3*8, 2+1*8, 2+2*8, 2+1*8, 2+2*8},
00783 {0,0,1,1,7,10,7,10,7+0*8, 7+0*8, 7+1*8, 7+1*8, 2+0*8, 2+3*8, 2+0*8, 2+3*8},
00784 {0,2,0,2,7,10,7,10,7+0*8, 7+2*8, 7+0*8, 7+2*8, 2+0*8, 2+3*8, 2+0*8, 2+3*8}
00785 };
00786
00787 h->topleft_partition= -1;
00788
00789 top_xy = mb_xy - (s->mb_stride << MB_FIELD);
00790
00791
00792
00793
00794 topleft_xy = top_xy - 1;
00795 topright_xy= top_xy + 1;
00796 left_xy[1] = left_xy[0] = mb_xy-1;
00797 h->left_block = left_block_options[0];
00798 if(FRAME_MBAFF){
00799 const int left_mb_field_flag = IS_INTERLACED(s->current_picture.mb_type[mb_xy-1]);
00800 const int curr_mb_field_flag = IS_INTERLACED(mb_type);
00801 if(s->mb_y&1){
00802 if (left_mb_field_flag != curr_mb_field_flag) {
00803 left_xy[1] = left_xy[0] = mb_xy - s->mb_stride - 1;
00804 if (curr_mb_field_flag) {
00805 left_xy[1] += s->mb_stride;
00806 h->left_block = left_block_options[3];
00807 } else {
00808 topleft_xy += s->mb_stride;
00809
00810 h->topleft_partition = 0;
00811 h->left_block = left_block_options[1];
00812 }
00813 }
00814 }else{
00815 if(curr_mb_field_flag){
00816 topleft_xy += s->mb_stride & (((s->current_picture.mb_type[top_xy - 1]>>7)&1)-1);
00817 topright_xy += s->mb_stride & (((s->current_picture.mb_type[top_xy + 1]>>7)&1)-1);
00818 top_xy += s->mb_stride & (((s->current_picture.mb_type[top_xy ]>>7)&1)-1);
00819 }
00820 if (left_mb_field_flag != curr_mb_field_flag) {
00821 if (curr_mb_field_flag) {
00822 left_xy[1] += s->mb_stride;
00823 h->left_block = left_block_options[3];
00824 } else {
00825 h->left_block = left_block_options[2];
00826 }
00827 }
00828 }
00829 }
00830
00831 h->topleft_mb_xy = topleft_xy;
00832 h->top_mb_xy = top_xy;
00833 h->topright_mb_xy= topright_xy;
00834 h->left_mb_xy[0] = left_xy[0];
00835 h->left_mb_xy[1] = left_xy[1];
00836
00837
00838 h->topleft_type = s->current_picture.mb_type[topleft_xy] ;
00839 h->top_type = s->current_picture.mb_type[top_xy] ;
00840 h->topright_type= s->current_picture.mb_type[topright_xy];
00841 h->left_type[0] = s->current_picture.mb_type[left_xy[0]] ;
00842 h->left_type[1] = s->current_picture.mb_type[left_xy[1]] ;
00843
00844 if(FMO){
00845 if(h->slice_table[topleft_xy ] != h->slice_num) h->topleft_type = 0;
00846 if(h->slice_table[top_xy ] != h->slice_num) h->top_type = 0;
00847 if(h->slice_table[left_xy[0] ] != h->slice_num) h->left_type[0] = h->left_type[1] = 0;
00848 }else{
00849 if(h->slice_table[topleft_xy ] != h->slice_num){
00850 h->topleft_type = 0;
00851 if(h->slice_table[top_xy ] != h->slice_num) h->top_type = 0;
00852 if(h->slice_table[left_xy[0] ] != h->slice_num) h->left_type[0] = h->left_type[1] = 0;
00853 }
00854 }
00855 if(h->slice_table[topright_xy] != h->slice_num) h->topright_type= 0;
00856 }
00857
00858 static void fill_decode_caches(H264Context *h, int mb_type){
00859 MpegEncContext * const s = &h->s;
00860 int topleft_xy, top_xy, topright_xy, left_xy[2];
00861 int topleft_type, top_type, topright_type, left_type[2];
00862 const uint8_t * left_block= h->left_block;
00863 int i;
00864
00865 topleft_xy = h->topleft_mb_xy ;
00866 top_xy = h->top_mb_xy ;
00867 topright_xy = h->topright_mb_xy;
00868 left_xy[0] = h->left_mb_xy[0] ;
00869 left_xy[1] = h->left_mb_xy[1] ;
00870 topleft_type = h->topleft_type ;
00871 top_type = h->top_type ;
00872 topright_type= h->topright_type ;
00873 left_type[0] = h->left_type[0] ;
00874 left_type[1] = h->left_type[1] ;
00875
00876 if(!IS_SKIP(mb_type)){
00877 if(IS_INTRA(mb_type)){
00878 int type_mask= h->pps.constrained_intra_pred ? IS_INTRA(-1) : -1;
00879 h->topleft_samples_available=
00880 h->top_samples_available=
00881 h->left_samples_available= 0xFFFF;
00882 h->topright_samples_available= 0xEEEA;
00883
00884 if(!(top_type & type_mask)){
00885 h->topleft_samples_available= 0xB3FF;
00886 h->top_samples_available= 0x33FF;
00887 h->topright_samples_available= 0x26EA;
00888 }
00889 if(IS_INTERLACED(mb_type) != IS_INTERLACED(left_type[0])){
00890 if(IS_INTERLACED(mb_type)){
00891 if(!(left_type[0] & type_mask)){
00892 h->topleft_samples_available&= 0xDFFF;
00893 h->left_samples_available&= 0x5FFF;
00894 }
00895 if(!(left_type[1] & type_mask)){
00896 h->topleft_samples_available&= 0xFF5F;
00897 h->left_samples_available&= 0xFF5F;
00898 }
00899 }else{
00900 int left_typei = s->current_picture.mb_type[left_xy[0] + s->mb_stride];
00901
00902 assert(left_xy[0] == left_xy[1]);
00903 if(!((left_typei & type_mask) && (left_type[0] & type_mask))){
00904 h->topleft_samples_available&= 0xDF5F;
00905 h->left_samples_available&= 0x5F5F;
00906 }
00907 }
00908 }else{
00909 if(!(left_type[0] & type_mask)){
00910 h->topleft_samples_available&= 0xDF5F;
00911 h->left_samples_available&= 0x5F5F;
00912 }
00913 }
00914
00915 if(!(topleft_type & type_mask))
00916 h->topleft_samples_available&= 0x7FFF;
00917
00918 if(!(topright_type & type_mask))
00919 h->topright_samples_available&= 0xFBFF;
00920
00921 if(IS_INTRA4x4(mb_type)){
00922 if(IS_INTRA4x4(top_type)){
00923 AV_COPY32(h->intra4x4_pred_mode_cache+4+8*0, h->intra4x4_pred_mode + h->mb2br_xy[top_xy]);
00924 }else{
00925 h->intra4x4_pred_mode_cache[4+8*0]=
00926 h->intra4x4_pred_mode_cache[5+8*0]=
00927 h->intra4x4_pred_mode_cache[6+8*0]=
00928 h->intra4x4_pred_mode_cache[7+8*0]= 2 - 3*!(top_type & type_mask);
00929 }
00930 for(i=0; i<2; i++){
00931 if(IS_INTRA4x4(left_type[i])){
00932 int8_t *mode= h->intra4x4_pred_mode + h->mb2br_xy[left_xy[i]];
00933 h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]= mode[6-left_block[0+2*i]];
00934 h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= mode[6-left_block[1+2*i]];
00935 }else{
00936 h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]=
00937 h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= 2 - 3*!(left_type[i] & type_mask);
00938 }
00939 }
00940 }
00941 }
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952
00953 if(top_type){
00954 AV_COPY32(&h->non_zero_count_cache[4+8*0], &h->non_zero_count[top_xy][4+3*8]);
00955 h->non_zero_count_cache[1+8*0]= h->non_zero_count[top_xy][1+1*8];
00956 h->non_zero_count_cache[2+8*0]= h->non_zero_count[top_xy][2+1*8];
00957
00958 h->non_zero_count_cache[1+8*3]= h->non_zero_count[top_xy][1+2*8];
00959 h->non_zero_count_cache[2+8*3]= h->non_zero_count[top_xy][2+2*8];
00960 }else {
00961 h->non_zero_count_cache[1+8*0]=
00962 h->non_zero_count_cache[2+8*0]=
00963
00964 h->non_zero_count_cache[1+8*3]=
00965 h->non_zero_count_cache[2+8*3]=
00966 AV_WN32A(&h->non_zero_count_cache[4+8*0], CABAC && !IS_INTRA(mb_type) ? 0 : 0x40404040);
00967 }
00968
00969 for (i=0; i<2; i++) {
00970 if(left_type[i]){
00971 h->non_zero_count_cache[3+8*1 + 2*8*i]= h->non_zero_count[left_xy[i]][left_block[8+0+2*i]];
00972 h->non_zero_count_cache[3+8*2 + 2*8*i]= h->non_zero_count[left_xy[i]][left_block[8+1+2*i]];
00973 h->non_zero_count_cache[0+8*1 + 8*i]= h->non_zero_count[left_xy[i]][left_block[8+4+2*i]];
00974 h->non_zero_count_cache[0+8*4 + 8*i]= h->non_zero_count[left_xy[i]][left_block[8+5+2*i]];
00975 }else{
00976 h->non_zero_count_cache[3+8*1 + 2*8*i]=
00977 h->non_zero_count_cache[3+8*2 + 2*8*i]=
00978 h->non_zero_count_cache[0+8*1 + 8*i]=
00979 h->non_zero_count_cache[0+8*4 + 8*i]= CABAC && !IS_INTRA(mb_type) ? 0 : 64;
00980 }
00981 }
00982
00983 if( CABAC ) {
00984
00985 if(top_type) {
00986 h->top_cbp = h->cbp_table[top_xy];
00987 } else {
00988 h->top_cbp = IS_INTRA(mb_type) ? 0x1CF : 0x00F;
00989 }
00990
00991 if (left_type[0]) {
00992 h->left_cbp = (h->cbp_table[left_xy[0]] & 0x1f0)
00993 | ((h->cbp_table[left_xy[0]]>>(left_block[0]&(~1)))&2)
00994 | (((h->cbp_table[left_xy[1]]>>(left_block[2]&(~1)))&2) << 2);
00995 } else {
00996 h->left_cbp = IS_INTRA(mb_type) ? 0x1CF : 0x00F;
00997 }
00998 }
00999 }
01000
01001 #if 1
01002 if(IS_INTER(mb_type) || (IS_DIRECT(mb_type) && h->direct_spatial_mv_pred)){
01003 int list;
01004 for(list=0; list<h->list_count; list++){
01005 if(!USES_LIST(mb_type, list)){
01006
01007
01008
01009
01010
01011 continue;
01012 }
01013 assert(!(IS_DIRECT(mb_type) && !h->direct_spatial_mv_pred));
01014
01015 h->mv_cache_clean[list]= 0;
01016
01017 if(USES_LIST(top_type, list)){
01018 const int b_xy= h->mb2b_xy[top_xy] + 3*h->b_stride;
01019 AV_COPY128(h->mv_cache[list][scan8[0] + 0 - 1*8], s->current_picture.motion_val[list][b_xy + 0]);
01020 h->ref_cache[list][scan8[0] + 0 - 1*8]=
01021 h->ref_cache[list][scan8[0] + 1 - 1*8]= s->current_picture.ref_index[list][4*top_xy + 2];
01022 h->ref_cache[list][scan8[0] + 2 - 1*8]=
01023 h->ref_cache[list][scan8[0] + 3 - 1*8]= s->current_picture.ref_index[list][4*top_xy + 3];
01024 }else{
01025 AV_ZERO128(h->mv_cache[list][scan8[0] + 0 - 1*8]);
01026 AV_WN32A(&h->ref_cache[list][scan8[0] + 0 - 1*8], ((top_type ? LIST_NOT_USED : PART_NOT_AVAILABLE)&0xFF)*0x01010101);
01027 }
01028
01029 if(mb_type & (MB_TYPE_16x8|MB_TYPE_8x8)){
01030 for(i=0; i<2; i++){
01031 int cache_idx = scan8[0] - 1 + i*2*8;
01032 if(USES_LIST(left_type[i], list)){
01033 const int b_xy= h->mb2b_xy[left_xy[i]] + 3;
01034 const int b8_xy= 4*left_xy[i] + 1;
01035 AV_COPY32(h->mv_cache[list][cache_idx ], s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[0+i*2]]);
01036 AV_COPY32(h->mv_cache[list][cache_idx+8], s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[1+i*2]]);
01037 h->ref_cache[list][cache_idx ]= s->current_picture.ref_index[list][b8_xy + (left_block[0+i*2]&~1)];
01038 h->ref_cache[list][cache_idx+8]= s->current_picture.ref_index[list][b8_xy + (left_block[1+i*2]&~1)];
01039 }else{
01040 AV_ZERO32(h->mv_cache [list][cache_idx ]);
01041 AV_ZERO32(h->mv_cache [list][cache_idx+8]);
01042 h->ref_cache[list][cache_idx ]=
01043 h->ref_cache[list][cache_idx+8]= (left_type[i]) ? LIST_NOT_USED : PART_NOT_AVAILABLE;
01044 }
01045 }
01046 }else{
01047 if(USES_LIST(left_type[0], list)){
01048 const int b_xy= h->mb2b_xy[left_xy[0]] + 3;
01049 const int b8_xy= 4*left_xy[0] + 1;
01050 AV_COPY32(h->mv_cache[list][scan8[0] - 1], s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[0]]);
01051 h->ref_cache[list][scan8[0] - 1]= s->current_picture.ref_index[list][b8_xy + (left_block[0]&~1)];
01052 }else{
01053 AV_ZERO32(h->mv_cache [list][scan8[0] - 1]);
01054 h->ref_cache[list][scan8[0] - 1]= left_type[0] ? LIST_NOT_USED : PART_NOT_AVAILABLE;
01055 }
01056 }
01057
01058 if(USES_LIST(topright_type, list)){
01059 const int b_xy= h->mb2b_xy[topright_xy] + 3*h->b_stride;
01060 AV_COPY32(h->mv_cache[list][scan8[0] + 4 - 1*8], s->current_picture.motion_val[list][b_xy]);
01061 h->ref_cache[list][scan8[0] + 4 - 1*8]= s->current_picture.ref_index[list][4*topright_xy + 2];
01062 }else{
01063 AV_ZERO32(h->mv_cache [list][scan8[0] + 4 - 1*8]);
01064 h->ref_cache[list][scan8[0] + 4 - 1*8]= topright_type ? LIST_NOT_USED : PART_NOT_AVAILABLE;
01065 }
01066 if(h->ref_cache[list][scan8[0] + 4 - 1*8] < 0){
01067 if(USES_LIST(topleft_type, list)){
01068 const int b_xy = h->mb2b_xy [topleft_xy] + 3 + h->b_stride + (h->topleft_partition & 2*h->b_stride);
01069 const int b8_xy= 4*topleft_xy + 1 + (h->topleft_partition & 2);
01070 AV_COPY32(h->mv_cache[list][scan8[0] - 1 - 1*8], s->current_picture.motion_val[list][b_xy]);
01071 h->ref_cache[list][scan8[0] - 1 - 1*8]= s->current_picture.ref_index[list][b8_xy];
01072 }else{
01073 AV_ZERO32(h->mv_cache[list][scan8[0] - 1 - 1*8]);
01074 h->ref_cache[list][scan8[0] - 1 - 1*8]= topleft_type ? LIST_NOT_USED : PART_NOT_AVAILABLE;
01075 }
01076 }
01077
01078 if((mb_type&(MB_TYPE_SKIP|MB_TYPE_DIRECT2)) && !FRAME_MBAFF)
01079 continue;
01080
01081 if(!(mb_type&(MB_TYPE_SKIP|MB_TYPE_DIRECT2))) {
01082 h->ref_cache[list][scan8[4 ]] =
01083 h->ref_cache[list][scan8[12]] = PART_NOT_AVAILABLE;
01084 AV_ZERO32(h->mv_cache [list][scan8[4 ]]);
01085 AV_ZERO32(h->mv_cache [list][scan8[12]]);
01086
01087 if( CABAC ) {
01088
01089 if(USES_LIST(top_type, list)){
01090 const int b_xy= h->mb2br_xy[top_xy];
01091 AV_COPY64(h->mvd_cache[list][scan8[0] + 0 - 1*8], h->mvd_table[list][b_xy + 0]);
01092 }else{
01093 AV_ZERO64(h->mvd_cache[list][scan8[0] + 0 - 1*8]);
01094 }
01095 if(USES_LIST(left_type[0], list)){
01096 const int b_xy= h->mb2br_xy[left_xy[0]] + 6;
01097 AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 0*8], h->mvd_table[list][b_xy - left_block[0]]);
01098 AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 1*8], h->mvd_table[list][b_xy - left_block[1]]);
01099 }else{
01100 AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 0*8]);
01101 AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 1*8]);
01102 }
01103 if(USES_LIST(left_type[1], list)){
01104 const int b_xy= h->mb2br_xy[left_xy[1]] + 6;
01105 AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 2*8], h->mvd_table[list][b_xy - left_block[2]]);
01106 AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 3*8], h->mvd_table[list][b_xy - left_block[3]]);
01107 }else{
01108 AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 2*8]);
01109 AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 3*8]);
01110 }
01111 AV_ZERO16(h->mvd_cache [list][scan8[4 ]]);
01112 AV_ZERO16(h->mvd_cache [list][scan8[12]]);
01113 if(h->slice_type_nos == FF_B_TYPE){
01114 fill_rectangle(&h->direct_cache[scan8[0]], 4, 4, 8, MB_TYPE_16x16>>1, 1);
01115
01116 if(IS_DIRECT(top_type)){
01117 AV_WN32A(&h->direct_cache[scan8[0] - 1*8], 0x01010101u*(MB_TYPE_DIRECT2>>1));
01118 }else if(IS_8X8(top_type)){
01119 int b8_xy = 4*top_xy;
01120 h->direct_cache[scan8[0] + 0 - 1*8]= h->direct_table[b8_xy + 2];
01121 h->direct_cache[scan8[0] + 2 - 1*8]= h->direct_table[b8_xy + 3];
01122 }else{
01123 AV_WN32A(&h->direct_cache[scan8[0] - 1*8], 0x01010101*(MB_TYPE_16x16>>1));
01124 }
01125
01126 if(IS_DIRECT(left_type[0]))
01127 h->direct_cache[scan8[0] - 1 + 0*8]= MB_TYPE_DIRECT2>>1;
01128 else if(IS_8X8(left_type[0]))
01129 h->direct_cache[scan8[0] - 1 + 0*8]= h->direct_table[4*left_xy[0] + 1 + (left_block[0]&~1)];
01130 else
01131 h->direct_cache[scan8[0] - 1 + 0*8]= MB_TYPE_16x16>>1;
01132
01133 if(IS_DIRECT(left_type[1]))
01134 h->direct_cache[scan8[0] - 1 + 2*8]= MB_TYPE_DIRECT2>>1;
01135 else if(IS_8X8(left_type[1]))
01136 h->direct_cache[scan8[0] - 1 + 2*8]= h->direct_table[4*left_xy[1] + 1 + (left_block[2]&~1)];
01137 else
01138 h->direct_cache[scan8[0] - 1 + 2*8]= MB_TYPE_16x16>>1;
01139 }
01140 }
01141 }
01142 if(FRAME_MBAFF){
01143 #define MAP_MVS\
01144 MAP_F2F(scan8[0] - 1 - 1*8, topleft_type)\
01145 MAP_F2F(scan8[0] + 0 - 1*8, top_type)\
01146 MAP_F2F(scan8[0] + 1 - 1*8, top_type)\
01147 MAP_F2F(scan8[0] + 2 - 1*8, top_type)\
01148 MAP_F2F(scan8[0] + 3 - 1*8, top_type)\
01149 MAP_F2F(scan8[0] + 4 - 1*8, topright_type)\
01150 MAP_F2F(scan8[0] - 1 + 0*8, left_type[0])\
01151 MAP_F2F(scan8[0] - 1 + 1*8, left_type[0])\
01152 MAP_F2F(scan8[0] - 1 + 2*8, left_type[1])\
01153 MAP_F2F(scan8[0] - 1 + 3*8, left_type[1])
01154 if(MB_FIELD){
01155 #define MAP_F2F(idx, mb_type)\
01156 if(!IS_INTERLACED(mb_type) && h->ref_cache[list][idx] >= 0){\
01157 h->ref_cache[list][idx] <<= 1;\
01158 h->mv_cache[list][idx][1] /= 2;\
01159 h->mvd_cache[list][idx][1] >>=1;\
01160 }
01161 MAP_MVS
01162 #undef MAP_F2F
01163 }else{
01164 #define MAP_F2F(idx, mb_type)\
01165 if(IS_INTERLACED(mb_type) && h->ref_cache[list][idx] >= 0){\
01166 h->ref_cache[list][idx] >>= 1;\
01167 h->mv_cache[list][idx][1] <<= 1;\
01168 h->mvd_cache[list][idx][1] <<= 1;\
01169 }
01170 MAP_MVS
01171 #undef MAP_F2F
01172 }
01173 }
01174 }
01175 }
01176 #endif
01177
01178 h->neighbor_transform_size= !!IS_8x8DCT(top_type) + !!IS_8x8DCT(left_type[0]);
01179 }
01180
01184 static inline int pred_intra_mode(H264Context *h, int n){
01185 const int index8= scan8[n];
01186 const int left= h->intra4x4_pred_mode_cache[index8 - 1];
01187 const int top = h->intra4x4_pred_mode_cache[index8 - 8];
01188 const int min= FFMIN(left, top);
01189
01190 tprintf(h->s.avctx, "mode:%d %d min:%d\n", left ,top, min);
01191
01192 if(min<0) return DC_PRED;
01193 else return min;
01194 }
01195
01196 static inline void write_back_non_zero_count(H264Context *h){
01197 const int mb_xy= h->mb_xy;
01198
01199 AV_COPY64(&h->non_zero_count[mb_xy][ 0], &h->non_zero_count_cache[0+8*1]);
01200 AV_COPY64(&h->non_zero_count[mb_xy][ 8], &h->non_zero_count_cache[0+8*2]);
01201 AV_COPY32(&h->non_zero_count[mb_xy][16], &h->non_zero_count_cache[0+8*5]);
01202 AV_COPY32(&h->non_zero_count[mb_xy][20], &h->non_zero_count_cache[4+8*3]);
01203 AV_COPY64(&h->non_zero_count[mb_xy][24], &h->non_zero_count_cache[0+8*4]);
01204 }
01205
01206 static inline void write_back_motion(H264Context *h, int mb_type){
01207 MpegEncContext * const s = &h->s;
01208 const int b_xy = 4*s->mb_x + 4*s->mb_y*h->b_stride;
01209 const int b8_xy= 4*h->mb_xy;
01210 int list;
01211
01212 if(!USES_LIST(mb_type, 0))
01213 fill_rectangle(&s->current_picture.ref_index[0][b8_xy], 2, 2, 2, (uint8_t)LIST_NOT_USED, 1);
01214
01215 for(list=0; list<h->list_count; list++){
01216 int y, b_stride;
01217 int16_t (*mv_dst)[2];
01218 int16_t (*mv_src)[2];
01219
01220 if(!USES_LIST(mb_type, list))
01221 continue;
01222
01223 b_stride = h->b_stride;
01224 mv_dst = &s->current_picture.motion_val[list][b_xy];
01225 mv_src = &h->mv_cache[list][scan8[0]];
01226 for(y=0; y<4; y++){
01227 AV_COPY128(mv_dst + y*b_stride, mv_src + 8*y);
01228 }
01229 if( CABAC ) {
01230 uint8_t (*mvd_dst)[2] = &h->mvd_table[list][FMO ? 8*h->mb_xy : h->mb2br_xy[h->mb_xy]];
01231 uint8_t (*mvd_src)[2] = &h->mvd_cache[list][scan8[0]];
01232 if(IS_SKIP(mb_type))
01233 AV_ZERO128(mvd_dst);
01234 else{
01235 AV_COPY64(mvd_dst, mvd_src + 8*3);
01236 AV_COPY16(mvd_dst + 3 + 3, mvd_src + 3 + 8*0);
01237 AV_COPY16(mvd_dst + 3 + 2, mvd_src + 3 + 8*1);
01238 AV_COPY16(mvd_dst + 3 + 1, mvd_src + 3 + 8*2);
01239 }
01240 }
01241
01242 {
01243 int8_t *ref_index = &s->current_picture.ref_index[list][b8_xy];
01244 ref_index[0+0*2]= h->ref_cache[list][scan8[0]];
01245 ref_index[1+0*2]= h->ref_cache[list][scan8[4]];
01246 ref_index[0+1*2]= h->ref_cache[list][scan8[8]];
01247 ref_index[1+1*2]= h->ref_cache[list][scan8[12]];
01248 }
01249 }
01250
01251 if(h->slice_type_nos == FF_B_TYPE && CABAC){
01252 if(IS_8X8(mb_type)){
01253 uint8_t *direct_table = &h->direct_table[4*h->mb_xy];
01254 direct_table[1] = h->sub_mb_type[1]>>1;
01255 direct_table[2] = h->sub_mb_type[2]>>1;
01256 direct_table[3] = h->sub_mb_type[3]>>1;
01257 }
01258 }
01259 }
01260
01261 static inline int get_dct8x8_allowed(H264Context *h){
01262 if(h->sps.direct_8x8_inference_flag)
01263 return !(AV_RN64A(h->sub_mb_type) & ((MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_8x8 )*0x0001000100010001ULL));
01264 else
01265 return !(AV_RN64A(h->sub_mb_type) & ((MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_8x8|MB_TYPE_DIRECT2)*0x0001000100010001ULL));
01266 }
01267
01271 static void av_unused decode_mb_skip(H264Context *h){
01272 MpegEncContext * const s = &h->s;
01273 const int mb_xy= h->mb_xy;
01274 int mb_type=0;
01275
01276 memset(h->non_zero_count[mb_xy], 0, 32);
01277 memset(h->non_zero_count_cache + 8, 0, 8*5);
01278
01279 if(MB_FIELD)
01280 mb_type|= MB_TYPE_INTERLACED;
01281
01282 if( h->slice_type_nos == FF_B_TYPE )
01283 {
01284
01285 mb_type|= MB_TYPE_L0L1|MB_TYPE_DIRECT2|MB_TYPE_SKIP;
01286 if(h->direct_spatial_mv_pred){
01287 fill_decode_neighbors(h, mb_type);
01288 fill_decode_caches(h, mb_type);
01289 }
01290 ff_h264_pred_direct_motion(h, &mb_type);
01291 mb_type|= MB_TYPE_SKIP;
01292 }
01293 else
01294 {
01295 int mx, my;
01296 mb_type|= MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P1L0|MB_TYPE_SKIP;
01297
01298 fill_decode_neighbors(h, mb_type);
01299 fill_decode_caches(h, mb_type);
01300 pred_pskip_motion(h, &mx, &my);
01301 fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, 0, 1);
01302 fill_rectangle( h->mv_cache[0][scan8[0]], 4, 4, 8, pack16to32(mx,my), 4);
01303 }
01304
01305 write_back_motion(h, mb_type);
01306 s->current_picture.mb_type[mb_xy]= mb_type;
01307 s->current_picture.qscale_table[mb_xy]= s->qscale;
01308 h->slice_table[ mb_xy ]= h->slice_num;
01309 h->prev_mb_skipped= 1;
01310 }
01311
01312 #include "h264_mvpred.h"
01313
01314 #endif