Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork56.4k
Fixed bug with the last 4 bytes in MJPEG encoder#24209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
see
| voidfinish() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
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
Uh oh!
There was an error while loading.Please reload this page.
asmorkalov left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
👍 Thanks a lot for the patch! I removed the guard by myself.
Uh oh!
There was an error while loading.Please reload this page.
resolves#19634
resolves#24171
Enabled parallel processing, that was temporary disabled in#19812 because of the issue#19634