• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2011 Google Inc. All Rights Reserved.
2 //
3 // This code is licensed under the same terms as WebM:
4 //  Software License Agreement:  http://www.webmproject.org/license/software/
5 //  Additional IP Rights Grant:  http://www.webmproject.org/license/additional/
6 // -----------------------------------------------------------------------------
7 //
8 // Enhancement layer (for YUV444/422)
9 //
10 // Author: Skal (pascal.massimino@gmail.com)
11 
12 #include <stdlib.h>
13 
14 #include "./vp8enci.h"
15 
16 #if defined(__cplusplus) || defined(c_plusplus)
17 extern "C" {
18 #endif
19 
20 //------------------------------------------------------------------------------
21 
VP8EncInitLayer(VP8Encoder * const enc)22 void VP8EncInitLayer(VP8Encoder* const enc) {
23   enc->use_layer_ = (enc->pic_->u0 != NULL);
24   enc->layer_data_size_ = 0;
25   enc->layer_data_ = NULL;
26   if (enc->use_layer_) {
27     VP8BitWriterInit(&enc->layer_bw_, enc->mb_w_ * enc->mb_h_ * 3);
28   }
29 }
30 
VP8EncCodeLayerBlock(VP8EncIterator * it)31 void VP8EncCodeLayerBlock(VP8EncIterator* it) {
32   (void)it;   // remove a warning
33 }
34 
VP8EncFinishLayer(VP8Encoder * const enc)35 int VP8EncFinishLayer(VP8Encoder* const enc) {
36   if (enc->use_layer_) {
37     enc->layer_data_ = VP8BitWriterFinish(&enc->layer_bw_);
38     enc->layer_data_size_ = VP8BitWriterSize(&enc->layer_bw_);
39   }
40   return 1;
41 }
42 
VP8EncDeleteLayer(VP8Encoder * enc)43 void VP8EncDeleteLayer(VP8Encoder* enc) {
44   free(enc->layer_data_);
45 }
46 
47 #if defined(__cplusplus) || defined(c_plusplus)
48 }    // extern "C"
49 #endif
50