label
int64 0
1
| func1
stringlengths 23
97k
| id
int64 0
27.3k
|
---|---|---|
1 | int vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb) { int pqindex, lowquant; int status; int mbmodetab, imvtab, icbptab, twomvbptab, fourmvbptab; /* useful only for debugging */ int scale, shift, i; /* for initializing LUT for intensity compensation */ v->numref=0; v->fcm=0; v->field_mode=0; v->p_frame_skipped = 0; if (v->second_field) { v->s.pict_type = (v->fptype & 1) ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I; if (v->fptype & 4) v->s.pict_type = (v->fptype & 1) ? AV_PICTURE_TYPE_BI : AV_PICTURE_TYPE_B; v->s.current_picture_ptr->f.pict_type = v->s.pict_type; if (!v->pic_header_flag) goto parse_common_info; } if (v->interlace) { v->fcm = decode012(gb); if (v->fcm) { if (v->fcm == 2) v->field_mode = 1; else v->field_mode = 0; if (!v->warn_interlaced++) av_log(v->s.avctx, AV_LOG_ERROR, "Interlaced frames/fields support is incomplete\n"); } } if (v->field_mode) { v->fptype = get_bits(gb, 3); v->s.pict_type = (v->fptype & 2) ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I; if (v->fptype & 4) // B-picture v->s.pict_type = (v->fptype & 2) ? AV_PICTURE_TYPE_BI : AV_PICTURE_TYPE_B; } else { switch (get_unary(gb, 0, 4)) { case 0: v->s.pict_type = AV_PICTURE_TYPE_P; break; case 1: v->s.pict_type = AV_PICTURE_TYPE_B; break; case 2: v->s.pict_type = AV_PICTURE_TYPE_I; break; case 3: v->s.pict_type = AV_PICTURE_TYPE_BI; break; case 4: v->s.pict_type = AV_PICTURE_TYPE_P; // skipped pic v->p_frame_skipped = 1; break; } } if (v->tfcntrflag) skip_bits(gb, 8); if (v->broadcast) { if (!v->interlace || v->psf) { v->rptfrm = get_bits(gb, 2); } else { v->tff = get_bits1(gb); v->rff = get_bits1(gb); } } if (v->panscanflag) { av_log_missing_feature(v->s.avctx, "Pan-scan", 0); //... } if (v->p_frame_skipped) { return 0; } v->rnd = get_bits1(gb); if (v->interlace) v->uvsamp = get_bits1(gb); if (v->field_mode) { if (!v->refdist_flag) v->refdist = 0; else { if ((v->s.pict_type != AV_PICTURE_TYPE_B) && (v->s.pict_type != AV_PICTURE_TYPE_BI)) { v->refdist = get_bits(gb, 2); if (v->refdist == 3) v->refdist += get_unary(gb, 0, 16); } else { v->bfraction_lut_index = get_vlc2(gb, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1); v->bfraction = ff_vc1_bfraction_lut[v->bfraction_lut_index]; v->frfd = (v->bfraction * v->refdist) >> 8; v->brfd = v->refdist - v->frfd - 1; if (v->brfd < 0) v->brfd = 0; } } goto parse_common_info; } if (v->finterpflag) v->interpfrm = get_bits1(gb); if (v->s.pict_type == AV_PICTURE_TYPE_B) { v->bfraction_lut_index = get_vlc2(gb, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1); v->bfraction = ff_vc1_bfraction_lut[v->bfraction_lut_index]; if (v->bfraction == 0) { v->s.pict_type = AV_PICTURE_TYPE_BI; /* XXX: should not happen here */ } } parse_common_info: if (v->field_mode) v->cur_field_type = !(v->tff ^ v->second_field); pqindex = get_bits(gb, 5); if (!pqindex) return -1; v->pqindex = pqindex; if (v->quantizer_mode == QUANT_FRAME_IMPLICIT) v->pq = ff_vc1_pquant_table[0][pqindex]; else v->pq = ff_vc1_pquant_table[1][pqindex]; v->pquantizer = 1; if (v->quantizer_mode == QUANT_FRAME_IMPLICIT) v->pquantizer = pqindex < 9; if (v->quantizer_mode == QUANT_NON_UNIFORM) v->pquantizer = 0; v->pqindex = pqindex; if (pqindex < 9) v->halfpq = get_bits1(gb); else v->halfpq = 0; if (v->quantizer_mode == QUANT_FRAME_EXPLICIT) v->pquantizer = get_bits1(gb); if (v->postprocflag) v->postproc = get_bits(gb, 2); if (v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_P) v->use_ic = 0; if (v->parse_only) return 0; switch (v->s.pict_type) { case AV_PICTURE_TYPE_I: case AV_PICTURE_TYPE_BI: if (v->fcm == 1) { //interlace frame picture status = bitplane_decoding(v->fieldtx_plane, &v->fieldtx_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "FIELDTX plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); } status = bitplane_decoding(v->acpred_plane, &v->acpred_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "ACPRED plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); v->condover = CONDOVER_NONE; if (v->overlap && v->pq <= 8) { v->condover = decode012(gb); if (v->condover == CONDOVER_SELECT) { status = bitplane_decoding(v->over_flags_plane, &v->overflg_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "CONDOVER plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); } } break; case AV_PICTURE_TYPE_P: if (v->field_mode) { av_log(v->s.avctx, AV_LOG_ERROR, "P Fields do not work currently\n"); return -1; v->numref = get_bits1(gb); if (!v->numref) { v->reffield = get_bits1(gb); v->ref_field_type[0] = v->reffield ^ !v->cur_field_type; } } if (v->extended_mv) v->mvrange = get_unary(gb, 0, 3); else v->mvrange = 0; if (v->interlace) { if (v->extended_dmv) v->dmvrange = get_unary(gb, 0, 3); else v->dmvrange = 0; if (v->fcm == 1) { // interlaced frame picture v->fourmvswitch = get_bits1(gb); v->intcomp = get_bits1(gb); if (v->intcomp) { v->lumscale = get_bits(gb, 6); v->lumshift = get_bits(gb, 6); INIT_LUT(v->lumscale, v->lumshift, v->luty, v->lutuv); } status = bitplane_decoding(v->s.mbskip_table, &v->skip_is_raw, v); av_log(v->s.avctx, AV_LOG_DEBUG, "SKIPMB plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); mbmodetab = get_bits(gb, 2); if (v->fourmvswitch) v->mbmode_vlc = &ff_vc1_intfr_4mv_mbmode_vlc[mbmodetab]; else v->mbmode_vlc = &ff_vc1_intfr_non4mv_mbmode_vlc[mbmodetab]; imvtab = get_bits(gb, 2); v->imv_vlc = &ff_vc1_1ref_mvdata_vlc[imvtab]; // interlaced p-picture cbpcy range is [1, 63] icbptab = get_bits(gb, 3); v->cbpcy_vlc = &ff_vc1_icbpcy_vlc[icbptab]; twomvbptab = get_bits(gb, 2); v->twomvbp_vlc = &ff_vc1_2mv_block_pattern_vlc[twomvbptab]; if (v->fourmvswitch) { fourmvbptab = get_bits(gb, 2); v->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[fourmvbptab]; } } } v->k_x = v->mvrange + 9 + (v->mvrange >> 1); //k_x can be 9 10 12 13 v->k_y = v->mvrange + 8; //k_y can be 8 9 10 11 v->range_x = 1 << (v->k_x - 1); v->range_y = 1 << (v->k_y - 1); if (v->pq < 5) v->tt_index = 0; else if (v->pq < 13) v->tt_index = 1; else v->tt_index = 2; if (v->fcm != 1) { int mvmode; mvmode = get_unary(gb, 1, 4); lowquant = (v->pq > 12) ? 0 : 1; v->mv_mode = ff_vc1_mv_pmode_table[lowquant][mvmode]; if (v->mv_mode == MV_PMODE_INTENSITY_COMP) { int mvmode2; mvmode2 = get_unary(gb, 1, 3); v->mv_mode2 = ff_vc1_mv_pmode_table2[lowquant][mvmode2]; if (v->field_mode) v->intcompfield = decode210(gb); v->lumscale = get_bits(gb, 6); v->lumshift = get_bits(gb, 6); INIT_LUT(v->lumscale, v->lumshift, v->luty, v->lutuv); if ((v->field_mode) && !v->intcompfield) { v->lumscale2 = get_bits(gb, 6); v->lumshift2 = get_bits(gb, 6); INIT_LUT(v->lumscale2, v->lumshift2, v->luty2, v->lutuv2); } v->use_ic = 1; } v->qs_last = v->s.quarter_sample; if (v->mv_mode == MV_PMODE_1MV_HPEL || v->mv_mode == MV_PMODE_1MV_HPEL_BILIN) v->s.quarter_sample = 0; else if (v->mv_mode == MV_PMODE_INTENSITY_COMP) { if (v->mv_mode2 == MV_PMODE_1MV_HPEL || v->mv_mode2 == MV_PMODE_1MV_HPEL_BILIN) v->s.quarter_sample = 0; else v->s.quarter_sample = 1; } else v->s.quarter_sample = 1; v->s.mspel = !(v->mv_mode == MV_PMODE_1MV_HPEL_BILIN || (v->mv_mode == MV_PMODE_INTENSITY_COMP && v->mv_mode2 == MV_PMODE_1MV_HPEL_BILIN)); } if (v->fcm == 0) { // progressive if ((v->mv_mode == MV_PMODE_INTENSITY_COMP && v->mv_mode2 == MV_PMODE_MIXED_MV) || v->mv_mode == MV_PMODE_MIXED_MV) { status = bitplane_decoding(v->mv_type_mb_plane, &v->mv_type_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "MB MV Type plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); } else { v->mv_type_is_raw = 0; memset(v->mv_type_mb_plane, 0, v->s.mb_stride * v->s.mb_height); } status = bitplane_decoding(v->s.mbskip_table, &v->skip_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); /* Hopefully this is correct for P frames */ v->s.mv_table_index = get_bits(gb, 2); //but using ff_vc1_ tables v->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[get_bits(gb, 2)]; } else if (v->fcm == 1) { // frame interlaced v->qs_last = v->s.quarter_sample; v->s.quarter_sample = 1; v->s.mspel = 1; } else { // field interlaced mbmodetab = get_bits(gb, 3); imvtab = get_bits(gb, 2 + v->numref); if (!v->numref) v->imv_vlc = &ff_vc1_1ref_mvdata_vlc[imvtab]; else v->imv_vlc = &ff_vc1_2ref_mvdata_vlc[imvtab]; icbptab = get_bits(gb, 3); v->cbpcy_vlc = &ff_vc1_icbpcy_vlc[icbptab]; if ((v->mv_mode == MV_PMODE_INTENSITY_COMP && v->mv_mode2 == MV_PMODE_MIXED_MV) || v->mv_mode == MV_PMODE_MIXED_MV) { fourmvbptab = get_bits(gb, 2); v->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[fourmvbptab]; v->mbmode_vlc = &ff_vc1_if_mmv_mbmode_vlc[mbmodetab]; } else { v->mbmode_vlc = &ff_vc1_if_1mv_mbmode_vlc[mbmodetab]; } } if (v->dquant) { av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n"); vop_dquant_decoding(v); } v->ttfrm = 0; //FIXME Is that so ? if (v->vstransform) { v->ttmbf = get_bits1(gb); if (v->ttmbf) { v->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(gb, 2)]; } } else { v->ttmbf = 1; v->ttfrm = TT_8X8; } break; case AV_PICTURE_TYPE_B: // TODO: implement interlaced frame B picture decoding if (v->fcm == 1) return -1; if (v->extended_mv) v->mvrange = get_unary(gb, 0, 3); else v->mvrange = 0; v->k_x = v->mvrange + 9 + (v->mvrange >> 1); //k_x can be 9 10 12 13 v->k_y = v->mvrange + 8; //k_y can be 8 9 10 11 v->range_x = 1 << (v->k_x - 1); v->range_y = 1 << (v->k_y - 1); if (v->pq < 5) v->tt_index = 0; else if (v->pq < 13) v->tt_index = 1; else v->tt_index = 2; if (v->field_mode) { int mvmode; av_log(v->s.avctx, AV_LOG_ERROR, "B Fields do not work currently\n"); return -1; if (v->extended_dmv) v->dmvrange = get_unary(gb, 0, 3); mvmode = get_unary(gb, 1, 3); lowquant = (v->pq > 12) ? 0 : 1; v->mv_mode = ff_vc1_mv_pmode_table2[lowquant][mvmode]; v->qs_last = v->s.quarter_sample; v->s.quarter_sample = (v->mv_mode == MV_PMODE_1MV || v->mv_mode == MV_PMODE_MIXED_MV); v->s.mspel = !(v->mv_mode == MV_PMODE_1MV_HPEL_BILIN || v->mv_mode == MV_PMODE_1MV_HPEL); status = bitplane_decoding(v->forward_mb_plane, &v->fmb_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "MB Forward Type plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); mbmodetab = get_bits(gb, 3); if (v->mv_mode == MV_PMODE_MIXED_MV) v->mbmode_vlc = &ff_vc1_if_mmv_mbmode_vlc[mbmodetab]; else v->mbmode_vlc = &ff_vc1_if_1mv_mbmode_vlc[mbmodetab]; imvtab = get_bits(gb, 3); v->imv_vlc = &ff_vc1_2ref_mvdata_vlc[imvtab]; icbptab = get_bits(gb, 3); v->cbpcy_vlc = &ff_vc1_icbpcy_vlc[icbptab]; if (v->mv_mode == MV_PMODE_MIXED_MV) { fourmvbptab = get_bits(gb, 2); v->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[fourmvbptab]; } v->numref = 1; // interlaced field B pictures are always 2-ref } else { v->mv_mode = get_bits1(gb) ? MV_PMODE_1MV : MV_PMODE_1MV_HPEL_BILIN; v->qs_last = v->s.quarter_sample; v->s.quarter_sample = (v->mv_mode == MV_PMODE_1MV); v->s.mspel = v->s.quarter_sample; status = bitplane_decoding(v->direct_mb_plane, &v->dmb_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "MB Direct Type plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); status = bitplane_decoding(v->s.mbskip_table, &v->skip_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); v->s.mv_table_index = get_bits(gb, 2); v->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[get_bits(gb, 2)]; } if (v->dquant) { av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n"); vop_dquant_decoding(v); } v->ttfrm = 0; if (v->vstransform) { v->ttmbf = get_bits1(gb); if (v->ttmbf) { v->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(gb, 2)]; } } else { v->ttmbf = 1; v->ttfrm = TT_8X8; } break; } /* AC Syntax */ v->c_ac_table_index = decode012(gb); if (v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_BI) { v->y_ac_table_index = decode012(gb); } /* DC Syntax */ v->s.dc_table_index = get_bits1(gb); if ((v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_BI) && v->dquant) { av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n"); vop_dquant_decoding(v); } v->bi_type = 0; if (v->s.pict_type == AV_PICTURE_TYPE_BI) { v->s.pict_type = AV_PICTURE_TYPE_B; v->bi_type = 1; } return 0; } | 25,380 |
1 | static int decode_mb(MadContext *s, AVFrame *frame, int inter) { int mv_map = 0; int mv_x, mv_y; int j; if (inter) { int v = decode210(&s->gb); if (v < 2) { mv_map = v ? get_bits(&s->gb, 6) : 63; mv_x = decode_motion(&s->gb); mv_y = decode_motion(&s->gb); } } for (j=0; j<6; j++) { if (mv_map & (1<<j)) { // mv_x and mv_y are guarded by mv_map int add = 2*decode_motion(&s->gb); if (s->last_frame->data[0]) comp_block(s, frame, s->mb_x, s->mb_y, j, mv_x, mv_y, add); } else { s->dsp.clear_block(s->block); if(decode_block_intra(s, s->block) < 0) return -1; idct_put(s, frame, s->block, s->mb_x, s->mb_y, j); } } return 0; } | 25,381 |
1 | static inline uint16_t vring_avail_idx(VirtQueue *vq) { VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches); hwaddr pa = offsetof(VRingAvail, idx); vq->shadow_avail_idx = virtio_lduw_phys_cached(vq->vdev, &caches->avail, pa); return vq->shadow_avail_idx; } | 25,384 |
1 | USBDevice *usb_create_simple(USBBus *bus, const char *name) { USBDevice *dev = usb_create(bus, name); qdev_init(&dev->qdev); return dev; } | 25,385 |
1 | static void qvirtio_pci_foreach_callback( QPCIDevice *dev, int devfn, void *data) { QVirtioPCIForeachData *d = data; QVirtioPCIDevice *vpcidev = qpcidevice_to_qvirtiodevice(dev); if (vpcidev->vdev.device_type == d->device_type && (!d->has_slot || vpcidev->pdev->devfn == d->slot << 3)) { d->func(&vpcidev->vdev, d->user_data); } else { g_free(vpcidev); } } | 25,386 |
1 | static inline void qpel_motion(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int field_based, int bottom_field, int field_select, uint8_t **ref_picture, op_pixels_func (*pix_op)[4], qpel_mc_func (*qpix_op)[16], int motion_x, int motion_y, int h) { uint8_t *ptr_y, *ptr_cb, *ptr_cr; int dxy, uvdxy, mx, my, src_x, src_y, uvsrc_x, uvsrc_y, v_edge_pos, linesize, uvlinesize; dxy = ((motion_y & 3) << 2) | (motion_x & 3); src_x = s->mb_x * 16 + (motion_x >> 2); src_y = s->mb_y * (16 >> field_based) + (motion_y >> 2); v_edge_pos = s->v_edge_pos >> field_based; linesize = s->linesize << field_based; uvlinesize = s->uvlinesize << field_based; if(field_based){ mx= motion_x/2; my= motion_y>>1; }else if(s->workaround_bugs&FF_BUG_QPEL_CHROMA2){ static const int rtab[8]= {0,0,1,1,0,0,0,1}; mx= (motion_x>>1) + rtab[motion_x&7]; my= (motion_y>>1) + rtab[motion_y&7]; }else if(s->workaround_bugs&FF_BUG_QPEL_CHROMA){ mx= (motion_x>>1)|(motion_x&1); my= (motion_y>>1)|(motion_y&1); }else{ mx= motion_x/2; my= motion_y/2; } mx= (mx>>1)|(mx&1); my= (my>>1)|(my&1); uvdxy= (mx&1) | ((my&1)<<1); mx>>=1; my>>=1; uvsrc_x = s->mb_x * 8 + mx; uvsrc_y = s->mb_y * (8 >> field_based) + my; ptr_y = ref_picture[0] + src_y * linesize + src_x; ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x; ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x; if( (unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x&3) - 16, 0) || (unsigned)src_y > FFMAX( v_edge_pos - (motion_y&3) - h , 0)){ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, 17, 17+field_based, src_x, src_y<<field_based, s->h_edge_pos, s->v_edge_pos); ptr_y= s->edge_emu_buffer; if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ uint8_t *uvbuf= s->edge_emu_buffer + 18*s->linesize; s->vdsp.emulated_edge_mc(uvbuf, ptr_cb, s->uvlinesize, 9, 9 + field_based, uvsrc_x, uvsrc_y<<field_based, s->h_edge_pos>>1, s->v_edge_pos>>1); s->vdsp.emulated_edge_mc(uvbuf + 16, ptr_cr, s->uvlinesize, 9, 9 + field_based, uvsrc_x, uvsrc_y<<field_based, s->h_edge_pos>>1, s->v_edge_pos>>1); ptr_cb= uvbuf; ptr_cr= uvbuf + 16; } } if(!field_based) qpix_op[0][dxy](dest_y, ptr_y, linesize); else{ if(bottom_field){ dest_y += s->linesize; dest_cb+= s->uvlinesize; dest_cr+= s->uvlinesize; } if(field_select){ ptr_y += s->linesize; ptr_cb += s->uvlinesize; ptr_cr += s->uvlinesize; } //damn interlaced mode //FIXME boundary mirroring is not exactly correct here qpix_op[1][dxy](dest_y , ptr_y , linesize); qpix_op[1][dxy](dest_y+8, ptr_y+8, linesize); } if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ pix_op[1][uvdxy](dest_cr, ptr_cr, uvlinesize, h >> 1); pix_op[1][uvdxy](dest_cb, ptr_cb, uvlinesize, h >> 1); } } | 25,387 |
1 | static int host_pci_config_read(int pos, int len, uint32_t val) { char path[PATH_MAX]; int config_fd; ssize_t size = sizeof(path); /* Access real host bridge. */ int rc = snprintf(path, size, "/sys/bus/pci/devices/%04x:%02x:%02x.%d/%s", 0, 0, 0, 0, "config"); if (rc >= size || rc < 0) { return -ENODEV; } config_fd = open(path, O_RDWR); if (config_fd < 0) { return -ENODEV; } if (lseek(config_fd, pos, SEEK_SET) != pos) { return -errno; } do { rc = read(config_fd, (uint8_t *)&val, len); } while (rc < 0 && (errno == EINTR || errno == EAGAIN)); if (rc != len) { return -errno; } return 0; } | 25,389 |
1 | static inline void read_mem(IVState *s, uint64_t off, void *buf, size_t len) { QTestState *qtest = global_qtest; global_qtest = s->qtest; qpci_memread(s->dev, s->mem_base + off, buf, len); global_qtest = qtest; } | 25,390 |
1 | static void sdhci_initfn(Object *obj) { SDHCIState *s = SDHCI(obj); DriveInfo *di; di = drive_get_next(IF_SD); s->card = sd_init(di ? di->bdrv : NULL, false); if (s->card == NULL) { exit(1); } s->eject_cb = qemu_allocate_irqs(sdhci_insert_eject_cb, s, 1)[0]; s->ro_cb = qemu_allocate_irqs(sdhci_card_readonly_cb, s, 1)[0]; sd_set_cb(s->card, s->ro_cb, s->eject_cb); s->insert_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, sdhci_raise_insertion_irq, s); s->transfer_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, sdhci_do_data_transfer, s); } | 25,391 |
1 | static int decode_packet(AVCodecContext *avctx, void *data, int *data_size, AVPacket* avpkt) { WmallDecodeCtx *s = avctx->priv_data; GetBitContext* gb = &s->pgb; const uint8_t* buf = avpkt->data; int buf_size = avpkt->size; int num_bits_prev_frame; int packet_sequence_number; s->samples = data; s->samples_end = (float*)((int8_t*)data + *data_size); *data_size = 0; if (s->packet_done || s->packet_loss) { s->packet_done = 0; /** sanity check for the buffer length */ if (buf_size < avctx->block_align) return 0; s->next_packet_start = buf_size - avctx->block_align; buf_size = avctx->block_align; s->buf_bit_size = buf_size << 3; /** parse packet header */ init_get_bits(gb, buf, s->buf_bit_size); packet_sequence_number = get_bits(gb, 4); int seekable_frame_in_packet = get_bits1(gb); int spliced_packet = get_bits1(gb); /** get number of bits that need to be added to the previous frame */ num_bits_prev_frame = get_bits(gb, s->log2_frame_size); /** check for packet loss */ if (!s->packet_loss && ((s->packet_sequence_number + 1) & 0xF) != packet_sequence_number) { s->packet_loss = 1; av_log(avctx, AV_LOG_ERROR, "Packet loss detected! seq %x vs %x\n", s->packet_sequence_number, packet_sequence_number); } s->packet_sequence_number = packet_sequence_number; if (num_bits_prev_frame > 0) { int remaining_packet_bits = s->buf_bit_size - get_bits_count(gb); if (num_bits_prev_frame >= remaining_packet_bits) { num_bits_prev_frame = remaining_packet_bits; s->packet_done = 1; } /** append the previous frame data to the remaining data from the previous packet to create a full frame */ save_bits(s, gb, num_bits_prev_frame, 1); /** decode the cross packet frame if it is valid */ if (!s->packet_loss) decode_frame(s); } else if (s->num_saved_bits - s->frame_offset) { dprintf(avctx, "ignoring %x previously saved bits\n", s->num_saved_bits - s->frame_offset); } if (s->packet_loss) { /** reset number of saved bits so that the decoder does not start to decode incomplete frames in the s->len_prefix == 0 case */ s->num_saved_bits = 0; s->packet_loss = 0; } } else { int frame_size; s->buf_bit_size = (avpkt->size - s->next_packet_start) << 3; init_get_bits(gb, avpkt->data, s->buf_bit_size); skip_bits(gb, s->packet_offset); if (s->len_prefix && remaining_bits(s, gb) > s->log2_frame_size && (frame_size = show_bits(gb, s->log2_frame_size)) && frame_size <= remaining_bits(s, gb)) { save_bits(s, gb, frame_size, 0); s->packet_done = !decode_frame(s); } else if (!s->len_prefix && s->num_saved_bits > get_bits_count(&s->gb)) { /** when the frames do not have a length prefix, we don't know the compressed length of the individual frames however, we know what part of a new packet belongs to the previous frame therefore we save the incoming packet first, then we append the "previous frame" data from the next packet so that we get a buffer that only contains full frames */ s->packet_done = !decode_frame(s); } else { s->packet_done = 1; } } if (s->packet_done && !s->packet_loss && remaining_bits(s, gb) > 0) { /** save the rest of the data so that it can be decoded with the next packet */ save_bits(s, gb, remaining_bits(s, gb), 0); } *data_size = 0; // (int8_t *)s->samples - (int8_t *)data; s->packet_offset = get_bits_count(gb) & 7; return (s->packet_loss) ? AVERROR_INVALIDDATA : get_bits_count(gb) >> 3; } | 25,392 |
1 | int vhost_backend_update_device_iotlb(struct vhost_dev *dev, uint64_t iova, uint64_t uaddr, uint64_t len, IOMMUAccessFlags perm) { struct vhost_iotlb_msg imsg; imsg.iova = iova; imsg.uaddr = uaddr; imsg.size = len; imsg.type = VHOST_IOTLB_UPDATE; switch (perm) { case IOMMU_RO: imsg.perm = VHOST_ACCESS_RO; break; case IOMMU_WO: imsg.perm = VHOST_ACCESS_WO; break; case IOMMU_RW: imsg.perm = VHOST_ACCESS_RW; break; default: return -EINVAL; } return dev->vhost_ops->vhost_send_device_iotlb_msg(dev, &imsg); } | 25,393 |
1 | void qemu_set_log_filename(const char *filename) { char *pidstr; g_free(logfilename); pidstr = strstr(filename, "%"); if (pidstr) { /* We only accept one %d, no other format strings */ if (pidstr[1] != 'd' || strchr(pidstr + 2, '%')) { error_report("Bad logfile format: %s", filename); logfilename = NULL; } else { logfilename = g_strdup_printf(filename, getpid()); } } else { logfilename = g_strdup(filename); } qemu_log_close(); qemu_set_log(qemu_loglevel); } | 25,394 |
1 | static void virtio_scsi_handle_event(VirtIODevice *vdev, VirtQueue *vq) { VirtIOSCSI *s = VIRTIO_SCSI(vdev); if (s->ctx && !s->dataplane_started) { virtio_scsi_dataplane_start(s); return; } if (s->events_dropped) { virtio_scsi_push_event(s, NULL, VIRTIO_SCSI_T_NO_EVENT, 0); } } | 25,395 |
1 | static int gdb_set_spe_reg(CPUState *env, uint8_t *mem_buf, int n) { if (n < 32) { #if defined(TARGET_PPC64) target_ulong lo = (uint32_t)env->gpr[n]; target_ulong hi = (target_ulong)ldl_p(mem_buf) << 32; env->gpr[n] = lo | hi; #else env->gprh[n] = ldl_p(mem_buf); #endif return 4; } if (n == 33) { env->spe_acc = ldq_p(mem_buf); return 8; } if (n == 34) { /* SPEFSCR not implemented */ return 4; } return 0; } | 25,396 |
1 | int pci_bridge_initfn(PCIDevice *dev) { PCIBus *parent = dev->bus; PCIBridge *br = DO_UPCAST(PCIBridge, dev, dev); PCIBus *sec_bus = &br->sec_bus; pci_word_test_and_set_mask(dev->config + PCI_STATUS, PCI_STATUS_66MHZ | PCI_STATUS_FAST_BACK); pci_config_set_class(dev->config, PCI_CLASS_BRIDGE_PCI); dev->config[PCI_HEADER_TYPE] = (dev->config[PCI_HEADER_TYPE] & PCI_HEADER_TYPE_MULTI_FUNCTION) | PCI_HEADER_TYPE_BRIDGE; pci_set_word(dev->config + PCI_SEC_STATUS, PCI_STATUS_66MHZ | PCI_STATUS_FAST_BACK); /* * If we don't specify the name, the bus will be addressed as <id>.0, where * id is the device id. * Since PCI Bridge devices have a single bus each, we don't need the index: * let users address the bus using the device name. */ if (!br->bus_name && dev->qdev.id && *dev->qdev.id) { br->bus_name = dev->qdev.id; } qbus_create_inplace(&sec_bus->qbus, TYPE_PCI_BUS, &dev->qdev, br->bus_name); sec_bus->parent_dev = dev; sec_bus->map_irq = br->map_irq; sec_bus->address_space_mem = &br->address_space_mem; memory_region_init(&br->address_space_mem, "pci_bridge_pci", INT64_MAX); sec_bus->address_space_io = &br->address_space_io; memory_region_init(&br->address_space_io, "pci_bridge_io", 65536); pci_bridge_region_init(br); QLIST_INIT(&sec_bus->child); QLIST_INSERT_HEAD(&parent->child, sec_bus, sibling); return 0; } | 25,397 |
1 | static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) { ASFContext *asf = s->priv_data; ff_asf_guid g; ByteIOContext *pb = s->pb; AVStream *st; ASFStream *asf_st; int size, i; int64_t gsize; AVRational dar[128]; uint32_t bitrate[128]; memset(dar, 0, sizeof(dar)); memset(bitrate, 0, sizeof(bitrate)); get_guid(pb, &g); if (guidcmp(&g, &ff_asf_header)) return -1; get_le64(pb); get_le32(pb); get_byte(pb); get_byte(pb); memset(&asf->asfid2avid, -1, sizeof(asf->asfid2avid)); for(;;) { uint64_t gpos= url_ftell(pb); get_guid(pb, &g); gsize = get_le64(pb); dprintf(s, "%08"PRIx64": ", gpos); print_guid(&g); dprintf(s, " size=0x%"PRIx64"\n", gsize); if (!guidcmp(&g, &ff_asf_data_header)) { asf->data_object_offset = url_ftell(pb); // if not streaming, gsize is not unlimited (how?), and there is enough space in the file.. if (!(asf->hdr.flags & 0x01) && gsize >= 100) { asf->data_object_size = gsize - 24; } else { asf->data_object_size = (uint64_t)-1; } break; } if (gsize < 24) return -1; if (!guidcmp(&g, &ff_asf_file_header)) { get_guid(pb, &asf->hdr.guid); asf->hdr.file_size = get_le64(pb); asf->hdr.create_time = get_le64(pb); asf->nb_packets = get_le64(pb); asf->hdr.play_time = get_le64(pb); asf->hdr.send_time = get_le64(pb); asf->hdr.preroll = get_le32(pb); asf->hdr.ignore = get_le32(pb); asf->hdr.flags = get_le32(pb); asf->hdr.min_pktsize = get_le32(pb); asf->hdr.max_pktsize = get_le32(pb); asf->hdr.max_bitrate = get_le32(pb); s->packet_size = asf->hdr.max_pktsize; } else if (!guidcmp(&g, &ff_asf_stream_header)) { enum AVMediaType type; int type_specific_size, sizeX; uint64_t total_size; unsigned int tag1; int64_t pos1, pos2, start_time; int test_for_ext_stream_audio, is_dvr_ms_audio=0; if (s->nb_streams == ASF_MAX_STREAMS) { av_log(s, AV_LOG_ERROR, "too many streams\n"); return AVERROR(EINVAL); } pos1 = url_ftell(pb); st = av_new_stream(s, 0); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */ asf_st = av_mallocz(sizeof(ASFStream)); if (!asf_st) return AVERROR(ENOMEM); st->priv_data = asf_st; start_time = asf->hdr.preroll; asf_st->stream_language_index = 128; // invalid stream index means no language info if(!(asf->hdr.flags & 0x01)) { // if we aren't streaming... st->duration = asf->hdr.play_time / (10000000 / 1000) - start_time; } get_guid(pb, &g); test_for_ext_stream_audio = 0; if (!guidcmp(&g, &ff_asf_audio_stream)) { type = AVMEDIA_TYPE_AUDIO; } else if (!guidcmp(&g, &ff_asf_video_stream)) { type = AVMEDIA_TYPE_VIDEO; } else if (!guidcmp(&g, &ff_asf_command_stream)) { type = AVMEDIA_TYPE_DATA; } else if (!guidcmp(&g, &ff_asf_ext_stream_embed_stream_header)) { test_for_ext_stream_audio = 1; type = AVMEDIA_TYPE_UNKNOWN; } else { return -1; } get_guid(pb, &g); total_size = get_le64(pb); type_specific_size = get_le32(pb); get_le32(pb); st->id = get_le16(pb) & 0x7f; /* stream id */ // mapping of asf ID to AV stream ID; asf->asfid2avid[st->id] = s->nb_streams - 1; get_le32(pb); if (test_for_ext_stream_audio) { get_guid(pb, &g); if (!guidcmp(&g, &ff_asf_ext_stream_audio_stream)) { type = AVMEDIA_TYPE_AUDIO; is_dvr_ms_audio=1; get_guid(pb, &g); get_le32(pb); get_le32(pb); get_le32(pb); get_guid(pb, &g); get_le32(pb); } } st->codec->codec_type = type; if (type == AVMEDIA_TYPE_AUDIO) { ff_get_wav_header(pb, st->codec, type_specific_size); if (is_dvr_ms_audio) { // codec_id and codec_tag are unreliable in dvr_ms // files. Set them later by probing stream. st->codec->codec_id = CODEC_ID_PROBE; st->codec->codec_tag = 0; } if (st->codec->codec_id == CODEC_ID_AAC) { st->need_parsing = AVSTREAM_PARSE_NONE; } else { st->need_parsing = AVSTREAM_PARSE_FULL; } /* We have to init the frame size at some point .... */ pos2 = url_ftell(pb); if (gsize >= (pos2 + 8 - pos1 + 24)) { asf_st->ds_span = get_byte(pb); asf_st->ds_packet_size = get_le16(pb); asf_st->ds_chunk_size = get_le16(pb); get_le16(pb); //ds_data_size get_byte(pb); //ds_silence_data } //printf("Descrambling: ps:%d cs:%d ds:%d s:%d sd:%d\n", // asf_st->ds_packet_size, asf_st->ds_chunk_size, // asf_st->ds_data_size, asf_st->ds_span, asf_st->ds_silence_data); if (asf_st->ds_span > 1) { if (!asf_st->ds_chunk_size || (asf_st->ds_packet_size/asf_st->ds_chunk_size <= 1) || asf_st->ds_packet_size % asf_st->ds_chunk_size) asf_st->ds_span = 0; // disable descrambling } switch (st->codec->codec_id) { case CODEC_ID_MP3: st->codec->frame_size = MPA_FRAME_SIZE; break; case CODEC_ID_PCM_S16LE: case CODEC_ID_PCM_S16BE: case CODEC_ID_PCM_U16LE: case CODEC_ID_PCM_U16BE: case CODEC_ID_PCM_S8: case CODEC_ID_PCM_U8: case CODEC_ID_PCM_ALAW: case CODEC_ID_PCM_MULAW: st->codec->frame_size = 1; break; default: /* This is probably wrong, but it prevents a crash later */ st->codec->frame_size = 1; break; } } else if (type == AVMEDIA_TYPE_VIDEO) { get_le32(pb); get_le32(pb); get_byte(pb); size = get_le16(pb); /* size */ sizeX= get_le32(pb); /* size */ st->codec->width = get_le32(pb); st->codec->height = get_le32(pb); /* not available for asf */ get_le16(pb); /* panes */ st->codec->bits_per_coded_sample = get_le16(pb); /* depth */ tag1 = get_le32(pb); url_fskip(pb, 20); // av_log(s, AV_LOG_DEBUG, "size:%d tsize:%d sizeX:%d\n", size, total_size, sizeX); size= sizeX; if (size > 40) { st->codec->extradata_size = size - 40; st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); get_buffer(pb, st->codec->extradata, st->codec->extradata_size); } /* Extract palette from extradata if bpp <= 8 */ /* This code assumes that extradata contains only palette */ /* This is true for all paletted codecs implemented in ffmpeg */ if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) { st->codec->palctrl = av_mallocz(sizeof(AVPaletteControl)); #if HAVE_BIGENDIAN for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++) st->codec->palctrl->palette[i] = bswap_32(((uint32_t*)st->codec->extradata)[i]); #else memcpy(st->codec->palctrl->palette, st->codec->extradata, FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)); #endif st->codec->palctrl->palette_changed = 1; } st->codec->codec_tag = tag1; st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, tag1); if(tag1 == MKTAG('D', 'V', 'R', ' ')) st->need_parsing = AVSTREAM_PARSE_FULL; if(st->codec->codec_id == CODEC_ID_H264) st->need_parsing = AVSTREAM_PARSE_FULL_ONCE; } pos2 = url_ftell(pb); url_fskip(pb, gsize - (pos2 - pos1 + 24)); } else if (!guidcmp(&g, &ff_asf_comment_header)) { int len1, len2, len3, len4, len5; len1 = get_le16(pb); len2 = get_le16(pb); len3 = get_le16(pb); len4 = get_le16(pb); len5 = get_le16(pb); get_tag(s, "title" , 0, len1); get_tag(s, "author" , 0, len2); get_tag(s, "copyright", 0, len3); get_tag(s, "comment" , 0, len4); url_fskip(pb, len5); } else if (!guidcmp(&g, &stream_bitrate_guid)) { int stream_count = get_le16(pb); int j; // av_log(s, AV_LOG_ERROR, "stream bitrate properties\n"); // av_log(s, AV_LOG_ERROR, "streams %d\n", streams); for(j = 0; j < stream_count; j++) { int flags, bitrate, stream_id; flags= get_le16(pb); bitrate= get_le32(pb); stream_id= (flags & 0x7f); // av_log(s, AV_LOG_ERROR, "flags: 0x%x stream id %d, bitrate %d\n", flags, stream_id, bitrate); asf->stream_bitrates[stream_id]= bitrate; } } else if (!guidcmp(&g, &ff_asf_language_guid)) { int j; int stream_count = get_le16(pb); for(j = 0; j < stream_count; j++) { char lang[6]; unsigned int lang_len = get_byte(pb); get_str16_nolen(pb, lang_len, lang, sizeof(lang)); if (j < 128) av_strlcpy(asf->stream_languages[j], lang, sizeof(*asf->stream_languages)); } } else if (!guidcmp(&g, &ff_asf_extended_content_header)) { int desc_count, i; desc_count = get_le16(pb); for(i=0;i<desc_count;i++) { int name_len,value_type,value_len; char name[1024]; name_len = get_le16(pb); if (name_len%2) // must be even, broken lavf versions wrote len-1 name_len += 1; get_str16_nolen(pb, name_len, name, sizeof(name)); value_type = get_le16(pb); value_len = get_le16(pb); if (!value_type && value_len%2) value_len += 1; get_tag(s, name, value_type, value_len); } } else if (!guidcmp(&g, &ff_asf_metadata_header)) { int n, stream_num, name_len, value_len, value_type, value_num; n = get_le16(pb); for(i=0;i<n;i++) { char name[1024]; get_le16(pb); //lang_list_index stream_num= get_le16(pb); name_len= get_le16(pb); value_type= get_le16(pb); value_len= get_le32(pb); get_str16_nolen(pb, name_len, name, sizeof(name)); //av_log(s, AV_LOG_ERROR, "%d %d %d %d %d <%s>\n", i, stream_num, name_len, value_type, value_len, name); value_num= get_le16(pb);//we should use get_value() here but it does not work 2 is le16 here but le32 elsewhere url_fskip(pb, value_len - 2); if(stream_num<128){ if (!strcmp(name, "AspectRatioX")) dar[stream_num].num= value_num; else if(!strcmp(name, "AspectRatioY")) dar[stream_num].den= value_num; } } } else if (!guidcmp(&g, &ff_asf_ext_stream_header)) { int ext_len, payload_ext_ct, stream_ct; uint32_t ext_d, leak_rate, stream_num; unsigned int stream_languageid_index; get_le64(pb); // starttime get_le64(pb); // endtime leak_rate = get_le32(pb); // leak-datarate get_le32(pb); // bucket-datasize get_le32(pb); // init-bucket-fullness get_le32(pb); // alt-leak-datarate get_le32(pb); // alt-bucket-datasize get_le32(pb); // alt-init-bucket-fullness get_le32(pb); // max-object-size get_le32(pb); // flags (reliable,seekable,no_cleanpoints?,resend-live-cleanpoints, rest of bits reserved) stream_num = get_le16(pb); // stream-num stream_languageid_index = get_le16(pb); // stream-language-id-index if (stream_num < 128) asf->streams[stream_num].stream_language_index = stream_languageid_index; get_le64(pb); // avg frametime in 100ns units stream_ct = get_le16(pb); //stream-name-count payload_ext_ct = get_le16(pb); //payload-extension-system-count if (stream_num < 128) bitrate[stream_num] = leak_rate; for (i=0; i<stream_ct; i++){ get_le16(pb); ext_len = get_le16(pb); url_fseek(pb, ext_len, SEEK_CUR); } for (i=0; i<payload_ext_ct; i++){ get_guid(pb, &g); ext_d=get_le16(pb); ext_len=get_le32(pb); url_fseek(pb, ext_len, SEEK_CUR); } // there could be a optional stream properties object to follow // if so the next iteration will pick it up continue; } else if (!guidcmp(&g, &ff_asf_head1_guid)) { int v1, v2; get_guid(pb, &g); v1 = get_le32(pb); v2 = get_le16(pb); continue; } else if (!guidcmp(&g, &ff_asf_marker_header)) { int i, count, name_len; char name[1024]; get_le64(pb); // reserved 16 bytes get_le64(pb); // ... count = get_le32(pb); // markers count get_le16(pb); // reserved 2 bytes name_len = get_le16(pb); // name length for(i=0;i<name_len;i++){ get_byte(pb); // skip the name } for(i=0;i<count;i++){ int64_t pres_time; int name_len; get_le64(pb); // offset, 8 bytes pres_time = get_le64(pb); // presentation time get_le16(pb); // entry length get_le32(pb); // send time get_le32(pb); // flags name_len = get_le32(pb); // name length get_str16_nolen(pb, name_len * 2, name, sizeof(name)); ff_new_chapter(s, i, (AVRational){1, 10000000}, pres_time, AV_NOPTS_VALUE, name ); } #if 0 } else if (!guidcmp(&g, &ff_asf_codec_comment_header)) { int len, v1, n, num; char str[256], *q; char tag[16]; get_guid(pb, &g); print_guid(&g); n = get_le32(pb); for(i=0;i<n;i++) { num = get_le16(pb); /* stream number */ get_str16(pb, str, sizeof(str)); get_str16(pb, str, sizeof(str)); len = get_le16(pb); q = tag; while (len > 0) { v1 = get_byte(pb); if ((q - tag) < sizeof(tag) - 1) *q++ = v1; len--; } *q = '\0'; } #endif } else if (url_feof(pb)) { return -1; } else { if (!s->keylen) { if (!guidcmp(&g, &ff_asf_content_encryption)) { av_log(s, AV_LOG_WARNING, "DRM protected stream detected, decoding will likely fail!\n"); } else if (!guidcmp(&g, &ff_asf_ext_content_encryption)) { av_log(s, AV_LOG_WARNING, "Ext DRM protected stream detected, decoding will likely fail!\n"); } else if (!guidcmp(&g, &ff_asf_digital_signature)) { av_log(s, AV_LOG_WARNING, "Digital signature detected, decoding will likely fail!\n"); } } } if(url_ftell(pb) != gpos + gsize) av_log(s, AV_LOG_DEBUG, "gpos mismatch our pos=%"PRIu64", end=%"PRIu64"\n", url_ftell(pb)-gpos, gsize); url_fseek(pb, gpos + gsize, SEEK_SET); } get_guid(pb, &g); get_le64(pb); get_byte(pb); get_byte(pb); if (url_feof(pb)) return -1; asf->data_offset = url_ftell(pb); asf->packet_size_left = 0; for(i=0; i<128; i++){ int stream_num= asf->asfid2avid[i]; if(stream_num>=0){ AVStream *st = s->streams[stream_num]; if (!st->codec->bit_rate) st->codec->bit_rate = bitrate[i]; if (dar[i].num > 0 && dar[i].den > 0) av_reduce(&st->sample_aspect_ratio.num, &st->sample_aspect_ratio.den, dar[i].num, dar[i].den, INT_MAX); //av_log(s, AV_LOG_ERROR, "dar %d:%d sar=%d:%d\n", dar[i].num, dar[i].den, st->sample_aspect_ratio.num, st->sample_aspect_ratio.den); // copy and convert language codes to the frontend if (asf->streams[i].stream_language_index < 128) { const char *rfc1766 = asf->stream_languages[asf->streams[i].stream_language_index]; if (rfc1766 && strlen(rfc1766) > 1) { const char primary_tag[3] = { rfc1766[0], rfc1766[1], '\0' }; // ignore country code if any const char *iso6392 = av_convert_lang_to(primary_tag, AV_LANG_ISO639_2_BIBL); if (iso6392) av_metadata_set2(&st->metadata, "language", iso6392, 0); } } } } return 0; } | 25,398 |
1 | int64_t qmp_guest_file_open(const char *path, bool has_mode, const char *mode, Error **errp) { FILE *fh; Error *local_err = NULL; int fd; int64_t ret = -1, handle; if (!has_mode) { mode = "r"; } slog("guest-file-open called, filepath: %s, mode: %s", path, mode); fh = safe_open_or_create(path, mode, &local_err); if (local_err != NULL) { error_propagate(errp, local_err); return -1; } /* set fd non-blocking to avoid common use cases (like reading from a * named pipe) from hanging the agent */ fd = fileno(fh); ret = fcntl(fd, F_GETFL); ret = fcntl(fd, F_SETFL, ret | O_NONBLOCK); if (ret == -1) { error_setg_errno(errp, errno, "failed to make file '%s' non-blocking", path); fclose(fh); return -1; } handle = guest_file_handle_add(fh, errp); if (error_is_set(errp)) { fclose(fh); return -1; } slog("guest-file-open, handle: %" PRId64, handle); return handle; } | 25,399 |
1 | static av_cold int rl2_read_header(AVFormatContext *s) { AVIOContext *pb = s->pb; AVStream *st; unsigned int frame_count; unsigned int audio_frame_counter = 0; unsigned int video_frame_counter = 0; unsigned int back_size; unsigned short sound_rate; unsigned short rate; unsigned short channels; unsigned short def_sound_size; unsigned int signature; unsigned int pts_den = 11025; /* video only case */ unsigned int pts_num = 1103; unsigned int* chunk_offset = NULL; int* chunk_size = NULL; int* audio_size = NULL; int i; int ret = 0; avio_skip(pb,4); /* skip FORM tag */ back_size = avio_rl32(pb); /**< get size of the background frame */ signature = avio_rb32(pb); avio_skip(pb, 4); /* data size */ frame_count = avio_rl32(pb); /* disallow back_sizes and frame_counts that may lead to overflows later */ if(back_size > INT_MAX/2 || frame_count > INT_MAX / sizeof(uint32_t)) avio_skip(pb, 2); /* encoding mentod */ sound_rate = avio_rl16(pb); rate = avio_rl16(pb); channels = avio_rl16(pb); def_sound_size = avio_rl16(pb); /** setup video stream */ st = avformat_new_stream(s, NULL); if(!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = AV_CODEC_ID_RL2; st->codec->codec_tag = 0; /* no fourcc */ st->codec->width = 320; st->codec->height = 200; /** allocate and fill extradata */ st->codec->extradata_size = EXTRADATA1_SIZE; if(signature == RLV3_TAG && back_size > 0) st->codec->extradata_size += back_size; st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); if(!st->codec->extradata) return AVERROR(ENOMEM); if(avio_read(pb,st->codec->extradata,st->codec->extradata_size) != st->codec->extradata_size) return AVERROR(EIO); /** setup audio stream if present */ if(sound_rate){ pts_num = def_sound_size; pts_den = rate; st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = AV_CODEC_ID_PCM_U8; st->codec->codec_tag = 1; st->codec->channels = channels; st->codec->bits_per_coded_sample = 8; st->codec->sample_rate = rate; st->codec->bit_rate = st->codec->channels * st->codec->sample_rate * st->codec->bits_per_coded_sample; st->codec->block_align = st->codec->channels * st->codec->bits_per_coded_sample / 8; avpriv_set_pts_info(st,32,1,rate); avpriv_set_pts_info(s->streams[0], 32, pts_num, pts_den); chunk_size = av_malloc(frame_count * sizeof(uint32_t)); audio_size = av_malloc(frame_count * sizeof(uint32_t)); chunk_offset = av_malloc(frame_count * sizeof(uint32_t)); if(!chunk_size || !audio_size || !chunk_offset){ av_free(chunk_size); av_free(audio_size); av_free(chunk_offset); return AVERROR(ENOMEM); /** read offset and size tables */ for(i=0; i < frame_count;i++) chunk_size[i] = avio_rl32(pb); for(i=0; i < frame_count;i++) chunk_offset[i] = avio_rl32(pb); for(i=0; i < frame_count;i++) audio_size[i] = avio_rl32(pb) & 0xFFFF; /** build the sample index */ for(i=0;i<frame_count;i++){ if(chunk_size[i] < 0 || audio_size[i] > chunk_size[i]){ ret = AVERROR_INVALIDDATA; break; if(sound_rate && audio_size[i]){ av_add_index_entry(s->streams[1], chunk_offset[i], audio_frame_counter,audio_size[i], 0, AVINDEX_KEYFRAME); audio_frame_counter += audio_size[i] / channels; av_add_index_entry(s->streams[0], chunk_offset[i] + audio_size[i], video_frame_counter,chunk_size[i]-audio_size[i],0,AVINDEX_KEYFRAME); ++video_frame_counter; av_free(chunk_size); av_free(audio_size); av_free(chunk_offset); return ret; | 25,400 |
1 | static int cdxl_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *pkt) { CDXLVideoContext *c = avctx->priv_data; AVFrame * const p = data; int ret, w, h, encoding, aligned_width, buf_size = pkt->size; const uint8_t *buf = pkt->data; if (buf_size < 32) return AVERROR_INVALIDDATA; encoding = buf[1] & 7; c->format = buf[1] & 0xE0; w = AV_RB16(&buf[14]); h = AV_RB16(&buf[16]); c->bpp = buf[19]; c->palette_size = AV_RB16(&buf[20]); c->palette = buf + 32; c->video = c->palette + c->palette_size; c->video_size = buf_size - c->palette_size - 32; if (c->palette_size > 512) return AVERROR_INVALIDDATA; if (buf_size < c->palette_size + 32) return AVERROR_INVALIDDATA; if (c->bpp < 1) return AVERROR_INVALIDDATA; if (c->format != BIT_PLANAR && c->format != BIT_LINE && c->format != CHUNKY) { avpriv_request_sample(avctx, "Pixel format 0x%0x", c->format); return AVERROR_PATCHWELCOME; } if ((ret = ff_set_dimensions(avctx, w, h)) < 0) return ret; if (c->format == CHUNKY) aligned_width = avctx->width; else aligned_width = FFALIGN(c->avctx->width, 16); c->padded_bits = aligned_width - c->avctx->width; if (c->video_size < aligned_width * avctx->height * c->bpp / 8) return AVERROR_INVALIDDATA; if (!encoding && c->palette_size && c->bpp <= 8) { avctx->pix_fmt = AV_PIX_FMT_PAL8; } else if (encoding == 1 && (c->bpp == 6 || c->bpp == 8)) { if (c->palette_size != (1 << (c->bpp - 1))) return AVERROR_INVALIDDATA; avctx->pix_fmt = AV_PIX_FMT_BGR24; } else if (!encoding && c->bpp == 24 && c->format == CHUNKY && !c->palette_size) { avctx->pix_fmt = AV_PIX_FMT_RGB24; } else { avpriv_request_sample(avctx, "Encoding %d, bpp %d and format 0x%x", encoding, c->bpp, c->format); return AVERROR_PATCHWELCOME; } if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; p->pict_type = AV_PICTURE_TYPE_I; if (encoding) { av_fast_padded_malloc(&c->new_video, &c->new_video_size, h * w + AV_INPUT_BUFFER_PADDING_SIZE); if (!c->new_video) return AVERROR(ENOMEM); if (c->bpp == 8) cdxl_decode_ham8(c, p); else cdxl_decode_ham6(c, p); } else if (avctx->pix_fmt == AV_PIX_FMT_PAL8) { cdxl_decode_rgb(c, p); } else { cdxl_decode_raw(c, p); } *got_frame = 1; return buf_size; } | 25,402 |
1 | int32 floatx80_to_int32_round_to_zero( floatx80 a STATUS_PARAM ) { flag aSign; int32 aExp, shiftCount; uint64_t aSig, savedASig; int32 z; aSig = extractFloatx80Frac( a ); aExp = extractFloatx80Exp( a ); aSign = extractFloatx80Sign( a ); if ( 0x401E < aExp ) { if ( ( aExp == 0x7FFF ) && (uint64_t) ( aSig<<1 ) ) aSign = 0; goto invalid; } else if ( aExp < 0x3FFF ) { if ( aExp || aSig ) STATUS(float_exception_flags) |= float_flag_inexact; return 0; } shiftCount = 0x403E - aExp; savedASig = aSig; aSig >>= shiftCount; z = aSig; if ( aSign ) z = - z; if ( ( z < 0 ) ^ aSign ) { invalid: float_raise( float_flag_invalid STATUS_VAR); return aSign ? (int32_t) 0x80000000 : 0x7FFFFFFF; } if ( ( aSig<<shiftCount ) != savedASig ) { STATUS(float_exception_flags) |= float_flag_inexact; } return z; } | 25,403 |
1 | static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); RawVideoContext *context = avctx->priv_data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; int linesize_align = 4; int res, len; int need_copy = !avpkt->buf || context->is_2_4_bpp || context->is_yuv2; AVFrame *frame = data; AVPicture *picture = data; frame->pict_type = AV_PICTURE_TYPE_I; frame->key_frame = 1; frame->reordered_opaque = avctx->reordered_opaque; frame->pkt_pts = avctx->pkt->pts; av_frame_set_pkt_pos (frame, avctx->pkt->pos); av_frame_set_pkt_duration(frame, avctx->pkt->duration); if (context->tff >= 0) { frame->interlaced_frame = 1; frame->top_field_first = context->tff; } if ((res = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0) return res; if (need_copy) frame->buf[0] = av_buffer_alloc(context->frame_size); else frame->buf[0] = av_buffer_ref(avpkt->buf); if (!frame->buf[0]) return AVERROR(ENOMEM); //2bpp and 4bpp raw in avi and mov (yes this is ugly ...) if (context->is_2_4_bpp) { int i; uint8_t *dst = frame->buf[0]->data; buf_size = context->frame_size - AVPALETTE_SIZE; if (avctx->bits_per_coded_sample == 4) { for (i = 0; 2 * i + 1 < buf_size && i<avpkt->size; i++) { dst[2 * i + 0] = buf[i] >> 4; dst[2 * i + 1] = buf[i] & 15; } linesize_align = 8; } else { av_assert0(avctx->bits_per_coded_sample == 2); for (i = 0; 4 * i + 3 < buf_size && i<avpkt->size; i++) { dst[4 * i + 0] = buf[i] >> 6; dst[4 * i + 1] = buf[i] >> 4 & 3; dst[4 * i + 2] = buf[i] >> 2 & 3; dst[4 * i + 3] = buf[i] & 3; } linesize_align = 16; } buf = dst; } else if (need_copy) { memcpy(frame->buf[0]->data, buf, FFMIN(buf_size, context->frame_size)); buf = frame->buf[0]->data; } if (avctx->codec_tag == MKTAG('A', 'V', '1', 'x') || avctx->codec_tag == MKTAG('A', 'V', 'u', 'p')) buf += buf_size - context->frame_size; len = context->frame_size - (avctx->pix_fmt==AV_PIX_FMT_PAL8 ? AVPALETTE_SIZE : 0); if (buf_size < len) { av_log(avctx, AV_LOG_ERROR, "Invalid buffer size, packet size %d < expected frame_size %d\n", buf_size, len); av_buffer_unref(&frame->buf[0]); return AVERROR(EINVAL); } if ((res = avpicture_fill(picture, buf, avctx->pix_fmt, avctx->width, avctx->height)) < 0) { av_buffer_unref(&frame->buf[0]); return res; } if (avctx->pix_fmt == AV_PIX_FMT_PAL8) { const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); if (pal) { av_buffer_unref(&context->palette); context->palette = av_buffer_alloc(AVPALETTE_SIZE); if (!context->palette) { av_buffer_unref(&frame->buf[0]); return AVERROR(ENOMEM); } memcpy(context->palette->data, pal, AVPALETTE_SIZE); frame->palette_has_changed = 1; } } if ((avctx->pix_fmt==AV_PIX_FMT_BGR24 || avctx->pix_fmt==AV_PIX_FMT_GRAY8 || avctx->pix_fmt==AV_PIX_FMT_RGB555LE || avctx->pix_fmt==AV_PIX_FMT_RGB555BE || avctx->pix_fmt==AV_PIX_FMT_RGB565LE || avctx->pix_fmt==AV_PIX_FMT_MONOWHITE || avctx->pix_fmt==AV_PIX_FMT_PAL8) && FFALIGN(frame->linesize[0], linesize_align) * avctx->height <= buf_size) frame->linesize[0] = FFALIGN(frame->linesize[0], linesize_align); if (avctx->pix_fmt == AV_PIX_FMT_NV12 && avctx->codec_tag == MKTAG('N', 'V', '1', '2') && FFALIGN(frame->linesize[0], linesize_align) * avctx->height + FFALIGN(frame->linesize[1], linesize_align) * ((avctx->height + 1) / 2) <= buf_size) { int la0 = FFALIGN(frame->linesize[0], linesize_align); frame->data[1] += (la0 - frame->linesize[0]) * avctx->height; frame->linesize[0] = la0; frame->linesize[1] = FFALIGN(frame->linesize[1], linesize_align); } if ((avctx->pix_fmt == AV_PIX_FMT_PAL8 && buf_size < context->frame_size) || (desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)) { frame->buf[1] = av_buffer_ref(context->palette); if (!frame->buf[1]) { av_buffer_unref(&frame->buf[0]); return AVERROR(ENOMEM); } frame->data[1] = frame->buf[1]->data; } if (avctx->pix_fmt == AV_PIX_FMT_BGR24 && ((frame->linesize[0] + 3) & ~3) * avctx->height <= buf_size) frame->linesize[0] = (frame->linesize[0] + 3) & ~3; if (context->flip) flip(avctx, picture); if (avctx->codec_tag == MKTAG('Y', 'V', '1', '2') || avctx->codec_tag == MKTAG('Y', 'V', '1', '6') || avctx->codec_tag == MKTAG('Y', 'V', '2', '4') || avctx->codec_tag == MKTAG('Y', 'V', 'U', '9')) FFSWAP(uint8_t *, picture->data[1], picture->data[2]); if (avctx->codec_tag == AV_RL32("I420") && (avctx->width+1)*(avctx->height+1) * 3/2 == buf_size) { picture->data[1] = picture->data[1] + (avctx->width+1)*(avctx->height+1) -avctx->width*avctx->height; picture->data[2] = picture->data[2] + ((avctx->width+1)*(avctx->height+1) -avctx->width*avctx->height)*5/4; } if (avctx->codec_tag == AV_RL32("yuv2") && avctx->pix_fmt == AV_PIX_FMT_YUYV422) { int x, y; uint8_t *line = picture->data[0]; for (y = 0; y < avctx->height; y++) { for (x = 0; x < avctx->width; x++) line[2 * x + 1] ^= 0x80; line += picture->linesize[0]; } } if (avctx->codec_tag == AV_RL32("YVYU") && avctx->pix_fmt == AV_PIX_FMT_YUYV422) { int x, y; uint8_t *line = picture->data[0]; for(y = 0; y < avctx->height; y++) { for(x = 0; x < avctx->width - 1; x += 2) FFSWAP(uint8_t, line[2*x + 1], line[2*x + 3]); line += picture->linesize[0]; } } if (avctx->field_order > AV_FIELD_PROGRESSIVE) { /* we have interlaced material flagged in container */ frame->interlaced_frame = 1; if (avctx->field_order == AV_FIELD_TT || avctx->field_order == AV_FIELD_TB) frame->top_field_first = 1; } *got_frame = 1; return buf_size; } | 25,405 |
1 | int ff_vaapi_mpeg_end_frame(AVCodecContext *avctx) { struct vaapi_context * const vactx = avctx->hwaccel_context; MpegEncContext *s = avctx->priv_data; int ret; ret = ff_vaapi_commit_slices(vactx); if (ret < 0) goto finish; ret = ff_vaapi_render_picture(vactx, ff_vaapi_get_surface_id(&s->current_picture_ptr->f)); if (ret < 0) goto finish; ff_mpeg_draw_horiz_band(s, 0, s->avctx->height); finish: ff_vaapi_common_end_frame(avctx); return ret; } | 25,406 |
1 | static void usb_uas_command(UASDevice *uas, uas_ui *ui) { UASRequest *req; uint32_t len; uint16_t tag = be16_to_cpu(ui->hdr.tag); if (uas_using_streams(uas) && tag > UAS_MAX_STREAMS) { goto invalid_tag; } req = usb_uas_find_request(uas, tag); if (req) { goto overlapped_tag; } req = usb_uas_alloc_request(uas, ui); if (req->dev == NULL) { goto bad_target; } trace_usb_uas_command(uas->dev.addr, req->tag, usb_uas_get_lun(req->lun), req->lun >> 32, req->lun & 0xffffffff); QTAILQ_INSERT_TAIL(&uas->requests, req, next); if (uas_using_streams(uas) && uas->data3[req->tag] != NULL) { req->data = uas->data3[req->tag]; req->data_async = true; uas->data3[req->tag] = NULL; } req->req = scsi_req_new(req->dev, req->tag, usb_uas_get_lun(req->lun), ui->command.cdb, req); if (uas->requestlog) { scsi_req_print(req->req); } len = scsi_req_enqueue(req->req); if (len) { req->data_size = len; scsi_req_continue(req->req); } overlapped_tag: usb_uas_queue_fake_sense(uas, tag, sense_code_OVERLAPPED_COMMANDS); bad_target: usb_uas_queue_fake_sense(uas, tag, sense_code_LUN_NOT_SUPPORTED); g_free(req); } | 25,407 |
1 | static int rscc_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { RsccContext *ctx = avctx->priv_data; GetByteContext *gbc = &ctx->gbc; GetByteContext tiles_gbc; AVFrame *frame = data; const uint8_t *pixels, *raw; uint8_t *inflated_tiles = NULL; int tiles_nb, packed_size, pixel_size = 0; int i, ret = 0; bytestream2_init(gbc, avpkt->data, avpkt->size); /* Size check */ if (bytestream2_get_bytes_left(gbc) < 12) { av_log(avctx, AV_LOG_ERROR, "Packet too small (%d)\n", avpkt->size); return AVERROR_INVALIDDATA; /* Read number of tiles, and allocate the array */ tiles_nb = bytestream2_get_le16(gbc); av_fast_malloc(&ctx->tiles, &ctx->tiles_size, tiles_nb * sizeof(*ctx->tiles)); if (!ctx->tiles) { ret = AVERROR(ENOMEM); av_log(avctx, AV_LOG_DEBUG, "Frame with %d tiles.\n", tiles_nb); /* When there are more than 5 tiles, they are packed together with * a size header. When that size does not match the number of tiles * times the tile size, it means it needs to be inflated as well */ if (tiles_nb > 5) { uLongf packed_tiles_size; if (tiles_nb < 32) packed_tiles_size = bytestream2_get_byte(gbc); else packed_tiles_size = bytestream2_get_le16(gbc); ff_dlog(avctx, "packed tiles of size %lu.\n", packed_tiles_size); /* If necessary, uncompress tiles, and hijack the bytestream reader */ if (packed_tiles_size != tiles_nb * TILE_SIZE) { uLongf length = tiles_nb * TILE_SIZE; inflated_tiles = av_malloc(length); if (!inflated_tiles) { ret = AVERROR(ENOMEM); ret = uncompress(inflated_tiles, &length, gbc->buffer, packed_tiles_size); if (ret) { av_log(avctx, AV_LOG_ERROR, "Tile deflate error %d.\n", ret); ret = AVERROR_UNKNOWN; /* Skip the compressed tile section in the main byte reader, * and point it to read the newly uncompressed data */ bytestream2_skip(gbc, packed_tiles_size); bytestream2_init(&tiles_gbc, inflated_tiles, length); gbc = &tiles_gbc; /* Fill in array of tiles, keeping track of how many pixels are updated */ for (i = 0; i < tiles_nb; i++) { ctx->tiles[i].x = bytestream2_get_le16(gbc); ctx->tiles[i].w = bytestream2_get_le16(gbc); ctx->tiles[i].y = bytestream2_get_le16(gbc); ctx->tiles[i].h = bytestream2_get_le16(gbc); pixel_size += ctx->tiles[i].w * ctx->tiles[i].h * ctx->component_size; ff_dlog(avctx, "tile %d orig(%d,%d) %dx%d.\n", i, ctx->tiles[i].x, ctx->tiles[i].y, ctx->tiles[i].w, ctx->tiles[i].h); if (ctx->tiles[i].w == 0 || ctx->tiles[i].h == 0) { av_log(avctx, AV_LOG_ERROR, "invalid tile %d at (%d.%d) with size %dx%d.\n", i, ctx->tiles[i].x, ctx->tiles[i].y, ctx->tiles[i].w, ctx->tiles[i].h); } else if (ctx->tiles[i].x + ctx->tiles[i].w > avctx->width || ctx->tiles[i].y + ctx->tiles[i].h > avctx->height) { av_log(avctx, AV_LOG_ERROR, "out of bounds tile %d at (%d.%d) with size %dx%d.\n", i, ctx->tiles[i].x, ctx->tiles[i].y, ctx->tiles[i].w, ctx->tiles[i].h); /* Reset the reader in case it had been modified before */ gbc = &ctx->gbc; /* Extract how much pixel data the tiles contain */ if (pixel_size < 0x100) packed_size = bytestream2_get_byte(gbc); else if (pixel_size < 0x10000) packed_size = bytestream2_get_le16(gbc); else if (pixel_size < 0x1000000) packed_size = bytestream2_get_le24(gbc); else packed_size = bytestream2_get_le32(gbc); ff_dlog(avctx, "pixel_size %d packed_size %d.\n", pixel_size, packed_size); if (packed_size < 0) { av_log(avctx, AV_LOG_ERROR, "Invalid tile size %d\n", packed_size); /* Get pixels buffer, it may be deflated or just raw */ if (pixel_size == packed_size) { if (bytestream2_get_bytes_left(gbc) < pixel_size) { av_log(avctx, AV_LOG_ERROR, "Insufficient input for %d\n", pixel_size); pixels = gbc->buffer; } else { uLongf len = ctx->inflated_size; if (bytestream2_get_bytes_left(gbc) < packed_size) { av_log(avctx, AV_LOG_ERROR, "Insufficient input for %d\n", packed_size); ret = uncompress(ctx->inflated_buf, &len, gbc->buffer, packed_size); if (ret) { av_log(avctx, AV_LOG_ERROR, "Pixel deflate error %d.\n", ret); ret = AVERROR_UNKNOWN; pixels = ctx->inflated_buf; /* Allocate when needed */ ret = ff_reget_buffer(avctx, ctx->reference); if (ret < 0) /* Pointer to actual pixels, will be updated when data is consumed */ raw = pixels; for (i = 0; i < tiles_nb; i++) { uint8_t *dst = ctx->reference->data[0] + ctx->reference->linesize[0] * (avctx->height - ctx->tiles[i].y - 1) + ctx->tiles[i].x * ctx->component_size; av_image_copy_plane(dst, -1 * ctx->reference->linesize[0], raw, ctx->tiles[i].w * ctx->component_size, ctx->tiles[i].w * ctx->component_size, ctx->tiles[i].h); raw += ctx->tiles[i].w * ctx->component_size * ctx->tiles[i].h; /* Frame is ready to be output */ ret = av_frame_ref(frame, ctx->reference); if (ret < 0) /* Keyframe when the number of pixels updated matches the whole surface */ if (pixel_size == ctx->inflated_size) { frame->pict_type = AV_PICTURE_TYPE_I; frame->key_frame = 1; } else { frame->pict_type = AV_PICTURE_TYPE_P; /* Palette handling */ if (avctx->pix_fmt == AV_PIX_FMT_PAL8) { int size; const uint8_t *palette = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size); if (palette && size == AVPALETTE_SIZE) { frame->palette_has_changed = 1; memcpy(ctx->palette, palette, AVPALETTE_SIZE); } else if (palette) { av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size); memcpy (frame->data[1], ctx->palette, AVPALETTE_SIZE); *got_frame = 1; ret = avpkt->size; end: av_free(inflated_tiles); return ret; | 25,408 |
1 | static void swap_channel_layouts_on_filter(AVFilterContext *filter) { AVFilterLink *link = NULL; int i, j, k; for (i = 0; i < filter->nb_inputs; i++) { link = filter->inputs[i]; if (link->type == AVMEDIA_TYPE_AUDIO && link->out_channel_layouts->nb_channel_layouts == 1) break; } if (i == filter->nb_inputs) return; for (i = 0; i < filter->nb_outputs; i++) { AVFilterLink *outlink = filter->outputs[i]; int best_idx, best_score = INT_MIN, best_count_diff = INT_MAX; if (outlink->type != AVMEDIA_TYPE_AUDIO || outlink->in_channel_layouts->nb_channel_layouts < 2) continue; for (j = 0; j < outlink->in_channel_layouts->nb_channel_layouts; j++) { uint64_t in_chlayout = link->out_channel_layouts->channel_layouts[0]; uint64_t out_chlayout = outlink->in_channel_layouts->channel_layouts[j]; int in_channels = av_get_channel_layout_nb_channels(in_chlayout); int out_channels = av_get_channel_layout_nb_channels(out_chlayout); int count_diff = out_channels - in_channels; int matched_channels, extra_channels; int score = 0; /* channel substitution */ for (k = 0; k < FF_ARRAY_ELEMS(ch_subst); k++) { uint64_t cmp0 = ch_subst[k][0]; uint64_t cmp1 = ch_subst[k][1]; if (( in_chlayout & cmp0) && (!(out_chlayout & cmp0)) && (out_chlayout & cmp1) && (!( in_chlayout & cmp1))) { in_chlayout &= ~cmp0; out_chlayout &= ~cmp1; /* add score for channel match, minus a deduction for having to do the substitution */ score += 10 * av_get_channel_layout_nb_channels(cmp1) - 2; } } /* no penalty for LFE channel mismatch */ if ( (in_chlayout & AV_CH_LOW_FREQUENCY) && (out_chlayout & AV_CH_LOW_FREQUENCY)) score += 10; in_chlayout &= ~AV_CH_LOW_FREQUENCY; out_chlayout &= ~AV_CH_LOW_FREQUENCY; matched_channels = av_get_channel_layout_nb_channels(in_chlayout & out_chlayout); extra_channels = av_get_channel_layout_nb_channels(out_chlayout & (~in_chlayout)); score += 10 * matched_channels - 5 * extra_channels; if (score > best_score || (count_diff < best_count_diff && score == best_score)) { best_score = score; best_idx = j; best_count_diff = count_diff; } } FFSWAP(uint64_t, outlink->in_channel_layouts->channel_layouts[0], outlink->in_channel_layouts->channel_layouts[best_idx]); } } | 25,409 |
0 | int img_convert(AVPicture *dst, int dst_pix_fmt, const AVPicture *src, int src_pix_fmt, int src_width, int src_height) { static int inited; int i, ret, dst_width, dst_height, int_pix_fmt; const PixFmtInfo *src_pix, *dst_pix; const ConvertEntry *ce; AVPicture tmp1, *tmp = &tmp1; if (src_pix_fmt < 0 || src_pix_fmt >= PIX_FMT_NB || dst_pix_fmt < 0 || dst_pix_fmt >= PIX_FMT_NB) return -1; if (src_width <= 0 || src_height <= 0) return 0; if (!inited) { inited = 1; img_convert_init(); } dst_width = src_width; dst_height = src_height; dst_pix = &pix_fmt_info[dst_pix_fmt]; src_pix = &pix_fmt_info[src_pix_fmt]; if (src_pix_fmt == dst_pix_fmt) { /* no conversion needed: just copy */ av_picture_copy(dst, src, dst_pix_fmt, dst_width, dst_height); return 0; } ce = &convert_table[src_pix_fmt][dst_pix_fmt]; if (ce->convert) { /* specific conversion routine */ ce->convert(dst, src, dst_width, dst_height); return 0; } /* gray to YUV */ if (is_yuv_planar(dst_pix) && src_pix_fmt == PIX_FMT_GRAY8) { int w, h, y; uint8_t *d; if (dst_pix->color_type == FF_COLOR_YUV_JPEG) { ff_img_copy_plane(dst->data[0], dst->linesize[0], src->data[0], src->linesize[0], dst_width, dst_height); } else { img_apply_table(dst->data[0], dst->linesize[0], src->data[0], src->linesize[0], dst_width, dst_height, y_jpeg_to_ccir); } /* fill U and V with 128 */ w = dst_width; h = dst_height; w >>= dst_pix->x_chroma_shift; h >>= dst_pix->y_chroma_shift; for(i = 1; i <= 2; i++) { d = dst->data[i]; for(y = 0; y< h; y++) { memset(d, 128, w); d += dst->linesize[i]; } } return 0; } /* YUV to gray */ if (is_yuv_planar(src_pix) && dst_pix_fmt == PIX_FMT_GRAY8) { if (src_pix->color_type == FF_COLOR_YUV_JPEG) { ff_img_copy_plane(dst->data[0], dst->linesize[0], src->data[0], src->linesize[0], dst_width, dst_height); } else { img_apply_table(dst->data[0], dst->linesize[0], src->data[0], src->linesize[0], dst_width, dst_height, y_ccir_to_jpeg); } return 0; } /* YUV to YUV planar */ if (is_yuv_planar(dst_pix) && is_yuv_planar(src_pix)) { int x_shift, y_shift, w, h, xy_shift; void (*resize_func)(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height); /* compute chroma size of the smallest dimensions */ w = dst_width; h = dst_height; if (dst_pix->x_chroma_shift >= src_pix->x_chroma_shift) w >>= dst_pix->x_chroma_shift; else w >>= src_pix->x_chroma_shift; if (dst_pix->y_chroma_shift >= src_pix->y_chroma_shift) h >>= dst_pix->y_chroma_shift; else h >>= src_pix->y_chroma_shift; x_shift = (dst_pix->x_chroma_shift - src_pix->x_chroma_shift); y_shift = (dst_pix->y_chroma_shift - src_pix->y_chroma_shift); xy_shift = ((x_shift & 0xf) << 4) | (y_shift & 0xf); /* there must be filters for conversion at least from and to YUV444 format */ switch(xy_shift) { case 0x00: resize_func = ff_img_copy_plane; break; case 0x10: resize_func = shrink21; break; case 0x20: resize_func = shrink41; break; case 0x01: resize_func = shrink12; break; case 0x11: resize_func = ff_shrink22; break; case 0x22: resize_func = ff_shrink44; break; case 0xf0: resize_func = grow21; break; case 0x0f: resize_func = grow12; break; case 0xe0: resize_func = grow41; break; case 0xff: resize_func = grow22; break; case 0xee: resize_func = grow44; break; case 0xf1: resize_func = conv411; break; default: /* currently not handled */ goto no_chroma_filter; } ff_img_copy_plane(dst->data[0], dst->linesize[0], src->data[0], src->linesize[0], dst_width, dst_height); for(i = 1;i <= 2; i++) resize_func(dst->data[i], dst->linesize[i], src->data[i], src->linesize[i], dst_width>>dst_pix->x_chroma_shift, dst_height>>dst_pix->y_chroma_shift); /* if yuv color space conversion is needed, we do it here on the destination image */ if (dst_pix->color_type != src_pix->color_type) { const uint8_t *y_table, *c_table; if (dst_pix->color_type == FF_COLOR_YUV) { y_table = y_jpeg_to_ccir; c_table = c_jpeg_to_ccir; } else { y_table = y_ccir_to_jpeg; c_table = c_ccir_to_jpeg; } img_apply_table(dst->data[0], dst->linesize[0], dst->data[0], dst->linesize[0], dst_width, dst_height, y_table); for(i = 1;i <= 2; i++) img_apply_table(dst->data[i], dst->linesize[i], dst->data[i], dst->linesize[i], dst_width>>dst_pix->x_chroma_shift, dst_height>>dst_pix->y_chroma_shift, c_table); } return 0; } no_chroma_filter: /* try to use an intermediate format */ if (src_pix_fmt == PIX_FMT_YUYV422 || dst_pix_fmt == PIX_FMT_YUYV422) { /* specific case: convert to YUV422P first */ int_pix_fmt = PIX_FMT_YUV422P; } else if (src_pix_fmt == PIX_FMT_UYVY422 || dst_pix_fmt == PIX_FMT_UYVY422) { /* specific case: convert to YUV422P first */ int_pix_fmt = PIX_FMT_YUV422P; } else if (src_pix_fmt == PIX_FMT_UYYVYY411 || dst_pix_fmt == PIX_FMT_UYYVYY411) { /* specific case: convert to YUV411P first */ int_pix_fmt = PIX_FMT_YUV411P; } else if ((src_pix->color_type == FF_COLOR_GRAY && src_pix_fmt != PIX_FMT_GRAY8) || (dst_pix->color_type == FF_COLOR_GRAY && dst_pix_fmt != PIX_FMT_GRAY8)) { /* gray8 is the normalized format */ int_pix_fmt = PIX_FMT_GRAY8; } else if ((is_yuv_planar(src_pix) && src_pix_fmt != PIX_FMT_YUV444P && src_pix_fmt != PIX_FMT_YUVJ444P)) { /* yuv444 is the normalized format */ if (src_pix->color_type == FF_COLOR_YUV_JPEG) int_pix_fmt = PIX_FMT_YUVJ444P; else int_pix_fmt = PIX_FMT_YUV444P; } else if ((is_yuv_planar(dst_pix) && dst_pix_fmt != PIX_FMT_YUV444P && dst_pix_fmt != PIX_FMT_YUVJ444P)) { /* yuv444 is the normalized format */ if (dst_pix->color_type == FF_COLOR_YUV_JPEG) int_pix_fmt = PIX_FMT_YUVJ444P; else int_pix_fmt = PIX_FMT_YUV444P; } else { /* the two formats are rgb or gray8 or yuv[j]444p */ if (src_pix->is_alpha && dst_pix->is_alpha) int_pix_fmt = PIX_FMT_RGB32; else int_pix_fmt = PIX_FMT_RGB24; } if (src_pix_fmt == int_pix_fmt) return -1; if (avpicture_alloc(tmp, int_pix_fmt, dst_width, dst_height) < 0) return -1; ret = -1; if (img_convert(tmp, int_pix_fmt, src, src_pix_fmt, src_width, src_height) < 0) goto fail1; if (img_convert(dst, dst_pix_fmt, tmp, int_pix_fmt, dst_width, dst_height) < 0) goto fail1; ret = 0; fail1: avpicture_free(tmp); return ret; } | 25,410 |
1 | static void nal_send(AVFormatContext *ctx, const uint8_t *buf, int len, int last_packet_of_frame) { RTPMuxContext *rtp_ctx = ctx->priv_data; int rtp_payload_size = rtp_ctx->max_payload_size - RTP_HEVC_HEADERS_SIZE; int nal_type = (buf[0] >> 1) & 0x3F; /* send it as one single NAL unit? */ if (len <= rtp_ctx->max_payload_size) { int buffered_size = rtp_ctx->buf_ptr - rtp_ctx->buf; /* Flush buffered NAL units if the current unit doesn't fit */ if (buffered_size + 2 + len > rtp_ctx->max_payload_size) { flush_buffered(ctx, 0); buffered_size = 0; } /* If the NAL unit fits including the framing, write the unit * to the buffer as an aggregate packet, otherwise flush and * send as single NAL. */ if (buffered_size + 4 + len <= rtp_ctx->max_payload_size) { if (buffered_size == 0) { *rtp_ctx->buf_ptr++ = 48 << 1; *rtp_ctx->buf_ptr++ = 1; } AV_WB16(rtp_ctx->buf_ptr, len); rtp_ctx->buf_ptr += 2; memcpy(rtp_ctx->buf_ptr, buf, len); rtp_ctx->buf_ptr += len; rtp_ctx->buffered_nals++; } else { flush_buffered(ctx, 0); ff_rtp_send_data(ctx, buf, len, last_packet_of_frame); } } else { flush_buffered(ctx, 0); /* create the HEVC payload header and transmit the buffer as fragmentation units (FU) 0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |F| Type | LayerId | TID | +-------------+-----------------+ F = 0 Type = 49 (fragmentation unit (FU)) LayerId = 0 TID = 1 */ rtp_ctx->buf[0] = 49 << 1; rtp_ctx->buf[1] = 1; /* create the FU header 0 1 2 3 4 5 6 7 +-+-+-+-+-+-+-+-+ |S|E| FuType | +---------------+ S = variable E = variable FuType = NAL unit type */ rtp_ctx->buf[2] = nal_type; /* set the S bit: mark as start fragment */ rtp_ctx->buf[2] |= 1 << 7; /* pass the original NAL header */ buf += 2; len -= 2; while (len > rtp_payload_size) { /* complete and send current RTP packet */ memcpy(&rtp_ctx->buf[RTP_HEVC_HEADERS_SIZE], buf, rtp_payload_size); ff_rtp_send_data(ctx, rtp_ctx->buf, rtp_ctx->max_payload_size, 0); buf += rtp_payload_size; len -= rtp_payload_size; /* reset the S bit */ rtp_ctx->buf[2] &= ~(1 << 7); } /* set the E bit: mark as last fragment */ rtp_ctx->buf[2] |= 1 << 6; /* complete and send last RTP packet */ memcpy(&rtp_ctx->buf[RTP_HEVC_HEADERS_SIZE], buf, len); ff_rtp_send_data(ctx, rtp_ctx->buf, len + 2, last_packet_of_frame); } } | 25,411 |
1 | static void decode_band_structure(GetBitContext *gbc, int blk, int eac3, int ecpl, int start_subband, int end_subband, const uint8_t *default_band_struct, uint8_t *band_struct, int *num_subbands, int *num_bands, int *band_sizes) { int subbnd, bnd, n_subbands, n_bands, bnd_sz[22]; n_subbands = end_subband - start_subband; /* decode band structure from bitstream or use default */ if (!eac3 || get_bits1(gbc)) { for (subbnd = 0; subbnd < n_subbands - 1; subbnd++) { band_struct[subbnd] = get_bits1(gbc); } } else if (!blk) { memcpy(band_struct, &default_band_struct[start_subband+1], n_subbands-1); } band_struct[n_subbands-1] = 0; /* calculate number of bands and band sizes based on band structure. note that the first 4 subbands in enhanced coupling span only 6 bins instead of 12. */ if (num_bands || band_sizes ) { n_bands = n_subbands; bnd_sz[0] = ecpl ? 6 : 12; for (bnd = 0, subbnd = 1; subbnd < n_subbands; subbnd++) { int subbnd_size = (ecpl && subbnd < 4) ? 6 : 12; if (band_struct[subbnd-1]) { n_bands--; bnd_sz[bnd] += subbnd_size; } else { bnd_sz[++bnd] = subbnd_size; } } } /* set optional output params */ if (num_subbands) *num_subbands = n_subbands; if (num_bands) *num_bands = n_bands; if (band_sizes) memcpy(band_sizes, bnd_sz, sizeof(int)*n_bands); } | 25,412 |
1 | static void init_coef_vlc(VLC *vlc, uint16_t **prun_table, uint16_t **plevel_table, const CoefVLCTable *vlc_table) { int n = vlc_table->n; const uint8_t *table_bits = vlc_table->huffbits; const uint32_t *table_codes = vlc_table->huffcodes; const uint16_t *levels_table = vlc_table->levels; uint16_t *run_table, *level_table; const uint16_t *p; int i, l, j, level; init_vlc(vlc, 9, n, table_bits, 1, 1, table_codes, 4, 4); run_table = av_malloc(n * sizeof(uint16_t)); level_table = av_malloc(n * sizeof(uint16_t)); p = levels_table; i = 2; level = 1; while (i < n) { l = *p++; for(j=0;j<l;j++) { run_table[i] = j; level_table[i] = level; i++; } level++; } *prun_table = run_table; *plevel_table = level_table; } | 25,415 |
0 | static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt, int discard) { AviSynthContext *avs = s->priv_data; AVS_VideoFrame *frame; unsigned char *dst_p; const unsigned char *src_p; int n, i, plane, rowsize, planeheight, pitch, bits; const char *error; if (avs->curr_frame >= avs->vi->num_frames) return AVERROR_EOF; /* This must happen even if the stream is discarded to prevent desync. */ n = avs->curr_frame++; if (discard) return 0; #ifdef USING_AVISYNTH /* Define the bpp values for the new AviSynth 2.6 colorspaces. * Since AvxSynth doesn't have these functions, special-case * it in order to avoid implicit declaration errors. */ if (avs_library.avs_is_yv24(avs->vi)) bits = 24; else if (avs_library.avs_is_yv16(avs->vi)) bits = 16; else if (avs_library.avs_is_yv411(avs->vi)) bits = 12; else if (avs_library.avs_is_y8(avs->vi)) bits = 8; else bits = avs_library.avs_bits_per_pixel(avs->vi); #else bits = avs_bits_per_pixel(avs->vi); #endif /* Without the cast to int64_t, calculation overflows at about 9k x 9k * resolution. */ pkt->size = (((int64_t)avs->vi->width * (int64_t)avs->vi->height) * bits) / 8; if (!pkt->size) return AVERROR_UNKNOWN; if (av_new_packet(pkt, pkt->size) < 0) return AVERROR(ENOMEM); pkt->pts = n; pkt->dts = n; pkt->duration = 1; pkt->stream_index = avs->curr_stream; frame = avs_library.avs_get_frame(avs->clip, n); error = avs_library.avs_clip_get_error(avs->clip); if (error) { av_log(s, AV_LOG_ERROR, "%s\n", error); avs->error = 1; av_packet_unref(pkt); return AVERROR_UNKNOWN; } dst_p = pkt->data; for (i = 0; i < avs->n_planes; i++) { plane = avs->planes[i]; #ifdef USING_AVISYNTH src_p = avs_library.avs_get_read_ptr_p(frame, plane); pitch = avs_library.avs_get_pitch_p(frame, plane); rowsize = avs_library.avs_get_row_size_p(frame, plane); planeheight = avs_library.avs_get_height_p(frame, plane); #else src_p = avs_get_read_ptr_p(frame, plane); pitch = avs_get_pitch_p(frame, plane); rowsize = avs_get_row_size_p(frame, plane); planeheight = avs_get_height_p(frame, plane); #endif /* Flip RGB video. */ if (avs_is_rgb24(avs->vi) || avs_is_rgb(avs->vi)) { src_p = src_p + (planeheight - 1) * pitch; pitch = -pitch; } avs_library.avs_bit_blt(avs->env, dst_p, rowsize, src_p, pitch, rowsize, planeheight); dst_p += rowsize * planeheight; } avs_library.avs_release_video_frame(frame); return 0; } | 25,416 |
0 | static void avc_luma_midh_qrt_and_aver_dst_16w_msa(const uint8_t *src, int32_t src_stride, uint8_t *dst, int32_t dst_stride, int32_t height, uint8_t horiz_offset) { uint32_t multiple8_cnt; for (multiple8_cnt = 4; multiple8_cnt--;) { avc_luma_midh_qrt_and_aver_dst_4w_msa(src, src_stride, dst, dst_stride, height, horiz_offset); src += 4; dst += 4; } } | 25,417 |
1 | 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; | 25,418 |
1 | int kvmppc_get_htab_fd(bool write) { struct kvm_get_htab_fd s = { .flags = write ? KVM_GET_HTAB_WRITE : 0, .start_index = 0, }; if (!cap_htab_fd) { fprintf(stderr, "KVM version doesn't support saving the hash table\n"); return -1; } return kvm_vm_ioctl(kvm_state, KVM_PPC_GET_HTAB_FD, &s); } | 25,419 |
1 | static void machine_set_loadparm(Object *obj, const char *val, Error **errp) { S390CcwMachineState *ms = S390_CCW_MACHINE(obj); int i; for (i = 0; i < sizeof(ms->loadparm) && val[i]; i++) { uint8_t c = toupper(val[i]); /* mimic HMC */ if (('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') || (c == '.') || (c == ' ')) { ms->loadparm[i] = c; } else { error_setg(errp, "LOADPARM: invalid character '%c' (ASCII 0x%02x)", c, c); return; } } for (; i < sizeof(ms->loadparm); i++) { ms->loadparm[i] = ' '; /* pad right with spaces */ } } | 25,420 |
1 | static void eepro100_cu_command(EEPRO100State * s, uint8_t val) { eepro100_tx_t tx; uint32_t cb_address; switch (val) { case CU_NOP: /* No operation. */ break; case CU_START: if (get_cu_state(s) != cu_idle) { /* Intel documentation says that CU must be idle for the CU * start command. Intel driver for Linux also starts the CU * from suspended state. */ logout("CU state is %u, should be %u\n", get_cu_state(s), cu_idle); //~ assert(!"wrong CU state"); } set_cu_state(s, cu_active); s->cu_offset = s->pointer; next_command: cb_address = s->cu_base + s->cu_offset; cpu_physical_memory_read(cb_address, (uint8_t *) & tx, sizeof(tx)); uint16_t status = le16_to_cpu(tx.status); uint16_t command = le16_to_cpu(tx.command); logout ("val=0x%02x (cu start), status=0x%04x, command=0x%04x, link=0x%08x\n", val, status, command, tx.link); bool bit_el = ((command & 0x8000) != 0); bool bit_s = ((command & 0x4000) != 0); bool bit_i = ((command & 0x2000) != 0); bool bit_nc = ((command & 0x0010) != 0); //~ bool bit_sf = ((command & 0x0008) != 0); uint16_t cmd = command & 0x0007; s->cu_offset = le32_to_cpu(tx.link); switch (cmd) { case CmdNOp: /* Do nothing. */ break; case CmdIASetup: cpu_physical_memory_read(cb_address + 8, &s->macaddr[0], 6); TRACE(OTHER, logout("macaddr: %s\n", nic_dump(&s->macaddr[0], 6))); break; case CmdConfigure: cpu_physical_memory_read(cb_address + 8, &s->configuration[0], sizeof(s->configuration)); TRACE(OTHER, logout("configuration: %s\n", nic_dump(&s->configuration[0], 16))); break; case CmdMulticastList: //~ missing("multicast list"); break; case CmdTx: (void)0; uint32_t tbd_array = le32_to_cpu(tx.tx_desc_addr); uint16_t tcb_bytes = (le16_to_cpu(tx.tcb_bytes) & 0x3fff); TRACE(RXTX, logout ("transmit, TBD array address 0x%08x, TCB byte count 0x%04x, TBD count %u\n", tbd_array, tcb_bytes, tx.tbd_count)); assert(!bit_nc); //~ assert(!bit_sf); assert(tcb_bytes <= 2600); /* Next assertion fails for local configuration. */ //~ assert((tcb_bytes > 0) || (tbd_array != 0xffffffff)); if (!((tcb_bytes > 0) || (tbd_array != 0xffffffff))) { logout ("illegal values of TBD array address and TCB byte count!\n"); } // sends larger than MAX_ETH_FRAME_SIZE are allowed, up to 2600 bytes uint8_t buf[2600]; uint16_t size = 0; uint32_t tbd_address = cb_address + 0x10; assert(tcb_bytes <= sizeof(buf)); while (size < tcb_bytes) { uint32_t tx_buffer_address = ldl_phys(tbd_address); uint16_t tx_buffer_size = lduw_phys(tbd_address + 4); //~ uint16_t tx_buffer_el = lduw_phys(tbd_address + 6); tbd_address += 8; TRACE(RXTX, logout ("TBD (simplified mode): buffer address 0x%08x, size 0x%04x\n", tx_buffer_address, tx_buffer_size)); tx_buffer_size = MIN(tx_buffer_size, sizeof(buf) - size); cpu_physical_memory_read(tx_buffer_address, &buf[size], tx_buffer_size); size += tx_buffer_size; } if (tbd_array == 0xffffffff) { /* Simplified mode. Was already handled by code above. */ } else { /* Flexible mode. */ uint8_t tbd_count = 0; if (device_supports_eTxCB(s) && !(s->configuration[6] & BIT(4))) { /* Extended Flexible TCB. */ assert(tcb_bytes == 0); for (; tbd_count < 2; tbd_count++) { uint32_t tx_buffer_address = ldl_phys(tbd_address); uint16_t tx_buffer_size = lduw_phys(tbd_address + 4); uint16_t tx_buffer_el = lduw_phys(tbd_address + 6); tbd_address += 8; TRACE(RXTX, logout ("TBD (extended flexible mode): buffer address 0x%08x, size 0x%04x\n", tx_buffer_address, tx_buffer_size)); tx_buffer_size = MIN(tx_buffer_size, sizeof(buf) - size); cpu_physical_memory_read(tx_buffer_address, &buf[size], tx_buffer_size); size += tx_buffer_size; if (tx_buffer_el & 1) { break; } } } tbd_address = tbd_array; for (; tbd_count < tx.tbd_count; tbd_count++) { uint32_t tx_buffer_address = ldl_phys(tbd_address); uint16_t tx_buffer_size = lduw_phys(tbd_address + 4); uint16_t tx_buffer_el = lduw_phys(tbd_address + 6); tbd_address += 8; TRACE(RXTX, logout ("TBD (flexible mode): buffer address 0x%08x, size 0x%04x\n", tx_buffer_address, tx_buffer_size)); tx_buffer_size = MIN(tx_buffer_size, sizeof(buf) - size); cpu_physical_memory_read(tx_buffer_address, &buf[size], tx_buffer_size); size += tx_buffer_size; if (tx_buffer_el & 1) { break; } } } TRACE(RXTX, logout("%p sending frame, len=%d,%s\n", s, size, nic_dump(buf, size))); qemu_send_packet(s->vc, buf, size); s->statistics.tx_good_frames++; /* Transmit with bad status would raise an CX/TNO interrupt. * (82557 only). Emulation never has bad status. */ //~ eepro100_cx_interrupt(s); break; case CmdTDR: TRACE(OTHER, logout("load microcode\n")); /* Starting with offset 8, the command contains * 64 dwords microcode which we just ignore here. */ break; default: missing("undefined command"); } /* Write new status (success). */ stw_phys(cb_address, status | 0x8000 | 0x2000); if (bit_i) { /* CU completed action. */ eepro100_cx_interrupt(s); } if (bit_el) { /* CU becomes idle. Terminate command loop. */ set_cu_state(s, cu_idle); eepro100_cna_interrupt(s); } else if (bit_s) { /* CU becomes suspended. */ set_cu_state(s, cu_suspended); eepro100_cna_interrupt(s); } else { /* More entries in list. */ TRACE(OTHER, logout("CU list with at least one more entry\n")); goto next_command; } TRACE(OTHER, logout("CU list empty\n")); /* List is empty. Now CU is idle or suspended. */ break; case CU_RESUME: if (get_cu_state(s) != cu_suspended) { logout("bad CU resume from CU state %u\n", get_cu_state(s)); /* Workaround for bad Linux eepro100 driver which resumes * from idle state. */ //~ missing("cu resume"); set_cu_state(s, cu_suspended); } if (get_cu_state(s) == cu_suspended) { TRACE(OTHER, logout("CU resuming\n")); set_cu_state(s, cu_active); goto next_command; } break; case CU_STATSADDR: /* Load dump counters address. */ s->statsaddr = s->pointer; TRACE(OTHER, logout("val=0x%02x (status address)\n", val)); break; case CU_SHOWSTATS: /* Dump statistical counters. */ TRACE(OTHER, logout("val=0x%02x (dump stats)\n", val)); dump_statistics(s); break; case CU_CMD_BASE: /* Load CU base. */ TRACE(OTHER, logout("val=0x%02x (CU base address)\n", val)); s->cu_base = s->pointer; break; case CU_DUMPSTATS: /* Dump and reset statistical counters. */ TRACE(OTHER, logout("val=0x%02x (dump stats and reset)\n", val)); dump_statistics(s); memset(&s->statistics, 0, sizeof(s->statistics)); break; case CU_SRESUME: /* CU static resume. */ missing("CU static resume"); break; default: missing("Undefined CU command"); } } | 25,421 |
1 | static av_cold int fieldmatch_init(AVFilterContext *ctx) { const FieldMatchContext *fm = ctx->priv; AVFilterPad pad = { .name = av_strdup("main"), .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, .config_props = config_input, }; if (!pad.name) return AVERROR(ENOMEM); ff_insert_inpad(ctx, INPUT_MAIN, &pad); if (fm->ppsrc) { pad.name = av_strdup("clean_src"); pad.config_props = NULL; if (!pad.name) return AVERROR(ENOMEM); ff_insert_inpad(ctx, INPUT_CLEANSRC, &pad); } if ((fm->blockx & (fm->blockx - 1)) || (fm->blocky & (fm->blocky - 1))) { av_log(ctx, AV_LOG_ERROR, "blockx and blocky settings must be power of two\n"); return AVERROR(EINVAL); } if (fm->combpel > fm->blockx * fm->blocky) { av_log(ctx, AV_LOG_ERROR, "Combed pixel should not be larger than blockx x blocky\n"); return AVERROR(EINVAL); } return 0; } | 25,422 |
1 | static int count_contiguous_clusters(uint64_t nb_clusters, int cluster_size, uint64_t *l2_table, uint64_t start, uint64_t mask) { int i; uint64_t offset = be64_to_cpu(l2_table[0]) & ~mask; if (!offset) return 0; for (i = start; i < start + nb_clusters; i++) if (offset + i * cluster_size != (be64_to_cpu(l2_table[i]) & ~mask)) break; return (i - start); } | 25,423 |
1 | static void gen_ove_ov(DisasContext *dc, TCGv ov) { gen_helper_ove(cpu_env, ov); } | 25,424 |
0 | void avpriv_tak_parse_streaminfo(GetBitContext *gb, TAKStreamInfo *s) { uint64_t channel_mask = 0; int frame_type, i; s->codec = get_bits(gb, TAK_ENCODER_CODEC_BITS); skip_bits(gb, TAK_ENCODER_PROFILE_BITS); frame_type = get_bits(gb, TAK_SIZE_FRAME_DURATION_BITS); s->samples = get_bits64(gb, TAK_SIZE_SAMPLES_NUM_BITS); s->data_type = get_bits(gb, TAK_FORMAT_DATA_TYPE_BITS); s->sample_rate = get_bits(gb, TAK_FORMAT_SAMPLE_RATE_BITS) + TAK_SAMPLE_RATE_MIN; s->bps = get_bits(gb, TAK_FORMAT_BPS_BITS) + TAK_BPS_MIN; s->channels = get_bits(gb, TAK_FORMAT_CHANNEL_BITS) + TAK_CHANNELS_MIN; if (get_bits1(gb)) { skip_bits(gb, TAK_FORMAT_VALID_BITS); if (get_bits1(gb)) { for (i = 0; i < s->channels; i++) { int value = get_bits(gb, TAK_FORMAT_CH_LAYOUT_BITS); if (value < FF_ARRAY_ELEMS(tak_channel_layouts)) channel_mask |= tak_channel_layouts[value]; } } } s->ch_layout = channel_mask; s->frame_samples = tak_get_nb_samples(s->sample_rate, frame_type); } | 25,425 |
0 | int show_formats(void *optctx, const char *opt, const char *arg) { AVInputFormat *ifmt = NULL; AVOutputFormat *ofmt = NULL; const char *last_name; printf("File formats:\n" " D. = Demuxing supported\n" " .E = Muxing supported\n" " --\n"); last_name = "000"; for (;;) { int decode = 0; int encode = 0; const char *name = NULL; const char *long_name = NULL; while ((ofmt = av_oformat_next(ofmt))) { if ((name == NULL || strcmp(ofmt->name, name) < 0) && strcmp(ofmt->name, last_name) > 0) { name = ofmt->name; long_name = ofmt->long_name; encode = 1; } } while ((ifmt = av_iformat_next(ifmt))) { if ((name == NULL || strcmp(ifmt->name, name) < 0) && strcmp(ifmt->name, last_name) > 0) { name = ifmt->name; long_name = ifmt->long_name; encode = 0; } if (name && strcmp(ifmt->name, name) == 0) decode = 1; } if (name == NULL) break; last_name = name; printf(" %s%s %-15s %s\n", decode ? "D" : " ", encode ? "E" : " ", name, long_name ? long_name:" "); } return 0; } | 25,426 |
0 | static void SET_TYPE(resample_nearest)(void *dst0, int dst_index, const void *src0, int index) { FELEM *dst = dst0; const FELEM *src = src0; dst[dst_index] = src[index]; } | 25,427 |
0 | static inline void mc_dir_part(H264Context *h, Picture *pic, int n, int square, int chroma_height, int delta, int list, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int src_x_offset, int src_y_offset, qpel_mc_func *qpix_op, h264_chroma_mc_func chroma_op){ MpegEncContext * const s = &h->s; const int mx= h->mv_cache[list][ scan8[n] ][0] + src_x_offset*8; int my= h->mv_cache[list][ scan8[n] ][1] + src_y_offset*8; const int luma_xy= (mx&3) + ((my&3)<<2); uint8_t * src_y = pic->data[0] + (mx>>2) + (my>>2)*h->mb_linesize; uint8_t * src_cb, * src_cr; int extra_width= h->emu_edge_width; int extra_height= h->emu_edge_height; int emu=0; const int full_mx= mx>>2; const int full_my= my>>2; const int pic_width = 16*s->mb_width; const int pic_height = 16*s->mb_height >> MB_FIELD; if(!pic->data[0]) //FIXME this is unacceptable, some sensible error concealment must be done for missing reference frames return; if(mx&7) extra_width -= 3; if(my&7) extra_height -= 3; if( full_mx < 0-extra_width || full_my < 0-extra_height || full_mx + 16/*FIXME*/ > pic_width + extra_width || full_my + 16/*FIXME*/ > pic_height + extra_height){ ff_emulated_edge_mc(s->edge_emu_buffer, src_y - 2 - 2*h->mb_linesize, h->mb_linesize, 16+5, 16+5/*FIXME*/, full_mx-2, full_my-2, pic_width, pic_height); src_y= s->edge_emu_buffer + 2 + 2*h->mb_linesize; emu=1; } qpix_op[luma_xy](dest_y, src_y, h->mb_linesize); //FIXME try variable height perhaps? if(!square){ qpix_op[luma_xy](dest_y + delta, src_y + delta, h->mb_linesize); } if(ENABLE_GRAY && s->flags&CODEC_FLAG_GRAY) return; if(MB_FIELD){ // chroma offset when predicting from a field of opposite parity my += 2 * ((s->mb_y & 1) - (pic->reference - 1)); emu |= (my>>3) < 0 || (my>>3) + 8 >= (pic_height>>1); } src_cb= pic->data[1] + (mx>>3) + (my>>3)*h->mb_uvlinesize; src_cr= pic->data[2] + (mx>>3) + (my>>3)*h->mb_uvlinesize; if(emu){ ff_emulated_edge_mc(s->edge_emu_buffer, src_cb, h->mb_uvlinesize, 9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1); src_cb= s->edge_emu_buffer; } chroma_op(dest_cb, src_cb, h->mb_uvlinesize, chroma_height, mx&7, my&7); if(emu){ ff_emulated_edge_mc(s->edge_emu_buffer, src_cr, h->mb_uvlinesize, 9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1); src_cr= s->edge_emu_buffer; } chroma_op(dest_cr, src_cr, h->mb_uvlinesize, chroma_height, mx&7, my&7); } | 25,428 |
0 | static void rtsp_send_cmd(AVFormatContext *s, const char *cmd, RTSPMessageHeader *reply, unsigned char **content_ptr) { RTSPState *rt = s->priv_data; char buf[4096], buf1[1024]; rt->seq++; av_strlcpy(buf, cmd, sizeof(buf)); snprintf(buf1, sizeof(buf1), "CSeq: %d\r\n", rt->seq); av_strlcat(buf, buf1, sizeof(buf)); if (rt->session_id[0] != '\0' && !strstr(cmd, "\nIf-Match:")) { snprintf(buf1, sizeof(buf1), "Session: %s\r\n", rt->session_id); av_strlcat(buf, buf1, sizeof(buf)); } av_strlcat(buf, "\r\n", sizeof(buf)); #ifdef DEBUG printf("Sending:\n%s--\n", buf); #endif url_write(rt->rtsp_hd, buf, strlen(buf)); rtsp_read_reply(rt, reply, content_ptr); } | 25,429 |
0 | static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const char *vfilters) { static const enum PixelFormat pix_fmts[] = { PIX_FMT_YUV420P, PIX_FMT_NONE }; char sws_flags_str[128]; char buffersrc_args[256]; int ret; AVBufferSinkParams *buffersink_params = av_buffersink_params_alloc(); AVFilterContext *filt_src = NULL, *filt_out = NULL, *filt_format; AVCodecContext *codec = is->video_st->codec; snprintf(sws_flags_str, sizeof(sws_flags_str), "flags=%d", sws_flags); graph->scale_sws_opts = av_strdup(sws_flags_str); snprintf(buffersrc_args, sizeof(buffersrc_args), "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:pixel_aspect=%d/%d", codec->width, codec->height, codec->pix_fmt, is->video_st->time_base.num, is->video_st->time_base.den, codec->sample_aspect_ratio.num, codec->sample_aspect_ratio.den); if ((ret = avfilter_graph_create_filter(&filt_src, avfilter_get_by_name("buffer"), "ffplay_buffer", buffersrc_args, NULL, graph)) < 0) return ret; buffersink_params->pixel_fmts = pix_fmts; ret = avfilter_graph_create_filter(&filt_out, avfilter_get_by_name("buffersink"), "ffplay_buffersink", NULL, buffersink_params, graph); av_freep(&buffersink_params); if (ret < 0) return ret; if ((ret = avfilter_graph_create_filter(&filt_format, avfilter_get_by_name("format"), "format", "yuv420p", NULL, graph)) < 0) return ret; if ((ret = avfilter_link(filt_format, 0, filt_out, 0)) < 0) return ret; if (vfilters) { AVFilterInOut *outputs = avfilter_inout_alloc(); AVFilterInOut *inputs = avfilter_inout_alloc(); outputs->name = av_strdup("in"); outputs->filter_ctx = filt_src; outputs->pad_idx = 0; outputs->next = NULL; inputs->name = av_strdup("out"); inputs->filter_ctx = filt_format; inputs->pad_idx = 0; inputs->next = NULL; if ((ret = avfilter_graph_parse(graph, vfilters, &inputs, &outputs, NULL)) < 0) return ret; } else { if ((ret = avfilter_link(filt_src, 0, filt_format, 0)) < 0) return ret; } if ((ret = avfilter_graph_config(graph, NULL)) < 0) return ret; is->in_video_filter = filt_src; is->out_video_filter = filt_out; if (codec->codec->capabilities & CODEC_CAP_DR1) { is->use_dr1 = 1; codec->get_buffer = codec_get_buffer; codec->release_buffer = codec_release_buffer; codec->opaque = &is->buffer_pool; } return ret; } | 25,430 |
1 | int dyngen_code(TCGContext *s, uint8_t *gen_code_buf) { #ifdef CONFIG_PROFILER { extern int64_t dyngen_op_count; extern int dyngen_op_count_max; int n; n = (gen_opc_ptr - gen_opc_buf); dyngen_op_count += n; if (n > dyngen_op_count_max) dyngen_op_count_max = n; } #endif tcg_gen_code_common(s, gen_code_buf, 0, NULL); /* flush instruction cache */ flush_icache_range((unsigned long)gen_code_buf, (unsigned long)s->code_ptr); return s->code_ptr - gen_code_buf; } | 25,431 |
1 | static int alloc_refcount_block(BlockDriverState *bs, int64_t cluster_index, void **refcount_block) { BDRVQcow2State *s = bs->opaque; unsigned int refcount_table_index; int64_t ret; BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC); /* Find the refcount block for the given cluster */ refcount_table_index = cluster_index >> s->refcount_block_bits; if (refcount_table_index < s->refcount_table_size) { uint64_t refcount_block_offset = s->refcount_table[refcount_table_index] & REFT_OFFSET_MASK; /* If it's already there, we're done */ if (refcount_block_offset) { if (offset_into_cluster(s, refcount_block_offset)) { qcow2_signal_corruption(bs, true, -1, -1, "Refblock offset %#" PRIx64 " unaligned (reftable index: " "%#x)", refcount_block_offset, refcount_table_index); return load_refcount_block(bs, refcount_block_offset, refcount_block); /* * If we came here, we need to allocate something. Something is at least * a cluster for the new refcount block. It may also include a new refcount * table if the old refcount table is too small. * * Note that allocating clusters here needs some special care: * * - We can't use the normal qcow2_alloc_clusters(), it would try to * increase the refcount and very likely we would end up with an endless * recursion. Instead we must place the refcount blocks in a way that * they can describe them themselves. * * - We need to consider that at this point we are inside update_refcounts * and potentially doing an initial refcount increase. This means that * some clusters have already been allocated by the caller, but their * refcount isn't accurate yet. If we allocate clusters for metadata, we * need to return -EAGAIN to signal the caller that it needs to restart * the search for free clusters. * * - alloc_clusters_noref and qcow2_free_clusters may load a different * refcount block into the cache */ *refcount_block = NULL; /* We write to the refcount table, so we might depend on L2 tables */ ret = qcow2_cache_flush(bs, s->l2_table_cache); if (ret < 0) { return ret; /* Allocate the refcount block itself and mark it as used */ int64_t new_block = alloc_clusters_noref(bs, s->cluster_size); if (new_block < 0) { return new_block; #ifdef DEBUG_ALLOC2 fprintf(stderr, "qcow2: Allocate refcount block %d for %" PRIx64 " at %" PRIx64 "\n", refcount_table_index, cluster_index << s->cluster_bits, new_block); #endif if (in_same_refcount_block(s, new_block, cluster_index << s->cluster_bits)) { /* Zero the new refcount block before updating it */ ret = qcow2_cache_get_empty(bs, s->refcount_block_cache, new_block, refcount_block); if (ret < 0) { goto fail; memset(*refcount_block, 0, s->cluster_size); /* The block describes itself, need to update the cache */ int block_index = (new_block >> s->cluster_bits) & (s->refcount_block_size - 1); s->set_refcount(*refcount_block, block_index, 1); } else { /* Described somewhere else. This can recurse at most twice before we * arrive at a block that describes itself. */ ret = update_refcount(bs, new_block, s->cluster_size, 1, false, QCOW2_DISCARD_NEVER); if (ret < 0) { goto fail; ret = qcow2_cache_flush(bs, s->refcount_block_cache); if (ret < 0) { goto fail; /* Initialize the new refcount block only after updating its refcount, * update_refcount uses the refcount cache itself */ ret = qcow2_cache_get_empty(bs, s->refcount_block_cache, new_block, refcount_block); if (ret < 0) { goto fail; memset(*refcount_block, 0, s->cluster_size); /* Now the new refcount block needs to be written to disk */ BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC_WRITE); qcow2_cache_entry_mark_dirty(bs, s->refcount_block_cache, *refcount_block); ret = qcow2_cache_flush(bs, s->refcount_block_cache); if (ret < 0) { goto fail; /* If the refcount table is big enough, just hook the block up there */ if (refcount_table_index < s->refcount_table_size) { uint64_t data64 = cpu_to_be64(new_block); BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC_HOOKUP); ret = bdrv_pwrite_sync(bs->file, s->refcount_table_offset + refcount_table_index * sizeof(uint64_t), &data64, sizeof(data64)); if (ret < 0) { goto fail; s->refcount_table[refcount_table_index] = new_block; /* If there's a hole in s->refcount_table then it can happen * that refcount_table_index < s->max_refcount_table_index */ s->max_refcount_table_index = MAX(s->max_refcount_table_index, refcount_table_index); /* The new refcount block may be where the caller intended to put its * data, so let it restart the search. */ return -EAGAIN; qcow2_cache_put(bs, s->refcount_block_cache, refcount_block); /* * If we come here, we need to grow the refcount table. Again, a new * refcount table needs some space and we can't simply allocate to avoid * endless recursion. * * Therefore let's grab new refcount blocks at the end of the image, which * will describe themselves and the new refcount table. This way we can * reference them only in the new table and do the switch to the new * refcount table at once without producing an inconsistent state in * between. */ BLKDBG_EVENT(bs->file, BLKDBG_REFTABLE_GROW); /* Calculate the number of refcount blocks needed so far; this will be the * basis for calculating the index of the first cluster used for the * self-describing refcount structures which we are about to create. * * Because we reached this point, there cannot be any refcount entries for * cluster_index or higher indices yet. However, because new_block has been * allocated to describe that cluster (and it will assume this role later * on), we cannot use that index; also, new_block may actually have a higher * cluster index than cluster_index, so it needs to be taken into account * here (and 1 needs to be added to its value because that cluster is used). */ uint64_t blocks_used = DIV_ROUND_UP(MAX(cluster_index + 1, (new_block >> s->cluster_bits) + 1), s->refcount_block_size); /* Create the new refcount table and blocks */ uint64_t meta_offset = (blocks_used * s->refcount_block_size) * s->cluster_size; ret = qcow2_refcount_area(bs, meta_offset, 0, false, refcount_table_index, new_block); if (ret < 0) { return ret; ret = load_refcount_block(bs, new_block, refcount_block); if (ret < 0) { return ret; /* If we were trying to do the initial refcount update for some cluster * allocation, we might have used the same clusters to store newly * allocated metadata. Make the caller search some new space. */ return -EAGAIN; fail: if (*refcount_block != NULL) { qcow2_cache_put(bs, s->refcount_block_cache, refcount_block); return ret; | 25,432 |
1 | static int x8_setup_spatial_predictor(IntraX8Context * const w, const int chroma){ MpegEncContext * const s= w->s; int range; int sum; int quant; w->dsp.setup_spatial_compensation(s->dest[chroma], s->edge_emu_buffer, s->current_picture.f.linesize[chroma>0], &range, &sum, w->edges); if(chroma){ w->orient=w->chroma_orient; quant=w->quant_dc_chroma; }else{ quant=w->quant; } w->flat_dc=0; if(range < quant || range < 3){ w->orient=0; if(range < 3){//yep you read right, a +-1 idct error may break decoding! w->flat_dc=1; sum+=9; w->predicted_dc = (sum*6899)>>17;//((1<<17)+9)/(8+8+1+2)=6899 } } if(chroma) return 0; assert(w->orient < 3); if(range < 2*w->quant){ if( (w->edges&3) == 0){ if(w->orient==1) w->orient=11; if(w->orient==2) w->orient=10; }else{ w->orient=0; } w->raw_orient=0; }else{ static const uint8_t prediction_table[3][12]={ {0,8,4, 10,11, 2,6,9,1,3,5,7}, {4,0,8, 11,10, 3,5,2,6,9,1,7}, {8,0,4, 10,11, 1,7,2,6,9,3,5} }; w->raw_orient=x8_get_orient_vlc(w); if(w->raw_orient<0) return -1; assert(w->raw_orient < 12 ); assert(w->orient<3); w->orient=prediction_table[w->orient][w->raw_orient]; } return 0; } | 25,433 |
1 | static void vc1_mc_4mv_chroma4(VC1Context *v, int dir, int dir2, int avg) { MpegEncContext *s = &v->s; H264ChromaContext *h264chroma = &v->h264chroma; uint8_t *srcU, *srcV; int uvsrc_x, uvsrc_y; int uvmx_field[4], uvmy_field[4]; int i, off, tx, ty; int fieldmv = v->blk_mv_type[s->block_index[0]]; static const int s_rndtblfield[16] = { 0, 0, 1, 2, 4, 4, 5, 6, 2, 2, 3, 8, 6, 6, 7, 12 }; int v_dist = fieldmv ? 1 : 4; // vertical offset for lower sub-blocks int v_edge_pos = s->v_edge_pos >> 1; int use_ic; uint8_t (*lutuv)[256]; if (s->flags & CODEC_FLAG_GRAY) return; for (i = 0; i < 4; i++) { int d = i < 2 ? dir: dir2; tx = s->mv[d][i][0]; uvmx_field[i] = (tx + ((tx & 3) == 3)) >> 1; ty = s->mv[d][i][1]; if (fieldmv) uvmy_field[i] = (ty >> 4) * 8 + s_rndtblfield[ty & 0xF]; else uvmy_field[i] = (ty + ((ty & 3) == 3)) >> 1; } for (i = 0; i < 4; i++) { off = (i & 1) * 4 + ((i & 2) ? v_dist * s->uvlinesize : 0); uvsrc_x = s->mb_x * 8 + (i & 1) * 4 + (uvmx_field[i] >> 2); uvsrc_y = s->mb_y * 8 + ((i & 2) ? v_dist : 0) + (uvmy_field[i] >> 2); // FIXME: implement proper pull-back (see vc1cropmv.c, vc1CROPMV_ChromaPullBack()) uvsrc_x = av_clip(uvsrc_x, -8, s->avctx->coded_width >> 1); uvsrc_y = av_clip(uvsrc_y, -8, s->avctx->coded_height >> 1); if (i < 2 ? dir : dir2) { srcU = s->next_picture.f.data[1] + uvsrc_y * s->uvlinesize + uvsrc_x; srcV = s->next_picture.f.data[2] + uvsrc_y * s->uvlinesize + uvsrc_x; lutuv = v->next_lutuv; use_ic = v->next_use_ic; } else { srcU = s->last_picture.f.data[1] + uvsrc_y * s->uvlinesize + uvsrc_x; srcV = s->last_picture.f.data[2] + uvsrc_y * s->uvlinesize + uvsrc_x; lutuv = v->last_lutuv; use_ic = v->last_use_ic; } uvmx_field[i] = (uvmx_field[i] & 3) << 1; uvmy_field[i] = (uvmy_field[i] & 3) << 1; if (fieldmv && !(uvsrc_y & 1)) v_edge_pos--; if (fieldmv && (uvsrc_y & 1) && uvsrc_y < 2) uvsrc_y--; if (use_ic || s->h_edge_pos < 10 || v_edge_pos < (5 << fieldmv) || (unsigned)uvsrc_x > (s->h_edge_pos >> 1) - 5 || (unsigned)uvsrc_y > v_edge_pos - (5 << fieldmv)) { s->vdsp.emulated_edge_mc(s->edge_emu_buffer, srcU, s->uvlinesize, s->uvlinesize, 5, (5 << fieldmv), uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, v_edge_pos); s->vdsp.emulated_edge_mc(s->edge_emu_buffer + 16, srcV, s->uvlinesize, s->uvlinesize, 5, (5 << fieldmv), uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, v_edge_pos); srcU = s->edge_emu_buffer; srcV = s->edge_emu_buffer + 16; /* if we deal with intensity compensation we need to scale source blocks */ if (use_ic) { int i, j; uint8_t *src, *src2; src = srcU; src2 = srcV; for (j = 0; j < 5; j++) { int f = (uvsrc_y + (j << fieldmv)) & 1; for (i = 0; i < 5; i++) { src[i] = lutuv[f][src[i]]; src2[i] = lutuv[f][src2[i]]; } src += s->uvlinesize << fieldmv; src2 += s->uvlinesize << fieldmv; } } } if (avg) { if (!v->rnd) { h264chroma->avg_h264_chroma_pixels_tab[1](s->dest[1] + off, srcU, s->uvlinesize << fieldmv, 4, uvmx_field[i], uvmy_field[i]); h264chroma->avg_h264_chroma_pixels_tab[1](s->dest[2] + off, srcV, s->uvlinesize << fieldmv, 4, uvmx_field[i], uvmy_field[i]); } else { v->vc1dsp.avg_no_rnd_vc1_chroma_pixels_tab[1](s->dest[1] + off, srcU, s->uvlinesize << fieldmv, 4, uvmx_field[i], uvmy_field[i]); v->vc1dsp.avg_no_rnd_vc1_chroma_pixels_tab[1](s->dest[2] + off, srcV, s->uvlinesize << fieldmv, 4, uvmx_field[i], uvmy_field[i]); } } else { if (!v->rnd) { h264chroma->put_h264_chroma_pixels_tab[1](s->dest[1] + off, srcU, s->uvlinesize << fieldmv, 4, uvmx_field[i], uvmy_field[i]); h264chroma->put_h264_chroma_pixels_tab[1](s->dest[2] + off, srcV, s->uvlinesize << fieldmv, 4, uvmx_field[i], uvmy_field[i]); } else { v->vc1dsp.put_no_rnd_vc1_chroma_pixels_tab[1](s->dest[1] + off, srcU, s->uvlinesize << fieldmv, 4, uvmx_field[i], uvmy_field[i]); v->vc1dsp.put_no_rnd_vc1_chroma_pixels_tab[1](s->dest[2] + off, srcV, s->uvlinesize << fieldmv, 4, uvmx_field[i], uvmy_field[i]); } } } } | 25,434 |
1 | static void moxie_cpu_initfn(Object *obj) { CPUState *cs = CPU(obj); MoxieCPU *cpu = MOXIE_CPU(obj); static int inited; cs->env_ptr = &cpu->env; cpu_exec_init(cs, &error_abort); if (tcg_enabled() && !inited) { inited = 1; moxie_translate_init(); } } | 25,435 |
1 | static int rtp_asf_fix_header(uint8_t *buf, int len) { uint8_t *p = buf, *end = buf + len; if (len < sizeof(ff_asf_guid) * 2 + 22 || memcmp(p, ff_asf_header, sizeof(ff_asf_guid))) { return -1; } p += sizeof(ff_asf_guid) + 14; do { uint64_t chunksize = AV_RL64(p + sizeof(ff_asf_guid)); if (memcmp(p, ff_asf_file_header, sizeof(ff_asf_guid))) { if (chunksize > end - p) return -1; p += chunksize; continue; } /* skip most of the file header, to min_pktsize */ p += 6 * 8 + 3 * 4 + sizeof(ff_asf_guid) * 2; if (p + 8 <= end && AV_RL32(p) == AV_RL32(p + 4)) { /* and set that to zero */ AV_WL32(p, 0); return 0; } break; } while (end - p >= sizeof(ff_asf_guid) + 8); return -1; } | 25,436 |
1 | static int vmdk_open(BlockDriverState *bs, const char *filename, int flags) { BDRVVmdkState *s = bs->opaque; uint32_t magic; int l1_size, i, ret; if (parent_open) // Parent must be opened as RO. flags = BDRV_O_RDONLY; fprintf(stderr, "(VMDK) image open: flags=0x%x filename=%s\n", flags, bs->filename); ret = bdrv_file_open(&s->hd, filename, flags | BDRV_O_AUTOGROW); if (ret < 0) return ret; if (bdrv_pread(s->hd, 0, &magic, sizeof(magic)) != sizeof(magic)) goto fail; magic = be32_to_cpu(magic); if (magic == VMDK3_MAGIC) { VMDK3Header header; if (bdrv_pread(s->hd, sizeof(magic), &header, sizeof(header)) != sizeof(header)) goto fail; s->cluster_sectors = le32_to_cpu(header.granularity); s->l2_size = 1 << 9; s->l1_size = 1 << 6; bs->total_sectors = le32_to_cpu(header.disk_sectors); s->l1_table_offset = le32_to_cpu(header.l1dir_offset) << 9; s->l1_backup_table_offset = 0; s->l1_entry_sectors = s->l2_size * s->cluster_sectors; } else if (magic == VMDK4_MAGIC) { VMDK4Header header; if (bdrv_pread(s->hd, sizeof(magic), &header, sizeof(header)) != sizeof(header)) goto fail; bs->total_sectors = le64_to_cpu(header.capacity); s->cluster_sectors = le64_to_cpu(header.granularity); s->l2_size = le32_to_cpu(header.num_gtes_per_gte); s->l1_entry_sectors = s->l2_size * s->cluster_sectors; if (s->l1_entry_sectors <= 0) goto fail; s->l1_size = (bs->total_sectors + s->l1_entry_sectors - 1) / s->l1_entry_sectors; s->l1_table_offset = le64_to_cpu(header.rgd_offset) << 9; s->l1_backup_table_offset = le64_to_cpu(header.gd_offset) << 9; if (parent_open) s->is_parent = 1; else s->is_parent = 0; // try to open parent images, if exist if (vmdk_parent_open(bs, filename) != 0) goto fail; // write the CID once after the image creation s->parent_cid = vmdk_read_cid(bs,1); } else { goto fail; } /* read the L1 table */ l1_size = s->l1_size * sizeof(uint32_t); s->l1_table = qemu_malloc(l1_size); if (!s->l1_table) goto fail; if (bdrv_pread(s->hd, s->l1_table_offset, s->l1_table, l1_size) != l1_size) goto fail; for(i = 0; i < s->l1_size; i++) { le32_to_cpus(&s->l1_table[i]); } if (s->l1_backup_table_offset) { s->l1_backup_table = qemu_malloc(l1_size); if (!s->l1_backup_table) goto fail; if (bdrv_pread(s->hd, s->l1_backup_table_offset, s->l1_backup_table, l1_size) != l1_size) goto fail; for(i = 0; i < s->l1_size; i++) { le32_to_cpus(&s->l1_backup_table[i]); } } s->l2_cache = qemu_malloc(s->l2_size * L2_CACHE_SIZE * sizeof(uint32_t)); if (!s->l2_cache) goto fail; return 0; fail: qemu_free(s->l1_backup_table); qemu_free(s->l1_table); qemu_free(s->l2_cache); bdrv_delete(s->hd); return -1; } | 25,437 |
1 | static SocketAddress *nbd_config(BDRVNBDState *s, QDict *options, Error **errp) { SocketAddress *saddr = NULL; QDict *addr = NULL; QObject *crumpled_addr = NULL; Visitor *iv = NULL; Error *local_err = NULL; qdict_extract_subqdict(options, &addr, "server."); if (!qdict_size(addr)) { error_setg(errp, "NBD server address missing"); goto done; } crumpled_addr = qdict_crumple(addr, errp); if (!crumpled_addr) { goto done; } iv = qobject_input_visitor_new(crumpled_addr); visit_type_SocketAddress(iv, NULL, &saddr, &local_err); if (local_err) { error_propagate(errp, local_err); goto done; } done: QDECREF(addr); qobject_decref(crumpled_addr); visit_free(iv); return saddr; } | 25,438 |
1 | static inline void RENAME(uyvyToY)(uint8_t *dst, uint8_t *src, long width) { #ifdef HAVE_MMX asm volatile( "mov %0, %%"REG_a" \n\t" "1: \n\t" "movq (%1, %%"REG_a",2), %%mm0 \n\t" "movq 8(%1, %%"REG_a",2), %%mm1 \n\t" "psrlw $8, %%mm0 \n\t" "psrlw $8, %%mm1 \n\t" "packuswb %%mm1, %%mm0 \n\t" "movq %%mm0, (%2, %%"REG_a") \n\t" "add $8, %%"REG_a" \n\t" " js 1b \n\t" : : "g" (-width), "r" (src+width*2), "r" (dst+width) : "%"REG_a ); #else int i; for(i=0; i<width; i++) dst[i]= src[2*i+1]; #endif } | 25,439 |
1 | static int kempf_decode_tile(G2MContext *c, int tile_x, int tile_y, const uint8_t *src, int src_size) { int width, height; int hdr, zsize, npal, tidx = -1, ret; int i, j; const uint8_t *src_end = src + src_size; uint8_t pal[768], transp[3]; uLongf dlen = (c->tile_width + 1) * c->tile_height; int sub_type; int nblocks, cblocks, bstride; int bits, bitbuf, coded; uint8_t *dst = c->framebuf + tile_x * c->tile_width * 3 + tile_y * c->tile_height * c->framebuf_stride; if (src_size < 2) width = FFMIN(c->width - tile_x * c->tile_width, c->tile_width); height = FFMIN(c->height - tile_y * c->tile_height, c->tile_height); hdr = *src++; sub_type = hdr >> 5; if (sub_type == 0) { int j; memcpy(transp, src, 3); src += 3; for (j = 0; j < height; j++, dst += c->framebuf_stride) for (i = 0; i < width; i++) memcpy(dst + i * 3, transp, 3); return 0; } else if (sub_type == 1) { return jpg_decode_data(&c->jc, width, height, src, src_end - src, dst, c->framebuf_stride, NULL, 0, 0, 0); } if (sub_type != 2) { memcpy(transp, src, 3); src += 3; } npal = *src++ + 1; memcpy(pal, src, npal * 3); src += npal * 3; if (sub_type != 2) { for (i = 0; i < npal; i++) { if (!memcmp(pal + i * 3, transp, 3)) { tidx = i; break; } } } if (src_end - src < 2) return 0; zsize = (src[0] << 8) | src[1]; src += 2; if (src_end - src < zsize + (sub_type != 2)) ret = uncompress(c->kempf_buf, &dlen, src, zsize); if (ret) src += zsize; if (sub_type == 2) { kempf_restore_buf(c->kempf_buf, dlen, dst, c->framebuf_stride, NULL, 0, width, height, pal, npal, tidx); return 0; } nblocks = *src++ + 1; cblocks = 0; bstride = FFALIGN(width, 16) >> 4; // blocks are coded LSB and we need normal bitreader for JPEG data bits = 0; for (i = 0; i < (FFALIGN(height, 16) >> 4); i++) { for (j = 0; j < (FFALIGN(width, 16) >> 4); j++) { if (!bits) { if (src >= src_end) bitbuf = *src++; bits = 8; } coded = bitbuf & 1; bits--; bitbuf >>= 1; cblocks += coded; if (cblocks > nblocks) c->kempf_flags[j + i * bstride] = coded; } } memset(c->jpeg_tile, 0, c->tile_stride * height); jpg_decode_data(&c->jc, width, height, src, src_end - src, c->jpeg_tile, c->tile_stride, c->kempf_flags, bstride, nblocks, 0); kempf_restore_buf(c->kempf_buf, dlen, dst, c->framebuf_stride, c->jpeg_tile, c->tile_stride, width, height, pal, npal, tidx); return 0; } | 25,440 |
1 | static void interpolate_refplane(DiracContext *s, DiracFrame *ref, int plane, int width, int height) { /* chroma allocates an edge of 8 when subsampled which for 4:2:2 means an h edge of 16 and v edge of 8 just use 8 for everything for the moment */ int i, edge = EDGE_WIDTH/2; ref->hpel[plane][0] = ref->avframe->data[plane]; s->mpvencdsp.draw_edges(ref->hpel[plane][0], ref->avframe->linesize[plane], width, height, edge, edge, EDGE_TOP | EDGE_BOTTOM); /* EDGE_TOP | EDGE_BOTTOM values just copied to make it build, this needs to be ensured */ /* no need for hpel if we only have fpel vectors */ if (!s->mv_precision) return; for (i = 1; i < 4; i++) { if (!ref->hpel_base[plane][i]) ref->hpel_base[plane][i] = av_malloc((height+2*edge) * ref->avframe->linesize[plane] + 32); /* we need to be 16-byte aligned even for chroma */ ref->hpel[plane][i] = ref->hpel_base[plane][i] + edge*ref->avframe->linesize[plane] + 16; } if (!ref->interpolated[plane]) { s->diracdsp.dirac_hpel_filter(ref->hpel[plane][1], ref->hpel[plane][2], ref->hpel[plane][3], ref->hpel[plane][0], ref->avframe->linesize[plane], width, height); s->mpvencdsp.draw_edges(ref->hpel[plane][1], ref->avframe->linesize[plane], width, height, edge, edge, EDGE_TOP | EDGE_BOTTOM); s->mpvencdsp.draw_edges(ref->hpel[plane][2], ref->avframe->linesize[plane], width, height, edge, edge, EDGE_TOP | EDGE_BOTTOM); s->mpvencdsp.draw_edges(ref->hpel[plane][3], ref->avframe->linesize[plane], width, height, edge, edge, EDGE_TOP | EDGE_BOTTOM); } ref->interpolated[plane] = 1; } | 25,441 |
1 | static void scsi_read_complete(void * opaque, int ret) { SCSIGenericReq *r = (SCSIGenericReq *)opaque; int len; if (ret) { DPRINTF("IO error ret %d\n", ret); scsi_command_complete(r, ret); return; } len = r->io_header.dxfer_len - r->io_header.resid; DPRINTF("Data ready tag=0x%x len=%d\n", r->req.tag, len); r->len = -1; r->req.bus->complete(r->req.bus, SCSI_REASON_DATA, r->req.tag, len); if (len == 0) scsi_command_complete(r, 0); } | 25,442 |
1 | int avfilter_process_command(AVFilterContext *filter, const char *cmd, const char *arg, char *res, int res_len, int flags) { if(!strcmp(cmd, "ping")){ av_strlcatf(res, res_len, "pong from:%s %s\n", filter->filter->name, filter->name); return 0; }else if(!strcmp(cmd, "enable")) { return set_enable_expr(filter, arg); }else if(filter->filter->process_command) { return filter->filter->process_command(filter, cmd, arg, res, res_len, flags); return AVERROR(ENOSYS); | 25,443 |
0 | static void decode_clnpass(Jpeg2000DecoderContext *s, Jpeg2000T1Context *t1, int width, int height, int bpno, int bandno, int seg_symbols) { int mask = 3 << (bpno - 1), y0, x, y, runlen, dec; for (y0 = 0; y0 < height; y0 += 4) for (x = 0; x < width; x++) { if (y0 + 3 < height && !((t1->flags[y0 + 1][x + 1] & (JPEG2000_T1_SIG_NB | JPEG2000_T1_VIS | JPEG2000_T1_SIG)) || (t1->flags[y0 + 2][x + 1] & (JPEG2000_T1_SIG_NB | JPEG2000_T1_VIS | JPEG2000_T1_SIG)) || (t1->flags[y0 + 3][x + 1] & (JPEG2000_T1_SIG_NB | JPEG2000_T1_VIS | JPEG2000_T1_SIG)) || (t1->flags[y0 + 4][x + 1] & (JPEG2000_T1_SIG_NB | JPEG2000_T1_VIS | JPEG2000_T1_SIG)))) { if (!ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_RL)) continue; runlen = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI); runlen = (runlen << 1) | ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI); dec = 1; } else { runlen = 0; dec = 0; } for (y = y0 + runlen; y < y0 + 4 && y < height; y++) { if (!dec) { if (!(t1->flags[y + 1][x + 1] & (JPEG2000_T1_SIG | JPEG2000_T1_VIS))) dec = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ff_jpeg2000_getsigctxno(t1->flags[y + 1][x + 1], bandno)); } if (dec) { int xorbit; int ctxno = ff_jpeg2000_getsgnctxno(t1->flags[y + 1][x + 1], &xorbit); t1->data[y][x] = (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ^ xorbit) ? -mask : mask; ff_jpeg2000_set_significance(t1, x, y, t1->data[y][x] < 0); } dec = 0; t1->flags[y + 1][x + 1] &= ~JPEG2000_T1_VIS; } } if (seg_symbols) { int val; val = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI); val = (val << 1) + ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI); val = (val << 1) + ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI); val = (val << 1) + ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI); if (val != 0xa) av_log(s->avctx, AV_LOG_ERROR, "Segmentation symbol value incorrect\n"); } } | 25,444 |
0 | void ff_put_h264_qpel8_mc03_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_vt_qrt_8w_msa(src - (stride * 2), stride, dst, stride, 8, 1); } | 25,445 |
0 | static av_cold int audio_write_header(AVFormatContext *s1) { AlsaData *s = s1->priv_data; AVStream *st; unsigned int sample_rate; enum AVCodecID codec_id; int res; st = s1->streams[0]; sample_rate = st->codec->sample_rate; codec_id = st->codec->codec_id; res = ff_alsa_open(s1, SND_PCM_STREAM_PLAYBACK, &sample_rate, st->codec->channels, &codec_id); if (sample_rate != st->codec->sample_rate) { av_log(s1, AV_LOG_ERROR, "sample rate %d not available, nearest is %d\n", st->codec->sample_rate, sample_rate); goto fail; } avpriv_set_pts_info(st, 64, 1, sample_rate); return res; fail: snd_pcm_close(s->h); return AVERROR(EIO); } | 25,446 |
0 | int ff_jpegls_decode_lse(MJpegDecodeContext *s) { int id; int tid, wt, maxtab, i, j; int len = get_bits(&s->gb, 16); /* length: FIXME: verify field validity */ id = get_bits(&s->gb, 8); switch (id) { case 1: s->maxval = get_bits(&s->gb, 16); s->t1 = get_bits(&s->gb, 16); s->t2 = get_bits(&s->gb, 16); s->t3 = get_bits(&s->gb, 16); s->reset = get_bits(&s->gb, 16); // ff_jpegls_reset_coding_parameters(s, 0); //FIXME quant table? break; case 2: s->palette_index = 0; case 3: tid= get_bits(&s->gb, 8); wt = get_bits(&s->gb, 8); if (len < 5) return AVERROR_INVALIDDATA; if (wt < 1 || wt > MAX_COMPONENTS) { avpriv_request_sample(s->avctx, "wt %d", wt); return AVERROR_PATCHWELCOME; } if (!s->maxval) maxtab = 255; else if ((5 + wt*(s->maxval+1)) < 65535) maxtab = s->maxval; else maxtab = 65530/wt - 1; if(s->avctx->debug & FF_DEBUG_PICT_INFO) { av_log(s->avctx, AV_LOG_DEBUG, "LSE palette %d tid:%d wt:%d maxtab:%d\n", id, tid, wt, maxtab); } if (maxtab >= 256) { avpriv_request_sample(s->avctx, ">8bit palette"); return AVERROR_PATCHWELCOME; } maxtab = FFMIN(maxtab, (len - 5) / wt + s->palette_index); if (s->palette_index > maxtab) return AVERROR_INVALIDDATA; if ((s->avctx->pix_fmt == AV_PIX_FMT_GRAY8 || s->avctx->pix_fmt == AV_PIX_FMT_PAL8) && (s->picture_ptr->format == AV_PIX_FMT_GRAY8 || s->picture_ptr->format == AV_PIX_FMT_PAL8)) { uint32_t *pal = s->picture_ptr->data[1]; s->picture_ptr->format = s->avctx->pix_fmt = AV_PIX_FMT_PAL8; for (i=s->palette_index; i<=maxtab; i++) { pal[i] = 0; for (j=0; j<wt; j++) { pal[i] |= get_bits(&s->gb, 8) << (8*(wt-j-1)); } } s->palette_index = i; } break; case 4: avpriv_request_sample(s->avctx, "oversize image"); return AVERROR(ENOSYS); default: av_log(s->avctx, AV_LOG_ERROR, "invalid id %d\n", id); return AVERROR_INVALIDDATA; } av_dlog(s->avctx, "ID=%i, T=%i,%i,%i\n", id, s->t1, s->t2, s->t3); return 0; } | 25,447 |
0 | static int mov_read_stss(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; unsigned int i, entries; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; avio_r8(pb); /* version */ avio_rb24(pb); /* flags */ entries = avio_rb32(pb); av_dlog(c->fc, "keyframe_count = %d\n", entries); if (!entries) { sc->keyframe_absent = 1; if (!st->need_parsing) st->need_parsing = AVSTREAM_PARSE_HEADERS; return 0; } if (entries >= UINT_MAX / sizeof(int)) return AVERROR_INVALIDDATA; sc->keyframes = av_malloc(entries * sizeof(int)); if (!sc->keyframes) return AVERROR(ENOMEM); for (i = 0; i < entries && !pb->eof_reached; i++) { sc->keyframes[i] = avio_rb32(pb); //av_dlog(c->fc, "keyframes[]=%d\n", sc->keyframes[i]); } sc->keyframe_count = i; if (pb->eof_reached) return AVERROR_EOF; return 0; } | 25,449 |
0 | void swr_compensate(struct SwrContext *s, int sample_delta, int compensation_distance){ ResampleContext *c= s->resample; // sample_delta += (c->ideal_dst_incr - c->dst_incr)*(int64_t)c->compensation_distance / c->ideal_dst_incr; c->compensation_distance= compensation_distance; c->dst_incr = c->ideal_dst_incr - c->ideal_dst_incr * (int64_t)sample_delta / compensation_distance; } | 25,450 |
0 | int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) { int i; Picture *pic; s->mb_skipped = 0; assert(s->last_picture_ptr==NULL || s->out_format != FMT_H264 || s->codec_id == CODEC_ID_SVQ3); /* mark&release old frames */ if (s->pict_type != FF_B_TYPE && s->last_picture_ptr && s->last_picture_ptr != s->next_picture_ptr && s->last_picture_ptr->data[0]) { if(s->out_format != FMT_H264 || s->codec_id == CODEC_ID_SVQ3){ free_frame_buffer(s, s->last_picture_ptr); /* release forgotten pictures */ /* if(mpeg124/h263) */ if(!s->encoding){ for(i=0; i<MAX_PICTURE_COUNT; i++){ if(s->picture[i].data[0] && &s->picture[i] != s->next_picture_ptr && s->picture[i].reference){ av_log(avctx, AV_LOG_ERROR, "releasing zombie picture\n"); free_frame_buffer(s, &s->picture[i]); } } } } } alloc: if(!s->encoding){ /* release non reference frames */ for(i=0; i<MAX_PICTURE_COUNT; i++){ if(s->picture[i].data[0] && !s->picture[i].reference /*&& s->picture[i].type!=FF_BUFFER_TYPE_SHARED*/){ free_frame_buffer(s, &s->picture[i]); } } if(s->current_picture_ptr && s->current_picture_ptr->data[0]==NULL) pic= s->current_picture_ptr; //we already have a unused image (maybe it was set before reading the header) else{ i= ff_find_unused_picture(s, 0); pic= &s->picture[i]; } pic->reference= 0; if (!s->dropable){ if (s->codec_id == CODEC_ID_H264) pic->reference = s->picture_structure; else if (s->pict_type != FF_B_TYPE) pic->reference = 3; } pic->coded_picture_number= s->coded_picture_number++; if(ff_alloc_picture(s, pic, 0) < 0) return -1; s->current_picture_ptr= pic; s->current_picture_ptr->top_field_first= s->top_field_first; //FIXME use only the vars from current_pic s->current_picture_ptr->interlaced_frame= !s->progressive_frame && !s->progressive_sequence; } s->current_picture_ptr->pict_type= s->pict_type; // if(s->flags && CODEC_FLAG_QSCALE) // s->current_picture_ptr->quality= s->new_picture_ptr->quality; s->current_picture_ptr->key_frame= s->pict_type == FF_I_TYPE; ff_copy_picture(&s->current_picture, s->current_picture_ptr); if (s->pict_type != FF_B_TYPE) { s->last_picture_ptr= s->next_picture_ptr; if(!s->dropable) s->next_picture_ptr= s->current_picture_ptr; } /* av_log(s->avctx, AV_LOG_DEBUG, "L%p N%p C%p L%p N%p C%p type:%d drop:%d\n", s->last_picture_ptr, s->next_picture_ptr,s->current_picture_ptr, s->last_picture_ptr ? s->last_picture_ptr->data[0] : NULL, s->next_picture_ptr ? s->next_picture_ptr->data[0] : NULL, s->current_picture_ptr ? s->current_picture_ptr->data[0] : NULL, s->pict_type, s->dropable);*/ if(s->last_picture_ptr) ff_copy_picture(&s->last_picture, s->last_picture_ptr); if(s->next_picture_ptr) ff_copy_picture(&s->next_picture, s->next_picture_ptr); if(s->pict_type != FF_I_TYPE && (s->last_picture_ptr==NULL || s->last_picture_ptr->data[0]==NULL) && !s->dropable && s->codec_id != CODEC_ID_H264){ av_log(avctx, AV_LOG_ERROR, "warning: first frame is no keyframe\n"); assert(s->pict_type != FF_B_TYPE); //these should have been dropped if we don't have a reference goto alloc; } assert(s->pict_type == FF_I_TYPE || (s->last_picture_ptr && s->last_picture_ptr->data[0])); if(s->picture_structure!=PICT_FRAME && s->out_format != FMT_H264){ int i; for(i=0; i<4; i++){ if(s->picture_structure == PICT_BOTTOM_FIELD){ s->current_picture.data[i] += s->current_picture.linesize[i]; } s->current_picture.linesize[i] *= 2; s->last_picture.linesize[i] *=2; s->next_picture.linesize[i] *=2; } } s->hurry_up= s->avctx->hurry_up; s->error_recognition= avctx->error_recognition; /* set dequantizer, we can't do it during init as it might change for mpeg4 and we can't do it in the header decode as init is not called for mpeg4 there yet */ if(s->mpeg_quant || s->codec_id == CODEC_ID_MPEG2VIDEO){ s->dct_unquantize_intra = s->dct_unquantize_mpeg2_intra; s->dct_unquantize_inter = s->dct_unquantize_mpeg2_inter; }else if(s->out_format == FMT_H263 || s->out_format == FMT_H261){ s->dct_unquantize_intra = s->dct_unquantize_h263_intra; s->dct_unquantize_inter = s->dct_unquantize_h263_inter; }else{ s->dct_unquantize_intra = s->dct_unquantize_mpeg1_intra; s->dct_unquantize_inter = s->dct_unquantize_mpeg1_inter; } if(s->dct_error_sum){ assert(s->avctx->noise_reduction && s->encoding); update_noise_reduction(s); } if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) return ff_xvmc_field_start(s, avctx); return 0; } | 25,451 |
1 | udp_listen(Slirp *slirp, uint32_t haddr, u_int hport, uint32_t laddr, u_int lport, int flags) { struct sockaddr_in addr; struct socket *so; socklen_t addrlen = sizeof(struct sockaddr_in); so = socreate(slirp); if (!so) { so->s = qemu_socket(AF_INET,SOCK_DGRAM,0); so->so_expire = curtime + SO_EXPIRE; insque(so, &slirp->udb); addr.sin_family = AF_INET; addr.sin_addr.s_addr = haddr; addr.sin_port = hport; if (bind(so->s,(struct sockaddr *)&addr, addrlen) < 0) { udp_detach(so); socket_set_fast_reuse(so->s); getsockname(so->s,(struct sockaddr *)&addr,&addrlen); so->fhost.sin = addr; sotranslate_accept(so); so->so_lfamily = AF_INET; so->so_lport = lport; so->so_laddr.s_addr = laddr; if (flags != SS_FACCEPTONCE) so->so_expire = 0; so->so_state &= SS_PERSISTENT_MASK; so->so_state |= SS_ISFCONNECTED | flags; return so; | 25,452 |
1 | static int local_post_create_passthrough(FsContext *fs_ctx, const char *path, FsCred *credp) { if (chmod(rpath(fs_ctx, path), credp->fc_mode & 07777) < 0) { return -1; } if (chown(rpath(fs_ctx, path), credp->fc_uid, credp->fc_gid) < 0) { return -1; } return 0; } | 25,453 |
1 | static int piix4_device_hotplug(DeviceState *qdev, PCIDevice *dev, PCIHotplugState state) { int slot = PCI_SLOT(dev->devfn); PIIX4PMState *s = DO_UPCAST(PIIX4PMState, dev, PCI_DEVICE(qdev)); /* Don't send event when device is enabled during qemu machine creation: * it is present on boot, no hotplug event is necessary. We do send an * event when the device is disabled later. */ if (state == PCI_COLDPLUG_ENABLED) { return 0; } s->pci0_status.up = 0; s->pci0_status.down = 0; if (state == PCI_HOTPLUG_ENABLED) { enable_device(s, slot); } else { disable_device(s, slot); } pm_update_sci(s); return 0; } | 25,454 |
1 | static int pcm_dvd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { AVFrame *frame = data; const uint8_t *src = avpkt->data; int buf_size = avpkt->size; PCMDVDContext *s = avctx->priv_data; int retval; int blocks; void *dst; if (buf_size < 3) { av_log(avctx, AV_LOG_ERROR, "PCM packet too small\n"); return AVERROR_INVALIDDATA; if ((retval = pcm_dvd_parse_header(avctx, src))) return retval; src += 3; buf_size -= 3; blocks = (buf_size + s->extra_sample_count) / s->block_size; /* get output buffer */ frame->nb_samples = blocks * s->samples_per_block; if ((retval = ff_get_buffer(avctx, frame, 0)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return retval; dst = frame->data[0]; /* consume leftover samples from last packet */ if (s->extra_sample_count) { int missing_samples = s->block_size - s->extra_sample_count; if (buf_size >= missing_samples) { memcpy(s->extra_samples + s->extra_sample_count, src, missing_samples); dst = pcm_dvd_decode_samples(avctx, s->extra_samples, dst, 1); src += missing_samples; buf_size -= missing_samples; blocks--; } else { /* new packet still doesn't have enough samples */ memcpy(s->extra_samples + s->extra_sample_count, src, buf_size); s->extra_sample_count += buf_size; return avpkt->size; /* decode remaining complete samples */ if (blocks) { pcm_dvd_decode_samples(avctx, src, dst, blocks); buf_size -= blocks * s->block_size; /* store leftover samples */ if (buf_size) { src += blocks * s->block_size; memcpy(s->extra_samples, src, buf_size); s->extra_sample_count = buf_size; *got_frame_ptr = 1; return avpkt->size; | 25,455 |
1 | void qmp_migrate_set_cache_size(int64_t value, Error **errp) { MigrationState *s = migrate_get_current(); int64_t new_size; /* Check for truncation */ if (value != (size_t)value) { error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cache size", "exceeding address space"); return; } /* Cache should not be larger than guest ram size */ if (value > ram_bytes_total()) { error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cache size", "exceeds guest ram size "); return; } new_size = xbzrle_cache_resize(value); if (new_size < 0) { error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cache size", "is smaller than page size"); return; } s->xbzrle_cache_size = new_size; } | 25,456 |
1 | static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s, void *last, void *dst, int last2, int w, int stride, int comp, int bits) { int i, x = 0; int Ra, Rb, Rc, Rd; int D0, D1, D2; while (x < w) { int err, pred; /* compute gradients */ Ra = x ? R(dst, x - stride) : R(last, x); Rb = R(last, x); Rc = x ? R(last, x - stride) : last2; Rd = (x >= w - stride) ? R(last, x) : R(last, x + stride); D0 = Rd - Rb; D1 = Rb - Rc; D2 = Rc - Ra; /* run mode */ if ((FFABS(D0) <= state->near) && (FFABS(D1) <= state->near) && (FFABS(D2) <= state->near)) { int r; int RItype; /* decode full runs while available */ while (get_bits1(&s->gb)) { int r; r = 1 << ff_log2_run[state->run_index[comp]]; if (x + r * stride > w) r = (w - x) / stride; for (i = 0; i < r; i++) { W(dst, x, Ra); x += stride; } /* if EOL reached, we stop decoding */ if (r != 1 << ff_log2_run[state->run_index[comp]]) return; if (state->run_index[comp] < 31) state->run_index[comp]++; if (x + stride > w) return; } /* decode aborted run */ r = ff_log2_run[state->run_index[comp]]; if (r) r = get_bits_long(&s->gb, r); if (x + r * stride > w) { r = (w - x) / stride; } for (i = 0; i < r; i++) { W(dst, x, Ra); x += stride; } if (x >= w) { av_log(NULL, AV_LOG_ERROR, "run overflow\n"); return; } /* decode run termination value */ Rb = R(last, x); RItype = (FFABS(Ra - Rb) <= state->near) ? 1 : 0; err = ls_get_code_runterm(&s->gb, state, RItype, ff_log2_run[state->run_index[comp]]); if (state->run_index[comp]) state->run_index[comp]--; if (state->near && RItype) { pred = Ra + err; } else { if (Rb < Ra) pred = Rb - err; else pred = Rb + err; } } else { /* regular mode */ int context, sign; context = ff_jpegls_quantize(state, D0) * 81 + ff_jpegls_quantize(state, D1) * 9 + ff_jpegls_quantize(state, D2); pred = mid_pred(Ra, Ra + Rb - Rc, Rb); if (context < 0) { context = -context; sign = 1; } else { sign = 0; } if (sign) { pred = av_clip(pred - state->C[context], 0, state->maxval); err = -ls_get_code_regular(&s->gb, state, context); } else { pred = av_clip(pred + state->C[context], 0, state->maxval); err = ls_get_code_regular(&s->gb, state, context); } /* we have to do something more for near-lossless coding */ pred += err; } if (state->near) { if (pred < -state->near) pred += state->range * state->twonear; else if (pred > state->maxval + state->near) pred -= state->range * state->twonear; pred = av_clip(pred, 0, state->maxval); } pred &= state->maxval; W(dst, x, pred); x += stride; } } | 25,457 |
0 | static void do_video_out(AVFormatContext *s, OutputStream *ost, AVFrame *in_picture, float quality) { int ret, format_video_sync; AVPacket pkt; AVCodecContext *enc = ost->st->codec; int nb_frames; double sync_ipts, delta; double duration = 0; int frame_size = 0; InputStream *ist = NULL; if (ost->source_index >= 0) ist = input_streams[ost->source_index]; if(ist && ist->st->start_time != AV_NOPTS_VALUE && ist->st->first_dts != AV_NOPTS_VALUE && ost->frame_rate.num) duration = 1/(av_q2d(ost->frame_rate) * av_q2d(enc->time_base)); sync_ipts = in_picture->pts; delta = sync_ipts - ost->sync_opts + duration; /* by default, we output a single frame */ nb_frames = 1; format_video_sync = video_sync_method; if (format_video_sync == VSYNC_AUTO) format_video_sync = (s->oformat->flags & AVFMT_VARIABLE_FPS) ? ((s->oformat->flags & AVFMT_NOTIMESTAMPS) ? VSYNC_PASSTHROUGH : VSYNC_VFR) : 1; switch (format_video_sync) { case VSYNC_CFR: // FIXME set to 0.5 after we fix some dts/pts bugs like in avidec.c if (delta < -1.1) nb_frames = 0; else if (delta > 1.1) nb_frames = lrintf(delta); break; case VSYNC_VFR: if (delta <= -0.6) nb_frames = 0; else if (delta > 0.6) ost->sync_opts = lrint(sync_ipts); break; case VSYNC_DROP: case VSYNC_PASSTHROUGH: ost->sync_opts = lrint(sync_ipts); break; default: av_assert0(0); } nb_frames = FFMIN(nb_frames, ost->max_frames - ost->frame_number); if (nb_frames == 0) { nb_frames_drop++; av_log(NULL, AV_LOG_VERBOSE, "*** drop!\n"); return; } else if (nb_frames > 1) { if (nb_frames > dts_error_threshold * 30) { av_log(NULL, AV_LOG_ERROR, "%d frame duplication too large, skiping\n", nb_frames - 1); nb_frames_drop++; return; } nb_frames_dup += nb_frames - 1; av_log(NULL, AV_LOG_VERBOSE, "*** %d dup!\n", nb_frames - 1); } duplicate_frame: av_init_packet(&pkt); pkt.data = NULL; pkt.size = 0; in_picture->pts = ost->sync_opts; if (!check_recording_time(ost)) return; if (s->oformat->flags & AVFMT_RAWPICTURE && enc->codec->id == CODEC_ID_RAWVIDEO) { /* raw pictures are written as AVPicture structure to avoid any copies. We support temporarily the older method. */ enc->coded_frame->interlaced_frame = in_picture->interlaced_frame; enc->coded_frame->top_field_first = in_picture->top_field_first; pkt.data = (uint8_t *)in_picture; pkt.size = sizeof(AVPicture); pkt.pts = av_rescale_q(in_picture->pts, enc->time_base, ost->st->time_base); pkt.flags |= AV_PKT_FLAG_KEY; write_frame(s, &pkt, ost); video_size += pkt.size; } else { int got_packet; AVFrame big_picture; big_picture = *in_picture; /* better than nothing: use input picture interlaced settings */ big_picture.interlaced_frame = in_picture->interlaced_frame; if (ost->st->codec->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME)) { if (ost->top_field_first == -1) big_picture.top_field_first = in_picture->top_field_first; else big_picture.top_field_first = !!ost->top_field_first; } /* handles same_quant here. This is not correct because it may not be a global option */ big_picture.quality = quality; if (!enc->me_threshold) big_picture.pict_type = 0; if (ost->forced_kf_index < ost->forced_kf_count && big_picture.pts >= ost->forced_kf_pts[ost->forced_kf_index]) { big_picture.pict_type = AV_PICTURE_TYPE_I; ost->forced_kf_index++; } update_benchmark(NULL); ret = avcodec_encode_video2(enc, &pkt, &big_picture, &got_packet); update_benchmark("encode_video %d.%d", ost->file_index, ost->index); if (ret < 0) { av_log(NULL, AV_LOG_FATAL, "Video encoding failed\n"); exit_program(1); } if (got_packet) { if (pkt.pts == AV_NOPTS_VALUE && !(enc->codec->capabilities & CODEC_CAP_DELAY)) pkt.pts = ost->sync_opts; if (pkt.pts != AV_NOPTS_VALUE) pkt.pts = av_rescale_q(pkt.pts, enc->time_base, ost->st->time_base); if (pkt.dts != AV_NOPTS_VALUE) pkt.dts = av_rescale_q(pkt.dts, enc->time_base, ost->st->time_base); if (debug_ts) { av_log(NULL, AV_LOG_INFO, "encoder -> type:video " "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s\n", av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &ost->st->time_base), av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &ost->st->time_base)); } write_frame(s, &pkt, ost); frame_size = pkt.size; video_size += pkt.size; av_free_packet(&pkt); /* if two pass, output log */ if (ost->logfile && enc->stats_out) { fprintf(ost->logfile, "%s", enc->stats_out); } } } ost->sync_opts++; /* * For video, number of frames in == number of packets out. * But there may be reordering, so we can't throw away frames on encoder * flush, we need to limit them here, before they go into encoder. */ ost->frame_number++; if(--nb_frames) goto duplicate_frame; if (vstats_filename && frame_size) do_video_stats(output_files[ost->file_index]->ctx, ost, frame_size); } | 25,458 |
1 | int opt_loglevel(void *optctx, const char *opt, const char *arg) { const struct { const char *name; int level; } log_levels[] = { { "quiet" , AV_LOG_QUIET }, { "panic" , AV_LOG_PANIC }, { "fatal" , AV_LOG_FATAL }, { "error" , AV_LOG_ERROR }, { "warning", AV_LOG_WARNING }, { "info" , AV_LOG_INFO }, { "verbose", AV_LOG_VERBOSE }, { "debug" , AV_LOG_DEBUG }, }; char *tail; int level; int i; for (i = 0; i < FF_ARRAY_ELEMS(log_levels); i++) { if (!strcmp(log_levels[i].name, arg)) { av_log_set_level(log_levels[i].level); return 0; } } level = strtol(arg, &tail, 10); if (*tail) { av_log(NULL, AV_LOG_FATAL, "Invalid loglevel \"%s\". " "Possible levels are numbers or:\n", arg); for (i = 0; i < FF_ARRAY_ELEMS(log_levels); i++) av_log(NULL, AV_LOG_FATAL, "\"%s\"\n", log_levels[i].name); exit(1); } av_log_set_level(level); return 0; } | 25,461 |
1 | static void ram_save_cleanup(void *opaque) { RAMState **rsp = opaque; RAMBlock *block; /* caller have hold iothread lock or is in a bh, so there is * no writing race against this migration_bitmap */ memory_global_dirty_log_stop(); QLIST_FOREACH_RCU(block, &ram_list.blocks, next) { g_free(block->bmap); block->bmap = NULL; g_free(block->unsentmap); block->unsentmap = NULL; } XBZRLE_cache_lock(); if (XBZRLE.cache) { cache_fini(XBZRLE.cache); g_free(XBZRLE.encoded_buf); g_free(XBZRLE.current_buf); g_free(XBZRLE.zero_target_page); XBZRLE.cache = NULL; XBZRLE.encoded_buf = NULL; XBZRLE.current_buf = NULL; XBZRLE.zero_target_page = NULL; } XBZRLE_cache_unlock(); compress_threads_save_cleanup(); ram_state_cleanup(rsp); } | 25,462 |
0 | const AVOption *av_opt_next(void *obj, const AVOption *last) { AVClass *class = *(AVClass**)obj; if (!last && class->option && class->option[0].name) return class->option; if (last && last[1].name) return ++last; return NULL; } | 25,463 |
0 | int avfilter_graph_create_filter(AVFilterContext **filt_ctx, AVFilter *filt, const char *name, const char *args, void *opaque, AVFilterGraph *graph_ctx) { int ret; *filt_ctx = avfilter_graph_alloc_filter(graph_ctx, filt, name); if (!*filt_ctx) return AVERROR(ENOMEM); ret = avfilter_init_filter(*filt_ctx, args, opaque); if (ret < 0) goto fail; return 0; fail: if (*filt_ctx) avfilter_free(*filt_ctx); *filt_ctx = NULL; return ret; } | 25,464 |
1 | static void es1370_class_init (ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS (klass); PCIDeviceClass *k = PCI_DEVICE_CLASS (klass); k->realize = es1370_realize; k->vendor_id = PCI_VENDOR_ID_ENSONIQ; k->device_id = PCI_DEVICE_ID_ENSONIQ_ES1370; k->class_id = PCI_CLASS_MULTIMEDIA_AUDIO; k->subsystem_vendor_id = 0x4942; k->subsystem_id = 0x4c4c; set_bit(DEVICE_CATEGORY_SOUND, dc->categories); dc->desc = "ENSONIQ AudioPCI ES1370"; dc->vmsd = &vmstate_es1370; } | 25,465 |
1 | static inline int64_t add64(const int64_t a, const int64_t b) { return a + b; } | 25,467 |
1 | static void slavio_timer_init_all(target_phys_addr_t addr, qemu_irq master_irq, qemu_irq *cpu_irqs, unsigned int num_cpus) { DeviceState *dev; SysBusDevice *s; unsigned int i; dev = qdev_create(NULL, "slavio_timer"); qdev_prop_set_uint32(dev, "num_cpus", num_cpus); qdev_init(dev); s = sysbus_from_qdev(dev); sysbus_connect_irq(s, 0, master_irq); sysbus_mmio_map(s, 0, addr + SYS_TIMER_OFFSET); for (i = 0; i < MAX_CPUS; i++) { sysbus_mmio_map(s, i + 1, addr + (target_phys_addr_t)CPU_TIMER_OFFSET(i)); sysbus_connect_irq(s, i + 1, cpu_irqs[i]); } } | 25,469 |
1 | int ff_pred_weight_table(H264Context *h) { int list, i; int luma_def, chroma_def; h->use_weight = 0; h->use_weight_chroma = 0; h->luma_log2_weight_denom = get_ue_golomb(&h->gb); if (h->sps.chroma_format_idc) h->chroma_log2_weight_denom = get_ue_golomb(&h->gb); luma_def = 1 << h->luma_log2_weight_denom; chroma_def = 1 << h->chroma_log2_weight_denom; for (list = 0; list < 2; list++) { h->luma_weight_flag[list] = 0; h->chroma_weight_flag[list] = 0; for (i = 0; i < h->ref_count[list]; i++) { int luma_weight_flag, chroma_weight_flag; luma_weight_flag = get_bits1(&h->gb); if (luma_weight_flag) { h->luma_weight[i][list][0] = get_se_golomb(&h->gb); h->luma_weight[i][list][1] = get_se_golomb(&h->gb); if (h->luma_weight[i][list][0] != luma_def || h->luma_weight[i][list][1] != 0) { h->use_weight = 1; h->luma_weight_flag[list] = 1; } else { h->luma_weight[i][list][0] = luma_def; h->luma_weight[i][list][1] = 0; if (h->sps.chroma_format_idc) { chroma_weight_flag = get_bits1(&h->gb); if (chroma_weight_flag) { int j; for (j = 0; j < 2; j++) { h->chroma_weight[i][list][j][0] = get_se_golomb(&h->gb); h->chroma_weight[i][list][j][1] = get_se_golomb(&h->gb); if (h->chroma_weight[i][list][j][0] != chroma_def || h->chroma_weight[i][list][j][1] != 0) { h->use_weight_chroma = 1; h->chroma_weight_flag[list] = 1; } else { int j; for (j = 0; j < 2; j++) { h->chroma_weight[i][list][j][0] = chroma_def; h->chroma_weight[i][list][j][1] = 0; if (h->slice_type_nos != AV_PICTURE_TYPE_B) break; h->use_weight = h->use_weight || h->use_weight_chroma; return 0; | 25,470 |
1 | static int mpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_output, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; Mpeg1Context *s = avctx->priv_data; AVFrame *picture = data; MpegEncContext *s2 = &s->mpeg_enc_ctx; av_dlog(avctx, "fill_buffer\n"); if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == SEQ_END_CODE)) { /* special case for last picture */ if (s2->low_delay == 0 && s2->next_picture_ptr) { int ret = av_frame_ref(picture, &s2->next_picture_ptr->f); if (ret < 0) return ret; s2->next_picture_ptr = NULL; *got_output = 1; } return buf_size; } if (s2->flags & CODEC_FLAG_TRUNCATED) { int next = ff_mpeg1_find_frame_end(&s2->parse_context, buf, buf_size, NULL); if (ff_combine_frame(&s2->parse_context, next, (const uint8_t **) &buf, &buf_size) < 0) return buf_size; } if (s->mpeg_enc_ctx_allocated == 0 && avctx->codec_tag == AV_RL32("VCR2")) vcr2_init_sequence(avctx); s->slice_count = 0; if (avctx->extradata && !s->extradata_decoded) { int ret = decode_chunks(avctx, picture, got_output, avctx->extradata, avctx->extradata_size); s->extradata_decoded = 1; if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE)) return ret; } return decode_chunks(avctx, picture, got_output, buf, buf_size); } | 25,471 |
1 | static void blur(CoverContext *cover, AVFrame *in, int offx, int offy) { int x, y, p; for (p=0; p<3; p++) { int ox = offx>>!!p; int oy = offy>>!!p; int stride = in->linesize[p]; uint8_t *data = in->data[p] + ox + oy * stride; int w = FF_CEIL_RSHIFT(cover->width , !!p); int h = FF_CEIL_RSHIFT(cover->height, !!p); int iw = FF_CEIL_RSHIFT(in->width , !!p); int ih = FF_CEIL_RSHIFT(in->height, !!p); for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { int c = 0; int s = 0; if (ox) { int scale = 65536 / (x + 1); s += data[-1 + y*stride] * scale; c += scale; } if (oy) { int scale = 65536 / (y + 1); s += data[x - stride] * scale; c += scale; } if (ox + w < iw) { int scale = 65536 / (w - x); s += data[w + y*stride] * scale; c += scale; } if (oy + h < ih) { int scale = 65536 / (h - y); s += data[x + h*stride] * scale; c += scale; } data[x + y*stride] = (s + (c>>1)) / c; } } } } | 25,473 |
1 | static int wav_read_header(AVFormatContext *s) { int64_t size, av_uninit(data_size); int64_t sample_count = 0; int rf64 = 0; char start_code[32]; uint32_t tag; AVIOContext *pb = s->pb; AVStream *st = NULL; WAVDemuxContext *wav = s->priv_data; int ret, got_fmt = 0; int64_t next_tag_ofs, data_ofs = -1; wav->unaligned = avio_tell(s->pb) & 1; wav->smv_data_ofs = -1; /* read chunk ID */ tag = avio_rl32(pb); switch (tag) { case MKTAG('R', 'I', 'F', 'F'): break; case MKTAG('R', 'I', 'F', 'X'): wav->rifx = 1; break; case MKTAG('R', 'F', '6', '4'): rf64 = 1; break; default: av_get_codec_tag_string(start_code, sizeof(start_code), tag); av_log(s, AV_LOG_ERROR, "invalid start code %s in RIFF header\n", start_code); return AVERROR_INVALIDDATA; /* read chunk size */ avio_rl32(pb); /* read format */ if (avio_rl32(pb) != MKTAG('W', 'A', 'V', 'E')) { av_log(s, AV_LOG_ERROR, "invalid format in RIFF header\n"); return AVERROR_INVALIDDATA; if (rf64) { if (avio_rl32(pb) != MKTAG('d', 's', '6', '4')) return AVERROR_INVALIDDATA; size = avio_rl32(pb); if (size < 24) return AVERROR_INVALIDDATA; avio_rl64(pb); /* RIFF size */ data_size = avio_rl64(pb); sample_count = avio_rl64(pb); if (data_size < 0 || sample_count < 0) { av_log(s, AV_LOG_ERROR, "negative data_size and/or sample_count in " "ds64: data_size = %"PRId64", sample_count = %"PRId64"\n", data_size, sample_count); return AVERROR_INVALIDDATA; avio_skip(pb, size - 24); /* skip rest of ds64 chunk */ for (;;) { AVStream *vst; size = next_tag(pb, &tag, wav->rifx); next_tag_ofs = avio_tell(pb) + size; if (avio_feof(pb)) break; switch (tag) { case MKTAG('f', 'm', 't', ' '): /* only parse the first 'fmt ' tag found */ if (!got_fmt && (ret = wav_parse_fmt_tag(s, size, &st)) < 0) { return ret; } else if (got_fmt) av_log(s, AV_LOG_WARNING, "found more than one 'fmt ' tag\n"); got_fmt = 1; break; case MKTAG('d', 'a', 't', 'a'): if (!got_fmt) { av_log(s, AV_LOG_ERROR, "found no 'fmt ' tag before the 'data' tag\n"); return AVERROR_INVALIDDATA; if (rf64) { next_tag_ofs = wav->data_end = avio_tell(pb) + data_size; } else if (size != 0xFFFFFFFF) { data_size = size; next_tag_ofs = wav->data_end = size ? next_tag_ofs : INT64_MAX; } else { av_log(s, AV_LOG_WARNING, "Ignoring maximum wav data size, " "file may be invalid\n"); data_size = 0; next_tag_ofs = wav->data_end = INT64_MAX; data_ofs = avio_tell(pb); /* don't look for footer metadata if we can't seek or if we don't * know where the data tag ends */ if (!pb->seekable || (!rf64 && !size)) goto break_loop; break; case MKTAG('f', 'a', 'c', 't'): if (!sample_count) sample_count = (!wav->rifx ? avio_rl32(pb) : avio_rb32(pb)); break; case MKTAG('b', 'e', 'x', 't'): if ((ret = wav_parse_bext_tag(s, size)) < 0) return ret; break; case MKTAG('S','M','V','0'): if (!got_fmt) { av_log(s, AV_LOG_ERROR, "found no 'fmt ' tag before the 'SMV0' tag\n"); return AVERROR_INVALIDDATA; // SMV file, a wav file with video appended. if (size != MKTAG('0','2','0','0')) { av_log(s, AV_LOG_ERROR, "Unknown SMV version found\n"); goto break_loop; av_log(s, AV_LOG_DEBUG, "Found SMV data\n"); wav->smv_given_first = 0; vst = avformat_new_stream(s, NULL); if (!vst) return AVERROR(ENOMEM); avio_r8(pb); vst->id = 1; vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; vst->codec->codec_id = AV_CODEC_ID_SMVJPEG; vst->codec->width = avio_rl24(pb); vst->codec->height = avio_rl24(pb); if (ff_alloc_extradata(vst->codec, 4)) { av_log(s, AV_LOG_ERROR, "Could not allocate extradata.\n"); return AVERROR(ENOMEM); size = avio_rl24(pb); wav->smv_data_ofs = avio_tell(pb) + (size - 5) * 3; avio_rl24(pb); wav->smv_block_size = avio_rl24(pb); avpriv_set_pts_info(vst, 32, 1, avio_rl24(pb)); vst->duration = avio_rl24(pb); avio_rl24(pb); avio_rl24(pb); wav->smv_frames_per_jpeg = avio_rl24(pb); if (wav->smv_frames_per_jpeg > 65536) { av_log(s, AV_LOG_ERROR, "too many frames per jpeg\n"); return AVERROR_INVALIDDATA; AV_WL32(vst->codec->extradata, wav->smv_frames_per_jpeg); wav->smv_cur_pt = 0; goto break_loop; case MKTAG('L', 'I', 'S', 'T'): if (size < 4) { av_log(s, AV_LOG_ERROR, "too short LIST tag\n"); return AVERROR_INVALIDDATA; switch (avio_rl32(pb)) { case MKTAG('I', 'N', 'F', 'O'): ff_read_riff_info(s, size - 4); break; /* seek to next tag unless we know that we'll run into EOF */ if ((avio_size(pb) > 0 && next_tag_ofs >= avio_size(pb)) || wav_seek_tag(wav, pb, next_tag_ofs, SEEK_SET) < 0) { break; break_loop: if (data_ofs < 0) { av_log(s, AV_LOG_ERROR, "no 'data' tag found\n"); return AVERROR_INVALIDDATA; avio_seek(pb, data_ofs, SEEK_SET); if ( data_size > 0 && sample_count && st->codec->channels && (data_size << 3) / sample_count / st->codec->channels > st->codec->bits_per_coded_sample) { av_log(s, AV_LOG_WARNING, "ignoring wrong sample_count %"PRId64"\n", sample_count); sample_count = 0; if (!sample_count || av_get_exact_bits_per_sample(st->codec->codec_id) > 0) if ( st->codec->channels && data_size && av_get_bits_per_sample(st->codec->codec_id) && wav->data_end <= avio_size(pb)) sample_count = (data_size << 3) / (st->codec->channels * (uint64_t)av_get_bits_per_sample(st->codec->codec_id)); if (sample_count) st->duration = sample_count; ff_metadata_conv_ctx(s, NULL, wav_metadata_conv); ff_metadata_conv_ctx(s, NULL, ff_riff_info_conv); return 0; | 25,474 |
1 | static int parse_bsfs(void *log_ctx, const char *bsfs_spec, AVBitStreamFilterContext **bsfs) { char *bsf_name, *buf, *saveptr; int ret = 0; if (!(buf = av_strdup(bsfs_spec))) return AVERROR(ENOMEM); while (bsf_name = av_strtok(buf, ",", &saveptr)) { AVBitStreamFilterContext *bsf = av_bitstream_filter_init(bsf_name); if (!bsf) { av_log(log_ctx, AV_LOG_ERROR, "Cannot initialize bitstream filter with name '%s', " "unknown filter or internal error happened\n", bsf_name); ret = AVERROR_UNKNOWN; goto end; } /* append bsf context to the list of bsf contexts */ *bsfs = bsf; bsfs = &bsf->next; buf = NULL; } end: av_free(buf); return ret; } | 25,475 |
1 | void ff_ivi_output_plane(IVIPlaneDesc *plane, uint8_t *dst, int dst_pitch) { int x, y; const int16_t *src = plane->bands[0].buf; uint32_t pitch = plane->bands[0].pitch; for (y = 0; y < plane->height; y++) { for (x = 0; x < plane->width; x++) dst[x] = av_clip_uint8(src[x] + 128); src += pitch; dst += dst_pitch; } } | 25,476 |
1 | static void secondary_do_checkpoint(BDRVReplicationState *s, Error **errp) { Error *local_err = NULL; int ret; if (!s->secondary_disk->bs->job) { error_setg(errp, "Backup job was cancelled unexpectedly"); backup_do_checkpoint(s->secondary_disk->bs->job, &local_err); if (local_err) { error_propagate(errp, local_err); ret = s->active_disk->bs->drv->bdrv_make_empty(s->active_disk->bs); if (ret < 0) { error_setg(errp, "Cannot make active disk empty"); ret = s->hidden_disk->bs->drv->bdrv_make_empty(s->hidden_disk->bs); if (ret < 0) { error_setg(errp, "Cannot make hidden disk empty"); | 25,478 |
1 | static void vnc_dpy_update(DisplayChangeListener *dcl, DisplayState *ds, int x, int y, int w, int h) { int i; VncDisplay *vd = ds->opaque; struct VncSurface *s = &vd->guest; int width = ds_get_width(ds); int height = ds_get_height(ds); h += y; /* round x down to ensure the loop only spans one 16-pixel block per, iteration. otherwise, if (x % 16) != 0, the last iteration may span two 16-pixel blocks but we only mark the first as dirty */ w += (x % 16); x -= (x % 16); x = MIN(x, width); y = MIN(y, height); w = MIN(x + w, width) - x; h = MIN(h, height); for (; y < h; y++) for (i = 0; i < w; i += 16) set_bit((x + i) / 16, s->dirty[y]); } | 25,479 |
1 | static int aio_read_f(BlockBackend *blk, int argc, char **argv) { int nr_iov, c; struct aio_ctx *ctx = g_new0(struct aio_ctx, 1); ctx->blk = blk; while ((c = getopt(argc, argv, "CP:qv")) != -1) { switch (c) { case 'C': ctx->Cflag = 1; break; case 'P': ctx->Pflag = 1; ctx->pattern = parse_pattern(optarg); if (ctx->pattern < 0) { g_free(ctx); return 0; } break; case 'q': ctx->qflag = 1; break; case 'v': ctx->vflag = 1; break; default: g_free(ctx); return qemuio_command_usage(&aio_read_cmd); } } if (optind > argc - 2) { g_free(ctx); return qemuio_command_usage(&aio_read_cmd); } ctx->offset = cvtnum(argv[optind]); if (ctx->offset < 0) { print_cvtnum_err(ctx->offset, argv[optind]); g_free(ctx); return 0; } optind++; if (ctx->offset & 0x1ff) { printf("offset %" PRId64 " is not sector aligned\n", ctx->offset); g_free(ctx); return 0; } nr_iov = argc - optind; ctx->buf = create_iovec(blk, &ctx->qiov, &argv[optind], nr_iov, 0xab); if (ctx->buf == NULL) { g_free(ctx); return 0; } gettimeofday(&ctx->t1, NULL); block_acct_start(blk_get_stats(blk), &ctx->acct, ctx->qiov.size, BLOCK_ACCT_READ); blk_aio_readv(blk, ctx->offset >> 9, &ctx->qiov, ctx->qiov.size >> 9, aio_read_done, ctx); return 0; } | 25,480 |
0 | static int ff_estimate_motion_b(MpegEncContext * s, int mb_x, int mb_y, int16_t (*mv_table)[2], int ref_index, int f_code) { MotionEstContext * const c= &s->me; int mx, my, dmin; int P[10][2]; const int shift= 1+s->quarter_sample; const int mot_stride = s->mb_stride; const int mot_xy = mb_y*mot_stride + mb_x; uint8_t * const mv_penalty= c->mv_penalty[f_code] + MAX_MV; int mv_scale; c->penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_cmp); c->sub_penalty_factor= get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_sub_cmp); c->mb_penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->mb_cmp); c->current_mv_penalty= mv_penalty; get_limits(s, 16*mb_x, 16*mb_y); switch(s->me_method) { case ME_ZERO: default: no_motion_search(s, &mx, &my); dmin = 0; mx-= mb_x*16; my-= mb_y*16; break; #if 0 case ME_FULL: dmin = full_motion_search(s, &mx, &my, range, ref_picture); mx-= mb_x*16; my-= mb_y*16; break; case ME_LOG: dmin = log_motion_search(s, &mx, &my, range / 2, ref_picture); mx-= mb_x*16; my-= mb_y*16; break; case ME_PHODS: dmin = phods_motion_search(s, &mx, &my, range / 2, ref_picture); mx-= mb_x*16; my-= mb_y*16; break; #endif case ME_X1: case ME_EPZS: { P_LEFT[0] = mv_table[mot_xy - 1][0]; P_LEFT[1] = mv_table[mot_xy - 1][1]; if(P_LEFT[0] > (c->xmax<<shift)) P_LEFT[0] = (c->xmax<<shift); /* special case for first line */ if (!s->first_slice_line) { P_TOP[0] = mv_table[mot_xy - mot_stride ][0]; P_TOP[1] = mv_table[mot_xy - mot_stride ][1]; P_TOPRIGHT[0] = mv_table[mot_xy - mot_stride + 1 ][0]; P_TOPRIGHT[1] = mv_table[mot_xy - mot_stride + 1 ][1]; if(P_TOP[1] > (c->ymax<<shift)) P_TOP[1]= (c->ymax<<shift); if(P_TOPRIGHT[0] < (c->xmin<<shift)) P_TOPRIGHT[0]= (c->xmin<<shift); if(P_TOPRIGHT[1] > (c->ymax<<shift)) P_TOPRIGHT[1]= (c->ymax<<shift); P_MEDIAN[0]= mid_pred(P_LEFT[0], P_TOP[0], P_TOPRIGHT[0]); P_MEDIAN[1]= mid_pred(P_LEFT[1], P_TOP[1], P_TOPRIGHT[1]); } c->pred_x= P_LEFT[0]; c->pred_y= P_LEFT[1]; } if(mv_table == s->b_forw_mv_table){ mv_scale= (s->pb_time<<16) / (s->pp_time<<shift); }else{ mv_scale= ((s->pb_time - s->pp_time)<<16) / (s->pp_time<<shift); } dmin = ff_epzs_motion_search(s, &mx, &my, P, 0, ref_index, s->p_mv_table, mv_scale, 0, 16); break; } dmin= c->sub_motion_search(s, &mx, &my, dmin, 0, ref_index, 0, 16); if(c->avctx->me_sub_cmp != c->avctx->mb_cmp && !c->skip) dmin= get_mb_score(s, mx, my, 0, ref_index); //printf("%d %d %d %d//", s->mb_x, s->mb_y, mx, my); // s->mb_type[mb_y*s->mb_width + mb_x]= mb_type; mv_table[mot_xy][0]= mx; mv_table[mot_xy][1]= my; return dmin; } | 25,482 |
1 | static int count_contiguous_clusters(uint64_t nb_clusters, int cluster_size, uint64_t *l2_table, uint64_t stop_flags) { int i; uint64_t mask = stop_flags | L2E_OFFSET_MASK | QCOW2_CLUSTER_COMPRESSED; uint64_t first_entry = be64_to_cpu(l2_table[0]); uint64_t offset = first_entry & mask; if (!offset) return 0; assert(qcow2_get_cluster_type(first_entry) != QCOW2_CLUSTER_COMPRESSED); for (i = 0; i < nb_clusters; i++) { uint64_t l2_entry = be64_to_cpu(l2_table[i]) & mask; if (offset + (uint64_t) i * cluster_size != l2_entry) { break; } } return i; } | 25,483 |
1 | AddressSpace *pci_device_iommu_address_space(PCIDevice *dev) { PCIBus *bus = PCI_BUS(dev->bus); if (bus->iommu_fn) { return bus->iommu_fn(bus, bus->iommu_opaque, dev->devfn); } if (bus->parent_dev) { /** We are ignoring the bus master DMA bit of the bridge * as it would complicate things such as VFIO for no good reason */ return pci_device_iommu_address_space(bus->parent_dev); } return &address_space_memory; } | 25,484 |
1 | static int vc1_decode_b_mb_intfr(VC1Context *v) { MpegEncContext *s = &v->s; GetBitContext *gb = &s->gb; int i, j; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; int cbp = 0; /* cbp decoding stuff */ int mqdiff, mquant; /* MB quantization */ int ttmb = v->ttfrm; /* MB Transform type */ int mvsw = 0; /* motion vector switch */ int mb_has_coeffs = 1; /* last_flag */ int dmv_x, dmv_y; /* Differential MV components */ int val; /* temp value */ int first_block = 1; int dst_idx, off; int skipped, direct, twomv = 0; int block_cbp = 0, pat, block_tt = 0; int idx_mbmode = 0, mvbp; int stride_y, fieldtx; int bmvtype = BMV_TYPE_BACKWARD; int dir, dir2; mquant = v->pq; /* Lossy initialization */ s->mb_intra = 0; if (v->skip_is_raw) skipped = get_bits1(gb); else skipped = v->s.mbskip_table[mb_pos]; if (!skipped) { idx_mbmode = get_vlc2(gb, v->mbmode_vlc->table, VC1_INTFR_NON4MV_MBMODE_VLC_BITS, 2); if (ff_vc1_mbmode_intfrp[0][idx_mbmode][0] == MV_PMODE_INTFR_2MV_FIELD) { twomv = 1; v->blk_mv_type[s->block_index[0]] = 1; v->blk_mv_type[s->block_index[1]] = 1; v->blk_mv_type[s->block_index[2]] = 1; v->blk_mv_type[s->block_index[3]] = 1; } else { v->blk_mv_type[s->block_index[0]] = 0; v->blk_mv_type[s->block_index[1]] = 0; v->blk_mv_type[s->block_index[2]] = 0; v->blk_mv_type[s->block_index[3]] = 0; } } if (v->dmb_is_raw) direct = get_bits1(gb); else direct = v->direct_mb_plane[mb_pos]; if (direct) { s->mv[0][0][0] = s->current_picture.motion_val[0][s->block_index[0]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][0], v->bfraction, 0, s->quarter_sample); s->mv[0][0][1] = s->current_picture.motion_val[0][s->block_index[0]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][1], v->bfraction, 0, s->quarter_sample); s->mv[1][0][0] = s->current_picture.motion_val[1][s->block_index[0]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][0], v->bfraction, 1, s->quarter_sample); s->mv[1][0][1] = s->current_picture.motion_val[1][s->block_index[0]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][1], v->bfraction, 1, s->quarter_sample); if (twomv) { s->mv[0][2][0] = s->current_picture.motion_val[0][s->block_index[2]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][0], v->bfraction, 0, s->quarter_sample); s->mv[0][2][1] = s->current_picture.motion_val[0][s->block_index[2]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][1], v->bfraction, 0, s->quarter_sample); s->mv[1][2][0] = s->current_picture.motion_val[1][s->block_index[2]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][0], v->bfraction, 1, s->quarter_sample); s->mv[1][2][1] = s->current_picture.motion_val[1][s->block_index[2]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][1], v->bfraction, 1, s->quarter_sample); for (i = 1; i < 4; i += 2) { s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0] = s->mv[0][i-1][0]; s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1] = s->mv[0][i-1][1]; s->mv[1][i][0] = s->current_picture.motion_val[1][s->block_index[i]][0] = s->mv[1][i-1][0]; s->mv[1][i][1] = s->current_picture.motion_val[1][s->block_index[i]][1] = s->mv[1][i-1][1]; } } else { for (i = 1; i < 4; i++) { s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0] = s->mv[0][0][0]; s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1] = s->mv[0][0][1]; s->mv[1][i][0] = s->current_picture.motion_val[1][s->block_index[i]][0] = s->mv[1][0][0]; s->mv[1][i][1] = s->current_picture.motion_val[1][s->block_index[i]][1] = s->mv[1][0][1]; } } } if (ff_vc1_mbmode_intfrp[0][idx_mbmode][0] == MV_PMODE_INTFR_INTRA) { // intra MB for (i = 0; i < 4; i++) { s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0] = 0; s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1] = 0; s->mv[1][i][0] = s->current_picture.motion_val[1][s->block_index[i]][0] = 0; s->mv[1][i][1] = s->current_picture.motion_val[1][s->block_index[i]][1] = 0; } s->current_picture.mb_type[mb_pos] = MB_TYPE_INTRA; s->mb_intra = v->is_intra[s->mb_x] = 1; for (i = 0; i < 6; i++) v->mb_type[0][s->block_index[i]] = 1; fieldtx = v->fieldtx_plane[mb_pos] = get_bits1(gb); mb_has_coeffs = get_bits1(gb); if (mb_has_coeffs) cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb); GET_MQUANT(); s->current_picture.qscale_table[mb_pos] = mquant; /* Set DC scale - y and c use the same (not sure if necessary here) */ s->y_dc_scale = s->y_dc_scale_table[mquant]; s->c_dc_scale = s->c_dc_scale_table[mquant]; dst_idx = 0; for (i = 0; i < 6; i++) { s->dc_val[0][s->block_index[i]] = 0; dst_idx += i >> 2; val = ((cbp >> (5 - i)) & 1); v->mb_type[0][s->block_index[i]] = s->mb_intra; v->a_avail = v->c_avail = 0; if (i == 2 || i == 3 || !s->first_slice_line) v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]]; if (i == 1 || i == 3 || s->mb_x) v->c_avail = v->mb_type[0][s->block_index[i] - 1]; vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i & 4) ? v->codingset2 : v->codingset); if (i > 3 && (s->flags & CODEC_FLAG_GRAY)) continue; v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); if (i < 4) { stride_y = s->linesize << fieldtx; off = (fieldtx) ? ((i & 1) * 8) + ((i & 2) >> 1) * s->linesize : (i & 1) * 8 + 4 * (i & 2) * s->linesize; } else { stride_y = s->uvlinesize; off = 0; } s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, stride_y); } } else { s->mb_intra = v->is_intra[s->mb_x] = 0; if (!direct) { if (skipped || !s->mb_intra) { bmvtype = decode012(gb); switch (bmvtype) { case 0: bmvtype = (v->bfraction >= (B_FRACTION_DEN/2)) ? BMV_TYPE_BACKWARD : BMV_TYPE_FORWARD; break; case 1: bmvtype = (v->bfraction >= (B_FRACTION_DEN/2)) ? BMV_TYPE_FORWARD : BMV_TYPE_BACKWARD; break; case 2: bmvtype = BMV_TYPE_INTERPOLATED; } } if (twomv && bmvtype != BMV_TYPE_INTERPOLATED) mvsw = get_bits1(gb); } if (!skipped) { // inter MB mb_has_coeffs = ff_vc1_mbmode_intfrp[0][idx_mbmode][3]; if (mb_has_coeffs) cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); if (!direct) { if (bmvtype == BMV_TYPE_INTERPOLATED && twomv) { v->fourmvbp = get_vlc2(gb, v->fourmvbp_vlc->table, VC1_4MV_BLOCK_PATTERN_VLC_BITS, 1); } else if (bmvtype == BMV_TYPE_INTERPOLATED || twomv) { v->twomvbp = get_vlc2(gb, v->twomvbp_vlc->table, VC1_2MV_BLOCK_PATTERN_VLC_BITS, 1); } } for (i = 0; i < 6; i++) v->mb_type[0][s->block_index[i]] = 0; fieldtx = v->fieldtx_plane[mb_pos] = ff_vc1_mbmode_intfrp[0][idx_mbmode][1]; /* for all motion vector read MVDATA and motion compensate each block */ dst_idx = 0; if (direct) { if (twomv) { for (i = 0; i < 4; i++) { vc1_mc_4mv_luma(v, i, 0, 0); vc1_mc_4mv_luma(v, i, 1, 1); } vc1_mc_4mv_chroma4(v, 0, 0, 0); vc1_mc_4mv_chroma4(v, 1, 1, 1); } else { vc1_mc_1mv(v, 0); vc1_interp_mc(v); } } else if (twomv && bmvtype == BMV_TYPE_INTERPOLATED) { mvbp = v->fourmvbp; for (i = 0; i < 4; i++) { dir = i==1 || i==3; dmv_x = dmv_y = 0; val = ((mvbp >> (3 - i)) & 1); if (val) get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0); j = i > 1 ? 2 : 0; vc1_pred_mv_intfr(v, j, dmv_x, dmv_y, 2, v->range_x, v->range_y, v->mb_type[0], dir); vc1_mc_4mv_luma(v, j, dir, dir); vc1_mc_4mv_luma(v, j+1, dir, dir); } vc1_mc_4mv_chroma4(v, 0, 0, 0); vc1_mc_4mv_chroma4(v, 1, 1, 1); } else if (bmvtype == BMV_TYPE_INTERPOLATED) { mvbp = v->twomvbp; dmv_x = dmv_y = 0; if (mvbp & 2) get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0); vc1_pred_mv_intfr(v, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0], 0); vc1_mc_1mv(v, 0); dmv_x = dmv_y = 0; if (mvbp & 1) get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0); vc1_pred_mv_intfr(v, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0], 1); vc1_interp_mc(v); } else if (twomv) { dir = bmvtype == BMV_TYPE_BACKWARD; dir2 = dir; if (mvsw) dir2 = !dir; mvbp = v->twomvbp; dmv_x = dmv_y = 0; if (mvbp & 2) get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0); vc1_pred_mv_intfr(v, 0, dmv_x, dmv_y, 2, v->range_x, v->range_y, v->mb_type[0], dir); dmv_x = dmv_y = 0; if (mvbp & 1) get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0); vc1_pred_mv_intfr(v, 2, dmv_x, dmv_y, 2, v->range_x, v->range_y, v->mb_type[0], dir2); if (mvsw) { for (i = 0; i < 2; i++) { s->mv[dir][i+2][0] = s->mv[dir][i][0] = s->current_picture.motion_val[dir][s->block_index[i+2]][0] = s->current_picture.motion_val[dir][s->block_index[i]][0]; s->mv[dir][i+2][1] = s->mv[dir][i][1] = s->current_picture.motion_val[dir][s->block_index[i+2]][1] = s->current_picture.motion_val[dir][s->block_index[i]][1]; s->mv[dir2][i+2][0] = s->mv[dir2][i][0] = s->current_picture.motion_val[dir2][s->block_index[i]][0] = s->current_picture.motion_val[dir2][s->block_index[i+2]][0]; s->mv[dir2][i+2][1] = s->mv[dir2][i][1] = s->current_picture.motion_val[dir2][s->block_index[i]][1] = s->current_picture.motion_val[dir2][s->block_index[i+2]][1]; } } else { vc1_pred_mv_intfr(v, 0, 0, 0, 2, v->range_x, v->range_y, v->mb_type[0], !dir); vc1_pred_mv_intfr(v, 2, 0, 0, 2, v->range_x, v->range_y, v->mb_type[0], !dir); } vc1_mc_4mv_luma(v, 0, dir, 0); vc1_mc_4mv_luma(v, 1, dir, 0); vc1_mc_4mv_luma(v, 2, dir2, 0); vc1_mc_4mv_luma(v, 3, dir2, 0); vc1_mc_4mv_chroma4(v, dir, dir2, 0); } else { dir = bmvtype == BMV_TYPE_BACKWARD; mvbp = ff_vc1_mbmode_intfrp[0][idx_mbmode][2]; dmv_x = dmv_y = 0; if (mvbp) get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0); vc1_pred_mv_intfr(v, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0], dir); v->blk_mv_type[s->block_index[0]] = 1; v->blk_mv_type[s->block_index[1]] = 1; v->blk_mv_type[s->block_index[2]] = 1; v->blk_mv_type[s->block_index[3]] = 1; vc1_pred_mv_intfr(v, 0, 0, 0, 2, v->range_x, v->range_y, 0, !dir); for (i = 0; i < 2; i++) { s->mv[!dir][i+2][0] = s->mv[!dir][i][0] = s->current_picture.motion_val[!dir][s->block_index[i+2]][0] = s->current_picture.motion_val[!dir][s->block_index[i]][0]; s->mv[!dir][i+2][1] = s->mv[!dir][i][1] = s->current_picture.motion_val[!dir][s->block_index[i+2]][1] = s->current_picture.motion_val[!dir][s->block_index[i]][1]; } vc1_mc_1mv(v, dir); } if (cbp) GET_MQUANT(); // p. 227 s->current_picture.qscale_table[mb_pos] = mquant; if (!v->ttmbf && cbp) ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); for (i = 0; i < 6; i++) { s->dc_val[0][s->block_index[i]] = 0; dst_idx += i >> 2; val = ((cbp >> (5 - i)) & 1); if (!fieldtx) off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); else off = (i & 4) ? 0 : ((i & 1) * 8 + ((i > 1) * s->linesize)); if (val) { pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : (s->linesize << fieldtx), (i & 4) && (s->flags & CODEC_FLAG_GRAY), &block_tt); block_cbp |= pat << (i << 2); if (!v->ttmbf && ttmb < 8) ttmb = -1; first_block = 0; } } } else { // skipped dir = 0; for (i = 0; i < 6; i++) { v->mb_type[0][s->block_index[i]] = 0; s->dc_val[0][s->block_index[i]] = 0; } s->current_picture.mb_type[mb_pos] = MB_TYPE_SKIP; s->current_picture.qscale_table[mb_pos] = 0; v->blk_mv_type[s->block_index[0]] = 0; v->blk_mv_type[s->block_index[1]] = 0; v->blk_mv_type[s->block_index[2]] = 0; v->blk_mv_type[s->block_index[3]] = 0; if (!direct) { if (bmvtype == BMV_TYPE_INTERPOLATED) { vc1_pred_mv_intfr(v, 0, 0, 0, 1, v->range_x, v->range_y, v->mb_type[0], 0); vc1_pred_mv_intfr(v, 0, 0, 0, 1, v->range_x, v->range_y, v->mb_type[0], 1); } else { dir = bmvtype == BMV_TYPE_BACKWARD; vc1_pred_mv_intfr(v, 0, 0, 0, 1, v->range_x, v->range_y, v->mb_type[0], dir); if (mvsw) { int dir2 = dir; if (mvsw) dir2 = !dir; for (i = 0; i < 2; i++) { s->mv[dir][i+2][0] = s->mv[dir][i][0] = s->current_picture.motion_val[dir][s->block_index[i+2]][0] = s->current_picture.motion_val[dir][s->block_index[i]][0]; s->mv[dir][i+2][1] = s->mv[dir][i][1] = s->current_picture.motion_val[dir][s->block_index[i+2]][1] = s->current_picture.motion_val[dir][s->block_index[i]][1]; s->mv[dir2][i+2][0] = s->mv[dir2][i][0] = s->current_picture.motion_val[dir2][s->block_index[i]][0] = s->current_picture.motion_val[dir2][s->block_index[i+2]][0]; s->mv[dir2][i+2][1] = s->mv[dir2][i][1] = s->current_picture.motion_val[dir2][s->block_index[i]][1] = s->current_picture.motion_val[dir2][s->block_index[i+2]][1]; } } else { v->blk_mv_type[s->block_index[0]] = 1; v->blk_mv_type[s->block_index[1]] = 1; v->blk_mv_type[s->block_index[2]] = 1; v->blk_mv_type[s->block_index[3]] = 1; vc1_pred_mv_intfr(v, 0, 0, 0, 2, v->range_x, v->range_y, 0, !dir); for (i = 0; i < 2; i++) { s->mv[!dir][i+2][0] = s->mv[!dir][i][0] = s->current_picture.motion_val[!dir][s->block_index[i+2]][0] = s->current_picture.motion_val[!dir][s->block_index[i]][0]; s->mv[!dir][i+2][1] = s->mv[!dir][i][1] = s->current_picture.motion_val[!dir][s->block_index[i+2]][1] = s->current_picture.motion_val[!dir][s->block_index[i]][1]; } } } } vc1_mc_1mv(v, dir); if (direct || bmvtype == BMV_TYPE_INTERPOLATED) { vc1_interp_mc(v); } } } if (s->mb_x == s->mb_width - 1) memmove(v->is_intra_base, v->is_intra, sizeof(v->is_intra_base[0]) * s->mb_stride); v->cbp[s->mb_x] = block_cbp; v->ttblk[s->mb_x] = block_tt; return 0; } | 25,485 |
1 | static void attach(sPAPRDRConnector *drc, DeviceState *d, void *fdt, int fdt_start_offset, bool coldplug, Error **errp) { DPRINTFN("drc: %x, attach", get_index(drc)); if (drc->isolation_state != SPAPR_DR_ISOLATION_STATE_ISOLATED) { error_setg(errp, "an attached device is still awaiting release"); return; if (drc->type == SPAPR_DR_CONNECTOR_TYPE_PCI) { g_assert(drc->allocation_state == SPAPR_DR_ALLOCATION_STATE_USABLE); g_assert(fdt || coldplug); /* NOTE: setting initial isolation state to UNISOLATED means we can't * detach unless guest has a userspace/kernel that moves this state * back to ISOLATED in response to an unplug event, or this is done * manually by the admin prior. if we force things while the guest * may be accessing the device, we can easily crash the guest, so we * we defer completion of removal in such cases to the reset() hook. */ if (drc->type == SPAPR_DR_CONNECTOR_TYPE_PCI) { drc->isolation_state = SPAPR_DR_ISOLATION_STATE_UNISOLATED; drc->indicator_state = SPAPR_DR_INDICATOR_STATE_ACTIVE; drc->dev = d; drc->fdt = fdt; drc->fdt_start_offset = fdt_start_offset; drc->configured = coldplug; /* 'logical' DR resources such as memory/cpus are in some cases treated * as a pool of resources from which the guest is free to choose from * based on only a count. for resources that can be assigned in this * fashion, we must assume the resource is signalled immediately * since a single hotplug request might make an arbitrary number of * such attached resources available to the guest, as opposed to * 'physical' DR resources such as PCI where each device/resource is * signalled individually. */ drc->signalled = (drc->type != SPAPR_DR_CONNECTOR_TYPE_PCI) ? true : coldplug; object_property_add_link(OBJECT(drc), "device", object_get_typename(OBJECT(drc->dev)), (Object **)(&drc->dev), NULL, 0, NULL); | 25,486 |
1 | static void coroutine_fn sd_write_done(SheepdogAIOCB *acb) { BDRVSheepdogState *s = acb->common.bs->opaque; struct iovec iov; AIOReq *aio_req; uint32_t offset, data_len, mn, mx; mn = s->min_dirty_data_idx; mx = s->max_dirty_data_idx; if (mn <= mx) { /* we need to update the vdi object. */ offset = sizeof(s->inode) - sizeof(s->inode.data_vdi_id) + mn * sizeof(s->inode.data_vdi_id[0]); data_len = (mx - mn + 1) * sizeof(s->inode.data_vdi_id[0]); s->min_dirty_data_idx = UINT32_MAX; s->max_dirty_data_idx = 0; iov.iov_base = &s->inode; iov.iov_len = sizeof(s->inode); aio_req = alloc_aio_req(s, acb, vid_to_vdi_oid(s->inode.vdi_id), data_len, offset, 0, 0, offset); QLIST_INSERT_HEAD(&s->inflight_aio_head, aio_req, aio_siblings); add_aio_request(s, aio_req, &iov, 1, false, AIOCB_WRITE_UDATA); acb->aio_done_func = sd_finish_aiocb; acb->aiocb_type = AIOCB_WRITE_UDATA; return; } sd_finish_aiocb(acb); } | 25,487 |
1 | static int execute_code(AVCodecContext * avctx, int c) { AnsiContext *s = avctx->priv_data; int ret, i, width, height; switch(c) { case 'A': //Cursor Up s->y = FFMAX(s->y - (s->nb_args > 0 ? s->args[0]*s->font_height : s->font_height), 0); break; case 'B': //Cursor Down s->y = FFMIN(s->y + (s->nb_args > 0 ? s->args[0]*s->font_height : s->font_height), avctx->height - s->font_height); break; case 'C': //Cursor Right s->x = FFMIN(s->x + (s->nb_args > 0 ? s->args[0]*FONT_WIDTH : FONT_WIDTH), avctx->width - FONT_WIDTH); break; case 'D': //Cursor Left s->x = FFMAX(s->x - (s->nb_args > 0 ? s->args[0]*FONT_WIDTH : FONT_WIDTH), 0); break; case 'H': //Cursor Position case 'f': //Horizontal and Vertical Position s->y = s->nb_args > 0 ? av_clip((s->args[0] - 1)*s->font_height, 0, avctx->height - s->font_height) : 0; s->x = s->nb_args > 1 ? av_clip((s->args[1] - 1)*FONT_WIDTH, 0, avctx->width - FONT_WIDTH) : 0; break; case 'h': //set creen mode case 'l': //reset screen mode if (s->nb_args < 2) s->args[0] = DEFAULT_SCREEN_MODE; switch(s->args[0]) { case 0: case 1: case 4: case 5: case 13: case 19: //320x200 (25 rows) s->font = ff_cga_font; s->font_height = 8; width = 40<<3; height = 25<<3; break; case 2: case 3: //640x400 (25 rows) s->font = ff_vga16_font; s->font_height = 16; width = 80<<3; height = 25<<4; break; case 6: case 14: //640x200 (25 rows) s->font = ff_cga_font; s->font_height = 8; width = 80<<3; height = 25<<3; break; case 7: //set line wrapping break; case 15: case 16: //640x350 (43 rows) s->font = ff_cga_font; s->font_height = 8; width = 80<<3; height = 43<<3; break; case 17: case 18: //640x480 (60 rows) s->font = ff_cga_font; s->font_height = 8; width = 80<<3; height = 60<<4; break; default: avpriv_request_sample(avctx, "Unsupported screen mode"); } if (width != avctx->width || height != avctx->height) { av_frame_unref(s->frame); ret = ff_set_dimensions(avctx, width, height); if (ret < 0) return ret; ret = ff_get_buffer(avctx, s->frame, AV_GET_BUFFER_FLAG_REF); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } s->frame->pict_type = AV_PICTURE_TYPE_I; s->frame->palette_has_changed = 1; memcpy(s->frame->data[1], ff_cga_palette, 16 * 4); erase_screen(avctx); } else if (c == 'l') { erase_screen(avctx); } break; case 'J': //Erase in Page switch (s->args[0]) { case 0: erase_line(avctx, s->x, avctx->width - s->x); if (s->y < avctx->height - s->font_height) memset(s->frame->data[0] + (s->y + s->font_height)*s->frame->linesize[0], DEFAULT_BG_COLOR, (avctx->height - s->y - s->font_height)*s->frame->linesize[0]); break; case 1: erase_line(avctx, 0, s->x); if (s->y > 0) memset(s->frame->data[0], DEFAULT_BG_COLOR, s->y * s->frame->linesize[0]); break; case 2: erase_screen(avctx); } break; case 'K': //Erase in Line switch(s->args[0]) { case 0: erase_line(avctx, s->x, avctx->width - s->x); break; case 1: erase_line(avctx, 0, s->x); break; case 2: erase_line(avctx, 0, avctx->width); } break; case 'm': //Select Graphics Rendition if (s->nb_args == 0) { s->nb_args = 1; s->args[0] = 0; } for (i = 0; i < FFMIN(s->nb_args, MAX_NB_ARGS); i++) { int m = s->args[i]; if (m == 0) { s->attributes = 0; s->fg = DEFAULT_FG_COLOR; s->bg = DEFAULT_BG_COLOR; } else if (m == 1 || m == 2 || m == 4 || m == 5 || m == 7 || m == 8) { s->attributes |= 1 << (m - 1); } else if (m >= 30 && m <= 38) { s->fg = ansi_to_cga[m - 30]; } else if (m == 39) { s->fg = ansi_to_cga[DEFAULT_FG_COLOR]; } else if (m >= 40 && m <= 47) { s->bg = ansi_to_cga[m - 40]; } else if (m == 49) { s->fg = ansi_to_cga[DEFAULT_BG_COLOR]; } else { avpriv_request_sample(avctx, "Unsupported rendition parameter"); } } break; case 'n': //Device Status Report case 'R': //report current line and column /* ignore */ break; case 's': //Save Cursor Position s->sx = s->x; s->sy = s->y; break; case 'u': //Restore Cursor Position s->x = av_clip(s->sx, 0, avctx->width - FONT_WIDTH); s->y = av_clip(s->sy, 0, avctx->height - s->font_height); break; default: avpriv_request_sample(avctx, "Unknown escape code"); break; } return 0; } | 25,488 |
1 | void migration_bitmap_extend(ram_addr_t old, ram_addr_t new) { /* called in qemu main thread, so there is * no writing race against this migration_bitmap */ if (migration_bitmap) { unsigned long *old_bitmap = migration_bitmap, *bitmap; bitmap = bitmap_new(new); /* prevent migration_bitmap content from being set bit * by migration_bitmap_sync_range() at the same time. * it is safe to migration if migration_bitmap is cleared bit * at the same time. */ qemu_mutex_lock(&migration_bitmap_mutex); bitmap_copy(bitmap, old_bitmap, old); bitmap_set(bitmap, old, new - old); atomic_rcu_set(&migration_bitmap, bitmap); qemu_mutex_unlock(&migration_bitmap_mutex); migration_dirty_pages += new - old; synchronize_rcu(); g_free(old_bitmap); } } | 25,490 |
1 | static void coroutine_fn v9fs_walk(void *opaque) { int name_idx; V9fsQID *qids = NULL; int i, err = 0; V9fsPath dpath, path; uint16_t nwnames; struct stat stbuf; size_t offset = 7; int32_t fid, newfid; V9fsString *wnames = NULL; V9fsFidState *fidp; V9fsFidState *newfidp = NULL; V9fsPDU *pdu = opaque; V9fsState *s = pdu->s; V9fsQID qid; err = pdu_unmarshal(pdu, offset, "ddw", &fid, &newfid, &nwnames); if (err < 0) { pdu_complete(pdu, err); return ; } offset += err; trace_v9fs_walk(pdu->tag, pdu->id, fid, newfid, nwnames); if (nwnames && nwnames <= P9_MAXWELEM) { wnames = g_malloc0(sizeof(wnames[0]) * nwnames); qids = g_malloc0(sizeof(qids[0]) * nwnames); for (i = 0; i < nwnames; i++) { err = pdu_unmarshal(pdu, offset, "s", &wnames[i]); if (err < 0) { goto out_nofid; } if (name_is_illegal(wnames[i].data)) { err = -ENOENT; goto out_nofid; } offset += err; } } else if (nwnames > P9_MAXWELEM) { err = -EINVAL; goto out_nofid; } fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -ENOENT; goto out_nofid; } v9fs_path_init(&dpath); v9fs_path_init(&path); err = fid_to_qid(pdu, fidp, &qid); if (err < 0) { goto out; } /* * Both dpath and path initially poin to fidp. * Needed to handle request with nwnames == 0 */ v9fs_path_copy(&dpath, &fidp->path); v9fs_path_copy(&path, &fidp->path); for (name_idx = 0; name_idx < nwnames; name_idx++) { if (not_same_qid(&pdu->s->root_qid, &qid) || strcmp("..", wnames[name_idx].data)) { err = v9fs_co_name_to_path(pdu, &dpath, wnames[name_idx].data, &path); if (err < 0) { goto out; } err = v9fs_co_lstat(pdu, &path, &stbuf); if (err < 0) { goto out; } stat_to_qid(&stbuf, &qid); v9fs_path_copy(&dpath, &path); } memcpy(&qids[name_idx], &qid, sizeof(qid)); } if (fid == newfid) { BUG_ON(fidp->fid_type != P9_FID_NONE); v9fs_path_copy(&fidp->path, &path); } else { newfidp = alloc_fid(s, newfid); if (newfidp == NULL) { err = -EINVAL; goto out; } newfidp->uid = fidp->uid; v9fs_path_copy(&newfidp->path, &path); } err = v9fs_walk_marshal(pdu, nwnames, qids); trace_v9fs_walk_return(pdu->tag, pdu->id, nwnames, qids); out: put_fid(pdu, fidp); if (newfidp) { put_fid(pdu, newfidp); } v9fs_path_free(&dpath); v9fs_path_free(&path); out_nofid: pdu_complete(pdu, err); if (nwnames && nwnames <= P9_MAXWELEM) { for (name_idx = 0; name_idx < nwnames; name_idx++) { v9fs_string_free(&wnames[name_idx]); } g_free(wnames); g_free(qids); } } | 25,491 |
1 | int avpicture_layout(const AVPicture* src, int pix_fmt, int width, int height, unsigned char *dest, int dest_size) { PixFmtInfo* pf = &pix_fmt_info[pix_fmt]; int i, j, w, h, data_planes; const unsigned char* s; int size = avpicture_get_size(pix_fmt, width, height); if (size > dest_size) return -1; if (pf->pixel_type == FF_PIXEL_PACKED || pf->pixel_type == FF_PIXEL_PALETTE) { if (pix_fmt == PIX_FMT_YUV422 || pix_fmt == PIX_FMT_UYVY422 || pix_fmt == PIX_FMT_RGB565 || pix_fmt == PIX_FMT_RGB555) w = width * 2; else if (pix_fmt == PIX_FMT_UYVY411) w = width + width/2; else if (pix_fmt == PIX_FMT_PAL8) w = width; else w = width * (pf->depth * pf->nb_channels / 8); data_planes = 1; h = height; } else { data_planes = pf->nb_channels; w = (width*pf->depth + 7)/8; h = height; } for (i=0; i<data_planes; i++) { if (i == 1) { w = width >> pf->x_chroma_shift; h = height >> pf->y_chroma_shift; } s = src->data[i]; for(j=0; j<h; j++) { memcpy(dest, s, w); dest += w; s += src->linesize[i]; } } if (pf->pixel_type == FF_PIXEL_PALETTE) memcpy((unsigned char *)(((size_t)dest + 3) & ~3), src->data[1], 256 * 4); return size; } | 25,493 |
1 | static int vnc_update_stats(VncDisplay *vd, struct timeval * tv) { int width = pixman_image_get_width(vd->guest.fb); int height = pixman_image_get_height(vd->guest.fb); int x, y; struct timeval res; int has_dirty = 0; for (y = 0; y < height; y += VNC_STAT_RECT) { for (x = 0; x < width; x += VNC_STAT_RECT) { VncRectStat *rect = vnc_stat_rect(vd, x, y); rect->updated = false; } } qemu_timersub(tv, &VNC_REFRESH_STATS, &res); if (timercmp(&vd->guest.last_freq_check, &res, >)) { return has_dirty; } vd->guest.last_freq_check = *tv; for (y = 0; y < height; y += VNC_STAT_RECT) { for (x = 0; x < width; x += VNC_STAT_RECT) { VncRectStat *rect= vnc_stat_rect(vd, x, y); int count = ARRAY_SIZE(rect->times); struct timeval min, max; if (!timerisset(&rect->times[count - 1])) { continue ; } max = rect->times[(rect->idx + count - 1) % count]; qemu_timersub(tv, &max, &res); if (timercmp(&res, &VNC_REFRESH_LOSSY, >)) { rect->freq = 0; has_dirty += vnc_refresh_lossy_rect(vd, x, y); memset(rect->times, 0, sizeof (rect->times)); continue ; } min = rect->times[rect->idx]; max = rect->times[(rect->idx + count - 1) % count]; qemu_timersub(&max, &min, &res); rect->freq = res.tv_sec + res.tv_usec / 1000000.; rect->freq /= count; rect->freq = 1. / rect->freq; } } return has_dirty; } | 25,495 |
1 | static void iscsi_readcapacity_sync(IscsiLun *iscsilun, Error **errp) { struct scsi_task *task = NULL; struct scsi_readcapacity10 *rc10 = NULL; struct scsi_readcapacity16 *rc16 = NULL; int retries = ISCSI_CMD_RETRIES; do { if (task != NULL) { scsi_free_scsi_task(task); task = NULL; } switch (iscsilun->type) { case TYPE_DISK: task = iscsi_readcapacity16_sync(iscsilun->iscsi, iscsilun->lun); if (task != NULL && task->status == SCSI_STATUS_GOOD) { rc16 = scsi_datain_unmarshall(task); if (rc16 == NULL) { error_setg(errp, "iSCSI: Failed to unmarshall readcapacity16 data."); } else { iscsilun->block_size = rc16->block_length; iscsilun->num_blocks = rc16->returned_lba + 1; iscsilun->lbpme = !!rc16->lbpme; iscsilun->lbprz = !!rc16->lbprz; iscsilun->use_16_for_rw = (rc16->returned_lba > 0xffffffff); } } break; case TYPE_ROM: task = iscsi_readcapacity10_sync(iscsilun->iscsi, iscsilun->lun, 0, 0); if (task != NULL && task->status == SCSI_STATUS_GOOD) { rc10 = scsi_datain_unmarshall(task); if (rc10 == NULL) { error_setg(errp, "iSCSI: Failed to unmarshall readcapacity10 data."); } else { iscsilun->block_size = rc10->block_size; if (rc10->lba == 0) { /* blank disk loaded */ iscsilun->num_blocks = 0; } else { iscsilun->num_blocks = rc10->lba + 1; } } } break; default: return; } } while (task != NULL && task->status == SCSI_STATUS_CHECK_CONDITION && task->sense.key == SCSI_SENSE_UNIT_ATTENTION && retries-- > 0); if (task == NULL || task->status != SCSI_STATUS_GOOD) { error_setg(errp, "iSCSI: failed to send readcapacity10 command."); } if (task) { scsi_free_scsi_task(task); } } | 25,496 |
1 | static int read_access_unit(AVCodecContext *avctx, void* data, int *got_frame_ptr, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; MLPDecodeContext *m = avctx->priv_data; GetBitContext gb; unsigned int length, substr; unsigned int substream_start; unsigned int header_size = 4; unsigned int substr_header_size = 0; uint8_t substream_parity_present[MAX_SUBSTREAMS]; uint16_t substream_data_len[MAX_SUBSTREAMS]; uint8_t parity_bits; int ret; if (buf_size < 4) return AVERROR_INVALIDDATA; length = (AV_RB16(buf) & 0xfff) * 2; if (length < 4 || length > buf_size) return AVERROR_INVALIDDATA; init_get_bits(&gb, (buf + 4), (length - 4) * 8); m->is_major_sync_unit = 0; if (show_bits_long(&gb, 31) == (0xf8726fba >> 1)) { if (read_major_sync(m, &gb) < 0) m->is_major_sync_unit = 1; header_size += m->major_sync_header_size; if (!m->params_valid) { av_log(m->avctx, AV_LOG_WARNING, "Stream parameters not seen; skipping frame.\n"); *got_frame_ptr = 0; return length; substream_start = 0; for (substr = 0; substr < m->num_substreams; substr++) { int extraword_present, checkdata_present, end, nonrestart_substr; extraword_present = get_bits1(&gb); nonrestart_substr = get_bits1(&gb); checkdata_present = get_bits1(&gb); skip_bits1(&gb); end = get_bits(&gb, 12) * 2; substr_header_size += 2; if (extraword_present) { if (m->avctx->codec_id == AV_CODEC_ID_MLP) { av_log(m->avctx, AV_LOG_ERROR, "There must be no extraword for MLP.\n"); skip_bits(&gb, 16); substr_header_size += 2; if (!(nonrestart_substr ^ m->is_major_sync_unit)) { av_log(m->avctx, AV_LOG_ERROR, "Invalid nonrestart_substr.\n"); if (end + header_size + substr_header_size > length) { av_log(m->avctx, AV_LOG_ERROR, "Indicated length of substream %d data goes off end of " "packet.\n", substr); end = length - header_size - substr_header_size; if (end < substream_start) { av_log(avctx, AV_LOG_ERROR, "Indicated end offset of substream %d data " "is smaller than calculated start offset.\n", substr); if (substr > m->max_decoded_substream) continue; substream_parity_present[substr] = checkdata_present; substream_data_len[substr] = end - substream_start; substream_start = end; parity_bits = ff_mlp_calculate_parity(buf, 4); parity_bits ^= ff_mlp_calculate_parity(buf + header_size, substr_header_size); if ((((parity_bits >> 4) ^ parity_bits) & 0xF) != 0xF) { av_log(avctx, AV_LOG_ERROR, "Parity check failed.\n"); buf += header_size + substr_header_size; for (substr = 0; substr <= m->max_decoded_substream; substr++) { SubStream *s = &m->substream[substr]; init_get_bits(&gb, buf, substream_data_len[substr] * 8); m->matrix_changed = 0; memset(m->filter_changed, 0, sizeof(m->filter_changed)); s->blockpos = 0; do { if (get_bits1(&gb)) { if (get_bits1(&gb)) { /* A restart header should be present. */ if (read_restart_header(m, &gb, buf, substr) < 0) goto next_substr; s->restart_seen = 1; if (!s->restart_seen) goto next_substr; if (read_decoding_params(m, &gb, substr) < 0) goto next_substr; if (!s->restart_seen) goto next_substr; if ((ret = read_block_data(m, &gb, substr)) < 0) return ret; if (get_bits_count(&gb) >= substream_data_len[substr] * 8) goto substream_length_mismatch; } while (!get_bits1(&gb)); skip_bits(&gb, (-get_bits_count(&gb)) & 15); if (substream_data_len[substr] * 8 - get_bits_count(&gb) >= 32) { int shorten_by; if (get_bits(&gb, 16) != 0xD234) return AVERROR_INVALIDDATA; shorten_by = get_bits(&gb, 16); if (m->avctx->codec_id == AV_CODEC_ID_TRUEHD && shorten_by & 0x2000) s->blockpos -= FFMIN(shorten_by & 0x1FFF, s->blockpos); else if (m->avctx->codec_id == AV_CODEC_ID_MLP && shorten_by != 0xD234) return AVERROR_INVALIDDATA; if (substr == m->max_decoded_substream) av_log(m->avctx, AV_LOG_INFO, "End of stream indicated.\n"); if (substream_parity_present[substr]) { uint8_t parity, checksum; if (substream_data_len[substr] * 8 - get_bits_count(&gb) != 16) goto substream_length_mismatch; parity = ff_mlp_calculate_parity(buf, substream_data_len[substr] - 2); checksum = ff_mlp_checksum8 (buf, substream_data_len[substr] - 2); if ((get_bits(&gb, 8) ^ parity) != 0xa9 ) av_log(m->avctx, AV_LOG_ERROR, "Substream %d parity check failed.\n", substr); if ( get_bits(&gb, 8) != checksum) av_log(m->avctx, AV_LOG_ERROR, "Substream %d checksum failed.\n" , substr); if (substream_data_len[substr] * 8 != get_bits_count(&gb)) goto substream_length_mismatch; next_substr: if (!s->restart_seen) av_log(m->avctx, AV_LOG_ERROR, "No restart header present in substream %d.\n", substr); buf += substream_data_len[substr]; if ((ret = output_data(m, m->max_decoded_substream, data, got_frame_ptr)) < 0) return ret; return length; substream_length_mismatch: av_log(m->avctx, AV_LOG_ERROR, "substream %d length mismatch\n", substr); return AVERROR_INVALIDDATA; error: m->params_valid = 0; return AVERROR_INVALIDDATA; | 25,497 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.