/**
    \fn getNextFrame
*/
bool blackenBorders::getNextFrame(uint32_t *fn,ADMImage *image)
{
    if(!previousFilter->getNextFrame(fn,image))
    {
        ADM_info("[blackenBorder] Cannot get previous image\n");
        return false;
    }


    // Top...
    uint8_t *ptr[3];
    uint32_t stride[3];
    image->GetPitches(stride);
    image->GetWritePlanes(ptr);
    // top
    blackenHz(image->_width,param.top,ptr,stride);
    // Left
    blackenHz(param.left,image->_height,ptr,stride);
    // Right
    uint32_t pWidth=previousFilter->getInfo()->width-param.right;
    ptr[0]+=pWidth;
    ptr[1]+=(pWidth)/2;
    ptr[2]+=(pWidth)/2;
    blackenHz(param.right,image->_height,ptr,stride);
    // Bottom
    image->GetPitches(stride);
    image->GetWritePlanes(ptr);
    uint32_t offsetLine=previousFilter->getInfo()->height-param.bottom;
    ptr[0]+=offsetLine*stride[0];
    ptr[1]+=(offsetLine/2)*stride[1];
    ptr[2]+=(offsetLine/2)*stride[2];
    blackenHz(image->_width,param.bottom,ptr,stride);
    return true;
}
/**
    \fn getNextFrame
*/
bool addBorders::getNextFrame(uint32_t *fn,ADMImage *image)
{
    uint32_t smallWidth=previousFilter->getInfo()->width;
    uint32_t smallHeight=previousFilter->getInfo()->height;

    ADMImageRefWrittable ref(smallWidth,smallHeight);

    image->GetWritePlanes(ref._planes);
    image->GetPitches(ref._planeStride);

    uint32_t offset=param.top*image->GetPitch(PLANAR_Y);
    ref._planes[0]+=param.left+offset;

    offset=(param.top>>1)*image->GetPitch(PLANAR_U);
    ref._planes[1]+=(param.left>>1)+offset;

    offset=(param.top>>1)*image->GetPitch(PLANAR_V);
    ref._planes[2]+=(param.left>>1)+offset;


    if(false==previousFilter->getNextFrame(fn,&ref))
    {
        ADM_warning("FlipFilter : Cannot get frame\n");
        return false;
    }
    // Now do fill

    // Top...
    uint8_t *ptr[3];
    int     stride[3];
    image->GetPitches(stride);
    image->GetWritePlanes(ptr);
    blackenHz(image->_width,param.top,ptr,stride);
    // Left
    blackenHz(param.left,image->_height,ptr,stride);
    // Right
    uint32_t pWidth=previousFilter->getInfo()->width;
    ptr[0]+=param.left+pWidth;
    ptr[1]+=(param.left+pWidth)/2;
    ptr[2]+=(param.left+pWidth)/2;
    blackenHz(param.right,image->_height,ptr,stride);
    // Bottom
    image->GetPitches(stride);
    image->GetWritePlanes(ptr);
    uint32_t offsetLine=previousFilter->getInfo()->height+param.top;
    ptr[0]+=offsetLine*stride[0];
    ptr[1]+=(offsetLine/2)*stride[1];
    ptr[2]+=(offsetLine/2)*stride[2];
    blackenHz(image->_width,param.bottom,ptr,stride);
    // Copy info
    image->copyInfo(&ref);
    return true;
}