Hello,
I'm developing a Qt application for the i.MX8MP targeting a 12MP image capture device and encountering image artifacts in the captured PNG images.
Hardware/Software Environment:
GStreamer Pipeline:
descr = g_strdup_printf("v4l2src name=video_source " "device=/dev/video-isp-csi1 " "io-mode=dmabuf ! " "video/x-raw, width=4048,height=3040 ! tee name=t " "t. ! queue max-size-buffers=1 leaky=downstream ! imxvideoconvert_g2d " "name=g2d rotation=3 ! video/x-raw, width=480, height=800 ! appsink " "name=app_sink_live max-buffers=1 drop=True " "t. ! queue ! appsink name=app_sink_snapshot max-buffers=1 drop=True");
Issue: The captured PNG images frequently contain visual artifacts (see attached image). The artifacts appear as corrupted regions or visual distortions in the final image.
Observations:
Questions:
Any guidance would be greatly appreciated!
Image:
Hi,
Thank you for taking your time. I could finally solve the problem.
FYI: I am stick to DMA in this case because its 12MP and image buffers are to big for user space manipulations.
No image artifacts are seen anymore After adding clean stop (GST_STATE_NULL) in bool GstVideoPipeline::stop() and after we wait for state change to complete to ensure ISP device is closed:
ret = gst_element_get_state(m_pimpl->pipeline, &state, &pending, GST_CLOCK_TIME_NONE);
now the Gstreamer pipeline stop is as follows:
bool GstVideoPipeline::stop() {
if (!VideoPipeline::stop()) {
return false;
}
GstStateChangeReturn ret = gst_element_set_state(m_pimpl->pipeline, GST_STATE_NULL);
if (ret == GST_STATE_CHANGE_FAILURE) {
qCritical() << "Failed to change pipeline state to NULL";
return false;
}
// Wait for state change to complete to ensure ISP device is closed
// this is key to image artifact issue
GstState state, pending;
ret = gst_element_get_state(m_pimpl->pipeline, &state, &pending, GST_CLOCK_TIME_NONE);
if (ret == GST_STATE_CHANGE_FAILURE) {
qCritical() << "Failed to wait for NULL state";
return false;
}
// Release references to child elements so they can be properly freed
if (m_pimpl->g2d != nullptr) {
gst_object_unref(m_pimpl->g2d);
m_pimpl->g2d = nullptr;
}
if (m_pimpl->appSinkLive != nullptr) {
gst_object_unref(m_pimpl->appSinkLive);
m_pimpl->appSinkLive = nullptr;
}
if (m_pimpl->appSinkSnapshot != nullptr) {
gst_object_unref(m_pimpl->appSinkSnapshot);
m_pimpl->appSinkSnapshot = nullptr;
}
qDebug() << "Pipeline stopped and all resources freed";
return true;
}Hello.
What sensor model is being used? are you using a custom ISP tuning file (XML)?. There are know issues with debayering and ISP configuration if sensor-specific tuning or profile is not properly adapted (image quality may degrade over time)
>Could this be a buffer synchronization issue between the ISP and the downstream elements?>Are there recommended buffer settings or pipeline configurations for high-resolution capture on i.MX8MP?
In your pipeline, max-size-buffers=1 limits the queue to hold only one buffer, If the downstream element is slow (encoding or saving) the buffer may be dropped Can you try increasing buffer sizes + leaky=no to prevent buffer drops: max-size-buffers=4 leaky=no
Could you also try to use use filesink instead of appsink to debug image output independently of Qt
>Could the dmabuf io-mode be causing memory coherency issues?
Can you test your pipeline using io-mode=mmap and io-mode=auto to discart dmabuf issues
>Are there any known issues with the ISP driver at this resolution?
8MP ISP supports up to 4096x3072, where width must be divisible by 16 and height by 8 due to macroblock alignment for dewarp and ISP processing. Your resolution of 4048x3046 is valid
Regards