fix compilation of token.c
(TOKEN_BUFFER still disabled) also: made VP8TBufferClear() always visible Change-Id: Iff353fe70b2f3c5b0ab4ef7f143e1d65b0ab2b0d
This commit is contained in:
		@@ -33,6 +33,10 @@ struct VP8Tokens {
 | 
			
		||||
  VP8Tokens* next_;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
//------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
#ifdef USE_TOKEN_BUFFER
 | 
			
		||||
 | 
			
		||||
void VP8TBufferInit(VP8TBuffer* const b) {
 | 
			
		||||
  b->tokens_ = NULL;
 | 
			
		||||
  b->pages_ = NULL;
 | 
			
		||||
@@ -41,13 +45,9 @@ void VP8TBufferInit(VP8TBuffer* const b) {
 | 
			
		||||
  b->error_ = 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
#ifdef USE_TOKEN_BUFFER
 | 
			
		||||
 | 
			
		||||
void VP8TBufferClear(VP8TBuffer* const b) {
 | 
			
		||||
  if (b != NULL) {
 | 
			
		||||
    const VP8Tokens* p = b->rows_;
 | 
			
		||||
    const VP8Tokens* p = b->pages_;
 | 
			
		||||
    while (p != NULL) {
 | 
			
		||||
      const VP8Tokens* const next = p->next_;
 | 
			
		||||
      free((void*)p);
 | 
			
		||||
@@ -63,7 +63,7 @@ static int TBufferNewPage(VP8TBuffer* const b) {
 | 
			
		||||
    b->error_ = 1;
 | 
			
		||||
    return 0;
 | 
			
		||||
  }
 | 
			
		||||
  *b->last_page__ = page;
 | 
			
		||||
  *b->last_page_ = page;
 | 
			
		||||
  b->last_page_ = &page->next_;
 | 
			
		||||
  b->left_ = MAX_NUM_TOKEN;
 | 
			
		||||
  b->tokens_ = page->tokens_;
 | 
			
		||||
@@ -185,7 +185,7 @@ static void Record(int bit, proba_t* const stats) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void VP8TokenToStats(const VP8TBuffer* const b, proba_t* const stats) {
 | 
			
		||||
  const VP8Tokens* p = b->rows_;
 | 
			
		||||
  const VP8Tokens* p = b->pages_;
 | 
			
		||||
  while (p != NULL) {
 | 
			
		||||
    const int N = (p->next_ == NULL) ? b->left_ : 0;
 | 
			
		||||
    int n = MAX_NUM_TOKEN;
 | 
			
		||||
@@ -201,7 +201,8 @@ void VP8TokenToStats(const VP8TBuffer* const b, proba_t* const stats) {
 | 
			
		||||
 | 
			
		||||
int VP8EmitTokens(const VP8TBuffer* const b, VP8BitWriter* const bw,
 | 
			
		||||
                  const uint8_t* const probas, int final_pass) {
 | 
			
		||||
  const VP8Tokens* p = b->rows_;
 | 
			
		||||
  const VP8Tokens* p = b->pages_;
 | 
			
		||||
  (void)final_pass;
 | 
			
		||||
  if (b->error_) return 0;
 | 
			
		||||
  while (p != NULL) {
 | 
			
		||||
    const VP8Tokens* const next = p->next_;
 | 
			
		||||
@@ -221,6 +222,14 @@ int VP8EmitTokens(const VP8TBuffer* const b, VP8BitWriter* const bw,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//------------------------------------------------------------------------------
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
void VP8TBufferInit(VP8TBuffer* const b) {
 | 
			
		||||
  (void)b;
 | 
			
		||||
}
 | 
			
		||||
void VP8TBufferClear(VP8TBuffer* const b) {
 | 
			
		||||
  (void)b;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif    // USE_TOKEN_BUFFER
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -331,19 +331,20 @@ void VP8SetSegment(const VP8EncIterator* const it, int segment);
 | 
			
		||||
typedef struct VP8Tokens VP8Tokens;  // struct details in token.c
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
#ifdef USE_TOKEN_BUFFER
 | 
			
		||||
  VP8Tokens* pages_;        // first page
 | 
			
		||||
  VP8Tokens** last_page_;   // last page
 | 
			
		||||
  uint16_t* tokens_;        // set to (*last_page_)->tokens_
 | 
			
		||||
  int left_;          // how many free tokens left before the page is full.
 | 
			
		||||
  int error_;         // true in case of malloc error
 | 
			
		||||
#endif
 | 
			
		||||
} VP8TBuffer;
 | 
			
		||||
 | 
			
		||||
void VP8TBufferInit(VP8TBuffer* const b);    // initialize an empty buffer
 | 
			
		||||
void VP8TBufferClear(VP8TBuffer* const b);   // de-allocate pages memory
 | 
			
		||||
 | 
			
		||||
#ifdef USE_TOKEN_BUFFER
 | 
			
		||||
 | 
			
		||||
void VP8TBufferClear(VP8TBuffer* const b);   // de-allocate pages memory
 | 
			
		||||
 | 
			
		||||
int VP8EmitTokens(const VP8TBuffer* const b, VP8BitWriter* const bw,
 | 
			
		||||
                  const uint8_t* const probas, int final_pass);
 | 
			
		||||
int VP8RecordCoeffTokens(int ctx, int first, int last,
 | 
			
		||||
@@ -378,9 +379,8 @@ struct VP8Encoder {
 | 
			
		||||
 | 
			
		||||
  int percent_;                             // for progress
 | 
			
		||||
 | 
			
		||||
#ifdef USE_TOKEN_BUFFER
 | 
			
		||||
  int use_tokens_;                          // if true, use Token buffer
 | 
			
		||||
  VP8TBuffer tokens_;                       // token buffer
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
  // transparency blob
 | 
			
		||||
  int has_alpha_;
 | 
			
		||||
@@ -475,7 +475,7 @@ void VP8MakeIntra4Preds(const VP8EncIterator* const it);
 | 
			
		||||
int VP8GetCostLuma16(VP8EncIterator* const it, const VP8ModeScore* const rd);
 | 
			
		||||
int VP8GetCostLuma4(VP8EncIterator* const it, const int16_t levels[16]);
 | 
			
		||||
int VP8GetCostUV(VP8EncIterator* const it, const VP8ModeScore* const rd);
 | 
			
		||||
// Main stat / coding passes
 | 
			
		||||
// Main coding calls
 | 
			
		||||
int VP8EncLoop(VP8Encoder* const enc);
 | 
			
		||||
int VP8StatLoop(VP8Encoder* const enc);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user