// Copyright 2012 Google Inc. All Rights Reserved. // // Use of this source code is governed by a BSD-style license // that can be found in the COPYING file in the root of the source // tree. An additional intellectual property rights grant can be found // in the file PATENTS. All contributing project authors may // be found in the AUTHORS file in the root of the source tree. // ----------------------------------------------------------------------------- // // main entry for the lossless encoder. // // Author: Vikas Arora (vikaas.arora@gmail.com) //
// Maximum number of histogram images (sub-blocks). #define MAX_HUFF_IMAGE_SIZE 2600 #define MAX_HUFFMAN_BITS (MIN_HUFFMAN_BITS + (1 << NUM_HUFFMAN_BITS) - 1) // Empirical value for which it becomes too computationally expensive to // compute the best predictor image. #define MAX_PREDICTOR_IMAGE_SIZE (1 << 14)
static WEBP_INLINE uint32_t HashPix(uint32_t pix) { // Note that masking with 0xffffffffu is for preventing an // 'unsigned int overflow' warning. Doesn't impact the compiled code. return ((((uint64_t)pix + (pix >> 19)) * 0x39c5fba7ull) & 0xffffffffu) >> 24;
}
staticint AnalyzeEntropy(const uint32_t* argb, int width, int height, int argb_stride, int use_palette, int palette_size, int transform_bits,
EntropyIx* const min_entropy_ix, int* const red_and_blue_always_zero) { // Allocate histogram set with cache_bits = 0.
uint32_t* histo;
if (use_palette && palette_size <= 16) { // In the case of small palettes, we pack 2, 4 or 8 pixels together. In // practice, small palettes are better than any other transform.
*min_entropy_ix = kPalette;
*red_and_blue_always_zero = 1; return 1;
}
histo = (uint32_t*)WebPSafeCalloc(kHistoTotal, sizeof(*histo) * 256); if (histo != NULL) { int i, x, y; const uint32_t* prev_row = NULL; const uint32_t* curr_row = argb;
uint32_t pix_prev = argb[0]; // Skip the first pixel. for (y = 0; y < height; ++y) { for (x = 0; x < width; ++x) { const uint32_t pix = curr_row[x]; const uint32_t pix_diff = VP8LSubPixels(pix, pix_prev);
pix_prev = pix; if ((pix_diff == 0) || (prev_row != NULL && pix == prev_row[x])) { continue;
}
AddSingle(pix,
&histo[kHistoAlpha * 256],
&histo[kHistoRed * 256],
&histo[kHistoGreen * 256],
&histo[kHistoBlue * 256]);
AddSingle(pix_diff,
&histo[kHistoAlphaPred * 256],
&histo[kHistoRedPred * 256],
&histo[kHistoGreenPred * 256],
&histo[kHistoBluePred * 256]);
AddSingleSubGreen(pix,
&histo[kHistoRedSubGreen * 256],
&histo[kHistoBlueSubGreen * 256]);
AddSingleSubGreen(pix_diff,
&histo[kHistoRedPredSubGreen * 256],
&histo[kHistoBluePredSubGreen * 256]);
{ // Approximate the palette by the entropy of the multiplicative hash. const uint32_t hash = HashPix(pix);
++histo[kHistoPalette * 256 + hash];
}
}
prev_row = curr_row;
curr_row += argb_stride;
}
{
uint64_t entropy_comp[kHistoTotal];
uint64_t entropy[kNumEntropyIx]; int k; int last_mode_to_analyze = use_palette ? kPalette : kSpatialSubGreen; int j; // Let's add one zero to the predicted histograms. The zeros are removed // too efficiently by the pix_diff == 0 comparison, at least one of the // zeros is likely to exist.
++histo[kHistoRedPredSubGreen * 256];
++histo[kHistoBluePredSubGreen * 256];
++histo[kHistoRedPred * 256];
++histo[kHistoGreenPred * 256];
++histo[kHistoBluePred * 256];
++histo[kHistoAlphaPred * 256];
// When including transforms, there is an overhead in bits from // storing them. This overhead is small but matters for small images. // For spatial, there are 14 transformations.
entropy[kSpatial] += (uint64_t)VP8LSubSampleSize(width, transform_bits) *
VP8LSubSampleSize(height, transform_bits) *
VP8LFastLog2(14); // For color transforms: 24 as only 3 channels are considered in a // ColorTransformElement.
entropy[kSpatialSubGreen] +=
(uint64_t)VP8LSubSampleSize(width, transform_bits) *
VP8LSubSampleSize(height, transform_bits) * VP8LFastLog2(24); // For palettes, add the cost of storing the palette. // We empirically estimate the cost of a compressed entry as 8 bits. // The palette is differential-coded when compressed hence a much // lower cost than sizeof(uint32_t)*8.
entropy[kPalette] += (palette_size * 8ull) << LOG_2_PRECISION_BITS;
*min_entropy_ix = kDirect; for (k = kDirect + 1; k <= last_mode_to_analyze; ++k) { if (entropy[*min_entropy_ix] > entropy[k]) {
*min_entropy_ix = (EntropyIx)k;
}
}
assert((int)*min_entropy_ix <= last_mode_to_analyze);
*red_and_blue_always_zero = 1; // Let's check if the histogram of the chosen entropy mode has // non-zero red and blue values. If all are zero, we can later skip // the cross color optimization.
{ staticconst uint8_t kHistoPairs[5][2] = {
{ kHistoRed, kHistoBlue },
{ kHistoRedPred, kHistoBluePred },
{ kHistoRedSubGreen, kHistoBlueSubGreen },
{ kHistoRedPredSubGreen, kHistoBluePredSubGreen },
{ kHistoRed, kHistoBlue }
}; const uint32_t* const red_histo =
&histo[256 * kHistoPairs[*min_entropy_ix][0]]; const uint32_t* const blue_histo =
&histo[256 * kHistoPairs[*min_entropy_ix][1]]; for (i = 1; i < 256; ++i) { if ((red_histo[i] | blue_histo[i]) != 0) {
*red_and_blue_always_zero = 0; break;
}
}
}
}
WebPSafeFree(histo); return 1;
} else { return 0;
}
}
// Clamp histogram and transform bits. staticint ClampBits(int width, int height, int bits, int min_bits, int max_bits, int image_size_max) { int image_size;
bits = (bits < min_bits) ? min_bits : (bits > max_bits) ? max_bits : bits;
image_size = VP8LSubSampleSize(width, bits) * VP8LSubSampleSize(height, bits); while (bits < max_bits && image_size > image_size_max) {
++bits;
image_size =
VP8LSubSampleSize(width, bits) * VP8LSubSampleSize(height, bits);
} // In case the bits reduce the image too much, choose the smallest value // setting the histogram image size to 1. while (bits > min_bits && image_size == 1) {
image_size = VP8LSubSampleSize(width, bits - 1) *
VP8LSubSampleSize(height, bits - 1); if (image_size != 1) break;
--bits;
} return bits;
}
staticint GetHistoBits(int method, int use_palette, int width, int height) { // Make tile size a function of encoding method (Range: 0 to 6). constint histo_bits = (use_palette ? 9 : 7) - method; return ClampBits(width, height, histo_bits, MIN_HUFFMAN_BITS,
MAX_HUFFMAN_BITS, MAX_HUFF_IMAGE_SIZE);
}
// Set of parameters to be used in each iteration of the cruncher. #define CRUNCH_SUBCONFIGS_MAX 2 typedefstruct { int lz77_; int do_no_cache_;
} CrunchSubConfig; typedefstruct { int entropy_idx_;
PaletteSorting palette_sorting_type_;
CrunchSubConfig sub_configs_[CRUNCH_SUBCONFIGS_MAX]; int sub_configs_size_;
} CrunchConfig;
// +2 because we add a palette sorting configuration for kPalette and // kPaletteAndSpatial. #define CRUNCH_CONFIGS_MAX (kNumEntropyIx + 2 * kPaletteSortingNum)
staticint EncoderAnalyze(VP8LEncoder* const enc,
CrunchConfig crunch_configs[CRUNCH_CONFIGS_MAX], int* const crunch_configs_size, int* const red_and_blue_always_zero) { const WebPPicture* const pic = enc->pic_; constint width = pic->width; constint height = pic->height; const WebPConfig* const config = enc->config_; constint method = config->method; constint low_effort = (config->method == 0); int i; int use_palette, transform_bits; int n_lz77s; // If set to 0, analyze the cache with the computed cache value. If 1, also // analyze with no-cache. int do_no_cache = 0;
assert(pic != NULL && pic->argb != NULL);
// Check whether a palette is possible.
enc->palette_size_ = GetColorPalette(pic, enc->palette_sorted_);
use_palette = (enc->palette_size_ <= MAX_PALETTE_SIZE); if (!use_palette) {
enc->palette_size_ = 0;
}
staticvoid StoreHuffmanTreeOfHuffmanTreeToBitMask(
VP8LBitWriter* const bw, const uint8_t* code_length_bitdepth) { // RFC 1951 will calm you down if you are worried about this funny sequence. // This sequence is tuned from that, but more weighted for lower symbol count, // and more spiking histograms. staticconst uint8_t kStorageOrder[CODE_LENGTH_CODES] = {
17, 18, 0, 1, 2, 3, 4, 5, 16, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
}; int i; // Throw away trailing zeros: int codes_to_store = CODE_LENGTH_CODES; for (; codes_to_store > 4; --codes_to_store) { if (code_length_bitdepth[kStorageOrder[codes_to_store - 1]] != 0) { break;
}
}
VP8LPutBits(bw, codes_to_store - 4, 4); for (i = 0; i < codes_to_store; ++i) {
VP8LPutBits(bw, code_length_bitdepth[kStorageOrder[i]], 3);
}
}
staticvoid ClearHuffmanTreeIfOnlyOneSymbol(
HuffmanTreeCode* const huffman_code) { int k; int count = 0; for (k = 0; k < huffman_code->num_symbols; ++k) { if (huffman_code->code_lengths[k] != 0) {
++count; if (count > 1) return;
}
} for (k = 0; k < huffman_code->num_symbols; ++k) {
huffman_code->code_lengths[k] = 0;
huffman_code->codes[k] = 0;
}
}
staticvoid StoreHuffmanTreeToBitMask(
VP8LBitWriter* const bw, const HuffmanTreeToken* const tokens, constint num_tokens, const HuffmanTreeCode* const huffman_code) { int i; for (i = 0; i < num_tokens; ++i) { constint ix = tokens[i].code; constint extra_bits = tokens[i].extra_bits;
VP8LPutBits(bw, huffman_code->codes[ix], huffman_code->code_lengths[ix]); switch (ix) { case 16:
VP8LPutBits(bw, extra_bits, 2); break; case 17:
VP8LPutBits(bw, extra_bits, 3); break; case 18:
VP8LPutBits(bw, extra_bits, 7); break;
}
}
}
// 'huff_tree' and 'tokens' are pre-alloacted buffers. staticvoid StoreHuffmanCode(VP8LBitWriter* const bw,
HuffmanTree* const huff_tree,
HuffmanTreeToken* const tokens, const HuffmanTreeCode* const huffman_code) { int i; int count = 0; int symbols[2] = { 0, 0 }; constint kMaxBits = 8; constint kMaxSymbol = 1 << kMaxBits;
// Check whether it's a small tree. for (i = 0; i < huffman_code->num_symbols && count < 3; ++i) { if (huffman_code->code_lengths[i] != 0) { if (count < 2) symbols[count] = i;
++count;
}
}
if (count == 0) { // emit minimal tree for empty cases // bits: small tree marker: 1, count-1: 0, large 8-bit code: 0, code: 0
VP8LPutBits(bw, 0x01, 4);
} elseif (count <= 2 && symbols[0] < kMaxSymbol && symbols[1] < kMaxSymbol) {
VP8LPutBits(bw, 1, 1); // Small tree marker to encode 1 or 2 symbols.
VP8LPutBits(bw, count - 1, 1); if (symbols[0] <= 1) {
VP8LPutBits(bw, 0, 1); // Code bit for small (1 bit) symbol value.
VP8LPutBits(bw, symbols[0], 1);
} else {
VP8LPutBits(bw, 1, 1);
VP8LPutBits(bw, symbols[0], 8);
} if (count == 2) {
VP8LPutBits(bw, symbols[1], 8);
}
} else {
StoreFullHuffmanCode(bw, huff_tree, tokens, huffman_code);
}
}
// Don't write the distance with the extra bits code since // the distance can be up to 18 bits of extra bits, and the prefix // 15 bits, totaling to 33, and our PutBits only supports up to 32 bits.
VP8LPrefixEncode(distance, &code, &n_bits, &bits);
WriteHuffmanCode(bw, codes + 4, code);
VP8LPutBits(bw, bits, n_bits);
}
x += PixOrCopyLength(v); while (x >= width) {
x -= width;
++y;
}
VP8LRefsCursorNext(&c);
} if (bw->error_) { return WebPEncodingSetError(pic, VP8_ENC_ERROR_OUT_OF_MEMORY);
} return 1;
}
// Special case of EncodeImageInternal() for cache-bits=0, histo_bits=31. // pic and percent are for progress. staticint EncodeImageNoHuffman(VP8LBitWriter* const bw, const uint32_t* const argb,
VP8LHashChain* const hash_chain,
VP8LBackwardRefs* const refs_array, int width, int height, int quality, int low_effort, const WebPPicture* const pic, int percent_range, int* const percent) { int i; int max_tokens = 0;
VP8LBackwardRefs* refs;
HuffmanTreeToken* tokens = NULL;
HuffmanTreeCode huffman_codes[5] = {{0, NULL, NULL}}; const uint32_t histogram_symbols[1] = {0}; // only one tree, one symbol int cache_bits = 0;
VP8LHistogramSet* histogram_image = NULL;
HuffmanTree* const huff_tree = (HuffmanTree*)WebPSafeMalloc(
3ULL * CODE_LENGTH_CODES, sizeof(*huff_tree)); if (huff_tree == NULL) {
WebPEncodingSetError(pic, VP8_ENC_ERROR_OUT_OF_MEMORY); goto Error;
}
// Build histogram image and symbols from backward references.
VP8LHistogramStoreRefs(refs, histogram_image->histograms[0]);
// Create Huffman bit lengths and codes for each histogram image.
assert(histogram_image->size == 1); if (!GetHuffBitLengthsAndCodes(histogram_image, huffman_codes)) {
WebPEncodingSetError(pic, VP8_ENC_ERROR_OUT_OF_MEMORY); goto Error;
}
// No color cache, no Huffman image.
VP8LPutBits(bw, 0, 1);
// Find maximum number of symbols for the huffman tree-set. for (i = 0; i < 5; ++i) {
HuffmanTreeCode* const codes = &huffman_codes[i]; if (max_tokens < codes->num_symbols) {
max_tokens = codes->num_symbols;
}
}
// Make sure we can allocate the different objects. if (huff_tree == NULL || histogram_argb == NULL ||
!VP8LHashChainInit(&hash_chain_histogram, histogram_image_xysize)) {
WebPEncodingSetError(pic, VP8_ENC_ERROR_OUT_OF_MEMORY); goto Error;
}
// If the value is different from zero, it has been set during the palette // analysis.
cache_bits_init = (*cache_bits == 0) ? MAX_COLOR_CACHE_BITS : *cache_bits; // If several iterations will happen, clone into bw_best. if ((config->sub_configs_size_ > 1 || config->sub_configs_[0].do_no_cache_) &&
!VP8LBitWriterClone(bw, &bw_best)) {
WebPEncodingSetError(pic, VP8_ENC_ERROR_OUT_OF_MEMORY); goto Error;
}
for (sub_configs_idx = 0; sub_configs_idx < config->sub_configs_size_;
++sub_configs_idx) { const CrunchSubConfig* const sub_config =
&config->sub_configs_[sub_configs_idx]; int cache_bits_best, i_cache; int i_remaining_percent = remaining_percent / config->sub_configs_size_; int i_percent_range = i_remaining_percent / 4;
i_remaining_percent -= i_percent_range;
for (i_cache = 0; i_cache < (sub_config->do_no_cache_ ? 2 : 1); ++i_cache) { constint cache_bits_tmp = (i_cache == 0) ? cache_bits_best : 0; int histogram_bits = histogram_bits_in; // Speed-up: no need to study the no-cache case if it was already studied // in i_cache == 0. if (i_cache == 1 && cache_bits_best == 0) break;
// Reset the bit writer for this iteration.
VP8LBitWriterReset(&bw_init, bw);
// Build histogram image and symbols from backward references.
histogram_image =
VP8LAllocateHistogramSet(histogram_image_xysize, cache_bits_tmp);
tmp_histo = VP8LAllocateHistogram(cache_bits_tmp); if (histogram_image == NULL || tmp_histo == NULL) {
WebPEncodingSetError(pic, VP8_ENC_ERROR_OUT_OF_MEMORY); goto Error;
}
i_percent_range = i_remaining_percent / 3;
i_remaining_percent -= i_percent_range; if (!VP8LGetHistoImageSymbols(
width, height, &refs_array[i_cache], quality, low_effort,
histogram_bits, cache_bits_tmp, histogram_image, tmp_histo,
histogram_argb, pic, i_percent_range, percent)) { goto Error;
} // Create Huffman bit lengths and codes for each histogram image.
histogram_image_size = histogram_image->size;
bit_array_size = 5 * histogram_image_size;
huffman_codes = (HuffmanTreeCode*)WebPSafeCalloc(bit_array_size, sizeof(*huffman_codes)); // Note: some histogram_image entries may point to tmp_histos[], so the // latter need to outlive the following call to // GetHuffBitLengthsAndCodes(). if (huffman_codes == NULL ||
!GetHuffBitLengthsAndCodes(histogram_image, huffman_codes)) {
WebPEncodingSetError(pic, VP8_ENC_ERROR_OUT_OF_MEMORY); goto Error;
} // Free combined histograms.
VP8LFreeHistogramSet(histogram_image);
histogram_image = NULL;
staticint ApplyCrossColorFilter(VP8LEncoder* const enc, int width, int height, int quality, int low_effort,
VP8LBitWriter* const bw, int percent_range, int* const percent) { constint min_bits = enc->cross_color_transform_bits_; int best_bits;
// Use 1 pixel cache for ARGB pixels. #define APPLY_PALETTE_FOR(COLOR_INDEX) do { \
uint32_t prev_pix = palette[0]; \
uint32_t prev_idx = 0; \ for (y = 0; y < height; ++y) { \ for (x = 0; x < width; ++x) { \ const uint32_t pix = src[x]; \ if (pix != prev_pix) { \
prev_idx = COLOR_INDEX; \
prev_pix = pix; \
} \
tmp_row[x] = prev_idx; \
} \
VP8LBundleColorMap(tmp_row, width, xbits, dst); \
src += src_stride; \
dst += dst_stride; \
} \
} while (0)
// Remap argb values in src[] to packed palettes entries in dst[] // using 'row' as a temporary buffer of size 'width'. // We assume that all src[] values have a corresponding entry in the palette. // Note: src[] can be the same as dst[] staticint ApplyPalette(const uint32_t* src, uint32_t src_stride, uint32_t* dst,
uint32_t dst_stride, const uint32_t* palette, int palette_size, int width, int height, int xbits, const WebPPicture* const pic) { // TODO(skal): this tmp buffer is not needed if VP8LBundleColorMap() can be // made to work in-place.
uint8_t* const tmp_row = (uint8_t*)WebPSafeMalloc(width, sizeof(*tmp_row)); int x, y;
if (tmp_row == NULL) { return WebPEncodingSetError(pic, VP8_ENC_ERROR_OUT_OF_MEMORY);
}
if (palette_size < APPLY_PALETTE_GREEDY_MAX) {
APPLY_PALETTE_FOR(SearchColorGreedy(palette, palette_size, pix));
} else { int i, j;
uint16_t buffer[PALETTE_INV_SIZE];
uint32_t (*const hash_functions[])(uint32_t) = {
ApplyPaletteHash0, ApplyPaletteHash1, ApplyPaletteHash2
};
// Try to find a perfect hash function able to go from a color to an index // within 1 << PALETTE_INV_SIZE_BITS in order to build a hash map to go // from color to index in palette. for (i = 0; i < 3; ++i) { int use_LUT = 1; // Set each element in buffer to max uint16_t.
memset(buffer, 0xff, sizeof(buffer)); for (j = 0; j < palette_size; ++j) { const uint32_t ind = hash_functions[i](palette[j]); if (buffer[ind] != 0xffffu) {
use_LUT = 0; break;
} else {
buffer[ind] = j;
}
} if (use_LUT) break;
}
// Save palette_[] to bitstream. staticint EncodePalette(VP8LBitWriter* const bw, int low_effort,
VP8LEncoder* const enc, int percent_range, int* const percent) { int i;
uint32_t tmp_palette[MAX_PALETTE_SIZE]; constint palette_size = enc->palette_size_; const uint32_t* const palette = enc->palette_; // If the last element is 0, do not store it and count on automatic palette // 0-filling. This can only happen if there is no pixel packing, hence if // there are strictly more than 16 colors (after 0 is removed). const uint32_t encoded_palette_size =
(enc->palette_[palette_size - 1] == 0 && palette_size > 17)
? palette_size - 1
: palette_size;
VP8LPutBits(bw, TRANSFORM_PRESENT, 1);
VP8LPutBits(bw, COLOR_INDEXING_TRANSFORM, 2);
assert(palette_size >= 1 && palette_size <= MAX_PALETTE_SIZE);
VP8LPutBits(bw, encoded_palette_size - 1, 8); for (i = encoded_palette_size - 1; i >= 1; --i) {
tmp_palette[i] = VP8LSubPixels(palette[i], palette[i - 1]);
}
tmp_palette[0] = palette[0]; return EncodeImageNoHuffman(
bw, tmp_palette, &enc->hash_chain_, &enc->refs_[0], encoded_palette_size,
1, /*quality=*/20, low_effort, enc->pic_, percent_range, percent);
}
staticvoid VP8LEncoderDelete(VP8LEncoder* enc) { if (enc != NULL) { int i;
VP8LHashChainClear(&enc->hash_chain_); for (i = 0; i < 4; ++i) VP8LBackwardRefsClear(&enc->refs_[i]);
ClearTransformBuffer(enc);
WebPSafeFree(enc);
}
}
// ----------------------------------------------------------------------------- // Main call
// Encode palette if (enc->use_palette_) { if (!PaletteSort(crunch_configs[idx].palette_sorting_type_, enc->pic_,
enc->palette_sorted_, enc->palette_size_,
enc->palette_)) {
WebPEncodingSetError(enc->pic_, VP8_ENC_ERROR_OUT_OF_MEMORY); goto Error;
}
percent_range = remaining_percent / 4; if (!EncodePalette(bw, low_effort, enc, percent_range, &percent)) { goto Error;
}
remaining_percent -= percent_range; if (!MapImageFromPalette(enc)) goto Error; // If using a color cache, do not have it bigger than the number of // colors. if (enc->palette_size_ < (1 << MAX_COLOR_CACHE_BITS)) {
enc->cache_bits_ = BitsLog2Floor(enc->palette_size_) + 1;
}
} // In case image is not packed. if (enc->argb_content_ != kEncoderNearLossless &&
enc->argb_content_ != kEncoderPalette) { if (!MakeInputImageCopy(enc)) goto Error;
}
// ------------------------------------------------------------------------- // Apply transforms and write transform data.
if (enc->use_subtract_green_) {
ApplySubtractGreen(enc, enc->current_width_, height, bw);
}
// If we are better than what we already have. if (VP8LBitWriterNumBytes(bw) < best_size) {
best_size = VP8LBitWriterNumBytes(bw); // Store the BitWriter.
VP8LBitWriterSwap(bw, &bw_best); #if !defined(WEBP_DISABLE_STATS) // Update the stats. if (stats != NULL) {
stats->lossless_features = 0; if (enc->use_predict_) stats->lossless_features |= 1; if (enc->use_cross_color_) stats->lossless_features |= 2; if (enc->use_subtract_green_) stats->lossless_features |= 4; if (enc->use_palette_) stats->lossless_features |= 8;
stats->histogram_bits = enc->histo_bits_;
stats->transform_bits = enc->predictor_transform_bits_;
stats->cross_color_transform_bits = enc->cross_color_transform_bits_;
stats->cache_bits = enc->cache_bits_;
stats->palette_size = enc->palette_size_;
stats->lossless_size = (int)(best_size - byte_position);
stats->lossless_hdr_size = hdr_size;
stats->lossless_data_size = data_size;
} #endif
} // Reset the bit writer for the following iteration if any. if (num_crunch_configs > 1) VP8LBitWriterReset(&bw_init, bw);
}
VP8LBitWriterSwap(&bw_best, bw);
Error:
VP8LBitWriterWipeOut(&bw_best); // The hook should return false in case of error. return (params->picture_->error_code == VP8_ENC_OK);
}
int VP8LEncodeStream(const WebPConfig* const config, const WebPPicture* const picture,
VP8LBitWriter* const bw_main) {
VP8LEncoder* const enc_main = VP8LEncoderNew(config, picture);
VP8LEncoder* enc_side = NULL;
CrunchConfig crunch_configs[CRUNCH_CONFIGS_MAX]; int num_crunch_configs_main, num_crunch_configs_side = 0; int idx; int red_and_blue_always_zero = 0;
WebPWorker worker_main, worker_side;
StreamEncodeContext params_main, params_side; // The main thread uses picture->stats, the side thread uses stats_side.
WebPAuxStats stats_side;
VP8LBitWriter bw_side;
WebPPicture picture_side; const WebPWorkerInterface* const worker_interface = WebPGetWorkerInterface(); int ok_main;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.