-
Notifications
You must be signed in to change notification settings - Fork 152
Open
Labels
Description
I'm getting strange results trying to get ROI maps to work (on H264/AVC).
Even something really simple doesn't seem to work at all:
uint32_t width = 1920;
uint32_t height = 1080;
uint32_t mbSize = 16;
uint32_t mbWidth = (width + mbSize - 1) / mbSize;
uint32_t mbHeight = (height + mbSize - 1) / mbSize;
AMFSurfacePtr roiSurface;
amfContext1->AllocSurfaceEx(AMF_MEMORY_HOST, AMF_SURFACE_GRAY32, mbWidth, mbHeight,
AMF_SURFACE_USAGE_DEFAULT | AMF_SURFACE_USAGE_LINEAR,
AMF_MEMORY_CPU_DEFAULT, &roiSurface);
AMFPlane &plane = *roiSurface->GetPlaneAt(0);
amf_uint32 *roi = (amf_uint32 *)plane.GetNative();
amf_int32 pitch = plane.GetHPitch();
memset((void *)roi, 0, pitch * mbHeight);
for (int y = 0; y < mbHeight; y++) {
for (int x = 0; x < mbWidth / 2; x++) {
roi[y * (pitch / 4) + x] = 10;
}
}
surface->SetProperty(AMF_VIDEO_ENCODER_ROI_DATA, roiSurface);
If I'm understanding the ROI sample, this should be boosting the quality of the left half of the stream. Instead, it's somehow boosting the top half of the stream. What would cause it to rotate the map like this?
Things get weirder if I try to divide by 4 instead (which should be boosting the left quarter of the stream). It ends up affecting the top half once again, but this time in horizontal stripes all the way across the display.
Everything else other than ROI works just fine.
I did notice that ROI doesn't seem to have any effect when Pre-Analysis is enabled... is this to be expected?
- OS: Ubuntu Linux 25.04
- Driver Version: 6.4.1 (from repo.radeon.com)
- GPU: RX 6700 XT
- Which component has the issue: Encoder