Example #1
0
bool TcspInfos::TsortFc::operator()(const TcspInfo* &csp1, const TcspInfo* &csp2)
{
    int rank1;
    csp_bestMatch(csp, csp1->id, &rank1, outPrimaryCSP);
    int rank2;
    csp_bestMatch(csp, csp2->id, &rank2, outPrimaryCSP);
    return rank1 > rank2;
}
Example #2
0
bool TimgFilter::getOutputFmt(TffPictBase &pict,const TfilterSettingsVideo *cfg)
{
    if (!is(pict,cfg)) {
        return false;
    }
    uint64_t supcsp1=getSupportedInputColorspaces(cfg);
    if (((pict.csp&FF_CSPS_MASK)&(supcsp1&FF_CSPS_MASK))==0) {
        pict.csp=csp_bestMatch(pict.csp,supcsp1&FF_CSPS_MASK)|(supcsp1&FF_CSP_FLAGS_VFLIP);
    }
    uint64_t supcsp2=getSupportedOutputColorspaces(cfg);
    if (((pict.csp&FF_CSPS_MASK)&(supcsp2&FF_CSPS_MASK))==0) {
        pict.csp=csp_bestMatch(pict.csp,supcsp2&FF_CSPS_MASK)|(supcsp2&FF_CSP_FLAGS_VFLIP);
    }
    return true;
}
Example #3
0
/**
 * get addresses of next picture buffer (Next picture buffer is a picture to be written by image filter.)
 * Image buffer is prepared for new picture (own2).
 * Picture will not be copied unless it has borders that are not going to be processed or TimgFilter::pictHalf is set true.
 *
 * @param[in] csp requested color space.
 * @param[in] pict current picture
 * @param[out] pict next picture
 * @param[in] full true: process whole image, false: process rectClip.
 * @param[in,out] dst[4] pointer to the array to receive the addresses
 * @param[in] rect2 If not NULL, pict.rectClip will be replaced by rect2.
 * *return true if color space is changed.
 * stride will be set to TimgFilter::stride2
 */
bool TimgFilter::getNext(uint64_t csp,TffPict &pict,int full,unsigned char **dst[4],const Trect *rect2)
{
    if (rect2) {
        pict.rectFull=pict.rectClip=*rect2;
    }
    const Trect &r=pictRect;//full?pict.rectFull:pict.rectClip;
    TffPict pictN;
    if (((csp&FF_CSPS_MASK)&(pict.csp&FF_CSPS_MASK))==0) {
        pict.convertCSP(csp_bestMatch(pict.csp,csp&FF_CSPS_MASK)|(csp&FF_CSP_FLAGS_YUV_ADJ),own2);
        pict.setRO(false);
        pictN=pict;
    } else {
        pictN=pict;
        pictN.convertCSP(pict.csp|(csp&FF_CSP_FLAGS_YUV_ADJ),own2);
    }
    bool copyBorder=!rect2 && !full && pict.rectClip!=pict.rectFull;
    unsigned int i = 0;
    for (; i<pict.cspInfo.numPlanes; i++) {
        if (dst[i]) {
            if (copyBorder) {
                pictN.copyBorder(pict,i);
            }
            if (pictHalf && !rect2) {
                TffPict::copy(pictN.data[i]+(full?0:pictN.diff[i]),pictN.stride[i],pict.data[i]+(full?0:pict.diff[i]),pict.stride[i],(pictRect.dx>>pictN.cspInfo.shiftX[i])*pict.cspInfo.Bpp,pictRect.dy>>pictN.cspInfo.shiftY[i]);
            }
            pict.diff[i]=pictN.diff[i];
            pict.ro[i]=false;
            pict.data[i]=pictN.data[i];
            pict.stride[i]=pictN.stride[i];
            *dst[i]=pict.data[i]+(full?0:pict.diff[i]);
            if (pictHalf && !rect2) {
                *dst[i]+=(pictRect.x>>pict.cspInfo.shiftX[i])*pict.cspInfo.Bpp;
            }
        }
Example #4
0
/**
 * get addresses of current picture buffer (Current picture is usually a picture to feed into image filter.)
 * If color space conversion is necessary, own1 will be used.
 * If color space conversion is not necessary, picture buffer will not be copied.
 *
 * @param[in] csp requested color space.
 * @param[in,out] pict current picture (will be modifed if necessary)
 * @param[in] full
 * @param[in,out] src[4] pointer to the array to receive the addresses
 * *return true if color space is changed.
 * stride will be set to TimgFilter::stride1
 */
bool TimgFilter::getCur(uint64_t csp,TffPict &pict,int full,const unsigned char **src[4])
{
    uint64_t wasAdj=pict.csp&FF_CSP_FLAGS_YUV_ADJ;
    csp_yuv_adj_to_plane(pict.csp,&pict.cspInfo,pict.rectFull.dy,pict.data,pict.stride);
    csp_yuv_order(pict.csp,pict.data,pict.stride);

    // if color space is different or FF_CSP_FLAGS_YUV_ADJ is different
    if (((csp&FF_CSPS_MASK)&(pict.csp&FF_CSPS_MASK))==0 || ((csp&FF_CSP_FLAGS_YUV_ADJ) && !wasAdj)) {
        if (!convert1) {
            convert1=new Tconvert(deci,pict.rectFull.dx,pict.rectFull.dy);
        }
        pict.convertCSP(csp_bestMatch(pict.csp,csp&FF_CSPS_MASK)|(csp&(FF_CSP_FLAGS_VFLIP|FF_CSP_FLAGS_YUV_ADJ|FF_CSP_FLAGS_YUV_ORDER)),own1,convert1);
        pict.setRO(false);
    }

    bool cspChanged=csp1!=pict.csp;
    csp1=pict.csp;
    const Trect &r=pictRect; //full?pict.rectFull:pict.rectClip;
    unsigned int i = 0;
    for (; i<pict.cspInfo.numPlanes; i++) {
        if (src[i]) {
            *src[i]=pict.data[i]+(full?0:pict.diff[i])+(pictHalf?r.x*pict.cspInfo.Bpp>>pict.cspInfo.shiftX[i]:0);
        }
        stride1[i]=pict.stride[i];
        dx1[i]=r.dx>>pict.cspInfo.shiftX[i];
        dy1[i]=r.dy>>pict.cspInfo.shiftY[i];
    }
    for (; i<4; i++) {
        src[i] = NULL;
        stride1[i] = 0;
        dx1[i] = 0;
        dy1[i] = 0;
    }
    return cspChanged;
}
Example #5
0
bool TcspInfos::TsortFc::operator ()(const TcspInfo* csp1,const TcspInfo* csp2)
{
 int rank1;csp_bestMatch(csp,csp1->id,&rank1);
 int rank2;csp_bestMatch(csp,csp2->id,&rank2);
 return rank1>rank2;
}