Merge "remove all unused layer code"

This commit is contained in:
James Zern 2014-05-08 22:51:13 -07:00 committed by Gerrit Code Review
commit 34168ecbe4
16 changed files with 2 additions and 204 deletions

View File

@ -18,7 +18,6 @@ LOCAL_SRC_FILES := \
src/dec/frame.c \
src/dec/idec.c \
src/dec/io.c \
src/dec/layer.c \
src/dec/quant.c \
src/dec/tree.c \
src/dec/vp8.c \
@ -48,7 +47,6 @@ LOCAL_SRC_FILES := \
src/enc/frame.c \
src/enc/histogram.c \
src/enc/iterator.c \
src/enc/layer.c \
src/enc/picture.c \
src/enc/quant.c \
src/enc/syntax.c \

View File

@ -156,7 +156,6 @@ DEC_OBJS = \
$(DIROBJ)\dec\frame.obj \
$(DIROBJ)\dec\idec.obj \
$(DIROBJ)\dec\io.obj \
$(DIROBJ)\dec\layer.obj \
$(DIROBJ)\dec\quant.obj \
$(DIROBJ)\dec\tree.obj \
$(DIROBJ)\dec\vp8.obj \
@ -210,7 +209,6 @@ ENC_OBJS = \
$(DIROBJ)\enc\frame.obj \
$(DIROBJ)\enc\histogram.obj \
$(DIROBJ)\enc\iterator.obj \
$(DIROBJ)\enc\layer.obj \
$(DIROBJ)\enc\picture.obj \
$(DIROBJ)\enc\quant.obj \
$(DIROBJ)\enc\syntax.obj \

View File

@ -273,10 +273,6 @@ static void PrintExtraInfoLossy(const WebPPicture* const pic, int short_output,
fprintf(stderr, " transparency: %6d (%.1f dB)\n",
stats->alpha_data_size, stats->PSNR[4]);
}
if (stats->layer_data_size) {
fprintf(stderr, " enhancement: %6d\n",
stats->layer_data_size);
}
fprintf(stderr, " Residuals bytes "
"|segment 1|segment 2|segment 3"
"|segment 4| total\n");

View File

@ -91,7 +91,6 @@ DEC_OBJS = \
src/dec/frame.o \
src/dec/idec.o \
src/dec/io.o \
src/dec/layer.o \
src/dec/quant.o \
src/dec/tree.o \
src/dec/vp8.o \
@ -134,7 +133,6 @@ ENC_OBJS = \
src/enc/frame.o \
src/enc/histogram.o \
src/enc/iterator.o \
src/enc/layer.o \
src/enc/picture.o \
src/enc/quant.o \
src/enc/syntax.o \

View File

@ -9,7 +9,6 @@ libwebpdecode_la_SOURCES += decode_vp8.h
libwebpdecode_la_SOURCES += frame.c
libwebpdecode_la_SOURCES += idec.c
libwebpdecode_la_SOURCES += io.c
libwebpdecode_la_SOURCES += layer.c
libwebpdecode_la_SOURCES += quant.c
libwebpdecode_la_SOURCES += tree.c
libwebpdecode_la_SOURCES += vp8.c

View File

@ -1,30 +0,0 @@
// Copyright 2011 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.
// -----------------------------------------------------------------------------
//
// Enhancement layer (for YUV444/422)
//
// Author: Skal (pascal.massimino@gmail.com)
#include <assert.h>
#include <stdlib.h>
#include "./vp8i.h"
//------------------------------------------------------------------------------
int VP8DecodeLayer(VP8Decoder* const dec) {
assert(dec);
assert(dec->layer_data_size_ > 0);
(void)dec;
// TODO: handle enhancement layer here.
return 1;
}

View File

@ -363,28 +363,6 @@ int VP8GetHeaders(VP8Decoder* const dec, VP8Io* const io) {
VP8ParseProba(br, dec);
#ifdef WEBP_EXPERIMENTAL_FEATURES
// Extensions
if (dec->pic_hdr_.colorspace_) {
const size_t kTrailerSize = 8;
const uint8_t kTrailerMarker = 0x01;
const uint8_t* ext_buf = buf - kTrailerSize;
size_t size;
if (frm_hdr->partition_length_ < kTrailerSize ||
ext_buf[kTrailerSize - 1] != kTrailerMarker) {
return VP8SetError(dec, VP8_STATUS_BITSTREAM_ERROR,
"RIFF: Inconsistent extra information.");
}
// Layer
size = (ext_buf[0] << 0) | (ext_buf[1] << 8) | (ext_buf[2] << 16);
dec->layer_data_size_ = size;
dec->layer_data_ = NULL; // will be set later
dec->layer_colorspace_ = ext_buf[3];
}
#endif
// sanitized state
dec->ready_ = 1;
return 1;
@ -629,15 +607,6 @@ static int ParseFrame(VP8Decoder* const dec, VP8Io* io) {
if (!WebPWorkerSync(&dec->worker_)) return 0;
}
// Finish
#ifdef WEBP_EXPERIMENTAL_FEATURES
if (dec->layer_data_size_ > 0) {
if (!VP8DecodeLayer(dec)) {
return 0;
}
}
#endif
return 1;
}

View File

@ -297,11 +297,6 @@ struct VP8Decoder {
size_t alpha_data_size_;
int is_alpha_decoded_; // true if alpha_data_ is decoded in alpha_plane_
uint8_t* alpha_plane_; // output. Persistent, contains the whole data.
// extensions
int layer_colorspace_;
const uint8_t* layer_data_; // compressed layer data (if present)
size_t layer_data_size_;
};
//------------------------------------------------------------------------------
@ -349,9 +344,6 @@ int VP8DecodeMB(VP8Decoder* const dec, VP8BitReader* const token_br);
const uint8_t* VP8DecompressAlphaRows(VP8Decoder* const dec,
int row, int num_rows);
// in layer.c
int VP8DecodeLayer(VP8Decoder* const dec);
//------------------------------------------------------------------------------
#ifdef __cplusplus

View File

@ -12,7 +12,6 @@ libwebpencode_la_SOURCES += filter.c
libwebpencode_la_SOURCES += frame.c
libwebpencode_la_SOURCES += histogram.c
libwebpencode_la_SOURCES += iterator.c
libwebpencode_la_SOURCES += layer.c
libwebpencode_la_SOURCES += picture.c
libwebpencode_la_SOURCES += quant.c
libwebpencode_la_SOURCES += syntax.c

View File

@ -716,11 +716,6 @@ int VP8EncLoop(VP8Encoder* const enc) {
} else { // reset predictors after a skip
ResetAfterSkip(&it);
}
#ifdef WEBP_EXPERIMENTAL_FEATURES
if (enc->use_layer_) {
VP8EncCodeLayerBlock(&it);
}
#endif
StoreSideInfo(&it);
VP8StoreFilterStats(&it);
VP8IteratorExport(&it);
@ -788,11 +783,6 @@ int VP8EncTokenLoop(VP8Encoder* const enc) {
RecordTokens(&it, &info, &enc->tokens_);
size_p0 += info.H;
distortion += info.D;
#ifdef WEBP_EXPERIMENTAL_FEATURES
if (enc->use_layer_) {
VP8EncCodeLayerBlock(&it);
}
#endif
if (is_last_pass) {
StoreSideInfo(&it);
VP8StoreFilterStats(&it);

View File

@ -1,44 +0,0 @@
// Copyright 2011 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.
// -----------------------------------------------------------------------------
//
// Enhancement layer (for YUV444/422)
//
// Author: Skal (pascal.massimino@gmail.com)
#include <stdlib.h>
#include "./vp8enci.h"
#include "../utils/utils.h"
//------------------------------------------------------------------------------
void VP8EncInitLayer(VP8Encoder* const enc) {
enc->use_layer_ = (enc->pic_->u0 != NULL);
enc->layer_data_size_ = 0;
enc->layer_data_ = NULL;
if (enc->use_layer_) {
VP8BitWriterInit(&enc->layer_bw_, enc->mb_w_ * enc->mb_h_ * 3);
}
}
void VP8EncCodeLayerBlock(VP8EncIterator* it) {
(void)it; // remove a warning
}
int VP8EncFinishLayer(VP8Encoder* const enc) {
if (enc->use_layer_) {
enc->layer_data_ = VP8BitWriterFinish(&enc->layer_bw_);
enc->layer_data_size_ = VP8BitWriterSize(&enc->layer_bw_);
}
return 1;
}
void VP8EncDeleteLayer(VP8Encoder* enc) {
WebPSafeFree(enc->layer_data_);
}

View File

@ -263,53 +263,14 @@ static int EmitPartitionsSize(const VP8Encoder* const enc,
//------------------------------------------------------------------------------
#ifdef WEBP_EXPERIMENTAL_FEATURES
#define KTRAILER_SIZE 8
static int WriteExtensions(VP8Encoder* const enc) {
uint8_t buffer[KTRAILER_SIZE];
VP8BitWriter* const bw = &enc->bw_;
WebPPicture* const pic = enc->pic_;
// Layer (bytes 0..3)
PutLE24(buffer + 0, enc->layer_data_size_);
buffer[3] = enc->pic_->colorspace & WEBP_CSP_UV_MASK;
if (enc->layer_data_size_ > 0) {
assert(enc->use_layer_);
// append layer data to last partition
if (!VP8BitWriterAppend(&enc->parts_[enc->num_parts_ - 1],
enc->layer_data_, enc->layer_data_size_)) {
return WebPEncodingSetError(pic, VP8_ENC_ERROR_BITSTREAM_OUT_OF_MEMORY);
}
}
buffer[KTRAILER_SIZE - 1] = 0x01; // marker
if (!VP8BitWriterAppend(bw, buffer, KTRAILER_SIZE)) {
return WebPEncodingSetError(pic, VP8_ENC_ERROR_BITSTREAM_OUT_OF_MEMORY);
}
return 1;
}
#endif /* WEBP_EXPERIMENTAL_FEATURES */
//------------------------------------------------------------------------------
static size_t GeneratePartition0(VP8Encoder* const enc) {
VP8BitWriter* const bw = &enc->bw_;
const int mb_size = enc->mb_w_ * enc->mb_h_;
uint64_t pos1, pos2, pos3;
#ifdef WEBP_EXPERIMENTAL_FEATURES
const int need_extensions = enc->use_layer_;
#endif
pos1 = VP8BitWriterPos(bw);
VP8BitWriterInit(bw, mb_size * 7 / 8); // ~7 bits per macroblock
#ifdef WEBP_EXPERIMENTAL_FEATURES
VP8PutBitUniform(bw, need_extensions); // extensions
#else
VP8PutBitUniform(bw, 0); // colorspace
#endif
VP8PutBitUniform(bw, 0); // clamp type
PutSegmentHeader(bw, enc);
@ -324,19 +285,12 @@ static size_t GeneratePartition0(VP8Encoder* const enc) {
VP8CodeIntraModes(enc);
VP8BitWriterFinish(bw);
#ifdef WEBP_EXPERIMENTAL_FEATURES
if (need_extensions && !WriteExtensions(enc)) {
return 0;
}
#endif
pos3 = VP8BitWriterPos(bw);
if (enc->pic_->stats) {
enc->pic_->stats->header_bytes[0] = (int)((pos2 - pos1 + 7) >> 3);
enc->pic_->stats->header_bytes[1] = (int)((pos3 - pos2 + 7) >> 3);
enc->pic_->stats->alpha_data_size = (int)enc->alpha_data_size_;
enc->pic_->stats->layer_data_size = (int)enc->layer_data_size_;
}
return !bw->error_;
}

View File

@ -426,12 +426,6 @@ struct VP8Encoder {
uint32_t alpha_data_size_;
WebPWorker alpha_worker_;
// enhancement layer
int use_layer_;
VP8BitWriter layer_bw_;
uint8_t* layer_data_;
size_t layer_data_size_;
// quantization info (one set of DC/AC dequant factor per segment)
VP8SegmentInfo dqm_[NUM_MB_SEGMENTS];
int base_quant_; // nominal quantizer value. Only used
@ -537,12 +531,6 @@ int VP8EncStartAlpha(VP8Encoder* const enc); // start alpha coding process
int VP8EncFinishAlpha(VP8Encoder* const enc); // finalize compressed data
int VP8EncDeleteAlpha(VP8Encoder* const enc); // delete compressed data
// in layer.c
void VP8EncInitLayer(VP8Encoder* const enc); // init everything
void VP8EncCodeLayerBlock(VP8EncIterator* it); // code one more macroblock
int VP8EncFinishLayer(VP8Encoder* const enc); // finalize coding
void VP8EncDeleteLayer(VP8Encoder* enc); // reclaim memory
// in filter.c
// SSIM utils

View File

@ -254,9 +254,6 @@ static VP8Encoder* InitVP8Encoder(const WebPConfig* const config,
ResetBoundaryPredictions(enc);
VP8GetResidualCostInit();
VP8EncInitAlpha(enc);
#ifdef WEBP_EXPERIMENTAL_FEATURES
VP8EncInitLayer(enc);
#endif
// lower quality means smaller output -> we modulate a little the page
// size based on quality. This is just a crude 1rst-order prediction.
@ -271,9 +268,6 @@ static int DeleteVP8Encoder(VP8Encoder* enc) {
int ok = 1;
if (enc != NULL) {
ok = VP8EncDeleteAlpha(enc);
#ifdef WEBP_EXPERIMENTAL_FEATURES
VP8EncDeleteLayer(enc);
#endif
VP8TBufferClear(&enc->tokens_);
WebPSafeFree(enc);
}
@ -386,9 +380,6 @@ int WebPEncode(const WebPConfig* config, WebPPicture* pic) {
ok = ok && VP8EncTokenLoop(enc);
}
ok = ok && VP8EncFinishAlpha(enc);
#ifdef WEBP_EXPERIMENTAL_FEATURES
ok = ok && VP8EncFinishLayer(enc);
#endif
ok = ok && VP8EncWrite(enc);
StoreStats(enc);

View File

@ -20,7 +20,7 @@
extern "C" {
#endif
#define WEBP_DECODER_ABI_VERSION 0x0204 // MAJOR(8b) + MINOR(8b)
#define WEBP_DECODER_ABI_VERSION 0x0205 // MAJOR(8b) + MINOR(8b)
// Note: forward declaring enumerations is not allowed in (strict) C and C++,
// the types are left here for reference.

View File

@ -20,7 +20,7 @@
extern "C" {
#endif
#define WEBP_ENCODER_ABI_VERSION 0x0204 // MAJOR(8b) + MINOR(8b)
#define WEBP_ENCODER_ABI_VERSION 0x0205 // MAJOR(8b) + MINOR(8b)
// Note: forward declaring enumerations is not allowed in (strict) C and C++,
// the types are left here for reference.