@ -102,47 +102,6 @@ void ff_h263_update_motion_val(MpegEncContext * s){
}
}
int ff_h263_pred_dc ( MpegEncContext * s , int n , int16_t * * dc_val_ptr )
{
int x , y , wrap , a , c , pred_dc ;
int16_t * dc_val ;
/* find prediction */
if ( n < 4 ) {
x = 2 * s - > mb_x + ( n & 1 ) ;
y = 2 * s - > mb_y + ( ( n & 2 ) > > 1 ) ;
wrap = s - > b8_stride ;
dc_val = s - > dc_val [ 0 ] ;
} else {
x = s - > mb_x ;
y = s - > mb_y ;
wrap = s - > mb_stride ;
dc_val = s - > dc_val [ n - 4 + 1 ] ;
}
/* B C
* A X
*/
a = dc_val [ ( x - 1 ) + ( y ) * wrap ] ;
c = dc_val [ ( x ) + ( y - 1 ) * wrap ] ;
/* No prediction outside GOB boundary */
if ( s - > first_slice_line & & n ! = 3 ) {
if ( n ! = 2 ) c = 1024 ;
if ( n ! = 1 & & s - > mb_x = = s - > resync_mb_x ) a = 1024 ;
}
/* just DC prediction */
if ( a ! = 1024 & & c ! = 1024 )
pred_dc = ( a + c ) > > 1 ;
else if ( a ! = 1024 )
pred_dc = a ;
else
pred_dc = c ;
/* we assume pred is positive */
* dc_val_ptr = & dc_val [ x + y * wrap ] ;
return pred_dc ;
}
void ff_h263_loop_filter ( MpegEncContext * s ) {
int qp_c ;
const int linesize = s - > linesize ;
@ -228,93 +187,6 @@ void ff_h263_loop_filter(MpegEncContext * s){
}
}
void ff_h263_pred_acdc ( MpegEncContext * s , int16_t * block , int n )
{
int x , y , wrap , a , c , pred_dc , scale , i ;
int16_t * dc_val , * ac_val , * ac_val1 ;
/* find prediction */
if ( n < 4 ) {
x = 2 * s - > mb_x + ( n & 1 ) ;
y = 2 * s - > mb_y + ( n > > 1 ) ;
wrap = s - > b8_stride ;
dc_val = s - > dc_val [ 0 ] ;
ac_val = s - > ac_val [ 0 ] [ 0 ] ;
scale = s - > y_dc_scale ;
} else {
x = s - > mb_x ;
y = s - > mb_y ;
wrap = s - > mb_stride ;
dc_val = s - > dc_val [ n - 4 + 1 ] ;
ac_val = s - > ac_val [ n - 4 + 1 ] [ 0 ] ;
scale = s - > c_dc_scale ;
}
ac_val + = ( ( y ) * wrap + ( x ) ) * 16 ;
ac_val1 = ac_val ;
/* B C
* A X
*/
a = dc_val [ ( x - 1 ) + ( y ) * wrap ] ;
c = dc_val [ ( x ) + ( y - 1 ) * wrap ] ;
/* No prediction outside GOB boundary */
if ( s - > first_slice_line & & n ! = 3 ) {
if ( n ! = 2 ) c = 1024 ;
if ( n ! = 1 & & s - > mb_x = = s - > resync_mb_x ) a = 1024 ;
}
if ( s - > ac_pred ) {
pred_dc = 1024 ;
if ( s - > h263_aic_dir ) {
/* left prediction */
if ( a ! = 1024 ) {
ac_val - = 16 ;
for ( i = 1 ; i < 8 ; i + + ) {
block [ s - > idsp . idct_permutation [ i < < 3 ] ] + = ac_val [ i ] ;
}
pred_dc = a ;
}
} else {
/* top prediction */
if ( c ! = 1024 ) {
ac_val - = 16 * wrap ;
for ( i = 1 ; i < 8 ; i + + ) {
block [ s - > idsp . idct_permutation [ i ] ] + = ac_val [ i + 8 ] ;
}
pred_dc = c ;
}
}
} else {
/* just DC prediction */
if ( a ! = 1024 & & c ! = 1024 )
pred_dc = ( a + c ) > > 1 ;
else if ( a ! = 1024 )
pred_dc = a ;
else
pred_dc = c ;
}
/* we assume pred is positive */
block [ 0 ] = block [ 0 ] * scale + pred_dc ;
if ( block [ 0 ] < 0 )
block [ 0 ] = 0 ;
else
block [ 0 ] | = 1 ;
/* Update AC/DC tables */
dc_val [ ( x ) + ( y ) * wrap ] = block [ 0 ] ;
/* left copy */
for ( i = 1 ; i < 8 ; i + + )
ac_val1 [ i ] = block [ s - > idsp . idct_permutation [ i < < 3 ] ] ;
/* top copy */
for ( i = 1 ; i < 8 ; i + + )
ac_val1 [ 8 + i ] = block [ s - > idsp . idct_permutation [ i ] ] ;
}
int16_t * ff_h263_pred_motion ( MpegEncContext * s , int block , int dir ,
int * px , int * py )
{