Revision cf1cd520 libswscale/swscale.c

View differences:

libswscale/swscale.c
1308 1308
#endif //!CONFIG_RUNTIME_CPUDETECT
1309 1309
}
1310 1310

  
1311
static int planarToNv12Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
1312
                               int srcSliceH, uint8_t* dstParam[], int dstStride[])
1311
static void copyPlane(const uint8_t *src, int srcStride,
1312
                      int srcSliceY, int srcSliceH, int width,
1313
                      uint8_t *dst, int dstStride)
1313 1314
{
1314
    uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
1315
    /* Copy Y plane */
1316
    if (dstStride[0]==srcStride[0] && srcStride[0] > 0)
1317
        memcpy(dst, src[0], srcSliceH*dstStride[0]);
1318
    else {
1315
    dst += dstStride * srcSliceY;
1316
    if (dstStride == srcStride && srcStride > 0) {
1317
        memcpy(dst, src, srcSliceH * dstStride);
1318
    } else {
1319 1319
        int i;
1320
        const uint8_t *srcPtr= src[0];
1320
        const uint8_t *srcPtr = src;
1321 1321
        uint8_t *dstPtr= dst;
1322 1322
        for (i=0; i<srcSliceH; i++) {
1323
            memcpy(dstPtr, srcPtr, c->srcW);
1324
            srcPtr+= srcStride[0];
1325
            dstPtr+= dstStride[0];
1323
            memcpy(dstPtr, srcPtr, width);
1324
            srcPtr += srcStride;
1325
            dstPtr += dstStride;
1326 1326
        }
1327 1327
    }
1328
    dst = dstParam[1] + dstStride[1]*srcSliceY/2;
1328
}
1329

  
1330
static int planarToNv12Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
1331
                               int srcSliceH, uint8_t* dstParam[], int dstStride[])
1332
{
1333
    uint8_t *dst = dstParam[1] + dstStride[1]*srcSliceY/2;
1334

  
1335
    copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,
1336
              dstParam[0], dstStride[0]);
1337

  
1329 1338
    if (c->dstFormat == PIX_FMT_NV12)
1330 1339
        interleaveBytes(src[1], src[2], dst, c->srcW/2, srcSliceH/2, srcStride[1], srcStride[2], dstStride[0]);
1331 1340
    else
......
1583 1592
static int yvu9ToYv12Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
1584 1593
                             int srcSliceH, uint8_t* dst[], int dstStride[])
1585 1594
{
1586
    int i;
1587

  
1588
    /* copy Y */
1589
    if (srcStride[0]==dstStride[0] && srcStride[0] > 0)
1590
        memcpy(dst[0]+ srcSliceY*dstStride[0], src[0], srcStride[0]*srcSliceH);
1591
    else {
1592
        const uint8_t *srcPtr= src[0];
1593
        uint8_t *dstPtr= dst[0] + dstStride[0]*srcSliceY;
1594

  
1595
        for (i=0; i<srcSliceH; i++) {
1596
            memcpy(dstPtr, srcPtr, c->srcW);
1597
            srcPtr+= srcStride[0];
1598
            dstPtr+= dstStride[0];
1599
        }
1600
    }
1595
    copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,
1596
              dst[0], dstStride[0]);
1601 1597

  
1602 1598
    planar2x(src[1], dst[1] + dstStride[1]*(srcSliceY >> 1), c->chrSrcW,
1603 1599
             srcSliceH >> 2, srcStride[1], dstStride[1]);

Also available in: Unified diff