id
int32
0
27.3k
func
stringlengths
26
142k
target
bool
2 classes
project
stringclasses
2 values
commit_id
stringlengths
40
40
func_clean
stringlengths
26
131k
vul_lines
dict
normalized_func
stringlengths
24
132k
lines
sequencelengths
1
2.8k
label
sequencelengths
1
2.8k
line_no
sequencelengths
1
2.8k
25,380
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; }
true
FFmpeg
7b5c03064df522aef027490c51af8136ed5f17b3
int vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb) { int pqindex, lowquant; int status; int mbmodetab, imvtab, icbptab, twomvbptab, fourmvbptab; int scale, shift, i; 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) 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; 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; } } 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) { 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) { 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]; 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); v->k_y = v->mvrange + 8; 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) { 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); v->s.mv_table_index = get_bits(gb, 2); v->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[get_bits(gb, 2)]; } else if (v->fcm == 1) { v->qs_last = v->s.quarter_sample; v->s.quarter_sample = 1; v->s.mspel = 1; } else { 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; 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: 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); v->k_y = v->mvrange + 8; 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; } 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; } 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); } 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; }
{ "code": [ " av_log(v->s.avctx, AV_LOG_ERROR, \"P Fields do not work currently\\n\");", " return -1;" ], "line_no": [ 341, 307 ] }
int FUNC_0(VC1Context *VAR_0, GetBitContext* VAR_1) { int VAR_2, VAR_3; int VAR_4; int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9; int VAR_10, VAR_11, VAR_12; VAR_0->numref=0; VAR_0->fcm=0; VAR_0->field_mode=0; VAR_0->p_frame_skipped = 0; if (VAR_0->second_field) { VAR_0->s.pict_type = (VAR_0->fptype & 1) ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I; if (VAR_0->fptype & 4) VAR_0->s.pict_type = (VAR_0->fptype & 1) ? AV_PICTURE_TYPE_BI : AV_PICTURE_TYPE_B; VAR_0->s.current_picture_ptr->f.pict_type = VAR_0->s.pict_type; if (!VAR_0->pic_header_flag) goto parse_common_info; } if (VAR_0->interlace) { VAR_0->fcm = decode012(VAR_1); if (VAR_0->fcm) { if (VAR_0->fcm == 2) VAR_0->field_mode = 1; else VAR_0->field_mode = 0; if (!VAR_0->warn_interlaced++) av_log(VAR_0->s.avctx, AV_LOG_ERROR, "Interlaced frames/fields support is incomplete\n"); } } if (VAR_0->field_mode) { VAR_0->fptype = get_bits(VAR_1, 3); VAR_0->s.pict_type = (VAR_0->fptype & 2) ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I; if (VAR_0->fptype & 4) VAR_0->s.pict_type = (VAR_0->fptype & 2) ? AV_PICTURE_TYPE_BI : AV_PICTURE_TYPE_B; } else { switch (get_unary(VAR_1, 0, 4)) { case 0: VAR_0->s.pict_type = AV_PICTURE_TYPE_P; break; case 1: VAR_0->s.pict_type = AV_PICTURE_TYPE_B; break; case 2: VAR_0->s.pict_type = AV_PICTURE_TYPE_I; break; case 3: VAR_0->s.pict_type = AV_PICTURE_TYPE_BI; break; case 4: VAR_0->s.pict_type = AV_PICTURE_TYPE_P; VAR_0->p_frame_skipped = 1; break; } } if (VAR_0->tfcntrflag) skip_bits(VAR_1, 8); if (VAR_0->broadcast) { if (!VAR_0->interlace || VAR_0->psf) { VAR_0->rptfrm = get_bits(VAR_1, 2); } else { VAR_0->tff = get_bits1(VAR_1); VAR_0->rff = get_bits1(VAR_1); } } if (VAR_0->panscanflag) { av_log_missing_feature(VAR_0->s.avctx, "Pan-scan", 0); } if (VAR_0->p_frame_skipped) { return 0; } VAR_0->rnd = get_bits1(VAR_1); if (VAR_0->interlace) VAR_0->uvsamp = get_bits1(VAR_1); if (VAR_0->field_mode) { if (!VAR_0->refdist_flag) VAR_0->refdist = 0; else { if ((VAR_0->s.pict_type != AV_PICTURE_TYPE_B) && (VAR_0->s.pict_type != AV_PICTURE_TYPE_BI)) { VAR_0->refdist = get_bits(VAR_1, 2); if (VAR_0->refdist == 3) VAR_0->refdist += get_unary(VAR_1, 0, 16); } else { VAR_0->bfraction_lut_index = get_vlc2(VAR_1, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1); VAR_0->bfraction = ff_vc1_bfraction_lut[VAR_0->bfraction_lut_index]; VAR_0->frfd = (VAR_0->bfraction * VAR_0->refdist) >> 8; VAR_0->brfd = VAR_0->refdist - VAR_0->frfd - 1; if (VAR_0->brfd < 0) VAR_0->brfd = 0; } } goto parse_common_info; } if (VAR_0->finterpflag) VAR_0->interpfrm = get_bits1(VAR_1); if (VAR_0->s.pict_type == AV_PICTURE_TYPE_B) { VAR_0->bfraction_lut_index = get_vlc2(VAR_1, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1); VAR_0->bfraction = ff_vc1_bfraction_lut[VAR_0->bfraction_lut_index]; if (VAR_0->bfraction == 0) { VAR_0->s.pict_type = AV_PICTURE_TYPE_BI; } } parse_common_info: if (VAR_0->field_mode) VAR_0->cur_field_type = !(VAR_0->tff ^ VAR_0->second_field); VAR_2 = get_bits(VAR_1, 5); if (!VAR_2) return -1; VAR_0->VAR_2 = VAR_2; if (VAR_0->quantizer_mode == QUANT_FRAME_IMPLICIT) VAR_0->pq = ff_vc1_pquant_table[0][VAR_2]; else VAR_0->pq = ff_vc1_pquant_table[1][VAR_2]; VAR_0->pquantizer = 1; if (VAR_0->quantizer_mode == QUANT_FRAME_IMPLICIT) VAR_0->pquantizer = VAR_2 < 9; if (VAR_0->quantizer_mode == QUANT_NON_UNIFORM) VAR_0->pquantizer = 0; VAR_0->VAR_2 = VAR_2; if (VAR_2 < 9) VAR_0->halfpq = get_bits1(VAR_1); else VAR_0->halfpq = 0; if (VAR_0->quantizer_mode == QUANT_FRAME_EXPLICIT) VAR_0->pquantizer = get_bits1(VAR_1); if (VAR_0->postprocflag) VAR_0->postproc = get_bits(VAR_1, 2); if (VAR_0->s.pict_type == AV_PICTURE_TYPE_I || VAR_0->s.pict_type == AV_PICTURE_TYPE_P) VAR_0->use_ic = 0; if (VAR_0->parse_only) return 0; switch (VAR_0->s.pict_type) { case AV_PICTURE_TYPE_I: case AV_PICTURE_TYPE_BI: if (VAR_0->fcm == 1) { VAR_4 = bitplane_decoding(VAR_0->fieldtx_plane, &VAR_0->fieldtx_is_raw, VAR_0); if (VAR_4 < 0) return -1; av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "FIELDTX plane encoding: " "Imode: %VAR_12, Invert: %VAR_12\n", VAR_4>>1, VAR_4&1); } VAR_4 = bitplane_decoding(VAR_0->acpred_plane, &VAR_0->acpred_is_raw, VAR_0); if (VAR_4 < 0) return -1; av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "ACPRED plane encoding: " "Imode: %VAR_12, Invert: %VAR_12\n", VAR_4>>1, VAR_4&1); VAR_0->condover = CONDOVER_NONE; if (VAR_0->overlap && VAR_0->pq <= 8) { VAR_0->condover = decode012(VAR_1); if (VAR_0->condover == CONDOVER_SELECT) { VAR_4 = bitplane_decoding(VAR_0->over_flags_plane, &VAR_0->overflg_is_raw, VAR_0); if (VAR_4 < 0) return -1; av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "CONDOVER plane encoding: " "Imode: %VAR_12, Invert: %VAR_12\n", VAR_4>>1, VAR_4&1); } } break; case AV_PICTURE_TYPE_P: if (VAR_0->field_mode) { av_log(VAR_0->s.avctx, AV_LOG_ERROR, "P Fields do not work currently\n"); return -1; VAR_0->numref = get_bits1(VAR_1); if (!VAR_0->numref) { VAR_0->reffield = get_bits1(VAR_1); VAR_0->ref_field_type[0] = VAR_0->reffield ^ !VAR_0->cur_field_type; } } if (VAR_0->extended_mv) VAR_0->mvrange = get_unary(VAR_1, 0, 3); else VAR_0->mvrange = 0; if (VAR_0->interlace) { if (VAR_0->extended_dmv) VAR_0->dmvrange = get_unary(VAR_1, 0, 3); else VAR_0->dmvrange = 0; if (VAR_0->fcm == 1) { VAR_0->fourmvswitch = get_bits1(VAR_1); VAR_0->intcomp = get_bits1(VAR_1); if (VAR_0->intcomp) { VAR_0->lumscale = get_bits(VAR_1, 6); VAR_0->lumshift = get_bits(VAR_1, 6); INIT_LUT(VAR_0->lumscale, VAR_0->lumshift, VAR_0->luty, VAR_0->lutuv); } VAR_4 = bitplane_decoding(VAR_0->s.mbskip_table, &VAR_0->skip_is_raw, VAR_0); av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "SKIPMB plane encoding: " "Imode: %VAR_12, Invert: %VAR_12\n", VAR_4>>1, VAR_4&1); VAR_5 = get_bits(VAR_1, 2); if (VAR_0->fourmvswitch) VAR_0->mbmode_vlc = &ff_vc1_intfr_4mv_mbmode_vlc[VAR_5]; else VAR_0->mbmode_vlc = &ff_vc1_intfr_non4mv_mbmode_vlc[VAR_5]; VAR_6 = get_bits(VAR_1, 2); VAR_0->imv_vlc = &ff_vc1_1ref_mvdata_vlc[VAR_6]; VAR_7 = get_bits(VAR_1, 3); VAR_0->cbpcy_vlc = &ff_vc1_icbpcy_vlc[VAR_7]; VAR_8 = get_bits(VAR_1, 2); VAR_0->twomvbp_vlc = &ff_vc1_2mv_block_pattern_vlc[VAR_8]; if (VAR_0->fourmvswitch) { VAR_9 = get_bits(VAR_1, 2); VAR_0->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[VAR_9]; } } } VAR_0->k_x = VAR_0->mvrange + 9 + (VAR_0->mvrange >> 1); VAR_0->k_y = VAR_0->mvrange + 8; VAR_0->range_x = 1 << (VAR_0->k_x - 1); VAR_0->range_y = 1 << (VAR_0->k_y - 1); if (VAR_0->pq < 5) VAR_0->tt_index = 0; else if (VAR_0->pq < 13) VAR_0->tt_index = 1; else VAR_0->tt_index = 2; if (VAR_0->fcm != 1) { int VAR_15; VAR_15 = get_unary(VAR_1, 1, 4); VAR_3 = (VAR_0->pq > 12) ? 0 : 1; VAR_0->mv_mode = ff_vc1_mv_pmode_table[VAR_3][VAR_15]; if (VAR_0->mv_mode == MV_PMODE_INTENSITY_COMP) { int VAR_14; VAR_14 = get_unary(VAR_1, 1, 3); VAR_0->mv_mode2 = ff_vc1_mv_pmode_table2[VAR_3][VAR_14]; if (VAR_0->field_mode) VAR_0->intcompfield = decode210(VAR_1); VAR_0->lumscale = get_bits(VAR_1, 6); VAR_0->lumshift = get_bits(VAR_1, 6); INIT_LUT(VAR_0->lumscale, VAR_0->lumshift, VAR_0->luty, VAR_0->lutuv); if ((VAR_0->field_mode) && !VAR_0->intcompfield) { VAR_0->lumscale2 = get_bits(VAR_1, 6); VAR_0->lumshift2 = get_bits(VAR_1, 6); INIT_LUT(VAR_0->lumscale2, VAR_0->lumshift2, VAR_0->luty2, VAR_0->lutuv2); } VAR_0->use_ic = 1; } VAR_0->qs_last = VAR_0->s.quarter_sample; if (VAR_0->mv_mode == MV_PMODE_1MV_HPEL || VAR_0->mv_mode == MV_PMODE_1MV_HPEL_BILIN) VAR_0->s.quarter_sample = 0; else if (VAR_0->mv_mode == MV_PMODE_INTENSITY_COMP) { if (VAR_0->mv_mode2 == MV_PMODE_1MV_HPEL || VAR_0->mv_mode2 == MV_PMODE_1MV_HPEL_BILIN) VAR_0->s.quarter_sample = 0; else VAR_0->s.quarter_sample = 1; } else VAR_0->s.quarter_sample = 1; VAR_0->s.mspel = !(VAR_0->mv_mode == MV_PMODE_1MV_HPEL_BILIN || (VAR_0->mv_mode == MV_PMODE_INTENSITY_COMP && VAR_0->mv_mode2 == MV_PMODE_1MV_HPEL_BILIN)); } if (VAR_0->fcm == 0) { if ((VAR_0->mv_mode == MV_PMODE_INTENSITY_COMP && VAR_0->mv_mode2 == MV_PMODE_MIXED_MV) || VAR_0->mv_mode == MV_PMODE_MIXED_MV) { VAR_4 = bitplane_decoding(VAR_0->mv_type_mb_plane, &VAR_0->mv_type_is_raw, VAR_0); if (VAR_4 < 0) return -1; av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "MB MV Type plane encoding: " "Imode: %VAR_12, Invert: %VAR_12\n", VAR_4>>1, VAR_4&1); } else { VAR_0->mv_type_is_raw = 0; memset(VAR_0->mv_type_mb_plane, 0, VAR_0->s.mb_stride * VAR_0->s.mb_height); } VAR_4 = bitplane_decoding(VAR_0->s.mbskip_table, &VAR_0->skip_is_raw, VAR_0); if (VAR_4 < 0) return -1; av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: " "Imode: %VAR_12, Invert: %VAR_12\n", VAR_4>>1, VAR_4&1); VAR_0->s.mv_table_index = get_bits(VAR_1, 2); VAR_0->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[get_bits(VAR_1, 2)]; } else if (VAR_0->fcm == 1) { VAR_0->qs_last = VAR_0->s.quarter_sample; VAR_0->s.quarter_sample = 1; VAR_0->s.mspel = 1; } else { VAR_5 = get_bits(VAR_1, 3); VAR_6 = get_bits(VAR_1, 2 + VAR_0->numref); if (!VAR_0->numref) VAR_0->imv_vlc = &ff_vc1_1ref_mvdata_vlc[VAR_6]; else VAR_0->imv_vlc = &ff_vc1_2ref_mvdata_vlc[VAR_6]; VAR_7 = get_bits(VAR_1, 3); VAR_0->cbpcy_vlc = &ff_vc1_icbpcy_vlc[VAR_7]; if ((VAR_0->mv_mode == MV_PMODE_INTENSITY_COMP && VAR_0->mv_mode2 == MV_PMODE_MIXED_MV) || VAR_0->mv_mode == MV_PMODE_MIXED_MV) { VAR_9 = get_bits(VAR_1, 2); VAR_0->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[VAR_9]; VAR_0->mbmode_vlc = &ff_vc1_if_mmv_mbmode_vlc[VAR_5]; } else { VAR_0->mbmode_vlc = &ff_vc1_if_1mv_mbmode_vlc[VAR_5]; } } if (VAR_0->dquant) { av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n"); vop_dquant_decoding(VAR_0); } VAR_0->ttfrm = 0; if (VAR_0->vstransform) { VAR_0->ttmbf = get_bits1(VAR_1); if (VAR_0->ttmbf) { VAR_0->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(VAR_1, 2)]; } } else { VAR_0->ttmbf = 1; VAR_0->ttfrm = TT_8X8; } break; case AV_PICTURE_TYPE_B: if (VAR_0->fcm == 1) return -1; if (VAR_0->extended_mv) VAR_0->mvrange = get_unary(VAR_1, 0, 3); else VAR_0->mvrange = 0; VAR_0->k_x = VAR_0->mvrange + 9 + (VAR_0->mvrange >> 1); VAR_0->k_y = VAR_0->mvrange + 8; VAR_0->range_x = 1 << (VAR_0->k_x - 1); VAR_0->range_y = 1 << (VAR_0->k_y - 1); if (VAR_0->pq < 5) VAR_0->tt_index = 0; else if (VAR_0->pq < 13) VAR_0->tt_index = 1; else VAR_0->tt_index = 2; if (VAR_0->field_mode) { int VAR_15; av_log(VAR_0->s.avctx, AV_LOG_ERROR, "B Fields do not work currently\n"); return -1; if (VAR_0->extended_dmv) VAR_0->dmvrange = get_unary(VAR_1, 0, 3); VAR_15 = get_unary(VAR_1, 1, 3); VAR_3 = (VAR_0->pq > 12) ? 0 : 1; VAR_0->mv_mode = ff_vc1_mv_pmode_table2[VAR_3][VAR_15]; VAR_0->qs_last = VAR_0->s.quarter_sample; VAR_0->s.quarter_sample = (VAR_0->mv_mode == MV_PMODE_1MV || VAR_0->mv_mode == MV_PMODE_MIXED_MV); VAR_0->s.mspel = !(VAR_0->mv_mode == MV_PMODE_1MV_HPEL_BILIN || VAR_0->mv_mode == MV_PMODE_1MV_HPEL); VAR_4 = bitplane_decoding(VAR_0->forward_mb_plane, &VAR_0->fmb_is_raw, VAR_0); if (VAR_4 < 0) return -1; av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "MB Forward Type plane encoding: " "Imode: %VAR_12, Invert: %VAR_12\n", VAR_4>>1, VAR_4&1); VAR_5 = get_bits(VAR_1, 3); if (VAR_0->mv_mode == MV_PMODE_MIXED_MV) VAR_0->mbmode_vlc = &ff_vc1_if_mmv_mbmode_vlc[VAR_5]; else VAR_0->mbmode_vlc = &ff_vc1_if_1mv_mbmode_vlc[VAR_5]; VAR_6 = get_bits(VAR_1, 3); VAR_0->imv_vlc = &ff_vc1_2ref_mvdata_vlc[VAR_6]; VAR_7 = get_bits(VAR_1, 3); VAR_0->cbpcy_vlc = &ff_vc1_icbpcy_vlc[VAR_7]; if (VAR_0->mv_mode == MV_PMODE_MIXED_MV) { VAR_9 = get_bits(VAR_1, 2); VAR_0->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[VAR_9]; } VAR_0->numref = 1; } else { VAR_0->mv_mode = get_bits1(VAR_1) ? MV_PMODE_1MV : MV_PMODE_1MV_HPEL_BILIN; VAR_0->qs_last = VAR_0->s.quarter_sample; VAR_0->s.quarter_sample = (VAR_0->mv_mode == MV_PMODE_1MV); VAR_0->s.mspel = VAR_0->s.quarter_sample; VAR_4 = bitplane_decoding(VAR_0->direct_mb_plane, &VAR_0->dmb_is_raw, VAR_0); if (VAR_4 < 0) return -1; av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "MB Direct Type plane encoding: " "Imode: %VAR_12, Invert: %VAR_12\n", VAR_4>>1, VAR_4&1); VAR_4 = bitplane_decoding(VAR_0->s.mbskip_table, &VAR_0->skip_is_raw, VAR_0); if (VAR_4 < 0) return -1; av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: " "Imode: %VAR_12, Invert: %VAR_12\n", VAR_4>>1, VAR_4&1); VAR_0->s.mv_table_index = get_bits(VAR_1, 2); VAR_0->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[get_bits(VAR_1, 2)]; } if (VAR_0->dquant) { av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n"); vop_dquant_decoding(VAR_0); } VAR_0->ttfrm = 0; if (VAR_0->vstransform) { VAR_0->ttmbf = get_bits1(VAR_1); if (VAR_0->ttmbf) { VAR_0->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(VAR_1, 2)]; } } else { VAR_0->ttmbf = 1; VAR_0->ttfrm = TT_8X8; } break; } VAR_0->c_ac_table_index = decode012(VAR_1); if (VAR_0->s.pict_type == AV_PICTURE_TYPE_I || VAR_0->s.pict_type == AV_PICTURE_TYPE_BI) { VAR_0->y_ac_table_index = decode012(VAR_1); } VAR_0->s.dc_table_index = get_bits1(VAR_1); if ((VAR_0->s.pict_type == AV_PICTURE_TYPE_I || VAR_0->s.pict_type == AV_PICTURE_TYPE_BI) && VAR_0->dquant) { av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n"); vop_dquant_decoding(VAR_0); } VAR_0->bi_type = 0; if (VAR_0->s.pict_type == AV_PICTURE_TYPE_BI) { VAR_0->s.pict_type = AV_PICTURE_TYPE_B; VAR_0->bi_type = 1; } return 0; }
[ "int FUNC_0(VC1Context *VAR_0, GetBitContext* VAR_1)\n{", "int VAR_2, VAR_3;", "int VAR_4;", "int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;", "int VAR_10, VAR_11, VAR_12;", "VAR_0->numref=0;", "VAR_0->fcm=0;", "VAR_0->field_mode=0;", "VAR_0->p_frame_skipped = 0;", "if (VAR_0->second_field) {", "VAR_0->s.pict_type = (VAR_0->fptype & 1) ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I;", "if (VAR_0->fptype & 4)\nVAR_0->s.pict_type = (VAR_0->fptype & 1) ? AV_PICTURE_TYPE_BI : AV_PICTURE_TYPE_B;", "VAR_0->s.current_picture_ptr->f.pict_type = VAR_0->s.pict_type;", "if (!VAR_0->pic_header_flag)\ngoto parse_common_info;", "}", "if (VAR_0->interlace) {", "VAR_0->fcm = decode012(VAR_1);", "if (VAR_0->fcm) {", "if (VAR_0->fcm == 2)\nVAR_0->field_mode = 1;", "else\nVAR_0->field_mode = 0;", "if (!VAR_0->warn_interlaced++)\nav_log(VAR_0->s.avctx, AV_LOG_ERROR,\n\"Interlaced frames/fields support is incomplete\\n\");", "}", "}", "if (VAR_0->field_mode) {", "VAR_0->fptype = get_bits(VAR_1, 3);", "VAR_0->s.pict_type = (VAR_0->fptype & 2) ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I;", "if (VAR_0->fptype & 4)\nVAR_0->s.pict_type = (VAR_0->fptype & 2) ? AV_PICTURE_TYPE_BI : AV_PICTURE_TYPE_B;", "} else {", "switch (get_unary(VAR_1, 0, 4)) {", "case 0:\nVAR_0->s.pict_type = AV_PICTURE_TYPE_P;", "break;", "case 1:\nVAR_0->s.pict_type = AV_PICTURE_TYPE_B;", "break;", "case 2:\nVAR_0->s.pict_type = AV_PICTURE_TYPE_I;", "break;", "case 3:\nVAR_0->s.pict_type = AV_PICTURE_TYPE_BI;", "break;", "case 4:\nVAR_0->s.pict_type = AV_PICTURE_TYPE_P;", "VAR_0->p_frame_skipped = 1;", "break;", "}", "}", "if (VAR_0->tfcntrflag)\nskip_bits(VAR_1, 8);", "if (VAR_0->broadcast) {", "if (!VAR_0->interlace || VAR_0->psf) {", "VAR_0->rptfrm = get_bits(VAR_1, 2);", "} else {", "VAR_0->tff = get_bits1(VAR_1);", "VAR_0->rff = get_bits1(VAR_1);", "}", "}", "if (VAR_0->panscanflag) {", "av_log_missing_feature(VAR_0->s.avctx, \"Pan-scan\", 0);", "}", "if (VAR_0->p_frame_skipped) {", "return 0;", "}", "VAR_0->rnd = get_bits1(VAR_1);", "if (VAR_0->interlace)\nVAR_0->uvsamp = get_bits1(VAR_1);", "if (VAR_0->field_mode) {", "if (!VAR_0->refdist_flag)\nVAR_0->refdist = 0;", "else {", "if ((VAR_0->s.pict_type != AV_PICTURE_TYPE_B)\n&& (VAR_0->s.pict_type != AV_PICTURE_TYPE_BI)) {", "VAR_0->refdist = get_bits(VAR_1, 2);", "if (VAR_0->refdist == 3)\nVAR_0->refdist += get_unary(VAR_1, 0, 16);", "} else {", "VAR_0->bfraction_lut_index = get_vlc2(VAR_1, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1);", "VAR_0->bfraction = ff_vc1_bfraction_lut[VAR_0->bfraction_lut_index];", "VAR_0->frfd = (VAR_0->bfraction * VAR_0->refdist) >> 8;", "VAR_0->brfd = VAR_0->refdist - VAR_0->frfd - 1;", "if (VAR_0->brfd < 0)\nVAR_0->brfd = 0;", "}", "}", "goto parse_common_info;", "}", "if (VAR_0->finterpflag)\nVAR_0->interpfrm = get_bits1(VAR_1);", "if (VAR_0->s.pict_type == AV_PICTURE_TYPE_B) {", "VAR_0->bfraction_lut_index = get_vlc2(VAR_1, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1);", "VAR_0->bfraction = ff_vc1_bfraction_lut[VAR_0->bfraction_lut_index];", "if (VAR_0->bfraction == 0) {", "VAR_0->s.pict_type = AV_PICTURE_TYPE_BI;", "}", "}", "parse_common_info:\nif (VAR_0->field_mode)\nVAR_0->cur_field_type = !(VAR_0->tff ^ VAR_0->second_field);", "VAR_2 = get_bits(VAR_1, 5);", "if (!VAR_2)\nreturn -1;", "VAR_0->VAR_2 = VAR_2;", "if (VAR_0->quantizer_mode == QUANT_FRAME_IMPLICIT)\nVAR_0->pq = ff_vc1_pquant_table[0][VAR_2];", "else\nVAR_0->pq = ff_vc1_pquant_table[1][VAR_2];", "VAR_0->pquantizer = 1;", "if (VAR_0->quantizer_mode == QUANT_FRAME_IMPLICIT)\nVAR_0->pquantizer = VAR_2 < 9;", "if (VAR_0->quantizer_mode == QUANT_NON_UNIFORM)\nVAR_0->pquantizer = 0;", "VAR_0->VAR_2 = VAR_2;", "if (VAR_2 < 9)\nVAR_0->halfpq = get_bits1(VAR_1);", "else\nVAR_0->halfpq = 0;", "if (VAR_0->quantizer_mode == QUANT_FRAME_EXPLICIT)\nVAR_0->pquantizer = get_bits1(VAR_1);", "if (VAR_0->postprocflag)\nVAR_0->postproc = get_bits(VAR_1, 2);", "if (VAR_0->s.pict_type == AV_PICTURE_TYPE_I || VAR_0->s.pict_type == AV_PICTURE_TYPE_P)\nVAR_0->use_ic = 0;", "if (VAR_0->parse_only)\nreturn 0;", "switch (VAR_0->s.pict_type) {", "case AV_PICTURE_TYPE_I:\ncase AV_PICTURE_TYPE_BI:\nif (VAR_0->fcm == 1) {", "VAR_4 = bitplane_decoding(VAR_0->fieldtx_plane, &VAR_0->fieldtx_is_raw, VAR_0);", "if (VAR_4 < 0)\nreturn -1;", "av_log(VAR_0->s.avctx, AV_LOG_DEBUG, \"FIELDTX plane encoding: \"\n\"Imode: %VAR_12, Invert: %VAR_12\\n\", VAR_4>>1, VAR_4&1);", "}", "VAR_4 = bitplane_decoding(VAR_0->acpred_plane, &VAR_0->acpred_is_raw, VAR_0);", "if (VAR_4 < 0)\nreturn -1;", "av_log(VAR_0->s.avctx, AV_LOG_DEBUG, \"ACPRED plane encoding: \"\n\"Imode: %VAR_12, Invert: %VAR_12\\n\", VAR_4>>1, VAR_4&1);", "VAR_0->condover = CONDOVER_NONE;", "if (VAR_0->overlap && VAR_0->pq <= 8) {", "VAR_0->condover = decode012(VAR_1);", "if (VAR_0->condover == CONDOVER_SELECT) {", "VAR_4 = bitplane_decoding(VAR_0->over_flags_plane, &VAR_0->overflg_is_raw, VAR_0);", "if (VAR_4 < 0)\nreturn -1;", "av_log(VAR_0->s.avctx, AV_LOG_DEBUG, \"CONDOVER plane encoding: \"\n\"Imode: %VAR_12, Invert: %VAR_12\\n\", VAR_4>>1, VAR_4&1);", "}", "}", "break;", "case AV_PICTURE_TYPE_P:\nif (VAR_0->field_mode) {", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"P Fields do not work currently\\n\");", "return -1;", "VAR_0->numref = get_bits1(VAR_1);", "if (!VAR_0->numref) {", "VAR_0->reffield = get_bits1(VAR_1);", "VAR_0->ref_field_type[0] = VAR_0->reffield ^ !VAR_0->cur_field_type;", "}", "}", "if (VAR_0->extended_mv)\nVAR_0->mvrange = get_unary(VAR_1, 0, 3);", "else\nVAR_0->mvrange = 0;", "if (VAR_0->interlace) {", "if (VAR_0->extended_dmv)\nVAR_0->dmvrange = get_unary(VAR_1, 0, 3);", "else\nVAR_0->dmvrange = 0;", "if (VAR_0->fcm == 1) {", "VAR_0->fourmvswitch = get_bits1(VAR_1);", "VAR_0->intcomp = get_bits1(VAR_1);", "if (VAR_0->intcomp) {", "VAR_0->lumscale = get_bits(VAR_1, 6);", "VAR_0->lumshift = get_bits(VAR_1, 6);", "INIT_LUT(VAR_0->lumscale, VAR_0->lumshift, VAR_0->luty, VAR_0->lutuv);", "}", "VAR_4 = bitplane_decoding(VAR_0->s.mbskip_table, &VAR_0->skip_is_raw, VAR_0);", "av_log(VAR_0->s.avctx, AV_LOG_DEBUG, \"SKIPMB plane encoding: \"\n\"Imode: %VAR_12, Invert: %VAR_12\\n\", VAR_4>>1, VAR_4&1);", "VAR_5 = get_bits(VAR_1, 2);", "if (VAR_0->fourmvswitch)\nVAR_0->mbmode_vlc = &ff_vc1_intfr_4mv_mbmode_vlc[VAR_5];", "else\nVAR_0->mbmode_vlc = &ff_vc1_intfr_non4mv_mbmode_vlc[VAR_5];", "VAR_6 = get_bits(VAR_1, 2);", "VAR_0->imv_vlc = &ff_vc1_1ref_mvdata_vlc[VAR_6];", "VAR_7 = get_bits(VAR_1, 3);", "VAR_0->cbpcy_vlc = &ff_vc1_icbpcy_vlc[VAR_7];", "VAR_8 = get_bits(VAR_1, 2);", "VAR_0->twomvbp_vlc = &ff_vc1_2mv_block_pattern_vlc[VAR_8];", "if (VAR_0->fourmvswitch) {", "VAR_9 = get_bits(VAR_1, 2);", "VAR_0->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[VAR_9];", "}", "}", "}", "VAR_0->k_x = VAR_0->mvrange + 9 + (VAR_0->mvrange >> 1);", "VAR_0->k_y = VAR_0->mvrange + 8;", "VAR_0->range_x = 1 << (VAR_0->k_x - 1);", "VAR_0->range_y = 1 << (VAR_0->k_y - 1);", "if (VAR_0->pq < 5)\nVAR_0->tt_index = 0;", "else if (VAR_0->pq < 13)\nVAR_0->tt_index = 1;", "else\nVAR_0->tt_index = 2;", "if (VAR_0->fcm != 1) {", "int VAR_15;", "VAR_15 = get_unary(VAR_1, 1, 4);", "VAR_3 = (VAR_0->pq > 12) ? 0 : 1;", "VAR_0->mv_mode = ff_vc1_mv_pmode_table[VAR_3][VAR_15];", "if (VAR_0->mv_mode == MV_PMODE_INTENSITY_COMP) {", "int VAR_14;", "VAR_14 = get_unary(VAR_1, 1, 3);", "VAR_0->mv_mode2 = ff_vc1_mv_pmode_table2[VAR_3][VAR_14];", "if (VAR_0->field_mode)\nVAR_0->intcompfield = decode210(VAR_1);", "VAR_0->lumscale = get_bits(VAR_1, 6);", "VAR_0->lumshift = get_bits(VAR_1, 6);", "INIT_LUT(VAR_0->lumscale, VAR_0->lumshift, VAR_0->luty, VAR_0->lutuv);", "if ((VAR_0->field_mode) && !VAR_0->intcompfield) {", "VAR_0->lumscale2 = get_bits(VAR_1, 6);", "VAR_0->lumshift2 = get_bits(VAR_1, 6);", "INIT_LUT(VAR_0->lumscale2, VAR_0->lumshift2, VAR_0->luty2, VAR_0->lutuv2);", "}", "VAR_0->use_ic = 1;", "}", "VAR_0->qs_last = VAR_0->s.quarter_sample;", "if (VAR_0->mv_mode == MV_PMODE_1MV_HPEL || VAR_0->mv_mode == MV_PMODE_1MV_HPEL_BILIN)\nVAR_0->s.quarter_sample = 0;", "else if (VAR_0->mv_mode == MV_PMODE_INTENSITY_COMP) {", "if (VAR_0->mv_mode2 == MV_PMODE_1MV_HPEL || VAR_0->mv_mode2 == MV_PMODE_1MV_HPEL_BILIN)\nVAR_0->s.quarter_sample = 0;", "else\nVAR_0->s.quarter_sample = 1;", "} else", "VAR_0->s.quarter_sample = 1;", "VAR_0->s.mspel = !(VAR_0->mv_mode == MV_PMODE_1MV_HPEL_BILIN\n|| (VAR_0->mv_mode == MV_PMODE_INTENSITY_COMP\n&& VAR_0->mv_mode2 == MV_PMODE_1MV_HPEL_BILIN));", "}", "if (VAR_0->fcm == 0) {", "if ((VAR_0->mv_mode == MV_PMODE_INTENSITY_COMP &&\nVAR_0->mv_mode2 == MV_PMODE_MIXED_MV)\n|| VAR_0->mv_mode == MV_PMODE_MIXED_MV) {", "VAR_4 = bitplane_decoding(VAR_0->mv_type_mb_plane, &VAR_0->mv_type_is_raw, VAR_0);", "if (VAR_4 < 0)\nreturn -1;", "av_log(VAR_0->s.avctx, AV_LOG_DEBUG, \"MB MV Type plane encoding: \"\n\"Imode: %VAR_12, Invert: %VAR_12\\n\", VAR_4>>1, VAR_4&1);", "} else {", "VAR_0->mv_type_is_raw = 0;", "memset(VAR_0->mv_type_mb_plane, 0, VAR_0->s.mb_stride * VAR_0->s.mb_height);", "}", "VAR_4 = bitplane_decoding(VAR_0->s.mbskip_table, &VAR_0->skip_is_raw, VAR_0);", "if (VAR_4 < 0)\nreturn -1;", "av_log(VAR_0->s.avctx, AV_LOG_DEBUG, \"MB Skip plane encoding: \"\n\"Imode: %VAR_12, Invert: %VAR_12\\n\", VAR_4>>1, VAR_4&1);", "VAR_0->s.mv_table_index = get_bits(VAR_1, 2);", "VAR_0->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[get_bits(VAR_1, 2)];", "} else if (VAR_0->fcm == 1) {", "VAR_0->qs_last = VAR_0->s.quarter_sample;", "VAR_0->s.quarter_sample = 1;", "VAR_0->s.mspel = 1;", "} else {", "VAR_5 = get_bits(VAR_1, 3);", "VAR_6 = get_bits(VAR_1, 2 + VAR_0->numref);", "if (!VAR_0->numref)\nVAR_0->imv_vlc = &ff_vc1_1ref_mvdata_vlc[VAR_6];", "else\nVAR_0->imv_vlc = &ff_vc1_2ref_mvdata_vlc[VAR_6];", "VAR_7 = get_bits(VAR_1, 3);", "VAR_0->cbpcy_vlc = &ff_vc1_icbpcy_vlc[VAR_7];", "if ((VAR_0->mv_mode == MV_PMODE_INTENSITY_COMP &&\nVAR_0->mv_mode2 == MV_PMODE_MIXED_MV) || VAR_0->mv_mode == MV_PMODE_MIXED_MV) {", "VAR_9 = get_bits(VAR_1, 2);", "VAR_0->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[VAR_9];", "VAR_0->mbmode_vlc = &ff_vc1_if_mmv_mbmode_vlc[VAR_5];", "} else {", "VAR_0->mbmode_vlc = &ff_vc1_if_1mv_mbmode_vlc[VAR_5];", "}", "}", "if (VAR_0->dquant) {", "av_log(VAR_0->s.avctx, AV_LOG_DEBUG, \"VOP DQuant info\\n\");", "vop_dquant_decoding(VAR_0);", "}", "VAR_0->ttfrm = 0;", "if (VAR_0->vstransform) {", "VAR_0->ttmbf = get_bits1(VAR_1);", "if (VAR_0->ttmbf) {", "VAR_0->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(VAR_1, 2)];", "}", "} else {", "VAR_0->ttmbf = 1;", "VAR_0->ttfrm = TT_8X8;", "}", "break;", "case AV_PICTURE_TYPE_B:\nif (VAR_0->fcm == 1)\nreturn -1;", "if (VAR_0->extended_mv)\nVAR_0->mvrange = get_unary(VAR_1, 0, 3);", "else\nVAR_0->mvrange = 0;", "VAR_0->k_x = VAR_0->mvrange + 9 + (VAR_0->mvrange >> 1);", "VAR_0->k_y = VAR_0->mvrange + 8;", "VAR_0->range_x = 1 << (VAR_0->k_x - 1);", "VAR_0->range_y = 1 << (VAR_0->k_y - 1);", "if (VAR_0->pq < 5)\nVAR_0->tt_index = 0;", "else if (VAR_0->pq < 13)\nVAR_0->tt_index = 1;", "else\nVAR_0->tt_index = 2;", "if (VAR_0->field_mode) {", "int VAR_15;", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"B Fields do not work currently\\n\");", "return -1;", "if (VAR_0->extended_dmv)\nVAR_0->dmvrange = get_unary(VAR_1, 0, 3);", "VAR_15 = get_unary(VAR_1, 1, 3);", "VAR_3 = (VAR_0->pq > 12) ? 0 : 1;", "VAR_0->mv_mode = ff_vc1_mv_pmode_table2[VAR_3][VAR_15];", "VAR_0->qs_last = VAR_0->s.quarter_sample;", "VAR_0->s.quarter_sample = (VAR_0->mv_mode == MV_PMODE_1MV || VAR_0->mv_mode == MV_PMODE_MIXED_MV);", "VAR_0->s.mspel = !(VAR_0->mv_mode == MV_PMODE_1MV_HPEL_BILIN || VAR_0->mv_mode == MV_PMODE_1MV_HPEL);", "VAR_4 = bitplane_decoding(VAR_0->forward_mb_plane, &VAR_0->fmb_is_raw, VAR_0);", "if (VAR_4 < 0)\nreturn -1;", "av_log(VAR_0->s.avctx, AV_LOG_DEBUG, \"MB Forward Type plane encoding: \"\n\"Imode: %VAR_12, Invert: %VAR_12\\n\", VAR_4>>1, VAR_4&1);", "VAR_5 = get_bits(VAR_1, 3);", "if (VAR_0->mv_mode == MV_PMODE_MIXED_MV)\nVAR_0->mbmode_vlc = &ff_vc1_if_mmv_mbmode_vlc[VAR_5];", "else\nVAR_0->mbmode_vlc = &ff_vc1_if_1mv_mbmode_vlc[VAR_5];", "VAR_6 = get_bits(VAR_1, 3);", "VAR_0->imv_vlc = &ff_vc1_2ref_mvdata_vlc[VAR_6];", "VAR_7 = get_bits(VAR_1, 3);", "VAR_0->cbpcy_vlc = &ff_vc1_icbpcy_vlc[VAR_7];", "if (VAR_0->mv_mode == MV_PMODE_MIXED_MV) {", "VAR_9 = get_bits(VAR_1, 2);", "VAR_0->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[VAR_9];", "}", "VAR_0->numref = 1;", "} else {", "VAR_0->mv_mode = get_bits1(VAR_1) ? MV_PMODE_1MV : MV_PMODE_1MV_HPEL_BILIN;", "VAR_0->qs_last = VAR_0->s.quarter_sample;", "VAR_0->s.quarter_sample = (VAR_0->mv_mode == MV_PMODE_1MV);", "VAR_0->s.mspel = VAR_0->s.quarter_sample;", "VAR_4 = bitplane_decoding(VAR_0->direct_mb_plane, &VAR_0->dmb_is_raw, VAR_0);", "if (VAR_4 < 0)\nreturn -1;", "av_log(VAR_0->s.avctx, AV_LOG_DEBUG, \"MB Direct Type plane encoding: \"\n\"Imode: %VAR_12, Invert: %VAR_12\\n\", VAR_4>>1, VAR_4&1);", "VAR_4 = bitplane_decoding(VAR_0->s.mbskip_table, &VAR_0->skip_is_raw, VAR_0);", "if (VAR_4 < 0)\nreturn -1;", "av_log(VAR_0->s.avctx, AV_LOG_DEBUG, \"MB Skip plane encoding: \"\n\"Imode: %VAR_12, Invert: %VAR_12\\n\", VAR_4>>1, VAR_4&1);", "VAR_0->s.mv_table_index = get_bits(VAR_1, 2);", "VAR_0->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[get_bits(VAR_1, 2)];", "}", "if (VAR_0->dquant) {", "av_log(VAR_0->s.avctx, AV_LOG_DEBUG, \"VOP DQuant info\\n\");", "vop_dquant_decoding(VAR_0);", "}", "VAR_0->ttfrm = 0;", "if (VAR_0->vstransform) {", "VAR_0->ttmbf = get_bits1(VAR_1);", "if (VAR_0->ttmbf) {", "VAR_0->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(VAR_1, 2)];", "}", "} else {", "VAR_0->ttmbf = 1;", "VAR_0->ttfrm = TT_8X8;", "}", "break;", "}", "VAR_0->c_ac_table_index = decode012(VAR_1);", "if (VAR_0->s.pict_type == AV_PICTURE_TYPE_I || VAR_0->s.pict_type == AV_PICTURE_TYPE_BI) {", "VAR_0->y_ac_table_index = decode012(VAR_1);", "}", "VAR_0->s.dc_table_index = get_bits1(VAR_1);", "if ((VAR_0->s.pict_type == AV_PICTURE_TYPE_I || VAR_0->s.pict_type == AV_PICTURE_TYPE_BI)\n&& VAR_0->dquant) {", "av_log(VAR_0->s.avctx, AV_LOG_DEBUG, \"VOP DQuant info\\n\");", "vop_dquant_decoding(VAR_0);", "}", "VAR_0->bi_type = 0;", "if (VAR_0->s.pict_type == AV_PICTURE_TYPE_BI) {", "VAR_0->s.pict_type = AV_PICTURE_TYPE_B;", "VAR_0->bi_type = 1;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51, 53 ], [ 55, 57, 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105, 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153, 155 ], [ 157 ], [ 159, 161 ], [ 163 ], [ 165, 167 ], [ 169 ], [ 171, 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185, 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197, 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 217, 219, 221 ], [ 223 ], [ 225, 227 ], [ 229 ], [ 231, 233 ], [ 235, 237 ], [ 241 ], [ 243, 245 ], [ 247, 249 ], [ 251 ], [ 253, 255 ], [ 257, 259 ], [ 261, 263 ], [ 265, 267 ], [ 271, 273 ], [ 277, 279 ], [ 283 ], [ 285, 287, 289 ], [ 291 ], [ 293, 295 ], [ 297, 299 ], [ 301 ], [ 303 ], [ 305, 307 ], [ 309, 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323, 325 ], [ 327, 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337, 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357, 359 ], [ 361, 363 ], [ 365 ], [ 367, 369 ], [ 371, 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393, 395 ], [ 397 ], [ 399, 401 ], [ 403, 405 ], [ 407 ], [ 409 ], [ 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423 ], [ 425 ], [ 427 ], [ 429 ], [ 431 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 443, 445 ], [ 447, 449 ], [ 451, 453 ], [ 455 ], [ 457 ], [ 459 ], [ 461 ], [ 463 ], [ 465 ], [ 467 ], [ 469 ], [ 471 ], [ 473, 475 ], [ 477 ], [ 479 ], [ 481 ], [ 483 ], [ 485 ], [ 487 ], [ 489 ], [ 491 ], [ 493 ], [ 495 ], [ 497 ], [ 499, 501 ], [ 503 ], [ 505, 507 ], [ 509, 511 ], [ 513 ], [ 515 ], [ 517, 519, 521 ], [ 523 ], [ 525 ], [ 527, 529, 531 ], [ 533 ], [ 535, 537 ], [ 539, 541 ], [ 543 ], [ 545 ], [ 547 ], [ 549 ], [ 551 ], [ 553, 555 ], [ 557, 559 ], [ 565 ], [ 567 ], [ 569 ], [ 571 ], [ 573 ], [ 575 ], [ 577 ], [ 579 ], [ 581 ], [ 583, 585 ], [ 587, 589 ], [ 591 ], [ 593 ], [ 595, 597 ], [ 599 ], [ 601 ], [ 603 ], [ 605 ], [ 607 ], [ 609 ], [ 611 ], [ 613 ], [ 615 ], [ 617 ], [ 619 ], [ 623 ], [ 625 ], [ 627 ], [ 629 ], [ 631 ], [ 633 ], [ 635 ], [ 637 ], [ 639 ], [ 641 ], [ 643 ], [ 645, 649, 651 ], [ 653, 655 ], [ 657, 659 ], [ 661 ], [ 663 ], [ 665 ], [ 667 ], [ 671, 673 ], [ 675, 677 ], [ 679, 681 ], [ 685 ], [ 687 ], [ 689 ], [ 691 ], [ 693, 695 ], [ 697 ], [ 699 ], [ 701 ], [ 703 ], [ 705 ], [ 707 ], [ 709 ], [ 711, 713 ], [ 715, 717 ], [ 719 ], [ 721, 723 ], [ 725, 727 ], [ 729 ], [ 731 ], [ 733 ], [ 735 ], [ 737 ], [ 739 ], [ 741 ], [ 743 ], [ 745 ], [ 747 ], [ 749 ], [ 751 ], [ 753 ], [ 755 ], [ 757 ], [ 759, 761 ], [ 763, 765 ], [ 767 ], [ 769, 771 ], [ 773, 775 ], [ 777 ], [ 779 ], [ 781 ], [ 785 ], [ 787 ], [ 789 ], [ 791 ], [ 795 ], [ 797 ], [ 799 ], [ 801 ], [ 803 ], [ 805 ], [ 807 ], [ 809 ], [ 811 ], [ 813 ], [ 815 ], [ 817 ], [ 823 ], [ 825 ], [ 827 ], [ 829 ], [ 833 ], [ 835, 837 ], [ 839 ], [ 841 ], [ 843 ], [ 847 ], [ 849 ], [ 851 ], [ 853 ], [ 855 ], [ 857 ], [ 859 ] ]
25,381
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; }
true
FFmpeg
a779602584b43578e8baa69b367ba7d64e973dd0
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)) { 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; }
{ "code": [ " int mv_x, mv_y;" ], "line_no": [ 7 ] }
static int FUNC_0(MadContext *VAR_0, AVFrame *VAR_1, int VAR_2) { int VAR_3 = 0; int VAR_4, VAR_5; int VAR_6; if (VAR_2) { int VAR_7 = decode210(&VAR_0->gb); if (VAR_7 < 2) { VAR_3 = VAR_7 ? get_bits(&VAR_0->gb, 6) : 63; VAR_4 = decode_motion(&VAR_0->gb); VAR_5 = decode_motion(&VAR_0->gb); } } for (VAR_6=0; VAR_6<6; VAR_6++) { if (VAR_3 & (1<<VAR_6)) { int VAR_8 = 2*decode_motion(&VAR_0->gb); if (VAR_0->last_frame->data[0]) comp_block(VAR_0, VAR_1, VAR_0->mb_x, VAR_0->mb_y, VAR_6, VAR_4, VAR_5, VAR_8); } else { VAR_0->dsp.clear_block(VAR_0->block); if(decode_block_intra(VAR_0, VAR_0->block) < 0) return -1; idct_put(VAR_0, VAR_1, VAR_0->block, VAR_0->mb_x, VAR_0->mb_y, VAR_6); } } return 0; }
[ "static int FUNC_0(MadContext *VAR_0, AVFrame *VAR_1, int VAR_2)\n{", "int VAR_3 = 0;", "int VAR_4, VAR_5;", "int VAR_6;", "if (VAR_2) {", "int VAR_7 = decode210(&VAR_0->gb);", "if (VAR_7 < 2) {", "VAR_3 = VAR_7 ? get_bits(&VAR_0->gb, 6) : 63;", "VAR_4 = decode_motion(&VAR_0->gb);", "VAR_5 = decode_motion(&VAR_0->gb);", "}", "}", "for (VAR_6=0; VAR_6<6; VAR_6++) {", "if (VAR_3 & (1<<VAR_6)) {", "int VAR_8 = 2*decode_motion(&VAR_0->gb);", "if (VAR_0->last_frame->data[0])\ncomp_block(VAR_0, VAR_1, VAR_0->mb_x, VAR_0->mb_y, VAR_6, VAR_4, VAR_5, VAR_8);", "} else {", "VAR_0->dsp.clear_block(VAR_0->block);", "if(decode_block_intra(VAR_0, VAR_0->block) < 0)\nreturn -1;", "idct_put(VAR_0, VAR_1, VAR_0->block, VAR_0->mb_x, VAR_0->mb_y, VAR_6);", "}", "}", "return 0;", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ] ]
25,384
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; }
true
qemu
e0e2d644096c79a71099b176d08f465f6803a8b1
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; }
{ "code": [ " VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches);", " VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches);", " VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches);", " VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches);", " VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches);", " VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches);", " VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches);", " VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches);" ], "line_no": [ 5, 5, 5, 5, 5, 5, 5, 5 ] }
static inline uint16_t FUNC_0(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; }
[ "static inline uint16_t FUNC_0(VirtQueue *vq)\n{", "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;", "}" ]
[ 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
25,385
USBDevice *usb_create_simple(USBBus *bus, const char *name) { USBDevice *dev = usb_create(bus, name); qdev_init(&dev->qdev); return dev; }
true
qemu
e23a1b33b53d25510320b26d9f154e19c6c99725
USBDevice *usb_create_simple(USBBus *bus, const char *name) { USBDevice *dev = usb_create(bus, name); qdev_init(&dev->qdev); return dev; }
{ "code": [ " qdev_init(&dev->qdev);", " qdev_init(&dev->qdev);", " qdev_init(&dev->qdev);", " qdev_init(&dev->qdev);", " qdev_init(&dev->qdev);", " qdev_init(&dev->qdev);", " qdev_init(&dev->qdev);", " qdev_init(&dev->qdev);" ], "line_no": [ 7, 7, 7, 7, 7, 7, 7, 7 ] }
USBDevice *FUNC_0(USBBus *bus, const char *name) { USBDevice *dev = usb_create(bus, name); qdev_init(&dev->qdev); return dev; }
[ "USBDevice *FUNC_0(USBBus *bus, const char *name)\n{", "USBDevice *dev = usb_create(bus, name);", "qdev_init(&dev->qdev);", "return dev;", "}" ]
[ 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
25,386
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); } }
true
qemu
80e1eea37a25a7696137e680285e36d0bfdc9f34
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); } }
{ "code": [ " g_free(vpcidev);" ], "line_no": [ 21 ] }
static void FUNC_0( QPCIDevice *VAR_0, int VAR_1, void *VAR_2) { QVirtioPCIForeachData *d = VAR_2; QVirtioPCIDevice *vpcidev = qpcidevice_to_qvirtiodevice(VAR_0); if (vpcidev->vdev.device_type == d->device_type && (!d->has_slot || vpcidev->pdev->VAR_1 == d->slot << 3)) { d->func(&vpcidev->vdev, d->user_data); } else { g_free(vpcidev); } }
[ "static void FUNC_0(\nQPCIDevice *VAR_0, int VAR_1, void *VAR_2)\n{", "QVirtioPCIForeachData *d = VAR_2;", "QVirtioPCIDevice *vpcidev = qpcidevice_to_qvirtiodevice(VAR_0);", "if (vpcidev->vdev.device_type == d->device_type &&\n(!d->has_slot || vpcidev->pdev->VAR_1 == d->slot << 3)) {", "d->func(&vpcidev->vdev, d->user_data);", "} else {", "g_free(vpcidev);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
25,387
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); } }
true
FFmpeg
c341f734e5f9d6af4a8fdcceb6f5d12de6395c76
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; } 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); } }
{ "code": [ " int dxy, uvdxy, mx, my, src_x, src_y, uvsrc_x, uvsrc_y, v_edge_pos, linesize, uvlinesize;" ], "line_no": [ 17 ] }
static inline void FUNC_0(MpegEncContext *VAR_0, uint8_t *VAR_1, uint8_t *VAR_2, uint8_t *VAR_3, int VAR_4, int VAR_5, int VAR_6, uint8_t **VAR_7, VAR_8 (*pix_op)[4], VAR_9 (*qpix_op)[16], int VAR_10, int VAR_11, int VAR_12) { uint8_t *ptr_y, *ptr_cb, *ptr_cr; int VAR_13, VAR_14, VAR_15, VAR_16, VAR_17, VAR_18, VAR_19, VAR_20, VAR_21, VAR_22, VAR_23; VAR_13 = ((VAR_11 & 3) << 2) | (VAR_10 & 3); VAR_17 = VAR_0->mb_x * 16 + (VAR_10 >> 2); VAR_18 = VAR_0->mb_y * (16 >> VAR_4) + (VAR_11 >> 2); VAR_21 = VAR_0->VAR_21 >> VAR_4; VAR_22 = VAR_0->VAR_22 << VAR_4; VAR_23 = VAR_0->VAR_23 << VAR_4; if(VAR_4){ VAR_15= VAR_10/2; VAR_16= VAR_11>>1; }else if(VAR_0->workaround_bugs&FF_BUG_QPEL_CHROMA2){ static const int VAR_24[8]= {0,0,1,1,0,0,0,1}; VAR_15= (VAR_10>>1) + VAR_24[VAR_10&7]; VAR_16= (VAR_11>>1) + VAR_24[VAR_11&7]; }else if(VAR_0->workaround_bugs&FF_BUG_QPEL_CHROMA){ VAR_15= (VAR_10>>1)|(VAR_10&1); VAR_16= (VAR_11>>1)|(VAR_11&1); }else{ VAR_15= VAR_10/2; VAR_16= VAR_11/2; } VAR_15= (VAR_15>>1)|(VAR_15&1); VAR_16= (VAR_16>>1)|(VAR_16&1); VAR_14= (VAR_15&1) | ((VAR_16&1)<<1); VAR_15>>=1; VAR_16>>=1; VAR_19 = VAR_0->mb_x * 8 + VAR_15; VAR_20 = VAR_0->mb_y * (8 >> VAR_4) + VAR_16; ptr_y = VAR_7[0] + VAR_18 * VAR_22 + VAR_17; ptr_cb = VAR_7[1] + VAR_20 * VAR_23 + VAR_19; ptr_cr = VAR_7[2] + VAR_20 * VAR_23 + VAR_19; if( (unsigned)VAR_17 > FFMAX(VAR_0->h_edge_pos - (VAR_10&3) - 16, 0) || (unsigned)VAR_18 > FFMAX( VAR_21 - (VAR_11&3) - VAR_12 , 0)){ VAR_0->vdsp.emulated_edge_mc(VAR_0->edge_emu_buffer, ptr_y, VAR_0->VAR_22, 17, 17+VAR_4, VAR_17, VAR_18<<VAR_4, VAR_0->h_edge_pos, VAR_0->VAR_21); ptr_y= VAR_0->edge_emu_buffer; if(!CONFIG_GRAY || !(VAR_0->flags&CODEC_FLAG_GRAY)){ uint8_t *uvbuf= VAR_0->edge_emu_buffer + 18*VAR_0->VAR_22; VAR_0->vdsp.emulated_edge_mc(uvbuf, ptr_cb, VAR_0->VAR_23, 9, 9 + VAR_4, VAR_19, VAR_20<<VAR_4, VAR_0->h_edge_pos>>1, VAR_0->VAR_21>>1); VAR_0->vdsp.emulated_edge_mc(uvbuf + 16, ptr_cr, VAR_0->VAR_23, 9, 9 + VAR_4, VAR_19, VAR_20<<VAR_4, VAR_0->h_edge_pos>>1, VAR_0->VAR_21>>1); ptr_cb= uvbuf; ptr_cr= uvbuf + 16; } } if(!VAR_4) qpix_op[0][VAR_13](VAR_1, ptr_y, VAR_22); else{ if(VAR_5){ VAR_1 += VAR_0->VAR_22; VAR_2+= VAR_0->VAR_23; VAR_3+= VAR_0->VAR_23; } if(VAR_6){ ptr_y += VAR_0->VAR_22; ptr_cb += VAR_0->VAR_23; ptr_cr += VAR_0->VAR_23; } qpix_op[1][VAR_13](VAR_1 , ptr_y , VAR_22); qpix_op[1][VAR_13](VAR_1+8, ptr_y+8, VAR_22); } if(!CONFIG_GRAY || !(VAR_0->flags&CODEC_FLAG_GRAY)){ pix_op[1][VAR_14](VAR_3, ptr_cr, VAR_23, VAR_12 >> 1); pix_op[1][VAR_14](VAR_2, ptr_cb, VAR_23, VAR_12 >> 1); } }
[ "static inline void FUNC_0(MpegEncContext *VAR_0,\nuint8_t *VAR_1, uint8_t *VAR_2, uint8_t *VAR_3,\nint VAR_4, int VAR_5, int VAR_6,\nuint8_t **VAR_7, VAR_8 (*pix_op)[4],\nVAR_9 (*qpix_op)[16],\nint VAR_10, int VAR_11, int VAR_12)\n{", "uint8_t *ptr_y, *ptr_cb, *ptr_cr;", "int VAR_13, VAR_14, VAR_15, VAR_16, VAR_17, VAR_18, VAR_19, VAR_20, VAR_21, VAR_22, VAR_23;", "VAR_13 = ((VAR_11 & 3) << 2) | (VAR_10 & 3);", "VAR_17 = VAR_0->mb_x * 16 + (VAR_10 >> 2);", "VAR_18 = VAR_0->mb_y * (16 >> VAR_4) + (VAR_11 >> 2);", "VAR_21 = VAR_0->VAR_21 >> VAR_4;", "VAR_22 = VAR_0->VAR_22 << VAR_4;", "VAR_23 = VAR_0->VAR_23 << VAR_4;", "if(VAR_4){", "VAR_15= VAR_10/2;", "VAR_16= VAR_11>>1;", "}else if(VAR_0->workaround_bugs&FF_BUG_QPEL_CHROMA2){", "static const int VAR_24[8]= {0,0,1,1,0,0,0,1};", "VAR_15= (VAR_10>>1) + VAR_24[VAR_10&7];", "VAR_16= (VAR_11>>1) + VAR_24[VAR_11&7];", "}else if(VAR_0->workaround_bugs&FF_BUG_QPEL_CHROMA){", "VAR_15= (VAR_10>>1)|(VAR_10&1);", "VAR_16= (VAR_11>>1)|(VAR_11&1);", "}else{", "VAR_15= VAR_10/2;", "VAR_16= VAR_11/2;", "}", "VAR_15= (VAR_15>>1)|(VAR_15&1);", "VAR_16= (VAR_16>>1)|(VAR_16&1);", "VAR_14= (VAR_15&1) | ((VAR_16&1)<<1);", "VAR_15>>=1;", "VAR_16>>=1;", "VAR_19 = VAR_0->mb_x * 8 + VAR_15;", "VAR_20 = VAR_0->mb_y * (8 >> VAR_4) + VAR_16;", "ptr_y = VAR_7[0] + VAR_18 * VAR_22 + VAR_17;", "ptr_cb = VAR_7[1] + VAR_20 * VAR_23 + VAR_19;", "ptr_cr = VAR_7[2] + VAR_20 * VAR_23 + VAR_19;", "if( (unsigned)VAR_17 > FFMAX(VAR_0->h_edge_pos - (VAR_10&3) - 16, 0)\n|| (unsigned)VAR_18 > FFMAX( VAR_21 - (VAR_11&3) - VAR_12 , 0)){", "VAR_0->vdsp.emulated_edge_mc(VAR_0->edge_emu_buffer, ptr_y, VAR_0->VAR_22,\n17, 17+VAR_4, VAR_17, VAR_18<<VAR_4,\nVAR_0->h_edge_pos, VAR_0->VAR_21);", "ptr_y= VAR_0->edge_emu_buffer;", "if(!CONFIG_GRAY || !(VAR_0->flags&CODEC_FLAG_GRAY)){", "uint8_t *uvbuf= VAR_0->edge_emu_buffer + 18*VAR_0->VAR_22;", "VAR_0->vdsp.emulated_edge_mc(uvbuf, ptr_cb, VAR_0->VAR_23,\n9, 9 + VAR_4,\nVAR_19, VAR_20<<VAR_4,\nVAR_0->h_edge_pos>>1, VAR_0->VAR_21>>1);", "VAR_0->vdsp.emulated_edge_mc(uvbuf + 16, ptr_cr, VAR_0->VAR_23,\n9, 9 + VAR_4,\nVAR_19, VAR_20<<VAR_4,\nVAR_0->h_edge_pos>>1, VAR_0->VAR_21>>1);", "ptr_cb= uvbuf;", "ptr_cr= uvbuf + 16;", "}", "}", "if(!VAR_4)\nqpix_op[0][VAR_13](VAR_1, ptr_y, VAR_22);", "else{", "if(VAR_5){", "VAR_1 += VAR_0->VAR_22;", "VAR_2+= VAR_0->VAR_23;", "VAR_3+= VAR_0->VAR_23;", "}", "if(VAR_6){", "ptr_y += VAR_0->VAR_22;", "ptr_cb += VAR_0->VAR_23;", "ptr_cr += VAR_0->VAR_23;", "}", "qpix_op[1][VAR_13](VAR_1 , ptr_y , VAR_22);", "qpix_op[1][VAR_13](VAR_1+8, ptr_y+8, VAR_22);", "}", "if(!CONFIG_GRAY || !(VAR_0->flags&CODEC_FLAG_GRAY)){", "pix_op[1][VAR_14](VAR_3, ptr_cr, VAR_23, VAR_12 >> 1);", "pix_op[1][VAR_14](VAR_2, ptr_cb, VAR_23, VAR_12 >> 1);", "}", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 93, 95 ], [ 97, 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109, 111, 113, 115 ], [ 117, 119, 121, 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ] ]
25,389
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; }
true
qemu
e3fce97cf500c61f23df8e0245e08625fc375295
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); 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; }
{ "code": [ " return -errno;", " return -errno;", " return 0;" ], "line_no": [ 39, 39, 57 ] }
static int FUNC_0(int VAR_0, int VAR_1, uint32_t VAR_2) { char VAR_3[PATH_MAX]; int VAR_4; ssize_t size = sizeof(VAR_3); int VAR_5 = snprintf(VAR_3, size, "/sys/bus/pci/devices/%04x:%02x:%02x.%d/%s", 0, 0, 0, 0, "config"); if (VAR_5 >= size || VAR_5 < 0) { return -ENODEV; } VAR_4 = open(VAR_3, O_RDWR); if (VAR_4 < 0) { return -ENODEV; } if (lseek(VAR_4, VAR_0, SEEK_SET) != VAR_0) { return -errno; } do { VAR_5 = read(VAR_4, (uint8_t *)&VAR_2, VAR_1); } while (VAR_5 < 0 && (errno == EINTR || errno == EAGAIN)); if (VAR_5 != VAR_1) { return -errno; } return 0; }
[ "static int FUNC_0(int VAR_0, int VAR_1, uint32_t VAR_2)\n{", "char VAR_3[PATH_MAX];", "int VAR_4;", "ssize_t size = sizeof(VAR_3);", "int VAR_5 = snprintf(VAR_3, size, \"/sys/bus/pci/devices/%04x:%02x:%02x.%d/%s\",\n0, 0, 0, 0, \"config\");", "if (VAR_5 >= size || VAR_5 < 0) {", "return -ENODEV;", "}", "VAR_4 = open(VAR_3, O_RDWR);", "if (VAR_4 < 0) {", "return -ENODEV;", "}", "if (lseek(VAR_4, VAR_0, SEEK_SET) != VAR_0) {", "return -errno;", "}", "do {", "VAR_5 = read(VAR_4, (uint8_t *)&VAR_2, VAR_1);", "} while (VAR_5 < 0 && (errno == EINTR || errno == EAGAIN));", "if (VAR_5 != VAR_1) {", "return -errno;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ] ]
25,390
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; }
true
qemu
b4ba67d9a702507793c2724e56f98e9b0f7be02b
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; }
{ "code": [ " qpci_memread(s->dev, s->mem_base + off, buf, len);" ], "line_no": [ 11 ] }
static inline void FUNC_0(IVState *VAR_0, uint64_t VAR_1, void *VAR_2, size_t VAR_3) { QTestState *qtest = global_qtest; global_qtest = VAR_0->qtest; qpci_memread(VAR_0->dev, VAR_0->mem_base + VAR_1, VAR_2, VAR_3); global_qtest = qtest; }
[ "static inline void FUNC_0(IVState *VAR_0, uint64_t VAR_1, void *VAR_2, size_t VAR_3)\n{", "QTestState *qtest = global_qtest;", "global_qtest = VAR_0->qtest;", "qpci_memread(VAR_0->dev, VAR_0->mem_base + VAR_1, VAR_2, VAR_3);", "global_qtest = qtest;", "}" ]
[ 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
25,391
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); }
true
qemu
f3c7d0389fe8a2792fd4c1cf151b885de03c8f62
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); }
{ "code": [ " 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];" ], "line_no": [ 21, 23 ] }
static void FUNC_0(Object *VAR_0) { SDHCIState *s = SDHCI(VAR_0); 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); }
[ "static void FUNC_0(Object *VAR_0)\n{", "SDHCIState *s = SDHCI(VAR_0);", "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);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ] ]
25,392
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; }
true
FFmpeg
dae7ff04160901a30a35af05f2f149b289c4f0b1
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; 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; 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); num_bits_prev_frame = get_bits(gb, s->log2_frame_size); 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; } save_bits(s, gb, num_bits_prev_frame, 1); 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) { 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)) { s->packet_done = !decode_frame(s); } else { s->packet_done = 1; } } if (s->packet_done && !s->packet_loss && remaining_bits(s, gb) > 0) { save_bits(s, gb, remaining_bits(s, gb), 0); } *data_size = 0; s->packet_offset = get_bits_count(gb) & 7; return (s->packet_loss) ? AVERROR_INVALIDDATA : get_bits_count(gb) >> 3; }
{ "code": [ "\tint seekable_frame_in_packet = get_bits1(gb);", "\tint spliced_packet = get_bits1(gb);", "\t\tdecode_frame(s);" ], "line_no": [ 57, 59, 113 ] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket* VAR_3) { WmallDecodeCtx *s = VAR_0->priv_data; GetBitContext* gb = &s->pgb; const uint8_t* VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; int VAR_6; int VAR_7; s->samples = VAR_1; s->samples_end = (float*)((int8_t*)VAR_1 + *VAR_2); *VAR_2 = 0; if (s->packet_done || s->packet_loss) { s->packet_done = 0; if (VAR_5 < VAR_0->block_align) return 0; s->next_packet_start = VAR_5 - VAR_0->block_align; VAR_5 = VAR_0->block_align; s->buf_bit_size = VAR_5 << 3; init_get_bits(gb, VAR_4, s->buf_bit_size); VAR_7 = get_bits(gb, 4); int VAR_8 = get_bits1(gb); int VAR_9 = get_bits1(gb); VAR_6 = get_bits(gb, s->log2_frame_size); if (!s->packet_loss && ((s->VAR_7 + 1) & 0xF) != VAR_7) { s->packet_loss = 1; av_log(VAR_0, AV_LOG_ERROR, "Packet loss detected! seq %x vs %x\n", s->VAR_7, VAR_7); } s->VAR_7 = VAR_7; if (VAR_6 > 0) { int VAR_10 = s->buf_bit_size - get_bits_count(gb); if (VAR_6 >= VAR_10) { VAR_6 = VAR_10; s->packet_done = 1; } save_bits(s, gb, VAR_6, 1); if (!s->packet_loss) decode_frame(s); } else if (s->num_saved_bits - s->frame_offset) { dprintf(VAR_0, "ignoring %x previously saved bits\n", s->num_saved_bits - s->frame_offset); } if (s->packet_loss) { s->num_saved_bits = 0; s->packet_loss = 0; } } else { int VAR_11; s->buf_bit_size = (VAR_3->size - s->next_packet_start) << 3; init_get_bits(gb, VAR_3->VAR_1, s->buf_bit_size); skip_bits(gb, s->packet_offset); if (s->len_prefix && remaining_bits(s, gb) > s->log2_frame_size && (VAR_11 = show_bits(gb, s->log2_frame_size)) && VAR_11 <= remaining_bits(s, gb)) { save_bits(s, gb, VAR_11, 0); s->packet_done = !decode_frame(s); } else if (!s->len_prefix && s->num_saved_bits > get_bits_count(&s->gb)) { s->packet_done = !decode_frame(s); } else { s->packet_done = 1; } } if (s->packet_done && !s->packet_loss && remaining_bits(s, gb) > 0) { save_bits(s, gb, remaining_bits(s, gb), 0); } *VAR_2 = 0; s->packet_offset = get_bits_count(gb) & 7; return (s->packet_loss) ? AVERROR_INVALIDDATA : get_bits_count(gb) >> 3; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2, AVPacket* VAR_3)\n{", "WmallDecodeCtx *s = VAR_0->priv_data;", "GetBitContext* gb = &s->pgb;", "const uint8_t* VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "int VAR_6;", "int VAR_7;", "s->samples = VAR_1;", "s->samples_end = (float*)((int8_t*)VAR_1 + *VAR_2);", "*VAR_2 = 0;", "if (s->packet_done || s->packet_loss) {", "s->packet_done = 0;", "if (VAR_5 < VAR_0->block_align)\nreturn 0;", "s->next_packet_start = VAR_5 - VAR_0->block_align;", "VAR_5 = VAR_0->block_align;", "s->buf_bit_size = VAR_5 << 3;", "init_get_bits(gb, VAR_4, s->buf_bit_size);", "VAR_7 = get_bits(gb, 4);", "int VAR_8 = get_bits1(gb);", "int VAR_9 = get_bits1(gb);", "VAR_6 = get_bits(gb, s->log2_frame_size);", "if (!s->packet_loss &&\n((s->VAR_7 + 1) & 0xF) != VAR_7) {", "s->packet_loss = 1;", "av_log(VAR_0, AV_LOG_ERROR, \"Packet loss detected! seq %x vs %x\\n\",\ns->VAR_7, VAR_7);", "}", "s->VAR_7 = VAR_7;", "if (VAR_6 > 0) {", "int VAR_10 = s->buf_bit_size - get_bits_count(gb);", "if (VAR_6 >= VAR_10) {", "VAR_6 = VAR_10;", "s->packet_done = 1;", "}", "save_bits(s, gb, VAR_6, 1);", "if (!s->packet_loss)\ndecode_frame(s);", "} else if (s->num_saved_bits - s->frame_offset) {", "dprintf(VAR_0, \"ignoring %x previously saved bits\\n\",\ns->num_saved_bits - s->frame_offset);", "}", "if (s->packet_loss) {", "s->num_saved_bits = 0;", "s->packet_loss = 0;", "}", "} else {", "int VAR_11;", "s->buf_bit_size = (VAR_3->size - s->next_packet_start) << 3;", "init_get_bits(gb, VAR_3->VAR_1, s->buf_bit_size);", "skip_bits(gb, s->packet_offset);", "if (s->len_prefix && remaining_bits(s, gb) > s->log2_frame_size &&\n(VAR_11 = show_bits(gb, s->log2_frame_size)) &&\nVAR_11 <= remaining_bits(s, gb)) {", "save_bits(s, gb, VAR_11, 0);", "s->packet_done = !decode_frame(s);", "} else if (!s->len_prefix", "&& s->num_saved_bits > get_bits_count(&s->gb)) {", "s->packet_done = !decode_frame(s);", "} else {", "s->packet_done = 1;", "}", "}", "if (s->packet_done && !s->packet_loss &&\nremaining_bits(s, gb) > 0) {", "save_bits(s, gb, remaining_bits(s, gb), 0);", "}", "*VAR_2 = 0;", "s->packet_offset = get_bits_count(gb) & 7;", "return (s->packet_loss) ? AVERROR_INVALIDDATA : get_bits_count(gb) >> 3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 37, 39 ], [ 43 ], [ 45 ], [ 47 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 65 ], [ 71, 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 105 ], [ 111, 113 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 125 ], [ 133 ], [ 135 ], [ 137 ], [ 141 ], [ 143 ], [ 147 ], [ 149 ], [ 151 ], [ 155, 157, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 195, 197 ], [ 203 ], [ 205 ], [ 209 ], [ 211 ], [ 215 ], [ 217 ] ]
25,393
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); }
true
qemu
384b557da1a44ce260cd0328c06a250507348f73
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); }
{ "code": [ " return dev->vhost_ops->vhost_send_device_iotlb_msg(dev, &imsg);", " return dev->vhost_ops->vhost_send_device_iotlb_msg(dev, &imsg);" ], "line_no": [ 53, 53 ] }
int FUNC_0(struct vhost_dev *VAR_0, uint64_t VAR_1, uint64_t VAR_2, uint64_t VAR_3, IOMMUAccessFlags VAR_4) { struct vhost_iotlb_msg VAR_5; VAR_5.VAR_1 = VAR_1; VAR_5.VAR_2 = VAR_2; VAR_5.size = VAR_3; VAR_5.type = VHOST_IOTLB_UPDATE; switch (VAR_4) { case IOMMU_RO: VAR_5.VAR_4 = VHOST_ACCESS_RO; break; case IOMMU_WO: VAR_5.VAR_4 = VHOST_ACCESS_WO; break; case IOMMU_RW: VAR_5.VAR_4 = VHOST_ACCESS_RW; break; default: return -EINVAL; } return VAR_0->vhost_ops->vhost_send_device_iotlb_msg(VAR_0, &VAR_5); }
[ "int FUNC_0(struct vhost_dev *VAR_0,\nuint64_t VAR_1, uint64_t VAR_2,\nuint64_t VAR_3,\nIOMMUAccessFlags VAR_4)\n{", "struct vhost_iotlb_msg VAR_5;", "VAR_5.VAR_1 = VAR_1;", "VAR_5.VAR_2 = VAR_2;", "VAR_5.size = VAR_3;", "VAR_5.type = VHOST_IOTLB_UPDATE;", "switch (VAR_4) {", "case IOMMU_RO:\nVAR_5.VAR_4 = VHOST_ACCESS_RO;", "break;", "case IOMMU_WO:\nVAR_5.VAR_4 = VHOST_ACCESS_WO;", "break;", "case IOMMU_RW:\nVAR_5.VAR_4 = VHOST_ACCESS_RW;", "break;", "default:\nreturn -EINVAL;", "}", "return VAR_0->vhost_ops->vhost_send_device_iotlb_msg(VAR_0, &VAR_5);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 53 ], [ 55 ] ]
25,394
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); }
true
qemu
daa76aa416b1e18ab1fac650ff53d966d8f21f68
void qemu_set_log_filename(const char *filename) { char *pidstr; g_free(logfilename); pidstr = strstr(filename, "%"); if (pidstr) { 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); }
{ "code": [ "void qemu_set_log_filename(const char *filename)", " error_report(\"Bad logfile format: %s\", filename);", " logfilename = NULL;" ], "line_no": [ 1, 19, 21 ] }
void FUNC_0(const char *VAR_0) { char *VAR_1; g_free(logfilename); VAR_1 = strstr(VAR_0, "%"); if (VAR_1) { if (VAR_1[1] != 'd' || strchr(VAR_1 + 2, '%')) { error_report("Bad logfile format: %s", VAR_0); logfilename = NULL; } else { logfilename = g_strdup_printf(VAR_0, getpid()); } } else { logfilename = g_strdup(VAR_0); } qemu_log_close(); qemu_set_log(qemu_loglevel); }
[ "void FUNC_0(const char *VAR_0)\n{", "char *VAR_1;", "g_free(logfilename);", "VAR_1 = strstr(VAR_0, \"%\");", "if (VAR_1) {", "if (VAR_1[1] != 'd' || strchr(VAR_1 + 2, '%')) {", "error_report(\"Bad logfile format: %s\", VAR_0);", "logfilename = NULL;", "} else {", "logfilename = g_strdup_printf(VAR_0, getpid());", "}", "} else {", "logfilename = g_strdup(VAR_0);", "}", "qemu_log_close();", "qemu_set_log(qemu_loglevel);", "}" ]
[ 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ] ]
25,395
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); } }
true
qemu
a8f2e5c8fffbaf7fbd4f0efc8efbeebade78008f
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); } }
{ "code": [ " if (s->ctx && !s->dataplane_started) {", " virtio_scsi_dataplane_start(s);", " if (s->ctx && !s->dataplane_started) {", " virtio_scsi_dataplane_start(s);", " if (s->ctx && !s->dataplane_started) {", " if (s->events_dropped) {", " virtio_scsi_push_event(s, NULL, VIRTIO_SCSI_T_NO_EVENT, 0);" ], "line_no": [ 9, 11, 9, 11, 9, 17, 19 ] }
static void FUNC_0(VirtIODevice *VAR_0, VirtQueue *VAR_1) { VirtIOSCSI *s = VIRTIO_SCSI(VAR_0); 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); } }
[ "static void FUNC_0(VirtIODevice *VAR_0, VirtQueue *VAR_1)\n{", "VirtIOSCSI *s = VIRTIO_SCSI(VAR_0);", "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);", "}", "}" ]
[ 0, 0, 1, 1, 0, 0, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
25,396
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; }
true
qemu
70976a7926b42d87e0c575412b85a8f5c1e48fad
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) { return 4; } return 0; }
{ "code": [ " if (n == 33) {", " if (n == 34) {", " if (n == 33) {", " if (n == 34) {", " if (n == 33) {", " if (n == 34) {", " if (n == 33) {", " if (n == 34) {" ], "line_no": [ 25, 33, 25, 33, 25, 33, 25, 33 ] }
static int FUNC_0(CPUState *VAR_0, uint8_t *VAR_1, int VAR_2) { if (VAR_2 < 32) { #if defined(TARGET_PPC64) target_ulong lo = (uint32_t)VAR_0->gpr[VAR_2]; target_ulong hi = (target_ulong)ldl_p(VAR_1) << 32; VAR_0->gpr[VAR_2] = lo | hi; #else VAR_0->gprh[VAR_2] = ldl_p(VAR_1); #endif return 4; } if (VAR_2 == 33) { VAR_0->spe_acc = ldq_p(VAR_1); return 8; } if (VAR_2 == 34) { return 4; } return 0; }
[ "static int FUNC_0(CPUState *VAR_0, uint8_t *VAR_1, int VAR_2)\n{", "if (VAR_2 < 32) {", "#if defined(TARGET_PPC64)\ntarget_ulong lo = (uint32_t)VAR_0->gpr[VAR_2];", "target_ulong hi = (target_ulong)ldl_p(VAR_1) << 32;", "VAR_0->gpr[VAR_2] = lo | hi;", "#else\nVAR_0->gprh[VAR_2] = ldl_p(VAR_1);", "#endif\nreturn 4;", "}", "if (VAR_2 == 33) {", "VAR_0->spe_acc = ldq_p(VAR_1);", "return 8;", "}", "if (VAR_2 == 34) {", "return 4;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 15, 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ] ]
25,397
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; }
true
qemu
b308c82cbda44e138ef990af64d44a5613c16092
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 (!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; }
{ "code": [ " pci_bridge_region_init(br);", " pci_bridge_region_init(br);" ], "line_no": [ 67, 67 ] }
int FUNC_0(PCIDevice *VAR_0) { PCIBus *parent = VAR_0->bus; PCIBridge *br = DO_UPCAST(PCIBridge, VAR_0, VAR_0); PCIBus *sec_bus = &br->sec_bus; pci_word_test_and_set_mask(VAR_0->config + PCI_STATUS, PCI_STATUS_66MHZ | PCI_STATUS_FAST_BACK); pci_config_set_class(VAR_0->config, PCI_CLASS_BRIDGE_PCI); VAR_0->config[PCI_HEADER_TYPE] = (VAR_0->config[PCI_HEADER_TYPE] & PCI_HEADER_TYPE_MULTI_FUNCTION) | PCI_HEADER_TYPE_BRIDGE; pci_set_word(VAR_0->config + PCI_SEC_STATUS, PCI_STATUS_66MHZ | PCI_STATUS_FAST_BACK); if (!br->bus_name && VAR_0->qdev.id && *VAR_0->qdev.id) { br->bus_name = VAR_0->qdev.id; } qbus_create_inplace(&sec_bus->qbus, TYPE_PCI_BUS, &VAR_0->qdev, br->bus_name); sec_bus->parent_dev = VAR_0; 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; }
[ "int FUNC_0(PCIDevice *VAR_0)\n{", "PCIBus *parent = VAR_0->bus;", "PCIBridge *br = DO_UPCAST(PCIBridge, VAR_0, VAR_0);", "PCIBus *sec_bus = &br->sec_bus;", "pci_word_test_and_set_mask(VAR_0->config + PCI_STATUS,\nPCI_STATUS_66MHZ | PCI_STATUS_FAST_BACK);", "pci_config_set_class(VAR_0->config, PCI_CLASS_BRIDGE_PCI);", "VAR_0->config[PCI_HEADER_TYPE] =\n(VAR_0->config[PCI_HEADER_TYPE] & PCI_HEADER_TYPE_MULTI_FUNCTION) |\nPCI_HEADER_TYPE_BRIDGE;", "pci_set_word(VAR_0->config + PCI_SEC_STATUS,\nPCI_STATUS_66MHZ | PCI_STATUS_FAST_BACK);", "if (!br->bus_name && VAR_0->qdev.id && *VAR_0->qdev.id) {", "br->bus_name = VAR_0->qdev.id;", "}", "qbus_create_inplace(&sec_bus->qbus, TYPE_PCI_BUS, &VAR_0->qdev,\nbr->bus_name);", "sec_bus->parent_dev = VAR_0;", "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;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 17 ], [ 19, 21, 23 ], [ 25, 27 ], [ 43 ], [ 45 ], [ 47 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ] ]
25,398
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; }
true
FFmpeg
31247669593e5bf6571192f5e8888ccabd050ec8
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 (!(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); 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; if(!(asf->hdr.flags & 0x01)) { 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; 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) { 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; } 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); get_byte(pb); } 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; } 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: 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); sizeX= get_le32(pb); st->codec->width = get_le32(pb); st->codec->height = get_le32(pb); get_le16(pb); st->codec->bits_per_coded_sample = get_le16(pb); tag1 = get_le32(pb); url_fskip(pb, 20); 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); } 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; for(j = 0; j < stream_count; j++) { int flags, bitrate, stream_id; flags= get_le16(pb); bitrate= get_le32(pb); stream_id= (flags & 0x7f); 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) 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); 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)); value_num= get_le16(pb); 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); get_le64(pb); leak_rate = get_le32(pb); get_le32(pb); get_le32(pb); get_le32(pb); get_le32(pb); get_le32(pb); get_le32(pb); get_le32(pb); stream_num = get_le16(pb); stream_languageid_index = get_le16(pb); if (stream_num < 128) asf->streams[stream_num].stream_language_index = stream_languageid_index; get_le64(pb); stream_ct = get_le16(pb); payload_ext_ct = get_le16(pb); 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); } 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); get_le64(pb); count = get_le32(pb); get_le16(pb); name_len = get_le16(pb); for(i=0;i<name_len;i++){ get_byte(pb); } for(i=0;i<count;i++){ int64_t pres_time; int name_len; get_le64(pb); pres_time = get_le64(pb); get_le16(pb); get_le32(pb); get_le32(pb); name_len = get_le32(pb); 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); 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); 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' }; 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; }
{ "code": [ " if(tag1 == MKTAG('D', 'V', 'R', ' '))" ], "line_no": [ 431 ] }
static int FUNC_0(AVFormatContext *VAR_0, AVFormatParameters *VAR_1) { ASFContext *asf = VAR_0->priv_data; ff_asf_guid g; ByteIOContext *pb = VAR_0->pb; AVStream *st; ASFStream *asf_st; int VAR_2, VAR_36; int64_t gsize; AVRational dar[128]; uint32_t VAR_18[128]; memset(dar, 0, sizeof(dar)); memset(VAR_18, 0, sizeof(VAR_18)); 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(VAR_0, "%08"PRIx64": ", gpos); print_guid(&g); dprintf(VAR_0, " VAR_2=0x%"PRIx64"\VAR_27", gsize); if (!guidcmp(&g, &ff_asf_data_header)) { asf->data_object_offset = url_ftell(pb); if (!(asf->hdr.VAR_17 & 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.VAR_17 = get_le32(pb); asf->hdr.min_pktsize = get_le32(pb); asf->hdr.max_pktsize = get_le32(pb); asf->hdr.max_bitrate = get_le32(pb); VAR_0->packet_size = asf->hdr.max_pktsize; } else if (!guidcmp(&g, &ff_asf_stream_header)) { enum AVMediaType VAR_4; int VAR_5, VAR_6; uint64_t total_size; unsigned int VAR_7; int64_t pos1, pos2, start_time; int VAR_8, VAR_9=0; if (VAR_0->nb_streams == ASF_MAX_STREAMS) { av_log(VAR_0, AV_LOG_ERROR, "too many streams\VAR_27"); return AVERROR(EINVAL); } pos1 = url_ftell(pb); st = av_new_stream(VAR_0, 0); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 32, 1, 1000); 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; if(!(asf->hdr.VAR_17 & 0x01)) { st->duration = asf->hdr.play_time / (10000000 / 1000) - start_time; } get_guid(pb, &g); VAR_8 = 0; if (!guidcmp(&g, &ff_asf_audio_stream)) { VAR_4 = AVMEDIA_TYPE_AUDIO; } else if (!guidcmp(&g, &ff_asf_video_stream)) { VAR_4 = AVMEDIA_TYPE_VIDEO; } else if (!guidcmp(&g, &ff_asf_command_stream)) { VAR_4 = AVMEDIA_TYPE_DATA; } else if (!guidcmp(&g, &ff_asf_ext_stream_embed_stream_header)) { VAR_8 = 1; VAR_4 = AVMEDIA_TYPE_UNKNOWN; } else { return -1; } get_guid(pb, &g); total_size = get_le64(pb); VAR_5 = get_le32(pb); get_le32(pb); st->id = get_le16(pb) & 0x7f; asf->asfid2avid[st->id] = VAR_0->nb_streams - 1; get_le32(pb); if (VAR_8) { get_guid(pb, &g); if (!guidcmp(&g, &ff_asf_ext_stream_audio_stream)) { VAR_4 = AVMEDIA_TYPE_AUDIO; VAR_9=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 = VAR_4; if (VAR_4 == AVMEDIA_TYPE_AUDIO) { ff_get_wav_header(pb, st->codec, VAR_5); if (VAR_9) { 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; } 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); get_byte(pb); } 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; } 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: st->codec->frame_size = 1; break; } } else if (VAR_4 == AVMEDIA_TYPE_VIDEO) { get_le32(pb); get_le32(pb); get_byte(pb); VAR_2 = get_le16(pb); VAR_6= get_le32(pb); st->codec->width = get_le32(pb); st->codec->height = get_le32(pb); get_le16(pb); st->codec->bits_per_coded_sample = get_le16(pb); VAR_7 = get_le32(pb); url_fskip(pb, 20); VAR_2= VAR_6; if (VAR_2 > 40) { st->codec->extradata_size = VAR_2 - 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); } if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) { st->codec->palctrl = av_mallocz(sizeof(AVPaletteControl)); #if HAVE_BIGENDIAN for (VAR_36 = 0; VAR_36 < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; VAR_36++) st->codec->palctrl->palette[VAR_36] = bswap_32(((uint32_t*)st->codec->extradata)[VAR_36]); #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 = VAR_7; st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, VAR_7); if(VAR_7 == 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 VAR_10, VAR_11, VAR_12, VAR_13, VAR_14; VAR_10 = get_le16(pb); VAR_11 = get_le16(pb); VAR_12 = get_le16(pb); VAR_13 = get_le16(pb); VAR_14 = get_le16(pb); get_tag(VAR_0, "title" , 0, VAR_10); get_tag(VAR_0, "author" , 0, VAR_11); get_tag(VAR_0, "copyright", 0, VAR_12); get_tag(VAR_0, "comment" , 0, VAR_13); url_fskip(pb, VAR_14); } else if (!guidcmp(&g, &stream_bitrate_guid)) { int VAR_20 = get_le16(pb); int VAR_20; for(VAR_20 = 0; VAR_20 < VAR_20; VAR_20++) { int VAR_17, VAR_18, VAR_19; VAR_17= get_le16(pb); VAR_18= get_le32(pb); VAR_19= (VAR_17 & 0x7f); asf->stream_bitrates[VAR_19]= VAR_18; } } else if (!guidcmp(&g, &ff_asf_language_guid)) { int VAR_20; int VAR_20 = get_le16(pb); for(VAR_20 = 0; VAR_20 < VAR_20; VAR_20++) { char VAR_20[6]; unsigned int VAR_21 = get_byte(pb); get_str16_nolen(pb, VAR_21, VAR_20, sizeof(VAR_20)); if (VAR_20 < 128) av_strlcpy(asf->stream_languages[VAR_20], VAR_20, sizeof(*asf->stream_languages)); } } else if (!guidcmp(&g, &ff_asf_extended_content_header)) { int VAR_22, VAR_36; VAR_22 = get_le16(pb); for(VAR_36=0;VAR_36<VAR_22;VAR_36++) { int VAR_37,VAR_29,VAR_29; char VAR_37[1024]; VAR_37 = get_le16(pb); if (VAR_37%2) VAR_37 += 1; get_str16_nolen(pb, VAR_37, VAR_37, sizeof(VAR_37)); VAR_29 = get_le16(pb); VAR_29 = get_le16(pb); if (!VAR_29 && VAR_29%2) VAR_29 += 1; get_tag(VAR_0, VAR_37, VAR_29, VAR_29); } } else if (!guidcmp(&g, &ff_asf_metadata_header)) { int VAR_27, VAR_37, VAR_37, VAR_29, VAR_29, VAR_29; VAR_27 = get_le16(pb); for(VAR_36=0;VAR_36<VAR_27;VAR_36++) { char VAR_37[1024]; get_le16(pb); VAR_37= get_le16(pb); VAR_37= get_le16(pb); VAR_29= get_le16(pb); VAR_29= get_le32(pb); get_str16_nolen(pb, VAR_37, VAR_37, sizeof(VAR_37)); VAR_29= get_le16(pb); url_fskip(pb, VAR_29 - 2); if(VAR_37<128){ if (!strcmp(VAR_37, "AspectRatioX")) dar[VAR_37].num= VAR_29; else if(!strcmp(VAR_37, "AspectRatioY")) dar[VAR_37].den= VAR_29; } } } else if (!guidcmp(&g, &ff_asf_ext_stream_header)) { int VAR_30, VAR_31, VAR_32; uint32_t ext_d, leak_rate, VAR_37; unsigned int VAR_33; get_le64(pb); get_le64(pb); leak_rate = get_le32(pb); get_le32(pb); get_le32(pb); get_le32(pb); get_le32(pb); get_le32(pb); get_le32(pb); get_le32(pb); VAR_37 = get_le16(pb); VAR_33 = get_le16(pb); if (VAR_37 < 128) asf->streams[VAR_37].stream_language_index = VAR_33; get_le64(pb); VAR_32 = get_le16(pb); VAR_31 = get_le16(pb); if (VAR_37 < 128) VAR_18[VAR_37] = leak_rate; for (VAR_36=0; VAR_36<VAR_32; VAR_36++){ get_le16(pb); VAR_30 = get_le16(pb); url_fseek(pb, VAR_30, SEEK_CUR); } for (VAR_36=0; VAR_36<VAR_31; VAR_36++){ get_guid(pb, &g); ext_d=get_le16(pb); VAR_30=get_le32(pb); url_fseek(pb, VAR_30, SEEK_CUR); } continue; } else if (!guidcmp(&g, &ff_asf_head1_guid)) { int VAR_34, VAR_35; get_guid(pb, &g); VAR_34 = get_le32(pb); VAR_35 = get_le16(pb); continue; } else if (!guidcmp(&g, &ff_asf_marker_header)) { int VAR_36, VAR_36, VAR_37; char VAR_37[1024]; get_le64(pb); get_le64(pb); VAR_36 = get_le32(pb); get_le16(pb); VAR_37 = get_le16(pb); for(VAR_36=0;VAR_36<VAR_37;VAR_36++){ get_byte(pb); } for(VAR_36=0;VAR_36<VAR_36;VAR_36++){ int64_t pres_time; int VAR_37; get_le64(pb); pres_time = get_le64(pb); get_le16(pb); get_le32(pb); get_le32(pb); VAR_37 = get_le32(pb); get_str16_nolen(pb, VAR_37 * 2, VAR_37, sizeof(VAR_37)); ff_new_chapter(VAR_0, VAR_36, (AVRational){1, 10000000}, pres_time, AV_NOPTS_VALUE, VAR_37 ); } #if 0 } else if (!guidcmp(&g, &ff_asf_codec_comment_header)) { int len, VAR_34, VAR_27, num; char str[256], *q; char tag[16]; get_guid(pb, &g); print_guid(&g); VAR_27 = get_le32(pb); for(VAR_36=0;VAR_36<VAR_27;VAR_36++) { num = get_le16(pb); get_str16(pb, str, sizeof(str)); get_str16(pb, str, sizeof(str)); len = get_le16(pb); q = tag; while (len > 0) { VAR_34 = get_byte(pb); if ((q - tag) < sizeof(tag) - 1) *q++ = VAR_34; len--; } *q = '\0'; } #endif } else if (url_feof(pb)) { return -1; } else { if (!VAR_0->keylen) { if (!guidcmp(&g, &ff_asf_content_encryption)) { av_log(VAR_0, AV_LOG_WARNING, "DRM protected stream detected, decoding will likely fail!\VAR_27"); } else if (!guidcmp(&g, &ff_asf_ext_content_encryption)) { av_log(VAR_0, AV_LOG_WARNING, "Ext DRM protected stream detected, decoding will likely fail!\VAR_27"); } else if (!guidcmp(&g, &ff_asf_digital_signature)) { av_log(VAR_0, AV_LOG_WARNING, "Digital signature detected, decoding will likely fail!\VAR_27"); } } } if(url_ftell(pb) != gpos + gsize) av_log(VAR_0, AV_LOG_DEBUG, "gpos mismatch our pos=%"PRIu64", end=%"PRIu64"\VAR_27", 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(VAR_36=0; VAR_36<128; VAR_36++){ int VAR_37= asf->asfid2avid[VAR_36]; if(VAR_37>=0){ AVStream *st = VAR_0->streams[VAR_37]; if (!st->codec->bit_rate) st->codec->bit_rate = VAR_18[VAR_36]; if (dar[VAR_36].num > 0 && dar[VAR_36].den > 0) av_reduce(&st->sample_aspect_ratio.num, &st->sample_aspect_ratio.den, dar[VAR_36].num, dar[VAR_36].den, INT_MAX); if (asf->streams[VAR_36].stream_language_index < 128) { const char *VAR_37 = asf->stream_languages[asf->streams[VAR_36].stream_language_index]; if (VAR_37 && strlen(VAR_37) > 1) { const char VAR_38[3] = { VAR_37[0], VAR_37[1], '\0' }; const char *VAR_39 = av_convert_lang_to(VAR_38, AV_LANG_ISO639_2_BIBL); if (VAR_39) av_metadata_set2(&st->metadata, "language", VAR_39, 0); } } } } return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0, AVFormatParameters *VAR_1)\n{", "ASFContext *asf = VAR_0->priv_data;", "ff_asf_guid g;", "ByteIOContext *pb = VAR_0->pb;", "AVStream *st;", "ASFStream *asf_st;", "int VAR_2, VAR_36;", "int64_t gsize;", "AVRational dar[128];", "uint32_t VAR_18[128];", "memset(dar, 0, sizeof(dar));", "memset(VAR_18, 0, sizeof(VAR_18));", "get_guid(pb, &g);", "if (guidcmp(&g, &ff_asf_header))\nreturn -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(VAR_0, \"%08\"PRIx64\": \", gpos);", "print_guid(&g);", "dprintf(VAR_0, \" VAR_2=0x%\"PRIx64\"\\VAR_27\", gsize);", "if (!guidcmp(&g, &ff_asf_data_header)) {", "asf->data_object_offset = url_ftell(pb);", "if (!(asf->hdr.VAR_17 & 0x01) && gsize >= 100) {", "asf->data_object_size = gsize - 24;", "} else {", "asf->data_object_size = (uint64_t)-1;", "}", "break;", "}", "if (gsize < 24)\nreturn -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.VAR_17 = get_le32(pb);", "asf->hdr.min_pktsize = get_le32(pb);", "asf->hdr.max_pktsize = get_le32(pb);", "asf->hdr.max_bitrate = get_le32(pb);", "VAR_0->packet_size = asf->hdr.max_pktsize;", "} else if (!guidcmp(&g, &ff_asf_stream_header)) {", "enum AVMediaType VAR_4;", "int VAR_5, VAR_6;", "uint64_t total_size;", "unsigned int VAR_7;", "int64_t pos1, pos2, start_time;", "int VAR_8, VAR_9=0;", "if (VAR_0->nb_streams == ASF_MAX_STREAMS) {", "av_log(VAR_0, AV_LOG_ERROR, \"too many streams\\VAR_27\");", "return AVERROR(EINVAL);", "}", "pos1 = url_ftell(pb);", "st = av_new_stream(VAR_0, 0);", "if (!st)\nreturn AVERROR(ENOMEM);", "av_set_pts_info(st, 32, 1, 1000);", "asf_st = av_mallocz(sizeof(ASFStream));", "if (!asf_st)\nreturn AVERROR(ENOMEM);", "st->priv_data = asf_st;", "start_time = asf->hdr.preroll;", "asf_st->stream_language_index = 128;", "if(!(asf->hdr.VAR_17 & 0x01)) {", "st->duration = asf->hdr.play_time /\n(10000000 / 1000) - start_time;", "}", "get_guid(pb, &g);", "VAR_8 = 0;", "if (!guidcmp(&g, &ff_asf_audio_stream)) {", "VAR_4 = AVMEDIA_TYPE_AUDIO;", "} else if (!guidcmp(&g, &ff_asf_video_stream)) {", "VAR_4 = AVMEDIA_TYPE_VIDEO;", "} else if (!guidcmp(&g, &ff_asf_command_stream)) {", "VAR_4 = AVMEDIA_TYPE_DATA;", "} else if (!guidcmp(&g, &ff_asf_ext_stream_embed_stream_header)) {", "VAR_8 = 1;", "VAR_4 = AVMEDIA_TYPE_UNKNOWN;", "} else {", "return -1;", "}", "get_guid(pb, &g);", "total_size = get_le64(pb);", "VAR_5 = get_le32(pb);", "get_le32(pb);", "st->id = get_le16(pb) & 0x7f;", "asf->asfid2avid[st->id] = VAR_0->nb_streams - 1;", "get_le32(pb);", "if (VAR_8) {", "get_guid(pb, &g);", "if (!guidcmp(&g, &ff_asf_ext_stream_audio_stream)) {", "VAR_4 = AVMEDIA_TYPE_AUDIO;", "VAR_9=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 = VAR_4;", "if (VAR_4 == AVMEDIA_TYPE_AUDIO) {", "ff_get_wav_header(pb, st->codec, VAR_5);", "if (VAR_9) {", "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;", "}", "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);", "get_byte(pb);", "}", "if (asf_st->ds_span > 1) {", "if (!asf_st->ds_chunk_size\n|| (asf_st->ds_packet_size/asf_st->ds_chunk_size <= 1)\n|| asf_st->ds_packet_size % asf_st->ds_chunk_size)\nasf_st->ds_span = 0;", "}", "switch (st->codec->codec_id) {", "case CODEC_ID_MP3:\nst->codec->frame_size = MPA_FRAME_SIZE;", "break;", "case CODEC_ID_PCM_S16LE:\ncase CODEC_ID_PCM_S16BE:\ncase CODEC_ID_PCM_U16LE:\ncase CODEC_ID_PCM_U16BE:\ncase CODEC_ID_PCM_S8:\ncase CODEC_ID_PCM_U8:\ncase CODEC_ID_PCM_ALAW:\ncase CODEC_ID_PCM_MULAW:\nst->codec->frame_size = 1;", "break;", "default:\nst->codec->frame_size = 1;", "break;", "}", "} else if (VAR_4 == AVMEDIA_TYPE_VIDEO) {", "get_le32(pb);", "get_le32(pb);", "get_byte(pb);", "VAR_2 = get_le16(pb);", "VAR_6= get_le32(pb);", "st->codec->width = get_le32(pb);", "st->codec->height = get_le32(pb);", "get_le16(pb);", "st->codec->bits_per_coded_sample = get_le16(pb);", "VAR_7 = get_le32(pb);", "url_fskip(pb, 20);", "VAR_2= VAR_6;", "if (VAR_2 > 40) {", "st->codec->extradata_size = VAR_2 - 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);", "}", "if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) {", "st->codec->palctrl = av_mallocz(sizeof(AVPaletteControl));", "#if HAVE_BIGENDIAN\nfor (VAR_36 = 0; VAR_36 < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; VAR_36++)", "st->codec->palctrl->palette[VAR_36] = bswap_32(((uint32_t*)st->codec->extradata)[VAR_36]);", "#else\nmemcpy(st->codec->palctrl->palette, st->codec->extradata,\nFFMIN(st->codec->extradata_size, AVPALETTE_SIZE));", "#endif\nst->codec->palctrl->palette_changed = 1;", "}", "st->codec->codec_tag = VAR_7;", "st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, VAR_7);", "if(VAR_7 == MKTAG('D', 'V', 'R', ' '))\nst->need_parsing = AVSTREAM_PARSE_FULL;", "if(st->codec->codec_id == CODEC_ID_H264)\nst->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 VAR_10, VAR_11, VAR_12, VAR_13, VAR_14;", "VAR_10 = get_le16(pb);", "VAR_11 = get_le16(pb);", "VAR_12 = get_le16(pb);", "VAR_13 = get_le16(pb);", "VAR_14 = get_le16(pb);", "get_tag(VAR_0, \"title\" , 0, VAR_10);", "get_tag(VAR_0, \"author\" , 0, VAR_11);", "get_tag(VAR_0, \"copyright\", 0, VAR_12);", "get_tag(VAR_0, \"comment\" , 0, VAR_13);", "url_fskip(pb, VAR_14);", "} else if (!guidcmp(&g, &stream_bitrate_guid)) {", "int VAR_20 = get_le16(pb);", "int VAR_20;", "for(VAR_20 = 0; VAR_20 < VAR_20; VAR_20++) {", "int VAR_17, VAR_18, VAR_19;", "VAR_17= get_le16(pb);", "VAR_18= get_le32(pb);", "VAR_19= (VAR_17 & 0x7f);", "asf->stream_bitrates[VAR_19]= VAR_18;", "}", "} else if (!guidcmp(&g, &ff_asf_language_guid)) {", "int VAR_20;", "int VAR_20 = get_le16(pb);", "for(VAR_20 = 0; VAR_20 < VAR_20; VAR_20++) {", "char VAR_20[6];", "unsigned int VAR_21 = get_byte(pb);", "get_str16_nolen(pb, VAR_21, VAR_20, sizeof(VAR_20));", "if (VAR_20 < 128)\nav_strlcpy(asf->stream_languages[VAR_20], VAR_20, sizeof(*asf->stream_languages));", "}", "} else if (!guidcmp(&g, &ff_asf_extended_content_header)) {", "int VAR_22, VAR_36;", "VAR_22 = get_le16(pb);", "for(VAR_36=0;VAR_36<VAR_22;VAR_36++) {", "int VAR_37,VAR_29,VAR_29;", "char VAR_37[1024];", "VAR_37 = get_le16(pb);", "if (VAR_37%2)\nVAR_37 += 1;", "get_str16_nolen(pb, VAR_37, VAR_37, sizeof(VAR_37));", "VAR_29 = get_le16(pb);", "VAR_29 = get_le16(pb);", "if (!VAR_29 && VAR_29%2)\nVAR_29 += 1;", "get_tag(VAR_0, VAR_37, VAR_29, VAR_29);", "}", "} else if (!guidcmp(&g, &ff_asf_metadata_header)) {", "int VAR_27, VAR_37, VAR_37, VAR_29, VAR_29, VAR_29;", "VAR_27 = get_le16(pb);", "for(VAR_36=0;VAR_36<VAR_27;VAR_36++) {", "char VAR_37[1024];", "get_le16(pb);", "VAR_37= get_le16(pb);", "VAR_37= get_le16(pb);", "VAR_29= get_le16(pb);", "VAR_29= get_le32(pb);", "get_str16_nolen(pb, VAR_37, VAR_37, sizeof(VAR_37));", "VAR_29= get_le16(pb);", "url_fskip(pb, VAR_29 - 2);", "if(VAR_37<128){", "if (!strcmp(VAR_37, \"AspectRatioX\")) dar[VAR_37].num= VAR_29;", "else if(!strcmp(VAR_37, \"AspectRatioY\")) dar[VAR_37].den= VAR_29;", "}", "}", "} else if (!guidcmp(&g, &ff_asf_ext_stream_header)) {", "int VAR_30, VAR_31, VAR_32;", "uint32_t ext_d, leak_rate, VAR_37;", "unsigned int VAR_33;", "get_le64(pb);", "get_le64(pb);", "leak_rate = get_le32(pb);", "get_le32(pb);", "get_le32(pb);", "get_le32(pb);", "get_le32(pb);", "get_le32(pb);", "get_le32(pb);", "get_le32(pb);", "VAR_37 = get_le16(pb);", "VAR_33 = get_le16(pb);", "if (VAR_37 < 128)\nasf->streams[VAR_37].stream_language_index = VAR_33;", "get_le64(pb);", "VAR_32 = get_le16(pb);", "VAR_31 = get_le16(pb);", "if (VAR_37 < 128)\nVAR_18[VAR_37] = leak_rate;", "for (VAR_36=0; VAR_36<VAR_32; VAR_36++){", "get_le16(pb);", "VAR_30 = get_le16(pb);", "url_fseek(pb, VAR_30, SEEK_CUR);", "}", "for (VAR_36=0; VAR_36<VAR_31; VAR_36++){", "get_guid(pb, &g);", "ext_d=get_le16(pb);", "VAR_30=get_le32(pb);", "url_fseek(pb, VAR_30, SEEK_CUR);", "}", "continue;", "} else if (!guidcmp(&g, &ff_asf_head1_guid)) {", "int VAR_34, VAR_35;", "get_guid(pb, &g);", "VAR_34 = get_le32(pb);", "VAR_35 = get_le16(pb);", "continue;", "} else if (!guidcmp(&g, &ff_asf_marker_header)) {", "int VAR_36, VAR_36, VAR_37;", "char VAR_37[1024];", "get_le64(pb);", "get_le64(pb);", "VAR_36 = get_le32(pb);", "get_le16(pb);", "VAR_37 = get_le16(pb);", "for(VAR_36=0;VAR_36<VAR_37;VAR_36++){", "get_byte(pb);", "}", "for(VAR_36=0;VAR_36<VAR_36;VAR_36++){", "int64_t pres_time;", "int VAR_37;", "get_le64(pb);", "pres_time = get_le64(pb);", "get_le16(pb);", "get_le32(pb);", "get_le32(pb);", "VAR_37 = get_le32(pb);", "get_str16_nolen(pb, VAR_37 * 2, VAR_37, sizeof(VAR_37));", "ff_new_chapter(VAR_0, VAR_36, (AVRational){1, 10000000}, pres_time, AV_NOPTS_VALUE, VAR_37 );", "}", "#if 0\n} else if (!guidcmp(&g, &ff_asf_codec_comment_header)) {", "int len, VAR_34, VAR_27, num;", "char str[256], *q;", "char tag[16];", "get_guid(pb, &g);", "print_guid(&g);", "VAR_27 = get_le32(pb);", "for(VAR_36=0;VAR_36<VAR_27;VAR_36++) {", "num = get_le16(pb);", "get_str16(pb, str, sizeof(str));", "get_str16(pb, str, sizeof(str));", "len = get_le16(pb);", "q = tag;", "while (len > 0) {", "VAR_34 = get_byte(pb);", "if ((q - tag) < sizeof(tag) - 1)\n*q++ = VAR_34;", "len--;", "}", "*q = '\\0';", "}", "#endif\n} else if (url_feof(pb)) {", "return -1;", "} else {", "if (!VAR_0->keylen) {", "if (!guidcmp(&g, &ff_asf_content_encryption)) {", "av_log(VAR_0, AV_LOG_WARNING, \"DRM protected stream detected, decoding will likely fail!\\VAR_27\");", "} else if (!guidcmp(&g, &ff_asf_ext_content_encryption)) {", "av_log(VAR_0, AV_LOG_WARNING, \"Ext DRM protected stream detected, decoding will likely fail!\\VAR_27\");", "} else if (!guidcmp(&g, &ff_asf_digital_signature)) {", "av_log(VAR_0, AV_LOG_WARNING, \"Digital signature detected, decoding will likely fail!\\VAR_27\");", "}", "}", "}", "if(url_ftell(pb) != gpos + gsize)\nav_log(VAR_0, AV_LOG_DEBUG, \"gpos mismatch our pos=%\"PRIu64\", end=%\"PRIu64\"\\VAR_27\", 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))\nreturn -1;", "asf->data_offset = url_ftell(pb);", "asf->packet_size_left = 0;", "for(VAR_36=0; VAR_36<128; VAR_36++){", "int VAR_37= asf->asfid2avid[VAR_36];", "if(VAR_37>=0){", "AVStream *st = VAR_0->streams[VAR_37];", "if (!st->codec->bit_rate)\nst->codec->bit_rate = VAR_18[VAR_36];", "if (dar[VAR_36].num > 0 && dar[VAR_36].den > 0)\nav_reduce(&st->sample_aspect_ratio.num,\n&st->sample_aspect_ratio.den,\ndar[VAR_36].num, dar[VAR_36].den, INT_MAX);", "if (asf->streams[VAR_36].stream_language_index < 128) {", "const char *VAR_37 = asf->stream_languages[asf->streams[VAR_36].stream_language_index];", "if (VAR_37 && strlen(VAR_37) > 1) {", "const char VAR_38[3] = { VAR_37[0], VAR_37[1], '\\0' };", "const char *VAR_39 = av_convert_lang_to(VAR_38, AV_LANG_ISO639_2_BIBL);", "if (VAR_39)\nav_metadata_set2(&st->metadata, \"language\", VAR_39, 0);", "}", "}", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 143 ], [ 145, 147 ], [ 149 ], [ 151 ], [ 153, 155 ], [ 157 ], [ 159 ], [ 163 ], [ 167 ], [ 169, 171 ], [ 173 ], [ 175 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 217 ], [ 221 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 305 ], [ 307, 309, 311, 313 ], [ 315 ], [ 317 ], [ 319, 321 ], [ 323 ], [ 325, 327, 329, 331, 333, 335, 337, 339, 341 ], [ 343 ], [ 345, 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 373 ], [ 375 ], [ 377 ], [ 379 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 403 ], [ 405 ], [ 407, 409 ], [ 411 ], [ 413, 415, 417 ], [ 419, 421 ], [ 423 ], [ 427 ], [ 429 ], [ 431, 433 ], [ 435, 437 ], [ 439 ], [ 441 ], [ 443 ], [ 445 ], [ 447 ], [ 451 ], [ 453 ], [ 455 ], [ 457 ], [ 459 ], [ 461 ], [ 463 ], [ 465 ], [ 467 ], [ 469 ], [ 471 ], [ 473 ], [ 475 ], [ 483 ], [ 485 ], [ 489 ], [ 491 ], [ 493 ], [ 497 ], [ 499 ], [ 501 ], [ 503 ], [ 505 ], [ 507 ], [ 509 ], [ 511 ], [ 513 ], [ 515, 517 ], [ 519 ], [ 521 ], [ 523 ], [ 527 ], [ 529 ], [ 531 ], [ 533 ], [ 537 ], [ 539, 541 ], [ 543 ], [ 545 ], [ 547 ], [ 549, 551 ], [ 553 ], [ 555 ], [ 557 ], [ 559 ], [ 561 ], [ 565 ], [ 567 ], [ 571 ], [ 573 ], [ 575 ], [ 577 ], [ 579 ], [ 583 ], [ 587 ], [ 589 ], [ 593 ], [ 595 ], [ 597 ], [ 599 ], [ 601 ], [ 603 ], [ 605 ], [ 607 ], [ 609 ], [ 613 ], [ 615 ], [ 617 ], [ 619 ], [ 621 ], [ 623 ], [ 625 ], [ 627 ], [ 629 ], [ 631 ], [ 633 ], [ 637 ], [ 639, 641 ], [ 645 ], [ 647 ], [ 649 ], [ 653, 655 ], [ 659 ], [ 661 ], [ 663 ], [ 665 ], [ 667 ], [ 671 ], [ 673 ], [ 675 ], [ 677 ], [ 679 ], [ 681 ], [ 689 ], [ 691 ], [ 693 ], [ 695 ], [ 697 ], [ 699 ], [ 701 ], [ 703 ], [ 705 ], [ 707 ], [ 711 ], [ 713 ], [ 715 ], [ 717 ], [ 719 ], [ 721 ], [ 723 ], [ 725 ], [ 729 ], [ 731 ], [ 733 ], [ 737 ], [ 739 ], [ 741 ], [ 743 ], [ 745 ], [ 747 ], [ 749 ], [ 751 ], [ 753 ], [ 755, 757 ], [ 759 ], [ 761 ], [ 763 ], [ 767 ], [ 769 ], [ 773 ], [ 775 ], [ 777 ], [ 779 ], [ 781 ], [ 783 ], [ 785 ], [ 787 ], [ 789 ], [ 791, 793 ], [ 795 ], [ 797 ], [ 799 ], [ 801 ], [ 803, 805 ], [ 807 ], [ 809 ], [ 811 ], [ 813 ], [ 815 ], [ 817 ], [ 819 ], [ 821 ], [ 823 ], [ 825 ], [ 827 ], [ 829 ], [ 831, 833 ], [ 835 ], [ 837 ], [ 839 ], [ 841 ], [ 843 ], [ 845 ], [ 847, 849 ], [ 851 ], [ 853 ], [ 859 ], [ 861 ], [ 863 ], [ 865 ], [ 867, 869 ], [ 871, 873, 875, 877 ], [ 885 ], [ 887 ], [ 889 ], [ 891 ], [ 893 ], [ 895, 897 ], [ 899 ], [ 901 ], [ 903 ], [ 905 ], [ 909 ], [ 911 ] ]
25,399
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; }
true
qemu
a903f40c314c57734ffd651786c953541cfc43a8
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; } 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; }
{ "code": [ " if (error_is_set(errp)) {", " if (error_is_set(errp)) {" ], "line_no": [ 65, 65 ] }
int64_t FUNC_0(const char *path, bool has_mode, const char *mode, Error **errp) { FILE *fh; Error *local_err = NULL; int VAR_0; 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; } VAR_0 = fileno(fh); ret = fcntl(VAR_0, F_GETFL); ret = fcntl(VAR_0, 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; }
[ "int64_t FUNC_0(const char *path, bool has_mode, const char *mode,\nError **errp)\n{", "FILE *fh;", "Error *local_err = NULL;", "int VAR_0;", "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;", "}", "VAR_0 = fileno(fh);", "ret = fcntl(VAR_0, F_GETFL);", "ret = fcntl(VAR_0, F_SETFL, ret | O_NONBLOCK);", "if (ret == -1) {", "error_setg_errno(errp, errno, \"failed to make file '%s' non-blocking\",\npath);", "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;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ] ]
25,400
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;
true
FFmpeg
3ca14aa5964ea5d11f7a15f9fff17924d6096d44
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; 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); back_size = avio_rl32(pb); signature = avio_rb32(pb); avio_skip(pb, 4); frame_count = avio_rl32(pb); if(back_size > INT_MAX/2 || frame_count > INT_MAX / sizeof(uint32_t)) avio_skip(pb, 2); sound_rate = avio_rl16(pb); rate = avio_rl16(pb); channels = avio_rl16(pb); def_sound_size = avio_rl16(pb); 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; st->codec->width = 320; st->codec->height = 200; 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); 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); 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; 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;
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVFormatContext *s) { AVIOContext *pb = s->pb; AVStream *st; unsigned int VAR_0; unsigned int VAR_1 = 0; unsigned int VAR_2 = 0; unsigned int VAR_3; unsigned short VAR_4; unsigned short VAR_5; unsigned short VAR_6; unsigned short VAR_7; unsigned int VAR_8; unsigned int VAR_9 = 11025; unsigned int VAR_10 = 1103; unsigned int* VAR_11 = NULL; int* VAR_12 = NULL; int* VAR_13 = NULL; int VAR_14; int VAR_15 = 0; avio_skip(pb,4); VAR_3 = avio_rl32(pb); VAR_8 = avio_rb32(pb); avio_skip(pb, 4); VAR_0 = avio_rl32(pb); if(VAR_3 > INT_MAX/2 || VAR_0 > INT_MAX / sizeof(uint32_t)) avio_skip(pb, 2); VAR_4 = avio_rl16(pb); VAR_5 = avio_rl16(pb); VAR_6 = avio_rl16(pb); VAR_7 = avio_rl16(pb); 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; st->codec->width = 320; st->codec->height = 200; st->codec->extradata_size = EXTRADATA1_SIZE; if(VAR_8 == RLV3_TAG && VAR_3 > 0) st->codec->extradata_size += VAR_3; 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); if(VAR_4){ VAR_10 = VAR_7; VAR_9 = VAR_5; 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->VAR_6 = VAR_6; st->codec->bits_per_coded_sample = 8; st->codec->sample_rate = VAR_5; st->codec->bit_rate = st->codec->VAR_6 * st->codec->sample_rate * st->codec->bits_per_coded_sample; st->codec->block_align = st->codec->VAR_6 * st->codec->bits_per_coded_sample / 8; avpriv_set_pts_info(st,32,1,VAR_5); avpriv_set_pts_info(s->streams[0], 32, VAR_10, VAR_9); VAR_12 = av_malloc(VAR_0 * sizeof(uint32_t)); VAR_13 = av_malloc(VAR_0 * sizeof(uint32_t)); VAR_11 = av_malloc(VAR_0 * sizeof(uint32_t)); if(!VAR_12 || !VAR_13 || !VAR_11){ av_free(VAR_12); av_free(VAR_13); av_free(VAR_11); return AVERROR(ENOMEM); for(VAR_14=0; VAR_14 < VAR_0;VAR_14++) VAR_12[VAR_14] = avio_rl32(pb); for(VAR_14=0; VAR_14 < VAR_0;VAR_14++) VAR_11[VAR_14] = avio_rl32(pb); for(VAR_14=0; VAR_14 < VAR_0;VAR_14++) VAR_13[VAR_14] = avio_rl32(pb) & 0xFFFF; for(VAR_14=0;VAR_14<VAR_0;VAR_14++){ if(VAR_12[VAR_14] < 0 || VAR_13[VAR_14] > VAR_12[VAR_14]){ VAR_15 = AVERROR_INVALIDDATA; break; if(VAR_4 && VAR_13[VAR_14]){ av_add_index_entry(s->streams[1], VAR_11[VAR_14], VAR_1,VAR_13[VAR_14], 0, AVINDEX_KEYFRAME); VAR_1 += VAR_13[VAR_14] / VAR_6; av_add_index_entry(s->streams[0], VAR_11[VAR_14] + VAR_13[VAR_14], VAR_2,VAR_12[VAR_14]-VAR_13[VAR_14],0,AVINDEX_KEYFRAME); ++VAR_2; av_free(VAR_12); av_free(VAR_13); av_free(VAR_11); return VAR_15;
[ "static av_cold int FUNC_0(AVFormatContext *s)\n{", "AVIOContext *pb = s->pb;", "AVStream *st;", "unsigned int VAR_0;", "unsigned int VAR_1 = 0;", "unsigned int VAR_2 = 0;", "unsigned int VAR_3;", "unsigned short VAR_4;", "unsigned short VAR_5;", "unsigned short VAR_6;", "unsigned short VAR_7;", "unsigned int VAR_8;", "unsigned int VAR_9 = 11025;", "unsigned int VAR_10 = 1103;", "unsigned int* VAR_11 = NULL;", "int* VAR_12 = NULL;", "int* VAR_13 = NULL;", "int VAR_14;", "int VAR_15 = 0;", "avio_skip(pb,4);", "VAR_3 = avio_rl32(pb);", "VAR_8 = avio_rb32(pb);", "avio_skip(pb, 4);", "VAR_0 = avio_rl32(pb);", "if(VAR_3 > INT_MAX/2 || VAR_0 > INT_MAX / sizeof(uint32_t))\navio_skip(pb, 2);", "VAR_4 = avio_rl16(pb);", "VAR_5 = avio_rl16(pb);", "VAR_6 = avio_rl16(pb);", "VAR_7 = avio_rl16(pb);", "st = avformat_new_stream(s, NULL);", "if(!st)\nreturn AVERROR(ENOMEM);", "st->codec->codec_type = AVMEDIA_TYPE_VIDEO;", "st->codec->codec_id = AV_CODEC_ID_RL2;", "st->codec->codec_tag = 0;", "st->codec->width = 320;", "st->codec->height = 200;", "st->codec->extradata_size = EXTRADATA1_SIZE;", "if(VAR_8 == RLV3_TAG && VAR_3 > 0)\nst->codec->extradata_size += VAR_3;", "st->codec->extradata = av_mallocz(st->codec->extradata_size +\nFF_INPUT_BUFFER_PADDING_SIZE);", "if(!st->codec->extradata)\nreturn AVERROR(ENOMEM);", "if(avio_read(pb,st->codec->extradata,st->codec->extradata_size) !=\nst->codec->extradata_size)\nreturn AVERROR(EIO);", "if(VAR_4){", "VAR_10 = VAR_7;", "VAR_9 = VAR_5;", "st = avformat_new_stream(s, NULL);", "if (!st)\nreturn 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->VAR_6 = VAR_6;", "st->codec->bits_per_coded_sample = 8;", "st->codec->sample_rate = VAR_5;", "st->codec->bit_rate = st->codec->VAR_6 * st->codec->sample_rate *\nst->codec->bits_per_coded_sample;", "st->codec->block_align = st->codec->VAR_6 *\nst->codec->bits_per_coded_sample / 8;", "avpriv_set_pts_info(st,32,1,VAR_5);", "avpriv_set_pts_info(s->streams[0], 32, VAR_10, VAR_9);", "VAR_12 = av_malloc(VAR_0 * sizeof(uint32_t));", "VAR_13 = av_malloc(VAR_0 * sizeof(uint32_t));", "VAR_11 = av_malloc(VAR_0 * sizeof(uint32_t));", "if(!VAR_12 || !VAR_13 || !VAR_11){", "av_free(VAR_12);", "av_free(VAR_13);", "av_free(VAR_11);", "return AVERROR(ENOMEM);", "for(VAR_14=0; VAR_14 < VAR_0;VAR_14++)", "VAR_12[VAR_14] = avio_rl32(pb);", "for(VAR_14=0; VAR_14 < VAR_0;VAR_14++)", "VAR_11[VAR_14] = avio_rl32(pb);", "for(VAR_14=0; VAR_14 < VAR_0;VAR_14++)", "VAR_13[VAR_14] = avio_rl32(pb) & 0xFFFF;", "for(VAR_14=0;VAR_14<VAR_0;VAR_14++){", "if(VAR_12[VAR_14] < 0 || VAR_13[VAR_14] > VAR_12[VAR_14]){", "VAR_15 = AVERROR_INVALIDDATA;", "break;", "if(VAR_4 && VAR_13[VAR_14]){", "av_add_index_entry(s->streams[1], VAR_11[VAR_14],\nVAR_1,VAR_13[VAR_14], 0, AVINDEX_KEYFRAME);", "VAR_1 += VAR_13[VAR_14] / VAR_6;", "av_add_index_entry(s->streams[0], VAR_11[VAR_14] + VAR_13[VAR_14],\nVAR_2,VAR_12[VAR_14]-VAR_13[VAR_14],0,AVINDEX_KEYFRAME);", "++VAR_2;", "av_free(VAR_12);", "av_free(VAR_13);", "av_free(VAR_11);", "return VAR_15;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 57, 62 ], [ 64 ], [ 66 ], [ 68 ], [ 70 ], [ 80 ], [ 82, 84 ], [ 88 ], [ 90 ], [ 92 ], [ 94 ], [ 96 ], [ 102 ], [ 106, 108 ], [ 112, 114 ], [ 116, 118 ], [ 122, 124, 126 ], [ 132 ], [ 134 ], [ 136 ], [ 140 ], [ 142, 144 ], [ 146 ], [ 148 ], [ 150 ], [ 152 ], [ 154 ], [ 156 ], [ 158, 160 ], [ 162, 164 ], [ 166 ], [ 171 ], [ 175 ], [ 177 ], [ 179 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 198 ], [ 200 ], [ 202 ], [ 204 ], [ 206 ], [ 208 ], [ 214 ], [ 216 ], [ 218 ], [ 220 ], [ 225 ], [ 227, 229 ], [ 231 ], [ 234, 236 ], [ 238 ], [ 245 ], [ 247 ], [ 249 ], [ 253 ] ]
25,402
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; }
true
FFmpeg
1002932a3b16d35c46a08455f76462909eebb5aa
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; }
{ "code": [ " if (c->video_size < aligned_width * avctx->height * c->bpp / 8)" ], "line_no": [ 79 ] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { CDXLVideoContext *c = VAR_0->priv_data; AVFrame * const p = VAR_1; int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9 = VAR_3->size; const uint8_t *VAR_10 = VAR_3->VAR_1; if (VAR_9 < 32) return AVERROR_INVALIDDATA; VAR_7 = VAR_10[1] & 7; c->format = VAR_10[1] & 0xE0; VAR_5 = AV_RB16(&VAR_10[14]); VAR_6 = AV_RB16(&VAR_10[16]); c->bpp = VAR_10[19]; c->palette_size = AV_RB16(&VAR_10[20]); c->palette = VAR_10 + 32; c->video = c->palette + c->palette_size; c->video_size = VAR_9 - c->palette_size - 32; if (c->palette_size > 512) return AVERROR_INVALIDDATA; if (VAR_9 < 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(VAR_0, "Pixel format 0x%0x", c->format); return AVERROR_PATCHWELCOME; } if ((VAR_4 = ff_set_dimensions(VAR_0, VAR_5, VAR_6)) < 0) return VAR_4; if (c->format == CHUNKY) VAR_8 = VAR_0->width; else VAR_8 = FFALIGN(c->VAR_0->width, 16); c->padded_bits = VAR_8 - c->VAR_0->width; if (c->video_size < VAR_8 * VAR_0->height * c->bpp / 8) return AVERROR_INVALIDDATA; if (!VAR_7 && c->palette_size && c->bpp <= 8) { VAR_0->pix_fmt = AV_PIX_FMT_PAL8; } else if (VAR_7 == 1 && (c->bpp == 6 || c->bpp == 8)) { if (c->palette_size != (1 << (c->bpp - 1))) return AVERROR_INVALIDDATA; VAR_0->pix_fmt = AV_PIX_FMT_BGR24; } else if (!VAR_7 && c->bpp == 24 && c->format == CHUNKY && !c->palette_size) { VAR_0->pix_fmt = AV_PIX_FMT_RGB24; } else { avpriv_request_sample(VAR_0, "Encoding %d, bpp %d and format 0x%x", VAR_7, c->bpp, c->format); return AVERROR_PATCHWELCOME; } if ((VAR_4 = ff_get_buffer(VAR_0, p, 0)) < 0) return VAR_4; p->pict_type = AV_PICTURE_TYPE_I; if (VAR_7) { av_fast_padded_malloc(&c->new_video, &c->new_video_size, VAR_6 * VAR_5 + 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 (VAR_0->pix_fmt == AV_PIX_FMT_PAL8) { cdxl_decode_rgb(c, p); } else { cdxl_decode_raw(c, p); } *VAR_2 = 1; return VAR_9; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{", "CDXLVideoContext *c = VAR_0->priv_data;", "AVFrame * const p = VAR_1;", "int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9 = VAR_3->size;", "const uint8_t *VAR_10 = VAR_3->VAR_1;", "if (VAR_9 < 32)\nreturn AVERROR_INVALIDDATA;", "VAR_7 = VAR_10[1] & 7;", "c->format = VAR_10[1] & 0xE0;", "VAR_5 = AV_RB16(&VAR_10[14]);", "VAR_6 = AV_RB16(&VAR_10[16]);", "c->bpp = VAR_10[19];", "c->palette_size = AV_RB16(&VAR_10[20]);", "c->palette = VAR_10 + 32;", "c->video = c->palette + c->palette_size;", "c->video_size = VAR_9 - c->palette_size - 32;", "if (c->palette_size > 512)\nreturn AVERROR_INVALIDDATA;", "if (VAR_9 < c->palette_size + 32)\nreturn AVERROR_INVALIDDATA;", "if (c->bpp < 1)\nreturn AVERROR_INVALIDDATA;", "if (c->format != BIT_PLANAR && c->format != BIT_LINE && c->format != CHUNKY) {", "avpriv_request_sample(VAR_0, \"Pixel format 0x%0x\", c->format);", "return AVERROR_PATCHWELCOME;", "}", "if ((VAR_4 = ff_set_dimensions(VAR_0, VAR_5, VAR_6)) < 0)\nreturn VAR_4;", "if (c->format == CHUNKY)\nVAR_8 = VAR_0->width;", "else\nVAR_8 = FFALIGN(c->VAR_0->width, 16);", "c->padded_bits = VAR_8 - c->VAR_0->width;", "if (c->video_size < VAR_8 * VAR_0->height * c->bpp / 8)\nreturn AVERROR_INVALIDDATA;", "if (!VAR_7 && c->palette_size && c->bpp <= 8) {", "VAR_0->pix_fmt = AV_PIX_FMT_PAL8;", "} else if (VAR_7 == 1 && (c->bpp == 6 || c->bpp == 8)) {", "if (c->palette_size != (1 << (c->bpp - 1)))\nreturn AVERROR_INVALIDDATA;", "VAR_0->pix_fmt = AV_PIX_FMT_BGR24;", "} else if (!VAR_7 && c->bpp == 24 && c->format == CHUNKY &&", "!c->palette_size) {", "VAR_0->pix_fmt = AV_PIX_FMT_RGB24;", "} else {", "avpriv_request_sample(VAR_0, \"Encoding %d, bpp %d and format 0x%x\",\nVAR_7, c->bpp, c->format);", "return AVERROR_PATCHWELCOME;", "}", "if ((VAR_4 = ff_get_buffer(VAR_0, p, 0)) < 0)\nreturn VAR_4;", "p->pict_type = AV_PICTURE_TYPE_I;", "if (VAR_7) {", "av_fast_padded_malloc(&c->new_video, &c->new_video_size,\nVAR_6 * VAR_5 + AV_INPUT_BUFFER_PADDING_SIZE);", "if (!c->new_video)\nreturn AVERROR(ENOMEM);", "if (c->bpp == 8)\ncdxl_decode_ham8(c, p);", "else\ncdxl_decode_ham6(c, p);", "} else if (VAR_0->pix_fmt == AV_PIX_FMT_PAL8) {", "cdxl_decode_rgb(c, p);", "} else {", "cdxl_decode_raw(c, p);", "}", "*VAR_2 = 1;", "return VAR_9;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41, 43 ], [ 45, 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63, 65 ], [ 69, 71 ], [ 73, 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 113, 115 ], [ 117 ], [ 121 ], [ 123, 125 ], [ 127, 129 ], [ 131, 133 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 153 ], [ 155 ] ]
25,403
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; }
true
qemu
b3a6a2e0417c78ec5491347eb85a7d125a5fefdc
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; }
{ "code": [ " int32 z;", " int32 z;", " int32 z;", " int32 z;" ], "line_no": [ 11, 11, 11, 11 ] }
int32 FUNC_0( 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; }
[ "int32 FUNC_0( floatx80 a STATUS_PARAM )\n{", "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:\nfloat_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;", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ] ]
25,405
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; }
true
FFmpeg
8962da9ec367b535f975c876643ed2cad2bad32e
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); 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) { 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; }
{ "code": [ " frame->buf[0] = av_buffer_alloc(context->frame_size);", " memcpy(frame->buf[0]->data, buf, FFMIN(buf_size, context->frame_size));" ], "line_no": [ 61, 119 ] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { const AVPixFmtDescriptor *VAR_4 = av_pix_fmt_desc_get(VAR_0->pix_fmt); RawVideoContext *context = VAR_0->priv_data; const uint8_t *VAR_5 = VAR_3->VAR_1; int VAR_6 = VAR_3->size; int VAR_7 = 4; int VAR_8, VAR_9; int VAR_10 = !VAR_3->VAR_5 || context->is_2_4_bpp || context->is_yuv2; AVFrame *frame = VAR_1; AVPicture *picture = VAR_1; frame->pict_type = AV_PICTURE_TYPE_I; frame->key_frame = 1; frame->reordered_opaque = VAR_0->reordered_opaque; frame->pkt_pts = VAR_0->pkt->pts; av_frame_set_pkt_pos (frame, VAR_0->pkt->pos); av_frame_set_pkt_duration(frame, VAR_0->pkt->duration); if (context->tff >= 0) { frame->interlaced_frame = 1; frame->top_field_first = context->tff; } if ((VAR_8 = av_image_check_size(VAR_0->width, VAR_0->height, 0, VAR_0)) < 0) return VAR_8; if (VAR_10) frame->VAR_5[0] = av_buffer_alloc(context->frame_size); else frame->VAR_5[0] = av_buffer_ref(VAR_3->VAR_5); if (!frame->VAR_5[0]) return AVERROR(ENOMEM); if (context->is_2_4_bpp) { int VAR_11; uint8_t *dst = frame->VAR_5[0]->VAR_1; VAR_6 = context->frame_size - AVPALETTE_SIZE; if (VAR_0->bits_per_coded_sample == 4) { for (VAR_11 = 0; 2 * VAR_11 + 1 < VAR_6 && VAR_11<VAR_3->size; VAR_11++) { dst[2 * VAR_11 + 0] = VAR_5[VAR_11] >> 4; dst[2 * VAR_11 + 1] = VAR_5[VAR_11] & 15; } VAR_7 = 8; } else { av_assert0(VAR_0->bits_per_coded_sample == 2); for (VAR_11 = 0; 4 * VAR_11 + 3 < VAR_6 && VAR_11<VAR_3->size; VAR_11++) { dst[4 * VAR_11 + 0] = VAR_5[VAR_11] >> 6; dst[4 * VAR_11 + 1] = VAR_5[VAR_11] >> 4 & 3; dst[4 * VAR_11 + 2] = VAR_5[VAR_11] >> 2 & 3; dst[4 * VAR_11 + 3] = VAR_5[VAR_11] & 3; } VAR_7 = 16; } VAR_5 = dst; } else if (VAR_10) { memcpy(frame->VAR_5[0]->VAR_1, VAR_5, FFMIN(VAR_6, context->frame_size)); VAR_5 = frame->VAR_5[0]->VAR_1; } if (VAR_0->codec_tag == MKTAG('A', 'V', '1', 'VAR_16') || VAR_0->codec_tag == MKTAG('A', 'V', 'u', 'p')) VAR_5 += VAR_6 - context->frame_size; VAR_9 = context->frame_size - (VAR_0->pix_fmt==AV_PIX_FMT_PAL8 ? AVPALETTE_SIZE : 0); if (VAR_6 < VAR_9) { av_log(VAR_0, AV_LOG_ERROR, "Invalid buffer size, packet size %d < expected frame_size %d\n", VAR_6, VAR_9); av_buffer_unref(&frame->VAR_5[0]); return AVERROR(EINVAL); } if ((VAR_8 = avpicture_fill(picture, VAR_5, VAR_0->pix_fmt, VAR_0->width, VAR_0->height)) < 0) { av_buffer_unref(&frame->VAR_5[0]); return VAR_8; } if (VAR_0->pix_fmt == AV_PIX_FMT_PAL8) { const uint8_t *VAR_12 = av_packet_get_side_data(VAR_3, AV_PKT_DATA_PALETTE, NULL); if (VAR_12) { av_buffer_unref(&context->palette); context->palette = av_buffer_alloc(AVPALETTE_SIZE); if (!context->palette) { av_buffer_unref(&frame->VAR_5[0]); return AVERROR(ENOMEM); } memcpy(context->palette->VAR_1, VAR_12, AVPALETTE_SIZE); frame->palette_has_changed = 1; } } if ((VAR_0->pix_fmt==AV_PIX_FMT_BGR24 || VAR_0->pix_fmt==AV_PIX_FMT_GRAY8 || VAR_0->pix_fmt==AV_PIX_FMT_RGB555LE || VAR_0->pix_fmt==AV_PIX_FMT_RGB555BE || VAR_0->pix_fmt==AV_PIX_FMT_RGB565LE || VAR_0->pix_fmt==AV_PIX_FMT_MONOWHITE || VAR_0->pix_fmt==AV_PIX_FMT_PAL8) && FFALIGN(frame->linesize[0], VAR_7) * VAR_0->height <= VAR_6) frame->linesize[0] = FFALIGN(frame->linesize[0], VAR_7); if (VAR_0->pix_fmt == AV_PIX_FMT_NV12 && VAR_0->codec_tag == MKTAG('N', 'V', '1', '2') && FFALIGN(frame->linesize[0], VAR_7) * VAR_0->height + FFALIGN(frame->linesize[1], VAR_7) * ((VAR_0->height + 1) / 2) <= VAR_6) { int VAR_13 = FFALIGN(frame->linesize[0], VAR_7); frame->VAR_1[1] += (VAR_13 - frame->linesize[0]) * VAR_0->height; frame->linesize[0] = VAR_13; frame->linesize[1] = FFALIGN(frame->linesize[1], VAR_7); } if ((VAR_0->pix_fmt == AV_PIX_FMT_PAL8 && VAR_6 < context->frame_size) || (VAR_4->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)) { frame->VAR_5[1] = av_buffer_ref(context->palette); if (!frame->VAR_5[1]) { av_buffer_unref(&frame->VAR_5[0]); return AVERROR(ENOMEM); } frame->VAR_1[1] = frame->VAR_5[1]->VAR_1; } if (VAR_0->pix_fmt == AV_PIX_FMT_BGR24 && ((frame->linesize[0] + 3) & ~3) * VAR_0->height <= VAR_6) frame->linesize[0] = (frame->linesize[0] + 3) & ~3; if (context->flip) flip(VAR_0, picture); if (VAR_0->codec_tag == MKTAG('Y', 'V', '1', '2') || VAR_0->codec_tag == MKTAG('Y', 'V', '1', '6') || VAR_0->codec_tag == MKTAG('Y', 'V', '2', '4') || VAR_0->codec_tag == MKTAG('Y', 'V', 'U', '9')) FFSWAP(uint8_t *, picture->VAR_1[1], picture->VAR_1[2]); if (VAR_0->codec_tag == AV_RL32("I420") && (VAR_0->width+1)*(VAR_0->height+1) * 3/2 == VAR_6) { picture->VAR_1[1] = picture->VAR_1[1] + (VAR_0->width+1)*(VAR_0->height+1) -VAR_0->width*VAR_0->height; picture->VAR_1[2] = picture->VAR_1[2] + ((VAR_0->width+1)*(VAR_0->height+1) -VAR_0->width*VAR_0->height)*5/4; } if (VAR_0->codec_tag == AV_RL32("yuv2") && VAR_0->pix_fmt == AV_PIX_FMT_YUYV422) { int VAR_16, VAR_16; uint8_t *line = picture->VAR_1[0]; for (VAR_16 = 0; VAR_16 < VAR_0->height; VAR_16++) { for (VAR_16 = 0; VAR_16 < VAR_0->width; VAR_16++) line[2 * VAR_16 + 1] ^= 0x80; line += picture->linesize[0]; } } if (VAR_0->codec_tag == AV_RL32("YVYU") && VAR_0->pix_fmt == AV_PIX_FMT_YUYV422) { int VAR_16, VAR_16; uint8_t *line = picture->VAR_1[0]; for(VAR_16 = 0; VAR_16 < VAR_0->height; VAR_16++) { for(VAR_16 = 0; VAR_16 < VAR_0->width - 1; VAR_16 += 2) FFSWAP(uint8_t, line[2*VAR_16 + 1], line[2*VAR_16 + 3]); line += picture->linesize[0]; } } if (VAR_0->field_order > AV_FIELD_PROGRESSIVE) { frame->interlaced_frame = 1; if (VAR_0->field_order == AV_FIELD_TT || VAR_0->field_order == AV_FIELD_TB) frame->top_field_first = 1; } *VAR_2 = 1; return VAR_6; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{", "const AVPixFmtDescriptor *VAR_4 = av_pix_fmt_desc_get(VAR_0->pix_fmt);", "RawVideoContext *context = VAR_0->priv_data;", "const uint8_t *VAR_5 = VAR_3->VAR_1;", "int VAR_6 = VAR_3->size;", "int VAR_7 = 4;", "int VAR_8, VAR_9;", "int VAR_10 = !VAR_3->VAR_5 || context->is_2_4_bpp || context->is_yuv2;", "AVFrame *frame = VAR_1;", "AVPicture *picture = VAR_1;", "frame->pict_type = AV_PICTURE_TYPE_I;", "frame->key_frame = 1;", "frame->reordered_opaque = VAR_0->reordered_opaque;", "frame->pkt_pts = VAR_0->pkt->pts;", "av_frame_set_pkt_pos (frame, VAR_0->pkt->pos);", "av_frame_set_pkt_duration(frame, VAR_0->pkt->duration);", "if (context->tff >= 0) {", "frame->interlaced_frame = 1;", "frame->top_field_first = context->tff;", "}", "if ((VAR_8 = av_image_check_size(VAR_0->width, VAR_0->height, 0, VAR_0)) < 0)\nreturn VAR_8;", "if (VAR_10)\nframe->VAR_5[0] = av_buffer_alloc(context->frame_size);", "else\nframe->VAR_5[0] = av_buffer_ref(VAR_3->VAR_5);", "if (!frame->VAR_5[0])\nreturn AVERROR(ENOMEM);", "if (context->is_2_4_bpp) {", "int VAR_11;", "uint8_t *dst = frame->VAR_5[0]->VAR_1;", "VAR_6 = context->frame_size - AVPALETTE_SIZE;", "if (VAR_0->bits_per_coded_sample == 4) {", "for (VAR_11 = 0; 2 * VAR_11 + 1 < VAR_6 && VAR_11<VAR_3->size; VAR_11++) {", "dst[2 * VAR_11 + 0] = VAR_5[VAR_11] >> 4;", "dst[2 * VAR_11 + 1] = VAR_5[VAR_11] & 15;", "}", "VAR_7 = 8;", "} else {", "av_assert0(VAR_0->bits_per_coded_sample == 2);", "for (VAR_11 = 0; 4 * VAR_11 + 3 < VAR_6 && VAR_11<VAR_3->size; VAR_11++) {", "dst[4 * VAR_11 + 0] = VAR_5[VAR_11] >> 6;", "dst[4 * VAR_11 + 1] = VAR_5[VAR_11] >> 4 & 3;", "dst[4 * VAR_11 + 2] = VAR_5[VAR_11] >> 2 & 3;", "dst[4 * VAR_11 + 3] = VAR_5[VAR_11] & 3;", "}", "VAR_7 = 16;", "}", "VAR_5 = dst;", "} else if (VAR_10) {", "memcpy(frame->VAR_5[0]->VAR_1, VAR_5, FFMIN(VAR_6, context->frame_size));", "VAR_5 = frame->VAR_5[0]->VAR_1;", "}", "if (VAR_0->codec_tag == MKTAG('A', 'V', '1', 'VAR_16') ||\nVAR_0->codec_tag == MKTAG('A', 'V', 'u', 'p'))\nVAR_5 += VAR_6 - context->frame_size;", "VAR_9 = context->frame_size - (VAR_0->pix_fmt==AV_PIX_FMT_PAL8 ? AVPALETTE_SIZE : 0);", "if (VAR_6 < VAR_9) {", "av_log(VAR_0, AV_LOG_ERROR, \"Invalid buffer size, packet size %d < expected frame_size %d\\n\", VAR_6, VAR_9);", "av_buffer_unref(&frame->VAR_5[0]);", "return AVERROR(EINVAL);", "}", "if ((VAR_8 = avpicture_fill(picture, VAR_5, VAR_0->pix_fmt,\nVAR_0->width, VAR_0->height)) < 0) {", "av_buffer_unref(&frame->VAR_5[0]);", "return VAR_8;", "}", "if (VAR_0->pix_fmt == AV_PIX_FMT_PAL8) {", "const uint8_t *VAR_12 = av_packet_get_side_data(VAR_3, AV_PKT_DATA_PALETTE,\nNULL);", "if (VAR_12) {", "av_buffer_unref(&context->palette);", "context->palette = av_buffer_alloc(AVPALETTE_SIZE);", "if (!context->palette) {", "av_buffer_unref(&frame->VAR_5[0]);", "return AVERROR(ENOMEM);", "}", "memcpy(context->palette->VAR_1, VAR_12, AVPALETTE_SIZE);", "frame->palette_has_changed = 1;", "}", "}", "if ((VAR_0->pix_fmt==AV_PIX_FMT_BGR24 ||\nVAR_0->pix_fmt==AV_PIX_FMT_GRAY8 ||\nVAR_0->pix_fmt==AV_PIX_FMT_RGB555LE ||\nVAR_0->pix_fmt==AV_PIX_FMT_RGB555BE ||\nVAR_0->pix_fmt==AV_PIX_FMT_RGB565LE ||\nVAR_0->pix_fmt==AV_PIX_FMT_MONOWHITE ||\nVAR_0->pix_fmt==AV_PIX_FMT_PAL8) &&\nFFALIGN(frame->linesize[0], VAR_7) * VAR_0->height <= VAR_6)\nframe->linesize[0] = FFALIGN(frame->linesize[0], VAR_7);", "if (VAR_0->pix_fmt == AV_PIX_FMT_NV12 && VAR_0->codec_tag == MKTAG('N', 'V', '1', '2') &&\nFFALIGN(frame->linesize[0], VAR_7) * VAR_0->height +\nFFALIGN(frame->linesize[1], VAR_7) * ((VAR_0->height + 1) / 2) <= VAR_6) {", "int VAR_13 = FFALIGN(frame->linesize[0], VAR_7);", "frame->VAR_1[1] += (VAR_13 - frame->linesize[0]) * VAR_0->height;", "frame->linesize[0] = VAR_13;", "frame->linesize[1] = FFALIGN(frame->linesize[1], VAR_7);", "}", "if ((VAR_0->pix_fmt == AV_PIX_FMT_PAL8 && VAR_6 < context->frame_size) ||\n(VAR_4->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)) {", "frame->VAR_5[1] = av_buffer_ref(context->palette);", "if (!frame->VAR_5[1]) {", "av_buffer_unref(&frame->VAR_5[0]);", "return AVERROR(ENOMEM);", "}", "frame->VAR_1[1] = frame->VAR_5[1]->VAR_1;", "}", "if (VAR_0->pix_fmt == AV_PIX_FMT_BGR24 &&\n((frame->linesize[0] + 3) & ~3) * VAR_0->height <= VAR_6)\nframe->linesize[0] = (frame->linesize[0] + 3) & ~3;", "if (context->flip)\nflip(VAR_0, picture);", "if (VAR_0->codec_tag == MKTAG('Y', 'V', '1', '2') ||\nVAR_0->codec_tag == MKTAG('Y', 'V', '1', '6') ||\nVAR_0->codec_tag == MKTAG('Y', 'V', '2', '4') ||\nVAR_0->codec_tag == MKTAG('Y', 'V', 'U', '9'))\nFFSWAP(uint8_t *, picture->VAR_1[1], picture->VAR_1[2]);", "if (VAR_0->codec_tag == AV_RL32(\"I420\") && (VAR_0->width+1)*(VAR_0->height+1) * 3/2 == VAR_6) {", "picture->VAR_1[1] = picture->VAR_1[1] + (VAR_0->width+1)*(VAR_0->height+1) -VAR_0->width*VAR_0->height;", "picture->VAR_1[2] = picture->VAR_1[2] + ((VAR_0->width+1)*(VAR_0->height+1) -VAR_0->width*VAR_0->height)*5/4;", "}", "if (VAR_0->codec_tag == AV_RL32(\"yuv2\") &&\nVAR_0->pix_fmt == AV_PIX_FMT_YUYV422) {", "int VAR_16, VAR_16;", "uint8_t *line = picture->VAR_1[0];", "for (VAR_16 = 0; VAR_16 < VAR_0->height; VAR_16++) {", "for (VAR_16 = 0; VAR_16 < VAR_0->width; VAR_16++)", "line[2 * VAR_16 + 1] ^= 0x80;", "line += picture->linesize[0];", "}", "}", "if (VAR_0->codec_tag == AV_RL32(\"YVYU\") &&\nVAR_0->pix_fmt == AV_PIX_FMT_YUYV422) {", "int VAR_16, VAR_16;", "uint8_t *line = picture->VAR_1[0];", "for(VAR_16 = 0; VAR_16 < VAR_0->height; VAR_16++) {", "for(VAR_16 = 0; VAR_16 < VAR_0->width - 1; VAR_16 += 2)", "FFSWAP(uint8_t, line[2*VAR_16 + 1], line[2*VAR_16 + 3]);", "line += picture->linesize[0];", "}", "}", "if (VAR_0->field_order > AV_FIELD_PROGRESSIVE) {", "frame->interlaced_frame = 1;", "if (VAR_0->field_order == AV_FIELD_TT || VAR_0->field_order == AV_FIELD_TB)\nframe->top_field_first = 1;", "}", "*VAR_2 = 1;", "return VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53, 55 ], [ 59, 61 ], [ 63, 65 ], [ 67, 69 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127, 129, 131 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 149, 151 ], [ 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163, 165 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 193, 195, 197, 199, 201, 203, 205, 207, 209 ], [ 213, 215, 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 231, 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 251, 253, 255 ], [ 259, 261 ], [ 265, 267, 269, 271, 273 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 287, 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307, 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 329 ], [ 331 ], [ 333, 335 ], [ 337 ], [ 341 ], [ 343 ], [ 345 ] ]
25,406
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; }
true
FFmpeg
f6774f905fb3cfdc319523ac640be30b14c1bc55
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; }
{ "code": [ " ff_vaapi_get_surface_id(&s->current_picture_ptr->f));" ], "line_no": [ 23 ] }
int FUNC_0(AVCodecContext *VAR_0) { struct vaapi_context * const VAR_1 = VAR_0->hwaccel_context; MpegEncContext *s = VAR_0->priv_data; int VAR_2; VAR_2 = ff_vaapi_commit_slices(VAR_1); if (VAR_2 < 0) goto finish; VAR_2 = ff_vaapi_render_picture(VAR_1, ff_vaapi_get_surface_id(&s->current_picture_ptr->f)); if (VAR_2 < 0) goto finish; ff_mpeg_draw_horiz_band(s, 0, s->VAR_0->height); finish: ff_vaapi_common_end_frame(VAR_0); return VAR_2; }
[ "int FUNC_0(AVCodecContext *VAR_0)\n{", "struct vaapi_context * const VAR_1 = VAR_0->hwaccel_context;", "MpegEncContext *s = VAR_0->priv_data;", "int VAR_2;", "VAR_2 = ff_vaapi_commit_slices(VAR_1);", "if (VAR_2 < 0)\ngoto finish;", "VAR_2 = ff_vaapi_render_picture(VAR_1,\nff_vaapi_get_surface_id(&s->current_picture_ptr->f));", "if (VAR_2 < 0)\ngoto finish;", "ff_mpeg_draw_horiz_band(s, 0, s->VAR_0->height);", "finish:\nff_vaapi_common_end_frame(VAR_0);", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 21, 23 ], [ 25, 27 ], [ 31 ], [ 35, 37 ], [ 39 ], [ 41 ] ]
25,407
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); }
true
qemu
3453f9a0dfa58578e6dadf0905ff4528b428ec73
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); }
{ "code": [], "line_no": [] }
static void FUNC_0(UASDevice *VAR_0, uas_ui *VAR_1) { UASRequest *req; uint32_t len; uint16_t tag = be16_to_cpu(VAR_1->hdr.tag); if (uas_using_streams(VAR_0) && tag > UAS_MAX_STREAMS) { goto invalid_tag; } req = usb_uas_find_request(VAR_0, tag); if (req) { goto overlapped_tag; } req = usb_uas_alloc_request(VAR_0, VAR_1); if (req->dev == NULL) { goto bad_target; } trace_usb_uas_command(VAR_0->dev.addr, req->tag, usb_uas_get_lun(req->lun), req->lun >> 32, req->lun & 0xffffffff); QTAILQ_INSERT_TAIL(&VAR_0->requests, req, next); if (uas_using_streams(VAR_0) && VAR_0->data3[req->tag] != NULL) { req->data = VAR_0->data3[req->tag]; req->data_async = true; VAR_0->data3[req->tag] = NULL; } req->req = scsi_req_new(req->dev, req->tag, usb_uas_get_lun(req->lun), VAR_1->command.cdb, req); if (VAR_0->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(VAR_0, tag, sense_code_OVERLAPPED_COMMANDS); bad_target: usb_uas_queue_fake_sense(VAR_0, tag, sense_code_LUN_NOT_SUPPORTED); g_free(req); }
[ "static void FUNC_0(UASDevice *VAR_0, uas_ui *VAR_1)\n{", "UASRequest *req;", "uint32_t len;", "uint16_t tag = be16_to_cpu(VAR_1->hdr.tag);", "if (uas_using_streams(VAR_0) && tag > UAS_MAX_STREAMS) {", "goto invalid_tag;", "}", "req = usb_uas_find_request(VAR_0, tag);", "if (req) {", "goto overlapped_tag;", "}", "req = usb_uas_alloc_request(VAR_0, VAR_1);", "if (req->dev == NULL) {", "goto bad_target;", "}", "trace_usb_uas_command(VAR_0->dev.addr, req->tag,\nusb_uas_get_lun(req->lun),\nreq->lun >> 32, req->lun & 0xffffffff);", "QTAILQ_INSERT_TAIL(&VAR_0->requests, req, next);", "if (uas_using_streams(VAR_0) && VAR_0->data3[req->tag] != NULL) {", "req->data = VAR_0->data3[req->tag];", "req->data_async = true;", "VAR_0->data3[req->tag] = NULL;", "}", "req->req = scsi_req_new(req->dev, req->tag,\nusb_uas_get_lun(req->lun),\nVAR_1->command.cdb, req);", "if (VAR_0->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:\nusb_uas_queue_fake_sense(VAR_0, tag, sense_code_OVERLAPPED_COMMANDS);", "bad_target:\nusb_uas_queue_fake_sense(VAR_0, tag, sense_code_LUN_NOT_SUPPORTED);", "g_free(req);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17, 18, 19 ], [ 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24 ], [ 25 ], [ 26, 27, 28 ], [ 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33 ], [ 34 ], [ 35 ], [ 36 ], [ 37, 38 ], [ 39, 40 ], [ 41 ], [ 42 ] ]
25,408
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;
true
FFmpeg
934572c5c3592732a30336afdf2df9926a8b4df2
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); if (bytestream2_get_bytes_left(gbc) < 12) { av_log(avctx, AV_LOG_ERROR, "Packet too small (%d)\n", avpkt->size); return AVERROR_INVALIDDATA; 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); 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 (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; bytestream2_skip(gbc, packed_tiles_size); bytestream2_init(&tiles_gbc, inflated_tiles, length); gbc = &tiles_gbc; 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); gbc = &ctx->gbc; 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); 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; ret = ff_reget_buffer(avctx, ctx->reference); if (ret < 0) 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; ret = av_frame_ref(frame, ctx->reference); if (ret < 0) 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; 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;
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { RsccContext *ctx = VAR_0->priv_data; GetByteContext *gbc = &ctx->gbc; GetByteContext tiles_gbc; AVFrame *frame = VAR_1; const uint8_t *VAR_4, *raw; uint8_t *inflated_tiles = NULL; int VAR_5, VAR_6, VAR_7 = 0; int VAR_8, VAR_9 = 0; bytestream2_init(gbc, VAR_3->VAR_1, VAR_3->VAR_10); if (bytestream2_get_bytes_left(gbc) < 12) { av_log(VAR_0, AV_LOG_ERROR, "Packet too small (%d)\n", VAR_3->VAR_10); return AVERROR_INVALIDDATA; VAR_5 = bytestream2_get_le16(gbc); av_fast_malloc(&ctx->tiles, &ctx->tiles_size, VAR_5 * sizeof(*ctx->tiles)); if (!ctx->tiles) { VAR_9 = AVERROR(ENOMEM); av_log(VAR_0, AV_LOG_DEBUG, "Frame with %d tiles.\n", VAR_5); if (VAR_5 > 5) { uLongf packed_tiles_size; if (VAR_5 < 32) packed_tiles_size = bytestream2_get_byte(gbc); else packed_tiles_size = bytestream2_get_le16(gbc); ff_dlog(VAR_0, "packed tiles of VAR_10 %lu.\n", packed_tiles_size); if (packed_tiles_size != VAR_5 * TILE_SIZE) { uLongf length = VAR_5 * TILE_SIZE; inflated_tiles = av_malloc(length); if (!inflated_tiles) { VAR_9 = AVERROR(ENOMEM); VAR_9 = uncompress(inflated_tiles, &length, gbc->buffer, packed_tiles_size); if (VAR_9) { av_log(VAR_0, AV_LOG_ERROR, "Tile deflate error %d.\n", VAR_9); VAR_9 = AVERROR_UNKNOWN; bytestream2_skip(gbc, packed_tiles_size); bytestream2_init(&tiles_gbc, inflated_tiles, length); gbc = &tiles_gbc; for (VAR_8 = 0; VAR_8 < VAR_5; VAR_8++) { ctx->tiles[VAR_8].x = bytestream2_get_le16(gbc); ctx->tiles[VAR_8].w = bytestream2_get_le16(gbc); ctx->tiles[VAR_8].y = bytestream2_get_le16(gbc); ctx->tiles[VAR_8].h = bytestream2_get_le16(gbc); VAR_7 += ctx->tiles[VAR_8].w * ctx->tiles[VAR_8].h * ctx->component_size; ff_dlog(VAR_0, "tile %d orig(%d,%d) %dx%d.\n", VAR_8, ctx->tiles[VAR_8].x, ctx->tiles[VAR_8].y, ctx->tiles[VAR_8].w, ctx->tiles[VAR_8].h); if (ctx->tiles[VAR_8].w == 0 || ctx->tiles[VAR_8].h == 0) { av_log(VAR_0, AV_LOG_ERROR, "invalid tile %d at (%d.%d) with VAR_10 %dx%d.\n", VAR_8, ctx->tiles[VAR_8].x, ctx->tiles[VAR_8].y, ctx->tiles[VAR_8].w, ctx->tiles[VAR_8].h); } else if (ctx->tiles[VAR_8].x + ctx->tiles[VAR_8].w > VAR_0->width || ctx->tiles[VAR_8].y + ctx->tiles[VAR_8].h > VAR_0->height) { av_log(VAR_0, AV_LOG_ERROR, "out of bounds tile %d at (%d.%d) with VAR_10 %dx%d.\n", VAR_8, ctx->tiles[VAR_8].x, ctx->tiles[VAR_8].y, ctx->tiles[VAR_8].w, ctx->tiles[VAR_8].h); gbc = &ctx->gbc; if (VAR_7 < 0x100) VAR_6 = bytestream2_get_byte(gbc); else if (VAR_7 < 0x10000) VAR_6 = bytestream2_get_le16(gbc); else if (VAR_7 < 0x1000000) VAR_6 = bytestream2_get_le24(gbc); else VAR_6 = bytestream2_get_le32(gbc); ff_dlog(VAR_0, "VAR_7 %d VAR_6 %d.\n", VAR_7, VAR_6); if (VAR_6 < 0) { av_log(VAR_0, AV_LOG_ERROR, "Invalid tile VAR_10 %d\n", VAR_6); if (VAR_7 == VAR_6) { if (bytestream2_get_bytes_left(gbc) < VAR_7) { av_log(VAR_0, AV_LOG_ERROR, "Insufficient input for %d\n", VAR_7); VAR_4 = gbc->buffer; } else { uLongf len = ctx->inflated_size; if (bytestream2_get_bytes_left(gbc) < VAR_6) { av_log(VAR_0, AV_LOG_ERROR, "Insufficient input for %d\n", VAR_6); VAR_9 = uncompress(ctx->inflated_buf, &len, gbc->buffer, VAR_6); if (VAR_9) { av_log(VAR_0, AV_LOG_ERROR, "Pixel deflate error %d.\n", VAR_9); VAR_9 = AVERROR_UNKNOWN; VAR_4 = ctx->inflated_buf; VAR_9 = ff_reget_buffer(VAR_0, ctx->reference); if (VAR_9 < 0) raw = VAR_4; for (VAR_8 = 0; VAR_8 < VAR_5; VAR_8++) { uint8_t *dst = ctx->reference->VAR_1[0] + ctx->reference->linesize[0] * (VAR_0->height - ctx->tiles[VAR_8].y - 1) + ctx->tiles[VAR_8].x * ctx->component_size; av_image_copy_plane(dst, -1 * ctx->reference->linesize[0], raw, ctx->tiles[VAR_8].w * ctx->component_size, ctx->tiles[VAR_8].w * ctx->component_size, ctx->tiles[VAR_8].h); raw += ctx->tiles[VAR_8].w * ctx->component_size * ctx->tiles[VAR_8].h; VAR_9 = av_frame_ref(frame, ctx->reference); if (VAR_9 < 0) if (VAR_7 == ctx->inflated_size) { frame->pict_type = AV_PICTURE_TYPE_I; frame->key_frame = 1; } else { frame->pict_type = AV_PICTURE_TYPE_P; if (VAR_0->pix_fmt == AV_PIX_FMT_PAL8) { int VAR_10; const uint8_t *VAR_11 = av_packet_get_side_data(VAR_3, AV_PKT_DATA_PALETTE, &VAR_10); if (VAR_11 && VAR_10 == AVPALETTE_SIZE) { frame->palette_has_changed = 1; memcpy(ctx->VAR_11, VAR_11, AVPALETTE_SIZE); } else if (VAR_11) { av_log(VAR_0, AV_LOG_ERROR, "Palette VAR_10 %d is wrong\n", VAR_10); memcpy (frame->VAR_1[1], ctx->VAR_11, AVPALETTE_SIZE); *VAR_2 = 1; VAR_9 = VAR_3->VAR_10; end: av_free(inflated_tiles); return VAR_9;
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{", "RsccContext *ctx = VAR_0->priv_data;", "GetByteContext *gbc = &ctx->gbc;", "GetByteContext tiles_gbc;", "AVFrame *frame = VAR_1;", "const uint8_t *VAR_4, *raw;", "uint8_t *inflated_tiles = NULL;", "int VAR_5, VAR_6, VAR_7 = 0;", "int VAR_8, VAR_9 = 0;", "bytestream2_init(gbc, VAR_3->VAR_1, VAR_3->VAR_10);", "if (bytestream2_get_bytes_left(gbc) < 12) {", "av_log(VAR_0, AV_LOG_ERROR, \"Packet too small (%d)\\n\", VAR_3->VAR_10);", "return AVERROR_INVALIDDATA;", "VAR_5 = bytestream2_get_le16(gbc);", "av_fast_malloc(&ctx->tiles, &ctx->tiles_size,\nVAR_5 * sizeof(*ctx->tiles));", "if (!ctx->tiles) {", "VAR_9 = AVERROR(ENOMEM);", "av_log(VAR_0, AV_LOG_DEBUG, \"Frame with %d tiles.\\n\", VAR_5);", "if (VAR_5 > 5) {", "uLongf packed_tiles_size;", "if (VAR_5 < 32)\npacked_tiles_size = bytestream2_get_byte(gbc);", "else\npacked_tiles_size = bytestream2_get_le16(gbc);", "ff_dlog(VAR_0, \"packed tiles of VAR_10 %lu.\\n\", packed_tiles_size);", "if (packed_tiles_size != VAR_5 * TILE_SIZE) {", "uLongf length = VAR_5 * TILE_SIZE;", "inflated_tiles = av_malloc(length);", "if (!inflated_tiles) {", "VAR_9 = AVERROR(ENOMEM);", "VAR_9 = uncompress(inflated_tiles, &length,\ngbc->buffer, packed_tiles_size);", "if (VAR_9) {", "av_log(VAR_0, AV_LOG_ERROR, \"Tile deflate error %d.\\n\", VAR_9);", "VAR_9 = AVERROR_UNKNOWN;", "bytestream2_skip(gbc, packed_tiles_size);", "bytestream2_init(&tiles_gbc, inflated_tiles, length);", "gbc = &tiles_gbc;", "for (VAR_8 = 0; VAR_8 < VAR_5; VAR_8++) {", "ctx->tiles[VAR_8].x = bytestream2_get_le16(gbc);", "ctx->tiles[VAR_8].w = bytestream2_get_le16(gbc);", "ctx->tiles[VAR_8].y = bytestream2_get_le16(gbc);", "ctx->tiles[VAR_8].h = bytestream2_get_le16(gbc);", "VAR_7 += ctx->tiles[VAR_8].w * ctx->tiles[VAR_8].h * ctx->component_size;", "ff_dlog(VAR_0, \"tile %d orig(%d,%d) %dx%d.\\n\", VAR_8,\nctx->tiles[VAR_8].x, ctx->tiles[VAR_8].y,\nctx->tiles[VAR_8].w, ctx->tiles[VAR_8].h);", "if (ctx->tiles[VAR_8].w == 0 || ctx->tiles[VAR_8].h == 0) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"invalid tile %d at (%d.%d) with VAR_10 %dx%d.\\n\", VAR_8,\nctx->tiles[VAR_8].x, ctx->tiles[VAR_8].y,\nctx->tiles[VAR_8].w, ctx->tiles[VAR_8].h);", "} else if (ctx->tiles[VAR_8].x + ctx->tiles[VAR_8].w > VAR_0->width ||", "ctx->tiles[VAR_8].y + ctx->tiles[VAR_8].h > VAR_0->height) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"out of bounds tile %d at (%d.%d) with VAR_10 %dx%d.\\n\", VAR_8,\nctx->tiles[VAR_8].x, ctx->tiles[VAR_8].y,\nctx->tiles[VAR_8].w, ctx->tiles[VAR_8].h);", "gbc = &ctx->gbc;", "if (VAR_7 < 0x100)\nVAR_6 = bytestream2_get_byte(gbc);", "else if (VAR_7 < 0x10000)\nVAR_6 = bytestream2_get_le16(gbc);", "else if (VAR_7 < 0x1000000)\nVAR_6 = bytestream2_get_le24(gbc);", "else\nVAR_6 = bytestream2_get_le32(gbc);", "ff_dlog(VAR_0, \"VAR_7 %d VAR_6 %d.\\n\", VAR_7, VAR_6);", "if (VAR_6 < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"Invalid tile VAR_10 %d\\n\", VAR_6);", "if (VAR_7 == VAR_6) {", "if (bytestream2_get_bytes_left(gbc) < VAR_7) {", "av_log(VAR_0, AV_LOG_ERROR, \"Insufficient input for %d\\n\", VAR_7);", "VAR_4 = gbc->buffer;", "} else {", "uLongf len = ctx->inflated_size;", "if (bytestream2_get_bytes_left(gbc) < VAR_6) {", "av_log(VAR_0, AV_LOG_ERROR, \"Insufficient input for %d\\n\", VAR_6);", "VAR_9 = uncompress(ctx->inflated_buf, &len, gbc->buffer, VAR_6);", "if (VAR_9) {", "av_log(VAR_0, AV_LOG_ERROR, \"Pixel deflate error %d.\\n\", VAR_9);", "VAR_9 = AVERROR_UNKNOWN;", "VAR_4 = ctx->inflated_buf;", "VAR_9 = ff_reget_buffer(VAR_0, ctx->reference);", "if (VAR_9 < 0)\nraw = VAR_4;", "for (VAR_8 = 0; VAR_8 < VAR_5; VAR_8++) {", "uint8_t *dst = ctx->reference->VAR_1[0] + ctx->reference->linesize[0] *\n(VAR_0->height - ctx->tiles[VAR_8].y - 1) +\nctx->tiles[VAR_8].x * ctx->component_size;", "av_image_copy_plane(dst, -1 * ctx->reference->linesize[0],\nraw, ctx->tiles[VAR_8].w * ctx->component_size,\nctx->tiles[VAR_8].w * ctx->component_size,\nctx->tiles[VAR_8].h);", "raw += ctx->tiles[VAR_8].w * ctx->component_size * ctx->tiles[VAR_8].h;", "VAR_9 = av_frame_ref(frame, ctx->reference);", "if (VAR_9 < 0)\nif (VAR_7 == ctx->inflated_size) {", "frame->pict_type = AV_PICTURE_TYPE_I;", "frame->key_frame = 1;", "} else {", "frame->pict_type = AV_PICTURE_TYPE_P;", "if (VAR_0->pix_fmt == AV_PIX_FMT_PAL8) {", "int VAR_10;", "const uint8_t *VAR_11 = av_packet_get_side_data(VAR_3,\nAV_PKT_DATA_PALETTE,\n&VAR_10);", "if (VAR_11 && VAR_10 == AVPALETTE_SIZE) {", "frame->palette_has_changed = 1;", "memcpy(ctx->VAR_11, VAR_11, AVPALETTE_SIZE);", "} else if (VAR_11) {", "av_log(VAR_0, AV_LOG_ERROR, \"Palette VAR_10 %d is wrong\\n\", VAR_10);", "memcpy (frame->VAR_1[1], ctx->VAR_11, AVPALETTE_SIZE);", "*VAR_2 = 1;", "VAR_9 = VAR_3->VAR_10;", "end:\nav_free(inflated_tiles);", "return VAR_9;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 14 ], [ 15 ], [ 16 ], [ 18 ], [ 19, 20 ], [ 21 ], [ 22 ], [ 23 ], [ 27 ], [ 28 ], [ 29, 30 ], [ 31, 32 ], [ 33 ], [ 35 ], [ 36 ], [ 37 ], [ 38 ], [ 39 ], [ 40, 41 ], [ 42 ], [ 43 ], [ 44 ], [ 47 ], [ 48 ], [ 49 ], [ 51 ], [ 52 ], [ 53 ], [ 54 ], [ 55 ], [ 56 ], [ 57, 58, 59 ], [ 60 ], [ 61, 62, 63, 64 ], [ 65 ], [ 66 ], [ 67, 68, 69, 70 ], [ 72 ], [ 74, 75 ], [ 76, 77 ], [ 78, 79 ], [ 80, 81 ], [ 82 ], [ 83 ], [ 84 ], [ 86 ], [ 87 ], [ 88 ], [ 89 ], [ 90 ], [ 91 ], [ 92 ], [ 93 ], [ 94 ], [ 95 ], [ 96 ], [ 97 ], [ 98 ], [ 100 ], [ 101, 103 ], [ 104 ], [ 105, 106, 107 ], [ 108, 109, 110, 111 ], [ 112 ], [ 114 ], [ 115, 117 ], [ 118 ], [ 119 ], [ 120 ], [ 121 ], [ 123 ], [ 124 ], [ 125, 126, 127 ], [ 128 ], [ 129 ], [ 130 ], [ 131 ], [ 132 ], [ 133 ], [ 134 ], [ 135 ], [ 136, 137 ], [ 138 ] ]
25,409
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]); } }
true
FFmpeg
e3496e5dbe277e056800ebe7740ac6467d35d5cb
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; 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; score += 10 * av_get_channel_layout_nb_channels(cmp1) - 2; } } 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]); } }
{ "code": [ " int best_idx, best_score = INT_MIN, best_count_diff = INT_MAX;" ], "line_no": [ 35 ] }
static void FUNC_0(AVFilterContext *VAR_0) { AVFilterLink *link = NULL; int VAR_1, VAR_2, VAR_3; for (VAR_1 = 0; VAR_1 < VAR_0->nb_inputs; VAR_1++) { link = VAR_0->inputs[VAR_1]; if (link->type == AVMEDIA_TYPE_AUDIO && link->out_channel_layouts->nb_channel_layouts == 1) break; } if (VAR_1 == VAR_0->nb_inputs) return; for (VAR_1 = 0; VAR_1 < VAR_0->nb_outputs; VAR_1++) { AVFilterLink *outlink = VAR_0->outputs[VAR_1]; 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 (VAR_2 = 0; VAR_2 < outlink->in_channel_layouts->nb_channel_layouts; VAR_2++) { uint64_t in_chlayout = link->out_channel_layouts->channel_layouts[0]; uint64_t out_chlayout = outlink->in_channel_layouts->channel_layouts[VAR_2]; 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; for (VAR_3 = 0; VAR_3 < FF_ARRAY_ELEMS(ch_subst); VAR_3++) { uint64_t cmp0 = ch_subst[VAR_3][0]; uint64_t cmp1 = ch_subst[VAR_3][1]; if (( in_chlayout & cmp0) && (!(out_chlayout & cmp0)) && (out_chlayout & cmp1) && (!( in_chlayout & cmp1))) { in_chlayout &= ~cmp0; out_chlayout &= ~cmp1; score += 10 * av_get_channel_layout_nb_channels(cmp1) - 2; } } 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 = VAR_2; best_count_diff = count_diff; } } FFSWAP(uint64_t, outlink->in_channel_layouts->channel_layouts[0], outlink->in_channel_layouts->channel_layouts[best_idx]); } }
[ "static void FUNC_0(AVFilterContext *VAR_0)\n{", "AVFilterLink *link = NULL;", "int VAR_1, VAR_2, VAR_3;", "for (VAR_1 = 0; VAR_1 < VAR_0->nb_inputs; VAR_1++) {", "link = VAR_0->inputs[VAR_1];", "if (link->type == AVMEDIA_TYPE_AUDIO &&\nlink->out_channel_layouts->nb_channel_layouts == 1)\nbreak;", "}", "if (VAR_1 == VAR_0->nb_inputs)\nreturn;", "for (VAR_1 = 0; VAR_1 < VAR_0->nb_outputs; VAR_1++) {", "AVFilterLink *outlink = VAR_0->outputs[VAR_1];", "int best_idx, best_score = INT_MIN, best_count_diff = INT_MAX;", "if (outlink->type != AVMEDIA_TYPE_AUDIO ||\noutlink->in_channel_layouts->nb_channel_layouts < 2)\ncontinue;", "for (VAR_2 = 0; VAR_2 < outlink->in_channel_layouts->nb_channel_layouts; VAR_2++) {", "uint64_t in_chlayout = link->out_channel_layouts->channel_layouts[0];", "uint64_t out_chlayout = outlink->in_channel_layouts->channel_layouts[VAR_2];", "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;", "for (VAR_3 = 0; VAR_3 < FF_ARRAY_ELEMS(ch_subst); VAR_3++) {", "uint64_t cmp0 = ch_subst[VAR_3][0];", "uint64_t cmp1 = ch_subst[VAR_3][1];", "if (( in_chlayout & cmp0) && (!(out_chlayout & cmp0)) &&\n(out_chlayout & cmp1) && (!( in_chlayout & cmp1))) {", "in_chlayout &= ~cmp0;", "out_chlayout &= ~cmp1;", "score += 10 * av_get_channel_layout_nb_channels(cmp1) - 2;", "}", "}", "if ( (in_chlayout & AV_CH_LOW_FREQUENCY) &&\n(out_chlayout & AV_CH_LOW_FREQUENCY))\nscore += 10;", "in_chlayout &= ~AV_CH_LOW_FREQUENCY;", "out_chlayout &= ~AV_CH_LOW_FREQUENCY;", "matched_channels = av_get_channel_layout_nb_channels(in_chlayout &\nout_chlayout);", "extra_channels = av_get_channel_layout_nb_channels(out_chlayout &\n(~in_chlayout));", "score += 10 * matched_channels - 5 * extra_channels;", "if (score > best_score ||\n(count_diff < best_count_diff && score == best_score)) {", "best_score = score;", "best_idx = VAR_2;", "best_count_diff = count_diff;", "}", "}", "FFSWAP(uint64_t, outlink->in_channel_layouts->channel_layouts[0],\noutlink->in_channel_layouts->channel_layouts[best_idx]);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17, 19, 21 ], [ 23 ], [ 25, 27 ], [ 31 ], [ 33 ], [ 35 ], [ 39, 41, 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 85 ], [ 87 ], [ 89 ], [ 95, 97, 99 ], [ 101 ], [ 103 ], [ 107, 109 ], [ 111, 113 ], [ 115 ], [ 119, 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 141 ] ]
25,410
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; }
false
FFmpeg
5e53486545726987ab4482321d4dcf7e23e7652f
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) { 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) { ce->convert(dst, src, dst_width, dst_height); return 0; } 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); } 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; } 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; } 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); 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); 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: 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 (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: if (src_pix_fmt == PIX_FMT_YUYV422 || dst_pix_fmt == PIX_FMT_YUYV422) { int_pix_fmt = PIX_FMT_YUV422P; } else if (src_pix_fmt == PIX_FMT_UYVY422 || dst_pix_fmt == PIX_FMT_UYVY422) { int_pix_fmt = PIX_FMT_YUV422P; } else if (src_pix_fmt == PIX_FMT_UYYVYY411 || dst_pix_fmt == PIX_FMT_UYYVYY411) { 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)) { 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)) { 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)) { if (dst_pix->color_type == FF_COLOR_YUV_JPEG) int_pix_fmt = PIX_FMT_YUVJ444P; else int_pix_fmt = PIX_FMT_YUV444P; } else { 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; }
{ "code": [], "line_no": [] }
int FUNC_0(AVPicture *VAR_21, int VAR_1, const AVPicture *VAR_22, int VAR_3, int VAR_4, int VAR_5) { static int VAR_6; int VAR_7, VAR_8, VAR_9, VAR_10, VAR_11; const PixFmtInfo *VAR_12, *dst_pix; const ConvertEntry *VAR_13; AVPicture tmp1, *tmp = &tmp1; if (VAR_3 < 0 || VAR_3 >= PIX_FMT_NB || VAR_1 < 0 || VAR_1 >= PIX_FMT_NB) return -1; if (VAR_4 <= 0 || VAR_5 <= 0) return 0; if (!VAR_6) { VAR_6 = 1; img_convert_init(); } VAR_9 = VAR_4; VAR_10 = VAR_5; dst_pix = &pix_fmt_info[VAR_1]; VAR_12 = &pix_fmt_info[VAR_3]; if (VAR_3 == VAR_1) { av_picture_copy(VAR_21, VAR_22, VAR_1, VAR_9, VAR_10); return 0; } VAR_13 = &convert_table[VAR_3][VAR_1]; if (VAR_13->convert) { VAR_13->convert(VAR_21, VAR_22, VAR_9, VAR_10); return 0; } if (is_yuv_planar(dst_pix) && VAR_3 == PIX_FMT_GRAY8) { int VAR_19, VAR_19, VAR_16; uint8_t *d; if (dst_pix->color_type == FF_COLOR_YUV_JPEG) { ff_img_copy_plane(VAR_21->data[0], VAR_21->linesize[0], VAR_22->data[0], VAR_22->linesize[0], VAR_9, VAR_10); } else { img_apply_table(VAR_21->data[0], VAR_21->linesize[0], VAR_22->data[0], VAR_22->linesize[0], VAR_9, VAR_10, y_jpeg_to_ccir); } VAR_19 = VAR_9; VAR_19 = VAR_10; VAR_19 >>= dst_pix->x_chroma_shift; VAR_19 >>= dst_pix->y_chroma_shift; for(VAR_7 = 1; VAR_7 <= 2; VAR_7++) { d = VAR_21->data[VAR_7]; for(VAR_16 = 0; VAR_16< VAR_19; VAR_16++) { memset(d, 128, VAR_19); d += VAR_21->linesize[VAR_7]; } } return 0; } if (is_yuv_planar(VAR_12) && VAR_1 == PIX_FMT_GRAY8) { if (VAR_12->color_type == FF_COLOR_YUV_JPEG) { ff_img_copy_plane(VAR_21->data[0], VAR_21->linesize[0], VAR_22->data[0], VAR_22->linesize[0], VAR_9, VAR_10); } else { img_apply_table(VAR_21->data[0], VAR_21->linesize[0], VAR_22->data[0], VAR_22->linesize[0], VAR_9, VAR_10, y_ccir_to_jpeg); } return 0; } if (is_yuv_planar(dst_pix) && is_yuv_planar(VAR_12)) { int VAR_17, VAR_18, VAR_19, VAR_19, VAR_19; void (*VAR_20)(uint8_t *VAR_21, int VAR_21, const uint8_t *VAR_22, int VAR_22, int VAR_23, int VAR_24); VAR_19 = VAR_9; VAR_19 = VAR_10; if (dst_pix->x_chroma_shift >= VAR_12->x_chroma_shift) VAR_19 >>= dst_pix->x_chroma_shift; else VAR_19 >>= VAR_12->x_chroma_shift; if (dst_pix->y_chroma_shift >= VAR_12->y_chroma_shift) VAR_19 >>= dst_pix->y_chroma_shift; else VAR_19 >>= VAR_12->y_chroma_shift; VAR_17 = (dst_pix->x_chroma_shift - VAR_12->x_chroma_shift); VAR_18 = (dst_pix->y_chroma_shift - VAR_12->y_chroma_shift); VAR_19 = ((VAR_17 & 0xf) << 4) | (VAR_18 & 0xf); switch(VAR_19) { case 0x00: VAR_20 = ff_img_copy_plane; break; case 0x10: VAR_20 = shrink21; break; case 0x20: VAR_20 = shrink41; break; case 0x01: VAR_20 = shrink12; break; case 0x11: VAR_20 = ff_shrink22; break; case 0x22: VAR_20 = ff_shrink44; break; case 0xf0: VAR_20 = grow21; break; case 0x0f: VAR_20 = grow12; break; case 0xe0: VAR_20 = grow41; break; case 0xff: VAR_20 = grow22; break; case 0xee: VAR_20 = grow44; break; case 0xf1: VAR_20 = conv411; break; default: goto no_chroma_filter; } ff_img_copy_plane(VAR_21->data[0], VAR_21->linesize[0], VAR_22->data[0], VAR_22->linesize[0], VAR_9, VAR_10); for(VAR_7 = 1;VAR_7 <= 2; VAR_7++) VAR_20(VAR_21->data[VAR_7], VAR_21->linesize[VAR_7], VAR_22->data[VAR_7], VAR_22->linesize[VAR_7], VAR_9>>dst_pix->x_chroma_shift, VAR_10>>dst_pix->y_chroma_shift); if (dst_pix->color_type != VAR_12->color_type) { const uint8_t *VAR_25, *c_table; if (dst_pix->color_type == FF_COLOR_YUV) { VAR_25 = y_jpeg_to_ccir; c_table = c_jpeg_to_ccir; } else { VAR_25 = y_ccir_to_jpeg; c_table = c_ccir_to_jpeg; } img_apply_table(VAR_21->data[0], VAR_21->linesize[0], VAR_21->data[0], VAR_21->linesize[0], VAR_9, VAR_10, VAR_25); for(VAR_7 = 1;VAR_7 <= 2; VAR_7++) img_apply_table(VAR_21->data[VAR_7], VAR_21->linesize[VAR_7], VAR_21->data[VAR_7], VAR_21->linesize[VAR_7], VAR_9>>dst_pix->x_chroma_shift, VAR_10>>dst_pix->y_chroma_shift, c_table); } return 0; } no_chroma_filter: if (VAR_3 == PIX_FMT_YUYV422 || VAR_1 == PIX_FMT_YUYV422) { VAR_11 = PIX_FMT_YUV422P; } else if (VAR_3 == PIX_FMT_UYVY422 || VAR_1 == PIX_FMT_UYVY422) { VAR_11 = PIX_FMT_YUV422P; } else if (VAR_3 == PIX_FMT_UYYVYY411 || VAR_1 == PIX_FMT_UYYVYY411) { VAR_11 = PIX_FMT_YUV411P; } else if ((VAR_12->color_type == FF_COLOR_GRAY && VAR_3 != PIX_FMT_GRAY8) || (dst_pix->color_type == FF_COLOR_GRAY && VAR_1 != PIX_FMT_GRAY8)) { VAR_11 = PIX_FMT_GRAY8; } else if ((is_yuv_planar(VAR_12) && VAR_3 != PIX_FMT_YUV444P && VAR_3 != PIX_FMT_YUVJ444P)) { if (VAR_12->color_type == FF_COLOR_YUV_JPEG) VAR_11 = PIX_FMT_YUVJ444P; else VAR_11 = PIX_FMT_YUV444P; } else if ((is_yuv_planar(dst_pix) && VAR_1 != PIX_FMT_YUV444P && VAR_1 != PIX_FMT_YUVJ444P)) { if (dst_pix->color_type == FF_COLOR_YUV_JPEG) VAR_11 = PIX_FMT_YUVJ444P; else VAR_11 = PIX_FMT_YUV444P; } else { if (VAR_12->is_alpha && dst_pix->is_alpha) VAR_11 = PIX_FMT_RGB32; else VAR_11 = PIX_FMT_RGB24; } if (VAR_3 == VAR_11) return -1; if (avpicture_alloc(tmp, VAR_11, VAR_9, VAR_10) < 0) return -1; VAR_8 = -1; if (FUNC_0(tmp, VAR_11, VAR_22, VAR_3, VAR_4, VAR_5) < 0) goto fail1; if (FUNC_0(VAR_21, VAR_1, tmp, VAR_11, VAR_9, VAR_10) < 0) goto fail1; VAR_8 = 0; fail1: avpicture_free(tmp); return VAR_8; }
[ "int FUNC_0(AVPicture *VAR_21, int VAR_1,\nconst AVPicture *VAR_22, int VAR_3,\nint VAR_4, int VAR_5)\n{", "static int VAR_6;", "int VAR_7, VAR_8, VAR_9, VAR_10, VAR_11;", "const PixFmtInfo *VAR_12, *dst_pix;", "const ConvertEntry *VAR_13;", "AVPicture tmp1, *tmp = &tmp1;", "if (VAR_3 < 0 || VAR_3 >= PIX_FMT_NB ||\nVAR_1 < 0 || VAR_1 >= PIX_FMT_NB)\nreturn -1;", "if (VAR_4 <= 0 || VAR_5 <= 0)\nreturn 0;", "if (!VAR_6) {", "VAR_6 = 1;", "img_convert_init();", "}", "VAR_9 = VAR_4;", "VAR_10 = VAR_5;", "dst_pix = &pix_fmt_info[VAR_1];", "VAR_12 = &pix_fmt_info[VAR_3];", "if (VAR_3 == VAR_1) {", "av_picture_copy(VAR_21, VAR_22, VAR_1, VAR_9, VAR_10);", "return 0;", "}", "VAR_13 = &convert_table[VAR_3][VAR_1];", "if (VAR_13->convert) {", "VAR_13->convert(VAR_21, VAR_22, VAR_9, VAR_10);", "return 0;", "}", "if (is_yuv_planar(dst_pix) &&\nVAR_3 == PIX_FMT_GRAY8) {", "int VAR_19, VAR_19, VAR_16;", "uint8_t *d;", "if (dst_pix->color_type == FF_COLOR_YUV_JPEG) {", "ff_img_copy_plane(VAR_21->data[0], VAR_21->linesize[0],\nVAR_22->data[0], VAR_22->linesize[0],\nVAR_9, VAR_10);", "} else {", "img_apply_table(VAR_21->data[0], VAR_21->linesize[0],\nVAR_22->data[0], VAR_22->linesize[0],\nVAR_9, VAR_10,\ny_jpeg_to_ccir);", "}", "VAR_19 = VAR_9;", "VAR_19 = VAR_10;", "VAR_19 >>= dst_pix->x_chroma_shift;", "VAR_19 >>= dst_pix->y_chroma_shift;", "for(VAR_7 = 1; VAR_7 <= 2; VAR_7++) {", "d = VAR_21->data[VAR_7];", "for(VAR_16 = 0; VAR_16< VAR_19; VAR_16++) {", "memset(d, 128, VAR_19);", "d += VAR_21->linesize[VAR_7];", "}", "}", "return 0;", "}", "if (is_yuv_planar(VAR_12) &&\nVAR_1 == PIX_FMT_GRAY8) {", "if (VAR_12->color_type == FF_COLOR_YUV_JPEG) {", "ff_img_copy_plane(VAR_21->data[0], VAR_21->linesize[0],\nVAR_22->data[0], VAR_22->linesize[0],\nVAR_9, VAR_10);", "} else {", "img_apply_table(VAR_21->data[0], VAR_21->linesize[0],\nVAR_22->data[0], VAR_22->linesize[0],\nVAR_9, VAR_10,\ny_ccir_to_jpeg);", "}", "return 0;", "}", "if (is_yuv_planar(dst_pix) && is_yuv_planar(VAR_12)) {", "int VAR_17, VAR_18, VAR_19, VAR_19, VAR_19;", "void (*VAR_20)(uint8_t *VAR_21, int VAR_21,\nconst uint8_t *VAR_22, int VAR_22,\nint VAR_23, int VAR_24);", "VAR_19 = VAR_9;", "VAR_19 = VAR_10;", "if (dst_pix->x_chroma_shift >= VAR_12->x_chroma_shift)\nVAR_19 >>= dst_pix->x_chroma_shift;", "else\nVAR_19 >>= VAR_12->x_chroma_shift;", "if (dst_pix->y_chroma_shift >= VAR_12->y_chroma_shift)\nVAR_19 >>= dst_pix->y_chroma_shift;", "else\nVAR_19 >>= VAR_12->y_chroma_shift;", "VAR_17 = (dst_pix->x_chroma_shift - VAR_12->x_chroma_shift);", "VAR_18 = (dst_pix->y_chroma_shift - VAR_12->y_chroma_shift);", "VAR_19 = ((VAR_17 & 0xf) << 4) | (VAR_18 & 0xf);", "switch(VAR_19) {", "case 0x00:\nVAR_20 = ff_img_copy_plane;", "break;", "case 0x10:\nVAR_20 = shrink21;", "break;", "case 0x20:\nVAR_20 = shrink41;", "break;", "case 0x01:\nVAR_20 = shrink12;", "break;", "case 0x11:\nVAR_20 = ff_shrink22;", "break;", "case 0x22:\nVAR_20 = ff_shrink44;", "break;", "case 0xf0:\nVAR_20 = grow21;", "break;", "case 0x0f:\nVAR_20 = grow12;", "break;", "case 0xe0:\nVAR_20 = grow41;", "break;", "case 0xff:\nVAR_20 = grow22;", "break;", "case 0xee:\nVAR_20 = grow44;", "break;", "case 0xf1:\nVAR_20 = conv411;", "break;", "default:\ngoto no_chroma_filter;", "}", "ff_img_copy_plane(VAR_21->data[0], VAR_21->linesize[0],\nVAR_22->data[0], VAR_22->linesize[0],\nVAR_9, VAR_10);", "for(VAR_7 = 1;VAR_7 <= 2; VAR_7++)", "VAR_20(VAR_21->data[VAR_7], VAR_21->linesize[VAR_7],\nVAR_22->data[VAR_7], VAR_22->linesize[VAR_7],\nVAR_9>>dst_pix->x_chroma_shift, VAR_10>>dst_pix->y_chroma_shift);", "if (dst_pix->color_type != VAR_12->color_type) {", "const uint8_t *VAR_25, *c_table;", "if (dst_pix->color_type == FF_COLOR_YUV) {", "VAR_25 = y_jpeg_to_ccir;", "c_table = c_jpeg_to_ccir;", "} else {", "VAR_25 = y_ccir_to_jpeg;", "c_table = c_ccir_to_jpeg;", "}", "img_apply_table(VAR_21->data[0], VAR_21->linesize[0],\nVAR_21->data[0], VAR_21->linesize[0],\nVAR_9, VAR_10,\nVAR_25);", "for(VAR_7 = 1;VAR_7 <= 2; VAR_7++)", "img_apply_table(VAR_21->data[VAR_7], VAR_21->linesize[VAR_7],\nVAR_21->data[VAR_7], VAR_21->linesize[VAR_7],\nVAR_9>>dst_pix->x_chroma_shift,\nVAR_10>>dst_pix->y_chroma_shift,\nc_table);", "}", "return 0;", "}", "no_chroma_filter:\nif (VAR_3 == PIX_FMT_YUYV422 ||\nVAR_1 == PIX_FMT_YUYV422) {", "VAR_11 = PIX_FMT_YUV422P;", "} else if (VAR_3 == PIX_FMT_UYVY422 ||", "VAR_1 == PIX_FMT_UYVY422) {", "VAR_11 = PIX_FMT_YUV422P;", "} else if (VAR_3 == PIX_FMT_UYYVYY411 ||", "VAR_1 == PIX_FMT_UYYVYY411) {", "VAR_11 = PIX_FMT_YUV411P;", "} else if ((VAR_12->color_type == FF_COLOR_GRAY &&", "VAR_3 != PIX_FMT_GRAY8) ||\n(dst_pix->color_type == FF_COLOR_GRAY &&\nVAR_1 != PIX_FMT_GRAY8)) {", "VAR_11 = PIX_FMT_GRAY8;", "} else if ((is_yuv_planar(VAR_12) &&", "VAR_3 != PIX_FMT_YUV444P &&\nVAR_3 != PIX_FMT_YUVJ444P)) {", "if (VAR_12->color_type == FF_COLOR_YUV_JPEG)\nVAR_11 = PIX_FMT_YUVJ444P;", "else\nVAR_11 = PIX_FMT_YUV444P;", "} else if ((is_yuv_planar(dst_pix) &&", "VAR_1 != PIX_FMT_YUV444P &&\nVAR_1 != PIX_FMT_YUVJ444P)) {", "if (dst_pix->color_type == FF_COLOR_YUV_JPEG)\nVAR_11 = PIX_FMT_YUVJ444P;", "else\nVAR_11 = PIX_FMT_YUV444P;", "} else {", "if (VAR_12->is_alpha && dst_pix->is_alpha)\nVAR_11 = PIX_FMT_RGB32;", "else\nVAR_11 = PIX_FMT_RGB24;", "}", "if (VAR_3 == VAR_11)\nreturn -1;", "if (avpicture_alloc(tmp, VAR_11, VAR_9, VAR_10) < 0)\nreturn -1;", "VAR_8 = -1;", "if (FUNC_0(tmp, VAR_11,\nVAR_22, VAR_3, VAR_4, VAR_5) < 0)\ngoto fail1;", "if (FUNC_0(VAR_21, VAR_1,\ntmp, VAR_11, VAR_9, VAR_10) < 0)\ngoto fail1;", "VAR_8 = 0;", "fail1:\navpicture_free(tmp);", "return VAR_8;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23, 25 ], [ 27, 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93, 95, 97 ], [ 99 ], [ 101, 103, 105, 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 143, 145 ], [ 147 ], [ 149, 151, 153 ], [ 155 ], [ 157, 159, 161, 163 ], [ 165 ], [ 167 ], [ 169 ], [ 175 ], [ 177 ], [ 179, 181, 183 ], [ 189 ], [ 191 ], [ 193, 195 ], [ 197, 199 ], [ 201, 203 ], [ 205, 207 ], [ 211 ], [ 213 ], [ 215 ], [ 221 ], [ 223, 225 ], [ 227 ], [ 229, 231 ], [ 233 ], [ 235, 237 ], [ 239 ], [ 241, 243 ], [ 245 ], [ 247, 249 ], [ 251 ], [ 253, 255 ], [ 257 ], [ 259, 261 ], [ 263 ], [ 265, 267 ], [ 269 ], [ 271, 273 ], [ 275 ], [ 277, 279 ], [ 281 ], [ 283, 285 ], [ 287 ], [ 289, 291 ], [ 293 ], [ 295, 299 ], [ 301 ], [ 305, 307, 309 ], [ 313 ], [ 315, 317, 319 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343, 345, 347, 349 ], [ 353 ], [ 355, 357, 359, 361, 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371, 377, 379 ], [ 383 ], [ 385 ], [ 387 ], [ 391 ], [ 393 ], [ 395 ], [ 399 ], [ 401 ], [ 403, 405, 407 ], [ 411 ], [ 413 ], [ 415, 417 ], [ 421, 423 ], [ 425, 427 ], [ 429 ], [ 431, 433 ], [ 437, 439 ], [ 441, 443 ], [ 445 ], [ 449, 451 ], [ 453, 455 ], [ 457 ], [ 459, 461 ], [ 463, 465 ], [ 467 ], [ 469, 471, 473 ], [ 475, 477, 479 ], [ 481 ], [ 483, 485 ], [ 487 ], [ 489 ] ]
25,411
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); } }
true
FFmpeg
c82bf15dca00f67a701d126e47ea9075fc9459cb
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; if (len <= rtp_ctx->max_payload_size) { int buffered_size = rtp_ctx->buf_ptr - rtp_ctx->buf; if (buffered_size + 2 + len > rtp_ctx->max_payload_size) { flush_buffered(ctx, 0); buffered_size = 0; } 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); rtp_ctx->buf[0] = 49 << 1; rtp_ctx->buf[1] = 1; rtp_ctx->buf[2] = nal_type; rtp_ctx->buf[2] |= 1 << 7; buf += 2; len -= 2; while (len > rtp_payload_size) { 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; rtp_ctx->buf[2] &= ~(1 << 7); } rtp_ctx->buf[2] |= 1 << 6; memcpy(&rtp_ctx->buf[RTP_HEVC_HEADERS_SIZE], buf, len); ff_rtp_send_data(ctx, rtp_ctx->buf, len + 2, last_packet_of_frame); } }
{ "code": [ " buffered_size = 0;", " } else {", " } else {", " } else {", "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;", " if (len <= rtp_ctx->max_payload_size) {", " int buffered_size = rtp_ctx->buf_ptr - rtp_ctx->buf;", " if (buffered_size + 2 + len > rtp_ctx->max_payload_size) {", " flush_buffered(ctx, 0);", " buffered_size = 0;", " 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);", " rtp_ctx->buf[0] = 49 << 1;", " rtp_ctx->buf[1] = 1;", " rtp_ctx->buf[2] = nal_type;", " rtp_ctx->buf[2] |= 1 << 7;", " buf += 2;", " len -= 2;", " while (len > rtp_payload_size) {", " 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;", " rtp_ctx->buf[2] &= ~(1 << 7);", " rtp_ctx->buf[2] |= 1 << 6;", " memcpy(&rtp_ctx->buf[RTP_HEVC_HEADERS_SIZE], buf, len);", " ff_rtp_send_data(ctx, rtp_ctx->buf, len + 2, last_packet_of_frame);", " RTPMuxContext *rtp_ctx = ctx->priv_data;", " } else {" ], "line_no": [ 25, 55, 63, 55, 1, 5, 7, 9, 15, 17, 21, 23, 25, 35, 37, 39, 41, 45, 47, 49, 51, 53, 55, 23, 59, 63, 65, 95, 97, 125, 129, 135, 137, 141, 145, 147, 151, 153, 159, 167, 173, 175, 5, 55 ] }
static void FUNC_0(AVFormatContext *VAR_0, const uint8_t *VAR_1, int VAR_2, int VAR_3) { RTPMuxContext *rtp_ctx = VAR_0->priv_data; int VAR_4 = rtp_ctx->max_payload_size - RTP_HEVC_HEADERS_SIZE; int VAR_5 = (VAR_1[0] >> 1) & 0x3F; if (VAR_2 <= rtp_ctx->max_payload_size) { int VAR_6 = rtp_ctx->buf_ptr - rtp_ctx->VAR_1; if (VAR_6 + 2 + VAR_2 > rtp_ctx->max_payload_size) { flush_buffered(VAR_0, 0); VAR_6 = 0; } if (VAR_6 + 4 + VAR_2 <= rtp_ctx->max_payload_size) { if (VAR_6 == 0) { *rtp_ctx->buf_ptr++ = 48 << 1; *rtp_ctx->buf_ptr++ = 1; } AV_WB16(rtp_ctx->buf_ptr, VAR_2); rtp_ctx->buf_ptr += 2; memcpy(rtp_ctx->buf_ptr, VAR_1, VAR_2); rtp_ctx->buf_ptr += VAR_2; rtp_ctx->buffered_nals++; } else { flush_buffered(VAR_0, 0); ff_rtp_send_data(VAR_0, VAR_1, VAR_2, VAR_3); } } else { flush_buffered(VAR_0, 0); rtp_ctx->VAR_1[0] = 49 << 1; rtp_ctx->VAR_1[1] = 1; rtp_ctx->VAR_1[2] = VAR_5; rtp_ctx->VAR_1[2] |= 1 << 7; VAR_1 += 2; VAR_2 -= 2; while (VAR_2 > VAR_4) { memcpy(&rtp_ctx->VAR_1[RTP_HEVC_HEADERS_SIZE], VAR_1, VAR_4); ff_rtp_send_data(VAR_0, rtp_ctx->VAR_1, rtp_ctx->max_payload_size, 0); VAR_1 += VAR_4; VAR_2 -= VAR_4; rtp_ctx->VAR_1[2] &= ~(1 << 7); } rtp_ctx->VAR_1[2] |= 1 << 6; memcpy(&rtp_ctx->VAR_1[RTP_HEVC_HEADERS_SIZE], VAR_1, VAR_2); ff_rtp_send_data(VAR_0, rtp_ctx->VAR_1, VAR_2 + 2, VAR_3); } }
[ "static void FUNC_0(AVFormatContext *VAR_0, const uint8_t *VAR_1, int VAR_2, int VAR_3)\n{", "RTPMuxContext *rtp_ctx = VAR_0->priv_data;", "int VAR_4 = rtp_ctx->max_payload_size - RTP_HEVC_HEADERS_SIZE;", "int VAR_5 = (VAR_1[0] >> 1) & 0x3F;", "if (VAR_2 <= rtp_ctx->max_payload_size) {", "int VAR_6 = rtp_ctx->buf_ptr - rtp_ctx->VAR_1;", "if (VAR_6 + 2 + VAR_2 > rtp_ctx->max_payload_size) {", "flush_buffered(VAR_0, 0);", "VAR_6 = 0;", "}", "if (VAR_6 + 4 + VAR_2 <= rtp_ctx->max_payload_size) {", "if (VAR_6 == 0) {", "*rtp_ctx->buf_ptr++ = 48 << 1;", "*rtp_ctx->buf_ptr++ = 1;", "}", "AV_WB16(rtp_ctx->buf_ptr, VAR_2);", "rtp_ctx->buf_ptr += 2;", "memcpy(rtp_ctx->buf_ptr, VAR_1, VAR_2);", "rtp_ctx->buf_ptr += VAR_2;", "rtp_ctx->buffered_nals++;", "} else {", "flush_buffered(VAR_0, 0);", "ff_rtp_send_data(VAR_0, VAR_1, VAR_2, VAR_3);", "}", "} else {", "flush_buffered(VAR_0, 0);", "rtp_ctx->VAR_1[0] = 49 << 1;", "rtp_ctx->VAR_1[1] = 1;", "rtp_ctx->VAR_1[2] = VAR_5;", "rtp_ctx->VAR_1[2] |= 1 << 7;", "VAR_1 += 2;", "VAR_2 -= 2;", "while (VAR_2 > VAR_4) {", "memcpy(&rtp_ctx->VAR_1[RTP_HEVC_HEADERS_SIZE], VAR_1, VAR_4);", "ff_rtp_send_data(VAR_0, rtp_ctx->VAR_1, rtp_ctx->max_payload_size, 0);", "VAR_1 += VAR_4;", "VAR_2 -= VAR_4;", "rtp_ctx->VAR_1[2] &= ~(1 << 7);", "}", "rtp_ctx->VAR_1[2] |= 1 << 6;", "memcpy(&rtp_ctx->VAR_1[RTP_HEVC_HEADERS_SIZE], VAR_1, VAR_2);", "ff_rtp_send_data(VAR_0, rtp_ctx->VAR_1, VAR_2 + 2, VAR_3);", "}", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 95 ], [ 97 ], [ 125 ], [ 129 ], [ 135 ], [ 137 ], [ 141 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ], [ 159 ], [ 161 ], [ 167 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ] ]
25,412
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); }
true
FFmpeg
c763f86728f1ae8c64794dc1a2451777539e382d
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; 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; 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; } } } 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); }
{ "code": [ " n_bands = n_subbands;" ], "line_no": [ 53 ] }
static void FUNC_0(GetBitContext *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5, const uint8_t *VAR_6, uint8_t *VAR_7, int *VAR_8, int *VAR_9, int *VAR_10) { int VAR_11, VAR_12, VAR_13, VAR_14, VAR_15[22]; VAR_13 = VAR_5 - VAR_4; if (!VAR_2 || get_bits1(VAR_0)) { for (VAR_11 = 0; VAR_11 < VAR_13 - 1; VAR_11++) { VAR_7[VAR_11] = get_bits1(VAR_0); } } else if (!VAR_1) { memcpy(VAR_7, &VAR_6[VAR_4+1], VAR_13-1); } VAR_7[VAR_13-1] = 0; if (VAR_9 || VAR_10 ) { VAR_14 = VAR_13; VAR_15[0] = VAR_3 ? 6 : 12; for (VAR_12 = 0, VAR_11 = 1; VAR_11 < VAR_13; VAR_11++) { int VAR_16 = (VAR_3 && VAR_11 < 4) ? 6 : 12; if (VAR_7[VAR_11-1]) { VAR_14--; VAR_15[VAR_12] += VAR_16; } else { VAR_15[++VAR_12] = VAR_16; } } } if (VAR_8) *VAR_8 = VAR_13; if (VAR_9) *VAR_9 = VAR_14; if (VAR_10) memcpy(VAR_10, VAR_15, sizeof(int)*VAR_14); }
[ "static void FUNC_0(GetBitContext *VAR_0, int VAR_1, int VAR_2,\nint VAR_3, int VAR_4, int VAR_5,\nconst uint8_t *VAR_6,\nuint8_t *VAR_7, int *VAR_8,\nint *VAR_9, int *VAR_10)\n{", "int VAR_11, VAR_12, VAR_13, VAR_14, VAR_15[22];", "VAR_13 = VAR_5 - VAR_4;", "if (!VAR_2 || get_bits1(VAR_0)) {", "for (VAR_11 = 0; VAR_11 < VAR_13 - 1; VAR_11++) {", "VAR_7[VAR_11] = get_bits1(VAR_0);", "}", "} else if (!VAR_1) {", "memcpy(VAR_7,\n&VAR_6[VAR_4+1],\nVAR_13-1);", "}", "VAR_7[VAR_13-1] = 0;", "if (VAR_9 || VAR_10 ) {", "VAR_14 = VAR_13;", "VAR_15[0] = VAR_3 ? 6 : 12;", "for (VAR_12 = 0, VAR_11 = 1; VAR_11 < VAR_13; VAR_11++) {", "int VAR_16 = (VAR_3 && VAR_11 < 4) ? 6 : 12;", "if (VAR_7[VAR_11-1]) {", "VAR_14--;", "VAR_15[VAR_12] += VAR_16;", "} else {", "VAR_15[++VAR_12] = VAR_16;", "}", "}", "}", "if (VAR_8)\n*VAR_8 = VAR_13;", "if (VAR_9)\n*VAR_9 = VAR_14;", "if (VAR_10)\nmemcpy(VAR_10, VAR_15, sizeof(int)*VAR_14);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 17 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35, 37 ], [ 39 ], [ 41 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 81, 83 ], [ 85, 87 ], [ 89, 91 ], [ 93 ] ]
25,415
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; }
true
FFmpeg
073c2593c9f0aa4445a6fc1b9b24e6e52a8cc2c1
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; }
{ "code": [ " init_vlc(vlc, 9, n, table_bits, 1, 1, table_codes, 4, 4);" ], "line_no": [ 25 ] }
static void FUNC_0(VLC *VAR_0, uint16_t **VAR_1, uint16_t **VAR_2, const CoefVLCTable *VAR_3) { int VAR_4 = VAR_3->VAR_4; const uint8_t *VAR_5 = VAR_3->huffbits; const uint32_t *VAR_6 = VAR_3->huffcodes; const uint16_t *VAR_7 = VAR_3->levels; uint16_t *run_table, *level_table; const uint16_t *VAR_8; int VAR_9, VAR_10, VAR_11, VAR_12; init_vlc(VAR_0, 9, VAR_4, VAR_5, 1, 1, VAR_6, 4, 4); run_table = av_malloc(VAR_4 * sizeof(uint16_t)); level_table = av_malloc(VAR_4 * sizeof(uint16_t)); VAR_8 = VAR_7; VAR_9 = 2; VAR_12 = 1; while (VAR_9 < VAR_4) { VAR_10 = *VAR_8++; for(VAR_11=0;VAR_11<VAR_10;VAR_11++) { run_table[VAR_9] = VAR_11; level_table[VAR_9] = VAR_12; VAR_9++; } VAR_12++; } *VAR_1 = run_table; *VAR_2 = level_table; }
[ "static void FUNC_0(VLC *VAR_0,\nuint16_t **VAR_1, uint16_t **VAR_2,\nconst CoefVLCTable *VAR_3)\n{", "int VAR_4 = VAR_3->VAR_4;", "const uint8_t *VAR_5 = VAR_3->huffbits;", "const uint32_t *VAR_6 = VAR_3->huffcodes;", "const uint16_t *VAR_7 = VAR_3->levels;", "uint16_t *run_table, *level_table;", "const uint16_t *VAR_8;", "int VAR_9, VAR_10, VAR_11, VAR_12;", "init_vlc(VAR_0, 9, VAR_4, VAR_5, 1, 1, VAR_6, 4, 4);", "run_table = av_malloc(VAR_4 * sizeof(uint16_t));", "level_table = av_malloc(VAR_4 * sizeof(uint16_t));", "VAR_8 = VAR_7;", "VAR_9 = 2;", "VAR_12 = 1;", "while (VAR_9 < VAR_4) {", "VAR_10 = *VAR_8++;", "for(VAR_11=0;VAR_11<VAR_10;VAR_11++) {", "run_table[VAR_9] = VAR_11;", "level_table[VAR_9] = VAR_12;", "VAR_9++;", "}", "VAR_12++;", "}", "*VAR_1 = run_table;", "*VAR_2 = level_table;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ] ]
25,416
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; }
false
FFmpeg
aaae59700f7fc10fd80cb93b38c5d109900872d9
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; n = avs->curr_frame++; if (discard) return 0; #ifdef USING_AVISYNTH 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 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 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; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1, int VAR_2) { AviSynthContext *avs = VAR_0->priv_data; AVS_VideoFrame *frame; unsigned char *VAR_3; const unsigned char *VAR_4; int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11; const char *VAR_12; if (avs->curr_frame >= avs->vi->num_frames) return AVERROR_EOF; VAR_5 = avs->curr_frame++; if (VAR_2) return 0; #ifdef USING_AVISYNTH if (avs_library.avs_is_yv24(avs->vi)) VAR_11 = 24; else if (avs_library.avs_is_yv16(avs->vi)) VAR_11 = 16; else if (avs_library.avs_is_yv411(avs->vi)) VAR_11 = 12; else if (avs_library.avs_is_y8(avs->vi)) VAR_11 = 8; else VAR_11 = avs_library.avs_bits_per_pixel(avs->vi); #else VAR_11 = avs_bits_per_pixel(avs->vi); #endif VAR_1->size = (((int64_t)avs->vi->width * (int64_t)avs->vi->height) * VAR_11) / 8; if (!VAR_1->size) return AVERROR_UNKNOWN; if (av_new_packet(VAR_1, VAR_1->size) < 0) return AVERROR(ENOMEM); VAR_1->pts = VAR_5; VAR_1->dts = VAR_5; VAR_1->duration = 1; VAR_1->stream_index = avs->curr_stream; frame = avs_library.avs_get_frame(avs->clip, VAR_5); VAR_12 = avs_library.avs_clip_get_error(avs->clip); if (VAR_12) { av_log(VAR_0, AV_LOG_ERROR, "%VAR_0\VAR_5", VAR_12); avs->VAR_12 = 1; av_packet_unref(VAR_1); return AVERROR_UNKNOWN; } VAR_3 = VAR_1->data; for (VAR_6 = 0; VAR_6 < avs->n_planes; VAR_6++) { VAR_7 = avs->planes[VAR_6]; #ifdef USING_AVISYNTH VAR_4 = avs_library.avs_get_read_ptr_p(frame, VAR_7); VAR_10 = avs_library.avs_get_pitch_p(frame, VAR_7); VAR_8 = avs_library.avs_get_row_size_p(frame, VAR_7); VAR_9 = avs_library.avs_get_height_p(frame, VAR_7); #else VAR_4 = avs_get_read_ptr_p(frame, VAR_7); VAR_10 = avs_get_pitch_p(frame, VAR_7); VAR_8 = avs_get_row_size_p(frame, VAR_7); VAR_9 = avs_get_height_p(frame, VAR_7); #endif if (avs_is_rgb24(avs->vi) || avs_is_rgb(avs->vi)) { VAR_4 = VAR_4 + (VAR_9 - 1) * VAR_10; VAR_10 = -VAR_10; } avs_library.avs_bit_blt(avs->env, VAR_3, VAR_8, VAR_4, VAR_10, VAR_8, VAR_9); VAR_3 += VAR_8 * VAR_9; } avs_library.avs_release_video_frame(frame); return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1,\nint VAR_2)\n{", "AviSynthContext *avs = VAR_0->priv_data;", "AVS_VideoFrame *frame;", "unsigned char *VAR_3;", "const unsigned char *VAR_4;", "int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11;", "const char *VAR_12;", "if (avs->curr_frame >= avs->vi->num_frames)\nreturn AVERROR_EOF;", "VAR_5 = avs->curr_frame++;", "if (VAR_2)\nreturn 0;", "#ifdef USING_AVISYNTH\nif (avs_library.avs_is_yv24(avs->vi))\nVAR_11 = 24;", "else if (avs_library.avs_is_yv16(avs->vi))\nVAR_11 = 16;", "else if (avs_library.avs_is_yv411(avs->vi))\nVAR_11 = 12;", "else if (avs_library.avs_is_y8(avs->vi))\nVAR_11 = 8;", "else\nVAR_11 = avs_library.avs_bits_per_pixel(avs->vi);", "#else\nVAR_11 = avs_bits_per_pixel(avs->vi);", "#endif\nVAR_1->size = (((int64_t)avs->vi->width *\n(int64_t)avs->vi->height) * VAR_11) / 8;", "if (!VAR_1->size)\nreturn AVERROR_UNKNOWN;", "if (av_new_packet(VAR_1, VAR_1->size) < 0)\nreturn AVERROR(ENOMEM);", "VAR_1->pts = VAR_5;", "VAR_1->dts = VAR_5;", "VAR_1->duration = 1;", "VAR_1->stream_index = avs->curr_stream;", "frame = avs_library.avs_get_frame(avs->clip, VAR_5);", "VAR_12 = avs_library.avs_clip_get_error(avs->clip);", "if (VAR_12) {", "av_log(VAR_0, AV_LOG_ERROR, \"%VAR_0\\VAR_5\", VAR_12);", "avs->VAR_12 = 1;", "av_packet_unref(VAR_1);", "return AVERROR_UNKNOWN;", "}", "VAR_3 = VAR_1->data;", "for (VAR_6 = 0; VAR_6 < avs->n_planes; VAR_6++) {", "VAR_7 = avs->planes[VAR_6];", "#ifdef USING_AVISYNTH\nVAR_4 = avs_library.avs_get_read_ptr_p(frame, VAR_7);", "VAR_10 = avs_library.avs_get_pitch_p(frame, VAR_7);", "VAR_8 = avs_library.avs_get_row_size_p(frame, VAR_7);", "VAR_9 = avs_library.avs_get_height_p(frame, VAR_7);", "#else\nVAR_4 = avs_get_read_ptr_p(frame, VAR_7);", "VAR_10 = avs_get_pitch_p(frame, VAR_7);", "VAR_8 = avs_get_row_size_p(frame, VAR_7);", "VAR_9 = avs_get_height_p(frame, VAR_7);", "#endif\nif (avs_is_rgb24(avs->vi) || avs_is_rgb(avs->vi)) {", "VAR_4 = VAR_4 + (VAR_9 - 1) * VAR_10;", "VAR_10 = -VAR_10;", "}", "avs_library.avs_bit_blt(avs->env, VAR_3, VAR_8, VAR_4, VAR_10,\nVAR_8, VAR_9);", "VAR_3 += VAR_8 * VAR_9;", "}", "avs_library.avs_release_video_frame(frame);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 29 ], [ 31, 33 ], [ 37, 47, 49 ], [ 51, 53 ], [ 55, 57 ], [ 59, 61 ], [ 63, 65 ], [ 67, 69 ], [ 71, 79, 81 ], [ 83, 85 ], [ 89, 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129, 131 ], [ 133 ], [ 137 ], [ 139 ], [ 141, 143 ], [ 145 ], [ 149 ], [ 151 ], [ 153, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 169, 171 ], [ 173 ], [ 175 ], [ 179 ], [ 181 ], [ 183 ] ]
25,417
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; } }
false
FFmpeg
72dbc610be3272ba36603f78a39cc2d2d8fe0cc3
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; } }
{ "code": [], "line_no": [] }
static void FUNC_0(const uint8_t *VAR_0, int32_t VAR_1, uint8_t *VAR_2, int32_t VAR_3, int32_t VAR_4, uint8_t VAR_5) { uint32_t multiple8_cnt; for (multiple8_cnt = 4; multiple8_cnt--;) { avc_luma_midh_qrt_and_aver_dst_4w_msa(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5); VAR_0 += 4; VAR_2 += 4; } }
[ "static void FUNC_0(const uint8_t *VAR_0,\nint32_t VAR_1,\nuint8_t *VAR_2,\nint32_t VAR_3,\nint32_t VAR_4,\nuint8_t VAR_5)\n{", "uint32_t multiple8_cnt;", "for (multiple8_cnt = 4; multiple8_cnt--;) {", "avc_luma_midh_qrt_and_aver_dst_4w_msa(VAR_0, VAR_1, VAR_2, VAR_3,\nVAR_4, VAR_5);", "VAR_0 += 4;", "VAR_2 += 4;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13 ], [ 15 ], [ 19 ], [ 21, 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ] ]
25,418
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;
true
FFmpeg
5d996b56499f00f80b02a41bab3d6b7349e36e9d
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'; 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;
{ "code": [], "line_no": [] }
static int FUNC_0(TiffContext *VAR_0, AVFrame *VAR_1) { unsigned VAR_2, VAR_3, VAR_4, VAR_5, VAR_6 = 0, VAR_7 = 0; int VAR_8, VAR_9; int VAR_10; int VAR_11; double *VAR_12; VAR_11 = ff_tread_tag(&VAR_0->gb, VAR_0->le, &VAR_2, &VAR_3, &VAR_4, &VAR_9); if (VAR_11 < 0) { goto end; VAR_5 = bytestream2_tell(&VAR_0->gb); if (VAR_4 == 1) { switch (VAR_3) { case TIFF_BYTE: case TIFF_SHORT: case TIFF_LONG: VAR_6 = ff_tget(&VAR_0->gb, VAR_3, VAR_0->le); break; case TIFF_RATIONAL: VAR_6 = ff_tget(&VAR_0->gb, TIFF_LONG, VAR_0->le); VAR_7 = ff_tget(&VAR_0->gb, TIFF_LONG, VAR_0->le); break; case TIFF_STRING: if (VAR_4 <= 4) { break; default: VAR_6 = UINT_MAX; switch (VAR_2) { case TIFF_WIDTH: VAR_0->width = VAR_6; break; case TIFF_HEIGHT: VAR_0->height = VAR_6; break; case TIFF_BPP: if (VAR_4 > 4U) { "This format is not supported (bpp=%d, %d components)\n", VAR_6, VAR_4); VAR_0->bppcount = VAR_4; if (VAR_4 == 1) VAR_0->bpp = VAR_6; else { switch (VAR_3) { case TIFF_BYTE: case TIFF_SHORT: case TIFF_LONG: VAR_0->bpp = 0; if (bytestream2_get_bytes_left(&VAR_0->gb) < type_sizes[VAR_3] * VAR_4) for (VAR_8 = 0; VAR_8 < VAR_4; VAR_8++) VAR_0->bpp += ff_tget(&VAR_0->gb, VAR_3, VAR_0->le); break; default: VAR_0->bpp = -1; break; case TIFF_SAMPLES_PER_PIXEL: if (VAR_4 != 1) { "Samples per pixel requires a single VAR_6, many provided\n"); if (VAR_6 > 4U) { "Samples per pixel %d is too large\n", VAR_6); if (VAR_0->bppcount == 1) VAR_0->bpp *= VAR_6; VAR_0->bppcount = VAR_6; break; case TIFF_COMPR: VAR_0->compr = VAR_6; av_log(VAR_0->avctx, AV_LOG_DEBUG, "compression: %d\n", VAR_0->compr); VAR_0->predictor = 0; switch (VAR_0->compr) { case TIFF_RAW: case TIFF_PACKBITS: case TIFF_LZW: case TIFF_CCITT_RLE: break; case TIFF_G3: case TIFF_G4: VAR_0->fax_opts = 0; break; case TIFF_DEFLATE: case TIFF_ADOBE_DEFLATE: #if CONFIG_ZLIB break; #else av_log(VAR_0->avctx, AV_LOG_ERROR, "Deflate: ZLib not compiled in\n"); return AVERROR(ENOSYS); #endif case TIFF_JPEG: case TIFF_NEWJPEG: avpriv_report_missing_feature(VAR_0->avctx, "JPEG compression"); return AVERROR_PATCHWELCOME; case TIFF_LZMA: #if CONFIG_LZMA break; #else av_log(VAR_0->avctx, AV_LOG_ERROR, "LZMA not compiled in\n"); return AVERROR(ENOSYS); #endif default: av_log(VAR_0->avctx, AV_LOG_ERROR, "Unknown compression method %VAR_8\n", VAR_0->compr); break; case TIFF_ROWSPERSTRIP: if (!VAR_6 || (VAR_3 == TIFF_LONG && VAR_6 == UINT_MAX)) VAR_6 = VAR_0->height; VAR_0->rps = FFMIN(VAR_6, VAR_0->height); break; case TIFF_STRIP_OFFS: if (VAR_4 == 1) { VAR_0->strippos = 0; VAR_0->stripoff = VAR_6; } else VAR_0->strippos = VAR_5; VAR_0->strips = VAR_4; if (VAR_0->strips == 1) VAR_0->rps = VAR_0->height; VAR_0->sot = VAR_3; break; case TIFF_STRIP_SIZE: if (VAR_4 == 1) { "stripsize %u too large\n", VAR_6); VAR_0->stripsizesoff = 0; VAR_0->stripsize = VAR_6; VAR_0->strips = 1; } else { VAR_0->stripsizesoff = VAR_5; VAR_0->strips = VAR_4; VAR_0->sstype = VAR_3; break; case TIFF_XRES: case TIFF_YRES: set_sar(VAR_0, VAR_2, VAR_6, VAR_7); break; case TIFF_TILE_BYTE_COUNTS: case TIFF_TILE_LENGTH: case TIFF_TILE_OFFSETS: case TIFF_TILE_WIDTH: av_log(VAR_0->avctx, AV_LOG_ERROR, "Tiled images are not supported\n"); return AVERROR_PATCHWELCOME; break; case TIFF_PREDICTOR: VAR_0->predictor = VAR_6; break; case TIFF_PHOTOMETRIC: switch (VAR_6) { case TIFF_PHOTOMETRIC_WHITE_IS_ZERO: case TIFF_PHOTOMETRIC_BLACK_IS_ZERO: case TIFF_PHOTOMETRIC_RGB: case TIFF_PHOTOMETRIC_PALETTE: case TIFF_PHOTOMETRIC_YCBCR: VAR_0->photometric = VAR_6; 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(VAR_0->avctx, "PhotometricInterpretation 0x%04X", VAR_6); return AVERROR_PATCHWELCOME; default: av_log(VAR_0->avctx, AV_LOG_ERROR, "PhotometricInterpretation %u is " "unknown\n", VAR_6); break; case TIFF_FILL_ORDER: if (VAR_6 < 1 || VAR_6 > 2) { "Unknown FillOrder VAR_6 %d, trying default one\n", VAR_6); VAR_6 = 1; VAR_0->fill_order = VAR_6 - 1; break; case TIFF_PAL: { GetByteContext pal_gb[3]; VAR_5 = type_sizes[VAR_3]; if (VAR_4 / 3 > 256 || bytestream2_get_bytes_left(&VAR_0->gb) < VAR_4 / 3 * VAR_5 * 3) pal_gb[0] = pal_gb[1] = pal_gb[2] = VAR_0->gb; bytestream2_skip(&pal_gb[1], VAR_4 / 3 * VAR_5); bytestream2_skip(&pal_gb[2], VAR_4 / 3 * VAR_5 * 2); VAR_5 = (type_sizes[VAR_3] - 1) << 3; if (VAR_5 > 31U) { av_log(VAR_0->avctx, AV_LOG_ERROR, "palette shift %d is out of range\n", VAR_5); for (VAR_8 = 0; VAR_8 < VAR_4 / 3; VAR_8++) { uint32_t p = 0xFF000000; p |= (ff_tget(&pal_gb[0], VAR_3, VAR_0->le) >> VAR_5) << 16; p |= (ff_tget(&pal_gb[1], VAR_3, VAR_0->le) >> VAR_5) << 8; p |= ff_tget(&pal_gb[2], VAR_3, VAR_0->le) >> VAR_5; VAR_0->palette[VAR_8] = p; VAR_0->palette_is_set = 1; break; case TIFF_PLANAR: VAR_0->planar = VAR_6 == 2; break; case TIFF_YCBCR_SUBSAMPLING: if (VAR_4 != 2) { av_log(VAR_0->avctx, AV_LOG_ERROR, "subsample VAR_4 invalid\n"); for (VAR_8 = 0; VAR_8 < VAR_4; VAR_8++) { VAR_0->subsampling[VAR_8] = ff_tget(&VAR_0->gb, VAR_3, VAR_0->le); if (VAR_0->subsampling[VAR_8] <= 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "subsampling %d is invalid\n", VAR_0->subsampling[VAR_8]); break; case TIFF_T4OPTIONS: if (VAR_0->compr == TIFF_G3) VAR_0->fax_opts = VAR_6; break; case TIFF_T6OPTIONS: if (VAR_0->compr == TIFF_G4) VAR_0->fax_opts = VAR_6; break; #define ADD_METADATA(VAR_4, name, sep)\ if ((VAR_11 = add_metadata(VAR_4, VAR_3, name, sep, VAR_0, VAR_1)) < 0) {\ av_log(VAR_0->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n");\ goto end;\ case TIFF_MODEL_PIXEL_SCALE: ADD_METADATA(VAR_4, "ModelPixelScaleTag", NULL); break; case TIFF_MODEL_TRANSFORMATION: ADD_METADATA(VAR_4, "ModelTransformationTag", NULL); break; case TIFF_MODEL_TIEPOINT: ADD_METADATA(VAR_4, "ModelTiepointTag", NULL); break; case TIFF_GEO_KEY_DIRECTORY: if (VAR_0->geotag_count) { avpriv_request_sample(VAR_0->avctx, "Multiple geo key directories\n"); ADD_METADATA(1, "GeoTIFF_Version", NULL); ADD_METADATA(2, "GeoTIFF_Key_Revision", "."); VAR_0->geotag_count = ff_tget_short(&VAR_0->gb, VAR_0->le); if (VAR_0->geotag_count > VAR_4 / 4 - 1) { VAR_0->geotag_count = VAR_4 / 4 - 1; av_log(VAR_0->avctx, AV_LOG_WARNING, "GeoTIFF key directory buffer shorter than specified\n"); if (bytestream2_get_bytes_left(&VAR_0->gb) < VAR_0->geotag_count * sizeof(int16_t) * 4) { VAR_0->geotag_count = 0; return -1; VAR_0->geotags = av_mallocz_array(VAR_0->geotag_count, sizeof(TiffGeoTag)); if (!VAR_0->geotags) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n"); VAR_0->geotag_count = 0; goto end; for (VAR_8 = 0; VAR_8 < VAR_0->geotag_count; VAR_8++) { VAR_0->geotags[VAR_8].key = ff_tget_short(&VAR_0->gb, VAR_0->le); VAR_0->geotags[VAR_8].VAR_3 = ff_tget_short(&VAR_0->gb, VAR_0->le); VAR_0->geotags[VAR_8].VAR_4 = ff_tget_short(&VAR_0->gb, VAR_0->le); if (!VAR_0->geotags[VAR_8].VAR_3) VAR_0->geotags[VAR_8].val = get_geokey_val(VAR_0->geotags[VAR_8].key, ff_tget_short(&VAR_0->gb, VAR_0->le)); else VAR_0->geotags[VAR_8].offset = ff_tget_short(&VAR_0->gb, VAR_0->le); break; case TIFF_GEO_DOUBLE_PARAMS: if (VAR_4 >= INT_MAX / sizeof(int64_t)) if (bytestream2_get_bytes_left(&VAR_0->gb) < VAR_4 * sizeof(int64_t)) VAR_12 = av_malloc_array(VAR_4, sizeof(double)); if (!VAR_12) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n"); goto end; for (VAR_8 = 0; VAR_8 < VAR_4; VAR_8++) VAR_12[VAR_8] = ff_tget_double(&VAR_0->gb, VAR_0->le); for (VAR_8 = 0; VAR_8 < VAR_0->geotag_count; VAR_8++) { if (VAR_0->geotags[VAR_8].VAR_3 == TIFF_GEO_DOUBLE_PARAMS) { if (VAR_0->geotags[VAR_8].VAR_4 == 0 || VAR_0->geotags[VAR_8].offset + VAR_0->geotags[VAR_8].VAR_4 > VAR_4) { av_log(VAR_0->avctx, AV_LOG_WARNING, "Invalid GeoTIFF key %d\n", VAR_0->geotags[VAR_8].key); } else { char *ap = doubles2str(&VAR_12[VAR_0->geotags[VAR_8].offset], VAR_0->geotags[VAR_8].VAR_4, ", "); if (!ap) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n"); av_freep(&VAR_12); return AVERROR(ENOMEM); VAR_0->geotags[VAR_8].val = ap; av_freep(&VAR_12); break; case TIFF_GEO_ASCII_PARAMS: VAR_10 = bytestream2_tell(&VAR_0->gb); for (VAR_8 = 0; VAR_8 < VAR_0->geotag_count; VAR_8++) { if (VAR_0->geotags[VAR_8].VAR_3 == TIFF_GEO_ASCII_PARAMS) { if (VAR_0->geotags[VAR_8].VAR_4 == 0 || VAR_0->geotags[VAR_8].offset + VAR_0->geotags[VAR_8].VAR_4 > VAR_4) { av_log(VAR_0->avctx, AV_LOG_WARNING, "Invalid GeoTIFF key %d\n", VAR_0->geotags[VAR_8].key); } else { char *ap; bytestream2_seek(&VAR_0->gb, VAR_10 + VAR_0->geotags[VAR_8].offset, SEEK_SET); if (bytestream2_get_bytes_left(&VAR_0->gb) < VAR_0->geotags[VAR_8].VAR_4) ap = av_malloc(VAR_0->geotags[VAR_8].VAR_4); if (!ap) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n"); return AVERROR(ENOMEM); bytestream2_get_bufferu(&VAR_0->gb, ap, VAR_0->geotags[VAR_8].VAR_4); ap[VAR_0->geotags[VAR_8].VAR_4 - 1] = '\0'; VAR_0->geotags[VAR_8].val = ap; break; case TIFF_ARTIST: ADD_METADATA(VAR_4, "artist", NULL); break; case TIFF_COPYRIGHT: ADD_METADATA(VAR_4, "copyright", NULL); break; case TIFF_DATE: ADD_METADATA(VAR_4, "date", NULL); break; case TIFF_DOCUMENT_NAME: ADD_METADATA(VAR_4, "document_name", NULL); break; case TIFF_HOST_COMPUTER: ADD_METADATA(VAR_4, "computer", NULL); break; case TIFF_IMAGE_DESCRIPTION: ADD_METADATA(VAR_4, "description", NULL); break; case TIFF_MAKE: ADD_METADATA(VAR_4, "make", NULL); break; case TIFF_MODEL: ADD_METADATA(VAR_4, "model", NULL); break; case TIFF_PAGE_NAME: ADD_METADATA(VAR_4, "page_name", NULL); break; case TIFF_PAGE_NUMBER: ADD_METADATA(VAR_4, "page_number", " / "); break; case TIFF_SOFTWARE_NAME: ADD_METADATA(VAR_4, "software", NULL); break; default: if (VAR_0->avctx->err_recognition & AV_EF_EXPLODE) { "Unknown or unsupported VAR_2 %d/0X%0X\n", VAR_2, VAR_2); end: if (VAR_0->bpp > 64U) { "This format is not supported (bpp=%d, %d components)\n", VAR_0->bpp, VAR_4); VAR_0->bpp = 0; bytestream2_seek(&VAR_0->gb, VAR_9, SEEK_SET); return 0;
[ "static int FUNC_0(TiffContext *VAR_0, AVFrame *VAR_1)\n{", "unsigned VAR_2, VAR_3, VAR_4, VAR_5, VAR_6 = 0, VAR_7 = 0;", "int VAR_8, VAR_9;", "int VAR_10;", "int VAR_11;", "double *VAR_12;", "VAR_11 = ff_tread_tag(&VAR_0->gb, VAR_0->le, &VAR_2, &VAR_3, &VAR_4, &VAR_9);", "if (VAR_11 < 0) {", "goto end;", "VAR_5 = bytestream2_tell(&VAR_0->gb);", "if (VAR_4 == 1) {", "switch (VAR_3) {", "case TIFF_BYTE:\ncase TIFF_SHORT:\ncase TIFF_LONG:\nVAR_6 = ff_tget(&VAR_0->gb, VAR_3, VAR_0->le);", "break;", "case TIFF_RATIONAL:\nVAR_6 = ff_tget(&VAR_0->gb, TIFF_LONG, VAR_0->le);", "VAR_7 = ff_tget(&VAR_0->gb, TIFF_LONG, VAR_0->le);", "break;", "case TIFF_STRING:\nif (VAR_4 <= 4) {", "break;", "default:\nVAR_6 = UINT_MAX;", "switch (VAR_2) {", "case TIFF_WIDTH:\nVAR_0->width = VAR_6;", "break;", "case TIFF_HEIGHT:\nVAR_0->height = VAR_6;", "break;", "case TIFF_BPP:\nif (VAR_4 > 4U) {", "\"This format is not supported (bpp=%d, %d components)\\n\",\nVAR_6, VAR_4);", "VAR_0->bppcount = VAR_4;", "if (VAR_4 == 1)\nVAR_0->bpp = VAR_6;", "else {", "switch (VAR_3) {", "case TIFF_BYTE:\ncase TIFF_SHORT:\ncase TIFF_LONG:\nVAR_0->bpp = 0;", "if (bytestream2_get_bytes_left(&VAR_0->gb) < type_sizes[VAR_3] * VAR_4)\nfor (VAR_8 = 0; VAR_8 < VAR_4; VAR_8++)", "VAR_0->bpp += ff_tget(&VAR_0->gb, VAR_3, VAR_0->le);", "break;", "default:\nVAR_0->bpp = -1;", "break;", "case TIFF_SAMPLES_PER_PIXEL:\nif (VAR_4 != 1) {", "\"Samples per pixel requires a single VAR_6, many provided\\n\");", "if (VAR_6 > 4U) {", "\"Samples per pixel %d is too large\\n\", VAR_6);", "if (VAR_0->bppcount == 1)\nVAR_0->bpp *= VAR_6;", "VAR_0->bppcount = VAR_6;", "break;", "case TIFF_COMPR:\nVAR_0->compr = VAR_6;", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"compression: %d\\n\", VAR_0->compr);", "VAR_0->predictor = 0;", "switch (VAR_0->compr) {", "case TIFF_RAW:\ncase TIFF_PACKBITS:\ncase TIFF_LZW:\ncase TIFF_CCITT_RLE:\nbreak;", "case TIFF_G3:\ncase TIFF_G4:\nVAR_0->fax_opts = 0;", "break;", "case TIFF_DEFLATE:\ncase TIFF_ADOBE_DEFLATE:\n#if CONFIG_ZLIB\nbreak;", "#else\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"Deflate: ZLib not compiled in\\n\");", "return AVERROR(ENOSYS);", "#endif\ncase TIFF_JPEG:\ncase TIFF_NEWJPEG:\navpriv_report_missing_feature(VAR_0->avctx, \"JPEG compression\");", "return AVERROR_PATCHWELCOME;", "case TIFF_LZMA:\n#if CONFIG_LZMA\nbreak;", "#else\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"LZMA not compiled in\\n\");", "return AVERROR(ENOSYS);", "#endif\ndefault:\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"Unknown compression method %VAR_8\\n\",\nVAR_0->compr);", "break;", "case TIFF_ROWSPERSTRIP:\nif (!VAR_6 || (VAR_3 == TIFF_LONG && VAR_6 == UINT_MAX))\nVAR_6 = VAR_0->height;", "VAR_0->rps = FFMIN(VAR_6, VAR_0->height);", "break;", "case TIFF_STRIP_OFFS:\nif (VAR_4 == 1) {", "VAR_0->strippos = 0;", "VAR_0->stripoff = VAR_6;", "} else", "VAR_0->strippos = VAR_5;", "VAR_0->strips = VAR_4;", "if (VAR_0->strips == 1)\nVAR_0->rps = VAR_0->height;", "VAR_0->sot = VAR_3;", "break;", "case TIFF_STRIP_SIZE:\nif (VAR_4 == 1) {", "\"stripsize %u too large\\n\", VAR_6);", "VAR_0->stripsizesoff = 0;", "VAR_0->stripsize = VAR_6;", "VAR_0->strips = 1;", "} else {", "VAR_0->stripsizesoff = VAR_5;", "VAR_0->strips = VAR_4;", "VAR_0->sstype = VAR_3;", "break;", "case TIFF_XRES:\ncase TIFF_YRES:\nset_sar(VAR_0, VAR_2, VAR_6, VAR_7);", "break;", "case TIFF_TILE_BYTE_COUNTS:\ncase TIFF_TILE_LENGTH:\ncase TIFF_TILE_OFFSETS:\ncase TIFF_TILE_WIDTH:\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"Tiled images are not supported\\n\");", "return AVERROR_PATCHWELCOME;", "break;", "case TIFF_PREDICTOR:\nVAR_0->predictor = VAR_6;", "break;", "case TIFF_PHOTOMETRIC:\nswitch (VAR_6) {", "case TIFF_PHOTOMETRIC_WHITE_IS_ZERO:\ncase TIFF_PHOTOMETRIC_BLACK_IS_ZERO:\ncase TIFF_PHOTOMETRIC_RGB:\ncase TIFF_PHOTOMETRIC_PALETTE:\ncase TIFF_PHOTOMETRIC_YCBCR:\nVAR_0->photometric = VAR_6;", "break;", "case TIFF_PHOTOMETRIC_ALPHA_MASK:\ncase TIFF_PHOTOMETRIC_SEPARATED:\ncase TIFF_PHOTOMETRIC_CIE_LAB:\ncase TIFF_PHOTOMETRIC_ICC_LAB:\ncase TIFF_PHOTOMETRIC_ITU_LAB:\ncase TIFF_PHOTOMETRIC_CFA:\ncase TIFF_PHOTOMETRIC_LOG_L:\ncase TIFF_PHOTOMETRIC_LOG_LUV:\ncase TIFF_PHOTOMETRIC_LINEAR_RAW:\navpriv_report_missing_feature(VAR_0->avctx,\n\"PhotometricInterpretation 0x%04X\",\nVAR_6);", "return AVERROR_PATCHWELCOME;", "default:\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"PhotometricInterpretation %u is \"\n\"unknown\\n\", VAR_6);", "break;", "case TIFF_FILL_ORDER:\nif (VAR_6 < 1 || VAR_6 > 2) {", "\"Unknown FillOrder VAR_6 %d, trying default one\\n\", VAR_6);", "VAR_6 = 1;", "VAR_0->fill_order = VAR_6 - 1;", "break;", "case TIFF_PAL: {", "GetByteContext pal_gb[3];", "VAR_5 = type_sizes[VAR_3];", "if (VAR_4 / 3 > 256 ||\nbytestream2_get_bytes_left(&VAR_0->gb) < VAR_4 / 3 * VAR_5 * 3)\npal_gb[0] = pal_gb[1] = pal_gb[2] = VAR_0->gb;", "bytestream2_skip(&pal_gb[1], VAR_4 / 3 * VAR_5);", "bytestream2_skip(&pal_gb[2], VAR_4 / 3 * VAR_5 * 2);", "VAR_5 = (type_sizes[VAR_3] - 1) << 3;", "if (VAR_5 > 31U) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"palette shift %d is out of range\\n\", VAR_5);", "for (VAR_8 = 0; VAR_8 < VAR_4 / 3; VAR_8++) {", "uint32_t p = 0xFF000000;", "p |= (ff_tget(&pal_gb[0], VAR_3, VAR_0->le) >> VAR_5) << 16;", "p |= (ff_tget(&pal_gb[1], VAR_3, VAR_0->le) >> VAR_5) << 8;", "p |= ff_tget(&pal_gb[2], VAR_3, VAR_0->le) >> VAR_5;", "VAR_0->palette[VAR_8] = p;", "VAR_0->palette_is_set = 1;", "break;", "case TIFF_PLANAR:\nVAR_0->planar = VAR_6 == 2;", "break;", "case TIFF_YCBCR_SUBSAMPLING:\nif (VAR_4 != 2) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"subsample VAR_4 invalid\\n\");", "for (VAR_8 = 0; VAR_8 < VAR_4; VAR_8++) {", "VAR_0->subsampling[VAR_8] = ff_tget(&VAR_0->gb, VAR_3, VAR_0->le);", "if (VAR_0->subsampling[VAR_8] <= 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"subsampling %d is invalid\\n\", VAR_0->subsampling[VAR_8]);", "break;", "case TIFF_T4OPTIONS:\nif (VAR_0->compr == TIFF_G3)\nVAR_0->fax_opts = VAR_6;", "break;", "case TIFF_T6OPTIONS:\nif (VAR_0->compr == TIFF_G4)\nVAR_0->fax_opts = VAR_6;", "break;", "#define ADD_METADATA(VAR_4, name, sep)\\\nif ((VAR_11 = add_metadata(VAR_4, VAR_3, name, sep, VAR_0, VAR_1)) < 0) {\\", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Error allocating temporary buffer\\n\");\\", "goto end;\\", "case TIFF_MODEL_PIXEL_SCALE:\nADD_METADATA(VAR_4, \"ModelPixelScaleTag\", NULL);", "break;", "case TIFF_MODEL_TRANSFORMATION:\nADD_METADATA(VAR_4, \"ModelTransformationTag\", NULL);", "break;", "case TIFF_MODEL_TIEPOINT:\nADD_METADATA(VAR_4, \"ModelTiepointTag\", NULL);", "break;", "case TIFF_GEO_KEY_DIRECTORY:\nif (VAR_0->geotag_count) {", "avpriv_request_sample(VAR_0->avctx, \"Multiple geo key directories\\n\");", "ADD_METADATA(1, \"GeoTIFF_Version\", NULL);", "ADD_METADATA(2, \"GeoTIFF_Key_Revision\", \".\");", "VAR_0->geotag_count = ff_tget_short(&VAR_0->gb, VAR_0->le);", "if (VAR_0->geotag_count > VAR_4 / 4 - 1) {", "VAR_0->geotag_count = VAR_4 / 4 - 1;", "av_log(VAR_0->avctx, AV_LOG_WARNING, \"GeoTIFF key directory buffer shorter than specified\\n\");", "if (bytestream2_get_bytes_left(&VAR_0->gb) < VAR_0->geotag_count * sizeof(int16_t) * 4) {", "VAR_0->geotag_count = 0;", "return -1;", "VAR_0->geotags = av_mallocz_array(VAR_0->geotag_count, sizeof(TiffGeoTag));", "if (!VAR_0->geotags) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Error allocating temporary buffer\\n\");", "VAR_0->geotag_count = 0;", "goto end;", "for (VAR_8 = 0; VAR_8 < VAR_0->geotag_count; VAR_8++) {", "VAR_0->geotags[VAR_8].key = ff_tget_short(&VAR_0->gb, VAR_0->le);", "VAR_0->geotags[VAR_8].VAR_3 = ff_tget_short(&VAR_0->gb, VAR_0->le);", "VAR_0->geotags[VAR_8].VAR_4 = ff_tget_short(&VAR_0->gb, VAR_0->le);", "if (!VAR_0->geotags[VAR_8].VAR_3)\nVAR_0->geotags[VAR_8].val = get_geokey_val(VAR_0->geotags[VAR_8].key, ff_tget_short(&VAR_0->gb, VAR_0->le));", "else\nVAR_0->geotags[VAR_8].offset = ff_tget_short(&VAR_0->gb, VAR_0->le);", "break;", "case TIFF_GEO_DOUBLE_PARAMS:\nif (VAR_4 >= INT_MAX / sizeof(int64_t))\nif (bytestream2_get_bytes_left(&VAR_0->gb) < VAR_4 * sizeof(int64_t))\nVAR_12 = av_malloc_array(VAR_4, sizeof(double));", "if (!VAR_12) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Error allocating temporary buffer\\n\");", "goto end;", "for (VAR_8 = 0; VAR_8 < VAR_4; VAR_8++)", "VAR_12[VAR_8] = ff_tget_double(&VAR_0->gb, VAR_0->le);", "for (VAR_8 = 0; VAR_8 < VAR_0->geotag_count; VAR_8++) {", "if (VAR_0->geotags[VAR_8].VAR_3 == TIFF_GEO_DOUBLE_PARAMS) {", "if (VAR_0->geotags[VAR_8].VAR_4 == 0\n|| VAR_0->geotags[VAR_8].offset + VAR_0->geotags[VAR_8].VAR_4 > VAR_4) {", "av_log(VAR_0->avctx, AV_LOG_WARNING, \"Invalid GeoTIFF key %d\\n\", VAR_0->geotags[VAR_8].key);", "} else {", "char *ap = doubles2str(&VAR_12[VAR_0->geotags[VAR_8].offset], VAR_0->geotags[VAR_8].VAR_4, \", \");", "if (!ap) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Error allocating temporary buffer\\n\");", "av_freep(&VAR_12);", "return AVERROR(ENOMEM);", "VAR_0->geotags[VAR_8].val = ap;", "av_freep(&VAR_12);", "break;", "case TIFF_GEO_ASCII_PARAMS:\nVAR_10 = bytestream2_tell(&VAR_0->gb);", "for (VAR_8 = 0; VAR_8 < VAR_0->geotag_count; VAR_8++) {", "if (VAR_0->geotags[VAR_8].VAR_3 == TIFF_GEO_ASCII_PARAMS) {", "if (VAR_0->geotags[VAR_8].VAR_4 == 0\n|| VAR_0->geotags[VAR_8].offset + VAR_0->geotags[VAR_8].VAR_4 > VAR_4) {", "av_log(VAR_0->avctx, AV_LOG_WARNING, \"Invalid GeoTIFF key %d\\n\", VAR_0->geotags[VAR_8].key);", "} else {", "char *ap;", "bytestream2_seek(&VAR_0->gb, VAR_10 + VAR_0->geotags[VAR_8].offset, SEEK_SET);", "if (bytestream2_get_bytes_left(&VAR_0->gb) < VAR_0->geotags[VAR_8].VAR_4)\nap = av_malloc(VAR_0->geotags[VAR_8].VAR_4);", "if (!ap) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Error allocating temporary buffer\\n\");", "return AVERROR(ENOMEM);", "bytestream2_get_bufferu(&VAR_0->gb, ap, VAR_0->geotags[VAR_8].VAR_4);", "ap[VAR_0->geotags[VAR_8].VAR_4 - 1] = '\\0';", "VAR_0->geotags[VAR_8].val = ap;", "break;", "case TIFF_ARTIST:\nADD_METADATA(VAR_4, \"artist\", NULL);", "break;", "case TIFF_COPYRIGHT:\nADD_METADATA(VAR_4, \"copyright\", NULL);", "break;", "case TIFF_DATE:\nADD_METADATA(VAR_4, \"date\", NULL);", "break;", "case TIFF_DOCUMENT_NAME:\nADD_METADATA(VAR_4, \"document_name\", NULL);", "break;", "case TIFF_HOST_COMPUTER:\nADD_METADATA(VAR_4, \"computer\", NULL);", "break;", "case TIFF_IMAGE_DESCRIPTION:\nADD_METADATA(VAR_4, \"description\", NULL);", "break;", "case TIFF_MAKE:\nADD_METADATA(VAR_4, \"make\", NULL);", "break;", "case TIFF_MODEL:\nADD_METADATA(VAR_4, \"model\", NULL);", "break;", "case TIFF_PAGE_NAME:\nADD_METADATA(VAR_4, \"page_name\", NULL);", "break;", "case TIFF_PAGE_NUMBER:\nADD_METADATA(VAR_4, \"page_number\", \" / \");", "break;", "case TIFF_SOFTWARE_NAME:\nADD_METADATA(VAR_4, \"software\", NULL);", "break;", "default:\nif (VAR_0->avctx->err_recognition & AV_EF_EXPLODE) {", "\"Unknown or unsupported VAR_2 %d/0X%0X\\n\",\nVAR_2, VAR_2);", "end:\nif (VAR_0->bpp > 64U) {", "\"This format is not supported (bpp=%d, %d components)\\n\",\nVAR_0->bpp, VAR_4);", "VAR_0->bpp = 0;", "bytestream2_seek(&VAR_0->gb, VAR_9, SEEK_SET);", "return 0;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 26 ], [ 28 ], [ 30 ], [ 32, 34, 36, 38 ], [ 40 ], [ 42, 44 ], [ 46 ], [ 48 ], [ 50, 52 ], [ 54 ], [ 57, 59 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79, 81 ], [ 84, 86 ], [ 90 ], [ 92, 94 ], [ 96 ], [ 98 ], [ 100, 102, 104, 106 ], [ 108, 111 ], [ 113 ], [ 115 ], [ 117, 119 ], [ 123 ], [ 125, 127 ], [ 130 ], [ 134 ], [ 137 ], [ 141, 143 ], [ 145 ], [ 147 ], [ 149, 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159, 161, 163, 165, 167 ], [ 169, 171, 173 ], [ 175 ], [ 177, 179, 181, 183 ], [ 185, 187 ], [ 189 ], [ 191, 193, 195, 197 ], [ 199 ], [ 201, 203, 205 ], [ 207, 209 ], [ 211 ], [ 213, 215, 217, 219 ], [ 223 ], [ 225, 227, 229 ], [ 231 ], [ 233 ], [ 235, 237 ], [ 244 ], [ 246 ], [ 248 ], [ 250 ], [ 252 ], [ 254, 256 ], [ 258 ], [ 260 ], [ 262, 264 ], [ 268 ], [ 272 ], [ 274 ], [ 276 ], [ 278 ], [ 280 ], [ 283 ], [ 285 ], [ 287 ], [ 289, 291, 293 ], [ 295 ], [ 297, 299, 301, 303, 305 ], [ 307 ], [ 309 ], [ 311, 313 ], [ 315 ], [ 317, 319 ], [ 321, 323, 325, 327, 329, 331 ], [ 333 ], [ 335, 337, 339, 341, 343, 345, 347, 349, 351, 353, 355, 357 ], [ 359 ], [ 361, 363, 365 ], [ 369 ], [ 371, 373 ], [ 376 ], [ 378 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391, 393, 398 ], [ 400 ], [ 402 ], [ 406 ], [ 408 ], [ 410 ], [ 416 ], [ 418 ], [ 420 ], [ 422 ], [ 424 ], [ 426 ], [ 429 ], [ 431 ], [ 434, 436 ], [ 438 ], [ 440, 442 ], [ 444 ], [ 448 ], [ 450 ], [ 452 ], [ 454 ], [ 459 ], [ 461, 463, 465 ], [ 467 ], [ 469, 471, 473 ], [ 475 ], [ 477, 479 ], [ 481 ], [ 483 ], [ 486, 488 ], [ 490 ], [ 492, 494 ], [ 496 ], [ 498, 500 ], [ 502 ], [ 504, 506 ], [ 508 ], [ 512 ], [ 514 ], [ 516 ], [ 518 ], [ 520 ], [ 522 ], [ 525 ], [ 527 ], [ 529 ], [ 532 ], [ 534 ], [ 536 ], [ 538 ], [ 540 ], [ 543 ], [ 545 ], [ 547 ], [ 549 ], [ 553, 555 ], [ 557, 559 ], [ 562 ], [ 564, 566, 569, 572 ], [ 574 ], [ 576 ], [ 578 ], [ 581 ], [ 583 ], [ 585 ], [ 587 ], [ 589, 591 ], [ 593 ], [ 595 ], [ 597 ], [ 599 ], [ 601 ], [ 603 ], [ 605 ], [ 608 ], [ 613 ], [ 615 ], [ 617, 619 ], [ 621 ], [ 623 ], [ 625, 627 ], [ 629 ], [ 631 ], [ 633 ], [ 637 ], [ 639, 642 ], [ 644 ], [ 646 ], [ 648 ], [ 651 ], [ 653 ], [ 655 ], [ 660 ], [ 662, 664 ], [ 666 ], [ 668, 670 ], [ 672 ], [ 674, 676 ], [ 678 ], [ 680, 682 ], [ 684 ], [ 686, 688 ], [ 690 ], [ 692, 694 ], [ 696 ], [ 698, 700 ], [ 702 ], [ 704, 706 ], [ 708 ], [ 710, 712 ], [ 714 ], [ 716, 718 ], [ 720 ], [ 722, 724 ], [ 726 ], [ 728, 730 ], [ 733, 735 ], [ 740, 742 ], [ 745, 747 ], [ 749 ], [ 753 ], [ 755 ] ]
25,419
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); }
true
qemu
82be8e7394b31fd2d740651365b8ebdd0c847529
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); }
{ "code": [ " return -1;", " return kvm_vm_ioctl(kvm_state, KVM_PPC_GET_HTAB_FD, &s);" ], "line_no": [ 19, 25 ] }
int FUNC_0(bool VAR_0) { struct kvm_get_htab_fd VAR_1 = { .flags = VAR_0 ? 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, &VAR_1); }
[ "int FUNC_0(bool VAR_0)\n{", "struct kvm_get_htab_fd VAR_1 = {", ".flags = VAR_0 ? KVM_GET_HTAB_WRITE : 0,\n.start_index = 0,\n};", "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, &VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9, 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ] ]
25,420
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 */ } }
true
qemu
95a5befc2f8b359e72926f89cd661d063c2cf06c
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]); 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] = ' '; } }
{ "code": [], "line_no": [] }
static void FUNC_0(Object *VAR_0, const char *VAR_1, Error **VAR_2) { S390CcwMachineState *ms = S390_CCW_MACHINE(VAR_0); int VAR_3; for (VAR_3 = 0; VAR_3 < sizeof(ms->loadparm) && VAR_1[VAR_3]; VAR_3++) { uint8_t c = toupper(VAR_1[VAR_3]); if (('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') || (c == '.') || (c == ' ')) { ms->loadparm[VAR_3] = c; } else { error_setg(VAR_2, "LOADPARM: invalid character '%c' (ASCII 0x%02x)", c, c); return; } } for (; VAR_3 < sizeof(ms->loadparm); VAR_3++) { ms->loadparm[VAR_3] = ' '; } }
[ "static void FUNC_0(Object *VAR_0, const char *VAR_1, Error **VAR_2)\n{", "S390CcwMachineState *ms = S390_CCW_MACHINE(VAR_0);", "int VAR_3;", "for (VAR_3 = 0; VAR_3 < sizeof(ms->loadparm) && VAR_1[VAR_3]; VAR_3++) {", "uint8_t c = toupper(VAR_1[VAR_3]);", "if (('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') || (c == '.') ||\n(c == ' ')) {", "ms->loadparm[VAR_3] = c;", "} else {", "error_setg(VAR_2, \"LOADPARM: invalid character '%c' (ASCII 0x%02x)\",\nc, c);", "return;", "}", "}", "for (; VAR_3 < sizeof(ms->loadparm); VAR_3++) {", "ms->loadparm[VAR_3] = ' ';", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ] ]
25,421
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"); } }
true
qemu
7f1e9d4e138f5baf1e862a1221ba13eee7dcce9e
static void eepro100_cu_command(EEPRO100State * s, uint8_t val) { eepro100_tx_t tx; uint32_t cb_address; switch (val) { case CU_NOP: break; case CU_START: if (get_cu_state(s) != cu_idle) { logout("CU state is %u, should be %u\n", get_cu_state(s), cu_idle); } 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); uint16_t cmd = command & 0x0007; s->cu_offset = le32_to_cpu(tx.link); switch (cmd) { case CmdNOp: 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: 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(tcb_bytes <= 2600); if (!((tcb_bytes > 0) || (tbd_array != 0xffffffff))) { logout ("illegal values of TBD array address and TCB byte count!\n"); } 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); 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) { } else { uint8_t tbd_count = 0; if (device_supports_eTxCB(s) && !(s->configuration[6] & BIT(4))) { 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++; break; case CmdTDR: TRACE(OTHER, logout("load microcode\n")); break; default: missing("undefined command"); } stw_phys(cb_address, status | 0x8000 | 0x2000); if (bit_i) { eepro100_cx_interrupt(s); } if (bit_el) { set_cu_state(s, cu_idle); eepro100_cna_interrupt(s); } else if (bit_s) { set_cu_state(s, cu_suspended); eepro100_cna_interrupt(s); } else { TRACE(OTHER, logout("CU list with at least one more entry\n")); goto next_command; } TRACE(OTHER, logout("CU list empty\n")); break; case CU_RESUME: if (get_cu_state(s) != cu_suspended) { logout("bad CU resume from CU state %u\n", get_cu_state(s)); 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: s->statsaddr = s->pointer; TRACE(OTHER, logout("val=0x%02x (status address)\n", val)); break; case CU_SHOWSTATS: TRACE(OTHER, logout("val=0x%02x (dump stats)\n", val)); dump_statistics(s); break; case CU_CMD_BASE: TRACE(OTHER, logout("val=0x%02x (CU base address)\n", val)); s->cu_base = s->pointer; break; case CU_DUMPSTATS: 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: missing("CU static resume"); break; default: missing("Undefined CU command"); } }
{ "code": [ " assert(!bit_nc);", " assert(tcb_bytes <= 2600);", " assert(tcb_bytes == 0);", " stw_phys(cb_address, status | 0x8000 | 0x2000);" ], "line_no": [ 113, 117, 181, 285 ] }
static void FUNC_0(EEPRO100State * VAR_0, uint8_t VAR_1) { eepro100_tx_t tx; uint32_t cb_address; switch (VAR_1) { case CU_NOP: break; case CU_START: if (get_cu_state(VAR_0) != cu_idle) { logout("CU state is %u, should be %u\n", get_cu_state(VAR_0), cu_idle); } set_cu_state(VAR_0, cu_active); VAR_0->cu_offset = VAR_0->pointer; next_command: cb_address = VAR_0->cu_base + VAR_0->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 ("VAR_1=0x%02x (cu start), status=0x%04x, command=0x%04x, link=0x%08x\n", VAR_1, 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); uint16_t cmd = command & 0x0007; VAR_0->cu_offset = le32_to_cpu(tx.link); switch (cmd) { case CmdNOp: break; case CmdIASetup: cpu_physical_memory_read(cb_address + 8, &VAR_0->macaddr[0], 6); TRACE(OTHER, logout("macaddr: %VAR_0\n", nic_dump(&VAR_0->macaddr[0], 6))); break; case CmdConfigure: cpu_physical_memory_read(cb_address + 8, &VAR_0->configuration[0], sizeof(VAR_0->configuration)); TRACE(OTHER, logout("configuration: %VAR_0\n", nic_dump(&VAR_0->configuration[0], 16))); break; case CmdMulticastList: 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(tcb_bytes <= 2600); if (!((tcb_bytes > 0) || (tbd_array != 0xffffffff))) { logout ("illegal values of TBD array address and TCB byte count!\n"); } 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); 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) { } else { uint8_t tbd_count = 0; if (device_supports_eTxCB(VAR_0) && !(VAR_0->configuration[6] & BIT(4))) { 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,%VAR_0\n", VAR_0, size, nic_dump(buf, size))); qemu_send_packet(VAR_0->vc, buf, size); VAR_0->statistics.tx_good_frames++; break; case CmdTDR: TRACE(OTHER, logout("load microcode\n")); break; default: missing("undefined command"); } stw_phys(cb_address, status | 0x8000 | 0x2000); if (bit_i) { eepro100_cx_interrupt(VAR_0); } if (bit_el) { set_cu_state(VAR_0, cu_idle); eepro100_cna_interrupt(VAR_0); } else if (bit_s) { set_cu_state(VAR_0, cu_suspended); eepro100_cna_interrupt(VAR_0); } else { TRACE(OTHER, logout("CU list with at least one more entry\n")); goto next_command; } TRACE(OTHER, logout("CU list empty\n")); break; case CU_RESUME: if (get_cu_state(VAR_0) != cu_suspended) { logout("bad CU resume from CU state %u\n", get_cu_state(VAR_0)); set_cu_state(VAR_0, cu_suspended); } if (get_cu_state(VAR_0) == cu_suspended) { TRACE(OTHER, logout("CU resuming\n")); set_cu_state(VAR_0, cu_active); goto next_command; } break; case CU_STATSADDR: VAR_0->statsaddr = VAR_0->pointer; TRACE(OTHER, logout("VAR_1=0x%02x (status address)\n", VAR_1)); break; case CU_SHOWSTATS: TRACE(OTHER, logout("VAR_1=0x%02x (dump stats)\n", VAR_1)); dump_statistics(VAR_0); break; case CU_CMD_BASE: TRACE(OTHER, logout("VAR_1=0x%02x (CU base address)\n", VAR_1)); VAR_0->cu_base = VAR_0->pointer; break; case CU_DUMPSTATS: TRACE(OTHER, logout("VAR_1=0x%02x (dump stats and reset)\n", VAR_1)); dump_statistics(VAR_0); memset(&VAR_0->statistics, 0, sizeof(VAR_0->statistics)); break; case CU_SRESUME: missing("CU static resume"); break; default: missing("Undefined CU command"); } }
[ "static void FUNC_0(EEPRO100State * VAR_0, uint8_t VAR_1)\n{", "eepro100_tx_t tx;", "uint32_t cb_address;", "switch (VAR_1) {", "case CU_NOP:\nbreak;", "case CU_START:\nif (get_cu_state(VAR_0) != cu_idle) {", "logout(\"CU state is %u, should be %u\\n\", get_cu_state(VAR_0), cu_idle);", "}", "set_cu_state(VAR_0, cu_active);", "VAR_0->cu_offset = VAR_0->pointer;", "next_command:\ncb_address = VAR_0->cu_base + VAR_0->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\n(\"VAR_1=0x%02x (cu start), status=0x%04x, command=0x%04x, link=0x%08x\\n\",\nVAR_1, 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);", "uint16_t cmd = command & 0x0007;", "VAR_0->cu_offset = le32_to_cpu(tx.link);", "switch (cmd) {", "case CmdNOp:\nbreak;", "case CmdIASetup:\ncpu_physical_memory_read(cb_address + 8, &VAR_0->macaddr[0], 6);", "TRACE(OTHER, logout(\"macaddr: %VAR_0\\n\", nic_dump(&VAR_0->macaddr[0], 6)));", "break;", "case CmdConfigure:\ncpu_physical_memory_read(cb_address + 8, &VAR_0->configuration[0],\nsizeof(VAR_0->configuration));", "TRACE(OTHER, logout(\"configuration: %VAR_0\\n\", nic_dump(&VAR_0->configuration[0], 16)));", "break;", "case CmdMulticastList:\nbreak;", "case CmdTx:\n(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\n(\"transmit, TBD array address 0x%08x, TCB byte count 0x%04x, TBD count %u\\n\",\ntbd_array, tcb_bytes, tx.tbd_count));", "assert(!bit_nc);", "assert(tcb_bytes <= 2600);", "if (!((tcb_bytes > 0) || (tbd_array != 0xffffffff))) {", "logout\n(\"illegal values of TBD array address and TCB byte count!\\n\");", "}", "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);", "tbd_address += 8;", "TRACE(RXTX, logout\n(\"TBD (simplified mode): buffer address 0x%08x, size 0x%04x\\n\",\ntx_buffer_address, tx_buffer_size));", "tx_buffer_size = MIN(tx_buffer_size, sizeof(buf) - size);", "cpu_physical_memory_read(tx_buffer_address, &buf[size],\ntx_buffer_size);", "size += tx_buffer_size;", "}", "if (tbd_array == 0xffffffff) {", "} else {", "uint8_t tbd_count = 0;", "if (device_supports_eTxCB(VAR_0) && !(VAR_0->configuration[6] & BIT(4))) {", "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\n(\"TBD (extended flexible mode): buffer address 0x%08x, size 0x%04x\\n\",\ntx_buffer_address, tx_buffer_size));", "tx_buffer_size = MIN(tx_buffer_size, sizeof(buf) - size);", "cpu_physical_memory_read(tx_buffer_address, &buf[size],\ntx_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\n(\"TBD (flexible mode): buffer address 0x%08x, size 0x%04x\\n\",\ntx_buffer_address, tx_buffer_size));", "tx_buffer_size = MIN(tx_buffer_size, sizeof(buf) - size);", "cpu_physical_memory_read(tx_buffer_address, &buf[size],\ntx_buffer_size);", "size += tx_buffer_size;", "if (tx_buffer_el & 1) {", "break;", "}", "}", "}", "TRACE(RXTX, logout(\"%p sending frame, len=%d,%VAR_0\\n\", VAR_0, size, nic_dump(buf, size)));", "qemu_send_packet(VAR_0->vc, buf, size);", "VAR_0->statistics.tx_good_frames++;", "break;", "case CmdTDR:\nTRACE(OTHER, logout(\"load microcode\\n\"));", "break;", "default:\nmissing(\"undefined command\");", "}", "stw_phys(cb_address, status | 0x8000 | 0x2000);", "if (bit_i) {", "eepro100_cx_interrupt(VAR_0);", "}", "if (bit_el) {", "set_cu_state(VAR_0, cu_idle);", "eepro100_cna_interrupt(VAR_0);", "} else if (bit_s) {", "set_cu_state(VAR_0, cu_suspended);", "eepro100_cna_interrupt(VAR_0);", "} else {", "TRACE(OTHER, logout(\"CU list with at least one more entry\\n\"));", "goto next_command;", "}", "TRACE(OTHER, logout(\"CU list empty\\n\"));", "break;", "case CU_RESUME:\nif (get_cu_state(VAR_0) != cu_suspended) {", "logout(\"bad CU resume from CU state %u\\n\", get_cu_state(VAR_0));", "set_cu_state(VAR_0, cu_suspended);", "}", "if (get_cu_state(VAR_0) == cu_suspended) {", "TRACE(OTHER, logout(\"CU resuming\\n\"));", "set_cu_state(VAR_0, cu_active);", "goto next_command;", "}", "break;", "case CU_STATSADDR:\nVAR_0->statsaddr = VAR_0->pointer;", "TRACE(OTHER, logout(\"VAR_1=0x%02x (status address)\\n\", VAR_1));", "break;", "case CU_SHOWSTATS:\nTRACE(OTHER, logout(\"VAR_1=0x%02x (dump stats)\\n\", VAR_1));", "dump_statistics(VAR_0);", "break;", "case CU_CMD_BASE:\nTRACE(OTHER, logout(\"VAR_1=0x%02x (CU base address)\\n\", VAR_1));", "VAR_0->cu_base = VAR_0->pointer;", "break;", "case CU_DUMPSTATS:\nTRACE(OTHER, logout(\"VAR_1=0x%02x (dump stats and reset)\\n\", VAR_1));", "dump_statistics(VAR_0);", "memset(&VAR_0->statistics, 0, sizeof(VAR_0->statistics));", "break;", "case CU_SRESUME:\nmissing(\"CU static resume\");", "break;", "default:\nmissing(\"Undefined CU command\");", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11, 15 ], [ 17, 19 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 83, 85, 87 ], [ 89 ], [ 91 ], [ 93, 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107, 109, 111 ], [ 113 ], [ 117 ], [ 123 ], [ 125, 127 ], [ 129 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 151, 153, 155 ], [ 157 ], [ 159, 161 ], [ 163 ], [ 165 ], [ 167 ], [ 171 ], [ 175 ], [ 177 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193, 195, 197 ], [ 199 ], [ 201, 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229, 231, 233 ], [ 235 ], [ 237, 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 265 ], [ 267, 269 ], [ 275 ], [ 277, 279 ], [ 281 ], [ 285 ], [ 287 ], [ 291 ], [ 293 ], [ 295 ], [ 299 ], [ 301 ], [ 303 ], [ 307 ], [ 309 ], [ 311 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 325 ], [ 327, 329 ], [ 331 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355, 359 ], [ 361 ], [ 363 ], [ 365, 369 ], [ 371 ], [ 373 ], [ 375, 379 ], [ 381 ], [ 383 ], [ 385, 389 ], [ 391 ], [ 393 ], [ 395 ], [ 397, 401 ], [ 403 ], [ 405, 407 ], [ 409 ], [ 411 ] ]
25,422
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; }
true
FFmpeg
dfea94ce994a916eb7c1a278a09748fd3928c00d
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; }
{ "code": [ " ff_insert_inpad(ctx, INPUT_MAIN, &pad);", " ff_insert_inpad(ctx, INPUT_CLEANSRC, &pad);" ], "line_no": [ 25, 39 ] }
static av_cold int FUNC_0(AVFilterContext *ctx) { const FieldMatchContext *VAR_0 = 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 (VAR_0->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 ((VAR_0->blockx & (VAR_0->blockx - 1)) || (VAR_0->blocky & (VAR_0->blocky - 1))) { av_log(ctx, AV_LOG_ERROR, "blockx and blocky settings must be power of two\n"); return AVERROR(EINVAL); } if (VAR_0->combpel > VAR_0->blockx * VAR_0->blocky) { av_log(ctx, AV_LOG_ERROR, "Combed pixel should not be larger than blockx x blocky\n"); return AVERROR(EINVAL); } return 0; }
[ "static av_cold int FUNC_0(AVFilterContext *ctx)\n{", "const FieldMatchContext *VAR_0 = ctx->priv;", "AVFilterPad pad = {", ".name = av_strdup(\"main\"),\n.type = AVMEDIA_TYPE_VIDEO,\n.filter_frame = filter_frame,\n.config_props = config_input,\n};", "if (!pad.name)\nreturn AVERROR(ENOMEM);", "ff_insert_inpad(ctx, INPUT_MAIN, &pad);", "if (VAR_0->ppsrc) {", "pad.name = av_strdup(\"clean_src\");", "pad.config_props = NULL;", "if (!pad.name)\nreturn AVERROR(ENOMEM);", "ff_insert_inpad(ctx, INPUT_CLEANSRC, &pad);", "}", "if ((VAR_0->blockx & (VAR_0->blockx - 1)) ||\n(VAR_0->blocky & (VAR_0->blocky - 1))) {", "av_log(ctx, AV_LOG_ERROR, \"blockx and blocky settings must be power of two\\n\");", "return AVERROR(EINVAL);", "}", "if (VAR_0->combpel > VAR_0->blockx * VAR_0->blocky) {", "av_log(ctx, AV_LOG_ERROR, \"Combed pixel should not be larger than blockx x blocky\\n\");", "return AVERROR(EINVAL);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11, 13, 15, 17 ], [ 21, 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ] ]
25,423
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); }
true
qemu
80ee15a6b274dfcedb0ad7db8c9e7d392210d6a1
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); }
{ "code": [ " if (offset + i * cluster_size != (be64_to_cpu(l2_table[i]) & ~mask))" ], "line_no": [ 21 ] }
static int FUNC_0(uint64_t VAR_0, int VAR_1, uint64_t *VAR_2, uint64_t VAR_3, uint64_t VAR_4) { int VAR_5; uint64_t offset = be64_to_cpu(VAR_2[0]) & ~VAR_4; if (!offset) return 0; for (VAR_5 = VAR_3; VAR_5 < VAR_3 + VAR_0; VAR_5++) if (offset + VAR_5 * VAR_1 != (be64_to_cpu(VAR_2[VAR_5]) & ~VAR_4)) break; return (VAR_5 - VAR_3); }
[ "static int FUNC_0(uint64_t VAR_0, int VAR_1,\nuint64_t *VAR_2, uint64_t VAR_3, uint64_t VAR_4)\n{", "int VAR_5;", "uint64_t offset = be64_to_cpu(VAR_2[0]) & ~VAR_4;", "if (!offset)\nreturn 0;", "for (VAR_5 = VAR_3; VAR_5 < VAR_3 + VAR_0; VAR_5++)", "if (offset + VAR_5 * VAR_1 != (be64_to_cpu(VAR_2[VAR_5]) & ~VAR_4))\nbreak;", "return (VAR_5 - VAR_3);", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 19 ], [ 21, 23 ], [ 27 ], [ 29 ] ]
25,424
static void gen_ove_ov(DisasContext *dc, TCGv ov) { gen_helper_ove(cpu_env, ov); }
true
qemu
0c53d7342b4e8412f3b81eed67f053304813dc5d
static void gen_ove_ov(DisasContext *dc, TCGv ov) { gen_helper_ove(cpu_env, ov); }
{ "code": [ " gen_helper_ove(cpu_env, ov);" ], "line_no": [ 5 ] }
static void FUNC_0(DisasContext *VAR_0, TCGv VAR_1) { gen_helper_ove(cpu_env, VAR_1); }
[ "static void FUNC_0(DisasContext *VAR_0, TCGv VAR_1)\n{", "gen_helper_ove(cpu_env, VAR_1);", "}" ]
[ 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
25,425
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); }
false
FFmpeg
6bd665b7c5798803366b877903fa3bce7f129d05
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); }
{ "code": [], "line_no": [] }
void FUNC_0(GetBitContext *VAR_0, TAKStreamInfo *VAR_1) { uint64_t channel_mask = 0; int VAR_2, VAR_3; VAR_1->codec = get_bits(VAR_0, TAK_ENCODER_CODEC_BITS); skip_bits(VAR_0, TAK_ENCODER_PROFILE_BITS); VAR_2 = get_bits(VAR_0, TAK_SIZE_FRAME_DURATION_BITS); VAR_1->samples = get_bits64(VAR_0, TAK_SIZE_SAMPLES_NUM_BITS); VAR_1->data_type = get_bits(VAR_0, TAK_FORMAT_DATA_TYPE_BITS); VAR_1->sample_rate = get_bits(VAR_0, TAK_FORMAT_SAMPLE_RATE_BITS) + TAK_SAMPLE_RATE_MIN; VAR_1->bps = get_bits(VAR_0, TAK_FORMAT_BPS_BITS) + TAK_BPS_MIN; VAR_1->channels = get_bits(VAR_0, TAK_FORMAT_CHANNEL_BITS) + TAK_CHANNELS_MIN; if (get_bits1(VAR_0)) { skip_bits(VAR_0, TAK_FORMAT_VALID_BITS); if (get_bits1(VAR_0)) { for (VAR_3 = 0; VAR_3 < VAR_1->channels; VAR_3++) { int value = get_bits(VAR_0, TAK_FORMAT_CH_LAYOUT_BITS); if (value < FF_ARRAY_ELEMS(tak_channel_layouts)) channel_mask |= tak_channel_layouts[value]; } } } VAR_1->ch_layout = channel_mask; VAR_1->frame_samples = tak_get_nb_samples(VAR_1->sample_rate, VAR_2); }
[ "void FUNC_0(GetBitContext *VAR_0, TAKStreamInfo *VAR_1)\n{", "uint64_t channel_mask = 0;", "int VAR_2, VAR_3;", "VAR_1->codec = get_bits(VAR_0, TAK_ENCODER_CODEC_BITS);", "skip_bits(VAR_0, TAK_ENCODER_PROFILE_BITS);", "VAR_2 = get_bits(VAR_0, TAK_SIZE_FRAME_DURATION_BITS);", "VAR_1->samples = get_bits64(VAR_0, TAK_SIZE_SAMPLES_NUM_BITS);", "VAR_1->data_type = get_bits(VAR_0, TAK_FORMAT_DATA_TYPE_BITS);", "VAR_1->sample_rate = get_bits(VAR_0, TAK_FORMAT_SAMPLE_RATE_BITS) +\nTAK_SAMPLE_RATE_MIN;", "VAR_1->bps = get_bits(VAR_0, TAK_FORMAT_BPS_BITS) +\nTAK_BPS_MIN;", "VAR_1->channels = get_bits(VAR_0, TAK_FORMAT_CHANNEL_BITS) +\nTAK_CHANNELS_MIN;", "if (get_bits1(VAR_0)) {", "skip_bits(VAR_0, TAK_FORMAT_VALID_BITS);", "if (get_bits1(VAR_0)) {", "for (VAR_3 = 0; VAR_3 < VAR_1->channels; VAR_3++) {", "int value = get_bits(VAR_0, TAK_FORMAT_CH_LAYOUT_BITS);", "if (value < FF_ARRAY_ELEMS(tak_channel_layouts))\nchannel_mask |= tak_channel_layouts[value];", "}", "}", "}", "VAR_1->ch_layout = channel_mask;", "VAR_1->frame_samples = tak_get_nb_samples(VAR_1->sample_rate, VAR_2);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25, 27 ], [ 29, 31 ], [ 33, 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ] ]
25,426
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; }
false
FFmpeg
f929ab0569ff31ed5a59b0b0adb7ce09df3fca39
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; }
{ "code": [], "line_no": [] }
int FUNC_0(void *VAR_0, const char *VAR_1, const char *VAR_2) { AVInputFormat *ifmt = NULL; AVOutputFormat *ofmt = NULL; const char *VAR_3; printf("File formats:\n" " D. = Demuxing supported\n" " .E = Muxing supported\n" " --\n"); VAR_3 = "000"; for (;;) { int VAR_4 = 0; int VAR_5 = 0; const char *VAR_6 = NULL; const char *VAR_7 = NULL; while ((ofmt = av_oformat_next(ofmt))) { if ((VAR_6 == NULL || strcmp(ofmt->VAR_6, VAR_6) < 0) && strcmp(ofmt->VAR_6, VAR_3) > 0) { VAR_6 = ofmt->VAR_6; VAR_7 = ofmt->VAR_7; VAR_5 = 1; } } while ((ifmt = av_iformat_next(ifmt))) { if ((VAR_6 == NULL || strcmp(ifmt->VAR_6, VAR_6) < 0) && strcmp(ifmt->VAR_6, VAR_3) > 0) { VAR_6 = ifmt->VAR_6; VAR_7 = ifmt->VAR_7; VAR_5 = 0; } if (VAR_6 && strcmp(ifmt->VAR_6, VAR_6) == 0) VAR_4 = 1; } if (VAR_6 == NULL) break; VAR_3 = VAR_6; printf(" %s%s %-15s %s\n", VAR_4 ? "D" : " ", VAR_5 ? "E" : " ", VAR_6, VAR_7 ? VAR_7:" "); } return 0; }
[ "int FUNC_0(void *VAR_0, const char *VAR_1, const char *VAR_2)\n{", "AVInputFormat *ifmt = NULL;", "AVOutputFormat *ofmt = NULL;", "const char *VAR_3;", "printf(\"File formats:\\n\"\n\" D. = Demuxing supported\\n\"\n\" .E = Muxing supported\\n\"\n\" --\\n\");", "VAR_3 = \"000\";", "for (;;) {", "int VAR_4 = 0;", "int VAR_5 = 0;", "const char *VAR_6 = NULL;", "const char *VAR_7 = NULL;", "while ((ofmt = av_oformat_next(ofmt))) {", "if ((VAR_6 == NULL || strcmp(ofmt->VAR_6, VAR_6) < 0) &&\nstrcmp(ofmt->VAR_6, VAR_3) > 0) {", "VAR_6 = ofmt->VAR_6;", "VAR_7 = ofmt->VAR_7;", "VAR_5 = 1;", "}", "}", "while ((ifmt = av_iformat_next(ifmt))) {", "if ((VAR_6 == NULL || strcmp(ifmt->VAR_6, VAR_6) < 0) &&\nstrcmp(ifmt->VAR_6, VAR_3) > 0) {", "VAR_6 = ifmt->VAR_6;", "VAR_7 = ifmt->VAR_7;", "VAR_5 = 0;", "}", "if (VAR_6 && strcmp(ifmt->VAR_6, VAR_6) == 0)\nVAR_4 = 1;", "}", "if (VAR_6 == NULL)\nbreak;", "VAR_3 = VAR_6;", "printf(\" %s%s %-15s %s\\n\",\nVAR_4 ? \"D\" : \" \",\nVAR_5 ? \"E\" : \" \",\nVAR_6,\nVAR_7 ? VAR_7:\" \");", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15, 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 79, 81, 83, 85, 87 ], [ 89 ], [ 91 ], [ 93 ] ]
25,427
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]; }
false
FFmpeg
be394968c81019887ef996a78a526bdd85d1e216
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]; }
{ "code": [], "line_no": [] }
static void FUNC_0(resample_nearest)(void *dst0, int dst_index, const void *src0, int index) { FELEM *dst = dst0; const FELEM *VAR_0 = src0; dst[dst_index] = VAR_0[index]; }
[ "static void FUNC_0(resample_nearest)(void *dst0, int dst_index, const void *src0, int index)\n{", "FELEM *dst = dst0;", "const FELEM *VAR_0 = src0;", "dst[dst_index] = VAR_0[index];", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
25,428
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); }
false
FFmpeg
17779f39b684cd8e545768155c37e97e604489b8
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]) 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 > pic_width + extra_width || full_my + 16 > 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, 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); 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){ 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, (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, (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); }
{ "code": [], "line_no": [] }
static inline void FUNC_0(H264Context *VAR_0, Picture *VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6, uint8_t *VAR_7, uint8_t *VAR_8, uint8_t *VAR_9, int VAR_10, int VAR_11, qpel_mc_func *VAR_12, h264_chroma_mc_func VAR_13){ MpegEncContext * const s = &VAR_0->s; const int VAR_14= VAR_0->mv_cache[VAR_6][ scan8[VAR_2] ][0] + VAR_10*8; int VAR_15= VAR_0->mv_cache[VAR_6][ scan8[VAR_2] ][1] + VAR_11*8; const int VAR_16= (VAR_14&3) + ((VAR_15&3)<<2); uint8_t * src_y = VAR_1->data[0] + (VAR_14>>2) + (VAR_15>>2)*VAR_0->mb_linesize; uint8_t * src_cb, * src_cr; int VAR_17= VAR_0->emu_edge_width; int VAR_18= VAR_0->emu_edge_height; int VAR_19=0; const int VAR_20= VAR_14>>2; const int VAR_21= VAR_15>>2; const int VAR_22 = 16*s->mb_width; const int VAR_23 = 16*s->mb_height >> MB_FIELD; if(!VAR_1->data[0]) return; if(VAR_14&7) VAR_17 -= 3; if(VAR_15&7) VAR_18 -= 3; if( VAR_20 < 0-VAR_17 || VAR_21 < 0-VAR_18 || VAR_20 + 16 > VAR_22 + VAR_17 || VAR_21 + 16 > VAR_23 + VAR_18){ ff_emulated_edge_mc(s->edge_emu_buffer, src_y - 2 - 2*VAR_0->mb_linesize, VAR_0->mb_linesize, 16+5, 16+5, VAR_20-2, VAR_21-2, VAR_22, VAR_23); src_y= s->edge_emu_buffer + 2 + 2*VAR_0->mb_linesize; VAR_19=1; } VAR_12[VAR_16](VAR_7, src_y, VAR_0->mb_linesize); if(!VAR_3){ VAR_12[VAR_16](VAR_7 + VAR_5, src_y + VAR_5, VAR_0->mb_linesize); } if(ENABLE_GRAY && s->flags&CODEC_FLAG_GRAY) return; if(MB_FIELD){ VAR_15 += 2 * ((s->mb_y & 1) - (VAR_1->reference - 1)); VAR_19 |= (VAR_15>>3) < 0 || (VAR_15>>3) + 8 >= (VAR_23>>1); } src_cb= VAR_1->data[1] + (VAR_14>>3) + (VAR_15>>3)*VAR_0->mb_uvlinesize; src_cr= VAR_1->data[2] + (VAR_14>>3) + (VAR_15>>3)*VAR_0->mb_uvlinesize; if(VAR_19){ ff_emulated_edge_mc(s->edge_emu_buffer, src_cb, VAR_0->mb_uvlinesize, 9, 9, (VAR_14>>3), (VAR_15>>3), VAR_22>>1, VAR_23>>1); src_cb= s->edge_emu_buffer; } VAR_13(VAR_8, src_cb, VAR_0->mb_uvlinesize, VAR_4, VAR_14&7, VAR_15&7); if(VAR_19){ ff_emulated_edge_mc(s->edge_emu_buffer, src_cr, VAR_0->mb_uvlinesize, 9, 9, (VAR_14>>3), (VAR_15>>3), VAR_22>>1, VAR_23>>1); src_cr= s->edge_emu_buffer; } VAR_13(VAR_9, src_cr, VAR_0->mb_uvlinesize, VAR_4, VAR_14&7, VAR_15&7); }
[ "static inline void FUNC_0(H264Context *VAR_0, Picture *VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6,\nuint8_t *VAR_7, uint8_t *VAR_8, uint8_t *VAR_9,\nint VAR_10, int VAR_11,\nqpel_mc_func *VAR_12, h264_chroma_mc_func VAR_13){", "MpegEncContext * const s = &VAR_0->s;", "const int VAR_14= VAR_0->mv_cache[VAR_6][ scan8[VAR_2] ][0] + VAR_10*8;", "int VAR_15= VAR_0->mv_cache[VAR_6][ scan8[VAR_2] ][1] + VAR_11*8;", "const int VAR_16= (VAR_14&3) + ((VAR_15&3)<<2);", "uint8_t * src_y = VAR_1->data[0] + (VAR_14>>2) + (VAR_15>>2)*VAR_0->mb_linesize;", "uint8_t * src_cb, * src_cr;", "int VAR_17= VAR_0->emu_edge_width;", "int VAR_18= VAR_0->emu_edge_height;", "int VAR_19=0;", "const int VAR_20= VAR_14>>2;", "const int VAR_21= VAR_15>>2;", "const int VAR_22 = 16*s->mb_width;", "const int VAR_23 = 16*s->mb_height >> MB_FIELD;", "if(!VAR_1->data[0])\nreturn;", "if(VAR_14&7) VAR_17 -= 3;", "if(VAR_15&7) VAR_18 -= 3;", "if( VAR_20 < 0-VAR_17\n|| VAR_21 < 0-VAR_18\n|| VAR_20 + 16 > VAR_22 + VAR_17\n|| VAR_21 + 16 > VAR_23 + VAR_18){", "ff_emulated_edge_mc(s->edge_emu_buffer, src_y - 2 - 2*VAR_0->mb_linesize, VAR_0->mb_linesize, 16+5, 16+5, VAR_20-2, VAR_21-2, VAR_22, VAR_23);", "src_y= s->edge_emu_buffer + 2 + 2*VAR_0->mb_linesize;", "VAR_19=1;", "}", "VAR_12[VAR_16](VAR_7, src_y, VAR_0->mb_linesize);", "if(!VAR_3){", "VAR_12[VAR_16](VAR_7 + VAR_5, src_y + VAR_5, VAR_0->mb_linesize);", "}", "if(ENABLE_GRAY && s->flags&CODEC_FLAG_GRAY) return;", "if(MB_FIELD){", "VAR_15 += 2 * ((s->mb_y & 1) - (VAR_1->reference - 1));", "VAR_19 |= (VAR_15>>3) < 0 || (VAR_15>>3) + 8 >= (VAR_23>>1);", "}", "src_cb= VAR_1->data[1] + (VAR_14>>3) + (VAR_15>>3)*VAR_0->mb_uvlinesize;", "src_cr= VAR_1->data[2] + (VAR_14>>3) + (VAR_15>>3)*VAR_0->mb_uvlinesize;", "if(VAR_19){", "ff_emulated_edge_mc(s->edge_emu_buffer, src_cb, VAR_0->mb_uvlinesize, 9, 9, (VAR_14>>3), (VAR_15>>3), VAR_22>>1, VAR_23>>1);", "src_cb= s->edge_emu_buffer;", "}", "VAR_13(VAR_8, src_cb, VAR_0->mb_uvlinesize, VAR_4, VAR_14&7, VAR_15&7);", "if(VAR_19){", "ff_emulated_edge_mc(s->edge_emu_buffer, src_cr, VAR_0->mb_uvlinesize, 9, 9, (VAR_14>>3), (VAR_15>>3), VAR_22>>1, VAR_23>>1);", "src_cr= s->edge_emu_buffer;", "}", "VAR_13(VAR_9, src_cr, VAR_0->mb_uvlinesize, VAR_4, VAR_14&7, VAR_15&7);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37, 39 ], [ 43 ], [ 45 ], [ 49, 51, 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ] ]
25,429
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); }
false
FFmpeg
57f94f54c449b1d34b0d6ccf82dfdcdc1ce7cd14
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); }
{ "code": [], "line_no": [] }
static void FUNC_0(AVFormatContext *VAR_0, const char *VAR_1, RTSPMessageHeader *VAR_2, unsigned char **VAR_3) { RTSPState *rt = VAR_0->priv_data; char VAR_4[4096], VAR_5[1024]; rt->seq++; av_strlcpy(VAR_4, VAR_1, sizeof(VAR_4)); snprintf(VAR_5, sizeof(VAR_5), "CSeq: %d\r\n", rt->seq); av_strlcat(VAR_4, VAR_5, sizeof(VAR_4)); if (rt->session_id[0] != '\0' && !strstr(VAR_1, "\nIf-Match:")) { snprintf(VAR_5, sizeof(VAR_5), "Session: %VAR_0\r\n", rt->session_id); av_strlcat(VAR_4, VAR_5, sizeof(VAR_4)); } av_strlcat(VAR_4, "\r\n", sizeof(VAR_4)); #ifdef DEBUG printf("Sending:\n%VAR_0--\n", VAR_4); #endif url_write(rt->rtsp_hd, VAR_4, strlen(VAR_4)); rtsp_read_reply(rt, VAR_2, VAR_3); }
[ "static void FUNC_0(AVFormatContext *VAR_0,\nconst char *VAR_1, RTSPMessageHeader *VAR_2,\nunsigned char **VAR_3)\n{", "RTSPState *rt = VAR_0->priv_data;", "char VAR_4[4096], VAR_5[1024];", "rt->seq++;", "av_strlcpy(VAR_4, VAR_1, sizeof(VAR_4));", "snprintf(VAR_5, sizeof(VAR_5), \"CSeq: %d\\r\\n\", rt->seq);", "av_strlcat(VAR_4, VAR_5, sizeof(VAR_4));", "if (rt->session_id[0] != '\\0' && !strstr(VAR_1, \"\\nIf-Match:\")) {", "snprintf(VAR_5, sizeof(VAR_5), \"Session: %VAR_0\\r\\n\", rt->session_id);", "av_strlcat(VAR_4, VAR_5, sizeof(VAR_4));", "}", "av_strlcat(VAR_4, \"\\r\\n\", sizeof(VAR_4));", "#ifdef DEBUG\nprintf(\"Sending:\\n%VAR_0--\\n\", VAR_4);", "#endif\nurl_write(rt->rtsp_hd, VAR_4, strlen(VAR_4));", "rtsp_read_reply(rt, VAR_2, VAR_3);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37, 39 ], [ 43 ], [ 45 ] ]
25,430
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; }
false
FFmpeg
79a7451d069f17c72e566d8e76a75c15cc25c515
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; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFilterGraph *VAR_0, VideoState *VAR_1, const char *VAR_2) { static const enum PixelFormat VAR_3[] = { PIX_FMT_YUV420P, PIX_FMT_NONE }; char VAR_4[128]; char VAR_5[256]; int VAR_6; AVBufferSinkParams *buffersink_params = av_buffersink_params_alloc(); AVFilterContext *filt_src = NULL, *filt_out = NULL, *filt_format; AVCodecContext *codec = VAR_1->video_st->codec; snprintf(VAR_4, sizeof(VAR_4), "flags=%d", sws_flags); VAR_0->scale_sws_opts = av_strdup(VAR_4); snprintf(VAR_5, sizeof(VAR_5), "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:pixel_aspect=%d/%d", codec->width, codec->height, codec->pix_fmt, VAR_1->video_st->time_base.num, VAR_1->video_st->time_base.den, codec->sample_aspect_ratio.num, codec->sample_aspect_ratio.den); if ((VAR_6 = avfilter_graph_create_filter(&filt_src, avfilter_get_by_name("buffer"), "ffplay_buffer", VAR_5, NULL, VAR_0)) < 0) return VAR_6; buffersink_params->pixel_fmts = VAR_3; VAR_6 = avfilter_graph_create_filter(&filt_out, avfilter_get_by_name("buffersink"), "ffplay_buffersink", NULL, buffersink_params, VAR_0); av_freep(&buffersink_params); if (VAR_6 < 0) return VAR_6; if ((VAR_6 = avfilter_graph_create_filter(&filt_format, avfilter_get_by_name("format"), "format", "yuv420p", NULL, VAR_0)) < 0) return VAR_6; if ((VAR_6 = avfilter_link(filt_format, 0, filt_out, 0)) < 0) return VAR_6; if (VAR_2) { 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 ((VAR_6 = avfilter_graph_parse(VAR_0, VAR_2, &inputs, &outputs, NULL)) < 0) return VAR_6; } else { if ((VAR_6 = avfilter_link(filt_src, 0, filt_format, 0)) < 0) return VAR_6; } if ((VAR_6 = avfilter_graph_config(VAR_0, NULL)) < 0) return VAR_6; VAR_1->in_video_filter = filt_src; VAR_1->out_video_filter = filt_out; if (codec->codec->capabilities & CODEC_CAP_DR1) { VAR_1->use_dr1 = 1; codec->get_buffer = codec_get_buffer; codec->release_buffer = codec_release_buffer; codec->opaque = &VAR_1->buffer_pool; } return VAR_6; }
[ "static int FUNC_0(AVFilterGraph *VAR_0, VideoState *VAR_1, const char *VAR_2)\n{", "static const enum PixelFormat VAR_3[] = { PIX_FMT_YUV420P, PIX_FMT_NONE };", "char VAR_4[128];", "char VAR_5[256];", "int VAR_6;", "AVBufferSinkParams *buffersink_params = av_buffersink_params_alloc();", "AVFilterContext *filt_src = NULL, *filt_out = NULL, *filt_format;", "AVCodecContext *codec = VAR_1->video_st->codec;", "snprintf(VAR_4, sizeof(VAR_4), \"flags=%d\", sws_flags);", "VAR_0->scale_sws_opts = av_strdup(VAR_4);", "snprintf(VAR_5, sizeof(VAR_5),\n\"video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:pixel_aspect=%d/%d\",\ncodec->width, codec->height, codec->pix_fmt,\nVAR_1->video_st->time_base.num, VAR_1->video_st->time_base.den,\ncodec->sample_aspect_ratio.num, codec->sample_aspect_ratio.den);", "if ((VAR_6 = avfilter_graph_create_filter(&filt_src,\navfilter_get_by_name(\"buffer\"),\n\"ffplay_buffer\", VAR_5, NULL,\nVAR_0)) < 0)\nreturn VAR_6;", "buffersink_params->pixel_fmts = VAR_3;", "VAR_6 = avfilter_graph_create_filter(&filt_out,\navfilter_get_by_name(\"buffersink\"),\n\"ffplay_buffersink\", NULL, buffersink_params, VAR_0);", "av_freep(&buffersink_params);", "if (VAR_6 < 0)\nreturn VAR_6;", "if ((VAR_6 = avfilter_graph_create_filter(&filt_format,\navfilter_get_by_name(\"format\"),\n\"format\", \"yuv420p\", NULL, VAR_0)) < 0)\nreturn VAR_6;", "if ((VAR_6 = avfilter_link(filt_format, 0, filt_out, 0)) < 0)\nreturn VAR_6;", "if (VAR_2) {", "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 ((VAR_6 = avfilter_graph_parse(VAR_0, VAR_2, &inputs, &outputs, NULL)) < 0)\nreturn VAR_6;", "} else {", "if ((VAR_6 = avfilter_link(filt_src, 0, filt_format, 0)) < 0)\nreturn VAR_6;", "}", "if ((VAR_6 = avfilter_graph_config(VAR_0, NULL)) < 0)\nreturn VAR_6;", "VAR_1->in_video_filter = filt_src;", "VAR_1->out_video_filter = filt_out;", "if (codec->codec->capabilities & CODEC_CAP_DR1) {", "VAR_1->use_dr1 = 1;", "codec->get_buffer = codec_get_buffer;", "codec->release_buffer = codec_release_buffer;", "codec->opaque = &VAR_1->buffer_pool;", "}", "return VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 27, 29, 31, 33, 35 ], [ 39, 41, 43, 45, 47 ], [ 51 ], [ 53, 55, 57 ], [ 59 ], [ 61, 63 ], [ 67, 69, 71, 73 ], [ 75, 77 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111, 113 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 125, 127 ], [ 131 ], [ 133 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ] ]
25,431
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; }
true
qemu
2ba1eeb62c29d23238b95dc7e9ade3444b49f0a1
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_icache_range((unsigned long)gen_code_buf, (unsigned long)s->code_ptr); return s->code_ptr - gen_code_buf; }
{ "code": [ " tcg_gen_code_common(s, gen_code_buf, 0, NULL);" ], "line_no": [ 29 ] }
int FUNC_0(TCGContext *VAR_0, uint8_t *VAR_1) { #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(VAR_0, VAR_1, 0, NULL); flush_icache_range((unsigned long)VAR_1, (unsigned long)VAR_0->code_ptr); return VAR_0->code_ptr - VAR_1; }
[ "int FUNC_0(TCGContext *VAR_0, uint8_t *VAR_1)\n{", "#ifdef CONFIG_PROFILER\n{", "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)\ndyngen_op_count_max = n;", "}", "#endif\ntcg_gen_code_common(VAR_0, VAR_1, 0, NULL);", "flush_icache_range((unsigned long)VAR_1,\n(unsigned long)VAR_0->code_ptr);", "return VAR_0->code_ptr - VAR_1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25, 29 ], [ 35, 37 ], [ 39 ], [ 41 ] ]
25,432
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;
true
qemu
6bf45d59f98c898b7d7997a333765c8ee41236ea
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); 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 (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); *refcount_block = NULL; ret = qcow2_cache_flush(bs, s->l2_table_cache); if (ret < 0) { return ret; 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)) { 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); int block_index = (new_block >> s->cluster_bits) & (s->refcount_block_size - 1); s->set_refcount(*refcount_block, block_index, 1); } else { 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; 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); 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 (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; s->max_refcount_table_index = MAX(s->max_refcount_table_index, refcount_table_index); return -EAGAIN; qcow2_cache_put(bs, s->refcount_block_cache, refcount_block); BLKDBG_EVENT(bs->file, BLKDBG_REFTABLE_GROW); uint64_t blocks_used = DIV_ROUND_UP(MAX(cluster_index + 1, (new_block >> s->cluster_bits) + 1), s->refcount_block_size); 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; return -EAGAIN; fail: if (*refcount_block != NULL) { qcow2_cache_put(bs, s->refcount_block_cache, refcount_block); return ret;
{ "code": [], "line_no": [] }
static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1, void **VAR_2) { BDRVQcow2State *s = VAR_0->opaque; unsigned int VAR_3; int64_t ret; BLKDBG_EVENT(VAR_0->file, BLKDBG_REFBLOCK_ALLOC); VAR_3 = VAR_1 >> s->refcount_block_bits; if (VAR_3 < s->refcount_table_size) { uint64_t refcount_block_offset = s->refcount_table[VAR_3] & REFT_OFFSET_MASK; if (refcount_block_offset) { if (offset_into_cluster(s, refcount_block_offset)) { qcow2_signal_corruption(VAR_0, true, -1, -1, "Refblock offset %#" PRIx64 " unaligned (reftable index: " "%#x)", refcount_block_offset, VAR_3); return load_refcount_block(VAR_0, refcount_block_offset, VAR_2); *VAR_2 = NULL; ret = qcow2_cache_flush(VAR_0, s->l2_table_cache); if (ret < 0) { return ret; int64_t new_block = alloc_clusters_noref(VAR_0, 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", VAR_3, VAR_1 << s->cluster_bits, new_block); #endif if (in_same_refcount_block(s, new_block, VAR_1 << s->cluster_bits)) { ret = qcow2_cache_get_empty(VAR_0, s->refcount_block_cache, new_block, VAR_2); if (ret < 0) { goto fail; memset(*VAR_2, 0, s->cluster_size); int VAR_4 = (new_block >> s->cluster_bits) & (s->refcount_block_size - 1); s->set_refcount(*VAR_2, VAR_4, 1); } else { ret = update_refcount(VAR_0, new_block, s->cluster_size, 1, false, QCOW2_DISCARD_NEVER); if (ret < 0) { goto fail; ret = qcow2_cache_flush(VAR_0, s->refcount_block_cache); if (ret < 0) { goto fail; ret = qcow2_cache_get_empty(VAR_0, s->refcount_block_cache, new_block, VAR_2); if (ret < 0) { goto fail; memset(*VAR_2, 0, s->cluster_size); BLKDBG_EVENT(VAR_0->file, BLKDBG_REFBLOCK_ALLOC_WRITE); qcow2_cache_entry_mark_dirty(VAR_0, s->refcount_block_cache, *VAR_2); ret = qcow2_cache_flush(VAR_0, s->refcount_block_cache); if (ret < 0) { goto fail; if (VAR_3 < s->refcount_table_size) { uint64_t data64 = cpu_to_be64(new_block); BLKDBG_EVENT(VAR_0->file, BLKDBG_REFBLOCK_ALLOC_HOOKUP); ret = bdrv_pwrite_sync(VAR_0->file, s->refcount_table_offset + VAR_3 * sizeof(uint64_t), &data64, sizeof(data64)); if (ret < 0) { goto fail; s->refcount_table[VAR_3] = new_block; s->max_refcount_table_index = MAX(s->max_refcount_table_index, VAR_3); return -EAGAIN; qcow2_cache_put(VAR_0, s->refcount_block_cache, VAR_2); BLKDBG_EVENT(VAR_0->file, BLKDBG_REFTABLE_GROW); uint64_t blocks_used = DIV_ROUND_UP(MAX(VAR_1 + 1, (new_block >> s->cluster_bits) + 1), s->refcount_block_size); uint64_t meta_offset = (blocks_used * s->refcount_block_size) * s->cluster_size; ret = qcow2_refcount_area(VAR_0, meta_offset, 0, false, VAR_3, new_block); if (ret < 0) { return ret; ret = load_refcount_block(VAR_0, new_block, VAR_2); if (ret < 0) { return ret; return -EAGAIN; fail: if (*VAR_2 != NULL) { qcow2_cache_put(VAR_0, s->refcount_block_cache, VAR_2); return ret;
[ "static int FUNC_0(BlockDriverState *VAR_0,\nint64_t VAR_1, void **VAR_2)\n{", "BDRVQcow2State *s = VAR_0->opaque;", "unsigned int VAR_3;", "int64_t ret;", "BLKDBG_EVENT(VAR_0->file, BLKDBG_REFBLOCK_ALLOC);", "VAR_3 = VAR_1 >> s->refcount_block_bits;", "if (VAR_3 < s->refcount_table_size) {", "uint64_t refcount_block_offset =\ns->refcount_table[VAR_3] & REFT_OFFSET_MASK;", "if (refcount_block_offset) {", "if (offset_into_cluster(s, refcount_block_offset)) {", "qcow2_signal_corruption(VAR_0, true, -1, -1, \"Refblock offset %#\"\nPRIx64 \" unaligned (reftable index: \"\n\"%#x)\", refcount_block_offset,\nVAR_3);", "return load_refcount_block(VAR_0, refcount_block_offset,\nVAR_2);", "*VAR_2 = NULL;", "ret = qcow2_cache_flush(VAR_0, s->l2_table_cache);", "if (ret < 0) {", "return ret;", "int64_t new_block = alloc_clusters_noref(VAR_0, s->cluster_size);", "if (new_block < 0) {", "return new_block;", "#ifdef DEBUG_ALLOC2\nfprintf(stderr, \"qcow2: Allocate refcount block %d for %\" PRIx64\n\" at %\" PRIx64 \"\\n\",\nVAR_3, VAR_1 << s->cluster_bits, new_block);", "#endif\nif (in_same_refcount_block(s, new_block, VAR_1 << s->cluster_bits)) {", "ret = qcow2_cache_get_empty(VAR_0, s->refcount_block_cache, new_block,\nVAR_2);", "if (ret < 0) {", "goto fail;", "memset(*VAR_2, 0, s->cluster_size);", "int VAR_4 = (new_block >> s->cluster_bits) &\n(s->refcount_block_size - 1);", "s->set_refcount(*VAR_2, VAR_4, 1);", "} else {", "ret = update_refcount(VAR_0, new_block, s->cluster_size, 1, false,\nQCOW2_DISCARD_NEVER);", "if (ret < 0) {", "goto fail;", "ret = qcow2_cache_flush(VAR_0, s->refcount_block_cache);", "if (ret < 0) {", "goto fail;", "ret = qcow2_cache_get_empty(VAR_0, s->refcount_block_cache, new_block,\nVAR_2);", "if (ret < 0) {", "goto fail;", "memset(*VAR_2, 0, s->cluster_size);", "BLKDBG_EVENT(VAR_0->file, BLKDBG_REFBLOCK_ALLOC_WRITE);", "qcow2_cache_entry_mark_dirty(VAR_0, s->refcount_block_cache, *VAR_2);", "ret = qcow2_cache_flush(VAR_0, s->refcount_block_cache);", "if (ret < 0) {", "goto fail;", "if (VAR_3 < s->refcount_table_size) {", "uint64_t data64 = cpu_to_be64(new_block);", "BLKDBG_EVENT(VAR_0->file, BLKDBG_REFBLOCK_ALLOC_HOOKUP);", "ret = bdrv_pwrite_sync(VAR_0->file,\ns->refcount_table_offset + VAR_3 * sizeof(uint64_t),\n&data64, sizeof(data64));", "if (ret < 0) {", "goto fail;", "s->refcount_table[VAR_3] = new_block;", "s->max_refcount_table_index =\nMAX(s->max_refcount_table_index, VAR_3);", "return -EAGAIN;", "qcow2_cache_put(VAR_0, s->refcount_block_cache, VAR_2);", "BLKDBG_EVENT(VAR_0->file, BLKDBG_REFTABLE_GROW);", "uint64_t blocks_used = DIV_ROUND_UP(MAX(VAR_1 + 1,\n(new_block >> s->cluster_bits) + 1),\ns->refcount_block_size);", "uint64_t meta_offset = (blocks_used * s->refcount_block_size) *\ns->cluster_size;", "ret = qcow2_refcount_area(VAR_0, meta_offset, 0, false,\nVAR_3, new_block);", "if (ret < 0) {", "return ret;", "ret = load_refcount_block(VAR_0, new_block, VAR_2);", "if (ret < 0) {", "return ret;", "return -EAGAIN;", "fail:\nif (*VAR_2 != NULL) {", "qcow2_cache_put(VAR_0, s->refcount_block_cache, VAR_2);", "return ret;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 9 ], [ 10 ], [ 11, 12 ], [ 14 ], [ 15 ], [ 16, 17, 18, 19 ], [ 20, 21 ], [ 44 ], [ 46 ], [ 47 ], [ 48 ], [ 50 ], [ 51 ], [ 52 ], [ 53, 54, 55, 56 ], [ 57, 58 ], [ 60, 61 ], [ 62 ], [ 63 ], [ 64 ], [ 66, 67 ], [ 68 ], [ 69 ], [ 72, 73 ], [ 74 ], [ 75 ], [ 76 ], [ 77 ], [ 78 ], [ 81, 82 ], [ 83 ], [ 84 ], [ 85 ], [ 87 ], [ 88 ], [ 89 ], [ 90 ], [ 91 ], [ 93 ], [ 94 ], [ 95 ], [ 96, 97, 98 ], [ 99 ], [ 100 ], [ 101 ], [ 104, 105 ], [ 108 ], [ 109 ], [ 121 ], [ 133, 134, 135 ], [ 137, 138 ], [ 139, 140 ], [ 141 ], [ 142 ], [ 143 ], [ 144 ], [ 145 ], [ 149 ], [ 150, 151 ], [ 152 ], [ 153 ] ]
25,433
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; }
true
FFmpeg
f6774f905fb3cfdc319523ac640be30b14c1bc55
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){ w->flat_dc=1; sum+=9; w->predicted_dc = (sum*6899)>>17; } } 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; }
{ "code": [ " s->current_picture.f.linesize[chroma>0]," ], "line_no": [ 15 ] }
static int FUNC_0(IntraX8Context * const VAR_0, const int VAR_1){ MpegEncContext * const s= VAR_0->s; int VAR_2; int VAR_3; int VAR_4; VAR_0->dsp.setup_spatial_compensation(s->dest[VAR_1], s->edge_emu_buffer, s->current_picture.f.linesize[VAR_1>0], &VAR_2, &VAR_3, VAR_0->edges); if(VAR_1){ VAR_0->orient=VAR_0->chroma_orient; VAR_4=VAR_0->quant_dc_chroma; }else{ VAR_4=VAR_0->VAR_4; } VAR_0->flat_dc=0; if(VAR_2 < VAR_4 || VAR_2 < 3){ VAR_0->orient=0; if(VAR_2 < 3){ VAR_0->flat_dc=1; VAR_3+=9; VAR_0->predicted_dc = (VAR_3*6899)>>17; } } if(VAR_1) return 0; assert(VAR_0->orient < 3); if(VAR_2 < 2*VAR_0->VAR_4){ if( (VAR_0->edges&3) == 0){ if(VAR_0->orient==1) VAR_0->orient=11; if(VAR_0->orient==2) VAR_0->orient=10; }else{ VAR_0->orient=0; } VAR_0->raw_orient=0; }else{ static const uint8_t VAR_5[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} }; VAR_0->raw_orient=x8_get_orient_vlc(VAR_0); if(VAR_0->raw_orient<0) return -1; assert(VAR_0->raw_orient < 12 ); assert(VAR_0->orient<3); VAR_0->orient=VAR_5[VAR_0->orient][VAR_0->raw_orient]; } return 0; }
[ "static int FUNC_0(IntraX8Context * const VAR_0, const int VAR_1){", "MpegEncContext * const s= VAR_0->s;", "int VAR_2;", "int VAR_3;", "int VAR_4;", "VAR_0->dsp.setup_spatial_compensation(s->dest[VAR_1], s->edge_emu_buffer,\ns->current_picture.f.linesize[VAR_1>0],\n&VAR_2, &VAR_3, VAR_0->edges);", "if(VAR_1){", "VAR_0->orient=VAR_0->chroma_orient;", "VAR_4=VAR_0->quant_dc_chroma;", "}else{", "VAR_4=VAR_0->VAR_4;", "}", "VAR_0->flat_dc=0;", "if(VAR_2 < VAR_4 || VAR_2 < 3){", "VAR_0->orient=0;", "if(VAR_2 < 3){", "VAR_0->flat_dc=1;", "VAR_3+=9;", "VAR_0->predicted_dc = (VAR_3*6899)>>17;", "}", "}", "if(VAR_1)\nreturn 0;", "assert(VAR_0->orient < 3);", "if(VAR_2 < 2*VAR_0->VAR_4){", "if( (VAR_0->edges&3) == 0){", "if(VAR_0->orient==1) VAR_0->orient=11;", "if(VAR_0->orient==2) VAR_0->orient=10;", "}else{", "VAR_0->orient=0;", "}", "VAR_0->raw_orient=0;", "}else{", "static const uint8_t VAR_5[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}", "};", "VAR_0->raw_orient=x8_get_orient_vlc(VAR_0);", "if(VAR_0->raw_orient<0) return -1;", "assert(VAR_0->raw_orient < 12 );", "assert(VAR_0->orient<3);", "VAR_0->orient=VAR_5[VAR_0->orient][VAR_0->raw_orient];", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ] ]
25,434
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]); } } } }
true
FFmpeg
f6774f905fb3cfdc319523ac640be30b14c1bc55
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; 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); 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 (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]); } } } }
{ "code": [ " 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;", " 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;" ], "line_no": [ 75, 77, 85, 87 ] }
static void FUNC_0(VC1Context *VAR_0, int VAR_1, int VAR_2, int VAR_3) { MpegEncContext *s = &VAR_0->s; H264ChromaContext *h264chroma = &VAR_0->h264chroma; uint8_t *srcU, *srcV; int VAR_4, VAR_5; int VAR_6[4], VAR_7[4]; int VAR_18, VAR_9, VAR_10, VAR_11; int VAR_12 = VAR_0->blk_mv_type[s->block_index[0]]; static const int VAR_13[16] = { 0, 0, 1, 2, 4, 4, 5, 6, 2, 2, 3, 8, 6, 6, 7, 12 }; int VAR_14 = VAR_12 ? 1 : 4; int VAR_15 = s->VAR_15 >> 1; int VAR_16; uint8_t (*lutuv)[256]; if (s->flags & CODEC_FLAG_GRAY) return; for (VAR_18 = 0; VAR_18 < 4; VAR_18++) { int VAR_17 = VAR_18 < 2 ? VAR_1: VAR_2; VAR_10 = s->mv[VAR_17][VAR_18][0]; VAR_6[VAR_18] = (VAR_10 + ((VAR_10 & 3) == 3)) >> 1; VAR_11 = s->mv[VAR_17][VAR_18][1]; if (VAR_12) VAR_7[VAR_18] = (VAR_11 >> 4) * 8 + VAR_13[VAR_11 & 0xF]; else VAR_7[VAR_18] = (VAR_11 + ((VAR_11 & 3) == 3)) >> 1; } for (VAR_18 = 0; VAR_18 < 4; VAR_18++) { VAR_9 = (VAR_18 & 1) * 4 + ((VAR_18 & 2) ? VAR_14 * s->uvlinesize : 0); VAR_4 = s->mb_x * 8 + (VAR_18 & 1) * 4 + (VAR_6[VAR_18] >> 2); VAR_5 = s->mb_y * 8 + ((VAR_18 & 2) ? VAR_14 : 0) + (VAR_7[VAR_18] >> 2); VAR_4 = av_clip(VAR_4, -8, s->avctx->coded_width >> 1); VAR_5 = av_clip(VAR_5, -8, s->avctx->coded_height >> 1); if (VAR_18 < 2 ? VAR_1 : VAR_2) { srcU = s->next_picture.VAR_19.data[1] + VAR_5 * s->uvlinesize + VAR_4; srcV = s->next_picture.VAR_19.data[2] + VAR_5 * s->uvlinesize + VAR_4; lutuv = VAR_0->next_lutuv; VAR_16 = VAR_0->next_use_ic; } else { srcU = s->last_picture.VAR_19.data[1] + VAR_5 * s->uvlinesize + VAR_4; srcV = s->last_picture.VAR_19.data[2] + VAR_5 * s->uvlinesize + VAR_4; lutuv = VAR_0->last_lutuv; VAR_16 = VAR_0->last_use_ic; } VAR_6[VAR_18] = (VAR_6[VAR_18] & 3) << 1; VAR_7[VAR_18] = (VAR_7[VAR_18] & 3) << 1; if (VAR_12 && !(VAR_5 & 1)) VAR_15--; if (VAR_12 && (VAR_5 & 1) && VAR_5 < 2) VAR_5--; if (VAR_16 || s->h_edge_pos < 10 || VAR_15 < (5 << VAR_12) || (unsigned)VAR_4 > (s->h_edge_pos >> 1) - 5 || (unsigned)VAR_5 > VAR_15 - (5 << VAR_12)) { s->vdsp.emulated_edge_mc(s->edge_emu_buffer, srcU, s->uvlinesize, s->uvlinesize, 5, (5 << VAR_12), VAR_4, VAR_5, s->h_edge_pos >> 1, VAR_15); s->vdsp.emulated_edge_mc(s->edge_emu_buffer + 16, srcV, s->uvlinesize, s->uvlinesize, 5, (5 << VAR_12), VAR_4, VAR_5, s->h_edge_pos >> 1, VAR_15); srcU = s->edge_emu_buffer; srcV = s->edge_emu_buffer + 16; if (VAR_16) { int VAR_18, VAR_18; uint8_t *src, *src2; src = srcU; src2 = srcV; for (VAR_18 = 0; VAR_18 < 5; VAR_18++) { int VAR_19 = (VAR_5 + (VAR_18 << VAR_12)) & 1; for (VAR_18 = 0; VAR_18 < 5; VAR_18++) { src[VAR_18] = lutuv[VAR_19][src[VAR_18]]; src2[VAR_18] = lutuv[VAR_19][src2[VAR_18]]; } src += s->uvlinesize << VAR_12; src2 += s->uvlinesize << VAR_12; } } } if (VAR_3) { if (!VAR_0->rnd) { h264chroma->avg_h264_chroma_pixels_tab[1](s->dest[1] + VAR_9, srcU, s->uvlinesize << VAR_12, 4, VAR_6[VAR_18], VAR_7[VAR_18]); h264chroma->avg_h264_chroma_pixels_tab[1](s->dest[2] + VAR_9, srcV, s->uvlinesize << VAR_12, 4, VAR_6[VAR_18], VAR_7[VAR_18]); } else { VAR_0->vc1dsp.avg_no_rnd_vc1_chroma_pixels_tab[1](s->dest[1] + VAR_9, srcU, s->uvlinesize << VAR_12, 4, VAR_6[VAR_18], VAR_7[VAR_18]); VAR_0->vc1dsp.avg_no_rnd_vc1_chroma_pixels_tab[1](s->dest[2] + VAR_9, srcV, s->uvlinesize << VAR_12, 4, VAR_6[VAR_18], VAR_7[VAR_18]); } } else { if (!VAR_0->rnd) { h264chroma->put_h264_chroma_pixels_tab[1](s->dest[1] + VAR_9, srcU, s->uvlinesize << VAR_12, 4, VAR_6[VAR_18], VAR_7[VAR_18]); h264chroma->put_h264_chroma_pixels_tab[1](s->dest[2] + VAR_9, srcV, s->uvlinesize << VAR_12, 4, VAR_6[VAR_18], VAR_7[VAR_18]); } else { VAR_0->vc1dsp.put_no_rnd_vc1_chroma_pixels_tab[1](s->dest[1] + VAR_9, srcU, s->uvlinesize << VAR_12, 4, VAR_6[VAR_18], VAR_7[VAR_18]); VAR_0->vc1dsp.put_no_rnd_vc1_chroma_pixels_tab[1](s->dest[2] + VAR_9, srcV, s->uvlinesize << VAR_12, 4, VAR_6[VAR_18], VAR_7[VAR_18]); } } } }
[ "static void FUNC_0(VC1Context *VAR_0, int VAR_1, int VAR_2, int VAR_3)\n{", "MpegEncContext *s = &VAR_0->s;", "H264ChromaContext *h264chroma = &VAR_0->h264chroma;", "uint8_t *srcU, *srcV;", "int VAR_4, VAR_5;", "int VAR_6[4], VAR_7[4];", "int VAR_18, VAR_9, VAR_10, VAR_11;", "int VAR_12 = VAR_0->blk_mv_type[s->block_index[0]];", "static const int VAR_13[16] = { 0, 0, 1, 2, 4, 4, 5, 6, 2, 2, 3, 8, 6, 6, 7, 12 };", "int VAR_14 = VAR_12 ? 1 : 4;", "int VAR_15 = s->VAR_15 >> 1;", "int VAR_16;", "uint8_t (*lutuv)[256];", "if (s->flags & CODEC_FLAG_GRAY)\nreturn;", "for (VAR_18 = 0; VAR_18 < 4; VAR_18++) {", "int VAR_17 = VAR_18 < 2 ? VAR_1: VAR_2;", "VAR_10 = s->mv[VAR_17][VAR_18][0];", "VAR_6[VAR_18] = (VAR_10 + ((VAR_10 & 3) == 3)) >> 1;", "VAR_11 = s->mv[VAR_17][VAR_18][1];", "if (VAR_12)\nVAR_7[VAR_18] = (VAR_11 >> 4) * 8 + VAR_13[VAR_11 & 0xF];", "else\nVAR_7[VAR_18] = (VAR_11 + ((VAR_11 & 3) == 3)) >> 1;", "}", "for (VAR_18 = 0; VAR_18 < 4; VAR_18++) {", "VAR_9 = (VAR_18 & 1) * 4 + ((VAR_18 & 2) ? VAR_14 * s->uvlinesize : 0);", "VAR_4 = s->mb_x * 8 + (VAR_18 & 1) * 4 + (VAR_6[VAR_18] >> 2);", "VAR_5 = s->mb_y * 8 + ((VAR_18 & 2) ? VAR_14 : 0) + (VAR_7[VAR_18] >> 2);", "VAR_4 = av_clip(VAR_4, -8, s->avctx->coded_width >> 1);", "VAR_5 = av_clip(VAR_5, -8, s->avctx->coded_height >> 1);", "if (VAR_18 < 2 ? VAR_1 : VAR_2) {", "srcU = s->next_picture.VAR_19.data[1] + VAR_5 * s->uvlinesize + VAR_4;", "srcV = s->next_picture.VAR_19.data[2] + VAR_5 * s->uvlinesize + VAR_4;", "lutuv = VAR_0->next_lutuv;", "VAR_16 = VAR_0->next_use_ic;", "} else {", "srcU = s->last_picture.VAR_19.data[1] + VAR_5 * s->uvlinesize + VAR_4;", "srcV = s->last_picture.VAR_19.data[2] + VAR_5 * s->uvlinesize + VAR_4;", "lutuv = VAR_0->last_lutuv;", "VAR_16 = VAR_0->last_use_ic;", "}", "VAR_6[VAR_18] = (VAR_6[VAR_18] & 3) << 1;", "VAR_7[VAR_18] = (VAR_7[VAR_18] & 3) << 1;", "if (VAR_12 && !(VAR_5 & 1))\nVAR_15--;", "if (VAR_12 && (VAR_5 & 1) && VAR_5 < 2)\nVAR_5--;", "if (VAR_16\n|| s->h_edge_pos < 10 || VAR_15 < (5 << VAR_12)\n|| (unsigned)VAR_4 > (s->h_edge_pos >> 1) - 5\n|| (unsigned)VAR_5 > VAR_15 - (5 << VAR_12)) {", "s->vdsp.emulated_edge_mc(s->edge_emu_buffer, srcU,\ns->uvlinesize, s->uvlinesize,\n5, (5 << VAR_12), VAR_4, VAR_5,\ns->h_edge_pos >> 1, VAR_15);", "s->vdsp.emulated_edge_mc(s->edge_emu_buffer + 16, srcV,\ns->uvlinesize, s->uvlinesize,\n5, (5 << VAR_12), VAR_4, VAR_5,\ns->h_edge_pos >> 1, VAR_15);", "srcU = s->edge_emu_buffer;", "srcV = s->edge_emu_buffer + 16;", "if (VAR_16) {", "int VAR_18, VAR_18;", "uint8_t *src, *src2;", "src = srcU;", "src2 = srcV;", "for (VAR_18 = 0; VAR_18 < 5; VAR_18++) {", "int VAR_19 = (VAR_5 + (VAR_18 << VAR_12)) & 1;", "for (VAR_18 = 0; VAR_18 < 5; VAR_18++) {", "src[VAR_18] = lutuv[VAR_19][src[VAR_18]];", "src2[VAR_18] = lutuv[VAR_19][src2[VAR_18]];", "}", "src += s->uvlinesize << VAR_12;", "src2 += s->uvlinesize << VAR_12;", "}", "}", "}", "if (VAR_3) {", "if (!VAR_0->rnd) {", "h264chroma->avg_h264_chroma_pixels_tab[1](s->dest[1] + VAR_9, srcU, s->uvlinesize << VAR_12, 4, VAR_6[VAR_18], VAR_7[VAR_18]);", "h264chroma->avg_h264_chroma_pixels_tab[1](s->dest[2] + VAR_9, srcV, s->uvlinesize << VAR_12, 4, VAR_6[VAR_18], VAR_7[VAR_18]);", "} else {", "VAR_0->vc1dsp.avg_no_rnd_vc1_chroma_pixels_tab[1](s->dest[1] + VAR_9, srcU, s->uvlinesize << VAR_12, 4, VAR_6[VAR_18], VAR_7[VAR_18]);", "VAR_0->vc1dsp.avg_no_rnd_vc1_chroma_pixels_tab[1](s->dest[2] + VAR_9, srcV, s->uvlinesize << VAR_12, 4, VAR_6[VAR_18], VAR_7[VAR_18]);", "}", "} else {", "if (!VAR_0->rnd) {", "h264chroma->put_h264_chroma_pixels_tab[1](s->dest[1] + VAR_9, srcU, s->uvlinesize << VAR_12, 4, VAR_6[VAR_18], VAR_7[VAR_18]);", "h264chroma->put_h264_chroma_pixels_tab[1](s->dest[2] + VAR_9, srcV, s->uvlinesize << VAR_12, 4, VAR_6[VAR_18], VAR_7[VAR_18]);", "} else {", "VAR_0->vc1dsp.put_no_rnd_vc1_chroma_pixels_tab[1](s->dest[1] + VAR_9, srcU, s->uvlinesize << VAR_12, 4, VAR_6[VAR_18], VAR_7[VAR_18]);", "VAR_0->vc1dsp.put_no_rnd_vc1_chroma_pixels_tab[1](s->dest[2] + VAR_9, srcV, s->uvlinesize << VAR_12, 4, VAR_6[VAR_18], VAR_7[VAR_18]);", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31, 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51, 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101, 103 ], [ 105, 107 ], [ 109, 111, 113, 115 ], [ 117, 119, 121, 123 ], [ 125, 127, 129, 131 ], [ 133 ], [ 135 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ] ]
25,435
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(); } }
true
qemu
ce5b1bbf624b977a55ff7f85bb3871682d03baff
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(); } }
{ "code": [ " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);" ], "line_no": [ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15 ] }
static void FUNC_0(Object *VAR_0) { CPUState *cs = CPU(VAR_0); MoxieCPU *cpu = MOXIE_CPU(VAR_0); static int VAR_1; cs->env_ptr = &cpu->env; cpu_exec_init(cs, &error_abort); if (tcg_enabled() && !VAR_1) { VAR_1 = 1; moxie_translate_init(); } }
[ "static void FUNC_0(Object *VAR_0)\n{", "CPUState *cs = CPU(VAR_0);", "MoxieCPU *cpu = MOXIE_CPU(VAR_0);", "static int VAR_1;", "cs->env_ptr = &cpu->env;", "cpu_exec_init(cs, &error_abort);", "if (tcg_enabled() && !VAR_1) {", "VAR_1 = 1;", "moxie_translate_init();", "}", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
25,436
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; }
true
FFmpeg
445a02b1ec5ea94d28ea2503a3ae0272fcff0e12
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; } p += 6 * 8 + 3 * 4 + sizeof(ff_asf_guid) * 2; if (p + 8 <= end && AV_RL32(p) == AV_RL32(p + 4)) { AV_WL32(p, 0); return 0; } break; } while (end - p >= sizeof(ff_asf_guid) + 8); return -1; }
{ "code": [ " p += 6 * 8 + 3 * 4 + sizeof(ff_asf_guid) * 2;", " if (p + 8 <= end && AV_RL32(p) == AV_RL32(p + 4)) {" ], "line_no": [ 39, 41 ] }
static int FUNC_0(uint8_t *VAR_0, int VAR_1) { uint8_t *p = VAR_0, *end = VAR_0 + VAR_1; if (VAR_1 < 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; } p += 6 * 8 + 3 * 4 + sizeof(ff_asf_guid) * 2; if (p + 8 <= end && AV_RL32(p) == AV_RL32(p + 4)) { AV_WL32(p, 0); return 0; } break; } while (end - p >= sizeof(ff_asf_guid) + 8); return -1; }
[ "static int FUNC_0(uint8_t *VAR_0, int VAR_1)\n{", "uint8_t *p = VAR_0, *end = VAR_0 + VAR_1;", "if (VAR_1 < sizeof(ff_asf_guid) * 2 + 22 ||\nmemcmp(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)\nreturn -1;", "p += chunksize;", "continue;", "}", "p += 6 * 8 + 3 * 4 + sizeof(ff_asf_guid) * 2;", "if (p + 8 <= end && AV_RL32(p) == AV_RL32(p + 4)) {", "AV_WL32(p, 0);", "return 0;", "}", "break;", "} while (end - p >= sizeof(ff_asf_guid) + 8);", "return -1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ] ]
25,437
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; }
true
qemu
b5eff355460643d09e533024360fe0522f368c07
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) 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; if (vmdk_parent_open(bs, filename) != 0) goto fail; s->parent_cid = vmdk_read_cid(bs,1); } else { goto fail; } 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; }
{ "code": [ " ret = bdrv_file_open(&s->hd, filename, flags | BDRV_O_AUTOGROW);", " ret = bdrv_file_open(&s->hd, filename, flags | BDRV_O_AUTOGROW);", " ret = bdrv_file_open(&s->hd, filename, flags | BDRV_O_AUTOGROW);", " return 0;", " return 0;" ], "line_no": [ 23, 23, 23, 171, 171 ] }
static int FUNC_0(BlockDriverState *VAR_0, const char *VAR_1, int VAR_2) { BDRVVmdkState *s = VAR_0->opaque; uint32_t magic; int VAR_3, VAR_4, VAR_5; if (parent_open) VAR_2 = BDRV_O_RDONLY; fprintf(stderr, "(VMDK) image open: VAR_2=0x%x VAR_1=%s\n", VAR_2, VAR_0->VAR_1); VAR_5 = bdrv_file_open(&s->hd, VAR_1, VAR_2 | BDRV_O_AUTOGROW); if (VAR_5 < 0) return VAR_5; 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->VAR_3 = 1 << 6; VAR_0->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; VAR_0->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->VAR_3 = (VAR_0->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; if (vmdk_parent_open(VAR_0, VAR_1) != 0) goto fail; s->parent_cid = vmdk_read_cid(VAR_0,1); } else { goto fail; } VAR_3 = s->VAR_3 * sizeof(uint32_t); s->l1_table = qemu_malloc(VAR_3); if (!s->l1_table) goto fail; if (bdrv_pread(s->hd, s->l1_table_offset, s->l1_table, VAR_3) != VAR_3) goto fail; for(VAR_4 = 0; VAR_4 < s->VAR_3; VAR_4++) { le32_to_cpus(&s->l1_table[VAR_4]); } if (s->l1_backup_table_offset) { s->l1_backup_table = qemu_malloc(VAR_3); if (!s->l1_backup_table) goto fail; if (bdrv_pread(s->hd, s->l1_backup_table_offset, s->l1_backup_table, VAR_3) != VAR_3) goto fail; for(VAR_4 = 0; VAR_4 < s->VAR_3; VAR_4++) { le32_to_cpus(&s->l1_backup_table[VAR_4]); } } 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; }
[ "static int FUNC_0(BlockDriverState *VAR_0, const char *VAR_1, int VAR_2)\n{", "BDRVVmdkState *s = VAR_0->opaque;", "uint32_t magic;", "int VAR_3, VAR_4, VAR_5;", "if (parent_open)\nVAR_2 = BDRV_O_RDONLY;", "fprintf(stderr, \"(VMDK) image open: VAR_2=0x%x VAR_1=%s\\n\", VAR_2, VAR_0->VAR_1);", "VAR_5 = bdrv_file_open(&s->hd, VAR_1, VAR_2 | BDRV_O_AUTOGROW);", "if (VAR_5 < 0)\nreturn VAR_5;", "if (bdrv_pread(s->hd, 0, &magic, sizeof(magic)) != sizeof(magic))\ngoto fail;", "magic = be32_to_cpu(magic);", "if (magic == VMDK3_MAGIC) {", "VMDK3Header header;", "if (bdrv_pread(s->hd, sizeof(magic), &header, sizeof(header)) != sizeof(header))\ngoto fail;", "s->cluster_sectors = le32_to_cpu(header.granularity);", "s->l2_size = 1 << 9;", "s->VAR_3 = 1 << 6;", "VAR_0->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))\ngoto fail;", "VAR_0->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)\ngoto fail;", "s->VAR_3 = (VAR_0->total_sectors + s->l1_entry_sectors - 1)\n/ 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)\ns->is_parent = 1;", "else\ns->is_parent = 0;", "if (vmdk_parent_open(VAR_0, VAR_1) != 0)\ngoto fail;", "s->parent_cid = vmdk_read_cid(VAR_0,1);", "} else {", "goto fail;", "}", "VAR_3 = s->VAR_3 * sizeof(uint32_t);", "s->l1_table = qemu_malloc(VAR_3);", "if (!s->l1_table)\ngoto fail;", "if (bdrv_pread(s->hd, s->l1_table_offset, s->l1_table, VAR_3) != VAR_3)\ngoto fail;", "for(VAR_4 = 0; VAR_4 < s->VAR_3; VAR_4++) {", "le32_to_cpus(&s->l1_table[VAR_4]);", "}", "if (s->l1_backup_table_offset) {", "s->l1_backup_table = qemu_malloc(VAR_3);", "if (!s->l1_backup_table)\ngoto fail;", "if (bdrv_pread(s->hd, s->l1_backup_table_offset, s->l1_backup_table, VAR_3) != VAR_3)\ngoto fail;", "for(VAR_4 = 0; VAR_4 < s->VAR_3; VAR_4++) {", "le32_to_cpus(&s->l1_backup_table[VAR_4]);", "}", "}", "s->l2_cache = qemu_malloc(s->l2_size * L2_CACHE_SIZE * sizeof(uint32_t));", "if (!s->l2_cache)\ngoto fail;", "return 0;", "fail:\nqemu_free(s->l1_backup_table);", "qemu_free(s->l1_table);", "qemu_free(s->l2_cache);", "bdrv_delete(s->hd);", "return -1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 17 ], [ 19 ], [ 23 ], [ 25, 27 ], [ 29, 31 ], [ 35 ], [ 37 ], [ 39 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 93, 95 ], [ 97, 99 ], [ 105, 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 123 ], [ 125 ], [ 127, 129 ], [ 131, 133 ], [ 135 ], [ 137 ], [ 139 ], [ 143 ], [ 145 ], [ 147, 149 ], [ 151, 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 165 ], [ 167, 169 ], [ 171 ], [ 173, 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ] ]
25,438
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; }
true
qemu
129c7d1c536d0c67a8781cb09fb5bdb3d0f6a2d0
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; }
{ "code": [], "line_no": [] }
static SocketAddress *FUNC_0(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; }
[ "static SocketAddress *FUNC_0(BDRVNBDState *s, QDict *options, Error **errp)\n{", "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:\nQDECREF(addr);", "qobject_decref(crumpled_addr);", "visit_free(iv);", "return saddr;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ] ]
25,439
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 }
true
FFmpeg
2da0d70d5eebe42f9fcd27ee554419ebe2a5da06
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 }
{ "code": [ "\tasm volatile(", "\t\t: \"%\"REG_a", "\t);", "\tint i;", "#endif", "#endif", "#endif", "#endif", "#endif", "\tint i;", "#endif", "#endif", "#endif", "#endif", "\tint i;", "#endif", "#endif", "#endif", "#endif", "#endif", "\tasm volatile(", "\t\t\"mov %0, %%\"REG_a\"\t\t\\n\\t\"", "\t\t\"1:\t\t\t\t\\n\\t\"", "\t\t\"movq (%1, %%\"REG_a\",2), %%mm0\t\\n\\t\"", "\t\t\"movq 8(%1, %%\"REG_a\",2), %%mm1\t\\n\\t\"", "\t\t\"packuswb %%mm1, %%mm0\t\t\\n\\t\"", "\t\t\"movq %%mm0, (%2, %%\"REG_a\")\t\\n\\t\"", "\t\t\"add $8, %%\"REG_a\"\t\t\\n\\t\"", "\t\t\" js 1b\t\t\t\t\\n\\t\"", "\t\t: : \"g\" (-width), \"r\" (src+width*2), \"r\" (dst+width)", "\t\t: \"%\"REG_a", "\t);", "\tint i;", "\tfor(i=0; i<width; i++)", "\tasm volatile(", "\t\t\"mov %0, %%\"REG_a\"\t\t\\n\\t\"", "\t\t\"1:\t\t\t\t\\n\\t\"", "\t\t\"psrlw $8, %%mm0\t\t\\n\\t\"", "\t\t\"psrlw $8, %%mm1\t\t\\n\\t\"", "\t\t\"packuswb %%mm1, %%mm0\t\t\\n\\t\"", "\t\t\"psrlw $8, %%mm0\t\t\\n\\t\"", "\t\t\" js 1b\t\t\t\t\\n\\t\"", "\t\t: \"%\"REG_a", "\t);", "\tint i;", "\tfor(i=0; i<width; i++)", "#endif", "\tasm volatile(", "\t\t\"mov %0, %%\"REG_a\"\t\t\\n\\t\"", "\t\t\"1:\t\t\t\t\\n\\t\"", "\t\t\"movq (%1, %%\"REG_a\",2), %%mm0\t\\n\\t\"", "\t\t\"movq 8(%1, %%\"REG_a\",2), %%mm1\t\\n\\t\"", "\t\t\"psrlw $8, %%mm0\t\t\\n\\t\"", "\t\t\"psrlw $8, %%mm1\t\t\\n\\t\"", "\t\t\"packuswb %%mm1, %%mm0\t\t\\n\\t\"", "\t\t\"movq %%mm0, (%2, %%\"REG_a\")\t\\n\\t\"", "\t\t\"add $8, %%\"REG_a\"\t\t\\n\\t\"", "\t\t\" js 1b\t\t\t\t\\n\\t\"", "\t\t: : \"g\" (-width), \"r\" (src+width*2), \"r\" (dst+width)", "\t\t: \"%\"REG_a", "\t);", "\tint i;", "\tfor(i=0; i<width; i++)", "\t\tdst[i]= src[2*i+1];", "\tasm volatile(", "\t\t\"mov %0, %%\"REG_a\"\t\t\\n\\t\"", "\t\t\"1:\t\t\t\t\\n\\t\"", "\t\t\"packuswb %%mm1, %%mm0\t\t\\n\\t\"", "\t\t\"psrlw $8, %%mm0\t\t\\n\\t\"", "\t\t\" js 1b\t\t\t\t\\n\\t\"", "\t\t: \"%\"REG_a", "\t);", "\tint i;", "\tfor(i=0; i<width; i++)", "#endif", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tasm volatile(", "\t\t\"1:\t\t\t\t\\n\\t\"", "#endif", "#endif", "\t\t\"add $8, %%\"REG_a\"\t\t\\n\\t\"", "\t\t\" js 1b\t\t\t\t\\n\\t\"", "\t);", "\tint i;", "\tfor(i=0; i<width; i++)", "\tasm volatile(", "\t\t\"1:\t\t\t\t\\n\\t\"", "#endif", "#endif", "#endif", "#endif", "\t\t\" js 1b\t\t\t\t\\n\\t\"", "\t);", "\tint i;", "\tfor(i=0; i<width; i++)", "#endif", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "#endif", "#endif", "#endif", "#endif", "\tint i;", "\tint i;", "#endif", "#endif", "#endif", "\tasm volatile(", "\t\t\"1:\t\t\t\t\\n\\t\"", "\tint i;", "\tint i;", "#endif", "#endif", "#endif", "\tasm volatile(", "\t\t\"1:\t\t\t\t\\n\\t\"", "\tint i;", "#endif" ], "line_no": [ 7, 31, 33, 37, 43, 43, 43, 43, 43, 37, 43, 43, 43, 43, 37, 43, 43, 43, 43, 43, 7, 9, 11, 13, 15, 21, 23, 25, 27, 29, 31, 33, 37, 39, 7, 9, 11, 17, 19, 21, 17, 27, 31, 33, 37, 39, 43, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 37, 39, 41, 7, 9, 11, 21, 17, 27, 31, 33, 37, 39, 43, 37, 39, 37, 39, 7, 11, 43, 43, 25, 27, 33, 37, 39, 7, 11, 43, 43, 43, 43, 27, 33, 37, 39, 43, 37, 39, 37, 39, 37, 39, 37, 39, 37, 39, 37, 39, 37, 39, 37, 39, 37, 39, 37, 39, 37, 39, 37, 39, 37, 39, 37, 39, 43, 43, 43, 43, 37, 37, 43, 43, 43, 7, 11, 37, 37, 43, 43, 43, 7, 11, 37, 43 ] }
static inline void FUNC_0(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 VAR_0; for(VAR_0=0; VAR_0<width; VAR_0++) dst[VAR_0]= src[2*VAR_0+1]; #endif }
[ "static inline void FUNC_0(uyvyToY)(uint8_t *dst, uint8_t *src, long width)\n{", "#ifdef HAVE_MMX\nasm volatile(\n\"mov %0, %%\"REG_a\"\t\t\\n\\t\"\n\"1:\t\t\t\t\\n\\t\"\n\"movq (%1, %%\"REG_a\",2), %%mm0\t\\n\\t\"\n\"movq 8(%1, %%\"REG_a\",2), %%mm1\t\\n\\t\"\n\"psrlw $8, %%mm0\t\t\\n\\t\"\n\"psrlw $8, %%mm1\t\t\\n\\t\"\n\"packuswb %%mm1, %%mm0\t\t\\n\\t\"\n\"movq %%mm0, (%2, %%\"REG_a\")\t\\n\\t\"\n\"add $8, %%\"REG_a\"\t\t\\n\\t\"\n\" js 1b\t\t\t\t\\n\\t\"\n: : \"g\" (-width), \"r\" (src+width*2), \"r\" (dst+width)\n: \"%\"REG_a\n);", "#else\nint VAR_0;", "for(VAR_0=0; VAR_0<width; VAR_0++)", "dst[VAR_0]= src[2*VAR_0+1];", "#endif\n}" ]
[ 0, 1, 1, 1, 1, 1 ]
[ [ 1, 3 ], [ 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43, 45 ] ]
25,440
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; }
true
FFmpeg
6d9dad6a7cb5d544d540abf941fedbd34c14d2bd
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; 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; }
{ "code": [], "line_no": [] }
static int FUNC_0(G2MContext *VAR_0, int VAR_1, int VAR_2, const uint8_t *VAR_3, int VAR_4) { int VAR_5, VAR_6; int VAR_7, VAR_8, VAR_9, VAR_10 = -1, VAR_11; int VAR_12, VAR_22; const uint8_t *VAR_14 = VAR_3 + VAR_4; uint8_t pal[768], transp[3]; uLongf dlen = (VAR_0->tile_width + 1) * VAR_0->tile_height; int VAR_15; int VAR_16, VAR_17, VAR_18; int VAR_19, VAR_20, VAR_21; uint8_t *dst = VAR_0->framebuf + VAR_1 * VAR_0->tile_width * 3 + VAR_2 * VAR_0->tile_height * VAR_0->framebuf_stride; if (VAR_4 < 2) VAR_5 = FFMIN(VAR_0->VAR_5 - VAR_1 * VAR_0->tile_width, VAR_0->tile_width); VAR_6 = FFMIN(VAR_0->VAR_6 - VAR_2 * VAR_0->tile_height, VAR_0->tile_height); VAR_7 = *VAR_3++; VAR_15 = VAR_7 >> 5; if (VAR_15 == 0) { int VAR_22; memcpy(transp, VAR_3, 3); VAR_3 += 3; for (VAR_22 = 0; VAR_22 < VAR_6; VAR_22++, dst += VAR_0->framebuf_stride) for (VAR_12 = 0; VAR_12 < VAR_5; VAR_12++) memcpy(dst + VAR_12 * 3, transp, 3); return 0; } else if (VAR_15 == 1) { return jpg_decode_data(&VAR_0->jc, VAR_5, VAR_6, VAR_3, VAR_14 - VAR_3, dst, VAR_0->framebuf_stride, NULL, 0, 0, 0); } if (VAR_15 != 2) { memcpy(transp, VAR_3, 3); VAR_3 += 3; } VAR_9 = *VAR_3++ + 1; memcpy(pal, VAR_3, VAR_9 * 3); VAR_3 += VAR_9 * 3; if (VAR_15 != 2) { for (VAR_12 = 0; VAR_12 < VAR_9; VAR_12++) { if (!memcmp(pal + VAR_12 * 3, transp, 3)) { VAR_10 = VAR_12; break; } } } if (VAR_14 - VAR_3 < 2) return 0; VAR_8 = (VAR_3[0] << 8) | VAR_3[1]; VAR_3 += 2; if (VAR_14 - VAR_3 < VAR_8 + (VAR_15 != 2)) VAR_11 = uncompress(VAR_0->kempf_buf, &dlen, VAR_3, VAR_8); if (VAR_11) VAR_3 += VAR_8; if (VAR_15 == 2) { kempf_restore_buf(VAR_0->kempf_buf, dlen, dst, VAR_0->framebuf_stride, NULL, 0, VAR_5, VAR_6, pal, VAR_9, VAR_10); return 0; } VAR_16 = *VAR_3++ + 1; VAR_17 = 0; VAR_18 = FFALIGN(VAR_5, 16) >> 4; VAR_19 = 0; for (VAR_12 = 0; VAR_12 < (FFALIGN(VAR_6, 16) >> 4); VAR_12++) { for (VAR_22 = 0; VAR_22 < (FFALIGN(VAR_5, 16) >> 4); VAR_22++) { if (!VAR_19) { if (VAR_3 >= VAR_14) VAR_20 = *VAR_3++; VAR_19 = 8; } VAR_21 = VAR_20 & 1; VAR_19--; VAR_20 >>= 1; VAR_17 += VAR_21; if (VAR_17 > VAR_16) VAR_0->kempf_flags[VAR_22 + VAR_12 * VAR_18] = VAR_21; } } memset(VAR_0->jpeg_tile, 0, VAR_0->tile_stride * VAR_6); jpg_decode_data(&VAR_0->jc, VAR_5, VAR_6, VAR_3, VAR_14 - VAR_3, VAR_0->jpeg_tile, VAR_0->tile_stride, VAR_0->kempf_flags, VAR_18, VAR_16, 0); kempf_restore_buf(VAR_0->kempf_buf, dlen, dst, VAR_0->framebuf_stride, VAR_0->jpeg_tile, VAR_0->tile_stride, VAR_5, VAR_6, pal, VAR_9, VAR_10); return 0; }
[ "static int FUNC_0(G2MContext *VAR_0, int VAR_1, int VAR_2,\nconst uint8_t *VAR_3, int VAR_4)\n{", "int VAR_5, VAR_6;", "int VAR_7, VAR_8, VAR_9, VAR_10 = -1, VAR_11;", "int VAR_12, VAR_22;", "const uint8_t *VAR_14 = VAR_3 + VAR_4;", "uint8_t pal[768], transp[3];", "uLongf dlen = (VAR_0->tile_width + 1) * VAR_0->tile_height;", "int VAR_15;", "int VAR_16, VAR_17, VAR_18;", "int VAR_19, VAR_20, VAR_21;", "uint8_t *dst = VAR_0->framebuf + VAR_1 * VAR_0->tile_width * 3 +\nVAR_2 * VAR_0->tile_height * VAR_0->framebuf_stride;", "if (VAR_4 < 2)\nVAR_5 = FFMIN(VAR_0->VAR_5 - VAR_1 * VAR_0->tile_width, VAR_0->tile_width);", "VAR_6 = FFMIN(VAR_0->VAR_6 - VAR_2 * VAR_0->tile_height, VAR_0->tile_height);", "VAR_7 = *VAR_3++;", "VAR_15 = VAR_7 >> 5;", "if (VAR_15 == 0) {", "int VAR_22;", "memcpy(transp, VAR_3, 3);", "VAR_3 += 3;", "for (VAR_22 = 0; VAR_22 < VAR_6; VAR_22++, dst += VAR_0->framebuf_stride)", "for (VAR_12 = 0; VAR_12 < VAR_5; VAR_12++)", "memcpy(dst + VAR_12 * 3, transp, 3);", "return 0;", "} else if (VAR_15 == 1) {", "return jpg_decode_data(&VAR_0->jc, VAR_5, VAR_6, VAR_3, VAR_14 - VAR_3,\ndst, VAR_0->framebuf_stride, NULL, 0, 0, 0);", "}", "if (VAR_15 != 2) {", "memcpy(transp, VAR_3, 3);", "VAR_3 += 3;", "}", "VAR_9 = *VAR_3++ + 1;", "memcpy(pal, VAR_3, VAR_9 * 3); VAR_3 += VAR_9 * 3;", "if (VAR_15 != 2) {", "for (VAR_12 = 0; VAR_12 < VAR_9; VAR_12++) {", "if (!memcmp(pal + VAR_12 * 3, transp, 3)) {", "VAR_10 = VAR_12;", "break;", "}", "}", "}", "if (VAR_14 - VAR_3 < 2)\nreturn 0;", "VAR_8 = (VAR_3[0] << 8) | VAR_3[1]; VAR_3 += 2;", "if (VAR_14 - VAR_3 < VAR_8 + (VAR_15 != 2))\nVAR_11 = uncompress(VAR_0->kempf_buf, &dlen, VAR_3, VAR_8);", "if (VAR_11)\nVAR_3 += VAR_8;", "if (VAR_15 == 2) {", "kempf_restore_buf(VAR_0->kempf_buf, dlen, dst, VAR_0->framebuf_stride,\nNULL, 0, VAR_5, VAR_6, pal, VAR_9, VAR_10);", "return 0;", "}", "VAR_16 = *VAR_3++ + 1;", "VAR_17 = 0;", "VAR_18 = FFALIGN(VAR_5, 16) >> 4;", "VAR_19 = 0;", "for (VAR_12 = 0; VAR_12 < (FFALIGN(VAR_6, 16) >> 4); VAR_12++) {", "for (VAR_22 = 0; VAR_22 < (FFALIGN(VAR_5, 16) >> 4); VAR_22++) {", "if (!VAR_19) {", "if (VAR_3 >= VAR_14)\nVAR_20 = *VAR_3++;", "VAR_19 = 8;", "}", "VAR_21 = VAR_20 & 1;", "VAR_19--;", "VAR_20 >>= 1;", "VAR_17 += VAR_21;", "if (VAR_17 > VAR_16)\nVAR_0->kempf_flags[VAR_22 + VAR_12 * VAR_18] = VAR_21;", "}", "}", "memset(VAR_0->jpeg_tile, 0, VAR_0->tile_stride * VAR_6);", "jpg_decode_data(&VAR_0->jc, VAR_5, VAR_6, VAR_3, VAR_14 - VAR_3,\nVAR_0->jpeg_tile, VAR_0->tile_stride,\nVAR_0->kempf_flags, VAR_18, VAR_16, 0);", "kempf_restore_buf(VAR_0->kempf_buf, dlen, dst, VAR_0->framebuf_stride,\nVAR_0->jpeg_tile, VAR_0->tile_stride,\nVAR_5, VAR_6, pal, VAR_9, VAR_10);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 31, 36 ], [ 38 ], [ 42 ], [ 44 ], [ 46 ], [ 48 ], [ 50 ], [ 52 ], [ 54 ], [ 56 ], [ 58 ], [ 60 ], [ 62 ], [ 64, 66 ], [ 68 ], [ 72 ], [ 74 ], [ 76 ], [ 78 ], [ 80 ], [ 84 ], [ 86 ], [ 88 ], [ 90 ], [ 92 ], [ 94 ], [ 96 ], [ 98 ], [ 100 ], [ 104, 106 ], [ 108 ], [ 112, 117 ], [ 119, 122 ], [ 126 ], [ 128, 130 ], [ 132 ], [ 134 ], [ 138 ], [ 140 ], [ 142 ], [ 146 ], [ 148 ], [ 150 ], [ 152 ], [ 154, 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171, 174 ], [ 176 ], [ 178 ], [ 182 ], [ 184, 186, 188 ], [ 192, 194, 196 ], [ 200 ], [ 202 ] ]
25,441
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; }
true
FFmpeg
1c5b712c0a643a039d6f34269b4102de313a050a
static void interpolate_refplane(DiracContext *s, DiracFrame *ref, int plane, int width, int height) { 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); 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); 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; }
{ "code": [ "static void interpolate_refplane(DiracContext *s, DiracFrame *ref, int plane, int width, int height)" ], "line_no": [ 1 ] }
static void FUNC_0(DiracContext *VAR_0, DiracFrame *VAR_1, int VAR_2, int VAR_3, int VAR_4) { int VAR_5, VAR_6 = EDGE_WIDTH/2; VAR_1->hpel[VAR_2][0] = VAR_1->avframe->data[VAR_2]; VAR_0->mpvencdsp.draw_edges(VAR_1->hpel[VAR_2][0], VAR_1->avframe->linesize[VAR_2], VAR_3, VAR_4, VAR_6, VAR_6, EDGE_TOP | EDGE_BOTTOM); if (!VAR_0->mv_precision) return; for (VAR_5 = 1; VAR_5 < 4; VAR_5++) { if (!VAR_1->hpel_base[VAR_2][VAR_5]) VAR_1->hpel_base[VAR_2][VAR_5] = av_malloc((VAR_4+2*VAR_6) * VAR_1->avframe->linesize[VAR_2] + 32); VAR_1->hpel[VAR_2][VAR_5] = VAR_1->hpel_base[VAR_2][VAR_5] + VAR_6*VAR_1->avframe->linesize[VAR_2] + 16; } if (!VAR_1->interpolated[VAR_2]) { VAR_0->diracdsp.dirac_hpel_filter(VAR_1->hpel[VAR_2][1], VAR_1->hpel[VAR_2][2], VAR_1->hpel[VAR_2][3], VAR_1->hpel[VAR_2][0], VAR_1->avframe->linesize[VAR_2], VAR_3, VAR_4); VAR_0->mpvencdsp.draw_edges(VAR_1->hpel[VAR_2][1], VAR_1->avframe->linesize[VAR_2], VAR_3, VAR_4, VAR_6, VAR_6, EDGE_TOP | EDGE_BOTTOM); VAR_0->mpvencdsp.draw_edges(VAR_1->hpel[VAR_2][2], VAR_1->avframe->linesize[VAR_2], VAR_3, VAR_4, VAR_6, VAR_6, EDGE_TOP | EDGE_BOTTOM); VAR_0->mpvencdsp.draw_edges(VAR_1->hpel[VAR_2][3], VAR_1->avframe->linesize[VAR_2], VAR_3, VAR_4, VAR_6, VAR_6, EDGE_TOP | EDGE_BOTTOM); } VAR_1->interpolated[VAR_2] = 1; }
[ "static void FUNC_0(DiracContext *VAR_0, DiracFrame *VAR_1, int VAR_2, int VAR_3, int VAR_4)\n{", "int VAR_5, VAR_6 = EDGE_WIDTH/2;", "VAR_1->hpel[VAR_2][0] = VAR_1->avframe->data[VAR_2];", "VAR_0->mpvencdsp.draw_edges(VAR_1->hpel[VAR_2][0], VAR_1->avframe->linesize[VAR_2], VAR_3, VAR_4, VAR_6, VAR_6, EDGE_TOP | EDGE_BOTTOM);", "if (!VAR_0->mv_precision)\nreturn;", "for (VAR_5 = 1; VAR_5 < 4; VAR_5++) {", "if (!VAR_1->hpel_base[VAR_2][VAR_5])\nVAR_1->hpel_base[VAR_2][VAR_5] = av_malloc((VAR_4+2*VAR_6) * VAR_1->avframe->linesize[VAR_2] + 32);", "VAR_1->hpel[VAR_2][VAR_5] = VAR_1->hpel_base[VAR_2][VAR_5] + VAR_6*VAR_1->avframe->linesize[VAR_2] + 16;", "}", "if (!VAR_1->interpolated[VAR_2]) {", "VAR_0->diracdsp.dirac_hpel_filter(VAR_1->hpel[VAR_2][1], VAR_1->hpel[VAR_2][2],\nVAR_1->hpel[VAR_2][3], VAR_1->hpel[VAR_2][0],\nVAR_1->avframe->linesize[VAR_2], VAR_3, VAR_4);", "VAR_0->mpvencdsp.draw_edges(VAR_1->hpel[VAR_2][1], VAR_1->avframe->linesize[VAR_2], VAR_3, VAR_4, VAR_6, VAR_6, EDGE_TOP | EDGE_BOTTOM);", "VAR_0->mpvencdsp.draw_edges(VAR_1->hpel[VAR_2][2], VAR_1->avframe->linesize[VAR_2], VAR_3, VAR_4, VAR_6, VAR_6, EDGE_TOP | EDGE_BOTTOM);", "VAR_0->mpvencdsp.draw_edges(VAR_1->hpel[VAR_2][3], VAR_1->avframe->linesize[VAR_2], VAR_3, VAR_4, VAR_6, VAR_6, EDGE_TOP | EDGE_BOTTOM);", "}", "VAR_1->interpolated[VAR_2] = 1;", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 11 ], [ 15 ], [ 17 ], [ 23, 25 ], [ 29 ], [ 31, 33 ], [ 37 ], [ 39 ], [ 43 ], [ 45, 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ] ]
25,442
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); }
true
qemu
40f16dd1279e7f26357b3c4b3838a89ffc6153da
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); }
{ "code": [ " r->req.bus->complete(r->req.bus, SCSI_REASON_DATA, r->req.tag, len);", " if (len == 0)" ], "line_no": [ 29, 31 ] }
static void FUNC_0(void * VAR_0, int VAR_1) { SCSIGenericReq *r = (SCSIGenericReq *)VAR_0; int VAR_2; if (VAR_1) { DPRINTF("IO error VAR_1 %d\n", VAR_1); scsi_command_complete(r, VAR_1); return; } VAR_2 = r->io_header.dxfer_len - r->io_header.resid; DPRINTF("Data ready tag=0x%x VAR_2=%d\n", r->req.tag, VAR_2); r->VAR_2 = -1; r->req.bus->complete(r->req.bus, SCSI_REASON_DATA, r->req.tag, VAR_2); if (VAR_2 == 0) scsi_command_complete(r, 0); }
[ "static void FUNC_0(void * VAR_0, int VAR_1)\n{", "SCSIGenericReq *r = (SCSIGenericReq *)VAR_0;", "int VAR_2;", "if (VAR_1) {", "DPRINTF(\"IO error VAR_1 %d\\n\", VAR_1);", "scsi_command_complete(r, VAR_1);", "return;", "}", "VAR_2 = r->io_header.dxfer_len - r->io_header.resid;", "DPRINTF(\"Data ready tag=0x%x VAR_2=%d\\n\", r->req.tag, VAR_2);", "r->VAR_2 = -1;", "r->req.bus->complete(r->req.bus, SCSI_REASON_DATA, r->req.tag, VAR_2);", "if (VAR_2 == 0)\nscsi_command_complete(r, 0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ] ]
25,443
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);
true
FFmpeg
bb23bf8fd7fb4771b0f08a4ee1ba8fe6ca16d14f
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);
{ "code": [], "line_no": [] }
int FUNC_0(AVFilterContext *VAR_0, const char *VAR_1, const char *VAR_2, char *VAR_3, int VAR_4, int VAR_5) { if(!strcmp(VAR_1, "ping")){ av_strlcatf(VAR_3, VAR_4, "pong from:%s %s\n", VAR_0->VAR_0->name, VAR_0->name); return 0; }else if(!strcmp(VAR_1, "enable")) { return set_enable_expr(VAR_0, VAR_2); }else if(VAR_0->VAR_0->process_command) { return VAR_0->VAR_0->process_command(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5); return AVERROR(ENOSYS);
[ "int FUNC_0(AVFilterContext *VAR_0, const char *VAR_1, const char *VAR_2, char *VAR_3, int VAR_4, int VAR_5)\n{", "if(!strcmp(VAR_1, \"ping\")){", "av_strlcatf(VAR_3, VAR_4, \"pong from:%s %s\\n\", VAR_0->VAR_0->name, VAR_0->name);", "return 0;", "}else if(!strcmp(VAR_1, \"enable\")) {", "return set_enable_expr(VAR_0, VAR_2);", "}else if(VAR_0->VAR_0->process_command) {", "return VAR_0->VAR_0->process_command(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5);", "return AVERROR(ENOSYS);" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ] ]
25,444
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"); } }
false
FFmpeg
64f6570c6e2c5a0344383e89c7897809f0c6e1f1
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"); } }
{ "code": [], "line_no": [] }
static void FUNC_0(Jpeg2000DecoderContext *VAR_0, Jpeg2000T1Context *VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6) { int VAR_7 = 3 << (VAR_4 - 1), VAR_8, VAR_9, VAR_10, VAR_11, VAR_12; for (VAR_8 = 0; VAR_8 < VAR_3; VAR_8 += 4) for (VAR_9 = 0; VAR_9 < VAR_2; VAR_9++) { if (VAR_8 + 3 < VAR_3 && !((VAR_1->flags[VAR_8 + 1][VAR_9 + 1] & (JPEG2000_T1_SIG_NB | JPEG2000_T1_VIS | JPEG2000_T1_SIG)) || (VAR_1->flags[VAR_8 + 2][VAR_9 + 1] & (JPEG2000_T1_SIG_NB | JPEG2000_T1_VIS | JPEG2000_T1_SIG)) || (VAR_1->flags[VAR_8 + 3][VAR_9 + 1] & (JPEG2000_T1_SIG_NB | JPEG2000_T1_VIS | JPEG2000_T1_SIG)) || (VAR_1->flags[VAR_8 + 4][VAR_9 + 1] & (JPEG2000_T1_SIG_NB | JPEG2000_T1_VIS | JPEG2000_T1_SIG)))) { if (!ff_mqc_decode(&VAR_1->mqc, VAR_1->mqc.cx_states + MQC_CX_RL)) continue; VAR_11 = ff_mqc_decode(&VAR_1->mqc, VAR_1->mqc.cx_states + MQC_CX_UNI); VAR_11 = (VAR_11 << 1) | ff_mqc_decode(&VAR_1->mqc, VAR_1->mqc.cx_states + MQC_CX_UNI); VAR_12 = 1; } else { VAR_11 = 0; VAR_12 = 0; } for (VAR_10 = VAR_8 + VAR_11; VAR_10 < VAR_8 + 4 && VAR_10 < VAR_3; VAR_10++) { if (!VAR_12) { if (!(VAR_1->flags[VAR_10 + 1][VAR_9 + 1] & (JPEG2000_T1_SIG | JPEG2000_T1_VIS))) VAR_12 = ff_mqc_decode(&VAR_1->mqc, VAR_1->mqc.cx_states + ff_jpeg2000_getsigctxno(VAR_1->flags[VAR_10 + 1][VAR_9 + 1], VAR_5)); } if (VAR_12) { int VAR_13; int VAR_14 = ff_jpeg2000_getsgnctxno(VAR_1->flags[VAR_10 + 1][VAR_9 + 1], &VAR_13); VAR_1->data[VAR_10][VAR_9] = (ff_mqc_decode(&VAR_1->mqc, VAR_1->mqc.cx_states + VAR_14) ^ VAR_13) ? -VAR_7 : VAR_7; ff_jpeg2000_set_significance(VAR_1, VAR_9, VAR_10, VAR_1->data[VAR_10][VAR_9] < 0); } VAR_12 = 0; VAR_1->flags[VAR_10 + 1][VAR_9 + 1] &= ~JPEG2000_T1_VIS; } } if (VAR_6) { int VAR_15; VAR_15 = ff_mqc_decode(&VAR_1->mqc, VAR_1->mqc.cx_states + MQC_CX_UNI); VAR_15 = (VAR_15 << 1) + ff_mqc_decode(&VAR_1->mqc, VAR_1->mqc.cx_states + MQC_CX_UNI); VAR_15 = (VAR_15 << 1) + ff_mqc_decode(&VAR_1->mqc, VAR_1->mqc.cx_states + MQC_CX_UNI); VAR_15 = (VAR_15 << 1) + ff_mqc_decode(&VAR_1->mqc, VAR_1->mqc.cx_states + MQC_CX_UNI); if (VAR_15 != 0xa) av_log(VAR_0->avctx, AV_LOG_ERROR, "Segmentation symbol value incorrect\n"); } }
[ "static void FUNC_0(Jpeg2000DecoderContext *VAR_0, Jpeg2000T1Context *VAR_1,\nint VAR_2, int VAR_3, int VAR_4, int VAR_5,\nint VAR_6)\n{", "int VAR_7 = 3 << (VAR_4 - 1), VAR_8, VAR_9, VAR_10, VAR_11, VAR_12;", "for (VAR_8 = 0; VAR_8 < VAR_3; VAR_8 += 4)", "for (VAR_9 = 0; VAR_9 < VAR_2; VAR_9++) {", "if (VAR_8 + 3 < VAR_3 &&\n!((VAR_1->flags[VAR_8 + 1][VAR_9 + 1] & (JPEG2000_T1_SIG_NB | JPEG2000_T1_VIS | JPEG2000_T1_SIG)) ||\n(VAR_1->flags[VAR_8 + 2][VAR_9 + 1] & (JPEG2000_T1_SIG_NB | JPEG2000_T1_VIS | JPEG2000_T1_SIG)) ||\n(VAR_1->flags[VAR_8 + 3][VAR_9 + 1] & (JPEG2000_T1_SIG_NB | JPEG2000_T1_VIS | JPEG2000_T1_SIG)) ||\n(VAR_1->flags[VAR_8 + 4][VAR_9 + 1] & (JPEG2000_T1_SIG_NB | JPEG2000_T1_VIS | JPEG2000_T1_SIG)))) {", "if (!ff_mqc_decode(&VAR_1->mqc, VAR_1->mqc.cx_states + MQC_CX_RL))\ncontinue;", "VAR_11 = ff_mqc_decode(&VAR_1->mqc,\nVAR_1->mqc.cx_states + MQC_CX_UNI);", "VAR_11 = (VAR_11 << 1) | ff_mqc_decode(&VAR_1->mqc,\nVAR_1->mqc.cx_states +\nMQC_CX_UNI);", "VAR_12 = 1;", "} else {", "VAR_11 = 0;", "VAR_12 = 0;", "}", "for (VAR_10 = VAR_8 + VAR_11; VAR_10 < VAR_8 + 4 && VAR_10 < VAR_3; VAR_10++) {", "if (!VAR_12) {", "if (!(VAR_1->flags[VAR_10 + 1][VAR_9 + 1] & (JPEG2000_T1_SIG | JPEG2000_T1_VIS)))\nVAR_12 = ff_mqc_decode(&VAR_1->mqc,\nVAR_1->mqc.cx_states +\nff_jpeg2000_getsigctxno(VAR_1->flags[VAR_10 + 1][VAR_9 + 1],\nVAR_5));", "}", "if (VAR_12) {", "int VAR_13;", "int VAR_14 = ff_jpeg2000_getsgnctxno(VAR_1->flags[VAR_10 + 1][VAR_9 + 1],\n&VAR_13);", "VAR_1->data[VAR_10][VAR_9] = (ff_mqc_decode(&VAR_1->mqc,\nVAR_1->mqc.cx_states + VAR_14) ^\nVAR_13)\n? -VAR_7 : VAR_7;", "ff_jpeg2000_set_significance(VAR_1, VAR_9, VAR_10, VAR_1->data[VAR_10][VAR_9] < 0);", "}", "VAR_12 = 0;", "VAR_1->flags[VAR_10 + 1][VAR_9 + 1] &= ~JPEG2000_T1_VIS;", "}", "}", "if (VAR_6) {", "int VAR_15;", "VAR_15 = ff_mqc_decode(&VAR_1->mqc, VAR_1->mqc.cx_states + MQC_CX_UNI);", "VAR_15 = (VAR_15 << 1) + ff_mqc_decode(&VAR_1->mqc, VAR_1->mqc.cx_states + MQC_CX_UNI);", "VAR_15 = (VAR_15 << 1) + ff_mqc_decode(&VAR_1->mqc, VAR_1->mqc.cx_states + MQC_CX_UNI);", "VAR_15 = (VAR_15 << 1) + ff_mqc_decode(&VAR_1->mqc, VAR_1->mqc.cx_states + MQC_CX_UNI);", "if (VAR_15 != 0xa)\nav_log(VAR_0->avctx, AV_LOG_ERROR,\n\"Segmentation symbol value incorrect\\n\");", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17, 19, 21, 23, 25 ], [ 27, 29 ], [ 31, 33 ], [ 35, 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57, 59, 61, 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77, 79, 81, 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109, 111, 113 ], [ 115 ], [ 117 ] ]
25,445
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); }
false
FFmpeg
6796a1dd8c14843b77925cb83a3ef88706ae1dd0
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); }
{ "code": [], "line_no": [] }
void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1, ptrdiff_t VAR_2) { avc_luma_vt_qrt_8w_msa(VAR_1 - (VAR_2 * 2), VAR_2, VAR_0, VAR_2, 8, 1); }
[ "void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1,\nptrdiff_t VAR_2)\n{", "avc_luma_vt_qrt_8w_msa(VAR_1 - (VAR_2 * 2), VAR_2, VAR_0, VAR_2, 8, 1);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
25,446
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); }
false
FFmpeg
e56d1a120324fa49a5367cbf22098c5c7eb23f91
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); }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVFormatContext *s1) { AlsaData *s = s1->priv_data; AVStream *st; unsigned int VAR_0; enum AVCodecID VAR_1; int VAR_2; st = s1->streams[0]; VAR_0 = st->codec->VAR_0; VAR_1 = st->codec->VAR_1; VAR_2 = ff_alsa_open(s1, SND_PCM_STREAM_PLAYBACK, &VAR_0, st->codec->channels, &VAR_1); if (VAR_0 != st->codec->VAR_0) { av_log(s1, AV_LOG_ERROR, "sample rate %d not available, nearest is %d\n", st->codec->VAR_0, VAR_0); goto fail; } avpriv_set_pts_info(st, 64, 1, VAR_0); return VAR_2; fail: snd_pcm_close(s->h); return AVERROR(EIO); }
[ "static av_cold int FUNC_0(AVFormatContext *s1)\n{", "AlsaData *s = s1->priv_data;", "AVStream *st;", "unsigned int VAR_0;", "enum AVCodecID VAR_1;", "int VAR_2;", "st = s1->streams[0];", "VAR_0 = st->codec->VAR_0;", "VAR_1 = st->codec->VAR_1;", "VAR_2 = ff_alsa_open(s1, SND_PCM_STREAM_PLAYBACK, &VAR_0,\nst->codec->channels, &VAR_1);", "if (VAR_0 != st->codec->VAR_0) {", "av_log(s1, AV_LOG_ERROR,\n\"sample rate %d not available, nearest is %d\\n\",\nst->codec->VAR_0, VAR_0);", "goto fail;", "}", "avpriv_set_pts_info(st, 64, 1, VAR_0);", "return VAR_2;", "fail:\nsnd_pcm_close(s->h);", "return AVERROR(EIO);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29, 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 47, 49 ], [ 51 ], [ 53 ] ]
25,447
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; }
false
FFmpeg
2773ab36cc6480ce77845df0b1d1e2f790c59cde
int ff_jpegls_decode_lse(MJpegDecodeContext *s) { int id; int tid, wt, maxtab, i, j; int len = get_bits(&s->gb, 16); 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); 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; }
{ "code": [], "line_no": [] }
int FUNC_0(MJpegDecodeContext *VAR_0) { int VAR_1; int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6; int VAR_7 = get_bits(&VAR_0->gb, 16); VAR_1 = get_bits(&VAR_0->gb, 8); switch (VAR_1) { case 1: VAR_0->maxval = get_bits(&VAR_0->gb, 16); VAR_0->t1 = get_bits(&VAR_0->gb, 16); VAR_0->t2 = get_bits(&VAR_0->gb, 16); VAR_0->t3 = get_bits(&VAR_0->gb, 16); VAR_0->reset = get_bits(&VAR_0->gb, 16); break; case 2: VAR_0->palette_index = 0; case 3: VAR_2= get_bits(&VAR_0->gb, 8); VAR_3 = get_bits(&VAR_0->gb, 8); if (VAR_7 < 5) return AVERROR_INVALIDDATA; if (VAR_3 < 1 || VAR_3 > MAX_COMPONENTS) { avpriv_request_sample(VAR_0->avctx, "VAR_3 %d", VAR_3); return AVERROR_PATCHWELCOME; } if (!VAR_0->maxval) VAR_4 = 255; else if ((5 + VAR_3*(VAR_0->maxval+1)) < 65535) VAR_4 = VAR_0->maxval; else VAR_4 = 65530/VAR_3 - 1; if(VAR_0->avctx->debug & FF_DEBUG_PICT_INFO) { av_log(VAR_0->avctx, AV_LOG_DEBUG, "LSE palette %d VAR_2:%d VAR_3:%d VAR_4:%d\n", VAR_1, VAR_2, VAR_3, VAR_4); } if (VAR_4 >= 256) { avpriv_request_sample(VAR_0->avctx, ">8bit palette"); return AVERROR_PATCHWELCOME; } VAR_4 = FFMIN(VAR_4, (VAR_7 - 5) / VAR_3 + VAR_0->palette_index); if (VAR_0->palette_index > VAR_4) return AVERROR_INVALIDDATA; if ((VAR_0->avctx->pix_fmt == AV_PIX_FMT_GRAY8 || VAR_0->avctx->pix_fmt == AV_PIX_FMT_PAL8) && (VAR_0->picture_ptr->format == AV_PIX_FMT_GRAY8 || VAR_0->picture_ptr->format == AV_PIX_FMT_PAL8)) { uint32_t *pal = VAR_0->picture_ptr->data[1]; VAR_0->picture_ptr->format = VAR_0->avctx->pix_fmt = AV_PIX_FMT_PAL8; for (VAR_5=VAR_0->palette_index; VAR_5<=VAR_4; VAR_5++) { pal[VAR_5] = 0; for (VAR_6=0; VAR_6<VAR_3; VAR_6++) { pal[VAR_5] |= get_bits(&VAR_0->gb, 8) << (8*(VAR_3-VAR_6-1)); } } VAR_0->palette_index = VAR_5; } break; case 4: avpriv_request_sample(VAR_0->avctx, "oversize image"); return AVERROR(ENOSYS); default: av_log(VAR_0->avctx, AV_LOG_ERROR, "invalid VAR_1 %d\n", VAR_1); return AVERROR_INVALIDDATA; } av_dlog(VAR_0->avctx, "ID=%VAR_5, T=%VAR_5,%VAR_5,%VAR_5\n", VAR_1, VAR_0->t1, VAR_0->t2, VAR_0->t3); return 0; }
[ "int FUNC_0(MJpegDecodeContext *VAR_0)\n{", "int VAR_1;", "int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6;", "int VAR_7 = get_bits(&VAR_0->gb, 16);", "VAR_1 = get_bits(&VAR_0->gb, 8);", "switch (VAR_1) {", "case 1:\nVAR_0->maxval = get_bits(&VAR_0->gb, 16);", "VAR_0->t1 = get_bits(&VAR_0->gb, 16);", "VAR_0->t2 = get_bits(&VAR_0->gb, 16);", "VAR_0->t3 = get_bits(&VAR_0->gb, 16);", "VAR_0->reset = get_bits(&VAR_0->gb, 16);", "break;", "case 2:\nVAR_0->palette_index = 0;", "case 3:\nVAR_2= get_bits(&VAR_0->gb, 8);", "VAR_3 = get_bits(&VAR_0->gb, 8);", "if (VAR_7 < 5)\nreturn AVERROR_INVALIDDATA;", "if (VAR_3 < 1 || VAR_3 > MAX_COMPONENTS) {", "avpriv_request_sample(VAR_0->avctx, \"VAR_3 %d\", VAR_3);", "return AVERROR_PATCHWELCOME;", "}", "if (!VAR_0->maxval)\nVAR_4 = 255;", "else if ((5 + VAR_3*(VAR_0->maxval+1)) < 65535)\nVAR_4 = VAR_0->maxval;", "else\nVAR_4 = 65530/VAR_3 - 1;", "if(VAR_0->avctx->debug & FF_DEBUG_PICT_INFO) {", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"LSE palette %d VAR_2:%d VAR_3:%d VAR_4:%d\\n\", VAR_1, VAR_2, VAR_3, VAR_4);", "}", "if (VAR_4 >= 256) {", "avpriv_request_sample(VAR_0->avctx, \">8bit palette\");", "return AVERROR_PATCHWELCOME;", "}", "VAR_4 = FFMIN(VAR_4, (VAR_7 - 5) / VAR_3 + VAR_0->palette_index);", "if (VAR_0->palette_index > VAR_4)\nreturn AVERROR_INVALIDDATA;", "if ((VAR_0->avctx->pix_fmt == AV_PIX_FMT_GRAY8 || VAR_0->avctx->pix_fmt == AV_PIX_FMT_PAL8) &&\n(VAR_0->picture_ptr->format == AV_PIX_FMT_GRAY8 || VAR_0->picture_ptr->format == AV_PIX_FMT_PAL8)) {", "uint32_t *pal = VAR_0->picture_ptr->data[1];", "VAR_0->picture_ptr->format =\nVAR_0->avctx->pix_fmt = AV_PIX_FMT_PAL8;", "for (VAR_5=VAR_0->palette_index; VAR_5<=VAR_4; VAR_5++) {", "pal[VAR_5] = 0;", "for (VAR_6=0; VAR_6<VAR_3; VAR_6++) {", "pal[VAR_5] |= get_bits(&VAR_0->gb, 8) << (8*(VAR_3-VAR_6-1));", "}", "}", "VAR_0->palette_index = VAR_5;", "}", "break;", "case 4:\navpriv_request_sample(VAR_0->avctx, \"oversize image\");", "return AVERROR(ENOSYS);", "default:\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"invalid VAR_1 %d\\n\", VAR_1);", "return AVERROR_INVALIDDATA;", "}", "av_dlog(VAR_0->avctx, \"ID=%VAR_5, T=%VAR_5,%VAR_5,%VAR_5\\n\", VAR_1, VAR_0->t1, VAR_0->t2, VAR_0->t3);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 37 ], [ 39, 41 ], [ 43, 45 ], [ 47 ], [ 51, 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67, 69 ], [ 71, 73 ], [ 75, 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99, 101 ], [ 105, 107 ], [ 109 ], [ 111, 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 139, 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ] ]
25,449
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; }
false
FFmpeg
019247bdc326a90bf20d3ce5d2413cc642e8bb08
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); avio_rb24(pb); 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); } sc->keyframe_count = i; if (pb->eof_reached) return AVERROR_EOF; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2) { AVStream *st; MOVStreamContext *sc; unsigned int VAR_3, VAR_4; if (VAR_0->fc->nb_streams < 1) return 0; st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1]; sc = st->priv_data; avio_r8(VAR_1); avio_rb24(VAR_1); VAR_4 = avio_rb32(VAR_1); av_dlog(VAR_0->fc, "keyframe_count = %d\n", VAR_4); if (!VAR_4) { sc->keyframe_absent = 1; if (!st->need_parsing) st->need_parsing = AVSTREAM_PARSE_HEADERS; return 0; } if (VAR_4 >= UINT_MAX / sizeof(int)) return AVERROR_INVALIDDATA; sc->keyframes = av_malloc(VAR_4 * sizeof(int)); if (!sc->keyframes) return AVERROR(ENOMEM); for (VAR_3 = 0; VAR_3 < VAR_4 && !VAR_1->eof_reached; VAR_3++) { sc->keyframes[VAR_3] = avio_rb32(VAR_1); } sc->keyframe_count = VAR_3; if (VAR_1->eof_reached) return AVERROR_EOF; return 0; }
[ "static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2)\n{", "AVStream *st;", "MOVStreamContext *sc;", "unsigned int VAR_3, VAR_4;", "if (VAR_0->fc->nb_streams < 1)\nreturn 0;", "st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1];", "sc = st->priv_data;", "avio_r8(VAR_1);", "avio_rb24(VAR_1);", "VAR_4 = avio_rb32(VAR_1);", "av_dlog(VAR_0->fc, \"keyframe_count = %d\\n\", VAR_4);", "if (!VAR_4)\n{", "sc->keyframe_absent = 1;", "if (!st->need_parsing)\nst->need_parsing = AVSTREAM_PARSE_HEADERS;", "return 0;", "}", "if (VAR_4 >= UINT_MAX / sizeof(int))\nreturn AVERROR_INVALIDDATA;", "sc->keyframes = av_malloc(VAR_4 * sizeof(int));", "if (!sc->keyframes)\nreturn AVERROR(ENOMEM);", "for (VAR_3 = 0; VAR_3 < VAR_4 && !VAR_1->eof_reached; VAR_3++) {", "sc->keyframes[VAR_3] = avio_rb32(VAR_1);", "}", "sc->keyframe_count = VAR_3;", "if (VAR_1->eof_reached)\nreturn AVERROR_EOF;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 33 ], [ 37, 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57, 59 ], [ 63 ], [ 65 ], [ 69 ], [ 73 ], [ 77, 79 ], [ 83 ], [ 85 ] ]
25,450
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; }
false
FFmpeg
741aca793623afeff1d18816f416cc65104b7ef9
void swr_compensate(struct SwrContext *s, int sample_delta, int compensation_distance){ ResampleContext *c= s->resample; c->compensation_distance= compensation_distance; c->dst_incr = c->ideal_dst_incr - c->ideal_dst_incr * (int64_t)sample_delta / compensation_distance; }
{ "code": [], "line_no": [] }
void FUNC_0(struct SwrContext *VAR_0, int VAR_1, int VAR_2){ ResampleContext *c= VAR_0->resample; c->VAR_2= VAR_2; c->dst_incr = c->ideal_dst_incr - c->ideal_dst_incr * (int64_t)VAR_1 / VAR_2; }
[ "void FUNC_0(struct SwrContext *VAR_0, int VAR_1, int VAR_2){", "ResampleContext *c= VAR_0->resample;", "c->VAR_2= VAR_2;", "c->dst_incr = c->ideal_dst_incr - c->ideal_dst_incr * (int64_t)VAR_1 / VAR_2;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 7 ], [ 9 ], [ 11 ] ]
25,451
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; }
false
FFmpeg
d52b4abe8b7d58b1680b5ae5fccfcbd50ad98ef0
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); 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); 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){ for(i=0; i<MAX_PICTURE_COUNT; i++){ if(s->picture[i].data[0] && !s->picture[i].reference ){ free_frame_buffer(s, &s->picture[i]); } } if(s->current_picture_ptr && s->current_picture_ptr->data[0]==NULL) pic= s->current_picture_ptr; 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; s->current_picture_ptr->interlaced_frame= !s->progressive_frame && !s->progressive_sequence; } s->current_picture_ptr->pict_type= s->pict_type; 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; } 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); 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; 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; }
{ "code": [], "line_no": [] }
int FUNC_0(MpegEncContext *VAR_0, AVCodecContext *VAR_1) { int VAR_3; Picture *pic; VAR_0->mb_skipped = 0; assert(VAR_0->last_picture_ptr==NULL || VAR_0->out_format != FMT_H264 || VAR_0->codec_id == CODEC_ID_SVQ3); if (VAR_0->pict_type != FF_B_TYPE && VAR_0->last_picture_ptr && VAR_0->last_picture_ptr != VAR_0->next_picture_ptr && VAR_0->last_picture_ptr->data[0]) { if(VAR_0->out_format != FMT_H264 || VAR_0->codec_id == CODEC_ID_SVQ3){ free_frame_buffer(VAR_0, VAR_0->last_picture_ptr); if(!VAR_0->encoding){ for(VAR_3=0; VAR_3<MAX_PICTURE_COUNT; VAR_3++){ if(VAR_0->picture[VAR_3].data[0] && &VAR_0->picture[VAR_3] != VAR_0->next_picture_ptr && VAR_0->picture[VAR_3].reference){ av_log(VAR_1, AV_LOG_ERROR, "releasing zombie picture\n"); free_frame_buffer(VAR_0, &VAR_0->picture[VAR_3]); } } } } } alloc: if(!VAR_0->encoding){ for(VAR_3=0; VAR_3<MAX_PICTURE_COUNT; VAR_3++){ if(VAR_0->picture[VAR_3].data[0] && !VAR_0->picture[VAR_3].reference ){ free_frame_buffer(VAR_0, &VAR_0->picture[VAR_3]); } } if(VAR_0->current_picture_ptr && VAR_0->current_picture_ptr->data[0]==NULL) pic= VAR_0->current_picture_ptr; else{ VAR_3= ff_find_unused_picture(VAR_0, 0); pic= &VAR_0->picture[VAR_3]; } pic->reference= 0; if (!VAR_0->dropable){ if (VAR_0->codec_id == CODEC_ID_H264) pic->reference = VAR_0->picture_structure; else if (VAR_0->pict_type != FF_B_TYPE) pic->reference = 3; } pic->coded_picture_number= VAR_0->coded_picture_number++; if(ff_alloc_picture(VAR_0, pic, 0) < 0) return -1; VAR_0->current_picture_ptr= pic; VAR_0->current_picture_ptr->top_field_first= VAR_0->top_field_first; VAR_0->current_picture_ptr->interlaced_frame= !VAR_0->progressive_frame && !VAR_0->progressive_sequence; } VAR_0->current_picture_ptr->pict_type= VAR_0->pict_type; VAR_0->current_picture_ptr->key_frame= VAR_0->pict_type == FF_I_TYPE; ff_copy_picture(&VAR_0->current_picture, VAR_0->current_picture_ptr); if (VAR_0->pict_type != FF_B_TYPE) { VAR_0->last_picture_ptr= VAR_0->next_picture_ptr; if(!VAR_0->dropable) VAR_0->next_picture_ptr= VAR_0->current_picture_ptr; } if(VAR_0->last_picture_ptr) ff_copy_picture(&VAR_0->last_picture, VAR_0->last_picture_ptr); if(VAR_0->next_picture_ptr) ff_copy_picture(&VAR_0->next_picture, VAR_0->next_picture_ptr); if(VAR_0->pict_type != FF_I_TYPE && (VAR_0->last_picture_ptr==NULL || VAR_0->last_picture_ptr->data[0]==NULL) && !VAR_0->dropable && VAR_0->codec_id != CODEC_ID_H264){ av_log(VAR_1, AV_LOG_ERROR, "warning: first frame is no keyframe\n"); assert(VAR_0->pict_type != FF_B_TYPE); goto alloc; } assert(VAR_0->pict_type == FF_I_TYPE || (VAR_0->last_picture_ptr && VAR_0->last_picture_ptr->data[0])); if(VAR_0->picture_structure!=PICT_FRAME && VAR_0->out_format != FMT_H264){ int VAR_3; for(VAR_3=0; VAR_3<4; VAR_3++){ if(VAR_0->picture_structure == PICT_BOTTOM_FIELD){ VAR_0->current_picture.data[VAR_3] += VAR_0->current_picture.linesize[VAR_3]; } VAR_0->current_picture.linesize[VAR_3] *= 2; VAR_0->last_picture.linesize[VAR_3] *=2; VAR_0->next_picture.linesize[VAR_3] *=2; } } VAR_0->hurry_up= VAR_0->VAR_1->hurry_up; VAR_0->error_recognition= VAR_1->error_recognition; if(VAR_0->mpeg_quant || VAR_0->codec_id == CODEC_ID_MPEG2VIDEO){ VAR_0->dct_unquantize_intra = VAR_0->dct_unquantize_mpeg2_intra; VAR_0->dct_unquantize_inter = VAR_0->dct_unquantize_mpeg2_inter; }else if(VAR_0->out_format == FMT_H263 || VAR_0->out_format == FMT_H261){ VAR_0->dct_unquantize_intra = VAR_0->dct_unquantize_h263_intra; VAR_0->dct_unquantize_inter = VAR_0->dct_unquantize_h263_inter; }else{ VAR_0->dct_unquantize_intra = VAR_0->dct_unquantize_mpeg1_intra; VAR_0->dct_unquantize_inter = VAR_0->dct_unquantize_mpeg1_inter; } if(VAR_0->dct_error_sum){ assert(VAR_0->VAR_1->noise_reduction && VAR_0->encoding); update_noise_reduction(VAR_0); } if(CONFIG_MPEG_XVMC_DECODER && VAR_0->VAR_1->xvmc_acceleration) return ff_xvmc_field_start(VAR_0, VAR_1); return 0; }
[ "int FUNC_0(MpegEncContext *VAR_0, AVCodecContext *VAR_1)\n{", "int VAR_3;", "Picture *pic;", "VAR_0->mb_skipped = 0;", "assert(VAR_0->last_picture_ptr==NULL || VAR_0->out_format != FMT_H264 || VAR_0->codec_id == CODEC_ID_SVQ3);", "if (VAR_0->pict_type != FF_B_TYPE && VAR_0->last_picture_ptr && VAR_0->last_picture_ptr != VAR_0->next_picture_ptr && VAR_0->last_picture_ptr->data[0]) {", "if(VAR_0->out_format != FMT_H264 || VAR_0->codec_id == CODEC_ID_SVQ3){", "free_frame_buffer(VAR_0, VAR_0->last_picture_ptr);", "if(!VAR_0->encoding){", "for(VAR_3=0; VAR_3<MAX_PICTURE_COUNT; VAR_3++){", "if(VAR_0->picture[VAR_3].data[0] && &VAR_0->picture[VAR_3] != VAR_0->next_picture_ptr && VAR_0->picture[VAR_3].reference){", "av_log(VAR_1, AV_LOG_ERROR, \"releasing zombie picture\\n\");", "free_frame_buffer(VAR_0, &VAR_0->picture[VAR_3]);", "}", "}", "}", "}", "}", "alloc:\nif(!VAR_0->encoding){", "for(VAR_3=0; VAR_3<MAX_PICTURE_COUNT; VAR_3++){", "if(VAR_0->picture[VAR_3].data[0] && !VAR_0->picture[VAR_3].reference ){", "free_frame_buffer(VAR_0, &VAR_0->picture[VAR_3]);", "}", "}", "if(VAR_0->current_picture_ptr && VAR_0->current_picture_ptr->data[0]==NULL)\npic= VAR_0->current_picture_ptr;", "else{", "VAR_3= ff_find_unused_picture(VAR_0, 0);", "pic= &VAR_0->picture[VAR_3];", "}", "pic->reference= 0;", "if (!VAR_0->dropable){", "if (VAR_0->codec_id == CODEC_ID_H264)\npic->reference = VAR_0->picture_structure;", "else if (VAR_0->pict_type != FF_B_TYPE)\npic->reference = 3;", "}", "pic->coded_picture_number= VAR_0->coded_picture_number++;", "if(ff_alloc_picture(VAR_0, pic, 0) < 0)\nreturn -1;", "VAR_0->current_picture_ptr= pic;", "VAR_0->current_picture_ptr->top_field_first= VAR_0->top_field_first;", "VAR_0->current_picture_ptr->interlaced_frame= !VAR_0->progressive_frame && !VAR_0->progressive_sequence;", "}", "VAR_0->current_picture_ptr->pict_type= VAR_0->pict_type;", "VAR_0->current_picture_ptr->key_frame= VAR_0->pict_type == FF_I_TYPE;", "ff_copy_picture(&VAR_0->current_picture, VAR_0->current_picture_ptr);", "if (VAR_0->pict_type != FF_B_TYPE) {", "VAR_0->last_picture_ptr= VAR_0->next_picture_ptr;", "if(!VAR_0->dropable)\nVAR_0->next_picture_ptr= VAR_0->current_picture_ptr;", "}", "if(VAR_0->last_picture_ptr) ff_copy_picture(&VAR_0->last_picture, VAR_0->last_picture_ptr);", "if(VAR_0->next_picture_ptr) ff_copy_picture(&VAR_0->next_picture, VAR_0->next_picture_ptr);", "if(VAR_0->pict_type != FF_I_TYPE && (VAR_0->last_picture_ptr==NULL || VAR_0->last_picture_ptr->data[0]==NULL) && !VAR_0->dropable && VAR_0->codec_id != CODEC_ID_H264){", "av_log(VAR_1, AV_LOG_ERROR, \"warning: first frame is no keyframe\\n\");", "assert(VAR_0->pict_type != FF_B_TYPE);", "goto alloc;", "}", "assert(VAR_0->pict_type == FF_I_TYPE || (VAR_0->last_picture_ptr && VAR_0->last_picture_ptr->data[0]));", "if(VAR_0->picture_structure!=PICT_FRAME && VAR_0->out_format != FMT_H264){", "int VAR_3;", "for(VAR_3=0; VAR_3<4; VAR_3++){", "if(VAR_0->picture_structure == PICT_BOTTOM_FIELD){", "VAR_0->current_picture.data[VAR_3] += VAR_0->current_picture.linesize[VAR_3];", "}", "VAR_0->current_picture.linesize[VAR_3] *= 2;", "VAR_0->last_picture.linesize[VAR_3] *=2;", "VAR_0->next_picture.linesize[VAR_3] *=2;", "}", "}", "VAR_0->hurry_up= VAR_0->VAR_1->hurry_up;", "VAR_0->error_recognition= VAR_1->error_recognition;", "if(VAR_0->mpeg_quant || VAR_0->codec_id == CODEC_ID_MPEG2VIDEO){", "VAR_0->dct_unquantize_intra = VAR_0->dct_unquantize_mpeg2_intra;", "VAR_0->dct_unquantize_inter = VAR_0->dct_unquantize_mpeg2_inter;", "}else if(VAR_0->out_format == FMT_H263 || VAR_0->out_format == FMT_H261){", "VAR_0->dct_unquantize_intra = VAR_0->dct_unquantize_h263_intra;", "VAR_0->dct_unquantize_inter = VAR_0->dct_unquantize_h263_inter;", "}else{", "VAR_0->dct_unquantize_intra = VAR_0->dct_unquantize_mpeg1_intra;", "VAR_0->dct_unquantize_inter = VAR_0->dct_unquantize_mpeg1_inter;", "}", "if(VAR_0->dct_error_sum){", "assert(VAR_0->VAR_1->noise_reduction && VAR_0->encoding);", "update_noise_reduction(VAR_0);", "}", "if(CONFIG_MPEG_XVMC_DECODER && VAR_0->VAR_1->xvmc_acceleration)\nreturn ff_xvmc_field_start(VAR_0, VAR_1);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 19 ], [ 21 ], [ 23 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 91, 93 ], [ 95 ], [ 99 ], [ 103, 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 125 ], [ 129 ], [ 133 ], [ 135 ], [ 137, 139 ], [ 141 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 173 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 201 ], [ 203 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 233 ], [ 235 ], [ 239 ], [ 241 ], [ 245, 247 ], [ 251 ], [ 253 ] ]
25,452
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;
true
qemu
4577b09a278fe9134ecb9192c2ae2ed67a0d0aa7
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;
{ "code": [], "line_no": [] }
FUNC_0(Slirp *VAR_0, uint32_t VAR_1, u_int VAR_2, uint32_t VAR_3, u_int VAR_4, int VAR_5) { struct sockaddr_in VAR_6; struct socket *VAR_7; socklen_t addrlen = sizeof(struct sockaddr_in); VAR_7 = socreate(VAR_0); if (!VAR_7) { VAR_7->s = qemu_socket(AF_INET,SOCK_DGRAM,0); VAR_7->so_expire = curtime + SO_EXPIRE; insque(VAR_7, &VAR_0->udb); VAR_6.sin_family = AF_INET; VAR_6.sin_addr.s_addr = VAR_1; VAR_6.sin_port = VAR_2; if (bind(VAR_7->s,(struct sockaddr *)&VAR_6, addrlen) < 0) { udp_detach(VAR_7); socket_set_fast_reuse(VAR_7->s); getsockname(VAR_7->s,(struct sockaddr *)&VAR_6,&addrlen); VAR_7->fhost.sin = VAR_6; sotranslate_accept(VAR_7); VAR_7->so_lfamily = AF_INET; VAR_7->so_lport = VAR_4; VAR_7->so_laddr.s_addr = VAR_3; if (VAR_5 != SS_FACCEPTONCE) VAR_7->so_expire = 0; VAR_7->so_state &= SS_PERSISTENT_MASK; VAR_7->so_state |= SS_ISFCONNECTED | VAR_5; return VAR_7;
[ "FUNC_0(Slirp *VAR_0, uint32_t VAR_1, u_int VAR_2, uint32_t VAR_3,\nu_int VAR_4, int VAR_5)\n{", "struct sockaddr_in VAR_6;", "struct socket *VAR_7;", "socklen_t addrlen = sizeof(struct sockaddr_in);", "VAR_7 = socreate(VAR_0);", "if (!VAR_7) {", "VAR_7->s = qemu_socket(AF_INET,SOCK_DGRAM,0);", "VAR_7->so_expire = curtime + SO_EXPIRE;", "insque(VAR_7, &VAR_0->udb);", "VAR_6.sin_family = AF_INET;", "VAR_6.sin_addr.s_addr = VAR_1;", "VAR_6.sin_port = VAR_2;", "if (bind(VAR_7->s,(struct sockaddr *)&VAR_6, addrlen) < 0) {", "udp_detach(VAR_7);", "socket_set_fast_reuse(VAR_7->s);", "getsockname(VAR_7->s,(struct sockaddr *)&VAR_6,&addrlen);", "VAR_7->fhost.sin = VAR_6;", "sotranslate_accept(VAR_7);", "VAR_7->so_lfamily = AF_INET;", "VAR_7->so_lport = VAR_4;", "VAR_7->so_laddr.s_addr = VAR_3;", "if (VAR_5 != SS_FACCEPTONCE)\nVAR_7->so_expire = 0;", "VAR_7->so_state &= SS_PERSISTENT_MASK;", "VAR_7->so_state |= SS_ISFCONNECTED | VAR_5;", "return VAR_7;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 69 ], [ 71 ], [ 75 ] ]
25,453
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; }
true
qemu
12848bfc5d719bad536c5448205a3226be1fda47
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; }
{ "code": [ " return -1;" ], "line_no": [ 9 ] }
static int FUNC_0(FsContext *VAR_0, const char *VAR_1, FsCred *VAR_2) { if (chmod(rpath(VAR_0, VAR_1), VAR_2->fc_mode & 07777) < 0) { return -1; } if (chown(rpath(VAR_0, VAR_1), VAR_2->fc_uid, VAR_2->fc_gid) < 0) { return -1; } return 0; }
[ "static int FUNC_0(FsContext *VAR_0, const char *VAR_1,\nFsCred *VAR_2)\n{", "if (chmod(rpath(VAR_0, VAR_1), VAR_2->fc_mode & 07777) < 0) {", "return -1;", "}", "if (chown(rpath(VAR_0, VAR_1), VAR_2->fc_uid, VAR_2->fc_gid) < 0) {", "return -1;", "}", "return 0;", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
25,454
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; }
true
qemu
7faa8075d898ae56d2c533c530569bb25ab86eaf
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)); 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; }
{ "code": [ " s->pci0_status.up = 0;", " s->pci0_status.down = 0;" ], "line_no": [ 29, 31 ] }
static int FUNC_0(DeviceState *VAR_0, PCIDevice *VAR_1, PCIHotplugState VAR_2) { int VAR_3 = PCI_SLOT(VAR_1->devfn); PIIX4PMState *s = DO_UPCAST(PIIX4PMState, VAR_1, PCI_DEVICE(VAR_0)); if (VAR_2 == PCI_COLDPLUG_ENABLED) { return 0; } s->pci0_status.up = 0; s->pci0_status.down = 0; if (VAR_2 == PCI_HOTPLUG_ENABLED) { enable_device(s, VAR_3); } else { disable_device(s, VAR_3); } pm_update_sci(s); return 0; }
[ "static int FUNC_0(DeviceState *VAR_0, PCIDevice *VAR_1,\nPCIHotplugState VAR_2)\n{", "int VAR_3 = PCI_SLOT(VAR_1->devfn);", "PIIX4PMState *s = DO_UPCAST(PIIX4PMState, VAR_1,\nPCI_DEVICE(VAR_0));", "if (VAR_2 == PCI_COLDPLUG_ENABLED) {", "return 0;", "}", "s->pci0_status.up = 0;", "s->pci0_status.down = 0;", "if (VAR_2 == PCI_HOTPLUG_ENABLED) {", "enable_device(s, VAR_3);", "} else {", "disable_device(s, VAR_3);", "}", "pm_update_sci(s);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9, 11 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 49 ], [ 51 ] ]
25,455
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;
true
FFmpeg
7c1805869d6f8dd9292977393aa4d97417716852
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; 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]; 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 { memcpy(s->extra_samples + s->extra_sample_count, src, buf_size); s->extra_sample_count += buf_size; return avpkt->size; if (blocks) { pcm_dvd_decode_samples(avctx, src, dst, blocks); buf_size -= blocks * s->block_size; 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;
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { AVFrame *frame = VAR_1; const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; PCMDVDContext *s = VAR_0->priv_data; int VAR_6; int VAR_7; void *VAR_8; if (VAR_5 < 3) { av_log(VAR_0, AV_LOG_ERROR, "PCM packet too small\n"); return AVERROR_INVALIDDATA; if ((VAR_6 = pcm_dvd_parse_header(VAR_0, VAR_4))) return VAR_6; VAR_4 += 3; VAR_5 -= 3; VAR_7 = (VAR_5 + s->extra_sample_count) / s->block_size; frame->nb_samples = VAR_7 * s->samples_per_block; if ((VAR_6 = ff_get_buffer(VAR_0, frame, 0)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\n"); return VAR_6; VAR_8 = frame->VAR_1[0]; if (s->extra_sample_count) { int VAR_9 = s->block_size - s->extra_sample_count; if (VAR_5 >= VAR_9) { memcpy(s->extra_samples + s->extra_sample_count, VAR_4, VAR_9); VAR_8 = pcm_dvd_decode_samples(VAR_0, s->extra_samples, VAR_8, 1); VAR_4 += VAR_9; VAR_5 -= VAR_9; VAR_7--; } else { memcpy(s->extra_samples + s->extra_sample_count, VAR_4, VAR_5); s->extra_sample_count += VAR_5; return VAR_3->size; if (VAR_7) { pcm_dvd_decode_samples(VAR_0, VAR_4, VAR_8, VAR_7); VAR_5 -= VAR_7 * s->block_size; if (VAR_5) { VAR_4 += VAR_7 * s->block_size; memcpy(s->extra_samples, VAR_4, VAR_5); s->extra_sample_count = VAR_5; *VAR_2 = 1; return VAR_3->size;
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{", "AVFrame *frame = VAR_1;", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "PCMDVDContext *s = VAR_0->priv_data;", "int VAR_6;", "int VAR_7;", "void *VAR_8;", "if (VAR_5 < 3) {", "av_log(VAR_0, AV_LOG_ERROR, \"PCM packet too small\\n\");", "return AVERROR_INVALIDDATA;", "if ((VAR_6 = pcm_dvd_parse_header(VAR_0, VAR_4)))\nreturn VAR_6;", "VAR_4 += 3;", "VAR_5 -= 3;", "VAR_7 = (VAR_5 + s->extra_sample_count) / s->block_size;", "frame->nb_samples = VAR_7 * s->samples_per_block;", "if ((VAR_6 = ff_get_buffer(VAR_0, frame, 0)) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"get_buffer() failed\\n\");", "return VAR_6;", "VAR_8 = frame->VAR_1[0];", "if (s->extra_sample_count) {", "int VAR_9 = s->block_size - s->extra_sample_count;", "if (VAR_5 >= VAR_9) {", "memcpy(s->extra_samples + s->extra_sample_count, VAR_4,\nVAR_9);", "VAR_8 = pcm_dvd_decode_samples(VAR_0, s->extra_samples, VAR_8, 1);", "VAR_4 += VAR_9;", "VAR_5 -= VAR_9;", "VAR_7--;", "} else {", "memcpy(s->extra_samples + s->extra_sample_count, VAR_4, VAR_5);", "s->extra_sample_count += VAR_5;", "return VAR_3->size;", "if (VAR_7) {", "pcm_dvd_decode_samples(VAR_0, VAR_4, VAR_8, VAR_7);", "VAR_5 -= VAR_7 * s->block_size;", "if (VAR_5) {", "VAR_4 += VAR_7 * s->block_size;", "memcpy(s->extra_samples, VAR_4, VAR_5);", "s->extra_sample_count = VAR_5;", "*VAR_2 = 1;", "return VAR_3->size;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 32, 34 ], [ 41 ], [ 43 ], [ 47 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 62 ], [ 68 ], [ 70 ], [ 72 ], [ 74, 76 ], [ 78 ], [ 80 ], [ 82 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 103 ], [ 105 ], [ 107 ], [ 114 ], [ 116 ], [ 118 ], [ 120 ], [ 125 ], [ 129 ] ]
25,456
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; }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
void qmp_migrate_set_cache_size(int64_t value, Error **errp) { MigrationState *s = migrate_get_current(); int64_t new_size; if (value != (size_t)value) { error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cache size", "exceeding address space"); return; } 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; }
{ "code": [], "line_no": [] }
void FUNC_0(int64_t VAR_0, Error **VAR_1) { MigrationState *s = migrate_get_current(); int64_t new_size; if (VAR_0 != (size_t)VAR_0) { error_set(VAR_1, QERR_INVALID_PARAMETER_VALUE, "cache size", "exceeding address space"); return; } if (VAR_0 > ram_bytes_total()) { error_set(VAR_1, QERR_INVALID_PARAMETER_VALUE, "cache size", "exceeds guest ram size "); return; } new_size = xbzrle_cache_resize(VAR_0); if (new_size < 0) { error_set(VAR_1, QERR_INVALID_PARAMETER_VALUE, "cache size", "is smaller than page size"); return; } s->xbzrle_cache_size = new_size; }
[ "void FUNC_0(int64_t VAR_0, Error **VAR_1)\n{", "MigrationState *s = migrate_get_current();", "int64_t new_size;", "if (VAR_0 != (size_t)VAR_0) {", "error_set(VAR_1, QERR_INVALID_PARAMETER_VALUE, \"cache size\",\n\"exceeding address space\");", "return;", "}", "if (VAR_0 > ram_bytes_total()) {", "error_set(VAR_1, QERR_INVALID_PARAMETER_VALUE, \"cache size\",\n\"exceeds guest ram size \");", "return;", "}", "new_size = xbzrle_cache_resize(VAR_0);", "if (new_size < 0) {", "error_set(VAR_1, QERR_INVALID_PARAMETER_VALUE, \"cache size\",\n\"is smaller than page size\");", "return;", "}", "s->xbzrle_cache_size = new_size;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ] ]
25,457
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; } }
true
FFmpeg
6d3f17838db93647f026338cb63103ce57f5d0e2
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; 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; if ((FFABS(D0) <= state->near) && (FFABS(D1) <= state->near) && (FFABS(D2) <= state->near)) { int r; int RItype; 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 (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; } 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; } 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 { 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); } 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; } }
{ "code": [], "line_no": [] }
static inline void FUNC_0(JLSState *VAR_0, MJpegDecodeContext *VAR_1, void *VAR_2, void *VAR_3, int VAR_4, int VAR_5, int VAR_6, int VAR_7, int VAR_8) { int VAR_9, VAR_10 = 0; int VAR_11, VAR_12, VAR_13, VAR_14; int VAR_15, VAR_16, VAR_17; while (VAR_10 < VAR_5) { int VAR_18, VAR_19; VAR_11 = VAR_10 ? R(VAR_3, VAR_10 - VAR_6) : R(VAR_2, VAR_10); VAR_12 = R(VAR_2, VAR_10); VAR_13 = VAR_10 ? R(VAR_2, VAR_10 - VAR_6) : VAR_4; VAR_14 = (VAR_10 >= VAR_5 - VAR_6) ? R(VAR_2, VAR_10) : R(VAR_2, VAR_10 + VAR_6); VAR_15 = VAR_14 - VAR_12; VAR_16 = VAR_12 - VAR_13; VAR_17 = VAR_13 - VAR_11; if ((FFABS(VAR_15) <= VAR_0->near) && (FFABS(VAR_16) <= VAR_0->near) && (FFABS(VAR_17) <= VAR_0->near)) { int VAR_22; int VAR_21; while (get_bits1(&VAR_1->gb)) { int VAR_22; VAR_22 = 1 << ff_log2_run[VAR_0->run_index[VAR_7]]; if (VAR_10 + VAR_22 * VAR_6 > VAR_5) VAR_22 = (VAR_5 - VAR_10) / VAR_6; for (VAR_9 = 0; VAR_9 < VAR_22; VAR_9++) { W(VAR_3, VAR_10, VAR_11); VAR_10 += VAR_6; } if (VAR_22 != 1 << ff_log2_run[VAR_0->run_index[VAR_7]]) return; if (VAR_0->run_index[VAR_7] < 31) VAR_0->run_index[VAR_7]++; if (VAR_10 + VAR_6 > VAR_5) return; } VAR_22 = ff_log2_run[VAR_0->run_index[VAR_7]]; if (VAR_22) VAR_22 = get_bits_long(&VAR_1->gb, VAR_22); if (VAR_10 + VAR_22 * VAR_6 > VAR_5) { VAR_22 = (VAR_5 - VAR_10) / VAR_6; } for (VAR_9 = 0; VAR_9 < VAR_22; VAR_9++) { W(VAR_3, VAR_10, VAR_11); VAR_10 += VAR_6; } if (VAR_10 >= VAR_5) { av_log(NULL, AV_LOG_ERROR, "run overflow\n"); return; } VAR_12 = R(VAR_2, VAR_10); VAR_21 = (FFABS(VAR_11 - VAR_12) <= VAR_0->near) ? 1 : 0; VAR_18 = ls_get_code_runterm(&VAR_1->gb, VAR_0, VAR_21, ff_log2_run[VAR_0->run_index[VAR_7]]); if (VAR_0->run_index[VAR_7]) VAR_0->run_index[VAR_7]--; if (VAR_0->near && VAR_21) { VAR_19 = VAR_11 + VAR_18; } else { if (VAR_12 < VAR_11) VAR_19 = VAR_12 - VAR_18; else VAR_19 = VAR_12 + VAR_18; } } else { int VAR_22, VAR_23; VAR_22 = ff_jpegls_quantize(VAR_0, VAR_15) * 81 + ff_jpegls_quantize(VAR_0, VAR_16) * 9 + ff_jpegls_quantize(VAR_0, VAR_17); VAR_19 = mid_pred(VAR_11, VAR_11 + VAR_12 - VAR_13, VAR_12); if (VAR_22 < 0) { VAR_22 = -VAR_22; VAR_23 = 1; } else { VAR_23 = 0; } if (VAR_23) { VAR_19 = av_clip(VAR_19 - VAR_0->C[VAR_22], 0, VAR_0->maxval); VAR_18 = -ls_get_code_regular(&VAR_1->gb, VAR_0, VAR_22); } else { VAR_19 = av_clip(VAR_19 + VAR_0->C[VAR_22], 0, VAR_0->maxval); VAR_18 = ls_get_code_regular(&VAR_1->gb, VAR_0, VAR_22); } VAR_19 += VAR_18; } if (VAR_0->near) { if (VAR_19 < -VAR_0->near) VAR_19 += VAR_0->range * VAR_0->twonear; else if (VAR_19 > VAR_0->maxval + VAR_0->near) VAR_19 -= VAR_0->range * VAR_0->twonear; VAR_19 = av_clip(VAR_19, 0, VAR_0->maxval); } VAR_19 &= VAR_0->maxval; W(VAR_3, VAR_10, VAR_19); VAR_10 += VAR_6; } }
[ "static inline void FUNC_0(JLSState *VAR_0, MJpegDecodeContext *VAR_1,\nvoid *VAR_2, void *VAR_3, int VAR_4, int VAR_5,\nint VAR_6, int VAR_7, int VAR_8)\n{", "int VAR_9, VAR_10 = 0;", "int VAR_11, VAR_12, VAR_13, VAR_14;", "int VAR_15, VAR_16, VAR_17;", "while (VAR_10 < VAR_5) {", "int VAR_18, VAR_19;", "VAR_11 = VAR_10 ? R(VAR_3, VAR_10 - VAR_6) : R(VAR_2, VAR_10);", "VAR_12 = R(VAR_2, VAR_10);", "VAR_13 = VAR_10 ? R(VAR_2, VAR_10 - VAR_6) : VAR_4;", "VAR_14 = (VAR_10 >= VAR_5 - VAR_6) ? R(VAR_2, VAR_10) : R(VAR_2, VAR_10 + VAR_6);", "VAR_15 = VAR_14 - VAR_12;", "VAR_16 = VAR_12 - VAR_13;", "VAR_17 = VAR_13 - VAR_11;", "if ((FFABS(VAR_15) <= VAR_0->near) &&\n(FFABS(VAR_16) <= VAR_0->near) &&\n(FFABS(VAR_17) <= VAR_0->near)) {", "int VAR_22;", "int VAR_21;", "while (get_bits1(&VAR_1->gb)) {", "int VAR_22;", "VAR_22 = 1 << ff_log2_run[VAR_0->run_index[VAR_7]];", "if (VAR_10 + VAR_22 * VAR_6 > VAR_5)\nVAR_22 = (VAR_5 - VAR_10) / VAR_6;", "for (VAR_9 = 0; VAR_9 < VAR_22; VAR_9++) {", "W(VAR_3, VAR_10, VAR_11);", "VAR_10 += VAR_6;", "}", "if (VAR_22 != 1 << ff_log2_run[VAR_0->run_index[VAR_7]])\nreturn;", "if (VAR_0->run_index[VAR_7] < 31)\nVAR_0->run_index[VAR_7]++;", "if (VAR_10 + VAR_6 > VAR_5)\nreturn;", "}", "VAR_22 = ff_log2_run[VAR_0->run_index[VAR_7]];", "if (VAR_22)\nVAR_22 = get_bits_long(&VAR_1->gb, VAR_22);", "if (VAR_10 + VAR_22 * VAR_6 > VAR_5) {", "VAR_22 = (VAR_5 - VAR_10) / VAR_6;", "}", "for (VAR_9 = 0; VAR_9 < VAR_22; VAR_9++) {", "W(VAR_3, VAR_10, VAR_11);", "VAR_10 += VAR_6;", "}", "if (VAR_10 >= VAR_5) {", "av_log(NULL, AV_LOG_ERROR, \"run overflow\\n\");", "return;", "}", "VAR_12 = R(VAR_2, VAR_10);", "VAR_21 = (FFABS(VAR_11 - VAR_12) <= VAR_0->near) ? 1 : 0;", "VAR_18 = ls_get_code_runterm(&VAR_1->gb, VAR_0, VAR_21,\nff_log2_run[VAR_0->run_index[VAR_7]]);", "if (VAR_0->run_index[VAR_7])\nVAR_0->run_index[VAR_7]--;", "if (VAR_0->near && VAR_21) {", "VAR_19 = VAR_11 + VAR_18;", "} else {", "if (VAR_12 < VAR_11)\nVAR_19 = VAR_12 - VAR_18;", "else\nVAR_19 = VAR_12 + VAR_18;", "}", "} else {", "int VAR_22, VAR_23;", "VAR_22 = ff_jpegls_quantize(VAR_0, VAR_15) * 81 +\nff_jpegls_quantize(VAR_0, VAR_16) * 9 +\nff_jpegls_quantize(VAR_0, VAR_17);", "VAR_19 = mid_pred(VAR_11, VAR_11 + VAR_12 - VAR_13, VAR_12);", "if (VAR_22 < 0) {", "VAR_22 = -VAR_22;", "VAR_23 = 1;", "} else {", "VAR_23 = 0;", "}", "if (VAR_23) {", "VAR_19 = av_clip(VAR_19 - VAR_0->C[VAR_22], 0, VAR_0->maxval);", "VAR_18 = -ls_get_code_regular(&VAR_1->gb, VAR_0, VAR_22);", "} else {", "VAR_19 = av_clip(VAR_19 + VAR_0->C[VAR_22], 0, VAR_0->maxval);", "VAR_18 = ls_get_code_regular(&VAR_1->gb, VAR_0, VAR_22);", "}", "VAR_19 += VAR_18;", "}", "if (VAR_0->near) {", "if (VAR_19 < -VAR_0->near)\nVAR_19 += VAR_0->range * VAR_0->twonear;", "else if (VAR_19 > VAR_0->maxval + VAR_0->near)\nVAR_19 -= VAR_0->range * VAR_0->twonear;", "VAR_19 = av_clip(VAR_19, 0, VAR_0->maxval);", "}", "VAR_19 &= VAR_0->maxval;", "W(VAR_3, VAR_10, VAR_19);", "VAR_10 += VAR_6;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41, 43, 45 ], [ 47 ], [ 49 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75, 77 ], [ 79, 81 ], [ 83, 85 ], [ 87 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 118 ], [ 120 ], [ 126 ], [ 128 ], [ 130, 132 ], [ 134, 136 ], [ 140 ], [ 142 ], [ 144 ], [ 146, 148 ], [ 150, 152 ], [ 154 ], [ 156 ], [ 158 ], [ 162, 164, 166 ], [ 168 ], [ 172 ], [ 174 ], [ 176 ], [ 178 ], [ 180 ], [ 182 ], [ 186 ], [ 188 ], [ 190 ], [ 192 ], [ 194 ], [ 196 ], [ 198 ], [ 204 ], [ 206 ], [ 208 ], [ 210, 212 ], [ 214, 216 ], [ 218 ], [ 220 ], [ 224 ], [ 226 ], [ 228 ], [ 230 ], [ 232 ] ]
25,458
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); }
false
FFmpeg
dece4f46931cc7870f7ee7022522225b5f49e709
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; 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: 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) { 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; 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; } 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 (ost->logfile && enc->stats_out) { fprintf(ost->logfile, "%s", enc->stats_out); } } } ost->sync_opts++; 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); }
{ "code": [], "line_no": [] }
static void FUNC_0(AVFormatContext *VAR_0, OutputStream *VAR_1, AVFrame *VAR_2, float VAR_3) { int VAR_4, VAR_5; AVPacket pkt; AVCodecContext *enc = VAR_1->st->codec; int VAR_6; double VAR_7, VAR_8; double VAR_9 = 0; int VAR_10 = 0; InputStream *ist = NULL; if (VAR_1->source_index >= 0) ist = input_streams[VAR_1->source_index]; if(ist && ist->st->start_time != AV_NOPTS_VALUE && ist->st->first_dts != AV_NOPTS_VALUE && VAR_1->frame_rate.num) VAR_9 = 1/(av_q2d(VAR_1->frame_rate) * av_q2d(enc->time_base)); VAR_7 = VAR_2->pts; VAR_8 = VAR_7 - VAR_1->sync_opts + VAR_9; VAR_6 = 1; VAR_5 = video_sync_method; if (VAR_5 == VSYNC_AUTO) VAR_5 = (VAR_0->oformat->flags & AVFMT_VARIABLE_FPS) ? ((VAR_0->oformat->flags & AVFMT_NOTIMESTAMPS) ? VSYNC_PASSTHROUGH : VSYNC_VFR) : 1; switch (VAR_5) { case VSYNC_CFR: if (VAR_8 < -1.1) VAR_6 = 0; else if (VAR_8 > 1.1) VAR_6 = lrintf(VAR_8); break; case VSYNC_VFR: if (VAR_8 <= -0.6) VAR_6 = 0; else if (VAR_8 > 0.6) VAR_1->sync_opts = lrint(VAR_7); break; case VSYNC_DROP: case VSYNC_PASSTHROUGH: VAR_1->sync_opts = lrint(VAR_7); break; default: av_assert0(0); } VAR_6 = FFMIN(VAR_6, VAR_1->max_frames - VAR_1->frame_number); if (VAR_6 == 0) { nb_frames_drop++; av_log(NULL, AV_LOG_VERBOSE, "*** drop!\n"); return; } else if (VAR_6 > 1) { if (VAR_6 > dts_error_threshold * 30) { av_log(NULL, AV_LOG_ERROR, "%d frame duplication too large, skiping\n", VAR_6 - 1); nb_frames_drop++; return; } nb_frames_dup += VAR_6 - 1; av_log(NULL, AV_LOG_VERBOSE, "*** %d dup!\n", VAR_6 - 1); } duplicate_frame: av_init_packet(&pkt); pkt.data = NULL; pkt.size = 0; VAR_2->pts = VAR_1->sync_opts; if (!check_recording_time(VAR_1)) return; if (VAR_0->oformat->flags & AVFMT_RAWPICTURE && enc->codec->id == CODEC_ID_RAWVIDEO) { enc->coded_frame->interlaced_frame = VAR_2->interlaced_frame; enc->coded_frame->top_field_first = VAR_2->top_field_first; pkt.data = (uint8_t *)VAR_2; pkt.size = sizeof(AVPicture); pkt.pts = av_rescale_q(VAR_2->pts, enc->time_base, VAR_1->st->time_base); pkt.flags |= AV_PKT_FLAG_KEY; write_frame(VAR_0, &pkt, VAR_1); video_size += pkt.size; } else { int VAR_11; AVFrame big_picture; big_picture = *VAR_2; big_picture.interlaced_frame = VAR_2->interlaced_frame; if (VAR_1->st->codec->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME)) { if (VAR_1->top_field_first == -1) big_picture.top_field_first = VAR_2->top_field_first; else big_picture.top_field_first = !!VAR_1->top_field_first; } big_picture.VAR_3 = VAR_3; if (!enc->me_threshold) big_picture.pict_type = 0; if (VAR_1->forced_kf_index < VAR_1->forced_kf_count && big_picture.pts >= VAR_1->forced_kf_pts[VAR_1->forced_kf_index]) { big_picture.pict_type = AV_PICTURE_TYPE_I; VAR_1->forced_kf_index++; } update_benchmark(NULL); VAR_4 = avcodec_encode_video2(enc, &pkt, &big_picture, &VAR_11); update_benchmark("encode_video %d.%d", VAR_1->file_index, VAR_1->index); if (VAR_4 < 0) { av_log(NULL, AV_LOG_FATAL, "Video encoding failed\n"); exit_program(1); } if (VAR_11) { if (pkt.pts == AV_NOPTS_VALUE && !(enc->codec->capabilities & CODEC_CAP_DELAY)) pkt.pts = VAR_1->sync_opts; if (pkt.pts != AV_NOPTS_VALUE) pkt.pts = av_rescale_q(pkt.pts, enc->time_base, VAR_1->st->time_base); if (pkt.dts != AV_NOPTS_VALUE) pkt.dts = av_rescale_q(pkt.dts, enc->time_base, VAR_1->st->time_base); if (debug_ts) { av_log(NULL, AV_LOG_INFO, "encoder -> type:video " "pkt_pts:%VAR_0 pkt_pts_time:%VAR_0 pkt_dts:%VAR_0 pkt_dts_time:%VAR_0\n", av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &VAR_1->st->time_base), av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &VAR_1->st->time_base)); } write_frame(VAR_0, &pkt, VAR_1); VAR_10 = pkt.size; video_size += pkt.size; av_free_packet(&pkt); if (VAR_1->logfile && enc->stats_out) { fprintf(VAR_1->logfile, "%VAR_0", enc->stats_out); } } } VAR_1->sync_opts++; VAR_1->frame_number++; if(--VAR_6) goto duplicate_frame; if (vstats_filename && VAR_10) do_video_stats(output_files[VAR_1->file_index]->ctx, VAR_1, VAR_10); }
[ "static void FUNC_0(AVFormatContext *VAR_0,\nOutputStream *VAR_1,\nAVFrame *VAR_2,\nfloat VAR_3)\n{", "int VAR_4, VAR_5;", "AVPacket pkt;", "AVCodecContext *enc = VAR_1->st->codec;", "int VAR_6;", "double VAR_7, VAR_8;", "double VAR_9 = 0;", "int VAR_10 = 0;", "InputStream *ist = NULL;", "if (VAR_1->source_index >= 0)\nist = input_streams[VAR_1->source_index];", "if(ist && ist->st->start_time != AV_NOPTS_VALUE && ist->st->first_dts != AV_NOPTS_VALUE && VAR_1->frame_rate.num)\nVAR_9 = 1/(av_q2d(VAR_1->frame_rate) * av_q2d(enc->time_base));", "VAR_7 = VAR_2->pts;", "VAR_8 = VAR_7 - VAR_1->sync_opts + VAR_9;", "VAR_6 = 1;", "VAR_5 = video_sync_method;", "if (VAR_5 == VSYNC_AUTO)\nVAR_5 = (VAR_0->oformat->flags & AVFMT_VARIABLE_FPS) ? ((VAR_0->oformat->flags & AVFMT_NOTIMESTAMPS) ? VSYNC_PASSTHROUGH : VSYNC_VFR) : 1;", "switch (VAR_5) {", "case VSYNC_CFR:\nif (VAR_8 < -1.1)\nVAR_6 = 0;", "else if (VAR_8 > 1.1)\nVAR_6 = lrintf(VAR_8);", "break;", "case VSYNC_VFR:\nif (VAR_8 <= -0.6)\nVAR_6 = 0;", "else if (VAR_8 > 0.6)\nVAR_1->sync_opts = lrint(VAR_7);", "break;", "case VSYNC_DROP:\ncase VSYNC_PASSTHROUGH:\nVAR_1->sync_opts = lrint(VAR_7);", "break;", "default:\nav_assert0(0);", "}", "VAR_6 = FFMIN(VAR_6, VAR_1->max_frames - VAR_1->frame_number);", "if (VAR_6 == 0) {", "nb_frames_drop++;", "av_log(NULL, AV_LOG_VERBOSE, \"*** drop!\\n\");", "return;", "} else if (VAR_6 > 1) {", "if (VAR_6 > dts_error_threshold * 30) {", "av_log(NULL, AV_LOG_ERROR, \"%d frame duplication too large, skiping\\n\", VAR_6 - 1);", "nb_frames_drop++;", "return;", "}", "nb_frames_dup += VAR_6 - 1;", "av_log(NULL, AV_LOG_VERBOSE, \"*** %d dup!\\n\", VAR_6 - 1);", "}", "duplicate_frame:\nav_init_packet(&pkt);", "pkt.data = NULL;", "pkt.size = 0;", "VAR_2->pts = VAR_1->sync_opts;", "if (!check_recording_time(VAR_1))\nreturn;", "if (VAR_0->oformat->flags & AVFMT_RAWPICTURE &&\nenc->codec->id == CODEC_ID_RAWVIDEO) {", "enc->coded_frame->interlaced_frame = VAR_2->interlaced_frame;", "enc->coded_frame->top_field_first = VAR_2->top_field_first;", "pkt.data = (uint8_t *)VAR_2;", "pkt.size = sizeof(AVPicture);", "pkt.pts = av_rescale_q(VAR_2->pts, enc->time_base, VAR_1->st->time_base);", "pkt.flags |= AV_PKT_FLAG_KEY;", "write_frame(VAR_0, &pkt, VAR_1);", "video_size += pkt.size;", "} else {", "int VAR_11;", "AVFrame big_picture;", "big_picture = *VAR_2;", "big_picture.interlaced_frame = VAR_2->interlaced_frame;", "if (VAR_1->st->codec->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME)) {", "if (VAR_1->top_field_first == -1)\nbig_picture.top_field_first = VAR_2->top_field_first;", "else\nbig_picture.top_field_first = !!VAR_1->top_field_first;", "}", "big_picture.VAR_3 = VAR_3;", "if (!enc->me_threshold)\nbig_picture.pict_type = 0;", "if (VAR_1->forced_kf_index < VAR_1->forced_kf_count &&\nbig_picture.pts >= VAR_1->forced_kf_pts[VAR_1->forced_kf_index]) {", "big_picture.pict_type = AV_PICTURE_TYPE_I;", "VAR_1->forced_kf_index++;", "}", "update_benchmark(NULL);", "VAR_4 = avcodec_encode_video2(enc, &pkt, &big_picture, &VAR_11);", "update_benchmark(\"encode_video %d.%d\", VAR_1->file_index, VAR_1->index);", "if (VAR_4 < 0) {", "av_log(NULL, AV_LOG_FATAL, \"Video encoding failed\\n\");", "exit_program(1);", "}", "if (VAR_11) {", "if (pkt.pts == AV_NOPTS_VALUE && !(enc->codec->capabilities & CODEC_CAP_DELAY))\npkt.pts = VAR_1->sync_opts;", "if (pkt.pts != AV_NOPTS_VALUE)\npkt.pts = av_rescale_q(pkt.pts, enc->time_base, VAR_1->st->time_base);", "if (pkt.dts != AV_NOPTS_VALUE)\npkt.dts = av_rescale_q(pkt.dts, enc->time_base, VAR_1->st->time_base);", "if (debug_ts) {", "av_log(NULL, AV_LOG_INFO, \"encoder -> type:video \"\n\"pkt_pts:%VAR_0 pkt_pts_time:%VAR_0 pkt_dts:%VAR_0 pkt_dts_time:%VAR_0\\n\",\nav_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &VAR_1->st->time_base),\nav_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &VAR_1->st->time_base));", "}", "write_frame(VAR_0, &pkt, VAR_1);", "VAR_10 = pkt.size;", "video_size += pkt.size;", "av_free_packet(&pkt);", "if (VAR_1->logfile && enc->stats_out) {", "fprintf(VAR_1->logfile, \"%VAR_0\", enc->stats_out);", "}", "}", "}", "VAR_1->sync_opts++;", "VAR_1->frame_number++;", "if(--VAR_6)\ngoto duplicate_frame;", "if (vstats_filename && VAR_10)\ndo_video_stats(output_files[VAR_1->file_index]->ctx, VAR_1, VAR_10);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29, 31 ], [ 35, 37 ], [ 41 ], [ 43 ], [ 49 ], [ 53 ], [ 55, 57 ], [ 61 ], [ 63, 67, 69 ], [ 71, 73 ], [ 75 ], [ 77, 79, 81 ], [ 83, 85 ], [ 87 ], [ 89, 91, 93 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 137, 139 ], [ 141 ], [ 143 ], [ 147 ], [ 151, 153 ], [ 157, 159 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 193 ], [ 199 ], [ 201 ], [ 203, 205 ], [ 207, 209 ], [ 211 ], [ 219 ], [ 221, 223 ], [ 225, 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 251 ], [ 253, 255 ], [ 259, 261 ], [ 263, 265 ], [ 269 ], [ 271, 273, 275, 277 ], [ 279 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 317 ], [ 321, 323 ], [ 327, 329 ], [ 331 ] ]
25,461
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; }
true
FFmpeg
636ced8e1dc8248a1353b416240b93d70ad03edb
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; }
{ "code": [ " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);" ], "line_no": [ 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59 ] }
int FUNC_0(void *VAR_0, const char *VAR_1, const char *VAR_2) { const struct { const char *name; int VAR_5; } VAR_3[] = { { "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 *VAR_4; int VAR_5; int VAR_6; for (VAR_6 = 0; VAR_6 < FF_ARRAY_ELEMS(VAR_3); VAR_6++) { if (!strcmp(VAR_3[VAR_6].name, VAR_2)) { av_log_set_level(VAR_3[VAR_6].VAR_5); return 0; } } VAR_5 = strtol(VAR_2, &VAR_4, 10); if (*VAR_4) { av_log(NULL, AV_LOG_FATAL, "Invalid loglevel \"%s\". " "Possible levels are numbers or:\n", VAR_2); for (VAR_6 = 0; VAR_6 < FF_ARRAY_ELEMS(VAR_3); VAR_6++) av_log(NULL, AV_LOG_FATAL, "\"%s\"\n", VAR_3[VAR_6].name); exit(1); } av_log_set_level(VAR_5); return 0; }
[ "int FUNC_0(void *VAR_0, const char *VAR_1, const char *VAR_2)\n{", "const struct { const char *name; int VAR_5; } VAR_3[] = {", "{ \"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 *VAR_4;", "int VAR_5;", "int VAR_6;", "for (VAR_6 = 0; VAR_6 < FF_ARRAY_ELEMS(VAR_3); VAR_6++) {", "if (!strcmp(VAR_3[VAR_6].name, VAR_2)) {", "av_log_set_level(VAR_3[VAR_6].VAR_5);", "return 0;", "}", "}", "VAR_5 = strtol(VAR_2, &VAR_4, 10);", "if (*VAR_4) {", "av_log(NULL, AV_LOG_FATAL, \"Invalid loglevel \\\"%s\\\". \"\n\"Possible levels are numbers or:\\n\", VAR_2);", "for (VAR_6 = 0; VAR_6 < FF_ARRAY_ELEMS(VAR_3); VAR_6++)", "av_log(NULL, AV_LOG_FATAL, \"\\\"%s\\\"\\n\", VAR_3[VAR_6].name);", "exit(1);", "}", "av_log_set_level(VAR_5);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ] ]
25,462
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); }
true
qemu
84593a0807004d852132eaa56edf24d55793d480
static void ram_save_cleanup(void *opaque) { RAMState **rsp = opaque; RAMBlock *block; 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); }
{ "code": [ " 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();" ], "line_no": [ 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 57 ] }
static void FUNC_0(void *VAR_0) { RAMState **rsp = VAR_0; RAMBlock *block; 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); }
[ "static void FUNC_0(void *VAR_0)\n{", "RAMState **rsp = VAR_0;", "RAMBlock *block;", "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);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ] ]
25,463
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; }
false
FFmpeg
f98dbc7311a30a30802c71571ff5e3d049ea7556
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; }
{ "code": [], "line_no": [] }
const AVOption *FUNC_0(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; }
[ "const AVOption *FUNC_0(void *obj, const AVOption *last)\n{", "AVClass *class = *(AVClass**)obj;", "if (!last && class->option && class->option[0].name)\nreturn class->option;", "if (last && last[1].name)\nreturn ++last;", "return NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11, 13 ], [ 15 ], [ 17 ] ]
25,464
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; }
false
FFmpeg
0acf7e268b2f873379cd854b4d5aaba6f9c1f0b5
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; }
{ "code": [], "line_no": [] }
int FUNC_0(AVFilterContext **VAR_0, AVFilter *VAR_1, const char *VAR_2, const char *VAR_3, void *VAR_4, AVFilterGraph *VAR_5) { int VAR_6; *VAR_0 = avfilter_graph_alloc_filter(VAR_5, VAR_1, VAR_2); if (!*VAR_0) return AVERROR(ENOMEM); VAR_6 = avfilter_init_filter(*VAR_0, VAR_3, VAR_4); if (VAR_6 < 0) goto fail; return 0; fail: if (*VAR_0) avfilter_free(*VAR_0); *VAR_0 = NULL; return VAR_6; }
[ "int FUNC_0(AVFilterContext **VAR_0, AVFilter *VAR_1,\nconst char *VAR_2, const char *VAR_3, void *VAR_4,\nAVFilterGraph *VAR_5)\n{", "int VAR_6;", "*VAR_0 = avfilter_graph_alloc_filter(VAR_5, VAR_1, VAR_2);", "if (!*VAR_0)\nreturn AVERROR(ENOMEM);", "VAR_6 = avfilter_init_filter(*VAR_0, VAR_3, VAR_4);", "if (VAR_6 < 0)\ngoto fail;", "return 0;", "fail:\nif (*VAR_0)\navfilter_free(*VAR_0);", "*VAR_0 = NULL;", "return VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 21 ], [ 23, 25 ], [ 29 ], [ 33, 35, 37 ], [ 39 ], [ 41 ], [ 43 ] ]
25,465
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; }
true
qemu
069eb7b2b8fc47c7cb52e5a4af23ea98d939e3da
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; }
{ "code": [], "line_no": [] }
static void FUNC_0 (ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS (VAR_0); PCIDeviceClass *k = PCI_DEVICE_CLASS (VAR_0); 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; }
[ "static void FUNC_0 (ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS (VAR_0);", "PCIDeviceClass *k = PCI_DEVICE_CLASS (VAR_0);", "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;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 14 ], [ 16 ], [ 18 ], [ 20 ], [ 22 ], [ 24 ], [ 26 ], [ 28 ], [ 30 ] ]
25,467
static inline int64_t add64(const int64_t a, const int64_t b) { return a + b; }
true
qemu
21ce148c7ec71ee32834061355a5ecfd1a11f90f
static inline int64_t add64(const int64_t a, const int64_t b) { return a + b; }
{ "code": [ "static inline int64_t add64(const int64_t a, const int64_t b)" ], "line_no": [ 1 ] }
static inline int64_t FUNC_0(const int64_t a, const int64_t b) { return a + b; }
[ "static inline int64_t FUNC_0(const int64_t a, const int64_t b)\n{", "return a + b;", "}" ]
[ 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
25,469
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]); } }
true
qemu
e23a1b33b53d25510320b26d9f154e19c6c99725
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]); } }
{ "code": [ " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);" ], "line_no": [ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19 ] }
static void FUNC_0(target_phys_addr_t VAR_0, qemu_irq VAR_1, qemu_irq *VAR_2, unsigned int VAR_3) { DeviceState *dev; SysBusDevice *s; unsigned int VAR_4; dev = qdev_create(NULL, "slavio_timer"); qdev_prop_set_uint32(dev, "VAR_3", VAR_3); qdev_init(dev); s = sysbus_from_qdev(dev); sysbus_connect_irq(s, 0, VAR_1); sysbus_mmio_map(s, 0, VAR_0 + SYS_TIMER_OFFSET); for (VAR_4 = 0; VAR_4 < MAX_CPUS; VAR_4++) { sysbus_mmio_map(s, VAR_4 + 1, VAR_0 + (target_phys_addr_t)CPU_TIMER_OFFSET(VAR_4)); sysbus_connect_irq(s, VAR_4 + 1, VAR_2[VAR_4]); } }
[ "static void FUNC_0(target_phys_addr_t VAR_0, qemu_irq VAR_1,\nqemu_irq *VAR_2, unsigned int VAR_3)\n{", "DeviceState *dev;", "SysBusDevice *s;", "unsigned int VAR_4;", "dev = qdev_create(NULL, \"slavio_timer\");", "qdev_prop_set_uint32(dev, \"VAR_3\", VAR_3);", "qdev_init(dev);", "s = sysbus_from_qdev(dev);", "sysbus_connect_irq(s, 0, VAR_1);", "sysbus_mmio_map(s, 0, VAR_0 + SYS_TIMER_OFFSET);", "for (VAR_4 = 0; VAR_4 < MAX_CPUS; VAR_4++) {", "sysbus_mmio_map(s, VAR_4 + 1, VAR_0 + (target_phys_addr_t)CPU_TIMER_OFFSET(VAR_4));", "sysbus_connect_irq(s, VAR_4 + 1, VAR_2[VAR_4]);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]
25,470
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;
true
FFmpeg
61296d41e2de3b41304339e4631dd44c2e15f805
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;
{ "code": [], "line_no": [] }
int FUNC_0(H264Context *VAR_0) { int VAR_1, VAR_2; int VAR_3, VAR_4; VAR_0->use_weight = 0; VAR_0->use_weight_chroma = 0; VAR_0->luma_log2_weight_denom = get_ue_golomb(&VAR_0->gb); if (VAR_0->sps.chroma_format_idc) VAR_0->chroma_log2_weight_denom = get_ue_golomb(&VAR_0->gb); VAR_3 = 1 << VAR_0->luma_log2_weight_denom; VAR_4 = 1 << VAR_0->chroma_log2_weight_denom; for (VAR_1 = 0; VAR_1 < 2; VAR_1++) { VAR_0->luma_weight_flag[VAR_1] = 0; VAR_0->chroma_weight_flag[VAR_1] = 0; for (VAR_2 = 0; VAR_2 < VAR_0->ref_count[VAR_1]; VAR_2++) { int luma_weight_flag, chroma_weight_flag; luma_weight_flag = get_bits1(&VAR_0->gb); if (luma_weight_flag) { VAR_0->luma_weight[VAR_2][VAR_1][0] = get_se_golomb(&VAR_0->gb); VAR_0->luma_weight[VAR_2][VAR_1][1] = get_se_golomb(&VAR_0->gb); if (VAR_0->luma_weight[VAR_2][VAR_1][0] != VAR_3 || VAR_0->luma_weight[VAR_2][VAR_1][1] != 0) { VAR_0->use_weight = 1; VAR_0->luma_weight_flag[VAR_1] = 1; } else { VAR_0->luma_weight[VAR_2][VAR_1][0] = VAR_3; VAR_0->luma_weight[VAR_2][VAR_1][1] = 0; if (VAR_0->sps.chroma_format_idc) { chroma_weight_flag = get_bits1(&VAR_0->gb); if (chroma_weight_flag) { int j; for (j = 0; j < 2; j++) { VAR_0->chroma_weight[VAR_2][VAR_1][j][0] = get_se_golomb(&VAR_0->gb); VAR_0->chroma_weight[VAR_2][VAR_1][j][1] = get_se_golomb(&VAR_0->gb); if (VAR_0->chroma_weight[VAR_2][VAR_1][j][0] != VAR_4 || VAR_0->chroma_weight[VAR_2][VAR_1][j][1] != 0) { VAR_0->use_weight_chroma = 1; VAR_0->chroma_weight_flag[VAR_1] = 1; } else { int j; for (j = 0; j < 2; j++) { VAR_0->chroma_weight[VAR_2][VAR_1][j][0] = VAR_4; VAR_0->chroma_weight[VAR_2][VAR_1][j][1] = 0; if (VAR_0->slice_type_nos != AV_PICTURE_TYPE_B) break; VAR_0->use_weight = VAR_0->use_weight || VAR_0->use_weight_chroma; return 0;
[ "int FUNC_0(H264Context *VAR_0)\n{", "int VAR_1, VAR_2;", "int VAR_3, VAR_4;", "VAR_0->use_weight = 0;", "VAR_0->use_weight_chroma = 0;", "VAR_0->luma_log2_weight_denom = get_ue_golomb(&VAR_0->gb);", "if (VAR_0->sps.chroma_format_idc)\nVAR_0->chroma_log2_weight_denom = get_ue_golomb(&VAR_0->gb);", "VAR_3 = 1 << VAR_0->luma_log2_weight_denom;", "VAR_4 = 1 << VAR_0->chroma_log2_weight_denom;", "for (VAR_1 = 0; VAR_1 < 2; VAR_1++) {", "VAR_0->luma_weight_flag[VAR_1] = 0;", "VAR_0->chroma_weight_flag[VAR_1] = 0;", "for (VAR_2 = 0; VAR_2 < VAR_0->ref_count[VAR_1]; VAR_2++) {", "int luma_weight_flag, chroma_weight_flag;", "luma_weight_flag = get_bits1(&VAR_0->gb);", "if (luma_weight_flag) {", "VAR_0->luma_weight[VAR_2][VAR_1][0] = get_se_golomb(&VAR_0->gb);", "VAR_0->luma_weight[VAR_2][VAR_1][1] = get_se_golomb(&VAR_0->gb);", "if (VAR_0->luma_weight[VAR_2][VAR_1][0] != VAR_3 ||\nVAR_0->luma_weight[VAR_2][VAR_1][1] != 0) {", "VAR_0->use_weight = 1;", "VAR_0->luma_weight_flag[VAR_1] = 1;", "} else {", "VAR_0->luma_weight[VAR_2][VAR_1][0] = VAR_3;", "VAR_0->luma_weight[VAR_2][VAR_1][1] = 0;", "if (VAR_0->sps.chroma_format_idc) {", "chroma_weight_flag = get_bits1(&VAR_0->gb);", "if (chroma_weight_flag) {", "int j;", "for (j = 0; j < 2; j++) {", "VAR_0->chroma_weight[VAR_2][VAR_1][j][0] = get_se_golomb(&VAR_0->gb);", "VAR_0->chroma_weight[VAR_2][VAR_1][j][1] = get_se_golomb(&VAR_0->gb);", "if (VAR_0->chroma_weight[VAR_2][VAR_1][j][0] != VAR_4 ||\nVAR_0->chroma_weight[VAR_2][VAR_1][j][1] != 0) {", "VAR_0->use_weight_chroma = 1;", "VAR_0->chroma_weight_flag[VAR_1] = 1;", "} else {", "int j;", "for (j = 0; j < 2; j++) {", "VAR_0->chroma_weight[VAR_2][VAR_1][j][0] = VAR_4;", "VAR_0->chroma_weight[VAR_2][VAR_1][j][1] = 0;", "if (VAR_0->slice_type_nos != AV_PICTURE_TYPE_B)\nbreak;", "VAR_0->use_weight = VAR_0->use_weight || VAR_0->use_weight_chroma;", "return 0;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8, 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19 ], [ 20 ], [ 21, 22 ], [ 23 ], [ 24 ], [ 25 ], [ 26 ], [ 27 ], [ 28 ], [ 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33 ], [ 34 ], [ 35, 36 ], [ 37 ], [ 38 ], [ 39 ], [ 40 ], [ 41 ], [ 42 ], [ 43 ], [ 44, 45 ], [ 46 ], [ 47 ] ]
25,471
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); }
true
FFmpeg
f6774f905fb3cfdc319523ac640be30b14c1bc55
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)) { 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); }
{ "code": [ " int ret = av_frame_ref(picture, &s2->next_picture_ptr->f);" ], "line_no": [ 27 ] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; Mpeg1Context *s = VAR_0->priv_data; AVFrame *picture = VAR_1; MpegEncContext *s2 = &s->mpeg_enc_ctx; av_dlog(VAR_0, "fill_buffer\n"); if (VAR_5 == 0 || (VAR_5 == 4 && AV_RB32(VAR_4) == SEQ_END_CODE)) { if (s2->low_delay == 0 && s2->next_picture_ptr) { int VAR_8 = av_frame_ref(picture, &s2->next_picture_ptr->f); if (VAR_8 < 0) return VAR_8; s2->next_picture_ptr = NULL; *VAR_2 = 1; } return VAR_5; } if (s2->flags & CODEC_FLAG_TRUNCATED) { int VAR_7 = ff_mpeg1_find_frame_end(&s2->parse_context, VAR_4, VAR_5, NULL); if (ff_combine_frame(&s2->parse_context, VAR_7, (const uint8_t **) &VAR_4, &VAR_5) < 0) return VAR_5; } if (s->mpeg_enc_ctx_allocated == 0 && VAR_0->codec_tag == AV_RL32("VCR2")) vcr2_init_sequence(VAR_0); s->slice_count = 0; if (VAR_0->extradata && !s->extradata_decoded) { int VAR_8 = decode_chunks(VAR_0, picture, VAR_2, VAR_0->extradata, VAR_0->extradata_size); s->extradata_decoded = 1; if (VAR_8 < 0 && (VAR_0->err_recognition & AV_EF_EXPLODE)) return VAR_8; } return decode_chunks(VAR_0, picture, VAR_2, VAR_4, VAR_5); }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "Mpeg1Context *s = VAR_0->priv_data;", "AVFrame *picture = VAR_1;", "MpegEncContext *s2 = &s->mpeg_enc_ctx;", "av_dlog(VAR_0, \"fill_buffer\\n\");", "if (VAR_5 == 0 || (VAR_5 == 4 && AV_RB32(VAR_4) == SEQ_END_CODE)) {", "if (s2->low_delay == 0 && s2->next_picture_ptr) {", "int VAR_8 = av_frame_ref(picture, &s2->next_picture_ptr->f);", "if (VAR_8 < 0)\nreturn VAR_8;", "s2->next_picture_ptr = NULL;", "*VAR_2 = 1;", "}", "return VAR_5;", "}", "if (s2->flags & CODEC_FLAG_TRUNCATED) {", "int VAR_7 = ff_mpeg1_find_frame_end(&s2->parse_context, VAR_4,\nVAR_5, NULL);", "if (ff_combine_frame(&s2->parse_context, VAR_7,\n(const uint8_t **) &VAR_4, &VAR_5) < 0)\nreturn VAR_5;", "}", "if (s->mpeg_enc_ctx_allocated == 0 && VAR_0->codec_tag == AV_RL32(\"VCR2\"))\nvcr2_init_sequence(VAR_0);", "s->slice_count = 0;", "if (VAR_0->extradata && !s->extradata_decoded) {", "int VAR_8 = decode_chunks(VAR_0, picture, VAR_2,\nVAR_0->extradata, VAR_0->extradata_size);", "s->extradata_decoded = 1;", "if (VAR_8 < 0 && (VAR_0->err_recognition & AV_EF_EXPLODE))\nreturn VAR_8;", "}", "return decode_chunks(VAR_0, picture, VAR_2, VAR_4, VAR_5);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51, 53 ], [ 57, 59, 61 ], [ 63 ], [ 67, 69 ], [ 73 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 93 ], [ 95 ] ]
25,473
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; } } } }
true
FFmpeg
0d05406482950b7c129eccfefe0daa3d6d47e292
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; } } } }
{ "code": [ " data[x + y*stride] = (s + (c>>1)) / c;" ], "line_no": [ 75 ] }
static void FUNC_0(CoverContext *VAR_0, AVFrame *VAR_1, int VAR_2, int VAR_3) { int VAR_4, VAR_5, VAR_6; for (VAR_6=0; VAR_6<3; VAR_6++) { int VAR_7 = VAR_2>>!!VAR_6; int VAR_8 = VAR_3>>!!VAR_6; int VAR_9 = VAR_1->linesize[VAR_6]; uint8_t *data = VAR_1->data[VAR_6] + VAR_7 + VAR_8 * VAR_9; int VAR_10 = FF_CEIL_RSHIFT(VAR_0->width , !!VAR_6); int VAR_11 = FF_CEIL_RSHIFT(VAR_0->height, !!VAR_6); int VAR_12 = FF_CEIL_RSHIFT(VAR_1->width , !!VAR_6); int VAR_13 = FF_CEIL_RSHIFT(VAR_1->height, !!VAR_6); for (VAR_5 = 0; VAR_5 < VAR_11; VAR_5++) { for (VAR_4 = 0; VAR_4 < VAR_10; VAR_4++) { int VAR_14 = 0; int VAR_15 = 0; if (VAR_7) { int VAR_17 = 65536 / (VAR_4 + 1); VAR_15 += data[-1 + VAR_5*VAR_9] * VAR_17; VAR_14 += VAR_17; } if (VAR_8) { int VAR_17 = 65536 / (VAR_5 + 1); VAR_15 += data[VAR_4 - VAR_9] * VAR_17; VAR_14 += VAR_17; } if (VAR_7 + VAR_10 < VAR_12) { int VAR_17 = 65536 / (VAR_10 - VAR_4); VAR_15 += data[VAR_10 + VAR_5*VAR_9] * VAR_17; VAR_14 += VAR_17; } if (VAR_8 + VAR_11 < VAR_13) { int VAR_17 = 65536 / (VAR_11 - VAR_5); VAR_15 += data[VAR_4 + VAR_11*VAR_9] * VAR_17; VAR_14 += VAR_17; } data[VAR_4 + VAR_5*VAR_9] = (VAR_15 + (VAR_14>>1)) / VAR_14; } } } }
[ "static void FUNC_0(CoverContext *VAR_0, AVFrame *VAR_1, int VAR_2, int VAR_3)\n{", "int VAR_4, VAR_5, VAR_6;", "for (VAR_6=0; VAR_6<3; VAR_6++) {", "int VAR_7 = VAR_2>>!!VAR_6;", "int VAR_8 = VAR_3>>!!VAR_6;", "int VAR_9 = VAR_1->linesize[VAR_6];", "uint8_t *data = VAR_1->data[VAR_6] + VAR_7 + VAR_8 * VAR_9;", "int VAR_10 = FF_CEIL_RSHIFT(VAR_0->width , !!VAR_6);", "int VAR_11 = FF_CEIL_RSHIFT(VAR_0->height, !!VAR_6);", "int VAR_12 = FF_CEIL_RSHIFT(VAR_1->width , !!VAR_6);", "int VAR_13 = FF_CEIL_RSHIFT(VAR_1->height, !!VAR_6);", "for (VAR_5 = 0; VAR_5 < VAR_11; VAR_5++) {", "for (VAR_4 = 0; VAR_4 < VAR_10; VAR_4++) {", "int VAR_14 = 0;", "int VAR_15 = 0;", "if (VAR_7) {", "int VAR_17 = 65536 / (VAR_4 + 1);", "VAR_15 += data[-1 + VAR_5*VAR_9] * VAR_17;", "VAR_14 += VAR_17;", "}", "if (VAR_8) {", "int VAR_17 = 65536 / (VAR_5 + 1);", "VAR_15 += data[VAR_4 - VAR_9] * VAR_17;", "VAR_14 += VAR_17;", "}", "if (VAR_7 + VAR_10 < VAR_12) {", "int VAR_17 = 65536 / (VAR_10 - VAR_4);", "VAR_15 += data[VAR_10 + VAR_5*VAR_9] * VAR_17;", "VAR_14 += VAR_17;", "}", "if (VAR_8 + VAR_11 < VAR_13) {", "int VAR_17 = 65536 / (VAR_11 - VAR_5);", "VAR_15 += data[VAR_4 + VAR_11*VAR_9] * VAR_17;", "VAR_14 += VAR_17;", "}", "data[VAR_4 + VAR_5*VAR_9] = (VAR_15 + (VAR_14>>1)) / VAR_14;", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ] ]
25,474
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;
true
FFmpeg
f40ec70478648c1e6cde43b8577c3c29380372ee
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; 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; avio_rl32(pb); 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); 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); 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', ' '): 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); 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; 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; 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;
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0) { int64_t size, av_uninit(data_size); int64_t sample_count = 0; int VAR_1 = 0; char VAR_2[32]; uint32_t tag; AVIOContext *pb = VAR_0->pb; AVStream *st = NULL; WAVDemuxContext *wav = VAR_0->priv_data; int VAR_3, VAR_4 = 0; int64_t next_tag_ofs, data_ofs = -1; wav->unaligned = avio_tell(VAR_0->pb) & 1; wav->smv_data_ofs = -1; 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'): VAR_1 = 1; break; default: av_get_codec_tag_string(VAR_2, sizeof(VAR_2), tag); av_log(VAR_0, AV_LOG_ERROR, "invalid start code %VAR_0 in RIFF header\n", VAR_2); return AVERROR_INVALIDDATA; avio_rl32(pb); if (avio_rl32(pb) != MKTAG('W', 'A', 'V', 'E')) { av_log(VAR_0, AV_LOG_ERROR, "invalid format in RIFF header\n"); return AVERROR_INVALIDDATA; if (VAR_1) { if (avio_rl32(pb) != MKTAG('d', 'VAR_0', '6', '4')) return AVERROR_INVALIDDATA; size = avio_rl32(pb); if (size < 24) return AVERROR_INVALIDDATA; avio_rl64(pb); data_size = avio_rl64(pb); sample_count = avio_rl64(pb); if (data_size < 0 || sample_count < 0) { av_log(VAR_0, 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); 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', ' '): if (!VAR_4 && (VAR_3 = wav_parse_fmt_tag(VAR_0, size, &st)) < 0) { return VAR_3; } else if (VAR_4) av_log(VAR_0, AV_LOG_WARNING, "found more than one 'fmt ' tag\n"); VAR_4 = 1; break; case MKTAG('d', 'a', 't', 'a'): if (!VAR_4) { av_log(VAR_0, AV_LOG_ERROR, "found no 'fmt ' tag before the 'data' tag\n"); return AVERROR_INVALIDDATA; if (VAR_1) { 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(VAR_0, 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); if (!pb->seekable || (!VAR_1 && !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 ((VAR_3 = wav_parse_bext_tag(VAR_0, size)) < 0) return VAR_3; break; case MKTAG('S','M','V','0'): if (!VAR_4) { av_log(VAR_0, AV_LOG_ERROR, "found no 'fmt ' tag before the 'SMV0' tag\n"); return AVERROR_INVALIDDATA; if (size != MKTAG('0','2','0','0')) { av_log(VAR_0, AV_LOG_ERROR, "Unknown SMV version found\n"); goto break_loop; av_log(VAR_0, AV_LOG_DEBUG, "Found SMV data\n"); wav->smv_given_first = 0; vst = avformat_new_stream(VAR_0, 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(VAR_0, 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(VAR_0, 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(VAR_0, 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(VAR_0, size - 4); break; 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(VAR_0, 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(VAR_0, 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(VAR_0, NULL, wav_metadata_conv); ff_metadata_conv_ctx(VAR_0, NULL, ff_riff_info_conv); return 0;
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "int64_t size, av_uninit(data_size);", "int64_t sample_count = 0;", "int VAR_1 = 0;", "char VAR_2[32];", "uint32_t tag;", "AVIOContext *pb = VAR_0->pb;", "AVStream *st = NULL;", "WAVDemuxContext *wav = VAR_0->priv_data;", "int VAR_3, VAR_4 = 0;", "int64_t next_tag_ofs, data_ofs = -1;", "wav->unaligned = avio_tell(VAR_0->pb) & 1;", "wav->smv_data_ofs = -1;", "tag = avio_rl32(pb);", "switch (tag) {", "case MKTAG('R', 'I', 'F', 'F'):\nbreak;", "case MKTAG('R', 'I', 'F', 'X'):\nwav->rifx = 1;", "break;", "case MKTAG('R', 'F', '6', '4'):\nVAR_1 = 1;", "break;", "default:\nav_get_codec_tag_string(VAR_2, sizeof(VAR_2), tag);", "av_log(VAR_0, AV_LOG_ERROR, \"invalid start code %VAR_0 in RIFF header\\n\", VAR_2);", "return AVERROR_INVALIDDATA;", "avio_rl32(pb);", "if (avio_rl32(pb) != MKTAG('W', 'A', 'V', 'E')) {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid format in RIFF header\\n\");", "return AVERROR_INVALIDDATA;", "if (VAR_1) {", "if (avio_rl32(pb) != MKTAG('d', 'VAR_0', '6', '4'))\nreturn AVERROR_INVALIDDATA;", "size = avio_rl32(pb);", "if (size < 24)\nreturn AVERROR_INVALIDDATA;", "avio_rl64(pb);", "data_size = avio_rl64(pb);", "sample_count = avio_rl64(pb);", "if (data_size < 0 || sample_count < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"negative data_size and/or sample_count in \"\n\"ds64: data_size = %\"PRId64\", sample_count = %\"PRId64\"\\n\",\ndata_size, sample_count);", "return AVERROR_INVALIDDATA;", "avio_skip(pb, size - 24);", "for (;;) {", "AVStream *vst;", "size = next_tag(pb, &tag, wav->rifx);", "next_tag_ofs = avio_tell(pb) + size;", "if (avio_feof(pb))\nbreak;", "switch (tag) {", "case MKTAG('f', 'm', 't', ' '):\nif (!VAR_4 && (VAR_3 = wav_parse_fmt_tag(VAR_0, size, &st)) < 0) {", "return VAR_3;", "} else if (VAR_4)", "av_log(VAR_0, AV_LOG_WARNING, \"found more than one 'fmt ' tag\\n\");", "VAR_4 = 1;", "break;", "case MKTAG('d', 'a', 't', 'a'):\nif (!VAR_4) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"found no 'fmt ' tag before the 'data' tag\\n\");", "return AVERROR_INVALIDDATA;", "if (VAR_1) {", "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(VAR_0, AV_LOG_WARNING, \"Ignoring maximum wav data size, \"\n\"file may be invalid\\n\");", "data_size = 0;", "next_tag_ofs = wav->data_end = INT64_MAX;", "data_ofs = avio_tell(pb);", "if (!pb->seekable || (!VAR_1 && !size))\ngoto break_loop;", "break;", "case MKTAG('f', 'a', 'c', 't'):\nif (!sample_count)\nsample_count = (!wav->rifx ? avio_rl32(pb) : avio_rb32(pb));", "break;", "case MKTAG('b', 'e', 'x', 't'):\nif ((VAR_3 = wav_parse_bext_tag(VAR_0, size)) < 0)\nreturn VAR_3;", "break;", "case MKTAG('S','M','V','0'):\nif (!VAR_4) {", "av_log(VAR_0, AV_LOG_ERROR, \"found no 'fmt ' tag before the 'SMV0' tag\\n\");", "return AVERROR_INVALIDDATA;", "if (size != MKTAG('0','2','0','0')) {", "av_log(VAR_0, AV_LOG_ERROR, \"Unknown SMV version found\\n\");", "goto break_loop;", "av_log(VAR_0, AV_LOG_DEBUG, \"Found SMV data\\n\");", "wav->smv_given_first = 0;", "vst = avformat_new_stream(VAR_0, NULL);", "if (!vst)\nreturn 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(VAR_0, 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(VAR_0, 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'):\nif (size < 4) {", "av_log(VAR_0, AV_LOG_ERROR, \"too short LIST tag\\n\");", "return AVERROR_INVALIDDATA;", "switch (avio_rl32(pb)) {", "case MKTAG('I', 'N', 'F', 'O'):\nff_read_riff_info(VAR_0, size - 4);", "break;", "if ((avio_size(pb) > 0 && next_tag_ofs >= avio_size(pb)) ||\nwav_seek_tag(wav, pb, next_tag_ofs, SEEK_SET) < 0) {", "break;", "break_loop:\nif (data_ofs < 0) {", "av_log(VAR_0, 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\n&& (data_size << 3) / sample_count / st->codec->channels > st->codec->bits_per_coded_sample) {", "av_log(VAR_0, 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)\nif ( st->codec->channels\n&& data_size\n&& av_get_bits_per_sample(st->codec->codec_id)\n&& wav->data_end <= avio_size(pb))\nsample_count = (data_size << 3)\n/\n(st->codec->channels * (uint64_t)av_get_bits_per_sample(st->codec->codec_id));", "if (sample_count)\nst->duration = sample_count;", "ff_metadata_conv_ctx(VAR_0, NULL, wav_metadata_conv);", "ff_metadata_conv_ctx(VAR_0, NULL, ff_riff_info_conv);", "return 0;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 16 ], [ 17 ], [ 18, 19 ], [ 20, 21 ], [ 22 ], [ 23, 24 ], [ 25 ], [ 26, 27 ], [ 28 ], [ 29 ], [ 31 ], [ 33 ], [ 34 ], [ 35 ], [ 36 ], [ 37, 38 ], [ 39 ], [ 40, 41 ], [ 42 ], [ 43 ], [ 44 ], [ 45 ], [ 46, 47, 48 ], [ 49 ], [ 50 ], [ 51 ], [ 52 ], [ 53 ], [ 54 ], [ 55, 56 ], [ 57 ], [ 58, 60 ], [ 61 ], [ 62 ], [ 63 ], [ 64 ], [ 65 ], [ 66, 67 ], [ 68, 69 ], [ 70 ], [ 71 ], [ 72 ], [ 73 ], [ 74 ], [ 75 ], [ 76 ], [ 77, 78 ], [ 79 ], [ 80 ], [ 81 ], [ 85, 86 ], [ 87 ], [ 88, 89, 90 ], [ 91 ], [ 92, 93, 94 ], [ 95 ], [ 96, 97 ], [ 98 ], [ 99 ], [ 101 ], [ 102 ], [ 103 ], [ 104 ], [ 105 ], [ 106 ], [ 107, 108 ], [ 109 ], [ 110 ], [ 111 ], [ 112 ], [ 113 ], [ 114 ], [ 115 ], [ 116 ], [ 117 ], [ 118 ], [ 119 ], [ 120 ], [ 121 ], [ 122 ], [ 123 ], [ 124 ], [ 125 ], [ 126 ], [ 127 ], [ 128 ], [ 129 ], [ 130 ], [ 131 ], [ 132 ], [ 133, 134 ], [ 135 ], [ 136 ], [ 137 ], [ 138, 139 ], [ 140 ], [ 142, 143 ], [ 144 ], [ 145, 146 ], [ 147 ], [ 148 ], [ 149 ], [ 150, 151 ], [ 152 ], [ 153 ], [ 154, 155, 156, 157, 158, 159, 160, 161 ], [ 162, 163 ], [ 164 ], [ 165 ], [ 166 ] ]
25,475
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; }
true
FFmpeg
59f809e9922ad2a8ed5373189e0e2aec0d4dffd7
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; } *bsfs = bsf; bsfs = &bsf->next; buf = NULL; } end: av_free(buf); return ret; }
{ "code": [ " char *bsf_name, *buf, *saveptr;", " if (!(buf = av_strdup(bsfs_spec)))", " av_free(buf);" ], "line_no": [ 7, 13, 59 ] }
static int FUNC_0(void *VAR_0, const char *VAR_1, AVBitStreamFilterContext **VAR_2) { char *VAR_3, *VAR_4, *VAR_5; int VAR_6 = 0; if (!(VAR_4 = av_strdup(VAR_1))) return AVERROR(ENOMEM); while (VAR_3 = av_strtok(VAR_4, ",", &VAR_5)) { AVBitStreamFilterContext *bsf = av_bitstream_filter_init(VAR_3); if (!bsf) { av_log(VAR_0, AV_LOG_ERROR, "Cannot initialize bitstream filter with name '%s', " "unknown filter or internal error happened\n", VAR_3); VAR_6 = AVERROR_UNKNOWN; goto end; } *VAR_2 = bsf; VAR_2 = &bsf->next; VAR_4 = NULL; } end: av_free(VAR_4); return VAR_6; }
[ "static int FUNC_0(void *VAR_0, const char *VAR_1,\nAVBitStreamFilterContext **VAR_2)\n{", "char *VAR_3, *VAR_4, *VAR_5;", "int VAR_6 = 0;", "if (!(VAR_4 = av_strdup(VAR_1)))\nreturn AVERROR(ENOMEM);", "while (VAR_3 = av_strtok(VAR_4, \",\", &VAR_5)) {", "AVBitStreamFilterContext *bsf = av_bitstream_filter_init(VAR_3);", "if (!bsf) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Cannot initialize bitstream filter with name '%s', \"\n\"unknown filter or internal error happened\\n\",\nVAR_3);", "VAR_6 = AVERROR_UNKNOWN;", "goto end;", "}", "*VAR_2 = bsf;", "VAR_2 = &bsf->next;", "VAR_4 = NULL;", "}", "end:\nav_free(VAR_4);", "return VAR_6;", "}" ]
[ 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 19 ], [ 21 ], [ 25 ], [ 27, 29, 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 57, 59 ], [ 61 ], [ 63 ] ]
25,476
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; } }
true
FFmpeg
b18a0cc781b791912549504ca8a257f35a151c5e
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; } }
{ "code": [], "line_no": [] }
void FUNC_0(IVIPlaneDesc *VAR_0, uint8_t *VAR_1, int VAR_2) { int VAR_3, VAR_4; const int16_t *VAR_5 = VAR_0->bands[0].buf; uint32_t pitch = VAR_0->bands[0].pitch; for (VAR_4 = 0; VAR_4 < VAR_0->height; VAR_4++) { for (VAR_3 = 0; VAR_3 < VAR_0->width; VAR_3++) VAR_1[VAR_3] = av_clip_uint8(VAR_5[VAR_3] + 128); VAR_5 += pitch; VAR_1 += VAR_2; } }
[ "void FUNC_0(IVIPlaneDesc *VAR_0, uint8_t *VAR_1, int VAR_2)\n{", "int VAR_3, VAR_4;", "const int16_t *VAR_5 = VAR_0->bands[0].buf;", "uint32_t pitch = VAR_0->bands[0].pitch;", "for (VAR_4 = 0; VAR_4 < VAR_0->height; VAR_4++) {", "for (VAR_3 = 0; VAR_3 < VAR_0->width; VAR_3++)", "VAR_1[VAR_3] = av_clip_uint8(VAR_5[VAR_3] + 128);", "VAR_5 += pitch;", "VAR_1 += VAR_2;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ] ]
25,478
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");
true
qemu
d470ad42acfc73c45d3e8ed5311a491160b4c100
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");
{ "code": [], "line_no": [] }
static void FUNC_0(BDRVReplicationState *VAR_0, Error **VAR_1) { Error *local_err = NULL; int VAR_2; if (!VAR_0->secondary_disk->bs->job) { error_setg(VAR_1, "Backup job was cancelled unexpectedly"); backup_do_checkpoint(VAR_0->secondary_disk->bs->job, &local_err); if (local_err) { error_propagate(VAR_1, local_err); VAR_2 = VAR_0->active_disk->bs->drv->bdrv_make_empty(VAR_0->active_disk->bs); if (VAR_2 < 0) { error_setg(VAR_1, "Cannot make active disk empty"); VAR_2 = VAR_0->hidden_disk->bs->drv->bdrv_make_empty(VAR_0->hidden_disk->bs); if (VAR_2 < 0) { error_setg(VAR_1, "Cannot make hidden disk empty");
[ "static void FUNC_0(BDRVReplicationState *VAR_0, Error **VAR_1)\n{", "Error *local_err = NULL;", "int VAR_2;", "if (!VAR_0->secondary_disk->bs->job) {", "error_setg(VAR_1, \"Backup job was cancelled unexpectedly\");", "backup_do_checkpoint(VAR_0->secondary_disk->bs->job, &local_err);", "if (local_err) {", "error_propagate(VAR_1, local_err);", "VAR_2 = VAR_0->active_disk->bs->drv->bdrv_make_empty(VAR_0->active_disk->bs);", "if (VAR_2 < 0) {", "error_setg(VAR_1, \"Cannot make active disk empty\");", "VAR_2 = VAR_0->hidden_disk->bs->drv->bdrv_make_empty(VAR_0->hidden_disk->bs);", "if (VAR_2 < 0) {", "error_setg(VAR_1, \"Cannot make hidden disk empty\");" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ] ]
25,479
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]); }
true
qemu
21ef45d71221b4577330fe3aacfb06afad91ad46
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; 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]); }
{ "code": [ " VncDisplay *vd = ds->opaque;", " VncDisplay *vd = ds->opaque;", " VncDisplay *vd = ds->opaque;", " VncDisplay *vd = ds->opaque;" ], "line_no": [ 11, 11, 11, 11 ] }
static void FUNC_0(DisplayChangeListener *VAR_0, DisplayState *VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5) { int VAR_6; VncDisplay *vd = VAR_1->opaque; struct VncSurface *VAR_7 = &vd->guest; int VAR_8 = ds_get_width(VAR_1); int VAR_9 = ds_get_height(VAR_1); VAR_5 += VAR_3; VAR_4 += (VAR_2 % 16); VAR_2 -= (VAR_2 % 16); VAR_2 = MIN(VAR_2, VAR_8); VAR_3 = MIN(VAR_3, VAR_9); VAR_4 = MIN(VAR_2 + VAR_4, VAR_8) - VAR_2; VAR_5 = MIN(VAR_5, VAR_9); for (; VAR_3 < VAR_5; VAR_3++) for (VAR_6 = 0; VAR_6 < VAR_4; VAR_6 += 16) set_bit((VAR_2 + VAR_6) / 16, VAR_7->dirty[VAR_3]); }
[ "static void FUNC_0(DisplayChangeListener *VAR_0,\nDisplayState *VAR_1,\nint VAR_2, int VAR_3, int VAR_4, int VAR_5)\n{", "int VAR_6;", "VncDisplay *vd = VAR_1->opaque;", "struct VncSurface *VAR_7 = &vd->guest;", "int VAR_8 = ds_get_width(VAR_1);", "int VAR_9 = ds_get_height(VAR_1);", "VAR_5 += VAR_3;", "VAR_4 += (VAR_2 % 16);", "VAR_2 -= (VAR_2 % 16);", "VAR_2 = MIN(VAR_2, VAR_8);", "VAR_3 = MIN(VAR_3, VAR_9);", "VAR_4 = MIN(VAR_2 + VAR_4, VAR_8) - VAR_2;", "VAR_5 = MIN(VAR_5, VAR_9);", "for (; VAR_3 < VAR_5; VAR_3++)", "for (VAR_6 = 0; VAR_6 < VAR_4; VAR_6 += 16)", "set_bit((VAR_2 + VAR_6) / 16, VAR_7->dirty[VAR_3]);", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ] ]
25,480
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; }
true
qemu
556c2b60714e7dae3ed0eb3488910435263dc09f
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; }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockBackend *VAR_0, int VAR_1, char **VAR_2) { int VAR_3, VAR_4; struct aio_ctx *VAR_5 = g_new0(struct aio_ctx, 1); VAR_5->VAR_0 = VAR_0; while ((VAR_4 = getopt(VAR_1, VAR_2, "CP:qv")) != -1) { switch (VAR_4) { case 'C': VAR_5->Cflag = 1; break; case 'P': VAR_5->Pflag = 1; VAR_5->pattern = parse_pattern(optarg); if (VAR_5->pattern < 0) { g_free(VAR_5); return 0; } break; case 'q': VAR_5->qflag = 1; break; case 'v': VAR_5->vflag = 1; break; default: g_free(VAR_5); return qemuio_command_usage(&aio_read_cmd); } } if (optind > VAR_1 - 2) { g_free(VAR_5); return qemuio_command_usage(&aio_read_cmd); } VAR_5->offset = cvtnum(VAR_2[optind]); if (VAR_5->offset < 0) { print_cvtnum_err(VAR_5->offset, VAR_2[optind]); g_free(VAR_5); return 0; } optind++; if (VAR_5->offset & 0x1ff) { printf("offset %" PRId64 " is not sector aligned\n", VAR_5->offset); g_free(VAR_5); return 0; } VAR_3 = VAR_1 - optind; VAR_5->buf = create_iovec(VAR_0, &VAR_5->qiov, &VAR_2[optind], VAR_3, 0xab); if (VAR_5->buf == NULL) { g_free(VAR_5); return 0; } gettimeofday(&VAR_5->t1, NULL); block_acct_start(blk_get_stats(VAR_0), &VAR_5->acct, VAR_5->qiov.size, BLOCK_ACCT_READ); blk_aio_readv(VAR_0, VAR_5->offset >> 9, &VAR_5->qiov, VAR_5->qiov.size >> 9, aio_read_done, VAR_5); return 0; }
[ "static int FUNC_0(BlockBackend *VAR_0, int VAR_1, char **VAR_2)\n{", "int VAR_3, VAR_4;", "struct aio_ctx *VAR_5 = g_new0(struct aio_ctx, 1);", "VAR_5->VAR_0 = VAR_0;", "while ((VAR_4 = getopt(VAR_1, VAR_2, \"CP:qv\")) != -1) {", "switch (VAR_4) {", "case 'C':\nVAR_5->Cflag = 1;", "break;", "case 'P':\nVAR_5->Pflag = 1;", "VAR_5->pattern = parse_pattern(optarg);", "if (VAR_5->pattern < 0) {", "g_free(VAR_5);", "return 0;", "}", "break;", "case 'q':\nVAR_5->qflag = 1;", "break;", "case 'v':\nVAR_5->vflag = 1;", "break;", "default:\ng_free(VAR_5);", "return qemuio_command_usage(&aio_read_cmd);", "}", "}", "if (optind > VAR_1 - 2) {", "g_free(VAR_5);", "return qemuio_command_usage(&aio_read_cmd);", "}", "VAR_5->offset = cvtnum(VAR_2[optind]);", "if (VAR_5->offset < 0) {", "print_cvtnum_err(VAR_5->offset, VAR_2[optind]);", "g_free(VAR_5);", "return 0;", "}", "optind++;", "if (VAR_5->offset & 0x1ff) {", "printf(\"offset %\" PRId64 \" is not sector aligned\\n\",\nVAR_5->offset);", "g_free(VAR_5);", "return 0;", "}", "VAR_3 = VAR_1 - optind;", "VAR_5->buf = create_iovec(VAR_0, &VAR_5->qiov, &VAR_2[optind], VAR_3, 0xab);", "if (VAR_5->buf == NULL) {", "g_free(VAR_5);", "return 0;", "}", "gettimeofday(&VAR_5->t1, NULL);", "block_acct_start(blk_get_stats(VAR_0), &VAR_5->acct, VAR_5->qiov.size,\nBLOCK_ACCT_READ);", "blk_aio_readv(VAR_0, VAR_5->offset >> 9, &VAR_5->qiov,\nVAR_5->qiov.size >> 9, aio_read_done, VAR_5);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91, 93 ], [ 96 ], [ 98 ], [ 100 ], [ 104 ], [ 106 ], [ 108 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121, 123 ], [ 125, 127 ], [ 129 ], [ 131 ] ]
25,482
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; }
false
FFmpeg
155ec6edf82692bcf3a5f87d2bc697404f4e5aaf
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); 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); mv_table[mot_xy][0]= mx; mv_table[mot_xy][1]= my; return dmin; }
{ "code": [], "line_no": [] }
static int FUNC_0(MpegEncContext * VAR_0, int VAR_1, int VAR_2, VAR_3 (*mv_table)[2], int VAR_4, int VAR_5) { MotionEstContext * const c= &VAR_0->me; int VAR_6, VAR_7, VAR_8; int VAR_9[10][2]; const int VAR_10= 1+VAR_0->quarter_sample; const int VAR_11 = VAR_0->mb_stride; const int VAR_12 = VAR_2*VAR_11 + VAR_1; uint8_t * const mv_penalty= c->mv_penalty[VAR_5] + MAX_MV; int VAR_13; c->penalty_factor = get_penalty_factor(VAR_0->lambda, VAR_0->lambda2, c->avctx->me_cmp); c->sub_penalty_factor= get_penalty_factor(VAR_0->lambda, VAR_0->lambda2, c->avctx->me_sub_cmp); c->mb_penalty_factor = get_penalty_factor(VAR_0->lambda, VAR_0->lambda2, c->avctx->mb_cmp); c->current_mv_penalty= mv_penalty; get_limits(VAR_0, 16*VAR_1, 16*VAR_2); switch(VAR_0->me_method) { case ME_ZERO: default: no_motion_search(VAR_0, &VAR_6, &VAR_7); VAR_8 = 0; VAR_6-= VAR_1*16; VAR_7-= VAR_2*16; break; #if 0 case ME_FULL: VAR_8 = full_motion_search(VAR_0, &VAR_6, &VAR_7, range, ref_picture); VAR_6-= VAR_1*16; VAR_7-= VAR_2*16; break; case ME_LOG: VAR_8 = log_motion_search(VAR_0, &VAR_6, &VAR_7, range / 2, ref_picture); VAR_6-= VAR_1*16; VAR_7-= VAR_2*16; break; case ME_PHODS: VAR_8 = phods_motion_search(VAR_0, &VAR_6, &VAR_7, range / 2, ref_picture); VAR_6-= VAR_1*16; VAR_7-= VAR_2*16; break; #endif case ME_X1: case ME_EPZS: { P_LEFT[0] = mv_table[VAR_12 - 1][0]; P_LEFT[1] = mv_table[VAR_12 - 1][1]; if(P_LEFT[0] > (c->xmax<<VAR_10)) P_LEFT[0] = (c->xmax<<VAR_10); if (!VAR_0->first_slice_line) { P_TOP[0] = mv_table[VAR_12 - VAR_11 ][0]; P_TOP[1] = mv_table[VAR_12 - VAR_11 ][1]; P_TOPRIGHT[0] = mv_table[VAR_12 - VAR_11 + 1 ][0]; P_TOPRIGHT[1] = mv_table[VAR_12 - VAR_11 + 1 ][1]; if(P_TOP[1] > (c->ymax<<VAR_10)) P_TOP[1]= (c->ymax<<VAR_10); if(P_TOPRIGHT[0] < (c->xmin<<VAR_10)) P_TOPRIGHT[0]= (c->xmin<<VAR_10); if(P_TOPRIGHT[1] > (c->ymax<<VAR_10)) P_TOPRIGHT[1]= (c->ymax<<VAR_10); 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 == VAR_0->b_forw_mv_table){ VAR_13= (VAR_0->pb_time<<16) / (VAR_0->pp_time<<VAR_10); }else{ VAR_13= ((VAR_0->pb_time - VAR_0->pp_time)<<16) / (VAR_0->pp_time<<VAR_10); } VAR_8 = ff_epzs_motion_search(VAR_0, &VAR_6, &VAR_7, VAR_9, 0, VAR_4, VAR_0->p_mv_table, VAR_13, 0, 16); break; } VAR_8= c->sub_motion_search(VAR_0, &VAR_6, &VAR_7, VAR_8, 0, VAR_4, 0, 16); if(c->avctx->me_sub_cmp != c->avctx->mb_cmp && !c->skip) VAR_8= get_mb_score(VAR_0, VAR_6, VAR_7, 0, VAR_4); mv_table[VAR_12][0]= VAR_6; mv_table[VAR_12][1]= VAR_7; return VAR_8; }
[ "static int FUNC_0(MpegEncContext * VAR_0,\nint VAR_1, int VAR_2, VAR_3 (*mv_table)[2], int VAR_4, int VAR_5)\n{", "MotionEstContext * const c= &VAR_0->me;", "int VAR_6, VAR_7, VAR_8;", "int VAR_9[10][2];", "const int VAR_10= 1+VAR_0->quarter_sample;", "const int VAR_11 = VAR_0->mb_stride;", "const int VAR_12 = VAR_2*VAR_11 + VAR_1;", "uint8_t * const mv_penalty= c->mv_penalty[VAR_5] + MAX_MV;", "int VAR_13;", "c->penalty_factor = get_penalty_factor(VAR_0->lambda, VAR_0->lambda2, c->avctx->me_cmp);", "c->sub_penalty_factor= get_penalty_factor(VAR_0->lambda, VAR_0->lambda2, c->avctx->me_sub_cmp);", "c->mb_penalty_factor = get_penalty_factor(VAR_0->lambda, VAR_0->lambda2, c->avctx->mb_cmp);", "c->current_mv_penalty= mv_penalty;", "get_limits(VAR_0, 16*VAR_1, 16*VAR_2);", "switch(VAR_0->me_method) {", "case ME_ZERO:\ndefault:\nno_motion_search(VAR_0, &VAR_6, &VAR_7);", "VAR_8 = 0;", "VAR_6-= VAR_1*16;", "VAR_7-= VAR_2*16;", "break;", "#if 0\ncase ME_FULL:\nVAR_8 = full_motion_search(VAR_0, &VAR_6, &VAR_7, range, ref_picture);", "VAR_6-= VAR_1*16;", "VAR_7-= VAR_2*16;", "break;", "case ME_LOG:\nVAR_8 = log_motion_search(VAR_0, &VAR_6, &VAR_7, range / 2, ref_picture);", "VAR_6-= VAR_1*16;", "VAR_7-= VAR_2*16;", "break;", "case ME_PHODS:\nVAR_8 = phods_motion_search(VAR_0, &VAR_6, &VAR_7, range / 2, ref_picture);", "VAR_6-= VAR_1*16;", "VAR_7-= VAR_2*16;", "break;", "#endif\ncase ME_X1:\ncase ME_EPZS:\n{", "P_LEFT[0] = mv_table[VAR_12 - 1][0];", "P_LEFT[1] = mv_table[VAR_12 - 1][1];", "if(P_LEFT[0] > (c->xmax<<VAR_10)) P_LEFT[0] = (c->xmax<<VAR_10);", "if (!VAR_0->first_slice_line) {", "P_TOP[0] = mv_table[VAR_12 - VAR_11 ][0];", "P_TOP[1] = mv_table[VAR_12 - VAR_11 ][1];", "P_TOPRIGHT[0] = mv_table[VAR_12 - VAR_11 + 1 ][0];", "P_TOPRIGHT[1] = mv_table[VAR_12 - VAR_11 + 1 ][1];", "if(P_TOP[1] > (c->ymax<<VAR_10)) P_TOP[1]= (c->ymax<<VAR_10);", "if(P_TOPRIGHT[0] < (c->xmin<<VAR_10)) P_TOPRIGHT[0]= (c->xmin<<VAR_10);", "if(P_TOPRIGHT[1] > (c->ymax<<VAR_10)) P_TOPRIGHT[1]= (c->ymax<<VAR_10);", "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 == VAR_0->b_forw_mv_table){", "VAR_13= (VAR_0->pb_time<<16) / (VAR_0->pp_time<<VAR_10);", "}else{", "VAR_13= ((VAR_0->pb_time - VAR_0->pp_time)<<16) / (VAR_0->pp_time<<VAR_10);", "}", "VAR_8 = ff_epzs_motion_search(VAR_0, &VAR_6, &VAR_7, VAR_9, 0, VAR_4, VAR_0->p_mv_table, VAR_13, 0, 16);", "break;", "}", "VAR_8= c->sub_motion_search(VAR_0, &VAR_6, &VAR_7, VAR_8, 0, VAR_4, 0, 16);", "if(c->avctx->me_sub_cmp != c->avctx->mb_cmp && !c->skip)\nVAR_8= get_mb_score(VAR_0, VAR_6, VAR_7, 0, VAR_4);", "mv_table[VAR_12][0]= VAR_6;", "mv_table[VAR_12][1]= VAR_7;", "return VAR_8;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 39 ], [ 41, 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87, 89, 91, 93 ], [ 95 ], [ 97 ], [ 101 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 155 ], [ 157 ], [ 161 ], [ 165, 167 ], [ 175 ], [ 177 ], [ 181 ], [ 183 ] ]
25,483
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; }
true
qemu
78a52ad5acca7053b774fcc80290e7b7e224c80a
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; }
{ "code": [ " uint64_t mask = stop_flags | L2E_OFFSET_MASK | QCOW2_CLUSTER_COMPRESSED;" ], "line_no": [ 9 ] }
static int FUNC_0(uint64_t VAR_0, int VAR_1, uint64_t *VAR_2, uint64_t VAR_3) { int VAR_4; uint64_t mask = VAR_3 | L2E_OFFSET_MASK | QCOW2_CLUSTER_COMPRESSED; uint64_t first_entry = be64_to_cpu(VAR_2[0]); uint64_t offset = first_entry & mask; if (!offset) return 0; assert(qcow2_get_cluster_type(first_entry) != QCOW2_CLUSTER_COMPRESSED); for (VAR_4 = 0; VAR_4 < VAR_0; VAR_4++) { uint64_t l2_entry = be64_to_cpu(VAR_2[VAR_4]) & mask; if (offset + (uint64_t) VAR_4 * VAR_1 != l2_entry) { break; } } return VAR_4; }
[ "static int FUNC_0(uint64_t VAR_0, int VAR_1,\nuint64_t *VAR_2, uint64_t VAR_3)\n{", "int VAR_4;", "uint64_t mask = VAR_3 | L2E_OFFSET_MASK | QCOW2_CLUSTER_COMPRESSED;", "uint64_t first_entry = be64_to_cpu(VAR_2[0]);", "uint64_t offset = first_entry & mask;", "if (!offset)\nreturn 0;", "assert(qcow2_get_cluster_type(first_entry) != QCOW2_CLUSTER_COMPRESSED);", "for (VAR_4 = 0; VAR_4 < VAR_0; VAR_4++) {", "uint64_t l2_entry = be64_to_cpu(VAR_2[VAR_4]) & mask;", "if (offset + (uint64_t) VAR_4 * VAR_1 != l2_entry) {", "break;", "}", "}", "return VAR_4;", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ] ]
25,484
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; }
true
qemu
5af2ae2305143f1805a696f9554231e1fc246edc
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) { return pci_device_iommu_address_space(bus->parent_dev); } return &address_space_memory; }
{ "code": [ " if (bus->iommu_fn) {", " return bus->iommu_fn(bus, bus->iommu_opaque, dev->devfn);", " if (bus->parent_dev) {", " return pci_device_iommu_address_space(bus->parent_dev);" ], "line_no": [ 9, 11, 17, 23 ] }
AddressSpace *FUNC_0(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) { return FUNC_0(bus->parent_dev); } return &address_space_memory; }
[ "AddressSpace *FUNC_0(PCIDevice *dev)\n{", "PCIBus *bus = PCI_BUS(dev->bus);", "if (bus->iommu_fn) {", "return bus->iommu_fn(bus, bus->iommu_opaque, dev->devfn);", "}", "if (bus->parent_dev) {", "return FUNC_0(bus->parent_dev);", "}", "return &address_space_memory;", "}" ]
[ 0, 0, 1, 1, 0, 1, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ] ]
25,485
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; }
true
FFmpeg
f4b288a639bbda3ca244072e67b689aa4f40f2c6
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; int mqdiff, mquant; int ttmb = v->ttfrm; int mvsw = 0; int mb_has_coeffs = 1; int dmv_x, dmv_y; int val; 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; 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) { 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; 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) { 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]; 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(); 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 { 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; }
{ "code": [], "line_no": [] }
static int FUNC_0(VC1Context *VAR_0) { MpegEncContext *s = &VAR_0->s; GetBitContext *gb = &s->gb; int VAR_1, VAR_2; int VAR_3 = s->mb_x + s->mb_y * s->mb_stride; int VAR_4 = 0; int VAR_5, VAR_6; int VAR_7 = VAR_0->ttfrm; int VAR_8 = 0; int VAR_9 = 1; int VAR_10, VAR_11; int VAR_12; int VAR_13 = 1; int VAR_14, VAR_15; int VAR_16, VAR_17, VAR_18 = 0; int VAR_19 = 0, VAR_20, VAR_21 = 0; int VAR_22 = 0, VAR_23; int VAR_24, VAR_25; int VAR_26 = BMV_TYPE_BACKWARD; int VAR_27, VAR_29; VAR_6 = VAR_0->pq; s->mb_intra = 0; if (VAR_0->skip_is_raw) VAR_16 = get_bits1(gb); else VAR_16 = VAR_0->s.mbskip_table[VAR_3]; if (!VAR_16) { VAR_22 = get_vlc2(gb, VAR_0->mbmode_vlc->table, VC1_INTFR_NON4MV_MBMODE_VLC_BITS, 2); if (ff_vc1_mbmode_intfrp[0][VAR_22][0] == MV_PMODE_INTFR_2MV_FIELD) { VAR_18 = 1; VAR_0->blk_mv_type[s->block_index[0]] = 1; VAR_0->blk_mv_type[s->block_index[1]] = 1; VAR_0->blk_mv_type[s->block_index[2]] = 1; VAR_0->blk_mv_type[s->block_index[3]] = 1; } else { VAR_0->blk_mv_type[s->block_index[0]] = 0; VAR_0->blk_mv_type[s->block_index[1]] = 0; VAR_0->blk_mv_type[s->block_index[2]] = 0; VAR_0->blk_mv_type[s->block_index[3]] = 0; } } if (VAR_0->dmb_is_raw) VAR_17 = get_bits1(gb); else VAR_17 = VAR_0->direct_mb_plane[VAR_3]; if (VAR_17) { 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], VAR_0->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], VAR_0->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], VAR_0->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], VAR_0->bfraction, 1, s->quarter_sample); if (VAR_18) { 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], VAR_0->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], VAR_0->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], VAR_0->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], VAR_0->bfraction, 1, s->quarter_sample); for (VAR_1 = 1; VAR_1 < 4; VAR_1 += 2) { s->mv[0][VAR_1][0] = s->current_picture.motion_val[0][s->block_index[VAR_1]][0] = s->mv[0][VAR_1-1][0]; s->mv[0][VAR_1][1] = s->current_picture.motion_val[0][s->block_index[VAR_1]][1] = s->mv[0][VAR_1-1][1]; s->mv[1][VAR_1][0] = s->current_picture.motion_val[1][s->block_index[VAR_1]][0] = s->mv[1][VAR_1-1][0]; s->mv[1][VAR_1][1] = s->current_picture.motion_val[1][s->block_index[VAR_1]][1] = s->mv[1][VAR_1-1][1]; } } else { for (VAR_1 = 1; VAR_1 < 4; VAR_1++) { s->mv[0][VAR_1][0] = s->current_picture.motion_val[0][s->block_index[VAR_1]][0] = s->mv[0][0][0]; s->mv[0][VAR_1][1] = s->current_picture.motion_val[0][s->block_index[VAR_1]][1] = s->mv[0][0][1]; s->mv[1][VAR_1][0] = s->current_picture.motion_val[1][s->block_index[VAR_1]][0] = s->mv[1][0][0]; s->mv[1][VAR_1][1] = s->current_picture.motion_val[1][s->block_index[VAR_1]][1] = s->mv[1][0][1]; } } } if (ff_vc1_mbmode_intfrp[0][VAR_22][0] == MV_PMODE_INTFR_INTRA) { for (VAR_1 = 0; VAR_1 < 4; VAR_1++) { s->mv[0][VAR_1][0] = s->current_picture.motion_val[0][s->block_index[VAR_1]][0] = 0; s->mv[0][VAR_1][1] = s->current_picture.motion_val[0][s->block_index[VAR_1]][1] = 0; s->mv[1][VAR_1][0] = s->current_picture.motion_val[1][s->block_index[VAR_1]][0] = 0; s->mv[1][VAR_1][1] = s->current_picture.motion_val[1][s->block_index[VAR_1]][1] = 0; } s->current_picture.mb_type[VAR_3] = MB_TYPE_INTRA; s->mb_intra = VAR_0->is_intra[s->mb_x] = 1; for (VAR_1 = 0; VAR_1 < 6; VAR_1++) VAR_0->mb_type[0][s->block_index[VAR_1]] = 1; VAR_25 = VAR_0->fieldtx_plane[VAR_3] = get_bits1(gb); VAR_9 = get_bits1(gb); if (VAR_9) VAR_4 = 1 + get_vlc2(&VAR_0->s.gb, VAR_0->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); VAR_0->s.ac_pred = VAR_0->acpred_plane[VAR_3] = get_bits1(gb); GET_MQUANT(); s->current_picture.qscale_table[VAR_3] = VAR_6; s->y_dc_scale = s->y_dc_scale_table[VAR_6]; s->c_dc_scale = s->c_dc_scale_table[VAR_6]; VAR_14 = 0; for (VAR_1 = 0; VAR_1 < 6; VAR_1++) { s->dc_val[0][s->block_index[VAR_1]] = 0; VAR_14 += VAR_1 >> 2; VAR_12 = ((VAR_4 >> (5 - VAR_1)) & 1); VAR_0->mb_type[0][s->block_index[VAR_1]] = s->mb_intra; VAR_0->a_avail = VAR_0->c_avail = 0; if (VAR_1 == 2 || VAR_1 == 3 || !s->first_slice_line) VAR_0->a_avail = VAR_0->mb_type[0][s->block_index[VAR_1] - s->block_wrap[VAR_1]]; if (VAR_1 == 1 || VAR_1 == 3 || s->mb_x) VAR_0->c_avail = VAR_0->mb_type[0][s->block_index[VAR_1] - 1]; vc1_decode_intra_block(VAR_0, s->block[VAR_1], VAR_1, VAR_12, VAR_6, (VAR_1 & 4) ? VAR_0->codingset2 : VAR_0->codingset); if (VAR_1 > 3 && (s->flags & CODEC_FLAG_GRAY)) continue; VAR_0->vc1dsp.vc1_inv_trans_8x8(s->block[VAR_1]); if (VAR_1 < 4) { VAR_24 = s->linesize << VAR_25; VAR_15 = (VAR_25) ? ((VAR_1 & 1) * 8) + ((VAR_1 & 2) >> 1) * s->linesize : (VAR_1 & 1) * 8 + 4 * (VAR_1 & 2) * s->linesize; } else { VAR_24 = s->uvlinesize; VAR_15 = 0; } s->dsp.put_signed_pixels_clamped(s->block[VAR_1], s->dest[VAR_14] + VAR_15, VAR_24); } } else { s->mb_intra = VAR_0->is_intra[s->mb_x] = 0; if (!VAR_17) { if (VAR_16 || !s->mb_intra) { VAR_26 = decode012(gb); switch (VAR_26) { case 0: VAR_26 = (VAR_0->bfraction >= (B_FRACTION_DEN/2)) ? BMV_TYPE_BACKWARD : BMV_TYPE_FORWARD; break; case 1: VAR_26 = (VAR_0->bfraction >= (B_FRACTION_DEN/2)) ? BMV_TYPE_FORWARD : BMV_TYPE_BACKWARD; break; case 2: VAR_26 = BMV_TYPE_INTERPOLATED; } } if (VAR_18 && VAR_26 != BMV_TYPE_INTERPOLATED) VAR_8 = get_bits1(gb); } if (!VAR_16) { VAR_9 = ff_vc1_mbmode_intfrp[0][VAR_22][3]; if (VAR_9) VAR_4 = 1 + get_vlc2(&VAR_0->s.gb, VAR_0->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); if (!VAR_17) { if (VAR_26 == BMV_TYPE_INTERPOLATED && VAR_18) { VAR_0->fourmvbp = get_vlc2(gb, VAR_0->fourmvbp_vlc->table, VC1_4MV_BLOCK_PATTERN_VLC_BITS, 1); } else if (VAR_26 == BMV_TYPE_INTERPOLATED || VAR_18) { VAR_0->twomvbp = get_vlc2(gb, VAR_0->twomvbp_vlc->table, VC1_2MV_BLOCK_PATTERN_VLC_BITS, 1); } } for (VAR_1 = 0; VAR_1 < 6; VAR_1++) VAR_0->mb_type[0][s->block_index[VAR_1]] = 0; VAR_25 = VAR_0->fieldtx_plane[VAR_3] = ff_vc1_mbmode_intfrp[0][VAR_22][1]; VAR_14 = 0; if (VAR_17) { if (VAR_18) { for (VAR_1 = 0; VAR_1 < 4; VAR_1++) { vc1_mc_4mv_luma(VAR_0, VAR_1, 0, 0); vc1_mc_4mv_luma(VAR_0, VAR_1, 1, 1); } vc1_mc_4mv_chroma4(VAR_0, 0, 0, 0); vc1_mc_4mv_chroma4(VAR_0, 1, 1, 1); } else { vc1_mc_1mv(VAR_0, 0); vc1_interp_mc(VAR_0); } } else if (VAR_18 && VAR_26 == BMV_TYPE_INTERPOLATED) { VAR_23 = VAR_0->fourmvbp; for (VAR_1 = 0; VAR_1 < 4; VAR_1++) { VAR_27 = VAR_1==1 || VAR_1==3; VAR_10 = VAR_11 = 0; VAR_12 = ((VAR_23 >> (3 - VAR_1)) & 1); if (VAR_12) get_mvdata_interlaced(VAR_0, &VAR_10, &VAR_11, 0); VAR_2 = VAR_1 > 1 ? 2 : 0; vc1_pred_mv_intfr(VAR_0, VAR_2, VAR_10, VAR_11, 2, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], VAR_27); vc1_mc_4mv_luma(VAR_0, VAR_2, VAR_27, VAR_27); vc1_mc_4mv_luma(VAR_0, VAR_2+1, VAR_27, VAR_27); } vc1_mc_4mv_chroma4(VAR_0, 0, 0, 0); vc1_mc_4mv_chroma4(VAR_0, 1, 1, 1); } else if (VAR_26 == BMV_TYPE_INTERPOLATED) { VAR_23 = VAR_0->twomvbp; VAR_10 = VAR_11 = 0; if (VAR_23 & 2) get_mvdata_interlaced(VAR_0, &VAR_10, &VAR_11, 0); vc1_pred_mv_intfr(VAR_0, 0, VAR_10, VAR_11, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], 0); vc1_mc_1mv(VAR_0, 0); VAR_10 = VAR_11 = 0; if (VAR_23 & 1) get_mvdata_interlaced(VAR_0, &VAR_10, &VAR_11, 0); vc1_pred_mv_intfr(VAR_0, 0, VAR_10, VAR_11, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], 1); vc1_interp_mc(VAR_0); } else if (VAR_18) { VAR_27 = VAR_26 == BMV_TYPE_BACKWARD; VAR_29 = VAR_27; if (VAR_8) VAR_29 = !VAR_27; VAR_23 = VAR_0->twomvbp; VAR_10 = VAR_11 = 0; if (VAR_23 & 2) get_mvdata_interlaced(VAR_0, &VAR_10, &VAR_11, 0); vc1_pred_mv_intfr(VAR_0, 0, VAR_10, VAR_11, 2, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], VAR_27); VAR_10 = VAR_11 = 0; if (VAR_23 & 1) get_mvdata_interlaced(VAR_0, &VAR_10, &VAR_11, 0); vc1_pred_mv_intfr(VAR_0, 2, VAR_10, VAR_11, 2, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], VAR_29); if (VAR_8) { for (VAR_1 = 0; VAR_1 < 2; VAR_1++) { s->mv[VAR_27][VAR_1+2][0] = s->mv[VAR_27][VAR_1][0] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1+2]][0] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1]][0]; s->mv[VAR_27][VAR_1+2][1] = s->mv[VAR_27][VAR_1][1] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1+2]][1] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1]][1]; s->mv[VAR_29][VAR_1+2][0] = s->mv[VAR_29][VAR_1][0] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1]][0] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1+2]][0]; s->mv[VAR_29][VAR_1+2][1] = s->mv[VAR_29][VAR_1][1] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1]][1] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1+2]][1]; } } else { vc1_pred_mv_intfr(VAR_0, 0, 0, 0, 2, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], !VAR_27); vc1_pred_mv_intfr(VAR_0, 2, 0, 0, 2, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], !VAR_27); } vc1_mc_4mv_luma(VAR_0, 0, VAR_27, 0); vc1_mc_4mv_luma(VAR_0, 1, VAR_27, 0); vc1_mc_4mv_luma(VAR_0, 2, VAR_29, 0); vc1_mc_4mv_luma(VAR_0, 3, VAR_29, 0); vc1_mc_4mv_chroma4(VAR_0, VAR_27, VAR_29, 0); } else { VAR_27 = VAR_26 == BMV_TYPE_BACKWARD; VAR_23 = ff_vc1_mbmode_intfrp[0][VAR_22][2]; VAR_10 = VAR_11 = 0; if (VAR_23) get_mvdata_interlaced(VAR_0, &VAR_10, &VAR_11, 0); vc1_pred_mv_intfr(VAR_0, 0, VAR_10, VAR_11, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], VAR_27); VAR_0->blk_mv_type[s->block_index[0]] = 1; VAR_0->blk_mv_type[s->block_index[1]] = 1; VAR_0->blk_mv_type[s->block_index[2]] = 1; VAR_0->blk_mv_type[s->block_index[3]] = 1; vc1_pred_mv_intfr(VAR_0, 0, 0, 0, 2, VAR_0->range_x, VAR_0->range_y, 0, !VAR_27); for (VAR_1 = 0; VAR_1 < 2; VAR_1++) { s->mv[!VAR_27][VAR_1+2][0] = s->mv[!VAR_27][VAR_1][0] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1+2]][0] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1]][0]; s->mv[!VAR_27][VAR_1+2][1] = s->mv[!VAR_27][VAR_1][1] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1+2]][1] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1]][1]; } vc1_mc_1mv(VAR_0, VAR_27); } if (VAR_4) GET_MQUANT(); s->current_picture.qscale_table[VAR_3] = VAR_6; if (!VAR_0->ttmbf && VAR_4) VAR_7 = get_vlc2(gb, ff_vc1_ttmb_vlc[VAR_0->tt_index].table, VC1_TTMB_VLC_BITS, 2); for (VAR_1 = 0; VAR_1 < 6; VAR_1++) { s->dc_val[0][s->block_index[VAR_1]] = 0; VAR_14 += VAR_1 >> 2; VAR_12 = ((VAR_4 >> (5 - VAR_1)) & 1); if (!VAR_25) VAR_15 = (VAR_1 & 4) ? 0 : ((VAR_1 & 1) * 8 + (VAR_1 & 2) * 4 * s->linesize); else VAR_15 = (VAR_1 & 4) ? 0 : ((VAR_1 & 1) * 8 + ((VAR_1 > 1) * s->linesize)); if (VAR_12) { VAR_20 = vc1_decode_p_block(VAR_0, s->block[VAR_1], VAR_1, VAR_6, VAR_7, VAR_13, s->dest[VAR_14] + VAR_15, (VAR_1 & 4) ? s->uvlinesize : (s->linesize << VAR_25), (VAR_1 & 4) && (s->flags & CODEC_FLAG_GRAY), &VAR_21); VAR_19 |= VAR_20 << (VAR_1 << 2); if (!VAR_0->ttmbf && VAR_7 < 8) VAR_7 = -1; VAR_13 = 0; } } } else { VAR_27 = 0; for (VAR_1 = 0; VAR_1 < 6; VAR_1++) { VAR_0->mb_type[0][s->block_index[VAR_1]] = 0; s->dc_val[0][s->block_index[VAR_1]] = 0; } s->current_picture.mb_type[VAR_3] = MB_TYPE_SKIP; s->current_picture.qscale_table[VAR_3] = 0; VAR_0->blk_mv_type[s->block_index[0]] = 0; VAR_0->blk_mv_type[s->block_index[1]] = 0; VAR_0->blk_mv_type[s->block_index[2]] = 0; VAR_0->blk_mv_type[s->block_index[3]] = 0; if (!VAR_17) { if (VAR_26 == BMV_TYPE_INTERPOLATED) { vc1_pred_mv_intfr(VAR_0, 0, 0, 0, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], 0); vc1_pred_mv_intfr(VAR_0, 0, 0, 0, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], 1); } else { VAR_27 = VAR_26 == BMV_TYPE_BACKWARD; vc1_pred_mv_intfr(VAR_0, 0, 0, 0, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], VAR_27); if (VAR_8) { int VAR_29 = VAR_27; if (VAR_8) VAR_29 = !VAR_27; for (VAR_1 = 0; VAR_1 < 2; VAR_1++) { s->mv[VAR_27][VAR_1+2][0] = s->mv[VAR_27][VAR_1][0] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1+2]][0] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1]][0]; s->mv[VAR_27][VAR_1+2][1] = s->mv[VAR_27][VAR_1][1] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1+2]][1] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1]][1]; s->mv[VAR_29][VAR_1+2][0] = s->mv[VAR_29][VAR_1][0] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1]][0] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1+2]][0]; s->mv[VAR_29][VAR_1+2][1] = s->mv[VAR_29][VAR_1][1] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1]][1] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1+2]][1]; } } else { VAR_0->blk_mv_type[s->block_index[0]] = 1; VAR_0->blk_mv_type[s->block_index[1]] = 1; VAR_0->blk_mv_type[s->block_index[2]] = 1; VAR_0->blk_mv_type[s->block_index[3]] = 1; vc1_pred_mv_intfr(VAR_0, 0, 0, 0, 2, VAR_0->range_x, VAR_0->range_y, 0, !VAR_27); for (VAR_1 = 0; VAR_1 < 2; VAR_1++) { s->mv[!VAR_27][VAR_1+2][0] = s->mv[!VAR_27][VAR_1][0] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1+2]][0] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1]][0]; s->mv[!VAR_27][VAR_1+2][1] = s->mv[!VAR_27][VAR_1][1] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1+2]][1] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1]][1]; } } } } vc1_mc_1mv(VAR_0, VAR_27); if (VAR_17 || VAR_26 == BMV_TYPE_INTERPOLATED) { vc1_interp_mc(VAR_0); } } } if (s->mb_x == s->mb_width - 1) memmove(VAR_0->is_intra_base, VAR_0->is_intra, sizeof(VAR_0->is_intra_base[0]) * s->mb_stride); VAR_0->VAR_4[s->mb_x] = VAR_19; VAR_0->ttblk[s->mb_x] = VAR_21; return 0; }
[ "static int FUNC_0(VC1Context *VAR_0)\n{", "MpegEncContext *s = &VAR_0->s;", "GetBitContext *gb = &s->gb;", "int VAR_1, VAR_2;", "int VAR_3 = s->mb_x + s->mb_y * s->mb_stride;", "int VAR_4 = 0;", "int VAR_5, VAR_6;", "int VAR_7 = VAR_0->ttfrm;", "int VAR_8 = 0;", "int VAR_9 = 1;", "int VAR_10, VAR_11;", "int VAR_12;", "int VAR_13 = 1;", "int VAR_14, VAR_15;", "int VAR_16, VAR_17, VAR_18 = 0;", "int VAR_19 = 0, VAR_20, VAR_21 = 0;", "int VAR_22 = 0, VAR_23;", "int VAR_24, VAR_25;", "int VAR_26 = BMV_TYPE_BACKWARD;", "int VAR_27, VAR_29;", "VAR_6 = VAR_0->pq;", "s->mb_intra = 0;", "if (VAR_0->skip_is_raw)\nVAR_16 = get_bits1(gb);", "else\nVAR_16 = VAR_0->s.mbskip_table[VAR_3];", "if (!VAR_16) {", "VAR_22 = get_vlc2(gb, VAR_0->mbmode_vlc->table, VC1_INTFR_NON4MV_MBMODE_VLC_BITS, 2);", "if (ff_vc1_mbmode_intfrp[0][VAR_22][0] == MV_PMODE_INTFR_2MV_FIELD) {", "VAR_18 = 1;", "VAR_0->blk_mv_type[s->block_index[0]] = 1;", "VAR_0->blk_mv_type[s->block_index[1]] = 1;", "VAR_0->blk_mv_type[s->block_index[2]] = 1;", "VAR_0->blk_mv_type[s->block_index[3]] = 1;", "} else {", "VAR_0->blk_mv_type[s->block_index[0]] = 0;", "VAR_0->blk_mv_type[s->block_index[1]] = 0;", "VAR_0->blk_mv_type[s->block_index[2]] = 0;", "VAR_0->blk_mv_type[s->block_index[3]] = 0;", "}", "}", "if (VAR_0->dmb_is_raw)\nVAR_17 = get_bits1(gb);", "else\nVAR_17 = VAR_0->direct_mb_plane[VAR_3];", "if (VAR_17) {", "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], VAR_0->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], VAR_0->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], VAR_0->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], VAR_0->bfraction, 1, s->quarter_sample);", "if (VAR_18) {", "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], VAR_0->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], VAR_0->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], VAR_0->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], VAR_0->bfraction, 1, s->quarter_sample);", "for (VAR_1 = 1; VAR_1 < 4; VAR_1 += 2) {", "s->mv[0][VAR_1][0] = s->current_picture.motion_val[0][s->block_index[VAR_1]][0] = s->mv[0][VAR_1-1][0];", "s->mv[0][VAR_1][1] = s->current_picture.motion_val[0][s->block_index[VAR_1]][1] = s->mv[0][VAR_1-1][1];", "s->mv[1][VAR_1][0] = s->current_picture.motion_val[1][s->block_index[VAR_1]][0] = s->mv[1][VAR_1-1][0];", "s->mv[1][VAR_1][1] = s->current_picture.motion_val[1][s->block_index[VAR_1]][1] = s->mv[1][VAR_1-1][1];", "}", "} else {", "for (VAR_1 = 1; VAR_1 < 4; VAR_1++) {", "s->mv[0][VAR_1][0] = s->current_picture.motion_val[0][s->block_index[VAR_1]][0] = s->mv[0][0][0];", "s->mv[0][VAR_1][1] = s->current_picture.motion_val[0][s->block_index[VAR_1]][1] = s->mv[0][0][1];", "s->mv[1][VAR_1][0] = s->current_picture.motion_val[1][s->block_index[VAR_1]][0] = s->mv[1][0][0];", "s->mv[1][VAR_1][1] = s->current_picture.motion_val[1][s->block_index[VAR_1]][1] = s->mv[1][0][1];", "}", "}", "}", "if (ff_vc1_mbmode_intfrp[0][VAR_22][0] == MV_PMODE_INTFR_INTRA) {", "for (VAR_1 = 0; VAR_1 < 4; VAR_1++) {", "s->mv[0][VAR_1][0] = s->current_picture.motion_val[0][s->block_index[VAR_1]][0] = 0;", "s->mv[0][VAR_1][1] = s->current_picture.motion_val[0][s->block_index[VAR_1]][1] = 0;", "s->mv[1][VAR_1][0] = s->current_picture.motion_val[1][s->block_index[VAR_1]][0] = 0;", "s->mv[1][VAR_1][1] = s->current_picture.motion_val[1][s->block_index[VAR_1]][1] = 0;", "}", "s->current_picture.mb_type[VAR_3] = MB_TYPE_INTRA;", "s->mb_intra = VAR_0->is_intra[s->mb_x] = 1;", "for (VAR_1 = 0; VAR_1 < 6; VAR_1++)", "VAR_0->mb_type[0][s->block_index[VAR_1]] = 1;", "VAR_25 = VAR_0->fieldtx_plane[VAR_3] = get_bits1(gb);", "VAR_9 = get_bits1(gb);", "if (VAR_9)\nVAR_4 = 1 + get_vlc2(&VAR_0->s.gb, VAR_0->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);", "VAR_0->s.ac_pred = VAR_0->acpred_plane[VAR_3] = get_bits1(gb);", "GET_MQUANT();", "s->current_picture.qscale_table[VAR_3] = VAR_6;", "s->y_dc_scale = s->y_dc_scale_table[VAR_6];", "s->c_dc_scale = s->c_dc_scale_table[VAR_6];", "VAR_14 = 0;", "for (VAR_1 = 0; VAR_1 < 6; VAR_1++) {", "s->dc_val[0][s->block_index[VAR_1]] = 0;", "VAR_14 += VAR_1 >> 2;", "VAR_12 = ((VAR_4 >> (5 - VAR_1)) & 1);", "VAR_0->mb_type[0][s->block_index[VAR_1]] = s->mb_intra;", "VAR_0->a_avail = VAR_0->c_avail = 0;", "if (VAR_1 == 2 || VAR_1 == 3 || !s->first_slice_line)\nVAR_0->a_avail = VAR_0->mb_type[0][s->block_index[VAR_1] - s->block_wrap[VAR_1]];", "if (VAR_1 == 1 || VAR_1 == 3 || s->mb_x)\nVAR_0->c_avail = VAR_0->mb_type[0][s->block_index[VAR_1] - 1];", "vc1_decode_intra_block(VAR_0, s->block[VAR_1], VAR_1, VAR_12, VAR_6,\n(VAR_1 & 4) ? VAR_0->codingset2 : VAR_0->codingset);", "if (VAR_1 > 3 && (s->flags & CODEC_FLAG_GRAY))\ncontinue;", "VAR_0->vc1dsp.vc1_inv_trans_8x8(s->block[VAR_1]);", "if (VAR_1 < 4) {", "VAR_24 = s->linesize << VAR_25;", "VAR_15 = (VAR_25) ? ((VAR_1 & 1) * 8) + ((VAR_1 & 2) >> 1) * s->linesize : (VAR_1 & 1) * 8 + 4 * (VAR_1 & 2) * s->linesize;", "} else {", "VAR_24 = s->uvlinesize;", "VAR_15 = 0;", "}", "s->dsp.put_signed_pixels_clamped(s->block[VAR_1], s->dest[VAR_14] + VAR_15, VAR_24);", "}", "} else {", "s->mb_intra = VAR_0->is_intra[s->mb_x] = 0;", "if (!VAR_17) {", "if (VAR_16 || !s->mb_intra) {", "VAR_26 = decode012(gb);", "switch (VAR_26) {", "case 0:\nVAR_26 = (VAR_0->bfraction >= (B_FRACTION_DEN/2)) ? BMV_TYPE_BACKWARD : BMV_TYPE_FORWARD;", "break;", "case 1:\nVAR_26 = (VAR_0->bfraction >= (B_FRACTION_DEN/2)) ? BMV_TYPE_FORWARD : BMV_TYPE_BACKWARD;", "break;", "case 2:\nVAR_26 = BMV_TYPE_INTERPOLATED;", "}", "}", "if (VAR_18 && VAR_26 != BMV_TYPE_INTERPOLATED)\nVAR_8 = get_bits1(gb);", "}", "if (!VAR_16) {", "VAR_9 = ff_vc1_mbmode_intfrp[0][VAR_22][3];", "if (VAR_9)\nVAR_4 = 1 + get_vlc2(&VAR_0->s.gb, VAR_0->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);", "if (!VAR_17) {", "if (VAR_26 == BMV_TYPE_INTERPOLATED && VAR_18) {", "VAR_0->fourmvbp = get_vlc2(gb, VAR_0->fourmvbp_vlc->table, VC1_4MV_BLOCK_PATTERN_VLC_BITS, 1);", "} else if (VAR_26 == BMV_TYPE_INTERPOLATED || VAR_18) {", "VAR_0->twomvbp = get_vlc2(gb, VAR_0->twomvbp_vlc->table, VC1_2MV_BLOCK_PATTERN_VLC_BITS, 1);", "}", "}", "for (VAR_1 = 0; VAR_1 < 6; VAR_1++)", "VAR_0->mb_type[0][s->block_index[VAR_1]] = 0;", "VAR_25 = VAR_0->fieldtx_plane[VAR_3] = ff_vc1_mbmode_intfrp[0][VAR_22][1];", "VAR_14 = 0;", "if (VAR_17) {", "if (VAR_18) {", "for (VAR_1 = 0; VAR_1 < 4; VAR_1++) {", "vc1_mc_4mv_luma(VAR_0, VAR_1, 0, 0);", "vc1_mc_4mv_luma(VAR_0, VAR_1, 1, 1);", "}", "vc1_mc_4mv_chroma4(VAR_0, 0, 0, 0);", "vc1_mc_4mv_chroma4(VAR_0, 1, 1, 1);", "} else {", "vc1_mc_1mv(VAR_0, 0);", "vc1_interp_mc(VAR_0);", "}", "} else if (VAR_18 && VAR_26 == BMV_TYPE_INTERPOLATED) {", "VAR_23 = VAR_0->fourmvbp;", "for (VAR_1 = 0; VAR_1 < 4; VAR_1++) {", "VAR_27 = VAR_1==1 || VAR_1==3;", "VAR_10 = VAR_11 = 0;", "VAR_12 = ((VAR_23 >> (3 - VAR_1)) & 1);", "if (VAR_12)\nget_mvdata_interlaced(VAR_0, &VAR_10, &VAR_11, 0);", "VAR_2 = VAR_1 > 1 ? 2 : 0;", "vc1_pred_mv_intfr(VAR_0, VAR_2, VAR_10, VAR_11, 2, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], VAR_27);", "vc1_mc_4mv_luma(VAR_0, VAR_2, VAR_27, VAR_27);", "vc1_mc_4mv_luma(VAR_0, VAR_2+1, VAR_27, VAR_27);", "}", "vc1_mc_4mv_chroma4(VAR_0, 0, 0, 0);", "vc1_mc_4mv_chroma4(VAR_0, 1, 1, 1);", "} else if (VAR_26 == BMV_TYPE_INTERPOLATED) {", "VAR_23 = VAR_0->twomvbp;", "VAR_10 = VAR_11 = 0;", "if (VAR_23 & 2)\nget_mvdata_interlaced(VAR_0, &VAR_10, &VAR_11, 0);", "vc1_pred_mv_intfr(VAR_0, 0, VAR_10, VAR_11, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], 0);", "vc1_mc_1mv(VAR_0, 0);", "VAR_10 = VAR_11 = 0;", "if (VAR_23 & 1)\nget_mvdata_interlaced(VAR_0, &VAR_10, &VAR_11, 0);", "vc1_pred_mv_intfr(VAR_0, 0, VAR_10, VAR_11, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], 1);", "vc1_interp_mc(VAR_0);", "} else if (VAR_18) {", "VAR_27 = VAR_26 == BMV_TYPE_BACKWARD;", "VAR_29 = VAR_27;", "if (VAR_8)\nVAR_29 = !VAR_27;", "VAR_23 = VAR_0->twomvbp;", "VAR_10 = VAR_11 = 0;", "if (VAR_23 & 2)\nget_mvdata_interlaced(VAR_0, &VAR_10, &VAR_11, 0);", "vc1_pred_mv_intfr(VAR_0, 0, VAR_10, VAR_11, 2, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], VAR_27);", "VAR_10 = VAR_11 = 0;", "if (VAR_23 & 1)\nget_mvdata_interlaced(VAR_0, &VAR_10, &VAR_11, 0);", "vc1_pred_mv_intfr(VAR_0, 2, VAR_10, VAR_11, 2, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], VAR_29);", "if (VAR_8) {", "for (VAR_1 = 0; VAR_1 < 2; VAR_1++) {", "s->mv[VAR_27][VAR_1+2][0] = s->mv[VAR_27][VAR_1][0] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1+2]][0] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1]][0];", "s->mv[VAR_27][VAR_1+2][1] = s->mv[VAR_27][VAR_1][1] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1+2]][1] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1]][1];", "s->mv[VAR_29][VAR_1+2][0] = s->mv[VAR_29][VAR_1][0] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1]][0] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1+2]][0];", "s->mv[VAR_29][VAR_1+2][1] = s->mv[VAR_29][VAR_1][1] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1]][1] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1+2]][1];", "}", "} else {", "vc1_pred_mv_intfr(VAR_0, 0, 0, 0, 2, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], !VAR_27);", "vc1_pred_mv_intfr(VAR_0, 2, 0, 0, 2, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], !VAR_27);", "}", "vc1_mc_4mv_luma(VAR_0, 0, VAR_27, 0);", "vc1_mc_4mv_luma(VAR_0, 1, VAR_27, 0);", "vc1_mc_4mv_luma(VAR_0, 2, VAR_29, 0);", "vc1_mc_4mv_luma(VAR_0, 3, VAR_29, 0);", "vc1_mc_4mv_chroma4(VAR_0, VAR_27, VAR_29, 0);", "} else {", "VAR_27 = VAR_26 == BMV_TYPE_BACKWARD;", "VAR_23 = ff_vc1_mbmode_intfrp[0][VAR_22][2];", "VAR_10 = VAR_11 = 0;", "if (VAR_23)\nget_mvdata_interlaced(VAR_0, &VAR_10, &VAR_11, 0);", "vc1_pred_mv_intfr(VAR_0, 0, VAR_10, VAR_11, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], VAR_27);", "VAR_0->blk_mv_type[s->block_index[0]] = 1;", "VAR_0->blk_mv_type[s->block_index[1]] = 1;", "VAR_0->blk_mv_type[s->block_index[2]] = 1;", "VAR_0->blk_mv_type[s->block_index[3]] = 1;", "vc1_pred_mv_intfr(VAR_0, 0, 0, 0, 2, VAR_0->range_x, VAR_0->range_y, 0, !VAR_27);", "for (VAR_1 = 0; VAR_1 < 2; VAR_1++) {", "s->mv[!VAR_27][VAR_1+2][0] = s->mv[!VAR_27][VAR_1][0] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1+2]][0] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1]][0];", "s->mv[!VAR_27][VAR_1+2][1] = s->mv[!VAR_27][VAR_1][1] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1+2]][1] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1]][1];", "}", "vc1_mc_1mv(VAR_0, VAR_27);", "}", "if (VAR_4)\nGET_MQUANT();", "s->current_picture.qscale_table[VAR_3] = VAR_6;", "if (!VAR_0->ttmbf && VAR_4)\nVAR_7 = get_vlc2(gb, ff_vc1_ttmb_vlc[VAR_0->tt_index].table, VC1_TTMB_VLC_BITS, 2);", "for (VAR_1 = 0; VAR_1 < 6; VAR_1++) {", "s->dc_val[0][s->block_index[VAR_1]] = 0;", "VAR_14 += VAR_1 >> 2;", "VAR_12 = ((VAR_4 >> (5 - VAR_1)) & 1);", "if (!VAR_25)\nVAR_15 = (VAR_1 & 4) ? 0 : ((VAR_1 & 1) * 8 + (VAR_1 & 2) * 4 * s->linesize);", "else\nVAR_15 = (VAR_1 & 4) ? 0 : ((VAR_1 & 1) * 8 + ((VAR_1 > 1) * s->linesize));", "if (VAR_12) {", "VAR_20 = vc1_decode_p_block(VAR_0, s->block[VAR_1], VAR_1, VAR_6, VAR_7,\nVAR_13, s->dest[VAR_14] + VAR_15,\n(VAR_1 & 4) ? s->uvlinesize : (s->linesize << VAR_25),\n(VAR_1 & 4) && (s->flags & CODEC_FLAG_GRAY), &VAR_21);", "VAR_19 |= VAR_20 << (VAR_1 << 2);", "if (!VAR_0->ttmbf && VAR_7 < 8)\nVAR_7 = -1;", "VAR_13 = 0;", "}", "}", "} else {", "VAR_27 = 0;", "for (VAR_1 = 0; VAR_1 < 6; VAR_1++) {", "VAR_0->mb_type[0][s->block_index[VAR_1]] = 0;", "s->dc_val[0][s->block_index[VAR_1]] = 0;", "}", "s->current_picture.mb_type[VAR_3] = MB_TYPE_SKIP;", "s->current_picture.qscale_table[VAR_3] = 0;", "VAR_0->blk_mv_type[s->block_index[0]] = 0;", "VAR_0->blk_mv_type[s->block_index[1]] = 0;", "VAR_0->blk_mv_type[s->block_index[2]] = 0;", "VAR_0->blk_mv_type[s->block_index[3]] = 0;", "if (!VAR_17) {", "if (VAR_26 == BMV_TYPE_INTERPOLATED) {", "vc1_pred_mv_intfr(VAR_0, 0, 0, 0, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], 0);", "vc1_pred_mv_intfr(VAR_0, 0, 0, 0, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], 1);", "} else {", "VAR_27 = VAR_26 == BMV_TYPE_BACKWARD;", "vc1_pred_mv_intfr(VAR_0, 0, 0, 0, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], VAR_27);", "if (VAR_8) {", "int VAR_29 = VAR_27;", "if (VAR_8)\nVAR_29 = !VAR_27;", "for (VAR_1 = 0; VAR_1 < 2; VAR_1++) {", "s->mv[VAR_27][VAR_1+2][0] = s->mv[VAR_27][VAR_1][0] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1+2]][0] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1]][0];", "s->mv[VAR_27][VAR_1+2][1] = s->mv[VAR_27][VAR_1][1] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1+2]][1] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1]][1];", "s->mv[VAR_29][VAR_1+2][0] = s->mv[VAR_29][VAR_1][0] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1]][0] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1+2]][0];", "s->mv[VAR_29][VAR_1+2][1] = s->mv[VAR_29][VAR_1][1] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1]][1] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1+2]][1];", "}", "} else {", "VAR_0->blk_mv_type[s->block_index[0]] = 1;", "VAR_0->blk_mv_type[s->block_index[1]] = 1;", "VAR_0->blk_mv_type[s->block_index[2]] = 1;", "VAR_0->blk_mv_type[s->block_index[3]] = 1;", "vc1_pred_mv_intfr(VAR_0, 0, 0, 0, 2, VAR_0->range_x, VAR_0->range_y, 0, !VAR_27);", "for (VAR_1 = 0; VAR_1 < 2; VAR_1++) {", "s->mv[!VAR_27][VAR_1+2][0] = s->mv[!VAR_27][VAR_1][0] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1+2]][0] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1]][0];", "s->mv[!VAR_27][VAR_1+2][1] = s->mv[!VAR_27][VAR_1][1] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1+2]][1] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1]][1];", "}", "}", "}", "}", "vc1_mc_1mv(VAR_0, VAR_27);", "if (VAR_17 || VAR_26 == BMV_TYPE_INTERPOLATED) {", "vc1_interp_mc(VAR_0);", "}", "}", "}", "if (s->mb_x == s->mb_width - 1)\nmemmove(VAR_0->is_intra_base, VAR_0->is_intra, sizeof(VAR_0->is_intra_base[0]) * s->mb_stride);", "VAR_0->VAR_4[s->mb_x] = VAR_19;", "VAR_0->ttblk[s->mb_x] = VAR_21;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53, 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91, 93 ], [ 95, 97 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185, 187 ], [ 189 ], [ 191 ], [ 193 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215, 217 ], [ 219, 221 ], [ 225, 227 ], [ 229, 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265, 267 ], [ 269 ], [ 271, 273 ], [ 275 ], [ 277, 279 ], [ 281 ], [ 283 ], [ 287, 289 ], [ 291 ], [ 295 ], [ 297 ], [ 299, 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 319 ], [ 321 ], [ 323 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365, 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391, 393 ], [ 397 ], [ 399 ], [ 403 ], [ 405, 407 ], [ 411 ], [ 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421, 423 ], [ 425 ], [ 427 ], [ 429, 431 ], [ 433 ], [ 437 ], [ 439, 441 ], [ 443 ], [ 447 ], [ 449 ], [ 451 ], [ 453 ], [ 455 ], [ 457 ], [ 459 ], [ 461 ], [ 463 ], [ 465 ], [ 467 ], [ 471 ], [ 473 ], [ 475 ], [ 477 ], [ 479 ], [ 481 ], [ 483 ], [ 487 ], [ 489 ], [ 491, 493 ], [ 497 ], [ 499 ], [ 501 ], [ 503 ], [ 505 ], [ 507 ], [ 509 ], [ 511 ], [ 513 ], [ 515 ], [ 517 ], [ 519 ], [ 523, 525 ], [ 527 ], [ 529, 531 ], [ 533 ], [ 535 ], [ 537 ], [ 539 ], [ 541, 543 ], [ 545, 547 ], [ 549 ], [ 551, 553, 555, 557 ], [ 559 ], [ 561, 563 ], [ 565 ], [ 567 ], [ 569 ], [ 573 ], [ 575 ], [ 577 ], [ 579 ], [ 581 ], [ 583 ], [ 585 ], [ 587 ], [ 589 ], [ 591 ], [ 593 ], [ 595 ], [ 599 ], [ 601 ], [ 603 ], [ 605 ], [ 607 ], [ 609 ], [ 611 ], [ 613 ], [ 615 ], [ 617, 619 ], [ 621 ], [ 623 ], [ 625 ], [ 627 ], [ 629 ], [ 631 ], [ 633 ], [ 635 ], [ 637 ], [ 639 ], [ 641 ], [ 643 ], [ 645 ], [ 647 ], [ 649 ], [ 651 ], [ 653 ], [ 655 ], [ 657 ], [ 661 ], [ 663 ], [ 665 ], [ 667 ], [ 669 ], [ 671 ], [ 673, 675 ], [ 677 ], [ 679 ], [ 681 ], [ 683 ] ]
25,486
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);
true
qemu
aab99135b63522267c6fdae04712cb2f02c8c7de
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); 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; 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);
{ "code": [], "line_no": [] }
static void FUNC_0(sPAPRDRConnector *VAR_0, DeviceState *VAR_1, void *VAR_2, int VAR_3, bool VAR_4, Error **VAR_5) { DPRINTFN("VAR_0: %x, FUNC_0", get_index(VAR_0)); if (VAR_0->isolation_state != SPAPR_DR_ISOLATION_STATE_ISOLATED) { error_setg(VAR_5, "an attached device is still awaiting release"); return; if (VAR_0->type == SPAPR_DR_CONNECTOR_TYPE_PCI) { g_assert(VAR_0->allocation_state == SPAPR_DR_ALLOCATION_STATE_USABLE); g_assert(VAR_2 || VAR_4); if (VAR_0->type == SPAPR_DR_CONNECTOR_TYPE_PCI) { VAR_0->isolation_state = SPAPR_DR_ISOLATION_STATE_UNISOLATED; VAR_0->indicator_state = SPAPR_DR_INDICATOR_STATE_ACTIVE; VAR_0->dev = VAR_1; VAR_0->VAR_2 = VAR_2; VAR_0->VAR_3 = VAR_3; VAR_0->configured = VAR_4; VAR_0->signalled = (VAR_0->type != SPAPR_DR_CONNECTOR_TYPE_PCI) ? true : VAR_4; object_property_add_link(OBJECT(VAR_0), "device", object_get_typename(OBJECT(VAR_0->dev)), (Object **)(&VAR_0->dev), NULL, 0, NULL);
[ "static void FUNC_0(sPAPRDRConnector *VAR_0, DeviceState *VAR_1, void *VAR_2,\nint VAR_3, bool VAR_4, Error **VAR_5)\n{", "DPRINTFN(\"VAR_0: %x, FUNC_0\", get_index(VAR_0));", "if (VAR_0->isolation_state != SPAPR_DR_ISOLATION_STATE_ISOLATED) {", "error_setg(VAR_5, \"an attached device is still awaiting release\");", "return;", "if (VAR_0->type == SPAPR_DR_CONNECTOR_TYPE_PCI) {", "g_assert(VAR_0->allocation_state == SPAPR_DR_ALLOCATION_STATE_USABLE);", "g_assert(VAR_2 || VAR_4);", "if (VAR_0->type == SPAPR_DR_CONNECTOR_TYPE_PCI) {", "VAR_0->isolation_state = SPAPR_DR_ISOLATION_STATE_UNISOLATED;", "VAR_0->indicator_state = SPAPR_DR_INDICATOR_STATE_ACTIVE;", "VAR_0->dev = VAR_1;", "VAR_0->VAR_2 = VAR_2;", "VAR_0->VAR_3 = VAR_3;", "VAR_0->configured = VAR_4;", "VAR_0->signalled = (VAR_0->type != SPAPR_DR_CONNECTOR_TYPE_PCI)\n? true : VAR_4;", "object_property_add_link(OBJECT(VAR_0), \"device\",\nobject_get_typename(OBJECT(VAR_0->dev)),\n(Object **)(&VAR_0->dev),\nNULL, 0, NULL);" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 18 ], [ 19 ], [ 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24 ], [ 34, 35 ], [ 36, 37, 38, 39 ] ]
25,487
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); }
true
qemu
b544c1aba8681c2fe5d6715fbd37cf6caf1bc7bb
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) { 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); }
{ "code": [ " add_aio_request(s, aio_req, &iov, 1, false, AIOCB_WRITE_UDATA);", " data_len, offset, 0, 0, offset);", " add_aio_request(s, aio_req, &iov, 1, false, AIOCB_WRITE_UDATA);" ], "line_no": [ 47, 43, 47 ] }
static void VAR_0 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) { 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); }
[ "static void VAR_0 sd_write_done(SheepdogAIOCB *acb)\n{", "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) {", "offset = sizeof(s->inode) - sizeof(s->inode.data_vdi_id) +\nmn * 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),\ndata_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);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23, 25 ], [ 27 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ] ]
25,488
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; }
true
FFmpeg
3ea5f64ffff0a51f62922efd2e2bc231b13b2179
static int execute_code(AVCodecContext * avctx, int c) { AnsiContext *s = avctx->priv_data; int ret, i, width, height; switch(c) { case 'A': s->y = FFMAX(s->y - (s->nb_args > 0 ? s->args[0]*s->font_height : s->font_height), 0); break; case 'B': 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': s->x = FFMIN(s->x + (s->nb_args > 0 ? s->args[0]*FONT_WIDTH : FONT_WIDTH), avctx->width - FONT_WIDTH); break; case 'D': s->x = FFMAX(s->x - (s->nb_args > 0 ? s->args[0]*FONT_WIDTH : FONT_WIDTH), 0); break; case 'H': case 'f': 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': case 'l': 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: s->font = ff_cga_font; s->font_height = 8; width = 40<<3; height = 25<<3; break; case 2: case 3: s->font = ff_vga16_font; s->font_height = 16; width = 80<<3; height = 25<<4; break; case 6: case 14: s->font = ff_cga_font; s->font_height = 8; width = 80<<3; height = 25<<3; break; case 7: break; case 15: case 16: s->font = ff_cga_font; s->font_height = 8; width = 80<<3; height = 43<<3; break; case 17: case 18: 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': 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': 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': 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': case 'R': break; case 's': s->sx = s->x; s->sy = s->y; break; case 'u': 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; }
{ "code": [ " int ret, i, width, height;", " if (width != avctx->width || height != avctx->height) {" ], "line_no": [ 7, 125 ] }
static int FUNC_0(AVCodecContext * VAR_0, int VAR_1) { AnsiContext *s = VAR_0->priv_data; int VAR_2, VAR_3, VAR_4, VAR_5; switch(VAR_1) { case 'A': s->y = FFMAX(s->y - (s->nb_args > 0 ? s->args[0]*s->font_height : s->font_height), 0); break; case 'B': s->y = FFMIN(s->y + (s->nb_args > 0 ? s->args[0]*s->font_height : s->font_height), VAR_0->VAR_5 - s->font_height); break; case 'C': s->x = FFMIN(s->x + (s->nb_args > 0 ? s->args[0]*FONT_WIDTH : FONT_WIDTH), VAR_0->VAR_4 - FONT_WIDTH); break; case 'D': s->x = FFMAX(s->x - (s->nb_args > 0 ? s->args[0]*FONT_WIDTH : FONT_WIDTH), 0); break; case 'H': case 'f': s->y = s->nb_args > 0 ? av_clip((s->args[0] - 1)*s->font_height, 0, VAR_0->VAR_5 - s->font_height) : 0; s->x = s->nb_args > 1 ? av_clip((s->args[1] - 1)*FONT_WIDTH, 0, VAR_0->VAR_4 - FONT_WIDTH) : 0; break; case 'h': case 'l': 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: s->font = ff_cga_font; s->font_height = 8; VAR_4 = 40<<3; VAR_5 = 25<<3; break; case 2: case 3: s->font = ff_vga16_font; s->font_height = 16; VAR_4 = 80<<3; VAR_5 = 25<<4; break; case 6: case 14: s->font = ff_cga_font; s->font_height = 8; VAR_4 = 80<<3; VAR_5 = 25<<3; break; case 7: break; case 15: case 16: s->font = ff_cga_font; s->font_height = 8; VAR_4 = 80<<3; VAR_5 = 43<<3; break; case 17: case 18: s->font = ff_cga_font; s->font_height = 8; VAR_4 = 80<<3; VAR_5 = 60<<4; break; default: avpriv_request_sample(VAR_0, "Unsupported screen mode"); } if (VAR_4 != VAR_0->VAR_4 || VAR_5 != VAR_0->VAR_5) { av_frame_unref(s->frame); VAR_2 = ff_set_dimensions(VAR_0, VAR_4, VAR_5); if (VAR_2 < 0) return VAR_2; VAR_2 = ff_get_buffer(VAR_0, s->frame, AV_GET_BUFFER_FLAG_REF); if (VAR_2 < 0) { av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\n"); return VAR_2; } 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(VAR_0); } else if (VAR_1 == 'l') { erase_screen(VAR_0); } break; case 'J': switch (s->args[0]) { case 0: erase_line(VAR_0, s->x, VAR_0->VAR_4 - s->x); if (s->y < VAR_0->VAR_5 - s->font_height) memset(s->frame->data[0] + (s->y + s->font_height)*s->frame->linesize[0], DEFAULT_BG_COLOR, (VAR_0->VAR_5 - s->y - s->font_height)*s->frame->linesize[0]); break; case 1: erase_line(VAR_0, 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(VAR_0); } break; case 'K': switch(s->args[0]) { case 0: erase_line(VAR_0, s->x, VAR_0->VAR_4 - s->x); break; case 1: erase_line(VAR_0, 0, s->x); break; case 2: erase_line(VAR_0, 0, VAR_0->VAR_4); } break; case 'm': if (s->nb_args == 0) { s->nb_args = 1; s->args[0] = 0; } for (VAR_3 = 0; VAR_3 < FFMIN(s->nb_args, MAX_NB_ARGS); VAR_3++) { int m = s->args[VAR_3]; 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(VAR_0, "Unsupported rendition parameter"); } } break; case 'n': case 'R': break; case 's': s->sx = s->x; s->sy = s->y; break; case 'u': s->x = av_clip(s->sx, 0, VAR_0->VAR_4 - FONT_WIDTH); s->y = av_clip(s->sy, 0, VAR_0->VAR_5 - s->font_height); break; default: avpriv_request_sample(VAR_0, "Unknown escape code"); break; } return 0; }
[ "static int FUNC_0(AVCodecContext * VAR_0, int VAR_1)\n{", "AnsiContext *s = VAR_0->priv_data;", "int VAR_2, VAR_3, VAR_4, VAR_5;", "switch(VAR_1) {", "case 'A':\ns->y = FFMAX(s->y - (s->nb_args > 0 ? s->args[0]*s->font_height : s->font_height), 0);", "break;", "case 'B':\ns->y = FFMIN(s->y + (s->nb_args > 0 ? s->args[0]*s->font_height : s->font_height), VAR_0->VAR_5 - s->font_height);", "break;", "case 'C':\ns->x = FFMIN(s->x + (s->nb_args > 0 ? s->args[0]*FONT_WIDTH : FONT_WIDTH), VAR_0->VAR_4 - FONT_WIDTH);", "break;", "case 'D':\ns->x = FFMAX(s->x - (s->nb_args > 0 ? s->args[0]*FONT_WIDTH : FONT_WIDTH), 0);", "break;", "case 'H':\ncase 'f':\ns->y = s->nb_args > 0 ? av_clip((s->args[0] - 1)*s->font_height, 0, VAR_0->VAR_5 - s->font_height) : 0;", "s->x = s->nb_args > 1 ? av_clip((s->args[1] - 1)*FONT_WIDTH, 0, VAR_0->VAR_4 - FONT_WIDTH) : 0;", "break;", "case 'h':\ncase 'l':\nif (s->nb_args < 2)\ns->args[0] = DEFAULT_SCREEN_MODE;", "switch(s->args[0]) {", "case 0: case 1: case 4: case 5: case 13: case 19:\ns->font = ff_cga_font;", "s->font_height = 8;", "VAR_4 = 40<<3;", "VAR_5 = 25<<3;", "break;", "case 2: case 3:\ns->font = ff_vga16_font;", "s->font_height = 16;", "VAR_4 = 80<<3;", "VAR_5 = 25<<4;", "break;", "case 6: case 14:\ns->font = ff_cga_font;", "s->font_height = 8;", "VAR_4 = 80<<3;", "VAR_5 = 25<<3;", "break;", "case 7:\nbreak;", "case 15: case 16:\ns->font = ff_cga_font;", "s->font_height = 8;", "VAR_4 = 80<<3;", "VAR_5 = 43<<3;", "break;", "case 17: case 18:\ns->font = ff_cga_font;", "s->font_height = 8;", "VAR_4 = 80<<3;", "VAR_5 = 60<<4;", "break;", "default:\navpriv_request_sample(VAR_0, \"Unsupported screen mode\");", "}", "if (VAR_4 != VAR_0->VAR_4 || VAR_5 != VAR_0->VAR_5) {", "av_frame_unref(s->frame);", "VAR_2 = ff_set_dimensions(VAR_0, VAR_4, VAR_5);", "if (VAR_2 < 0)\nreturn VAR_2;", "VAR_2 = ff_get_buffer(VAR_0, s->frame, AV_GET_BUFFER_FLAG_REF);", "if (VAR_2 < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"get_buffer() failed\\n\");", "return VAR_2;", "}", "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(VAR_0);", "} else if (VAR_1 == 'l') {", "erase_screen(VAR_0);", "}", "break;", "case 'J':\nswitch (s->args[0]) {", "case 0:\nerase_line(VAR_0, s->x, VAR_0->VAR_4 - s->x);", "if (s->y < VAR_0->VAR_5 - s->font_height)\nmemset(s->frame->data[0] + (s->y + s->font_height)*s->frame->linesize[0],\nDEFAULT_BG_COLOR, (VAR_0->VAR_5 - s->y - s->font_height)*s->frame->linesize[0]);", "break;", "case 1:\nerase_line(VAR_0, 0, s->x);", "if (s->y > 0)\nmemset(s->frame->data[0], DEFAULT_BG_COLOR, s->y * s->frame->linesize[0]);", "break;", "case 2:\nerase_screen(VAR_0);", "}", "break;", "case 'K':\nswitch(s->args[0]) {", "case 0:\nerase_line(VAR_0, s->x, VAR_0->VAR_4 - s->x);", "break;", "case 1:\nerase_line(VAR_0, 0, s->x);", "break;", "case 2:\nerase_line(VAR_0, 0, VAR_0->VAR_4);", "}", "break;", "case 'm':\nif (s->nb_args == 0) {", "s->nb_args = 1;", "s->args[0] = 0;", "}", "for (VAR_3 = 0; VAR_3 < FFMIN(s->nb_args, MAX_NB_ARGS); VAR_3++) {", "int m = s->args[VAR_3];", "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(VAR_0, \"Unsupported rendition parameter\");", "}", "}", "break;", "case 'n':\ncase 'R':\nbreak;", "case 's':\ns->sx = s->x;", "s->sy = s->y;", "break;", "case 'u':\ns->x = av_clip(s->sx, 0, VAR_0->VAR_4 - FONT_WIDTH);", "s->y = av_clip(s->sy, 0, VAR_0->VAR_5 - s->font_height);", "break;", "default:\navpriv_request_sample(VAR_0, \"Unknown escape code\");", "break;", "}", "return 0;", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35, 37, 39 ], [ 41 ], [ 43 ], [ 45, 47, 49, 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91, 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107, 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119, 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131, 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161, 163 ], [ 165, 167 ], [ 169, 171, 173 ], [ 175 ], [ 177, 179 ], [ 181, 183 ], [ 185 ], [ 187, 189 ], [ 191 ], [ 193 ], [ 195, 197 ], [ 199, 201 ], [ 203 ], [ 205, 207 ], [ 209 ], [ 211, 213 ], [ 215 ], [ 217 ], [ 219, 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271, 273, 277 ], [ 279, 281 ], [ 283 ], [ 285 ], [ 287, 289 ], [ 291 ], [ 293 ], [ 295, 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ] ]
25,490
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); } }
true
qemu
60be6340796e66b5ac8aac2d98dde5c79336a89c
void migration_bitmap_extend(ram_addr_t old, ram_addr_t new) { if (migration_bitmap) { unsigned long *old_bitmap = migration_bitmap, *bitmap; bitmap = bitmap_new(new); 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); } }
{ "code": [ " synchronize_rcu();", " if (migration_bitmap) {", " unsigned long *old_bitmap = migration_bitmap, *bitmap;", " bitmap = bitmap_new(new);", " bitmap_copy(bitmap, old_bitmap, old);", " bitmap_set(bitmap, old, new - old);", " atomic_rcu_set(&migration_bitmap, bitmap);", " synchronize_rcu();", " g_free(old_bitmap);" ], "line_no": [ 41, 11, 13, 15, 31, 33, 35, 41, 43 ] }
void FUNC_0(ram_addr_t VAR_0, ram_addr_t VAR_1) { if (migration_bitmap) { unsigned long *VAR_2 = migration_bitmap, *VAR_3; VAR_3 = bitmap_new(VAR_1); qemu_mutex_lock(&migration_bitmap_mutex); bitmap_copy(VAR_3, VAR_2, VAR_0); bitmap_set(VAR_3, VAR_0, VAR_1 - VAR_0); atomic_rcu_set(&migration_bitmap, VAR_3); qemu_mutex_unlock(&migration_bitmap_mutex); migration_dirty_pages += VAR_1 - VAR_0; synchronize_rcu(); g_free(VAR_2); } }
[ "void FUNC_0(ram_addr_t VAR_0, ram_addr_t VAR_1)\n{", "if (migration_bitmap) {", "unsigned long *VAR_2 = migration_bitmap, *VAR_3;", "VAR_3 = bitmap_new(VAR_1);", "qemu_mutex_lock(&migration_bitmap_mutex);", "bitmap_copy(VAR_3, VAR_2, VAR_0);", "bitmap_set(VAR_3, VAR_0, VAR_1 - VAR_0);", "atomic_rcu_set(&migration_bitmap, VAR_3);", "qemu_mutex_unlock(&migration_bitmap_mutex);", "migration_dirty_pages += VAR_1 - VAR_0;", "synchronize_rcu();", "g_free(VAR_2);", "}", "}" ]
[ 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 11 ], [ 13 ], [ 15 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ] ]
25,491
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); } }
true
qemu
49dd946bb5419681c8668b09a6d10f42bc707b78
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; } 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); } }
{ "code": [ " BUG_ON(fidp->fid_type != P9_FID_NONE);" ], "line_no": [ 167 ] }
static void VAR_0 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; } 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); } }
[ "static void VAR_0 v9fs_walk(void *opaque)\n{", "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;", "}", "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) ||\nstrcmp(\"..\", wnames[name_idx].data)) {", "err = v9fs_co_name_to_path(pdu, &dpath, wnames[name_idx].data,\n&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:\nput_fid(pdu, fidp);", "if (newfidp) {", "put_fid(pdu, newfidp);", "}", "v9fs_path_free(&dpath);", "v9fs_path_free(&path);", "out_nofid:\npdu_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);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 125 ], [ 127 ], [ 129 ], [ 131, 133 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 143 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193, 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207, 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ] ]
25,493
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; }
true
FFmpeg
0ecca7a49f8e254c12a3a1de048d738bfbb614c6
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; }
{ "code": [ " if (size > dest_size)" ], "line_no": [ 17 ] }
int FUNC_0(const AVPicture* VAR_0, int VAR_1, int VAR_2, int VAR_3, unsigned char *VAR_4, int VAR_5) { PixFmtInfo* pf = &pix_fmt_info[VAR_1]; int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10; const unsigned char* VAR_11; int VAR_12 = avpicture_get_size(VAR_1, VAR_2, VAR_3); if (VAR_12 > VAR_5) return -1; if (pf->pixel_type == FF_PIXEL_PACKED || pf->pixel_type == FF_PIXEL_PALETTE) { if (VAR_1 == PIX_FMT_YUV422 || VAR_1 == PIX_FMT_UYVY422 || VAR_1 == PIX_FMT_RGB565 || VAR_1 == PIX_FMT_RGB555) VAR_8 = VAR_2 * 2; else if (VAR_1 == PIX_FMT_UYVY411) VAR_8 = VAR_2 + VAR_2/2; else if (VAR_1 == PIX_FMT_PAL8) VAR_8 = VAR_2; else VAR_8 = VAR_2 * (pf->depth * pf->nb_channels / 8); VAR_10 = 1; VAR_9 = VAR_3; } else { VAR_10 = pf->nb_channels; VAR_8 = (VAR_2*pf->depth + 7)/8; VAR_9 = VAR_3; } for (VAR_6=0; VAR_6<VAR_10; VAR_6++) { if (VAR_6 == 1) { VAR_8 = VAR_2 >> pf->x_chroma_shift; VAR_9 = VAR_3 >> pf->y_chroma_shift; } VAR_11 = VAR_0->data[VAR_6]; for(VAR_7=0; VAR_7<VAR_9; VAR_7++) { memcpy(VAR_4, VAR_11, VAR_8); VAR_4 += VAR_8; VAR_11 += VAR_0->linesize[VAR_6]; } } if (pf->pixel_type == FF_PIXEL_PALETTE) memcpy((unsigned char *)(((size_t)VAR_4 + 3) & ~3), VAR_0->data[1], 256 * 4); return VAR_12; }
[ "int FUNC_0(const AVPicture* VAR_0, int VAR_1, int VAR_2, int VAR_3,\nunsigned char *VAR_4, int VAR_5)\n{", "PixFmtInfo* pf = &pix_fmt_info[VAR_1];", "int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;", "const unsigned char* VAR_11;", "int VAR_12 = avpicture_get_size(VAR_1, VAR_2, VAR_3);", "if (VAR_12 > VAR_5)\nreturn -1;", "if (pf->pixel_type == FF_PIXEL_PACKED || pf->pixel_type == FF_PIXEL_PALETTE) {", "if (VAR_1 == PIX_FMT_YUV422 ||\nVAR_1 == PIX_FMT_UYVY422 ||\nVAR_1 == PIX_FMT_RGB565 ||\nVAR_1 == PIX_FMT_RGB555)\nVAR_8 = VAR_2 * 2;", "else if (VAR_1 == PIX_FMT_UYVY411)\nVAR_8 = VAR_2 + VAR_2/2;", "else if (VAR_1 == PIX_FMT_PAL8)\nVAR_8 = VAR_2;", "else\nVAR_8 = VAR_2 * (pf->depth * pf->nb_channels / 8);", "VAR_10 = 1;", "VAR_9 = VAR_3;", "} else {", "VAR_10 = pf->nb_channels;", "VAR_8 = (VAR_2*pf->depth + 7)/8;", "VAR_9 = VAR_3;", "}", "for (VAR_6=0; VAR_6<VAR_10; VAR_6++) {", "if (VAR_6 == 1) {", "VAR_8 = VAR_2 >> pf->x_chroma_shift;", "VAR_9 = VAR_3 >> pf->y_chroma_shift;", "}", "VAR_11 = VAR_0->data[VAR_6];", "for(VAR_7=0; VAR_7<VAR_9; VAR_7++) {", "memcpy(VAR_4, VAR_11, VAR_8);", "VAR_4 += VAR_8;", "VAR_11 += VAR_0->linesize[VAR_6];", "}", "}", "if (pf->pixel_type == FF_PIXEL_PALETTE)\nmemcpy((unsigned char *)(((size_t)VAR_4 + 3) & ~3), VAR_0->data[1], 256 * 4);", "return VAR_12;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 23 ], [ 25, 27, 29, 31, 33 ], [ 35, 37 ], [ 39, 41 ], [ 43, 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91, 93 ], [ 97 ], [ 99 ] ]
25,495
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; }
true
qemu
eebe0b7905642a986cbce7406d6ab7bf78f3e210
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; }
{ "code": [ " int width = pixman_image_get_width(vd->guest.fb);", " int height = pixman_image_get_height(vd->guest.fb);" ], "line_no": [ 5, 7 ] }
static int FUNC_0(VncDisplay *VAR_0, struct timeval * VAR_1) { int VAR_2 = pixman_image_get_width(VAR_0->guest.fb); int VAR_3 = pixman_image_get_height(VAR_0->guest.fb); int VAR_4, VAR_5; struct timeval VAR_6; int VAR_7 = 0; for (VAR_5 = 0; VAR_5 < VAR_3; VAR_5 += VNC_STAT_RECT) { for (VAR_4 = 0; VAR_4 < VAR_2; VAR_4 += VNC_STAT_RECT) { VncRectStat *rect = vnc_stat_rect(VAR_0, VAR_4, VAR_5); rect->updated = false; } } qemu_timersub(VAR_1, &VNC_REFRESH_STATS, &VAR_6); if (timercmp(&VAR_0->guest.last_freq_check, &VAR_6, >)) { return VAR_7; } VAR_0->guest.last_freq_check = *VAR_1; for (VAR_5 = 0; VAR_5 < VAR_3; VAR_5 += VNC_STAT_RECT) { for (VAR_4 = 0; VAR_4 < VAR_2; VAR_4 += VNC_STAT_RECT) { VncRectStat *rect= vnc_stat_rect(VAR_0, VAR_4, VAR_5); int VAR_8 = ARRAY_SIZE(rect->times); struct timeval VAR_9, VAR_10; if (!timerisset(&rect->times[VAR_8 - 1])) { continue ; } VAR_10 = rect->times[(rect->idx + VAR_8 - 1) % VAR_8]; qemu_timersub(VAR_1, &VAR_10, &VAR_6); if (timercmp(&VAR_6, &VNC_REFRESH_LOSSY, >)) { rect->freq = 0; VAR_7 += vnc_refresh_lossy_rect(VAR_0, VAR_4, VAR_5); memset(rect->times, 0, sizeof (rect->times)); continue ; } VAR_9 = rect->times[rect->idx]; VAR_10 = rect->times[(rect->idx + VAR_8 - 1) % VAR_8]; qemu_timersub(&VAR_10, &VAR_9, &VAR_6); rect->freq = VAR_6.tv_sec + VAR_6.tv_usec / 1000000.; rect->freq /= VAR_8; rect->freq = 1. / rect->freq; } } return VAR_7; }
[ "static int FUNC_0(VncDisplay *VAR_0, struct timeval * VAR_1)\n{", "int VAR_2 = pixman_image_get_width(VAR_0->guest.fb);", "int VAR_3 = pixman_image_get_height(VAR_0->guest.fb);", "int VAR_4, VAR_5;", "struct timeval VAR_6;", "int VAR_7 = 0;", "for (VAR_5 = 0; VAR_5 < VAR_3; VAR_5 += VNC_STAT_RECT) {", "for (VAR_4 = 0; VAR_4 < VAR_2; VAR_4 += VNC_STAT_RECT) {", "VncRectStat *rect = vnc_stat_rect(VAR_0, VAR_4, VAR_5);", "rect->updated = false;", "}", "}", "qemu_timersub(VAR_1, &VNC_REFRESH_STATS, &VAR_6);", "if (timercmp(&VAR_0->guest.last_freq_check, &VAR_6, >)) {", "return VAR_7;", "}", "VAR_0->guest.last_freq_check = *VAR_1;", "for (VAR_5 = 0; VAR_5 < VAR_3; VAR_5 += VNC_STAT_RECT) {", "for (VAR_4 = 0; VAR_4 < VAR_2; VAR_4 += VNC_STAT_RECT) {", "VncRectStat *rect= vnc_stat_rect(VAR_0, VAR_4, VAR_5);", "int VAR_8 = ARRAY_SIZE(rect->times);", "struct timeval VAR_9, VAR_10;", "if (!timerisset(&rect->times[VAR_8 - 1])) {", "continue ;", "}", "VAR_10 = rect->times[(rect->idx + VAR_8 - 1) % VAR_8];", "qemu_timersub(VAR_1, &VAR_10, &VAR_6);", "if (timercmp(&VAR_6, &VNC_REFRESH_LOSSY, >)) {", "rect->freq = 0;", "VAR_7 += vnc_refresh_lossy_rect(VAR_0, VAR_4, VAR_5);", "memset(rect->times, 0, sizeof (rect->times));", "continue ;", "}", "VAR_9 = rect->times[rect->idx];", "VAR_10 = rect->times[(rect->idx + VAR_8 - 1) % VAR_8];", "qemu_timersub(&VAR_10, &VAR_9, &VAR_6);", "rect->freq = VAR_6.tv_sec + VAR_6.tv_usec / 1000000.;", "rect->freq /= VAR_8;", "rect->freq = 1. / rect->freq;", "}", "}", "return VAR_7;", "}" ]
[ 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ] ]
25,496
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); } }
true
qemu
6d1f252d8c1ba73bf6ed9af28731a9c9c3d473a2
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) { 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); } }
{ "code": [], "line_no": [] }
static void FUNC_0(IscsiLun *VAR_0, Error **VAR_1) { struct scsi_task *VAR_2 = NULL; struct scsi_readcapacity10 *VAR_3 = NULL; struct scsi_readcapacity16 *VAR_4 = NULL; int VAR_5 = ISCSI_CMD_RETRIES; do { if (VAR_2 != NULL) { scsi_free_scsi_task(VAR_2); VAR_2 = NULL; } switch (VAR_0->type) { case TYPE_DISK: VAR_2 = iscsi_readcapacity16_sync(VAR_0->iscsi, VAR_0->lun); if (VAR_2 != NULL && VAR_2->status == SCSI_STATUS_GOOD) { VAR_4 = scsi_datain_unmarshall(VAR_2); if (VAR_4 == NULL) { error_setg(VAR_1, "iSCSI: Failed to unmarshall readcapacity16 data."); } else { VAR_0->block_size = VAR_4->block_length; VAR_0->num_blocks = VAR_4->returned_lba + 1; VAR_0->lbpme = !!VAR_4->lbpme; VAR_0->lbprz = !!VAR_4->lbprz; VAR_0->use_16_for_rw = (VAR_4->returned_lba > 0xffffffff); } } break; case TYPE_ROM: VAR_2 = iscsi_readcapacity10_sync(VAR_0->iscsi, VAR_0->lun, 0, 0); if (VAR_2 != NULL && VAR_2->status == SCSI_STATUS_GOOD) { VAR_3 = scsi_datain_unmarshall(VAR_2); if (VAR_3 == NULL) { error_setg(VAR_1, "iSCSI: Failed to unmarshall readcapacity10 data."); } else { VAR_0->block_size = VAR_3->block_size; if (VAR_3->lba == 0) { VAR_0->num_blocks = 0; } else { VAR_0->num_blocks = VAR_3->lba + 1; } } } break; default: return; } } while (VAR_2 != NULL && VAR_2->status == SCSI_STATUS_CHECK_CONDITION && VAR_2->sense.key == SCSI_SENSE_UNIT_ATTENTION && VAR_5-- > 0); if (VAR_2 == NULL || VAR_2->status != SCSI_STATUS_GOOD) { error_setg(VAR_1, "iSCSI: failed to send readcapacity10 command."); } if (VAR_2) { scsi_free_scsi_task(VAR_2); } }
[ "static void FUNC_0(IscsiLun *VAR_0, Error **VAR_1)\n{", "struct scsi_task *VAR_2 = NULL;", "struct scsi_readcapacity10 *VAR_3 = NULL;", "struct scsi_readcapacity16 *VAR_4 = NULL;", "int VAR_5 = ISCSI_CMD_RETRIES;", "do {", "if (VAR_2 != NULL) {", "scsi_free_scsi_task(VAR_2);", "VAR_2 = NULL;", "}", "switch (VAR_0->type) {", "case TYPE_DISK:\nVAR_2 = iscsi_readcapacity16_sync(VAR_0->iscsi, VAR_0->lun);", "if (VAR_2 != NULL && VAR_2->status == SCSI_STATUS_GOOD) {", "VAR_4 = scsi_datain_unmarshall(VAR_2);", "if (VAR_4 == NULL) {", "error_setg(VAR_1, \"iSCSI: Failed to unmarshall readcapacity16 data.\");", "} else {", "VAR_0->block_size = VAR_4->block_length;", "VAR_0->num_blocks = VAR_4->returned_lba + 1;", "VAR_0->lbpme = !!VAR_4->lbpme;", "VAR_0->lbprz = !!VAR_4->lbprz;", "VAR_0->use_16_for_rw = (VAR_4->returned_lba > 0xffffffff);", "}", "}", "break;", "case TYPE_ROM:\nVAR_2 = iscsi_readcapacity10_sync(VAR_0->iscsi, VAR_0->lun, 0, 0);", "if (VAR_2 != NULL && VAR_2->status == SCSI_STATUS_GOOD) {", "VAR_3 = scsi_datain_unmarshall(VAR_2);", "if (VAR_3 == NULL) {", "error_setg(VAR_1, \"iSCSI: Failed to unmarshall readcapacity10 data.\");", "} else {", "VAR_0->block_size = VAR_3->block_size;", "if (VAR_3->lba == 0) {", "VAR_0->num_blocks = 0;", "} else {", "VAR_0->num_blocks = VAR_3->lba + 1;", "}", "}", "}", "break;", "default:\nreturn;", "}", "} while (VAR_2 != NULL && VAR_2->status == SCSI_STATUS_CHECK_CONDITION", "&& VAR_2->sense.key == SCSI_SENSE_UNIT_ATTENTION\n&& VAR_5-- > 0);", "if (VAR_2 == NULL || VAR_2->status != SCSI_STATUS_GOOD) {", "error_setg(VAR_1, \"iSCSI: failed to send readcapacity10 command.\");", "}", "if (VAR_2) {", "scsi_free_scsi_task(VAR_2);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 107 ], [ 109 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ] ]
25,497
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;
true
FFmpeg
e3e51f8c14d22ae11684dcfe58df355f0f9e6401
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)) { 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;
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void* VAR_1, int *VAR_2, AVPacket *VAR_3) { const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; MLPDecodeContext *m = VAR_0->priv_data; GetBitContext gb; unsigned int VAR_6, VAR_7; unsigned int VAR_8; unsigned int VAR_9 = 4; unsigned int VAR_10 = 0; uint8_t substream_parity_present[MAX_SUBSTREAMS]; uint16_t substream_data_len[MAX_SUBSTREAMS]; uint8_t parity_bits; int VAR_11; if (VAR_5 < 4) return AVERROR_INVALIDDATA; VAR_6 = (AV_RB16(VAR_4) & 0xfff) * 2; if (VAR_6 < 4 || VAR_6 > VAR_5) return AVERROR_INVALIDDATA; init_get_bits(&gb, (VAR_4 + 4), (VAR_6 - 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; VAR_9 += m->major_sync_header_size; if (!m->params_valid) { av_log(m->VAR_0, AV_LOG_WARNING, "Stream parameters not seen; skipping frame.\n"); *VAR_2 = 0; return VAR_6; VAR_8 = 0; for (VAR_7 = 0; VAR_7 < m->num_substreams; VAR_7++) { 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; VAR_10 += 2; if (extraword_present) { if (m->VAR_0->codec_id == AV_CODEC_ID_MLP) { av_log(m->VAR_0, AV_LOG_ERROR, "There must be no extraword for MLP.\n"); skip_bits(&gb, 16); VAR_10 += 2; if (!(nonrestart_substr ^ m->is_major_sync_unit)) { av_log(m->VAR_0, AV_LOG_ERROR, "Invalid nonrestart_substr.\n"); if (end + VAR_9 + VAR_10 > VAR_6) { av_log(m->VAR_0, AV_LOG_ERROR, "Indicated VAR_6 of substream %d VAR_1 goes off end of " "packet.\n", VAR_7); end = VAR_6 - VAR_9 - VAR_10; if (end < VAR_8) { av_log(VAR_0, AV_LOG_ERROR, "Indicated end offset of substream %d VAR_1 " "is smaller than calculated start offset.\n", VAR_7); if (VAR_7 > m->max_decoded_substream) continue; substream_parity_present[VAR_7] = checkdata_present; substream_data_len[VAR_7] = end - VAR_8; VAR_8 = end; parity_bits = ff_mlp_calculate_parity(VAR_4, 4); parity_bits ^= ff_mlp_calculate_parity(VAR_4 + VAR_9, VAR_10); if ((((parity_bits >> 4) ^ parity_bits) & 0xF) != 0xF) { av_log(VAR_0, AV_LOG_ERROR, "Parity check failed.\n"); VAR_4 += VAR_9 + VAR_10; for (VAR_7 = 0; VAR_7 <= m->max_decoded_substream; VAR_7++) { SubStream *s = &m->substream[VAR_7]; init_get_bits(&gb, VAR_4, substream_data_len[VAR_7] * 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)) { if (read_restart_header(m, &gb, VAR_4, VAR_7) < 0) goto next_substr; s->restart_seen = 1; if (!s->restart_seen) goto next_substr; if (read_decoding_params(m, &gb, VAR_7) < 0) goto next_substr; if (!s->restart_seen) goto next_substr; if ((VAR_11 = read_block_data(m, &gb, VAR_7)) < 0) return VAR_11; if (get_bits_count(&gb) >= substream_data_len[VAR_7] * 8) goto substream_length_mismatch; } while (!get_bits1(&gb)); skip_bits(&gb, (-get_bits_count(&gb)) & 15); if (substream_data_len[VAR_7] * 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->VAR_0->codec_id == AV_CODEC_ID_TRUEHD && shorten_by & 0x2000) s->blockpos -= FFMIN(shorten_by & 0x1FFF, s->blockpos); else if (m->VAR_0->codec_id == AV_CODEC_ID_MLP && shorten_by != 0xD234) return AVERROR_INVALIDDATA; if (VAR_7 == m->max_decoded_substream) av_log(m->VAR_0, AV_LOG_INFO, "End of stream indicated.\n"); if (substream_parity_present[VAR_7]) { uint8_t parity, checksum; if (substream_data_len[VAR_7] * 8 - get_bits_count(&gb) != 16) goto substream_length_mismatch; parity = ff_mlp_calculate_parity(VAR_4, substream_data_len[VAR_7] - 2); checksum = ff_mlp_checksum8 (VAR_4, substream_data_len[VAR_7] - 2); if ((get_bits(&gb, 8) ^ parity) != 0xa9 ) av_log(m->VAR_0, AV_LOG_ERROR, "Substream %d parity check failed.\n", VAR_7); if ( get_bits(&gb, 8) != checksum) av_log(m->VAR_0, AV_LOG_ERROR, "Substream %d checksum failed.\n" , VAR_7); if (substream_data_len[VAR_7] * 8 != get_bits_count(&gb)) goto substream_length_mismatch; next_substr: if (!s->restart_seen) av_log(m->VAR_0, AV_LOG_ERROR, "No restart header present in substream %d.\n", VAR_7); VAR_4 += substream_data_len[VAR_7]; if ((VAR_11 = output_data(m, m->max_decoded_substream, VAR_1, VAR_2)) < 0) return VAR_11; return VAR_6; substream_length_mismatch: av_log(m->VAR_0, AV_LOG_ERROR, "substream %d VAR_6 mismatch\n", VAR_7); return AVERROR_INVALIDDATA; error: m->params_valid = 0; return AVERROR_INVALIDDATA;
[ "static int FUNC_0(AVCodecContext *VAR_0, void* VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "MLPDecodeContext *m = VAR_0->priv_data;", "GetBitContext gb;", "unsigned int VAR_6, VAR_7;", "unsigned int VAR_8;", "unsigned int VAR_9 = 4;", "unsigned int VAR_10 = 0;", "uint8_t substream_parity_present[MAX_SUBSTREAMS];", "uint16_t substream_data_len[MAX_SUBSTREAMS];", "uint8_t parity_bits;", "int VAR_11;", "if (VAR_5 < 4)\nreturn AVERROR_INVALIDDATA;", "VAR_6 = (AV_RB16(VAR_4) & 0xfff) * 2;", "if (VAR_6 < 4 || VAR_6 > VAR_5)\nreturn AVERROR_INVALIDDATA;", "init_get_bits(&gb, (VAR_4 + 4), (VAR_6 - 4) * 8);", "m->is_major_sync_unit = 0;", "if (show_bits_long(&gb, 31) == (0xf8726fba >> 1)) {", "if (read_major_sync(m, &gb) < 0)\nm->is_major_sync_unit = 1;", "VAR_9 += m->major_sync_header_size;", "if (!m->params_valid) {", "av_log(m->VAR_0, AV_LOG_WARNING,\n\"Stream parameters not seen; skipping frame.\\n\");", "*VAR_2 = 0;", "return VAR_6;", "VAR_8 = 0;", "for (VAR_7 = 0; VAR_7 < m->num_substreams; VAR_7++) {", "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;", "VAR_10 += 2;", "if (extraword_present) {", "if (m->VAR_0->codec_id == AV_CODEC_ID_MLP) {", "av_log(m->VAR_0, AV_LOG_ERROR, \"There must be no extraword for MLP.\\n\");", "skip_bits(&gb, 16);", "VAR_10 += 2;", "if (!(nonrestart_substr ^ m->is_major_sync_unit)) {", "av_log(m->VAR_0, AV_LOG_ERROR, \"Invalid nonrestart_substr.\\n\");", "if (end + VAR_9 + VAR_10 > VAR_6) {", "av_log(m->VAR_0, AV_LOG_ERROR,\n\"Indicated VAR_6 of substream %d VAR_1 goes off end of \"\n\"packet.\\n\", VAR_7);", "end = VAR_6 - VAR_9 - VAR_10;", "if (end < VAR_8) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Indicated end offset of substream %d VAR_1 \"\n\"is smaller than calculated start offset.\\n\",\nVAR_7);", "if (VAR_7 > m->max_decoded_substream)\ncontinue;", "substream_parity_present[VAR_7] = checkdata_present;", "substream_data_len[VAR_7] = end - VAR_8;", "VAR_8 = end;", "parity_bits = ff_mlp_calculate_parity(VAR_4, 4);", "parity_bits ^= ff_mlp_calculate_parity(VAR_4 + VAR_9, VAR_10);", "if ((((parity_bits >> 4) ^ parity_bits) & 0xF) != 0xF) {", "av_log(VAR_0, AV_LOG_ERROR, \"Parity check failed.\\n\");", "VAR_4 += VAR_9 + VAR_10;", "for (VAR_7 = 0; VAR_7 <= m->max_decoded_substream; VAR_7++) {", "SubStream *s = &m->substream[VAR_7];", "init_get_bits(&gb, VAR_4, substream_data_len[VAR_7] * 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)) {", "if (read_restart_header(m, &gb, VAR_4, VAR_7) < 0)\ngoto next_substr;", "s->restart_seen = 1;", "if (!s->restart_seen)\ngoto next_substr;", "if (read_decoding_params(m, &gb, VAR_7) < 0)\ngoto next_substr;", "if (!s->restart_seen)\ngoto next_substr;", "if ((VAR_11 = read_block_data(m, &gb, VAR_7)) < 0)\nreturn VAR_11;", "if (get_bits_count(&gb) >= substream_data_len[VAR_7] * 8)\ngoto substream_length_mismatch;", "} while (!get_bits1(&gb));", "skip_bits(&gb, (-get_bits_count(&gb)) & 15);", "if (substream_data_len[VAR_7] * 8 - get_bits_count(&gb) >= 32) {", "int shorten_by;", "if (get_bits(&gb, 16) != 0xD234)\nreturn AVERROR_INVALIDDATA;", "shorten_by = get_bits(&gb, 16);", "if (m->VAR_0->codec_id == AV_CODEC_ID_TRUEHD && shorten_by & 0x2000)\ns->blockpos -= FFMIN(shorten_by & 0x1FFF, s->blockpos);", "else if (m->VAR_0->codec_id == AV_CODEC_ID_MLP && shorten_by != 0xD234)\nreturn AVERROR_INVALIDDATA;", "if (VAR_7 == m->max_decoded_substream)\nav_log(m->VAR_0, AV_LOG_INFO, \"End of stream indicated.\\n\");", "if (substream_parity_present[VAR_7]) {", "uint8_t parity, checksum;", "if (substream_data_len[VAR_7] * 8 - get_bits_count(&gb) != 16)\ngoto substream_length_mismatch;", "parity = ff_mlp_calculate_parity(VAR_4, substream_data_len[VAR_7] - 2);", "checksum = ff_mlp_checksum8 (VAR_4, substream_data_len[VAR_7] - 2);", "if ((get_bits(&gb, 8) ^ parity) != 0xa9 )\nav_log(m->VAR_0, AV_LOG_ERROR, \"Substream %d parity check failed.\\n\", VAR_7);", "if ( get_bits(&gb, 8) != checksum)\nav_log(m->VAR_0, AV_LOG_ERROR, \"Substream %d checksum failed.\\n\" , VAR_7);", "if (substream_data_len[VAR_7] * 8 != get_bits_count(&gb))\ngoto substream_length_mismatch;", "next_substr:\nif (!s->restart_seen)\nav_log(m->VAR_0, AV_LOG_ERROR,\n\"No restart header present in substream %d.\\n\", VAR_7);", "VAR_4 += substream_data_len[VAR_7];", "if ((VAR_11 = output_data(m, m->max_decoded_substream, VAR_1, VAR_2)) < 0)\nreturn VAR_11;", "return VAR_6;", "substream_length_mismatch:\nav_log(m->VAR_0, AV_LOG_ERROR, \"substream %d VAR_6 mismatch\\n\", VAR_7);", "return AVERROR_INVALIDDATA;", "error:\nm->params_valid = 0;", "return AVERROR_INVALIDDATA;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16, 17 ], [ 18 ], [ 19, 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24, 25 ], [ 26 ], [ 27 ], [ 28, 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33 ], [ 34 ], [ 35 ], [ 36 ], [ 37 ], [ 38 ], [ 39 ], [ 40 ], [ 41 ], [ 42 ], [ 43 ], [ 44 ], [ 45 ], [ 46 ], [ 47 ], [ 48 ], [ 49, 50, 51 ], [ 52 ], [ 53 ], [ 54, 55, 56, 57 ], [ 58, 59 ], [ 60 ], [ 61 ], [ 62 ], [ 63 ], [ 64 ], [ 65 ], [ 66 ], [ 67 ], [ 68 ], [ 69 ], [ 70 ], [ 71 ], [ 72 ], [ 73 ], [ 74 ], [ 75 ], [ 76 ], [ 78, 79 ], [ 80 ], [ 81, 82 ], [ 83, 84 ], [ 85, 86 ], [ 87, 88 ], [ 89, 90 ], [ 91 ], [ 92 ], [ 93 ], [ 94 ], [ 95, 96 ], [ 97 ], [ 98, 99 ], [ 100, 101 ], [ 102, 103 ], [ 104 ], [ 105 ], [ 106, 107 ], [ 108 ], [ 109 ], [ 110, 111 ], [ 112, 113 ], [ 114, 115 ], [ 116, 117, 118, 119 ], [ 120 ], [ 121, 122 ], [ 123 ], [ 124, 125 ], [ 126 ], [ 127, 128 ], [ 129 ] ]