question: public void ff_emulated_edge_mc ( int [ ] buf_base , int buf_offset , int [ ] src_base , int src_offset , int linesize , int block_w , int block_h , int src_x , int src_y , int w , int h ) { int x , y ; int start_y , start_x , end_y , end_x ; if ( src_y >= h ) { src_offset += ( h - 1 - src_y ) * linesize ; src_y = h - 1 ; } else if ( src_y <= - block_h ) { src_offset += ( 1 - block_h - src_y ) * linesize ; src_y = 1 - block_h ; } if ( src_x >= w ) { src_offset += ( w - 1 - src_x ) ; src_x = w - 1 ; } else if ( src_x <= - block_w ) { src_offset += ( 1 - block_w - src_x ) ; src_x = 1 - block_w ; } start_y = Math . max ( 0 , - src_y ) ; start_x = Math . max ( 0 , - src_x ) ; end_y = Math . min ( block_h , h - src_y ) ; end_x = Math . min ( block_w , w - src_x ) ; for ( y = start_y ; y < end_y ; y ++ ) { for ( x = start_x ; x < end_x ; x ++ ) { buf_base [ buf_offset + x + y * linesize ] = src_base [ src_offset + x + y * linesize ] ; } } for ( y = 0 ; y < start_y ; y ++ ) { for ( x = start_x ; x < end_x ; x ++ ) { buf_base [ buf_offset + x + y * linesize ] = buf_base [ buf_offset + x + start_y * linesize ] ; } } for ( y = end_y ; y < block_h ; y ++ ) { for ( x = start_x ; x < end_x ; x ++ ) { buf_base [ buf_offset + x + y * linesize ] = buf_base [ buf_offset + x + ( end_y - 1 ) * linesize ] ; } } for ( y = 0 ; y < block_h ; y ++ ) { for ( x = 0 ; x < start_x ; x ++ ) { buf_base [ buf_offset + x + y * linesize ] = buf_base [ buf_offset + start_x + y * linesize ] ; } for ( x = end_x ; x < block_w ; x ++ ) { buf_base [ buf_offset + x + y * linesize ] = buf_base [ buf_offset + end_x - 1 + y * linesize ] ; } } }
target:  Copy a rectangular area of samples to a temporary buffer and replicate the border samples.