cosmetics: fix indent after 2f5e898

2f5e898 fix multiple allocation for transform buffer

Change-Id: Ied5c89c0040671e2eddf23c8b7a78e0d817dd18e
This commit is contained in:
James Zern 2016-02-19 19:22:34 -08:00
parent 6753f35cac
commit 0beed01aa5
2 changed files with 27 additions and 27 deletions

View File

@ -1128,21 +1128,21 @@ static void ClearTransformBuffer(VP8LEncoder* const enc) {
static WebPEncodingError AllocateTransformBuffer(VP8LEncoder* const enc,
int width, int height) {
WebPEncodingError err = VP8_ENC_OK;
const int tile_size = 1 << enc->transform_bits_;
const uint64_t image_size = width * height;
// Ensure enough size for tiles, as well as for two scanlines and two
// extra pixels for CopyImageWithPrediction.
const uint64_t argb_scratch_size =
enc->use_predict_ ? tile_size * width + width + 2 : 0;
const int transform_data_size =
(enc->use_predict_ || enc->use_cross_color_)
? VP8LSubSampleSize(width, enc->transform_bits_) *
VP8LSubSampleSize(height, enc->transform_bits_)
: 0;
const int tile_size = 1 << enc->transform_bits_;
const uint64_t image_size = width * height;
// Ensure enough size for tiles, as well as for two scanlines and two
// extra pixels for CopyImageWithPrediction.
const uint64_t argb_scratch_size =
enc->use_predict_ ? tile_size * width + width + 2 : 0;
const int transform_data_size =
(enc->use_predict_ || enc->use_cross_color_)
? VP8LSubSampleSize(width, enc->transform_bits_) *
VP8LSubSampleSize(height, enc->transform_bits_)
: 0;
const uint64_t mem_size =
image_size + WEBP_ALIGN_CST +
argb_scratch_size + WEBP_ALIGN_CST +
(uint64_t)transform_data_size;
image_size + WEBP_ALIGN_CST +
argb_scratch_size + WEBP_ALIGN_CST +
(uint64_t)transform_data_size;
uint32_t* mem = enc->transform_mem_;
if (mem == NULL || mem_size > enc->transform_mem_size_) {
ClearTransformBuffer(enc);
@ -1154,13 +1154,13 @@ static WebPEncodingError AllocateTransformBuffer(VP8LEncoder* const enc,
enc->transform_mem_ = mem;
enc->transform_mem_size_ = (size_t)mem_size;
}
enc->argb_ = mem;
mem = (uint32_t*)WEBP_ALIGN(mem + image_size);
enc->argb_scratch_ = mem;
mem = (uint32_t*)WEBP_ALIGN(mem + argb_scratch_size);
enc->transform_data_ = mem;
enc->argb_ = mem;
mem = (uint32_t*)WEBP_ALIGN(mem + image_size);
enc->argb_scratch_ = mem;
mem = (uint32_t*)WEBP_ALIGN(mem + argb_scratch_size);
enc->transform_data_ = mem;
enc->current_width_ = width;
enc->current_width_ = width;
Error:
return err;
}

View File

@ -25,17 +25,17 @@ extern "C" {
#endif
typedef struct {
const WebPConfig* config_; // user configuration and parameters
const WebPPicture* pic_; // input picture.
const WebPConfig* config_; // user configuration and parameters
const WebPPicture* pic_; // input picture.
uint32_t* argb_; // Transformed argb image data.
uint32_t* argb_scratch_; // Scratch memory for argb rows
// (used for prediction).
uint32_t* transform_data_; // Scratch memory for transform data.
uint32_t* argb_; // Transformed argb image data.
uint32_t* argb_scratch_; // Scratch memory for argb rows
// (used for prediction).
uint32_t* transform_data_; // Scratch memory for transform data.
uint32_t* transform_mem_; // Currently allocated memory.
size_t transform_mem_size_; // Currently allocated memory size.
int current_width_; // Corresponds to packed image width.
int current_width_; // Corresponds to packed image width.
// Encoding parameters derived from quality parameter.
int histo_bits_;