Skip to content

Imgcodecs minor improvements for better code readibility#26828

Merged
asmorkalov merged 1 commit intoopencv:4.xfrom
sturkmen72:imgcodecs_improvements
Jan 25, 2025
Merged

Imgcodecs minor improvements for better code readibility#26828
asmorkalov merged 1 commit intoopencv:4.xfrom
sturkmen72:imgcodecs_improvements

Conversation

@sturkmen72
Copy link
Copy Markdown
Contributor

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

The PR addresses the following improvements:

1.Improving member functions:

  • Renaming read_from_io and write_to_io to more descriptive names for better clarity.
  • Enhancing documentation for these functions to make their purpose, inputs, outputs, and edge-case handling explicit.

2.RFC Refactoring functions into the base class with the following considerations (subject to undone):

  • This change allows decoders currently with m_buf_supported = false to potentially use these functions in the future to support buffer reading.
  • Introducing the m_f variable in the base class, which potentially enables efficient handling of file streams by reducing redundant file-opening operations. For example, the source file can be assigned to m_f once when the decoder is selected, avoiding the need to reopen the file in readHeader().

@asmorkalov
Copy link
Copy Markdown
Contributor

@sturkmen72 Thanks for the PR! I do not think that io migration to the base class is good idea by several reasons:

@sturkmen72 sturkmen72 force-pushed the imgcodecs_improvements branch from 14d6676 to b8b4896 Compare January 24, 2025 07:20
@sturkmen72 sturkmen72 marked this pull request as draft January 24, 2025 07:42
@sturkmen72
Copy link
Copy Markdown
Contributor Author

let me update the PR after #26832 merged

@sturkmen72 sturkmen72 force-pushed the imgcodecs_improvements branch from b8b4896 to ca51d55 Compare January 24, 2025 12:33
@sturkmen72 sturkmen72 changed the title Imgcodecs improvements Imgcodecs minor improvements for better code readibility Jan 24, 2025
@sturkmen72 sturkmen72 marked this pull request as ready for review January 24, 2025 12:34
@asmorkalov asmorkalov added category: imgcodecs cleanup Code cleanup (e.g, drop legacy C-API, legacy unmaintained code) labels Jan 25, 2025
@asmorkalov asmorkalov self-assigned this Jan 25, 2025
@asmorkalov asmorkalov added this to the 4.12.0 milestone Jan 25, 2025
@asmorkalov asmorkalov merged commit c637dd2 into opencv:4.x Jan 25, 2025
@sturkmen72 sturkmen72 deleted the imgcodecs_improvements branch January 25, 2025 18:48
@asmorkalov asmorkalov mentioned this pull request Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: imgcodecs cleanup Code cleanup (e.g, drop legacy C-API, legacy unmaintained code)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants