Fixed bug with the last 4 bytes in MJPEG encoder#24209
Conversation
|
|
||
| m_data_len = m_buffer_list[0].get_len(); | ||
| m_last_bit_len = m_buffer_list[0].get_bits_free() ? 32 - m_buffer_list[0].get_bits_free() : 0; | ||
| m_last_bit_len = 32 - m_buffer_list[0].get_bits_free(); |
There was a problem hiding this comment.
see
There was a problem hiding this comment.
if you call mjpeg_buffer::finish() than mjpeg_buffer::get_len() returns the number of occupied integers and mjpeg_buffer::get_bits_free() returns the number of free bits in the last integer (from 0 to 31)
|
|
||
| m_data_len = m_buffer_list[0].get_len(); | ||
| m_last_bit_len = m_buffer_list[0].get_bits_free() ? 32 - m_buffer_list[0].get_bits_free() : 0; | ||
| m_last_bit_len = 32 - m_buffer_list[0].get_bits_free(); |
There was a problem hiding this comment.
if you call mjpeg_buffer::finish() than mjpeg_buffer::get_len() returns the number of occupied integers and mjpeg_buffer::get_bits_free() returns the number of free bits in the last integer (from 0 to 31)
| m_output_buffer[m_data_len++] = currval; | ||
|
|
||
| m_last_bit_len = -bits; | ||
| if (bits != 0) { |
There was a problem hiding this comment.
If bits != 0 than currval contains some useful bits. We need to increase m_data_len and add the bits to the last item of m_output_buffer.
If bits == 0 than currval doesn't contain useful bits
b3c8963 to
f280e3c
Compare
asmorkalov
left a comment
There was a problem hiding this comment.
👍 Thanks a lot for the patch! I removed the guard by myself.
resolves #19634
resolves #24171
Enabled parallel processing, that was temporary disabled in #19812 because of the issue #19634