Skip to content

Commit 89bce24

Browse files
using std::vector instead c array
1 parent cfbafef commit 89bce24

File tree

1 file changed

+12
-22
lines changed

1 file changed

+12
-22
lines changed

src/AvTranscoder/ColorTransform.cpp

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -53,36 +53,26 @@ void ColorTransform::convert( const Image& src, Image& dst )
5353
{
5454

5555
SwsContext* m_imageConvertContext = sws_getContext(
56-
m_width, m_height, m_inputPixel(),
57-
m_width, m_height, m_outputPixel(),
56+
m_width, m_height, m_inputPixel.get(),
57+
m_width, m_height, m_outputPixel.get(),
5858
SWS_POINT, NULL, NULL, NULL);
5959

6060
// resize dst buffer ? using :
6161
// av_image_get_buffer_size(enum AVPixelFormat pix_fmt, int width, int height, int align);
6262

63-
unsigned char* dataIn [ AV_NUM_DATA_POINTERS ];
64-
unsigned char* dataOut [ AV_NUM_DATA_POINTERS ];
65-
int linesizeIn [ AV_NUM_DATA_POINTERS ];
66-
int linesizeOut[ AV_NUM_DATA_POINTERS ];
63+
std::vector< std::vector< unsigned char > > dataIn ( AV_NUM_DATA_POINTERS );
64+
std::vector< std::vector< unsigned char > > dataOut( AV_NUM_DATA_POINTERS );
65+
std::vector< int > lineSizeIn ( AV_NUM_DATA_POINTERS, 0 );
66+
std::vector< int > lineSizeOut( AV_NUM_DATA_POINTERS, 0 );
6767

68-
// std::vector< int > lineSizeOut( AV_NUM_DATA_POINTERS, 0 );
69-
70-
for( size_t i = 0; i < AV_NUM_DATA_POINTERS; ++i )
71-
{
72-
dataIn [i] = NULL;
73-
dataOut[i] = NULL;
74-
linesizeIn [i] = 0;
75-
linesizeOut[i] = 0;
76-
}
77-
78-
//dataIn [0] = const_cast< unsigned char* >( &src[0] );
68+
//dataIn[0] = &src.getPtr();
7969
//dataOut[0] = &dst[0];
80-
linesizeIn [0] = av_image_get_linesize( m_inputPixel(), m_width, 3 );
81-
linesizeOut[0] = av_image_get_linesize( m_outputPixel(), m_width, 3 );
70+
lineSizeIn [0] = av_image_get_linesize( m_inputPixel.get(), src.getWidth(), 3 );
71+
lineSizeOut[0] = av_image_get_linesize( m_outputPixel.get(), src.getWidth(), 3 );
8272

83-
sws_scale( m_imageConvertContext,
84-
dataIn, linesizeIn, 0, m_height,
85-
dataOut, linesizeOut );
73+
// sws_scale( m_imageConvertContext,
74+
// dataIn, lineSizeIn, 0, src.getHeight(),
75+
// dataOut, lineSizeOut );
8676
}
8777

8878
}

0 commit comments

Comments
 (0)