From 9b8c58a4c47bc229071d1971575136aee9fd46d7 Mon Sep 17 00:00:00 2001 From: colinhl Date: Wed, 8 Jan 2025 22:03:43 +0800 Subject: [PATCH 1/2] support dma Signed-off-by: colinhl --- Source/astcenc_image.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/astcenc_image.cpp b/Source/astcenc_image.cpp index 8622a92..96082d2 100644 --- a/Source/astcenc_image.cpp +++ b/Source/astcenc_image.cpp @@ -341,7 +341,7 @@ void store_image_block( unsigned int zpos, const astcenc_swizzle& swz ) { - unsigned int x_size = img.dim_x; + unsigned int x_size = img.dim_stride; unsigned int x_start = xpos; unsigned int x_end = astc::min(x_size, xpos + bsd.xdim); unsigned int x_count = x_end - x_start; -- Gitee From 27914c1f574718795626bcf6b1fd47afa611ea8d Mon Sep 17 00:00:00 2001 From: colinhl Date: Thu, 9 Jan 2025 11:36:54 +0800 Subject: [PATCH 2/2] fix Signed-off-by: colinhl --- Source/astcenc_image.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Source/astcenc_image.cpp b/Source/astcenc_image.cpp index 96082d2..9401a4d 100644 --- a/Source/astcenc_image.cpp +++ b/Source/astcenc_image.cpp @@ -341,7 +341,8 @@ void store_image_block( unsigned int zpos, const astcenc_swizzle& swz ) { - unsigned int x_size = img.dim_stride; + unsigned int x_size = img.dim_x; + unsigned int stride = img.dim_stride; unsigned int x_start = xpos; unsigned int x_end = astc::min(x_size, xpos + bsd.xdim); unsigned int x_count = x_end - x_start; @@ -375,7 +376,7 @@ void store_image_block( for (unsigned int y = y_start; y < y_end; y++) { - uint8_t* data8_row = data8 + (4 * x_size * y) + (4 * x_start); + uint8_t* data8_row = data8 + (4 * stride * y) + (4 * x_start); for (unsigned int x = 0; x < x_count; x += ASTCENC_SIMD_WIDTH) { @@ -452,7 +453,7 @@ void store_image_block( for (unsigned int y = y_start; y < y_end; y++) { - uint16_t* data16_row = data16 + (4 * x_size * y) + (4 * x_start); + uint16_t* data16_row = data16 + (4 * stride * y) + (4 * x_start); for (unsigned int x = 0; x < x_count; x++) { @@ -514,7 +515,7 @@ void store_image_block( for (unsigned int y = y_start; y < y_end; y++) { - float* data32_row = data32 + (4 * x_size * y) + (4 * x_start); + float* data32_row = data32 + (4 * stride * y) + (4 * x_start); for (unsigned int x = 0; x < x_count; x++) { -- Gitee