修复阶段4之前的问题,修复编译报错

This commit is contained in:
sladro 2025-12-29 10:59:44 +08:00
parent 26b047f1cf
commit 21dd258577

View File

@ -302,13 +302,27 @@ private:
return;
}
size_t out_size = CalcImageSizeStrided(dst_wstride, dst_hstride, out_fmt);
if (out_size == 0 || src_fmt_rga == RK_FORMAT_UNKNOWN || dst_fmt_rga == RK_FORMAT_UNKNOWN) {
// Calculate proper strides (RGA requires aligned strides)
// 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 (src_fmt_rga == RK_FORMAT_UNKNOWN || dst_fmt_rga == RK_FORMAT_UNKNOWN) {
std::cerr << "[preprocess] unsupported format for RGA\n";
PushToDownstream(frame);
return;
}
size_t out_size = CalcImageSizeStrided(dst_wstride, dst_hstride, out_fmt);
if (out_size == 0) {
std::cerr << "[preprocess] invalid output size for RGA\n";
PushToDownstream(frame);
return;
}
// Use DMA-BUF allocation to avoid >4GB address issue with RGA
auto dma_buf = DmaAlloc(out_size);
if (!dma_buf || !dma_buf->valid()) {
@ -317,14 +331,6 @@ private:
return;
}
// Calculate proper strides (RGA requires aligned strides)
// 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<int>(frame->format) << " rga_fmt=" << src_fmt_rga