Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
asmorkalov merged 1 commit intoopencv:4.xfromalexlyulkov:al/fixed-mjpeg
Sep 5, 2023

Conversation

@alexlyulkov
Copy link
Contributor

@alexlyulkovalexlyulkov commentedAug 31, 2023
edited by asmorkalov
Loading

resolves#19634
resolves#24171
Enabled parallel processing, that was temporary disabled in#19812 because of the issue#19634


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();
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Copy link
ContributorAuthor

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();
Copy link
ContributorAuthor

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) {
Copy link
ContributorAuthor

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

Copy link
Contributor

@asmorkalovasmorkalov left a 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.

@asmorkalovasmorkalov merged commit21fb10c intoopencv:4.xSep 5, 2023
@asmorkalovasmorkalov mentioned this pull requestSep 11, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@asmorkalovasmorkalovasmorkalov approved these changes

Assignees

@asmorkalovasmorkalov

Projects

None yet

Milestone

4.9.0

Development

Successfully merging this pull request may close these issues.

cv::VideoWriter with CAP_OPENCV_MJPEG api creates broken (or just unfinished) video file. Out of bound access in cap_mjpeg_encoder.cpp

2 participants

@alexlyulkov@asmorkalov

[8]ページ先頭

©2009-2025 Movatter.jp