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
21,733
static int disas_neon_data_insn(DisasContext *s, uint32_t insn) { int op; int q; int rd, rn, rm; int size; int shift; int pass; int count; int pairwise; int u; uint32_t imm, mask; TCGv_i32 tmp, tmp2, tmp3, tmp4, tmp5; TCGv_i64 tmp64; /* FIXME: this access check should not take precedence over UNDEF * for invalid encodings; we will generate incorrect syndrome information * for attempts to execute invalid vfp/neon encodings with FP disabled. */ if (!s->cpacr_fpen) { gen_exception_insn(s, 4, EXCP_UDEF, syn_fp_access_trap(1, 0xe, s->thumb), default_exception_el(s)); return 0; } if (!s->vfp_enabled) return 1; q = (insn & (1 << 6)) != 0; u = (insn >> 24) & 1; VFP_DREG_D(rd, insn); VFP_DREG_N(rn, insn); VFP_DREG_M(rm, insn); size = (insn >> 20) & 3; if ((insn & (1 << 23)) == 0) { /* Three register same length. */ op = ((insn >> 7) & 0x1e) | ((insn >> 4) & 1); /* Catch invalid op and bad size combinations: UNDEF */ if ((neon_3r_sizes[op] & (1 << size)) == 0) { return 1; } /* All insns of this form UNDEF for either this condition or the * superset of cases "Q==1"; we catch the latter later. */ if (q && ((rd | rn | rm) & 1)) { return 1; } /* * The SHA-1/SHA-256 3-register instructions require special treatment * here, as their size field is overloaded as an op type selector, and * they all consume their input in a single pass. */ if (op == NEON_3R_SHA) { if (!q) { return 1; } if (!u) { /* SHA-1 */ if (!arm_dc_feature(s, ARM_FEATURE_V8_SHA1)) { return 1; } tmp = tcg_const_i32(rd); tmp2 = tcg_const_i32(rn); tmp3 = tcg_const_i32(rm); tmp4 = tcg_const_i32(size); gen_helper_crypto_sha1_3reg(cpu_env, tmp, tmp2, tmp3, tmp4); tcg_temp_free_i32(tmp4); } else { /* SHA-256 */ if (!arm_dc_feature(s, ARM_FEATURE_V8_SHA256) || size == 3) { return 1; } tmp = tcg_const_i32(rd); tmp2 = tcg_const_i32(rn); tmp3 = tcg_const_i32(rm); switch (size) { case 0: gen_helper_crypto_sha256h(cpu_env, tmp, tmp2, tmp3); break; case 1: gen_helper_crypto_sha256h2(cpu_env, tmp, tmp2, tmp3); break; case 2: gen_helper_crypto_sha256su1(cpu_env, tmp, tmp2, tmp3); break; } } tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp3); return 0; } if (size == 3 && op != NEON_3R_LOGIC) { /* 64-bit element instructions. */ for (pass = 0; pass < (q ? 2 : 1); pass++) { neon_load_reg64(cpu_V0, rn + pass); neon_load_reg64(cpu_V1, rm + pass); switch (op) { case NEON_3R_VQADD: if (u) { gen_helper_neon_qadd_u64(cpu_V0, cpu_env, cpu_V0, cpu_V1); } else { gen_helper_neon_qadd_s64(cpu_V0, cpu_env, cpu_V0, cpu_V1); } break; case NEON_3R_VQSUB: if (u) { gen_helper_neon_qsub_u64(cpu_V0, cpu_env, cpu_V0, cpu_V1); } else { gen_helper_neon_qsub_s64(cpu_V0, cpu_env, cpu_V0, cpu_V1); } break; case NEON_3R_VSHL: if (u) { gen_helper_neon_shl_u64(cpu_V0, cpu_V1, cpu_V0); } else { gen_helper_neon_shl_s64(cpu_V0, cpu_V1, cpu_V0); } break; case NEON_3R_VQSHL: if (u) { gen_helper_neon_qshl_u64(cpu_V0, cpu_env, cpu_V1, cpu_V0); } else { gen_helper_neon_qshl_s64(cpu_V0, cpu_env, cpu_V1, cpu_V0); } break; case NEON_3R_VRSHL: if (u) { gen_helper_neon_rshl_u64(cpu_V0, cpu_V1, cpu_V0); } else { gen_helper_neon_rshl_s64(cpu_V0, cpu_V1, cpu_V0); } break; case NEON_3R_VQRSHL: if (u) { gen_helper_neon_qrshl_u64(cpu_V0, cpu_env, cpu_V1, cpu_V0); } else { gen_helper_neon_qrshl_s64(cpu_V0, cpu_env, cpu_V1, cpu_V0); } break; case NEON_3R_VADD_VSUB: if (u) { tcg_gen_sub_i64(CPU_V001); } else { tcg_gen_add_i64(CPU_V001); } break; default: abort(); } neon_store_reg64(cpu_V0, rd + pass); } return 0; } pairwise = 0; switch (op) { case NEON_3R_VSHL: case NEON_3R_VQSHL: case NEON_3R_VRSHL: case NEON_3R_VQRSHL: { int rtmp; /* Shift instruction operands are reversed. */ rtmp = rn; rn = rm; rm = rtmp; } break; case NEON_3R_VPADD: if (u) { return 1; } /* Fall through */ case NEON_3R_VPMAX: case NEON_3R_VPMIN: pairwise = 1; break; case NEON_3R_FLOAT_ARITH: pairwise = (u && size < 2); /* if VPADD (float) */ break; case NEON_3R_FLOAT_MINMAX: pairwise = u; /* if VPMIN/VPMAX (float) */ break; case NEON_3R_FLOAT_CMP: if (!u && size) { /* no encoding for U=0 C=1x */ return 1; } break; case NEON_3R_FLOAT_ACMP: if (!u) { return 1; } break; case NEON_3R_FLOAT_MISC: /* VMAXNM/VMINNM in ARMv8 */ if (u && !arm_dc_feature(s, ARM_FEATURE_V8)) { return 1; } break; case NEON_3R_VMUL: if (u && (size != 0)) { /* UNDEF on invalid size for polynomial subcase */ return 1; } break; case NEON_3R_VFM: if (!arm_dc_feature(s, ARM_FEATURE_VFP4) || u) { return 1; } break; default: break; } if (pairwise && q) { /* All the pairwise insns UNDEF if Q is set */ return 1; } for (pass = 0; pass < (q ? 4 : 2); pass++) { if (pairwise) { /* Pairwise. */ if (pass < 1) { tmp = neon_load_reg(rn, 0); tmp2 = neon_load_reg(rn, 1); } else { tmp = neon_load_reg(rm, 0); tmp2 = neon_load_reg(rm, 1); } } else { /* Elementwise. */ tmp = neon_load_reg(rn, pass); tmp2 = neon_load_reg(rm, pass); } switch (op) { case NEON_3R_VHADD: GEN_NEON_INTEGER_OP(hadd); break; case NEON_3R_VQADD: GEN_NEON_INTEGER_OP_ENV(qadd); break; case NEON_3R_VRHADD: GEN_NEON_INTEGER_OP(rhadd); break; case NEON_3R_LOGIC: /* Logic ops. */ switch ((u << 2) | size) { case 0: /* VAND */ tcg_gen_and_i32(tmp, tmp, tmp2); break; case 1: /* BIC */ tcg_gen_andc_i32(tmp, tmp, tmp2); break; case 2: /* VORR */ tcg_gen_or_i32(tmp, tmp, tmp2); break; case 3: /* VORN */ tcg_gen_orc_i32(tmp, tmp, tmp2); break; case 4: /* VEOR */ tcg_gen_xor_i32(tmp, tmp, tmp2); break; case 5: /* VBSL */ tmp3 = neon_load_reg(rd, pass); gen_neon_bsl(tmp, tmp, tmp2, tmp3); tcg_temp_free_i32(tmp3); break; case 6: /* VBIT */ tmp3 = neon_load_reg(rd, pass); gen_neon_bsl(tmp, tmp, tmp3, tmp2); tcg_temp_free_i32(tmp3); break; case 7: /* VBIF */ tmp3 = neon_load_reg(rd, pass); gen_neon_bsl(tmp, tmp3, tmp, tmp2); tcg_temp_free_i32(tmp3); break; } break; case NEON_3R_VHSUB: GEN_NEON_INTEGER_OP(hsub); break; case NEON_3R_VQSUB: GEN_NEON_INTEGER_OP_ENV(qsub); break; case NEON_3R_VCGT: GEN_NEON_INTEGER_OP(cgt); break; case NEON_3R_VCGE: GEN_NEON_INTEGER_OP(cge); break; case NEON_3R_VSHL: GEN_NEON_INTEGER_OP(shl); break; case NEON_3R_VQSHL: GEN_NEON_INTEGER_OP_ENV(qshl); break; case NEON_3R_VRSHL: GEN_NEON_INTEGER_OP(rshl); break; case NEON_3R_VQRSHL: GEN_NEON_INTEGER_OP_ENV(qrshl); break; case NEON_3R_VMAX: GEN_NEON_INTEGER_OP(max); break; case NEON_3R_VMIN: GEN_NEON_INTEGER_OP(min); break; case NEON_3R_VABD: GEN_NEON_INTEGER_OP(abd); break; case NEON_3R_VABA: GEN_NEON_INTEGER_OP(abd); tcg_temp_free_i32(tmp2); tmp2 = neon_load_reg(rd, pass); gen_neon_add(size, tmp, tmp2); break; case NEON_3R_VADD_VSUB: if (!u) { /* VADD */ gen_neon_add(size, tmp, tmp2); } else { /* VSUB */ switch (size) { case 0: gen_helper_neon_sub_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_sub_u16(tmp, tmp, tmp2); break; case 2: tcg_gen_sub_i32(tmp, tmp, tmp2); break; default: abort(); } } break; case NEON_3R_VTST_VCEQ: if (!u) { /* VTST */ switch (size) { case 0: gen_helper_neon_tst_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_tst_u16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_tst_u32(tmp, tmp, tmp2); break; default: abort(); } } else { /* VCEQ */ switch (size) { case 0: gen_helper_neon_ceq_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_ceq_u16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_ceq_u32(tmp, tmp, tmp2); break; default: abort(); } } break; case NEON_3R_VML: /* VMLA, VMLAL, VMLS,VMLSL */ switch (size) { case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break; case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break; default: abort(); } tcg_temp_free_i32(tmp2); tmp2 = neon_load_reg(rd, pass); if (u) { /* VMLS */ gen_neon_rsb(size, tmp, tmp2); } else { /* VMLA */ gen_neon_add(size, tmp, tmp2); } break; case NEON_3R_VMUL: if (u) { /* polynomial */ gen_helper_neon_mul_p8(tmp, tmp, tmp2); } else { /* Integer */ switch (size) { case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break; case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break; default: abort(); } } break; case NEON_3R_VPMAX: GEN_NEON_INTEGER_OP(pmax); break; case NEON_3R_VPMIN: GEN_NEON_INTEGER_OP(pmin); break; case NEON_3R_VQDMULH_VQRDMULH: /* Multiply high. */ if (!u) { /* VQDMULH */ switch (size) { case 1: gen_helper_neon_qdmulh_s16(tmp, cpu_env, tmp, tmp2); break; case 2: gen_helper_neon_qdmulh_s32(tmp, cpu_env, tmp, tmp2); break; default: abort(); } } else { /* VQRDMULH */ switch (size) { case 1: gen_helper_neon_qrdmulh_s16(tmp, cpu_env, tmp, tmp2); break; case 2: gen_helper_neon_qrdmulh_s32(tmp, cpu_env, tmp, tmp2); break; default: abort(); } } break; case NEON_3R_VPADD: switch (size) { case 0: gen_helper_neon_padd_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_padd_u16(tmp, tmp, tmp2); break; case 2: tcg_gen_add_i32(tmp, tmp, tmp2); break; default: abort(); } break; case NEON_3R_FLOAT_ARITH: /* Floating point arithmetic. */ { TCGv_ptr fpstatus = get_fpstatus_ptr(1); switch ((u << 2) | size) { case 0: /* VADD */ case 4: /* VPADD */ gen_helper_vfp_adds(tmp, tmp, tmp2, fpstatus); break; case 2: /* VSUB */ gen_helper_vfp_subs(tmp, tmp, tmp2, fpstatus); break; case 6: /* VABD */ gen_helper_neon_abd_f32(tmp, tmp, tmp2, fpstatus); break; default: abort(); } tcg_temp_free_ptr(fpstatus); break; } case NEON_3R_FLOAT_MULTIPLY: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); gen_helper_vfp_muls(tmp, tmp, tmp2, fpstatus); if (!u) { tcg_temp_free_i32(tmp2); tmp2 = neon_load_reg(rd, pass); if (size == 0) { gen_helper_vfp_adds(tmp, tmp, tmp2, fpstatus); } else { gen_helper_vfp_subs(tmp, tmp2, tmp, fpstatus); } } tcg_temp_free_ptr(fpstatus); break; } case NEON_3R_FLOAT_CMP: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); if (!u) { gen_helper_neon_ceq_f32(tmp, tmp, tmp2, fpstatus); } else { if (size == 0) { gen_helper_neon_cge_f32(tmp, tmp, tmp2, fpstatus); } else { gen_helper_neon_cgt_f32(tmp, tmp, tmp2, fpstatus); } } tcg_temp_free_ptr(fpstatus); break; } case NEON_3R_FLOAT_ACMP: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); if (size == 0) { gen_helper_neon_acge_f32(tmp, tmp, tmp2, fpstatus); } else { gen_helper_neon_acgt_f32(tmp, tmp, tmp2, fpstatus); } tcg_temp_free_ptr(fpstatus); break; } case NEON_3R_FLOAT_MINMAX: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); if (size == 0) { gen_helper_vfp_maxs(tmp, tmp, tmp2, fpstatus); } else { gen_helper_vfp_mins(tmp, tmp, tmp2, fpstatus); } tcg_temp_free_ptr(fpstatus); break; } case NEON_3R_FLOAT_MISC: if (u) { /* VMAXNM/VMINNM */ TCGv_ptr fpstatus = get_fpstatus_ptr(1); if (size == 0) { gen_helper_vfp_maxnums(tmp, tmp, tmp2, fpstatus); } else { gen_helper_vfp_minnums(tmp, tmp, tmp2, fpstatus); } tcg_temp_free_ptr(fpstatus); } else { if (size == 0) { gen_helper_recps_f32(tmp, tmp, tmp2, cpu_env); } else { gen_helper_rsqrts_f32(tmp, tmp, tmp2, cpu_env); } } break; case NEON_3R_VFM: { /* VFMA, VFMS: fused multiply-add */ TCGv_ptr fpstatus = get_fpstatus_ptr(1); TCGv_i32 tmp3 = neon_load_reg(rd, pass); if (size) { /* VFMS */ gen_helper_vfp_negs(tmp, tmp); } gen_helper_vfp_muladds(tmp, tmp, tmp2, tmp3, fpstatus); tcg_temp_free_i32(tmp3); tcg_temp_free_ptr(fpstatus); break; } default: abort(); } tcg_temp_free_i32(tmp2); /* Save the result. For elementwise operations we can put it straight into the destination register. For pairwise operations we have to be careful to avoid clobbering the source operands. */ if (pairwise && rd == rm) { neon_store_scratch(pass, tmp); } else { neon_store_reg(rd, pass, tmp); } } /* for pass */ if (pairwise && rd == rm) { for (pass = 0; pass < (q ? 4 : 2); pass++) { tmp = neon_load_scratch(pass); neon_store_reg(rd, pass, tmp); } } /* End of 3 register same size operations. */ } else if (insn & (1 << 4)) { if ((insn & 0x00380080) != 0) { /* Two registers and shift. */ op = (insn >> 8) & 0xf; if (insn & (1 << 7)) { /* 64-bit shift. */ if (op > 7) { return 1; } size = 3; } else { size = 2; while ((insn & (1 << (size + 19))) == 0) size--; } shift = (insn >> 16) & ((1 << (3 + size)) - 1); /* To avoid excessive duplication of ops we implement shift by immediate using the variable shift operations. */ if (op < 8) { /* Shift by immediate: VSHR, VSRA, VRSHR, VRSRA, VSRI, VSHL, VQSHL, VQSHLU. */ if (q && ((rd | rm) & 1)) { return 1; } if (!u && (op == 4 || op == 6)) { return 1; } /* Right shifts are encoded as N - shift, where N is the element size in bits. */ if (op <= 4) shift = shift - (1 << (size + 3)); if (size == 3) { count = q + 1; } else { count = q ? 4: 2; } switch (size) { case 0: imm = (uint8_t) shift; imm |= imm << 8; imm |= imm << 16; break; case 1: imm = (uint16_t) shift; imm |= imm << 16; break; case 2: case 3: imm = shift; break; default: abort(); } for (pass = 0; pass < count; pass++) { if (size == 3) { neon_load_reg64(cpu_V0, rm + pass); tcg_gen_movi_i64(cpu_V1, imm); switch (op) { case 0: /* VSHR */ case 1: /* VSRA */ if (u) gen_helper_neon_shl_u64(cpu_V0, cpu_V0, cpu_V1); else gen_helper_neon_shl_s64(cpu_V0, cpu_V0, cpu_V1); break; case 2: /* VRSHR */ case 3: /* VRSRA */ if (u) gen_helper_neon_rshl_u64(cpu_V0, cpu_V0, cpu_V1); else gen_helper_neon_rshl_s64(cpu_V0, cpu_V0, cpu_V1); break; case 4: /* VSRI */ case 5: /* VSHL, VSLI */ gen_helper_neon_shl_u64(cpu_V0, cpu_V0, cpu_V1); break; case 6: /* VQSHLU */ gen_helper_neon_qshlu_s64(cpu_V0, cpu_env, cpu_V0, cpu_V1); break; case 7: /* VQSHL */ if (u) { gen_helper_neon_qshl_u64(cpu_V0, cpu_env, cpu_V0, cpu_V1); } else { gen_helper_neon_qshl_s64(cpu_V0, cpu_env, cpu_V0, cpu_V1); } break; } if (op == 1 || op == 3) { /* Accumulate. */ neon_load_reg64(cpu_V1, rd + pass); tcg_gen_add_i64(cpu_V0, cpu_V0, cpu_V1); } else if (op == 4 || (op == 5 && u)) { /* Insert */ neon_load_reg64(cpu_V1, rd + pass); uint64_t mask; if (shift < -63 || shift > 63) { mask = 0; } else { if (op == 4) { mask = 0xffffffffffffffffull >> -shift; } else { mask = 0xffffffffffffffffull << shift; } } tcg_gen_andi_i64(cpu_V1, cpu_V1, ~mask); tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1); } neon_store_reg64(cpu_V0, rd + pass); } else { /* size < 3 */ /* Operands in T0 and T1. */ tmp = neon_load_reg(rm, pass); tmp2 = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp2, imm); switch (op) { case 0: /* VSHR */ case 1: /* VSRA */ GEN_NEON_INTEGER_OP(shl); break; case 2: /* VRSHR */ case 3: /* VRSRA */ GEN_NEON_INTEGER_OP(rshl); break; case 4: /* VSRI */ case 5: /* VSHL, VSLI */ switch (size) { case 0: gen_helper_neon_shl_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_shl_u16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_shl_u32(tmp, tmp, tmp2); break; default: abort(); } break; case 6: /* VQSHLU */ switch (size) { case 0: gen_helper_neon_qshlu_s8(tmp, cpu_env, tmp, tmp2); break; case 1: gen_helper_neon_qshlu_s16(tmp, cpu_env, tmp, tmp2); break; case 2: gen_helper_neon_qshlu_s32(tmp, cpu_env, tmp, tmp2); break; default: abort(); } break; case 7: /* VQSHL */ GEN_NEON_INTEGER_OP_ENV(qshl); break; } tcg_temp_free_i32(tmp2); if (op == 1 || op == 3) { /* Accumulate. */ tmp2 = neon_load_reg(rd, pass); gen_neon_add(size, tmp, tmp2); tcg_temp_free_i32(tmp2); } else if (op == 4 || (op == 5 && u)) { /* Insert */ switch (size) { case 0: if (op == 4) mask = 0xff >> -shift; else mask = (uint8_t)(0xff << shift); mask |= mask << 8; mask |= mask << 16; break; case 1: if (op == 4) mask = 0xffff >> -shift; else mask = (uint16_t)(0xffff << shift); mask |= mask << 16; break; case 2: if (shift < -31 || shift > 31) { mask = 0; } else { if (op == 4) mask = 0xffffffffu >> -shift; else mask = 0xffffffffu << shift; } break; default: abort(); } tmp2 = neon_load_reg(rd, pass); tcg_gen_andi_i32(tmp, tmp, mask); tcg_gen_andi_i32(tmp2, tmp2, ~mask); tcg_gen_or_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); } neon_store_reg(rd, pass, tmp); } } /* for pass */ } else if (op < 10) { /* Shift by immediate and narrow: VSHRN, VRSHRN, VQSHRN, VQRSHRN. */ int input_unsigned = (op == 8) ? !u : u; if (rm & 1) { return 1; } shift = shift - (1 << (size + 3)); size++; if (size == 3) { tmp64 = tcg_const_i64(shift); neon_load_reg64(cpu_V0, rm); neon_load_reg64(cpu_V1, rm + 1); for (pass = 0; pass < 2; pass++) { TCGv_i64 in; if (pass == 0) { in = cpu_V0; } else { in = cpu_V1; } if (q) { if (input_unsigned) { gen_helper_neon_rshl_u64(cpu_V0, in, tmp64); } else { gen_helper_neon_rshl_s64(cpu_V0, in, tmp64); } } else { if (input_unsigned) { gen_helper_neon_shl_u64(cpu_V0, in, tmp64); } else { gen_helper_neon_shl_s64(cpu_V0, in, tmp64); } } tmp = tcg_temp_new_i32(); gen_neon_narrow_op(op == 8, u, size - 1, tmp, cpu_V0); neon_store_reg(rd, pass, tmp); } /* for pass */ tcg_temp_free_i64(tmp64); } else { if (size == 1) { imm = (uint16_t)shift; imm |= imm << 16; } else { /* size == 2 */ imm = (uint32_t)shift; } tmp2 = tcg_const_i32(imm); tmp4 = neon_load_reg(rm + 1, 0); tmp5 = neon_load_reg(rm + 1, 1); for (pass = 0; pass < 2; pass++) { if (pass == 0) { tmp = neon_load_reg(rm, 0); } else { tmp = tmp4; } gen_neon_shift_narrow(size, tmp, tmp2, q, input_unsigned); if (pass == 0) { tmp3 = neon_load_reg(rm, 1); } else { tmp3 = tmp5; } gen_neon_shift_narrow(size, tmp3, tmp2, q, input_unsigned); tcg_gen_concat_i32_i64(cpu_V0, tmp, tmp3); tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp3); tmp = tcg_temp_new_i32(); gen_neon_narrow_op(op == 8, u, size - 1, tmp, cpu_V0); neon_store_reg(rd, pass, tmp); } /* for pass */ tcg_temp_free_i32(tmp2); } } else if (op == 10) { /* VSHLL, VMOVL */ if (q || (rd & 1)) { return 1; } tmp = neon_load_reg(rm, 0); tmp2 = neon_load_reg(rm, 1); for (pass = 0; pass < 2; pass++) { if (pass == 1) tmp = tmp2; gen_neon_widen(cpu_V0, tmp, size, u); if (shift != 0) { /* The shift is less than the width of the source type, so we can just shift the whole register. */ tcg_gen_shli_i64(cpu_V0, cpu_V0, shift); /* Widen the result of shift: we need to clear * the potential overflow bits resulting from * left bits of the narrow input appearing as * right bits of left the neighbour narrow * input. */ if (size < 2 || !u) { uint64_t imm64; if (size == 0) { imm = (0xffu >> (8 - shift)); imm |= imm << 16; } else if (size == 1) { imm = 0xffff >> (16 - shift); } else { /* size == 2 */ imm = 0xffffffff >> (32 - shift); } if (size < 2) { imm64 = imm | (((uint64_t)imm) << 32); } else { imm64 = imm; } tcg_gen_andi_i64(cpu_V0, cpu_V0, ~imm64); } } neon_store_reg64(cpu_V0, rd + pass); } } else if (op >= 14) { /* VCVT fixed-point. */ if (!(insn & (1 << 21)) || (q && ((rd | rm) & 1))) { return 1; } /* We have already masked out the must-be-1 top bit of imm6, * hence this 32-shift where the ARM ARM has 64-imm6. */ shift = 32 - shift; for (pass = 0; pass < (q ? 4 : 2); pass++) { tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, pass)); if (!(op & 1)) { if (u) gen_vfp_ulto(0, shift, 1); else gen_vfp_slto(0, shift, 1); } else { if (u) gen_vfp_toul(0, shift, 1); else gen_vfp_tosl(0, shift, 1); } tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, pass)); } } else { return 1; } } else { /* (insn & 0x00380080) == 0 */ int invert; if (q && (rd & 1)) { return 1; } op = (insn >> 8) & 0xf; /* One register and immediate. */ imm = (u << 7) | ((insn >> 12) & 0x70) | (insn & 0xf); invert = (insn & (1 << 5)) != 0; /* Note that op = 2,3,4,5,6,7,10,11,12,13 imm=0 is UNPREDICTABLE. * We choose to not special-case this and will behave as if a * valid constant encoding of 0 had been given. */ switch (op) { case 0: case 1: /* no-op */ break; case 2: case 3: imm <<= 8; break; case 4: case 5: imm <<= 16; break; case 6: case 7: imm <<= 24; break; case 8: case 9: imm |= imm << 16; break; case 10: case 11: imm = (imm << 8) | (imm << 24); break; case 12: imm = (imm << 8) | 0xff; break; case 13: imm = (imm << 16) | 0xffff; break; case 14: imm |= (imm << 8) | (imm << 16) | (imm << 24); if (invert) imm = ~imm; break; case 15: if (invert) { return 1; } imm = ((imm & 0x80) << 24) | ((imm & 0x3f) << 19) | ((imm & 0x40) ? (0x1f << 25) : (1 << 30)); break; } if (invert) imm = ~imm; for (pass = 0; pass < (q ? 4 : 2); pass++) { if (op & 1 && op < 12) { tmp = neon_load_reg(rd, pass); if (invert) { /* The immediate value has already been inverted, so BIC becomes AND. */ tcg_gen_andi_i32(tmp, tmp, imm); } else { tcg_gen_ori_i32(tmp, tmp, imm); } } else { /* VMOV, VMVN. */ tmp = tcg_temp_new_i32(); if (op == 14 && invert) { int n; uint32_t val; val = 0; for (n = 0; n < 4; n++) { if (imm & (1 << (n + (pass & 1) * 4))) val |= 0xff << (n * 8); } tcg_gen_movi_i32(tmp, val); } else { tcg_gen_movi_i32(tmp, imm); } } neon_store_reg(rd, pass, tmp); } } } else { /* (insn & 0x00800010 == 0x00800000) */ if (size != 3) { op = (insn >> 8) & 0xf; if ((insn & (1 << 6)) == 0) { /* Three registers of different lengths. */ int src1_wide; int src2_wide; int prewiden; /* undefreq: bit 0 : UNDEF if size == 0 * bit 1 : UNDEF if size == 1 * bit 2 : UNDEF if size == 2 * bit 3 : UNDEF if U == 1 * Note that [2:0] set implies 'always UNDEF' */ int undefreq; /* prewiden, src1_wide, src2_wide, undefreq */ static const int neon_3reg_wide[16][4] = { {1, 0, 0, 0}, /* VADDL */ {1, 1, 0, 0}, /* VADDW */ {1, 0, 0, 0}, /* VSUBL */ {1, 1, 0, 0}, /* VSUBW */ {0, 1, 1, 0}, /* VADDHN */ {0, 0, 0, 0}, /* VABAL */ {0, 1, 1, 0}, /* VSUBHN */ {0, 0, 0, 0}, /* VABDL */ {0, 0, 0, 0}, /* VMLAL */ {0, 0, 0, 9}, /* VQDMLAL */ {0, 0, 0, 0}, /* VMLSL */ {0, 0, 0, 9}, /* VQDMLSL */ {0, 0, 0, 0}, /* Integer VMULL */ {0, 0, 0, 1}, /* VQDMULL */ {0, 0, 0, 0xa}, /* Polynomial VMULL */ {0, 0, 0, 7}, /* Reserved: always UNDEF */ }; prewiden = neon_3reg_wide[op][0]; src1_wide = neon_3reg_wide[op][1]; src2_wide = neon_3reg_wide[op][2]; undefreq = neon_3reg_wide[op][3]; if ((undefreq & (1 << size)) || ((undefreq & 8) && u)) { return 1; } if ((src1_wide && (rn & 1)) || (src2_wide && (rm & 1)) || (!src2_wide && (rd & 1))) { return 1; } /* Handle VMULL.P64 (Polynomial 64x64 to 128 bit multiply) * outside the loop below as it only performs a single pass. */ if (op == 14 && size == 2) { TCGv_i64 tcg_rn, tcg_rm, tcg_rd; if (!arm_dc_feature(s, ARM_FEATURE_V8_PMULL)) { return 1; } tcg_rn = tcg_temp_new_i64(); tcg_rm = tcg_temp_new_i64(); tcg_rd = tcg_temp_new_i64(); neon_load_reg64(tcg_rn, rn); neon_load_reg64(tcg_rm, rm); gen_helper_neon_pmull_64_lo(tcg_rd, tcg_rn, tcg_rm); neon_store_reg64(tcg_rd, rd); gen_helper_neon_pmull_64_hi(tcg_rd, tcg_rn, tcg_rm); neon_store_reg64(tcg_rd, rd + 1); tcg_temp_free_i64(tcg_rn); tcg_temp_free_i64(tcg_rm); tcg_temp_free_i64(tcg_rd); return 0; } /* Avoid overlapping operands. Wide source operands are always aligned so will never overlap with wide destinations in problematic ways. */ if (rd == rm && !src2_wide) { tmp = neon_load_reg(rm, 1); neon_store_scratch(2, tmp); } else if (rd == rn && !src1_wide) { tmp = neon_load_reg(rn, 1); neon_store_scratch(2, tmp); } TCGV_UNUSED_I32(tmp3); for (pass = 0; pass < 2; pass++) { if (src1_wide) { neon_load_reg64(cpu_V0, rn + pass); TCGV_UNUSED_I32(tmp); } else { if (pass == 1 && rd == rn) { tmp = neon_load_scratch(2); } else { tmp = neon_load_reg(rn, pass); } if (prewiden) { gen_neon_widen(cpu_V0, tmp, size, u); } } if (src2_wide) { neon_load_reg64(cpu_V1, rm + pass); TCGV_UNUSED_I32(tmp2); } else { if (pass == 1 && rd == rm) { tmp2 = neon_load_scratch(2); } else { tmp2 = neon_load_reg(rm, pass); } if (prewiden) { gen_neon_widen(cpu_V1, tmp2, size, u); } } switch (op) { case 0: case 1: case 4: /* VADDL, VADDW, VADDHN, VRADDHN */ gen_neon_addl(size); break; case 2: case 3: case 6: /* VSUBL, VSUBW, VSUBHN, VRSUBHN */ gen_neon_subl(size); break; case 5: case 7: /* VABAL, VABDL */ switch ((size << 1) | u) { case 0: gen_helper_neon_abdl_s16(cpu_V0, tmp, tmp2); break; case 1: gen_helper_neon_abdl_u16(cpu_V0, tmp, tmp2); break; case 2: gen_helper_neon_abdl_s32(cpu_V0, tmp, tmp2); break; case 3: gen_helper_neon_abdl_u32(cpu_V0, tmp, tmp2); break; case 4: gen_helper_neon_abdl_s64(cpu_V0, tmp, tmp2); break; case 5: gen_helper_neon_abdl_u64(cpu_V0, tmp, tmp2); break; default: abort(); } tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp); break; case 8: case 9: case 10: case 11: case 12: case 13: /* VMLAL, VQDMLAL, VMLSL, VQDMLSL, VMULL, VQDMULL */ gen_neon_mull(cpu_V0, tmp, tmp2, size, u); break; case 14: /* Polynomial VMULL */ gen_helper_neon_mull_p8(cpu_V0, tmp, tmp2); tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp); break; default: /* 15 is RESERVED: caught earlier */ abort(); } if (op == 13) { /* VQDMULL */ gen_neon_addl_saturate(cpu_V0, cpu_V0, size); neon_store_reg64(cpu_V0, rd + pass); } else if (op == 5 || (op >= 8 && op <= 11)) { /* Accumulate. */ neon_load_reg64(cpu_V1, rd + pass); switch (op) { case 10: /* VMLSL */ gen_neon_negl(cpu_V0, size); /* Fall through */ case 5: case 8: /* VABAL, VMLAL */ gen_neon_addl(size); break; case 9: case 11: /* VQDMLAL, VQDMLSL */ gen_neon_addl_saturate(cpu_V0, cpu_V0, size); if (op == 11) { gen_neon_negl(cpu_V0, size); } gen_neon_addl_saturate(cpu_V0, cpu_V1, size); break; default: abort(); } neon_store_reg64(cpu_V0, rd + pass); } else if (op == 4 || op == 6) { /* Narrowing operation. */ tmp = tcg_temp_new_i32(); if (!u) { switch (size) { case 0: gen_helper_neon_narrow_high_u8(tmp, cpu_V0); break; case 1: gen_helper_neon_narrow_high_u16(tmp, cpu_V0); break; case 2: tcg_gen_shri_i64(cpu_V0, cpu_V0, 32); tcg_gen_trunc_i64_i32(tmp, cpu_V0); break; default: abort(); } } else { switch (size) { case 0: gen_helper_neon_narrow_round_high_u8(tmp, cpu_V0); break; case 1: gen_helper_neon_narrow_round_high_u16(tmp, cpu_V0); break; case 2: tcg_gen_addi_i64(cpu_V0, cpu_V0, 1u << 31); tcg_gen_shri_i64(cpu_V0, cpu_V0, 32); tcg_gen_trunc_i64_i32(tmp, cpu_V0); break; default: abort(); } } if (pass == 0) { tmp3 = tmp; } else { neon_store_reg(rd, 0, tmp3); neon_store_reg(rd, 1, tmp); } } else { /* Write back the result. */ neon_store_reg64(cpu_V0, rd + pass); } } } else { /* Two registers and a scalar. NB that for ops of this form * the ARM ARM labels bit 24 as Q, but it is in our variable * 'u', not 'q'. */ if (size == 0) { return 1; } switch (op) { case 1: /* Float VMLA scalar */ case 5: /* Floating point VMLS scalar */ case 9: /* Floating point VMUL scalar */ if (size == 1) { return 1; } /* fall through */ case 0: /* Integer VMLA scalar */ case 4: /* Integer VMLS scalar */ case 8: /* Integer VMUL scalar */ case 12: /* VQDMULH scalar */ case 13: /* VQRDMULH scalar */ if (u && ((rd | rn) & 1)) { return 1; } tmp = neon_get_scalar(size, rm); neon_store_scratch(0, tmp); for (pass = 0; pass < (u ? 4 : 2); pass++) { tmp = neon_load_scratch(0); tmp2 = neon_load_reg(rn, pass); if (op == 12) { if (size == 1) { gen_helper_neon_qdmulh_s16(tmp, cpu_env, tmp, tmp2); } else { gen_helper_neon_qdmulh_s32(tmp, cpu_env, tmp, tmp2); } } else if (op == 13) { if (size == 1) { gen_helper_neon_qrdmulh_s16(tmp, cpu_env, tmp, tmp2); } else { gen_helper_neon_qrdmulh_s32(tmp, cpu_env, tmp, tmp2); } } else if (op & 1) { TCGv_ptr fpstatus = get_fpstatus_ptr(1); gen_helper_vfp_muls(tmp, tmp, tmp2, fpstatus); tcg_temp_free_ptr(fpstatus); } else { switch (size) { case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break; case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break; default: abort(); } } tcg_temp_free_i32(tmp2); if (op < 8) { /* Accumulate. */ tmp2 = neon_load_reg(rd, pass); switch (op) { case 0: gen_neon_add(size, tmp, tmp2); break; case 1: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); gen_helper_vfp_adds(tmp, tmp, tmp2, fpstatus); tcg_temp_free_ptr(fpstatus); break; } case 4: gen_neon_rsb(size, tmp, tmp2); break; case 5: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); gen_helper_vfp_subs(tmp, tmp2, tmp, fpstatus); tcg_temp_free_ptr(fpstatus); break; } default: abort(); } tcg_temp_free_i32(tmp2); } neon_store_reg(rd, pass, tmp); } break; case 3: /* VQDMLAL scalar */ case 7: /* VQDMLSL scalar */ case 11: /* VQDMULL scalar */ if (u == 1) { return 1; } /* fall through */ case 2: /* VMLAL sclar */ case 6: /* VMLSL scalar */ case 10: /* VMULL scalar */ if (rd & 1) { return 1; } tmp2 = neon_get_scalar(size, rm); /* We need a copy of tmp2 because gen_neon_mull * deletes it during pass 0. */ tmp4 = tcg_temp_new_i32(); tcg_gen_mov_i32(tmp4, tmp2); tmp3 = neon_load_reg(rn, 1); for (pass = 0; pass < 2; pass++) { if (pass == 0) { tmp = neon_load_reg(rn, 0); } else { tmp = tmp3; tmp2 = tmp4; } gen_neon_mull(cpu_V0, tmp, tmp2, size, u); if (op != 11) { neon_load_reg64(cpu_V1, rd + pass); } switch (op) { case 6: gen_neon_negl(cpu_V0, size); /* Fall through */ case 2: gen_neon_addl(size); break; case 3: case 7: gen_neon_addl_saturate(cpu_V0, cpu_V0, size); if (op == 7) { gen_neon_negl(cpu_V0, size); } gen_neon_addl_saturate(cpu_V0, cpu_V1, size); break; case 10: /* no-op */ break; case 11: gen_neon_addl_saturate(cpu_V0, cpu_V0, size); break; default: abort(); } neon_store_reg64(cpu_V0, rd + pass); } break; default: /* 14 and 15 are RESERVED */ return 1; } } } else { /* size == 3 */ if (!u) { /* Extract. */ imm = (insn >> 8) & 0xf; if (imm > 7 && !q) return 1; if (q && ((rd | rn | rm) & 1)) { return 1; } if (imm == 0) { neon_load_reg64(cpu_V0, rn); if (q) { neon_load_reg64(cpu_V1, rn + 1); } } else if (imm == 8) { neon_load_reg64(cpu_V0, rn + 1); if (q) { neon_load_reg64(cpu_V1, rm); } } else if (q) { tmp64 = tcg_temp_new_i64(); if (imm < 8) { neon_load_reg64(cpu_V0, rn); neon_load_reg64(tmp64, rn + 1); } else { neon_load_reg64(cpu_V0, rn + 1); neon_load_reg64(tmp64, rm); } tcg_gen_shri_i64(cpu_V0, cpu_V0, (imm & 7) * 8); tcg_gen_shli_i64(cpu_V1, tmp64, 64 - ((imm & 7) * 8)); tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1); if (imm < 8) { neon_load_reg64(cpu_V1, rm); } else { neon_load_reg64(cpu_V1, rm + 1); imm -= 8; } tcg_gen_shli_i64(cpu_V1, cpu_V1, 64 - (imm * 8)); tcg_gen_shri_i64(tmp64, tmp64, imm * 8); tcg_gen_or_i64(cpu_V1, cpu_V1, tmp64); tcg_temp_free_i64(tmp64); } else { /* BUGFIX */ neon_load_reg64(cpu_V0, rn); tcg_gen_shri_i64(cpu_V0, cpu_V0, imm * 8); neon_load_reg64(cpu_V1, rm); tcg_gen_shli_i64(cpu_V1, cpu_V1, 64 - (imm * 8)); tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1); } neon_store_reg64(cpu_V0, rd); if (q) { neon_store_reg64(cpu_V1, rd + 1); } } else if ((insn & (1 << 11)) == 0) { /* Two register misc. */ op = ((insn >> 12) & 0x30) | ((insn >> 7) & 0xf); size = (insn >> 18) & 3; /* UNDEF for unknown op values and bad op-size combinations */ if ((neon_2rm_sizes[op] & (1 << size)) == 0) { return 1; } if ((op != NEON_2RM_VMOVN && op != NEON_2RM_VQMOVN) && q && ((rm | rd) & 1)) { return 1; } switch (op) { case NEON_2RM_VREV64: for (pass = 0; pass < (q ? 2 : 1); pass++) { tmp = neon_load_reg(rm, pass * 2); tmp2 = neon_load_reg(rm, pass * 2 + 1); switch (size) { case 0: tcg_gen_bswap32_i32(tmp, tmp); break; case 1: gen_swap_half(tmp); break; case 2: /* no-op */ break; default: abort(); } neon_store_reg(rd, pass * 2 + 1, tmp); if (size == 2) { neon_store_reg(rd, pass * 2, tmp2); } else { switch (size) { case 0: tcg_gen_bswap32_i32(tmp2, tmp2); break; case 1: gen_swap_half(tmp2); break; default: abort(); } neon_store_reg(rd, pass * 2, tmp2); } } break; case NEON_2RM_VPADDL: case NEON_2RM_VPADDL_U: case NEON_2RM_VPADAL: case NEON_2RM_VPADAL_U: for (pass = 0; pass < q + 1; pass++) { tmp = neon_load_reg(rm, pass * 2); gen_neon_widen(cpu_V0, tmp, size, op & 1); tmp = neon_load_reg(rm, pass * 2 + 1); gen_neon_widen(cpu_V1, tmp, size, op & 1); switch (size) { case 0: gen_helper_neon_paddl_u16(CPU_V001); break; case 1: gen_helper_neon_paddl_u32(CPU_V001); break; case 2: tcg_gen_add_i64(CPU_V001); break; default: abort(); } if (op >= NEON_2RM_VPADAL) { /* Accumulate. */ neon_load_reg64(cpu_V1, rd + pass); gen_neon_addl(size); } neon_store_reg64(cpu_V0, rd + pass); } break; case NEON_2RM_VTRN: if (size == 2) { int n; for (n = 0; n < (q ? 4 : 2); n += 2) { tmp = neon_load_reg(rm, n); tmp2 = neon_load_reg(rd, n + 1); neon_store_reg(rm, n, tmp2); neon_store_reg(rd, n + 1, tmp); } } else { goto elementwise; } break; case NEON_2RM_VUZP: if (gen_neon_unzip(rd, rm, size, q)) { return 1; } break; case NEON_2RM_VZIP: if (gen_neon_zip(rd, rm, size, q)) { return 1; } break; case NEON_2RM_VMOVN: case NEON_2RM_VQMOVN: /* also VQMOVUN; op field and mnemonics don't line up */ if (rm & 1) { return 1; } TCGV_UNUSED_I32(tmp2); for (pass = 0; pass < 2; pass++) { neon_load_reg64(cpu_V0, rm + pass); tmp = tcg_temp_new_i32(); gen_neon_narrow_op(op == NEON_2RM_VMOVN, q, size, tmp, cpu_V0); if (pass == 0) { tmp2 = tmp; } else { neon_store_reg(rd, 0, tmp2); neon_store_reg(rd, 1, tmp); } } break; case NEON_2RM_VSHLL: if (q || (rd & 1)) { return 1; } tmp = neon_load_reg(rm, 0); tmp2 = neon_load_reg(rm, 1); for (pass = 0; pass < 2; pass++) { if (pass == 1) tmp = tmp2; gen_neon_widen(cpu_V0, tmp, size, 1); tcg_gen_shli_i64(cpu_V0, cpu_V0, 8 << size); neon_store_reg64(cpu_V0, rd + pass); } break; case NEON_2RM_VCVT_F16_F32: if (!arm_dc_feature(s, ARM_FEATURE_VFP_FP16) || q || (rm & 1)) { return 1; } tmp = tcg_temp_new_i32(); tmp2 = tcg_temp_new_i32(); tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 0)); gen_helper_neon_fcvt_f32_to_f16(tmp, cpu_F0s, cpu_env); tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 1)); gen_helper_neon_fcvt_f32_to_f16(tmp2, cpu_F0s, cpu_env); tcg_gen_shli_i32(tmp2, tmp2, 16); tcg_gen_or_i32(tmp2, tmp2, tmp); tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 2)); gen_helper_neon_fcvt_f32_to_f16(tmp, cpu_F0s, cpu_env); tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 3)); neon_store_reg(rd, 0, tmp2); tmp2 = tcg_temp_new_i32(); gen_helper_neon_fcvt_f32_to_f16(tmp2, cpu_F0s, cpu_env); tcg_gen_shli_i32(tmp2, tmp2, 16); tcg_gen_or_i32(tmp2, tmp2, tmp); neon_store_reg(rd, 1, tmp2); tcg_temp_free_i32(tmp); break; case NEON_2RM_VCVT_F32_F16: if (!arm_dc_feature(s, ARM_FEATURE_VFP_FP16) || q || (rd & 1)) { return 1; } tmp3 = tcg_temp_new_i32(); tmp = neon_load_reg(rm, 0); tmp2 = neon_load_reg(rm, 1); tcg_gen_ext16u_i32(tmp3, tmp); gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env); tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 0)); tcg_gen_shri_i32(tmp3, tmp, 16); gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env); tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 1)); tcg_temp_free_i32(tmp); tcg_gen_ext16u_i32(tmp3, tmp2); gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env); tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 2)); tcg_gen_shri_i32(tmp3, tmp2, 16); gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env); tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 3)); tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp3); break; case NEON_2RM_AESE: case NEON_2RM_AESMC: if (!arm_dc_feature(s, ARM_FEATURE_V8_AES) || ((rm | rd) & 1)) { return 1; } tmp = tcg_const_i32(rd); tmp2 = tcg_const_i32(rm); /* Bit 6 is the lowest opcode bit; it distinguishes between * encryption (AESE/AESMC) and decryption (AESD/AESIMC) */ tmp3 = tcg_const_i32(extract32(insn, 6, 1)); if (op == NEON_2RM_AESE) { gen_helper_crypto_aese(cpu_env, tmp, tmp2, tmp3); } else { gen_helper_crypto_aesmc(cpu_env, tmp, tmp2, tmp3); } tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp3); break; case NEON_2RM_SHA1H: if (!arm_dc_feature(s, ARM_FEATURE_V8_SHA1) || ((rm | rd) & 1)) { return 1; } tmp = tcg_const_i32(rd); tmp2 = tcg_const_i32(rm); gen_helper_crypto_sha1h(cpu_env, tmp, tmp2); tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); break; case NEON_2RM_SHA1SU1: if ((rm | rd) & 1) { return 1; } /* bit 6 (q): set -> SHA256SU0, cleared -> SHA1SU1 */ if (q) { if (!arm_dc_feature(s, ARM_FEATURE_V8_SHA256)) { return 1; } } else if (!arm_dc_feature(s, ARM_FEATURE_V8_SHA1)) { return 1; } tmp = tcg_const_i32(rd); tmp2 = tcg_const_i32(rm); if (q) { gen_helper_crypto_sha256su0(cpu_env, tmp, tmp2); } else { gen_helper_crypto_sha1su1(cpu_env, tmp, tmp2); } tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); break; default: elementwise: for (pass = 0; pass < (q ? 4 : 2); pass++) { if (neon_2rm_is_float_op(op)) { tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, pass)); TCGV_UNUSED_I32(tmp); } else { tmp = neon_load_reg(rm, pass); } switch (op) { case NEON_2RM_VREV32: switch (size) { case 0: tcg_gen_bswap32_i32(tmp, tmp); break; case 1: gen_swap_half(tmp); break; default: abort(); } break; case NEON_2RM_VREV16: gen_rev16(tmp); break; case NEON_2RM_VCLS: switch (size) { case 0: gen_helper_neon_cls_s8(tmp, tmp); break; case 1: gen_helper_neon_cls_s16(tmp, tmp); break; case 2: gen_helper_neon_cls_s32(tmp, tmp); break; default: abort(); } break; case NEON_2RM_VCLZ: switch (size) { case 0: gen_helper_neon_clz_u8(tmp, tmp); break; case 1: gen_helper_neon_clz_u16(tmp, tmp); break; case 2: gen_helper_clz(tmp, tmp); break; default: abort(); } break; case NEON_2RM_VCNT: gen_helper_neon_cnt_u8(tmp, tmp); break; case NEON_2RM_VMVN: tcg_gen_not_i32(tmp, tmp); break; case NEON_2RM_VQABS: switch (size) { case 0: gen_helper_neon_qabs_s8(tmp, cpu_env, tmp); break; case 1: gen_helper_neon_qabs_s16(tmp, cpu_env, tmp); break; case 2: gen_helper_neon_qabs_s32(tmp, cpu_env, tmp); break; default: abort(); } break; case NEON_2RM_VQNEG: switch (size) { case 0: gen_helper_neon_qneg_s8(tmp, cpu_env, tmp); break; case 1: gen_helper_neon_qneg_s16(tmp, cpu_env, tmp); break; case 2: gen_helper_neon_qneg_s32(tmp, cpu_env, tmp); break; default: abort(); } break; case NEON_2RM_VCGT0: case NEON_2RM_VCLE0: tmp2 = tcg_const_i32(0); switch(size) { case 0: gen_helper_neon_cgt_s8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_cgt_s16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_cgt_s32(tmp, tmp, tmp2); break; default: abort(); } tcg_temp_free_i32(tmp2); if (op == NEON_2RM_VCLE0) { tcg_gen_not_i32(tmp, tmp); } break; case NEON_2RM_VCGE0: case NEON_2RM_VCLT0: tmp2 = tcg_const_i32(0); switch(size) { case 0: gen_helper_neon_cge_s8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_cge_s16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_cge_s32(tmp, tmp, tmp2); break; default: abort(); } tcg_temp_free_i32(tmp2); if (op == NEON_2RM_VCLT0) { tcg_gen_not_i32(tmp, tmp); } break; case NEON_2RM_VCEQ0: tmp2 = tcg_const_i32(0); switch(size) { case 0: gen_helper_neon_ceq_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_ceq_u16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_ceq_u32(tmp, tmp, tmp2); break; default: abort(); } tcg_temp_free_i32(tmp2); break; case NEON_2RM_VABS: switch(size) { case 0: gen_helper_neon_abs_s8(tmp, tmp); break; case 1: gen_helper_neon_abs_s16(tmp, tmp); break; case 2: tcg_gen_abs_i32(tmp, tmp); break; default: abort(); } break; case NEON_2RM_VNEG: tmp2 = tcg_const_i32(0); gen_neon_rsb(size, tmp, tmp2); tcg_temp_free_i32(tmp2); break; case NEON_2RM_VCGT0_F: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); tmp2 = tcg_const_i32(0); gen_helper_neon_cgt_f32(tmp, tmp, tmp2, fpstatus); tcg_temp_free_i32(tmp2); tcg_temp_free_ptr(fpstatus); break; } case NEON_2RM_VCGE0_F: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); tmp2 = tcg_const_i32(0); gen_helper_neon_cge_f32(tmp, tmp, tmp2, fpstatus); tcg_temp_free_i32(tmp2); tcg_temp_free_ptr(fpstatus); break; } case NEON_2RM_VCEQ0_F: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); tmp2 = tcg_const_i32(0); gen_helper_neon_ceq_f32(tmp, tmp, tmp2, fpstatus); tcg_temp_free_i32(tmp2); tcg_temp_free_ptr(fpstatus); break; } case NEON_2RM_VCLE0_F: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); tmp2 = tcg_const_i32(0); gen_helper_neon_cge_f32(tmp, tmp2, tmp, fpstatus); tcg_temp_free_i32(tmp2); tcg_temp_free_ptr(fpstatus); break; } case NEON_2RM_VCLT0_F: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); tmp2 = tcg_const_i32(0); gen_helper_neon_cgt_f32(tmp, tmp2, tmp, fpstatus); tcg_temp_free_i32(tmp2); tcg_temp_free_ptr(fpstatus); break; } case NEON_2RM_VABS_F: gen_vfp_abs(0); break; case NEON_2RM_VNEG_F: gen_vfp_neg(0); break; case NEON_2RM_VSWP: tmp2 = neon_load_reg(rd, pass); neon_store_reg(rm, pass, tmp2); break; case NEON_2RM_VTRN: tmp2 = neon_load_reg(rd, pass); switch (size) { case 0: gen_neon_trn_u8(tmp, tmp2); break; case 1: gen_neon_trn_u16(tmp, tmp2); break; default: abort(); } neon_store_reg(rm, pass, tmp2); break; case NEON_2RM_VRINTN: case NEON_2RM_VRINTA: case NEON_2RM_VRINTM: case NEON_2RM_VRINTP: case NEON_2RM_VRINTZ: { TCGv_i32 tcg_rmode; TCGv_ptr fpstatus = get_fpstatus_ptr(1); int rmode; if (op == NEON_2RM_VRINTZ) { rmode = FPROUNDING_ZERO; } else { rmode = fp_decode_rm[((op & 0x6) >> 1) ^ 1]; } tcg_rmode = tcg_const_i32(arm_rmode_to_sf(rmode)); gen_helper_set_neon_rmode(tcg_rmode, tcg_rmode, cpu_env); gen_helper_rints(cpu_F0s, cpu_F0s, fpstatus); gen_helper_set_neon_rmode(tcg_rmode, tcg_rmode, cpu_env); tcg_temp_free_ptr(fpstatus); tcg_temp_free_i32(tcg_rmode); break; } case NEON_2RM_VRINTX: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); gen_helper_rints_exact(cpu_F0s, cpu_F0s, fpstatus); tcg_temp_free_ptr(fpstatus); break; } case NEON_2RM_VCVTAU: case NEON_2RM_VCVTAS: case NEON_2RM_VCVTNU: case NEON_2RM_VCVTNS: case NEON_2RM_VCVTPU: case NEON_2RM_VCVTPS: case NEON_2RM_VCVTMU: case NEON_2RM_VCVTMS: { bool is_signed = !extract32(insn, 7, 1); TCGv_ptr fpst = get_fpstatus_ptr(1); TCGv_i32 tcg_rmode, tcg_shift; int rmode = fp_decode_rm[extract32(insn, 8, 2)]; tcg_shift = tcg_const_i32(0); tcg_rmode = tcg_const_i32(arm_rmode_to_sf(rmode)); gen_helper_set_neon_rmode(tcg_rmode, tcg_rmode, cpu_env); if (is_signed) { gen_helper_vfp_tosls(cpu_F0s, cpu_F0s, tcg_shift, fpst); } else { gen_helper_vfp_touls(cpu_F0s, cpu_F0s, tcg_shift, fpst); } gen_helper_set_neon_rmode(tcg_rmode, tcg_rmode, cpu_env); tcg_temp_free_i32(tcg_rmode); tcg_temp_free_i32(tcg_shift); tcg_temp_free_ptr(fpst); break; } case NEON_2RM_VRECPE: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); gen_helper_recpe_u32(tmp, tmp, fpstatus); tcg_temp_free_ptr(fpstatus); break; } case NEON_2RM_VRSQRTE: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); gen_helper_rsqrte_u32(tmp, tmp, fpstatus); tcg_temp_free_ptr(fpstatus); break; } case NEON_2RM_VRECPE_F: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); gen_helper_recpe_f32(cpu_F0s, cpu_F0s, fpstatus); tcg_temp_free_ptr(fpstatus); break; } case NEON_2RM_VRSQRTE_F: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); gen_helper_rsqrte_f32(cpu_F0s, cpu_F0s, fpstatus); tcg_temp_free_ptr(fpstatus); break; } case NEON_2RM_VCVT_FS: /* VCVT.F32.S32 */ gen_vfp_sito(0, 1); break; case NEON_2RM_VCVT_FU: /* VCVT.F32.U32 */ gen_vfp_uito(0, 1); break; case NEON_2RM_VCVT_SF: /* VCVT.S32.F32 */ gen_vfp_tosiz(0, 1); break; case NEON_2RM_VCVT_UF: /* VCVT.U32.F32 */ gen_vfp_touiz(0, 1); break; default: /* Reserved op values were caught by the * neon_2rm_sizes[] check earlier. */ abort(); } if (neon_2rm_is_float_op(op)) { tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, pass)); } else { neon_store_reg(rd, pass, tmp); } } break; } } else if ((insn & (1 << 10)) == 0) { /* VTBL, VTBX. */ int n = ((insn >> 8) & 3) + 1; if ((rn + n) > 32) { /* This is UNPREDICTABLE; we choose to UNDEF to avoid the * helper function running off the end of the register file. */ return 1; } n <<= 3; if (insn & (1 << 6)) { tmp = neon_load_reg(rd, 0); } else { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, 0); } tmp2 = neon_load_reg(rm, 0); tmp4 = tcg_const_i32(rn); tmp5 = tcg_const_i32(n); gen_helper_neon_tbl(tmp2, cpu_env, tmp2, tmp, tmp4, tmp5); tcg_temp_free_i32(tmp); if (insn & (1 << 6)) { tmp = neon_load_reg(rd, 1); } else { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, 0); } tmp3 = neon_load_reg(rm, 1); gen_helper_neon_tbl(tmp3, cpu_env, tmp3, tmp, tmp4, tmp5); tcg_temp_free_i32(tmp5); tcg_temp_free_i32(tmp4); neon_store_reg(rd, 0, tmp2); neon_store_reg(rd, 1, tmp3); tcg_temp_free_i32(tmp); } else if ((insn & 0x380) == 0) { /* VDUP */ if ((insn & (7 << 16)) == 0 || (q && (rd & 1))) { return 1; } if (insn & (1 << 19)) { tmp = neon_load_reg(rm, 1); } else { tmp = neon_load_reg(rm, 0); } if (insn & (1 << 16)) { gen_neon_dup_u8(tmp, ((insn >> 17) & 3) * 8); } else if (insn & (1 << 17)) { if ((insn >> 18) & 1) gen_neon_dup_high16(tmp); else gen_neon_dup_low16(tmp); } for (pass = 0; pass < (q ? 4 : 2); pass++) { tmp2 = tcg_temp_new_i32(); tcg_gen_mov_i32(tmp2, tmp); neon_store_reg(rd, pass, tmp2); } tcg_temp_free_i32(tmp); } else { return 1; } } } return 0; }
false
qemu
9dbbc748d671c70599101836cd1c2719d92f3017
static int disas_neon_data_insn(DisasContext *s, uint32_t insn) { int op; int q; int rd, rn, rm; int size; int shift; int pass; int count; int pairwise; int u; uint32_t imm, mask; TCGv_i32 tmp, tmp2, tmp3, tmp4, tmp5; TCGv_i64 tmp64; if (!s->cpacr_fpen) { gen_exception_insn(s, 4, EXCP_UDEF, syn_fp_access_trap(1, 0xe, s->thumb), default_exception_el(s)); return 0; } if (!s->vfp_enabled) return 1; q = (insn & (1 << 6)) != 0; u = (insn >> 24) & 1; VFP_DREG_D(rd, insn); VFP_DREG_N(rn, insn); VFP_DREG_M(rm, insn); size = (insn >> 20) & 3; if ((insn & (1 << 23)) == 0) { op = ((insn >> 7) & 0x1e) | ((insn >> 4) & 1); if ((neon_3r_sizes[op] & (1 << size)) == 0) { return 1; } if (q && ((rd | rn | rm) & 1)) { return 1; } if (op == NEON_3R_SHA) { if (!q) { return 1; } if (!u) { if (!arm_dc_feature(s, ARM_FEATURE_V8_SHA1)) { return 1; } tmp = tcg_const_i32(rd); tmp2 = tcg_const_i32(rn); tmp3 = tcg_const_i32(rm); tmp4 = tcg_const_i32(size); gen_helper_crypto_sha1_3reg(cpu_env, tmp, tmp2, tmp3, tmp4); tcg_temp_free_i32(tmp4); } else { if (!arm_dc_feature(s, ARM_FEATURE_V8_SHA256) || size == 3) { return 1; } tmp = tcg_const_i32(rd); tmp2 = tcg_const_i32(rn); tmp3 = tcg_const_i32(rm); switch (size) { case 0: gen_helper_crypto_sha256h(cpu_env, tmp, tmp2, tmp3); break; case 1: gen_helper_crypto_sha256h2(cpu_env, tmp, tmp2, tmp3); break; case 2: gen_helper_crypto_sha256su1(cpu_env, tmp, tmp2, tmp3); break; } } tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp3); return 0; } if (size == 3 && op != NEON_3R_LOGIC) { for (pass = 0; pass < (q ? 2 : 1); pass++) { neon_load_reg64(cpu_V0, rn + pass); neon_load_reg64(cpu_V1, rm + pass); switch (op) { case NEON_3R_VQADD: if (u) { gen_helper_neon_qadd_u64(cpu_V0, cpu_env, cpu_V0, cpu_V1); } else { gen_helper_neon_qadd_s64(cpu_V0, cpu_env, cpu_V0, cpu_V1); } break; case NEON_3R_VQSUB: if (u) { gen_helper_neon_qsub_u64(cpu_V0, cpu_env, cpu_V0, cpu_V1); } else { gen_helper_neon_qsub_s64(cpu_V0, cpu_env, cpu_V0, cpu_V1); } break; case NEON_3R_VSHL: if (u) { gen_helper_neon_shl_u64(cpu_V0, cpu_V1, cpu_V0); } else { gen_helper_neon_shl_s64(cpu_V0, cpu_V1, cpu_V0); } break; case NEON_3R_VQSHL: if (u) { gen_helper_neon_qshl_u64(cpu_V0, cpu_env, cpu_V1, cpu_V0); } else { gen_helper_neon_qshl_s64(cpu_V0, cpu_env, cpu_V1, cpu_V0); } break; case NEON_3R_VRSHL: if (u) { gen_helper_neon_rshl_u64(cpu_V0, cpu_V1, cpu_V0); } else { gen_helper_neon_rshl_s64(cpu_V0, cpu_V1, cpu_V0); } break; case NEON_3R_VQRSHL: if (u) { gen_helper_neon_qrshl_u64(cpu_V0, cpu_env, cpu_V1, cpu_V0); } else { gen_helper_neon_qrshl_s64(cpu_V0, cpu_env, cpu_V1, cpu_V0); } break; case NEON_3R_VADD_VSUB: if (u) { tcg_gen_sub_i64(CPU_V001); } else { tcg_gen_add_i64(CPU_V001); } break; default: abort(); } neon_store_reg64(cpu_V0, rd + pass); } return 0; } pairwise = 0; switch (op) { case NEON_3R_VSHL: case NEON_3R_VQSHL: case NEON_3R_VRSHL: case NEON_3R_VQRSHL: { int rtmp; rtmp = rn; rn = rm; rm = rtmp; } break; case NEON_3R_VPADD: if (u) { return 1; } case NEON_3R_VPMAX: case NEON_3R_VPMIN: pairwise = 1; break; case NEON_3R_FLOAT_ARITH: pairwise = (u && size < 2); break; case NEON_3R_FLOAT_MINMAX: pairwise = u; break; case NEON_3R_FLOAT_CMP: if (!u && size) { return 1; } break; case NEON_3R_FLOAT_ACMP: if (!u) { return 1; } break; case NEON_3R_FLOAT_MISC: if (u && !arm_dc_feature(s, ARM_FEATURE_V8)) { return 1; } break; case NEON_3R_VMUL: if (u && (size != 0)) { return 1; } break; case NEON_3R_VFM: if (!arm_dc_feature(s, ARM_FEATURE_VFP4) || u) { return 1; } break; default: break; } if (pairwise && q) { return 1; } for (pass = 0; pass < (q ? 4 : 2); pass++) { if (pairwise) { if (pass < 1) { tmp = neon_load_reg(rn, 0); tmp2 = neon_load_reg(rn, 1); } else { tmp = neon_load_reg(rm, 0); tmp2 = neon_load_reg(rm, 1); } } else { tmp = neon_load_reg(rn, pass); tmp2 = neon_load_reg(rm, pass); } switch (op) { case NEON_3R_VHADD: GEN_NEON_INTEGER_OP(hadd); break; case NEON_3R_VQADD: GEN_NEON_INTEGER_OP_ENV(qadd); break; case NEON_3R_VRHADD: GEN_NEON_INTEGER_OP(rhadd); break; case NEON_3R_LOGIC: switch ((u << 2) | size) { case 0: tcg_gen_and_i32(tmp, tmp, tmp2); break; case 1: tcg_gen_andc_i32(tmp, tmp, tmp2); break; case 2: tcg_gen_or_i32(tmp, tmp, tmp2); break; case 3: tcg_gen_orc_i32(tmp, tmp, tmp2); break; case 4: tcg_gen_xor_i32(tmp, tmp, tmp2); break; case 5: tmp3 = neon_load_reg(rd, pass); gen_neon_bsl(tmp, tmp, tmp2, tmp3); tcg_temp_free_i32(tmp3); break; case 6: tmp3 = neon_load_reg(rd, pass); gen_neon_bsl(tmp, tmp, tmp3, tmp2); tcg_temp_free_i32(tmp3); break; case 7: tmp3 = neon_load_reg(rd, pass); gen_neon_bsl(tmp, tmp3, tmp, tmp2); tcg_temp_free_i32(tmp3); break; } break; case NEON_3R_VHSUB: GEN_NEON_INTEGER_OP(hsub); break; case NEON_3R_VQSUB: GEN_NEON_INTEGER_OP_ENV(qsub); break; case NEON_3R_VCGT: GEN_NEON_INTEGER_OP(cgt); break; case NEON_3R_VCGE: GEN_NEON_INTEGER_OP(cge); break; case NEON_3R_VSHL: GEN_NEON_INTEGER_OP(shl); break; case NEON_3R_VQSHL: GEN_NEON_INTEGER_OP_ENV(qshl); break; case NEON_3R_VRSHL: GEN_NEON_INTEGER_OP(rshl); break; case NEON_3R_VQRSHL: GEN_NEON_INTEGER_OP_ENV(qrshl); break; case NEON_3R_VMAX: GEN_NEON_INTEGER_OP(max); break; case NEON_3R_VMIN: GEN_NEON_INTEGER_OP(min); break; case NEON_3R_VABD: GEN_NEON_INTEGER_OP(abd); break; case NEON_3R_VABA: GEN_NEON_INTEGER_OP(abd); tcg_temp_free_i32(tmp2); tmp2 = neon_load_reg(rd, pass); gen_neon_add(size, tmp, tmp2); break; case NEON_3R_VADD_VSUB: if (!u) { gen_neon_add(size, tmp, tmp2); } else { switch (size) { case 0: gen_helper_neon_sub_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_sub_u16(tmp, tmp, tmp2); break; case 2: tcg_gen_sub_i32(tmp, tmp, tmp2); break; default: abort(); } } break; case NEON_3R_VTST_VCEQ: if (!u) { switch (size) { case 0: gen_helper_neon_tst_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_tst_u16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_tst_u32(tmp, tmp, tmp2); break; default: abort(); } } else { switch (size) { case 0: gen_helper_neon_ceq_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_ceq_u16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_ceq_u32(tmp, tmp, tmp2); break; default: abort(); } } break; case NEON_3R_VML: switch (size) { case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break; case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break; default: abort(); } tcg_temp_free_i32(tmp2); tmp2 = neon_load_reg(rd, pass); if (u) { gen_neon_rsb(size, tmp, tmp2); } else { gen_neon_add(size, tmp, tmp2); } break; case NEON_3R_VMUL: if (u) { gen_helper_neon_mul_p8(tmp, tmp, tmp2); } else { switch (size) { case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break; case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break; default: abort(); } } break; case NEON_3R_VPMAX: GEN_NEON_INTEGER_OP(pmax); break; case NEON_3R_VPMIN: GEN_NEON_INTEGER_OP(pmin); break; case NEON_3R_VQDMULH_VQRDMULH: if (!u) { switch (size) { case 1: gen_helper_neon_qdmulh_s16(tmp, cpu_env, tmp, tmp2); break; case 2: gen_helper_neon_qdmulh_s32(tmp, cpu_env, tmp, tmp2); break; default: abort(); } } else { switch (size) { case 1: gen_helper_neon_qrdmulh_s16(tmp, cpu_env, tmp, tmp2); break; case 2: gen_helper_neon_qrdmulh_s32(tmp, cpu_env, tmp, tmp2); break; default: abort(); } } break; case NEON_3R_VPADD: switch (size) { case 0: gen_helper_neon_padd_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_padd_u16(tmp, tmp, tmp2); break; case 2: tcg_gen_add_i32(tmp, tmp, tmp2); break; default: abort(); } break; case NEON_3R_FLOAT_ARITH: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); switch ((u << 2) | size) { case 0: case 4: gen_helper_vfp_adds(tmp, tmp, tmp2, fpstatus); break; case 2: gen_helper_vfp_subs(tmp, tmp, tmp2, fpstatus); break; case 6: gen_helper_neon_abd_f32(tmp, tmp, tmp2, fpstatus); break; default: abort(); } tcg_temp_free_ptr(fpstatus); break; } case NEON_3R_FLOAT_MULTIPLY: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); gen_helper_vfp_muls(tmp, tmp, tmp2, fpstatus); if (!u) { tcg_temp_free_i32(tmp2); tmp2 = neon_load_reg(rd, pass); if (size == 0) { gen_helper_vfp_adds(tmp, tmp, tmp2, fpstatus); } else { gen_helper_vfp_subs(tmp, tmp2, tmp, fpstatus); } } tcg_temp_free_ptr(fpstatus); break; } case NEON_3R_FLOAT_CMP: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); if (!u) { gen_helper_neon_ceq_f32(tmp, tmp, tmp2, fpstatus); } else { if (size == 0) { gen_helper_neon_cge_f32(tmp, tmp, tmp2, fpstatus); } else { gen_helper_neon_cgt_f32(tmp, tmp, tmp2, fpstatus); } } tcg_temp_free_ptr(fpstatus); break; } case NEON_3R_FLOAT_ACMP: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); if (size == 0) { gen_helper_neon_acge_f32(tmp, tmp, tmp2, fpstatus); } else { gen_helper_neon_acgt_f32(tmp, tmp, tmp2, fpstatus); } tcg_temp_free_ptr(fpstatus); break; } case NEON_3R_FLOAT_MINMAX: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); if (size == 0) { gen_helper_vfp_maxs(tmp, tmp, tmp2, fpstatus); } else { gen_helper_vfp_mins(tmp, tmp, tmp2, fpstatus); } tcg_temp_free_ptr(fpstatus); break; } case NEON_3R_FLOAT_MISC: if (u) { TCGv_ptr fpstatus = get_fpstatus_ptr(1); if (size == 0) { gen_helper_vfp_maxnums(tmp, tmp, tmp2, fpstatus); } else { gen_helper_vfp_minnums(tmp, tmp, tmp2, fpstatus); } tcg_temp_free_ptr(fpstatus); } else { if (size == 0) { gen_helper_recps_f32(tmp, tmp, tmp2, cpu_env); } else { gen_helper_rsqrts_f32(tmp, tmp, tmp2, cpu_env); } } break; case NEON_3R_VFM: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); TCGv_i32 tmp3 = neon_load_reg(rd, pass); if (size) { gen_helper_vfp_negs(tmp, tmp); } gen_helper_vfp_muladds(tmp, tmp, tmp2, tmp3, fpstatus); tcg_temp_free_i32(tmp3); tcg_temp_free_ptr(fpstatus); break; } default: abort(); } tcg_temp_free_i32(tmp2); if (pairwise && rd == rm) { neon_store_scratch(pass, tmp); } else { neon_store_reg(rd, pass, tmp); } } if (pairwise && rd == rm) { for (pass = 0; pass < (q ? 4 : 2); pass++) { tmp = neon_load_scratch(pass); neon_store_reg(rd, pass, tmp); } } } else if (insn & (1 << 4)) { if ((insn & 0x00380080) != 0) { op = (insn >> 8) & 0xf; if (insn & (1 << 7)) { if (op > 7) { return 1; } size = 3; } else { size = 2; while ((insn & (1 << (size + 19))) == 0) size--; } shift = (insn >> 16) & ((1 << (3 + size)) - 1); if (op < 8) { if (q && ((rd | rm) & 1)) { return 1; } if (!u && (op == 4 || op == 6)) { return 1; } if (op <= 4) shift = shift - (1 << (size + 3)); if (size == 3) { count = q + 1; } else { count = q ? 4: 2; } switch (size) { case 0: imm = (uint8_t) shift; imm |= imm << 8; imm |= imm << 16; break; case 1: imm = (uint16_t) shift; imm |= imm << 16; break; case 2: case 3: imm = shift; break; default: abort(); } for (pass = 0; pass < count; pass++) { if (size == 3) { neon_load_reg64(cpu_V0, rm + pass); tcg_gen_movi_i64(cpu_V1, imm); switch (op) { case 0: case 1: if (u) gen_helper_neon_shl_u64(cpu_V0, cpu_V0, cpu_V1); else gen_helper_neon_shl_s64(cpu_V0, cpu_V0, cpu_V1); break; case 2: case 3: if (u) gen_helper_neon_rshl_u64(cpu_V0, cpu_V0, cpu_V1); else gen_helper_neon_rshl_s64(cpu_V0, cpu_V0, cpu_V1); break; case 4: case 5: gen_helper_neon_shl_u64(cpu_V0, cpu_V0, cpu_V1); break; case 6: gen_helper_neon_qshlu_s64(cpu_V0, cpu_env, cpu_V0, cpu_V1); break; case 7: if (u) { gen_helper_neon_qshl_u64(cpu_V0, cpu_env, cpu_V0, cpu_V1); } else { gen_helper_neon_qshl_s64(cpu_V0, cpu_env, cpu_V0, cpu_V1); } break; } if (op == 1 || op == 3) { neon_load_reg64(cpu_V1, rd + pass); tcg_gen_add_i64(cpu_V0, cpu_V0, cpu_V1); } else if (op == 4 || (op == 5 && u)) { neon_load_reg64(cpu_V1, rd + pass); uint64_t mask; if (shift < -63 || shift > 63) { mask = 0; } else { if (op == 4) { mask = 0xffffffffffffffffull >> -shift; } else { mask = 0xffffffffffffffffull << shift; } } tcg_gen_andi_i64(cpu_V1, cpu_V1, ~mask); tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1); } neon_store_reg64(cpu_V0, rd + pass); } else { tmp = neon_load_reg(rm, pass); tmp2 = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp2, imm); switch (op) { case 0: case 1: GEN_NEON_INTEGER_OP(shl); break; case 2: case 3: GEN_NEON_INTEGER_OP(rshl); break; case 4: case 5: switch (size) { case 0: gen_helper_neon_shl_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_shl_u16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_shl_u32(tmp, tmp, tmp2); break; default: abort(); } break; case 6: switch (size) { case 0: gen_helper_neon_qshlu_s8(tmp, cpu_env, tmp, tmp2); break; case 1: gen_helper_neon_qshlu_s16(tmp, cpu_env, tmp, tmp2); break; case 2: gen_helper_neon_qshlu_s32(tmp, cpu_env, tmp, tmp2); break; default: abort(); } break; case 7: GEN_NEON_INTEGER_OP_ENV(qshl); break; } tcg_temp_free_i32(tmp2); if (op == 1 || op == 3) { tmp2 = neon_load_reg(rd, pass); gen_neon_add(size, tmp, tmp2); tcg_temp_free_i32(tmp2); } else if (op == 4 || (op == 5 && u)) { switch (size) { case 0: if (op == 4) mask = 0xff >> -shift; else mask = (uint8_t)(0xff << shift); mask |= mask << 8; mask |= mask << 16; break; case 1: if (op == 4) mask = 0xffff >> -shift; else mask = (uint16_t)(0xffff << shift); mask |= mask << 16; break; case 2: if (shift < -31 || shift > 31) { mask = 0; } else { if (op == 4) mask = 0xffffffffu >> -shift; else mask = 0xffffffffu << shift; } break; default: abort(); } tmp2 = neon_load_reg(rd, pass); tcg_gen_andi_i32(tmp, tmp, mask); tcg_gen_andi_i32(tmp2, tmp2, ~mask); tcg_gen_or_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); } neon_store_reg(rd, pass, tmp); } } } else if (op < 10) { int input_unsigned = (op == 8) ? !u : u; if (rm & 1) { return 1; } shift = shift - (1 << (size + 3)); size++; if (size == 3) { tmp64 = tcg_const_i64(shift); neon_load_reg64(cpu_V0, rm); neon_load_reg64(cpu_V1, rm + 1); for (pass = 0; pass < 2; pass++) { TCGv_i64 in; if (pass == 0) { in = cpu_V0; } else { in = cpu_V1; } if (q) { if (input_unsigned) { gen_helper_neon_rshl_u64(cpu_V0, in, tmp64); } else { gen_helper_neon_rshl_s64(cpu_V0, in, tmp64); } } else { if (input_unsigned) { gen_helper_neon_shl_u64(cpu_V0, in, tmp64); } else { gen_helper_neon_shl_s64(cpu_V0, in, tmp64); } } tmp = tcg_temp_new_i32(); gen_neon_narrow_op(op == 8, u, size - 1, tmp, cpu_V0); neon_store_reg(rd, pass, tmp); } tcg_temp_free_i64(tmp64); } else { if (size == 1) { imm = (uint16_t)shift; imm |= imm << 16; } else { imm = (uint32_t)shift; } tmp2 = tcg_const_i32(imm); tmp4 = neon_load_reg(rm + 1, 0); tmp5 = neon_load_reg(rm + 1, 1); for (pass = 0; pass < 2; pass++) { if (pass == 0) { tmp = neon_load_reg(rm, 0); } else { tmp = tmp4; } gen_neon_shift_narrow(size, tmp, tmp2, q, input_unsigned); if (pass == 0) { tmp3 = neon_load_reg(rm, 1); } else { tmp3 = tmp5; } gen_neon_shift_narrow(size, tmp3, tmp2, q, input_unsigned); tcg_gen_concat_i32_i64(cpu_V0, tmp, tmp3); tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp3); tmp = tcg_temp_new_i32(); gen_neon_narrow_op(op == 8, u, size - 1, tmp, cpu_V0); neon_store_reg(rd, pass, tmp); } tcg_temp_free_i32(tmp2); } } else if (op == 10) { if (q || (rd & 1)) { return 1; } tmp = neon_load_reg(rm, 0); tmp2 = neon_load_reg(rm, 1); for (pass = 0; pass < 2; pass++) { if (pass == 1) tmp = tmp2; gen_neon_widen(cpu_V0, tmp, size, u); if (shift != 0) { tcg_gen_shli_i64(cpu_V0, cpu_V0, shift); if (size < 2 || !u) { uint64_t imm64; if (size == 0) { imm = (0xffu >> (8 - shift)); imm |= imm << 16; } else if (size == 1) { imm = 0xffff >> (16 - shift); } else { imm = 0xffffffff >> (32 - shift); } if (size < 2) { imm64 = imm | (((uint64_t)imm) << 32); } else { imm64 = imm; } tcg_gen_andi_i64(cpu_V0, cpu_V0, ~imm64); } } neon_store_reg64(cpu_V0, rd + pass); } } else if (op >= 14) { if (!(insn & (1 << 21)) || (q && ((rd | rm) & 1))) { return 1; } shift = 32 - shift; for (pass = 0; pass < (q ? 4 : 2); pass++) { tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, pass)); if (!(op & 1)) { if (u) gen_vfp_ulto(0, shift, 1); else gen_vfp_slto(0, shift, 1); } else { if (u) gen_vfp_toul(0, shift, 1); else gen_vfp_tosl(0, shift, 1); } tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, pass)); } } else { return 1; } } else { int invert; if (q && (rd & 1)) { return 1; } op = (insn >> 8) & 0xf; imm = (u << 7) | ((insn >> 12) & 0x70) | (insn & 0xf); invert = (insn & (1 << 5)) != 0; switch (op) { case 0: case 1: break; case 2: case 3: imm <<= 8; break; case 4: case 5: imm <<= 16; break; case 6: case 7: imm <<= 24; break; case 8: case 9: imm |= imm << 16; break; case 10: case 11: imm = (imm << 8) | (imm << 24); break; case 12: imm = (imm << 8) | 0xff; break; case 13: imm = (imm << 16) | 0xffff; break; case 14: imm |= (imm << 8) | (imm << 16) | (imm << 24); if (invert) imm = ~imm; break; case 15: if (invert) { return 1; } imm = ((imm & 0x80) << 24) | ((imm & 0x3f) << 19) | ((imm & 0x40) ? (0x1f << 25) : (1 << 30)); break; } if (invert) imm = ~imm; for (pass = 0; pass < (q ? 4 : 2); pass++) { if (op & 1 && op < 12) { tmp = neon_load_reg(rd, pass); if (invert) { tcg_gen_andi_i32(tmp, tmp, imm); } else { tcg_gen_ori_i32(tmp, tmp, imm); } } else { tmp = tcg_temp_new_i32(); if (op == 14 && invert) { int n; uint32_t val; val = 0; for (n = 0; n < 4; n++) { if (imm & (1 << (n + (pass & 1) * 4))) val |= 0xff << (n * 8); } tcg_gen_movi_i32(tmp, val); } else { tcg_gen_movi_i32(tmp, imm); } } neon_store_reg(rd, pass, tmp); } } } else { if (size != 3) { op = (insn >> 8) & 0xf; if ((insn & (1 << 6)) == 0) { int src1_wide; int src2_wide; int prewiden; int undefreq; static const int neon_3reg_wide[16][4] = { {1, 0, 0, 0}, {1, 1, 0, 0}, {1, 0, 0, 0}, {1, 1, 0, 0}, {0, 1, 1, 0}, {0, 0, 0, 0}, {0, 1, 1, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 9}, {0, 0, 0, 0}, {0, 0, 0, 9}, {0, 0, 0, 0}, {0, 0, 0, 1}, {0, 0, 0, 0xa}, {0, 0, 0, 7}, }; prewiden = neon_3reg_wide[op][0]; src1_wide = neon_3reg_wide[op][1]; src2_wide = neon_3reg_wide[op][2]; undefreq = neon_3reg_wide[op][3]; if ((undefreq & (1 << size)) || ((undefreq & 8) && u)) { return 1; } if ((src1_wide && (rn & 1)) || (src2_wide && (rm & 1)) || (!src2_wide && (rd & 1))) { return 1; } if (op == 14 && size == 2) { TCGv_i64 tcg_rn, tcg_rm, tcg_rd; if (!arm_dc_feature(s, ARM_FEATURE_V8_PMULL)) { return 1; } tcg_rn = tcg_temp_new_i64(); tcg_rm = tcg_temp_new_i64(); tcg_rd = tcg_temp_new_i64(); neon_load_reg64(tcg_rn, rn); neon_load_reg64(tcg_rm, rm); gen_helper_neon_pmull_64_lo(tcg_rd, tcg_rn, tcg_rm); neon_store_reg64(tcg_rd, rd); gen_helper_neon_pmull_64_hi(tcg_rd, tcg_rn, tcg_rm); neon_store_reg64(tcg_rd, rd + 1); tcg_temp_free_i64(tcg_rn); tcg_temp_free_i64(tcg_rm); tcg_temp_free_i64(tcg_rd); return 0; } if (rd == rm && !src2_wide) { tmp = neon_load_reg(rm, 1); neon_store_scratch(2, tmp); } else if (rd == rn && !src1_wide) { tmp = neon_load_reg(rn, 1); neon_store_scratch(2, tmp); } TCGV_UNUSED_I32(tmp3); for (pass = 0; pass < 2; pass++) { if (src1_wide) { neon_load_reg64(cpu_V0, rn + pass); TCGV_UNUSED_I32(tmp); } else { if (pass == 1 && rd == rn) { tmp = neon_load_scratch(2); } else { tmp = neon_load_reg(rn, pass); } if (prewiden) { gen_neon_widen(cpu_V0, tmp, size, u); } } if (src2_wide) { neon_load_reg64(cpu_V1, rm + pass); TCGV_UNUSED_I32(tmp2); } else { if (pass == 1 && rd == rm) { tmp2 = neon_load_scratch(2); } else { tmp2 = neon_load_reg(rm, pass); } if (prewiden) { gen_neon_widen(cpu_V1, tmp2, size, u); } } switch (op) { case 0: case 1: case 4: gen_neon_addl(size); break; case 2: case 3: case 6: gen_neon_subl(size); break; case 5: case 7: switch ((size << 1) | u) { case 0: gen_helper_neon_abdl_s16(cpu_V0, tmp, tmp2); break; case 1: gen_helper_neon_abdl_u16(cpu_V0, tmp, tmp2); break; case 2: gen_helper_neon_abdl_s32(cpu_V0, tmp, tmp2); break; case 3: gen_helper_neon_abdl_u32(cpu_V0, tmp, tmp2); break; case 4: gen_helper_neon_abdl_s64(cpu_V0, tmp, tmp2); break; case 5: gen_helper_neon_abdl_u64(cpu_V0, tmp, tmp2); break; default: abort(); } tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp); break; case 8: case 9: case 10: case 11: case 12: case 13: gen_neon_mull(cpu_V0, tmp, tmp2, size, u); break; case 14: gen_helper_neon_mull_p8(cpu_V0, tmp, tmp2); tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp); break; default: abort(); } if (op == 13) { gen_neon_addl_saturate(cpu_V0, cpu_V0, size); neon_store_reg64(cpu_V0, rd + pass); } else if (op == 5 || (op >= 8 && op <= 11)) { neon_load_reg64(cpu_V1, rd + pass); switch (op) { case 10: gen_neon_negl(cpu_V0, size); case 5: case 8: gen_neon_addl(size); break; case 9: case 11: gen_neon_addl_saturate(cpu_V0, cpu_V0, size); if (op == 11) { gen_neon_negl(cpu_V0, size); } gen_neon_addl_saturate(cpu_V0, cpu_V1, size); break; default: abort(); } neon_store_reg64(cpu_V0, rd + pass); } else if (op == 4 || op == 6) { tmp = tcg_temp_new_i32(); if (!u) { switch (size) { case 0: gen_helper_neon_narrow_high_u8(tmp, cpu_V0); break; case 1: gen_helper_neon_narrow_high_u16(tmp, cpu_V0); break; case 2: tcg_gen_shri_i64(cpu_V0, cpu_V0, 32); tcg_gen_trunc_i64_i32(tmp, cpu_V0); break; default: abort(); } } else { switch (size) { case 0: gen_helper_neon_narrow_round_high_u8(tmp, cpu_V0); break; case 1: gen_helper_neon_narrow_round_high_u16(tmp, cpu_V0); break; case 2: tcg_gen_addi_i64(cpu_V0, cpu_V0, 1u << 31); tcg_gen_shri_i64(cpu_V0, cpu_V0, 32); tcg_gen_trunc_i64_i32(tmp, cpu_V0); break; default: abort(); } } if (pass == 0) { tmp3 = tmp; } else { neon_store_reg(rd, 0, tmp3); neon_store_reg(rd, 1, tmp); } } else { neon_store_reg64(cpu_V0, rd + pass); } } } else { if (size == 0) { return 1; } switch (op) { case 1: case 5: case 9: if (size == 1) { return 1; } case 0: case 4: case 8: case 12: case 13: if (u && ((rd | rn) & 1)) { return 1; } tmp = neon_get_scalar(size, rm); neon_store_scratch(0, tmp); for (pass = 0; pass < (u ? 4 : 2); pass++) { tmp = neon_load_scratch(0); tmp2 = neon_load_reg(rn, pass); if (op == 12) { if (size == 1) { gen_helper_neon_qdmulh_s16(tmp, cpu_env, tmp, tmp2); } else { gen_helper_neon_qdmulh_s32(tmp, cpu_env, tmp, tmp2); } } else if (op == 13) { if (size == 1) { gen_helper_neon_qrdmulh_s16(tmp, cpu_env, tmp, tmp2); } else { gen_helper_neon_qrdmulh_s32(tmp, cpu_env, tmp, tmp2); } } else if (op & 1) { TCGv_ptr fpstatus = get_fpstatus_ptr(1); gen_helper_vfp_muls(tmp, tmp, tmp2, fpstatus); tcg_temp_free_ptr(fpstatus); } else { switch (size) { case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break; case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break; default: abort(); } } tcg_temp_free_i32(tmp2); if (op < 8) { tmp2 = neon_load_reg(rd, pass); switch (op) { case 0: gen_neon_add(size, tmp, tmp2); break; case 1: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); gen_helper_vfp_adds(tmp, tmp, tmp2, fpstatus); tcg_temp_free_ptr(fpstatus); break; } case 4: gen_neon_rsb(size, tmp, tmp2); break; case 5: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); gen_helper_vfp_subs(tmp, tmp2, tmp, fpstatus); tcg_temp_free_ptr(fpstatus); break; } default: abort(); } tcg_temp_free_i32(tmp2); } neon_store_reg(rd, pass, tmp); } break; case 3: case 7: case 11: if (u == 1) { return 1; } case 2: case 6: case 10: if (rd & 1) { return 1; } tmp2 = neon_get_scalar(size, rm); tmp4 = tcg_temp_new_i32(); tcg_gen_mov_i32(tmp4, tmp2); tmp3 = neon_load_reg(rn, 1); for (pass = 0; pass < 2; pass++) { if (pass == 0) { tmp = neon_load_reg(rn, 0); } else { tmp = tmp3; tmp2 = tmp4; } gen_neon_mull(cpu_V0, tmp, tmp2, size, u); if (op != 11) { neon_load_reg64(cpu_V1, rd + pass); } switch (op) { case 6: gen_neon_negl(cpu_V0, size); case 2: gen_neon_addl(size); break; case 3: case 7: gen_neon_addl_saturate(cpu_V0, cpu_V0, size); if (op == 7) { gen_neon_negl(cpu_V0, size); } gen_neon_addl_saturate(cpu_V0, cpu_V1, size); break; case 10: break; case 11: gen_neon_addl_saturate(cpu_V0, cpu_V0, size); break; default: abort(); } neon_store_reg64(cpu_V0, rd + pass); } break; default: return 1; } } } else { if (!u) { imm = (insn >> 8) & 0xf; if (imm > 7 && !q) return 1; if (q && ((rd | rn | rm) & 1)) { return 1; } if (imm == 0) { neon_load_reg64(cpu_V0, rn); if (q) { neon_load_reg64(cpu_V1, rn + 1); } } else if (imm == 8) { neon_load_reg64(cpu_V0, rn + 1); if (q) { neon_load_reg64(cpu_V1, rm); } } else if (q) { tmp64 = tcg_temp_new_i64(); if (imm < 8) { neon_load_reg64(cpu_V0, rn); neon_load_reg64(tmp64, rn + 1); } else { neon_load_reg64(cpu_V0, rn + 1); neon_load_reg64(tmp64, rm); } tcg_gen_shri_i64(cpu_V0, cpu_V0, (imm & 7) * 8); tcg_gen_shli_i64(cpu_V1, tmp64, 64 - ((imm & 7) * 8)); tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1); if (imm < 8) { neon_load_reg64(cpu_V1, rm); } else { neon_load_reg64(cpu_V1, rm + 1); imm -= 8; } tcg_gen_shli_i64(cpu_V1, cpu_V1, 64 - (imm * 8)); tcg_gen_shri_i64(tmp64, tmp64, imm * 8); tcg_gen_or_i64(cpu_V1, cpu_V1, tmp64); tcg_temp_free_i64(tmp64); } else { neon_load_reg64(cpu_V0, rn); tcg_gen_shri_i64(cpu_V0, cpu_V0, imm * 8); neon_load_reg64(cpu_V1, rm); tcg_gen_shli_i64(cpu_V1, cpu_V1, 64 - (imm * 8)); tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1); } neon_store_reg64(cpu_V0, rd); if (q) { neon_store_reg64(cpu_V1, rd + 1); } } else if ((insn & (1 << 11)) == 0) { op = ((insn >> 12) & 0x30) | ((insn >> 7) & 0xf); size = (insn >> 18) & 3; if ((neon_2rm_sizes[op] & (1 << size)) == 0) { return 1; } if ((op != NEON_2RM_VMOVN && op != NEON_2RM_VQMOVN) && q && ((rm | rd) & 1)) { return 1; } switch (op) { case NEON_2RM_VREV64: for (pass = 0; pass < (q ? 2 : 1); pass++) { tmp = neon_load_reg(rm, pass * 2); tmp2 = neon_load_reg(rm, pass * 2 + 1); switch (size) { case 0: tcg_gen_bswap32_i32(tmp, tmp); break; case 1: gen_swap_half(tmp); break; case 2: break; default: abort(); } neon_store_reg(rd, pass * 2 + 1, tmp); if (size == 2) { neon_store_reg(rd, pass * 2, tmp2); } else { switch (size) { case 0: tcg_gen_bswap32_i32(tmp2, tmp2); break; case 1: gen_swap_half(tmp2); break; default: abort(); } neon_store_reg(rd, pass * 2, tmp2); } } break; case NEON_2RM_VPADDL: case NEON_2RM_VPADDL_U: case NEON_2RM_VPADAL: case NEON_2RM_VPADAL_U: for (pass = 0; pass < q + 1; pass++) { tmp = neon_load_reg(rm, pass * 2); gen_neon_widen(cpu_V0, tmp, size, op & 1); tmp = neon_load_reg(rm, pass * 2 + 1); gen_neon_widen(cpu_V1, tmp, size, op & 1); switch (size) { case 0: gen_helper_neon_paddl_u16(CPU_V001); break; case 1: gen_helper_neon_paddl_u32(CPU_V001); break; case 2: tcg_gen_add_i64(CPU_V001); break; default: abort(); } if (op >= NEON_2RM_VPADAL) { neon_load_reg64(cpu_V1, rd + pass); gen_neon_addl(size); } neon_store_reg64(cpu_V0, rd + pass); } break; case NEON_2RM_VTRN: if (size == 2) { int n; for (n = 0; n < (q ? 4 : 2); n += 2) { tmp = neon_load_reg(rm, n); tmp2 = neon_load_reg(rd, n + 1); neon_store_reg(rm, n, tmp2); neon_store_reg(rd, n + 1, tmp); } } else { goto elementwise; } break; case NEON_2RM_VUZP: if (gen_neon_unzip(rd, rm, size, q)) { return 1; } break; case NEON_2RM_VZIP: if (gen_neon_zip(rd, rm, size, q)) { return 1; } break; case NEON_2RM_VMOVN: case NEON_2RM_VQMOVN: if (rm & 1) { return 1; } TCGV_UNUSED_I32(tmp2); for (pass = 0; pass < 2; pass++) { neon_load_reg64(cpu_V0, rm + pass); tmp = tcg_temp_new_i32(); gen_neon_narrow_op(op == NEON_2RM_VMOVN, q, size, tmp, cpu_V0); if (pass == 0) { tmp2 = tmp; } else { neon_store_reg(rd, 0, tmp2); neon_store_reg(rd, 1, tmp); } } break; case NEON_2RM_VSHLL: if (q || (rd & 1)) { return 1; } tmp = neon_load_reg(rm, 0); tmp2 = neon_load_reg(rm, 1); for (pass = 0; pass < 2; pass++) { if (pass == 1) tmp = tmp2; gen_neon_widen(cpu_V0, tmp, size, 1); tcg_gen_shli_i64(cpu_V0, cpu_V0, 8 << size); neon_store_reg64(cpu_V0, rd + pass); } break; case NEON_2RM_VCVT_F16_F32: if (!arm_dc_feature(s, ARM_FEATURE_VFP_FP16) || q || (rm & 1)) { return 1; } tmp = tcg_temp_new_i32(); tmp2 = tcg_temp_new_i32(); tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 0)); gen_helper_neon_fcvt_f32_to_f16(tmp, cpu_F0s, cpu_env); tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 1)); gen_helper_neon_fcvt_f32_to_f16(tmp2, cpu_F0s, cpu_env); tcg_gen_shli_i32(tmp2, tmp2, 16); tcg_gen_or_i32(tmp2, tmp2, tmp); tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 2)); gen_helper_neon_fcvt_f32_to_f16(tmp, cpu_F0s, cpu_env); tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 3)); neon_store_reg(rd, 0, tmp2); tmp2 = tcg_temp_new_i32(); gen_helper_neon_fcvt_f32_to_f16(tmp2, cpu_F0s, cpu_env); tcg_gen_shli_i32(tmp2, tmp2, 16); tcg_gen_or_i32(tmp2, tmp2, tmp); neon_store_reg(rd, 1, tmp2); tcg_temp_free_i32(tmp); break; case NEON_2RM_VCVT_F32_F16: if (!arm_dc_feature(s, ARM_FEATURE_VFP_FP16) || q || (rd & 1)) { return 1; } tmp3 = tcg_temp_new_i32(); tmp = neon_load_reg(rm, 0); tmp2 = neon_load_reg(rm, 1); tcg_gen_ext16u_i32(tmp3, tmp); gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env); tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 0)); tcg_gen_shri_i32(tmp3, tmp, 16); gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env); tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 1)); tcg_temp_free_i32(tmp); tcg_gen_ext16u_i32(tmp3, tmp2); gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env); tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 2)); tcg_gen_shri_i32(tmp3, tmp2, 16); gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env); tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 3)); tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp3); break; case NEON_2RM_AESE: case NEON_2RM_AESMC: if (!arm_dc_feature(s, ARM_FEATURE_V8_AES) || ((rm | rd) & 1)) { return 1; } tmp = tcg_const_i32(rd); tmp2 = tcg_const_i32(rm); tmp3 = tcg_const_i32(extract32(insn, 6, 1)); if (op == NEON_2RM_AESE) { gen_helper_crypto_aese(cpu_env, tmp, tmp2, tmp3); } else { gen_helper_crypto_aesmc(cpu_env, tmp, tmp2, tmp3); } tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp3); break; case NEON_2RM_SHA1H: if (!arm_dc_feature(s, ARM_FEATURE_V8_SHA1) || ((rm | rd) & 1)) { return 1; } tmp = tcg_const_i32(rd); tmp2 = tcg_const_i32(rm); gen_helper_crypto_sha1h(cpu_env, tmp, tmp2); tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); break; case NEON_2RM_SHA1SU1: if ((rm | rd) & 1) { return 1; } if (q) { if (!arm_dc_feature(s, ARM_FEATURE_V8_SHA256)) { return 1; } } else if (!arm_dc_feature(s, ARM_FEATURE_V8_SHA1)) { return 1; } tmp = tcg_const_i32(rd); tmp2 = tcg_const_i32(rm); if (q) { gen_helper_crypto_sha256su0(cpu_env, tmp, tmp2); } else { gen_helper_crypto_sha1su1(cpu_env, tmp, tmp2); } tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); break; default: elementwise: for (pass = 0; pass < (q ? 4 : 2); pass++) { if (neon_2rm_is_float_op(op)) { tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, pass)); TCGV_UNUSED_I32(tmp); } else { tmp = neon_load_reg(rm, pass); } switch (op) { case NEON_2RM_VREV32: switch (size) { case 0: tcg_gen_bswap32_i32(tmp, tmp); break; case 1: gen_swap_half(tmp); break; default: abort(); } break; case NEON_2RM_VREV16: gen_rev16(tmp); break; case NEON_2RM_VCLS: switch (size) { case 0: gen_helper_neon_cls_s8(tmp, tmp); break; case 1: gen_helper_neon_cls_s16(tmp, tmp); break; case 2: gen_helper_neon_cls_s32(tmp, tmp); break; default: abort(); } break; case NEON_2RM_VCLZ: switch (size) { case 0: gen_helper_neon_clz_u8(tmp, tmp); break; case 1: gen_helper_neon_clz_u16(tmp, tmp); break; case 2: gen_helper_clz(tmp, tmp); break; default: abort(); } break; case NEON_2RM_VCNT: gen_helper_neon_cnt_u8(tmp, tmp); break; case NEON_2RM_VMVN: tcg_gen_not_i32(tmp, tmp); break; case NEON_2RM_VQABS: switch (size) { case 0: gen_helper_neon_qabs_s8(tmp, cpu_env, tmp); break; case 1: gen_helper_neon_qabs_s16(tmp, cpu_env, tmp); break; case 2: gen_helper_neon_qabs_s32(tmp, cpu_env, tmp); break; default: abort(); } break; case NEON_2RM_VQNEG: switch (size) { case 0: gen_helper_neon_qneg_s8(tmp, cpu_env, tmp); break; case 1: gen_helper_neon_qneg_s16(tmp, cpu_env, tmp); break; case 2: gen_helper_neon_qneg_s32(tmp, cpu_env, tmp); break; default: abort(); } break; case NEON_2RM_VCGT0: case NEON_2RM_VCLE0: tmp2 = tcg_const_i32(0); switch(size) { case 0: gen_helper_neon_cgt_s8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_cgt_s16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_cgt_s32(tmp, tmp, tmp2); break; default: abort(); } tcg_temp_free_i32(tmp2); if (op == NEON_2RM_VCLE0) { tcg_gen_not_i32(tmp, tmp); } break; case NEON_2RM_VCGE0: case NEON_2RM_VCLT0: tmp2 = tcg_const_i32(0); switch(size) { case 0: gen_helper_neon_cge_s8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_cge_s16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_cge_s32(tmp, tmp, tmp2); break; default: abort(); } tcg_temp_free_i32(tmp2); if (op == NEON_2RM_VCLT0) { tcg_gen_not_i32(tmp, tmp); } break; case NEON_2RM_VCEQ0: tmp2 = tcg_const_i32(0); switch(size) { case 0: gen_helper_neon_ceq_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_ceq_u16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_ceq_u32(tmp, tmp, tmp2); break; default: abort(); } tcg_temp_free_i32(tmp2); break; case NEON_2RM_VABS: switch(size) { case 0: gen_helper_neon_abs_s8(tmp, tmp); break; case 1: gen_helper_neon_abs_s16(tmp, tmp); break; case 2: tcg_gen_abs_i32(tmp, tmp); break; default: abort(); } break; case NEON_2RM_VNEG: tmp2 = tcg_const_i32(0); gen_neon_rsb(size, tmp, tmp2); tcg_temp_free_i32(tmp2); break; case NEON_2RM_VCGT0_F: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); tmp2 = tcg_const_i32(0); gen_helper_neon_cgt_f32(tmp, tmp, tmp2, fpstatus); tcg_temp_free_i32(tmp2); tcg_temp_free_ptr(fpstatus); break; } case NEON_2RM_VCGE0_F: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); tmp2 = tcg_const_i32(0); gen_helper_neon_cge_f32(tmp, tmp, tmp2, fpstatus); tcg_temp_free_i32(tmp2); tcg_temp_free_ptr(fpstatus); break; } case NEON_2RM_VCEQ0_F: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); tmp2 = tcg_const_i32(0); gen_helper_neon_ceq_f32(tmp, tmp, tmp2, fpstatus); tcg_temp_free_i32(tmp2); tcg_temp_free_ptr(fpstatus); break; } case NEON_2RM_VCLE0_F: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); tmp2 = tcg_const_i32(0); gen_helper_neon_cge_f32(tmp, tmp2, tmp, fpstatus); tcg_temp_free_i32(tmp2); tcg_temp_free_ptr(fpstatus); break; } case NEON_2RM_VCLT0_F: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); tmp2 = tcg_const_i32(0); gen_helper_neon_cgt_f32(tmp, tmp2, tmp, fpstatus); tcg_temp_free_i32(tmp2); tcg_temp_free_ptr(fpstatus); break; } case NEON_2RM_VABS_F: gen_vfp_abs(0); break; case NEON_2RM_VNEG_F: gen_vfp_neg(0); break; case NEON_2RM_VSWP: tmp2 = neon_load_reg(rd, pass); neon_store_reg(rm, pass, tmp2); break; case NEON_2RM_VTRN: tmp2 = neon_load_reg(rd, pass); switch (size) { case 0: gen_neon_trn_u8(tmp, tmp2); break; case 1: gen_neon_trn_u16(tmp, tmp2); break; default: abort(); } neon_store_reg(rm, pass, tmp2); break; case NEON_2RM_VRINTN: case NEON_2RM_VRINTA: case NEON_2RM_VRINTM: case NEON_2RM_VRINTP: case NEON_2RM_VRINTZ: { TCGv_i32 tcg_rmode; TCGv_ptr fpstatus = get_fpstatus_ptr(1); int rmode; if (op == NEON_2RM_VRINTZ) { rmode = FPROUNDING_ZERO; } else { rmode = fp_decode_rm[((op & 0x6) >> 1) ^ 1]; } tcg_rmode = tcg_const_i32(arm_rmode_to_sf(rmode)); gen_helper_set_neon_rmode(tcg_rmode, tcg_rmode, cpu_env); gen_helper_rints(cpu_F0s, cpu_F0s, fpstatus); gen_helper_set_neon_rmode(tcg_rmode, tcg_rmode, cpu_env); tcg_temp_free_ptr(fpstatus); tcg_temp_free_i32(tcg_rmode); break; } case NEON_2RM_VRINTX: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); gen_helper_rints_exact(cpu_F0s, cpu_F0s, fpstatus); tcg_temp_free_ptr(fpstatus); break; } case NEON_2RM_VCVTAU: case NEON_2RM_VCVTAS: case NEON_2RM_VCVTNU: case NEON_2RM_VCVTNS: case NEON_2RM_VCVTPU: case NEON_2RM_VCVTPS: case NEON_2RM_VCVTMU: case NEON_2RM_VCVTMS: { bool is_signed = !extract32(insn, 7, 1); TCGv_ptr fpst = get_fpstatus_ptr(1); TCGv_i32 tcg_rmode, tcg_shift; int rmode = fp_decode_rm[extract32(insn, 8, 2)]; tcg_shift = tcg_const_i32(0); tcg_rmode = tcg_const_i32(arm_rmode_to_sf(rmode)); gen_helper_set_neon_rmode(tcg_rmode, tcg_rmode, cpu_env); if (is_signed) { gen_helper_vfp_tosls(cpu_F0s, cpu_F0s, tcg_shift, fpst); } else { gen_helper_vfp_touls(cpu_F0s, cpu_F0s, tcg_shift, fpst); } gen_helper_set_neon_rmode(tcg_rmode, tcg_rmode, cpu_env); tcg_temp_free_i32(tcg_rmode); tcg_temp_free_i32(tcg_shift); tcg_temp_free_ptr(fpst); break; } case NEON_2RM_VRECPE: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); gen_helper_recpe_u32(tmp, tmp, fpstatus); tcg_temp_free_ptr(fpstatus); break; } case NEON_2RM_VRSQRTE: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); gen_helper_rsqrte_u32(tmp, tmp, fpstatus); tcg_temp_free_ptr(fpstatus); break; } case NEON_2RM_VRECPE_F: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); gen_helper_recpe_f32(cpu_F0s, cpu_F0s, fpstatus); tcg_temp_free_ptr(fpstatus); break; } case NEON_2RM_VRSQRTE_F: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); gen_helper_rsqrte_f32(cpu_F0s, cpu_F0s, fpstatus); tcg_temp_free_ptr(fpstatus); break; } case NEON_2RM_VCVT_FS: gen_vfp_sito(0, 1); break; case NEON_2RM_VCVT_FU: gen_vfp_uito(0, 1); break; case NEON_2RM_VCVT_SF: gen_vfp_tosiz(0, 1); break; case NEON_2RM_VCVT_UF: gen_vfp_touiz(0, 1); break; default: abort(); } if (neon_2rm_is_float_op(op)) { tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, pass)); } else { neon_store_reg(rd, pass, tmp); } } break; } } else if ((insn & (1 << 10)) == 0) { int n = ((insn >> 8) & 3) + 1; if ((rn + n) > 32) { return 1; } n <<= 3; if (insn & (1 << 6)) { tmp = neon_load_reg(rd, 0); } else { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, 0); } tmp2 = neon_load_reg(rm, 0); tmp4 = tcg_const_i32(rn); tmp5 = tcg_const_i32(n); gen_helper_neon_tbl(tmp2, cpu_env, tmp2, tmp, tmp4, tmp5); tcg_temp_free_i32(tmp); if (insn & (1 << 6)) { tmp = neon_load_reg(rd, 1); } else { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, 0); } tmp3 = neon_load_reg(rm, 1); gen_helper_neon_tbl(tmp3, cpu_env, tmp3, tmp, tmp4, tmp5); tcg_temp_free_i32(tmp5); tcg_temp_free_i32(tmp4); neon_store_reg(rd, 0, tmp2); neon_store_reg(rd, 1, tmp3); tcg_temp_free_i32(tmp); } else if ((insn & 0x380) == 0) { if ((insn & (7 << 16)) == 0 || (q && (rd & 1))) { return 1; } if (insn & (1 << 19)) { tmp = neon_load_reg(rm, 1); } else { tmp = neon_load_reg(rm, 0); } if (insn & (1 << 16)) { gen_neon_dup_u8(tmp, ((insn >> 17) & 3) * 8); } else if (insn & (1 << 17)) { if ((insn >> 18) & 1) gen_neon_dup_high16(tmp); else gen_neon_dup_low16(tmp); } for (pass = 0; pass < (q ? 4 : 2); pass++) { tmp2 = tcg_temp_new_i32(); tcg_gen_mov_i32(tmp2, tmp); neon_store_reg(rd, pass, tmp2); } tcg_temp_free_i32(tmp); } else { return 1; } } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(DisasContext *VAR_0, uint32_t VAR_1) { int VAR_2; int VAR_3; int VAR_4, VAR_5, VAR_6; int VAR_7; int VAR_8; int VAR_9; int VAR_10; int VAR_11; int VAR_12; uint32_t imm, mask; TCGv_i32 tmp, tmp2, tmp3, tmp4, tmp5; TCGv_i64 tmp64; if (!VAR_0->cpacr_fpen) { gen_exception_insn(VAR_0, 4, EXCP_UDEF, syn_fp_access_trap(1, 0xe, VAR_0->thumb), default_exception_el(VAR_0)); return 0; } if (!VAR_0->vfp_enabled) return 1; VAR_3 = (VAR_1 & (1 << 6)) != 0; VAR_12 = (VAR_1 >> 24) & 1; VFP_DREG_D(VAR_4, VAR_1); VFP_DREG_N(VAR_5, VAR_1); VFP_DREG_M(VAR_6, VAR_1); VAR_7 = (VAR_1 >> 20) & 3; if ((VAR_1 & (1 << 23)) == 0) { VAR_2 = ((VAR_1 >> 7) & 0x1e) | ((VAR_1 >> 4) & 1); if ((neon_3r_sizes[VAR_2] & (1 << VAR_7)) == 0) { return 1; } if (VAR_3 && ((VAR_4 | VAR_5 | VAR_6) & 1)) { return 1; } if (VAR_2 == NEON_3R_SHA) { if (!VAR_3) { return 1; } if (!VAR_12) { if (!arm_dc_feature(VAR_0, ARM_FEATURE_V8_SHA1)) { return 1; } tmp = tcg_const_i32(VAR_4); tmp2 = tcg_const_i32(VAR_5); tmp3 = tcg_const_i32(VAR_6); tmp4 = tcg_const_i32(VAR_7); gen_helper_crypto_sha1_3reg(cpu_env, tmp, tmp2, tmp3, tmp4); tcg_temp_free_i32(tmp4); } else { if (!arm_dc_feature(VAR_0, ARM_FEATURE_V8_SHA256) || VAR_7 == 3) { return 1; } tmp = tcg_const_i32(VAR_4); tmp2 = tcg_const_i32(VAR_5); tmp3 = tcg_const_i32(VAR_6); switch (VAR_7) { case 0: gen_helper_crypto_sha256h(cpu_env, tmp, tmp2, tmp3); break; case 1: gen_helper_crypto_sha256h2(cpu_env, tmp, tmp2, tmp3); break; case 2: gen_helper_crypto_sha256su1(cpu_env, tmp, tmp2, tmp3); break; } } tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp3); return 0; } if (VAR_7 == 3 && VAR_2 != NEON_3R_LOGIC) { for (VAR_9 = 0; VAR_9 < (VAR_3 ? 2 : 1); VAR_9++) { neon_load_reg64(cpu_V0, VAR_5 + VAR_9); neon_load_reg64(cpu_V1, VAR_6 + VAR_9); switch (VAR_2) { case NEON_3R_VQADD: if (VAR_12) { gen_helper_neon_qadd_u64(cpu_V0, cpu_env, cpu_V0, cpu_V1); } else { gen_helper_neon_qadd_s64(cpu_V0, cpu_env, cpu_V0, cpu_V1); } break; case NEON_3R_VQSUB: if (VAR_12) { gen_helper_neon_qsub_u64(cpu_V0, cpu_env, cpu_V0, cpu_V1); } else { gen_helper_neon_qsub_s64(cpu_V0, cpu_env, cpu_V0, cpu_V1); } break; case NEON_3R_VSHL: if (VAR_12) { gen_helper_neon_shl_u64(cpu_V0, cpu_V1, cpu_V0); } else { gen_helper_neon_shl_s64(cpu_V0, cpu_V1, cpu_V0); } break; case NEON_3R_VQSHL: if (VAR_12) { gen_helper_neon_qshl_u64(cpu_V0, cpu_env, cpu_V1, cpu_V0); } else { gen_helper_neon_qshl_s64(cpu_V0, cpu_env, cpu_V1, cpu_V0); } break; case NEON_3R_VRSHL: if (VAR_12) { gen_helper_neon_rshl_u64(cpu_V0, cpu_V1, cpu_V0); } else { gen_helper_neon_rshl_s64(cpu_V0, cpu_V1, cpu_V0); } break; case NEON_3R_VQRSHL: if (VAR_12) { gen_helper_neon_qrshl_u64(cpu_V0, cpu_env, cpu_V1, cpu_V0); } else { gen_helper_neon_qrshl_s64(cpu_V0, cpu_env, cpu_V1, cpu_V0); } break; case NEON_3R_VADD_VSUB: if (VAR_12) { tcg_gen_sub_i64(CPU_V001); } else { tcg_gen_add_i64(CPU_V001); } break; default: abort(); } neon_store_reg64(cpu_V0, VAR_4 + VAR_9); } return 0; } VAR_11 = 0; switch (VAR_2) { case NEON_3R_VSHL: case NEON_3R_VQSHL: case NEON_3R_VRSHL: case NEON_3R_VQRSHL: { int VAR_13; VAR_13 = VAR_5; VAR_5 = VAR_6; VAR_6 = VAR_13; } break; case NEON_3R_VPADD: if (VAR_12) { return 1; } case NEON_3R_VPMAX: case NEON_3R_VPMIN: VAR_11 = 1; break; case NEON_3R_FLOAT_ARITH: VAR_11 = (VAR_12 && VAR_7 < 2); break; case NEON_3R_FLOAT_MINMAX: VAR_11 = VAR_12; break; case NEON_3R_FLOAT_CMP: if (!VAR_12 && VAR_7) { return 1; } break; case NEON_3R_FLOAT_ACMP: if (!VAR_12) { return 1; } break; case NEON_3R_FLOAT_MISC: if (VAR_12 && !arm_dc_feature(VAR_0, ARM_FEATURE_V8)) { return 1; } break; case NEON_3R_VMUL: if (VAR_12 && (VAR_7 != 0)) { return 1; } break; case NEON_3R_VFM: if (!arm_dc_feature(VAR_0, ARM_FEATURE_VFP4) || VAR_12) { return 1; } break; default: break; } if (VAR_11 && VAR_3) { return 1; } for (VAR_9 = 0; VAR_9 < (VAR_3 ? 4 : 2); VAR_9++) { if (VAR_11) { if (VAR_9 < 1) { tmp = neon_load_reg(VAR_5, 0); tmp2 = neon_load_reg(VAR_5, 1); } else { tmp = neon_load_reg(VAR_6, 0); tmp2 = neon_load_reg(VAR_6, 1); } } else { tmp = neon_load_reg(VAR_5, VAR_9); tmp2 = neon_load_reg(VAR_6, VAR_9); } switch (VAR_2) { case NEON_3R_VHADD: GEN_NEON_INTEGER_OP(hadd); break; case NEON_3R_VQADD: GEN_NEON_INTEGER_OP_ENV(qadd); break; case NEON_3R_VRHADD: GEN_NEON_INTEGER_OP(rhadd); break; case NEON_3R_LOGIC: switch ((VAR_12 << 2) | VAR_7) { case 0: tcg_gen_and_i32(tmp, tmp, tmp2); break; case 1: tcg_gen_andc_i32(tmp, tmp, tmp2); break; case 2: tcg_gen_or_i32(tmp, tmp, tmp2); break; case 3: tcg_gen_orc_i32(tmp, tmp, tmp2); break; case 4: tcg_gen_xor_i32(tmp, tmp, tmp2); break; case 5: tmp3 = neon_load_reg(VAR_4, VAR_9); gen_neon_bsl(tmp, tmp, tmp2, tmp3); tcg_temp_free_i32(tmp3); break; case 6: tmp3 = neon_load_reg(VAR_4, VAR_9); gen_neon_bsl(tmp, tmp, tmp3, tmp2); tcg_temp_free_i32(tmp3); break; case 7: tmp3 = neon_load_reg(VAR_4, VAR_9); gen_neon_bsl(tmp, tmp3, tmp, tmp2); tcg_temp_free_i32(tmp3); break; } break; case NEON_3R_VHSUB: GEN_NEON_INTEGER_OP(hsub); break; case NEON_3R_VQSUB: GEN_NEON_INTEGER_OP_ENV(qsub); break; case NEON_3R_VCGT: GEN_NEON_INTEGER_OP(cgt); break; case NEON_3R_VCGE: GEN_NEON_INTEGER_OP(cge); break; case NEON_3R_VSHL: GEN_NEON_INTEGER_OP(shl); break; case NEON_3R_VQSHL: GEN_NEON_INTEGER_OP_ENV(qshl); break; case NEON_3R_VRSHL: GEN_NEON_INTEGER_OP(rshl); break; case NEON_3R_VQRSHL: GEN_NEON_INTEGER_OP_ENV(qrshl); break; case NEON_3R_VMAX: GEN_NEON_INTEGER_OP(max); break; case NEON_3R_VMIN: GEN_NEON_INTEGER_OP(min); break; case NEON_3R_VABD: GEN_NEON_INTEGER_OP(abd); break; case NEON_3R_VABA: GEN_NEON_INTEGER_OP(abd); tcg_temp_free_i32(tmp2); tmp2 = neon_load_reg(VAR_4, VAR_9); gen_neon_add(VAR_7, tmp, tmp2); break; case NEON_3R_VADD_VSUB: if (!VAR_12) { gen_neon_add(VAR_7, tmp, tmp2); } else { switch (VAR_7) { case 0: gen_helper_neon_sub_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_sub_u16(tmp, tmp, tmp2); break; case 2: tcg_gen_sub_i32(tmp, tmp, tmp2); break; default: abort(); } } break; case NEON_3R_VTST_VCEQ: if (!VAR_12) { switch (VAR_7) { case 0: gen_helper_neon_tst_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_tst_u16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_tst_u32(tmp, tmp, tmp2); break; default: abort(); } } else { switch (VAR_7) { case 0: gen_helper_neon_ceq_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_ceq_u16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_ceq_u32(tmp, tmp, tmp2); break; default: abort(); } } break; case NEON_3R_VML: switch (VAR_7) { case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break; case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break; default: abort(); } tcg_temp_free_i32(tmp2); tmp2 = neon_load_reg(VAR_4, VAR_9); if (VAR_12) { gen_neon_rsb(VAR_7, tmp, tmp2); } else { gen_neon_add(VAR_7, tmp, tmp2); } break; case NEON_3R_VMUL: if (VAR_12) { gen_helper_neon_mul_p8(tmp, tmp, tmp2); } else { switch (VAR_7) { case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break; case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break; default: abort(); } } break; case NEON_3R_VPMAX: GEN_NEON_INTEGER_OP(pmax); break; case NEON_3R_VPMIN: GEN_NEON_INTEGER_OP(pmin); break; case NEON_3R_VQDMULH_VQRDMULH: if (!VAR_12) { switch (VAR_7) { case 1: gen_helper_neon_qdmulh_s16(tmp, cpu_env, tmp, tmp2); break; case 2: gen_helper_neon_qdmulh_s32(tmp, cpu_env, tmp, tmp2); break; default: abort(); } } else { switch (VAR_7) { case 1: gen_helper_neon_qrdmulh_s16(tmp, cpu_env, tmp, tmp2); break; case 2: gen_helper_neon_qrdmulh_s32(tmp, cpu_env, tmp, tmp2); break; default: abort(); } } break; case NEON_3R_VPADD: switch (VAR_7) { case 0: gen_helper_neon_padd_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_padd_u16(tmp, tmp, tmp2); break; case 2: tcg_gen_add_i32(tmp, tmp, tmp2); break; default: abort(); } break; case NEON_3R_FLOAT_ARITH: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); switch ((VAR_12 << 2) | VAR_7) { case 0: case 4: gen_helper_vfp_adds(tmp, tmp, tmp2, fpstatus); break; case 2: gen_helper_vfp_subs(tmp, tmp, tmp2, fpstatus); break; case 6: gen_helper_neon_abd_f32(tmp, tmp, tmp2, fpstatus); break; default: abort(); } tcg_temp_free_ptr(fpstatus); break; } case NEON_3R_FLOAT_MULTIPLY: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); gen_helper_vfp_muls(tmp, tmp, tmp2, fpstatus); if (!VAR_12) { tcg_temp_free_i32(tmp2); tmp2 = neon_load_reg(VAR_4, VAR_9); if (VAR_7 == 0) { gen_helper_vfp_adds(tmp, tmp, tmp2, fpstatus); } else { gen_helper_vfp_subs(tmp, tmp2, tmp, fpstatus); } } tcg_temp_free_ptr(fpstatus); break; } case NEON_3R_FLOAT_CMP: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); if (!VAR_12) { gen_helper_neon_ceq_f32(tmp, tmp, tmp2, fpstatus); } else { if (VAR_7 == 0) { gen_helper_neon_cge_f32(tmp, tmp, tmp2, fpstatus); } else { gen_helper_neon_cgt_f32(tmp, tmp, tmp2, fpstatus); } } tcg_temp_free_ptr(fpstatus); break; } case NEON_3R_FLOAT_ACMP: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); if (VAR_7 == 0) { gen_helper_neon_acge_f32(tmp, tmp, tmp2, fpstatus); } else { gen_helper_neon_acgt_f32(tmp, tmp, tmp2, fpstatus); } tcg_temp_free_ptr(fpstatus); break; } case NEON_3R_FLOAT_MINMAX: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); if (VAR_7 == 0) { gen_helper_vfp_maxs(tmp, tmp, tmp2, fpstatus); } else { gen_helper_vfp_mins(tmp, tmp, tmp2, fpstatus); } tcg_temp_free_ptr(fpstatus); break; } case NEON_3R_FLOAT_MISC: if (VAR_12) { TCGv_ptr fpstatus = get_fpstatus_ptr(1); if (VAR_7 == 0) { gen_helper_vfp_maxnums(tmp, tmp, tmp2, fpstatus); } else { gen_helper_vfp_minnums(tmp, tmp, tmp2, fpstatus); } tcg_temp_free_ptr(fpstatus); } else { if (VAR_7 == 0) { gen_helper_recps_f32(tmp, tmp, tmp2, cpu_env); } else { gen_helper_rsqrts_f32(tmp, tmp, tmp2, cpu_env); } } break; case NEON_3R_VFM: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); TCGv_i32 tmp3 = neon_load_reg(VAR_4, VAR_9); if (VAR_7) { gen_helper_vfp_negs(tmp, tmp); } gen_helper_vfp_muladds(tmp, tmp, tmp2, tmp3, fpstatus); tcg_temp_free_i32(tmp3); tcg_temp_free_ptr(fpstatus); break; } default: abort(); } tcg_temp_free_i32(tmp2); if (VAR_11 && VAR_4 == VAR_6) { neon_store_scratch(VAR_9, tmp); } else { neon_store_reg(VAR_4, VAR_9, tmp); } } if (VAR_11 && VAR_4 == VAR_6) { for (VAR_9 = 0; VAR_9 < (VAR_3 ? 4 : 2); VAR_9++) { tmp = neon_load_scratch(VAR_9); neon_store_reg(VAR_4, VAR_9, tmp); } } } else if (VAR_1 & (1 << 4)) { if ((VAR_1 & 0x00380080) != 0) { VAR_2 = (VAR_1 >> 8) & 0xf; if (VAR_1 & (1 << 7)) { if (VAR_2 > 7) { return 1; } VAR_7 = 3; } else { VAR_7 = 2; while ((VAR_1 & (1 << (VAR_7 + 19))) == 0) VAR_7--; } VAR_8 = (VAR_1 >> 16) & ((1 << (3 + VAR_7)) - 1); if (VAR_2 < 8) { if (VAR_3 && ((VAR_4 | VAR_6) & 1)) { return 1; } if (!VAR_12 && (VAR_2 == 4 || VAR_2 == 6)) { return 1; } if (VAR_2 <= 4) VAR_8 = VAR_8 - (1 << (VAR_7 + 3)); if (VAR_7 == 3) { VAR_10 = VAR_3 + 1; } else { VAR_10 = VAR_3 ? 4: 2; } switch (VAR_7) { case 0: imm = (uint8_t) VAR_8; imm |= imm << 8; imm |= imm << 16; break; case 1: imm = (uint16_t) VAR_8; imm |= imm << 16; break; case 2: case 3: imm = VAR_8; break; default: abort(); } for (VAR_9 = 0; VAR_9 < VAR_10; VAR_9++) { if (VAR_7 == 3) { neon_load_reg64(cpu_V0, VAR_6 + VAR_9); tcg_gen_movi_i64(cpu_V1, imm); switch (VAR_2) { case 0: case 1: if (VAR_12) gen_helper_neon_shl_u64(cpu_V0, cpu_V0, cpu_V1); else gen_helper_neon_shl_s64(cpu_V0, cpu_V0, cpu_V1); break; case 2: case 3: if (VAR_12) gen_helper_neon_rshl_u64(cpu_V0, cpu_V0, cpu_V1); else gen_helper_neon_rshl_s64(cpu_V0, cpu_V0, cpu_V1); break; case 4: case 5: gen_helper_neon_shl_u64(cpu_V0, cpu_V0, cpu_V1); break; case 6: gen_helper_neon_qshlu_s64(cpu_V0, cpu_env, cpu_V0, cpu_V1); break; case 7: if (VAR_12) { gen_helper_neon_qshl_u64(cpu_V0, cpu_env, cpu_V0, cpu_V1); } else { gen_helper_neon_qshl_s64(cpu_V0, cpu_env, cpu_V0, cpu_V1); } break; } if (VAR_2 == 1 || VAR_2 == 3) { neon_load_reg64(cpu_V1, VAR_4 + VAR_9); tcg_gen_add_i64(cpu_V0, cpu_V0, cpu_V1); } else if (VAR_2 == 4 || (VAR_2 == 5 && VAR_12)) { neon_load_reg64(cpu_V1, VAR_4 + VAR_9); uint64_t mask; if (VAR_8 < -63 || VAR_8 > 63) { mask = 0; } else { if (VAR_2 == 4) { mask = 0xffffffffffffffffull >> -VAR_8; } else { mask = 0xffffffffffffffffull << VAR_8; } } tcg_gen_andi_i64(cpu_V1, cpu_V1, ~mask); tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1); } neon_store_reg64(cpu_V0, VAR_4 + VAR_9); } else { tmp = neon_load_reg(VAR_6, VAR_9); tmp2 = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp2, imm); switch (VAR_2) { case 0: case 1: GEN_NEON_INTEGER_OP(shl); break; case 2: case 3: GEN_NEON_INTEGER_OP(rshl); break; case 4: case 5: switch (VAR_7) { case 0: gen_helper_neon_shl_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_shl_u16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_shl_u32(tmp, tmp, tmp2); break; default: abort(); } break; case 6: switch (VAR_7) { case 0: gen_helper_neon_qshlu_s8(tmp, cpu_env, tmp, tmp2); break; case 1: gen_helper_neon_qshlu_s16(tmp, cpu_env, tmp, tmp2); break; case 2: gen_helper_neon_qshlu_s32(tmp, cpu_env, tmp, tmp2); break; default: abort(); } break; case 7: GEN_NEON_INTEGER_OP_ENV(qshl); break; } tcg_temp_free_i32(tmp2); if (VAR_2 == 1 || VAR_2 == 3) { tmp2 = neon_load_reg(VAR_4, VAR_9); gen_neon_add(VAR_7, tmp, tmp2); tcg_temp_free_i32(tmp2); } else if (VAR_2 == 4 || (VAR_2 == 5 && VAR_12)) { switch (VAR_7) { case 0: if (VAR_2 == 4) mask = 0xff >> -VAR_8; else mask = (uint8_t)(0xff << VAR_8); mask |= mask << 8; mask |= mask << 16; break; case 1: if (VAR_2 == 4) mask = 0xffff >> -VAR_8; else mask = (uint16_t)(0xffff << VAR_8); mask |= mask << 16; break; case 2: if (VAR_8 < -31 || VAR_8 > 31) { mask = 0; } else { if (VAR_2 == 4) mask = 0xffffffffu >> -VAR_8; else mask = 0xffffffffu << VAR_8; } break; default: abort(); } tmp2 = neon_load_reg(VAR_4, VAR_9); tcg_gen_andi_i32(tmp, tmp, mask); tcg_gen_andi_i32(tmp2, tmp2, ~mask); tcg_gen_or_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); } neon_store_reg(VAR_4, VAR_9, tmp); } } } else if (VAR_2 < 10) { int VAR_14 = (VAR_2 == 8) ? !VAR_12 : VAR_12; if (VAR_6 & 1) { return 1; } VAR_8 = VAR_8 - (1 << (VAR_7 + 3)); VAR_7++; if (VAR_7 == 3) { tmp64 = tcg_const_i64(VAR_8); neon_load_reg64(cpu_V0, VAR_6); neon_load_reg64(cpu_V1, VAR_6 + 1); for (VAR_9 = 0; VAR_9 < 2; VAR_9++) { TCGv_i64 in; if (VAR_9 == 0) { in = cpu_V0; } else { in = cpu_V1; } if (VAR_3) { if (VAR_14) { gen_helper_neon_rshl_u64(cpu_V0, in, tmp64); } else { gen_helper_neon_rshl_s64(cpu_V0, in, tmp64); } } else { if (VAR_14) { gen_helper_neon_shl_u64(cpu_V0, in, tmp64); } else { gen_helper_neon_shl_s64(cpu_V0, in, tmp64); } } tmp = tcg_temp_new_i32(); gen_neon_narrow_op(VAR_2 == 8, VAR_12, VAR_7 - 1, tmp, cpu_V0); neon_store_reg(VAR_4, VAR_9, tmp); } tcg_temp_free_i64(tmp64); } else { if (VAR_7 == 1) { imm = (uint16_t)VAR_8; imm |= imm << 16; } else { imm = (uint32_t)VAR_8; } tmp2 = tcg_const_i32(imm); tmp4 = neon_load_reg(VAR_6 + 1, 0); tmp5 = neon_load_reg(VAR_6 + 1, 1); for (VAR_9 = 0; VAR_9 < 2; VAR_9++) { if (VAR_9 == 0) { tmp = neon_load_reg(VAR_6, 0); } else { tmp = tmp4; } gen_neon_shift_narrow(VAR_7, tmp, tmp2, VAR_3, VAR_14); if (VAR_9 == 0) { tmp3 = neon_load_reg(VAR_6, 1); } else { tmp3 = tmp5; } gen_neon_shift_narrow(VAR_7, tmp3, tmp2, VAR_3, VAR_14); tcg_gen_concat_i32_i64(cpu_V0, tmp, tmp3); tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp3); tmp = tcg_temp_new_i32(); gen_neon_narrow_op(VAR_2 == 8, VAR_12, VAR_7 - 1, tmp, cpu_V0); neon_store_reg(VAR_4, VAR_9, tmp); } tcg_temp_free_i32(tmp2); } } else if (VAR_2 == 10) { if (VAR_3 || (VAR_4 & 1)) { return 1; } tmp = neon_load_reg(VAR_6, 0); tmp2 = neon_load_reg(VAR_6, 1); for (VAR_9 = 0; VAR_9 < 2; VAR_9++) { if (VAR_9 == 1) tmp = tmp2; gen_neon_widen(cpu_V0, tmp, VAR_7, VAR_12); if (VAR_8 != 0) { tcg_gen_shli_i64(cpu_V0, cpu_V0, VAR_8); if (VAR_7 < 2 || !VAR_12) { uint64_t imm64; if (VAR_7 == 0) { imm = (0xffu >> (8 - VAR_8)); imm |= imm << 16; } else if (VAR_7 == 1) { imm = 0xffff >> (16 - VAR_8); } else { imm = 0xffffffff >> (32 - VAR_8); } if (VAR_7 < 2) { imm64 = imm | (((uint64_t)imm) << 32); } else { imm64 = imm; } tcg_gen_andi_i64(cpu_V0, cpu_V0, ~imm64); } } neon_store_reg64(cpu_V0, VAR_4 + VAR_9); } } else if (VAR_2 >= 14) { if (!(VAR_1 & (1 << 21)) || (VAR_3 && ((VAR_4 | VAR_6) & 1))) { return 1; } VAR_8 = 32 - VAR_8; for (VAR_9 = 0; VAR_9 < (VAR_3 ? 4 : 2); VAR_9++) { tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_6, VAR_9)); if (!(VAR_2 & 1)) { if (VAR_12) gen_vfp_ulto(0, VAR_8, 1); else gen_vfp_slto(0, VAR_8, 1); } else { if (VAR_12) gen_vfp_toul(0, VAR_8, 1); else gen_vfp_tosl(0, VAR_8, 1); } tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_4, VAR_9)); } } else { return 1; } } else { int VAR_15; if (VAR_3 && (VAR_4 & 1)) { return 1; } VAR_2 = (VAR_1 >> 8) & 0xf; imm = (VAR_12 << 7) | ((VAR_1 >> 12) & 0x70) | (VAR_1 & 0xf); VAR_15 = (VAR_1 & (1 << 5)) != 0; switch (VAR_2) { case 0: case 1: break; case 2: case 3: imm <<= 8; break; case 4: case 5: imm <<= 16; break; case 6: case 7: imm <<= 24; break; case 8: case 9: imm |= imm << 16; break; case 10: case 11: imm = (imm << 8) | (imm << 24); break; case 12: imm = (imm << 8) | 0xff; break; case 13: imm = (imm << 16) | 0xffff; break; case 14: imm |= (imm << 8) | (imm << 16) | (imm << 24); if (VAR_15) imm = ~imm; break; case 15: if (VAR_15) { return 1; } imm = ((imm & 0x80) << 24) | ((imm & 0x3f) << 19) | ((imm & 0x40) ? (0x1f << 25) : (1 << 30)); break; } if (VAR_15) imm = ~imm; for (VAR_9 = 0; VAR_9 < (VAR_3 ? 4 : 2); VAR_9++) { if (VAR_2 & 1 && VAR_2 < 12) { tmp = neon_load_reg(VAR_4, VAR_9); if (VAR_15) { tcg_gen_andi_i32(tmp, tmp, imm); } else { tcg_gen_ori_i32(tmp, tmp, imm); } } else { tmp = tcg_temp_new_i32(); if (VAR_2 == 14 && VAR_15) { int VAR_23; uint32_t val; val = 0; for (VAR_23 = 0; VAR_23 < 4; VAR_23++) { if (imm & (1 << (VAR_23 + (VAR_9 & 1) * 4))) val |= 0xff << (VAR_23 * 8); } tcg_gen_movi_i32(tmp, val); } else { tcg_gen_movi_i32(tmp, imm); } } neon_store_reg(VAR_4, VAR_9, tmp); } } } else { if (VAR_7 != 3) { VAR_2 = (VAR_1 >> 8) & 0xf; if ((VAR_1 & (1 << 6)) == 0) { int VAR_17; int VAR_18; int VAR_19; int VAR_20; static const int VAR_21[16][4] = { {1, 0, 0, 0}, {1, 1, 0, 0}, {1, 0, 0, 0}, {1, 1, 0, 0}, {0, 1, 1, 0}, {0, 0, 0, 0}, {0, 1, 1, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 9}, {0, 0, 0, 0}, {0, 0, 0, 9}, {0, 0, 0, 0}, {0, 0, 0, 1}, {0, 0, 0, 0xa}, {0, 0, 0, 7}, }; VAR_19 = VAR_21[VAR_2][0]; VAR_17 = VAR_21[VAR_2][1]; VAR_18 = VAR_21[VAR_2][2]; VAR_20 = VAR_21[VAR_2][3]; if ((VAR_20 & (1 << VAR_7)) || ((VAR_20 & 8) && VAR_12)) { return 1; } if ((VAR_17 && (VAR_5 & 1)) || (VAR_18 && (VAR_6 & 1)) || (!VAR_18 && (VAR_4 & 1))) { return 1; } if (VAR_2 == 14 && VAR_7 == 2) { TCGv_i64 tcg_rn, tcg_rm, tcg_rd; if (!arm_dc_feature(VAR_0, ARM_FEATURE_V8_PMULL)) { return 1; } tcg_rn = tcg_temp_new_i64(); tcg_rm = tcg_temp_new_i64(); tcg_rd = tcg_temp_new_i64(); neon_load_reg64(tcg_rn, VAR_5); neon_load_reg64(tcg_rm, VAR_6); gen_helper_neon_pmull_64_lo(tcg_rd, tcg_rn, tcg_rm); neon_store_reg64(tcg_rd, VAR_4); gen_helper_neon_pmull_64_hi(tcg_rd, tcg_rn, tcg_rm); neon_store_reg64(tcg_rd, VAR_4 + 1); tcg_temp_free_i64(tcg_rn); tcg_temp_free_i64(tcg_rm); tcg_temp_free_i64(tcg_rd); return 0; } if (VAR_4 == VAR_6 && !VAR_18) { tmp = neon_load_reg(VAR_6, 1); neon_store_scratch(2, tmp); } else if (VAR_4 == VAR_5 && !VAR_17) { tmp = neon_load_reg(VAR_5, 1); neon_store_scratch(2, tmp); } TCGV_UNUSED_I32(tmp3); for (VAR_9 = 0; VAR_9 < 2; VAR_9++) { if (VAR_17) { neon_load_reg64(cpu_V0, VAR_5 + VAR_9); TCGV_UNUSED_I32(tmp); } else { if (VAR_9 == 1 && VAR_4 == VAR_5) { tmp = neon_load_scratch(2); } else { tmp = neon_load_reg(VAR_5, VAR_9); } if (VAR_19) { gen_neon_widen(cpu_V0, tmp, VAR_7, VAR_12); } } if (VAR_18) { neon_load_reg64(cpu_V1, VAR_6 + VAR_9); TCGV_UNUSED_I32(tmp2); } else { if (VAR_9 == 1 && VAR_4 == VAR_6) { tmp2 = neon_load_scratch(2); } else { tmp2 = neon_load_reg(VAR_6, VAR_9); } if (VAR_19) { gen_neon_widen(cpu_V1, tmp2, VAR_7, VAR_12); } } switch (VAR_2) { case 0: case 1: case 4: gen_neon_addl(VAR_7); break; case 2: case 3: case 6: gen_neon_subl(VAR_7); break; case 5: case 7: switch ((VAR_7 << 1) | VAR_12) { case 0: gen_helper_neon_abdl_s16(cpu_V0, tmp, tmp2); break; case 1: gen_helper_neon_abdl_u16(cpu_V0, tmp, tmp2); break; case 2: gen_helper_neon_abdl_s32(cpu_V0, tmp, tmp2); break; case 3: gen_helper_neon_abdl_u32(cpu_V0, tmp, tmp2); break; case 4: gen_helper_neon_abdl_s64(cpu_V0, tmp, tmp2); break; case 5: gen_helper_neon_abdl_u64(cpu_V0, tmp, tmp2); break; default: abort(); } tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp); break; case 8: case 9: case 10: case 11: case 12: case 13: gen_neon_mull(cpu_V0, tmp, tmp2, VAR_7, VAR_12); break; case 14: gen_helper_neon_mull_p8(cpu_V0, tmp, tmp2); tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp); break; default: abort(); } if (VAR_2 == 13) { gen_neon_addl_saturate(cpu_V0, cpu_V0, VAR_7); neon_store_reg64(cpu_V0, VAR_4 + VAR_9); } else if (VAR_2 == 5 || (VAR_2 >= 8 && VAR_2 <= 11)) { neon_load_reg64(cpu_V1, VAR_4 + VAR_9); switch (VAR_2) { case 10: gen_neon_negl(cpu_V0, VAR_7); case 5: case 8: gen_neon_addl(VAR_7); break; case 9: case 11: gen_neon_addl_saturate(cpu_V0, cpu_V0, VAR_7); if (VAR_2 == 11) { gen_neon_negl(cpu_V0, VAR_7); } gen_neon_addl_saturate(cpu_V0, cpu_V1, VAR_7); break; default: abort(); } neon_store_reg64(cpu_V0, VAR_4 + VAR_9); } else if (VAR_2 == 4 || VAR_2 == 6) { tmp = tcg_temp_new_i32(); if (!VAR_12) { switch (VAR_7) { case 0: gen_helper_neon_narrow_high_u8(tmp, cpu_V0); break; case 1: gen_helper_neon_narrow_high_u16(tmp, cpu_V0); break; case 2: tcg_gen_shri_i64(cpu_V0, cpu_V0, 32); tcg_gen_trunc_i64_i32(tmp, cpu_V0); break; default: abort(); } } else { switch (VAR_7) { case 0: gen_helper_neon_narrow_round_high_u8(tmp, cpu_V0); break; case 1: gen_helper_neon_narrow_round_high_u16(tmp, cpu_V0); break; case 2: tcg_gen_addi_i64(cpu_V0, cpu_V0, 1u << 31); tcg_gen_shri_i64(cpu_V0, cpu_V0, 32); tcg_gen_trunc_i64_i32(tmp, cpu_V0); break; default: abort(); } } if (VAR_9 == 0) { tmp3 = tmp; } else { neon_store_reg(VAR_4, 0, tmp3); neon_store_reg(VAR_4, 1, tmp); } } else { neon_store_reg64(cpu_V0, VAR_4 + VAR_9); } } } else { if (VAR_7 == 0) { return 1; } switch (VAR_2) { case 1: case 5: case 9: if (VAR_7 == 1) { return 1; } case 0: case 4: case 8: case 12: case 13: if (VAR_12 && ((VAR_4 | VAR_5) & 1)) { return 1; } tmp = neon_get_scalar(VAR_7, VAR_6); neon_store_scratch(0, tmp); for (VAR_9 = 0; VAR_9 < (VAR_12 ? 4 : 2); VAR_9++) { tmp = neon_load_scratch(0); tmp2 = neon_load_reg(VAR_5, VAR_9); if (VAR_2 == 12) { if (VAR_7 == 1) { gen_helper_neon_qdmulh_s16(tmp, cpu_env, tmp, tmp2); } else { gen_helper_neon_qdmulh_s32(tmp, cpu_env, tmp, tmp2); } } else if (VAR_2 == 13) { if (VAR_7 == 1) { gen_helper_neon_qrdmulh_s16(tmp, cpu_env, tmp, tmp2); } else { gen_helper_neon_qrdmulh_s32(tmp, cpu_env, tmp, tmp2); } } else if (VAR_2 & 1) { TCGv_ptr fpstatus = get_fpstatus_ptr(1); gen_helper_vfp_muls(tmp, tmp, tmp2, fpstatus); tcg_temp_free_ptr(fpstatus); } else { switch (VAR_7) { case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break; case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break; default: abort(); } } tcg_temp_free_i32(tmp2); if (VAR_2 < 8) { tmp2 = neon_load_reg(VAR_4, VAR_9); switch (VAR_2) { case 0: gen_neon_add(VAR_7, tmp, tmp2); break; case 1: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); gen_helper_vfp_adds(tmp, tmp, tmp2, fpstatus); tcg_temp_free_ptr(fpstatus); break; } case 4: gen_neon_rsb(VAR_7, tmp, tmp2); break; case 5: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); gen_helper_vfp_subs(tmp, tmp2, tmp, fpstatus); tcg_temp_free_ptr(fpstatus); break; } default: abort(); } tcg_temp_free_i32(tmp2); } neon_store_reg(VAR_4, VAR_9, tmp); } break; case 3: case 7: case 11: if (VAR_12 == 1) { return 1; } case 2: case 6: case 10: if (VAR_4 & 1) { return 1; } tmp2 = neon_get_scalar(VAR_7, VAR_6); tmp4 = tcg_temp_new_i32(); tcg_gen_mov_i32(tmp4, tmp2); tmp3 = neon_load_reg(VAR_5, 1); for (VAR_9 = 0; VAR_9 < 2; VAR_9++) { if (VAR_9 == 0) { tmp = neon_load_reg(VAR_5, 0); } else { tmp = tmp3; tmp2 = tmp4; } gen_neon_mull(cpu_V0, tmp, tmp2, VAR_7, VAR_12); if (VAR_2 != 11) { neon_load_reg64(cpu_V1, VAR_4 + VAR_9); } switch (VAR_2) { case 6: gen_neon_negl(cpu_V0, VAR_7); case 2: gen_neon_addl(VAR_7); break; case 3: case 7: gen_neon_addl_saturate(cpu_V0, cpu_V0, VAR_7); if (VAR_2 == 7) { gen_neon_negl(cpu_V0, VAR_7); } gen_neon_addl_saturate(cpu_V0, cpu_V1, VAR_7); break; case 10: break; case 11: gen_neon_addl_saturate(cpu_V0, cpu_V0, VAR_7); break; default: abort(); } neon_store_reg64(cpu_V0, VAR_4 + VAR_9); } break; default: return 1; } } } else { if (!VAR_12) { imm = (VAR_1 >> 8) & 0xf; if (imm > 7 && !VAR_3) return 1; if (VAR_3 && ((VAR_4 | VAR_5 | VAR_6) & 1)) { return 1; } if (imm == 0) { neon_load_reg64(cpu_V0, VAR_5); if (VAR_3) { neon_load_reg64(cpu_V1, VAR_5 + 1); } } else if (imm == 8) { neon_load_reg64(cpu_V0, VAR_5 + 1); if (VAR_3) { neon_load_reg64(cpu_V1, VAR_6); } } else if (VAR_3) { tmp64 = tcg_temp_new_i64(); if (imm < 8) { neon_load_reg64(cpu_V0, VAR_5); neon_load_reg64(tmp64, VAR_5 + 1); } else { neon_load_reg64(cpu_V0, VAR_5 + 1); neon_load_reg64(tmp64, VAR_6); } tcg_gen_shri_i64(cpu_V0, cpu_V0, (imm & 7) * 8); tcg_gen_shli_i64(cpu_V1, tmp64, 64 - ((imm & 7) * 8)); tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1); if (imm < 8) { neon_load_reg64(cpu_V1, VAR_6); } else { neon_load_reg64(cpu_V1, VAR_6 + 1); imm -= 8; } tcg_gen_shli_i64(cpu_V1, cpu_V1, 64 - (imm * 8)); tcg_gen_shri_i64(tmp64, tmp64, imm * 8); tcg_gen_or_i64(cpu_V1, cpu_V1, tmp64); tcg_temp_free_i64(tmp64); } else { neon_load_reg64(cpu_V0, VAR_5); tcg_gen_shri_i64(cpu_V0, cpu_V0, imm * 8); neon_load_reg64(cpu_V1, VAR_6); tcg_gen_shli_i64(cpu_V1, cpu_V1, 64 - (imm * 8)); tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1); } neon_store_reg64(cpu_V0, VAR_4); if (VAR_3) { neon_store_reg64(cpu_V1, VAR_4 + 1); } } else if ((VAR_1 & (1 << 11)) == 0) { VAR_2 = ((VAR_1 >> 12) & 0x30) | ((VAR_1 >> 7) & 0xf); VAR_7 = (VAR_1 >> 18) & 3; if ((neon_2rm_sizes[VAR_2] & (1 << VAR_7)) == 0) { return 1; } if ((VAR_2 != NEON_2RM_VMOVN && VAR_2 != NEON_2RM_VQMOVN) && VAR_3 && ((VAR_6 | VAR_4) & 1)) { return 1; } switch (VAR_2) { case NEON_2RM_VREV64: for (VAR_9 = 0; VAR_9 < (VAR_3 ? 2 : 1); VAR_9++) { tmp = neon_load_reg(VAR_6, VAR_9 * 2); tmp2 = neon_load_reg(VAR_6, VAR_9 * 2 + 1); switch (VAR_7) { case 0: tcg_gen_bswap32_i32(tmp, tmp); break; case 1: gen_swap_half(tmp); break; case 2: break; default: abort(); } neon_store_reg(VAR_4, VAR_9 * 2 + 1, tmp); if (VAR_7 == 2) { neon_store_reg(VAR_4, VAR_9 * 2, tmp2); } else { switch (VAR_7) { case 0: tcg_gen_bswap32_i32(tmp2, tmp2); break; case 1: gen_swap_half(tmp2); break; default: abort(); } neon_store_reg(VAR_4, VAR_9 * 2, tmp2); } } break; case NEON_2RM_VPADDL: case NEON_2RM_VPADDL_U: case NEON_2RM_VPADAL: case NEON_2RM_VPADAL_U: for (VAR_9 = 0; VAR_9 < VAR_3 + 1; VAR_9++) { tmp = neon_load_reg(VAR_6, VAR_9 * 2); gen_neon_widen(cpu_V0, tmp, VAR_7, VAR_2 & 1); tmp = neon_load_reg(VAR_6, VAR_9 * 2 + 1); gen_neon_widen(cpu_V1, tmp, VAR_7, VAR_2 & 1); switch (VAR_7) { case 0: gen_helper_neon_paddl_u16(CPU_V001); break; case 1: gen_helper_neon_paddl_u32(CPU_V001); break; case 2: tcg_gen_add_i64(CPU_V001); break; default: abort(); } if (VAR_2 >= NEON_2RM_VPADAL) { neon_load_reg64(cpu_V1, VAR_4 + VAR_9); gen_neon_addl(VAR_7); } neon_store_reg64(cpu_V0, VAR_4 + VAR_9); } break; case NEON_2RM_VTRN: if (VAR_7 == 2) { int VAR_23; for (VAR_23 = 0; VAR_23 < (VAR_3 ? 4 : 2); VAR_23 += 2) { tmp = neon_load_reg(VAR_6, VAR_23); tmp2 = neon_load_reg(VAR_4, VAR_23 + 1); neon_store_reg(VAR_6, VAR_23, tmp2); neon_store_reg(VAR_4, VAR_23 + 1, tmp); } } else { goto elementwise; } break; case NEON_2RM_VUZP: if (gen_neon_unzip(VAR_4, VAR_6, VAR_7, VAR_3)) { return 1; } break; case NEON_2RM_VZIP: if (gen_neon_zip(VAR_4, VAR_6, VAR_7, VAR_3)) { return 1; } break; case NEON_2RM_VMOVN: case NEON_2RM_VQMOVN: if (VAR_6 & 1) { return 1; } TCGV_UNUSED_I32(tmp2); for (VAR_9 = 0; VAR_9 < 2; VAR_9++) { neon_load_reg64(cpu_V0, VAR_6 + VAR_9); tmp = tcg_temp_new_i32(); gen_neon_narrow_op(VAR_2 == NEON_2RM_VMOVN, VAR_3, VAR_7, tmp, cpu_V0); if (VAR_9 == 0) { tmp2 = tmp; } else { neon_store_reg(VAR_4, 0, tmp2); neon_store_reg(VAR_4, 1, tmp); } } break; case NEON_2RM_VSHLL: if (VAR_3 || (VAR_4 & 1)) { return 1; } tmp = neon_load_reg(VAR_6, 0); tmp2 = neon_load_reg(VAR_6, 1); for (VAR_9 = 0; VAR_9 < 2; VAR_9++) { if (VAR_9 == 1) tmp = tmp2; gen_neon_widen(cpu_V0, tmp, VAR_7, 1); tcg_gen_shli_i64(cpu_V0, cpu_V0, 8 << VAR_7); neon_store_reg64(cpu_V0, VAR_4 + VAR_9); } break; case NEON_2RM_VCVT_F16_F32: if (!arm_dc_feature(VAR_0, ARM_FEATURE_VFP_FP16) || VAR_3 || (VAR_6 & 1)) { return 1; } tmp = tcg_temp_new_i32(); tmp2 = tcg_temp_new_i32(); tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_6, 0)); gen_helper_neon_fcvt_f32_to_f16(tmp, cpu_F0s, cpu_env); tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_6, 1)); gen_helper_neon_fcvt_f32_to_f16(tmp2, cpu_F0s, cpu_env); tcg_gen_shli_i32(tmp2, tmp2, 16); tcg_gen_or_i32(tmp2, tmp2, tmp); tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_6, 2)); gen_helper_neon_fcvt_f32_to_f16(tmp, cpu_F0s, cpu_env); tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_6, 3)); neon_store_reg(VAR_4, 0, tmp2); tmp2 = tcg_temp_new_i32(); gen_helper_neon_fcvt_f32_to_f16(tmp2, cpu_F0s, cpu_env); tcg_gen_shli_i32(tmp2, tmp2, 16); tcg_gen_or_i32(tmp2, tmp2, tmp); neon_store_reg(VAR_4, 1, tmp2); tcg_temp_free_i32(tmp); break; case NEON_2RM_VCVT_F32_F16: if (!arm_dc_feature(VAR_0, ARM_FEATURE_VFP_FP16) || VAR_3 || (VAR_4 & 1)) { return 1; } tmp3 = tcg_temp_new_i32(); tmp = neon_load_reg(VAR_6, 0); tmp2 = neon_load_reg(VAR_6, 1); tcg_gen_ext16u_i32(tmp3, tmp); gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env); tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_4, 0)); tcg_gen_shri_i32(tmp3, tmp, 16); gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env); tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_4, 1)); tcg_temp_free_i32(tmp); tcg_gen_ext16u_i32(tmp3, tmp2); gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env); tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_4, 2)); tcg_gen_shri_i32(tmp3, tmp2, 16); gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env); tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_4, 3)); tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp3); break; case NEON_2RM_AESE: case NEON_2RM_AESMC: if (!arm_dc_feature(VAR_0, ARM_FEATURE_V8_AES) || ((VAR_6 | VAR_4) & 1)) { return 1; } tmp = tcg_const_i32(VAR_4); tmp2 = tcg_const_i32(VAR_6); tmp3 = tcg_const_i32(extract32(VAR_1, 6, 1)); if (VAR_2 == NEON_2RM_AESE) { gen_helper_crypto_aese(cpu_env, tmp, tmp2, tmp3); } else { gen_helper_crypto_aesmc(cpu_env, tmp, tmp2, tmp3); } tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp3); break; case NEON_2RM_SHA1H: if (!arm_dc_feature(VAR_0, ARM_FEATURE_V8_SHA1) || ((VAR_6 | VAR_4) & 1)) { return 1; } tmp = tcg_const_i32(VAR_4); tmp2 = tcg_const_i32(VAR_6); gen_helper_crypto_sha1h(cpu_env, tmp, tmp2); tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); break; case NEON_2RM_SHA1SU1: if ((VAR_6 | VAR_4) & 1) { return 1; } if (VAR_3) { if (!arm_dc_feature(VAR_0, ARM_FEATURE_V8_SHA256)) { return 1; } } else if (!arm_dc_feature(VAR_0, ARM_FEATURE_V8_SHA1)) { return 1; } tmp = tcg_const_i32(VAR_4); tmp2 = tcg_const_i32(VAR_6); if (VAR_3) { gen_helper_crypto_sha256su0(cpu_env, tmp, tmp2); } else { gen_helper_crypto_sha1su1(cpu_env, tmp, tmp2); } tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); break; default: elementwise: for (VAR_9 = 0; VAR_9 < (VAR_3 ? 4 : 2); VAR_9++) { if (neon_2rm_is_float_op(VAR_2)) { tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_6, VAR_9)); TCGV_UNUSED_I32(tmp); } else { tmp = neon_load_reg(VAR_6, VAR_9); } switch (VAR_2) { case NEON_2RM_VREV32: switch (VAR_7) { case 0: tcg_gen_bswap32_i32(tmp, tmp); break; case 1: gen_swap_half(tmp); break; default: abort(); } break; case NEON_2RM_VREV16: gen_rev16(tmp); break; case NEON_2RM_VCLS: switch (VAR_7) { case 0: gen_helper_neon_cls_s8(tmp, tmp); break; case 1: gen_helper_neon_cls_s16(tmp, tmp); break; case 2: gen_helper_neon_cls_s32(tmp, tmp); break; default: abort(); } break; case NEON_2RM_VCLZ: switch (VAR_7) { case 0: gen_helper_neon_clz_u8(tmp, tmp); break; case 1: gen_helper_neon_clz_u16(tmp, tmp); break; case 2: gen_helper_clz(tmp, tmp); break; default: abort(); } break; case NEON_2RM_VCNT: gen_helper_neon_cnt_u8(tmp, tmp); break; case NEON_2RM_VMVN: tcg_gen_not_i32(tmp, tmp); break; case NEON_2RM_VQABS: switch (VAR_7) { case 0: gen_helper_neon_qabs_s8(tmp, cpu_env, tmp); break; case 1: gen_helper_neon_qabs_s16(tmp, cpu_env, tmp); break; case 2: gen_helper_neon_qabs_s32(tmp, cpu_env, tmp); break; default: abort(); } break; case NEON_2RM_VQNEG: switch (VAR_7) { case 0: gen_helper_neon_qneg_s8(tmp, cpu_env, tmp); break; case 1: gen_helper_neon_qneg_s16(tmp, cpu_env, tmp); break; case 2: gen_helper_neon_qneg_s32(tmp, cpu_env, tmp); break; default: abort(); } break; case NEON_2RM_VCGT0: case NEON_2RM_VCLE0: tmp2 = tcg_const_i32(0); switch(VAR_7) { case 0: gen_helper_neon_cgt_s8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_cgt_s16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_cgt_s32(tmp, tmp, tmp2); break; default: abort(); } tcg_temp_free_i32(tmp2); if (VAR_2 == NEON_2RM_VCLE0) { tcg_gen_not_i32(tmp, tmp); } break; case NEON_2RM_VCGE0: case NEON_2RM_VCLT0: tmp2 = tcg_const_i32(0); switch(VAR_7) { case 0: gen_helper_neon_cge_s8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_cge_s16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_cge_s32(tmp, tmp, tmp2); break; default: abort(); } tcg_temp_free_i32(tmp2); if (VAR_2 == NEON_2RM_VCLT0) { tcg_gen_not_i32(tmp, tmp); } break; case NEON_2RM_VCEQ0: tmp2 = tcg_const_i32(0); switch(VAR_7) { case 0: gen_helper_neon_ceq_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_ceq_u16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_ceq_u32(tmp, tmp, tmp2); break; default: abort(); } tcg_temp_free_i32(tmp2); break; case NEON_2RM_VABS: switch(VAR_7) { case 0: gen_helper_neon_abs_s8(tmp, tmp); break; case 1: gen_helper_neon_abs_s16(tmp, tmp); break; case 2: tcg_gen_abs_i32(tmp, tmp); break; default: abort(); } break; case NEON_2RM_VNEG: tmp2 = tcg_const_i32(0); gen_neon_rsb(VAR_7, tmp, tmp2); tcg_temp_free_i32(tmp2); break; case NEON_2RM_VCGT0_F: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); tmp2 = tcg_const_i32(0); gen_helper_neon_cgt_f32(tmp, tmp, tmp2, fpstatus); tcg_temp_free_i32(tmp2); tcg_temp_free_ptr(fpstatus); break; } case NEON_2RM_VCGE0_F: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); tmp2 = tcg_const_i32(0); gen_helper_neon_cge_f32(tmp, tmp, tmp2, fpstatus); tcg_temp_free_i32(tmp2); tcg_temp_free_ptr(fpstatus); break; } case NEON_2RM_VCEQ0_F: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); tmp2 = tcg_const_i32(0); gen_helper_neon_ceq_f32(tmp, tmp, tmp2, fpstatus); tcg_temp_free_i32(tmp2); tcg_temp_free_ptr(fpstatus); break; } case NEON_2RM_VCLE0_F: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); tmp2 = tcg_const_i32(0); gen_helper_neon_cge_f32(tmp, tmp2, tmp, fpstatus); tcg_temp_free_i32(tmp2); tcg_temp_free_ptr(fpstatus); break; } case NEON_2RM_VCLT0_F: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); tmp2 = tcg_const_i32(0); gen_helper_neon_cgt_f32(tmp, tmp2, tmp, fpstatus); tcg_temp_free_i32(tmp2); tcg_temp_free_ptr(fpstatus); break; } case NEON_2RM_VABS_F: gen_vfp_abs(0); break; case NEON_2RM_VNEG_F: gen_vfp_neg(0); break; case NEON_2RM_VSWP: tmp2 = neon_load_reg(VAR_4, VAR_9); neon_store_reg(VAR_6, VAR_9, tmp2); break; case NEON_2RM_VTRN: tmp2 = neon_load_reg(VAR_4, VAR_9); switch (VAR_7) { case 0: gen_neon_trn_u8(tmp, tmp2); break; case 1: gen_neon_trn_u16(tmp, tmp2); break; default: abort(); } neon_store_reg(VAR_6, VAR_9, tmp2); break; case NEON_2RM_VRINTN: case NEON_2RM_VRINTA: case NEON_2RM_VRINTM: case NEON_2RM_VRINTP: case NEON_2RM_VRINTZ: { TCGv_i32 tcg_rmode; TCGv_ptr fpstatus = get_fpstatus_ptr(1); int VAR_23; if (VAR_2 == NEON_2RM_VRINTZ) { VAR_23 = FPROUNDING_ZERO; } else { VAR_23 = fp_decode_rm[((VAR_2 & 0x6) >> 1) ^ 1]; } tcg_rmode = tcg_const_i32(arm_rmode_to_sf(VAR_23)); gen_helper_set_neon_rmode(tcg_rmode, tcg_rmode, cpu_env); gen_helper_rints(cpu_F0s, cpu_F0s, fpstatus); gen_helper_set_neon_rmode(tcg_rmode, tcg_rmode, cpu_env); tcg_temp_free_ptr(fpstatus); tcg_temp_free_i32(tcg_rmode); break; } case NEON_2RM_VRINTX: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); gen_helper_rints_exact(cpu_F0s, cpu_F0s, fpstatus); tcg_temp_free_ptr(fpstatus); break; } case NEON_2RM_VCVTAU: case NEON_2RM_VCVTAS: case NEON_2RM_VCVTNU: case NEON_2RM_VCVTNS: case NEON_2RM_VCVTPU: case NEON_2RM_VCVTPS: case NEON_2RM_VCVTMU: case NEON_2RM_VCVTMS: { bool is_signed = !extract32(VAR_1, 7, 1); TCGv_ptr fpst = get_fpstatus_ptr(1); TCGv_i32 tcg_rmode, tcg_shift; int VAR_23 = fp_decode_rm[extract32(VAR_1, 8, 2)]; tcg_shift = tcg_const_i32(0); tcg_rmode = tcg_const_i32(arm_rmode_to_sf(VAR_23)); gen_helper_set_neon_rmode(tcg_rmode, tcg_rmode, cpu_env); if (is_signed) { gen_helper_vfp_tosls(cpu_F0s, cpu_F0s, tcg_shift, fpst); } else { gen_helper_vfp_touls(cpu_F0s, cpu_F0s, tcg_shift, fpst); } gen_helper_set_neon_rmode(tcg_rmode, tcg_rmode, cpu_env); tcg_temp_free_i32(tcg_rmode); tcg_temp_free_i32(tcg_shift); tcg_temp_free_ptr(fpst); break; } case NEON_2RM_VRECPE: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); gen_helper_recpe_u32(tmp, tmp, fpstatus); tcg_temp_free_ptr(fpstatus); break; } case NEON_2RM_VRSQRTE: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); gen_helper_rsqrte_u32(tmp, tmp, fpstatus); tcg_temp_free_ptr(fpstatus); break; } case NEON_2RM_VRECPE_F: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); gen_helper_recpe_f32(cpu_F0s, cpu_F0s, fpstatus); tcg_temp_free_ptr(fpstatus); break; } case NEON_2RM_VRSQRTE_F: { TCGv_ptr fpstatus = get_fpstatus_ptr(1); gen_helper_rsqrte_f32(cpu_F0s, cpu_F0s, fpstatus); tcg_temp_free_ptr(fpstatus); break; } case NEON_2RM_VCVT_FS: gen_vfp_sito(0, 1); break; case NEON_2RM_VCVT_FU: gen_vfp_uito(0, 1); break; case NEON_2RM_VCVT_SF: gen_vfp_tosiz(0, 1); break; case NEON_2RM_VCVT_UF: gen_vfp_touiz(0, 1); break; default: abort(); } if (neon_2rm_is_float_op(VAR_2)) { tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_4, VAR_9)); } else { neon_store_reg(VAR_4, VAR_9, tmp); } } break; } } else if ((VAR_1 & (1 << 10)) == 0) { int VAR_23 = ((VAR_1 >> 8) & 3) + 1; if ((VAR_5 + VAR_23) > 32) { return 1; } VAR_23 <<= 3; if (VAR_1 & (1 << 6)) { tmp = neon_load_reg(VAR_4, 0); } else { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, 0); } tmp2 = neon_load_reg(VAR_6, 0); tmp4 = tcg_const_i32(VAR_5); tmp5 = tcg_const_i32(VAR_23); gen_helper_neon_tbl(tmp2, cpu_env, tmp2, tmp, tmp4, tmp5); tcg_temp_free_i32(tmp); if (VAR_1 & (1 << 6)) { tmp = neon_load_reg(VAR_4, 1); } else { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, 0); } tmp3 = neon_load_reg(VAR_6, 1); gen_helper_neon_tbl(tmp3, cpu_env, tmp3, tmp, tmp4, tmp5); tcg_temp_free_i32(tmp5); tcg_temp_free_i32(tmp4); neon_store_reg(VAR_4, 0, tmp2); neon_store_reg(VAR_4, 1, tmp3); tcg_temp_free_i32(tmp); } else if ((VAR_1 & 0x380) == 0) { if ((VAR_1 & (7 << 16)) == 0 || (VAR_3 && (VAR_4 & 1))) { return 1; } if (VAR_1 & (1 << 19)) { tmp = neon_load_reg(VAR_6, 1); } else { tmp = neon_load_reg(VAR_6, 0); } if (VAR_1 & (1 << 16)) { gen_neon_dup_u8(tmp, ((VAR_1 >> 17) & 3) * 8); } else if (VAR_1 & (1 << 17)) { if ((VAR_1 >> 18) & 1) gen_neon_dup_high16(tmp); else gen_neon_dup_low16(tmp); } for (VAR_9 = 0; VAR_9 < (VAR_3 ? 4 : 2); VAR_9++) { tmp2 = tcg_temp_new_i32(); tcg_gen_mov_i32(tmp2, tmp); neon_store_reg(VAR_4, VAR_9, tmp2); } tcg_temp_free_i32(tmp); } else { return 1; } } } return 0; }
[ "static int FUNC_0(DisasContext *VAR_0, uint32_t VAR_1)\n{", "int VAR_2;", "int VAR_3;", "int VAR_4, VAR_5, VAR_6;", "int VAR_7;", "int VAR_8;", "int VAR_9;", "int VAR_10;", "int VAR_11;", "int VAR_12;", "uint32_t imm, mask;", "TCGv_i32 tmp, tmp2, tmp3, tmp4, tmp5;", "TCGv_i64 tmp64;", "if (!VAR_0->cpacr_fpen) {", "gen_exception_insn(VAR_0, 4, EXCP_UDEF,\nsyn_fp_access_trap(1, 0xe, VAR_0->thumb),\ndefault_exception_el(VAR_0));", "return 0;", "}", "if (!VAR_0->vfp_enabled)\nreturn 1;", "VAR_3 = (VAR_1 & (1 << 6)) != 0;", "VAR_12 = (VAR_1 >> 24) & 1;", "VFP_DREG_D(VAR_4, VAR_1);", "VFP_DREG_N(VAR_5, VAR_1);", "VFP_DREG_M(VAR_6, VAR_1);", "VAR_7 = (VAR_1 >> 20) & 3;", "if ((VAR_1 & (1 << 23)) == 0) {", "VAR_2 = ((VAR_1 >> 7) & 0x1e) | ((VAR_1 >> 4) & 1);", "if ((neon_3r_sizes[VAR_2] & (1 << VAR_7)) == 0) {", "return 1;", "}", "if (VAR_3 && ((VAR_4 | VAR_5 | VAR_6) & 1)) {", "return 1;", "}", "if (VAR_2 == NEON_3R_SHA) {", "if (!VAR_3) {", "return 1;", "}", "if (!VAR_12) {", "if (!arm_dc_feature(VAR_0, ARM_FEATURE_V8_SHA1)) {", "return 1;", "}", "tmp = tcg_const_i32(VAR_4);", "tmp2 = tcg_const_i32(VAR_5);", "tmp3 = tcg_const_i32(VAR_6);", "tmp4 = tcg_const_i32(VAR_7);", "gen_helper_crypto_sha1_3reg(cpu_env, tmp, tmp2, tmp3, tmp4);", "tcg_temp_free_i32(tmp4);", "} else {", "if (!arm_dc_feature(VAR_0, ARM_FEATURE_V8_SHA256) || VAR_7 == 3) {", "return 1;", "}", "tmp = tcg_const_i32(VAR_4);", "tmp2 = tcg_const_i32(VAR_5);", "tmp3 = tcg_const_i32(VAR_6);", "switch (VAR_7) {", "case 0:\ngen_helper_crypto_sha256h(cpu_env, tmp, tmp2, tmp3);", "break;", "case 1:\ngen_helper_crypto_sha256h2(cpu_env, tmp, tmp2, tmp3);", "break;", "case 2:\ngen_helper_crypto_sha256su1(cpu_env, tmp, tmp2, tmp3);", "break;", "}", "}", "tcg_temp_free_i32(tmp);", "tcg_temp_free_i32(tmp2);", "tcg_temp_free_i32(tmp3);", "return 0;", "}", "if (VAR_7 == 3 && VAR_2 != NEON_3R_LOGIC) {", "for (VAR_9 = 0; VAR_9 < (VAR_3 ? 2 : 1); VAR_9++) {", "neon_load_reg64(cpu_V0, VAR_5 + VAR_9);", "neon_load_reg64(cpu_V1, VAR_6 + VAR_9);", "switch (VAR_2) {", "case NEON_3R_VQADD:\nif (VAR_12) {", "gen_helper_neon_qadd_u64(cpu_V0, cpu_env,\ncpu_V0, cpu_V1);", "} else {", "gen_helper_neon_qadd_s64(cpu_V0, cpu_env,\ncpu_V0, cpu_V1);", "}", "break;", "case NEON_3R_VQSUB:\nif (VAR_12) {", "gen_helper_neon_qsub_u64(cpu_V0, cpu_env,\ncpu_V0, cpu_V1);", "} else {", "gen_helper_neon_qsub_s64(cpu_V0, cpu_env,\ncpu_V0, cpu_V1);", "}", "break;", "case NEON_3R_VSHL:\nif (VAR_12) {", "gen_helper_neon_shl_u64(cpu_V0, cpu_V1, cpu_V0);", "} else {", "gen_helper_neon_shl_s64(cpu_V0, cpu_V1, cpu_V0);", "}", "break;", "case NEON_3R_VQSHL:\nif (VAR_12) {", "gen_helper_neon_qshl_u64(cpu_V0, cpu_env,\ncpu_V1, cpu_V0);", "} else {", "gen_helper_neon_qshl_s64(cpu_V0, cpu_env,\ncpu_V1, cpu_V0);", "}", "break;", "case NEON_3R_VRSHL:\nif (VAR_12) {", "gen_helper_neon_rshl_u64(cpu_V0, cpu_V1, cpu_V0);", "} else {", "gen_helper_neon_rshl_s64(cpu_V0, cpu_V1, cpu_V0);", "}", "break;", "case NEON_3R_VQRSHL:\nif (VAR_12) {", "gen_helper_neon_qrshl_u64(cpu_V0, cpu_env,\ncpu_V1, cpu_V0);", "} else {", "gen_helper_neon_qrshl_s64(cpu_V0, cpu_env,\ncpu_V1, cpu_V0);", "}", "break;", "case NEON_3R_VADD_VSUB:\nif (VAR_12) {", "tcg_gen_sub_i64(CPU_V001);", "} else {", "tcg_gen_add_i64(CPU_V001);", "}", "break;", "default:\nabort();", "}", "neon_store_reg64(cpu_V0, VAR_4 + VAR_9);", "}", "return 0;", "}", "VAR_11 = 0;", "switch (VAR_2) {", "case NEON_3R_VSHL:\ncase NEON_3R_VQSHL:\ncase NEON_3R_VRSHL:\ncase NEON_3R_VQRSHL:\n{", "int VAR_13;", "VAR_13 = VAR_5;", "VAR_5 = VAR_6;", "VAR_6 = VAR_13;", "}", "break;", "case NEON_3R_VPADD:\nif (VAR_12) {", "return 1;", "}", "case NEON_3R_VPMAX:\ncase NEON_3R_VPMIN:\nVAR_11 = 1;", "break;", "case NEON_3R_FLOAT_ARITH:\nVAR_11 = (VAR_12 && VAR_7 < 2);", "break;", "case NEON_3R_FLOAT_MINMAX:\nVAR_11 = VAR_12;", "break;", "case NEON_3R_FLOAT_CMP:\nif (!VAR_12 && VAR_7) {", "return 1;", "}", "break;", "case NEON_3R_FLOAT_ACMP:\nif (!VAR_12) {", "return 1;", "}", "break;", "case NEON_3R_FLOAT_MISC:\nif (VAR_12 && !arm_dc_feature(VAR_0, ARM_FEATURE_V8)) {", "return 1;", "}", "break;", "case NEON_3R_VMUL:\nif (VAR_12 && (VAR_7 != 0)) {", "return 1;", "}", "break;", "case NEON_3R_VFM:\nif (!arm_dc_feature(VAR_0, ARM_FEATURE_VFP4) || VAR_12) {", "return 1;", "}", "break;", "default:\nbreak;", "}", "if (VAR_11 && VAR_3) {", "return 1;", "}", "for (VAR_9 = 0; VAR_9 < (VAR_3 ? 4 : 2); VAR_9++) {", "if (VAR_11) {", "if (VAR_9 < 1) {", "tmp = neon_load_reg(VAR_5, 0);", "tmp2 = neon_load_reg(VAR_5, 1);", "} else {", "tmp = neon_load_reg(VAR_6, 0);", "tmp2 = neon_load_reg(VAR_6, 1);", "}", "} else {", "tmp = neon_load_reg(VAR_5, VAR_9);", "tmp2 = neon_load_reg(VAR_6, VAR_9);", "}", "switch (VAR_2) {", "case NEON_3R_VHADD:\nGEN_NEON_INTEGER_OP(hadd);", "break;", "case NEON_3R_VQADD:\nGEN_NEON_INTEGER_OP_ENV(qadd);", "break;", "case NEON_3R_VRHADD:\nGEN_NEON_INTEGER_OP(rhadd);", "break;", "case NEON_3R_LOGIC:\nswitch ((VAR_12 << 2) | VAR_7) {", "case 0:\ntcg_gen_and_i32(tmp, tmp, tmp2);", "break;", "case 1:\ntcg_gen_andc_i32(tmp, tmp, tmp2);", "break;", "case 2:\ntcg_gen_or_i32(tmp, tmp, tmp2);", "break;", "case 3:\ntcg_gen_orc_i32(tmp, tmp, tmp2);", "break;", "case 4:\ntcg_gen_xor_i32(tmp, tmp, tmp2);", "break;", "case 5:\ntmp3 = neon_load_reg(VAR_4, VAR_9);", "gen_neon_bsl(tmp, tmp, tmp2, tmp3);", "tcg_temp_free_i32(tmp3);", "break;", "case 6:\ntmp3 = neon_load_reg(VAR_4, VAR_9);", "gen_neon_bsl(tmp, tmp, tmp3, tmp2);", "tcg_temp_free_i32(tmp3);", "break;", "case 7:\ntmp3 = neon_load_reg(VAR_4, VAR_9);", "gen_neon_bsl(tmp, tmp3, tmp, tmp2);", "tcg_temp_free_i32(tmp3);", "break;", "}", "break;", "case NEON_3R_VHSUB:\nGEN_NEON_INTEGER_OP(hsub);", "break;", "case NEON_3R_VQSUB:\nGEN_NEON_INTEGER_OP_ENV(qsub);", "break;", "case NEON_3R_VCGT:\nGEN_NEON_INTEGER_OP(cgt);", "break;", "case NEON_3R_VCGE:\nGEN_NEON_INTEGER_OP(cge);", "break;", "case NEON_3R_VSHL:\nGEN_NEON_INTEGER_OP(shl);", "break;", "case NEON_3R_VQSHL:\nGEN_NEON_INTEGER_OP_ENV(qshl);", "break;", "case NEON_3R_VRSHL:\nGEN_NEON_INTEGER_OP(rshl);", "break;", "case NEON_3R_VQRSHL:\nGEN_NEON_INTEGER_OP_ENV(qrshl);", "break;", "case NEON_3R_VMAX:\nGEN_NEON_INTEGER_OP(max);", "break;", "case NEON_3R_VMIN:\nGEN_NEON_INTEGER_OP(min);", "break;", "case NEON_3R_VABD:\nGEN_NEON_INTEGER_OP(abd);", "break;", "case NEON_3R_VABA:\nGEN_NEON_INTEGER_OP(abd);", "tcg_temp_free_i32(tmp2);", "tmp2 = neon_load_reg(VAR_4, VAR_9);", "gen_neon_add(VAR_7, tmp, tmp2);", "break;", "case NEON_3R_VADD_VSUB:\nif (!VAR_12) {", "gen_neon_add(VAR_7, tmp, tmp2);", "} else {", "switch (VAR_7) {", "case 0: gen_helper_neon_sub_u8(tmp, tmp, tmp2); break;", "case 1: gen_helper_neon_sub_u16(tmp, tmp, tmp2); break;", "case 2: tcg_gen_sub_i32(tmp, tmp, tmp2); break;", "default: abort();", "}", "}", "break;", "case NEON_3R_VTST_VCEQ:\nif (!VAR_12) {", "switch (VAR_7) {", "case 0: gen_helper_neon_tst_u8(tmp, tmp, tmp2); break;", "case 1: gen_helper_neon_tst_u16(tmp, tmp, tmp2); break;", "case 2: gen_helper_neon_tst_u32(tmp, tmp, tmp2); break;", "default: abort();", "}", "} else {", "switch (VAR_7) {", "case 0: gen_helper_neon_ceq_u8(tmp, tmp, tmp2); break;", "case 1: gen_helper_neon_ceq_u16(tmp, tmp, tmp2); break;", "case 2: gen_helper_neon_ceq_u32(tmp, tmp, tmp2); break;", "default: abort();", "}", "}", "break;", "case NEON_3R_VML:\nswitch (VAR_7) {", "case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break;", "case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break;", "case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break;", "default: abort();", "}", "tcg_temp_free_i32(tmp2);", "tmp2 = neon_load_reg(VAR_4, VAR_9);", "if (VAR_12) {", "gen_neon_rsb(VAR_7, tmp, tmp2);", "} else {", "gen_neon_add(VAR_7, tmp, tmp2);", "}", "break;", "case NEON_3R_VMUL:\nif (VAR_12) {", "gen_helper_neon_mul_p8(tmp, tmp, tmp2);", "} else {", "switch (VAR_7) {", "case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break;", "case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break;", "case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break;", "default: abort();", "}", "}", "break;", "case NEON_3R_VPMAX:\nGEN_NEON_INTEGER_OP(pmax);", "break;", "case NEON_3R_VPMIN:\nGEN_NEON_INTEGER_OP(pmin);", "break;", "case NEON_3R_VQDMULH_VQRDMULH:\nif (!VAR_12) {", "switch (VAR_7) {", "case 1:\ngen_helper_neon_qdmulh_s16(tmp, cpu_env, tmp, tmp2);", "break;", "case 2:\ngen_helper_neon_qdmulh_s32(tmp, cpu_env, tmp, tmp2);", "break;", "default: abort();", "}", "} else {", "switch (VAR_7) {", "case 1:\ngen_helper_neon_qrdmulh_s16(tmp, cpu_env, tmp, tmp2);", "break;", "case 2:\ngen_helper_neon_qrdmulh_s32(tmp, cpu_env, tmp, tmp2);", "break;", "default: abort();", "}", "}", "break;", "case NEON_3R_VPADD:\nswitch (VAR_7) {", "case 0: gen_helper_neon_padd_u8(tmp, tmp, tmp2); break;", "case 1: gen_helper_neon_padd_u16(tmp, tmp, tmp2); break;", "case 2: tcg_gen_add_i32(tmp, tmp, tmp2); break;", "default: abort();", "}", "break;", "case NEON_3R_FLOAT_ARITH:\n{", "TCGv_ptr fpstatus = get_fpstatus_ptr(1);", "switch ((VAR_12 << 2) | VAR_7) {", "case 0:\ncase 4:\ngen_helper_vfp_adds(tmp, tmp, tmp2, fpstatus);", "break;", "case 2:\ngen_helper_vfp_subs(tmp, tmp, tmp2, fpstatus);", "break;", "case 6:\ngen_helper_neon_abd_f32(tmp, tmp, tmp2, fpstatus);", "break;", "default:\nabort();", "}", "tcg_temp_free_ptr(fpstatus);", "break;", "}", "case NEON_3R_FLOAT_MULTIPLY:\n{", "TCGv_ptr fpstatus = get_fpstatus_ptr(1);", "gen_helper_vfp_muls(tmp, tmp, tmp2, fpstatus);", "if (!VAR_12) {", "tcg_temp_free_i32(tmp2);", "tmp2 = neon_load_reg(VAR_4, VAR_9);", "if (VAR_7 == 0) {", "gen_helper_vfp_adds(tmp, tmp, tmp2, fpstatus);", "} else {", "gen_helper_vfp_subs(tmp, tmp2, tmp, fpstatus);", "}", "}", "tcg_temp_free_ptr(fpstatus);", "break;", "}", "case NEON_3R_FLOAT_CMP:\n{", "TCGv_ptr fpstatus = get_fpstatus_ptr(1);", "if (!VAR_12) {", "gen_helper_neon_ceq_f32(tmp, tmp, tmp2, fpstatus);", "} else {", "if (VAR_7 == 0) {", "gen_helper_neon_cge_f32(tmp, tmp, tmp2, fpstatus);", "} else {", "gen_helper_neon_cgt_f32(tmp, tmp, tmp2, fpstatus);", "}", "}", "tcg_temp_free_ptr(fpstatus);", "break;", "}", "case NEON_3R_FLOAT_ACMP:\n{", "TCGv_ptr fpstatus = get_fpstatus_ptr(1);", "if (VAR_7 == 0) {", "gen_helper_neon_acge_f32(tmp, tmp, tmp2, fpstatus);", "} else {", "gen_helper_neon_acgt_f32(tmp, tmp, tmp2, fpstatus);", "}", "tcg_temp_free_ptr(fpstatus);", "break;", "}", "case NEON_3R_FLOAT_MINMAX:\n{", "TCGv_ptr fpstatus = get_fpstatus_ptr(1);", "if (VAR_7 == 0) {", "gen_helper_vfp_maxs(tmp, tmp, tmp2, fpstatus);", "} else {", "gen_helper_vfp_mins(tmp, tmp, tmp2, fpstatus);", "}", "tcg_temp_free_ptr(fpstatus);", "break;", "}", "case NEON_3R_FLOAT_MISC:\nif (VAR_12) {", "TCGv_ptr fpstatus = get_fpstatus_ptr(1);", "if (VAR_7 == 0) {", "gen_helper_vfp_maxnums(tmp, tmp, tmp2, fpstatus);", "} else {", "gen_helper_vfp_minnums(tmp, tmp, tmp2, fpstatus);", "}", "tcg_temp_free_ptr(fpstatus);", "} else {", "if (VAR_7 == 0) {", "gen_helper_recps_f32(tmp, tmp, tmp2, cpu_env);", "} else {", "gen_helper_rsqrts_f32(tmp, tmp, tmp2, cpu_env);", "}", "}", "break;", "case NEON_3R_VFM:\n{", "TCGv_ptr fpstatus = get_fpstatus_ptr(1);", "TCGv_i32 tmp3 = neon_load_reg(VAR_4, VAR_9);", "if (VAR_7) {", "gen_helper_vfp_negs(tmp, tmp);", "}", "gen_helper_vfp_muladds(tmp, tmp, tmp2, tmp3, fpstatus);", "tcg_temp_free_i32(tmp3);", "tcg_temp_free_ptr(fpstatus);", "break;", "}", "default:\nabort();", "}", "tcg_temp_free_i32(tmp2);", "if (VAR_11 && VAR_4 == VAR_6) {", "neon_store_scratch(VAR_9, tmp);", "} else {", "neon_store_reg(VAR_4, VAR_9, tmp);", "}", "}", "if (VAR_11 && VAR_4 == VAR_6) {", "for (VAR_9 = 0; VAR_9 < (VAR_3 ? 4 : 2); VAR_9++) {", "tmp = neon_load_scratch(VAR_9);", "neon_store_reg(VAR_4, VAR_9, tmp);", "}", "}", "} else if (VAR_1 & (1 << 4)) {", "if ((VAR_1 & 0x00380080) != 0) {", "VAR_2 = (VAR_1 >> 8) & 0xf;", "if (VAR_1 & (1 << 7)) {", "if (VAR_2 > 7) {", "return 1;", "}", "VAR_7 = 3;", "} else {", "VAR_7 = 2;", "while ((VAR_1 & (1 << (VAR_7 + 19))) == 0)\nVAR_7--;", "}", "VAR_8 = (VAR_1 >> 16) & ((1 << (3 + VAR_7)) - 1);", "if (VAR_2 < 8) {", "if (VAR_3 && ((VAR_4 | VAR_6) & 1)) {", "return 1;", "}", "if (!VAR_12 && (VAR_2 == 4 || VAR_2 == 6)) {", "return 1;", "}", "if (VAR_2 <= 4)\nVAR_8 = VAR_8 - (1 << (VAR_7 + 3));", "if (VAR_7 == 3) {", "VAR_10 = VAR_3 + 1;", "} else {", "VAR_10 = VAR_3 ? 4: 2;", "}", "switch (VAR_7) {", "case 0:\nimm = (uint8_t) VAR_8;", "imm |= imm << 8;", "imm |= imm << 16;", "break;", "case 1:\nimm = (uint16_t) VAR_8;", "imm |= imm << 16;", "break;", "case 2:\ncase 3:\nimm = VAR_8;", "break;", "default:\nabort();", "}", "for (VAR_9 = 0; VAR_9 < VAR_10; VAR_9++) {", "if (VAR_7 == 3) {", "neon_load_reg64(cpu_V0, VAR_6 + VAR_9);", "tcg_gen_movi_i64(cpu_V1, imm);", "switch (VAR_2) {", "case 0:\ncase 1:\nif (VAR_12)\ngen_helper_neon_shl_u64(cpu_V0, cpu_V0, cpu_V1);", "else\ngen_helper_neon_shl_s64(cpu_V0, cpu_V0, cpu_V1);", "break;", "case 2:\ncase 3:\nif (VAR_12)\ngen_helper_neon_rshl_u64(cpu_V0, cpu_V0, cpu_V1);", "else\ngen_helper_neon_rshl_s64(cpu_V0, cpu_V0, cpu_V1);", "break;", "case 4:\ncase 5:\ngen_helper_neon_shl_u64(cpu_V0, cpu_V0, cpu_V1);", "break;", "case 6:\ngen_helper_neon_qshlu_s64(cpu_V0, cpu_env,\ncpu_V0, cpu_V1);", "break;", "case 7:\nif (VAR_12) {", "gen_helper_neon_qshl_u64(cpu_V0, cpu_env,\ncpu_V0, cpu_V1);", "} else {", "gen_helper_neon_qshl_s64(cpu_V0, cpu_env,\ncpu_V0, cpu_V1);", "}", "break;", "}", "if (VAR_2 == 1 || VAR_2 == 3) {", "neon_load_reg64(cpu_V1, VAR_4 + VAR_9);", "tcg_gen_add_i64(cpu_V0, cpu_V0, cpu_V1);", "} else if (VAR_2 == 4 || (VAR_2 == 5 && VAR_12)) {", "neon_load_reg64(cpu_V1, VAR_4 + VAR_9);", "uint64_t mask;", "if (VAR_8 < -63 || VAR_8 > 63) {", "mask = 0;", "} else {", "if (VAR_2 == 4) {", "mask = 0xffffffffffffffffull >> -VAR_8;", "} else {", "mask = 0xffffffffffffffffull << VAR_8;", "}", "}", "tcg_gen_andi_i64(cpu_V1, cpu_V1, ~mask);", "tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1);", "}", "neon_store_reg64(cpu_V0, VAR_4 + VAR_9);", "} else {", "tmp = neon_load_reg(VAR_6, VAR_9);", "tmp2 = tcg_temp_new_i32();", "tcg_gen_movi_i32(tmp2, imm);", "switch (VAR_2) {", "case 0:\ncase 1:\nGEN_NEON_INTEGER_OP(shl);", "break;", "case 2:\ncase 3:\nGEN_NEON_INTEGER_OP(rshl);", "break;", "case 4:\ncase 5:\nswitch (VAR_7) {", "case 0: gen_helper_neon_shl_u8(tmp, tmp, tmp2); break;", "case 1: gen_helper_neon_shl_u16(tmp, tmp, tmp2); break;", "case 2: gen_helper_neon_shl_u32(tmp, tmp, tmp2); break;", "default: abort();", "}", "break;", "case 6:\nswitch (VAR_7) {", "case 0:\ngen_helper_neon_qshlu_s8(tmp, cpu_env,\ntmp, tmp2);", "break;", "case 1:\ngen_helper_neon_qshlu_s16(tmp, cpu_env,\ntmp, tmp2);", "break;", "case 2:\ngen_helper_neon_qshlu_s32(tmp, cpu_env,\ntmp, tmp2);", "break;", "default:\nabort();", "}", "break;", "case 7:\nGEN_NEON_INTEGER_OP_ENV(qshl);", "break;", "}", "tcg_temp_free_i32(tmp2);", "if (VAR_2 == 1 || VAR_2 == 3) {", "tmp2 = neon_load_reg(VAR_4, VAR_9);", "gen_neon_add(VAR_7, tmp, tmp2);", "tcg_temp_free_i32(tmp2);", "} else if (VAR_2 == 4 || (VAR_2 == 5 && VAR_12)) {", "switch (VAR_7) {", "case 0:\nif (VAR_2 == 4)\nmask = 0xff >> -VAR_8;", "else\nmask = (uint8_t)(0xff << VAR_8);", "mask |= mask << 8;", "mask |= mask << 16;", "break;", "case 1:\nif (VAR_2 == 4)\nmask = 0xffff >> -VAR_8;", "else\nmask = (uint16_t)(0xffff << VAR_8);", "mask |= mask << 16;", "break;", "case 2:\nif (VAR_8 < -31 || VAR_8 > 31) {", "mask = 0;", "} else {", "if (VAR_2 == 4)\nmask = 0xffffffffu >> -VAR_8;", "else\nmask = 0xffffffffu << VAR_8;", "}", "break;", "default:\nabort();", "}", "tmp2 = neon_load_reg(VAR_4, VAR_9);", "tcg_gen_andi_i32(tmp, tmp, mask);", "tcg_gen_andi_i32(tmp2, tmp2, ~mask);", "tcg_gen_or_i32(tmp, tmp, tmp2);", "tcg_temp_free_i32(tmp2);", "}", "neon_store_reg(VAR_4, VAR_9, tmp);", "}", "}", "} else if (VAR_2 < 10) {", "int VAR_14 = (VAR_2 == 8) ? !VAR_12 : VAR_12;", "if (VAR_6 & 1) {", "return 1;", "}", "VAR_8 = VAR_8 - (1 << (VAR_7 + 3));", "VAR_7++;", "if (VAR_7 == 3) {", "tmp64 = tcg_const_i64(VAR_8);", "neon_load_reg64(cpu_V0, VAR_6);", "neon_load_reg64(cpu_V1, VAR_6 + 1);", "for (VAR_9 = 0; VAR_9 < 2; VAR_9++) {", "TCGv_i64 in;", "if (VAR_9 == 0) {", "in = cpu_V0;", "} else {", "in = cpu_V1;", "}", "if (VAR_3) {", "if (VAR_14) {", "gen_helper_neon_rshl_u64(cpu_V0, in, tmp64);", "} else {", "gen_helper_neon_rshl_s64(cpu_V0, in, tmp64);", "}", "} else {", "if (VAR_14) {", "gen_helper_neon_shl_u64(cpu_V0, in, tmp64);", "} else {", "gen_helper_neon_shl_s64(cpu_V0, in, tmp64);", "}", "}", "tmp = tcg_temp_new_i32();", "gen_neon_narrow_op(VAR_2 == 8, VAR_12, VAR_7 - 1, tmp, cpu_V0);", "neon_store_reg(VAR_4, VAR_9, tmp);", "}", "tcg_temp_free_i64(tmp64);", "} else {", "if (VAR_7 == 1) {", "imm = (uint16_t)VAR_8;", "imm |= imm << 16;", "} else {", "imm = (uint32_t)VAR_8;", "}", "tmp2 = tcg_const_i32(imm);", "tmp4 = neon_load_reg(VAR_6 + 1, 0);", "tmp5 = neon_load_reg(VAR_6 + 1, 1);", "for (VAR_9 = 0; VAR_9 < 2; VAR_9++) {", "if (VAR_9 == 0) {", "tmp = neon_load_reg(VAR_6, 0);", "} else {", "tmp = tmp4;", "}", "gen_neon_shift_narrow(VAR_7, tmp, tmp2, VAR_3,\nVAR_14);", "if (VAR_9 == 0) {", "tmp3 = neon_load_reg(VAR_6, 1);", "} else {", "tmp3 = tmp5;", "}", "gen_neon_shift_narrow(VAR_7, tmp3, tmp2, VAR_3,\nVAR_14);", "tcg_gen_concat_i32_i64(cpu_V0, tmp, tmp3);", "tcg_temp_free_i32(tmp);", "tcg_temp_free_i32(tmp3);", "tmp = tcg_temp_new_i32();", "gen_neon_narrow_op(VAR_2 == 8, VAR_12, VAR_7 - 1, tmp, cpu_V0);", "neon_store_reg(VAR_4, VAR_9, tmp);", "}", "tcg_temp_free_i32(tmp2);", "}", "} else if (VAR_2 == 10) {", "if (VAR_3 || (VAR_4 & 1)) {", "return 1;", "}", "tmp = neon_load_reg(VAR_6, 0);", "tmp2 = neon_load_reg(VAR_6, 1);", "for (VAR_9 = 0; VAR_9 < 2; VAR_9++) {", "if (VAR_9 == 1)\ntmp = tmp2;", "gen_neon_widen(cpu_V0, tmp, VAR_7, VAR_12);", "if (VAR_8 != 0) {", "tcg_gen_shli_i64(cpu_V0, cpu_V0, VAR_8);", "if (VAR_7 < 2 || !VAR_12) {", "uint64_t imm64;", "if (VAR_7 == 0) {", "imm = (0xffu >> (8 - VAR_8));", "imm |= imm << 16;", "} else if (VAR_7 == 1) {", "imm = 0xffff >> (16 - VAR_8);", "} else {", "imm = 0xffffffff >> (32 - VAR_8);", "}", "if (VAR_7 < 2) {", "imm64 = imm | (((uint64_t)imm) << 32);", "} else {", "imm64 = imm;", "}", "tcg_gen_andi_i64(cpu_V0, cpu_V0, ~imm64);", "}", "}", "neon_store_reg64(cpu_V0, VAR_4 + VAR_9);", "}", "} else if (VAR_2 >= 14) {", "if (!(VAR_1 & (1 << 21)) || (VAR_3 && ((VAR_4 | VAR_6) & 1))) {", "return 1;", "}", "VAR_8 = 32 - VAR_8;", "for (VAR_9 = 0; VAR_9 < (VAR_3 ? 4 : 2); VAR_9++) {", "tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_6, VAR_9));", "if (!(VAR_2 & 1)) {", "if (VAR_12)\ngen_vfp_ulto(0, VAR_8, 1);", "else\ngen_vfp_slto(0, VAR_8, 1);", "} else {", "if (VAR_12)\ngen_vfp_toul(0, VAR_8, 1);", "else\ngen_vfp_tosl(0, VAR_8, 1);", "}", "tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_4, VAR_9));", "}", "} else {", "return 1;", "}", "} else {", "int VAR_15;", "if (VAR_3 && (VAR_4 & 1)) {", "return 1;", "}", "VAR_2 = (VAR_1 >> 8) & 0xf;", "imm = (VAR_12 << 7) | ((VAR_1 >> 12) & 0x70) | (VAR_1 & 0xf);", "VAR_15 = (VAR_1 & (1 << 5)) != 0;", "switch (VAR_2) {", "case 0: case 1:\nbreak;", "case 2: case 3:\nimm <<= 8;", "break;", "case 4: case 5:\nimm <<= 16;", "break;", "case 6: case 7:\nimm <<= 24;", "break;", "case 8: case 9:\nimm |= imm << 16;", "break;", "case 10: case 11:\nimm = (imm << 8) | (imm << 24);", "break;", "case 12:\nimm = (imm << 8) | 0xff;", "break;", "case 13:\nimm = (imm << 16) | 0xffff;", "break;", "case 14:\nimm |= (imm << 8) | (imm << 16) | (imm << 24);", "if (VAR_15)\nimm = ~imm;", "break;", "case 15:\nif (VAR_15) {", "return 1;", "}", "imm = ((imm & 0x80) << 24) | ((imm & 0x3f) << 19)\n| ((imm & 0x40) ? (0x1f << 25) : (1 << 30));", "break;", "}", "if (VAR_15)\nimm = ~imm;", "for (VAR_9 = 0; VAR_9 < (VAR_3 ? 4 : 2); VAR_9++) {", "if (VAR_2 & 1 && VAR_2 < 12) {", "tmp = neon_load_reg(VAR_4, VAR_9);", "if (VAR_15) {", "tcg_gen_andi_i32(tmp, tmp, imm);", "} else {", "tcg_gen_ori_i32(tmp, tmp, imm);", "}", "} else {", "tmp = tcg_temp_new_i32();", "if (VAR_2 == 14 && VAR_15) {", "int VAR_23;", "uint32_t val;", "val = 0;", "for (VAR_23 = 0; VAR_23 < 4; VAR_23++) {", "if (imm & (1 << (VAR_23 + (VAR_9 & 1) * 4)))\nval |= 0xff << (VAR_23 * 8);", "}", "tcg_gen_movi_i32(tmp, val);", "} else {", "tcg_gen_movi_i32(tmp, imm);", "}", "}", "neon_store_reg(VAR_4, VAR_9, tmp);", "}", "}", "} else {", "if (VAR_7 != 3) {", "VAR_2 = (VAR_1 >> 8) & 0xf;", "if ((VAR_1 & (1 << 6)) == 0) {", "int VAR_17;", "int VAR_18;", "int VAR_19;", "int VAR_20;", "static const int VAR_21[16][4] = {", "{1, 0, 0, 0},", "{1, 1, 0, 0},", "{1, 0, 0, 0},", "{1, 1, 0, 0},", "{0, 1, 1, 0},", "{0, 0, 0, 0},", "{0, 1, 1, 0},", "{0, 0, 0, 0},", "{0, 0, 0, 0},", "{0, 0, 0, 9},", "{0, 0, 0, 0},", "{0, 0, 0, 9},", "{0, 0, 0, 0},", "{0, 0, 0, 1},", "{0, 0, 0, 0xa},", "{0, 0, 0, 7},", "};", "VAR_19 = VAR_21[VAR_2][0];", "VAR_17 = VAR_21[VAR_2][1];", "VAR_18 = VAR_21[VAR_2][2];", "VAR_20 = VAR_21[VAR_2][3];", "if ((VAR_20 & (1 << VAR_7)) ||\n((VAR_20 & 8) && VAR_12)) {", "return 1;", "}", "if ((VAR_17 && (VAR_5 & 1)) ||\n(VAR_18 && (VAR_6 & 1)) ||\n(!VAR_18 && (VAR_4 & 1))) {", "return 1;", "}", "if (VAR_2 == 14 && VAR_7 == 2) {", "TCGv_i64 tcg_rn, tcg_rm, tcg_rd;", "if (!arm_dc_feature(VAR_0, ARM_FEATURE_V8_PMULL)) {", "return 1;", "}", "tcg_rn = tcg_temp_new_i64();", "tcg_rm = tcg_temp_new_i64();", "tcg_rd = tcg_temp_new_i64();", "neon_load_reg64(tcg_rn, VAR_5);", "neon_load_reg64(tcg_rm, VAR_6);", "gen_helper_neon_pmull_64_lo(tcg_rd, tcg_rn, tcg_rm);", "neon_store_reg64(tcg_rd, VAR_4);", "gen_helper_neon_pmull_64_hi(tcg_rd, tcg_rn, tcg_rm);", "neon_store_reg64(tcg_rd, VAR_4 + 1);", "tcg_temp_free_i64(tcg_rn);", "tcg_temp_free_i64(tcg_rm);", "tcg_temp_free_i64(tcg_rd);", "return 0;", "}", "if (VAR_4 == VAR_6 && !VAR_18) {", "tmp = neon_load_reg(VAR_6, 1);", "neon_store_scratch(2, tmp);", "} else if (VAR_4 == VAR_5 && !VAR_17) {", "tmp = neon_load_reg(VAR_5, 1);", "neon_store_scratch(2, tmp);", "}", "TCGV_UNUSED_I32(tmp3);", "for (VAR_9 = 0; VAR_9 < 2; VAR_9++) {", "if (VAR_17) {", "neon_load_reg64(cpu_V0, VAR_5 + VAR_9);", "TCGV_UNUSED_I32(tmp);", "} else {", "if (VAR_9 == 1 && VAR_4 == VAR_5) {", "tmp = neon_load_scratch(2);", "} else {", "tmp = neon_load_reg(VAR_5, VAR_9);", "}", "if (VAR_19) {", "gen_neon_widen(cpu_V0, tmp, VAR_7, VAR_12);", "}", "}", "if (VAR_18) {", "neon_load_reg64(cpu_V1, VAR_6 + VAR_9);", "TCGV_UNUSED_I32(tmp2);", "} else {", "if (VAR_9 == 1 && VAR_4 == VAR_6) {", "tmp2 = neon_load_scratch(2);", "} else {", "tmp2 = neon_load_reg(VAR_6, VAR_9);", "}", "if (VAR_19) {", "gen_neon_widen(cpu_V1, tmp2, VAR_7, VAR_12);", "}", "}", "switch (VAR_2) {", "case 0: case 1: case 4:\ngen_neon_addl(VAR_7);", "break;", "case 2: case 3: case 6:\ngen_neon_subl(VAR_7);", "break;", "case 5: case 7:\nswitch ((VAR_7 << 1) | VAR_12) {", "case 0:\ngen_helper_neon_abdl_s16(cpu_V0, tmp, tmp2);", "break;", "case 1:\ngen_helper_neon_abdl_u16(cpu_V0, tmp, tmp2);", "break;", "case 2:\ngen_helper_neon_abdl_s32(cpu_V0, tmp, tmp2);", "break;", "case 3:\ngen_helper_neon_abdl_u32(cpu_V0, tmp, tmp2);", "break;", "case 4:\ngen_helper_neon_abdl_s64(cpu_V0, tmp, tmp2);", "break;", "case 5:\ngen_helper_neon_abdl_u64(cpu_V0, tmp, tmp2);", "break;", "default: abort();", "}", "tcg_temp_free_i32(tmp2);", "tcg_temp_free_i32(tmp);", "break;", "case 8: case 9: case 10: case 11: case 12: case 13:\ngen_neon_mull(cpu_V0, tmp, tmp2, VAR_7, VAR_12);", "break;", "case 14:\ngen_helper_neon_mull_p8(cpu_V0, tmp, tmp2);", "tcg_temp_free_i32(tmp2);", "tcg_temp_free_i32(tmp);", "break;", "default:\nabort();", "}", "if (VAR_2 == 13) {", "gen_neon_addl_saturate(cpu_V0, cpu_V0, VAR_7);", "neon_store_reg64(cpu_V0, VAR_4 + VAR_9);", "} else if (VAR_2 == 5 || (VAR_2 >= 8 && VAR_2 <= 11)) {", "neon_load_reg64(cpu_V1, VAR_4 + VAR_9);", "switch (VAR_2) {", "case 10:\ngen_neon_negl(cpu_V0, VAR_7);", "case 5: case 8:\ngen_neon_addl(VAR_7);", "break;", "case 9: case 11:\ngen_neon_addl_saturate(cpu_V0, cpu_V0, VAR_7);", "if (VAR_2 == 11) {", "gen_neon_negl(cpu_V0, VAR_7);", "}", "gen_neon_addl_saturate(cpu_V0, cpu_V1, VAR_7);", "break;", "default:\nabort();", "}", "neon_store_reg64(cpu_V0, VAR_4 + VAR_9);", "} else if (VAR_2 == 4 || VAR_2 == 6) {", "tmp = tcg_temp_new_i32();", "if (!VAR_12) {", "switch (VAR_7) {", "case 0:\ngen_helper_neon_narrow_high_u8(tmp, cpu_V0);", "break;", "case 1:\ngen_helper_neon_narrow_high_u16(tmp, cpu_V0);", "break;", "case 2:\ntcg_gen_shri_i64(cpu_V0, cpu_V0, 32);", "tcg_gen_trunc_i64_i32(tmp, cpu_V0);", "break;", "default: abort();", "}", "} else {", "switch (VAR_7) {", "case 0:\ngen_helper_neon_narrow_round_high_u8(tmp, cpu_V0);", "break;", "case 1:\ngen_helper_neon_narrow_round_high_u16(tmp, cpu_V0);", "break;", "case 2:\ntcg_gen_addi_i64(cpu_V0, cpu_V0, 1u << 31);", "tcg_gen_shri_i64(cpu_V0, cpu_V0, 32);", "tcg_gen_trunc_i64_i32(tmp, cpu_V0);", "break;", "default: abort();", "}", "}", "if (VAR_9 == 0) {", "tmp3 = tmp;", "} else {", "neon_store_reg(VAR_4, 0, tmp3);", "neon_store_reg(VAR_4, 1, tmp);", "}", "} else {", "neon_store_reg64(cpu_V0, VAR_4 + VAR_9);", "}", "}", "} else {", "if (VAR_7 == 0) {", "return 1;", "}", "switch (VAR_2) {", "case 1:\ncase 5:\ncase 9:\nif (VAR_7 == 1) {", "return 1;", "}", "case 0:\ncase 4:\ncase 8:\ncase 12:\ncase 13:\nif (VAR_12 && ((VAR_4 | VAR_5) & 1)) {", "return 1;", "}", "tmp = neon_get_scalar(VAR_7, VAR_6);", "neon_store_scratch(0, tmp);", "for (VAR_9 = 0; VAR_9 < (VAR_12 ? 4 : 2); VAR_9++) {", "tmp = neon_load_scratch(0);", "tmp2 = neon_load_reg(VAR_5, VAR_9);", "if (VAR_2 == 12) {", "if (VAR_7 == 1) {", "gen_helper_neon_qdmulh_s16(tmp, cpu_env, tmp, tmp2);", "} else {", "gen_helper_neon_qdmulh_s32(tmp, cpu_env, tmp, tmp2);", "}", "} else if (VAR_2 == 13) {", "if (VAR_7 == 1) {", "gen_helper_neon_qrdmulh_s16(tmp, cpu_env, tmp, tmp2);", "} else {", "gen_helper_neon_qrdmulh_s32(tmp, cpu_env, tmp, tmp2);", "}", "} else if (VAR_2 & 1) {", "TCGv_ptr fpstatus = get_fpstatus_ptr(1);", "gen_helper_vfp_muls(tmp, tmp, tmp2, fpstatus);", "tcg_temp_free_ptr(fpstatus);", "} else {", "switch (VAR_7) {", "case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break;", "case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break;", "case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break;", "default: abort();", "}", "}", "tcg_temp_free_i32(tmp2);", "if (VAR_2 < 8) {", "tmp2 = neon_load_reg(VAR_4, VAR_9);", "switch (VAR_2) {", "case 0:\ngen_neon_add(VAR_7, tmp, tmp2);", "break;", "case 1:\n{", "TCGv_ptr fpstatus = get_fpstatus_ptr(1);", "gen_helper_vfp_adds(tmp, tmp, tmp2, fpstatus);", "tcg_temp_free_ptr(fpstatus);", "break;", "}", "case 4:\ngen_neon_rsb(VAR_7, tmp, tmp2);", "break;", "case 5:\n{", "TCGv_ptr fpstatus = get_fpstatus_ptr(1);", "gen_helper_vfp_subs(tmp, tmp2, tmp, fpstatus);", "tcg_temp_free_ptr(fpstatus);", "break;", "}", "default:\nabort();", "}", "tcg_temp_free_i32(tmp2);", "}", "neon_store_reg(VAR_4, VAR_9, tmp);", "}", "break;", "case 3:\ncase 7:\ncase 11:\nif (VAR_12 == 1) {", "return 1;", "}", "case 2:\ncase 6:\ncase 10:\nif (VAR_4 & 1) {", "return 1;", "}", "tmp2 = neon_get_scalar(VAR_7, VAR_6);", "tmp4 = tcg_temp_new_i32();", "tcg_gen_mov_i32(tmp4, tmp2);", "tmp3 = neon_load_reg(VAR_5, 1);", "for (VAR_9 = 0; VAR_9 < 2; VAR_9++) {", "if (VAR_9 == 0) {", "tmp = neon_load_reg(VAR_5, 0);", "} else {", "tmp = tmp3;", "tmp2 = tmp4;", "}", "gen_neon_mull(cpu_V0, tmp, tmp2, VAR_7, VAR_12);", "if (VAR_2 != 11) {", "neon_load_reg64(cpu_V1, VAR_4 + VAR_9);", "}", "switch (VAR_2) {", "case 6:\ngen_neon_negl(cpu_V0, VAR_7);", "case 2:\ngen_neon_addl(VAR_7);", "break;", "case 3: case 7:\ngen_neon_addl_saturate(cpu_V0, cpu_V0, VAR_7);", "if (VAR_2 == 7) {", "gen_neon_negl(cpu_V0, VAR_7);", "}", "gen_neon_addl_saturate(cpu_V0, cpu_V1, VAR_7);", "break;", "case 10:\nbreak;", "case 11:\ngen_neon_addl_saturate(cpu_V0, cpu_V0, VAR_7);", "break;", "default:\nabort();", "}", "neon_store_reg64(cpu_V0, VAR_4 + VAR_9);", "}", "break;", "default:\nreturn 1;", "}", "}", "} else {", "if (!VAR_12) {", "imm = (VAR_1 >> 8) & 0xf;", "if (imm > 7 && !VAR_3)\nreturn 1;", "if (VAR_3 && ((VAR_4 | VAR_5 | VAR_6) & 1)) {", "return 1;", "}", "if (imm == 0) {", "neon_load_reg64(cpu_V0, VAR_5);", "if (VAR_3) {", "neon_load_reg64(cpu_V1, VAR_5 + 1);", "}", "} else if (imm == 8) {", "neon_load_reg64(cpu_V0, VAR_5 + 1);", "if (VAR_3) {", "neon_load_reg64(cpu_V1, VAR_6);", "}", "} else if (VAR_3) {", "tmp64 = tcg_temp_new_i64();", "if (imm < 8) {", "neon_load_reg64(cpu_V0, VAR_5);", "neon_load_reg64(tmp64, VAR_5 + 1);", "} else {", "neon_load_reg64(cpu_V0, VAR_5 + 1);", "neon_load_reg64(tmp64, VAR_6);", "}", "tcg_gen_shri_i64(cpu_V0, cpu_V0, (imm & 7) * 8);", "tcg_gen_shli_i64(cpu_V1, tmp64, 64 - ((imm & 7) * 8));", "tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1);", "if (imm < 8) {", "neon_load_reg64(cpu_V1, VAR_6);", "} else {", "neon_load_reg64(cpu_V1, VAR_6 + 1);", "imm -= 8;", "}", "tcg_gen_shli_i64(cpu_V1, cpu_V1, 64 - (imm * 8));", "tcg_gen_shri_i64(tmp64, tmp64, imm * 8);", "tcg_gen_or_i64(cpu_V1, cpu_V1, tmp64);", "tcg_temp_free_i64(tmp64);", "} else {", "neon_load_reg64(cpu_V0, VAR_5);", "tcg_gen_shri_i64(cpu_V0, cpu_V0, imm * 8);", "neon_load_reg64(cpu_V1, VAR_6);", "tcg_gen_shli_i64(cpu_V1, cpu_V1, 64 - (imm * 8));", "tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1);", "}", "neon_store_reg64(cpu_V0, VAR_4);", "if (VAR_3) {", "neon_store_reg64(cpu_V1, VAR_4 + 1);", "}", "} else if ((VAR_1 & (1 << 11)) == 0) {", "VAR_2 = ((VAR_1 >> 12) & 0x30) | ((VAR_1 >> 7) & 0xf);", "VAR_7 = (VAR_1 >> 18) & 3;", "if ((neon_2rm_sizes[VAR_2] & (1 << VAR_7)) == 0) {", "return 1;", "}", "if ((VAR_2 != NEON_2RM_VMOVN && VAR_2 != NEON_2RM_VQMOVN) &&\nVAR_3 && ((VAR_6 | VAR_4) & 1)) {", "return 1;", "}", "switch (VAR_2) {", "case NEON_2RM_VREV64:\nfor (VAR_9 = 0; VAR_9 < (VAR_3 ? 2 : 1); VAR_9++) {", "tmp = neon_load_reg(VAR_6, VAR_9 * 2);", "tmp2 = neon_load_reg(VAR_6, VAR_9 * 2 + 1);", "switch (VAR_7) {", "case 0: tcg_gen_bswap32_i32(tmp, tmp); break;", "case 1: gen_swap_half(tmp); break;", "case 2: break;", "default: abort();", "}", "neon_store_reg(VAR_4, VAR_9 * 2 + 1, tmp);", "if (VAR_7 == 2) {", "neon_store_reg(VAR_4, VAR_9 * 2, tmp2);", "} else {", "switch (VAR_7) {", "case 0: tcg_gen_bswap32_i32(tmp2, tmp2); break;", "case 1: gen_swap_half(tmp2); break;", "default: abort();", "}", "neon_store_reg(VAR_4, VAR_9 * 2, tmp2);", "}", "}", "break;", "case NEON_2RM_VPADDL: case NEON_2RM_VPADDL_U:\ncase NEON_2RM_VPADAL: case NEON_2RM_VPADAL_U:\nfor (VAR_9 = 0; VAR_9 < VAR_3 + 1; VAR_9++) {", "tmp = neon_load_reg(VAR_6, VAR_9 * 2);", "gen_neon_widen(cpu_V0, tmp, VAR_7, VAR_2 & 1);", "tmp = neon_load_reg(VAR_6, VAR_9 * 2 + 1);", "gen_neon_widen(cpu_V1, tmp, VAR_7, VAR_2 & 1);", "switch (VAR_7) {", "case 0: gen_helper_neon_paddl_u16(CPU_V001); break;", "case 1: gen_helper_neon_paddl_u32(CPU_V001); break;", "case 2: tcg_gen_add_i64(CPU_V001); break;", "default: abort();", "}", "if (VAR_2 >= NEON_2RM_VPADAL) {", "neon_load_reg64(cpu_V1, VAR_4 + VAR_9);", "gen_neon_addl(VAR_7);", "}", "neon_store_reg64(cpu_V0, VAR_4 + VAR_9);", "}", "break;", "case NEON_2RM_VTRN:\nif (VAR_7 == 2) {", "int VAR_23;", "for (VAR_23 = 0; VAR_23 < (VAR_3 ? 4 : 2); VAR_23 += 2) {", "tmp = neon_load_reg(VAR_6, VAR_23);", "tmp2 = neon_load_reg(VAR_4, VAR_23 + 1);", "neon_store_reg(VAR_6, VAR_23, tmp2);", "neon_store_reg(VAR_4, VAR_23 + 1, tmp);", "}", "} else {", "goto elementwise;", "}", "break;", "case NEON_2RM_VUZP:\nif (gen_neon_unzip(VAR_4, VAR_6, VAR_7, VAR_3)) {", "return 1;", "}", "break;", "case NEON_2RM_VZIP:\nif (gen_neon_zip(VAR_4, VAR_6, VAR_7, VAR_3)) {", "return 1;", "}", "break;", "case NEON_2RM_VMOVN: case NEON_2RM_VQMOVN:\nif (VAR_6 & 1) {", "return 1;", "}", "TCGV_UNUSED_I32(tmp2);", "for (VAR_9 = 0; VAR_9 < 2; VAR_9++) {", "neon_load_reg64(cpu_V0, VAR_6 + VAR_9);", "tmp = tcg_temp_new_i32();", "gen_neon_narrow_op(VAR_2 == NEON_2RM_VMOVN, VAR_3, VAR_7,\ntmp, cpu_V0);", "if (VAR_9 == 0) {", "tmp2 = tmp;", "} else {", "neon_store_reg(VAR_4, 0, tmp2);", "neon_store_reg(VAR_4, 1, tmp);", "}", "}", "break;", "case NEON_2RM_VSHLL:\nif (VAR_3 || (VAR_4 & 1)) {", "return 1;", "}", "tmp = neon_load_reg(VAR_6, 0);", "tmp2 = neon_load_reg(VAR_6, 1);", "for (VAR_9 = 0; VAR_9 < 2; VAR_9++) {", "if (VAR_9 == 1)\ntmp = tmp2;", "gen_neon_widen(cpu_V0, tmp, VAR_7, 1);", "tcg_gen_shli_i64(cpu_V0, cpu_V0, 8 << VAR_7);", "neon_store_reg64(cpu_V0, VAR_4 + VAR_9);", "}", "break;", "case NEON_2RM_VCVT_F16_F32:\nif (!arm_dc_feature(VAR_0, ARM_FEATURE_VFP_FP16) ||\nVAR_3 || (VAR_6 & 1)) {", "return 1;", "}", "tmp = tcg_temp_new_i32();", "tmp2 = tcg_temp_new_i32();", "tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_6, 0));", "gen_helper_neon_fcvt_f32_to_f16(tmp, cpu_F0s, cpu_env);", "tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_6, 1));", "gen_helper_neon_fcvt_f32_to_f16(tmp2, cpu_F0s, cpu_env);", "tcg_gen_shli_i32(tmp2, tmp2, 16);", "tcg_gen_or_i32(tmp2, tmp2, tmp);", "tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_6, 2));", "gen_helper_neon_fcvt_f32_to_f16(tmp, cpu_F0s, cpu_env);", "tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_6, 3));", "neon_store_reg(VAR_4, 0, tmp2);", "tmp2 = tcg_temp_new_i32();", "gen_helper_neon_fcvt_f32_to_f16(tmp2, cpu_F0s, cpu_env);", "tcg_gen_shli_i32(tmp2, tmp2, 16);", "tcg_gen_or_i32(tmp2, tmp2, tmp);", "neon_store_reg(VAR_4, 1, tmp2);", "tcg_temp_free_i32(tmp);", "break;", "case NEON_2RM_VCVT_F32_F16:\nif (!arm_dc_feature(VAR_0, ARM_FEATURE_VFP_FP16) ||\nVAR_3 || (VAR_4 & 1)) {", "return 1;", "}", "tmp3 = tcg_temp_new_i32();", "tmp = neon_load_reg(VAR_6, 0);", "tmp2 = neon_load_reg(VAR_6, 1);", "tcg_gen_ext16u_i32(tmp3, tmp);", "gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);", "tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_4, 0));", "tcg_gen_shri_i32(tmp3, tmp, 16);", "gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);", "tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_4, 1));", "tcg_temp_free_i32(tmp);", "tcg_gen_ext16u_i32(tmp3, tmp2);", "gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);", "tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_4, 2));", "tcg_gen_shri_i32(tmp3, tmp2, 16);", "gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);", "tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_4, 3));", "tcg_temp_free_i32(tmp2);", "tcg_temp_free_i32(tmp3);", "break;", "case NEON_2RM_AESE: case NEON_2RM_AESMC:\nif (!arm_dc_feature(VAR_0, ARM_FEATURE_V8_AES)\n|| ((VAR_6 | VAR_4) & 1)) {", "return 1;", "}", "tmp = tcg_const_i32(VAR_4);", "tmp2 = tcg_const_i32(VAR_6);", "tmp3 = tcg_const_i32(extract32(VAR_1, 6, 1));", "if (VAR_2 == NEON_2RM_AESE) {", "gen_helper_crypto_aese(cpu_env, tmp, tmp2, tmp3);", "} else {", "gen_helper_crypto_aesmc(cpu_env, tmp, tmp2, tmp3);", "}", "tcg_temp_free_i32(tmp);", "tcg_temp_free_i32(tmp2);", "tcg_temp_free_i32(tmp3);", "break;", "case NEON_2RM_SHA1H:\nif (!arm_dc_feature(VAR_0, ARM_FEATURE_V8_SHA1)\n|| ((VAR_6 | VAR_4) & 1)) {", "return 1;", "}", "tmp = tcg_const_i32(VAR_4);", "tmp2 = tcg_const_i32(VAR_6);", "gen_helper_crypto_sha1h(cpu_env, tmp, tmp2);", "tcg_temp_free_i32(tmp);", "tcg_temp_free_i32(tmp2);", "break;", "case NEON_2RM_SHA1SU1:\nif ((VAR_6 | VAR_4) & 1) {", "return 1;", "}", "if (VAR_3) {", "if (!arm_dc_feature(VAR_0, ARM_FEATURE_V8_SHA256)) {", "return 1;", "}", "} else if (!arm_dc_feature(VAR_0, ARM_FEATURE_V8_SHA1)) {", "return 1;", "}", "tmp = tcg_const_i32(VAR_4);", "tmp2 = tcg_const_i32(VAR_6);", "if (VAR_3) {", "gen_helper_crypto_sha256su0(cpu_env, tmp, tmp2);", "} else {", "gen_helper_crypto_sha1su1(cpu_env, tmp, tmp2);", "}", "tcg_temp_free_i32(tmp);", "tcg_temp_free_i32(tmp2);", "break;", "default:\nelementwise:\nfor (VAR_9 = 0; VAR_9 < (VAR_3 ? 4 : 2); VAR_9++) {", "if (neon_2rm_is_float_op(VAR_2)) {", "tcg_gen_ld_f32(cpu_F0s, cpu_env,\nneon_reg_offset(VAR_6, VAR_9));", "TCGV_UNUSED_I32(tmp);", "} else {", "tmp = neon_load_reg(VAR_6, VAR_9);", "}", "switch (VAR_2) {", "case NEON_2RM_VREV32:\nswitch (VAR_7) {", "case 0: tcg_gen_bswap32_i32(tmp, tmp); break;", "case 1: gen_swap_half(tmp); break;", "default: abort();", "}", "break;", "case NEON_2RM_VREV16:\ngen_rev16(tmp);", "break;", "case NEON_2RM_VCLS:\nswitch (VAR_7) {", "case 0: gen_helper_neon_cls_s8(tmp, tmp); break;", "case 1: gen_helper_neon_cls_s16(tmp, tmp); break;", "case 2: gen_helper_neon_cls_s32(tmp, tmp); break;", "default: abort();", "}", "break;", "case NEON_2RM_VCLZ:\nswitch (VAR_7) {", "case 0: gen_helper_neon_clz_u8(tmp, tmp); break;", "case 1: gen_helper_neon_clz_u16(tmp, tmp); break;", "case 2: gen_helper_clz(tmp, tmp); break;", "default: abort();", "}", "break;", "case NEON_2RM_VCNT:\ngen_helper_neon_cnt_u8(tmp, tmp);", "break;", "case NEON_2RM_VMVN:\ntcg_gen_not_i32(tmp, tmp);", "break;", "case NEON_2RM_VQABS:\nswitch (VAR_7) {", "case 0:\ngen_helper_neon_qabs_s8(tmp, cpu_env, tmp);", "break;", "case 1:\ngen_helper_neon_qabs_s16(tmp, cpu_env, tmp);", "break;", "case 2:\ngen_helper_neon_qabs_s32(tmp, cpu_env, tmp);", "break;", "default: abort();", "}", "break;", "case NEON_2RM_VQNEG:\nswitch (VAR_7) {", "case 0:\ngen_helper_neon_qneg_s8(tmp, cpu_env, tmp);", "break;", "case 1:\ngen_helper_neon_qneg_s16(tmp, cpu_env, tmp);", "break;", "case 2:\ngen_helper_neon_qneg_s32(tmp, cpu_env, tmp);", "break;", "default: abort();", "}", "break;", "case NEON_2RM_VCGT0: case NEON_2RM_VCLE0:\ntmp2 = tcg_const_i32(0);", "switch(VAR_7) {", "case 0: gen_helper_neon_cgt_s8(tmp, tmp, tmp2); break;", "case 1: gen_helper_neon_cgt_s16(tmp, tmp, tmp2); break;", "case 2: gen_helper_neon_cgt_s32(tmp, tmp, tmp2); break;", "default: abort();", "}", "tcg_temp_free_i32(tmp2);", "if (VAR_2 == NEON_2RM_VCLE0) {", "tcg_gen_not_i32(tmp, tmp);", "}", "break;", "case NEON_2RM_VCGE0: case NEON_2RM_VCLT0:\ntmp2 = tcg_const_i32(0);", "switch(VAR_7) {", "case 0: gen_helper_neon_cge_s8(tmp, tmp, tmp2); break;", "case 1: gen_helper_neon_cge_s16(tmp, tmp, tmp2); break;", "case 2: gen_helper_neon_cge_s32(tmp, tmp, tmp2); break;", "default: abort();", "}", "tcg_temp_free_i32(tmp2);", "if (VAR_2 == NEON_2RM_VCLT0) {", "tcg_gen_not_i32(tmp, tmp);", "}", "break;", "case NEON_2RM_VCEQ0:\ntmp2 = tcg_const_i32(0);", "switch(VAR_7) {", "case 0: gen_helper_neon_ceq_u8(tmp, tmp, tmp2); break;", "case 1: gen_helper_neon_ceq_u16(tmp, tmp, tmp2); break;", "case 2: gen_helper_neon_ceq_u32(tmp, tmp, tmp2); break;", "default: abort();", "}", "tcg_temp_free_i32(tmp2);", "break;", "case NEON_2RM_VABS:\nswitch(VAR_7) {", "case 0: gen_helper_neon_abs_s8(tmp, tmp); break;", "case 1: gen_helper_neon_abs_s16(tmp, tmp); break;", "case 2: tcg_gen_abs_i32(tmp, tmp); break;", "default: abort();", "}", "break;", "case NEON_2RM_VNEG:\ntmp2 = tcg_const_i32(0);", "gen_neon_rsb(VAR_7, tmp, tmp2);", "tcg_temp_free_i32(tmp2);", "break;", "case NEON_2RM_VCGT0_F:\n{", "TCGv_ptr fpstatus = get_fpstatus_ptr(1);", "tmp2 = tcg_const_i32(0);", "gen_helper_neon_cgt_f32(tmp, tmp, tmp2, fpstatus);", "tcg_temp_free_i32(tmp2);", "tcg_temp_free_ptr(fpstatus);", "break;", "}", "case NEON_2RM_VCGE0_F:\n{", "TCGv_ptr fpstatus = get_fpstatus_ptr(1);", "tmp2 = tcg_const_i32(0);", "gen_helper_neon_cge_f32(tmp, tmp, tmp2, fpstatus);", "tcg_temp_free_i32(tmp2);", "tcg_temp_free_ptr(fpstatus);", "break;", "}", "case NEON_2RM_VCEQ0_F:\n{", "TCGv_ptr fpstatus = get_fpstatus_ptr(1);", "tmp2 = tcg_const_i32(0);", "gen_helper_neon_ceq_f32(tmp, tmp, tmp2, fpstatus);", "tcg_temp_free_i32(tmp2);", "tcg_temp_free_ptr(fpstatus);", "break;", "}", "case NEON_2RM_VCLE0_F:\n{", "TCGv_ptr fpstatus = get_fpstatus_ptr(1);", "tmp2 = tcg_const_i32(0);", "gen_helper_neon_cge_f32(tmp, tmp2, tmp, fpstatus);", "tcg_temp_free_i32(tmp2);", "tcg_temp_free_ptr(fpstatus);", "break;", "}", "case NEON_2RM_VCLT0_F:\n{", "TCGv_ptr fpstatus = get_fpstatus_ptr(1);", "tmp2 = tcg_const_i32(0);", "gen_helper_neon_cgt_f32(tmp, tmp2, tmp, fpstatus);", "tcg_temp_free_i32(tmp2);", "tcg_temp_free_ptr(fpstatus);", "break;", "}", "case NEON_2RM_VABS_F:\ngen_vfp_abs(0);", "break;", "case NEON_2RM_VNEG_F:\ngen_vfp_neg(0);", "break;", "case NEON_2RM_VSWP:\ntmp2 = neon_load_reg(VAR_4, VAR_9);", "neon_store_reg(VAR_6, VAR_9, tmp2);", "break;", "case NEON_2RM_VTRN:\ntmp2 = neon_load_reg(VAR_4, VAR_9);", "switch (VAR_7) {", "case 0: gen_neon_trn_u8(tmp, tmp2); break;", "case 1: gen_neon_trn_u16(tmp, tmp2); break;", "default: abort();", "}", "neon_store_reg(VAR_6, VAR_9, tmp2);", "break;", "case NEON_2RM_VRINTN:\ncase NEON_2RM_VRINTA:\ncase NEON_2RM_VRINTM:\ncase NEON_2RM_VRINTP:\ncase NEON_2RM_VRINTZ:\n{", "TCGv_i32 tcg_rmode;", "TCGv_ptr fpstatus = get_fpstatus_ptr(1);", "int VAR_23;", "if (VAR_2 == NEON_2RM_VRINTZ) {", "VAR_23 = FPROUNDING_ZERO;", "} else {", "VAR_23 = fp_decode_rm[((VAR_2 & 0x6) >> 1) ^ 1];", "}", "tcg_rmode = tcg_const_i32(arm_rmode_to_sf(VAR_23));", "gen_helper_set_neon_rmode(tcg_rmode, tcg_rmode,\ncpu_env);", "gen_helper_rints(cpu_F0s, cpu_F0s, fpstatus);", "gen_helper_set_neon_rmode(tcg_rmode, tcg_rmode,\ncpu_env);", "tcg_temp_free_ptr(fpstatus);", "tcg_temp_free_i32(tcg_rmode);", "break;", "}", "case NEON_2RM_VRINTX:\n{", "TCGv_ptr fpstatus = get_fpstatus_ptr(1);", "gen_helper_rints_exact(cpu_F0s, cpu_F0s, fpstatus);", "tcg_temp_free_ptr(fpstatus);", "break;", "}", "case NEON_2RM_VCVTAU:\ncase NEON_2RM_VCVTAS:\ncase NEON_2RM_VCVTNU:\ncase NEON_2RM_VCVTNS:\ncase NEON_2RM_VCVTPU:\ncase NEON_2RM_VCVTPS:\ncase NEON_2RM_VCVTMU:\ncase NEON_2RM_VCVTMS:\n{", "bool is_signed = !extract32(VAR_1, 7, 1);", "TCGv_ptr fpst = get_fpstatus_ptr(1);", "TCGv_i32 tcg_rmode, tcg_shift;", "int VAR_23 = fp_decode_rm[extract32(VAR_1, 8, 2)];", "tcg_shift = tcg_const_i32(0);", "tcg_rmode = tcg_const_i32(arm_rmode_to_sf(VAR_23));", "gen_helper_set_neon_rmode(tcg_rmode, tcg_rmode,\ncpu_env);", "if (is_signed) {", "gen_helper_vfp_tosls(cpu_F0s, cpu_F0s,\ntcg_shift, fpst);", "} else {", "gen_helper_vfp_touls(cpu_F0s, cpu_F0s,\ntcg_shift, fpst);", "}", "gen_helper_set_neon_rmode(tcg_rmode, tcg_rmode,\ncpu_env);", "tcg_temp_free_i32(tcg_rmode);", "tcg_temp_free_i32(tcg_shift);", "tcg_temp_free_ptr(fpst);", "break;", "}", "case NEON_2RM_VRECPE:\n{", "TCGv_ptr fpstatus = get_fpstatus_ptr(1);", "gen_helper_recpe_u32(tmp, tmp, fpstatus);", "tcg_temp_free_ptr(fpstatus);", "break;", "}", "case NEON_2RM_VRSQRTE:\n{", "TCGv_ptr fpstatus = get_fpstatus_ptr(1);", "gen_helper_rsqrte_u32(tmp, tmp, fpstatus);", "tcg_temp_free_ptr(fpstatus);", "break;", "}", "case NEON_2RM_VRECPE_F:\n{", "TCGv_ptr fpstatus = get_fpstatus_ptr(1);", "gen_helper_recpe_f32(cpu_F0s, cpu_F0s, fpstatus);", "tcg_temp_free_ptr(fpstatus);", "break;", "}", "case NEON_2RM_VRSQRTE_F:\n{", "TCGv_ptr fpstatus = get_fpstatus_ptr(1);", "gen_helper_rsqrte_f32(cpu_F0s, cpu_F0s, fpstatus);", "tcg_temp_free_ptr(fpstatus);", "break;", "}", "case NEON_2RM_VCVT_FS:\ngen_vfp_sito(0, 1);", "break;", "case NEON_2RM_VCVT_FU:\ngen_vfp_uito(0, 1);", "break;", "case NEON_2RM_VCVT_SF:\ngen_vfp_tosiz(0, 1);", "break;", "case NEON_2RM_VCVT_UF:\ngen_vfp_touiz(0, 1);", "break;", "default:\nabort();", "}", "if (neon_2rm_is_float_op(VAR_2)) {", "tcg_gen_st_f32(cpu_F0s, cpu_env,\nneon_reg_offset(VAR_4, VAR_9));", "} else {", "neon_store_reg(VAR_4, VAR_9, tmp);", "}", "}", "break;", "}", "} else if ((VAR_1 & (1 << 10)) == 0) {", "int VAR_23 = ((VAR_1 >> 8) & 3) + 1;", "if ((VAR_5 + VAR_23) > 32) {", "return 1;", "}", "VAR_23 <<= 3;", "if (VAR_1 & (1 << 6)) {", "tmp = neon_load_reg(VAR_4, 0);", "} else {", "tmp = tcg_temp_new_i32();", "tcg_gen_movi_i32(tmp, 0);", "}", "tmp2 = neon_load_reg(VAR_6, 0);", "tmp4 = tcg_const_i32(VAR_5);", "tmp5 = tcg_const_i32(VAR_23);", "gen_helper_neon_tbl(tmp2, cpu_env, tmp2, tmp, tmp4, tmp5);", "tcg_temp_free_i32(tmp);", "if (VAR_1 & (1 << 6)) {", "tmp = neon_load_reg(VAR_4, 1);", "} else {", "tmp = tcg_temp_new_i32();", "tcg_gen_movi_i32(tmp, 0);", "}", "tmp3 = neon_load_reg(VAR_6, 1);", "gen_helper_neon_tbl(tmp3, cpu_env, tmp3, tmp, tmp4, tmp5);", "tcg_temp_free_i32(tmp5);", "tcg_temp_free_i32(tmp4);", "neon_store_reg(VAR_4, 0, tmp2);", "neon_store_reg(VAR_4, 1, tmp3);", "tcg_temp_free_i32(tmp);", "} else if ((VAR_1 & 0x380) == 0) {", "if ((VAR_1 & (7 << 16)) == 0 || (VAR_3 && (VAR_4 & 1))) {", "return 1;", "}", "if (VAR_1 & (1 << 19)) {", "tmp = neon_load_reg(VAR_6, 1);", "} else {", "tmp = neon_load_reg(VAR_6, 0);", "}", "if (VAR_1 & (1 << 16)) {", "gen_neon_dup_u8(tmp, ((VAR_1 >> 17) & 3) * 8);", "} else if (VAR_1 & (1 << 17)) {", "if ((VAR_1 >> 18) & 1)\ngen_neon_dup_high16(tmp);", "else\ngen_neon_dup_low16(tmp);", "}", "for (VAR_9 = 0; VAR_9 < (VAR_3 ? 4 : 2); VAR_9++) {", "tmp2 = tcg_temp_new_i32();", "tcg_gen_mov_i32(tmp2, tmp);", "neon_store_reg(VAR_4, VAR_9, tmp2);", "}", "tcg_temp_free_i32(tmp);", "} else {", "return 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 39 ], [ 41, 43, 45 ], [ 47 ], [ 49 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 89 ], [ 91 ], [ 93 ], [ 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 ], [ 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 ], [ 275, 277 ], [ 279, 281 ], [ 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 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349, 351 ], [ 353 ], [ 355 ], [ 359, 361, 363 ], [ 365 ], [ 367, 369 ], [ 371 ], [ 373, 375 ], [ 377 ], [ 379, 381 ], [ 385 ], [ 387 ], [ 389 ], [ 391, 393 ], [ 395 ], [ 397 ], [ 399 ], [ 401, 405 ], [ 407 ], [ 409 ], [ 411 ], [ 413, 415 ], [ 419 ], [ 421 ], [ 423 ], [ 425, 427 ], [ 429 ], [ 431 ], [ 433 ], [ 435, 437 ], [ 439 ], [ 443 ], [ 447 ], [ 449 ], [ 453 ], [ 457 ], [ 461 ], [ 463 ], [ 465 ], [ 467 ], [ 469 ], [ 471 ], [ 473 ], [ 475 ], [ 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, 561 ], [ 563 ], [ 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 ], [ 621, 623 ], [ 625 ], [ 627, 629 ], [ 631 ], [ 633, 635 ], [ 637 ], [ 639, 641 ], [ 643 ], [ 645 ], [ 647 ], [ 649 ], [ 651, 653 ], [ 655 ], [ 657 ], [ 659 ], [ 661 ], [ 663 ], [ 665 ], [ 667 ], [ 669 ], [ 671 ], [ 673 ], [ 675, 677 ], [ 679 ], [ 681 ], [ 683 ], [ 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, 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, 855 ], [ 857 ], [ 859, 861 ], [ 863 ], [ 865, 867 ], [ 869 ], [ 871 ], [ 873 ], [ 875 ], [ 877, 879 ], [ 881 ], [ 883 ], [ 885 ], [ 887 ], [ 889 ], [ 891 ], [ 893 ], [ 895 ], [ 897 ], [ 899 ], [ 901 ], [ 903 ], [ 905 ], [ 907 ], [ 909, 911 ], [ 913 ], [ 915 ], [ 917 ], [ 919 ], [ 921 ], [ 923 ], [ 925 ], [ 927 ], [ 929 ], [ 931 ], [ 933 ], [ 935 ], [ 937 ], [ 939, 941 ], [ 943 ], [ 945 ], [ 947 ], [ 949 ], [ 951 ], [ 953 ], [ 955 ], [ 957 ], [ 959 ], [ 961, 963 ], [ 965 ], [ 967 ], [ 969 ], [ 971 ], [ 973 ], [ 975 ], [ 977 ], [ 979 ], [ 981 ], [ 983, 985 ], [ 989 ], [ 991 ], [ 993 ], [ 995 ], [ 997 ], [ 999 ], [ 1001 ], [ 1003 ], [ 1005 ], [ 1007 ], [ 1009 ], [ 1011 ], [ 1013 ], [ 1015 ], [ 1017 ], [ 1019, 1021 ], [ 1025 ], [ 1027 ], [ 1029 ], [ 1033 ], [ 1035 ], [ 1037 ], [ 1039 ], [ 1041 ], [ 1043 ], [ 1045 ], [ 1047, 1049 ], [ 1051 ], [ 1053 ], [ 1063 ], [ 1065 ], [ 1067 ], [ 1069 ], [ 1071 ], [ 1075 ], [ 1077 ], [ 1079 ], [ 1081 ], [ 1083 ], [ 1085 ], [ 1087 ], [ 1091 ], [ 1093 ], [ 1097 ], [ 1099 ], [ 1103 ], [ 1105 ], [ 1107 ], [ 1109 ], [ 1111 ], [ 1113 ], [ 1115, 1117 ], [ 1119 ], [ 1121 ], [ 1127 ], [ 1133 ], [ 1135 ], [ 1137 ], [ 1139 ], [ 1141 ], [ 1143 ], [ 1149, 1151 ], [ 1153 ], [ 1155 ], [ 1157 ], [ 1159 ], [ 1161 ], [ 1163 ], [ 1165, 1167 ], [ 1169 ], [ 1171 ], [ 1173 ], [ 1175, 1177 ], [ 1179 ], [ 1181 ], [ 1183, 1185, 1187 ], [ 1189 ], [ 1191, 1193 ], [ 1195 ], [ 1199 ], [ 1201 ], [ 1203 ], [ 1205 ], [ 1207 ], [ 1209, 1211, 1213, 1215 ], [ 1217, 1219 ], [ 1221 ], [ 1223, 1225, 1227, 1229 ], [ 1231, 1233 ], [ 1235 ], [ 1237, 1239, 1241 ], [ 1243 ], [ 1245, 1247, 1249 ], [ 1251 ], [ 1253, 1255 ], [ 1257, 1259 ], [ 1261 ], [ 1263, 1265 ], [ 1267 ], [ 1269 ], [ 1271 ], [ 1273 ], [ 1277 ], [ 1279 ], [ 1281 ], [ 1285 ], [ 1287 ], [ 1289 ], [ 1291 ], [ 1293 ], [ 1295 ], [ 1297 ], [ 1299 ], [ 1301 ], [ 1303 ], [ 1305 ], [ 1307 ], [ 1309 ], [ 1311 ], [ 1313 ], [ 1315 ], [ 1319 ], [ 1321 ], [ 1323 ], [ 1325 ], [ 1327, 1329, 1331 ], [ 1333 ], [ 1335, 1337, 1339 ], [ 1341 ], [ 1343, 1345, 1347 ], [ 1349 ], [ 1351 ], [ 1353 ], [ 1355 ], [ 1357 ], [ 1359 ], [ 1361, 1363 ], [ 1365, 1367, 1369 ], [ 1371 ], [ 1373, 1375, 1377 ], [ 1379 ], [ 1381, 1383, 1385 ], [ 1387 ], [ 1389, 1391 ], [ 1393 ], [ 1395 ], [ 1397, 1399 ], [ 1401 ], [ 1403 ], [ 1405 ], [ 1409 ], [ 1413 ], [ 1415 ], [ 1417 ], [ 1419 ], [ 1423 ], [ 1425, 1427, 1429 ], [ 1431, 1433 ], [ 1435 ], [ 1437 ], [ 1439 ], [ 1441, 1443, 1445 ], [ 1447, 1449 ], [ 1451 ], [ 1453 ], [ 1455, 1457 ], [ 1459 ], [ 1461 ], [ 1463, 1465 ], [ 1467, 1469 ], [ 1471 ], [ 1473 ], [ 1475, 1477 ], [ 1479 ], [ 1481 ], [ 1483 ], [ 1485 ], [ 1487 ], [ 1489 ], [ 1491 ], [ 1493 ], [ 1495 ], [ 1497 ], [ 1499 ], [ 1505 ], [ 1507 ], [ 1509 ], [ 1511 ], [ 1513 ], [ 1515 ], [ 1517 ], [ 1519 ], [ 1521 ], [ 1523 ], [ 1525 ], [ 1527 ], [ 1529 ], [ 1531 ], [ 1533 ], [ 1535 ], [ 1537 ], [ 1539 ], [ 1541 ], [ 1543 ], [ 1545 ], [ 1547 ], [ 1549 ], [ 1551 ], [ 1553 ], [ 1555 ], [ 1557 ], [ 1559 ], [ 1561 ], [ 1563 ], [ 1565 ], [ 1567 ], [ 1569 ], [ 1571 ], [ 1573 ], [ 1575 ], [ 1577 ], [ 1579 ], [ 1581 ], [ 1583 ], [ 1587 ], [ 1589 ], [ 1591 ], [ 1593 ], [ 1595 ], [ 1597 ], [ 1599 ], [ 1601 ], [ 1603 ], [ 1605 ], [ 1607 ], [ 1609, 1611 ], [ 1613 ], [ 1615 ], [ 1617 ], [ 1619 ], [ 1621 ], [ 1623, 1625 ], [ 1627 ], [ 1629 ], [ 1631 ], [ 1633 ], [ 1635 ], [ 1637 ], [ 1639 ], [ 1641 ], [ 1643 ], [ 1645 ], [ 1649 ], [ 1651 ], [ 1653 ], [ 1655 ], [ 1657 ], [ 1659 ], [ 1661, 1663 ], [ 1667 ], [ 1671 ], [ 1677 ], [ 1689 ], [ 1691 ], [ 1693 ], [ 1695 ], [ 1697 ], [ 1699 ], [ 1701 ], [ 1703 ], [ 1707 ], [ 1709 ], [ 1711 ], [ 1713 ], [ 1715 ], [ 1717 ], [ 1719 ], [ 1721 ], [ 1723 ], [ 1725 ], [ 1727 ], [ 1729 ], [ 1731 ], [ 1735 ], [ 1737 ], [ 1739 ], [ 1747 ], [ 1749 ], [ 1751 ], [ 1753 ], [ 1755, 1757 ], [ 1759, 1761 ], [ 1763 ], [ 1765, 1767 ], [ 1769, 1771 ], [ 1773 ], [ 1775 ], [ 1777 ], [ 1779 ], [ 1781 ], [ 1783 ], [ 1785 ], [ 1787 ], [ 1789 ], [ 1791 ], [ 1793 ], [ 1797 ], [ 1801 ], [ 1803 ], [ 1813 ], [ 1815, 1819 ], [ 1821, 1823 ], [ 1825 ], [ 1827, 1829 ], [ 1831 ], [ 1833, 1835 ], [ 1837 ], [ 1839, 1841 ], [ 1843 ], [ 1845, 1847 ], [ 1849 ], [ 1851, 1853 ], [ 1855 ], [ 1857, 1859 ], [ 1861 ], [ 1863, 1865 ], [ 1867, 1869 ], [ 1871 ], [ 1873, 1875 ], [ 1877 ], [ 1879 ], [ 1881, 1883 ], [ 1885 ], [ 1887 ], [ 1889, 1891 ], [ 1895 ], [ 1897 ], [ 1899 ], [ 1901 ], [ 1907 ], [ 1909 ], [ 1911 ], [ 1913 ], [ 1915 ], [ 1919 ], [ 1921 ], [ 1923 ], [ 1925 ], [ 1927 ], [ 1929 ], [ 1931, 1933 ], [ 1935 ], [ 1937 ], [ 1939 ], [ 1941 ], [ 1943 ], [ 1945 ], [ 1947 ], [ 1949 ], [ 1951 ], [ 1953 ], [ 1955 ], [ 1957 ], [ 1959 ], [ 1963 ], [ 1965 ], [ 1967 ], [ 1981 ], [ 1985 ], [ 1987 ], [ 1989 ], [ 1991 ], [ 1993 ], [ 1995 ], [ 1997 ], [ 1999 ], [ 2001 ], [ 2003 ], [ 2005 ], [ 2007 ], [ 2009 ], [ 2011 ], [ 2013 ], [ 2015 ], [ 2017 ], [ 2019 ], [ 2023 ], [ 2025 ], [ 2027 ], [ 2029 ], [ 2033, 2035 ], [ 2037 ], [ 2039 ], [ 2041, 2043, 2045 ], [ 2047 ], [ 2049 ], [ 2059 ], [ 2061 ], [ 2065 ], [ 2067 ], [ 2069 ], [ 2071 ], [ 2073 ], [ 2075 ], [ 2077 ], [ 2079 ], [ 2081 ], [ 2083 ], [ 2085 ], [ 2087 ], [ 2089 ], [ 2091 ], [ 2093 ], [ 2095 ], [ 2097 ], [ 2107 ], [ 2109 ], [ 2111 ], [ 2113 ], [ 2115 ], [ 2117 ], [ 2119 ], [ 2121 ], [ 2123 ], [ 2125 ], [ 2127 ], [ 2129 ], [ 2131 ], [ 2133 ], [ 2135 ], [ 2137 ], [ 2139 ], [ 2141 ], [ 2143 ], [ 2145 ], [ 2147 ], [ 2149 ], [ 2151 ], [ 2153 ], [ 2155 ], [ 2157 ], [ 2159 ], [ 2161 ], [ 2163 ], [ 2165 ], [ 2167 ], [ 2169 ], [ 2171 ], [ 2173 ], [ 2175 ], [ 2177 ], [ 2179, 2181 ], [ 2183 ], [ 2185, 2187 ], [ 2189 ], [ 2191, 2193 ], [ 2195, 2197 ], [ 2199 ], [ 2201, 2203 ], [ 2205 ], [ 2207, 2209 ], [ 2211 ], [ 2213, 2215 ], [ 2217 ], [ 2219, 2221 ], [ 2223 ], [ 2225, 2227 ], [ 2229 ], [ 2231 ], [ 2233 ], [ 2235 ], [ 2237 ], [ 2239 ], [ 2241, 2245 ], [ 2247 ], [ 2249, 2251 ], [ 2253 ], [ 2255 ], [ 2257 ], [ 2259, 2261 ], [ 2263 ], [ 2265 ], [ 2269 ], [ 2271 ], [ 2273 ], [ 2277 ], [ 2279 ], [ 2281, 2283 ], [ 2287, 2289 ], [ 2291 ], [ 2293, 2295 ], [ 2297 ], [ 2299 ], [ 2301 ], [ 2303 ], [ 2305 ], [ 2307, 2309 ], [ 2311 ], [ 2313 ], [ 2315 ], [ 2319 ], [ 2321 ], [ 2323 ], [ 2325, 2327 ], [ 2329 ], [ 2331, 2333 ], [ 2335 ], [ 2337, 2339 ], [ 2341 ], [ 2343 ], [ 2345 ], [ 2347 ], [ 2349 ], [ 2351 ], [ 2353, 2355 ], [ 2357 ], [ 2359, 2361 ], [ 2363 ], [ 2365, 2367 ], [ 2369 ], [ 2371 ], [ 2373 ], [ 2375 ], [ 2377 ], [ 2379 ], [ 2381 ], [ 2383 ], [ 2385 ], [ 2387 ], [ 2389 ], [ 2391 ], [ 2393 ], [ 2397 ], [ 2399 ], [ 2401 ], [ 2403 ], [ 2413 ], [ 2415 ], [ 2417 ], [ 2419 ], [ 2421, 2423, 2425, 2427 ], [ 2429 ], [ 2431 ], [ 2435, 2437, 2439, 2441, 2443, 2445 ], [ 2447 ], [ 2449 ], [ 2451 ], [ 2453 ], [ 2455 ], [ 2457 ], [ 2459 ], [ 2461 ], [ 2463 ], [ 2465 ], [ 2467 ], [ 2469 ], [ 2471 ], [ 2473 ], [ 2475 ], [ 2477 ], [ 2479 ], [ 2481 ], [ 2483 ], [ 2485 ], [ 2487 ], [ 2489 ], [ 2491 ], [ 2493 ], [ 2495 ], [ 2497 ], [ 2499 ], [ 2501 ], [ 2503 ], [ 2505 ], [ 2507 ], [ 2509 ], [ 2511 ], [ 2515 ], [ 2517 ], [ 2519, 2521 ], [ 2523 ], [ 2525, 2527 ], [ 2529 ], [ 2531 ], [ 2533 ], [ 2535 ], [ 2537 ], [ 2539, 2541 ], [ 2543 ], [ 2545, 2547 ], [ 2549 ], [ 2551 ], [ 2553 ], [ 2555 ], [ 2557 ], [ 2559, 2561 ], [ 2563 ], [ 2565 ], [ 2567 ], [ 2569 ], [ 2571 ], [ 2573 ], [ 2575, 2577, 2579, 2581 ], [ 2583 ], [ 2585 ], [ 2589, 2591, 2593, 2595 ], [ 2597 ], [ 2599 ], [ 2601 ], [ 2607 ], [ 2609 ], [ 2611 ], [ 2615 ], [ 2617 ], [ 2619 ], [ 2621 ], [ 2623 ], [ 2625 ], [ 2627 ], [ 2629 ], [ 2631 ], [ 2633 ], [ 2635 ], [ 2637 ], [ 2639, 2641 ], [ 2645, 2647 ], [ 2649 ], [ 2651, 2653 ], [ 2655 ], [ 2657 ], [ 2659 ], [ 2661 ], [ 2663 ], [ 2665, 2669 ], [ 2671, 2673 ], [ 2675 ], [ 2677, 2679 ], [ 2681 ], [ 2683 ], [ 2685 ], [ 2691 ], [ 2693, 2695 ], [ 2697 ], [ 2699 ], [ 2701 ], [ 2703 ], [ 2707 ], [ 2711, 2713 ], [ 2717 ], [ 2719 ], [ 2721 ], [ 2725 ], [ 2727 ], [ 2729 ], [ 2731 ], [ 2733 ], [ 2735 ], [ 2737 ], [ 2739 ], [ 2741 ], [ 2743 ], [ 2745 ], [ 2747 ], [ 2749 ], [ 2751 ], [ 2753 ], [ 2755 ], [ 2757 ], [ 2759 ], [ 2761 ], [ 2763 ], [ 2765 ], [ 2767 ], [ 2769 ], [ 2771 ], [ 2773 ], [ 2775 ], [ 2777 ], [ 2779 ], [ 2781 ], [ 2783 ], [ 2785 ], [ 2787 ], [ 2789 ], [ 2793 ], [ 2795 ], [ 2797 ], [ 2799 ], [ 2801 ], [ 2803 ], [ 2805 ], [ 2807 ], [ 2809 ], [ 2811 ], [ 2813 ], [ 2817 ], [ 2819 ], [ 2823 ], [ 2825 ], [ 2827 ], [ 2829, 2831 ], [ 2833 ], [ 2835 ], [ 2837 ], [ 2839, 2841 ], [ 2843 ], [ 2845 ], [ 2847 ], [ 2849 ], [ 2851 ], [ 2853 ], [ 2855 ], [ 2857 ], [ 2859 ], [ 2861 ], [ 2863 ], [ 2865 ], [ 2867 ], [ 2869 ], [ 2871 ], [ 2873 ], [ 2875 ], [ 2877 ], [ 2879 ], [ 2881 ], [ 2883 ], [ 2885, 2887, 2889 ], [ 2891 ], [ 2893 ], [ 2895 ], [ 2897 ], [ 2899 ], [ 2901 ], [ 2903 ], [ 2905 ], [ 2907 ], [ 2909 ], [ 2911 ], [ 2915 ], [ 2917 ], [ 2919 ], [ 2921 ], [ 2923 ], [ 2925 ], [ 2927, 2929 ], [ 2931 ], [ 2933 ], [ 2935 ], [ 2937 ], [ 2939 ], [ 2941 ], [ 2943 ], [ 2945 ], [ 2947 ], [ 2949 ], [ 2951 ], [ 2953, 2955 ], [ 2957 ], [ 2959 ], [ 2961 ], [ 2963, 2965 ], [ 2967 ], [ 2969 ], [ 2971 ], [ 2973, 2977 ], [ 2979 ], [ 2981 ], [ 2983 ], [ 2985 ], [ 2987 ], [ 2989 ], [ 2991, 2993 ], [ 2995 ], [ 2997 ], [ 2999 ], [ 3001 ], [ 3003 ], [ 3005 ], [ 3007 ], [ 3009 ], [ 3011, 3013 ], [ 3015 ], [ 3017 ], [ 3019 ], [ 3021 ], [ 3023 ], [ 3025, 3027 ], [ 3029 ], [ 3031 ], [ 3033 ], [ 3035 ], [ 3037 ], [ 3039, 3041, 3043 ], [ 3045 ], [ 3047 ], [ 3049 ], [ 3051 ], [ 3053 ], [ 3055 ], [ 3057 ], [ 3059 ], [ 3061 ], [ 3063 ], [ 3065 ], [ 3067 ], [ 3069 ], [ 3071 ], [ 3073 ], [ 3075 ], [ 3077 ], [ 3079 ], [ 3081 ], [ 3083 ], [ 3085 ], [ 3087, 3089, 3091 ], [ 3093 ], [ 3095 ], [ 3097 ], [ 3099 ], [ 3101 ], [ 3103 ], [ 3105 ], [ 3107 ], [ 3109 ], [ 3111 ], [ 3113 ], [ 3115 ], [ 3117 ], [ 3119 ], [ 3121 ], [ 3123 ], [ 3125 ], [ 3127 ], [ 3129 ], [ 3131 ], [ 3133 ], [ 3135, 3137, 3139 ], [ 3141 ], [ 3143 ], [ 3145 ], [ 3147 ], [ 3157 ], [ 3161 ], [ 3163 ], [ 3165 ], [ 3167 ], [ 3169 ], [ 3171 ], [ 3173 ], [ 3175 ], [ 3177 ], [ 3179, 3181, 3183 ], [ 3185 ], [ 3187 ], [ 3189 ], [ 3191 ], [ 3195 ], [ 3199 ], [ 3201 ], [ 3203 ], [ 3205, 3207 ], [ 3209 ], [ 3211 ], [ 3215 ], [ 3217 ], [ 3219 ], [ 3221 ], [ 3223 ], [ 3225 ], [ 3227 ], [ 3229 ], [ 3231 ], [ 3233 ], [ 3235 ], [ 3237 ], [ 3239 ], [ 3241 ], [ 3243 ], [ 3245 ], [ 3247 ], [ 3249, 3251, 3253 ], [ 3255 ], [ 3257, 3259 ], [ 3261 ], [ 3263 ], [ 3265 ], [ 3267 ], [ 3269 ], [ 3271, 3273 ], [ 3275 ], [ 3277 ], [ 3279 ], [ 3281 ], [ 3283 ], [ 3285, 3287 ], [ 3289 ], [ 3291, 3293 ], [ 3295 ], [ 3297 ], [ 3299 ], [ 3301 ], [ 3303 ], [ 3305 ], [ 3307, 3309 ], [ 3311 ], [ 3313 ], [ 3315 ], [ 3317 ], [ 3319 ], [ 3321 ], [ 3323, 3325 ], [ 3327 ], [ 3329, 3331 ], [ 3333 ], [ 3335, 3337 ], [ 3339, 3341 ], [ 3343 ], [ 3345, 3347 ], [ 3349 ], [ 3351, 3353 ], [ 3355 ], [ 3357 ], [ 3359 ], [ 3361 ], [ 3363, 3365 ], [ 3367, 3369 ], [ 3371 ], [ 3373, 3375 ], [ 3377 ], [ 3379, 3381 ], [ 3383 ], [ 3385 ], [ 3387 ], [ 3389 ], [ 3391, 3393 ], [ 3395 ], [ 3397 ], [ 3399 ], [ 3401 ], [ 3403 ], [ 3405 ], [ 3407 ], [ 3409 ], [ 3411 ], [ 3413 ], [ 3415 ], [ 3417, 3419 ], [ 3421 ], [ 3423 ], [ 3425 ], [ 3427 ], [ 3429 ], [ 3431 ], [ 3433 ], [ 3435 ], [ 3437 ], [ 3439 ], [ 3441 ], [ 3443, 3445 ], [ 3447 ], [ 3449 ], [ 3451 ], [ 3453 ], [ 3455 ], [ 3457 ], [ 3459 ], [ 3461 ], [ 3463, 3465 ], [ 3467 ], [ 3469 ], [ 3471 ], [ 3473 ], [ 3475 ], [ 3477 ], [ 3479, 3481 ], [ 3483 ], [ 3485 ], [ 3487 ], [ 3489, 3491 ], [ 3493 ], [ 3495 ], [ 3497 ], [ 3499 ], [ 3501 ], [ 3503 ], [ 3505 ], [ 3507, 3509 ], [ 3511 ], [ 3513 ], [ 3515 ], [ 3517 ], [ 3519 ], [ 3521 ], [ 3523 ], [ 3525, 3527 ], [ 3529 ], [ 3531 ], [ 3533 ], [ 3535 ], [ 3537 ], [ 3539 ], [ 3541 ], [ 3543, 3545 ], [ 3547 ], [ 3549 ], [ 3551 ], [ 3553 ], [ 3555 ], [ 3557 ], [ 3559 ], [ 3561, 3563 ], [ 3565 ], [ 3567 ], [ 3569 ], [ 3571 ], [ 3573 ], [ 3575 ], [ 3577 ], [ 3579, 3581 ], [ 3583 ], [ 3585, 3587 ], [ 3589 ], [ 3591, 3593 ], [ 3595 ], [ 3597 ], [ 3599, 3601 ], [ 3603 ], [ 3605 ], [ 3607 ], [ 3609 ], [ 3611 ], [ 3613 ], [ 3615 ], [ 3617, 3619, 3621, 3623, 3625, 3627 ], [ 3629 ], [ 3631 ], [ 3633 ], [ 3637 ], [ 3639 ], [ 3641 ], [ 3643 ], [ 3645 ], [ 3649 ], [ 3651, 3653 ], [ 3655 ], [ 3657, 3659 ], [ 3661 ], [ 3663 ], [ 3665 ], [ 3667 ], [ 3669, 3671 ], [ 3673 ], [ 3675 ], [ 3677 ], [ 3679 ], [ 3681 ], [ 3683, 3685, 3687, 3689, 3691, 3693, 3695, 3697, 3699 ], [ 3701 ], [ 3703 ], [ 3705 ], [ 3707 ], [ 3711 ], [ 3713 ], [ 3715, 3717 ], [ 3721 ], [ 3723, 3725 ], [ 3727 ], [ 3729, 3731 ], [ 3733 ], [ 3737, 3739 ], [ 3741 ], [ 3743 ], [ 3745 ], [ 3747 ], [ 3749 ], [ 3751, 3753 ], [ 3755 ], [ 3757 ], [ 3759 ], [ 3761 ], [ 3763 ], [ 3765, 3767 ], [ 3769 ], [ 3771 ], [ 3773 ], [ 3775 ], [ 3777 ], [ 3779, 3781 ], [ 3783 ], [ 3785 ], [ 3787 ], [ 3789 ], [ 3791 ], [ 3793, 3795 ], [ 3797 ], [ 3799 ], [ 3801 ], [ 3803 ], [ 3805 ], [ 3807, 3809 ], [ 3811 ], [ 3813, 3815 ], [ 3817 ], [ 3819, 3821 ], [ 3823 ], [ 3825, 3827 ], [ 3829 ], [ 3831, 3839 ], [ 3841 ], [ 3843 ], [ 3845, 3847 ], [ 3849 ], [ 3851 ], [ 3853 ], [ 3855 ], [ 3857 ], [ 3859 ], [ 3861 ], [ 3865 ], [ 3867 ], [ 3875 ], [ 3877 ], [ 3879 ], [ 3881 ], [ 3883 ], [ 3885 ], [ 3887 ], [ 3889 ], [ 3891 ], [ 3893 ], [ 3895 ], [ 3897 ], [ 3899 ], [ 3901 ], [ 3903 ], [ 3905 ], [ 3907 ], [ 3909 ], [ 3911 ], [ 3913 ], [ 3915 ], [ 3917 ], [ 3919 ], [ 3921 ], [ 3923 ], [ 3925 ], [ 3927 ], [ 3929 ], [ 3933 ], [ 3935 ], [ 3937 ], [ 3939 ], [ 3941 ], [ 3943 ], [ 3945 ], [ 3947 ], [ 3949 ], [ 3951 ], [ 3953 ], [ 3955, 3957 ], [ 3959, 3961 ], [ 3963 ], [ 3965 ], [ 3967 ], [ 3969 ], [ 3971 ], [ 3973 ], [ 3975 ], [ 3977 ], [ 3979 ], [ 3981 ], [ 3983 ], [ 3985 ], [ 3987 ], [ 3989 ] ]
21,734
static void rtas_int_on(sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { struct ics_state *ics = spapr->icp->ics; uint32_t nr; if ((nargs != 1) || (nret != 1)) { rtas_st(rets, 0, -3); return; } nr = rtas_ld(args, 0); if (!ics_valid_irq(ics, nr)) { rtas_st(rets, 0, -3); return; } ics_write_xive(ics, nr, ics->irqs[nr - ics->offset].server, ics->irqs[nr - ics->offset].saved_priority, ics->irqs[nr - ics->offset].saved_priority); rtas_st(rets, 0, 0); /* Success */ }
false
qemu
210b580b106fa798149e28aa13c66b325a43204e
static void rtas_int_on(sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { struct ics_state *ics = spapr->icp->ics; uint32_t nr; if ((nargs != 1) || (nret != 1)) { rtas_st(rets, 0, -3); return; } nr = rtas_ld(args, 0); if (!ics_valid_irq(ics, nr)) { rtas_st(rets, 0, -3); return; } ics_write_xive(ics, nr, ics->irqs[nr - ics->offset].server, ics->irqs[nr - ics->offset].saved_priority, ics->irqs[nr - ics->offset].saved_priority); rtas_st(rets, 0, 0); }
{ "code": [], "line_no": [] }
static void FUNC_0(sPAPREnvironment *VAR_0, uint32_t VAR_1, uint32_t VAR_2, target_ulong VAR_3, uint32_t VAR_4, target_ulong VAR_5) { struct ics_state *VAR_6 = VAR_0->icp->VAR_6; uint32_t nr; if ((VAR_2 != 1) || (VAR_4 != 1)) { rtas_st(VAR_5, 0, -3); return; } nr = rtas_ld(VAR_3, 0); if (!ics_valid_irq(VAR_6, nr)) { rtas_st(VAR_5, 0, -3); return; } ics_write_xive(VAR_6, nr, VAR_6->irqs[nr - VAR_6->offset].server, VAR_6->irqs[nr - VAR_6->offset].saved_priority, VAR_6->irqs[nr - VAR_6->offset].saved_priority); rtas_st(VAR_5, 0, 0); }
[ "static void FUNC_0(sPAPREnvironment *VAR_0, uint32_t VAR_1,\nuint32_t VAR_2, target_ulong VAR_3,\nuint32_t VAR_4, target_ulong VAR_5)\n{", "struct ics_state *VAR_6 = VAR_0->icp->VAR_6;", "uint32_t nr;", "if ((VAR_2 != 1) || (VAR_4 != 1)) {", "rtas_st(VAR_5, 0, -3);", "return;", "}", "nr = rtas_ld(VAR_3, 0);", "if (!ics_valid_irq(VAR_6, nr)) {", "rtas_st(VAR_5, 0, -3);", "return;", "}", "ics_write_xive(VAR_6, nr, VAR_6->irqs[nr - VAR_6->offset].server,\nVAR_6->irqs[nr - VAR_6->offset].saved_priority,\nVAR_6->irqs[nr - VAR_6->offset].saved_priority);", "rtas_st(VAR_5, 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 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39, 41, 43 ], [ 47 ], [ 49 ] ]
21,735
static void do_info(Monitor *mon, const QDict *qdict, QObject **ret_data) { const mon_cmd_t *cmd; const char *item = qdict_get_try_str(qdict, "item"); if (!item) goto help; for (cmd = info_cmds; cmd->name != NULL; cmd++) { if (compare_cmd(item, cmd->name)) break; } if (cmd->name == NULL) goto help; if (monitor_handler_ported(cmd)) { cmd->mhandler.info_new(mon, ret_data); if (*ret_data) cmd->user_print(mon, *ret_data); } else { cmd->mhandler.info(mon); } return; help: help_cmd(mon, "info"); }
false
qemu
25b422eb4051b9b7473feea1ae848f1e3b4f799f
static void do_info(Monitor *mon, const QDict *qdict, QObject **ret_data) { const mon_cmd_t *cmd; const char *item = qdict_get_try_str(qdict, "item"); if (!item) goto help; for (cmd = info_cmds; cmd->name != NULL; cmd++) { if (compare_cmd(item, cmd->name)) break; } if (cmd->name == NULL) goto help; if (monitor_handler_ported(cmd)) { cmd->mhandler.info_new(mon, ret_data); if (*ret_data) cmd->user_print(mon, *ret_data); } else { cmd->mhandler.info(mon); } return; help: help_cmd(mon, "info"); }
{ "code": [], "line_no": [] }
static void FUNC_0(Monitor *VAR_0, const QDict *VAR_1, QObject **VAR_2) { const mon_cmd_t *VAR_3; const char *VAR_4 = qdict_get_try_str(VAR_1, "VAR_4"); if (!VAR_4) goto help; for (VAR_3 = info_cmds; VAR_3->name != NULL; VAR_3++) { if (compare_cmd(VAR_4, VAR_3->name)) break; } if (VAR_3->name == NULL) goto help; if (monitor_handler_ported(VAR_3)) { VAR_3->mhandler.info_new(VAR_0, VAR_2); if (*VAR_2) VAR_3->user_print(VAR_0, *VAR_2); } else { VAR_3->mhandler.info(VAR_0); } return; help: help_cmd(VAR_0, "info"); }
[ "static void FUNC_0(Monitor *VAR_0, const QDict *VAR_1, QObject **VAR_2)\n{", "const mon_cmd_t *VAR_3;", "const char *VAR_4 = qdict_get_try_str(VAR_1, \"VAR_4\");", "if (!VAR_4)\ngoto help;", "for (VAR_3 = info_cmds; VAR_3->name != NULL; VAR_3++) {", "if (compare_cmd(VAR_4, VAR_3->name))\nbreak;", "}", "if (VAR_3->name == NULL)\ngoto help;", "if (monitor_handler_ported(VAR_3)) {", "VAR_3->mhandler.info_new(VAR_0, VAR_2);", "if (*VAR_2)\nVAR_3->user_print(VAR_0, *VAR_2);", "} else {", "VAR_3->mhandler.info(VAR_0);", "}", "return;", "help:\nhelp_cmd(VAR_0, \"info\");", "}" ]
[ 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 ], [ 27, 29 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 53, 55 ], [ 57 ] ]
21,736
static int ehci_state_fetchsitd(EHCIState *ehci, int async) { uint32_t entry; EHCIsitd sitd; assert(!async); entry = ehci_get_fetch_addr(ehci, async); get_dwords(NLPTR_GET(entry), (uint32_t *)&sitd, sizeof(EHCIsitd) >> 2); ehci_trace_sitd(ehci, entry, &sitd); if (!(sitd.results & SITD_RESULTS_ACTIVE)) { /* siTD is not active, nothing to do */; } else { /* TODO: split transfers are not implemented */ fprintf(stderr, "WARNING: Skipping active siTD\n"); } ehci_set_fetch_addr(ehci, async, sitd.next); ehci_set_state(ehci, async, EST_FETCHENTRY); return 1; }
false
qemu
68d553587c0aa271c3eb2902921b503740d775b6
static int ehci_state_fetchsitd(EHCIState *ehci, int async) { uint32_t entry; EHCIsitd sitd; assert(!async); entry = ehci_get_fetch_addr(ehci, async); get_dwords(NLPTR_GET(entry), (uint32_t *)&sitd, sizeof(EHCIsitd) >> 2); ehci_trace_sitd(ehci, entry, &sitd); if (!(sitd.results & SITD_RESULTS_ACTIVE)) { ; } else { fprintf(stderr, "WARNING: Skipping active siTD\n"); } ehci_set_fetch_addr(ehci, async, sitd.next); ehci_set_state(ehci, async, EST_FETCHENTRY); return 1; }
{ "code": [], "line_no": [] }
static int FUNC_0(EHCIState *VAR_0, int VAR_1) { uint32_t entry; EHCIsitd sitd; assert(!VAR_1); entry = ehci_get_fetch_addr(VAR_0, VAR_1); get_dwords(NLPTR_GET(entry), (uint32_t *)&sitd, sizeof(EHCIsitd) >> 2); ehci_trace_sitd(VAR_0, entry, &sitd); if (!(sitd.results & SITD_RESULTS_ACTIVE)) { ; } else { fprintf(stderr, "WARNING: Skipping active siTD\n"); } ehci_set_fetch_addr(VAR_0, VAR_1, sitd.next); ehci_set_state(VAR_0, VAR_1, EST_FETCHENTRY); return 1; }
[ "static int FUNC_0(EHCIState *VAR_0, int VAR_1)\n{", "uint32_t entry;", "EHCIsitd sitd;", "assert(!VAR_1);", "entry = ehci_get_fetch_addr(VAR_0, VAR_1);", "get_dwords(NLPTR_GET(entry), (uint32_t *)&sitd,\nsizeof(EHCIsitd) >> 2);", "ehci_trace_sitd(VAR_0, entry, &sitd);", "if (!(sitd.results & SITD_RESULTS_ACTIVE)) {", ";", "} else {", "fprintf(stderr, \"WARNING: Skipping active siTD\\n\");", "}", "ehci_set_fetch_addr(VAR_0, VAR_1, sitd.next);", "ehci_set_state(VAR_0, VAR_1, EST_FETCHENTRY);", "return 1;", "}" ]
[ 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 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ] ]
21,737
static void test_cdrom_dma(void) { static const size_t len = ATAPI_BLOCK_SIZE; char *pattern = g_malloc(ATAPI_BLOCK_SIZE * 16); char *rx = g_malloc0(len); uintptr_t guest_buf; PrdtEntry prdt[1]; FILE *fh; ide_test_start("-drive if=none,file=%s,media=cdrom,format=raw,id=sr0,index=0 " "-device ide-cd,drive=sr0,bus=ide.0", tmp_path); qtest_irq_intercept_in(global_qtest, "ioapic"); guest_buf = guest_alloc(guest_malloc, len); prdt[0].addr = cpu_to_le32(guest_buf); prdt[0].size = cpu_to_le32(len | PRDT_EOT); generate_pattern(pattern, ATAPI_BLOCK_SIZE * 16, ATAPI_BLOCK_SIZE); fh = fopen(tmp_path, "w+"); fwrite(pattern, ATAPI_BLOCK_SIZE, 16, fh); fclose(fh); send_dma_request(CMD_PACKET, 0, 1, prdt, 1, send_scsi_cdb_read10); /* Read back data from guest memory into local qtest memory */ memread(guest_buf, rx, len); g_assert_cmpint(memcmp(pattern, rx, len), ==, 0); g_free(pattern); g_free(rx); test_bmdma_teardown(); }
false
qemu
543f8f13e256a081dd820375e9575439b659ccd8
static void test_cdrom_dma(void) { static const size_t len = ATAPI_BLOCK_SIZE; char *pattern = g_malloc(ATAPI_BLOCK_SIZE * 16); char *rx = g_malloc0(len); uintptr_t guest_buf; PrdtEntry prdt[1]; FILE *fh; ide_test_start("-drive if=none,file=%s,media=cdrom,format=raw,id=sr0,index=0 " "-device ide-cd,drive=sr0,bus=ide.0", tmp_path); qtest_irq_intercept_in(global_qtest, "ioapic"); guest_buf = guest_alloc(guest_malloc, len); prdt[0].addr = cpu_to_le32(guest_buf); prdt[0].size = cpu_to_le32(len | PRDT_EOT); generate_pattern(pattern, ATAPI_BLOCK_SIZE * 16, ATAPI_BLOCK_SIZE); fh = fopen(tmp_path, "w+"); fwrite(pattern, ATAPI_BLOCK_SIZE, 16, fh); fclose(fh); send_dma_request(CMD_PACKET, 0, 1, prdt, 1, send_scsi_cdb_read10); memread(guest_buf, rx, len); g_assert_cmpint(memcmp(pattern, rx, len), ==, 0); g_free(pattern); g_free(rx); test_bmdma_teardown(); }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { static const size_t VAR_0 = ATAPI_BLOCK_SIZE; char *VAR_1 = g_malloc(ATAPI_BLOCK_SIZE * 16); char *VAR_2 = g_malloc0(VAR_0); uintptr_t guest_buf; PrdtEntry prdt[1]; FILE *fh; ide_test_start("-drive if=none,file=%s,media=cdrom,format=raw,id=sr0,index=0 " "-device ide-cd,drive=sr0,bus=ide.0", tmp_path); qtest_irq_intercept_in(global_qtest, "ioapic"); guest_buf = guest_alloc(guest_malloc, VAR_0); prdt[0].addr = cpu_to_le32(guest_buf); prdt[0].size = cpu_to_le32(VAR_0 | PRDT_EOT); generate_pattern(VAR_1, ATAPI_BLOCK_SIZE * 16, ATAPI_BLOCK_SIZE); fh = fopen(tmp_path, "w+"); fwrite(VAR_1, ATAPI_BLOCK_SIZE, 16, fh); fclose(fh); send_dma_request(CMD_PACKET, 0, 1, prdt, 1, send_scsi_cdb_read10); memread(guest_buf, VAR_2, VAR_0); g_assert_cmpint(memcmp(VAR_1, VAR_2, VAR_0), ==, 0); g_free(VAR_1); g_free(VAR_2); test_bmdma_teardown(); }
[ "static void FUNC_0(void)\n{", "static const size_t VAR_0 = ATAPI_BLOCK_SIZE;", "char *VAR_1 = g_malloc(ATAPI_BLOCK_SIZE * 16);", "char *VAR_2 = g_malloc0(VAR_0);", "uintptr_t guest_buf;", "PrdtEntry prdt[1];", "FILE *fh;", "ide_test_start(\"-drive if=none,file=%s,media=cdrom,format=raw,id=sr0,index=0 \"\n\"-device ide-cd,drive=sr0,bus=ide.0\", tmp_path);", "qtest_irq_intercept_in(global_qtest, \"ioapic\");", "guest_buf = guest_alloc(guest_malloc, VAR_0);", "prdt[0].addr = cpu_to_le32(guest_buf);", "prdt[0].size = cpu_to_le32(VAR_0 | PRDT_EOT);", "generate_pattern(VAR_1, ATAPI_BLOCK_SIZE * 16, ATAPI_BLOCK_SIZE);", "fh = fopen(tmp_path, \"w+\");", "fwrite(VAR_1, ATAPI_BLOCK_SIZE, 16, fh);", "fclose(fh);", "send_dma_request(CMD_PACKET, 0, 1, prdt, 1, send_scsi_cdb_read10);", "memread(guest_buf, VAR_2, VAR_0);", "g_assert_cmpint(memcmp(VAR_1, VAR_2, VAR_0), ==, 0);", "g_free(VAR_1);", "g_free(VAR_2);", "test_bmdma_teardown();", "}" ]
[ 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 ], [ 19, 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ] ]
21,741
static void test_abstract_interfaces(void) { QList *all_types; QList *obj_types; QListEntry *ae; qtest_start(common_args); /* qom-list-types implements=interface would return any type * that implements _any_ interface (not just interface types), * so use a trick to find the interface type names: * - list all object types * - list all types, and look for items that are not * on the first list */ all_types = qom_list_types(NULL, false); obj_types = qom_list_types("object", false); QLIST_FOREACH_ENTRY(all_types, ae) { QDict *at = qobject_to_qdict(qlist_entry_obj(ae)); const char *aname = qdict_get_str(at, "name"); QListEntry *oe; const char *found = NULL; QLIST_FOREACH_ENTRY(obj_types, oe) { QDict *ot = qobject_to_qdict(qlist_entry_obj(oe)); const char *oname = qdict_get_str(ot, "name"); if (!strcmp(aname, oname)) { found = oname; break; } } /* Using g_assert_cmpstr() will give more useful failure * messages than g_assert(found) */ g_assert_cmpstr(aname, ==, found); } QDECREF(all_types); QDECREF(obj_types); qtest_end(); }
false
qemu
dbb2a604a94f3899fa34bd1ede462f213e822e03
static void test_abstract_interfaces(void) { QList *all_types; QList *obj_types; QListEntry *ae; qtest_start(common_args); all_types = qom_list_types(NULL, false); obj_types = qom_list_types("object", false); QLIST_FOREACH_ENTRY(all_types, ae) { QDict *at = qobject_to_qdict(qlist_entry_obj(ae)); const char *aname = qdict_get_str(at, "name"); QListEntry *oe; const char *found = NULL; QLIST_FOREACH_ENTRY(obj_types, oe) { QDict *ot = qobject_to_qdict(qlist_entry_obj(oe)); const char *oname = qdict_get_str(ot, "name"); if (!strcmp(aname, oname)) { found = oname; break; } } g_assert_cmpstr(aname, ==, found); } QDECREF(all_types); QDECREF(obj_types); qtest_end(); }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { QList *all_types; QList *obj_types; QListEntry *ae; qtest_start(common_args); all_types = qom_list_types(NULL, false); obj_types = qom_list_types("object", false); QLIST_FOREACH_ENTRY(all_types, ae) { QDict *at = qobject_to_qdict(qlist_entry_obj(ae)); const char *aname = qdict_get_str(at, "name"); QListEntry *oe; const char *found = NULL; QLIST_FOREACH_ENTRY(obj_types, oe) { QDict *ot = qobject_to_qdict(qlist_entry_obj(oe)); const char *oname = qdict_get_str(ot, "name"); if (!strcmp(aname, oname)) { found = oname; break; } } g_assert_cmpstr(aname, ==, found); } QDECREF(all_types); QDECREF(obj_types); qtest_end(); }
[ "static void FUNC_0(void)\n{", "QList *all_types;", "QList *obj_types;", "QListEntry *ae;", "qtest_start(common_args);", "all_types = qom_list_types(NULL, false);", "obj_types = qom_list_types(\"object\", false);", "QLIST_FOREACH_ENTRY(all_types, ae) {", "QDict *at = qobject_to_qdict(qlist_entry_obj(ae));", "const char *aname = qdict_get_str(at, \"name\");", "QListEntry *oe;", "const char *found = NULL;", "QLIST_FOREACH_ENTRY(obj_types, oe) {", "QDict *ot = qobject_to_qdict(qlist_entry_obj(oe));", "const char *oname = qdict_get_str(ot, \"name\");", "if (!strcmp(aname, oname)) {", "found = oname;", "break;", "}", "}", "g_assert_cmpstr(aname, ==, found);", "}", "QDECREF(all_types);", "QDECREF(obj_types);", "qtest_end();", "}" ]
[ 0, 0, 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 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ] ]
21,742
static void mips_fulong2e_init(ram_addr_t ram_size, const char *boot_device, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { char *filename; unsigned long ram_offset, bios_offset; long bios_size; int64_t kernel_entry; qemu_irq *i8259; qemu_irq *cpu_exit_irq; int via_devfn; PCIBus *pci_bus; uint8_t *eeprom_buf; i2c_bus *smbus; int i; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; DeviceState *eeprom; CPUState *env; /* init CPUs */ if (cpu_model == NULL) { cpu_model = "Loongson-2E"; } env = cpu_init(cpu_model); if (!env) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } register_savevm(NULL, "cpu", 0, 3, cpu_save, cpu_load, env); qemu_register_reset(main_cpu_reset, env); /* fulong 2e has 256M ram. */ ram_size = 256 * 1024 * 1024; /* fulong 2e has a 1M flash.Winbond W39L040AP70Z */ bios_size = 1024 * 1024; /* allocate RAM */ ram_offset = qemu_ram_alloc(NULL, "fulong2e.ram", ram_size); bios_offset = qemu_ram_alloc(NULL, "fulong2e.bios", bios_size); cpu_register_physical_memory(0, ram_size, ram_offset); cpu_register_physical_memory(0x1fc00000LL, bios_size, bios_offset | IO_MEM_ROM); /* We do not support flash operation, just loading pmon.bin as raw BIOS. * Please use -L to set the BIOS path and -bios to set bios name. */ if (kernel_filename) { loaderparams.ram_size = ram_size; loaderparams.kernel_filename = kernel_filename; loaderparams.kernel_cmdline = kernel_cmdline; loaderparams.initrd_filename = initrd_filename; kernel_entry = load_kernel (env); write_bootloader(env, qemu_get_ram_ptr(bios_offset), kernel_entry); } else { if (bios_name == NULL) { bios_name = FULONG_BIOSNAME; } filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (filename) { bios_size = load_image_targphys(filename, 0x1fc00000LL, BIOS_SIZE); qemu_free(filename); } else { bios_size = -1; } if ((bios_size < 0 || bios_size > BIOS_SIZE) && !kernel_filename) { fprintf(stderr, "qemu: Could not load MIPS bios '%s'\n", bios_name); exit(1); } } /* Init internal devices */ cpu_mips_irq_init_cpu(env); cpu_mips_clock_init(env); /* Interrupt controller */ /* The 8259 -> IP5 */ i8259 = i8259_init(env->irq[5]); /* North bridge, Bonito --> IP2 */ pci_bus = bonito_init((qemu_irq *)&(env->irq[2])); /* South bridge */ if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) { fprintf(stderr, "qemu: too many IDE bus\n"); exit(1); } for(i = 0; i < MAX_IDE_BUS * MAX_IDE_DEVS; i++) { hd[i] = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); } via_devfn = vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 0)); if (via_devfn < 0) { fprintf(stderr, "vt82c686b_init error \n"); exit(1); } isa_bus_irqs(i8259); vt82c686b_ide_init(pci_bus, hd, PCI_DEVFN(FULONG2E_VIA_SLOT, 1)); usb_uhci_vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 2)); usb_uhci_vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 3)); smbus = vt82c686b_pm_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 4), 0xeee1, NULL); eeprom_buf = qemu_mallocz(8 * 256); /* XXX: make this persistent */ memcpy(eeprom_buf, eeprom_spd, sizeof(eeprom_spd)); /* TODO: Populate SPD eeprom data. */ eeprom = qdev_create((BusState *)smbus, "smbus-eeprom"); qdev_prop_set_uint8(eeprom, "address", 0x50); qdev_prop_set_ptr(eeprom, "data", eeprom_buf); qdev_init_nofail(eeprom); /* init other devices */ pit = pit_init(0x40, isa_reserve_irq(0)); cpu_exit_irq = qemu_allocate_irqs(cpu_request_exit, NULL, 1); DMA_init(0, cpu_exit_irq); /* Super I/O */ isa_create_simple("i8042"); rtc_init(2000, NULL); for(i = 0; i < MAX_SERIAL_PORTS; i++) { if (serial_hds[i]) { serial_isa_init(i, serial_hds[i]); } } if (parallel_hds[0]) { parallel_init(0, parallel_hds[0]); } /* Sound card */ audio_init(pci_bus); /* Network card */ network_init(); }
false
qemu
64d7e9a421fea0ac50b44541f5521de455e7cd5d
static void mips_fulong2e_init(ram_addr_t ram_size, const char *boot_device, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { char *filename; unsigned long ram_offset, bios_offset; long bios_size; int64_t kernel_entry; qemu_irq *i8259; qemu_irq *cpu_exit_irq; int via_devfn; PCIBus *pci_bus; uint8_t *eeprom_buf; i2c_bus *smbus; int i; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; DeviceState *eeprom; CPUState *env; if (cpu_model == NULL) { cpu_model = "Loongson-2E"; } env = cpu_init(cpu_model); if (!env) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } register_savevm(NULL, "cpu", 0, 3, cpu_save, cpu_load, env); qemu_register_reset(main_cpu_reset, env); ram_size = 256 * 1024 * 1024; bios_size = 1024 * 1024; ram_offset = qemu_ram_alloc(NULL, "fulong2e.ram", ram_size); bios_offset = qemu_ram_alloc(NULL, "fulong2e.bios", bios_size); cpu_register_physical_memory(0, ram_size, ram_offset); cpu_register_physical_memory(0x1fc00000LL, bios_size, bios_offset | IO_MEM_ROM); if (kernel_filename) { loaderparams.ram_size = ram_size; loaderparams.kernel_filename = kernel_filename; loaderparams.kernel_cmdline = kernel_cmdline; loaderparams.initrd_filename = initrd_filename; kernel_entry = load_kernel (env); write_bootloader(env, qemu_get_ram_ptr(bios_offset), kernel_entry); } else { if (bios_name == NULL) { bios_name = FULONG_BIOSNAME; } filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (filename) { bios_size = load_image_targphys(filename, 0x1fc00000LL, BIOS_SIZE); qemu_free(filename); } else { bios_size = -1; } if ((bios_size < 0 || bios_size > BIOS_SIZE) && !kernel_filename) { fprintf(stderr, "qemu: Could not load MIPS bios '%s'\n", bios_name); exit(1); } } cpu_mips_irq_init_cpu(env); cpu_mips_clock_init(env); i8259 = i8259_init(env->irq[5]); pci_bus = bonito_init((qemu_irq *)&(env->irq[2])); if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) { fprintf(stderr, "qemu: too many IDE bus\n"); exit(1); } for(i = 0; i < MAX_IDE_BUS * MAX_IDE_DEVS; i++) { hd[i] = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); } via_devfn = vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 0)); if (via_devfn < 0) { fprintf(stderr, "vt82c686b_init error \n"); exit(1); } isa_bus_irqs(i8259); vt82c686b_ide_init(pci_bus, hd, PCI_DEVFN(FULONG2E_VIA_SLOT, 1)); usb_uhci_vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 2)); usb_uhci_vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 3)); smbus = vt82c686b_pm_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 4), 0xeee1, NULL); eeprom_buf = qemu_mallocz(8 * 256); memcpy(eeprom_buf, eeprom_spd, sizeof(eeprom_spd)); eeprom = qdev_create((BusState *)smbus, "smbus-eeprom"); qdev_prop_set_uint8(eeprom, "address", 0x50); qdev_prop_set_ptr(eeprom, "data", eeprom_buf); qdev_init_nofail(eeprom); pit = pit_init(0x40, isa_reserve_irq(0)); cpu_exit_irq = qemu_allocate_irqs(cpu_request_exit, NULL, 1); DMA_init(0, cpu_exit_irq); isa_create_simple("i8042"); rtc_init(2000, NULL); for(i = 0; i < MAX_SERIAL_PORTS; i++) { if (serial_hds[i]) { serial_isa_init(i, serial_hds[i]); } } if (parallel_hds[0]) { parallel_init(0, parallel_hds[0]); } audio_init(pci_bus); network_init(); }
{ "code": [], "line_no": [] }
static void FUNC_0(ram_addr_t VAR_0, const char *VAR_1, const char *VAR_2, const char *VAR_3, const char *VAR_4, const char *VAR_5) { char *VAR_6; unsigned long VAR_7, VAR_8; long VAR_9; int64_t kernel_entry; qemu_irq *i8259; qemu_irq *cpu_exit_irq; int VAR_10; PCIBus *pci_bus; uint8_t *eeprom_buf; i2c_bus *smbus; int VAR_11; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; DeviceState *eeprom; CPUState *env; if (VAR_5 == NULL) { VAR_5 = "Loongson-2E"; } env = cpu_init(VAR_5); if (!env) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } register_savevm(NULL, "cpu", 0, 3, cpu_save, cpu_load, env); qemu_register_reset(main_cpu_reset, env); VAR_0 = 256 * 1024 * 1024; VAR_9 = 1024 * 1024; VAR_7 = qemu_ram_alloc(NULL, "fulong2e.ram", VAR_0); VAR_8 = qemu_ram_alloc(NULL, "fulong2e.bios", VAR_9); cpu_register_physical_memory(0, VAR_0, VAR_7); cpu_register_physical_memory(0x1fc00000LL, VAR_9, VAR_8 | IO_MEM_ROM); if (VAR_2) { loaderparams.VAR_0 = VAR_0; loaderparams.VAR_2 = VAR_2; loaderparams.VAR_3 = VAR_3; loaderparams.VAR_4 = VAR_4; kernel_entry = load_kernel (env); write_bootloader(env, qemu_get_ram_ptr(VAR_8), kernel_entry); } else { if (bios_name == NULL) { bios_name = FULONG_BIOSNAME; } VAR_6 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (VAR_6) { VAR_9 = load_image_targphys(VAR_6, 0x1fc00000LL, BIOS_SIZE); qemu_free(VAR_6); } else { VAR_9 = -1; } if ((VAR_9 < 0 || VAR_9 > BIOS_SIZE) && !VAR_2) { fprintf(stderr, "qemu: Could not load MIPS bios '%s'\n", bios_name); exit(1); } } cpu_mips_irq_init_cpu(env); cpu_mips_clock_init(env); i8259 = i8259_init(env->irq[5]); pci_bus = bonito_init((qemu_irq *)&(env->irq[2])); if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) { fprintf(stderr, "qemu: too many IDE bus\n"); exit(1); } for(VAR_11 = 0; VAR_11 < MAX_IDE_BUS * MAX_IDE_DEVS; VAR_11++) { hd[VAR_11] = drive_get(IF_IDE, VAR_11 / MAX_IDE_DEVS, VAR_11 % MAX_IDE_DEVS); } VAR_10 = vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 0)); if (VAR_10 < 0) { fprintf(stderr, "vt82c686b_init error \n"); exit(1); } isa_bus_irqs(i8259); vt82c686b_ide_init(pci_bus, hd, PCI_DEVFN(FULONG2E_VIA_SLOT, 1)); usb_uhci_vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 2)); usb_uhci_vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 3)); smbus = vt82c686b_pm_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 4), 0xeee1, NULL); eeprom_buf = qemu_mallocz(8 * 256); memcpy(eeprom_buf, eeprom_spd, sizeof(eeprom_spd)); eeprom = qdev_create((BusState *)smbus, "smbus-eeprom"); qdev_prop_set_uint8(eeprom, "address", 0x50); qdev_prop_set_ptr(eeprom, "data", eeprom_buf); qdev_init_nofail(eeprom); pit = pit_init(0x40, isa_reserve_irq(0)); cpu_exit_irq = qemu_allocate_irqs(cpu_request_exit, NULL, 1); DMA_init(0, cpu_exit_irq); isa_create_simple("i8042"); rtc_init(2000, NULL); for(VAR_11 = 0; VAR_11 < MAX_SERIAL_PORTS; VAR_11++) { if (serial_hds[VAR_11]) { serial_isa_init(VAR_11, serial_hds[VAR_11]); } } if (parallel_hds[0]) { parallel_init(0, parallel_hds[0]); } audio_init(pci_bus); network_init(); }
[ "static void FUNC_0(ram_addr_t VAR_0, const char *VAR_1,\nconst char *VAR_2, const char *VAR_3,\nconst char *VAR_4, const char *VAR_5)\n{", "char *VAR_6;", "unsigned long VAR_7, VAR_8;", "long VAR_9;", "int64_t kernel_entry;", "qemu_irq *i8259;", "qemu_irq *cpu_exit_irq;", "int VAR_10;", "PCIBus *pci_bus;", "uint8_t *eeprom_buf;", "i2c_bus *smbus;", "int VAR_11;", "DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];", "DeviceState *eeprom;", "CPUState *env;", "if (VAR_5 == NULL) {", "VAR_5 = \"Loongson-2E\";", "}", "env = cpu_init(VAR_5);", "if (!env) {", "fprintf(stderr, \"Unable to find CPU definition\\n\");", "exit(1);", "}", "register_savevm(NULL, \"cpu\", 0, 3, cpu_save, cpu_load, env);", "qemu_register_reset(main_cpu_reset, env);", "VAR_0 = 256 * 1024 * 1024;", "VAR_9 = 1024 * 1024;", "VAR_7 = qemu_ram_alloc(NULL, \"fulong2e.ram\", VAR_0);", "VAR_8 = qemu_ram_alloc(NULL, \"fulong2e.bios\", VAR_9);", "cpu_register_physical_memory(0, VAR_0, VAR_7);", "cpu_register_physical_memory(0x1fc00000LL,\nVAR_9, VAR_8 | IO_MEM_ROM);", "if (VAR_2) {", "loaderparams.VAR_0 = VAR_0;", "loaderparams.VAR_2 = VAR_2;", "loaderparams.VAR_3 = VAR_3;", "loaderparams.VAR_4 = VAR_4;", "kernel_entry = load_kernel (env);", "write_bootloader(env, qemu_get_ram_ptr(VAR_8), kernel_entry);", "} else {", "if (bios_name == NULL) {", "bios_name = FULONG_BIOSNAME;", "}", "VAR_6 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);", "if (VAR_6) {", "VAR_9 = load_image_targphys(VAR_6, 0x1fc00000LL,\nBIOS_SIZE);", "qemu_free(VAR_6);", "} else {", "VAR_9 = -1;", "}", "if ((VAR_9 < 0 || VAR_9 > BIOS_SIZE) && !VAR_2) {", "fprintf(stderr, \"qemu: Could not load MIPS bios '%s'\\n\", bios_name);", "exit(1);", "}", "}", "cpu_mips_irq_init_cpu(env);", "cpu_mips_clock_init(env);", "i8259 = i8259_init(env->irq[5]);", "pci_bus = bonito_init((qemu_irq *)&(env->irq[2]));", "if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) {", "fprintf(stderr, \"qemu: too many IDE bus\\n\");", "exit(1);", "}", "for(VAR_11 = 0; VAR_11 < MAX_IDE_BUS * MAX_IDE_DEVS; VAR_11++) {", "hd[VAR_11] = drive_get(IF_IDE, VAR_11 / MAX_IDE_DEVS, VAR_11 % MAX_IDE_DEVS);", "}", "VAR_10 = vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 0));", "if (VAR_10 < 0) {", "fprintf(stderr, \"vt82c686b_init error \\n\");", "exit(1);", "}", "isa_bus_irqs(i8259);", "vt82c686b_ide_init(pci_bus, hd, PCI_DEVFN(FULONG2E_VIA_SLOT, 1));", "usb_uhci_vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 2));", "usb_uhci_vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 3));", "smbus = vt82c686b_pm_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 4),\n0xeee1, NULL);", "eeprom_buf = qemu_mallocz(8 * 256);", "memcpy(eeprom_buf, eeprom_spd, sizeof(eeprom_spd));", "eeprom = qdev_create((BusState *)smbus, \"smbus-eeprom\");", "qdev_prop_set_uint8(eeprom, \"address\", 0x50);", "qdev_prop_set_ptr(eeprom, \"data\", eeprom_buf);", "qdev_init_nofail(eeprom);", "pit = pit_init(0x40, isa_reserve_irq(0));", "cpu_exit_irq = qemu_allocate_irqs(cpu_request_exit, NULL, 1);", "DMA_init(0, cpu_exit_irq);", "isa_create_simple(\"i8042\");", "rtc_init(2000, NULL);", "for(VAR_11 = 0; VAR_11 < MAX_SERIAL_PORTS; VAR_11++) {", "if (serial_hds[VAR_11]) {", "serial_isa_init(VAR_11, serial_hds[VAR_11]);", "}", "}", "if (parallel_hds[0]) {", "parallel_init(0, parallel_hds[0]);", "}", "audio_init(pci_bus);", "network_init();", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 67 ], [ 73 ], [ 79 ], [ 81 ], [ 85 ], [ 87, 89 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 153 ], [ 155 ], [ 163 ], [ 169 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 185 ], [ 187 ], [ 189 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 215, 217 ], [ 219 ], [ 221 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 237 ], [ 239 ], [ 241 ], [ 247 ], [ 251 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 267 ], [ 269 ], [ 271 ], [ 277 ], [ 281 ], [ 283 ] ]
21,743
static ssize_t nic_receive(NetClientState *nc, const uint8_t * buf, size_t size) { /* TODO: * - Magic packets should set bit 30 in power management driver register. * - Interesting packets should set bit 29 in power management driver register. */ EEPRO100State *s = DO_UPCAST(NICState, nc, nc)->opaque; uint16_t rfd_status = 0xa000; #if defined(CONFIG_PAD_RECEIVED_FRAMES) uint8_t min_buf[60]; #endif static const uint8_t broadcast_macaddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; #if defined(CONFIG_PAD_RECEIVED_FRAMES) /* Pad to minimum Ethernet frame length */ if (size < sizeof(min_buf)) { memcpy(min_buf, buf, size); memset(&min_buf[size], 0, sizeof(min_buf) - size); buf = min_buf; size = sizeof(min_buf); } #endif if (s->configuration[8] & 0x80) { /* CSMA is disabled. */ logout("%p received while CSMA is disabled\n", s); return -1; #if !defined(CONFIG_PAD_RECEIVED_FRAMES) } else if (size < 64 && (s->configuration[7] & BIT(0))) { /* Short frame and configuration byte 7/0 (discard short receive) set: * Short frame is discarded */ logout("%p received short frame (%zu byte)\n", s, size); s->statistics.rx_short_frame_errors++; return -1; #endif } else if ((size > MAX_ETH_FRAME_SIZE + 4) && !(s->configuration[18] & BIT(3))) { /* Long frame and configuration byte 18/3 (long receive ok) not set: * Long frames are discarded. */ logout("%p received long frame (%zu byte), ignored\n", s, size); return -1; } else if (memcmp(buf, s->conf.macaddr.a, 6) == 0) { /* !!! */ /* Frame matches individual address. */ /* TODO: check configuration byte 15/4 (ignore U/L). */ TRACE(RXTX, logout("%p received frame for me, len=%zu\n", s, size)); } else if (memcmp(buf, broadcast_macaddr, 6) == 0) { /* Broadcast frame. */ TRACE(RXTX, logout("%p received broadcast, len=%zu\n", s, size)); rfd_status |= 0x0002; } else if (buf[0] & 0x01) { /* Multicast frame. */ TRACE(RXTX, logout("%p received multicast, len=%zu,%s\n", s, size, nic_dump(buf, size))); if (s->configuration[21] & BIT(3)) { /* Multicast all bit is set, receive all multicast frames. */ } else { unsigned mcast_idx = e100_compute_mcast_idx(buf); assert(mcast_idx < 64); if (s->mult[mcast_idx >> 3] & (1 << (mcast_idx & 7))) { /* Multicast frame is allowed in hash table. */ } else if (s->configuration[15] & BIT(0)) { /* Promiscuous: receive all. */ rfd_status |= 0x0004; } else { TRACE(RXTX, logout("%p multicast ignored\n", s)); return -1; } } /* TODO: Next not for promiscuous mode? */ rfd_status |= 0x0002; } else if (s->configuration[15] & BIT(0)) { /* Promiscuous: receive all. */ TRACE(RXTX, logout("%p received frame in promiscuous mode, len=%zu\n", s, size)); rfd_status |= 0x0004; } else if (s->configuration[20] & BIT(6)) { /* Multiple IA bit set. */ unsigned mcast_idx = compute_mcast_idx(buf); assert(mcast_idx < 64); if (s->mult[mcast_idx >> 3] & (1 << (mcast_idx & 7))) { TRACE(RXTX, logout("%p accepted, multiple IA bit set\n", s)); } else { TRACE(RXTX, logout("%p frame ignored, multiple IA bit set\n", s)); return -1; } } else { TRACE(RXTX, logout("%p received frame, ignored, len=%zu,%s\n", s, size, nic_dump(buf, size))); return size; } if (get_ru_state(s) != ru_ready) { /* No resources available. */ logout("no resources, state=%u\n", get_ru_state(s)); /* TODO: RNR interrupt only at first failed frame? */ eepro100_rnr_interrupt(s); s->statistics.rx_resource_errors++; #if 0 assert(!"no resources"); #endif return -1; } /* !!! */ eepro100_rx_t rx; pci_dma_read(&s->dev, s->ru_base + s->ru_offset, &rx, sizeof(eepro100_rx_t)); uint16_t rfd_command = le16_to_cpu(rx.command); uint16_t rfd_size = le16_to_cpu(rx.size); if (size > rfd_size) { logout("Receive buffer (%" PRId16 " bytes) too small for data " "(%zu bytes); data truncated\n", rfd_size, size); size = rfd_size; } #if !defined(CONFIG_PAD_RECEIVED_FRAMES) if (size < 64) { rfd_status |= 0x0080; } #endif TRACE(OTHER, logout("command 0x%04x, link 0x%08x, addr 0x%08x, size %u\n", rfd_command, rx.link, rx.rx_buf_addr, rfd_size)); stw_le_pci_dma(&s->dev, s->ru_base + s->ru_offset + offsetof(eepro100_rx_t, status), rfd_status); stw_le_pci_dma(&s->dev, s->ru_base + s->ru_offset + offsetof(eepro100_rx_t, count), size); /* Early receive interrupt not supported. */ #if 0 eepro100_er_interrupt(s); #endif /* Receive CRC Transfer not supported. */ if (s->configuration[18] & BIT(2)) { missing("Receive CRC Transfer"); return -1; } /* TODO: check stripping enable bit. */ #if 0 assert(!(s->configuration[17] & BIT(0))); #endif pci_dma_write(&s->dev, s->ru_base + s->ru_offset + sizeof(eepro100_rx_t), buf, size); s->statistics.rx_good_frames++; eepro100_fr_interrupt(s); s->ru_offset = le32_to_cpu(rx.link); if (rfd_command & COMMAND_EL) { /* EL bit is set, so this was the last frame. */ logout("receive: Running out of frames\n"); set_ru_state(s, ru_suspended); } if (rfd_command & COMMAND_S) { /* S bit is set. */ set_ru_state(s, ru_suspended); } return size; }
false
qemu
1069985fb132cd4324fc02d371f1e61492a1823f
static ssize_t nic_receive(NetClientState *nc, const uint8_t * buf, size_t size) { EEPRO100State *s = DO_UPCAST(NICState, nc, nc)->opaque; uint16_t rfd_status = 0xa000; #if defined(CONFIG_PAD_RECEIVED_FRAMES) uint8_t min_buf[60]; #endif static const uint8_t broadcast_macaddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; #if defined(CONFIG_PAD_RECEIVED_FRAMES) if (size < sizeof(min_buf)) { memcpy(min_buf, buf, size); memset(&min_buf[size], 0, sizeof(min_buf) - size); buf = min_buf; size = sizeof(min_buf); } #endif if (s->configuration[8] & 0x80) { logout("%p received while CSMA is disabled\n", s); return -1; #if !defined(CONFIG_PAD_RECEIVED_FRAMES) } else if (size < 64 && (s->configuration[7] & BIT(0))) { logout("%p received short frame (%zu byte)\n", s, size); s->statistics.rx_short_frame_errors++; return -1; #endif } else if ((size > MAX_ETH_FRAME_SIZE + 4) && !(s->configuration[18] & BIT(3))) { logout("%p received long frame (%zu byte), ignored\n", s, size); return -1; } else if (memcmp(buf, s->conf.macaddr.a, 6) == 0) { TRACE(RXTX, logout("%p received frame for me, len=%zu\n", s, size)); } else if (memcmp(buf, broadcast_macaddr, 6) == 0) { TRACE(RXTX, logout("%p received broadcast, len=%zu\n", s, size)); rfd_status |= 0x0002; } else if (buf[0] & 0x01) { TRACE(RXTX, logout("%p received multicast, len=%zu,%s\n", s, size, nic_dump(buf, size))); if (s->configuration[21] & BIT(3)) { } else { unsigned mcast_idx = e100_compute_mcast_idx(buf); assert(mcast_idx < 64); if (s->mult[mcast_idx >> 3] & (1 << (mcast_idx & 7))) { } else if (s->configuration[15] & BIT(0)) { rfd_status |= 0x0004; } else { TRACE(RXTX, logout("%p multicast ignored\n", s)); return -1; } } rfd_status |= 0x0002; } else if (s->configuration[15] & BIT(0)) { TRACE(RXTX, logout("%p received frame in promiscuous mode, len=%zu\n", s, size)); rfd_status |= 0x0004; } else if (s->configuration[20] & BIT(6)) { unsigned mcast_idx = compute_mcast_idx(buf); assert(mcast_idx < 64); if (s->mult[mcast_idx >> 3] & (1 << (mcast_idx & 7))) { TRACE(RXTX, logout("%p accepted, multiple IA bit set\n", s)); } else { TRACE(RXTX, logout("%p frame ignored, multiple IA bit set\n", s)); return -1; } } else { TRACE(RXTX, logout("%p received frame, ignored, len=%zu,%s\n", s, size, nic_dump(buf, size))); return size; } if (get_ru_state(s) != ru_ready) { logout("no resources, state=%u\n", get_ru_state(s)); eepro100_rnr_interrupt(s); s->statistics.rx_resource_errors++; #if 0 assert(!"no resources"); #endif return -1; } eepro100_rx_t rx; pci_dma_read(&s->dev, s->ru_base + s->ru_offset, &rx, sizeof(eepro100_rx_t)); uint16_t rfd_command = le16_to_cpu(rx.command); uint16_t rfd_size = le16_to_cpu(rx.size); if (size > rfd_size) { logout("Receive buffer (%" PRId16 " bytes) too small for data " "(%zu bytes); data truncated\n", rfd_size, size); size = rfd_size; } #if !defined(CONFIG_PAD_RECEIVED_FRAMES) if (size < 64) { rfd_status |= 0x0080; } #endif TRACE(OTHER, logout("command 0x%04x, link 0x%08x, addr 0x%08x, size %u\n", rfd_command, rx.link, rx.rx_buf_addr, rfd_size)); stw_le_pci_dma(&s->dev, s->ru_base + s->ru_offset + offsetof(eepro100_rx_t, status), rfd_status); stw_le_pci_dma(&s->dev, s->ru_base + s->ru_offset + offsetof(eepro100_rx_t, count), size); #if 0 eepro100_er_interrupt(s); #endif if (s->configuration[18] & BIT(2)) { missing("Receive CRC Transfer"); return -1; } #if 0 assert(!(s->configuration[17] & BIT(0))); #endif pci_dma_write(&s->dev, s->ru_base + s->ru_offset + sizeof(eepro100_rx_t), buf, size); s->statistics.rx_good_frames++; eepro100_fr_interrupt(s); s->ru_offset = le32_to_cpu(rx.link); if (rfd_command & COMMAND_EL) { logout("receive: Running out of frames\n"); set_ru_state(s, ru_suspended); } if (rfd_command & COMMAND_S) { set_ru_state(s, ru_suspended); } return size; }
{ "code": [], "line_no": [] }
static ssize_t FUNC_0(NetClientState *nc, const uint8_t * buf, size_t size) { EEPRO100State *s = DO_UPCAST(NICState, nc, nc)->opaque; uint16_t rfd_status = 0xa000; #if defined(CONFIG_PAD_RECEIVED_FRAMES) uint8_t min_buf[60]; #endif static const uint8_t VAR_0[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; #if defined(CONFIG_PAD_RECEIVED_FRAMES) if (size < sizeof(min_buf)) { memcpy(min_buf, buf, size); memset(&min_buf[size], 0, sizeof(min_buf) - size); buf = min_buf; size = sizeof(min_buf); } #endif if (s->configuration[8] & 0x80) { logout("%p received while CSMA is disabled\n", s); return -1; #if !defined(CONFIG_PAD_RECEIVED_FRAMES) } else if (size < 64 && (s->configuration[7] & BIT(0))) { logout("%p received short frame (%zu byte)\n", s, size); s->statistics.rx_short_frame_errors++; return -1; #endif } else if ((size > MAX_ETH_FRAME_SIZE + 4) && !(s->configuration[18] & BIT(3))) { logout("%p received long frame (%zu byte), ignored\n", s, size); return -1; } else if (memcmp(buf, s->conf.macaddr.a, 6) == 0) { TRACE(RXTX, logout("%p received frame for me, len=%zu\n", s, size)); } else if (memcmp(buf, VAR_0, 6) == 0) { TRACE(RXTX, logout("%p received broadcast, len=%zu\n", s, size)); rfd_status |= 0x0002; } else if (buf[0] & 0x01) { TRACE(RXTX, logout("%p received multicast, len=%zu,%s\n", s, size, nic_dump(buf, size))); if (s->configuration[21] & BIT(3)) { } else { unsigned VAR_2 = e100_compute_mcast_idx(buf); assert(VAR_2 < 64); if (s->mult[VAR_2 >> 3] & (1 << (VAR_2 & 7))) { } else if (s->configuration[15] & BIT(0)) { rfd_status |= 0x0004; } else { TRACE(RXTX, logout("%p multicast ignored\n", s)); return -1; } } rfd_status |= 0x0002; } else if (s->configuration[15] & BIT(0)) { TRACE(RXTX, logout("%p received frame in promiscuous mode, len=%zu\n", s, size)); rfd_status |= 0x0004; } else if (s->configuration[20] & BIT(6)) { unsigned VAR_2 = compute_mcast_idx(buf); assert(VAR_2 < 64); if (s->mult[VAR_2 >> 3] & (1 << (VAR_2 & 7))) { TRACE(RXTX, logout("%p accepted, multiple IA bit set\n", s)); } else { TRACE(RXTX, logout("%p frame ignored, multiple IA bit set\n", s)); return -1; } } else { TRACE(RXTX, logout("%p received frame, ignored, len=%zu,%s\n", s, size, nic_dump(buf, size))); return size; } if (get_ru_state(s) != ru_ready) { logout("no resources, state=%u\n", get_ru_state(s)); eepro100_rnr_interrupt(s); s->statistics.rx_resource_errors++; #if 0 assert(!"no resources"); #endif return -1; } eepro100_rx_t rx; pci_dma_read(&s->dev, s->ru_base + s->ru_offset, &rx, sizeof(eepro100_rx_t)); uint16_t rfd_command = le16_to_cpu(rx.command); uint16_t rfd_size = le16_to_cpu(rx.size); if (size > rfd_size) { logout("Receive buffer (%" PRId16 " bytes) too small for data " "(%zu bytes); data truncated\n", rfd_size, size); size = rfd_size; } #if !defined(CONFIG_PAD_RECEIVED_FRAMES) if (size < 64) { rfd_status |= 0x0080; } #endif TRACE(OTHER, logout("command 0x%04x, link 0x%08x, addr 0x%08x, size %u\n", rfd_command, rx.link, rx.rx_buf_addr, rfd_size)); stw_le_pci_dma(&s->dev, s->ru_base + s->ru_offset + offsetof(eepro100_rx_t, status), rfd_status); stw_le_pci_dma(&s->dev, s->ru_base + s->ru_offset + offsetof(eepro100_rx_t, count), size); #if 0 eepro100_er_interrupt(s); #endif if (s->configuration[18] & BIT(2)) { missing("Receive CRC Transfer"); return -1; } #if 0 assert(!(s->configuration[17] & BIT(0))); #endif pci_dma_write(&s->dev, s->ru_base + s->ru_offset + sizeof(eepro100_rx_t), buf, size); s->statistics.rx_good_frames++; eepro100_fr_interrupt(s); s->ru_offset = le32_to_cpu(rx.link); if (rfd_command & COMMAND_EL) { logout("receive: Running out of frames\n"); set_ru_state(s, ru_suspended); } if (rfd_command & COMMAND_S) { set_ru_state(s, ru_suspended); } return size; }
[ "static ssize_t FUNC_0(NetClientState *nc, const uint8_t * buf, size_t size)\n{", "EEPRO100State *s = DO_UPCAST(NICState, nc, nc)->opaque;", "uint16_t rfd_status = 0xa000;", "#if defined(CONFIG_PAD_RECEIVED_FRAMES)\nuint8_t min_buf[60];", "#endif\nstatic const uint8_t VAR_0[6] =\n{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };", "#if defined(CONFIG_PAD_RECEIVED_FRAMES)\nif (size < sizeof(min_buf)) {", "memcpy(min_buf, buf, size);", "memset(&min_buf[size], 0, sizeof(min_buf) - size);", "buf = min_buf;", "size = sizeof(min_buf);", "}", "#endif\nif (s->configuration[8] & 0x80) {", "logout(\"%p received while CSMA is disabled\\n\", s);", "return -1;", "#if !defined(CONFIG_PAD_RECEIVED_FRAMES)\n} else if (size < 64 && (s->configuration[7] & BIT(0))) {", "logout(\"%p received short frame (%zu byte)\\n\", s, size);", "s->statistics.rx_short_frame_errors++;", "return -1;", "#endif\n} else if ((size > MAX_ETH_FRAME_SIZE + 4) && !(s->configuration[18] & BIT(3))) {", "logout(\"%p received long frame (%zu byte), ignored\\n\", s, size);", "return -1;", "} else if (memcmp(buf, s->conf.macaddr.a, 6) == 0) {", "TRACE(RXTX, logout(\"%p received frame for me, len=%zu\\n\", s, size));", "} else if (memcmp(buf, VAR_0, 6) == 0) {", "TRACE(RXTX, logout(\"%p received broadcast, len=%zu\\n\", s, size));", "rfd_status |= 0x0002;", "} else if (buf[0] & 0x01) {", "TRACE(RXTX, logout(\"%p received multicast, len=%zu,%s\\n\", s, size, nic_dump(buf, size)));", "if (s->configuration[21] & BIT(3)) {", "} else {", "unsigned VAR_2 = e100_compute_mcast_idx(buf);", "assert(VAR_2 < 64);", "if (s->mult[VAR_2 >> 3] & (1 << (VAR_2 & 7))) {", "} else if (s->configuration[15] & BIT(0)) {", "rfd_status |= 0x0004;", "} else {", "TRACE(RXTX, logout(\"%p multicast ignored\\n\", s));", "return -1;", "}", "}", "rfd_status |= 0x0002;", "} else if (s->configuration[15] & BIT(0)) {", "TRACE(RXTX, logout(\"%p received frame in promiscuous mode, len=%zu\\n\", s, size));", "rfd_status |= 0x0004;", "} else if (s->configuration[20] & BIT(6)) {", "unsigned VAR_2 = compute_mcast_idx(buf);", "assert(VAR_2 < 64);", "if (s->mult[VAR_2 >> 3] & (1 << (VAR_2 & 7))) {", "TRACE(RXTX, logout(\"%p accepted, multiple IA bit set\\n\", s));", "} else {", "TRACE(RXTX, logout(\"%p frame ignored, multiple IA bit set\\n\", s));", "return -1;", "}", "} else {", "TRACE(RXTX, logout(\"%p received frame, ignored, len=%zu,%s\\n\", s, size,\nnic_dump(buf, size)));", "return size;", "}", "if (get_ru_state(s) != ru_ready) {", "logout(\"no resources, state=%u\\n\", get_ru_state(s));", "eepro100_rnr_interrupt(s);", "s->statistics.rx_resource_errors++;", "#if 0\nassert(!\"no resources\");", "#endif\nreturn -1;", "}", "eepro100_rx_t rx;", "pci_dma_read(&s->dev, s->ru_base + s->ru_offset,\n&rx, sizeof(eepro100_rx_t));", "uint16_t rfd_command = le16_to_cpu(rx.command);", "uint16_t rfd_size = le16_to_cpu(rx.size);", "if (size > rfd_size) {", "logout(\"Receive buffer (%\" PRId16 \" bytes) too small for data \"\n\"(%zu bytes); data truncated\\n\", rfd_size, size);", "size = rfd_size;", "}", "#if !defined(CONFIG_PAD_RECEIVED_FRAMES)\nif (size < 64) {", "rfd_status |= 0x0080;", "}", "#endif\nTRACE(OTHER, logout(\"command 0x%04x, link 0x%08x, addr 0x%08x, size %u\\n\",\nrfd_command, rx.link, rx.rx_buf_addr, rfd_size));", "stw_le_pci_dma(&s->dev, s->ru_base + s->ru_offset +\noffsetof(eepro100_rx_t, status), rfd_status);", "stw_le_pci_dma(&s->dev, s->ru_base + s->ru_offset +\noffsetof(eepro100_rx_t, count), size);", "#if 0\neepro100_er_interrupt(s);", "#endif\nif (s->configuration[18] & BIT(2)) {", "missing(\"Receive CRC Transfer\");", "return -1;", "}", "#if 0\nassert(!(s->configuration[17] & BIT(0)));", "#endif\npci_dma_write(&s->dev, s->ru_base + s->ru_offset +\nsizeof(eepro100_rx_t), buf, size);", "s->statistics.rx_good_frames++;", "eepro100_fr_interrupt(s);", "s->ru_offset = le32_to_cpu(rx.link);", "if (rfd_command & COMMAND_EL) {", "logout(\"receive: Running out of frames\\n\");", "set_ru_state(s, ru_suspended);", "}", "if (rfd_command & COMMAND_S) {", "set_ru_state(s, ru_suspended);", "}", "return 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21, 23, 25 ], [ 29, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 49 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 79 ], [ 81 ], [ 83 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 139 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169, 171 ], [ 173 ], [ 175 ], [ 179 ], [ 183 ], [ 187 ], [ 189 ], [ 191, 193 ], [ 195, 197 ], [ 199 ], [ 203 ], [ 205, 207 ], [ 209 ], [ 211 ], [ 215 ], [ 217, 219 ], [ 221 ], [ 223 ], [ 225, 227 ], [ 229 ], [ 231 ], [ 233, 235, 237 ], [ 239, 241 ], [ 243, 245 ], [ 249, 251 ], [ 253, 257 ], [ 259 ], [ 261 ], [ 263 ], [ 267, 269 ], [ 271, 273, 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ] ]
21,744
void pci_bus_get_w64_range(PCIBus *bus, Range *range) { range->begin = range->end = 0; pci_for_each_device_under_bus(bus, pci_dev_get_w64, range); }
false
qemu
a0efbf16604770b9d805bcf210ec29942321134f
void pci_bus_get_w64_range(PCIBus *bus, Range *range) { range->begin = range->end = 0; pci_for_each_device_under_bus(bus, pci_dev_get_w64, range); }
{ "code": [], "line_no": [] }
void FUNC_0(PCIBus *VAR_0, Range *VAR_1) { VAR_1->begin = VAR_1->end = 0; pci_for_each_device_under_bus(VAR_0, pci_dev_get_w64, VAR_1); }
[ "void FUNC_0(PCIBus *VAR_0, Range *VAR_1)\n{", "VAR_1->begin = VAR_1->end = 0;", "pci_for_each_device_under_bus(VAR_0, pci_dev_get_w64, VAR_1);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
21,745
static void m5208_timer_write(void *opaque, target_phys_addr_t offset, uint64_t value, unsigned size) { m5208_timer_state *s = (m5208_timer_state *)opaque; int prescale; int limit; switch (offset) { case 0: /* The PIF bit is set-to-clear. */ if (value & PCSR_PIF) { s->pcsr &= ~PCSR_PIF; value &= ~PCSR_PIF; } /* Avoid frobbing the timer if we're just twiddling IRQ bits. */ if (((s->pcsr ^ value) & ~PCSR_PIE) == 0) { s->pcsr = value; m5208_timer_update(s); return; } if (s->pcsr & PCSR_EN) ptimer_stop(s->timer); s->pcsr = value; prescale = 1 << ((s->pcsr & PCSR_PRE_MASK) >> PCSR_PRE_SHIFT); ptimer_set_freq(s->timer, (SYS_FREQ / 2) / prescale); if (s->pcsr & PCSR_RLD) limit = s->pmr; else limit = 0xffff; ptimer_set_limit(s->timer, limit, 0); if (s->pcsr & PCSR_EN) ptimer_run(s->timer, 0); break; case 2: s->pmr = value; s->pcsr &= ~PCSR_PIF; if ((s->pcsr & PCSR_RLD) == 0) { if (s->pcsr & PCSR_OVW) ptimer_set_count(s->timer, value); } else { ptimer_set_limit(s->timer, value, s->pcsr & PCSR_OVW); } break; case 4: break; default: hw_error("m5208_timer_write: Bad offset 0x%x\n", (int)offset); break; } m5208_timer_update(s); }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void m5208_timer_write(void *opaque, target_phys_addr_t offset, uint64_t value, unsigned size) { m5208_timer_state *s = (m5208_timer_state *)opaque; int prescale; int limit; switch (offset) { case 0: if (value & PCSR_PIF) { s->pcsr &= ~PCSR_PIF; value &= ~PCSR_PIF; } if (((s->pcsr ^ value) & ~PCSR_PIE) == 0) { s->pcsr = value; m5208_timer_update(s); return; } if (s->pcsr & PCSR_EN) ptimer_stop(s->timer); s->pcsr = value; prescale = 1 << ((s->pcsr & PCSR_PRE_MASK) >> PCSR_PRE_SHIFT); ptimer_set_freq(s->timer, (SYS_FREQ / 2) / prescale); if (s->pcsr & PCSR_RLD) limit = s->pmr; else limit = 0xffff; ptimer_set_limit(s->timer, limit, 0); if (s->pcsr & PCSR_EN) ptimer_run(s->timer, 0); break; case 2: s->pmr = value; s->pcsr &= ~PCSR_PIF; if ((s->pcsr & PCSR_RLD) == 0) { if (s->pcsr & PCSR_OVW) ptimer_set_count(s->timer, value); } else { ptimer_set_limit(s->timer, value, s->pcsr & PCSR_OVW); } break; case 4: break; default: hw_error("m5208_timer_write: Bad offset 0x%x\n", (int)offset); break; } m5208_timer_update(s); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint64_t VAR_2, unsigned VAR_3) { m5208_timer_state *s = (m5208_timer_state *)VAR_0; int VAR_4; int VAR_5; switch (VAR_1) { case 0: if (VAR_2 & PCSR_PIF) { s->pcsr &= ~PCSR_PIF; VAR_2 &= ~PCSR_PIF; } if (((s->pcsr ^ VAR_2) & ~PCSR_PIE) == 0) { s->pcsr = VAR_2; m5208_timer_update(s); return; } if (s->pcsr & PCSR_EN) ptimer_stop(s->timer); s->pcsr = VAR_2; VAR_4 = 1 << ((s->pcsr & PCSR_PRE_MASK) >> PCSR_PRE_SHIFT); ptimer_set_freq(s->timer, (SYS_FREQ / 2) / VAR_4); if (s->pcsr & PCSR_RLD) VAR_5 = s->pmr; else VAR_5 = 0xffff; ptimer_set_limit(s->timer, VAR_5, 0); if (s->pcsr & PCSR_EN) ptimer_run(s->timer, 0); break; case 2: s->pmr = VAR_2; s->pcsr &= ~PCSR_PIF; if ((s->pcsr & PCSR_RLD) == 0) { if (s->pcsr & PCSR_OVW) ptimer_set_count(s->timer, VAR_2); } else { ptimer_set_limit(s->timer, VAR_2, s->pcsr & PCSR_OVW); } break; case 4: break; default: hw_error("FUNC_0: Bad VAR_1 0x%x\n", (int)VAR_1); break; } m5208_timer_update(s); }
[ "static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "m5208_timer_state *s = (m5208_timer_state *)VAR_0;", "int VAR_4;", "int VAR_5;", "switch (VAR_1) {", "case 0:\nif (VAR_2 & PCSR_PIF) {", "s->pcsr &= ~PCSR_PIF;", "VAR_2 &= ~PCSR_PIF;", "}", "if (((s->pcsr ^ VAR_2) & ~PCSR_PIE) == 0) {", "s->pcsr = VAR_2;", "m5208_timer_update(s);", "return;", "}", "if (s->pcsr & PCSR_EN)\nptimer_stop(s->timer);", "s->pcsr = VAR_2;", "VAR_4 = 1 << ((s->pcsr & PCSR_PRE_MASK) >> PCSR_PRE_SHIFT);", "ptimer_set_freq(s->timer, (SYS_FREQ / 2) / VAR_4);", "if (s->pcsr & PCSR_RLD)\nVAR_5 = s->pmr;", "else\nVAR_5 = 0xffff;", "ptimer_set_limit(s->timer, VAR_5, 0);", "if (s->pcsr & PCSR_EN)\nptimer_run(s->timer, 0);", "break;", "case 2:\ns->pmr = VAR_2;", "s->pcsr &= ~PCSR_PIF;", "if ((s->pcsr & PCSR_RLD) == 0) {", "if (s->pcsr & PCSR_OVW)\nptimer_set_count(s->timer, VAR_2);", "} else {", "ptimer_set_limit(s->timer, VAR_2, s->pcsr & PCSR_OVW);", "}", "break;", "case 4:\nbreak;", "default:\nhw_error(\"FUNC_0: Bad VAR_1 0x%x\\n\", (int)VAR_1);", "break;", "}", "m5208_timer_update(s);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41, 43 ], [ 47 ], [ 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 ] ]
21,747
static void free_tables(H264Context *h){ int i; H264Context *hx; av_freep(&h->intra4x4_pred_mode); av_freep(&h->chroma_pred_mode_table); av_freep(&h->cbp_table); av_freep(&h->mvd_table[0]); av_freep(&h->mvd_table[1]); av_freep(&h->direct_table); av_freep(&h->non_zero_count); av_freep(&h->slice_table_base); h->slice_table= NULL; av_freep(&h->list_counts); av_freep(&h->mb2b_xy); av_freep(&h->mb2br_xy); for(i = 0; i < MAX_THREADS; i++) { hx = h->thread_context[i]; if(!hx) continue; av_freep(&hx->top_borders[1]); av_freep(&hx->top_borders[0]); av_freep(&hx->s.obmc_scratchpad); av_freep(&hx->rbsp_buffer[1]); av_freep(&hx->rbsp_buffer[0]); hx->rbsp_buffer_size[0] = 0; hx->rbsp_buffer_size[1] = 0; if (i) av_freep(&h->thread_context[i]); } }
true
FFmpeg
2ed0f76655a76cc49f8a1a1d59e545f5906e7924
static void free_tables(H264Context *h){ int i; H264Context *hx; av_freep(&h->intra4x4_pred_mode); av_freep(&h->chroma_pred_mode_table); av_freep(&h->cbp_table); av_freep(&h->mvd_table[0]); av_freep(&h->mvd_table[1]); av_freep(&h->direct_table); av_freep(&h->non_zero_count); av_freep(&h->slice_table_base); h->slice_table= NULL; av_freep(&h->list_counts); av_freep(&h->mb2b_xy); av_freep(&h->mb2br_xy); for(i = 0; i < MAX_THREADS; i++) { hx = h->thread_context[i]; if(!hx) continue; av_freep(&hx->top_borders[1]); av_freep(&hx->top_borders[0]); av_freep(&hx->s.obmc_scratchpad); av_freep(&hx->rbsp_buffer[1]); av_freep(&hx->rbsp_buffer[0]); hx->rbsp_buffer_size[0] = 0; hx->rbsp_buffer_size[1] = 0; if (i) av_freep(&h->thread_context[i]); } }
{ "code": [ "static void free_tables(H264Context *h){" ], "line_no": [ 1 ] }
static void FUNC_0(H264Context *VAR_0){ int VAR_1; H264Context *hx; av_freep(&VAR_0->intra4x4_pred_mode); av_freep(&VAR_0->chroma_pred_mode_table); av_freep(&VAR_0->cbp_table); av_freep(&VAR_0->mvd_table[0]); av_freep(&VAR_0->mvd_table[1]); av_freep(&VAR_0->direct_table); av_freep(&VAR_0->non_zero_count); av_freep(&VAR_0->slice_table_base); VAR_0->slice_table= NULL; av_freep(&VAR_0->list_counts); av_freep(&VAR_0->mb2b_xy); av_freep(&VAR_0->mb2br_xy); for(VAR_1 = 0; VAR_1 < MAX_THREADS; VAR_1++) { hx = VAR_0->thread_context[VAR_1]; if(!hx) continue; av_freep(&hx->top_borders[1]); av_freep(&hx->top_borders[0]); av_freep(&hx->s.obmc_scratchpad); av_freep(&hx->rbsp_buffer[1]); av_freep(&hx->rbsp_buffer[0]); hx->rbsp_buffer_size[0] = 0; hx->rbsp_buffer_size[1] = 0; if (VAR_1) av_freep(&VAR_0->thread_context[VAR_1]); } }
[ "static void FUNC_0(H264Context *VAR_0){", "int VAR_1;", "H264Context *hx;", "av_freep(&VAR_0->intra4x4_pred_mode);", "av_freep(&VAR_0->chroma_pred_mode_table);", "av_freep(&VAR_0->cbp_table);", "av_freep(&VAR_0->mvd_table[0]);", "av_freep(&VAR_0->mvd_table[1]);", "av_freep(&VAR_0->direct_table);", "av_freep(&VAR_0->non_zero_count);", "av_freep(&VAR_0->slice_table_base);", "VAR_0->slice_table= NULL;", "av_freep(&VAR_0->list_counts);", "av_freep(&VAR_0->mb2b_xy);", "av_freep(&VAR_0->mb2br_xy);", "for(VAR_1 = 0; VAR_1 < MAX_THREADS; VAR_1++) {", "hx = VAR_0->thread_context[VAR_1];", "if(!hx) continue;", "av_freep(&hx->top_borders[1]);", "av_freep(&hx->top_borders[0]);", "av_freep(&hx->s.obmc_scratchpad);", "av_freep(&hx->rbsp_buffer[1]);", "av_freep(&hx->rbsp_buffer[0]);", "hx->rbsp_buffer_size[0] = 0;", "hx->rbsp_buffer_size[1] = 0;", "if (VAR_1) av_freep(&VAR_0->thread_context[VAR_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 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ] ]
21,748
CBus *cbus_init(qemu_irq dat) { CBusPriv *s = (CBusPriv *) g_malloc0(sizeof(*s)); s->dat_out = dat; s->cbus.clk = qemu_allocate_irqs(cbus_clk, s, 1)[0]; s->cbus.dat = qemu_allocate_irqs(cbus_dat, s, 1)[0]; s->cbus.sel = qemu_allocate_irqs(cbus_sel, s, 1)[0]; s->sel = 1; s->clk = 0; s->dat = 0; return &s->cbus; }
true
qemu
f3c7d0389fe8a2792fd4c1cf151b885de03c8f62
CBus *cbus_init(qemu_irq dat) { CBusPriv *s = (CBusPriv *) g_malloc0(sizeof(*s)); s->dat_out = dat; s->cbus.clk = qemu_allocate_irqs(cbus_clk, s, 1)[0]; s->cbus.dat = qemu_allocate_irqs(cbus_dat, s, 1)[0]; s->cbus.sel = qemu_allocate_irqs(cbus_sel, s, 1)[0]; s->sel = 1; s->clk = 0; s->dat = 0; return &s->cbus; }
{ "code": [ " s->cbus.clk = qemu_allocate_irqs(cbus_clk, s, 1)[0];", " s->cbus.dat = qemu_allocate_irqs(cbus_dat, s, 1)[0];", " s->cbus.sel = qemu_allocate_irqs(cbus_sel, s, 1)[0];" ], "line_no": [ 11, 13, 15 ] }
CBus *FUNC_0(qemu_irq dat) { CBusPriv *s = (CBusPriv *) g_malloc0(sizeof(*s)); s->dat_out = dat; s->cbus.clk = qemu_allocate_irqs(cbus_clk, s, 1)[0]; s->cbus.dat = qemu_allocate_irqs(cbus_dat, s, 1)[0]; s->cbus.sel = qemu_allocate_irqs(cbus_sel, s, 1)[0]; s->sel = 1; s->clk = 0; s->dat = 0; return &s->cbus; }
[ "CBus *FUNC_0(qemu_irq dat)\n{", "CBusPriv *s = (CBusPriv *) g_malloc0(sizeof(*s));", "s->dat_out = dat;", "s->cbus.clk = qemu_allocate_irqs(cbus_clk, s, 1)[0];", "s->cbus.dat = qemu_allocate_irqs(cbus_dat, s, 1)[0];", "s->cbus.sel = qemu_allocate_irqs(cbus_sel, s, 1)[0];", "s->sel = 1;", "s->clk = 0;", "s->dat = 0;", "return &s->cbus;", "}" ]
[ 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ] ]
21,749
static int cp15_tls_load_store(CPUState *env, DisasContext *s, uint32_t insn, uint32_t rd) { TCGv tmp; int cpn = (insn >> 16) & 0xf; int cpm = insn & 0xf; int op = ((insn >> 5) & 7) | ((insn >> 18) & 0x38); if (!arm_feature(env, ARM_FEATURE_V6K)) return 0; if (!(cpn == 13 && cpm == 0)) return 0; if (insn & ARM_CP_RW_BIT) { switch (op) { case 2: tmp = load_cpu_field(cp15.c13_tls1); break; case 3: tmp = load_cpu_field(cp15.c13_tls2); break; case 4: tmp = load_cpu_field(cp15.c13_tls3); break; default: return 0; } store_reg(s, rd, tmp); } else { tmp = load_reg(s, rd); switch (op) { case 2: store_cpu_field(tmp, cp15.c13_tls1); break; case 3: store_cpu_field(tmp, cp15.c13_tls2); break; case 4: store_cpu_field(tmp, cp15.c13_tls3); break; default: dead_tmp(tmp); return 0; } } return 1; }
true
qemu
7d1b0095bff7157e856d1d0e6c4295641ced2752
static int cp15_tls_load_store(CPUState *env, DisasContext *s, uint32_t insn, uint32_t rd) { TCGv tmp; int cpn = (insn >> 16) & 0xf; int cpm = insn & 0xf; int op = ((insn >> 5) & 7) | ((insn >> 18) & 0x38); if (!arm_feature(env, ARM_FEATURE_V6K)) return 0; if (!(cpn == 13 && cpm == 0)) return 0; if (insn & ARM_CP_RW_BIT) { switch (op) { case 2: tmp = load_cpu_field(cp15.c13_tls1); break; case 3: tmp = load_cpu_field(cp15.c13_tls2); break; case 4: tmp = load_cpu_field(cp15.c13_tls3); break; default: return 0; } store_reg(s, rd, tmp); } else { tmp = load_reg(s, rd); switch (op) { case 2: store_cpu_field(tmp, cp15.c13_tls1); break; case 3: store_cpu_field(tmp, cp15.c13_tls2); break; case 4: store_cpu_field(tmp, cp15.c13_tls3); break; default: dead_tmp(tmp); return 0; } } return 1; }
{ "code": [ " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);" ], "line_no": [ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85 ] }
static int FUNC_0(CPUState *VAR_0, DisasContext *VAR_1, uint32_t VAR_2, uint32_t VAR_3) { TCGv tmp; int VAR_4 = (VAR_2 >> 16) & 0xf; int VAR_5 = VAR_2 & 0xf; int VAR_6 = ((VAR_2 >> 5) & 7) | ((VAR_2 >> 18) & 0x38); if (!arm_feature(VAR_0, ARM_FEATURE_V6K)) return 0; if (!(VAR_4 == 13 && VAR_5 == 0)) return 0; if (VAR_2 & ARM_CP_RW_BIT) { switch (VAR_6) { case 2: tmp = load_cpu_field(cp15.c13_tls1); break; case 3: tmp = load_cpu_field(cp15.c13_tls2); break; case 4: tmp = load_cpu_field(cp15.c13_tls3); break; default: return 0; } store_reg(VAR_1, VAR_3, tmp); } else { tmp = load_reg(VAR_1, VAR_3); switch (VAR_6) { case 2: store_cpu_field(tmp, cp15.c13_tls1); break; case 3: store_cpu_field(tmp, cp15.c13_tls2); break; case 4: store_cpu_field(tmp, cp15.c13_tls3); break; default: dead_tmp(tmp); return 0; } } return 1; }
[ "static int FUNC_0(CPUState *VAR_0, DisasContext *VAR_1, uint32_t VAR_2, uint32_t VAR_3)\n{", "TCGv tmp;", "int VAR_4 = (VAR_2 >> 16) & 0xf;", "int VAR_5 = VAR_2 & 0xf;", "int VAR_6 = ((VAR_2 >> 5) & 7) | ((VAR_2 >> 18) & 0x38);", "if (!arm_feature(VAR_0, ARM_FEATURE_V6K))\nreturn 0;", "if (!(VAR_4 == 13 && VAR_5 == 0))\nreturn 0;", "if (VAR_2 & ARM_CP_RW_BIT) {", "switch (VAR_6) {", "case 2:\ntmp = load_cpu_field(cp15.c13_tls1);", "break;", "case 3:\ntmp = load_cpu_field(cp15.c13_tls2);", "break;", "case 4:\ntmp = load_cpu_field(cp15.c13_tls3);", "break;", "default:\nreturn 0;", "}", "store_reg(VAR_1, VAR_3, tmp);", "} else {", "tmp = load_reg(VAR_1, VAR_3);", "switch (VAR_6) {", "case 2:\nstore_cpu_field(tmp, cp15.c13_tls1);", "break;", "case 3:\nstore_cpu_field(tmp, cp15.c13_tls2);", "break;", "case 4:\nstore_cpu_field(tmp, cp15.c13_tls3);", "break;", "default:\ndead_tmp(tmp);", "return 0;", "}", "}", "return 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, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 21, 23 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ] ]
21,751
void hmp_pci_add(Monitor *mon, const QDict *qdict) { PCIDevice *dev = NULL; const char *pci_addr = qdict_get_str(qdict, "pci_addr"); const char *type = qdict_get_str(qdict, "type"); const char *opts = qdict_get_try_str(qdict, "opts"); /* strip legacy tag */ if (!strncmp(pci_addr, "pci_addr=", 9)) { pci_addr += 9; } if (!opts) { opts = ""; } if (!strcmp(pci_addr, "auto")) pci_addr = NULL; if (strcmp(type, "nic") == 0) { dev = qemu_pci_hot_add_nic(mon, pci_addr, opts); } else if (strcmp(type, "storage") == 0) { dev = qemu_pci_hot_add_storage(mon, pci_addr, opts); } else { monitor_printf(mon, "invalid type: %s\n", type); } if (dev) { monitor_printf(mon, "OK root bus %s, bus %d, slot %d, function %d\n", pci_root_bus_path(dev), pci_bus_num(dev->bus), PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)); } else monitor_printf(mon, "failed to add %s\n", opts); }
true
qemu
f51074cdc6e750daa3b6df727d83449a7e42b391
void hmp_pci_add(Monitor *mon, const QDict *qdict) { PCIDevice *dev = NULL; const char *pci_addr = qdict_get_str(qdict, "pci_addr"); const char *type = qdict_get_str(qdict, "type"); const char *opts = qdict_get_try_str(qdict, "opts"); if (!strncmp(pci_addr, "pci_addr=", 9)) { pci_addr += 9; } if (!opts) { opts = ""; } if (!strcmp(pci_addr, "auto")) pci_addr = NULL; if (strcmp(type, "nic") == 0) { dev = qemu_pci_hot_add_nic(mon, pci_addr, opts); } else if (strcmp(type, "storage") == 0) { dev = qemu_pci_hot_add_storage(mon, pci_addr, opts); } else { monitor_printf(mon, "invalid type: %s\n", type); } if (dev) { monitor_printf(mon, "OK root bus %s, bus %d, slot %d, function %d\n", pci_root_bus_path(dev), pci_bus_num(dev->bus), PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)); } else monitor_printf(mon, "failed to add %s\n", opts); }
{ "code": [ " if (!opts) {", " const char *pci_addr = qdict_get_str(qdict, \"pci_addr\");", " } else {", " } else {", "void hmp_pci_add(Monitor *mon, const QDict *qdict)", " PCIDevice *dev = NULL;", " const char *pci_addr = qdict_get_str(qdict, \"pci_addr\");", " const char *type = qdict_get_str(qdict, \"type\");", " const char *opts = qdict_get_try_str(qdict, \"opts\");", " if (!strncmp(pci_addr, \"pci_addr=\", 9)) {", " pci_addr += 9;", " if (!opts) {", " opts = \"\";", " if (!strcmp(pci_addr, \"auto\"))", " pci_addr = NULL;", " if (strcmp(type, \"nic\") == 0) {", " dev = qemu_pci_hot_add_nic(mon, pci_addr, opts);", " } else if (strcmp(type, \"storage\") == 0) {", " dev = qemu_pci_hot_add_storage(mon, pci_addr, opts);", " } else {", " monitor_printf(mon, \"invalid type: %s\\n\", type);", " if (dev) {", " monitor_printf(mon, \"OK root bus %s, bus %d, slot %d, function %d\\n\",", " pci_root_bus_path(dev),", " pci_bus_num(dev->bus), PCI_SLOT(dev->devfn),", " PCI_FUNC(dev->devfn));", " } else", " monitor_printf(mon, \"failed to add %s\\n\", opts);" ], "line_no": [ 25, 7, 47, 47, 1, 5, 7, 9, 11, 17, 19, 25, 27, 33, 35, 39, 41, 43, 45, 47, 49, 55, 57, 59, 61, 63, 65, 67 ] }
void FUNC_0(Monitor *VAR_0, const QDict *VAR_1) { PCIDevice *dev = NULL; const char *VAR_2 = qdict_get_str(VAR_1, "VAR_2"); const char *VAR_3 = qdict_get_str(VAR_1, "VAR_3"); const char *VAR_4 = qdict_get_try_str(VAR_1, "VAR_4"); if (!strncmp(VAR_2, "VAR_2=", 9)) { VAR_2 += 9; } if (!VAR_4) { VAR_4 = ""; } if (!strcmp(VAR_2, "auto")) VAR_2 = NULL; if (strcmp(VAR_3, "nic") == 0) { dev = qemu_pci_hot_add_nic(VAR_0, VAR_2, VAR_4); } else if (strcmp(VAR_3, "storage") == 0) { dev = qemu_pci_hot_add_storage(VAR_0, VAR_2, VAR_4); } else { monitor_printf(VAR_0, "invalid VAR_3: %s\n", VAR_3); } if (dev) { monitor_printf(VAR_0, "OK root bus %s, bus %d, slot %d, function %d\n", pci_root_bus_path(dev), pci_bus_num(dev->bus), PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)); } else monitor_printf(VAR_0, "failed to add %s\n", VAR_4); }
[ "void FUNC_0(Monitor *VAR_0, const QDict *VAR_1)\n{", "PCIDevice *dev = NULL;", "const char *VAR_2 = qdict_get_str(VAR_1, \"VAR_2\");", "const char *VAR_3 = qdict_get_str(VAR_1, \"VAR_3\");", "const char *VAR_4 = qdict_get_try_str(VAR_1, \"VAR_4\");", "if (!strncmp(VAR_2, \"VAR_2=\", 9)) {", "VAR_2 += 9;", "}", "if (!VAR_4) {", "VAR_4 = \"\";", "}", "if (!strcmp(VAR_2, \"auto\"))\nVAR_2 = NULL;", "if (strcmp(VAR_3, \"nic\") == 0) {", "dev = qemu_pci_hot_add_nic(VAR_0, VAR_2, VAR_4);", "} else if (strcmp(VAR_3, \"storage\") == 0) {", "dev = qemu_pci_hot_add_storage(VAR_0, VAR_2, VAR_4);", "} else {", "monitor_printf(VAR_0, \"invalid VAR_3: %s\\n\", VAR_3);", "}", "if (dev) {", "monitor_printf(VAR_0, \"OK root bus %s, bus %d, slot %d, function %d\\n\",\npci_root_bus_path(dev),\npci_bus_num(dev->bus), PCI_SLOT(dev->devfn),\nPCI_FUNC(dev->devfn));", "} else", "monitor_printf(VAR_0, \"failed to add %s\\n\", VAR_4);", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 33, 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57, 59, 61, 63 ], [ 65 ], [ 67 ], [ 69 ] ]
21,752
static int ape_decode_frame(AVCodecContext * avctx, void *data, int *data_size, const uint8_t * buf, int buf_size) { APEContext *s = avctx->priv_data; int16_t *samples = data; int nblocks; int i, n; int blockstodecode; int bytes_used; if (buf_size == 0 && !s->samples) { *data_size = 0; return 0; /* should not happen but who knows */ if (BLOCKS_PER_LOOP * 2 * avctx->channels > *data_size) { av_log (avctx, AV_LOG_ERROR, "Packet size is too big to be handled in lavc! (max is %d where you have %d)\n", *data_size, s->samples * 2 * avctx->channels); if(!s->samples){ s->data = av_realloc(s->data, (buf_size + 3) & ~3); s->dsp.bswap_buf((uint32_t*)s->data, (const uint32_t*)buf, buf_size >> 2); s->ptr = s->last_ptr = s->data; s->data_end = s->data + buf_size; nblocks = s->samples = bytestream_get_be32(&s->ptr); n = bytestream_get_be32(&s->ptr); if(n < 0 || n > 3){ av_log(avctx, AV_LOG_ERROR, "Incorrect offset passed\n"); s->data = NULL; s->ptr += n; s->currentframeblocks = nblocks; buf += 4; if (s->samples <= 0) { *data_size = 0; return buf_size; memset(s->decoded0, 0, sizeof(s->decoded0)); memset(s->decoded1, 0, sizeof(s->decoded1)); /* Initialize the frame decoder */ init_frame_decoder(s); if (!s->data) { *data_size = 0; return buf_size; nblocks = s->samples; blockstodecode = FFMIN(BLOCKS_PER_LOOP, nblocks); if ((s->channels == 1) || (s->frameflags & APE_FRAMECODE_PSEUDO_STEREO)) ape_unpack_mono(s, blockstodecode); else ape_unpack_stereo(s, blockstodecode); for (i = 0; i < blockstodecode; i++) { *samples++ = s->decoded0[i]; if(s->channels == 2) *samples++ = s->decoded1[i]; s->samples -= blockstodecode; *data_size = blockstodecode * 2 * s->channels; bytes_used = s->samples ? s->ptr - s->last_ptr : buf_size; s->last_ptr = s->ptr; return bytes_used;
true
FFmpeg
6a287b739f3a8660d5e4405be1302da8b3e51e88
static int ape_decode_frame(AVCodecContext * avctx, void *data, int *data_size, const uint8_t * buf, int buf_size) { APEContext *s = avctx->priv_data; int16_t *samples = data; int nblocks; int i, n; int blockstodecode; int bytes_used; if (buf_size == 0 && !s->samples) { *data_size = 0; return 0; if (BLOCKS_PER_LOOP * 2 * avctx->channels > *data_size) { av_log (avctx, AV_LOG_ERROR, "Packet size is too big to be handled in lavc! (max is %d where you have %d)\n", *data_size, s->samples * 2 * avctx->channels); if(!s->samples){ s->data = av_realloc(s->data, (buf_size + 3) & ~3); s->dsp.bswap_buf((uint32_t*)s->data, (const uint32_t*)buf, buf_size >> 2); s->ptr = s->last_ptr = s->data; s->data_end = s->data + buf_size; nblocks = s->samples = bytestream_get_be32(&s->ptr); n = bytestream_get_be32(&s->ptr); if(n < 0 || n > 3){ av_log(avctx, AV_LOG_ERROR, "Incorrect offset passed\n"); s->data = NULL; s->ptr += n; s->currentframeblocks = nblocks; buf += 4; if (s->samples <= 0) { *data_size = 0; return buf_size; memset(s->decoded0, 0, sizeof(s->decoded0)); memset(s->decoded1, 0, sizeof(s->decoded1)); init_frame_decoder(s); if (!s->data) { *data_size = 0; return buf_size; nblocks = s->samples; blockstodecode = FFMIN(BLOCKS_PER_LOOP, nblocks); if ((s->channels == 1) || (s->frameflags & APE_FRAMECODE_PSEUDO_STEREO)) ape_unpack_mono(s, blockstodecode); else ape_unpack_stereo(s, blockstodecode); for (i = 0; i < blockstodecode; i++) { *samples++ = s->decoded0[i]; if(s->channels == 2) *samples++ = s->decoded1[i]; s->samples -= blockstodecode; *data_size = blockstodecode * 2 * s->channels; bytes_used = s->samples ? s->ptr - s->last_ptr : buf_size; s->last_ptr = s->ptr; return bytes_used;
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext * VAR_0, void *VAR_1, int *VAR_2, const uint8_t * VAR_3, int VAR_4) { APEContext *s = VAR_0->priv_data; int16_t *samples = VAR_1; int VAR_5; int VAR_6, VAR_7; int VAR_8; int VAR_9; if (VAR_4 == 0 && !s->samples) { *VAR_2 = 0; return 0; if (BLOCKS_PER_LOOP * 2 * VAR_0->channels > *VAR_2) { av_log (VAR_0, AV_LOG_ERROR, "Packet size is too big to be handled in lavc! (max is %d where you have %d)\VAR_7", *VAR_2, s->samples * 2 * VAR_0->channels); if(!s->samples){ s->VAR_1 = av_realloc(s->VAR_1, (VAR_4 + 3) & ~3); s->dsp.bswap_buf((uint32_t*)s->VAR_1, (const uint32_t*)VAR_3, VAR_4 >> 2); s->ptr = s->last_ptr = s->VAR_1; s->data_end = s->VAR_1 + VAR_4; VAR_5 = s->samples = bytestream_get_be32(&s->ptr); VAR_7 = bytestream_get_be32(&s->ptr); if(VAR_7 < 0 || VAR_7 > 3){ av_log(VAR_0, AV_LOG_ERROR, "Incorrect offset passed\VAR_7"); s->VAR_1 = NULL; s->ptr += VAR_7; s->currentframeblocks = VAR_5; VAR_3 += 4; if (s->samples <= 0) { *VAR_2 = 0; return VAR_4; memset(s->decoded0, 0, sizeof(s->decoded0)); memset(s->decoded1, 0, sizeof(s->decoded1)); init_frame_decoder(s); if (!s->VAR_1) { *VAR_2 = 0; return VAR_4; VAR_5 = s->samples; VAR_8 = FFMIN(BLOCKS_PER_LOOP, VAR_5); if ((s->channels == 1) || (s->frameflags & APE_FRAMECODE_PSEUDO_STEREO)) ape_unpack_mono(s, VAR_8); else ape_unpack_stereo(s, VAR_8); for (VAR_6 = 0; VAR_6 < VAR_8; VAR_6++) { *samples++ = s->decoded0[VAR_6]; if(s->channels == 2) *samples++ = s->decoded1[VAR_6]; s->samples -= VAR_8; *VAR_2 = VAR_8 * 2 * s->channels; VAR_9 = s->samples ? s->ptr - s->last_ptr : VAR_4; s->last_ptr = s->ptr; return VAR_9;
[ "static int FUNC_0(AVCodecContext * VAR_0,\nvoid *VAR_1, int *VAR_2,\nconst uint8_t * VAR_3, int VAR_4)\n{", "APEContext *s = VAR_0->priv_data;", "int16_t *samples = VAR_1;", "int VAR_5;", "int VAR_6, VAR_7;", "int VAR_8;", "int VAR_9;", "if (VAR_4 == 0 && !s->samples) {", "*VAR_2 = 0;", "return 0;", "if (BLOCKS_PER_LOOP * 2 * VAR_0->channels > *VAR_2) {", "av_log (VAR_0, AV_LOG_ERROR, \"Packet size is too big to be handled in lavc! (max is %d where you have %d)\\VAR_7\", *VAR_2, s->samples * 2 * VAR_0->channels);", "if(!s->samples){", "s->VAR_1 = av_realloc(s->VAR_1, (VAR_4 + 3) & ~3);", "s->dsp.bswap_buf((uint32_t*)s->VAR_1, (const uint32_t*)VAR_3, VAR_4 >> 2);", "s->ptr = s->last_ptr = s->VAR_1;", "s->data_end = s->VAR_1 + VAR_4;", "VAR_5 = s->samples = bytestream_get_be32(&s->ptr);", "VAR_7 = bytestream_get_be32(&s->ptr);", "if(VAR_7 < 0 || VAR_7 > 3){", "av_log(VAR_0, AV_LOG_ERROR, \"Incorrect offset passed\\VAR_7\");", "s->VAR_1 = NULL;", "s->ptr += VAR_7;", "s->currentframeblocks = VAR_5;", "VAR_3 += 4;", "if (s->samples <= 0) {", "*VAR_2 = 0;", "return VAR_4;", "memset(s->decoded0, 0, sizeof(s->decoded0));", "memset(s->decoded1, 0, sizeof(s->decoded1));", "init_frame_decoder(s);", "if (!s->VAR_1) {", "*VAR_2 = 0;", "return VAR_4;", "VAR_5 = s->samples;", "VAR_8 = FFMIN(BLOCKS_PER_LOOP, VAR_5);", "if ((s->channels == 1) || (s->frameflags & APE_FRAMECODE_PSEUDO_STEREO))\nape_unpack_mono(s, VAR_8);", "else\nape_unpack_stereo(s, VAR_8);", "for (VAR_6 = 0; VAR_6 < VAR_8; VAR_6++) {", "*samples++ = s->decoded0[VAR_6];", "if(s->channels == 2)\n*samples++ = s->decoded1[VAR_6];", "s->samples -= VAR_8;", "*VAR_2 = VAR_8 * 2 * s->channels;", "VAR_9 = s->samples ? s->ptr - s->last_ptr : VAR_4;", "s->last_ptr = s->ptr;", "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 ]
[ [ 1, 2, 3, 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19 ], [ 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24 ], [ 25 ], [ 26 ], [ 27 ], [ 28 ], [ 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33 ], [ 34 ], [ 36 ], [ 37 ], [ 38 ], [ 39 ], [ 40 ], [ 41 ], [ 42, 43 ], [ 44, 45 ], [ 46 ], [ 47 ], [ 48, 49 ], [ 50 ], [ 51 ], [ 52 ], [ 53 ], [ 54 ] ]
21,753
AVAES *av_aes_init(uint8_t *key, int key_bits, int decrypt) { AVAES *a; int i, j, t, rconpointer = 0; uint8_t tk[8][4]; int KC= key_bits>>5; int rounds= KC + 6; uint8_t log8[256]; uint8_t alog8[512]; if(!sbox[255]){ j=1; for(i=0; i<255; i++){ alog8[i]= alog8[i+255]= j; log8[j]= i; j^= j+j; if(j>255) j^= 0x11B; } for(i=0; i<256; i++){ j= i ? alog8[255-log8[i]] : 0; j ^= (j<<1) ^ (j<<2) ^ (j<<3) ^ (j<<4); j = (j ^ (j>>8) ^ 99) & 255; inv_sbox[j]= i; sbox [i]= j; } init_multbl2(dec_multbl[0], (int[4]){0xe, 0x9, 0xd, 0xb}, log8, alog8, inv_sbox); init_multbl2(enc_multbl[0], (int[4]){0x2, 0x1, 0x1, 0x3}, log8, alog8, sbox); } if(key_bits!=128 && key_bits!=192 && key_bits!=256) return NULL; a= av_malloc(sizeof(AVAES)); a->rounds= rounds; memcpy(tk, key, KC*4); for(t= 0; t < (rounds+1)*4;) { memcpy(a->round_key[0][t], tk, KC*4); t+= KC; for(i = 0; i < 4; i++) tk[0][i] ^= sbox[tk[KC-1][(i+1)&3]]; tk[0][0] ^= rcon[rconpointer++]; for(j = 1; j < KC; j++){ if(KC != 8 || j != KC>>1) for(i = 0; i < 4; i++) tk[j][i] ^= tk[j-1][i]; else for(i = 0; i < 4; i++) tk[j][i] ^= sbox[tk[j-1][i]]; } } if(decrypt){ for(i=1; i<rounds; i++){ for(j=0; j<16; j++) a->round_key[i][0][j]= sbox[a->round_key[i][0][j]]; mix(a->round_key[i], dec_multbl); } }else{ for(i=0; i<(rounds+1)>>1; i++){ for(j=0; j<16; j++) FFSWAP(int, a->round_key[i][0][j], a->round_key[rounds-i][0][j]); } } return a; }
false
FFmpeg
347c27988d1924f795a6b30ae6d41e0b774a219f
AVAES *av_aes_init(uint8_t *key, int key_bits, int decrypt) { AVAES *a; int i, j, t, rconpointer = 0; uint8_t tk[8][4]; int KC= key_bits>>5; int rounds= KC + 6; uint8_t log8[256]; uint8_t alog8[512]; if(!sbox[255]){ j=1; for(i=0; i<255; i++){ alog8[i]= alog8[i+255]= j; log8[j]= i; j^= j+j; if(j>255) j^= 0x11B; } for(i=0; i<256; i++){ j= i ? alog8[255-log8[i]] : 0; j ^= (j<<1) ^ (j<<2) ^ (j<<3) ^ (j<<4); j = (j ^ (j>>8) ^ 99) & 255; inv_sbox[j]= i; sbox [i]= j; } init_multbl2(dec_multbl[0], (int[4]){0xe, 0x9, 0xd, 0xb}, log8, alog8, inv_sbox); init_multbl2(enc_multbl[0], (int[4]){0x2, 0x1, 0x1, 0x3}, log8, alog8, sbox); } if(key_bits!=128 && key_bits!=192 && key_bits!=256) return NULL; a= av_malloc(sizeof(AVAES)); a->rounds= rounds; memcpy(tk, key, KC*4); for(t= 0; t < (rounds+1)*4;) { memcpy(a->round_key[0][t], tk, KC*4); t+= KC; for(i = 0; i < 4; i++) tk[0][i] ^= sbox[tk[KC-1][(i+1)&3]]; tk[0][0] ^= rcon[rconpointer++]; for(j = 1; j < KC; j++){ if(KC != 8 || j != KC>>1) for(i = 0; i < 4; i++) tk[j][i] ^= tk[j-1][i]; else for(i = 0; i < 4; i++) tk[j][i] ^= sbox[tk[j-1][i]]; } } if(decrypt){ for(i=1; i<rounds; i++){ for(j=0; j<16; j++) a->round_key[i][0][j]= sbox[a->round_key[i][0][j]]; mix(a->round_key[i], dec_multbl); } }else{ for(i=0; i<(rounds+1)>>1; i++){ for(j=0; j<16; j++) FFSWAP(int, a->round_key[i][0][j], a->round_key[rounds-i][0][j]); } } return a; }
{ "code": [], "line_no": [] }
AVAES *FUNC_0(uint8_t *key, int key_bits, int decrypt) { AVAES *a; int VAR_0, VAR_1, VAR_2, VAR_3 = 0; uint8_t tk[8][4]; int VAR_4= key_bits>>5; int VAR_5= VAR_4 + 6; uint8_t log8[256]; uint8_t alog8[512]; if(!sbox[255]){ VAR_1=1; for(VAR_0=0; VAR_0<255; VAR_0++){ alog8[VAR_0]= alog8[VAR_0+255]= VAR_1; log8[VAR_1]= VAR_0; VAR_1^= VAR_1+VAR_1; if(VAR_1>255) VAR_1^= 0x11B; } for(VAR_0=0; VAR_0<256; VAR_0++){ VAR_1= VAR_0 ? alog8[255-log8[VAR_0]] : 0; VAR_1 ^= (VAR_1<<1) ^ (VAR_1<<2) ^ (VAR_1<<3) ^ (VAR_1<<4); VAR_1 = (VAR_1 ^ (VAR_1>>8) ^ 99) & 255; inv_sbox[VAR_1]= VAR_0; sbox [VAR_0]= VAR_1; } init_multbl2(dec_multbl[0], (int[4]){0xe, 0x9, 0xd, 0xb}, log8, alog8, inv_sbox); init_multbl2(enc_multbl[0], (int[4]){0x2, 0x1, 0x1, 0x3}, log8, alog8, sbox); } if(key_bits!=128 && key_bits!=192 && key_bits!=256) return NULL; a= av_malloc(sizeof(AVAES)); a->VAR_5= VAR_5; memcpy(tk, key, VAR_4*4); for(VAR_2= 0; VAR_2 < (VAR_5+1)*4;) { memcpy(a->round_key[0][VAR_2], tk, VAR_4*4); VAR_2+= VAR_4; for(VAR_0 = 0; VAR_0 < 4; VAR_0++) tk[0][VAR_0] ^= sbox[tk[VAR_4-1][(VAR_0+1)&3]]; tk[0][0] ^= rcon[VAR_3++]; for(VAR_1 = 1; VAR_1 < VAR_4; VAR_1++){ if(VAR_4 != 8 || VAR_1 != VAR_4>>1) for(VAR_0 = 0; VAR_0 < 4; VAR_0++) tk[VAR_1][VAR_0] ^= tk[VAR_1-1][VAR_0]; else for(VAR_0 = 0; VAR_0 < 4; VAR_0++) tk[VAR_1][VAR_0] ^= sbox[tk[VAR_1-1][VAR_0]]; } } if(decrypt){ for(VAR_0=1; VAR_0<VAR_5; VAR_0++){ for(VAR_1=0; VAR_1<16; VAR_1++) a->round_key[VAR_0][0][VAR_1]= sbox[a->round_key[VAR_0][0][VAR_1]]; mix(a->round_key[VAR_0], dec_multbl); } }else{ for(VAR_0=0; VAR_0<(VAR_5+1)>>1; VAR_0++){ for(VAR_1=0; VAR_1<16; VAR_1++) FFSWAP(int, a->round_key[VAR_0][0][VAR_1], a->round_key[VAR_5-VAR_0][0][VAR_1]); } } return a; }
[ "AVAES *FUNC_0(uint8_t *key, int key_bits, int decrypt) {", "AVAES *a;", "int VAR_0, VAR_1, VAR_2, VAR_3 = 0;", "uint8_t tk[8][4];", "int VAR_4= key_bits>>5;", "int VAR_5= VAR_4 + 6;", "uint8_t log8[256];", "uint8_t alog8[512];", "if(!sbox[255]){", "VAR_1=1;", "for(VAR_0=0; VAR_0<255; VAR_0++){", "alog8[VAR_0]=\nalog8[VAR_0+255]= VAR_1;", "log8[VAR_1]= VAR_0;", "VAR_1^= VAR_1+VAR_1;", "if(VAR_1>255) VAR_1^= 0x11B;", "}", "for(VAR_0=0; VAR_0<256; VAR_0++){", "VAR_1= VAR_0 ? alog8[255-log8[VAR_0]] : 0;", "VAR_1 ^= (VAR_1<<1) ^ (VAR_1<<2) ^ (VAR_1<<3) ^ (VAR_1<<4);", "VAR_1 = (VAR_1 ^ (VAR_1>>8) ^ 99) & 255;", "inv_sbox[VAR_1]= VAR_0;", "sbox [VAR_0]= VAR_1;", "}", "init_multbl2(dec_multbl[0], (int[4]){0xe, 0x9, 0xd, 0xb}, log8, alog8, inv_sbox);", "init_multbl2(enc_multbl[0], (int[4]){0x2, 0x1, 0x1, 0x3}, log8, alog8, sbox);", "}", "if(key_bits!=128 && key_bits!=192 && key_bits!=256)\nreturn NULL;", "a= av_malloc(sizeof(AVAES));", "a->VAR_5= VAR_5;", "memcpy(tk, key, VAR_4*4);", "for(VAR_2= 0; VAR_2 < (VAR_5+1)*4;) {", "memcpy(a->round_key[0][VAR_2], tk, VAR_4*4);", "VAR_2+= VAR_4;", "for(VAR_0 = 0; VAR_0 < 4; VAR_0++)", "tk[0][VAR_0] ^= sbox[tk[VAR_4-1][(VAR_0+1)&3]];", "tk[0][0] ^= rcon[VAR_3++];", "for(VAR_1 = 1; VAR_1 < VAR_4; VAR_1++){", "if(VAR_4 != 8 || VAR_1 != VAR_4>>1)\nfor(VAR_0 = 0; VAR_0 < 4; VAR_0++) tk[VAR_1][VAR_0] ^= tk[VAR_1-1][VAR_0];", "else\nfor(VAR_0 = 0; VAR_0 < 4; VAR_0++) tk[VAR_1][VAR_0] ^= sbox[tk[VAR_1-1][VAR_0]];", "}", "}", "if(decrypt){", "for(VAR_0=1; VAR_0<VAR_5; VAR_0++){", "for(VAR_1=0; VAR_1<16; VAR_1++)", "a->round_key[VAR_0][0][VAR_1]= sbox[a->round_key[VAR_0][0][VAR_1]];", "mix(a->round_key[VAR_0], dec_multbl);", "}", "}else{", "for(VAR_0=0; VAR_0<(VAR_5+1)>>1; VAR_0++){", "for(VAR_1=0; VAR_1<16; VAR_1++)", "FFSWAP(int, a->round_key[VAR_0][0][VAR_1], a->round_key[VAR_5-VAR_0][0][VAR_1]);", "}", "}", "return a;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59, 61 ], [ 65 ], [ 67 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93, 95 ], [ 97, 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 133 ], [ 135 ] ]
21,754
av_cold void ff_mpadsp_init(MPADSPContext *s) { DCTContext dct; ff_dct_init(&dct, 5, DCT_II); ff_init_mpadsp_tabs_float(); ff_init_mpadsp_tabs_fixed(); s->apply_window_float = ff_mpadsp_apply_window_float; s->apply_window_fixed = ff_mpadsp_apply_window_fixed; s->dct32_float = dct.dct32; s->dct32_fixed = ff_dct32_fixed; s->imdct36_blocks_float = ff_imdct36_blocks_float; s->imdct36_blocks_fixed = ff_imdct36_blocks_fixed; if (ARCH_AARCH64) ff_mpadsp_init_aarch64(s); if (ARCH_ARM) ff_mpadsp_init_arm(s); if (ARCH_PPC) ff_mpadsp_init_ppc(s); if (ARCH_X86) ff_mpadsp_init_x86(s); if (HAVE_MIPSFPU) ff_mpadsp_init_mipsfpu(s); if (HAVE_MIPSDSP) ff_mpadsp_init_mipsdsp(s); }
false
FFmpeg
5eaaffaf64d1854493f0fe9ec822eed1b3cd9fe1
av_cold void ff_mpadsp_init(MPADSPContext *s) { DCTContext dct; ff_dct_init(&dct, 5, DCT_II); ff_init_mpadsp_tabs_float(); ff_init_mpadsp_tabs_fixed(); s->apply_window_float = ff_mpadsp_apply_window_float; s->apply_window_fixed = ff_mpadsp_apply_window_fixed; s->dct32_float = dct.dct32; s->dct32_fixed = ff_dct32_fixed; s->imdct36_blocks_float = ff_imdct36_blocks_float; s->imdct36_blocks_fixed = ff_imdct36_blocks_fixed; if (ARCH_AARCH64) ff_mpadsp_init_aarch64(s); if (ARCH_ARM) ff_mpadsp_init_arm(s); if (ARCH_PPC) ff_mpadsp_init_ppc(s); if (ARCH_X86) ff_mpadsp_init_x86(s); if (HAVE_MIPSFPU) ff_mpadsp_init_mipsfpu(s); if (HAVE_MIPSDSP) ff_mpadsp_init_mipsdsp(s); }
{ "code": [], "line_no": [] }
av_cold void FUNC_0(MPADSPContext *s) { DCTContext dct; ff_dct_init(&dct, 5, DCT_II); ff_init_mpadsp_tabs_float(); ff_init_mpadsp_tabs_fixed(); s->apply_window_float = ff_mpadsp_apply_window_float; s->apply_window_fixed = ff_mpadsp_apply_window_fixed; s->dct32_float = dct.dct32; s->dct32_fixed = ff_dct32_fixed; s->imdct36_blocks_float = ff_imdct36_blocks_float; s->imdct36_blocks_fixed = ff_imdct36_blocks_fixed; if (ARCH_AARCH64) ff_mpadsp_init_aarch64(s); if (ARCH_ARM) ff_mpadsp_init_arm(s); if (ARCH_PPC) ff_mpadsp_init_ppc(s); if (ARCH_X86) ff_mpadsp_init_x86(s); if (HAVE_MIPSFPU) ff_mpadsp_init_mipsfpu(s); if (HAVE_MIPSDSP) ff_mpadsp_init_mipsdsp(s); }
[ "av_cold void FUNC_0(MPADSPContext *s)\n{", "DCTContext dct;", "ff_dct_init(&dct, 5, DCT_II);", "ff_init_mpadsp_tabs_float();", "ff_init_mpadsp_tabs_fixed();", "s->apply_window_float = ff_mpadsp_apply_window_float;", "s->apply_window_fixed = ff_mpadsp_apply_window_fixed;", "s->dct32_float = dct.dct32;", "s->dct32_fixed = ff_dct32_fixed;", "s->imdct36_blocks_float = ff_imdct36_blocks_float;", "s->imdct36_blocks_fixed = ff_imdct36_blocks_fixed;", "if (ARCH_AARCH64) ff_mpadsp_init_aarch64(s);", "if (ARCH_ARM) ff_mpadsp_init_arm(s);", "if (ARCH_PPC) ff_mpadsp_init_ppc(s);", "if (ARCH_X86) ff_mpadsp_init_x86(s);", "if (HAVE_MIPSFPU) ff_mpadsp_init_mipsfpu(s);", "if (HAVE_MIPSDSP) ff_mpadsp_init_mipsdsp(s);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ] ]
21,755
static int get_range_off(int *off, int *y_rng, int *uv_rng, enum AVColorRange rng, int depth) { switch (rng) { case AVCOL_RANGE_MPEG: *off = 16 << (depth - 8); *y_rng = 219 << (depth - 8); *uv_rng = 224 << (depth - 8); break; case AVCOL_RANGE_JPEG: *off = 0; *y_rng = *uv_rng = (256 << (depth - 8)) - 1; break; default: return AVERROR(EINVAL); } return 0; }
false
FFmpeg
cb78d14cf9b5ab59b4a9177f390f5e1abff58644
static int get_range_off(int *off, int *y_rng, int *uv_rng, enum AVColorRange rng, int depth) { switch (rng) { case AVCOL_RANGE_MPEG: *off = 16 << (depth - 8); *y_rng = 219 << (depth - 8); *uv_rng = 224 << (depth - 8); break; case AVCOL_RANGE_JPEG: *off = 0; *y_rng = *uv_rng = (256 << (depth - 8)) - 1; break; default: return AVERROR(EINVAL); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(int *VAR_0, int *VAR_1, int *VAR_2, enum AVColorRange VAR_3, int VAR_4) { switch (VAR_3) { case AVCOL_RANGE_MPEG: *VAR_0 = 16 << (VAR_4 - 8); *VAR_1 = 219 << (VAR_4 - 8); *VAR_2 = 224 << (VAR_4 - 8); break; case AVCOL_RANGE_JPEG: *VAR_0 = 0; *VAR_1 = *VAR_2 = (256 << (VAR_4 - 8)) - 1; break; default: return AVERROR(EINVAL); } return 0; }
[ "static int FUNC_0(int *VAR_0, int *VAR_1, int *VAR_2,\nenum AVColorRange VAR_3, int VAR_4)\n{", "switch (VAR_3) {", "case AVCOL_RANGE_MPEG:\n*VAR_0 = 16 << (VAR_4 - 8);", "*VAR_1 = 219 << (VAR_4 - 8);", "*VAR_2 = 224 << (VAR_4 - 8);", "break;", "case AVCOL_RANGE_JPEG:\n*VAR_0 = 0;", "*VAR_1 = *VAR_2 = (256 << (VAR_4 - 8)) - 1;", "break;", "default:\nreturn AVERROR(EINVAL);", "}", "return 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 ] ]
21,756
static av_always_inline void fill_filter_caches_inter(const H264Context *h, H264SliceContext *sl, int mb_type, int top_xy, int left_xy[LEFT_MBS], int top_type, int left_type[LEFT_MBS], int mb_xy, int list) { int b_stride = h->b_stride; int16_t(*mv_dst)[2] = &sl->mv_cache[list][scan8[0]]; int8_t *ref_cache = &sl->ref_cache[list][scan8[0]]; if (IS_INTER(mb_type) || IS_DIRECT(mb_type)) { if (USES_LIST(top_type, list)) { const int b_xy = h->mb2b_xy[top_xy] + 3 * b_stride; const int b8_xy = 4 * top_xy + 2; int (*ref2frm)[64] = sl->ref2frm[h->slice_table[top_xy] & (MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2); AV_COPY128(mv_dst - 1 * 8, h->cur_pic.motion_val[list][b_xy + 0]); ref_cache[0 - 1 * 8] = ref_cache[1 - 1 * 8] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 0]]; ref_cache[2 - 1 * 8] = ref_cache[3 - 1 * 8] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 1]]; } else { AV_ZERO128(mv_dst - 1 * 8); AV_WN32A(&ref_cache[0 - 1 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u); } if (!IS_INTERLACED(mb_type ^ left_type[LTOP])) { if (USES_LIST(left_type[LTOP], list)) { const int b_xy = h->mb2b_xy[left_xy[LTOP]] + 3; const int b8_xy = 4 * left_xy[LTOP] + 1; int (*ref2frm)[64] = sl->ref2frm[h->slice_table[left_xy[LTOP]] & (MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2); AV_COPY32(mv_dst - 1 + 0, h->cur_pic.motion_val[list][b_xy + b_stride * 0]); AV_COPY32(mv_dst - 1 + 8, h->cur_pic.motion_val[list][b_xy + b_stride * 1]); AV_COPY32(mv_dst - 1 + 16, h->cur_pic.motion_val[list][b_xy + b_stride * 2]); AV_COPY32(mv_dst - 1 + 24, h->cur_pic.motion_val[list][b_xy + b_stride * 3]); ref_cache[-1 + 0] = ref_cache[-1 + 8] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 2 * 0]]; ref_cache[-1 + 16] = ref_cache[-1 + 24] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 2 * 1]]; } else { AV_ZERO32(mv_dst - 1 + 0); AV_ZERO32(mv_dst - 1 + 8); AV_ZERO32(mv_dst - 1 + 16); AV_ZERO32(mv_dst - 1 + 24); ref_cache[-1 + 0] = ref_cache[-1 + 8] = ref_cache[-1 + 16] = ref_cache[-1 + 24] = LIST_NOT_USED; } } } if (!USES_LIST(mb_type, list)) { fill_rectangle(mv_dst, 4, 4, 8, pack16to32(0, 0), 4); AV_WN32A(&ref_cache[0 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u); AV_WN32A(&ref_cache[1 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u); AV_WN32A(&ref_cache[2 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u); AV_WN32A(&ref_cache[3 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u); return; } { int8_t *ref = &h->cur_pic.ref_index[list][4 * mb_xy]; int (*ref2frm)[64] = sl->ref2frm[sl->slice_num & (MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2); uint32_t ref01 = (pack16to32(ref2frm[list][ref[0]], ref2frm[list][ref[1]]) & 0x00FF00FF) * 0x0101; uint32_t ref23 = (pack16to32(ref2frm[list][ref[2]], ref2frm[list][ref[3]]) & 0x00FF00FF) * 0x0101; AV_WN32A(&ref_cache[0 * 8], ref01); AV_WN32A(&ref_cache[1 * 8], ref01); AV_WN32A(&ref_cache[2 * 8], ref23); AV_WN32A(&ref_cache[3 * 8], ref23); } { int16_t(*mv_src)[2] = &h->cur_pic.motion_val[list][4 * sl->mb_x + 4 * sl->mb_y * b_stride]; AV_COPY128(mv_dst + 8 * 0, mv_src + 0 * b_stride); AV_COPY128(mv_dst + 8 * 1, mv_src + 1 * b_stride); AV_COPY128(mv_dst + 8 * 2, mv_src + 2 * b_stride); AV_COPY128(mv_dst + 8 * 3, mv_src + 3 * b_stride); } }
false
FFmpeg
b77fffa127663028169c5ed543956af4b9496c29
static av_always_inline void fill_filter_caches_inter(const H264Context *h, H264SliceContext *sl, int mb_type, int top_xy, int left_xy[LEFT_MBS], int top_type, int left_type[LEFT_MBS], int mb_xy, int list) { int b_stride = h->b_stride; int16_t(*mv_dst)[2] = &sl->mv_cache[list][scan8[0]]; int8_t *ref_cache = &sl->ref_cache[list][scan8[0]]; if (IS_INTER(mb_type) || IS_DIRECT(mb_type)) { if (USES_LIST(top_type, list)) { const int b_xy = h->mb2b_xy[top_xy] + 3 * b_stride; const int b8_xy = 4 * top_xy + 2; int (*ref2frm)[64] = sl->ref2frm[h->slice_table[top_xy] & (MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2); AV_COPY128(mv_dst - 1 * 8, h->cur_pic.motion_val[list][b_xy + 0]); ref_cache[0 - 1 * 8] = ref_cache[1 - 1 * 8] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 0]]; ref_cache[2 - 1 * 8] = ref_cache[3 - 1 * 8] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 1]]; } else { AV_ZERO128(mv_dst - 1 * 8); AV_WN32A(&ref_cache[0 - 1 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u); } if (!IS_INTERLACED(mb_type ^ left_type[LTOP])) { if (USES_LIST(left_type[LTOP], list)) { const int b_xy = h->mb2b_xy[left_xy[LTOP]] + 3; const int b8_xy = 4 * left_xy[LTOP] + 1; int (*ref2frm)[64] = sl->ref2frm[h->slice_table[left_xy[LTOP]] & (MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2); AV_COPY32(mv_dst - 1 + 0, h->cur_pic.motion_val[list][b_xy + b_stride * 0]); AV_COPY32(mv_dst - 1 + 8, h->cur_pic.motion_val[list][b_xy + b_stride * 1]); AV_COPY32(mv_dst - 1 + 16, h->cur_pic.motion_val[list][b_xy + b_stride * 2]); AV_COPY32(mv_dst - 1 + 24, h->cur_pic.motion_val[list][b_xy + b_stride * 3]); ref_cache[-1 + 0] = ref_cache[-1 + 8] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 2 * 0]]; ref_cache[-1 + 16] = ref_cache[-1 + 24] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 2 * 1]]; } else { AV_ZERO32(mv_dst - 1 + 0); AV_ZERO32(mv_dst - 1 + 8); AV_ZERO32(mv_dst - 1 + 16); AV_ZERO32(mv_dst - 1 + 24); ref_cache[-1 + 0] = ref_cache[-1 + 8] = ref_cache[-1 + 16] = ref_cache[-1 + 24] = LIST_NOT_USED; } } } if (!USES_LIST(mb_type, list)) { fill_rectangle(mv_dst, 4, 4, 8, pack16to32(0, 0), 4); AV_WN32A(&ref_cache[0 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u); AV_WN32A(&ref_cache[1 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u); AV_WN32A(&ref_cache[2 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u); AV_WN32A(&ref_cache[3 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u); return; } { int8_t *ref = &h->cur_pic.ref_index[list][4 * mb_xy]; int (*ref2frm)[64] = sl->ref2frm[sl->slice_num & (MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2); uint32_t ref01 = (pack16to32(ref2frm[list][ref[0]], ref2frm[list][ref[1]]) & 0x00FF00FF) * 0x0101; uint32_t ref23 = (pack16to32(ref2frm[list][ref[2]], ref2frm[list][ref[3]]) & 0x00FF00FF) * 0x0101; AV_WN32A(&ref_cache[0 * 8], ref01); AV_WN32A(&ref_cache[1 * 8], ref01); AV_WN32A(&ref_cache[2 * 8], ref23); AV_WN32A(&ref_cache[3 * 8], ref23); } { int16_t(*mv_src)[2] = &h->cur_pic.motion_val[list][4 * sl->mb_x + 4 * sl->mb_y * b_stride]; AV_COPY128(mv_dst + 8 * 0, mv_src + 0 * b_stride); AV_COPY128(mv_dst + 8 * 1, mv_src + 1 * b_stride); AV_COPY128(mv_dst + 8 * 2, mv_src + 2 * b_stride); AV_COPY128(mv_dst + 8 * 3, mv_src + 3 * b_stride); } }
{ "code": [], "line_no": [] }
static av_always_inline void FUNC_0(const H264Context *h, H264SliceContext *sl, int mb_type, int top_xy, int left_xy[LEFT_MBS], int top_type, int left_type[LEFT_MBS], int mb_xy, int list) { int VAR_0 = h->VAR_0; int16_t(*mv_dst)[2] = &sl->mv_cache[list][scan8[0]]; int8_t *ref_cache = &sl->ref_cache[list][scan8[0]]; if (IS_INTER(mb_type) || IS_DIRECT(mb_type)) { if (USES_LIST(top_type, list)) { const int VAR_4 = h->mb2b_xy[top_xy] + 3 * VAR_0; const int VAR_4 = 4 * top_xy + 2; int (*VAR_4)[64] = sl->VAR_4[h->slice_table[top_xy] & (MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2); AV_COPY128(mv_dst - 1 * 8, h->cur_pic.motion_val[list][VAR_4 + 0]); ref_cache[0 - 1 * 8] = ref_cache[1 - 1 * 8] = VAR_4[list][h->cur_pic.ref_index[list][VAR_4 + 0]]; ref_cache[2 - 1 * 8] = ref_cache[3 - 1 * 8] = VAR_4[list][h->cur_pic.ref_index[list][VAR_4 + 1]]; } else { AV_ZERO128(mv_dst - 1 * 8); AV_WN32A(&ref_cache[0 - 1 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u); } if (!IS_INTERLACED(mb_type ^ left_type[LTOP])) { if (USES_LIST(left_type[LTOP], list)) { const int VAR_4 = h->mb2b_xy[left_xy[LTOP]] + 3; const int VAR_4 = 4 * left_xy[LTOP] + 1; int (*VAR_4)[64] = sl->VAR_4[h->slice_table[left_xy[LTOP]] & (MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2); AV_COPY32(mv_dst - 1 + 0, h->cur_pic.motion_val[list][VAR_4 + VAR_0 * 0]); AV_COPY32(mv_dst - 1 + 8, h->cur_pic.motion_val[list][VAR_4 + VAR_0 * 1]); AV_COPY32(mv_dst - 1 + 16, h->cur_pic.motion_val[list][VAR_4 + VAR_0 * 2]); AV_COPY32(mv_dst - 1 + 24, h->cur_pic.motion_val[list][VAR_4 + VAR_0 * 3]); ref_cache[-1 + 0] = ref_cache[-1 + 8] = VAR_4[list][h->cur_pic.ref_index[list][VAR_4 + 2 * 0]]; ref_cache[-1 + 16] = ref_cache[-1 + 24] = VAR_4[list][h->cur_pic.ref_index[list][VAR_4 + 2 * 1]]; } else { AV_ZERO32(mv_dst - 1 + 0); AV_ZERO32(mv_dst - 1 + 8); AV_ZERO32(mv_dst - 1 + 16); AV_ZERO32(mv_dst - 1 + 24); ref_cache[-1 + 0] = ref_cache[-1 + 8] = ref_cache[-1 + 16] = ref_cache[-1 + 24] = LIST_NOT_USED; } } } if (!USES_LIST(mb_type, list)) { fill_rectangle(mv_dst, 4, 4, 8, pack16to32(0, 0), 4); AV_WN32A(&ref_cache[0 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u); AV_WN32A(&ref_cache[1 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u); AV_WN32A(&ref_cache[2 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u); AV_WN32A(&ref_cache[3 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u); return; } { int8_t *ref = &h->cur_pic.ref_index[list][4 * mb_xy]; int (*VAR_4)[64] = sl->VAR_4[sl->slice_num & (MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2); uint32_t ref01 = (pack16to32(VAR_4[list][ref[0]], VAR_4[list][ref[1]]) & 0x00FF00FF) * 0x0101; uint32_t ref23 = (pack16to32(VAR_4[list][ref[2]], VAR_4[list][ref[3]]) & 0x00FF00FF) * 0x0101; AV_WN32A(&ref_cache[0 * 8], ref01); AV_WN32A(&ref_cache[1 * 8], ref01); AV_WN32A(&ref_cache[2 * 8], ref23); AV_WN32A(&ref_cache[3 * 8], ref23); } { int16_t(*mv_src)[2] = &h->cur_pic.motion_val[list][4 * sl->mb_x + 4 * sl->mb_y * VAR_0]; AV_COPY128(mv_dst + 8 * 0, mv_src + 0 * VAR_0); AV_COPY128(mv_dst + 8 * 1, mv_src + 1 * VAR_0); AV_COPY128(mv_dst + 8 * 2, mv_src + 2 * VAR_0); AV_COPY128(mv_dst + 8 * 3, mv_src + 3 * VAR_0); } }
[ "static av_always_inline void FUNC_0(const H264Context *h,\nH264SliceContext *sl,\nint mb_type, int top_xy,\nint left_xy[LEFT_MBS],\nint top_type,\nint left_type[LEFT_MBS],\nint mb_xy, int list)\n{", "int VAR_0 = h->VAR_0;", "int16_t(*mv_dst)[2] = &sl->mv_cache[list][scan8[0]];", "int8_t *ref_cache = &sl->ref_cache[list][scan8[0]];", "if (IS_INTER(mb_type) || IS_DIRECT(mb_type)) {", "if (USES_LIST(top_type, list)) {", "const int VAR_4 = h->mb2b_xy[top_xy] + 3 * VAR_0;", "const int VAR_4 = 4 * top_xy + 2;", "int (*VAR_4)[64] = sl->VAR_4[h->slice_table[top_xy] & (MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2);", "AV_COPY128(mv_dst - 1 * 8, h->cur_pic.motion_val[list][VAR_4 + 0]);", "ref_cache[0 - 1 * 8] =\nref_cache[1 - 1 * 8] = VAR_4[list][h->cur_pic.ref_index[list][VAR_4 + 0]];", "ref_cache[2 - 1 * 8] =\nref_cache[3 - 1 * 8] = VAR_4[list][h->cur_pic.ref_index[list][VAR_4 + 1]];", "} else {", "AV_ZERO128(mv_dst - 1 * 8);", "AV_WN32A(&ref_cache[0 - 1 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u);", "}", "if (!IS_INTERLACED(mb_type ^ left_type[LTOP])) {", "if (USES_LIST(left_type[LTOP], list)) {", "const int VAR_4 = h->mb2b_xy[left_xy[LTOP]] + 3;", "const int VAR_4 = 4 * left_xy[LTOP] + 1;", "int (*VAR_4)[64] = sl->VAR_4[h->slice_table[left_xy[LTOP]] & (MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2);", "AV_COPY32(mv_dst - 1 + 0, h->cur_pic.motion_val[list][VAR_4 + VAR_0 * 0]);", "AV_COPY32(mv_dst - 1 + 8, h->cur_pic.motion_val[list][VAR_4 + VAR_0 * 1]);", "AV_COPY32(mv_dst - 1 + 16, h->cur_pic.motion_val[list][VAR_4 + VAR_0 * 2]);", "AV_COPY32(mv_dst - 1 + 24, h->cur_pic.motion_val[list][VAR_4 + VAR_0 * 3]);", "ref_cache[-1 + 0] =\nref_cache[-1 + 8] = VAR_4[list][h->cur_pic.ref_index[list][VAR_4 + 2 * 0]];", "ref_cache[-1 + 16] =\nref_cache[-1 + 24] = VAR_4[list][h->cur_pic.ref_index[list][VAR_4 + 2 * 1]];", "} else {", "AV_ZERO32(mv_dst - 1 + 0);", "AV_ZERO32(mv_dst - 1 + 8);", "AV_ZERO32(mv_dst - 1 + 16);", "AV_ZERO32(mv_dst - 1 + 24);", "ref_cache[-1 + 0] =\nref_cache[-1 + 8] =\nref_cache[-1 + 16] =\nref_cache[-1 + 24] = LIST_NOT_USED;", "}", "}", "}", "if (!USES_LIST(mb_type, list)) {", "fill_rectangle(mv_dst, 4, 4, 8, pack16to32(0, 0), 4);", "AV_WN32A(&ref_cache[0 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u);", "AV_WN32A(&ref_cache[1 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u);", "AV_WN32A(&ref_cache[2 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u);", "AV_WN32A(&ref_cache[3 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u);", "return;", "}", "{", "int8_t *ref = &h->cur_pic.ref_index[list][4 * mb_xy];", "int (*VAR_4)[64] = sl->VAR_4[sl->slice_num & (MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2);", "uint32_t ref01 = (pack16to32(VAR_4[list][ref[0]], VAR_4[list][ref[1]]) & 0x00FF00FF) * 0x0101;", "uint32_t ref23 = (pack16to32(VAR_4[list][ref[2]], VAR_4[list][ref[3]]) & 0x00FF00FF) * 0x0101;", "AV_WN32A(&ref_cache[0 * 8], ref01);", "AV_WN32A(&ref_cache[1 * 8], ref01);", "AV_WN32A(&ref_cache[2 * 8], ref23);", "AV_WN32A(&ref_cache[3 * 8], ref23);", "}", "{", "int16_t(*mv_src)[2] = &h->cur_pic.motion_val[list][4 * sl->mb_x + 4 * sl->mb_y * VAR_0];", "AV_COPY128(mv_dst + 8 * 0, mv_src + 0 * VAR_0);", "AV_COPY128(mv_dst + 8 * 1, mv_src + 1 * VAR_0);", "AV_COPY128(mv_dst + 8 * 2, mv_src + 2 * VAR_0);", "AV_COPY128(mv_dst + 8 * 3, mv_src + 3 * VAR_0);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 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 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ] ]
21,757
static int adpcm_decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size) { ADPCMContext *c = avctx->priv_data; ADPCMChannelStatus *cs; int n, m, channel, i; int block_predictor[2]; short *samples; short *samples_end; uint8_t *src; int st; /* stereo */ /* DK3 ADPCM accounting variables */ unsigned char last_byte = 0; unsigned char nibble; int decode_top_nibble_next = 0; int diff_channel; /* EA ADPCM state variables */ uint32_t samples_in_chunk; int32_t previous_left_sample, previous_right_sample; int32_t current_left_sample, current_right_sample; int32_t next_left_sample, next_right_sample; int32_t coeff1l, coeff2l, coeff1r, coeff2r; uint8_t shift_left, shift_right; int count1, count2; if (!buf_size) return 0; //should protect all 4bit ADPCM variants //8 is needed for CODEC_ID_ADPCM_IMA_WAV with 2 channels // if(*data_size/4 < buf_size + 8) return -1; samples = data; samples_end= samples + *data_size/2; *data_size= 0; src = buf; st = avctx->channels == 2 ? 1 : 0; switch(avctx->codec->id) { case CODEC_ID_ADPCM_IMA_QT: n = (buf_size - 2);/* >> 2*avctx->channels;*/ channel = c->channel; cs = &(c->status[channel]); /* (pppppp) (piiiiiii) */ /* Bits 15-7 are the _top_ 9 bits of the 16-bit initial predictor value */ cs->predictor = (*src++) << 8; cs->predictor |= (*src & 0x80); cs->predictor &= 0xFF80; /* sign extension */ if(cs->predictor & 0x8000) cs->predictor -= 0x10000; cs->predictor = av_clip_int16(cs->predictor); cs->step_index = (*src++) & 0x7F; if (cs->step_index > 88){ av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n", cs->step_index); cs->step_index = 88; } cs->step = step_table[cs->step_index]; if (st && channel) samples++; for(m=32; n>0 && m>0; n--, m--) { /* in QuickTime, IMA is encoded by chuncks of 34 bytes (=64 samples) */ *samples = adpcm_ima_expand_nibble(cs, src[0] & 0x0F, 3); samples += avctx->channels; *samples = adpcm_ima_expand_nibble(cs, (src[0] >> 4) & 0x0F, 3); samples += avctx->channels; src ++; } if(st) { /* handle stereo interlacing */ c->channel = (channel + 1) % 2; /* we get one packet for left, then one for right data */ if(channel == 1) { /* wait for the other packet before outputing anything */ return src - buf; } } break; case CODEC_ID_ADPCM_IMA_WAV: if (avctx->block_align != 0 && buf_size > avctx->block_align) buf_size = avctx->block_align; // samples_per_block= (block_align-4*chanels)*8 / (bits_per_sample * chanels) + 1; for(i=0; i<avctx->channels; i++){ cs = &(c->status[i]); cs->predictor = (int16_t)(src[0] + (src[1]<<8)); src+=2; // XXX: is this correct ??: *samples++ = cs->predictor; cs->step_index = *src++; if (cs->step_index > 88){ av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n", cs->step_index); cs->step_index = 88; } if (*src++) av_log(avctx, AV_LOG_ERROR, "unused byte should be null but is %d!!\n", src[-1]); /* unused */ } while(src < buf + buf_size){ for(m=0; m<4; m++){ for(i=0; i<=st; i++) *samples++ = adpcm_ima_expand_nibble(&c->status[i], src[4*i] & 0x0F, 3); for(i=0; i<=st; i++) *samples++ = adpcm_ima_expand_nibble(&c->status[i], src[4*i] >> 4 , 3); src++; } src += 4*st; } break; case CODEC_ID_ADPCM_4XM: cs = &(c->status[0]); c->status[0].predictor= (int16_t)(src[0] + (src[1]<<8)); src+=2; if(st){ c->status[1].predictor= (int16_t)(src[0] + (src[1]<<8)); src+=2; } c->status[0].step_index= (int16_t)(src[0] + (src[1]<<8)); src+=2; if(st){ c->status[1].step_index= (int16_t)(src[0] + (src[1]<<8)); src+=2; } if (cs->step_index < 0) cs->step_index = 0; if (cs->step_index > 88) cs->step_index = 88; m= (buf_size - (src - buf))>>st; for(i=0; i<m; i++) { *samples++ = adpcm_ima_expand_nibble(&c->status[0], src[i] & 0x0F, 4); if (st) *samples++ = adpcm_ima_expand_nibble(&c->status[1], src[i+m] & 0x0F, 4); *samples++ = adpcm_ima_expand_nibble(&c->status[0], src[i] >> 4, 4); if (st) *samples++ = adpcm_ima_expand_nibble(&c->status[1], src[i+m] >> 4, 4); } src += m<<st; break; case CODEC_ID_ADPCM_MS: if (avctx->block_align != 0 && buf_size > avctx->block_align) buf_size = avctx->block_align; n = buf_size - 7 * avctx->channels; if (n < 0) return -1; block_predictor[0] = av_clip(*src++, 0, 7); block_predictor[1] = 0; if (st) block_predictor[1] = av_clip(*src++, 0, 7); c->status[0].idelta = (int16_t)((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); src+=2; if (st){ c->status[1].idelta = (int16_t)((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); src+=2; } c->status[0].coeff1 = AdaptCoeff1[block_predictor[0]]; c->status[0].coeff2 = AdaptCoeff2[block_predictor[0]]; c->status[1].coeff1 = AdaptCoeff1[block_predictor[1]]; c->status[1].coeff2 = AdaptCoeff2[block_predictor[1]]; c->status[0].sample1 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); src+=2; if (st) c->status[1].sample1 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); if (st) src+=2; c->status[0].sample2 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); src+=2; if (st) c->status[1].sample2 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); if (st) src+=2; *samples++ = c->status[0].sample1; if (st) *samples++ = c->status[1].sample1; *samples++ = c->status[0].sample2; if (st) *samples++ = c->status[1].sample2; for(;n>0;n--) { *samples++ = adpcm_ms_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F); *samples++ = adpcm_ms_expand_nibble(&c->status[st], src[0] & 0x0F); src ++; } break; case CODEC_ID_ADPCM_IMA_DK4: if (avctx->block_align != 0 && buf_size > avctx->block_align) buf_size = avctx->block_align; c->status[0].predictor = (int16_t)(src[0] | (src[1] << 8)); c->status[0].step_index = src[2]; src += 4; *samples++ = c->status[0].predictor; if (st) { c->status[1].predictor = (int16_t)(src[0] | (src[1] << 8)); c->status[1].step_index = src[2]; src += 4; *samples++ = c->status[1].predictor; } while (src < buf + buf_size) { /* take care of the top nibble (always left or mono channel) */ *samples++ = adpcm_ima_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F, 3); /* take care of the bottom nibble, which is right sample for * stereo, or another mono sample */ if (st) *samples++ = adpcm_ima_expand_nibble(&c->status[1], src[0] & 0x0F, 3); else *samples++ = adpcm_ima_expand_nibble(&c->status[0], src[0] & 0x0F, 3); src++; } break; case CODEC_ID_ADPCM_IMA_DK3: if (avctx->block_align != 0 && buf_size > avctx->block_align) buf_size = avctx->block_align; if(buf_size + 16 > (samples_end - samples)*3/8) return -1; c->status[0].predictor = (int16_t)(src[10] | (src[11] << 8)); c->status[1].predictor = (int16_t)(src[12] | (src[13] << 8)); c->status[0].step_index = src[14]; c->status[1].step_index = src[15]; /* sign extend the predictors */ src += 16; diff_channel = c->status[1].predictor; /* the DK3_GET_NEXT_NIBBLE macro issues the break statement when * the buffer is consumed */ while (1) { /* for this algorithm, c->status[0] is the sum channel and * c->status[1] is the diff channel */ /* process the first predictor of the sum channel */ DK3_GET_NEXT_NIBBLE(); adpcm_ima_expand_nibble(&c->status[0], nibble, 3); /* process the diff channel predictor */ DK3_GET_NEXT_NIBBLE(); adpcm_ima_expand_nibble(&c->status[1], nibble, 3); /* process the first pair of stereo PCM samples */ diff_channel = (diff_channel + c->status[1].predictor) / 2; *samples++ = c->status[0].predictor + c->status[1].predictor; *samples++ = c->status[0].predictor - c->status[1].predictor; /* process the second predictor of the sum channel */ DK3_GET_NEXT_NIBBLE(); adpcm_ima_expand_nibble(&c->status[0], nibble, 3); /* process the second pair of stereo PCM samples */ diff_channel = (diff_channel + c->status[1].predictor) / 2; *samples++ = c->status[0].predictor + c->status[1].predictor; *samples++ = c->status[0].predictor - c->status[1].predictor; } break; case CODEC_ID_ADPCM_IMA_WS: /* no per-block initialization; just start decoding the data */ while (src < buf + buf_size) { if (st) { *samples++ = adpcm_ima_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F, 3); *samples++ = adpcm_ima_expand_nibble(&c->status[1], src[0] & 0x0F, 3); } else { *samples++ = adpcm_ima_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F, 3); *samples++ = adpcm_ima_expand_nibble(&c->status[0], src[0] & 0x0F, 3); } src++; } break; case CODEC_ID_ADPCM_XA: c->status[0].sample1 = c->status[0].sample2 = c->status[1].sample1 = c->status[1].sample2 = 0; while (buf_size >= 128) { xa_decode(samples, src, &c->status[0], &c->status[1], avctx->channels); src += 128; samples += 28 * 8; buf_size -= 128; } break; case CODEC_ID_ADPCM_EA: samples_in_chunk = AV_RL32(src); if (samples_in_chunk >= ((buf_size - 12) * 2)) { src += buf_size; break; } src += 4; current_left_sample = (int16_t)AV_RL16(src); src += 2; previous_left_sample = (int16_t)AV_RL16(src); src += 2; current_right_sample = (int16_t)AV_RL16(src); src += 2; previous_right_sample = (int16_t)AV_RL16(src); src += 2; for (count1 = 0; count1 < samples_in_chunk/28;count1++) { coeff1l = ea_adpcm_table[(*src >> 4) & 0x0F]; coeff2l = ea_adpcm_table[((*src >> 4) & 0x0F) + 4]; coeff1r = ea_adpcm_table[*src & 0x0F]; coeff2r = ea_adpcm_table[(*src & 0x0F) + 4]; src++; shift_left = ((*src >> 4) & 0x0F) + 8; shift_right = (*src & 0x0F) + 8; src++; for (count2 = 0; count2 < 28; count2++) { next_left_sample = (((*src & 0xF0) << 24) >> shift_left); next_right_sample = (((*src & 0x0F) << 28) >> shift_right); src++; next_left_sample = (next_left_sample + (current_left_sample * coeff1l) + (previous_left_sample * coeff2l) + 0x80) >> 8; next_right_sample = (next_right_sample + (current_right_sample * coeff1r) + (previous_right_sample * coeff2r) + 0x80) >> 8; previous_left_sample = current_left_sample; current_left_sample = av_clip_int16(next_left_sample); previous_right_sample = current_right_sample; current_right_sample = av_clip_int16(next_right_sample); *samples++ = (unsigned short)current_left_sample; *samples++ = (unsigned short)current_right_sample; } } break; case CODEC_ID_ADPCM_IMA_AMV: case CODEC_ID_ADPCM_IMA_SMJPEG: c->status[0].predictor = *src; src += 2; c->status[0].step_index = *src++; src++; /* skip another byte before getting to the meat */ if (avctx->codec->id == CODEC_ID_ADPCM_IMA_AMV) src+=4; while (src < buf + buf_size) { char hi, lo; lo = *src & 0x0F; hi = (*src >> 4) & 0x0F; if (avctx->codec->id == CODEC_ID_ADPCM_IMA_AMV) FFSWAP(char, hi, lo); *samples++ = adpcm_ima_expand_nibble(&c->status[0], lo, 3); *samples++ = adpcm_ima_expand_nibble(&c->status[0], hi, 3); src++; } break; case CODEC_ID_ADPCM_CT: while (src < buf + buf_size) { if (st) { *samples++ = adpcm_ct_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F); *samples++ = adpcm_ct_expand_nibble(&c->status[1], src[0] & 0x0F); } else { *samples++ = adpcm_ct_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F); *samples++ = adpcm_ct_expand_nibble(&c->status[0], src[0] & 0x0F); } src++; } break; case CODEC_ID_ADPCM_SBPRO_4: case CODEC_ID_ADPCM_SBPRO_3: case CODEC_ID_ADPCM_SBPRO_2: if (!c->status[0].step_index) { /* the first byte is a raw sample */ *samples++ = 128 * (*src++ - 0x80); if (st) *samples++ = 128 * (*src++ - 0x80); c->status[0].step_index = 1; } if (avctx->codec->id == CODEC_ID_ADPCM_SBPRO_4) { while (src < buf + buf_size) { *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F, 4, 0); *samples++ = adpcm_sbpro_expand_nibble(&c->status[st], src[0] & 0x0F, 4, 0); src++; } } else if (avctx->codec->id == CODEC_ID_ADPCM_SBPRO_3) { while (src < buf + buf_size && samples + 2 < samples_end) { *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], (src[0] >> 5) & 0x07, 3, 0); *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], (src[0] >> 2) & 0x07, 3, 0); *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], src[0] & 0x03, 2, 0); src++; } } else { while (src < buf + buf_size && samples + 3 < samples_end) { *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], (src[0] >> 6) & 0x03, 2, 2); *samples++ = adpcm_sbpro_expand_nibble(&c->status[st], (src[0] >> 4) & 0x03, 2, 2); *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], (src[0] >> 2) & 0x03, 2, 2); *samples++ = adpcm_sbpro_expand_nibble(&c->status[st], src[0] & 0x03, 2, 2); src++; } } break; case CODEC_ID_ADPCM_SWF: { GetBitContext gb; const int *table; int k0, signmask, nb_bits, count; int size = buf_size*8; init_get_bits(&gb, buf, size); //read bits & initial values nb_bits = get_bits(&gb, 2)+2; //av_log(NULL,AV_LOG_INFO,"nb_bits: %d\n", nb_bits); table = swf_index_tables[nb_bits-2]; k0 = 1 << (nb_bits-2); signmask = 1 << (nb_bits-1); while (get_bits_count(&gb) <= size - 22*avctx->channels) { for (i = 0; i < avctx->channels; i++) { *samples++ = c->status[i].predictor = get_sbits(&gb, 16); c->status[i].step_index = get_bits(&gb, 6); } for (count = 0; get_bits_count(&gb) <= size - nb_bits*avctx->channels && count < 4095; count++) { int i; for (i = 0; i < avctx->channels; i++) { // similar to IMA adpcm int delta = get_bits(&gb, nb_bits); int step = step_table[c->status[i].step_index]; long vpdiff = 0; // vpdiff = (delta+0.5)*step/4 int k = k0; do { if (delta & k) vpdiff += step; step >>= 1; k >>= 1; } while(k); vpdiff += step; if (delta & signmask) c->status[i].predictor -= vpdiff; else c->status[i].predictor += vpdiff; c->status[i].step_index += table[delta & (~signmask)]; c->status[i].step_index = av_clip(c->status[i].step_index, 0, 88); c->status[i].predictor = av_clip_int16(c->status[i].predictor); *samples++ = c->status[i].predictor; if (samples >= samples_end) { av_log(avctx, AV_LOG_ERROR, "allocated output buffer is too small\n"); return -1; } } } } src += buf_size; break; } case CODEC_ID_ADPCM_YAMAHA: while (src < buf + buf_size) { if (st) { *samples++ = adpcm_yamaha_expand_nibble(&c->status[0], src[0] & 0x0F); *samples++ = adpcm_yamaha_expand_nibble(&c->status[1], (src[0] >> 4) & 0x0F); } else { *samples++ = adpcm_yamaha_expand_nibble(&c->status[0], src[0] & 0x0F); *samples++ = adpcm_yamaha_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F); } src++; } break; case CODEC_ID_ADPCM_THP: { int table[2][16]; unsigned int samplecnt; int prev[2][2]; int ch; if (buf_size < 80) { av_log(avctx, AV_LOG_ERROR, "frame too small\n"); return -1; } src+=4; samplecnt = bytestream_get_be32(&src); for (i = 0; i < 32; i++) table[0][i] = (int16_t)bytestream_get_be16(&src); /* Initialize the previous sample. */ for (i = 0; i < 4; i++) prev[0][i] = (int16_t)bytestream_get_be16(&src); if (samplecnt >= (samples_end - samples) / (st + 1)) { av_log(avctx, AV_LOG_ERROR, "allocated output buffer is too small\n"); return -1; } for (ch = 0; ch <= st; ch++) { samples = (unsigned short *) data + ch; /* Read in every sample for this channel. */ for (i = 0; i < samplecnt / 14; i++) { int index = (*src >> 4) & 7; unsigned int exp = 28 - (*src++ & 15); int factor1 = table[ch][index * 2]; int factor2 = table[ch][index * 2 + 1]; /* Decode 14 samples. */ for (n = 0; n < 14; n++) { int32_t sampledat; if(n&1) sampledat= *src++ <<28; else sampledat= (*src&0xF0)<<24; sampledat = ((prev[ch][0]*factor1 + prev[ch][1]*factor2) >> 11) + (sampledat>>exp); *samples = av_clip_int16(sampledat); prev[ch][1] = prev[ch][0]; prev[ch][0] = *samples++; /* In case of stereo, skip one sample, this sample is for the other channel. */ samples += st; } } } /* In the previous loop, in case stereo is used, samples is increased exactly one time too often. */ samples -= st; break; } default: return -1; } *data_size = (uint8_t *)samples - (uint8_t *)data; return src - buf; }
false
FFmpeg
330194b9cec1b31cd61a80d1914bc8cfc73ad45d
static int adpcm_decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size) { ADPCMContext *c = avctx->priv_data; ADPCMChannelStatus *cs; int n, m, channel, i; int block_predictor[2]; short *samples; short *samples_end; uint8_t *src; int st; unsigned char last_byte = 0; unsigned char nibble; int decode_top_nibble_next = 0; int diff_channel; uint32_t samples_in_chunk; int32_t previous_left_sample, previous_right_sample; int32_t current_left_sample, current_right_sample; int32_t next_left_sample, next_right_sample; int32_t coeff1l, coeff2l, coeff1r, coeff2r; uint8_t shift_left, shift_right; int count1, count2; if (!buf_size) return 0; if(*data_size/4 < buf_size + 8) return -1; samples = data; samples_end= samples + *data_size/2; *data_size= 0; src = buf; st = avctx->channels == 2 ? 1 : 0; switch(avctx->codec->id) { case CODEC_ID_ADPCM_IMA_QT: n = (buf_size - 2); channel = c->channel; cs = &(c->status[channel]); cs->predictor = (*src++) << 8; cs->predictor |= (*src & 0x80); cs->predictor &= 0xFF80; if(cs->predictor & 0x8000) cs->predictor -= 0x10000; cs->predictor = av_clip_int16(cs->predictor); cs->step_index = (*src++) & 0x7F; if (cs->step_index > 88){ av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n", cs->step_index); cs->step_index = 88; } cs->step = step_table[cs->step_index]; if (st && channel) samples++; for(m=32; n>0 && m>0; n--, m--) { *samples = adpcm_ima_expand_nibble(cs, src[0] & 0x0F, 3); samples += avctx->channels; *samples = adpcm_ima_expand_nibble(cs, (src[0] >> 4) & 0x0F, 3); samples += avctx->channels; src ++; } if(st) { c->channel = (channel + 1) % 2; if(channel == 1) { return src - buf; } } break; case CODEC_ID_ADPCM_IMA_WAV: if (avctx->block_align != 0 && buf_size > avctx->block_align) buf_size = avctx->block_align; samples_per_block= (block_align-4*chanels)*8 / (bits_per_sample * chanels) + 1; for(i=0; i<avctx->channels; i++){ cs = &(c->status[i]); cs->predictor = (int16_t)(src[0] + (src[1]<<8)); src+=2; XXX: is this correct ??: *samples++ = cs->predictor; cs->step_index = *src++; if (cs->step_index > 88){ av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n", cs->step_index); cs->step_index = 88; } if (*src++) av_log(avctx, AV_LOG_ERROR, "unused byte should be null but is %d!!\n", src[-1]); } while(src < buf + buf_size){ for(m=0; m<4; m++){ for(i=0; i<=st; i++) *samples++ = adpcm_ima_expand_nibble(&c->status[i], src[4*i] & 0x0F, 3); for(i=0; i<=st; i++) *samples++ = adpcm_ima_expand_nibble(&c->status[i], src[4*i] >> 4 , 3); src++; } src += 4*st; } break; case CODEC_ID_ADPCM_4XM: cs = &(c->status[0]); c->status[0].predictor= (int16_t)(src[0] + (src[1]<<8)); src+=2; if(st){ c->status[1].predictor= (int16_t)(src[0] + (src[1]<<8)); src+=2; } c->status[0].step_index= (int16_t)(src[0] + (src[1]<<8)); src+=2; if(st){ c->status[1].step_index= (int16_t)(src[0] + (src[1]<<8)); src+=2; } if (cs->step_index < 0) cs->step_index = 0; if (cs->step_index > 88) cs->step_index = 88; m= (buf_size - (src - buf))>>st; for(i=0; i<m; i++) { *samples++ = adpcm_ima_expand_nibble(&c->status[0], src[i] & 0x0F, 4); if (st) *samples++ = adpcm_ima_expand_nibble(&c->status[1], src[i+m] & 0x0F, 4); *samples++ = adpcm_ima_expand_nibble(&c->status[0], src[i] >> 4, 4); if (st) *samples++ = adpcm_ima_expand_nibble(&c->status[1], src[i+m] >> 4, 4); } src += m<<st; break; case CODEC_ID_ADPCM_MS: if (avctx->block_align != 0 && buf_size > avctx->block_align) buf_size = avctx->block_align; n = buf_size - 7 * avctx->channels; if (n < 0) return -1; block_predictor[0] = av_clip(*src++, 0, 7); block_predictor[1] = 0; if (st) block_predictor[1] = av_clip(*src++, 0, 7); c->status[0].idelta = (int16_t)((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); src+=2; if (st){ c->status[1].idelta = (int16_t)((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); src+=2; } c->status[0].coeff1 = AdaptCoeff1[block_predictor[0]]; c->status[0].coeff2 = AdaptCoeff2[block_predictor[0]]; c->status[1].coeff1 = AdaptCoeff1[block_predictor[1]]; c->status[1].coeff2 = AdaptCoeff2[block_predictor[1]]; c->status[0].sample1 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); src+=2; if (st) c->status[1].sample1 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); if (st) src+=2; c->status[0].sample2 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); src+=2; if (st) c->status[1].sample2 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); if (st) src+=2; *samples++ = c->status[0].sample1; if (st) *samples++ = c->status[1].sample1; *samples++ = c->status[0].sample2; if (st) *samples++ = c->status[1].sample2; for(;n>0;n--) { *samples++ = adpcm_ms_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F); *samples++ = adpcm_ms_expand_nibble(&c->status[st], src[0] & 0x0F); src ++; } break; case CODEC_ID_ADPCM_IMA_DK4: if (avctx->block_align != 0 && buf_size > avctx->block_align) buf_size = avctx->block_align; c->status[0].predictor = (int16_t)(src[0] | (src[1] << 8)); c->status[0].step_index = src[2]; src += 4; *samples++ = c->status[0].predictor; if (st) { c->status[1].predictor = (int16_t)(src[0] | (src[1] << 8)); c->status[1].step_index = src[2]; src += 4; *samples++ = c->status[1].predictor; } while (src < buf + buf_size) { *samples++ = adpcm_ima_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F, 3); if (st) *samples++ = adpcm_ima_expand_nibble(&c->status[1], src[0] & 0x0F, 3); else *samples++ = adpcm_ima_expand_nibble(&c->status[0], src[0] & 0x0F, 3); src++; } break; case CODEC_ID_ADPCM_IMA_DK3: if (avctx->block_align != 0 && buf_size > avctx->block_align) buf_size = avctx->block_align; if(buf_size + 16 > (samples_end - samples)*3/8) return -1; c->status[0].predictor = (int16_t)(src[10] | (src[11] << 8)); c->status[1].predictor = (int16_t)(src[12] | (src[13] << 8)); c->status[0].step_index = src[14]; c->status[1].step_index = src[15]; src += 16; diff_channel = c->status[1].predictor; while (1) { DK3_GET_NEXT_NIBBLE(); adpcm_ima_expand_nibble(&c->status[0], nibble, 3); DK3_GET_NEXT_NIBBLE(); adpcm_ima_expand_nibble(&c->status[1], nibble, 3); diff_channel = (diff_channel + c->status[1].predictor) / 2; *samples++ = c->status[0].predictor + c->status[1].predictor; *samples++ = c->status[0].predictor - c->status[1].predictor; DK3_GET_NEXT_NIBBLE(); adpcm_ima_expand_nibble(&c->status[0], nibble, 3); diff_channel = (diff_channel + c->status[1].predictor) / 2; *samples++ = c->status[0].predictor + c->status[1].predictor; *samples++ = c->status[0].predictor - c->status[1].predictor; } break; case CODEC_ID_ADPCM_IMA_WS: while (src < buf + buf_size) { if (st) { *samples++ = adpcm_ima_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F, 3); *samples++ = adpcm_ima_expand_nibble(&c->status[1], src[0] & 0x0F, 3); } else { *samples++ = adpcm_ima_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F, 3); *samples++ = adpcm_ima_expand_nibble(&c->status[0], src[0] & 0x0F, 3); } src++; } break; case CODEC_ID_ADPCM_XA: c->status[0].sample1 = c->status[0].sample2 = c->status[1].sample1 = c->status[1].sample2 = 0; while (buf_size >= 128) { xa_decode(samples, src, &c->status[0], &c->status[1], avctx->channels); src += 128; samples += 28 * 8; buf_size -= 128; } break; case CODEC_ID_ADPCM_EA: samples_in_chunk = AV_RL32(src); if (samples_in_chunk >= ((buf_size - 12) * 2)) { src += buf_size; break; } src += 4; current_left_sample = (int16_t)AV_RL16(src); src += 2; previous_left_sample = (int16_t)AV_RL16(src); src += 2; current_right_sample = (int16_t)AV_RL16(src); src += 2; previous_right_sample = (int16_t)AV_RL16(src); src += 2; for (count1 = 0; count1 < samples_in_chunk/28;count1++) { coeff1l = ea_adpcm_table[(*src >> 4) & 0x0F]; coeff2l = ea_adpcm_table[((*src >> 4) & 0x0F) + 4]; coeff1r = ea_adpcm_table[*src & 0x0F]; coeff2r = ea_adpcm_table[(*src & 0x0F) + 4]; src++; shift_left = ((*src >> 4) & 0x0F) + 8; shift_right = (*src & 0x0F) + 8; src++; for (count2 = 0; count2 < 28; count2++) { next_left_sample = (((*src & 0xF0) << 24) >> shift_left); next_right_sample = (((*src & 0x0F) << 28) >> shift_right); src++; next_left_sample = (next_left_sample + (current_left_sample * coeff1l) + (previous_left_sample * coeff2l) + 0x80) >> 8; next_right_sample = (next_right_sample + (current_right_sample * coeff1r) + (previous_right_sample * coeff2r) + 0x80) >> 8; previous_left_sample = current_left_sample; current_left_sample = av_clip_int16(next_left_sample); previous_right_sample = current_right_sample; current_right_sample = av_clip_int16(next_right_sample); *samples++ = (unsigned short)current_left_sample; *samples++ = (unsigned short)current_right_sample; } } break; case CODEC_ID_ADPCM_IMA_AMV: case CODEC_ID_ADPCM_IMA_SMJPEG: c->status[0].predictor = *src; src += 2; c->status[0].step_index = *src++; src++; if (avctx->codec->id == CODEC_ID_ADPCM_IMA_AMV) src+=4; while (src < buf + buf_size) { char hi, lo; lo = *src & 0x0F; hi = (*src >> 4) & 0x0F; if (avctx->codec->id == CODEC_ID_ADPCM_IMA_AMV) FFSWAP(char, hi, lo); *samples++ = adpcm_ima_expand_nibble(&c->status[0], lo, 3); *samples++ = adpcm_ima_expand_nibble(&c->status[0], hi, 3); src++; } break; case CODEC_ID_ADPCM_CT: while (src < buf + buf_size) { if (st) { *samples++ = adpcm_ct_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F); *samples++ = adpcm_ct_expand_nibble(&c->status[1], src[0] & 0x0F); } else { *samples++ = adpcm_ct_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F); *samples++ = adpcm_ct_expand_nibble(&c->status[0], src[0] & 0x0F); } src++; } break; case CODEC_ID_ADPCM_SBPRO_4: case CODEC_ID_ADPCM_SBPRO_3: case CODEC_ID_ADPCM_SBPRO_2: if (!c->status[0].step_index) { *samples++ = 128 * (*src++ - 0x80); if (st) *samples++ = 128 * (*src++ - 0x80); c->status[0].step_index = 1; } if (avctx->codec->id == CODEC_ID_ADPCM_SBPRO_4) { while (src < buf + buf_size) { *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F, 4, 0); *samples++ = adpcm_sbpro_expand_nibble(&c->status[st], src[0] & 0x0F, 4, 0); src++; } } else if (avctx->codec->id == CODEC_ID_ADPCM_SBPRO_3) { while (src < buf + buf_size && samples + 2 < samples_end) { *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], (src[0] >> 5) & 0x07, 3, 0); *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], (src[0] >> 2) & 0x07, 3, 0); *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], src[0] & 0x03, 2, 0); src++; } } else { while (src < buf + buf_size && samples + 3 < samples_end) { *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], (src[0] >> 6) & 0x03, 2, 2); *samples++ = adpcm_sbpro_expand_nibble(&c->status[st], (src[0] >> 4) & 0x03, 2, 2); *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], (src[0] >> 2) & 0x03, 2, 2); *samples++ = adpcm_sbpro_expand_nibble(&c->status[st], src[0] & 0x03, 2, 2); src++; } } break; case CODEC_ID_ADPCM_SWF: { GetBitContext gb; const int *table; int k0, signmask, nb_bits, count; int size = buf_size*8; init_get_bits(&gb, buf, size); read bits & initial values nb_bits = get_bits(&gb, 2)+2; av_log(NULL,AV_LOG_INFO,"nb_bits: %d\n", nb_bits); table = swf_index_tables[nb_bits-2]; k0 = 1 << (nb_bits-2); signmask = 1 << (nb_bits-1); while (get_bits_count(&gb) <= size - 22*avctx->channels) { for (i = 0; i < avctx->channels; i++) { *samples++ = c->status[i].predictor = get_sbits(&gb, 16); c->status[i].step_index = get_bits(&gb, 6); } for (count = 0; get_bits_count(&gb) <= size - nb_bits*avctx->channels && count < 4095; count++) { int i; for (i = 0; i < avctx->channels; i++) { similar to IMA adpcm int delta = get_bits(&gb, nb_bits); int step = step_table[c->status[i].step_index]; long vpdiff = 0; vpdiff = (delta+0.5)*step/4 int k = k0; do { if (delta & k) vpdiff += step; step >>= 1; k >>= 1; } while(k); vpdiff += step; if (delta & signmask) c->status[i].predictor -= vpdiff; else c->status[i].predictor += vpdiff; c->status[i].step_index += table[delta & (~signmask)]; c->status[i].step_index = av_clip(c->status[i].step_index, 0, 88); c->status[i].predictor = av_clip_int16(c->status[i].predictor); *samples++ = c->status[i].predictor; if (samples >= samples_end) { av_log(avctx, AV_LOG_ERROR, "allocated output buffer is too small\n"); return -1; } } } } src += buf_size; break; } case CODEC_ID_ADPCM_YAMAHA: while (src < buf + buf_size) { if (st) { *samples++ = adpcm_yamaha_expand_nibble(&c->status[0], src[0] & 0x0F); *samples++ = adpcm_yamaha_expand_nibble(&c->status[1], (src[0] >> 4) & 0x0F); } else { *samples++ = adpcm_yamaha_expand_nibble(&c->status[0], src[0] & 0x0F); *samples++ = adpcm_yamaha_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F); } src++; } break; case CODEC_ID_ADPCM_THP: { int table[2][16]; unsigned int samplecnt; int prev[2][2]; int ch; if (buf_size < 80) { av_log(avctx, AV_LOG_ERROR, "frame too small\n"); return -1; } src+=4; samplecnt = bytestream_get_be32(&src); for (i = 0; i < 32; i++) table[0][i] = (int16_t)bytestream_get_be16(&src); for (i = 0; i < 4; i++) prev[0][i] = (int16_t)bytestream_get_be16(&src); if (samplecnt >= (samples_end - samples) / (st + 1)) { av_log(avctx, AV_LOG_ERROR, "allocated output buffer is too small\n"); return -1; } for (ch = 0; ch <= st; ch++) { samples = (unsigned short *) data + ch; for (i = 0; i < samplecnt / 14; i++) { int index = (*src >> 4) & 7; unsigned int exp = 28 - (*src++ & 15); int factor1 = table[ch][index * 2]; int factor2 = table[ch][index * 2 + 1]; for (n = 0; n < 14; n++) { int32_t sampledat; if(n&1) sampledat= *src++ <<28; else sampledat= (*src&0xF0)<<24; sampledat = ((prev[ch][0]*factor1 + prev[ch][1]*factor2) >> 11) + (sampledat>>exp); *samples = av_clip_int16(sampledat); prev[ch][1] = prev[ch][0]; prev[ch][0] = *samples++; samples += st; } } } samples -= st; break; } default: return -1; } *data_size = (uint8_t *)samples - (uint8_t *)data; return src - buf; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, uint8_t *VAR_3, int VAR_4) { ADPCMContext *c = VAR_0->priv_data; ADPCMChannelStatus *cs; int VAR_5, VAR_6, VAR_7, VAR_8; int VAR_9[2]; short *VAR_10; short *VAR_11; uint8_t *src; int VAR_12; unsigned char VAR_13 = 0; unsigned char VAR_14; int VAR_15 = 0; int VAR_16; uint32_t samples_in_chunk; int32_t previous_left_sample, previous_right_sample; int32_t current_left_sample, current_right_sample; int32_t next_left_sample, next_right_sample; int32_t coeff1l, coeff2l, coeff1r, coeff2r; uint8_t shift_left, shift_right; int VAR_17, VAR_18; if (!VAR_4) return 0; if(*VAR_2/4 < VAR_4 + 8) return -1; VAR_10 = VAR_1; VAR_11= VAR_10 + *VAR_2/2; *VAR_2= 0; src = VAR_3; VAR_12 = VAR_0->channels == 2 ? 1 : 0; switch(VAR_0->codec->id) { case CODEC_ID_ADPCM_IMA_QT: VAR_5 = (VAR_4 - 2); VAR_7 = c->VAR_7; cs = &(c->status[VAR_7]); cs->predictor = (*src++) << 8; cs->predictor |= (*src & 0x80); cs->predictor &= 0xFF80; if(cs->predictor & 0x8000) cs->predictor -= 0x10000; cs->predictor = av_clip_int16(cs->predictor); cs->step_index = (*src++) & 0x7F; if (cs->step_index > 88){ av_log(VAR_0, AV_LOG_ERROR, "ERROR: step_index = %VAR_8\VAR_5", cs->step_index); cs->step_index = 88; } cs->step = step_table[cs->step_index]; if (VAR_12 && VAR_7) VAR_10++; for(VAR_6=32; VAR_5>0 && VAR_6>0; VAR_5--, VAR_6--) { *VAR_10 = adpcm_ima_expand_nibble(cs, src[0] & 0x0F, 3); VAR_10 += VAR_0->channels; *VAR_10 = adpcm_ima_expand_nibble(cs, (src[0] >> 4) & 0x0F, 3); VAR_10 += VAR_0->channels; src ++; } if(VAR_12) { c->VAR_7 = (VAR_7 + 1) % 2; if(VAR_7 == 1) { return src - VAR_3; } } break; case CODEC_ID_ADPCM_IMA_WAV: if (VAR_0->block_align != 0 && VAR_4 > VAR_0->block_align) VAR_4 = VAR_0->block_align; samples_per_block= (block_align-4*chanels)*8 / (bits_per_sample * chanels) + 1; for(VAR_8=0; VAR_8<VAR_0->channels; VAR_8++){ cs = &(c->status[VAR_8]); cs->predictor = (int16_t)(src[0] + (src[1]<<8)); src+=2; XXX: is this correct ??: *VAR_10++ = cs->predictor; cs->step_index = *src++; if (cs->step_index > 88){ av_log(VAR_0, AV_LOG_ERROR, "ERROR: step_index = %VAR_8\VAR_5", cs->step_index); cs->step_index = 88; } if (*src++) av_log(VAR_0, AV_LOG_ERROR, "unused byte should be null but is %d!!\VAR_5", src[-1]); } while(src < VAR_3 + VAR_4){ for(VAR_6=0; VAR_6<4; VAR_6++){ for(VAR_8=0; VAR_8<=VAR_12; VAR_8++) *VAR_10++ = adpcm_ima_expand_nibble(&c->status[VAR_8], src[4*VAR_8] & 0x0F, 3); for(VAR_8=0; VAR_8<=VAR_12; VAR_8++) *VAR_10++ = adpcm_ima_expand_nibble(&c->status[VAR_8], src[4*VAR_8] >> 4 , 3); src++; } src += 4*VAR_12; } break; case CODEC_ID_ADPCM_4XM: cs = &(c->status[0]); c->status[0].predictor= (int16_t)(src[0] + (src[1]<<8)); src+=2; if(VAR_12){ c->status[1].predictor= (int16_t)(src[0] + (src[1]<<8)); src+=2; } c->status[0].step_index= (int16_t)(src[0] + (src[1]<<8)); src+=2; if(VAR_12){ c->status[1].step_index= (int16_t)(src[0] + (src[1]<<8)); src+=2; } if (cs->step_index < 0) cs->step_index = 0; if (cs->step_index > 88) cs->step_index = 88; VAR_6= (VAR_4 - (src - VAR_3))>>VAR_12; for(VAR_8=0; VAR_8<VAR_6; VAR_8++) { *VAR_10++ = adpcm_ima_expand_nibble(&c->status[0], src[VAR_8] & 0x0F, 4); if (VAR_12) *VAR_10++ = adpcm_ima_expand_nibble(&c->status[1], src[VAR_8+VAR_6] & 0x0F, 4); *VAR_10++ = adpcm_ima_expand_nibble(&c->status[0], src[VAR_8] >> 4, 4); if (VAR_12) *VAR_10++ = adpcm_ima_expand_nibble(&c->status[1], src[VAR_8+VAR_6] >> 4, 4); } src += VAR_6<<VAR_12; break; case CODEC_ID_ADPCM_MS: if (VAR_0->block_align != 0 && VAR_4 > VAR_0->block_align) VAR_4 = VAR_0->block_align; VAR_5 = VAR_4 - 7 * VAR_0->channels; if (VAR_5 < 0) return -1; VAR_9[0] = av_clip(*src++, 0, 7); VAR_9[1] = 0; if (VAR_12) VAR_9[1] = av_clip(*src++, 0, 7); c->status[0].idelta = (int16_t)((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); src+=2; if (VAR_12){ c->status[1].idelta = (int16_t)((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); src+=2; } c->status[0].coeff1 = AdaptCoeff1[VAR_9[0]]; c->status[0].coeff2 = AdaptCoeff2[VAR_9[0]]; c->status[1].coeff1 = AdaptCoeff1[VAR_9[1]]; c->status[1].coeff2 = AdaptCoeff2[VAR_9[1]]; c->status[0].sample1 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); src+=2; if (VAR_12) c->status[1].sample1 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); if (VAR_12) src+=2; c->status[0].sample2 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); src+=2; if (VAR_12) c->status[1].sample2 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); if (VAR_12) src+=2; *VAR_10++ = c->status[0].sample1; if (VAR_12) *VAR_10++ = c->status[1].sample1; *VAR_10++ = c->status[0].sample2; if (VAR_12) *VAR_10++ = c->status[1].sample2; for(;VAR_5>0;VAR_5--) { *VAR_10++ = adpcm_ms_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F); *VAR_10++ = adpcm_ms_expand_nibble(&c->status[VAR_12], src[0] & 0x0F); src ++; } break; case CODEC_ID_ADPCM_IMA_DK4: if (VAR_0->block_align != 0 && VAR_4 > VAR_0->block_align) VAR_4 = VAR_0->block_align; c->status[0].predictor = (int16_t)(src[0] | (src[1] << 8)); c->status[0].step_index = src[2]; src += 4; *VAR_10++ = c->status[0].predictor; if (VAR_12) { c->status[1].predictor = (int16_t)(src[0] | (src[1] << 8)); c->status[1].step_index = src[2]; src += 4; *VAR_10++ = c->status[1].predictor; } while (src < VAR_3 + VAR_4) { *VAR_10++ = adpcm_ima_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F, 3); if (VAR_12) *VAR_10++ = adpcm_ima_expand_nibble(&c->status[1], src[0] & 0x0F, 3); else *VAR_10++ = adpcm_ima_expand_nibble(&c->status[0], src[0] & 0x0F, 3); src++; } break; case CODEC_ID_ADPCM_IMA_DK3: if (VAR_0->block_align != 0 && VAR_4 > VAR_0->block_align) VAR_4 = VAR_0->block_align; if(VAR_4 + 16 > (VAR_11 - VAR_10)*3/8) return -1; c->status[0].predictor = (int16_t)(src[10] | (src[11] << 8)); c->status[1].predictor = (int16_t)(src[12] | (src[13] << 8)); c->status[0].step_index = src[14]; c->status[1].step_index = src[15]; src += 16; VAR_16 = c->status[1].predictor; while (1) { DK3_GET_NEXT_NIBBLE(); adpcm_ima_expand_nibble(&c->status[0], VAR_14, 3); DK3_GET_NEXT_NIBBLE(); adpcm_ima_expand_nibble(&c->status[1], VAR_14, 3); VAR_16 = (VAR_16 + c->status[1].predictor) / 2; *VAR_10++ = c->status[0].predictor + c->status[1].predictor; *VAR_10++ = c->status[0].predictor - c->status[1].predictor; DK3_GET_NEXT_NIBBLE(); adpcm_ima_expand_nibble(&c->status[0], VAR_14, 3); VAR_16 = (VAR_16 + c->status[1].predictor) / 2; *VAR_10++ = c->status[0].predictor + c->status[1].predictor; *VAR_10++ = c->status[0].predictor - c->status[1].predictor; } break; case CODEC_ID_ADPCM_IMA_WS: while (src < VAR_3 + VAR_4) { if (VAR_12) { *VAR_10++ = adpcm_ima_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F, 3); *VAR_10++ = adpcm_ima_expand_nibble(&c->status[1], src[0] & 0x0F, 3); } else { *VAR_10++ = adpcm_ima_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F, 3); *VAR_10++ = adpcm_ima_expand_nibble(&c->status[0], src[0] & 0x0F, 3); } src++; } break; case CODEC_ID_ADPCM_XA: c->status[0].sample1 = c->status[0].sample2 = c->status[1].sample1 = c->status[1].sample2 = 0; while (VAR_4 >= 128) { xa_decode(VAR_10, src, &c->status[0], &c->status[1], VAR_0->channels); src += 128; VAR_10 += 28 * 8; VAR_4 -= 128; } break; case CODEC_ID_ADPCM_EA: samples_in_chunk = AV_RL32(src); if (samples_in_chunk >= ((VAR_4 - 12) * 2)) { src += VAR_4; break; } src += 4; current_left_sample = (int16_t)AV_RL16(src); src += 2; previous_left_sample = (int16_t)AV_RL16(src); src += 2; current_right_sample = (int16_t)AV_RL16(src); src += 2; previous_right_sample = (int16_t)AV_RL16(src); src += 2; for (VAR_17 = 0; VAR_17 < samples_in_chunk/28;VAR_17++) { coeff1l = ea_adpcm_table[(*src >> 4) & 0x0F]; coeff2l = ea_adpcm_table[((*src >> 4) & 0x0F) + 4]; coeff1r = ea_adpcm_table[*src & 0x0F]; coeff2r = ea_adpcm_table[(*src & 0x0F) + 4]; src++; shift_left = ((*src >> 4) & 0x0F) + 8; shift_right = (*src & 0x0F) + 8; src++; for (VAR_18 = 0; VAR_18 < 28; VAR_18++) { next_left_sample = (((*src & 0xF0) << 24) >> shift_left); next_right_sample = (((*src & 0x0F) << 28) >> shift_right); src++; next_left_sample = (next_left_sample + (current_left_sample * coeff1l) + (previous_left_sample * coeff2l) + 0x80) >> 8; next_right_sample = (next_right_sample + (current_right_sample * coeff1r) + (previous_right_sample * coeff2r) + 0x80) >> 8; previous_left_sample = current_left_sample; current_left_sample = av_clip_int16(next_left_sample); previous_right_sample = current_right_sample; current_right_sample = av_clip_int16(next_right_sample); *VAR_10++ = (unsigned short)current_left_sample; *VAR_10++ = (unsigned short)current_right_sample; } } break; case CODEC_ID_ADPCM_IMA_AMV: case CODEC_ID_ADPCM_IMA_SMJPEG: c->status[0].predictor = *src; src += 2; c->status[0].step_index = *src++; src++; if (VAR_0->codec->id == CODEC_ID_ADPCM_IMA_AMV) src+=4; while (src < VAR_3 + VAR_4) { char VAR_19, VAR_20; VAR_20 = *src & 0x0F; VAR_19 = (*src >> 4) & 0x0F; if (VAR_0->codec->id == CODEC_ID_ADPCM_IMA_AMV) FFSWAP(char, VAR_19, VAR_20); *VAR_10++ = adpcm_ima_expand_nibble(&c->status[0], VAR_20, 3); *VAR_10++ = adpcm_ima_expand_nibble(&c->status[0], VAR_19, 3); src++; } break; case CODEC_ID_ADPCM_CT: while (src < VAR_3 + VAR_4) { if (VAR_12) { *VAR_10++ = adpcm_ct_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F); *VAR_10++ = adpcm_ct_expand_nibble(&c->status[1], src[0] & 0x0F); } else { *VAR_10++ = adpcm_ct_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F); *VAR_10++ = adpcm_ct_expand_nibble(&c->status[0], src[0] & 0x0F); } src++; } break; case CODEC_ID_ADPCM_SBPRO_4: case CODEC_ID_ADPCM_SBPRO_3: case CODEC_ID_ADPCM_SBPRO_2: if (!c->status[0].step_index) { *VAR_10++ = 128 * (*src++ - 0x80); if (VAR_12) *VAR_10++ = 128 * (*src++ - 0x80); c->status[0].step_index = 1; } if (VAR_0->codec->id == CODEC_ID_ADPCM_SBPRO_4) { while (src < VAR_3 + VAR_4) { *VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F, 4, 0); *VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[VAR_12], src[0] & 0x0F, 4, 0); src++; } } else if (VAR_0->codec->id == CODEC_ID_ADPCM_SBPRO_3) { while (src < VAR_3 + VAR_4 && VAR_10 + 2 < VAR_11) { *VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[0], (src[0] >> 5) & 0x07, 3, 0); *VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[0], (src[0] >> 2) & 0x07, 3, 0); *VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[0], src[0] & 0x03, 2, 0); src++; } } else { while (src < VAR_3 + VAR_4 && VAR_10 + 3 < VAR_11) { *VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[0], (src[0] >> 6) & 0x03, 2, 2); *VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[VAR_12], (src[0] >> 4) & 0x03, 2, 2); *VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[0], (src[0] >> 2) & 0x03, 2, 2); *VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[VAR_12], src[0] & 0x03, 2, 2); src++; } } break; case CODEC_ID_ADPCM_SWF: { GetBitContext gb; const int *VAR_27; int VAR_22, VAR_23, VAR_24, VAR_25; int VAR_26 = VAR_4*8; init_get_bits(&gb, VAR_3, VAR_26); read bits & initial values VAR_24 = get_bits(&gb, 2)+2; av_log(NULL,AV_LOG_INFO,"VAR_24: %d\VAR_5", VAR_24); VAR_27 = swf_index_tables[VAR_24-2]; VAR_22 = 1 << (VAR_24-2); VAR_23 = 1 << (VAR_24-1); while (get_bits_count(&gb) <= VAR_26 - 22*VAR_0->channels) { for (VAR_8 = 0; VAR_8 < VAR_0->channels; VAR_8++) { *VAR_10++ = c->status[VAR_8].predictor = get_sbits(&gb, 16); c->status[VAR_8].step_index = get_bits(&gb, 6); } for (VAR_25 = 0; get_bits_count(&gb) <= VAR_26 - VAR_24*VAR_0->channels && VAR_25 < 4095; VAR_25++) { int VAR_8; for (VAR_8 = 0; VAR_8 < VAR_0->channels; VAR_8++) { similar to IMA adpcm int delta = get_bits(&gb, VAR_24); int step = step_table[c->status[VAR_8].step_index]; long vpdiff = 0; vpdiff = (delta+0.5)*step/4 int k = VAR_22; do { if (delta & k) vpdiff += step; step >>= 1; k >>= 1; } while(k); vpdiff += step; if (delta & VAR_23) c->status[VAR_8].predictor -= vpdiff; else c->status[VAR_8].predictor += vpdiff; c->status[VAR_8].step_index += VAR_27[delta & (~VAR_23)]; c->status[VAR_8].step_index = av_clip(c->status[VAR_8].step_index, 0, 88); c->status[VAR_8].predictor = av_clip_int16(c->status[VAR_8].predictor); *VAR_10++ = c->status[VAR_8].predictor; if (VAR_10 >= VAR_11) { av_log(VAR_0, AV_LOG_ERROR, "allocated output buffer is too small\VAR_5"); return -1; } } } } src += VAR_4; break; } case CODEC_ID_ADPCM_YAMAHA: while (src < VAR_3 + VAR_4) { if (VAR_12) { *VAR_10++ = adpcm_yamaha_expand_nibble(&c->status[0], src[0] & 0x0F); *VAR_10++ = adpcm_yamaha_expand_nibble(&c->status[1], (src[0] >> 4) & 0x0F); } else { *VAR_10++ = adpcm_yamaha_expand_nibble(&c->status[0], src[0] & 0x0F); *VAR_10++ = adpcm_yamaha_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F); } src++; } break; case CODEC_ID_ADPCM_THP: { int VAR_27[2][16]; unsigned int VAR_27; int VAR_28[2][2]; int VAR_29; if (VAR_4 < 80) { av_log(VAR_0, AV_LOG_ERROR, "frame too small\VAR_5"); return -1; } src+=4; VAR_27 = bytestream_get_be32(&src); for (VAR_8 = 0; VAR_8 < 32; VAR_8++) VAR_27[0][VAR_8] = (int16_t)bytestream_get_be16(&src); for (VAR_8 = 0; VAR_8 < 4; VAR_8++) VAR_28[0][VAR_8] = (int16_t)bytestream_get_be16(&src); if (VAR_27 >= (VAR_11 - VAR_10) / (VAR_12 + 1)) { av_log(VAR_0, AV_LOG_ERROR, "allocated output buffer is too small\VAR_5"); return -1; } for (VAR_29 = 0; VAR_29 <= VAR_12; VAR_29++) { VAR_10 = (unsigned short *) VAR_1 + VAR_29; for (VAR_8 = 0; VAR_8 < VAR_27 / 14; VAR_8++) { int VAR_30 = (*src >> 4) & 7; unsigned int VAR_31 = 28 - (*src++ & 15); int VAR_32 = VAR_27[VAR_29][VAR_30 * 2]; int VAR_33 = VAR_27[VAR_29][VAR_30 * 2 + 1]; for (VAR_5 = 0; VAR_5 < 14; VAR_5++) { int32_t sampledat; if(VAR_5&1) sampledat= *src++ <<28; else sampledat= (*src&0xF0)<<24; sampledat = ((VAR_28[VAR_29][0]*VAR_32 + VAR_28[VAR_29][1]*VAR_33) >> 11) + (sampledat>>VAR_31); *VAR_10 = av_clip_int16(sampledat); VAR_28[VAR_29][1] = VAR_28[VAR_29][0]; VAR_28[VAR_29][0] = *VAR_10++; VAR_10 += VAR_12; } } } VAR_10 -= VAR_12; break; } default: return -1; } *VAR_2 = (uint8_t *)VAR_10 - (uint8_t *)VAR_1; return src - VAR_3; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nuint8_t *VAR_3, int VAR_4)\n{", "ADPCMContext *c = VAR_0->priv_data;", "ADPCMChannelStatus *cs;", "int VAR_5, VAR_6, VAR_7, VAR_8;", "int VAR_9[2];", "short *VAR_10;", "short *VAR_11;", "uint8_t *src;", "int VAR_12;", "unsigned char VAR_13 = 0;", "unsigned char VAR_14;", "int VAR_15 = 0;", "int VAR_16;", "uint32_t samples_in_chunk;", "int32_t previous_left_sample, previous_right_sample;", "int32_t current_left_sample, current_right_sample;", "int32_t next_left_sample, next_right_sample;", "int32_t coeff1l, coeff2l, coeff1r, coeff2r;", "uint8_t shift_left, shift_right;", "int VAR_17, VAR_18;", "if (!VAR_4)\nreturn 0;", "if(*VAR_2/4 < VAR_4 + 8)\nreturn -1;", "VAR_10 = VAR_1;", "VAR_11= VAR_10 + *VAR_2/2;", "*VAR_2= 0;", "src = VAR_3;", "VAR_12 = VAR_0->channels == 2 ? 1 : 0;", "switch(VAR_0->codec->id) {", "case CODEC_ID_ADPCM_IMA_QT:\nVAR_5 = (VAR_4 - 2);", "VAR_7 = c->VAR_7;", "cs = &(c->status[VAR_7]);", "cs->predictor = (*src++) << 8;", "cs->predictor |= (*src & 0x80);", "cs->predictor &= 0xFF80;", "if(cs->predictor & 0x8000)\ncs->predictor -= 0x10000;", "cs->predictor = av_clip_int16(cs->predictor);", "cs->step_index = (*src++) & 0x7F;", "if (cs->step_index > 88){", "av_log(VAR_0, AV_LOG_ERROR, \"ERROR: step_index = %VAR_8\\VAR_5\", cs->step_index);", "cs->step_index = 88;", "}", "cs->step = step_table[cs->step_index];", "if (VAR_12 && VAR_7)\nVAR_10++;", "for(VAR_6=32; VAR_5>0 && VAR_6>0; VAR_5--, VAR_6--) {", "*VAR_10 = adpcm_ima_expand_nibble(cs, src[0] & 0x0F, 3);", "VAR_10 += VAR_0->channels;", "*VAR_10 = adpcm_ima_expand_nibble(cs, (src[0] >> 4) & 0x0F, 3);", "VAR_10 += VAR_0->channels;", "src ++;", "}", "if(VAR_12) {", "c->VAR_7 = (VAR_7 + 1) % 2;", "if(VAR_7 == 1) {", "return src - VAR_3;", "}", "}", "break;", "case CODEC_ID_ADPCM_IMA_WAV:\nif (VAR_0->block_align != 0 && VAR_4 > VAR_0->block_align)\nVAR_4 = VAR_0->block_align;", "samples_per_block= (block_align-4*chanels)*8 / (bits_per_sample * chanels) + 1;", "for(VAR_8=0; VAR_8<VAR_0->channels; VAR_8++){", "cs = &(c->status[VAR_8]);", "cs->predictor = (int16_t)(src[0] + (src[1]<<8));", "src+=2;", "XXX: is this correct ??: *VAR_10++ = cs->predictor;", "cs->step_index = *src++;", "if (cs->step_index > 88){", "av_log(VAR_0, AV_LOG_ERROR, \"ERROR: step_index = %VAR_8\\VAR_5\", cs->step_index);", "cs->step_index = 88;", "}", "if (*src++) av_log(VAR_0, AV_LOG_ERROR, \"unused byte should be null but is %d!!\\VAR_5\", src[-1]);", "}", "while(src < VAR_3 + VAR_4){", "for(VAR_6=0; VAR_6<4; VAR_6++){", "for(VAR_8=0; VAR_8<=VAR_12; VAR_8++)", "*VAR_10++ = adpcm_ima_expand_nibble(&c->status[VAR_8], src[4*VAR_8] & 0x0F, 3);", "for(VAR_8=0; VAR_8<=VAR_12; VAR_8++)", "*VAR_10++ = adpcm_ima_expand_nibble(&c->status[VAR_8], src[4*VAR_8] >> 4 , 3);", "src++;", "}", "src += 4*VAR_12;", "}", "break;", "case CODEC_ID_ADPCM_4XM:\ncs = &(c->status[0]);", "c->status[0].predictor= (int16_t)(src[0] + (src[1]<<8)); src+=2;", "if(VAR_12){", "c->status[1].predictor= (int16_t)(src[0] + (src[1]<<8)); src+=2;", "}", "c->status[0].step_index= (int16_t)(src[0] + (src[1]<<8)); src+=2;", "if(VAR_12){", "c->status[1].step_index= (int16_t)(src[0] + (src[1]<<8)); src+=2;", "}", "if (cs->step_index < 0) cs->step_index = 0;", "if (cs->step_index > 88) cs->step_index = 88;", "VAR_6= (VAR_4 - (src - VAR_3))>>VAR_12;", "for(VAR_8=0; VAR_8<VAR_6; VAR_8++) {", "*VAR_10++ = adpcm_ima_expand_nibble(&c->status[0], src[VAR_8] & 0x0F, 4);", "if (VAR_12)\n*VAR_10++ = adpcm_ima_expand_nibble(&c->status[1], src[VAR_8+VAR_6] & 0x0F, 4);", "*VAR_10++ = adpcm_ima_expand_nibble(&c->status[0], src[VAR_8] >> 4, 4);", "if (VAR_12)\n*VAR_10++ = adpcm_ima_expand_nibble(&c->status[1], src[VAR_8+VAR_6] >> 4, 4);", "}", "src += VAR_6<<VAR_12;", "break;", "case CODEC_ID_ADPCM_MS:\nif (VAR_0->block_align != 0 && VAR_4 > VAR_0->block_align)\nVAR_4 = VAR_0->block_align;", "VAR_5 = VAR_4 - 7 * VAR_0->channels;", "if (VAR_5 < 0)\nreturn -1;", "VAR_9[0] = av_clip(*src++, 0, 7);", "VAR_9[1] = 0;", "if (VAR_12)\nVAR_9[1] = av_clip(*src++, 0, 7);", "c->status[0].idelta = (int16_t)((*src & 0xFF) | ((src[1] << 8) & 0xFF00));", "src+=2;", "if (VAR_12){", "c->status[1].idelta = (int16_t)((*src & 0xFF) | ((src[1] << 8) & 0xFF00));", "src+=2;", "}", "c->status[0].coeff1 = AdaptCoeff1[VAR_9[0]];", "c->status[0].coeff2 = AdaptCoeff2[VAR_9[0]];", "c->status[1].coeff1 = AdaptCoeff1[VAR_9[1]];", "c->status[1].coeff2 = AdaptCoeff2[VAR_9[1]];", "c->status[0].sample1 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00));", "src+=2;", "if (VAR_12) c->status[1].sample1 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00));", "if (VAR_12) src+=2;", "c->status[0].sample2 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00));", "src+=2;", "if (VAR_12) c->status[1].sample2 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00));", "if (VAR_12) src+=2;", "*VAR_10++ = c->status[0].sample1;", "if (VAR_12) *VAR_10++ = c->status[1].sample1;", "*VAR_10++ = c->status[0].sample2;", "if (VAR_12) *VAR_10++ = c->status[1].sample2;", "for(;VAR_5>0;VAR_5--) {", "*VAR_10++ = adpcm_ms_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F);", "*VAR_10++ = adpcm_ms_expand_nibble(&c->status[VAR_12], src[0] & 0x0F);", "src ++;", "}", "break;", "case CODEC_ID_ADPCM_IMA_DK4:\nif (VAR_0->block_align != 0 && VAR_4 > VAR_0->block_align)\nVAR_4 = VAR_0->block_align;", "c->status[0].predictor = (int16_t)(src[0] | (src[1] << 8));", "c->status[0].step_index = src[2];", "src += 4;", "*VAR_10++ = c->status[0].predictor;", "if (VAR_12) {", "c->status[1].predictor = (int16_t)(src[0] | (src[1] << 8));", "c->status[1].step_index = src[2];", "src += 4;", "*VAR_10++ = c->status[1].predictor;", "}", "while (src < VAR_3 + VAR_4) {", "*VAR_10++ = adpcm_ima_expand_nibble(&c->status[0],\n(src[0] >> 4) & 0x0F, 3);", "if (VAR_12)\n*VAR_10++ = adpcm_ima_expand_nibble(&c->status[1],\nsrc[0] & 0x0F, 3);", "else\n*VAR_10++ = adpcm_ima_expand_nibble(&c->status[0],\nsrc[0] & 0x0F, 3);", "src++;", "}", "break;", "case CODEC_ID_ADPCM_IMA_DK3:\nif (VAR_0->block_align != 0 && VAR_4 > VAR_0->block_align)\nVAR_4 = VAR_0->block_align;", "if(VAR_4 + 16 > (VAR_11 - VAR_10)*3/8)\nreturn -1;", "c->status[0].predictor = (int16_t)(src[10] | (src[11] << 8));", "c->status[1].predictor = (int16_t)(src[12] | (src[13] << 8));", "c->status[0].step_index = src[14];", "c->status[1].step_index = src[15];", "src += 16;", "VAR_16 = c->status[1].predictor;", "while (1) {", "DK3_GET_NEXT_NIBBLE();", "adpcm_ima_expand_nibble(&c->status[0], VAR_14, 3);", "DK3_GET_NEXT_NIBBLE();", "adpcm_ima_expand_nibble(&c->status[1], VAR_14, 3);", "VAR_16 = (VAR_16 + c->status[1].predictor) / 2;", "*VAR_10++ = c->status[0].predictor + c->status[1].predictor;", "*VAR_10++ = c->status[0].predictor - c->status[1].predictor;", "DK3_GET_NEXT_NIBBLE();", "adpcm_ima_expand_nibble(&c->status[0], VAR_14, 3);", "VAR_16 = (VAR_16 + c->status[1].predictor) / 2;", "*VAR_10++ = c->status[0].predictor + c->status[1].predictor;", "*VAR_10++ = c->status[0].predictor - c->status[1].predictor;", "}", "break;", "case CODEC_ID_ADPCM_IMA_WS:\nwhile (src < VAR_3 + VAR_4) {", "if (VAR_12) {", "*VAR_10++ = adpcm_ima_expand_nibble(&c->status[0],\n(src[0] >> 4) & 0x0F, 3);", "*VAR_10++ = adpcm_ima_expand_nibble(&c->status[1],\nsrc[0] & 0x0F, 3);", "} else {", "*VAR_10++ = adpcm_ima_expand_nibble(&c->status[0],\n(src[0] >> 4) & 0x0F, 3);", "*VAR_10++ = adpcm_ima_expand_nibble(&c->status[0],\nsrc[0] & 0x0F, 3);", "}", "src++;", "}", "break;", "case CODEC_ID_ADPCM_XA:\nc->status[0].sample1 = c->status[0].sample2 =\nc->status[1].sample1 = c->status[1].sample2 = 0;", "while (VAR_4 >= 128) {", "xa_decode(VAR_10, src, &c->status[0], &c->status[1],\nVAR_0->channels);", "src += 128;", "VAR_10 += 28 * 8;", "VAR_4 -= 128;", "}", "break;", "case CODEC_ID_ADPCM_EA:\nsamples_in_chunk = AV_RL32(src);", "if (samples_in_chunk >= ((VAR_4 - 12) * 2)) {", "src += VAR_4;", "break;", "}", "src += 4;", "current_left_sample = (int16_t)AV_RL16(src);", "src += 2;", "previous_left_sample = (int16_t)AV_RL16(src);", "src += 2;", "current_right_sample = (int16_t)AV_RL16(src);", "src += 2;", "previous_right_sample = (int16_t)AV_RL16(src);", "src += 2;", "for (VAR_17 = 0; VAR_17 < samples_in_chunk/28;VAR_17++) {", "coeff1l = ea_adpcm_table[(*src >> 4) & 0x0F];", "coeff2l = ea_adpcm_table[((*src >> 4) & 0x0F) + 4];", "coeff1r = ea_adpcm_table[*src & 0x0F];", "coeff2r = ea_adpcm_table[(*src & 0x0F) + 4];", "src++;", "shift_left = ((*src >> 4) & 0x0F) + 8;", "shift_right = (*src & 0x0F) + 8;", "src++;", "for (VAR_18 = 0; VAR_18 < 28; VAR_18++) {", "next_left_sample = (((*src & 0xF0) << 24) >> shift_left);", "next_right_sample = (((*src & 0x0F) << 28) >> shift_right);", "src++;", "next_left_sample = (next_left_sample +\n(current_left_sample * coeff1l) +\n(previous_left_sample * coeff2l) + 0x80) >> 8;", "next_right_sample = (next_right_sample +\n(current_right_sample * coeff1r) +\n(previous_right_sample * coeff2r) + 0x80) >> 8;", "previous_left_sample = current_left_sample;", "current_left_sample = av_clip_int16(next_left_sample);", "previous_right_sample = current_right_sample;", "current_right_sample = av_clip_int16(next_right_sample);", "*VAR_10++ = (unsigned short)current_left_sample;", "*VAR_10++ = (unsigned short)current_right_sample;", "}", "}", "break;", "case CODEC_ID_ADPCM_IMA_AMV:\ncase CODEC_ID_ADPCM_IMA_SMJPEG:\nc->status[0].predictor = *src;", "src += 2;", "c->status[0].step_index = *src++;", "src++;", "if (VAR_0->codec->id == CODEC_ID_ADPCM_IMA_AMV)\nsrc+=4;", "while (src < VAR_3 + VAR_4) {", "char VAR_19, VAR_20;", "VAR_20 = *src & 0x0F;", "VAR_19 = (*src >> 4) & 0x0F;", "if (VAR_0->codec->id == CODEC_ID_ADPCM_IMA_AMV)\nFFSWAP(char, VAR_19, VAR_20);", "*VAR_10++ = adpcm_ima_expand_nibble(&c->status[0],\nVAR_20, 3);", "*VAR_10++ = adpcm_ima_expand_nibble(&c->status[0],\nVAR_19, 3);", "src++;", "}", "break;", "case CODEC_ID_ADPCM_CT:\nwhile (src < VAR_3 + VAR_4) {", "if (VAR_12) {", "*VAR_10++ = adpcm_ct_expand_nibble(&c->status[0],\n(src[0] >> 4) & 0x0F);", "*VAR_10++ = adpcm_ct_expand_nibble(&c->status[1],\nsrc[0] & 0x0F);", "} else {", "*VAR_10++ = adpcm_ct_expand_nibble(&c->status[0],\n(src[0] >> 4) & 0x0F);", "*VAR_10++ = adpcm_ct_expand_nibble(&c->status[0],\nsrc[0] & 0x0F);", "}", "src++;", "}", "break;", "case CODEC_ID_ADPCM_SBPRO_4:\ncase CODEC_ID_ADPCM_SBPRO_3:\ncase CODEC_ID_ADPCM_SBPRO_2:\nif (!c->status[0].step_index) {", "*VAR_10++ = 128 * (*src++ - 0x80);", "if (VAR_12)\n*VAR_10++ = 128 * (*src++ - 0x80);", "c->status[0].step_index = 1;", "}", "if (VAR_0->codec->id == CODEC_ID_ADPCM_SBPRO_4) {", "while (src < VAR_3 + VAR_4) {", "*VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[0],\n(src[0] >> 4) & 0x0F, 4, 0);", "*VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[VAR_12],\nsrc[0] & 0x0F, 4, 0);", "src++;", "}", "} else if (VAR_0->codec->id == CODEC_ID_ADPCM_SBPRO_3) {", "while (src < VAR_3 + VAR_4 && VAR_10 + 2 < VAR_11) {", "*VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[0],\n(src[0] >> 5) & 0x07, 3, 0);", "*VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[0],\n(src[0] >> 2) & 0x07, 3, 0);", "*VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[0],\nsrc[0] & 0x03, 2, 0);", "src++;", "}", "} else {", "while (src < VAR_3 + VAR_4 && VAR_10 + 3 < VAR_11) {", "*VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[0],\n(src[0] >> 6) & 0x03, 2, 2);", "*VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[VAR_12],\n(src[0] >> 4) & 0x03, 2, 2);", "*VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[0],\n(src[0] >> 2) & 0x03, 2, 2);", "*VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[VAR_12],\nsrc[0] & 0x03, 2, 2);", "src++;", "}", "}", "break;", "case CODEC_ID_ADPCM_SWF:\n{", "GetBitContext gb;", "const int *VAR_27;", "int VAR_22, VAR_23, VAR_24, VAR_25;", "int VAR_26 = VAR_4*8;", "init_get_bits(&gb, VAR_3, VAR_26);", "read bits & initial values\nVAR_24 = get_bits(&gb, 2)+2;", "av_log(NULL,AV_LOG_INFO,\"VAR_24: %d\\VAR_5\", VAR_24);", "VAR_27 = swf_index_tables[VAR_24-2];", "VAR_22 = 1 << (VAR_24-2);", "VAR_23 = 1 << (VAR_24-1);", "while (get_bits_count(&gb) <= VAR_26 - 22*VAR_0->channels) {", "for (VAR_8 = 0; VAR_8 < VAR_0->channels; VAR_8++) {", "*VAR_10++ = c->status[VAR_8].predictor = get_sbits(&gb, 16);", "c->status[VAR_8].step_index = get_bits(&gb, 6);", "}", "for (VAR_25 = 0; get_bits_count(&gb) <= VAR_26 - VAR_24*VAR_0->channels && VAR_25 < 4095; VAR_25++) {", "int VAR_8;", "for (VAR_8 = 0; VAR_8 < VAR_0->channels; VAR_8++) {", "similar to IMA adpcm\nint delta = get_bits(&gb, VAR_24);", "int step = step_table[c->status[VAR_8].step_index];", "long vpdiff = 0; vpdiff = (delta+0.5)*step/4", "int k = VAR_22;", "do {", "if (delta & k)\nvpdiff += step;", "step >>= 1;", "k >>= 1;", "} while(k);", "vpdiff += step;", "if (delta & VAR_23)\nc->status[VAR_8].predictor -= vpdiff;", "else\nc->status[VAR_8].predictor += vpdiff;", "c->status[VAR_8].step_index += VAR_27[delta & (~VAR_23)];", "c->status[VAR_8].step_index = av_clip(c->status[VAR_8].step_index, 0, 88);", "c->status[VAR_8].predictor = av_clip_int16(c->status[VAR_8].predictor);", "*VAR_10++ = c->status[VAR_8].predictor;", "if (VAR_10 >= VAR_11) {", "av_log(VAR_0, AV_LOG_ERROR, \"allocated output buffer is too small\\VAR_5\");", "return -1;", "}", "}", "}", "}", "src += VAR_4;", "break;", "}", "case CODEC_ID_ADPCM_YAMAHA:\nwhile (src < VAR_3 + VAR_4) {", "if (VAR_12) {", "*VAR_10++ = adpcm_yamaha_expand_nibble(&c->status[0],\nsrc[0] & 0x0F);", "*VAR_10++ = adpcm_yamaha_expand_nibble(&c->status[1],\n(src[0] >> 4) & 0x0F);", "} else {", "*VAR_10++ = adpcm_yamaha_expand_nibble(&c->status[0],\nsrc[0] & 0x0F);", "*VAR_10++ = adpcm_yamaha_expand_nibble(&c->status[0],\n(src[0] >> 4) & 0x0F);", "}", "src++;", "}", "break;", "case CODEC_ID_ADPCM_THP:\n{", "int VAR_27[2][16];", "unsigned int VAR_27;", "int VAR_28[2][2];", "int VAR_29;", "if (VAR_4 < 80) {", "av_log(VAR_0, AV_LOG_ERROR, \"frame too small\\VAR_5\");", "return -1;", "}", "src+=4;", "VAR_27 = bytestream_get_be32(&src);", "for (VAR_8 = 0; VAR_8 < 32; VAR_8++)", "VAR_27[0][VAR_8] = (int16_t)bytestream_get_be16(&src);", "for (VAR_8 = 0; VAR_8 < 4; VAR_8++)", "VAR_28[0][VAR_8] = (int16_t)bytestream_get_be16(&src);", "if (VAR_27 >= (VAR_11 - VAR_10) / (VAR_12 + 1)) {", "av_log(VAR_0, AV_LOG_ERROR, \"allocated output buffer is too small\\VAR_5\");", "return -1;", "}", "for (VAR_29 = 0; VAR_29 <= VAR_12; VAR_29++) {", "VAR_10 = (unsigned short *) VAR_1 + VAR_29;", "for (VAR_8 = 0; VAR_8 < VAR_27 / 14; VAR_8++) {", "int VAR_30 = (*src >> 4) & 7;", "unsigned int VAR_31 = 28 - (*src++ & 15);", "int VAR_32 = VAR_27[VAR_29][VAR_30 * 2];", "int VAR_33 = VAR_27[VAR_29][VAR_30 * 2 + 1];", "for (VAR_5 = 0; VAR_5 < 14; VAR_5++) {", "int32_t sampledat;", "if(VAR_5&1) sampledat= *src++ <<28;", "else sampledat= (*src&0xF0)<<24;", "sampledat = ((VAR_28[VAR_29][0]*VAR_32\n+ VAR_28[VAR_29][1]*VAR_33) >> 11) + (sampledat>>VAR_31);", "*VAR_10 = av_clip_int16(sampledat);", "VAR_28[VAR_29][1] = VAR_28[VAR_29][0];", "VAR_28[VAR_29][0] = *VAR_10++;", "VAR_10 += VAR_12;", "}", "}", "}", "VAR_10 -= VAR_12;", "break;", "}", "default:\nreturn -1;", "}", "*VAR_2 = (uint8_t *)VAR_10 - (uint8_t *)VAR_1;", "return src - VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57, 59 ], [ 69, 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 105 ], [ 107 ], [ 109 ], [ 115, 117 ], [ 121 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 143, 145 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179, 181, 183 ], [ 187 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 201 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243, 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 269 ], [ 271 ], [ 273 ], [ 275, 277 ], [ 279 ], [ 281, 283 ], [ 285 ], [ 289 ], [ 293 ], [ 295, 297, 299 ], [ 301 ], [ 303, 305 ], [ 307 ], [ 309 ], [ 311, 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375, 377, 379 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 399 ], [ 401 ], [ 403 ], [ 409, 411 ], [ 419, 421, 423 ], [ 425, 427, 429 ], [ 433 ], [ 435 ], [ 437 ], [ 439, 441, 443 ], [ 447, 449 ], [ 453 ], [ 455 ], [ 457 ], [ 459 ], [ 463 ], [ 465 ], [ 473 ], [ 485 ], [ 487 ], [ 493 ], [ 495 ], [ 501 ], [ 503 ], [ 505 ], [ 511 ], [ 513 ], [ 519 ], [ 521 ], [ 523 ], [ 525 ], [ 527 ], [ 529, 533 ], [ 537 ], [ 539, 541 ], [ 543, 545 ], [ 547 ], [ 549, 551 ], [ 553, 555 ], [ 557 ], [ 561 ], [ 563 ], [ 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 ], [ 621 ], [ 623 ], [ 625 ], [ 627 ], [ 629 ], [ 631 ], [ 635 ], [ 637 ], [ 639 ], [ 643 ], [ 645 ], [ 647 ], [ 649 ], [ 653, 655, 657 ], [ 659, 661, 663 ], [ 667 ], [ 669 ], [ 671 ], [ 673 ], [ 675 ], [ 677 ], [ 679 ], [ 681 ], [ 683 ], [ 685, 687, 689 ], [ 691 ], [ 693 ], [ 695 ], [ 699, 701 ], [ 705 ], [ 707 ], [ 709 ], [ 711 ], [ 715, 717 ], [ 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 ], [ 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 ], [ 855 ], [ 857 ], [ 859 ], [ 861 ], [ 865 ], [ 869, 871 ], [ 873 ], [ 875 ], [ 877 ], [ 879 ], [ 883 ], [ 885 ], [ 887 ], [ 889 ], [ 891 ], [ 895 ], [ 897 ], [ 901 ], [ 903, 905 ], [ 907 ], [ 909 ], [ 911 ], [ 915 ], [ 917, 919 ], [ 921 ], [ 923 ], [ 925 ], [ 927 ], [ 931, 933 ], [ 935, 937 ], [ 941 ], [ 945 ], [ 947 ], [ 951 ], [ 953 ], [ 955 ], [ 957 ], [ 959 ], [ 961 ], [ 963 ], [ 965 ], [ 967 ], [ 969 ], [ 971 ], [ 973, 975 ], [ 977 ], [ 979, 981 ], [ 983, 985 ], [ 987 ], [ 989, 991 ], [ 993, 995 ], [ 997 ], [ 999 ], [ 1001 ], [ 1003 ], [ 1005, 1007 ], [ 1009 ], [ 1011 ], [ 1013 ], [ 1015 ], [ 1019 ], [ 1021 ], [ 1023 ], [ 1025 ], [ 1029 ], [ 1031 ], [ 1035 ], [ 1037 ], [ 1043 ], [ 1045 ], [ 1049 ], [ 1051 ], [ 1053 ], [ 1055 ], [ 1059 ], [ 1061 ], [ 1067 ], [ 1069 ], [ 1071 ], [ 1073 ], [ 1075 ], [ 1081 ], [ 1083 ], [ 1085 ], [ 1087 ], [ 1091, 1093 ], [ 1095 ], [ 1097 ], [ 1099 ], [ 1107 ], [ 1109 ], [ 1111 ], [ 1113 ], [ 1121 ], [ 1123 ], [ 1125 ], [ 1129, 1131 ], [ 1133 ], [ 1135 ], [ 1137 ], [ 1139 ] ]
21,758
static void ff_h264_idct_add16intra_sse2(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){ int i; for(i=0; i<16; i+=2){ if(nnzc[ scan8[i+0] ]|nnzc[ scan8[i+1] ]) ff_x264_add8x4_idct_sse2 (dst + block_offset[i], block + i*16, stride); else if(block[i*16]|block[i*16+16]) ff_h264_idct_dc_add8_mmx2(dst + block_offset[i], block + i*16, stride); } }
false
FFmpeg
1d16a1cf99488f16492b1bb48e023f4da8377e07
static void ff_h264_idct_add16intra_sse2(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){ int i; for(i=0; i<16; i+=2){ if(nnzc[ scan8[i+0] ]|nnzc[ scan8[i+1] ]) ff_x264_add8x4_idct_sse2 (dst + block_offset[i], block + i*16, stride); else if(block[i*16]|block[i*16+16]) ff_h264_idct_dc_add8_mmx2(dst + block_offset[i], block + i*16, stride); } }
{ "code": [], "line_no": [] }
static void FUNC_0(uint8_t *VAR_0, const int *VAR_1, DCTELEM *VAR_2, int VAR_3, const uint8_t VAR_4[6*8]){ int VAR_5; for(VAR_5=0; VAR_5<16; VAR_5+=2){ if(VAR_4[ scan8[VAR_5+0] ]|VAR_4[ scan8[VAR_5+1] ]) ff_x264_add8x4_idct_sse2 (VAR_0 + VAR_1[VAR_5], VAR_2 + VAR_5*16, VAR_3); else if(VAR_2[VAR_5*16]|VAR_2[VAR_5*16+16]) ff_h264_idct_dc_add8_mmx2(VAR_0 + VAR_1[VAR_5], VAR_2 + VAR_5*16, VAR_3); } }
[ "static void FUNC_0(uint8_t *VAR_0, const int *VAR_1, DCTELEM *VAR_2, int VAR_3, const uint8_t VAR_4[6*8]){", "int VAR_5;", "for(VAR_5=0; VAR_5<16; VAR_5+=2){", "if(VAR_4[ scan8[VAR_5+0] ]|VAR_4[ scan8[VAR_5+1] ])\nff_x264_add8x4_idct_sse2 (VAR_0 + VAR_1[VAR_5], VAR_2 + VAR_5*16, VAR_3);", "else if(VAR_2[VAR_5*16]|VAR_2[VAR_5*16+16])\nff_h264_idct_dc_add8_mmx2(VAR_0 + VAR_1[VAR_5], VAR_2 + VAR_5*16, VAR_3);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7, 9 ], [ 11, 13 ], [ 15 ], [ 17 ] ]
21,759
int swr_init(SwrContext *s){ s->in_buffer_index= 0; s->in_buffer_count= 0; s->resample_in_constraint= 0; free_temp(&s->postin); free_temp(&s->midbuf); free_temp(&s->preout); free_temp(&s->in_buffer); swr_audio_convert_free(&s-> in_convert); swr_audio_convert_free(&s->out_convert); s-> in.planar= s-> in_sample_fmt >= 0x100; s->out.planar= s->out_sample_fmt >= 0x100; s-> in_sample_fmt &= 0xFF; s->out_sample_fmt &= 0xFF; //We assume AVOptions checked the various values and the defaults where allowed if( s->int_sample_fmt != AV_SAMPLE_FMT_S16 &&s->int_sample_fmt != AV_SAMPLE_FMT_FLT){ av_log(s, AV_LOG_ERROR, "Requested sample format %s is not supported internally, only float & S16 is supported\n", av_get_sample_fmt_name(s->int_sample_fmt)); return AVERROR(EINVAL); } //FIXME should we allow/support using FLT on material that doesnt need it ? if(s->in_sample_fmt <= AV_SAMPLE_FMT_S16 || s->int_sample_fmt==AV_SAMPLE_FMT_S16){ s->int_sample_fmt= AV_SAMPLE_FMT_S16; }else s->int_sample_fmt= AV_SAMPLE_FMT_FLT; if (s->out_sample_rate!=s->in_sample_rate || (s->flags & SWR_FLAG_RESAMPLE)){ s->resample = swr_resample_init(s->resample, s->out_sample_rate, s->in_sample_rate, 16, 10, 0, 0.8); }else swr_resample_free(&s->resample); if(s->int_sample_fmt != AV_SAMPLE_FMT_S16 && s->resample){ av_log(s, AV_LOG_ERROR, "Resampling only supported with internal s16 currently\n"); //FIXME return -1; } if(!s-> in_ch_layout) s-> in_ch_layout= guess_layout(s->in.ch_count); if(!s->out_ch_layout) s->out_ch_layout= guess_layout(s->out.ch_count); s->rematrix= s->out_ch_layout !=s->in_ch_layout; #define RSC 1 //FIXME finetune if(!s-> in.ch_count) s-> in.ch_count= av_get_channel_layout_nb_channels(s-> in_ch_layout); if(!s->out.ch_count) s->out.ch_count= av_get_channel_layout_nb_channels(s->out_ch_layout); av_assert0(s-> in.ch_count); av_assert0(s->out.ch_count); s->resample_first= RSC*s->out.ch_count/s->in.ch_count - RSC < s->out_sample_rate/(float)s-> in_sample_rate - 1.0; s-> in.bps= av_get_bits_per_sample_fmt(s-> in_sample_fmt)/8; s->int_bps= av_get_bits_per_sample_fmt(s->int_sample_fmt)/8; s->out.bps= av_get_bits_per_sample_fmt(s->out_sample_fmt)/8; s->in_convert = swr_audio_convert_alloc(s->int_sample_fmt, s-> in_sample_fmt, s-> in.ch_count, 0); s->out_convert= swr_audio_convert_alloc(s->out_sample_fmt, s->int_sample_fmt, s->out.ch_count, 0); s->postin= s->in; s->preout= s->out; s->midbuf= s->in; s->in_buffer= s->in; if(!s->resample_first){ s->midbuf.ch_count= s->out.ch_count; s->in_buffer.ch_count = s->out.ch_count; } s->in_buffer.bps = s->postin.bps = s->midbuf.bps = s->preout.bps = s->int_bps; s->in_buffer.planar = s->postin.planar = s->midbuf.planar = s->preout.planar = 1; if(s->rematrix && swr_rematrix_init(s)<0) return -1; return 0; }
false
FFmpeg
834b3760a7ca112573e813bd6c3573a8c0daf4ed
int swr_init(SwrContext *s){ s->in_buffer_index= 0; s->in_buffer_count= 0; s->resample_in_constraint= 0; free_temp(&s->postin); free_temp(&s->midbuf); free_temp(&s->preout); free_temp(&s->in_buffer); swr_audio_convert_free(&s-> in_convert); swr_audio_convert_free(&s->out_convert); s-> in.planar= s-> in_sample_fmt >= 0x100; s->out.planar= s->out_sample_fmt >= 0x100; s-> in_sample_fmt &= 0xFF; s->out_sample_fmt &= 0xFF; if( s->int_sample_fmt != AV_SAMPLE_FMT_S16 &&s->int_sample_fmt != AV_SAMPLE_FMT_FLT){ av_log(s, AV_LOG_ERROR, "Requested sample format %s is not supported internally, only float & S16 is supported\n", av_get_sample_fmt_name(s->int_sample_fmt)); return AVERROR(EINVAL); } if(s->in_sample_fmt <= AV_SAMPLE_FMT_S16 || s->int_sample_fmt==AV_SAMPLE_FMT_S16){ s->int_sample_fmt= AV_SAMPLE_FMT_S16; }else s->int_sample_fmt= AV_SAMPLE_FMT_FLT; if (s->out_sample_rate!=s->in_sample_rate || (s->flags & SWR_FLAG_RESAMPLE)){ s->resample = swr_resample_init(s->resample, s->out_sample_rate, s->in_sample_rate, 16, 10, 0, 0.8); }else swr_resample_free(&s->resample); if(s->int_sample_fmt != AV_SAMPLE_FMT_S16 && s->resample){ av_log(s, AV_LOG_ERROR, "Resampling only supported with internal s16 currently\n"); return -1; } if(!s-> in_ch_layout) s-> in_ch_layout= guess_layout(s->in.ch_count); if(!s->out_ch_layout) s->out_ch_layout= guess_layout(s->out.ch_count); s->rematrix= s->out_ch_layout !=s->in_ch_layout; #define RSC 1 finetune if(!s-> in.ch_count) s-> in.ch_count= av_get_channel_layout_nb_channels(s-> in_ch_layout); if(!s->out.ch_count) s->out.ch_count= av_get_channel_layout_nb_channels(s->out_ch_layout); av_assert0(s-> in.ch_count); av_assert0(s->out.ch_count); s->resample_first= RSC*s->out.ch_count/s->in.ch_count - RSC < s->out_sample_rate/(float)s-> in_sample_rate - 1.0; s-> in.bps= av_get_bits_per_sample_fmt(s-> in_sample_fmt)/8; s->int_bps= av_get_bits_per_sample_fmt(s->int_sample_fmt)/8; s->out.bps= av_get_bits_per_sample_fmt(s->out_sample_fmt)/8; s->in_convert = swr_audio_convert_alloc(s->int_sample_fmt, s-> in_sample_fmt, s-> in.ch_count, 0); s->out_convert= swr_audio_convert_alloc(s->out_sample_fmt, s->int_sample_fmt, s->out.ch_count, 0); s->postin= s->in; s->preout= s->out; s->midbuf= s->in; s->in_buffer= s->in; if(!s->resample_first){ s->midbuf.ch_count= s->out.ch_count; s->in_buffer.ch_count = s->out.ch_count; } s->in_buffer.bps = s->postin.bps = s->midbuf.bps = s->preout.bps = s->int_bps; s->in_buffer.planar = s->postin.planar = s->midbuf.planar = s->preout.planar = 1; if(s->rematrix && swr_rematrix_init(s)<0) return -1; return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(SwrContext *VAR_0){ VAR_0->in_buffer_index= 0; VAR_0->in_buffer_count= 0; VAR_0->resample_in_constraint= 0; free_temp(&VAR_0->postin); free_temp(&VAR_0->midbuf); free_temp(&VAR_0->preout); free_temp(&VAR_0->in_buffer); swr_audio_convert_free(&VAR_0-> in_convert); swr_audio_convert_free(&VAR_0->out_convert); VAR_0-> in.planar= VAR_0-> in_sample_fmt >= 0x100; VAR_0->out.planar= VAR_0->out_sample_fmt >= 0x100; VAR_0-> in_sample_fmt &= 0xFF; VAR_0->out_sample_fmt &= 0xFF; if( VAR_0->int_sample_fmt != AV_SAMPLE_FMT_S16 &&VAR_0->int_sample_fmt != AV_SAMPLE_FMT_FLT){ av_log(VAR_0, AV_LOG_ERROR, "Requested sample format %VAR_0 is not supported internally, only float & S16 is supported\n", av_get_sample_fmt_name(VAR_0->int_sample_fmt)); return AVERROR(EINVAL); } if(VAR_0->in_sample_fmt <= AV_SAMPLE_FMT_S16 || VAR_0->int_sample_fmt==AV_SAMPLE_FMT_S16){ VAR_0->int_sample_fmt= AV_SAMPLE_FMT_S16; }else VAR_0->int_sample_fmt= AV_SAMPLE_FMT_FLT; if (VAR_0->out_sample_rate!=VAR_0->in_sample_rate || (VAR_0->flags & SWR_FLAG_RESAMPLE)){ VAR_0->resample = swr_resample_init(VAR_0->resample, VAR_0->out_sample_rate, VAR_0->in_sample_rate, 16, 10, 0, 0.8); }else swr_resample_free(&VAR_0->resample); if(VAR_0->int_sample_fmt != AV_SAMPLE_FMT_S16 && VAR_0->resample){ av_log(VAR_0, AV_LOG_ERROR, "Resampling only supported with internal s16 currently\n"); return -1; } if(!VAR_0-> in_ch_layout) VAR_0-> in_ch_layout= guess_layout(VAR_0->in.ch_count); if(!VAR_0->out_ch_layout) VAR_0->out_ch_layout= guess_layout(VAR_0->out.ch_count); VAR_0->rematrix= VAR_0->out_ch_layout !=VAR_0->in_ch_layout; #define RSC 1 finetune if(!VAR_0-> in.ch_count) VAR_0-> in.ch_count= av_get_channel_layout_nb_channels(VAR_0-> in_ch_layout); if(!VAR_0->out.ch_count) VAR_0->out.ch_count= av_get_channel_layout_nb_channels(VAR_0->out_ch_layout); av_assert0(VAR_0-> in.ch_count); av_assert0(VAR_0->out.ch_count); VAR_0->resample_first= RSC*VAR_0->out.ch_count/VAR_0->in.ch_count - RSC < VAR_0->out_sample_rate/(float)VAR_0-> in_sample_rate - 1.0; VAR_0-> in.bps= av_get_bits_per_sample_fmt(VAR_0-> in_sample_fmt)/8; VAR_0->int_bps= av_get_bits_per_sample_fmt(VAR_0->int_sample_fmt)/8; VAR_0->out.bps= av_get_bits_per_sample_fmt(VAR_0->out_sample_fmt)/8; VAR_0->in_convert = swr_audio_convert_alloc(VAR_0->int_sample_fmt, VAR_0-> in_sample_fmt, VAR_0-> in.ch_count, 0); VAR_0->out_convert= swr_audio_convert_alloc(VAR_0->out_sample_fmt, VAR_0->int_sample_fmt, VAR_0->out.ch_count, 0); VAR_0->postin= VAR_0->in; VAR_0->preout= VAR_0->out; VAR_0->midbuf= VAR_0->in; VAR_0->in_buffer= VAR_0->in; if(!VAR_0->resample_first){ VAR_0->midbuf.ch_count= VAR_0->out.ch_count; VAR_0->in_buffer.ch_count = VAR_0->out.ch_count; } VAR_0->in_buffer.bps = VAR_0->postin.bps = VAR_0->midbuf.bps = VAR_0->preout.bps = VAR_0->int_bps; VAR_0->in_buffer.planar = VAR_0->postin.planar = VAR_0->midbuf.planar = VAR_0->preout.planar = 1; if(VAR_0->rematrix && swr_rematrix_init(VAR_0)<0) return -1; return 0; }
[ "int FUNC_0(SwrContext *VAR_0){", "VAR_0->in_buffer_index= 0;", "VAR_0->in_buffer_count= 0;", "VAR_0->resample_in_constraint= 0;", "free_temp(&VAR_0->postin);", "free_temp(&VAR_0->midbuf);", "free_temp(&VAR_0->preout);", "free_temp(&VAR_0->in_buffer);", "swr_audio_convert_free(&VAR_0-> in_convert);", "swr_audio_convert_free(&VAR_0->out_convert);", "VAR_0-> in.planar= VAR_0-> in_sample_fmt >= 0x100;", "VAR_0->out.planar= VAR_0->out_sample_fmt >= 0x100;", "VAR_0-> in_sample_fmt &= 0xFF;", "VAR_0->out_sample_fmt &= 0xFF;", "if( VAR_0->int_sample_fmt != AV_SAMPLE_FMT_S16\n&&VAR_0->int_sample_fmt != AV_SAMPLE_FMT_FLT){", "av_log(VAR_0, AV_LOG_ERROR, \"Requested sample format %VAR_0 is not supported internally, only float & S16 is supported\\n\", av_get_sample_fmt_name(VAR_0->int_sample_fmt));", "return AVERROR(EINVAL);", "}", "if(VAR_0->in_sample_fmt <= AV_SAMPLE_FMT_S16 || VAR_0->int_sample_fmt==AV_SAMPLE_FMT_S16){", "VAR_0->int_sample_fmt= AV_SAMPLE_FMT_S16;", "}else", "VAR_0->int_sample_fmt= AV_SAMPLE_FMT_FLT;", "if (VAR_0->out_sample_rate!=VAR_0->in_sample_rate || (VAR_0->flags & SWR_FLAG_RESAMPLE)){", "VAR_0->resample = swr_resample_init(VAR_0->resample, VAR_0->out_sample_rate, VAR_0->in_sample_rate, 16, 10, 0, 0.8);", "}else", "swr_resample_free(&VAR_0->resample);", "if(VAR_0->int_sample_fmt != AV_SAMPLE_FMT_S16 && VAR_0->resample){", "av_log(VAR_0, AV_LOG_ERROR, \"Resampling only supported with internal s16 currently\\n\");", "return -1;", "}", "if(!VAR_0-> in_ch_layout)\nVAR_0-> in_ch_layout= guess_layout(VAR_0->in.ch_count);", "if(!VAR_0->out_ch_layout)\nVAR_0->out_ch_layout= guess_layout(VAR_0->out.ch_count);", "VAR_0->rematrix= VAR_0->out_ch_layout !=VAR_0->in_ch_layout;", "#define RSC 1 finetune\nif(!VAR_0-> in.ch_count)\nVAR_0-> in.ch_count= av_get_channel_layout_nb_channels(VAR_0-> in_ch_layout);", "if(!VAR_0->out.ch_count)\nVAR_0->out.ch_count= av_get_channel_layout_nb_channels(VAR_0->out_ch_layout);", "av_assert0(VAR_0-> in.ch_count);", "av_assert0(VAR_0->out.ch_count);", "VAR_0->resample_first= RSC*VAR_0->out.ch_count/VAR_0->in.ch_count - RSC < VAR_0->out_sample_rate/(float)VAR_0-> in_sample_rate - 1.0;", "VAR_0-> in.bps= av_get_bits_per_sample_fmt(VAR_0-> in_sample_fmt)/8;", "VAR_0->int_bps= av_get_bits_per_sample_fmt(VAR_0->int_sample_fmt)/8;", "VAR_0->out.bps= av_get_bits_per_sample_fmt(VAR_0->out_sample_fmt)/8;", "VAR_0->in_convert = swr_audio_convert_alloc(VAR_0->int_sample_fmt,\nVAR_0-> in_sample_fmt, VAR_0-> in.ch_count, 0);", "VAR_0->out_convert= swr_audio_convert_alloc(VAR_0->out_sample_fmt,\nVAR_0->int_sample_fmt, VAR_0->out.ch_count, 0);", "VAR_0->postin= VAR_0->in;", "VAR_0->preout= VAR_0->out;", "VAR_0->midbuf= VAR_0->in;", "VAR_0->in_buffer= VAR_0->in;", "if(!VAR_0->resample_first){", "VAR_0->midbuf.ch_count= VAR_0->out.ch_count;", "VAR_0->in_buffer.ch_count = VAR_0->out.ch_count;", "}", "VAR_0->in_buffer.bps = VAR_0->postin.bps = VAR_0->midbuf.bps = VAR_0->preout.bps = VAR_0->int_bps;", "VAR_0->in_buffer.planar = VAR_0->postin.planar = VAR_0->midbuf.planar = VAR_0->preout.planar = 1;", "if(VAR_0->rematrix && swr_rematrix_init(VAR_0)<0)\nreturn -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 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79, 81 ], [ 83, 85 ], [ 89 ], [ 93, 95, 97 ], [ 99, 101 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 121, 123 ], [ 125, 127 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ], [ 159, 161 ], [ 165 ], [ 167 ] ]
21,761
static inline void RENAME(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, long width, long height, long lumStride, long chromStride, long srcStride) { long y; const long chromWidth= width>>1; #ifdef HAVE_MMX for(y=0; y<height-2; y+=2) { long i; for(i=0; i<2; i++) { asm volatile( "mov %2, %%"REG_a" \n\t" "movq "MANGLE(bgr2YCoeff)", %%mm6 \n\t" "movq "MANGLE(w1111)", %%mm5 \n\t" "pxor %%mm7, %%mm7 \n\t" "lea (%%"REG_a", %%"REG_a", 2), %%"REG_d"\n\t" ASMALIGN(4) "1: \n\t" PREFETCH" 64(%0, %%"REG_d") \n\t" "movd (%0, %%"REG_d"), %%mm0 \n\t" "movd 3(%0, %%"REG_d"), %%mm1 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "movd 6(%0, %%"REG_d"), %%mm2 \n\t" "movd 9(%0, %%"REG_d"), %%mm3 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "pmaddwd %%mm6, %%mm0 \n\t" "pmaddwd %%mm6, %%mm1 \n\t" "pmaddwd %%mm6, %%mm2 \n\t" "pmaddwd %%mm6, %%mm3 \n\t" #ifndef FAST_BGR2YV12 "psrad $8, %%mm0 \n\t" "psrad $8, %%mm1 \n\t" "psrad $8, %%mm2 \n\t" "psrad $8, %%mm3 \n\t" #endif "packssdw %%mm1, %%mm0 \n\t" "packssdw %%mm3, %%mm2 \n\t" "pmaddwd %%mm5, %%mm0 \n\t" "pmaddwd %%mm5, %%mm2 \n\t" "packssdw %%mm2, %%mm0 \n\t" "psraw $7, %%mm0 \n\t" "movd 12(%0, %%"REG_d"), %%mm4 \n\t" "movd 15(%0, %%"REG_d"), %%mm1 \n\t" "punpcklbw %%mm7, %%mm4 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "movd 18(%0, %%"REG_d"), %%mm2 \n\t" "movd 21(%0, %%"REG_d"), %%mm3 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "pmaddwd %%mm6, %%mm4 \n\t" "pmaddwd %%mm6, %%mm1 \n\t" "pmaddwd %%mm6, %%mm2 \n\t" "pmaddwd %%mm6, %%mm3 \n\t" #ifndef FAST_BGR2YV12 "psrad $8, %%mm4 \n\t" "psrad $8, %%mm1 \n\t" "psrad $8, %%mm2 \n\t" "psrad $8, %%mm3 \n\t" #endif "packssdw %%mm1, %%mm4 \n\t" "packssdw %%mm3, %%mm2 \n\t" "pmaddwd %%mm5, %%mm4 \n\t" "pmaddwd %%mm5, %%mm2 \n\t" "add $24, %%"REG_d" \n\t" "packssdw %%mm2, %%mm4 \n\t" "psraw $7, %%mm4 \n\t" "packuswb %%mm4, %%mm0 \n\t" "paddusb "MANGLE(bgr2YOffset)", %%mm0 \n\t" MOVNTQ" %%mm0, (%1, %%"REG_a") \n\t" "add $8, %%"REG_a" \n\t" " js 1b \n\t" : : "r" (src+width*3), "r" (ydst+width), "g" (-width) : "%"REG_a, "%"REG_d ); ydst += lumStride; src += srcStride; } src -= srcStride*2; asm volatile( "mov %4, %%"REG_a" \n\t" "movq "MANGLE(w1111)", %%mm5 \n\t" "movq "MANGLE(bgr2UCoeff)", %%mm6 \n\t" "pxor %%mm7, %%mm7 \n\t" "lea (%%"REG_a", %%"REG_a", 2), %%"REG_d"\n\t" "add %%"REG_d", %%"REG_d" \n\t" ASMALIGN(4) "1: \n\t" PREFETCH" 64(%0, %%"REG_d") \n\t" PREFETCH" 64(%1, %%"REG_d") \n\t" #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) "movq (%0, %%"REG_d"), %%mm0 \n\t" "movq (%1, %%"REG_d"), %%mm1 \n\t" "movq 6(%0, %%"REG_d"), %%mm2 \n\t" "movq 6(%1, %%"REG_d"), %%mm3 \n\t" PAVGB" %%mm1, %%mm0 \n\t" PAVGB" %%mm3, %%mm2 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm2, %%mm3 \n\t" "psrlq $24, %%mm0 \n\t" "psrlq $24, %%mm2 \n\t" PAVGB" %%mm1, %%mm0 \n\t" PAVGB" %%mm3, %%mm2 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" #else "movd (%0, %%"REG_d"), %%mm0 \n\t" "movd (%1, %%"REG_d"), %%mm1 \n\t" "movd 3(%0, %%"REG_d"), %%mm2 \n\t" "movd 3(%1, %%"REG_d"), %%mm3 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "paddw %%mm1, %%mm0 \n\t" "paddw %%mm3, %%mm2 \n\t" "paddw %%mm2, %%mm0 \n\t" "movd 6(%0, %%"REG_d"), %%mm4 \n\t" "movd 6(%1, %%"REG_d"), %%mm1 \n\t" "movd 9(%0, %%"REG_d"), %%mm2 \n\t" "movd 9(%1, %%"REG_d"), %%mm3 \n\t" "punpcklbw %%mm7, %%mm4 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "paddw %%mm1, %%mm4 \n\t" "paddw %%mm3, %%mm2 \n\t" "paddw %%mm4, %%mm2 \n\t" "psrlw $2, %%mm0 \n\t" "psrlw $2, %%mm2 \n\t" #endif "movq "MANGLE(bgr2VCoeff)", %%mm1 \n\t" "movq "MANGLE(bgr2VCoeff)", %%mm3 \n\t" "pmaddwd %%mm0, %%mm1 \n\t" "pmaddwd %%mm2, %%mm3 \n\t" "pmaddwd %%mm6, %%mm0 \n\t" "pmaddwd %%mm6, %%mm2 \n\t" #ifndef FAST_BGR2YV12 "psrad $8, %%mm0 \n\t" "psrad $8, %%mm1 \n\t" "psrad $8, %%mm2 \n\t" "psrad $8, %%mm3 \n\t" #endif "packssdw %%mm2, %%mm0 \n\t" "packssdw %%mm3, %%mm1 \n\t" "pmaddwd %%mm5, %%mm0 \n\t" "pmaddwd %%mm5, %%mm1 \n\t" "packssdw %%mm1, %%mm0 \n\t" // V1 V0 U1 U0 "psraw $7, %%mm0 \n\t" #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) "movq 12(%0, %%"REG_d"), %%mm4 \n\t" "movq 12(%1, %%"REG_d"), %%mm1 \n\t" "movq 18(%0, %%"REG_d"), %%mm2 \n\t" "movq 18(%1, %%"REG_d"), %%mm3 \n\t" PAVGB" %%mm1, %%mm4 \n\t" PAVGB" %%mm3, %%mm2 \n\t" "movq %%mm4, %%mm1 \n\t" "movq %%mm2, %%mm3 \n\t" "psrlq $24, %%mm4 \n\t" "psrlq $24, %%mm2 \n\t" PAVGB" %%mm1, %%mm4 \n\t" PAVGB" %%mm3, %%mm2 \n\t" "punpcklbw %%mm7, %%mm4 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" #else "movd 12(%0, %%"REG_d"), %%mm4 \n\t" "movd 12(%1, %%"REG_d"), %%mm1 \n\t" "movd 15(%0, %%"REG_d"), %%mm2 \n\t" "movd 15(%1, %%"REG_d"), %%mm3 \n\t" "punpcklbw %%mm7, %%mm4 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "paddw %%mm1, %%mm4 \n\t" "paddw %%mm3, %%mm2 \n\t" "paddw %%mm2, %%mm4 \n\t" "movd 18(%0, %%"REG_d"), %%mm5 \n\t" "movd 18(%1, %%"REG_d"), %%mm1 \n\t" "movd 21(%0, %%"REG_d"), %%mm2 \n\t" "movd 21(%1, %%"REG_d"), %%mm3 \n\t" "punpcklbw %%mm7, %%mm5 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "paddw %%mm1, %%mm5 \n\t" "paddw %%mm3, %%mm2 \n\t" "paddw %%mm5, %%mm2 \n\t" "movq "MANGLE(w1111)", %%mm5 \n\t" "psrlw $2, %%mm4 \n\t" "psrlw $2, %%mm2 \n\t" #endif "movq "MANGLE(bgr2VCoeff)", %%mm1 \n\t" "movq "MANGLE(bgr2VCoeff)", %%mm3 \n\t" "pmaddwd %%mm4, %%mm1 \n\t" "pmaddwd %%mm2, %%mm3 \n\t" "pmaddwd %%mm6, %%mm4 \n\t" "pmaddwd %%mm6, %%mm2 \n\t" #ifndef FAST_BGR2YV12 "psrad $8, %%mm4 \n\t" "psrad $8, %%mm1 \n\t" "psrad $8, %%mm2 \n\t" "psrad $8, %%mm3 \n\t" #endif "packssdw %%mm2, %%mm4 \n\t" "packssdw %%mm3, %%mm1 \n\t" "pmaddwd %%mm5, %%mm4 \n\t" "pmaddwd %%mm5, %%mm1 \n\t" "add $24, %%"REG_d" \n\t" "packssdw %%mm1, %%mm4 \n\t" // V3 V2 U3 U2 "psraw $7, %%mm4 \n\t" "movq %%mm0, %%mm1 \n\t" "punpckldq %%mm4, %%mm0 \n\t" "punpckhdq %%mm4, %%mm1 \n\t" "packsswb %%mm1, %%mm0 \n\t" "paddb "MANGLE(bgr2UVOffset)", %%mm0 \n\t" "movd %%mm0, (%2, %%"REG_a") \n\t" "punpckhdq %%mm0, %%mm0 \n\t" "movd %%mm0, (%3, %%"REG_a") \n\t" "add $4, %%"REG_a" \n\t" " js 1b \n\t" : : "r" (src+chromWidth*6), "r" (src+srcStride+chromWidth*6), "r" (udst+chromWidth), "r" (vdst+chromWidth), "g" (-chromWidth) : "%"REG_a, "%"REG_d ); udst += chromStride; vdst += chromStride; src += srcStride*2; } asm volatile( EMMS" \n\t" SFENCE" \n\t" :::"memory"); #else y=0; #endif for(; y<height; y+=2) { long i; for(i=0; i<chromWidth; i++) { unsigned int b= src[6*i+0]; unsigned int g= src[6*i+1]; unsigned int r= src[6*i+2]; unsigned int Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16; unsigned int V = ((RV*r + GV*g + BV*b)>>RGB2YUV_SHIFT) + 128; unsigned int U = ((RU*r + GU*g + BU*b)>>RGB2YUV_SHIFT) + 128; udst[i] = U; vdst[i] = V; ydst[2*i] = Y; b= src[6*i+3]; g= src[6*i+4]; r= src[6*i+5]; Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16; ydst[2*i+1] = Y; } ydst += lumStride; src += srcStride; for(i=0; i<chromWidth; i++) { unsigned int b= src[6*i+0]; unsigned int g= src[6*i+1]; unsigned int r= src[6*i+2]; unsigned int Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16; ydst[2*i] = Y; b= src[6*i+3]; g= src[6*i+4]; r= src[6*i+5]; Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16; ydst[2*i+1] = Y; } udst += chromStride; vdst += chromStride; ydst += lumStride; src += srcStride; } }
true
FFmpeg
6e42e6c4b410dbef8b593c2d796a5dad95f89ee4
static inline void RENAME(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, long width, long height, long lumStride, long chromStride, long srcStride) { long y; const long chromWidth= width>>1; #ifdef HAVE_MMX for(y=0; y<height-2; y+=2) { long i; for(i=0; i<2; i++) { asm volatile( "mov %2, %%"REG_a" \n\t" "movq "MANGLE(bgr2YCoeff)", %%mm6 \n\t" "movq "MANGLE(w1111)", %%mm5 \n\t" "pxor %%mm7, %%mm7 \n\t" "lea (%%"REG_a", %%"REG_a", 2), %%"REG_d"\n\t" ASMALIGN(4) "1: \n\t" PREFETCH" 64(%0, %%"REG_d") \n\t" "movd (%0, %%"REG_d"), %%mm0 \n\t" "movd 3(%0, %%"REG_d"), %%mm1 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "movd 6(%0, %%"REG_d"), %%mm2 \n\t" "movd 9(%0, %%"REG_d"), %%mm3 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "pmaddwd %%mm6, %%mm0 \n\t" "pmaddwd %%mm6, %%mm1 \n\t" "pmaddwd %%mm6, %%mm2 \n\t" "pmaddwd %%mm6, %%mm3 \n\t" #ifndef FAST_BGR2YV12 "psrad $8, %%mm0 \n\t" "psrad $8, %%mm1 \n\t" "psrad $8, %%mm2 \n\t" "psrad $8, %%mm3 \n\t" #endif "packssdw %%mm1, %%mm0 \n\t" "packssdw %%mm3, %%mm2 \n\t" "pmaddwd %%mm5, %%mm0 \n\t" "pmaddwd %%mm5, %%mm2 \n\t" "packssdw %%mm2, %%mm0 \n\t" "psraw $7, %%mm0 \n\t" "movd 12(%0, %%"REG_d"), %%mm4 \n\t" "movd 15(%0, %%"REG_d"), %%mm1 \n\t" "punpcklbw %%mm7, %%mm4 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "movd 18(%0, %%"REG_d"), %%mm2 \n\t" "movd 21(%0, %%"REG_d"), %%mm3 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "pmaddwd %%mm6, %%mm4 \n\t" "pmaddwd %%mm6, %%mm1 \n\t" "pmaddwd %%mm6, %%mm2 \n\t" "pmaddwd %%mm6, %%mm3 \n\t" #ifndef FAST_BGR2YV12 "psrad $8, %%mm4 \n\t" "psrad $8, %%mm1 \n\t" "psrad $8, %%mm2 \n\t" "psrad $8, %%mm3 \n\t" #endif "packssdw %%mm1, %%mm4 \n\t" "packssdw %%mm3, %%mm2 \n\t" "pmaddwd %%mm5, %%mm4 \n\t" "pmaddwd %%mm5, %%mm2 \n\t" "add $24, %%"REG_d" \n\t" "packssdw %%mm2, %%mm4 \n\t" "psraw $7, %%mm4 \n\t" "packuswb %%mm4, %%mm0 \n\t" "paddusb "MANGLE(bgr2YOffset)", %%mm0 \n\t" MOVNTQ" %%mm0, (%1, %%"REG_a") \n\t" "add $8, %%"REG_a" \n\t" " js 1b \n\t" : : "r" (src+width*3), "r" (ydst+width), "g" (-width) : "%"REG_a, "%"REG_d ); ydst += lumStride; src += srcStride; } src -= srcStride*2; asm volatile( "mov %4, %%"REG_a" \n\t" "movq "MANGLE(w1111)", %%mm5 \n\t" "movq "MANGLE(bgr2UCoeff)", %%mm6 \n\t" "pxor %%mm7, %%mm7 \n\t" "lea (%%"REG_a", %%"REG_a", 2), %%"REG_d"\n\t" "add %%"REG_d", %%"REG_d" \n\t" ASMALIGN(4) "1: \n\t" PREFETCH" 64(%0, %%"REG_d") \n\t" PREFETCH" 64(%1, %%"REG_d") \n\t" #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) "movq (%0, %%"REG_d"), %%mm0 \n\t" "movq (%1, %%"REG_d"), %%mm1 \n\t" "movq 6(%0, %%"REG_d"), %%mm2 \n\t" "movq 6(%1, %%"REG_d"), %%mm3 \n\t" PAVGB" %%mm1, %%mm0 \n\t" PAVGB" %%mm3, %%mm2 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm2, %%mm3 \n\t" "psrlq $24, %%mm0 \n\t" "psrlq $24, %%mm2 \n\t" PAVGB" %%mm1, %%mm0 \n\t" PAVGB" %%mm3, %%mm2 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" #else "movd (%0, %%"REG_d"), %%mm0 \n\t" "movd (%1, %%"REG_d"), %%mm1 \n\t" "movd 3(%0, %%"REG_d"), %%mm2 \n\t" "movd 3(%1, %%"REG_d"), %%mm3 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "paddw %%mm1, %%mm0 \n\t" "paddw %%mm3, %%mm2 \n\t" "paddw %%mm2, %%mm0 \n\t" "movd 6(%0, %%"REG_d"), %%mm4 \n\t" "movd 6(%1, %%"REG_d"), %%mm1 \n\t" "movd 9(%0, %%"REG_d"), %%mm2 \n\t" "movd 9(%1, %%"REG_d"), %%mm3 \n\t" "punpcklbw %%mm7, %%mm4 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "paddw %%mm1, %%mm4 \n\t" "paddw %%mm3, %%mm2 \n\t" "paddw %%mm4, %%mm2 \n\t" "psrlw $2, %%mm0 \n\t" "psrlw $2, %%mm2 \n\t" #endif "movq "MANGLE(bgr2VCoeff)", %%mm1 \n\t" "movq "MANGLE(bgr2VCoeff)", %%mm3 \n\t" "pmaddwd %%mm0, %%mm1 \n\t" "pmaddwd %%mm2, %%mm3 \n\t" "pmaddwd %%mm6, %%mm0 \n\t" "pmaddwd %%mm6, %%mm2 \n\t" #ifndef FAST_BGR2YV12 "psrad $8, %%mm0 \n\t" "psrad $8, %%mm1 \n\t" "psrad $8, %%mm2 \n\t" "psrad $8, %%mm3 \n\t" #endif "packssdw %%mm2, %%mm0 \n\t" "packssdw %%mm3, %%mm1 \n\t" "pmaddwd %%mm5, %%mm0 \n\t" "pmaddwd %%mm5, %%mm1 \n\t" "packssdw %%mm1, %%mm0 \n\t" "psraw $7, %%mm0 \n\t" #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) "movq 12(%0, %%"REG_d"), %%mm4 \n\t" "movq 12(%1, %%"REG_d"), %%mm1 \n\t" "movq 18(%0, %%"REG_d"), %%mm2 \n\t" "movq 18(%1, %%"REG_d"), %%mm3 \n\t" PAVGB" %%mm1, %%mm4 \n\t" PAVGB" %%mm3, %%mm2 \n\t" "movq %%mm4, %%mm1 \n\t" "movq %%mm2, %%mm3 \n\t" "psrlq $24, %%mm4 \n\t" "psrlq $24, %%mm2 \n\t" PAVGB" %%mm1, %%mm4 \n\t" PAVGB" %%mm3, %%mm2 \n\t" "punpcklbw %%mm7, %%mm4 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" #else "movd 12(%0, %%"REG_d"), %%mm4 \n\t" "movd 12(%1, %%"REG_d"), %%mm1 \n\t" "movd 15(%0, %%"REG_d"), %%mm2 \n\t" "movd 15(%1, %%"REG_d"), %%mm3 \n\t" "punpcklbw %%mm7, %%mm4 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "paddw %%mm1, %%mm4 \n\t" "paddw %%mm3, %%mm2 \n\t" "paddw %%mm2, %%mm4 \n\t" "movd 18(%0, %%"REG_d"), %%mm5 \n\t" "movd 18(%1, %%"REG_d"), %%mm1 \n\t" "movd 21(%0, %%"REG_d"), %%mm2 \n\t" "movd 21(%1, %%"REG_d"), %%mm3 \n\t" "punpcklbw %%mm7, %%mm5 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "paddw %%mm1, %%mm5 \n\t" "paddw %%mm3, %%mm2 \n\t" "paddw %%mm5, %%mm2 \n\t" "movq "MANGLE(w1111)", %%mm5 \n\t" "psrlw $2, %%mm4 \n\t" "psrlw $2, %%mm2 \n\t" #endif "movq "MANGLE(bgr2VCoeff)", %%mm1 \n\t" "movq "MANGLE(bgr2VCoeff)", %%mm3 \n\t" "pmaddwd %%mm4, %%mm1 \n\t" "pmaddwd %%mm2, %%mm3 \n\t" "pmaddwd %%mm6, %%mm4 \n\t" "pmaddwd %%mm6, %%mm2 \n\t" #ifndef FAST_BGR2YV12 "psrad $8, %%mm4 \n\t" "psrad $8, %%mm1 \n\t" "psrad $8, %%mm2 \n\t" "psrad $8, %%mm3 \n\t" #endif "packssdw %%mm2, %%mm4 \n\t" "packssdw %%mm3, %%mm1 \n\t" "pmaddwd %%mm5, %%mm4 \n\t" "pmaddwd %%mm5, %%mm1 \n\t" "add $24, %%"REG_d" \n\t" "packssdw %%mm1, %%mm4 \n\t" "psraw $7, %%mm4 \n\t" "movq %%mm0, %%mm1 \n\t" "punpckldq %%mm4, %%mm0 \n\t" "punpckhdq %%mm4, %%mm1 \n\t" "packsswb %%mm1, %%mm0 \n\t" "paddb "MANGLE(bgr2UVOffset)", %%mm0 \n\t" "movd %%mm0, (%2, %%"REG_a") \n\t" "punpckhdq %%mm0, %%mm0 \n\t" "movd %%mm0, (%3, %%"REG_a") \n\t" "add $4, %%"REG_a" \n\t" " js 1b \n\t" : : "r" (src+chromWidth*6), "r" (src+srcStride+chromWidth*6), "r" (udst+chromWidth), "r" (vdst+chromWidth), "g" (-chromWidth) : "%"REG_a, "%"REG_d ); udst += chromStride; vdst += chromStride; src += srcStride*2; } asm volatile( EMMS" \n\t" SFENCE" \n\t" :::"memory"); #else y=0; #endif for(; y<height; y+=2) { long i; for(i=0; i<chromWidth; i++) { unsigned int b= src[6*i+0]; unsigned int g= src[6*i+1]; unsigned int r= src[6*i+2]; unsigned int Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16; unsigned int V = ((RV*r + GV*g + BV*b)>>RGB2YUV_SHIFT) + 128; unsigned int U = ((RU*r + GU*g + BU*b)>>RGB2YUV_SHIFT) + 128; udst[i] = U; vdst[i] = V; ydst[2*i] = Y; b= src[6*i+3]; g= src[6*i+4]; r= src[6*i+5]; Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16; ydst[2*i+1] = Y; } ydst += lumStride; src += srcStride; for(i=0; i<chromWidth; i++) { unsigned int b= src[6*i+0]; unsigned int g= src[6*i+1]; unsigned int r= src[6*i+2]; unsigned int Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16; ydst[2*i] = Y; b= src[6*i+3]; g= src[6*i+4]; r= src[6*i+5]; Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16; ydst[2*i+1] = Y; } udst += chromStride; vdst += chromStride; ydst += lumStride; src += srcStride; } }
{ "code": [ "\tlong width, long height,", "\tlong width, long height,", "\tlong width, long height,", "\tlong width, long height,", "\tlong width, long height,", "\tlong width, long height,", "\tlong width, long height,", "\tlong width, long height,", "\tlong width, long height,", "\tlong width, long height,", "#ifdef HAVE_MMX", "#endif", "#ifdef HAVE_MMX", "#endif", "#else", "#endif", "#endif", "\t\t);", "\t\t);", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "\tlong width, long height,", "\tlong y;", "\tconst long chromWidth= width>>1;", "\t\tasm volatile(", "\t\t\tASMALIGN(4)", "\t\t\t\"1:\t\t\t\t\\n\\t\"", "\t\t);", "#endif", "#endif", "#endif", "\tlong width, long height,", "\tlong width, long height,", "\tlong y;", "\tconst long chromWidth= width>>1;", "\t\tasm volatile(", "\t\t\tASMALIGN(4)", "\t\t\t\"1:\t\t\t\t\\n\\t\"", "\t\t);", "#endif", "#endif", "#endif", "\tlong width, long height,", "\tlong width, long height,", "\tlong width, long height,", "\tlong lumStride, long chromStride, long srcStride)", "\tlong y;", "\tconst long chromWidth= width>>1;", "\t\tasm volatile(", "\t\t\tASMALIGN(4)", "\t\t\t\"1:\t\t\t\t\\n\\t\"", "\t\t);", "\t\tydst += lumStride;", "\t\tsrc += srcStride;", "\t\tasm volatile(", "\t\t\tASMALIGN(4)", "\t\t\t\"1:\t\t\t\t\\n\\t\"", "\t\t);", "\t\tlong i;", "\t\tfor(i=0; i<chromWidth; i++)", "\t\tydst += lumStride;", "\t\tsrc += srcStride;", "\t\tfor(i=0; i<chromWidth; i++)", "#endif", "\t\tudst += chromStride;", "\t\tvdst += chromStride;", "\t\tydst += lumStride;", "\t\tsrc += srcStride;", "\t\tasm volatile(", "\t\t\t\"mov %4, %%\"REG_a\"\t\t\\n\\t\"", "\t\t\t\"1:\t\t\t\t\\n\\t\"", "\t\t\tPAVGB\" %%mm1, %%mm4\t\t\\n\\t\"", "\t\t\tPAVGB\" %%mm1, %%mm4\t\t\\n\\t\"", "#endif", "\t\t\t\" js 1b\t\t\t\t\\n\\t\"", "\t\t);", "#endif", "\tlong width, long height,", "\tlong lumStride, long chromStride, long srcStride)", "\tlong y;", "\tconst long chromWidth= width>>1;", "\t\tasm volatile(", "\t\t\tASMALIGN(4)", "\t\t\t\"1:\t\t\t\t\\n\\t\"", "\t\t);", "\t\tydst += lumStride;", "\t\tsrc += srcStride;", "\t\tasm volatile(", "\t\t\tASMALIGN(4)", "\t\t\t\"1:\t\t\t\t\\n\\t\"", "\t\t);", "\t\tlong i;", "\t\tfor(i=0; i<chromWidth; i++)", "\t\tydst += lumStride;", "\t\tsrc += srcStride;", "\t\tfor(i=0; i<chromWidth; i++)", "#endif", "\t\tudst += chromStride;", "\t\tvdst += chromStride;", "\t\tydst += lumStride;", "\t\tsrc += srcStride;", "\tlong width, long height,", "\tlong lumStride, long chromStride, long srcStride)", "\tlong y;", "\tconst long chromWidth= width>>1;", "\tfor(y=0; y<height-2; y+=2)", "\t\tlong i;", "\t\tfor(i=0; i<2; i++)", "\t\t\tasm volatile(", "\t\t\t\t\"mov %2, %%\"REG_a\"\t\t\\n\\t\"", "\t\t\t\t\"movq \"MANGLE(bgr2YCoeff)\", %%mm6\t\t\\n\\t\"", "\t\t\t\t\"movq \"MANGLE(w1111)\", %%mm5\t\t\\n\\t\"", "\t\t\t\t\"pxor %%mm7, %%mm7\t\t\\n\\t\"", "\t\t\t\t\"lea (%%\"REG_a\", %%\"REG_a\", 2), %%\"REG_d\"\\n\\t\"", "\t\t\t\tASMALIGN(4)", "\t\t\t\t\"1:\t\t\t\t\\n\\t\"", "\t\t\t\tPREFETCH\" 64(%0, %%\"REG_d\")\t\\n\\t\"", "\t\t\t\t\"movd (%0, %%\"REG_d\"), %%mm0\t\\n\\t\"", "\t\t\t\t\"movd 3(%0, %%\"REG_d\"), %%mm1\t\\n\\t\"", "\t\t\t\t\"punpcklbw %%mm7, %%mm0\t\t\\n\\t\"", "\t\t\t\t\"punpcklbw %%mm7, %%mm1\t\t\\n\\t\"", "\t\t\t\t\"movd 6(%0, %%\"REG_d\"), %%mm2\t\\n\\t\"", "\t\t\t\t\"movd 9(%0, %%\"REG_d\"), %%mm3\t\\n\\t\"", "\t\t\t\t\"punpcklbw %%mm7, %%mm2\t\t\\n\\t\"", "\t\t\t\t\"punpcklbw %%mm7, %%mm3\t\t\\n\\t\"", "\t\t\t\t\"pmaddwd %%mm6, %%mm0\t\t\\n\\t\"", "\t\t\t\t\"pmaddwd %%mm6, %%mm1\t\t\\n\\t\"", "\t\t\t\t\"pmaddwd %%mm6, %%mm2\t\t\\n\\t\"", "\t\t\t\t\"pmaddwd %%mm6, %%mm3\t\t\\n\\t\"", "\t\t\t\t\"psrad $8, %%mm0\t\t\\n\\t\"", "\t\t\t\t\"psrad $8, %%mm1\t\t\\n\\t\"", "\t\t\t\t\"psrad $8, %%mm2\t\t\\n\\t\"", "\t\t\t\t\"psrad $8, %%mm3\t\t\\n\\t\"", "#endif", "\t\t\t\t\"packssdw %%mm1, %%mm0\t\t\\n\\t\"", "\t\t\t\t\"packssdw %%mm3, %%mm2\t\t\\n\\t\"", "\t\t\t\t\"pmaddwd %%mm5, %%mm0\t\t\\n\\t\"", "\t\t\t\t\"pmaddwd %%mm5, %%mm2\t\t\\n\\t\"", "\t\t\t\t\"packssdw %%mm2, %%mm0\t\t\\n\\t\"", "\t\t\t\t\"psraw $7, %%mm0\t\t\\n\\t\"", "\t\t\t\t\"movd 12(%0, %%\"REG_d\"), %%mm4\t\\n\\t\"", "\t\t\t\t\"movd 15(%0, %%\"REG_d\"), %%mm1\t\\n\\t\"", "\t\t\t\t\"punpcklbw %%mm7, %%mm4\t\t\\n\\t\"", "\t\t\t\t\"punpcklbw %%mm7, %%mm1\t\t\\n\\t\"", "\t\t\t\t\"movd 18(%0, %%\"REG_d\"), %%mm2\t\\n\\t\"", "\t\t\t\t\"movd 21(%0, %%\"REG_d\"), %%mm3\t\\n\\t\"", "\t\t\t\t\"punpcklbw %%mm7, %%mm2\t\t\\n\\t\"", "\t\t\t\t\"punpcklbw %%mm7, %%mm3\t\t\\n\\t\"", "\t\t\t\t\"pmaddwd %%mm6, %%mm4\t\t\\n\\t\"", "\t\t\t\t\"pmaddwd %%mm6, %%mm1\t\t\\n\\t\"", "\t\t\t\t\"pmaddwd %%mm6, %%mm2\t\t\\n\\t\"", "\t\t\t\t\"pmaddwd %%mm6, %%mm3\t\t\\n\\t\"", "\t\t\t\t\"psrad $8, %%mm4\t\t\\n\\t\"", "\t\t\t\t\"psrad $8, %%mm1\t\t\\n\\t\"", "\t\t\t\t\"psrad $8, %%mm2\t\t\\n\\t\"", "\t\t\t\t\"psrad $8, %%mm3\t\t\\n\\t\"", "#endif", "\t\t\t\t\"packssdw %%mm1, %%mm4\t\t\\n\\t\"", "\t\t\t\t\"packssdw %%mm3, %%mm2\t\t\\n\\t\"", "\t\t\t\t\"pmaddwd %%mm5, %%mm4\t\t\\n\\t\"", "\t\t\t\t\"pmaddwd %%mm5, %%mm2\t\t\\n\\t\"", "\t\t\t\t\"add $24, %%\"REG_d\"\t\t\\n\\t\"", "\t\t\t\t\"packssdw %%mm2, %%mm4\t\t\\n\\t\"", "\t\t\t\t\"psraw $7, %%mm4\t\t\\n\\t\"", "\t\t\t\t\"packuswb %%mm4, %%mm0\t\t\\n\\t\"", "\t\t\t\t\"paddusb \"MANGLE(bgr2YOffset)\", %%mm0\t\\n\\t\"", "\t\t\t\tMOVNTQ\" %%mm0, (%1, %%\"REG_a\")\t\\n\\t\"", "\t\t\t\t\"add $8, %%\"REG_a\"\t\t\\n\\t\"", "\t\t\t\t\" js 1b\t\t\t\t\\n\\t\"", "\t\t\t\t: : \"r\" (src+width*3), \"r\" (ydst+width), \"g\" (-width)", "\t\t\t\t: \"%\"REG_a, \"%\"REG_d", "\t\t\t);", "\t\t\tydst += lumStride;", "\t\t\tsrc += srcStride;", "\t\tsrc -= srcStride*2;", "\t\tasm volatile(", "\t\t\t\"mov %4, %%\"REG_a\"\t\t\\n\\t\"", "\t\t\t\"movq \"MANGLE(w1111)\", %%mm5\t\t\\n\\t\"", "\t\t\t\"movq \"MANGLE(bgr2UCoeff)\", %%mm6\t\t\\n\\t\"", "\t\t\t\"pxor %%mm7, %%mm7\t\t\\n\\t\"", "\t\t\t\"lea (%%\"REG_a\", %%\"REG_a\", 2), %%\"REG_d\"\\n\\t\"", "\t\t\t\"add %%\"REG_d\", %%\"REG_d\"\t\\n\\t\"", "\t\t\tASMALIGN(4)", "\t\t\t\"1:\t\t\t\t\\n\\t\"", "\t\t\tPREFETCH\" 64(%0, %%\"REG_d\")\t\\n\\t\"", "\t\t\tPREFETCH\" 64(%1, %%\"REG_d\")\t\\n\\t\"", "\t\t\t\"movq (%0, %%\"REG_d\"), %%mm0\t\\n\\t\"", "\t\t\t\"movq (%1, %%\"REG_d\"), %%mm1\t\\n\\t\"", "\t\t\t\"movq 6(%0, %%\"REG_d\"), %%mm2\t\\n\\t\"", "\t\t\t\"movq 6(%1, %%\"REG_d\"), %%mm3\t\\n\\t\"", "\t\t\tPAVGB\" %%mm1, %%mm0\t\t\\n\\t\"", "\t\t\tPAVGB\" %%mm3, %%mm2\t\t\\n\\t\"", "\t\t\t\"movq %%mm0, %%mm1\t\t\\n\\t\"", "\t\t\t\"movq %%mm2, %%mm3\t\t\\n\\t\"", "\t\t\t\"psrlq $24, %%mm0\t\t\\n\\t\"", "\t\t\t\"psrlq $24, %%mm2\t\t\\n\\t\"", "\t\t\tPAVGB\" %%mm1, %%mm0\t\t\\n\\t\"", "\t\t\tPAVGB\" %%mm3, %%mm2\t\t\\n\\t\"", "\t\t\t\"punpcklbw %%mm7, %%mm0\t\t\\n\\t\"", "\t\t\t\"punpcklbw %%mm7, %%mm2\t\t\\n\\t\"", "\t\t\t\"movd (%0, %%\"REG_d\"), %%mm0\t\\n\\t\"", "\t\t\t\"movd (%1, %%\"REG_d\"), %%mm1\t\\n\\t\"", "\t\t\t\"movd 3(%0, %%\"REG_d\"), %%mm2\t\\n\\t\"", "\t\t\t\"movd 3(%1, %%\"REG_d\"), %%mm3\t\\n\\t\"", "\t\t\t\"punpcklbw %%mm7, %%mm0\t\t\\n\\t\"", "\t\t\t\"punpcklbw %%mm7, %%mm1\t\t\\n\\t\"", "\t\t\t\"punpcklbw %%mm7, %%mm2\t\t\\n\\t\"", "\t\t\t\"punpcklbw %%mm7, %%mm3\t\t\\n\\t\"", "\t\t\t\"paddw %%mm1, %%mm0\t\t\\n\\t\"", "\t\t\t\"paddw %%mm3, %%mm2\t\t\\n\\t\"", "\t\t\t\"paddw %%mm2, %%mm0\t\t\\n\\t\"", "\t\t\t\"movd 6(%0, %%\"REG_d\"), %%mm4\t\\n\\t\"", "\t\t\t\"movd 6(%1, %%\"REG_d\"), %%mm1\t\\n\\t\"", "\t\t\t\"movd 9(%0, %%\"REG_d\"), %%mm2\t\\n\\t\"", "\t\t\t\"movd 9(%1, %%\"REG_d\"), %%mm3\t\\n\\t\"", "\t\t\t\"punpcklbw %%mm7, %%mm4\t\t\\n\\t\"", "\t\t\t\"punpcklbw %%mm7, %%mm1\t\t\\n\\t\"", "\t\t\t\"punpcklbw %%mm7, %%mm2\t\t\\n\\t\"", "\t\t\t\"punpcklbw %%mm7, %%mm3\t\t\\n\\t\"", "\t\t\t\"paddw %%mm1, %%mm4\t\t\\n\\t\"", "\t\t\t\"paddw %%mm3, %%mm2\t\t\\n\\t\"", "\t\t\t\"paddw %%mm4, %%mm2\t\t\\n\\t\"", "\t\t\t\"psrlw $2, %%mm0\t\t\\n\\t\"", "\t\t\t\"psrlw $2, %%mm2\t\t\\n\\t\"", "#endif", "\t\t\t\"movq \"MANGLE(bgr2VCoeff)\", %%mm1\t\t\\n\\t\"", "\t\t\t\"movq \"MANGLE(bgr2VCoeff)\", %%mm3\t\t\\n\\t\"", "\t\t\t\"pmaddwd %%mm0, %%mm1\t\t\\n\\t\"", "\t\t\t\"pmaddwd %%mm2, %%mm3\t\t\\n\\t\"", "\t\t\t\"pmaddwd %%mm6, %%mm0\t\t\\n\\t\"", "\t\t\t\"pmaddwd %%mm6, %%mm2\t\t\\n\\t\"", "\t\t\t\"psrad $8, %%mm0\t\t\\n\\t\"", "\t\t\t\"psrad $8, %%mm1\t\t\\n\\t\"", "\t\t\t\"psrad $8, %%mm2\t\t\\n\\t\"", "\t\t\t\"psrad $8, %%mm3\t\t\\n\\t\"", "#endif", "\t\t\t\"packssdw %%mm2, %%mm0\t\t\\n\\t\"", "\t\t\t\"packssdw %%mm3, %%mm1\t\t\\n\\t\"", "\t\t\t\"pmaddwd %%mm5, %%mm0\t\t\\n\\t\"", "\t\t\t\"pmaddwd %%mm5, %%mm1\t\t\\n\\t\"", "\t\t\t\"psraw $7, %%mm0\t\t\\n\\t\"", "\t\t\t\"movq 12(%0, %%\"REG_d\"), %%mm4\t\\n\\t\"", "\t\t\t\"movq 12(%1, %%\"REG_d\"), %%mm1\t\\n\\t\"", "\t\t\t\"movq 18(%0, %%\"REG_d\"), %%mm2\t\\n\\t\"", "\t\t\t\"movq 18(%1, %%\"REG_d\"), %%mm3\t\\n\\t\"", "\t\t\tPAVGB\" %%mm1, %%mm4\t\t\\n\\t\"", "\t\t\tPAVGB\" %%mm3, %%mm2\t\t\\n\\t\"", "\t\t\t\"movq %%mm4, %%mm1\t\t\\n\\t\"", "\t\t\t\"movq %%mm2, %%mm3\t\t\\n\\t\"", "\t\t\t\"psrlq $24, %%mm4\t\t\\n\\t\"", "\t\t\t\"psrlq $24, %%mm2\t\t\\n\\t\"", "\t\t\tPAVGB\" %%mm1, %%mm4\t\t\\n\\t\"", "\t\t\tPAVGB\" %%mm3, %%mm2\t\t\\n\\t\"", "\t\t\t\"punpcklbw %%mm7, %%mm4\t\t\\n\\t\"", "\t\t\t\"punpcklbw %%mm7, %%mm2\t\t\\n\\t\"", "\t\t\t\"movd 12(%0, %%\"REG_d\"), %%mm4\t\\n\\t\"", "\t\t\t\"movd 12(%1, %%\"REG_d\"), %%mm1\t\\n\\t\"", "\t\t\t\"movd 15(%0, %%\"REG_d\"), %%mm2\t\\n\\t\"", "\t\t\t\"movd 15(%1, %%\"REG_d\"), %%mm3\t\\n\\t\"", "\t\t\t\"punpcklbw %%mm7, %%mm4\t\t\\n\\t\"", "\t\t\t\"punpcklbw %%mm7, %%mm1\t\t\\n\\t\"", "\t\t\t\"punpcklbw %%mm7, %%mm2\t\t\\n\\t\"", "\t\t\t\"punpcklbw %%mm7, %%mm3\t\t\\n\\t\"", "\t\t\t\"paddw %%mm1, %%mm4\t\t\\n\\t\"", "\t\t\t\"paddw %%mm3, %%mm2\t\t\\n\\t\"", "\t\t\t\"paddw %%mm2, %%mm4\t\t\\n\\t\"", "\t\t\t\"movd 18(%0, %%\"REG_d\"), %%mm5\t\\n\\t\"", "\t\t\t\"movd 18(%1, %%\"REG_d\"), %%mm1\t\\n\\t\"", "\t\t\t\"movd 21(%0, %%\"REG_d\"), %%mm2\t\\n\\t\"", "\t\t\t\"movd 21(%1, %%\"REG_d\"), %%mm3\t\\n\\t\"", "\t\t\t\"punpcklbw %%mm7, %%mm5\t\t\\n\\t\"", "\t\t\t\"punpcklbw %%mm7, %%mm1\t\t\\n\\t\"", "\t\t\t\"punpcklbw %%mm7, %%mm2\t\t\\n\\t\"", "\t\t\t\"punpcklbw %%mm7, %%mm3\t\t\\n\\t\"", "\t\t\t\"paddw %%mm1, %%mm5\t\t\\n\\t\"", "\t\t\t\"paddw %%mm3, %%mm2\t\t\\n\\t\"", "\t\t\t\"paddw %%mm5, %%mm2\t\t\\n\\t\"", "\t\t\t\"movq \"MANGLE(w1111)\", %%mm5\t\t\\n\\t\"", "\t\t\t\"psrlw $2, %%mm4\t\t\\n\\t\"", "\t\t\t\"psrlw $2, %%mm2\t\t\\n\\t\"", "#endif", "\t\t\t\"movq \"MANGLE(bgr2VCoeff)\", %%mm1\t\t\\n\\t\"", "\t\t\t\"movq \"MANGLE(bgr2VCoeff)\", %%mm3\t\t\\n\\t\"", "\t\t\t\"pmaddwd %%mm4, %%mm1\t\t\\n\\t\"", "\t\t\t\"pmaddwd %%mm2, %%mm3\t\t\\n\\t\"", "\t\t\t\"pmaddwd %%mm6, %%mm4\t\t\\n\\t\"", "\t\t\t\"pmaddwd %%mm6, %%mm2\t\t\\n\\t\"", "\t\t\t\"psrad $8, %%mm4\t\t\\n\\t\"", "\t\t\t\"psrad $8, %%mm1\t\t\\n\\t\"", "\t\t\t\"psrad $8, %%mm2\t\t\\n\\t\"", "\t\t\t\"psrad $8, %%mm3\t\t\\n\\t\"", "#endif", "\t\t\t\"packssdw %%mm2, %%mm4\t\t\\n\\t\"", "\t\t\t\"packssdw %%mm3, %%mm1\t\t\\n\\t\"", "\t\t\t\"pmaddwd %%mm5, %%mm4\t\t\\n\\t\"", "\t\t\t\"pmaddwd %%mm5, %%mm1\t\t\\n\\t\"", "\t\t\t\"add $24, %%\"REG_d\"\t\t\\n\\t\"", "\t\t\t\"psraw $7, %%mm4\t\t\\n\\t\"", "\t\t\t\"movq %%mm0, %%mm1\t\t\\n\\t\"", "\t\t\t\"punpckldq %%mm4, %%mm0\t\t\\n\\t\"", "\t\t\t\"punpckhdq %%mm4, %%mm1\t\t\\n\\t\"", "\t\t\t\"packsswb %%mm1, %%mm0\t\t\\n\\t\"", "\t\t\t\"paddb \"MANGLE(bgr2UVOffset)\", %%mm0\t\\n\\t\"", "\t\t\t\"movd %%mm0, (%2, %%\"REG_a\")\t\\n\\t\"", "\t\t\t\"punpckhdq %%mm0, %%mm0\t\t\\n\\t\"", "\t\t\t\"movd %%mm0, (%3, %%\"REG_a\")\t\\n\\t\"", "\t\t\t\"add $4, %%\"REG_a\"\t\t\\n\\t\"", "\t\t\t\" js 1b\t\t\t\t\\n\\t\"", "\t\t\t: : \"r\" (src+chromWidth*6), \"r\" (src+srcStride+chromWidth*6), \"r\" (udst+chromWidth), \"r\" (vdst+chromWidth), \"g\" (-chromWidth)", "\t\t\t: \"%\"REG_a, \"%\"REG_d", "\t\t);", "\t\tudst += chromStride;", "\t\tvdst += chromStride;", "\t\tsrc += srcStride*2;", "\tasm volatile( EMMS\" \\n\\t\"", "\t\t\tSFENCE\" \\n\\t\"", "\t\t\t:::\"memory\");", "\ty=0;", "#endif", "\tfor(; y<height; y+=2)", "\t\tlong i;", "\t\tfor(i=0; i<chromWidth; i++)", "\t\t\tunsigned int b= src[6*i+0];", "\t\t\tunsigned int g= src[6*i+1];", "\t\t\tunsigned int r= src[6*i+2];", "\t\t\tunsigned int Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16;", "\t\t\tunsigned int V = ((RV*r + GV*g + BV*b)>>RGB2YUV_SHIFT) + 128;", "\t\t\tunsigned int U = ((RU*r + GU*g + BU*b)>>RGB2YUV_SHIFT) + 128;", "\t\t\tudst[i] \t= U;", "\t\t\tvdst[i] \t= V;", "\t\t\tydst[2*i] \t= Y;", "\t\t\tb= src[6*i+3];", "\t\t\tg= src[6*i+4];", "\t\t\tr= src[6*i+5];", "\t\t\tY = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16;", "\t\t\tydst[2*i+1] \t= Y;", "\t\tydst += lumStride;", "\t\tsrc += srcStride;", "\t\tfor(i=0; i<chromWidth; i++)", "\t\t\tunsigned int b= src[6*i+0];", "\t\t\tunsigned int g= src[6*i+1];", "\t\t\tunsigned int r= src[6*i+2];", "\t\t\tunsigned int Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16;", "\t\t\tydst[2*i] \t= Y;", "\t\t\tb= src[6*i+3];", "\t\t\tg= src[6*i+4];", "\t\t\tr= src[6*i+5];", "\t\t\tY = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16;", "\t\t\tydst[2*i+1] \t= Y;", "\t\tudst += chromStride;", "\t\tvdst += chromStride;", "\t\tydst += lumStride;", "\t\tsrc += srcStride;", "\t\t\t\"1:\t\t\t\t\\n\\t\"", "\t\t);", "\t\t\t\"1:\t\t\t\t\\n\\t\"", "\t\t\t\"movq %%mm0, %%mm1\t\t\\n\\t\"", "\t\t\t\"movq %%mm2, %%mm3\t\t\\n\\t\"", "\t\t);", "#endif", "\t\t);", "#endif", "#endif", "#endif", "\t\t);", "#endif", "\t\t);" ], "line_no": [ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 13, 77, 13, 77, 223, 77, 77, 465, 465, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 3, 9, 11, 171, 185, 187, 465, 77, 77, 77, 3, 3, 9, 11, 171, 185, 187, 465, 77, 77, 77, 3, 3, 3, 5, 9, 11, 171, 185, 187, 465, 539, 541, 171, 185, 187, 465, 19, 497, 539, 541, 497, 77, 469, 471, 539, 541, 171, 173, 187, 325, 325, 77, 459, 465, 77, 3, 5, 9, 11, 171, 185, 187, 465, 539, 541, 171, 185, 187, 465, 19, 497, 539, 541, 497, 77, 469, 471, 539, 541, 3, 5, 9, 11, 15, 19, 21, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 93, 95, 97, 49, 101, 103, 55, 57, 109, 61, 63, 65, 119, 71, 73, 75, 77, 129, 81, 133, 85, 137, 139, 141, 145, 147, 151, 153, 155, 157, 159, 161, 163, 165, 169, 171, 173, 175, 177, 179, 181, 183, 185, 187, 189, 191, 195, 197, 199, 201, 203, 205, 207, 209, 211, 213, 203, 205, 219, 221, 225, 227, 229, 231, 219, 235, 221, 239, 241, 243, 245, 247, 249, 251, 253, 255, 235, 221, 239, 263, 243, 267, 269, 271, 77, 275, 277, 281, 283, 285, 287, 291, 293, 295, 297, 77, 301, 303, 305, 307, 311, 317, 319, 321, 323, 325, 205, 329, 209, 333, 213, 325, 205, 255, 221, 347, 349, 351, 353, 255, 235, 221, 239, 263, 243, 367, 369, 371, 373, 375, 377, 235, 221, 239, 385, 243, 389, 175, 393, 271, 77, 275, 277, 405, 283, 409, 287, 415, 293, 295, 297, 77, 425, 303, 429, 307, 433, 437, 207, 443, 445, 447, 449, 451, 453, 455, 457, 459, 461, 463, 465, 469, 471, 473, 479, 481, 483, 487, 77, 491, 19, 497, 501, 503, 505, 509, 511, 513, 517, 519, 521, 525, 527, 529, 533, 535, 539, 541, 497, 501, 503, 505, 509, 521, 525, 527, 529, 533, 535, 469, 471, 539, 541, 187, 465, 187, 207, 209, 465, 77, 465, 77, 77, 77, 465, 77, 465 ] }
static inline void FUNC_0(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, long width, long height, long lumStride, long chromStride, long srcStride) { long VAR_0; const long VAR_1= width>>1; #ifdef HAVE_MMX for(VAR_0=0; VAR_0<height-2; VAR_0+=2) { long i; for(i=0; i<2; i++) { asm volatile( "mov %2, %%"REG_a" \n\t" "movq "MANGLE(bgr2YCoeff)", %%mm6 \n\t" "movq "MANGLE(w1111)", %%mm5 \n\t" "pxor %%mm7, %%mm7 \n\t" "lea (%%"REG_a", %%"REG_a", 2), %%"REG_d"\n\t" ASMALIGN(4) "1: \n\t" PREFETCH" 64(%0, %%"REG_d") \n\t" "movd (%0, %%"REG_d"), %%mm0 \n\t" "movd 3(%0, %%"REG_d"), %%mm1 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "movd 6(%0, %%"REG_d"), %%mm2 \n\t" "movd 9(%0, %%"REG_d"), %%mm3 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "pmaddwd %%mm6, %%mm0 \n\t" "pmaddwd %%mm6, %%mm1 \n\t" "pmaddwd %%mm6, %%mm2 \n\t" "pmaddwd %%mm6, %%mm3 \n\t" #ifndef FAST_BGR2YV12 "psrad $8, %%mm0 \n\t" "psrad $8, %%mm1 \n\t" "psrad $8, %%mm2 \n\t" "psrad $8, %%mm3 \n\t" #endif "packssdw %%mm1, %%mm0 \n\t" "packssdw %%mm3, %%mm2 \n\t" "pmaddwd %%mm5, %%mm0 \n\t" "pmaddwd %%mm5, %%mm2 \n\t" "packssdw %%mm2, %%mm0 \n\t" "psraw $7, %%mm0 \n\t" "movd 12(%0, %%"REG_d"), %%mm4 \n\t" "movd 15(%0, %%"REG_d"), %%mm1 \n\t" "punpcklbw %%mm7, %%mm4 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "movd 18(%0, %%"REG_d"), %%mm2 \n\t" "movd 21(%0, %%"REG_d"), %%mm3 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "pmaddwd %%mm6, %%mm4 \n\t" "pmaddwd %%mm6, %%mm1 \n\t" "pmaddwd %%mm6, %%mm2 \n\t" "pmaddwd %%mm6, %%mm3 \n\t" #ifndef FAST_BGR2YV12 "psrad $8, %%mm4 \n\t" "psrad $8, %%mm1 \n\t" "psrad $8, %%mm2 \n\t" "psrad $8, %%mm3 \n\t" #endif "packssdw %%mm1, %%mm4 \n\t" "packssdw %%mm3, %%mm2 \n\t" "pmaddwd %%mm5, %%mm4 \n\t" "pmaddwd %%mm5, %%mm2 \n\t" "add $24, %%"REG_d" \n\t" "packssdw %%mm2, %%mm4 \n\t" "psraw $7, %%mm4 \n\t" "packuswb %%mm4, %%mm0 \n\t" "paddusb "MANGLE(bgr2YOffset)", %%mm0 \n\t" MOVNTQ" %%mm0, (%1, %%"REG_a") \n\t" "add $8, %%"REG_a" \n\t" " js 1b \n\t" : : "r" (src+width*3), "r" (ydst+width), "g" (-width) : "%"REG_a, "%"REG_d ); ydst += lumStride; src += srcStride; } src -= srcStride*2; asm volatile( "mov %4, %%"REG_a" \n\t" "movq "MANGLE(w1111)", %%mm5 \n\t" "movq "MANGLE(bgr2UCoeff)", %%mm6 \n\t" "pxor %%mm7, %%mm7 \n\t" "lea (%%"REG_a", %%"REG_a", 2), %%"REG_d"\n\t" "add %%"REG_d", %%"REG_d" \n\t" ASMALIGN(4) "1: \n\t" PREFETCH" 64(%0, %%"REG_d") \n\t" PREFETCH" 64(%1, %%"REG_d") \n\t" #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) "movq (%0, %%"REG_d"), %%mm0 \n\t" "movq (%1, %%"REG_d"), %%mm1 \n\t" "movq 6(%0, %%"REG_d"), %%mm2 \n\t" "movq 6(%1, %%"REG_d"), %%mm3 \n\t" PAVGB" %%mm1, %%mm0 \n\t" PAVGB" %%mm3, %%mm2 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm2, %%mm3 \n\t" "psrlq $24, %%mm0 \n\t" "psrlq $24, %%mm2 \n\t" PAVGB" %%mm1, %%mm0 \n\t" PAVGB" %%mm3, %%mm2 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" #else "movd (%0, %%"REG_d"), %%mm0 \n\t" "movd (%1, %%"REG_d"), %%mm1 \n\t" "movd 3(%0, %%"REG_d"), %%mm2 \n\t" "movd 3(%1, %%"REG_d"), %%mm3 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "paddw %%mm1, %%mm0 \n\t" "paddw %%mm3, %%mm2 \n\t" "paddw %%mm2, %%mm0 \n\t" "movd 6(%0, %%"REG_d"), %%mm4 \n\t" "movd 6(%1, %%"REG_d"), %%mm1 \n\t" "movd 9(%0, %%"REG_d"), %%mm2 \n\t" "movd 9(%1, %%"REG_d"), %%mm3 \n\t" "punpcklbw %%mm7, %%mm4 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "paddw %%mm1, %%mm4 \n\t" "paddw %%mm3, %%mm2 \n\t" "paddw %%mm4, %%mm2 \n\t" "psrlw $2, %%mm0 \n\t" "psrlw $2, %%mm2 \n\t" #endif "movq "MANGLE(bgr2VCoeff)", %%mm1 \n\t" "movq "MANGLE(bgr2VCoeff)", %%mm3 \n\t" "pmaddwd %%mm0, %%mm1 \n\t" "pmaddwd %%mm2, %%mm3 \n\t" "pmaddwd %%mm6, %%mm0 \n\t" "pmaddwd %%mm6, %%mm2 \n\t" #ifndef FAST_BGR2YV12 "psrad $8, %%mm0 \n\t" "psrad $8, %%mm1 \n\t" "psrad $8, %%mm2 \n\t" "psrad $8, %%mm3 \n\t" #endif "packssdw %%mm2, %%mm0 \n\t" "packssdw %%mm3, %%mm1 \n\t" "pmaddwd %%mm5, %%mm0 \n\t" "pmaddwd %%mm5, %%mm1 \n\t" "packssdw %%mm1, %%mm0 \n\t" "psraw $7, %%mm0 \n\t" #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) "movq 12(%0, %%"REG_d"), %%mm4 \n\t" "movq 12(%1, %%"REG_d"), %%mm1 \n\t" "movq 18(%0, %%"REG_d"), %%mm2 \n\t" "movq 18(%1, %%"REG_d"), %%mm3 \n\t" PAVGB" %%mm1, %%mm4 \n\t" PAVGB" %%mm3, %%mm2 \n\t" "movq %%mm4, %%mm1 \n\t" "movq %%mm2, %%mm3 \n\t" "psrlq $24, %%mm4 \n\t" "psrlq $24, %%mm2 \n\t" PAVGB" %%mm1, %%mm4 \n\t" PAVGB" %%mm3, %%mm2 \n\t" "punpcklbw %%mm7, %%mm4 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" #else "movd 12(%0, %%"REG_d"), %%mm4 \n\t" "movd 12(%1, %%"REG_d"), %%mm1 \n\t" "movd 15(%0, %%"REG_d"), %%mm2 \n\t" "movd 15(%1, %%"REG_d"), %%mm3 \n\t" "punpcklbw %%mm7, %%mm4 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "paddw %%mm1, %%mm4 \n\t" "paddw %%mm3, %%mm2 \n\t" "paddw %%mm2, %%mm4 \n\t" "movd 18(%0, %%"REG_d"), %%mm5 \n\t" "movd 18(%1, %%"REG_d"), %%mm1 \n\t" "movd 21(%0, %%"REG_d"), %%mm2 \n\t" "movd 21(%1, %%"REG_d"), %%mm3 \n\t" "punpcklbw %%mm7, %%mm5 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "paddw %%mm1, %%mm5 \n\t" "paddw %%mm3, %%mm2 \n\t" "paddw %%mm5, %%mm2 \n\t" "movq "MANGLE(w1111)", %%mm5 \n\t" "psrlw $2, %%mm4 \n\t" "psrlw $2, %%mm2 \n\t" #endif "movq "MANGLE(bgr2VCoeff)", %%mm1 \n\t" "movq "MANGLE(bgr2VCoeff)", %%mm3 \n\t" "pmaddwd %%mm4, %%mm1 \n\t" "pmaddwd %%mm2, %%mm3 \n\t" "pmaddwd %%mm6, %%mm4 \n\t" "pmaddwd %%mm6, %%mm2 \n\t" #ifndef FAST_BGR2YV12 "psrad $8, %%mm4 \n\t" "psrad $8, %%mm1 \n\t" "psrad $8, %%mm2 \n\t" "psrad $8, %%mm3 \n\t" #endif "packssdw %%mm2, %%mm4 \n\t" "packssdw %%mm3, %%mm1 \n\t" "pmaddwd %%mm5, %%mm4 \n\t" "pmaddwd %%mm5, %%mm1 \n\t" "add $24, %%"REG_d" \n\t" "packssdw %%mm1, %%mm4 \n\t" "psraw $7, %%mm4 \n\t" "movq %%mm0, %%mm1 \n\t" "punpckldq %%mm4, %%mm0 \n\t" "punpckhdq %%mm4, %%mm1 \n\t" "packsswb %%mm1, %%mm0 \n\t" "paddb "MANGLE(bgr2UVOffset)", %%mm0 \n\t" "movd %%mm0, (%2, %%"REG_a") \n\t" "punpckhdq %%mm0, %%mm0 \n\t" "movd %%mm0, (%3, %%"REG_a") \n\t" "add $4, %%"REG_a" \n\t" " js 1b \n\t" : : "r" (src+VAR_1*6), "r" (src+srcStride+VAR_1*6), "r" (udst+VAR_1), "r" (vdst+VAR_1), "g" (-VAR_1) : "%"REG_a, "%"REG_d ); udst += chromStride; vdst += chromStride; src += srcStride*2; } asm volatile( EMMS" \n\t" SFENCE" \n\t" :::"memory"); #else VAR_0=0; #endif for(; VAR_0<height; VAR_0+=2) { long i; for(i=0; i<VAR_1; i++) { unsigned int b= src[6*i+0]; unsigned int g= src[6*i+1]; unsigned int r= src[6*i+2]; unsigned int Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16; unsigned int V = ((RV*r + GV*g + BV*b)>>RGB2YUV_SHIFT) + 128; unsigned int U = ((RU*r + GU*g + BU*b)>>RGB2YUV_SHIFT) + 128; udst[i] = U; vdst[i] = V; ydst[2*i] = Y; b= src[6*i+3]; g= src[6*i+4]; r= src[6*i+5]; Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16; ydst[2*i+1] = Y; } ydst += lumStride; src += srcStride; for(i=0; i<VAR_1; i++) { unsigned int b= src[6*i+0]; unsigned int g= src[6*i+1]; unsigned int r= src[6*i+2]; unsigned int Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16; ydst[2*i] = Y; b= src[6*i+3]; g= src[6*i+4]; r= src[6*i+5]; Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16; ydst[2*i+1] = Y; } udst += chromStride; vdst += chromStride; ydst += lumStride; src += srcStride; } }
[ "static inline void FUNC_0(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,\nlong width, long height,\nlong lumStride, long chromStride, long srcStride)\n{", "long VAR_0;", "const long VAR_1= width>>1;", "#ifdef HAVE_MMX\nfor(VAR_0=0; VAR_0<height-2; VAR_0+=2)", "{", "long i;", "for(i=0; i<2; i++)", "{", "asm volatile(\n\"mov %2, %%\"REG_a\"\t\t\\n\\t\"\n\"movq \"MANGLE(bgr2YCoeff)\", %%mm6\t\t\\n\\t\"\n\"movq \"MANGLE(w1111)\", %%mm5\t\t\\n\\t\"\n\"pxor %%mm7, %%mm7\t\t\\n\\t\"\n\"lea (%%\"REG_a\", %%\"REG_a\", 2), %%\"REG_d\"\\n\\t\"\nASMALIGN(4)\n\"1:\t\t\t\t\\n\\t\"\nPREFETCH\" 64(%0, %%\"REG_d\")\t\\n\\t\"\n\"movd (%0, %%\"REG_d\"), %%mm0\t\\n\\t\"\n\"movd 3(%0, %%\"REG_d\"), %%mm1\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm0\t\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm1\t\t\\n\\t\"\n\"movd 6(%0, %%\"REG_d\"), %%mm2\t\\n\\t\"\n\"movd 9(%0, %%\"REG_d\"), %%mm3\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm2\t\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm3\t\t\\n\\t\"\n\"pmaddwd %%mm6, %%mm0\t\t\\n\\t\"\n\"pmaddwd %%mm6, %%mm1\t\t\\n\\t\"\n\"pmaddwd %%mm6, %%mm2\t\t\\n\\t\"\n\"pmaddwd %%mm6, %%mm3\t\t\\n\\t\"\n#ifndef FAST_BGR2YV12\n\"psrad $8, %%mm0\t\t\\n\\t\"\n\"psrad $8, %%mm1\t\t\\n\\t\"\n\"psrad $8, %%mm2\t\t\\n\\t\"\n\"psrad $8, %%mm3\t\t\\n\\t\"\n#endif\n\"packssdw %%mm1, %%mm0\t\t\\n\\t\"\n\"packssdw %%mm3, %%mm2\t\t\\n\\t\"\n\"pmaddwd %%mm5, %%mm0\t\t\\n\\t\"\n\"pmaddwd %%mm5, %%mm2\t\t\\n\\t\"\n\"packssdw %%mm2, %%mm0\t\t\\n\\t\"\n\"psraw $7, %%mm0\t\t\\n\\t\"\n\"movd 12(%0, %%\"REG_d\"), %%mm4\t\\n\\t\"\n\"movd 15(%0, %%\"REG_d\"), %%mm1\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm4\t\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm1\t\t\\n\\t\"\n\"movd 18(%0, %%\"REG_d\"), %%mm2\t\\n\\t\"\n\"movd 21(%0, %%\"REG_d\"), %%mm3\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm2\t\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm3\t\t\\n\\t\"\n\"pmaddwd %%mm6, %%mm4\t\t\\n\\t\"\n\"pmaddwd %%mm6, %%mm1\t\t\\n\\t\"\n\"pmaddwd %%mm6, %%mm2\t\t\\n\\t\"\n\"pmaddwd %%mm6, %%mm3\t\t\\n\\t\"\n#ifndef FAST_BGR2YV12\n\"psrad $8, %%mm4\t\t\\n\\t\"\n\"psrad $8, %%mm1\t\t\\n\\t\"\n\"psrad $8, %%mm2\t\t\\n\\t\"\n\"psrad $8, %%mm3\t\t\\n\\t\"\n#endif\n\"packssdw %%mm1, %%mm4\t\t\\n\\t\"\n\"packssdw %%mm3, %%mm2\t\t\\n\\t\"\n\"pmaddwd %%mm5, %%mm4\t\t\\n\\t\"\n\"pmaddwd %%mm5, %%mm2\t\t\\n\\t\"\n\"add $24, %%\"REG_d\"\t\t\\n\\t\"\n\"packssdw %%mm2, %%mm4\t\t\\n\\t\"\n\"psraw $7, %%mm4\t\t\\n\\t\"\n\"packuswb %%mm4, %%mm0\t\t\\n\\t\"\n\"paddusb \"MANGLE(bgr2YOffset)\", %%mm0\t\\n\\t\"\nMOVNTQ\" %%mm0, (%1, %%\"REG_a\")\t\\n\\t\"\n\"add $8, %%\"REG_a\"\t\t\\n\\t\"\n\" js 1b\t\t\t\t\\n\\t\"\n: : \"r\" (src+width*3), \"r\" (ydst+width), \"g\" (-width)\n: \"%\"REG_a, \"%\"REG_d\n);", "ydst += lumStride;", "src += srcStride;", "}", "src -= srcStride*2;", "asm volatile(\n\"mov %4, %%\"REG_a\"\t\t\\n\\t\"\n\"movq \"MANGLE(w1111)\", %%mm5\t\t\\n\\t\"\n\"movq \"MANGLE(bgr2UCoeff)\", %%mm6\t\t\\n\\t\"\n\"pxor %%mm7, %%mm7\t\t\\n\\t\"\n\"lea (%%\"REG_a\", %%\"REG_a\", 2), %%\"REG_d\"\\n\\t\"\n\"add %%\"REG_d\", %%\"REG_d\"\t\\n\\t\"\nASMALIGN(4)\n\"1:\t\t\t\t\\n\\t\"\nPREFETCH\" 64(%0, %%\"REG_d\")\t\\n\\t\"\nPREFETCH\" 64(%1, %%\"REG_d\")\t\\n\\t\"\n#if defined (HAVE_MMX2) || defined (HAVE_3DNOW)\n\"movq (%0, %%\"REG_d\"), %%mm0\t\\n\\t\"\n\"movq (%1, %%\"REG_d\"), %%mm1\t\\n\\t\"\n\"movq 6(%0, %%\"REG_d\"), %%mm2\t\\n\\t\"\n\"movq 6(%1, %%\"REG_d\"), %%mm3\t\\n\\t\"\nPAVGB\" %%mm1, %%mm0\t\t\\n\\t\"\nPAVGB\" %%mm3, %%mm2\t\t\\n\\t\"\n\"movq %%mm0, %%mm1\t\t\\n\\t\"\n\"movq %%mm2, %%mm3\t\t\\n\\t\"\n\"psrlq $24, %%mm0\t\t\\n\\t\"\n\"psrlq $24, %%mm2\t\t\\n\\t\"\nPAVGB\" %%mm1, %%mm0\t\t\\n\\t\"\nPAVGB\" %%mm3, %%mm2\t\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm0\t\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm2\t\t\\n\\t\"\n#else\n\"movd (%0, %%\"REG_d\"), %%mm0\t\\n\\t\"\n\"movd (%1, %%\"REG_d\"), %%mm1\t\\n\\t\"\n\"movd 3(%0, %%\"REG_d\"), %%mm2\t\\n\\t\"\n\"movd 3(%1, %%\"REG_d\"), %%mm3\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm0\t\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm1\t\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm2\t\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm3\t\t\\n\\t\"\n\"paddw %%mm1, %%mm0\t\t\\n\\t\"\n\"paddw %%mm3, %%mm2\t\t\\n\\t\"\n\"paddw %%mm2, %%mm0\t\t\\n\\t\"\n\"movd 6(%0, %%\"REG_d\"), %%mm4\t\\n\\t\"\n\"movd 6(%1, %%\"REG_d\"), %%mm1\t\\n\\t\"\n\"movd 9(%0, %%\"REG_d\"), %%mm2\t\\n\\t\"\n\"movd 9(%1, %%\"REG_d\"), %%mm3\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm4\t\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm1\t\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm2\t\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm3\t\t\\n\\t\"\n\"paddw %%mm1, %%mm4\t\t\\n\\t\"\n\"paddw %%mm3, %%mm2\t\t\\n\\t\"\n\"paddw %%mm4, %%mm2\t\t\\n\\t\"\n\"psrlw $2, %%mm0\t\t\\n\\t\"\n\"psrlw $2, %%mm2\t\t\\n\\t\"\n#endif\n\"movq \"MANGLE(bgr2VCoeff)\", %%mm1\t\t\\n\\t\"\n\"movq \"MANGLE(bgr2VCoeff)\", %%mm3\t\t\\n\\t\"\n\"pmaddwd %%mm0, %%mm1\t\t\\n\\t\"\n\"pmaddwd %%mm2, %%mm3\t\t\\n\\t\"\n\"pmaddwd %%mm6, %%mm0\t\t\\n\\t\"\n\"pmaddwd %%mm6, %%mm2\t\t\\n\\t\"\n#ifndef FAST_BGR2YV12\n\"psrad $8, %%mm0\t\t\\n\\t\"\n\"psrad $8, %%mm1\t\t\\n\\t\"\n\"psrad $8, %%mm2\t\t\\n\\t\"\n\"psrad $8, %%mm3\t\t\\n\\t\"\n#endif\n\"packssdw %%mm2, %%mm0\t\t\\n\\t\"\n\"packssdw %%mm3, %%mm1\t\t\\n\\t\"\n\"pmaddwd %%mm5, %%mm0\t\t\\n\\t\"\n\"pmaddwd %%mm5, %%mm1\t\t\\n\\t\"\n\"packssdw %%mm1, %%mm0\t\t\\n\\t\"\n\"psraw $7, %%mm0\t\t\\n\\t\"\n#if defined (HAVE_MMX2) || defined (HAVE_3DNOW)\n\"movq 12(%0, %%\"REG_d\"), %%mm4\t\\n\\t\"\n\"movq 12(%1, %%\"REG_d\"), %%mm1\t\\n\\t\"\n\"movq 18(%0, %%\"REG_d\"), %%mm2\t\\n\\t\"\n\"movq 18(%1, %%\"REG_d\"), %%mm3\t\\n\\t\"\nPAVGB\" %%mm1, %%mm4\t\t\\n\\t\"\nPAVGB\" %%mm3, %%mm2\t\t\\n\\t\"\n\"movq %%mm4, %%mm1\t\t\\n\\t\"\n\"movq %%mm2, %%mm3\t\t\\n\\t\"\n\"psrlq $24, %%mm4\t\t\\n\\t\"\n\"psrlq $24, %%mm2\t\t\\n\\t\"\nPAVGB\" %%mm1, %%mm4\t\t\\n\\t\"\nPAVGB\" %%mm3, %%mm2\t\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm4\t\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm2\t\t\\n\\t\"\n#else\n\"movd 12(%0, %%\"REG_d\"), %%mm4\t\\n\\t\"\n\"movd 12(%1, %%\"REG_d\"), %%mm1\t\\n\\t\"\n\"movd 15(%0, %%\"REG_d\"), %%mm2\t\\n\\t\"\n\"movd 15(%1, %%\"REG_d\"), %%mm3\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm4\t\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm1\t\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm2\t\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm3\t\t\\n\\t\"\n\"paddw %%mm1, %%mm4\t\t\\n\\t\"\n\"paddw %%mm3, %%mm2\t\t\\n\\t\"\n\"paddw %%mm2, %%mm4\t\t\\n\\t\"\n\"movd 18(%0, %%\"REG_d\"), %%mm5\t\\n\\t\"\n\"movd 18(%1, %%\"REG_d\"), %%mm1\t\\n\\t\"\n\"movd 21(%0, %%\"REG_d\"), %%mm2\t\\n\\t\"\n\"movd 21(%1, %%\"REG_d\"), %%mm3\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm5\t\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm1\t\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm2\t\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm3\t\t\\n\\t\"\n\"paddw %%mm1, %%mm5\t\t\\n\\t\"\n\"paddw %%mm3, %%mm2\t\t\\n\\t\"\n\"paddw %%mm5, %%mm2\t\t\\n\\t\"\n\"movq \"MANGLE(w1111)\", %%mm5\t\t\\n\\t\"\n\"psrlw $2, %%mm4\t\t\\n\\t\"\n\"psrlw $2, %%mm2\t\t\\n\\t\"\n#endif\n\"movq \"MANGLE(bgr2VCoeff)\", %%mm1\t\t\\n\\t\"\n\"movq \"MANGLE(bgr2VCoeff)\", %%mm3\t\t\\n\\t\"\n\"pmaddwd %%mm4, %%mm1\t\t\\n\\t\"\n\"pmaddwd %%mm2, %%mm3\t\t\\n\\t\"\n\"pmaddwd %%mm6, %%mm4\t\t\\n\\t\"\n\"pmaddwd %%mm6, %%mm2\t\t\\n\\t\"\n#ifndef FAST_BGR2YV12\n\"psrad $8, %%mm4\t\t\\n\\t\"\n\"psrad $8, %%mm1\t\t\\n\\t\"\n\"psrad $8, %%mm2\t\t\\n\\t\"\n\"psrad $8, %%mm3\t\t\\n\\t\"\n#endif\n\"packssdw %%mm2, %%mm4\t\t\\n\\t\"\n\"packssdw %%mm3, %%mm1\t\t\\n\\t\"\n\"pmaddwd %%mm5, %%mm4\t\t\\n\\t\"\n\"pmaddwd %%mm5, %%mm1\t\t\\n\\t\"\n\"add $24, %%\"REG_d\"\t\t\\n\\t\"\n\"packssdw %%mm1, %%mm4\t\t\\n\\t\"\n\"psraw $7, %%mm4\t\t\\n\\t\"\n\"movq %%mm0, %%mm1\t\t\\n\\t\"\n\"punpckldq %%mm4, %%mm0\t\t\\n\\t\"\n\"punpckhdq %%mm4, %%mm1\t\t\\n\\t\"\n\"packsswb %%mm1, %%mm0\t\t\\n\\t\"\n\"paddb \"MANGLE(bgr2UVOffset)\", %%mm0\t\\n\\t\"\n\"movd %%mm0, (%2, %%\"REG_a\")\t\\n\\t\"\n\"punpckhdq %%mm0, %%mm0\t\t\\n\\t\"\n\"movd %%mm0, (%3, %%\"REG_a\")\t\\n\\t\"\n\"add $4, %%\"REG_a\"\t\t\\n\\t\"\n\" js 1b\t\t\t\t\\n\\t\"\n: : \"r\" (src+VAR_1*6), \"r\" (src+srcStride+VAR_1*6), \"r\" (udst+VAR_1), \"r\" (vdst+VAR_1), \"g\" (-VAR_1)\n: \"%\"REG_a, \"%\"REG_d\n);", "udst += chromStride;", "vdst += chromStride;", "src += srcStride*2;", "}", "asm volatile( EMMS\" \\n\\t\"\nSFENCE\" \\n\\t\"\n:::\"memory\");", "#else\nVAR_0=0;", "#endif\nfor(; VAR_0<height; VAR_0+=2)", "{", "long i;", "for(i=0; i<VAR_1; i++)", "{", "unsigned int b= src[6*i+0];", "unsigned int g= src[6*i+1];", "unsigned int r= src[6*i+2];", "unsigned int Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16;", "unsigned int V = ((RV*r + GV*g + BV*b)>>RGB2YUV_SHIFT) + 128;", "unsigned int U = ((RU*r + GU*g + BU*b)>>RGB2YUV_SHIFT) + 128;", "udst[i] \t= U;", "vdst[i] \t= V;", "ydst[2*i] \t= Y;", "b= src[6*i+3];", "g= src[6*i+4];", "r= src[6*i+5];", "Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16;", "ydst[2*i+1] \t= Y;", "}", "ydst += lumStride;", "src += srcStride;", "for(i=0; i<VAR_1; i++)", "{", "unsigned int b= src[6*i+0];", "unsigned int g= src[6*i+1];", "unsigned int r= src[6*i+2];", "unsigned int Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16;", "ydst[2*i] \t= Y;", "b= src[6*i+3];", "g= src[6*i+4];", "r= src[6*i+5];", "Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16;", "ydst[2*i+1] \t= Y;", "}", "udst += chromStride;", "vdst += chromStride;", "ydst += lumStride;", "src += srcStride;", "}", "}" ]
[ 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 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 ], [ 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, 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, 145, 147, 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, 275, 277, 281, 283, 285, 287, 289, 291, 293, 295, 297, 299, 301, 303, 305, 307, 309, 311, 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, 405, 407, 409, 411, 413, 415, 417, 419, 421, 423, 425, 427, 429, 431, 433, 435, 437, 441, 443, 445, 447, 449, 451, 453, 455, 457, 459, 461, 463, 465 ], [ 469 ], [ 471 ], [ 473 ], [ 475 ], [ 479, 481, 483 ], [ 485, 487 ], [ 489, 491 ], [ 493 ], [ 495 ], [ 497 ], [ 499 ], [ 501 ], [ 503 ], [ 505 ], [ 509 ], [ 511 ], [ 513 ], [ 517 ], [ 519 ], [ 521 ], [ 525 ], [ 527 ], [ 529 ], [ 533 ], [ 535 ], [ 537 ], [ 539 ], [ 541 ], [ 545 ], [ 547 ], [ 549 ], [ 551 ], [ 553 ], [ 557 ], [ 561 ], [ 565 ], [ 567 ], [ 569 ], [ 573 ], [ 575 ], [ 577 ], [ 579 ], [ 581 ], [ 583 ], [ 585 ], [ 587 ], [ 589 ] ]
21,763
static inline void gen_mtcr(CPUTriCoreState *env, DisasContext *ctx, TCGv r1, int32_t offset) { if (ctx->hflags & TRICORE_HFLAG_SM) { /* since we're caching PSW make this a special case */ if (offset == 0xfe04) { gen_helper_psw_write(cpu_env, r1); } else { switch (offset) { #include "csfr.def" } } } else { /* generate privilege trap */ } }
true
qemu
40a1f64b468ee247fca3b237f0b89f066e59626c
static inline void gen_mtcr(CPUTriCoreState *env, DisasContext *ctx, TCGv r1, int32_t offset) { if (ctx->hflags & TRICORE_HFLAG_SM) { if (offset == 0xfe04) { gen_helper_psw_write(cpu_env, r1); } else { switch (offset) { #include "csfr.def" } } } else { } }
{ "code": [ " if (ctx->hflags & TRICORE_HFLAG_SM) {" ], "line_no": [ 7 ] }
static inline void FUNC_0(CPUTriCoreState *VAR_0, DisasContext *VAR_1, TCGv VAR_2, int32_t VAR_3) { if (VAR_1->hflags & TRICORE_HFLAG_SM) { if (VAR_3 == 0xfe04) { gen_helper_psw_write(cpu_env, VAR_2); } else { switch (VAR_3) { #include "csfr.def" } } } else { } }
[ "static inline void FUNC_0(CPUTriCoreState *VAR_0, DisasContext *VAR_1, TCGv VAR_2,\nint32_t VAR_3)\n{", "if (VAR_1->hflags & TRICORE_HFLAG_SM) {", "if (VAR_3 == 0xfe04) {", "gen_helper_psw_write(cpu_env, VAR_2);", "} else {", "switch (VAR_3) {", "#include \"csfr.def\"\n}", "}", "} else {", "}", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ] ]
21,764
m_free(struct mbuf *m) { DEBUG_CALL("m_free"); DEBUG_ARG("m = %lx", (long )m); if(m) { /* Remove from m_usedlist */ if (m->m_flags & M_USEDLIST) remque(m); /* If it's M_EXT, free() it */ if (m->m_flags & M_EXT) free(m->m_ext); /* * Either free() it or put it on the free list */ if (m->m_flags & M_DOFREE) { free(m); m->slirp->mbuf_alloced--; } else if ((m->m_flags & M_FREELIST) == 0) { insque(m,&m->slirp->m_freelist); m->m_flags = M_FREELIST; /* Clobber other flags */ } } /* if(m) */ }
true
qemu
e0cf6d15e374c8db39acda551845ecc62f5205a3
m_free(struct mbuf *m) { DEBUG_CALL("m_free"); DEBUG_ARG("m = %lx", (long )m); if(m) { if (m->m_flags & M_USEDLIST) remque(m); if (m->m_flags & M_EXT) free(m->m_ext); if (m->m_flags & M_DOFREE) { free(m); m->slirp->mbuf_alloced--; } else if ((m->m_flags & M_FREELIST) == 0) { insque(m,&m->slirp->m_freelist); m->m_flags = M_FREELIST; } } }
{ "code": [ "\t\tfree(m);" ], "line_no": [ 39 ] }
FUNC_0(struct mbuf *VAR_0) { DEBUG_CALL("FUNC_0"); DEBUG_ARG("VAR_0 = %lx", (long )VAR_0); if(VAR_0) { if (VAR_0->m_flags & M_USEDLIST) remque(VAR_0); if (VAR_0->m_flags & M_EXT) free(VAR_0->m_ext); if (VAR_0->m_flags & M_DOFREE) { free(VAR_0); VAR_0->slirp->mbuf_alloced--; } else if ((VAR_0->m_flags & M_FREELIST) == 0) { insque(VAR_0,&VAR_0->slirp->m_freelist); VAR_0->m_flags = M_FREELIST; } } }
[ "FUNC_0(struct mbuf *VAR_0)\n{", "DEBUG_CALL(\"FUNC_0\");", "DEBUG_ARG(\"VAR_0 = %lx\", (long )VAR_0);", "if(VAR_0) {", "if (VAR_0->m_flags & M_USEDLIST)\nremque(VAR_0);", "if (VAR_0->m_flags & M_EXT)\nfree(VAR_0->m_ext);", "if (VAR_0->m_flags & M_DOFREE) {", "free(VAR_0);", "VAR_0->slirp->mbuf_alloced--;", "} else if ((VAR_0->m_flags & M_FREELIST) == 0) {", "insque(VAR_0,&VAR_0->slirp->m_freelist);", "VAR_0->m_flags = M_FREELIST;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 7 ], [ 9 ], [ 13 ], [ 17, 19 ], [ 25, 27 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ] ]
21,768
static int qcow_open(BlockDriverState *bs, const char *filename, int flags) { BDRVQcowState *s = bs->opaque; int len, i, shift, ret; QCowHeader header; ret = bdrv_file_open(&s->hd, filename, flags | BDRV_O_AUTOGROW); if (ret < 0) return ret; if (bdrv_pread(s->hd, 0, &header, sizeof(header)) != sizeof(header)) goto fail; be32_to_cpus(&header.magic); be32_to_cpus(&header.version); be64_to_cpus(&header.backing_file_offset); be32_to_cpus(&header.backing_file_size); be64_to_cpus(&header.size); be32_to_cpus(&header.cluster_bits); be32_to_cpus(&header.crypt_method); be64_to_cpus(&header.l1_table_offset); be32_to_cpus(&header.l1_size); be64_to_cpus(&header.refcount_table_offset); be32_to_cpus(&header.refcount_table_clusters); be64_to_cpus(&header.snapshots_offset); be32_to_cpus(&header.nb_snapshots); if (header.magic != QCOW_MAGIC || header.version != QCOW_VERSION) goto fail; if (header.size <= 1 || header.cluster_bits < 9 || header.cluster_bits > 16) goto fail; if (header.crypt_method > QCOW_CRYPT_AES) goto fail; s->crypt_method_header = header.crypt_method; if (s->crypt_method_header) bs->encrypted = 1; s->cluster_bits = header.cluster_bits; s->cluster_size = 1 << s->cluster_bits; s->cluster_sectors = 1 << (s->cluster_bits - 9); s->l2_bits = s->cluster_bits - 3; /* L2 is always one cluster */ s->l2_size = 1 << s->l2_bits; bs->total_sectors = header.size / 512; s->csize_shift = (62 - (s->cluster_bits - 8)); s->csize_mask = (1 << (s->cluster_bits - 8)) - 1; s->cluster_offset_mask = (1LL << s->csize_shift) - 1; s->refcount_table_offset = header.refcount_table_offset; s->refcount_table_size = header.refcount_table_clusters << (s->cluster_bits - 3); s->snapshots_offset = header.snapshots_offset; s->nb_snapshots = header.nb_snapshots; /* read the level 1 table */ s->l1_size = header.l1_size; shift = s->cluster_bits + s->l2_bits; s->l1_vm_state_index = (header.size + (1LL << shift) - 1) >> shift; /* the L1 table must contain at least enough entries to put header.size bytes */ if (s->l1_size < s->l1_vm_state_index) goto fail; s->l1_table_offset = header.l1_table_offset; s->l1_table = qemu_malloc(s->l1_size * sizeof(uint64_t)); if (!s->l1_table) goto fail; if (bdrv_pread(s->hd, s->l1_table_offset, s->l1_table, s->l1_size * sizeof(uint64_t)) != s->l1_size * sizeof(uint64_t)) goto fail; for(i = 0;i < s->l1_size; i++) { be64_to_cpus(&s->l1_table[i]); } /* alloc L2 cache */ s->l2_cache = qemu_malloc(s->l2_size * L2_CACHE_SIZE * sizeof(uint64_t)); if (!s->l2_cache) goto fail; s->cluster_cache = qemu_malloc(s->cluster_size); if (!s->cluster_cache) goto fail; /* one more sector for decompressed data alignment */ s->cluster_data = qemu_malloc(s->cluster_size + 512); if (!s->cluster_data) goto fail; s->cluster_cache_offset = -1; if (refcount_init(bs) < 0) goto fail; /* read the backing file name */ if (header.backing_file_offset != 0) { len = header.backing_file_size; if (len > 1023) len = 1023; if (bdrv_pread(s->hd, header.backing_file_offset, bs->backing_file, len) != len) goto fail; bs->backing_file[len] = '\0'; } if (qcow_read_snapshots(bs) < 0) goto fail; #ifdef DEBUG_ALLOC check_refcounts(bs); #endif return 0; fail: qcow_free_snapshots(bs); refcount_close(bs); qemu_free(s->l1_table); qemu_free(s->l2_cache); qemu_free(s->cluster_cache); qemu_free(s->cluster_data); bdrv_delete(s->hd); return -1; }
true
qemu
b5eff355460643d09e533024360fe0522f368c07
static int qcow_open(BlockDriverState *bs, const char *filename, int flags) { BDRVQcowState *s = bs->opaque; int len, i, shift, ret; QCowHeader header; ret = bdrv_file_open(&s->hd, filename, flags | BDRV_O_AUTOGROW); if (ret < 0) return ret; if (bdrv_pread(s->hd, 0, &header, sizeof(header)) != sizeof(header)) goto fail; be32_to_cpus(&header.magic); be32_to_cpus(&header.version); be64_to_cpus(&header.backing_file_offset); be32_to_cpus(&header.backing_file_size); be64_to_cpus(&header.size); be32_to_cpus(&header.cluster_bits); be32_to_cpus(&header.crypt_method); be64_to_cpus(&header.l1_table_offset); be32_to_cpus(&header.l1_size); be64_to_cpus(&header.refcount_table_offset); be32_to_cpus(&header.refcount_table_clusters); be64_to_cpus(&header.snapshots_offset); be32_to_cpus(&header.nb_snapshots); if (header.magic != QCOW_MAGIC || header.version != QCOW_VERSION) goto fail; if (header.size <= 1 || header.cluster_bits < 9 || header.cluster_bits > 16) goto fail; if (header.crypt_method > QCOW_CRYPT_AES) goto fail; s->crypt_method_header = header.crypt_method; if (s->crypt_method_header) bs->encrypted = 1; s->cluster_bits = header.cluster_bits; s->cluster_size = 1 << s->cluster_bits; s->cluster_sectors = 1 << (s->cluster_bits - 9); s->l2_bits = s->cluster_bits - 3; s->l2_size = 1 << s->l2_bits; bs->total_sectors = header.size / 512; s->csize_shift = (62 - (s->cluster_bits - 8)); s->csize_mask = (1 << (s->cluster_bits - 8)) - 1; s->cluster_offset_mask = (1LL << s->csize_shift) - 1; s->refcount_table_offset = header.refcount_table_offset; s->refcount_table_size = header.refcount_table_clusters << (s->cluster_bits - 3); s->snapshots_offset = header.snapshots_offset; s->nb_snapshots = header.nb_snapshots; s->l1_size = header.l1_size; shift = s->cluster_bits + s->l2_bits; s->l1_vm_state_index = (header.size + (1LL << shift) - 1) >> shift; if (s->l1_size < s->l1_vm_state_index) goto fail; s->l1_table_offset = header.l1_table_offset; s->l1_table = qemu_malloc(s->l1_size * sizeof(uint64_t)); if (!s->l1_table) goto fail; if (bdrv_pread(s->hd, s->l1_table_offset, s->l1_table, s->l1_size * sizeof(uint64_t)) != s->l1_size * sizeof(uint64_t)) goto fail; for(i = 0;i < s->l1_size; i++) { be64_to_cpus(&s->l1_table[i]); } s->l2_cache = qemu_malloc(s->l2_size * L2_CACHE_SIZE * sizeof(uint64_t)); if (!s->l2_cache) goto fail; s->cluster_cache = qemu_malloc(s->cluster_size); if (!s->cluster_cache) goto fail; s->cluster_data = qemu_malloc(s->cluster_size + 512); if (!s->cluster_data) goto fail; s->cluster_cache_offset = -1; if (refcount_init(bs) < 0) goto fail; if (header.backing_file_offset != 0) { len = header.backing_file_size; if (len > 1023) len = 1023; if (bdrv_pread(s->hd, header.backing_file_offset, bs->backing_file, len) != len) goto fail; bs->backing_file[len] = '\0'; } if (qcow_read_snapshots(bs) < 0) goto fail; #ifdef DEBUG_ALLOC check_refcounts(bs); #endif return 0; fail: qcow_free_snapshots(bs); refcount_close(bs); qemu_free(s->l1_table); qemu_free(s->l2_cache); qemu_free(s->cluster_cache); qemu_free(s->cluster_data); 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": [ 13, 13, 13, 203, 203 ] }
static int FUNC_0(BlockDriverState *VAR_0, const char *VAR_1, int VAR_2) { BDRVQcowState *s = VAR_0->opaque; int VAR_3, VAR_4, VAR_5, VAR_6; QCowHeader header; VAR_6 = bdrv_file_open(&s->hd, VAR_1, VAR_2 | BDRV_O_AUTOGROW); if (VAR_6 < 0) return VAR_6; if (bdrv_pread(s->hd, 0, &header, sizeof(header)) != sizeof(header)) goto fail; be32_to_cpus(&header.magic); be32_to_cpus(&header.version); be64_to_cpus(&header.backing_file_offset); be32_to_cpus(&header.backing_file_size); be64_to_cpus(&header.size); be32_to_cpus(&header.cluster_bits); be32_to_cpus(&header.crypt_method); be64_to_cpus(&header.l1_table_offset); be32_to_cpus(&header.l1_size); be64_to_cpus(&header.refcount_table_offset); be32_to_cpus(&header.refcount_table_clusters); be64_to_cpus(&header.snapshots_offset); be32_to_cpus(&header.nb_snapshots); if (header.magic != QCOW_MAGIC || header.version != QCOW_VERSION) goto fail; if (header.size <= 1 || header.cluster_bits < 9 || header.cluster_bits > 16) goto fail; if (header.crypt_method > QCOW_CRYPT_AES) goto fail; s->crypt_method_header = header.crypt_method; if (s->crypt_method_header) VAR_0->encrypted = 1; s->cluster_bits = header.cluster_bits; s->cluster_size = 1 << s->cluster_bits; s->cluster_sectors = 1 << (s->cluster_bits - 9); s->l2_bits = s->cluster_bits - 3; s->l2_size = 1 << s->l2_bits; VAR_0->total_sectors = header.size / 512; s->csize_shift = (62 - (s->cluster_bits - 8)); s->csize_mask = (1 << (s->cluster_bits - 8)) - 1; s->cluster_offset_mask = (1LL << s->csize_shift) - 1; s->refcount_table_offset = header.refcount_table_offset; s->refcount_table_size = header.refcount_table_clusters << (s->cluster_bits - 3); s->snapshots_offset = header.snapshots_offset; s->nb_snapshots = header.nb_snapshots; s->l1_size = header.l1_size; VAR_5 = s->cluster_bits + s->l2_bits; s->l1_vm_state_index = (header.size + (1LL << VAR_5) - 1) >> VAR_5; if (s->l1_size < s->l1_vm_state_index) goto fail; s->l1_table_offset = header.l1_table_offset; s->l1_table = qemu_malloc(s->l1_size * sizeof(uint64_t)); if (!s->l1_table) goto fail; if (bdrv_pread(s->hd, s->l1_table_offset, s->l1_table, s->l1_size * sizeof(uint64_t)) != s->l1_size * sizeof(uint64_t)) goto fail; for(VAR_4 = 0;VAR_4 < s->l1_size; VAR_4++) { be64_to_cpus(&s->l1_table[VAR_4]); } s->l2_cache = qemu_malloc(s->l2_size * L2_CACHE_SIZE * sizeof(uint64_t)); if (!s->l2_cache) goto fail; s->cluster_cache = qemu_malloc(s->cluster_size); if (!s->cluster_cache) goto fail; s->cluster_data = qemu_malloc(s->cluster_size + 512); if (!s->cluster_data) goto fail; s->cluster_cache_offset = -1; if (refcount_init(VAR_0) < 0) goto fail; if (header.backing_file_offset != 0) { VAR_3 = header.backing_file_size; if (VAR_3 > 1023) VAR_3 = 1023; if (bdrv_pread(s->hd, header.backing_file_offset, VAR_0->backing_file, VAR_3) != VAR_3) goto fail; VAR_0->backing_file[VAR_3] = '\0'; } if (qcow_read_snapshots(VAR_0) < 0) goto fail; #ifdef DEBUG_ALLOC check_refcounts(VAR_0); #endif return 0; fail: qcow_free_snapshots(VAR_0); refcount_close(VAR_0); qemu_free(s->l1_table); qemu_free(s->l2_cache); qemu_free(s->cluster_cache); qemu_free(s->cluster_data); bdrv_delete(s->hd); return -1; }
[ "static int FUNC_0(BlockDriverState *VAR_0, const char *VAR_1, int VAR_2)\n{", "BDRVQcowState *s = VAR_0->opaque;", "int VAR_3, VAR_4, VAR_5, VAR_6;", "QCowHeader header;", "VAR_6 = bdrv_file_open(&s->hd, VAR_1, VAR_2 | BDRV_O_AUTOGROW);", "if (VAR_6 < 0)\nreturn VAR_6;", "if (bdrv_pread(s->hd, 0, &header, sizeof(header)) != sizeof(header))\ngoto fail;", "be32_to_cpus(&header.magic);", "be32_to_cpus(&header.version);", "be64_to_cpus(&header.backing_file_offset);", "be32_to_cpus(&header.backing_file_size);", "be64_to_cpus(&header.size);", "be32_to_cpus(&header.cluster_bits);", "be32_to_cpus(&header.crypt_method);", "be64_to_cpus(&header.l1_table_offset);", "be32_to_cpus(&header.l1_size);", "be64_to_cpus(&header.refcount_table_offset);", "be32_to_cpus(&header.refcount_table_clusters);", "be64_to_cpus(&header.snapshots_offset);", "be32_to_cpus(&header.nb_snapshots);", "if (header.magic != QCOW_MAGIC || header.version != QCOW_VERSION)\ngoto fail;", "if (header.size <= 1 ||\nheader.cluster_bits < 9 ||\nheader.cluster_bits > 16)\ngoto fail;", "if (header.crypt_method > QCOW_CRYPT_AES)\ngoto fail;", "s->crypt_method_header = header.crypt_method;", "if (s->crypt_method_header)\nVAR_0->encrypted = 1;", "s->cluster_bits = header.cluster_bits;", "s->cluster_size = 1 << s->cluster_bits;", "s->cluster_sectors = 1 << (s->cluster_bits - 9);", "s->l2_bits = s->cluster_bits - 3;", "s->l2_size = 1 << s->l2_bits;", "VAR_0->total_sectors = header.size / 512;", "s->csize_shift = (62 - (s->cluster_bits - 8));", "s->csize_mask = (1 << (s->cluster_bits - 8)) - 1;", "s->cluster_offset_mask = (1LL << s->csize_shift) - 1;", "s->refcount_table_offset = header.refcount_table_offset;", "s->refcount_table_size =\nheader.refcount_table_clusters << (s->cluster_bits - 3);", "s->snapshots_offset = header.snapshots_offset;", "s->nb_snapshots = header.nb_snapshots;", "s->l1_size = header.l1_size;", "VAR_5 = s->cluster_bits + s->l2_bits;", "s->l1_vm_state_index = (header.size + (1LL << VAR_5) - 1) >> VAR_5;", "if (s->l1_size < s->l1_vm_state_index)\ngoto fail;", "s->l1_table_offset = header.l1_table_offset;", "s->l1_table = qemu_malloc(s->l1_size * sizeof(uint64_t));", "if (!s->l1_table)\ngoto fail;", "if (bdrv_pread(s->hd, s->l1_table_offset, s->l1_table, s->l1_size * sizeof(uint64_t)) !=\ns->l1_size * sizeof(uint64_t))\ngoto fail;", "for(VAR_4 = 0;VAR_4 < s->l1_size; VAR_4++) {", "be64_to_cpus(&s->l1_table[VAR_4]);", "}", "s->l2_cache = qemu_malloc(s->l2_size * L2_CACHE_SIZE * sizeof(uint64_t));", "if (!s->l2_cache)\ngoto fail;", "s->cluster_cache = qemu_malloc(s->cluster_size);", "if (!s->cluster_cache)\ngoto fail;", "s->cluster_data = qemu_malloc(s->cluster_size + 512);", "if (!s->cluster_data)\ngoto fail;", "s->cluster_cache_offset = -1;", "if (refcount_init(VAR_0) < 0)\ngoto fail;", "if (header.backing_file_offset != 0) {", "VAR_3 = header.backing_file_size;", "if (VAR_3 > 1023)\nVAR_3 = 1023;", "if (bdrv_pread(s->hd, header.backing_file_offset, VAR_0->backing_file, VAR_3) != VAR_3)\ngoto fail;", "VAR_0->backing_file[VAR_3] = '\\0';", "}", "if (qcow_read_snapshots(VAR_0) < 0)\ngoto fail;", "#ifdef DEBUG_ALLOC\ncheck_refcounts(VAR_0);", "#endif\nreturn 0;", "fail:\nqcow_free_snapshots(VAR_0);", "refcount_close(VAR_0);", "qemu_free(s->l1_table);", "qemu_free(s->l2_cache);", "qemu_free(s->cluster_cache);", "qemu_free(s->cluster_data);", "bdrv_delete(s->hd);", "return -1;", "}" ]
[ 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, 1, 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 ], [ 51, 53 ], [ 55, 57, 59, 61 ], [ 63, 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 99 ], [ 101 ], [ 107 ], [ 109 ], [ 111 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125, 127 ], [ 129, 131, 133 ], [ 135 ], [ 137 ], [ 139 ], [ 143 ], [ 145, 147 ], [ 149 ], [ 151, 153 ], [ 157 ], [ 159, 161 ], [ 163 ], [ 167, 169 ], [ 175 ], [ 177 ], [ 179, 181 ], [ 183, 185 ], [ 187 ], [ 189 ], [ 191, 193 ], [ 197, 199 ], [ 201, 203 ], [ 207, 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ] ]
21,769
static uint32_t rtl8139_io_readl(void *opaque, uint8_t addr) { RTL8139State *s = opaque; uint32_t ret; switch (addr) { case RxMissed: ret = s->RxMissed; DPRINTF("RxMissed read val=0x%08x\n", ret); break; case TxConfig: ret = rtl8139_TxConfig_read(s); break; case RxConfig: ret = rtl8139_RxConfig_read(s); break; case TxStatus0 ... TxStatus0+4*4-1: ret = rtl8139_TxStatus_read(s, addr, 4); break; case TxAddr0 ... TxAddr0+4*4-1: ret = rtl8139_TxAddr_read(s, addr-TxAddr0); break; case RxBuf: ret = rtl8139_RxBuf_read(s); break; case RxRingAddrLO: ret = s->RxRingAddrLO; DPRINTF("C+ RxRing low bits read val=0x%08x\n", ret); break; case RxRingAddrHI: ret = s->RxRingAddrHI; DPRINTF("C+ RxRing high bits read val=0x%08x\n", ret); break; case Timer: ret = muldiv64(qemu_get_clock_ns(vm_clock) - s->TCTR_base, PCI_FREQUENCY, get_ticks_per_sec()); DPRINTF("TCTR Timer read val=0x%08x\n", ret); break; case FlashReg: ret = s->TimerInt; DPRINTF("FlashReg TimerInt read val=0x%08x\n", ret); break; default: DPRINTF("ioport read(l) addr=0x%x via read(b)\n", addr); ret = rtl8139_io_readb(opaque, addr); ret |= rtl8139_io_readb(opaque, addr + 1) << 8; ret |= rtl8139_io_readb(opaque, addr + 2) << 16; ret |= rtl8139_io_readb(opaque, addr + 3) << 24; DPRINTF("read(l) addr=0x%x val=%08x\n", addr, ret); break; } return ret; }
true
qemu
3e48dd4a2d48aabafe22ce3611d65544d0234a69
static uint32_t rtl8139_io_readl(void *opaque, uint8_t addr) { RTL8139State *s = opaque; uint32_t ret; switch (addr) { case RxMissed: ret = s->RxMissed; DPRINTF("RxMissed read val=0x%08x\n", ret); break; case TxConfig: ret = rtl8139_TxConfig_read(s); break; case RxConfig: ret = rtl8139_RxConfig_read(s); break; case TxStatus0 ... TxStatus0+4*4-1: ret = rtl8139_TxStatus_read(s, addr, 4); break; case TxAddr0 ... TxAddr0+4*4-1: ret = rtl8139_TxAddr_read(s, addr-TxAddr0); break; case RxBuf: ret = rtl8139_RxBuf_read(s); break; case RxRingAddrLO: ret = s->RxRingAddrLO; DPRINTF("C+ RxRing low bits read val=0x%08x\n", ret); break; case RxRingAddrHI: ret = s->RxRingAddrHI; DPRINTF("C+ RxRing high bits read val=0x%08x\n", ret); break; case Timer: ret = muldiv64(qemu_get_clock_ns(vm_clock) - s->TCTR_base, PCI_FREQUENCY, get_ticks_per_sec()); DPRINTF("TCTR Timer read val=0x%08x\n", ret); break; case FlashReg: ret = s->TimerInt; DPRINTF("FlashReg TimerInt read val=0x%08x\n", ret); break; default: DPRINTF("ioport read(l) addr=0x%x via read(b)\n", addr); ret = rtl8139_io_readb(opaque, addr); ret |= rtl8139_io_readb(opaque, addr + 1) << 8; ret |= rtl8139_io_readb(opaque, addr + 2) << 16; ret |= rtl8139_io_readb(opaque, addr + 3) << 24; DPRINTF("read(l) addr=0x%x val=%08x\n", addr, ret); break; } return ret; }
{ "code": [ " ret = rtl8139_TxStatus_read(s, addr, 4);" ], "line_no": [ 45 ] }
static uint32_t FUNC_0(void *opaque, uint8_t addr) { RTL8139State *s = opaque; uint32_t ret; switch (addr) { case RxMissed: ret = s->RxMissed; DPRINTF("RxMissed read val=0x%08x\n", ret); break; case TxConfig: ret = rtl8139_TxConfig_read(s); break; case RxConfig: ret = rtl8139_RxConfig_read(s); break; case TxStatus0 ... TxStatus0+4*4-1: ret = rtl8139_TxStatus_read(s, addr, 4); break; case TxAddr0 ... TxAddr0+4*4-1: ret = rtl8139_TxAddr_read(s, addr-TxAddr0); break; case RxBuf: ret = rtl8139_RxBuf_read(s); break; case RxRingAddrLO: ret = s->RxRingAddrLO; DPRINTF("C+ RxRing low bits read val=0x%08x\n", ret); break; case RxRingAddrHI: ret = s->RxRingAddrHI; DPRINTF("C+ RxRing high bits read val=0x%08x\n", ret); break; case Timer: ret = muldiv64(qemu_get_clock_ns(vm_clock) - s->TCTR_base, PCI_FREQUENCY, get_ticks_per_sec()); DPRINTF("TCTR Timer read val=0x%08x\n", ret); break; case FlashReg: ret = s->TimerInt; DPRINTF("FlashReg TimerInt read val=0x%08x\n", ret); break; default: DPRINTF("ioport read(l) addr=0x%x via read(b)\n", addr); ret = rtl8139_io_readb(opaque, addr); ret |= rtl8139_io_readb(opaque, addr + 1) << 8; ret |= rtl8139_io_readb(opaque, addr + 2) << 16; ret |= rtl8139_io_readb(opaque, addr + 3) << 24; DPRINTF("read(l) addr=0x%x val=%08x\n", addr, ret); break; } return ret; }
[ "static uint32_t FUNC_0(void *opaque, uint8_t addr)\n{", "RTL8139State *s = opaque;", "uint32_t ret;", "switch (addr)\n{", "case RxMissed:\nret = s->RxMissed;", "DPRINTF(\"RxMissed read val=0x%08x\\n\", ret);", "break;", "case TxConfig:\nret = rtl8139_TxConfig_read(s);", "break;", "case RxConfig:\nret = rtl8139_RxConfig_read(s);", "break;", "case TxStatus0 ... TxStatus0+4*4-1:\nret = rtl8139_TxStatus_read(s, addr, 4);", "break;", "case TxAddr0 ... TxAddr0+4*4-1:\nret = rtl8139_TxAddr_read(s, addr-TxAddr0);", "break;", "case RxBuf:\nret = rtl8139_RxBuf_read(s);", "break;", "case RxRingAddrLO:\nret = s->RxRingAddrLO;", "DPRINTF(\"C+ RxRing low bits read val=0x%08x\\n\", ret);", "break;", "case RxRingAddrHI:\nret = s->RxRingAddrHI;", "DPRINTF(\"C+ RxRing high bits read val=0x%08x\\n\", ret);", "break;", "case Timer:\nret = muldiv64(qemu_get_clock_ns(vm_clock) - s->TCTR_base,\nPCI_FREQUENCY, get_ticks_per_sec());", "DPRINTF(\"TCTR Timer read val=0x%08x\\n\", ret);", "break;", "case FlashReg:\nret = s->TimerInt;", "DPRINTF(\"FlashReg TimerInt read val=0x%08x\\n\", ret);", "break;", "default:\nDPRINTF(\"ioport read(l) addr=0x%x via read(b)\\n\", addr);", "ret = rtl8139_io_readb(opaque, addr);", "ret |= rtl8139_io_readb(opaque, addr + 1) << 8;", "ret |= rtl8139_io_readb(opaque, addr + 2) << 16;", "ret |= rtl8139_io_readb(opaque, addr + 3) << 24;", "DPRINTF(\"read(l) addr=0x%x val=%08x\\n\", addr, ret);", "break;", "}", "return ret;", "}" ]
[ 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 ], [ 11, 13 ], [ 15, 17 ], [ 21 ], [ 23 ], [ 27, 29 ], [ 31 ], [ 35, 37 ], [ 39 ], [ 43, 45 ], [ 47 ], [ 51, 53 ], [ 55 ], [ 59, 61 ], [ 63 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 87, 89, 91 ], [ 93 ], [ 95 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 109, 111 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 129 ], [ 133 ], [ 135 ] ]
21,770
static void video_decode_example(const char *outfilename, const char *filename) { AVCodec *codec; AVCodecContext *c= NULL; int frame, got_picture, len; FILE *f; AVFrame *picture; uint8_t inbuf[INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE]; char buf[1024]; AVPacket avpkt; av_init_packet(&avpkt); /* set end of buffer to 0 (this ensures that no overreading happens for damaged mpeg streams) */ memset(inbuf + INBUF_SIZE, 0, FF_INPUT_BUFFER_PADDING_SIZE); printf("Decode video file %s\n", filename); /* find the mpeg1 video decoder */ codec = avcodec_find_decoder(AV_CODEC_ID_MPEG1VIDEO); if (!codec) { fprintf(stderr, "codec not found\n"); exit(1); } c = avcodec_alloc_context3(codec); picture= avcodec_alloc_frame(); if(codec->capabilities&CODEC_CAP_TRUNCATED) c->flags|= CODEC_FLAG_TRUNCATED; /* we do not send complete frames */ /* For some codecs, such as msmpeg4 and mpeg4, width and height MUST be initialized there because this information is not available in the bitstream. */ /* open it */ if (avcodec_open2(c, codec, NULL) < 0) { fprintf(stderr, "could not open codec\n"); exit(1); } /* the codec gives us the frame size, in samples */ f = fopen(filename, "rb"); if (!f) { fprintf(stderr, "could not open %s\n", filename); exit(1); } frame = 0; for(;;) { avpkt.size = fread(inbuf, 1, INBUF_SIZE, f); if (avpkt.size == 0) break; /* NOTE1: some codecs are stream based (mpegvideo, mpegaudio) and this is the only method to use them because you cannot know the compressed data size before analysing it. BUT some other codecs (msmpeg4, mpeg4) are inherently frame based, so you must call them with all the data for one frame exactly. You must also initialize 'width' and 'height' before initializing them. */ /* NOTE2: some codecs allow the raw parameters (frame size, sample rate) to be changed at any frame. We handle this, so you should also take care of it */ /* here, we use a stream based decoder (mpeg1video), so we feed decoder and see if it could decode a frame */ avpkt.data = inbuf; while (avpkt.size > 0) { len = avcodec_decode_video2(c, picture, &got_picture, &avpkt); if (len < 0) { fprintf(stderr, "Error while decoding frame %d\n", frame); exit(1); } if (got_picture) { printf("saving frame %3d\n", frame); fflush(stdout); /* the picture is allocated by the decoder. no need to free it */ snprintf(buf, sizeof(buf), outfilename, frame); pgm_save(picture->data[0], picture->linesize[0], c->width, c->height, buf); frame++; } avpkt.size -= len; avpkt.data += len; } } /* some codecs, such as MPEG, transmit the I and P frame with a latency of one frame. You must do the following to have a chance to get the last frame of the video */ avpkt.data = NULL; avpkt.size = 0; len = avcodec_decode_video2(c, picture, &got_picture, &avpkt); if (got_picture) { printf("saving last frame %3d\n", frame); fflush(stdout); /* the picture is allocated by the decoder. no need to free it */ snprintf(buf, sizeof(buf), outfilename, frame); pgm_save(picture->data[0], picture->linesize[0], c->width, c->height, buf); frame++; } fclose(f); avcodec_close(c); av_free(c); av_free(picture); printf("\n"); }
true
FFmpeg
535df748c5043bac6b03e598cfa93160ecce8383
static void video_decode_example(const char *outfilename, const char *filename) { AVCodec *codec; AVCodecContext *c= NULL; int frame, got_picture, len; FILE *f; AVFrame *picture; uint8_t inbuf[INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE]; char buf[1024]; AVPacket avpkt; av_init_packet(&avpkt); memset(inbuf + INBUF_SIZE, 0, FF_INPUT_BUFFER_PADDING_SIZE); printf("Decode video file %s\n", filename); codec = avcodec_find_decoder(AV_CODEC_ID_MPEG1VIDEO); if (!codec) { fprintf(stderr, "codec not found\n"); exit(1); } c = avcodec_alloc_context3(codec); picture= avcodec_alloc_frame(); if(codec->capabilities&CODEC_CAP_TRUNCATED) c->flags|= CODEC_FLAG_TRUNCATED; if (avcodec_open2(c, codec, NULL) < 0) { fprintf(stderr, "could not open codec\n"); exit(1); } f = fopen(filename, "rb"); if (!f) { fprintf(stderr, "could not open %s\n", filename); exit(1); } frame = 0; for(;;) { avpkt.size = fread(inbuf, 1, INBUF_SIZE, f); if (avpkt.size == 0) break; avpkt.data = inbuf; while (avpkt.size > 0) { len = avcodec_decode_video2(c, picture, &got_picture, &avpkt); if (len < 0) { fprintf(stderr, "Error while decoding frame %d\n", frame); exit(1); } if (got_picture) { printf("saving frame %3d\n", frame); fflush(stdout); snprintf(buf, sizeof(buf), outfilename, frame); pgm_save(picture->data[0], picture->linesize[0], c->width, c->height, buf); frame++; } avpkt.size -= len; avpkt.data += len; } } avpkt.data = NULL; avpkt.size = 0; len = avcodec_decode_video2(c, picture, &got_picture, &avpkt); if (got_picture) { printf("saving last frame %3d\n", frame); fflush(stdout); snprintf(buf, sizeof(buf), outfilename, frame); pgm_save(picture->data[0], picture->linesize[0], c->width, c->height, buf); frame++; } fclose(f); avcodec_close(c); av_free(c); av_free(picture); printf("\n"); }
{ "code": [ " picture= avcodec_alloc_frame();", " picture= avcodec_alloc_frame();" ], "line_no": [ 53, 53 ] }
static void FUNC_0(const char *VAR_0, const char *VAR_1) { AVCodec *codec; AVCodecContext *c= NULL; int VAR_2, VAR_3, VAR_4; FILE *f; AVFrame *picture; uint8_t inbuf[INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE]; char VAR_5[1024]; AVPacket avpkt; av_init_packet(&avpkt); memset(inbuf + INBUF_SIZE, 0, FF_INPUT_BUFFER_PADDING_SIZE); printf("Decode video file %s\n", VAR_1); codec = avcodec_find_decoder(AV_CODEC_ID_MPEG1VIDEO); if (!codec) { fprintf(stderr, "codec not found\n"); exit(1); } c = avcodec_alloc_context3(codec); picture= avcodec_alloc_frame(); if(codec->capabilities&CODEC_CAP_TRUNCATED) c->flags|= CODEC_FLAG_TRUNCATED; if (avcodec_open2(c, codec, NULL) < 0) { fprintf(stderr, "could not open codec\n"); exit(1); } f = fopen(VAR_1, "rb"); if (!f) { fprintf(stderr, "could not open %s\n", VAR_1); exit(1); } VAR_2 = 0; for(;;) { avpkt.size = fread(inbuf, 1, INBUF_SIZE, f); if (avpkt.size == 0) break; avpkt.data = inbuf; while (avpkt.size > 0) { VAR_4 = avcodec_decode_video2(c, picture, &VAR_3, &avpkt); if (VAR_4 < 0) { fprintf(stderr, "Error while decoding VAR_2 %d\n", VAR_2); exit(1); } if (VAR_3) { printf("saving VAR_2 %3d\n", VAR_2); fflush(stdout); snprintf(VAR_5, sizeof(VAR_5), VAR_0, VAR_2); pgm_save(picture->data[0], picture->linesize[0], c->width, c->height, VAR_5); VAR_2++; } avpkt.size -= VAR_4; avpkt.data += VAR_4; } } avpkt.data = NULL; avpkt.size = 0; VAR_4 = avcodec_decode_video2(c, picture, &VAR_3, &avpkt); if (VAR_3) { printf("saving last VAR_2 %3d\n", VAR_2); fflush(stdout); snprintf(VAR_5, sizeof(VAR_5), VAR_0, VAR_2); pgm_save(picture->data[0], picture->linesize[0], c->width, c->height, VAR_5); VAR_2++; } fclose(f); avcodec_close(c); av_free(c); av_free(picture); printf("\n"); }
[ "static void FUNC_0(const char *VAR_0, const char *VAR_1)\n{", "AVCodec *codec;", "AVCodecContext *c= NULL;", "int VAR_2, VAR_3, VAR_4;", "FILE *f;", "AVFrame *picture;", "uint8_t inbuf[INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE];", "char VAR_5[1024];", "AVPacket avpkt;", "av_init_packet(&avpkt);", "memset(inbuf + INBUF_SIZE, 0, FF_INPUT_BUFFER_PADDING_SIZE);", "printf(\"Decode video file %s\\n\", VAR_1);", "codec = avcodec_find_decoder(AV_CODEC_ID_MPEG1VIDEO);", "if (!codec) {", "fprintf(stderr, \"codec not found\\n\");", "exit(1);", "}", "c = avcodec_alloc_context3(codec);", "picture= avcodec_alloc_frame();", "if(codec->capabilities&CODEC_CAP_TRUNCATED)\nc->flags|= CODEC_FLAG_TRUNCATED;", "if (avcodec_open2(c, codec, NULL) < 0) {", "fprintf(stderr, \"could not open codec\\n\");", "exit(1);", "}", "f = fopen(VAR_1, \"rb\");", "if (!f) {", "fprintf(stderr, \"could not open %s\\n\", VAR_1);", "exit(1);", "}", "VAR_2 = 0;", "for(;;) {", "avpkt.size = fread(inbuf, 1, INBUF_SIZE, f);", "if (avpkt.size == 0)\nbreak;", "avpkt.data = inbuf;", "while (avpkt.size > 0) {", "VAR_4 = avcodec_decode_video2(c, picture, &VAR_3, &avpkt);", "if (VAR_4 < 0) {", "fprintf(stderr, \"Error while decoding VAR_2 %d\\n\", VAR_2);", "exit(1);", "}", "if (VAR_3) {", "printf(\"saving VAR_2 %3d\\n\", VAR_2);", "fflush(stdout);", "snprintf(VAR_5, sizeof(VAR_5), VAR_0, VAR_2);", "pgm_save(picture->data[0], picture->linesize[0],\nc->width, c->height, VAR_5);", "VAR_2++;", "}", "avpkt.size -= VAR_4;", "avpkt.data += VAR_4;", "}", "}", "avpkt.data = NULL;", "avpkt.size = 0;", "VAR_4 = avcodec_decode_video2(c, picture, &VAR_3, &avpkt);", "if (VAR_3) {", "printf(\"saving last VAR_2 %3d\\n\", VAR_2);", "fflush(stdout);", "snprintf(VAR_5, sizeof(VAR_5), VAR_0, VAR_2);", "pgm_save(picture->data[0], picture->linesize[0],\nc->width, c->height, VAR_5);", "VAR_2++;", "}", "fclose(f);", "avcodec_close(c);", "av_free(c);", "av_free(picture);", "printf(\"\\n\");", "}" ]
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 29 ], [ 33 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 57, 59 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105, 107 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 167 ], [ 169, 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 211 ], [ 213, 215 ], [ 217 ], [ 219 ], [ 223 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ] ]
21,771
static int open_input(HLSContext *c, struct playlist *pls, struct segment *seg) { AVDictionary *opts = NULL; int ret; // broker prior HTTP options that should be consistent across requests av_dict_set(&opts, "user-agent", c->user_agent, 0); av_dict_set(&opts, "cookies", c->cookies, 0); av_dict_set(&opts, "headers", c->headers, 0); av_dict_set(&opts, "http_proxy", c->http_proxy, 0); av_dict_set(&opts, "seekable", "0", 0); if (seg->size >= 0) { /* try to restrict the HTTP request to the part we want * (if this is in fact a HTTP request) */ av_dict_set_int(&opts, "offset", seg->url_offset, 0); av_dict_set_int(&opts, "end_offset", seg->url_offset + seg->size, 0); } av_log(pls->parent, AV_LOG_VERBOSE, "HLS request for url '%s', offset %"PRId64", playlist %d\n", seg->url, seg->url_offset, pls->index); if (seg->key_type == KEY_NONE) { ret = open_url(pls->parent, &pls->input, seg->url, c->avio_opts, opts); } else if (seg->key_type == KEY_AES_128) { AVDictionary *opts2 = NULL; char iv[33], key[33], url[MAX_URL_SIZE]; if (strcmp(seg->key, pls->key_url)) { AVIOContext *pb; if (open_url(pls->parent, &pb, seg->key, c->avio_opts, opts) == 0) { ret = avio_read(pb, pls->key, sizeof(pls->key)); if (ret != sizeof(pls->key)) { av_log(NULL, AV_LOG_ERROR, "Unable to read key file %s\n", seg->key); } ff_format_io_close(pls->parent, &pb); } else { av_log(NULL, AV_LOG_ERROR, "Unable to open key file %s\n", seg->key); } av_strlcpy(pls->key_url, seg->key, sizeof(pls->key_url)); } ff_data_to_hex(iv, seg->iv, sizeof(seg->iv), 0); ff_data_to_hex(key, pls->key, sizeof(pls->key), 0); iv[32] = key[32] = '\0'; if (strstr(seg->url, "://")) snprintf(url, sizeof(url), "crypto+%s", seg->url); else snprintf(url, sizeof(url), "crypto:%s", seg->url); av_dict_copy(&opts2, c->avio_opts, 0); av_dict_set(&opts2, "key", key, 0); av_dict_set(&opts2, "iv", iv, 0); ret = open_url(pls->parent, &pls->input, url, opts2, opts); av_dict_free(&opts2); if (ret < 0) { goto cleanup; } ret = 0; } else if (seg->key_type == KEY_SAMPLE_AES) { av_log(pls->parent, AV_LOG_ERROR, "SAMPLE-AES encryption is not supported yet\n"); ret = AVERROR_PATCHWELCOME; } else ret = AVERROR(ENOSYS); /* Seek to the requested position. If this was a HTTP request, the offset * should already be where want it to, but this allows e.g. local testing * without a HTTP server. */ if (ret == 0 && seg->key_type == KEY_NONE && seg->url_offset) { int seekret = avio_seek(pls->input, seg->url_offset, SEEK_SET); if (seekret < 0) { av_log(pls->parent, AV_LOG_ERROR, "Unable to seek to offset %"PRId64" of HLS segment '%s'\n", seg->url_offset, seg->url); ret = seekret; ff_format_io_close(pls->parent, &pls->input); } } cleanup: av_dict_free(&opts); pls->cur_seg_offset = 0; return ret; }
true
FFmpeg
58f21b6c9354bbc8414d9ff87645a7292cbe0d92
static int open_input(HLSContext *c, struct playlist *pls, struct segment *seg) { AVDictionary *opts = NULL; int ret; av_dict_set(&opts, "user-agent", c->user_agent, 0); av_dict_set(&opts, "cookies", c->cookies, 0); av_dict_set(&opts, "headers", c->headers, 0); av_dict_set(&opts, "http_proxy", c->http_proxy, 0); av_dict_set(&opts, "seekable", "0", 0); if (seg->size >= 0) { av_dict_set_int(&opts, "offset", seg->url_offset, 0); av_dict_set_int(&opts, "end_offset", seg->url_offset + seg->size, 0); } av_log(pls->parent, AV_LOG_VERBOSE, "HLS request for url '%s', offset %"PRId64", playlist %d\n", seg->url, seg->url_offset, pls->index); if (seg->key_type == KEY_NONE) { ret = open_url(pls->parent, &pls->input, seg->url, c->avio_opts, opts); } else if (seg->key_type == KEY_AES_128) { AVDictionary *opts2 = NULL; char iv[33], key[33], url[MAX_URL_SIZE]; if (strcmp(seg->key, pls->key_url)) { AVIOContext *pb; if (open_url(pls->parent, &pb, seg->key, c->avio_opts, opts) == 0) { ret = avio_read(pb, pls->key, sizeof(pls->key)); if (ret != sizeof(pls->key)) { av_log(NULL, AV_LOG_ERROR, "Unable to read key file %s\n", seg->key); } ff_format_io_close(pls->parent, &pb); } else { av_log(NULL, AV_LOG_ERROR, "Unable to open key file %s\n", seg->key); } av_strlcpy(pls->key_url, seg->key, sizeof(pls->key_url)); } ff_data_to_hex(iv, seg->iv, sizeof(seg->iv), 0); ff_data_to_hex(key, pls->key, sizeof(pls->key), 0); iv[32] = key[32] = '\0'; if (strstr(seg->url, ": snprintf(url, sizeof(url), "crypto+%s", seg->url); else snprintf(url, sizeof(url), "crypto:%s", seg->url); av_dict_copy(&opts2, c->avio_opts, 0); av_dict_set(&opts2, "key", key, 0); av_dict_set(&opts2, "iv", iv, 0); ret = open_url(pls->parent, &pls->input, url, opts2, opts); av_dict_free(&opts2); if (ret < 0) { goto cleanup; } ret = 0; } else if (seg->key_type == KEY_SAMPLE_AES) { av_log(pls->parent, AV_LOG_ERROR, "SAMPLE-AES encryption is not supported yet\n"); ret = AVERROR_PATCHWELCOME; } else ret = AVERROR(ENOSYS); if (ret == 0 && seg->key_type == KEY_NONE && seg->url_offset) { int seekret = avio_seek(pls->input, seg->url_offset, SEEK_SET); if (seekret < 0) { av_log(pls->parent, AV_LOG_ERROR, "Unable to seek to offset %"PRId64" of HLS segment '%s'\n", seg->url_offset, seg->url); ret = seekret; ff_format_io_close(pls->parent, &pls->input); } } cleanup: av_dict_free(&opts); pls->cur_seg_offset = 0; return ret; }
{ "code": [ " int seekret = avio_seek(pls->input, seg->url_offset, SEEK_SET);" ], "line_no": [ 149 ] }
static int FUNC_0(HLSContext *VAR_0, struct playlist *VAR_1, struct segment *VAR_2) { AVDictionary *opts = NULL; int VAR_3; av_dict_set(&opts, "user-agent", VAR_0->user_agent, 0); av_dict_set(&opts, "cookies", VAR_0->cookies, 0); av_dict_set(&opts, "headers", VAR_0->headers, 0); av_dict_set(&opts, "http_proxy", VAR_0->http_proxy, 0); av_dict_set(&opts, "seekable", "0", 0); if (VAR_2->size >= 0) { av_dict_set_int(&opts, "offset", VAR_2->url_offset, 0); av_dict_set_int(&opts, "end_offset", VAR_2->url_offset + VAR_2->size, 0); } av_log(VAR_1->parent, AV_LOG_VERBOSE, "HLS request for url '%s', offset %"PRId64", playlist %d\n", VAR_2->url, VAR_2->url_offset, VAR_1->index); if (VAR_2->key_type == KEY_NONE) { VAR_3 = open_url(VAR_1->parent, &VAR_1->input, VAR_2->url, VAR_0->avio_opts, opts); } else if (VAR_2->key_type == KEY_AES_128) { AVDictionary *opts2 = NULL; char VAR_4[33], VAR_5[33], url[MAX_URL_SIZE]; if (strcmp(VAR_2->VAR_5, VAR_1->key_url)) { AVIOContext *pb; if (open_url(VAR_1->parent, &pb, VAR_2->VAR_5, VAR_0->avio_opts, opts) == 0) { VAR_3 = avio_read(pb, VAR_1->VAR_5, sizeof(VAR_1->VAR_5)); if (VAR_3 != sizeof(VAR_1->VAR_5)) { av_log(NULL, AV_LOG_ERROR, "Unable to read VAR_5 file %s\n", VAR_2->VAR_5); } ff_format_io_close(VAR_1->parent, &pb); } else { av_log(NULL, AV_LOG_ERROR, "Unable to open VAR_5 file %s\n", VAR_2->VAR_5); } av_strlcpy(VAR_1->key_url, VAR_2->VAR_5, sizeof(VAR_1->key_url)); } ff_data_to_hex(VAR_4, VAR_2->VAR_4, sizeof(VAR_2->VAR_4), 0); ff_data_to_hex(VAR_5, VAR_1->VAR_5, sizeof(VAR_1->VAR_5), 0); VAR_4[32] = VAR_5[32] = '\0'; if (strstr(VAR_2->url, ": snprintf(url, sizeof(url), "crypto+%s", VAR_2->url); else snprintf(url, sizeof(url), "crypto:%s", VAR_2->url); av_dict_copy(&opts2, VAR_0->avio_opts, 0); av_dict_set(&opts2, "VAR_5", VAR_5, 0); av_dict_set(&opts2, "VAR_4", VAR_4, 0); VAR_3 = open_url(VAR_1->parent, &VAR_1->input, url, opts2, opts); av_dict_free(&opts2); if (VAR_3 < 0) { goto cleanup; } VAR_3 = 0; } else if (VAR_2->key_type == KEY_SAMPLE_AES) { av_log(VAR_1->parent, AV_LOG_ERROR, "SAMPLE-AES encryption is not supported yet\n"); VAR_3 = AVERROR_PATCHWELCOME; } else VAR_3 = AVERROR(ENOSYS); if (VAR_3 == 0 && VAR_2->key_type == KEY_NONE && VAR_2->url_offset) { int VAR_6 = avio_seek(VAR_1->input, VAR_2->url_offset, SEEK_SET); if (VAR_6 < 0) { av_log(VAR_1->parent, AV_LOG_ERROR, "Unable to seek to offset %"PRId64" of HLS segment '%s'\n", VAR_2->url_offset, VAR_2->url); VAR_3 = VAR_6; ff_format_io_close(VAR_1->parent, &VAR_1->input); } } cleanup: av_dict_free(&opts); VAR_1->cur_seg_offset = 0; return VAR_3; }
[ "static int FUNC_0(HLSContext *VAR_0, struct playlist *VAR_1, struct segment *VAR_2)\n{", "AVDictionary *opts = NULL;", "int VAR_3;", "av_dict_set(&opts, \"user-agent\", VAR_0->user_agent, 0);", "av_dict_set(&opts, \"cookies\", VAR_0->cookies, 0);", "av_dict_set(&opts, \"headers\", VAR_0->headers, 0);", "av_dict_set(&opts, \"http_proxy\", VAR_0->http_proxy, 0);", "av_dict_set(&opts, \"seekable\", \"0\", 0);", "if (VAR_2->size >= 0) {", "av_dict_set_int(&opts, \"offset\", VAR_2->url_offset, 0);", "av_dict_set_int(&opts, \"end_offset\", VAR_2->url_offset + VAR_2->size, 0);", "}", "av_log(VAR_1->parent, AV_LOG_VERBOSE, \"HLS request for url '%s', offset %\"PRId64\", playlist %d\\n\",\nVAR_2->url, VAR_2->url_offset, VAR_1->index);", "if (VAR_2->key_type == KEY_NONE) {", "VAR_3 = open_url(VAR_1->parent, &VAR_1->input, VAR_2->url, VAR_0->avio_opts, opts);", "} else if (VAR_2->key_type == KEY_AES_128) {", "AVDictionary *opts2 = NULL;", "char VAR_4[33], VAR_5[33], url[MAX_URL_SIZE];", "if (strcmp(VAR_2->VAR_5, VAR_1->key_url)) {", "AVIOContext *pb;", "if (open_url(VAR_1->parent, &pb, VAR_2->VAR_5, VAR_0->avio_opts, opts) == 0) {", "VAR_3 = avio_read(pb, VAR_1->VAR_5, sizeof(VAR_1->VAR_5));", "if (VAR_3 != sizeof(VAR_1->VAR_5)) {", "av_log(NULL, AV_LOG_ERROR, \"Unable to read VAR_5 file %s\\n\",\nVAR_2->VAR_5);", "}", "ff_format_io_close(VAR_1->parent, &pb);", "} else {", "av_log(NULL, AV_LOG_ERROR, \"Unable to open VAR_5 file %s\\n\",\nVAR_2->VAR_5);", "}", "av_strlcpy(VAR_1->key_url, VAR_2->VAR_5, sizeof(VAR_1->key_url));", "}", "ff_data_to_hex(VAR_4, VAR_2->VAR_4, sizeof(VAR_2->VAR_4), 0);", "ff_data_to_hex(VAR_5, VAR_1->VAR_5, sizeof(VAR_1->VAR_5), 0);", "VAR_4[32] = VAR_5[32] = '\\0';", "if (strstr(VAR_2->url, \":\nsnprintf(url, sizeof(url), \"crypto+%s\", VAR_2->url);", "else\nsnprintf(url, sizeof(url), \"crypto:%s\", VAR_2->url);", "av_dict_copy(&opts2, VAR_0->avio_opts, 0);", "av_dict_set(&opts2, \"VAR_5\", VAR_5, 0);", "av_dict_set(&opts2, \"VAR_4\", VAR_4, 0);", "VAR_3 = open_url(VAR_1->parent, &VAR_1->input, url, opts2, opts);", "av_dict_free(&opts2);", "if (VAR_3 < 0) {", "goto cleanup;", "}", "VAR_3 = 0;", "} else if (VAR_2->key_type == KEY_SAMPLE_AES) {", "av_log(VAR_1->parent, AV_LOG_ERROR,\n\"SAMPLE-AES encryption is not supported yet\\n\");", "VAR_3 = AVERROR_PATCHWELCOME;", "}", "else\nVAR_3 = AVERROR(ENOSYS);", "if (VAR_3 == 0 && VAR_2->key_type == KEY_NONE && VAR_2->url_offset) {", "int VAR_6 = avio_seek(VAR_1->input, VAR_2->url_offset, SEEK_SET);", "if (VAR_6 < 0) {", "av_log(VAR_1->parent, AV_LOG_ERROR, \"Unable to seek to offset %\"PRId64\" of HLS segment '%s'\\n\", VAR_2->url_offset, VAR_2->url);", "VAR_3 = VAR_6;", "ff_format_io_close(VAR_1->parent, &VAR_1->input);", "}", "}", "cleanup:\nav_dict_free(&opts);", "VAR_1->cur_seg_offset = 0;", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 31 ], [ 33 ], [ 35 ], [ 39, 41 ], [ 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 ], [ 103 ], [ 105 ], [ 109 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 135, 137 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 165, 167 ], [ 169 ], [ 171 ], [ 173 ] ]
21,772
static int dvvideo_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; DVVideoContext *s = avctx->priv_data; s->sys = dv_frame_profile(buf); if (!s->sys || buf_size < s->sys->frame_size || dv_init_dynamic_tables(s->sys)) return -1; /* NOTE: we only accept several full frames */ if (s->picture.data[0]) avctx->release_buffer(avctx, &s->picture); s->picture.reference = 0; s->picture.key_frame = 1; s->picture.pict_type = FF_I_TYPE; avctx->pix_fmt = s->sys->pix_fmt; avctx->time_base = s->sys->time_base; avcodec_set_dimensions(avctx, s->sys->width, s->sys->height); if (avctx->get_buffer(avctx, &s->picture) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } s->picture.interlaced_frame = 1; s->picture.top_field_first = 0; s->buf = buf; avctx->execute(avctx, dv_decode_video_segment, s->sys->work_chunks, NULL, dv_work_pool_size(s->sys), sizeof(DVwork_chunk)); emms_c(); /* return image */ *data_size = sizeof(AVFrame); *(AVFrame*)data = s->picture; return s->sys->frame_size; }
true
FFmpeg
d509c743b78da198af385fea362b632292cd00ad
static int dvvideo_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; DVVideoContext *s = avctx->priv_data; s->sys = dv_frame_profile(buf); if (!s->sys || buf_size < s->sys->frame_size || dv_init_dynamic_tables(s->sys)) return -1; if (s->picture.data[0]) avctx->release_buffer(avctx, &s->picture); s->picture.reference = 0; s->picture.key_frame = 1; s->picture.pict_type = FF_I_TYPE; avctx->pix_fmt = s->sys->pix_fmt; avctx->time_base = s->sys->time_base; avcodec_set_dimensions(avctx, s->sys->width, s->sys->height); if (avctx->get_buffer(avctx, &s->picture) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } s->picture.interlaced_frame = 1; s->picture.top_field_first = 0; s->buf = buf; avctx->execute(avctx, dv_decode_video_segment, s->sys->work_chunks, NULL, dv_work_pool_size(s->sys), sizeof(DVwork_chunk)); emms_c(); *data_size = sizeof(AVFrame); *(AVFrame*)data = s->picture; return s->sys->frame_size; }
{ "code": [ " s->sys = dv_frame_profile(buf);" ], "line_no": [ 17 ] }
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; DVVideoContext *s = VAR_0->priv_data; s->sys = dv_frame_profile(VAR_4); if (!s->sys || VAR_5 < s->sys->frame_size || dv_init_dynamic_tables(s->sys)) return -1; if (s->picture.VAR_1[0]) VAR_0->release_buffer(VAR_0, &s->picture); s->picture.reference = 0; s->picture.key_frame = 1; s->picture.pict_type = FF_I_TYPE; VAR_0->pix_fmt = s->sys->pix_fmt; VAR_0->time_base = s->sys->time_base; avcodec_set_dimensions(VAR_0, s->sys->width, s->sys->height); if (VAR_0->get_buffer(VAR_0, &s->picture) < 0) { av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } s->picture.interlaced_frame = 1; s->picture.top_field_first = 0; s->VAR_4 = VAR_4; VAR_0->execute(VAR_0, dv_decode_video_segment, s->sys->work_chunks, NULL, dv_work_pool_size(s->sys), sizeof(DVwork_chunk)); emms_c(); *VAR_2 = sizeof(AVFrame); *(AVFrame*)VAR_1 = s->picture; return s->sys->frame_size; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "DVVideoContext *s = VAR_0->priv_data;", "s->sys = dv_frame_profile(VAR_4);", "if (!s->sys || VAR_5 < s->sys->frame_size || dv_init_dynamic_tables(s->sys))\nreturn -1;", "if (s->picture.VAR_1[0])\nVAR_0->release_buffer(VAR_0, &s->picture);", "s->picture.reference = 0;", "s->picture.key_frame = 1;", "s->picture.pict_type = FF_I_TYPE;", "VAR_0->pix_fmt = s->sys->pix_fmt;", "VAR_0->time_base = s->sys->time_base;", "avcodec_set_dimensions(VAR_0, s->sys->width, s->sys->height);", "if (VAR_0->get_buffer(VAR_0, &s->picture) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"get_buffer() failed\\n\");", "return -1;", "}", "s->picture.interlaced_frame = 1;", "s->picture.top_field_first = 0;", "s->VAR_4 = VAR_4;", "VAR_0->execute(VAR_0, dv_decode_video_segment, s->sys->work_chunks, NULL,\ndv_work_pool_size(s->sys), sizeof(DVwork_chunk));", "emms_c();", "*VAR_2 = sizeof(AVFrame);", "*(AVFrame*)VAR_1 = s->picture;", "return s->sys->frame_size;", "}" ]
[ 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 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19, 21 ], [ 25, 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59, 61 ], [ 65 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ] ]
21,773
target_ulong helper_dvpe(target_ulong arg1) { // TODO arg1 = 0; // rt = arg1 return arg1; }
true
qemu
9ed5726c043958359b0f1fa44ab3e4f25f9d9a47
target_ulong helper_dvpe(target_ulong arg1) { arg1 = 0; return arg1; }
{ "code": [ " arg1 = 0;", " return arg1;", " arg1 = 0;", " return arg1;", "target_ulong helper_dvpe(target_ulong arg1)", " arg1 = 0;", " return arg1;", " arg1 = 0;", " return arg1;" ], "line_no": [ 7, 13, 7, 13, 1, 7, 13, 7, 13 ] }
target_ulong FUNC_0(target_ulong arg1) { arg1 = 0; return arg1; }
[ "target_ulong FUNC_0(target_ulong arg1)\n{", "arg1 = 0;", "return arg1;", "}" ]
[ 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 7 ], [ 13 ], [ 15 ] ]
21,774
static void colo_compare_finalize(Object *obj) { CompareState *s = COLO_COMPARE(obj); qemu_chr_fe_deinit(&s->chr_pri_in); qemu_chr_fe_deinit(&s->chr_sec_in); qemu_chr_fe_deinit(&s->chr_out); g_queue_free(&s->conn_list); if (qemu_thread_is_self(&s->thread)) { /* compare connection */ g_queue_foreach(&s->conn_list, colo_compare_connection, s); qemu_thread_join(&s->thread); } g_free(s->pri_indev); g_free(s->sec_indev); g_free(s->outdev); }
true
qemu
dfd917a9c2bed578c31043126c9f558190bf21e4
static void colo_compare_finalize(Object *obj) { CompareState *s = COLO_COMPARE(obj); qemu_chr_fe_deinit(&s->chr_pri_in); qemu_chr_fe_deinit(&s->chr_sec_in); qemu_chr_fe_deinit(&s->chr_out); g_queue_free(&s->conn_list); if (qemu_thread_is_self(&s->thread)) { g_queue_foreach(&s->conn_list, colo_compare_connection, s); qemu_thread_join(&s->thread); } g_free(s->pri_indev); g_free(s->sec_indev); g_free(s->outdev); }
{ "code": [ " g_queue_free(&s->conn_list);", " if (qemu_thread_is_self(&s->thread)) {", " g_queue_foreach(&s->conn_list, colo_compare_connection, s);", " qemu_thread_join(&s->thread);" ], "line_no": [ 17, 21, 25, 27 ] }
static void FUNC_0(Object *VAR_0) { CompareState *s = COLO_COMPARE(VAR_0); qemu_chr_fe_deinit(&s->chr_pri_in); qemu_chr_fe_deinit(&s->chr_sec_in); qemu_chr_fe_deinit(&s->chr_out); g_queue_free(&s->conn_list); if (qemu_thread_is_self(&s->thread)) { g_queue_foreach(&s->conn_list, colo_compare_connection, s); qemu_thread_join(&s->thread); } g_free(s->pri_indev); g_free(s->sec_indev); g_free(s->outdev); }
[ "static void FUNC_0(Object *VAR_0)\n{", "CompareState *s = COLO_COMPARE(VAR_0);", "qemu_chr_fe_deinit(&s->chr_pri_in);", "qemu_chr_fe_deinit(&s->chr_sec_in);", "qemu_chr_fe_deinit(&s->chr_out);", "g_queue_free(&s->conn_list);", "if (qemu_thread_is_self(&s->thread)) {", "g_queue_foreach(&s->conn_list, colo_compare_connection, s);", "qemu_thread_join(&s->thread);", "}", "g_free(s->pri_indev);", "g_free(s->sec_indev);", "g_free(s->outdev);", "}" ]
[ 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ] ]
21,775
void cpu_dump_state(CPUState *env, FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...), int flags) { #if defined(TARGET_PPC64) || 1 #define FILL "" #define RGPL 4 #define RFPL 4 #else #define FILL " " #define RGPL 8 #define RFPL 4 #endif int i; cpu_fprintf(f, "NIP " REGX " LR " REGX " CTR " REGX "\n", env->nip, env->lr, env->ctr); cpu_fprintf(f, "MSR " REGX FILL " XER %08x TB %08x %08x " #if !defined(CONFIG_USER_ONLY) "DECR %08x" #endif "\n", do_load_msr(env), load_xer(env), cpu_ppc_load_tbu(env), cpu_ppc_load_tbl(env) #if !defined(CONFIG_USER_ONLY) , cpu_ppc_load_decr(env) #endif ); for (i = 0; i < 32; i++) { if ((i & (RGPL - 1)) == 0) cpu_fprintf(f, "GPR%02d", i); cpu_fprintf(f, " " REGX, env->gpr[i]); if ((i & (RGPL - 1)) == (RGPL - 1)) cpu_fprintf(f, "\n"); } cpu_fprintf(f, "CR "); for (i = 0; i < 8; i++) cpu_fprintf(f, "%01x", env->crf[i]); cpu_fprintf(f, " ["); for (i = 0; i < 8; i++) { char a = '-'; if (env->crf[i] & 0x08) a = 'L'; else if (env->crf[i] & 0x04) a = 'G'; else if (env->crf[i] & 0x02) a = 'E'; cpu_fprintf(f, " %c%c", a, env->crf[i] & 0x01 ? 'O' : ' '); } cpu_fprintf(f, " ] " FILL "RES " REGX "\n", env->reserve); for (i = 0; i < 32; i++) { if ((i & (RFPL - 1)) == 0) cpu_fprintf(f, "FPR%02d", i); cpu_fprintf(f, " %016" PRIx64, *((uint64_t *)&env->fpr[i])); if ((i & (RFPL - 1)) == (RFPL - 1)) cpu_fprintf(f, "\n"); } cpu_fprintf(f, "SRR0 " REGX " SRR1 " REGX " " FILL FILL FILL "SDR1 " REGX "\n", env->spr[SPR_SRR0], env->spr[SPR_SRR1], env->sdr1); #undef REGX #undef RGPL #undef RFPL #undef FILL }
true
qemu
d9bce9d99f4656ae0b0127f7472db9067b8f84ab
void cpu_dump_state(CPUState *env, FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...), int flags) { #if defined(TARGET_PPC64) || 1 #define FILL "" #define RGPL 4 #define RFPL 4 #else #define FILL " " #define RGPL 8 #define RFPL 4 #endif int i; cpu_fprintf(f, "NIP " REGX " LR " REGX " CTR " REGX "\n", env->nip, env->lr, env->ctr); cpu_fprintf(f, "MSR " REGX FILL " XER %08x TB %08x %08x " #if !defined(CONFIG_USER_ONLY) "DECR %08x" #endif "\n", do_load_msr(env), load_xer(env), cpu_ppc_load_tbu(env), cpu_ppc_load_tbl(env) #if !defined(CONFIG_USER_ONLY) , cpu_ppc_load_decr(env) #endif ); for (i = 0; i < 32; i++) { if ((i & (RGPL - 1)) == 0) cpu_fprintf(f, "GPR%02d", i); cpu_fprintf(f, " " REGX, env->gpr[i]); if ((i & (RGPL - 1)) == (RGPL - 1)) cpu_fprintf(f, "\n"); } cpu_fprintf(f, "CR "); for (i = 0; i < 8; i++) cpu_fprintf(f, "%01x", env->crf[i]); cpu_fprintf(f, " ["); for (i = 0; i < 8; i++) { char a = '-'; if (env->crf[i] & 0x08) a = 'L'; else if (env->crf[i] & 0x04) a = 'G'; else if (env->crf[i] & 0x02) a = 'E'; cpu_fprintf(f, " %c%c", a, env->crf[i] & 0x01 ? 'O' : ' '); } cpu_fprintf(f, " ] " FILL "RES " REGX "\n", env->reserve); for (i = 0; i < 32; i++) { if ((i & (RFPL - 1)) == 0) cpu_fprintf(f, "FPR%02d", i); cpu_fprintf(f, " %016" PRIx64, *((uint64_t *)&env->fpr[i])); if ((i & (RFPL - 1)) == (RFPL - 1)) cpu_fprintf(f, "\n"); } cpu_fprintf(f, "SRR0 " REGX " SRR1 " REGX " " FILL FILL FILL "SDR1 " REGX "\n", env->spr[SPR_SRR0], env->spr[SPR_SRR1], env->sdr1); #undef REGX #undef RGPL #undef RFPL #undef FILL }
{ "code": [ "#else", "#endif", "#else", "#endif", " cpu_fprintf(f, \"MSR \" REGX FILL \" XER %08x TB %08x %08x \"", " do_load_msr(env), load_xer(env), cpu_ppc_load_tbu(env),", " cpu_ppc_load_tbl(env)", "#undef REGX" ], "line_no": [ 17, 25, 17, 25, 37, 47, 49, 125 ] }
void FUNC_0(CPUState *VAR_0, FILE *VAR_3, int (*VAR_2)(FILE *VAR_3, const char *VAR_3, ...), int VAR_4) { #if defined(TARGET_PPC64) || 1 #define FILL "" #define RGPL 4 #define RFPL 4 #else #define FILL " " #define RGPL 8 #define RFPL 4 #endif int VAR_5; VAR_2(VAR_3, "NIP " REGX " LR " REGX " CTR " REGX "\n", VAR_0->nip, VAR_0->lr, VAR_0->ctr); VAR_2(VAR_3, "MSR " REGX FILL " XER %08x TB %08x %08x " #if !defined(CONFIG_USER_ONLY) "DECR %08x" #endif "\n", do_load_msr(VAR_0), load_xer(VAR_0), cpu_ppc_load_tbu(VAR_0), cpu_ppc_load_tbl(VAR_0) #if !defined(CONFIG_USER_ONLY) , cpu_ppc_load_decr(VAR_0) #endif ); for (VAR_5 = 0; VAR_5 < 32; VAR_5++) { if ((VAR_5 & (RGPL - 1)) == 0) VAR_2(VAR_3, "GPR%02d", VAR_5); VAR_2(VAR_3, " " REGX, VAR_0->gpr[VAR_5]); if ((VAR_5 & (RGPL - 1)) == (RGPL - 1)) VAR_2(VAR_3, "\n"); } VAR_2(VAR_3, "CR "); for (VAR_5 = 0; VAR_5 < 8; VAR_5++) VAR_2(VAR_3, "%01x", VAR_0->crf[VAR_5]); VAR_2(VAR_3, " ["); for (VAR_5 = 0; VAR_5 < 8; VAR_5++) { char VAR_6 = '-'; if (VAR_0->crf[VAR_5] & 0x08) VAR_6 = 'L'; else if (VAR_0->crf[VAR_5] & 0x04) VAR_6 = 'G'; else if (VAR_0->crf[VAR_5] & 0x02) VAR_6 = 'E'; VAR_2(VAR_3, " %c%c", VAR_6, VAR_0->crf[VAR_5] & 0x01 ? 'O' : ' '); } VAR_2(VAR_3, " ] " FILL "RES " REGX "\n", VAR_0->reserve); for (VAR_5 = 0; VAR_5 < 32; VAR_5++) { if ((VAR_5 & (RFPL - 1)) == 0) VAR_2(VAR_3, "FPR%02d", VAR_5); VAR_2(VAR_3, " %016" PRIx64, *((uint64_t *)&VAR_0->fpr[VAR_5])); if ((VAR_5 & (RFPL - 1)) == (RFPL - 1)) VAR_2(VAR_3, "\n"); } VAR_2(VAR_3, "SRR0 " REGX " SRR1 " REGX " " FILL FILL FILL "SDR1 " REGX "\n", VAR_0->spr[SPR_SRR0], VAR_0->spr[SPR_SRR1], VAR_0->sdr1); #undef REGX #undef RGPL #undef RFPL #undef FILL }
[ "void FUNC_0(CPUState *VAR_0, FILE *VAR_3,\nint (*VAR_2)(FILE *VAR_3, const char *VAR_3, ...),\nint VAR_4)\n{", "#if defined(TARGET_PPC64) || 1\n#define FILL \"\"\n#define RGPL 4\n#define RFPL 4\n#else\n#define FILL \" \"\n#define RGPL 8\n#define RFPL 4\n#endif\nint VAR_5;", "VAR_2(VAR_3, \"NIP \" REGX \" LR \" REGX \" CTR \" REGX \"\\n\",\nVAR_0->nip, VAR_0->lr, VAR_0->ctr);", "VAR_2(VAR_3, \"MSR \" REGX FILL \" XER %08x TB %08x %08x \"\n#if !defined(CONFIG_USER_ONLY)\n\"DECR %08x\"\n#endif\n\"\\n\",\ndo_load_msr(VAR_0), load_xer(VAR_0), cpu_ppc_load_tbu(VAR_0),\ncpu_ppc_load_tbl(VAR_0)\n#if !defined(CONFIG_USER_ONLY)\n, cpu_ppc_load_decr(VAR_0)\n#endif\n);", "for (VAR_5 = 0; VAR_5 < 32; VAR_5++) {", "if ((VAR_5 & (RGPL - 1)) == 0)\nVAR_2(VAR_3, \"GPR%02d\", VAR_5);", "VAR_2(VAR_3, \" \" REGX, VAR_0->gpr[VAR_5]);", "if ((VAR_5 & (RGPL - 1)) == (RGPL - 1))\nVAR_2(VAR_3, \"\\n\");", "}", "VAR_2(VAR_3, \"CR \");", "for (VAR_5 = 0; VAR_5 < 8; VAR_5++)", "VAR_2(VAR_3, \"%01x\", VAR_0->crf[VAR_5]);", "VAR_2(VAR_3, \" [\");", "for (VAR_5 = 0; VAR_5 < 8; VAR_5++) {", "char VAR_6 = '-';", "if (VAR_0->crf[VAR_5] & 0x08)\nVAR_6 = 'L';", "else if (VAR_0->crf[VAR_5] & 0x04)\nVAR_6 = 'G';", "else if (VAR_0->crf[VAR_5] & 0x02)\nVAR_6 = 'E';", "VAR_2(VAR_3, \" %c%c\", VAR_6, VAR_0->crf[VAR_5] & 0x01 ? 'O' : ' ');", "}", "VAR_2(VAR_3, \" ] \" FILL \"RES \" REGX \"\\n\", VAR_0->reserve);", "for (VAR_5 = 0; VAR_5 < 32; VAR_5++) {", "if ((VAR_5 & (RFPL - 1)) == 0)\nVAR_2(VAR_3, \"FPR%02d\", VAR_5);", "VAR_2(VAR_3, \" %016\" PRIx64, *((uint64_t *)&VAR_0->fpr[VAR_5]));", "if ((VAR_5 & (RFPL - 1)) == (RFPL - 1))\nVAR_2(VAR_3, \"\\n\");", "}", "VAR_2(VAR_3, \"SRR0 \" REGX \" SRR1 \" REGX \" \" FILL FILL FILL\n\"SDR1 \" REGX \"\\n\",\nVAR_0->spr[SPR_SRR0], VAR_0->spr[SPR_SRR1], VAR_0->sdr1);", "#undef REGX\n#undef RGPL\n#undef RFPL\n#undef FILL\n}" ]
[ 0, 1, 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, 1 ]
[ [ 1, 3, 5, 7 ], [ 9, 11, 13, 15, 17, 19, 21, 23, 25, 29 ], [ 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 ], [ 125, 127, 129, 131, 133 ] ]
21,777
static void tci_out_label(TCGContext *s, TCGArg arg) { TCGLabel *label = &s->labels[arg]; if (label->has_value) { tcg_out_i(s, label->u.value); assert(label->u.value); } else { tcg_out_reloc(s, s->code_ptr, sizeof(tcg_target_ulong), arg, 0); tcg_out_i(s, 0); } }
true
qemu
3c01ae0ea29915d165c384d0bd1cbafcf4364a4d
static void tci_out_label(TCGContext *s, TCGArg arg) { TCGLabel *label = &s->labels[arg]; if (label->has_value) { tcg_out_i(s, label->u.value); assert(label->u.value); } else { tcg_out_reloc(s, s->code_ptr, sizeof(tcg_target_ulong), arg, 0); tcg_out_i(s, 0); } }
{ "code": [ " tcg_out_i(s, 0);" ], "line_no": [ 17 ] }
static void FUNC_0(TCGContext *VAR_0, TCGArg VAR_1) { TCGLabel *label = &VAR_0->labels[VAR_1]; if (label->has_value) { tcg_out_i(VAR_0, label->u.value); assert(label->u.value); } else { tcg_out_reloc(VAR_0, VAR_0->code_ptr, sizeof(tcg_target_ulong), VAR_1, 0); tcg_out_i(VAR_0, 0); } }
[ "static void FUNC_0(TCGContext *VAR_0, TCGArg VAR_1)\n{", "TCGLabel *label = &VAR_0->labels[VAR_1];", "if (label->has_value) {", "tcg_out_i(VAR_0, label->u.value);", "assert(label->u.value);", "} else {", "tcg_out_reloc(VAR_0, VAR_0->code_ptr, sizeof(tcg_target_ulong), VAR_1, 0);", "tcg_out_i(VAR_0, 0);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
21,778
int64_t ff_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, int64_t pos_min, int64_t pos_max, int64_t pos_limit, int64_t ts_min, int64_t ts_max, int flags, int64_t *ts_ret, int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t )) { int64_t pos, ts; int64_t start_pos, filesize; int no_change; av_dlog(s, "gen_seek: %d %s\n", stream_index, av_ts2str(target_ts)); if(ts_min == AV_NOPTS_VALUE){ pos_min = s->data_offset; ts_min = ff_read_timestamp(s, stream_index, &pos_min, INT64_MAX, read_timestamp); if (ts_min == AV_NOPTS_VALUE) return -1; } if(ts_min >= target_ts){ *ts_ret= ts_min; return pos_min; } if(ts_max == AV_NOPTS_VALUE){ int64_t step= 1024; int64_t limit; filesize = avio_size(s->pb); pos_max = filesize - 1; do{ limit = pos_max; pos_max = FFMAX(0, pos_max - step); ts_max = ff_read_timestamp(s, stream_index, &pos_max, limit, read_timestamp); step += step; }while(ts_max == AV_NOPTS_VALUE && pos_max > 0); if (ts_max == AV_NOPTS_VALUE) return -1; for(;;){ int64_t tmp_pos= pos_max + 1; int64_t tmp_ts= ff_read_timestamp(s, stream_index, &tmp_pos, INT64_MAX, read_timestamp); if(tmp_ts == AV_NOPTS_VALUE) break; ts_max= tmp_ts; pos_max= tmp_pos; if(tmp_pos >= filesize) break; } pos_limit= pos_max; } if(ts_max <= target_ts){ *ts_ret= ts_max; return pos_max; } if(ts_min > ts_max){ return -1; }else if(ts_min == ts_max){ pos_limit= pos_min; } no_change=0; while (pos_min < pos_limit) { av_dlog(s, "pos_min=0x%"PRIx64" pos_max=0x%"PRIx64" dts_min=%s dts_max=%s\n", pos_min, pos_max, av_ts2str(ts_min), av_ts2str(ts_max)); assert(pos_limit <= pos_max); if(no_change==0){ int64_t approximate_keyframe_distance= pos_max - pos_limit; // interpolate position (better than dichotomy) pos = av_rescale(target_ts - ts_min, pos_max - pos_min, ts_max - ts_min) + pos_min - approximate_keyframe_distance; }else if(no_change==1){ // bisection, if interpolation failed to change min or max pos last time pos = (pos_min + pos_limit)>>1; }else{ /* linear search if bisection failed, can only happen if there are very few or no keyframes between min/max */ pos=pos_min; } if(pos <= pos_min) pos= pos_min + 1; else if(pos > pos_limit) pos= pos_limit; start_pos= pos; ts = ff_read_timestamp(s, stream_index, &pos, INT64_MAX, read_timestamp); //may pass pos_limit instead of -1 if(pos == pos_max) no_change++; else no_change=0; av_dlog(s, "%"PRId64" %"PRId64" %"PRId64" / %s %s %s target:%s limit:%"PRId64" start:%"PRId64" noc:%d\n", pos_min, pos, pos_max, av_ts2str(ts_min), av_ts2str(ts), av_ts2str(ts_max), av_ts2str(target_ts), pos_limit, start_pos, no_change); if(ts == AV_NOPTS_VALUE){ av_log(s, AV_LOG_ERROR, "read_timestamp() failed in the middle\n"); return -1; } assert(ts != AV_NOPTS_VALUE); if (target_ts <= ts) { pos_limit = start_pos - 1; pos_max = pos; ts_max = ts; } if (target_ts >= ts) { pos_min = pos; ts_min = ts; } } pos = (flags & AVSEEK_FLAG_BACKWARD) ? pos_min : pos_max; ts = (flags & AVSEEK_FLAG_BACKWARD) ? ts_min : ts_max; #if 0 pos_min = pos; ts_min = ff_read_timestamp(s, stream_index, &pos_min, INT64_MAX, read_timestamp); pos_min++; ts_max = ff_read_timestamp(s, stream_index, &pos_min, INT64_MAX, read_timestamp); av_dlog(s, "pos=0x%"PRIx64" %s<=%s<=%s\n", pos, av_ts2str(ts_min), av_ts2str(target_ts), av_ts2str(ts_max)); #endif *ts_ret= ts; return pos; }
false
FFmpeg
f8ca8138f01d0a7d96d4e1ea65fecd1197f96206
int64_t ff_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, int64_t pos_min, int64_t pos_max, int64_t pos_limit, int64_t ts_min, int64_t ts_max, int flags, int64_t *ts_ret, int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t )) { int64_t pos, ts; int64_t start_pos, filesize; int no_change; av_dlog(s, "gen_seek: %d %s\n", stream_index, av_ts2str(target_ts)); if(ts_min == AV_NOPTS_VALUE){ pos_min = s->data_offset; ts_min = ff_read_timestamp(s, stream_index, &pos_min, INT64_MAX, read_timestamp); if (ts_min == AV_NOPTS_VALUE) return -1; } if(ts_min >= target_ts){ *ts_ret= ts_min; return pos_min; } if(ts_max == AV_NOPTS_VALUE){ int64_t step= 1024; int64_t limit; filesize = avio_size(s->pb); pos_max = filesize - 1; do{ limit = pos_max; pos_max = FFMAX(0, pos_max - step); ts_max = ff_read_timestamp(s, stream_index, &pos_max, limit, read_timestamp); step += step; }while(ts_max == AV_NOPTS_VALUE && pos_max > 0); if (ts_max == AV_NOPTS_VALUE) return -1; for(;;){ int64_t tmp_pos= pos_max + 1; int64_t tmp_ts= ff_read_timestamp(s, stream_index, &tmp_pos, INT64_MAX, read_timestamp); if(tmp_ts == AV_NOPTS_VALUE) break; ts_max= tmp_ts; pos_max= tmp_pos; if(tmp_pos >= filesize) break; } pos_limit= pos_max; } if(ts_max <= target_ts){ *ts_ret= ts_max; return pos_max; } if(ts_min > ts_max){ return -1; }else if(ts_min == ts_max){ pos_limit= pos_min; } no_change=0; while (pos_min < pos_limit) { av_dlog(s, "pos_min=0x%"PRIx64" pos_max=0x%"PRIx64" dts_min=%s dts_max=%s\n", pos_min, pos_max, av_ts2str(ts_min), av_ts2str(ts_max)); assert(pos_limit <= pos_max); if(no_change==0){ int64_t approximate_keyframe_distance= pos_max - pos_limit; pos = av_rescale(target_ts - ts_min, pos_max - pos_min, ts_max - ts_min) + pos_min - approximate_keyframe_distance; }else if(no_change==1){ pos = (pos_min + pos_limit)>>1; }else{ pos=pos_min; } if(pos <= pos_min) pos= pos_min + 1; else if(pos > pos_limit) pos= pos_limit; start_pos= pos; ts = ff_read_timestamp(s, stream_index, &pos, INT64_MAX, read_timestamp); if(pos == pos_max) no_change++; else no_change=0; av_dlog(s, "%"PRId64" %"PRId64" %"PRId64" / %s %s %s target:%s limit:%"PRId64" start:%"PRId64" noc:%d\n", pos_min, pos, pos_max, av_ts2str(ts_min), av_ts2str(ts), av_ts2str(ts_max), av_ts2str(target_ts), pos_limit, start_pos, no_change); if(ts == AV_NOPTS_VALUE){ av_log(s, AV_LOG_ERROR, "read_timestamp() failed in the middle\n"); return -1; } assert(ts != AV_NOPTS_VALUE); if (target_ts <= ts) { pos_limit = start_pos - 1; pos_max = pos; ts_max = ts; } if (target_ts >= ts) { pos_min = pos; ts_min = ts; } } pos = (flags & AVSEEK_FLAG_BACKWARD) ? pos_min : pos_max; ts = (flags & AVSEEK_FLAG_BACKWARD) ? ts_min : ts_max; #if 0 pos_min = pos; ts_min = ff_read_timestamp(s, stream_index, &pos_min, INT64_MAX, read_timestamp); pos_min++; ts_max = ff_read_timestamp(s, stream_index, &pos_min, INT64_MAX, read_timestamp); av_dlog(s, "pos=0x%"PRIx64" %s<=%s<=%s\n", pos, av_ts2str(ts_min), av_ts2str(target_ts), av_ts2str(ts_max)); #endif *ts_ret= ts; return pos; }
{ "code": [], "line_no": [] }
int64_t FUNC_0(AVFormatContext *s, int stream_index, int64_t target_ts, int64_t pos_min, int64_t pos_max, int64_t pos_limit, int64_t ts_min, int64_t ts_max, int flags, int64_t *ts_ret, int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t )) { int64_t pos, ts; int64_t start_pos, filesize; int VAR_0; av_dlog(s, "gen_seek: %d %s\n", stream_index, av_ts2str(target_ts)); if(ts_min == AV_NOPTS_VALUE){ pos_min = s->data_offset; ts_min = ff_read_timestamp(s, stream_index, &pos_min, INT64_MAX, read_timestamp); if (ts_min == AV_NOPTS_VALUE) return -1; } if(ts_min >= target_ts){ *ts_ret= ts_min; return pos_min; } if(ts_max == AV_NOPTS_VALUE){ int64_t step= 1024; int64_t limit; filesize = avio_size(s->pb); pos_max = filesize - 1; do{ limit = pos_max; pos_max = FFMAX(0, pos_max - step); ts_max = ff_read_timestamp(s, stream_index, &pos_max, limit, read_timestamp); step += step; }while(ts_max == AV_NOPTS_VALUE && pos_max > 0); if (ts_max == AV_NOPTS_VALUE) return -1; for(;;){ int64_t tmp_pos= pos_max + 1; int64_t tmp_ts= ff_read_timestamp(s, stream_index, &tmp_pos, INT64_MAX, read_timestamp); if(tmp_ts == AV_NOPTS_VALUE) break; ts_max= tmp_ts; pos_max= tmp_pos; if(tmp_pos >= filesize) break; } pos_limit= pos_max; } if(ts_max <= target_ts){ *ts_ret= ts_max; return pos_max; } if(ts_min > ts_max){ return -1; }else if(ts_min == ts_max){ pos_limit= pos_min; } VAR_0=0; while (pos_min < pos_limit) { av_dlog(s, "pos_min=0x%"PRIx64" pos_max=0x%"PRIx64" dts_min=%s dts_max=%s\n", pos_min, pos_max, av_ts2str(ts_min), av_ts2str(ts_max)); assert(pos_limit <= pos_max); if(VAR_0==0){ int64_t approximate_keyframe_distance= pos_max - pos_limit; pos = av_rescale(target_ts - ts_min, pos_max - pos_min, ts_max - ts_min) + pos_min - approximate_keyframe_distance; }else if(VAR_0==1){ pos = (pos_min + pos_limit)>>1; }else{ pos=pos_min; } if(pos <= pos_min) pos= pos_min + 1; else if(pos > pos_limit) pos= pos_limit; start_pos= pos; ts = ff_read_timestamp(s, stream_index, &pos, INT64_MAX, read_timestamp); if(pos == pos_max) VAR_0++; else VAR_0=0; av_dlog(s, "%"PRId64" %"PRId64" %"PRId64" / %s %s %s target:%s limit:%"PRId64" start:%"PRId64" noc:%d\n", pos_min, pos, pos_max, av_ts2str(ts_min), av_ts2str(ts), av_ts2str(ts_max), av_ts2str(target_ts), pos_limit, start_pos, VAR_0); if(ts == AV_NOPTS_VALUE){ av_log(s, AV_LOG_ERROR, "read_timestamp() failed in the middle\n"); return -1; } assert(ts != AV_NOPTS_VALUE); if (target_ts <= ts) { pos_limit = start_pos - 1; pos_max = pos; ts_max = ts; } if (target_ts >= ts) { pos_min = pos; ts_min = ts; } } pos = (flags & AVSEEK_FLAG_BACKWARD) ? pos_min : pos_max; ts = (flags & AVSEEK_FLAG_BACKWARD) ? ts_min : ts_max; #if 0 pos_min = pos; ts_min = ff_read_timestamp(s, stream_index, &pos_min, INT64_MAX, read_timestamp); pos_min++; ts_max = ff_read_timestamp(s, stream_index, &pos_min, INT64_MAX, read_timestamp); av_dlog(s, "pos=0x%"PRIx64" %s<=%s<=%s\n", pos, av_ts2str(ts_min), av_ts2str(target_ts), av_ts2str(ts_max)); #endif *ts_ret= ts; return pos; }
[ "int64_t FUNC_0(AVFormatContext *s, int stream_index, int64_t target_ts,\nint64_t pos_min, int64_t pos_max, int64_t pos_limit,\nint64_t ts_min, int64_t ts_max, int flags, int64_t *ts_ret,\nint64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t ))\n{", "int64_t pos, ts;", "int64_t start_pos, filesize;", "int VAR_0;", "av_dlog(s, \"gen_seek: %d %s\\n\", stream_index, av_ts2str(target_ts));", "if(ts_min == AV_NOPTS_VALUE){", "pos_min = s->data_offset;", "ts_min = ff_read_timestamp(s, stream_index, &pos_min, INT64_MAX, read_timestamp);", "if (ts_min == AV_NOPTS_VALUE)\nreturn -1;", "}", "if(ts_min >= target_ts){", "*ts_ret= ts_min;", "return pos_min;", "}", "if(ts_max == AV_NOPTS_VALUE){", "int64_t step= 1024;", "int64_t limit;", "filesize = avio_size(s->pb);", "pos_max = filesize - 1;", "do{", "limit = pos_max;", "pos_max = FFMAX(0, pos_max - step);", "ts_max = ff_read_timestamp(s, stream_index, &pos_max, limit, read_timestamp);", "step += step;", "}while(ts_max == AV_NOPTS_VALUE && pos_max > 0);", "if (ts_max == AV_NOPTS_VALUE)\nreturn -1;", "for(;;){", "int64_t tmp_pos= pos_max + 1;", "int64_t tmp_ts= ff_read_timestamp(s, stream_index, &tmp_pos, INT64_MAX, read_timestamp);", "if(tmp_ts == AV_NOPTS_VALUE)\nbreak;", "ts_max= tmp_ts;", "pos_max= tmp_pos;", "if(tmp_pos >= filesize)\nbreak;", "}", "pos_limit= pos_max;", "}", "if(ts_max <= target_ts){", "*ts_ret= ts_max;", "return pos_max;", "}", "if(ts_min > ts_max){", "return -1;", "}else if(ts_min == ts_max){", "pos_limit= pos_min;", "}", "VAR_0=0;", "while (pos_min < pos_limit) {", "av_dlog(s, \"pos_min=0x%\"PRIx64\" pos_max=0x%\"PRIx64\" dts_min=%s dts_max=%s\\n\",\npos_min, pos_max, av_ts2str(ts_min), av_ts2str(ts_max));", "assert(pos_limit <= pos_max);", "if(VAR_0==0){", "int64_t approximate_keyframe_distance= pos_max - pos_limit;", "pos = av_rescale(target_ts - ts_min, pos_max - pos_min, ts_max - ts_min)\n+ pos_min - approximate_keyframe_distance;", "}else if(VAR_0==1){", "pos = (pos_min + pos_limit)>>1;", "}else{", "pos=pos_min;", "}", "if(pos <= pos_min)\npos= pos_min + 1;", "else if(pos > pos_limit)\npos= pos_limit;", "start_pos= pos;", "ts = ff_read_timestamp(s, stream_index, &pos, INT64_MAX, read_timestamp);", "if(pos == pos_max)\nVAR_0++;", "else\nVAR_0=0;", "av_dlog(s, \"%\"PRId64\" %\"PRId64\" %\"PRId64\" / %s %s %s target:%s limit:%\"PRId64\" start:%\"PRId64\" noc:%d\\n\",\npos_min, pos, pos_max,\nav_ts2str(ts_min), av_ts2str(ts), av_ts2str(ts_max), av_ts2str(target_ts),\npos_limit, start_pos, VAR_0);", "if(ts == AV_NOPTS_VALUE){", "av_log(s, AV_LOG_ERROR, \"read_timestamp() failed in the middle\\n\");", "return -1;", "}", "assert(ts != AV_NOPTS_VALUE);", "if (target_ts <= ts) {", "pos_limit = start_pos - 1;", "pos_max = pos;", "ts_max = ts;", "}", "if (target_ts >= ts) {", "pos_min = pos;", "ts_min = ts;", "}", "}", "pos = (flags & AVSEEK_FLAG_BACKWARD) ? pos_min : pos_max;", "ts = (flags & AVSEEK_FLAG_BACKWARD) ? ts_min : ts_max;", "#if 0\npos_min = pos;", "ts_min = ff_read_timestamp(s, stream_index, &pos_min, INT64_MAX, read_timestamp);", "pos_min++;", "ts_max = ff_read_timestamp(s, stream_index, &pos_min, INT64_MAX, read_timestamp);", "av_dlog(s, \"pos=0x%\"PRIx64\" %s<=%s<=%s\\n\",\npos, av_ts2str(ts_min), av_ts2str(target_ts), av_ts2str(ts_max));", "#endif\n*ts_ret= ts;", "return pos;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127, 129 ], [ 131 ], [ 135 ], [ 137 ], [ 141, 143 ], [ 145 ], [ 149 ], [ 151 ], [ 157 ], [ 159 ], [ 161, 163 ], [ 165, 167 ], [ 169 ], [ 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, 239 ], [ 241, 243 ], [ 245 ], [ 247 ] ]
21,780
static int mov_write_udta_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { AVIOContext *pb_buf; int i, ret, size; uint8_t *buf; for (i = 0; i < s->nb_streams; i++) if (s->flags & AVFMT_FLAG_BITEXACT) { return 0; } ret = avio_open_dyn_buf(&pb_buf); if (ret < 0) return ret; if (mov->mode & MODE_3GP) { mov_write_3gp_udta_tag(pb_buf, s, "perf", "artist"); mov_write_3gp_udta_tag(pb_buf, s, "titl", "title"); mov_write_3gp_udta_tag(pb_buf, s, "auth", "author"); mov_write_3gp_udta_tag(pb_buf, s, "gnre", "genre"); mov_write_3gp_udta_tag(pb_buf, s, "dscp", "comment"); mov_write_3gp_udta_tag(pb_buf, s, "albm", "album"); mov_write_3gp_udta_tag(pb_buf, s, "cprt", "copyright"); mov_write_3gp_udta_tag(pb_buf, s, "yrrc", "date"); } else if (mov->mode == MODE_MOV) { // the title field breaks gtkpod with mp4 and my suspicion is that stuff is not valid in mp4 mov_write_string_metadata(s, pb_buf, "\251ART", "artist", 0); mov_write_string_metadata(s, pb_buf, "\251nam", "title", 0); mov_write_string_metadata(s, pb_buf, "\251aut", "author", 0); mov_write_string_metadata(s, pb_buf, "\251alb", "album", 0); mov_write_string_metadata(s, pb_buf, "\251day", "date", 0); mov_write_string_metadata(s, pb_buf, "\251swr", "encoder", 0); mov_write_string_metadata(s, pb_buf, "\251des", "comment", 0); mov_write_string_metadata(s, pb_buf, "\251gen", "genre", 0); mov_write_string_metadata(s, pb_buf, "\251cpy", "copyright", 0); } else { /* iTunes meta data */ mov_write_meta_tag(pb_buf, mov, s); } if (s->nb_chapters && !(mov->flags & FF_MOV_FLAG_DISABLE_CHPL)) mov_write_chpl_tag(pb_buf, s); if ((size = avio_close_dyn_buf(pb_buf, &buf)) > 0) { avio_wb32(pb, size + 8); ffio_wfourcc(pb, "udta"); avio_write(pb, buf, size); } av_free(buf); return 0; }
false
FFmpeg
d9432789bd119f0e37bcf65cebda05d36aafd4ed
static int mov_write_udta_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { AVIOContext *pb_buf; int i, ret, size; uint8_t *buf; for (i = 0; i < s->nb_streams; i++) if (s->flags & AVFMT_FLAG_BITEXACT) { return 0; } ret = avio_open_dyn_buf(&pb_buf); if (ret < 0) return ret; if (mov->mode & MODE_3GP) { mov_write_3gp_udta_tag(pb_buf, s, "perf", "artist"); mov_write_3gp_udta_tag(pb_buf, s, "titl", "title"); mov_write_3gp_udta_tag(pb_buf, s, "auth", "author"); mov_write_3gp_udta_tag(pb_buf, s, "gnre", "genre"); mov_write_3gp_udta_tag(pb_buf, s, "dscp", "comment"); mov_write_3gp_udta_tag(pb_buf, s, "albm", "album"); mov_write_3gp_udta_tag(pb_buf, s, "cprt", "copyright"); mov_write_3gp_udta_tag(pb_buf, s, "yrrc", "date"); } else if (mov->mode == MODE_MOV) { mov_write_string_metadata(s, pb_buf, "\251ART", "artist", 0); mov_write_string_metadata(s, pb_buf, "\251nam", "title", 0); mov_write_string_metadata(s, pb_buf, "\251aut", "author", 0); mov_write_string_metadata(s, pb_buf, "\251alb", "album", 0); mov_write_string_metadata(s, pb_buf, "\251day", "date", 0); mov_write_string_metadata(s, pb_buf, "\251swr", "encoder", 0); mov_write_string_metadata(s, pb_buf, "\251des", "comment", 0); mov_write_string_metadata(s, pb_buf, "\251gen", "genre", 0); mov_write_string_metadata(s, pb_buf, "\251cpy", "copyright", 0); } else { mov_write_meta_tag(pb_buf, mov, s); } if (s->nb_chapters && !(mov->flags & FF_MOV_FLAG_DISABLE_CHPL)) mov_write_chpl_tag(pb_buf, s); if ((size = avio_close_dyn_buf(pb_buf, &buf)) > 0) { avio_wb32(pb, size + 8); ffio_wfourcc(pb, "udta"); avio_write(pb, buf, size); } av_free(buf); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVIOContext *VAR_0, MOVMuxContext *VAR_1, AVFormatContext *VAR_2) { AVIOContext *pb_buf; int VAR_3, VAR_4, VAR_5; uint8_t *buf; for (VAR_3 = 0; VAR_3 < VAR_2->nb_streams; VAR_3++) if (VAR_2->flags & AVFMT_FLAG_BITEXACT) { return 0; } VAR_4 = avio_open_dyn_buf(&pb_buf); if (VAR_4 < 0) return VAR_4; if (VAR_1->mode & MODE_3GP) { mov_write_3gp_udta_tag(pb_buf, VAR_2, "perf", "artist"); mov_write_3gp_udta_tag(pb_buf, VAR_2, "titl", "title"); mov_write_3gp_udta_tag(pb_buf, VAR_2, "auth", "author"); mov_write_3gp_udta_tag(pb_buf, VAR_2, "gnre", "genre"); mov_write_3gp_udta_tag(pb_buf, VAR_2, "dscp", "comment"); mov_write_3gp_udta_tag(pb_buf, VAR_2, "albm", "album"); mov_write_3gp_udta_tag(pb_buf, VAR_2, "cprt", "copyright"); mov_write_3gp_udta_tag(pb_buf, VAR_2, "yrrc", "date"); } else if (VAR_1->mode == MODE_MOV) { mov_write_string_metadata(VAR_2, pb_buf, "\251ART", "artist", 0); mov_write_string_metadata(VAR_2, pb_buf, "\251nam", "title", 0); mov_write_string_metadata(VAR_2, pb_buf, "\251aut", "author", 0); mov_write_string_metadata(VAR_2, pb_buf, "\251alb", "album", 0); mov_write_string_metadata(VAR_2, pb_buf, "\251day", "date", 0); mov_write_string_metadata(VAR_2, pb_buf, "\251swr", "encoder", 0); mov_write_string_metadata(VAR_2, pb_buf, "\251des", "comment", 0); mov_write_string_metadata(VAR_2, pb_buf, "\251gen", "genre", 0); mov_write_string_metadata(VAR_2, pb_buf, "\251cpy", "copyright", 0); } else { mov_write_meta_tag(pb_buf, VAR_1, VAR_2); } if (VAR_2->nb_chapters && !(VAR_1->flags & FF_MOV_FLAG_DISABLE_CHPL)) mov_write_chpl_tag(pb_buf, VAR_2); if ((VAR_5 = avio_close_dyn_buf(pb_buf, &buf)) > 0) { avio_wb32(VAR_0, VAR_5 + 8); ffio_wfourcc(VAR_0, "udta"); avio_write(VAR_0, buf, VAR_5); } av_free(buf); return 0; }
[ "static int FUNC_0(AVIOContext *VAR_0, MOVMuxContext *VAR_1,\nAVFormatContext *VAR_2)\n{", "AVIOContext *pb_buf;", "int VAR_3, VAR_4, VAR_5;", "uint8_t *buf;", "for (VAR_3 = 0; VAR_3 < VAR_2->nb_streams; VAR_3++)", "if (VAR_2->flags & AVFMT_FLAG_BITEXACT) {", "return 0;", "}", "VAR_4 = avio_open_dyn_buf(&pb_buf);", "if (VAR_4 < 0)\nreturn VAR_4;", "if (VAR_1->mode & MODE_3GP) {", "mov_write_3gp_udta_tag(pb_buf, VAR_2, \"perf\", \"artist\");", "mov_write_3gp_udta_tag(pb_buf, VAR_2, \"titl\", \"title\");", "mov_write_3gp_udta_tag(pb_buf, VAR_2, \"auth\", \"author\");", "mov_write_3gp_udta_tag(pb_buf, VAR_2, \"gnre\", \"genre\");", "mov_write_3gp_udta_tag(pb_buf, VAR_2, \"dscp\", \"comment\");", "mov_write_3gp_udta_tag(pb_buf, VAR_2, \"albm\", \"album\");", "mov_write_3gp_udta_tag(pb_buf, VAR_2, \"cprt\", \"copyright\");", "mov_write_3gp_udta_tag(pb_buf, VAR_2, \"yrrc\", \"date\");", "} else if (VAR_1->mode == MODE_MOV) {", "mov_write_string_metadata(VAR_2, pb_buf, \"\\251ART\", \"artist\", 0);", "mov_write_string_metadata(VAR_2, pb_buf, \"\\251nam\", \"title\", 0);", "mov_write_string_metadata(VAR_2, pb_buf, \"\\251aut\", \"author\", 0);", "mov_write_string_metadata(VAR_2, pb_buf, \"\\251alb\", \"album\", 0);", "mov_write_string_metadata(VAR_2, pb_buf, \"\\251day\", \"date\", 0);", "mov_write_string_metadata(VAR_2, pb_buf, \"\\251swr\", \"encoder\", 0);", "mov_write_string_metadata(VAR_2, pb_buf, \"\\251des\", \"comment\", 0);", "mov_write_string_metadata(VAR_2, pb_buf, \"\\251gen\", \"genre\", 0);", "mov_write_string_metadata(VAR_2, pb_buf, \"\\251cpy\", \"copyright\", 0);", "} else {", "mov_write_meta_tag(pb_buf, VAR_1, VAR_2);", "}", "if (VAR_2->nb_chapters && !(VAR_1->flags & FF_MOV_FLAG_DISABLE_CHPL))\nmov_write_chpl_tag(pb_buf, VAR_2);", "if ((VAR_5 = avio_close_dyn_buf(pb_buf, &buf)) > 0) {", "avio_wb32(VAR_0, VAR_5 + 8);", "ffio_wfourcc(VAR_0, \"udta\");", "avio_write(VAR_0, buf, VAR_5);", "}", "av_free(buf);", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27, 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 81, 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ] ]
21,781
static void write_video_frame(AVFormatContext *oc, AVStream *st) { int ret; static struct SwsContext *sws_ctx; AVCodecContext *c = st->codec; if (frame_count >= STREAM_NB_FRAMES) { /* No more frames to compress. The codec has a latency of a few * frames if using B-frames, so we get the last frames by * passing the same picture again. */ } else { if (c->pix_fmt != AV_PIX_FMT_YUV420P) { /* as we only generate a YUV420P picture, we must convert it * to the codec pixel format if needed */ if (!sws_ctx) { sws_ctx = sws_getContext(c->width, c->height, AV_PIX_FMT_YUV420P, c->width, c->height, c->pix_fmt, sws_flags, NULL, NULL, NULL); if (!sws_ctx) { fprintf(stderr, "Could not initialize the conversion context\n"); exit(1); } } fill_yuv_image(&src_picture, frame_count, c->width, c->height); sws_scale(sws_ctx, (const uint8_t * const *)src_picture.data, src_picture.linesize, 0, c->height, dst_picture.data, dst_picture.linesize); } else { fill_yuv_image(&dst_picture, frame_count, c->width, c->height); } } if (oc->oformat->flags & AVFMT_RAWPICTURE) { /* Raw video case - directly store the picture in the packet */ AVPacket pkt; av_init_packet(&pkt); pkt.flags |= AV_PKT_FLAG_KEY; pkt.stream_index = st->index; pkt.data = dst_picture.data[0]; pkt.size = sizeof(AVPicture); ret = av_interleaved_write_frame(oc, &pkt); } else { AVPacket pkt = { 0 }; int got_packet; av_init_packet(&pkt); /* encode the image */ frame->pts = frame_count; ret = avcodec_encode_video2(c, &pkt, frame, &got_packet); if (ret < 0) { fprintf(stderr, "Error encoding video frame: %s\n", av_err2str(ret)); exit(1); } /* If size is zero, it means the image was buffered. */ if (got_packet) { ret = write_frame(oc, &c->time_base, st, &pkt); } else { ret = 0; } } if (ret != 0) { fprintf(stderr, "Error while writing video frame: %s\n", av_err2str(ret)); exit(1); } frame_count++; }
false
FFmpeg
b933c72b5e36967b6be73555e8289cc074fb44a7
static void write_video_frame(AVFormatContext *oc, AVStream *st) { int ret; static struct SwsContext *sws_ctx; AVCodecContext *c = st->codec; if (frame_count >= STREAM_NB_FRAMES) { } else { if (c->pix_fmt != AV_PIX_FMT_YUV420P) { if (!sws_ctx) { sws_ctx = sws_getContext(c->width, c->height, AV_PIX_FMT_YUV420P, c->width, c->height, c->pix_fmt, sws_flags, NULL, NULL, NULL); if (!sws_ctx) { fprintf(stderr, "Could not initialize the conversion context\n"); exit(1); } } fill_yuv_image(&src_picture, frame_count, c->width, c->height); sws_scale(sws_ctx, (const uint8_t * const *)src_picture.data, src_picture.linesize, 0, c->height, dst_picture.data, dst_picture.linesize); } else { fill_yuv_image(&dst_picture, frame_count, c->width, c->height); } } if (oc->oformat->flags & AVFMT_RAWPICTURE) { AVPacket pkt; av_init_packet(&pkt); pkt.flags |= AV_PKT_FLAG_KEY; pkt.stream_index = st->index; pkt.data = dst_picture.data[0]; pkt.size = sizeof(AVPicture); ret = av_interleaved_write_frame(oc, &pkt); } else { AVPacket pkt = { 0 }; int got_packet; av_init_packet(&pkt); frame->pts = frame_count; ret = avcodec_encode_video2(c, &pkt, frame, &got_packet); if (ret < 0) { fprintf(stderr, "Error encoding video frame: %s\n", av_err2str(ret)); exit(1); } if (got_packet) { ret = write_frame(oc, &c->time_base, st, &pkt); } else { ret = 0; } } if (ret != 0) { fprintf(stderr, "Error while writing video frame: %s\n", av_err2str(ret)); exit(1); } frame_count++; }
{ "code": [], "line_no": [] }
static void FUNC_0(AVFormatContext *VAR_0, AVStream *VAR_1) { int VAR_2; static struct SwsContext *VAR_3; AVCodecContext *c = VAR_1->codec; if (frame_count >= STREAM_NB_FRAMES) { } else { if (c->pix_fmt != AV_PIX_FMT_YUV420P) { if (!VAR_3) { VAR_3 = sws_getContext(c->width, c->height, AV_PIX_FMT_YUV420P, c->width, c->height, c->pix_fmt, sws_flags, NULL, NULL, NULL); if (!VAR_3) { fprintf(stderr, "Could not initialize the conversion context\n"); exit(1); } } fill_yuv_image(&src_picture, frame_count, c->width, c->height); sws_scale(VAR_3, (const uint8_t * const *)src_picture.data, src_picture.linesize, 0, c->height, dst_picture.data, dst_picture.linesize); } else { fill_yuv_image(&dst_picture, frame_count, c->width, c->height); } } if (VAR_0->oformat->flags & AVFMT_RAWPICTURE) { AVPacket pkt; av_init_packet(&pkt); pkt.flags |= AV_PKT_FLAG_KEY; pkt.stream_index = VAR_1->index; pkt.data = dst_picture.data[0]; pkt.size = sizeof(AVPicture); VAR_2 = av_interleaved_write_frame(VAR_0, &pkt); } else { AVPacket pkt = { 0 }; int VAR_4; av_init_packet(&pkt); frame->pts = frame_count; VAR_2 = avcodec_encode_video2(c, &pkt, frame, &VAR_4); if (VAR_2 < 0) { fprintf(stderr, "Error encoding video frame: %s\n", av_err2str(VAR_2)); exit(1); } if (VAR_4) { VAR_2 = write_frame(VAR_0, &c->time_base, VAR_1, &pkt); } else { VAR_2 = 0; } } if (VAR_2 != 0) { fprintf(stderr, "Error while writing video frame: %s\n", av_err2str(VAR_2)); exit(1); } frame_count++; }
[ "static void FUNC_0(AVFormatContext *VAR_0, AVStream *VAR_1)\n{", "int VAR_2;", "static struct SwsContext *VAR_3;", "AVCodecContext *c = VAR_1->codec;", "if (frame_count >= STREAM_NB_FRAMES) {", "} else {", "if (c->pix_fmt != AV_PIX_FMT_YUV420P) {", "if (!VAR_3) {", "VAR_3 = sws_getContext(c->width, c->height, AV_PIX_FMT_YUV420P,\nc->width, c->height, c->pix_fmt,\nsws_flags, NULL, NULL, NULL);", "if (!VAR_3) {", "fprintf(stderr,\n\"Could not initialize the conversion context\\n\");", "exit(1);", "}", "}", "fill_yuv_image(&src_picture, frame_count, c->width, c->height);", "sws_scale(VAR_3,\n(const uint8_t * const *)src_picture.data, src_picture.linesize,\n0, c->height, dst_picture.data, dst_picture.linesize);", "} else {", "fill_yuv_image(&dst_picture, frame_count, c->width, c->height);", "}", "}", "if (VAR_0->oformat->flags & AVFMT_RAWPICTURE) {", "AVPacket pkt;", "av_init_packet(&pkt);", "pkt.flags |= AV_PKT_FLAG_KEY;", "pkt.stream_index = VAR_1->index;", "pkt.data = dst_picture.data[0];", "pkt.size = sizeof(AVPicture);", "VAR_2 = av_interleaved_write_frame(VAR_0, &pkt);", "} else {", "AVPacket pkt = { 0 };", "int VAR_4;", "av_init_packet(&pkt);", "frame->pts = frame_count;", "VAR_2 = avcodec_encode_video2(c, &pkt, frame, &VAR_4);", "if (VAR_2 < 0) {", "fprintf(stderr, \"Error encoding video frame: %s\\n\", av_err2str(VAR_2));", "exit(1);", "}", "if (VAR_4) {", "VAR_2 = write_frame(VAR_0, &c->time_base, VAR_1, &pkt);", "} else {", "VAR_2 = 0;", "}", "}", "if (VAR_2 != 0) {", "fprintf(stderr, \"Error while writing video frame: %s\\n\", av_err2str(VAR_2));", "exit(1);", "}", "frame_count++;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 21 ], [ 23 ], [ 29 ], [ 31, 33, 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51, 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ] ]
21,782
static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args, uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size, int keyframe) { H264BSFContext *ctx = bsfc->priv_data; uint8_t unit_type; uint32_t nal_size, cumul_size = 0; /* nothing to filter */ if (!avctx->extradata || avctx->extradata_size < 6) { *poutbuf = (uint8_t*) buf; *poutbuf_size = buf_size; return 0; } /* retrieve sps and pps NAL units from extradata */ if (!ctx->sps_pps_data) { uint16_t unit_size; uint32_t total_size = 0; uint8_t *out = NULL, unit_nb, sps_done = 0; const uint8_t *extradata = avctx->extradata+4; static const uint8_t nalu_header[4] = {0, 0, 0, 1}; /* retrieve length coded size */ ctx->length_size = (*extradata++ & 0x3) + 1; if (ctx->length_size == 3) return AVERROR(EINVAL); /* retrieve sps and pps unit(s) */ unit_nb = *extradata++ & 0x1f; /* number of sps unit(s) */ if (!unit_nb) { unit_nb = *extradata++; /* number of pps unit(s) */ sps_done++; } while (unit_nb--) { unit_size = AV_RB16(extradata); total_size += unit_size+4; if (extradata+2+unit_size > avctx->extradata+avctx->extradata_size) { av_free(out); return AVERROR(EINVAL); } out = av_realloc(out, total_size); if (!out) return AVERROR(ENOMEM); memcpy(out+total_size-unit_size-4, nalu_header, 4); memcpy(out+total_size-unit_size, extradata+2, unit_size); extradata += 2+unit_size; if (!unit_nb && !sps_done++) unit_nb = *extradata++; /* number of pps unit(s) */ } ctx->sps_pps_data = out; ctx->size = total_size; ctx->first_idr = 1; } *poutbuf_size = 0; *poutbuf = NULL; do { if (ctx->length_size == 1) nal_size = buf[0]; else if (ctx->length_size == 2) nal_size = AV_RB16(buf); else nal_size = AV_RB32(buf); buf += ctx->length_size; unit_type = *buf & 0x1f; /* prepend only to the first type 5 NAL unit of an IDR picture */ if (ctx->first_idr && unit_type == 5) { alloc_and_copy(poutbuf, poutbuf_size, ctx->sps_pps_data, ctx->size, buf, nal_size); ctx->first_idr = 0; } else { alloc_and_copy(poutbuf, poutbuf_size, NULL, 0, buf, nal_size); if (!ctx->first_idr && unit_type == 1) ctx->first_idr = 1; } buf += nal_size; cumul_size += nal_size + ctx->length_size; } while (cumul_size < buf_size); return 1; }
false
FFmpeg
52486603b5b8e2827627afbc8a2028fb74554920
static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args, uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size, int keyframe) { H264BSFContext *ctx = bsfc->priv_data; uint8_t unit_type; uint32_t nal_size, cumul_size = 0; if (!avctx->extradata || avctx->extradata_size < 6) { *poutbuf = (uint8_t*) buf; *poutbuf_size = buf_size; return 0; } if (!ctx->sps_pps_data) { uint16_t unit_size; uint32_t total_size = 0; uint8_t *out = NULL, unit_nb, sps_done = 0; const uint8_t *extradata = avctx->extradata+4; static const uint8_t nalu_header[4] = {0, 0, 0, 1}; ctx->length_size = (*extradata++ & 0x3) + 1; if (ctx->length_size == 3) return AVERROR(EINVAL); unit_nb = *extradata++ & 0x1f; if (!unit_nb) { unit_nb = *extradata++; sps_done++; } while (unit_nb--) { unit_size = AV_RB16(extradata); total_size += unit_size+4; if (extradata+2+unit_size > avctx->extradata+avctx->extradata_size) { av_free(out); return AVERROR(EINVAL); } out = av_realloc(out, total_size); if (!out) return AVERROR(ENOMEM); memcpy(out+total_size-unit_size-4, nalu_header, 4); memcpy(out+total_size-unit_size, extradata+2, unit_size); extradata += 2+unit_size; if (!unit_nb && !sps_done++) unit_nb = *extradata++; } ctx->sps_pps_data = out; ctx->size = total_size; ctx->first_idr = 1; } *poutbuf_size = 0; *poutbuf = NULL; do { if (ctx->length_size == 1) nal_size = buf[0]; else if (ctx->length_size == 2) nal_size = AV_RB16(buf); else nal_size = AV_RB32(buf); buf += ctx->length_size; unit_type = *buf & 0x1f; if (ctx->first_idr && unit_type == 5) { alloc_and_copy(poutbuf, poutbuf_size, ctx->sps_pps_data, ctx->size, buf, nal_size); ctx->first_idr = 0; } else { alloc_and_copy(poutbuf, poutbuf_size, NULL, 0, buf, nal_size); if (!ctx->first_idr && unit_type == 1) ctx->first_idr = 1; } buf += nal_size; cumul_size += nal_size + ctx->length_size; } while (cumul_size < buf_size); return 1; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVBitStreamFilterContext *VAR_0, AVCodecContext *VAR_1, const char *VAR_2, uint8_t **VAR_3, int *VAR_4, const uint8_t *VAR_5, int VAR_6, int VAR_7) { H264BSFContext *ctx = VAR_0->priv_data; uint8_t unit_type; uint32_t nal_size, cumul_size = 0; if (!VAR_1->VAR_8 || VAR_1->extradata_size < 6) { *VAR_3 = (uint8_t*) VAR_5; *VAR_4 = VAR_6; return 0; } if (!ctx->sps_pps_data) { uint16_t unit_size; uint32_t total_size = 0; uint8_t *out = NULL, unit_nb, sps_done = 0; const uint8_t *VAR_8 = VAR_1->VAR_8+4; static const uint8_t VAR_9[4] = {0, 0, 0, 1}; ctx->length_size = (*VAR_8++ & 0x3) + 1; if (ctx->length_size == 3) return AVERROR(EINVAL); unit_nb = *VAR_8++ & 0x1f; if (!unit_nb) { unit_nb = *VAR_8++; sps_done++; } while (unit_nb--) { unit_size = AV_RB16(VAR_8); total_size += unit_size+4; if (VAR_8+2+unit_size > VAR_1->VAR_8+VAR_1->extradata_size) { av_free(out); return AVERROR(EINVAL); } out = av_realloc(out, total_size); if (!out) return AVERROR(ENOMEM); memcpy(out+total_size-unit_size-4, VAR_9, 4); memcpy(out+total_size-unit_size, VAR_8+2, unit_size); VAR_8 += 2+unit_size; if (!unit_nb && !sps_done++) unit_nb = *VAR_8++; } ctx->sps_pps_data = out; ctx->size = total_size; ctx->first_idr = 1; } *VAR_4 = 0; *VAR_3 = NULL; do { if (ctx->length_size == 1) nal_size = VAR_5[0]; else if (ctx->length_size == 2) nal_size = AV_RB16(VAR_5); else nal_size = AV_RB32(VAR_5); VAR_5 += ctx->length_size; unit_type = *VAR_5 & 0x1f; if (ctx->first_idr && unit_type == 5) { alloc_and_copy(VAR_3, VAR_4, ctx->sps_pps_data, ctx->size, VAR_5, nal_size); ctx->first_idr = 0; } else { alloc_and_copy(VAR_3, VAR_4, NULL, 0, VAR_5, nal_size); if (!ctx->first_idr && unit_type == 1) ctx->first_idr = 1; } VAR_5 += nal_size; cumul_size += nal_size + ctx->length_size; } while (cumul_size < VAR_6); return 1; }
[ "static int FUNC_0(AVBitStreamFilterContext *VAR_0,\nAVCodecContext *VAR_1, const char *VAR_2,\nuint8_t **VAR_3, int *VAR_4,\nconst uint8_t *VAR_5, int VAR_6,\nint VAR_7) {", "H264BSFContext *ctx = VAR_0->priv_data;", "uint8_t unit_type;", "uint32_t nal_size, cumul_size = 0;", "if (!VAR_1->VAR_8 || VAR_1->extradata_size < 6) {", "*VAR_3 = (uint8_t*) VAR_5;", "*VAR_4 = VAR_6;", "return 0;", "}", "if (!ctx->sps_pps_data) {", "uint16_t unit_size;", "uint32_t total_size = 0;", "uint8_t *out = NULL, unit_nb, sps_done = 0;", "const uint8_t *VAR_8 = VAR_1->VAR_8+4;", "static const uint8_t VAR_9[4] = {0, 0, 0, 1};", "ctx->length_size = (*VAR_8++ & 0x3) + 1;", "if (ctx->length_size == 3)\nreturn AVERROR(EINVAL);", "unit_nb = *VAR_8++ & 0x1f;", "if (!unit_nb) {", "unit_nb = *VAR_8++;", "sps_done++;", "}", "while (unit_nb--) {", "unit_size = AV_RB16(VAR_8);", "total_size += unit_size+4;", "if (VAR_8+2+unit_size > VAR_1->VAR_8+VAR_1->extradata_size) {", "av_free(out);", "return AVERROR(EINVAL);", "}", "out = av_realloc(out, total_size);", "if (!out)\nreturn AVERROR(ENOMEM);", "memcpy(out+total_size-unit_size-4, VAR_9, 4);", "memcpy(out+total_size-unit_size, VAR_8+2, unit_size);", "VAR_8 += 2+unit_size;", "if (!unit_nb && !sps_done++)\nunit_nb = *VAR_8++;", "}", "ctx->sps_pps_data = out;", "ctx->size = total_size;", "ctx->first_idr = 1;", "}", "*VAR_4 = 0;", "*VAR_3 = NULL;", "do {", "if (ctx->length_size == 1)\nnal_size = VAR_5[0];", "else if (ctx->length_size == 2)\nnal_size = AV_RB16(VAR_5);", "else\nnal_size = AV_RB32(VAR_5);", "VAR_5 += ctx->length_size;", "unit_type = *VAR_5 & 0x1f;", "if (ctx->first_idr && unit_type == 5) {", "alloc_and_copy(VAR_3, VAR_4,\nctx->sps_pps_data, ctx->size,\nVAR_5, nal_size);", "ctx->first_idr = 0;", "}", "else {", "alloc_and_copy(VAR_3, VAR_4,\nNULL, 0,\nVAR_5, nal_size);", "if (!ctx->first_idr && unit_type == 1)\nctx->first_idr = 1;", "}", "VAR_5 += nal_size;", "cumul_size += nal_size + ctx->length_size;", "} while (cumul_size < VAR_6);", "return 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 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 51 ], [ 53, 55 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99, 101 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 123, 125 ], [ 127, 129 ], [ 131, 133 ], [ 137 ], [ 139 ], [ 145 ], [ 147, 149, 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159, 161, 163 ], [ 165, 167 ], [ 169 ], [ 173 ], [ 175 ], [ 177 ], [ 181 ], [ 183 ] ]
21,783
static uint_fast8_t vorbis_floor0_decode(vorbis_context *vc, vorbis_floor_data *vfu, float *vec) { vorbis_floor0 * vf=&vfu->t0; float * lsp=vf->lsp; uint_fast32_t amplitude; uint_fast32_t book_idx; amplitude=get_bits(&vc->gb, vf->amplitude_bits); if (amplitude>0) { float last = 0; uint_fast16_t lsp_len = 0; uint_fast16_t idx; vorbis_codebook codebook; book_idx=get_bits(&vc->gb, ilog(vf->num_books)); if ( book_idx >= vf->num_books ) { av_log( vc->avccontext, AV_LOG_ERROR, "floor0 dec: booknumber too high!\n" ); //FIXME: look above } AV_DEBUG( "floor0 dec: booknumber: %u\n", book_idx ); codebook=vc->codebooks[vf->book_list[book_idx]]; while (lsp_len<vf->order) { int vec_off; AV_DEBUG( "floor0 dec: book dimension: %d\n", codebook.dimensions ); AV_DEBUG( "floor0 dec: maximum depth: %d\n", codebook.maxdepth ); /* read temp vector */ vec_off=get_vlc2(&vc->gb, codebook.vlc.table, codebook.nb_bits, codebook.maxdepth ) * codebook.dimensions; AV_DEBUG( "floor0 dec: vector offset: %d\n", vec_off ); /* copy each vector component and add last to it */ for (idx=0; idx<codebook.dimensions; ++idx) { lsp[lsp_len+idx]=codebook.codevectors[vec_off+idx]+last; } last=lsp[lsp_len+idx-1]; /* set last to last vector component */ lsp_len += codebook.dimensions; } #ifdef V_DEBUG /* DEBUG: output lsp coeffs */ { int idx; for ( idx = 0; idx < lsp_len; ++idx ) AV_DEBUG("floor0 dec: coeff at %d is %f\n", idx, lsp[idx] ); } #endif /* synthesize floor output vector */ { int i; int order=vf->order; float wstep=M_PI/vf->bark_map_size; for(i=0;i<order;i++) { lsp[i]=2.0f*cos(lsp[i]); } AV_DEBUG("floor0 synth: map_size=%d; m=%d; wstep=%f\n", vf->map_size, order, wstep); i=0; while(i<vf->map_size) { int j, iter_cond=vf->map[i]; float p=0.5f; float q=0.5f; float two_cos_w=2.0f*cos(wstep*iter_cond); // needed all times /* similar part for the q and p products */ for(j=0;j<order;j+=2) { q *= lsp[j] -two_cos_w; p *= lsp[j+1]-two_cos_w; } if(j==order) { // even order p *= p*(2.0f-two_cos_w); q *= q*(2.0f+two_cos_w); } else { // odd order q *= two_cos_w-lsp[j]; // one more time for q /* final step and square */ p *= p*(4.f-two_cos_w*two_cos_w); q *= q; } /* calculate linear floor value */ { int_fast32_t pow_of_two=2, exponent=vf->amplitude_bits; if ( vf->amplitude_bits ) { while ( --exponent ) { pow_of_two <<= 1; } } else { pow_of_two=1; } q=exp( ( ( (amplitude*vf->amplitude_offset)/ ((pow_of_two-1) * sqrt(p+q)) ) - vf->amplitude_offset ) * .11512925f ); } /* fill vector */ do { vec[i]=q; ++i; }while(vf->map[i]==iter_cond); } } } else { /* this channel is unused */ return 1; } AV_DEBUG(" Floor0 decoded\n"); return 0; }
false
FFmpeg
536b48b2583d9616e574ca36308b1afb5802246f
static uint_fast8_t vorbis_floor0_decode(vorbis_context *vc, vorbis_floor_data *vfu, float *vec) { vorbis_floor0 * vf=&vfu->t0; float * lsp=vf->lsp; uint_fast32_t amplitude; uint_fast32_t book_idx; amplitude=get_bits(&vc->gb, vf->amplitude_bits); if (amplitude>0) { float last = 0; uint_fast16_t lsp_len = 0; uint_fast16_t idx; vorbis_codebook codebook; book_idx=get_bits(&vc->gb, ilog(vf->num_books)); if ( book_idx >= vf->num_books ) { av_log( vc->avccontext, AV_LOG_ERROR, "floor0 dec: booknumber too high!\n" ); } AV_DEBUG( "floor0 dec: booknumber: %u\n", book_idx ); codebook=vc->codebooks[vf->book_list[book_idx]]; while (lsp_len<vf->order) { int vec_off; AV_DEBUG( "floor0 dec: book dimension: %d\n", codebook.dimensions ); AV_DEBUG( "floor0 dec: maximum depth: %d\n", codebook.maxdepth ); vec_off=get_vlc2(&vc->gb, codebook.vlc.table, codebook.nb_bits, codebook.maxdepth ) * codebook.dimensions; AV_DEBUG( "floor0 dec: vector offset: %d\n", vec_off ); for (idx=0; idx<codebook.dimensions; ++idx) { lsp[lsp_len+idx]=codebook.codevectors[vec_off+idx]+last; } last=lsp[lsp_len+idx-1]; lsp_len += codebook.dimensions; } #ifdef V_DEBUG { int idx; for ( idx = 0; idx < lsp_len; ++idx ) AV_DEBUG("floor0 dec: coeff at %d is %f\n", idx, lsp[idx] ); } #endif { int i; int order=vf->order; float wstep=M_PI/vf->bark_map_size; for(i=0;i<order;i++) { lsp[i]=2.0f*cos(lsp[i]); } AV_DEBUG("floor0 synth: map_size=%d; m=%d; wstep=%f\n", vf->map_size, order, wstep); i=0; while(i<vf->map_size) { int j, iter_cond=vf->map[i]; float p=0.5f; float q=0.5f; float two_cos_w=2.0f*cos(wstep*iter_cond); for(j=0;j<order;j+=2) { q *= lsp[j] -two_cos_w; p *= lsp[j+1]-two_cos_w; } if(j==order) { p *= p*(2.0f-two_cos_w); q *= q*(2.0f+two_cos_w); } else { q *= two_cos_w-lsp[j]; p *= p*(4.f-two_cos_w*two_cos_w); q *= q; } { int_fast32_t pow_of_two=2, exponent=vf->amplitude_bits; if ( vf->amplitude_bits ) { while ( --exponent ) { pow_of_two <<= 1; } } else { pow_of_two=1; } q=exp( ( ( (amplitude*vf->amplitude_offset)/ ((pow_of_two-1) * sqrt(p+q)) ) - vf->amplitude_offset ) * .11512925f ); } do { vec[i]=q; ++i; }while(vf->map[i]==iter_cond); } } } else { return 1; } AV_DEBUG(" Floor0 decoded\n"); return 0; }
{ "code": [], "line_no": [] }
static uint_fast8_t FUNC_0(vorbis_context *vc, vorbis_floor_data *vfu, float *vec) { vorbis_floor0 * vf=&vfu->t0; float * VAR_0=vf->VAR_0; uint_fast32_t amplitude; uint_fast32_t book_idx; amplitude=get_bits(&vc->gb, vf->amplitude_bits); if (amplitude>0) { float VAR_1 = 0; uint_fast16_t lsp_len = 0; uint_fast16_t idx; vorbis_codebook codebook; book_idx=get_bits(&vc->gb, ilog(vf->num_books)); if ( book_idx >= vf->num_books ) { av_log( vc->avccontext, AV_LOG_ERROR, "floor0 dec: booknumber too high!\n" ); } AV_DEBUG( "floor0 dec: booknumber: %u\n", book_idx ); codebook=vc->codebooks[vf->book_list[book_idx]]; while (lsp_len<vf->VAR_4) { int VAR_2; AV_DEBUG( "floor0 dec: book dimension: %d\n", codebook.dimensions ); AV_DEBUG( "floor0 dec: maximum depth: %d\n", codebook.maxdepth ); VAR_2=get_vlc2(&vc->gb, codebook.vlc.table, codebook.nb_bits, codebook.maxdepth ) * codebook.dimensions; AV_DEBUG( "floor0 dec: vector offset: %d\n", VAR_2 ); for (idx=0; idx<codebook.dimensions; ++idx) { VAR_0[lsp_len+idx]=codebook.codevectors[VAR_2+idx]+VAR_1; } VAR_1=VAR_0[lsp_len+idx-1]; lsp_len += codebook.dimensions; } #ifdef V_DEBUG { int idx; for ( idx = 0; idx < lsp_len; ++idx ) AV_DEBUG("floor0 dec: coeff at %d is %f\n", idx, VAR_0[idx] ); } #endif { int VAR_3; int VAR_4=vf->VAR_4; float VAR_5=M_PI/vf->bark_map_size; for(VAR_3=0;VAR_3<VAR_4;VAR_3++) { VAR_0[VAR_3]=2.0f*cos(VAR_0[VAR_3]); } AV_DEBUG("floor0 synth: map_size=%d; m=%d; VAR_5=%f\n", vf->map_size, VAR_4, VAR_5); VAR_3=0; while(VAR_3<vf->map_size) { int VAR_6, VAR_7=vf->map[VAR_3]; float VAR_8=0.5f; float VAR_9=0.5f; float VAR_10=2.0f*cos(VAR_5*VAR_7); for(VAR_6=0;VAR_6<VAR_4;VAR_6+=2) { VAR_9 *= VAR_0[VAR_6] -VAR_10; VAR_8 *= VAR_0[VAR_6+1]-VAR_10; } if(VAR_6==VAR_4) { VAR_8 *= VAR_8*(2.0f-VAR_10); VAR_9 *= VAR_9*(2.0f+VAR_10); } else { VAR_9 *= VAR_10-VAR_0[VAR_6]; VAR_8 *= VAR_8*(4.f-VAR_10*VAR_10); VAR_9 *= VAR_9; } { int_fast32_t pow_of_two=2, exponent=vf->amplitude_bits; if ( vf->amplitude_bits ) { while ( --exponent ) { pow_of_two <<= 1; } } else { pow_of_two=1; } VAR_9=exp( ( ( (amplitude*vf->amplitude_offset)/ ((pow_of_two-1) * sqrt(VAR_8+VAR_9)) ) - vf->amplitude_offset ) * .11512925f ); } do { vec[VAR_3]=VAR_9; ++VAR_3; }while(vf->map[VAR_3]==VAR_7); } } } else { return 1; } AV_DEBUG(" Floor0 decoded\n"); return 0; }
[ "static uint_fast8_t FUNC_0(vorbis_context *vc,\nvorbis_floor_data *vfu, float *vec) {", "vorbis_floor0 * vf=&vfu->t0;", "float * VAR_0=vf->VAR_0;", "uint_fast32_t amplitude;", "uint_fast32_t book_idx;", "amplitude=get_bits(&vc->gb, vf->amplitude_bits);", "if (amplitude>0) {", "float VAR_1 = 0;", "uint_fast16_t lsp_len = 0;", "uint_fast16_t idx;", "vorbis_codebook codebook;", "book_idx=get_bits(&vc->gb, ilog(vf->num_books));", "if ( book_idx >= vf->num_books ) {", "av_log( vc->avccontext, AV_LOG_ERROR,\n\"floor0 dec: booknumber too high!\\n\" );", "}", "AV_DEBUG( \"floor0 dec: booknumber: %u\\n\", book_idx );", "codebook=vc->codebooks[vf->book_list[book_idx]];", "while (lsp_len<vf->VAR_4) {", "int VAR_2;", "AV_DEBUG( \"floor0 dec: book dimension: %d\\n\", codebook.dimensions );", "AV_DEBUG( \"floor0 dec: maximum depth: %d\\n\", codebook.maxdepth );", "VAR_2=get_vlc2(&vc->gb,\ncodebook.vlc.table,\ncodebook.nb_bits,\ncodebook.maxdepth ) *\ncodebook.dimensions;", "AV_DEBUG( \"floor0 dec: vector offset: %d\\n\", VAR_2 );", "for (idx=0; idx<codebook.dimensions; ++idx) {", "VAR_0[lsp_len+idx]=codebook.codevectors[VAR_2+idx]+VAR_1;", "}", "VAR_1=VAR_0[lsp_len+idx-1];", "lsp_len += codebook.dimensions;", "}", "#ifdef V_DEBUG\n{", "int idx;", "for ( idx = 0; idx < lsp_len; ++idx )", "AV_DEBUG(\"floor0 dec: coeff at %d is %f\\n\", idx, VAR_0[idx] );", "}", "#endif\n{", "int VAR_3;", "int VAR_4=vf->VAR_4;", "float VAR_5=M_PI/vf->bark_map_size;", "for(VAR_3=0;VAR_3<VAR_4;VAR_3++) { VAR_0[VAR_3]=2.0f*cos(VAR_0[VAR_3]); }", "AV_DEBUG(\"floor0 synth: map_size=%d; m=%d; VAR_5=%f\\n\",", "vf->map_size, VAR_4, VAR_5);", "VAR_3=0;", "while(VAR_3<vf->map_size) {", "int VAR_6, VAR_7=vf->map[VAR_3];", "float VAR_8=0.5f;", "float VAR_9=0.5f;", "float VAR_10=2.0f*cos(VAR_5*VAR_7);", "for(VAR_6=0;VAR_6<VAR_4;VAR_6+=2) {", "VAR_9 *= VAR_0[VAR_6] -VAR_10;", "VAR_8 *= VAR_0[VAR_6+1]-VAR_10;", "}", "if(VAR_6==VAR_4) {", "VAR_8 *= VAR_8*(2.0f-VAR_10);", "VAR_9 *= VAR_9*(2.0f+VAR_10);", "}", "else {", "VAR_9 *= VAR_10-VAR_0[VAR_6];", "VAR_8 *= VAR_8*(4.f-VAR_10*VAR_10);", "VAR_9 *= VAR_9;", "}", "{", "int_fast32_t pow_of_two=2, exponent=vf->amplitude_bits;", "if ( vf->amplitude_bits ) {", "while ( --exponent ) { pow_of_two <<= 1; }", "}", "else { pow_of_two=1; }", "VAR_9=exp( (\n( (amplitude*vf->amplitude_offset)/\n((pow_of_two-1) * sqrt(VAR_8+VAR_9)) )\n- vf->amplitude_offset ) * .11512925f\n);", "}", "do { vec[VAR_3]=VAR_9; ++VAR_3; }while(vf->map[VAR_3]==VAR_7);", "}", "}", "}", "else {", "return 1;", "}", "AV_DEBUG(\" Floor0 decoded\\n\");", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 59, 61, 63, 65, 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101, 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 167 ], [ 169 ], [ 171 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189, 191, 193, 195, 197 ], [ 199 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 217 ], [ 219 ], [ 223 ], [ 227 ], [ 229 ] ]
21,784
static void check_itxfm(void) { LOCAL_ALIGNED_32(uint8_t, src, [32 * 32 * 2]); LOCAL_ALIGNED_32(uint8_t, dst, [32 * 32 * 2]); LOCAL_ALIGNED_32(uint8_t, dst0, [32 * 32 * 2]); LOCAL_ALIGNED_32(uint8_t, dst1, [32 * 32 * 2]); LOCAL_ALIGNED_32(int16_t, coef, [32 * 32 * 2]); LOCAL_ALIGNED_32(int16_t, subcoef0, [32 * 32 * 2]); LOCAL_ALIGNED_32(int16_t, subcoef1, [32 * 32 * 2]); declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT, void, uint8_t *dst, ptrdiff_t stride, int16_t *block, int eob); VP9DSPContext dsp; int y, x, tx, txtp, bit_depth, sub; static const char *const txtp_types[N_TXFM_TYPES] = { [DCT_DCT] = "dct_dct", [DCT_ADST] = "adst_dct", [ADST_DCT] = "dct_adst", [ADST_ADST] = "adst_adst" }; for (bit_depth = 8; bit_depth <= 12; bit_depth += 2) { ff_vp9dsp_init(&dsp, bit_depth, 0); for (tx = TX_4X4; tx <= N_TXFM_SIZES /* 4 = lossless */; tx++) { int sz = 4 << (tx & 3); int n_txtps = tx < TX_32X32 ? N_TXFM_TYPES : 1; for (txtp = 0; txtp < n_txtps; txtp++) { if (check_func(dsp.itxfm_add[tx][txtp], "vp9_inv_%s_%dx%d_add_%d", tx == 4 ? "wht_wht" : txtp_types[txtp], sz, sz, bit_depth)) { randomize_buffers(); ftx(coef, tx, txtp, sz, bit_depth); for (sub = (txtp == 0) ? 1 : 2; sub <= sz; sub <<= 1) { int eob; if (sub < sz) { eob = copy_subcoefs(subcoef0, coef, tx, txtp, sz, sub, bit_depth); } else { eob = sz * sz; memcpy(subcoef0, coef, sz * sz * SIZEOF_COEF); } memcpy(dst0, dst, sz * sz * SIZEOF_PIXEL); memcpy(dst1, dst, sz * sz * SIZEOF_PIXEL); memcpy(subcoef1, subcoef0, sz * sz * SIZEOF_COEF); call_ref(dst0, sz * SIZEOF_PIXEL, subcoef0, eob); call_new(dst1, sz * SIZEOF_PIXEL, subcoef1, eob); if (memcmp(dst0, dst1, sz * sz * SIZEOF_PIXEL) || !iszero(subcoef0, sz * sz * SIZEOF_COEF) || !iszero(subcoef1, sz * sz * SIZEOF_COEF)) fail(); } bench_new(dst, sz * SIZEOF_PIXEL, coef, sz * sz); } } } } report("itxfm"); }
false
FFmpeg
1c8fbd7b90469f69fe3a3f78ba7886195d97c34f
static void check_itxfm(void) { LOCAL_ALIGNED_32(uint8_t, src, [32 * 32 * 2]); LOCAL_ALIGNED_32(uint8_t, dst, [32 * 32 * 2]); LOCAL_ALIGNED_32(uint8_t, dst0, [32 * 32 * 2]); LOCAL_ALIGNED_32(uint8_t, dst1, [32 * 32 * 2]); LOCAL_ALIGNED_32(int16_t, coef, [32 * 32 * 2]); LOCAL_ALIGNED_32(int16_t, subcoef0, [32 * 32 * 2]); LOCAL_ALIGNED_32(int16_t, subcoef1, [32 * 32 * 2]); declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT, void, uint8_t *dst, ptrdiff_t stride, int16_t *block, int eob); VP9DSPContext dsp; int y, x, tx, txtp, bit_depth, sub; static const char *const txtp_types[N_TXFM_TYPES] = { [DCT_DCT] = "dct_dct", [DCT_ADST] = "adst_dct", [ADST_DCT] = "dct_adst", [ADST_ADST] = "adst_adst" }; for (bit_depth = 8; bit_depth <= 12; bit_depth += 2) { ff_vp9dsp_init(&dsp, bit_depth, 0); for (tx = TX_4X4; tx <= N_TXFM_SIZES ; tx++) { int sz = 4 << (tx & 3); int n_txtps = tx < TX_32X32 ? N_TXFM_TYPES : 1; for (txtp = 0; txtp < n_txtps; txtp++) { if (check_func(dsp.itxfm_add[tx][txtp], "vp9_inv_%s_%dx%d_add_%d", tx == 4 ? "wht_wht" : txtp_types[txtp], sz, sz, bit_depth)) { randomize_buffers(); ftx(coef, tx, txtp, sz, bit_depth); for (sub = (txtp == 0) ? 1 : 2; sub <= sz; sub <<= 1) { int eob; if (sub < sz) { eob = copy_subcoefs(subcoef0, coef, tx, txtp, sz, sub, bit_depth); } else { eob = sz * sz; memcpy(subcoef0, coef, sz * sz * SIZEOF_COEF); } memcpy(dst0, dst, sz * sz * SIZEOF_PIXEL); memcpy(dst1, dst, sz * sz * SIZEOF_PIXEL); memcpy(subcoef1, subcoef0, sz * sz * SIZEOF_COEF); call_ref(dst0, sz * SIZEOF_PIXEL, subcoef0, eob); call_new(dst1, sz * SIZEOF_PIXEL, subcoef1, eob); if (memcmp(dst0, dst1, sz * sz * SIZEOF_PIXEL) || !iszero(subcoef0, sz * sz * SIZEOF_COEF) || !iszero(subcoef1, sz * sz * SIZEOF_COEF)) fail(); } bench_new(dst, sz * SIZEOF_PIXEL, coef, sz * sz); } } } } report("itxfm"); }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { LOCAL_ALIGNED_32(uint8_t, src, [32 * 32 * 2]); LOCAL_ALIGNED_32(uint8_t, dst, [32 * 32 * 2]); LOCAL_ALIGNED_32(uint8_t, dst0, [32 * 32 * 2]); LOCAL_ALIGNED_32(uint8_t, dst1, [32 * 32 * 2]); LOCAL_ALIGNED_32(int16_t, coef, [32 * 32 * 2]); LOCAL_ALIGNED_32(int16_t, subcoef0, [32 * 32 * 2]); LOCAL_ALIGNED_32(int16_t, subcoef1, [32 * 32 * 2]); declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT, void, uint8_t *dst, ptrdiff_t stride, int16_t *block, int eob); VP9DSPContext dsp; int VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5; static const char *const VAR_6[N_TXFM_TYPES] = { [DCT_DCT] = "dct_dct", [DCT_ADST] = "adst_dct", [ADST_DCT] = "dct_adst", [ADST_ADST] = "adst_adst" }; for (VAR_4 = 8; VAR_4 <= 12; VAR_4 += 2) { ff_vp9dsp_init(&dsp, VAR_4, 0); for (VAR_2 = TX_4X4; VAR_2 <= N_TXFM_SIZES ; VAR_2++) { int sz = 4 << (VAR_2 & 3); int n_txtps = VAR_2 < TX_32X32 ? N_TXFM_TYPES : 1; for (VAR_3 = 0; VAR_3 < n_txtps; VAR_3++) { if (check_func(dsp.itxfm_add[VAR_2][VAR_3], "vp9_inv_%s_%dx%d_add_%d", VAR_2 == 4 ? "wht_wht" : VAR_6[VAR_3], sz, sz, VAR_4)) { randomize_buffers(); ftx(coef, VAR_2, VAR_3, sz, VAR_4); for (VAR_5 = (VAR_3 == 0) ? 1 : 2; VAR_5 <= sz; VAR_5 <<= 1) { int eob; if (VAR_5 < sz) { eob = copy_subcoefs(subcoef0, coef, VAR_2, VAR_3, sz, VAR_5, VAR_4); } else { eob = sz * sz; memcpy(subcoef0, coef, sz * sz * SIZEOF_COEF); } memcpy(dst0, dst, sz * sz * SIZEOF_PIXEL); memcpy(dst1, dst, sz * sz * SIZEOF_PIXEL); memcpy(subcoef1, subcoef0, sz * sz * SIZEOF_COEF); call_ref(dst0, sz * SIZEOF_PIXEL, subcoef0, eob); call_new(dst1, sz * SIZEOF_PIXEL, subcoef1, eob); if (memcmp(dst0, dst1, sz * sz * SIZEOF_PIXEL) || !iszero(subcoef0, sz * sz * SIZEOF_COEF) || !iszero(subcoef1, sz * sz * SIZEOF_COEF)) fail(); } bench_new(dst, sz * SIZEOF_PIXEL, coef, sz * sz); } } } } report("itxfm"); }
[ "static void FUNC_0(void)\n{", "LOCAL_ALIGNED_32(uint8_t, src, [32 * 32 * 2]);", "LOCAL_ALIGNED_32(uint8_t, dst, [32 * 32 * 2]);", "LOCAL_ALIGNED_32(uint8_t, dst0, [32 * 32 * 2]);", "LOCAL_ALIGNED_32(uint8_t, dst1, [32 * 32 * 2]);", "LOCAL_ALIGNED_32(int16_t, coef, [32 * 32 * 2]);", "LOCAL_ALIGNED_32(int16_t, subcoef0, [32 * 32 * 2]);", "LOCAL_ALIGNED_32(int16_t, subcoef1, [32 * 32 * 2]);", "declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT, void, uint8_t *dst, ptrdiff_t stride, int16_t *block, int eob);", "VP9DSPContext dsp;", "int VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5;", "static const char *const VAR_6[N_TXFM_TYPES] = {", "[DCT_DCT] = \"dct_dct\", [DCT_ADST] = \"adst_dct\",\n[ADST_DCT] = \"dct_adst\", [ADST_ADST] = \"adst_adst\"\n};", "for (VAR_4 = 8; VAR_4 <= 12; VAR_4 += 2) {", "ff_vp9dsp_init(&dsp, VAR_4, 0);", "for (VAR_2 = TX_4X4; VAR_2 <= N_TXFM_SIZES ; VAR_2++) {", "int sz = 4 << (VAR_2 & 3);", "int n_txtps = VAR_2 < TX_32X32 ? N_TXFM_TYPES : 1;", "for (VAR_3 = 0; VAR_3 < n_txtps; VAR_3++) {", "if (check_func(dsp.itxfm_add[VAR_2][VAR_3], \"vp9_inv_%s_%dx%d_add_%d\",\nVAR_2 == 4 ? \"wht_wht\" : VAR_6[VAR_3], sz, sz,\nVAR_4)) {", "randomize_buffers();", "ftx(coef, VAR_2, VAR_3, sz, VAR_4);", "for (VAR_5 = (VAR_3 == 0) ? 1 : 2; VAR_5 <= sz; VAR_5 <<= 1) {", "int eob;", "if (VAR_5 < sz) {", "eob = copy_subcoefs(subcoef0, coef, VAR_2, VAR_3,\nsz, VAR_5, VAR_4);", "} else {", "eob = sz * sz;", "memcpy(subcoef0, coef, sz * sz * SIZEOF_COEF);", "}", "memcpy(dst0, dst, sz * sz * SIZEOF_PIXEL);", "memcpy(dst1, dst, sz * sz * SIZEOF_PIXEL);", "memcpy(subcoef1, subcoef0, sz * sz * SIZEOF_COEF);", "call_ref(dst0, sz * SIZEOF_PIXEL, subcoef0, eob);", "call_new(dst1, sz * SIZEOF_PIXEL, subcoef1, eob);", "if (memcmp(dst0, dst1, sz * sz * SIZEOF_PIXEL) ||\n!iszero(subcoef0, sz * sz * SIZEOF_COEF) ||\n!iszero(subcoef1, sz * sz * SIZEOF_COEF))\nfail();", "}", "bench_new(dst, sz * SIZEOF_PIXEL, coef, sz * sz);", "}", "}", "}", "}", "report(\"itxfm\");", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51, 53, 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95, 97, 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ] ]
21,785
void ff_put_h264_qpel4_mc32_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_midh_qrt_4w_msa(src - (2 * stride) - 2, stride, dst, stride, 4, 1); }
false
FFmpeg
e549933a270dd2cfc36f2cf9bb6b29acf3dc6d08
void ff_put_h264_qpel4_mc32_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_midh_qrt_4w_msa(src - (2 * stride) - 2, stride, dst, stride, 4, 1); }
{ "code": [], "line_no": [] }
void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1, ptrdiff_t VAR_2) { avc_luma_midh_qrt_4w_msa(VAR_1 - (2 * VAR_2) - 2, VAR_2, VAR_0, VAR_2, 4, 1); }
[ "void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1,\nptrdiff_t VAR_2)\n{", "avc_luma_midh_qrt_4w_msa(VAR_1 - (2 * VAR_2) - 2, VAR_2, VAR_0, VAR_2, 4, 1);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
21,786
static void put_ebml_utf8(ByteIOContext *pb, unsigned int elementid, char *str) { put_ebml_binary(pb, elementid, str, strlen(str)); }
false
FFmpeg
81efc03f5883cf17a1ad6acedfbb876163d7d06a
static void put_ebml_utf8(ByteIOContext *pb, unsigned int elementid, char *str) { put_ebml_binary(pb, elementid, str, strlen(str)); }
{ "code": [], "line_no": [] }
static void FUNC_0(ByteIOContext *VAR_0, unsigned int VAR_1, char *VAR_2) { put_ebml_binary(VAR_0, VAR_1, VAR_2, strlen(VAR_2)); }
[ "static void FUNC_0(ByteIOContext *VAR_0, unsigned int VAR_1, char *VAR_2)\n{", "put_ebml_binary(VAR_0, VAR_1, VAR_2, strlen(VAR_2));", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
21,787
static void compute_antialias_fixed(MPADecodeContext *s, GranuleDef *g) { int32_t *ptr, *csa; int n, i; /* we antialias only "long" bands */ if (g->block_type == 2) { if (!g->switch_point) return; /* XXX: check this for 8000Hz case */ n = 1; } else { n = SBLIMIT - 1; } ptr = g->sb_hybrid + 18; for(i = n;i > 0;i--) { int tmp0, tmp1, tmp2; csa = &csa_table[0][0]; #define INT_AA(j) \ tmp0 = ptr[-1-j];\ tmp1 = ptr[ j];\ tmp2= MULH(tmp0 + tmp1, csa[0+4*j]);\ ptr[-1-j] = 4*(tmp2 - MULH(tmp1, csa[2+4*j]));\ ptr[ j] = 4*(tmp2 + MULH(tmp0, csa[3+4*j])); INT_AA(0) INT_AA(1) INT_AA(2) INT_AA(3) INT_AA(4) INT_AA(5) INT_AA(6) INT_AA(7) ptr += 18; } }
false
FFmpeg
6f1ec38ce2193d3d4cacd87edb452c6d7ba751ec
static void compute_antialias_fixed(MPADecodeContext *s, GranuleDef *g) { int32_t *ptr, *csa; int n, i; if (g->block_type == 2) { if (!g->switch_point) return; n = 1; } else { n = SBLIMIT - 1; } ptr = g->sb_hybrid + 18; for(i = n;i > 0;i--) { int tmp0, tmp1, tmp2; csa = &csa_table[0][0]; #define INT_AA(j) \ tmp0 = ptr[-1-j];\ tmp1 = ptr[ j];\ tmp2= MULH(tmp0 + tmp1, csa[0+4*j]);\ ptr[-1-j] = 4*(tmp2 - MULH(tmp1, csa[2+4*j]));\ ptr[ j] = 4*(tmp2 + MULH(tmp0, csa[3+4*j])); INT_AA(0) INT_AA(1) INT_AA(2) INT_AA(3) INT_AA(4) INT_AA(5) INT_AA(6) INT_AA(7) ptr += 18; } }
{ "code": [], "line_no": [] }
static void FUNC_0(MPADecodeContext *VAR_0, GranuleDef *VAR_1) { int32_t *ptr, *csa; int VAR_2, VAR_3; if (VAR_1->block_type == 2) { if (!VAR_1->switch_point) return; VAR_2 = 1; } else { VAR_2 = SBLIMIT - 1; } ptr = VAR_1->sb_hybrid + 18; for(VAR_3 = VAR_2;VAR_3 > 0;VAR_3--) { int VAR_4, VAR_5, VAR_6; csa = &csa_table[0][0]; #define INT_AA(j) \ VAR_4 = ptr[-1-j];\ VAR_5 = ptr[ j];\ VAR_6= MULH(VAR_4 + VAR_5, csa[0+4*j]);\ ptr[-1-j] = 4*(VAR_6 - MULH(VAR_5, csa[2+4*j]));\ ptr[ j] = 4*(VAR_6 + MULH(VAR_4, csa[3+4*j])); INT_AA(0) INT_AA(1) INT_AA(2) INT_AA(3) INT_AA(4) INT_AA(5) INT_AA(6) INT_AA(7) ptr += 18; } }
[ "static void FUNC_0(MPADecodeContext *VAR_0, GranuleDef *VAR_1)\n{", "int32_t *ptr, *csa;", "int VAR_2, VAR_3;", "if (VAR_1->block_type == 2) {", "if (!VAR_1->switch_point)\nreturn;", "VAR_2 = 1;", "} else {", "VAR_2 = SBLIMIT - 1;", "}", "ptr = VAR_1->sb_hybrid + 18;", "for(VAR_3 = VAR_2;VAR_3 > 0;VAR_3--) {", "int VAR_4, VAR_5, VAR_6;", "csa = &csa_table[0][0];", "#define INT_AA(j) \\\nVAR_4 = ptr[-1-j];\\", "VAR_5 = ptr[ j];\\", "VAR_6= MULH(VAR_4 + VAR_5, csa[0+4*j]);\\", "ptr[-1-j] = 4*(VAR_6 - MULH(VAR_5, csa[2+4*j]));\\", "ptr[ j] = 4*(VAR_6 + MULH(VAR_4, csa[3+4*j]));", "INT_AA(0)\nINT_AA(1)\nINT_AA(2)\nINT_AA(3)\nINT_AA(4)\nINT_AA(5)\nINT_AA(6)\nINT_AA(7)\nptr += 18;", "}", "}" ]
[ 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 ], [ 13 ], [ 15, 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53, 55, 57, 59, 61, 63, 65, 67, 71 ], [ 73 ], [ 75 ] ]
21,788
av_cold struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(enum IIRFilterType filt_type, enum IIRFilterMode filt_mode, int order, float cutoff_ratio, float stopband, float ripple) { int i, j; FFIIRFilterCoeffs *c; double wa; double p[MAXORDER + 1][2]; if(filt_type != FF_FILTER_TYPE_BUTTERWORTH || filt_mode != FF_FILTER_MODE_LOWPASS) return NULL; if(order <= 1 || (order & 1) || order > MAXORDER || cutoff_ratio >= 1.0) return NULL; c = av_malloc(sizeof(FFIIRFilterCoeffs)); c->cx = av_malloc(sizeof(c->cx[0]) * ((order >> 1) + 1)); c->cy = av_malloc(sizeof(c->cy[0]) * order); c->order = order; wa = 2 * tan(M_PI * 0.5 * cutoff_ratio); c->cx[0] = 1; for(i = 1; i < (order >> 1) + 1; i++) c->cx[i] = c->cx[i - 1] * (order - i + 1LL) / i; p[0][0] = 1.0; p[0][1] = 0.0; for(i = 1; i <= order; i++) p[i][0] = p[i][1] = 0.0; for(i = 0; i < order; i++){ double zp[2]; double th = (i + (order >> 1) + 0.5) * M_PI / order; double a_re, a_im, c_re, c_im; zp[0] = cos(th) * wa; zp[1] = sin(th) * wa; a_re = zp[0] + 2.0; c_re = zp[0] - 2.0; a_im = c_im = zp[1]; zp[0] = (a_re * c_re + a_im * c_im) / (c_re * c_re + c_im * c_im); zp[1] = (a_im * c_re - a_re * c_im) / (c_re * c_re + c_im * c_im); for(j = order; j >= 1; j--) { a_re = p[j][0]; a_im = p[j][1]; p[j][0] = a_re*zp[0] - a_im*zp[1] + p[j-1][0]; p[j][1] = a_re*zp[1] + a_im*zp[0] + p[j-1][1]; } a_re = p[0][0]*zp[0] - p[0][1]*zp[1]; p[0][1] = p[0][0]*zp[1] + p[0][1]*zp[0]; p[0][0] = a_re; } c->gain = p[order][0]; for(i = 0; i < order; i++){ c->gain += p[i][0]; c->cy[i] = (-p[i][0] * p[order][0] + -p[i][1] * p[order][1]) / (p[order][0] * p[order][0] + p[order][1] * p[order][1]); } c->gain /= 1 << order; return c; }
true
FFmpeg
d42dc217ed2b0f886ffc50b26c2bbff1fee5feca
av_cold struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(enum IIRFilterType filt_type, enum IIRFilterMode filt_mode, int order, float cutoff_ratio, float stopband, float ripple) { int i, j; FFIIRFilterCoeffs *c; double wa; double p[MAXORDER + 1][2]; if(filt_type != FF_FILTER_TYPE_BUTTERWORTH || filt_mode != FF_FILTER_MODE_LOWPASS) return NULL; if(order <= 1 || (order & 1) || order > MAXORDER || cutoff_ratio >= 1.0) return NULL; c = av_malloc(sizeof(FFIIRFilterCoeffs)); c->cx = av_malloc(sizeof(c->cx[0]) * ((order >> 1) + 1)); c->cy = av_malloc(sizeof(c->cy[0]) * order); c->order = order; wa = 2 * tan(M_PI * 0.5 * cutoff_ratio); c->cx[0] = 1; for(i = 1; i < (order >> 1) + 1; i++) c->cx[i] = c->cx[i - 1] * (order - i + 1LL) / i; p[0][0] = 1.0; p[0][1] = 0.0; for(i = 1; i <= order; i++) p[i][0] = p[i][1] = 0.0; for(i = 0; i < order; i++){ double zp[2]; double th = (i + (order >> 1) + 0.5) * M_PI / order; double a_re, a_im, c_re, c_im; zp[0] = cos(th) * wa; zp[1] = sin(th) * wa; a_re = zp[0] + 2.0; c_re = zp[0] - 2.0; a_im = c_im = zp[1]; zp[0] = (a_re * c_re + a_im * c_im) / (c_re * c_re + c_im * c_im); zp[1] = (a_im * c_re - a_re * c_im) / (c_re * c_re + c_im * c_im); for(j = order; j >= 1; j--) { a_re = p[j][0]; a_im = p[j][1]; p[j][0] = a_re*zp[0] - a_im*zp[1] + p[j-1][0]; p[j][1] = a_re*zp[1] + a_im*zp[0] + p[j-1][1]; } a_re = p[0][0]*zp[0] - p[0][1]*zp[1]; p[0][1] = p[0][0]*zp[1] + p[0][1]*zp[0]; p[0][0] = a_re; } c->gain = p[order][0]; for(i = 0; i < order; i++){ c->gain += p[i][0]; c->cy[i] = (-p[i][0] * p[order][0] + -p[i][1] * p[order][1]) / (p[order][0] * p[order][0] + p[order][1] * p[order][1]); } c->gain /= 1 << order; return c; }
{ "code": [ "av_cold struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(enum IIRFilterType filt_type,", " c = av_malloc(sizeof(FFIIRFilterCoeffs));", " c->cx = av_malloc(sizeof(c->cx[0]) * ((order >> 1) + 1));", " c->cy = av_malloc(sizeof(c->cy[0]) * order);" ], "line_no": [ 1, 31, 33, 35 ] }
av_cold struct FFIIRFilterCoeffs* FUNC_0(enum IIRFilterType filt_type, enum IIRFilterMode filt_mode, int order, float cutoff_ratio, float stopband, float ripple) { int VAR_0, VAR_1; FFIIRFilterCoeffs *VAR_2; double VAR_3; double VAR_4[MAXORDER + 1][2]; if(filt_type != FF_FILTER_TYPE_BUTTERWORTH || filt_mode != FF_FILTER_MODE_LOWPASS) return NULL; if(order <= 1 || (order & 1) || order > MAXORDER || cutoff_ratio >= 1.0) return NULL; VAR_2 = av_malloc(sizeof(FFIIRFilterCoeffs)); VAR_2->cx = av_malloc(sizeof(VAR_2->cx[0]) * ((order >> 1) + 1)); VAR_2->cy = av_malloc(sizeof(VAR_2->cy[0]) * order); VAR_2->order = order; VAR_3 = 2 * tan(M_PI * 0.5 * cutoff_ratio); VAR_2->cx[0] = 1; for(VAR_0 = 1; VAR_0 < (order >> 1) + 1; VAR_0++) VAR_2->cx[VAR_0] = VAR_2->cx[VAR_0 - 1] * (order - VAR_0 + 1LL) / VAR_0; VAR_4[0][0] = 1.0; VAR_4[0][1] = 0.0; for(VAR_0 = 1; VAR_0 <= order; VAR_0++) VAR_4[VAR_0][0] = VAR_4[VAR_0][1] = 0.0; for(VAR_0 = 0; VAR_0 < order; VAR_0++){ double VAR_5[2]; double VAR_6 = (VAR_0 + (order >> 1) + 0.5) * M_PI / order; double VAR_7, VAR_8, VAR_9, VAR_10; VAR_5[0] = cos(VAR_6) * VAR_3; VAR_5[1] = sin(VAR_6) * VAR_3; VAR_7 = VAR_5[0] + 2.0; VAR_9 = VAR_5[0] - 2.0; VAR_8 = VAR_10 = VAR_5[1]; VAR_5[0] = (VAR_7 * VAR_9 + VAR_8 * VAR_10) / (VAR_9 * VAR_9 + VAR_10 * VAR_10); VAR_5[1] = (VAR_8 * VAR_9 - VAR_7 * VAR_10) / (VAR_9 * VAR_9 + VAR_10 * VAR_10); for(VAR_1 = order; VAR_1 >= 1; VAR_1--) { VAR_7 = VAR_4[VAR_1][0]; VAR_8 = VAR_4[VAR_1][1]; VAR_4[VAR_1][0] = VAR_7*VAR_5[0] - VAR_8*VAR_5[1] + VAR_4[VAR_1-1][0]; VAR_4[VAR_1][1] = VAR_7*VAR_5[1] + VAR_8*VAR_5[0] + VAR_4[VAR_1-1][1]; } VAR_7 = VAR_4[0][0]*VAR_5[0] - VAR_4[0][1]*VAR_5[1]; VAR_4[0][1] = VAR_4[0][0]*VAR_5[1] + VAR_4[0][1]*VAR_5[0]; VAR_4[0][0] = VAR_7; } VAR_2->gain = VAR_4[order][0]; for(VAR_0 = 0; VAR_0 < order; VAR_0++){ VAR_2->gain += VAR_4[VAR_0][0]; VAR_2->cy[VAR_0] = (-VAR_4[VAR_0][0] * VAR_4[order][0] + -VAR_4[VAR_0][1] * VAR_4[order][1]) / (VAR_4[order][0] * VAR_4[order][0] + VAR_4[order][1] * VAR_4[order][1]); } VAR_2->gain /= 1 << order; return VAR_2; }
[ "av_cold struct FFIIRFilterCoeffs* FUNC_0(enum IIRFilterType filt_type,\nenum IIRFilterMode filt_mode,\nint order, float cutoff_ratio,\nfloat stopband, float ripple)\n{", "int VAR_0, VAR_1;", "FFIIRFilterCoeffs *VAR_2;", "double VAR_3;", "double VAR_4[MAXORDER + 1][2];", "if(filt_type != FF_FILTER_TYPE_BUTTERWORTH || filt_mode != FF_FILTER_MODE_LOWPASS)\nreturn NULL;", "if(order <= 1 || (order & 1) || order > MAXORDER || cutoff_ratio >= 1.0)\nreturn NULL;", "VAR_2 = av_malloc(sizeof(FFIIRFilterCoeffs));", "VAR_2->cx = av_malloc(sizeof(VAR_2->cx[0]) * ((order >> 1) + 1));", "VAR_2->cy = av_malloc(sizeof(VAR_2->cy[0]) * order);", "VAR_2->order = order;", "VAR_3 = 2 * tan(M_PI * 0.5 * cutoff_ratio);", "VAR_2->cx[0] = 1;", "for(VAR_0 = 1; VAR_0 < (order >> 1) + 1; VAR_0++)", "VAR_2->cx[VAR_0] = VAR_2->cx[VAR_0 - 1] * (order - VAR_0 + 1LL) / VAR_0;", "VAR_4[0][0] = 1.0;", "VAR_4[0][1] = 0.0;", "for(VAR_0 = 1; VAR_0 <= order; VAR_0++)", "VAR_4[VAR_0][0] = VAR_4[VAR_0][1] = 0.0;", "for(VAR_0 = 0; VAR_0 < order; VAR_0++){", "double VAR_5[2];", "double VAR_6 = (VAR_0 + (order >> 1) + 0.5) * M_PI / order;", "double VAR_7, VAR_8, VAR_9, VAR_10;", "VAR_5[0] = cos(VAR_6) * VAR_3;", "VAR_5[1] = sin(VAR_6) * VAR_3;", "VAR_7 = VAR_5[0] + 2.0;", "VAR_9 = VAR_5[0] - 2.0;", "VAR_8 =\nVAR_10 = VAR_5[1];", "VAR_5[0] = (VAR_7 * VAR_9 + VAR_8 * VAR_10) / (VAR_9 * VAR_9 + VAR_10 * VAR_10);", "VAR_5[1] = (VAR_8 * VAR_9 - VAR_7 * VAR_10) / (VAR_9 * VAR_9 + VAR_10 * VAR_10);", "for(VAR_1 = order; VAR_1 >= 1; VAR_1--)", "{", "VAR_7 = VAR_4[VAR_1][0];", "VAR_8 = VAR_4[VAR_1][1];", "VAR_4[VAR_1][0] = VAR_7*VAR_5[0] - VAR_8*VAR_5[1] + VAR_4[VAR_1-1][0];", "VAR_4[VAR_1][1] = VAR_7*VAR_5[1] + VAR_8*VAR_5[0] + VAR_4[VAR_1-1][1];", "}", "VAR_7 = VAR_4[0][0]*VAR_5[0] - VAR_4[0][1]*VAR_5[1];", "VAR_4[0][1] = VAR_4[0][0]*VAR_5[1] + VAR_4[0][1]*VAR_5[0];", "VAR_4[0][0] = VAR_7;", "}", "VAR_2->gain = VAR_4[order][0];", "for(VAR_0 = 0; VAR_0 < order; VAR_0++){", "VAR_2->gain += VAR_4[VAR_0][0];", "VAR_2->cy[VAR_0] = (-VAR_4[VAR_0][0] * VAR_4[order][0] + -VAR_4[VAR_0][1] * VAR_4[order][1]) /\n(VAR_4[order][0] * VAR_4[order][0] + VAR_4[order][1] * VAR_4[order][1]);", "}", "VAR_2->gain /= 1 << order;", "return VAR_2;", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 1, 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 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 25, 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ] ]
21,789
static inline uint64_t ram_chunk_index(const uint8_t *start, const uint8_t *host) { return ((uintptr_t) host - (uintptr_t) start) >> RDMA_REG_CHUNK_SHIFT; }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
static inline uint64_t ram_chunk_index(const uint8_t *start, const uint8_t *host) { return ((uintptr_t) host - (uintptr_t) start) >> RDMA_REG_CHUNK_SHIFT; }
{ "code": [], "line_no": [] }
static inline uint64_t FUNC_0(const uint8_t *start, const uint8_t *host) { return ((uintptr_t) host - (uintptr_t) start) >> RDMA_REG_CHUNK_SHIFT; }
[ "static inline uint64_t FUNC_0(const uint8_t *start,\nconst uint8_t *host)\n{", "return ((uintptr_t) host - (uintptr_t) start) >> RDMA_REG_CHUNK_SHIFT;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
21,790
static void av_estimate_timings_from_bit_rate(AVFormatContext *ic) { int64_t filesize, duration; int bit_rate, i; AVStream *st; /* if bit_rate is already set, we believe it */ if (ic->bit_rate == 0) { bit_rate = 0; for(i=0;i<ic->nb_streams;i++) { st = ic->streams[i]; bit_rate += st->codec->bit_rate; } ic->bit_rate = bit_rate; } /* if duration is already set, we believe it */ if (ic->duration == AV_NOPTS_VALUE && ic->bit_rate != 0 && ic->file_size != 0) { filesize = ic->file_size; if (filesize > 0) { for(i = 0; i < ic->nb_streams; i++) { st = ic->streams[i]; duration= av_rescale(8*filesize, st->time_base.den, ic->bit_rate*(int64_t)st->time_base.num); if (st->duration == AV_NOPTS_VALUE) st->duration = duration; } } } }
true
FFmpeg
9100d4d6327b077c44e5fdbc8082255f11953978
static void av_estimate_timings_from_bit_rate(AVFormatContext *ic) { int64_t filesize, duration; int bit_rate, i; AVStream *st; if (ic->bit_rate == 0) { bit_rate = 0; for(i=0;i<ic->nb_streams;i++) { st = ic->streams[i]; bit_rate += st->codec->bit_rate; } ic->bit_rate = bit_rate; } if (ic->duration == AV_NOPTS_VALUE && ic->bit_rate != 0 && ic->file_size != 0) { filesize = ic->file_size; if (filesize > 0) { for(i = 0; i < ic->nb_streams; i++) { st = ic->streams[i]; duration= av_rescale(8*filesize, st->time_base.den, ic->bit_rate*(int64_t)st->time_base.num); if (st->duration == AV_NOPTS_VALUE) st->duration = duration; } } } }
{ "code": [ " if (ic->bit_rate == 0) {" ], "line_no": [ 15 ] }
static void FUNC_0(AVFormatContext *VAR_0) { int64_t filesize, duration; int VAR_1, VAR_2; AVStream *st; if (VAR_0->VAR_1 == 0) { VAR_1 = 0; for(VAR_2=0;VAR_2<VAR_0->nb_streams;VAR_2++) { st = VAR_0->streams[VAR_2]; VAR_1 += st->codec->VAR_1; } VAR_0->VAR_1 = VAR_1; } if (VAR_0->duration == AV_NOPTS_VALUE && VAR_0->VAR_1 != 0 && VAR_0->file_size != 0) { filesize = VAR_0->file_size; if (filesize > 0) { for(VAR_2 = 0; VAR_2 < VAR_0->nb_streams; VAR_2++) { st = VAR_0->streams[VAR_2]; duration= av_rescale(8*filesize, st->time_base.den, VAR_0->VAR_1*(int64_t)st->time_base.num); if (st->duration == AV_NOPTS_VALUE) st->duration = duration; } } } }
[ "static void FUNC_0(AVFormatContext *VAR_0)\n{", "int64_t filesize, duration;", "int VAR_1, VAR_2;", "AVStream *st;", "if (VAR_0->VAR_1 == 0) {", "VAR_1 = 0;", "for(VAR_2=0;VAR_2<VAR_0->nb_streams;VAR_2++) {", "st = VAR_0->streams[VAR_2];", "VAR_1 += st->codec->VAR_1;", "}", "VAR_0->VAR_1 = VAR_1;", "}", "if (VAR_0->duration == AV_NOPTS_VALUE &&\nVAR_0->VAR_1 != 0 &&\nVAR_0->file_size != 0) {", "filesize = VAR_0->file_size;", "if (filesize > 0) {", "for(VAR_2 = 0; VAR_2 < VAR_0->nb_streams; VAR_2++) {", "st = VAR_0->streams[VAR_2];", "duration= av_rescale(8*filesize, st->time_base.den, VAR_0->VAR_1*(int64_t)st->time_base.num);", "if (st->duration == AV_NOPTS_VALUE)\nst->duration = duration;", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 35, 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ] ]
21,791
static void sr_1d97_int(int32_t *p, int i0, int i1) { int i; if (i1 <= i0 + 1) { if (i0 == 1) p[1] = (p[1] * I_LFTG_K + (1<<16)) >> 17; else p[0] = (p[0] * I_LFTG_X + (1<<15)) >> 16; return; } extend97_int(p, i0, i1); for (i = (i0 >> 1) - 1; i < (i1 >> 1) + 2; i++) p[2 * i] -= (I_LFTG_DELTA * (p[2 * i - 1] + p[2 * i + 1]) + (1 << 15)) >> 16; /* step 4 */ for (i = (i0 >> 1) - 1; i < (i1 >> 1) + 1; i++) p[2 * i + 1] -= (I_LFTG_GAMMA * (p[2 * i] + p[2 * i + 2]) + (1 << 15)) >> 16; /*step 5*/ for (i = (i0 >> 1); i < (i1 >> 1) + 1; i++) p[2 * i] += (I_LFTG_BETA * (p[2 * i - 1] + p[2 * i + 1]) + (1 << 15)) >> 16; /* step 6 */ for (i = (i0 >> 1); i < (i1 >> 1); i++) p[2 * i + 1] += (I_LFTG_ALPHA * (p[2 * i] + p[2 * i + 2]) + (1 << 15)) >> 16; }
true
FFmpeg
3c70251780647d49e09522bbe22758c841e37a9a
static void sr_1d97_int(int32_t *p, int i0, int i1) { int i; if (i1 <= i0 + 1) { if (i0 == 1) p[1] = (p[1] * I_LFTG_K + (1<<16)) >> 17; else p[0] = (p[0] * I_LFTG_X + (1<<15)) >> 16; return; } extend97_int(p, i0, i1); for (i = (i0 >> 1) - 1; i < (i1 >> 1) + 2; i++) p[2 * i] -= (I_LFTG_DELTA * (p[2 * i - 1] + p[2 * i + 1]) + (1 << 15)) >> 16; for (i = (i0 >> 1) - 1; i < (i1 >> 1) + 1; i++) p[2 * i + 1] -= (I_LFTG_GAMMA * (p[2 * i] + p[2 * i + 2]) + (1 << 15)) >> 16; for (i = (i0 >> 1); i < (i1 >> 1) + 1; i++) p[2 * i] += (I_LFTG_BETA * (p[2 * i - 1] + p[2 * i + 1]) + (1 << 15)) >> 16; for (i = (i0 >> 1); i < (i1 >> 1); i++) p[2 * i + 1] += (I_LFTG_ALPHA * (p[2 * i] + p[2 * i + 2]) + (1 << 15)) >> 16; }
{ "code": [ " p[2 * i] -= (I_LFTG_DELTA * (p[2 * i - 1] + p[2 * i + 1]) + (1 << 15)) >> 16;", " p[2 * i + 1] -= (I_LFTG_GAMMA * (p[2 * i] + p[2 * i + 2]) + (1 << 15)) >> 16;", " p[2 * i] += (I_LFTG_BETA * (p[2 * i - 1] + p[2 * i + 1]) + (1 << 15)) >> 16;", " p[2 * i + 1] += (I_LFTG_ALPHA * (p[2 * i] + p[2 * i + 2]) + (1 << 15)) >> 16;" ], "line_no": [ 31, 37, 43, 49 ] }
static void FUNC_0(int32_t *VAR_0, int VAR_1, int VAR_2) { int VAR_3; if (VAR_2 <= VAR_1 + 1) { if (VAR_1 == 1) VAR_0[1] = (VAR_0[1] * I_LFTG_K + (1<<16)) >> 17; else VAR_0[0] = (VAR_0[0] * I_LFTG_X + (1<<15)) >> 16; return; } extend97_int(VAR_0, VAR_1, VAR_2); for (VAR_3 = (VAR_1 >> 1) - 1; VAR_3 < (VAR_2 >> 1) + 2; VAR_3++) VAR_0[2 * VAR_3] -= (I_LFTG_DELTA * (VAR_0[2 * VAR_3 - 1] + VAR_0[2 * VAR_3 + 1]) + (1 << 15)) >> 16; for (VAR_3 = (VAR_1 >> 1) - 1; VAR_3 < (VAR_2 >> 1) + 1; VAR_3++) VAR_0[2 * VAR_3 + 1] -= (I_LFTG_GAMMA * (VAR_0[2 * VAR_3] + VAR_0[2 * VAR_3 + 2]) + (1 << 15)) >> 16; for (VAR_3 = (VAR_1 >> 1); VAR_3 < (VAR_2 >> 1) + 1; VAR_3++) VAR_0[2 * VAR_3] += (I_LFTG_BETA * (VAR_0[2 * VAR_3 - 1] + VAR_0[2 * VAR_3 + 1]) + (1 << 15)) >> 16; for (VAR_3 = (VAR_1 >> 1); VAR_3 < (VAR_2 >> 1); VAR_3++) VAR_0[2 * VAR_3 + 1] += (I_LFTG_ALPHA * (VAR_0[2 * VAR_3] + VAR_0[2 * VAR_3 + 2]) + (1 << 15)) >> 16; }
[ "static void FUNC_0(int32_t *VAR_0, int VAR_1, int VAR_2)\n{", "int VAR_3;", "if (VAR_2 <= VAR_1 + 1) {", "if (VAR_1 == 1)\nVAR_0[1] = (VAR_0[1] * I_LFTG_K + (1<<16)) >> 17;", "else\nVAR_0[0] = (VAR_0[0] * I_LFTG_X + (1<<15)) >> 16;", "return;", "}", "extend97_int(VAR_0, VAR_1, VAR_2);", "for (VAR_3 = (VAR_1 >> 1) - 1; VAR_3 < (VAR_2 >> 1) + 2; VAR_3++)", "VAR_0[2 * VAR_3] -= (I_LFTG_DELTA * (VAR_0[2 * VAR_3 - 1] + VAR_0[2 * VAR_3 + 1]) + (1 << 15)) >> 16;", "for (VAR_3 = (VAR_1 >> 1) - 1; VAR_3 < (VAR_2 >> 1) + 1; VAR_3++)", "VAR_0[2 * VAR_3 + 1] -= (I_LFTG_GAMMA * (VAR_0[2 * VAR_3] + VAR_0[2 * VAR_3 + 2]) + (1 << 15)) >> 16;", "for (VAR_3 = (VAR_1 >> 1); VAR_3 < (VAR_2 >> 1) + 1; VAR_3++)", "VAR_0[2 * VAR_3] += (I_LFTG_BETA * (VAR_0[2 * VAR_3 - 1] + VAR_0[2 * VAR_3 + 1]) + (1 << 15)) >> 16;", "for (VAR_3 = (VAR_1 >> 1); VAR_3 < (VAR_2 >> 1); VAR_3++)", "VAR_0[2 * VAR_3 + 1] += (I_LFTG_ALPHA * (VAR_0[2 * VAR_3] + VAR_0[2 * VAR_3 + 2]) + (1 << 15)) >> 16;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 25 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ] ]
21,792
static void arm_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) { DisasContext *dc = container_of(dcbase, DisasContext, base); dc->insn_start_idx = tcg_op_buf_count(); tcg_gen_insn_start(dc->pc, (dc->condexec_cond << 4) | (dc->condexec_mask >> 1), 0); }
true
qemu
15fa08f8451babc88d733bd411d4c94976f9d0f8
static void arm_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) { DisasContext *dc = container_of(dcbase, DisasContext, base); dc->insn_start_idx = tcg_op_buf_count(); tcg_gen_insn_start(dc->pc, (dc->condexec_cond << 4) | (dc->condexec_mask >> 1), 0); }
{ "code": [ " dc->insn_start_idx = tcg_op_buf_count();", " dc->insn_start_idx = tcg_op_buf_count();" ], "line_no": [ 9, 9 ] }
static void FUNC_0(DisasContextBase *VAR_0, CPUState *VAR_1) { DisasContext *dc = container_of(VAR_0, DisasContext, base); dc->insn_start_idx = tcg_op_buf_count(); tcg_gen_insn_start(dc->pc, (dc->condexec_cond << 4) | (dc->condexec_mask >> 1), 0); }
[ "static void FUNC_0(DisasContextBase *VAR_0, CPUState *VAR_1)\n{", "DisasContext *dc = container_of(VAR_0, DisasContext, base);", "dc->insn_start_idx = tcg_op_buf_count();", "tcg_gen_insn_start(dc->pc,\n(dc->condexec_cond << 4) | (dc->condexec_mask >> 1),\n0);", "}" ]
[ 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13, 15 ], [ 17 ] ]
21,793
static void fft(AC3MDCTContext *mdct, IComplex *z, int ln) { int j, l, np, np2; int nblocks, nloops; register IComplex *p,*q; int tmp_re, tmp_im; np = 1 << ln; /* reverse */ for (j = 0; j < np; j++) { int k = av_reverse[j] >> (8 - ln); if (k < j) FFSWAP(IComplex, z[k], z[j]); } /* pass 0 */ p = &z[0]; j = np >> 1; do { BF(p[0].re, p[0].im, p[1].re, p[1].im, p[0].re, p[0].im, p[1].re, p[1].im); p += 2; } while (--j); /* pass 1 */ p = &z[0]; j = np >> 2; do { BF(p[0].re, p[0].im, p[2].re, p[2].im, p[0].re, p[0].im, p[2].re, p[2].im); BF(p[1].re, p[1].im, p[3].re, p[3].im, p[1].re, p[1].im, p[3].im, -p[3].re); p+=4; } while (--j); /* pass 2 .. ln-1 */ nblocks = np >> 3; nloops = 1 << 2; np2 = np >> 1; do { p = z; q = z + nloops; for (j = 0; j < nblocks; j++) { BF(p->re, p->im, q->re, q->im, p->re, p->im, q->re, q->im); p++; q++; for(l = nblocks; l < np2; l += nblocks) { CMUL(tmp_re, tmp_im, mdct->costab[l], -mdct->sintab[l], q->re, q->im); BF(p->re, p->im, q->re, q->im, p->re, p->im, tmp_re, tmp_im); p++; q++; } p += nloops; q += nloops; } nblocks = nblocks >> 1; nloops = nloops << 1; } while (nblocks); }
true
FFmpeg
323e6fead07c75f418e4b60704a4f437bb3483b2
static void fft(AC3MDCTContext *mdct, IComplex *z, int ln) { int j, l, np, np2; int nblocks, nloops; register IComplex *p,*q; int tmp_re, tmp_im; np = 1 << ln; for (j = 0; j < np; j++) { int k = av_reverse[j] >> (8 - ln); if (k < j) FFSWAP(IComplex, z[k], z[j]); } p = &z[0]; j = np >> 1; do { BF(p[0].re, p[0].im, p[1].re, p[1].im, p[0].re, p[0].im, p[1].re, p[1].im); p += 2; } while (--j); p = &z[0]; j = np >> 2; do { BF(p[0].re, p[0].im, p[2].re, p[2].im, p[0].re, p[0].im, p[2].re, p[2].im); BF(p[1].re, p[1].im, p[3].re, p[3].im, p[1].re, p[1].im, p[3].im, -p[3].re); p+=4; } while (--j); nblocks = np >> 3; nloops = 1 << 2; np2 = np >> 1; do { p = z; q = z + nloops; for (j = 0; j < nblocks; j++) { BF(p->re, p->im, q->re, q->im, p->re, p->im, q->re, q->im); p++; q++; for(l = nblocks; l < np2; l += nblocks) { CMUL(tmp_re, tmp_im, mdct->costab[l], -mdct->sintab[l], q->re, q->im); BF(p->re, p->im, q->re, q->im, p->re, p->im, tmp_re, tmp_im); p++; q++; } p += nloops; q += nloops; } nblocks = nblocks >> 1; nloops = nloops << 1; } while (nblocks); }
{ "code": [ " CMUL(tmp_re, tmp_im, mdct->costab[l], -mdct->sintab[l], q->re, q->im);" ], "line_no": [ 105 ] }
static void FUNC_0(AC3MDCTContext *VAR_0, IComplex *VAR_1, int VAR_2) { int VAR_3, VAR_4, VAR_5, VAR_6; int VAR_7, VAR_8; register IComplex *VAR_9,*q; int VAR_10, VAR_11; VAR_5 = 1 << VAR_2; for (VAR_3 = 0; VAR_3 < VAR_5; VAR_3++) { int VAR_12 = av_reverse[VAR_3] >> (8 - VAR_2); if (VAR_12 < VAR_3) FFSWAP(IComplex, VAR_1[VAR_12], VAR_1[VAR_3]); } VAR_9 = &VAR_1[0]; VAR_3 = VAR_5 >> 1; do { BF(VAR_9[0].re, VAR_9[0].im, VAR_9[1].re, VAR_9[1].im, VAR_9[0].re, VAR_9[0].im, VAR_9[1].re, VAR_9[1].im); VAR_9 += 2; } while (--VAR_3); VAR_9 = &VAR_1[0]; VAR_3 = VAR_5 >> 2; do { BF(VAR_9[0].re, VAR_9[0].im, VAR_9[2].re, VAR_9[2].im, VAR_9[0].re, VAR_9[0].im, VAR_9[2].re, VAR_9[2].im); BF(VAR_9[1].re, VAR_9[1].im, VAR_9[3].re, VAR_9[3].im, VAR_9[1].re, VAR_9[1].im, VAR_9[3].im, -VAR_9[3].re); VAR_9+=4; } while (--VAR_3); VAR_7 = VAR_5 >> 3; VAR_8 = 1 << 2; VAR_6 = VAR_5 >> 1; do { VAR_9 = VAR_1; q = VAR_1 + VAR_8; for (VAR_3 = 0; VAR_3 < VAR_7; VAR_3++) { BF(VAR_9->re, VAR_9->im, q->re, q->im, VAR_9->re, VAR_9->im, q->re, q->im); VAR_9++; q++; for(VAR_4 = VAR_7; VAR_4 < VAR_6; VAR_4 += VAR_7) { CMUL(VAR_10, VAR_11, VAR_0->costab[VAR_4], -VAR_0->sintab[VAR_4], q->re, q->im); BF(VAR_9->re, VAR_9->im, q->re, q->im, VAR_9->re, VAR_9->im, VAR_10, VAR_11); VAR_9++; q++; } VAR_9 += VAR_8; q += VAR_8; } VAR_7 = VAR_7 >> 1; VAR_8 = VAR_8 << 1; } while (VAR_7); }
[ "static void FUNC_0(AC3MDCTContext *VAR_0, IComplex *VAR_1, int VAR_2)\n{", "int VAR_3, VAR_4, VAR_5, VAR_6;", "int VAR_7, VAR_8;", "register IComplex *VAR_9,*q;", "int VAR_10, VAR_11;", "VAR_5 = 1 << VAR_2;", "for (VAR_3 = 0; VAR_3 < VAR_5; VAR_3++) {", "int VAR_12 = av_reverse[VAR_3] >> (8 - VAR_2);", "if (VAR_12 < VAR_3)\nFFSWAP(IComplex, VAR_1[VAR_12], VAR_1[VAR_3]);", "}", "VAR_9 = &VAR_1[0];", "VAR_3 = VAR_5 >> 1;", "do {", "BF(VAR_9[0].re, VAR_9[0].im, VAR_9[1].re, VAR_9[1].im,\nVAR_9[0].re, VAR_9[0].im, VAR_9[1].re, VAR_9[1].im);", "VAR_9 += 2;", "} while (--VAR_3);", "VAR_9 = &VAR_1[0];", "VAR_3 = VAR_5 >> 2;", "do {", "BF(VAR_9[0].re, VAR_9[0].im, VAR_9[2].re, VAR_9[2].im,\nVAR_9[0].re, VAR_9[0].im, VAR_9[2].re, VAR_9[2].im);", "BF(VAR_9[1].re, VAR_9[1].im, VAR_9[3].re, VAR_9[3].im,\nVAR_9[1].re, VAR_9[1].im, VAR_9[3].im, -VAR_9[3].re);", "VAR_9+=4;", "} while (--VAR_3);", "VAR_7 = VAR_5 >> 3;", "VAR_8 = 1 << 2;", "VAR_6 = VAR_5 >> 1;", "do {", "VAR_9 = VAR_1;", "q = VAR_1 + VAR_8;", "for (VAR_3 = 0; VAR_3 < VAR_7; VAR_3++) {", "BF(VAR_9->re, VAR_9->im, q->re, q->im,\nVAR_9->re, VAR_9->im, q->re, q->im);", "VAR_9++;", "q++;", "for(VAR_4 = VAR_7; VAR_4 < VAR_6; VAR_4 += VAR_7) {", "CMUL(VAR_10, VAR_11, VAR_0->costab[VAR_4], -VAR_0->sintab[VAR_4], q->re, q->im);", "BF(VAR_9->re, VAR_9->im, q->re, q->im,\nVAR_9->re, VAR_9->im, VAR_10, VAR_11);", "VAR_9++;", "q++;", "}", "VAR_9 += VAR_8;", "q += VAR_8;", "}", "VAR_7 = VAR_7 >> 1;", "VAR_8 = VAR_8 << 1;", "} while (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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 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 ] ]
21,795
static int mjpeg_decode_init(AVCodecContext *avctx) { MJpegDecodeContext *s = avctx->priv_data; MpegEncContext s2; s->avctx = avctx; /* ugly way to get the idct & scantable FIXME */ memset(&s2, 0, sizeof(MpegEncContext)); s2.avctx= avctx; // s2->out_format = FMT_MJPEG; dsputil_init(&s2.dsp, avctx); DCT_common_init(&s2); s->scantable= s2.intra_scantable; s->idct_put= s2.dsp.idct_put; s->mpeg_enc_ctx_allocated = 0; s->buffer_size = 102400; /* smaller buffer should be enough, but photojpg files could ahive bigger sizes */ s->buffer = av_malloc(s->buffer_size); if (!s->buffer) return -1; s->start_code = -1; s->first_picture = 1; s->org_height = avctx->coded_height; build_vlc(&s->vlcs[0][0], bits_dc_luminance, val_dc_luminance, 12); build_vlc(&s->vlcs[0][1], bits_dc_chrominance, val_dc_chrominance, 12); build_vlc(&s->vlcs[1][0], bits_ac_luminance, val_ac_luminance, 251); build_vlc(&s->vlcs[1][1], bits_ac_chrominance, val_ac_chrominance, 251); if (avctx->flags & CODEC_FLAG_EXTERN_HUFF) { av_log(avctx, AV_LOG_INFO, "mjpeg: using external huffman table\n"); init_get_bits(&s->gb, avctx->extradata, avctx->extradata_size*8); mjpeg_decode_dht(s); /* should check for error - but dunno */ } return 0; }
true
FFmpeg
073c2593c9f0aa4445a6fc1b9b24e6e52a8cc2c1
static int mjpeg_decode_init(AVCodecContext *avctx) { MJpegDecodeContext *s = avctx->priv_data; MpegEncContext s2; s->avctx = avctx; memset(&s2, 0, sizeof(MpegEncContext)); s2.avctx= avctx; dsputil_init(&s2.dsp, avctx); DCT_common_init(&s2); s->scantable= s2.intra_scantable; s->idct_put= s2.dsp.idct_put; s->mpeg_enc_ctx_allocated = 0; s->buffer_size = 102400; s->buffer = av_malloc(s->buffer_size); if (!s->buffer) return -1; s->start_code = -1; s->first_picture = 1; s->org_height = avctx->coded_height; build_vlc(&s->vlcs[0][0], bits_dc_luminance, val_dc_luminance, 12); build_vlc(&s->vlcs[0][1], bits_dc_chrominance, val_dc_chrominance, 12); build_vlc(&s->vlcs[1][0], bits_ac_luminance, val_ac_luminance, 251); build_vlc(&s->vlcs[1][1], bits_ac_chrominance, val_ac_chrominance, 251); if (avctx->flags & CODEC_FLAG_EXTERN_HUFF) { av_log(avctx, AV_LOG_INFO, "mjpeg: using external huffman table\n"); init_get_bits(&s->gb, avctx->extradata, avctx->extradata_size*8); mjpeg_decode_dht(s); } return 0; }
{ "code": [ " build_vlc(&s->vlcs[0][0], bits_dc_luminance, val_dc_luminance, 12);", " build_vlc(&s->vlcs[0][1], bits_dc_chrominance, val_dc_chrominance, 12);", " build_vlc(&s->vlcs[1][0], bits_ac_luminance, val_ac_luminance, 251);", " build_vlc(&s->vlcs[1][1], bits_ac_chrominance, val_ac_chrominance, 251);" ], "line_no": [ 55, 57, 59, 61 ] }
static int FUNC_0(AVCodecContext *VAR_0) { MJpegDecodeContext *s = VAR_0->priv_data; MpegEncContext s2; s->VAR_0 = VAR_0; memset(&s2, 0, sizeof(MpegEncContext)); s2.VAR_0= VAR_0; dsputil_init(&s2.dsp, VAR_0); DCT_common_init(&s2); s->scantable= s2.intra_scantable; s->idct_put= s2.dsp.idct_put; s->mpeg_enc_ctx_allocated = 0; s->buffer_size = 102400; s->buffer = av_malloc(s->buffer_size); if (!s->buffer) return -1; s->start_code = -1; s->first_picture = 1; s->org_height = VAR_0->coded_height; build_vlc(&s->vlcs[0][0], bits_dc_luminance, val_dc_luminance, 12); build_vlc(&s->vlcs[0][1], bits_dc_chrominance, val_dc_chrominance, 12); build_vlc(&s->vlcs[1][0], bits_ac_luminance, val_ac_luminance, 251); build_vlc(&s->vlcs[1][1], bits_ac_chrominance, val_ac_chrominance, 251); if (VAR_0->flags & CODEC_FLAG_EXTERN_HUFF) { av_log(VAR_0, AV_LOG_INFO, "mjpeg: using external huffman table\n"); init_get_bits(&s->gb, VAR_0->extradata, VAR_0->extradata_size*8); mjpeg_decode_dht(s); } return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0)\n{", "MJpegDecodeContext *s = VAR_0->priv_data;", "MpegEncContext s2;", "s->VAR_0 = VAR_0;", "memset(&s2, 0, sizeof(MpegEncContext));", "s2.VAR_0= VAR_0;", "dsputil_init(&s2.dsp, VAR_0);", "DCT_common_init(&s2);", "s->scantable= s2.intra_scantable;", "s->idct_put= s2.dsp.idct_put;", "s->mpeg_enc_ctx_allocated = 0;", "s->buffer_size = 102400;", "s->buffer = av_malloc(s->buffer_size);", "if (!s->buffer)\nreturn -1;", "s->start_code = -1;", "s->first_picture = 1;", "s->org_height = VAR_0->coded_height;", "build_vlc(&s->vlcs[0][0], bits_dc_luminance, val_dc_luminance, 12);", "build_vlc(&s->vlcs[0][1], bits_dc_chrominance, val_dc_chrominance, 12);", "build_vlc(&s->vlcs[1][0], bits_ac_luminance, val_ac_luminance, 251);", "build_vlc(&s->vlcs[1][1], bits_ac_chrominance, val_ac_chrominance, 251);", "if (VAR_0->flags & CODEC_FLAG_EXTERN_HUFF)\n{", "av_log(VAR_0, AV_LOG_INFO, \"mjpeg: using external huffman table\\n\");", "init_get_bits(&s->gb, VAR_0->extradata, VAR_0->extradata_size*8);", "mjpeg_decode_dht(s);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 81 ], [ 83 ] ]
21,797
int ff_thread_ref_frame(ThreadFrame *dst, ThreadFrame *src) { int ret; dst->owner = src->owner; ret = av_frame_ref(dst->f, src->f); if (ret < 0) return ret; av_assert0(!dst->progress); if (src->progress && !(dst->progress = av_buffer_ref(src->progress))) { ff_thread_release_buffer(dst->owner, dst); return AVERROR(ENOMEM); } return 0; }
true
FFmpeg
083300bea935d125b83f60d7030f78a7ffb0f3df
int ff_thread_ref_frame(ThreadFrame *dst, ThreadFrame *src) { int ret; dst->owner = src->owner; ret = av_frame_ref(dst->f, src->f); if (ret < 0) return ret; av_assert0(!dst->progress); if (src->progress && !(dst->progress = av_buffer_ref(src->progress))) { ff_thread_release_buffer(dst->owner, dst); return AVERROR(ENOMEM); } return 0; }
{ "code": [ " dst->owner = src->owner;", " ff_thread_release_buffer(dst->owner, dst);" ], "line_no": [ 9, 29 ] }
int FUNC_0(ThreadFrame *VAR_0, ThreadFrame *VAR_1) { int VAR_2; VAR_0->owner = VAR_1->owner; VAR_2 = av_frame_ref(VAR_0->f, VAR_1->f); if (VAR_2 < 0) return VAR_2; av_assert0(!VAR_0->progress); if (VAR_1->progress && !(VAR_0->progress = av_buffer_ref(VAR_1->progress))) { ff_thread_release_buffer(VAR_0->owner, VAR_0); return AVERROR(ENOMEM); } return 0; }
[ "int FUNC_0(ThreadFrame *VAR_0, ThreadFrame *VAR_1)\n{", "int VAR_2;", "VAR_0->owner = VAR_1->owner;", "VAR_2 = av_frame_ref(VAR_0->f, VAR_1->f);", "if (VAR_2 < 0)\nreturn VAR_2;", "av_assert0(!VAR_0->progress);", "if (VAR_1->progress &&\n!(VAR_0->progress = av_buffer_ref(VAR_1->progress))) {", "ff_thread_release_buffer(VAR_0->owner, VAR_0);", "return AVERROR(ENOMEM);", "}", "return 0;", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 21 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ] ]
21,798
void zipl_load(void) { ScsiMbr *mbr = (void *)sec; LDL_VTOC *vlbl = (void *)sec; /* Grab the MBR */ memset(sec, FREE_SPACE_FILLER, sizeof(sec)); read_block(0, mbr, "Cannot read block 0"); dputs("checking magic\n"); if (magic_match(mbr->magic, ZIPL_MAGIC)) { ipl_scsi(); /* no return */ } /* Check if we can boot as ISO media */ if (virtio_guessed_disk_nature()) { virtio_assume_iso9660(); } ipl_iso_el_torito(); /* We have failed to follow the SCSI scheme, so */ if (virtio_guessed_disk_nature()) { sclp_print("Using guessed DASD geometry.\n"); virtio_assume_eckd(); } print_eckd_msg(); if (magic_match(mbr->magic, IPL1_MAGIC)) { ipl_eckd_cdl(); /* no return */ } /* LDL/CMS? */ memset(sec, FREE_SPACE_FILLER, sizeof(sec)); read_block(2, vlbl, "Cannot read block 2"); if (magic_match(vlbl->magic, CMS1_MAGIC)) { ipl_eckd_ldl(ECKD_CMS); /* no return */ } if (magic_match(vlbl->magic, LNX1_MAGIC)) { ipl_eckd_ldl(ECKD_LDL); /* no return */ } ipl_eckd_ldl(ECKD_LDL_UNLABELED); /* it still may return */ /* * Ok, it is not a LDL by any means. * It still might be a CDL with zero record keys for IPL1 and IPL2 */ ipl_eckd_cdl(); virtio_panic("\n* this can never happen *\n"); }
true
qemu
c9262e8a84a29f22fbb5edde5d17f4f6166d5ae1
void zipl_load(void) { ScsiMbr *mbr = (void *)sec; LDL_VTOC *vlbl = (void *)sec; memset(sec, FREE_SPACE_FILLER, sizeof(sec)); read_block(0, mbr, "Cannot read block 0"); dputs("checking magic\n"); if (magic_match(mbr->magic, ZIPL_MAGIC)) { ipl_scsi(); } if (virtio_guessed_disk_nature()) { virtio_assume_iso9660(); } ipl_iso_el_torito(); if (virtio_guessed_disk_nature()) { sclp_print("Using guessed DASD geometry.\n"); virtio_assume_eckd(); } print_eckd_msg(); if (magic_match(mbr->magic, IPL1_MAGIC)) { ipl_eckd_cdl(); } memset(sec, FREE_SPACE_FILLER, sizeof(sec)); read_block(2, vlbl, "Cannot read block 2"); if (magic_match(vlbl->magic, CMS1_MAGIC)) { ipl_eckd_ldl(ECKD_CMS); } if (magic_match(vlbl->magic, LNX1_MAGIC)) { ipl_eckd_ldl(ECKD_LDL); } ipl_eckd_ldl(ECKD_LDL_UNLABELED); ipl_eckd_cdl(); virtio_panic("\n* this can never happen *\n"); }
{ "code": [ " virtio_panic(\"\\n* this can never happen *\\n\");" ], "line_no": [ 99 ] }
void FUNC_0(void) { ScsiMbr *mbr = (void *)sec; LDL_VTOC *vlbl = (void *)sec; memset(sec, FREE_SPACE_FILLER, sizeof(sec)); read_block(0, mbr, "Cannot read block 0"); dputs("checking magic\n"); if (magic_match(mbr->magic, ZIPL_MAGIC)) { ipl_scsi(); } if (virtio_guessed_disk_nature()) { virtio_assume_iso9660(); } ipl_iso_el_torito(); if (virtio_guessed_disk_nature()) { sclp_print("Using guessed DASD geometry.\n"); virtio_assume_eckd(); } print_eckd_msg(); if (magic_match(mbr->magic, IPL1_MAGIC)) { ipl_eckd_cdl(); } memset(sec, FREE_SPACE_FILLER, sizeof(sec)); read_block(2, vlbl, "Cannot read block 2"); if (magic_match(vlbl->magic, CMS1_MAGIC)) { ipl_eckd_ldl(ECKD_CMS); } if (magic_match(vlbl->magic, LNX1_MAGIC)) { ipl_eckd_ldl(ECKD_LDL); } ipl_eckd_ldl(ECKD_LDL_UNLABELED); ipl_eckd_cdl(); virtio_panic("\n* this can never happen *\n"); }
[ "void FUNC_0(void)\n{", "ScsiMbr *mbr = (void *)sec;", "LDL_VTOC *vlbl = (void *)sec;", "memset(sec, FREE_SPACE_FILLER, sizeof(sec));", "read_block(0, mbr, \"Cannot read block 0\");", "dputs(\"checking magic\\n\");", "if (magic_match(mbr->magic, ZIPL_MAGIC)) {", "ipl_scsi();", "}", "if (virtio_guessed_disk_nature()) {", "virtio_assume_iso9660();", "}", "ipl_iso_el_torito();", "if (virtio_guessed_disk_nature()) {", "sclp_print(\"Using guessed DASD geometry.\\n\");", "virtio_assume_eckd();", "}", "print_eckd_msg();", "if (magic_match(mbr->magic, IPL1_MAGIC)) {", "ipl_eckd_cdl();", "}", "memset(sec, FREE_SPACE_FILLER, sizeof(sec));", "read_block(2, vlbl, \"Cannot read block 2\");", "if (magic_match(vlbl->magic, CMS1_MAGIC)) {", "ipl_eckd_ldl(ECKD_CMS);", "}", "if (magic_match(vlbl->magic, LNX1_MAGIC)) {", "ipl_eckd_ldl(ECKD_LDL);", "}", "ipl_eckd_ldl(ECKD_LDL_UNLABELED);", "ipl_eckd_cdl();", "virtio_panic(\"\\n* this can never happen *\\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, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 95 ], [ 99 ], [ 101 ] ]
21,799
void ppc_set_irq(PowerPCCPU *cpu, int n_IRQ, int level) { CPUState *cs = CPU(cpu); CPUPPCState *env = &cpu->env; unsigned int old_pending = env->pending_interrupts; if (level) { env->pending_interrupts |= 1 << n_IRQ; cpu_interrupt(cs, CPU_INTERRUPT_HARD); } else { env->pending_interrupts &= ~(1 << n_IRQ); if (env->pending_interrupts == 0) { cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); } } if (old_pending != env->pending_interrupts) { #ifdef CONFIG_KVM kvmppc_set_interrupt(cpu, n_IRQ, level); #endif } LOG_IRQ("%s: %p n_IRQ %d level %d => pending %08" PRIx32 "req %08x\n", __func__, env, n_IRQ, level, env->pending_interrupts, CPU(cpu)->interrupt_request); }
true
qemu
8d04fb55dec381bc5105cb47f29d918e579e8cbd
void ppc_set_irq(PowerPCCPU *cpu, int n_IRQ, int level) { CPUState *cs = CPU(cpu); CPUPPCState *env = &cpu->env; unsigned int old_pending = env->pending_interrupts; if (level) { env->pending_interrupts |= 1 << n_IRQ; cpu_interrupt(cs, CPU_INTERRUPT_HARD); } else { env->pending_interrupts &= ~(1 << n_IRQ); if (env->pending_interrupts == 0) { cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); } } if (old_pending != env->pending_interrupts) { #ifdef CONFIG_KVM kvmppc_set_interrupt(cpu, n_IRQ, level); #endif } LOG_IRQ("%s: %p n_IRQ %d level %d => pending %08" PRIx32 "req %08x\n", __func__, env, n_IRQ, level, env->pending_interrupts, CPU(cpu)->interrupt_request); }
{ "code": [ " } else {", " unsigned int old_pending = env->pending_interrupts;" ], "line_no": [ 19, 9 ] }
void FUNC_0(PowerPCCPU *VAR_0, int VAR_1, int VAR_2) { CPUState *cs = CPU(VAR_0); CPUPPCState *env = &VAR_0->env; unsigned int VAR_3 = env->pending_interrupts; if (VAR_2) { env->pending_interrupts |= 1 << VAR_1; cpu_interrupt(cs, CPU_INTERRUPT_HARD); } else { env->pending_interrupts &= ~(1 << VAR_1); if (env->pending_interrupts == 0) { cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); } } if (VAR_3 != env->pending_interrupts) { #ifdef CONFIG_KVM kvmppc_set_interrupt(VAR_0, VAR_1, VAR_2); #endif } LOG_IRQ("%s: %p VAR_1 %d VAR_2 %d => pending %08" PRIx32 "req %08x\n", __func__, env, VAR_1, VAR_2, env->pending_interrupts, CPU(VAR_0)->interrupt_request); }
[ "void FUNC_0(PowerPCCPU *VAR_0, int VAR_1, int VAR_2)\n{", "CPUState *cs = CPU(VAR_0);", "CPUPPCState *env = &VAR_0->env;", "unsigned int VAR_3 = env->pending_interrupts;", "if (VAR_2) {", "env->pending_interrupts |= 1 << VAR_1;", "cpu_interrupt(cs, CPU_INTERRUPT_HARD);", "} else {", "env->pending_interrupts &= ~(1 << VAR_1);", "if (env->pending_interrupts == 0) {", "cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);", "}", "}", "if (VAR_3 != env->pending_interrupts) {", "#ifdef CONFIG_KVM\nkvmppc_set_interrupt(VAR_0, VAR_1, VAR_2);", "#endif\n}", "LOG_IRQ(\"%s: %p VAR_1 %d VAR_2 %d => pending %08\" PRIx32\n\"req %08x\\n\", __func__, env, VAR_1, VAR_2,\nenv->pending_interrupts, CPU(VAR_0)->interrupt_request);", "}" ]
[ 0, 0, 0, 1, 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 ], [ 45, 47, 49 ], [ 51 ] ]
21,800
static void vfio_vga_probe_ati_3c3_quirk(VFIOPCIDevice *vdev) { VFIOQuirk *quirk; /* * As long as the BAR is >= 256 bytes it will be aligned such that the * lower byte is always zero. Filter out anything else, if it exists. */ if (!vfio_pci_is(vdev, PCI_VENDOR_ID_ATI, PCI_ANY_ID) || !vdev->bars[4].ioport || vdev->bars[4].region.size < 256) { return; } quirk = g_malloc0(sizeof(*quirk)); quirk->mem = g_malloc0(sizeof(MemoryRegion)); quirk->nr_mem = 1; memory_region_init_io(quirk->mem, OBJECT(vdev), &vfio_ati_3c3_quirk, vdev, "vfio-ati-3c3-quirk", 1); memory_region_add_subregion(&vdev->vga.region[QEMU_PCI_VGA_IO_HI].mem, 3 /* offset 3 bytes from 0x3c0 */, quirk->mem); QLIST_INSERT_HEAD(&vdev->vga.region[QEMU_PCI_VGA_IO_HI].quirks, quirk, next); trace_vfio_quirk_ati_3c3_probe(vdev->vbasedev.name); }
true
qemu
bdd81addf4033ce26e6cd180b060f63095f3ded9
static void vfio_vga_probe_ati_3c3_quirk(VFIOPCIDevice *vdev) { VFIOQuirk *quirk; if (!vfio_pci_is(vdev, PCI_VENDOR_ID_ATI, PCI_ANY_ID) || !vdev->bars[4].ioport || vdev->bars[4].region.size < 256) { return; } quirk = g_malloc0(sizeof(*quirk)); quirk->mem = g_malloc0(sizeof(MemoryRegion)); quirk->nr_mem = 1; memory_region_init_io(quirk->mem, OBJECT(vdev), &vfio_ati_3c3_quirk, vdev, "vfio-ati-3c3-quirk", 1); memory_region_add_subregion(&vdev->vga.region[QEMU_PCI_VGA_IO_HI].mem, 3 , quirk->mem); QLIST_INSERT_HEAD(&vdev->vga.region[QEMU_PCI_VGA_IO_HI].quirks, quirk, next); trace_vfio_quirk_ati_3c3_probe(vdev->vbasedev.name); }
{ "code": [ " quirk->mem = g_malloc0(sizeof(MemoryRegion));" ], "line_no": [ 29 ] }
static void FUNC_0(VFIOPCIDevice *VAR_0) { VFIOQuirk *quirk; if (!vfio_pci_is(VAR_0, PCI_VENDOR_ID_ATI, PCI_ANY_ID) || !VAR_0->bars[4].ioport || VAR_0->bars[4].region.size < 256) { return; } quirk = g_malloc0(sizeof(*quirk)); quirk->mem = g_malloc0(sizeof(MemoryRegion)); quirk->nr_mem = 1; memory_region_init_io(quirk->mem, OBJECT(VAR_0), &vfio_ati_3c3_quirk, VAR_0, "vfio-ati-3c3-quirk", 1); memory_region_add_subregion(&VAR_0->vga.region[QEMU_PCI_VGA_IO_HI].mem, 3 , quirk->mem); QLIST_INSERT_HEAD(&VAR_0->vga.region[QEMU_PCI_VGA_IO_HI].quirks, quirk, next); trace_vfio_quirk_ati_3c3_probe(VAR_0->vbasedev.name); }
[ "static void FUNC_0(VFIOPCIDevice *VAR_0)\n{", "VFIOQuirk *quirk;", "if (!vfio_pci_is(VAR_0, PCI_VENDOR_ID_ATI, PCI_ANY_ID) ||\n!VAR_0->bars[4].ioport || VAR_0->bars[4].region.size < 256) {", "return;", "}", "quirk = g_malloc0(sizeof(*quirk));", "quirk->mem = g_malloc0(sizeof(MemoryRegion));", "quirk->nr_mem = 1;", "memory_region_init_io(quirk->mem, OBJECT(VAR_0), &vfio_ati_3c3_quirk, VAR_0,\n\"vfio-ati-3c3-quirk\", 1);", "memory_region_add_subregion(&VAR_0->vga.region[QEMU_PCI_VGA_IO_HI].mem,\n3 , quirk->mem);", "QLIST_INSERT_HEAD(&VAR_0->vga.region[QEMU_PCI_VGA_IO_HI].quirks,\nquirk, next);", "trace_vfio_quirk_ati_3c3_probe(VAR_0->vbasedev.name);", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 35, 37 ], [ 39, 41 ], [ 45, 47 ], [ 51 ], [ 53 ] ]
21,801
static void mem_info(Monitor *mon) { CPUState *env; int l1, l2, prot, last_prot; uint32_t pgd, pde, pte, start, end; env = mon_get_cpu(); if (!env) return; if (!(env->cr[0] & CR0_PG_MASK)) { monitor_printf(mon, "PG disabled\n"); return; } pgd = env->cr[3] & ~0xfff; last_prot = 0; start = -1; for(l1 = 0; l1 < 1024; l1++) { cpu_physical_memory_read(pgd + l1 * 4, (uint8_t *)&pde, 4); pde = le32_to_cpu(pde); end = l1 << 22; if (pde & PG_PRESENT_MASK) { if ((pde & PG_PSE_MASK) && (env->cr[4] & CR4_PSE_MASK)) { prot = pde & (PG_USER_MASK | PG_RW_MASK | PG_PRESENT_MASK); mem_print(mon, &start, &last_prot, end, prot); } else { for(l2 = 0; l2 < 1024; l2++) { cpu_physical_memory_read((pde & ~0xfff) + l2 * 4, (uint8_t *)&pte, 4); pte = le32_to_cpu(pte); end = (l1 << 22) + (l2 << 12); if (pte & PG_PRESENT_MASK) { prot = pte & (PG_USER_MASK | PG_RW_MASK | PG_PRESENT_MASK); } else { prot = 0; } mem_print(mon, &start, &last_prot, end, prot); } } } else { prot = 0; mem_print(mon, &start, &last_prot, end, prot); } } }
true
qemu
09b9418c6d085a0728372aa760ebd10128a020b1
static void mem_info(Monitor *mon) { CPUState *env; int l1, l2, prot, last_prot; uint32_t pgd, pde, pte, start, end; env = mon_get_cpu(); if (!env) return; if (!(env->cr[0] & CR0_PG_MASK)) { monitor_printf(mon, "PG disabled\n"); return; } pgd = env->cr[3] & ~0xfff; last_prot = 0; start = -1; for(l1 = 0; l1 < 1024; l1++) { cpu_physical_memory_read(pgd + l1 * 4, (uint8_t *)&pde, 4); pde = le32_to_cpu(pde); end = l1 << 22; if (pde & PG_PRESENT_MASK) { if ((pde & PG_PSE_MASK) && (env->cr[4] & CR4_PSE_MASK)) { prot = pde & (PG_USER_MASK | PG_RW_MASK | PG_PRESENT_MASK); mem_print(mon, &start, &last_prot, end, prot); } else { for(l2 = 0; l2 < 1024; l2++) { cpu_physical_memory_read((pde & ~0xfff) + l2 * 4, (uint8_t *)&pte, 4); pte = le32_to_cpu(pte); end = (l1 << 22) + (l2 << 12); if (pte & PG_PRESENT_MASK) { prot = pte & (PG_USER_MASK | PG_RW_MASK | PG_PRESENT_MASK); } else { prot = 0; } mem_print(mon, &start, &last_prot, end, prot); } } } else { prot = 0; mem_print(mon, &start, &last_prot, end, prot); } } }
{ "code": [ " if (!env)", " if (!env)", " if (!env)", " if (!env)", " if (!env)", " if (!env)", " if (!env)", " if (!env)", " if (!env)", " if (!env)", " if (!env)", " if (!env)", " if (!env)" ], "line_no": [ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15 ] }
static void FUNC_0(Monitor *VAR_0) { CPUState *env; int VAR_1, VAR_2, VAR_3, VAR_4; uint32_t pgd, pde, pte, start, end; env = mon_get_cpu(); if (!env) return; if (!(env->cr[0] & CR0_PG_MASK)) { monitor_printf(VAR_0, "PG disabled\n"); return; } pgd = env->cr[3] & ~0xfff; VAR_4 = 0; start = -1; for(VAR_1 = 0; VAR_1 < 1024; VAR_1++) { cpu_physical_memory_read(pgd + VAR_1 * 4, (uint8_t *)&pde, 4); pde = le32_to_cpu(pde); end = VAR_1 << 22; if (pde & PG_PRESENT_MASK) { if ((pde & PG_PSE_MASK) && (env->cr[4] & CR4_PSE_MASK)) { VAR_3 = pde & (PG_USER_MASK | PG_RW_MASK | PG_PRESENT_MASK); mem_print(VAR_0, &start, &VAR_4, end, VAR_3); } else { for(VAR_2 = 0; VAR_2 < 1024; VAR_2++) { cpu_physical_memory_read((pde & ~0xfff) + VAR_2 * 4, (uint8_t *)&pte, 4); pte = le32_to_cpu(pte); end = (VAR_1 << 22) + (VAR_2 << 12); if (pte & PG_PRESENT_MASK) { VAR_3 = pte & (PG_USER_MASK | PG_RW_MASK | PG_PRESENT_MASK); } else { VAR_3 = 0; } mem_print(VAR_0, &start, &VAR_4, end, VAR_3); } } } else { VAR_3 = 0; mem_print(VAR_0, &start, &VAR_4, end, VAR_3); } } }
[ "static void FUNC_0(Monitor *VAR_0)\n{", "CPUState *env;", "int VAR_1, VAR_2, VAR_3, VAR_4;", "uint32_t pgd, pde, pte, start, end;", "env = mon_get_cpu();", "if (!env)\nreturn;", "if (!(env->cr[0] & CR0_PG_MASK)) {", "monitor_printf(VAR_0, \"PG disabled\\n\");", "return;", "}", "pgd = env->cr[3] & ~0xfff;", "VAR_4 = 0;", "start = -1;", "for(VAR_1 = 0; VAR_1 < 1024; VAR_1++) {", "cpu_physical_memory_read(pgd + VAR_1 * 4, (uint8_t *)&pde, 4);", "pde = le32_to_cpu(pde);", "end = VAR_1 << 22;", "if (pde & PG_PRESENT_MASK) {", "if ((pde & PG_PSE_MASK) && (env->cr[4] & CR4_PSE_MASK)) {", "VAR_3 = pde & (PG_USER_MASK | PG_RW_MASK | PG_PRESENT_MASK);", "mem_print(VAR_0, &start, &VAR_4, end, VAR_3);", "} else {", "for(VAR_2 = 0; VAR_2 < 1024; VAR_2++) {", "cpu_physical_memory_read((pde & ~0xfff) + VAR_2 * 4,\n(uint8_t *)&pte, 4);", "pte = le32_to_cpu(pte);", "end = (VAR_1 << 22) + (VAR_2 << 12);", "if (pte & PG_PRESENT_MASK) {", "VAR_3 = pte & (PG_USER_MASK | PG_RW_MASK | PG_PRESENT_MASK);", "} else {", "VAR_3 = 0;", "}", "mem_print(VAR_0, &start, &VAR_4, end, VAR_3);", "}", "}", "} else {", "VAR_3 = 0;", "mem_print(VAR_0, &start, &VAR_4, end, VAR_3);", "}", "}", "}" ]
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 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 ] ]
21,802
CharDriverState *chr_testdev_init(void) { TestdevCharState *testdev; CharDriverState *chr; testdev = g_malloc0(sizeof(TestdevCharState)); testdev->chr = chr = g_malloc0(sizeof(CharDriverState)); chr->opaque = testdev; chr->chr_write = testdev_write; chr->chr_close = testdev_close; return chr; }
true
qemu
2d528d45ecf5ee3c1a566a9f3d664464925ef830
CharDriverState *chr_testdev_init(void) { TestdevCharState *testdev; CharDriverState *chr; testdev = g_malloc0(sizeof(TestdevCharState)); testdev->chr = chr = g_malloc0(sizeof(CharDriverState)); chr->opaque = testdev; chr->chr_write = testdev_write; chr->chr_close = testdev_close; return chr; }
{ "code": [ " testdev = g_malloc0(sizeof(TestdevCharState));", " testdev->chr = chr = g_malloc0(sizeof(CharDriverState));" ], "line_no": [ 11, 13 ] }
CharDriverState *FUNC_0(void) { TestdevCharState *testdev; CharDriverState *chr; testdev = g_malloc0(sizeof(TestdevCharState)); testdev->chr = chr = g_malloc0(sizeof(CharDriverState)); chr->opaque = testdev; chr->chr_write = testdev_write; chr->chr_close = testdev_close; return chr; }
[ "CharDriverState *FUNC_0(void)\n{", "TestdevCharState *testdev;", "CharDriverState *chr;", "testdev = g_malloc0(sizeof(TestdevCharState));", "testdev->chr = chr = g_malloc0(sizeof(CharDriverState));", "chr->opaque = testdev;", "chr->chr_write = testdev_write;", "chr->chr_close = testdev_close;", "return chr;", "}" ]
[ 0, 0, 0, 1, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ] ]
21,803
static int coroutine_fn bdrv_co_do_writev(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *qiov) { BlockDriver *drv = bs->drv; BdrvTrackedRequest req; int ret; if (!bs->drv) { return -ENOMEDIUM; if (bs->read_only) { return -EACCES; if (bdrv_check_request(bs, sector_num, nb_sectors)) { return -EIO; /* throttling disk write I/O */ if (bs->io_limits_enabled) { bdrv_io_limits_intercept(bs, true, nb_sectors); tracked_request_begin(&req, bs, sector_num, nb_sectors, true); ret = drv->bdrv_co_writev(bs, sector_num, nb_sectors, qiov); if (bs->dirty_bitmap) { set_dirty_bitmap(bs, sector_num, nb_sectors, 1); if (bs->wr_highest_sector < sector_num + nb_sectors - 1) { bs->wr_highest_sector = sector_num + nb_sectors - 1; tracked_request_end(&req); return ret;
true
qemu
f4658285f99473367dbbc34ce6970ec4637c2388
static int coroutine_fn bdrv_co_do_writev(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *qiov) { BlockDriver *drv = bs->drv; BdrvTrackedRequest req; int ret; if (!bs->drv) { return -ENOMEDIUM; if (bs->read_only) { return -EACCES; if (bdrv_check_request(bs, sector_num, nb_sectors)) { return -EIO; if (bs->io_limits_enabled) { bdrv_io_limits_intercept(bs, true, nb_sectors); tracked_request_begin(&req, bs, sector_num, nb_sectors, true); ret = drv->bdrv_co_writev(bs, sector_num, nb_sectors, qiov); if (bs->dirty_bitmap) { set_dirty_bitmap(bs, sector_num, nb_sectors, 1); if (bs->wr_highest_sector < sector_num + nb_sectors - 1) { bs->wr_highest_sector = sector_num + nb_sectors - 1; tracked_request_end(&req); return ret;
{ "code": [], "line_no": [] }
static int VAR_0 bdrv_co_do_writev(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *qiov) { BlockDriver *drv = bs->drv; BdrvTrackedRequest req; int ret; if (!bs->drv) { return -ENOMEDIUM; if (bs->read_only) { return -EACCES; if (bdrv_check_request(bs, sector_num, nb_sectors)) { return -EIO; if (bs->io_limits_enabled) { bdrv_io_limits_intercept(bs, true, nb_sectors); tracked_request_begin(&req, bs, sector_num, nb_sectors, true); ret = drv->bdrv_co_writev(bs, sector_num, nb_sectors, qiov); if (bs->dirty_bitmap) { set_dirty_bitmap(bs, sector_num, nb_sectors, 1); if (bs->wr_highest_sector < sector_num + nb_sectors - 1) { bs->wr_highest_sector = sector_num + nb_sectors - 1; tracked_request_end(&req); return ret;
[ "static int VAR_0 bdrv_co_do_writev(BlockDriverState *bs,\nint64_t sector_num, int nb_sectors, QEMUIOVector *qiov)\n{", "BlockDriver *drv = bs->drv;", "BdrvTrackedRequest req;", "int ret;", "if (!bs->drv) {", "return -ENOMEDIUM;", "if (bs->read_only) {", "return -EACCES;", "if (bdrv_check_request(bs, sector_num, nb_sectors)) {", "return -EIO;", "if (bs->io_limits_enabled) {", "bdrv_io_limits_intercept(bs, true, nb_sectors);", "tracked_request_begin(&req, bs, sector_num, nb_sectors, true);", "ret = drv->bdrv_co_writev(bs, sector_num, nb_sectors, qiov);", "if (bs->dirty_bitmap) {", "set_dirty_bitmap(bs, sector_num, nb_sectors, 1);", "if (bs->wr_highest_sector < sector_num + nb_sectors - 1) {", "bs->wr_highest_sector = sector_num + nb_sectors - 1;", "tracked_request_end(&req);", "return ret;" ]
[ 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 ], [ 17 ], [ 18 ], [ 19 ], [ 20 ], [ 21 ], [ 22 ], [ 23 ] ]
21,804
void *etraxfs_eth_init(NICInfo *nd, target_phys_addr_t base, int phyaddr) { struct etraxfs_dma_client *dma = NULL; struct fs_eth *eth = NULL; qemu_check_nic_model(nd, "fseth"); dma = qemu_mallocz(sizeof *dma * 2); eth = qemu_mallocz(sizeof *eth); dma[0].client.push = eth_tx_push; dma[0].client.opaque = eth; dma[1].client.opaque = eth; dma[1].client.pull = NULL; eth->dma_out = dma; eth->dma_in = dma + 1; /* Connect the phy. */ eth->phyaddr = phyaddr & 0x1f; tdk_init(&eth->phy); mdio_attach(&eth->mdio_bus, &eth->phy, eth->phyaddr); eth->ethregs = cpu_register_io_memory(eth_read, eth_write, eth); cpu_register_physical_memory (base, 0x5c, eth->ethregs); eth->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, eth_can_receive, eth_receive, NULL, eth_cleanup, eth); eth->vc->opaque = eth; eth->vc->link_status_changed = eth_set_link; return dma; }
true
qemu
ae50b2747f77944faa79eb914272b54eb30b63b3
void *etraxfs_eth_init(NICInfo *nd, target_phys_addr_t base, int phyaddr) { struct etraxfs_dma_client *dma = NULL; struct fs_eth *eth = NULL; qemu_check_nic_model(nd, "fseth"); dma = qemu_mallocz(sizeof *dma * 2); eth = qemu_mallocz(sizeof *eth); dma[0].client.push = eth_tx_push; dma[0].client.opaque = eth; dma[1].client.opaque = eth; dma[1].client.pull = NULL; eth->dma_out = dma; eth->dma_in = dma + 1; eth->phyaddr = phyaddr & 0x1f; tdk_init(&eth->phy); mdio_attach(&eth->mdio_bus, &eth->phy, eth->phyaddr); eth->ethregs = cpu_register_io_memory(eth_read, eth_write, eth); cpu_register_physical_memory (base, 0x5c, eth->ethregs); eth->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, eth_can_receive, eth_receive, NULL, eth_cleanup, eth); eth->vc->opaque = eth; eth->vc->link_status_changed = eth_set_link; return dma; }
{ "code": [ "\teth->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name,", "\t\t\t\t eth_can_receive, eth_receive, NULL,", "\t\t\t\t eth_cleanup, eth);" ], "line_no": [ 53, 55, 57 ] }
void *FUNC_0(NICInfo *VAR_0, target_phys_addr_t VAR_1, int VAR_2) { struct etraxfs_dma_client *VAR_3 = NULL; struct fs_eth *VAR_4 = NULL; qemu_check_nic_model(VAR_0, "fseth"); VAR_3 = qemu_mallocz(sizeof *VAR_3 * 2); VAR_4 = qemu_mallocz(sizeof *VAR_4); VAR_3[0].client.push = eth_tx_push; VAR_3[0].client.opaque = VAR_4; VAR_3[1].client.opaque = VAR_4; VAR_3[1].client.pull = NULL; VAR_4->dma_out = VAR_3; VAR_4->dma_in = VAR_3 + 1; VAR_4->VAR_2 = VAR_2 & 0x1f; tdk_init(&VAR_4->phy); mdio_attach(&VAR_4->mdio_bus, &VAR_4->phy, VAR_4->VAR_2); VAR_4->ethregs = cpu_register_io_memory(eth_read, eth_write, VAR_4); cpu_register_physical_memory (VAR_1, 0x5c, VAR_4->ethregs); VAR_4->vc = qemu_new_vlan_client(VAR_0->vlan, VAR_0->model, VAR_0->name, eth_can_receive, eth_receive, NULL, eth_cleanup, VAR_4); VAR_4->vc->opaque = VAR_4; VAR_4->vc->link_status_changed = eth_set_link; return VAR_3; }
[ "void *FUNC_0(NICInfo *VAR_0, target_phys_addr_t VAR_1, int VAR_2)\n{", "struct etraxfs_dma_client *VAR_3 = NULL;", "struct fs_eth *VAR_4 = NULL;", "qemu_check_nic_model(VAR_0, \"fseth\");", "VAR_3 = qemu_mallocz(sizeof *VAR_3 * 2);", "VAR_4 = qemu_mallocz(sizeof *VAR_4);", "VAR_3[0].client.push = eth_tx_push;", "VAR_3[0].client.opaque = VAR_4;", "VAR_3[1].client.opaque = VAR_4;", "VAR_3[1].client.pull = NULL;", "VAR_4->dma_out = VAR_3;", "VAR_4->dma_in = VAR_3 + 1;", "VAR_4->VAR_2 = VAR_2 & 0x1f;", "tdk_init(&VAR_4->phy);", "mdio_attach(&VAR_4->mdio_bus, &VAR_4->phy, VAR_4->VAR_2);", "VAR_4->ethregs = cpu_register_io_memory(eth_read, eth_write, VAR_4);", "cpu_register_physical_memory (VAR_1, 0x5c, VAR_4->ethregs);", "VAR_4->vc = qemu_new_vlan_client(VAR_0->vlan, VAR_0->model, VAR_0->name,\neth_can_receive, eth_receive, NULL,\neth_cleanup, VAR_4);", "VAR_4->vc->opaque = VAR_4;", "VAR_4->vc->link_status_changed = eth_set_link;", "return VAR_3;", "}" ]
[ 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 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 53, 55, 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ] ]
21,805
static void do_udp_write(void *arg, void *buf, int size) { URLContext *h = arg; UDPContext *s = h->priv_data; int ret; if (!(h->flags & AVIO_FLAG_NONBLOCK)) { ret = ff_network_wait_fd(s->udp_fd, 1); if (ret < 0) { s->circular_buffer_error = ret; return; } } if (!s->is_connected) { ret = sendto (s->udp_fd, buf, size, 0, (struct sockaddr *) &s->dest_addr, s->dest_addr_len); } else ret = send(s->udp_fd, buf, size, 0); s->circular_buffer_error=ret; }
true
FFmpeg
9b7a8bddac52bd05dddb28afd4dff92739946d3b
static void do_udp_write(void *arg, void *buf, int size) { URLContext *h = arg; UDPContext *s = h->priv_data; int ret; if (!(h->flags & AVIO_FLAG_NONBLOCK)) { ret = ff_network_wait_fd(s->udp_fd, 1); if (ret < 0) { s->circular_buffer_error = ret; return; } } if (!s->is_connected) { ret = sendto (s->udp_fd, buf, size, 0, (struct sockaddr *) &s->dest_addr, s->dest_addr_len); } else ret = send(s->udp_fd, buf, size, 0); s->circular_buffer_error=ret; }
{ "code": [ "static void do_udp_write(void *arg, void *buf, int size) {", " URLContext *h = arg;", " UDPContext *s = h->priv_data;", " int ret;", " if (!(h->flags & AVIO_FLAG_NONBLOCK)) {", " ret = ff_network_wait_fd(s->udp_fd, 1);", " if (ret < 0) {", " s->circular_buffer_error = ret;", " if (!s->is_connected) {", " ret = sendto (s->udp_fd, buf, size, 0,", " (struct sockaddr *) &s->dest_addr,", " s->dest_addr_len);", " } else", " ret = send(s->udp_fd, buf, size, 0);", " s->circular_buffer_error=ret;" ], "line_no": [ 1, 3, 5, 9, 13, 15, 17, 19, 29, 31, 33, 35, 37, 39, 43 ] }
static void FUNC_0(void *VAR_0, void *VAR_1, int VAR_2) { URLContext *h = VAR_0; UDPContext *s = h->priv_data; int VAR_3; if (!(h->flags & AVIO_FLAG_NONBLOCK)) { VAR_3 = ff_network_wait_fd(s->udp_fd, 1); if (VAR_3 < 0) { s->circular_buffer_error = VAR_3; return; } } if (!s->is_connected) { VAR_3 = sendto (s->udp_fd, VAR_1, VAR_2, 0, (struct sockaddr *) &s->dest_addr, s->dest_addr_len); } else VAR_3 = send(s->udp_fd, VAR_1, VAR_2, 0); s->circular_buffer_error=VAR_3; }
[ "static void FUNC_0(void *VAR_0, void *VAR_1, int VAR_2) {", "URLContext *h = VAR_0;", "UDPContext *s = h->priv_data;", "int VAR_3;", "if (!(h->flags & AVIO_FLAG_NONBLOCK)) {", "VAR_3 = ff_network_wait_fd(s->udp_fd, 1);", "if (VAR_3 < 0) {", "s->circular_buffer_error = VAR_3;", "return;", "}", "}", "if (!s->is_connected) {", "VAR_3 = sendto (s->udp_fd, VAR_1, VAR_2, 0,\n(struct sockaddr *) &s->dest_addr,\ns->dest_addr_len);", "} else", "VAR_3 = send(s->udp_fd, VAR_1, VAR_2, 0);", "s->circular_buffer_error=VAR_3;", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31, 33, 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ] ]
21,806
av_cold struct FFPsyPreprocessContext* ff_psy_preprocess_init(AVCodecContext *avctx) { FFPsyPreprocessContext *ctx; int i; float cutoff_coeff = 0; ctx = av_mallocz(sizeof(FFPsyPreprocessContext)); ctx->avctx = avctx; if (avctx->cutoff > 0) cutoff_coeff = 2.0 * avctx->cutoff / avctx->sample_rate; if (cutoff_coeff) ctx->fcoeffs = ff_iir_filter_init_coeffs(FF_FILTER_TYPE_BUTTERWORTH, FF_FILTER_MODE_LOWPASS, FILT_ORDER, cutoff_coeff, 0.0, 0.0); if (ctx->fcoeffs) { ctx->fstate = av_mallocz(sizeof(ctx->fstate[0]) * avctx->channels); for (i = 0; i < avctx->channels; i++) ctx->fstate[i] = ff_iir_filter_init_state(FILT_ORDER); } return ctx; }
true
FFmpeg
20d1f6fec1aa2a33c4cf8162e72ca88ead3d389d
av_cold struct FFPsyPreprocessContext* ff_psy_preprocess_init(AVCodecContext *avctx) { FFPsyPreprocessContext *ctx; int i; float cutoff_coeff = 0; ctx = av_mallocz(sizeof(FFPsyPreprocessContext)); ctx->avctx = avctx; if (avctx->cutoff > 0) cutoff_coeff = 2.0 * avctx->cutoff / avctx->sample_rate; if (cutoff_coeff) ctx->fcoeffs = ff_iir_filter_init_coeffs(FF_FILTER_TYPE_BUTTERWORTH, FF_FILTER_MODE_LOWPASS, FILT_ORDER, cutoff_coeff, 0.0, 0.0); if (ctx->fcoeffs) { ctx->fstate = av_mallocz(sizeof(ctx->fstate[0]) * avctx->channels); for (i = 0; i < avctx->channels; i++) ctx->fstate[i] = ff_iir_filter_init_state(FILT_ORDER); } return ctx; }
{ "code": [ " ctx->fcoeffs = ff_iir_filter_init_coeffs(FF_FILTER_TYPE_BUTTERWORTH, FF_FILTER_MODE_LOWPASS," ], "line_no": [ 25 ] }
av_cold struct FFPsyPreprocessContext* FUNC_0(AVCodecContext *avctx) { FFPsyPreprocessContext *VAR_0; int VAR_1; float VAR_2 = 0; VAR_0 = av_mallocz(sizeof(FFPsyPreprocessContext)); VAR_0->avctx = avctx; if (avctx->cutoff > 0) VAR_2 = 2.0 * avctx->cutoff / avctx->sample_rate; if (VAR_2) VAR_0->fcoeffs = ff_iir_filter_init_coeffs(FF_FILTER_TYPE_BUTTERWORTH, FF_FILTER_MODE_LOWPASS, FILT_ORDER, VAR_2, 0.0, 0.0); if (VAR_0->fcoeffs) { VAR_0->fstate = av_mallocz(sizeof(VAR_0->fstate[0]) * avctx->channels); for (VAR_1 = 0; VAR_1 < avctx->channels; VAR_1++) VAR_0->fstate[VAR_1] = ff_iir_filter_init_state(FILT_ORDER); } return VAR_0; }
[ "av_cold struct FFPsyPreprocessContext* FUNC_0(AVCodecContext *avctx)\n{", "FFPsyPreprocessContext *VAR_0;", "int VAR_1;", "float VAR_2 = 0;", "VAR_0 = av_mallocz(sizeof(FFPsyPreprocessContext));", "VAR_0->avctx = avctx;", "if (avctx->cutoff > 0)\nVAR_2 = 2.0 * avctx->cutoff / avctx->sample_rate;", "if (VAR_2)\nVAR_0->fcoeffs = ff_iir_filter_init_coeffs(FF_FILTER_TYPE_BUTTERWORTH, FF_FILTER_MODE_LOWPASS,\nFILT_ORDER, VAR_2, 0.0, 0.0);", "if (VAR_0->fcoeffs) {", "VAR_0->fstate = av_mallocz(sizeof(VAR_0->fstate[0]) * avctx->channels);", "for (VAR_1 = 0; VAR_1 < avctx->channels; VAR_1++)", "VAR_0->fstate[VAR_1] = ff_iir_filter_init_state(FILT_ORDER);", "}", "return VAR_0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 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 ] ]
21,807
static QVirtioPCIDevice *virtio_blk_pci_init(QPCIBus *bus, int slot) { QVirtioPCIDevice *dev; dev = qvirtio_pci_device_find(bus, VIRTIO_ID_BLOCK); g_assert(dev != NULL); g_assert_cmphex(dev->vdev.device_type, ==, VIRTIO_ID_BLOCK); g_assert_cmphex(dev->pdev->devfn, ==, ((slot << 3) | PCI_FN)); qvirtio_pci_device_enable(dev); qvirtio_reset(&dev->vdev); qvirtio_set_acknowledge(&dev->vdev); qvirtio_set_driver(&dev->vdev); return dev; }
true
qemu
80e1eea37a25a7696137e680285e36d0bfdc9f34
static QVirtioPCIDevice *virtio_blk_pci_init(QPCIBus *bus, int slot) { QVirtioPCIDevice *dev; dev = qvirtio_pci_device_find(bus, VIRTIO_ID_BLOCK); g_assert(dev != NULL); g_assert_cmphex(dev->vdev.device_type, ==, VIRTIO_ID_BLOCK); g_assert_cmphex(dev->pdev->devfn, ==, ((slot << 3) | PCI_FN)); qvirtio_pci_device_enable(dev); qvirtio_reset(&dev->vdev); qvirtio_set_acknowledge(&dev->vdev); qvirtio_set_driver(&dev->vdev); return dev; }
{ "code": [ " dev = qvirtio_pci_device_find(bus, VIRTIO_ID_BLOCK);" ], "line_no": [ 9 ] }
static QVirtioPCIDevice *FUNC_0(QPCIBus *bus, int slot) { QVirtioPCIDevice *dev; dev = qvirtio_pci_device_find(bus, VIRTIO_ID_BLOCK); g_assert(dev != NULL); g_assert_cmphex(dev->vdev.device_type, ==, VIRTIO_ID_BLOCK); g_assert_cmphex(dev->pdev->devfn, ==, ((slot << 3) | PCI_FN)); qvirtio_pci_device_enable(dev); qvirtio_reset(&dev->vdev); qvirtio_set_acknowledge(&dev->vdev); qvirtio_set_driver(&dev->vdev); return dev; }
[ "static QVirtioPCIDevice *FUNC_0(QPCIBus *bus, int slot)\n{", "QVirtioPCIDevice *dev;", "dev = qvirtio_pci_device_find(bus, VIRTIO_ID_BLOCK);", "g_assert(dev != NULL);", "g_assert_cmphex(dev->vdev.device_type, ==, VIRTIO_ID_BLOCK);", "g_assert_cmphex(dev->pdev->devfn, ==, ((slot << 3) | PCI_FN));", "qvirtio_pci_device_enable(dev);", "qvirtio_reset(&dev->vdev);", "qvirtio_set_acknowledge(&dev->vdev);", "qvirtio_set_driver(&dev->vdev);", "return dev;", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ] ]
21,808
static int64_t coroutine_fn bdrv_co_get_block_status(BlockDriverState *bs, int64_t sector_num, int nb_sectors, int *pnum, BlockDriverState **file) { int64_t total_sectors; int64_t n; int64_t ret, ret2; total_sectors = bdrv_nb_sectors(bs); if (total_sectors < 0) { return total_sectors; } if (sector_num >= total_sectors) { *pnum = 0; return BDRV_BLOCK_EOF; } n = total_sectors - sector_num; if (n < nb_sectors) { nb_sectors = n; } if (!bs->drv->bdrv_co_get_block_status) { *pnum = nb_sectors; ret = BDRV_BLOCK_DATA | BDRV_BLOCK_ALLOCATED; if (sector_num + nb_sectors == total_sectors) { ret |= BDRV_BLOCK_EOF; } if (bs->drv->protocol_name) { ret |= BDRV_BLOCK_OFFSET_VALID | (sector_num * BDRV_SECTOR_SIZE); } return ret; } *file = NULL; bdrv_inc_in_flight(bs); ret = bs->drv->bdrv_co_get_block_status(bs, sector_num, nb_sectors, pnum, file); if (ret < 0) { *pnum = 0; goto out; } if (ret & BDRV_BLOCK_RAW) { assert(ret & BDRV_BLOCK_OFFSET_VALID); ret = bdrv_co_get_block_status(*file, ret >> BDRV_SECTOR_BITS, *pnum, pnum, file); goto out; } if (ret & (BDRV_BLOCK_DATA | BDRV_BLOCK_ZERO)) { ret |= BDRV_BLOCK_ALLOCATED; } else { if (bdrv_unallocated_blocks_are_zero(bs)) { ret |= BDRV_BLOCK_ZERO; } else if (bs->backing) { BlockDriverState *bs2 = bs->backing->bs; int64_t nb_sectors2 = bdrv_nb_sectors(bs2); if (nb_sectors2 >= 0 && sector_num >= nb_sectors2) { ret |= BDRV_BLOCK_ZERO; } } } if (*file && *file != bs && (ret & BDRV_BLOCK_DATA) && !(ret & BDRV_BLOCK_ZERO) && (ret & BDRV_BLOCK_OFFSET_VALID)) { BlockDriverState *file2; int file_pnum; ret2 = bdrv_co_get_block_status(*file, ret >> BDRV_SECTOR_BITS, *pnum, &file_pnum, &file2); if (ret2 >= 0) { /* Ignore errors. This is just providing extra information, it * is useful but not necessary. */ if (ret2 & BDRV_BLOCK_EOF && (!file_pnum || ret2 & BDRV_BLOCK_ZERO)) { /* * It is valid for the format block driver to read * beyond the end of the underlying file's current * size; such areas read as zero. */ ret |= BDRV_BLOCK_ZERO; } else { /* Limit request to the range reported by the protocol driver */ *pnum = file_pnum; ret |= (ret2 & BDRV_BLOCK_ZERO); } } } out: bdrv_dec_in_flight(bs); if (ret >= 0 && sector_num + *pnum == total_sectors) { ret |= BDRV_BLOCK_EOF; } return ret; }
true
qemu
81c219ac6ce0d6182e35f3976f2caa4cefcaf9f0
static int64_t coroutine_fn bdrv_co_get_block_status(BlockDriverState *bs, int64_t sector_num, int nb_sectors, int *pnum, BlockDriverState **file) { int64_t total_sectors; int64_t n; int64_t ret, ret2; total_sectors = bdrv_nb_sectors(bs); if (total_sectors < 0) { return total_sectors; } if (sector_num >= total_sectors) { *pnum = 0; return BDRV_BLOCK_EOF; } n = total_sectors - sector_num; if (n < nb_sectors) { nb_sectors = n; } if (!bs->drv->bdrv_co_get_block_status) { *pnum = nb_sectors; ret = BDRV_BLOCK_DATA | BDRV_BLOCK_ALLOCATED; if (sector_num + nb_sectors == total_sectors) { ret |= BDRV_BLOCK_EOF; } if (bs->drv->protocol_name) { ret |= BDRV_BLOCK_OFFSET_VALID | (sector_num * BDRV_SECTOR_SIZE); } return ret; } *file = NULL; bdrv_inc_in_flight(bs); ret = bs->drv->bdrv_co_get_block_status(bs, sector_num, nb_sectors, pnum, file); if (ret < 0) { *pnum = 0; goto out; } if (ret & BDRV_BLOCK_RAW) { assert(ret & BDRV_BLOCK_OFFSET_VALID); ret = bdrv_co_get_block_status(*file, ret >> BDRV_SECTOR_BITS, *pnum, pnum, file); goto out; } if (ret & (BDRV_BLOCK_DATA | BDRV_BLOCK_ZERO)) { ret |= BDRV_BLOCK_ALLOCATED; } else { if (bdrv_unallocated_blocks_are_zero(bs)) { ret |= BDRV_BLOCK_ZERO; } else if (bs->backing) { BlockDriverState *bs2 = bs->backing->bs; int64_t nb_sectors2 = bdrv_nb_sectors(bs2); if (nb_sectors2 >= 0 && sector_num >= nb_sectors2) { ret |= BDRV_BLOCK_ZERO; } } } if (*file && *file != bs && (ret & BDRV_BLOCK_DATA) && !(ret & BDRV_BLOCK_ZERO) && (ret & BDRV_BLOCK_OFFSET_VALID)) { BlockDriverState *file2; int file_pnum; ret2 = bdrv_co_get_block_status(*file, ret >> BDRV_SECTOR_BITS, *pnum, &file_pnum, &file2); if (ret2 >= 0) { if (ret2 & BDRV_BLOCK_EOF && (!file_pnum || ret2 & BDRV_BLOCK_ZERO)) { ret |= BDRV_BLOCK_ZERO; } else { *pnum = file_pnum; ret |= (ret2 & BDRV_BLOCK_ZERO); } } } out: bdrv_dec_in_flight(bs); if (ret >= 0 && sector_num + *pnum == total_sectors) { ret |= BDRV_BLOCK_EOF; } return ret; }
{ "code": [ " *file = NULL;", " assert(ret & BDRV_BLOCK_OFFSET_VALID);" ], "line_no": [ 73, 93 ] }
static int64_t VAR_0 bdrv_co_get_block_status(BlockDriverState *bs, int64_t sector_num, int nb_sectors, int *pnum, BlockDriverState **file) { int64_t total_sectors; int64_t n; int64_t ret, ret2; total_sectors = bdrv_nb_sectors(bs); if (total_sectors < 0) { return total_sectors; } if (sector_num >= total_sectors) { *pnum = 0; return BDRV_BLOCK_EOF; } n = total_sectors - sector_num; if (n < nb_sectors) { nb_sectors = n; } if (!bs->drv->bdrv_co_get_block_status) { *pnum = nb_sectors; ret = BDRV_BLOCK_DATA | BDRV_BLOCK_ALLOCATED; if (sector_num + nb_sectors == total_sectors) { ret |= BDRV_BLOCK_EOF; } if (bs->drv->protocol_name) { ret |= BDRV_BLOCK_OFFSET_VALID | (sector_num * BDRV_SECTOR_SIZE); } return ret; } *file = NULL; bdrv_inc_in_flight(bs); ret = bs->drv->bdrv_co_get_block_status(bs, sector_num, nb_sectors, pnum, file); if (ret < 0) { *pnum = 0; goto out; } if (ret & BDRV_BLOCK_RAW) { assert(ret & BDRV_BLOCK_OFFSET_VALID); ret = bdrv_co_get_block_status(*file, ret >> BDRV_SECTOR_BITS, *pnum, pnum, file); goto out; } if (ret & (BDRV_BLOCK_DATA | BDRV_BLOCK_ZERO)) { ret |= BDRV_BLOCK_ALLOCATED; } else { if (bdrv_unallocated_blocks_are_zero(bs)) { ret |= BDRV_BLOCK_ZERO; } else if (bs->backing) { BlockDriverState *bs2 = bs->backing->bs; int64_t nb_sectors2 = bdrv_nb_sectors(bs2); if (nb_sectors2 >= 0 && sector_num >= nb_sectors2) { ret |= BDRV_BLOCK_ZERO; } } } if (*file && *file != bs && (ret & BDRV_BLOCK_DATA) && !(ret & BDRV_BLOCK_ZERO) && (ret & BDRV_BLOCK_OFFSET_VALID)) { BlockDriverState *file2; int file_pnum; ret2 = bdrv_co_get_block_status(*file, ret >> BDRV_SECTOR_BITS, *pnum, &file_pnum, &file2); if (ret2 >= 0) { if (ret2 & BDRV_BLOCK_EOF && (!file_pnum || ret2 & BDRV_BLOCK_ZERO)) { ret |= BDRV_BLOCK_ZERO; } else { *pnum = file_pnum; ret |= (ret2 & BDRV_BLOCK_ZERO); } } } out: bdrv_dec_in_flight(bs); if (ret >= 0 && sector_num + *pnum == total_sectors) { ret |= BDRV_BLOCK_EOF; } return ret; }
[ "static int64_t VAR_0 bdrv_co_get_block_status(BlockDriverState *bs,\nint64_t sector_num,\nint nb_sectors, int *pnum,\nBlockDriverState **file)\n{", "int64_t total_sectors;", "int64_t n;", "int64_t ret, ret2;", "total_sectors = bdrv_nb_sectors(bs);", "if (total_sectors < 0) {", "return total_sectors;", "}", "if (sector_num >= total_sectors) {", "*pnum = 0;", "return BDRV_BLOCK_EOF;", "}", "n = total_sectors - sector_num;", "if (n < nb_sectors) {", "nb_sectors = n;", "}", "if (!bs->drv->bdrv_co_get_block_status) {", "*pnum = nb_sectors;", "ret = BDRV_BLOCK_DATA | BDRV_BLOCK_ALLOCATED;", "if (sector_num + nb_sectors == total_sectors) {", "ret |= BDRV_BLOCK_EOF;", "}", "if (bs->drv->protocol_name) {", "ret |= BDRV_BLOCK_OFFSET_VALID | (sector_num * BDRV_SECTOR_SIZE);", "}", "return ret;", "}", "*file = NULL;", "bdrv_inc_in_flight(bs);", "ret = bs->drv->bdrv_co_get_block_status(bs, sector_num, nb_sectors, pnum,\nfile);", "if (ret < 0) {", "*pnum = 0;", "goto out;", "}", "if (ret & BDRV_BLOCK_RAW) {", "assert(ret & BDRV_BLOCK_OFFSET_VALID);", "ret = bdrv_co_get_block_status(*file, ret >> BDRV_SECTOR_BITS,\n*pnum, pnum, file);", "goto out;", "}", "if (ret & (BDRV_BLOCK_DATA | BDRV_BLOCK_ZERO)) {", "ret |= BDRV_BLOCK_ALLOCATED;", "} else {", "if (bdrv_unallocated_blocks_are_zero(bs)) {", "ret |= BDRV_BLOCK_ZERO;", "} else if (bs->backing) {", "BlockDriverState *bs2 = bs->backing->bs;", "int64_t nb_sectors2 = bdrv_nb_sectors(bs2);", "if (nb_sectors2 >= 0 && sector_num >= nb_sectors2) {", "ret |= BDRV_BLOCK_ZERO;", "}", "}", "}", "if (*file && *file != bs &&\n(ret & BDRV_BLOCK_DATA) && !(ret & BDRV_BLOCK_ZERO) &&\n(ret & BDRV_BLOCK_OFFSET_VALID)) {", "BlockDriverState *file2;", "int file_pnum;", "ret2 = bdrv_co_get_block_status(*file, ret >> BDRV_SECTOR_BITS,\n*pnum, &file_pnum, &file2);", "if (ret2 >= 0) {", "if (ret2 & BDRV_BLOCK_EOF &&\n(!file_pnum || ret2 & BDRV_BLOCK_ZERO)) {", "ret |= BDRV_BLOCK_ZERO;", "} else {", "*pnum = file_pnum;", "ret |= (ret2 & BDRV_BLOCK_ZERO);", "}", "}", "}", "out:\nbdrv_dec_in_flight(bs);", "if (ret >= 0 && sector_num + *pnum == total_sectors) {", "ret |= BDRV_BLOCK_EOF;", "}", "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, 1, 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 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 133, 135, 137 ], [ 139 ], [ 141 ], [ 145, 147 ], [ 149 ], [ 157, 159 ], [ 171 ], [ 173 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 189, 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ] ]
21,809
static int qcow2_do_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVQcow2State *s = bs->opaque; unsigned int len, i; int ret = 0; QCowHeader header; Error *local_err = NULL; uint64_t ext_end; uint64_t l1_vm_state_index; ret = bdrv_pread(bs->file, 0, &header, sizeof(header)); if (ret < 0) { error_setg_errno(errp, -ret, "Could not read qcow2 header"); goto fail; } be32_to_cpus(&header.magic); be32_to_cpus(&header.version); be64_to_cpus(&header.backing_file_offset); be32_to_cpus(&header.backing_file_size); be64_to_cpus(&header.size); be32_to_cpus(&header.cluster_bits); be32_to_cpus(&header.crypt_method); be64_to_cpus(&header.l1_table_offset); be32_to_cpus(&header.l1_size); be64_to_cpus(&header.refcount_table_offset); be32_to_cpus(&header.refcount_table_clusters); be64_to_cpus(&header.snapshots_offset); be32_to_cpus(&header.nb_snapshots); if (header.magic != QCOW_MAGIC) { error_setg(errp, "Image is not in qcow2 format"); ret = -EINVAL; goto fail; } if (header.version < 2 || header.version > 3) { error_setg(errp, "Unsupported qcow2 version %" PRIu32, header.version); ret = -ENOTSUP; goto fail; } s->qcow_version = header.version; /* Initialise cluster size */ if (header.cluster_bits < MIN_CLUSTER_BITS || header.cluster_bits > MAX_CLUSTER_BITS) { error_setg(errp, "Unsupported cluster size: 2^%" PRIu32, header.cluster_bits); ret = -EINVAL; goto fail; } s->cluster_bits = header.cluster_bits; s->cluster_size = 1 << s->cluster_bits; s->cluster_sectors = 1 << (s->cluster_bits - 9); /* Initialise version 3 header fields */ if (header.version == 2) { header.incompatible_features = 0; header.compatible_features = 0; header.autoclear_features = 0; header.refcount_order = 4; header.header_length = 72; } else { be64_to_cpus(&header.incompatible_features); be64_to_cpus(&header.compatible_features); be64_to_cpus(&header.autoclear_features); be32_to_cpus(&header.refcount_order); be32_to_cpus(&header.header_length); if (header.header_length < 104) { error_setg(errp, "qcow2 header too short"); ret = -EINVAL; goto fail; } } if (header.header_length > s->cluster_size) { error_setg(errp, "qcow2 header exceeds cluster size"); ret = -EINVAL; goto fail; } if (header.header_length > sizeof(header)) { s->unknown_header_fields_size = header.header_length - sizeof(header); s->unknown_header_fields = g_malloc(s->unknown_header_fields_size); ret = bdrv_pread(bs->file, sizeof(header), s->unknown_header_fields, s->unknown_header_fields_size); if (ret < 0) { error_setg_errno(errp, -ret, "Could not read unknown qcow2 header " "fields"); goto fail; } } if (header.backing_file_offset > s->cluster_size) { error_setg(errp, "Invalid backing file offset"); ret = -EINVAL; goto fail; } if (header.backing_file_offset) { ext_end = header.backing_file_offset; } else { ext_end = 1 << header.cluster_bits; } /* Handle feature bits */ s->incompatible_features = header.incompatible_features; s->compatible_features = header.compatible_features; s->autoclear_features = header.autoclear_features; if (s->incompatible_features & ~QCOW2_INCOMPAT_MASK) { void *feature_table = NULL; qcow2_read_extensions(bs, header.header_length, ext_end, &feature_table, NULL); report_unsupported_feature(errp, feature_table, s->incompatible_features & ~QCOW2_INCOMPAT_MASK); ret = -ENOTSUP; g_free(feature_table); goto fail; } if (s->incompatible_features & QCOW2_INCOMPAT_CORRUPT) { /* Corrupt images may not be written to unless they are being repaired */ if ((flags & BDRV_O_RDWR) && !(flags & BDRV_O_CHECK)) { error_setg(errp, "qcow2: Image is corrupt; cannot be opened " "read/write"); ret = -EACCES; goto fail; } } /* Check support for various header values */ if (header.refcount_order > 6) { error_setg(errp, "Reference count entry width too large; may not " "exceed 64 bits"); ret = -EINVAL; goto fail; } s->refcount_order = header.refcount_order; s->refcount_bits = 1 << s->refcount_order; s->refcount_max = UINT64_C(1) << (s->refcount_bits - 1); s->refcount_max += s->refcount_max - 1; if (header.crypt_method > QCOW_CRYPT_AES) { error_setg(errp, "Unsupported encryption method: %" PRIu32, header.crypt_method); ret = -EINVAL; goto fail; } s->crypt_method_header = header.crypt_method; if (s->crypt_method_header) { if (bdrv_uses_whitelist() && s->crypt_method_header == QCOW_CRYPT_AES) { error_setg(errp, "Use of AES-CBC encrypted qcow2 images is no longer " "supported in system emulators"); error_append_hint(errp, "You can use 'qemu-img convert' to convert your " "image to an alternative supported format, such " "as unencrypted qcow2, or raw with the LUKS " "format instead.\n"); ret = -ENOSYS; goto fail; } bs->encrypted = true; bs->valid_key = true; } s->l2_bits = s->cluster_bits - 3; /* L2 is always one cluster */ s->l2_size = 1 << s->l2_bits; /* 2^(s->refcount_order - 3) is the refcount width in bytes */ s->refcount_block_bits = s->cluster_bits - (s->refcount_order - 3); s->refcount_block_size = 1 << s->refcount_block_bits; bs->total_sectors = header.size / 512; s->csize_shift = (62 - (s->cluster_bits - 8)); s->csize_mask = (1 << (s->cluster_bits - 8)) - 1; s->cluster_offset_mask = (1LL << s->csize_shift) - 1; s->refcount_table_offset = header.refcount_table_offset; s->refcount_table_size = header.refcount_table_clusters << (s->cluster_bits - 3); if (header.refcount_table_clusters > qcow2_max_refcount_clusters(s)) { error_setg(errp, "Reference count table too large"); ret = -EINVAL; goto fail; } ret = validate_table_offset(bs, s->refcount_table_offset, s->refcount_table_size, sizeof(uint64_t)); if (ret < 0) { error_setg(errp, "Invalid reference count table offset"); goto fail; } /* Snapshot table offset/length */ if (header.nb_snapshots > QCOW_MAX_SNAPSHOTS) { error_setg(errp, "Too many snapshots"); ret = -EINVAL; goto fail; } ret = validate_table_offset(bs, header.snapshots_offset, header.nb_snapshots, sizeof(QCowSnapshotHeader)); if (ret < 0) { error_setg(errp, "Invalid snapshot table offset"); goto fail; } /* read the level 1 table */ if (header.l1_size > QCOW_MAX_L1_SIZE / sizeof(uint64_t)) { error_setg(errp, "Active L1 table too large"); ret = -EFBIG; goto fail; } s->l1_size = header.l1_size; l1_vm_state_index = size_to_l1(s, header.size); if (l1_vm_state_index > INT_MAX) { error_setg(errp, "Image is too big"); ret = -EFBIG; goto fail; } s->l1_vm_state_index = l1_vm_state_index; /* the L1 table must contain at least enough entries to put header.size bytes */ if (s->l1_size < s->l1_vm_state_index) { error_setg(errp, "L1 table is too small"); ret = -EINVAL; goto fail; } ret = validate_table_offset(bs, header.l1_table_offset, header.l1_size, sizeof(uint64_t)); if (ret < 0) { error_setg(errp, "Invalid L1 table offset"); goto fail; } s->l1_table_offset = header.l1_table_offset; if (s->l1_size > 0) { s->l1_table = qemu_try_blockalign(bs->file->bs, align_offset(s->l1_size * sizeof(uint64_t), 512)); if (s->l1_table == NULL) { error_setg(errp, "Could not allocate L1 table"); ret = -ENOMEM; goto fail; } ret = bdrv_pread(bs->file, s->l1_table_offset, s->l1_table, s->l1_size * sizeof(uint64_t)); if (ret < 0) { error_setg_errno(errp, -ret, "Could not read L1 table"); goto fail; } for(i = 0;i < s->l1_size; i++) { be64_to_cpus(&s->l1_table[i]); } } /* Parse driver-specific options */ ret = qcow2_update_options(bs, options, flags, errp); if (ret < 0) { goto fail; } s->cluster_cache = g_malloc(s->cluster_size); /* one more sector for decompressed data alignment */ s->cluster_data = qemu_try_blockalign(bs->file->bs, QCOW_MAX_CRYPT_CLUSTERS * s->cluster_size + 512); if (s->cluster_data == NULL) { error_setg(errp, "Could not allocate temporary cluster buffer"); ret = -ENOMEM; goto fail; } s->cluster_cache_offset = -1; s->flags = flags; ret = qcow2_refcount_init(bs); if (ret != 0) { error_setg_errno(errp, -ret, "Could not initialize refcount handling"); goto fail; } QLIST_INIT(&s->cluster_allocs); QTAILQ_INIT(&s->discards); /* read qcow2 extensions */ if (qcow2_read_extensions(bs, header.header_length, ext_end, NULL, &local_err)) { error_propagate(errp, local_err); ret = -EINVAL; goto fail; } if (s->crypt_method_header == QCOW_CRYPT_AES) { unsigned int cflags = 0; if (flags & BDRV_O_NO_IO) { cflags |= QCRYPTO_BLOCK_OPEN_NO_IO; } s->crypto = qcrypto_block_open(s->crypto_opts, NULL, NULL, cflags, errp); if (!s->crypto) { ret = -EINVAL; goto fail; } } /* read the backing file name */ if (header.backing_file_offset != 0) { len = header.backing_file_size; if (len > MIN(1023, s->cluster_size - header.backing_file_offset) || len >= sizeof(bs->backing_file)) { error_setg(errp, "Backing file name too long"); ret = -EINVAL; goto fail; } ret = bdrv_pread(bs->file, header.backing_file_offset, bs->backing_file, len); if (ret < 0) { error_setg_errno(errp, -ret, "Could not read backing file name"); goto fail; } bs->backing_file[len] = '\0'; s->image_backing_file = g_strdup(bs->backing_file); } /* Internal snapshots */ s->snapshots_offset = header.snapshots_offset; s->nb_snapshots = header.nb_snapshots; ret = qcow2_read_snapshots(bs); if (ret < 0) { error_setg_errno(errp, -ret, "Could not read snapshots"); goto fail; } /* Clear unknown autoclear feature bits */ if (!bs->read_only && !(flags & BDRV_O_INACTIVE) && s->autoclear_features) { s->autoclear_features = 0; ret = qcow2_update_header(bs); if (ret < 0) { error_setg_errno(errp, -ret, "Could not update qcow2 header"); goto fail; } } /* Initialise locks */ qemu_co_mutex_init(&s->lock); bs->supported_zero_flags = BDRV_REQ_MAY_UNMAP; /* Repair image if dirty */ if (!(flags & (BDRV_O_CHECK | BDRV_O_INACTIVE)) && !bs->read_only && (s->incompatible_features & QCOW2_INCOMPAT_DIRTY)) { BdrvCheckResult result = {0}; ret = qcow2_check(bs, &result, BDRV_FIX_ERRORS | BDRV_FIX_LEAKS); if (ret < 0) { error_setg_errno(errp, -ret, "Could not repair dirty image"); goto fail; } } #ifdef DEBUG_ALLOC { BdrvCheckResult result = {0}; qcow2_check_refcounts(bs, &result, 0); } #endif return ret; fail: g_free(s->unknown_header_fields); cleanup_unknown_header_ext(bs); qcow2_free_snapshots(bs); qcow2_refcount_close(bs); qemu_vfree(s->l1_table); /* else pre-write overlap checks in cache_destroy may crash */ s->l1_table = NULL; cache_clean_timer_del(bs); if (s->l2_table_cache) { qcow2_cache_destroy(bs, s->l2_table_cache); } if (s->refcount_block_cache) { qcow2_cache_destroy(bs, s->refcount_block_cache); } g_free(s->cluster_cache); qemu_vfree(s->cluster_data); qcrypto_block_free(s->crypto); qapi_free_QCryptoBlockOpenOptions(s->crypto_opts); return ret; }
true
qemu
4652b8f3e1ec91bb9d6f00e40df7f96d1f1aafee
static int qcow2_do_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVQcow2State *s = bs->opaque; unsigned int len, i; int ret = 0; QCowHeader header; Error *local_err = NULL; uint64_t ext_end; uint64_t l1_vm_state_index; ret = bdrv_pread(bs->file, 0, &header, sizeof(header)); if (ret < 0) { error_setg_errno(errp, -ret, "Could not read qcow2 header"); goto fail; } be32_to_cpus(&header.magic); be32_to_cpus(&header.version); be64_to_cpus(&header.backing_file_offset); be32_to_cpus(&header.backing_file_size); be64_to_cpus(&header.size); be32_to_cpus(&header.cluster_bits); be32_to_cpus(&header.crypt_method); be64_to_cpus(&header.l1_table_offset); be32_to_cpus(&header.l1_size); be64_to_cpus(&header.refcount_table_offset); be32_to_cpus(&header.refcount_table_clusters); be64_to_cpus(&header.snapshots_offset); be32_to_cpus(&header.nb_snapshots); if (header.magic != QCOW_MAGIC) { error_setg(errp, "Image is not in qcow2 format"); ret = -EINVAL; goto fail; } if (header.version < 2 || header.version > 3) { error_setg(errp, "Unsupported qcow2 version %" PRIu32, header.version); ret = -ENOTSUP; goto fail; } s->qcow_version = header.version; if (header.cluster_bits < MIN_CLUSTER_BITS || header.cluster_bits > MAX_CLUSTER_BITS) { error_setg(errp, "Unsupported cluster size: 2^%" PRIu32, header.cluster_bits); ret = -EINVAL; goto fail; } s->cluster_bits = header.cluster_bits; s->cluster_size = 1 << s->cluster_bits; s->cluster_sectors = 1 << (s->cluster_bits - 9); if (header.version == 2) { header.incompatible_features = 0; header.compatible_features = 0; header.autoclear_features = 0; header.refcount_order = 4; header.header_length = 72; } else { be64_to_cpus(&header.incompatible_features); be64_to_cpus(&header.compatible_features); be64_to_cpus(&header.autoclear_features); be32_to_cpus(&header.refcount_order); be32_to_cpus(&header.header_length); if (header.header_length < 104) { error_setg(errp, "qcow2 header too short"); ret = -EINVAL; goto fail; } } if (header.header_length > s->cluster_size) { error_setg(errp, "qcow2 header exceeds cluster size"); ret = -EINVAL; goto fail; } if (header.header_length > sizeof(header)) { s->unknown_header_fields_size = header.header_length - sizeof(header); s->unknown_header_fields = g_malloc(s->unknown_header_fields_size); ret = bdrv_pread(bs->file, sizeof(header), s->unknown_header_fields, s->unknown_header_fields_size); if (ret < 0) { error_setg_errno(errp, -ret, "Could not read unknown qcow2 header " "fields"); goto fail; } } if (header.backing_file_offset > s->cluster_size) { error_setg(errp, "Invalid backing file offset"); ret = -EINVAL; goto fail; } if (header.backing_file_offset) { ext_end = header.backing_file_offset; } else { ext_end = 1 << header.cluster_bits; } s->incompatible_features = header.incompatible_features; s->compatible_features = header.compatible_features; s->autoclear_features = header.autoclear_features; if (s->incompatible_features & ~QCOW2_INCOMPAT_MASK) { void *feature_table = NULL; qcow2_read_extensions(bs, header.header_length, ext_end, &feature_table, NULL); report_unsupported_feature(errp, feature_table, s->incompatible_features & ~QCOW2_INCOMPAT_MASK); ret = -ENOTSUP; g_free(feature_table); goto fail; } if (s->incompatible_features & QCOW2_INCOMPAT_CORRUPT) { if ((flags & BDRV_O_RDWR) && !(flags & BDRV_O_CHECK)) { error_setg(errp, "qcow2: Image is corrupt; cannot be opened " "read/write"); ret = -EACCES; goto fail; } } if (header.refcount_order > 6) { error_setg(errp, "Reference count entry width too large; may not " "exceed 64 bits"); ret = -EINVAL; goto fail; } s->refcount_order = header.refcount_order; s->refcount_bits = 1 << s->refcount_order; s->refcount_max = UINT64_C(1) << (s->refcount_bits - 1); s->refcount_max += s->refcount_max - 1; if (header.crypt_method > QCOW_CRYPT_AES) { error_setg(errp, "Unsupported encryption method: %" PRIu32, header.crypt_method); ret = -EINVAL; goto fail; } s->crypt_method_header = header.crypt_method; if (s->crypt_method_header) { if (bdrv_uses_whitelist() && s->crypt_method_header == QCOW_CRYPT_AES) { error_setg(errp, "Use of AES-CBC encrypted qcow2 images is no longer " "supported in system emulators"); error_append_hint(errp, "You can use 'qemu-img convert' to convert your " "image to an alternative supported format, such " "as unencrypted qcow2, or raw with the LUKS " "format instead.\n"); ret = -ENOSYS; goto fail; } bs->encrypted = true; bs->valid_key = true; } s->l2_bits = s->cluster_bits - 3; s->l2_size = 1 << s->l2_bits; s->refcount_block_bits = s->cluster_bits - (s->refcount_order - 3); s->refcount_block_size = 1 << s->refcount_block_bits; bs->total_sectors = header.size / 512; s->csize_shift = (62 - (s->cluster_bits - 8)); s->csize_mask = (1 << (s->cluster_bits - 8)) - 1; s->cluster_offset_mask = (1LL << s->csize_shift) - 1; s->refcount_table_offset = header.refcount_table_offset; s->refcount_table_size = header.refcount_table_clusters << (s->cluster_bits - 3); if (header.refcount_table_clusters > qcow2_max_refcount_clusters(s)) { error_setg(errp, "Reference count table too large"); ret = -EINVAL; goto fail; } ret = validate_table_offset(bs, s->refcount_table_offset, s->refcount_table_size, sizeof(uint64_t)); if (ret < 0) { error_setg(errp, "Invalid reference count table offset"); goto fail; } if (header.nb_snapshots > QCOW_MAX_SNAPSHOTS) { error_setg(errp, "Too many snapshots"); ret = -EINVAL; goto fail; } ret = validate_table_offset(bs, header.snapshots_offset, header.nb_snapshots, sizeof(QCowSnapshotHeader)); if (ret < 0) { error_setg(errp, "Invalid snapshot table offset"); goto fail; } if (header.l1_size > QCOW_MAX_L1_SIZE / sizeof(uint64_t)) { error_setg(errp, "Active L1 table too large"); ret = -EFBIG; goto fail; } s->l1_size = header.l1_size; l1_vm_state_index = size_to_l1(s, header.size); if (l1_vm_state_index > INT_MAX) { error_setg(errp, "Image is too big"); ret = -EFBIG; goto fail; } s->l1_vm_state_index = l1_vm_state_index; if (s->l1_size < s->l1_vm_state_index) { error_setg(errp, "L1 table is too small"); ret = -EINVAL; goto fail; } ret = validate_table_offset(bs, header.l1_table_offset, header.l1_size, sizeof(uint64_t)); if (ret < 0) { error_setg(errp, "Invalid L1 table offset"); goto fail; } s->l1_table_offset = header.l1_table_offset; if (s->l1_size > 0) { s->l1_table = qemu_try_blockalign(bs->file->bs, align_offset(s->l1_size * sizeof(uint64_t), 512)); if (s->l1_table == NULL) { error_setg(errp, "Could not allocate L1 table"); ret = -ENOMEM; goto fail; } ret = bdrv_pread(bs->file, s->l1_table_offset, s->l1_table, s->l1_size * sizeof(uint64_t)); if (ret < 0) { error_setg_errno(errp, -ret, "Could not read L1 table"); goto fail; } for(i = 0;i < s->l1_size; i++) { be64_to_cpus(&s->l1_table[i]); } } ret = qcow2_update_options(bs, options, flags, errp); if (ret < 0) { goto fail; } s->cluster_cache = g_malloc(s->cluster_size); s->cluster_data = qemu_try_blockalign(bs->file->bs, QCOW_MAX_CRYPT_CLUSTERS * s->cluster_size + 512); if (s->cluster_data == NULL) { error_setg(errp, "Could not allocate temporary cluster buffer"); ret = -ENOMEM; goto fail; } s->cluster_cache_offset = -1; s->flags = flags; ret = qcow2_refcount_init(bs); if (ret != 0) { error_setg_errno(errp, -ret, "Could not initialize refcount handling"); goto fail; } QLIST_INIT(&s->cluster_allocs); QTAILQ_INIT(&s->discards); if (qcow2_read_extensions(bs, header.header_length, ext_end, NULL, &local_err)) { error_propagate(errp, local_err); ret = -EINVAL; goto fail; } if (s->crypt_method_header == QCOW_CRYPT_AES) { unsigned int cflags = 0; if (flags & BDRV_O_NO_IO) { cflags |= QCRYPTO_BLOCK_OPEN_NO_IO; } s->crypto = qcrypto_block_open(s->crypto_opts, NULL, NULL, cflags, errp); if (!s->crypto) { ret = -EINVAL; goto fail; } } if (header.backing_file_offset != 0) { len = header.backing_file_size; if (len > MIN(1023, s->cluster_size - header.backing_file_offset) || len >= sizeof(bs->backing_file)) { error_setg(errp, "Backing file name too long"); ret = -EINVAL; goto fail; } ret = bdrv_pread(bs->file, header.backing_file_offset, bs->backing_file, len); if (ret < 0) { error_setg_errno(errp, -ret, "Could not read backing file name"); goto fail; } bs->backing_file[len] = '\0'; s->image_backing_file = g_strdup(bs->backing_file); } s->snapshots_offset = header.snapshots_offset; s->nb_snapshots = header.nb_snapshots; ret = qcow2_read_snapshots(bs); if (ret < 0) { error_setg_errno(errp, -ret, "Could not read snapshots"); goto fail; } if (!bs->read_only && !(flags & BDRV_O_INACTIVE) && s->autoclear_features) { s->autoclear_features = 0; ret = qcow2_update_header(bs); if (ret < 0) { error_setg_errno(errp, -ret, "Could not update qcow2 header"); goto fail; } } qemu_co_mutex_init(&s->lock); bs->supported_zero_flags = BDRV_REQ_MAY_UNMAP; if (!(flags & (BDRV_O_CHECK | BDRV_O_INACTIVE)) && !bs->read_only && (s->incompatible_features & QCOW2_INCOMPAT_DIRTY)) { BdrvCheckResult result = {0}; ret = qcow2_check(bs, &result, BDRV_FIX_ERRORS | BDRV_FIX_LEAKS); if (ret < 0) { error_setg_errno(errp, -ret, "Could not repair dirty image"); goto fail; } } #ifdef DEBUG_ALLOC { BdrvCheckResult result = {0}; qcow2_check_refcounts(bs, &result, 0); } #endif return ret; fail: g_free(s->unknown_header_fields); cleanup_unknown_header_ext(bs); qcow2_free_snapshots(bs); qcow2_refcount_close(bs); qemu_vfree(s->l1_table); s->l1_table = NULL; cache_clean_timer_del(bs); if (s->l2_table_cache) { qcow2_cache_destroy(bs, s->l2_table_cache); } if (s->refcount_block_cache) { qcow2_cache_destroy(bs, s->refcount_block_cache); } g_free(s->cluster_cache); qemu_vfree(s->cluster_data); qcrypto_block_free(s->crypto); qapi_free_QCryptoBlockOpenOptions(s->crypto_opts); return ret; }
{ "code": [ " &feature_table, NULL);", " if (header.crypt_method > QCOW_CRYPT_AES) {", " error_setg(errp, \"Unsupported encryption method: %\" PRIu32,", " header.crypt_method);", " ret = -EINVAL;", " goto fail;", " &local_err)) {", " if (s->crypt_method_header == QCOW_CRYPT_AES) {", " unsigned int cflags = 0;", " if (flags & BDRV_O_NO_IO) {", " cflags |= QCRYPTO_BLOCK_OPEN_NO_IO;", " s->crypto = qcrypto_block_open(s->crypto_opts, NULL, NULL,", " cflags, errp);", " if (!s->crypto) {", " ret = -EINVAL;" ], "line_no": [ 231, 295, 297, 299, 65, 29, 595, 607, 609, 611, 613, 617, 619, 621, 65 ] }
static int FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1, int VAR_2, Error **VAR_3) { BDRVQcow2State *s = VAR_0->opaque; unsigned int VAR_4, VAR_5; int VAR_6 = 0; QCowHeader header; Error *local_err = NULL; uint64_t ext_end; uint64_t l1_vm_state_index; VAR_6 = bdrv_pread(VAR_0->file, 0, &header, sizeof(header)); if (VAR_6 < 0) { error_setg_errno(VAR_3, -VAR_6, "Could not read qcow2 header"); goto fail; } be32_to_cpus(&header.magic); be32_to_cpus(&header.version); be64_to_cpus(&header.backing_file_offset); be32_to_cpus(&header.backing_file_size); be64_to_cpus(&header.size); be32_to_cpus(&header.cluster_bits); be32_to_cpus(&header.crypt_method); be64_to_cpus(&header.l1_table_offset); be32_to_cpus(&header.l1_size); be64_to_cpus(&header.refcount_table_offset); be32_to_cpus(&header.refcount_table_clusters); be64_to_cpus(&header.snapshots_offset); be32_to_cpus(&header.nb_snapshots); if (header.magic != QCOW_MAGIC) { error_setg(VAR_3, "Image is not in qcow2 format"); VAR_6 = -EINVAL; goto fail; } if (header.version < 2 || header.version > 3) { error_setg(VAR_3, "Unsupported qcow2 version %" PRIu32, header.version); VAR_6 = -ENOTSUP; goto fail; } s->qcow_version = header.version; if (header.cluster_bits < MIN_CLUSTER_BITS || header.cluster_bits > MAX_CLUSTER_BITS) { error_setg(VAR_3, "Unsupported cluster size: 2^%" PRIu32, header.cluster_bits); VAR_6 = -EINVAL; goto fail; } s->cluster_bits = header.cluster_bits; s->cluster_size = 1 << s->cluster_bits; s->cluster_sectors = 1 << (s->cluster_bits - 9); if (header.version == 2) { header.incompatible_features = 0; header.compatible_features = 0; header.autoclear_features = 0; header.refcount_order = 4; header.header_length = 72; } else { be64_to_cpus(&header.incompatible_features); be64_to_cpus(&header.compatible_features); be64_to_cpus(&header.autoclear_features); be32_to_cpus(&header.refcount_order); be32_to_cpus(&header.header_length); if (header.header_length < 104) { error_setg(VAR_3, "qcow2 header too short"); VAR_6 = -EINVAL; goto fail; } } if (header.header_length > s->cluster_size) { error_setg(VAR_3, "qcow2 header exceeds cluster size"); VAR_6 = -EINVAL; goto fail; } if (header.header_length > sizeof(header)) { s->unknown_header_fields_size = header.header_length - sizeof(header); s->unknown_header_fields = g_malloc(s->unknown_header_fields_size); VAR_6 = bdrv_pread(VAR_0->file, sizeof(header), s->unknown_header_fields, s->unknown_header_fields_size); if (VAR_6 < 0) { error_setg_errno(VAR_3, -VAR_6, "Could not read unknown qcow2 header " "fields"); goto fail; } } if (header.backing_file_offset > s->cluster_size) { error_setg(VAR_3, "Invalid backing file offset"); VAR_6 = -EINVAL; goto fail; } if (header.backing_file_offset) { ext_end = header.backing_file_offset; } else { ext_end = 1 << header.cluster_bits; } s->incompatible_features = header.incompatible_features; s->compatible_features = header.compatible_features; s->autoclear_features = header.autoclear_features; if (s->incompatible_features & ~QCOW2_INCOMPAT_MASK) { void *VAR_7 = NULL; qcow2_read_extensions(VAR_0, header.header_length, ext_end, &VAR_7, NULL); report_unsupported_feature(VAR_3, VAR_7, s->incompatible_features & ~QCOW2_INCOMPAT_MASK); VAR_6 = -ENOTSUP; g_free(VAR_7); goto fail; } if (s->incompatible_features & QCOW2_INCOMPAT_CORRUPT) { if ((VAR_2 & BDRV_O_RDWR) && !(VAR_2 & BDRV_O_CHECK)) { error_setg(VAR_3, "qcow2: Image is corrupt; cannot be opened " "read/write"); VAR_6 = -EACCES; goto fail; } } if (header.refcount_order > 6) { error_setg(VAR_3, "Reference count entry width too large; may not " "exceed 64 bits"); VAR_6 = -EINVAL; goto fail; } s->refcount_order = header.refcount_order; s->refcount_bits = 1 << s->refcount_order; s->refcount_max = UINT64_C(1) << (s->refcount_bits - 1); s->refcount_max += s->refcount_max - 1; if (header.crypt_method > QCOW_CRYPT_AES) { error_setg(VAR_3, "Unsupported encryption method: %" PRIu32, header.crypt_method); VAR_6 = -EINVAL; goto fail; } s->crypt_method_header = header.crypt_method; if (s->crypt_method_header) { if (bdrv_uses_whitelist() && s->crypt_method_header == QCOW_CRYPT_AES) { error_setg(VAR_3, "Use of AES-CBC encrypted qcow2 images is no longer " "supported in system emulators"); error_append_hint(VAR_3, "You can use 'qemu-img convert' to convert your " "image to an alternative supported format, such " "as unencrypted qcow2, or raw with the LUKS " "format instead.\n"); VAR_6 = -ENOSYS; goto fail; } VAR_0->encrypted = true; VAR_0->valid_key = true; } s->l2_bits = s->cluster_bits - 3; s->l2_size = 1 << s->l2_bits; s->refcount_block_bits = s->cluster_bits - (s->refcount_order - 3); s->refcount_block_size = 1 << s->refcount_block_bits; VAR_0->total_sectors = header.size / 512; s->csize_shift = (62 - (s->cluster_bits - 8)); s->csize_mask = (1 << (s->cluster_bits - 8)) - 1; s->cluster_offset_mask = (1LL << s->csize_shift) - 1; s->refcount_table_offset = header.refcount_table_offset; s->refcount_table_size = header.refcount_table_clusters << (s->cluster_bits - 3); if (header.refcount_table_clusters > qcow2_max_refcount_clusters(s)) { error_setg(VAR_3, "Reference count table too large"); VAR_6 = -EINVAL; goto fail; } VAR_6 = validate_table_offset(VAR_0, s->refcount_table_offset, s->refcount_table_size, sizeof(uint64_t)); if (VAR_6 < 0) { error_setg(VAR_3, "Invalid reference count table offset"); goto fail; } if (header.nb_snapshots > QCOW_MAX_SNAPSHOTS) { error_setg(VAR_3, "Too many snapshots"); VAR_6 = -EINVAL; goto fail; } VAR_6 = validate_table_offset(VAR_0, header.snapshots_offset, header.nb_snapshots, sizeof(QCowSnapshotHeader)); if (VAR_6 < 0) { error_setg(VAR_3, "Invalid snapshot table offset"); goto fail; } if (header.l1_size > QCOW_MAX_L1_SIZE / sizeof(uint64_t)) { error_setg(VAR_3, "Active L1 table too large"); VAR_6 = -EFBIG; goto fail; } s->l1_size = header.l1_size; l1_vm_state_index = size_to_l1(s, header.size); if (l1_vm_state_index > INT_MAX) { error_setg(VAR_3, "Image is too big"); VAR_6 = -EFBIG; goto fail; } s->l1_vm_state_index = l1_vm_state_index; if (s->l1_size < s->l1_vm_state_index) { error_setg(VAR_3, "L1 table is too small"); VAR_6 = -EINVAL; goto fail; } VAR_6 = validate_table_offset(VAR_0, header.l1_table_offset, header.l1_size, sizeof(uint64_t)); if (VAR_6 < 0) { error_setg(VAR_3, "Invalid L1 table offset"); goto fail; } s->l1_table_offset = header.l1_table_offset; if (s->l1_size > 0) { s->l1_table = qemu_try_blockalign(VAR_0->file->VAR_0, align_offset(s->l1_size * sizeof(uint64_t), 512)); if (s->l1_table == NULL) { error_setg(VAR_3, "Could not allocate L1 table"); VAR_6 = -ENOMEM; goto fail; } VAR_6 = bdrv_pread(VAR_0->file, s->l1_table_offset, s->l1_table, s->l1_size * sizeof(uint64_t)); if (VAR_6 < 0) { error_setg_errno(VAR_3, -VAR_6, "Could not read L1 table"); goto fail; } for(VAR_5 = 0;VAR_5 < s->l1_size; VAR_5++) { be64_to_cpus(&s->l1_table[VAR_5]); } } VAR_6 = qcow2_update_options(VAR_0, VAR_1, VAR_2, VAR_3); if (VAR_6 < 0) { goto fail; } s->cluster_cache = g_malloc(s->cluster_size); s->cluster_data = qemu_try_blockalign(VAR_0->file->VAR_0, QCOW_MAX_CRYPT_CLUSTERS * s->cluster_size + 512); if (s->cluster_data == NULL) { error_setg(VAR_3, "Could not allocate temporary cluster buffer"); VAR_6 = -ENOMEM; goto fail; } s->cluster_cache_offset = -1; s->VAR_2 = VAR_2; VAR_6 = qcow2_refcount_init(VAR_0); if (VAR_6 != 0) { error_setg_errno(VAR_3, -VAR_6, "Could not initialize refcount handling"); goto fail; } QLIST_INIT(&s->cluster_allocs); QTAILQ_INIT(&s->discards); if (qcow2_read_extensions(VAR_0, header.header_length, ext_end, NULL, &local_err)) { error_propagate(VAR_3, local_err); VAR_6 = -EINVAL; goto fail; } if (s->crypt_method_header == QCOW_CRYPT_AES) { unsigned int VAR_8 = 0; if (VAR_2 & BDRV_O_NO_IO) { VAR_8 |= QCRYPTO_BLOCK_OPEN_NO_IO; } s->crypto = qcrypto_block_open(s->crypto_opts, NULL, NULL, VAR_8, VAR_3); if (!s->crypto) { VAR_6 = -EINVAL; goto fail; } } if (header.backing_file_offset != 0) { VAR_4 = header.backing_file_size; if (VAR_4 > MIN(1023, s->cluster_size - header.backing_file_offset) || VAR_4 >= sizeof(VAR_0->backing_file)) { error_setg(VAR_3, "Backing file name too long"); VAR_6 = -EINVAL; goto fail; } VAR_6 = bdrv_pread(VAR_0->file, header.backing_file_offset, VAR_0->backing_file, VAR_4); if (VAR_6 < 0) { error_setg_errno(VAR_3, -VAR_6, "Could not read backing file name"); goto fail; } VAR_0->backing_file[VAR_4] = '\0'; s->image_backing_file = g_strdup(VAR_0->backing_file); } s->snapshots_offset = header.snapshots_offset; s->nb_snapshots = header.nb_snapshots; VAR_6 = qcow2_read_snapshots(VAR_0); if (VAR_6 < 0) { error_setg_errno(VAR_3, -VAR_6, "Could not read snapshots"); goto fail; } if (!VAR_0->read_only && !(VAR_2 & BDRV_O_INACTIVE) && s->autoclear_features) { s->autoclear_features = 0; VAR_6 = qcow2_update_header(VAR_0); if (VAR_6 < 0) { error_setg_errno(VAR_3, -VAR_6, "Could not update qcow2 header"); goto fail; } } qemu_co_mutex_init(&s->lock); VAR_0->supported_zero_flags = BDRV_REQ_MAY_UNMAP; if (!(VAR_2 & (BDRV_O_CHECK | BDRV_O_INACTIVE)) && !VAR_0->read_only && (s->incompatible_features & QCOW2_INCOMPAT_DIRTY)) { BdrvCheckResult result = {0}; VAR_6 = qcow2_check(VAR_0, &result, BDRV_FIX_ERRORS | BDRV_FIX_LEAKS); if (VAR_6 < 0) { error_setg_errno(VAR_3, -VAR_6, "Could not repair dirty image"); goto fail; } } #ifdef DEBUG_ALLOC { BdrvCheckResult result = {0}; qcow2_check_refcounts(VAR_0, &result, 0); } #endif return VAR_6; fail: g_free(s->unknown_header_fields); cleanup_unknown_header_ext(VAR_0); qcow2_free_snapshots(VAR_0); qcow2_refcount_close(VAR_0); qemu_vfree(s->l1_table); s->l1_table = NULL; cache_clean_timer_del(VAR_0); if (s->l2_table_cache) { qcow2_cache_destroy(VAR_0, s->l2_table_cache); } if (s->refcount_block_cache) { qcow2_cache_destroy(VAR_0, s->refcount_block_cache); } g_free(s->cluster_cache); qemu_vfree(s->cluster_data); qcrypto_block_free(s->crypto); qapi_free_QCryptoBlockOpenOptions(s->crypto_opts); return VAR_6; }
[ "static int FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1, int VAR_2,\nError **VAR_3)\n{", "BDRVQcow2State *s = VAR_0->opaque;", "unsigned int VAR_4, VAR_5;", "int VAR_6 = 0;", "QCowHeader header;", "Error *local_err = NULL;", "uint64_t ext_end;", "uint64_t l1_vm_state_index;", "VAR_6 = bdrv_pread(VAR_0->file, 0, &header, sizeof(header));", "if (VAR_6 < 0) {", "error_setg_errno(VAR_3, -VAR_6, \"Could not read qcow2 header\");", "goto fail;", "}", "be32_to_cpus(&header.magic);", "be32_to_cpus(&header.version);", "be64_to_cpus(&header.backing_file_offset);", "be32_to_cpus(&header.backing_file_size);", "be64_to_cpus(&header.size);", "be32_to_cpus(&header.cluster_bits);", "be32_to_cpus(&header.crypt_method);", "be64_to_cpus(&header.l1_table_offset);", "be32_to_cpus(&header.l1_size);", "be64_to_cpus(&header.refcount_table_offset);", "be32_to_cpus(&header.refcount_table_clusters);", "be64_to_cpus(&header.snapshots_offset);", "be32_to_cpus(&header.nb_snapshots);", "if (header.magic != QCOW_MAGIC) {", "error_setg(VAR_3, \"Image is not in qcow2 format\");", "VAR_6 = -EINVAL;", "goto fail;", "}", "if (header.version < 2 || header.version > 3) {", "error_setg(VAR_3, \"Unsupported qcow2 version %\" PRIu32, header.version);", "VAR_6 = -ENOTSUP;", "goto fail;", "}", "s->qcow_version = header.version;", "if (header.cluster_bits < MIN_CLUSTER_BITS ||\nheader.cluster_bits > MAX_CLUSTER_BITS) {", "error_setg(VAR_3, \"Unsupported cluster size: 2^%\" PRIu32,\nheader.cluster_bits);", "VAR_6 = -EINVAL;", "goto fail;", "}", "s->cluster_bits = header.cluster_bits;", "s->cluster_size = 1 << s->cluster_bits;", "s->cluster_sectors = 1 << (s->cluster_bits - 9);", "if (header.version == 2) {", "header.incompatible_features = 0;", "header.compatible_features = 0;", "header.autoclear_features = 0;", "header.refcount_order = 4;", "header.header_length = 72;", "} else {", "be64_to_cpus(&header.incompatible_features);", "be64_to_cpus(&header.compatible_features);", "be64_to_cpus(&header.autoclear_features);", "be32_to_cpus(&header.refcount_order);", "be32_to_cpus(&header.header_length);", "if (header.header_length < 104) {", "error_setg(VAR_3, \"qcow2 header too short\");", "VAR_6 = -EINVAL;", "goto fail;", "}", "}", "if (header.header_length > s->cluster_size) {", "error_setg(VAR_3, \"qcow2 header exceeds cluster size\");", "VAR_6 = -EINVAL;", "goto fail;", "}", "if (header.header_length > sizeof(header)) {", "s->unknown_header_fields_size = header.header_length - sizeof(header);", "s->unknown_header_fields = g_malloc(s->unknown_header_fields_size);", "VAR_6 = bdrv_pread(VAR_0->file, sizeof(header), s->unknown_header_fields,\ns->unknown_header_fields_size);", "if (VAR_6 < 0) {", "error_setg_errno(VAR_3, -VAR_6, \"Could not read unknown qcow2 header \"\n\"fields\");", "goto fail;", "}", "}", "if (header.backing_file_offset > s->cluster_size) {", "error_setg(VAR_3, \"Invalid backing file offset\");", "VAR_6 = -EINVAL;", "goto fail;", "}", "if (header.backing_file_offset) {", "ext_end = header.backing_file_offset;", "} else {", "ext_end = 1 << header.cluster_bits;", "}", "s->incompatible_features = header.incompatible_features;", "s->compatible_features = header.compatible_features;", "s->autoclear_features = header.autoclear_features;", "if (s->incompatible_features & ~QCOW2_INCOMPAT_MASK) {", "void *VAR_7 = NULL;", "qcow2_read_extensions(VAR_0, header.header_length, ext_end,\n&VAR_7, NULL);", "report_unsupported_feature(VAR_3, VAR_7,\ns->incompatible_features &\n~QCOW2_INCOMPAT_MASK);", "VAR_6 = -ENOTSUP;", "g_free(VAR_7);", "goto fail;", "}", "if (s->incompatible_features & QCOW2_INCOMPAT_CORRUPT) {", "if ((VAR_2 & BDRV_O_RDWR) && !(VAR_2 & BDRV_O_CHECK)) {", "error_setg(VAR_3, \"qcow2: Image is corrupt; cannot be opened \"", "\"read/write\");", "VAR_6 = -EACCES;", "goto fail;", "}", "}", "if (header.refcount_order > 6) {", "error_setg(VAR_3, \"Reference count entry width too large; may not \"", "\"exceed 64 bits\");", "VAR_6 = -EINVAL;", "goto fail;", "}", "s->refcount_order = header.refcount_order;", "s->refcount_bits = 1 << s->refcount_order;", "s->refcount_max = UINT64_C(1) << (s->refcount_bits - 1);", "s->refcount_max += s->refcount_max - 1;", "if (header.crypt_method > QCOW_CRYPT_AES) {", "error_setg(VAR_3, \"Unsupported encryption method: %\" PRIu32,\nheader.crypt_method);", "VAR_6 = -EINVAL;", "goto fail;", "}", "s->crypt_method_header = header.crypt_method;", "if (s->crypt_method_header) {", "if (bdrv_uses_whitelist() &&\ns->crypt_method_header == QCOW_CRYPT_AES) {", "error_setg(VAR_3,\n\"Use of AES-CBC encrypted qcow2 images is no longer \"\n\"supported in system emulators\");", "error_append_hint(VAR_3,\n\"You can use 'qemu-img convert' to convert your \"\n\"image to an alternative supported format, such \"\n\"as unencrypted qcow2, or raw with the LUKS \"\n\"format instead.\\n\");", "VAR_6 = -ENOSYS;", "goto fail;", "}", "VAR_0->encrypted = true;", "VAR_0->valid_key = true;", "}", "s->l2_bits = s->cluster_bits - 3;", "s->l2_size = 1 << s->l2_bits;", "s->refcount_block_bits = s->cluster_bits - (s->refcount_order - 3);", "s->refcount_block_size = 1 << s->refcount_block_bits;", "VAR_0->total_sectors = header.size / 512;", "s->csize_shift = (62 - (s->cluster_bits - 8));", "s->csize_mask = (1 << (s->cluster_bits - 8)) - 1;", "s->cluster_offset_mask = (1LL << s->csize_shift) - 1;", "s->refcount_table_offset = header.refcount_table_offset;", "s->refcount_table_size =\nheader.refcount_table_clusters << (s->cluster_bits - 3);", "if (header.refcount_table_clusters > qcow2_max_refcount_clusters(s)) {", "error_setg(VAR_3, \"Reference count table too large\");", "VAR_6 = -EINVAL;", "goto fail;", "}", "VAR_6 = validate_table_offset(VAR_0, s->refcount_table_offset,\ns->refcount_table_size, sizeof(uint64_t));", "if (VAR_6 < 0) {", "error_setg(VAR_3, \"Invalid reference count table offset\");", "goto fail;", "}", "if (header.nb_snapshots > QCOW_MAX_SNAPSHOTS) {", "error_setg(VAR_3, \"Too many snapshots\");", "VAR_6 = -EINVAL;", "goto fail;", "}", "VAR_6 = validate_table_offset(VAR_0, header.snapshots_offset,\nheader.nb_snapshots,\nsizeof(QCowSnapshotHeader));", "if (VAR_6 < 0) {", "error_setg(VAR_3, \"Invalid snapshot table offset\");", "goto fail;", "}", "if (header.l1_size > QCOW_MAX_L1_SIZE / sizeof(uint64_t)) {", "error_setg(VAR_3, \"Active L1 table too large\");", "VAR_6 = -EFBIG;", "goto fail;", "}", "s->l1_size = header.l1_size;", "l1_vm_state_index = size_to_l1(s, header.size);", "if (l1_vm_state_index > INT_MAX) {", "error_setg(VAR_3, \"Image is too big\");", "VAR_6 = -EFBIG;", "goto fail;", "}", "s->l1_vm_state_index = l1_vm_state_index;", "if (s->l1_size < s->l1_vm_state_index) {", "error_setg(VAR_3, \"L1 table is too small\");", "VAR_6 = -EINVAL;", "goto fail;", "}", "VAR_6 = validate_table_offset(VAR_0, header.l1_table_offset,\nheader.l1_size, sizeof(uint64_t));", "if (VAR_6 < 0) {", "error_setg(VAR_3, \"Invalid L1 table offset\");", "goto fail;", "}", "s->l1_table_offset = header.l1_table_offset;", "if (s->l1_size > 0) {", "s->l1_table = qemu_try_blockalign(VAR_0->file->VAR_0,\nalign_offset(s->l1_size * sizeof(uint64_t), 512));", "if (s->l1_table == NULL) {", "error_setg(VAR_3, \"Could not allocate L1 table\");", "VAR_6 = -ENOMEM;", "goto fail;", "}", "VAR_6 = bdrv_pread(VAR_0->file, s->l1_table_offset, s->l1_table,\ns->l1_size * sizeof(uint64_t));", "if (VAR_6 < 0) {", "error_setg_errno(VAR_3, -VAR_6, \"Could not read L1 table\");", "goto fail;", "}", "for(VAR_5 = 0;VAR_5 < s->l1_size; VAR_5++) {", "be64_to_cpus(&s->l1_table[VAR_5]);", "}", "}", "VAR_6 = qcow2_update_options(VAR_0, VAR_1, VAR_2, VAR_3);", "if (VAR_6 < 0) {", "goto fail;", "}", "s->cluster_cache = g_malloc(s->cluster_size);", "s->cluster_data = qemu_try_blockalign(VAR_0->file->VAR_0, QCOW_MAX_CRYPT_CLUSTERS\n* s->cluster_size + 512);", "if (s->cluster_data == NULL) {", "error_setg(VAR_3, \"Could not allocate temporary cluster buffer\");", "VAR_6 = -ENOMEM;", "goto fail;", "}", "s->cluster_cache_offset = -1;", "s->VAR_2 = VAR_2;", "VAR_6 = qcow2_refcount_init(VAR_0);", "if (VAR_6 != 0) {", "error_setg_errno(VAR_3, -VAR_6, \"Could not initialize refcount handling\");", "goto fail;", "}", "QLIST_INIT(&s->cluster_allocs);", "QTAILQ_INIT(&s->discards);", "if (qcow2_read_extensions(VAR_0, header.header_length, ext_end, NULL,\n&local_err)) {", "error_propagate(VAR_3, local_err);", "VAR_6 = -EINVAL;", "goto fail;", "}", "if (s->crypt_method_header == QCOW_CRYPT_AES) {", "unsigned int VAR_8 = 0;", "if (VAR_2 & BDRV_O_NO_IO) {", "VAR_8 |= QCRYPTO_BLOCK_OPEN_NO_IO;", "}", "s->crypto = qcrypto_block_open(s->crypto_opts, NULL, NULL,\nVAR_8, VAR_3);", "if (!s->crypto) {", "VAR_6 = -EINVAL;", "goto fail;", "}", "}", "if (header.backing_file_offset != 0) {", "VAR_4 = header.backing_file_size;", "if (VAR_4 > MIN(1023, s->cluster_size - header.backing_file_offset) ||\nVAR_4 >= sizeof(VAR_0->backing_file)) {", "error_setg(VAR_3, \"Backing file name too long\");", "VAR_6 = -EINVAL;", "goto fail;", "}", "VAR_6 = bdrv_pread(VAR_0->file, header.backing_file_offset,\nVAR_0->backing_file, VAR_4);", "if (VAR_6 < 0) {", "error_setg_errno(VAR_3, -VAR_6, \"Could not read backing file name\");", "goto fail;", "}", "VAR_0->backing_file[VAR_4] = '\\0';", "s->image_backing_file = g_strdup(VAR_0->backing_file);", "}", "s->snapshots_offset = header.snapshots_offset;", "s->nb_snapshots = header.nb_snapshots;", "VAR_6 = qcow2_read_snapshots(VAR_0);", "if (VAR_6 < 0) {", "error_setg_errno(VAR_3, -VAR_6, \"Could not read snapshots\");", "goto fail;", "}", "if (!VAR_0->read_only && !(VAR_2 & BDRV_O_INACTIVE) && s->autoclear_features) {", "s->autoclear_features = 0;", "VAR_6 = qcow2_update_header(VAR_0);", "if (VAR_6 < 0) {", "error_setg_errno(VAR_3, -VAR_6, \"Could not update qcow2 header\");", "goto fail;", "}", "}", "qemu_co_mutex_init(&s->lock);", "VAR_0->supported_zero_flags = BDRV_REQ_MAY_UNMAP;", "if (!(VAR_2 & (BDRV_O_CHECK | BDRV_O_INACTIVE)) && !VAR_0->read_only &&\n(s->incompatible_features & QCOW2_INCOMPAT_DIRTY)) {", "BdrvCheckResult result = {0};", "VAR_6 = qcow2_check(VAR_0, &result, BDRV_FIX_ERRORS | BDRV_FIX_LEAKS);", "if (VAR_6 < 0) {", "error_setg_errno(VAR_3, -VAR_6, \"Could not repair dirty image\");", "goto fail;", "}", "}", "#ifdef DEBUG_ALLOC\n{", "BdrvCheckResult result = {0};", "qcow2_check_refcounts(VAR_0, &result, 0);", "}", "#endif\nreturn VAR_6;", "fail:\ng_free(s->unknown_header_fields);", "cleanup_unknown_header_ext(VAR_0);", "qcow2_free_snapshots(VAR_0);", "qcow2_refcount_close(VAR_0);", "qemu_vfree(s->l1_table);", "s->l1_table = NULL;", "cache_clean_timer_del(VAR_0);", "if (s->l2_table_cache) {", "qcow2_cache_destroy(VAR_0, s->l2_table_cache);", "}", "if (s->refcount_block_cache) {", "qcow2_cache_destroy(VAR_0, s->refcount_block_cache);", "}", "g_free(s->cluster_cache);", "qemu_vfree(s->cluster_data);", "qcrypto_block_free(s->crypto);", "qapi_free_QCryptoBlockOpenOptions(s->crypto_opts);", "return VAR_6;", "}" ]
[ 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, 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, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1, 1, 1, 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, 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 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 89, 91 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167 ], [ 169 ], [ 171 ], [ 173, 175 ], [ 177 ], [ 179, 181 ], [ 183 ], [ 185 ], [ 187 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 217 ], [ 219 ], [ 221 ], [ 225 ], [ 227 ], [ 229, 231 ], [ 233, 235, 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 249 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 295 ], [ 297, 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311, 313 ], [ 315, 317, 319 ], [ 321, 323, 325, 327, 329 ], [ 331 ], [ 333 ], [ 335 ], [ 339 ], [ 341 ], [ 343 ], [ 347 ], [ 349 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 367 ], [ 369, 371 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 387, 389 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 403 ], [ 405 ], [ 407 ], [ 409 ], [ 411 ], [ 415, 417, 419 ], [ 421 ], [ 423 ], [ 425 ], [ 427 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443 ], [ 447 ], [ 449 ], [ 451 ], [ 453 ], [ 455 ], [ 457 ], [ 459 ], [ 467 ], [ 469 ], [ 471 ], [ 473 ], [ 475 ], [ 479, 481 ], [ 483 ], [ 485 ], [ 487 ], [ 489 ], [ 491 ], [ 497 ], [ 499, 501 ], [ 503 ], [ 505 ], [ 507 ], [ 509 ], [ 511 ], [ 513, 515 ], [ 517 ], [ 519 ], [ 521 ], [ 523 ], [ 525 ], [ 527 ], [ 529 ], [ 531 ], [ 537 ], [ 539 ], [ 541 ], [ 543 ], [ 547 ], [ 551, 553 ], [ 555 ], [ 557 ], [ 559 ], [ 561 ], [ 563 ], [ 567 ], [ 569 ], [ 573 ], [ 575 ], [ 577 ], [ 579 ], [ 581 ], [ 585 ], [ 587 ], [ 593, 595 ], [ 597 ], [ 599 ], [ 601 ], [ 603 ], [ 607 ], [ 609 ], [ 611 ], [ 613 ], [ 615 ], [ 617, 619 ], [ 621 ], [ 623 ], [ 625 ], [ 627 ], [ 629 ], [ 635 ], [ 637 ], [ 639, 641 ], [ 643 ], [ 645 ], [ 647 ], [ 649 ], [ 651, 653 ], [ 655 ], [ 657 ], [ 659 ], [ 661 ], [ 663 ], [ 665 ], [ 667 ], [ 673 ], [ 675 ], [ 679 ], [ 681 ], [ 683 ], [ 685 ], [ 687 ], [ 693 ], [ 695 ], [ 697 ], [ 699 ], [ 701 ], [ 703 ], [ 705 ], [ 707 ], [ 713 ], [ 715 ], [ 721, 723 ], [ 725 ], [ 729 ], [ 731 ], [ 733 ], [ 735 ], [ 737 ], [ 739 ], [ 743, 745 ], [ 747 ], [ 749 ], [ 751 ], [ 753, 755 ], [ 759, 761 ], [ 763 ], [ 765 ], [ 767 ], [ 769 ], [ 773 ], [ 775 ], [ 777 ], [ 779 ], [ 781 ], [ 783 ], [ 785 ], [ 787 ], [ 789 ], [ 791 ], [ 793 ], [ 795 ], [ 797 ], [ 799 ] ]
21,810
static void *qemu_tcg_cpu_thread_fn(void *arg) { CPUState *cpu = arg; rcu_register_thread(); qemu_mutex_lock_iothread(); qemu_thread_get_self(cpu->thread); CPU_FOREACH(cpu) { cpu->thread_id = qemu_get_thread_id(); cpu->created = true; cpu->can_do_io = 1; } qemu_cond_signal(&qemu_cpu_cond); /* wait for initial kick-off after machine start */ while (first_cpu->stopped) { qemu_cond_wait(first_cpu->halt_cond, &qemu_global_mutex); /* process any pending work */ CPU_FOREACH(cpu) { qemu_wait_io_event_common(cpu); } } start_tcg_kick_timer(); cpu = first_cpu; /* process any pending work */ cpu->exit_request = 1; while (1) { /* Account partial waits to QEMU_CLOCK_VIRTUAL. */ qemu_account_warp_timer(); if (!cpu) { cpu = first_cpu; } while (cpu && !cpu->queued_work_first && !cpu->exit_request) { atomic_mb_set(&tcg_current_rr_cpu, cpu); qemu_clock_enable(QEMU_CLOCK_VIRTUAL, (cpu->singlestep_enabled & SSTEP_NOTIMER) == 0); if (cpu_can_run(cpu)) { int r; r = tcg_cpu_exec(cpu); if (r == EXCP_DEBUG) { cpu_handle_guest_debug(cpu); break; } } else if (cpu->stop || cpu->stopped) { if (cpu->unplug) { cpu = CPU_NEXT(cpu); } break; } cpu = CPU_NEXT(cpu); } /* while (cpu && !cpu->exit_request).. */ /* Does not need atomic_mb_set because a spurious wakeup is okay. */ atomic_set(&tcg_current_rr_cpu, NULL); if (cpu && cpu->exit_request) { atomic_mb_set(&cpu->exit_request, 0); } handle_icount_deadline(); qemu_tcg_wait_io_event(QTAILQ_FIRST(&cpus)); deal_with_unplugged_cpus(); } return NULL; }
true
qemu
372579427a5040a26dfee78464b50e2bdf27ef26
static void *qemu_tcg_cpu_thread_fn(void *arg) { CPUState *cpu = arg; rcu_register_thread(); qemu_mutex_lock_iothread(); qemu_thread_get_self(cpu->thread); CPU_FOREACH(cpu) { cpu->thread_id = qemu_get_thread_id(); cpu->created = true; cpu->can_do_io = 1; } qemu_cond_signal(&qemu_cpu_cond); while (first_cpu->stopped) { qemu_cond_wait(first_cpu->halt_cond, &qemu_global_mutex); CPU_FOREACH(cpu) { qemu_wait_io_event_common(cpu); } } start_tcg_kick_timer(); cpu = first_cpu; cpu->exit_request = 1; while (1) { qemu_account_warp_timer(); if (!cpu) { cpu = first_cpu; } while (cpu && !cpu->queued_work_first && !cpu->exit_request) { atomic_mb_set(&tcg_current_rr_cpu, cpu); qemu_clock_enable(QEMU_CLOCK_VIRTUAL, (cpu->singlestep_enabled & SSTEP_NOTIMER) == 0); if (cpu_can_run(cpu)) { int r; r = tcg_cpu_exec(cpu); if (r == EXCP_DEBUG) { cpu_handle_guest_debug(cpu); break; } } else if (cpu->stop || cpu->stopped) { if (cpu->unplug) { cpu = CPU_NEXT(cpu); } break; } cpu = CPU_NEXT(cpu); } atomic_set(&tcg_current_rr_cpu, NULL); if (cpu && cpu->exit_request) { atomic_mb_set(&cpu->exit_request, 0); } handle_icount_deadline(); qemu_tcg_wait_io_event(QTAILQ_FIRST(&cpus)); deal_with_unplugged_cpus(); } return NULL; }
{ "code": [ " CPU_FOREACH(cpu) {", "static void *qemu_tcg_cpu_thread_fn(void *arg)", " } else if (cpu->stop || cpu->stopped) {", " qemu_tcg_wait_io_event(QTAILQ_FIRST(&cpus));" ], "line_no": [ 19, 1, 111, 149 ] }
static void *FUNC_0(void *VAR_0) { CPUState *cpu = VAR_0; rcu_register_thread(); qemu_mutex_lock_iothread(); qemu_thread_get_self(cpu->thread); CPU_FOREACH(cpu) { cpu->thread_id = qemu_get_thread_id(); cpu->created = true; cpu->can_do_io = 1; } qemu_cond_signal(&qemu_cpu_cond); while (first_cpu->stopped) { qemu_cond_wait(first_cpu->halt_cond, &qemu_global_mutex); CPU_FOREACH(cpu) { qemu_wait_io_event_common(cpu); } } start_tcg_kick_timer(); cpu = first_cpu; cpu->exit_request = 1; while (1) { qemu_account_warp_timer(); if (!cpu) { cpu = first_cpu; } while (cpu && !cpu->queued_work_first && !cpu->exit_request) { atomic_mb_set(&tcg_current_rr_cpu, cpu); qemu_clock_enable(QEMU_CLOCK_VIRTUAL, (cpu->singlestep_enabled & SSTEP_NOTIMER) == 0); if (cpu_can_run(cpu)) { int VAR_1; VAR_1 = tcg_cpu_exec(cpu); if (VAR_1 == EXCP_DEBUG) { cpu_handle_guest_debug(cpu); break; } } else if (cpu->stop || cpu->stopped) { if (cpu->unplug) { cpu = CPU_NEXT(cpu); } break; } cpu = CPU_NEXT(cpu); } atomic_set(&tcg_current_rr_cpu, NULL); if (cpu && cpu->exit_request) { atomic_mb_set(&cpu->exit_request, 0); } handle_icount_deadline(); qemu_tcg_wait_io_event(QTAILQ_FIRST(&cpus)); deal_with_unplugged_cpus(); } return NULL; }
[ "static void *FUNC_0(void *VAR_0)\n{", "CPUState *cpu = VAR_0;", "rcu_register_thread();", "qemu_mutex_lock_iothread();", "qemu_thread_get_self(cpu->thread);", "CPU_FOREACH(cpu) {", "cpu->thread_id = qemu_get_thread_id();", "cpu->created = true;", "cpu->can_do_io = 1;", "}", "qemu_cond_signal(&qemu_cpu_cond);", "while (first_cpu->stopped) {", "qemu_cond_wait(first_cpu->halt_cond, &qemu_global_mutex);", "CPU_FOREACH(cpu) {", "qemu_wait_io_event_common(cpu);", "}", "}", "start_tcg_kick_timer();", "cpu = first_cpu;", "cpu->exit_request = 1;", "while (1) {", "qemu_account_warp_timer();", "if (!cpu) {", "cpu = first_cpu;", "}", "while (cpu && !cpu->queued_work_first && !cpu->exit_request) {", "atomic_mb_set(&tcg_current_rr_cpu, cpu);", "qemu_clock_enable(QEMU_CLOCK_VIRTUAL,\n(cpu->singlestep_enabled & SSTEP_NOTIMER) == 0);", "if (cpu_can_run(cpu)) {", "int VAR_1;", "VAR_1 = tcg_cpu_exec(cpu);", "if (VAR_1 == EXCP_DEBUG) {", "cpu_handle_guest_debug(cpu);", "break;", "}", "} else if (cpu->stop || cpu->stopped) {", "if (cpu->unplug) {", "cpu = CPU_NEXT(cpu);", "}", "break;", "}", "cpu = CPU_NEXT(cpu);", "}", "atomic_set(&tcg_current_rr_cpu, NULL);", "if (cpu && cpu->exit_request) {", "atomic_mb_set(&cpu->exit_request, 0);", "}", "handle_icount_deadline();", "qemu_tcg_wait_io_event(QTAILQ_FIRST(&cpus));", "deal_with_unplugged_cpus();", "}", "return NULL;", "}" ]
[ 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 35 ], [ 37 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 57 ], [ 63 ], [ 67 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 87 ], [ 91, 93 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 133 ], [ 137 ], [ 139 ], [ 141 ], [ 145 ], [ 149 ], [ 151 ], [ 153 ], [ 157 ], [ 159 ] ]
21,811
static void png_filter_row(PNGDSPContext *dsp, uint8_t *dst, int filter_type, uint8_t *src, uint8_t *last, int size, int bpp) { int i, p, r, g, b, a; switch (filter_type) { case PNG_FILTER_VALUE_NONE: memcpy(dst, src, size); break; case PNG_FILTER_VALUE_SUB: for (i = 0; i < bpp; i++) { dst[i] = src[i]; } if (bpp == 4) { p = *(int*)dst; for (; i < size; i += bpp) { int s = *(int*)(src + i); p = ((s & 0x7f7f7f7f) + (p & 0x7f7f7f7f)) ^ ((s ^ p) & 0x80808080); *(int*)(dst + i) = p; } } else { #define OP_SUB(x,s,l) x+s UNROLL_FILTER(OP_SUB); } break; case PNG_FILTER_VALUE_UP: dsp->add_bytes_l2(dst, src, last, size); break; case PNG_FILTER_VALUE_AVG: for (i = 0; i < bpp; i++) { p = (last[i] >> 1); dst[i] = p + src[i]; } #define OP_AVG(x,s,l) (((x + l) >> 1) + s) & 0xff UNROLL_FILTER(OP_AVG); break; case PNG_FILTER_VALUE_PAETH: for (i = 0; i < bpp; i++) { p = last[i]; dst[i] = p + src[i]; } if (bpp > 2 && size > 4) { // would write off the end of the array if we let it process the last pixel with bpp=3 int w = bpp == 4 ? size : size - 3; dsp->add_paeth_prediction(dst + i, src + i, last + i, w - i, bpp); i = w; } ff_add_png_paeth_prediction(dst + i, src + i, last + i, size - i, bpp); break; } }
true
FFmpeg
cb079b1b2bb1f7d0609ea7196090802a2788913a
static void png_filter_row(PNGDSPContext *dsp, uint8_t *dst, int filter_type, uint8_t *src, uint8_t *last, int size, int bpp) { int i, p, r, g, b, a; switch (filter_type) { case PNG_FILTER_VALUE_NONE: memcpy(dst, src, size); break; case PNG_FILTER_VALUE_SUB: for (i = 0; i < bpp; i++) { dst[i] = src[i]; } if (bpp == 4) { p = *(int*)dst; for (; i < size; i += bpp) { int s = *(int*)(src + i); p = ((s & 0x7f7f7f7f) + (p & 0x7f7f7f7f)) ^ ((s ^ p) & 0x80808080); *(int*)(dst + i) = p; } } else { #define OP_SUB(x,s,l) x+s UNROLL_FILTER(OP_SUB); } break; case PNG_FILTER_VALUE_UP: dsp->add_bytes_l2(dst, src, last, size); break; case PNG_FILTER_VALUE_AVG: for (i = 0; i < bpp; i++) { p = (last[i] >> 1); dst[i] = p + src[i]; } #define OP_AVG(x,s,l) (((x + l) >> 1) + s) & 0xff UNROLL_FILTER(OP_AVG); break; case PNG_FILTER_VALUE_PAETH: for (i = 0; i < bpp; i++) { p = last[i]; dst[i] = p + src[i]; } if (bpp > 2 && size > 4) { int w = bpp == 4 ? size : size - 3; dsp->add_paeth_prediction(dst + i, src + i, last + i, w - i, bpp); i = w; } ff_add_png_paeth_prediction(dst + i, src + i, last + i, size - i, bpp); break; } }
{ "code": [ " int s = *(int*)(src + i);" ], "line_no": [ 33 ] }
static void FUNC_0(PNGDSPContext *VAR_0, uint8_t *VAR_1, int VAR_2, uint8_t *VAR_3, uint8_t *VAR_4, int VAR_5, int VAR_6) { int VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12; switch (VAR_2) { case PNG_FILTER_VALUE_NONE: memcpy(VAR_1, VAR_3, VAR_5); break; case PNG_FILTER_VALUE_SUB: for (VAR_7 = 0; VAR_7 < VAR_6; VAR_7++) { VAR_1[VAR_7] = VAR_3[VAR_7]; } if (VAR_6 == 4) { VAR_8 = *(int*)VAR_1; for (; VAR_7 < VAR_5; VAR_7 += VAR_6) { int VAR_13 = *(int*)(VAR_3 + VAR_7); VAR_8 = ((VAR_13 & 0x7f7f7f7f) + (VAR_8 & 0x7f7f7f7f)) ^ ((VAR_13 ^ VAR_8) & 0x80808080); *(int*)(VAR_1 + VAR_7) = VAR_8; } } else { #define OP_SUB(x,VAR_13,l) x+VAR_13 UNROLL_FILTER(OP_SUB); } break; case PNG_FILTER_VALUE_UP: VAR_0->add_bytes_l2(VAR_1, VAR_3, VAR_4, VAR_5); break; case PNG_FILTER_VALUE_AVG: for (VAR_7 = 0; VAR_7 < VAR_6; VAR_7++) { VAR_8 = (VAR_4[VAR_7] >> 1); VAR_1[VAR_7] = VAR_8 + VAR_3[VAR_7]; } #define OP_AVG(x,VAR_13,l) (((x + l) >> 1) + VAR_13) & 0xff UNROLL_FILTER(OP_AVG); break; case PNG_FILTER_VALUE_PAETH: for (VAR_7 = 0; VAR_7 < VAR_6; VAR_7++) { VAR_8 = VAR_4[VAR_7]; VAR_1[VAR_7] = VAR_8 + VAR_3[VAR_7]; } if (VAR_6 > 2 && VAR_5 > 4) { int VAR_14 = VAR_6 == 4 ? VAR_5 : VAR_5 - 3; VAR_0->add_paeth_prediction(VAR_1 + VAR_7, VAR_3 + VAR_7, VAR_4 + VAR_7, VAR_14 - VAR_7, VAR_6); VAR_7 = VAR_14; } ff_add_png_paeth_prediction(VAR_1 + VAR_7, VAR_3 + VAR_7, VAR_4 + VAR_7, VAR_5 - VAR_7, VAR_6); break; } }
[ "static void FUNC_0(PNGDSPContext *VAR_0, uint8_t *VAR_1, int VAR_2,\nuint8_t *VAR_3, uint8_t *VAR_4, int VAR_5, int VAR_6)\n{", "int VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12;", "switch (VAR_2) {", "case PNG_FILTER_VALUE_NONE:\nmemcpy(VAR_1, VAR_3, VAR_5);", "break;", "case PNG_FILTER_VALUE_SUB:\nfor (VAR_7 = 0; VAR_7 < VAR_6; VAR_7++) {", "VAR_1[VAR_7] = VAR_3[VAR_7];", "}", "if (VAR_6 == 4) {", "VAR_8 = *(int*)VAR_1;", "for (; VAR_7 < VAR_5; VAR_7 += VAR_6) {", "int VAR_13 = *(int*)(VAR_3 + VAR_7);", "VAR_8 = ((VAR_13 & 0x7f7f7f7f) + (VAR_8 & 0x7f7f7f7f)) ^ ((VAR_13 ^ VAR_8) & 0x80808080);", "*(int*)(VAR_1 + VAR_7) = VAR_8;", "}", "} else {", "#define OP_SUB(x,VAR_13,l) x+VAR_13\nUNROLL_FILTER(OP_SUB);", "}", "break;", "case PNG_FILTER_VALUE_UP:\nVAR_0->add_bytes_l2(VAR_1, VAR_3, VAR_4, VAR_5);", "break;", "case PNG_FILTER_VALUE_AVG:\nfor (VAR_7 = 0; VAR_7 < VAR_6; VAR_7++) {", "VAR_8 = (VAR_4[VAR_7] >> 1);", "VAR_1[VAR_7] = VAR_8 + VAR_3[VAR_7];", "}", "#define OP_AVG(x,VAR_13,l) (((x + l) >> 1) + VAR_13) & 0xff\nUNROLL_FILTER(OP_AVG);", "break;", "case PNG_FILTER_VALUE_PAETH:\nfor (VAR_7 = 0; VAR_7 < VAR_6; VAR_7++) {", "VAR_8 = VAR_4[VAR_7];", "VAR_1[VAR_7] = VAR_8 + VAR_3[VAR_7];", "}", "if (VAR_6 > 2 && VAR_5 > 4) {", "int VAR_14 = VAR_6 == 4 ? VAR_5 : VAR_5 - 3;", "VAR_0->add_paeth_prediction(VAR_1 + VAR_7, VAR_3 + VAR_7, VAR_4 + VAR_7, VAR_14 - VAR_7, VAR_6);", "VAR_7 = VAR_14;", "}", "ff_add_png_paeth_prediction(VAR_1 + VAR_7, VAR_3 + VAR_7, VAR_4 + VAR_7, VAR_5 - VAR_7, VAR_6);", "break;", "}", "}" ]
[ 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 ]
[ [ 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 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ] ]
21,812
static void vp56_mc(VP56Context *s, int b, int plane, uint8_t *src, int stride, int x, int y) { uint8_t *dst = s->frames[VP56_FRAME_CURRENT]->data[plane] + s->block_offset[b]; uint8_t *src_block; int src_offset; int overlap_offset = 0; int mask = s->vp56_coord_div[b] - 1; int deblock_filtering = s->deblock_filtering; int dx; int dy; if (s->avctx->skip_loop_filter >= AVDISCARD_ALL || (s->avctx->skip_loop_filter >= AVDISCARD_NONKEY && !s->frames[VP56_FRAME_CURRENT]->key_frame)) deblock_filtering = 0; dx = s->mv[b].x / s->vp56_coord_div[b]; dy = s->mv[b].y / s->vp56_coord_div[b]; if (b >= 4) { x /= 2; y /= 2; } x += dx - 2; y += dy - 2; if (x<0 || x+12>=s->plane_width[plane] || y<0 || y+12>=s->plane_height[plane]) { s->vdsp.emulated_edge_mc(s->edge_emu_buffer, src + s->block_offset[b] + (dy-2)*stride + (dx-2), stride, 12, 12, x, y, s->plane_width[plane], s->plane_height[plane]); src_block = s->edge_emu_buffer; src_offset = 2 + 2*stride; } else if (deblock_filtering) { /* only need a 12x12 block, but there is no such dsp function, */ /* so copy a 16x12 block */ s->hdsp.put_pixels_tab[0][0](s->edge_emu_buffer, src + s->block_offset[b] + (dy-2)*stride + (dx-2), stride, 12); src_block = s->edge_emu_buffer; src_offset = 2 + 2*stride; } else { src_block = src; src_offset = s->block_offset[b] + dy*stride + dx; } if (deblock_filtering) vp56_deblock_filter(s, src_block, stride, dx&7, dy&7); if (s->mv[b].x & mask) overlap_offset += (s->mv[b].x > 0) ? 1 : -1; if (s->mv[b].y & mask) overlap_offset += (s->mv[b].y > 0) ? stride : -stride; if (overlap_offset) { if (s->filter) s->filter(s, dst, src_block, src_offset, src_offset+overlap_offset, stride, s->mv[b], mask, s->filter_selection, b<4); else s->vp3dsp.put_no_rnd_pixels_l2(dst, src_block+src_offset, src_block+src_offset+overlap_offset, stride, 8); } else { s->hdsp.put_pixels_tab[1][0](dst, src_block+src_offset, stride, 8); } }
true
FFmpeg
c341f734e5f9d6af4a8fdcceb6f5d12de6395c76
static void vp56_mc(VP56Context *s, int b, int plane, uint8_t *src, int stride, int x, int y) { uint8_t *dst = s->frames[VP56_FRAME_CURRENT]->data[plane] + s->block_offset[b]; uint8_t *src_block; int src_offset; int overlap_offset = 0; int mask = s->vp56_coord_div[b] - 1; int deblock_filtering = s->deblock_filtering; int dx; int dy; if (s->avctx->skip_loop_filter >= AVDISCARD_ALL || (s->avctx->skip_loop_filter >= AVDISCARD_NONKEY && !s->frames[VP56_FRAME_CURRENT]->key_frame)) deblock_filtering = 0; dx = s->mv[b].x / s->vp56_coord_div[b]; dy = s->mv[b].y / s->vp56_coord_div[b]; if (b >= 4) { x /= 2; y /= 2; } x += dx - 2; y += dy - 2; if (x<0 || x+12>=s->plane_width[plane] || y<0 || y+12>=s->plane_height[plane]) { s->vdsp.emulated_edge_mc(s->edge_emu_buffer, src + s->block_offset[b] + (dy-2)*stride + (dx-2), stride, 12, 12, x, y, s->plane_width[plane], s->plane_height[plane]); src_block = s->edge_emu_buffer; src_offset = 2 + 2*stride; } else if (deblock_filtering) { s->hdsp.put_pixels_tab[0][0](s->edge_emu_buffer, src + s->block_offset[b] + (dy-2)*stride + (dx-2), stride, 12); src_block = s->edge_emu_buffer; src_offset = 2 + 2*stride; } else { src_block = src; src_offset = s->block_offset[b] + dy*stride + dx; } if (deblock_filtering) vp56_deblock_filter(s, src_block, stride, dx&7, dy&7); if (s->mv[b].x & mask) overlap_offset += (s->mv[b].x > 0) ? 1 : -1; if (s->mv[b].y & mask) overlap_offset += (s->mv[b].y > 0) ? stride : -stride; if (overlap_offset) { if (s->filter) s->filter(s, dst, src_block, src_offset, src_offset+overlap_offset, stride, s->mv[b], mask, s->filter_selection, b<4); else s->vp3dsp.put_no_rnd_pixels_l2(dst, src_block+src_offset, src_block+src_offset+overlap_offset, stride, 8); } else { s->hdsp.put_pixels_tab[1][0](dst, src_block+src_offset, stride, 8); } }
{ "code": [ " int stride, int x, int y)" ], "line_no": [ 3 ] }
static void FUNC_0(VP56Context *VAR_0, int VAR_1, int VAR_2, uint8_t *VAR_3, int VAR_4, int VAR_5, int VAR_6) { uint8_t *dst = VAR_0->frames[VP56_FRAME_CURRENT]->data[VAR_2] + VAR_0->block_offset[VAR_1]; uint8_t *src_block; int VAR_7; int VAR_8 = 0; int VAR_9 = VAR_0->vp56_coord_div[VAR_1] - 1; int VAR_10 = VAR_0->VAR_10; int VAR_11; int VAR_12; if (VAR_0->avctx->skip_loop_filter >= AVDISCARD_ALL || (VAR_0->avctx->skip_loop_filter >= AVDISCARD_NONKEY && !VAR_0->frames[VP56_FRAME_CURRENT]->key_frame)) VAR_10 = 0; VAR_11 = VAR_0->mv[VAR_1].VAR_5 / VAR_0->vp56_coord_div[VAR_1]; VAR_12 = VAR_0->mv[VAR_1].VAR_6 / VAR_0->vp56_coord_div[VAR_1]; if (VAR_1 >= 4) { VAR_5 /= 2; VAR_6 /= 2; } VAR_5 += VAR_11 - 2; VAR_6 += VAR_12 - 2; if (VAR_5<0 || VAR_5+12>=VAR_0->plane_width[VAR_2] || VAR_6<0 || VAR_6+12>=VAR_0->plane_height[VAR_2]) { VAR_0->vdsp.emulated_edge_mc(VAR_0->edge_emu_buffer, VAR_3 + VAR_0->block_offset[VAR_1] + (VAR_12-2)*VAR_4 + (VAR_11-2), VAR_4, 12, 12, VAR_5, VAR_6, VAR_0->plane_width[VAR_2], VAR_0->plane_height[VAR_2]); src_block = VAR_0->edge_emu_buffer; VAR_7 = 2 + 2*VAR_4; } else if (VAR_10) { VAR_0->hdsp.put_pixels_tab[0][0](VAR_0->edge_emu_buffer, VAR_3 + VAR_0->block_offset[VAR_1] + (VAR_12-2)*VAR_4 + (VAR_11-2), VAR_4, 12); src_block = VAR_0->edge_emu_buffer; VAR_7 = 2 + 2*VAR_4; } else { src_block = VAR_3; VAR_7 = VAR_0->block_offset[VAR_1] + VAR_12*VAR_4 + VAR_11; } if (VAR_10) vp56_deblock_filter(VAR_0, src_block, VAR_4, VAR_11&7, VAR_12&7); if (VAR_0->mv[VAR_1].VAR_5 & VAR_9) VAR_8 += (VAR_0->mv[VAR_1].VAR_5 > 0) ? 1 : -1; if (VAR_0->mv[VAR_1].VAR_6 & VAR_9) VAR_8 += (VAR_0->mv[VAR_1].VAR_6 > 0) ? VAR_4 : -VAR_4; if (VAR_8) { if (VAR_0->filter) VAR_0->filter(VAR_0, dst, src_block, VAR_7, VAR_7+VAR_8, VAR_4, VAR_0->mv[VAR_1], VAR_9, VAR_0->filter_selection, VAR_1<4); else VAR_0->vp3dsp.put_no_rnd_pixels_l2(dst, src_block+VAR_7, src_block+VAR_7+VAR_8, VAR_4, 8); } else { VAR_0->hdsp.put_pixels_tab[1][0](dst, src_block+VAR_7, VAR_4, 8); } }
[ "static void FUNC_0(VP56Context *VAR_0, int VAR_1, int VAR_2, uint8_t *VAR_3,\nint VAR_4, int VAR_5, int VAR_6)\n{", "uint8_t *dst = VAR_0->frames[VP56_FRAME_CURRENT]->data[VAR_2] + VAR_0->block_offset[VAR_1];", "uint8_t *src_block;", "int VAR_7;", "int VAR_8 = 0;", "int VAR_9 = VAR_0->vp56_coord_div[VAR_1] - 1;", "int VAR_10 = VAR_0->VAR_10;", "int VAR_11;", "int VAR_12;", "if (VAR_0->avctx->skip_loop_filter >= AVDISCARD_ALL ||\n(VAR_0->avctx->skip_loop_filter >= AVDISCARD_NONKEY\n&& !VAR_0->frames[VP56_FRAME_CURRENT]->key_frame))\nVAR_10 = 0;", "VAR_11 = VAR_0->mv[VAR_1].VAR_5 / VAR_0->vp56_coord_div[VAR_1];", "VAR_12 = VAR_0->mv[VAR_1].VAR_6 / VAR_0->vp56_coord_div[VAR_1];", "if (VAR_1 >= 4) {", "VAR_5 /= 2;", "VAR_6 /= 2;", "}", "VAR_5 += VAR_11 - 2;", "VAR_6 += VAR_12 - 2;", "if (VAR_5<0 || VAR_5+12>=VAR_0->plane_width[VAR_2] ||\nVAR_6<0 || VAR_6+12>=VAR_0->plane_height[VAR_2]) {", "VAR_0->vdsp.emulated_edge_mc(VAR_0->edge_emu_buffer,\nVAR_3 + VAR_0->block_offset[VAR_1] + (VAR_12-2)*VAR_4 + (VAR_11-2),\nVAR_4, 12, 12, VAR_5, VAR_6,\nVAR_0->plane_width[VAR_2],\nVAR_0->plane_height[VAR_2]);", "src_block = VAR_0->edge_emu_buffer;", "VAR_7 = 2 + 2*VAR_4;", "} else if (VAR_10) {", "VAR_0->hdsp.put_pixels_tab[0][0](VAR_0->edge_emu_buffer,\nVAR_3 + VAR_0->block_offset[VAR_1] + (VAR_12-2)*VAR_4 + (VAR_11-2),\nVAR_4, 12);", "src_block = VAR_0->edge_emu_buffer;", "VAR_7 = 2 + 2*VAR_4;", "} else {", "src_block = VAR_3;", "VAR_7 = VAR_0->block_offset[VAR_1] + VAR_12*VAR_4 + VAR_11;", "}", "if (VAR_10)\nvp56_deblock_filter(VAR_0, src_block, VAR_4, VAR_11&7, VAR_12&7);", "if (VAR_0->mv[VAR_1].VAR_5 & VAR_9)\nVAR_8 += (VAR_0->mv[VAR_1].VAR_5 > 0) ? 1 : -1;", "if (VAR_0->mv[VAR_1].VAR_6 & VAR_9)\nVAR_8 += (VAR_0->mv[VAR_1].VAR_6 > 0) ? VAR_4 : -VAR_4;", "if (VAR_8) {", "if (VAR_0->filter)\nVAR_0->filter(VAR_0, dst, src_block, VAR_7, VAR_7+VAR_8,\nVAR_4, VAR_0->mv[VAR_1], VAR_9, VAR_0->filter_selection, VAR_1<4);", "else\nVAR_0->vp3dsp.put_no_rnd_pixels_l2(dst, src_block+VAR_7,\nsrc_block+VAR_7+VAR_8,\nVAR_4, 8);", "} else {", "VAR_0->hdsp.put_pixels_tab[1][0](dst, src_block+VAR_7, VAR_4, 8);", "}", "}" ]
[ 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 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25, 27, 29, 31 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55, 57 ], [ 59, 61, 63, 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 79, 81, 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99, 101 ], [ 105, 107 ], [ 109, 111 ], [ 115 ], [ 117, 119, 121 ], [ 123, 125, 127, 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ] ]
21,813
static int elf_core_dump(int signr, const CPUArchState *env) { const CPUState *cpu = ENV_GET_CPU((CPUArchState *)env); const TaskState *ts = (const TaskState *)cpu->opaque; struct vm_area_struct *vma = NULL; char corefile[PATH_MAX]; struct elf_note_info info; struct elfhdr elf; struct elf_phdr phdr; struct rlimit dumpsize; struct mm_struct *mm = NULL; off_t offset = 0, data_offset = 0; int segs = 0; int fd = -1; init_note_info(&info); errno = 0; getrlimit(RLIMIT_CORE, &dumpsize); if (dumpsize.rlim_cur == 0) return 0; if (core_dump_filename(ts, corefile, sizeof (corefile)) < 0) return (-errno); if ((fd = open(corefile, O_WRONLY | O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) < 0) return (-errno); /* * Walk through target process memory mappings and * set up structure containing this information. After * this point vma_xxx functions can be used. */ if ((mm = vma_init()) == NULL) goto out; walk_memory_regions(mm, vma_walker); segs = vma_get_mapping_count(mm); /* * Construct valid coredump ELF header. We also * add one more segment for notes. */ fill_elf_header(&elf, segs + 1, ELF_MACHINE, 0); if (dump_write(fd, &elf, sizeof (elf)) != 0) goto out; /* fill in the in-memory version of notes */ if (fill_note_info(&info, signr, env) < 0) goto out; offset += sizeof (elf); /* elf header */ offset += (segs + 1) * sizeof (struct elf_phdr); /* program headers */ /* write out notes program header */ fill_elf_note_phdr(&phdr, info.notes_size, offset); offset += info.notes_size; if (dump_write(fd, &phdr, sizeof (phdr)) != 0) goto out; /* * ELF specification wants data to start at page boundary so * we align it here. */ data_offset = offset = roundup(offset, ELF_EXEC_PAGESIZE); /* * Write program headers for memory regions mapped in * the target process. */ for (vma = vma_first(mm); vma != NULL; vma = vma_next(vma)) { (void) memset(&phdr, 0, sizeof (phdr)); phdr.p_type = PT_LOAD; phdr.p_offset = offset; phdr.p_vaddr = vma->vma_start; phdr.p_paddr = 0; phdr.p_filesz = vma_dump_size(vma); offset += phdr.p_filesz; phdr.p_memsz = vma->vma_end - vma->vma_start; phdr.p_flags = vma->vma_flags & PROT_READ ? PF_R : 0; if (vma->vma_flags & PROT_WRITE) phdr.p_flags |= PF_W; if (vma->vma_flags & PROT_EXEC) phdr.p_flags |= PF_X; phdr.p_align = ELF_EXEC_PAGESIZE; bswap_phdr(&phdr, 1); dump_write(fd, &phdr, sizeof (phdr)); } /* * Next we write notes just after program headers. No * alignment needed here. */ if (write_note_info(&info, fd) < 0) goto out; /* align data to page boundary */ if (lseek(fd, data_offset, SEEK_SET) != data_offset) goto out; /* * Finally we can dump process memory into corefile as well. */ for (vma = vma_first(mm); vma != NULL; vma = vma_next(vma)) { abi_ulong addr; abi_ulong end; end = vma->vma_start + vma_dump_size(vma); for (addr = vma->vma_start; addr < end; addr += TARGET_PAGE_SIZE) { char page[TARGET_PAGE_SIZE]; int error; /* * Read in page from target process memory and * write it to coredump file. */ error = copy_from_user(page, addr, sizeof (page)); if (error != 0) { (void) fprintf(stderr, "unable to dump " TARGET_ABI_FMT_lx "\n", addr); errno = -error; goto out; } if (dump_write(fd, page, TARGET_PAGE_SIZE) < 0) goto out; } } out: free_note_info(&info); if (mm != NULL) vma_delete(mm); (void) close(fd); if (errno != 0) return (-errno); return (0); }
true
qemu
772034b63e9c0caf6c92e31413f2d8df2ee69c88
static int elf_core_dump(int signr, const CPUArchState *env) { const CPUState *cpu = ENV_GET_CPU((CPUArchState *)env); const TaskState *ts = (const TaskState *)cpu->opaque; struct vm_area_struct *vma = NULL; char corefile[PATH_MAX]; struct elf_note_info info; struct elfhdr elf; struct elf_phdr phdr; struct rlimit dumpsize; struct mm_struct *mm = NULL; off_t offset = 0, data_offset = 0; int segs = 0; int fd = -1; init_note_info(&info); errno = 0; getrlimit(RLIMIT_CORE, &dumpsize); if (dumpsize.rlim_cur == 0) return 0; if (core_dump_filename(ts, corefile, sizeof (corefile)) < 0) return (-errno); if ((fd = open(corefile, O_WRONLY | O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) < 0) return (-errno); if ((mm = vma_init()) == NULL) goto out; walk_memory_regions(mm, vma_walker); segs = vma_get_mapping_count(mm); fill_elf_header(&elf, segs + 1, ELF_MACHINE, 0); if (dump_write(fd, &elf, sizeof (elf)) != 0) goto out; if (fill_note_info(&info, signr, env) < 0) goto out; offset += sizeof (elf); offset += (segs + 1) * sizeof (struct elf_phdr); fill_elf_note_phdr(&phdr, info.notes_size, offset); offset += info.notes_size; if (dump_write(fd, &phdr, sizeof (phdr)) != 0) goto out; data_offset = offset = roundup(offset, ELF_EXEC_PAGESIZE); for (vma = vma_first(mm); vma != NULL; vma = vma_next(vma)) { (void) memset(&phdr, 0, sizeof (phdr)); phdr.p_type = PT_LOAD; phdr.p_offset = offset; phdr.p_vaddr = vma->vma_start; phdr.p_paddr = 0; phdr.p_filesz = vma_dump_size(vma); offset += phdr.p_filesz; phdr.p_memsz = vma->vma_end - vma->vma_start; phdr.p_flags = vma->vma_flags & PROT_READ ? PF_R : 0; if (vma->vma_flags & PROT_WRITE) phdr.p_flags |= PF_W; if (vma->vma_flags & PROT_EXEC) phdr.p_flags |= PF_X; phdr.p_align = ELF_EXEC_PAGESIZE; bswap_phdr(&phdr, 1); dump_write(fd, &phdr, sizeof (phdr)); } if (write_note_info(&info, fd) < 0) goto out; if (lseek(fd, data_offset, SEEK_SET) != data_offset) goto out; for (vma = vma_first(mm); vma != NULL; vma = vma_next(vma)) { abi_ulong addr; abi_ulong end; end = vma->vma_start + vma_dump_size(vma); for (addr = vma->vma_start; addr < end; addr += TARGET_PAGE_SIZE) { char page[TARGET_PAGE_SIZE]; int error; error = copy_from_user(page, addr, sizeof (page)); if (error != 0) { (void) fprintf(stderr, "unable to dump " TARGET_ABI_FMT_lx "\n", addr); errno = -error; goto out; } if (dump_write(fd, page, TARGET_PAGE_SIZE) < 0) goto out; } } out: free_note_info(&info); if (mm != NULL) vma_delete(mm); (void) close(fd); if (errno != 0) return (-errno); return (0); }
{ "code": [ " dump_write(fd, &phdr, sizeof (phdr));" ], "line_no": [ 181 ] }
static int FUNC_0(int VAR_0, const CPUArchState *VAR_1) { const CPUState *VAR_2 = ENV_GET_CPU((CPUArchState *)VAR_1); const TaskState *VAR_3 = (const TaskState *)VAR_2->opaque; struct vm_area_struct *VAR_4 = NULL; char VAR_5[PATH_MAX]; struct elf_note_info VAR_6; struct elfhdr VAR_7; struct elf_phdr VAR_8; struct rlimit VAR_9; struct mm_struct *VAR_10 = NULL; off_t offset = 0, data_offset = 0; int VAR_11 = 0; int VAR_12 = -1; init_note_info(&VAR_6); errno = 0; getrlimit(RLIMIT_CORE, &VAR_9); if (VAR_9.rlim_cur == 0) return 0; if (core_dump_filename(VAR_3, VAR_5, sizeof (VAR_5)) < 0) return (-errno); if ((VAR_12 = open(VAR_5, O_WRONLY | O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) < 0) return (-errno); if ((VAR_10 = vma_init()) == NULL) goto out; walk_memory_regions(VAR_10, vma_walker); VAR_11 = vma_get_mapping_count(VAR_10); fill_elf_header(&VAR_7, VAR_11 + 1, ELF_MACHINE, 0); if (dump_write(VAR_12, &VAR_7, sizeof (VAR_7)) != 0) goto out; if (fill_note_info(&VAR_6, VAR_0, VAR_1) < 0) goto out; offset += sizeof (VAR_7); offset += (VAR_11 + 1) * sizeof (struct elf_phdr); fill_elf_note_phdr(&VAR_8, VAR_6.notes_size, offset); offset += VAR_6.notes_size; if (dump_write(VAR_12, &VAR_8, sizeof (VAR_8)) != 0) goto out; data_offset = offset = roundup(offset, ELF_EXEC_PAGESIZE); for (VAR_4 = vma_first(VAR_10); VAR_4 != NULL; VAR_4 = vma_next(VAR_4)) { (void) memset(&VAR_8, 0, sizeof (VAR_8)); VAR_8.p_type = PT_LOAD; VAR_8.p_offset = offset; VAR_8.p_vaddr = VAR_4->vma_start; VAR_8.p_paddr = 0; VAR_8.p_filesz = vma_dump_size(VAR_4); offset += VAR_8.p_filesz; VAR_8.p_memsz = VAR_4->vma_end - VAR_4->vma_start; VAR_8.p_flags = VAR_4->vma_flags & PROT_READ ? PF_R : 0; if (VAR_4->vma_flags & PROT_WRITE) VAR_8.p_flags |= PF_W; if (VAR_4->vma_flags & PROT_EXEC) VAR_8.p_flags |= PF_X; VAR_8.p_align = ELF_EXEC_PAGESIZE; bswap_phdr(&VAR_8, 1); dump_write(VAR_12, &VAR_8, sizeof (VAR_8)); } if (write_note_info(&VAR_6, VAR_12) < 0) goto out; if (lseek(VAR_12, data_offset, SEEK_SET) != data_offset) goto out; for (VAR_4 = vma_first(VAR_10); VAR_4 != NULL; VAR_4 = vma_next(VAR_4)) { abi_ulong addr; abi_ulong end; end = VAR_4->vma_start + vma_dump_size(VAR_4); for (addr = VAR_4->vma_start; addr < end; addr += TARGET_PAGE_SIZE) { char page[TARGET_PAGE_SIZE]; int error; error = copy_from_user(page, addr, sizeof (page)); if (error != 0) { (void) fprintf(stderr, "unable to dump " TARGET_ABI_FMT_lx "\n", addr); errno = -error; goto out; } if (dump_write(VAR_12, page, TARGET_PAGE_SIZE) < 0) goto out; } } out: free_note_info(&VAR_6); if (VAR_10 != NULL) vma_delete(VAR_10); (void) close(VAR_12); if (errno != 0) return (-errno); return (0); }
[ "static int FUNC_0(int VAR_0, const CPUArchState *VAR_1)\n{", "const CPUState *VAR_2 = ENV_GET_CPU((CPUArchState *)VAR_1);", "const TaskState *VAR_3 = (const TaskState *)VAR_2->opaque;", "struct vm_area_struct *VAR_4 = NULL;", "char VAR_5[PATH_MAX];", "struct elf_note_info VAR_6;", "struct elfhdr VAR_7;", "struct elf_phdr VAR_8;", "struct rlimit VAR_9;", "struct mm_struct *VAR_10 = NULL;", "off_t offset = 0, data_offset = 0;", "int VAR_11 = 0;", "int VAR_12 = -1;", "init_note_info(&VAR_6);", "errno = 0;", "getrlimit(RLIMIT_CORE, &VAR_9);", "if (VAR_9.rlim_cur == 0)\nreturn 0;", "if (core_dump_filename(VAR_3, VAR_5, sizeof (VAR_5)) < 0)\nreturn (-errno);", "if ((VAR_12 = open(VAR_5, O_WRONLY | O_CREAT,\nS_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) < 0)\nreturn (-errno);", "if ((VAR_10 = vma_init()) == NULL)\ngoto out;", "walk_memory_regions(VAR_10, vma_walker);", "VAR_11 = vma_get_mapping_count(VAR_10);", "fill_elf_header(&VAR_7, VAR_11 + 1, ELF_MACHINE, 0);", "if (dump_write(VAR_12, &VAR_7, sizeof (VAR_7)) != 0)\ngoto out;", "if (fill_note_info(&VAR_6, VAR_0, VAR_1) < 0)\ngoto out;", "offset += sizeof (VAR_7);", "offset += (VAR_11 + 1) * sizeof (struct elf_phdr);", "fill_elf_note_phdr(&VAR_8, VAR_6.notes_size, offset);", "offset += VAR_6.notes_size;", "if (dump_write(VAR_12, &VAR_8, sizeof (VAR_8)) != 0)\ngoto out;", "data_offset = offset = roundup(offset, ELF_EXEC_PAGESIZE);", "for (VAR_4 = vma_first(VAR_10); VAR_4 != NULL; VAR_4 = vma_next(VAR_4)) {", "(void) memset(&VAR_8, 0, sizeof (VAR_8));", "VAR_8.p_type = PT_LOAD;", "VAR_8.p_offset = offset;", "VAR_8.p_vaddr = VAR_4->vma_start;", "VAR_8.p_paddr = 0;", "VAR_8.p_filesz = vma_dump_size(VAR_4);", "offset += VAR_8.p_filesz;", "VAR_8.p_memsz = VAR_4->vma_end - VAR_4->vma_start;", "VAR_8.p_flags = VAR_4->vma_flags & PROT_READ ? PF_R : 0;", "if (VAR_4->vma_flags & PROT_WRITE)\nVAR_8.p_flags |= PF_W;", "if (VAR_4->vma_flags & PROT_EXEC)\nVAR_8.p_flags |= PF_X;", "VAR_8.p_align = ELF_EXEC_PAGESIZE;", "bswap_phdr(&VAR_8, 1);", "dump_write(VAR_12, &VAR_8, sizeof (VAR_8));", "}", "if (write_note_info(&VAR_6, VAR_12) < 0)\ngoto out;", "if (lseek(VAR_12, data_offset, SEEK_SET) != data_offset)\ngoto out;", "for (VAR_4 = vma_first(VAR_10); VAR_4 != NULL; VAR_4 = vma_next(VAR_4)) {", "abi_ulong addr;", "abi_ulong end;", "end = VAR_4->vma_start + vma_dump_size(VAR_4);", "for (addr = VAR_4->vma_start; addr < end;", "addr += TARGET_PAGE_SIZE) {", "char page[TARGET_PAGE_SIZE];", "int error;", "error = copy_from_user(page, addr, sizeof (page));", "if (error != 0) {", "(void) fprintf(stderr, \"unable to dump \" TARGET_ABI_FMT_lx \"\\n\",\naddr);", "errno = -error;", "goto out;", "}", "if (dump_write(VAR_12, page, TARGET_PAGE_SIZE) < 0)\ngoto out;", "}", "}", "out:\nfree_note_info(&VAR_6);", "if (VAR_10 != NULL)\nvma_delete(VAR_10);", "(void) close(VAR_12);", "if (errno != 0)\nreturn (-errno);", "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, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 45, 47 ], [ 51, 53, 55 ], [ 69, 71 ], [ 75 ], [ 77 ], [ 89 ], [ 91, 93 ], [ 99, 101 ], [ 105 ], [ 107 ], [ 113 ], [ 117 ], [ 119, 121 ], [ 133 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167, 169 ], [ 171, 173 ], [ 175 ], [ 179 ], [ 181 ], [ 183 ], [ 195, 197 ], [ 203, 205 ], [ 215 ], [ 217 ], [ 219 ], [ 223 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 245 ], [ 247 ], [ 249, 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259, 261 ], [ 263 ], [ 265 ], [ 269, 271 ], [ 273, 275 ], [ 277 ], [ 281, 283 ], [ 285 ], [ 287 ] ]
21,814
void qemu_acl_reset(qemu_acl *acl) { qemu_acl_entry *entry; /* Put back to deny by default, so there is no window * of "open access" while the user re-initializes the * access control list */ acl->defaultDeny = 1; QTAILQ_FOREACH(entry, &acl->entries, next) { QTAILQ_REMOVE(&acl->entries, entry, next); free(entry->match); free(entry); } acl->nentries = 0; }
true
qemu
0ce6a434176e274a7e86bcaa268542c5cc402696
void qemu_acl_reset(qemu_acl *acl) { qemu_acl_entry *entry; acl->defaultDeny = 1; QTAILQ_FOREACH(entry, &acl->entries, next) { QTAILQ_REMOVE(&acl->entries, entry, next); free(entry->match); free(entry); } acl->nentries = 0; }
{ "code": [ " qemu_acl_entry *entry;", " QTAILQ_FOREACH(entry, &acl->entries, next) {" ], "line_no": [ 5, 17 ] }
void FUNC_0(qemu_acl *VAR_0) { qemu_acl_entry *entry; VAR_0->defaultDeny = 1; QTAILQ_FOREACH(entry, &VAR_0->entries, next) { QTAILQ_REMOVE(&VAR_0->entries, entry, next); free(entry->match); free(entry); } VAR_0->nentries = 0; }
[ "void FUNC_0(qemu_acl *VAR_0)\n{", "qemu_acl_entry *entry;", "VAR_0->defaultDeny = 1;", "QTAILQ_FOREACH(entry, &VAR_0->entries, next) {", "QTAILQ_REMOVE(&VAR_0->entries, entry, next);", "free(entry->match);", "free(entry);", "}", "VAR_0->nentries = 0;", "}" ]
[ 0, 1, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ] ]
21,816
void ff_id3v2_read(AVFormatContext *s, const char *magic, ID3v2ExtraMeta **extra_meta) { id3v2_read_internal(s->pb, &s->metadata, s, magic, extra_meta); }
false
FFmpeg
5331773cc33ba26b9e26ace643d926219e46a17b
void ff_id3v2_read(AVFormatContext *s, const char *magic, ID3v2ExtraMeta **extra_meta) { id3v2_read_internal(s->pb, &s->metadata, s, magic, extra_meta); }
{ "code": [], "line_no": [] }
void FUNC_0(AVFormatContext *VAR_0, const char *VAR_1, ID3v2ExtraMeta **VAR_2) { id3v2_read_internal(VAR_0->pb, &VAR_0->metadata, VAR_0, VAR_1, VAR_2); }
[ "void FUNC_0(AVFormatContext *VAR_0, const char *VAR_1,\nID3v2ExtraMeta **VAR_2)\n{", "id3v2_read_internal(VAR_0->pb, &VAR_0->metadata, VAR_0, VAR_1, VAR_2);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
21,817
static int qemu_loadvm_state(QEMUFile *f) { SaveStateEntry *se; int len, ret, instance_id, record_len, version_id; int64_t total_len, end_pos, cur_pos; unsigned int v; char idstr[256]; v = qemu_get_be32(f); if (v != QEMU_VM_FILE_MAGIC) goto fail; v = qemu_get_be32(f); if (v != QEMU_VM_FILE_VERSION) { fail: ret = -1; goto the_end; } total_len = qemu_get_be64(f); end_pos = total_len + qemu_ftell(f); for(;;) { if (qemu_ftell(f) >= end_pos) break; len = qemu_get_byte(f); qemu_get_buffer(f, (uint8_t *)idstr, len); idstr[len] = '\0'; instance_id = qemu_get_be32(f); version_id = qemu_get_be32(f); record_len = qemu_get_be32(f); #if 0 printf("idstr=%s instance=0x%x version=%d len=%d\n", idstr, instance_id, version_id, record_len); #endif cur_pos = qemu_ftell(f); se = find_se(idstr, instance_id); if (!se) { fprintf(stderr, "qemu: warning: instance 0x%x of device '%s' not present in current VM\n", instance_id, idstr); } else { ret = se->load_state(f, se->opaque, version_id); if (ret < 0) { fprintf(stderr, "qemu: warning: error while loading state for instance 0x%x of device '%s'\n", instance_id, idstr); } } /* always seek to exact end of record */ qemu_fseek(f, cur_pos + record_len, SEEK_SET); } ret = 0; the_end: return ret; }
true
qemu
9366f4186025e1d8fc3bebd41fb714521c170b6f
static int qemu_loadvm_state(QEMUFile *f) { SaveStateEntry *se; int len, ret, instance_id, record_len, version_id; int64_t total_len, end_pos, cur_pos; unsigned int v; char idstr[256]; v = qemu_get_be32(f); if (v != QEMU_VM_FILE_MAGIC) goto fail; v = qemu_get_be32(f); if (v != QEMU_VM_FILE_VERSION) { fail: ret = -1; goto the_end; } total_len = qemu_get_be64(f); end_pos = total_len + qemu_ftell(f); for(;;) { if (qemu_ftell(f) >= end_pos) break; len = qemu_get_byte(f); qemu_get_buffer(f, (uint8_t *)idstr, len); idstr[len] = '\0'; instance_id = qemu_get_be32(f); version_id = qemu_get_be32(f); record_len = qemu_get_be32(f); #if 0 printf("idstr=%s instance=0x%x version=%d len=%d\n", idstr, instance_id, version_id, record_len); #endif cur_pos = qemu_ftell(f); se = find_se(idstr, instance_id); if (!se) { fprintf(stderr, "qemu: warning: instance 0x%x of device '%s' not present in current VM\n", instance_id, idstr); } else { ret = se->load_state(f, se->opaque, version_id); if (ret < 0) { fprintf(stderr, "qemu: warning: error while loading state for instance 0x%x of device '%s'\n", instance_id, idstr); } } qemu_fseek(f, cur_pos + record_len, SEEK_SET); } ret = 0; the_end: return ret; }
{ "code": [ " cur_pos = qemu_ftell(f);", " ret = 0;", "static int qemu_loadvm_state(QEMUFile *f)", " unsigned int v;", " v = qemu_get_be32(f);", " if (v != QEMU_VM_FILE_MAGIC)", " goto fail;", " v = qemu_get_be32(f);", " if (v != QEMU_VM_FILE_VERSION) {", " fail:", " ret = -1;", " goto the_end;", "#if 0", " printf(\"idstr=%s instance=0x%x version=%d len=%d\\n\",", " idstr, instance_id, version_id, record_len);", "#endif", " the_end:" ], "line_no": [ 65, 95, 1, 11, 17, 19, 21, 17, 25, 27, 29, 31, 57, 59, 61, 63, 97 ] }
static int FUNC_0(QEMUFile *VAR_0) { SaveStateEntry *se; int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5; int64_t total_len, end_pos, cur_pos; unsigned int VAR_6; char VAR_7[256]; VAR_6 = qemu_get_be32(VAR_0); if (VAR_6 != QEMU_VM_FILE_MAGIC) goto fail; VAR_6 = qemu_get_be32(VAR_0); if (VAR_6 != QEMU_VM_FILE_VERSION) { fail: VAR_2 = -1; goto the_end; } total_len = qemu_get_be64(VAR_0); end_pos = total_len + qemu_ftell(VAR_0); for(;;) { if (qemu_ftell(VAR_0) >= end_pos) break; VAR_1 = qemu_get_byte(VAR_0); qemu_get_buffer(VAR_0, (uint8_t *)VAR_7, VAR_1); VAR_7[VAR_1] = '\0'; VAR_3 = qemu_get_be32(VAR_0); VAR_5 = qemu_get_be32(VAR_0); VAR_4 = qemu_get_be32(VAR_0); #if 0 printf("VAR_7=%s instance=0x%x version=%d VAR_1=%d\n", VAR_7, VAR_3, VAR_5, VAR_4); #endif cur_pos = qemu_ftell(VAR_0); se = find_se(VAR_7, VAR_3); if (!se) { fprintf(stderr, "qemu: warning: instance 0x%x of device '%s' not present in current VM\n", VAR_3, VAR_7); } else { VAR_2 = se->load_state(VAR_0, se->opaque, VAR_5); if (VAR_2 < 0) { fprintf(stderr, "qemu: warning: error while loading state for instance 0x%x of device '%s'\n", VAR_3, VAR_7); } } qemu_fseek(VAR_0, cur_pos + VAR_4, SEEK_SET); } VAR_2 = 0; the_end: return VAR_2; }
[ "static int FUNC_0(QEMUFile *VAR_0)\n{", "SaveStateEntry *se;", "int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5;", "int64_t total_len, end_pos, cur_pos;", "unsigned int VAR_6;", "char VAR_7[256];", "VAR_6 = qemu_get_be32(VAR_0);", "if (VAR_6 != QEMU_VM_FILE_MAGIC)\ngoto fail;", "VAR_6 = qemu_get_be32(VAR_0);", "if (VAR_6 != QEMU_VM_FILE_VERSION) {", "fail:\nVAR_2 = -1;", "goto the_end;", "}", "total_len = qemu_get_be64(VAR_0);", "end_pos = total_len + qemu_ftell(VAR_0);", "for(;;) {", "if (qemu_ftell(VAR_0) >= end_pos)\nbreak;", "VAR_1 = qemu_get_byte(VAR_0);", "qemu_get_buffer(VAR_0, (uint8_t *)VAR_7, VAR_1);", "VAR_7[VAR_1] = '\\0';", "VAR_3 = qemu_get_be32(VAR_0);", "VAR_5 = qemu_get_be32(VAR_0);", "VAR_4 = qemu_get_be32(VAR_0);", "#if 0\nprintf(\"VAR_7=%s instance=0x%x version=%d VAR_1=%d\\n\",\nVAR_7, VAR_3, VAR_5, VAR_4);", "#endif\ncur_pos = qemu_ftell(VAR_0);", "se = find_se(VAR_7, VAR_3);", "if (!se) {", "fprintf(stderr, \"qemu: warning: instance 0x%x of device '%s' not present in current VM\\n\",\nVAR_3, VAR_7);", "} else {", "VAR_2 = se->load_state(VAR_0, se->opaque, VAR_5);", "if (VAR_2 < 0) {", "fprintf(stderr, \"qemu: warning: error while loading state for instance 0x%x of device '%s'\\n\",\nVAR_3, VAR_7);", "}", "}", "qemu_fseek(VAR_0, cur_pos + VAR_4, SEEK_SET);", "}", "VAR_2 = 0;", "the_end:\nreturn VAR_2;", "}" ]
[ 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 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 ], [ 91 ], [ 93 ], [ 95 ], [ 97, 99 ], [ 101 ] ]
21,818
int ff_h263_decode_picture_header(MpegEncContext *s) { int format, width, height, i; uint32_t startcode; align_get_bits(&s->gb); if (show_bits(&s->gb, 2) == 2 && s->avctx->frame_number == 0) { av_log(s->avctx, AV_LOG_WARNING, "Header looks like RTP instead of H.263\n"); } startcode= get_bits(&s->gb, 22-8); for(i= get_bits_left(&s->gb); i>24; i-=8) { startcode = ((startcode << 8) | get_bits(&s->gb, 8)) & 0x003FFFFF; if(startcode == 0x20) break; } if (startcode != 0x20) { av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n"); return -1; } /* temporal reference */ i = get_bits(&s->gb, 8); /* picture timestamp */ if( (s->picture_number&~0xFF)+i < s->picture_number) i+= 256; s->picture_number= (s->picture_number&~0xFF) + i; /* PTYPE starts here */ if (get_bits1(&s->gb) != 1) { /* marker */ av_log(s->avctx, AV_LOG_ERROR, "Bad marker\n"); return -1; } if (get_bits1(&s->gb) != 0) { av_log(s->avctx, AV_LOG_ERROR, "Bad H263 id\n"); return -1; /* h263 id */ } skip_bits1(&s->gb); /* split screen off */ skip_bits1(&s->gb); /* camera off */ skip_bits1(&s->gb); /* freeze picture release off */ format = get_bits(&s->gb, 3); /* 0 forbidden 1 sub-QCIF 10 QCIF 7 extended PTYPE (PLUSPTYPE) */ if (format != 7 && format != 6) { s->h263_plus = 0; /* H.263v1 */ width = ff_h263_format[format][0]; height = ff_h263_format[format][1]; if (!width) return -1; s->pict_type = AV_PICTURE_TYPE_I + get_bits1(&s->gb); s->h263_long_vectors = get_bits1(&s->gb); if (get_bits1(&s->gb) != 0) { av_log(s->avctx, AV_LOG_ERROR, "H263 SAC not supported\n"); return -1; /* SAC: off */ } s->obmc= get_bits1(&s->gb); /* Advanced prediction mode */ s->unrestricted_mv = s->h263_long_vectors || s->obmc; s->pb_frame = get_bits1(&s->gb); s->chroma_qscale= s->qscale = get_bits(&s->gb, 5); skip_bits1(&s->gb); /* Continuous Presence Multipoint mode: off */ s->width = width; s->height = height; s->avctx->sample_aspect_ratio= (AVRational){12,11}; s->avctx->framerate = (AVRational){ 30000, 1001 }; } else { int ufep; /* H.263v2 */ s->h263_plus = 1; ufep = get_bits(&s->gb, 3); /* Update Full Extended PTYPE */ /* ufep other than 0 and 1 are reserved */ if (ufep == 1) { /* OPPTYPE */ format = get_bits(&s->gb, 3); av_dlog(s->avctx, "ufep=1, format: %d\n", format); s->custom_pcf= get_bits1(&s->gb); s->umvplus = get_bits1(&s->gb); /* Unrestricted Motion Vector */ if (get_bits1(&s->gb) != 0) { av_log(s->avctx, AV_LOG_ERROR, "Syntax-based Arithmetic Coding (SAC) not supported\n"); } s->obmc= get_bits1(&s->gb); /* Advanced prediction mode */ s->h263_aic = get_bits1(&s->gb); /* Advanced Intra Coding (AIC) */ s->loop_filter= get_bits1(&s->gb); s->unrestricted_mv = s->umvplus || s->obmc || s->loop_filter; if(s->avctx->lowres) s->loop_filter = 0; s->h263_slice_structured= get_bits1(&s->gb); if (get_bits1(&s->gb) != 0) { av_log(s->avctx, AV_LOG_ERROR, "Reference Picture Selection not supported\n"); } if (get_bits1(&s->gb) != 0) { av_log(s->avctx, AV_LOG_ERROR, "Independent Segment Decoding not supported\n"); } s->alt_inter_vlc= get_bits1(&s->gb); s->modified_quant= get_bits1(&s->gb); if(s->modified_quant) s->chroma_qscale_table= ff_h263_chroma_qscale_table; skip_bits(&s->gb, 1); /* Prevent start code emulation */ skip_bits(&s->gb, 3); /* Reserved */ } else if (ufep != 0) { av_log(s->avctx, AV_LOG_ERROR, "Bad UFEP type (%d)\n", ufep); return -1; } /* MPPTYPE */ s->pict_type = get_bits(&s->gb, 3); switch(s->pict_type){ case 0: s->pict_type= AV_PICTURE_TYPE_I;break; case 1: s->pict_type= AV_PICTURE_TYPE_P;break; case 2: s->pict_type= AV_PICTURE_TYPE_P;s->pb_frame = 3;break; case 3: s->pict_type= AV_PICTURE_TYPE_B;break; case 7: s->pict_type= AV_PICTURE_TYPE_I;break; //ZYGO default: return -1; } skip_bits(&s->gb, 2); s->no_rounding = get_bits1(&s->gb); skip_bits(&s->gb, 4); /* Get the picture dimensions */ if (ufep) { if (format == 6) { /* Custom Picture Format (CPFMT) */ s->aspect_ratio_info = get_bits(&s->gb, 4); av_dlog(s->avctx, "aspect: %d\n", s->aspect_ratio_info); /* aspect ratios: 0 - forbidden 1 - 1:1 2 - 12:11 (CIF 4:3) 3 - 10:11 (525-type 4:3) 4 - 16:11 (CIF 16:9) 5 - 40:33 (525-type 16:9) 6-14 - reserved */ width = (get_bits(&s->gb, 9) + 1) * 4; skip_bits1(&s->gb); height = get_bits(&s->gb, 9) * 4; av_dlog(s->avctx, "\nH.263+ Custom picture: %dx%d\n",width,height); if (s->aspect_ratio_info == FF_ASPECT_EXTENDED) { /* aspected dimensions */ s->avctx->sample_aspect_ratio.num= get_bits(&s->gb, 8); s->avctx->sample_aspect_ratio.den= get_bits(&s->gb, 8); }else{ s->avctx->sample_aspect_ratio= ff_h263_pixel_aspect[s->aspect_ratio_info]; } } else { width = ff_h263_format[format][0]; height = ff_h263_format[format][1]; s->avctx->sample_aspect_ratio= (AVRational){12,11}; } s->avctx->sample_aspect_ratio.den <<= s->ehc_mode; if ((width == 0) || (height == 0)) return -1; s->width = width; s->height = height; if(s->custom_pcf){ int gcd; s->avctx->framerate.num = 1800000; s->avctx->framerate.den = 1000 + get_bits1(&s->gb); s->avctx->framerate.den *= get_bits(&s->gb, 7); if(s->avctx->framerate.den == 0){ av_log(s, AV_LOG_ERROR, "zero framerate\n"); return -1; } gcd= av_gcd(s->avctx->framerate.den, s->avctx->framerate.num); s->avctx->framerate.den /= gcd; s->avctx->framerate.num /= gcd; }else{ s->avctx->framerate = (AVRational){ 30000, 1001 }; } } if(s->custom_pcf){ skip_bits(&s->gb, 2); //extended Temporal reference } if (ufep) { if (s->umvplus) { if(get_bits1(&s->gb)==0) /* Unlimited Unrestricted Motion Vectors Indicator (UUI) */ skip_bits1(&s->gb); } if(s->h263_slice_structured){ if (get_bits1(&s->gb) != 0) { av_log(s->avctx, AV_LOG_ERROR, "rectangular slices not supported\n"); } if (get_bits1(&s->gb) != 0) { av_log(s->avctx, AV_LOG_ERROR, "unordered slices not supported\n"); } } } s->qscale = get_bits(&s->gb, 5); } if (s->width == 0 || s->height == 0) { av_log(s->avctx, AV_LOG_ERROR, "dimensions 0\n"); return -1; } s->mb_width = (s->width + 15) / 16; s->mb_height = (s->height + 15) / 16; s->mb_num = s->mb_width * s->mb_height; if (s->pb_frame) { skip_bits(&s->gb, 3); /* Temporal reference for B-pictures */ if (s->custom_pcf) skip_bits(&s->gb, 2); //extended Temporal reference skip_bits(&s->gb, 2); /* Quantization information for B-pictures */ } if (s->pict_type!=AV_PICTURE_TYPE_B) { s->time = s->picture_number; s->pp_time = s->time - s->last_non_b_time; s->last_non_b_time = s->time; }else{ s->time = s->picture_number; s->pb_time = s->pp_time - (s->last_non_b_time - s->time); if (s->pp_time <=s->pb_time || s->pp_time <= s->pp_time - s->pb_time || s->pp_time <= 0){ s->pp_time = 2; s->pb_time = 1; } ff_mpeg4_init_direct_mv(s); } /* PEI */ if (skip_1stop_8data_bits(&s->gb) < 0) return AVERROR_INVALIDDATA; if(s->h263_slice_structured){ if (get_bits1(&s->gb) != 1) { av_log(s->avctx, AV_LOG_ERROR, "SEPB1 marker missing\n"); return -1; } ff_h263_decode_mba(s); if (get_bits1(&s->gb) != 1) { av_log(s->avctx, AV_LOG_ERROR, "SEPB2 marker missing\n"); return -1; } } s->f_code = 1; if(s->h263_aic){ s->y_dc_scale_table= s->c_dc_scale_table= ff_aic_dc_scale_table; }else{ s->y_dc_scale_table= s->c_dc_scale_table= ff_mpeg1_dc_scale_table; } ff_h263_show_pict_info(s); if (s->pict_type == AV_PICTURE_TYPE_I && s->codec_tag == AV_RL32("ZYGO") && get_bits_left(&s->gb) >= 85 + 13*3*16 + 50){ int i,j; for(i=0; i<85; i++) av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb)); av_log(s->avctx, AV_LOG_DEBUG, "\n"); for(i=0; i<13; i++){ for(j=0; j<3; j++){ int v= get_bits(&s->gb, 8); v |= get_sbits(&s->gb, 8)<<8; av_log(s->avctx, AV_LOG_DEBUG, " %5d", v); } av_log(s->avctx, AV_LOG_DEBUG, "\n"); } for(i=0; i<50; i++) av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb)); } return 0; }
false
FFmpeg
fbdaebb29861d32acc93fa55fd13554a2ae32eb4
int ff_h263_decode_picture_header(MpegEncContext *s) { int format, width, height, i; uint32_t startcode; align_get_bits(&s->gb); if (show_bits(&s->gb, 2) == 2 && s->avctx->frame_number == 0) { av_log(s->avctx, AV_LOG_WARNING, "Header looks like RTP instead of H.263\n"); } startcode= get_bits(&s->gb, 22-8); for(i= get_bits_left(&s->gb); i>24; i-=8) { startcode = ((startcode << 8) | get_bits(&s->gb, 8)) & 0x003FFFFF; if(startcode == 0x20) break; } if (startcode != 0x20) { av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n"); return -1; } i = get_bits(&s->gb, 8); if( (s->picture_number&~0xFF)+i < s->picture_number) i+= 256; s->picture_number= (s->picture_number&~0xFF) + i; if (get_bits1(&s->gb) != 1) { av_log(s->avctx, AV_LOG_ERROR, "Bad marker\n"); return -1; } if (get_bits1(&s->gb) != 0) { av_log(s->avctx, AV_LOG_ERROR, "Bad H263 id\n"); return -1; } skip_bits1(&s->gb); skip_bits1(&s->gb); skip_bits1(&s->gb); format = get_bits(&s->gb, 3); if (format != 7 && format != 6) { s->h263_plus = 0; width = ff_h263_format[format][0]; height = ff_h263_format[format][1]; if (!width) return -1; s->pict_type = AV_PICTURE_TYPE_I + get_bits1(&s->gb); s->h263_long_vectors = get_bits1(&s->gb); if (get_bits1(&s->gb) != 0) { av_log(s->avctx, AV_LOG_ERROR, "H263 SAC not supported\n"); return -1; } s->obmc= get_bits1(&s->gb); s->unrestricted_mv = s->h263_long_vectors || s->obmc; s->pb_frame = get_bits1(&s->gb); s->chroma_qscale= s->qscale = get_bits(&s->gb, 5); skip_bits1(&s->gb); s->width = width; s->height = height; s->avctx->sample_aspect_ratio= (AVRational){12,11}; s->avctx->framerate = (AVRational){ 30000, 1001 }; } else { int ufep; s->h263_plus = 1; ufep = get_bits(&s->gb, 3); if (ufep == 1) { format = get_bits(&s->gb, 3); av_dlog(s->avctx, "ufep=1, format: %d\n", format); s->custom_pcf= get_bits1(&s->gb); s->umvplus = get_bits1(&s->gb); if (get_bits1(&s->gb) != 0) { av_log(s->avctx, AV_LOG_ERROR, "Syntax-based Arithmetic Coding (SAC) not supported\n"); } s->obmc= get_bits1(&s->gb); s->h263_aic = get_bits1(&s->gb); s->loop_filter= get_bits1(&s->gb); s->unrestricted_mv = s->umvplus || s->obmc || s->loop_filter; if(s->avctx->lowres) s->loop_filter = 0; s->h263_slice_structured= get_bits1(&s->gb); if (get_bits1(&s->gb) != 0) { av_log(s->avctx, AV_LOG_ERROR, "Reference Picture Selection not supported\n"); } if (get_bits1(&s->gb) != 0) { av_log(s->avctx, AV_LOG_ERROR, "Independent Segment Decoding not supported\n"); } s->alt_inter_vlc= get_bits1(&s->gb); s->modified_quant= get_bits1(&s->gb); if(s->modified_quant) s->chroma_qscale_table= ff_h263_chroma_qscale_table; skip_bits(&s->gb, 1); skip_bits(&s->gb, 3); } else if (ufep != 0) { av_log(s->avctx, AV_LOG_ERROR, "Bad UFEP type (%d)\n", ufep); return -1; } s->pict_type = get_bits(&s->gb, 3); switch(s->pict_type){ case 0: s->pict_type= AV_PICTURE_TYPE_I;break; case 1: s->pict_type= AV_PICTURE_TYPE_P;break; case 2: s->pict_type= AV_PICTURE_TYPE_P;s->pb_frame = 3;break; case 3: s->pict_type= AV_PICTURE_TYPE_B;break; case 7: s->pict_type= AV_PICTURE_TYPE_I;break; default: return -1; } skip_bits(&s->gb, 2); s->no_rounding = get_bits1(&s->gb); skip_bits(&s->gb, 4); if (ufep) { if (format == 6) { s->aspect_ratio_info = get_bits(&s->gb, 4); av_dlog(s->avctx, "aspect: %d\n", s->aspect_ratio_info); width = (get_bits(&s->gb, 9) + 1) * 4; skip_bits1(&s->gb); height = get_bits(&s->gb, 9) * 4; av_dlog(s->avctx, "\nH.263+ Custom picture: %dx%d\n",width,height); if (s->aspect_ratio_info == FF_ASPECT_EXTENDED) { s->avctx->sample_aspect_ratio.num= get_bits(&s->gb, 8); s->avctx->sample_aspect_ratio.den= get_bits(&s->gb, 8); }else{ s->avctx->sample_aspect_ratio= ff_h263_pixel_aspect[s->aspect_ratio_info]; } } else { width = ff_h263_format[format][0]; height = ff_h263_format[format][1]; s->avctx->sample_aspect_ratio= (AVRational){12,11}; } s->avctx->sample_aspect_ratio.den <<= s->ehc_mode; if ((width == 0) || (height == 0)) return -1; s->width = width; s->height = height; if(s->custom_pcf){ int gcd; s->avctx->framerate.num = 1800000; s->avctx->framerate.den = 1000 + get_bits1(&s->gb); s->avctx->framerate.den *= get_bits(&s->gb, 7); if(s->avctx->framerate.den == 0){ av_log(s, AV_LOG_ERROR, "zero framerate\n"); return -1; } gcd= av_gcd(s->avctx->framerate.den, s->avctx->framerate.num); s->avctx->framerate.den /= gcd; s->avctx->framerate.num /= gcd; }else{ s->avctx->framerate = (AVRational){ 30000, 1001 }; } } if(s->custom_pcf){ skip_bits(&s->gb, 2); } if (ufep) { if (s->umvplus) { if(get_bits1(&s->gb)==0) skip_bits1(&s->gb); } if(s->h263_slice_structured){ if (get_bits1(&s->gb) != 0) { av_log(s->avctx, AV_LOG_ERROR, "rectangular slices not supported\n"); } if (get_bits1(&s->gb) != 0) { av_log(s->avctx, AV_LOG_ERROR, "unordered slices not supported\n"); } } } s->qscale = get_bits(&s->gb, 5); } if (s->width == 0 || s->height == 0) { av_log(s->avctx, AV_LOG_ERROR, "dimensions 0\n"); return -1; } s->mb_width = (s->width + 15) / 16; s->mb_height = (s->height + 15) / 16; s->mb_num = s->mb_width * s->mb_height; if (s->pb_frame) { skip_bits(&s->gb, 3); if (s->custom_pcf) skip_bits(&s->gb, 2); skip_bits(&s->gb, 2); } if (s->pict_type!=AV_PICTURE_TYPE_B) { s->time = s->picture_number; s->pp_time = s->time - s->last_non_b_time; s->last_non_b_time = s->time; }else{ s->time = s->picture_number; s->pb_time = s->pp_time - (s->last_non_b_time - s->time); if (s->pp_time <=s->pb_time || s->pp_time <= s->pp_time - s->pb_time || s->pp_time <= 0){ s->pp_time = 2; s->pb_time = 1; } ff_mpeg4_init_direct_mv(s); } if (skip_1stop_8data_bits(&s->gb) < 0) return AVERROR_INVALIDDATA; if(s->h263_slice_structured){ if (get_bits1(&s->gb) != 1) { av_log(s->avctx, AV_LOG_ERROR, "SEPB1 marker missing\n"); return -1; } ff_h263_decode_mba(s); if (get_bits1(&s->gb) != 1) { av_log(s->avctx, AV_LOG_ERROR, "SEPB2 marker missing\n"); return -1; } } s->f_code = 1; if(s->h263_aic){ s->y_dc_scale_table= s->c_dc_scale_table= ff_aic_dc_scale_table; }else{ s->y_dc_scale_table= s->c_dc_scale_table= ff_mpeg1_dc_scale_table; } ff_h263_show_pict_info(s); if (s->pict_type == AV_PICTURE_TYPE_I && s->codec_tag == AV_RL32("ZYGO") && get_bits_left(&s->gb) >= 85 + 13*3*16 + 50){ int i,j; for(i=0; i<85; i++) av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb)); av_log(s->avctx, AV_LOG_DEBUG, "\n"); for(i=0; i<13; i++){ for(j=0; j<3; j++){ int v= get_bits(&s->gb, 8); v |= get_sbits(&s->gb, 8)<<8; av_log(s->avctx, AV_LOG_DEBUG, " %5d", v); } av_log(s->avctx, AV_LOG_DEBUG, "\n"); } for(i=0; i<50; i++) av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb)); } return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(MpegEncContext *VAR_0) { int VAR_1, VAR_2, VAR_3, VAR_7; uint32_t startcode; align_get_bits(&VAR_0->gb); if (show_bits(&VAR_0->gb, 2) == 2 && VAR_0->avctx->frame_number == 0) { av_log(VAR_0->avctx, AV_LOG_WARNING, "Header looks like RTP instead of H.263\n"); } startcode= get_bits(&VAR_0->gb, 22-8); for(VAR_7= get_bits_left(&VAR_0->gb); VAR_7>24; VAR_7-=8) { startcode = ((startcode << 8) | get_bits(&VAR_0->gb, 8)) & 0x003FFFFF; if(startcode == 0x20) break; } if (startcode != 0x20) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Bad picture start code\n"); return -1; } VAR_7 = get_bits(&VAR_0->gb, 8); if( (VAR_0->picture_number&~0xFF)+VAR_7 < VAR_0->picture_number) VAR_7+= 256; VAR_0->picture_number= (VAR_0->picture_number&~0xFF) + VAR_7; if (get_bits1(&VAR_0->gb) != 1) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Bad marker\n"); return -1; } if (get_bits1(&VAR_0->gb) != 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Bad H263 id\n"); return -1; } skip_bits1(&VAR_0->gb); skip_bits1(&VAR_0->gb); skip_bits1(&VAR_0->gb); VAR_1 = get_bits(&VAR_0->gb, 3); if (VAR_1 != 7 && VAR_1 != 6) { VAR_0->h263_plus = 0; VAR_2 = ff_h263_format[VAR_1][0]; VAR_3 = ff_h263_format[VAR_1][1]; if (!VAR_2) return -1; VAR_0->pict_type = AV_PICTURE_TYPE_I + get_bits1(&VAR_0->gb); VAR_0->h263_long_vectors = get_bits1(&VAR_0->gb); if (get_bits1(&VAR_0->gb) != 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "H263 SAC not supported\n"); return -1; } VAR_0->obmc= get_bits1(&VAR_0->gb); VAR_0->unrestricted_mv = VAR_0->h263_long_vectors || VAR_0->obmc; VAR_0->pb_frame = get_bits1(&VAR_0->gb); VAR_0->chroma_qscale= VAR_0->qscale = get_bits(&VAR_0->gb, 5); skip_bits1(&VAR_0->gb); VAR_0->VAR_2 = VAR_2; VAR_0->VAR_3 = VAR_3; VAR_0->avctx->sample_aspect_ratio= (AVRational){12,11}; VAR_0->avctx->framerate = (AVRational){ 30000, 1001 }; } else { int VAR_5; VAR_0->h263_plus = 1; VAR_5 = get_bits(&VAR_0->gb, 3); if (VAR_5 == 1) { VAR_1 = get_bits(&VAR_0->gb, 3); av_dlog(VAR_0->avctx, "VAR_5=1, VAR_1: %d\n", VAR_1); VAR_0->custom_pcf= get_bits1(&VAR_0->gb); VAR_0->umvplus = get_bits1(&VAR_0->gb); if (get_bits1(&VAR_0->gb) != 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Syntax-based Arithmetic Coding (SAC) not supported\n"); } VAR_0->obmc= get_bits1(&VAR_0->gb); VAR_0->h263_aic = get_bits1(&VAR_0->gb); VAR_0->loop_filter= get_bits1(&VAR_0->gb); VAR_0->unrestricted_mv = VAR_0->umvplus || VAR_0->obmc || VAR_0->loop_filter; if(VAR_0->avctx->lowres) VAR_0->loop_filter = 0; VAR_0->h263_slice_structured= get_bits1(&VAR_0->gb); if (get_bits1(&VAR_0->gb) != 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Reference Picture Selection not supported\n"); } if (get_bits1(&VAR_0->gb) != 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Independent Segment Decoding not supported\n"); } VAR_0->alt_inter_vlc= get_bits1(&VAR_0->gb); VAR_0->modified_quant= get_bits1(&VAR_0->gb); if(VAR_0->modified_quant) VAR_0->chroma_qscale_table= ff_h263_chroma_qscale_table; skip_bits(&VAR_0->gb, 1); skip_bits(&VAR_0->gb, 3); } else if (VAR_5 != 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Bad UFEP type (%d)\n", VAR_5); return -1; } VAR_0->pict_type = get_bits(&VAR_0->gb, 3); switch(VAR_0->pict_type){ case 0: VAR_0->pict_type= AV_PICTURE_TYPE_I;break; case 1: VAR_0->pict_type= AV_PICTURE_TYPE_P;break; case 2: VAR_0->pict_type= AV_PICTURE_TYPE_P;VAR_0->pb_frame = 3;break; case 3: VAR_0->pict_type= AV_PICTURE_TYPE_B;break; case 7: VAR_0->pict_type= AV_PICTURE_TYPE_I;break; default: return -1; } skip_bits(&VAR_0->gb, 2); VAR_0->no_rounding = get_bits1(&VAR_0->gb); skip_bits(&VAR_0->gb, 4); if (VAR_5) { if (VAR_1 == 6) { VAR_0->aspect_ratio_info = get_bits(&VAR_0->gb, 4); av_dlog(VAR_0->avctx, "aspect: %d\n", VAR_0->aspect_ratio_info); VAR_2 = (get_bits(&VAR_0->gb, 9) + 1) * 4; skip_bits1(&VAR_0->gb); VAR_3 = get_bits(&VAR_0->gb, 9) * 4; av_dlog(VAR_0->avctx, "\nH.263+ Custom picture: %dx%d\n",VAR_2,VAR_3); if (VAR_0->aspect_ratio_info == FF_ASPECT_EXTENDED) { VAR_0->avctx->sample_aspect_ratio.num= get_bits(&VAR_0->gb, 8); VAR_0->avctx->sample_aspect_ratio.den= get_bits(&VAR_0->gb, 8); }else{ VAR_0->avctx->sample_aspect_ratio= ff_h263_pixel_aspect[VAR_0->aspect_ratio_info]; } } else { VAR_2 = ff_h263_format[VAR_1][0]; VAR_3 = ff_h263_format[VAR_1][1]; VAR_0->avctx->sample_aspect_ratio= (AVRational){12,11}; } VAR_0->avctx->sample_aspect_ratio.den <<= VAR_0->ehc_mode; if ((VAR_2 == 0) || (VAR_3 == 0)) return -1; VAR_0->VAR_2 = VAR_2; VAR_0->VAR_3 = VAR_3; if(VAR_0->custom_pcf){ int VAR_6; VAR_0->avctx->framerate.num = 1800000; VAR_0->avctx->framerate.den = 1000 + get_bits1(&VAR_0->gb); VAR_0->avctx->framerate.den *= get_bits(&VAR_0->gb, 7); if(VAR_0->avctx->framerate.den == 0){ av_log(VAR_0, AV_LOG_ERROR, "zero framerate\n"); return -1; } VAR_6= av_gcd(VAR_0->avctx->framerate.den, VAR_0->avctx->framerate.num); VAR_0->avctx->framerate.den /= VAR_6; VAR_0->avctx->framerate.num /= VAR_6; }else{ VAR_0->avctx->framerate = (AVRational){ 30000, 1001 }; } } if(VAR_0->custom_pcf){ skip_bits(&VAR_0->gb, 2); } if (VAR_5) { if (VAR_0->umvplus) { if(get_bits1(&VAR_0->gb)==0) skip_bits1(&VAR_0->gb); } if(VAR_0->h263_slice_structured){ if (get_bits1(&VAR_0->gb) != 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "rectangular slices not supported\n"); } if (get_bits1(&VAR_0->gb) != 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "unordered slices not supported\n"); } } } VAR_0->qscale = get_bits(&VAR_0->gb, 5); } if (VAR_0->VAR_2 == 0 || VAR_0->VAR_3 == 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "dimensions 0\n"); return -1; } VAR_0->mb_width = (VAR_0->VAR_2 + 15) / 16; VAR_0->mb_height = (VAR_0->VAR_3 + 15) / 16; VAR_0->mb_num = VAR_0->mb_width * VAR_0->mb_height; if (VAR_0->pb_frame) { skip_bits(&VAR_0->gb, 3); if (VAR_0->custom_pcf) skip_bits(&VAR_0->gb, 2); skip_bits(&VAR_0->gb, 2); } if (VAR_0->pict_type!=AV_PICTURE_TYPE_B) { VAR_0->time = VAR_0->picture_number; VAR_0->pp_time = VAR_0->time - VAR_0->last_non_b_time; VAR_0->last_non_b_time = VAR_0->time; }else{ VAR_0->time = VAR_0->picture_number; VAR_0->pb_time = VAR_0->pp_time - (VAR_0->last_non_b_time - VAR_0->time); if (VAR_0->pp_time <=VAR_0->pb_time || VAR_0->pp_time <= VAR_0->pp_time - VAR_0->pb_time || VAR_0->pp_time <= 0){ VAR_0->pp_time = 2; VAR_0->pb_time = 1; } ff_mpeg4_init_direct_mv(VAR_0); } if (skip_1stop_8data_bits(&VAR_0->gb) < 0) return AVERROR_INVALIDDATA; if(VAR_0->h263_slice_structured){ if (get_bits1(&VAR_0->gb) != 1) { av_log(VAR_0->avctx, AV_LOG_ERROR, "SEPB1 marker missing\n"); return -1; } ff_h263_decode_mba(VAR_0); if (get_bits1(&VAR_0->gb) != 1) { av_log(VAR_0->avctx, AV_LOG_ERROR, "SEPB2 marker missing\n"); return -1; } } VAR_0->f_code = 1; if(VAR_0->h263_aic){ VAR_0->y_dc_scale_table= VAR_0->c_dc_scale_table= ff_aic_dc_scale_table; }else{ VAR_0->y_dc_scale_table= VAR_0->c_dc_scale_table= ff_mpeg1_dc_scale_table; } ff_h263_show_pict_info(VAR_0); if (VAR_0->pict_type == AV_PICTURE_TYPE_I && VAR_0->codec_tag == AV_RL32("ZYGO") && get_bits_left(&VAR_0->gb) >= 85 + 13*3*16 + 50){ int VAR_7,VAR_7; for(VAR_7=0; VAR_7<85; VAR_7++) av_log(VAR_0->avctx, AV_LOG_DEBUG, "%d", get_bits1(&VAR_0->gb)); av_log(VAR_0->avctx, AV_LOG_DEBUG, "\n"); for(VAR_7=0; VAR_7<13; VAR_7++){ for(VAR_7=0; VAR_7<3; VAR_7++){ int VAR_8= get_bits(&VAR_0->gb, 8); VAR_8 |= get_sbits(&VAR_0->gb, 8)<<8; av_log(VAR_0->avctx, AV_LOG_DEBUG, " %5d", VAR_8); } av_log(VAR_0->avctx, AV_LOG_DEBUG, "\n"); } for(VAR_7=0; VAR_7<50; VAR_7++) av_log(VAR_0->avctx, AV_LOG_DEBUG, "%d", get_bits1(&VAR_0->gb)); } return 0; }
[ "int FUNC_0(MpegEncContext *VAR_0)\n{", "int VAR_1, VAR_2, VAR_3, VAR_7;", "uint32_t startcode;", "align_get_bits(&VAR_0->gb);", "if (show_bits(&VAR_0->gb, 2) == 2 && VAR_0->avctx->frame_number == 0) {", "av_log(VAR_0->avctx, AV_LOG_WARNING, \"Header looks like RTP instead of H.263\\n\");", "}", "startcode= get_bits(&VAR_0->gb, 22-8);", "for(VAR_7= get_bits_left(&VAR_0->gb); VAR_7>24; VAR_7-=8) {", "startcode = ((startcode << 8) | get_bits(&VAR_0->gb, 8)) & 0x003FFFFF;", "if(startcode == 0x20)\nbreak;", "}", "if (startcode != 0x20) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Bad picture start code\\n\");", "return -1;", "}", "VAR_7 = get_bits(&VAR_0->gb, 8);", "if( (VAR_0->picture_number&~0xFF)+VAR_7 < VAR_0->picture_number)\nVAR_7+= 256;", "VAR_0->picture_number= (VAR_0->picture_number&~0xFF) + VAR_7;", "if (get_bits1(&VAR_0->gb) != 1) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Bad marker\\n\");", "return -1;", "}", "if (get_bits1(&VAR_0->gb) != 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Bad H263 id\\n\");", "return -1;", "}", "skip_bits1(&VAR_0->gb);", "skip_bits1(&VAR_0->gb);", "skip_bits1(&VAR_0->gb);", "VAR_1 = get_bits(&VAR_0->gb, 3);", "if (VAR_1 != 7 && VAR_1 != 6) {", "VAR_0->h263_plus = 0;", "VAR_2 = ff_h263_format[VAR_1][0];", "VAR_3 = ff_h263_format[VAR_1][1];", "if (!VAR_2)\nreturn -1;", "VAR_0->pict_type = AV_PICTURE_TYPE_I + get_bits1(&VAR_0->gb);", "VAR_0->h263_long_vectors = get_bits1(&VAR_0->gb);", "if (get_bits1(&VAR_0->gb) != 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"H263 SAC not supported\\n\");", "return -1;", "}", "VAR_0->obmc= get_bits1(&VAR_0->gb);", "VAR_0->unrestricted_mv = VAR_0->h263_long_vectors || VAR_0->obmc;", "VAR_0->pb_frame = get_bits1(&VAR_0->gb);", "VAR_0->chroma_qscale= VAR_0->qscale = get_bits(&VAR_0->gb, 5);", "skip_bits1(&VAR_0->gb);", "VAR_0->VAR_2 = VAR_2;", "VAR_0->VAR_3 = VAR_3;", "VAR_0->avctx->sample_aspect_ratio= (AVRational){12,11};", "VAR_0->avctx->framerate = (AVRational){ 30000, 1001 };", "} else {", "int VAR_5;", "VAR_0->h263_plus = 1;", "VAR_5 = get_bits(&VAR_0->gb, 3);", "if (VAR_5 == 1) {", "VAR_1 = get_bits(&VAR_0->gb, 3);", "av_dlog(VAR_0->avctx, \"VAR_5=1, VAR_1: %d\\n\", VAR_1);", "VAR_0->custom_pcf= get_bits1(&VAR_0->gb);", "VAR_0->umvplus = get_bits1(&VAR_0->gb);", "if (get_bits1(&VAR_0->gb) != 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Syntax-based Arithmetic Coding (SAC) not supported\\n\");", "}", "VAR_0->obmc= get_bits1(&VAR_0->gb);", "VAR_0->h263_aic = get_bits1(&VAR_0->gb);", "VAR_0->loop_filter= get_bits1(&VAR_0->gb);", "VAR_0->unrestricted_mv = VAR_0->umvplus || VAR_0->obmc || VAR_0->loop_filter;", "if(VAR_0->avctx->lowres)\nVAR_0->loop_filter = 0;", "VAR_0->h263_slice_structured= get_bits1(&VAR_0->gb);", "if (get_bits1(&VAR_0->gb) != 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Reference Picture Selection not supported\\n\");", "}", "if (get_bits1(&VAR_0->gb) != 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Independent Segment Decoding not supported\\n\");", "}", "VAR_0->alt_inter_vlc= get_bits1(&VAR_0->gb);", "VAR_0->modified_quant= get_bits1(&VAR_0->gb);", "if(VAR_0->modified_quant)\nVAR_0->chroma_qscale_table= ff_h263_chroma_qscale_table;", "skip_bits(&VAR_0->gb, 1);", "skip_bits(&VAR_0->gb, 3);", "} else if (VAR_5 != 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Bad UFEP type (%d)\\n\", VAR_5);", "return -1;", "}", "VAR_0->pict_type = get_bits(&VAR_0->gb, 3);", "switch(VAR_0->pict_type){", "case 0: VAR_0->pict_type= AV_PICTURE_TYPE_I;break;", "case 1: VAR_0->pict_type= AV_PICTURE_TYPE_P;break;", "case 2: VAR_0->pict_type= AV_PICTURE_TYPE_P;VAR_0->pb_frame = 3;break;", "case 3: VAR_0->pict_type= AV_PICTURE_TYPE_B;break;", "case 7: VAR_0->pict_type= AV_PICTURE_TYPE_I;break;", "default:\nreturn -1;", "}", "skip_bits(&VAR_0->gb, 2);", "VAR_0->no_rounding = get_bits1(&VAR_0->gb);", "skip_bits(&VAR_0->gb, 4);", "if (VAR_5) {", "if (VAR_1 == 6) {", "VAR_0->aspect_ratio_info = get_bits(&VAR_0->gb, 4);", "av_dlog(VAR_0->avctx, \"aspect: %d\\n\", VAR_0->aspect_ratio_info);", "VAR_2 = (get_bits(&VAR_0->gb, 9) + 1) * 4;", "skip_bits1(&VAR_0->gb);", "VAR_3 = get_bits(&VAR_0->gb, 9) * 4;", "av_dlog(VAR_0->avctx, \"\\nH.263+ Custom picture: %dx%d\\n\",VAR_2,VAR_3);", "if (VAR_0->aspect_ratio_info == FF_ASPECT_EXTENDED) {", "VAR_0->avctx->sample_aspect_ratio.num= get_bits(&VAR_0->gb, 8);", "VAR_0->avctx->sample_aspect_ratio.den= get_bits(&VAR_0->gb, 8);", "}else{", "VAR_0->avctx->sample_aspect_ratio= ff_h263_pixel_aspect[VAR_0->aspect_ratio_info];", "}", "} else {", "VAR_2 = ff_h263_format[VAR_1][0];", "VAR_3 = ff_h263_format[VAR_1][1];", "VAR_0->avctx->sample_aspect_ratio= (AVRational){12,11};", "}", "VAR_0->avctx->sample_aspect_ratio.den <<= VAR_0->ehc_mode;", "if ((VAR_2 == 0) || (VAR_3 == 0))\nreturn -1;", "VAR_0->VAR_2 = VAR_2;", "VAR_0->VAR_3 = VAR_3;", "if(VAR_0->custom_pcf){", "int VAR_6;", "VAR_0->avctx->framerate.num = 1800000;", "VAR_0->avctx->framerate.den = 1000 + get_bits1(&VAR_0->gb);", "VAR_0->avctx->framerate.den *= get_bits(&VAR_0->gb, 7);", "if(VAR_0->avctx->framerate.den == 0){", "av_log(VAR_0, AV_LOG_ERROR, \"zero framerate\\n\");", "return -1;", "}", "VAR_6= av_gcd(VAR_0->avctx->framerate.den, VAR_0->avctx->framerate.num);", "VAR_0->avctx->framerate.den /= VAR_6;", "VAR_0->avctx->framerate.num /= VAR_6;", "}else{", "VAR_0->avctx->framerate = (AVRational){ 30000, 1001 };", "}", "}", "if(VAR_0->custom_pcf){", "skip_bits(&VAR_0->gb, 2);", "}", "if (VAR_5) {", "if (VAR_0->umvplus) {", "if(get_bits1(&VAR_0->gb)==0)\nskip_bits1(&VAR_0->gb);", "}", "if(VAR_0->h263_slice_structured){", "if (get_bits1(&VAR_0->gb) != 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"rectangular slices not supported\\n\");", "}", "if (get_bits1(&VAR_0->gb) != 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"unordered slices not supported\\n\");", "}", "}", "}", "VAR_0->qscale = get_bits(&VAR_0->gb, 5);", "}", "if (VAR_0->VAR_2 == 0 || VAR_0->VAR_3 == 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"dimensions 0\\n\");", "return -1;", "}", "VAR_0->mb_width = (VAR_0->VAR_2 + 15) / 16;", "VAR_0->mb_height = (VAR_0->VAR_3 + 15) / 16;", "VAR_0->mb_num = VAR_0->mb_width * VAR_0->mb_height;", "if (VAR_0->pb_frame) {", "skip_bits(&VAR_0->gb, 3);", "if (VAR_0->custom_pcf)\nskip_bits(&VAR_0->gb, 2);", "skip_bits(&VAR_0->gb, 2);", "}", "if (VAR_0->pict_type!=AV_PICTURE_TYPE_B) {", "VAR_0->time = VAR_0->picture_number;", "VAR_0->pp_time = VAR_0->time - VAR_0->last_non_b_time;", "VAR_0->last_non_b_time = VAR_0->time;", "}else{", "VAR_0->time = VAR_0->picture_number;", "VAR_0->pb_time = VAR_0->pp_time - (VAR_0->last_non_b_time - VAR_0->time);", "if (VAR_0->pp_time <=VAR_0->pb_time ||\nVAR_0->pp_time <= VAR_0->pp_time - VAR_0->pb_time ||\nVAR_0->pp_time <= 0){", "VAR_0->pp_time = 2;", "VAR_0->pb_time = 1;", "}", "ff_mpeg4_init_direct_mv(VAR_0);", "}", "if (skip_1stop_8data_bits(&VAR_0->gb) < 0)\nreturn AVERROR_INVALIDDATA;", "if(VAR_0->h263_slice_structured){", "if (get_bits1(&VAR_0->gb) != 1) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"SEPB1 marker missing\\n\");", "return -1;", "}", "ff_h263_decode_mba(VAR_0);", "if (get_bits1(&VAR_0->gb) != 1) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"SEPB2 marker missing\\n\");", "return -1;", "}", "}", "VAR_0->f_code = 1;", "if(VAR_0->h263_aic){", "VAR_0->y_dc_scale_table=\nVAR_0->c_dc_scale_table= ff_aic_dc_scale_table;", "}else{", "VAR_0->y_dc_scale_table=\nVAR_0->c_dc_scale_table= ff_mpeg1_dc_scale_table;", "}", "ff_h263_show_pict_info(VAR_0);", "if (VAR_0->pict_type == AV_PICTURE_TYPE_I && VAR_0->codec_tag == AV_RL32(\"ZYGO\") && get_bits_left(&VAR_0->gb) >= 85 + 13*3*16 + 50){", "int VAR_7,VAR_7;", "for(VAR_7=0; VAR_7<85; VAR_7++) av_log(VAR_0->avctx, AV_LOG_DEBUG, \"%d\", get_bits1(&VAR_0->gb));", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"\\n\");", "for(VAR_7=0; VAR_7<13; VAR_7++){", "for(VAR_7=0; VAR_7<3; VAR_7++){", "int VAR_8= get_bits(&VAR_0->gb, 8);", "VAR_8 |= get_sbits(&VAR_0->gb, 8)<<8;", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \" %5d\", VAR_8);", "}", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"\\n\");", "}", "for(VAR_7=0; VAR_7<50; VAR_7++) av_log(VAR_0->avctx, AV_LOG_DEBUG, \"%d\", get_bits1(&VAR_0->gb));", "}", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 27 ], [ 29 ], [ 33, 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115, 117 ], [ 121 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 167 ], [ 169 ], [ 175 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201, 203 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225, 227 ], [ 231 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263, 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 279 ], [ 281 ], [ 285 ], [ 287 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341, 343 ], [ 345 ], [ 347 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 385 ], [ 387 ], [ 389 ], [ 393 ], [ 395 ], [ 397, 399 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 409 ], [ 411 ], [ 413 ], [ 415 ], [ 417 ], [ 419 ], [ 423 ], [ 425 ], [ 429 ], [ 431 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 445 ], [ 447 ], [ 449, 451 ], [ 453 ], [ 455 ], [ 459 ], [ 461 ], [ 463 ], [ 465 ], [ 467 ], [ 469 ], [ 471 ], [ 473, 475, 477 ], [ 479 ], [ 481 ], [ 483 ], [ 485 ], [ 487 ], [ 493, 495 ], [ 499 ], [ 501 ], [ 503 ], [ 505 ], [ 507 ], [ 511 ], [ 515 ], [ 517 ], [ 519 ], [ 521 ], [ 523 ], [ 525 ], [ 529 ], [ 531, 533 ], [ 535 ], [ 537, 539 ], [ 541 ], [ 545 ], [ 547 ], [ 549 ], [ 551 ], [ 553 ], [ 555 ], [ 557 ], [ 559 ], [ 561 ], [ 563 ], [ 565 ], [ 567 ], [ 569 ], [ 571 ], [ 573 ], [ 577 ], [ 579 ] ]
21,819
static inline void gen_op_arith_add(DisasContext *ctx, TCGv ret, TCGv arg1, TCGv arg2, bool add_ca, bool compute_ca, bool compute_ov, bool compute_rc0) { TCGv t0 = ret; if (((compute_ca && add_ca) || compute_ov) && (TCGV_EQUAL(ret, arg1) || TCGV_EQUAL(ret, arg2))) { t0 = tcg_temp_new(); } if (compute_ca) { TCGv zero = tcg_const_tl(0); if (add_ca) { tcg_gen_add2_tl(t0, cpu_ca, arg1, zero, cpu_ca, zero); tcg_gen_add2_tl(t0, cpu_ca, t0, cpu_ca, arg2, zero); } else { tcg_gen_add2_tl(t0, cpu_ca, arg1, zero, arg2, zero); } tcg_temp_free(zero); } else { tcg_gen_add_tl(t0, arg1, arg2); if (add_ca) { tcg_gen_add_tl(t0, t0, cpu_ca); } } if (compute_ov) { gen_op_arith_compute_ov(ctx, t0, arg1, arg2, 0); } if (unlikely(compute_rc0)) { gen_set_Rc0(ctx, t0); } if (!TCGV_EQUAL(t0, ret)) { tcg_gen_mov_tl(ret, t0); tcg_temp_free(t0); } }
true
qemu
79482e5ab38a05ca8869040b0d8b8f451f16ff62
static inline void gen_op_arith_add(DisasContext *ctx, TCGv ret, TCGv arg1, TCGv arg2, bool add_ca, bool compute_ca, bool compute_ov, bool compute_rc0) { TCGv t0 = ret; if (((compute_ca && add_ca) || compute_ov) && (TCGV_EQUAL(ret, arg1) || TCGV_EQUAL(ret, arg2))) { t0 = tcg_temp_new(); } if (compute_ca) { TCGv zero = tcg_const_tl(0); if (add_ca) { tcg_gen_add2_tl(t0, cpu_ca, arg1, zero, cpu_ca, zero); tcg_gen_add2_tl(t0, cpu_ca, t0, cpu_ca, arg2, zero); } else { tcg_gen_add2_tl(t0, cpu_ca, arg1, zero, arg2, zero); } tcg_temp_free(zero); } else { tcg_gen_add_tl(t0, arg1, arg2); if (add_ca) { tcg_gen_add_tl(t0, t0, cpu_ca); } } if (compute_ov) { gen_op_arith_compute_ov(ctx, t0, arg1, arg2, 0); } if (unlikely(compute_rc0)) { gen_set_Rc0(ctx, t0); } if (!TCGV_EQUAL(t0, ret)) { tcg_gen_mov_tl(ret, t0); tcg_temp_free(t0); } }
{ "code": [ " TCGv zero = tcg_const_tl(0);", " if (add_ca) {", " tcg_gen_add2_tl(t0, cpu_ca, arg1, zero, cpu_ca, zero);", " tcg_gen_add2_tl(t0, cpu_ca, t0, cpu_ca, arg2, zero);", " tcg_gen_add2_tl(t0, cpu_ca, arg1, zero, arg2, zero);", " tcg_temp_free(zero);", " && (TCGV_EQUAL(ret, arg1) || TCGV_EQUAL(ret, arg2))) {", " tcg_gen_add_tl(t0, t0, cpu_ca);" ], "line_no": [ 25, 27, 29, 31, 35, 39, 15, 47 ] }
static inline void FUNC_0(DisasContext *VAR_0, TCGv VAR_1, TCGv VAR_2, TCGv VAR_3, bool VAR_4, bool VAR_5, bool VAR_6, bool VAR_7) { TCGv t0 = VAR_1; if (((VAR_5 && VAR_4) || VAR_6) && (TCGV_EQUAL(VAR_1, VAR_2) || TCGV_EQUAL(VAR_1, VAR_3))) { t0 = tcg_temp_new(); } if (VAR_5) { TCGv zero = tcg_const_tl(0); if (VAR_4) { tcg_gen_add2_tl(t0, cpu_ca, VAR_2, zero, cpu_ca, zero); tcg_gen_add2_tl(t0, cpu_ca, t0, cpu_ca, VAR_3, zero); } else { tcg_gen_add2_tl(t0, cpu_ca, VAR_2, zero, VAR_3, zero); } tcg_temp_free(zero); } else { tcg_gen_add_tl(t0, VAR_2, VAR_3); if (VAR_4) { tcg_gen_add_tl(t0, t0, cpu_ca); } } if (VAR_6) { gen_op_arith_compute_ov(VAR_0, t0, VAR_2, VAR_3, 0); } if (unlikely(VAR_7)) { gen_set_Rc0(VAR_0, t0); } if (!TCGV_EQUAL(t0, VAR_1)) { tcg_gen_mov_tl(VAR_1, t0); tcg_temp_free(t0); } }
[ "static inline void FUNC_0(DisasContext *VAR_0, TCGv VAR_1, TCGv VAR_2,\nTCGv VAR_3, bool VAR_4, bool VAR_5,\nbool VAR_6, bool VAR_7)\n{", "TCGv t0 = VAR_1;", "if (((VAR_5 && VAR_4) || VAR_6)\n&& (TCGV_EQUAL(VAR_1, VAR_2) || TCGV_EQUAL(VAR_1, VAR_3))) {", "t0 = tcg_temp_new();", "}", "if (VAR_5) {", "TCGv zero = tcg_const_tl(0);", "if (VAR_4) {", "tcg_gen_add2_tl(t0, cpu_ca, VAR_2, zero, cpu_ca, zero);", "tcg_gen_add2_tl(t0, cpu_ca, t0, cpu_ca, VAR_3, zero);", "} else {", "tcg_gen_add2_tl(t0, cpu_ca, VAR_2, zero, VAR_3, zero);", "}", "tcg_temp_free(zero);", "} else {", "tcg_gen_add_tl(t0, VAR_2, VAR_3);", "if (VAR_4) {", "tcg_gen_add_tl(t0, t0, cpu_ca);", "}", "}", "if (VAR_6) {", "gen_op_arith_compute_ov(VAR_0, t0, VAR_2, VAR_3, 0);", "}", "if (unlikely(VAR_7)) {", "gen_set_Rc0(VAR_0, t0);", "}", "if (!TCGV_EQUAL(t0, VAR_1)) {", "tcg_gen_mov_tl(VAR_1, t0);", "tcg_temp_free(t0);", "}", "}" ]
[ 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ] ]
21,821
static void qxl_check_state(PCIQXLDevice *d) { QXLRam *ram = d->ram; assert(SPICE_RING_IS_EMPTY(&ram->cmd_ring)); assert(SPICE_RING_IS_EMPTY(&ram->cursor_ring)); }
true
qemu
be48e9951214a78ebef025cefecfc77be3d1c13c
static void qxl_check_state(PCIQXLDevice *d) { QXLRam *ram = d->ram; assert(SPICE_RING_IS_EMPTY(&ram->cmd_ring)); assert(SPICE_RING_IS_EMPTY(&ram->cursor_ring)); }
{ "code": [ " assert(SPICE_RING_IS_EMPTY(&ram->cmd_ring));", " assert(SPICE_RING_IS_EMPTY(&ram->cursor_ring));", " QXLRam *ram = d->ram;" ], "line_no": [ 9, 11, 5 ] }
static void FUNC_0(PCIQXLDevice *VAR_0) { QXLRam *ram = VAR_0->ram; assert(SPICE_RING_IS_EMPTY(&ram->cmd_ring)); assert(SPICE_RING_IS_EMPTY(&ram->cursor_ring)); }
[ "static void FUNC_0(PCIQXLDevice *VAR_0)\n{", "QXLRam *ram = VAR_0->ram;", "assert(SPICE_RING_IS_EMPTY(&ram->cmd_ring));", "assert(SPICE_RING_IS_EMPTY(&ram->cursor_ring));", "}" ]
[ 0, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ] ]
21,824
static inline uint64_t inline_cvttq(CPUAlphaState *env, uint64_t a, int roundmode, int VI) { uint64_t frac, ret = 0; uint32_t exp, sign, exc = 0; int shift; sign = (a >> 63); exp = (uint32_t)(a >> 52) & 0x7ff; frac = a & 0xfffffffffffffull; if (exp == 0) { if (unlikely(frac != 0)) { goto do_underflow; } } else if (exp == 0x7ff) { exc = (frac ? FPCR_INV : VI ? FPCR_OVF : 0); } else { /* Restore implicit bit. */ frac |= 0x10000000000000ull; shift = exp - 1023 - 52; if (shift >= 0) { /* In this case the number is so large that we must shift the fraction left. There is no rounding to do. */ if (shift < 63) { ret = frac << shift; if (VI && (ret >> shift) != frac) { exc = FPCR_OVF; } } } else { uint64_t round; /* In this case the number is smaller than the fraction as represented by the 52 bit number. Here we must think about rounding the result. Handle this by shifting the fractional part of the number into the high bits of ROUND. This will let us efficiently handle round-to-nearest. */ shift = -shift; if (shift < 63) { ret = frac >> shift; round = frac << (64 - shift); } else { /* The exponent is so small we shift out everything. Leave a sticky bit for proper rounding below. */ do_underflow: round = 1; } if (round) { exc = (VI ? FPCR_INE : 0); switch (roundmode) { case float_round_nearest_even: if (round == (1ull << 63)) { /* Fraction is exactly 0.5; round to even. */ ret += (ret & 1); } else if (round > (1ull << 63)) { ret += 1; } break; case float_round_to_zero: break; case float_round_up: ret += 1 - sign; break; case float_round_down: ret += sign; break; } } } if (sign) { ret = -ret; } } env->error_code = exc; return ret; }
true
qemu
c24a8a0b6dad5a33d84f5fb846edb28c43312c71
static inline uint64_t inline_cvttq(CPUAlphaState *env, uint64_t a, int roundmode, int VI) { uint64_t frac, ret = 0; uint32_t exp, sign, exc = 0; int shift; sign = (a >> 63); exp = (uint32_t)(a >> 52) & 0x7ff; frac = a & 0xfffffffffffffull; if (exp == 0) { if (unlikely(frac != 0)) { goto do_underflow; } } else if (exp == 0x7ff) { exc = (frac ? FPCR_INV : VI ? FPCR_OVF : 0); } else { frac |= 0x10000000000000ull; shift = exp - 1023 - 52; if (shift >= 0) { if (shift < 63) { ret = frac << shift; if (VI && (ret >> shift) != frac) { exc = FPCR_OVF; } } } else { uint64_t round; shift = -shift; if (shift < 63) { ret = frac >> shift; round = frac << (64 - shift); } else { do_underflow: round = 1; } if (round) { exc = (VI ? FPCR_INE : 0); switch (roundmode) { case float_round_nearest_even: if (round == (1ull << 63)) { ret += (ret & 1); } else if (round > (1ull << 63)) { ret += 1; } break; case float_round_to_zero: break; case float_round_up: ret += 1 - sign; break; case float_round_down: ret += sign; break; } } } if (sign) { ret = -ret; } } env->error_code = exc; return ret; }
{ "code": [ "static inline uint64_t inline_cvttq(CPUAlphaState *env, uint64_t a,", " int roundmode, int VI)", " exc = (frac ? FPCR_INV : VI ? FPCR_OVF : 0);", " if (VI && (ret >> shift) != frac) {", " exc = FPCR_OVF;", " exc = (VI ? FPCR_INE : 0);" ], "line_no": [ 1, 3, 33, 55, 57, 103 ] }
static inline uint64_t FUNC_0(CPUAlphaState *env, uint64_t a, int roundmode, int VI) { uint64_t frac, ret = 0; uint32_t exp, sign, exc = 0; int VAR_0; sign = (a >> 63); exp = (uint32_t)(a >> 52) & 0x7ff; frac = a & 0xfffffffffffffull; if (exp == 0) { if (unlikely(frac != 0)) { goto do_underflow; } } else if (exp == 0x7ff) { exc = (frac ? FPCR_INV : VI ? FPCR_OVF : 0); } else { frac |= 0x10000000000000ull; VAR_0 = exp - 1023 - 52; if (VAR_0 >= 0) { if (VAR_0 < 63) { ret = frac << VAR_0; if (VI && (ret >> VAR_0) != frac) { exc = FPCR_OVF; } } } else { uint64_t round; VAR_0 = -VAR_0; if (VAR_0 < 63) { ret = frac >> VAR_0; round = frac << (64 - VAR_0); } else { do_underflow: round = 1; } if (round) { exc = (VI ? FPCR_INE : 0); switch (roundmode) { case float_round_nearest_even: if (round == (1ull << 63)) { ret += (ret & 1); } else if (round > (1ull << 63)) { ret += 1; } break; case float_round_to_zero: break; case float_round_up: ret += 1 - sign; break; case float_round_down: ret += sign; break; } } } if (sign) { ret = -ret; } } env->error_code = exc; return ret; }
[ "static inline uint64_t FUNC_0(CPUAlphaState *env, uint64_t a,\nint roundmode, int VI)\n{", "uint64_t frac, ret = 0;", "uint32_t exp, sign, exc = 0;", "int VAR_0;", "sign = (a >> 63);", "exp = (uint32_t)(a >> 52) & 0x7ff;", "frac = a & 0xfffffffffffffull;", "if (exp == 0) {", "if (unlikely(frac != 0)) {", "goto do_underflow;", "}", "} else if (exp == 0x7ff) {", "exc = (frac ? FPCR_INV : VI ? FPCR_OVF : 0);", "} else {", "frac |= 0x10000000000000ull;", "VAR_0 = exp - 1023 - 52;", "if (VAR_0 >= 0) {", "if (VAR_0 < 63) {", "ret = frac << VAR_0;", "if (VI && (ret >> VAR_0) != frac) {", "exc = FPCR_OVF;", "}", "}", "} else {", "uint64_t round;", "VAR_0 = -VAR_0;", "if (VAR_0 < 63) {", "ret = frac >> VAR_0;", "round = frac << (64 - VAR_0);", "} else {", "do_underflow:\nround = 1;", "}", "if (round) {", "exc = (VI ? FPCR_INE : 0);", "switch (roundmode) {", "case float_round_nearest_even:\nif (round == (1ull << 63)) {", "ret += (ret & 1);", "} else if (round > (1ull << 63)) {", "ret += 1;", "}", "break;", "case float_round_to_zero:\nbreak;", "case float_round_up:\nret += 1 - sign;", "break;", "case float_round_down:\nret += sign;", "break;", "}", "}", "}", "if (sign) {", "ret = -ret;", "}", "}", "env->error_code = exc;", "return ret;", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 43 ], [ 45 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 93, 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107, 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123, 125 ], [ 127, 129 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 157 ], [ 159 ] ]
21,825
static inline void ff_mpeg4_set_one_direct_mv(MpegEncContext *s, int mx, int my, int i){ static const int tab_size = sizeof(s->direct_scale_mv[0])/sizeof(int16_t); static const int tab_bias = (tab_size/2); int xy= s->block_index[i]; uint16_t time_pp= s->pp_time; uint16_t time_pb= s->pb_time; int p_mx, p_my; p_mx= s->next_picture.motion_val[0][xy][0]; if((unsigned)(p_mx + tab_bias) < tab_size){ s->mv[0][i][0] = s->direct_scale_mv[0][p_mx + tab_bias] + mx; s->mv[1][i][0] = mx ? s->mv[0][i][0] - p_mx : s->direct_scale_mv[1][p_mx + tab_bias]; }else{ s->mv[0][i][0] = p_mx*time_pb/time_pp + mx; s->mv[1][i][0] = mx ? s->mv[0][i][0] - p_mx : p_mx*(time_pb - time_pp)/time_pp; } p_my= s->next_picture.motion_val[0][xy][1]; if((unsigned)(p_my + tab_bias) < tab_size){ s->mv[0][i][1] = s->direct_scale_mv[0][p_my + tab_bias] + my; s->mv[1][i][1] = my ? s->mv[0][i][1] - p_my : s->direct_scale_mv[1][p_my + tab_bias]; }else{ s->mv[0][i][1] = p_my*time_pb/time_pp + my; s->mv[1][i][1] = my ? s->mv[0][i][1] - p_my : p_my*(time_pb - time_pp)/time_pp; } }
true
FFmpeg
c4e2a535b3a8b192c144acfaa9f1a7bc8b7f99f3
static inline void ff_mpeg4_set_one_direct_mv(MpegEncContext *s, int mx, int my, int i){ static const int tab_size = sizeof(s->direct_scale_mv[0])/sizeof(int16_t); static const int tab_bias = (tab_size/2); int xy= s->block_index[i]; uint16_t time_pp= s->pp_time; uint16_t time_pb= s->pb_time; int p_mx, p_my; p_mx= s->next_picture.motion_val[0][xy][0]; if((unsigned)(p_mx + tab_bias) < tab_size){ s->mv[0][i][0] = s->direct_scale_mv[0][p_mx + tab_bias] + mx; s->mv[1][i][0] = mx ? s->mv[0][i][0] - p_mx : s->direct_scale_mv[1][p_mx + tab_bias]; }else{ s->mv[0][i][0] = p_mx*time_pb/time_pp + mx; s->mv[1][i][0] = mx ? s->mv[0][i][0] - p_mx : p_mx*(time_pb - time_pp)/time_pp; } p_my= s->next_picture.motion_val[0][xy][1]; if((unsigned)(p_my + tab_bias) < tab_size){ s->mv[0][i][1] = s->direct_scale_mv[0][p_my + tab_bias] + my; s->mv[1][i][1] = my ? s->mv[0][i][1] - p_my : s->direct_scale_mv[1][p_my + tab_bias]; }else{ s->mv[0][i][1] = p_my*time_pb/time_pp + my; s->mv[1][i][1] = my ? s->mv[0][i][1] - p_my : p_my*(time_pb - time_pp)/time_pp; } }
{ "code": [ " static const int tab_size = sizeof(s->direct_scale_mv[0])/sizeof(int16_t);", " static const int tab_bias = (tab_size/2);", " static const int tab_size = sizeof(s->direct_scale_mv[0])/sizeof(int16_t);", " static const int tab_bias = (tab_size/2);" ], "line_no": [ 3, 5, 3, 5 ] }
static inline void FUNC_0(MpegEncContext *VAR_0, int VAR_1, int VAR_2, int VAR_3){ static const int VAR_4 = sizeof(VAR_0->direct_scale_mv[0])/sizeof(int16_t); static const int VAR_5 = (VAR_4/2); int VAR_6= VAR_0->block_index[VAR_3]; uint16_t time_pp= VAR_0->pp_time; uint16_t time_pb= VAR_0->pb_time; int VAR_7, VAR_8; VAR_7= VAR_0->next_picture.motion_val[0][VAR_6][0]; if((unsigned)(VAR_7 + VAR_5) < VAR_4){ VAR_0->mv[0][VAR_3][0] = VAR_0->direct_scale_mv[0][VAR_7 + VAR_5] + VAR_1; VAR_0->mv[1][VAR_3][0] = VAR_1 ? VAR_0->mv[0][VAR_3][0] - VAR_7 : VAR_0->direct_scale_mv[1][VAR_7 + VAR_5]; }else{ VAR_0->mv[0][VAR_3][0] = VAR_7*time_pb/time_pp + VAR_1; VAR_0->mv[1][VAR_3][0] = VAR_1 ? VAR_0->mv[0][VAR_3][0] - VAR_7 : VAR_7*(time_pb - time_pp)/time_pp; } VAR_8= VAR_0->next_picture.motion_val[0][VAR_6][1]; if((unsigned)(VAR_8 + VAR_5) < VAR_4){ VAR_0->mv[0][VAR_3][1] = VAR_0->direct_scale_mv[0][VAR_8 + VAR_5] + VAR_2; VAR_0->mv[1][VAR_3][1] = VAR_2 ? VAR_0->mv[0][VAR_3][1] - VAR_8 : VAR_0->direct_scale_mv[1][VAR_8 + VAR_5]; }else{ VAR_0->mv[0][VAR_3][1] = VAR_8*time_pb/time_pp + VAR_2; VAR_0->mv[1][VAR_3][1] = VAR_2 ? VAR_0->mv[0][VAR_3][1] - VAR_8 : VAR_8*(time_pb - time_pp)/time_pp; } }
[ "static inline void FUNC_0(MpegEncContext *VAR_0, int VAR_1, int VAR_2, int VAR_3){", "static const int VAR_4 = sizeof(VAR_0->direct_scale_mv[0])/sizeof(int16_t);", "static const int VAR_5 = (VAR_4/2);", "int VAR_6= VAR_0->block_index[VAR_3];", "uint16_t time_pp= VAR_0->pp_time;", "uint16_t time_pb= VAR_0->pb_time;", "int VAR_7, VAR_8;", "VAR_7= VAR_0->next_picture.motion_val[0][VAR_6][0];", "if((unsigned)(VAR_7 + VAR_5) < VAR_4){", "VAR_0->mv[0][VAR_3][0] = VAR_0->direct_scale_mv[0][VAR_7 + VAR_5] + VAR_1;", "VAR_0->mv[1][VAR_3][0] = VAR_1 ? VAR_0->mv[0][VAR_3][0] - VAR_7\n: VAR_0->direct_scale_mv[1][VAR_7 + VAR_5];", "}else{", "VAR_0->mv[0][VAR_3][0] = VAR_7*time_pb/time_pp + VAR_1;", "VAR_0->mv[1][VAR_3][0] = VAR_1 ? VAR_0->mv[0][VAR_3][0] - VAR_7\n: VAR_7*(time_pb - time_pp)/time_pp;", "}", "VAR_8= VAR_0->next_picture.motion_val[0][VAR_6][1];", "if((unsigned)(VAR_8 + VAR_5) < VAR_4){", "VAR_0->mv[0][VAR_3][1] = VAR_0->direct_scale_mv[0][VAR_8 + VAR_5] + VAR_2;", "VAR_0->mv[1][VAR_3][1] = VAR_2 ? VAR_0->mv[0][VAR_3][1] - VAR_8\n: VAR_0->direct_scale_mv[1][VAR_8 + VAR_5];", "}else{", "VAR_0->mv[0][VAR_3][1] = VAR_8*time_pb/time_pp + VAR_2;", "VAR_0->mv[1][VAR_3][1] = VAR_2 ? VAR_0->mv[0][VAR_3][1] - VAR_8\n: VAR_8*(time_pb - time_pp)/time_pp;", "}", "}" ]
[ 0, 1, 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 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ] ]
21,826
static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ AVIContext *avi = s->priv_data; AVIOContext *pb = s->pb; int longs_pre_entry= avio_rl16(pb); int index_sub_type = avio_r8(pb); int index_type = avio_r8(pb); int entries_in_use = avio_rl32(pb); int chunk_id = avio_rl32(pb); int64_t base = avio_rl64(pb); int stream_id= 10*((chunk_id&0xFF) - '0') + (((chunk_id>>8)&0xFF) - '0'); AVStream *st; AVIStream *ast; int i; int64_t last_pos= -1; int64_t filesize= avi->fsize; av_dlog(s, "longs_pre_entry:%d index_type:%d entries_in_use:%d chunk_id:%X base:%16"PRIX64"\n", longs_pre_entry,index_type, entries_in_use, chunk_id, base); if(stream_id >= s->nb_streams || stream_id < 0) return -1; st= s->streams[stream_id]; ast = st->priv_data; if(index_sub_type) return -1; avio_rl32(pb); if(index_type && longs_pre_entry != 2) return -1; if(index_type>1) return -1; if(filesize > 0 && base >= filesize){ av_log(s, AV_LOG_ERROR, "ODML index invalid\n"); if(base>>32 == (base & 0xFFFFFFFF) && (base & 0xFFFFFFFF) < filesize && filesize <= 0xFFFFFFFF) base &= 0xFFFFFFFF; else return -1; } for(i=0; i<entries_in_use; i++){ if(index_type){ int64_t pos= avio_rl32(pb) + base - 8; int len = avio_rl32(pb); int key= len >= 0; len &= 0x7FFFFFFF; #ifdef DEBUG_SEEK av_log(s, AV_LOG_ERROR, "pos:%"PRId64", len:%X\n", pos, len); #endif if(url_feof(pb)) return -1; if(last_pos == pos || pos == base - 8) avi->non_interleaved= 1; if(last_pos != pos && (len || !ast->sample_size)) av_add_index_entry(st, pos, ast->cum_len, len, 0, key ? AVINDEX_KEYFRAME : 0); ast->cum_len += get_duration(ast, len); last_pos= pos; }else{ int64_t offset, pos; int duration; offset = avio_rl64(pb); avio_rl32(pb); /* size */ duration = avio_rl32(pb); if(url_feof(pb)) return -1; pos = avio_tell(pb); if(avi->odml_depth > MAX_ODML_DEPTH){ av_log(s, AV_LOG_ERROR, "Too deeply nested ODML indexes\n"); return -1; } avio_seek(pb, offset+8, SEEK_SET); avi->odml_depth++; read_braindead_odml_indx(s, frame_num); avi->odml_depth--; frame_num += duration; avio_seek(pb, pos, SEEK_SET); } } avi->index_loaded=1; return 0; }
true
FFmpeg
f9e083a156f19094cb6fcd134c1ca4ca899a1a6d
static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ AVIContext *avi = s->priv_data; AVIOContext *pb = s->pb; int longs_pre_entry= avio_rl16(pb); int index_sub_type = avio_r8(pb); int index_type = avio_r8(pb); int entries_in_use = avio_rl32(pb); int chunk_id = avio_rl32(pb); int64_t base = avio_rl64(pb); int stream_id= 10*((chunk_id&0xFF) - '0') + (((chunk_id>>8)&0xFF) - '0'); AVStream *st; AVIStream *ast; int i; int64_t last_pos= -1; int64_t filesize= avi->fsize; av_dlog(s, "longs_pre_entry:%d index_type:%d entries_in_use:%d chunk_id:%X base:%16"PRIX64"\n", longs_pre_entry,index_type, entries_in_use, chunk_id, base); if(stream_id >= s->nb_streams || stream_id < 0) return -1; st= s->streams[stream_id]; ast = st->priv_data; if(index_sub_type) return -1; avio_rl32(pb); if(index_type && longs_pre_entry != 2) return -1; if(index_type>1) return -1; if(filesize > 0 && base >= filesize){ av_log(s, AV_LOG_ERROR, "ODML index invalid\n"); if(base>>32 == (base & 0xFFFFFFFF) && (base & 0xFFFFFFFF) < filesize && filesize <= 0xFFFFFFFF) base &= 0xFFFFFFFF; else return -1; } for(i=0; i<entries_in_use; i++){ if(index_type){ int64_t pos= avio_rl32(pb) + base - 8; int len = avio_rl32(pb); int key= len >= 0; len &= 0x7FFFFFFF; #ifdef DEBUG_SEEK av_log(s, AV_LOG_ERROR, "pos:%"PRId64", len:%X\n", pos, len); #endif if(url_feof(pb)) return -1; if(last_pos == pos || pos == base - 8) avi->non_interleaved= 1; if(last_pos != pos && (len || !ast->sample_size)) av_add_index_entry(st, pos, ast->cum_len, len, 0, key ? AVINDEX_KEYFRAME : 0); ast->cum_len += get_duration(ast, len); last_pos= pos; }else{ int64_t offset, pos; int duration; offset = avio_rl64(pb); avio_rl32(pb); duration = avio_rl32(pb); if(url_feof(pb)) return -1; pos = avio_tell(pb); if(avi->odml_depth > MAX_ODML_DEPTH){ av_log(s, AV_LOG_ERROR, "Too deeply nested ODML indexes\n"); return -1; } avio_seek(pb, offset+8, SEEK_SET); avi->odml_depth++; read_braindead_odml_indx(s, frame_num); avi->odml_depth--; frame_num += duration; avio_seek(pb, pos, SEEK_SET); } } avi->index_loaded=1; return 0; }
{ "code": [ " avio_seek(pb, offset+8, SEEK_SET);", " avio_seek(pb, pos, SEEK_SET);" ], "line_no": [ 159, 171 ] }
static int FUNC_0(AVFormatContext *VAR_0, int VAR_1){ AVIContext *avi = VAR_0->priv_data; AVIOContext *pb = VAR_0->pb; int VAR_2= avio_rl16(pb); int VAR_3 = avio_r8(pb); int VAR_4 = avio_r8(pb); int VAR_5 = avio_rl32(pb); int VAR_6 = avio_rl32(pb); int64_t base = avio_rl64(pb); int VAR_7= 10*((VAR_6&0xFF) - '0') + (((VAR_6>>8)&0xFF) - '0'); AVStream *st; AVIStream *ast; int VAR_8; int64_t last_pos= -1; int64_t filesize= avi->fsize; av_dlog(VAR_0, "VAR_2:%d VAR_4:%d VAR_5:%d VAR_6:%X base:%16"PRIX64"\n", VAR_2,VAR_4, VAR_5, VAR_6, base); if(VAR_7 >= VAR_0->nb_streams || VAR_7 < 0) return -1; st= VAR_0->streams[VAR_7]; ast = st->priv_data; if(VAR_3) return -1; avio_rl32(pb); if(VAR_4 && VAR_2 != 2) return -1; if(VAR_4>1) return -1; if(filesize > 0 && base >= filesize){ av_log(VAR_0, AV_LOG_ERROR, "ODML index invalid\n"); if(base>>32 == (base & 0xFFFFFFFF) && (base & 0xFFFFFFFF) < filesize && filesize <= 0xFFFFFFFF) base &= 0xFFFFFFFF; else return -1; } for(VAR_8=0; VAR_8<VAR_5; VAR_8++){ if(VAR_4){ int64_t pos= avio_rl32(pb) + base - 8; int VAR_9 = avio_rl32(pb); int VAR_10= VAR_9 >= 0; VAR_9 &= 0x7FFFFFFF; #ifdef DEBUG_SEEK av_log(VAR_0, AV_LOG_ERROR, "pos:%"PRId64", VAR_9:%X\n", pos, VAR_9); #endif if(url_feof(pb)) return -1; if(last_pos == pos || pos == base - 8) avi->non_interleaved= 1; if(last_pos != pos && (VAR_9 || !ast->sample_size)) av_add_index_entry(st, pos, ast->cum_len, VAR_9, 0, VAR_10 ? AVINDEX_KEYFRAME : 0); ast->cum_len += get_duration(ast, VAR_9); last_pos= pos; }else{ int64_t offset, pos; int VAR_11; offset = avio_rl64(pb); avio_rl32(pb); VAR_11 = avio_rl32(pb); if(url_feof(pb)) return -1; pos = avio_tell(pb); if(avi->odml_depth > MAX_ODML_DEPTH){ av_log(VAR_0, AV_LOG_ERROR, "Too deeply nested ODML indexes\n"); return -1; } avio_seek(pb, offset+8, SEEK_SET); avi->odml_depth++; FUNC_0(VAR_0, VAR_1); avi->odml_depth--; VAR_1 += VAR_11; avio_seek(pb, pos, SEEK_SET); } } avi->index_loaded=1; return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0, int VAR_1){", "AVIContext *avi = VAR_0->priv_data;", "AVIOContext *pb = VAR_0->pb;", "int VAR_2= avio_rl16(pb);", "int VAR_3 = avio_r8(pb);", "int VAR_4 = avio_r8(pb);", "int VAR_5 = avio_rl32(pb);", "int VAR_6 = avio_rl32(pb);", "int64_t base = avio_rl64(pb);", "int VAR_7= 10*((VAR_6&0xFF) - '0') + (((VAR_6>>8)&0xFF) - '0');", "AVStream *st;", "AVIStream *ast;", "int VAR_8;", "int64_t last_pos= -1;", "int64_t filesize= avi->fsize;", "av_dlog(VAR_0, \"VAR_2:%d VAR_4:%d VAR_5:%d VAR_6:%X base:%16\"PRIX64\"\\n\",\nVAR_2,VAR_4, VAR_5, VAR_6, base);", "if(VAR_7 >= VAR_0->nb_streams || VAR_7 < 0)\nreturn -1;", "st= VAR_0->streams[VAR_7];", "ast = st->priv_data;", "if(VAR_3)\nreturn -1;", "avio_rl32(pb);", "if(VAR_4 && VAR_2 != 2)\nreturn -1;", "if(VAR_4>1)\nreturn -1;", "if(filesize > 0 && base >= filesize){", "av_log(VAR_0, AV_LOG_ERROR, \"ODML index invalid\\n\");", "if(base>>32 == (base & 0xFFFFFFFF) && (base & 0xFFFFFFFF) < filesize && filesize <= 0xFFFFFFFF)\nbase &= 0xFFFFFFFF;", "else\nreturn -1;", "}", "for(VAR_8=0; VAR_8<VAR_5; VAR_8++){", "if(VAR_4){", "int64_t pos= avio_rl32(pb) + base - 8;", "int VAR_9 = avio_rl32(pb);", "int VAR_10= VAR_9 >= 0;", "VAR_9 &= 0x7FFFFFFF;", "#ifdef DEBUG_SEEK\nav_log(VAR_0, AV_LOG_ERROR, \"pos:%\"PRId64\", VAR_9:%X\\n\", pos, VAR_9);", "#endif\nif(url_feof(pb))\nreturn -1;", "if(last_pos == pos || pos == base - 8)\navi->non_interleaved= 1;", "if(last_pos != pos && (VAR_9 || !ast->sample_size))\nav_add_index_entry(st, pos, ast->cum_len, VAR_9, 0, VAR_10 ? AVINDEX_KEYFRAME : 0);", "ast->cum_len += get_duration(ast, VAR_9);", "last_pos= pos;", "}else{", "int64_t offset, pos;", "int VAR_11;", "offset = avio_rl64(pb);", "avio_rl32(pb);", "VAR_11 = avio_rl32(pb);", "if(url_feof(pb))\nreturn -1;", "pos = avio_tell(pb);", "if(avi->odml_depth > MAX_ODML_DEPTH){", "av_log(VAR_0, AV_LOG_ERROR, \"Too deeply nested ODML indexes\\n\");", "return -1;", "}", "avio_seek(pb, offset+8, SEEK_SET);", "avi->odml_depth++;", "FUNC_0(VAR_0, VAR_1);", "avi->odml_depth--;", "VAR_1 += VAR_11;", "avio_seek(pb, pos, SEEK_SET);", "}", "}", "avi->index_loaded=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, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33, 35 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 49, 51 ], [ 55 ], [ 59, 61 ], [ 63, 65 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77, 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99, 101 ], [ 103, 105, 107 ], [ 111, 113 ], [ 115, 117 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139, 141 ], [ 145 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ] ]
21,827
static inline void RENAME(rgb24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused) { #if COMPILE_TEMPLATE_MMX assert(src1==src2); RENAME(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_RGB24); #else int i; assert(src1==src2); for (i=0; i<width; i++) { int r= src1[3*i + 0]; int g= src1[3*i + 1]; int b= src1[3*i + 2]; dstU[i]= (RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT; dstV[i]= (RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT; } #endif }
false
FFmpeg
d1adad3cca407f493c3637e20ecd4f7124e69212
static inline void RENAME(rgb24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused) { #if COMPILE_TEMPLATE_MMX assert(src1==src2); RENAME(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_RGB24); #else int i; assert(src1==src2); for (i=0; i<width; i++) { int r= src1[3*i + 0]; int g= src1[3*i + 1]; int b= src1[3*i + 2]; dstU[i]= (RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT; dstV[i]= (RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT; } #endif }
{ "code": [], "line_no": [] }
static inline void FUNC_0(rgb24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused) { #if COMPILE_TEMPLATE_MMX assert(src1==src2); FUNC_0(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_RGB24); #else int VAR_0; assert(src1==src2); for (VAR_0=0; VAR_0<width; VAR_0++) { int r= src1[3*VAR_0 + 0]; int g= src1[3*VAR_0 + 1]; int b= src1[3*VAR_0 + 2]; dstU[VAR_0]= (RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT; dstV[VAR_0]= (RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT; } #endif }
[ "static inline void FUNC_0(rgb24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused)\n{", "#if COMPILE_TEMPLATE_MMX\nassert(src1==src2);", "FUNC_0(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_RGB24);", "#else\nint VAR_0;", "assert(src1==src2);", "for (VAR_0=0; VAR_0<width; VAR_0++) {", "int r= src1[3*VAR_0 + 0];", "int g= src1[3*VAR_0 + 1];", "int b= src1[3*VAR_0 + 2];", "dstU[VAR_0]= (RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT;", "dstV[VAR_0]= (RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT;", "}", "#endif\n}" ]
[ 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 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ] ]
21,829
static Visitor *visitor_input_test_init_raw(TestInputVisitorData *data, const char *json_string) { Visitor *v; data->obj = qobject_from_json(json_string); g_assert(data->obj != NULL); data->qiv = qmp_input_visitor_new(data->obj); g_assert(data->qiv != NULL); v = qmp_input_get_visitor(data->qiv); g_assert(v != NULL); return v; }
true
qemu
0920a17199d23b3def3a60fa1fbbdeadcdda452d
static Visitor *visitor_input_test_init_raw(TestInputVisitorData *data, const char *json_string) { Visitor *v; data->obj = qobject_from_json(json_string); g_assert(data->obj != NULL); data->qiv = qmp_input_visitor_new(data->obj); g_assert(data->qiv != NULL); v = qmp_input_get_visitor(data->qiv); g_assert(v != NULL); return v; }
{ "code": [ " g_assert(data->obj != NULL);", " g_assert(data->qiv != NULL);", " v = qmp_input_get_visitor(data->qiv);", " g_assert(v != NULL);", " Visitor *v;", " data->obj = qobject_from_json(json_string);", " g_assert(data->obj != NULL);", " g_assert(data->qiv != NULL);", " v = qmp_input_get_visitor(data->qiv);", " g_assert(v != NULL);", " return v;", " g_assert(data->obj != NULL);", " data->qiv = qmp_input_visitor_new(data->obj);", " g_assert(data->qiv != NULL);", " v = qmp_input_get_visitor(data->qiv);", " g_assert(v != NULL);", " Visitor *v;", " data->obj = qobject_from_json(json_string);", " g_assert(data->obj != NULL);", " data->qiv = qmp_input_visitor_new(data->obj);", " g_assert(data->qiv != NULL);", " v = qmp_input_get_visitor(data->qiv);", " g_assert(v != NULL);", " return v;" ], "line_no": [ 15, 21, 25, 27, 7, 11, 15, 21, 25, 27, 31, 15, 19, 21, 25, 27, 7, 11, 15, 19, 21, 25, 27, 31 ] }
static Visitor *FUNC_0(TestInputVisitorData *data, const char *json_string) { Visitor *v; data->obj = qobject_from_json(json_string); g_assert(data->obj != NULL); data->qiv = qmp_input_visitor_new(data->obj); g_assert(data->qiv != NULL); v = qmp_input_get_visitor(data->qiv); g_assert(v != NULL); return v; }
[ "static Visitor *FUNC_0(TestInputVisitorData *data,\nconst char *json_string)\n{", "Visitor *v;", "data->obj = qobject_from_json(json_string);", "g_assert(data->obj != NULL);", "data->qiv = qmp_input_visitor_new(data->obj);", "g_assert(data->qiv != NULL);", "v = qmp_input_get_visitor(data->qiv);", "g_assert(v != NULL);", "return v;", "}" ]
[ 0, 1, 1, 1, 1, 1, 1, 1, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ] ]
21,830
ssize_t v9fs_get_xattr(FsContext *ctx, const char *path, const char *name, void *value, size_t size) { XattrOperations *xops = get_xattr_operations(ctx->xops, name); if (xops) { return xops->getxattr(ctx, path, name, value, size); } errno = -EOPNOTSUPP; return -1; }
true
qemu
8af00205445eb901f17ca5b632d976065187538e
ssize_t v9fs_get_xattr(FsContext *ctx, const char *path, const char *name, void *value, size_t size) { XattrOperations *xops = get_xattr_operations(ctx->xops, name); if (xops) { return xops->getxattr(ctx, path, name, value, size); } errno = -EOPNOTSUPP; return -1; }
{ "code": [ " errno = -EOPNOTSUPP;", " errno = -EOPNOTSUPP;", " errno = -EOPNOTSUPP;" ], "line_no": [ 15, 15, 15 ] }
ssize_t FUNC_0(FsContext *ctx, const char *path, const char *name, void *value, size_t size) { XattrOperations *xops = get_xattr_operations(ctx->xops, name); if (xops) { return xops->getxattr(ctx, path, name, value, size); } errno = -EOPNOTSUPP; return -1; }
[ "ssize_t FUNC_0(FsContext *ctx, const char *path,\nconst char *name, void *value, size_t size)\n{", "XattrOperations *xops = get_xattr_operations(ctx->xops, name);", "if (xops) {", "return xops->getxattr(ctx, path, name, value, size);", "}", "errno = -EOPNOTSUPP;", "return -1;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
21,831
static void fdctrl_write_data(FDCtrl *fdctrl, uint32_t value) { FDrive *cur_drv; int pos; /* Reset mode */ if (!(fdctrl->dor & FD_DOR_nRESET)) { FLOPPY_DPRINTF("Floppy controller in RESET state !\n"); return; } if (!(fdctrl->msr & FD_MSR_RQM) || (fdctrl->msr & FD_MSR_DIO)) { FLOPPY_DPRINTF("error: controller not ready for writing\n"); return; } fdctrl->dsr &= ~FD_DSR_PWRDOWN; /* Is it write command time ? */ if (fdctrl->msr & FD_MSR_NONDMA) { /* FIFO data write */ pos = fdctrl->data_pos++; pos %= FD_SECTOR_LEN; fdctrl->fifo[pos] = value; if (pos == FD_SECTOR_LEN - 1 || fdctrl->data_pos == fdctrl->data_len) { cur_drv = get_cur_drv(fdctrl); if (blk_write(cur_drv->blk, fd_sector(cur_drv), fdctrl->fifo, 1) < 0) { FLOPPY_DPRINTF("error writing sector %d\n", fd_sector(cur_drv)); return; } if (!fdctrl_seek_to_next_sect(fdctrl, cur_drv)) { FLOPPY_DPRINTF("error seeking to next sector %d\n", fd_sector(cur_drv)); return; } } /* Switch from transfer mode to status mode * then from status mode to command mode */ if (fdctrl->data_pos == fdctrl->data_len) fdctrl_stop_transfer(fdctrl, 0x00, 0x00, 0x00); return; } if (fdctrl->data_pos == 0) { /* Command */ pos = command_to_handler[value & 0xff]; FLOPPY_DPRINTF("%s command\n", handlers[pos].name); fdctrl->data_len = handlers[pos].parameters + 1; fdctrl->msr |= FD_MSR_CMDBUSY; } FLOPPY_DPRINTF("%s: %02x\n", __func__, value); fdctrl->fifo[fdctrl->data_pos++] = value; if (fdctrl->data_pos == fdctrl->data_len) { /* We now have all parameters * and will be able to treat the command */ if (fdctrl->data_state & FD_STATE_FORMAT) { fdctrl_format_sector(fdctrl); return; } pos = command_to_handler[fdctrl->fifo[0] & 0xff]; FLOPPY_DPRINTF("treat %s command\n", handlers[pos].name); (*handlers[pos].handler)(fdctrl, handlers[pos].direction); } }
true
qemu
e907746266721f305d67bc0718795fedee2e824c
static void fdctrl_write_data(FDCtrl *fdctrl, uint32_t value) { FDrive *cur_drv; int pos; if (!(fdctrl->dor & FD_DOR_nRESET)) { FLOPPY_DPRINTF("Floppy controller in RESET state !\n"); return; } if (!(fdctrl->msr & FD_MSR_RQM) || (fdctrl->msr & FD_MSR_DIO)) { FLOPPY_DPRINTF("error: controller not ready for writing\n"); return; } fdctrl->dsr &= ~FD_DSR_PWRDOWN; if (fdctrl->msr & FD_MSR_NONDMA) { pos = fdctrl->data_pos++; pos %= FD_SECTOR_LEN; fdctrl->fifo[pos] = value; if (pos == FD_SECTOR_LEN - 1 || fdctrl->data_pos == fdctrl->data_len) { cur_drv = get_cur_drv(fdctrl); if (blk_write(cur_drv->blk, fd_sector(cur_drv), fdctrl->fifo, 1) < 0) { FLOPPY_DPRINTF("error writing sector %d\n", fd_sector(cur_drv)); return; } if (!fdctrl_seek_to_next_sect(fdctrl, cur_drv)) { FLOPPY_DPRINTF("error seeking to next sector %d\n", fd_sector(cur_drv)); return; } } if (fdctrl->data_pos == fdctrl->data_len) fdctrl_stop_transfer(fdctrl, 0x00, 0x00, 0x00); return; } if (fdctrl->data_pos == 0) { pos = command_to_handler[value & 0xff]; FLOPPY_DPRINTF("%s command\n", handlers[pos].name); fdctrl->data_len = handlers[pos].parameters + 1; fdctrl->msr |= FD_MSR_CMDBUSY; } FLOPPY_DPRINTF("%s: %02x\n", __func__, value); fdctrl->fifo[fdctrl->data_pos++] = value; if (fdctrl->data_pos == fdctrl->data_len) { if (fdctrl->data_state & FD_STATE_FORMAT) { fdctrl_format_sector(fdctrl); return; } pos = command_to_handler[fdctrl->fifo[0] & 0xff]; FLOPPY_DPRINTF("treat %s command\n", handlers[pos].name); (*handlers[pos].handler)(fdctrl, handlers[pos].direction); } }
{ "code": [ " int pos;", " pos %= FD_SECTOR_LEN;", " int pos;", " fdctrl->fifo[fdctrl->data_pos++] = value;" ], "line_no": [ 7, 39, 7, 105 ] }
static void FUNC_0(FDCtrl *VAR_0, uint32_t VAR_1) { FDrive *cur_drv; int VAR_2; if (!(VAR_0->dor & FD_DOR_nRESET)) { FLOPPY_DPRINTF("Floppy controller in RESET state !\n"); return; } if (!(VAR_0->msr & FD_MSR_RQM) || (VAR_0->msr & FD_MSR_DIO)) { FLOPPY_DPRINTF("error: controller not ready for writing\n"); return; } VAR_0->dsr &= ~FD_DSR_PWRDOWN; if (VAR_0->msr & FD_MSR_NONDMA) { VAR_2 = VAR_0->data_pos++; VAR_2 %= FD_SECTOR_LEN; VAR_0->fifo[VAR_2] = VAR_1; if (VAR_2 == FD_SECTOR_LEN - 1 || VAR_0->data_pos == VAR_0->data_len) { cur_drv = get_cur_drv(VAR_0); if (blk_write(cur_drv->blk, fd_sector(cur_drv), VAR_0->fifo, 1) < 0) { FLOPPY_DPRINTF("error writing sector %d\n", fd_sector(cur_drv)); return; } if (!fdctrl_seek_to_next_sect(VAR_0, cur_drv)) { FLOPPY_DPRINTF("error seeking to next sector %d\n", fd_sector(cur_drv)); return; } } if (VAR_0->data_pos == VAR_0->data_len) fdctrl_stop_transfer(VAR_0, 0x00, 0x00, 0x00); return; } if (VAR_0->data_pos == 0) { VAR_2 = command_to_handler[VAR_1 & 0xff]; FLOPPY_DPRINTF("%s command\n", handlers[VAR_2].name); VAR_0->data_len = handlers[VAR_2].parameters + 1; VAR_0->msr |= FD_MSR_CMDBUSY; } FLOPPY_DPRINTF("%s: %02x\n", __func__, VAR_1); VAR_0->fifo[VAR_0->data_pos++] = VAR_1; if (VAR_0->data_pos == VAR_0->data_len) { if (VAR_0->data_state & FD_STATE_FORMAT) { fdctrl_format_sector(VAR_0); return; } VAR_2 = command_to_handler[VAR_0->fifo[0] & 0xff]; FLOPPY_DPRINTF("treat %s command\n", handlers[VAR_2].name); (*handlers[VAR_2].handler)(VAR_0, handlers[VAR_2].direction); } }
[ "static void FUNC_0(FDCtrl *VAR_0, uint32_t VAR_1)\n{", "FDrive *cur_drv;", "int VAR_2;", "if (!(VAR_0->dor & FD_DOR_nRESET)) {", "FLOPPY_DPRINTF(\"Floppy controller in RESET state !\\n\");", "return;", "}", "if (!(VAR_0->msr & FD_MSR_RQM) || (VAR_0->msr & FD_MSR_DIO)) {", "FLOPPY_DPRINTF(\"error: controller not ready for writing\\n\");", "return;", "}", "VAR_0->dsr &= ~FD_DSR_PWRDOWN;", "if (VAR_0->msr & FD_MSR_NONDMA) {", "VAR_2 = VAR_0->data_pos++;", "VAR_2 %= FD_SECTOR_LEN;", "VAR_0->fifo[VAR_2] = VAR_1;", "if (VAR_2 == FD_SECTOR_LEN - 1 ||\nVAR_0->data_pos == VAR_0->data_len) {", "cur_drv = get_cur_drv(VAR_0);", "if (blk_write(cur_drv->blk, fd_sector(cur_drv), VAR_0->fifo, 1)\n< 0) {", "FLOPPY_DPRINTF(\"error writing sector %d\\n\",\nfd_sector(cur_drv));", "return;", "}", "if (!fdctrl_seek_to_next_sect(VAR_0, cur_drv)) {", "FLOPPY_DPRINTF(\"error seeking to next sector %d\\n\",\nfd_sector(cur_drv));", "return;", "}", "}", "if (VAR_0->data_pos == VAR_0->data_len)\nfdctrl_stop_transfer(VAR_0, 0x00, 0x00, 0x00);", "return;", "}", "if (VAR_0->data_pos == 0) {", "VAR_2 = command_to_handler[VAR_1 & 0xff];", "FLOPPY_DPRINTF(\"%s command\\n\", handlers[VAR_2].name);", "VAR_0->data_len = handlers[VAR_2].parameters + 1;", "VAR_0->msr |= FD_MSR_CMDBUSY;", "}", "FLOPPY_DPRINTF(\"%s: %02x\\n\", __func__, VAR_1);", "VAR_0->fifo[VAR_0->data_pos++] = VAR_1;", "if (VAR_0->data_pos == VAR_0->data_len) {", "if (VAR_0->data_state & FD_STATE_FORMAT) {", "fdctrl_format_sector(VAR_0);", "return;", "}", "VAR_2 = command_to_handler[VAR_0->fifo[0] & 0xff];", "FLOPPY_DPRINTF(\"treat %s command\\n\", handlers[VAR_2].name);", "(*handlers[VAR_2].handler)(VAR_0, handlers[VAR_2].direction);", "}", "}" ]
[ 0, 0, 1, 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49, 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ], [ 107 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ] ]
21,832
static uint8_t *scsi_get_buf(SCSIDevice *d, uint32_t tag) { SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, d); SCSIDiskReq *r; r = scsi_find_request(s, tag); if (!r) { BADF("Bad buffer tag 0x%x\n", tag); return NULL; } return (uint8_t *)r->iov.iov_base; }
true
qemu
5c6c0e513600ba57c3e73b7151d3c0664438f7b5
static uint8_t *scsi_get_buf(SCSIDevice *d, uint32_t tag) { SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, d); SCSIDiskReq *r; r = scsi_find_request(s, tag); if (!r) { BADF("Bad buffer tag 0x%x\n", tag); return NULL; } return (uint8_t *)r->iov.iov_base; }
{ "code": [ " SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, d);", " SCSIDiskReq *r;", " r = scsi_find_request(s, tag);", " SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, d);", " SCSIDiskReq *r;", " r = scsi_find_request(s, tag);", " if (!r) {", " SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, d);", " SCSIDiskReq *r;", " r = scsi_find_request(s, tag);", " if (!r) {", "static uint8_t *scsi_get_buf(SCSIDevice *d, uint32_t tag)", " SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, d);", " SCSIDiskReq *r;", " r = scsi_find_request(s, tag);", " if (!r) {", " BADF(\"Bad buffer tag 0x%x\\n\", tag);", " return NULL;", " SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, d);", " SCSIDiskReq *r;", " r = scsi_find_request(s, tag);", " r = scsi_find_request(s, tag);", " r = scsi_find_request(s, tag);", " if (!r) {", " r = scsi_find_request(s, tag);", " if (!r) {", "static uint8_t *scsi_get_buf(SCSIDevice *d, uint32_t tag)", " r = scsi_find_request(s, tag);", " if (!r) {", " BADF(\"Bad buffer tag 0x%x\\n\", tag);", " return NULL;", " r = scsi_find_request(s, tag);" ], "line_no": [ 5, 7, 11, 5, 7, 11, 13, 5, 7, 11, 13, 1, 5, 7, 11, 13, 15, 17, 5, 7, 11, 11, 11, 13, 11, 13, 1, 11, 13, 15, 17, 11 ] }
static uint8_t *FUNC_0(SCSIDevice *d, uint32_t tag) { SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, d); SCSIDiskReq *r; r = scsi_find_request(s, tag); if (!r) { BADF("Bad buffer tag 0x%x\n", tag); return NULL; } return (uint8_t *)r->iov.iov_base; }
[ "static uint8_t *FUNC_0(SCSIDevice *d, uint32_t tag)\n{", "SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, d);", "SCSIDiskReq *r;", "r = scsi_find_request(s, tag);", "if (!r) {", "BADF(\"Bad buffer tag 0x%x\\n\", tag);", "return NULL;", "}", "return (uint8_t *)r->iov.iov_base;", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
21,833
static int noise(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args, uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size, int keyframe){ unsigned int *state= bsfc->priv_data; int amount= args ? atoi(args) : (*state % 10001+1); int i; if(amount <= 0) return AVERROR(EINVAL); *poutbuf= av_malloc(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); memcpy(*poutbuf, buf, buf_size + FF_INPUT_BUFFER_PADDING_SIZE); for(i=0; i<buf_size; i++){ (*state) += (*poutbuf)[i] + 1; if(*state % amount == 0) (*poutbuf)[i] = *state; } return 1; }
true
FFmpeg
67f9bbbb3f6295ca27da7c367f31c6d65339dd4a
static int noise(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args, uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size, int keyframe){ unsigned int *state= bsfc->priv_data; int amount= args ? atoi(args) : (*state % 10001+1); int i; if(amount <= 0) return AVERROR(EINVAL); *poutbuf= av_malloc(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); memcpy(*poutbuf, buf, buf_size + FF_INPUT_BUFFER_PADDING_SIZE); for(i=0; i<buf_size; i++){ (*state) += (*poutbuf)[i] + 1; if(*state % amount == 0) (*poutbuf)[i] = *state; } return 1; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVBitStreamFilterContext *VAR_0, AVCodecContext *VAR_1, const char *VAR_2, uint8_t **VAR_3, int *VAR_4, const uint8_t *VAR_5, int VAR_6, int VAR_7){ unsigned int *VAR_8= VAR_0->priv_data; int VAR_9= VAR_2 ? atoi(VAR_2) : (*VAR_8 % 10001+1); int VAR_10; if(VAR_9 <= 0) return AVERROR(EINVAL); *VAR_3= av_malloc(VAR_6 + FF_INPUT_BUFFER_PADDING_SIZE); memcpy(*VAR_3, VAR_5, VAR_6 + FF_INPUT_BUFFER_PADDING_SIZE); for(VAR_10=0; VAR_10<VAR_6; VAR_10++){ (*VAR_8) += (*VAR_3)[VAR_10] + 1; if(*VAR_8 % VAR_9 == 0) (*VAR_3)[VAR_10] = *VAR_8; } return 1; }
[ "static int FUNC_0(AVBitStreamFilterContext *VAR_0, AVCodecContext *VAR_1, const char *VAR_2,\nuint8_t **VAR_3, int *VAR_4,\nconst uint8_t *VAR_5, int VAR_6, int VAR_7){", "unsigned int *VAR_8= VAR_0->priv_data;", "int VAR_9= VAR_2 ? atoi(VAR_2) : (*VAR_8 % 10001+1);", "int VAR_10;", "if(VAR_9 <= 0)\nreturn AVERROR(EINVAL);", "*VAR_3= av_malloc(VAR_6 + FF_INPUT_BUFFER_PADDING_SIZE);", "memcpy(*VAR_3, VAR_5, VAR_6 + FF_INPUT_BUFFER_PADDING_SIZE);", "for(VAR_10=0; VAR_10<VAR_6; VAR_10++){", "(*VAR_8) += (*VAR_3)[VAR_10] + 1;", "if(*VAR_8 % VAR_9 == 0)\n(*VAR_3)[VAR_10] = *VAR_8;", "}", "return 1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 21 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ] ]
21,834
static void qdev_print_devinfos(bool show_no_user) { static const char *cat_name[DEVICE_CATEGORY_MAX + 1] = { [DEVICE_CATEGORY_BRIDGE] = "Controller/Bridge/Hub", [DEVICE_CATEGORY_USB] = "USB", [DEVICE_CATEGORY_STORAGE] = "Storage", [DEVICE_CATEGORY_NETWORK] = "Network", [DEVICE_CATEGORY_INPUT] = "Input", [DEVICE_CATEGORY_DISPLAY] = "Display", [DEVICE_CATEGORY_SOUND] = "Sound", [DEVICE_CATEGORY_MISC] = "Misc", [DEVICE_CATEGORY_MAX] = "Uncategorized", }; GSList *list, *elt; int i; bool cat_printed; list = g_slist_sort(object_class_get_list(TYPE_DEVICE, false), devinfo_cmp); for (i = 0; i <= DEVICE_CATEGORY_MAX; i++) { cat_printed = false; for (elt = list; elt; elt = elt->next) { DeviceClass *dc = OBJECT_CLASS_CHECK(DeviceClass, elt->data, TYPE_DEVICE); if ((i < DEVICE_CATEGORY_MAX ? !test_bit(i, dc->categories) : !bitmap_empty(dc->categories, DEVICE_CATEGORY_MAX)) || (!show_no_user && dc->no_user)) { continue; } if (!cat_printed) { error_printf("%s%s devices:\n", i ? "\n" : "", cat_name[i]); cat_printed = true; } qdev_print_devinfo(dc); } } g_slist_free(list); }
true
qemu
efec3dd631d94160288392721a5f9c39e50fb2bc
static void qdev_print_devinfos(bool show_no_user) { static const char *cat_name[DEVICE_CATEGORY_MAX + 1] = { [DEVICE_CATEGORY_BRIDGE] = "Controller/Bridge/Hub", [DEVICE_CATEGORY_USB] = "USB", [DEVICE_CATEGORY_STORAGE] = "Storage", [DEVICE_CATEGORY_NETWORK] = "Network", [DEVICE_CATEGORY_INPUT] = "Input", [DEVICE_CATEGORY_DISPLAY] = "Display", [DEVICE_CATEGORY_SOUND] = "Sound", [DEVICE_CATEGORY_MISC] = "Misc", [DEVICE_CATEGORY_MAX] = "Uncategorized", }; GSList *list, *elt; int i; bool cat_printed; list = g_slist_sort(object_class_get_list(TYPE_DEVICE, false), devinfo_cmp); for (i = 0; i <= DEVICE_CATEGORY_MAX; i++) { cat_printed = false; for (elt = list; elt; elt = elt->next) { DeviceClass *dc = OBJECT_CLASS_CHECK(DeviceClass, elt->data, TYPE_DEVICE); if ((i < DEVICE_CATEGORY_MAX ? !test_bit(i, dc->categories) : !bitmap_empty(dc->categories, DEVICE_CATEGORY_MAX)) || (!show_no_user && dc->no_user)) { continue; } if (!cat_printed) { error_printf("%s%s devices:\n", i ? "\n" : "", cat_name[i]); cat_printed = true; } qdev_print_devinfo(dc); } } g_slist_free(list); }
{ "code": [ " || (!show_no_user && dc->no_user)) {" ], "line_no": [ 57 ] }
static void FUNC_0(bool VAR_0) { static const char *VAR_1[DEVICE_CATEGORY_MAX + 1] = { [DEVICE_CATEGORY_BRIDGE] = "Controller/Bridge/Hub", [DEVICE_CATEGORY_USB] = "USB", [DEVICE_CATEGORY_STORAGE] = "Storage", [DEVICE_CATEGORY_NETWORK] = "Network", [DEVICE_CATEGORY_INPUT] = "Input", [DEVICE_CATEGORY_DISPLAY] = "Display", [DEVICE_CATEGORY_SOUND] = "Sound", [DEVICE_CATEGORY_MISC] = "Misc", [DEVICE_CATEGORY_MAX] = "Uncategorized", }; GSList *list, *elt; int VAR_2; bool cat_printed; list = g_slist_sort(object_class_get_list(TYPE_DEVICE, false), devinfo_cmp); for (VAR_2 = 0; VAR_2 <= DEVICE_CATEGORY_MAX; VAR_2++) { cat_printed = false; for (elt = list; elt; elt = elt->next) { DeviceClass *dc = OBJECT_CLASS_CHECK(DeviceClass, elt->data, TYPE_DEVICE); if ((VAR_2 < DEVICE_CATEGORY_MAX ? !test_bit(VAR_2, dc->categories) : !bitmap_empty(dc->categories, DEVICE_CATEGORY_MAX)) || (!VAR_0 && dc->no_user)) { continue; } if (!cat_printed) { error_printf("%s%s devices:\n", VAR_2 ? "\n" : "", VAR_1[VAR_2]); cat_printed = true; } qdev_print_devinfo(dc); } } g_slist_free(list); }
[ "static void FUNC_0(bool VAR_0)\n{", "static const char *VAR_1[DEVICE_CATEGORY_MAX + 1] = {", "[DEVICE_CATEGORY_BRIDGE] = \"Controller/Bridge/Hub\",\n[DEVICE_CATEGORY_USB] = \"USB\",\n[DEVICE_CATEGORY_STORAGE] = \"Storage\",\n[DEVICE_CATEGORY_NETWORK] = \"Network\",\n[DEVICE_CATEGORY_INPUT] = \"Input\",\n[DEVICE_CATEGORY_DISPLAY] = \"Display\",\n[DEVICE_CATEGORY_SOUND] = \"Sound\",\n[DEVICE_CATEGORY_MISC] = \"Misc\",\n[DEVICE_CATEGORY_MAX] = \"Uncategorized\",\n};", "GSList *list, *elt;", "int VAR_2;", "bool cat_printed;", "list = g_slist_sort(object_class_get_list(TYPE_DEVICE, false),\ndevinfo_cmp);", "for (VAR_2 = 0; VAR_2 <= DEVICE_CATEGORY_MAX; VAR_2++) {", "cat_printed = false;", "for (elt = list; elt; elt = elt->next) {", "DeviceClass *dc = OBJECT_CLASS_CHECK(DeviceClass, elt->data,\nTYPE_DEVICE);", "if ((VAR_2 < DEVICE_CATEGORY_MAX\n? !test_bit(VAR_2, dc->categories)\n: !bitmap_empty(dc->categories, DEVICE_CATEGORY_MAX))\n|| (!VAR_0 && dc->no_user)) {", "continue;", "}", "if (!cat_printed) {", "error_printf(\"%s%s devices:\\n\", VAR_2 ? \"\\n\" : \"\",\nVAR_1[VAR_2]);", "cat_printed = true;", "}", "qdev_print_devinfo(dc);", "}", "}", "g_slist_free(list);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 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, 19, 21, 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35, 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51, 53, 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ] ]
21,835
static void uhci_ioport_writew(void *opaque, uint32_t addr, uint32_t val) { UHCIState *s = opaque; addr &= 0x1f; trace_usb_uhci_mmio_writew(addr, val); switch(addr) { case 0x00: if ((val & UHCI_CMD_RS) && !(s->cmd & UHCI_CMD_RS)) { /* start frame processing */ trace_usb_uhci_schedule_start(); s->expire_time = qemu_get_clock_ns(vm_clock) + (get_ticks_per_sec() / FRAME_TIMER_FREQ); qemu_mod_timer(s->frame_timer, qemu_get_clock_ns(vm_clock)); s->status &= ~UHCI_STS_HCHALTED; } else if (!(val & UHCI_CMD_RS)) { s->status |= UHCI_STS_HCHALTED; } if (val & UHCI_CMD_GRESET) { UHCIPort *port; int i; /* send reset on the USB bus */ for(i = 0; i < NB_PORTS; i++) { port = &s->ports[i]; usb_device_reset(port->port.dev); } uhci_reset(s); return; } if (val & UHCI_CMD_HCRESET) { uhci_reset(s); return; } s->cmd = val; break; case 0x02: s->status &= ~val; /* XXX: the chip spec is not coherent, so we add a hidden register to distinguish between IOC and SPD */ if (val & UHCI_STS_USBINT) s->status2 = 0; uhci_update_irq(s); break; case 0x04: s->intr = val; uhci_update_irq(s); break; case 0x06: if (s->status & UHCI_STS_HCHALTED) s->frnum = val & 0x7ff; break; case 0x10 ... 0x1f: { UHCIPort *port; USBDevice *dev; int n; n = (addr >> 1) & 7; if (n >= NB_PORTS) return; port = &s->ports[n]; dev = port->port.dev; if (dev && dev->attached) { /* port reset */ if ( (val & UHCI_PORT_RESET) && !(port->ctrl & UHCI_PORT_RESET) ) { usb_device_reset(dev); } } port->ctrl &= UHCI_PORT_READ_ONLY; /* enabled may only be set if a device is connected */ if (!(port->ctrl & UHCI_PORT_CCS)) { val &= ~UHCI_PORT_EN; } port->ctrl |= (val & ~UHCI_PORT_READ_ONLY); /* some bits are reset when a '1' is written to them */ port->ctrl &= ~(val & UHCI_PORT_WRITE_CLEAR); } break; } }
true
qemu
f8f48b6957bf182339495e6be429f7bdc7ef1981
static void uhci_ioport_writew(void *opaque, uint32_t addr, uint32_t val) { UHCIState *s = opaque; addr &= 0x1f; trace_usb_uhci_mmio_writew(addr, val); switch(addr) { case 0x00: if ((val & UHCI_CMD_RS) && !(s->cmd & UHCI_CMD_RS)) { trace_usb_uhci_schedule_start(); s->expire_time = qemu_get_clock_ns(vm_clock) + (get_ticks_per_sec() / FRAME_TIMER_FREQ); qemu_mod_timer(s->frame_timer, qemu_get_clock_ns(vm_clock)); s->status &= ~UHCI_STS_HCHALTED; } else if (!(val & UHCI_CMD_RS)) { s->status |= UHCI_STS_HCHALTED; } if (val & UHCI_CMD_GRESET) { UHCIPort *port; int i; for(i = 0; i < NB_PORTS; i++) { port = &s->ports[i]; usb_device_reset(port->port.dev); } uhci_reset(s); return; } if (val & UHCI_CMD_HCRESET) { uhci_reset(s); return; } s->cmd = val; break; case 0x02: s->status &= ~val; if (val & UHCI_STS_USBINT) s->status2 = 0; uhci_update_irq(s); break; case 0x04: s->intr = val; uhci_update_irq(s); break; case 0x06: if (s->status & UHCI_STS_HCHALTED) s->frnum = val & 0x7ff; break; case 0x10 ... 0x1f: { UHCIPort *port; USBDevice *dev; int n; n = (addr >> 1) & 7; if (n >= NB_PORTS) return; port = &s->ports[n]; dev = port->port.dev; if (dev && dev->attached) { if ( (val & UHCI_PORT_RESET) && !(port->ctrl & UHCI_PORT_RESET) ) { usb_device_reset(dev); } } port->ctrl &= UHCI_PORT_READ_ONLY; if (!(port->ctrl & UHCI_PORT_CCS)) { val &= ~UHCI_PORT_EN; } port->ctrl |= (val & ~UHCI_PORT_READ_ONLY); port->ctrl &= ~(val & UHCI_PORT_WRITE_CLEAR); } break; } }
{ "code": [ " qemu_mod_timer(s->frame_timer, qemu_get_clock_ns(vm_clock));" ], "line_no": [ 29 ] }
static void FUNC_0(void *VAR_0, uint32_t VAR_1, uint32_t VAR_2) { UHCIState *s = VAR_0; VAR_1 &= 0x1f; trace_usb_uhci_mmio_writew(VAR_1, VAR_2); switch(VAR_1) { case 0x00: if ((VAR_2 & UHCI_CMD_RS) && !(s->cmd & UHCI_CMD_RS)) { trace_usb_uhci_schedule_start(); s->expire_time = qemu_get_clock_ns(vm_clock) + (get_ticks_per_sec() / FRAME_TIMER_FREQ); qemu_mod_timer(s->frame_timer, qemu_get_clock_ns(vm_clock)); s->status &= ~UHCI_STS_HCHALTED; } else if (!(VAR_2 & UHCI_CMD_RS)) { s->status |= UHCI_STS_HCHALTED; } if (VAR_2 & UHCI_CMD_GRESET) { UHCIPort *port; int VAR_3; for(VAR_3 = 0; VAR_3 < NB_PORTS; VAR_3++) { port = &s->ports[VAR_3]; usb_device_reset(port->port.dev); } uhci_reset(s); return; } if (VAR_2 & UHCI_CMD_HCRESET) { uhci_reset(s); return; } s->cmd = VAR_2; break; case 0x02: s->status &= ~VAR_2; if (VAR_2 & UHCI_STS_USBINT) s->status2 = 0; uhci_update_irq(s); break; case 0x04: s->intr = VAR_2; uhci_update_irq(s); break; case 0x06: if (s->status & UHCI_STS_HCHALTED) s->frnum = VAR_2 & 0x7ff; break; case 0x10 ... 0x1f: { UHCIPort *port; USBDevice *dev; int VAR_4; VAR_4 = (VAR_1 >> 1) & 7; if (VAR_4 >= NB_PORTS) return; port = &s->ports[VAR_4]; dev = port->port.dev; if (dev && dev->attached) { if ( (VAR_2 & UHCI_PORT_RESET) && !(port->ctrl & UHCI_PORT_RESET) ) { usb_device_reset(dev); } } port->ctrl &= UHCI_PORT_READ_ONLY; if (!(port->ctrl & UHCI_PORT_CCS)) { VAR_2 &= ~UHCI_PORT_EN; } port->ctrl |= (VAR_2 & ~UHCI_PORT_READ_ONLY); port->ctrl &= ~(VAR_2 & UHCI_PORT_WRITE_CLEAR); } break; } }
[ "static void FUNC_0(void *VAR_0, uint32_t VAR_1, uint32_t VAR_2)\n{", "UHCIState *s = VAR_0;", "VAR_1 &= 0x1f;", "trace_usb_uhci_mmio_writew(VAR_1, VAR_2);", "switch(VAR_1) {", "case 0x00:\nif ((VAR_2 & UHCI_CMD_RS) && !(s->cmd & UHCI_CMD_RS)) {", "trace_usb_uhci_schedule_start();", "s->expire_time = qemu_get_clock_ns(vm_clock) +\n(get_ticks_per_sec() / FRAME_TIMER_FREQ);", "qemu_mod_timer(s->frame_timer, qemu_get_clock_ns(vm_clock));", "s->status &= ~UHCI_STS_HCHALTED;", "} else if (!(VAR_2 & UHCI_CMD_RS)) {", "s->status |= UHCI_STS_HCHALTED;", "}", "if (VAR_2 & UHCI_CMD_GRESET) {", "UHCIPort *port;", "int VAR_3;", "for(VAR_3 = 0; VAR_3 < NB_PORTS; VAR_3++) {", "port = &s->ports[VAR_3];", "usb_device_reset(port->port.dev);", "}", "uhci_reset(s);", "return;", "}", "if (VAR_2 & UHCI_CMD_HCRESET) {", "uhci_reset(s);", "return;", "}", "s->cmd = VAR_2;", "break;", "case 0x02:\ns->status &= ~VAR_2;", "if (VAR_2 & UHCI_STS_USBINT)\ns->status2 = 0;", "uhci_update_irq(s);", "break;", "case 0x04:\ns->intr = VAR_2;", "uhci_update_irq(s);", "break;", "case 0x06:\nif (s->status & UHCI_STS_HCHALTED)\ns->frnum = VAR_2 & 0x7ff;", "break;", "case 0x10 ... 0x1f:\n{", "UHCIPort *port;", "USBDevice *dev;", "int VAR_4;", "VAR_4 = (VAR_1 >> 1) & 7;", "if (VAR_4 >= NB_PORTS)\nreturn;", "port = &s->ports[VAR_4];", "dev = port->port.dev;", "if (dev && dev->attached) {", "if ( (VAR_2 & UHCI_PORT_RESET) &&\n!(port->ctrl & UHCI_PORT_RESET) ) {", "usb_device_reset(dev);", "}", "}", "port->ctrl &= UHCI_PORT_READ_ONLY;", "if (!(port->ctrl & UHCI_PORT_CCS)) {", "VAR_2 &= ~UHCI_PORT_EN;", "}", "port->ctrl |= (VAR_2 & ~UHCI_PORT_READ_ONLY);", "port->ctrl &= ~(VAR_2 & UHCI_PORT_WRITE_CLEAR);", "}", "break;", "}", "}" ]
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15 ], [ 17, 19 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 99, 101, 103 ], [ 105 ], [ 107, 109 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 129 ], [ 133, 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ] ]
21,837
static void to_meta_with_crop(AVCodecContext *avctx, AVFrame *p, int *dest) { int blockx, blocky, x, y; int luma = 0; int height = FFMIN(avctx->height, C64YRES); int width = FFMIN(avctx->width , C64XRES); uint8_t *src = p->data[0]; for (blocky = 0; blocky < C64YRES; blocky += 8) { for (blockx = 0; blockx < C64XRES; blockx += 8) { for (y = blocky; y < blocky + 8 && y < C64YRES; y++) { for (x = blockx; x < blockx + 8 && x < C64XRES; x += 2) { if(x < width && y < height) { /* build average over 2 pixels */ luma = (src[(x + 0 + y * p->linesize[0])] + src[(x + 1 + y * p->linesize[0])]) / 2; /* write blocks as linear data now so they are suitable for elbg */ dest[0] = luma; } dest++; } } } } }
false
FFmpeg
91767360d86ac786571593ab11c7291010ab3829
static void to_meta_with_crop(AVCodecContext *avctx, AVFrame *p, int *dest) { int blockx, blocky, x, y; int luma = 0; int height = FFMIN(avctx->height, C64YRES); int width = FFMIN(avctx->width , C64XRES); uint8_t *src = p->data[0]; for (blocky = 0; blocky < C64YRES; blocky += 8) { for (blockx = 0; blockx < C64XRES; blockx += 8) { for (y = blocky; y < blocky + 8 && y < C64YRES; y++) { for (x = blockx; x < blockx + 8 && x < C64XRES; x += 2) { if(x < width && y < height) { luma = (src[(x + 0 + y * p->linesize[0])] + src[(x + 1 + y * p->linesize[0])]) / 2; dest[0] = luma; } dest++; } } } } }
{ "code": [], "line_no": [] }
static void FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1, int *VAR_2) { int VAR_3, VAR_4, VAR_5, VAR_6; int VAR_7 = 0; int VAR_8 = FFMIN(VAR_0->VAR_8, C64YRES); int VAR_9 = FFMIN(VAR_0->VAR_9 , C64XRES); uint8_t *src = VAR_1->data[0]; for (VAR_4 = 0; VAR_4 < C64YRES; VAR_4 += 8) { for (VAR_3 = 0; VAR_3 < C64XRES; VAR_3 += 8) { for (VAR_6 = VAR_4; VAR_6 < VAR_4 + 8 && VAR_6 < C64YRES; VAR_6++) { for (VAR_5 = VAR_3; VAR_5 < VAR_3 + 8 && VAR_5 < C64XRES; VAR_5 += 2) { if(VAR_5 < VAR_9 && VAR_6 < VAR_8) { VAR_7 = (src[(VAR_5 + 0 + VAR_6 * VAR_1->linesize[0])] + src[(VAR_5 + 1 + VAR_6 * VAR_1->linesize[0])]) / 2; VAR_2[0] = VAR_7; } VAR_2++; } } } } }
[ "static void FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1, int *VAR_2)\n{", "int VAR_3, VAR_4, VAR_5, VAR_6;", "int VAR_7 = 0;", "int VAR_8 = FFMIN(VAR_0->VAR_8, C64YRES);", "int VAR_9 = FFMIN(VAR_0->VAR_9 , C64XRES);", "uint8_t *src = VAR_1->data[0];", "for (VAR_4 = 0; VAR_4 < C64YRES; VAR_4 += 8) {", "for (VAR_3 = 0; VAR_3 < C64XRES; VAR_3 += 8) {", "for (VAR_6 = VAR_4; VAR_6 < VAR_4 + 8 && VAR_6 < C64YRES; VAR_6++) {", "for (VAR_5 = VAR_3; VAR_5 < VAR_3 + 8 && VAR_5 < C64XRES; VAR_5 += 2) {", "if(VAR_5 < VAR_9 && VAR_6 < VAR_8) {", "VAR_7 = (src[(VAR_5 + 0 + VAR_6 * VAR_1->linesize[0])] +\nsrc[(VAR_5 + 1 + VAR_6 * VAR_1->linesize[0])]) / 2;", "VAR_2[0] = VAR_7;", "}", "VAR_2++;", "}", "}", "}", "}", "}" ]
[ 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 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ] ]
21,838
static int jpeg2000_read_bitstream_packets(Jpeg2000DecoderContext *s) { int ret = 0; int tileno; for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++) { Jpeg2000Tile *tile = s->tile + tileno; if (ret = init_tile(s, tileno)) return ret; s->g = tile->tile_part[0].tpg; if (ret = jpeg2000_decode_packets(s, tile)) return ret; } return 0; }
false
FFmpeg
4bfdd967a6b2908c9562f9a0ec731e5745cfa796
static int jpeg2000_read_bitstream_packets(Jpeg2000DecoderContext *s) { int ret = 0; int tileno; for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++) { Jpeg2000Tile *tile = s->tile + tileno; if (ret = init_tile(s, tileno)) return ret; s->g = tile->tile_part[0].tpg; if (ret = jpeg2000_decode_packets(s, tile)) return ret; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(Jpeg2000DecoderContext *VAR_0) { int VAR_1 = 0; int VAR_2; for (VAR_2 = 0; VAR_2 < VAR_0->numXtiles * VAR_0->numYtiles; VAR_2++) { Jpeg2000Tile *tile = VAR_0->tile + VAR_2; if (VAR_1 = init_tile(VAR_0, VAR_2)) return VAR_1; VAR_0->g = tile->tile_part[0].tpg; if (VAR_1 = jpeg2000_decode_packets(VAR_0, tile)) return VAR_1; } return 0; }
[ "static int FUNC_0(Jpeg2000DecoderContext *VAR_0)\n{", "int VAR_1 = 0;", "int VAR_2;", "for (VAR_2 = 0; VAR_2 < VAR_0->numXtiles * VAR_0->numYtiles; VAR_2++) {", "Jpeg2000Tile *tile = VAR_0->tile + VAR_2;", "if (VAR_1 = init_tile(VAR_0, VAR_2))\nreturn VAR_1;", "VAR_0->g = tile->tile_part[0].tpg;", "if (VAR_1 = jpeg2000_decode_packets(VAR_0, tile))\nreturn VAR_1;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 33 ], [ 35 ] ]
21,839
static void RENAME(yuv2yuvX_ar)(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, uint8_t *uDest, uint8_t *vDest, uint8_t *aDest, int dstW, int chrDstW) { if (uDest) { x86_reg uv_off = c->uv_off; YSCALEYUV2YV12X_ACCURATE(CHR_MMX_FILTER_OFFSET, uDest, chrDstW, 0) YSCALEYUV2YV12X_ACCURATE(CHR_MMX_FILTER_OFFSET, vDest - uv_off, chrDstW + uv_off, uv_off) } if (CONFIG_SWSCALE_ALPHA && aDest) { YSCALEYUV2YV12X_ACCURATE(ALP_MMX_FILTER_OFFSET, aDest, dstW, 0) } YSCALEYUV2YV12X_ACCURATE(LUM_MMX_FILTER_OFFSET, dest, dstW, 0) }
false
FFmpeg
13a099799e89a76eb921ca452e1b04a7a28a9855
static void RENAME(yuv2yuvX_ar)(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, uint8_t *uDest, uint8_t *vDest, uint8_t *aDest, int dstW, int chrDstW) { if (uDest) { x86_reg uv_off = c->uv_off; YSCALEYUV2YV12X_ACCURATE(CHR_MMX_FILTER_OFFSET, uDest, chrDstW, 0) YSCALEYUV2YV12X_ACCURATE(CHR_MMX_FILTER_OFFSET, vDest - uv_off, chrDstW + uv_off, uv_off) } if (CONFIG_SWSCALE_ALPHA && aDest) { YSCALEYUV2YV12X_ACCURATE(ALP_MMX_FILTER_OFFSET, aDest, dstW, 0) } YSCALEYUV2YV12X_ACCURATE(LUM_MMX_FILTER_OFFSET, dest, dstW, 0) }
{ "code": [], "line_no": [] }
static void FUNC_0(yuv2yuvX_ar)(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, uint8_t *uDest, uint8_t *vDest, uint8_t *aDest, int dstW, int chrDstW) { if (uDest) { x86_reg uv_off = c->uv_off; YSCALEYUV2YV12X_ACCURATE(CHR_MMX_FILTER_OFFSET, uDest, chrDstW, 0) YSCALEYUV2YV12X_ACCURATE(CHR_MMX_FILTER_OFFSET, vDest - uv_off, chrDstW + uv_off, uv_off) } if (CONFIG_SWSCALE_ALPHA && aDest) { YSCALEYUV2YV12X_ACCURATE(ALP_MMX_FILTER_OFFSET, aDest, dstW, 0) } YSCALEYUV2YV12X_ACCURATE(LUM_MMX_FILTER_OFFSET, dest, dstW, 0) }
[ "static void FUNC_0(yuv2yuvX_ar)(SwsContext *c, const int16_t *lumFilter,\nconst int16_t **lumSrc, int lumFilterSize,\nconst int16_t *chrFilter, const int16_t **chrUSrc,\nconst int16_t **chrVSrc,\nint chrFilterSize, const int16_t **alpSrc,\nuint8_t *dest, uint8_t *uDest, uint8_t *vDest,\nuint8_t *aDest, int dstW, int chrDstW)\n{", "if (uDest) {", "x86_reg uv_off = c->uv_off;", "YSCALEYUV2YV12X_ACCURATE(CHR_MMX_FILTER_OFFSET, uDest, chrDstW, 0)\nYSCALEYUV2YV12X_ACCURATE(CHR_MMX_FILTER_OFFSET, vDest - uv_off, chrDstW + uv_off, uv_off)\n}", "if (CONFIG_SWSCALE_ALPHA && aDest) {", "YSCALEYUV2YV12X_ACCURATE(ALP_MMX_FILTER_OFFSET, aDest, dstW, 0)\n}", "YSCALEYUV2YV12X_ACCURATE(LUM_MMX_FILTER_OFFSET, dest, dstW, 0)\n}" ]
[ 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 ] ]
21,840
av_cold void ff_dsputil_init_x86(DSPContext *c, AVCodecContext *avctx) { int cpu_flags = av_get_cpu_flags(); #if HAVE_7REGS && HAVE_INLINE_ASM if (cpu_flags & AV_CPU_FLAG_CMOV) c->add_hfyu_median_prediction = ff_add_hfyu_median_prediction_cmov; #endif if (cpu_flags & AV_CPU_FLAG_MMX) dsputil_init_mmx(c, avctx, cpu_flags); if (cpu_flags & AV_CPU_FLAG_MMXEXT) dsputil_init_mmxext(c, avctx, cpu_flags); if (cpu_flags & AV_CPU_FLAG_SSE) dsputil_init_sse(c, avctx, cpu_flags); if (cpu_flags & AV_CPU_FLAG_SSE2) dsputil_init_sse2(c, avctx, cpu_flags); if (cpu_flags & AV_CPU_FLAG_SSSE3) dsputil_init_ssse3(c, avctx, cpu_flags); if (cpu_flags & AV_CPU_FLAG_SSE4) dsputil_init_sse4(c, avctx, cpu_flags); if (CONFIG_ENCODERS) ff_dsputilenc_init_mmx(c, avctx); }
false
FFmpeg
6369ba3c9cc74becfaad2a8882dff3dd3e7ae3c0
av_cold void ff_dsputil_init_x86(DSPContext *c, AVCodecContext *avctx) { int cpu_flags = av_get_cpu_flags(); #if HAVE_7REGS && HAVE_INLINE_ASM if (cpu_flags & AV_CPU_FLAG_CMOV) c->add_hfyu_median_prediction = ff_add_hfyu_median_prediction_cmov; #endif if (cpu_flags & AV_CPU_FLAG_MMX) dsputil_init_mmx(c, avctx, cpu_flags); if (cpu_flags & AV_CPU_FLAG_MMXEXT) dsputil_init_mmxext(c, avctx, cpu_flags); if (cpu_flags & AV_CPU_FLAG_SSE) dsputil_init_sse(c, avctx, cpu_flags); if (cpu_flags & AV_CPU_FLAG_SSE2) dsputil_init_sse2(c, avctx, cpu_flags); if (cpu_flags & AV_CPU_FLAG_SSSE3) dsputil_init_ssse3(c, avctx, cpu_flags); if (cpu_flags & AV_CPU_FLAG_SSE4) dsputil_init_sse4(c, avctx, cpu_flags); if (CONFIG_ENCODERS) ff_dsputilenc_init_mmx(c, avctx); }
{ "code": [], "line_no": [] }
av_cold void FUNC_0(DSPContext *c, AVCodecContext *avctx) { int VAR_0 = av_get_cpu_flags(); #if HAVE_7REGS && HAVE_INLINE_ASM if (VAR_0 & AV_CPU_FLAG_CMOV) c->add_hfyu_median_prediction = ff_add_hfyu_median_prediction_cmov; #endif if (VAR_0 & AV_CPU_FLAG_MMX) dsputil_init_mmx(c, avctx, VAR_0); if (VAR_0 & AV_CPU_FLAG_MMXEXT) dsputil_init_mmxext(c, avctx, VAR_0); if (VAR_0 & AV_CPU_FLAG_SSE) dsputil_init_sse(c, avctx, VAR_0); if (VAR_0 & AV_CPU_FLAG_SSE2) dsputil_init_sse2(c, avctx, VAR_0); if (VAR_0 & AV_CPU_FLAG_SSSE3) dsputil_init_ssse3(c, avctx, VAR_0); if (VAR_0 & AV_CPU_FLAG_SSE4) dsputil_init_sse4(c, avctx, VAR_0); if (CONFIG_ENCODERS) ff_dsputilenc_init_mmx(c, avctx); }
[ "av_cold void FUNC_0(DSPContext *c, AVCodecContext *avctx)\n{", "int VAR_0 = av_get_cpu_flags();", "#if HAVE_7REGS && HAVE_INLINE_ASM\nif (VAR_0 & AV_CPU_FLAG_CMOV)\nc->add_hfyu_median_prediction = ff_add_hfyu_median_prediction_cmov;", "#endif\nif (VAR_0 & AV_CPU_FLAG_MMX)\ndsputil_init_mmx(c, avctx, VAR_0);", "if (VAR_0 & AV_CPU_FLAG_MMXEXT)\ndsputil_init_mmxext(c, avctx, VAR_0);", "if (VAR_0 & AV_CPU_FLAG_SSE)\ndsputil_init_sse(c, avctx, VAR_0);", "if (VAR_0 & AV_CPU_FLAG_SSE2)\ndsputil_init_sse2(c, avctx, VAR_0);", "if (VAR_0 & AV_CPU_FLAG_SSSE3)\ndsputil_init_ssse3(c, avctx, VAR_0);", "if (VAR_0 & AV_CPU_FLAG_SSE4)\ndsputil_init_sse4(c, avctx, VAR_0);", "if (CONFIG_ENCODERS)\nff_dsputilenc_init_mmx(c, avctx);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11, 13 ], [ 15, 19, 21 ], [ 25, 27 ], [ 31, 33 ], [ 37, 39 ], [ 43, 45 ], [ 49, 51 ], [ 55, 57 ], [ 59 ] ]
21,842
matroska_read_close (AVFormatContext *s) { MatroskaDemuxContext *matroska = s->priv_data; int n = 0; if (matroska->writing_app) av_free(matroska->writing_app); if (matroska->muxing_app) av_free(matroska->muxing_app); if (matroska->index) av_free(matroska->index); if (matroska->packets != NULL) { for (n = 0; n < matroska->num_packets; n++) { av_free_packet(matroska->packets[n]); av_free(matroska->packets[n]); } av_free(matroska->packets); } for (n = 0; n < matroska->num_tracks; n++) { MatroskaTrack *track = matroska->tracks[n]; if (track->codec_id) av_free(track->codec_id); if (track->codec_name) av_free(track->codec_name); if (track->codec_priv) av_free(track->codec_priv); if (track->name) av_free(track->name); if (track->language) av_free(track->language); av_free(track); } memset(matroska, 0, sizeof(MatroskaDemuxContext)); return 0; }
false
FFmpeg
ce99efc6ffedc7a8fbcc23690d9ff9f7e6f4bf44
matroska_read_close (AVFormatContext *s) { MatroskaDemuxContext *matroska = s->priv_data; int n = 0; if (matroska->writing_app) av_free(matroska->writing_app); if (matroska->muxing_app) av_free(matroska->muxing_app); if (matroska->index) av_free(matroska->index); if (matroska->packets != NULL) { for (n = 0; n < matroska->num_packets; n++) { av_free_packet(matroska->packets[n]); av_free(matroska->packets[n]); } av_free(matroska->packets); } for (n = 0; n < matroska->num_tracks; n++) { MatroskaTrack *track = matroska->tracks[n]; if (track->codec_id) av_free(track->codec_id); if (track->codec_name) av_free(track->codec_name); if (track->codec_priv) av_free(track->codec_priv); if (track->name) av_free(track->name); if (track->language) av_free(track->language); av_free(track); } memset(matroska, 0, sizeof(MatroskaDemuxContext)); return 0; }
{ "code": [], "line_no": [] }
FUNC_0 (AVFormatContext *VAR_0) { MatroskaDemuxContext *matroska = VAR_0->priv_data; int VAR_1 = 0; if (matroska->writing_app) av_free(matroska->writing_app); if (matroska->muxing_app) av_free(matroska->muxing_app); if (matroska->index) av_free(matroska->index); if (matroska->packets != NULL) { for (VAR_1 = 0; VAR_1 < matroska->num_packets; VAR_1++) { av_free_packet(matroska->packets[VAR_1]); av_free(matroska->packets[VAR_1]); } av_free(matroska->packets); } for (VAR_1 = 0; VAR_1 < matroska->num_tracks; VAR_1++) { MatroskaTrack *track = matroska->tracks[VAR_1]; if (track->codec_id) av_free(track->codec_id); if (track->codec_name) av_free(track->codec_name); if (track->codec_priv) av_free(track->codec_priv); if (track->name) av_free(track->name); if (track->language) av_free(track->language); av_free(track); } memset(matroska, 0, sizeof(MatroskaDemuxContext)); return 0; }
[ "FUNC_0 (AVFormatContext *VAR_0)\n{", "MatroskaDemuxContext *matroska = VAR_0->priv_data;", "int VAR_1 = 0;", "if (matroska->writing_app)\nav_free(matroska->writing_app);", "if (matroska->muxing_app)\nav_free(matroska->muxing_app);", "if (matroska->index)\nav_free(matroska->index);", "if (matroska->packets != NULL) {", "for (VAR_1 = 0; VAR_1 < matroska->num_packets; VAR_1++) {", "av_free_packet(matroska->packets[VAR_1]);", "av_free(matroska->packets[VAR_1]);", "}", "av_free(matroska->packets);", "}", "for (VAR_1 = 0; VAR_1 < matroska->num_tracks; VAR_1++) {", "MatroskaTrack *track = matroska->tracks[VAR_1];", "if (track->codec_id)\nav_free(track->codec_id);", "if (track->codec_name)\nav_free(track->codec_name);", "if (track->codec_priv)\nav_free(track->codec_priv);", "if (track->name)\nav_free(track->name);", "if (track->language)\nav_free(track->language);", "av_free(track);", "}", "memset(matroska, 0, sizeof(MatroskaDemuxContext));", "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, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 15, 17 ], [ 19, 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49, 51 ], [ 53, 55 ], [ 57, 59 ], [ 61, 63 ], [ 67 ], [ 69 ], [ 73 ], [ 77 ], [ 79 ] ]
21,844
av_cold int ff_intrax8_common_init(IntraX8Context *w, IDCTDSPContext *idsp, MpegEncContext *const s) { int ret = x8_vlc_init(); if (ret < 0) return ret; w->idsp = *idsp; w->s = s; // two rows, 2 blocks per cannon mb w->prediction_table = av_mallocz(s->mb_width * 2 * 2); if (!w->prediction_table) return AVERROR(ENOMEM); ff_init_scantable(w->idsp.idct_permutation, &w->scantable[0], ff_wmv1_scantable[0]); ff_init_scantable(w->idsp.idct_permutation, &w->scantable[1], ff_wmv1_scantable[2]); ff_init_scantable(w->idsp.idct_permutation, &w->scantable[2], ff_wmv1_scantable[3]); ff_intrax8dsp_init(&w->dsp); return 0; }
false
FFmpeg
1eaae7abb8f208fefb4e8b9e983e61b2499206a3
av_cold int ff_intrax8_common_init(IntraX8Context *w, IDCTDSPContext *idsp, MpegEncContext *const s) { int ret = x8_vlc_init(); if (ret < 0) return ret; w->idsp = *idsp; w->s = s; w->prediction_table = av_mallocz(s->mb_width * 2 * 2); if (!w->prediction_table) return AVERROR(ENOMEM); ff_init_scantable(w->idsp.idct_permutation, &w->scantable[0], ff_wmv1_scantable[0]); ff_init_scantable(w->idsp.idct_permutation, &w->scantable[1], ff_wmv1_scantable[2]); ff_init_scantable(w->idsp.idct_permutation, &w->scantable[2], ff_wmv1_scantable[3]); ff_intrax8dsp_init(&w->dsp); return 0; }
{ "code": [], "line_no": [] }
av_cold int FUNC_0(IntraX8Context *w, IDCTDSPContext *idsp, MpegEncContext *const s) { int VAR_0 = x8_vlc_init(); if (VAR_0 < 0) return VAR_0; w->idsp = *idsp; w->s = s; w->prediction_table = av_mallocz(s->mb_width * 2 * 2); if (!w->prediction_table) return AVERROR(ENOMEM); ff_init_scantable(w->idsp.idct_permutation, &w->scantable[0], ff_wmv1_scantable[0]); ff_init_scantable(w->idsp.idct_permutation, &w->scantable[1], ff_wmv1_scantable[2]); ff_init_scantable(w->idsp.idct_permutation, &w->scantable[2], ff_wmv1_scantable[3]); ff_intrax8dsp_init(&w->dsp); return 0; }
[ "av_cold int FUNC_0(IntraX8Context *w, IDCTDSPContext *idsp,\nMpegEncContext *const s)\n{", "int VAR_0 = x8_vlc_init();", "if (VAR_0 < 0)\nreturn VAR_0;", "w->idsp = *idsp;", "w->s = s;", "w->prediction_table = av_mallocz(s->mb_width * 2 * 2);", "if (!w->prediction_table)\nreturn AVERROR(ENOMEM);", "ff_init_scantable(w->idsp.idct_permutation, &w->scantable[0],\nff_wmv1_scantable[0]);", "ff_init_scantable(w->idsp.idct_permutation, &w->scantable[1],\nff_wmv1_scantable[2]);", "ff_init_scantable(w->idsp.idct_permutation, &w->scantable[2],\nff_wmv1_scantable[3]);", "ff_intrax8dsp_init(&w->dsp);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9, 11 ], [ 15 ], [ 17 ], [ 23 ], [ 25, 27 ], [ 31, 33 ], [ 35, 37 ], [ 39, 41 ], [ 45 ], [ 49 ], [ 51 ] ]
21,845
static int pcm_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { const uint8_t *src = avpkt->data; int buf_size = avpkt->size; PCMDecode *s = avctx->priv_data; int sample_size, c, n, ret, samples_per_block; uint8_t *samples; int32_t *dst_int32_t; sample_size = av_get_bits_per_sample(avctx->codec_id) / 8; /* av_get_bits_per_sample returns 0 for AV_CODEC_ID_PCM_DVD */ samples_per_block = 1; if (AV_CODEC_ID_PCM_DVD == avctx->codec_id) { if (avctx->bits_per_coded_sample != 20 && avctx->bits_per_coded_sample != 24) { av_log(avctx, AV_LOG_ERROR, "PCM DVD unsupported sample depth %i\n", avctx->bits_per_coded_sample); /* 2 samples are interleaved per block in PCM_DVD */ samples_per_block = 2; sample_size = avctx->bits_per_coded_sample * 2 / 8; } else if (avctx->codec_id == AV_CODEC_ID_PCM_LXF) { /* we process 40-bit blocks per channel for LXF */ samples_per_block = 2; sample_size = 5; if (sample_size == 0) { av_log(avctx, AV_LOG_ERROR, "Invalid sample_size\n"); n = avctx->channels * sample_size; if (n && buf_size % n) { if (buf_size < n) { av_log(avctx, AV_LOG_ERROR, "Invalid PCM packet, data has size %d but at least a size of %d was expected\n", buf_size, n); return AVERROR_INVALIDDATA; } else buf_size -= buf_size % n; n = buf_size / sample_size; /* get output buffer */ s->frame.nb_samples = n * samples_per_block / avctx->channels; if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; samples = s->frame.data[0]; switch (avctx->codec->id) { case AV_CODEC_ID_PCM_U32LE: DECODE(32, le32, src, samples, n, 0, 0x80000000) break; case AV_CODEC_ID_PCM_U32BE: DECODE(32, be32, src, samples, n, 0, 0x80000000) break; case AV_CODEC_ID_PCM_S24LE: DECODE(32, le24, src, samples, n, 8, 0) break; case AV_CODEC_ID_PCM_S24BE: DECODE(32, be24, src, samples, n, 8, 0) break; case AV_CODEC_ID_PCM_U24LE: DECODE(32, le24, src, samples, n, 8, 0x800000) break; case AV_CODEC_ID_PCM_U24BE: DECODE(32, be24, src, samples, n, 8, 0x800000) break; case AV_CODEC_ID_PCM_S24DAUD: for (; n > 0; n--) { uint32_t v = bytestream_get_be24(&src); v >>= 4; // sync flags are here AV_WN16A(samples, ff_reverse[(v >> 8) & 0xff] + (ff_reverse[v & 0xff] << 8)); samples += 2; break; case AV_CODEC_ID_PCM_S16LE_PLANAR: { int i; n /= avctx->channels; for (c = 0; c < avctx->channels; c++) { samples = s->frame.extended_data[c]; for (i = n; i > 0; i--) { AV_WN16A(samples, bytestream_get_le16(&src)); samples += 2; break; case AV_CODEC_ID_PCM_U16LE: DECODE(16, le16, src, samples, n, 0, 0x8000) break; case AV_CODEC_ID_PCM_U16BE: DECODE(16, be16, src, samples, n, 0, 0x8000) break; case AV_CODEC_ID_PCM_S8: for (; n > 0; n--) *samples++ = *src++ + 128; break; #if HAVE_BIGENDIAN case AV_CODEC_ID_PCM_F64LE: DECODE(64, le64, src, samples, n, 0, 0) break; case AV_CODEC_ID_PCM_S32LE: case AV_CODEC_ID_PCM_F32LE: DECODE(32, le32, src, samples, n, 0, 0) break; case AV_CODEC_ID_PCM_S16LE: DECODE(16, le16, src, samples, n, 0, 0) break; case AV_CODEC_ID_PCM_F64BE: case AV_CODEC_ID_PCM_F32BE: case AV_CODEC_ID_PCM_S32BE: case AV_CODEC_ID_PCM_S16BE: #else case AV_CODEC_ID_PCM_F64BE: DECODE(64, be64, src, samples, n, 0, 0) break; case AV_CODEC_ID_PCM_F32BE: case AV_CODEC_ID_PCM_S32BE: DECODE(32, be32, src, samples, n, 0, 0) break; case AV_CODEC_ID_PCM_S16BE: DECODE(16, be16, src, samples, n, 0, 0) break; case AV_CODEC_ID_PCM_F64LE: case AV_CODEC_ID_PCM_F32LE: case AV_CODEC_ID_PCM_S32LE: case AV_CODEC_ID_PCM_S16LE: #endif /* HAVE_BIGENDIAN */ case AV_CODEC_ID_PCM_U8: memcpy(samples, src, n * sample_size); break; case AV_CODEC_ID_PCM_ZORK: for (; n > 0; n--) { int v = *src++; if (v < 128) v = 128 - v; *samples++ = v; break; case AV_CODEC_ID_PCM_ALAW: case AV_CODEC_ID_PCM_MULAW: for (; n > 0; n--) { AV_WN16A(samples, s->table[*src++]); samples += 2; break; case AV_CODEC_ID_PCM_DVD: { const uint8_t *src8; dst_int32_t = (int32_t *)s->frame.data[0]; n /= avctx->channels; switch (avctx->bits_per_coded_sample) { case 20: while (n--) { c = avctx->channels; src8 = src + 4 * c; while (c--) { *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8 & 0xf0) << 8); *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8++ & 0x0f) << 12); src = src8; break; case 24: while (n--) { c = avctx->channels; src8 = src + 4 * c; while (c--) { *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8++) << 8); *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8++) << 8); src = src8; break; break; case AV_CODEC_ID_PCM_LXF: { int i; n /= avctx->channels; for (c = 0; c < avctx->channels; c++) { dst_int32_t = (int32_t *)s->frame.extended_data[c]; for (i = 0; i < n; i++) { // extract low 20 bits and expand to 32 bits *dst_int32_t++ = (src[2] << 28) | (src[1] << 20) | (src[0] << 12) | ((src[2] & 0x0F) << 8) | src[1]; // extract high 20 bits and expand to 32 bits *dst_int32_t++ = (src[4] << 24) | (src[3] << 16) | ((src[2] & 0xF0) << 8) | (src[4] << 4) | (src[3] >> 4); src += 5; break; default: return -1; *got_frame_ptr = 1; *(AVFrame *)data = s->frame; return buf_size;
true
FFmpeg
b8551f8ea71b7d6ae39de121213860262d911001
static int pcm_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { const uint8_t *src = avpkt->data; int buf_size = avpkt->size; PCMDecode *s = avctx->priv_data; int sample_size, c, n, ret, samples_per_block; uint8_t *samples; int32_t *dst_int32_t; sample_size = av_get_bits_per_sample(avctx->codec_id) / 8; samples_per_block = 1; if (AV_CODEC_ID_PCM_DVD == avctx->codec_id) { if (avctx->bits_per_coded_sample != 20 && avctx->bits_per_coded_sample != 24) { av_log(avctx, AV_LOG_ERROR, "PCM DVD unsupported sample depth %i\n", avctx->bits_per_coded_sample); samples_per_block = 2; sample_size = avctx->bits_per_coded_sample * 2 / 8; } else if (avctx->codec_id == AV_CODEC_ID_PCM_LXF) { samples_per_block = 2; sample_size = 5; if (sample_size == 0) { av_log(avctx, AV_LOG_ERROR, "Invalid sample_size\n"); n = avctx->channels * sample_size; if (n && buf_size % n) { if (buf_size < n) { av_log(avctx, AV_LOG_ERROR, "Invalid PCM packet, data has size %d but at least a size of %d was expected\n", buf_size, n); return AVERROR_INVALIDDATA; } else buf_size -= buf_size % n; n = buf_size / sample_size; s->frame.nb_samples = n * samples_per_block / avctx->channels; if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; samples = s->frame.data[0]; switch (avctx->codec->id) { case AV_CODEC_ID_PCM_U32LE: DECODE(32, le32, src, samples, n, 0, 0x80000000) break; case AV_CODEC_ID_PCM_U32BE: DECODE(32, be32, src, samples, n, 0, 0x80000000) break; case AV_CODEC_ID_PCM_S24LE: DECODE(32, le24, src, samples, n, 8, 0) break; case AV_CODEC_ID_PCM_S24BE: DECODE(32, be24, src, samples, n, 8, 0) break; case AV_CODEC_ID_PCM_U24LE: DECODE(32, le24, src, samples, n, 8, 0x800000) break; case AV_CODEC_ID_PCM_U24BE: DECODE(32, be24, src, samples, n, 8, 0x800000) break; case AV_CODEC_ID_PCM_S24DAUD: for (; n > 0; n--) { uint32_t v = bytestream_get_be24(&src); v >>= 4; AV_WN16A(samples, ff_reverse[(v >> 8) & 0xff] + (ff_reverse[v & 0xff] << 8)); samples += 2; break; case AV_CODEC_ID_PCM_S16LE_PLANAR: { int i; n /= avctx->channels; for (c = 0; c < avctx->channels; c++) { samples = s->frame.extended_data[c]; for (i = n; i > 0; i--) { AV_WN16A(samples, bytestream_get_le16(&src)); samples += 2; break; case AV_CODEC_ID_PCM_U16LE: DECODE(16, le16, src, samples, n, 0, 0x8000) break; case AV_CODEC_ID_PCM_U16BE: DECODE(16, be16, src, samples, n, 0, 0x8000) break; case AV_CODEC_ID_PCM_S8: for (; n > 0; n--) *samples++ = *src++ + 128; break; #if HAVE_BIGENDIAN case AV_CODEC_ID_PCM_F64LE: DECODE(64, le64, src, samples, n, 0, 0) break; case AV_CODEC_ID_PCM_S32LE: case AV_CODEC_ID_PCM_F32LE: DECODE(32, le32, src, samples, n, 0, 0) break; case AV_CODEC_ID_PCM_S16LE: DECODE(16, le16, src, samples, n, 0, 0) break; case AV_CODEC_ID_PCM_F64BE: case AV_CODEC_ID_PCM_F32BE: case AV_CODEC_ID_PCM_S32BE: case AV_CODEC_ID_PCM_S16BE: #else case AV_CODEC_ID_PCM_F64BE: DECODE(64, be64, src, samples, n, 0, 0) break; case AV_CODEC_ID_PCM_F32BE: case AV_CODEC_ID_PCM_S32BE: DECODE(32, be32, src, samples, n, 0, 0) break; case AV_CODEC_ID_PCM_S16BE: DECODE(16, be16, src, samples, n, 0, 0) break; case AV_CODEC_ID_PCM_F64LE: case AV_CODEC_ID_PCM_F32LE: case AV_CODEC_ID_PCM_S32LE: case AV_CODEC_ID_PCM_S16LE: #endif case AV_CODEC_ID_PCM_U8: memcpy(samples, src, n * sample_size); break; case AV_CODEC_ID_PCM_ZORK: for (; n > 0; n--) { int v = *src++; if (v < 128) v = 128 - v; *samples++ = v; break; case AV_CODEC_ID_PCM_ALAW: case AV_CODEC_ID_PCM_MULAW: for (; n > 0; n--) { AV_WN16A(samples, s->table[*src++]); samples += 2; break; case AV_CODEC_ID_PCM_DVD: { const uint8_t *src8; dst_int32_t = (int32_t *)s->frame.data[0]; n /= avctx->channels; switch (avctx->bits_per_coded_sample) { case 20: while (n--) { c = avctx->channels; src8 = src + 4 * c; while (c--) { *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8 & 0xf0) << 8); *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8++ & 0x0f) << 12); src = src8; break; case 24: while (n--) { c = avctx->channels; src8 = src + 4 * c; while (c--) { *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8++) << 8); *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8++) << 8); src = src8; break; break; case AV_CODEC_ID_PCM_LXF: { int i; n /= avctx->channels; for (c = 0; c < avctx->channels; c++) { dst_int32_t = (int32_t *)s->frame.extended_data[c]; for (i = 0; i < n; i++) { *dst_int32_t++ = (src[2] << 28) | (src[1] << 20) | (src[0] << 12) | ((src[2] & 0x0F) << 8) | src[1]; *dst_int32_t++ = (src[4] << 24) | (src[3] << 16) | ((src[2] & 0xF0) << 8) | (src[4] << 4) | (src[3] >> 4); src += 5; break; default: return -1; *got_frame_ptr = 1; *(AVFrame *)data = s->frame; return buf_size;
{ "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; PCMDecode *s = VAR_0->priv_data; int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10; uint8_t *samples; int32_t *dst_int32_t; VAR_6 = av_get_bits_per_sample(VAR_0->codec_id) / 8; VAR_10 = 1; if (AV_CODEC_ID_PCM_DVD == VAR_0->codec_id) { if (VAR_0->bits_per_coded_sample != 20 && VAR_0->bits_per_coded_sample != 24) { av_log(VAR_0, AV_LOG_ERROR, "PCM DVD unsupported sample depth %VAR_11\VAR_8", VAR_0->bits_per_coded_sample); VAR_10 = 2; VAR_6 = VAR_0->bits_per_coded_sample * 2 / 8; } else if (VAR_0->codec_id == AV_CODEC_ID_PCM_LXF) { VAR_10 = 2; VAR_6 = 5; if (VAR_6 == 0) { av_log(VAR_0, AV_LOG_ERROR, "Invalid VAR_6\VAR_8"); VAR_8 = VAR_0->channels * VAR_6; if (VAR_8 && VAR_5 % VAR_8) { if (VAR_5 < VAR_8) { av_log(VAR_0, AV_LOG_ERROR, "Invalid PCM packet, VAR_1 has size %d but at least a size of %d was expected\VAR_8", VAR_5, VAR_8); return AVERROR_INVALIDDATA; } else VAR_5 -= VAR_5 % VAR_8; VAR_8 = VAR_5 / VAR_6; s->frame.nb_samples = VAR_8 * VAR_10 / VAR_0->channels; if ((VAR_9 = VAR_0->get_buffer(VAR_0, &s->frame)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\VAR_8"); return VAR_9; samples = s->frame.VAR_1[0]; switch (VAR_0->codec->id) { case AV_CODEC_ID_PCM_U32LE: DECODE(32, le32, VAR_4, samples, VAR_8, 0, 0x80000000) break; case AV_CODEC_ID_PCM_U32BE: DECODE(32, be32, VAR_4, samples, VAR_8, 0, 0x80000000) break; case AV_CODEC_ID_PCM_S24LE: DECODE(32, le24, VAR_4, samples, VAR_8, 8, 0) break; case AV_CODEC_ID_PCM_S24BE: DECODE(32, be24, VAR_4, samples, VAR_8, 8, 0) break; case AV_CODEC_ID_PCM_U24LE: DECODE(32, le24, VAR_4, samples, VAR_8, 8, 0x800000) break; case AV_CODEC_ID_PCM_U24BE: DECODE(32, be24, VAR_4, samples, VAR_8, 8, 0x800000) break; case AV_CODEC_ID_PCM_S24DAUD: for (; VAR_8 > 0; VAR_8--) { uint32_t v = bytestream_get_be24(&VAR_4); v >>= 4; AV_WN16A(samples, ff_reverse[(v >> 8) & 0xff] + (ff_reverse[v & 0xff] << 8)); samples += 2; break; case AV_CODEC_ID_PCM_S16LE_PLANAR: { int VAR_11; VAR_8 /= VAR_0->channels; for (VAR_7 = 0; VAR_7 < VAR_0->channels; VAR_7++) { samples = s->frame.extended_data[VAR_7]; for (VAR_11 = VAR_8; VAR_11 > 0; VAR_11--) { AV_WN16A(samples, bytestream_get_le16(&VAR_4)); samples += 2; break; case AV_CODEC_ID_PCM_U16LE: DECODE(16, le16, VAR_4, samples, VAR_8, 0, 0x8000) break; case AV_CODEC_ID_PCM_U16BE: DECODE(16, be16, VAR_4, samples, VAR_8, 0, 0x8000) break; case AV_CODEC_ID_PCM_S8: for (; VAR_8 > 0; VAR_8--) *samples++ = *VAR_4++ + 128; break; #if HAVE_BIGENDIAN case AV_CODEC_ID_PCM_F64LE: DECODE(64, le64, VAR_4, samples, VAR_8, 0, 0) break; case AV_CODEC_ID_PCM_S32LE: case AV_CODEC_ID_PCM_F32LE: DECODE(32, le32, VAR_4, samples, VAR_8, 0, 0) break; case AV_CODEC_ID_PCM_S16LE: DECODE(16, le16, VAR_4, samples, VAR_8, 0, 0) break; case AV_CODEC_ID_PCM_F64BE: case AV_CODEC_ID_PCM_F32BE: case AV_CODEC_ID_PCM_S32BE: case AV_CODEC_ID_PCM_S16BE: #else case AV_CODEC_ID_PCM_F64BE: DECODE(64, be64, VAR_4, samples, VAR_8, 0, 0) break; case AV_CODEC_ID_PCM_F32BE: case AV_CODEC_ID_PCM_S32BE: DECODE(32, be32, VAR_4, samples, VAR_8, 0, 0) break; case AV_CODEC_ID_PCM_S16BE: DECODE(16, be16, VAR_4, samples, VAR_8, 0, 0) break; case AV_CODEC_ID_PCM_F64LE: case AV_CODEC_ID_PCM_F32LE: case AV_CODEC_ID_PCM_S32LE: case AV_CODEC_ID_PCM_S16LE: #endif case AV_CODEC_ID_PCM_U8: memcpy(samples, VAR_4, VAR_8 * VAR_6); break; case AV_CODEC_ID_PCM_ZORK: for (; VAR_8 > 0; VAR_8--) { int v = *VAR_4++; if (v < 128) v = 128 - v; *samples++ = v; break; case AV_CODEC_ID_PCM_ALAW: case AV_CODEC_ID_PCM_MULAW: for (; VAR_8 > 0; VAR_8--) { AV_WN16A(samples, s->table[*VAR_4++]); samples += 2; break; case AV_CODEC_ID_PCM_DVD: { const uint8_t *src8; dst_int32_t = (int32_t *)s->frame.VAR_1[0]; VAR_8 /= VAR_0->channels; switch (VAR_0->bits_per_coded_sample) { case 20: while (VAR_8--) { VAR_7 = VAR_0->channels; src8 = VAR_4 + 4 * VAR_7; while (VAR_7--) { *dst_int32_t++ = (bytestream_get_be16(&VAR_4) << 16) + ((*src8 & 0xf0) << 8); *dst_int32_t++ = (bytestream_get_be16(&VAR_4) << 16) + ((*src8++ & 0x0f) << 12); VAR_4 = src8; break; case 24: while (VAR_8--) { VAR_7 = VAR_0->channels; src8 = VAR_4 + 4 * VAR_7; while (VAR_7--) { *dst_int32_t++ = (bytestream_get_be16(&VAR_4) << 16) + ((*src8++) << 8); *dst_int32_t++ = (bytestream_get_be16(&VAR_4) << 16) + ((*src8++) << 8); VAR_4 = src8; break; break; case AV_CODEC_ID_PCM_LXF: { int VAR_11; VAR_8 /= VAR_0->channels; for (VAR_7 = 0; VAR_7 < VAR_0->channels; VAR_7++) { dst_int32_t = (int32_t *)s->frame.extended_data[VAR_7]; for (VAR_11 = 0; VAR_11 < VAR_8; VAR_11++) { *dst_int32_t++ = (VAR_4[2] << 28) | (VAR_4[1] << 20) | (VAR_4[0] << 12) | ((VAR_4[2] & 0x0F) << 8) | VAR_4[1]; *dst_int32_t++ = (VAR_4[4] << 24) | (VAR_4[3] << 16) | ((VAR_4[2] & 0xF0) << 8) | (VAR_4[4] << 4) | (VAR_4[3] >> 4); VAR_4 += 5; break; default: return -1; *VAR_2 = 1; *(AVFrame *)VAR_1 = s->frame; return 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;", "PCMDecode *s = VAR_0->priv_data;", "int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;", "uint8_t *samples;", "int32_t *dst_int32_t;", "VAR_6 = av_get_bits_per_sample(VAR_0->codec_id) / 8;", "VAR_10 = 1;", "if (AV_CODEC_ID_PCM_DVD == VAR_0->codec_id) {", "if (VAR_0->bits_per_coded_sample != 20 &&\nVAR_0->bits_per_coded_sample != 24) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"PCM DVD unsupported sample depth %VAR_11\\VAR_8\",\nVAR_0->bits_per_coded_sample);", "VAR_10 = 2;", "VAR_6 = VAR_0->bits_per_coded_sample * 2 / 8;", "} else if (VAR_0->codec_id == AV_CODEC_ID_PCM_LXF) {", "VAR_10 = 2;", "VAR_6 = 5;", "if (VAR_6 == 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"Invalid VAR_6\\VAR_8\");", "VAR_8 = VAR_0->channels * VAR_6;", "if (VAR_8 && VAR_5 % VAR_8) {", "if (VAR_5 < VAR_8) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Invalid PCM packet, VAR_1 has size %d but at least a size of %d was expected\\VAR_8\",\nVAR_5, VAR_8);", "return AVERROR_INVALIDDATA;", "} else", "VAR_5 -= VAR_5 % VAR_8;", "VAR_8 = VAR_5 / VAR_6;", "s->frame.nb_samples = VAR_8 * VAR_10 / VAR_0->channels;", "if ((VAR_9 = VAR_0->get_buffer(VAR_0, &s->frame)) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"get_buffer() failed\\VAR_8\");", "return VAR_9;", "samples = s->frame.VAR_1[0];", "switch (VAR_0->codec->id) {", "case AV_CODEC_ID_PCM_U32LE:\nDECODE(32, le32, VAR_4, samples, VAR_8, 0, 0x80000000)\nbreak;", "case AV_CODEC_ID_PCM_U32BE:\nDECODE(32, be32, VAR_4, samples, VAR_8, 0, 0x80000000)\nbreak;", "case AV_CODEC_ID_PCM_S24LE:\nDECODE(32, le24, VAR_4, samples, VAR_8, 8, 0)\nbreak;", "case AV_CODEC_ID_PCM_S24BE:\nDECODE(32, be24, VAR_4, samples, VAR_8, 8, 0)\nbreak;", "case AV_CODEC_ID_PCM_U24LE:\nDECODE(32, le24, VAR_4, samples, VAR_8, 8, 0x800000)\nbreak;", "case AV_CODEC_ID_PCM_U24BE:\nDECODE(32, be24, VAR_4, samples, VAR_8, 8, 0x800000)\nbreak;", "case AV_CODEC_ID_PCM_S24DAUD:\nfor (; VAR_8 > 0; VAR_8--) {", "uint32_t v = bytestream_get_be24(&VAR_4);", "v >>= 4;", "AV_WN16A(samples, ff_reverse[(v >> 8) & 0xff] +\n(ff_reverse[v & 0xff] << 8));", "samples += 2;", "break;", "case AV_CODEC_ID_PCM_S16LE_PLANAR:\n{", "int VAR_11;", "VAR_8 /= VAR_0->channels;", "for (VAR_7 = 0; VAR_7 < VAR_0->channels; VAR_7++) {", "samples = s->frame.extended_data[VAR_7];", "for (VAR_11 = VAR_8; VAR_11 > 0; VAR_11--) {", "AV_WN16A(samples, bytestream_get_le16(&VAR_4));", "samples += 2;", "break;", "case AV_CODEC_ID_PCM_U16LE:\nDECODE(16, le16, VAR_4, samples, VAR_8, 0, 0x8000)\nbreak;", "case AV_CODEC_ID_PCM_U16BE:\nDECODE(16, be16, VAR_4, samples, VAR_8, 0, 0x8000)\nbreak;", "case AV_CODEC_ID_PCM_S8:\nfor (; VAR_8 > 0; VAR_8--)", "*samples++ = *VAR_4++ + 128;", "break;", "#if HAVE_BIGENDIAN\ncase AV_CODEC_ID_PCM_F64LE:\nDECODE(64, le64, VAR_4, samples, VAR_8, 0, 0)\nbreak;", "case AV_CODEC_ID_PCM_S32LE:\ncase AV_CODEC_ID_PCM_F32LE:\nDECODE(32, le32, VAR_4, samples, VAR_8, 0, 0)\nbreak;", "case AV_CODEC_ID_PCM_S16LE:\nDECODE(16, le16, VAR_4, samples, VAR_8, 0, 0)\nbreak;", "case AV_CODEC_ID_PCM_F64BE:\ncase AV_CODEC_ID_PCM_F32BE:\ncase AV_CODEC_ID_PCM_S32BE:\ncase AV_CODEC_ID_PCM_S16BE:\n#else\ncase AV_CODEC_ID_PCM_F64BE:\nDECODE(64, be64, VAR_4, samples, VAR_8, 0, 0)\nbreak;", "case AV_CODEC_ID_PCM_F32BE:\ncase AV_CODEC_ID_PCM_S32BE:\nDECODE(32, be32, VAR_4, samples, VAR_8, 0, 0)\nbreak;", "case AV_CODEC_ID_PCM_S16BE:\nDECODE(16, be16, VAR_4, samples, VAR_8, 0, 0)\nbreak;", "case AV_CODEC_ID_PCM_F64LE:\ncase AV_CODEC_ID_PCM_F32LE:\ncase AV_CODEC_ID_PCM_S32LE:\ncase AV_CODEC_ID_PCM_S16LE:\n#endif\ncase AV_CODEC_ID_PCM_U8:\nmemcpy(samples, VAR_4, VAR_8 * VAR_6);", "break;", "case AV_CODEC_ID_PCM_ZORK:\nfor (; VAR_8 > 0; VAR_8--) {", "int v = *VAR_4++;", "if (v < 128)\nv = 128 - v;", "*samples++ = v;", "break;", "case AV_CODEC_ID_PCM_ALAW:\ncase AV_CODEC_ID_PCM_MULAW:\nfor (; VAR_8 > 0; VAR_8--) {", "AV_WN16A(samples, s->table[*VAR_4++]);", "samples += 2;", "break;", "case AV_CODEC_ID_PCM_DVD:\n{", "const uint8_t *src8;", "dst_int32_t = (int32_t *)s->frame.VAR_1[0];", "VAR_8 /= VAR_0->channels;", "switch (VAR_0->bits_per_coded_sample) {", "case 20:\nwhile (VAR_8--) {", "VAR_7 = VAR_0->channels;", "src8 = VAR_4 + 4 * VAR_7;", "while (VAR_7--) {", "*dst_int32_t++ = (bytestream_get_be16(&VAR_4) << 16) + ((*src8 & 0xf0) << 8);", "*dst_int32_t++ = (bytestream_get_be16(&VAR_4) << 16) + ((*src8++ & 0x0f) << 12);", "VAR_4 = src8;", "break;", "case 24:\nwhile (VAR_8--) {", "VAR_7 = VAR_0->channels;", "src8 = VAR_4 + 4 * VAR_7;", "while (VAR_7--) {", "*dst_int32_t++ = (bytestream_get_be16(&VAR_4) << 16) + ((*src8++) << 8);", "*dst_int32_t++ = (bytestream_get_be16(&VAR_4) << 16) + ((*src8++) << 8);", "VAR_4 = src8;", "break;", "break;", "case AV_CODEC_ID_PCM_LXF:\n{", "int VAR_11;", "VAR_8 /= VAR_0->channels;", "for (VAR_7 = 0; VAR_7 < VAR_0->channels; VAR_7++) {", "dst_int32_t = (int32_t *)s->frame.extended_data[VAR_7];", "for (VAR_11 = 0; VAR_11 < VAR_8; VAR_11++) {", "*dst_int32_t++ = (VAR_4[2] << 28) |\n(VAR_4[1] << 20) |\n(VAR_4[0] << 12) |\n((VAR_4[2] & 0x0F) << 8) |\nVAR_4[1];", "*dst_int32_t++ = (VAR_4[4] << 24) |\n(VAR_4[3] << 16) |\n((VAR_4[2] & 0xF0) << 8) |\n(VAR_4[4] << 4) |\n(VAR_4[3] >> 4);", "VAR_4 += 5;", "break;", "default:\nreturn -1;", "*VAR_2 = 1;", "*(AVFrame *)VAR_1 = s->frame;", "return VAR_5;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 12 ], [ 13 ], [ 14, 15 ], [ 16, 17, 18 ], [ 20 ], [ 21 ], [ 22 ], [ 24 ], [ 25 ], [ 26 ], [ 27 ], [ 28 ], [ 29 ], [ 30 ], [ 31, 32, 33 ], [ 34 ], [ 35 ], [ 36 ], [ 37 ], [ 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 ], [ 77 ], [ 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 ], [ 130 ], [ 131 ], [ 132, 133, 134 ], [ 135 ], [ 136 ], [ 137 ], [ 138, 139 ], [ 140 ], [ 141 ], [ 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 ], [ 167 ], [ 168 ], [ 169 ], [ 171, 172, 173, 174, 175 ], [ 177, 178, 179, 180, 181 ], [ 182 ], [ 183 ], [ 184, 185 ], [ 186 ], [ 187 ], [ 188 ] ]
21,846
static void vfio_probe_rtl8168_bar2_quirk(VFIOPCIDevice *vdev, int nr) { VFIOQuirk *quirk; VFIOrtl8168Quirk *rtl; if (!vfio_pci_is(vdev, PCI_VENDOR_ID_REALTEK, 0x8168) || nr != 2) { return; } quirk = g_malloc0(sizeof(*quirk)); quirk->mem = g_malloc0(sizeof(MemoryRegion) * 2); quirk->nr_mem = 2; quirk->data = rtl = g_malloc0(sizeof(*rtl)); rtl->vdev = vdev; memory_region_init_io(&quirk->mem[0], OBJECT(vdev), &vfio_rtl_address_quirk, rtl, "vfio-rtl8168-window-address-quirk", 4); memory_region_add_subregion_overlap(&vdev->bars[nr].region.mem, 0x74, &quirk->mem[0], 1); memory_region_init_io(&quirk->mem[1], OBJECT(vdev), &vfio_rtl_data_quirk, rtl, "vfio-rtl8168-window-data-quirk", 4); memory_region_add_subregion_overlap(&vdev->bars[nr].region.mem, 0x70, &quirk->mem[1], 1); QLIST_INSERT_HEAD(&vdev->bars[nr].quirks, quirk, next); trace_vfio_quirk_rtl8168_probe(vdev->vbasedev.name); }
true
qemu
bdd81addf4033ce26e6cd180b060f63095f3ded9
static void vfio_probe_rtl8168_bar2_quirk(VFIOPCIDevice *vdev, int nr) { VFIOQuirk *quirk; VFIOrtl8168Quirk *rtl; if (!vfio_pci_is(vdev, PCI_VENDOR_ID_REALTEK, 0x8168) || nr != 2) { return; } quirk = g_malloc0(sizeof(*quirk)); quirk->mem = g_malloc0(sizeof(MemoryRegion) * 2); quirk->nr_mem = 2; quirk->data = rtl = g_malloc0(sizeof(*rtl)); rtl->vdev = vdev; memory_region_init_io(&quirk->mem[0], OBJECT(vdev), &vfio_rtl_address_quirk, rtl, "vfio-rtl8168-window-address-quirk", 4); memory_region_add_subregion_overlap(&vdev->bars[nr].region.mem, 0x74, &quirk->mem[0], 1); memory_region_init_io(&quirk->mem[1], OBJECT(vdev), &vfio_rtl_data_quirk, rtl, "vfio-rtl8168-window-data-quirk", 4); memory_region_add_subregion_overlap(&vdev->bars[nr].region.mem, 0x70, &quirk->mem[1], 1); QLIST_INSERT_HEAD(&vdev->bars[nr].quirks, quirk, next); trace_vfio_quirk_rtl8168_probe(vdev->vbasedev.name); }
{ "code": [ " quirk->mem = g_malloc0(sizeof(MemoryRegion) * 2);", " quirk->mem = g_malloc0(sizeof(MemoryRegion) * 2);", " quirk->mem = g_malloc0(sizeof(MemoryRegion) * 2);" ], "line_no": [ 21, 21, 21 ] }
static void FUNC_0(VFIOPCIDevice *VAR_0, int VAR_1) { VFIOQuirk *quirk; VFIOrtl8168Quirk *rtl; if (!vfio_pci_is(VAR_0, PCI_VENDOR_ID_REALTEK, 0x8168) || VAR_1 != 2) { return; } quirk = g_malloc0(sizeof(*quirk)); quirk->mem = g_malloc0(sizeof(MemoryRegion) * 2); quirk->nr_mem = 2; quirk->data = rtl = g_malloc0(sizeof(*rtl)); rtl->VAR_0 = VAR_0; memory_region_init_io(&quirk->mem[0], OBJECT(VAR_0), &vfio_rtl_address_quirk, rtl, "vfio-rtl8168-window-address-quirk", 4); memory_region_add_subregion_overlap(&VAR_0->bars[VAR_1].region.mem, 0x74, &quirk->mem[0], 1); memory_region_init_io(&quirk->mem[1], OBJECT(VAR_0), &vfio_rtl_data_quirk, rtl, "vfio-rtl8168-window-data-quirk", 4); memory_region_add_subregion_overlap(&VAR_0->bars[VAR_1].region.mem, 0x70, &quirk->mem[1], 1); QLIST_INSERT_HEAD(&VAR_0->bars[VAR_1].quirks, quirk, next); trace_vfio_quirk_rtl8168_probe(VAR_0->vbasedev.name); }
[ "static void FUNC_0(VFIOPCIDevice *VAR_0, int VAR_1)\n{", "VFIOQuirk *quirk;", "VFIOrtl8168Quirk *rtl;", "if (!vfio_pci_is(VAR_0, PCI_VENDOR_ID_REALTEK, 0x8168) || VAR_1 != 2) {", "return;", "}", "quirk = g_malloc0(sizeof(*quirk));", "quirk->mem = g_malloc0(sizeof(MemoryRegion) * 2);", "quirk->nr_mem = 2;", "quirk->data = rtl = g_malloc0(sizeof(*rtl));", "rtl->VAR_0 = VAR_0;", "memory_region_init_io(&quirk->mem[0], OBJECT(VAR_0),\n&vfio_rtl_address_quirk, rtl,\n\"vfio-rtl8168-window-address-quirk\", 4);", "memory_region_add_subregion_overlap(&VAR_0->bars[VAR_1].region.mem,\n0x74, &quirk->mem[0], 1);", "memory_region_init_io(&quirk->mem[1], OBJECT(VAR_0),\n&vfio_rtl_data_quirk, rtl,\n\"vfio-rtl8168-window-data-quirk\", 4);", "memory_region_add_subregion_overlap(&VAR_0->bars[VAR_1].region.mem,\n0x70, &quirk->mem[1], 1);", "QLIST_INSERT_HEAD(&VAR_0->bars[VAR_1].quirks, quirk, next);", "trace_vfio_quirk_rtl8168_probe(VAR_0->vbasedev.name);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31, 33, 35 ], [ 37, 39 ], [ 43, 45, 47 ], [ 49, 51 ], [ 55 ], [ 59 ], [ 61 ] ]
21,847
static int gif_read_header1(GifState *s) { ByteIOContext *f = s->f; uint8_t sig[6]; int ret, v, n; int has_global_palette; /* read gif signature */ ret = get_buffer(f, sig, 6); if (ret != 6) return -1; if (memcmp(sig, gif87a_sig, 6) != 0 && memcmp(sig, gif89a_sig, 6) != 0) return -1; /* read screen header */ s->transparent_color_index = -1; s->screen_width = get_le16(f); s->screen_height = get_le16(f); if( (unsigned)s->screen_width > 32767 || (unsigned)s->screen_height > 32767){ av_log(NULL, AV_LOG_ERROR, "picture size too large\n"); return -1; } v = get_byte(f); s->color_resolution = ((v & 0x70) >> 4) + 1; has_global_palette = (v & 0x80); s->bits_per_pixel = (v & 0x07) + 1; s->background_color_index = get_byte(f); get_byte(f); /* ignored */ #ifdef DEBUG printf("gif: screen_w=%d screen_h=%d bpp=%d global_palette=%d\n", s->screen_width, s->screen_height, s->bits_per_pixel, has_global_palette); #endif if (has_global_palette) { n = 1 << s->bits_per_pixel; get_buffer(f, s->global_palette, n * 3); } return 0; }
true
FFmpeg
0b54f3c0878a3acaa9142e4f24942e762d97e350
static int gif_read_header1(GifState *s) { ByteIOContext *f = s->f; uint8_t sig[6]; int ret, v, n; int has_global_palette; ret = get_buffer(f, sig, 6); if (ret != 6) return -1; if (memcmp(sig, gif87a_sig, 6) != 0 && memcmp(sig, gif89a_sig, 6) != 0) return -1; s->transparent_color_index = -1; s->screen_width = get_le16(f); s->screen_height = get_le16(f); if( (unsigned)s->screen_width > 32767 || (unsigned)s->screen_height > 32767){ av_log(NULL, AV_LOG_ERROR, "picture size too large\n"); return -1; } v = get_byte(f); s->color_resolution = ((v & 0x70) >> 4) + 1; has_global_palette = (v & 0x80); s->bits_per_pixel = (v & 0x07) + 1; s->background_color_index = get_byte(f); get_byte(f); #ifdef DEBUG printf("gif: screen_w=%d screen_h=%d bpp=%d global_palette=%d\n", s->screen_width, s->screen_height, s->bits_per_pixel, has_global_palette); #endif if (has_global_palette) { n = 1 << s->bits_per_pixel; get_buffer(f, s->global_palette, n * 3); } return 0; }
{ "code": [ " return 0;", " ByteIOContext *f = s->f;", "#ifdef DEBUG", "#endif", " return 0;", " ByteIOContext *f = s->f;", "#ifdef DEBUG", "#endif", "#ifdef DEBUG", "#endif", "#ifdef DEBUG", "#endif", " return 0;", "static int gif_read_header1(GifState *s)", " ByteIOContext *f = s->f;", " uint8_t sig[6];", " int ret, v, n;", " int has_global_palette;", " ret = get_buffer(f, sig, 6);", " if (ret != 6)", " return -1;", " if (memcmp(sig, gif87a_sig, 6) != 0 &&", " memcmp(sig, gif89a_sig, 6) != 0)", " return -1;", " s->transparent_color_index = -1;", " s->screen_width = get_le16(f);", " s->screen_height = get_le16(f);", " if( (unsigned)s->screen_width > 32767", " || (unsigned)s->screen_height > 32767){", " av_log(NULL, AV_LOG_ERROR, \"picture size too large\\n\");", " return -1;", " v = get_byte(f);", " s->color_resolution = ((v & 0x70) >> 4) + 1;", " has_global_palette = (v & 0x80);", " s->bits_per_pixel = (v & 0x07) + 1;", " s->background_color_index = get_byte(f);", "#ifdef DEBUG", " printf(\"gif: screen_w=%d screen_h=%d bpp=%d global_palette=%d\\n\",", " s->screen_width, s->screen_height, s->bits_per_pixel,", " has_global_palette);", "#endif", " if (has_global_palette) {", " n = 1 << s->bits_per_pixel;", " get_buffer(f, s->global_palette, n * 3);", " return 0;", " ByteIOContext *f = s->f;", "#ifdef DEBUG", "#endif", " return -1;", " return -1;", " return 0;", " return 0;", " return 0;" ], "line_no": [ 81, 5, 63, 71, 81, 5, 63, 71, 63, 71, 63, 71, 81, 1, 5, 7, 9, 11, 17, 19, 21, 23, 25, 21, 33, 35, 37, 39, 41, 43, 21, 51, 53, 55, 57, 59, 63, 65, 67, 69, 71, 73, 75, 77, 81, 5, 63, 71, 21, 21, 81, 81, 81 ] }
static int FUNC_0(GifState *VAR_0) { ByteIOContext *f = VAR_0->f; uint8_t sig[6]; int VAR_1, VAR_2, VAR_3; int VAR_4; VAR_1 = get_buffer(f, sig, 6); if (VAR_1 != 6) return -1; if (memcmp(sig, gif87a_sig, 6) != 0 && memcmp(sig, gif89a_sig, 6) != 0) return -1; VAR_0->transparent_color_index = -1; VAR_0->screen_width = get_le16(f); VAR_0->screen_height = get_le16(f); if( (unsigned)VAR_0->screen_width > 32767 || (unsigned)VAR_0->screen_height > 32767){ av_log(NULL, AV_LOG_ERROR, "picture size too large\VAR_3"); return -1; } VAR_2 = get_byte(f); VAR_0->color_resolution = ((VAR_2 & 0x70) >> 4) + 1; VAR_4 = (VAR_2 & 0x80); VAR_0->bits_per_pixel = (VAR_2 & 0x07) + 1; VAR_0->background_color_index = get_byte(f); get_byte(f); #ifdef DEBUG printf("gif: screen_w=%d screen_h=%d bpp=%d global_palette=%d\VAR_3", VAR_0->screen_width, VAR_0->screen_height, VAR_0->bits_per_pixel, VAR_4); #endif if (VAR_4) { VAR_3 = 1 << VAR_0->bits_per_pixel; get_buffer(f, VAR_0->global_palette, VAR_3 * 3); } return 0; }
[ "static int FUNC_0(GifState *VAR_0)\n{", "ByteIOContext *f = VAR_0->f;", "uint8_t sig[6];", "int VAR_1, VAR_2, VAR_3;", "int VAR_4;", "VAR_1 = get_buffer(f, sig, 6);", "if (VAR_1 != 6)\nreturn -1;", "if (memcmp(sig, gif87a_sig, 6) != 0 &&\nmemcmp(sig, gif89a_sig, 6) != 0)\nreturn -1;", "VAR_0->transparent_color_index = -1;", "VAR_0->screen_width = get_le16(f);", "VAR_0->screen_height = get_le16(f);", "if( (unsigned)VAR_0->screen_width > 32767\n|| (unsigned)VAR_0->screen_height > 32767){", "av_log(NULL, AV_LOG_ERROR, \"picture size too large\\VAR_3\");", "return -1;", "}", "VAR_2 = get_byte(f);", "VAR_0->color_resolution = ((VAR_2 & 0x70) >> 4) + 1;", "VAR_4 = (VAR_2 & 0x80);", "VAR_0->bits_per_pixel = (VAR_2 & 0x07) + 1;", "VAR_0->background_color_index = get_byte(f);", "get_byte(f);", "#ifdef DEBUG\nprintf(\"gif: screen_w=%d screen_h=%d bpp=%d global_palette=%d\\VAR_3\",\nVAR_0->screen_width, VAR_0->screen_height, VAR_0->bits_per_pixel,\nVAR_4);", "#endif\nif (VAR_4) {", "VAR_3 = 1 << VAR_0->bits_per_pixel;", "get_buffer(f, VAR_0->global_palette, VAR_3 * 3);", "}", "return 0;", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 17 ], [ 19, 21 ], [ 23, 25, 27 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65, 67, 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ] ]
21,848
int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required, int mq_required) { struct ifreq ifr; int fd, ret; int len = sizeof(struct virtio_net_hdr); TFR(fd = open(PATH_NET_TUN, O_RDWR)); if (fd < 0) { error_report("could not open %s: %m", PATH_NET_TUN); return -1; } memset(&ifr, 0, sizeof(ifr)); ifr.ifr_flags = IFF_TAP | IFF_NO_PI; if (*vnet_hdr) { unsigned int features; if (ioctl(fd, TUNGETFEATURES, &features) == 0 && features & IFF_VNET_HDR) { *vnet_hdr = 1; ifr.ifr_flags |= IFF_VNET_HDR; } else { *vnet_hdr = 0; } if (vnet_hdr_required && !*vnet_hdr) { error_report("vnet_hdr=1 requested, but no kernel " "support for IFF_VNET_HDR available"); close(fd); return -1; } /* * Make sure vnet header size has the default value: for a persistent * tap it might have been modified e.g. by another instance of qemu. * Ignore errors since old kernels do not support this ioctl: in this * case the header size implicitly has the correct value. */ ioctl(fd, TUNSETVNETHDRSZ, &len); } if (mq_required) { unsigned int features; if ((ioctl(fd, TUNGETFEATURES, &features) != 0) || !(features & IFF_MULTI_QUEUE)) { error_report("multiqueue required, but no kernel " "support for IFF_MULTI_QUEUE available"); close(fd); return -1; } else { ifr.ifr_flags |= IFF_MULTI_QUEUE; } } if (ifname[0] != '\0') pstrcpy(ifr.ifr_name, IFNAMSIZ, ifname); else pstrcpy(ifr.ifr_name, IFNAMSIZ, "tap%d"); ret = ioctl(fd, TUNSETIFF, (void *) &ifr); if (ret != 0) { if (ifname[0] != '\0') { error_report("could not configure %s (%s): %m", PATH_NET_TUN, ifr.ifr_name); } else { error_report("could not configure %s: %m", PATH_NET_TUN); } close(fd); return -1; } pstrcpy(ifname, ifname_size, ifr.ifr_name); fcntl(fd, F_SETFL, O_NONBLOCK); return fd; }
true
qemu
d26e445c80fddcc7483b83f3115e5067fef28fe6
int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required, int mq_required) { struct ifreq ifr; int fd, ret; int len = sizeof(struct virtio_net_hdr); TFR(fd = open(PATH_NET_TUN, O_RDWR)); if (fd < 0) { error_report("could not open %s: %m", PATH_NET_TUN); return -1; } memset(&ifr, 0, sizeof(ifr)); ifr.ifr_flags = IFF_TAP | IFF_NO_PI; if (*vnet_hdr) { unsigned int features; if (ioctl(fd, TUNGETFEATURES, &features) == 0 && features & IFF_VNET_HDR) { *vnet_hdr = 1; ifr.ifr_flags |= IFF_VNET_HDR; } else { *vnet_hdr = 0; } if (vnet_hdr_required && !*vnet_hdr) { error_report("vnet_hdr=1 requested, but no kernel " "support for IFF_VNET_HDR available"); close(fd); return -1; } ioctl(fd, TUNSETVNETHDRSZ, &len); } if (mq_required) { unsigned int features; if ((ioctl(fd, TUNGETFEATURES, &features) != 0) || !(features & IFF_MULTI_QUEUE)) { error_report("multiqueue required, but no kernel " "support for IFF_MULTI_QUEUE available"); close(fd); return -1; } else { ifr.ifr_flags |= IFF_MULTI_QUEUE; } } if (ifname[0] != '\0') pstrcpy(ifr.ifr_name, IFNAMSIZ, ifname); else pstrcpy(ifr.ifr_name, IFNAMSIZ, "tap%d"); ret = ioctl(fd, TUNSETIFF, (void *) &ifr); if (ret != 0) { if (ifname[0] != '\0') { error_report("could not configure %s (%s): %m", PATH_NET_TUN, ifr.ifr_name); } else { error_report("could not configure %s: %m", PATH_NET_TUN); } close(fd); return -1; } pstrcpy(ifname, ifname_size, ifr.ifr_name); fcntl(fd, F_SETFL, O_NONBLOCK); return fd; }
{ "code": [ " if (*vnet_hdr) {", " unsigned int features;", " unsigned int features;" ], "line_no": [ 31, 33, 33 ] }
int FUNC_0(char *VAR_0, int VAR_1, int *VAR_2, int VAR_3, int VAR_4) { struct ifreq VAR_5; int VAR_6, VAR_7; int VAR_8 = sizeof(struct virtio_net_hdr); TFR(VAR_6 = open(PATH_NET_TUN, O_RDWR)); if (VAR_6 < 0) { error_report("could not open %s: %m", PATH_NET_TUN); return -1; } memset(&VAR_5, 0, sizeof(VAR_5)); VAR_5.ifr_flags = IFF_TAP | IFF_NO_PI; if (*VAR_2) { unsigned int VAR_10; if (ioctl(VAR_6, TUNGETFEATURES, &VAR_10) == 0 && VAR_10 & IFF_VNET_HDR) { *VAR_2 = 1; VAR_5.ifr_flags |= IFF_VNET_HDR; } else { *VAR_2 = 0; } if (VAR_3 && !*VAR_2) { error_report("VAR_2=1 requested, but no kernel " "support for IFF_VNET_HDR available"); close(VAR_6); return -1; } ioctl(VAR_6, TUNSETVNETHDRSZ, &VAR_8); } if (VAR_4) { unsigned int VAR_10; if ((ioctl(VAR_6, TUNGETFEATURES, &VAR_10) != 0) || !(VAR_10 & IFF_MULTI_QUEUE)) { error_report("multiqueue required, but no kernel " "support for IFF_MULTI_QUEUE available"); close(VAR_6); return -1; } else { VAR_5.ifr_flags |= IFF_MULTI_QUEUE; } } if (VAR_0[0] != '\0') pstrcpy(VAR_5.ifr_name, IFNAMSIZ, VAR_0); else pstrcpy(VAR_5.ifr_name, IFNAMSIZ, "tap%d"); VAR_7 = ioctl(VAR_6, TUNSETIFF, (void *) &VAR_5); if (VAR_7 != 0) { if (VAR_0[0] != '\0') { error_report("could not configure %s (%s): %m", PATH_NET_TUN, VAR_5.ifr_name); } else { error_report("could not configure %s: %m", PATH_NET_TUN); } close(VAR_6); return -1; } pstrcpy(VAR_0, VAR_1, VAR_5.ifr_name); fcntl(VAR_6, F_SETFL, O_NONBLOCK); return VAR_6; }
[ "int FUNC_0(char *VAR_0, int VAR_1, int *VAR_2,\nint VAR_3, int VAR_4)\n{", "struct ifreq VAR_5;", "int VAR_6, VAR_7;", "int VAR_8 = sizeof(struct virtio_net_hdr);", "TFR(VAR_6 = open(PATH_NET_TUN, O_RDWR));", "if (VAR_6 < 0) {", "error_report(\"could not open %s: %m\", PATH_NET_TUN);", "return -1;", "}", "memset(&VAR_5, 0, sizeof(VAR_5));", "VAR_5.ifr_flags = IFF_TAP | IFF_NO_PI;", "if (*VAR_2) {", "unsigned int VAR_10;", "if (ioctl(VAR_6, TUNGETFEATURES, &VAR_10) == 0 &&\nVAR_10 & IFF_VNET_HDR) {", "*VAR_2 = 1;", "VAR_5.ifr_flags |= IFF_VNET_HDR;", "} else {", "*VAR_2 = 0;", "}", "if (VAR_3 && !*VAR_2) {", "error_report(\"VAR_2=1 requested, but no kernel \"\n\"support for IFF_VNET_HDR available\");", "close(VAR_6);", "return -1;", "}", "ioctl(VAR_6, TUNSETVNETHDRSZ, &VAR_8);", "}", "if (VAR_4) {", "unsigned int VAR_10;", "if ((ioctl(VAR_6, TUNGETFEATURES, &VAR_10) != 0) ||\n!(VAR_10 & IFF_MULTI_QUEUE)) {", "error_report(\"multiqueue required, but no kernel \"\n\"support for IFF_MULTI_QUEUE available\");", "close(VAR_6);", "return -1;", "} else {", "VAR_5.ifr_flags |= IFF_MULTI_QUEUE;", "}", "}", "if (VAR_0[0] != '\\0')\npstrcpy(VAR_5.ifr_name, IFNAMSIZ, VAR_0);", "else\npstrcpy(VAR_5.ifr_name, IFNAMSIZ, \"tap%d\");", "VAR_7 = ioctl(VAR_6, TUNSETIFF, (void *) &VAR_5);", "if (VAR_7 != 0) {", "if (VAR_0[0] != '\\0') {", "error_report(\"could not configure %s (%s): %m\", PATH_NET_TUN, VAR_5.ifr_name);", "} else {", "error_report(\"could not configure %s: %m\", PATH_NET_TUN);", "}", "close(VAR_6);", "return -1;", "}", "pstrcpy(VAR_0, VAR_1, VAR_5.ifr_name);", "fcntl(VAR_6, F_SETFL, O_NONBLOCK);", "return VAR_6;", "}" ]
[ 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, 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 ], [ 31 ], [ 33 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 89, 91 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111, 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ] ]
21,849
static int mkv_write_attachments(AVFormatContext *s) { MatroskaMuxContext *mkv = s->priv_data; AVIOContext *dyn_cp, *pb = s->pb; ebml_master attachments; AVLFG c; int i, ret; if (!mkv->have_attachments) return 0; mkv->attachments = av_mallocz(sizeof(*mkv->attachments)); if (!mkv->attachments) return ret; av_lfg_init(&c, av_get_random_seed()); ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_ATTACHMENTS, avio_tell(pb)); if (ret < 0) return ret; ret = start_ebml_master_crc32(pb, &dyn_cp, mkv, &attachments, MATROSKA_ID_ATTACHMENTS, 0); if (ret < 0) return ret; for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; ebml_master attached_file; mkv_attachment *attachment = mkv->attachments->entries; AVDictionaryEntry *t; const char *mimetype = NULL; uint32_t fileuid; if (st->codecpar->codec_type != AVMEDIA_TYPE_ATTACHMENT) continue; attachment = av_realloc_array(attachment, mkv->attachments->num_entries + 1, sizeof(mkv_attachment)); if (!attachment) return AVERROR(ENOMEM); mkv->attachments->entries = attachment; attached_file = start_ebml_master(dyn_cp, MATROSKA_ID_ATTACHEDFILE, 0); if (t = av_dict_get(st->metadata, "title", NULL, 0)) put_ebml_string(dyn_cp, MATROSKA_ID_FILEDESC, t->value); if (!(t = av_dict_get(st->metadata, "filename", NULL, 0))) { av_log(s, AV_LOG_ERROR, "Attachment stream %d has no filename tag.\n", i); return AVERROR(EINVAL); } put_ebml_string(dyn_cp, MATROSKA_ID_FILENAME, t->value); if (t = av_dict_get(st->metadata, "mimetype", NULL, 0)) mimetype = t->value; else if (st->codecpar->codec_id != AV_CODEC_ID_NONE ) { int i; for (i = 0; ff_mkv_mime_tags[i].id != AV_CODEC_ID_NONE; i++) if (ff_mkv_mime_tags[i].id == st->codecpar->codec_id) { mimetype = ff_mkv_mime_tags[i].str; break; } for (i = 0; ff_mkv_image_mime_tags[i].id != AV_CODEC_ID_NONE; i++) if (ff_mkv_image_mime_tags[i].id == st->codecpar->codec_id) { mimetype = ff_mkv_image_mime_tags[i].str; break; } } if (!mimetype) { av_log(s, AV_LOG_ERROR, "Attachment stream %d has no mimetype tag and " "it cannot be deduced from the codec id.\n", i); return AVERROR(EINVAL); } if (s->flags & AVFMT_FLAG_BITEXACT) { struct AVSHA *sha = av_sha_alloc(); uint8_t digest[20]; if (!sha) return AVERROR(ENOMEM); av_sha_init(sha, 160); av_sha_update(sha, st->codecpar->extradata, st->codecpar->extradata_size); av_sha_final(sha, digest); av_free(sha); fileuid = AV_RL32(digest); } else { fileuid = av_lfg_get(&c); } av_log(s, AV_LOG_VERBOSE, "Using %.8"PRIx32" for attachment %d\n", fileuid, mkv->attachments->num_entries); put_ebml_string(dyn_cp, MATROSKA_ID_FILEMIMETYPE, mimetype); put_ebml_binary(dyn_cp, MATROSKA_ID_FILEDATA, st->codecpar->extradata, st->codecpar->extradata_size); put_ebml_uint(dyn_cp, MATROSKA_ID_FILEUID, fileuid); end_ebml_master(dyn_cp, attached_file); mkv->attachments->entries[mkv->attachments->num_entries].stream_idx = i; mkv->attachments->entries[mkv->attachments->num_entries++].fileuid = fileuid; } end_ebml_master_crc32(pb, &dyn_cp, mkv, attachments); return 0; }
true
FFmpeg
be28ce210d5674603838e67509fc597f30c1bb1c
static int mkv_write_attachments(AVFormatContext *s) { MatroskaMuxContext *mkv = s->priv_data; AVIOContext *dyn_cp, *pb = s->pb; ebml_master attachments; AVLFG c; int i, ret; if (!mkv->have_attachments) return 0; mkv->attachments = av_mallocz(sizeof(*mkv->attachments)); if (!mkv->attachments) return ret; av_lfg_init(&c, av_get_random_seed()); ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_ATTACHMENTS, avio_tell(pb)); if (ret < 0) return ret; ret = start_ebml_master_crc32(pb, &dyn_cp, mkv, &attachments, MATROSKA_ID_ATTACHMENTS, 0); if (ret < 0) return ret; for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; ebml_master attached_file; mkv_attachment *attachment = mkv->attachments->entries; AVDictionaryEntry *t; const char *mimetype = NULL; uint32_t fileuid; if (st->codecpar->codec_type != AVMEDIA_TYPE_ATTACHMENT) continue; attachment = av_realloc_array(attachment, mkv->attachments->num_entries + 1, sizeof(mkv_attachment)); if (!attachment) return AVERROR(ENOMEM); mkv->attachments->entries = attachment; attached_file = start_ebml_master(dyn_cp, MATROSKA_ID_ATTACHEDFILE, 0); if (t = av_dict_get(st->metadata, "title", NULL, 0)) put_ebml_string(dyn_cp, MATROSKA_ID_FILEDESC, t->value); if (!(t = av_dict_get(st->metadata, "filename", NULL, 0))) { av_log(s, AV_LOG_ERROR, "Attachment stream %d has no filename tag.\n", i); return AVERROR(EINVAL); } put_ebml_string(dyn_cp, MATROSKA_ID_FILENAME, t->value); if (t = av_dict_get(st->metadata, "mimetype", NULL, 0)) mimetype = t->value; else if (st->codecpar->codec_id != AV_CODEC_ID_NONE ) { int i; for (i = 0; ff_mkv_mime_tags[i].id != AV_CODEC_ID_NONE; i++) if (ff_mkv_mime_tags[i].id == st->codecpar->codec_id) { mimetype = ff_mkv_mime_tags[i].str; break; } for (i = 0; ff_mkv_image_mime_tags[i].id != AV_CODEC_ID_NONE; i++) if (ff_mkv_image_mime_tags[i].id == st->codecpar->codec_id) { mimetype = ff_mkv_image_mime_tags[i].str; break; } } if (!mimetype) { av_log(s, AV_LOG_ERROR, "Attachment stream %d has no mimetype tag and " "it cannot be deduced from the codec id.\n", i); return AVERROR(EINVAL); } if (s->flags & AVFMT_FLAG_BITEXACT) { struct AVSHA *sha = av_sha_alloc(); uint8_t digest[20]; if (!sha) return AVERROR(ENOMEM); av_sha_init(sha, 160); av_sha_update(sha, st->codecpar->extradata, st->codecpar->extradata_size); av_sha_final(sha, digest); av_free(sha); fileuid = AV_RL32(digest); } else { fileuid = av_lfg_get(&c); } av_log(s, AV_LOG_VERBOSE, "Using %.8"PRIx32" for attachment %d\n", fileuid, mkv->attachments->num_entries); put_ebml_string(dyn_cp, MATROSKA_ID_FILEMIMETYPE, mimetype); put_ebml_binary(dyn_cp, MATROSKA_ID_FILEDATA, st->codecpar->extradata, st->codecpar->extradata_size); put_ebml_uint(dyn_cp, MATROSKA_ID_FILEUID, fileuid); end_ebml_master(dyn_cp, attached_file); mkv->attachments->entries[mkv->attachments->num_entries].stream_idx = i; mkv->attachments->entries[mkv->attachments->num_entries++].fileuid = fileuid; } end_ebml_master_crc32(pb, &dyn_cp, mkv, attachments); return 0; }
{ "code": [ " return ret;" ], "line_no": [ 27 ] }
static int FUNC_0(AVFormatContext *VAR_0) { MatroskaMuxContext *mkv = VAR_0->priv_data; AVIOContext *dyn_cp, *pb = VAR_0->pb; ebml_master attachments; AVLFG c; int VAR_1, VAR_2; if (!mkv->have_attachments) return 0; mkv->attachments = av_mallocz(sizeof(*mkv->attachments)); if (!mkv->attachments) return VAR_2; av_lfg_init(&c, av_get_random_seed()); VAR_2 = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_ATTACHMENTS, avio_tell(pb)); if (VAR_2 < 0) return VAR_2; VAR_2 = start_ebml_master_crc32(pb, &dyn_cp, mkv, &attachments, MATROSKA_ID_ATTACHMENTS, 0); if (VAR_2 < 0) return VAR_2; for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) { AVStream *st = VAR_0->streams[VAR_1]; ebml_master attached_file; mkv_attachment *attachment = mkv->attachments->entries; AVDictionaryEntry *t; const char *mimetype = NULL; uint32_t fileuid; if (st->codecpar->codec_type != AVMEDIA_TYPE_ATTACHMENT) continue; attachment = av_realloc_array(attachment, mkv->attachments->num_entries + 1, sizeof(mkv_attachment)); if (!attachment) return AVERROR(ENOMEM); mkv->attachments->entries = attachment; attached_file = start_ebml_master(dyn_cp, MATROSKA_ID_ATTACHEDFILE, 0); if (t = av_dict_get(st->metadata, "title", NULL, 0)) put_ebml_string(dyn_cp, MATROSKA_ID_FILEDESC, t->value); if (!(t = av_dict_get(st->metadata, "filename", NULL, 0))) { av_log(VAR_0, AV_LOG_ERROR, "Attachment stream %d has no filename tag.\n", VAR_1); return AVERROR(EINVAL); } put_ebml_string(dyn_cp, MATROSKA_ID_FILENAME, t->value); if (t = av_dict_get(st->metadata, "mimetype", NULL, 0)) mimetype = t->value; else if (st->codecpar->codec_id != AV_CODEC_ID_NONE ) { int VAR_1; for (VAR_1 = 0; ff_mkv_mime_tags[VAR_1].id != AV_CODEC_ID_NONE; VAR_1++) if (ff_mkv_mime_tags[VAR_1].id == st->codecpar->codec_id) { mimetype = ff_mkv_mime_tags[VAR_1].str; break; } for (VAR_1 = 0; ff_mkv_image_mime_tags[VAR_1].id != AV_CODEC_ID_NONE; VAR_1++) if (ff_mkv_image_mime_tags[VAR_1].id == st->codecpar->codec_id) { mimetype = ff_mkv_image_mime_tags[VAR_1].str; break; } } if (!mimetype) { av_log(VAR_0, AV_LOG_ERROR, "Attachment stream %d has no mimetype tag and " "it cannot be deduced from the codec id.\n", VAR_1); return AVERROR(EINVAL); } if (VAR_0->flags & AVFMT_FLAG_BITEXACT) { struct AVSHA *sha = av_sha_alloc(); uint8_t digest[20]; if (!sha) return AVERROR(ENOMEM); av_sha_init(sha, 160); av_sha_update(sha, st->codecpar->extradata, st->codecpar->extradata_size); av_sha_final(sha, digest); av_free(sha); fileuid = AV_RL32(digest); } else { fileuid = av_lfg_get(&c); } av_log(VAR_0, AV_LOG_VERBOSE, "Using %.8"PRIx32" for attachment %d\n", fileuid, mkv->attachments->num_entries); put_ebml_string(dyn_cp, MATROSKA_ID_FILEMIMETYPE, mimetype); put_ebml_binary(dyn_cp, MATROSKA_ID_FILEDATA, st->codecpar->extradata, st->codecpar->extradata_size); put_ebml_uint(dyn_cp, MATROSKA_ID_FILEUID, fileuid); end_ebml_master(dyn_cp, attached_file); mkv->attachments->entries[mkv->attachments->num_entries].stream_idx = VAR_1; mkv->attachments->entries[mkv->attachments->num_entries++].fileuid = fileuid; } end_ebml_master_crc32(pb, &dyn_cp, mkv, attachments); return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "MatroskaMuxContext *mkv = VAR_0->priv_data;", "AVIOContext *dyn_cp, *pb = VAR_0->pb;", "ebml_master attachments;", "AVLFG c;", "int VAR_1, VAR_2;", "if (!mkv->have_attachments)\nreturn 0;", "mkv->attachments = av_mallocz(sizeof(*mkv->attachments));", "if (!mkv->attachments)\nreturn VAR_2;", "av_lfg_init(&c, av_get_random_seed());", "VAR_2 = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_ATTACHMENTS, avio_tell(pb));", "if (VAR_2 < 0) return VAR_2;", "VAR_2 = start_ebml_master_crc32(pb, &dyn_cp, mkv, &attachments, MATROSKA_ID_ATTACHMENTS, 0);", "if (VAR_2 < 0) return VAR_2;", "for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) {", "AVStream *st = VAR_0->streams[VAR_1];", "ebml_master attached_file;", "mkv_attachment *attachment = mkv->attachments->entries;", "AVDictionaryEntry *t;", "const char *mimetype = NULL;", "uint32_t fileuid;", "if (st->codecpar->codec_type != AVMEDIA_TYPE_ATTACHMENT)\ncontinue;", "attachment = av_realloc_array(attachment, mkv->attachments->num_entries + 1, sizeof(mkv_attachment));", "if (!attachment)\nreturn AVERROR(ENOMEM);", "mkv->attachments->entries = attachment;", "attached_file = start_ebml_master(dyn_cp, MATROSKA_ID_ATTACHEDFILE, 0);", "if (t = av_dict_get(st->metadata, \"title\", NULL, 0))\nput_ebml_string(dyn_cp, MATROSKA_ID_FILEDESC, t->value);", "if (!(t = av_dict_get(st->metadata, \"filename\", NULL, 0))) {", "av_log(VAR_0, AV_LOG_ERROR, \"Attachment stream %d has no filename tag.\\n\", VAR_1);", "return AVERROR(EINVAL);", "}", "put_ebml_string(dyn_cp, MATROSKA_ID_FILENAME, t->value);", "if (t = av_dict_get(st->metadata, \"mimetype\", NULL, 0))\nmimetype = t->value;", "else if (st->codecpar->codec_id != AV_CODEC_ID_NONE ) {", "int VAR_1;", "for (VAR_1 = 0; ff_mkv_mime_tags[VAR_1].id != AV_CODEC_ID_NONE; VAR_1++)", "if (ff_mkv_mime_tags[VAR_1].id == st->codecpar->codec_id) {", "mimetype = ff_mkv_mime_tags[VAR_1].str;", "break;", "}", "for (VAR_1 = 0; ff_mkv_image_mime_tags[VAR_1].id != AV_CODEC_ID_NONE; VAR_1++)", "if (ff_mkv_image_mime_tags[VAR_1].id == st->codecpar->codec_id) {", "mimetype = ff_mkv_image_mime_tags[VAR_1].str;", "break;", "}", "}", "if (!mimetype) {", "av_log(VAR_0, AV_LOG_ERROR, \"Attachment stream %d has no mimetype tag and \"\n\"it cannot be deduced from the codec id.\\n\", VAR_1);", "return AVERROR(EINVAL);", "}", "if (VAR_0->flags & AVFMT_FLAG_BITEXACT) {", "struct AVSHA *sha = av_sha_alloc();", "uint8_t digest[20];", "if (!sha)\nreturn AVERROR(ENOMEM);", "av_sha_init(sha, 160);", "av_sha_update(sha, st->codecpar->extradata, st->codecpar->extradata_size);", "av_sha_final(sha, digest);", "av_free(sha);", "fileuid = AV_RL32(digest);", "} else {", "fileuid = av_lfg_get(&c);", "}", "av_log(VAR_0, AV_LOG_VERBOSE, \"Using %.8\"PRIx32\" for attachment %d\\n\",\nfileuid, mkv->attachments->num_entries);", "put_ebml_string(dyn_cp, MATROSKA_ID_FILEMIMETYPE, mimetype);", "put_ebml_binary(dyn_cp, MATROSKA_ID_FILEDATA, st->codecpar->extradata, st->codecpar->extradata_size);", "put_ebml_uint(dyn_cp, MATROSKA_ID_FILEUID, fileuid);", "end_ebml_master(dyn_cp, attached_file);", "mkv->attachments->entries[mkv->attachments->num_entries].stream_idx = VAR_1;", "mkv->attachments->entries[mkv->attachments->num_entries++].fileuid = fileuid;", "}", "end_ebml_master_crc32(pb, &dyn_cp, mkv, attachments);", "return 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 23 ], [ 25, 27 ], [ 31 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63, 65 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 79 ], [ 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 ], [ 139 ], [ 141 ], [ 143 ], [ 145, 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165, 167 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 191 ], [ 193 ] ]
21,850
void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size) { RTPMuxContext *s = s1->priv_data; const uint8_t *qtables = NULL; int nb_qtables = 0; uint8_t type = 1; /* default pixel format is AV_PIX_FMT_YUVJ420P */ uint8_t w, h; uint8_t *p; int off = 0; /* fragment offset of the current JPEG frame */ int len; int i; s->buf_ptr = s->buf; s->timestamp = s->cur_timestamp; /* convert video pixel dimensions from pixels to blocks */ w = s1->streams[0]->codec->width >> 3; h = s1->streams[0]->codec->height >> 3; /* check if pixel format is not the normal 420 case */ if (s1->streams[0]->codec->pix_fmt == AV_PIX_FMT_YUVJ422P) { type = 0; } else if (s1->streams[0]->codec->pix_fmt == AV_PIX_FMT_YUVJ420P) { type = 1; } else { av_log(s1, AV_LOG_ERROR, "Unsupported pixel format\n"); return; } /* preparse the header for getting some infos */ for (i = 0; i < size; i++) { if (buf[i] != 0xff) continue; if (buf[i + 1] == DQT) { if (buf[i + 4]) av_log(s1, AV_LOG_WARNING, "Only 8-bit precision is supported.\n"); /* a quantization table is 64 bytes long */ nb_qtables = AV_RB16(&buf[i + 2]) / 65; if (i + 4 + nb_qtables * 65 > size) { av_log(s1, AV_LOG_ERROR, "Too short JPEG header. Aborted!\n"); return; } qtables = &buf[i + 4]; } else if (buf[i + 1] == SOF0) { if (buf[i + 14] != 17 || buf[i + 17] != 17) { av_log(s1, AV_LOG_ERROR, "Only 1x1 chroma blocks are supported. Aborted!\n"); return; } } else if (buf[i + 1] == SOS) { /* SOS is last marker in the header */ i += AV_RB16(&buf[i + 2]) + 2; break; } } /* skip JPEG header */ buf += i; size -= i; for (i = size - 2; i >= 0; i--) { if (buf[i] == 0xff && buf[i + 1] == EOI) { /* Remove the EOI marker */ size = i; break; } } p = s->buf_ptr; while (size > 0) { int hdr_size = 8; if (off == 0 && nb_qtables) hdr_size += 4 + 64 * nb_qtables; /* payload max in one packet */ len = FFMIN(size, s->max_payload_size - hdr_size); /* set main header */ bytestream_put_byte(&p, 0); bytestream_put_be24(&p, off); bytestream_put_byte(&p, type); bytestream_put_byte(&p, 255); bytestream_put_byte(&p, w); bytestream_put_byte(&p, h); if (off == 0 && nb_qtables) { /* set quantization tables header */ bytestream_put_byte(&p, 0); bytestream_put_byte(&p, 0); bytestream_put_be16(&p, 64 * nb_qtables); for (i = 0; i < nb_qtables; i++) bytestream_put_buffer(&p, &qtables[65 * i + 1], 64); } /* copy payload data */ memcpy(p, buf, len); /* marker bit is last packet in frame */ ff_rtp_send_data(s1, s->buf, len + hdr_size, size == len); buf += len; size -= len; off += len; p = s->buf; } }
false
FFmpeg
39975acc699c83af0a87a7318c0f41e189142938
void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size) { RTPMuxContext *s = s1->priv_data; const uint8_t *qtables = NULL; int nb_qtables = 0; uint8_t type = 1; uint8_t w, h; uint8_t *p; int off = 0; int len; int i; s->buf_ptr = s->buf; s->timestamp = s->cur_timestamp; w = s1->streams[0]->codec->width >> 3; h = s1->streams[0]->codec->height >> 3; if (s1->streams[0]->codec->pix_fmt == AV_PIX_FMT_YUVJ422P) { type = 0; } else if (s1->streams[0]->codec->pix_fmt == AV_PIX_FMT_YUVJ420P) { type = 1; } else { av_log(s1, AV_LOG_ERROR, "Unsupported pixel format\n"); return; } for (i = 0; i < size; i++) { if (buf[i] != 0xff) continue; if (buf[i + 1] == DQT) { if (buf[i + 4]) av_log(s1, AV_LOG_WARNING, "Only 8-bit precision is supported.\n"); nb_qtables = AV_RB16(&buf[i + 2]) / 65; if (i + 4 + nb_qtables * 65 > size) { av_log(s1, AV_LOG_ERROR, "Too short JPEG header. Aborted!\n"); return; } qtables = &buf[i + 4]; } else if (buf[i + 1] == SOF0) { if (buf[i + 14] != 17 || buf[i + 17] != 17) { av_log(s1, AV_LOG_ERROR, "Only 1x1 chroma blocks are supported. Aborted!\n"); return; } } else if (buf[i + 1] == SOS) { i += AV_RB16(&buf[i + 2]) + 2; break; } } buf += i; size -= i; for (i = size - 2; i >= 0; i--) { if (buf[i] == 0xff && buf[i + 1] == EOI) { size = i; break; } } p = s->buf_ptr; while (size > 0) { int hdr_size = 8; if (off == 0 && nb_qtables) hdr_size += 4 + 64 * nb_qtables; len = FFMIN(size, s->max_payload_size - hdr_size); bytestream_put_byte(&p, 0); bytestream_put_be24(&p, off); bytestream_put_byte(&p, type); bytestream_put_byte(&p, 255); bytestream_put_byte(&p, w); bytestream_put_byte(&p, h); if (off == 0 && nb_qtables) { bytestream_put_byte(&p, 0); bytestream_put_byte(&p, 0); bytestream_put_be16(&p, 64 * nb_qtables); for (i = 0; i < nb_qtables; i++) bytestream_put_buffer(&p, &qtables[65 * i + 1], 64); } memcpy(p, buf, len); ff_rtp_send_data(s1, s->buf, len + hdr_size, size == len); buf += len; size -= len; off += len; p = s->buf; } }
{ "code": [], "line_no": [] }
void FUNC_0(AVFormatContext *VAR_0, const uint8_t *VAR_1, int VAR_2) { RTPMuxContext *s = VAR_0->priv_data; const uint8_t *VAR_3 = NULL; int VAR_4 = 0; uint8_t type = 1; uint8_t w, h; uint8_t *p; int VAR_5 = 0; int VAR_6; int VAR_7; s->buf_ptr = s->VAR_1; s->timestamp = s->cur_timestamp; w = VAR_0->streams[0]->codec->width >> 3; h = VAR_0->streams[0]->codec->height >> 3; if (VAR_0->streams[0]->codec->pix_fmt == AV_PIX_FMT_YUVJ422P) { type = 0; } else if (VAR_0->streams[0]->codec->pix_fmt == AV_PIX_FMT_YUVJ420P) { type = 1; } else { av_log(VAR_0, AV_LOG_ERROR, "Unsupported pixel format\n"); return; } for (VAR_7 = 0; VAR_7 < VAR_2; VAR_7++) { if (VAR_1[VAR_7] != 0xff) continue; if (VAR_1[VAR_7 + 1] == DQT) { if (VAR_1[VAR_7 + 4]) av_log(VAR_0, AV_LOG_WARNING, "Only 8-bit precision is supported.\n"); VAR_4 = AV_RB16(&VAR_1[VAR_7 + 2]) / 65; if (VAR_7 + 4 + VAR_4 * 65 > VAR_2) { av_log(VAR_0, AV_LOG_ERROR, "Too short JPEG header. Aborted!\n"); return; } VAR_3 = &VAR_1[VAR_7 + 4]; } else if (VAR_1[VAR_7 + 1] == SOF0) { if (VAR_1[VAR_7 + 14] != 17 || VAR_1[VAR_7 + 17] != 17) { av_log(VAR_0, AV_LOG_ERROR, "Only 1x1 chroma blocks are supported. Aborted!\n"); return; } } else if (VAR_1[VAR_7 + 1] == SOS) { VAR_7 += AV_RB16(&VAR_1[VAR_7 + 2]) + 2; break; } } VAR_1 += VAR_7; VAR_2 -= VAR_7; for (VAR_7 = VAR_2 - 2; VAR_7 >= 0; VAR_7--) { if (VAR_1[VAR_7] == 0xff && VAR_1[VAR_7 + 1] == EOI) { VAR_2 = VAR_7; break; } } p = s->buf_ptr; while (VAR_2 > 0) { int VAR_8 = 8; if (VAR_5 == 0 && VAR_4) VAR_8 += 4 + 64 * VAR_4; VAR_6 = FFMIN(VAR_2, s->max_payload_size - VAR_8); bytestream_put_byte(&p, 0); bytestream_put_be24(&p, VAR_5); bytestream_put_byte(&p, type); bytestream_put_byte(&p, 255); bytestream_put_byte(&p, w); bytestream_put_byte(&p, h); if (VAR_5 == 0 && VAR_4) { bytestream_put_byte(&p, 0); bytestream_put_byte(&p, 0); bytestream_put_be16(&p, 64 * VAR_4); for (VAR_7 = 0; VAR_7 < VAR_4; VAR_7++) bytestream_put_buffer(&p, &VAR_3[65 * VAR_7 + 1], 64); } memcpy(p, VAR_1, VAR_6); ff_rtp_send_data(VAR_0, s->VAR_1, VAR_6 + VAR_8, VAR_2 == VAR_6); VAR_1 += VAR_6; VAR_2 -= VAR_6; VAR_5 += VAR_6; p = s->VAR_1; } }
[ "void FUNC_0(AVFormatContext *VAR_0, const uint8_t *VAR_1, int VAR_2)\n{", "RTPMuxContext *s = VAR_0->priv_data;", "const uint8_t *VAR_3 = NULL;", "int VAR_4 = 0;", "uint8_t type = 1;", "uint8_t w, h;", "uint8_t *p;", "int VAR_5 = 0;", "int VAR_6;", "int VAR_7;", "s->buf_ptr = s->VAR_1;", "s->timestamp = s->cur_timestamp;", "w = VAR_0->streams[0]->codec->width >> 3;", "h = VAR_0->streams[0]->codec->height >> 3;", "if (VAR_0->streams[0]->codec->pix_fmt == AV_PIX_FMT_YUVJ422P) {", "type = 0;", "} else if (VAR_0->streams[0]->codec->pix_fmt == AV_PIX_FMT_YUVJ420P) {", "type = 1;", "} else {", "av_log(VAR_0, AV_LOG_ERROR, \"Unsupported pixel format\\n\");", "return;", "}", "for (VAR_7 = 0; VAR_7 < VAR_2; VAR_7++) {", "if (VAR_1[VAR_7] != 0xff)\ncontinue;", "if (VAR_1[VAR_7 + 1] == DQT) {", "if (VAR_1[VAR_7 + 4])\nav_log(VAR_0, AV_LOG_WARNING,\n\"Only 8-bit precision is supported.\\n\");", "VAR_4 = AV_RB16(&VAR_1[VAR_7 + 2]) / 65;", "if (VAR_7 + 4 + VAR_4 * 65 > VAR_2) {", "av_log(VAR_0, AV_LOG_ERROR, \"Too short JPEG header. Aborted!\\n\");", "return;", "}", "VAR_3 = &VAR_1[VAR_7 + 4];", "} else if (VAR_1[VAR_7 + 1] == SOF0) {", "if (VAR_1[VAR_7 + 14] != 17 || VAR_1[VAR_7 + 17] != 17) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Only 1x1 chroma blocks are supported. Aborted!\\n\");", "return;", "}", "} else if (VAR_1[VAR_7 + 1] == SOS) {", "VAR_7 += AV_RB16(&VAR_1[VAR_7 + 2]) + 2;", "break;", "}", "}", "VAR_1 += VAR_7;", "VAR_2 -= VAR_7;", "for (VAR_7 = VAR_2 - 2; VAR_7 >= 0; VAR_7--) {", "if (VAR_1[VAR_7] == 0xff && VAR_1[VAR_7 + 1] == EOI) {", "VAR_2 = VAR_7;", "break;", "}", "}", "p = s->buf_ptr;", "while (VAR_2 > 0) {", "int VAR_8 = 8;", "if (VAR_5 == 0 && VAR_4)\nVAR_8 += 4 + 64 * VAR_4;", "VAR_6 = FFMIN(VAR_2, s->max_payload_size - VAR_8);", "bytestream_put_byte(&p, 0);", "bytestream_put_be24(&p, VAR_5);", "bytestream_put_byte(&p, type);", "bytestream_put_byte(&p, 255);", "bytestream_put_byte(&p, w);", "bytestream_put_byte(&p, h);", "if (VAR_5 == 0 && VAR_4) {", "bytestream_put_byte(&p, 0);", "bytestream_put_byte(&p, 0);", "bytestream_put_be16(&p, 64 * VAR_4);", "for (VAR_7 = 0; VAR_7 < VAR_4; VAR_7++)", "bytestream_put_buffer(&p, &VAR_3[65 * VAR_7 + 1], 64);", "}", "memcpy(p, VAR_1, VAR_6);", "ff_rtp_send_data(VAR_0, s->VAR_1, VAR_6 + VAR_8, VAR_2 == VAR_6);", "VAR_1 += VAR_6;", "VAR_2 -= VAR_6;", "VAR_5 += VAR_6;", "p = s->VAR_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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 33 ], [ 35 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 61 ], [ 63, 65 ], [ 69 ], [ 71, 73, 75 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 145 ], [ 147 ], [ 149 ], [ 153, 155 ], [ 161 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 181 ], [ 185 ], [ 187 ], [ 189 ], [ 193 ], [ 195 ], [ 197 ], [ 203 ], [ 209 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ] ]
21,852
static int ffat_decode(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { ATDecodeContext *at = avctx->priv_data; AVFrame *frame = data; int pkt_size = avpkt->size; AVPacket filtered_packet = {0}; OSStatus ret; AudioBufferList out_buffers; if (avctx->codec_id == AV_CODEC_ID_AAC && avpkt->size > 2 && (AV_RB16(avpkt->data) & 0xfff0) == 0xfff0) { AVPacket filter_pkt = {0}; if (!at->bsf) { const AVBitStreamFilter *bsf = av_bsf_get_by_name("aac_adtstoasc"); if(!bsf) return AVERROR_BSF_NOT_FOUND; if ((ret = av_bsf_alloc(bsf, &at->bsf))) return ret; if (((ret = avcodec_parameters_from_context(at->bsf->par_in, avctx)) < 0) || ((ret = av_bsf_init(at->bsf)) < 0)) { av_bsf_free(&at->bsf); return ret; } } if ((ret = av_packet_ref(&filter_pkt, avpkt)) < 0) return ret; if ((ret = av_bsf_send_packet(at->bsf, &filter_pkt)) < 0) { av_packet_unref(&filter_pkt); return ret; } if ((ret = av_bsf_receive_packet(at->bsf, &filtered_packet)) < 0) return ret; at->extradata = at->bsf->par_out->extradata; at->extradata_size = at->bsf->par_out->extradata_size; avpkt = &filtered_packet; } if (!at->converter) { if ((ret = ffat_create_decoder(avctx, avpkt)) < 0) { av_packet_unref(&filtered_packet); return ret; } } out_buffers = (AudioBufferList){ .mNumberBuffers = 1, .mBuffers = { { .mNumberChannels = avctx->channels, .mDataByteSize = av_get_bytes_per_sample(avctx->sample_fmt) * avctx->frame_size * avctx->channels, } } }; av_packet_unref(&at->new_in_pkt); if (avpkt->size) { if (filtered_packet.data) { at->new_in_pkt = filtered_packet; } else if ((ret = av_packet_ref(&at->new_in_pkt, avpkt)) < 0) { return ret; } } else { at->eof = 1; } frame->sample_rate = avctx->sample_rate; frame->nb_samples = avctx->frame_size; out_buffers.mBuffers[0].mData = at->decoded_data; ret = AudioConverterFillComplexBuffer(at->converter, ffat_decode_callback, avctx, &frame->nb_samples, &out_buffers, NULL); if ((!ret || ret == 1) && frame->nb_samples) { if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; ffat_copy_samples(avctx, frame); *got_frame_ptr = 1; if (at->last_pts != AV_NOPTS_VALUE) { frame->pts = at->last_pts; #if FF_API_PKT_PTS FF_DISABLE_DEPRECATION_WARNINGS frame->pkt_pts = at->last_pts; FF_ENABLE_DEPRECATION_WARNINGS #endif at->last_pts = avpkt->pts; } } else if (ret && ret != 1) { av_log(avctx, AV_LOG_WARNING, "Decode error: %i\n", ret); } else { at->last_pts = avpkt->pts; } return pkt_size; }
false
FFmpeg
954e2b3d34b7c2d82871254f07e2f8a39bc451cb
static int ffat_decode(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { ATDecodeContext *at = avctx->priv_data; AVFrame *frame = data; int pkt_size = avpkt->size; AVPacket filtered_packet = {0}; OSStatus ret; AudioBufferList out_buffers; if (avctx->codec_id == AV_CODEC_ID_AAC && avpkt->size > 2 && (AV_RB16(avpkt->data) & 0xfff0) == 0xfff0) { AVPacket filter_pkt = {0}; if (!at->bsf) { const AVBitStreamFilter *bsf = av_bsf_get_by_name("aac_adtstoasc"); if(!bsf) return AVERROR_BSF_NOT_FOUND; if ((ret = av_bsf_alloc(bsf, &at->bsf))) return ret; if (((ret = avcodec_parameters_from_context(at->bsf->par_in, avctx)) < 0) || ((ret = av_bsf_init(at->bsf)) < 0)) { av_bsf_free(&at->bsf); return ret; } } if ((ret = av_packet_ref(&filter_pkt, avpkt)) < 0) return ret; if ((ret = av_bsf_send_packet(at->bsf, &filter_pkt)) < 0) { av_packet_unref(&filter_pkt); return ret; } if ((ret = av_bsf_receive_packet(at->bsf, &filtered_packet)) < 0) return ret; at->extradata = at->bsf->par_out->extradata; at->extradata_size = at->bsf->par_out->extradata_size; avpkt = &filtered_packet; } if (!at->converter) { if ((ret = ffat_create_decoder(avctx, avpkt)) < 0) { av_packet_unref(&filtered_packet); return ret; } } out_buffers = (AudioBufferList){ .mNumberBuffers = 1, .mBuffers = { { .mNumberChannels = avctx->channels, .mDataByteSize = av_get_bytes_per_sample(avctx->sample_fmt) * avctx->frame_size * avctx->channels, } } }; av_packet_unref(&at->new_in_pkt); if (avpkt->size) { if (filtered_packet.data) { at->new_in_pkt = filtered_packet; } else if ((ret = av_packet_ref(&at->new_in_pkt, avpkt)) < 0) { return ret; } } else { at->eof = 1; } frame->sample_rate = avctx->sample_rate; frame->nb_samples = avctx->frame_size; out_buffers.mBuffers[0].mData = at->decoded_data; ret = AudioConverterFillComplexBuffer(at->converter, ffat_decode_callback, avctx, &frame->nb_samples, &out_buffers, NULL); if ((!ret || ret == 1) && frame->nb_samples) { if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; ffat_copy_samples(avctx, frame); *got_frame_ptr = 1; if (at->last_pts != AV_NOPTS_VALUE) { frame->pts = at->last_pts; #if FF_API_PKT_PTS FF_DISABLE_DEPRECATION_WARNINGS frame->pkt_pts = at->last_pts; FF_ENABLE_DEPRECATION_WARNINGS #endif at->last_pts = avpkt->pts; } } else if (ret && ret != 1) { av_log(avctx, AV_LOG_WARNING, "Decode error: %i\n", ret); } else { at->last_pts = avpkt->pts; } return pkt_size; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { ATDecodeContext *at = VAR_0->priv_data; AVFrame *frame = VAR_1; int VAR_4 = VAR_3->size; AVPacket filtered_packet = {0}; OSStatus ret; AudioBufferList out_buffers; if (VAR_0->codec_id == AV_CODEC_ID_AAC && VAR_3->size > 2 && (AV_RB16(VAR_3->VAR_1) & 0xfff0) == 0xfff0) { AVPacket filter_pkt = {0}; if (!at->VAR_5) { const AVBitStreamFilter *VAR_5 = av_bsf_get_by_name("aac_adtstoasc"); if(!VAR_5) return AVERROR_BSF_NOT_FOUND; if ((ret = av_bsf_alloc(VAR_5, &at->VAR_5))) return ret; if (((ret = avcodec_parameters_from_context(at->VAR_5->par_in, VAR_0)) < 0) || ((ret = av_bsf_init(at->VAR_5)) < 0)) { av_bsf_free(&at->VAR_5); return ret; } } if ((ret = av_packet_ref(&filter_pkt, VAR_3)) < 0) return ret; if ((ret = av_bsf_send_packet(at->VAR_5, &filter_pkt)) < 0) { av_packet_unref(&filter_pkt); return ret; } if ((ret = av_bsf_receive_packet(at->VAR_5, &filtered_packet)) < 0) return ret; at->extradata = at->VAR_5->par_out->extradata; at->extradata_size = at->VAR_5->par_out->extradata_size; VAR_3 = &filtered_packet; } if (!at->converter) { if ((ret = ffat_create_decoder(VAR_0, VAR_3)) < 0) { av_packet_unref(&filtered_packet); return ret; } } out_buffers = (AudioBufferList){ .mNumberBuffers = 1, .mBuffers = { { .mNumberChannels = VAR_0->channels, .mDataByteSize = av_get_bytes_per_sample(VAR_0->sample_fmt) * VAR_0->frame_size * VAR_0->channels, } } }; av_packet_unref(&at->new_in_pkt); if (VAR_3->size) { if (filtered_packet.VAR_1) { at->new_in_pkt = filtered_packet; } else if ((ret = av_packet_ref(&at->new_in_pkt, VAR_3)) < 0) { return ret; } } else { at->eof = 1; } frame->sample_rate = VAR_0->sample_rate; frame->nb_samples = VAR_0->frame_size; out_buffers.mBuffers[0].mData = at->decoded_data; ret = AudioConverterFillComplexBuffer(at->converter, ffat_decode_callback, VAR_0, &frame->nb_samples, &out_buffers, NULL); if ((!ret || ret == 1) && frame->nb_samples) { if ((ret = ff_get_buffer(VAR_0, frame, 0)) < 0) return ret; ffat_copy_samples(VAR_0, frame); *VAR_2 = 1; if (at->last_pts != AV_NOPTS_VALUE) { frame->pts = at->last_pts; #if FF_API_PKT_PTS FF_DISABLE_DEPRECATION_WARNINGS frame->pkt_pts = at->last_pts; FF_ENABLE_DEPRECATION_WARNINGS #endif at->last_pts = VAR_3->pts; } } else if (ret && ret != 1) { av_log(VAR_0, AV_LOG_WARNING, "Decode error: %i\n", ret); } else { at->last_pts = VAR_3->pts; } return VAR_4; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{", "ATDecodeContext *at = VAR_0->priv_data;", "AVFrame *frame = VAR_1;", "int VAR_4 = VAR_3->size;", "AVPacket filtered_packet = {0};", "OSStatus ret;", "AudioBufferList out_buffers;", "if (VAR_0->codec_id == AV_CODEC_ID_AAC && VAR_3->size > 2 &&\n(AV_RB16(VAR_3->VAR_1) & 0xfff0) == 0xfff0) {", "AVPacket filter_pkt = {0};", "if (!at->VAR_5) {", "const AVBitStreamFilter *VAR_5 = av_bsf_get_by_name(\"aac_adtstoasc\");", "if(!VAR_5)\nreturn AVERROR_BSF_NOT_FOUND;", "if ((ret = av_bsf_alloc(VAR_5, &at->VAR_5)))\nreturn ret;", "if (((ret = avcodec_parameters_from_context(at->VAR_5->par_in, VAR_0)) < 0) ||\n((ret = av_bsf_init(at->VAR_5)) < 0)) {", "av_bsf_free(&at->VAR_5);", "return ret;", "}", "}", "if ((ret = av_packet_ref(&filter_pkt, VAR_3)) < 0)\nreturn ret;", "if ((ret = av_bsf_send_packet(at->VAR_5, &filter_pkt)) < 0) {", "av_packet_unref(&filter_pkt);", "return ret;", "}", "if ((ret = av_bsf_receive_packet(at->VAR_5, &filtered_packet)) < 0)\nreturn ret;", "at->extradata = at->VAR_5->par_out->extradata;", "at->extradata_size = at->VAR_5->par_out->extradata_size;", "VAR_3 = &filtered_packet;", "}", "if (!at->converter) {", "if ((ret = ffat_create_decoder(VAR_0, VAR_3)) < 0) {", "av_packet_unref(&filtered_packet);", "return ret;", "}", "}", "out_buffers = (AudioBufferList){", ".mNumberBuffers = 1,\n.mBuffers = {", "{", ".mNumberChannels = VAR_0->channels,\n.mDataByteSize = av_get_bytes_per_sample(VAR_0->sample_fmt) * VAR_0->frame_size\n* VAR_0->channels,\n}", "}", "};", "av_packet_unref(&at->new_in_pkt);", "if (VAR_3->size) {", "if (filtered_packet.VAR_1) {", "at->new_in_pkt = filtered_packet;", "} else if ((ret = av_packet_ref(&at->new_in_pkt, VAR_3)) < 0) {", "return ret;", "}", "} else {", "at->eof = 1;", "}", "frame->sample_rate = VAR_0->sample_rate;", "frame->nb_samples = VAR_0->frame_size;", "out_buffers.mBuffers[0].mData = at->decoded_data;", "ret = AudioConverterFillComplexBuffer(at->converter, ffat_decode_callback, VAR_0,\n&frame->nb_samples, &out_buffers, NULL);", "if ((!ret || ret == 1) && frame->nb_samples) {", "if ((ret = ff_get_buffer(VAR_0, frame, 0)) < 0)\nreturn ret;", "ffat_copy_samples(VAR_0, frame);", "*VAR_2 = 1;", "if (at->last_pts != AV_NOPTS_VALUE) {", "frame->pts = at->last_pts;", "#if FF_API_PKT_PTS\nFF_DISABLE_DEPRECATION_WARNINGS\nframe->pkt_pts = at->last_pts;", "FF_ENABLE_DEPRECATION_WARNINGS\n#endif\nat->last_pts = VAR_3->pts;", "}", "} else if (ret && ret != 1) {", "av_log(VAR_0, AV_LOG_WARNING, \"Decode error: %i\\n\", ret);", "} else {", "at->last_pts = VAR_3->pts;", "}", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 31, 33 ], [ 35, 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53, 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69, 71 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103, 105 ], [ 107 ], [ 109, 111, 113, 115 ], [ 117 ], [ 119 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 147 ], [ 151 ], [ 155 ], [ 159, 161 ], [ 163 ], [ 165, 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177, 179, 181 ], [ 183, 185, 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 203 ], [ 205 ] ]
21,853
static void phys_section_destroy(MemoryRegion *mr) { memory_region_unref(mr); if (mr->subpage) { subpage_t *subpage = container_of(mr, subpage_t, iomem); object_unref(OBJECT(&subpage->iomem)); g_free(subpage); } }
false
qemu
55b4e80b047300e1512df02887b7448ba3786b62
static void phys_section_destroy(MemoryRegion *mr) { memory_region_unref(mr); if (mr->subpage) { subpage_t *subpage = container_of(mr, subpage_t, iomem); object_unref(OBJECT(&subpage->iomem)); g_free(subpage); } }
{ "code": [], "line_no": [] }
static void FUNC_0(MemoryRegion *VAR_0) { memory_region_unref(VAR_0); if (VAR_0->subpage) { subpage_t *subpage = container_of(VAR_0, subpage_t, iomem); object_unref(OBJECT(&subpage->iomem)); g_free(subpage); } }
[ "static void FUNC_0(MemoryRegion *VAR_0)\n{", "memory_region_unref(VAR_0);", "if (VAR_0->subpage) {", "subpage_t *subpage = container_of(VAR_0, subpage_t, iomem);", "object_unref(OBJECT(&subpage->iomem));", "g_free(subpage);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
21,854
static void usb_ohci_init(OHCIState *ohci, DeviceState *dev, int num_ports, int devfn, qemu_irq irq, enum ohci_type type, const char *name, uint32_t localmem_base) { int i; if (usb_frame_time == 0) { #ifdef OHCI_TIME_WARP usb_frame_time = get_ticks_per_sec(); usb_bit_time = muldiv64(1, get_ticks_per_sec(), USB_HZ/1000); #else usb_frame_time = muldiv64(1, get_ticks_per_sec(), 1000); if (get_ticks_per_sec() >= USB_HZ) { usb_bit_time = muldiv64(1, get_ticks_per_sec(), USB_HZ); } else { usb_bit_time = 1; } #endif dprintf("usb-ohci: usb_bit_time=%" PRId64 " usb_frame_time=%" PRId64 "\n", usb_frame_time, usb_bit_time); } ohci->mem = cpu_register_io_memory(ohci_readfn, ohci_writefn, ohci); ohci->localmem_base = localmem_base; ohci->name = name; ohci->irq = irq; ohci->type = type; usb_bus_new(&ohci->bus, dev); ohci->num_ports = num_ports; for (i = 0; i < num_ports; i++) { usb_register_port(&ohci->bus, &ohci->rhport[i].port, ohci, i, ohci_attach); } ohci->async_td = 0; qemu_register_reset(ohci_reset, ohci); ohci_reset(ohci); }
false
qemu
c169998802505c244b8bcad562633f29de7d74a4
static void usb_ohci_init(OHCIState *ohci, DeviceState *dev, int num_ports, int devfn, qemu_irq irq, enum ohci_type type, const char *name, uint32_t localmem_base) { int i; if (usb_frame_time == 0) { #ifdef OHCI_TIME_WARP usb_frame_time = get_ticks_per_sec(); usb_bit_time = muldiv64(1, get_ticks_per_sec(), USB_HZ/1000); #else usb_frame_time = muldiv64(1, get_ticks_per_sec(), 1000); if (get_ticks_per_sec() >= USB_HZ) { usb_bit_time = muldiv64(1, get_ticks_per_sec(), USB_HZ); } else { usb_bit_time = 1; } #endif dprintf("usb-ohci: usb_bit_time=%" PRId64 " usb_frame_time=%" PRId64 "\n", usb_frame_time, usb_bit_time); } ohci->mem = cpu_register_io_memory(ohci_readfn, ohci_writefn, ohci); ohci->localmem_base = localmem_base; ohci->name = name; ohci->irq = irq; ohci->type = type; usb_bus_new(&ohci->bus, dev); ohci->num_ports = num_ports; for (i = 0; i < num_ports; i++) { usb_register_port(&ohci->bus, &ohci->rhport[i].port, ohci, i, ohci_attach); } ohci->async_td = 0; qemu_register_reset(ohci_reset, ohci); ohci_reset(ohci); }
{ "code": [], "line_no": [] }
static void FUNC_0(OHCIState *VAR_0, DeviceState *VAR_1, int VAR_2, int VAR_3, qemu_irq VAR_4, enum ohci_type VAR_5, const char *VAR_6, uint32_t VAR_7) { int VAR_8; if (usb_frame_time == 0) { #ifdef OHCI_TIME_WARP usb_frame_time = get_ticks_per_sec(); usb_bit_time = muldiv64(1, get_ticks_per_sec(), USB_HZ/1000); #else usb_frame_time = muldiv64(1, get_ticks_per_sec(), 1000); if (get_ticks_per_sec() >= USB_HZ) { usb_bit_time = muldiv64(1, get_ticks_per_sec(), USB_HZ); } else { usb_bit_time = 1; } #endif dprintf("usb-VAR_0: usb_bit_time=%" PRId64 " usb_frame_time=%" PRId64 "\n", usb_frame_time, usb_bit_time); } VAR_0->mem = cpu_register_io_memory(ohci_readfn, ohci_writefn, VAR_0); VAR_0->VAR_7 = VAR_7; VAR_0->VAR_6 = VAR_6; VAR_0->VAR_4 = VAR_4; VAR_0->VAR_5 = VAR_5; usb_bus_new(&VAR_0->bus, VAR_1); VAR_0->VAR_2 = VAR_2; for (VAR_8 = 0; VAR_8 < VAR_2; VAR_8++) { usb_register_port(&VAR_0->bus, &VAR_0->rhport[VAR_8].port, VAR_0, VAR_8, ohci_attach); } VAR_0->async_td = 0; qemu_register_reset(ohci_reset, VAR_0); ohci_reset(VAR_0); }
[ "static void FUNC_0(OHCIState *VAR_0, DeviceState *VAR_1,\nint VAR_2, int VAR_3,\nqemu_irq VAR_4, enum ohci_type VAR_5,\nconst char *VAR_6, uint32_t VAR_7)\n{", "int VAR_8;", "if (usb_frame_time == 0) {", "#ifdef OHCI_TIME_WARP\nusb_frame_time = get_ticks_per_sec();", "usb_bit_time = muldiv64(1, get_ticks_per_sec(), USB_HZ/1000);", "#else\nusb_frame_time = muldiv64(1, get_ticks_per_sec(), 1000);", "if (get_ticks_per_sec() >= USB_HZ) {", "usb_bit_time = muldiv64(1, get_ticks_per_sec(), USB_HZ);", "} else {", "usb_bit_time = 1;", "}", "#endif\ndprintf(\"usb-VAR_0: usb_bit_time=%\" PRId64 \" usb_frame_time=%\" PRId64 \"\\n\",\nusb_frame_time, usb_bit_time);", "}", "VAR_0->mem = cpu_register_io_memory(ohci_readfn, ohci_writefn, VAR_0);", "VAR_0->VAR_7 = VAR_7;", "VAR_0->VAR_6 = VAR_6;", "VAR_0->VAR_4 = VAR_4;", "VAR_0->VAR_5 = VAR_5;", "usb_bus_new(&VAR_0->bus, VAR_1);", "VAR_0->VAR_2 = VAR_2;", "for (VAR_8 = 0; VAR_8 < VAR_2; VAR_8++) {", "usb_register_port(&VAR_0->bus, &VAR_0->rhport[VAR_8].port, VAR_0, VAR_8, ohci_attach);", "}", "VAR_0->async_td = 0;", "qemu_register_reset(ohci_reset, VAR_0);", "ohci_reset(VAR_0);", "}" ]
[ 0, 0, 0, 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 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ] ]
21,855
void helper_float_check_status (void) { #ifdef CONFIG_SOFTFLOAT if (env->exception_index == POWERPC_EXCP_PROGRAM && (env->error_code & POWERPC_EXCP_FP)) { /* Differred floating-point exception after target FPR update */ if (msr_fe0 != 0 || msr_fe1 != 0) helper_raise_exception_err(env->exception_index, env->error_code); } else { int status = get_float_exception_flags(&env->fp_status); if (status & float_flag_overflow) { float_overflow_excp(); } else if (status & float_flag_underflow) { float_underflow_excp(); } else if (status & float_flag_inexact) { float_inexact_excp(); } } #else if (env->exception_index == POWERPC_EXCP_PROGRAM && (env->error_code & POWERPC_EXCP_FP)) { /* Differred floating-point exception after target FPR update */ if (msr_fe0 != 0 || msr_fe1 != 0) helper_raise_exception_err(env->exception_index, env->error_code); } #endif }
false
qemu
e33e94f92298c96e0928cefab00ea5bae0a1cd19
void helper_float_check_status (void) { #ifdef CONFIG_SOFTFLOAT if (env->exception_index == POWERPC_EXCP_PROGRAM && (env->error_code & POWERPC_EXCP_FP)) { if (msr_fe0 != 0 || msr_fe1 != 0) helper_raise_exception_err(env->exception_index, env->error_code); } else { int status = get_float_exception_flags(&env->fp_status); if (status & float_flag_overflow) { float_overflow_excp(); } else if (status & float_flag_underflow) { float_underflow_excp(); } else if (status & float_flag_inexact) { float_inexact_excp(); } } #else if (env->exception_index == POWERPC_EXCP_PROGRAM && (env->error_code & POWERPC_EXCP_FP)) { if (msr_fe0 != 0 || msr_fe1 != 0) helper_raise_exception_err(env->exception_index, env->error_code); } #endif }
{ "code": [], "line_no": [] }
void FUNC_0 (void) { #ifdef CONFIG_SOFTFLOAT if (env->exception_index == POWERPC_EXCP_PROGRAM && (env->error_code & POWERPC_EXCP_FP)) { if (msr_fe0 != 0 || msr_fe1 != 0) helper_raise_exception_err(env->exception_index, env->error_code); } else { int status = get_float_exception_flags(&env->fp_status); if (status & float_flag_overflow) { float_overflow_excp(); } else if (status & float_flag_underflow) { float_underflow_excp(); } else if (status & float_flag_inexact) { float_inexact_excp(); } } #else if (env->exception_index == POWERPC_EXCP_PROGRAM && (env->error_code & POWERPC_EXCP_FP)) { if (msr_fe0 != 0 || msr_fe1 != 0) helper_raise_exception_err(env->exception_index, env->error_code); } #endif }
[ "void FUNC_0 (void)\n{", "#ifdef CONFIG_SOFTFLOAT\nif (env->exception_index == POWERPC_EXCP_PROGRAM &&\n(env->error_code & POWERPC_EXCP_FP)) {", "if (msr_fe0 != 0 || msr_fe1 != 0)\nhelper_raise_exception_err(env->exception_index, env->error_code);", "} else {", "int status = get_float_exception_flags(&env->fp_status);", "if (status & float_flag_overflow) {", "float_overflow_excp();", "} else if (status & float_flag_underflow) {", "float_underflow_excp();", "} else if (status & float_flag_inexact) {", "float_inexact_excp();", "}", "}", "#else\nif (env->exception_index == POWERPC_EXCP_PROGRAM &&\n(env->error_code & POWERPC_EXCP_FP)) {", "if (msr_fe0 != 0 || msr_fe1 != 0)\nhelper_raise_exception_err(env->exception_index, env->error_code);", "}", "#endif\n}" ]
[ 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 ], [ 45, 47 ], [ 49 ], [ 51, 53 ] ]