From c747942855d75f3757c5dd243145f793d55ac045 Mon Sep 17 00:00:00 2001 From: sladro Date: Fri, 26 Dec 2025 16:14:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8=20DMA-BUF=20=E5=88=86?= =?UTF-8?q?=E9=85=8D=E5=86=85=E5=AD=98=EF=BC=8C=E4=BF=AE=E5=A4=8D=E5=8A=9F?= =?UTF-8?q?=E8=83=BDbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/preprocess/preprocess_node.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/plugins/preprocess/preprocess_node.cpp b/plugins/preprocess/preprocess_node.cpp index 25c6039..87c8c11 100644 --- a/plugins/preprocess/preprocess_node.cpp +++ b/plugins/preprocess/preprocess_node.cpp @@ -204,12 +204,23 @@ private: } // Calculate proper strides (RGA requires aligned strides) - int src_wstride = frame->planes[0].stride > 0 ? frame->planes[0].stride - : (frame->stride > 0 ? frame->stride : Align16(frame->width)); + // For YUV formats, wstride is the width of Y plane + // For RGB/BGR formats, wstride is width (not width*3) + int src_wstride = Align16(frame->width); int src_hstride = Align16(frame->height); int dst_wstride = Align16(out_w); int dst_hstride = Align16(out_h); + if (processed_ < 3) { + std::cout << "[preprocess] src: " << frame->width << "x" << frame->height + << " fmt=" << static_cast(frame->format) << " rga_fmt=" << src_fmt_rga + << " wstride=" << src_wstride << " hstride=" << src_hstride + << " data_size=" << frame->data_size << "\n"; + std::cout << "[preprocess] dst: " << out_w << "x" << out_h + << " fmt=" << static_cast(out_fmt) << " rga_fmt=" << dst_fmt_rga + << " wstride=" << dst_wstride << " hstride=" << dst_hstride << "\n"; + } + rga_buffer_t src_buf{}; rga_buffer_t dst_buf{}; DmaBufferPtr src_dma_buf; // Keep alive if we allocate