Commit 137c8468 authored by Michael Niedermayer's avatar Michael Niedermayer

unify table indexing (motion_val,dc_val,ac_val,coded_block changed)

minor +-1 bugfix

Originally committed as revision 3016 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 37f5cd5a
...@@ -45,7 +45,7 @@ static void put_dc(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t ...@@ -45,7 +45,7 @@ static void put_dc(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t
{ {
int dc, dcu, dcv, y, i; int dc, dcu, dcv, y, i;
for(i=0; i<4; i++){ for(i=0; i<4; i++){
dc= s->dc_val[0][mb_x*2+1 + (i&1) + (mb_y*2+1 + (i>>1))*(s->mb_width*2+2)]; dc= s->dc_val[0][mb_x*2 + (i&1) + (mb_y*2 + (i>>1))*s->b8_stride];
if(dc<0) dc=0; if(dc<0) dc=0;
else if(dc>2040) dc=2040; else if(dc>2040) dc=2040;
for(y=0; y<8; y++){ for(y=0; y<8; y++){
...@@ -55,8 +55,8 @@ static void put_dc(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t ...@@ -55,8 +55,8 @@ static void put_dc(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t
} }
} }
} }
dcu = s->dc_val[1][mb_x+1 + (mb_y+1)*(s->mb_width+2)]; dcu = s->dc_val[1][mb_x + mb_y*s->mb_stride];
dcv = s->dc_val[2][mb_x+1 + (mb_y+1)*(s->mb_width+2)]; dcv = s->dc_val[2][mb_x + mb_y*s->mb_stride];
if (dcu<0 ) dcu=0; if (dcu<0 ) dcu=0;
else if(dcu>2040) dcu=2040; else if(dcu>2040) dcu=2040;
if (dcv<0 ) dcv=0; if (dcv<0 ) dcv=0;
...@@ -209,8 +209,8 @@ static void h_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int st ...@@ -209,8 +209,8 @@ static void h_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int st
int left_damage = left_status&(DC_ERROR|AC_ERROR|MV_ERROR); int left_damage = left_status&(DC_ERROR|AC_ERROR|MV_ERROR);
int right_damage= right_status&(DC_ERROR|AC_ERROR|MV_ERROR); int right_damage= right_status&(DC_ERROR|AC_ERROR|MV_ERROR);
int offset= b_x*8 + b_y*stride*8; int offset= b_x*8 + b_y*stride*8;
int16_t *left_mv= s->current_picture.motion_val[0][s->block_wrap[0]*((b_y<<(1-is_luma)) + 1) + ( b_x <<(1-is_luma))]; int16_t *left_mv= s->current_picture.motion_val[0][s->b8_stride*(b_y<<(1-is_luma)) + ( b_x <<(1-is_luma))];
int16_t *right_mv= s->current_picture.motion_val[0][s->block_wrap[0]*((b_y<<(1-is_luma)) + 1) + ((b_x+1)<<(1-is_luma))]; int16_t *right_mv= s->current_picture.motion_val[0][s->b8_stride*(b_y<<(1-is_luma)) + ((b_x+1)<<(1-is_luma))];
if(!(left_damage||right_damage)) continue; // both undamaged if(!(left_damage||right_damage)) continue; // both undamaged
...@@ -269,8 +269,8 @@ static void v_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int st ...@@ -269,8 +269,8 @@ static void v_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int st
int top_damage = top_status&(DC_ERROR|AC_ERROR|MV_ERROR); int top_damage = top_status&(DC_ERROR|AC_ERROR|MV_ERROR);
int bottom_damage= bottom_status&(DC_ERROR|AC_ERROR|MV_ERROR); int bottom_damage= bottom_status&(DC_ERROR|AC_ERROR|MV_ERROR);
int offset= b_x*8 + b_y*stride*8; int offset= b_x*8 + b_y*stride*8;
int16_t *top_mv= s->current_picture.motion_val[0][s->block_wrap[0]*(( b_y <<(1-is_luma)) + 1) + (b_x<<(1-is_luma))]; int16_t *top_mv= s->current_picture.motion_val[0][s->b8_stride*( b_y <<(1-is_luma)) + (b_x<<(1-is_luma))];
int16_t *bottom_mv= s->current_picture.motion_val[0][s->block_wrap[0]*(((b_y+1)<<(1-is_luma)) + 1) + (b_x<<(1-is_luma))]; int16_t *bottom_mv= s->current_picture.motion_val[0][s->b8_stride*((b_y+1)<<(1-is_luma)) + (b_x<<(1-is_luma))];
if(!(top_damage||bottom_damage)) continue; // both undamaged if(!(top_damage||bottom_damage)) continue; // both undamaged
...@@ -378,8 +378,8 @@ int score_sum=0; ...@@ -378,8 +378,8 @@ int score_sum=0;
int j; int j;
int best_score=256*256*256*64; int best_score=256*256*256*64;
int best_pred=0; int best_pred=0;
const int mot_stride= mb_width*2+2; const int mot_stride= s->b8_stride;
const int mot_index= mb_x*2 + 1 + (mb_y*2+1)*mot_stride; const int mot_index= mb_x*2 + mb_y*2*mot_stride;
int prev_x= s->current_picture.motion_val[0][mot_index][0]; int prev_x= s->current_picture.motion_val[0][mot_index][0];
int prev_y= s->current_picture.motion_val[0][mot_index][1]; int prev_y= s->current_picture.motion_val[0][mot_index][1];
...@@ -672,14 +672,14 @@ void ff_er_frame_end(MpegEncContext *s){ ...@@ -672,14 +672,14 @@ void ff_er_frame_end(MpegEncContext *s){
av_log(s->avctx, AV_LOG_INFO, "concealing errors\n"); av_log(s->avctx, AV_LOG_INFO, "concealing errors\n");
if(s->current_picture.motion_val[0] == NULL){ if(s->current_picture.motion_val[0] == NULL){
int size = (2 * s->mb_width + 2) * (2 * s->mb_height + 2); int size = s->b8_stride * 2 * s->mb_height;
Picture *pic= s->current_picture_ptr; Picture *pic= s->current_picture_ptr;
av_log(s->avctx, AV_LOG_ERROR, "Warning MVs not available\n"); av_log(s->avctx, AV_LOG_ERROR, "Warning MVs not available\n");
for(i=0; i<2; i++){ for(i=0; i<2; i++){
pic->motion_val_base[i]= av_mallocz((size+1) * 2 * sizeof(uint16_t)); //FIXME size pic->motion_val_base[i]= av_mallocz((size+2) * 2 * sizeof(uint16_t));
pic->motion_val[i]= pic->motion_val_base[i]+1; pic->motion_val[i]= pic->motion_val_base[i]+2;
} }
pic->motion_subsample_log2= 3; pic->motion_subsample_log2= 3;
s->current_picture= *s->current_picture_ptr; s->current_picture= *s->current_picture_ptr;
...@@ -845,17 +845,17 @@ void ff_er_frame_end(MpegEncContext *s){ ...@@ -845,17 +845,17 @@ void ff_er_frame_end(MpegEncContext *s){
s->mb_intra=0; s->mb_intra=0;
s->mb_skiped=0; s->mb_skiped=0;
if(IS_8X8(mb_type)){ if(IS_8X8(mb_type)){
int mb_index= mb_x*2+1 + (mb_y*2+1)*s->block_wrap[0]; int mb_index= mb_x*2 + mb_y*2*s->b8_stride;
int j; int j;
s->mv_type = MV_TYPE_8X8; s->mv_type = MV_TYPE_8X8;
for(j=0; j<4; j++){ for(j=0; j<4; j++){
s->mv[0][j][0] = s->current_picture.motion_val[0][ mb_index + (j&1) + (j>>1)*s->block_wrap[0] ][0]; s->mv[0][j][0] = s->current_picture.motion_val[0][ mb_index + (j&1) + (j>>1)*s->b8_stride ][0];
s->mv[0][j][1] = s->current_picture.motion_val[0][ mb_index + (j&1) + (j>>1)*s->block_wrap[0] ][1]; s->mv[0][j][1] = s->current_picture.motion_val[0][ mb_index + (j&1) + (j>>1)*s->b8_stride ][1];
} }
}else{ }else{
s->mv_type = MV_TYPE_16X16; s->mv_type = MV_TYPE_16X16;
s->mv[0][0][0] = s->current_picture.motion_val[0][ mb_x*2+1 + (mb_y*2+1)*s->block_wrap[0] ][0]; s->mv[0][0][0] = s->current_picture.motion_val[0][ mb_x*2 + mb_y*2*s->b8_stride ][0];
s->mv[0][0][1] = s->current_picture.motion_val[0][ mb_x*2+1 + (mb_y*2+1)*s->block_wrap[0] ][1]; s->mv[0][0][1] = s->current_picture.motion_val[0][ mb_x*2 + mb_y*2*s->b8_stride ][1];
} }
s->dsp.clear_blocks(s->block[0]); s->dsp.clear_blocks(s->block[0]);
...@@ -870,7 +870,7 @@ void ff_er_frame_end(MpegEncContext *s){ ...@@ -870,7 +870,7 @@ void ff_er_frame_end(MpegEncContext *s){
if(s->pict_type==B_TYPE){ if(s->pict_type==B_TYPE){
for(mb_y=0; mb_y<s->mb_height; mb_y++){ for(mb_y=0; mb_y<s->mb_height; mb_y++){
for(mb_x=0; mb_x<s->mb_width; mb_x++){ for(mb_x=0; mb_x<s->mb_width; mb_x++){
int xy= mb_x*2+1 + (mb_y*2+1)*s->block_wrap[0]; int xy= mb_x*2 + mb_y*2*s->b8_stride;
const int mb_xy= mb_x + mb_y * s->mb_stride; const int mb_xy= mb_x + mb_y * s->mb_stride;
const int mb_type= s->current_picture.mb_type[mb_xy]; const int mb_type= s->current_picture.mb_type[mb_xy];
error= s->error_status_table[mb_xy]; error= s->error_status_table[mb_xy];
...@@ -930,7 +930,7 @@ void ff_er_frame_end(MpegEncContext *s){ ...@@ -930,7 +930,7 @@ void ff_er_frame_end(MpegEncContext *s){
dest_cb= s->current_picture.data[1] + mb_x*8 + mb_y*8 *s->uvlinesize; dest_cb= s->current_picture.data[1] + mb_x*8 + mb_y*8 *s->uvlinesize;
dest_cr= s->current_picture.data[2] + mb_x*8 + mb_y*8 *s->uvlinesize; dest_cr= s->current_picture.data[2] + mb_x*8 + mb_y*8 *s->uvlinesize;
dc_ptr= &s->dc_val[0][mb_x*2+1 + (mb_y*2+1)*(s->mb_width*2+2)]; dc_ptr= &s->dc_val[0][mb_x*2 + mb_y*2*s->b8_stride];
for(n=0; n<4; n++){ for(n=0; n<4; n++){
dc=0; dc=0;
for(y=0; y<8; y++){ for(y=0; y<8; y++){
...@@ -939,7 +939,7 @@ void ff_er_frame_end(MpegEncContext *s){ ...@@ -939,7 +939,7 @@ void ff_er_frame_end(MpegEncContext *s){
dc+= dest_y[x + (n&1)*8 + (y + (n>>1)*8)*s->linesize]; dc+= dest_y[x + (n&1)*8 + (y + (n>>1)*8)*s->linesize];
} }
} }
dc_ptr[(n&1) + (n>>1)*(s->mb_width*2+2)]= (dc+4)>>3; dc_ptr[(n&1) + (n>>1)*s->b8_stride]= (dc+4)>>3;
} }
dcu=dcv=0; dcu=dcv=0;
...@@ -950,18 +950,18 @@ void ff_er_frame_end(MpegEncContext *s){ ...@@ -950,18 +950,18 @@ void ff_er_frame_end(MpegEncContext *s){
dcv+=dest_cr[x + y*(s->uvlinesize)]; dcv+=dest_cr[x + y*(s->uvlinesize)];
} }
} }
s->dc_val[1][mb_x+1 + (mb_y+1)*(s->mb_width+2)]= (dcu+4)>>3; s->dc_val[1][mb_x + mb_y*s->mb_stride]= (dcu+4)>>3;
s->dc_val[2][mb_x+1 + (mb_y+1)*(s->mb_width+2)]= (dcv+4)>>3; s->dc_val[2][mb_x + mb_y*s->mb_stride]= (dcv+4)>>3;
} }
} }
#if 1 #if 1
/* guess DC for damaged blocks */ /* guess DC for damaged blocks */
guess_dc(s, s->dc_val[0] + s->mb_width*2+3, s->mb_width*2, s->mb_height*2, s->mb_width*2+2, 1); guess_dc(s, s->dc_val[0], s->mb_width*2, s->mb_height*2, s->b8_stride, 1);
guess_dc(s, s->dc_val[1] + s->mb_width +3, s->mb_width , s->mb_height , s->mb_width +2, 0); guess_dc(s, s->dc_val[1], s->mb_width , s->mb_height , s->mb_stride, 0);
guess_dc(s, s->dc_val[2] + s->mb_width +3, s->mb_width , s->mb_height , s->mb_width +2, 0); guess_dc(s, s->dc_val[2], s->mb_width , s->mb_height , s->mb_stride, 0);
#endif #endif
/* filter luma DC */ /* filter luma DC */
filter181(s->dc_val[0] + s->mb_width*2+3, s->mb_width*2, s->mb_height*2, s->mb_width*2+2); filter181(s->dc_val[0], s->mb_width*2, s->mb_height*2, s->b8_stride);
#if 1 #if 1
/* render DC only intra */ /* render DC only intra */
......
This diff is collapsed.
...@@ -733,7 +733,7 @@ static inline void set_p_mv_tables(MpegEncContext * s, int mx, int my, int mv4) ...@@ -733,7 +733,7 @@ static inline void set_p_mv_tables(MpegEncContext * s, int mx, int my, int mv4)
s->current_picture.motion_val[0][mot_xy+1][0]= mx; s->current_picture.motion_val[0][mot_xy+1][0]= mx;
s->current_picture.motion_val[0][mot_xy+1][1]= my; s->current_picture.motion_val[0][mot_xy+1][1]= my;
mot_xy += s->block_wrap[0]; mot_xy += s->b8_stride;
s->current_picture.motion_val[0][mot_xy ][0]= mx; s->current_picture.motion_val[0][mot_xy ][0]= mx;
s->current_picture.motion_val[0][mot_xy ][1]= my; s->current_picture.motion_val[0][mot_xy ][1]= my;
s->current_picture.motion_val[0][mot_xy+1][0]= mx; s->current_picture.motion_val[0][mot_xy+1][0]= mx;
...@@ -780,7 +780,7 @@ static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift) ...@@ -780,7 +780,7 @@ static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift)
int pred_x4, pred_y4; int pred_x4, pred_y4;
int dmin4; int dmin4;
static const int off[4]= {2, 1, 1, -1}; static const int off[4]= {2, 1, 1, -1};
const int mot_stride = s->block_wrap[0]; const int mot_stride = s->b8_stride;
const int mot_xy = s->block_index[block]; const int mot_xy = s->block_index[block];
const int block_x= (block&1); const int block_x= (block&1);
const int block_y= (block>>1); const int block_y= (block>>1);
...@@ -1102,7 +1102,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, ...@@ -1102,7 +1102,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s,
case ME_X1: case ME_X1:
case ME_EPZS: case ME_EPZS:
{ {
const int mot_stride = s->block_wrap[0]; const int mot_stride = s->b8_stride;
const int mot_xy = s->block_index[0]; const int mot_xy = s->block_index[0];
P_LEFT[0] = s->current_picture.motion_val[0][mot_xy - 1][0]; P_LEFT[0] = s->current_picture.motion_val[0][mot_xy - 1][0];
...@@ -1252,7 +1252,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, ...@@ -1252,7 +1252,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s,
int mean; int mean;
if(s->out_format == FMT_H263){ if(s->out_format == FMT_H263){
mean= (s->dc_val[i][mb_x + (mb_y+1)*(s->mb_width+2)] + 4)>>3; //FIXME not exact but simple ;) mean= (s->dc_val[i][mb_x + mb_y*s->b8_stride] + 4)>>3; //FIXME not exact but simple ;)
}else{ }else{
mean= (s->last_dc[i] + 4)>>3; mean= (s->last_dc[i] + 4)>>3;
} }
...@@ -1809,11 +1809,11 @@ void ff_fix_long_p_mvs(MpegEncContext * s) ...@@ -1809,11 +1809,11 @@ void ff_fix_long_p_mvs(MpegEncContext * s)
//printf("%d no:%d %d//\n", clip, noclip, f_code); //printf("%d no:%d %d//\n", clip, noclip, f_code);
if(s->flags&CODEC_FLAG_4MV){ if(s->flags&CODEC_FLAG_4MV){
const int wrap= 2+ s->mb_width*2; const int wrap= s->b8_stride;
/* clip / convert to intra 8x8 type MVs */ /* clip / convert to intra 8x8 type MVs */
for(y=0; y<s->mb_height; y++){ for(y=0; y<s->mb_height; y++){
int xy= (y*2 + 1)*wrap + 1; int xy= y*2*wrap;
int i= y*s->mb_stride; int i= y*s->mb_stride;
int x; int x;
......
...@@ -2324,8 +2324,8 @@ static int mpeg_decode_slice(Mpeg1Context *s1, int mb_y, ...@@ -2324,8 +2324,8 @@ static int mpeg_decode_slice(Mpeg1Context *s1, int mb_y,
return -1; return -1;
if(s->current_picture.motion_val[0] && !s->encoding){ //note motion_val is normally NULL unless we want to extract the MVs if(s->current_picture.motion_val[0] && !s->encoding){ //note motion_val is normally NULL unless we want to extract the MVs
const int wrap = field_pic ? 2*s->block_wrap[0] : s->block_wrap[0]; const int wrap = field_pic ? 2*s->b8_stride : s->b8_stride;
int xy = s->mb_x*2 + 1 + (s->mb_y*2 +1)*wrap; int xy = s->mb_x*2 + s->mb_y*2*wrap;
int motion_x, motion_y, dir, i; int motion_x, motion_y, dir, i;
if(field_pic && !s->first_field) if(field_pic && !s->first_field)
xy += wrap/2; xy += wrap/2;
......
This diff is collapsed.
...@@ -321,13 +321,16 @@ typedef struct MpegEncContext { ...@@ -321,13 +321,16 @@ typedef struct MpegEncContext {
Picture *current_picture_ptr; ///< pointer to the current picture Picture *current_picture_ptr; ///< pointer to the current picture
uint8_t *visualization_buffer[3]; //< temporary buffer vor MV visualization uint8_t *visualization_buffer[3]; //< temporary buffer vor MV visualization
int last_dc[3]; ///< last DC values for MPEG1 int last_dc[3]; ///< last DC values for MPEG1
int16_t *dc_val_base;
int16_t *dc_val[3]; ///< used for mpeg4 DC prediction, all 3 arrays must be continuous int16_t *dc_val[3]; ///< used for mpeg4 DC prediction, all 3 arrays must be continuous
int16_t dc_cache[4*5]; int16_t dc_cache[4*5];
int y_dc_scale, c_dc_scale; int y_dc_scale, c_dc_scale;
uint8_t *y_dc_scale_table; ///< qscale -> y_dc_scale table uint8_t *y_dc_scale_table; ///< qscale -> y_dc_scale table
uint8_t *c_dc_scale_table; ///< qscale -> c_dc_scale table uint8_t *c_dc_scale_table; ///< qscale -> c_dc_scale table
const uint8_t *chroma_qscale_table; ///< qscale -> chroma_qscale (h263) const uint8_t *chroma_qscale_table; ///< qscale -> chroma_qscale (h263)
uint8_t *coded_block_base;
uint8_t *coded_block; ///< used for coded block pattern prediction (msmpeg4v3, wmv1) 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 int16_t (*ac_val[3])[16]; ///< used for for mpeg4 AC prediction, all 3 arrays must be continuous
int ac_pred; int ac_pred;
uint8_t *prev_pict_types; ///< previous picture types in bitstream order, used for mb skip uint8_t *prev_pict_types; ///< previous picture types in bitstream order, used for mb skip
...@@ -857,7 +860,7 @@ void mpeg4_encode_mb(MpegEncContext *s, ...@@ -857,7 +860,7 @@ void mpeg4_encode_mb(MpegEncContext *s,
void h263_encode_picture_header(MpegEncContext *s, int picture_number); void h263_encode_picture_header(MpegEncContext *s, int picture_number);
void ff_flv_encode_picture_header(MpegEncContext *s, int picture_number); void ff_flv_encode_picture_header(MpegEncContext *s, int picture_number);
void h263_encode_gob_header(MpegEncContext * s, int mb_line); void h263_encode_gob_header(MpegEncContext * s, int mb_line);
int16_t *h263_pred_motion(MpegEncContext * s, int block, int16_t *h263_pred_motion(MpegEncContext * s, int block, int dir,
int *px, int *py); int *px, int *py);
void mpeg4_pred_ac(MpegEncContext * s, DCTELEM *block, int n, void mpeg4_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
int dir); int dir);
......
...@@ -449,7 +449,7 @@ static inline int coded_block_pred(MpegEncContext * s, int n, uint8_t **coded_bl ...@@ -449,7 +449,7 @@ static inline int coded_block_pred(MpegEncContext * s, int n, uint8_t **coded_bl
int xy, wrap, pred, a, b, c; int xy, wrap, pred, a, b, c;
xy = s->block_index[n]; xy = s->block_index[n];
wrap = s->block_wrap[0]; wrap = s->b8_stride;
/* B C /* B C
* A X * A X
...@@ -567,7 +567,7 @@ void msmpeg4_encode_mb(MpegEncContext * s, ...@@ -567,7 +567,7 @@ void msmpeg4_encode_mb(MpegEncContext * s,
s->misc_bits += get_bits_diff(s); s->misc_bits += get_bits_diff(s);
h263_pred_motion(s, 0, &pred_x, &pred_y); h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
msmpeg4v2_encode_motion(s, motion_x - pred_x); msmpeg4v2_encode_motion(s, motion_x - pred_x);
msmpeg4v2_encode_motion(s, motion_y - pred_y); msmpeg4v2_encode_motion(s, motion_y - pred_y);
}else{ }else{
...@@ -578,7 +578,7 @@ void msmpeg4_encode_mb(MpegEncContext * s, ...@@ -578,7 +578,7 @@ void msmpeg4_encode_mb(MpegEncContext * s,
s->misc_bits += get_bits_diff(s); s->misc_bits += get_bits_diff(s);
/* motion vector */ /* motion vector */
h263_pred_motion(s, 0, &pred_x, &pred_y); h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
msmpeg4_encode_motion(s, motion_x - pred_x, msmpeg4_encode_motion(s, motion_x - pred_x,
motion_y - pred_y); motion_y - pred_y);
} }
...@@ -1549,7 +1549,7 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) ...@@ -1549,7 +1549,7 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
cbp|= cbpy<<2; cbp|= cbpy<<2;
if(s->msmpeg4_version==1 || (cbp&3) != 3) cbp^= 0x3C; if(s->msmpeg4_version==1 || (cbp&3) != 3) cbp^= 0x3C;
h263_pred_motion(s, 0, &mx, &my); h263_pred_motion(s, 0, 0, &mx, &my);
mx= msmpeg4v2_decode_motion(s, mx, 1); mx= msmpeg4v2_decode_motion(s, mx, 1);
my= msmpeg4v2_decode_motion(s, my, 1); my= msmpeg4v2_decode_motion(s, my, 1);
...@@ -1637,7 +1637,7 @@ static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) ...@@ -1637,7 +1637,7 @@ static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
s->rl_chroma_table_index = s->rl_table_index; s->rl_chroma_table_index = s->rl_table_index;
} }
set_stat(ST_MV); set_stat(ST_MV);
h263_pred_motion(s, 0, &mx, &my); h263_pred_motion(s, 0, 0, &mx, &my);
if (msmpeg4_decode_motion(s, &mx, &my) < 0) if (msmpeg4_decode_motion(s, &mx, &my) < 0)
return -1; return -1;
s->mv_dir = MV_DIR_FORWARD; s->mv_dir = MV_DIR_FORWARD;
......
...@@ -564,10 +564,6 @@ static int rv10_decode_packet(AVCodecContext *avctx, ...@@ -564,10 +564,6 @@ static int rv10_decode_packet(AVCodecContext *avctx,
return -1; return -1;
} }
if(s->pict_type == B_TYPE){ //FIXME remove after cleaning mottion_val indexing
memset(s->current_picture.motion_val[0], 0, sizeof(int16_t)*2*(s->mb_width*2+2)*(s->mb_height*2+2));
}
#ifdef DEBUG #ifdef DEBUG
printf("qscale=%d\n", s->qscale); printf("qscale=%d\n", s->qscale);
#endif #endif
...@@ -600,9 +596,9 @@ static int rv10_decode_packet(AVCodecContext *avctx, ...@@ -600,9 +596,9 @@ static int rv10_decode_packet(AVCodecContext *avctx,
s->block_wrap[0]= s->block_wrap[0]=
s->block_wrap[1]= s->block_wrap[1]=
s->block_wrap[2]= s->block_wrap[2]=
s->block_wrap[3]= s->mb_width*2 + 2; s->block_wrap[3]= s->b8_stride;
s->block_wrap[4]= s->block_wrap[4]=
s->block_wrap[5]= s->mb_width + 2; s->block_wrap[5]= s->mb_stride;
ff_init_block_index(s); ff_init_block_index(s);
/* decode each macroblock */ /* decode each macroblock */
...@@ -677,10 +673,6 @@ static int rv10_decode_frame(AVCodecContext *avctx, ...@@ -677,10 +673,6 @@ static int rv10_decode_frame(AVCodecContext *avctx,
return -1; return -1;
} }
if(s->pict_type == B_TYPE){ //FIXME remove after cleaning mottion_val indexing
memset(s->current_picture.motion_val[0], 0, sizeof(int16_t)*2*(s->mb_width*2+2)*(s->mb_height*2+2));
}
if(s->mb_y>=s->mb_height){ if(s->mb_y>=s->mb_height){
MPV_frame_end(s); MPV_frame_end(s);
......
...@@ -216,7 +216,7 @@ void ff_wmv2_encode_mb(MpegEncContext * s, ...@@ -216,7 +216,7 @@ void ff_wmv2_encode_mb(MpegEncContext * s,
wmv2_inter_table[w->cbp_table_index][cbp + 64][0]); wmv2_inter_table[w->cbp_table_index][cbp + 64][0]);
/* motion vector */ /* motion vector */
h263_pred_motion(s, 0, &pred_x, &pred_y); h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
msmpeg4_encode_motion(s, motion_x - pred_x, msmpeg4_encode_motion(s, motion_x - pred_x,
motion_y - pred_y); motion_y - pred_y);
} else { } else {
...@@ -504,7 +504,7 @@ static int16_t *wmv2_pred_motion(Wmv2Context *w, int *px, int *py){ ...@@ -504,7 +504,7 @@ static int16_t *wmv2_pred_motion(Wmv2Context *w, int *px, int *py){
int xy, wrap, diff, type; int xy, wrap, diff, type;
int16_t *A, *B, *C, *mot_val; int16_t *A, *B, *C, *mot_val;
wrap = s->block_wrap[0]; wrap = s->b8_stride;
xy = s->block_index[0]; xy = s->block_index[0];
mot_val = s->current_picture.motion_val[0][xy]; mot_val = s->current_picture.motion_val[0][xy];
......
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