Lines Matching refs:bw
497 VP8LBitWriter* const bw, const uint8_t* code_length_bitdepth) { in StoreHuffmanTreeOfHuffmanTreeToBitMask() argument
512 VP8LPutBits(bw, codes_to_store - 4, 4); in StoreHuffmanTreeOfHuffmanTreeToBitMask()
514 VP8LPutBits(bw, code_length_bitdepth[kStorageOrder[i]], 3); in StoreHuffmanTreeOfHuffmanTreeToBitMask()
535 VP8LBitWriter* const bw, in StoreHuffmanTreeToBitMask() argument
542 VP8LPutBits(bw, huffman_code->codes[ix], huffman_code->code_lengths[ix]); in StoreHuffmanTreeToBitMask()
545 VP8LPutBits(bw, extra_bits, 2); in StoreHuffmanTreeToBitMask()
548 VP8LPutBits(bw, extra_bits, 3); in StoreHuffmanTreeToBitMask()
551 VP8LPutBits(bw, extra_bits, 7); in StoreHuffmanTreeToBitMask()
558 static void StoreFullHuffmanCode(VP8LBitWriter* const bw, in StoreFullHuffmanCode() argument
571 VP8LPutBits(bw, 0, 1); in StoreFullHuffmanCode()
584 StoreHuffmanTreeOfHuffmanTreeToBitMask(bw, code_length_bitdepth); in StoreFullHuffmanCode()
608 VP8LPutBits(bw, write_trimmed_length, 1); in StoreFullHuffmanCode()
612 VP8LPutBits(bw, nbitpairs - 1, 3); in StoreFullHuffmanCode()
614 VP8LPutBits(bw, trimmed_length - 2, nbitpairs * 2); in StoreFullHuffmanCode()
616 StoreHuffmanTreeToBitMask(bw, tokens, length, &huffman_code); in StoreFullHuffmanCode()
621 static void StoreHuffmanCode(VP8LBitWriter* const bw, in StoreHuffmanCode() argument
641 VP8LPutBits(bw, 0x01, 4); in StoreHuffmanCode()
643 VP8LPutBits(bw, 1, 1); // Small tree marker to encode 1 or 2 symbols. in StoreHuffmanCode()
644 VP8LPutBits(bw, count - 1, 1); in StoreHuffmanCode()
646 VP8LPutBits(bw, 0, 1); // Code bit for small (1 bit) symbol value. in StoreHuffmanCode()
647 VP8LPutBits(bw, symbols[0], 1); in StoreHuffmanCode()
649 VP8LPutBits(bw, 1, 1); in StoreHuffmanCode()
650 VP8LPutBits(bw, symbols[0], 8); in StoreHuffmanCode()
653 VP8LPutBits(bw, symbols[1], 8); in StoreHuffmanCode()
656 StoreFullHuffmanCode(bw, huff_tree, tokens, huffman_code); in StoreHuffmanCode()
660 static WEBP_INLINE void WriteHuffmanCode(VP8LBitWriter* const bw, in WriteHuffmanCode() argument
665 VP8LPutBits(bw, symbol, depth); in WriteHuffmanCode()
669 VP8LBitWriter* const bw, in WriteHuffmanCodeWithExtraBits() argument
676 VP8LPutBits(bw, (bits << depth) | symbol, depth + n_bits); in WriteHuffmanCodeWithExtraBits()
680 VP8LBitWriter* const bw, int width, int histo_bits, in StoreImageToBitMask() argument
708 WriteHuffmanCode(bw, codes + k, code); in StoreImageToBitMask()
713 WriteHuffmanCode(bw, codes, literal_ix); in StoreImageToBitMask()
720 WriteHuffmanCodeWithExtraBits(bw, codes, 256 + code, bits, n_bits); in StoreImageToBitMask()
727 WriteHuffmanCode(bw, codes + 4, code); in StoreImageToBitMask()
728 VP8LPutBits(bw, bits, n_bits); in StoreImageToBitMask()
737 return bw->error_ ? VP8_ENC_ERROR_OUT_OF_MEMORY : VP8_ENC_OK; in StoreImageToBitMask()
741 static WebPEncodingError EncodeImageNoHuffman(VP8LBitWriter* const bw, in EncodeImageNoHuffman() argument
787 VP8LPutBits(bw, 0, 1); in EncodeImageNoHuffman()
806 StoreHuffmanCode(bw, huff_tree, tokens, codes); in EncodeImageNoHuffman()
811 err = StoreImageToBitMask(bw, width, 0, refs, histogram_symbols, in EncodeImageNoHuffman()
822 static WebPEncodingError EncodeImageInternal(VP8LBitWriter* const bw, in EncodeImageInternal() argument
907 VP8LPutBits(bw, 1, 1); in EncodeImageInternal()
908 VP8LPutBits(bw, *cache_bits, 4); in EncodeImageInternal()
910 VP8LPutBits(bw, 0, 1); in EncodeImageInternal()
916 VP8LPutBits(bw, write_histogram_image, 1); in EncodeImageInternal()
936 VP8LPutBits(bw, histogram_bits - 2, 3); in EncodeImageInternal()
937 err = EncodeImageNoHuffman(bw, histogram_argb, hash_chain, refs_array, in EncodeImageInternal()
971 StoreHuffmanCode(bw, huff_tree, tokens, codes); in EncodeImageInternal()
976 *hdr_size = (int)(VP8LBitWriterNumBytes(bw) - init_byte_position); in EncodeImageInternal()
978 err = StoreImageToBitMask(bw, width, histogram_bits, &refs, in EncodeImageInternal()
981 (int)(VP8LBitWriterNumBytes(bw) - init_byte_position - *hdr_size); in EncodeImageInternal()
1001 VP8LBitWriter* const bw) { in ApplySubtractGreen() argument
1002 VP8LPutBits(bw, TRANSFORM_PRESENT, 1); in ApplySubtractGreen()
1003 VP8LPutBits(bw, SUBTRACT_GREEN, 2); in ApplySubtractGreen()
1010 VP8LBitWriter* const bw) { in ApplyPredictFilter() argument
1018 VP8LPutBits(bw, TRANSFORM_PRESENT, 1); in ApplyPredictFilter()
1019 VP8LPutBits(bw, PREDICTOR_TRANSFORM, 2); in ApplyPredictFilter()
1021 VP8LPutBits(bw, pred_bits - 2, 3); in ApplyPredictFilter()
1022 return EncodeImageNoHuffman(bw, enc->transform_data_, in ApplyPredictFilter()
1032 VP8LBitWriter* const bw) { in ApplyCrossColorFilter() argument
1039 VP8LPutBits(bw, TRANSFORM_PRESENT, 1); in ApplyCrossColorFilter()
1040 VP8LPutBits(bw, CROSS_COLOR_TRANSFORM, 2); in ApplyCrossColorFilter()
1042 VP8LPutBits(bw, ccolor_transform_bits - 2, 3); in ApplyCrossColorFilter()
1043 return EncodeImageNoHuffman(bw, enc->transform_data_, in ApplyCrossColorFilter()
1067 VP8LBitWriter* const bw) { in WriteImageSize() argument
1072 VP8LPutBits(bw, width, VP8L_IMAGE_SIZE_BITS); in WriteImageSize()
1073 VP8LPutBits(bw, height, VP8L_IMAGE_SIZE_BITS); in WriteImageSize()
1074 return !bw->error_; in WriteImageSize()
1077 static int WriteRealAlphaAndVersion(VP8LBitWriter* const bw, int has_alpha) { in WriteRealAlphaAndVersion() argument
1078 VP8LPutBits(bw, has_alpha, 1); in WriteRealAlphaAndVersion()
1079 VP8LPutBits(bw, VP8L_VERSION, VP8L_VERSION_BITS); in WriteRealAlphaAndVersion()
1080 return !bw->error_; in WriteRealAlphaAndVersion()
1084 VP8LBitWriter* const bw, in WriteImage() argument
1087 const uint8_t* const webpll_data = VP8LBitWriterFinish(bw); in WriteImage()
1088 const size_t webpll_size = VP8LBitWriterNumBytes(bw); in WriteImage()
1289 static WebPEncodingError EncodePalette(VP8LBitWriter* const bw, in EncodePalette() argument
1295 VP8LPutBits(bw, TRANSFORM_PRESENT, 1); in EncodePalette()
1296 VP8LPutBits(bw, COLOR_INDEXING_TRANSFORM, 2); in EncodePalette()
1298 VP8LPutBits(bw, palette_size - 1, 8); in EncodePalette()
1303 return EncodeImageNoHuffman(bw, tmp_palette, &enc->hash_chain_, enc->refs_, in EncodePalette()
1310 VP8LBitWriter* const bw, VP8LEncoder* const enc, int quality) { in EncodeDeltaPalettePredictorImage() argument
1335 VP8LPutBits(bw, TRANSFORM_PRESENT, 1); in EncodeDeltaPalettePredictorImage()
1336 VP8LPutBits(bw, PREDICTOR_TRANSFORM, 2); in EncodeDeltaPalettePredictorImage()
1337 VP8LPutBits(bw, pred_bits - 2, 3); in EncodeDeltaPalettePredictorImage()
1338 err = EncodeImageNoHuffman(bw, predictors, &enc->hash_chain_, in EncodeDeltaPalettePredictorImage()
1381 VP8LBitWriter* const bw) { in VP8LEncodeStream() argument
1388 const size_t byte_position = VP8LBitWriterNumBytes(bw); in VP8LEncodeStream()
1430 err = EncodeDeltaPalettePredictorImage(bw, enc, quality); in VP8LEncodeStream()
1439 err = EncodePalette(bw, enc); in VP8LEncodeStream()
1455 ApplySubtractGreen(enc, enc->current_width_, height, bw); in VP8LEncodeStream()
1460 low_effort, bw); in VP8LEncodeStream()
1466 height, quality, bw); in VP8LEncodeStream()
1471 VP8LPutBits(bw, !TRANSFORM_PRESENT, 1); // No more transforms. in VP8LEncodeStream()
1475 err = EncodeImageInternal(bw, enc->argb_, &enc->hash_chain_, enc->refs_, in VP8LEncodeStream()
1492 stats->lossless_size = (int)(VP8LBitWriterNumBytes(bw) - byte_position); in VP8LEncodeStream()
1510 VP8LBitWriter bw; in VP8LEncodeImage() local
1526 if (!VP8LBitWriterInit(&bw, initial_size)) { in VP8LEncodeImage()
1548 if (!WriteImageSize(picture, &bw)) { in VP8LEncodeImage()
1555 if (!WriteRealAlphaAndVersion(&bw, has_alpha)) { in VP8LEncodeImage()
1563 err = VP8LEncodeStream(config, picture, &bw); in VP8LEncodeImage()
1570 err = WriteImage(picture, &bw, &coded_size); in VP8LEncodeImage()
1588 if (bw.error_) err = VP8_ENC_ERROR_OUT_OF_MEMORY; in VP8LEncodeImage()
1589 VP8LBitWriterWipeOut(&bw); in VP8LEncodeImage()