Example #1
0
/*!
    allocate planes[] and planeSizes[] according to size and format
    \internal
*/
void QVideoFramePrivate::allocateOwnPlanes()
{
    int totalSize  = 0;
    int planeSizes[maxPlanesCount];

    for ( int plane = 0; plane < maxPlanesCount; plane++ ) {
        int depth = QVideoFrame::colorDepth( format, plane );
        if ( depth ) {
            QSize pSize = planeSize( plane );

            bytesPerLine[plane] = (( pSize.width() * depth + 31)/32) * 32 / 8;
            planeSizes[plane] = bytesPerLine[plane] * pSize.height();
            //planes[plane] = (uchar *)malloc( bytesPerLine[plane] * pSize.height() );
            totalSize += planeSizes[plane];
        } else
            planeSizes[plane] = 0;
    }

    if ( totalSize ) {
        planes[0] = (uchar *)malloc( totalSize );
        for ( int plane = 1; plane < maxPlanesCount; plane++ ) {
            if ( planeSizes[plane] )
                planes[plane] = planes[plane-1] + planeSizes[plane-1];
            else
                break;
        }
    }
}
Example #2
0
/*!
    \internal
*/
QVideoFramePrivate::QVideoFramePrivate( const QVideoFramePrivate& other )
:QSharedData(other)
{
    size = other.size;
    format = other.format;
    ownData = true;
    bufferHelper = 0;

    allocateOwnPlanes();

    for ( int plane=0; plane < maxPlanesCount; ++plane ) {
        bytesPerLine[plane] = other.bytesPerLine[plane];
        constPlanes[plane] = 0;

        if ( other.planes[plane] ) {
            memcpy( planes[plane], other.planes[plane], planeSize(plane).height()*bytesPerLine[plane] );
        } else if ( other.constPlanes[plane] ) {
            memcpy( planes[plane], other.constPlanes[plane], planeSize(plane).height()*bytesPerLine[plane] );
        }
    }

    aspectRatio = other.aspectRatio;
    isAspectRatioDefined = other.isAspectRatioDefined;
}
Example #3
0
tscalar* planeData(tindex i) { return data() + i * planeSize(); }
Example #4
0
 decltype(auto) vector(tindex i) { return tensor::map_vector(planeData(i), planeSize()); }