Logo Search packages:      
Sourcecode: blender version File versions  Download package

void ff_emulated_edge_mc ( uint8_t *  buf,
uint8_t *  src,
int  linesize,
int  block_w,
int  block_h,
int  src_x,
int  src_y,
int  w,
int  h 
)

Copies a rectangular area of samples to a temporary buffer and replicates the boarder samples.

Parameters:
buf destination buffer
src source buffer
linesize number of bytes between 2 vertically adjacent samples in both the source and destination buffers
block_w width of block
block_h height of block
src_x x coordinate of the top left sample of the block in the source buffer
src_y y coordinate of the top left sample of the block in the source buffer
w width of the source buffer
h height of the source buffer

Definition at line 2751 of file mpegvideo.c.

Referenced by chroma_4mv_motion(), and MPV_motion().

                                                                       {
    int x, y;
    int start_y, start_x, end_y, end_x;

    if(src_y>= h){
        src+= (h-1-src_y)*linesize;
        src_y=h-1;
    }else if(src_y<=-block_h){
        src+= (1-block_h-src_y)*linesize;
        src_y=1-block_h;
    }
    if(src_x>= w){
        src+= (w-1-src_x);
        src_x=w-1;
    }else if(src_x<=-block_w){
        src+= (1-block_w-src_x);
        src_x=1-block_w;
    }

    start_y= FFMAX(0, -src_y);
    start_x= FFMAX(0, -src_x);
    end_y= FFMIN(block_h, h-src_y);
    end_x= FFMIN(block_w, w-src_x);

    // copy existing part
    for(y=start_y; y<end_y; y++){
        for(x=start_x; x<end_x; x++){
            buf[x + y*linesize]= src[x + y*linesize];
        }
    }

    //top
    for(y=0; y<start_y; y++){
        for(x=start_x; x<end_x; x++){
            buf[x + y*linesize]= buf[x + start_y*linesize];
        }
    }

    //bottom
    for(y=end_y; y<block_h; y++){
        for(x=start_x; x<end_x; x++){
            buf[x + y*linesize]= buf[x + (end_y-1)*linesize];
        }
    }

    for(y=0; y<block_h; y++){
       //left
        for(x=0; x<start_x; x++){
            buf[x + y*linesize]= buf[start_x + y*linesize];
        }

       //right
        for(x=end_x; x<block_w; x++){
            buf[x + y*linesize]= buf[end_x - 1 + y*linesize];
        }
    }
}


Generated by  Doxygen 1.6.0   Back to index