@ -77,7 +77,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
AVFilterLink * outlink = ctx - > outputs [ 0 ] ;
AVFrame * out ;
uint8_t * inrow , * outrow ;
int i , j , plane , step , hsub , vsub ;
int i , j , plane , step ;
out = ff_get_video_buffer ( outlink , outlink - > w , outlink - > h ) ;
if ( ! out ) {
@ -91,16 +91,16 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
memcpy ( out - > data [ 1 ] , in - > data [ 1 ] , AVPALETTE_SIZE ) ;
for ( plane = 0 ; plane < 4 & & in - > data [ plane ] ; plane + + ) {
const int width = ( plane = = 1 | | plane = = 2 ) ? FF_CEIL_RSHIFT ( inlink - > w , flip - > hsub ) : inlink - > w ;
const int height = ( plane = = 1 | | plane = = 2 ) ? FF_CEIL_RSHIFT ( inlink - > h , flip - > vsub ) : inlink - > h ;
step = flip - > max_step [ plane ] ;
hsub = ( plane = = 1 | | plane = = 2 ) ? flip - > hsub : 0 ;
vsub = ( plane = = 1 | | plane = = 2 ) ? flip - > vsub : 0 ;
outrow = out - > data [ plane ] ;
inrow = in - > data [ plane ] + ( ( inlink - > w > > hsub ) - 1 ) * step ;
for ( i = 0 ; i < in - > height > > vsub ; i + + ) {
inrow = in - > data [ plane ] + ( width - 1 ) * step ;
for ( i = 0 ; i < height ; i + + ) {
switch ( step ) {
case 1 :
for ( j = 0 ; j < ( inlink - > w > > hsub ) ; j + + )
for ( j = 0 ; j < width ; j + + )
outrow [ j ] = inrow [ - j ] ;
break ;
@ -108,7 +108,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
{
uint16_t * outrow16 = ( uint16_t * ) outrow ;
uint16_t * inrow16 = ( uint16_t * ) inrow ;
for ( j = 0 ; j < ( inlink - > w > > hsub ) ; j + + )
for ( j = 0 ; j < width ; j + + )
outrow16 [ j ] = inrow16 [ - j ] ;
}
break ;
@ -117,7 +117,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
{
uint8_t * in = inrow ;
uint8_t * out = outrow ;
for ( j = 0 ; j < ( inlink - > w > > hsub ) ; j + + , out + = 3 , in - = 3 ) {
for ( j = 0 ; j < width ; j + + , out + = 3 , in - = 3 ) {
int32_t v = AV_RB24 ( in ) ;
AV_WB24 ( out , v ) ;
}
@ -128,13 +128,13 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
{
uint32_t * outrow32 = ( uint32_t * ) outrow ;
uint32_t * inrow32 = ( uint32_t * ) inrow ;
for ( j = 0 ; j < ( inlink - > w > > hsub ) ; j + + )
for ( j = 0 ; j < width ; j + + )
outrow32 [ j ] = inrow32 [ - j ] ;
}
break ;
default :
for ( j = 0 ; j < ( inlink - > w > > hsub ) ; j + + )
for ( j = 0 ; j < width ; j + + )
memcpy ( outrow + j * step , inrow - j * step , step ) ;
}