- add sources.
[platform/framework/web/crosswalk.git] / src / third_party / libwebp / enc / layer.c
1 // Copyright 2011 Google Inc. All Rights Reserved.
2 //
3 // Use of this source code is governed by a BSD-style license
4 // that can be found in the COPYING file in the root of the source
5 // tree. An additional intellectual property rights grant can be found
6 // in the file PATENTS. All contributing project authors may
7 // be found in the AUTHORS file in the root of the source tree.
8 // -----------------------------------------------------------------------------
9 //
10 // Enhancement layer (for YUV444/422)
11 //
12 // Author: Skal (pascal.massimino@gmail.com)
13
14 #include <stdlib.h>
15
16 #include "./vp8enci.h"
17
18 #if defined(__cplusplus) || defined(c_plusplus)
19 extern "C" {
20 #endif
21
22 //------------------------------------------------------------------------------
23
24 void VP8EncInitLayer(VP8Encoder* const enc) {
25   enc->use_layer_ = (enc->pic_->u0 != NULL);
26   enc->layer_data_size_ = 0;
27   enc->layer_data_ = NULL;
28   if (enc->use_layer_) {
29     VP8BitWriterInit(&enc->layer_bw_, enc->mb_w_ * enc->mb_h_ * 3);
30   }
31 }
32
33 void VP8EncCodeLayerBlock(VP8EncIterator* it) {
34   (void)it;   // remove a warning
35 }
36
37 int VP8EncFinishLayer(VP8Encoder* const enc) {
38   if (enc->use_layer_) {
39     enc->layer_data_ = VP8BitWriterFinish(&enc->layer_bw_);
40     enc->layer_data_size_ = VP8BitWriterSize(&enc->layer_bw_);
41   }
42   return 1;
43 }
44
45 void VP8EncDeleteLayer(VP8Encoder* enc) {
46   free(enc->layer_data_);
47 }
48
49 #if defined(__cplusplus) || defined(c_plusplus)
50 }    // extern "C"
51 #endif