videoio(mjpeg): disable parallel encoder

This commit is contained in:
Alexander Alekhin 2021-03-31 12:16:42 +00:00
parent bf03f5fa3a
commit b697b3162f

View File

@ -1167,6 +1167,8 @@ public:
fdct_qtab(_fdct_qtab),
cat_table(_cat_table)
{
#if 0 // disable parallel processing due to buffer overrun bug: https://github.com/opencv/opencv/issues/19634
//empirically found value. if number of pixels is less than that value there is no sense to parallelize it.
const int min_pixels_count = 96*96;
@ -1176,6 +1178,7 @@ public:
{
if(height*width > min_pixels_count)
{
const int default_stripes_count = 4;
stripes_count = default_stripes_count;
}
}
@ -1191,6 +1194,12 @@ public:
stripes_count = std::min(stripes_count, max_stripes);
#else
if (nstripes > 1)
CV_LOG_ONCE_WARNING(NULL, "VIDEOIO/MJPEG: parallel processing is disabled: https://github.com/opencv/opencv/issues/19634");
stripes_count = 1;
#endif
m_buffer_list.allocate_buffers(stripes_count, (height*width*2)/stripes_count);
}
@ -1370,11 +1379,8 @@ private:
const short (&fdct_qtab)[2][64];
const uchar* cat_table;
int stripes_count;
static const int default_stripes_count;
};
const int MjpegEncoder::default_stripes_count = 4;
void MotionJpegWriter::writeFrameData( const uchar* data, int step, int colorspace, int input_channels )
{
//double total_cvt = 0, total_dct = 0;