mirror of
				https://github.com/webmproject/libwebp.git
				synced 2025-10-31 02:15:42 +01:00 
			
		
		
		
	re-introduce some comments in Huffman Cost.
Change-Id: I2396bbc58628dd12a2d36068f7193e2a6eb4d166
This commit is contained in:
		| @@ -214,10 +214,19 @@ static double InitialHuffmanCost(void) { | |||||||
|  |  | ||||||
| // Finalize the Huffman cost based on streak numbers and length type (<3 or >=3) | // Finalize the Huffman cost based on streak numbers and length type (<3 or >=3) | ||||||
| static double FinalHuffmanCost(const VP8LStreaks* const stats) { | static double FinalHuffmanCost(const VP8LStreaks* const stats) { | ||||||
|  |   // The constants in this function are experimental and got rounded from | ||||||
|  |   // their original values in 1/8 when switched to 1/1024. | ||||||
|   double retval = InitialHuffmanCost(); |   double retval = InitialHuffmanCost(); | ||||||
|  |   // Second coefficient: Many zeros in the histogram are covered efficiently | ||||||
|  |   // by a run-length encode. Originally 2/8. | ||||||
|   retval += stats->counts[0] * 1.5625 + 0.234375 * stats->streaks[0][1]; |   retval += stats->counts[0] * 1.5625 + 0.234375 * stats->streaks[0][1]; | ||||||
|  |   // Second coefficient: Constant values are encoded less efficiently, but still | ||||||
|  |   // RLE'ed. Originally 6/8. | ||||||
|   retval += stats->counts[1] * 2.578125 + 0.703125 * stats->streaks[1][1]; |   retval += stats->counts[1] * 2.578125 + 0.703125 * stats->streaks[1][1]; | ||||||
|  |   // 0s are usually encoded more efficiently than non-0s. | ||||||
|  |   // Originally 15/8. | ||||||
|   retval += 1.796875 * stats->streaks[0][0]; |   retval += 1.796875 * stats->streaks[0][0]; | ||||||
|  |   // Originally 26/8. | ||||||
|   retval += 3.28125 * stats->streaks[1][0]; |   retval += 3.28125 * stats->streaks[1][0]; | ||||||
|   return retval; |   return retval; | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user