소스 검색

Added definable thread count. Fixed alignment.

Brucey 3 년 전
부모
커밋
638d404db3
1개의 변경된 파일8개의 추가작업 그리고 5개의 파일을 삭제
  1. 8 5
      jxl.mod/jxl.bmx

+ 8 - 5
jxl.mod/jxl.bmx

@@ -47,6 +47,12 @@ ModuleInfo "CC_OPTS: -DJPEGXL_PATCH_VERSION=0"
 
 Import "common.bmx"
 
+Rem
+bbdoc: Number of threads to use during Jxl decoding.
+about: The default is to use only the current thread.
+End Rem
+Global JxlDecoderThreadCount:Int = 0
+
 Private
 
 Type TPixmapLoaderJXL Extends TPixmapLoader
@@ -94,6 +100,7 @@ Type TJxlDecoder
 		End If
 
 		runnerPtr = JxlResizableParallelRunnerCreate(Null)
+		JxlResizableParallelRunnerSetThreads(runnerPtr, Size_T(Max(0, JxlDecoderThreadCount)))
 
 		If bmx_jxl_JxlDecoderSetParallelRunner(decoderPtr, runnerPtr) <> JXL_DEC_SUCCESS Then
 			Return Null
@@ -129,7 +136,7 @@ Type TJxlDecoder
 
 				If info.alpha_bits = 0 Then
 					format.num_channels = 3
-					format.align = 3
+					format.align = 4
 					pixFormat = PF_RGB888
 				End If
 
@@ -142,10 +149,6 @@ Type TJxlDecoder
 					Return Null
 				End If
 
-				If bufferSize <> width * height * format.align Then
-					Return Null
-				End If
-
 				If JxlDecoderSetImageOutBuffer(decoderPtr, format, pix.pixels, Size_T(pix.capacity)) <> JXL_DEC_SUCCESS Then
 					Return Null
 				End If