Fix bug when calculating BytesPerFrame
This commit is contained in:
1 parent
379d13a8ed
commit
51f9585263
3 files changed
+34
-20
No files matched your search
+22
-3
@@ -170,7 +170,7 @@ UInt64 PlaYUVerFrame::getBytesPerFrame( UInt uiWidth, UInt uiHeight, Int iPixelF
|
||||
UInt64 numberBytes = uiWidth * uiHeight;
|
||||
if( pcPelFormat->numberChannels > 1 )
|
||||
{
|
||||
UInt64 numberBytesChroma = CHROMASHIFT( uiWidth, pcPelFormat->log2ChromaWidth ) * CHROMASHIFT( uiWidth, pcPelFormat->log2ChromaHeight );
|
||||
UInt64 numberBytesChroma = CHROMASHIFT( uiWidth, pcPelFormat->log2ChromaWidth ) * CHROMASHIFT( uiHeight, pcPelFormat->log2ChromaHeight );
|
||||
numberBytes += ( pcPelFormat->numberChannels - 1 ) * numberBytesChroma;
|
||||
}
|
||||
return numberBytes;
|
||||
@@ -255,7 +255,8 @@ Void PlaYUVerFrame::frameToBuffer( Pel *output_buffer )
|
||||
|
||||
for( i = 0; i < CHROMASHIFT( m_uiHeight, ratioH ) * CHROMASHIFT( m_uiWidth, ratioW ); i++ )
|
||||
{
|
||||
*pTmpBuff++ = *pTmpPel++;
|
||||
*pTmpBuff = *pTmpPel++;
|
||||
pTmpBuff += step;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,7 +266,25 @@ Void PlaYUVerFrame::fillRGBBuffer()
|
||||
{
|
||||
if( m_bHasRGBPel )
|
||||
return;
|
||||
m_pcPelFormat->fillARGB32buffer( m_pppcInputPel, m_pcARGB32, m_uiWidth, m_uiHeight );
|
||||
if( m_pcPelFormat->colorSpace == COLOR_RGB )
|
||||
{
|
||||
Pel* pR = m_pppcInputPel[COLOR_R][0];
|
||||
Pel* pG = m_pppcInputPel[COLOR_G][0];
|
||||
Pel* pB = m_pppcInputPel[COLOR_B][0];
|
||||
Int iR, iG, iB;
|
||||
UInt* pARGB = ( UInt* )m_pcARGB32;
|
||||
for( UInt i = 0; i < m_uiHeight * m_uiWidth; i++ )
|
||||
{
|
||||
iR = *pR++;
|
||||
iG = *pG++;
|
||||
iB = *pB++;
|
||||
*pARGB++ = PEL_RGB( iR, iG, iB );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pcPelFormat->fillARGB32buffer( m_pppcInputPel, m_pcARGB32, m_uiWidth, m_uiHeight );
|
||||
}
|
||||
m_bHasRGBPel = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -239,23 +239,16 @@ Void fillARGB32bufferYUV420p( Pel*** in, UChar* out, UInt width, UInt height )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Void fillARGB32bufferYUV444p( Pel*** in, UChar* out, UInt width, UInt height )
|
||||
{
|
||||
fillARGB32bufferYUV( in, out, width, height, 0, 0 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Void fillARGB32bufferYUV422( Pel*** in, UChar* out, UInt width, UInt height )
|
||||
{
|
||||
fillARGB32bufferYUV( in, out, width, height, 1, 0 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Void fillARGB32bufferGray( Pel*** in, UChar* out, UInt width, UInt height )
|
||||
{
|
||||
Pel *inPel = in[0][0];
|
||||
@@ -285,6 +278,7 @@ Void fillARGB32bufferRGB( Pel*** in, UChar* out, UInt width, UInt height )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PlaYUVerPixFmtDescriptor yuv420p =
|
||||
{
|
||||
"YUV420p",
|
||||
@@ -293,13 +287,13 @@ PlaYUVerPixFmtDescriptor yuv420p =
|
||||
3,
|
||||
1,
|
||||
1,
|
||||
fillARGB32bufferYUV420p,
|
||||
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_YUV420P ),
|
||||
{
|
||||
{ 0, 0, 1, 0, 7 }, /* Y */
|
||||
{ 1, 0, 1, 0, 7 }, /* U */
|
||||
{ 2, 0, 1, 0, 7 }, /* V */
|
||||
},
|
||||
fillARGB32bufferYUV420p,
|
||||
};
|
||||
|
||||
PlaYUVerPixFmtDescriptor yuv422p =
|
||||
@@ -310,13 +304,13 @@ PlaYUVerPixFmtDescriptor yuv422p =
|
||||
3,
|
||||
1,
|
||||
0,
|
||||
fillARGB32bufferYUV422,
|
||||
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_YUV422P ),
|
||||
{
|
||||
{ 0, 0, 1, 0, 7 }, /* Y */
|
||||
{ 1, 0, 1, 0, 7 }, /* U */
|
||||
{ 2, 0, 1, 0, 7 }, /* V */
|
||||
},
|
||||
fillARGB32bufferYUV422,
|
||||
};
|
||||
|
||||
PlaYUVerPixFmtDescriptor yuv444p =
|
||||
@@ -327,13 +321,13 @@ PlaYUVerPixFmtDescriptor yuv444p =
|
||||
3,
|
||||
0,
|
||||
0,
|
||||
fillARGB32bufferYUV444p,
|
||||
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_YUV444P ),
|
||||
{
|
||||
{ 0, 0, 1, 0, 7 }, /* Y */
|
||||
{ 1, 0, 1, 0, 7 }, /* U */
|
||||
{ 2, 0, 1, 0, 7 }, /* V */
|
||||
},
|
||||
fillARGB32bufferYUV444p,
|
||||
};
|
||||
|
||||
PlaYUVerPixFmtDescriptor yuyv422 =
|
||||
@@ -344,13 +338,13 @@ PlaYUVerPixFmtDescriptor yuyv422 =
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
fillARGB32bufferYUV422,
|
||||
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_YUYV422 ),
|
||||
{
|
||||
{ 0, 1, 1, 0, 7 }, /* Y */
|
||||
{ 0, 3, 2, 0, 7 }, /* U */
|
||||
{ 0, 3, 4, 0, 7 }, /* V */
|
||||
},
|
||||
fillARGB32bufferYUV422,
|
||||
};
|
||||
|
||||
PlaYUVerPixFmtDescriptor gray =
|
||||
@@ -361,9 +355,9 @@ PlaYUVerPixFmtDescriptor gray =
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
fillARGB32bufferGray,
|
||||
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_GRAY8 ),
|
||||
{ { 0, 0, 1, 0, 7 } }, /* Y */
|
||||
fillARGB32bufferGray,
|
||||
};
|
||||
|
||||
PlaYUVerPixFmtDescriptor RGB24 =
|
||||
@@ -374,13 +368,13 @@ PlaYUVerPixFmtDescriptor RGB24 =
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
fillARGB32bufferRGB,
|
||||
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_RGB24 ),
|
||||
{
|
||||
{ 0, 2, 1, 0, 7 }, /* R */
|
||||
{ 0, 2, 2, 0, 7 }, /* G */
|
||||
{ 0, 2, 3, 0, 7 }, /* B */
|
||||
},
|
||||
fillARGB32bufferRGB,
|
||||
};
|
||||
|
||||
PlaYUVerPixFmtDescriptor BGR24 =
|
||||
@@ -391,13 +385,13 @@ PlaYUVerPixFmtDescriptor BGR24 =
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
fillARGB32bufferRGB,
|
||||
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_BGR24 ),
|
||||
{
|
||||
{ 0, 2, 3, 0, 7 }, /* R */
|
||||
{ 0, 2, 2, 0, 7 }, /* G */
|
||||
{ 0, 2, 1, 0, 7 }, /* B */
|
||||
},
|
||||
fillARGB32bufferRGB,
|
||||
};
|
||||
|
||||
PlaYUVerPixFmtDescriptor g_PlaYUVerPixFmtDescriptorsList[PLAYUVER_NUMBER_FORMATS] =
|
||||
@@ -408,6 +402,7 @@ PlaYUVerPixFmtDescriptor g_PlaYUVerPixFmtDescriptorsList[PLAYUVER_NUMBER_FORMATS
|
||||
yuyv422,
|
||||
gray,
|
||||
RGB24,
|
||||
BGR24, };
|
||||
BGR24,
|
||||
};
|
||||
|
||||
} // NAMESPACE
|
||||
@@ -143,8 +143,6 @@ typedef struct PlaYUVerPixFmtDescriptor
|
||||
*/
|
||||
UInt8 log2ChromaHeight;
|
||||
|
||||
Void (*fillARGB32buffer)( Pel*** in, UChar* out, UInt width, UInt height );
|
||||
|
||||
Int ffmpegPelFormat;
|
||||
|
||||
/**
|
||||
@@ -157,6 +155,8 @@ typedef struct PlaYUVerPixFmtDescriptor
|
||||
*/
|
||||
PlaYUVerComponentDescriptor comp[4];
|
||||
|
||||
Void (*fillARGB32buffer)( Pel*** in, UChar* out, UInt width, UInt height );
|
||||
|
||||
} PlaYUVerPixFmtDescriptor;
|
||||
|
||||
#define MAX_NUMBER_PLANES 3
|
||||
|
||||
Reference in new issue
Block a user