Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\lz4\lz4hc_compress.c Create Date:2022-07-28 07:01:00
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:LZ4HC_compress_generic

Proto:static int LZ4HC_compress_generic(LZ4HC_CCtx_internal *const ctx, const char *const source, char *const dest, int const inputSize, int const maxOutputSize, int compressionLevel, limitedOutput_directive limit)

Type:int

Parameter:

TypeParameterName
LZ4HC_CCtx_internal *constctx
const char *constsource
char *constdest
int constinputSize
int constmaxOutputSize
intcompressionLevel
limitedOutput_directivelimit
348  ip = source
349  anchor = ip
350  iend = ip + inputSize
351  mflimit = iend - MFLIMIT
352  matchlimit = iend - LASTLITERALS
354  op = dest
355  oend = op + maxOutputSize
359  const BYTE * ref = NULL
360  const BYTE * start2 = NULL
361  const BYTE * ref2 = NULL
362  const BYTE * start3 = NULL
363  const BYTE * ref3 = NULL
368  If compressionLevel > LZ4HC_MAX_CLEVEL Then compressionLevel = LZ4HC_MAX_CLEVEL
370  If compressionLevel < 1 Then compressionLevel = LZ4HC_DEFAULT_CLEVEL
372  maxNbAttempts = 1 << compressionLevel - 1
373  xt block to continue on current prefix += inputSize
375  ip++
378  When ip < mflimit cycle
379  ml = LZ4HC_InsertAndFindBestMatch(ctx, ip, matchlimit, ( & ref), maxNbAttempts)
381  If Not ml Then
382  ip++
383  Continue
387  start0 = ip
388  ref0 = ref
389  ml0 = ml
391  _Search2 :
392  If ip + ml < mflimit Then ml2 = LZ4HC_InsertAndGetWiderMatch(ctx, ip + ml - 2, ip + 0, matchlimit, ml, & ref2, & start2, maxNbAttempts)
397  Else ml2 = ml
400  If ml2 == ml Then
402  If LZ4HC_encodeSequence( & ip, & op, & anchor, ml, ref, limit, oend) Then Return 0
405  Continue
408  If start0 < ip Then
409  If start2 < ip + ml0 Then
411  ip = start0
412  ref = ref0
413  ml = ml0
418  If start2 - ip < 3 Then
420  ml = ml2
421  ip = start2
422  ref = ref2
423  Go to _Search2
426  _Search3 :
432  If start2 - ip < Local Constants and types Then
434  new_ml = ml
441  correction = new_ml - start2 - ip
443  If correction > 0 Then
444  start2 += correction
445  ref2 += correction
446  ml2 -= correction
454  If start2 + ml2 < mflimit Then ml3 = LZ4HC_InsertAndGetWiderMatch(ctx, start2 + ml2 - 3, start2, matchlimit, ml2, & ref3, & start3, maxNbAttempts)
459  Else ml3 = ml2
462  If ml3 == ml2 Then
465  If start2 < ip + ml Then ml = start2 - ip
468  If LZ4HC_encodeSequence( & ip, & op, & anchor, ml, ref, limit, oend) Then Return 0
471  ip = start2
472  If LZ4HC_encodeSequence( & ip, & op, & anchor, ml2, ref2, limit, oend) Then Return 0
475  Continue
478  If start3 < ip + ml + 3 Then
480  If start3 >= ip + ml Then
485  If start2 < ip + ml Then
486  correction = ip + ml - start2
488  start2 += correction
489  ref2 += correction
490  ml2 -= correction
492  start2 = start3
493  ref2 = ref3
494  ml2 = ml3
498  If LZ4HC_encodeSequence( & ip, & op, & anchor, ml, ref, limit, oend) Then Return 0
501  ip = start3
502  ref = ref3
503  ml = ml3
505  start0 = start2
506  ref0 = ref2
507  ml0 = ml2
508  Go to _Search2
511  start2 = start3
512  ref2 = ref3
513  ml2 = ml3
514  Go to _Search3
522  If start2 < ip + ml Then
523  If start2 - ip < ML_MASK Then
536  Else ml = start2 - ip
539  If LZ4HC_encodeSequence( & ip, & op, & anchor, ml, ref, limit, oend) Then Return 0
543  ip = start2
544  ref = ref2
545  ml = ml2
547  start2 = start3
548  ref2 = ref3
549  ml2 = ml3
551  Go to _Search3
556  lastRun = iend - anchor
558  If limit && op - dest + lastRun + 1 + ( lastRun + 255 - RUN_MASK) / 255 > maxOutputSize Then
563  Return 0
565  If lastRun >= RUN_MASK Then
566  op++ = RUN_MASK << ML_BITS
567  lastRun -= RUN_MASK
568  When lastRun > 254 cycle op++ = 255
570  op++ = lastRun
571  Else op++ = lastRun << ML_BITS
573  No 3D Now!(op, anchor, iend - anchor)
574  op += iend - anchor
578  Return op - dest
Caller
NameDescribe
LZ4_compress_HC_extStateHC
LZ4_compressHC_continue_generic