Lines Matching refs:refs

81 void VP8LInitBackwardRefs(VP8LBackwardRefs* const refs) {  in VP8LInitBackwardRefs()  argument
82 if (refs != NULL) { in VP8LInitBackwardRefs()
83 refs->refs = NULL; in VP8LInitBackwardRefs()
84 refs->size = 0; in VP8LInitBackwardRefs()
85 refs->max_size = 0; in VP8LInitBackwardRefs()
89 void VP8LClearBackwardRefs(VP8LBackwardRefs* const refs) { in VP8LClearBackwardRefs() argument
90 if (refs != NULL) { in VP8LClearBackwardRefs()
91 free(refs->refs); in VP8LClearBackwardRefs()
92 VP8LInitBackwardRefs(refs); in VP8LClearBackwardRefs()
96 int VP8LBackwardRefsAlloc(VP8LBackwardRefs* const refs, int max_size) { in VP8LBackwardRefsAlloc() argument
97 assert(refs != NULL); in VP8LBackwardRefsAlloc()
98 refs->size = 0; in VP8LBackwardRefsAlloc()
99 refs->max_size = 0; in VP8LBackwardRefsAlloc()
100 refs->refs = (PixOrCopy*)WebPSafeMalloc((uint64_t)max_size, in VP8LBackwardRefsAlloc()
101 sizeof(*refs->refs)); in VP8LBackwardRefsAlloc()
102 if (refs->refs == NULL) return 0; in VP8LBackwardRefsAlloc()
103 refs->max_size = max_size; in VP8LBackwardRefsAlloc()
230 static WEBP_INLINE void PushBackCopy(VP8LBackwardRefs* const refs, int length) { in PushBackCopy() argument
231 int size = refs->size; in PushBackCopy()
233 refs->refs[size++] = PixOrCopyCreateCopy(1, MAX_LENGTH); in PushBackCopy()
237 refs->refs[size++] = PixOrCopyCreateCopy(1, length); in PushBackCopy()
239 refs->size = size; in PushBackCopy()
244 VP8LBackwardRefs* const refs) { in BackwardReferencesRle() argument
248 refs->size = 0; in BackwardReferencesRle()
249 PushBackCopy(refs, match_len); // i=0 case in BackwardReferencesRle()
250 refs->refs[refs->size++] = PixOrCopyCreateLiteral(argb[0]); in BackwardReferencesRle()
255 PushBackCopy(refs, match_len); in BackwardReferencesRle()
257 refs->refs[refs->size++] = PixOrCopyCreateLiteral(argb[i]); in BackwardReferencesRle()
260 PushBackCopy(refs, match_len); in BackwardReferencesRle()
266 VP8LBackwardRefs* const refs) { in BackwardReferencesHashChain() argument
286 refs->size = 0; in BackwardReferencesHashChain()
322 refs->refs[refs->size] = PixOrCopyCreateCacheIdx(ix); in BackwardReferencesHashChain()
324 refs->refs[refs->size] = PixOrCopyCreateLiteral(pixel); in BackwardReferencesHashChain()
326 ++refs->size; in BackwardReferencesHashChain()
336 refs->refs[refs->size++] = PixOrCopyCreateCopy(offset, len); in BackwardReferencesHashChain()
355 refs->refs[refs->size] = PixOrCopyCreateCacheIdx(ix); in BackwardReferencesHashChain()
357 refs->refs[refs->size] = PixOrCopyCreateLiteral(pixel); in BackwardReferencesHashChain()
359 ++refs->size; in BackwardReferencesHashChain()
387 VP8LBackwardRefs* const refs);
415 VP8LBackwardRefs refs; in CostModelBuild() local
417 if (!VP8LBackwardRefsAlloc(&refs, xsize * ysize)) goto Error; in CostModelBuild()
421 argb, quality, cache_bits, &refs)) { in CostModelBuild()
426 &refs)) { in CostModelBuild()
430 VP8LHistogramCreate(&histo, &refs, cache_bits); in CostModelBuild()
444 VP8LClearBackwardRefs(&refs); in CostModelBuild()
624 VP8LBackwardRefs* const refs) { in BackwardReferencesHashChainFollowChosenPath() argument
647 refs->size = 0; in BackwardReferencesHashChainFollowChosenPath()
659 refs->refs[size] = PixOrCopyCreateCopy(offset, len); in BackwardReferencesHashChainFollowChosenPath()
676 refs->refs[size] = PixOrCopyCreateCacheIdx(idx); in BackwardReferencesHashChainFollowChosenPath()
678 refs->refs[size] = PixOrCopyCreateLiteral(argb[i]); in BackwardReferencesHashChainFollowChosenPath()
687 assert(size <= refs->max_size); in BackwardReferencesHashChainFollowChosenPath()
688 refs->size = size; in BackwardReferencesHashChainFollowChosenPath()
701 VP8LBackwardRefs* const refs) { in BackwardReferencesTraceBackwards() argument
719 refs)) { in BackwardReferencesTraceBackwards()
729 VP8LBackwardRefs* const refs) { in BackwardReferences2DLocality() argument
731 for (i = 0; i < refs->size; ++i) { in BackwardReferences2DLocality()
732 if (PixOrCopyIsCopy(&refs->refs[i])) { in BackwardReferences2DLocality()
733 const int dist = refs->refs[i].argb_or_distance; in BackwardReferences2DLocality()
735 refs->refs[i].argb_or_distance = transformed_dist; in BackwardReferences2DLocality()
752 if (refs_rle.refs == NULL || refs_lz77.refs == NULL) { in VP8LGetBackwardReferences()
820 const VP8LBackwardRefs* const refs, in ComputeCacheHistogram() argument
835 for (i = 0; i < refs->size; ++i) { in ComputeCacheHistogram()
836 const PixOrCopy* const v = &refs->refs[i]; in ComputeCacheHistogram()
871 VP8LBackwardRefs refs; in VP8LCalculateEstimateForCacheSize() local
874 if (!VP8LBackwardRefsAlloc(&refs, xsize * ysize) || in VP8LCalculateEstimateForCacheSize()
875 !BackwardReferencesHashChain(xsize, ysize, argb, 0, quality, &refs)) { in VP8LCalculateEstimateForCacheSize()
882 ComputeCacheHistogram(argb, xsize, ysize, &refs, cache_bits, &histo); in VP8LCalculateEstimateForCacheSize()
892 VP8LClearBackwardRefs(&refs); in VP8LCalculateEstimateForCacheSize()