File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ type encoderOptions struct {
2424 allLitEntropy bool
2525 customWindow bool
2626 customALEntropy bool
27+ customBlockSize bool
2728 lowMem bool
2829 dict * dict
2930}
@@ -33,7 +34,7 @@ func (o *encoderOptions) setDefault() {
3334 concurrent : runtime .GOMAXPROCS (0 ),
3435 crc : true ,
3536 single : nil ,
36- blockSize : 1 << 16 ,
37+ blockSize : maxCompressedBlockSize ,
3738 windowSize : 8 << 20 ,
3839 level : SpeedDefault ,
3940 allLitEntropy : true ,
@@ -106,6 +107,7 @@ func WithWindowSize(n int) EOption {
106107 o .customWindow = true
107108 if o .blockSize > o .windowSize {
108109 o .blockSize = o .windowSize
110+ o .customBlockSize = true
109111 }
110112 return nil
111113 }
@@ -222,6 +224,9 @@ func WithEncoderLevel(l EncoderLevel) EOption {
222224 switch o .level {
223225 case SpeedFastest :
224226 o .windowSize = 4 << 20
227+ if ! o .customBlockSize {
228+ o .blockSize = 1 << 16
229+ }
225230 case SpeedDefault :
226231 o .windowSize = 8 << 20
227232 case SpeedBetterCompression :
You can’t perform that action at this time.
0 commit comments