Skip to content

Add YUV to RGB color conversion with cubic and linear vertical chroma upsampling.#715

Open
jeffqjiangNew wants to merge 11 commits into
ROCm:developfrom
jeffqjiangNew:jj/yuv_rgb_conversion_new_func
Open

Add YUV to RGB color conversion with cubic and linear vertical chroma upsampling.#715
jeffqjiangNew wants to merge 11 commits into
ROCm:developfrom
jeffqjiangNew:jj/yuv_rgb_conversion_new_func

Conversation

@jeffqjiangNew
Copy link
Copy Markdown
Contributor

@jeffqjiangNew jeffqjiangNew commented Apr 30, 2026

Motivation

This PR adds YUV to RGB color conversion with cubic and linear vertical chroma upsampling.

Technical Details

Two new 8-bit NV12 to RGB packed color space conversion (CSC) functions are added:

  • One CSC function with FFmpeg-compatible cubic vertical chroma upsampling
  • One CSC function with FFmpeg-compatible linear vertical chroma upsampling

Test Plan

Run the proposed TorchCodec test with AMD ROCm HW decoder enabled.

H.265 10-bit test should pass.

Test Result

Submission Checklist

Copy link
Copy Markdown
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

Adds new NV12 (8-bit) YUV→RGB packed conversion entry points that perform FFmpeg-compatible vertical chroma upsampling (bicubic and bilinear) on the HIP backend, extending the existing rppt_yuv_to_rgb path.

Changes:

  • Added public RPPT APIs: rppt_yuv_to_rgb_bicubic_v and rppt_yuv_to_rgb_bilinear_v (HIP-only, U8 NV12 → RGB24).
  • Implemented HIP kernels for bicubic/bilinear vertical chroma upsampling and corresponding HIP executors.
  • Wired new APIs through the tensor data-exchange operations dispatcher and added executor declarations.

Reviewed changes

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

File Description
src/modules/tensor/rppt_tensor_data_exchange_operations.cpp Adds new RPPT entry points that route to HIP executors for bicubic/bilinear vertical chroma upsampling.
src/modules/tensor/hip/kernel/color_space_conversion.cpp Implements the two new HIP kernels and executor launch functions.
src/include/tensor/hip_tensor_executors.hpp Declares the new HIP executor templates.
api/rppt_tensor_data_exchange_operations.h Exposes and documents the new public APIs.

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

Comment thread api/rppt_tensor_data_exchange_operations.h Outdated
Comment thread api/rppt_tensor_data_exchange_operations.h
Comment thread api/rppt_tensor_data_exchange_operations.h
Comment thread src/modules/tensor/hip/kernel/color_space_conversion.cpp Outdated
Comment thread src/modules/tensor/hip/kernel/color_space_conversion.cpp Outdated
Comment thread src/modules/tensor/rppt_tensor_data_exchange_operations.cpp Outdated
Comment thread src/modules/tensor/hip/kernel/color_space_conversion.cpp Outdated
Comment thread src/modules/tensor/hip/kernel/color_space_conversion.cpp Outdated
Comment thread src/modules/tensor/hip/kernel/color_space_conversion.cpp
Copy link
Copy Markdown
Contributor

@rrawther rrawther left a comment

Choose a reason for hiding this comment

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

Please add review comments

@jeffqjiangNew jeffqjiangNew changed the title Add YUV to RGB color conversion with bicubic and bilinear vertical chroma upsampling. Add YUV to RGB color conversion with cubic and linear vertical chroma upsampling. May 1, 2026
@kiritigowda kiritigowda self-assigned this May 4, 2026
Comment thread src/modules/tensor/hip/kernel/color_space_conversion.cpp Outdated
Copy link
Copy Markdown
Contributor

@rrawther rrawther left a comment

Choose a reason for hiding this comment

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

Added a minor comment for further improvement

@jeffqjiangNew jeffqjiangNew requested a review from rrawther May 5, 2026 15:37
Copy link
Copy Markdown
Contributor

@LakshmiKumar23 LakshmiKumar23 left a comment

Choose a reason for hiding this comment

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

@jeffqjiangNew we need to add some local test cases later for this. Let's discuss

@LakshmiKumar23
Copy link
Copy Markdown
Contributor

@codecov
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

❌ Patch coverage is 89.24731% with 10 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...es/tensor/rppt_tensor_data_exchange_operations.cpp 81.82% 10 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #715      +/-   ##
===========================================
- Coverage    93.11%   93.08%   -0.02%     
===========================================
  Files          201      201              
  Lines        97531    97623      +92     
===========================================
+ Hits         90809    90872      +63     
- Misses        6722     6751      +29     
Files with missing lines Coverage Δ
...dules/tensor/hip/kernel/color_space_conversion.cpp 82.08% <100.00%> (+10.02%) ⬆️
...es/tensor/rppt_tensor_data_exchange_operations.cpp 92.14% <81.82%> (-1.83%) ⬇️

... and 3 files with indirect coverage changes

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

@rrawther
Copy link
Copy Markdown
Contributor

rrawther commented May 7, 2026

Can we add a test case for the new functionality. Codecov showing >1% diff

@jeffqjiangNew
Copy link
Copy Markdown
Contributor Author

Agreed we need to add new test for the new functions. Working on that.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants