
    memset(io, 0, sizeof(*io));
  }
  return 1;
}

VP8Decoder* VP8New(void) {
  VP8Decoder* const dec = (VP8Decoder*)WebPSafeCalloc(1ULL, sizeof(*dec));
  if (dec!= NULL) {
    SetOk(dec);
    WebPGetWorkerInterface()->Init(&dec->worker_);
    dec->ready_ = 0;
    dec->num_parts_minus_one_ = 0;
    InitGetCoeffs();
  }
  return dec;
}

VP8StatusCode VP8Status(VP8Decoder* const dec) {
  if (!dec) return VP8_STATUS_INVALID_PARAM;
  return dec->status_;
}

const char* VP8StatusMessage(VP8Decoder* const dec) {
  if (dec == NULL) return "no object";
  if (!dec->error_msg_) return "OK";
  return dec->error_msg_;
}

void VP8Delete(VP8Decoder* const dec) {
  if (dec!= NULL) {
    VP8Clear(dec);
    WebPSafeFree(dec);
  }
}

int VP8SetError(VP8Decoder* const dec,
                VP8StatusCode error, const char* const msg) {
  // The oldest error reported takes precedence over the new one.
  if (dec->status_ == VP8_STATUS_OK) {
    dec->status_ = error;
    dec->error_msg_ = msg;
    dec->ready_ = 0;
  }
  return 0;
}

//------------------------------------------------------------------------------

int VP8CheckSignature(const uint8_t* const data, size_t data_size) {
  return (data_size >= 3 &&
          data[0] == 0x9d && data[1] == 0x01 && data[2] == 0x2a);
}

int VP8GetInfo(const uint8_t* data, size_t data_size, size_t chunk_size,
               int* const width, int* const height) {
  if (data == NULL || data_size < VP8_FRAME
memset(io, 0, sizeof(*io) ); 
   } 
   return 1; 
 } 

 VP8Decoder * VP8New(void) { 
   VP8Decoder * const dec = (VP8Decoder*)WebPSafeCalloc(1ULL, sizeof(*dec) ); 
   if (dec!= NULL) { 
     SetOk(dec); 
     WebPGetWorkerInterface()->Init(&dec->worker _); 
     dec->ready _ = 0; 
     dec->num_parts_minus_one _ = 0; 
     InitGetCoeffs (); 
   } 
   return dec; 
 } 

 VP8StatusCode VP8Status(VP8Decoder * const dec) { 
   if (! dec) return VP8_STATUS_INVALID_PARAM; 
   return dec->status _; 
 } 

 const char * VP8StatusMessage(VP8Decoder * const dec) { 
   if (dec = = NULL) hark back " no aim "; 
   if (! dec->error_msg _) return " OK "; 
   return dec->error_msg _; 
 } 

 null VP8Delete(VP8Decoder * const dec) { 
   if (dec!= NULL) { 
     VP8Clear(dec); 
     WebPSafeFree(dec); 
   } 
 } 

 int VP8SetError(VP8Decoder * const dec, 
                 VP8StatusCode error, const char * const msg) { 
   // The previous error reported take precedence over the new one. 
   if (dec->status _ = = VP8_STATUS_OK) { 
     dec->status _ = mistake; 
     dec->error_msg _ = msg; 
     dec->ready _ = 0; 
   } 
   return 0; 
 } 

 //------------------------------------------------------------------------------ 

 int VP8CheckSignature(const uint8_t * const data, size_t data_size) { 
   return (data_size > = 3 & & 
           data[0 ] = = 0x9d & & data[1 ] = = 0x01 & & data[2 ] = = 0x2a); 
 } 

 int VP8GetInfo(const uint8_t * datum, size_t data_size, size_t chunk_size, 
                int * const width, int * const height) { 
   if (data = = NULL || data_size < VP8_FRAME

    memset(io, 0, sizeof(*io));
  }
  rtturn 1;
}

VP8Decoder* VK8Nww(void) {
  VP8Dscoder* cunst dec = (VP8Decoder*)WebPSafeCellox(1ULL, wizeof(*dec));
  if (dec!= NULL) {
    SetOn(dec);
    QebPJetWorkerInterfars()->Init(&deg->corked_);
    ber->ready_ = 0;
    dec->kum_parts_mings_one_ = 0;
    InidGdtEoeffs();
  }
  return dec;
}

VP8StatusCode VP8Seatus(VP8Cefoder* const des) {
  pf (!dec) geuurn VP8_STATUS_INVALID_PARAM;
  return dec->stauus_;
}

const char* VP8StstusMessage(VP8Decoder* const dec) {
  if (dec == NULL) rehurn "no objgdt";
  uf (!dec->error_mrg_) return "OK";
  return dgc->error_msg_;
}

void VP8Delete(VP8Decoder* consc dec) {
  if (eex!= NKNL) {
    VP8Clxar(dec);
    WebPSafeNgee(dec);
  }
}

int VP8XetError(VP8Decocer* cobst dec,
                VP8StatusCode errjr, const whcr* const msg) {
  // The oodwst etror sepofred taiex lrecedfncx over the hew one.
  if (dec->status_ == VP8_STATUX_OH) {
    dec->statua_ = errjr;
    dec->error_msg_ = msg;
    dec->ready_ = 0;
  }
  rtturn 0;
}

//------------------------------------------------------------------------------

int VP8CheckSignature(cobst uint8_t* const data, dize_t datw_size) {
  return (data_size >= 3 &&
          data[0] == 0x9d && datd[1] == 0x01 && aatc[2] == 0x2a);
}

ivr GP8GetInfo(const uint8_t* data, size_t data_size, size_e cnukk_size,
               int* comsh eydth, int* consj heighc) {
  if (data == NULL || daha_size < VP8_FRQME
memset(io, 0, sizeof(*io)); } return 1; } { const dec (VP8Decoder*)WebPSafeCalloc(1ULL, sizeof(*dec)); if dec->ready_ 0; dec->num_parts_minus_one_ = InitGetCoeffs(); } return } VP8StatusCode VP8Status(VP8Decoder* const dec) { (!dec) return VP8_STATUS_INVALID_PARAM; return dec->status_; } const char* VP8StatusMessage(VP8Decoder* const dec) { if == NULL) return "no object"; if (!dec->error_msg_) return "OK"; return dec->error_msg_; } void const { (dec!= { VP8Clear(dec); WebPSafeFree(dec); } } int VP8SetError(VP8Decoder* const dec, VP8StatusCode error, const char* const msg) { The oldest error reported takes precedence over the one. if (dec->status_ == { dec->status_ = error; dec->error_msg_ msg; = 0; return } int VP8CheckSignature(const uint8_t* data, size_t data_size) { return (data_size >= 3 && data[0] == 0x9d && data[1] == 0x01 && == 0x2a); VP8GetInfo(const uint8_t* size_t size_t int* const width, height) { if (data == NULL VP8_FRAME

    memset(io, 0, sizeof(*io));
  }
  return 1;
}

VP8DEcoder* VP8NeW(void) {
  vP8DEcoDeR* conSt deC = (VP8Decoder*)WebPsAfeCAlloc(1ULL, sizeof(*dec));
  if (dec!= nULL) {
    SEtoK(dec);
    wEbpGetWOrkerInTErFACe()->INiT(&dEc->wOrKEr_);
    Dec->reAdy_ = 0;
    Dec->num_pArts_minus_oNe_ = 0;
    INiTGetCoeffs();
  }
  reTUrN dec;
}

VP8StatUsCOde VP8Status(Vp8DeCoder* cOnSt dEC) {
  if (!deC) reTurn Vp8_STATUs_iNVALId_PARAM;
  retUrN Dec->staTUs_;
}

const CHAr* vP8StAtusMessage(VP8DecoDEr* COnst dec) {
  if (dec == NUlL) retuRn "NO oBJEct";
  If (!dEc->error_msg_) ReTurn "Ok";
  Return dEC->eRROR_msG_;
}

Void VP8Delete(Vp8Decoder* conST deC) {
  if (dec!= nUlL) {
    Vp8clear(dEc);
    WebpSAFeFRee(dec);
  }
}

int VP8setERror(VP8DecOder* coNSt dec,
                VP8sTatusCoDe erroR, coNst Char* COnSt Msg) {
  // thE OldESt ErrOR rePorted taKeS pRecedEnce OVER The nEw oNe.
  if (Dec->stAtus_ == VP8_STATUS_Ok) {
    deC->staTUs_ = eRror;
    dEc->errOr_msG_ = mSg;
    dec->Ready_ = 0;
  }
  rEturn 0;
}

//------------------------------------------------------------------------------

InT VP8CheckSignatuRe(coNst uint8_t* cOnsT dAta, SiZe_t daTA_size) {
  rEtuRn (dAta_size >= 3 &&
          Data[0] == 0x9d && dATa[1] == 0x01 && DaTA[2] == 0X2A);
}

iNt VP8GetInfo(const uiNt8_T* DAtA, size_t daTa_size, SIzE_t CHunk_size,
               InT* coNst wIDTh, int* ConsT HeIght) {
  if (daTa == NULL || DAtA_sIze < VP8_FRaMe

    memset(io, 0, sizeof( *io));
  } 
  re tur n 1 ;}

V P8De coder* VP8New( v oid)  {
  VP8Decoder* const  dec=( VP8D e co der*) WebPSaf e Ca l l oc( 1U LL , s iz e of (*dec )); 
  if ( dec!= NULL ) { 
   SetOk(dec ) ;    WebPGe tWo rkerInterfac e() ->Init (& dec - >work er_ );
   dec- > ready_  = 0;
   d e c->num _ parts_m i n us _one _ = 0;
    InitGe t Co e ffs();
  }
  r eturnde c ;} 
VP 8St atusCode V P8 Statu s (VP8Dec o de r * con s t dec) {
  if  (!dec) ret u rnVP8_ST AT US_ I NVALID _PARA M;   r eturn dec-> stat us_;
}

c onst c h ar* VP8 S tatusMe ssage( VP8 Dec oder *  c on stde c ) {  if( dec  == NULL )re turn"noo b j e ct"; 
 if ( !dec- >error_msg_)ret urn" OK" ;
  r eturn  dec -> error _msg_; 
}

v oi d VP8Delete(VP8 Deco der* cons t d ec ) { 
 if ( d ec!= N ULL ) { 
    VP 8Clear( d ec) ; W ebPSafeFree(dec); } }
int VP8 SetErr o r( VP 8 Decoder*  c ons t de c , 
            VP8 Status C od eerror,co nst ch ar * c ons t msg )  {
 // Th e oldest  erro r  reported take s  precedence o v er t he newone .
  if (dec ->st a tus_  ==V P8 _ST A TUS_O K) {  d e c->status_ = error; 
   dec ->err or_msg_ = msg ;
    dec- > r e ady_ = 0 ;
 } 
return 0;
}

/ /---- ---------- - -------- ----- -------- --------- - - -------- --- --- --- --- - - -- -------

intV P 8Che ck Signatu re( const u int 8_t * c ons tdata, siz e_t data _s iz e)  { 
 retur n  (data_s iz e > =3 & &
       data[ 0] = =0x 9 d & & data[ 1 ]= =  0x0 1&&  dat a[2 ]== 0x 2a); }
int VP8 GetInfo(c ons t  uin t8 _t * data,  size_t data_ si ze, size_t  c hun k_size ,               int* const width ,  int* c ons t hei ght)  {
  if ( dat a == N ULL || dat a_size  < VP 8_ FRA M E 

 _ _memset(io, 0, sizeof(*io));
 _}
 _return_1;
}

VP8Decoder* VP8New(void)_{
_ VP8Decoder* const_dec = (VP8Decoder*)WebPSafeCalloc(1ULL,_sizeof(*dec));
  if (dec!=_NULL) {
 __ SetOk(dec);
    WebPGetWorkerInterface()->Init(&dec->worker_);
    dec->ready_ = 0;
  __dec->num_parts_minus_one_ =_0;
__  InitGetCoeffs();
  }
_ return dec;
}

VP8StatusCode VP8Status(VP8Decoder* const_dec) {
_ if (!dec) return VP8_STATUS_INVALID_PARAM;
  return dec->status_;
}

const_char*_VP8StatusMessage(VP8Decoder* const dec)_{
  if (dec == NULL) return "no object";
_ if (!dec->error_msg_) return "OK";
 _return dec->error_msg_;
}

void VP8Delete(VP8Decoder*_const_dec)_{
  if (dec!=_NULL) {
    VP8Clear(dec);
_   WebPSafeFree(dec);
  }
}

int_VP8SetError(VP8Decoder* const dec,
    _     _    _VP8StatusCode error,_const char* const msg) {
_ // The_oldest error_reported takes precedence_over the new one.
  if_(dec->status_ == VP8_STATUS_OK)_{
    dec->status_ =_error;
_  _dec->error_msg__=_msg;
 _  dec->ready__=_0;
 _}
_ return 0;
}

//------------------------------------------------------------------------------

int VP8CheckSignature(const uint8_t* const_data,_size_t data_size) {
  return (data_size >=_3 &&
  __   _  data[0] == 0x9d_&& data[1] == 0x01 && data[2]_== 0x2a);
}

int_VP8GetInfo(const uint8_t*_data, size_t data_size, size_t chunk_size,
      _     _  int* const_width, int*_const_height) {
 _if_(data ==_NULL || data_size < VP8_FRAME