Skip to content

removed OpenCV decoder option for image#452

Open
rrawther wants to merge 9 commits intoROCm:developfrom
rrawther:rr/rocal_remove_opencv
Open

removed OpenCV decoder option for image#452
rrawther wants to merge 9 commits intoROCm:developfrom
rrawther:rr/rocal_remove_opencv

Conversation

@rrawther
Copy link
Collaborator

@rrawther rrawther commented Feb 2, 2026

Motivation

removing OpenCV dependency and decoding option

Technical Details

OpenCV decoder files are removed and its use case

Test Plan

rocAL CTest

Test Result

rocAL CTest should pass

Submission Checklist

@rrawther rrawther requested a review from kiritigowda as a code owner February 2, 2026 22:19
@kiritigowda kiritigowda self-assigned this Feb 9, 2026
@kiritigowda kiritigowda added enhancement New feature or request ci:precheckin labels Feb 9, 2026
@LakshmiKumar23
Copy link
Contributor

@adeljo-amd Please take a look at this. We are removing OpenCV backend. Please update the examples from your PR: ROCm/rocm-examples#354

@codecov
Copy link

codecov bot commented Feb 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #452      +/-   ##
===========================================
- Coverage    80.31%   79.60%   -0.71%     
===========================================
  Files          317      315       -2     
  Lines        25379    25305      -74     
===========================================
- Hits         20382    20144     -238     
- Misses        4997     5161     +164     
Files with missing lines Coverage Δ
rocAL/include/api/rocal_api_types.h 0.00% <ø> (ø)
rocAL/include/decoders/image/decoder.h 76.47% <ø> (ø)
rocAL/source/api/rocal_api_data_loaders.cpp 78.42% <ø> (-0.09%) ⬇️
rocAL/source/decoders/image/decoder_factory.cpp 50.00% <ø> (-6.00%) ⬇️

... and 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kiritigowda
Copy link
Collaborator

kiritigowda commented Feb 16, 2026

Minor changes required for merge

  1. Missing Update:
tests/cpp_api/basic_test/README.md still documents:
   * decoder type : 1 - OpenCV decoder   
   * decoder type : 2 - rocJpeg decoder
Should be updated to:
   * decoder type : 1 - rocJpeg decode
  1. Docs drift: tests/python_api/README.md still mentions “JPEG reader with OpenCV”, which is now misleading given the decoder removal.
  2. The CHANGELOG.md doesn't document this breaking change in the "Unreleased" section under "Removed". This should be added as:
* OpenCV decoder option (ROCAL_DECODER_OPENCV) for image decoding
  1. The CMakeLists.txt files still contain OpenCV detection and configuration:
    rocAL/CMakeLists.txt. Test CMakeLists files still have ENABLE_OPENCV flags
    Question: Is OpenCV still needed for other functionality (like test visualization)? If not, these should be removed too.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes the OpenCV-based image decoder option from rocAL, updating the decoder factory, public decoder enums, tests, and Python bindings accordingly.

Changes:

  • Removed the OpenCV image decoder implementation and its registration in the decoder factory.
  • Removed the OpenCV decoder option from C++ tests and Python/pybind exposed decoder enums.
  • Updated API/internal decoder type enums to drop the OpenCV entry (currently by renumbering subsequent values).

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/cpp_api/image_augmentation/image_augmentation.cpp Removes an OpenCV-decoder-specific message; still passes CLI decoder values through.
tests/cpp_api/basic_test/basic_test.cpp Updates CLI decoder selection logic to drop OpenCV choice.
rocAL_pybind/rocal_pybind.cpp Removes DECODER_OPENCV from the Python-exposed enum.
rocAL_pybind/amd/rocal/types.py Removes DECODER_OPENCV import and mapping entry.
rocAL/source/decoders/image/open_cv_decoder.cpp Deletes the OpenCV decoder implementation.
rocAL/source/decoders/image/decoder_factory.cpp Removes OpenCV decoder include and factory case.
rocAL/source/api/rocal_api_data_loaders.cpp Removes mapping from ROCAL_DECODER_OPENCV to DecoderType::OPENCV.
rocAL/include/decoders/image/open_cv_decoder.h Deletes the OpenCV decoder header.
rocAL/include/decoders/image/decoder.h Removes DecoderType::OPENCV and renumbers subsequent values.
rocAL/include/api/rocal_api_types.h Removes ROCAL_DECODER_OPENCV and renumbers subsequent public API values.
Comments suppressed due to low confidence (1)

tests/cpp_api/image_augmentation/image_augmentation.cpp:153

  • decoder_type is parsed as an int and then used as a RocalDecoderType (dec_type), but after removing the OpenCV decoder (and renumbering RocalDecoderType) some numeric values now correspond to non-image decoders (video/audio). Passing those through to rocalJpegFileSource can silently fall back to the default decoder, which makes the CLI option misleading. Consider explicitly mapping/validating the allowed image decoder values here (e.g., only TJPEG / ROCJPEG) and rejecting or warning on unsupported values.
    } else {
        // The jpeg file loader can automatically select the best size to decode all images to that size
        // User can alternatively set the size or change the policy that is used to automatically find the size
        if (decode_height <= 0 || decode_width <= 0)
            input1 = rocalJpegFileSource(handle, folderPath1, color_format, shard_count, false, shuffle, false);
        else
            input1 = rocalJpegFileSource(handle, folderPath1, color_format, shard_count, false, shuffle, false, ROCAL_USE_USER_GIVEN_SIZE_RESTRICTED, decode_width, decode_height, dec_type);
    }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rrawther rrawther requested a review from a team as a code owner March 2, 2026 22:36
@rrawther
Copy link
Collaborator Author

rrawther commented Mar 2, 2026

HI @kiritigowda : Resolved all the comments. Please review again and merge

@rrawther
Copy link
Collaborator Author

rrawther commented Mar 3, 2026

@kiritigowda : all the comments are addressed in this PR and the codecov is dropping because of another commit. Can you please merge this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:precheckin enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants