static int flic_decode_frame_8BPP ( AVCodecContext * avctx , void * data , int * got_frame , const uint8_t * buf , int buf_size ) {
 FlicDecodeContext * s = avctx -> priv_data ;
 GetByteContext g2 ;
 int stream_ptr_after_color_chunk ;
 int pixel_ptr ;
 int palette_ptr ;
 unsigned char palette_idx1 ;
 unsigned char palette_idx2 ;
 unsigned int frame_size ;
 int num_chunks ;
 unsigned int chunk_size ;
 int chunk_type ;
 int i , j , ret ;
 int color_packets ;
 int color_changes ;
 int color_shift ;
 unsigned char r , g , b ;
 int lines ;
 int compressed_lines ;
 int starting_line ;
 signed short line_packets ;
 int y_ptr ;
 int byte_run ;
 int pixel_skip ;
 int pixel_countdown ;
 unsigned char * pixels ;
 unsigned int pixel_limit ;
 bytestream2_init ( & g2 , buf , buf_size ) ;
 s -> frame . reference = 1 ;
 s -> frame . buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE ;
 if ( ( ret = avctx -> reget_buffer ( avctx , & s -> frame ) ) < 0 ) {
 av_log ( avctx , AV_LOG_ERROR , "reget_buffer() failed\n" ) ;
 return ret ;
 }
 pixels = s -> frame . data [ 0 ] ;
 pixel_limit = s -> avctx -> height * s -> frame . linesize [ 0 ] ;
 frame_size = bytestream2_get_le32 ( & g2 ) ;
 bytestream2_skip ( & g2 , 2 ) ;
 num_chunks = bytestream2_get_le16 ( & g2 ) ;
 bytestream2_skip ( & g2 , 8 ) ;
 frame_size -= 16 ;
 while ( ( frame_size > 0 ) && ( num_chunks > 0 ) ) {
 chunk_size = bytestream2_get_le32 ( & g2 ) ;
 chunk_type = bytestream2_get_le16 ( & g2 ) ;
 switch ( chunk_type ) {
 case FLI_256_COLOR : case FLI_COLOR : stream_ptr_after_color_chunk = bytestream2_tell ( & g2 ) + chunk_size - 6 ;
 if ( ( chunk_type == FLI_256_COLOR ) && ( s -> fli_type != FLC_MAGIC_CARPET_SYNTHETIC_TYPE_CODE ) ) color_shift = 0 ;
 else color_shift = 2 ;
 color_packets = bytestream2_get_le16 ( & g2 ) ;
 palette_ptr = 0 ;
 for ( i = 0 ;
 i < color_packets ;
 i ++ ) {
 palette_ptr += bytestream2_get_byte ( & g2 ) ;
 color_changes = bytestream2_get_byte ( & g2 ) ;
 if ( color_changes == 0 ) color_changes = 256 ;
 for ( j = 0 ;
 j < color_changes ;
 j ++ ) {
 unsigned int entry ;
 if ( ( unsigned ) palette_ptr >= 256 ) palette_ptr = 0 ;
 r = bytestream2_get_byte ( & g2 ) << color_shift ;
 g = bytestream2_get_byte ( & g2 ) << color_shift ;
 b = bytestream2_get_byte ( & g2 ) << color_shift ;
 entry = ( r << 16 ) | ( g << 8 ) | b ;
 if ( s -> palette [ palette_ptr ] != entry ) s -> new_palette = 1 ;
 s -> palette [ palette_ptr ++ ] = entry ;
 }
 }
 if ( stream_ptr_after_color_chunk - bytestream2_tell ( & g2 ) > 0 ) bytestream2_skip ( & g2 , stream_ptr_after_color_chunk - bytestream2_tell ( & g2 ) ) ;
 break ;
 case FLI_DELTA : y_ptr = 0 ;
 compressed_lines = bytestream2_get_le16 ( & g2 ) ;
 while ( compressed_lines > 0 ) {
 line_packets = bytestream2_get_le16 ( & g2 ) ;
 if ( ( line_packets & 0xC000 ) == 0xC000 ) {
 line_packets = - line_packets ;
 y_ptr += line_packets * s -> frame . linesize [ 0 ] ;
 }
 else if ( ( line_packets & 0xC000 ) == 0x4000 ) {
 av_log ( avctx , AV_LOG_ERROR , "Undefined opcode (%x) in DELTA_FLI\n" , line_packets ) ;
 }
 else if ( ( line_packets & 0xC000 ) == 0x8000 ) {
 pixel_ptr = y_ptr + s -> frame . linesize [ 0 ] - 1 ;
 CHECK_PIXEL_PTR ( 0 ) ;
 pixels [ pixel_ptr ] = line_packets & 0xff ;
 }
 else {
 compressed_lines -- ;
 pixel_ptr = y_ptr ;
 CHECK_PIXEL_PTR ( 0 ) ;
 pixel_countdown = s -> avctx -> width ;
 for ( i = 0 ;
 i < line_packets ;
 i ++ ) {
 pixel_skip = bytestream2_get_byte ( & g2 ) ;
 pixel_ptr += pixel_skip ;
 pixel_countdown -= pixel_skip ;
 byte_run = sign_extend ( bytestream2_get_byte ( & g2 ) , 8 ) ;
 if ( byte_run < 0 ) {
 byte_run = - byte_run ;
 palette_idx1 = bytestream2_get_byte ( & g2 ) ;
 palette_idx2 = bytestream2_get_byte ( & g2 ) ;
 CHECK_PIXEL_PTR ( byte_run * 2 ) ;
 for ( j = 0 ;
 j < byte_run ;
 j ++ , pixel_countdown -= 2 ) {
 pixels [ pixel_ptr ++ ] = palette_idx1 ;
 pixels [ pixel_ptr ++ ] = palette_idx2 ;
 }
 }
 else {
 CHECK_PIXEL_PTR ( byte_run * 2 ) ;
 for ( j = 0 ;
 j < byte_run * 2 ;
 j ++ , pixel_countdown -- ) {
 pixels [ pixel_ptr ++ ] = bytestream2_get_byte ( & g2 ) ;
 }
 }
 }
 y_ptr += s -> frame . linesize [ 0 ] ;
 }
 }
 break ;
 case FLI_LC : starting_line = bytestream2_get_le16 ( & g2 ) ;
 y_ptr = 0 ;
 y_ptr += starting_line * s -> frame . linesize [ 0 ] ;
 compressed_lines = bytestream2_get_le16 ( & g2 ) ;
 while ( compressed_lines > 0 ) {
 pixel_ptr = y_ptr ;
 CHECK_PIXEL_PTR ( 0 ) ;
 pixel_countdown = s -> avctx -> width ;
 line_packets = bytestream2_get_byte ( & g2 ) ;
 if ( line_packets > 0 ) {
 for ( i = 0 ;
 i < line_packets ;
 i ++ ) {
 pixel_skip = bytestream2_get_byte ( & g2 ) ;
 pixel_ptr += pixel_skip ;
 pixel_countdown -= pixel_skip ;
 byte_run = sign_extend ( bytestream2_get_byte ( & g2 ) , 8 ) ;
 if ( byte_run > 0 ) {
 CHECK_PIXEL_PTR ( byte_run ) ;
 for ( j = 0 ;
 j < byte_run ;
 j ++ , pixel_countdown -- ) {
 pixels [ pixel_ptr ++ ] = bytestream2_get_byte ( & g2 ) ;
 }
 }
 else if ( byte_run < 0 ) {
 byte_run = - byte_run ;
 palette_idx1 = bytestream2_get_byte ( & g2 ) ;
 CHECK_PIXEL_PTR ( byte_run ) ;
 for ( j = 0 ;
 j < byte_run ;
 j ++ , pixel_countdown -- ) {
 pixels [ pixel_ptr ++ ] = palette_idx1 ;
 }
 }
 }
 }
 y_ptr += s -> frame . linesize [ 0 ] ;
 compressed_lines -- ;
 }
 break ;
 case FLI_BLACK : memset ( pixels , 0 , s -> frame . linesize [ 0 ] * s -> avctx -> height ) ;
 break ;
 case FLI_BRUN : y_ptr = 0 ;
 for ( lines = 0 ;
 lines < s -> avctx -> height ;
 lines ++ ) {
 pixel_ptr = y_ptr ;
 bytestream2_skip ( & g2 , 1 ) ;
 pixel_countdown = s -> avctx -> width ;
 while ( pixel_countdown > 0 ) {
 byte_run = sign_extend ( bytestream2_get_byte ( & g2 ) , 8 ) ;
 if ( ! byte_run ) {
 av_log ( avctx , AV_LOG_ERROR , "Invalid byte run value.\n" ) ;
 return AVERROR_INVALIDDATA ;
 }
 if ( byte_run > 0 ) {
 palette_idx1 = bytestream2_get_byte ( & g2 ) ;
 CHECK_PIXEL_PTR ( byte_run ) ;
 for ( j = 0 ;
 j < byte_run ;
 j ++ ) {
 pixels [ pixel_ptr ++ ] = palette_idx1 ;
 pixel_countdown -- ;
 if ( pixel_countdown < 0 ) av_log ( avctx , AV_LOG_ERROR , "pixel_countdown < 0 (%d) at line %d\n" , pixel_countdown , lines ) ;
 }
 }
 else {
 byte_run = - byte_run ;
 CHECK_PIXEL_PTR ( byte_run ) ;
 for ( j = 0 ;
 j < byte_run ;
 j ++ ) {
 pixels [ pixel_ptr ++ ] = bytestream2_get_byte ( & g2 ) ;
 pixel_countdown -- ;
 if ( pixel_countdown < 0 ) av_log ( avctx , AV_LOG_ERROR , "pixel_countdown < 0 (%d) at line %d\n" , pixel_countdown , lines ) ;
 }
 }
 }
 y_ptr += s -> frame . linesize [ 0 ] ;
 }
 break ;
 case FLI_COPY : if ( chunk_size - 6 > s -> avctx -> width * s -> avctx -> height ) {
 av_log ( avctx , AV_LOG_ERROR , "In chunk FLI_COPY : source data (%d bytes) " \ "bigger than image, skipping chunk\n" , chunk_size - 6 ) ;
 bytestream2_skip ( & g2 , chunk_size - 6 ) ;
 }
 else {
 for ( y_ptr = 0 ;
 y_ptr < s -> frame . linesize [ 0 ] * s -> avctx -> height ;
 y_ptr += s -> frame . linesize [ 0 ] ) {
 bytestream2_get_buffer ( & g2 , & pixels [ y_ptr ] , s -> avctx -> width ) ;
 }
 }
 break ;
 case FLI_MINI : bytestream2_skip ( & g2 , chunk_size - 6 ) ;
 break ;
 default : av_log ( avctx , AV_LOG_ERROR , "Unrecognized chunk type: %d\n" , chunk_type ) ;
 break ;
 }
 frame_size -= chunk_size ;
 num_chunks -- ;
 }
 if ( ( bytestream2_get_bytes_left ( & g2 ) != 0 ) && ( bytestream2_get_bytes_left ( & g2 ) != 1 ) ) av_log ( avctx , AV_LOG_ERROR , "Processed FLI chunk where chunk size = %d " \ "and final chunk ptr = %d\n" , buf_size , buf_size - bytestream2_get_bytes_left ( & g2 ) ) ;
 memcpy ( s -> frame . data [ 1 ] , s -> palette , AVPALETTE_SIZE ) ;
 if ( s -> new_palette ) {
 s -> frame . palette_has_changed = 1 ;
 s -> new_palette = 0 ;
 }
 * got_frame = 1 ;
 * ( AVFrame * ) data = s -> frame ;
 return buf_size ;
 }


CAMLexport float caml_deserialize_float_4(void)
{
  float f;
  caml_deserialize_block_4(&f, 1);
  return f;
}


  void WaitForCopySourceReady() {
    while (!GetRenderWidgetHostViewPort()->IsSurfaceAvailableForCopy())
      GiveItSomeTime();
  }


static inline void mix_stereo_to_mono(AC3DecodeContext *ctx)

{

    int i;

    float (*output)[256] = ctx->audio_block.block_output;

    for (i = 0; i < 256; i++)

        output[1][i] += output[2][i];

    memset(output[2], 0, sizeof(output[2]));

}


static guint iax_circuit_hash ( gconstpointer v ) {
 const iax_circuit_key * key = ( const iax_circuit_key * ) v ;
 guint hash_val ;
 hash_val = 0 ;
 ADD_ADDRESS_TO_HASH ( hash_val , & key -> addr ) ;
 hash_val += ( guint ) ( key -> ptype ) ;
 hash_val += ( guint ) ( key -> port ) ;
 hash_val += ( guint ) ( key -> callno ) ;
 # ifdef DEBUG_HASHING g_debug ( "+++ Hashing key: %s, result %#x" , key_to_str ( key ) , hash_val ) ;
 # endif return ( guint ) hash_val ;
 }


Resource* ResourceFetcher::CreateResourceForLoading(
    FetchRequest& request,
    const String& charset,
    const ResourceFactory& factory) {
  const String cache_identifier = GetCacheIdentifier();
  DCHECK(!GetMemoryCache()->ResourceForURL(request.GetResourceRequest().Url(),
                                           cache_identifier));

  RESOURCE_LOADING_DVLOG(1)
      << "Loading Resource for "
      << request.GetResourceRequest().Url().ElidedString();

  Resource* resource =
      factory.Create(request.GetResourceRequest(), request.Options(), charset);
  resource->SetLinkPreload(request.IsLinkPreload());
  if (request.IsSpeculativePreload()) {
    resource->SetPreloadDiscoveryTime(request.PreloadDiscoveryTime());
  }
  resource->SetCacheIdentifier(cache_identifier);

  if (factory.GetType() != Resource::kMainResource &&
      request.Options().data_buffering_policy != kDoNotBufferData) {
    GetMemoryCache()->Add(resource);
  }
  return resource;
}


static struct key *request_user_key(const char *master_desc, const u8 **master_key,
				    size_t *master_keylen)
{
	const struct user_key_payload *upayload;
	struct key *ukey;

	ukey = request_key(&key_type_user, master_desc, NULL);
	if (IS_ERR(ukey))
		goto error;

	down_read(&ukey->sem);
	upayload = user_key_payload_locked(ukey);
	if (!upayload) {
		/* key was revoked before we acquired its semaphore */
		up_read(&ukey->sem);
		key_put(ukey);
		ukey = ERR_PTR(-EKEYREVOKED);
		goto error;
	}
	*master_key = upayload->data;
	*master_keylen = upayload->datalen;
error:
	return ukey;
}


int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu)
{
	return 1;
}


static size_t mz_zip_file_write_callback(void *pOpaque, mz_uint64 ofs,
                                         const void *pBuf, size_t n) {
  (void)ofs;
  return MZ_FWRITE(pBuf, 1, n, (MZ_FILE *)pOpaque);
}


int PEM_write_ ## name ( FILE * fp , const type * x ) ;
 # define DECLARE_PEM_write_cb_fp ( name , type ) int PEM_write_ ## name ( FILE * fp , type * x , const EVP_CIPHER * enc , unsigned char * kstr , int klen , pem_password_cb * cb , void * u ) ;
 # endif # define DECLARE_PEM_read_bio ( name , type ) type * PEM_read_bio_ ## name ( BIO * bp , type * * x , pem_password_cb * cb , void * u ) ;
 # define DECLARE_PEM_write_bio ( name , type ) int PEM_write_bio_ ## name ( BIO * bp , type * x ) ;
 # define DECLARE_PEM_write_bio_const ( name , type ) int PEM_write_bio_ ## name ( BIO * bp , const type * x ) ;
 # define DECLARE_PEM_write_cb_bio ( name , type ) int PEM_write_bio_ ## name ( BIO * bp , type * x , const EVP_CIPHER * enc , unsigned char * kstr , int klen , pem_password_cb * cb , void * u ) ;
 # define DECLARE_PEM_write ( name , type ) DECLARE_PEM_write_bio ( name , type ) DECLARE_PEM_write_fp ( name , type ) # define DECLARE_PEM_write_const ( name , type ) DECLARE_PEM_write_bio_const ( name , type ) DECLARE_PEM_write_fp_const ( name , type ) # define DECLARE_PEM_write_cb ( name , type ) DECLARE_PEM_write_cb_bio ( name , type ) DECLARE_PEM_write_cb_fp ( name , type ) # define DECLARE_PEM_read ( name , type ) DECLARE_PEM_read_bio ( name , type ) DECLARE_PEM_read_fp ( name , type ) # define DECLARE_PEM_rw ( name , type ) DECLARE_PEM_read ( name , type ) DECLARE_PEM_write ( name , type ) # define DECLARE_PEM_rw_const ( name , type ) DECLARE_PEM_read ( name , type ) DECLARE_PEM_write_const ( name , type ) # define DECLARE_PEM_rw_cb ( name , type ) DECLARE_PEM_read ( name , type ) DECLARE_PEM_write_cb ( name , type ) typedef int pem_password_cb ( char * buf , int size , int rwflag , void * userdata ) ;
 int PEM_get_EVP_CIPHER_INFO ( char * header , EVP_CIPHER_INFO * cipher ) ;
 int PEM_do_header ( EVP_CIPHER_INFO * cipher , unsigned char * data , long * len , pem_password_cb * callback , void * u ) ;
 int PEM_read_bio ( BIO * bp , char * * name , char * * header , unsigned char * * data , long * len ) ;
 # define PEM_FLAG_SECURE 0x1 # define PEM_FLAG_EAY_COMPATIBLE 0x2 # define PEM_FLAG_ONLY_B64 0x4 int PEM_read_bio_ex ( BIO * bp , char * * name , char * * header , unsigned char * * data , long * len , unsigned int flags ) ;
 int PEM_bytes_read_bio_secmem ( unsigned char * * pdata , long * plen , char * * pnm , const char * name , BIO * bp , pem_password_cb * cb , void * u ) ;
 int PEM_write_bio ( BIO * bp , const char * name , const char * hdr , const unsigned char * data , long len ) ;
 int PEM_bytes_read_bio ( unsigned char * * pdata , long * plen , char * * pnm , const char * name , BIO * bp , pem_password_cb * cb , void * u ) ;
 void * PEM_ASN1_read_bio ( d2i_of_void * d2i , const char * name , BIO * bp , void * * x , pem_password_cb * cb , void * u ) ;
 int PEM_ASN1_write_bio ( i2d_of_void * i2d , const char * name , BIO * bp , void * x , const EVP_CIPHER * enc , unsigned char * kstr , int klen , pem_password_cb * cb , void * u ) ;
 STACK_OF ( X509_INFO ) * PEM_X509_INFO_read_bio ( BIO * bp , STACK_OF ( X509_INFO ) * sk , pem_password_cb * cb , void * u ) ;
 int PEM_X509_INFO_write_bio ( BIO * bp , X509_INFO * xi , EVP_CIPHER * enc , unsigned char * kstr , int klen , pem_password_cb * cd , void * u ) ;
 # ifndef OPENSSL_NO_STDIO int PEM_read ( FILE * fp , char * * name , char * * header , unsigned char * * data , long * len ) ;
 int PEM_write ( FILE * fp , const char * name , const char * hdr , const unsigned char * data , long len ) ;
 void * PEM_ASN1_read ( d2i_of_void * d2i , const char * name , FILE * fp , void * * x , pem_password_cb * cb , void * u ) ;
 int PEM_ASN1_write ( i2d_of_void * i2d , const char * name , FILE * fp , void * x , const EVP_CIPHER * enc , unsigned char * kstr , int klen , pem_password_cb * callback , void * u ) ;
 STACK_OF ( X509_INFO ) * PEM_X509_INFO_read ( FILE * fp , STACK_OF ( X509_INFO ) * sk , pem_password_cb * cb , void * u ) ;
 # endif int PEM_SignInit ( EVP_MD_CTX * ctx , EVP_MD * type ) ;
 int PEM_SignUpdate ( EVP_MD_CTX * ctx , unsigned char * d , unsigned int cnt ) ;
 int PEM_SignFinal ( EVP_MD_CTX * ctx , unsigned char * sigret , unsigned int * siglen , EVP_PKEY * pkey ) ;
 int PEM_def_callback ( char * buf , int num , int rwflag , void * userdata ) ;
 void PEM_proc_type ( char * buf , int type ) ;
 void PEM_dek_info ( char * buf , const char * type , int len , char * str ) ;
 # include < openssl / symhacks . h > DECLARE_PEM_rw ( X509 , X509 ) DECLARE_PEM_rw ( X509_AUX , X509 ) DECLARE_PEM_rw ( X509_REQ , X509_REQ ) DECLARE_PEM_write ( X509_REQ_NEW , X509_REQ ) DECLARE_PEM_rw ( X509_CRL , X509_CRL ) DECLARE_PEM_rw ( PKCS7 , PKCS7 ) DECLARE_PEM_rw ( NETSCAPE_CERT_SEQUENCE , NETSCAPE_CERT_SEQUENCE ) DECLARE_PEM_rw ( PKCS8 , X509_SIG ) DECLARE_PEM_rw ( PKCS8_PRIV_KEY_INFO , PKCS8_PRIV_KEY_INFO ) # ifndef OPENSSL_NO_RSA DECLARE_PEM_rw_cb ( RSAPrivateKey , RSA ) DECLARE_PEM_rw_const ( RSAPublicKey , RSA ) DECLARE_PEM_rw ( RSA_PUBKEY , RSA ) # endif # ifndef OPENSSL_NO_DSA DECLARE_PEM_rw_cb ( DSAPrivateKey , DSA ) DECLARE_PEM_rw ( DSA_PUBKEY , DSA ) DECLARE_PEM_rw_const ( DSAparams , DSA ) # endif # ifndef OPENSSL_NO_EC DECLARE_PEM_rw_const ( ECPKParameters , EC_GROUP ) DECLARE_PEM_rw_cb ( ECPrivateKey , EC_KEY ) DECLARE_PEM_rw ( EC_PUBKEY , EC_KEY ) # endif # ifndef OPENSSL_NO_DH DECLARE_PEM_rw_const ( DHparams , DH ) DECLARE_PEM_write_const ( DHxparams , DH )


VaapiVideoDecodeAccelerator::VaapiVP9Accelerator::VaapiVP9Accelerator(
    VaapiVideoDecodeAccelerator* vaapi_dec,
    VaapiWrapper* vaapi_wrapper)
     : vaapi_wrapper_(vaapi_wrapper), vaapi_dec_(vaapi_dec) {
   DCHECK(vaapi_wrapper_);
   DCHECK(vaapi_dec_);
  DETACH_FROM_SEQUENCE(sequence_checker_);
 }


void dnxhd_get_blocks(DNXHDEncContext *ctx, int mb_x, int mb_y)

{

    const int bs = ctx->block_width_l2;

    const int bw = 1 << bs;

    int dct_y_offset = ctx->dct_y_offset;

    int dct_uv_offset = ctx->dct_uv_offset;

    int linesize = ctx->m.linesize;

    int uvlinesize = ctx->m.uvlinesize;

    const uint8_t *ptr_y = ctx->thread[0]->src[0] +

                           ((mb_y << 4) * ctx->m.linesize) + (mb_x << bs + 1);

    const uint8_t *ptr_u = ctx->thread[0]->src[1] +

                           ((mb_y << 4) * ctx->m.uvlinesize) + (mb_x << bs + ctx->is_444);

    const uint8_t *ptr_v = ctx->thread[0]->src[2] +

                           ((mb_y << 4) * ctx->m.uvlinesize) + (mb_x << bs + ctx->is_444);

    PixblockDSPContext *pdsp = &ctx->m.pdsp;

    VideoDSPContext *vdsp = &ctx->m.vdsp;

    if (ctx->bit_depth != 10 && vdsp->emulated_edge_mc && ((mb_x << 4) + 16 > ctx->m.avctx->width ||

                                                           (mb_y << 4) + 16 > ctx->m.avctx->height)) {

        int y_w = ctx->m.avctx->width  - (mb_x << 4);

        int y_h = ctx->m.avctx->height - (mb_y << 4);

        int uv_w = (y_w + 1) / 2;

        int uv_h = y_h;

        linesize = 16;

        uvlinesize = 8;

        vdsp->emulated_edge_mc(&ctx->edge_buf_y[0], ptr_y,

                               linesize, ctx->m.linesize,

                               linesize, 16,

                               0, 0, y_w, y_h);

        vdsp->emulated_edge_mc(&ctx->edge_buf_uv[0][0], ptr_u,

                               uvlinesize, ctx->m.uvlinesize,

                               uvlinesize, 16,

                               0, 0, uv_w, uv_h);

        vdsp->emulated_edge_mc(&ctx->edge_buf_uv[1][0], ptr_v,

                               uvlinesize, ctx->m.uvlinesize,

                               uvlinesize, 16,

                               0, 0, uv_w, uv_h);

        dct_y_offset =  bw * linesize;

        dct_uv_offset = bw * uvlinesize;

        ptr_y = &ctx->edge_buf_y[0];

        ptr_u = &ctx->edge_buf_uv[0][0];

        ptr_v = &ctx->edge_buf_uv[1][0];

    } else if (ctx->bit_depth == 10 && vdsp->emulated_edge_mc && ((mb_x << 3) + 8 > ctx->m.avctx->width ||

                                                                  (mb_y << 3) + 8 > ctx->m.avctx->height)) {

        int y_w = ctx->m.avctx->width  - (mb_x << 3);

        int y_h = ctx->m.avctx->height - (mb_y << 3);

        int uv_w = ctx->is_444 ? y_w : (y_w + 1) / 2;

        int uv_h = y_h;

        linesize = 16;

        uvlinesize = 8 + 8 * ctx->is_444;

        vdsp->emulated_edge_mc(&ctx->edge_buf_y[0], ptr_y,

                               linesize, ctx->m.linesize,

                               linesize / 2, 16,

                               0, 0, y_w, y_h);

        vdsp->emulated_edge_mc(&ctx->edge_buf_uv[0][0], ptr_u,

                               uvlinesize, ctx->m.uvlinesize,

                               uvlinesize / 2, 16,

                               0, 0, uv_w, uv_h);

        vdsp->emulated_edge_mc(&ctx->edge_buf_uv[1][0], ptr_v,

                               uvlinesize, ctx->m.uvlinesize,

                               uvlinesize / 2, 16,

                               0, 0, uv_w, uv_h);

        dct_y_offset =  bw * linesize;

        dct_uv_offset = bw * uvlinesize;

        ptr_y = &ctx->edge_buf_y[0];

        ptr_u = &ctx->edge_buf_uv[0][0];

        ptr_v = &ctx->edge_buf_uv[1][0];

    }

    if (!ctx->is_444) {

        pdsp->get_pixels(ctx->blocks[0], ptr_y,      linesize);

        pdsp->get_pixels(ctx->blocks[1], ptr_y + bw, linesize);

        pdsp->get_pixels(ctx->blocks[2], ptr_u,      uvlinesize);

        pdsp->get_pixels(ctx->blocks[3], ptr_v,      uvlinesize);

        if (mb_y + 1 == ctx->m.mb_height && ctx->m.avctx->height == 1080) {

            if (ctx->interlaced) {

                ctx->get_pixels_8x4_sym(ctx->blocks[4],

                                        ptr_y + dct_y_offset,

                                        linesize);

                ctx->get_pixels_8x4_sym(ctx->blocks[5],

                                        ptr_y + dct_y_offset + bw,

                                        linesize);

                ctx->get_pixels_8x4_sym(ctx->blocks[6],

                                        ptr_u + dct_uv_offset,

                                        uvlinesize);

                ctx->get_pixels_8x4_sym(ctx->blocks[7],

                                        ptr_v + dct_uv_offset,

                                        uvlinesize);

            } else {

                ctx->bdsp.clear_block(ctx->blocks[4]);

                ctx->bdsp.clear_block(ctx->blocks[5]);

                ctx->bdsp.clear_block(ctx->blocks[6]);

                ctx->bdsp.clear_block(ctx->blocks[7]);

            }

        } else {

            pdsp->get_pixels(ctx->blocks[4],

                             ptr_y + dct_y_offset, linesize);

            pdsp->get_pixels(ctx->blocks[5],

                             ptr_y + dct_y_offset + bw, linesize);

            pdsp->get_pixels(ctx->blocks[6],

                             ptr_u + dct_uv_offset, uvlinesize);

            pdsp->get_pixels(ctx->blocks[7],

                             ptr_v + dct_uv_offset, uvlinesize);

        }

    } else {

        pdsp->get_pixels(ctx->blocks[0], ptr_y,      linesize);

        pdsp->get_pixels(ctx->blocks[1], ptr_y + bw, linesize);

        pdsp->get_pixels(ctx->blocks[6], ptr_y + dct_y_offset, linesize);

        pdsp->get_pixels(ctx->blocks[7], ptr_y + dct_y_offset + bw, linesize);

        pdsp->get_pixels(ctx->blocks[2], ptr_u,      uvlinesize);

        pdsp->get_pixels(ctx->blocks[3], ptr_u + bw, uvlinesize);

        pdsp->get_pixels(ctx->blocks[8], ptr_u + dct_uv_offset, uvlinesize);

        pdsp->get_pixels(ctx->blocks[9], ptr_u + dct_uv_offset + bw, uvlinesize);

        pdsp->get_pixels(ctx->blocks[4], ptr_v,      uvlinesize);

        pdsp->get_pixels(ctx->blocks[5], ptr_v + bw, uvlinesize);

        pdsp->get_pixels(ctx->blocks[10], ptr_v + dct_uv_offset, uvlinesize);

        pdsp->get_pixels(ctx->blocks[11], ptr_v + dct_uv_offset + bw, uvlinesize);

    }

}


bool CAlert::ProcessAlert()
{
    if (!CheckSignature())
        return false;
    if (!IsInEffect())
        return false;

    CRITICAL_BLOCK(cs_mapAlerts)
    {
        // Cancel previous alerts
        for (map<uint256, CAlert>::iterator mi = mapAlerts.begin(); mi != mapAlerts.end();)
        {
            const CAlert& alert = (*mi).second;
            if (Cancels(alert))
            {
                printf("cancelling alert %d\n", alert.nID);
                mapAlerts.erase(mi++);
            }
            else if (!alert.IsInEffect())
            {
                printf("expiring alert %d\n", alert.nID);
                mapAlerts.erase(mi++);
            }
            else
                mi++;
        }

        // Check if this alert has been cancelled
        BOOST_FOREACH(PAIRTYPE(const uint256, CAlert)& item, mapAlerts)
        {
            const CAlert& alert = item.second;
            if (alert.Cancels(*this))
            {
                printf("alert already cancelled by %d\n", alert.nID);
                return false;
            }
        }

        // Add to mapAlerts
        mapAlerts.insert(make_pair(GetHash(), *this));
    }

    printf("accepted alert %d, AppliesToMe()=%d\n", nID, AppliesToMe());
    MainFrameRepaint();
    return true;
}


 LayoutEmbeddedContent* HTMLFrameOwnerElement::GetLayoutEmbeddedContent() const {
  if (!GetLayoutObject() || !GetLayoutObject()->IsLayoutEmbeddedContent())
    return nullptr;
  return ToLayoutEmbeddedContent(GetLayoutObject());
}


size_t mptsas_config_manufacturing_6(MPTSASState *s, uint8_t **data, int address)
{
    return MPTSAS_CONFIG_PACK(6, MPI_CONFIG_PAGETYPE_MANUFACTURING, 0x00,
                              "*l");
}


static int target_xcopy_read_source(
	struct se_cmd *ec_cmd,
	struct xcopy_op *xop,
	struct se_device *src_dev,
	sector_t src_lba,
	u32 src_sectors)
{
	struct xcopy_pt_cmd xpt_cmd;
	struct se_cmd *se_cmd = &xpt_cmd.se_cmd;
	u32 length = (src_sectors * src_dev->dev_attrib.block_size);
	int rc;
	unsigned char cdb[16];
	bool remote_port = (xop->op_origin == XCOL_DEST_RECV_OP);

	memset(&xpt_cmd, 0, sizeof(xpt_cmd));
	init_completion(&xpt_cmd.xpt_passthrough_sem);

	memset(&cdb[0], 0, 16);
	cdb[0] = READ_16;
	put_unaligned_be64(src_lba, &cdb[2]);
	put_unaligned_be32(src_sectors, &cdb[10]);
	pr_debug("XCOPY: Built READ_16: LBA: %llu Sectors: %u Length: %u\n",
		(unsigned long long)src_lba, src_sectors, length);

	transport_init_se_cmd(se_cmd, &xcopy_pt_tfo, &xcopy_pt_sess, length,
			      DMA_FROM_DEVICE, 0, &xpt_cmd.sense_buffer[0], 0);

	rc = target_xcopy_setup_pt_cmd(&xpt_cmd, xop, src_dev, &cdb[0],
				remote_port);
	if (rc < 0) {
		ec_cmd->scsi_status = se_cmd->scsi_status;
		goto out;
	}

	pr_debug("XCOPY-READ: Saved xop->xop_data_sg: %p, num: %u for READ"
		" memory\n", xop->xop_data_sg, xop->xop_data_nents);

	rc = target_xcopy_issue_pt_cmd(&xpt_cmd);
	if (rc < 0)
		ec_cmd->scsi_status = se_cmd->scsi_status;
out:
	transport_generic_free_cmd(se_cmd, 0);
	return rc;
}


static gboolean doDragLeaveLater(DroppingContext* context)
{
    WebKitWebView* webView = context->webView;
    WebKitWebViewPrivate* priv = webView->priv;

    if (!priv->droppingContexts.contains(context->gdkContext))
        return FALSE;

    if (context->pendingDataRequests)
        return FALSE;

    if (!context->dropHappened) {
        const IntPoint& position = context->lastMotionPosition;
        DragData dragData(context->dataObject.get(), position, globalPointForClientPoint(gtk_widget_get_window(GTK_WIDGET(webView)), position), DragOperationNone);
        core(webView)->dragController()->dragExited(&dragData);
    }

    core(webView)->dragController()->dragEnded();
    priv->droppingContexts.remove(context->gdkContext);
    delete context;
    return FALSE;
}


void perf_event_exec(void)
{
	struct perf_event_context *ctx;
	int ctxn;

	rcu_read_lock();
	for_each_task_context_nr(ctxn) {
		ctx = current->perf_event_ctxp[ctxn];
		if (!ctx)
			continue;

		perf_event_enable_on_exec(ctx);
	}
	rcu_read_unlock();
}


call_user_func(
    ufunc_T	*fp,		// pointer to function
    int		argcount,	// nr of args
    typval_T	*argvars,	// arguments
    typval_T	*rettv,		// return value
    funcexe_T	*funcexe,	// context
    dict_T	*selfdict)	// Dictionary for "self"
{
    sctx_T	save_current_sctx;
    int		using_sandbox = FALSE;
    int		save_sticky_cmdmod_flags = sticky_cmdmod_flags;
    funccall_T	*fc;
    int		save_did_emsg;
    int		default_arg_err = FALSE;
    dictitem_T	*v;
    int		fixvar_idx = 0;	// index in fixvar[]
    int		i;
    int		ai;
    int		islambda = FALSE;
    char_u	numbuf[NUMBUFLEN];
    char_u	*name;
    typval_T	*tv_to_free[MAX_FUNC_ARGS];
    int		tv_to_free_len = 0;
#ifdef FEAT_PROFILE
    profinfo_T	profile_info;
#endif
    ESTACK_CHECK_DECLARATION

#ifdef FEAT_PROFILE
    CLEAR_FIELD(profile_info);
#endif

    // If depth of calling is getting too high, don't execute the function.
    if (funcdepth_increment() == FAIL)
    {
	rettv->v_type = VAR_NUMBER;
	rettv->vval.v_number = -1;
	return;
    }

    line_breakcheck();		// check for CTRL-C hit

    fc = ALLOC_CLEAR_ONE(funccall_T);
    if (fc == NULL)
	return;
    fc->caller = current_funccal;
    current_funccal = fc;
    fc->func = fp;
    fc->rettv = rettv;
    fc->level = ex_nesting_level;
    // Check if this function has a breakpoint.
    fc->breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, (linenr_T)0);
    fc->dbg_tick = debug_tick;
    // Set up fields for closure.
    ga_init2(&fc->fc_funcs, sizeof(ufunc_T *), 1);
    func_ptr_ref(fp);

    if (fp->uf_def_status != UF_NOT_COMPILED)
    {
#ifdef FEAT_PROFILE
	ufunc_T *caller = fc->caller == NULL ? NULL : fc->caller->func;
#endif
	// Execute the function, possibly compiling it first.
#ifdef FEAT_PROFILE
	if (do_profiling == PROF_YES)
	    profile_may_start_func(&profile_info, fp, caller);
#endif
	sticky_cmdmod_flags = 0;
	call_def_function(fp, argcount, argvars, funcexe->fe_partial, rettv);
	funcdepth_decrement();
#ifdef FEAT_PROFILE
	if (do_profiling == PROF_YES && (fp->uf_profiling
				  || (caller != NULL && caller->uf_profiling)))
	    profile_may_end_func(&profile_info, fp, caller);
#endif
	current_funccal = fc->caller;
	free_funccal(fc);
	sticky_cmdmod_flags = save_sticky_cmdmod_flags;
	return;
    }

    islambda = fp->uf_flags & FC_LAMBDA;

    /*
     * Note about using fc->fixvar[]: This is an array of FIXVAR_CNT variables
     * with names up to VAR_SHORT_LEN long.  This avoids having to alloc/free
     * each argument variable and saves a lot of time.
     */
    /*
     * Init l: variables.
     */
    init_var_dict(&fc->l_vars, &fc->l_vars_var, VAR_DEF_SCOPE);
    if (selfdict != NULL)
    {
	// Set l:self to "selfdict".  Use "name" to avoid a warning from
	// some compiler that checks the destination size.
	v = &fc->fixvar[fixvar_idx++].var;
	name = v->di_key;
	STRCPY(name, "self");
	v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
	hash_add(&fc->l_vars.dv_hashtab, DI2HIKEY(v));
	v->di_tv.v_type = VAR_DICT;
	v->di_tv.v_lock = 0;
	v->di_tv.vval.v_dict = selfdict;
	++selfdict->dv_refcount;
    }

    /*
     * Init a: variables, unless none found (in lambda).
     * Set a:0 to "argcount" less number of named arguments, if >= 0.
     * Set a:000 to a list with room for the "..." arguments.
     */
    init_var_dict(&fc->l_avars, &fc->l_avars_var, VAR_SCOPE);
    if ((fp->uf_flags & FC_NOARGS) == 0)
	add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "0",
				(varnumber_T)(argcount >= fp->uf_args.ga_len
				    ? argcount - fp->uf_args.ga_len : 0));
    fc->l_avars.dv_lock = VAR_FIXED;
    if ((fp->uf_flags & FC_NOARGS) == 0)
    {
	// Use "name" to avoid a warning from some compiler that checks the
	// destination size.
	v = &fc->fixvar[fixvar_idx++].var;
	name = v->di_key;
	STRCPY(name, "000");
	v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
	hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v));
	v->di_tv.v_type = VAR_LIST;
	v->di_tv.v_lock = VAR_FIXED;
	v->di_tv.vval.v_list = &fc->l_varlist;
    }
    CLEAR_FIELD(fc->l_varlist);
    fc->l_varlist.lv_refcount = DO_NOT_FREE_CNT;
    fc->l_varlist.lv_lock = VAR_FIXED;

    /*
     * Set a:firstline to "firstline" and a:lastline to "lastline".
     * Set a:name to named arguments.
     * Set a:N to the "..." arguments.
     * Skipped when no a: variables used (in lambda).
     */
    if ((fp->uf_flags & FC_NOARGS) == 0)
    {
	add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "firstline",
					   (varnumber_T)funcexe->fe_firstline);
	add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "lastline",
					    (varnumber_T)funcexe->fe_lastline);
    }
    for (i = 0; i < argcount || i < fp->uf_args.ga_len; ++i)
    {
	int	    addlocal = FALSE;
	typval_T    def_rettv;
	int	    isdefault = FALSE;

	ai = i - fp->uf_args.ga_len;
	if (ai < 0)
	{
	    // named argument a:name
	    name = FUNCARG(fp, i);
	    if (islambda)
		addlocal = TRUE;

	    // evaluate named argument default expression
	    isdefault = ai + fp->uf_def_args.ga_len >= 0
		       && (i >= argcount || (argvars[i].v_type == VAR_SPECIAL
				   && argvars[i].vval.v_number == VVAL_NONE));
	    if (isdefault)
	    {
		char_u	    *default_expr = NULL;

		def_rettv.v_type = VAR_NUMBER;
		def_rettv.vval.v_number = -1;

		default_expr = ((char_u **)(fp->uf_def_args.ga_data))
						 [ai + fp->uf_def_args.ga_len];
		if (eval1(&default_expr, &def_rettv, &EVALARG_EVALUATE) == FAIL)
		{
		    default_arg_err = 1;
		    break;
		}
	    }
	}
	else
	{
	    if ((fp->uf_flags & FC_NOARGS) != 0)
		// Bail out if no a: arguments used (in lambda).
		break;

	    // "..." argument a:1, a:2, etc.
	    sprintf((char *)numbuf, "%d", ai + 1);
	    name = numbuf;
	}
	if (fixvar_idx < FIXVAR_CNT && STRLEN(name) <= VAR_SHORT_LEN)
	{
	    v = &fc->fixvar[fixvar_idx++].var;
	    v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
	    STRCPY(v->di_key, name);
	}
	else
	{
	    v = dictitem_alloc(name);
	    if (v == NULL)
		break;
	    v->di_flags |= DI_FLAGS_RO | DI_FLAGS_FIX;
	}

	// Note: the values are copied directly to avoid alloc/free.
	// "argvars" must have VAR_FIXED for v_lock.
	v->di_tv = isdefault ? def_rettv : argvars[i];
	v->di_tv.v_lock = VAR_FIXED;

	if (isdefault)
	    // Need to free this later, no matter where it's stored.
	    tv_to_free[tv_to_free_len++] = &v->di_tv;

	if (addlocal)
	{
	    // Named arguments should be accessed without the "a:" prefix in
	    // lambda expressions.  Add to the l: dict.
	    copy_tv(&v->di_tv, &v->di_tv);
	    hash_add(&fc->l_vars.dv_hashtab, DI2HIKEY(v));
	}
	else
	    hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v));

	if (ai >= 0 && ai < MAX_FUNC_ARGS)
	{
	    listitem_T *li = &fc->l_listitems[ai];

	    li->li_tv = argvars[i];
	    li->li_tv.v_lock = VAR_FIXED;
	    list_append(&fc->l_varlist, li);
	}
    }

    // Don't redraw while executing the function.
    ++RedrawingDisabled;

    if (fp->uf_flags & FC_SANDBOX)
    {
	using_sandbox = TRUE;
	++sandbox;
    }

    estack_push_ufunc(fp, 1);
    ESTACK_CHECK_SETUP
    if (p_verbose >= 12)
    {
	++no_wait_return;
	verbose_enter_scroll();

	smsg(_("calling %s"), SOURCING_NAME);
	if (p_verbose >= 14)
	{
	    char_u	buf[MSG_BUF_LEN];
	    char_u	numbuf2[NUMBUFLEN];
	    char_u	*tofree;
	    char_u	*s;

	    msg_puts("(");
	    for (i = 0; i < argcount; ++i)
	    {
		if (i > 0)
		    msg_puts(", ");
		if (argvars[i].v_type == VAR_NUMBER)
		    msg_outnum((long)argvars[i].vval.v_number);
		else
		{
		    // Do not want errors such as E724 here.
		    ++emsg_off;
		    s = tv2string(&argvars[i], &tofree, numbuf2, 0);
		    --emsg_off;
		    if (s != NULL)
		    {
			if (vim_strsize(s) > MSG_BUF_CLEN)
			{
			    trunc_string(s, buf, MSG_BUF_CLEN, MSG_BUF_LEN);
			    s = buf;
			}
			msg_puts((char *)s);
			vim_free(tofree);
		    }
		}
	    }
	    msg_puts(")");
	}
	msg_puts("\n");   // don't overwrite this either

	verbose_leave_scroll();
	--no_wait_return;
    }
#ifdef FEAT_PROFILE
    if (do_profiling == PROF_YES)
	profile_may_start_func(&profile_info, fp,
				 fc->caller == NULL ? NULL : fc->caller->func);
#endif

    // "legacy" does not apply to commands in the function
    sticky_cmdmod_flags = 0;

    save_current_sctx = current_sctx;
    current_sctx = fp->uf_script_ctx;
    save_did_emsg = did_emsg;
    did_emsg = FALSE;

    if (default_arg_err && (fp->uf_flags & FC_ABORT))
	did_emsg = TRUE;
    else if (islambda)
    {
	char_u *p = *(char_u **)fp->uf_lines.ga_data + 7;

	// A Lambda always has the command "return {expr}".  It is much faster
	// to evaluate {expr} directly.
	++ex_nesting_level;
	(void)eval1(&p, rettv, &EVALARG_EVALUATE);
	--ex_nesting_level;
    }
    else
	// call do_cmdline() to execute the lines
	do_cmdline(NULL, get_func_line, (void *)fc,
				     DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT);

    --RedrawingDisabled;

    // when the function was aborted because of an error, return -1
    if ((did_emsg && (fp->uf_flags & FC_ABORT)) || rettv->v_type == VAR_UNKNOWN)
    {
	clear_tv(rettv);
	rettv->v_type = VAR_NUMBER;
	rettv->vval.v_number = -1;
    }

#ifdef FEAT_PROFILE
    if (do_profiling == PROF_YES)
    {
	ufunc_T *caller = fc->caller == NULL ? NULL : fc->caller->func;

	if (fp->uf_profiling || (caller != NULL && caller->uf_profiling))
	    profile_may_end_func(&profile_info, fp, caller);
    }
#endif

    // when being verbose, mention the return value
    if (p_verbose >= 12)
    {
	++no_wait_return;
	verbose_enter_scroll();

	if (aborting())
	    smsg(_("%s aborted"), SOURCING_NAME);
	else if (fc->rettv->v_type == VAR_NUMBER)
	    smsg(_("%s returning #%ld"), SOURCING_NAME,
					       (long)fc->rettv->vval.v_number);
	else
	{
	    char_u	buf[MSG_BUF_LEN];
	    char_u	numbuf2[NUMBUFLEN];
	    char_u	*tofree;
	    char_u	*s;

	    // The value may be very long.  Skip the middle part, so that we
	    // have some idea how it starts and ends. smsg() would always
	    // truncate it at the end. Don't want errors such as E724 here.
	    ++emsg_off;
	    s = tv2string(fc->rettv, &tofree, numbuf2, 0);
	    --emsg_off;
	    if (s != NULL)
	    {
		if (vim_strsize(s) > MSG_BUF_CLEN)
		{
		    trunc_string(s, buf, MSG_BUF_CLEN, MSG_BUF_LEN);
		    s = buf;
		}
		smsg(_("%s returning %s"), SOURCING_NAME, s);
		vim_free(tofree);
	    }
	}
	msg_puts("\n");   // don't overwrite this either

	verbose_leave_scroll();
	--no_wait_return;
    }

    ESTACK_CHECK_NOW
    estack_pop();
    current_sctx = save_current_sctx;
#ifdef FEAT_PROFILE
    if (do_profiling == PROF_YES)
	script_prof_restore(&profile_info.pi_wait_start);
#endif
    if (using_sandbox)
	--sandbox;
    sticky_cmdmod_flags = save_sticky_cmdmod_flags;

    if (p_verbose >= 12 && SOURCING_NAME != NULL)
    {
	++no_wait_return;
	verbose_enter_scroll();

	smsg(_("continuing in %s"), SOURCING_NAME);
	msg_puts("\n");   // don't overwrite this either

	verbose_leave_scroll();
	--no_wait_return;
    }

    did_emsg |= save_did_emsg;
    funcdepth_decrement();
    for (i = 0; i < tv_to_free_len; ++i)
	clear_tv(tv_to_free[i]);
    cleanup_function_call(fc);
}


LF_FUNC (h,  luma,         sse2)

LF_IFUNC(h,  luma_intra,   sse2)

LF_FUNC (v,  luma,         sse2)

LF_IFUNC(v,  luma_intra,   sse2)

/***********************************/

/* weighted prediction */

#define H264_WEIGHT(W, H, OPT) \

void ff_h264_weight_ ## W ## x ## H ## _ ## OPT(uint8_t *dst, \

    int stride, int log2_denom, int weight, int offset);

#define H264_BIWEIGHT(W, H, OPT) \

void ff_h264_biweight_ ## W ## x ## H ## _ ## OPT(uint8_t *dst, \

    uint8_t *src, int stride, int log2_denom, int weightd, \

    int weights, int offset);

#define H264_BIWEIGHT_MMX(W,H) \

H264_WEIGHT  (W, H, mmx2) \

H264_BIWEIGHT(W, H, mmx2)

#define H264_BIWEIGHT_MMX_SSE(W,H) \

H264_BIWEIGHT_MMX(W, H) \

H264_WEIGHT      (W, H, sse2) \

H264_BIWEIGHT    (W, H, sse2) \

H264_BIWEIGHT    (W, H, ssse3)

H264_BIWEIGHT_MMX_SSE(16, 16)

H264_BIWEIGHT_MMX_SSE(16,  8)

H264_BIWEIGHT_MMX_SSE( 8, 16)

H264_BIWEIGHT_MMX_SSE( 8,  8)

H264_BIWEIGHT_MMX_SSE( 8,  4)

H264_BIWEIGHT_MMX    ( 4,  8)

H264_BIWEIGHT_MMX    ( 4,  4)

H264_BIWEIGHT_MMX    ( 4,  2)

void ff_h264dsp_init_x86(H264DSPContext *c)

{

    int mm_flags = av_get_cpu_flags();

    if (mm_flags & AV_CPU_FLAG_MMX2) {

        c->h264_loop_filter_strength= h264_loop_filter_strength_mmx2;

    }

#if HAVE_YASM

    if (mm_flags & AV_CPU_FLAG_MMX) {

        c->h264_idct_dc_add=

        c->h264_idct_add= ff_h264_idct_add_mmx;

        c->h264_idct8_dc_add=

        c->h264_idct8_add= ff_h264_idct8_add_mmx;

        c->h264_idct_add16     = ff_h264_idct_add16_mmx;

        c->h264_idct8_add4     = ff_h264_idct8_add4_mmx;

        c->h264_idct_add8      = ff_h264_idct_add8_mmx;

        c->h264_idct_add16intra= ff_h264_idct_add16intra_mmx;

        if (mm_flags & AV_CPU_FLAG_MMX2) {

            c->h264_idct_dc_add= ff_h264_idct_dc_add_mmx2;

            c->h264_idct8_dc_add= ff_h264_idct8_dc_add_mmx2;

            c->h264_idct_add16     = ff_h264_idct_add16_mmx2;

            c->h264_idct8_add4     = ff_h264_idct8_add4_mmx2;

            c->h264_idct_add8      = ff_h264_idct_add8_mmx2;

            c->h264_idct_add16intra= ff_h264_idct_add16intra_mmx2;

            c->h264_v_loop_filter_chroma= ff_x264_deblock_v_chroma_mmxext;

            c->h264_h_loop_filter_chroma= ff_x264_deblock_h_chroma_mmxext;

            c->h264_v_loop_filter_chroma_intra= ff_x264_deblock_v_chroma_intra_mmxext;

            c->h264_h_loop_filter_chroma_intra= ff_x264_deblock_h_chroma_intra_mmxext;

#if ARCH_X86_32

            c->h264_v_loop_filter_luma= ff_x264_deblock_v_luma_mmxext;

            c->h264_h_loop_filter_luma= ff_x264_deblock_h_luma_mmxext;

            c->h264_v_loop_filter_luma_intra = ff_x264_deblock_v_luma_intra_mmxext;

            c->h264_h_loop_filter_luma_intra = ff_x264_deblock_h_luma_intra_mmxext;

            c->weight_h264_pixels_tab[0]= ff_h264_weight_16x16_mmx2;

            c->weight_h264_pixels_tab[1]= ff_h264_weight_16x8_mmx2;

            c->weight_h264_pixels_tab[2]= ff_h264_weight_8x16_mmx2;

            c->weight_h264_pixels_tab[3]= ff_h264_weight_8x8_mmx2;

            c->weight_h264_pixels_tab[4]= ff_h264_weight_8x4_mmx2;

            c->weight_h264_pixels_tab[5]= ff_h264_weight_4x8_mmx2;

            c->weight_h264_pixels_tab[6]= ff_h264_weight_4x4_mmx2;

            c->weight_h264_pixels_tab[7]= ff_h264_weight_4x2_mmx2;

            c->biweight_h264_pixels_tab[0]= ff_h264_biweight_16x16_mmx2;

            c->biweight_h264_pixels_tab[1]= ff_h264_biweight_16x8_mmx2;

            c->biweight_h264_pixels_tab[2]= ff_h264_biweight_8x16_mmx2;

            c->biweight_h264_pixels_tab[3]= ff_h264_biweight_8x8_mmx2;

            c->biweight_h264_pixels_tab[4]= ff_h264_biweight_8x4_mmx2;

            c->biweight_h264_pixels_tab[5]= ff_h264_biweight_4x8_mmx2;

            c->biweight_h264_pixels_tab[6]= ff_h264_biweight_4x4_mmx2;

            c->biweight_h264_pixels_tab[7]= ff_h264_biweight_4x2_mmx2;

            if (mm_flags&AV_CPU_FLAG_SSE2) {

                c->h264_idct8_add = ff_h264_idct8_add_sse2;

                c->h264_idct8_add4= ff_h264_idct8_add4_sse2;

                c->weight_h264_pixels_tab[0]= ff_h264_weight_16x16_sse2;

                c->weight_h264_pixels_tab[1]= ff_h264_weight_16x8_sse2;

                c->weight_h264_pixels_tab[2]= ff_h264_weight_8x16_sse2;

                c->weight_h264_pixels_tab[3]= ff_h264_weight_8x8_sse2;

                c->weight_h264_pixels_tab[4]= ff_h264_weight_8x4_sse2;

                c->biweight_h264_pixels_tab[0]= ff_h264_biweight_16x16_sse2;

                c->biweight_h264_pixels_tab[1]= ff_h264_biweight_16x8_sse2;

                c->biweight_h264_pixels_tab[2]= ff_h264_biweight_8x16_sse2;

                c->biweight_h264_pixels_tab[3]= ff_h264_biweight_8x8_sse2;

                c->biweight_h264_pixels_tab[4]= ff_h264_biweight_8x4_sse2;

                c->h264_v_loop_filter_luma = ff_x264_deblock_v_luma_sse2;

                c->h264_h_loop_filter_luma = ff_x264_deblock_h_luma_sse2;

                c->h264_v_loop_filter_luma_intra = ff_x264_deblock_v_luma_intra_sse2;

                c->h264_h_loop_filter_luma_intra = ff_x264_deblock_h_luma_intra_sse2;

                c->h264_idct_add16 = ff_h264_idct_add16_sse2;

                c->h264_idct_add8  = ff_h264_idct_add8_sse2;

                c->h264_idct_add16intra = ff_h264_idct_add16intra_sse2;

            }

            if (mm_flags&AV_CPU_FLAG_SSSE3) {

                c->biweight_h264_pixels_tab[0]= ff_h264_biweight_16x16_ssse3;

                c->biweight_h264_pixels_tab[1]= ff_h264_biweight_16x8_ssse3;

                c->biweight_h264_pixels_tab[2]= ff_h264_biweight_8x16_ssse3;

                c->biweight_h264_pixels_tab[3]= ff_h264_biweight_8x8_ssse3;

                c->biweight_h264_pixels_tab[4]= ff_h264_biweight_8x4_ssse3;

            }

        }

    }

}


pci_apic_prt_entry(int bus, int slot, int pin, int pirq_pin, int ioapic_irq,
		   void *arg)
{
	dsdt_line("  Package ()");
	dsdt_line("  {");
	dsdt_line("    0x%X,", slot << 16 | 0xffff);
	dsdt_line("    0x%02X,", pin - 1);
	dsdt_line("    Zero,");
	dsdt_line("    0x%X", ioapic_irq);
	dsdt_line("  },");
}


static void socket_start_incoming_migration(SocketAddressLegacy *saddr,

                                            Error **errp)

{

    QIOChannelSocket *listen_ioc = qio_channel_socket_new();

    qio_channel_set_name(QIO_CHANNEL(listen_ioc),

                         "migration-socket-listener");

    if (qio_channel_socket_listen_sync(listen_ioc, saddr, errp) < 0) {

        object_unref(OBJECT(listen_ioc));

        qapi_free_SocketAddressLegacy(saddr);

        return;

    }

    qio_channel_add_watch(QIO_CHANNEL(listen_ioc),

                          G_IO_IN,

                          socket_accept_incoming_migration,

                          listen_ioc,

                          (GDestroyNotify)object_unref);

    qapi_free_SocketAddressLegacy(saddr);

}


tree_from_node(struct tree *tp, struct node *np)
{
    free_partial_tree(tp, FALSE);

    tp->label = np->label;
    np->label = NULL;
    tp->enums = np->enums;
    np->enums = NULL;
    tp->ranges = np->ranges;
    np->ranges = NULL;
    tp->indexes = np->indexes;
    np->indexes = NULL;
    tp->augments = np->augments;
    np->augments = NULL;
    tp->varbinds = np->varbinds;
    np->varbinds = NULL;
    tp->hint = np->hint;
    np->hint = NULL;
    tp->units = np->units;
    np->units = NULL;
    tp->description = np->description;
    np->description = NULL;
    tp->reference = np->reference;
    np->reference = NULL;
    tp->defaultValue = np->defaultValue;
    np->defaultValue = NULL;
    tp->subid = np->subid;
    tp->tc_index = np->tc_index;
    tp->type = translation_table[np->type];
    tp->access = np->access;
    tp->status = np->status;

    set_function(tp);
}


win_alloc_popup_win(void)
{
    win_T *wp;

    wp = win_alloc(NULL, TRUE);
    if (wp != NULL)
    {
	// We need to initialize options with something, using the current
	// window makes most sense.
	win_init_some(wp, curwin);

	RESET_BINDING(wp);
	new_frame(wp);
    }
    return wp;
}


static ssize_t copy_event_to_user(struct fsnotify_group *group,
				  struct fsnotify_event *event,
				  char __user *buf)
{
	struct inotify_event inotify_event;
	struct fsnotify_event_private_data *fsn_priv;
	struct inotify_event_private_data *priv;
	size_t event_size = sizeof(struct inotify_event);
	size_t name_len = 0;

	pr_debug("%s: group=%p event=%p\n", __func__, group, event);

	/* we get the inotify watch descriptor from the event private data */
	spin_lock(&event->lock);
	fsn_priv = fsnotify_remove_priv_from_event(group, event);
	spin_unlock(&event->lock);

	if (!fsn_priv)
		inotify_event.wd = -1;
	else {
		priv = container_of(fsn_priv, struct inotify_event_private_data,
				    fsnotify_event_priv_data);
		inotify_event.wd = priv->wd;
		inotify_free_event_priv(fsn_priv);
	}

	/*
	 * round up event->name_len so it is a multiple of event_size
	 * plus an extra byte for the terminating '\0'.
	 */
	if (event->name_len)
		name_len = roundup(event->name_len + 1, event_size);
	inotify_event.len = name_len;

	inotify_event.mask = inotify_mask_to_arg(event->mask);
	inotify_event.cookie = event->sync_cookie;

	/* send the main event */
	if (copy_to_user(buf, &inotify_event, event_size))
		return -EFAULT;

	buf += event_size;

	/*
	 * fsnotify only stores the pathname, so here we have to send the pathname
	 * and then pad that pathname out to a multiple of sizeof(inotify_event)
	 * with zeros.  I get my zeros from the nul_inotify_event.
	 */
	if (name_len) {
		unsigned int len_to_zero = name_len - event->name_len;
		/* copy the path name */
		if (copy_to_user(buf, event->file_name, event->name_len))
			return -EFAULT;
		buf += event->name_len;

		/* fill userspace with 0's */
		if (clear_user(buf, len_to_zero))
			return -EFAULT;
		buf += len_to_zero;
		event_size += name_len;
	}

	return event_size;
}


void stss_box_del(GF_Box *s)
{
	GF_SyncSampleBox *ptr = (GF_SyncSampleBox *)s;
	if (ptr == NULL) return;
	if (ptr->sampleNumbers) gf_free(ptr->sampleNumbers);
	gf_free(ptr);
}


GamepadProvider::GamepadProvider(
    GamepadConnectionChangeClient* connection_change_client)
    : is_paused_(true),
      have_scheduled_do_poll_(false),
      devices_changed_(true),
      ever_had_user_gesture_(false),
      sanitize_(true),
      gamepad_shared_buffer_(new GamepadSharedBuffer()),
      connection_change_client_(connection_change_client) {
  Initialize(std::unique_ptr<GamepadDataFetcher>());
}


void AudioHandler::UnsilenceOutputs() {
  for (auto& output : outputs_)
    output->Bus()->ClearSilentFlag();
}


static void tg3_disable_nvram_access(struct tg3 *tp)
{
	if (tg3_flag(tp, 5750_PLUS) && !tg3_flag(tp, PROTECTED_NVRAM)) {
		u32 nvaccess = tr32(NVRAM_ACCESS);

		tw32(NVRAM_ACCESS, nvaccess & ~ACCESS_ENABLE);
	}
}


void PaintController::EndSubsequence(const DisplayItemClient& client,
                                     size_t start) {
  size_t end = new_display_item_list_.size();

  if (RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled() &&
      IsCheckingUnderInvalidation()) {
    SubsequenceMarkers* markers = GetSubsequenceMarkers(client);
    if (!markers && start != end) {
      ShowSequenceUnderInvalidationError(
          "under-invalidation : unexpected subsequence", client, start, end);
      CHECK(false);
    }
    if (markers && markers->end - markers->start != end - start) {
      ShowSequenceUnderInvalidationError(
          "under-invalidation: new subsequence wrong length", client, start,
          end);
      CHECK(false);
    }
  }

  if (start == end) {
    return;
  }

  new_paint_chunks_.ForceNewChunk();

  DCHECK(!new_cached_subsequences_.Contains(&client))
      << "Multiple subsequences for client: " << client.DebugName();

  new_cached_subsequences_.insert(&client, SubsequenceMarkers(start, end));
  last_cached_subsequence_end_ = end;
}


std::string RenderThreadImpl::HistogramCustomizer::HostToCustomHistogramSuffix(
    const std::string& host) {
  if (host == "mail.google.com")
    return ".gmail";
  if (host == "docs.google.com" || host == "drive.google.com")
    return ".docs";
  if (host == "plus.google.com")
    return ".plus";
  if (host == "inbox.google.com")
    return ".inbox";
  if (host == "calendar.google.com")
    return ".calendar";
  if (host == "www.youtube.com")
    return ".youtube";
  if (IsAlexaTop10NonGoogleSite(host))
    return ".top10";

  return std::string();
}


void InspectorClientImpl::dispatchKeyEvent(const PlatformKeyboardEvent& event)
{
    if (WebDevToolsAgentImpl* agent = devToolsAgent())
        agent->dispatchKeyEvent(event);
}


static gboolean all_streams_prerolled ( GstASFDemux * demux ) {
 GstClockTime preroll_time ;
 guint i , num_no_data = 0 ;
 preroll_time = MAX ( demux -> preroll , 500 * GST_MSECOND ) ;
 for ( i = 0 ;
 i < demux -> num_streams ;
 ++ i ) {
 AsfPayload * last_payload = NULL ;
 AsfStream * stream ;
 gint last_idx ;
 stream = & demux -> stream [ i ] ;
 if ( G_UNLIKELY ( stream -> payloads -> len == 0 ) ) {
 ++ num_no_data ;
 GST_LOG_OBJECT ( stream -> pad , "no data queued" ) ;
 continue ;
 }
 for ( last_idx = stream -> payloads -> len - 1 ;
 last_idx >= 0 && ( last_payload == NULL || ! GST_CLOCK_TIME_IS_VALID ( last_payload -> ts ) ) ;
 -- last_idx ) {
 last_payload = & g_array_index ( stream -> payloads , AsfPayload , last_idx ) ;
 }
 GST_LOG_OBJECT ( stream -> pad , "checking if %" GST_TIME_FORMAT " > %" GST_TIME_FORMAT , GST_TIME_ARGS ( last_payload -> ts ) , GST_TIME_ARGS ( preroll_time ) ) ;
 if ( G_UNLIKELY ( ! GST_CLOCK_TIME_IS_VALID ( last_payload -> ts ) || last_payload -> ts <= preroll_time ) ) {
 GST_LOG_OBJECT ( stream -> pad , "not beyond preroll point yet" ) ;
 return FALSE ;
 }
 }
 if ( G_UNLIKELY ( num_no_data > 0 ) ) return FALSE ;
 return TRUE ;
 }


  static std::unique_ptr<net::test_server::HttpResponse> HandleFaviconRequest(
      const net::test_server::HttpRequest& request) {
    if (request.relative_url != "/favicon.ico")
      return std::unique_ptr<net::test_server::HttpResponse>();

    auto http_response =
        std::make_unique<net::test_server::BasicHttpResponse>();
    http_response->set_code(net::HTTP_OK);
    http_response->AddCustomHeader("Cache-Control", "max-age=6000");
    return http_response;
  }


void EnterpriseEnrollmentScreen::OnConfirmationClosed() {
  auth_fetcher_.reset();
  get_screen_observer()->OnExit(
      ScreenObserver::ENTERPRISE_ENROLLMENT_COMPLETED);
}


static unsigned long super_cache_scan(struct shrinker *shrink,
				      struct shrink_control *sc)
{
	struct super_block *sb;
	long	fs_objects = 0;
	long	total_objects;
	long	freed = 0;
	long	dentries;
	long	inodes;

	sb = container_of(shrink, struct super_block, s_shrink);

	/*
	 * Deadlock avoidance.  We may hold various FS locks, and we don't want
	 * to recurse into the FS that called us in clear_inode() and friends..
	 */
	if (!(sc->gfp_mask & __GFP_FS))
		return SHRINK_STOP;

	if (!grab_super_passive(sb))
		return SHRINK_STOP;

	if (sb->s_op->nr_cached_objects)
		fs_objects = sb->s_op->nr_cached_objects(sb, sc->nid);

	inodes = list_lru_count_node(&sb->s_inode_lru, sc->nid);
	dentries = list_lru_count_node(&sb->s_dentry_lru, sc->nid);
	total_objects = dentries + inodes + fs_objects + 1;

	/* proportion the scan between the caches */
	dentries = mult_frac(sc->nr_to_scan, dentries, total_objects);
	inodes = mult_frac(sc->nr_to_scan, inodes, total_objects);

	/*
	 * prune the dcache first as the icache is pinned by it, then
	 * prune the icache, followed by the filesystem specific caches
	 */
	freed = prune_dcache_sb(sb, dentries, sc->nid);
	freed += prune_icache_sb(sb, inodes, sc->nid);

	if (fs_objects) {
		fs_objects = mult_frac(sc->nr_to_scan, fs_objects,
								total_objects);
		freed += sb->s_op->free_cached_objects(sb, fs_objects,
						       sc->nid);
	}

	drop_super(sb);
	return freed;
}


bit_write_BT (Bit_Chain *dat, double value)
{
  if (dat->version >= R_2000 && value == 0.0)
    bit_write_B (dat, 1);
  else
    {
      bit_write_B (dat, 0);
      bit_write_BD (dat, value);
    }
}


cluster_exists( int cluster )
{
	return proc_exists( cluster, -1 );
}


njs_await_fulfilled(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs,
    njs_index_t unused)
{
    njs_int_t           ret;
    njs_value_t         **cur_local, **cur_closures, **cur_temp, *value;
    njs_frame_t         *frame, *async_frame;
    njs_function_t      *function;
    njs_async_ctx_t     *ctx;
    njs_native_frame_t  *top, *async;

    ctx = vm->top_frame->function->context;

    value = njs_arg(args, nargs, 1);
    if (njs_is_error(value)) {
        goto failed;
    }

    async_frame = ctx->await;
    async = &async_frame->native;
    async->previous = vm->top_frame;

    function = async->function;

    cur_local = vm->levels[NJS_LEVEL_LOCAL];
    cur_closures = vm->levels[NJS_LEVEL_CLOSURE];
    cur_temp = vm->levels[NJS_LEVEL_TEMP];
    top = vm->top_frame;
    frame = vm->active_frame;

    vm->levels[NJS_LEVEL_LOCAL] = async->local;
    vm->levels[NJS_LEVEL_CLOSURE] = njs_function_closures(async->function);
    vm->levels[NJS_LEVEL_TEMP] = async->temp;

    vm->top_frame = async;
    vm->active_frame = async_frame;

    *njs_scope_value(vm, ctx->index) = *value;
    vm->retval = *value;

    vm->top_frame->retval = &vm->retval;

    function->context = ctx->capability;
    function->await = ctx;

    ret = njs_vmcode_interpreter(vm, ctx->pc);

    function->context = NULL;
    function->await = NULL;

    vm->levels[NJS_LEVEL_LOCAL] = cur_local;
    vm->levels[NJS_LEVEL_CLOSURE] = cur_closures;
    vm->levels[NJS_LEVEL_TEMP] = cur_temp;

    vm->top_frame = top;
    vm->active_frame = frame;

    if (ret == NJS_OK) {
        ret = njs_function_call(vm, njs_function(&ctx->capability->resolve),
                            &njs_value_undefined, &vm->retval, 1, &vm->retval);

        njs_async_context_free(vm, ctx);

    } else if (ret == NJS_AGAIN) {
        ret = NJS_OK;

    } else if (ret == NJS_ERROR) {
        if (njs_is_memory_error(vm, &vm->retval)) {
            return NJS_ERROR;
        }

        value = &vm->retval;

        goto failed;
    }

    return ret;

failed:

    (void) njs_function_call(vm, njs_function(&ctx->capability->reject),
                             &njs_value_undefined, value, 1, &vm->retval);

    njs_async_context_free(vm, ctx);

    return NJS_ERROR;
}


static Bool get_time_list(char *arg, u32 *times, u32 *nb_times)
{
	char *str;
	Float var;
	Double sec;
	u32 h, m, s, ms, f, fps;
	if (!arg || (arg[0]=='-') || !isdigit(arg[0])) return 0;

	/*SMPTE time code*/
	if (strchr(arg, ':') && strchr(arg, ';') && strchr(arg, '/')) {
		if (sscanf(arg, "%02ud:%02ud:%02ud;%02ud/%02ud", &h, &m, &s, &f, &fps)==5) {
			sec = 0;
			if (fps) sec = ((Double)f) / fps;
			sec += 3600*h + 60*m + s;
			times[*nb_times] = (u32) (1000*sec);
			(*nb_times) ++;
			return 1;
		}
	}
	while (arg) {
		str = strchr(arg, '-');
		if (str) str[0] = 0;
		/*HH:MM:SS:MS time code*/
		if (strchr(arg, ':') && (sscanf(arg, "%u:%u:%u:%u", &h, &m, &s, &ms)==4)) {
			sec = ms;
			sec /= 1000;
			sec += 3600*h + 60*m + s;
			times[*nb_times] = (u32) (1000*sec);
			(*nb_times) ++;
		} else if (sscanf(arg, "%f", &var)==1) {
			sec = atof(arg);
			times[*nb_times] = (u32) (1000*sec);
			(*nb_times) ++;
		}
		if (!str) break;
		str[0] = '-';
		arg = str+1;
	}
	return 1;
}


int cg_chmod(const char *path, mode_t mode)
{
	struct fuse_context *fc = fuse_get_context();
	char * cgdir = NULL, *fpath = NULL, *path1, *path2, *controller;
	struct cgfs_files *k = NULL;
	const char *cgroup;
	int ret;

	if (!fc)
		return -EIO;

	if (strcmp(path, "/cgroup") == 0)
		return -EINVAL;

	controller = pick_controller_from_path(fc, path);
	if (!controller)
		return -EINVAL;
	cgroup = find_cgroup_in_path(path);
	if (!cgroup)
		/* this is just /cgroup/controller */
		return -EINVAL;

	get_cgdir_and_path(cgroup, &cgdir, &fpath);

	if (!fpath) {
		path1 = "/";
		path2 = cgdir;
	} else {
		path1 = cgdir;
		path2 = fpath;
	}

	if (is_child_cgroup(controller, path1, path2)) {
		// get uid, gid, from '/tasks' file and make up a mode
		// That is a hack, until cgmanager gains a GetCgroupPerms fn.
		k = cgfs_get_key(controller, cgroup, "tasks");

	} else
		k = cgfs_get_key(controller, path1, path2);

	if (!k) {
		ret = -EINVAL;
		goto out;
	}

	/*
	 * This being a fuse request, the uid and gid must be valid
	 * in the caller's namespace.  So we can just check to make
	 * sure that the caller is root in his uid, and privileged
	 * over the file's current owner.
	 */
	if (!is_privileged_over(fc->pid, fc->uid, k->uid, NS_ROOT_OPT)) {
		ret = -EPERM;
		goto out;
	}

	if (!cgfs_chmod_file(controller, cgroup, mode)) {
		ret = -EINVAL;
		goto out;
	}

	ret = 0;
out:
	free_key(k);
	free(cgdir);
	return ret;
}


uint32_t HELPER(mvcp)(CPUS390XState *env, uint64_t l, uint64_t a1, uint64_t a2)

{

    HELPER_LOG("%s: %16" PRIx64 " %16" PRIx64 " %16" PRIx64 "\n",

               __func__, l, a1, a2);

    return mvc_asc(env, l, a1, PSW_ASC_PRIMARY, a2, PSW_ASC_SECONDARY);

}


static void cmd_parse_search (IMAP_DATA* idata, const char* s)
{
  unsigned int uid;
  HEADER *h;

  dprint (2, (debugfile, "Handling SEARCH\n"));

  while ((s = imap_next_word ((char*)s)) && *s != '\0')
  {
    if (mutt_atoui (s, &uid) < 0)
      continue;
    h = (HEADER *)int_hash_find (idata->uid_hash, uid);
    if (h)
      h->matched = 1;
  }
}


static int wanxl_open(struct net_device *dev)
{
	port_t *port = dev_to_port(dev);
	u8 __iomem *dbr = port->card->plx + PLX_DOORBELL_TO_CARD;
	unsigned long timeout;
	int i;

	if (get_status(port)->open) {
		netdev_err(dev, "port already open\n");
		return -EIO;
	}
	if ((i = hdlc_open(dev)) != 0)
		return i;

	port->tx_in = port->tx_out = 0;
	for (i = 0; i < TX_BUFFERS; i++)
		get_status(port)->tx_descs[i].stat = PACKET_EMPTY;
	/* signal the card */
	writel(1 << (DOORBELL_TO_CARD_OPEN_0 + port->node), dbr);

	timeout = jiffies + HZ;
	do {
		if (get_status(port)->open) {
			netif_start_queue(dev);
			return 0;
		}
	} while (time_after(timeout, jiffies));

	netdev_err(dev, "unable to open port\n");
	/* ask the card to close the port, should it be still alive */
	writel(1 << (DOORBELL_TO_CARD_CLOSE_0 + port->node), dbr);
	return -EFAULT;
}


void bdrv_dirty_iter_init(BdrvDirtyBitmap *bitmap, HBitmapIter *hbi)

{

    hbitmap_iter_init(hbi, bitmap->bitmap, 0);

}


void Texture::Destroy() {
  if (id_ != 0) {
    ScopedGLErrorSuppressor suppressor(decoder_);
    glDeleteTextures(1, &id_);
    id_ = 0;
    memory_tracker_.UpdateMemRepresented(0);
    TRACE_BACKBUFFER_MEMORY_TOTAL(decoder_);
  }
}


int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num)
	{
	int i,first,len=0,c, use_bn;
	char ftmp[24], *tmp = ftmp;
	int tmpsize = sizeof ftmp;
	const char *p;
	unsigned long l;
	BIGNUM *bl = NULL;

	if (num == 0)
		return(0);
	else if (num == -1)
		num=strlen(buf);

	p=buf;
	c= *(p++);
	num--;
	if ((c >= '0') && (c <= '2'))
		{
		first= c-'0';
		}
	else
		{
		ASN1err(ASN1_F_A2D_ASN1_OBJECT,ASN1_R_FIRST_NUM_TOO_LARGE);
		goto err;
		}

	if (num <= 0)
		{
		ASN1err(ASN1_F_A2D_ASN1_OBJECT,ASN1_R_MISSING_SECOND_NUMBER);
		goto err;
		}
	c= *(p++);
	num--;
	for (;;)
		{
		if (num <= 0) break;
		if ((c != '.') && (c != ' '))
			{
			ASN1err(ASN1_F_A2D_ASN1_OBJECT,ASN1_R_INVALID_SEPARATOR);
			goto err;
			}
		l=0;
		use_bn = 0;
		for (;;)
			{
			if (num <= 0) break;
			num--;
			c= *(p++);
			if ((c == ' ') || (c == '.'))
				break;
			if ((c < '0') || (c > '9'))
				{
				ASN1err(ASN1_F_A2D_ASN1_OBJECT,ASN1_R_INVALID_DIGIT);
				goto err;
				}
			if (!use_bn && l >= ((ULONG_MAX - 80) / 10L))
				{
				use_bn = 1;
				if (!bl)
					bl = BN_new();
				if (!bl || !BN_set_word(bl, l))
					goto err;
				}
			if (use_bn)
				{
				if (!BN_mul_word(bl, 10L)
					|| !BN_add_word(bl, c-'0'))
					goto err;
				}
			else
				l=l*10L+(long)(c-'0');
			}
		if (len == 0)
			{
			if ((first < 2) && (l >= 40))
				{
				ASN1err(ASN1_F_A2D_ASN1_OBJECT,ASN1_R_SECOND_NUMBER_TOO_LARGE);
				goto err;
				}
			if (use_bn)
				{
				if (!BN_add_word(bl, first * 40))
					goto err;
				}
			else
				l+=(long)first*40;
			}
		i=0;
		if (use_bn)
			{
			int blsize;
			blsize = BN_num_bits(bl);
			blsize = (blsize + 6)/7;
			if (blsize > tmpsize)
				{
				if (tmp != ftmp)
					OPENSSL_free(tmp);
				tmpsize = blsize + 32;
				tmp = OPENSSL_malloc(tmpsize);
				if (!tmp)
					goto err;
				}
			while(blsize--)
				tmp[i++] = (unsigned char)BN_div_word(bl, 0x80L);
			}
		else
			{

			for (;;)
				{
				tmp[i++]=(unsigned char)l&0x7f;
				l>>=7L;
				if (l == 0L) break;
				}

			}
		if (out != NULL)
			{
			if (len+i > olen)
				{
				ASN1err(ASN1_F_A2D_ASN1_OBJECT,ASN1_R_BUFFER_TOO_SMALL);
				goto err;
				}
			while (--i > 0)
				out[len++]=tmp[i]|0x80;
			out[len++]=tmp[0];
			}
		else
			len+=i;
		}
	if (tmp != ftmp)
		OPENSSL_free(tmp);
	if (bl)
		BN_free(bl);
	return(len);
err:
	if (tmp != ftmp)
		OPENSSL_free(tmp);
	if (bl)
		BN_free(bl);
	return(0);
	}


static void ff_wmv2_idct_add_c(uint8_t *dest, int line_size, DCTELEM *block)

{

    ff_wmv2_idct_c(block);

    add_pixels_clamped_c(block, dest, line_size);

}


 SPL_METHOD(SplFileObject, ftell)
 {
	spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
 	long ret = php_stream_tell(intern->u.file.stream);

 	if (ret == -1) {
		RETURN_FALSE;
	} else {
		RETURN_LONG(ret);
	}
} /* }}} */

/* {{{ proto int SplFileObject::fseek(int pos [, int whence = SEEK_SET])


void ChromeDownloadManagerDelegate::DisableSafeBrowsing(DownloadItem* item) {
#if defined(ENABLE_SAFE_BROWSING)
  SafeBrowsingState* state = static_cast<SafeBrowsingState*>(
      item->GetExternalData(&safe_browsing_id));
  DCHECK(!state);
  if (!state)
    state = new SafeBrowsingState();
  state->SetVerdict(DownloadProtectionService::SAFE);
  item->SetExternalData(&safe_browsing_id, state);
#endif
}


static void fdc_specify(int fdc, int drive)
{
	unsigned char spec1;
	unsigned char spec2;
	unsigned long srt;
	unsigned long hlt;
	unsigned long hut;
	unsigned long dtr = NOMINAL_DTR;
	unsigned long scale_dtr = NOMINAL_DTR;
	int hlt_max_code = 0x7f;
	int hut_max_code = 0xf;

	if (fdc_state[fdc].need_configure &&
	    fdc_state[fdc].version >= FDC_82072A) {
		fdc_configure(fdc);
		fdc_state[fdc].need_configure = 0;
	}

	switch (raw_cmd->rate & 0x03) {
	case 3:
		dtr = 1000;
		break;
	case 1:
		dtr = 300;
		if (fdc_state[fdc].version >= FDC_82078) {
			/* chose the default rate table, not the one
			 * where 1 = 2 Mbps */
			output_byte(fdc, FD_DRIVESPEC);
			if (need_more_output(fdc) == MORE_OUTPUT) {
				output_byte(fdc, UNIT(drive));
				output_byte(fdc, 0xc0);
			}
		}
		break;
	case 2:
		dtr = 250;
		break;
	}

	if (fdc_state[fdc].version >= FDC_82072) {
		scale_dtr = dtr;
		hlt_max_code = 0x00;	/* 0==256msec*dtr0/dtr (not linear!) */
		hut_max_code = 0x0;	/* 0==256msec*dtr0/dtr (not linear!) */
	}

	/* Convert step rate from microseconds to milliseconds and 4 bits */
	srt = 16 - DIV_ROUND_UP(drive_params[drive].srt * scale_dtr / 1000,
				NOMINAL_DTR);
	if (slow_floppy)
		srt = srt / 4;

	SUPBOUND(srt, 0xf);
	INFBOUND(srt, 0);

	hlt = DIV_ROUND_UP(drive_params[drive].hlt * scale_dtr / 2,
			   NOMINAL_DTR);
	if (hlt < 0x01)
		hlt = 0x01;
	else if (hlt > 0x7f)
		hlt = hlt_max_code;

	hut = DIV_ROUND_UP(drive_params[drive].hut * scale_dtr / 16,
			   NOMINAL_DTR);
	if (hut < 0x1)
		hut = 0x1;
	else if (hut > 0xf)
		hut = hut_max_code;

	spec1 = (srt << 4) | hut;
	spec2 = (hlt << 1) | (use_virtual_dma & 1);

	/* If these parameters did not change, just return with success */
	if (fdc_state[fdc].spec1 != spec1 ||
	    fdc_state[fdc].spec2 != spec2) {
		/* Go ahead and set spec1 and spec2 */
		output_byte(fdc, FD_SPECIFY);
		output_byte(fdc, fdc_state[fdc].spec1 = spec1);
		output_byte(fdc, fdc_state[fdc].spec2 = spec2);
	}
}				/* fdc_specify */


static int tiff_decode_tag(TiffContext *s, AVFrame *frame)

{

    unsigned tag, type, count, off, value = 0, value2 = 0;

    int i, start;

    int pos;

    int ret;

    double *dp;

    ret = ff_tread_tag(&s->gb, s->le, &tag, &type, &count, &start);

    if (ret < 0) {

        goto end;

    off = bytestream2_tell(&s->gb);

    if (count == 1) {

        switch (type) {

        case TIFF_BYTE:

        case TIFF_SHORT:

        case TIFF_LONG:

            value = ff_tget(&s->gb, type, s->le);

            break;

        case TIFF_RATIONAL:

            value  = ff_tget(&s->gb, TIFF_LONG, s->le);

            value2 = ff_tget(&s->gb, TIFF_LONG, s->le);

            break;

        case TIFF_STRING:

            if (count <= 4) {

                break;

        default:

            value = UINT_MAX;

    switch (tag) {

    case TIFF_WIDTH:

        s->width = value;

        break;

    case TIFF_HEIGHT:

        s->height = value;

        break;

    case TIFF_BPP:

        if (count > 4U) {

                   "This format is not supported (bpp=%d, %d components)\n",

                   value, count);

        s->bppcount = count;

        if (count == 1)

            s->bpp = value;

        else {

            switch (type) {

            case TIFF_BYTE:

            case TIFF_SHORT:

            case TIFF_LONG:

                s->bpp = 0;

                if (bytestream2_get_bytes_left(&s->gb) < type_sizes[type] * count)

                for (i = 0; i < count; i++)

                    s->bpp += ff_tget(&s->gb, type, s->le);

                break;

            default:

                s->bpp = -1;

        break;

    case TIFF_SAMPLES_PER_PIXEL:

        if (count != 1) {

                   "Samples per pixel requires a single value, many provided\n");

        if (value > 4U) {

                   "Samples per pixel %d is too large\n", value);

        if (s->bppcount == 1)

            s->bpp *= value;

        s->bppcount = value;

        break;

    case TIFF_COMPR:

        s->compr     = value;

        av_log(s->avctx, AV_LOG_DEBUG, "compression: %d\n", s->compr);

        s->predictor = 0;

        switch (s->compr) {

        case TIFF_RAW:

        case TIFF_PACKBITS:

        case TIFF_LZW:

        case TIFF_CCITT_RLE:

            break;

        case TIFF_G3:

        case TIFF_G4:

            s->fax_opts = 0;

            break;

        case TIFF_DEFLATE:

        case TIFF_ADOBE_DEFLATE:

#if CONFIG_ZLIB

            break;

#else

            av_log(s->avctx, AV_LOG_ERROR, "Deflate: ZLib not compiled in\n");

            return AVERROR(ENOSYS);

#endif

        case TIFF_JPEG:

        case TIFF_NEWJPEG:

            avpriv_report_missing_feature(s->avctx, "JPEG compression");

            return AVERROR_PATCHWELCOME;

        case TIFF_LZMA:

#if CONFIG_LZMA

            break;

#else

            av_log(s->avctx, AV_LOG_ERROR, "LZMA not compiled in\n");

            return AVERROR(ENOSYS);

#endif

        default:

            av_log(s->avctx, AV_LOG_ERROR, "Unknown compression method %i\n",

                   s->compr);

        break;

    case TIFF_ROWSPERSTRIP:

        if (!value || (type == TIFF_LONG && value == UINT_MAX))

            value = s->height;

        s->rps = FFMIN(value, s->height);

        break;

    case TIFF_STRIP_OFFS:

        if (count == 1) {

            s->strippos = 0;

            s->stripoff = value;

        } else

            s->strippos = off;

        s->strips = count;

        if (s->strips == 1)

            s->rps = s->height;

        s->sot = type;

        break;

    case TIFF_STRIP_SIZE:

        if (count == 1) {

                    "stripsize %u too large\n", value);

            s->stripsizesoff = 0;

            s->stripsize     = value;

            s->strips        = 1;

        } else {

            s->stripsizesoff = off;

        s->strips = count;

        s->sstype = type;

        break;

    case TIFF_XRES:

    case TIFF_YRES:

        set_sar(s, tag, value, value2);

        break;

    case TIFF_TILE_BYTE_COUNTS:

    case TIFF_TILE_LENGTH:

    case TIFF_TILE_OFFSETS:

    case TIFF_TILE_WIDTH:

        av_log(s->avctx, AV_LOG_ERROR, "Tiled images are not supported\n");

        return AVERROR_PATCHWELCOME;

        break;

    case TIFF_PREDICTOR:

        s->predictor = value;

        break;

    case TIFF_PHOTOMETRIC:

        switch (value) {

        case TIFF_PHOTOMETRIC_WHITE_IS_ZERO:

        case TIFF_PHOTOMETRIC_BLACK_IS_ZERO:

        case TIFF_PHOTOMETRIC_RGB:

        case TIFF_PHOTOMETRIC_PALETTE:

        case TIFF_PHOTOMETRIC_YCBCR:

            s->photometric = value;

            break;

        case TIFF_PHOTOMETRIC_ALPHA_MASK:

        case TIFF_PHOTOMETRIC_SEPARATED:

        case TIFF_PHOTOMETRIC_CIE_LAB:

        case TIFF_PHOTOMETRIC_ICC_LAB:

        case TIFF_PHOTOMETRIC_ITU_LAB:

        case TIFF_PHOTOMETRIC_CFA:

        case TIFF_PHOTOMETRIC_LOG_L:

        case TIFF_PHOTOMETRIC_LOG_LUV:

        case TIFF_PHOTOMETRIC_LINEAR_RAW:

            avpriv_report_missing_feature(s->avctx,

                                          "PhotometricInterpretation 0x%04X",

                                          value);

            return AVERROR_PATCHWELCOME;

        default:

            av_log(s->avctx, AV_LOG_ERROR, "PhotometricInterpretation %u is "

                   "unknown\n", value);

        break;

    case TIFF_FILL_ORDER:

        if (value < 1 || value > 2) {

                   "Unknown FillOrder value %d, trying default one\n", value);

            value = 1;

        s->fill_order = value - 1;

        break;

    case TIFF_PAL: {

        GetByteContext pal_gb[3];

        off = type_sizes[type];

        if (count / 3 > 256 ||

            bytestream2_get_bytes_left(&s->gb) < count / 3 * off * 3)

        pal_gb[0] = pal_gb[1] = pal_gb[2] = s->gb;

        bytestream2_skip(&pal_gb[1], count / 3 * off);

        bytestream2_skip(&pal_gb[2], count / 3 * off * 2);

        off = (type_sizes[type] - 1) << 3;

        if (off > 31U) {

            av_log(s->avctx, AV_LOG_ERROR, "palette shift %d is out of range\n", off);

        for (i = 0; i < count / 3; i++) {

            uint32_t p = 0xFF000000;

            p |= (ff_tget(&pal_gb[0], type, s->le) >> off) << 16;

            p |= (ff_tget(&pal_gb[1], type, s->le) >> off) << 8;

            p |=  ff_tget(&pal_gb[2], type, s->le) >> off;

            s->palette[i] = p;

        s->palette_is_set = 1;

        break;

    case TIFF_PLANAR:

        s->planar = value == 2;

        break;

    case TIFF_YCBCR_SUBSAMPLING:

        if (count != 2) {

            av_log(s->avctx, AV_LOG_ERROR, "subsample count invalid\n");

        for (i = 0; i < count; i++) {

            s->subsampling[i] = ff_tget(&s->gb, type, s->le);

            if (s->subsampling[i] <= 0) {

                av_log(s->avctx, AV_LOG_ERROR, "subsampling %d is invalid\n", s->subsampling[i]);

        break;

    case TIFF_T4OPTIONS:

        if (s->compr == TIFF_G3)

            s->fax_opts = value;

        break;

    case TIFF_T6OPTIONS:

        if (s->compr == TIFF_G4)

            s->fax_opts = value;

        break;

#define ADD_METADATA(count, name, sep)\

    if ((ret = add_metadata(count, type, name, sep, s, frame)) < 0) {\

        av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n");\

        goto end;\

    case TIFF_MODEL_PIXEL_SCALE:

        ADD_METADATA(count, "ModelPixelScaleTag", NULL);

        break;

    case TIFF_MODEL_TRANSFORMATION:

        ADD_METADATA(count, "ModelTransformationTag", NULL);

        break;

    case TIFF_MODEL_TIEPOINT:

        ADD_METADATA(count, "ModelTiepointTag", NULL);

        break;

    case TIFF_GEO_KEY_DIRECTORY:

        if (s->geotag_count) {

            avpriv_request_sample(s->avctx, "Multiple geo key directories\n");

        ADD_METADATA(1, "GeoTIFF_Version", NULL);

        ADD_METADATA(2, "GeoTIFF_Key_Revision", ".");

        s->geotag_count   = ff_tget_short(&s->gb, s->le);

        if (s->geotag_count > count / 4 - 1) {

            s->geotag_count = count / 4 - 1;

            av_log(s->avctx, AV_LOG_WARNING, "GeoTIFF key directory buffer shorter than specified\n");

        if (bytestream2_get_bytes_left(&s->gb) < s->geotag_count * sizeof(int16_t) * 4) {

            s->geotag_count = 0;

            return -1;

        s->geotags = av_mallocz_array(s->geotag_count, sizeof(TiffGeoTag));

        if (!s->geotags) {

            av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n");

            s->geotag_count = 0;

            goto end;

        for (i = 0; i < s->geotag_count; i++) {

            s->geotags[i].key    = ff_tget_short(&s->gb, s->le);

            s->geotags[i].type   = ff_tget_short(&s->gb, s->le);

            s->geotags[i].count  = ff_tget_short(&s->gb, s->le);

            if (!s->geotags[i].type)

                s->geotags[i].val  = get_geokey_val(s->geotags[i].key, ff_tget_short(&s->gb, s->le));

            else

                s->geotags[i].offset = ff_tget_short(&s->gb, s->le);

        break;

    case TIFF_GEO_DOUBLE_PARAMS:

        if (count >= INT_MAX / sizeof(int64_t))

        if (bytestream2_get_bytes_left(&s->gb) < count * sizeof(int64_t))

        dp = av_malloc_array(count, sizeof(double));

        if (!dp) {

            av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n");

            goto end;

        for (i = 0; i < count; i++)

            dp[i] = ff_tget_double(&s->gb, s->le);

        for (i = 0; i < s->geotag_count; i++) {

            if (s->geotags[i].type == TIFF_GEO_DOUBLE_PARAMS) {

                if (s->geotags[i].count == 0

                    || s->geotags[i].offset + s->geotags[i].count > count) {

                    av_log(s->avctx, AV_LOG_WARNING, "Invalid GeoTIFF key %d\n", s->geotags[i].key);

                } else {

                    char *ap = doubles2str(&dp[s->geotags[i].offset], s->geotags[i].count, ", ");

                    if (!ap) {

                        av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n");

                        av_freep(&dp);

                        return AVERROR(ENOMEM);

                    s->geotags[i].val = ap;

        av_freep(&dp);

        break;

    case TIFF_GEO_ASCII_PARAMS:

        pos = bytestream2_tell(&s->gb);

        for (i = 0; i < s->geotag_count; i++) {

            if (s->geotags[i].type == TIFF_GEO_ASCII_PARAMS) {

                if (s->geotags[i].count == 0

                    || s->geotags[i].offset +  s->geotags[i].count > count) {

                    av_log(s->avctx, AV_LOG_WARNING, "Invalid GeoTIFF key %d\n", s->geotags[i].key);

                } else {

                    char *ap;

                    bytestream2_seek(&s->gb, pos + s->geotags[i].offset, SEEK_SET);

                    if (bytestream2_get_bytes_left(&s->gb) < s->geotags[i].count)

                    ap = av_malloc(s->geotags[i].count);

                    if (!ap) {

                        av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n");

                        return AVERROR(ENOMEM);

                    bytestream2_get_bufferu(&s->gb, ap, s->geotags[i].count);

                    ap[s->geotags[i].count - 1] = '\0'; //replace the "|" delimiter with a 0 byte

                    s->geotags[i].val = ap;

        break;

    case TIFF_ARTIST:

        ADD_METADATA(count, "artist", NULL);

        break;

    case TIFF_COPYRIGHT:

        ADD_METADATA(count, "copyright", NULL);

        break;

    case TIFF_DATE:

        ADD_METADATA(count, "date", NULL);

        break;

    case TIFF_DOCUMENT_NAME:

        ADD_METADATA(count, "document_name", NULL);

        break;

    case TIFF_HOST_COMPUTER:

        ADD_METADATA(count, "computer", NULL);

        break;

    case TIFF_IMAGE_DESCRIPTION:

        ADD_METADATA(count, "description", NULL);

        break;

    case TIFF_MAKE:

        ADD_METADATA(count, "make", NULL);

        break;

    case TIFF_MODEL:

        ADD_METADATA(count, "model", NULL);

        break;

    case TIFF_PAGE_NAME:

        ADD_METADATA(count, "page_name", NULL);

        break;

    case TIFF_PAGE_NUMBER:

        ADD_METADATA(count, "page_number", " / ");

        break;

    case TIFF_SOFTWARE_NAME:

        ADD_METADATA(count, "software", NULL);

        break;

    default:

        if (s->avctx->err_recognition & AV_EF_EXPLODE) {

                   "Unknown or unsupported tag %d/0X%0X\n",

                   tag, tag);

end:

    if (s->bpp > 64U) {

                "This format is not supported (bpp=%d, %d components)\n",

                s->bpp, count);

        s->bpp = 0;

    bytestream2_seek(&s->gb, start, SEEK_SET);

    return 0;


void RenderProcessHostImpl::OnChannelConnected(int32_t peer_pid) {
  channel_connected_ = true;
  if (IsReady()) {
    DCHECK(!sent_render_process_ready_);
    sent_render_process_ready_ = true;
    for (auto& observer : observers_)
      observer.RenderProcessReady(this);
  }

#if defined(IPC_MESSAGE_LOG_ENABLED)
  Send(new ChildProcessMsg_SetIPCLoggingEnabled(
      IPC::Logging::GetInstance()->Enabled()));
#endif

  tracked_objects::ThreadData::Status status =
      tracked_objects::ThreadData::status();
  Send(new ChildProcessMsg_SetProfilerStatus(status));

  BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
                          base::Bind(&AudioInputRendererHost::set_renderer_pid,
                                     audio_input_renderer_host_, peer_pid));
}


static void nullableLongAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
    TestObject* imp = V8TestObject::toNative(info.Holder());
    bool isNull = false;
    int jsValue = imp->nullableLongAttribute(isNull);
    if (isNull) {
        v8SetReturnValueNull(info);
        return;
    }
    v8SetReturnValueInt(info, jsValue);
}


static void do_write_page(struct f2fs_summary *sum, struct f2fs_io_info *fio)
{
	int type = __get_segment_type(fio);
	int err;

reallocate:
	allocate_data_block(fio->sbi, fio->page, fio->old_blkaddr,
			&fio->new_blkaddr, sum, type, fio, true);

	/* writeout dirty page into bdev */
	err = f2fs_submit_page_write(fio);
	if (err == -EAGAIN) {
		fio->old_blkaddr = fio->new_blkaddr;
		goto reallocate;
	}
}


void RenderWidgetHostViewAura::OnSelectionBoundsChanged(
    TextInputManager* text_input_manager,
    RenderWidgetHostViewBase* updated_view) {
  if (GetInputMethod())
    GetInputMethod()->OnCaretBoundsChanged(this);
}


static void bt_att_chan_free(void *data)
{
	struct bt_att_chan *chan = data;

	if (chan->pending_req)
		destroy_att_send_op(chan->pending_req);

	if (chan->pending_ind)
		destroy_att_send_op(chan->pending_ind);

	queue_destroy(chan->queue, destroy_att_send_op);

	io_destroy(chan->io);

	free(chan->buf);
	free(chan);
}


void PrepareRemoteOp(eager::Operation* remote_op, EagerOperation* op) {
  EagerContext& ctx = op->EagerContext();

  remote_op->set_id(ctx.RemoteMgr()->NextOpId());
  remote_op->set_name(op->Name());

  op->Attrs().FillAttrValueMapWithoutDefaults(remote_op->mutable_attrs());
  remote_op->set_device(absl::get<Device*>(op->Device())->name());
  remote_op->set_is_function(op->is_function());
}


DownloadShelf* BrowserView::GetDownloadShelf() {
  if (!download_shelf_.get()) {
    download_shelf_.reset(new DownloadShelfView(browser_.get(), this));
    download_shelf_->set_owned_by_client();
  }
  return download_shelf_.get();
}


status_t MPEG4Extractor::updateAudioTrackInfoFromESDS_MPEG4Audio(
 const void *esds_data, size_t esds_size) {
    ESDS esds(esds_data, esds_size);

 uint8_t objectTypeIndication;
 if (esds.getObjectTypeIndication(&objectTypeIndication) != OK) {
 return ERROR_MALFORMED;
 }

 if (objectTypeIndication == 0xe1) {
        mLastTrack->meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_QCELP);
 return OK;
 }

 if (objectTypeIndication  == 0x6b) {
        ALOGE("MP3 track in MP4/3GPP file is not supported");
 return ERROR_UNSUPPORTED;
 }

 const uint8_t *csd;
 size_t csd_size;
 if (esds.getCodecSpecificInfo(
 (const void **)&csd, &csd_size) != OK) {
 return ERROR_MALFORMED;
 }

#if 0
    printf("ESD of size %d\n", csd_size);
    hexdump(csd, csd_size);
#endif

 if (csd_size == 0) {

 return OK;
 }

 if (csd_size < 2) {
 return ERROR_MALFORMED;
 }

 static uint32_t kSamplingRate[] = {
 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050,
 16000, 12000, 11025, 8000, 7350
 };

 ABitReader br(csd, csd_size);
 uint32_t objectType = br.getBits(5);

 if (objectType == 31) { // AAC-ELD => additional 6 bits
        objectType = 32 + br.getBits(6);
 }

    mLastTrack->meta->setInt32(kKeyAACAOT, objectType);

 uint32_t freqIndex = br.getBits(4);

 int32_t sampleRate = 0;
 int32_t numChannels = 0;
 if (freqIndex == 15) {
 if (csd_size < 5) {
 return ERROR_MALFORMED;
 }
        sampleRate = br.getBits(24);
        numChannels = br.getBits(4);
 } else {
        numChannels = br.getBits(4);

 if (freqIndex == 13 || freqIndex == 14) {
 return ERROR_MALFORMED;
 }

        sampleRate = kSamplingRate[freqIndex];
 }

 if (objectType == AOT_SBR || objectType == AOT_PS) {//SBR specific config per 14496-3 table 1.13
 uint32_t extFreqIndex = br.getBits(4);
 int32_t extSampleRate;
 if (extFreqIndex == 15) {
 if (csd_size < 8) {
 return ERROR_MALFORMED;
 }
            extSampleRate = br.getBits(24);
 } else {
 if (extFreqIndex == 13 || extFreqIndex == 14) {
 return ERROR_MALFORMED;
 }
            extSampleRate = kSamplingRate[extFreqIndex];
 }
 }

 switch (numChannels) {
 case 0:
 case 1:// FC
 case 2:// FL FR
 case 3:// FC, FL FR
 case 4:// FC, FL FR, RC
 case 5:// FC, FL FR, SL SR
 case 6:// FC, FL FR, SL SR, LFE
 break;
 case 11:// FC, FL FR, SL SR, RC, LFE
            numChannels = 7;
 break;
 case 7: // FC, FCL FCR, FL FR, SL SR, LFE
 case 12:// FC, FL  FR,  SL SR, RL RR, LFE
 case 14:// FC, FL  FR,  SL SR, LFE, FHL FHR
            numChannels = 8;
 break;
 default:
 return ERROR_UNSUPPORTED;
 }

 {
 if (objectType == AOT_SBR || objectType == AOT_PS) {
            objectType = br.getBits(5);

 if (objectType == AOT_ESCAPE) {
                objectType = 32 + br.getBits(6);
 }
 }
 if (objectType == AOT_AAC_LC || objectType == AOT_ER_AAC_LC ||
                objectType == AOT_ER_AAC_LD || objectType == AOT_ER_AAC_SCAL ||
                objectType == AOT_ER_BSAC) {
 const int32_t frameLengthFlag = br.getBits(1);

 const int32_t dependsOnCoreCoder = br.getBits(1);

 if (dependsOnCoreCoder ) {
 const int32_t coreCoderDelay = br.getBits(14);
 }

 int32_t extensionFlag = -1;
 if (br.numBitsLeft() > 0) {
                extensionFlag = br.getBits(1);
 } else {
 switch (objectType) {
 case AOT_AAC_LC:
                    extensionFlag = 0;
 break;
 case AOT_ER_AAC_LC:
 case AOT_ER_AAC_SCAL:
 case AOT_ER_BSAC:
 case AOT_ER_AAC_LD:
                    extensionFlag = 1;
 break;
 default:
                    TRESPASS();
 break;
 }
                ALOGW("csd missing extension flag; assuming %d for object type %u.",
                        extensionFlag, objectType);
 }

 if (numChannels == 0) {
 int32_t channelsEffectiveNum = 0;
 int32_t channelsNum = 0;
 const int32_t ElementInstanceTag = br.getBits(4);
 const int32_t Profile = br.getBits(2);
 const int32_t SamplingFrequencyIndex = br.getBits(4);
 const int32_t NumFrontChannelElements = br.getBits(4);
 const int32_t NumSideChannelElements = br.getBits(4);
 const int32_t NumBackChannelElements = br.getBits(4);
 const int32_t NumLfeChannelElements = br.getBits(2);
 const int32_t NumAssocDataElements = br.getBits(3);
 const int32_t NumValidCcElements = br.getBits(4);

 const int32_t MonoMixdownPresent = br.getBits(1);
 if (MonoMixdownPresent != 0) {
 const int32_t MonoMixdownElementNumber = br.getBits(4);
 }

 const int32_t StereoMixdownPresent = br.getBits(1);
 if (StereoMixdownPresent != 0) {
 const int32_t StereoMixdownElementNumber = br.getBits(4);
 }

 const int32_t MatrixMixdownIndexPresent = br.getBits(1);
 if (MatrixMixdownIndexPresent != 0) {
 const int32_t MatrixMixdownIndex = br.getBits(2);
 const int32_t PseudoSurroundEnable = br.getBits(1);
 }

 int i;
 for (i=0; i < NumFrontChannelElements; i++) {
 const int32_t FrontElementIsCpe = br.getBits(1);
 const int32_t FrontElementTagSelect = br.getBits(4);
                    channelsNum += FrontElementIsCpe ? 2 : 1;
 }

 for (i=0; i < NumSideChannelElements; i++) {
 const int32_t SideElementIsCpe = br.getBits(1);
 const int32_t SideElementTagSelect = br.getBits(4);
                    channelsNum += SideElementIsCpe ? 2 : 1;
 }

 for (i=0; i < NumBackChannelElements; i++) {
 const int32_t BackElementIsCpe = br.getBits(1);
 const int32_t BackElementTagSelect = br.getBits(4);
                    channelsNum += BackElementIsCpe ? 2 : 1;
 }
                channelsEffectiveNum = channelsNum;

 for (i=0; i < NumLfeChannelElements; i++) {
 const int32_t LfeElementTagSelect = br.getBits(4);
                    channelsNum += 1;
 }
                ALOGV("mpeg4 audio channelsNum = %d", channelsNum);
                ALOGV("mpeg4 audio channelsEffectiveNum = %d", channelsEffectiveNum);
                numChannels = channelsNum;
 }
 }
 }

 if (numChannels == 0) {
 return ERROR_UNSUPPORTED;
 }

 int32_t prevSampleRate;
    CHECK(mLastTrack->meta->findInt32(kKeySampleRate, &prevSampleRate));

 if (prevSampleRate != sampleRate) {
        ALOGV("mpeg4 audio sample rate different from previous setting. "
 "was: %d, now: %d", prevSampleRate, sampleRate);
 }

    mLastTrack->meta->setInt32(kKeySampleRate, sampleRate);

 int32_t prevChannelCount;
    CHECK(mLastTrack->meta->findInt32(kKeyChannelCount, &prevChannelCount));

 if (prevChannelCount != numChannels) {
        ALOGV("mpeg4 audio channel count different from previous setting. "
 "was: %d, now: %d", prevChannelCount, numChannels);
 }

    mLastTrack->meta->setInt32(kKeyChannelCount, numChannels);

 return OK;
}


static void null_endofword(char *word)
{
	while (*word && *word != ' ' && *word != '\t')
		word++;
	*word = '\0';
}


static void execute_ncq_command(NCQTransferState *ncq_tfs)
{
    AHCIDevice *ad = ncq_tfs->drive;
    IDEState *ide_state = &ad->port.ifs[0];
    int port = ad->port_no;

    g_assert(is_ncq(ncq_tfs->cmd));
    ncq_tfs->halt = false;

    switch (ncq_tfs->cmd) {
    case READ_FPDMA_QUEUED:
        DPRINTF(port, "NCQ reading %d sectors from LBA %"PRId64", tag %d\n",
                ncq_tfs->sector_count, ncq_tfs->lba, ncq_tfs->tag);

        DPRINTF(port, "tag %d aio read %"PRId64"\n",
                ncq_tfs->tag, ncq_tfs->lba);

        dma_acct_start(ide_state->blk, &ncq_tfs->acct,
                       &ncq_tfs->sglist, BLOCK_ACCT_READ);
        ncq_tfs->aiocb = dma_blk_read(ide_state->blk, &ncq_tfs->sglist,
                                      ncq_tfs->lba << BDRV_SECTOR_BITS,
                                      BDRV_SECTOR_SIZE,
                                      ncq_cb, ncq_tfs);
        break;
    case WRITE_FPDMA_QUEUED:
        DPRINTF(port, "NCQ writing %d sectors to LBA %"PRId64", tag %d\n",
                ncq_tfs->sector_count, ncq_tfs->lba, ncq_tfs->tag);

        DPRINTF(port, "tag %d aio write %"PRId64"\n",
                ncq_tfs->tag, ncq_tfs->lba);

        dma_acct_start(ide_state->blk, &ncq_tfs->acct,
                       &ncq_tfs->sglist, BLOCK_ACCT_WRITE);
        ncq_tfs->aiocb = dma_blk_write(ide_state->blk, &ncq_tfs->sglist,
                                       ncq_tfs->lba << BDRV_SECTOR_BITS,
                                       BDRV_SECTOR_SIZE,
                                       ncq_cb, ncq_tfs);
        break;
    default:
        DPRINTF(port, "error: unsupported NCQ command (0x%02x) received\n",
                ncq_tfs->cmd);
        ncq_err(ncq_tfs);
    }
}


int BIO_vsnprintf ( char * buf , size_t n , const char * format , va_list args ) {
 size_t retlen ;
 int truncated ;
 if ( ! _dopr ( & buf , NULL , & n , & retlen , & truncated , format , args ) ) return - 1 ;
 if ( truncated ) return - 1 ;
 else return ( retlen <= INT_MAX ) ? ( int ) retlen : - 1 ;
 }


static void ohci_sof(OHCIState *ohci)
{
    ohci_eof_timer(ohci);
    ohci_set_interrupt(ohci, OHCI_INTR_SF);
}


ZEND_API int zend_get_object_classname(const zval *object, const char **class_name, zend_uint *class_name_len TSRMLS_DC) /* {{{ */
{
	if (Z_OBJ_HT_P(object)->get_class_name == NULL ||
		Z_OBJ_HT_P(object)->get_class_name(object, class_name, class_name_len, 0 TSRMLS_CC) != SUCCESS) {
		zend_class_entry *ce = Z_OBJCE_P(object);

		*class_name = ce->name;
		*class_name_len = ce->name_length;
		return 1;
	}
	return 0;
}
/* }}} */


    BOOL JavascriptArray::TemplatedGetItem(JavascriptNativeIntArray *pArr, uint32 index, Var * element, ScriptContext * scriptContext, bool checkHasItem)
    {
        Assert(VirtualTableInfo<JavascriptNativeIntArray>::HasVirtualTable(pArr)
            || VirtualTableInfo<CrossSiteObject<JavascriptNativeIntArray>>::HasVirtualTable(pArr));
        return pArr->JavascriptNativeIntArray::DirectGetItemAtFull(index, element);
    }


    void setEmpty(bool empty, RenderBlock* block = 0, LineWidth* lineWidth = 0)
    {
        if (m_isEmpty == empty)
            return;
        m_isEmpty = empty;
        if (!empty && block && floatPaginationStrut()) {
            block->setLogicalHeight(block->logicalHeight() + floatPaginationStrut());
            setFloatPaginationStrut(0);
            lineWidth->updateAvailableWidth();
        }
    }


void WebBluetoothServiceImpl::OnDescriptorWriteValueSuccess(
    RemoteDescriptorWriteValueCallback callback) {
  DCHECK_CURRENTLY_ON(BrowserThread::UI);
  std::move(callback).Run(blink::mojom::WebBluetoothResult::SUCCESS);
}


  tt_cmap14_validate( FT_Byte*      table,
                      FT_Validator  valid )
  {
    FT_Byte*  p;
    FT_ULong  length;
    FT_ULong  num_selectors;

    if ( table + 2 + 4 + 4 > valid->limit )
      FT_INVALID_TOO_SHORT;

    p             = table + 2;
    length        = TT_NEXT_ULONG( p );
    num_selectors = TT_NEXT_ULONG( p );

    if ( length > (FT_ULong)( valid->limit - table ) ||
         /* length < 10 + 11 * num_selectors ? */
         length < 10                                 ||
         ( length - 10 ) / 11 < num_selectors        )
      FT_INVALID_TOO_SHORT;

    /* check selectors, they must be in increasing order */
    {
      /* we start lastVarSel at 1 because a variant selector value of 0
       * isn't valid.
       */
      FT_ULong  n, lastVarSel = 1;

      for ( n = 0; n < num_selectors; n++ )
      {
        FT_ULong  varSel    = TT_NEXT_UINT24( p );
        FT_ULong  defOff    = TT_NEXT_ULONG( p );
        FT_ULong  nondefOff = TT_NEXT_ULONG( p );

        if ( defOff >= length || nondefOff >= length )
          FT_INVALID_TOO_SHORT;

        if ( varSel < lastVarSel )
          FT_INVALID_DATA;

        lastVarSel = varSel + 1;

        /* check the default table (these glyphs should be reached     */
        /* through the normal Unicode cmap, no GIDs, just check order) */
        if ( defOff != 0 )
        {
          FT_Byte*  defp      = table + defOff;
          FT_ULong  numRanges = TT_NEXT_ULONG( defp );
          FT_ULong  i;
          FT_ULong  lastBase  = 0;

          /* defp + numRanges * 4 > valid->limit ? */
          if ( numRanges > (FT_ULong)( valid->limit - defp ) / 4 )
            FT_INVALID_TOO_SHORT;

          for ( i = 0; i < numRanges; ++i )
          {
            FT_ULong  base = TT_NEXT_UINT24( defp );
            FT_ULong  cnt  = FT_NEXT_BYTE( defp );

            if ( base + cnt >= 0x110000UL )              /* end of Unicode */
              FT_INVALID_DATA;

            if ( base < lastBase )
              FT_INVALID_DATA;

            lastBase = base + cnt + 1U;
          }
        }

        /* and the non-default table (these glyphs are specified here) */
        if ( nondefOff != 0 )
        {
          FT_Byte*  ndp         = table + nondefOff;
          FT_ULong  numMappings = TT_NEXT_ULONG( ndp );
          FT_ULong  i, lastUni  = 0;

          /* numMappings * 4 > (FT_ULong)( valid->limit - ndp ) ? */
          if ( numMappings > ( (FT_ULong)( valid->limit - ndp ) ) / 4 )
            FT_INVALID_TOO_SHORT;

          for ( i = 0; i < numMappings; ++i )
          {
            FT_ULong  uni = TT_NEXT_UINT24( ndp );
            FT_ULong  gid = TT_NEXT_USHORT( ndp );

            if ( uni >= 0x110000UL )                     /* end of Unicode */
              FT_INVALID_DATA;

            if ( uni < lastUni )
              FT_INVALID_DATA;

            lastUni = uni + 1U;

            if ( valid->level >= FT_VALIDATE_TIGHT    &&
                 gid >= TT_VALID_GLYPH_COUNT( valid ) )
              FT_INVALID_GLYPH_ID;
          }
        }
      }
    }

    return FT_Err_Ok;
  }