mirror of
				https://github.com/webmproject/libwebp.git
				synced 2025-10-31 02:15:42 +01:00 
			
		
		
		
	Merge "Revert "Do not use a palette for one color images.""
This commit is contained in:
		| @@ -550,25 +550,6 @@ static int BackwardReferencesLz77(int xsize, int ysize, | ||||
|   return ok; | ||||
| } | ||||
|  | ||||
| static int BackwardReferencesNone(int xsize, int ysize, | ||||
|                                   const uint32_t* const argb, int cache_bits, | ||||
|                                   VP8LBackwardRefs* const refs) { | ||||
|   const int pix_count = xsize * ysize; | ||||
|   int i; | ||||
|   const int use_color_cache = (cache_bits > 0); | ||||
|   VP8LColorCache hashers; | ||||
|  | ||||
|   if (use_color_cache && !VP8LColorCacheInit(&hashers, cache_bits)) { | ||||
|     return 0; | ||||
|   } | ||||
|   VP8LClearBackwardRefs(refs); | ||||
|   for (i = 0; i < pix_count; ++i) { | ||||
|     AddSingleLiteral(argb[i], use_color_cache, &hashers, refs); | ||||
|   } | ||||
|   if (use_color_cache) VP8LColorCacheClear(&hashers); | ||||
|   return !refs->error_; | ||||
| } | ||||
|  | ||||
| // Compute an LZ77 by forcing matches to happen within a given distance cost. | ||||
| // We therefore limit the algorithm to the lowest 32 values in the PlaneCode | ||||
| // definition. | ||||
| @@ -938,9 +919,6 @@ static int GetBackwardReferences(int width, int height, | ||||
|         res = BackwardReferencesLz77Box(width, height, argb, 0, hash_chain, | ||||
|                                         &hash_chain_box, refs_tmp); | ||||
|         break; | ||||
|       case kLZ77None: | ||||
|         res = BackwardReferencesNone(width, height, argb, 0, refs_tmp); | ||||
|         break; | ||||
|       default: | ||||
|         assert(0); | ||||
|     } | ||||
|   | ||||
| @@ -213,10 +213,7 @@ static WEBP_INLINE void VP8LRefsCursorNext(VP8LRefsCursor* const c) { | ||||
| enum VP8LLZ77Type { | ||||
|   kLZ77Standard = 1, | ||||
|   kLZ77RLE = 2, | ||||
|   kLZ77Box = 4, | ||||
|   // With kLZ77None, LZ77 is not even tried. For now, this is only useful for | ||||
|   // 1-color images but we could use it if we are sure the image is a photo. | ||||
|   kLZ77None = 8 | ||||
|   kLZ77Box = 4 | ||||
| }; | ||||
|  | ||||
| // Evaluates best possible backward references for specified quality. | ||||
|   | ||||
| @@ -591,19 +591,6 @@ static int EncoderAnalyze(VP8LEncoder* const enc, | ||||
|           sizeof(*enc->palette_sorted_), PaletteCompareColorsForQsort); | ||||
|   } | ||||
|  | ||||
|   if (use_palette && enc->palette_size_ == 1) { | ||||
|     crunch_configs[0].entropy_idx_ = kDirect; | ||||
|     crunch_configs[0].sub_configs_size_ = 1; | ||||
|     crunch_configs[0].sub_configs_[0].lz77_ = kLZ77None; | ||||
|     crunch_configs[0].sub_configs_[0].do_no_cache_ = 1; | ||||
|     *crunch_configs_size = 1; | ||||
|     // Get the entropy image as small as possible. | ||||
|     enc->histo_bits_ = MAX_HUFFMAN_BITS; | ||||
|     // The transform image is unused as we are direct. | ||||
|     enc->transform_bits_ = MAX_TRANSFORM_BITS; | ||||
|     return 1; | ||||
|   } | ||||
|  | ||||
|   // Empirical bit sizes. | ||||
|   enc->histo_bits_ = GetHistoBits(method, use_palette, | ||||
|                                   pic->width, pic->height); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user