Skip also set sectors

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
Jakub Sztandera 2020-10-29 20:33:58 +01:00 committed by Jennifer Wang
parent 39cc536115
commit e615eecbea

View File

@ -382,8 +382,8 @@ func rleToPng(rleBytes []byte) ([]byte, error) {
} }
const width = 1024 const width = 1024
const skipTh = 128 const skipTh = 64
const skipSize = 64 const skipSize = 32
var size uint64 var size uint64
for ri.HasNext() { for ri.HasNext() {
@ -391,7 +391,7 @@ func rleToPng(rleBytes []byte) ([]byte, error) {
if err != nil { if err != nil {
return nil, xerrors.Errorf("getting next run: %w", err) return nil, xerrors.Errorf("getting next run: %w", err)
} }
if !run.Val && run.Len > skipTh*width { if run.Len > skipTh*width {
size += run.Len%(2*width) + skipSize*width size += run.Len%(2*width) + skipSize*width
} else { } else {
size += run.Len size += run.Len
@ -418,7 +418,7 @@ func rleToPng(rleBytes []byte) ([]byte, error) {
} }
var cut = false var cut = false
var oldLen uint64 var oldLen uint64
if !run.Val && run.Len > skipTh*width { if run.Len > skipTh*width {
oldLen = run.Len oldLen = run.Len
run.Len = run.Len%(2*width) + skipSize*width run.Len = run.Len%(2*width) + skipSize*width
cut = true cut = true