I'm having a problem using the LGPL version of sws_scale (the one built 
into FFMPEG) to convert my PIX_FMT_BGR24 frames to PIX_FMT_YUV420P 
format for MPEG4 compression.

The images are being split verticaly down the center with the right side 
appearing on the left and the left side appearing on the right. (they 
also look flipped vertically but that might be expected)
The source image and resulting YUV image can be seen here: 
http://www.schuckmannacres.com/node/3  (ignore the difference in the 
file size)
My copy of FFMPEG is rcode is based on r15986 which I think is from Dec 
1 or there abouts.

Is this a bug in sws_scale or in my code any help would be very much 
appreciated.

Thank you
Matt S.

My code is below, where:
The height and width of the bitmap is 1216 x 1216.
The source format (pixelFormat) is PIX_FMT_BGR32.
The destination format (m_pContext->pix_fmt is PIX_FMT_YUV420P)
The context has been setup for a height and width of 1216x1216.


avpicture_fill(
      (AVPicture*)(m_pimple->m_pRGBPicture)
      ,reinterpret_cast<uint8_t*>(pBM + sizeof(BITMAPINFOHEADER))
      ,pixelFormat
      ,pBM->biWidth
      ,pBM->biHeight );
   
    //If we haven't created our conversion context or one or more of
    //the parameter has changed (image sizes) create or recreate it now.
    m_pimple->m_pSwsContext = sws_getCachedContext(
      m_pimple->m_pSwsContext
      ,pBM->biWidth
      ,pBM->biHeight
      ,pixelFormat
      ,m_pimple->m_pContext->width
      ,m_pimple->m_pContext->height
      ,m_pimple->m_pContext->pix_fmt
      ,SWS_FAST_BILINEAR, NULL, NULL, NULL );

    //Now do the conversion (and possibly a scale if the bitmap height 
and width
    //don't match what the encoder context is setup for.
    if( m_pimple->m_pSwsContext )
    {
      avRet = sws_scale(
        m_pimple->m_pSwsContext
        ,m_pimple->m_pRGBPicture->data
        ,m_pimple->m_pRGBPicture->linesize
        ,0
        ,m_pimple->m_pContext->height
        ,m_pimple->m_pPicture->data
        ,m_pimple->m_pPicture->linesize );
}

_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to