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
listlengths 1
2.8k
| label
listlengths 1
2.8k
| line_no
listlengths 1
2.8k
|
---|---|---|---|---|---|---|---|---|---|---|
14,810 | block_crypto_open_opts_init(QCryptoBlockFormat format,
QemuOpts *opts,
Error **errp)
{
Visitor *v;
QCryptoBlockOpenOptions *ret = NULL;
Error *local_err = NULL;
ret = g_new0(QCryptoBlockOpenOptions, 1);
ret->format = format;
v = opts_visitor_new(opts);
visit_start_struct(v, NULL, NULL, 0, &local_err);
if (local_err) {
goto out;
}
switch (format) {
case Q_CRYPTO_BLOCK_FORMAT_LUKS:
visit_type_QCryptoBlockOptionsLUKS_members(
v, &ret->u.luks, &local_err);
break;
default:
error_setg(&local_err, "Unsupported block format %d", format);
break;
}
if (!local_err) {
visit_check_struct(v, &local_err);
}
visit_end_struct(v, NULL);
out:
if (local_err) {
error_propagate(errp, local_err);
qapi_free_QCryptoBlockOpenOptions(ret);
ret = NULL;
}
visit_free(v);
return ret;
}
| false | qemu | 306a06e5f766acaf26b71397a5692c65b65a61c7 | block_crypto_open_opts_init(QCryptoBlockFormat format,
QemuOpts *opts,
Error **errp)
{
Visitor *v;
QCryptoBlockOpenOptions *ret = NULL;
Error *local_err = NULL;
ret = g_new0(QCryptoBlockOpenOptions, 1);
ret->format = format;
v = opts_visitor_new(opts);
visit_start_struct(v, NULL, NULL, 0, &local_err);
if (local_err) {
goto out;
}
switch (format) {
case Q_CRYPTO_BLOCK_FORMAT_LUKS:
visit_type_QCryptoBlockOptionsLUKS_members(
v, &ret->u.luks, &local_err);
break;
default:
error_setg(&local_err, "Unsupported block format %d", format);
break;
}
if (!local_err) {
visit_check_struct(v, &local_err);
}
visit_end_struct(v, NULL);
out:
if (local_err) {
error_propagate(errp, local_err);
qapi_free_QCryptoBlockOpenOptions(ret);
ret = NULL;
}
visit_free(v);
return ret;
}
| {
"code": [],
"line_no": []
} | FUNC_0(QCryptoBlockFormat VAR_0,
QemuOpts *VAR_1,
Error **VAR_2)
{
Visitor *v;
QCryptoBlockOpenOptions *ret = NULL;
Error *local_err = NULL;
ret = g_new0(QCryptoBlockOpenOptions, 1);
ret->VAR_0 = VAR_0;
v = opts_visitor_new(VAR_1);
visit_start_struct(v, NULL, NULL, 0, &local_err);
if (local_err) {
goto out;
}
switch (VAR_0) {
case Q_CRYPTO_BLOCK_FORMAT_LUKS:
visit_type_QCryptoBlockOptionsLUKS_members(
v, &ret->u.luks, &local_err);
break;
default:
error_setg(&local_err, "Unsupported block VAR_0 %d", VAR_0);
break;
}
if (!local_err) {
visit_check_struct(v, &local_err);
}
visit_end_struct(v, NULL);
out:
if (local_err) {
error_propagate(VAR_2, local_err);
qapi_free_QCryptoBlockOpenOptions(ret);
ret = NULL;
}
visit_free(v);
return ret;
}
| [
"FUNC_0(QCryptoBlockFormat VAR_0,\nQemuOpts *VAR_1,\nError **VAR_2)\n{",
"Visitor *v;",
"QCryptoBlockOpenOptions *ret = NULL;",
"Error *local_err = NULL;",
"ret = g_new0(QCryptoBlockOpenOptions, 1);",
"ret->VAR_0 = VAR_0;",
"v = opts_visitor_new(VAR_1);",
"visit_start_struct(v, NULL, NULL, 0, &local_err);",
"if (local_err) {",
"goto out;",
"}",
"switch (VAR_0) {",
"case Q_CRYPTO_BLOCK_FORMAT_LUKS:\nvisit_type_QCryptoBlockOptionsLUKS_members(\nv, &ret->u.luks, &local_err);",
"break;",
"default:\nerror_setg(&local_err, \"Unsupported block VAR_0 %d\", VAR_0);",
"break;",
"}",
"if (!local_err) {",
"visit_check_struct(v, &local_err);",
"}",
"visit_end_struct(v, NULL);",
"out:\nif (local_err) {",
"error_propagate(VAR_2, local_err);",
"qapi_free_QCryptoBlockOpenOptions(ret);",
"ret = NULL;",
"}",
"visit_free(v);",
"return ret;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5,
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
19
],
[
23
],
[
27
],
[
29
],
[
31
],
[
33
],
[
37
],
[
39,
41,
43
],
[
45
],
[
49,
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
65
],
[
69,
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
]
]
|
14,811 | gen_intermediate_code_internal(CRISCPU *cpu, TranslationBlock *tb,
bool search_pc)
{
CPUState *cs = CPU(cpu);
CPUCRISState *env = &cpu->env;
uint32_t pc_start;
unsigned int insn_len;
int j, lj;
struct DisasContext ctx;
struct DisasContext *dc = &ctx;
uint32_t next_page_start;
target_ulong npc;
int num_insns;
int max_insns;
if (env->pregs[PR_VR] == 32) {
dc->decoder = crisv32_decoder;
dc->clear_locked_irq = 0;
} else {
dc->decoder = crisv10_decoder;
dc->clear_locked_irq = 1;
}
/* Odd PC indicates that branch is rexecuting due to exception in the
* delayslot, like in real hw.
*/
pc_start = tb->pc & ~1;
dc->cpu = cpu;
dc->tb = tb;
dc->is_jmp = DISAS_NEXT;
dc->ppc = pc_start;
dc->pc = pc_start;
dc->singlestep_enabled = cs->singlestep_enabled;
dc->flags_uptodate = 1;
dc->flagx_known = 1;
dc->flags_x = tb->flags & X_FLAG;
dc->cc_x_uptodate = 0;
dc->cc_mask = 0;
dc->update_cc = 0;
dc->clear_prefix = 0;
cris_update_cc_op(dc, CC_OP_FLAGS, 4);
dc->cc_size_uptodate = -1;
/* Decode TB flags. */
dc->tb_flags = tb->flags & (S_FLAG | P_FLAG | U_FLAG \
| X_FLAG | PFIX_FLAG);
dc->delayed_branch = !!(tb->flags & 7);
if (dc->delayed_branch) {
dc->jmp = JMP_INDIRECT;
} else {
dc->jmp = JMP_NOJMP;
}
dc->cpustate_changed = 0;
if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) {
qemu_log(
"srch=%d pc=%x %x flg=%" PRIx64 " bt=%x ds=%u ccs=%x\n"
"pid=%x usp=%x\n"
"%x.%x.%x.%x\n"
"%x.%x.%x.%x\n"
"%x.%x.%x.%x\n"
"%x.%x.%x.%x\n",
search_pc, dc->pc, dc->ppc,
(uint64_t)tb->flags,
env->btarget, (unsigned)tb->flags & 7,
env->pregs[PR_CCS],
env->pregs[PR_PID], env->pregs[PR_USP],
env->regs[0], env->regs[1], env->regs[2], env->regs[3],
env->regs[4], env->regs[5], env->regs[6], env->regs[7],
env->regs[8], env->regs[9],
env->regs[10], env->regs[11],
env->regs[12], env->regs[13],
env->regs[14], env->regs[15]);
qemu_log("--------------\n");
qemu_log("IN: %s\n", lookup_symbol(pc_start));
}
next_page_start = (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE;
lj = -1;
num_insns = 0;
max_insns = tb->cflags & CF_COUNT_MASK;
if (max_insns == 0) {
max_insns = CF_COUNT_MASK;
}
gen_tb_start(tb);
do {
check_breakpoint(env, dc);
if (search_pc) {
j = tcg_op_buf_count();
if (lj < j) {
lj++;
while (lj < j) {
tcg_ctx.gen_opc_instr_start[lj++] = 0;
}
}
if (dc->delayed_branch == 1) {
tcg_ctx.gen_opc_pc[lj] = dc->ppc | 1;
} else {
tcg_ctx.gen_opc_pc[lj] = dc->pc;
}
tcg_ctx.gen_opc_instr_start[lj] = 1;
tcg_ctx.gen_opc_icount[lj] = num_insns;
}
/* Pretty disas. */
LOG_DIS("%8.8x:\t", dc->pc);
if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO)) {
gen_io_start();
}
dc->clear_x = 1;
insn_len = dc->decoder(env, dc);
dc->ppc = dc->pc;
dc->pc += insn_len;
if (dc->clear_x) {
cris_clear_x_flag(dc);
}
num_insns++;
/* Check for delayed branches here. If we do it before
actually generating any host code, the simulator will just
loop doing nothing for on this program location. */
if (dc->delayed_branch) {
dc->delayed_branch--;
if (dc->delayed_branch == 0) {
if (tb->flags & 7) {
t_gen_mov_env_TN(dslot, tcg_const_tl(0));
}
if (dc->cpustate_changed || !dc->flagx_known
|| (dc->flags_x != (tb->flags & X_FLAG))) {
cris_store_direct_jmp(dc);
}
if (dc->clear_locked_irq) {
dc->clear_locked_irq = 0;
t_gen_mov_env_TN(locked_irq, tcg_const_tl(0));
}
if (dc->jmp == JMP_DIRECT_CC) {
int l1;
l1 = gen_new_label();
cris_evaluate_flags(dc);
/* Conditional jmp. */
tcg_gen_brcondi_tl(TCG_COND_EQ,
env_btaken, 0, l1);
gen_goto_tb(dc, 1, dc->jmp_pc);
gen_set_label(l1);
gen_goto_tb(dc, 0, dc->pc);
dc->is_jmp = DISAS_TB_JUMP;
dc->jmp = JMP_NOJMP;
} else if (dc->jmp == JMP_DIRECT) {
cris_evaluate_flags(dc);
gen_goto_tb(dc, 0, dc->jmp_pc);
dc->is_jmp = DISAS_TB_JUMP;
dc->jmp = JMP_NOJMP;
} else {
t_gen_cc_jmp(env_btarget, tcg_const_tl(dc->pc));
dc->is_jmp = DISAS_JUMP;
}
break;
}
}
/* If we are rexecuting a branch due to exceptions on
delay slots dont break. */
if (!(tb->pc & 1) && cs->singlestep_enabled) {
break;
}
} while (!dc->is_jmp && !dc->cpustate_changed
&& !tcg_op_buf_full()
&& !singlestep
&& (dc->pc < next_page_start)
&& num_insns < max_insns);
if (dc->clear_locked_irq) {
t_gen_mov_env_TN(locked_irq, tcg_const_tl(0));
}
npc = dc->pc;
if (tb->cflags & CF_LAST_IO)
gen_io_end();
/* Force an update if the per-tb cpu state has changed. */
if (dc->is_jmp == DISAS_NEXT
&& (dc->cpustate_changed || !dc->flagx_known
|| (dc->flags_x != (tb->flags & X_FLAG)))) {
dc->is_jmp = DISAS_UPDATE;
tcg_gen_movi_tl(env_pc, npc);
}
/* Broken branch+delayslot sequence. */
if (dc->delayed_branch == 1) {
/* Set env->dslot to the size of the branch insn. */
t_gen_mov_env_TN(dslot, tcg_const_tl(dc->pc - dc->ppc));
cris_store_direct_jmp(dc);
}
cris_evaluate_flags(dc);
if (unlikely(cs->singlestep_enabled)) {
if (dc->is_jmp == DISAS_NEXT) {
tcg_gen_movi_tl(env_pc, npc);
}
t_gen_raise_exception(EXCP_DEBUG);
} else {
switch (dc->is_jmp) {
case DISAS_NEXT:
gen_goto_tb(dc, 1, npc);
break;
default:
case DISAS_JUMP:
case DISAS_UPDATE:
/* indicate that the hash table must be used
to find the next TB */
tcg_gen_exit_tb(0);
break;
case DISAS_SWI:
case DISAS_TB_JUMP:
/* nothing more to generate */
break;
}
}
gen_tb_end(tb, num_insns);
if (search_pc) {
j = tcg_op_buf_count();
lj++;
while (lj <= j) {
tcg_ctx.gen_opc_instr_start[lj++] = 0;
}
} else {
tb->size = dc->pc - pc_start;
tb->icount = num_insns;
}
#ifdef DEBUG_DISAS
#if !DISAS_CRIS
if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) {
log_target_disas(env, pc_start, dc->pc - pc_start,
env->pregs[PR_VR]);
qemu_log("\nisize=%d osize=%d\n",
dc->pc - pc_start, tcg_op_buf_count());
}
#endif
#endif
}
| false | qemu | 42a268c241183877192c376d03bd9b6d527407c7 | gen_intermediate_code_internal(CRISCPU *cpu, TranslationBlock *tb,
bool search_pc)
{
CPUState *cs = CPU(cpu);
CPUCRISState *env = &cpu->env;
uint32_t pc_start;
unsigned int insn_len;
int j, lj;
struct DisasContext ctx;
struct DisasContext *dc = &ctx;
uint32_t next_page_start;
target_ulong npc;
int num_insns;
int max_insns;
if (env->pregs[PR_VR] == 32) {
dc->decoder = crisv32_decoder;
dc->clear_locked_irq = 0;
} else {
dc->decoder = crisv10_decoder;
dc->clear_locked_irq = 1;
}
pc_start = tb->pc & ~1;
dc->cpu = cpu;
dc->tb = tb;
dc->is_jmp = DISAS_NEXT;
dc->ppc = pc_start;
dc->pc = pc_start;
dc->singlestep_enabled = cs->singlestep_enabled;
dc->flags_uptodate = 1;
dc->flagx_known = 1;
dc->flags_x = tb->flags & X_FLAG;
dc->cc_x_uptodate = 0;
dc->cc_mask = 0;
dc->update_cc = 0;
dc->clear_prefix = 0;
cris_update_cc_op(dc, CC_OP_FLAGS, 4);
dc->cc_size_uptodate = -1;
dc->tb_flags = tb->flags & (S_FLAG | P_FLAG | U_FLAG \
| X_FLAG | PFIX_FLAG);
dc->delayed_branch = !!(tb->flags & 7);
if (dc->delayed_branch) {
dc->jmp = JMP_INDIRECT;
} else {
dc->jmp = JMP_NOJMP;
}
dc->cpustate_changed = 0;
if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) {
qemu_log(
"srch=%d pc=%x %x flg=%" PRIx64 " bt=%x ds=%u ccs=%x\n"
"pid=%x usp=%x\n"
"%x.%x.%x.%x\n"
"%x.%x.%x.%x\n"
"%x.%x.%x.%x\n"
"%x.%x.%x.%x\n",
search_pc, dc->pc, dc->ppc,
(uint64_t)tb->flags,
env->btarget, (unsigned)tb->flags & 7,
env->pregs[PR_CCS],
env->pregs[PR_PID], env->pregs[PR_USP],
env->regs[0], env->regs[1], env->regs[2], env->regs[3],
env->regs[4], env->regs[5], env->regs[6], env->regs[7],
env->regs[8], env->regs[9],
env->regs[10], env->regs[11],
env->regs[12], env->regs[13],
env->regs[14], env->regs[15]);
qemu_log("--------------\n");
qemu_log("IN: %s\n", lookup_symbol(pc_start));
}
next_page_start = (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE;
lj = -1;
num_insns = 0;
max_insns = tb->cflags & CF_COUNT_MASK;
if (max_insns == 0) {
max_insns = CF_COUNT_MASK;
}
gen_tb_start(tb);
do {
check_breakpoint(env, dc);
if (search_pc) {
j = tcg_op_buf_count();
if (lj < j) {
lj++;
while (lj < j) {
tcg_ctx.gen_opc_instr_start[lj++] = 0;
}
}
if (dc->delayed_branch == 1) {
tcg_ctx.gen_opc_pc[lj] = dc->ppc | 1;
} else {
tcg_ctx.gen_opc_pc[lj] = dc->pc;
}
tcg_ctx.gen_opc_instr_start[lj] = 1;
tcg_ctx.gen_opc_icount[lj] = num_insns;
}
LOG_DIS("%8.8x:\t", dc->pc);
if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO)) {
gen_io_start();
}
dc->clear_x = 1;
insn_len = dc->decoder(env, dc);
dc->ppc = dc->pc;
dc->pc += insn_len;
if (dc->clear_x) {
cris_clear_x_flag(dc);
}
num_insns++;
if (dc->delayed_branch) {
dc->delayed_branch--;
if (dc->delayed_branch == 0) {
if (tb->flags & 7) {
t_gen_mov_env_TN(dslot, tcg_const_tl(0));
}
if (dc->cpustate_changed || !dc->flagx_known
|| (dc->flags_x != (tb->flags & X_FLAG))) {
cris_store_direct_jmp(dc);
}
if (dc->clear_locked_irq) {
dc->clear_locked_irq = 0;
t_gen_mov_env_TN(locked_irq, tcg_const_tl(0));
}
if (dc->jmp == JMP_DIRECT_CC) {
int l1;
l1 = gen_new_label();
cris_evaluate_flags(dc);
tcg_gen_brcondi_tl(TCG_COND_EQ,
env_btaken, 0, l1);
gen_goto_tb(dc, 1, dc->jmp_pc);
gen_set_label(l1);
gen_goto_tb(dc, 0, dc->pc);
dc->is_jmp = DISAS_TB_JUMP;
dc->jmp = JMP_NOJMP;
} else if (dc->jmp == JMP_DIRECT) {
cris_evaluate_flags(dc);
gen_goto_tb(dc, 0, dc->jmp_pc);
dc->is_jmp = DISAS_TB_JUMP;
dc->jmp = JMP_NOJMP;
} else {
t_gen_cc_jmp(env_btarget, tcg_const_tl(dc->pc));
dc->is_jmp = DISAS_JUMP;
}
break;
}
}
if (!(tb->pc & 1) && cs->singlestep_enabled) {
break;
}
} while (!dc->is_jmp && !dc->cpustate_changed
&& !tcg_op_buf_full()
&& !singlestep
&& (dc->pc < next_page_start)
&& num_insns < max_insns);
if (dc->clear_locked_irq) {
t_gen_mov_env_TN(locked_irq, tcg_const_tl(0));
}
npc = dc->pc;
if (tb->cflags & CF_LAST_IO)
gen_io_end();
if (dc->is_jmp == DISAS_NEXT
&& (dc->cpustate_changed || !dc->flagx_known
|| (dc->flags_x != (tb->flags & X_FLAG)))) {
dc->is_jmp = DISAS_UPDATE;
tcg_gen_movi_tl(env_pc, npc);
}
if (dc->delayed_branch == 1) {
t_gen_mov_env_TN(dslot, tcg_const_tl(dc->pc - dc->ppc));
cris_store_direct_jmp(dc);
}
cris_evaluate_flags(dc);
if (unlikely(cs->singlestep_enabled)) {
if (dc->is_jmp == DISAS_NEXT) {
tcg_gen_movi_tl(env_pc, npc);
}
t_gen_raise_exception(EXCP_DEBUG);
} else {
switch (dc->is_jmp) {
case DISAS_NEXT:
gen_goto_tb(dc, 1, npc);
break;
default:
case DISAS_JUMP:
case DISAS_UPDATE:
tcg_gen_exit_tb(0);
break;
case DISAS_SWI:
case DISAS_TB_JUMP:
break;
}
}
gen_tb_end(tb, num_insns);
if (search_pc) {
j = tcg_op_buf_count();
lj++;
while (lj <= j) {
tcg_ctx.gen_opc_instr_start[lj++] = 0;
}
} else {
tb->size = dc->pc - pc_start;
tb->icount = num_insns;
}
#ifdef DEBUG_DISAS
#if !DISAS_CRIS
if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) {
log_target_disas(env, pc_start, dc->pc - pc_start,
env->pregs[PR_VR]);
qemu_log("\nisize=%d osize=%d\n",
dc->pc - pc_start, tcg_op_buf_count());
}
#endif
#endif
}
| {
"code": [],
"line_no": []
} | FUNC_0(CRISCPU *VAR_0, TranslationBlock *VAR_1,
bool VAR_2)
{
CPUState *cs = CPU(VAR_0);
CPUCRISState *env = &VAR_0->env;
uint32_t pc_start;
unsigned int VAR_3;
int VAR_4, VAR_5;
struct DisasContext VAR_6;
struct DisasContext *VAR_7 = &VAR_6;
uint32_t next_page_start;
target_ulong npc;
int VAR_8;
int VAR_9;
if (env->pregs[PR_VR] == 32) {
VAR_7->decoder = crisv32_decoder;
VAR_7->clear_locked_irq = 0;
} else {
VAR_7->decoder = crisv10_decoder;
VAR_7->clear_locked_irq = 1;
}
pc_start = VAR_1->pc & ~1;
VAR_7->VAR_0 = VAR_0;
VAR_7->VAR_1 = VAR_1;
VAR_7->is_jmp = DISAS_NEXT;
VAR_7->ppc = pc_start;
VAR_7->pc = pc_start;
VAR_7->singlestep_enabled = cs->singlestep_enabled;
VAR_7->flags_uptodate = 1;
VAR_7->flagx_known = 1;
VAR_7->flags_x = VAR_1->flags & X_FLAG;
VAR_7->cc_x_uptodate = 0;
VAR_7->cc_mask = 0;
VAR_7->update_cc = 0;
VAR_7->clear_prefix = 0;
cris_update_cc_op(VAR_7, CC_OP_FLAGS, 4);
VAR_7->cc_size_uptodate = -1;
VAR_7->tb_flags = VAR_1->flags & (S_FLAG | P_FLAG | U_FLAG \
| X_FLAG | PFIX_FLAG);
VAR_7->delayed_branch = !!(VAR_1->flags & 7);
if (VAR_7->delayed_branch) {
VAR_7->jmp = JMP_INDIRECT;
} else {
VAR_7->jmp = JMP_NOJMP;
}
VAR_7->cpustate_changed = 0;
if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) {
qemu_log(
"srch=%d pc=%x %x flg=%" PRIx64 " bt=%x ds=%u ccs=%x\n"
"pid=%x usp=%x\n"
"%x.%x.%x.%x\n"
"%x.%x.%x.%x\n"
"%x.%x.%x.%x\n"
"%x.%x.%x.%x\n",
VAR_2, VAR_7->pc, VAR_7->ppc,
(uint64_t)VAR_1->flags,
env->btarget, (unsigned)VAR_1->flags & 7,
env->pregs[PR_CCS],
env->pregs[PR_PID], env->pregs[PR_USP],
env->regs[0], env->regs[1], env->regs[2], env->regs[3],
env->regs[4], env->regs[5], env->regs[6], env->regs[7],
env->regs[8], env->regs[9],
env->regs[10], env->regs[11],
env->regs[12], env->regs[13],
env->regs[14], env->regs[15]);
qemu_log("--------------\n");
qemu_log("IN: %s\n", lookup_symbol(pc_start));
}
next_page_start = (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE;
VAR_5 = -1;
VAR_8 = 0;
VAR_9 = VAR_1->cflags & CF_COUNT_MASK;
if (VAR_9 == 0) {
VAR_9 = CF_COUNT_MASK;
}
gen_tb_start(VAR_1);
do {
check_breakpoint(env, VAR_7);
if (VAR_2) {
VAR_4 = tcg_op_buf_count();
if (VAR_5 < VAR_4) {
VAR_5++;
while (VAR_5 < VAR_4) {
tcg_ctx.gen_opc_instr_start[VAR_5++] = 0;
}
}
if (VAR_7->delayed_branch == 1) {
tcg_ctx.gen_opc_pc[VAR_5] = VAR_7->ppc | 1;
} else {
tcg_ctx.gen_opc_pc[VAR_5] = VAR_7->pc;
}
tcg_ctx.gen_opc_instr_start[VAR_5] = 1;
tcg_ctx.gen_opc_icount[VAR_5] = VAR_8;
}
LOG_DIS("%8.8x:\t", VAR_7->pc);
if (VAR_8 + 1 == VAR_9 && (VAR_1->cflags & CF_LAST_IO)) {
gen_io_start();
}
VAR_7->clear_x = 1;
VAR_3 = VAR_7->decoder(env, VAR_7);
VAR_7->ppc = VAR_7->pc;
VAR_7->pc += VAR_3;
if (VAR_7->clear_x) {
cris_clear_x_flag(VAR_7);
}
VAR_8++;
if (VAR_7->delayed_branch) {
VAR_7->delayed_branch--;
if (VAR_7->delayed_branch == 0) {
if (VAR_1->flags & 7) {
t_gen_mov_env_TN(dslot, tcg_const_tl(0));
}
if (VAR_7->cpustate_changed || !VAR_7->flagx_known
|| (VAR_7->flags_x != (VAR_1->flags & X_FLAG))) {
cris_store_direct_jmp(VAR_7);
}
if (VAR_7->clear_locked_irq) {
VAR_7->clear_locked_irq = 0;
t_gen_mov_env_TN(locked_irq, tcg_const_tl(0));
}
if (VAR_7->jmp == JMP_DIRECT_CC) {
int VAR_10;
VAR_10 = gen_new_label();
cris_evaluate_flags(VAR_7);
tcg_gen_brcondi_tl(TCG_COND_EQ,
env_btaken, 0, VAR_10);
gen_goto_tb(VAR_7, 1, VAR_7->jmp_pc);
gen_set_label(VAR_10);
gen_goto_tb(VAR_7, 0, VAR_7->pc);
VAR_7->is_jmp = DISAS_TB_JUMP;
VAR_7->jmp = JMP_NOJMP;
} else if (VAR_7->jmp == JMP_DIRECT) {
cris_evaluate_flags(VAR_7);
gen_goto_tb(VAR_7, 0, VAR_7->jmp_pc);
VAR_7->is_jmp = DISAS_TB_JUMP;
VAR_7->jmp = JMP_NOJMP;
} else {
t_gen_cc_jmp(env_btarget, tcg_const_tl(VAR_7->pc));
VAR_7->is_jmp = DISAS_JUMP;
}
break;
}
}
if (!(VAR_1->pc & 1) && cs->singlestep_enabled) {
break;
}
} while (!VAR_7->is_jmp && !VAR_7->cpustate_changed
&& !tcg_op_buf_full()
&& !singlestep
&& (VAR_7->pc < next_page_start)
&& VAR_8 < VAR_9);
if (VAR_7->clear_locked_irq) {
t_gen_mov_env_TN(locked_irq, tcg_const_tl(0));
}
npc = VAR_7->pc;
if (VAR_1->cflags & CF_LAST_IO)
gen_io_end();
if (VAR_7->is_jmp == DISAS_NEXT
&& (VAR_7->cpustate_changed || !VAR_7->flagx_known
|| (VAR_7->flags_x != (VAR_1->flags & X_FLAG)))) {
VAR_7->is_jmp = DISAS_UPDATE;
tcg_gen_movi_tl(env_pc, npc);
}
if (VAR_7->delayed_branch == 1) {
t_gen_mov_env_TN(dslot, tcg_const_tl(VAR_7->pc - VAR_7->ppc));
cris_store_direct_jmp(VAR_7);
}
cris_evaluate_flags(VAR_7);
if (unlikely(cs->singlestep_enabled)) {
if (VAR_7->is_jmp == DISAS_NEXT) {
tcg_gen_movi_tl(env_pc, npc);
}
t_gen_raise_exception(EXCP_DEBUG);
} else {
switch (VAR_7->is_jmp) {
case DISAS_NEXT:
gen_goto_tb(VAR_7, 1, npc);
break;
default:
case DISAS_JUMP:
case DISAS_UPDATE:
tcg_gen_exit_tb(0);
break;
case DISAS_SWI:
case DISAS_TB_JUMP:
break;
}
}
gen_tb_end(VAR_1, VAR_8);
if (VAR_2) {
VAR_4 = tcg_op_buf_count();
VAR_5++;
while (VAR_5 <= VAR_4) {
tcg_ctx.gen_opc_instr_start[VAR_5++] = 0;
}
} else {
VAR_1->size = VAR_7->pc - pc_start;
VAR_1->icount = VAR_8;
}
#ifdef DEBUG_DISAS
#if !DISAS_CRIS
if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) {
log_target_disas(env, pc_start, VAR_7->pc - pc_start,
env->pregs[PR_VR]);
qemu_log("\nisize=%d osize=%d\n",
VAR_7->pc - pc_start, tcg_op_buf_count());
}
#endif
#endif
}
| [
"FUNC_0(CRISCPU *VAR_0, TranslationBlock *VAR_1,\nbool VAR_2)\n{",
"CPUState *cs = CPU(VAR_0);",
"CPUCRISState *env = &VAR_0->env;",
"uint32_t pc_start;",
"unsigned int VAR_3;",
"int VAR_4, VAR_5;",
"struct DisasContext VAR_6;",
"struct DisasContext *VAR_7 = &VAR_6;",
"uint32_t next_page_start;",
"target_ulong npc;",
"int VAR_8;",
"int VAR_9;",
"if (env->pregs[PR_VR] == 32) {",
"VAR_7->decoder = crisv32_decoder;",
"VAR_7->clear_locked_irq = 0;",
"} else {",
"VAR_7->decoder = crisv10_decoder;",
"VAR_7->clear_locked_irq = 1;",
"}",
"pc_start = VAR_1->pc & ~1;",
"VAR_7->VAR_0 = VAR_0;",
"VAR_7->VAR_1 = VAR_1;",
"VAR_7->is_jmp = DISAS_NEXT;",
"VAR_7->ppc = pc_start;",
"VAR_7->pc = pc_start;",
"VAR_7->singlestep_enabled = cs->singlestep_enabled;",
"VAR_7->flags_uptodate = 1;",
"VAR_7->flagx_known = 1;",
"VAR_7->flags_x = VAR_1->flags & X_FLAG;",
"VAR_7->cc_x_uptodate = 0;",
"VAR_7->cc_mask = 0;",
"VAR_7->update_cc = 0;",
"VAR_7->clear_prefix = 0;",
"cris_update_cc_op(VAR_7, CC_OP_FLAGS, 4);",
"VAR_7->cc_size_uptodate = -1;",
"VAR_7->tb_flags = VAR_1->flags & (S_FLAG | P_FLAG | U_FLAG \\\n| X_FLAG | PFIX_FLAG);",
"VAR_7->delayed_branch = !!(VAR_1->flags & 7);",
"if (VAR_7->delayed_branch) {",
"VAR_7->jmp = JMP_INDIRECT;",
"} else {",
"VAR_7->jmp = JMP_NOJMP;",
"}",
"VAR_7->cpustate_changed = 0;",
"if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) {",
"qemu_log(\n\"srch=%d pc=%x %x flg=%\" PRIx64 \" bt=%x ds=%u ccs=%x\\n\"\n\"pid=%x usp=%x\\n\"\n\"%x.%x.%x.%x\\n\"\n\"%x.%x.%x.%x\\n\"\n\"%x.%x.%x.%x\\n\"\n\"%x.%x.%x.%x\\n\",\nVAR_2, VAR_7->pc, VAR_7->ppc,\n(uint64_t)VAR_1->flags,\nenv->btarget, (unsigned)VAR_1->flags & 7,\nenv->pregs[PR_CCS],\nenv->pregs[PR_PID], env->pregs[PR_USP],\nenv->regs[0], env->regs[1], env->regs[2], env->regs[3],\nenv->regs[4], env->regs[5], env->regs[6], env->regs[7],\nenv->regs[8], env->regs[9],\nenv->regs[10], env->regs[11],\nenv->regs[12], env->regs[13],\nenv->regs[14], env->regs[15]);",
"qemu_log(\"--------------\\n\");",
"qemu_log(\"IN: %s\\n\", lookup_symbol(pc_start));",
"}",
"next_page_start = (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE;",
"VAR_5 = -1;",
"VAR_8 = 0;",
"VAR_9 = VAR_1->cflags & CF_COUNT_MASK;",
"if (VAR_9 == 0) {",
"VAR_9 = CF_COUNT_MASK;",
"}",
"gen_tb_start(VAR_1);",
"do {",
"check_breakpoint(env, VAR_7);",
"if (VAR_2) {",
"VAR_4 = tcg_op_buf_count();",
"if (VAR_5 < VAR_4) {",
"VAR_5++;",
"while (VAR_5 < VAR_4) {",
"tcg_ctx.gen_opc_instr_start[VAR_5++] = 0;",
"}",
"}",
"if (VAR_7->delayed_branch == 1) {",
"tcg_ctx.gen_opc_pc[VAR_5] = VAR_7->ppc | 1;",
"} else {",
"tcg_ctx.gen_opc_pc[VAR_5] = VAR_7->pc;",
"}",
"tcg_ctx.gen_opc_instr_start[VAR_5] = 1;",
"tcg_ctx.gen_opc_icount[VAR_5] = VAR_8;",
"}",
"LOG_DIS(\"%8.8x:\\t\", VAR_7->pc);",
"if (VAR_8 + 1 == VAR_9 && (VAR_1->cflags & CF_LAST_IO)) {",
"gen_io_start();",
"}",
"VAR_7->clear_x = 1;",
"VAR_3 = VAR_7->decoder(env, VAR_7);",
"VAR_7->ppc = VAR_7->pc;",
"VAR_7->pc += VAR_3;",
"if (VAR_7->clear_x) {",
"cris_clear_x_flag(VAR_7);",
"}",
"VAR_8++;",
"if (VAR_7->delayed_branch) {",
"VAR_7->delayed_branch--;",
"if (VAR_7->delayed_branch == 0) {",
"if (VAR_1->flags & 7) {",
"t_gen_mov_env_TN(dslot, tcg_const_tl(0));",
"}",
"if (VAR_7->cpustate_changed || !VAR_7->flagx_known\n|| (VAR_7->flags_x != (VAR_1->flags & X_FLAG))) {",
"cris_store_direct_jmp(VAR_7);",
"}",
"if (VAR_7->clear_locked_irq) {",
"VAR_7->clear_locked_irq = 0;",
"t_gen_mov_env_TN(locked_irq, tcg_const_tl(0));",
"}",
"if (VAR_7->jmp == JMP_DIRECT_CC) {",
"int VAR_10;",
"VAR_10 = gen_new_label();",
"cris_evaluate_flags(VAR_7);",
"tcg_gen_brcondi_tl(TCG_COND_EQ,\nenv_btaken, 0, VAR_10);",
"gen_goto_tb(VAR_7, 1, VAR_7->jmp_pc);",
"gen_set_label(VAR_10);",
"gen_goto_tb(VAR_7, 0, VAR_7->pc);",
"VAR_7->is_jmp = DISAS_TB_JUMP;",
"VAR_7->jmp = JMP_NOJMP;",
"} else if (VAR_7->jmp == JMP_DIRECT) {",
"cris_evaluate_flags(VAR_7);",
"gen_goto_tb(VAR_7, 0, VAR_7->jmp_pc);",
"VAR_7->is_jmp = DISAS_TB_JUMP;",
"VAR_7->jmp = JMP_NOJMP;",
"} else {",
"t_gen_cc_jmp(env_btarget, tcg_const_tl(VAR_7->pc));",
"VAR_7->is_jmp = DISAS_JUMP;",
"}",
"break;",
"}",
"}",
"if (!(VAR_1->pc & 1) && cs->singlestep_enabled) {",
"break;",
"}",
"} while (!VAR_7->is_jmp && !VAR_7->cpustate_changed",
"&& !tcg_op_buf_full()\n&& !singlestep\n&& (VAR_7->pc < next_page_start)\n&& VAR_8 < VAR_9);",
"if (VAR_7->clear_locked_irq) {",
"t_gen_mov_env_TN(locked_irq, tcg_const_tl(0));",
"}",
"npc = VAR_7->pc;",
"if (VAR_1->cflags & CF_LAST_IO)\ngen_io_end();",
"if (VAR_7->is_jmp == DISAS_NEXT\n&& (VAR_7->cpustate_changed || !VAR_7->flagx_known\n|| (VAR_7->flags_x != (VAR_1->flags & X_FLAG)))) {",
"VAR_7->is_jmp = DISAS_UPDATE;",
"tcg_gen_movi_tl(env_pc, npc);",
"}",
"if (VAR_7->delayed_branch == 1) {",
"t_gen_mov_env_TN(dslot, tcg_const_tl(VAR_7->pc - VAR_7->ppc));",
"cris_store_direct_jmp(VAR_7);",
"}",
"cris_evaluate_flags(VAR_7);",
"if (unlikely(cs->singlestep_enabled)) {",
"if (VAR_7->is_jmp == DISAS_NEXT) {",
"tcg_gen_movi_tl(env_pc, npc);",
"}",
"t_gen_raise_exception(EXCP_DEBUG);",
"} else {",
"switch (VAR_7->is_jmp) {",
"case DISAS_NEXT:\ngen_goto_tb(VAR_7, 1, npc);",
"break;",
"default:\ncase DISAS_JUMP:\ncase DISAS_UPDATE:\ntcg_gen_exit_tb(0);",
"break;",
"case DISAS_SWI:\ncase DISAS_TB_JUMP:\nbreak;",
"}",
"}",
"gen_tb_end(VAR_1, VAR_8);",
"if (VAR_2) {",
"VAR_4 = tcg_op_buf_count();",
"VAR_5++;",
"while (VAR_5 <= VAR_4) {",
"tcg_ctx.gen_opc_instr_start[VAR_5++] = 0;",
"}",
"} else {",
"VAR_1->size = VAR_7->pc - pc_start;",
"VAR_1->icount = VAR_8;",
"}",
"#ifdef DEBUG_DISAS\n#if !DISAS_CRIS\nif (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) {",
"log_target_disas(env, pc_start, VAR_7->pc - pc_start,\nenv->pregs[PR_VR]);",
"qemu_log(\"\\nisize=%d osize=%d\\n\",\nVAR_7->pc - pc_start, tcg_op_buf_count());",
"}",
"#endif\n#endif\n}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
53
],
[
55
],
[
57
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
85
],
[
87
],
[
93,
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
111
],
[
115
],
[
117,
119,
121,
123,
125,
127,
129,
131,
133,
135,
137,
139,
141,
143,
145,
147,
149,
151
],
[
153
],
[
155
],
[
157
],
[
161
],
[
163
],
[
165
],
[
167
],
[
169
],
[
171
],
[
173
],
[
177
],
[
179
],
[
181
],
[
185
],
[
187
],
[
189
],
[
191
],
[
193
],
[
195
],
[
197
],
[
199
],
[
201
],
[
203
],
[
205
],
[
207
],
[
209
],
[
211
],
[
213
],
[
215
],
[
221
],
[
225
],
[
227
],
[
229
],
[
231
],
[
235
],
[
237
],
[
239
],
[
241
],
[
243
],
[
245
],
[
249
],
[
257
],
[
259
],
[
261
],
[
263
],
[
265
],
[
267
],
[
269,
271
],
[
273
],
[
275
],
[
279
],
[
281
],
[
283
],
[
285
],
[
289
],
[
291
],
[
295
],
[
297
],
[
303,
305
],
[
307
],
[
309
],
[
311
],
[
313
],
[
315
],
[
317
],
[
319
],
[
321
],
[
323
],
[
325
],
[
327
],
[
329
],
[
331
],
[
333
],
[
335
],
[
337
],
[
339
],
[
347
],
[
349
],
[
351
],
[
353
],
[
355,
357,
359,
361
],
[
365
],
[
367
],
[
369
],
[
373
],
[
377,
379
],
[
383,
385,
387
],
[
389
],
[
391
],
[
393
],
[
397
],
[
401
],
[
403
],
[
405
],
[
409
],
[
413
],
[
415
],
[
417
],
[
419
],
[
421
],
[
423
],
[
425
],
[
427,
429
],
[
431
],
[
433,
435,
437,
443
],
[
445
],
[
447,
449,
453
],
[
455
],
[
457
],
[
459
],
[
463
],
[
465
],
[
467
],
[
469
],
[
471
],
[
473
],
[
475
],
[
477
],
[
479
],
[
481
],
[
485,
487,
489
],
[
491,
493
],
[
495,
497
],
[
499
],
[
501,
503,
505
]
]
|
14,812 | uint64_t float64_to_uint64_round_to_zero (float64 a STATUS_PARAM)
{
int64_t v;
v = int64_to_float64(INT64_MIN STATUS_VAR);
v = float64_to_int64_round_to_zero((a + v) STATUS_VAR);
return v - INT64_MIN;
}
| false | qemu | f090c9d4ad5812fb92843d6470a1111c15190c4c | uint64_t float64_to_uint64_round_to_zero (float64 a STATUS_PARAM)
{
int64_t v;
v = int64_to_float64(INT64_MIN STATUS_VAR);
v = float64_to_int64_round_to_zero((a + v) STATUS_VAR);
return v - INT64_MIN;
}
| {
"code": [],
"line_no": []
} | uint64_t FUNC_0 (float64 a STATUS_PARAM)
{
int64_t v;
v = int64_to_float64(INT64_MIN STATUS_VAR);
v = float64_to_int64_round_to_zero((a + v) STATUS_VAR);
return v - INT64_MIN;
}
| [
"uint64_t FUNC_0 (float64 a STATUS_PARAM)\n{",
"int64_t v;",
"v = int64_to_float64(INT64_MIN STATUS_VAR);",
"v = float64_to_int64_round_to_zero((a + v) STATUS_VAR);",
"return v - INT64_MIN;",
"}"
]
| [
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
15
],
[
17
]
]
|
14,815 | static AHCIQState *ahci_boot(void)
{
AHCIQState *s;
const char *cli;
s = g_malloc0(sizeof(AHCIQState));
cli = "-drive if=none,id=drive0,file=%s,cache=writeback,serial=%s"
",format=raw"
" -M q35 "
"-device ide-hd,drive=drive0 "
"-global ide-hd.ver=%s";
s->parent = qtest_pc_boot(cli, tmp_path, "testdisk", "version");
/* Verify that we have an AHCI device present. */
s->dev = get_ahci_device(&s->fingerprint);
return s;
} | true | qemu | 259342d34dbdfb304374f569feec26317edd97c9 | static AHCIQState *ahci_boot(void)
{
AHCIQState *s;
const char *cli;
s = g_malloc0(sizeof(AHCIQState));
cli = "-drive if=none,id=drive0,file=%s,cache=writeback,serial=%s"
",format=raw"
" -M q35 "
"-device ide-hd,drive=drive0 "
"-global ide-hd.ver=%s";
s->parent = qtest_pc_boot(cli, tmp_path, "testdisk", "version");
s->dev = get_ahci_device(&s->fingerprint);
return s;
} | {
"code": [],
"line_no": []
} | static AHCIQState *FUNC_0(void)
{
AHCIQState *s;
const char *VAR_0;
s = g_malloc0(sizeof(AHCIQState));
VAR_0 = "-drive if=none,id=drive0,file=%s,cache=writeback,serial=%s"
",format=raw"
" -M q35 "
"-device ide-hd,drive=drive0 "
"-global ide-hd.ver=%s";
s->parent = qtest_pc_boot(VAR_0, tmp_path, "testdisk", "version");
s->dev = get_ahci_device(&s->fingerprint);
return s;
} | [
"static AHCIQState *FUNC_0(void)\n{",
"AHCIQState *s;",
"const char *VAR_0;",
"s = g_malloc0(sizeof(AHCIQState));",
"VAR_0 = \"-drive if=none,id=drive0,file=%s,cache=writeback,serial=%s\"\n\",format=raw\"\n\" -M q35 \"\n\"-device ide-hd,drive=drive0 \"\n\"-global ide-hd.ver=%s\";",
"s->parent = qtest_pc_boot(VAR_0, tmp_path, \"testdisk\", \"version\");",
"s->dev = get_ahci_device(&s->fingerprint);",
"return s;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
15,
17,
19,
21,
23
],
[
25
],
[
32
],
[
36
],
[
38
]
]
|
14,817 | static inline int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf,
int buf_size, AVCodecContext *avctx)
{
HEVCParserContext *ctx = s->priv_data;
HEVCContext *h = &ctx->h;
GetBitContext *gb;
SliceHeader *sh = &h->sh;
HEVCParamSets *ps = &h->ps;
HEVCPacket *pkt = &ctx->pkt;
const uint8_t *buf_end = buf + buf_size;
int state = -1, i;
HEVCNAL *nal;
int is_global = buf == avctx->extradata;
if (!h->HEVClc)
h->HEVClc = av_mallocz(sizeof(HEVCLocalContext));
if (!h->HEVClc)
return AVERROR(ENOMEM);
gb = &h->HEVClc->gb;
/* set some sane default values */
s->pict_type = AV_PICTURE_TYPE_I;
s->key_frame = 0;
s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN;
h->avctx = avctx;
if (!buf_size)
return 0;
if (pkt->nals_allocated < 1) {
HEVCNAL *tmp = av_realloc_array(pkt->nals, 1, sizeof(*tmp));
if (!tmp)
return AVERROR(ENOMEM);
pkt->nals = tmp;
memset(pkt->nals, 0, sizeof(*tmp));
pkt->nals_allocated = 1;
}
nal = &pkt->nals[0];
for (;;) {
int src_length, consumed;
buf = avpriv_find_start_code(buf, buf_end, &state);
if (--buf + 2 >= buf_end)
break;
src_length = buf_end - buf;
h->nal_unit_type = (*buf >> 1) & 0x3f;
h->temporal_id = (*(buf + 1) & 0x07) - 1;
if (h->nal_unit_type <= NAL_CRA_NUT) {
// Do not walk the whole buffer just to decode slice segment header
if (src_length > 20)
src_length = 20;
}
consumed = ff_hevc_extract_rbsp(NULL, buf, src_length, nal);
if (consumed < 0)
return consumed;
init_get_bits8(gb, nal->data + 2, nal->size);
switch (h->nal_unit_type) {
case NAL_VPS:
ff_hevc_decode_nal_vps(gb, avctx, ps);
break;
case NAL_SPS:
ff_hevc_decode_nal_sps(gb, avctx, ps, 1);
break;
case NAL_PPS:
ff_hevc_decode_nal_pps(gb, avctx, ps);
break;
case NAL_SEI_PREFIX:
case NAL_SEI_SUFFIX:
ff_hevc_decode_nal_sei(h);
break;
case NAL_TRAIL_N:
case NAL_TRAIL_R:
case NAL_TSA_N:
case NAL_TSA_R:
case NAL_STSA_N:
case NAL_STSA_R:
case NAL_RADL_N:
case NAL_RADL_R:
case NAL_RASL_N:
case NAL_RASL_R:
case NAL_BLA_W_LP:
case NAL_BLA_W_RADL:
case NAL_BLA_N_LP:
case NAL_IDR_W_RADL:
case NAL_IDR_N_LP:
case NAL_CRA_NUT:
if (is_global) {
av_log(avctx, AV_LOG_ERROR, "Invalid NAL unit: %d\n", h->nal_unit_type);
return AVERROR_INVALIDDATA;
}
sh->first_slice_in_pic_flag = get_bits1(gb);
s->picture_structure = h->picture_struct;
s->field_order = h->picture_struct;
if (IS_IRAP(h)) {
s->key_frame = 1;
sh->no_output_of_prior_pics_flag = get_bits1(gb);
}
sh->pps_id = get_ue_golomb(gb);
if (sh->pps_id >= MAX_PPS_COUNT || !ps->pps_list[sh->pps_id]) {
av_log(avctx, AV_LOG_ERROR, "PPS id out of range: %d\n", sh->pps_id);
return AVERROR_INVALIDDATA;
}
ps->pps = (HEVCPPS*)ps->pps_list[sh->pps_id]->data;
if (ps->pps->sps_id >= MAX_SPS_COUNT || !ps->sps_list[ps->pps->sps_id]) {
av_log(avctx, AV_LOG_ERROR, "SPS id out of range: %d\n", ps->pps->sps_id);
return AVERROR_INVALIDDATA;
}
if (ps->sps != (HEVCSPS*)ps->sps_list[ps->pps->sps_id]->data) {
ps->sps = (HEVCSPS*)ps->sps_list[ps->pps->sps_id]->data;
ps->vps = (HEVCVPS*)ps->vps_list[ps->sps->vps_id]->data;
}
if (!sh->first_slice_in_pic_flag) {
int slice_address_length;
if (ps->pps->dependent_slice_segments_enabled_flag)
sh->dependent_slice_segment_flag = get_bits1(gb);
else
sh->dependent_slice_segment_flag = 0;
slice_address_length = av_ceil_log2_c(ps->sps->ctb_width *
ps->sps->ctb_height);
sh->slice_segment_addr = slice_address_length ? get_bits(gb, slice_address_length) : 0;
if (sh->slice_segment_addr >= ps->sps->ctb_width * ps->sps->ctb_height) {
av_log(avctx, AV_LOG_ERROR, "Invalid slice segment address: %u.\n",
sh->slice_segment_addr);
return AVERROR_INVALIDDATA;
}
} else
sh->dependent_slice_segment_flag = 0;
if (sh->dependent_slice_segment_flag)
break;
for (i = 0; i < ps->pps->num_extra_slice_header_bits; i++)
skip_bits(gb, 1); // slice_reserved_undetermined_flag[]
sh->slice_type = get_ue_golomb(gb);
if (!(sh->slice_type == I_SLICE || sh->slice_type == P_SLICE ||
sh->slice_type == B_SLICE)) {
av_log(avctx, AV_LOG_ERROR, "Unknown slice type: %d.\n",
sh->slice_type);
return AVERROR_INVALIDDATA;
}
s->pict_type = sh->slice_type == B_SLICE ? AV_PICTURE_TYPE_B :
sh->slice_type == P_SLICE ? AV_PICTURE_TYPE_P :
AV_PICTURE_TYPE_I;
if (ps->pps->output_flag_present_flag)
sh->pic_output_flag = get_bits1(gb);
if (ps->sps->separate_colour_plane_flag)
sh->colour_plane_id = get_bits(gb, 2);
if (!IS_IDR(h)) {
sh->pic_order_cnt_lsb = get_bits(gb, ps->sps->log2_max_poc_lsb);
s->output_picture_number = h->poc = ff_hevc_compute_poc(h, sh->pic_order_cnt_lsb);
} else
s->output_picture_number = h->poc = 0;
if (h->temporal_id == 0 &&
h->nal_unit_type != NAL_TRAIL_N &&
h->nal_unit_type != NAL_TSA_N &&
h->nal_unit_type != NAL_STSA_N &&
h->nal_unit_type != NAL_RADL_N &&
h->nal_unit_type != NAL_RASL_N &&
h->nal_unit_type != NAL_RADL_R &&
h->nal_unit_type != NAL_RASL_R)
h->pocTid0 = h->poc;
return 0; /* no need to evaluate the rest */
}
buf += consumed;
}
/* didn't find a picture! */
if (!is_global)
av_log(h->avctx, AV_LOG_ERROR, "missing picture in access unit\n");
return -1;
}
| true | FFmpeg | bd6610c3b39e24ff3c3745cdfc5c69450bc7b0e5 | static inline int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf,
int buf_size, AVCodecContext *avctx)
{
HEVCParserContext *ctx = s->priv_data;
HEVCContext *h = &ctx->h;
GetBitContext *gb;
SliceHeader *sh = &h->sh;
HEVCParamSets *ps = &h->ps;
HEVCPacket *pkt = &ctx->pkt;
const uint8_t *buf_end = buf + buf_size;
int state = -1, i;
HEVCNAL *nal;
int is_global = buf == avctx->extradata;
if (!h->HEVClc)
h->HEVClc = av_mallocz(sizeof(HEVCLocalContext));
if (!h->HEVClc)
return AVERROR(ENOMEM);
gb = &h->HEVClc->gb;
s->pict_type = AV_PICTURE_TYPE_I;
s->key_frame = 0;
s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN;
h->avctx = avctx;
if (!buf_size)
return 0;
if (pkt->nals_allocated < 1) {
HEVCNAL *tmp = av_realloc_array(pkt->nals, 1, sizeof(*tmp));
if (!tmp)
return AVERROR(ENOMEM);
pkt->nals = tmp;
memset(pkt->nals, 0, sizeof(*tmp));
pkt->nals_allocated = 1;
}
nal = &pkt->nals[0];
for (;;) {
int src_length, consumed;
buf = avpriv_find_start_code(buf, buf_end, &state);
if (--buf + 2 >= buf_end)
break;
src_length = buf_end - buf;
h->nal_unit_type = (*buf >> 1) & 0x3f;
h->temporal_id = (*(buf + 1) & 0x07) - 1;
if (h->nal_unit_type <= NAL_CRA_NUT) {
if (src_length > 20)
src_length = 20;
}
consumed = ff_hevc_extract_rbsp(NULL, buf, src_length, nal);
if (consumed < 0)
return consumed;
init_get_bits8(gb, nal->data + 2, nal->size);
switch (h->nal_unit_type) {
case NAL_VPS:
ff_hevc_decode_nal_vps(gb, avctx, ps);
break;
case NAL_SPS:
ff_hevc_decode_nal_sps(gb, avctx, ps, 1);
break;
case NAL_PPS:
ff_hevc_decode_nal_pps(gb, avctx, ps);
break;
case NAL_SEI_PREFIX:
case NAL_SEI_SUFFIX:
ff_hevc_decode_nal_sei(h);
break;
case NAL_TRAIL_N:
case NAL_TRAIL_R:
case NAL_TSA_N:
case NAL_TSA_R:
case NAL_STSA_N:
case NAL_STSA_R:
case NAL_RADL_N:
case NAL_RADL_R:
case NAL_RASL_N:
case NAL_RASL_R:
case NAL_BLA_W_LP:
case NAL_BLA_W_RADL:
case NAL_BLA_N_LP:
case NAL_IDR_W_RADL:
case NAL_IDR_N_LP:
case NAL_CRA_NUT:
if (is_global) {
av_log(avctx, AV_LOG_ERROR, "Invalid NAL unit: %d\n", h->nal_unit_type);
return AVERROR_INVALIDDATA;
}
sh->first_slice_in_pic_flag = get_bits1(gb);
s->picture_structure = h->picture_struct;
s->field_order = h->picture_struct;
if (IS_IRAP(h)) {
s->key_frame = 1;
sh->no_output_of_prior_pics_flag = get_bits1(gb);
}
sh->pps_id = get_ue_golomb(gb);
if (sh->pps_id >= MAX_PPS_COUNT || !ps->pps_list[sh->pps_id]) {
av_log(avctx, AV_LOG_ERROR, "PPS id out of range: %d\n", sh->pps_id);
return AVERROR_INVALIDDATA;
}
ps->pps = (HEVCPPS*)ps->pps_list[sh->pps_id]->data;
if (ps->pps->sps_id >= MAX_SPS_COUNT || !ps->sps_list[ps->pps->sps_id]) {
av_log(avctx, AV_LOG_ERROR, "SPS id out of range: %d\n", ps->pps->sps_id);
return AVERROR_INVALIDDATA;
}
if (ps->sps != (HEVCSPS*)ps->sps_list[ps->pps->sps_id]->data) {
ps->sps = (HEVCSPS*)ps->sps_list[ps->pps->sps_id]->data;
ps->vps = (HEVCVPS*)ps->vps_list[ps->sps->vps_id]->data;
}
if (!sh->first_slice_in_pic_flag) {
int slice_address_length;
if (ps->pps->dependent_slice_segments_enabled_flag)
sh->dependent_slice_segment_flag = get_bits1(gb);
else
sh->dependent_slice_segment_flag = 0;
slice_address_length = av_ceil_log2_c(ps->sps->ctb_width *
ps->sps->ctb_height);
sh->slice_segment_addr = slice_address_length ? get_bits(gb, slice_address_length) : 0;
if (sh->slice_segment_addr >= ps->sps->ctb_width * ps->sps->ctb_height) {
av_log(avctx, AV_LOG_ERROR, "Invalid slice segment address: %u.\n",
sh->slice_segment_addr);
return AVERROR_INVALIDDATA;
}
} else
sh->dependent_slice_segment_flag = 0;
if (sh->dependent_slice_segment_flag)
break;
for (i = 0; i < ps->pps->num_extra_slice_header_bits; i++)
skip_bits(gb, 1);
sh->slice_type = get_ue_golomb(gb);
if (!(sh->slice_type == I_SLICE || sh->slice_type == P_SLICE ||
sh->slice_type == B_SLICE)) {
av_log(avctx, AV_LOG_ERROR, "Unknown slice type: %d.\n",
sh->slice_type);
return AVERROR_INVALIDDATA;
}
s->pict_type = sh->slice_type == B_SLICE ? AV_PICTURE_TYPE_B :
sh->slice_type == P_SLICE ? AV_PICTURE_TYPE_P :
AV_PICTURE_TYPE_I;
if (ps->pps->output_flag_present_flag)
sh->pic_output_flag = get_bits1(gb);
if (ps->sps->separate_colour_plane_flag)
sh->colour_plane_id = get_bits(gb, 2);
if (!IS_IDR(h)) {
sh->pic_order_cnt_lsb = get_bits(gb, ps->sps->log2_max_poc_lsb);
s->output_picture_number = h->poc = ff_hevc_compute_poc(h, sh->pic_order_cnt_lsb);
} else
s->output_picture_number = h->poc = 0;
if (h->temporal_id == 0 &&
h->nal_unit_type != NAL_TRAIL_N &&
h->nal_unit_type != NAL_TSA_N &&
h->nal_unit_type != NAL_STSA_N &&
h->nal_unit_type != NAL_RADL_N &&
h->nal_unit_type != NAL_RASL_N &&
h->nal_unit_type != NAL_RADL_R &&
h->nal_unit_type != NAL_RASL_R)
h->pocTid0 = h->poc;
return 0;
}
buf += consumed;
}
if (!is_global)
av_log(h->avctx, AV_LOG_ERROR, "missing picture in access unit\n");
return -1;
}
| {
"code": [
" init_get_bits8(gb, nal->data + 2, nal->size);"
],
"line_no": [
123
]
} | static inline int FUNC_0(AVCodecParserContext *VAR_0, const uint8_t *VAR_1,
int VAR_2, AVCodecContext *VAR_3)
{
HEVCParserContext *ctx = VAR_0->priv_data;
HEVCContext *h = &ctx->h;
GetBitContext *gb;
SliceHeader *sh = &h->sh;
HEVCParamSets *ps = &h->ps;
HEVCPacket *pkt = &ctx->pkt;
const uint8_t *VAR_4 = VAR_1 + VAR_2;
int VAR_5 = -1, VAR_6;
HEVCNAL *nal;
int VAR_7 = VAR_1 == VAR_3->extradata;
if (!h->HEVClc)
h->HEVClc = av_mallocz(sizeof(HEVCLocalContext));
if (!h->HEVClc)
return AVERROR(ENOMEM);
gb = &h->HEVClc->gb;
VAR_0->pict_type = AV_PICTURE_TYPE_I;
VAR_0->key_frame = 0;
VAR_0->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN;
h->VAR_3 = VAR_3;
if (!VAR_2)
return 0;
if (pkt->nals_allocated < 1) {
HEVCNAL *tmp = av_realloc_array(pkt->nals, 1, sizeof(*tmp));
if (!tmp)
return AVERROR(ENOMEM);
pkt->nals = tmp;
memset(pkt->nals, 0, sizeof(*tmp));
pkt->nals_allocated = 1;
}
nal = &pkt->nals[0];
for (;;) {
int VAR_8, VAR_9;
VAR_1 = avpriv_find_start_code(VAR_1, VAR_4, &VAR_5);
if (--VAR_1 + 2 >= VAR_4)
break;
VAR_8 = VAR_4 - VAR_1;
h->nal_unit_type = (*VAR_1 >> 1) & 0x3f;
h->temporal_id = (*(VAR_1 + 1) & 0x07) - 1;
if (h->nal_unit_type <= NAL_CRA_NUT) {
if (VAR_8 > 20)
VAR_8 = 20;
}
VAR_9 = ff_hevc_extract_rbsp(NULL, VAR_1, VAR_8, nal);
if (VAR_9 < 0)
return VAR_9;
init_get_bits8(gb, nal->data + 2, nal->size);
switch (h->nal_unit_type) {
case NAL_VPS:
ff_hevc_decode_nal_vps(gb, VAR_3, ps);
break;
case NAL_SPS:
ff_hevc_decode_nal_sps(gb, VAR_3, ps, 1);
break;
case NAL_PPS:
ff_hevc_decode_nal_pps(gb, VAR_3, ps);
break;
case NAL_SEI_PREFIX:
case NAL_SEI_SUFFIX:
ff_hevc_decode_nal_sei(h);
break;
case NAL_TRAIL_N:
case NAL_TRAIL_R:
case NAL_TSA_N:
case NAL_TSA_R:
case NAL_STSA_N:
case NAL_STSA_R:
case NAL_RADL_N:
case NAL_RADL_R:
case NAL_RASL_N:
case NAL_RASL_R:
case NAL_BLA_W_LP:
case NAL_BLA_W_RADL:
case NAL_BLA_N_LP:
case NAL_IDR_W_RADL:
case NAL_IDR_N_LP:
case NAL_CRA_NUT:
if (VAR_7) {
av_log(VAR_3, AV_LOG_ERROR, "Invalid NAL unit: %d\n", h->nal_unit_type);
return AVERROR_INVALIDDATA;
}
sh->first_slice_in_pic_flag = get_bits1(gb);
VAR_0->picture_structure = h->picture_struct;
VAR_0->field_order = h->picture_struct;
if (IS_IRAP(h)) {
VAR_0->key_frame = 1;
sh->no_output_of_prior_pics_flag = get_bits1(gb);
}
sh->pps_id = get_ue_golomb(gb);
if (sh->pps_id >= MAX_PPS_COUNT || !ps->pps_list[sh->pps_id]) {
av_log(VAR_3, AV_LOG_ERROR, "PPS id out of range: %d\n", sh->pps_id);
return AVERROR_INVALIDDATA;
}
ps->pps = (HEVCPPS*)ps->pps_list[sh->pps_id]->data;
if (ps->pps->sps_id >= MAX_SPS_COUNT || !ps->sps_list[ps->pps->sps_id]) {
av_log(VAR_3, AV_LOG_ERROR, "SPS id out of range: %d\n", ps->pps->sps_id);
return AVERROR_INVALIDDATA;
}
if (ps->sps != (HEVCSPS*)ps->sps_list[ps->pps->sps_id]->data) {
ps->sps = (HEVCSPS*)ps->sps_list[ps->pps->sps_id]->data;
ps->vps = (HEVCVPS*)ps->vps_list[ps->sps->vps_id]->data;
}
if (!sh->first_slice_in_pic_flag) {
int VAR_10;
if (ps->pps->dependent_slice_segments_enabled_flag)
sh->dependent_slice_segment_flag = get_bits1(gb);
else
sh->dependent_slice_segment_flag = 0;
VAR_10 = av_ceil_log2_c(ps->sps->ctb_width *
ps->sps->ctb_height);
sh->slice_segment_addr = VAR_10 ? get_bits(gb, VAR_10) : 0;
if (sh->slice_segment_addr >= ps->sps->ctb_width * ps->sps->ctb_height) {
av_log(VAR_3, AV_LOG_ERROR, "Invalid slice segment address: %u.\n",
sh->slice_segment_addr);
return AVERROR_INVALIDDATA;
}
} else
sh->dependent_slice_segment_flag = 0;
if (sh->dependent_slice_segment_flag)
break;
for (VAR_6 = 0; VAR_6 < ps->pps->num_extra_slice_header_bits; VAR_6++)
skip_bits(gb, 1);
sh->slice_type = get_ue_golomb(gb);
if (!(sh->slice_type == I_SLICE || sh->slice_type == P_SLICE ||
sh->slice_type == B_SLICE)) {
av_log(VAR_3, AV_LOG_ERROR, "Unknown slice type: %d.\n",
sh->slice_type);
return AVERROR_INVALIDDATA;
}
VAR_0->pict_type = sh->slice_type == B_SLICE ? AV_PICTURE_TYPE_B :
sh->slice_type == P_SLICE ? AV_PICTURE_TYPE_P :
AV_PICTURE_TYPE_I;
if (ps->pps->output_flag_present_flag)
sh->pic_output_flag = get_bits1(gb);
if (ps->sps->separate_colour_plane_flag)
sh->colour_plane_id = get_bits(gb, 2);
if (!IS_IDR(h)) {
sh->pic_order_cnt_lsb = get_bits(gb, ps->sps->log2_max_poc_lsb);
VAR_0->output_picture_number = h->poc = ff_hevc_compute_poc(h, sh->pic_order_cnt_lsb);
} else
VAR_0->output_picture_number = h->poc = 0;
if (h->temporal_id == 0 &&
h->nal_unit_type != NAL_TRAIL_N &&
h->nal_unit_type != NAL_TSA_N &&
h->nal_unit_type != NAL_STSA_N &&
h->nal_unit_type != NAL_RADL_N &&
h->nal_unit_type != NAL_RASL_N &&
h->nal_unit_type != NAL_RADL_R &&
h->nal_unit_type != NAL_RASL_R)
h->pocTid0 = h->poc;
return 0;
}
VAR_1 += VAR_9;
}
if (!VAR_7)
av_log(h->VAR_3, AV_LOG_ERROR, "missing picture in access unit\n");
return -1;
}
| [
"static inline int FUNC_0(AVCodecParserContext *VAR_0, const uint8_t *VAR_1,\nint VAR_2, AVCodecContext *VAR_3)\n{",
"HEVCParserContext *ctx = VAR_0->priv_data;",
"HEVCContext *h = &ctx->h;",
"GetBitContext *gb;",
"SliceHeader *sh = &h->sh;",
"HEVCParamSets *ps = &h->ps;",
"HEVCPacket *pkt = &ctx->pkt;",
"const uint8_t *VAR_4 = VAR_1 + VAR_2;",
"int VAR_5 = -1, VAR_6;",
"HEVCNAL *nal;",
"int VAR_7 = VAR_1 == VAR_3->extradata;",
"if (!h->HEVClc)\nh->HEVClc = av_mallocz(sizeof(HEVCLocalContext));",
"if (!h->HEVClc)\nreturn AVERROR(ENOMEM);",
"gb = &h->HEVClc->gb;",
"VAR_0->pict_type = AV_PICTURE_TYPE_I;",
"VAR_0->key_frame = 0;",
"VAR_0->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN;",
"h->VAR_3 = VAR_3;",
"if (!VAR_2)\nreturn 0;",
"if (pkt->nals_allocated < 1) {",
"HEVCNAL *tmp = av_realloc_array(pkt->nals, 1, sizeof(*tmp));",
"if (!tmp)\nreturn AVERROR(ENOMEM);",
"pkt->nals = tmp;",
"memset(pkt->nals, 0, sizeof(*tmp));",
"pkt->nals_allocated = 1;",
"}",
"nal = &pkt->nals[0];",
"for (;;) {",
"int VAR_8, VAR_9;",
"VAR_1 = avpriv_find_start_code(VAR_1, VAR_4, &VAR_5);",
"if (--VAR_1 + 2 >= VAR_4)\nbreak;",
"VAR_8 = VAR_4 - VAR_1;",
"h->nal_unit_type = (*VAR_1 >> 1) & 0x3f;",
"h->temporal_id = (*(VAR_1 + 1) & 0x07) - 1;",
"if (h->nal_unit_type <= NAL_CRA_NUT) {",
"if (VAR_8 > 20)\nVAR_8 = 20;",
"}",
"VAR_9 = ff_hevc_extract_rbsp(NULL, VAR_1, VAR_8, nal);",
"if (VAR_9 < 0)\nreturn VAR_9;",
"init_get_bits8(gb, nal->data + 2, nal->size);",
"switch (h->nal_unit_type) {",
"case NAL_VPS:\nff_hevc_decode_nal_vps(gb, VAR_3, ps);",
"break;",
"case NAL_SPS:\nff_hevc_decode_nal_sps(gb, VAR_3, ps, 1);",
"break;",
"case NAL_PPS:\nff_hevc_decode_nal_pps(gb, VAR_3, ps);",
"break;",
"case NAL_SEI_PREFIX:\ncase NAL_SEI_SUFFIX:\nff_hevc_decode_nal_sei(h);",
"break;",
"case NAL_TRAIL_N:\ncase NAL_TRAIL_R:\ncase NAL_TSA_N:\ncase NAL_TSA_R:\ncase NAL_STSA_N:\ncase NAL_STSA_R:\ncase NAL_RADL_N:\ncase NAL_RADL_R:\ncase NAL_RASL_N:\ncase NAL_RASL_R:\ncase NAL_BLA_W_LP:\ncase NAL_BLA_W_RADL:\ncase NAL_BLA_N_LP:\ncase NAL_IDR_W_RADL:\ncase NAL_IDR_N_LP:\ncase NAL_CRA_NUT:\nif (VAR_7) {",
"av_log(VAR_3, AV_LOG_ERROR, \"Invalid NAL unit: %d\\n\", h->nal_unit_type);",
"return AVERROR_INVALIDDATA;",
"}",
"sh->first_slice_in_pic_flag = get_bits1(gb);",
"VAR_0->picture_structure = h->picture_struct;",
"VAR_0->field_order = h->picture_struct;",
"if (IS_IRAP(h)) {",
"VAR_0->key_frame = 1;",
"sh->no_output_of_prior_pics_flag = get_bits1(gb);",
"}",
"sh->pps_id = get_ue_golomb(gb);",
"if (sh->pps_id >= MAX_PPS_COUNT || !ps->pps_list[sh->pps_id]) {",
"av_log(VAR_3, AV_LOG_ERROR, \"PPS id out of range: %d\\n\", sh->pps_id);",
"return AVERROR_INVALIDDATA;",
"}",
"ps->pps = (HEVCPPS*)ps->pps_list[sh->pps_id]->data;",
"if (ps->pps->sps_id >= MAX_SPS_COUNT || !ps->sps_list[ps->pps->sps_id]) {",
"av_log(VAR_3, AV_LOG_ERROR, \"SPS id out of range: %d\\n\", ps->pps->sps_id);",
"return AVERROR_INVALIDDATA;",
"}",
"if (ps->sps != (HEVCSPS*)ps->sps_list[ps->pps->sps_id]->data) {",
"ps->sps = (HEVCSPS*)ps->sps_list[ps->pps->sps_id]->data;",
"ps->vps = (HEVCVPS*)ps->vps_list[ps->sps->vps_id]->data;",
"}",
"if (!sh->first_slice_in_pic_flag) {",
"int VAR_10;",
"if (ps->pps->dependent_slice_segments_enabled_flag)\nsh->dependent_slice_segment_flag = get_bits1(gb);",
"else\nsh->dependent_slice_segment_flag = 0;",
"VAR_10 = av_ceil_log2_c(ps->sps->ctb_width *\nps->sps->ctb_height);",
"sh->slice_segment_addr = VAR_10 ? get_bits(gb, VAR_10) : 0;",
"if (sh->slice_segment_addr >= ps->sps->ctb_width * ps->sps->ctb_height) {",
"av_log(VAR_3, AV_LOG_ERROR, \"Invalid slice segment address: %u.\\n\",\nsh->slice_segment_addr);",
"return AVERROR_INVALIDDATA;",
"}",
"} else",
"sh->dependent_slice_segment_flag = 0;",
"if (sh->dependent_slice_segment_flag)\nbreak;",
"for (VAR_6 = 0; VAR_6 < ps->pps->num_extra_slice_header_bits; VAR_6++)",
"skip_bits(gb, 1);",
"sh->slice_type = get_ue_golomb(gb);",
"if (!(sh->slice_type == I_SLICE || sh->slice_type == P_SLICE ||\nsh->slice_type == B_SLICE)) {",
"av_log(VAR_3, AV_LOG_ERROR, \"Unknown slice type: %d.\\n\",\nsh->slice_type);",
"return AVERROR_INVALIDDATA;",
"}",
"VAR_0->pict_type = sh->slice_type == B_SLICE ? AV_PICTURE_TYPE_B :\nsh->slice_type == P_SLICE ? AV_PICTURE_TYPE_P :\nAV_PICTURE_TYPE_I;",
"if (ps->pps->output_flag_present_flag)\nsh->pic_output_flag = get_bits1(gb);",
"if (ps->sps->separate_colour_plane_flag)\nsh->colour_plane_id = get_bits(gb, 2);",
"if (!IS_IDR(h)) {",
"sh->pic_order_cnt_lsb = get_bits(gb, ps->sps->log2_max_poc_lsb);",
"VAR_0->output_picture_number = h->poc = ff_hevc_compute_poc(h, sh->pic_order_cnt_lsb);",
"} else",
"VAR_0->output_picture_number = h->poc = 0;",
"if (h->temporal_id == 0 &&\nh->nal_unit_type != NAL_TRAIL_N &&\nh->nal_unit_type != NAL_TSA_N &&\nh->nal_unit_type != NAL_STSA_N &&\nh->nal_unit_type != NAL_RADL_N &&\nh->nal_unit_type != NAL_RASL_N &&\nh->nal_unit_type != NAL_RADL_R &&\nh->nal_unit_type != NAL_RASL_R)\nh->pocTid0 = h->poc;",
"return 0;",
"}",
"VAR_1 += VAR_9;",
"}",
"if (!VAR_7)\nav_log(h->VAR_3, AV_LOG_ERROR, \"missing picture in access unit\\n\");",
"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,
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
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
29,
31
],
[
33,
35
],
[
39
],
[
45
],
[
47
],
[
49
],
[
53
],
[
57,
59
],
[
63
],
[
65
],
[
67,
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
81
],
[
85
],
[
87
],
[
89
],
[
91,
93
],
[
95
],
[
99
],
[
101
],
[
103
],
[
107,
109
],
[
111
],
[
115
],
[
117,
119
],
[
123
],
[
125
],
[
127,
129
],
[
131
],
[
133,
135
],
[
137
],
[
139,
141
],
[
143
],
[
145,
147,
149
],
[
151
],
[
153,
155,
157,
159,
161,
163,
165,
167,
169,
171,
173,
175,
177,
179,
181,
183,
187
],
[
189
],
[
191
],
[
193
],
[
197
],
[
199
],
[
201
],
[
205
],
[
207
],
[
209
],
[
211
],
[
215
],
[
217
],
[
219
],
[
221
],
[
223
],
[
225
],
[
229
],
[
231
],
[
233
],
[
235
],
[
237
],
[
239
],
[
241
],
[
243
],
[
247
],
[
249
],
[
253,
255
],
[
257,
259
],
[
263,
265
],
[
267
],
[
269
],
[
271,
273
],
[
275
],
[
277
],
[
279
],
[
281
],
[
285,
287
],
[
291
],
[
293
],
[
297
],
[
299,
301
],
[
303,
305
],
[
307
],
[
309
],
[
311,
313,
315
],
[
319,
321
],
[
325,
327
],
[
331
],
[
333
],
[
335
],
[
337
],
[
339
],
[
343,
345,
347,
349,
351,
353,
355,
357,
359
],
[
363
],
[
365
],
[
367
],
[
369
],
[
373,
375
],
[
377
],
[
379
]
]
|
14,820 | static void decode_colskip(uint8_t* plane, int width, int height, int stride, VC9Context *v){
int x, y;
GetBitContext *gb = &v->s.gb;
for (x=0; x<width; x++){
if (!get_bits(gb, 1)) //colskip
for (y=0; y<height; y++)
plane[y*stride] = 0;
else
for (y=0; y<height; y++)
plane[y*stride] = get_bits(gb, 1);
plane ++;
}
}
| true | FFmpeg | 7cc84d241ba6ef8e27e4d057176a4ad385ad3d59 | static void decode_colskip(uint8_t* plane, int width, int height, int stride, VC9Context *v){
int x, y;
GetBitContext *gb = &v->s.gb;
for (x=0; x<width; x++){
if (!get_bits(gb, 1))
for (y=0; y<height; y++)
plane[y*stride] = 0;
else
for (y=0; y<height; y++)
plane[y*stride] = get_bits(gb, 1);
plane ++;
}
}
| {
"code": [
" GetBitContext *gb = &v->s.gb;",
"static void decode_colskip(uint8_t* plane, int width, int height, int stride, VC9Context *v){",
" GetBitContext *gb = &v->s.gb;"
],
"line_no": [
5,
1,
5
]
} | static void FUNC_0(uint8_t* VAR_0, int VAR_1, int VAR_2, int VAR_3, VC9Context *VAR_4){
int VAR_5, VAR_6;
GetBitContext *gb = &VAR_4->s.gb;
for (VAR_5=0; VAR_5<VAR_1; VAR_5++){
if (!get_bits(gb, 1))
for (VAR_6=0; VAR_6<VAR_2; VAR_6++)
VAR_0[VAR_6*VAR_3] = 0;
else
for (VAR_6=0; VAR_6<VAR_2; VAR_6++)
VAR_0[VAR_6*VAR_3] = get_bits(gb, 1);
VAR_0 ++;
}
}
| [
"static void FUNC_0(uint8_t* VAR_0, int VAR_1, int VAR_2, int VAR_3, VC9Context *VAR_4){",
"int VAR_5, VAR_6;",
"GetBitContext *gb = &VAR_4->s.gb;",
"for (VAR_5=0; VAR_5<VAR_1; VAR_5++){",
"if (!get_bits(gb, 1))\nfor (VAR_6=0; VAR_6<VAR_2; VAR_6++)",
"VAR_0[VAR_6*VAR_3] = 0;",
"else\nfor (VAR_6=0; VAR_6<VAR_2; VAR_6++)",
"VAR_0[VAR_6*VAR_3] = get_bits(gb, 1);",
"VAR_0 ++;",
"}",
"}"
]
| [
1,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1
],
[
3
],
[
5
],
[
9
],
[
11,
13
],
[
15
],
[
17,
19
],
[
21
],
[
23
],
[
25
],
[
27
]
]
|
14,821 | gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb,
int search_pc)
{
DisasContext ctx;
target_ulong pc_start;
uint16_t *gen_opc_end;
int j, lj = -1;
if (search_pc && loglevel)
fprintf (logfile, "search pc %d\n", search_pc);
pc_start = tb->pc;
gen_opc_end = gen_opc_buf + OPC_MAX_SIZE;
ctx.pc = pc_start;
ctx.saved_pc = -1;
ctx.tb = tb;
ctx.bstate = BS_NONE;
/* Restore delay slot state from the tb context. */
ctx.hflags = (uint32_t)tb->flags; /* FIXME: maybe use 64 bits here? */
restore_cpu_state(env, &ctx);
#if defined(CONFIG_USER_ONLY)
ctx.mem_idx = MIPS_HFLAG_UM;
#else
ctx.mem_idx = ctx.hflags & MIPS_HFLAG_KSU;
#endif
#ifdef DEBUG_DISAS
if (loglevel & CPU_LOG_TB_CPU) {
fprintf(logfile, "------------------------------------------------\n");
/* FIXME: This may print out stale hflags from env... */
cpu_dump_state(env, logfile, fprintf, 0);
}
#endif
#ifdef MIPS_DEBUG_DISAS
if (loglevel & CPU_LOG_TB_IN_ASM)
fprintf(logfile, "\ntb %p idx %d hflags %04x\n",
tb, ctx.mem_idx, ctx.hflags);
#endif
while (ctx.bstate == BS_NONE && gen_opc_ptr < gen_opc_end) {
if (env->nb_breakpoints > 0) {
for(j = 0; j < env->nb_breakpoints; j++) {
if (env->breakpoints[j] == ctx.pc) {
save_cpu_state(&ctx, 1);
ctx.bstate = BS_BRANCH;
gen_op_debug();
/* Include the breakpoint location or the tb won't
* be flushed when it must be. */
ctx.pc += 4;
goto done_generating;
}
}
}
if (search_pc) {
j = gen_opc_ptr - gen_opc_buf;
if (lj < j) {
lj++;
while (lj < j)
gen_opc_instr_start[lj++] = 0;
}
gen_opc_pc[lj] = ctx.pc;
gen_opc_hflags[lj] = ctx.hflags & MIPS_HFLAG_BMASK;
gen_opc_instr_start[lj] = 1;
}
ctx.opcode = ldl_code(ctx.pc);
decode_opc(env, &ctx);
ctx.pc += 4;
if (env->singlestep_enabled)
break;
if ((ctx.pc & (TARGET_PAGE_SIZE - 1)) == 0)
break;
#if defined (MIPS_SINGLE_STEP)
break;
#endif
}
if (env->singlestep_enabled) {
save_cpu_state(&ctx, ctx.bstate == BS_NONE);
gen_op_debug();
} else {
switch (ctx.bstate) {
case BS_STOP:
tcg_gen_helper_0_0(do_interrupt_restart);
gen_goto_tb(&ctx, 0, ctx.pc);
break;
case BS_NONE:
save_cpu_state(&ctx, 0);
gen_goto_tb(&ctx, 0, ctx.pc);
break;
case BS_EXCP:
tcg_gen_helper_0_0(do_interrupt_restart);
tcg_gen_exit_tb(0);
break;
case BS_BRANCH:
default:
break;
}
}
done_generating:
*gen_opc_ptr = INDEX_op_end;
if (search_pc) {
j = gen_opc_ptr - gen_opc_buf;
lj++;
while (lj <= j)
gen_opc_instr_start[lj++] = 0;
} else {
tb->size = ctx.pc - pc_start;
}
#ifdef DEBUG_DISAS
#if defined MIPS_DEBUG_DISAS
if (loglevel & CPU_LOG_TB_IN_ASM)
fprintf(logfile, "\n");
#endif
if (loglevel & CPU_LOG_TB_IN_ASM) {
fprintf(logfile, "IN: %s\n", lookup_symbol(pc_start));
target_disas(logfile, pc_start, ctx.pc - pc_start, 0);
fprintf(logfile, "\n");
}
if (loglevel & CPU_LOG_TB_CPU) {
fprintf(logfile, "---------------- %d %08x\n", ctx.bstate, ctx.hflags);
}
#endif
return 0;
}
| true | qemu | faf7aaa9183d5f2029ada291837a8716e9be127b | gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb,
int search_pc)
{
DisasContext ctx;
target_ulong pc_start;
uint16_t *gen_opc_end;
int j, lj = -1;
if (search_pc && loglevel)
fprintf (logfile, "search pc %d\n", search_pc);
pc_start = tb->pc;
gen_opc_end = gen_opc_buf + OPC_MAX_SIZE;
ctx.pc = pc_start;
ctx.saved_pc = -1;
ctx.tb = tb;
ctx.bstate = BS_NONE;
ctx.hflags = (uint32_t)tb->flags;
restore_cpu_state(env, &ctx);
#if defined(CONFIG_USER_ONLY)
ctx.mem_idx = MIPS_HFLAG_UM;
#else
ctx.mem_idx = ctx.hflags & MIPS_HFLAG_KSU;
#endif
#ifdef DEBUG_DISAS
if (loglevel & CPU_LOG_TB_CPU) {
fprintf(logfile, "------------------------------------------------\n");
cpu_dump_state(env, logfile, fprintf, 0);
}
#endif
#ifdef MIPS_DEBUG_DISAS
if (loglevel & CPU_LOG_TB_IN_ASM)
fprintf(logfile, "\ntb %p idx %d hflags %04x\n",
tb, ctx.mem_idx, ctx.hflags);
#endif
while (ctx.bstate == BS_NONE && gen_opc_ptr < gen_opc_end) {
if (env->nb_breakpoints > 0) {
for(j = 0; j < env->nb_breakpoints; j++) {
if (env->breakpoints[j] == ctx.pc) {
save_cpu_state(&ctx, 1);
ctx.bstate = BS_BRANCH;
gen_op_debug();
ctx.pc += 4;
goto done_generating;
}
}
}
if (search_pc) {
j = gen_opc_ptr - gen_opc_buf;
if (lj < j) {
lj++;
while (lj < j)
gen_opc_instr_start[lj++] = 0;
}
gen_opc_pc[lj] = ctx.pc;
gen_opc_hflags[lj] = ctx.hflags & MIPS_HFLAG_BMASK;
gen_opc_instr_start[lj] = 1;
}
ctx.opcode = ldl_code(ctx.pc);
decode_opc(env, &ctx);
ctx.pc += 4;
if (env->singlestep_enabled)
break;
if ((ctx.pc & (TARGET_PAGE_SIZE - 1)) == 0)
break;
#if defined (MIPS_SINGLE_STEP)
break;
#endif
}
if (env->singlestep_enabled) {
save_cpu_state(&ctx, ctx.bstate == BS_NONE);
gen_op_debug();
} else {
switch (ctx.bstate) {
case BS_STOP:
tcg_gen_helper_0_0(do_interrupt_restart);
gen_goto_tb(&ctx, 0, ctx.pc);
break;
case BS_NONE:
save_cpu_state(&ctx, 0);
gen_goto_tb(&ctx, 0, ctx.pc);
break;
case BS_EXCP:
tcg_gen_helper_0_0(do_interrupt_restart);
tcg_gen_exit_tb(0);
break;
case BS_BRANCH:
default:
break;
}
}
done_generating:
*gen_opc_ptr = INDEX_op_end;
if (search_pc) {
j = gen_opc_ptr - gen_opc_buf;
lj++;
while (lj <= j)
gen_opc_instr_start[lj++] = 0;
} else {
tb->size = ctx.pc - pc_start;
}
#ifdef DEBUG_DISAS
#if defined MIPS_DEBUG_DISAS
if (loglevel & CPU_LOG_TB_IN_ASM)
fprintf(logfile, "\n");
#endif
if (loglevel & CPU_LOG_TB_IN_ASM) {
fprintf(logfile, "IN: %s\n", lookup_symbol(pc_start));
target_disas(logfile, pc_start, ctx.pc - pc_start, 0);
fprintf(logfile, "\n");
}
if (loglevel & CPU_LOG_TB_CPU) {
fprintf(logfile, "---------------- %d %08x\n", ctx.bstate, ctx.hflags);
}
#endif
return 0;
}
| {
"code": [
" gen_opc_end = gen_opc_buf + OPC_MAX_SIZE;",
" while (ctx.bstate == BS_NONE && gen_opc_ptr < gen_opc_end) {"
],
"line_no": [
25,
75
]
} | FUNC_0 (CPUState *VAR_0, TranslationBlock *VAR_1,
int VAR_2)
{
DisasContext ctx;
target_ulong pc_start;
uint16_t *gen_opc_end;
int VAR_3, VAR_4 = -1;
if (VAR_2 && loglevel)
fprintf (logfile, "search pc %d\n", VAR_2);
pc_start = VAR_1->pc;
gen_opc_end = gen_opc_buf + OPC_MAX_SIZE;
ctx.pc = pc_start;
ctx.saved_pc = -1;
ctx.VAR_1 = VAR_1;
ctx.bstate = BS_NONE;
ctx.hflags = (uint32_t)VAR_1->flags;
restore_cpu_state(VAR_0, &ctx);
#if defined(CONFIG_USER_ONLY)
ctx.mem_idx = MIPS_HFLAG_UM;
#else
ctx.mem_idx = ctx.hflags & MIPS_HFLAG_KSU;
#endif
#ifdef DEBUG_DISAS
if (loglevel & CPU_LOG_TB_CPU) {
fprintf(logfile, "------------------------------------------------\n");
cpu_dump_state(VAR_0, logfile, fprintf, 0);
}
#endif
#ifdef MIPS_DEBUG_DISAS
if (loglevel & CPU_LOG_TB_IN_ASM)
fprintf(logfile, "\ntb %p idx %d hflags %04x\n",
VAR_1, ctx.mem_idx, ctx.hflags);
#endif
while (ctx.bstate == BS_NONE && gen_opc_ptr < gen_opc_end) {
if (VAR_0->nb_breakpoints > 0) {
for(VAR_3 = 0; VAR_3 < VAR_0->nb_breakpoints; VAR_3++) {
if (VAR_0->breakpoints[VAR_3] == ctx.pc) {
save_cpu_state(&ctx, 1);
ctx.bstate = BS_BRANCH;
gen_op_debug();
ctx.pc += 4;
goto done_generating;
}
}
}
if (VAR_2) {
VAR_3 = gen_opc_ptr - gen_opc_buf;
if (VAR_4 < VAR_3) {
VAR_4++;
while (VAR_4 < VAR_3)
gen_opc_instr_start[VAR_4++] = 0;
}
gen_opc_pc[VAR_4] = ctx.pc;
gen_opc_hflags[VAR_4] = ctx.hflags & MIPS_HFLAG_BMASK;
gen_opc_instr_start[VAR_4] = 1;
}
ctx.opcode = ldl_code(ctx.pc);
decode_opc(VAR_0, &ctx);
ctx.pc += 4;
if (VAR_0->singlestep_enabled)
break;
if ((ctx.pc & (TARGET_PAGE_SIZE - 1)) == 0)
break;
#if defined (MIPS_SINGLE_STEP)
break;
#endif
}
if (VAR_0->singlestep_enabled) {
save_cpu_state(&ctx, ctx.bstate == BS_NONE);
gen_op_debug();
} else {
switch (ctx.bstate) {
case BS_STOP:
tcg_gen_helper_0_0(do_interrupt_restart);
gen_goto_tb(&ctx, 0, ctx.pc);
break;
case BS_NONE:
save_cpu_state(&ctx, 0);
gen_goto_tb(&ctx, 0, ctx.pc);
break;
case BS_EXCP:
tcg_gen_helper_0_0(do_interrupt_restart);
tcg_gen_exit_tb(0);
break;
case BS_BRANCH:
default:
break;
}
}
done_generating:
*gen_opc_ptr = INDEX_op_end;
if (VAR_2) {
VAR_3 = gen_opc_ptr - gen_opc_buf;
VAR_4++;
while (VAR_4 <= VAR_3)
gen_opc_instr_start[VAR_4++] = 0;
} else {
VAR_1->size = ctx.pc - pc_start;
}
#ifdef DEBUG_DISAS
#if defined MIPS_DEBUG_DISAS
if (loglevel & CPU_LOG_TB_IN_ASM)
fprintf(logfile, "\n");
#endif
if (loglevel & CPU_LOG_TB_IN_ASM) {
fprintf(logfile, "IN: %s\n", lookup_symbol(pc_start));
target_disas(logfile, pc_start, ctx.pc - pc_start, 0);
fprintf(logfile, "\n");
}
if (loglevel & CPU_LOG_TB_CPU) {
fprintf(logfile, "---------------- %d %08x\n", ctx.bstate, ctx.hflags);
}
#endif
return 0;
}
| [
"FUNC_0 (CPUState *VAR_0, TranslationBlock *VAR_1,\nint VAR_2)\n{",
"DisasContext ctx;",
"target_ulong pc_start;",
"uint16_t *gen_opc_end;",
"int VAR_3, VAR_4 = -1;",
"if (VAR_2 && loglevel)\nfprintf (logfile, \"search pc %d\\n\", VAR_2);",
"pc_start = VAR_1->pc;",
"gen_opc_end = gen_opc_buf + OPC_MAX_SIZE;",
"ctx.pc = pc_start;",
"ctx.saved_pc = -1;",
"ctx.VAR_1 = VAR_1;",
"ctx.bstate = BS_NONE;",
"ctx.hflags = (uint32_t)VAR_1->flags;",
"restore_cpu_state(VAR_0, &ctx);",
"#if defined(CONFIG_USER_ONLY)\nctx.mem_idx = MIPS_HFLAG_UM;",
"#else\nctx.mem_idx = ctx.hflags & MIPS_HFLAG_KSU;",
"#endif\n#ifdef DEBUG_DISAS\nif (loglevel & CPU_LOG_TB_CPU) {",
"fprintf(logfile, \"------------------------------------------------\\n\");",
"cpu_dump_state(VAR_0, logfile, fprintf, 0);",
"}",
"#endif\n#ifdef MIPS_DEBUG_DISAS\nif (loglevel & CPU_LOG_TB_IN_ASM)\nfprintf(logfile, \"\\ntb %p idx %d hflags %04x\\n\",\nVAR_1, ctx.mem_idx, ctx.hflags);",
"#endif\nwhile (ctx.bstate == BS_NONE && gen_opc_ptr < gen_opc_end) {",
"if (VAR_0->nb_breakpoints > 0) {",
"for(VAR_3 = 0; VAR_3 < VAR_0->nb_breakpoints; VAR_3++) {",
"if (VAR_0->breakpoints[VAR_3] == ctx.pc) {",
"save_cpu_state(&ctx, 1);",
"ctx.bstate = BS_BRANCH;",
"gen_op_debug();",
"ctx.pc += 4;",
"goto done_generating;",
"}",
"}",
"}",
"if (VAR_2) {",
"VAR_3 = gen_opc_ptr - gen_opc_buf;",
"if (VAR_4 < VAR_3) {",
"VAR_4++;",
"while (VAR_4 < VAR_3)\ngen_opc_instr_start[VAR_4++] = 0;",
"}",
"gen_opc_pc[VAR_4] = ctx.pc;",
"gen_opc_hflags[VAR_4] = ctx.hflags & MIPS_HFLAG_BMASK;",
"gen_opc_instr_start[VAR_4] = 1;",
"}",
"ctx.opcode = ldl_code(ctx.pc);",
"decode_opc(VAR_0, &ctx);",
"ctx.pc += 4;",
"if (VAR_0->singlestep_enabled)\nbreak;",
"if ((ctx.pc & (TARGET_PAGE_SIZE - 1)) == 0)\nbreak;",
"#if defined (MIPS_SINGLE_STEP)\nbreak;",
"#endif\n}",
"if (VAR_0->singlestep_enabled) {",
"save_cpu_state(&ctx, ctx.bstate == BS_NONE);",
"gen_op_debug();",
"} else {",
"switch (ctx.bstate) {",
"case BS_STOP:\ntcg_gen_helper_0_0(do_interrupt_restart);",
"gen_goto_tb(&ctx, 0, ctx.pc);",
"break;",
"case BS_NONE:\nsave_cpu_state(&ctx, 0);",
"gen_goto_tb(&ctx, 0, ctx.pc);",
"break;",
"case BS_EXCP:\ntcg_gen_helper_0_0(do_interrupt_restart);",
"tcg_gen_exit_tb(0);",
"break;",
"case BS_BRANCH:\ndefault:\nbreak;",
"}",
"}",
"done_generating:\n*gen_opc_ptr = INDEX_op_end;",
"if (VAR_2) {",
"VAR_3 = gen_opc_ptr - gen_opc_buf;",
"VAR_4++;",
"while (VAR_4 <= VAR_3)\ngen_opc_instr_start[VAR_4++] = 0;",
"} else {",
"VAR_1->size = ctx.pc - pc_start;",
"}",
"#ifdef DEBUG_DISAS\n#if defined MIPS_DEBUG_DISAS\nif (loglevel & CPU_LOG_TB_IN_ASM)\nfprintf(logfile, \"\\n\");",
"#endif\nif (loglevel & CPU_LOG_TB_IN_ASM) {",
"fprintf(logfile, \"IN: %s\\n\", lookup_symbol(pc_start));",
"target_disas(logfile, pc_start, ctx.pc - pc_start, 0);",
"fprintf(logfile, \"\\n\");",
"}",
"if (loglevel & CPU_LOG_TB_CPU) {",
"fprintf(logfile, \"---------------- %d %08x\\n\", ctx.bstate, ctx.hflags);",
"}",
"#endif\nreturn 0;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17,
19
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
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
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113,
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
135,
137
],
[
141,
143
],
[
147,
149
],
[
151,
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165,
167
],
[
169
],
[
171
],
[
173,
175
],
[
177
],
[
179
],
[
181,
183
],
[
185
],
[
187
],
[
189,
191,
193
],
[
195
],
[
197
],
[
199,
201
],
[
203
],
[
205
],
[
207
],
[
209,
211
],
[
213
],
[
215
],
[
217
],
[
219,
221,
223,
225
],
[
227,
229
],
[
231
],
[
233
],
[
235
],
[
237
],
[
239
],
[
241
],
[
243
],
[
245,
249
],
[
251
]
]
|
14,824 | e1000_autoneg_timer(void *opaque)
{
E1000State *s = opaque;
qemu_get_queue(s->nic)->link_down = false;
e1000_link_up(s);
s->phy_reg[PHY_STATUS] |= MII_SR_AUTONEG_COMPLETE;
DBGOUT(PHY, "Auto negotiation is completed\n");
}
| true | qemu | ddcb73b7782cb6104479503faea04cc224f982b5 | e1000_autoneg_timer(void *opaque)
{
E1000State *s = opaque;
qemu_get_queue(s->nic)->link_down = false;
e1000_link_up(s);
s->phy_reg[PHY_STATUS] |= MII_SR_AUTONEG_COMPLETE;
DBGOUT(PHY, "Auto negotiation is completed\n");
}
| {
"code": [
" qemu_get_queue(s->nic)->link_down = false;",
" e1000_link_up(s);"
],
"line_no": [
7,
9
]
} | FUNC_0(void *VAR_0)
{
E1000State *s = VAR_0;
qemu_get_queue(s->nic)->link_down = false;
e1000_link_up(s);
s->phy_reg[PHY_STATUS] |= MII_SR_AUTONEG_COMPLETE;
DBGOUT(PHY, "Auto negotiation is completed\n");
}
| [
"FUNC_0(void *VAR_0)\n{",
"E1000State *s = VAR_0;",
"qemu_get_queue(s->nic)->link_down = false;",
"e1000_link_up(s);",
"s->phy_reg[PHY_STATUS] |= MII_SR_AUTONEG_COMPLETE;",
"DBGOUT(PHY, \"Auto negotiation is completed\\n\");",
"}"
]
| [
0,
0,
1,
1,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
]
]
|
14,825 | blkdebug_co_pwritev(BlockDriverState *bs, uint64_t offset, uint64_t bytes,
QEMUIOVector *qiov, int flags)
{
BDRVBlkdebugState *s = bs->opaque;
BlkdebugRule *rule = NULL;
QSIMPLEQ_FOREACH(rule, &s->active_rules, active_next) {
uint64_t inject_offset = rule->options.inject.offset;
if (inject_offset == -1 ||
(inject_offset >= offset && inject_offset < offset + bytes))
{
break;
if (rule && rule->options.inject.error) {
return inject_error(bs, rule);
return bdrv_co_pwritev(bs->file, offset, bytes, qiov, flags); | true | qemu | e0ef439588ce1ede747f82b77d893190c1cc9f4d | blkdebug_co_pwritev(BlockDriverState *bs, uint64_t offset, uint64_t bytes,
QEMUIOVector *qiov, int flags)
{
BDRVBlkdebugState *s = bs->opaque;
BlkdebugRule *rule = NULL;
QSIMPLEQ_FOREACH(rule, &s->active_rules, active_next) {
uint64_t inject_offset = rule->options.inject.offset;
if (inject_offset == -1 ||
(inject_offset >= offset && inject_offset < offset + bytes))
{
break;
if (rule && rule->options.inject.error) {
return inject_error(bs, rule);
return bdrv_co_pwritev(bs->file, offset, bytes, qiov, flags); | {
"code": [],
"line_no": []
} | FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1, uint64_t VAR_2,
QEMUIOVector *VAR_3, int VAR_4)
{
BDRVBlkdebugState *s = VAR_0->opaque;
BlkdebugRule *rule = NULL;
QSIMPLEQ_FOREACH(rule, &s->active_rules, active_next) {
uint64_t inject_offset = rule->options.inject.VAR_1;
if (inject_offset == -1 ||
(inject_offset >= VAR_1 && inject_offset < VAR_1 + VAR_2))
{
break;
if (rule && rule->options.inject.error) {
return inject_error(VAR_0, rule);
return bdrv_co_pwritev(VAR_0->file, VAR_1, VAR_2, VAR_3, VAR_4); | [
"FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1, uint64_t VAR_2,\nQEMUIOVector *VAR_3, int VAR_4)\n{",
"BDRVBlkdebugState *s = VAR_0->opaque;",
"BlkdebugRule *rule = NULL;",
"QSIMPLEQ_FOREACH(rule, &s->active_rules, active_next) {",
"uint64_t inject_offset = rule->options.inject.VAR_1;",
"if (inject_offset == -1 ||\n(inject_offset >= VAR_1 && inject_offset < VAR_1 + VAR_2))\n{",
"break;",
"if (rule && rule->options.inject.error) {",
"return inject_error(VAR_0, rule);",
"return bdrv_co_pwritev(VAR_0->file, VAR_1, VAR_2, VAR_3, VAR_4);"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
2,
3
],
[
4
],
[
5
],
[
6
],
[
7
],
[
8,
9,
10
],
[
11
],
[
12
],
[
13
],
[
14
]
]
|
14,826 | static void vc1_h_overlap_c(uint8_t* src, int stride)
{
int i;
int a, b, c, d;
int d1, d2;
int rnd = 1;
for(i = 0; i < 8; i++) {
a = src[-2];
b = src[-1];
c = src[0];
d = src[1];
d1 = (a - d + 3 + rnd) >> 3;
d2 = (a - d + b - c + 4 - rnd) >> 3;
src[-2] = a - d1;
src[-1] = b - d2;
src[0] = c + d2;
src[1] = d + d1;
src += stride;
rnd = !rnd;
}
}
| true | FFmpeg | 5a446bc88e49cc6400d0c646ca1eb540a727c9de | static void vc1_h_overlap_c(uint8_t* src, int stride)
{
int i;
int a, b, c, d;
int d1, d2;
int rnd = 1;
for(i = 0; i < 8; i++) {
a = src[-2];
b = src[-1];
c = src[0];
d = src[1];
d1 = (a - d + 3 + rnd) >> 3;
d2 = (a - d + b - c + 4 - rnd) >> 3;
src[-2] = a - d1;
src[-1] = b - d2;
src[0] = c + d2;
src[1] = d + d1;
src += stride;
rnd = !rnd;
}
}
| {
"code": [
" src[0] = c + d2;",
" src[-1] = b - d2;",
" src[0] = c + d2;"
],
"line_no": [
33,
31,
33
]
} | static void FUNC_0(uint8_t* VAR_0, int VAR_1)
{
int VAR_2;
int VAR_3, VAR_4, VAR_5, VAR_6;
int VAR_7, VAR_8;
int VAR_9 = 1;
for(VAR_2 = 0; VAR_2 < 8; VAR_2++) {
VAR_3 = VAR_0[-2];
VAR_4 = VAR_0[-1];
VAR_5 = VAR_0[0];
VAR_6 = VAR_0[1];
VAR_7 = (VAR_3 - VAR_6 + 3 + VAR_9) >> 3;
VAR_8 = (VAR_3 - VAR_6 + VAR_4 - VAR_5 + 4 - VAR_9) >> 3;
VAR_0[-2] = VAR_3 - VAR_7;
VAR_0[-1] = VAR_4 - VAR_8;
VAR_0[0] = VAR_5 + VAR_8;
VAR_0[1] = VAR_6 + VAR_7;
VAR_0 += VAR_1;
VAR_9 = !VAR_9;
}
}
| [
"static void FUNC_0(uint8_t* VAR_0, int VAR_1)\n{",
"int VAR_2;",
"int VAR_3, VAR_4, VAR_5, VAR_6;",
"int VAR_7, VAR_8;",
"int VAR_9 = 1;",
"for(VAR_2 = 0; VAR_2 < 8; VAR_2++) {",
"VAR_3 = VAR_0[-2];",
"VAR_4 = VAR_0[-1];",
"VAR_5 = VAR_0[0];",
"VAR_6 = VAR_0[1];",
"VAR_7 = (VAR_3 - VAR_6 + 3 + VAR_9) >> 3;",
"VAR_8 = (VAR_3 - VAR_6 + VAR_4 - VAR_5 + 4 - VAR_9) >> 3;",
"VAR_0[-2] = VAR_3 - VAR_7;",
"VAR_0[-1] = VAR_4 - VAR_8;",
"VAR_0[0] = VAR_5 + VAR_8;",
"VAR_0[1] = VAR_6 + VAR_7;",
"VAR_0 += VAR_1;",
"VAR_9 = !VAR_9;",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
]
]
|
14,827 | int ff_msmpeg4_decode_block(MpegEncContext * s, int16_t * block,
int n, int coded, const uint8_t *scan_table)
{
int level, i, last, run, run_diff;
int av_uninit(dc_pred_dir);
RLTable *rl;
RL_VLC_ELEM *rl_vlc;
int qmul, qadd;
if (s->mb_intra) {
qmul=1;
qadd=0;
/* DC coef */
level = msmpeg4_decode_dc(s, n, &dc_pred_dir);
if (level < 0){
av_log(s->avctx, AV_LOG_ERROR, "dc overflow- block: %d qscale: %d//\n", n, s->qscale);
if(s->inter_intra_pred) level=0;
else return -1;
}
if (n < 4) {
rl = &ff_rl_table[s->rl_table_index];
if(level > 256*s->y_dc_scale){
av_log(s->avctx, AV_LOG_ERROR, "dc overflow+ L qscale: %d//\n", s->qscale);
if(!s->inter_intra_pred) return -1;
}
} else {
rl = &ff_rl_table[3 + s->rl_chroma_table_index];
if(level > 256*s->c_dc_scale){
av_log(s->avctx, AV_LOG_ERROR, "dc overflow+ C qscale: %d//\n", s->qscale);
if(!s->inter_intra_pred) return -1;
}
}
block[0] = level;
run_diff = s->msmpeg4_version >= 4;
i = 0;
if (!coded) {
goto not_coded;
}
if (s->ac_pred) {
if (dc_pred_dir == 0)
scan_table = s->intra_v_scantable.permutated; /* left */
else
scan_table = s->intra_h_scantable.permutated; /* top */
} else {
scan_table = s->intra_scantable.permutated;
}
rl_vlc= rl->rl_vlc[0];
} else {
qmul = s->qscale << 1;
qadd = (s->qscale - 1) | 1;
i = -1;
rl = &ff_rl_table[3 + s->rl_table_index];
if(s->msmpeg4_version==2)
run_diff = 0;
else
run_diff = 1;
if (!coded) {
s->block_last_index[n] = i;
return 0;
}
if(!scan_table)
scan_table = s->inter_scantable.permutated;
rl_vlc= rl->rl_vlc[s->qscale];
}
{
OPEN_READER(re, &s->gb);
for(;;) {
UPDATE_CACHE(re, &s->gb);
GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 0);
if (level==0) {
int cache;
cache= GET_CACHE(re, &s->gb);
/* escape */
if (s->msmpeg4_version==1 || (cache&0x80000000)==0) {
if (s->msmpeg4_version==1 || (cache&0x40000000)==0) {
/* third escape */
if(s->msmpeg4_version!=1) LAST_SKIP_BITS(re, &s->gb, 2);
UPDATE_CACHE(re, &s->gb);
if(s->msmpeg4_version<=3){
last= SHOW_UBITS(re, &s->gb, 1); SKIP_CACHE(re, &s->gb, 1);
run= SHOW_UBITS(re, &s->gb, 6); SKIP_CACHE(re, &s->gb, 6);
level= SHOW_SBITS(re, &s->gb, 8);
SKIP_COUNTER(re, &s->gb, 1+6+8);
}else{
int sign;
last= SHOW_UBITS(re, &s->gb, 1); SKIP_BITS(re, &s->gb, 1);
if(!s->esc3_level_length){
int ll;
av_dlog(s->avctx, "ESC-3 %X at %d %d\n",
show_bits(&s->gb, 24), s->mb_x, s->mb_y);
if(s->qscale<8){
ll= SHOW_UBITS(re, &s->gb, 3); SKIP_BITS(re, &s->gb, 3);
if(ll==0){
ll= 8+SHOW_UBITS(re, &s->gb, 1); SKIP_BITS(re, &s->gb, 1);
}
}else{
ll=2;
while(ll<8 && SHOW_UBITS(re, &s->gb, 1)==0){
ll++;
SKIP_BITS(re, &s->gb, 1);
}
if(ll<8) SKIP_BITS(re, &s->gb, 1);
}
s->esc3_level_length= ll;
s->esc3_run_length= SHOW_UBITS(re, &s->gb, 2) + 3; SKIP_BITS(re, &s->gb, 2);
UPDATE_CACHE(re, &s->gb);
}
run= SHOW_UBITS(re, &s->gb, s->esc3_run_length);
SKIP_BITS(re, &s->gb, s->esc3_run_length);
sign= SHOW_UBITS(re, &s->gb, 1);
SKIP_BITS(re, &s->gb, 1);
level= SHOW_UBITS(re, &s->gb, s->esc3_level_length);
SKIP_BITS(re, &s->gb, s->esc3_level_length);
if(sign) level= -level;
}
#if 0 // waste of time / this will detect very few errors
{
const int abs_level= FFABS(level);
const int run1= run - rl->max_run[last][abs_level] - run_diff;
if(abs_level<=MAX_LEVEL && run<=MAX_RUN){
if(abs_level <= rl->max_level[last][run]){
av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, vlc encoding possible\n");
return DECODING_AC_LOST;
}
if(abs_level <= rl->max_level[last][run]*2){
av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 1 encoding possible\n");
return DECODING_AC_LOST;
}
if(run1>=0 && abs_level <= rl->max_level[last][run1]){
av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 2 encoding possible\n");
return DECODING_AC_LOST;
}
}
}
#endif
//level = level * qmul + (level>0) * qadd - (level<=0) * qadd ;
if (level>0) level= level * qmul + qadd;
else level= level * qmul - qadd;
#if 0 // waste of time too :(
if(level>2048 || level<-2048){
av_log(s->avctx, AV_LOG_ERROR, "|level| overflow in 3. esc\n");
return DECODING_AC_LOST;
}
#endif
i+= run + 1;
if(last) i+=192;
#ifdef ERROR_DETAILS
if(run==66)
av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code in ESC3 level=%d\n", level);
else if((i>62 && i<192) || i>192+63)
av_log(s->avctx, AV_LOG_ERROR, "run overflow in ESC3 i=%d run=%d level=%d\n", i, run, level);
#endif
} else {
/* second escape */
SKIP_BITS(re, &s->gb, 2);
GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1);
i+= run + rl->max_run[run>>7][level/qmul] + run_diff; //FIXME opt indexing
level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
LAST_SKIP_BITS(re, &s->gb, 1);
#ifdef ERROR_DETAILS
if(run==66)
av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code in ESC2 level=%d\n", level);
else if((i>62 && i<192) || i>192+63)
av_log(s->avctx, AV_LOG_ERROR, "run overflow in ESC2 i=%d run=%d level=%d\n", i, run, level);
#endif
}
} else {
/* first escape */
SKIP_BITS(re, &s->gb, 1);
GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1);
i+= run;
level = level + rl->max_level[run>>7][(run-1)&63] * qmul;//FIXME opt indexing
level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
LAST_SKIP_BITS(re, &s->gb, 1);
#ifdef ERROR_DETAILS
if(run==66)
av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code in ESC1 level=%d\n", level);
else if((i>62 && i<192) || i>192+63)
av_log(s->avctx, AV_LOG_ERROR, "run overflow in ESC1 i=%d run=%d level=%d\n", i, run, level);
#endif
}
} else {
i+= run;
level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
LAST_SKIP_BITS(re, &s->gb, 1);
#ifdef ERROR_DETAILS
if(run==66)
av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code level=%d\n", level);
else if((i>62 && i<192) || i>192+63)
av_log(s->avctx, AV_LOG_ERROR, "run overflow i=%d run=%d level=%d\n", i, run, level);
#endif
}
if (i > 62){
i-= 192;
if(i&(~63)){
const int left= get_bits_left(&s->gb);
if(((i+192 == 64 && level/qmul==-1) || !(s->err_recognition&(AV_EF_BITSTREAM|AV_EF_COMPLIANT))) && left>=0){
av_log(s->avctx, AV_LOG_ERROR, "ignoring overflow at %d %d\n", s->mb_x, s->mb_y);
i = 63;
break;
}else{
av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
}
block[scan_table[i]] = level;
break;
}
block[scan_table[i]] = level;
}
CLOSE_READER(re, &s->gb);
}
not_coded:
if (s->mb_intra) {
ff_mpeg4_pred_ac(s, block, n, dc_pred_dir);
if (s->ac_pred) {
i = 63; /* XXX: not optimal */
}
}
if(s->msmpeg4_version>=4 && i>0) i=63; //FIXME/XXX optimize
s->block_last_index[n] = i;
return 0;
}
| true | FFmpeg | b4eb06d32535958d71568503cf886f448a5164ed | int ff_msmpeg4_decode_block(MpegEncContext * s, int16_t * block,
int n, int coded, const uint8_t *scan_table)
{
int level, i, last, run, run_diff;
int av_uninit(dc_pred_dir);
RLTable *rl;
RL_VLC_ELEM *rl_vlc;
int qmul, qadd;
if (s->mb_intra) {
qmul=1;
qadd=0;
level = msmpeg4_decode_dc(s, n, &dc_pred_dir);
if (level < 0){
av_log(s->avctx, AV_LOG_ERROR, "dc overflow- block: %d qscale: %d
if(s->inter_intra_pred) level=0;
else return -1;
}
if (n < 4) {
rl = &ff_rl_table[s->rl_table_index];
if(level > 256*s->y_dc_scale){
av_log(s->avctx, AV_LOG_ERROR, "dc overflow+ L qscale: %d
if(!s->inter_intra_pred) return -1;
}
} else {
rl = &ff_rl_table[3 + s->rl_chroma_table_index];
if(level > 256*s->c_dc_scale){
av_log(s->avctx, AV_LOG_ERROR, "dc overflow+ C qscale: %d
if(!s->inter_intra_pred) return -1;
}
}
block[0] = level;
run_diff = s->msmpeg4_version >= 4;
i = 0;
if (!coded) {
goto not_coded;
}
if (s->ac_pred) {
if (dc_pred_dir == 0)
scan_table = s->intra_v_scantable.permutated;
else
scan_table = s->intra_h_scantable.permutated;
} else {
scan_table = s->intra_scantable.permutated;
}
rl_vlc= rl->rl_vlc[0];
} else {
qmul = s->qscale << 1;
qadd = (s->qscale - 1) | 1;
i = -1;
rl = &ff_rl_table[3 + s->rl_table_index];
if(s->msmpeg4_version==2)
run_diff = 0;
else
run_diff = 1;
if (!coded) {
s->block_last_index[n] = i;
return 0;
}
if(!scan_table)
scan_table = s->inter_scantable.permutated;
rl_vlc= rl->rl_vlc[s->qscale];
}
{
OPEN_READER(re, &s->gb);
for(;;) {
UPDATE_CACHE(re, &s->gb);
GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 0);
if (level==0) {
int cache;
cache= GET_CACHE(re, &s->gb);
if (s->msmpeg4_version==1 || (cache&0x80000000)==0) {
if (s->msmpeg4_version==1 || (cache&0x40000000)==0) {
if(s->msmpeg4_version!=1) LAST_SKIP_BITS(re, &s->gb, 2);
UPDATE_CACHE(re, &s->gb);
if(s->msmpeg4_version<=3){
last= SHOW_UBITS(re, &s->gb, 1); SKIP_CACHE(re, &s->gb, 1);
run= SHOW_UBITS(re, &s->gb, 6); SKIP_CACHE(re, &s->gb, 6);
level= SHOW_SBITS(re, &s->gb, 8);
SKIP_COUNTER(re, &s->gb, 1+6+8);
}else{
int sign;
last= SHOW_UBITS(re, &s->gb, 1); SKIP_BITS(re, &s->gb, 1);
if(!s->esc3_level_length){
int ll;
av_dlog(s->avctx, "ESC-3 %X at %d %d\n",
show_bits(&s->gb, 24), s->mb_x, s->mb_y);
if(s->qscale<8){
ll= SHOW_UBITS(re, &s->gb, 3); SKIP_BITS(re, &s->gb, 3);
if(ll==0){
ll= 8+SHOW_UBITS(re, &s->gb, 1); SKIP_BITS(re, &s->gb, 1);
}
}else{
ll=2;
while(ll<8 && SHOW_UBITS(re, &s->gb, 1)==0){
ll++;
SKIP_BITS(re, &s->gb, 1);
}
if(ll<8) SKIP_BITS(re, &s->gb, 1);
}
s->esc3_level_length= ll;
s->esc3_run_length= SHOW_UBITS(re, &s->gb, 2) + 3; SKIP_BITS(re, &s->gb, 2);
UPDATE_CACHE(re, &s->gb);
}
run= SHOW_UBITS(re, &s->gb, s->esc3_run_length);
SKIP_BITS(re, &s->gb, s->esc3_run_length);
sign= SHOW_UBITS(re, &s->gb, 1);
SKIP_BITS(re, &s->gb, 1);
level= SHOW_UBITS(re, &s->gb, s->esc3_level_length);
SKIP_BITS(re, &s->gb, s->esc3_level_length);
if(sign) level= -level;
}
#if 0
{
const int abs_level= FFABS(level);
const int run1= run - rl->max_run[last][abs_level] - run_diff;
if(abs_level<=MAX_LEVEL && run<=MAX_RUN){
if(abs_level <= rl->max_level[last][run]){
av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, vlc encoding possible\n");
return DECODING_AC_LOST;
}
if(abs_level <= rl->max_level[last][run]*2){
av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 1 encoding possible\n");
return DECODING_AC_LOST;
}
if(run1>=0 && abs_level <= rl->max_level[last][run1]){
av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 2 encoding possible\n");
return DECODING_AC_LOST;
}
}
}
#endif
if (level>0) level= level * qmul + qadd;
else level= level * qmul - qadd;
#if 0
if(level>2048 || level<-2048){
av_log(s->avctx, AV_LOG_ERROR, "|level| overflow in 3. esc\n");
return DECODING_AC_LOST;
}
#endif
i+= run + 1;
if(last) i+=192;
#ifdef ERROR_DETAILS
if(run==66)
av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code in ESC3 level=%d\n", level);
else if((i>62 && i<192) || i>192+63)
av_log(s->avctx, AV_LOG_ERROR, "run overflow in ESC3 i=%d run=%d level=%d\n", i, run, level);
#endif
} else {
SKIP_BITS(re, &s->gb, 2);
GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1);
i+= run + rl->max_run[run>>7][level/qmul] + run_diff;
level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
LAST_SKIP_BITS(re, &s->gb, 1);
#ifdef ERROR_DETAILS
if(run==66)
av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code in ESC2 level=%d\n", level);
else if((i>62 && i<192) || i>192+63)
av_log(s->avctx, AV_LOG_ERROR, "run overflow in ESC2 i=%d run=%d level=%d\n", i, run, level);
#endif
}
} else {
SKIP_BITS(re, &s->gb, 1);
GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1);
i+= run;
level = level + rl->max_level[run>>7][(run-1)&63] * qmul;
level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
LAST_SKIP_BITS(re, &s->gb, 1);
#ifdef ERROR_DETAILS
if(run==66)
av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code in ESC1 level=%d\n", level);
else if((i>62 && i<192) || i>192+63)
av_log(s->avctx, AV_LOG_ERROR, "run overflow in ESC1 i=%d run=%d level=%d\n", i, run, level);
#endif
}
} else {
i+= run;
level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
LAST_SKIP_BITS(re, &s->gb, 1);
#ifdef ERROR_DETAILS
if(run==66)
av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code level=%d\n", level);
else if((i>62 && i<192) || i>192+63)
av_log(s->avctx, AV_LOG_ERROR, "run overflow i=%d run=%d level=%d\n", i, run, level);
#endif
}
if (i > 62){
i-= 192;
if(i&(~63)){
const int left= get_bits_left(&s->gb);
if(((i+192 == 64 && level/qmul==-1) || !(s->err_recognition&(AV_EF_BITSTREAM|AV_EF_COMPLIANT))) && left>=0){
av_log(s->avctx, AV_LOG_ERROR, "ignoring overflow at %d %d\n", s->mb_x, s->mb_y);
i = 63;
break;
}else{
av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
}
block[scan_table[i]] = level;
break;
}
block[scan_table[i]] = level;
}
CLOSE_READER(re, &s->gb);
}
not_coded:
if (s->mb_intra) {
ff_mpeg4_pred_ac(s, block, n, dc_pred_dir);
if (s->ac_pred) {
i = 63;
}
}
if(s->msmpeg4_version>=4 && i>0) i=63;
s->block_last_index[n] = i;
return 0;
}
| {
"code": [
" else return -1;"
],
"line_no": [
39
]
} | int FUNC_0(MpegEncContext * VAR_0, int16_t * VAR_1,
int VAR_2, int VAR_3, const uint8_t *VAR_4)
{
int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;
int FUNC_1(dc_pred_dir);
RLTable *rl;
RL_VLC_ELEM *rl_vlc;
int VAR_10, VAR_11;
if (VAR_0->mb_intra) {
VAR_10=1;
VAR_11=0;
VAR_5 = msmpeg4_decode_dc(VAR_0, VAR_2, &dc_pred_dir);
if (VAR_5 < 0){
av_log(VAR_0->avctx, AV_LOG_ERROR, "dc overflow- VAR_1: %d qscale: %d
if(VAR_0->inter_intra_pred) VAR_5=0;
else return -1;
}
if (VAR_2 < 4) {
rl = &ff_rl_table[VAR_0->rl_table_index];
if(VAR_5 > 256*VAR_0->y_dc_scale){
av_log(VAR_0->avctx, AV_LOG_ERROR, "dc overflow+ L qscale: %d
if(!VAR_0->inter_intra_pred) return -1;
}
} else {
rl = &ff_rl_table[3 + VAR_0->rl_chroma_table_index];
if(VAR_5 > 256*VAR_0->c_dc_scale){
av_log(VAR_0->avctx, AV_LOG_ERROR, "dc overflow+ C qscale: %d
if(!VAR_0->inter_intra_pred) return -1;
}
}
VAR_1[0] = VAR_5;
VAR_9 = VAR_0->msmpeg4_version >= 4;
VAR_6 = 0;
if (!VAR_3) {
goto not_coded;
}
if (VAR_0->ac_pred) {
if (dc_pred_dir == 0)
VAR_4 = VAR_0->intra_v_scantable.permutated;
else
VAR_4 = VAR_0->intra_h_scantable.permutated;
} else {
VAR_4 = VAR_0->intra_scantable.permutated;
}
rl_vlc= rl->rl_vlc[0];
} else {
VAR_10 = VAR_0->qscale << 1;
VAR_11 = (VAR_0->qscale - 1) | 1;
VAR_6 = -1;
rl = &ff_rl_table[3 + VAR_0->rl_table_index];
if(VAR_0->msmpeg4_version==2)
VAR_9 = 0;
else
VAR_9 = 1;
if (!VAR_3) {
VAR_0->block_last_index[VAR_2] = VAR_6;
return 0;
}
if(!VAR_4)
VAR_4 = VAR_0->inter_scantable.permutated;
rl_vlc= rl->rl_vlc[VAR_0->qscale];
}
{
OPEN_READER(re, &VAR_0->gb);
for(;;) {
UPDATE_CACHE(re, &VAR_0->gb);
GET_RL_VLC(VAR_5, VAR_8, re, &VAR_0->gb, rl_vlc, TEX_VLC_BITS, 2, 0);
if (VAR_5==0) {
int VAR_12;
VAR_12= GET_CACHE(re, &VAR_0->gb);
if (VAR_0->msmpeg4_version==1 || (VAR_12&0x80000000)==0) {
if (VAR_0->msmpeg4_version==1 || (VAR_12&0x40000000)==0) {
if(VAR_0->msmpeg4_version!=1) LAST_SKIP_BITS(re, &VAR_0->gb, 2);
UPDATE_CACHE(re, &VAR_0->gb);
if(VAR_0->msmpeg4_version<=3){
VAR_7= SHOW_UBITS(re, &VAR_0->gb, 1); SKIP_CACHE(re, &VAR_0->gb, 1);
VAR_8= SHOW_UBITS(re, &VAR_0->gb, 6); SKIP_CACHE(re, &VAR_0->gb, 6);
VAR_5= SHOW_SBITS(re, &VAR_0->gb, 8);
SKIP_COUNTER(re, &VAR_0->gb, 1+6+8);
}else{
int VAR_13;
VAR_7= SHOW_UBITS(re, &VAR_0->gb, 1); SKIP_BITS(re, &VAR_0->gb, 1);
if(!VAR_0->esc3_level_length){
int VAR_14;
av_dlog(VAR_0->avctx, "ESC-3 %X at %d %d\VAR_2",
show_bits(&VAR_0->gb, 24), VAR_0->mb_x, VAR_0->mb_y);
if(VAR_0->qscale<8){
VAR_14= SHOW_UBITS(re, &VAR_0->gb, 3); SKIP_BITS(re, &VAR_0->gb, 3);
if(VAR_14==0){
VAR_14= 8+SHOW_UBITS(re, &VAR_0->gb, 1); SKIP_BITS(re, &VAR_0->gb, 1);
}
}else{
VAR_14=2;
while(VAR_14<8 && SHOW_UBITS(re, &VAR_0->gb, 1)==0){
VAR_14++;
SKIP_BITS(re, &VAR_0->gb, 1);
}
if(VAR_14<8) SKIP_BITS(re, &VAR_0->gb, 1);
}
VAR_0->esc3_level_length= VAR_14;
VAR_0->esc3_run_length= SHOW_UBITS(re, &VAR_0->gb, 2) + 3; SKIP_BITS(re, &VAR_0->gb, 2);
UPDATE_CACHE(re, &VAR_0->gb);
}
VAR_8= SHOW_UBITS(re, &VAR_0->gb, VAR_0->esc3_run_length);
SKIP_BITS(re, &VAR_0->gb, VAR_0->esc3_run_length);
VAR_13= SHOW_UBITS(re, &VAR_0->gb, 1);
SKIP_BITS(re, &VAR_0->gb, 1);
VAR_5= SHOW_UBITS(re, &VAR_0->gb, VAR_0->esc3_level_length);
SKIP_BITS(re, &VAR_0->gb, VAR_0->esc3_level_length);
if(VAR_13) VAR_5= -VAR_5;
}
#if 0
{
const int abs_level= FFABS(VAR_5);
const int run1= VAR_8 - rl->max_run[VAR_7][abs_level] - VAR_9;
if(abs_level<=MAX_LEVEL && VAR_8<=MAX_RUN){
if(abs_level <= rl->max_level[VAR_7][VAR_8]){
av_log(VAR_0->avctx, AV_LOG_ERROR, "illegal 3. esc, vlc encoding possible\VAR_2");
return DECODING_AC_LOST;
}
if(abs_level <= rl->max_level[VAR_7][VAR_8]*2){
av_log(VAR_0->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 1 encoding possible\VAR_2");
return DECODING_AC_LOST;
}
if(run1>=0 && abs_level <= rl->max_level[VAR_7][run1]){
av_log(VAR_0->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 2 encoding possible\VAR_2");
return DECODING_AC_LOST;
}
}
}
#endif
if (VAR_5>0) VAR_5= VAR_5 * VAR_10 + VAR_11;
else VAR_5= VAR_5 * VAR_10 - VAR_11;
#if 0
if(VAR_5>2048 || VAR_5<-2048){
av_log(VAR_0->avctx, AV_LOG_ERROR, "|VAR_5| overflow in 3. esc\VAR_2");
return DECODING_AC_LOST;
}
#endif
VAR_6+= VAR_8 + 1;
if(VAR_7) VAR_6+=192;
#ifdef ERROR_DETAILS
if(VAR_8==66)
av_log(VAR_0->avctx, AV_LOG_ERROR, "illegal vlc code in ESC3 VAR_5=%d\VAR_2", VAR_5);
else if((VAR_6>62 && VAR_6<192) || VAR_6>192+63)
av_log(VAR_0->avctx, AV_LOG_ERROR, "VAR_8 overflow in ESC3 VAR_6=%d VAR_8=%d VAR_5=%d\VAR_2", VAR_6, VAR_8, VAR_5);
#endif
} else {
SKIP_BITS(re, &VAR_0->gb, 2);
GET_RL_VLC(VAR_5, VAR_8, re, &VAR_0->gb, rl_vlc, TEX_VLC_BITS, 2, 1);
VAR_6+= VAR_8 + rl->max_run[VAR_8>>7][VAR_5/VAR_10] + VAR_9;
VAR_5 = (VAR_5 ^ SHOW_SBITS(re, &VAR_0->gb, 1)) - SHOW_SBITS(re, &VAR_0->gb, 1);
LAST_SKIP_BITS(re, &VAR_0->gb, 1);
#ifdef ERROR_DETAILS
if(VAR_8==66)
av_log(VAR_0->avctx, AV_LOG_ERROR, "illegal vlc code in ESC2 VAR_5=%d\VAR_2", VAR_5);
else if((VAR_6>62 && VAR_6<192) || VAR_6>192+63)
av_log(VAR_0->avctx, AV_LOG_ERROR, "VAR_8 overflow in ESC2 VAR_6=%d VAR_8=%d VAR_5=%d\VAR_2", VAR_6, VAR_8, VAR_5);
#endif
}
} else {
SKIP_BITS(re, &VAR_0->gb, 1);
GET_RL_VLC(VAR_5, VAR_8, re, &VAR_0->gb, rl_vlc, TEX_VLC_BITS, 2, 1);
VAR_6+= VAR_8;
VAR_5 = VAR_5 + rl->max_level[VAR_8>>7][(VAR_8-1)&63] * VAR_10;
VAR_5 = (VAR_5 ^ SHOW_SBITS(re, &VAR_0->gb, 1)) - SHOW_SBITS(re, &VAR_0->gb, 1);
LAST_SKIP_BITS(re, &VAR_0->gb, 1);
#ifdef ERROR_DETAILS
if(VAR_8==66)
av_log(VAR_0->avctx, AV_LOG_ERROR, "illegal vlc code in ESC1 VAR_5=%d\VAR_2", VAR_5);
else if((VAR_6>62 && VAR_6<192) || VAR_6>192+63)
av_log(VAR_0->avctx, AV_LOG_ERROR, "VAR_8 overflow in ESC1 VAR_6=%d VAR_8=%d VAR_5=%d\VAR_2", VAR_6, VAR_8, VAR_5);
#endif
}
} else {
VAR_6+= VAR_8;
VAR_5 = (VAR_5 ^ SHOW_SBITS(re, &VAR_0->gb, 1)) - SHOW_SBITS(re, &VAR_0->gb, 1);
LAST_SKIP_BITS(re, &VAR_0->gb, 1);
#ifdef ERROR_DETAILS
if(VAR_8==66)
av_log(VAR_0->avctx, AV_LOG_ERROR, "illegal vlc code VAR_5=%d\VAR_2", VAR_5);
else if((VAR_6>62 && VAR_6<192) || VAR_6>192+63)
av_log(VAR_0->avctx, AV_LOG_ERROR, "VAR_8 overflow VAR_6=%d VAR_8=%d VAR_5=%d\VAR_2", VAR_6, VAR_8, VAR_5);
#endif
}
if (VAR_6 > 62){
VAR_6-= 192;
if(VAR_6&(~63)){
const int VAR_15= get_bits_left(&VAR_0->gb);
if(((VAR_6+192 == 64 && VAR_5/VAR_10==-1) || !(VAR_0->err_recognition&(AV_EF_BITSTREAM|AV_EF_COMPLIANT))) && VAR_15>=0){
av_log(VAR_0->avctx, AV_LOG_ERROR, "ignoring overflow at %d %d\VAR_2", VAR_0->mb_x, VAR_0->mb_y);
VAR_6 = 63;
break;
}else{
av_log(VAR_0->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\VAR_2", VAR_0->mb_x, VAR_0->mb_y);
return -1;
}
}
VAR_1[VAR_4[VAR_6]] = VAR_5;
break;
}
VAR_1[VAR_4[VAR_6]] = VAR_5;
}
CLOSE_READER(re, &VAR_0->gb);
}
not_coded:
if (VAR_0->mb_intra) {
ff_mpeg4_pred_ac(VAR_0, VAR_1, VAR_2, dc_pred_dir);
if (VAR_0->ac_pred) {
VAR_6 = 63;
}
}
if(VAR_0->msmpeg4_version>=4 && VAR_6>0) VAR_6=63;
VAR_0->block_last_index[VAR_2] = VAR_6;
return 0;
}
| [
"int FUNC_0(MpegEncContext * VAR_0, int16_t * VAR_1,\nint VAR_2, int VAR_3, const uint8_t *VAR_4)\n{",
"int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;",
"int FUNC_1(dc_pred_dir);",
"RLTable *rl;",
"RL_VLC_ELEM *rl_vlc;",
"int VAR_10, VAR_11;",
"if (VAR_0->mb_intra) {",
"VAR_10=1;",
"VAR_11=0;",
"VAR_5 = msmpeg4_decode_dc(VAR_0, VAR_2, &dc_pred_dir);",
"if (VAR_5 < 0){",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"dc overflow- VAR_1: %d qscale: %d\nif(VAR_0->inter_intra_pred) VAR_5=0;",
"else return -1;",
"}",
"if (VAR_2 < 4) {",
"rl = &ff_rl_table[VAR_0->rl_table_index];",
"if(VAR_5 > 256*VAR_0->y_dc_scale){",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"dc overflow+ L qscale: %d\nif(!VAR_0->inter_intra_pred) return -1;",
"}",
"} else {",
"rl = &ff_rl_table[3 + VAR_0->rl_chroma_table_index];",
"if(VAR_5 > 256*VAR_0->c_dc_scale){",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"dc overflow+ C qscale: %d\nif(!VAR_0->inter_intra_pred) return -1;",
"}",
"}",
"VAR_1[0] = VAR_5;",
"VAR_9 = VAR_0->msmpeg4_version >= 4;",
"VAR_6 = 0;",
"if (!VAR_3) {",
"goto not_coded;",
"}",
"if (VAR_0->ac_pred) {",
"if (dc_pred_dir == 0)\nVAR_4 = VAR_0->intra_v_scantable.permutated;",
"else\nVAR_4 = VAR_0->intra_h_scantable.permutated;",
"} else {",
"VAR_4 = VAR_0->intra_scantable.permutated;",
"}",
"rl_vlc= rl->rl_vlc[0];",
"} else {",
"VAR_10 = VAR_0->qscale << 1;",
"VAR_11 = (VAR_0->qscale - 1) | 1;",
"VAR_6 = -1;",
"rl = &ff_rl_table[3 + VAR_0->rl_table_index];",
"if(VAR_0->msmpeg4_version==2)\nVAR_9 = 0;",
"else\nVAR_9 = 1;",
"if (!VAR_3) {",
"VAR_0->block_last_index[VAR_2] = VAR_6;",
"return 0;",
"}",
"if(!VAR_4)\nVAR_4 = VAR_0->inter_scantable.permutated;",
"rl_vlc= rl->rl_vlc[VAR_0->qscale];",
"}",
"{",
"OPEN_READER(re, &VAR_0->gb);",
"for(;;) {",
"UPDATE_CACHE(re, &VAR_0->gb);",
"GET_RL_VLC(VAR_5, VAR_8, re, &VAR_0->gb, rl_vlc, TEX_VLC_BITS, 2, 0);",
"if (VAR_5==0) {",
"int VAR_12;",
"VAR_12= GET_CACHE(re, &VAR_0->gb);",
"if (VAR_0->msmpeg4_version==1 || (VAR_12&0x80000000)==0) {",
"if (VAR_0->msmpeg4_version==1 || (VAR_12&0x40000000)==0) {",
"if(VAR_0->msmpeg4_version!=1) LAST_SKIP_BITS(re, &VAR_0->gb, 2);",
"UPDATE_CACHE(re, &VAR_0->gb);",
"if(VAR_0->msmpeg4_version<=3){",
"VAR_7= SHOW_UBITS(re, &VAR_0->gb, 1); SKIP_CACHE(re, &VAR_0->gb, 1);",
"VAR_8= SHOW_UBITS(re, &VAR_0->gb, 6); SKIP_CACHE(re, &VAR_0->gb, 6);",
"VAR_5= SHOW_SBITS(re, &VAR_0->gb, 8);",
"SKIP_COUNTER(re, &VAR_0->gb, 1+6+8);",
"}else{",
"int VAR_13;",
"VAR_7= SHOW_UBITS(re, &VAR_0->gb, 1); SKIP_BITS(re, &VAR_0->gb, 1);",
"if(!VAR_0->esc3_level_length){",
"int VAR_14;",
"av_dlog(VAR_0->avctx, \"ESC-3 %X at %d %d\\VAR_2\",\nshow_bits(&VAR_0->gb, 24), VAR_0->mb_x, VAR_0->mb_y);",
"if(VAR_0->qscale<8){",
"VAR_14= SHOW_UBITS(re, &VAR_0->gb, 3); SKIP_BITS(re, &VAR_0->gb, 3);",
"if(VAR_14==0){",
"VAR_14= 8+SHOW_UBITS(re, &VAR_0->gb, 1); SKIP_BITS(re, &VAR_0->gb, 1);",
"}",
"}else{",
"VAR_14=2;",
"while(VAR_14<8 && SHOW_UBITS(re, &VAR_0->gb, 1)==0){",
"VAR_14++;",
"SKIP_BITS(re, &VAR_0->gb, 1);",
"}",
"if(VAR_14<8) SKIP_BITS(re, &VAR_0->gb, 1);",
"}",
"VAR_0->esc3_level_length= VAR_14;",
"VAR_0->esc3_run_length= SHOW_UBITS(re, &VAR_0->gb, 2) + 3; SKIP_BITS(re, &VAR_0->gb, 2);",
"UPDATE_CACHE(re, &VAR_0->gb);",
"}",
"VAR_8= SHOW_UBITS(re, &VAR_0->gb, VAR_0->esc3_run_length);",
"SKIP_BITS(re, &VAR_0->gb, VAR_0->esc3_run_length);",
"VAR_13= SHOW_UBITS(re, &VAR_0->gb, 1);",
"SKIP_BITS(re, &VAR_0->gb, 1);",
"VAR_5= SHOW_UBITS(re, &VAR_0->gb, VAR_0->esc3_level_length);",
"SKIP_BITS(re, &VAR_0->gb, VAR_0->esc3_level_length);",
"if(VAR_13) VAR_5= -VAR_5;",
"}",
"#if 0\n{",
"const int abs_level= FFABS(VAR_5);",
"const int run1= VAR_8 - rl->max_run[VAR_7][abs_level] - VAR_9;",
"if(abs_level<=MAX_LEVEL && VAR_8<=MAX_RUN){",
"if(abs_level <= rl->max_level[VAR_7][VAR_8]){",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"illegal 3. esc, vlc encoding possible\\VAR_2\");",
"return DECODING_AC_LOST;",
"}",
"if(abs_level <= rl->max_level[VAR_7][VAR_8]*2){",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"illegal 3. esc, esc 1 encoding possible\\VAR_2\");",
"return DECODING_AC_LOST;",
"}",
"if(run1>=0 && abs_level <= rl->max_level[VAR_7][run1]){",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"illegal 3. esc, esc 2 encoding possible\\VAR_2\");",
"return DECODING_AC_LOST;",
"}",
"}",
"}",
"#endif\nif (VAR_5>0) VAR_5= VAR_5 * VAR_10 + VAR_11;",
"else VAR_5= VAR_5 * VAR_10 - VAR_11;",
"#if 0\nif(VAR_5>2048 || VAR_5<-2048){",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"|VAR_5| overflow in 3. esc\\VAR_2\");",
"return DECODING_AC_LOST;",
"}",
"#endif\nVAR_6+= VAR_8 + 1;",
"if(VAR_7) VAR_6+=192;",
"#ifdef ERROR_DETAILS\nif(VAR_8==66)\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"illegal vlc code in ESC3 VAR_5=%d\\VAR_2\", VAR_5);",
"else if((VAR_6>62 && VAR_6<192) || VAR_6>192+63)\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"VAR_8 overflow in ESC3 VAR_6=%d VAR_8=%d VAR_5=%d\\VAR_2\", VAR_6, VAR_8, VAR_5);",
"#endif\n} else {",
"SKIP_BITS(re, &VAR_0->gb, 2);",
"GET_RL_VLC(VAR_5, VAR_8, re, &VAR_0->gb, rl_vlc, TEX_VLC_BITS, 2, 1);",
"VAR_6+= VAR_8 + rl->max_run[VAR_8>>7][VAR_5/VAR_10] + VAR_9;",
"VAR_5 = (VAR_5 ^ SHOW_SBITS(re, &VAR_0->gb, 1)) - SHOW_SBITS(re, &VAR_0->gb, 1);",
"LAST_SKIP_BITS(re, &VAR_0->gb, 1);",
"#ifdef ERROR_DETAILS\nif(VAR_8==66)\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"illegal vlc code in ESC2 VAR_5=%d\\VAR_2\", VAR_5);",
"else if((VAR_6>62 && VAR_6<192) || VAR_6>192+63)\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"VAR_8 overflow in ESC2 VAR_6=%d VAR_8=%d VAR_5=%d\\VAR_2\", VAR_6, VAR_8, VAR_5);",
"#endif\n}",
"} else {",
"SKIP_BITS(re, &VAR_0->gb, 1);",
"GET_RL_VLC(VAR_5, VAR_8, re, &VAR_0->gb, rl_vlc, TEX_VLC_BITS, 2, 1);",
"VAR_6+= VAR_8;",
"VAR_5 = VAR_5 + rl->max_level[VAR_8>>7][(VAR_8-1)&63] * VAR_10;",
"VAR_5 = (VAR_5 ^ SHOW_SBITS(re, &VAR_0->gb, 1)) - SHOW_SBITS(re, &VAR_0->gb, 1);",
"LAST_SKIP_BITS(re, &VAR_0->gb, 1);",
"#ifdef ERROR_DETAILS\nif(VAR_8==66)\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"illegal vlc code in ESC1 VAR_5=%d\\VAR_2\", VAR_5);",
"else if((VAR_6>62 && VAR_6<192) || VAR_6>192+63)\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"VAR_8 overflow in ESC1 VAR_6=%d VAR_8=%d VAR_5=%d\\VAR_2\", VAR_6, VAR_8, VAR_5);",
"#endif\n}",
"} else {",
"VAR_6+= VAR_8;",
"VAR_5 = (VAR_5 ^ SHOW_SBITS(re, &VAR_0->gb, 1)) - SHOW_SBITS(re, &VAR_0->gb, 1);",
"LAST_SKIP_BITS(re, &VAR_0->gb, 1);",
"#ifdef ERROR_DETAILS\nif(VAR_8==66)\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"illegal vlc code VAR_5=%d\\VAR_2\", VAR_5);",
"else if((VAR_6>62 && VAR_6<192) || VAR_6>192+63)\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"VAR_8 overflow VAR_6=%d VAR_8=%d VAR_5=%d\\VAR_2\", VAR_6, VAR_8, VAR_5);",
"#endif\n}",
"if (VAR_6 > 62){",
"VAR_6-= 192;",
"if(VAR_6&(~63)){",
"const int VAR_15= get_bits_left(&VAR_0->gb);",
"if(((VAR_6+192 == 64 && VAR_5/VAR_10==-1) || !(VAR_0->err_recognition&(AV_EF_BITSTREAM|AV_EF_COMPLIANT))) && VAR_15>=0){",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"ignoring overflow at %d %d\\VAR_2\", VAR_0->mb_x, VAR_0->mb_y);",
"VAR_6 = 63;",
"break;",
"}else{",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"ac-tex damaged at %d %d\\VAR_2\", VAR_0->mb_x, VAR_0->mb_y);",
"return -1;",
"}",
"}",
"VAR_1[VAR_4[VAR_6]] = VAR_5;",
"break;",
"}",
"VAR_1[VAR_4[VAR_6]] = VAR_5;",
"}",
"CLOSE_READER(re, &VAR_0->gb);",
"}",
"not_coded:\nif (VAR_0->mb_intra) {",
"ff_mpeg4_pred_ac(VAR_0, VAR_1, VAR_2, dc_pred_dir);",
"if (VAR_0->ac_pred) {",
"VAR_6 = 63;",
"}",
"}",
"if(VAR_0->msmpeg4_version>=4 && VAR_6>0) VAR_6=63;",
"VAR_0->block_last_index[VAR_2] = VAR_6;",
"return 0;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23
],
[
29
],
[
33
],
[
35,
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49,
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61,
63
],
[
65
],
[
67
],
[
69
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85,
87
],
[
89,
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
113,
115
],
[
117,
119
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131,
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149
],
[
151
],
[
153
],
[
157
],
[
159
],
[
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
],
[
219
],
[
221
],
[
223
],
[
225
],
[
227
],
[
229
],
[
233
],
[
235
],
[
239
],
[
241
],
[
243
],
[
245
],
[
249,
251
],
[
253
],
[
255
],
[
257
],
[
259
],
[
261
],
[
263
],
[
265
],
[
267
],
[
269
],
[
271
],
[
273
],
[
275
],
[
277
],
[
279
],
[
281
],
[
283
],
[
285
],
[
287,
291
],
[
293
],
[
295,
297
],
[
299
],
[
301
],
[
303
],
[
305,
307
],
[
309
],
[
311,
313,
315
],
[
317,
319
],
[
321,
323
],
[
327
],
[
329
],
[
331
],
[
333
],
[
335
],
[
337,
339,
341
],
[
343,
345
],
[
347,
349
],
[
351
],
[
355
],
[
357
],
[
359
],
[
361
],
[
363
],
[
365
],
[
367,
369,
371
],
[
373,
375
],
[
377,
379
],
[
381
],
[
383
],
[
385
],
[
387
],
[
389,
391,
393
],
[
395,
397
],
[
399,
401
],
[
403
],
[
405
],
[
407
],
[
409
],
[
411
],
[
413
],
[
415
],
[
417
],
[
419
],
[
421
],
[
423
],
[
425
],
[
427
],
[
431
],
[
433
],
[
435
],
[
439
],
[
441
],
[
443
],
[
445
],
[
447,
449
],
[
451
],
[
453
],
[
455
],
[
457
],
[
459
],
[
461
],
[
463
],
[
467
],
[
469
]
]
|
14,828 | static int svq1_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
SVQ1Context *s = avctx->priv_data;
AVFrame *cur = data;
uint8_t *current;
int result, i, x, y, width, height;
svq1_pmv *pmv;
/* initialize bit buffer */
init_get_bits(&s->gb, buf, buf_size * 8);
/* decode frame header */
s->frame_code = get_bits(&s->gb, 22);
if ((s->frame_code & ~0x70) || !(s->frame_code & 0x60))
return AVERROR_INVALIDDATA;
/* swap some header bytes (why?) */
if (s->frame_code != 0x20) {
uint32_t *src = (uint32_t *)(buf + 4);
for (i = 0; i < 4; i++)
src[i] = ((src[i] << 16) | (src[i] >> 16)) ^ src[7 - i];
}
result = svq1_decode_frame_header(avctx, cur);
if (result != 0) {
av_dlog(avctx, "Error in svq1_decode_frame_header %i\n", result);
return result;
}
result = ff_set_dimensions(avctx, s->width, s->height);
if (result < 0)
return result;
if ((avctx->skip_frame >= AVDISCARD_NONREF && s->nonref) ||
(avctx->skip_frame >= AVDISCARD_NONKEY &&
cur->pict_type != AV_PICTURE_TYPE_I) ||
avctx->skip_frame >= AVDISCARD_ALL)
return buf_size;
result = ff_get_buffer(avctx, cur, s->nonref ? 0 : AV_GET_BUFFER_FLAG_REF);
if (result < 0)
return result;
pmv = av_malloc((FFALIGN(s->width, 16) / 8 + 3) * sizeof(*pmv));
if (!pmv)
return AVERROR(ENOMEM);
/* decode y, u and v components */
for (i = 0; i < 3; i++) {
int linesize = cur->linesize[i];
if (i == 0) {
width = FFALIGN(s->width, 16);
height = FFALIGN(s->height, 16);
} else {
if (avctx->flags & CODEC_FLAG_GRAY)
break;
width = FFALIGN(s->width / 4, 16);
height = FFALIGN(s->height / 4, 16);
}
current = cur->data[i];
if (cur->pict_type == AV_PICTURE_TYPE_I) {
/* keyframe */
for (y = 0; y < height; y += 16) {
for (x = 0; x < width; x += 16) {
result = svq1_decode_block_intra(&s->gb, ¤t[x],
linesize);
if (result != 0) {
av_log(avctx, AV_LOG_INFO,
"Error in svq1_decode_block %i (keyframe)\n",
result);
goto err;
}
}
current += 16 * linesize;
}
} else {
/* delta frame */
uint8_t *previous = s->prev->data[i];
if (!previous ||
s->prev->width != s->width || s->prev->height != s->height) {
av_log(avctx, AV_LOG_ERROR, "Missing reference frame.\n");
result = AVERROR_INVALIDDATA;
goto err;
}
memset(pmv, 0, ((width / 8) + 3) * sizeof(svq1_pmv));
for (y = 0; y < height; y += 16) {
for (x = 0; x < width; x += 16) {
result = svq1_decode_delta_block(avctx, &s->hdsp,
&s->gb, ¤t[x],
previous, linesize,
pmv, x, y, width, height);
if (result != 0) {
av_dlog(avctx,
"Error in svq1_decode_delta_block %i\n",
result);
goto err;
}
}
pmv[0].x =
pmv[0].y = 0;
current += 16 * linesize;
}
}
}
if (!s->nonref) {
av_frame_unref(s->prev);
result = av_frame_ref(s->prev, cur);
if (result < 0)
goto err;
}
*got_frame = 1;
result = buf_size;
err:
av_free(pmv);
return result;
}
| true | FFmpeg | 7b588bb691644e1b3c168b99accf74248a24e3cf | static int svq1_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
SVQ1Context *s = avctx->priv_data;
AVFrame *cur = data;
uint8_t *current;
int result, i, x, y, width, height;
svq1_pmv *pmv;
init_get_bits(&s->gb, buf, buf_size * 8);
s->frame_code = get_bits(&s->gb, 22);
if ((s->frame_code & ~0x70) || !(s->frame_code & 0x60))
return AVERROR_INVALIDDATA;
if (s->frame_code != 0x20) {
uint32_t *src = (uint32_t *)(buf + 4);
for (i = 0; i < 4; i++)
src[i] = ((src[i] << 16) | (src[i] >> 16)) ^ src[7 - i];
}
result = svq1_decode_frame_header(avctx, cur);
if (result != 0) {
av_dlog(avctx, "Error in svq1_decode_frame_header %i\n", result);
return result;
}
result = ff_set_dimensions(avctx, s->width, s->height);
if (result < 0)
return result;
if ((avctx->skip_frame >= AVDISCARD_NONREF && s->nonref) ||
(avctx->skip_frame >= AVDISCARD_NONKEY &&
cur->pict_type != AV_PICTURE_TYPE_I) ||
avctx->skip_frame >= AVDISCARD_ALL)
return buf_size;
result = ff_get_buffer(avctx, cur, s->nonref ? 0 : AV_GET_BUFFER_FLAG_REF);
if (result < 0)
return result;
pmv = av_malloc((FFALIGN(s->width, 16) / 8 + 3) * sizeof(*pmv));
if (!pmv)
return AVERROR(ENOMEM);
for (i = 0; i < 3; i++) {
int linesize = cur->linesize[i];
if (i == 0) {
width = FFALIGN(s->width, 16);
height = FFALIGN(s->height, 16);
} else {
if (avctx->flags & CODEC_FLAG_GRAY)
break;
width = FFALIGN(s->width / 4, 16);
height = FFALIGN(s->height / 4, 16);
}
current = cur->data[i];
if (cur->pict_type == AV_PICTURE_TYPE_I) {
for (y = 0; y < height; y += 16) {
for (x = 0; x < width; x += 16) {
result = svq1_decode_block_intra(&s->gb, ¤t[x],
linesize);
if (result != 0) {
av_log(avctx, AV_LOG_INFO,
"Error in svq1_decode_block %i (keyframe)\n",
result);
goto err;
}
}
current += 16 * linesize;
}
} else {
uint8_t *previous = s->prev->data[i];
if (!previous ||
s->prev->width != s->width || s->prev->height != s->height) {
av_log(avctx, AV_LOG_ERROR, "Missing reference frame.\n");
result = AVERROR_INVALIDDATA;
goto err;
}
memset(pmv, 0, ((width / 8) + 3) * sizeof(svq1_pmv));
for (y = 0; y < height; y += 16) {
for (x = 0; x < width; x += 16) {
result = svq1_decode_delta_block(avctx, &s->hdsp,
&s->gb, ¤t[x],
previous, linesize,
pmv, x, y, width, height);
if (result != 0) {
av_dlog(avctx,
"Error in svq1_decode_delta_block %i\n",
result);
goto err;
}
}
pmv[0].x =
pmv[0].y = 0;
current += 16 * linesize;
}
}
}
if (!s->nonref) {
av_frame_unref(s->prev);
result = av_frame_ref(s->prev, cur);
if (result < 0)
goto err;
}
*got_frame = 1;
result = buf_size;
err:
av_free(pmv);
return result;
}
| {
"code": [
" uint32_t *src = (uint32_t *)(buf + 4);"
],
"line_no": [
45
]
} | 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;
SVQ1Context *s = VAR_0->priv_data;
AVFrame *cur = VAR_1;
uint8_t *current;
int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11;
svq1_pmv *pmv;
init_get_bits(&s->gb, VAR_4, VAR_5 * 8);
s->frame_code = get_bits(&s->gb, 22);
if ((s->frame_code & ~0x70) || !(s->frame_code & 0x60))
return AVERROR_INVALIDDATA;
if (s->frame_code != 0x20) {
uint32_t *src = (uint32_t *)(VAR_4 + 4);
for (VAR_7 = 0; VAR_7 < 4; VAR_7++)
src[VAR_7] = ((src[VAR_7] << 16) | (src[VAR_7] >> 16)) ^ src[7 - VAR_7];
}
VAR_6 = svq1_decode_frame_header(VAR_0, cur);
if (VAR_6 != 0) {
av_dlog(VAR_0, "Error in svq1_decode_frame_header %VAR_7\n", VAR_6);
return VAR_6;
}
VAR_6 = ff_set_dimensions(VAR_0, s->VAR_10, s->VAR_11);
if (VAR_6 < 0)
return VAR_6;
if ((VAR_0->skip_frame >= AVDISCARD_NONREF && s->nonref) ||
(VAR_0->skip_frame >= AVDISCARD_NONKEY &&
cur->pict_type != AV_PICTURE_TYPE_I) ||
VAR_0->skip_frame >= AVDISCARD_ALL)
return VAR_5;
VAR_6 = ff_get_buffer(VAR_0, cur, s->nonref ? 0 : AV_GET_BUFFER_FLAG_REF);
if (VAR_6 < 0)
return VAR_6;
pmv = av_malloc((FFALIGN(s->VAR_10, 16) / 8 + 3) * sizeof(*pmv));
if (!pmv)
return AVERROR(ENOMEM);
for (VAR_7 = 0; VAR_7 < 3; VAR_7++) {
int VAR_12 = cur->VAR_12[VAR_7];
if (VAR_7 == 0) {
VAR_10 = FFALIGN(s->VAR_10, 16);
VAR_11 = FFALIGN(s->VAR_11, 16);
} else {
if (VAR_0->flags & CODEC_FLAG_GRAY)
break;
VAR_10 = FFALIGN(s->VAR_10 / 4, 16);
VAR_11 = FFALIGN(s->VAR_11 / 4, 16);
}
current = cur->VAR_1[VAR_7];
if (cur->pict_type == AV_PICTURE_TYPE_I) {
for (VAR_9 = 0; VAR_9 < VAR_11; VAR_9 += 16) {
for (VAR_8 = 0; VAR_8 < VAR_10; VAR_8 += 16) {
VAR_6 = svq1_decode_block_intra(&s->gb, ¤t[VAR_8],
VAR_12);
if (VAR_6 != 0) {
av_log(VAR_0, AV_LOG_INFO,
"Error in svq1_decode_block %VAR_7 (keyframe)\n",
VAR_6);
goto err;
}
}
current += 16 * VAR_12;
}
} else {
uint8_t *previous = s->prev->VAR_1[VAR_7];
if (!previous ||
s->prev->VAR_10 != s->VAR_10 || s->prev->VAR_11 != s->VAR_11) {
av_log(VAR_0, AV_LOG_ERROR, "Missing reference frame.\n");
VAR_6 = AVERROR_INVALIDDATA;
goto err;
}
memset(pmv, 0, ((VAR_10 / 8) + 3) * sizeof(svq1_pmv));
for (VAR_9 = 0; VAR_9 < VAR_11; VAR_9 += 16) {
for (VAR_8 = 0; VAR_8 < VAR_10; VAR_8 += 16) {
VAR_6 = svq1_decode_delta_block(VAR_0, &s->hdsp,
&s->gb, ¤t[VAR_8],
previous, VAR_12,
pmv, VAR_8, VAR_9, VAR_10, VAR_11);
if (VAR_6 != 0) {
av_dlog(VAR_0,
"Error in svq1_decode_delta_block %VAR_7\n",
VAR_6);
goto err;
}
}
pmv[0].VAR_8 =
pmv[0].VAR_9 = 0;
current += 16 * VAR_12;
}
}
}
if (!s->nonref) {
av_frame_unref(s->prev);
VAR_6 = av_frame_ref(s->prev, cur);
if (VAR_6 < 0)
goto err;
}
*VAR_2 = 1;
VAR_6 = VAR_5;
err:
av_free(pmv);
return VAR_6;
}
| [
"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;",
"SVQ1Context *s = VAR_0->priv_data;",
"AVFrame *cur = VAR_1;",
"uint8_t *current;",
"int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11;",
"svq1_pmv *pmv;",
"init_get_bits(&s->gb, VAR_4, VAR_5 * 8);",
"s->frame_code = get_bits(&s->gb, 22);",
"if ((s->frame_code & ~0x70) || !(s->frame_code & 0x60))\nreturn AVERROR_INVALIDDATA;",
"if (s->frame_code != 0x20) {",
"uint32_t *src = (uint32_t *)(VAR_4 + 4);",
"for (VAR_7 = 0; VAR_7 < 4; VAR_7++)",
"src[VAR_7] = ((src[VAR_7] << 16) | (src[VAR_7] >> 16)) ^ src[7 - VAR_7];",
"}",
"VAR_6 = svq1_decode_frame_header(VAR_0, cur);",
"if (VAR_6 != 0) {",
"av_dlog(VAR_0, \"Error in svq1_decode_frame_header %VAR_7\\n\", VAR_6);",
"return VAR_6;",
"}",
"VAR_6 = ff_set_dimensions(VAR_0, s->VAR_10, s->VAR_11);",
"if (VAR_6 < 0)\nreturn VAR_6;",
"if ((VAR_0->skip_frame >= AVDISCARD_NONREF && s->nonref) ||\n(VAR_0->skip_frame >= AVDISCARD_NONKEY &&\ncur->pict_type != AV_PICTURE_TYPE_I) ||\nVAR_0->skip_frame >= AVDISCARD_ALL)\nreturn VAR_5;",
"VAR_6 = ff_get_buffer(VAR_0, cur, s->nonref ? 0 : AV_GET_BUFFER_FLAG_REF);",
"if (VAR_6 < 0)\nreturn VAR_6;",
"pmv = av_malloc((FFALIGN(s->VAR_10, 16) / 8 + 3) * sizeof(*pmv));",
"if (!pmv)\nreturn AVERROR(ENOMEM);",
"for (VAR_7 = 0; VAR_7 < 3; VAR_7++) {",
"int VAR_12 = cur->VAR_12[VAR_7];",
"if (VAR_7 == 0) {",
"VAR_10 = FFALIGN(s->VAR_10, 16);",
"VAR_11 = FFALIGN(s->VAR_11, 16);",
"} else {",
"if (VAR_0->flags & CODEC_FLAG_GRAY)\nbreak;",
"VAR_10 = FFALIGN(s->VAR_10 / 4, 16);",
"VAR_11 = FFALIGN(s->VAR_11 / 4, 16);",
"}",
"current = cur->VAR_1[VAR_7];",
"if (cur->pict_type == AV_PICTURE_TYPE_I) {",
"for (VAR_9 = 0; VAR_9 < VAR_11; VAR_9 += 16) {",
"for (VAR_8 = 0; VAR_8 < VAR_10; VAR_8 += 16) {",
"VAR_6 = svq1_decode_block_intra(&s->gb, ¤t[VAR_8],\nVAR_12);",
"if (VAR_6 != 0) {",
"av_log(VAR_0, AV_LOG_INFO,\n\"Error in svq1_decode_block %VAR_7 (keyframe)\\n\",\nVAR_6);",
"goto err;",
"}",
"}",
"current += 16 * VAR_12;",
"}",
"} else {",
"uint8_t *previous = s->prev->VAR_1[VAR_7];",
"if (!previous ||\ns->prev->VAR_10 != s->VAR_10 || s->prev->VAR_11 != s->VAR_11) {",
"av_log(VAR_0, AV_LOG_ERROR, \"Missing reference frame.\\n\");",
"VAR_6 = AVERROR_INVALIDDATA;",
"goto err;",
"}",
"memset(pmv, 0, ((VAR_10 / 8) + 3) * sizeof(svq1_pmv));",
"for (VAR_9 = 0; VAR_9 < VAR_11; VAR_9 += 16) {",
"for (VAR_8 = 0; VAR_8 < VAR_10; VAR_8 += 16) {",
"VAR_6 = svq1_decode_delta_block(VAR_0, &s->hdsp,\n&s->gb, ¤t[VAR_8],\nprevious, VAR_12,\npmv, VAR_8, VAR_9, VAR_10, VAR_11);",
"if (VAR_6 != 0) {",
"av_dlog(VAR_0,\n\"Error in svq1_decode_delta_block %VAR_7\\n\",\nVAR_6);",
"goto err;",
"}",
"}",
"pmv[0].VAR_8 =\npmv[0].VAR_9 = 0;",
"current += 16 * VAR_12;",
"}",
"}",
"}",
"if (!s->nonref) {",
"av_frame_unref(s->prev);",
"VAR_6 = av_frame_ref(s->prev, cur);",
"if (VAR_6 < 0)\ngoto err;",
"}",
"*VAR_2 = 1;",
"VAR_6 = VAR_5;",
"err:\nav_free(pmv);",
"return VAR_6;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
25
],
[
31
],
[
35,
37
],
[
43
],
[
45
],
[
49
],
[
51
],
[
53
],
[
57
],
[
61
],
[
63
],
[
65
],
[
67
],
[
71
],
[
73,
75
],
[
79,
81,
83,
85,
87
],
[
91
],
[
93,
95
],
[
99
],
[
101,
103
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121,
123
],
[
125
],
[
127
],
[
129
],
[
133
],
[
137
],
[
141
],
[
143
],
[
145,
147
],
[
149
],
[
151,
153,
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165
],
[
167
],
[
171
],
[
173,
175
],
[
177
],
[
179
],
[
181
],
[
183
],
[
187
],
[
191
],
[
193
],
[
195,
197,
199,
201
],
[
203
],
[
205,
207,
209
],
[
211
],
[
213
],
[
215
],
[
219,
221
],
[
225
],
[
227
],
[
229
],
[
231
],
[
235
],
[
237
],
[
239
],
[
241,
243
],
[
245
],
[
249
],
[
251
],
[
255,
257
],
[
259
],
[
261
]
]
|
14,830 | static void pci_get_node_name(char *nodename, int len, PCIDevice *dev)
{
int slot = PCI_SLOT(dev->devfn);
int func = PCI_FUNC(dev->devfn);
uint32_t ccode = pci_default_read_config(dev, PCI_CLASS_PROG, 3);
const char *name;
name = pci_find_device_name((ccode >> 16) & 0xff, (ccode >> 8) & 0xff,
ccode & 0xff);
if (func != 0) {
snprintf(nodename, len, "%s@%x,%x", name, slot, func);
} else {
snprintf(nodename, len, "%s@%x", name, slot);
}
}
| false | qemu | 549ce59e2b9ed7f41d2f88524bd5e01b0d7db2e9 | static void pci_get_node_name(char *nodename, int len, PCIDevice *dev)
{
int slot = PCI_SLOT(dev->devfn);
int func = PCI_FUNC(dev->devfn);
uint32_t ccode = pci_default_read_config(dev, PCI_CLASS_PROG, 3);
const char *name;
name = pci_find_device_name((ccode >> 16) & 0xff, (ccode >> 8) & 0xff,
ccode & 0xff);
if (func != 0) {
snprintf(nodename, len, "%s@%x,%x", name, slot, func);
} else {
snprintf(nodename, len, "%s@%x", name, slot);
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(char *VAR_0, int VAR_1, PCIDevice *VAR_2)
{
int VAR_3 = PCI_SLOT(VAR_2->devfn);
int VAR_4 = PCI_FUNC(VAR_2->devfn);
uint32_t ccode = pci_default_read_config(VAR_2, PCI_CLASS_PROG, 3);
const char *VAR_5;
VAR_5 = pci_find_device_name((ccode >> 16) & 0xff, (ccode >> 8) & 0xff,
ccode & 0xff);
if (VAR_4 != 0) {
snprintf(VAR_0, VAR_1, "%s@%x,%x", VAR_5, VAR_3, VAR_4);
} else {
snprintf(VAR_0, VAR_1, "%s@%x", VAR_5, VAR_3);
}
}
| [
"static void FUNC_0(char *VAR_0, int VAR_1, PCIDevice *VAR_2)\n{",
"int VAR_3 = PCI_SLOT(VAR_2->devfn);",
"int VAR_4 = PCI_FUNC(VAR_2->devfn);",
"uint32_t ccode = pci_default_read_config(VAR_2, PCI_CLASS_PROG, 3);",
"const char *VAR_5;",
"VAR_5 = pci_find_device_name((ccode >> 16) & 0xff, (ccode >> 8) & 0xff,\nccode & 0xff);",
"if (VAR_4 != 0) {",
"snprintf(VAR_0, VAR_1, \"%s@%x,%x\", VAR_5, VAR_3, VAR_4);",
"} else {",
"snprintf(VAR_0, VAR_1, \"%s@%x\", VAR_5, VAR_3);",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15,
17
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
]
]
|
14,831 | void kqemu_flush_page(CPUState *env, target_ulong addr)
{
LOG_INT("kqemu_flush_page: addr=" TARGET_FMT_lx "\n", addr);
if (nb_pages_to_flush >= KQEMU_MAX_PAGES_TO_FLUSH)
nb_pages_to_flush = KQEMU_FLUSH_ALL;
else
pages_to_flush[nb_pages_to_flush++] = addr;
}
| false | qemu | 4a1418e07bdcfaa3177739e04707ecaec75d89e1 | void kqemu_flush_page(CPUState *env, target_ulong addr)
{
LOG_INT("kqemu_flush_page: addr=" TARGET_FMT_lx "\n", addr);
if (nb_pages_to_flush >= KQEMU_MAX_PAGES_TO_FLUSH)
nb_pages_to_flush = KQEMU_FLUSH_ALL;
else
pages_to_flush[nb_pages_to_flush++] = addr;
}
| {
"code": [],
"line_no": []
} | void FUNC_0(CPUState *VAR_0, target_ulong VAR_1)
{
LOG_INT("FUNC_0: VAR_1=" TARGET_FMT_lx "\n", VAR_1);
if (nb_pages_to_flush >= KQEMU_MAX_PAGES_TO_FLUSH)
nb_pages_to_flush = KQEMU_FLUSH_ALL;
else
pages_to_flush[nb_pages_to_flush++] = VAR_1;
}
| [
"void FUNC_0(CPUState *VAR_0, target_ulong VAR_1)\n{",
"LOG_INT(\"FUNC_0: VAR_1=\" TARGET_FMT_lx \"\\n\", VAR_1);",
"if (nb_pages_to_flush >= KQEMU_MAX_PAGES_TO_FLUSH)\nnb_pages_to_flush = KQEMU_FLUSH_ALL;",
"else\npages_to_flush[nb_pages_to_flush++] = VAR_1;",
"}"
]
| [
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7,
9
],
[
11,
13
],
[
15
]
]
|
14,832 | void helper_lcall_real_T0_T1(int shift, int next_eip)
{
int new_cs, new_eip;
uint32_t esp, esp_mask;
uint8_t *ssp;
new_cs = T0;
new_eip = T1;
esp = env->regs[R_ESP];
esp_mask = 0xffffffff;
if (!(env->segs[R_SS].flags & DESC_B_MASK))
esp_mask = 0xffff;
ssp = env->segs[R_SS].base;
if (shift) {
esp -= 4;
stl(ssp + (esp & esp_mask), env->segs[R_CS].selector);
esp -= 4;
stl(ssp + (esp & esp_mask), next_eip);
} else {
esp -= 2;
stw(ssp + (esp & esp_mask), env->segs[R_CS].selector);
esp -= 2;
stw(ssp + (esp & esp_mask), next_eip);
}
if (!(env->segs[R_SS].flags & DESC_B_MASK))
env->regs[R_ESP] = (env->regs[R_ESP] & ~0xffff) | (esp & 0xffff);
else
env->regs[R_ESP] = esp;
env->eip = new_eip;
env->segs[R_CS].selector = new_cs;
env->segs[R_CS].base = (uint8_t *)(new_cs << 4);
}
| false | qemu | 3b22c4707decb706b10ce023534f8b79413ff9fe | void helper_lcall_real_T0_T1(int shift, int next_eip)
{
int new_cs, new_eip;
uint32_t esp, esp_mask;
uint8_t *ssp;
new_cs = T0;
new_eip = T1;
esp = env->regs[R_ESP];
esp_mask = 0xffffffff;
if (!(env->segs[R_SS].flags & DESC_B_MASK))
esp_mask = 0xffff;
ssp = env->segs[R_SS].base;
if (shift) {
esp -= 4;
stl(ssp + (esp & esp_mask), env->segs[R_CS].selector);
esp -= 4;
stl(ssp + (esp & esp_mask), next_eip);
} else {
esp -= 2;
stw(ssp + (esp & esp_mask), env->segs[R_CS].selector);
esp -= 2;
stw(ssp + (esp & esp_mask), next_eip);
}
if (!(env->segs[R_SS].flags & DESC_B_MASK))
env->regs[R_ESP] = (env->regs[R_ESP] & ~0xffff) | (esp & 0xffff);
else
env->regs[R_ESP] = esp;
env->eip = new_eip;
env->segs[R_CS].selector = new_cs;
env->segs[R_CS].base = (uint8_t *)(new_cs << 4);
}
| {
"code": [],
"line_no": []
} | void FUNC_0(int VAR_0, int VAR_1)
{
int VAR_2, VAR_3;
uint32_t esp, esp_mask;
uint8_t *ssp;
VAR_2 = T0;
VAR_3 = T1;
esp = env->regs[R_ESP];
esp_mask = 0xffffffff;
if (!(env->segs[R_SS].flags & DESC_B_MASK))
esp_mask = 0xffff;
ssp = env->segs[R_SS].base;
if (VAR_0) {
esp -= 4;
stl(ssp + (esp & esp_mask), env->segs[R_CS].selector);
esp -= 4;
stl(ssp + (esp & esp_mask), VAR_1);
} else {
esp -= 2;
stw(ssp + (esp & esp_mask), env->segs[R_CS].selector);
esp -= 2;
stw(ssp + (esp & esp_mask), VAR_1);
}
if (!(env->segs[R_SS].flags & DESC_B_MASK))
env->regs[R_ESP] = (env->regs[R_ESP] & ~0xffff) | (esp & 0xffff);
else
env->regs[R_ESP] = esp;
env->eip = VAR_3;
env->segs[R_CS].selector = VAR_2;
env->segs[R_CS].base = (uint8_t *)(VAR_2 << 4);
}
| [
"void FUNC_0(int VAR_0, int VAR_1)\n{",
"int VAR_2, VAR_3;",
"uint32_t esp, esp_mask;",
"uint8_t *ssp;",
"VAR_2 = T0;",
"VAR_3 = T1;",
"esp = env->regs[R_ESP];",
"esp_mask = 0xffffffff;",
"if (!(env->segs[R_SS].flags & DESC_B_MASK))\nesp_mask = 0xffff;",
"ssp = env->segs[R_SS].base;",
"if (VAR_0) {",
"esp -= 4;",
"stl(ssp + (esp & esp_mask), env->segs[R_CS].selector);",
"esp -= 4;",
"stl(ssp + (esp & esp_mask), VAR_1);",
"} else {",
"esp -= 2;",
"stw(ssp + (esp & esp_mask), env->segs[R_CS].selector);",
"esp -= 2;",
"stw(ssp + (esp & esp_mask), VAR_1);",
"}",
"if (!(env->segs[R_SS].flags & DESC_B_MASK))\nenv->regs[R_ESP] = (env->regs[R_ESP] & ~0xffff) | (esp & 0xffff);",
"else\nenv->regs[R_ESP] = esp;",
"env->eip = VAR_3;",
"env->segs[R_CS].selector = VAR_2;",
"env->segs[R_CS].base = (uint8_t *)(VAR_2 << 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
]
| [
[
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
]
]
|
14,833 | static void handle_port_owner_write(EHCIState *s, int port, uint32_t owner)
{
USBDevice *dev = s->ports[port].dev;
uint32_t *portsc = &s->portsc[port];
uint32_t orig;
if (s->companion_ports[port] == NULL)
return;
owner = owner & PORTSC_POWNER;
orig = *portsc & PORTSC_POWNER;
if (!(owner ^ orig)) {
return;
}
if (dev) {
usb_attach(&s->ports[port], NULL);
}
*portsc &= ~PORTSC_POWNER;
*portsc |= owner;
if (dev) {
usb_attach(&s->ports[port], dev);
}
}
| false | qemu | 891fb2cd4592b6fe76106a69e0ca40efbf82726a | static void handle_port_owner_write(EHCIState *s, int port, uint32_t owner)
{
USBDevice *dev = s->ports[port].dev;
uint32_t *portsc = &s->portsc[port];
uint32_t orig;
if (s->companion_ports[port] == NULL)
return;
owner = owner & PORTSC_POWNER;
orig = *portsc & PORTSC_POWNER;
if (!(owner ^ orig)) {
return;
}
if (dev) {
usb_attach(&s->ports[port], NULL);
}
*portsc &= ~PORTSC_POWNER;
*portsc |= owner;
if (dev) {
usb_attach(&s->ports[port], dev);
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(EHCIState *VAR_0, int VAR_1, uint32_t VAR_2)
{
USBDevice *dev = VAR_0->ports[VAR_1].dev;
uint32_t *portsc = &VAR_0->portsc[VAR_1];
uint32_t orig;
if (VAR_0->companion_ports[VAR_1] == NULL)
return;
VAR_2 = VAR_2 & PORTSC_POWNER;
orig = *portsc & PORTSC_POWNER;
if (!(VAR_2 ^ orig)) {
return;
}
if (dev) {
usb_attach(&VAR_0->ports[VAR_1], NULL);
}
*portsc &= ~PORTSC_POWNER;
*portsc |= VAR_2;
if (dev) {
usb_attach(&VAR_0->ports[VAR_1], dev);
}
}
| [
"static void FUNC_0(EHCIState *VAR_0, int VAR_1, uint32_t VAR_2)\n{",
"USBDevice *dev = VAR_0->ports[VAR_1].dev;",
"uint32_t *portsc = &VAR_0->portsc[VAR_1];",
"uint32_t orig;",
"if (VAR_0->companion_ports[VAR_1] == NULL)\nreturn;",
"VAR_2 = VAR_2 & PORTSC_POWNER;",
"orig = *portsc & PORTSC_POWNER;",
"if (!(VAR_2 ^ orig)) {",
"return;",
"}",
"if (dev) {",
"usb_attach(&VAR_0->ports[VAR_1], NULL);",
"}",
"*portsc &= ~PORTSC_POWNER;",
"*portsc |= VAR_2;",
"if (dev) {",
"usb_attach(&VAR_0->ports[VAR_1], dev);",
"}",
"}"
]
| [
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
],
[
19
],
[
21
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
],
[
37
],
[
41
],
[
43
],
[
47
],
[
49
],
[
51
],
[
53
]
]
|
14,834 | static void test_visitor_out_native_list_str(TestOutputVisitorData *data,
const void *unused)
{
test_native_list(data, unused, USER_DEF_NATIVE_LIST_UNION_KIND_STRING);
}
| false | qemu | b3db211f3c80bb996a704d665fe275619f728bd4 | static void test_visitor_out_native_list_str(TestOutputVisitorData *data,
const void *unused)
{
test_native_list(data, unused, USER_DEF_NATIVE_LIST_UNION_KIND_STRING);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(TestOutputVisitorData *VAR_0,
const void *VAR_1)
{
test_native_list(VAR_0, VAR_1, USER_DEF_NATIVE_LIST_UNION_KIND_STRING);
}
| [
"static void FUNC_0(TestOutputVisitorData *VAR_0,\nconst void *VAR_1)\n{",
"test_native_list(VAR_0, VAR_1, USER_DEF_NATIVE_LIST_UNION_KIND_STRING);",
"}"
]
| [
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
]
]
|
14,835 | PCIBus *i440fx_init(const char *host_type, const char *pci_type,
PCII440FXState **pi440fx_state,
int *piix3_devfn,
ISABus **isa_bus, qemu_irq *pic,
MemoryRegion *address_space_mem,
MemoryRegion *address_space_io,
ram_addr_t ram_size,
ram_addr_t below_4g_mem_size,
ram_addr_t above_4g_mem_size,
MemoryRegion *pci_address_space,
MemoryRegion *ram_memory)
{
DeviceState *dev;
PCIBus *b;
PCIDevice *d;
PCIHostState *s;
PIIX3State *piix3;
PCII440FXState *f;
unsigned i;
I440FXState *i440fx;
dev = qdev_create(NULL, host_type);
s = PCI_HOST_BRIDGE(dev);
b = pci_bus_new(dev, NULL, pci_address_space,
address_space_io, 0, TYPE_PCI_BUS);
s->bus = b;
object_property_add_child(qdev_get_machine(), "i440fx", OBJECT(dev), NULL);
qdev_init_nofail(dev);
d = pci_create_simple(b, 0, pci_type);
*pi440fx_state = I440FX_PCI_DEVICE(d);
f = *pi440fx_state;
f->system_memory = address_space_mem;
f->pci_address_space = pci_address_space;
f->ram_memory = ram_memory;
i440fx = I440FX_PCI_HOST_BRIDGE(dev);
i440fx->pci_hole.begin = below_4g_mem_size;
i440fx->pci_hole.end = IO_APIC_DEFAULT_ADDRESS;
/* setup pci memory mapping */
pc_pci_as_mapping_init(OBJECT(f), f->system_memory,
f->pci_address_space);
/* if *disabled* show SMRAM to all CPUs */
memory_region_init_alias(&f->smram_region, OBJECT(d), "smram-region",
f->pci_address_space, 0xa0000, 0x20000);
memory_region_add_subregion_overlap(f->system_memory, 0xa0000,
&f->smram_region, 1);
memory_region_set_enabled(&f->smram_region, true);
/* smram, as seen by SMM CPUs */
memory_region_init(&f->smram, OBJECT(d), "smram", 1ull << 32);
memory_region_set_enabled(&f->smram, true);
memory_region_init_alias(&f->low_smram, OBJECT(d), "smram-low",
f->ram_memory, 0xa0000, 0x20000);
memory_region_set_enabled(&f->low_smram, true);
memory_region_add_subregion(&f->smram, 0xa0000, &f->low_smram);
object_property_add_const_link(qdev_get_machine(), "smram",
OBJECT(&f->smram), &error_abort);
init_pam(dev, f->ram_memory, f->system_memory, f->pci_address_space,
&f->pam_regions[0], PAM_BIOS_BASE, PAM_BIOS_SIZE);
for (i = 0; i < 12; ++i) {
init_pam(dev, f->ram_memory, f->system_memory, f->pci_address_space,
&f->pam_regions[i+1], PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE,
PAM_EXPAN_SIZE);
}
/* Xen supports additional interrupt routes from the PCI devices to
* the IOAPIC: the four pins of each PCI device on the bus are also
* connected to the IOAPIC directly.
* These additional routes can be discovered through ACPI. */
if (xen_enabled()) {
PCIDevice *pci_dev = pci_create_simple_multifunction(b,
-1, true, "PIIX3-xen");
piix3 = PIIX3_PCI_DEVICE(pci_dev);
pci_bus_irqs(b, xen_piix3_set_irq, xen_pci_slot_get_pirq,
piix3, XEN_PIIX_NUM_PIRQS);
} else {
PCIDevice *pci_dev = pci_create_simple_multifunction(b,
-1, true, "PIIX3");
piix3 = PIIX3_PCI_DEVICE(pci_dev);
pci_bus_irqs(b, piix3_set_irq, pci_slot_get_pirq, piix3,
PIIX_NUM_PIRQS);
pci_bus_set_route_irq_fn(b, piix3_route_intx_pin_to_irq);
}
piix3->pic = pic;
*isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(piix3), "isa.0"));
*piix3_devfn = piix3->dev.devfn;
ram_size = ram_size / 8 / 1024 / 1024;
if (ram_size > 255) {
ram_size = 255;
}
d->config[I440FX_COREBOOT_RAM_SIZE] = ram_size;
i440fx_update_memory_mappings(f);
return b;
}
| false | qemu | a0efbf16604770b9d805bcf210ec29942321134f | PCIBus *i440fx_init(const char *host_type, const char *pci_type,
PCII440FXState **pi440fx_state,
int *piix3_devfn,
ISABus **isa_bus, qemu_irq *pic,
MemoryRegion *address_space_mem,
MemoryRegion *address_space_io,
ram_addr_t ram_size,
ram_addr_t below_4g_mem_size,
ram_addr_t above_4g_mem_size,
MemoryRegion *pci_address_space,
MemoryRegion *ram_memory)
{
DeviceState *dev;
PCIBus *b;
PCIDevice *d;
PCIHostState *s;
PIIX3State *piix3;
PCII440FXState *f;
unsigned i;
I440FXState *i440fx;
dev = qdev_create(NULL, host_type);
s = PCI_HOST_BRIDGE(dev);
b = pci_bus_new(dev, NULL, pci_address_space,
address_space_io, 0, TYPE_PCI_BUS);
s->bus = b;
object_property_add_child(qdev_get_machine(), "i440fx", OBJECT(dev), NULL);
qdev_init_nofail(dev);
d = pci_create_simple(b, 0, pci_type);
*pi440fx_state = I440FX_PCI_DEVICE(d);
f = *pi440fx_state;
f->system_memory = address_space_mem;
f->pci_address_space = pci_address_space;
f->ram_memory = ram_memory;
i440fx = I440FX_PCI_HOST_BRIDGE(dev);
i440fx->pci_hole.begin = below_4g_mem_size;
i440fx->pci_hole.end = IO_APIC_DEFAULT_ADDRESS;
pc_pci_as_mapping_init(OBJECT(f), f->system_memory,
f->pci_address_space);
memory_region_init_alias(&f->smram_region, OBJECT(d), "smram-region",
f->pci_address_space, 0xa0000, 0x20000);
memory_region_add_subregion_overlap(f->system_memory, 0xa0000,
&f->smram_region, 1);
memory_region_set_enabled(&f->smram_region, true);
memory_region_init(&f->smram, OBJECT(d), "smram", 1ull << 32);
memory_region_set_enabled(&f->smram, true);
memory_region_init_alias(&f->low_smram, OBJECT(d), "smram-low",
f->ram_memory, 0xa0000, 0x20000);
memory_region_set_enabled(&f->low_smram, true);
memory_region_add_subregion(&f->smram, 0xa0000, &f->low_smram);
object_property_add_const_link(qdev_get_machine(), "smram",
OBJECT(&f->smram), &error_abort);
init_pam(dev, f->ram_memory, f->system_memory, f->pci_address_space,
&f->pam_regions[0], PAM_BIOS_BASE, PAM_BIOS_SIZE);
for (i = 0; i < 12; ++i) {
init_pam(dev, f->ram_memory, f->system_memory, f->pci_address_space,
&f->pam_regions[i+1], PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE,
PAM_EXPAN_SIZE);
}
if (xen_enabled()) {
PCIDevice *pci_dev = pci_create_simple_multifunction(b,
-1, true, "PIIX3-xen");
piix3 = PIIX3_PCI_DEVICE(pci_dev);
pci_bus_irqs(b, xen_piix3_set_irq, xen_pci_slot_get_pirq,
piix3, XEN_PIIX_NUM_PIRQS);
} else {
PCIDevice *pci_dev = pci_create_simple_multifunction(b,
-1, true, "PIIX3");
piix3 = PIIX3_PCI_DEVICE(pci_dev);
pci_bus_irqs(b, piix3_set_irq, pci_slot_get_pirq, piix3,
PIIX_NUM_PIRQS);
pci_bus_set_route_irq_fn(b, piix3_route_intx_pin_to_irq);
}
piix3->pic = pic;
*isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(piix3), "isa.0"));
*piix3_devfn = piix3->dev.devfn;
ram_size = ram_size / 8 / 1024 / 1024;
if (ram_size > 255) {
ram_size = 255;
}
d->config[I440FX_COREBOOT_RAM_SIZE] = ram_size;
i440fx_update_memory_mappings(f);
return b;
}
| {
"code": [],
"line_no": []
} | PCIBus *FUNC_0(const char *host_type, const char *pci_type,
PCII440FXState **pi440fx_state,
int *piix3_devfn,
ISABus **isa_bus, qemu_irq *pic,
MemoryRegion *address_space_mem,
MemoryRegion *address_space_io,
ram_addr_t ram_size,
ram_addr_t below_4g_mem_size,
ram_addr_t above_4g_mem_size,
MemoryRegion *pci_address_space,
MemoryRegion *ram_memory)
{
DeviceState *dev;
PCIBus *b;
PCIDevice *d;
PCIHostState *s;
PIIX3State *piix3;
PCII440FXState *f;
unsigned VAR_0;
I440FXState *i440fx;
dev = qdev_create(NULL, host_type);
s = PCI_HOST_BRIDGE(dev);
b = pci_bus_new(dev, NULL, pci_address_space,
address_space_io, 0, TYPE_PCI_BUS);
s->bus = b;
object_property_add_child(qdev_get_machine(), "i440fx", OBJECT(dev), NULL);
qdev_init_nofail(dev);
d = pci_create_simple(b, 0, pci_type);
*pi440fx_state = I440FX_PCI_DEVICE(d);
f = *pi440fx_state;
f->system_memory = address_space_mem;
f->pci_address_space = pci_address_space;
f->ram_memory = ram_memory;
i440fx = I440FX_PCI_HOST_BRIDGE(dev);
i440fx->pci_hole.begin = below_4g_mem_size;
i440fx->pci_hole.end = IO_APIC_DEFAULT_ADDRESS;
pc_pci_as_mapping_init(OBJECT(f), f->system_memory,
f->pci_address_space);
memory_region_init_alias(&f->smram_region, OBJECT(d), "smram-region",
f->pci_address_space, 0xa0000, 0x20000);
memory_region_add_subregion_overlap(f->system_memory, 0xa0000,
&f->smram_region, 1);
memory_region_set_enabled(&f->smram_region, true);
memory_region_init(&f->smram, OBJECT(d), "smram", 1ull << 32);
memory_region_set_enabled(&f->smram, true);
memory_region_init_alias(&f->low_smram, OBJECT(d), "smram-low",
f->ram_memory, 0xa0000, 0x20000);
memory_region_set_enabled(&f->low_smram, true);
memory_region_add_subregion(&f->smram, 0xa0000, &f->low_smram);
object_property_add_const_link(qdev_get_machine(), "smram",
OBJECT(&f->smram), &error_abort);
init_pam(dev, f->ram_memory, f->system_memory, f->pci_address_space,
&f->pam_regions[0], PAM_BIOS_BASE, PAM_BIOS_SIZE);
for (VAR_0 = 0; VAR_0 < 12; ++VAR_0) {
init_pam(dev, f->ram_memory, f->system_memory, f->pci_address_space,
&f->pam_regions[VAR_0+1], PAM_EXPAN_BASE + VAR_0 * PAM_EXPAN_SIZE,
PAM_EXPAN_SIZE);
}
if (xen_enabled()) {
PCIDevice *pci_dev = pci_create_simple_multifunction(b,
-1, true, "PIIX3-xen");
piix3 = PIIX3_PCI_DEVICE(pci_dev);
pci_bus_irqs(b, xen_piix3_set_irq, xen_pci_slot_get_pirq,
piix3, XEN_PIIX_NUM_PIRQS);
} else {
PCIDevice *pci_dev = pci_create_simple_multifunction(b,
-1, true, "PIIX3");
piix3 = PIIX3_PCI_DEVICE(pci_dev);
pci_bus_irqs(b, piix3_set_irq, pci_slot_get_pirq, piix3,
PIIX_NUM_PIRQS);
pci_bus_set_route_irq_fn(b, piix3_route_intx_pin_to_irq);
}
piix3->pic = pic;
*isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(piix3), "isa.0"));
*piix3_devfn = piix3->dev.devfn;
ram_size = ram_size / 8 / 1024 / 1024;
if (ram_size > 255) {
ram_size = 255;
}
d->config[I440FX_COREBOOT_RAM_SIZE] = ram_size;
i440fx_update_memory_mappings(f);
return b;
}
| [
"PCIBus *FUNC_0(const char *host_type, const char *pci_type,\nPCII440FXState **pi440fx_state,\nint *piix3_devfn,\nISABus **isa_bus, qemu_irq *pic,\nMemoryRegion *address_space_mem,\nMemoryRegion *address_space_io,\nram_addr_t ram_size,\nram_addr_t below_4g_mem_size,\nram_addr_t above_4g_mem_size,\nMemoryRegion *pci_address_space,\nMemoryRegion *ram_memory)\n{",
"DeviceState *dev;",
"PCIBus *b;",
"PCIDevice *d;",
"PCIHostState *s;",
"PIIX3State *piix3;",
"PCII440FXState *f;",
"unsigned VAR_0;",
"I440FXState *i440fx;",
"dev = qdev_create(NULL, host_type);",
"s = PCI_HOST_BRIDGE(dev);",
"b = pci_bus_new(dev, NULL, pci_address_space,\naddress_space_io, 0, TYPE_PCI_BUS);",
"s->bus = b;",
"object_property_add_child(qdev_get_machine(), \"i440fx\", OBJECT(dev), NULL);",
"qdev_init_nofail(dev);",
"d = pci_create_simple(b, 0, pci_type);",
"*pi440fx_state = I440FX_PCI_DEVICE(d);",
"f = *pi440fx_state;",
"f->system_memory = address_space_mem;",
"f->pci_address_space = pci_address_space;",
"f->ram_memory = ram_memory;",
"i440fx = I440FX_PCI_HOST_BRIDGE(dev);",
"i440fx->pci_hole.begin = below_4g_mem_size;",
"i440fx->pci_hole.end = IO_APIC_DEFAULT_ADDRESS;",
"pc_pci_as_mapping_init(OBJECT(f), f->system_memory,\nf->pci_address_space);",
"memory_region_init_alias(&f->smram_region, OBJECT(d), \"smram-region\",\nf->pci_address_space, 0xa0000, 0x20000);",
"memory_region_add_subregion_overlap(f->system_memory, 0xa0000,\n&f->smram_region, 1);",
"memory_region_set_enabled(&f->smram_region, true);",
"memory_region_init(&f->smram, OBJECT(d), \"smram\", 1ull << 32);",
"memory_region_set_enabled(&f->smram, true);",
"memory_region_init_alias(&f->low_smram, OBJECT(d), \"smram-low\",\nf->ram_memory, 0xa0000, 0x20000);",
"memory_region_set_enabled(&f->low_smram, true);",
"memory_region_add_subregion(&f->smram, 0xa0000, &f->low_smram);",
"object_property_add_const_link(qdev_get_machine(), \"smram\",\nOBJECT(&f->smram), &error_abort);",
"init_pam(dev, f->ram_memory, f->system_memory, f->pci_address_space,\n&f->pam_regions[0], PAM_BIOS_BASE, PAM_BIOS_SIZE);",
"for (VAR_0 = 0; VAR_0 < 12; ++VAR_0) {",
"init_pam(dev, f->ram_memory, f->system_memory, f->pci_address_space,\n&f->pam_regions[VAR_0+1], PAM_EXPAN_BASE + VAR_0 * PAM_EXPAN_SIZE,\nPAM_EXPAN_SIZE);",
"}",
"if (xen_enabled()) {",
"PCIDevice *pci_dev = pci_create_simple_multifunction(b,\n-1, true, \"PIIX3-xen\");",
"piix3 = PIIX3_PCI_DEVICE(pci_dev);",
"pci_bus_irqs(b, xen_piix3_set_irq, xen_pci_slot_get_pirq,\npiix3, XEN_PIIX_NUM_PIRQS);",
"} else {",
"PCIDevice *pci_dev = pci_create_simple_multifunction(b,\n-1, true, \"PIIX3\");",
"piix3 = PIIX3_PCI_DEVICE(pci_dev);",
"pci_bus_irqs(b, piix3_set_irq, pci_slot_get_pirq, piix3,\nPIIX_NUM_PIRQS);",
"pci_bus_set_route_irq_fn(b, piix3_route_intx_pin_to_irq);",
"}",
"piix3->pic = pic;",
"*isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(piix3), \"isa.0\"));",
"*piix3_devfn = piix3->dev.devfn;",
"ram_size = ram_size / 8 / 1024 / 1024;",
"if (ram_size > 255) {",
"ram_size = 255;",
"}",
"d->config[I440FX_COREBOOT_RAM_SIZE] = ram_size;",
"i440fx_update_memory_mappings(f);",
"return b;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5,
7,
9,
11,
13,
15,
17,
19,
21,
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
43
],
[
45
],
[
47,
49
],
[
51
],
[
53
],
[
55
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
73
],
[
75
],
[
77
],
[
83,
85
],
[
91,
93
],
[
95,
97
],
[
99
],
[
105
],
[
107
],
[
109,
111
],
[
113
],
[
115
],
[
117,
119
],
[
123,
125
],
[
127
],
[
129,
131,
133
],
[
135
],
[
147
],
[
149,
151
],
[
153
],
[
155,
157
],
[
159
],
[
161,
163
],
[
165
],
[
167,
169
],
[
171
],
[
173
],
[
175
],
[
177
],
[
181
],
[
185
],
[
187
],
[
189
],
[
191
],
[
193
],
[
197
],
[
201
],
[
203
]
]
|
14,836 | void qio_channel_socket_connect_async(QIOChannelSocket *ioc,
SocketAddressLegacy *addr,
QIOTaskFunc callback,
gpointer opaque,
GDestroyNotify destroy)
{
QIOTask *task = qio_task_new(
OBJECT(ioc), callback, opaque, destroy);
SocketAddressLegacy *addrCopy;
addrCopy = QAPI_CLONE(SocketAddressLegacy, addr);
/* socket_connect() does a non-blocking connect(), but it
* still blocks in DNS lookups, so we must use a thread */
trace_qio_channel_socket_connect_async(ioc, addr);
qio_task_run_in_thread(task,
qio_channel_socket_connect_worker,
addrCopy,
(GDestroyNotify)qapi_free_SocketAddressLegacy);
}
| false | qemu | bd269ebc82fbaa5fe7ce5bc7c1770ac8acecd884 | void qio_channel_socket_connect_async(QIOChannelSocket *ioc,
SocketAddressLegacy *addr,
QIOTaskFunc callback,
gpointer opaque,
GDestroyNotify destroy)
{
QIOTask *task = qio_task_new(
OBJECT(ioc), callback, opaque, destroy);
SocketAddressLegacy *addrCopy;
addrCopy = QAPI_CLONE(SocketAddressLegacy, addr);
trace_qio_channel_socket_connect_async(ioc, addr);
qio_task_run_in_thread(task,
qio_channel_socket_connect_worker,
addrCopy,
(GDestroyNotify)qapi_free_SocketAddressLegacy);
}
| {
"code": [],
"line_no": []
} | void FUNC_0(QIOChannelSocket *VAR_0,
SocketAddressLegacy *VAR_1,
QIOTaskFunc VAR_2,
gpointer VAR_3,
GDestroyNotify VAR_4)
{
QIOTask *task = qio_task_new(
OBJECT(VAR_0), VAR_2, VAR_3, VAR_4);
SocketAddressLegacy *addrCopy;
addrCopy = QAPI_CLONE(SocketAddressLegacy, VAR_1);
trace_qio_channel_socket_connect_async(VAR_0, VAR_1);
qio_task_run_in_thread(task,
qio_channel_socket_connect_worker,
addrCopy,
(GDestroyNotify)qapi_free_SocketAddressLegacy);
}
| [
"void FUNC_0(QIOChannelSocket *VAR_0,\nSocketAddressLegacy *VAR_1,\nQIOTaskFunc VAR_2,\ngpointer VAR_3,\nGDestroyNotify VAR_4)\n{",
"QIOTask *task = qio_task_new(\nOBJECT(VAR_0), VAR_2, VAR_3, VAR_4);",
"SocketAddressLegacy *addrCopy;",
"addrCopy = QAPI_CLONE(SocketAddressLegacy, VAR_1);",
"trace_qio_channel_socket_connect_async(VAR_0, VAR_1);",
"qio_task_run_in_thread(task,\nqio_channel_socket_connect_worker,\naddrCopy,\n(GDestroyNotify)qapi_free_SocketAddressLegacy);",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5,
7,
9,
11
],
[
13,
15
],
[
17
],
[
21
],
[
29
],
[
31,
33,
35,
37
],
[
39
]
]
|
14,837 | static av_cold int targa_encode_close(AVCodecContext *avctx)
{
av_frame_free(&avctx->coded_frame);
return 0;
}
| false | FFmpeg | d6604b29ef544793479d7fb4e05ef6622bb3e534 | static av_cold int targa_encode_close(AVCodecContext *avctx)
{
av_frame_free(&avctx->coded_frame);
return 0;
}
| {
"code": [],
"line_no": []
} | static av_cold int FUNC_0(AVCodecContext *avctx)
{
av_frame_free(&avctx->coded_frame);
return 0;
}
| [
"static av_cold int FUNC_0(AVCodecContext *avctx)\n{",
"av_frame_free(&avctx->coded_frame);",
"return 0;",
"}"
]
| [
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
]
]
|
14,838 | static int vnc_set_x509_credential_dir(VncDisplay *vs,
const char *certdir)
{
if (vnc_set_x509_credential(vs, certdir, X509_CA_CERT_FILE, &vs->x509cacert, 0) < 0)
goto cleanup;
if (vnc_set_x509_credential(vs, certdir, X509_CA_CRL_FILE, &vs->x509cacrl, 1) < 0)
goto cleanup;
if (vnc_set_x509_credential(vs, certdir, X509_SERVER_CERT_FILE, &vs->x509cert, 0) < 0)
goto cleanup;
if (vnc_set_x509_credential(vs, certdir, X509_SERVER_KEY_FILE, &vs->x509key, 0) < 0)
goto cleanup;
return 0;
cleanup:
qemu_free(vs->x509cacert);
qemu_free(vs->x509cacrl);
qemu_free(vs->x509cert);
qemu_free(vs->x509key);
vs->x509cacert = vs->x509cacrl = vs->x509cert = vs->x509key = NULL;
return -1;
}
| false | qemu | 5fb6c7a8b26eab1a22207d24b4784bd2b39ab54b | static int vnc_set_x509_credential_dir(VncDisplay *vs,
const char *certdir)
{
if (vnc_set_x509_credential(vs, certdir, X509_CA_CERT_FILE, &vs->x509cacert, 0) < 0)
goto cleanup;
if (vnc_set_x509_credential(vs, certdir, X509_CA_CRL_FILE, &vs->x509cacrl, 1) < 0)
goto cleanup;
if (vnc_set_x509_credential(vs, certdir, X509_SERVER_CERT_FILE, &vs->x509cert, 0) < 0)
goto cleanup;
if (vnc_set_x509_credential(vs, certdir, X509_SERVER_KEY_FILE, &vs->x509key, 0) < 0)
goto cleanup;
return 0;
cleanup:
qemu_free(vs->x509cacert);
qemu_free(vs->x509cacrl);
qemu_free(vs->x509cert);
qemu_free(vs->x509key);
vs->x509cacert = vs->x509cacrl = vs->x509cert = vs->x509key = NULL;
return -1;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(VncDisplay *VAR_0,
const char *VAR_1)
{
if (vnc_set_x509_credential(VAR_0, VAR_1, X509_CA_CERT_FILE, &VAR_0->x509cacert, 0) < 0)
goto cleanup;
if (vnc_set_x509_credential(VAR_0, VAR_1, X509_CA_CRL_FILE, &VAR_0->x509cacrl, 1) < 0)
goto cleanup;
if (vnc_set_x509_credential(VAR_0, VAR_1, X509_SERVER_CERT_FILE, &VAR_0->x509cert, 0) < 0)
goto cleanup;
if (vnc_set_x509_credential(VAR_0, VAR_1, X509_SERVER_KEY_FILE, &VAR_0->x509key, 0) < 0)
goto cleanup;
return 0;
cleanup:
qemu_free(VAR_0->x509cacert);
qemu_free(VAR_0->x509cacrl);
qemu_free(VAR_0->x509cert);
qemu_free(VAR_0->x509key);
VAR_0->x509cacert = VAR_0->x509cacrl = VAR_0->x509cert = VAR_0->x509key = NULL;
return -1;
}
| [
"static int FUNC_0(VncDisplay *VAR_0,\nconst char *VAR_1)\n{",
"if (vnc_set_x509_credential(VAR_0, VAR_1, X509_CA_CERT_FILE, &VAR_0->x509cacert, 0) < 0)\ngoto cleanup;",
"if (vnc_set_x509_credential(VAR_0, VAR_1, X509_CA_CRL_FILE, &VAR_0->x509cacrl, 1) < 0)\ngoto cleanup;",
"if (vnc_set_x509_credential(VAR_0, VAR_1, X509_SERVER_CERT_FILE, &VAR_0->x509cert, 0) < 0)\ngoto cleanup;",
"if (vnc_set_x509_credential(VAR_0, VAR_1, X509_SERVER_KEY_FILE, &VAR_0->x509key, 0) < 0)\ngoto cleanup;",
"return 0;",
"cleanup:\nqemu_free(VAR_0->x509cacert);",
"qemu_free(VAR_0->x509cacrl);",
"qemu_free(VAR_0->x509cert);",
"qemu_free(VAR_0->x509key);",
"VAR_0->x509cacert = VAR_0->x509cacrl = VAR_0->x509cert = VAR_0->x509key = NULL;",
"return -1;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7,
9
],
[
11,
13
],
[
15,
17
],
[
19,
21
],
[
25
],
[
29,
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
]
]
|
14,839 | static inline uint32_t xen_vcpu_eport(shared_iopage_t *shared_page, int i)
{
return shared_page->vcpu_iodata[i].vp_eport;
}
| false | qemu | 47d3df2387ed6927732584ffa4159c26d9f4dee8 | static inline uint32_t xen_vcpu_eport(shared_iopage_t *shared_page, int i)
{
return shared_page->vcpu_iodata[i].vp_eport;
}
| {
"code": [],
"line_no": []
} | static inline uint32_t FUNC_0(shared_iopage_t *shared_page, int i)
{
return shared_page->vcpu_iodata[i].vp_eport;
}
| [
"static inline uint32_t FUNC_0(shared_iopage_t *shared_page, int i)\n{",
"return shared_page->vcpu_iodata[i].vp_eport;",
"}"
]
| [
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
]
]
|
14,841 | int bdrv_flush_all(void)
{
BlockDriverState *bs = NULL;
int result = 0;
while ((bs = bdrv_next(bs))) {
AioContext *aio_context = bdrv_get_aio_context(bs);
int ret;
aio_context_acquire(aio_context);
ret = bdrv_flush(bs);
if (ret < 0 && !result) {
result = ret;
}
aio_context_release(aio_context);
}
return result;
}
| false | qemu | 61007b316cd71ee7333ff7a0a749a8949527575f | int bdrv_flush_all(void)
{
BlockDriverState *bs = NULL;
int result = 0;
while ((bs = bdrv_next(bs))) {
AioContext *aio_context = bdrv_get_aio_context(bs);
int ret;
aio_context_acquire(aio_context);
ret = bdrv_flush(bs);
if (ret < 0 && !result) {
result = ret;
}
aio_context_release(aio_context);
}
return result;
}
| {
"code": [],
"line_no": []
} | int FUNC_0(void)
{
BlockDriverState *bs = NULL;
int VAR_0 = 0;
while ((bs = bdrv_next(bs))) {
AioContext *aio_context = bdrv_get_aio_context(bs);
int VAR_1;
aio_context_acquire(aio_context);
VAR_1 = bdrv_flush(bs);
if (VAR_1 < 0 && !VAR_0) {
VAR_0 = VAR_1;
}
aio_context_release(aio_context);
}
return VAR_0;
}
| [
"int FUNC_0(void)\n{",
"BlockDriverState *bs = NULL;",
"int VAR_0 = 0;",
"while ((bs = bdrv_next(bs))) {",
"AioContext *aio_context = bdrv_get_aio_context(bs);",
"int VAR_1;",
"aio_context_acquire(aio_context);",
"VAR_1 = bdrv_flush(bs);",
"if (VAR_1 < 0 && !VAR_0) {",
"VAR_0 = VAR_1;",
"}",
"aio_context_release(aio_context);",
"}",
"return VAR_0;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
35
],
[
37
]
]
|
14,843 | static inline void gen_movcf_s (int fs, int fd, int cc, int tf)
{
uint32_t ccbit;
int cond;
TCGv r_tmp1 = tcg_temp_local_new(TCG_TYPE_I32);
TCGv fp0 = tcg_temp_local_new(TCG_TYPE_I32);
TCGv fp1 = tcg_temp_local_new(TCG_TYPE_I32);
int l1 = gen_new_label();
if (cc)
ccbit = 1 << (24 + cc);
else
ccbit = 1 << 23;
if (tf)
cond = TCG_COND_EQ;
else
cond = TCG_COND_NE;
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, fd);
tcg_gen_andi_i32(r_tmp1, fpu_fcr31, ccbit);
tcg_gen_brcondi_i32(cond, r_tmp1, 0, l1);
tcg_gen_mov_i32(fp1, fp0);
tcg_temp_free(fp0);
gen_set_label(l1);
tcg_temp_free(r_tmp1);
gen_store_fpr32(fp1, fd);
tcg_temp_free(fp1);
}
| false | qemu | 9bf3eb2ca542dd9306cb2e72fc68e02ba3e56e2e | static inline void gen_movcf_s (int fs, int fd, int cc, int tf)
{
uint32_t ccbit;
int cond;
TCGv r_tmp1 = tcg_temp_local_new(TCG_TYPE_I32);
TCGv fp0 = tcg_temp_local_new(TCG_TYPE_I32);
TCGv fp1 = tcg_temp_local_new(TCG_TYPE_I32);
int l1 = gen_new_label();
if (cc)
ccbit = 1 << (24 + cc);
else
ccbit = 1 << 23;
if (tf)
cond = TCG_COND_EQ;
else
cond = TCG_COND_NE;
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, fd);
tcg_gen_andi_i32(r_tmp1, fpu_fcr31, ccbit);
tcg_gen_brcondi_i32(cond, r_tmp1, 0, l1);
tcg_gen_mov_i32(fp1, fp0);
tcg_temp_free(fp0);
gen_set_label(l1);
tcg_temp_free(r_tmp1);
gen_store_fpr32(fp1, fd);
tcg_temp_free(fp1);
}
| {
"code": [],
"line_no": []
} | static inline void FUNC_0 (int VAR_0, int VAR_1, int VAR_2, int VAR_3)
{
uint32_t ccbit;
int VAR_4;
TCGv r_tmp1 = tcg_temp_local_new(TCG_TYPE_I32);
TCGv fp0 = tcg_temp_local_new(TCG_TYPE_I32);
TCGv fp1 = tcg_temp_local_new(TCG_TYPE_I32);
int VAR_5 = gen_new_label();
if (VAR_2)
ccbit = 1 << (24 + VAR_2);
else
ccbit = 1 << 23;
if (VAR_3)
VAR_4 = TCG_COND_EQ;
else
VAR_4 = TCG_COND_NE;
gen_load_fpr32(fp0, VAR_0);
gen_load_fpr32(fp1, VAR_1);
tcg_gen_andi_i32(r_tmp1, fpu_fcr31, ccbit);
tcg_gen_brcondi_i32(VAR_4, r_tmp1, 0, VAR_5);
tcg_gen_mov_i32(fp1, fp0);
tcg_temp_free(fp0);
gen_set_label(VAR_5);
tcg_temp_free(r_tmp1);
gen_store_fpr32(fp1, VAR_1);
tcg_temp_free(fp1);
}
| [
"static inline void FUNC_0 (int VAR_0, int VAR_1, int VAR_2, int VAR_3)\n{",
"uint32_t ccbit;",
"int VAR_4;",
"TCGv r_tmp1 = tcg_temp_local_new(TCG_TYPE_I32);",
"TCGv fp0 = tcg_temp_local_new(TCG_TYPE_I32);",
"TCGv fp1 = tcg_temp_local_new(TCG_TYPE_I32);",
"int VAR_5 = gen_new_label();",
"if (VAR_2)\nccbit = 1 << (24 + VAR_2);",
"else\nccbit = 1 << 23;",
"if (VAR_3)\nVAR_4 = TCG_COND_EQ;",
"else\nVAR_4 = TCG_COND_NE;",
"gen_load_fpr32(fp0, VAR_0);",
"gen_load_fpr32(fp1, VAR_1);",
"tcg_gen_andi_i32(r_tmp1, fpu_fcr31, ccbit);",
"tcg_gen_brcondi_i32(VAR_4, r_tmp1, 0, VAR_5);",
"tcg_gen_mov_i32(fp1, fp0);",
"tcg_temp_free(fp0);",
"gen_set_label(VAR_5);",
"tcg_temp_free(r_tmp1);",
"gen_store_fpr32(fp1, VAR_1);",
"tcg_temp_free(fp1);",
"}"
]
| [
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
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
]
]
|
14,844 | static void notdirty_mem_writel(void *opaque, target_phys_addr_t ram_addr,
uint32_t val)
{
int dirty_flags;
dirty_flags = phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS];
if (!(dirty_flags & CODE_DIRTY_FLAG)) {
#if !defined(CONFIG_USER_ONLY)
tb_invalidate_phys_page_fast(ram_addr, 4);
dirty_flags = phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS];
#endif
}
stl_p(qemu_get_ram_ptr(ram_addr), val);
dirty_flags |= (0xff & ~CODE_DIRTY_FLAG);
phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] = dirty_flags;
/* we remove the notdirty callback only if the code has been
flushed */
if (dirty_flags == 0xff)
tlb_set_dirty(cpu_single_env, cpu_single_env->mem_io_vaddr);
}
| false | qemu | f7c11b535040df31cc8bc3b1f0c33f546073ee62 | static void notdirty_mem_writel(void *opaque, target_phys_addr_t ram_addr,
uint32_t val)
{
int dirty_flags;
dirty_flags = phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS];
if (!(dirty_flags & CODE_DIRTY_FLAG)) {
#if !defined(CONFIG_USER_ONLY)
tb_invalidate_phys_page_fast(ram_addr, 4);
dirty_flags = phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS];
#endif
}
stl_p(qemu_get_ram_ptr(ram_addr), val);
dirty_flags |= (0xff & ~CODE_DIRTY_FLAG);
phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] = dirty_flags;
if (dirty_flags == 0xff)
tlb_set_dirty(cpu_single_env, cpu_single_env->mem_io_vaddr);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,
uint32_t VAR_2)
{
int VAR_3;
VAR_3 = phys_ram_dirty[VAR_1 >> TARGET_PAGE_BITS];
if (!(VAR_3 & CODE_DIRTY_FLAG)) {
#if !defined(CONFIG_USER_ONLY)
tb_invalidate_phys_page_fast(VAR_1, 4);
VAR_3 = phys_ram_dirty[VAR_1 >> TARGET_PAGE_BITS];
#endif
}
stl_p(qemu_get_ram_ptr(VAR_1), VAR_2);
VAR_3 |= (0xff & ~CODE_DIRTY_FLAG);
phys_ram_dirty[VAR_1 >> TARGET_PAGE_BITS] = VAR_3;
if (VAR_3 == 0xff)
tlb_set_dirty(cpu_single_env, cpu_single_env->mem_io_vaddr);
}
| [
"static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint32_t VAR_2)\n{",
"int VAR_3;",
"VAR_3 = phys_ram_dirty[VAR_1 >> TARGET_PAGE_BITS];",
"if (!(VAR_3 & CODE_DIRTY_FLAG)) {",
"#if !defined(CONFIG_USER_ONLY)\ntb_invalidate_phys_page_fast(VAR_1, 4);",
"VAR_3 = phys_ram_dirty[VAR_1 >> TARGET_PAGE_BITS];",
"#endif\n}",
"stl_p(qemu_get_ram_ptr(VAR_1), VAR_2);",
"VAR_3 |= (0xff & ~CODE_DIRTY_FLAG);",
"phys_ram_dirty[VAR_1 >> TARGET_PAGE_BITS] = VAR_3;",
"if (VAR_3 == 0xff)\ntlb_set_dirty(cpu_single_env, cpu_single_env->mem_io_vaddr);",
"}"
]
| [
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
],
[
33,
35
],
[
37
]
]
|
14,845 | static void qcow2_invalidate_cache(BlockDriverState *bs, Error **errp)
{
BDRVQcow2State *s = bs->opaque;
int flags = s->flags;
QCryptoCipher *cipher = NULL;
QDict *options;
Error *local_err = NULL;
int ret;
/*
* Backing files are read-only which makes all of their metadata immutable,
* that means we don't have to worry about reopening them here.
*/
cipher = s->cipher;
s->cipher = NULL;
qcow2_close(bs);
bdrv_invalidate_cache(bs->file->bs, &local_err);
if (local_err) {
error_propagate(errp, local_err);
bs->drv = NULL;
return;
}
memset(s, 0, sizeof(BDRVQcow2State));
options = qdict_clone_shallow(bs->options);
flags &= ~BDRV_O_INACTIVE;
ret = qcow2_open(bs, options, flags, &local_err);
QDECREF(options);
if (local_err) {
error_propagate(errp, local_err);
error_prepend(errp, "Could not reopen qcow2 layer: ");
bs->drv = NULL;
return;
} else if (ret < 0) {
error_setg_errno(errp, -ret, "Could not reopen qcow2 layer");
bs->drv = NULL;
return;
}
s->cipher = cipher;
}
| false | qemu | c9e9e9c66cee9932fb28a41a4659aa421a7a3f78 | static void qcow2_invalidate_cache(BlockDriverState *bs, Error **errp)
{
BDRVQcow2State *s = bs->opaque;
int flags = s->flags;
QCryptoCipher *cipher = NULL;
QDict *options;
Error *local_err = NULL;
int ret;
cipher = s->cipher;
s->cipher = NULL;
qcow2_close(bs);
bdrv_invalidate_cache(bs->file->bs, &local_err);
if (local_err) {
error_propagate(errp, local_err);
bs->drv = NULL;
return;
}
memset(s, 0, sizeof(BDRVQcow2State));
options = qdict_clone_shallow(bs->options);
flags &= ~BDRV_O_INACTIVE;
ret = qcow2_open(bs, options, flags, &local_err);
QDECREF(options);
if (local_err) {
error_propagate(errp, local_err);
error_prepend(errp, "Could not reopen qcow2 layer: ");
bs->drv = NULL;
return;
} else if (ret < 0) {
error_setg_errno(errp, -ret, "Could not reopen qcow2 layer");
bs->drv = NULL;
return;
}
s->cipher = cipher;
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(BlockDriverState *VAR_0, Error **VAR_1)
{
BDRVQcow2State *s = VAR_0->opaque;
int VAR_2 = s->VAR_2;
QCryptoCipher *cipher = NULL;
QDict *options;
Error *local_err = NULL;
int VAR_3;
cipher = s->cipher;
s->cipher = NULL;
qcow2_close(VAR_0);
bdrv_invalidate_cache(VAR_0->file->VAR_0, &local_err);
if (local_err) {
error_propagate(VAR_1, local_err);
VAR_0->drv = NULL;
return;
}
memset(s, 0, sizeof(BDRVQcow2State));
options = qdict_clone_shallow(VAR_0->options);
VAR_2 &= ~BDRV_O_INACTIVE;
VAR_3 = qcow2_open(VAR_0, options, VAR_2, &local_err);
QDECREF(options);
if (local_err) {
error_propagate(VAR_1, local_err);
error_prepend(VAR_1, "Could not reopen qcow2 layer: ");
VAR_0->drv = NULL;
return;
} else if (VAR_3 < 0) {
error_setg_errno(VAR_1, -VAR_3, "Could not reopen qcow2 layer");
VAR_0->drv = NULL;
return;
}
s->cipher = cipher;
}
| [
"static void FUNC_0(BlockDriverState *VAR_0, Error **VAR_1)\n{",
"BDRVQcow2State *s = VAR_0->opaque;",
"int VAR_2 = s->VAR_2;",
"QCryptoCipher *cipher = NULL;",
"QDict *options;",
"Error *local_err = NULL;",
"int VAR_3;",
"cipher = s->cipher;",
"s->cipher = NULL;",
"qcow2_close(VAR_0);",
"bdrv_invalidate_cache(VAR_0->file->VAR_0, &local_err);",
"if (local_err) {",
"error_propagate(VAR_1, local_err);",
"VAR_0->drv = NULL;",
"return;",
"}",
"memset(s, 0, sizeof(BDRVQcow2State));",
"options = qdict_clone_shallow(VAR_0->options);",
"VAR_2 &= ~BDRV_O_INACTIVE;",
"VAR_3 = qcow2_open(VAR_0, options, VAR_2, &local_err);",
"QDECREF(options);",
"if (local_err) {",
"error_propagate(VAR_1, local_err);",
"error_prepend(VAR_1, \"Could not reopen qcow2 layer: \");",
"VAR_0->drv = NULL;",
"return;",
"} else if (VAR_3 < 0) {",
"error_setg_errno(VAR_1, -VAR_3, \"Could not reopen qcow2 layer\");",
"VAR_0->drv = NULL;",
"return;",
"}",
"s->cipher = cipher;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
29
],
[
31
],
[
35
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
53
],
[
55
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
87
],
[
89
]
]
|
14,847 | static inline void gen_evmwumiaa(DisasContext *ctx)
{
TCGv_i64 acc;
TCGv_i64 tmp;
if (unlikely(!ctx->spe_enabled)) {
gen_exception(ctx, POWERPC_EXCP_APU);
return;
}
gen_evmwumi(ctx); /* rD := rA * rB */
acc = tcg_temp_new_i64();
tmp = tcg_temp_new_i64();
/* tmp := rD */
gen_load_gpr64(tmp, rD(ctx->opcode));
/* Load acc */
tcg_gen_ld_i64(acc, cpu_env, offsetof(CPUState, spe_acc));
/* acc := tmp + acc */
tcg_gen_add_i64(acc, acc, tmp);
/* Store acc */
tcg_gen_st_i64(acc, cpu_env, offsetof(CPUState, spe_acc));
/* rD := acc */
gen_store_gpr64(rD(ctx->opcode), acc);
tcg_temp_free_i64(acc);
tcg_temp_free_i64(tmp);
}
| false | qemu | 27a69bb088bee6d4efea254659422fb9c751b3c7 | static inline void gen_evmwumiaa(DisasContext *ctx)
{
TCGv_i64 acc;
TCGv_i64 tmp;
if (unlikely(!ctx->spe_enabled)) {
gen_exception(ctx, POWERPC_EXCP_APU);
return;
}
gen_evmwumi(ctx);
acc = tcg_temp_new_i64();
tmp = tcg_temp_new_i64();
gen_load_gpr64(tmp, rD(ctx->opcode));
tcg_gen_ld_i64(acc, cpu_env, offsetof(CPUState, spe_acc));
tcg_gen_add_i64(acc, acc, tmp);
tcg_gen_st_i64(acc, cpu_env, offsetof(CPUState, spe_acc));
gen_store_gpr64(rD(ctx->opcode), acc);
tcg_temp_free_i64(acc);
tcg_temp_free_i64(tmp);
}
| {
"code": [],
"line_no": []
} | static inline void FUNC_0(DisasContext *VAR_0)
{
TCGv_i64 acc;
TCGv_i64 tmp;
if (unlikely(!VAR_0->spe_enabled)) {
gen_exception(VAR_0, POWERPC_EXCP_APU);
return;
}
gen_evmwumi(VAR_0);
acc = tcg_temp_new_i64();
tmp = tcg_temp_new_i64();
gen_load_gpr64(tmp, rD(VAR_0->opcode));
tcg_gen_ld_i64(acc, cpu_env, offsetof(CPUState, spe_acc));
tcg_gen_add_i64(acc, acc, tmp);
tcg_gen_st_i64(acc, cpu_env, offsetof(CPUState, spe_acc));
gen_store_gpr64(rD(VAR_0->opcode), acc);
tcg_temp_free_i64(acc);
tcg_temp_free_i64(tmp);
}
| [
"static inline void FUNC_0(DisasContext *VAR_0)\n{",
"TCGv_i64 acc;",
"TCGv_i64 tmp;",
"if (unlikely(!VAR_0->spe_enabled)) {",
"gen_exception(VAR_0, POWERPC_EXCP_APU);",
"return;",
"}",
"gen_evmwumi(VAR_0);",
"acc = tcg_temp_new_i64();",
"tmp = tcg_temp_new_i64();",
"gen_load_gpr64(tmp, rD(VAR_0->opcode));",
"tcg_gen_ld_i64(acc, cpu_env, offsetof(CPUState, spe_acc));",
"tcg_gen_add_i64(acc, acc, tmp);",
"tcg_gen_st_i64(acc, cpu_env, offsetof(CPUState, spe_acc));",
"gen_store_gpr64(rD(VAR_0->opcode), acc);",
"tcg_temp_free_i64(acc);",
"tcg_temp_free_i64(tmp);",
"}"
]
| [
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
],
[
25
],
[
27
],
[
33
],
[
39
],
[
45
],
[
51
],
[
57
],
[
61
],
[
63
],
[
65
]
]
|
14,849 | void qemu_system_reset(void)
{
QEMUResetEntry *re, *nre;
/* reset all devices */
TAILQ_FOREACH_SAFE(re, &reset_handlers, entry, nre) {
re->func(re->opaque);
}
}
| false | qemu | 72cf2d4f0e181d0d3a3122e04129c58a95da713e | void qemu_system_reset(void)
{
QEMUResetEntry *re, *nre;
TAILQ_FOREACH_SAFE(re, &reset_handlers, entry, nre) {
re->func(re->opaque);
}
}
| {
"code": [],
"line_no": []
} | void FUNC_0(void)
{
QEMUResetEntry *re, *nre;
TAILQ_FOREACH_SAFE(re, &reset_handlers, entry, nre) {
re->func(re->opaque);
}
}
| [
"void FUNC_0(void)\n{",
"QEMUResetEntry *re, *nre;",
"TAILQ_FOREACH_SAFE(re, &reset_handlers, entry, nre) {",
"re->func(re->opaque);",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
11
],
[
13
],
[
15
],
[
17
]
]
|
14,851 | static int cpu_can_run(CPUState *env)
{
if (env->stop)
return 0;
if (env->stopped)
return 0;
if (!vm_running)
return 0;
return 1;
}
| false | qemu | 55274a30522d0f542c1659386f01096b78669455 | static int cpu_can_run(CPUState *env)
{
if (env->stop)
return 0;
if (env->stopped)
return 0;
if (!vm_running)
return 0;
return 1;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(CPUState *VAR_0)
{
if (VAR_0->stop)
return 0;
if (VAR_0->stopped)
return 0;
if (!vm_running)
return 0;
return 1;
}
| [
"static int FUNC_0(CPUState *VAR_0)\n{",
"if (VAR_0->stop)\nreturn 0;",
"if (VAR_0->stopped)\nreturn 0;",
"if (!vm_running)\nreturn 0;",
"return 1;",
"}"
]
| [
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5,
7
],
[
9,
11
],
[
13,
15
],
[
17
],
[
19
]
]
|
14,852 | static void cpu_common_parse_features(const char *typename, char *features,
Error **errp)
{
char *featurestr; /* Single "key=value" string being parsed */
char *val;
static bool cpu_globals_initialized;
/* TODO: all callers of ->parse_features() need to be changed to
* call it only once, so we can remove this check (or change it
* to assert(!cpu_globals_initialized).
* Current callers of ->parse_features() are:
* - cpu_generic_init()
* - cpu_x86_create()
*/
if (cpu_globals_initialized) {
return;
}
cpu_globals_initialized = true;
featurestr = features ? strtok(features, ",") : NULL;
while (featurestr) {
val = strchr(featurestr, '=');
if (val) {
GlobalProperty *prop = g_new0(typeof(*prop), 1);
*val = 0;
val++;
prop->driver = typename;
prop->property = g_strdup(featurestr);
prop->value = g_strdup(val);
prop->errp = &error_fatal;
qdev_prop_register_global(prop);
} else {
error_setg(errp, "Expected key=value format, found %s.",
featurestr);
return;
}
featurestr = strtok(NULL, ",");
}
}
| false | qemu | 6aff24c6a61c6fec31e555c7748ba6085b7b2c06 | static void cpu_common_parse_features(const char *typename, char *features,
Error **errp)
{
char *featurestr;
char *val;
static bool cpu_globals_initialized;
if (cpu_globals_initialized) {
return;
}
cpu_globals_initialized = true;
featurestr = features ? strtok(features, ",") : NULL;
while (featurestr) {
val = strchr(featurestr, '=');
if (val) {
GlobalProperty *prop = g_new0(typeof(*prop), 1);
*val = 0;
val++;
prop->driver = typename;
prop->property = g_strdup(featurestr);
prop->value = g_strdup(val);
prop->errp = &error_fatal;
qdev_prop_register_global(prop);
} else {
error_setg(errp, "Expected key=value format, found %s.",
featurestr);
return;
}
featurestr = strtok(NULL, ",");
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(const char *VAR_0, char *VAR_1,
Error **VAR_2)
{
char *VAR_3;
char *VAR_4;
static bool VAR_5;
if (VAR_5) {
return;
}
VAR_5 = true;
VAR_3 = VAR_1 ? strtok(VAR_1, ",") : NULL;
while (VAR_3) {
VAR_4 = strchr(VAR_3, '=');
if (VAR_4) {
GlobalProperty *prop = g_new0(typeof(*prop), 1);
*VAR_4 = 0;
VAR_4++;
prop->driver = VAR_0;
prop->property = g_strdup(VAR_3);
prop->value = g_strdup(VAR_4);
prop->VAR_2 = &error_fatal;
qdev_prop_register_global(prop);
} else {
error_setg(VAR_2, "Expected key=value format, found %s.",
VAR_3);
return;
}
VAR_3 = strtok(NULL, ",");
}
}
| [
"static void FUNC_0(const char *VAR_0, char *VAR_1,\nError **VAR_2)\n{",
"char *VAR_3;",
"char *VAR_4;",
"static bool VAR_5;",
"if (VAR_5) {",
"return;",
"}",
"VAR_5 = true;",
"VAR_3 = VAR_1 ? strtok(VAR_1, \",\") : NULL;",
"while (VAR_3) {",
"VAR_4 = strchr(VAR_3, '=');",
"if (VAR_4) {",
"GlobalProperty *prop = g_new0(typeof(*prop), 1);",
"*VAR_4 = 0;",
"VAR_4++;",
"prop->driver = VAR_0;",
"prop->property = g_strdup(VAR_3);",
"prop->value = g_strdup(VAR_4);",
"prop->VAR_2 = &error_fatal;",
"qdev_prop_register_global(prop);",
"} else {",
"error_setg(VAR_2, \"Expected key=value format, found %s.\",\nVAR_3);",
"return;",
"}",
"VAR_3 = strtok(NULL, \",\");",
"}",
"}"
]
| [
0,
0,
0,
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
],
[
29
],
[
31
],
[
33
],
[
35
],
[
39
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67,
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
]
]
|
14,853 | static void ich9_lpc_update_apic(ICH9LPCState *lpc, int gsi)
{
int level = 0;
assert(gsi >= ICH9_LPC_PIC_NUM_PINS);
level |= pci_bus_get_irq_level(lpc->d.bus, ich9_gsi_to_pirq(gsi));
if (gsi == lpc->sci_gsi) {
level |= lpc->sci_level;
}
qemu_set_irq(lpc->gsi[gsi], level);
}
| false | qemu | fd56e0612b6454a282fa6a953fdb09281a98c589 | static void ich9_lpc_update_apic(ICH9LPCState *lpc, int gsi)
{
int level = 0;
assert(gsi >= ICH9_LPC_PIC_NUM_PINS);
level |= pci_bus_get_irq_level(lpc->d.bus, ich9_gsi_to_pirq(gsi));
if (gsi == lpc->sci_gsi) {
level |= lpc->sci_level;
}
qemu_set_irq(lpc->gsi[gsi], level);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(ICH9LPCState *VAR_0, int VAR_1)
{
int VAR_2 = 0;
assert(VAR_1 >= ICH9_LPC_PIC_NUM_PINS);
VAR_2 |= pci_bus_get_irq_level(VAR_0->d.bus, ich9_gsi_to_pirq(VAR_1));
if (VAR_1 == VAR_0->sci_gsi) {
VAR_2 |= VAR_0->sci_level;
}
qemu_set_irq(VAR_0->VAR_1[VAR_1], VAR_2);
}
| [
"static void FUNC_0(ICH9LPCState *VAR_0, int VAR_1)\n{",
"int VAR_2 = 0;",
"assert(VAR_1 >= ICH9_LPC_PIC_NUM_PINS);",
"VAR_2 |= pci_bus_get_irq_level(VAR_0->d.bus, ich9_gsi_to_pirq(VAR_1));",
"if (VAR_1 == VAR_0->sci_gsi) {",
"VAR_2 |= VAR_0->sci_level;",
"}",
"qemu_set_irq(VAR_0->VAR_1[VAR_1], VAR_2);",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
9
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25
]
]
|
14,855 | static int32_t scsi_disk_emulate_command(SCSIRequest *req, uint8_t *buf)
{
SCSIDiskReq *r = DO_UPCAST(SCSIDiskReq, req, req);
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, req->dev);
uint64_t nb_sectors;
uint8_t *outbuf;
int buflen;
switch (req->cmd.buf[0]) {
case INQUIRY:
case MODE_SENSE:
case MODE_SENSE_10:
case RESERVE:
case RESERVE_10:
case RELEASE:
case RELEASE_10:
case START_STOP:
case ALLOW_MEDIUM_REMOVAL:
case GET_CONFIGURATION:
case GET_EVENT_STATUS_NOTIFICATION:
case MECHANISM_STATUS:
case REQUEST_SENSE:
break;
default:
if (s->tray_open || !bdrv_is_inserted(s->qdev.conf.bs)) {
scsi_check_condition(r, SENSE_CODE(NO_MEDIUM));
return 0;
}
break;
}
if (!r->iov.iov_base) {
/*
* FIXME: we shouldn't return anything bigger than 4k, but the code
* requires the buffer to be as big as req->cmd.xfer in several
* places. So, do not allow CDBs with a very large ALLOCATION
* LENGTH. The real fix would be to modify scsi_read_data and
* dma_buf_read, so that they return data beyond the buflen
* as all zeros.
*/
if (req->cmd.xfer > 65536) {
goto illegal_request;
}
r->buflen = MAX(4096, req->cmd.xfer);
r->iov.iov_base = qemu_blockalign(s->qdev.conf.bs, r->buflen);
}
buflen = req->cmd.xfer;
outbuf = r->iov.iov_base;
switch (req->cmd.buf[0]) {
case TEST_UNIT_READY:
assert(!s->tray_open && bdrv_is_inserted(s->qdev.conf.bs));
break;
case INQUIRY:
buflen = scsi_disk_emulate_inquiry(req, outbuf);
if (buflen < 0) {
goto illegal_request;
}
break;
case MODE_SENSE:
case MODE_SENSE_10:
buflen = scsi_disk_emulate_mode_sense(r, outbuf);
if (buflen < 0) {
goto illegal_request;
}
break;
case READ_TOC:
buflen = scsi_disk_emulate_read_toc(req, outbuf);
if (buflen < 0) {
goto illegal_request;
}
break;
case RESERVE:
if (req->cmd.buf[1] & 1) {
goto illegal_request;
}
break;
case RESERVE_10:
if (req->cmd.buf[1] & 3) {
goto illegal_request;
}
break;
case RELEASE:
if (req->cmd.buf[1] & 1) {
goto illegal_request;
}
break;
case RELEASE_10:
if (req->cmd.buf[1] & 3) {
goto illegal_request;
}
break;
case START_STOP:
if (scsi_disk_emulate_start_stop(r) < 0) {
return 0;
}
break;
case ALLOW_MEDIUM_REMOVAL:
s->tray_locked = req->cmd.buf[4] & 1;
bdrv_lock_medium(s->qdev.conf.bs, req->cmd.buf[4] & 1);
break;
case READ_CAPACITY_10:
/* The normal LEN field for this command is zero. */
memset(outbuf, 0, 8);
bdrv_get_geometry(s->qdev.conf.bs, &nb_sectors);
if (!nb_sectors) {
scsi_check_condition(r, SENSE_CODE(LUN_NOT_READY));
return -1;
}
if ((req->cmd.buf[8] & 1) == 0 && req->cmd.lba) {
goto illegal_request;
}
nb_sectors /= s->qdev.blocksize / 512;
/* Returned value is the address of the last sector. */
nb_sectors--;
/* Remember the new size for read/write sanity checking. */
s->qdev.max_lba = nb_sectors;
/* Clip to 2TB, instead of returning capacity modulo 2TB. */
if (nb_sectors > UINT32_MAX) {
nb_sectors = UINT32_MAX;
}
outbuf[0] = (nb_sectors >> 24) & 0xff;
outbuf[1] = (nb_sectors >> 16) & 0xff;
outbuf[2] = (nb_sectors >> 8) & 0xff;
outbuf[3] = nb_sectors & 0xff;
outbuf[4] = 0;
outbuf[5] = 0;
outbuf[6] = s->qdev.blocksize >> 8;
outbuf[7] = 0;
buflen = 8;
break;
case REQUEST_SENSE:
/* Just return "NO SENSE". */
buflen = scsi_build_sense(NULL, 0, outbuf, r->buflen,
(req->cmd.buf[1] & 1) == 0);
break;
case MECHANISM_STATUS:
buflen = scsi_emulate_mechanism_status(s, outbuf);
if (buflen < 0) {
goto illegal_request;
}
break;
case GET_CONFIGURATION:
buflen = scsi_get_configuration(s, outbuf);
if (buflen < 0) {
goto illegal_request;
}
break;
case GET_EVENT_STATUS_NOTIFICATION:
buflen = scsi_get_event_status_notification(s, r, outbuf);
if (buflen < 0) {
goto illegal_request;
}
break;
case READ_DISC_INFORMATION:
buflen = scsi_read_disc_information(s, r, outbuf);
if (buflen < 0) {
goto illegal_request;
}
break;
case READ_DVD_STRUCTURE:
buflen = scsi_read_dvd_structure(s, r, outbuf);
if (buflen < 0) {
goto illegal_request;
}
break;
case SERVICE_ACTION_IN_16:
/* Service Action In subcommands. */
if ((req->cmd.buf[1] & 31) == SAI_READ_CAPACITY_16) {
DPRINTF("SAI READ CAPACITY(16)\n");
memset(outbuf, 0, req->cmd.xfer);
bdrv_get_geometry(s->qdev.conf.bs, &nb_sectors);
if (!nb_sectors) {
scsi_check_condition(r, SENSE_CODE(LUN_NOT_READY));
return -1;
}
if ((req->cmd.buf[14] & 1) == 0 && req->cmd.lba) {
goto illegal_request;
}
nb_sectors /= s->qdev.blocksize / 512;
/* Returned value is the address of the last sector. */
nb_sectors--;
/* Remember the new size for read/write sanity checking. */
s->qdev.max_lba = nb_sectors;
outbuf[0] = (nb_sectors >> 56) & 0xff;
outbuf[1] = (nb_sectors >> 48) & 0xff;
outbuf[2] = (nb_sectors >> 40) & 0xff;
outbuf[3] = (nb_sectors >> 32) & 0xff;
outbuf[4] = (nb_sectors >> 24) & 0xff;
outbuf[5] = (nb_sectors >> 16) & 0xff;
outbuf[6] = (nb_sectors >> 8) & 0xff;
outbuf[7] = nb_sectors & 0xff;
outbuf[8] = 0;
outbuf[9] = 0;
outbuf[10] = s->qdev.blocksize >> 8;
outbuf[11] = 0;
outbuf[12] = 0;
outbuf[13] = get_physical_block_exp(&s->qdev.conf);
/* set TPE bit if the format supports discard */
if (s->qdev.conf.discard_granularity) {
outbuf[14] = 0x80;
}
/* Protection, exponent and lowest lba field left blank. */
buflen = req->cmd.xfer;
break;
}
DPRINTF("Unsupported Service Action In\n");
goto illegal_request;
case SYNCHRONIZE_CACHE:
/* The request is used as the AIO opaque value, so add a ref. */
scsi_req_ref(&r->req);
bdrv_acct_start(s->qdev.conf.bs, &r->acct, 0, BDRV_ACCT_FLUSH);
r->req.aiocb = bdrv_aio_flush(s->qdev.conf.bs, scsi_aio_complete, r);
return 0;
case SEEK_10:
DPRINTF("Seek(10) (sector %" PRId64 ")\n", r->req.cmd.lba);
if (r->req.cmd.lba > s->qdev.max_lba) {
goto illegal_lba;
}
break;
case MODE_SELECT:
DPRINTF("Mode Select(6) (len %lu)\n", (long)r->req.cmd.xfer);
/* We don't support mode parameter changes.
Allow the mode parameter header + block descriptors only. */
if (r->req.cmd.xfer > 12) {
goto illegal_request;
}
break;
case MODE_SELECT_10:
DPRINTF("Mode Select(10) (len %lu)\n", (long)r->req.cmd.xfer);
/* We don't support mode parameter changes.
Allow the mode parameter header + block descriptors only. */
if (r->req.cmd.xfer > 16) {
goto illegal_request;
}
break;
case WRITE_SAME_10:
nb_sectors = lduw_be_p(&req->cmd.buf[7]);
goto write_same;
case WRITE_SAME_16:
nb_sectors = ldl_be_p(&req->cmd.buf[10]) & 0xffffffffULL;
write_same:
if (r->req.cmd.lba > s->qdev.max_lba) {
goto illegal_lba;
}
/*
* We only support WRITE SAME with the unmap bit set for now.
*/
if (!(req->cmd.buf[1] & 0x8)) {
goto illegal_request;
}
/* The request is used as the AIO opaque value, so add a ref. */
scsi_req_ref(&r->req);
r->req.aiocb = bdrv_aio_discard(s->qdev.conf.bs,
r->req.cmd.lba * (s->qdev.blocksize / 512),
nb_sectors * (s->qdev.blocksize / 512),
scsi_aio_complete, r);
return 0;
default:
DPRINTF("Unknown SCSI command (%2.2x)\n", buf[0]);
scsi_check_condition(r, SENSE_CODE(INVALID_OPCODE));
return 0;
}
assert(!r->req.aiocb);
r->iov.iov_len = MIN(buflen, req->cmd.xfer);
if (r->iov.iov_len == 0) {
scsi_req_complete(&r->req, GOOD);
}
if (r->req.cmd.mode == SCSI_XFER_TO_DEV) {
assert(r->iov.iov_len == req->cmd.xfer);
return -r->iov.iov_len;
} else {
return r->iov.iov_len;
}
illegal_request:
if (r->req.status == -1) {
scsi_check_condition(r, SENSE_CODE(INVALID_FIELD));
}
return 0;
illegal_lba:
scsi_check_condition(r, SENSE_CODE(LBA_OUT_OF_RANGE));
return 0;
}
| false | qemu | 380feaffb0fcc8e5f615ed8e86d2e93717a6f2c6 | static int32_t scsi_disk_emulate_command(SCSIRequest *req, uint8_t *buf)
{
SCSIDiskReq *r = DO_UPCAST(SCSIDiskReq, req, req);
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, req->dev);
uint64_t nb_sectors;
uint8_t *outbuf;
int buflen;
switch (req->cmd.buf[0]) {
case INQUIRY:
case MODE_SENSE:
case MODE_SENSE_10:
case RESERVE:
case RESERVE_10:
case RELEASE:
case RELEASE_10:
case START_STOP:
case ALLOW_MEDIUM_REMOVAL:
case GET_CONFIGURATION:
case GET_EVENT_STATUS_NOTIFICATION:
case MECHANISM_STATUS:
case REQUEST_SENSE:
break;
default:
if (s->tray_open || !bdrv_is_inserted(s->qdev.conf.bs)) {
scsi_check_condition(r, SENSE_CODE(NO_MEDIUM));
return 0;
}
break;
}
if (!r->iov.iov_base) {
if (req->cmd.xfer > 65536) {
goto illegal_request;
}
r->buflen = MAX(4096, req->cmd.xfer);
r->iov.iov_base = qemu_blockalign(s->qdev.conf.bs, r->buflen);
}
buflen = req->cmd.xfer;
outbuf = r->iov.iov_base;
switch (req->cmd.buf[0]) {
case TEST_UNIT_READY:
assert(!s->tray_open && bdrv_is_inserted(s->qdev.conf.bs));
break;
case INQUIRY:
buflen = scsi_disk_emulate_inquiry(req, outbuf);
if (buflen < 0) {
goto illegal_request;
}
break;
case MODE_SENSE:
case MODE_SENSE_10:
buflen = scsi_disk_emulate_mode_sense(r, outbuf);
if (buflen < 0) {
goto illegal_request;
}
break;
case READ_TOC:
buflen = scsi_disk_emulate_read_toc(req, outbuf);
if (buflen < 0) {
goto illegal_request;
}
break;
case RESERVE:
if (req->cmd.buf[1] & 1) {
goto illegal_request;
}
break;
case RESERVE_10:
if (req->cmd.buf[1] & 3) {
goto illegal_request;
}
break;
case RELEASE:
if (req->cmd.buf[1] & 1) {
goto illegal_request;
}
break;
case RELEASE_10:
if (req->cmd.buf[1] & 3) {
goto illegal_request;
}
break;
case START_STOP:
if (scsi_disk_emulate_start_stop(r) < 0) {
return 0;
}
break;
case ALLOW_MEDIUM_REMOVAL:
s->tray_locked = req->cmd.buf[4] & 1;
bdrv_lock_medium(s->qdev.conf.bs, req->cmd.buf[4] & 1);
break;
case READ_CAPACITY_10:
memset(outbuf, 0, 8);
bdrv_get_geometry(s->qdev.conf.bs, &nb_sectors);
if (!nb_sectors) {
scsi_check_condition(r, SENSE_CODE(LUN_NOT_READY));
return -1;
}
if ((req->cmd.buf[8] & 1) == 0 && req->cmd.lba) {
goto illegal_request;
}
nb_sectors /= s->qdev.blocksize / 512;
nb_sectors--;
s->qdev.max_lba = nb_sectors;
if (nb_sectors > UINT32_MAX) {
nb_sectors = UINT32_MAX;
}
outbuf[0] = (nb_sectors >> 24) & 0xff;
outbuf[1] = (nb_sectors >> 16) & 0xff;
outbuf[2] = (nb_sectors >> 8) & 0xff;
outbuf[3] = nb_sectors & 0xff;
outbuf[4] = 0;
outbuf[5] = 0;
outbuf[6] = s->qdev.blocksize >> 8;
outbuf[7] = 0;
buflen = 8;
break;
case REQUEST_SENSE:
buflen = scsi_build_sense(NULL, 0, outbuf, r->buflen,
(req->cmd.buf[1] & 1) == 0);
break;
case MECHANISM_STATUS:
buflen = scsi_emulate_mechanism_status(s, outbuf);
if (buflen < 0) {
goto illegal_request;
}
break;
case GET_CONFIGURATION:
buflen = scsi_get_configuration(s, outbuf);
if (buflen < 0) {
goto illegal_request;
}
break;
case GET_EVENT_STATUS_NOTIFICATION:
buflen = scsi_get_event_status_notification(s, r, outbuf);
if (buflen < 0) {
goto illegal_request;
}
break;
case READ_DISC_INFORMATION:
buflen = scsi_read_disc_information(s, r, outbuf);
if (buflen < 0) {
goto illegal_request;
}
break;
case READ_DVD_STRUCTURE:
buflen = scsi_read_dvd_structure(s, r, outbuf);
if (buflen < 0) {
goto illegal_request;
}
break;
case SERVICE_ACTION_IN_16:
if ((req->cmd.buf[1] & 31) == SAI_READ_CAPACITY_16) {
DPRINTF("SAI READ CAPACITY(16)\n");
memset(outbuf, 0, req->cmd.xfer);
bdrv_get_geometry(s->qdev.conf.bs, &nb_sectors);
if (!nb_sectors) {
scsi_check_condition(r, SENSE_CODE(LUN_NOT_READY));
return -1;
}
if ((req->cmd.buf[14] & 1) == 0 && req->cmd.lba) {
goto illegal_request;
}
nb_sectors /= s->qdev.blocksize / 512;
nb_sectors--;
s->qdev.max_lba = nb_sectors;
outbuf[0] = (nb_sectors >> 56) & 0xff;
outbuf[1] = (nb_sectors >> 48) & 0xff;
outbuf[2] = (nb_sectors >> 40) & 0xff;
outbuf[3] = (nb_sectors >> 32) & 0xff;
outbuf[4] = (nb_sectors >> 24) & 0xff;
outbuf[5] = (nb_sectors >> 16) & 0xff;
outbuf[6] = (nb_sectors >> 8) & 0xff;
outbuf[7] = nb_sectors & 0xff;
outbuf[8] = 0;
outbuf[9] = 0;
outbuf[10] = s->qdev.blocksize >> 8;
outbuf[11] = 0;
outbuf[12] = 0;
outbuf[13] = get_physical_block_exp(&s->qdev.conf);
if (s->qdev.conf.discard_granularity) {
outbuf[14] = 0x80;
}
buflen = req->cmd.xfer;
break;
}
DPRINTF("Unsupported Service Action In\n");
goto illegal_request;
case SYNCHRONIZE_CACHE:
scsi_req_ref(&r->req);
bdrv_acct_start(s->qdev.conf.bs, &r->acct, 0, BDRV_ACCT_FLUSH);
r->req.aiocb = bdrv_aio_flush(s->qdev.conf.bs, scsi_aio_complete, r);
return 0;
case SEEK_10:
DPRINTF("Seek(10) (sector %" PRId64 ")\n", r->req.cmd.lba);
if (r->req.cmd.lba > s->qdev.max_lba) {
goto illegal_lba;
}
break;
case MODE_SELECT:
DPRINTF("Mode Select(6) (len %lu)\n", (long)r->req.cmd.xfer);
if (r->req.cmd.xfer > 12) {
goto illegal_request;
}
break;
case MODE_SELECT_10:
DPRINTF("Mode Select(10) (len %lu)\n", (long)r->req.cmd.xfer);
if (r->req.cmd.xfer > 16) {
goto illegal_request;
}
break;
case WRITE_SAME_10:
nb_sectors = lduw_be_p(&req->cmd.buf[7]);
goto write_same;
case WRITE_SAME_16:
nb_sectors = ldl_be_p(&req->cmd.buf[10]) & 0xffffffffULL;
write_same:
if (r->req.cmd.lba > s->qdev.max_lba) {
goto illegal_lba;
}
if (!(req->cmd.buf[1] & 0x8)) {
goto illegal_request;
}
scsi_req_ref(&r->req);
r->req.aiocb = bdrv_aio_discard(s->qdev.conf.bs,
r->req.cmd.lba * (s->qdev.blocksize / 512),
nb_sectors * (s->qdev.blocksize / 512),
scsi_aio_complete, r);
return 0;
default:
DPRINTF("Unknown SCSI command (%2.2x)\n", buf[0]);
scsi_check_condition(r, SENSE_CODE(INVALID_OPCODE));
return 0;
}
assert(!r->req.aiocb);
r->iov.iov_len = MIN(buflen, req->cmd.xfer);
if (r->iov.iov_len == 0) {
scsi_req_complete(&r->req, GOOD);
}
if (r->req.cmd.mode == SCSI_XFER_TO_DEV) {
assert(r->iov.iov_len == req->cmd.xfer);
return -r->iov.iov_len;
} else {
return r->iov.iov_len;
}
illegal_request:
if (r->req.status == -1) {
scsi_check_condition(r, SENSE_CODE(INVALID_FIELD));
}
return 0;
illegal_lba:
scsi_check_condition(r, SENSE_CODE(LBA_OUT_OF_RANGE));
return 0;
}
| {
"code": [],
"line_no": []
} | static int32_t FUNC_0(SCSIRequest *req, uint8_t *buf)
{
SCSIDiskReq *r = DO_UPCAST(SCSIDiskReq, req, req);
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, req->dev);
uint64_t nb_sectors;
uint8_t *outbuf;
int VAR_0;
switch (req->cmd.buf[0]) {
case INQUIRY:
case MODE_SENSE:
case MODE_SENSE_10:
case RESERVE:
case RESERVE_10:
case RELEASE:
case RELEASE_10:
case START_STOP:
case ALLOW_MEDIUM_REMOVAL:
case GET_CONFIGURATION:
case GET_EVENT_STATUS_NOTIFICATION:
case MECHANISM_STATUS:
case REQUEST_SENSE:
break;
default:
if (s->tray_open || !bdrv_is_inserted(s->qdev.conf.bs)) {
scsi_check_condition(r, SENSE_CODE(NO_MEDIUM));
return 0;
}
break;
}
if (!r->iov.iov_base) {
if (req->cmd.xfer > 65536) {
goto illegal_request;
}
r->VAR_0 = MAX(4096, req->cmd.xfer);
r->iov.iov_base = qemu_blockalign(s->qdev.conf.bs, r->VAR_0);
}
VAR_0 = req->cmd.xfer;
outbuf = r->iov.iov_base;
switch (req->cmd.buf[0]) {
case TEST_UNIT_READY:
assert(!s->tray_open && bdrv_is_inserted(s->qdev.conf.bs));
break;
case INQUIRY:
VAR_0 = scsi_disk_emulate_inquiry(req, outbuf);
if (VAR_0 < 0) {
goto illegal_request;
}
break;
case MODE_SENSE:
case MODE_SENSE_10:
VAR_0 = scsi_disk_emulate_mode_sense(r, outbuf);
if (VAR_0 < 0) {
goto illegal_request;
}
break;
case READ_TOC:
VAR_0 = scsi_disk_emulate_read_toc(req, outbuf);
if (VAR_0 < 0) {
goto illegal_request;
}
break;
case RESERVE:
if (req->cmd.buf[1] & 1) {
goto illegal_request;
}
break;
case RESERVE_10:
if (req->cmd.buf[1] & 3) {
goto illegal_request;
}
break;
case RELEASE:
if (req->cmd.buf[1] & 1) {
goto illegal_request;
}
break;
case RELEASE_10:
if (req->cmd.buf[1] & 3) {
goto illegal_request;
}
break;
case START_STOP:
if (scsi_disk_emulate_start_stop(r) < 0) {
return 0;
}
break;
case ALLOW_MEDIUM_REMOVAL:
s->tray_locked = req->cmd.buf[4] & 1;
bdrv_lock_medium(s->qdev.conf.bs, req->cmd.buf[4] & 1);
break;
case READ_CAPACITY_10:
memset(outbuf, 0, 8);
bdrv_get_geometry(s->qdev.conf.bs, &nb_sectors);
if (!nb_sectors) {
scsi_check_condition(r, SENSE_CODE(LUN_NOT_READY));
return -1;
}
if ((req->cmd.buf[8] & 1) == 0 && req->cmd.lba) {
goto illegal_request;
}
nb_sectors /= s->qdev.blocksize / 512;
nb_sectors--;
s->qdev.max_lba = nb_sectors;
if (nb_sectors > UINT32_MAX) {
nb_sectors = UINT32_MAX;
}
outbuf[0] = (nb_sectors >> 24) & 0xff;
outbuf[1] = (nb_sectors >> 16) & 0xff;
outbuf[2] = (nb_sectors >> 8) & 0xff;
outbuf[3] = nb_sectors & 0xff;
outbuf[4] = 0;
outbuf[5] = 0;
outbuf[6] = s->qdev.blocksize >> 8;
outbuf[7] = 0;
VAR_0 = 8;
break;
case REQUEST_SENSE:
VAR_0 = scsi_build_sense(NULL, 0, outbuf, r->VAR_0,
(req->cmd.buf[1] & 1) == 0);
break;
case MECHANISM_STATUS:
VAR_0 = scsi_emulate_mechanism_status(s, outbuf);
if (VAR_0 < 0) {
goto illegal_request;
}
break;
case GET_CONFIGURATION:
VAR_0 = scsi_get_configuration(s, outbuf);
if (VAR_0 < 0) {
goto illegal_request;
}
break;
case GET_EVENT_STATUS_NOTIFICATION:
VAR_0 = scsi_get_event_status_notification(s, r, outbuf);
if (VAR_0 < 0) {
goto illegal_request;
}
break;
case READ_DISC_INFORMATION:
VAR_0 = scsi_read_disc_information(s, r, outbuf);
if (VAR_0 < 0) {
goto illegal_request;
}
break;
case READ_DVD_STRUCTURE:
VAR_0 = scsi_read_dvd_structure(s, r, outbuf);
if (VAR_0 < 0) {
goto illegal_request;
}
break;
case SERVICE_ACTION_IN_16:
if ((req->cmd.buf[1] & 31) == SAI_READ_CAPACITY_16) {
DPRINTF("SAI READ CAPACITY(16)\n");
memset(outbuf, 0, req->cmd.xfer);
bdrv_get_geometry(s->qdev.conf.bs, &nb_sectors);
if (!nb_sectors) {
scsi_check_condition(r, SENSE_CODE(LUN_NOT_READY));
return -1;
}
if ((req->cmd.buf[14] & 1) == 0 && req->cmd.lba) {
goto illegal_request;
}
nb_sectors /= s->qdev.blocksize / 512;
nb_sectors--;
s->qdev.max_lba = nb_sectors;
outbuf[0] = (nb_sectors >> 56) & 0xff;
outbuf[1] = (nb_sectors >> 48) & 0xff;
outbuf[2] = (nb_sectors >> 40) & 0xff;
outbuf[3] = (nb_sectors >> 32) & 0xff;
outbuf[4] = (nb_sectors >> 24) & 0xff;
outbuf[5] = (nb_sectors >> 16) & 0xff;
outbuf[6] = (nb_sectors >> 8) & 0xff;
outbuf[7] = nb_sectors & 0xff;
outbuf[8] = 0;
outbuf[9] = 0;
outbuf[10] = s->qdev.blocksize >> 8;
outbuf[11] = 0;
outbuf[12] = 0;
outbuf[13] = get_physical_block_exp(&s->qdev.conf);
if (s->qdev.conf.discard_granularity) {
outbuf[14] = 0x80;
}
VAR_0 = req->cmd.xfer;
break;
}
DPRINTF("Unsupported Service Action In\n");
goto illegal_request;
case SYNCHRONIZE_CACHE:
scsi_req_ref(&r->req);
bdrv_acct_start(s->qdev.conf.bs, &r->acct, 0, BDRV_ACCT_FLUSH);
r->req.aiocb = bdrv_aio_flush(s->qdev.conf.bs, scsi_aio_complete, r);
return 0;
case SEEK_10:
DPRINTF("Seek(10) (sector %" PRId64 ")\n", r->req.cmd.lba);
if (r->req.cmd.lba > s->qdev.max_lba) {
goto illegal_lba;
}
break;
case MODE_SELECT:
DPRINTF("Mode Select(6) (len %lu)\n", (long)r->req.cmd.xfer);
if (r->req.cmd.xfer > 12) {
goto illegal_request;
}
break;
case MODE_SELECT_10:
DPRINTF("Mode Select(10) (len %lu)\n", (long)r->req.cmd.xfer);
if (r->req.cmd.xfer > 16) {
goto illegal_request;
}
break;
case WRITE_SAME_10:
nb_sectors = lduw_be_p(&req->cmd.buf[7]);
goto write_same;
case WRITE_SAME_16:
nb_sectors = ldl_be_p(&req->cmd.buf[10]) & 0xffffffffULL;
write_same:
if (r->req.cmd.lba > s->qdev.max_lba) {
goto illegal_lba;
}
if (!(req->cmd.buf[1] & 0x8)) {
goto illegal_request;
}
scsi_req_ref(&r->req);
r->req.aiocb = bdrv_aio_discard(s->qdev.conf.bs,
r->req.cmd.lba * (s->qdev.blocksize / 512),
nb_sectors * (s->qdev.blocksize / 512),
scsi_aio_complete, r);
return 0;
default:
DPRINTF("Unknown SCSI command (%2.2x)\n", buf[0]);
scsi_check_condition(r, SENSE_CODE(INVALID_OPCODE));
return 0;
}
assert(!r->req.aiocb);
r->iov.iov_len = MIN(VAR_0, req->cmd.xfer);
if (r->iov.iov_len == 0) {
scsi_req_complete(&r->req, GOOD);
}
if (r->req.cmd.mode == SCSI_XFER_TO_DEV) {
assert(r->iov.iov_len == req->cmd.xfer);
return -r->iov.iov_len;
} else {
return r->iov.iov_len;
}
illegal_request:
if (r->req.status == -1) {
scsi_check_condition(r, SENSE_CODE(INVALID_FIELD));
}
return 0;
illegal_lba:
scsi_check_condition(r, SENSE_CODE(LBA_OUT_OF_RANGE));
return 0;
}
| [
"static int32_t FUNC_0(SCSIRequest *req, uint8_t *buf)\n{",
"SCSIDiskReq *r = DO_UPCAST(SCSIDiskReq, req, req);",
"SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, req->dev);",
"uint64_t nb_sectors;",
"uint8_t *outbuf;",
"int VAR_0;",
"switch (req->cmd.buf[0]) {",
"case INQUIRY:\ncase MODE_SENSE:\ncase MODE_SENSE_10:\ncase RESERVE:\ncase RESERVE_10:\ncase RELEASE:\ncase RELEASE_10:\ncase START_STOP:\ncase ALLOW_MEDIUM_REMOVAL:\ncase GET_CONFIGURATION:\ncase GET_EVENT_STATUS_NOTIFICATION:\ncase MECHANISM_STATUS:\ncase REQUEST_SENSE:\nbreak;",
"default:\nif (s->tray_open || !bdrv_is_inserted(s->qdev.conf.bs)) {",
"scsi_check_condition(r, SENSE_CODE(NO_MEDIUM));",
"return 0;",
"}",
"break;",
"}",
"if (!r->iov.iov_base) {",
"if (req->cmd.xfer > 65536) {",
"goto illegal_request;",
"}",
"r->VAR_0 = MAX(4096, req->cmd.xfer);",
"r->iov.iov_base = qemu_blockalign(s->qdev.conf.bs, r->VAR_0);",
"}",
"VAR_0 = req->cmd.xfer;",
"outbuf = r->iov.iov_base;",
"switch (req->cmd.buf[0]) {",
"case TEST_UNIT_READY:\nassert(!s->tray_open && bdrv_is_inserted(s->qdev.conf.bs));",
"break;",
"case INQUIRY:\nVAR_0 = scsi_disk_emulate_inquiry(req, outbuf);",
"if (VAR_0 < 0) {",
"goto illegal_request;",
"}",
"break;",
"case MODE_SENSE:\ncase MODE_SENSE_10:\nVAR_0 = scsi_disk_emulate_mode_sense(r, outbuf);",
"if (VAR_0 < 0) {",
"goto illegal_request;",
"}",
"break;",
"case READ_TOC:\nVAR_0 = scsi_disk_emulate_read_toc(req, outbuf);",
"if (VAR_0 < 0) {",
"goto illegal_request;",
"}",
"break;",
"case RESERVE:\nif (req->cmd.buf[1] & 1) {",
"goto illegal_request;",
"}",
"break;",
"case RESERVE_10:\nif (req->cmd.buf[1] & 3) {",
"goto illegal_request;",
"}",
"break;",
"case RELEASE:\nif (req->cmd.buf[1] & 1) {",
"goto illegal_request;",
"}",
"break;",
"case RELEASE_10:\nif (req->cmd.buf[1] & 3) {",
"goto illegal_request;",
"}",
"break;",
"case START_STOP:\nif (scsi_disk_emulate_start_stop(r) < 0) {",
"return 0;",
"}",
"break;",
"case ALLOW_MEDIUM_REMOVAL:\ns->tray_locked = req->cmd.buf[4] & 1;",
"bdrv_lock_medium(s->qdev.conf.bs, req->cmd.buf[4] & 1);",
"break;",
"case READ_CAPACITY_10:\nmemset(outbuf, 0, 8);",
"bdrv_get_geometry(s->qdev.conf.bs, &nb_sectors);",
"if (!nb_sectors) {",
"scsi_check_condition(r, SENSE_CODE(LUN_NOT_READY));",
"return -1;",
"}",
"if ((req->cmd.buf[8] & 1) == 0 && req->cmd.lba) {",
"goto illegal_request;",
"}",
"nb_sectors /= s->qdev.blocksize / 512;",
"nb_sectors--;",
"s->qdev.max_lba = nb_sectors;",
"if (nb_sectors > UINT32_MAX) {",
"nb_sectors = UINT32_MAX;",
"}",
"outbuf[0] = (nb_sectors >> 24) & 0xff;",
"outbuf[1] = (nb_sectors >> 16) & 0xff;",
"outbuf[2] = (nb_sectors >> 8) & 0xff;",
"outbuf[3] = nb_sectors & 0xff;",
"outbuf[4] = 0;",
"outbuf[5] = 0;",
"outbuf[6] = s->qdev.blocksize >> 8;",
"outbuf[7] = 0;",
"VAR_0 = 8;",
"break;",
"case REQUEST_SENSE:\nVAR_0 = scsi_build_sense(NULL, 0, outbuf, r->VAR_0,\n(req->cmd.buf[1] & 1) == 0);",
"break;",
"case MECHANISM_STATUS:\nVAR_0 = scsi_emulate_mechanism_status(s, outbuf);",
"if (VAR_0 < 0) {",
"goto illegal_request;",
"}",
"break;",
"case GET_CONFIGURATION:\nVAR_0 = scsi_get_configuration(s, outbuf);",
"if (VAR_0 < 0) {",
"goto illegal_request;",
"}",
"break;",
"case GET_EVENT_STATUS_NOTIFICATION:\nVAR_0 = scsi_get_event_status_notification(s, r, outbuf);",
"if (VAR_0 < 0) {",
"goto illegal_request;",
"}",
"break;",
"case READ_DISC_INFORMATION:\nVAR_0 = scsi_read_disc_information(s, r, outbuf);",
"if (VAR_0 < 0) {",
"goto illegal_request;",
"}",
"break;",
"case READ_DVD_STRUCTURE:\nVAR_0 = scsi_read_dvd_structure(s, r, outbuf);",
"if (VAR_0 < 0) {",
"goto illegal_request;",
"}",
"break;",
"case SERVICE_ACTION_IN_16:\nif ((req->cmd.buf[1] & 31) == SAI_READ_CAPACITY_16) {",
"DPRINTF(\"SAI READ CAPACITY(16)\\n\");",
"memset(outbuf, 0, req->cmd.xfer);",
"bdrv_get_geometry(s->qdev.conf.bs, &nb_sectors);",
"if (!nb_sectors) {",
"scsi_check_condition(r, SENSE_CODE(LUN_NOT_READY));",
"return -1;",
"}",
"if ((req->cmd.buf[14] & 1) == 0 && req->cmd.lba) {",
"goto illegal_request;",
"}",
"nb_sectors /= s->qdev.blocksize / 512;",
"nb_sectors--;",
"s->qdev.max_lba = nb_sectors;",
"outbuf[0] = (nb_sectors >> 56) & 0xff;",
"outbuf[1] = (nb_sectors >> 48) & 0xff;",
"outbuf[2] = (nb_sectors >> 40) & 0xff;",
"outbuf[3] = (nb_sectors >> 32) & 0xff;",
"outbuf[4] = (nb_sectors >> 24) & 0xff;",
"outbuf[5] = (nb_sectors >> 16) & 0xff;",
"outbuf[6] = (nb_sectors >> 8) & 0xff;",
"outbuf[7] = nb_sectors & 0xff;",
"outbuf[8] = 0;",
"outbuf[9] = 0;",
"outbuf[10] = s->qdev.blocksize >> 8;",
"outbuf[11] = 0;",
"outbuf[12] = 0;",
"outbuf[13] = get_physical_block_exp(&s->qdev.conf);",
"if (s->qdev.conf.discard_granularity) {",
"outbuf[14] = 0x80;",
"}",
"VAR_0 = req->cmd.xfer;",
"break;",
"}",
"DPRINTF(\"Unsupported Service Action In\\n\");",
"goto illegal_request;",
"case SYNCHRONIZE_CACHE:\nscsi_req_ref(&r->req);",
"bdrv_acct_start(s->qdev.conf.bs, &r->acct, 0, BDRV_ACCT_FLUSH);",
"r->req.aiocb = bdrv_aio_flush(s->qdev.conf.bs, scsi_aio_complete, r);",
"return 0;",
"case SEEK_10:\nDPRINTF(\"Seek(10) (sector %\" PRId64 \")\\n\", r->req.cmd.lba);",
"if (r->req.cmd.lba > s->qdev.max_lba) {",
"goto illegal_lba;",
"}",
"break;",
"case MODE_SELECT:\nDPRINTF(\"Mode Select(6) (len %lu)\\n\", (long)r->req.cmd.xfer);",
"if (r->req.cmd.xfer > 12) {",
"goto illegal_request;",
"}",
"break;",
"case MODE_SELECT_10:\nDPRINTF(\"Mode Select(10) (len %lu)\\n\", (long)r->req.cmd.xfer);",
"if (r->req.cmd.xfer > 16) {",
"goto illegal_request;",
"}",
"break;",
"case WRITE_SAME_10:\nnb_sectors = lduw_be_p(&req->cmd.buf[7]);",
"goto write_same;",
"case WRITE_SAME_16:\nnb_sectors = ldl_be_p(&req->cmd.buf[10]) & 0xffffffffULL;",
"write_same:\nif (r->req.cmd.lba > s->qdev.max_lba) {",
"goto illegal_lba;",
"}",
"if (!(req->cmd.buf[1] & 0x8)) {",
"goto illegal_request;",
"}",
"scsi_req_ref(&r->req);",
"r->req.aiocb = bdrv_aio_discard(s->qdev.conf.bs,\nr->req.cmd.lba * (s->qdev.blocksize / 512),\nnb_sectors * (s->qdev.blocksize / 512),\nscsi_aio_complete, r);",
"return 0;",
"default:\nDPRINTF(\"Unknown SCSI command (%2.2x)\\n\", buf[0]);",
"scsi_check_condition(r, SENSE_CODE(INVALID_OPCODE));",
"return 0;",
"}",
"assert(!r->req.aiocb);",
"r->iov.iov_len = MIN(VAR_0, req->cmd.xfer);",
"if (r->iov.iov_len == 0) {",
"scsi_req_complete(&r->req, GOOD);",
"}",
"if (r->req.cmd.mode == SCSI_XFER_TO_DEV) {",
"assert(r->iov.iov_len == req->cmd.xfer);",
"return -r->iov.iov_len;",
"} else {",
"return r->iov.iov_len;",
"}",
"illegal_request:\nif (r->req.status == -1) {",
"scsi_check_condition(r, SENSE_CODE(INVALID_FIELD));",
"}",
"return 0;",
"illegal_lba:\nscsi_check_condition(r, SENSE_CODE(LBA_OUT_OF_RANGE));",
"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
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
19,
21,
23,
25,
27,
29,
31,
33,
35,
37,
39,
41,
43,
45
],
[
49,
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
65
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
97
],
[
99
],
[
101
],
[
103,
105
],
[
107
],
[
109,
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121,
123,
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135,
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147,
149
],
[
151
],
[
153
],
[
155
],
[
157,
159
],
[
161
],
[
163
],
[
165
],
[
167,
169
],
[
171
],
[
173
],
[
175
],
[
177,
179
],
[
181
],
[
183
],
[
185
],
[
187,
189
],
[
191
],
[
193
],
[
195
],
[
197,
199
],
[
201
],
[
203
],
[
205,
209
],
[
211
],
[
213
],
[
215
],
[
217
],
[
219
],
[
221
],
[
223
],
[
225
],
[
227
],
[
231
],
[
235
],
[
239
],
[
241
],
[
243
],
[
245
],
[
247
],
[
249
],
[
251
],
[
253
],
[
255
],
[
257
],
[
259
],
[
261
],
[
263
],
[
265,
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
],
[
357
],
[
359
],
[
361
],
[
365
],
[
369
],
[
371
],
[
373
],
[
375
],
[
377
],
[
379
],
[
381
],
[
383
],
[
385
],
[
387
],
[
389
],
[
391
],
[
393
],
[
395
],
[
397
],
[
403
],
[
405
],
[
407
],
[
413
],
[
415
],
[
417
],
[
419
],
[
421
],
[
423,
427
],
[
429
],
[
431
],
[
433
],
[
435,
437
],
[
439
],
[
441
],
[
443
],
[
445
],
[
447,
449
],
[
455
],
[
457
],
[
459
],
[
461
],
[
463,
465
],
[
471
],
[
473
],
[
475
],
[
477
],
[
479,
481
],
[
483
],
[
485,
487
],
[
489,
491
],
[
493
],
[
495
],
[
505
],
[
507
],
[
509
],
[
515
],
[
517,
519,
521,
523
],
[
525
],
[
527,
529
],
[
531
],
[
533
],
[
535
],
[
537
],
[
539
],
[
541
],
[
543
],
[
545
],
[
547
],
[
549
],
[
551
],
[
553
],
[
555
],
[
557
],
[
561,
563
],
[
565
],
[
567
],
[
569
],
[
573,
575
],
[
577
],
[
579
]
]
|
14,856 | static void qmp_input_start_list(Visitor *v, const char *name,
GenericList **list, size_t size, Error **errp)
{
QmpInputVisitor *qiv = to_qiv(v);
QObject *qobj = qmp_input_get_object(qiv, name, true, errp);
const QListEntry *entry;
if (!qobj) {
return;
}
if (qobject_type(qobj) != QTYPE_QLIST) {
if (list) {
*list = NULL;
}
error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
"list");
return;
}
entry = qmp_input_push(qiv, qobj, list, errp);
if (list) {
if (entry) {
*list = g_malloc0(size);
} else {
*list = NULL;
}
}
}
| false | qemu | b3db211f3c80bb996a704d665fe275619f728bd4 | static void qmp_input_start_list(Visitor *v, const char *name,
GenericList **list, size_t size, Error **errp)
{
QmpInputVisitor *qiv = to_qiv(v);
QObject *qobj = qmp_input_get_object(qiv, name, true, errp);
const QListEntry *entry;
if (!qobj) {
return;
}
if (qobject_type(qobj) != QTYPE_QLIST) {
if (list) {
*list = NULL;
}
error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
"list");
return;
}
entry = qmp_input_push(qiv, qobj, list, errp);
if (list) {
if (entry) {
*list = g_malloc0(size);
} else {
*list = NULL;
}
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(Visitor *VAR_0, const char *VAR_1,
GenericList **VAR_2, size_t VAR_3, Error **VAR_4)
{
QmpInputVisitor *qiv = to_qiv(VAR_0);
QObject *qobj = qmp_input_get_object(qiv, VAR_1, true, VAR_4);
const QListEntry *VAR_5;
if (!qobj) {
return;
}
if (qobject_type(qobj) != QTYPE_QLIST) {
if (VAR_2) {
*VAR_2 = NULL;
}
error_setg(VAR_4, QERR_INVALID_PARAMETER_TYPE, VAR_1 ? VAR_1 : "null",
"VAR_2");
return;
}
VAR_5 = qmp_input_push(qiv, qobj, VAR_2, VAR_4);
if (VAR_2) {
if (VAR_5) {
*VAR_2 = g_malloc0(VAR_3);
} else {
*VAR_2 = NULL;
}
}
}
| [
"static void FUNC_0(Visitor *VAR_0, const char *VAR_1,\nGenericList **VAR_2, size_t VAR_3, Error **VAR_4)\n{",
"QmpInputVisitor *qiv = to_qiv(VAR_0);",
"QObject *qobj = qmp_input_get_object(qiv, VAR_1, true, VAR_4);",
"const QListEntry *VAR_5;",
"if (!qobj) {",
"return;",
"}",
"if (qobject_type(qobj) != QTYPE_QLIST) {",
"if (VAR_2) {",
"*VAR_2 = NULL;",
"}",
"error_setg(VAR_4, QERR_INVALID_PARAMETER_TYPE, VAR_1 ? VAR_1 : \"null\",\n\"VAR_2\");",
"return;",
"}",
"VAR_5 = qmp_input_push(qiv, qobj, VAR_2, VAR_4);",
"if (VAR_2) {",
"if (VAR_5) {",
"*VAR_2 = g_malloc0(VAR_3);",
"} else {",
"*VAR_2 = NULL;",
"}",
"}",
"}"
]
| [
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
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
]
]
|
14,857 | static int pci_e1000_init(PCIDevice *pci_dev)
{
E1000State *d = DO_UPCAST(E1000State, dev, pci_dev);
uint8_t *pci_conf;
uint16_t checksum = 0;
int i;
uint8_t *macaddr;
pci_conf = d->dev.config;
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
pci_config_set_device_id(pci_conf, E1000_DEVID);
*(uint16_t *)(pci_conf+0x04) = cpu_to_le16(0x0407);
*(uint16_t *)(pci_conf+0x06) = cpu_to_le16(0x0010);
pci_conf[0x08] = 0x03;
pci_config_set_class(pci_conf, PCI_CLASS_NETWORK_ETHERNET);
pci_conf[0x0c] = 0x10;
pci_conf[0x3d] = 1; // interrupt pin 0
d->mmio_index = cpu_register_io_memory(e1000_mmio_read,
e1000_mmio_write, d);
pci_register_bar((PCIDevice *)d, 0, PNPMMIO_SIZE,
PCI_ADDRESS_SPACE_MEM, e1000_mmio_map);
pci_register_bar((PCIDevice *)d, 1, IOPORT_SIZE,
PCI_ADDRESS_SPACE_IO, ioport_map);
memmove(d->eeprom_data, e1000_eeprom_template,
sizeof e1000_eeprom_template);
qemu_macaddr_default_if_unset(&d->conf.macaddr);
macaddr = d->conf.macaddr.a;
for (i = 0; i < 3; i++)
d->eeprom_data[i] = (macaddr[2*i+1]<<8) | macaddr[2*i];
for (i = 0; i < EEPROM_CHECKSUM_REG; i++)
checksum += d->eeprom_data[i];
checksum = (uint16_t) EEPROM_SUM - checksum;
d->eeprom_data[EEPROM_CHECKSUM_REG] = checksum;
d->vc = qemu_new_vlan_client(NET_CLIENT_TYPE_NIC,
d->conf.vlan, d->conf.peer,
d->dev.qdev.info->name, d->dev.qdev.id,
e1000_can_receive, e1000_receive, NULL,
NULL, e1000_cleanup, d);
d->vc->link_status_changed = e1000_set_link_status;
qemu_format_nic_info_str(d->vc, macaddr);
vmstate_register(-1, &vmstate_e1000, d);
e1000_reset(d);
#if 0 /* rom bev support is broken -> can't load unconditionally */
if (!pci_dev->qdev.hotplugged) {
static int loaded = 0;
if (!loaded) {
rom_add_option("pxe-e1000.bin");
loaded = 1;
}
}
#endif
return 0;
}
| false | qemu | 04095e5ff305fc25a214b52e005153af9d009d66 | static int pci_e1000_init(PCIDevice *pci_dev)
{
E1000State *d = DO_UPCAST(E1000State, dev, pci_dev);
uint8_t *pci_conf;
uint16_t checksum = 0;
int i;
uint8_t *macaddr;
pci_conf = d->dev.config;
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
pci_config_set_device_id(pci_conf, E1000_DEVID);
*(uint16_t *)(pci_conf+0x04) = cpu_to_le16(0x0407);
*(uint16_t *)(pci_conf+0x06) = cpu_to_le16(0x0010);
pci_conf[0x08] = 0x03;
pci_config_set_class(pci_conf, PCI_CLASS_NETWORK_ETHERNET);
pci_conf[0x0c] = 0x10;
pci_conf[0x3d] = 1;
d->mmio_index = cpu_register_io_memory(e1000_mmio_read,
e1000_mmio_write, d);
pci_register_bar((PCIDevice *)d, 0, PNPMMIO_SIZE,
PCI_ADDRESS_SPACE_MEM, e1000_mmio_map);
pci_register_bar((PCIDevice *)d, 1, IOPORT_SIZE,
PCI_ADDRESS_SPACE_IO, ioport_map);
memmove(d->eeprom_data, e1000_eeprom_template,
sizeof e1000_eeprom_template);
qemu_macaddr_default_if_unset(&d->conf.macaddr);
macaddr = d->conf.macaddr.a;
for (i = 0; i < 3; i++)
d->eeprom_data[i] = (macaddr[2*i+1]<<8) | macaddr[2*i];
for (i = 0; i < EEPROM_CHECKSUM_REG; i++)
checksum += d->eeprom_data[i];
checksum = (uint16_t) EEPROM_SUM - checksum;
d->eeprom_data[EEPROM_CHECKSUM_REG] = checksum;
d->vc = qemu_new_vlan_client(NET_CLIENT_TYPE_NIC,
d->conf.vlan, d->conf.peer,
d->dev.qdev.info->name, d->dev.qdev.id,
e1000_can_receive, e1000_receive, NULL,
NULL, e1000_cleanup, d);
d->vc->link_status_changed = e1000_set_link_status;
qemu_format_nic_info_str(d->vc, macaddr);
vmstate_register(-1, &vmstate_e1000, d);
e1000_reset(d);
#if 0
if (!pci_dev->qdev.hotplugged) {
static int loaded = 0;
if (!loaded) {
rom_add_option("pxe-e1000.bin");
loaded = 1;
}
}
#endif
return 0;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(PCIDevice *VAR_0)
{
E1000State *d = DO_UPCAST(E1000State, dev, VAR_0);
uint8_t *pci_conf;
uint16_t checksum = 0;
int VAR_1;
uint8_t *macaddr;
pci_conf = d->dev.config;
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
pci_config_set_device_id(pci_conf, E1000_DEVID);
*(uint16_t *)(pci_conf+0x04) = cpu_to_le16(0x0407);
*(uint16_t *)(pci_conf+0x06) = cpu_to_le16(0x0010);
pci_conf[0x08] = 0x03;
pci_config_set_class(pci_conf, PCI_CLASS_NETWORK_ETHERNET);
pci_conf[0x0c] = 0x10;
pci_conf[0x3d] = 1;
d->mmio_index = cpu_register_io_memory(e1000_mmio_read,
e1000_mmio_write, d);
pci_register_bar((PCIDevice *)d, 0, PNPMMIO_SIZE,
PCI_ADDRESS_SPACE_MEM, e1000_mmio_map);
pci_register_bar((PCIDevice *)d, 1, IOPORT_SIZE,
PCI_ADDRESS_SPACE_IO, ioport_map);
memmove(d->eeprom_data, e1000_eeprom_template,
sizeof e1000_eeprom_template);
qemu_macaddr_default_if_unset(&d->conf.macaddr);
macaddr = d->conf.macaddr.a;
for (VAR_1 = 0; VAR_1 < 3; VAR_1++)
d->eeprom_data[VAR_1] = (macaddr[2*VAR_1+1]<<8) | macaddr[2*VAR_1];
for (VAR_1 = 0; VAR_1 < EEPROM_CHECKSUM_REG; VAR_1++)
checksum += d->eeprom_data[VAR_1];
checksum = (uint16_t) EEPROM_SUM - checksum;
d->eeprom_data[EEPROM_CHECKSUM_REG] = checksum;
d->vc = qemu_new_vlan_client(NET_CLIENT_TYPE_NIC,
d->conf.vlan, d->conf.peer,
d->dev.qdev.info->name, d->dev.qdev.id,
e1000_can_receive, e1000_receive, NULL,
NULL, e1000_cleanup, d);
d->vc->link_status_changed = e1000_set_link_status;
qemu_format_nic_info_str(d->vc, macaddr);
vmstate_register(-1, &vmstate_e1000, d);
e1000_reset(d);
#if 0
if (!VAR_0->qdev.hotplugged) {
static int loaded = 0;
if (!loaded) {
rom_add_option("pxe-e1000.bin");
loaded = 1;
}
}
#endif
return 0;
}
| [
"static int FUNC_0(PCIDevice *VAR_0)\n{",
"E1000State *d = DO_UPCAST(E1000State, dev, VAR_0);",
"uint8_t *pci_conf;",
"uint16_t checksum = 0;",
"int VAR_1;",
"uint8_t *macaddr;",
"pci_conf = d->dev.config;",
"pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);",
"pci_config_set_device_id(pci_conf, E1000_DEVID);",
"*(uint16_t *)(pci_conf+0x04) = cpu_to_le16(0x0407);",
"*(uint16_t *)(pci_conf+0x06) = cpu_to_le16(0x0010);",
"pci_conf[0x08] = 0x03;",
"pci_config_set_class(pci_conf, PCI_CLASS_NETWORK_ETHERNET);",
"pci_conf[0x0c] = 0x10;",
"pci_conf[0x3d] = 1;",
"d->mmio_index = cpu_register_io_memory(e1000_mmio_read,\ne1000_mmio_write, d);",
"pci_register_bar((PCIDevice *)d, 0, PNPMMIO_SIZE,\nPCI_ADDRESS_SPACE_MEM, e1000_mmio_map);",
"pci_register_bar((PCIDevice *)d, 1, IOPORT_SIZE,\nPCI_ADDRESS_SPACE_IO, ioport_map);",
"memmove(d->eeprom_data, e1000_eeprom_template,\nsizeof e1000_eeprom_template);",
"qemu_macaddr_default_if_unset(&d->conf.macaddr);",
"macaddr = d->conf.macaddr.a;",
"for (VAR_1 = 0; VAR_1 < 3; VAR_1++)",
"d->eeprom_data[VAR_1] = (macaddr[2*VAR_1+1]<<8) | macaddr[2*VAR_1];",
"for (VAR_1 = 0; VAR_1 < EEPROM_CHECKSUM_REG; VAR_1++)",
"checksum += d->eeprom_data[VAR_1];",
"checksum = (uint16_t) EEPROM_SUM - checksum;",
"d->eeprom_data[EEPROM_CHECKSUM_REG] = checksum;",
"d->vc = qemu_new_vlan_client(NET_CLIENT_TYPE_NIC,\nd->conf.vlan, d->conf.peer,\nd->dev.qdev.info->name, d->dev.qdev.id,\ne1000_can_receive, e1000_receive, NULL,\nNULL, e1000_cleanup, d);",
"d->vc->link_status_changed = e1000_set_link_status;",
"qemu_format_nic_info_str(d->vc, macaddr);",
"vmstate_register(-1, &vmstate_e1000, d);",
"e1000_reset(d);",
"#if 0\nif (!VAR_0->qdev.hotplugged) {",
"static int loaded = 0;",
"if (!loaded) {",
"rom_add_option(\"pxe-e1000.bin\");",
"loaded = 1;",
"}",
"}",
"#endif\nreturn 0;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
37
],
[
41,
43
],
[
47,
49
],
[
53,
55
],
[
59,
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
81,
83,
85,
87,
89
],
[
91
],
[
95
],
[
99
],
[
101
],
[
105,
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121,
123
],
[
125
]
]
|
14,858 | void qemu_clock_notify(QEMUClockType type)
{
QEMUTimerList *timer_list;
QEMUClock *clock = qemu_clock_ptr(type);
QLIST_FOREACH(timer_list, &clock->timerlists, list) {
timerlist_notify(timer_list);
}
}
| false | qemu | c2b38b277a7882a592f4f2ec955084b2b756daaa | void qemu_clock_notify(QEMUClockType type)
{
QEMUTimerList *timer_list;
QEMUClock *clock = qemu_clock_ptr(type);
QLIST_FOREACH(timer_list, &clock->timerlists, list) {
timerlist_notify(timer_list);
}
}
| {
"code": [],
"line_no": []
} | void FUNC_0(QEMUClockType VAR_0)
{
QEMUTimerList *timer_list;
QEMUClock *clock = qemu_clock_ptr(VAR_0);
QLIST_FOREACH(timer_list, &clock->timerlists, list) {
timerlist_notify(timer_list);
}
}
| [
"void FUNC_0(QEMUClockType VAR_0)\n{",
"QEMUTimerList *timer_list;",
"QEMUClock *clock = qemu_clock_ptr(VAR_0);",
"QLIST_FOREACH(timer_list, &clock->timerlists, list) {",
"timerlist_notify(timer_list);",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
]
]
|
14,859 | static void backward_filter(RA288Context *ractx)
{
float temp1[37]; // RTMP in the spec
float temp2[11]; // GPTPMP in the spec
do_hybrid_window(36, 40, 35, ractx->sp_block, temp1, ractx->sp_hist,
ractx->sp_rec, syn_window);
if (!eval_lpc_coeffs(temp1, ractx->sp_lpc, 36))
colmult(ractx->sp_lpc, ractx->sp_lpc, syn_bw_tab, 36);
do_hybrid_window(10, 8, 20, ractx->gain_block, temp2, ractx->gain_hist,
ractx->gain_rec, gain_window);
if (!eval_lpc_coeffs(temp2, ractx->gain_lpc, 10))
colmult(ractx->gain_lpc, ractx->gain_lpc, gain_bw_tab, 10);
}
| false | FFmpeg | e3751aa6ec8147ab7ca2649d4daadf8d4dce27d5 | static void backward_filter(RA288Context *ractx)
{
float temp1[37];
float temp2[11];
do_hybrid_window(36, 40, 35, ractx->sp_block, temp1, ractx->sp_hist,
ractx->sp_rec, syn_window);
if (!eval_lpc_coeffs(temp1, ractx->sp_lpc, 36))
colmult(ractx->sp_lpc, ractx->sp_lpc, syn_bw_tab, 36);
do_hybrid_window(10, 8, 20, ractx->gain_block, temp2, ractx->gain_hist,
ractx->gain_rec, gain_window);
if (!eval_lpc_coeffs(temp2, ractx->gain_lpc, 10))
colmult(ractx->gain_lpc, ractx->gain_lpc, gain_bw_tab, 10);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(RA288Context *VAR_0)
{
float VAR_1[37];
float VAR_2[11];
do_hybrid_window(36, 40, 35, VAR_0->sp_block, VAR_1, VAR_0->sp_hist,
VAR_0->sp_rec, syn_window);
if (!eval_lpc_coeffs(VAR_1, VAR_0->sp_lpc, 36))
colmult(VAR_0->sp_lpc, VAR_0->sp_lpc, syn_bw_tab, 36);
do_hybrid_window(10, 8, 20, VAR_0->gain_block, VAR_2, VAR_0->gain_hist,
VAR_0->gain_rec, gain_window);
if (!eval_lpc_coeffs(VAR_2, VAR_0->gain_lpc, 10))
colmult(VAR_0->gain_lpc, VAR_0->gain_lpc, gain_bw_tab, 10);
}
| [
"static void FUNC_0(RA288Context *VAR_0)\n{",
"float VAR_1[37];",
"float VAR_2[11];",
"do_hybrid_window(36, 40, 35, VAR_0->sp_block, VAR_1, VAR_0->sp_hist,\nVAR_0->sp_rec, syn_window);",
"if (!eval_lpc_coeffs(VAR_1, VAR_0->sp_lpc, 36))\ncolmult(VAR_0->sp_lpc, VAR_0->sp_lpc, syn_bw_tab, 36);",
"do_hybrid_window(10, 8, 20, VAR_0->gain_block, VAR_2, VAR_0->gain_hist,\nVAR_0->gain_rec, gain_window);",
"if (!eval_lpc_coeffs(VAR_2, VAR_0->gain_lpc, 10))\ncolmult(VAR_0->gain_lpc, VAR_0->gain_lpc, gain_bw_tab, 10);",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
11,
13
],
[
17,
19
],
[
23,
25
],
[
29,
31
],
[
33
]
]
|
14,860 | int target_mprotect(abi_ulong start, abi_ulong len, int prot)
{
abi_ulong end, host_start, host_end, addr;
int prot1, ret;
#ifdef DEBUG_MMAP
printf("mprotect: start=0x" TARGET_FMT_lx
"len=0x" TARGET_FMT_lx " prot=%c%c%c\n", start, len,
prot & PROT_READ ? 'r' : '-',
prot & PROT_WRITE ? 'w' : '-',
prot & PROT_EXEC ? 'x' : '-');
#endif
if ((start & ~TARGET_PAGE_MASK) != 0)
return -EINVAL;
len = TARGET_PAGE_ALIGN(len);
end = start + len;
if (end < start)
return -EINVAL;
if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC))
return -EINVAL;
if (len == 0)
return 0;
host_start = start & qemu_host_page_mask;
host_end = HOST_PAGE_ALIGN(end);
if (start > host_start) {
/* handle host page containing start */
prot1 = prot;
for(addr = host_start; addr < start; addr += TARGET_PAGE_SIZE) {
prot1 |= page_get_flags(addr);
}
if (host_end == host_start + qemu_host_page_size) {
for(addr = end; addr < host_end; addr += TARGET_PAGE_SIZE) {
prot1 |= page_get_flags(addr);
}
end = host_end;
}
ret = mprotect(g2h(host_start), qemu_host_page_size, prot1 & PAGE_BITS);
if (ret != 0)
return ret;
host_start += qemu_host_page_size;
}
if (end < host_end) {
prot1 = prot;
for(addr = end; addr < host_end; addr += TARGET_PAGE_SIZE) {
prot1 |= page_get_flags(addr);
}
ret = mprotect(g2h(host_end - qemu_host_page_size), qemu_host_page_size,
prot1 & PAGE_BITS);
if (ret != 0)
return ret;
host_end -= qemu_host_page_size;
}
/* handle the pages in the middle */
if (host_start < host_end) {
ret = mprotect(g2h(host_start), host_end - host_start, prot);
if (ret != 0)
return ret;
}
page_set_flags(start, start + len, prot | PAGE_VALID);
return 0;
}
| false | qemu | 171cd1cdfff32a99855ec80ca8cab43384fe0600 | int target_mprotect(abi_ulong start, abi_ulong len, int prot)
{
abi_ulong end, host_start, host_end, addr;
int prot1, ret;
#ifdef DEBUG_MMAP
printf("mprotect: start=0x" TARGET_FMT_lx
"len=0x" TARGET_FMT_lx " prot=%c%c%c\n", start, len,
prot & PROT_READ ? 'r' : '-',
prot & PROT_WRITE ? 'w' : '-',
prot & PROT_EXEC ? 'x' : '-');
#endif
if ((start & ~TARGET_PAGE_MASK) != 0)
return -EINVAL;
len = TARGET_PAGE_ALIGN(len);
end = start + len;
if (end < start)
return -EINVAL;
if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC))
return -EINVAL;
if (len == 0)
return 0;
host_start = start & qemu_host_page_mask;
host_end = HOST_PAGE_ALIGN(end);
if (start > host_start) {
prot1 = prot;
for(addr = host_start; addr < start; addr += TARGET_PAGE_SIZE) {
prot1 |= page_get_flags(addr);
}
if (host_end == host_start + qemu_host_page_size) {
for(addr = end; addr < host_end; addr += TARGET_PAGE_SIZE) {
prot1 |= page_get_flags(addr);
}
end = host_end;
}
ret = mprotect(g2h(host_start), qemu_host_page_size, prot1 & PAGE_BITS);
if (ret != 0)
return ret;
host_start += qemu_host_page_size;
}
if (end < host_end) {
prot1 = prot;
for(addr = end; addr < host_end; addr += TARGET_PAGE_SIZE) {
prot1 |= page_get_flags(addr);
}
ret = mprotect(g2h(host_end - qemu_host_page_size), qemu_host_page_size,
prot1 & PAGE_BITS);
if (ret != 0)
return ret;
host_end -= qemu_host_page_size;
}
if (host_start < host_end) {
ret = mprotect(g2h(host_start), host_end - host_start, prot);
if (ret != 0)
return ret;
}
page_set_flags(start, start + len, prot | PAGE_VALID);
return 0;
}
| {
"code": [],
"line_no": []
} | int FUNC_0(abi_ulong VAR_0, abi_ulong VAR_1, int VAR_2)
{
abi_ulong end, host_start, host_end, addr;
int VAR_3, VAR_4;
#ifdef DEBUG_MMAP
printf("mprotect: VAR_0=0x" TARGET_FMT_lx
"VAR_1=0x" TARGET_FMT_lx " VAR_2=%c%c%c\n", VAR_0, VAR_1,
VAR_2 & PROT_READ ? 'r' : '-',
VAR_2 & PROT_WRITE ? 'w' : '-',
VAR_2 & PROT_EXEC ? 'x' : '-');
#endif
if ((VAR_0 & ~TARGET_PAGE_MASK) != 0)
return -EINVAL;
VAR_1 = TARGET_PAGE_ALIGN(VAR_1);
end = VAR_0 + VAR_1;
if (end < VAR_0)
return -EINVAL;
if (VAR_2 & ~(PROT_READ | PROT_WRITE | PROT_EXEC))
return -EINVAL;
if (VAR_1 == 0)
return 0;
host_start = VAR_0 & qemu_host_page_mask;
host_end = HOST_PAGE_ALIGN(end);
if (VAR_0 > host_start) {
VAR_3 = VAR_2;
for(addr = host_start; addr < VAR_0; addr += TARGET_PAGE_SIZE) {
VAR_3 |= page_get_flags(addr);
}
if (host_end == host_start + qemu_host_page_size) {
for(addr = end; addr < host_end; addr += TARGET_PAGE_SIZE) {
VAR_3 |= page_get_flags(addr);
}
end = host_end;
}
VAR_4 = mprotect(g2h(host_start), qemu_host_page_size, VAR_3 & PAGE_BITS);
if (VAR_4 != 0)
return VAR_4;
host_start += qemu_host_page_size;
}
if (end < host_end) {
VAR_3 = VAR_2;
for(addr = end; addr < host_end; addr += TARGET_PAGE_SIZE) {
VAR_3 |= page_get_flags(addr);
}
VAR_4 = mprotect(g2h(host_end - qemu_host_page_size), qemu_host_page_size,
VAR_3 & PAGE_BITS);
if (VAR_4 != 0)
return VAR_4;
host_end -= qemu_host_page_size;
}
if (host_start < host_end) {
VAR_4 = mprotect(g2h(host_start), host_end - host_start, VAR_2);
if (VAR_4 != 0)
return VAR_4;
}
page_set_flags(VAR_0, VAR_0 + VAR_1, VAR_2 | PAGE_VALID);
return 0;
}
| [
"int FUNC_0(abi_ulong VAR_0, abi_ulong VAR_1, int VAR_2)\n{",
"abi_ulong end, host_start, host_end, addr;",
"int VAR_3, VAR_4;",
"#ifdef DEBUG_MMAP\nprintf(\"mprotect: VAR_0=0x\" TARGET_FMT_lx\n\"VAR_1=0x\" TARGET_FMT_lx \" VAR_2=%c%c%c\\n\", VAR_0, VAR_1,\nVAR_2 & PROT_READ ? 'r' : '-',\nVAR_2 & PROT_WRITE ? 'w' : '-',\nVAR_2 & PROT_EXEC ? 'x' : '-');",
"#endif\nif ((VAR_0 & ~TARGET_PAGE_MASK) != 0)\nreturn -EINVAL;",
"VAR_1 = TARGET_PAGE_ALIGN(VAR_1);",
"end = VAR_0 + VAR_1;",
"if (end < VAR_0)\nreturn -EINVAL;",
"if (VAR_2 & ~(PROT_READ | PROT_WRITE | PROT_EXEC))\nreturn -EINVAL;",
"if (VAR_1 == 0)\nreturn 0;",
"host_start = VAR_0 & qemu_host_page_mask;",
"host_end = HOST_PAGE_ALIGN(end);",
"if (VAR_0 > host_start) {",
"VAR_3 = VAR_2;",
"for(addr = host_start; addr < VAR_0; addr += TARGET_PAGE_SIZE) {",
"VAR_3 |= page_get_flags(addr);",
"}",
"if (host_end == host_start + qemu_host_page_size) {",
"for(addr = end; addr < host_end; addr += TARGET_PAGE_SIZE) {",
"VAR_3 |= page_get_flags(addr);",
"}",
"end = host_end;",
"}",
"VAR_4 = mprotect(g2h(host_start), qemu_host_page_size, VAR_3 & PAGE_BITS);",
"if (VAR_4 != 0)\nreturn VAR_4;",
"host_start += qemu_host_page_size;",
"}",
"if (end < host_end) {",
"VAR_3 = VAR_2;",
"for(addr = end; addr < host_end; addr += TARGET_PAGE_SIZE) {",
"VAR_3 |= page_get_flags(addr);",
"}",
"VAR_4 = mprotect(g2h(host_end - qemu_host_page_size), qemu_host_page_size,\nVAR_3 & PAGE_BITS);",
"if (VAR_4 != 0)\nreturn VAR_4;",
"host_end -= qemu_host_page_size;",
"}",
"if (host_start < host_end) {",
"VAR_4 = mprotect(g2h(host_start), host_end - host_start, VAR_2);",
"if (VAR_4 != 0)\nreturn VAR_4;",
"}",
"page_set_flags(VAR_0, VAR_0 + VAR_1, VAR_2 | PAGE_VALID);",
"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
]
| [
[
1,
3
],
[
5
],
[
7
],
[
11,
13,
15,
17,
19,
21
],
[
23,
27,
29
],
[
31
],
[
33
],
[
35,
37
],
[
39,
41
],
[
43,
45
],
[
49
],
[
51
],
[
53
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79,
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97,
99
],
[
101,
103
],
[
105
],
[
107
],
[
113
],
[
115
],
[
117,
119
],
[
121
],
[
123
],
[
125
],
[
127
]
]
|
14,861 | static int local_open(FsContext *ctx, V9fsPath *fs_path,
int flags, V9fsFidOpenState *fs)
{
char buffer[PATH_MAX];
char *path = fs_path->data;
fs->fd = open(rpath(ctx, path, buffer), flags | O_NOFOLLOW);
return fs->fd;
}
| false | qemu | 4fa4ce7107c6ec432f185307158c5df91ce54308 | static int local_open(FsContext *ctx, V9fsPath *fs_path,
int flags, V9fsFidOpenState *fs)
{
char buffer[PATH_MAX];
char *path = fs_path->data;
fs->fd = open(rpath(ctx, path, buffer), flags | O_NOFOLLOW);
return fs->fd;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1,
int VAR_2, V9fsFidOpenState *VAR_3)
{
char VAR_4[PATH_MAX];
char *VAR_5 = VAR_1->data;
VAR_3->fd = open(rpath(VAR_0, VAR_5, VAR_4), VAR_2 | O_NOFOLLOW);
return VAR_3->fd;
}
| [
"static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1,\nint VAR_2, V9fsFidOpenState *VAR_3)\n{",
"char VAR_4[PATH_MAX];",
"char *VAR_5 = VAR_1->data;",
"VAR_3->fd = open(rpath(VAR_0, VAR_5, VAR_4), VAR_2 | O_NOFOLLOW);",
"return VAR_3->fd;",
"}"
]
| [
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
17
]
]
|
14,862 | void qmp_block_commit(const char *device,
bool has_base, const char *base,
bool has_top, const char *top,
bool has_backing_file, const char *backing_file,
bool has_speed, int64_t speed,
Error **errp)
{
BlockDriverState *bs;
BlockDriverState *base_bs, *top_bs;
Error *local_err = NULL;
/* This will be part of the QMP command, if/when the
* BlockdevOnError change for blkmirror makes it in
*/
BlockdevOnError on_error = BLOCKDEV_ON_ERROR_REPORT;
if (!has_speed) {
speed = 0;
}
/* drain all i/o before commits */
bdrv_drain_all();
/* Important Note:
* libvirt relies on the DeviceNotFound error class in order to probe for
* live commit feature versions; for this to work, we must make sure to
* perform the device lookup before any generic errors that may occur in a
* scenario in which all optional arguments are omitted. */
bs = bdrv_find(device);
if (!bs) {
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
return;
}
if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_COMMIT, errp)) {
return;
}
/* default top_bs is the active layer */
top_bs = bs;
if (has_top && top) {
if (strcmp(bs->filename, top) != 0) {
top_bs = bdrv_find_backing_image(bs, top);
}
}
if (top_bs == NULL) {
error_setg(errp, "Top image file %s not found", top ? top : "NULL");
return;
}
if (has_base && base) {
base_bs = bdrv_find_backing_image(top_bs, base);
} else {
base_bs = bdrv_find_base(top_bs);
}
if (base_bs == NULL) {
error_set(errp, QERR_BASE_NOT_FOUND, base ? base : "NULL");
return;
}
/* Do not allow attempts to commit an image into itself */
if (top_bs == base_bs) {
error_setg(errp, "cannot commit an image into itself");
return;
}
if (top_bs == bs) {
if (has_backing_file) {
error_setg(errp, "'backing-file' specified,"
" but 'top' is the active layer");
return;
}
commit_active_start(bs, base_bs, speed, on_error, block_job_cb,
bs, &local_err);
} else {
commit_start(bs, base_bs, top_bs, speed, on_error, block_job_cb, bs,
has_backing_file ? backing_file : NULL, &local_err);
}
if (local_err != NULL) {
error_propagate(errp, local_err);
return;
}
}
| false | qemu | 9e85cd5ce0d3fc99d910428c9fd9d267764d341b | void qmp_block_commit(const char *device,
bool has_base, const char *base,
bool has_top, const char *top,
bool has_backing_file, const char *backing_file,
bool has_speed, int64_t speed,
Error **errp)
{
BlockDriverState *bs;
BlockDriverState *base_bs, *top_bs;
Error *local_err = NULL;
BlockdevOnError on_error = BLOCKDEV_ON_ERROR_REPORT;
if (!has_speed) {
speed = 0;
}
bdrv_drain_all();
bs = bdrv_find(device);
if (!bs) {
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
return;
}
if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_COMMIT, errp)) {
return;
}
top_bs = bs;
if (has_top && top) {
if (strcmp(bs->filename, top) != 0) {
top_bs = bdrv_find_backing_image(bs, top);
}
}
if (top_bs == NULL) {
error_setg(errp, "Top image file %s not found", top ? top : "NULL");
return;
}
if (has_base && base) {
base_bs = bdrv_find_backing_image(top_bs, base);
} else {
base_bs = bdrv_find_base(top_bs);
}
if (base_bs == NULL) {
error_set(errp, QERR_BASE_NOT_FOUND, base ? base : "NULL");
return;
}
if (top_bs == base_bs) {
error_setg(errp, "cannot commit an image into itself");
return;
}
if (top_bs == bs) {
if (has_backing_file) {
error_setg(errp, "'backing-file' specified,"
" but 'top' is the active layer");
return;
}
commit_active_start(bs, base_bs, speed, on_error, block_job_cb,
bs, &local_err);
} else {
commit_start(bs, base_bs, top_bs, speed, on_error, block_job_cb, bs,
has_backing_file ? backing_file : NULL, &local_err);
}
if (local_err != NULL) {
error_propagate(errp, local_err);
return;
}
}
| {
"code": [],
"line_no": []
} | void FUNC_0(const char *VAR_0,
bool VAR_1, const char *VAR_2,
bool VAR_3, const char *VAR_4,
bool VAR_5, const char *VAR_6,
bool VAR_7, int64_t VAR_8,
Error **VAR_9)
{
BlockDriverState *bs;
BlockDriverState *base_bs, *top_bs;
Error *local_err = NULL;
BlockdevOnError on_error = BLOCKDEV_ON_ERROR_REPORT;
if (!VAR_7) {
VAR_8 = 0;
}
bdrv_drain_all();
bs = bdrv_find(VAR_0);
if (!bs) {
error_set(VAR_9, QERR_DEVICE_NOT_FOUND, VAR_0);
return;
}
if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_COMMIT, VAR_9)) {
return;
}
top_bs = bs;
if (VAR_3 && VAR_4) {
if (strcmp(bs->filename, VAR_4) != 0) {
top_bs = bdrv_find_backing_image(bs, VAR_4);
}
}
if (top_bs == NULL) {
error_setg(VAR_9, "Top image file %s not found", VAR_4 ? VAR_4 : "NULL");
return;
}
if (VAR_1 && VAR_2) {
base_bs = bdrv_find_backing_image(top_bs, VAR_2);
} else {
base_bs = bdrv_find_base(top_bs);
}
if (base_bs == NULL) {
error_set(VAR_9, QERR_BASE_NOT_FOUND, VAR_2 ? VAR_2 : "NULL");
return;
}
if (top_bs == base_bs) {
error_setg(VAR_9, "cannot commit an image into itself");
return;
}
if (top_bs == bs) {
if (VAR_5) {
error_setg(VAR_9, "'backing-file' specified,"
" but 'VAR_4' is the active layer");
return;
}
commit_active_start(bs, base_bs, VAR_8, on_error, block_job_cb,
bs, &local_err);
} else {
commit_start(bs, base_bs, top_bs, VAR_8, on_error, block_job_cb, bs,
VAR_5 ? VAR_6 : NULL, &local_err);
}
if (local_err != NULL) {
error_propagate(VAR_9, local_err);
return;
}
}
| [
"void FUNC_0(const char *VAR_0,\nbool VAR_1, const char *VAR_2,\nbool VAR_3, const char *VAR_4,\nbool VAR_5, const char *VAR_6,\nbool VAR_7, int64_t VAR_8,\nError **VAR_9)\n{",
"BlockDriverState *bs;",
"BlockDriverState *base_bs, *top_bs;",
"Error *local_err = NULL;",
"BlockdevOnError on_error = BLOCKDEV_ON_ERROR_REPORT;",
"if (!VAR_7) {",
"VAR_8 = 0;",
"}",
"bdrv_drain_all();",
"bs = bdrv_find(VAR_0);",
"if (!bs) {",
"error_set(VAR_9, QERR_DEVICE_NOT_FOUND, VAR_0);",
"return;",
"}",
"if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_COMMIT, VAR_9)) {",
"return;",
"}",
"top_bs = bs;",
"if (VAR_3 && VAR_4) {",
"if (strcmp(bs->filename, VAR_4) != 0) {",
"top_bs = bdrv_find_backing_image(bs, VAR_4);",
"}",
"}",
"if (top_bs == NULL) {",
"error_setg(VAR_9, \"Top image file %s not found\", VAR_4 ? VAR_4 : \"NULL\");",
"return;",
"}",
"if (VAR_1 && VAR_2) {",
"base_bs = bdrv_find_backing_image(top_bs, VAR_2);",
"} else {",
"base_bs = bdrv_find_base(top_bs);",
"}",
"if (base_bs == NULL) {",
"error_set(VAR_9, QERR_BASE_NOT_FOUND, VAR_2 ? VAR_2 : \"NULL\");",
"return;",
"}",
"if (top_bs == base_bs) {",
"error_setg(VAR_9, \"cannot commit an image into itself\");",
"return;",
"}",
"if (top_bs == bs) {",
"if (VAR_5) {",
"error_setg(VAR_9, \"'backing-file' specified,\"\n\" but 'VAR_4' is the active layer\");",
"return;",
"}",
"commit_active_start(bs, base_bs, VAR_8, on_error, block_job_cb,\nbs, &local_err);",
"} else {",
"commit_start(bs, base_bs, top_bs, VAR_8, on_error, block_job_cb, bs,\nVAR_5 ? VAR_6 : NULL, &local_err);",
"}",
"if (local_err != NULL) {",
"error_propagate(VAR_9, local_err);",
"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
]
| [
[
1,
3,
5,
7,
9,
11,
13
],
[
15
],
[
17
],
[
19
],
[
27
],
[
31
],
[
33
],
[
35
],
[
41
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
67
],
[
69
],
[
71
],
[
77
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
93
],
[
95
],
[
97
],
[
99
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
115
],
[
117
],
[
119
],
[
121
],
[
127
],
[
129
],
[
131
],
[
133
],
[
137
],
[
139
],
[
141,
143
],
[
145
],
[
147
],
[
149,
151
],
[
153
],
[
155,
157
],
[
159
],
[
161
],
[
163
],
[
165
],
[
167
],
[
169
]
]
|
14,863 | void do_commit(Monitor *mon, const QDict *qdict)
{
const char *device = qdict_get_str(qdict, "device");
BlockDriverState *bs;
if (!strcmp(device, "all")) {
bdrv_commit_all();
} else {
bs = bdrv_find(device);
if (!bs) {
qerror_report(QERR_DEVICE_NOT_FOUND, device);
return;
}
bdrv_commit(bs);
}
}
| false | qemu | 2d3735d3bf61d5c8e154a197a11535cc65044334 | void do_commit(Monitor *mon, const QDict *qdict)
{
const char *device = qdict_get_str(qdict, "device");
BlockDriverState *bs;
if (!strcmp(device, "all")) {
bdrv_commit_all();
} else {
bs = bdrv_find(device);
if (!bs) {
qerror_report(QERR_DEVICE_NOT_FOUND, device);
return;
}
bdrv_commit(bs);
}
}
| {
"code": [],
"line_no": []
} | void FUNC_0(Monitor *VAR_0, const QDict *VAR_1)
{
const char *VAR_2 = qdict_get_str(VAR_1, "VAR_2");
BlockDriverState *bs;
if (!strcmp(VAR_2, "all")) {
bdrv_commit_all();
} else {
bs = bdrv_find(VAR_2);
if (!bs) {
qerror_report(QERR_DEVICE_NOT_FOUND, VAR_2);
return;
}
bdrv_commit(bs);
}
}
| [
"void FUNC_0(Monitor *VAR_0, const QDict *VAR_1)\n{",
"const char *VAR_2 = qdict_get_str(VAR_1, \"VAR_2\");",
"BlockDriverState *bs;",
"if (!strcmp(VAR_2, \"all\")) {",
"bdrv_commit_all();",
"} else {",
"bs = bdrv_find(VAR_2);",
"if (!bs) {",
"qerror_report(QERR_DEVICE_NOT_FOUND, VAR_2);",
"return;",
"}",
"bdrv_commit(bs);",
"}",
"}"
]
| [
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
]
]
|
14,864 | static QmpOutputVisitor *to_qov(Visitor *v)
{
return container_of(v, QmpOutputVisitor, visitor);
}
| false | qemu | b3db211f3c80bb996a704d665fe275619f728bd4 | static QmpOutputVisitor *to_qov(Visitor *v)
{
return container_of(v, QmpOutputVisitor, visitor);
}
| {
"code": [],
"line_no": []
} | static QmpOutputVisitor *FUNC_0(Visitor *v)
{
return container_of(v, QmpOutputVisitor, visitor);
}
| [
"static QmpOutputVisitor *FUNC_0(Visitor *v)\n{",
"return container_of(v, QmpOutputVisitor, visitor);",
"}"
]
| [
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
]
]
|
14,866 | static void vc1_inv_trans_8x8_c(DCTELEM block[64])
{
int i;
register int t1,t2,t3,t4,t5,t6,t7,t8;
DCTELEM *src, *dst, temp[64];
src = block;
dst = temp;
for(i = 0; i < 8; i++){
t1 = 12 * (src[ 0] + src[32]) + 4;
t2 = 12 * (src[ 0] - src[32]) + 4;
t3 = 16 * src[16] + 6 * src[48];
t4 = 6 * src[16] - 16 * src[48];
t5 = t1 + t3;
t6 = t2 + t4;
t7 = t2 - t4;
t8 = t1 - t3;
t1 = 16 * src[ 8] + 15 * src[24] + 9 * src[40] + 4 * src[56];
t2 = 15 * src[ 8] - 4 * src[24] - 16 * src[40] - 9 * src[56];
t3 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56];
t4 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56];
dst[0] = (t5 + t1) >> 3;
dst[1] = (t6 + t2) >> 3;
dst[2] = (t7 + t3) >> 3;
dst[3] = (t8 + t4) >> 3;
dst[4] = (t8 - t4) >> 3;
dst[5] = (t7 - t3) >> 3;
dst[6] = (t6 - t2) >> 3;
dst[7] = (t5 - t1) >> 3;
src += 1;
dst += 8;
}
src = temp;
dst = block;
for(i = 0; i < 8; i++){
t1 = 12 * (src[ 0] + src[32]) + 64;
t2 = 12 * (src[ 0] - src[32]) + 64;
t3 = 16 * src[16] + 6 * src[48];
t4 = 6 * src[16] - 16 * src[48];
t5 = t1 + t3;
t6 = t2 + t4;
t7 = t2 - t4;
t8 = t1 - t3;
t1 = 16 * src[ 8] + 15 * src[24] + 9 * src[40] + 4 * src[56];
t2 = 15 * src[ 8] - 4 * src[24] - 16 * src[40] - 9 * src[56];
t3 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56];
t4 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56];
dst[ 0] = (t5 + t1) >> 7;
dst[ 8] = (t6 + t2) >> 7;
dst[16] = (t7 + t3) >> 7;
dst[24] = (t8 + t4) >> 7;
dst[32] = (t8 - t4 + 1) >> 7;
dst[40] = (t7 - t3 + 1) >> 7;
dst[48] = (t6 - t2 + 1) >> 7;
dst[56] = (t5 - t1 + 1) >> 7;
src++;
dst++;
}
}
| false | FFmpeg | 6a786b15c34765ec00be3cd808dafbb041fd5881 | static void vc1_inv_trans_8x8_c(DCTELEM block[64])
{
int i;
register int t1,t2,t3,t4,t5,t6,t7,t8;
DCTELEM *src, *dst, temp[64];
src = block;
dst = temp;
for(i = 0; i < 8; i++){
t1 = 12 * (src[ 0] + src[32]) + 4;
t2 = 12 * (src[ 0] - src[32]) + 4;
t3 = 16 * src[16] + 6 * src[48];
t4 = 6 * src[16] - 16 * src[48];
t5 = t1 + t3;
t6 = t2 + t4;
t7 = t2 - t4;
t8 = t1 - t3;
t1 = 16 * src[ 8] + 15 * src[24] + 9 * src[40] + 4 * src[56];
t2 = 15 * src[ 8] - 4 * src[24] - 16 * src[40] - 9 * src[56];
t3 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56];
t4 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56];
dst[0] = (t5 + t1) >> 3;
dst[1] = (t6 + t2) >> 3;
dst[2] = (t7 + t3) >> 3;
dst[3] = (t8 + t4) >> 3;
dst[4] = (t8 - t4) >> 3;
dst[5] = (t7 - t3) >> 3;
dst[6] = (t6 - t2) >> 3;
dst[7] = (t5 - t1) >> 3;
src += 1;
dst += 8;
}
src = temp;
dst = block;
for(i = 0; i < 8; i++){
t1 = 12 * (src[ 0] + src[32]) + 64;
t2 = 12 * (src[ 0] - src[32]) + 64;
t3 = 16 * src[16] + 6 * src[48];
t4 = 6 * src[16] - 16 * src[48];
t5 = t1 + t3;
t6 = t2 + t4;
t7 = t2 - t4;
t8 = t1 - t3;
t1 = 16 * src[ 8] + 15 * src[24] + 9 * src[40] + 4 * src[56];
t2 = 15 * src[ 8] - 4 * src[24] - 16 * src[40] - 9 * src[56];
t3 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56];
t4 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56];
dst[ 0] = (t5 + t1) >> 7;
dst[ 8] = (t6 + t2) >> 7;
dst[16] = (t7 + t3) >> 7;
dst[24] = (t8 + t4) >> 7;
dst[32] = (t8 - t4 + 1) >> 7;
dst[40] = (t7 - t3 + 1) >> 7;
dst[48] = (t6 - t2 + 1) >> 7;
dst[56] = (t5 - t1 + 1) >> 7;
src++;
dst++;
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(DCTELEM VAR_0[64])
{
int VAR_1;
register int VAR_2,VAR_3,VAR_4,VAR_5,VAR_6,VAR_7,VAR_8,VAR_9;
DCTELEM *src, *dst, temp[64];
src = VAR_0;
dst = temp;
for(VAR_1 = 0; VAR_1 < 8; VAR_1++){
VAR_2 = 12 * (src[ 0] + src[32]) + 4;
VAR_3 = 12 * (src[ 0] - src[32]) + 4;
VAR_4 = 16 * src[16] + 6 * src[48];
VAR_5 = 6 * src[16] - 16 * src[48];
VAR_6 = VAR_2 + VAR_4;
VAR_7 = VAR_3 + VAR_5;
VAR_8 = VAR_3 - VAR_5;
VAR_9 = VAR_2 - VAR_4;
VAR_2 = 16 * src[ 8] + 15 * src[24] + 9 * src[40] + 4 * src[56];
VAR_3 = 15 * src[ 8] - 4 * src[24] - 16 * src[40] - 9 * src[56];
VAR_4 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56];
VAR_5 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56];
dst[0] = (VAR_6 + VAR_2) >> 3;
dst[1] = (VAR_7 + VAR_3) >> 3;
dst[2] = (VAR_8 + VAR_4) >> 3;
dst[3] = (VAR_9 + VAR_5) >> 3;
dst[4] = (VAR_9 - VAR_5) >> 3;
dst[5] = (VAR_8 - VAR_4) >> 3;
dst[6] = (VAR_7 - VAR_3) >> 3;
dst[7] = (VAR_6 - VAR_2) >> 3;
src += 1;
dst += 8;
}
src = temp;
dst = VAR_0;
for(VAR_1 = 0; VAR_1 < 8; VAR_1++){
VAR_2 = 12 * (src[ 0] + src[32]) + 64;
VAR_3 = 12 * (src[ 0] - src[32]) + 64;
VAR_4 = 16 * src[16] + 6 * src[48];
VAR_5 = 6 * src[16] - 16 * src[48];
VAR_6 = VAR_2 + VAR_4;
VAR_7 = VAR_3 + VAR_5;
VAR_8 = VAR_3 - VAR_5;
VAR_9 = VAR_2 - VAR_4;
VAR_2 = 16 * src[ 8] + 15 * src[24] + 9 * src[40] + 4 * src[56];
VAR_3 = 15 * src[ 8] - 4 * src[24] - 16 * src[40] - 9 * src[56];
VAR_4 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56];
VAR_5 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56];
dst[ 0] = (VAR_6 + VAR_2) >> 7;
dst[ 8] = (VAR_7 + VAR_3) >> 7;
dst[16] = (VAR_8 + VAR_4) >> 7;
dst[24] = (VAR_9 + VAR_5) >> 7;
dst[32] = (VAR_9 - VAR_5 + 1) >> 7;
dst[40] = (VAR_8 - VAR_4 + 1) >> 7;
dst[48] = (VAR_7 - VAR_3 + 1) >> 7;
dst[56] = (VAR_6 - VAR_2 + 1) >> 7;
src++;
dst++;
}
}
| [
"static void FUNC_0(DCTELEM VAR_0[64])\n{",
"int VAR_1;",
"register int VAR_2,VAR_3,VAR_4,VAR_5,VAR_6,VAR_7,VAR_8,VAR_9;",
"DCTELEM *src, *dst, temp[64];",
"src = VAR_0;",
"dst = temp;",
"for(VAR_1 = 0; VAR_1 < 8; VAR_1++){",
"VAR_2 = 12 * (src[ 0] + src[32]) + 4;",
"VAR_3 = 12 * (src[ 0] - src[32]) + 4;",
"VAR_4 = 16 * src[16] + 6 * src[48];",
"VAR_5 = 6 * src[16] - 16 * src[48];",
"VAR_6 = VAR_2 + VAR_4;",
"VAR_7 = VAR_3 + VAR_5;",
"VAR_8 = VAR_3 - VAR_5;",
"VAR_9 = VAR_2 - VAR_4;",
"VAR_2 = 16 * src[ 8] + 15 * src[24] + 9 * src[40] + 4 * src[56];",
"VAR_3 = 15 * src[ 8] - 4 * src[24] - 16 * src[40] - 9 * src[56];",
"VAR_4 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56];",
"VAR_5 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56];",
"dst[0] = (VAR_6 + VAR_2) >> 3;",
"dst[1] = (VAR_7 + VAR_3) >> 3;",
"dst[2] = (VAR_8 + VAR_4) >> 3;",
"dst[3] = (VAR_9 + VAR_5) >> 3;",
"dst[4] = (VAR_9 - VAR_5) >> 3;",
"dst[5] = (VAR_8 - VAR_4) >> 3;",
"dst[6] = (VAR_7 - VAR_3) >> 3;",
"dst[7] = (VAR_6 - VAR_2) >> 3;",
"src += 1;",
"dst += 8;",
"}",
"src = temp;",
"dst = VAR_0;",
"for(VAR_1 = 0; VAR_1 < 8; VAR_1++){",
"VAR_2 = 12 * (src[ 0] + src[32]) + 64;",
"VAR_3 = 12 * (src[ 0] - src[32]) + 64;",
"VAR_4 = 16 * src[16] + 6 * src[48];",
"VAR_5 = 6 * src[16] - 16 * src[48];",
"VAR_6 = VAR_2 + VAR_4;",
"VAR_7 = VAR_3 + VAR_5;",
"VAR_8 = VAR_3 - VAR_5;",
"VAR_9 = VAR_2 - VAR_4;",
"VAR_2 = 16 * src[ 8] + 15 * src[24] + 9 * src[40] + 4 * src[56];",
"VAR_3 = 15 * src[ 8] - 4 * src[24] - 16 * src[40] - 9 * src[56];",
"VAR_4 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56];",
"VAR_5 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56];",
"dst[ 0] = (VAR_6 + VAR_2) >> 7;",
"dst[ 8] = (VAR_7 + VAR_3) >> 7;",
"dst[16] = (VAR_8 + VAR_4) >> 7;",
"dst[24] = (VAR_9 + VAR_5) >> 7;",
"dst[32] = (VAR_9 - VAR_5 + 1) >> 7;",
"dst[40] = (VAR_8 - VAR_4 + 1) >> 7;",
"dst[48] = (VAR_7 - VAR_3 + 1) >> 7;",
"dst[56] = (VAR_6 - VAR_2 + 1) >> 7;",
"src++;",
"dst++;",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
29
],
[
31
],
[
33
],
[
35
],
[
39
],
[
41
],
[
43
],
[
45
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
67
],
[
69
],
[
71
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
91
],
[
93
],
[
95
],
[
97
],
[
101
],
[
103
],
[
105
],
[
107
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
129
],
[
131
],
[
133
],
[
135
]
]
|
14,867 | static void avc_loopfilter_luma_intra_edge_ver_msa(uint8_t *data,
uint8_t alpha_in,
uint8_t beta_in,
uint32_t img_width)
{
uint8_t *src;
v16u8 alpha, beta, p0_asub_q0;
v16u8 is_less_than_alpha, is_less_than;
v16u8 is_less_than_beta, negate_is_less_than_beta;
v8i16 p2_r = { 0 };
v8i16 p1_r = { 0 };
v8i16 p0_r = { 0 };
v8i16 q0_r = { 0 };
v8i16 q1_r = { 0 };
v8i16 q2_r = { 0 };
v8i16 p2_l = { 0 };
v8i16 p1_l = { 0 };
v8i16 p0_l = { 0 };
v8i16 q0_l = { 0 };
v8i16 q1_l = { 0 };
v8i16 q2_l = { 0 };
v16u8 p3_org, p2_org, p1_org, p0_org, q0_org, q1_org, q2_org, q3_org;
v8i16 p1_org_r, p0_org_r, q0_org_r, q1_org_r;
v8i16 p1_org_l, p0_org_l, q0_org_l, q1_org_l;
v16i8 zero = { 0 };
v16u8 tmp_flag;
src = data - 4;
{
v16u8 row0, row1, row2, row3, row4, row5, row6, row7;
v16u8 row8, row9, row10, row11, row12, row13, row14, row15;
LOAD_8VECS_UB(src, img_width,
row0, row1, row2, row3, row4, row5, row6, row7);
LOAD_8VECS_UB(src + (8 * img_width), img_width,
row8, row9, row10, row11, row12, row13, row14, row15);
TRANSPOSE16x8_B_UB(row0, row1, row2, row3, row4, row5, row6, row7,
row8, row9, row10, row11, row12, row13, row14, row15,
p3_org, p2_org, p1_org, p0_org,
q0_org, q1_org, q2_org, q3_org);
}
p1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p1_org);
p0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p0_org);
q0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q0_org);
q1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q1_org);
p1_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p1_org);
p0_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p0_org);
q0_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q0_org);
q1_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q1_org);
/* if ( ((unsigned)ABS(p0-q0) < thresholds->alpha_in) &&
((unsigned)ABS(p1-p0) < thresholds->beta_in) &&
((unsigned)ABS(q1-q0) < thresholds->beta_in) ) */
{
v16u8 p1_asub_p0, q1_asub_q0;
p0_asub_q0 = __msa_asub_u_b(p0_org, q0_org);
p1_asub_p0 = __msa_asub_u_b(p1_org, p0_org);
q1_asub_q0 = __msa_asub_u_b(q1_org, q0_org);
alpha = (v16u8) __msa_fill_b(alpha_in);
beta = (v16u8) __msa_fill_b(beta_in);
is_less_than_alpha = (p0_asub_q0 < alpha);
is_less_than_beta = (p1_asub_p0 < beta);
is_less_than = is_less_than_beta & is_less_than_alpha;
is_less_than_beta = (q1_asub_q0 < beta);
is_less_than = is_less_than_beta & is_less_than;
}
if (!__msa_test_bz_v(is_less_than)) {
tmp_flag = alpha >> 2;
tmp_flag = tmp_flag + 2;
tmp_flag = (p0_asub_q0 < tmp_flag);
{
v16u8 p2_asub_p0;
p2_asub_p0 = __msa_asub_u_b(p2_org, p0_org);
is_less_than_beta = (p2_asub_p0 < beta);
}
is_less_than_beta = tmp_flag & is_less_than_beta;
negate_is_less_than_beta = __msa_xori_b(is_less_than_beta, 0xff);
is_less_than_beta = is_less_than_beta & is_less_than;
negate_is_less_than_beta = negate_is_less_than_beta & is_less_than;
/* right */
{
v16u8 is_less_than_beta_r;
is_less_than_beta_r =
(v16u8) __msa_sldi_b((v16i8) is_less_than_beta, zero, 8);
if (!__msa_test_bz_v(is_less_than_beta_r)) {
v8i16 p3_org_r;
p3_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p3_org);
p2_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p2_org);
AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(p3_org_r, p0_org_r,
q0_org_r, p1_org_r,
p2_r, q1_org_r,
p0_r, p1_r, p2_r);
}
}
/* left */
{
v16u8 is_less_than_beta_l;
is_less_than_beta_l =
(v16u8) __msa_sldi_b(zero, (v16i8) is_less_than_beta, 8);
if (!__msa_test_bz_v(is_less_than_beta_l)) {
v8i16 p3_org_l;
p3_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p3_org);
p2_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p2_org);
AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(p3_org_l, p0_org_l,
q0_org_l, p1_org_l,
p2_l, q1_org_l,
p0_l, p1_l, p2_l);
}
}
/* combine and store */
if (!__msa_test_bz_v(is_less_than_beta)) {
v16u8 p0, p2, p1;
p0 = (v16u8) __msa_pckev_b((v16i8) p0_l, (v16i8) p0_r);
p1 = (v16u8) __msa_pckev_b((v16i8) p1_l, (v16i8) p1_r);
p2 = (v16u8) __msa_pckev_b((v16i8) p2_l, (v16i8) p2_r);
p0_org = __msa_bmnz_v(p0_org, p0, is_less_than_beta);
p1_org = __msa_bmnz_v(p1_org, p1, is_less_than_beta);
p2_org = __msa_bmnz_v(p2_org, p2, is_less_than_beta);
}
/* right */
{
v16u8 negate_is_less_than_beta_r;
negate_is_less_than_beta_r =
(v16u8) __msa_sldi_b((v16i8) negate_is_less_than_beta, zero, 8);
if (!__msa_test_bz_v(negate_is_less_than_beta_r)) {
AVC_LOOP_FILTER_P0_OR_Q0(p0_org_r, q1_org_r, p1_org_r, p0_r);
}
}
/* left */
{
v16u8 negate_is_less_than_beta_l;
negate_is_less_than_beta_l =
(v16u8) __msa_sldi_b(zero, (v16i8) negate_is_less_than_beta, 8);
if (!__msa_test_bz_v(negate_is_less_than_beta_l)) {
AVC_LOOP_FILTER_P0_OR_Q0(p0_org_l, q1_org_l, p1_org_l, p0_l);
}
}
if (!__msa_test_bz_v(negate_is_less_than_beta)) {
v16u8 p0;
p0 = (v16u8) __msa_pckev_b((v16i8) p0_l, (v16i8) p0_r);
p0_org = __msa_bmnz_v(p0_org, p0, negate_is_less_than_beta);
}
{
v16u8 q2_asub_q0;
q2_asub_q0 = __msa_asub_u_b(q2_org, q0_org);
is_less_than_beta = (q2_asub_q0 < beta);
}
is_less_than_beta = is_less_than_beta & tmp_flag;
negate_is_less_than_beta = __msa_xori_b(is_less_than_beta, 0xff);
is_less_than_beta = is_less_than_beta & is_less_than;
negate_is_less_than_beta = negate_is_less_than_beta & is_less_than;
/* right */
{
v16u8 is_less_than_beta_r;
is_less_than_beta_r =
(v16u8) __msa_sldi_b((v16i8) is_less_than_beta, zero, 8);
if (!__msa_test_bz_v(is_less_than_beta_r)) {
v8i16 q3_org_r;
q3_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q3_org);
q2_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q2_org);
AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(q3_org_r, q0_org_r,
p0_org_r, q1_org_r,
q2_r, p1_org_r,
q0_r, q1_r, q2_r);
}
}
/* left */
{
v16u8 is_less_than_beta_l;
is_less_than_beta_l =
(v16u8) __msa_sldi_b(zero, (v16i8) is_less_than_beta, 8);
if (!__msa_test_bz_v(is_less_than_beta_l)) {
v8i16 q3_org_l;
q3_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q3_org);
q2_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q2_org);
AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(q3_org_l, q0_org_l,
p0_org_l, q1_org_l,
q2_l, p1_org_l,
q0_l, q1_l, q2_l);
}
}
/* combine and store */
if (!__msa_test_bz_v(is_less_than_beta)) {
v16u8 q0, q1, q2;
q0 = (v16u8) __msa_pckev_b((v16i8) q0_l, (v16i8) q0_r);
q1 = (v16u8) __msa_pckev_b((v16i8) q1_l, (v16i8) q1_r);
q2 = (v16u8) __msa_pckev_b((v16i8) q2_l, (v16i8) q2_r);
q0_org = __msa_bmnz_v(q0_org, q0, is_less_than_beta);
q1_org = __msa_bmnz_v(q1_org, q1, is_less_than_beta);
q2_org = __msa_bmnz_v(q2_org, q2, is_less_than_beta);
}
/* right */
{
v16u8 negate_is_less_than_beta_r;
negate_is_less_than_beta_r =
(v16u8) __msa_sldi_b((v16i8) negate_is_less_than_beta, zero, 8);
if (!__msa_test_bz_v(negate_is_less_than_beta_r)) {
AVC_LOOP_FILTER_P0_OR_Q0(q0_org_r, p1_org_r, q1_org_r, q0_r);
}
}
/* left */
{
v16u8 negate_is_less_than_beta_l;
negate_is_less_than_beta_l =
(v16u8) __msa_sldi_b(zero, (v16i8) negate_is_less_than_beta, 8);
if (!__msa_test_bz_v(negate_is_less_than_beta_l)) {
AVC_LOOP_FILTER_P0_OR_Q0(q0_org_l, p1_org_l, q1_org_l, q0_l);
}
}
if (!__msa_test_bz_v(negate_is_less_than_beta)) {
v16u8 q0;
q0 = (v16u8) __msa_pckev_b((v16i8) q0_l, (v16i8) q0_r);
q0_org = __msa_bmnz_v(q0_org, q0, negate_is_less_than_beta);
}
}
{
v16u8 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
uint32_t out0, out2;
uint16_t out1, out3;
tmp0 = (v16u8) __msa_ilvr_b((v16i8) p1_org, (v16i8) p2_org);
tmp1 = (v16u8) __msa_ilvr_b((v16i8) q0_org, (v16i8) p0_org);
tmp2 = (v16u8) __msa_ilvr_b((v16i8) q2_org, (v16i8) q1_org);
tmp3 = (v16u8) __msa_ilvr_h((v8i16) tmp1, (v8i16) tmp0);
tmp4 = (v16u8) __msa_ilvl_h((v8i16) tmp1, (v8i16) tmp0);
tmp0 = (v16u8) __msa_ilvl_b((v16i8) p1_org, (v16i8) p2_org);
tmp1 = (v16u8) __msa_ilvl_b((v16i8) q0_org, (v16i8) p0_org);
tmp5 = (v16u8) __msa_ilvl_b((v16i8) q2_org, (v16i8) q1_org);
tmp6 = (v16u8) __msa_ilvr_h((v8i16) tmp1, (v8i16) tmp0);
tmp7 = (v16u8) __msa_ilvl_h((v8i16) tmp1, (v8i16) tmp0);
src = data - 3;
out0 = __msa_copy_u_w((v4i32) tmp3, 0);
out1 = __msa_copy_u_h((v8i16) tmp2, 0);
out2 = __msa_copy_u_w((v4i32) tmp3, 1);
out3 = __msa_copy_u_h((v8i16) tmp2, 1);
STORE_WORD(src, out0);
STORE_HWORD((src + 4), out1);
src += img_width;
STORE_WORD(src, out2);
STORE_HWORD((src + 4), out3);
out0 = __msa_copy_u_w((v4i32) tmp3, 2);
out1 = __msa_copy_u_h((v8i16) tmp2, 2);
out2 = __msa_copy_u_w((v4i32) tmp3, 3);
out3 = __msa_copy_u_h((v8i16) tmp2, 3);
src += img_width;
STORE_WORD(src, out0);
STORE_HWORD((src + 4), out1);
src += img_width;
STORE_WORD(src, out2);
STORE_HWORD((src + 4), out3);
out0 = __msa_copy_u_w((v4i32) tmp4, 0);
out1 = __msa_copy_u_h((v8i16) tmp2, 4);
out2 = __msa_copy_u_w((v4i32) tmp4, 1);
out3 = __msa_copy_u_h((v8i16) tmp2, 5);
src += img_width;
STORE_WORD(src, out0);
STORE_HWORD((src + 4), out1);
src += img_width;
STORE_WORD(src, out2);
STORE_HWORD((src + 4), out3);
out0 = __msa_copy_u_w((v4i32) tmp4, 2);
out1 = __msa_copy_u_h((v8i16) tmp2, 6);
out2 = __msa_copy_u_w((v4i32) tmp4, 3);
out3 = __msa_copy_u_h((v8i16) tmp2, 7);
src += img_width;
STORE_WORD(src, out0);
STORE_HWORD((src + 4), out1);
src += img_width;
STORE_WORD(src, out2);
STORE_HWORD((src + 4), out3);
out0 = __msa_copy_u_w((v4i32) tmp6, 0);
out1 = __msa_copy_u_h((v8i16) tmp5, 0);
out2 = __msa_copy_u_w((v4i32) tmp6, 1);
out3 = __msa_copy_u_h((v8i16) tmp5, 1);
src += img_width;
STORE_WORD(src, out0);
STORE_HWORD((src + 4), out1);
src += img_width;
STORE_WORD(src, out2);
STORE_HWORD((src + 4), out3);
out0 = __msa_copy_u_w((v4i32) tmp6, 2);
out1 = __msa_copy_u_h((v8i16) tmp5, 2);
out2 = __msa_copy_u_w((v4i32) tmp6, 3);
out3 = __msa_copy_u_h((v8i16) tmp5, 3);
src += img_width;
STORE_WORD(src, out0);
STORE_HWORD((src + 4), out1);
src += img_width;
STORE_WORD(src, out2);
STORE_HWORD((src + 4), out3);
out0 = __msa_copy_u_w((v4i32) tmp7, 0);
out1 = __msa_copy_u_h((v8i16) tmp5, 4);
out2 = __msa_copy_u_w((v4i32) tmp7, 1);
out3 = __msa_copy_u_h((v8i16) tmp5, 5);
src += img_width;
STORE_WORD(src, out0);
STORE_HWORD((src + 4), out1);
src += img_width;
STORE_WORD(src, out2);
STORE_HWORD((src + 4), out3);
out0 = __msa_copy_u_w((v4i32) tmp7, 2);
out1 = __msa_copy_u_h((v8i16) tmp5, 6);
out2 = __msa_copy_u_w((v4i32) tmp7, 3);
out3 = __msa_copy_u_h((v8i16) tmp5, 7);
src += img_width;
STORE_WORD(src, out0);
STORE_HWORD((src + 4), out1);
src += img_width;
STORE_WORD(src, out2);
STORE_HWORD((src + 4), out3);
}
}
| false | FFmpeg | bcd7bf7eeb09a395cc01698842d1b8be9af483fc | static void avc_loopfilter_luma_intra_edge_ver_msa(uint8_t *data,
uint8_t alpha_in,
uint8_t beta_in,
uint32_t img_width)
{
uint8_t *src;
v16u8 alpha, beta, p0_asub_q0;
v16u8 is_less_than_alpha, is_less_than;
v16u8 is_less_than_beta, negate_is_less_than_beta;
v8i16 p2_r = { 0 };
v8i16 p1_r = { 0 };
v8i16 p0_r = { 0 };
v8i16 q0_r = { 0 };
v8i16 q1_r = { 0 };
v8i16 q2_r = { 0 };
v8i16 p2_l = { 0 };
v8i16 p1_l = { 0 };
v8i16 p0_l = { 0 };
v8i16 q0_l = { 0 };
v8i16 q1_l = { 0 };
v8i16 q2_l = { 0 };
v16u8 p3_org, p2_org, p1_org, p0_org, q0_org, q1_org, q2_org, q3_org;
v8i16 p1_org_r, p0_org_r, q0_org_r, q1_org_r;
v8i16 p1_org_l, p0_org_l, q0_org_l, q1_org_l;
v16i8 zero = { 0 };
v16u8 tmp_flag;
src = data - 4;
{
v16u8 row0, row1, row2, row3, row4, row5, row6, row7;
v16u8 row8, row9, row10, row11, row12, row13, row14, row15;
LOAD_8VECS_UB(src, img_width,
row0, row1, row2, row3, row4, row5, row6, row7);
LOAD_8VECS_UB(src + (8 * img_width), img_width,
row8, row9, row10, row11, row12, row13, row14, row15);
TRANSPOSE16x8_B_UB(row0, row1, row2, row3, row4, row5, row6, row7,
row8, row9, row10, row11, row12, row13, row14, row15,
p3_org, p2_org, p1_org, p0_org,
q0_org, q1_org, q2_org, q3_org);
}
p1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p1_org);
p0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p0_org);
q0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q0_org);
q1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q1_org);
p1_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p1_org);
p0_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p0_org);
q0_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q0_org);
q1_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q1_org);
{
v16u8 p1_asub_p0, q1_asub_q0;
p0_asub_q0 = __msa_asub_u_b(p0_org, q0_org);
p1_asub_p0 = __msa_asub_u_b(p1_org, p0_org);
q1_asub_q0 = __msa_asub_u_b(q1_org, q0_org);
alpha = (v16u8) __msa_fill_b(alpha_in);
beta = (v16u8) __msa_fill_b(beta_in);
is_less_than_alpha = (p0_asub_q0 < alpha);
is_less_than_beta = (p1_asub_p0 < beta);
is_less_than = is_less_than_beta & is_less_than_alpha;
is_less_than_beta = (q1_asub_q0 < beta);
is_less_than = is_less_than_beta & is_less_than;
}
if (!__msa_test_bz_v(is_less_than)) {
tmp_flag = alpha >> 2;
tmp_flag = tmp_flag + 2;
tmp_flag = (p0_asub_q0 < tmp_flag);
{
v16u8 p2_asub_p0;
p2_asub_p0 = __msa_asub_u_b(p2_org, p0_org);
is_less_than_beta = (p2_asub_p0 < beta);
}
is_less_than_beta = tmp_flag & is_less_than_beta;
negate_is_less_than_beta = __msa_xori_b(is_less_than_beta, 0xff);
is_less_than_beta = is_less_than_beta & is_less_than;
negate_is_less_than_beta = negate_is_less_than_beta & is_less_than;
{
v16u8 is_less_than_beta_r;
is_less_than_beta_r =
(v16u8) __msa_sldi_b((v16i8) is_less_than_beta, zero, 8);
if (!__msa_test_bz_v(is_less_than_beta_r)) {
v8i16 p3_org_r;
p3_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p3_org);
p2_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p2_org);
AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(p3_org_r, p0_org_r,
q0_org_r, p1_org_r,
p2_r, q1_org_r,
p0_r, p1_r, p2_r);
}
}
{
v16u8 is_less_than_beta_l;
is_less_than_beta_l =
(v16u8) __msa_sldi_b(zero, (v16i8) is_less_than_beta, 8);
if (!__msa_test_bz_v(is_less_than_beta_l)) {
v8i16 p3_org_l;
p3_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p3_org);
p2_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p2_org);
AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(p3_org_l, p0_org_l,
q0_org_l, p1_org_l,
p2_l, q1_org_l,
p0_l, p1_l, p2_l);
}
}
if (!__msa_test_bz_v(is_less_than_beta)) {
v16u8 p0, p2, p1;
p0 = (v16u8) __msa_pckev_b((v16i8) p0_l, (v16i8) p0_r);
p1 = (v16u8) __msa_pckev_b((v16i8) p1_l, (v16i8) p1_r);
p2 = (v16u8) __msa_pckev_b((v16i8) p2_l, (v16i8) p2_r);
p0_org = __msa_bmnz_v(p0_org, p0, is_less_than_beta);
p1_org = __msa_bmnz_v(p1_org, p1, is_less_than_beta);
p2_org = __msa_bmnz_v(p2_org, p2, is_less_than_beta);
}
{
v16u8 negate_is_less_than_beta_r;
negate_is_less_than_beta_r =
(v16u8) __msa_sldi_b((v16i8) negate_is_less_than_beta, zero, 8);
if (!__msa_test_bz_v(negate_is_less_than_beta_r)) {
AVC_LOOP_FILTER_P0_OR_Q0(p0_org_r, q1_org_r, p1_org_r, p0_r);
}
}
{
v16u8 negate_is_less_than_beta_l;
negate_is_less_than_beta_l =
(v16u8) __msa_sldi_b(zero, (v16i8) negate_is_less_than_beta, 8);
if (!__msa_test_bz_v(negate_is_less_than_beta_l)) {
AVC_LOOP_FILTER_P0_OR_Q0(p0_org_l, q1_org_l, p1_org_l, p0_l);
}
}
if (!__msa_test_bz_v(negate_is_less_than_beta)) {
v16u8 p0;
p0 = (v16u8) __msa_pckev_b((v16i8) p0_l, (v16i8) p0_r);
p0_org = __msa_bmnz_v(p0_org, p0, negate_is_less_than_beta);
}
{
v16u8 q2_asub_q0;
q2_asub_q0 = __msa_asub_u_b(q2_org, q0_org);
is_less_than_beta = (q2_asub_q0 < beta);
}
is_less_than_beta = is_less_than_beta & tmp_flag;
negate_is_less_than_beta = __msa_xori_b(is_less_than_beta, 0xff);
is_less_than_beta = is_less_than_beta & is_less_than;
negate_is_less_than_beta = negate_is_less_than_beta & is_less_than;
{
v16u8 is_less_than_beta_r;
is_less_than_beta_r =
(v16u8) __msa_sldi_b((v16i8) is_less_than_beta, zero, 8);
if (!__msa_test_bz_v(is_less_than_beta_r)) {
v8i16 q3_org_r;
q3_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q3_org);
q2_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q2_org);
AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(q3_org_r, q0_org_r,
p0_org_r, q1_org_r,
q2_r, p1_org_r,
q0_r, q1_r, q2_r);
}
}
{
v16u8 is_less_than_beta_l;
is_less_than_beta_l =
(v16u8) __msa_sldi_b(zero, (v16i8) is_less_than_beta, 8);
if (!__msa_test_bz_v(is_less_than_beta_l)) {
v8i16 q3_org_l;
q3_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q3_org);
q2_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q2_org);
AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(q3_org_l, q0_org_l,
p0_org_l, q1_org_l,
q2_l, p1_org_l,
q0_l, q1_l, q2_l);
}
}
if (!__msa_test_bz_v(is_less_than_beta)) {
v16u8 q0, q1, q2;
q0 = (v16u8) __msa_pckev_b((v16i8) q0_l, (v16i8) q0_r);
q1 = (v16u8) __msa_pckev_b((v16i8) q1_l, (v16i8) q1_r);
q2 = (v16u8) __msa_pckev_b((v16i8) q2_l, (v16i8) q2_r);
q0_org = __msa_bmnz_v(q0_org, q0, is_less_than_beta);
q1_org = __msa_bmnz_v(q1_org, q1, is_less_than_beta);
q2_org = __msa_bmnz_v(q2_org, q2, is_less_than_beta);
}
{
v16u8 negate_is_less_than_beta_r;
negate_is_less_than_beta_r =
(v16u8) __msa_sldi_b((v16i8) negate_is_less_than_beta, zero, 8);
if (!__msa_test_bz_v(negate_is_less_than_beta_r)) {
AVC_LOOP_FILTER_P0_OR_Q0(q0_org_r, p1_org_r, q1_org_r, q0_r);
}
}
{
v16u8 negate_is_less_than_beta_l;
negate_is_less_than_beta_l =
(v16u8) __msa_sldi_b(zero, (v16i8) negate_is_less_than_beta, 8);
if (!__msa_test_bz_v(negate_is_less_than_beta_l)) {
AVC_LOOP_FILTER_P0_OR_Q0(q0_org_l, p1_org_l, q1_org_l, q0_l);
}
}
if (!__msa_test_bz_v(negate_is_less_than_beta)) {
v16u8 q0;
q0 = (v16u8) __msa_pckev_b((v16i8) q0_l, (v16i8) q0_r);
q0_org = __msa_bmnz_v(q0_org, q0, negate_is_less_than_beta);
}
}
{
v16u8 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
uint32_t out0, out2;
uint16_t out1, out3;
tmp0 = (v16u8) __msa_ilvr_b((v16i8) p1_org, (v16i8) p2_org);
tmp1 = (v16u8) __msa_ilvr_b((v16i8) q0_org, (v16i8) p0_org);
tmp2 = (v16u8) __msa_ilvr_b((v16i8) q2_org, (v16i8) q1_org);
tmp3 = (v16u8) __msa_ilvr_h((v8i16) tmp1, (v8i16) tmp0);
tmp4 = (v16u8) __msa_ilvl_h((v8i16) tmp1, (v8i16) tmp0);
tmp0 = (v16u8) __msa_ilvl_b((v16i8) p1_org, (v16i8) p2_org);
tmp1 = (v16u8) __msa_ilvl_b((v16i8) q0_org, (v16i8) p0_org);
tmp5 = (v16u8) __msa_ilvl_b((v16i8) q2_org, (v16i8) q1_org);
tmp6 = (v16u8) __msa_ilvr_h((v8i16) tmp1, (v8i16) tmp0);
tmp7 = (v16u8) __msa_ilvl_h((v8i16) tmp1, (v8i16) tmp0);
src = data - 3;
out0 = __msa_copy_u_w((v4i32) tmp3, 0);
out1 = __msa_copy_u_h((v8i16) tmp2, 0);
out2 = __msa_copy_u_w((v4i32) tmp3, 1);
out3 = __msa_copy_u_h((v8i16) tmp2, 1);
STORE_WORD(src, out0);
STORE_HWORD((src + 4), out1);
src += img_width;
STORE_WORD(src, out2);
STORE_HWORD((src + 4), out3);
out0 = __msa_copy_u_w((v4i32) tmp3, 2);
out1 = __msa_copy_u_h((v8i16) tmp2, 2);
out2 = __msa_copy_u_w((v4i32) tmp3, 3);
out3 = __msa_copy_u_h((v8i16) tmp2, 3);
src += img_width;
STORE_WORD(src, out0);
STORE_HWORD((src + 4), out1);
src += img_width;
STORE_WORD(src, out2);
STORE_HWORD((src + 4), out3);
out0 = __msa_copy_u_w((v4i32) tmp4, 0);
out1 = __msa_copy_u_h((v8i16) tmp2, 4);
out2 = __msa_copy_u_w((v4i32) tmp4, 1);
out3 = __msa_copy_u_h((v8i16) tmp2, 5);
src += img_width;
STORE_WORD(src, out0);
STORE_HWORD((src + 4), out1);
src += img_width;
STORE_WORD(src, out2);
STORE_HWORD((src + 4), out3);
out0 = __msa_copy_u_w((v4i32) tmp4, 2);
out1 = __msa_copy_u_h((v8i16) tmp2, 6);
out2 = __msa_copy_u_w((v4i32) tmp4, 3);
out3 = __msa_copy_u_h((v8i16) tmp2, 7);
src += img_width;
STORE_WORD(src, out0);
STORE_HWORD((src + 4), out1);
src += img_width;
STORE_WORD(src, out2);
STORE_HWORD((src + 4), out3);
out0 = __msa_copy_u_w((v4i32) tmp6, 0);
out1 = __msa_copy_u_h((v8i16) tmp5, 0);
out2 = __msa_copy_u_w((v4i32) tmp6, 1);
out3 = __msa_copy_u_h((v8i16) tmp5, 1);
src += img_width;
STORE_WORD(src, out0);
STORE_HWORD((src + 4), out1);
src += img_width;
STORE_WORD(src, out2);
STORE_HWORD((src + 4), out3);
out0 = __msa_copy_u_w((v4i32) tmp6, 2);
out1 = __msa_copy_u_h((v8i16) tmp5, 2);
out2 = __msa_copy_u_w((v4i32) tmp6, 3);
out3 = __msa_copy_u_h((v8i16) tmp5, 3);
src += img_width;
STORE_WORD(src, out0);
STORE_HWORD((src + 4), out1);
src += img_width;
STORE_WORD(src, out2);
STORE_HWORD((src + 4), out3);
out0 = __msa_copy_u_w((v4i32) tmp7, 0);
out1 = __msa_copy_u_h((v8i16) tmp5, 4);
out2 = __msa_copy_u_w((v4i32) tmp7, 1);
out3 = __msa_copy_u_h((v8i16) tmp5, 5);
src += img_width;
STORE_WORD(src, out0);
STORE_HWORD((src + 4), out1);
src += img_width;
STORE_WORD(src, out2);
STORE_HWORD((src + 4), out3);
out0 = __msa_copy_u_w((v4i32) tmp7, 2);
out1 = __msa_copy_u_h((v8i16) tmp5, 6);
out2 = __msa_copy_u_w((v4i32) tmp7, 3);
out3 = __msa_copy_u_h((v8i16) tmp5, 7);
src += img_width;
STORE_WORD(src, out0);
STORE_HWORD((src + 4), out1);
src += img_width;
STORE_WORD(src, out2);
STORE_HWORD((src + 4), out3);
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(uint8_t *VAR_0,
uint8_t VAR_1,
uint8_t VAR_2,
uint32_t VAR_3)
{
uint8_t *src;
v16u8 alpha, beta, p0_asub_q0;
v16u8 is_less_than_alpha, is_less_than;
v16u8 is_less_than_beta, negate_is_less_than_beta;
v8i16 p2_r = { 0 };
v8i16 p1_r = { 0 };
v8i16 p0_r = { 0 };
v8i16 q0_r = { 0 };
v8i16 q1_r = { 0 };
v8i16 q2_r = { 0 };
v8i16 p2_l = { 0 };
v8i16 p1_l = { 0 };
v8i16 p0_l = { 0 };
v8i16 q0_l = { 0 };
v8i16 q1_l = { 0 };
v8i16 q2_l = { 0 };
v16u8 p3_org, p2_org, p1_org, p0_org, q0_org, q1_org, q2_org, q3_org;
v8i16 p1_org_r, p0_org_r, q0_org_r, q1_org_r;
v8i16 p1_org_l, p0_org_l, q0_org_l, q1_org_l;
v16i8 zero = { 0 };
v16u8 tmp_flag;
src = VAR_0 - 4;
{
v16u8 row0, row1, row2, row3, row4, row5, row6, row7;
v16u8 row8, row9, row10, row11, row12, row13, row14, row15;
LOAD_8VECS_UB(src, VAR_3,
row0, row1, row2, row3, row4, row5, row6, row7);
LOAD_8VECS_UB(src + (8 * VAR_3), VAR_3,
row8, row9, row10, row11, row12, row13, row14, row15);
TRANSPOSE16x8_B_UB(row0, row1, row2, row3, row4, row5, row6, row7,
row8, row9, row10, row11, row12, row13, row14, row15,
p3_org, p2_org, p1_org, p0_org,
q0_org, q1_org, q2_org, q3_org);
}
p1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p1_org);
p0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p0_org);
q0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q0_org);
q1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q1_org);
p1_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p1_org);
p0_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p0_org);
q0_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q0_org);
q1_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q1_org);
{
v16u8 p1_asub_p0, q1_asub_q0;
p0_asub_q0 = __msa_asub_u_b(p0_org, q0_org);
p1_asub_p0 = __msa_asub_u_b(p1_org, p0_org);
q1_asub_q0 = __msa_asub_u_b(q1_org, q0_org);
alpha = (v16u8) __msa_fill_b(VAR_1);
beta = (v16u8) __msa_fill_b(VAR_2);
is_less_than_alpha = (p0_asub_q0 < alpha);
is_less_than_beta = (p1_asub_p0 < beta);
is_less_than = is_less_than_beta & is_less_than_alpha;
is_less_than_beta = (q1_asub_q0 < beta);
is_less_than = is_less_than_beta & is_less_than;
}
if (!__msa_test_bz_v(is_less_than)) {
tmp_flag = alpha >> 2;
tmp_flag = tmp_flag + 2;
tmp_flag = (p0_asub_q0 < tmp_flag);
{
v16u8 p2_asub_p0;
p2_asub_p0 = __msa_asub_u_b(p2_org, p0_org);
is_less_than_beta = (p2_asub_p0 < beta);
}
is_less_than_beta = tmp_flag & is_less_than_beta;
negate_is_less_than_beta = __msa_xori_b(is_less_than_beta, 0xff);
is_less_than_beta = is_less_than_beta & is_less_than;
negate_is_less_than_beta = negate_is_less_than_beta & is_less_than;
{
v16u8 is_less_than_beta_r;
is_less_than_beta_r =
(v16u8) __msa_sldi_b((v16i8) is_less_than_beta, zero, 8);
if (!__msa_test_bz_v(is_less_than_beta_r)) {
v8i16 p3_org_r;
p3_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p3_org);
p2_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p2_org);
AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(p3_org_r, p0_org_r,
q0_org_r, p1_org_r,
p2_r, q1_org_r,
p0_r, p1_r, p2_r);
}
}
{
v16u8 is_less_than_beta_l;
is_less_than_beta_l =
(v16u8) __msa_sldi_b(zero, (v16i8) is_less_than_beta, 8);
if (!__msa_test_bz_v(is_less_than_beta_l)) {
v8i16 p3_org_l;
p3_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p3_org);
p2_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p2_org);
AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(p3_org_l, p0_org_l,
q0_org_l, p1_org_l,
p2_l, q1_org_l,
p0_l, p1_l, p2_l);
}
}
if (!__msa_test_bz_v(is_less_than_beta)) {
v16u8 p0, p2, p1;
p0 = (v16u8) __msa_pckev_b((v16i8) p0_l, (v16i8) p0_r);
p1 = (v16u8) __msa_pckev_b((v16i8) p1_l, (v16i8) p1_r);
p2 = (v16u8) __msa_pckev_b((v16i8) p2_l, (v16i8) p2_r);
p0_org = __msa_bmnz_v(p0_org, p0, is_less_than_beta);
p1_org = __msa_bmnz_v(p1_org, p1, is_less_than_beta);
p2_org = __msa_bmnz_v(p2_org, p2, is_less_than_beta);
}
{
v16u8 negate_is_less_than_beta_r;
negate_is_less_than_beta_r =
(v16u8) __msa_sldi_b((v16i8) negate_is_less_than_beta, zero, 8);
if (!__msa_test_bz_v(negate_is_less_than_beta_r)) {
AVC_LOOP_FILTER_P0_OR_Q0(p0_org_r, q1_org_r, p1_org_r, p0_r);
}
}
{
v16u8 negate_is_less_than_beta_l;
negate_is_less_than_beta_l =
(v16u8) __msa_sldi_b(zero, (v16i8) negate_is_less_than_beta, 8);
if (!__msa_test_bz_v(negate_is_less_than_beta_l)) {
AVC_LOOP_FILTER_P0_OR_Q0(p0_org_l, q1_org_l, p1_org_l, p0_l);
}
}
if (!__msa_test_bz_v(negate_is_less_than_beta)) {
v16u8 p0;
p0 = (v16u8) __msa_pckev_b((v16i8) p0_l, (v16i8) p0_r);
p0_org = __msa_bmnz_v(p0_org, p0, negate_is_less_than_beta);
}
{
v16u8 q2_asub_q0;
q2_asub_q0 = __msa_asub_u_b(q2_org, q0_org);
is_less_than_beta = (q2_asub_q0 < beta);
}
is_less_than_beta = is_less_than_beta & tmp_flag;
negate_is_less_than_beta = __msa_xori_b(is_less_than_beta, 0xff);
is_less_than_beta = is_less_than_beta & is_less_than;
negate_is_less_than_beta = negate_is_less_than_beta & is_less_than;
{
v16u8 is_less_than_beta_r;
is_less_than_beta_r =
(v16u8) __msa_sldi_b((v16i8) is_less_than_beta, zero, 8);
if (!__msa_test_bz_v(is_less_than_beta_r)) {
v8i16 q3_org_r;
q3_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q3_org);
q2_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q2_org);
AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(q3_org_r, q0_org_r,
p0_org_r, q1_org_r,
q2_r, p1_org_r,
q0_r, q1_r, q2_r);
}
}
{
v16u8 is_less_than_beta_l;
is_less_than_beta_l =
(v16u8) __msa_sldi_b(zero, (v16i8) is_less_than_beta, 8);
if (!__msa_test_bz_v(is_less_than_beta_l)) {
v8i16 q3_org_l;
q3_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q3_org);
q2_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q2_org);
AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(q3_org_l, q0_org_l,
p0_org_l, q1_org_l,
q2_l, p1_org_l,
q0_l, q1_l, q2_l);
}
}
if (!__msa_test_bz_v(is_less_than_beta)) {
v16u8 q0, q1, q2;
q0 = (v16u8) __msa_pckev_b((v16i8) q0_l, (v16i8) q0_r);
q1 = (v16u8) __msa_pckev_b((v16i8) q1_l, (v16i8) q1_r);
q2 = (v16u8) __msa_pckev_b((v16i8) q2_l, (v16i8) q2_r);
q0_org = __msa_bmnz_v(q0_org, q0, is_less_than_beta);
q1_org = __msa_bmnz_v(q1_org, q1, is_less_than_beta);
q2_org = __msa_bmnz_v(q2_org, q2, is_less_than_beta);
}
{
v16u8 negate_is_less_than_beta_r;
negate_is_less_than_beta_r =
(v16u8) __msa_sldi_b((v16i8) negate_is_less_than_beta, zero, 8);
if (!__msa_test_bz_v(negate_is_less_than_beta_r)) {
AVC_LOOP_FILTER_P0_OR_Q0(q0_org_r, p1_org_r, q1_org_r, q0_r);
}
}
{
v16u8 negate_is_less_than_beta_l;
negate_is_less_than_beta_l =
(v16u8) __msa_sldi_b(zero, (v16i8) negate_is_less_than_beta, 8);
if (!__msa_test_bz_v(negate_is_less_than_beta_l)) {
AVC_LOOP_FILTER_P0_OR_Q0(q0_org_l, p1_org_l, q1_org_l, q0_l);
}
}
if (!__msa_test_bz_v(negate_is_less_than_beta)) {
v16u8 q0;
q0 = (v16u8) __msa_pckev_b((v16i8) q0_l, (v16i8) q0_r);
q0_org = __msa_bmnz_v(q0_org, q0, negate_is_less_than_beta);
}
}
{
v16u8 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
uint32_t out0, out2;
uint16_t out1, out3;
tmp0 = (v16u8) __msa_ilvr_b((v16i8) p1_org, (v16i8) p2_org);
tmp1 = (v16u8) __msa_ilvr_b((v16i8) q0_org, (v16i8) p0_org);
tmp2 = (v16u8) __msa_ilvr_b((v16i8) q2_org, (v16i8) q1_org);
tmp3 = (v16u8) __msa_ilvr_h((v8i16) tmp1, (v8i16) tmp0);
tmp4 = (v16u8) __msa_ilvl_h((v8i16) tmp1, (v8i16) tmp0);
tmp0 = (v16u8) __msa_ilvl_b((v16i8) p1_org, (v16i8) p2_org);
tmp1 = (v16u8) __msa_ilvl_b((v16i8) q0_org, (v16i8) p0_org);
tmp5 = (v16u8) __msa_ilvl_b((v16i8) q2_org, (v16i8) q1_org);
tmp6 = (v16u8) __msa_ilvr_h((v8i16) tmp1, (v8i16) tmp0);
tmp7 = (v16u8) __msa_ilvl_h((v8i16) tmp1, (v8i16) tmp0);
src = VAR_0 - 3;
out0 = __msa_copy_u_w((v4i32) tmp3, 0);
out1 = __msa_copy_u_h((v8i16) tmp2, 0);
out2 = __msa_copy_u_w((v4i32) tmp3, 1);
out3 = __msa_copy_u_h((v8i16) tmp2, 1);
STORE_WORD(src, out0);
STORE_HWORD((src + 4), out1);
src += VAR_3;
STORE_WORD(src, out2);
STORE_HWORD((src + 4), out3);
out0 = __msa_copy_u_w((v4i32) tmp3, 2);
out1 = __msa_copy_u_h((v8i16) tmp2, 2);
out2 = __msa_copy_u_w((v4i32) tmp3, 3);
out3 = __msa_copy_u_h((v8i16) tmp2, 3);
src += VAR_3;
STORE_WORD(src, out0);
STORE_HWORD((src + 4), out1);
src += VAR_3;
STORE_WORD(src, out2);
STORE_HWORD((src + 4), out3);
out0 = __msa_copy_u_w((v4i32) tmp4, 0);
out1 = __msa_copy_u_h((v8i16) tmp2, 4);
out2 = __msa_copy_u_w((v4i32) tmp4, 1);
out3 = __msa_copy_u_h((v8i16) tmp2, 5);
src += VAR_3;
STORE_WORD(src, out0);
STORE_HWORD((src + 4), out1);
src += VAR_3;
STORE_WORD(src, out2);
STORE_HWORD((src + 4), out3);
out0 = __msa_copy_u_w((v4i32) tmp4, 2);
out1 = __msa_copy_u_h((v8i16) tmp2, 6);
out2 = __msa_copy_u_w((v4i32) tmp4, 3);
out3 = __msa_copy_u_h((v8i16) tmp2, 7);
src += VAR_3;
STORE_WORD(src, out0);
STORE_HWORD((src + 4), out1);
src += VAR_3;
STORE_WORD(src, out2);
STORE_HWORD((src + 4), out3);
out0 = __msa_copy_u_w((v4i32) tmp6, 0);
out1 = __msa_copy_u_h((v8i16) tmp5, 0);
out2 = __msa_copy_u_w((v4i32) tmp6, 1);
out3 = __msa_copy_u_h((v8i16) tmp5, 1);
src += VAR_3;
STORE_WORD(src, out0);
STORE_HWORD((src + 4), out1);
src += VAR_3;
STORE_WORD(src, out2);
STORE_HWORD((src + 4), out3);
out0 = __msa_copy_u_w((v4i32) tmp6, 2);
out1 = __msa_copy_u_h((v8i16) tmp5, 2);
out2 = __msa_copy_u_w((v4i32) tmp6, 3);
out3 = __msa_copy_u_h((v8i16) tmp5, 3);
src += VAR_3;
STORE_WORD(src, out0);
STORE_HWORD((src + 4), out1);
src += VAR_3;
STORE_WORD(src, out2);
STORE_HWORD((src + 4), out3);
out0 = __msa_copy_u_w((v4i32) tmp7, 0);
out1 = __msa_copy_u_h((v8i16) tmp5, 4);
out2 = __msa_copy_u_w((v4i32) tmp7, 1);
out3 = __msa_copy_u_h((v8i16) tmp5, 5);
src += VAR_3;
STORE_WORD(src, out0);
STORE_HWORD((src + 4), out1);
src += VAR_3;
STORE_WORD(src, out2);
STORE_HWORD((src + 4), out3);
out0 = __msa_copy_u_w((v4i32) tmp7, 2);
out1 = __msa_copy_u_h((v8i16) tmp5, 6);
out2 = __msa_copy_u_w((v4i32) tmp7, 3);
out3 = __msa_copy_u_h((v8i16) tmp5, 7);
src += VAR_3;
STORE_WORD(src, out0);
STORE_HWORD((src + 4), out1);
src += VAR_3;
STORE_WORD(src, out2);
STORE_HWORD((src + 4), out3);
}
}
| [
"static void FUNC_0(uint8_t *VAR_0,\nuint8_t VAR_1,\nuint8_t VAR_2,\nuint32_t VAR_3)\n{",
"uint8_t *src;",
"v16u8 alpha, beta, p0_asub_q0;",
"v16u8 is_less_than_alpha, is_less_than;",
"v16u8 is_less_than_beta, negate_is_less_than_beta;",
"v8i16 p2_r = { 0 };",
"v8i16 p1_r = { 0 };",
"v8i16 p0_r = { 0 };",
"v8i16 q0_r = { 0 };",
"v8i16 q1_r = { 0 };",
"v8i16 q2_r = { 0 };",
"v8i16 p2_l = { 0 };",
"v8i16 p1_l = { 0 };",
"v8i16 p0_l = { 0 };",
"v8i16 q0_l = { 0 };",
"v8i16 q1_l = { 0 };",
"v8i16 q2_l = { 0 };",
"v16u8 p3_org, p2_org, p1_org, p0_org, q0_org, q1_org, q2_org, q3_org;",
"v8i16 p1_org_r, p0_org_r, q0_org_r, q1_org_r;",
"v8i16 p1_org_l, p0_org_l, q0_org_l, q1_org_l;",
"v16i8 zero = { 0 };",
"v16u8 tmp_flag;",
"src = VAR_0 - 4;",
"{",
"v16u8 row0, row1, row2, row3, row4, row5, row6, row7;",
"v16u8 row8, row9, row10, row11, row12, row13, row14, row15;",
"LOAD_8VECS_UB(src, VAR_3,\nrow0, row1, row2, row3, row4, row5, row6, row7);",
"LOAD_8VECS_UB(src + (8 * VAR_3), VAR_3,\nrow8, row9, row10, row11, row12, row13, row14, row15);",
"TRANSPOSE16x8_B_UB(row0, row1, row2, row3, row4, row5, row6, row7,\nrow8, row9, row10, row11, row12, row13, row14, row15,\np3_org, p2_org, p1_org, p0_org,\nq0_org, q1_org, q2_org, q3_org);",
"}",
"p1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p1_org);",
"p0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p0_org);",
"q0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q0_org);",
"q1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q1_org);",
"p1_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p1_org);",
"p0_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p0_org);",
"q0_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q0_org);",
"q1_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q1_org);",
"{",
"v16u8 p1_asub_p0, q1_asub_q0;",
"p0_asub_q0 = __msa_asub_u_b(p0_org, q0_org);",
"p1_asub_p0 = __msa_asub_u_b(p1_org, p0_org);",
"q1_asub_q0 = __msa_asub_u_b(q1_org, q0_org);",
"alpha = (v16u8) __msa_fill_b(VAR_1);",
"beta = (v16u8) __msa_fill_b(VAR_2);",
"is_less_than_alpha = (p0_asub_q0 < alpha);",
"is_less_than_beta = (p1_asub_p0 < beta);",
"is_less_than = is_less_than_beta & is_less_than_alpha;",
"is_less_than_beta = (q1_asub_q0 < beta);",
"is_less_than = is_less_than_beta & is_less_than;",
"}",
"if (!__msa_test_bz_v(is_less_than)) {",
"tmp_flag = alpha >> 2;",
"tmp_flag = tmp_flag + 2;",
"tmp_flag = (p0_asub_q0 < tmp_flag);",
"{",
"v16u8 p2_asub_p0;",
"p2_asub_p0 = __msa_asub_u_b(p2_org, p0_org);",
"is_less_than_beta = (p2_asub_p0 < beta);",
"}",
"is_less_than_beta = tmp_flag & is_less_than_beta;",
"negate_is_less_than_beta = __msa_xori_b(is_less_than_beta, 0xff);",
"is_less_than_beta = is_less_than_beta & is_less_than;",
"negate_is_less_than_beta = negate_is_less_than_beta & is_less_than;",
"{",
"v16u8 is_less_than_beta_r;",
"is_less_than_beta_r =\n(v16u8) __msa_sldi_b((v16i8) is_less_than_beta, zero, 8);",
"if (!__msa_test_bz_v(is_less_than_beta_r)) {",
"v8i16 p3_org_r;",
"p3_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p3_org);",
"p2_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p2_org);",
"AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(p3_org_r, p0_org_r,\nq0_org_r, p1_org_r,\np2_r, q1_org_r,\np0_r, p1_r, p2_r);",
"}",
"}",
"{",
"v16u8 is_less_than_beta_l;",
"is_less_than_beta_l =\n(v16u8) __msa_sldi_b(zero, (v16i8) is_less_than_beta, 8);",
"if (!__msa_test_bz_v(is_less_than_beta_l)) {",
"v8i16 p3_org_l;",
"p3_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p3_org);",
"p2_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p2_org);",
"AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(p3_org_l, p0_org_l,\nq0_org_l, p1_org_l,\np2_l, q1_org_l,\np0_l, p1_l, p2_l);",
"}",
"}",
"if (!__msa_test_bz_v(is_less_than_beta)) {",
"v16u8 p0, p2, p1;",
"p0 = (v16u8) __msa_pckev_b((v16i8) p0_l, (v16i8) p0_r);",
"p1 = (v16u8) __msa_pckev_b((v16i8) p1_l, (v16i8) p1_r);",
"p2 = (v16u8) __msa_pckev_b((v16i8) p2_l, (v16i8) p2_r);",
"p0_org = __msa_bmnz_v(p0_org, p0, is_less_than_beta);",
"p1_org = __msa_bmnz_v(p1_org, p1, is_less_than_beta);",
"p2_org = __msa_bmnz_v(p2_org, p2, is_less_than_beta);",
"}",
"{",
"v16u8 negate_is_less_than_beta_r;",
"negate_is_less_than_beta_r =\n(v16u8) __msa_sldi_b((v16i8) negate_is_less_than_beta, zero, 8);",
"if (!__msa_test_bz_v(negate_is_less_than_beta_r)) {",
"AVC_LOOP_FILTER_P0_OR_Q0(p0_org_r, q1_org_r, p1_org_r, p0_r);",
"}",
"}",
"{",
"v16u8 negate_is_less_than_beta_l;",
"negate_is_less_than_beta_l =\n(v16u8) __msa_sldi_b(zero, (v16i8) negate_is_less_than_beta, 8);",
"if (!__msa_test_bz_v(negate_is_less_than_beta_l)) {",
"AVC_LOOP_FILTER_P0_OR_Q0(p0_org_l, q1_org_l, p1_org_l, p0_l);",
"}",
"}",
"if (!__msa_test_bz_v(negate_is_less_than_beta)) {",
"v16u8 p0;",
"p0 = (v16u8) __msa_pckev_b((v16i8) p0_l, (v16i8) p0_r);",
"p0_org = __msa_bmnz_v(p0_org, p0, negate_is_less_than_beta);",
"}",
"{",
"v16u8 q2_asub_q0;",
"q2_asub_q0 = __msa_asub_u_b(q2_org, q0_org);",
"is_less_than_beta = (q2_asub_q0 < beta);",
"}",
"is_less_than_beta = is_less_than_beta & tmp_flag;",
"negate_is_less_than_beta = __msa_xori_b(is_less_than_beta, 0xff);",
"is_less_than_beta = is_less_than_beta & is_less_than;",
"negate_is_less_than_beta = negate_is_less_than_beta & is_less_than;",
"{",
"v16u8 is_less_than_beta_r;",
"is_less_than_beta_r =\n(v16u8) __msa_sldi_b((v16i8) is_less_than_beta, zero, 8);",
"if (!__msa_test_bz_v(is_less_than_beta_r)) {",
"v8i16 q3_org_r;",
"q3_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q3_org);",
"q2_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q2_org);",
"AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(q3_org_r, q0_org_r,\np0_org_r, q1_org_r,\nq2_r, p1_org_r,\nq0_r, q1_r, q2_r);",
"}",
"}",
"{",
"v16u8 is_less_than_beta_l;",
"is_less_than_beta_l =\n(v16u8) __msa_sldi_b(zero, (v16i8) is_less_than_beta, 8);",
"if (!__msa_test_bz_v(is_less_than_beta_l)) {",
"v8i16 q3_org_l;",
"q3_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q3_org);",
"q2_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q2_org);",
"AVC_LOOP_FILTER_P0P1P2_OR_Q0Q1Q2(q3_org_l, q0_org_l,\np0_org_l, q1_org_l,\nq2_l, p1_org_l,\nq0_l, q1_l, q2_l);",
"}",
"}",
"if (!__msa_test_bz_v(is_less_than_beta)) {",
"v16u8 q0, q1, q2;",
"q0 = (v16u8) __msa_pckev_b((v16i8) q0_l, (v16i8) q0_r);",
"q1 = (v16u8) __msa_pckev_b((v16i8) q1_l, (v16i8) q1_r);",
"q2 = (v16u8) __msa_pckev_b((v16i8) q2_l, (v16i8) q2_r);",
"q0_org = __msa_bmnz_v(q0_org, q0, is_less_than_beta);",
"q1_org = __msa_bmnz_v(q1_org, q1, is_less_than_beta);",
"q2_org = __msa_bmnz_v(q2_org, q2, is_less_than_beta);",
"}",
"{",
"v16u8 negate_is_less_than_beta_r;",
"negate_is_less_than_beta_r =\n(v16u8) __msa_sldi_b((v16i8) negate_is_less_than_beta, zero, 8);",
"if (!__msa_test_bz_v(negate_is_less_than_beta_r)) {",
"AVC_LOOP_FILTER_P0_OR_Q0(q0_org_r, p1_org_r, q1_org_r, q0_r);",
"}",
"}",
"{",
"v16u8 negate_is_less_than_beta_l;",
"negate_is_less_than_beta_l =\n(v16u8) __msa_sldi_b(zero, (v16i8) negate_is_less_than_beta, 8);",
"if (!__msa_test_bz_v(negate_is_less_than_beta_l)) {",
"AVC_LOOP_FILTER_P0_OR_Q0(q0_org_l, p1_org_l, q1_org_l, q0_l);",
"}",
"}",
"if (!__msa_test_bz_v(negate_is_less_than_beta)) {",
"v16u8 q0;",
"q0 = (v16u8) __msa_pckev_b((v16i8) q0_l, (v16i8) q0_r);",
"q0_org = __msa_bmnz_v(q0_org, q0, negate_is_less_than_beta);",
"}",
"}",
"{",
"v16u8 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;",
"uint32_t out0, out2;",
"uint16_t out1, out3;",
"tmp0 = (v16u8) __msa_ilvr_b((v16i8) p1_org, (v16i8) p2_org);",
"tmp1 = (v16u8) __msa_ilvr_b((v16i8) q0_org, (v16i8) p0_org);",
"tmp2 = (v16u8) __msa_ilvr_b((v16i8) q2_org, (v16i8) q1_org);",
"tmp3 = (v16u8) __msa_ilvr_h((v8i16) tmp1, (v8i16) tmp0);",
"tmp4 = (v16u8) __msa_ilvl_h((v8i16) tmp1, (v8i16) tmp0);",
"tmp0 = (v16u8) __msa_ilvl_b((v16i8) p1_org, (v16i8) p2_org);",
"tmp1 = (v16u8) __msa_ilvl_b((v16i8) q0_org, (v16i8) p0_org);",
"tmp5 = (v16u8) __msa_ilvl_b((v16i8) q2_org, (v16i8) q1_org);",
"tmp6 = (v16u8) __msa_ilvr_h((v8i16) tmp1, (v8i16) tmp0);",
"tmp7 = (v16u8) __msa_ilvl_h((v8i16) tmp1, (v8i16) tmp0);",
"src = VAR_0 - 3;",
"out0 = __msa_copy_u_w((v4i32) tmp3, 0);",
"out1 = __msa_copy_u_h((v8i16) tmp2, 0);",
"out2 = __msa_copy_u_w((v4i32) tmp3, 1);",
"out3 = __msa_copy_u_h((v8i16) tmp2, 1);",
"STORE_WORD(src, out0);",
"STORE_HWORD((src + 4), out1);",
"src += VAR_3;",
"STORE_WORD(src, out2);",
"STORE_HWORD((src + 4), out3);",
"out0 = __msa_copy_u_w((v4i32) tmp3, 2);",
"out1 = __msa_copy_u_h((v8i16) tmp2, 2);",
"out2 = __msa_copy_u_w((v4i32) tmp3, 3);",
"out3 = __msa_copy_u_h((v8i16) tmp2, 3);",
"src += VAR_3;",
"STORE_WORD(src, out0);",
"STORE_HWORD((src + 4), out1);",
"src += VAR_3;",
"STORE_WORD(src, out2);",
"STORE_HWORD((src + 4), out3);",
"out0 = __msa_copy_u_w((v4i32) tmp4, 0);",
"out1 = __msa_copy_u_h((v8i16) tmp2, 4);",
"out2 = __msa_copy_u_w((v4i32) tmp4, 1);",
"out3 = __msa_copy_u_h((v8i16) tmp2, 5);",
"src += VAR_3;",
"STORE_WORD(src, out0);",
"STORE_HWORD((src + 4), out1);",
"src += VAR_3;",
"STORE_WORD(src, out2);",
"STORE_HWORD((src + 4), out3);",
"out0 = __msa_copy_u_w((v4i32) tmp4, 2);",
"out1 = __msa_copy_u_h((v8i16) tmp2, 6);",
"out2 = __msa_copy_u_w((v4i32) tmp4, 3);",
"out3 = __msa_copy_u_h((v8i16) tmp2, 7);",
"src += VAR_3;",
"STORE_WORD(src, out0);",
"STORE_HWORD((src + 4), out1);",
"src += VAR_3;",
"STORE_WORD(src, out2);",
"STORE_HWORD((src + 4), out3);",
"out0 = __msa_copy_u_w((v4i32) tmp6, 0);",
"out1 = __msa_copy_u_h((v8i16) tmp5, 0);",
"out2 = __msa_copy_u_w((v4i32) tmp6, 1);",
"out3 = __msa_copy_u_h((v8i16) tmp5, 1);",
"src += VAR_3;",
"STORE_WORD(src, out0);",
"STORE_HWORD((src + 4), out1);",
"src += VAR_3;",
"STORE_WORD(src, out2);",
"STORE_HWORD((src + 4), out3);",
"out0 = __msa_copy_u_w((v4i32) tmp6, 2);",
"out1 = __msa_copy_u_h((v8i16) tmp5, 2);",
"out2 = __msa_copy_u_w((v4i32) tmp6, 3);",
"out3 = __msa_copy_u_h((v8i16) tmp5, 3);",
"src += VAR_3;",
"STORE_WORD(src, out0);",
"STORE_HWORD((src + 4), out1);",
"src += VAR_3;",
"STORE_WORD(src, out2);",
"STORE_HWORD((src + 4), out3);",
"out0 = __msa_copy_u_w((v4i32) tmp7, 0);",
"out1 = __msa_copy_u_h((v8i16) tmp5, 4);",
"out2 = __msa_copy_u_w((v4i32) tmp7, 1);",
"out3 = __msa_copy_u_h((v8i16) tmp5, 5);",
"src += VAR_3;",
"STORE_WORD(src, out0);",
"STORE_HWORD((src + 4), out1);",
"src += VAR_3;",
"STORE_WORD(src, out2);",
"STORE_HWORD((src + 4), out3);",
"out0 = __msa_copy_u_w((v4i32) tmp7, 2);",
"out1 = __msa_copy_u_h((v8i16) tmp5, 6);",
"out2 = __msa_copy_u_w((v4i32) tmp7, 3);",
"out3 = __msa_copy_u_h((v8i16) tmp5, 7);",
"src += VAR_3;",
"STORE_WORD(src, out0);",
"STORE_HWORD((src + 4), out1);",
"src += VAR_3;",
"STORE_WORD(src, out2);",
"STORE_HWORD((src + 4), out3);",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5,
7,
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
55
],
[
59
],
[
61
],
[
63
],
[
67,
69
],
[
71,
73
],
[
77,
79,
81,
83
],
[
85
],
[
89
],
[
91
],
[
93
],
[
95
],
[
99
],
[
101
],
[
103
],
[
105
],
[
115
],
[
117
],
[
121
],
[
123
],
[
125
],
[
129
],
[
131
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
149
],
[
151
],
[
153
],
[
155
],
[
159
],
[
161
],
[
165
],
[
167
],
[
169
],
[
173
],
[
177
],
[
179
],
[
181
],
[
187
],
[
189
],
[
193,
195
],
[
197
],
[
199
],
[
203
],
[
205
],
[
209,
211,
213,
215
],
[
217
],
[
219
],
[
223
],
[
225
],
[
229,
231
],
[
233
],
[
235
],
[
239
],
[
241
],
[
245,
247,
249,
251
],
[
253
],
[
255
],
[
261
],
[
263
],
[
267
],
[
269
],
[
271
],
[
275
],
[
277
],
[
279
],
[
281
],
[
287
],
[
289
],
[
293,
295
],
[
299
],
[
301
],
[
303
],
[
305
],
[
311
],
[
313
],
[
317,
319
],
[
321
],
[
323
],
[
325
],
[
327
],
[
331
],
[
333
],
[
337
],
[
339
],
[
341
],
[
345
],
[
347
],
[
351
],
[
353
],
[
355
],
[
359
],
[
361
],
[
365
],
[
367
],
[
373
],
[
375
],
[
379,
381
],
[
383
],
[
385
],
[
389
],
[
391
],
[
395,
397,
399,
401
],
[
403
],
[
405
],
[
411
],
[
413
],
[
417,
419
],
[
421
],
[
423
],
[
427
],
[
429
],
[
433,
435,
437,
439
],
[
441
],
[
443
],
[
449
],
[
451
],
[
455
],
[
457
],
[
459
],
[
463
],
[
465
],
[
467
],
[
469
],
[
475
],
[
477
],
[
481,
483
],
[
485
],
[
487
],
[
489
],
[
491
],
[
495
],
[
497
],
[
501,
503
],
[
505
],
[
507
],
[
509
],
[
511
],
[
515
],
[
517
],
[
521
],
[
523
],
[
525
],
[
527
],
[
531
],
[
533
],
[
535
],
[
537
],
[
541
],
[
543
],
[
545
],
[
547
],
[
549
],
[
553
],
[
555
],
[
557
],
[
559
],
[
561
],
[
565
],
[
569
],
[
571
],
[
573
],
[
575
],
[
579
],
[
581
],
[
583
],
[
585
],
[
587
],
[
591
],
[
593
],
[
595
],
[
597
],
[
601
],
[
603
],
[
605
],
[
607
],
[
609
],
[
611
],
[
615
],
[
617
],
[
619
],
[
621
],
[
625
],
[
627
],
[
629
],
[
631
],
[
633
],
[
635
],
[
639
],
[
641
],
[
643
],
[
645
],
[
649
],
[
651
],
[
653
],
[
655
],
[
657
],
[
659
],
[
663
],
[
665
],
[
667
],
[
669
],
[
673
],
[
675
],
[
677
],
[
679
],
[
681
],
[
683
],
[
687
],
[
689
],
[
691
],
[
693
],
[
697
],
[
699
],
[
701
],
[
703
],
[
705
],
[
707
],
[
711
],
[
713
],
[
715
],
[
717
],
[
721
],
[
723
],
[
725
],
[
727
],
[
729
],
[
731
],
[
735
],
[
737
],
[
739
],
[
741
],
[
745
],
[
747
],
[
749
],
[
751
],
[
753
],
[
755
],
[
757
],
[
759
]
]
|
14,868 | static int dshow_read_packet(AVFormatContext *s, AVPacket *pkt)
{
struct dshow_ctx *ctx = s->priv_data;
AVPacketList *pktl = NULL;
while (!pktl) {
WaitForSingleObject(ctx->mutex, INFINITE);
pktl = ctx->pktl;
if (pktl) {
*pkt = pktl->pkt;
ctx->pktl = ctx->pktl->next;
av_free(pktl);
ctx->curbufsize -= pkt->size;
}
ResetEvent(ctx->event);
ReleaseMutex(ctx->mutex);
if (!pktl) {
if (s->flags & AVFMT_FLAG_NONBLOCK) {
return AVERROR(EAGAIN);
} else {
WaitForSingleObject(ctx->event, INFINITE);
}
}
}
return pkt->size;
}
| false | FFmpeg | 190f6135b48a97dadd7586f154640bec6468df1b | static int dshow_read_packet(AVFormatContext *s, AVPacket *pkt)
{
struct dshow_ctx *ctx = s->priv_data;
AVPacketList *pktl = NULL;
while (!pktl) {
WaitForSingleObject(ctx->mutex, INFINITE);
pktl = ctx->pktl;
if (pktl) {
*pkt = pktl->pkt;
ctx->pktl = ctx->pktl->next;
av_free(pktl);
ctx->curbufsize -= pkt->size;
}
ResetEvent(ctx->event);
ReleaseMutex(ctx->mutex);
if (!pktl) {
if (s->flags & AVFMT_FLAG_NONBLOCK) {
return AVERROR(EAGAIN);
} else {
WaitForSingleObject(ctx->event, INFINITE);
}
}
}
return pkt->size;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1)
{
struct dshow_ctx *VAR_2 = VAR_0->priv_data;
AVPacketList *pktl = NULL;
while (!pktl) {
WaitForSingleObject(VAR_2->mutex, INFINITE);
pktl = VAR_2->pktl;
if (pktl) {
*VAR_1 = pktl->VAR_1;
VAR_2->pktl = VAR_2->pktl->next;
av_free(pktl);
VAR_2->curbufsize -= VAR_1->size;
}
ResetEvent(VAR_2->event);
ReleaseMutex(VAR_2->mutex);
if (!pktl) {
if (VAR_0->flags & AVFMT_FLAG_NONBLOCK) {
return AVERROR(EAGAIN);
} else {
WaitForSingleObject(VAR_2->event, INFINITE);
}
}
}
return VAR_1->size;
}
| [
"static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1)\n{",
"struct dshow_ctx *VAR_2 = VAR_0->priv_data;",
"AVPacketList *pktl = NULL;",
"while (!pktl) {",
"WaitForSingleObject(VAR_2->mutex, INFINITE);",
"pktl = VAR_2->pktl;",
"if (pktl) {",
"*VAR_1 = pktl->VAR_1;",
"VAR_2->pktl = VAR_2->pktl->next;",
"av_free(pktl);",
"VAR_2->curbufsize -= VAR_1->size;",
"}",
"ResetEvent(VAR_2->event);",
"ReleaseMutex(VAR_2->mutex);",
"if (!pktl) {",
"if (VAR_0->flags & AVFMT_FLAG_NONBLOCK) {",
"return AVERROR(EAGAIN);",
"} else {",
"WaitForSingleObject(VAR_2->event, INFINITE);",
"}",
"}",
"}",
"return VAR_1->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
]
| [
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
51
],
[
53
]
]
|
14,869 | static void blend_image(AVFilterContext *ctx,
AVFilterBufferRef *dst, AVFilterBufferRef *src,
int x, int y)
{
OverlayContext *over = ctx->priv;
int i, j, k;
int width = src->video->w;
int height = src->video->h;
if (over->main_is_packed_rgb) {
uint8_t *dp = dst->data[0] + x * over->main_pix_step[0] +
y * dst->linesize[0];
uint8_t *sp = src->data[0];
uint8_t alpha; ///< the amount of overlay to blend on to main
const int dr = over->main_rgba_map[R];
const int dg = over->main_rgba_map[G];
const int db = over->main_rgba_map[B];
const int da = over->main_rgba_map[A];
const int dstep = over->main_pix_step[0];
const int sr = over->overlay_rgba_map[R];
const int sg = over->overlay_rgba_map[G];
const int sb = over->overlay_rgba_map[B];
const int sa = over->overlay_rgba_map[A];
const int sstep = over->overlay_pix_step[0];
const int main_has_alpha = over->main_has_alpha;
for (i = 0; i < height; i++) {
uint8_t *d = dp, *s = sp;
for (j = 0; j < width; j++) {
alpha = s[sa];
// if the main channel has an alpha channel, alpha has to be calculated
// to create an un-premultiplied (straight) alpha value
if (main_has_alpha && alpha != 0 && alpha != 255) {
uint8_t alpha_d = d[da];
alpha = UNPREMULTIPLY_ALPHA(alpha, alpha_d);
}
switch (alpha) {
case 0:
break;
case 255:
d[dr] = s[sr];
d[dg] = s[sg];
d[db] = s[sb];
break;
default:
// main_value = main_value * (1 - alpha) + overlay_value * alpha
// since alpha is in the range 0-255, the result must divided by 255
d[dr] = FAST_DIV255(d[dr] * (255 - alpha) + s[sr] * alpha);
d[dg] = FAST_DIV255(d[dg] * (255 - alpha) + s[sg] * alpha);
d[db] = FAST_DIV255(d[db] * (255 - alpha) + s[sb] * alpha);
}
if (main_has_alpha) {
switch (alpha) {
case 0:
break;
case 255:
d[da] = s[sa];
break;
default:
// apply alpha compositing: main_alpha += (1-main_alpha) * overlay_alpha
d[da] += FAST_DIV255((255 - d[da]) * s[sa]);
}
}
d += dstep;
s += sstep;
}
dp += dst->linesize[0];
sp += src->linesize[0];
}
} else {
const int main_has_alpha = over->main_has_alpha;
if (main_has_alpha) {
uint8_t *da = dst->data[3] + x * over->main_pix_step[3] +
y * dst->linesize[3];
uint8_t *sa = src->data[3];
uint8_t alpha; ///< the amount of overlay to blend on to main
for (i = 0; i < height; i++) {
uint8_t *d = da, *s = sa;
for (j = 0; j < width; j++) {
alpha = *s;
if (alpha != 0 && alpha != 255) {
uint8_t alpha_d = *d;
alpha = UNPREMULTIPLY_ALPHA(alpha, alpha_d);
}
switch (alpha) {
case 0:
break;
case 255:
*d = *s;
break;
default:
// apply alpha compositing: main_alpha += (1-main_alpha) * overlay_alpha
*d += FAST_DIV255((255 - *d) * *s);
}
d += 1;
s += 1;
}
da += dst->linesize[3];
sa += src->linesize[3];
}
}
for (i = 0; i < 3; i++) {
int hsub = i ? over->hsub : 0;
int vsub = i ? over->vsub : 0;
uint8_t *dp = dst->data[i] + (x >> hsub) +
(y >> vsub) * dst->linesize[i];
uint8_t *sp = src->data[i];
uint8_t *ap = src->data[3];
int wp = FFALIGN(width, 1<<hsub) >> hsub;
int hp = FFALIGN(height, 1<<vsub) >> vsub;
for (j = 0; j < hp; j++) {
uint8_t *d = dp, *s = sp, *a = ap;
for (k = 0; k < wp; k++) {
// average alpha for color components, improve quality
int alpha_v, alpha_h, alpha;
if (hsub && vsub && j+1 < hp && k+1 < wp) {
alpha = (a[0] + a[src->linesize[3]] +
a[1] + a[src->linesize[3]+1]) >> 2;
} else if (hsub || vsub) {
alpha_h = hsub && k+1 < wp ?
(a[0] + a[1]) >> 1 : a[0];
alpha_v = vsub && j+1 < hp ?
(a[0] + a[src->linesize[3]]) >> 1 : a[0];
alpha = (alpha_v + alpha_h) >> 1;
} else
alpha = a[0];
// if the main channel has an alpha channel, alpha has to be calculated
// to create an un-premultiplied (straight) alpha value
if (main_has_alpha && alpha != 0 && alpha != 255) {
// average alpha for color components, improve quality
uint8_t alpha_d;
if (hsub && vsub && j+1 < hp && k+1 < wp) {
alpha_d = (d[0] + d[src->linesize[3]] +
d[1] + d[src->linesize[3]+1]) >> 2;
} else if (hsub || vsub) {
alpha_h = hsub && k+1 < wp ?
(d[0] + d[1]) >> 1 : d[0];
alpha_v = vsub && j+1 < hp ?
(d[0] + d[src->linesize[3]]) >> 1 : d[0];
alpha_d = (alpha_v + alpha_h) >> 1;
} else
alpha_d = d[0];
alpha = UNPREMULTIPLY_ALPHA(alpha, alpha_d);
}
*d = FAST_DIV255(*d * (255 - alpha) + *s * alpha);
s++;
d++;
a += 1 << hsub;
}
dp += dst->linesize[i];
sp += src->linesize[i];
ap += (1 << vsub) * src->linesize[3];
}
}
}
}
| false | FFmpeg | f164228fd793766187ed3e68cb6d6e2fe3e77c04 | static void blend_image(AVFilterContext *ctx,
AVFilterBufferRef *dst, AVFilterBufferRef *src,
int x, int y)
{
OverlayContext *over = ctx->priv;
int i, j, k;
int width = src->video->w;
int height = src->video->h;
if (over->main_is_packed_rgb) {
uint8_t *dp = dst->data[0] + x * over->main_pix_step[0] +
y * dst->linesize[0];
uint8_t *sp = src->data[0];
uint8_t alpha;
const int dr = over->main_rgba_map[R];
const int dg = over->main_rgba_map[G];
const int db = over->main_rgba_map[B];
const int da = over->main_rgba_map[A];
const int dstep = over->main_pix_step[0];
const int sr = over->overlay_rgba_map[R];
const int sg = over->overlay_rgba_map[G];
const int sb = over->overlay_rgba_map[B];
const int sa = over->overlay_rgba_map[A];
const int sstep = over->overlay_pix_step[0];
const int main_has_alpha = over->main_has_alpha;
for (i = 0; i < height; i++) {
uint8_t *d = dp, *s = sp;
for (j = 0; j < width; j++) {
alpha = s[sa];
if (main_has_alpha && alpha != 0 && alpha != 255) {
uint8_t alpha_d = d[da];
alpha = UNPREMULTIPLY_ALPHA(alpha, alpha_d);
}
switch (alpha) {
case 0:
break;
case 255:
d[dr] = s[sr];
d[dg] = s[sg];
d[db] = s[sb];
break;
default:
d[dr] = FAST_DIV255(d[dr] * (255 - alpha) + s[sr] * alpha);
d[dg] = FAST_DIV255(d[dg] * (255 - alpha) + s[sg] * alpha);
d[db] = FAST_DIV255(d[db] * (255 - alpha) + s[sb] * alpha);
}
if (main_has_alpha) {
switch (alpha) {
case 0:
break;
case 255:
d[da] = s[sa];
break;
default:
d[da] += FAST_DIV255((255 - d[da]) * s[sa]);
}
}
d += dstep;
s += sstep;
}
dp += dst->linesize[0];
sp += src->linesize[0];
}
} else {
const int main_has_alpha = over->main_has_alpha;
if (main_has_alpha) {
uint8_t *da = dst->data[3] + x * over->main_pix_step[3] +
y * dst->linesize[3];
uint8_t *sa = src->data[3];
uint8_t alpha;
for (i = 0; i < height; i++) {
uint8_t *d = da, *s = sa;
for (j = 0; j < width; j++) {
alpha = *s;
if (alpha != 0 && alpha != 255) {
uint8_t alpha_d = *d;
alpha = UNPREMULTIPLY_ALPHA(alpha, alpha_d);
}
switch (alpha) {
case 0:
break;
case 255:
*d = *s;
break;
default:
*d += FAST_DIV255((255 - *d) * *s);
}
d += 1;
s += 1;
}
da += dst->linesize[3];
sa += src->linesize[3];
}
}
for (i = 0; i < 3; i++) {
int hsub = i ? over->hsub : 0;
int vsub = i ? over->vsub : 0;
uint8_t *dp = dst->data[i] + (x >> hsub) +
(y >> vsub) * dst->linesize[i];
uint8_t *sp = src->data[i];
uint8_t *ap = src->data[3];
int wp = FFALIGN(width, 1<<hsub) >> hsub;
int hp = FFALIGN(height, 1<<vsub) >> vsub;
for (j = 0; j < hp; j++) {
uint8_t *d = dp, *s = sp, *a = ap;
for (k = 0; k < wp; k++) {
int alpha_v, alpha_h, alpha;
if (hsub && vsub && j+1 < hp && k+1 < wp) {
alpha = (a[0] + a[src->linesize[3]] +
a[1] + a[src->linesize[3]+1]) >> 2;
} else if (hsub || vsub) {
alpha_h = hsub && k+1 < wp ?
(a[0] + a[1]) >> 1 : a[0];
alpha_v = vsub && j+1 < hp ?
(a[0] + a[src->linesize[3]]) >> 1 : a[0];
alpha = (alpha_v + alpha_h) >> 1;
} else
alpha = a[0];
if (main_has_alpha && alpha != 0 && alpha != 255) {
uint8_t alpha_d;
if (hsub && vsub && j+1 < hp && k+1 < wp) {
alpha_d = (d[0] + d[src->linesize[3]] +
d[1] + d[src->linesize[3]+1]) >> 2;
} else if (hsub || vsub) {
alpha_h = hsub && k+1 < wp ?
(d[0] + d[1]) >> 1 : d[0];
alpha_v = vsub && j+1 < hp ?
(d[0] + d[src->linesize[3]]) >> 1 : d[0];
alpha_d = (alpha_v + alpha_h) >> 1;
} else
alpha_d = d[0];
alpha = UNPREMULTIPLY_ALPHA(alpha, alpha_d);
}
*d = FAST_DIV255(*d * (255 - alpha) + *s * alpha);
s++;
d++;
a += 1 << hsub;
}
dp += dst->linesize[i];
sp += src->linesize[i];
ap += (1 << vsub) * src->linesize[3];
}
}
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(AVFilterContext *VAR_0,
AVFilterBufferRef *VAR_1, AVFilterBufferRef *VAR_2,
int VAR_3, int VAR_4)
{
OverlayContext *over = VAR_0->priv;
int VAR_5, VAR_6, VAR_7;
int VAR_8 = VAR_2->video->w;
int VAR_9 = VAR_2->video->h;
if (over->main_is_packed_rgb) {
uint8_t *dp = VAR_1->data[0] + VAR_3 * over->main_pix_step[0] +
VAR_4 * VAR_1->linesize[0];
uint8_t *sp = VAR_2->data[0];
uint8_t VAR_27;
const int VAR_10 = over->main_rgba_map[R];
const int VAR_11 = over->main_rgba_map[G];
const int VAR_12 = over->main_rgba_map[B];
const int VAR_13 = over->main_rgba_map[A];
const int VAR_14 = over->main_pix_step[0];
const int VAR_15 = over->overlay_rgba_map[R];
const int VAR_16 = over->overlay_rgba_map[G];
const int VAR_17 = over->overlay_rgba_map[B];
const int VAR_18 = over->overlay_rgba_map[A];
const int VAR_19 = over->overlay_pix_step[0];
const int VAR_21 = over->VAR_21;
for (VAR_5 = 0; VAR_5 < VAR_9; VAR_5++) {
uint8_t *d = dp, *s = sp;
for (VAR_6 = 0; VAR_6 < VAR_8; VAR_6++) {
VAR_27 = s[VAR_18];
if (VAR_21 && VAR_27 != 0 && VAR_27 != 255) {
uint8_t alpha_d = d[VAR_13];
VAR_27 = UNPREMULTIPLY_ALPHA(VAR_27, alpha_d);
}
switch (VAR_27) {
case 0:
break;
case 255:
d[VAR_10] = s[VAR_15];
d[VAR_11] = s[VAR_16];
d[VAR_12] = s[VAR_17];
break;
default:
d[VAR_10] = FAST_DIV255(d[VAR_10] * (255 - VAR_27) + s[VAR_15] * VAR_27);
d[VAR_11] = FAST_DIV255(d[VAR_11] * (255 - VAR_27) + s[VAR_16] * VAR_27);
d[VAR_12] = FAST_DIV255(d[VAR_12] * (255 - VAR_27) + s[VAR_17] * VAR_27);
}
if (VAR_21) {
switch (VAR_27) {
case 0:
break;
case 255:
d[VAR_13] = s[VAR_18];
break;
default:
d[VAR_13] += FAST_DIV255((255 - d[VAR_13]) * s[VAR_18]);
}
}
d += VAR_14;
s += VAR_19;
}
dp += VAR_1->linesize[0];
sp += VAR_2->linesize[0];
}
} else {
const int VAR_21 = over->VAR_21;
if (VAR_21) {
uint8_t *VAR_13 = VAR_1->data[3] + VAR_3 * over->main_pix_step[3] +
VAR_4 * VAR_1->linesize[3];
uint8_t *VAR_18 = VAR_2->data[3];
uint8_t VAR_27;
for (VAR_5 = 0; VAR_5 < VAR_9; VAR_5++) {
uint8_t *d = VAR_13, *s = VAR_18;
for (VAR_6 = 0; VAR_6 < VAR_8; VAR_6++) {
VAR_27 = *s;
if (VAR_27 != 0 && VAR_27 != 255) {
uint8_t alpha_d = *d;
VAR_27 = UNPREMULTIPLY_ALPHA(VAR_27, alpha_d);
}
switch (VAR_27) {
case 0:
break;
case 255:
*d = *s;
break;
default:
*d += FAST_DIV255((255 - *d) * *s);
}
d += 1;
s += 1;
}
VAR_13 += VAR_1->linesize[3];
VAR_18 += VAR_2->linesize[3];
}
}
for (VAR_5 = 0; VAR_5 < 3; VAR_5++) {
int VAR_21 = VAR_5 ? over->VAR_21 : 0;
int VAR_22 = VAR_5 ? over->VAR_22 : 0;
uint8_t *dp = VAR_1->data[VAR_5] + (VAR_3 >> VAR_21) +
(VAR_4 >> VAR_22) * VAR_1->linesize[VAR_5];
uint8_t *sp = VAR_2->data[VAR_5];
uint8_t *ap = VAR_2->data[3];
int VAR_23 = FFALIGN(VAR_8, 1<<VAR_21) >> VAR_21;
int VAR_24 = FFALIGN(VAR_9, 1<<VAR_22) >> VAR_22;
for (VAR_6 = 0; VAR_6 < VAR_24; VAR_6++) {
uint8_t *d = dp, *s = sp, *a = ap;
for (VAR_7 = 0; VAR_7 < VAR_23; VAR_7++) {
int VAR_25, VAR_26, VAR_27;
if (VAR_21 && VAR_22 && VAR_6+1 < VAR_24 && VAR_7+1 < VAR_23) {
VAR_27 = (a[0] + a[VAR_2->linesize[3]] +
a[1] + a[VAR_2->linesize[3]+1]) >> 2;
} else if (VAR_21 || VAR_22) {
VAR_26 = VAR_21 && VAR_7+1 < VAR_23 ?
(a[0] + a[1]) >> 1 : a[0];
VAR_25 = VAR_22 && VAR_6+1 < VAR_24 ?
(a[0] + a[VAR_2->linesize[3]]) >> 1 : a[0];
VAR_27 = (VAR_25 + VAR_26) >> 1;
} else
VAR_27 = a[0];
if (VAR_21 && VAR_27 != 0 && VAR_27 != 255) {
uint8_t alpha_d;
if (VAR_21 && VAR_22 && VAR_6+1 < VAR_24 && VAR_7+1 < VAR_23) {
alpha_d = (d[0] + d[VAR_2->linesize[3]] +
d[1] + d[VAR_2->linesize[3]+1]) >> 2;
} else if (VAR_21 || VAR_22) {
VAR_26 = VAR_21 && VAR_7+1 < VAR_23 ?
(d[0] + d[1]) >> 1 : d[0];
VAR_25 = VAR_22 && VAR_6+1 < VAR_24 ?
(d[0] + d[VAR_2->linesize[3]]) >> 1 : d[0];
alpha_d = (VAR_25 + VAR_26) >> 1;
} else
alpha_d = d[0];
VAR_27 = UNPREMULTIPLY_ALPHA(VAR_27, alpha_d);
}
*d = FAST_DIV255(*d * (255 - VAR_27) + *s * VAR_27);
s++;
d++;
a += 1 << VAR_21;
}
dp += VAR_1->linesize[VAR_5];
sp += VAR_2->linesize[VAR_5];
ap += (1 << VAR_22) * VAR_2->linesize[3];
}
}
}
}
| [
"static void FUNC_0(AVFilterContext *VAR_0,\nAVFilterBufferRef *VAR_1, AVFilterBufferRef *VAR_2,\nint VAR_3, int VAR_4)\n{",
"OverlayContext *over = VAR_0->priv;",
"int VAR_5, VAR_6, VAR_7;",
"int VAR_8 = VAR_2->video->w;",
"int VAR_9 = VAR_2->video->h;",
"if (over->main_is_packed_rgb) {",
"uint8_t *dp = VAR_1->data[0] + VAR_3 * over->main_pix_step[0] +\nVAR_4 * VAR_1->linesize[0];",
"uint8_t *sp = VAR_2->data[0];",
"uint8_t VAR_27;",
"const int VAR_10 = over->main_rgba_map[R];",
"const int VAR_11 = over->main_rgba_map[G];",
"const int VAR_12 = over->main_rgba_map[B];",
"const int VAR_13 = over->main_rgba_map[A];",
"const int VAR_14 = over->main_pix_step[0];",
"const int VAR_15 = over->overlay_rgba_map[R];",
"const int VAR_16 = over->overlay_rgba_map[G];",
"const int VAR_17 = over->overlay_rgba_map[B];",
"const int VAR_18 = over->overlay_rgba_map[A];",
"const int VAR_19 = over->overlay_pix_step[0];",
"const int VAR_21 = over->VAR_21;",
"for (VAR_5 = 0; VAR_5 < VAR_9; VAR_5++) {",
"uint8_t *d = dp, *s = sp;",
"for (VAR_6 = 0; VAR_6 < VAR_8; VAR_6++) {",
"VAR_27 = s[VAR_18];",
"if (VAR_21 && VAR_27 != 0 && VAR_27 != 255) {",
"uint8_t alpha_d = d[VAR_13];",
"VAR_27 = UNPREMULTIPLY_ALPHA(VAR_27, alpha_d);",
"}",
"switch (VAR_27) {",
"case 0:\nbreak;",
"case 255:\nd[VAR_10] = s[VAR_15];",
"d[VAR_11] = s[VAR_16];",
"d[VAR_12] = s[VAR_17];",
"break;",
"default:\nd[VAR_10] = FAST_DIV255(d[VAR_10] * (255 - VAR_27) + s[VAR_15] * VAR_27);",
"d[VAR_11] = FAST_DIV255(d[VAR_11] * (255 - VAR_27) + s[VAR_16] * VAR_27);",
"d[VAR_12] = FAST_DIV255(d[VAR_12] * (255 - VAR_27) + s[VAR_17] * VAR_27);",
"}",
"if (VAR_21) {",
"switch (VAR_27) {",
"case 0:\nbreak;",
"case 255:\nd[VAR_13] = s[VAR_18];",
"break;",
"default:\nd[VAR_13] += FAST_DIV255((255 - d[VAR_13]) * s[VAR_18]);",
"}",
"}",
"d += VAR_14;",
"s += VAR_19;",
"}",
"dp += VAR_1->linesize[0];",
"sp += VAR_2->linesize[0];",
"}",
"} else {",
"const int VAR_21 = over->VAR_21;",
"if (VAR_21) {",
"uint8_t *VAR_13 = VAR_1->data[3] + VAR_3 * over->main_pix_step[3] +\nVAR_4 * VAR_1->linesize[3];",
"uint8_t *VAR_18 = VAR_2->data[3];",
"uint8_t VAR_27;",
"for (VAR_5 = 0; VAR_5 < VAR_9; VAR_5++) {",
"uint8_t *d = VAR_13, *s = VAR_18;",
"for (VAR_6 = 0; VAR_6 < VAR_8; VAR_6++) {",
"VAR_27 = *s;",
"if (VAR_27 != 0 && VAR_27 != 255) {",
"uint8_t alpha_d = *d;",
"VAR_27 = UNPREMULTIPLY_ALPHA(VAR_27, alpha_d);",
"}",
"switch (VAR_27) {",
"case 0:\nbreak;",
"case 255:\n*d = *s;",
"break;",
"default:\n*d += FAST_DIV255((255 - *d) * *s);",
"}",
"d += 1;",
"s += 1;",
"}",
"VAR_13 += VAR_1->linesize[3];",
"VAR_18 += VAR_2->linesize[3];",
"}",
"}",
"for (VAR_5 = 0; VAR_5 < 3; VAR_5++) {",
"int VAR_21 = VAR_5 ? over->VAR_21 : 0;",
"int VAR_22 = VAR_5 ? over->VAR_22 : 0;",
"uint8_t *dp = VAR_1->data[VAR_5] + (VAR_3 >> VAR_21) +\n(VAR_4 >> VAR_22) * VAR_1->linesize[VAR_5];",
"uint8_t *sp = VAR_2->data[VAR_5];",
"uint8_t *ap = VAR_2->data[3];",
"int VAR_23 = FFALIGN(VAR_8, 1<<VAR_21) >> VAR_21;",
"int VAR_24 = FFALIGN(VAR_9, 1<<VAR_22) >> VAR_22;",
"for (VAR_6 = 0; VAR_6 < VAR_24; VAR_6++) {",
"uint8_t *d = dp, *s = sp, *a = ap;",
"for (VAR_7 = 0; VAR_7 < VAR_23; VAR_7++) {",
"int VAR_25, VAR_26, VAR_27;",
"if (VAR_21 && VAR_22 && VAR_6+1 < VAR_24 && VAR_7+1 < VAR_23) {",
"VAR_27 = (a[0] + a[VAR_2->linesize[3]] +\na[1] + a[VAR_2->linesize[3]+1]) >> 2;",
"} else if (VAR_21 || VAR_22) {",
"VAR_26 = VAR_21 && VAR_7+1 < VAR_23 ?\n(a[0] + a[1]) >> 1 : a[0];",
"VAR_25 = VAR_22 && VAR_6+1 < VAR_24 ?\n(a[0] + a[VAR_2->linesize[3]]) >> 1 : a[0];",
"VAR_27 = (VAR_25 + VAR_26) >> 1;",
"} else",
"VAR_27 = a[0];",
"if (VAR_21 && VAR_27 != 0 && VAR_27 != 255) {",
"uint8_t alpha_d;",
"if (VAR_21 && VAR_22 && VAR_6+1 < VAR_24 && VAR_7+1 < VAR_23) {",
"alpha_d = (d[0] + d[VAR_2->linesize[3]] +\nd[1] + d[VAR_2->linesize[3]+1]) >> 2;",
"} else if (VAR_21 || VAR_22) {",
"VAR_26 = VAR_21 && VAR_7+1 < VAR_23 ?\n(d[0] + d[1]) >> 1 : d[0];",
"VAR_25 = VAR_22 && VAR_6+1 < VAR_24 ?\n(d[0] + d[VAR_2->linesize[3]]) >> 1 : d[0];",
"alpha_d = (VAR_25 + VAR_26) >> 1;",
"} else",
"alpha_d = d[0];",
"VAR_27 = UNPREMULTIPLY_ALPHA(VAR_27, alpha_d);",
"}",
"*d = FAST_DIV255(*d * (255 - VAR_27) + *s * VAR_27);",
"s++;",
"d++;",
"a += 1 << VAR_21;",
"}",
"dp += VAR_1->linesize[VAR_5];",
"sp += VAR_2->linesize[VAR_5];",
"ap += (1 << VAR_22) * VAR_2->linesize[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
]
| [
[
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
],
[
57
],
[
65
],
[
67
],
[
69
],
[
71
],
[
75
],
[
77,
79
],
[
81,
83
],
[
85
],
[
87
],
[
89
],
[
91,
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109,
111
],
[
113,
115
],
[
117
],
[
119,
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147,
149
],
[
151
],
[
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165
],
[
167
],
[
169
],
[
171
],
[
173,
175
],
[
177,
179
],
[
181
],
[
183,
187
],
[
189
],
[
191
],
[
193
],
[
195
],
[
197
],
[
199
],
[
201
],
[
203
],
[
205
],
[
207
],
[
209
],
[
211,
213
],
[
215
],
[
217
],
[
219
],
[
221
],
[
223
],
[
225
],
[
227
],
[
231
],
[
233
],
[
235,
237
],
[
239
],
[
241,
243
],
[
245,
247
],
[
249
],
[
251
],
[
253
],
[
259
],
[
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
]
]
|
14,871 | static void draw_mandelbrot(AVFilterContext *ctx, uint32_t *color, int linesize, int64_t pts)
{
MBContext *mb = ctx->priv;
int x,y,i, in_cidx=0, next_cidx=0, tmp_cidx;
double scale= mb->start_scale*pow(mb->end_scale/mb->start_scale, pts/mb->end_pts);
int use_zyklus=0;
fill_from_cache(ctx, NULL, &in_cidx, NULL, mb->start_y+scale*(-mb->h/2-0.5), scale);
for(y=0; y<mb->h; y++){
const double ci=mb->start_y+scale*(y-mb->h/2);
memset(color+linesize*y, 0, sizeof(*color)*mb->w);
fill_from_cache(ctx, color+linesize*y, &in_cidx, &next_cidx, ci, scale);
tmp_cidx= in_cidx;
fill_from_cache(ctx, color+linesize*y, &tmp_cidx, NULL, ci + scale/2, scale);
for(x=0; x<mb->w; x++){
const double cr=mb->start_x+scale*(x-mb->w/2);
double zr=cr;
double zi=ci;
uint32_t c=0;
double dv= mb->dither / (double)(1LL<<32);
mb->dither= mb->dither*1664525+1013904223;
if(color[x + y*linesize] & 0xFF000000)
continue;
use_zyklus= (x==0 || mb->inner!=BLACK ||color[x-1 + y*linesize] == 0xFF000000);
#define Z_Z2_C(outr,outi,inr,ini)\
outr= inr*inr - ini*ini + cr;\
outi= 2*inr*ini + ci;
#define Z_Z2_C_ZYKLUS(outr,outi,inr,ini, Z)\
Z_Z2_C(outr,outi,inr,ini)\
if(use_zyklus){\
if(Z && mb->zyklus[i>>1][0]==outr && mb->zyklus[i>>1][1]==outi)\
break;\
mb->zyklus[i][0]= outr;\
mb->zyklus[i][1]= outi;\
}
for(i=0; i<mb->maxiter-8; i++){
double t;
Z_Z2_C_ZYKLUS(t, zi, zr, zi, 0)
i++;
Z_Z2_C_ZYKLUS(zr, zi, t, zi, 1)
i++;
Z_Z2_C_ZYKLUS(t, zi, zr, zi, 0)
i++;
Z_Z2_C_ZYKLUS(zr, zi, t, zi, 1)
i++;
Z_Z2_C_ZYKLUS(t, zi, zr, zi, 0)
i++;
Z_Z2_C_ZYKLUS(zr, zi, t, zi, 1)
i++;
Z_Z2_C_ZYKLUS(t, zi, zr, zi, 0)
i++;
Z_Z2_C_ZYKLUS(zr, zi, t, zi, 1)
if(zr*zr + zi*zi > mb->bailout){
i-= FFMIN(7, i);
for(; i<mb->maxiter; i++){
zr= mb->zyklus[i][0];
zi= mb->zyklus[i][1];
if(zr*zr + zi*zi > mb->bailout){
switch(mb->outer){
case ITERATION_COUNT: zr = i; break;
case NORMALIZED_ITERATION_COUNT: zr= i + log2(log(mb->bailout) / log(zr*zr + zi*zi)); break;
}
c= lrintf((sin(zr)+1)*127) + lrintf((sin(zr/1.234)+1)*127)*256*256 + lrintf((sin(zr/100)+1)*127)*256;
break;
}
}
break;
}
}
if(!c){
if(mb->inner==PERIOD){
int j;
for(j=i-1; j; j--)
if(SQR(mb->zyklus[j][0]-zr) + SQR(mb->zyklus[j][1]-zi) < 0.0000000000000001)
break;
if(j){
c= i-j;
c= ((c<<5)&0xE0) + ((c<<16)&0xE000) + ((c<<27)&0xE00000);
}
}else if(mb->inner==CONVTIME){
c= floor(i*255.0/mb->maxiter+dv)*0x010101;
} else if(mb->inner==MINCOL){
int j;
double closest=9999;
int closest_index=0;
for(j=i-1; j>=0; j--)
if(SQR(mb->zyklus[j][0]) + SQR(mb->zyklus[j][1]) < closest){
closest= SQR(mb->zyklus[j][0]) + SQR(mb->zyklus[j][1]);
closest_index= j;
}
closest = sqrt(closest);
c= lrintf((mb->zyklus[closest_index][0]/closest+1)*127+dv) + lrintf((mb->zyklus[closest_index][1]/closest+1)*127+dv)*256;
}
}
c |= 0xFF000000;
color[x + y*linesize]= c;
if(next_cidx < mb->cache_allocated){
mb->next_cache[next_cidx ].p[0]= cr;
mb->next_cache[next_cidx ].p[1]= ci;
mb->next_cache[next_cidx++].val = c;
}
}
fill_from_cache(ctx, NULL, &in_cidx, &next_cidx, ci + scale/2, scale);
}
FFSWAP(void*, mb->next_cache, mb->point_cache);
mb->cache_used = next_cidx;
if(mb->cache_used == mb->cache_allocated)
av_log(0, AV_LOG_INFO, "Mandelbrot cache is too small!\n");
}
| false | FFmpeg | 56fc4cf04f9ed878cf8e159981f5d136af807973 | static void draw_mandelbrot(AVFilterContext *ctx, uint32_t *color, int linesize, int64_t pts)
{
MBContext *mb = ctx->priv;
int x,y,i, in_cidx=0, next_cidx=0, tmp_cidx;
double scale= mb->start_scale*pow(mb->end_scale/mb->start_scale, pts/mb->end_pts);
int use_zyklus=0;
fill_from_cache(ctx, NULL, &in_cidx, NULL, mb->start_y+scale*(-mb->h/2-0.5), scale);
for(y=0; y<mb->h; y++){
const double ci=mb->start_y+scale*(y-mb->h/2);
memset(color+linesize*y, 0, sizeof(*color)*mb->w);
fill_from_cache(ctx, color+linesize*y, &in_cidx, &next_cidx, ci, scale);
tmp_cidx= in_cidx;
fill_from_cache(ctx, color+linesize*y, &tmp_cidx, NULL, ci + scale/2, scale);
for(x=0; x<mb->w; x++){
const double cr=mb->start_x+scale*(x-mb->w/2);
double zr=cr;
double zi=ci;
uint32_t c=0;
double dv= mb->dither / (double)(1LL<<32);
mb->dither= mb->dither*1664525+1013904223;
if(color[x + y*linesize] & 0xFF000000)
continue;
use_zyklus= (x==0 || mb->inner!=BLACK ||color[x-1 + y*linesize] == 0xFF000000);
#define Z_Z2_C(outr,outi,inr,ini)\
outr= inr*inr - ini*ini + cr;\
outi= 2*inr*ini + ci;
#define Z_Z2_C_ZYKLUS(outr,outi,inr,ini, Z)\
Z_Z2_C(outr,outi,inr,ini)\
if(use_zyklus){\
if(Z && mb->zyklus[i>>1][0]==outr && mb->zyklus[i>>1][1]==outi)\
break;\
mb->zyklus[i][0]= outr;\
mb->zyklus[i][1]= outi;\
}
for(i=0; i<mb->maxiter-8; i++){
double t;
Z_Z2_C_ZYKLUS(t, zi, zr, zi, 0)
i++;
Z_Z2_C_ZYKLUS(zr, zi, t, zi, 1)
i++;
Z_Z2_C_ZYKLUS(t, zi, zr, zi, 0)
i++;
Z_Z2_C_ZYKLUS(zr, zi, t, zi, 1)
i++;
Z_Z2_C_ZYKLUS(t, zi, zr, zi, 0)
i++;
Z_Z2_C_ZYKLUS(zr, zi, t, zi, 1)
i++;
Z_Z2_C_ZYKLUS(t, zi, zr, zi, 0)
i++;
Z_Z2_C_ZYKLUS(zr, zi, t, zi, 1)
if(zr*zr + zi*zi > mb->bailout){
i-= FFMIN(7, i);
for(; i<mb->maxiter; i++){
zr= mb->zyklus[i][0];
zi= mb->zyklus[i][1];
if(zr*zr + zi*zi > mb->bailout){
switch(mb->outer){
case ITERATION_COUNT: zr = i; break;
case NORMALIZED_ITERATION_COUNT: zr= i + log2(log(mb->bailout) / log(zr*zr + zi*zi)); break;
}
c= lrintf((sin(zr)+1)*127) + lrintf((sin(zr/1.234)+1)*127)*256*256 + lrintf((sin(zr/100)+1)*127)*256;
break;
}
}
break;
}
}
if(!c){
if(mb->inner==PERIOD){
int j;
for(j=i-1; j; j--)
if(SQR(mb->zyklus[j][0]-zr) + SQR(mb->zyklus[j][1]-zi) < 0.0000000000000001)
break;
if(j){
c= i-j;
c= ((c<<5)&0xE0) + ((c<<16)&0xE000) + ((c<<27)&0xE00000);
}
}else if(mb->inner==CONVTIME){
c= floor(i*255.0/mb->maxiter+dv)*0x010101;
} else if(mb->inner==MINCOL){
int j;
double closest=9999;
int closest_index=0;
for(j=i-1; j>=0; j--)
if(SQR(mb->zyklus[j][0]) + SQR(mb->zyklus[j][1]) < closest){
closest= SQR(mb->zyklus[j][0]) + SQR(mb->zyklus[j][1]);
closest_index= j;
}
closest = sqrt(closest);
c= lrintf((mb->zyklus[closest_index][0]/closest+1)*127+dv) + lrintf((mb->zyklus[closest_index][1]/closest+1)*127+dv)*256;
}
}
c |= 0xFF000000;
color[x + y*linesize]= c;
if(next_cidx < mb->cache_allocated){
mb->next_cache[next_cidx ].p[0]= cr;
mb->next_cache[next_cidx ].p[1]= ci;
mb->next_cache[next_cidx++].val = c;
}
}
fill_from_cache(ctx, NULL, &in_cidx, &next_cidx, ci + scale/2, scale);
}
FFSWAP(void*, mb->next_cache, mb->point_cache);
mb->cache_used = next_cidx;
if(mb->cache_used == mb->cache_allocated)
av_log(0, AV_LOG_INFO, "Mandelbrot cache is too small!\n");
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(AVFilterContext *VAR_0, uint32_t *VAR_1, int VAR_2, int64_t VAR_3)
{
MBContext *mb = VAR_0->priv;
int VAR_4,VAR_5,VAR_6, VAR_7=0, VAR_8=0, VAR_9;
double VAR_10= mb->start_scale*pow(mb->end_scale/mb->start_scale, VAR_3/mb->end_pts);
int VAR_11=0;
fill_from_cache(VAR_0, NULL, &VAR_7, NULL, mb->start_y+VAR_10*(-mb->h/2-0.5), VAR_10);
for(VAR_5=0; VAR_5<mb->h; VAR_5++){
const double ci=mb->start_y+VAR_10*(VAR_5-mb->h/2);
memset(VAR_1+VAR_2*VAR_5, 0, sizeof(*VAR_1)*mb->w);
fill_from_cache(VAR_0, VAR_1+VAR_2*VAR_5, &VAR_7, &VAR_8, ci, VAR_10);
VAR_9= VAR_7;
fill_from_cache(VAR_0, VAR_1+VAR_2*VAR_5, &VAR_9, NULL, ci + VAR_10/2, VAR_10);
for(VAR_4=0; VAR_4<mb->w; VAR_4++){
const double cr=mb->start_x+VAR_10*(VAR_4-mb->w/2);
double zr=cr;
double zi=ci;
uint32_t c=0;
double dv= mb->dither / (double)(1LL<<32);
mb->dither= mb->dither*1664525+1013904223;
if(VAR_1[VAR_4 + VAR_5*VAR_2] & 0xFF000000)
continue;
VAR_11= (VAR_4==0 || mb->inner!=BLACK ||VAR_1[VAR_4-1 + VAR_5*VAR_2] == 0xFF000000);
#define Z_Z2_C(outr,outi,inr,ini)\
outr= inr*inr - ini*ini + cr;\
outi= 2*inr*ini + ci;
#define Z_Z2_C_ZYKLUS(outr,outi,inr,ini, Z)\
Z_Z2_C(outr,outi,inr,ini)\
if(VAR_11){\
if(Z && mb->zyklus[VAR_6>>1][0]==outr && mb->zyklus[VAR_6>>1][1]==outi)\
break;\
mb->zyklus[VAR_6][0]= outr;\
mb->zyklus[VAR_6][1]= outi;\
}
for(VAR_6=0; VAR_6<mb->maxiter-8; VAR_6++){
double t;
Z_Z2_C_ZYKLUS(t, zi, zr, zi, 0)
VAR_6++;
Z_Z2_C_ZYKLUS(zr, zi, t, zi, 1)
VAR_6++;
Z_Z2_C_ZYKLUS(t, zi, zr, zi, 0)
VAR_6++;
Z_Z2_C_ZYKLUS(zr, zi, t, zi, 1)
VAR_6++;
Z_Z2_C_ZYKLUS(t, zi, zr, zi, 0)
VAR_6++;
Z_Z2_C_ZYKLUS(zr, zi, t, zi, 1)
VAR_6++;
Z_Z2_C_ZYKLUS(t, zi, zr, zi, 0)
VAR_6++;
Z_Z2_C_ZYKLUS(zr, zi, t, zi, 1)
if(zr*zr + zi*zi > mb->bailout){
VAR_6-= FFMIN(7, VAR_6);
for(; VAR_6<mb->maxiter; VAR_6++){
zr= mb->zyklus[VAR_6][0];
zi= mb->zyklus[VAR_6][1];
if(zr*zr + zi*zi > mb->bailout){
switch(mb->outer){
case ITERATION_COUNT: zr = VAR_6; break;
case NORMALIZED_ITERATION_COUNT: zr= VAR_6 + log2(log(mb->bailout) / log(zr*zr + zi*zi)); break;
}
c= lrintf((sin(zr)+1)*127) + lrintf((sin(zr/1.234)+1)*127)*256*256 + lrintf((sin(zr/100)+1)*127)*256;
break;
}
}
break;
}
}
if(!c){
if(mb->inner==PERIOD){
int j;
for(j=VAR_6-1; j; j--)
if(SQR(mb->zyklus[j][0]-zr) + SQR(mb->zyklus[j][1]-zi) < 0.0000000000000001)
break;
if(j){
c= VAR_6-j;
c= ((c<<5)&0xE0) + ((c<<16)&0xE000) + ((c<<27)&0xE00000);
}
}else if(mb->inner==CONVTIME){
c= floor(VAR_6*255.0/mb->maxiter+dv)*0x010101;
} else if(mb->inner==MINCOL){
int j;
double closest=9999;
int closest_index=0;
for(j=VAR_6-1; j>=0; j--)
if(SQR(mb->zyklus[j][0]) + SQR(mb->zyklus[j][1]) < closest){
closest= SQR(mb->zyklus[j][0]) + SQR(mb->zyklus[j][1]);
closest_index= j;
}
closest = sqrt(closest);
c= lrintf((mb->zyklus[closest_index][0]/closest+1)*127+dv) + lrintf((mb->zyklus[closest_index][1]/closest+1)*127+dv)*256;
}
}
c |= 0xFF000000;
VAR_1[VAR_4 + VAR_5*VAR_2]= c;
if(VAR_8 < mb->cache_allocated){
mb->next_cache[VAR_8 ].p[0]= cr;
mb->next_cache[VAR_8 ].p[1]= ci;
mb->next_cache[VAR_8++].val = c;
}
}
fill_from_cache(VAR_0, NULL, &VAR_7, &VAR_8, ci + VAR_10/2, VAR_10);
}
FFSWAP(void*, mb->next_cache, mb->point_cache);
mb->cache_used = VAR_8;
if(mb->cache_used == mb->cache_allocated)
av_log(0, AV_LOG_INFO, "Mandelbrot cache is too small!\n");
}
| [
"static void FUNC_0(AVFilterContext *VAR_0, uint32_t *VAR_1, int VAR_2, int64_t VAR_3)\n{",
"MBContext *mb = VAR_0->priv;",
"int VAR_4,VAR_5,VAR_6, VAR_7=0, VAR_8=0, VAR_9;",
"double VAR_10= mb->start_scale*pow(mb->end_scale/mb->start_scale, VAR_3/mb->end_pts);",
"int VAR_11=0;",
"fill_from_cache(VAR_0, NULL, &VAR_7, NULL, mb->start_y+VAR_10*(-mb->h/2-0.5), VAR_10);",
"for(VAR_5=0; VAR_5<mb->h; VAR_5++){",
"const double ci=mb->start_y+VAR_10*(VAR_5-mb->h/2);",
"memset(VAR_1+VAR_2*VAR_5, 0, sizeof(*VAR_1)*mb->w);",
"fill_from_cache(VAR_0, VAR_1+VAR_2*VAR_5, &VAR_7, &VAR_8, ci, VAR_10);",
"VAR_9= VAR_7;",
"fill_from_cache(VAR_0, VAR_1+VAR_2*VAR_5, &VAR_9, NULL, ci + VAR_10/2, VAR_10);",
"for(VAR_4=0; VAR_4<mb->w; VAR_4++){",
"const double cr=mb->start_x+VAR_10*(VAR_4-mb->w/2);",
"double zr=cr;",
"double zi=ci;",
"uint32_t c=0;",
"double dv= mb->dither / (double)(1LL<<32);",
"mb->dither= mb->dither*1664525+1013904223;",
"if(VAR_1[VAR_4 + VAR_5*VAR_2] & 0xFF000000)\ncontinue;",
"VAR_11= (VAR_4==0 || mb->inner!=BLACK ||VAR_1[VAR_4-1 + VAR_5*VAR_2] == 0xFF000000);",
"#define Z_Z2_C(outr,outi,inr,ini)\\\noutr= inr*inr - ini*ini + cr;\\",
"outi= 2*inr*ini + ci;",
"#define Z_Z2_C_ZYKLUS(outr,outi,inr,ini, Z)\\\nZ_Z2_C(outr,outi,inr,ini)\\\nif(VAR_11){\\",
"if(Z && mb->zyklus[VAR_6>>1][0]==outr && mb->zyklus[VAR_6>>1][1]==outi)\\\nbreak;\\",
"mb->zyklus[VAR_6][0]= outr;\\",
"mb->zyklus[VAR_6][1]= outi;\\",
"}",
"for(VAR_6=0; VAR_6<mb->maxiter-8; VAR_6++){",
"double t;",
"Z_Z2_C_ZYKLUS(t, zi, zr, zi, 0)\nVAR_6++;",
"Z_Z2_C_ZYKLUS(zr, zi, t, zi, 1)\nVAR_6++;",
"Z_Z2_C_ZYKLUS(t, zi, zr, zi, 0)\nVAR_6++;",
"Z_Z2_C_ZYKLUS(zr, zi, t, zi, 1)\nVAR_6++;",
"Z_Z2_C_ZYKLUS(t, zi, zr, zi, 0)\nVAR_6++;",
"Z_Z2_C_ZYKLUS(zr, zi, t, zi, 1)\nVAR_6++;",
"Z_Z2_C_ZYKLUS(t, zi, zr, zi, 0)\nVAR_6++;",
"Z_Z2_C_ZYKLUS(zr, zi, t, zi, 1)\nif(zr*zr + zi*zi > mb->bailout){",
"VAR_6-= FFMIN(7, VAR_6);",
"for(; VAR_6<mb->maxiter; VAR_6++){",
"zr= mb->zyklus[VAR_6][0];",
"zi= mb->zyklus[VAR_6][1];",
"if(zr*zr + zi*zi > mb->bailout){",
"switch(mb->outer){",
"case ITERATION_COUNT: zr = VAR_6; break;",
"case NORMALIZED_ITERATION_COUNT: zr= VAR_6 + log2(log(mb->bailout) / log(zr*zr + zi*zi)); break;",
"}",
"c= lrintf((sin(zr)+1)*127) + lrintf((sin(zr/1.234)+1)*127)*256*256 + lrintf((sin(zr/100)+1)*127)*256;",
"break;",
"}",
"}",
"break;",
"}",
"}",
"if(!c){",
"if(mb->inner==PERIOD){",
"int j;",
"for(j=VAR_6-1; j; j--)",
"if(SQR(mb->zyklus[j][0]-zr) + SQR(mb->zyklus[j][1]-zi) < 0.0000000000000001)\nbreak;",
"if(j){",
"c= VAR_6-j;",
"c= ((c<<5)&0xE0) + ((c<<16)&0xE000) + ((c<<27)&0xE00000);",
"}",
"}else if(mb->inner==CONVTIME){",
"c= floor(VAR_6*255.0/mb->maxiter+dv)*0x010101;",
"} else if(mb->inner==MINCOL){",
"int j;",
"double closest=9999;",
"int closest_index=0;",
"for(j=VAR_6-1; j>=0; j--)",
"if(SQR(mb->zyklus[j][0]) + SQR(mb->zyklus[j][1]) < closest){",
"closest= SQR(mb->zyklus[j][0]) + SQR(mb->zyklus[j][1]);",
"closest_index= j;",
"}",
"closest = sqrt(closest);",
"c= lrintf((mb->zyklus[closest_index][0]/closest+1)*127+dv) + lrintf((mb->zyklus[closest_index][1]/closest+1)*127+dv)*256;",
"}",
"}",
"c |= 0xFF000000;",
"VAR_1[VAR_4 + VAR_5*VAR_2]= c;",
"if(VAR_8 < mb->cache_allocated){",
"mb->next_cache[VAR_8 ].p[0]= cr;",
"mb->next_cache[VAR_8 ].p[1]= ci;",
"mb->next_cache[VAR_8++].val = c;",
"}",
"}",
"fill_from_cache(VAR_0, NULL, &VAR_7, &VAR_8, ci + VAR_10/2, VAR_10);",
"}",
"FFSWAP(void*, mb->next_cache, mb->point_cache);",
"mb->cache_used = VAR_8;",
"if(mb->cache_used == mb->cache_allocated)\nav_log(0, AV_LOG_INFO, \"Mandelbrot cache is too small!\\n\");",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
45,
47
],
[
51
],
[
55,
57
],
[
59
],
[
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,
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149
],
[
151
],
[
153
],
[
155
],
[
157
],
[
159,
161
],
[
163
],
[
165
],
[
167
],
[
169
],
[
171
],
[
173
],
[
175
],
[
177
],
[
179
],
[
181
],
[
183
],
[
185
],
[
187
],
[
189
],
[
191
],
[
193
],
[
195
],
[
197
],
[
199
],
[
201
],
[
203
],
[
205
],
[
207
],
[
209
],
[
211
],
[
213
],
[
215
],
[
217
],
[
219
],
[
221
],
[
223
],
[
225,
227
],
[
229
]
]
|
14,873 | static void opt_mb_qmax(const char *arg)
{
video_mb_qmax = atoi(arg);
if (video_mb_qmax < 0 ||
video_mb_qmax > 31) {
fprintf(stderr, "qmax must be >= 1 and <= 31\n");
exit(1);
}
}
| false | FFmpeg | 6e0d8c06c7af61859e8d7bc2351a607d8abeab75 | static void opt_mb_qmax(const char *arg)
{
video_mb_qmax = atoi(arg);
if (video_mb_qmax < 0 ||
video_mb_qmax > 31) {
fprintf(stderr, "qmax must be >= 1 and <= 31\n");
exit(1);
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(const char *VAR_0)
{
video_mb_qmax = atoi(VAR_0);
if (video_mb_qmax < 0 ||
video_mb_qmax > 31) {
fprintf(stderr, "qmax must be >= 1 and <= 31\n");
exit(1);
}
}
| [
"static void FUNC_0(const char *VAR_0)\n{",
"video_mb_qmax = atoi(VAR_0);",
"if (video_mb_qmax < 0 ||\nvideo_mb_qmax > 31) {",
"fprintf(stderr, \"qmax must be >= 1 and <= 31\\n\");",
"exit(1);",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7,
9
],
[
11
],
[
13
],
[
15
],
[
17
]
]
|
14,874 | static void create_vorbis_context(venc_context_t * venc, AVCodecContext * avccontext) {
codebook_t * cb;
floor_t * fc;
residue_t * rc;
mapping_t * mc;
int i, book;
venc->channels = avccontext->channels;
venc->sample_rate = avccontext->sample_rate;
venc->blocksize[0] = venc->blocksize[1] = 11;
venc->ncodebooks = 29;
venc->codebooks = av_malloc(sizeof(codebook_t) * venc->ncodebooks);
int codebook0[] = { 2, 10, 8, 14, 7, 12, 11, 14, 1, 5, 3, 7, 4, 9, 7, 13, };
int codebook1[] = { 1, 4, 2, 6, 3, 7, 5, 7, };
int codebook2[] = { 1, 5, 7, 21, 5, 8, 9, 21, 10, 9, 12, 20, 20, 16, 20, 20, 4, 8, 9, 20, 6, 8, 9, 20, 11, 11, 13, 20, 20, 15, 17, 20, 9, 11, 14, 20, 8, 10, 15, 20, 11, 13, 15, 20, 20, 20, 20, 20, 20, 20, 20, 20, 13, 20, 20, 20, 18, 18, 20, 20, 20, 20, 20, 20, 3, 6, 8, 20, 6, 7, 9, 20, 10, 9, 12, 20, 20, 20, 20, 20, 5, 7, 9, 20, 6, 6, 9, 20, 10, 9, 12, 20, 20, 20, 20, 20, 8, 10, 13, 20, 8, 9, 12, 20, 11, 10, 12, 20, 20, 20, 20, 20, 18, 20, 20, 20, 15, 17, 18, 20, 18, 17, 18, 20, 20, 20, 20, 20, 7, 10, 12, 20, 8, 9, 11, 20, 14, 13, 14, 20, 20, 20, 20, 20, 6, 9, 12, 20, 7, 8, 11, 20, 12, 11, 13, 20, 20, 20, 20, 20, 9, 11, 15, 20, 8, 10, 14, 20, 12, 11, 14, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 11, 16, 18, 20, 15, 15, 17, 20, 20, 17, 20, 20, 20, 20, 20, 20, 9, 14, 16, 20, 12, 12, 15, 20, 17, 15, 18, 20, 20, 20, 20, 20, 16, 19, 18, 20, 15, 16, 20, 20, 17, 17, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, };
int codebook3[] = { 2, 3, 7, 13, 4, 4, 7, 15, 8, 6, 9, 17, 21, 16, 15, 21, 2, 5, 7, 11, 5, 5, 7, 14, 9, 7, 10, 16, 17, 15, 16, 21, 4, 7, 10, 17, 7, 7, 9, 15, 11, 9, 11, 16, 21, 18, 15, 21, 18, 21, 21, 21, 15, 17, 17, 19, 21, 19, 18, 20, 21, 21, 21, 20, };
int codebook4[] = { 5, 5, 5, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 7, 5, 7, 5, 7, 5, 7, 5, 8, 6, 8, 6, 8, 6, 9, 6, 9, 6, 10, 6, 10, 6, 11, 6, 11, 7, 11, 7, 12, 7, 12, 7, 12, 7, 12, 7, 12, 7, 12, 7, 12, 7, 12, 8, 13, 8, 12, 8, 12, 8, 13, 8, 13, 9, 13, 9, 13, 9, 13, 9, 12, 10, 12, 10, 13, 10, 14, 11, 14, 12, 14, 13, 14, 13, 14, 14, 15, 16, 15, 15, 15, 14, 15, 17, 21, 22, 22, 21, 22, 22, 22, 22, 22, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, };
int codebook5[] = { 2, 5, 5, 4, 5, 4, 5, 4, 5, 4, 6, 5, 6, 5, 6, 5, 6, 5, 7, 5, 7, 6, 8, 6, 8, 6, 8, 6, 9, 6, 9, 6, };
int codebook6[] = { 8, 5, 8, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 4, 8, 4, 8, 4, 9, 5, 9, 5, 9, 5, 9, 5, 9, 6, 10, 6, 10, 7, 10, 8, 11, 9, 11, 11, 12, 13, 12, 14, 13, 15, 13, 15, 14, 16, 14, 17, 15, 17, 15, 15, 16, 16, 15, 16, 16, 16, 15, 18, 16, 15, 17, 17, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, };
int codebook7[] = { 1, 5, 5, 5, 5, 5, 5, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 6, 7, 7, 7, 7, 8, 7, 8, 8, 9, 8, 10, 9, 10, 9, };
int codebook8[] = { 4, 3, 4, 3, 4, 4, 5, 4, 5, 4, 5, 5, 6, 5, 6, 5, 7, 5, 7, 6, 7, 6, 8, 7, 8, 7, 8, 7, 9, 8, 9, 9, 9, 9, 10, 10, 10, 11, 9, 12, 9, 12, 9, 15, 10, 14, 9, 13, 10, 13, 10, 12, 10, 12, 10, 13, 10, 12, 11, 13, 11, 14, 12, 13, 13, 14, 14, 13, 14, 15, 14, 16, 13, 13, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 15, };
int codebook9[] = { 4, 5, 4, 5, 3, 5, 3, 5, 3, 5, 4, 4, 4, 4, 5, 5, 5, };
int codebook10[] = { 3, 3, 4, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 5, 7, 5, 8, 6, 8, 6, 9, 7, 10, 7, 10, 8, 10, 8, 11, 9, 11, };
int codebook11[] = { 3, 7, 3, 8, 3, 10, 3, 8, 3, 9, 3, 8, 4, 9, 4, 9, 5, 9, 6, 10, 6, 9, 7, 11, 7, 12, 9, 13, 10, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, };
int codebook12[] = { 4, 5, 4, 5, 4, 5, 4, 5, 3, 5, 3, 5, 3, 5, 4, 5, 4, };
int codebook13[] = { 4, 2, 4, 2, 5, 3, 5, 4, 6, 6, 6, 7, 7, 8, 7, 8, 7, 8, 7, 9, 8, 9, 8, 9, 8, 10, 8, 11, 9, 12, 9, 12, };
int codebook14[] = { 2, 5, 2, 6, 3, 6, 4, 7, 4, 7, 5, 9, 5, 11, 6, 11, 6, 11, 7, 11, 6, 11, 6, 11, 9, 11, 8, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, };
int codebook15[] = { 5, 6, 11, 11, 11, 11, 10, 10, 12, 11, 5, 2, 11, 5, 6, 6, 7, 9, 11, 13, 13, 10, 7, 11, 6, 7, 8, 9, 10, 12, 11, 5, 11, 6, 8, 7, 9, 11, 14, 15, 11, 6, 6, 8, 4, 5, 7, 8, 10, 13, 10, 5, 7, 7, 5, 5, 6, 8, 10, 11, 10, 7, 7, 8, 6, 5, 5, 7, 9, 9, 11, 8, 8, 11, 8, 7, 6, 6, 7, 9, 12, 11, 10, 13, 9, 9, 7, 7, 7, 9, 11, 13, 12, 15, 12, 11, 9, 8, 8, 8, };
int codebook16[] = { 2, 4, 4, 0, 0, 0, 0, 0, 0, 5, 6, 6, 0, 0, 0, 0, 0, 0, 5, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 6, 8, 7, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 8, 8, 9, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 8, 8, 0, 0, 0, 0, 0, 0, 7, 9, 8, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 8, 8, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, 0, 0, 0, 0, 0, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 8, 8, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, 0, 0, 0, 0, 0, 8, 9, 8, };
int codebook17[] = { 2, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 7, 8, 0, 0, 0, 0, 0, 0, 0, 5, 6, 6, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 10, 10, 0, 0, 0, 0, 0, 0, 0, 5, 6, 6, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 10, 10, 0, 0, 0, 9, 9, 0, 0, 0, 9, 9, 0, 0, 0, 10, 10, 0, 0, 0, 0, 0, 0, 0, 8, 10, 10, 0, 0, 0, 9, 9, 0, 0, 0, 9, 9, 0, 0, 0, 10, 10, };
int codebook18[] = { 2, 4, 3, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 7, 9, 9, };
int codebook19[] = { 2, 3, 3, 6, 6, 0, 0, 0, 0, 0, 4, 4, 6, 6, 0, 0, 0, 0, 0, 4, 4, 6, 6, 0, 0, 0, 0, 0, 5, 5, 6, 6, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 7, 8, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 9, 9, };
int codebook20[] = { 1, 3, 4, 6, 6, 7, 7, 9, 9, 0, 5, 5, 7, 7, 7, 8, 9, 9, 0, 5, 5, 7, 7, 8, 8, 9, 9, 0, 7, 7, 8, 8, 8, 8, 10, 10, 0, 0, 0, 8, 8, 8, 8, 10, 10, 0, 0, 0, 9, 9, 9, 9, 10, 10, 0, 0, 0, 9, 9, 9, 9, 10, 10, 0, 0, 0, 10, 10, 10, 10, 11, 11, 0, 0, 0, 0, 0, 10, 10, 11, 11, };
int codebook21[] = { 2, 3, 3, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 10, 10, 11, 10, 0, 5, 5, 7, 7, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 0, 5, 5, 7, 7, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 0, 6, 6, 7, 7, 8, 8, 9, 9, 9, 9, 10, 10, 11, 11, 11, 11, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9, 10, 10, 11, 11, 11, 12, 0, 0, 0, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 11, 11, 12, 12, 0, 0, 0, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 11, 11, 12, 12, 0, 0, 0, 9, 9, 9, 9, 10, 10, 10, 10, 11, 10, 11, 11, 12, 12, 0, 0, 0, 0, 0, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 0, 0, 0, 0, 0, 9, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, 0, 0, 0, 0, 0, 8, 8, 9, 9, 10, 10, 11, 11, 12, 11, 12, 12, 0, 0, 0, 0, 0, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 13, 13, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10, 11, 11, 12, 12, 13, 13, 0, 0, 0, 0, 0, 0, 0, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 0, 0, 0, 0, 0, 0, 0, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 0, 0, 0, 0, 0, 0, 0, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 12, 12, 12, 13, 13, 13, 13, };
int codebook22[] = { 1, 4, 4, 7, 6, 6, 7, 6, 6, 4, 7, 7, 10, 9, 9, 11, 9, 9, 4, 7, 7, 10, 9, 9, 11, 9, 9, 7, 10, 10, 11, 11, 10, 12, 11, 11, 6, 9, 9, 11, 10, 10, 11, 10, 10, 6, 9, 9, 11, 10, 10, 11, 10, 10, 7, 11, 11, 11, 11, 11, 12, 11, 11, 6, 9, 9, 11, 10, 10, 11, 10, 10, 6, 9, 9, 11, 10, 10, 11, 10, 10, };
int codebook23[] = { 2, 4, 4, 6, 6, 7, 7, 7, 7, 8, 8, 10, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 10, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 10, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 10, 10, 10, 7, 7, 8, 7, 8, 8, 8, 8, 10, 10, 10, 8, 8, 8, 8, 8, 8, 8, 8, 10, 10, 10, 7, 8, 8, 8, 8, 8, 8, 8, 10, 10, 10, 8, 8, 8, 8, 8, 8, 8, 8, 10, 10, 10, 10, 10, 8, 8, 8, 8, 8, 8, 10, 10, 10, 10, 10, 9, 9, 8, 8, 9, 8, 10, 10, 10, 10, 10, 8, 8, 8, 8, 8, 8, };
int codebook24[] = { 1, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 6, 5, 5, 7, 7, 8, 8, 8, 8, 9, 9, 10, 10, 7, 5, 5, 7, 7, 8, 8, 8, 8, 9, 9, 11, 10, 0, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 11, 11, 0, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 11, 11, 0, 12, 12, 9, 9, 10, 10, 10, 10, 11, 11, 11, 12, 0, 13, 13, 9, 9, 10, 10, 10, 10, 11, 11, 12, 12, 0, 0, 0, 10, 10, 10, 10, 11, 11, 12, 12, 12, 12, 0, 0, 0, 10, 10, 10, 10, 11, 11, 12, 12, 12, 12, 0, 0, 0, 14, 14, 11, 11, 11, 11, 12, 12, 13, 13, 0, 0, 0, 14, 14, 11, 11, 11, 11, 12, 12, 13, 13, 0, 0, 0, 0, 0, 12, 12, 12, 12, 13, 13, 14, 13, 0, 0, 0, 0, 0, 13, 13, 12, 12, 13, 12, 14, 13, };
int codebook25[] = { 2, 4, 4, 5, 5, 6, 5, 5, 5, 5, 6, 4, 5, 5, 5, 6, 5, 5, 5, 5, 6, 6, 6, 5, 5, };
int codebook26[] = { 1, 4, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 4, 9, 8, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 2, 9, 7, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, };
int codebook27[] = { 1, 4, 4, 6, 6, 7, 7, 8, 7, 9, 9, 10, 10, 10, 10, 6, 5, 5, 7, 7, 8, 8, 10, 8, 11, 10, 12, 12, 13, 13, 6, 5, 5, 7, 7, 8, 8, 10, 9, 11, 11, 12, 12, 13, 12, 18, 8, 8, 8, 8, 9, 9, 10, 9, 11, 10, 12, 12, 13, 13, 18, 8, 8, 8, 8, 9, 9, 10, 10, 11, 11, 13, 12, 14, 13, 18, 11, 11, 9, 9, 10, 10, 11, 11, 11, 12, 13, 12, 13, 14, 18, 11, 11, 9, 8, 11, 10, 11, 11, 11, 11, 12, 12, 14, 13, 18, 18, 18, 10, 11, 10, 11, 12, 12, 12, 12, 13, 12, 14, 13, 18, 18, 18, 10, 11, 11, 9, 12, 11, 12, 12, 12, 13, 13, 13, 18, 18, 17, 14, 14, 11, 11, 12, 12, 13, 12, 14, 12, 14, 13, 18, 18, 18, 14, 14, 11, 10, 12, 9, 12, 13, 13, 13, 13, 13, 18, 18, 17, 16, 18, 13, 13, 12, 12, 13, 11, 14, 12, 14, 14, 17, 18, 18, 17, 18, 13, 12, 13, 10, 12, 11, 14, 14, 14, 14, 17, 18, 18, 18, 18, 15, 16, 12, 12, 13, 10, 14, 12, 14, 15, 18, 18, 18, 16, 17, 16, 14, 12, 11, 13, 10, 13, 13, 14, 15, };
int codebook28[] = { 2, 5, 5, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 10, 6, 6, 7, 7, 8, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 9, 10, 10, 10, 11, 11, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 11, 10, 11, 11, 11, 9, 9, 9, 9, 9, 9, 10, 10, 9, 9, 10, 9, 11, 10, 11, 11, 11, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 9, 11, 11, 11, 11, 11, 9, 9, 9, 9, 10, 10, 9, 9, 9, 9, 10, 9, 11, 11, 11, 11, 11, 11, 11, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 10, 9, 10, 10, 9, 10, 9, 9, 10, 9, 11, 10, 10, 11, 11, 11, 11, 9, 10, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 10, 10, 10, 9, 9, 10, 9, 10, 9, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 9, 9, 9, 9, 9, 10, 10, 10, };
int codebook_sizes[] = { 16, 8, 256, 64, 128, 32, 96, 32, 96, 17, 32, 78, 17, 32, 78, 100, 1641, 443, 105, 68, 81, 289, 81, 121, 169, 25, 169, 225, 289, };
int * codebook_lens[] = { codebook0, codebook1, codebook2, codebook3, codebook4, codebook5, codebook6, codebook7,
codebook8, codebook9, codebook10, codebook11, codebook12, codebook13, codebook14, codebook15,
codebook16, codebook17, codebook18, codebook19, codebook20, codebook21, codebook22, codebook23,
codebook24, codebook25, codebook26, codebook27, codebook28, };
struct {
int lookup;
int dim;
float min;
float delta;
int real_len;
int * quant;
} cvectors[] = {
{ 1, 8, -1.0, 1.0, 6561,(int[]){ 1, 0, 2, } },
{ 1, 4, -2.0, 1.0, 625, (int[]){ 2, 1, 3, 0, 4, } },
{ 1, 4, -2.0, 1.0, 625, (int[]){ 2, 1, 3, 0, 4, } },
{ 1, 2, -4.0, 1.0, 81, (int[]){ 4, 3, 5, 2, 6, 1, 7, 0, 8, } },
{ 1, 2, -4.0, 1.0, 81, (int[]){ 4, 3, 5, 2, 6, 1, 7, 0, 8, } },
{ 1, 2, -8.0, 1.0, 289, (int[]){ 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, } },
{ 1, 4, -11.0, 11.0, 81, (int[]){ 1, 0, 2, } },
{ 1, 2, -5.0, 1.0, 121, (int[]){ 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, } },
{ 1, 2, -30.0, 5.0, 169, (int[]){ 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, } },
{ 1, 2, -2.0, 1.0, 25, (int[]){ 2, 1, 3, 0, 4, } },
{ 1, 2, -1530.0, 255.0, 169, (int[]){ 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, } },
{ 1, 2, -119.0, 17.0, 225, (int[]){ 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, } },
{ 1, 2, -8.0, 1.0, 289, (int[]){ 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, } },
};
// codebook 0..14 - floor1 book, values 0..255
// codebook 15 residue masterbook
// codebook 16..29 residue
for (book = 0; book < venc->ncodebooks; book++) {
cb = &venc->codebooks[book];
cb->nentries = codebook_sizes[book];
if (book < 16) {
cb->ndimentions = 2;
cb->min = 0.;
cb->delta = 0.;
cb->seq_p = 0;
cb->lookup = 0;
cb->quantlist = NULL;
} else {
int vals;
cb->seq_p = 0;
cb->nentries = cvectors[book - 16].real_len;
cb->ndimentions = cvectors[book - 16].dim;
cb->min = cvectors[book - 16].min;
cb->delta = cvectors[book - 16].delta;
cb->lookup = cvectors[book - 16].lookup;
vals = cb_lookup_vals(cb->lookup, cb->ndimentions, cb->nentries);
cb->quantlist = av_malloc(sizeof(int) * vals);
for (i = 0; i < vals; i++) cb->quantlist[i] = cvectors[book - 16].quant[i];
}
cb->entries = av_malloc(sizeof(cb_entry_t) * cb->nentries);
for (i = 0; i < cb->nentries; i++) {
if (i < codebook_sizes[book]) cb->entries[i].len = codebook_lens[book][i];
else cb->entries[i].len = 0;
}
ready_codebook(cb);
}
venc->nfloors = 1;
venc->floors = av_malloc(sizeof(floor_t) * venc->nfloors);
// just 1 floor
fc = &venc->floors[0];
fc->partitions = 8;
fc->partition_to_class = av_malloc(sizeof(int) * fc->partitions);
fc->nclasses = 0;
for (i = 0; i < fc->partitions; i++) {
int a[] = {0,1,2,2,3,3,4,4};
fc->partition_to_class[i] = a[i];
fc->nclasses = FFMAX(fc->nclasses, fc->partition_to_class[i]);
}
fc->nclasses++;
fc->classes = av_malloc(sizeof(floor_class_t) * fc->nclasses);
for (i = 0; i < fc->nclasses; i++) {
floor_class_t * c = &fc->classes[i];
int j, books;
int dim[] = {3,4,3,4,3};
int subclass[] = {0,1,1,2,2};
int masterbook[] = {0/*none*/,0,1,2,3};
int * nbooks[] = {
(int[]){ 4 },
(int[]){ 5, 6 },
(int[]){ 7, 8 },
(int[]){ -1, 9, 10, 11 },
(int[]){ -1, 12, 13, 14 },
};
c->dim = dim[i];
c->subclass = subclass[i];
c->masterbook = masterbook[i];
books = (1 << c->subclass);
c->books = av_malloc(sizeof(int) * books);
for (j = 0; j < books; j++) c->books[j] = nbooks[i][j];
}
fc->multiplier = 2;
fc->rangebits = venc->blocksize[0] - 1;
fc->values = 2;
for (i = 0; i < fc->partitions; i++)
fc->values += fc->classes[fc->partition_to_class[i]].dim;
fc->list = av_malloc(sizeof(floor_entry_t) * fc->values);
fc->list[0].x = 0;
fc->list[1].x = 1 << fc->rangebits;
for (i = 2; i < fc->values; i++) {
/*int a = i - 1;
int g = ilog(a);
assert(g <= fc->rangebits);
a ^= 1 << (g-1);
g = 1 << (fc->rangebits - g);
fc->list[i].x = g + a*2*g;*/
//int a[] = {14, 4, 58, 2, 8, 28, 90};
int a[] = {93,23,372,6,46,186,750,14,33,65,130,260,556,3,10,18,28,39,55,79,111,158,220,312,464,650,850};
fc->list[i].x = a[i - 2];
}
ready_floor(fc);
venc->nresidues = 1;
venc->residues = av_malloc(sizeof(residue_t) * venc->nresidues);
// single residue
rc = &venc->residues[0];
rc->type = 2;
rc->begin = 0;
rc->end = 1600;
rc->partition_size = 32;
rc->classifications = 10;
rc->classbook = 15;
rc->books = av_malloc(sizeof(int[8]) * rc->classifications);
for (i = 0; i < rc->classifications; i++) {
int a[10][8] = {
{ -1, -1, -1, -1, -1, -1, -1, -1, },
{ -1, -1, 16, -1, -1, -1, -1, -1, },
{ -1, -1, 17, -1, -1, -1, -1, -1, },
{ -1, -1, 18, -1, -1, -1, -1, -1, },
{ -1, -1, 19, -1, -1, -1, -1, -1, },
{ -1, -1, 20, -1, -1, -1, -1, -1, },
{ -1, -1, 21, -1, -1, -1, -1, -1, },
{ 22, 23, -1, -1, -1, -1, -1, -1, },
{ 24, 25, -1, -1, -1, -1, -1, -1, },
{ 26, 27, 28, -1, -1, -1, -1, -1, },
};
int j;
for (j = 0; j < 8; j++) rc->books[i][j] = a[i][j];
}
ready_residue(rc, venc);
venc->nmappings = 1;
venc->mappings = av_malloc(sizeof(mapping_t) * venc->nmappings);
// single mapping
mc = &venc->mappings[0];
mc->submaps = 1;
mc->mux = av_malloc(sizeof(int) * venc->channels);
for (i = 0; i < venc->channels; i++) mc->mux[i] = 0;
mc->floor = av_malloc(sizeof(int) * mc->submaps);
mc->residue = av_malloc(sizeof(int) * mc->submaps);
for (i = 0; i < mc->submaps; i++) {
mc->floor[i] = 0;
mc->residue[i] = 0;
}
mc->coupling_steps = venc->channels == 2 ? 1 : 0;
mc->magnitude = av_malloc(sizeof(int) * mc->coupling_steps);
mc->angle = av_malloc(sizeof(int) * mc->coupling_steps);
if (mc->coupling_steps) {
mc->magnitude[0] = 0;
mc->angle[0] = 1;
}
venc->nmodes = 1;
venc->modes = av_malloc(sizeof(vorbis_mode_t) * venc->nmodes);
// single mode
venc->modes[0].blockflag = 0;
venc->modes[0].mapping = 0;
venc->have_saved = 0;
venc->saved = av_malloc(sizeof(float) * venc->channels * (1 << venc->blocksize[1]) / 2);
venc->samples = av_malloc(sizeof(float) * venc->channels * (1 << venc->blocksize[1]));
venc->floor = av_malloc(sizeof(float) * venc->channels * (1 << venc->blocksize[1]) / 2);
venc->coeffs = av_malloc(sizeof(float) * venc->channels * (1 << venc->blocksize[1]) / 2);
venc->win[0] = ff_vorbis_vwin[venc->blocksize[0] - 6];
venc->win[1] = ff_vorbis_vwin[venc->blocksize[1] - 6];
ff_mdct_init(&venc->mdct[0], venc->blocksize[0], 0);
ff_mdct_init(&venc->mdct[1], venc->blocksize[1], 0);
}
| false | FFmpeg | 39d0567737cbce35239dddeabe35ae037cecf362 | static void create_vorbis_context(venc_context_t * venc, AVCodecContext * avccontext) {
codebook_t * cb;
floor_t * fc;
residue_t * rc;
mapping_t * mc;
int i, book;
venc->channels = avccontext->channels;
venc->sample_rate = avccontext->sample_rate;
venc->blocksize[0] = venc->blocksize[1] = 11;
venc->ncodebooks = 29;
venc->codebooks = av_malloc(sizeof(codebook_t) * venc->ncodebooks);
int codebook0[] = { 2, 10, 8, 14, 7, 12, 11, 14, 1, 5, 3, 7, 4, 9, 7, 13, };
int codebook1[] = { 1, 4, 2, 6, 3, 7, 5, 7, };
int codebook2[] = { 1, 5, 7, 21, 5, 8, 9, 21, 10, 9, 12, 20, 20, 16, 20, 20, 4, 8, 9, 20, 6, 8, 9, 20, 11, 11, 13, 20, 20, 15, 17, 20, 9, 11, 14, 20, 8, 10, 15, 20, 11, 13, 15, 20, 20, 20, 20, 20, 20, 20, 20, 20, 13, 20, 20, 20, 18, 18, 20, 20, 20, 20, 20, 20, 3, 6, 8, 20, 6, 7, 9, 20, 10, 9, 12, 20, 20, 20, 20, 20, 5, 7, 9, 20, 6, 6, 9, 20, 10, 9, 12, 20, 20, 20, 20, 20, 8, 10, 13, 20, 8, 9, 12, 20, 11, 10, 12, 20, 20, 20, 20, 20, 18, 20, 20, 20, 15, 17, 18, 20, 18, 17, 18, 20, 20, 20, 20, 20, 7, 10, 12, 20, 8, 9, 11, 20, 14, 13, 14, 20, 20, 20, 20, 20, 6, 9, 12, 20, 7, 8, 11, 20, 12, 11, 13, 20, 20, 20, 20, 20, 9, 11, 15, 20, 8, 10, 14, 20, 12, 11, 14, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 11, 16, 18, 20, 15, 15, 17, 20, 20, 17, 20, 20, 20, 20, 20, 20, 9, 14, 16, 20, 12, 12, 15, 20, 17, 15, 18, 20, 20, 20, 20, 20, 16, 19, 18, 20, 15, 16, 20, 20, 17, 17, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, };
int codebook3[] = { 2, 3, 7, 13, 4, 4, 7, 15, 8, 6, 9, 17, 21, 16, 15, 21, 2, 5, 7, 11, 5, 5, 7, 14, 9, 7, 10, 16, 17, 15, 16, 21, 4, 7, 10, 17, 7, 7, 9, 15, 11, 9, 11, 16, 21, 18, 15, 21, 18, 21, 21, 21, 15, 17, 17, 19, 21, 19, 18, 20, 21, 21, 21, 20, };
int codebook4[] = { 5, 5, 5, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 7, 5, 7, 5, 7, 5, 7, 5, 8, 6, 8, 6, 8, 6, 9, 6, 9, 6, 10, 6, 10, 6, 11, 6, 11, 7, 11, 7, 12, 7, 12, 7, 12, 7, 12, 7, 12, 7, 12, 7, 12, 7, 12, 8, 13, 8, 12, 8, 12, 8, 13, 8, 13, 9, 13, 9, 13, 9, 13, 9, 12, 10, 12, 10, 13, 10, 14, 11, 14, 12, 14, 13, 14, 13, 14, 14, 15, 16, 15, 15, 15, 14, 15, 17, 21, 22, 22, 21, 22, 22, 22, 22, 22, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, };
int codebook5[] = { 2, 5, 5, 4, 5, 4, 5, 4, 5, 4, 6, 5, 6, 5, 6, 5, 6, 5, 7, 5, 7, 6, 8, 6, 8, 6, 8, 6, 9, 6, 9, 6, };
int codebook6[] = { 8, 5, 8, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 4, 8, 4, 8, 4, 9, 5, 9, 5, 9, 5, 9, 5, 9, 6, 10, 6, 10, 7, 10, 8, 11, 9, 11, 11, 12, 13, 12, 14, 13, 15, 13, 15, 14, 16, 14, 17, 15, 17, 15, 15, 16, 16, 15, 16, 16, 16, 15, 18, 16, 15, 17, 17, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, };
int codebook7[] = { 1, 5, 5, 5, 5, 5, 5, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 6, 7, 7, 7, 7, 8, 7, 8, 8, 9, 8, 10, 9, 10, 9, };
int codebook8[] = { 4, 3, 4, 3, 4, 4, 5, 4, 5, 4, 5, 5, 6, 5, 6, 5, 7, 5, 7, 6, 7, 6, 8, 7, 8, 7, 8, 7, 9, 8, 9, 9, 9, 9, 10, 10, 10, 11, 9, 12, 9, 12, 9, 15, 10, 14, 9, 13, 10, 13, 10, 12, 10, 12, 10, 13, 10, 12, 11, 13, 11, 14, 12, 13, 13, 14, 14, 13, 14, 15, 14, 16, 13, 13, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 15, };
int codebook9[] = { 4, 5, 4, 5, 3, 5, 3, 5, 3, 5, 4, 4, 4, 4, 5, 5, 5, };
int codebook10[] = { 3, 3, 4, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 5, 7, 5, 8, 6, 8, 6, 9, 7, 10, 7, 10, 8, 10, 8, 11, 9, 11, };
int codebook11[] = { 3, 7, 3, 8, 3, 10, 3, 8, 3, 9, 3, 8, 4, 9, 4, 9, 5, 9, 6, 10, 6, 9, 7, 11, 7, 12, 9, 13, 10, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, };
int codebook12[] = { 4, 5, 4, 5, 4, 5, 4, 5, 3, 5, 3, 5, 3, 5, 4, 5, 4, };
int codebook13[] = { 4, 2, 4, 2, 5, 3, 5, 4, 6, 6, 6, 7, 7, 8, 7, 8, 7, 8, 7, 9, 8, 9, 8, 9, 8, 10, 8, 11, 9, 12, 9, 12, };
int codebook14[] = { 2, 5, 2, 6, 3, 6, 4, 7, 4, 7, 5, 9, 5, 11, 6, 11, 6, 11, 7, 11, 6, 11, 6, 11, 9, 11, 8, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, };
int codebook15[] = { 5, 6, 11, 11, 11, 11, 10, 10, 12, 11, 5, 2, 11, 5, 6, 6, 7, 9, 11, 13, 13, 10, 7, 11, 6, 7, 8, 9, 10, 12, 11, 5, 11, 6, 8, 7, 9, 11, 14, 15, 11, 6, 6, 8, 4, 5, 7, 8, 10, 13, 10, 5, 7, 7, 5, 5, 6, 8, 10, 11, 10, 7, 7, 8, 6, 5, 5, 7, 9, 9, 11, 8, 8, 11, 8, 7, 6, 6, 7, 9, 12, 11, 10, 13, 9, 9, 7, 7, 7, 9, 11, 13, 12, 15, 12, 11, 9, 8, 8, 8, };
int codebook16[] = { 2, 4, 4, 0, 0, 0, 0, 0, 0, 5, 6, 6, 0, 0, 0, 0, 0, 0, 5, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 6, 8, 7, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 8, 8, 9, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 8, 8, 0, 0, 0, 0, 0, 0, 7, 9, 8, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 8, 8, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, 0, 0, 0, 0, 0, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 8, 8, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, 0, 0, 0, 0, 0, 8, 9, 8, };
int codebook17[] = { 2, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 7, 8, 0, 0, 0, 0, 0, 0, 0, 5, 6, 6, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 10, 10, 0, 0, 0, 0, 0, 0, 0, 5, 6, 6, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 10, 10, 0, 0, 0, 9, 9, 0, 0, 0, 9, 9, 0, 0, 0, 10, 10, 0, 0, 0, 0, 0, 0, 0, 8, 10, 10, 0, 0, 0, 9, 9, 0, 0, 0, 9, 9, 0, 0, 0, 10, 10, };
int codebook18[] = { 2, 4, 3, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 7, 9, 9, };
int codebook19[] = { 2, 3, 3, 6, 6, 0, 0, 0, 0, 0, 4, 4, 6, 6, 0, 0, 0, 0, 0, 4, 4, 6, 6, 0, 0, 0, 0, 0, 5, 5, 6, 6, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 7, 8, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 9, 9, };
int codebook20[] = { 1, 3, 4, 6, 6, 7, 7, 9, 9, 0, 5, 5, 7, 7, 7, 8, 9, 9, 0, 5, 5, 7, 7, 8, 8, 9, 9, 0, 7, 7, 8, 8, 8, 8, 10, 10, 0, 0, 0, 8, 8, 8, 8, 10, 10, 0, 0, 0, 9, 9, 9, 9, 10, 10, 0, 0, 0, 9, 9, 9, 9, 10, 10, 0, 0, 0, 10, 10, 10, 10, 11, 11, 0, 0, 0, 0, 0, 10, 10, 11, 11, };
int codebook21[] = { 2, 3, 3, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 10, 10, 11, 10, 0, 5, 5, 7, 7, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 0, 5, 5, 7, 7, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 0, 6, 6, 7, 7, 8, 8, 9, 9, 9, 9, 10, 10, 11, 11, 11, 11, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9, 10, 10, 11, 11, 11, 12, 0, 0, 0, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 11, 11, 12, 12, 0, 0, 0, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 11, 11, 12, 12, 0, 0, 0, 9, 9, 9, 9, 10, 10, 10, 10, 11, 10, 11, 11, 12, 12, 0, 0, 0, 0, 0, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 0, 0, 0, 0, 0, 9, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, 0, 0, 0, 0, 0, 8, 8, 9, 9, 10, 10, 11, 11, 12, 11, 12, 12, 0, 0, 0, 0, 0, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 13, 13, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10, 11, 11, 12, 12, 13, 13, 0, 0, 0, 0, 0, 0, 0, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 0, 0, 0, 0, 0, 0, 0, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 0, 0, 0, 0, 0, 0, 0, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 12, 12, 12, 13, 13, 13, 13, };
int codebook22[] = { 1, 4, 4, 7, 6, 6, 7, 6, 6, 4, 7, 7, 10, 9, 9, 11, 9, 9, 4, 7, 7, 10, 9, 9, 11, 9, 9, 7, 10, 10, 11, 11, 10, 12, 11, 11, 6, 9, 9, 11, 10, 10, 11, 10, 10, 6, 9, 9, 11, 10, 10, 11, 10, 10, 7, 11, 11, 11, 11, 11, 12, 11, 11, 6, 9, 9, 11, 10, 10, 11, 10, 10, 6, 9, 9, 11, 10, 10, 11, 10, 10, };
int codebook23[] = { 2, 4, 4, 6, 6, 7, 7, 7, 7, 8, 8, 10, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 10, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 10, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 10, 10, 10, 7, 7, 8, 7, 8, 8, 8, 8, 10, 10, 10, 8, 8, 8, 8, 8, 8, 8, 8, 10, 10, 10, 7, 8, 8, 8, 8, 8, 8, 8, 10, 10, 10, 8, 8, 8, 8, 8, 8, 8, 8, 10, 10, 10, 10, 10, 8, 8, 8, 8, 8, 8, 10, 10, 10, 10, 10, 9, 9, 8, 8, 9, 8, 10, 10, 10, 10, 10, 8, 8, 8, 8, 8, 8, };
int codebook24[] = { 1, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 6, 5, 5, 7, 7, 8, 8, 8, 8, 9, 9, 10, 10, 7, 5, 5, 7, 7, 8, 8, 8, 8, 9, 9, 11, 10, 0, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 11, 11, 0, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 11, 11, 0, 12, 12, 9, 9, 10, 10, 10, 10, 11, 11, 11, 12, 0, 13, 13, 9, 9, 10, 10, 10, 10, 11, 11, 12, 12, 0, 0, 0, 10, 10, 10, 10, 11, 11, 12, 12, 12, 12, 0, 0, 0, 10, 10, 10, 10, 11, 11, 12, 12, 12, 12, 0, 0, 0, 14, 14, 11, 11, 11, 11, 12, 12, 13, 13, 0, 0, 0, 14, 14, 11, 11, 11, 11, 12, 12, 13, 13, 0, 0, 0, 0, 0, 12, 12, 12, 12, 13, 13, 14, 13, 0, 0, 0, 0, 0, 13, 13, 12, 12, 13, 12, 14, 13, };
int codebook25[] = { 2, 4, 4, 5, 5, 6, 5, 5, 5, 5, 6, 4, 5, 5, 5, 6, 5, 5, 5, 5, 6, 6, 6, 5, 5, };
int codebook26[] = { 1, 4, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 4, 9, 8, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 2, 9, 7, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, };
int codebook27[] = { 1, 4, 4, 6, 6, 7, 7, 8, 7, 9, 9, 10, 10, 10, 10, 6, 5, 5, 7, 7, 8, 8, 10, 8, 11, 10, 12, 12, 13, 13, 6, 5, 5, 7, 7, 8, 8, 10, 9, 11, 11, 12, 12, 13, 12, 18, 8, 8, 8, 8, 9, 9, 10, 9, 11, 10, 12, 12, 13, 13, 18, 8, 8, 8, 8, 9, 9, 10, 10, 11, 11, 13, 12, 14, 13, 18, 11, 11, 9, 9, 10, 10, 11, 11, 11, 12, 13, 12, 13, 14, 18, 11, 11, 9, 8, 11, 10, 11, 11, 11, 11, 12, 12, 14, 13, 18, 18, 18, 10, 11, 10, 11, 12, 12, 12, 12, 13, 12, 14, 13, 18, 18, 18, 10, 11, 11, 9, 12, 11, 12, 12, 12, 13, 13, 13, 18, 18, 17, 14, 14, 11, 11, 12, 12, 13, 12, 14, 12, 14, 13, 18, 18, 18, 14, 14, 11, 10, 12, 9, 12, 13, 13, 13, 13, 13, 18, 18, 17, 16, 18, 13, 13, 12, 12, 13, 11, 14, 12, 14, 14, 17, 18, 18, 17, 18, 13, 12, 13, 10, 12, 11, 14, 14, 14, 14, 17, 18, 18, 18, 18, 15, 16, 12, 12, 13, 10, 14, 12, 14, 15, 18, 18, 18, 16, 17, 16, 14, 12, 11, 13, 10, 13, 13, 14, 15, };
int codebook28[] = { 2, 5, 5, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 10, 6, 6, 7, 7, 8, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 9, 10, 10, 10, 11, 11, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 11, 10, 11, 11, 11, 9, 9, 9, 9, 9, 9, 10, 10, 9, 9, 10, 9, 11, 10, 11, 11, 11, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 9, 11, 11, 11, 11, 11, 9, 9, 9, 9, 10, 10, 9, 9, 9, 9, 10, 9, 11, 11, 11, 11, 11, 11, 11, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 10, 9, 10, 10, 9, 10, 9, 9, 10, 9, 11, 10, 10, 11, 11, 11, 11, 9, 10, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 10, 10, 10, 9, 9, 10, 9, 10, 9, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 9, 9, 9, 9, 9, 10, 10, 10, };
int codebook_sizes[] = { 16, 8, 256, 64, 128, 32, 96, 32, 96, 17, 32, 78, 17, 32, 78, 100, 1641, 443, 105, 68, 81, 289, 81, 121, 169, 25, 169, 225, 289, };
int * codebook_lens[] = { codebook0, codebook1, codebook2, codebook3, codebook4, codebook5, codebook6, codebook7,
codebook8, codebook9, codebook10, codebook11, codebook12, codebook13, codebook14, codebook15,
codebook16, codebook17, codebook18, codebook19, codebook20, codebook21, codebook22, codebook23,
codebook24, codebook25, codebook26, codebook27, codebook28, };
struct {
int lookup;
int dim;
float min;
float delta;
int real_len;
int * quant;
} cvectors[] = {
{ 1, 8, -1.0, 1.0, 6561,(int[]){ 1, 0, 2, } },
{ 1, 4, -2.0, 1.0, 625, (int[]){ 2, 1, 3, 0, 4, } },
{ 1, 4, -2.0, 1.0, 625, (int[]){ 2, 1, 3, 0, 4, } },
{ 1, 2, -4.0, 1.0, 81, (int[]){ 4, 3, 5, 2, 6, 1, 7, 0, 8, } },
{ 1, 2, -4.0, 1.0, 81, (int[]){ 4, 3, 5, 2, 6, 1, 7, 0, 8, } },
{ 1, 2, -8.0, 1.0, 289, (int[]){ 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, } },
{ 1, 4, -11.0, 11.0, 81, (int[]){ 1, 0, 2, } },
{ 1, 2, -5.0, 1.0, 121, (int[]){ 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, } },
{ 1, 2, -30.0, 5.0, 169, (int[]){ 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, } },
{ 1, 2, -2.0, 1.0, 25, (int[]){ 2, 1, 3, 0, 4, } },
{ 1, 2, -1530.0, 255.0, 169, (int[]){ 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, } },
{ 1, 2, -119.0, 17.0, 225, (int[]){ 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, } },
{ 1, 2, -8.0, 1.0, 289, (int[]){ 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, } },
};
for (book = 0; book < venc->ncodebooks; book++) {
cb = &venc->codebooks[book];
cb->nentries = codebook_sizes[book];
if (book < 16) {
cb->ndimentions = 2;
cb->min = 0.;
cb->delta = 0.;
cb->seq_p = 0;
cb->lookup = 0;
cb->quantlist = NULL;
} else {
int vals;
cb->seq_p = 0;
cb->nentries = cvectors[book - 16].real_len;
cb->ndimentions = cvectors[book - 16].dim;
cb->min = cvectors[book - 16].min;
cb->delta = cvectors[book - 16].delta;
cb->lookup = cvectors[book - 16].lookup;
vals = cb_lookup_vals(cb->lookup, cb->ndimentions, cb->nentries);
cb->quantlist = av_malloc(sizeof(int) * vals);
for (i = 0; i < vals; i++) cb->quantlist[i] = cvectors[book - 16].quant[i];
}
cb->entries = av_malloc(sizeof(cb_entry_t) * cb->nentries);
for (i = 0; i < cb->nentries; i++) {
if (i < codebook_sizes[book]) cb->entries[i].len = codebook_lens[book][i];
else cb->entries[i].len = 0;
}
ready_codebook(cb);
}
venc->nfloors = 1;
venc->floors = av_malloc(sizeof(floor_t) * venc->nfloors);
fc = &venc->floors[0];
fc->partitions = 8;
fc->partition_to_class = av_malloc(sizeof(int) * fc->partitions);
fc->nclasses = 0;
for (i = 0; i < fc->partitions; i++) {
int a[] = {0,1,2,2,3,3,4,4};
fc->partition_to_class[i] = a[i];
fc->nclasses = FFMAX(fc->nclasses, fc->partition_to_class[i]);
}
fc->nclasses++;
fc->classes = av_malloc(sizeof(floor_class_t) * fc->nclasses);
for (i = 0; i < fc->nclasses; i++) {
floor_class_t * c = &fc->classes[i];
int j, books;
int dim[] = {3,4,3,4,3};
int subclass[] = {0,1,1,2,2};
int masterbook[] = {0,0,1,2,3};
int * nbooks[] = {
(int[]){ 4 },
(int[]){ 5, 6 },
(int[]){ 7, 8 },
(int[]){ -1, 9, 10, 11 },
(int[]){ -1, 12, 13, 14 },
};
c->dim = dim[i];
c->subclass = subclass[i];
c->masterbook = masterbook[i];
books = (1 << c->subclass);
c->books = av_malloc(sizeof(int) * books);
for (j = 0; j < books; j++) c->books[j] = nbooks[i][j];
}
fc->multiplier = 2;
fc->rangebits = venc->blocksize[0] - 1;
fc->values = 2;
for (i = 0; i < fc->partitions; i++)
fc->values += fc->classes[fc->partition_to_class[i]].dim;
fc->list = av_malloc(sizeof(floor_entry_t) * fc->values);
fc->list[0].x = 0;
fc->list[1].x = 1 << fc->rangebits;
for (i = 2; i < fc->values; i++) {
int a[] = {93,23,372,6,46,186,750,14,33,65,130,260,556,3,10,18,28,39,55,79,111,158,220,312,464,650,850};
fc->list[i].x = a[i - 2];
}
ready_floor(fc);
venc->nresidues = 1;
venc->residues = av_malloc(sizeof(residue_t) * venc->nresidues);
rc = &venc->residues[0];
rc->type = 2;
rc->begin = 0;
rc->end = 1600;
rc->partition_size = 32;
rc->classifications = 10;
rc->classbook = 15;
rc->books = av_malloc(sizeof(int[8]) * rc->classifications);
for (i = 0; i < rc->classifications; i++) {
int a[10][8] = {
{ -1, -1, -1, -1, -1, -1, -1, -1, },
{ -1, -1, 16, -1, -1, -1, -1, -1, },
{ -1, -1, 17, -1, -1, -1, -1, -1, },
{ -1, -1, 18, -1, -1, -1, -1, -1, },
{ -1, -1, 19, -1, -1, -1, -1, -1, },
{ -1, -1, 20, -1, -1, -1, -1, -1, },
{ -1, -1, 21, -1, -1, -1, -1, -1, },
{ 22, 23, -1, -1, -1, -1, -1, -1, },
{ 24, 25, -1, -1, -1, -1, -1, -1, },
{ 26, 27, 28, -1, -1, -1, -1, -1, },
};
int j;
for (j = 0; j < 8; j++) rc->books[i][j] = a[i][j];
}
ready_residue(rc, venc);
venc->nmappings = 1;
venc->mappings = av_malloc(sizeof(mapping_t) * venc->nmappings);
mc = &venc->mappings[0];
mc->submaps = 1;
mc->mux = av_malloc(sizeof(int) * venc->channels);
for (i = 0; i < venc->channels; i++) mc->mux[i] = 0;
mc->floor = av_malloc(sizeof(int) * mc->submaps);
mc->residue = av_malloc(sizeof(int) * mc->submaps);
for (i = 0; i < mc->submaps; i++) {
mc->floor[i] = 0;
mc->residue[i] = 0;
}
mc->coupling_steps = venc->channels == 2 ? 1 : 0;
mc->magnitude = av_malloc(sizeof(int) * mc->coupling_steps);
mc->angle = av_malloc(sizeof(int) * mc->coupling_steps);
if (mc->coupling_steps) {
mc->magnitude[0] = 0;
mc->angle[0] = 1;
}
venc->nmodes = 1;
venc->modes = av_malloc(sizeof(vorbis_mode_t) * venc->nmodes);
venc->modes[0].blockflag = 0;
venc->modes[0].mapping = 0;
venc->have_saved = 0;
venc->saved = av_malloc(sizeof(float) * venc->channels * (1 << venc->blocksize[1]) / 2);
venc->samples = av_malloc(sizeof(float) * venc->channels * (1 << venc->blocksize[1]));
venc->floor = av_malloc(sizeof(float) * venc->channels * (1 << venc->blocksize[1]) / 2);
venc->coeffs = av_malloc(sizeof(float) * venc->channels * (1 << venc->blocksize[1]) / 2);
venc->win[0] = ff_vorbis_vwin[venc->blocksize[0] - 6];
venc->win[1] = ff_vorbis_vwin[venc->blocksize[1] - 6];
ff_mdct_init(&venc->mdct[0], venc->blocksize[0], 0);
ff_mdct_init(&venc->mdct[1], venc->blocksize[1], 0);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(venc_context_t * VAR_0, AVCodecContext * VAR_1) {
codebook_t * cb;
floor_t * fc;
residue_t * rc;
mapping_t * mc;
int VAR_2, VAR_3;
VAR_0->channels = VAR_1->channels;
VAR_0->sample_rate = VAR_1->sample_rate;
VAR_0->blocksize[0] = VAR_0->blocksize[1] = 11;
VAR_0->ncodebooks = 29;
VAR_0->codebooks = av_malloc(sizeof(codebook_t) * VAR_0->ncodebooks);
int VAR_4[] = { 2, 10, 8, 14, 7, 12, 11, 14, 1, 5, 3, 7, 4, 9, 7, 13, };
int VAR_5[] = { 1, 4, 2, 6, 3, 7, 5, 7, };
int VAR_6[] = { 1, 5, 7, 21, 5, 8, 9, 21, 10, 9, 12, 20, 20, 16, 20, 20, 4, 8, 9, 20, 6, 8, 9, 20, 11, 11, 13, 20, 20, 15, 17, 20, 9, 11, 14, 20, 8, 10, 15, 20, 11, 13, 15, 20, 20, 20, 20, 20, 20, 20, 20, 20, 13, 20, 20, 20, 18, 18, 20, 20, 20, 20, 20, 20, 3, 6, 8, 20, 6, 7, 9, 20, 10, 9, 12, 20, 20, 20, 20, 20, 5, 7, 9, 20, 6, 6, 9, 20, 10, 9, 12, 20, 20, 20, 20, 20, 8, 10, 13, 20, 8, 9, 12, 20, 11, 10, 12, 20, 20, 20, 20, 20, 18, 20, 20, 20, 15, 17, 18, 20, 18, 17, 18, 20, 20, 20, 20, 20, 7, 10, 12, 20, 8, 9, 11, 20, 14, 13, 14, 20, 20, 20, 20, 20, 6, 9, 12, 20, 7, 8, 11, 20, 12, 11, 13, 20, 20, 20, 20, 20, 9, 11, 15, 20, 8, 10, 14, 20, 12, 11, 14, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 11, 16, 18, 20, 15, 15, 17, 20, 20, 17, 20, 20, 20, 20, 20, 20, 9, 14, 16, 20, 12, 12, 15, 20, 17, 15, 18, 20, 20, 20, 20, 20, 16, 19, 18, 20, 15, 16, 20, 20, 17, 17, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, };
int VAR_7[] = { 2, 3, 7, 13, 4, 4, 7, 15, 8, 6, 9, 17, 21, 16, 15, 21, 2, 5, 7, 11, 5, 5, 7, 14, 9, 7, 10, 16, 17, 15, 16, 21, 4, 7, 10, 17, 7, 7, 9, 15, 11, 9, 11, 16, 21, 18, 15, 21, 18, 21, 21, 21, 15, 17, 17, 19, 21, 19, 18, 20, 21, 21, 21, 20, };
int VAR_8[] = { 5, 5, 5, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 7, 5, 7, 5, 7, 5, 7, 5, 8, 6, 8, 6, 8, 6, 9, 6, 9, 6, 10, 6, 10, 6, 11, 6, 11, 7, 11, 7, 12, 7, 12, 7, 12, 7, 12, 7, 12, 7, 12, 7, 12, 7, 12, 8, 13, 8, 12, 8, 12, 8, 13, 8, 13, 9, 13, 9, 13, 9, 13, 9, 12, 10, 12, 10, 13, 10, 14, 11, 14, 12, 14, 13, 14, 13, 14, 14, 15, 16, 15, 15, 15, 14, 15, 17, 21, 22, 22, 21, 22, 22, 22, 22, 22, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, };
int VAR_9[] = { 2, 5, 5, 4, 5, 4, 5, 4, 5, 4, 6, 5, 6, 5, 6, 5, 6, 5, 7, 5, 7, 6, 8, 6, 8, 6, 8, 6, 9, 6, 9, 6, };
int VAR_10[] = { 8, 5, 8, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 4, 8, 4, 8, 4, 9, 5, 9, 5, 9, 5, 9, 5, 9, 6, 10, 6, 10, 7, 10, 8, 11, 9, 11, 11, 12, 13, 12, 14, 13, 15, 13, 15, 14, 16, 14, 17, 15, 17, 15, 15, 16, 16, 15, 16, 16, 16, 15, 18, 16, 15, 17, 17, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, };
int VAR_11[] = { 1, 5, 5, 5, 5, 5, 5, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 6, 7, 7, 7, 7, 8, 7, 8, 8, 9, 8, 10, 9, 10, 9, };
int VAR_12[] = { 4, 3, 4, 3, 4, 4, 5, 4, 5, 4, 5, 5, 6, 5, 6, 5, 7, 5, 7, 6, 7, 6, 8, 7, 8, 7, 8, 7, 9, 8, 9, 9, 9, 9, 10, 10, 10, 11, 9, 12, 9, 12, 9, 15, 10, 14, 9, 13, 10, 13, 10, 12, 10, 12, 10, 13, 10, 12, 11, 13, 11, 14, 12, 13, 13, 14, 14, 13, 14, 15, 14, 16, 13, 13, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 15, };
int VAR_13[] = { 4, 5, 4, 5, 3, 5, 3, 5, 3, 5, 4, 4, 4, 4, 5, 5, 5, };
int VAR_14[] = { 3, 3, 4, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 5, 7, 5, 8, 6, 8, 6, 9, 7, 10, 7, 10, 8, 10, 8, 11, 9, 11, };
int VAR_15[] = { 3, 7, 3, 8, 3, 10, 3, 8, 3, 9, 3, 8, 4, 9, 4, 9, 5, 9, 6, 10, 6, 9, 7, 11, 7, 12, 9, 13, 10, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, };
int VAR_16[] = { 4, 5, 4, 5, 4, 5, 4, 5, 3, 5, 3, 5, 3, 5, 4, 5, 4, };
int VAR_17[] = { 4, 2, 4, 2, 5, 3, 5, 4, 6, 6, 6, 7, 7, 8, 7, 8, 7, 8, 7, 9, 8, 9, 8, 9, 8, 10, 8, 11, 9, 12, 9, 12, };
int VAR_18[] = { 2, 5, 2, 6, 3, 6, 4, 7, 4, 7, 5, 9, 5, 11, 6, 11, 6, 11, 7, 11, 6, 11, 6, 11, 9, 11, 8, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, };
int VAR_19[] = { 5, 6, 11, 11, 11, 11, 10, 10, 12, 11, 5, 2, 11, 5, 6, 6, 7, 9, 11, 13, 13, 10, 7, 11, 6, 7, 8, 9, 10, 12, 11, 5, 11, 6, 8, 7, 9, 11, 14, 15, 11, 6, 6, 8, 4, 5, 7, 8, 10, 13, 10, 5, 7, 7, 5, 5, 6, 8, 10, 11, 10, 7, 7, 8, 6, 5, 5, 7, 9, 9, 11, 8, 8, 11, 8, 7, 6, 6, 7, 9, 12, 11, 10, 13, 9, 9, 7, 7, 7, 9, 11, 13, 12, 15, 12, 11, 9, 8, 8, 8, };
int VAR_20[] = { 2, 4, 4, 0, 0, 0, 0, 0, 0, 5, 6, 6, 0, 0, 0, 0, 0, 0, 5, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 6, 8, 7, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 8, 8, 9, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 8, 8, 0, 0, 0, 0, 0, 0, 7, 9, 8, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 8, 8, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, 0, 0, 0, 0, 0, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 8, 8, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, 0, 0, 0, 0, 0, 8, 9, 8, };
int VAR_21[] = { 2, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 7, 8, 0, 0, 0, 0, 0, 0, 0, 5, 6, 6, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 10, 10, 0, 0, 0, 0, 0, 0, 0, 5, 6, 6, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 10, 10, 0, 0, 0, 9, 9, 0, 0, 0, 9, 9, 0, 0, 0, 10, 10, 0, 0, 0, 0, 0, 0, 0, 8, 10, 10, 0, 0, 0, 9, 9, 0, 0, 0, 9, 9, 0, 0, 0, 10, 10, };
int VAR_22[] = { 2, 4, 3, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 7, 9, 9, };
int VAR_23[] = { 2, 3, 3, 6, 6, 0, 0, 0, 0, 0, 4, 4, 6, 6, 0, 0, 0, 0, 0, 4, 4, 6, 6, 0, 0, 0, 0, 0, 5, 5, 6, 6, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 7, 8, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 9, 9, };
int VAR_24[] = { 1, 3, 4, 6, 6, 7, 7, 9, 9, 0, 5, 5, 7, 7, 7, 8, 9, 9, 0, 5, 5, 7, 7, 8, 8, 9, 9, 0, 7, 7, 8, 8, 8, 8, 10, 10, 0, 0, 0, 8, 8, 8, 8, 10, 10, 0, 0, 0, 9, 9, 9, 9, 10, 10, 0, 0, 0, 9, 9, 9, 9, 10, 10, 0, 0, 0, 10, 10, 10, 10, 11, 11, 0, 0, 0, 0, 0, 10, 10, 11, 11, };
int VAR_25[] = { 2, 3, 3, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 10, 10, 11, 10, 0, 5, 5, 7, 7, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 0, 5, 5, 7, 7, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 0, 6, 6, 7, 7, 8, 8, 9, 9, 9, 9, 10, 10, 11, 11, 11, 11, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9, 10, 10, 11, 11, 11, 12, 0, 0, 0, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 11, 11, 12, 12, 0, 0, 0, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 11, 11, 12, 12, 0, 0, 0, 9, 9, 9, 9, 10, 10, 10, 10, 11, 10, 11, 11, 12, 12, 0, 0, 0, 0, 0, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 0, 0, 0, 0, 0, 9, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, 0, 0, 0, 0, 0, 8, 8, 9, 9, 10, 10, 11, 11, 12, 11, 12, 12, 0, 0, 0, 0, 0, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 13, 13, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10, 11, 11, 12, 12, 13, 13, 0, 0, 0, 0, 0, 0, 0, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 0, 0, 0, 0, 0, 0, 0, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 0, 0, 0, 0, 0, 0, 0, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 12, 12, 12, 13, 13, 13, 13, };
int VAR_26[] = { 1, 4, 4, 7, 6, 6, 7, 6, 6, 4, 7, 7, 10, 9, 9, 11, 9, 9, 4, 7, 7, 10, 9, 9, 11, 9, 9, 7, 10, 10, 11, 11, 10, 12, 11, 11, 6, 9, 9, 11, 10, 10, 11, 10, 10, 6, 9, 9, 11, 10, 10, 11, 10, 10, 7, 11, 11, 11, 11, 11, 12, 11, 11, 6, 9, 9, 11, 10, 10, 11, 10, 10, 6, 9, 9, 11, 10, 10, 11, 10, 10, };
int VAR_27[] = { 2, 4, 4, 6, 6, 7, 7, 7, 7, 8, 8, 10, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 10, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 10, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 10, 10, 10, 7, 7, 8, 7, 8, 8, 8, 8, 10, 10, 10, 8, 8, 8, 8, 8, 8, 8, 8, 10, 10, 10, 7, 8, 8, 8, 8, 8, 8, 8, 10, 10, 10, 8, 8, 8, 8, 8, 8, 8, 8, 10, 10, 10, 10, 10, 8, 8, 8, 8, 8, 8, 10, 10, 10, 10, 10, 9, 9, 8, 8, 9, 8, 10, 10, 10, 10, 10, 8, 8, 8, 8, 8, 8, };
int VAR_28[] = { 1, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 6, 5, 5, 7, 7, 8, 8, 8, 8, 9, 9, 10, 10, 7, 5, 5, 7, 7, 8, 8, 8, 8, 9, 9, 11, 10, 0, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 11, 11, 0, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 11, 11, 0, 12, 12, 9, 9, 10, 10, 10, 10, 11, 11, 11, 12, 0, 13, 13, 9, 9, 10, 10, 10, 10, 11, 11, 12, 12, 0, 0, 0, 10, 10, 10, 10, 11, 11, 12, 12, 12, 12, 0, 0, 0, 10, 10, 10, 10, 11, 11, 12, 12, 12, 12, 0, 0, 0, 14, 14, 11, 11, 11, 11, 12, 12, 13, 13, 0, 0, 0, 14, 14, 11, 11, 11, 11, 12, 12, 13, 13, 0, 0, 0, 0, 0, 12, 12, 12, 12, 13, 13, 14, 13, 0, 0, 0, 0, 0, 13, 13, 12, 12, 13, 12, 14, 13, };
int VAR_29[] = { 2, 4, 4, 5, 5, 6, 5, 5, 5, 5, 6, 4, 5, 5, 5, 6, 5, 5, 5, 5, 6, 6, 6, 5, 5, };
int VAR_30[] = { 1, 4, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 4, 9, 8, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 2, 9, 7, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, };
int VAR_31[] = { 1, 4, 4, 6, 6, 7, 7, 8, 7, 9, 9, 10, 10, 10, 10, 6, 5, 5, 7, 7, 8, 8, 10, 8, 11, 10, 12, 12, 13, 13, 6, 5, 5, 7, 7, 8, 8, 10, 9, 11, 11, 12, 12, 13, 12, 18, 8, 8, 8, 8, 9, 9, 10, 9, 11, 10, 12, 12, 13, 13, 18, 8, 8, 8, 8, 9, 9, 10, 10, 11, 11, 13, 12, 14, 13, 18, 11, 11, 9, 9, 10, 10, 11, 11, 11, 12, 13, 12, 13, 14, 18, 11, 11, 9, 8, 11, 10, 11, 11, 11, 11, 12, 12, 14, 13, 18, 18, 18, 10, 11, 10, 11, 12, 12, 12, 12, 13, 12, 14, 13, 18, 18, 18, 10, 11, 11, 9, 12, 11, 12, 12, 12, 13, 13, 13, 18, 18, 17, 14, 14, 11, 11, 12, 12, 13, 12, 14, 12, 14, 13, 18, 18, 18, 14, 14, 11, 10, 12, 9, 12, 13, 13, 13, 13, 13, 18, 18, 17, 16, 18, 13, 13, 12, 12, 13, 11, 14, 12, 14, 14, 17, 18, 18, 17, 18, 13, 12, 13, 10, 12, 11, 14, 14, 14, 14, 17, 18, 18, 18, 18, 15, 16, 12, 12, 13, 10, 14, 12, 14, 15, 18, 18, 18, 16, 17, 16, 14, 12, 11, 13, 10, 13, 13, 14, 15, };
int VAR_32[] = { 2, 5, 5, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 10, 6, 6, 7, 7, 8, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 9, 10, 10, 10, 11, 11, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 11, 10, 11, 11, 11, 9, 9, 9, 9, 9, 9, 10, 10, 9, 9, 10, 9, 11, 10, 11, 11, 11, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 9, 11, 11, 11, 11, 11, 9, 9, 9, 9, 10, 10, 9, 9, 9, 9, 10, 9, 11, 11, 11, 11, 11, 11, 11, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 10, 9, 10, 10, 9, 10, 9, 9, 10, 9, 11, 10, 10, 11, 11, 11, 11, 9, 10, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 10, 10, 10, 9, 9, 10, 9, 10, 9, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 9, 9, 9, 9, 9, 10, 10, 10, };
int VAR_33[] = { 16, 8, 256, 64, 128, 32, 96, 32, 96, 17, 32, 78, 17, 32, 78, 100, 1641, 443, 105, 68, 81, 289, 81, 121, 169, 25, 169, 225, 289, };
int * VAR_34[] = { VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11,
VAR_12, VAR_13, VAR_14, VAR_15, VAR_16, VAR_17, VAR_18, VAR_19,
VAR_20, VAR_21, VAR_22, VAR_23, VAR_24, VAR_25, VAR_26, VAR_27,
VAR_28, VAR_29, VAR_30, VAR_31, VAR_32, };
struct {
int lookup;
int dim;
float min;
float delta;
int real_len;
int * quant;
} VAR_35[] = {
{ 1, 8, -1.0, 1.0, 6561,(int[]){ 1, 0, 2, } },
{ 1, 4, -2.0, 1.0, 625, (int[]){ 2, 1, 3, 0, 4, } },
{ 1, 4, -2.0, 1.0, 625, (int[]){ 2, 1, 3, 0, 4, } },
{ 1, 2, -4.0, 1.0, 81, (int[]){ 4, 3, 5, 2, 6, 1, 7, 0, 8, } },
{ 1, 2, -4.0, 1.0, 81, (int[]){ 4, 3, 5, 2, 6, 1, 7, 0, 8, } },
{ 1, 2, -8.0, 1.0, 289, (int[]){ 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, } },
{ 1, 4, -11.0, 11.0, 81, (int[]){ 1, 0, 2, } },
{ 1, 2, -5.0, 1.0, 121, (int[]){ 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, } },
{ 1, 2, -30.0, 5.0, 169, (int[]){ 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, } },
{ 1, 2, -2.0, 1.0, 25, (int[]){ 2, 1, 3, 0, 4, } },
{ 1, 2, -1530.0, 255.0, 169, (int[]){ 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, } },
{ 1, 2, -119.0, 17.0, 225, (int[]){ 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, } },
{ 1, 2, -8.0, 1.0, 289, (int[]){ 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, } },
};
for (VAR_3 = 0; VAR_3 < VAR_0->ncodebooks; VAR_3++) {
cb = &VAR_0->codebooks[VAR_3];
cb->nentries = VAR_33[VAR_3];
if (VAR_3 < 16) {
cb->ndimentions = 2;
cb->min = 0.;
cb->delta = 0.;
cb->seq_p = 0;
cb->lookup = 0;
cb->quantlist = NULL;
} else {
int vals;
cb->seq_p = 0;
cb->nentries = VAR_35[VAR_3 - 16].real_len;
cb->ndimentions = VAR_35[VAR_3 - 16].dim;
cb->min = VAR_35[VAR_3 - 16].min;
cb->delta = VAR_35[VAR_3 - 16].delta;
cb->lookup = VAR_35[VAR_3 - 16].lookup;
vals = cb_lookup_vals(cb->lookup, cb->ndimentions, cb->nentries);
cb->quantlist = av_malloc(sizeof(int) * vals);
for (VAR_2 = 0; VAR_2 < vals; VAR_2++) cb->quantlist[VAR_2] = VAR_35[VAR_3 - 16].quant[VAR_2];
}
cb->entries = av_malloc(sizeof(cb_entry_t) * cb->nentries);
for (VAR_2 = 0; VAR_2 < cb->nentries; VAR_2++) {
if (VAR_2 < VAR_33[VAR_3]) cb->entries[VAR_2].len = VAR_34[VAR_3][VAR_2];
else cb->entries[VAR_2].len = 0;
}
ready_codebook(cb);
}
VAR_0->nfloors = 1;
VAR_0->floors = av_malloc(sizeof(floor_t) * VAR_0->nfloors);
fc = &VAR_0->floors[0];
fc->partitions = 8;
fc->partition_to_class = av_malloc(sizeof(int) * fc->partitions);
fc->nclasses = 0;
for (VAR_2 = 0; VAR_2 < fc->partitions; VAR_2++) {
int a[] = {0,1,2,2,3,3,4,4};
fc->partition_to_class[VAR_2] = a[VAR_2];
fc->nclasses = FFMAX(fc->nclasses, fc->partition_to_class[VAR_2]);
}
fc->nclasses++;
fc->classes = av_malloc(sizeof(floor_class_t) * fc->nclasses);
for (VAR_2 = 0; VAR_2 < fc->nclasses; VAR_2++) {
floor_class_t * c = &fc->classes[VAR_2];
int j, books;
int dim[] = {3,4,3,4,3};
int subclass[] = {0,1,1,2,2};
int masterbook[] = {0,0,1,2,3};
int * nbooks[] = {
(int[]){ 4 },
(int[]){ 5, 6 },
(int[]){ 7, 8 },
(int[]){ -1, 9, 10, 11 },
(int[]){ -1, 12, 13, 14 },
};
c->dim = dim[VAR_2];
c->subclass = subclass[VAR_2];
c->masterbook = masterbook[VAR_2];
books = (1 << c->subclass);
c->books = av_malloc(sizeof(int) * books);
for (j = 0; j < books; j++) c->books[j] = nbooks[VAR_2][j];
}
fc->multiplier = 2;
fc->rangebits = VAR_0->blocksize[0] - 1;
fc->values = 2;
for (VAR_2 = 0; VAR_2 < fc->partitions; VAR_2++)
fc->values += fc->classes[fc->partition_to_class[VAR_2]].dim;
fc->list = av_malloc(sizeof(floor_entry_t) * fc->values);
fc->list[0].x = 0;
fc->list[1].x = 1 << fc->rangebits;
for (VAR_2 = 2; VAR_2 < fc->values; VAR_2++) {
int a[] = {93,23,372,6,46,186,750,14,33,65,130,260,556,3,10,18,28,39,55,79,111,158,220,312,464,650,850};
fc->list[VAR_2].x = a[VAR_2 - 2];
}
ready_floor(fc);
VAR_0->nresidues = 1;
VAR_0->residues = av_malloc(sizeof(residue_t) * VAR_0->nresidues);
rc = &VAR_0->residues[0];
rc->type = 2;
rc->begin = 0;
rc->end = 1600;
rc->partition_size = 32;
rc->classifications = 10;
rc->classbook = 15;
rc->books = av_malloc(sizeof(int[8]) * rc->classifications);
for (VAR_2 = 0; VAR_2 < rc->classifications; VAR_2++) {
int a[10][8] = {
{ -1, -1, -1, -1, -1, -1, -1, -1, },
{ -1, -1, 16, -1, -1, -1, -1, -1, },
{ -1, -1, 17, -1, -1, -1, -1, -1, },
{ -1, -1, 18, -1, -1, -1, -1, -1, },
{ -1, -1, 19, -1, -1, -1, -1, -1, },
{ -1, -1, 20, -1, -1, -1, -1, -1, },
{ -1, -1, 21, -1, -1, -1, -1, -1, },
{ 22, 23, -1, -1, -1, -1, -1, -1, },
{ 24, 25, -1, -1, -1, -1, -1, -1, },
{ 26, 27, 28, -1, -1, -1, -1, -1, },
};
int j;
for (j = 0; j < 8; j++) rc->books[VAR_2][j] = a[VAR_2][j];
}
ready_residue(rc, VAR_0);
VAR_0->nmappings = 1;
VAR_0->mappings = av_malloc(sizeof(mapping_t) * VAR_0->nmappings);
mc = &VAR_0->mappings[0];
mc->submaps = 1;
mc->mux = av_malloc(sizeof(int) * VAR_0->channels);
for (VAR_2 = 0; VAR_2 < VAR_0->channels; VAR_2++) mc->mux[VAR_2] = 0;
mc->floor = av_malloc(sizeof(int) * mc->submaps);
mc->residue = av_malloc(sizeof(int) * mc->submaps);
for (VAR_2 = 0; VAR_2 < mc->submaps; VAR_2++) {
mc->floor[VAR_2] = 0;
mc->residue[VAR_2] = 0;
}
mc->coupling_steps = VAR_0->channels == 2 ? 1 : 0;
mc->magnitude = av_malloc(sizeof(int) * mc->coupling_steps);
mc->angle = av_malloc(sizeof(int) * mc->coupling_steps);
if (mc->coupling_steps) {
mc->magnitude[0] = 0;
mc->angle[0] = 1;
}
VAR_0->nmodes = 1;
VAR_0->modes = av_malloc(sizeof(vorbis_mode_t) * VAR_0->nmodes);
VAR_0->modes[0].blockflag = 0;
VAR_0->modes[0].mapping = 0;
VAR_0->have_saved = 0;
VAR_0->saved = av_malloc(sizeof(float) * VAR_0->channels * (1 << VAR_0->blocksize[1]) / 2);
VAR_0->samples = av_malloc(sizeof(float) * VAR_0->channels * (1 << VAR_0->blocksize[1]));
VAR_0->floor = av_malloc(sizeof(float) * VAR_0->channels * (1 << VAR_0->blocksize[1]) / 2);
VAR_0->coeffs = av_malloc(sizeof(float) * VAR_0->channels * (1 << VAR_0->blocksize[1]) / 2);
VAR_0->win[0] = ff_vorbis_vwin[VAR_0->blocksize[0] - 6];
VAR_0->win[1] = ff_vorbis_vwin[VAR_0->blocksize[1] - 6];
ff_mdct_init(&VAR_0->mdct[0], VAR_0->blocksize[0], 0);
ff_mdct_init(&VAR_0->mdct[1], VAR_0->blocksize[1], 0);
}
| [
"static void FUNC_0(venc_context_t * VAR_0, AVCodecContext * VAR_1) {",
"codebook_t * cb;",
"floor_t * fc;",
"residue_t * rc;",
"mapping_t * mc;",
"int VAR_2, VAR_3;",
"VAR_0->channels = VAR_1->channels;",
"VAR_0->sample_rate = VAR_1->sample_rate;",
"VAR_0->blocksize[0] = VAR_0->blocksize[1] = 11;",
"VAR_0->ncodebooks = 29;",
"VAR_0->codebooks = av_malloc(sizeof(codebook_t) * VAR_0->ncodebooks);",
"int VAR_4[] = { 2, 10, 8, 14, 7, 12, 11, 14, 1, 5, 3, 7, 4, 9, 7, 13, };",
"int VAR_5[] = { 1, 4, 2, 6, 3, 7, 5, 7, };",
"int VAR_6[] = { 1, 5, 7, 21, 5, 8, 9, 21, 10, 9, 12, 20, 20, 16, 20, 20, 4, 8, 9, 20, 6, 8, 9, 20, 11, 11, 13, 20, 20, 15, 17, 20, 9, 11, 14, 20, 8, 10, 15, 20, 11, 13, 15, 20, 20, 20, 20, 20, 20, 20, 20, 20, 13, 20, 20, 20, 18, 18, 20, 20, 20, 20, 20, 20, 3, 6, 8, 20, 6, 7, 9, 20, 10, 9, 12, 20, 20, 20, 20, 20, 5, 7, 9, 20, 6, 6, 9, 20, 10, 9, 12, 20, 20, 20, 20, 20, 8, 10, 13, 20, 8, 9, 12, 20, 11, 10, 12, 20, 20, 20, 20, 20, 18, 20, 20, 20, 15, 17, 18, 20, 18, 17, 18, 20, 20, 20, 20, 20, 7, 10, 12, 20, 8, 9, 11, 20, 14, 13, 14, 20, 20, 20, 20, 20, 6, 9, 12, 20, 7, 8, 11, 20, 12, 11, 13, 20, 20, 20, 20, 20, 9, 11, 15, 20, 8, 10, 14, 20, 12, 11, 14, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 11, 16, 18, 20, 15, 15, 17, 20, 20, 17, 20, 20, 20, 20, 20, 20, 9, 14, 16, 20, 12, 12, 15, 20, 17, 15, 18, 20, 20, 20, 20, 20, 16, 19, 18, 20, 15, 16, 20, 20, 17, 17, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, };",
"int VAR_7[] = { 2, 3, 7, 13, 4, 4, 7, 15, 8, 6, 9, 17, 21, 16, 15, 21, 2, 5, 7, 11, 5, 5, 7, 14, 9, 7, 10, 16, 17, 15, 16, 21, 4, 7, 10, 17, 7, 7, 9, 15, 11, 9, 11, 16, 21, 18, 15, 21, 18, 21, 21, 21, 15, 17, 17, 19, 21, 19, 18, 20, 21, 21, 21, 20, };",
"int VAR_8[] = { 5, 5, 5, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 7, 5, 7, 5, 7, 5, 7, 5, 8, 6, 8, 6, 8, 6, 9, 6, 9, 6, 10, 6, 10, 6, 11, 6, 11, 7, 11, 7, 12, 7, 12, 7, 12, 7, 12, 7, 12, 7, 12, 7, 12, 7, 12, 8, 13, 8, 12, 8, 12, 8, 13, 8, 13, 9, 13, 9, 13, 9, 13, 9, 12, 10, 12, 10, 13, 10, 14, 11, 14, 12, 14, 13, 14, 13, 14, 14, 15, 16, 15, 15, 15, 14, 15, 17, 21, 22, 22, 21, 22, 22, 22, 22, 22, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, };",
"int VAR_9[] = { 2, 5, 5, 4, 5, 4, 5, 4, 5, 4, 6, 5, 6, 5, 6, 5, 6, 5, 7, 5, 7, 6, 8, 6, 8, 6, 8, 6, 9, 6, 9, 6, };",
"int VAR_10[] = { 8, 5, 8, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 4, 8, 4, 8, 4, 9, 5, 9, 5, 9, 5, 9, 5, 9, 6, 10, 6, 10, 7, 10, 8, 11, 9, 11, 11, 12, 13, 12, 14, 13, 15, 13, 15, 14, 16, 14, 17, 15, 17, 15, 15, 16, 16, 15, 16, 16, 16, 15, 18, 16, 15, 17, 17, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, };",
"int VAR_11[] = { 1, 5, 5, 5, 5, 5, 5, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 6, 7, 7, 7, 7, 8, 7, 8, 8, 9, 8, 10, 9, 10, 9, };",
"int VAR_12[] = { 4, 3, 4, 3, 4, 4, 5, 4, 5, 4, 5, 5, 6, 5, 6, 5, 7, 5, 7, 6, 7, 6, 8, 7, 8, 7, 8, 7, 9, 8, 9, 9, 9, 9, 10, 10, 10, 11, 9, 12, 9, 12, 9, 15, 10, 14, 9, 13, 10, 13, 10, 12, 10, 12, 10, 13, 10, 12, 11, 13, 11, 14, 12, 13, 13, 14, 14, 13, 14, 15, 14, 16, 13, 13, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 15, };",
"int VAR_13[] = { 4, 5, 4, 5, 3, 5, 3, 5, 3, 5, 4, 4, 4, 4, 5, 5, 5, };",
"int VAR_14[] = { 3, 3, 4, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 5, 7, 5, 8, 6, 8, 6, 9, 7, 10, 7, 10, 8, 10, 8, 11, 9, 11, };",
"int VAR_15[] = { 3, 7, 3, 8, 3, 10, 3, 8, 3, 9, 3, 8, 4, 9, 4, 9, 5, 9, 6, 10, 6, 9, 7, 11, 7, 12, 9, 13, 10, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, };",
"int VAR_16[] = { 4, 5, 4, 5, 4, 5, 4, 5, 3, 5, 3, 5, 3, 5, 4, 5, 4, };",
"int VAR_17[] = { 4, 2, 4, 2, 5, 3, 5, 4, 6, 6, 6, 7, 7, 8, 7, 8, 7, 8, 7, 9, 8, 9, 8, 9, 8, 10, 8, 11, 9, 12, 9, 12, };",
"int VAR_18[] = { 2, 5, 2, 6, 3, 6, 4, 7, 4, 7, 5, 9, 5, 11, 6, 11, 6, 11, 7, 11, 6, 11, 6, 11, 9, 11, 8, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, };",
"int VAR_19[] = { 5, 6, 11, 11, 11, 11, 10, 10, 12, 11, 5, 2, 11, 5, 6, 6, 7, 9, 11, 13, 13, 10, 7, 11, 6, 7, 8, 9, 10, 12, 11, 5, 11, 6, 8, 7, 9, 11, 14, 15, 11, 6, 6, 8, 4, 5, 7, 8, 10, 13, 10, 5, 7, 7, 5, 5, 6, 8, 10, 11, 10, 7, 7, 8, 6, 5, 5, 7, 9, 9, 11, 8, 8, 11, 8, 7, 6, 6, 7, 9, 12, 11, 10, 13, 9, 9, 7, 7, 7, 9, 11, 13, 12, 15, 12, 11, 9, 8, 8, 8, };",
"int VAR_20[] = { 2, 4, 4, 0, 0, 0, 0, 0, 0, 5, 6, 6, 0, 0, 0, 0, 0, 0, 5, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 6, 8, 7, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 8, 8, 9, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 8, 8, 0, 0, 0, 0, 0, 0, 7, 9, 8, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 8, 8, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, 0, 0, 0, 0, 0, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 8, 8, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, 0, 0, 0, 0, 0, 8, 9, 8, };",
"int VAR_21[] = { 2, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 7, 8, 0, 0, 0, 0, 0, 0, 0, 5, 6, 6, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 10, 10, 0, 0, 0, 0, 0, 0, 0, 5, 6, 6, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 10, 10, 0, 0, 0, 9, 9, 0, 0, 0, 9, 9, 0, 0, 0, 10, 10, 0, 0, 0, 0, 0, 0, 0, 8, 10, 10, 0, 0, 0, 9, 9, 0, 0, 0, 9, 9, 0, 0, 0, 10, 10, };",
"int VAR_22[] = { 2, 4, 3, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 7, 9, 9, };",
"int VAR_23[] = { 2, 3, 3, 6, 6, 0, 0, 0, 0, 0, 4, 4, 6, 6, 0, 0, 0, 0, 0, 4, 4, 6, 6, 0, 0, 0, 0, 0, 5, 5, 6, 6, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 7, 8, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 9, 9, };",
"int VAR_24[] = { 1, 3, 4, 6, 6, 7, 7, 9, 9, 0, 5, 5, 7, 7, 7, 8, 9, 9, 0, 5, 5, 7, 7, 8, 8, 9, 9, 0, 7, 7, 8, 8, 8, 8, 10, 10, 0, 0, 0, 8, 8, 8, 8, 10, 10, 0, 0, 0, 9, 9, 9, 9, 10, 10, 0, 0, 0, 9, 9, 9, 9, 10, 10, 0, 0, 0, 10, 10, 10, 10, 11, 11, 0, 0, 0, 0, 0, 10, 10, 11, 11, };",
"int VAR_25[] = { 2, 3, 3, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 10, 10, 11, 10, 0, 5, 5, 7, 7, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 0, 5, 5, 7, 7, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 0, 6, 6, 7, 7, 8, 8, 9, 9, 9, 9, 10, 10, 11, 11, 11, 11, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9, 10, 10, 11, 11, 11, 12, 0, 0, 0, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 11, 11, 12, 12, 0, 0, 0, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 11, 11, 12, 12, 0, 0, 0, 9, 9, 9, 9, 10, 10, 10, 10, 11, 10, 11, 11, 12, 12, 0, 0, 0, 0, 0, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 0, 0, 0, 0, 0, 9, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, 0, 0, 0, 0, 0, 8, 8, 9, 9, 10, 10, 11, 11, 12, 11, 12, 12, 0, 0, 0, 0, 0, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 13, 13, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10, 11, 11, 12, 12, 13, 13, 0, 0, 0, 0, 0, 0, 0, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 0, 0, 0, 0, 0, 0, 0, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 0, 0, 0, 0, 0, 0, 0, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 12, 12, 12, 13, 13, 13, 13, };",
"int VAR_26[] = { 1, 4, 4, 7, 6, 6, 7, 6, 6, 4, 7, 7, 10, 9, 9, 11, 9, 9, 4, 7, 7, 10, 9, 9, 11, 9, 9, 7, 10, 10, 11, 11, 10, 12, 11, 11, 6, 9, 9, 11, 10, 10, 11, 10, 10, 6, 9, 9, 11, 10, 10, 11, 10, 10, 7, 11, 11, 11, 11, 11, 12, 11, 11, 6, 9, 9, 11, 10, 10, 11, 10, 10, 6, 9, 9, 11, 10, 10, 11, 10, 10, };",
"int VAR_27[] = { 2, 4, 4, 6, 6, 7, 7, 7, 7, 8, 8, 10, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 10, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 10, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 10, 10, 10, 7, 7, 8, 7, 8, 8, 8, 8, 10, 10, 10, 8, 8, 8, 8, 8, 8, 8, 8, 10, 10, 10, 7, 8, 8, 8, 8, 8, 8, 8, 10, 10, 10, 8, 8, 8, 8, 8, 8, 8, 8, 10, 10, 10, 10, 10, 8, 8, 8, 8, 8, 8, 10, 10, 10, 10, 10, 9, 9, 8, 8, 9, 8, 10, 10, 10, 10, 10, 8, 8, 8, 8, 8, 8, };",
"int VAR_28[] = { 1, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 6, 5, 5, 7, 7, 8, 8, 8, 8, 9, 9, 10, 10, 7, 5, 5, 7, 7, 8, 8, 8, 8, 9, 9, 11, 10, 0, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 11, 11, 0, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 11, 11, 0, 12, 12, 9, 9, 10, 10, 10, 10, 11, 11, 11, 12, 0, 13, 13, 9, 9, 10, 10, 10, 10, 11, 11, 12, 12, 0, 0, 0, 10, 10, 10, 10, 11, 11, 12, 12, 12, 12, 0, 0, 0, 10, 10, 10, 10, 11, 11, 12, 12, 12, 12, 0, 0, 0, 14, 14, 11, 11, 11, 11, 12, 12, 13, 13, 0, 0, 0, 14, 14, 11, 11, 11, 11, 12, 12, 13, 13, 0, 0, 0, 0, 0, 12, 12, 12, 12, 13, 13, 14, 13, 0, 0, 0, 0, 0, 13, 13, 12, 12, 13, 12, 14, 13, };",
"int VAR_29[] = { 2, 4, 4, 5, 5, 6, 5, 5, 5, 5, 6, 4, 5, 5, 5, 6, 5, 5, 5, 5, 6, 6, 6, 5, 5, };",
"int VAR_30[] = { 1, 4, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 4, 9, 8, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 2, 9, 7, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, };",
"int VAR_31[] = { 1, 4, 4, 6, 6, 7, 7, 8, 7, 9, 9, 10, 10, 10, 10, 6, 5, 5, 7, 7, 8, 8, 10, 8, 11, 10, 12, 12, 13, 13, 6, 5, 5, 7, 7, 8, 8, 10, 9, 11, 11, 12, 12, 13, 12, 18, 8, 8, 8, 8, 9, 9, 10, 9, 11, 10, 12, 12, 13, 13, 18, 8, 8, 8, 8, 9, 9, 10, 10, 11, 11, 13, 12, 14, 13, 18, 11, 11, 9, 9, 10, 10, 11, 11, 11, 12, 13, 12, 13, 14, 18, 11, 11, 9, 8, 11, 10, 11, 11, 11, 11, 12, 12, 14, 13, 18, 18, 18, 10, 11, 10, 11, 12, 12, 12, 12, 13, 12, 14, 13, 18, 18, 18, 10, 11, 11, 9, 12, 11, 12, 12, 12, 13, 13, 13, 18, 18, 17, 14, 14, 11, 11, 12, 12, 13, 12, 14, 12, 14, 13, 18, 18, 18, 14, 14, 11, 10, 12, 9, 12, 13, 13, 13, 13, 13, 18, 18, 17, 16, 18, 13, 13, 12, 12, 13, 11, 14, 12, 14, 14, 17, 18, 18, 17, 18, 13, 12, 13, 10, 12, 11, 14, 14, 14, 14, 17, 18, 18, 18, 18, 15, 16, 12, 12, 13, 10, 14, 12, 14, 15, 18, 18, 18, 16, 17, 16, 14, 12, 11, 13, 10, 13, 13, 14, 15, };",
"int VAR_32[] = { 2, 5, 5, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 10, 6, 6, 7, 7, 8, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 9, 10, 10, 10, 11, 11, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 11, 10, 11, 11, 11, 9, 9, 9, 9, 9, 9, 10, 10, 9, 9, 10, 9, 11, 10, 11, 11, 11, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 9, 11, 11, 11, 11, 11, 9, 9, 9, 9, 10, 10, 9, 9, 9, 9, 10, 9, 11, 11, 11, 11, 11, 11, 11, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 10, 9, 10, 10, 9, 10, 9, 9, 10, 9, 11, 10, 10, 11, 11, 11, 11, 9, 10, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 10, 10, 10, 9, 9, 10, 9, 10, 9, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 9, 9, 9, 9, 9, 10, 10, 10, };",
"int VAR_33[] = { 16, 8, 256, 64, 128, 32, 96, 32, 96, 17, 32, 78, 17, 32, 78, 100, 1641, 443, 105, 68, 81, 289, 81, 121, 169, 25, 169, 225, 289, };",
"int * VAR_34[] = { VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11,",
"VAR_12, VAR_13, VAR_14, VAR_15, VAR_16, VAR_17, VAR_18, VAR_19,\nVAR_20, VAR_21, VAR_22, VAR_23, VAR_24, VAR_25, VAR_26, VAR_27,\nVAR_28, VAR_29, VAR_30, VAR_31, VAR_32, };",
"struct {",
"int lookup;",
"int dim;",
"float min;",
"float delta;",
"int real_len;",
"int * quant;",
"} VAR_35[] = {",
"{ 1, 8, -1.0, 1.0, 6561,(int[]){ 1, 0, 2, } },",
"{ 1, 4, -2.0, 1.0, 625, (int[]){ 2, 1, 3, 0, 4, } },",
"{ 1, 4, -2.0, 1.0, 625, (int[]){ 2, 1, 3, 0, 4, } },",
"{ 1, 2, -4.0, 1.0, 81, (int[]){ 4, 3, 5, 2, 6, 1, 7, 0, 8, } },",
"{ 1, 2, -4.0, 1.0, 81, (int[]){ 4, 3, 5, 2, 6, 1, 7, 0, 8, } },",
"{ 1, 2, -8.0, 1.0, 289, (int[]){ 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, } },",
"{ 1, 4, -11.0, 11.0, 81, (int[]){ 1, 0, 2, } },",
"{ 1, 2, -5.0, 1.0, 121, (int[]){ 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, } },",
"{ 1, 2, -30.0, 5.0, 169, (int[]){ 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, } },",
"{ 1, 2, -2.0, 1.0, 25, (int[]){ 2, 1, 3, 0, 4, } },",
"{ 1, 2, -1530.0, 255.0, 169, (int[]){ 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, } },",
"{ 1, 2, -119.0, 17.0, 225, (int[]){ 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, } },",
"{ 1, 2, -8.0, 1.0, 289, (int[]){ 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, } },",
"};",
"for (VAR_3 = 0; VAR_3 < VAR_0->ncodebooks; VAR_3++) {",
"cb = &VAR_0->codebooks[VAR_3];",
"cb->nentries = VAR_33[VAR_3];",
"if (VAR_3 < 16) {",
"cb->ndimentions = 2;",
"cb->min = 0.;",
"cb->delta = 0.;",
"cb->seq_p = 0;",
"cb->lookup = 0;",
"cb->quantlist = NULL;",
"} else {",
"int vals;",
"cb->seq_p = 0;",
"cb->nentries = VAR_35[VAR_3 - 16].real_len;",
"cb->ndimentions = VAR_35[VAR_3 - 16].dim;",
"cb->min = VAR_35[VAR_3 - 16].min;",
"cb->delta = VAR_35[VAR_3 - 16].delta;",
"cb->lookup = VAR_35[VAR_3 - 16].lookup;",
"vals = cb_lookup_vals(cb->lookup, cb->ndimentions, cb->nentries);",
"cb->quantlist = av_malloc(sizeof(int) * vals);",
"for (VAR_2 = 0; VAR_2 < vals; VAR_2++) cb->quantlist[VAR_2] = VAR_35[VAR_3 - 16].quant[VAR_2];",
"}",
"cb->entries = av_malloc(sizeof(cb_entry_t) * cb->nentries);",
"for (VAR_2 = 0; VAR_2 < cb->nentries; VAR_2++) {",
"if (VAR_2 < VAR_33[VAR_3]) cb->entries[VAR_2].len = VAR_34[VAR_3][VAR_2];",
"else cb->entries[VAR_2].len = 0;",
"}",
"ready_codebook(cb);",
"}",
"VAR_0->nfloors = 1;",
"VAR_0->floors = av_malloc(sizeof(floor_t) * VAR_0->nfloors);",
"fc = &VAR_0->floors[0];",
"fc->partitions = 8;",
"fc->partition_to_class = av_malloc(sizeof(int) * fc->partitions);",
"fc->nclasses = 0;",
"for (VAR_2 = 0; VAR_2 < fc->partitions; VAR_2++) {",
"int a[] = {0,1,2,2,3,3,4,4};",
"fc->partition_to_class[VAR_2] = a[VAR_2];",
"fc->nclasses = FFMAX(fc->nclasses, fc->partition_to_class[VAR_2]);",
"}",
"fc->nclasses++;",
"fc->classes = av_malloc(sizeof(floor_class_t) * fc->nclasses);",
"for (VAR_2 = 0; VAR_2 < fc->nclasses; VAR_2++) {",
"floor_class_t * c = &fc->classes[VAR_2];",
"int j, books;",
"int dim[] = {3,4,3,4,3};",
"int subclass[] = {0,1,1,2,2};",
"int masterbook[] = {0,0,1,2,3};",
"int * nbooks[] = {",
"(int[]){ 4 },",
"(int[]){ 5, 6 },",
"(int[]){ 7, 8 },",
"(int[]){ -1, 9, 10, 11 },",
"(int[]){ -1, 12, 13, 14 },",
"};",
"c->dim = dim[VAR_2];",
"c->subclass = subclass[VAR_2];",
"c->masterbook = masterbook[VAR_2];",
"books = (1 << c->subclass);",
"c->books = av_malloc(sizeof(int) * books);",
"for (j = 0; j < books; j++) c->books[j] = nbooks[VAR_2][j];",
"}",
"fc->multiplier = 2;",
"fc->rangebits = VAR_0->blocksize[0] - 1;",
"fc->values = 2;",
"for (VAR_2 = 0; VAR_2 < fc->partitions; VAR_2++)",
"fc->values += fc->classes[fc->partition_to_class[VAR_2]].dim;",
"fc->list = av_malloc(sizeof(floor_entry_t) * fc->values);",
"fc->list[0].x = 0;",
"fc->list[1].x = 1 << fc->rangebits;",
"for (VAR_2 = 2; VAR_2 < fc->values; VAR_2++) {",
"int a[] = {93,23,372,6,46,186,750,14,33,65,130,260,556,3,10,18,28,39,55,79,111,158,220,312,464,650,850};",
"fc->list[VAR_2].x = a[VAR_2 - 2];",
"}",
"ready_floor(fc);",
"VAR_0->nresidues = 1;",
"VAR_0->residues = av_malloc(sizeof(residue_t) * VAR_0->nresidues);",
"rc = &VAR_0->residues[0];",
"rc->type = 2;",
"rc->begin = 0;",
"rc->end = 1600;",
"rc->partition_size = 32;",
"rc->classifications = 10;",
"rc->classbook = 15;",
"rc->books = av_malloc(sizeof(int[8]) * rc->classifications);",
"for (VAR_2 = 0; VAR_2 < rc->classifications; VAR_2++) {",
"int a[10][8] = {",
"{ -1, -1, -1, -1, -1, -1, -1, -1, },",
"{ -1, -1, 16, -1, -1, -1, -1, -1, },",
"{ -1, -1, 17, -1, -1, -1, -1, -1, },",
"{ -1, -1, 18, -1, -1, -1, -1, -1, },",
"{ -1, -1, 19, -1, -1, -1, -1, -1, },",
"{ -1, -1, 20, -1, -1, -1, -1, -1, },",
"{ -1, -1, 21, -1, -1, -1, -1, -1, },",
"{ 22, 23, -1, -1, -1, -1, -1, -1, },",
"{ 24, 25, -1, -1, -1, -1, -1, -1, },",
"{ 26, 27, 28, -1, -1, -1, -1, -1, },",
"};",
"int j;",
"for (j = 0; j < 8; j++) rc->books[VAR_2][j] = a[VAR_2][j];",
"}",
"ready_residue(rc, VAR_0);",
"VAR_0->nmappings = 1;",
"VAR_0->mappings = av_malloc(sizeof(mapping_t) * VAR_0->nmappings);",
"mc = &VAR_0->mappings[0];",
"mc->submaps = 1;",
"mc->mux = av_malloc(sizeof(int) * VAR_0->channels);",
"for (VAR_2 = 0; VAR_2 < VAR_0->channels; VAR_2++) mc->mux[VAR_2] = 0;",
"mc->floor = av_malloc(sizeof(int) * mc->submaps);",
"mc->residue = av_malloc(sizeof(int) * mc->submaps);",
"for (VAR_2 = 0; VAR_2 < mc->submaps; VAR_2++) {",
"mc->floor[VAR_2] = 0;",
"mc->residue[VAR_2] = 0;",
"}",
"mc->coupling_steps = VAR_0->channels == 2 ? 1 : 0;",
"mc->magnitude = av_malloc(sizeof(int) * mc->coupling_steps);",
"mc->angle = av_malloc(sizeof(int) * mc->coupling_steps);",
"if (mc->coupling_steps) {",
"mc->magnitude[0] = 0;",
"mc->angle[0] = 1;",
"}",
"VAR_0->nmodes = 1;",
"VAR_0->modes = av_malloc(sizeof(vorbis_mode_t) * VAR_0->nmodes);",
"VAR_0->modes[0].blockflag = 0;",
"VAR_0->modes[0].mapping = 0;",
"VAR_0->have_saved = 0;",
"VAR_0->saved = av_malloc(sizeof(float) * VAR_0->channels * (1 << VAR_0->blocksize[1]) / 2);",
"VAR_0->samples = av_malloc(sizeof(float) * VAR_0->channels * (1 << VAR_0->blocksize[1]));",
"VAR_0->floor = av_malloc(sizeof(float) * VAR_0->channels * (1 << VAR_0->blocksize[1]) / 2);",
"VAR_0->coeffs = av_malloc(sizeof(float) * VAR_0->channels * (1 << VAR_0->blocksize[1]) / 2);",
"VAR_0->win[0] = ff_vorbis_vwin[VAR_0->blocksize[0] - 6];",
"VAR_0->win[1] = ff_vorbis_vwin[VAR_0->blocksize[1] - 6];",
"ff_mdct_init(&VAR_0->mdct[0], VAR_0->blocksize[0], 0);",
"ff_mdct_init(&VAR_0->mdct[1], VAR_0->blocksize[1], 0);",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1
],
[
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25
],
[
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
],
[
89
],
[
91
],
[
93,
95,
97
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
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
],
[
213
],
[
215
],
[
221
],
[
223
],
[
225
],
[
227
],
[
229
],
[
231
],
[
233
],
[
235
],
[
237
],
[
239
],
[
241
],
[
243
],
[
245
],
[
247
],
[
249
],
[
251
],
[
253
],
[
255
],
[
257
],
[
259
],
[
261
],
[
263
],
[
265
],
[
267
],
[
269
],
[
271
],
[
273
],
[
275
],
[
277
],
[
279
],
[
281
],
[
283
],
[
285
],
[
289
],
[
291
],
[
293
],
[
297
],
[
299
],
[
301
],
[
303
],
[
319
],
[
321
],
[
323
],
[
325
],
[
329
],
[
331
],
[
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
],
[
389
],
[
391
],
[
397
],
[
399
],
[
401
],
[
403
],
[
405
],
[
407
],
[
409
],
[
411
],
[
413
],
[
415
],
[
417
],
[
419
],
[
421
],
[
423
],
[
425
],
[
427
],
[
429
],
[
433
],
[
435
],
[
441
],
[
443
],
[
447
],
[
449
],
[
451
],
[
453
],
[
455
],
[
459
],
[
461
],
[
465
],
[
467
],
[
469
]
]
|
14,875 | static RawAIOCB *raw_aio_setup(BlockDriverState *bs,
int64_t sector_num, uint8_t *buf, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque)
{
BDRVRawState *s = bs->opaque;
RawAIOCB *acb;
if (fd_open(bs) < 0)
return NULL;
acb = qemu_aio_get(bs, cb, opaque);
if (!acb)
return NULL;
acb->fd = raw_fd_pool_get(s);
acb->aiocb.aio_fildes = acb->fd;
acb->aiocb.aio_sigevent.sigev_signo = SIGUSR2;
acb->aiocb.aio_sigevent.sigev_notify = SIGEV_SIGNAL;
acb->aiocb.aio_buf = buf;
if (nb_sectors < 0)
acb->aiocb.aio_nbytes = -nb_sectors;
else
acb->aiocb.aio_nbytes = nb_sectors * 512;
acb->aiocb.aio_offset = sector_num * 512;
acb->next = posix_aio_state->first_aio;
posix_aio_state->first_aio = acb;
return acb;
}
| false | qemu | 3c529d935923a70519557d420db1d5a09a65086a | static RawAIOCB *raw_aio_setup(BlockDriverState *bs,
int64_t sector_num, uint8_t *buf, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque)
{
BDRVRawState *s = bs->opaque;
RawAIOCB *acb;
if (fd_open(bs) < 0)
return NULL;
acb = qemu_aio_get(bs, cb, opaque);
if (!acb)
return NULL;
acb->fd = raw_fd_pool_get(s);
acb->aiocb.aio_fildes = acb->fd;
acb->aiocb.aio_sigevent.sigev_signo = SIGUSR2;
acb->aiocb.aio_sigevent.sigev_notify = SIGEV_SIGNAL;
acb->aiocb.aio_buf = buf;
if (nb_sectors < 0)
acb->aiocb.aio_nbytes = -nb_sectors;
else
acb->aiocb.aio_nbytes = nb_sectors * 512;
acb->aiocb.aio_offset = sector_num * 512;
acb->next = posix_aio_state->first_aio;
posix_aio_state->first_aio = acb;
return acb;
}
| {
"code": [],
"line_no": []
} | static RawAIOCB *FUNC_0(BlockDriverState *bs,
int64_t sector_num, uint8_t *buf, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque)
{
BDRVRawState *s = bs->opaque;
RawAIOCB *acb;
if (fd_open(bs) < 0)
return NULL;
acb = qemu_aio_get(bs, cb, opaque);
if (!acb)
return NULL;
acb->fd = raw_fd_pool_get(s);
acb->aiocb.aio_fildes = acb->fd;
acb->aiocb.aio_sigevent.sigev_signo = SIGUSR2;
acb->aiocb.aio_sigevent.sigev_notify = SIGEV_SIGNAL;
acb->aiocb.aio_buf = buf;
if (nb_sectors < 0)
acb->aiocb.aio_nbytes = -nb_sectors;
else
acb->aiocb.aio_nbytes = nb_sectors * 512;
acb->aiocb.aio_offset = sector_num * 512;
acb->next = posix_aio_state->first_aio;
posix_aio_state->first_aio = acb;
return acb;
}
| [
"static RawAIOCB *FUNC_0(BlockDriverState *bs,\nint64_t sector_num, uint8_t *buf, int nb_sectors,\nBlockDriverCompletionFunc *cb, void *opaque)\n{",
"BDRVRawState *s = bs->opaque;",
"RawAIOCB *acb;",
"if (fd_open(bs) < 0)\nreturn NULL;",
"acb = qemu_aio_get(bs, cb, opaque);",
"if (!acb)\nreturn NULL;",
"acb->fd = raw_fd_pool_get(s);",
"acb->aiocb.aio_fildes = acb->fd;",
"acb->aiocb.aio_sigevent.sigev_signo = SIGUSR2;",
"acb->aiocb.aio_sigevent.sigev_notify = SIGEV_SIGNAL;",
"acb->aiocb.aio_buf = buf;",
"if (nb_sectors < 0)\nacb->aiocb.aio_nbytes = -nb_sectors;",
"else\nacb->aiocb.aio_nbytes = nb_sectors * 512;",
"acb->aiocb.aio_offset = sector_num * 512;",
"acb->next = posix_aio_state->first_aio;",
"posix_aio_state->first_aio = acb;",
"return acb;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5,
7
],
[
9
],
[
11
],
[
15,
17
],
[
21
],
[
23,
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37,
39
],
[
41,
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
]
]
|
14,876 | static uint32_t tpm_tis_data_read(TPMState *s, uint8_t locty)
{
TPMTISEmuState *tis = &s->s.tis;
uint32_t ret = TPM_TIS_NO_DATA_BYTE;
uint16_t len;
if ((tis->loc[locty].sts & TPM_TIS_STS_DATA_AVAILABLE)) {
len = tpm_tis_get_size_from_buffer(&tis->loc[locty].r_buffer);
ret = tis->loc[locty].r_buffer.buffer[tis->loc[locty].r_offset++];
if (tis->loc[locty].r_offset >= len) {
/* got last byte */
tis->loc[locty].sts = TPM_TIS_STS_VALID;
#ifdef RAISE_STS_IRQ
tpm_tis_raise_irq(s, locty, TPM_TIS_INT_STS_VALID);
#endif
}
DPRINTF("tpm_tis: tpm_tis_data_read byte 0x%02x [%d]\n",
ret, tis->loc[locty].r_offset-1);
}
return ret;
}
| false | qemu | fd859081453f94c3cbd6527289e41b7fddbf645f | static uint32_t tpm_tis_data_read(TPMState *s, uint8_t locty)
{
TPMTISEmuState *tis = &s->s.tis;
uint32_t ret = TPM_TIS_NO_DATA_BYTE;
uint16_t len;
if ((tis->loc[locty].sts & TPM_TIS_STS_DATA_AVAILABLE)) {
len = tpm_tis_get_size_from_buffer(&tis->loc[locty].r_buffer);
ret = tis->loc[locty].r_buffer.buffer[tis->loc[locty].r_offset++];
if (tis->loc[locty].r_offset >= len) {
tis->loc[locty].sts = TPM_TIS_STS_VALID;
#ifdef RAISE_STS_IRQ
tpm_tis_raise_irq(s, locty, TPM_TIS_INT_STS_VALID);
#endif
}
DPRINTF("tpm_tis: tpm_tis_data_read byte 0x%02x [%d]\n",
ret, tis->loc[locty].r_offset-1);
}
return ret;
}
| {
"code": [],
"line_no": []
} | static uint32_t FUNC_0(TPMState *s, uint8_t locty)
{
TPMTISEmuState *tis = &s->s.tis;
uint32_t ret = TPM_TIS_NO_DATA_BYTE;
uint16_t len;
if ((tis->loc[locty].sts & TPM_TIS_STS_DATA_AVAILABLE)) {
len = tpm_tis_get_size_from_buffer(&tis->loc[locty].r_buffer);
ret = tis->loc[locty].r_buffer.buffer[tis->loc[locty].r_offset++];
if (tis->loc[locty].r_offset >= len) {
tis->loc[locty].sts = TPM_TIS_STS_VALID;
#ifdef RAISE_STS_IRQ
tpm_tis_raise_irq(s, locty, TPM_TIS_INT_STS_VALID);
#endif
}
DPRINTF("tpm_tis: FUNC_0 byte 0x%02x [%d]\n",
ret, tis->loc[locty].r_offset-1);
}
return ret;
}
| [
"static uint32_t FUNC_0(TPMState *s, uint8_t locty)\n{",
"TPMTISEmuState *tis = &s->s.tis;",
"uint32_t ret = TPM_TIS_NO_DATA_BYTE;",
"uint16_t len;",
"if ((tis->loc[locty].sts & TPM_TIS_STS_DATA_AVAILABLE)) {",
"len = tpm_tis_get_size_from_buffer(&tis->loc[locty].r_buffer);",
"ret = tis->loc[locty].r_buffer.buffer[tis->loc[locty].r_offset++];",
"if (tis->loc[locty].r_offset >= len) {",
"tis->loc[locty].sts = TPM_TIS_STS_VALID;",
"#ifdef RAISE_STS_IRQ\ntpm_tis_raise_irq(s, locty, TPM_TIS_INT_STS_VALID);",
"#endif\n}",
"DPRINTF(\"tpm_tis: FUNC_0 byte 0x%02x [%d]\\n\",\nret, tis->loc[locty].r_offset-1);",
"}",
"return ret;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
19
],
[
21
],
[
25
],
[
27,
29
],
[
31,
33
],
[
35,
37
],
[
39
],
[
43
],
[
45
]
]
|
14,877 | cpu_x86_dump_seg_cache(CPUState *env, FILE *f,
int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
const char *name, struct SegmentCache *sc)
{
#ifdef TARGET_X86_64
if (env->hflags & HF_CS64_MASK) {
cpu_fprintf(f, "%-3s=%04x %016" PRIx64 " %08x %08x", name,
sc->selector, sc->base, sc->limit, sc->flags);
} else
#endif
{
cpu_fprintf(f, "%-3s=%04x %08x %08x %08x", name, sc->selector,
(uint32_t)sc->base, sc->limit, sc->flags);
}
if (!(env->hflags & HF_PE_MASK) || !(sc->flags & DESC_P_MASK))
goto done;
cpu_fprintf(f, " DPL=%d ", (sc->flags & DESC_DPL_MASK) >> DESC_DPL_SHIFT);
if (sc->flags & DESC_S_MASK) {
if (sc->flags & DESC_CS_MASK) {
cpu_fprintf(f, (sc->flags & DESC_L_MASK) ? "CS64" :
((sc->flags & DESC_B_MASK) ? "CS32" : "CS16"));
cpu_fprintf(f, " [%c%c", (sc->flags & DESC_C_MASK) ? 'C' : '-',
(sc->flags & DESC_R_MASK) ? 'R' : '-');
} else {
cpu_fprintf(f, (sc->flags & DESC_B_MASK) ? "DS " : "DS16");
cpu_fprintf(f, " [%c%c", (sc->flags & DESC_E_MASK) ? 'E' : '-',
(sc->flags & DESC_W_MASK) ? 'W' : '-');
}
cpu_fprintf(f, "%c]", (sc->flags & DESC_A_MASK) ? 'A' : '-');
} else {
static const char *sys_type_name[2][16] = {
{ /* 32 bit mode */
"Reserved", "TSS16-avl", "LDT", "TSS16-busy",
"CallGate16", "TaskGate", "IntGate16", "TrapGate16",
"Reserved", "TSS32-avl", "Reserved", "TSS32-busy",
"CallGate32", "Reserved", "IntGate32", "TrapGate32"
},
{ /* 64 bit mode */
"<hiword>", "Reserved", "LDT", "Reserved", "Reserved",
"Reserved", "Reserved", "Reserved", "Reserved",
"TSS64-avl", "Reserved", "TSS64-busy", "CallGate64",
"Reserved", "IntGate64", "TrapGate64"
}
};
cpu_fprintf(f, "%s",
sys_type_name[(env->hflags & HF_LMA_MASK) ? 1 : 0]
[(sc->flags & DESC_TYPE_MASK)
>> DESC_TYPE_SHIFT]);
}
done:
cpu_fprintf(f, "\n");
}
| false | qemu | 9a78eead0c74333a394c0f7bbfc4423ac746fcd5 | cpu_x86_dump_seg_cache(CPUState *env, FILE *f,
int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
const char *name, struct SegmentCache *sc)
{
#ifdef TARGET_X86_64
if (env->hflags & HF_CS64_MASK) {
cpu_fprintf(f, "%-3s=%04x %016" PRIx64 " %08x %08x", name,
sc->selector, sc->base, sc->limit, sc->flags);
} else
#endif
{
cpu_fprintf(f, "%-3s=%04x %08x %08x %08x", name, sc->selector,
(uint32_t)sc->base, sc->limit, sc->flags);
}
if (!(env->hflags & HF_PE_MASK) || !(sc->flags & DESC_P_MASK))
goto done;
cpu_fprintf(f, " DPL=%d ", (sc->flags & DESC_DPL_MASK) >> DESC_DPL_SHIFT);
if (sc->flags & DESC_S_MASK) {
if (sc->flags & DESC_CS_MASK) {
cpu_fprintf(f, (sc->flags & DESC_L_MASK) ? "CS64" :
((sc->flags & DESC_B_MASK) ? "CS32" : "CS16"));
cpu_fprintf(f, " [%c%c", (sc->flags & DESC_C_MASK) ? 'C' : '-',
(sc->flags & DESC_R_MASK) ? 'R' : '-');
} else {
cpu_fprintf(f, (sc->flags & DESC_B_MASK) ? "DS " : "DS16");
cpu_fprintf(f, " [%c%c", (sc->flags & DESC_E_MASK) ? 'E' : '-',
(sc->flags & DESC_W_MASK) ? 'W' : '-');
}
cpu_fprintf(f, "%c]", (sc->flags & DESC_A_MASK) ? 'A' : '-');
} else {
static const char *sys_type_name[2][16] = {
{
"Reserved", "TSS16-avl", "LDT", "TSS16-busy",
"CallGate16", "TaskGate", "IntGate16", "TrapGate16",
"Reserved", "TSS32-avl", "Reserved", "TSS32-busy",
"CallGate32", "Reserved", "IntGate32", "TrapGate32"
},
{
"<hiword>", "Reserved", "LDT", "Reserved", "Reserved",
"Reserved", "Reserved", "Reserved", "Reserved",
"TSS64-avl", "Reserved", "TSS64-busy", "CallGate64",
"Reserved", "IntGate64", "TrapGate64"
}
};
cpu_fprintf(f, "%s",
sys_type_name[(env->hflags & HF_LMA_MASK) ? 1 : 0]
[(sc->flags & DESC_TYPE_MASK)
>> DESC_TYPE_SHIFT]);
}
done:
cpu_fprintf(f, "\n");
}
| {
"code": [],
"line_no": []
} | FUNC_0(CPUState *VAR_0, FILE *VAR_3,
int (*VAR_2)(FILE *VAR_3, const char *VAR_3, ...),
const char *VAR_4, struct SegmentCache *VAR_5)
{
#ifdef TARGET_X86_64
if (VAR_0->hflags & HF_CS64_MASK) {
VAR_2(VAR_3, "%-3s=%04x %016" PRIx64 " %08x %08x", VAR_4,
VAR_5->selector, VAR_5->base, VAR_5->limit, VAR_5->flags);
} else
#endif
{
VAR_2(VAR_3, "%-3s=%04x %08x %08x %08x", VAR_4, VAR_5->selector,
(uint32_t)VAR_5->base, VAR_5->limit, VAR_5->flags);
}
if (!(VAR_0->hflags & HF_PE_MASK) || !(VAR_5->flags & DESC_P_MASK))
goto done;
VAR_2(VAR_3, " DPL=%d ", (VAR_5->flags & DESC_DPL_MASK) >> DESC_DPL_SHIFT);
if (VAR_5->flags & DESC_S_MASK) {
if (VAR_5->flags & DESC_CS_MASK) {
VAR_2(VAR_3, (VAR_5->flags & DESC_L_MASK) ? "CS64" :
((VAR_5->flags & DESC_B_MASK) ? "CS32" : "CS16"));
VAR_2(VAR_3, " [%c%c", (VAR_5->flags & DESC_C_MASK) ? 'C' : '-',
(VAR_5->flags & DESC_R_MASK) ? 'R' : '-');
} else {
VAR_2(VAR_3, (VAR_5->flags & DESC_B_MASK) ? "DS " : "DS16");
VAR_2(VAR_3, " [%c%c", (VAR_5->flags & DESC_E_MASK) ? 'E' : '-',
(VAR_5->flags & DESC_W_MASK) ? 'W' : '-');
}
VAR_2(VAR_3, "%c]", (VAR_5->flags & DESC_A_MASK) ? 'A' : '-');
} else {
static const char *VAR_6[2][16] = {
{
"Reserved", "TSS16-avl", "LDT", "TSS16-busy",
"CallGate16", "TaskGate", "IntGate16", "TrapGate16",
"Reserved", "TSS32-avl", "Reserved", "TSS32-busy",
"CallGate32", "Reserved", "IntGate32", "TrapGate32"
},
{
"<hiword>", "Reserved", "LDT", "Reserved", "Reserved",
"Reserved", "Reserved", "Reserved", "Reserved",
"TSS64-avl", "Reserved", "TSS64-busy", "CallGate64",
"Reserved", "IntGate64", "TrapGate64"
}
};
VAR_2(VAR_3, "%s",
VAR_6[(VAR_0->hflags & HF_LMA_MASK) ? 1 : 0]
[(VAR_5->flags & DESC_TYPE_MASK)
>> DESC_TYPE_SHIFT]);
}
done:
VAR_2(VAR_3, "\n");
}
| [
"FUNC_0(CPUState *VAR_0, FILE *VAR_3,\nint (*VAR_2)(FILE *VAR_3, const char *VAR_3, ...),\nconst char *VAR_4, struct SegmentCache *VAR_5)\n{",
"#ifdef TARGET_X86_64\nif (VAR_0->hflags & HF_CS64_MASK) {",
"VAR_2(VAR_3, \"%-3s=%04x %016\" PRIx64 \" %08x %08x\", VAR_4,\nVAR_5->selector, VAR_5->base, VAR_5->limit, VAR_5->flags);",
"} else",
"#endif\n{",
"VAR_2(VAR_3, \"%-3s=%04x %08x %08x %08x\", VAR_4, VAR_5->selector,\n(uint32_t)VAR_5->base, VAR_5->limit, VAR_5->flags);",
"}",
"if (!(VAR_0->hflags & HF_PE_MASK) || !(VAR_5->flags & DESC_P_MASK))\ngoto done;",
"VAR_2(VAR_3, \" DPL=%d \", (VAR_5->flags & DESC_DPL_MASK) >> DESC_DPL_SHIFT);",
"if (VAR_5->flags & DESC_S_MASK) {",
"if (VAR_5->flags & DESC_CS_MASK) {",
"VAR_2(VAR_3, (VAR_5->flags & DESC_L_MASK) ? \"CS64\" :\n((VAR_5->flags & DESC_B_MASK) ? \"CS32\" : \"CS16\"));",
"VAR_2(VAR_3, \" [%c%c\", (VAR_5->flags & DESC_C_MASK) ? 'C' : '-',\n(VAR_5->flags & DESC_R_MASK) ? 'R' : '-');",
"} else {",
"VAR_2(VAR_3, (VAR_5->flags & DESC_B_MASK) ? \"DS \" : \"DS16\");",
"VAR_2(VAR_3, \" [%c%c\", (VAR_5->flags & DESC_E_MASK) ? 'E' : '-',\n(VAR_5->flags & DESC_W_MASK) ? 'W' : '-');",
"}",
"VAR_2(VAR_3, \"%c]\", (VAR_5->flags & DESC_A_MASK) ? 'A' : '-');",
"} else {",
"static const char *VAR_6[2][16] = {",
"{",
"\"Reserved\", \"TSS16-avl\", \"LDT\", \"TSS16-busy\",\n\"CallGate16\", \"TaskGate\", \"IntGate16\", \"TrapGate16\",\n\"Reserved\", \"TSS32-avl\", \"Reserved\", \"TSS32-busy\",\n\"CallGate32\", \"Reserved\", \"IntGate32\", \"TrapGate32\"\n},",
"{",
"\"<hiword>\", \"Reserved\", \"LDT\", \"Reserved\", \"Reserved\",\n\"Reserved\", \"Reserved\", \"Reserved\", \"Reserved\",\n\"TSS64-avl\", \"Reserved\", \"TSS64-busy\", \"CallGate64\",\n\"Reserved\", \"IntGate64\", \"TrapGate64\"\n}",
"};",
"VAR_2(VAR_3, \"%s\",\nVAR_6[(VAR_0->hflags & HF_LMA_MASK) ? 1 : 0]\n[(VAR_5->flags & DESC_TYPE_MASK)\n>> DESC_TYPE_SHIFT]);",
"}",
"done:\nVAR_2(VAR_3, \"\\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
]
| [
[
1,
3,
5,
7
],
[
9,
11
],
[
13,
15
],
[
17
],
[
19,
21
],
[
23,
25
],
[
27
],
[
31,
33
],
[
37
],
[
39
],
[
41
],
[
43,
45
],
[
47,
49
],
[
51
],
[
53
],
[
55,
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
]
]
|
14,878 | static int qemu_gluster_parse_uri(BlockdevOptionsGluster *gconf,
const char *filename)
{
SocketAddress *gsconf;
URI *uri;
QueryParams *qp = NULL;
bool is_unix = false;
int ret = 0;
uri = uri_parse(filename);
if (!uri) {
return -EINVAL;
}
gconf->server = g_new0(SocketAddressList, 1);
gconf->server->value = gsconf = g_new0(SocketAddress, 1);
/* transport */
if (!uri->scheme || !strcmp(uri->scheme, "gluster")) {
gsconf->type = SOCKET_ADDRESS_TYPE_INET;
} else if (!strcmp(uri->scheme, "gluster+tcp")) {
gsconf->type = SOCKET_ADDRESS_TYPE_INET;
} else if (!strcmp(uri->scheme, "gluster+unix")) {
gsconf->type = SOCKET_ADDRESS_TYPE_UNIX;
is_unix = true;
} else if (!strcmp(uri->scheme, "gluster+rdma")) {
gsconf->type = SOCKET_ADDRESS_TYPE_INET;
error_report("Warning: rdma feature is not supported, falling "
"back to tcp");
} else {
ret = -EINVAL;
goto out;
}
ret = parse_volume_options(gconf, uri->path);
if (ret < 0) {
goto out;
}
qp = query_params_parse(uri->query);
if (qp->n > 1 || (is_unix && !qp->n) || (!is_unix && qp->n)) {
ret = -EINVAL;
goto out;
}
if (is_unix) {
if (uri->server || uri->port) {
ret = -EINVAL;
goto out;
}
if (strcmp(qp->p[0].name, "socket")) {
ret = -EINVAL;
goto out;
}
gsconf->u.q_unix.path = g_strdup(qp->p[0].value);
} else {
gsconf->u.inet.host = g_strdup(uri->server ? uri->server : "localhost");
if (uri->port) {
gsconf->u.inet.port = g_strdup_printf("%d", uri->port);
} else {
gsconf->u.inet.port = g_strdup_printf("%d", GLUSTER_DEFAULT_PORT);
}
}
out:
if (qp) {
query_params_free(qp);
}
uri_free(uri);
return ret;
}
| false | qemu | 3dc6f8693694a649a9c83f1e2746565b47683923 | static int qemu_gluster_parse_uri(BlockdevOptionsGluster *gconf,
const char *filename)
{
SocketAddress *gsconf;
URI *uri;
QueryParams *qp = NULL;
bool is_unix = false;
int ret = 0;
uri = uri_parse(filename);
if (!uri) {
return -EINVAL;
}
gconf->server = g_new0(SocketAddressList, 1);
gconf->server->value = gsconf = g_new0(SocketAddress, 1);
if (!uri->scheme || !strcmp(uri->scheme, "gluster")) {
gsconf->type = SOCKET_ADDRESS_TYPE_INET;
} else if (!strcmp(uri->scheme, "gluster+tcp")) {
gsconf->type = SOCKET_ADDRESS_TYPE_INET;
} else if (!strcmp(uri->scheme, "gluster+unix")) {
gsconf->type = SOCKET_ADDRESS_TYPE_UNIX;
is_unix = true;
} else if (!strcmp(uri->scheme, "gluster+rdma")) {
gsconf->type = SOCKET_ADDRESS_TYPE_INET;
error_report("Warning: rdma feature is not supported, falling "
"back to tcp");
} else {
ret = -EINVAL;
goto out;
}
ret = parse_volume_options(gconf, uri->path);
if (ret < 0) {
goto out;
}
qp = query_params_parse(uri->query);
if (qp->n > 1 || (is_unix && !qp->n) || (!is_unix && qp->n)) {
ret = -EINVAL;
goto out;
}
if (is_unix) {
if (uri->server || uri->port) {
ret = -EINVAL;
goto out;
}
if (strcmp(qp->p[0].name, "socket")) {
ret = -EINVAL;
goto out;
}
gsconf->u.q_unix.path = g_strdup(qp->p[0].value);
} else {
gsconf->u.inet.host = g_strdup(uri->server ? uri->server : "localhost");
if (uri->port) {
gsconf->u.inet.port = g_strdup_printf("%d", uri->port);
} else {
gsconf->u.inet.port = g_strdup_printf("%d", GLUSTER_DEFAULT_PORT);
}
}
out:
if (qp) {
query_params_free(qp);
}
uri_free(uri);
return ret;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(BlockdevOptionsGluster *VAR_0,
const char *VAR_1)
{
SocketAddress *gsconf;
URI *uri;
QueryParams *qp = NULL;
bool is_unix = false;
int VAR_2 = 0;
uri = uri_parse(VAR_1);
if (!uri) {
return -EINVAL;
}
VAR_0->server = g_new0(SocketAddressList, 1);
VAR_0->server->value = gsconf = g_new0(SocketAddress, 1);
if (!uri->scheme || !strcmp(uri->scheme, "gluster")) {
gsconf->type = SOCKET_ADDRESS_TYPE_INET;
} else if (!strcmp(uri->scheme, "gluster+tcp")) {
gsconf->type = SOCKET_ADDRESS_TYPE_INET;
} else if (!strcmp(uri->scheme, "gluster+unix")) {
gsconf->type = SOCKET_ADDRESS_TYPE_UNIX;
is_unix = true;
} else if (!strcmp(uri->scheme, "gluster+rdma")) {
gsconf->type = SOCKET_ADDRESS_TYPE_INET;
error_report("Warning: rdma feature is not supported, falling "
"back to tcp");
} else {
VAR_2 = -EINVAL;
goto out;
}
VAR_2 = parse_volume_options(VAR_0, uri->path);
if (VAR_2 < 0) {
goto out;
}
qp = query_params_parse(uri->query);
if (qp->n > 1 || (is_unix && !qp->n) || (!is_unix && qp->n)) {
VAR_2 = -EINVAL;
goto out;
}
if (is_unix) {
if (uri->server || uri->port) {
VAR_2 = -EINVAL;
goto out;
}
if (strcmp(qp->p[0].name, "socket")) {
VAR_2 = -EINVAL;
goto out;
}
gsconf->u.q_unix.path = g_strdup(qp->p[0].value);
} else {
gsconf->u.inet.host = g_strdup(uri->server ? uri->server : "localhost");
if (uri->port) {
gsconf->u.inet.port = g_strdup_printf("%d", uri->port);
} else {
gsconf->u.inet.port = g_strdup_printf("%d", GLUSTER_DEFAULT_PORT);
}
}
out:
if (qp) {
query_params_free(qp);
}
uri_free(uri);
return VAR_2;
}
| [
"static int FUNC_0(BlockdevOptionsGluster *VAR_0,\nconst char *VAR_1)\n{",
"SocketAddress *gsconf;",
"URI *uri;",
"QueryParams *qp = NULL;",
"bool is_unix = false;",
"int VAR_2 = 0;",
"uri = uri_parse(VAR_1);",
"if (!uri) {",
"return -EINVAL;",
"}",
"VAR_0->server = g_new0(SocketAddressList, 1);",
"VAR_0->server->value = gsconf = g_new0(SocketAddress, 1);",
"if (!uri->scheme || !strcmp(uri->scheme, \"gluster\")) {",
"gsconf->type = SOCKET_ADDRESS_TYPE_INET;",
"} else if (!strcmp(uri->scheme, \"gluster+tcp\")) {",
"gsconf->type = SOCKET_ADDRESS_TYPE_INET;",
"} else if (!strcmp(uri->scheme, \"gluster+unix\")) {",
"gsconf->type = SOCKET_ADDRESS_TYPE_UNIX;",
"is_unix = true;",
"} else if (!strcmp(uri->scheme, \"gluster+rdma\")) {",
"gsconf->type = SOCKET_ADDRESS_TYPE_INET;",
"error_report(\"Warning: rdma feature is not supported, falling \"\n\"back to tcp\");",
"} else {",
"VAR_2 = -EINVAL;",
"goto out;",
"}",
"VAR_2 = parse_volume_options(VAR_0, uri->path);",
"if (VAR_2 < 0) {",
"goto out;",
"}",
"qp = query_params_parse(uri->query);",
"if (qp->n > 1 || (is_unix && !qp->n) || (!is_unix && qp->n)) {",
"VAR_2 = -EINVAL;",
"goto out;",
"}",
"if (is_unix) {",
"if (uri->server || uri->port) {",
"VAR_2 = -EINVAL;",
"goto out;",
"}",
"if (strcmp(qp->p[0].name, \"socket\")) {",
"VAR_2 = -EINVAL;",
"goto out;",
"}",
"gsconf->u.q_unix.path = g_strdup(qp->p[0].value);",
"} else {",
"gsconf->u.inet.host = g_strdup(uri->server ? uri->server : \"localhost\");",
"if (uri->port) {",
"gsconf->u.inet.port = g_strdup_printf(\"%d\", uri->port);",
"} else {",
"gsconf->u.inet.port = g_strdup_printf(\"%d\", GLUSTER_DEFAULT_PORT);",
"}",
"}",
"out:\nif (qp) {",
"query_params_free(qp);",
"}",
"uri_free(uri);",
"return VAR_2;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23
],
[
25
],
[
29
],
[
31
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55,
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
69
],
[
71
],
[
73
],
[
75
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
129,
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
]
]
|
14,879 | static BlockDriverAIOCB *paio_submit(BlockDriverState *bs, HANDLE hfile,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque, int type)
{
RawWin32AIOData *acb = g_slice_new(RawWin32AIOData);
acb->bs = bs;
acb->hfile = hfile;
acb->aio_type = type;
if (qiov) {
acb->aio_iov = qiov->iov;
acb->aio_niov = qiov->niov;
}
acb->aio_nbytes = nb_sectors * 512;
acb->aio_offset = sector_num * 512;
trace_paio_submit(acb, opaque, sector_num, nb_sectors, type);
return thread_pool_submit_aio(aio_worker, acb, cb, opaque);
}
| false | qemu | c4d9d19645a484298a67e9021060bc7c2b081d0f | static BlockDriverAIOCB *paio_submit(BlockDriverState *bs, HANDLE hfile,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque, int type)
{
RawWin32AIOData *acb = g_slice_new(RawWin32AIOData);
acb->bs = bs;
acb->hfile = hfile;
acb->aio_type = type;
if (qiov) {
acb->aio_iov = qiov->iov;
acb->aio_niov = qiov->niov;
}
acb->aio_nbytes = nb_sectors * 512;
acb->aio_offset = sector_num * 512;
trace_paio_submit(acb, opaque, sector_num, nb_sectors, type);
return thread_pool_submit_aio(aio_worker, acb, cb, opaque);
}
| {
"code": [],
"line_no": []
} | static BlockDriverAIOCB *FUNC_0(BlockDriverState *bs, HANDLE hfile,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque, int type)
{
RawWin32AIOData *acb = g_slice_new(RawWin32AIOData);
acb->bs = bs;
acb->hfile = hfile;
acb->aio_type = type;
if (qiov) {
acb->aio_iov = qiov->iov;
acb->aio_niov = qiov->niov;
}
acb->aio_nbytes = nb_sectors * 512;
acb->aio_offset = sector_num * 512;
trace_paio_submit(acb, opaque, sector_num, nb_sectors, type);
return thread_pool_submit_aio(aio_worker, acb, cb, opaque);
}
| [
"static BlockDriverAIOCB *FUNC_0(BlockDriverState *bs, HANDLE hfile,\nint64_t sector_num, QEMUIOVector *qiov, int nb_sectors,\nBlockDriverCompletionFunc *cb, void *opaque, int type)\n{",
"RawWin32AIOData *acb = g_slice_new(RawWin32AIOData);",
"acb->bs = bs;",
"acb->hfile = hfile;",
"acb->aio_type = type;",
"if (qiov) {",
"acb->aio_iov = qiov->iov;",
"acb->aio_niov = qiov->niov;",
"}",
"acb->aio_nbytes = nb_sectors * 512;",
"acb->aio_offset = sector_num * 512;",
"trace_paio_submit(acb, opaque, sector_num, nb_sectors, type);",
"return thread_pool_submit_aio(aio_worker, acb, cb, opaque);",
"}"
]
| [
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
],
[
35
],
[
37
],
[
39
]
]
|
14,880 | static void special_write(void *opaque, target_phys_addr_t addr,
uint64_t val, unsigned size)
{
qemu_log("pci: special write cycle");
}
| false | qemu | a8170e5e97ad17ca169c64ba87ae2f53850dab4c | static void special_write(void *opaque, target_phys_addr_t addr,
uint64_t val, unsigned size)
{
qemu_log("pci: special write cycle");
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,
uint64_t VAR_2, unsigned VAR_3)
{
qemu_log("pci: special write cycle");
}
| [
"static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{",
"qemu_log(\"pci: special write cycle\");",
"}"
]
| [
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
]
]
|
14,881 | MemoryRegionSection *phys_page_find(AddressSpaceDispatch *d, hwaddr index)
{
PhysPageEntry lp = d->phys_map;
PhysPageEntry *p;
int i;
for (i = P_L2_LEVELS - 1; i >= 0 && !lp.is_leaf; i--) {
if (lp.ptr == PHYS_MAP_NODE_NIL) {
return &phys_sections[phys_section_unassigned];
}
p = phys_map_nodes[lp.ptr];
lp = p[(index >> (i * L2_BITS)) & (L2_SIZE - 1)];
}
return &phys_sections[lp.ptr];
}
| false | qemu | 149f54b53b7666a3facd45e86eece60ce7d3b114 | MemoryRegionSection *phys_page_find(AddressSpaceDispatch *d, hwaddr index)
{
PhysPageEntry lp = d->phys_map;
PhysPageEntry *p;
int i;
for (i = P_L2_LEVELS - 1; i >= 0 && !lp.is_leaf; i--) {
if (lp.ptr == PHYS_MAP_NODE_NIL) {
return &phys_sections[phys_section_unassigned];
}
p = phys_map_nodes[lp.ptr];
lp = p[(index >> (i * L2_BITS)) & (L2_SIZE - 1)];
}
return &phys_sections[lp.ptr];
}
| {
"code": [],
"line_no": []
} | MemoryRegionSection *FUNC_0(AddressSpaceDispatch *d, hwaddr index)
{
PhysPageEntry lp = d->phys_map;
PhysPageEntry *p;
int VAR_0;
for (VAR_0 = P_L2_LEVELS - 1; VAR_0 >= 0 && !lp.is_leaf; VAR_0--) {
if (lp.ptr == PHYS_MAP_NODE_NIL) {
return &phys_sections[phys_section_unassigned];
}
p = phys_map_nodes[lp.ptr];
lp = p[(index >> (VAR_0 * L2_BITS)) & (L2_SIZE - 1)];
}
return &phys_sections[lp.ptr];
}
| [
"MemoryRegionSection *FUNC_0(AddressSpaceDispatch *d, hwaddr index)\n{",
"PhysPageEntry lp = d->phys_map;",
"PhysPageEntry *p;",
"int VAR_0;",
"for (VAR_0 = P_L2_LEVELS - 1; VAR_0 >= 0 && !lp.is_leaf; VAR_0--) {",
"if (lp.ptr == PHYS_MAP_NODE_NIL) {",
"return &phys_sections[phys_section_unassigned];",
"}",
"p = phys_map_nodes[lp.ptr];",
"lp = p[(index >> (VAR_0 * L2_BITS)) & (L2_SIZE - 1)];",
"}",
"return &phys_sections[lp.ptr];",
"}"
]
| [
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
]
]
|
14,882 | static inline int qemu_gluster_zerofill(struct glfs_fd *fd, int64_t offset,
int64_t size)
{
return glfs_zerofill(fd, offset, size);
}
| false | qemu | df3a429ae82c0f45becdfab105617701d75e0f05 | static inline int qemu_gluster_zerofill(struct glfs_fd *fd, int64_t offset,
int64_t size)
{
return glfs_zerofill(fd, offset, size);
}
| {
"code": [],
"line_no": []
} | static inline int FUNC_0(struct glfs_fd *VAR_0, int64_t VAR_1,
int64_t VAR_2)
{
return glfs_zerofill(VAR_0, VAR_1, VAR_2);
}
| [
"static inline int FUNC_0(struct glfs_fd *VAR_0, int64_t VAR_1,\nint64_t VAR_2)\n{",
"return glfs_zerofill(VAR_0, VAR_1, VAR_2);",
"}"
]
| [
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
]
]
|
14,883 | static void write_cont (void *opaque, uint32_t nport, uint32_t data)
{
struct dma_cont *d = opaque;
int iport, ichan;
iport = (nport >> d->dshift) & 0x0f;
switch (iport) {
case 8: /* command */
if (data && (data | CMD_NOT_SUPPORTED)) {
log ("command %#x not supported\n", data);
goto error;
}
d->command = data;
break;
case 9:
ichan = data & 3;
if (data & 4) {
d->status |= 1 << (ichan + 4);
}
else {
d->status &= ~(1 << (ichan + 4));
}
d->status &= ~(1 << ichan);
break;
case 0xa: /* single mask */
if (data & 4)
d->mask |= 1 << (data & 3);
else
d->mask &= ~(1 << (data & 3));
break;
case 0xb: /* mode */
{
ichan = data & 3;
#ifdef DEBUG_DMA
int op;
int ai;
int dir;
int opmode;
op = (data >> 2) & 3;
ai = (data >> 4) & 1;
dir = (data >> 5) & 1;
opmode = (data >> 6) & 3;
linfo ("ichan %d, op %d, ai %d, dir %d, opmode %d\n",
ichan, op, ai, dir, opmode);
#endif
d->regs[ichan].mode = data;
break;
}
case 0xc: /* clear flip flop */
d->flip_flop = 0;
break;
case 0xd: /* reset */
d->flip_flop = 0;
d->mask = ~0;
d->status = 0;
d->command = 0;
break;
case 0xe: /* clear mask for all channels */
d->mask = 0;
break;
case 0xf: /* write mask for all channels */
d->mask = data;
break;
default:
log ("dma: unknown iport %#x\n", iport);
goto error;
}
#ifdef DEBUG_DMA
if (0xc != iport) {
linfo ("nport %#06x, ichan % 2d, val %#06x\n",
nport, ichan, data);
}
#endif
return;
error:
abort ();
}
| false | qemu | df475d18d890572b8456ebff327bb9debee6289a | static void write_cont (void *opaque, uint32_t nport, uint32_t data)
{
struct dma_cont *d = opaque;
int iport, ichan;
iport = (nport >> d->dshift) & 0x0f;
switch (iport) {
case 8:
if (data && (data | CMD_NOT_SUPPORTED)) {
log ("command %#x not supported\n", data);
goto error;
}
d->command = data;
break;
case 9:
ichan = data & 3;
if (data & 4) {
d->status |= 1 << (ichan + 4);
}
else {
d->status &= ~(1 << (ichan + 4));
}
d->status &= ~(1 << ichan);
break;
case 0xa:
if (data & 4)
d->mask |= 1 << (data & 3);
else
d->mask &= ~(1 << (data & 3));
break;
case 0xb:
{
ichan = data & 3;
#ifdef DEBUG_DMA
int op;
int ai;
int dir;
int opmode;
op = (data >> 2) & 3;
ai = (data >> 4) & 1;
dir = (data >> 5) & 1;
opmode = (data >> 6) & 3;
linfo ("ichan %d, op %d, ai %d, dir %d, opmode %d\n",
ichan, op, ai, dir, opmode);
#endif
d->regs[ichan].mode = data;
break;
}
case 0xc:
d->flip_flop = 0;
break;
case 0xd:
d->flip_flop = 0;
d->mask = ~0;
d->status = 0;
d->command = 0;
break;
case 0xe:
d->mask = 0;
break;
case 0xf:
d->mask = data;
break;
default:
log ("dma: unknown iport %#x\n", iport);
goto error;
}
#ifdef DEBUG_DMA
if (0xc != iport) {
linfo ("nport %#06x, ichan % 2d, val %#06x\n",
nport, ichan, data);
}
#endif
return;
error:
abort ();
}
| {
"code": [],
"line_no": []
} | static void FUNC_0 (void *VAR_0, uint32_t VAR_1, uint32_t VAR_2)
{
struct dma_cont *VAR_3 = VAR_0;
int VAR_4, VAR_5;
VAR_4 = (VAR_1 >> VAR_3->dshift) & 0x0f;
switch (VAR_4) {
case 8:
if (VAR_2 && (VAR_2 | CMD_NOT_SUPPORTED)) {
log ("command %#x not supported\n", VAR_2);
goto error;
}
VAR_3->command = VAR_2;
break;
case 9:
VAR_5 = VAR_2 & 3;
if (VAR_2 & 4) {
VAR_3->status |= 1 << (VAR_5 + 4);
}
else {
VAR_3->status &= ~(1 << (VAR_5 + 4));
}
VAR_3->status &= ~(1 << VAR_5);
break;
case 0xa:
if (VAR_2 & 4)
VAR_3->mask |= 1 << (VAR_2 & 3);
else
VAR_3->mask &= ~(1 << (VAR_2 & 3));
break;
case 0xb:
{
VAR_5 = VAR_2 & 3;
#ifdef DEBUG_DMA
int op;
int ai;
int dir;
int opmode;
op = (VAR_2 >> 2) & 3;
ai = (VAR_2 >> 4) & 1;
dir = (VAR_2 >> 5) & 1;
opmode = (VAR_2 >> 6) & 3;
linfo ("VAR_5 %VAR_3, op %VAR_3, ai %VAR_3, dir %VAR_3, opmode %VAR_3\n",
VAR_5, op, ai, dir, opmode);
#endif
VAR_3->regs[VAR_5].mode = VAR_2;
break;
}
case 0xc:
VAR_3->flip_flop = 0;
break;
case 0xd:
VAR_3->flip_flop = 0;
VAR_3->mask = ~0;
VAR_3->status = 0;
VAR_3->command = 0;
break;
case 0xe:
VAR_3->mask = 0;
break;
case 0xf:
VAR_3->mask = VAR_2;
break;
default:
log ("dma: unknown VAR_4 %#x\n", VAR_4);
goto error;
}
#ifdef DEBUG_DMA
if (0xc != VAR_4) {
linfo ("VAR_1 %#06x, VAR_5 % 2d, val %#06x\n",
VAR_1, VAR_5, VAR_2);
}
#endif
return;
error:
abort ();
}
| [
"static void FUNC_0 (void *VAR_0, uint32_t VAR_1, uint32_t VAR_2)\n{",
"struct dma_cont *VAR_3 = VAR_0;",
"int VAR_4, VAR_5;",
"VAR_4 = (VAR_1 >> VAR_3->dshift) & 0x0f;",
"switch (VAR_4) {",
"case 8:\nif (VAR_2 && (VAR_2 | CMD_NOT_SUPPORTED)) {",
"log (\"command %#x not supported\\n\", VAR_2);",
"goto error;",
"}",
"VAR_3->command = VAR_2;",
"break;",
"case 9:\nVAR_5 = VAR_2 & 3;",
"if (VAR_2 & 4) {",
"VAR_3->status |= 1 << (VAR_5 + 4);",
"}",
"else {",
"VAR_3->status &= ~(1 << (VAR_5 + 4));",
"}",
"VAR_3->status &= ~(1 << VAR_5);",
"break;",
"case 0xa:\nif (VAR_2 & 4)\nVAR_3->mask |= 1 << (VAR_2 & 3);",
"else\nVAR_3->mask &= ~(1 << (VAR_2 & 3));",
"break;",
"case 0xb:\n{",
"VAR_5 = VAR_2 & 3;",
"#ifdef DEBUG_DMA\nint op;",
"int ai;",
"int dir;",
"int opmode;",
"op = (VAR_2 >> 2) & 3;",
"ai = (VAR_2 >> 4) & 1;",
"dir = (VAR_2 >> 5) & 1;",
"opmode = (VAR_2 >> 6) & 3;",
"linfo (\"VAR_5 %VAR_3, op %VAR_3, ai %VAR_3, dir %VAR_3, opmode %VAR_3\\n\",\nVAR_5, op, ai, dir, opmode);",
"#endif\nVAR_3->regs[VAR_5].mode = VAR_2;",
"break;",
"}",
"case 0xc:\nVAR_3->flip_flop = 0;",
"break;",
"case 0xd:\nVAR_3->flip_flop = 0;",
"VAR_3->mask = ~0;",
"VAR_3->status = 0;",
"VAR_3->command = 0;",
"break;",
"case 0xe:\nVAR_3->mask = 0;",
"break;",
"case 0xf:\nVAR_3->mask = VAR_2;",
"break;",
"default:\nlog (\"dma: unknown VAR_4 %#x\\n\", VAR_4);",
"goto error;",
"}",
"#ifdef DEBUG_DMA\nif (0xc != VAR_4) {",
"linfo (\"VAR_1 %#06x, VAR_5 % 2d, val %#06x\\n\",\nVAR_1, VAR_5, VAR_2);",
"}",
"#endif\nreturn;",
"error:\nabort ();",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
31,
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
53,
55,
57
],
[
59,
61
],
[
63
],
[
67,
69
],
[
71
],
[
73,
75
],
[
77
],
[
79
],
[
81
],
[
85
],
[
87
],
[
89
],
[
91
],
[
95,
97
],
[
99,
103
],
[
105
],
[
107
],
[
111,
113
],
[
115
],
[
119,
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
133,
135
],
[
137
],
[
141,
143
],
[
145
],
[
149,
151
],
[
153
],
[
155
],
[
159,
161
],
[
163,
165
],
[
167
],
[
169,
171
],
[
175,
177
],
[
179
]
]
|
14,885 | static void test_visitor_in_fail_list(TestInputVisitorData *data,
const void *unused)
{
int64_t i64 = -1;
Visitor *v;
/* Unvisited list tail */
v = visitor_input_test_init(data, "[ 1, 2, 3 ]");
visit_start_list(v, NULL, NULL, 0, &error_abort);
visit_type_int(v, NULL, &i64, &error_abort);
g_assert_cmpint(i64, ==, 1);
visit_type_int(v, NULL, &i64, &error_abort);
g_assert_cmpint(i64, ==, 2);
visit_end_list(v, NULL);
/* BUG: unvisited tail not reported; actually not reportable by design */
}
| false | qemu | a4a1c70dc759e5b81627e96564f344ab43ea86eb | static void test_visitor_in_fail_list(TestInputVisitorData *data,
const void *unused)
{
int64_t i64 = -1;
Visitor *v;
v = visitor_input_test_init(data, "[ 1, 2, 3 ]");
visit_start_list(v, NULL, NULL, 0, &error_abort);
visit_type_int(v, NULL, &i64, &error_abort);
g_assert_cmpint(i64, ==, 1);
visit_type_int(v, NULL, &i64, &error_abort);
g_assert_cmpint(i64, ==, 2);
visit_end_list(v, NULL);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(TestInputVisitorData *VAR_0,
const void *VAR_1)
{
int64_t i64 = -1;
Visitor *v;
v = visitor_input_test_init(VAR_0, "[ 1, 2, 3 ]");
visit_start_list(v, NULL, NULL, 0, &error_abort);
visit_type_int(v, NULL, &i64, &error_abort);
g_assert_cmpint(i64, ==, 1);
visit_type_int(v, NULL, &i64, &error_abort);
g_assert_cmpint(i64, ==, 2);
visit_end_list(v, NULL);
}
| [
"static void FUNC_0(TestInputVisitorData *VAR_0,\nconst void *VAR_1)\n{",
"int64_t i64 = -1;",
"Visitor *v;",
"v = visitor_input_test_init(VAR_0, \"[ 1, 2, 3 ]\");",
"visit_start_list(v, NULL, NULL, 0, &error_abort);",
"visit_type_int(v, NULL, &i64, &error_abort);",
"g_assert_cmpint(i64, ==, 1);",
"visit_type_int(v, NULL, &i64, &error_abort);",
"g_assert_cmpint(i64, ==, 2);",
"visit_end_list(v, NULL);",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
17
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
35
]
]
|
14,886 | void qemu_console_copy(QEMUConsole *console, int src_x, int src_y,
int dst_x, int dst_y, int w, int h) {
if (active_console == console) {
if (console->ds->dpy_copy)
console->ds->dpy_copy(console->ds,
src_x, src_y, dst_x, dst_y, w, h);
else {
/* TODO */
console->ds->dpy_update(console->ds, dst_x, dst_y, w, h);
}
}
}
| false | qemu | c21bbcfa3ff4f6dc49fb01080ef598851aa424dd | void qemu_console_copy(QEMUConsole *console, int src_x, int src_y,
int dst_x, int dst_y, int w, int h) {
if (active_console == console) {
if (console->ds->dpy_copy)
console->ds->dpy_copy(console->ds,
src_x, src_y, dst_x, dst_y, w, h);
else {
console->ds->dpy_update(console->ds, dst_x, dst_y, w, h);
}
}
}
| {
"code": [],
"line_no": []
} | void FUNC_0(QEMUConsole *VAR_0, int VAR_1, int VAR_2,
int VAR_3, int VAR_4, int VAR_5, int VAR_6) {
if (active_console == VAR_0) {
if (VAR_0->ds->dpy_copy)
VAR_0->ds->dpy_copy(VAR_0->ds,
VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6);
else {
VAR_0->ds->dpy_update(VAR_0->ds, VAR_3, VAR_4, VAR_5, VAR_6);
}
}
}
| [
"void FUNC_0(QEMUConsole *VAR_0, int VAR_1, int VAR_2,\nint VAR_3, int VAR_4, int VAR_5, int VAR_6) {",
"if (active_console == VAR_0) {",
"if (VAR_0->ds->dpy_copy)\nVAR_0->ds->dpy_copy(VAR_0->ds,\nVAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6);",
"else {",
"VAR_0->ds->dpy_update(VAR_0->ds, VAR_3, VAR_4, VAR_5, VAR_6);",
"}",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7,
9,
11
],
[
13
],
[
17
],
[
19
],
[
21
],
[
23
]
]
|
14,888 | static inline void tcg_out_ldst(TCGContext *s, int ret, int addr, int offset, int op)
{
if (offset == (offset & 0xfff))
tcg_out32(s, op | INSN_RD(ret) | INSN_RS1(addr) |
INSN_IMM13(offset));
else
fprintf(stderr, "unimplemented %s with offset %d\n", __func__, offset);
}
| false | qemu | f02ca5cbeaf86038834c1953247a1579d7921927 | static inline void tcg_out_ldst(TCGContext *s, int ret, int addr, int offset, int op)
{
if (offset == (offset & 0xfff))
tcg_out32(s, op | INSN_RD(ret) | INSN_RS1(addr) |
INSN_IMM13(offset));
else
fprintf(stderr, "unimplemented %s with offset %d\n", __func__, offset);
}
| {
"code": [],
"line_no": []
} | static inline void FUNC_0(TCGContext *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4)
{
if (VAR_3 == (VAR_3 & 0xfff))
tcg_out32(VAR_0, VAR_4 | INSN_RD(VAR_1) | INSN_RS1(VAR_2) |
INSN_IMM13(VAR_3));
else
fprintf(stderr, "unimplemented %VAR_0 with VAR_3 %d\n", __func__, VAR_3);
}
| [
"static inline void FUNC_0(TCGContext *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4)\n{",
"if (VAR_3 == (VAR_3 & 0xfff))\ntcg_out32(VAR_0, VAR_4 | INSN_RD(VAR_1) | INSN_RS1(VAR_2) |\nINSN_IMM13(VAR_3));",
"else\nfprintf(stderr, \"unimplemented %VAR_0 with VAR_3 %d\\n\", __func__, VAR_3);",
"}"
]
| [
0,
0,
0,
0
]
| [
[
1,
3
],
[
5,
7,
9
],
[
11,
13
],
[
15
]
]
|
14,889 | static int i440fx_initfn(PCIDevice *dev)
{
PCII440FXState *d = DO_UPCAST(PCII440FXState, dev, dev);
pci_config_set_vendor_id(d->dev.config, PCI_VENDOR_ID_INTEL);
pci_config_set_device_id(d->dev.config, PCI_DEVICE_ID_INTEL_82441);
d->dev.config[0x08] = 0x02; // revision
pci_config_set_class(d->dev.config, PCI_CLASS_BRIDGE_HOST);
d->dev.config[I440FX_SMRAM] = 0x02;
cpu_smm_register(&i440fx_set_smm, d);
return 0;
}
| false | qemu | 3a9d85491ed2be8158fe93041dcbb34c13dfdb05 | static int i440fx_initfn(PCIDevice *dev)
{
PCII440FXState *d = DO_UPCAST(PCII440FXState, dev, dev);
pci_config_set_vendor_id(d->dev.config, PCI_VENDOR_ID_INTEL);
pci_config_set_device_id(d->dev.config, PCI_DEVICE_ID_INTEL_82441);
d->dev.config[0x08] = 0x02;
pci_config_set_class(d->dev.config, PCI_CLASS_BRIDGE_HOST);
d->dev.config[I440FX_SMRAM] = 0x02;
cpu_smm_register(&i440fx_set_smm, d);
return 0;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(PCIDevice *VAR_0)
{
PCII440FXState *d = DO_UPCAST(PCII440FXState, VAR_0, VAR_0);
pci_config_set_vendor_id(d->VAR_0.config, PCI_VENDOR_ID_INTEL);
pci_config_set_device_id(d->VAR_0.config, PCI_DEVICE_ID_INTEL_82441);
d->VAR_0.config[0x08] = 0x02;
pci_config_set_class(d->VAR_0.config, PCI_CLASS_BRIDGE_HOST);
d->VAR_0.config[I440FX_SMRAM] = 0x02;
cpu_smm_register(&i440fx_set_smm, d);
return 0;
}
| [
"static int FUNC_0(PCIDevice *VAR_0)\n{",
"PCII440FXState *d = DO_UPCAST(PCII440FXState, VAR_0, VAR_0);",
"pci_config_set_vendor_id(d->VAR_0.config, PCI_VENDOR_ID_INTEL);",
"pci_config_set_device_id(d->VAR_0.config, PCI_DEVICE_ID_INTEL_82441);",
"d->VAR_0.config[0x08] = 0x02;",
"pci_config_set_class(d->VAR_0.config, PCI_CLASS_BRIDGE_HOST);",
"d->VAR_0.config[I440FX_SMRAM] = 0x02;",
"cpu_smm_register(&i440fx_set_smm, d);",
"return 0;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
23
],
[
25
],
[
27
]
]
|
14,891 | void cpu_register_physical_memory_log(MemoryRegionSection *section,
bool readonly)
{
MemoryRegionSection now = *section, remain = *section;
if ((now.offset_within_address_space & ~TARGET_PAGE_MASK)
|| (now.size < TARGET_PAGE_SIZE)) {
now.size = MIN(TARGET_PAGE_ALIGN(now.offset_within_address_space)
- now.offset_within_address_space,
now.size);
register_subpage(&now);
remain.size -= now.size;
remain.offset_within_address_space += now.size;
remain.offset_within_region += now.size;
}
while (remain.size >= TARGET_PAGE_SIZE) {
now = remain;
if (remain.offset_within_region & ~TARGET_PAGE_MASK) {
now.size = TARGET_PAGE_SIZE;
register_subpage(&now);
} else {
now.size &= TARGET_PAGE_MASK;
register_multipage(&now);
}
remain.size -= now.size;
remain.offset_within_address_space += now.size;
remain.offset_within_region += now.size;
}
now = remain;
if (now.size) {
register_subpage(&now);
}
}
| false | qemu | ac1970fbe8ad5a70174f462109ac0f6c7bf1bc43 | void cpu_register_physical_memory_log(MemoryRegionSection *section,
bool readonly)
{
MemoryRegionSection now = *section, remain = *section;
if ((now.offset_within_address_space & ~TARGET_PAGE_MASK)
|| (now.size < TARGET_PAGE_SIZE)) {
now.size = MIN(TARGET_PAGE_ALIGN(now.offset_within_address_space)
- now.offset_within_address_space,
now.size);
register_subpage(&now);
remain.size -= now.size;
remain.offset_within_address_space += now.size;
remain.offset_within_region += now.size;
}
while (remain.size >= TARGET_PAGE_SIZE) {
now = remain;
if (remain.offset_within_region & ~TARGET_PAGE_MASK) {
now.size = TARGET_PAGE_SIZE;
register_subpage(&now);
} else {
now.size &= TARGET_PAGE_MASK;
register_multipage(&now);
}
remain.size -= now.size;
remain.offset_within_address_space += now.size;
remain.offset_within_region += now.size;
}
now = remain;
if (now.size) {
register_subpage(&now);
}
}
| {
"code": [],
"line_no": []
} | void FUNC_0(MemoryRegionSection *VAR_0,
bool VAR_1)
{
MemoryRegionSection now = *VAR_0, remain = *VAR_0;
if ((now.offset_within_address_space & ~TARGET_PAGE_MASK)
|| (now.size < TARGET_PAGE_SIZE)) {
now.size = MIN(TARGET_PAGE_ALIGN(now.offset_within_address_space)
- now.offset_within_address_space,
now.size);
register_subpage(&now);
remain.size -= now.size;
remain.offset_within_address_space += now.size;
remain.offset_within_region += now.size;
}
while (remain.size >= TARGET_PAGE_SIZE) {
now = remain;
if (remain.offset_within_region & ~TARGET_PAGE_MASK) {
now.size = TARGET_PAGE_SIZE;
register_subpage(&now);
} else {
now.size &= TARGET_PAGE_MASK;
register_multipage(&now);
}
remain.size -= now.size;
remain.offset_within_address_space += now.size;
remain.offset_within_region += now.size;
}
now = remain;
if (now.size) {
register_subpage(&now);
}
}
| [
"void FUNC_0(MemoryRegionSection *VAR_0,\nbool VAR_1)\n{",
"MemoryRegionSection now = *VAR_0, remain = *VAR_0;",
"if ((now.offset_within_address_space & ~TARGET_PAGE_MASK)\n|| (now.size < TARGET_PAGE_SIZE)) {",
"now.size = MIN(TARGET_PAGE_ALIGN(now.offset_within_address_space)\n- now.offset_within_address_space,\nnow.size);",
"register_subpage(&now);",
"remain.size -= now.size;",
"remain.offset_within_address_space += now.size;",
"remain.offset_within_region += now.size;",
"}",
"while (remain.size >= TARGET_PAGE_SIZE) {",
"now = remain;",
"if (remain.offset_within_region & ~TARGET_PAGE_MASK) {",
"now.size = TARGET_PAGE_SIZE;",
"register_subpage(&now);",
"} else {",
"now.size &= TARGET_PAGE_MASK;",
"register_multipage(&now);",
"}",
"remain.size -= now.size;",
"remain.offset_within_address_space += now.size;",
"remain.offset_within_region += now.size;",
"}",
"now = remain;",
"if (now.size) {",
"register_subpage(&now);",
"}",
"}"
]
| [
0,
0,
0,
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
]
]
|
14,892 | static void virtio_blk_handle_flush(BlockRequest *blkreq, int *num_writes,
VirtIOBlockReq *req)
{
BlockDriverAIOCB *acb;
/*
* Make sure all outstanding writes are posted to the backing device.
*/
if (*num_writes > 0) {
do_multiwrite(req->dev->bs, blkreq, *num_writes);
}
*num_writes = 0;
acb = bdrv_aio_flush(req->dev->bs, virtio_blk_flush_complete, req);
if (!acb) {
virtio_blk_req_complete(req, VIRTIO_BLK_S_IOERR);
}
}
| false | qemu | c20fd872257fb9abd2ce99741937c0f65aa162b7 | static void virtio_blk_handle_flush(BlockRequest *blkreq, int *num_writes,
VirtIOBlockReq *req)
{
BlockDriverAIOCB *acb;
if (*num_writes > 0) {
do_multiwrite(req->dev->bs, blkreq, *num_writes);
}
*num_writes = 0;
acb = bdrv_aio_flush(req->dev->bs, virtio_blk_flush_complete, req);
if (!acb) {
virtio_blk_req_complete(req, VIRTIO_BLK_S_IOERR);
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(BlockRequest *VAR_0, int *VAR_1,
VirtIOBlockReq *VAR_2)
{
BlockDriverAIOCB *acb;
if (*VAR_1 > 0) {
do_multiwrite(VAR_2->dev->bs, VAR_0, *VAR_1);
}
*VAR_1 = 0;
acb = bdrv_aio_flush(VAR_2->dev->bs, virtio_blk_flush_complete, VAR_2);
if (!acb) {
virtio_blk_req_complete(VAR_2, VIRTIO_BLK_S_IOERR);
}
}
| [
"static void FUNC_0(BlockRequest *VAR_0, int *VAR_1,\nVirtIOBlockReq *VAR_2)\n{",
"BlockDriverAIOCB *acb;",
"if (*VAR_1 > 0) {",
"do_multiwrite(VAR_2->dev->bs, VAR_0, *VAR_1);",
"}",
"*VAR_1 = 0;",
"acb = bdrv_aio_flush(VAR_2->dev->bs, virtio_blk_flush_complete, VAR_2);",
"if (!acb) {",
"virtio_blk_req_complete(VAR_2, VIRTIO_BLK_S_IOERR);",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
17
],
[
19
],
[
21
],
[
23
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
]
]
|
14,893 | static void gd_update_cursor(VirtualConsole *vc)
{
GtkDisplayState *s = vc->s;
GdkWindow *window;
if (vc->type != GD_VC_GFX) {
return;
}
window = gtk_widget_get_window(GTK_WIDGET(vc->gfx.drawing_area));
if (s->full_screen || qemu_input_is_absolute() || gd_is_grab_active(s)) {
gdk_window_set_cursor(window, s->null_cursor);
} else {
gdk_window_set_cursor(window, NULL);
}
}
| false | qemu | 2884cf5b934808f547b5268a51be631805c25857 | static void gd_update_cursor(VirtualConsole *vc)
{
GtkDisplayState *s = vc->s;
GdkWindow *window;
if (vc->type != GD_VC_GFX) {
return;
}
window = gtk_widget_get_window(GTK_WIDGET(vc->gfx.drawing_area));
if (s->full_screen || qemu_input_is_absolute() || gd_is_grab_active(s)) {
gdk_window_set_cursor(window, s->null_cursor);
} else {
gdk_window_set_cursor(window, NULL);
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(VirtualConsole *VAR_0)
{
GtkDisplayState *s = VAR_0->s;
GdkWindow *window;
if (VAR_0->type != GD_VC_GFX) {
return;
}
window = gtk_widget_get_window(GTK_WIDGET(VAR_0->gfx.drawing_area));
if (s->full_screen || qemu_input_is_absolute() || gd_is_grab_active(s)) {
gdk_window_set_cursor(window, s->null_cursor);
} else {
gdk_window_set_cursor(window, NULL);
}
}
| [
"static void FUNC_0(VirtualConsole *VAR_0)\n{",
"GtkDisplayState *s = VAR_0->s;",
"GdkWindow *window;",
"if (VAR_0->type != GD_VC_GFX) {",
"return;",
"}",
"window = gtk_widget_get_window(GTK_WIDGET(VAR_0->gfx.drawing_area));",
"if (s->full_screen || qemu_input_is_absolute() || gd_is_grab_active(s)) {",
"gdk_window_set_cursor(window, s->null_cursor);",
"} else {",
"gdk_window_set_cursor(window, NULL);",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
]
]
|
14,894 | static void sdhci_sdma_transfer_multi_blocks(SDHCIState *s)
{
bool page_aligned = false;
unsigned int n, begin;
const uint16_t block_size = s->blksize & 0x0fff;
uint32_t boundary_chk = 1 << (((s->blksize & 0xf000) >> 12) + 12);
uint32_t boundary_count = boundary_chk - (s->sdmasysad % boundary_chk);
/* XXX: Some sd/mmc drivers (for example, u-boot-slp) do not account for
* possible stop at page boundary if initial address is not page aligned,
* allow them to work properly */
if ((s->sdmasysad % boundary_chk) == 0) {
page_aligned = true;
}
if (s->trnmod & SDHC_TRNS_READ) {
s->prnsts |= SDHC_DOING_READ | SDHC_DATA_INHIBIT |
SDHC_DAT_LINE_ACTIVE;
while (s->blkcnt) {
if (s->data_count == 0) {
for (n = 0; n < block_size; n++) {
s->fifo_buffer[n] = sdbus_read_data(&s->sdbus);
}
}
begin = s->data_count;
if (((boundary_count + begin) < block_size) && page_aligned) {
s->data_count = boundary_count + begin;
boundary_count = 0;
} else {
s->data_count = block_size;
boundary_count -= block_size - begin;
if (s->trnmod & SDHC_TRNS_BLK_CNT_EN) {
s->blkcnt--;
}
}
dma_memory_write(&address_space_memory, s->sdmasysad,
&s->fifo_buffer[begin], s->data_count - begin);
s->sdmasysad += s->data_count - begin;
if (s->data_count == block_size) {
s->data_count = 0;
}
if (page_aligned && boundary_count == 0) {
break;
}
}
} else {
s->prnsts |= SDHC_DOING_WRITE | SDHC_DATA_INHIBIT |
SDHC_DAT_LINE_ACTIVE;
while (s->blkcnt) {
begin = s->data_count;
if (((boundary_count + begin) < block_size) && page_aligned) {
s->data_count = boundary_count + begin;
boundary_count = 0;
} else {
s->data_count = block_size;
boundary_count -= block_size - begin;
}
dma_memory_read(&address_space_memory, s->sdmasysad,
&s->fifo_buffer[begin], s->data_count);
s->sdmasysad += s->data_count - begin;
if (s->data_count == block_size) {
for (n = 0; n < block_size; n++) {
sdbus_write_data(&s->sdbus, s->fifo_buffer[n]);
}
s->data_count = 0;
if (s->trnmod & SDHC_TRNS_BLK_CNT_EN) {
s->blkcnt--;
}
}
if (page_aligned && boundary_count == 0) {
break;
}
}
}
if (s->blkcnt == 0) {
sdhci_end_transfer(s);
} else {
if (s->norintstsen & SDHC_NISEN_DMA) {
s->norintsts |= SDHC_NIS_DMA;
}
sdhci_update_irq(s);
}
}
| false | qemu | 42922105beb14c2fc58185ea022b9f72fb5465e9 | static void sdhci_sdma_transfer_multi_blocks(SDHCIState *s)
{
bool page_aligned = false;
unsigned int n, begin;
const uint16_t block_size = s->blksize & 0x0fff;
uint32_t boundary_chk = 1 << (((s->blksize & 0xf000) >> 12) + 12);
uint32_t boundary_count = boundary_chk - (s->sdmasysad % boundary_chk);
if ((s->sdmasysad % boundary_chk) == 0) {
page_aligned = true;
}
if (s->trnmod & SDHC_TRNS_READ) {
s->prnsts |= SDHC_DOING_READ | SDHC_DATA_INHIBIT |
SDHC_DAT_LINE_ACTIVE;
while (s->blkcnt) {
if (s->data_count == 0) {
for (n = 0; n < block_size; n++) {
s->fifo_buffer[n] = sdbus_read_data(&s->sdbus);
}
}
begin = s->data_count;
if (((boundary_count + begin) < block_size) && page_aligned) {
s->data_count = boundary_count + begin;
boundary_count = 0;
} else {
s->data_count = block_size;
boundary_count -= block_size - begin;
if (s->trnmod & SDHC_TRNS_BLK_CNT_EN) {
s->blkcnt--;
}
}
dma_memory_write(&address_space_memory, s->sdmasysad,
&s->fifo_buffer[begin], s->data_count - begin);
s->sdmasysad += s->data_count - begin;
if (s->data_count == block_size) {
s->data_count = 0;
}
if (page_aligned && boundary_count == 0) {
break;
}
}
} else {
s->prnsts |= SDHC_DOING_WRITE | SDHC_DATA_INHIBIT |
SDHC_DAT_LINE_ACTIVE;
while (s->blkcnt) {
begin = s->data_count;
if (((boundary_count + begin) < block_size) && page_aligned) {
s->data_count = boundary_count + begin;
boundary_count = 0;
} else {
s->data_count = block_size;
boundary_count -= block_size - begin;
}
dma_memory_read(&address_space_memory, s->sdmasysad,
&s->fifo_buffer[begin], s->data_count);
s->sdmasysad += s->data_count - begin;
if (s->data_count == block_size) {
for (n = 0; n < block_size; n++) {
sdbus_write_data(&s->sdbus, s->fifo_buffer[n]);
}
s->data_count = 0;
if (s->trnmod & SDHC_TRNS_BLK_CNT_EN) {
s->blkcnt--;
}
}
if (page_aligned && boundary_count == 0) {
break;
}
}
}
if (s->blkcnt == 0) {
sdhci_end_transfer(s);
} else {
if (s->norintstsen & SDHC_NISEN_DMA) {
s->norintsts |= SDHC_NIS_DMA;
}
sdhci_update_irq(s);
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(SDHCIState *VAR_0)
{
bool page_aligned = false;
unsigned int VAR_1, VAR_2;
const uint16_t VAR_3 = VAR_0->blksize & 0x0fff;
uint32_t boundary_chk = 1 << (((VAR_0->blksize & 0xf000) >> 12) + 12);
uint32_t boundary_count = boundary_chk - (VAR_0->sdmasysad % boundary_chk);
if ((VAR_0->sdmasysad % boundary_chk) == 0) {
page_aligned = true;
}
if (VAR_0->trnmod & SDHC_TRNS_READ) {
VAR_0->prnsts |= SDHC_DOING_READ | SDHC_DATA_INHIBIT |
SDHC_DAT_LINE_ACTIVE;
while (VAR_0->blkcnt) {
if (VAR_0->data_count == 0) {
for (VAR_1 = 0; VAR_1 < VAR_3; VAR_1++) {
VAR_0->fifo_buffer[VAR_1] = sdbus_read_data(&VAR_0->sdbus);
}
}
VAR_2 = VAR_0->data_count;
if (((boundary_count + VAR_2) < VAR_3) && page_aligned) {
VAR_0->data_count = boundary_count + VAR_2;
boundary_count = 0;
} else {
VAR_0->data_count = VAR_3;
boundary_count -= VAR_3 - VAR_2;
if (VAR_0->trnmod & SDHC_TRNS_BLK_CNT_EN) {
VAR_0->blkcnt--;
}
}
dma_memory_write(&address_space_memory, VAR_0->sdmasysad,
&VAR_0->fifo_buffer[VAR_2], VAR_0->data_count - VAR_2);
VAR_0->sdmasysad += VAR_0->data_count - VAR_2;
if (VAR_0->data_count == VAR_3) {
VAR_0->data_count = 0;
}
if (page_aligned && boundary_count == 0) {
break;
}
}
} else {
VAR_0->prnsts |= SDHC_DOING_WRITE | SDHC_DATA_INHIBIT |
SDHC_DAT_LINE_ACTIVE;
while (VAR_0->blkcnt) {
VAR_2 = VAR_0->data_count;
if (((boundary_count + VAR_2) < VAR_3) && page_aligned) {
VAR_0->data_count = boundary_count + VAR_2;
boundary_count = 0;
} else {
VAR_0->data_count = VAR_3;
boundary_count -= VAR_3 - VAR_2;
}
dma_memory_read(&address_space_memory, VAR_0->sdmasysad,
&VAR_0->fifo_buffer[VAR_2], VAR_0->data_count);
VAR_0->sdmasysad += VAR_0->data_count - VAR_2;
if (VAR_0->data_count == VAR_3) {
for (VAR_1 = 0; VAR_1 < VAR_3; VAR_1++) {
sdbus_write_data(&VAR_0->sdbus, VAR_0->fifo_buffer[VAR_1]);
}
VAR_0->data_count = 0;
if (VAR_0->trnmod & SDHC_TRNS_BLK_CNT_EN) {
VAR_0->blkcnt--;
}
}
if (page_aligned && boundary_count == 0) {
break;
}
}
}
if (VAR_0->blkcnt == 0) {
sdhci_end_transfer(VAR_0);
} else {
if (VAR_0->norintstsen & SDHC_NISEN_DMA) {
VAR_0->norintsts |= SDHC_NIS_DMA;
}
sdhci_update_irq(VAR_0);
}
}
| [
"static void FUNC_0(SDHCIState *VAR_0)\n{",
"bool page_aligned = false;",
"unsigned int VAR_1, VAR_2;",
"const uint16_t VAR_3 = VAR_0->blksize & 0x0fff;",
"uint32_t boundary_chk = 1 << (((VAR_0->blksize & 0xf000) >> 12) + 12);",
"uint32_t boundary_count = boundary_chk - (VAR_0->sdmasysad % boundary_chk);",
"if ((VAR_0->sdmasysad % boundary_chk) == 0) {",
"page_aligned = true;",
"}",
"if (VAR_0->trnmod & SDHC_TRNS_READ) {",
"VAR_0->prnsts |= SDHC_DOING_READ | SDHC_DATA_INHIBIT |\nSDHC_DAT_LINE_ACTIVE;",
"while (VAR_0->blkcnt) {",
"if (VAR_0->data_count == 0) {",
"for (VAR_1 = 0; VAR_1 < VAR_3; VAR_1++) {",
"VAR_0->fifo_buffer[VAR_1] = sdbus_read_data(&VAR_0->sdbus);",
"}",
"}",
"VAR_2 = VAR_0->data_count;",
"if (((boundary_count + VAR_2) < VAR_3) && page_aligned) {",
"VAR_0->data_count = boundary_count + VAR_2;",
"boundary_count = 0;",
"} else {",
"VAR_0->data_count = VAR_3;",
"boundary_count -= VAR_3 - VAR_2;",
"if (VAR_0->trnmod & SDHC_TRNS_BLK_CNT_EN) {",
"VAR_0->blkcnt--;",
"}",
"}",
"dma_memory_write(&address_space_memory, VAR_0->sdmasysad,\n&VAR_0->fifo_buffer[VAR_2], VAR_0->data_count - VAR_2);",
"VAR_0->sdmasysad += VAR_0->data_count - VAR_2;",
"if (VAR_0->data_count == VAR_3) {",
"VAR_0->data_count = 0;",
"}",
"if (page_aligned && boundary_count == 0) {",
"break;",
"}",
"}",
"} else {",
"VAR_0->prnsts |= SDHC_DOING_WRITE | SDHC_DATA_INHIBIT |\nSDHC_DAT_LINE_ACTIVE;",
"while (VAR_0->blkcnt) {",
"VAR_2 = VAR_0->data_count;",
"if (((boundary_count + VAR_2) < VAR_3) && page_aligned) {",
"VAR_0->data_count = boundary_count + VAR_2;",
"boundary_count = 0;",
"} else {",
"VAR_0->data_count = VAR_3;",
"boundary_count -= VAR_3 - VAR_2;",
"}",
"dma_memory_read(&address_space_memory, VAR_0->sdmasysad,\n&VAR_0->fifo_buffer[VAR_2], VAR_0->data_count);",
"VAR_0->sdmasysad += VAR_0->data_count - VAR_2;",
"if (VAR_0->data_count == VAR_3) {",
"for (VAR_1 = 0; VAR_1 < VAR_3; VAR_1++) {",
"sdbus_write_data(&VAR_0->sdbus, VAR_0->fifo_buffer[VAR_1]);",
"}",
"VAR_0->data_count = 0;",
"if (VAR_0->trnmod & SDHC_TRNS_BLK_CNT_EN) {",
"VAR_0->blkcnt--;",
"}",
"}",
"if (page_aligned && boundary_count == 0) {",
"break;",
"}",
"}",
"}",
"if (VAR_0->blkcnt == 0) {",
"sdhci_end_transfer(VAR_0);",
"} else {",
"if (VAR_0->norintstsen & SDHC_NISEN_DMA) {",
"VAR_0->norintsts |= SDHC_NIS_DMA;",
"}",
"sdhci_update_irq(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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
23
],
[
25
],
[
27
],
[
31
],
[
33,
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71,
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93,
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115,
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
151
],
[
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165
],
[
167
]
]
|
14,895 | static int read_access_unit(AVCodecContext *avctx, void* data, int *data_size,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
MLPDecodeContext *m = avctx->priv_data;
GetBitContext gb;
unsigned int length, substr;
unsigned int substream_start;
unsigned int header_size = 4;
unsigned int substr_header_size = 0;
uint8_t substream_parity_present[MAX_SUBSTREAMS];
uint16_t substream_data_len[MAX_SUBSTREAMS];
uint8_t parity_bits;
if (buf_size < 4)
return 0;
length = (AV_RB16(buf) & 0xfff) * 2;
if (length > buf_size)
return -1;
init_get_bits(&gb, (buf + 4), (length - 4) * 8);
m->is_major_sync_unit = 0;
if (show_bits_long(&gb, 31) == (0xf8726fba >> 1)) {
if (read_major_sync(m, &gb) < 0)
goto error;
m->is_major_sync_unit = 1;
header_size += 28;
}
if (!m->params_valid) {
av_log(m->avctx, AV_LOG_WARNING,
"Stream parameters not seen; skipping frame.\n");
*data_size = 0;
return length;
}
substream_start = 0;
for (substr = 0; substr < m->num_substreams; substr++) {
int extraword_present, checkdata_present, end, nonrestart_substr;
extraword_present = get_bits1(&gb);
nonrestart_substr = get_bits1(&gb);
checkdata_present = get_bits1(&gb);
skip_bits1(&gb);
end = get_bits(&gb, 12) * 2;
substr_header_size += 2;
if (extraword_present) {
if (m->avctx->codec_id == CODEC_ID_MLP) {
av_log(m->avctx, AV_LOG_ERROR, "There must be no extraword for MLP.\n");
goto error;
}
skip_bits(&gb, 16);
substr_header_size += 2;
}
if (!(nonrestart_substr ^ m->is_major_sync_unit)) {
av_log(m->avctx, AV_LOG_ERROR, "Invalid nonrestart_substr.\n");
goto error;
}
if (end + header_size + substr_header_size > length) {
av_log(m->avctx, AV_LOG_ERROR,
"Indicated length of substream %d data goes off end of "
"packet.\n", substr);
end = length - header_size - substr_header_size;
}
if (end < substream_start) {
av_log(avctx, AV_LOG_ERROR,
"Indicated end offset of substream %d data "
"is smaller than calculated start offset.\n",
substr);
goto error;
}
if (substr > m->max_decoded_substream)
continue;
substream_parity_present[substr] = checkdata_present;
substream_data_len[substr] = end - substream_start;
substream_start = end;
}
parity_bits = ff_mlp_calculate_parity(buf, 4);
parity_bits ^= ff_mlp_calculate_parity(buf + header_size, substr_header_size);
if ((((parity_bits >> 4) ^ parity_bits) & 0xF) != 0xF) {
av_log(avctx, AV_LOG_ERROR, "Parity check failed.\n");
goto error;
}
buf += header_size + substr_header_size;
for (substr = 0; substr <= m->max_decoded_substream; substr++) {
SubStream *s = &m->substream[substr];
init_get_bits(&gb, buf, substream_data_len[substr] * 8);
m->matrix_changed = 0;
memset(m->filter_changed, 0, sizeof(m->filter_changed));
s->blockpos = 0;
do {
unsigned int ch;
if (get_bits1(&gb)) {
if (get_bits1(&gb)) {
/* A restart header should be present. */
if (read_restart_header(m, &gb, buf, substr) < 0)
goto next_substr;
s->restart_seen = 1;
}
if (!s->restart_seen) {
goto next_substr;
}
if (read_decoding_params(m, &gb, substr) < 0)
goto next_substr;
}
if (m->matrix_changed > 1) {
av_log(m->avctx, AV_LOG_ERROR, "Matrices may change only once per access unit.\n");
goto next_substr;
}
for (ch = 0; ch < s->max_channel; ch++)
if (m->filter_changed[ch][FIR] > 1 ||
m->filter_changed[ch][IIR] > 1) {
av_log(m->avctx, AV_LOG_ERROR, "Filters may change only once per access unit.\n");
goto next_substr;
}
if (!s->restart_seen) {
goto next_substr;
}
if (read_block_data(m, &gb, substr) < 0)
return -1;
if (get_bits_count(&gb) >= substream_data_len[substr] * 8)
goto substream_length_mismatch;
} while (!get_bits1(&gb));
skip_bits(&gb, (-get_bits_count(&gb)) & 15);
if (substream_data_len[substr] * 8 - get_bits_count(&gb) >= 32) {
int shorten_by;
if (get_bits(&gb, 16) != 0xD234)
return -1;
shorten_by = get_bits(&gb, 16);
if (m->avctx->codec_id == CODEC_ID_TRUEHD && shorten_by & 0x2000)
s->blockpos -= FFMIN(shorten_by & 0x1FFF, s->blockpos);
else if (m->avctx->codec_id == CODEC_ID_MLP && shorten_by != 0xD234)
return -1;
if (substr == m->max_decoded_substream)
av_log(m->avctx, AV_LOG_INFO, "End of stream indicated.\n");
}
if (substream_parity_present[substr]) {
uint8_t parity, checksum;
if (substream_data_len[substr] * 8 - get_bits_count(&gb) != 16)
goto substream_length_mismatch;
parity = ff_mlp_calculate_parity(buf, substream_data_len[substr] - 2);
checksum = ff_mlp_checksum8 (buf, substream_data_len[substr] - 2);
if ((get_bits(&gb, 8) ^ parity) != 0xa9 )
av_log(m->avctx, AV_LOG_ERROR, "Substream %d parity check failed.\n", substr);
if ( get_bits(&gb, 8) != checksum)
av_log(m->avctx, AV_LOG_ERROR, "Substream %d checksum failed.\n" , substr);
}
if (substream_data_len[substr] * 8 != get_bits_count(&gb)) {
goto substream_length_mismatch;
}
next_substr:
if (!s->restart_seen) {
av_log(m->avctx, AV_LOG_ERROR,
"No restart header present in substream %d.\n", substr);
}
buf += substream_data_len[substr];
}
rematrix_channels(m, m->max_decoded_substream);
if (output_data(m, m->max_decoded_substream, data, data_size) < 0)
return -1;
return length;
substream_length_mismatch:
av_log(m->avctx, AV_LOG_ERROR, "substream %d length mismatch\n", substr);
return -1;
error:
m->params_valid = 0;
return -1;
}
| false | FFmpeg | 5d9e4eaa6d991718b24c7ce24318ee91419f593a | static int read_access_unit(AVCodecContext *avctx, void* data, int *data_size,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
MLPDecodeContext *m = avctx->priv_data;
GetBitContext gb;
unsigned int length, substr;
unsigned int substream_start;
unsigned int header_size = 4;
unsigned int substr_header_size = 0;
uint8_t substream_parity_present[MAX_SUBSTREAMS];
uint16_t substream_data_len[MAX_SUBSTREAMS];
uint8_t parity_bits;
if (buf_size < 4)
return 0;
length = (AV_RB16(buf) & 0xfff) * 2;
if (length > buf_size)
return -1;
init_get_bits(&gb, (buf + 4), (length - 4) * 8);
m->is_major_sync_unit = 0;
if (show_bits_long(&gb, 31) == (0xf8726fba >> 1)) {
if (read_major_sync(m, &gb) < 0)
goto error;
m->is_major_sync_unit = 1;
header_size += 28;
}
if (!m->params_valid) {
av_log(m->avctx, AV_LOG_WARNING,
"Stream parameters not seen; skipping frame.\n");
*data_size = 0;
return length;
}
substream_start = 0;
for (substr = 0; substr < m->num_substreams; substr++) {
int extraword_present, checkdata_present, end, nonrestart_substr;
extraword_present = get_bits1(&gb);
nonrestart_substr = get_bits1(&gb);
checkdata_present = get_bits1(&gb);
skip_bits1(&gb);
end = get_bits(&gb, 12) * 2;
substr_header_size += 2;
if (extraword_present) {
if (m->avctx->codec_id == CODEC_ID_MLP) {
av_log(m->avctx, AV_LOG_ERROR, "There must be no extraword for MLP.\n");
goto error;
}
skip_bits(&gb, 16);
substr_header_size += 2;
}
if (!(nonrestart_substr ^ m->is_major_sync_unit)) {
av_log(m->avctx, AV_LOG_ERROR, "Invalid nonrestart_substr.\n");
goto error;
}
if (end + header_size + substr_header_size > length) {
av_log(m->avctx, AV_LOG_ERROR,
"Indicated length of substream %d data goes off end of "
"packet.\n", substr);
end = length - header_size - substr_header_size;
}
if (end < substream_start) {
av_log(avctx, AV_LOG_ERROR,
"Indicated end offset of substream %d data "
"is smaller than calculated start offset.\n",
substr);
goto error;
}
if (substr > m->max_decoded_substream)
continue;
substream_parity_present[substr] = checkdata_present;
substream_data_len[substr] = end - substream_start;
substream_start = end;
}
parity_bits = ff_mlp_calculate_parity(buf, 4);
parity_bits ^= ff_mlp_calculate_parity(buf + header_size, substr_header_size);
if ((((parity_bits >> 4) ^ parity_bits) & 0xF) != 0xF) {
av_log(avctx, AV_LOG_ERROR, "Parity check failed.\n");
goto error;
}
buf += header_size + substr_header_size;
for (substr = 0; substr <= m->max_decoded_substream; substr++) {
SubStream *s = &m->substream[substr];
init_get_bits(&gb, buf, substream_data_len[substr] * 8);
m->matrix_changed = 0;
memset(m->filter_changed, 0, sizeof(m->filter_changed));
s->blockpos = 0;
do {
unsigned int ch;
if (get_bits1(&gb)) {
if (get_bits1(&gb)) {
if (read_restart_header(m, &gb, buf, substr) < 0)
goto next_substr;
s->restart_seen = 1;
}
if (!s->restart_seen) {
goto next_substr;
}
if (read_decoding_params(m, &gb, substr) < 0)
goto next_substr;
}
if (m->matrix_changed > 1) {
av_log(m->avctx, AV_LOG_ERROR, "Matrices may change only once per access unit.\n");
goto next_substr;
}
for (ch = 0; ch < s->max_channel; ch++)
if (m->filter_changed[ch][FIR] > 1 ||
m->filter_changed[ch][IIR] > 1) {
av_log(m->avctx, AV_LOG_ERROR, "Filters may change only once per access unit.\n");
goto next_substr;
}
if (!s->restart_seen) {
goto next_substr;
}
if (read_block_data(m, &gb, substr) < 0)
return -1;
if (get_bits_count(&gb) >= substream_data_len[substr] * 8)
goto substream_length_mismatch;
} while (!get_bits1(&gb));
skip_bits(&gb, (-get_bits_count(&gb)) & 15);
if (substream_data_len[substr] * 8 - get_bits_count(&gb) >= 32) {
int shorten_by;
if (get_bits(&gb, 16) != 0xD234)
return -1;
shorten_by = get_bits(&gb, 16);
if (m->avctx->codec_id == CODEC_ID_TRUEHD && shorten_by & 0x2000)
s->blockpos -= FFMIN(shorten_by & 0x1FFF, s->blockpos);
else if (m->avctx->codec_id == CODEC_ID_MLP && shorten_by != 0xD234)
return -1;
if (substr == m->max_decoded_substream)
av_log(m->avctx, AV_LOG_INFO, "End of stream indicated.\n");
}
if (substream_parity_present[substr]) {
uint8_t parity, checksum;
if (substream_data_len[substr] * 8 - get_bits_count(&gb) != 16)
goto substream_length_mismatch;
parity = ff_mlp_calculate_parity(buf, substream_data_len[substr] - 2);
checksum = ff_mlp_checksum8 (buf, substream_data_len[substr] - 2);
if ((get_bits(&gb, 8) ^ parity) != 0xa9 )
av_log(m->avctx, AV_LOG_ERROR, "Substream %d parity check failed.\n", substr);
if ( get_bits(&gb, 8) != checksum)
av_log(m->avctx, AV_LOG_ERROR, "Substream %d checksum failed.\n" , substr);
}
if (substream_data_len[substr] * 8 != get_bits_count(&gb)) {
goto substream_length_mismatch;
}
next_substr:
if (!s->restart_seen) {
av_log(m->avctx, AV_LOG_ERROR,
"No restart header present in substream %d.\n", substr);
}
buf += substream_data_len[substr];
}
rematrix_channels(m, m->max_decoded_substream);
if (output_data(m, m->max_decoded_substream, data, data_size) < 0)
return -1;
return length;
substream_length_mismatch:
av_log(m->avctx, AV_LOG_ERROR, "substream %d length mismatch\n", substr);
return -1;
error:
m->params_valid = 0;
return -1;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(AVCodecContext *VAR_0, void* VAR_1, int *VAR_2,
AVPacket *VAR_3)
{
const uint8_t *VAR_4 = VAR_3->VAR_1;
int VAR_5 = VAR_3->size;
MLPDecodeContext *m = VAR_0->priv_data;
GetBitContext gb;
unsigned int VAR_6, VAR_7;
unsigned int VAR_8;
unsigned int VAR_9 = 4;
unsigned int VAR_10 = 0;
uint8_t substream_parity_present[MAX_SUBSTREAMS];
uint16_t substream_data_len[MAX_SUBSTREAMS];
uint8_t parity_bits;
if (VAR_5 < 4)
return 0;
VAR_6 = (AV_RB16(VAR_4) & 0xfff) * 2;
if (VAR_6 > VAR_5)
return -1;
init_get_bits(&gb, (VAR_4 + 4), (VAR_6 - 4) * 8);
m->is_major_sync_unit = 0;
if (show_bits_long(&gb, 31) == (0xf8726fba >> 1)) {
if (read_major_sync(m, &gb) < 0)
goto error;
m->is_major_sync_unit = 1;
VAR_9 += 28;
}
if (!m->params_valid) {
av_log(m->VAR_0, AV_LOG_WARNING,
"Stream parameters not seen; skipping frame.\n");
*VAR_2 = 0;
return VAR_6;
}
VAR_8 = 0;
for (VAR_7 = 0; VAR_7 < m->num_substreams; VAR_7++) {
int extraword_present, checkdata_present, end, nonrestart_substr;
extraword_present = get_bits1(&gb);
nonrestart_substr = get_bits1(&gb);
checkdata_present = get_bits1(&gb);
skip_bits1(&gb);
end = get_bits(&gb, 12) * 2;
VAR_10 += 2;
if (extraword_present) {
if (m->VAR_0->codec_id == CODEC_ID_MLP) {
av_log(m->VAR_0, AV_LOG_ERROR, "There must be no extraword for MLP.\n");
goto error;
}
skip_bits(&gb, 16);
VAR_10 += 2;
}
if (!(nonrestart_substr ^ m->is_major_sync_unit)) {
av_log(m->VAR_0, AV_LOG_ERROR, "Invalid nonrestart_substr.\n");
goto error;
}
if (end + VAR_9 + VAR_10 > VAR_6) {
av_log(m->VAR_0, AV_LOG_ERROR,
"Indicated VAR_6 of substream %d VAR_1 goes off end of "
"packet.\n", VAR_7);
end = VAR_6 - VAR_9 - VAR_10;
}
if (end < VAR_8) {
av_log(VAR_0, AV_LOG_ERROR,
"Indicated end offset of substream %d VAR_1 "
"is smaller than calculated start offset.\n",
VAR_7);
goto error;
}
if (VAR_7 > m->max_decoded_substream)
continue;
substream_parity_present[VAR_7] = checkdata_present;
substream_data_len[VAR_7] = end - VAR_8;
VAR_8 = end;
}
parity_bits = ff_mlp_calculate_parity(VAR_4, 4);
parity_bits ^= ff_mlp_calculate_parity(VAR_4 + VAR_9, VAR_10);
if ((((parity_bits >> 4) ^ parity_bits) & 0xF) != 0xF) {
av_log(VAR_0, AV_LOG_ERROR, "Parity check failed.\n");
goto error;
}
VAR_4 += VAR_9 + VAR_10;
for (VAR_7 = 0; VAR_7 <= m->max_decoded_substream; VAR_7++) {
SubStream *s = &m->substream[VAR_7];
init_get_bits(&gb, VAR_4, substream_data_len[VAR_7] * 8);
m->matrix_changed = 0;
memset(m->filter_changed, 0, sizeof(m->filter_changed));
s->blockpos = 0;
do {
unsigned int ch;
if (get_bits1(&gb)) {
if (get_bits1(&gb)) {
if (read_restart_header(m, &gb, VAR_4, VAR_7) < 0)
goto next_substr;
s->restart_seen = 1;
}
if (!s->restart_seen) {
goto next_substr;
}
if (read_decoding_params(m, &gb, VAR_7) < 0)
goto next_substr;
}
if (m->matrix_changed > 1) {
av_log(m->VAR_0, AV_LOG_ERROR, "Matrices may change only once per access unit.\n");
goto next_substr;
}
for (ch = 0; ch < s->max_channel; ch++)
if (m->filter_changed[ch][FIR] > 1 ||
m->filter_changed[ch][IIR] > 1) {
av_log(m->VAR_0, AV_LOG_ERROR, "Filters may change only once per access unit.\n");
goto next_substr;
}
if (!s->restart_seen) {
goto next_substr;
}
if (read_block_data(m, &gb, VAR_7) < 0)
return -1;
if (get_bits_count(&gb) >= substream_data_len[VAR_7] * 8)
goto substream_length_mismatch;
} while (!get_bits1(&gb));
skip_bits(&gb, (-get_bits_count(&gb)) & 15);
if (substream_data_len[VAR_7] * 8 - get_bits_count(&gb) >= 32) {
int shorten_by;
if (get_bits(&gb, 16) != 0xD234)
return -1;
shorten_by = get_bits(&gb, 16);
if (m->VAR_0->codec_id == CODEC_ID_TRUEHD && shorten_by & 0x2000)
s->blockpos -= FFMIN(shorten_by & 0x1FFF, s->blockpos);
else if (m->VAR_0->codec_id == CODEC_ID_MLP && shorten_by != 0xD234)
return -1;
if (VAR_7 == m->max_decoded_substream)
av_log(m->VAR_0, AV_LOG_INFO, "End of stream indicated.\n");
}
if (substream_parity_present[VAR_7]) {
uint8_t parity, checksum;
if (substream_data_len[VAR_7] * 8 - get_bits_count(&gb) != 16)
goto substream_length_mismatch;
parity = ff_mlp_calculate_parity(VAR_4, substream_data_len[VAR_7] - 2);
checksum = ff_mlp_checksum8 (VAR_4, substream_data_len[VAR_7] - 2);
if ((get_bits(&gb, 8) ^ parity) != 0xa9 )
av_log(m->VAR_0, AV_LOG_ERROR, "Substream %d parity check failed.\n", VAR_7);
if ( get_bits(&gb, 8) != checksum)
av_log(m->VAR_0, AV_LOG_ERROR, "Substream %d checksum failed.\n" , VAR_7);
}
if (substream_data_len[VAR_7] * 8 != get_bits_count(&gb)) {
goto substream_length_mismatch;
}
next_substr:
if (!s->restart_seen) {
av_log(m->VAR_0, AV_LOG_ERROR,
"No restart header present in substream %d.\n", VAR_7);
}
VAR_4 += substream_data_len[VAR_7];
}
rematrix_channels(m, m->max_decoded_substream);
if (output_data(m, m->max_decoded_substream, VAR_1, VAR_2) < 0)
return -1;
return VAR_6;
substream_length_mismatch:
av_log(m->VAR_0, AV_LOG_ERROR, "substream %d VAR_6 mismatch\n", VAR_7);
return -1;
error:
m->params_valid = 0;
return -1;
}
| [
"static int FUNC_0(AVCodecContext *VAR_0, void* VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{",
"const uint8_t *VAR_4 = VAR_3->VAR_1;",
"int VAR_5 = VAR_3->size;",
"MLPDecodeContext *m = VAR_0->priv_data;",
"GetBitContext gb;",
"unsigned int VAR_6, VAR_7;",
"unsigned int VAR_8;",
"unsigned int VAR_9 = 4;",
"unsigned int VAR_10 = 0;",
"uint8_t substream_parity_present[MAX_SUBSTREAMS];",
"uint16_t substream_data_len[MAX_SUBSTREAMS];",
"uint8_t parity_bits;",
"if (VAR_5 < 4)\nreturn 0;",
"VAR_6 = (AV_RB16(VAR_4) & 0xfff) * 2;",
"if (VAR_6 > VAR_5)\nreturn -1;",
"init_get_bits(&gb, (VAR_4 + 4), (VAR_6 - 4) * 8);",
"m->is_major_sync_unit = 0;",
"if (show_bits_long(&gb, 31) == (0xf8726fba >> 1)) {",
"if (read_major_sync(m, &gb) < 0)\ngoto error;",
"m->is_major_sync_unit = 1;",
"VAR_9 += 28;",
"}",
"if (!m->params_valid) {",
"av_log(m->VAR_0, AV_LOG_WARNING,\n\"Stream parameters not seen; skipping frame.\\n\");",
"*VAR_2 = 0;",
"return VAR_6;",
"}",
"VAR_8 = 0;",
"for (VAR_7 = 0; VAR_7 < m->num_substreams; VAR_7++) {",
"int extraword_present, checkdata_present, end, nonrestart_substr;",
"extraword_present = get_bits1(&gb);",
"nonrestart_substr = get_bits1(&gb);",
"checkdata_present = get_bits1(&gb);",
"skip_bits1(&gb);",
"end = get_bits(&gb, 12) * 2;",
"VAR_10 += 2;",
"if (extraword_present) {",
"if (m->VAR_0->codec_id == CODEC_ID_MLP) {",
"av_log(m->VAR_0, AV_LOG_ERROR, \"There must be no extraword for MLP.\\n\");",
"goto error;",
"}",
"skip_bits(&gb, 16);",
"VAR_10 += 2;",
"}",
"if (!(nonrestart_substr ^ m->is_major_sync_unit)) {",
"av_log(m->VAR_0, AV_LOG_ERROR, \"Invalid nonrestart_substr.\\n\");",
"goto error;",
"}",
"if (end + VAR_9 + VAR_10 > VAR_6) {",
"av_log(m->VAR_0, AV_LOG_ERROR,\n\"Indicated VAR_6 of substream %d VAR_1 goes off end of \"\n\"packet.\\n\", VAR_7);",
"end = VAR_6 - VAR_9 - VAR_10;",
"}",
"if (end < VAR_8) {",
"av_log(VAR_0, AV_LOG_ERROR,\n\"Indicated end offset of substream %d VAR_1 \"\n\"is smaller than calculated start offset.\\n\",\nVAR_7);",
"goto error;",
"}",
"if (VAR_7 > m->max_decoded_substream)\ncontinue;",
"substream_parity_present[VAR_7] = checkdata_present;",
"substream_data_len[VAR_7] = end - VAR_8;",
"VAR_8 = end;",
"}",
"parity_bits = ff_mlp_calculate_parity(VAR_4, 4);",
"parity_bits ^= ff_mlp_calculate_parity(VAR_4 + VAR_9, VAR_10);",
"if ((((parity_bits >> 4) ^ parity_bits) & 0xF) != 0xF) {",
"av_log(VAR_0, AV_LOG_ERROR, \"Parity check failed.\\n\");",
"goto error;",
"}",
"VAR_4 += VAR_9 + VAR_10;",
"for (VAR_7 = 0; VAR_7 <= m->max_decoded_substream; VAR_7++) {",
"SubStream *s = &m->substream[VAR_7];",
"init_get_bits(&gb, VAR_4, substream_data_len[VAR_7] * 8);",
"m->matrix_changed = 0;",
"memset(m->filter_changed, 0, sizeof(m->filter_changed));",
"s->blockpos = 0;",
"do {",
"unsigned int ch;",
"if (get_bits1(&gb)) {",
"if (get_bits1(&gb)) {",
"if (read_restart_header(m, &gb, VAR_4, VAR_7) < 0)\ngoto next_substr;",
"s->restart_seen = 1;",
"}",
"if (!s->restart_seen) {",
"goto next_substr;",
"}",
"if (read_decoding_params(m, &gb, VAR_7) < 0)\ngoto next_substr;",
"}",
"if (m->matrix_changed > 1) {",
"av_log(m->VAR_0, AV_LOG_ERROR, \"Matrices may change only once per access unit.\\n\");",
"goto next_substr;",
"}",
"for (ch = 0; ch < s->max_channel; ch++)",
"if (m->filter_changed[ch][FIR] > 1 ||\nm->filter_changed[ch][IIR] > 1) {",
"av_log(m->VAR_0, AV_LOG_ERROR, \"Filters may change only once per access unit.\\n\");",
"goto next_substr;",
"}",
"if (!s->restart_seen) {",
"goto next_substr;",
"}",
"if (read_block_data(m, &gb, VAR_7) < 0)\nreturn -1;",
"if (get_bits_count(&gb) >= substream_data_len[VAR_7] * 8)\ngoto substream_length_mismatch;",
"} while (!get_bits1(&gb));",
"skip_bits(&gb, (-get_bits_count(&gb)) & 15);",
"if (substream_data_len[VAR_7] * 8 - get_bits_count(&gb) >= 32) {",
"int shorten_by;",
"if (get_bits(&gb, 16) != 0xD234)\nreturn -1;",
"shorten_by = get_bits(&gb, 16);",
"if (m->VAR_0->codec_id == CODEC_ID_TRUEHD && shorten_by & 0x2000)\ns->blockpos -= FFMIN(shorten_by & 0x1FFF, s->blockpos);",
"else if (m->VAR_0->codec_id == CODEC_ID_MLP && shorten_by != 0xD234)\nreturn -1;",
"if (VAR_7 == m->max_decoded_substream)\nav_log(m->VAR_0, AV_LOG_INFO, \"End of stream indicated.\\n\");",
"}",
"if (substream_parity_present[VAR_7]) {",
"uint8_t parity, checksum;",
"if (substream_data_len[VAR_7] * 8 - get_bits_count(&gb) != 16)\ngoto substream_length_mismatch;",
"parity = ff_mlp_calculate_parity(VAR_4, substream_data_len[VAR_7] - 2);",
"checksum = ff_mlp_checksum8 (VAR_4, substream_data_len[VAR_7] - 2);",
"if ((get_bits(&gb, 8) ^ parity) != 0xa9 )\nav_log(m->VAR_0, AV_LOG_ERROR, \"Substream %d parity check failed.\\n\", VAR_7);",
"if ( get_bits(&gb, 8) != checksum)\nav_log(m->VAR_0, AV_LOG_ERROR, \"Substream %d checksum failed.\\n\" , VAR_7);",
"}",
"if (substream_data_len[VAR_7] * 8 != get_bits_count(&gb)) {",
"goto substream_length_mismatch;",
"}",
"next_substr:\nif (!s->restart_seen) {",
"av_log(m->VAR_0, AV_LOG_ERROR,\n\"No restart header present in substream %d.\\n\", VAR_7);",
"}",
"VAR_4 += substream_data_len[VAR_7];",
"}",
"rematrix_channels(m, m->max_decoded_substream);",
"if (output_data(m, m->max_decoded_substream, VAR_1, VAR_2) < 0)\nreturn -1;",
"return VAR_6;",
"substream_length_mismatch:\nav_log(m->VAR_0, AV_LOG_ERROR, \"substream %d VAR_6 mismatch\\n\", VAR_7);",
"return -1;",
"error:\nm->params_valid = 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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
31,
33
],
[
37
],
[
41,
43
],
[
47
],
[
51
],
[
53
],
[
55,
57
],
[
59
],
[
61
],
[
63
],
[
67
],
[
69,
71
],
[
73
],
[
75
],
[
77
],
[
81
],
[
85
],
[
87
],
[
91
],
[
93
],
[
95
],
[
97
],
[
101
],
[
105
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
127
],
[
129
],
[
131
],
[
133
],
[
137
],
[
139,
141,
143
],
[
145
],
[
147
],
[
151
],
[
153,
155,
157,
159
],
[
161
],
[
163
],
[
167,
169
],
[
173
],
[
175
],
[
177
],
[
179
],
[
183
],
[
185
],
[
189
],
[
191
],
[
193
],
[
195
],
[
199
],
[
203
],
[
205
],
[
207
],
[
211
],
[
213
],
[
217
],
[
219
],
[
221
],
[
225
],
[
227
],
[
231,
233
],
[
235
],
[
237
],
[
241
],
[
243
],
[
245
],
[
249,
251
],
[
253
],
[
257
],
[
259
],
[
261
],
[
263
],
[
265
],
[
267,
269
],
[
271
],
[
273
],
[
275
],
[
279
],
[
281
],
[
283
],
[
287,
289
],
[
293,
295
],
[
299
],
[
303
],
[
305
],
[
307
],
[
311,
313
],
[
317
],
[
319,
321
],
[
323,
325
],
[
329,
331
],
[
333
],
[
335
],
[
337
],
[
341,
343
],
[
347
],
[
349
],
[
353,
355
],
[
357,
359
],
[
361
],
[
363
],
[
365
],
[
367
],
[
371,
373
],
[
375,
377
],
[
379
],
[
383
],
[
385
],
[
389
],
[
393,
395
],
[
399
],
[
403,
405
],
[
407
],
[
411,
413
],
[
415
],
[
417
]
]
|
14,896 | static int coroutine_fn blkreplay_co_preadv(BlockDriverState *bs,
uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags)
{
uint64_t reqid = request_id++;
int ret = bdrv_co_preadv(bs->file->bs, offset, bytes, qiov, flags);
block_request_create(reqid, bs, qemu_coroutine_self());
qemu_coroutine_yield();
return ret;
}
| false | qemu | a03ef88f77af045a2eb9629b5ce774a3fb973c5e | static int coroutine_fn blkreplay_co_preadv(BlockDriverState *bs,
uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags)
{
uint64_t reqid = request_id++;
int ret = bdrv_co_preadv(bs->file->bs, offset, bytes, qiov, flags);
block_request_create(reqid, bs, qemu_coroutine_self());
qemu_coroutine_yield();
return ret;
}
| {
"code": [],
"line_no": []
} | static int VAR_0 blkreplay_co_preadv(BlockDriverState *bs,
uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags)
{
uint64_t reqid = request_id++;
int ret = bdrv_co_preadv(bs->file->bs, offset, bytes, qiov, flags);
block_request_create(reqid, bs, qemu_coroutine_self());
qemu_coroutine_yield();
return ret;
}
| [
"static int VAR_0 blkreplay_co_preadv(BlockDriverState *bs,\nuint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags)\n{",
"uint64_t reqid = request_id++;",
"int ret = bdrv_co_preadv(bs->file->bs, offset, bytes, qiov, flags);",
"block_request_create(reqid, bs, qemu_coroutine_self());",
"qemu_coroutine_yield();",
"return ret;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
19
]
]
|
14,897 | void s390x_tod_timer(void *opaque)
{
S390CPU *cpu = opaque;
CPUS390XState *env = &cpu->env;
env->pending_int |= INTERRUPT_TOD;
cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HARD);
}
| false | qemu | 6482b0ffd12ce83810c10b1a3884a75eba2ade1a | void s390x_tod_timer(void *opaque)
{
S390CPU *cpu = opaque;
CPUS390XState *env = &cpu->env;
env->pending_int |= INTERRUPT_TOD;
cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HARD);
}
| {
"code": [],
"line_no": []
} | void FUNC_0(void *VAR_0)
{
S390CPU *cpu = VAR_0;
CPUS390XState *env = &cpu->env;
env->pending_int |= INTERRUPT_TOD;
cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HARD);
}
| [
"void FUNC_0(void *VAR_0)\n{",
"S390CPU *cpu = VAR_0;",
"CPUS390XState *env = &cpu->env;",
"env->pending_int |= INTERRUPT_TOD;",
"cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HARD);",
"}"
]
| [
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
15
]
]
|
14,898 | static uint8_t qpci_spapr_io_readb(QPCIBus *bus, void *addr)
{
QPCIBusSPAPR *s = container_of(bus, QPCIBusSPAPR, bus);
uint64_t port = (uintptr_t)addr;
uint8_t v;
if (port < s->pio.size) {
v = readb(s->pio_cpu_base + port);
} else {
v = readb(s->mmio_cpu_base + port);
}
return v;
}
| false | qemu | 8360544a6d3a54df1fce80f55ba4ad075a8ded54 | static uint8_t qpci_spapr_io_readb(QPCIBus *bus, void *addr)
{
QPCIBusSPAPR *s = container_of(bus, QPCIBusSPAPR, bus);
uint64_t port = (uintptr_t)addr;
uint8_t v;
if (port < s->pio.size) {
v = readb(s->pio_cpu_base + port);
} else {
v = readb(s->mmio_cpu_base + port);
}
return v;
}
| {
"code": [],
"line_no": []
} | static uint8_t FUNC_0(QPCIBus *bus, void *addr)
{
QPCIBusSPAPR *s = container_of(bus, QPCIBusSPAPR, bus);
uint64_t port = (uintptr_t)addr;
uint8_t v;
if (port < s->pio.size) {
v = readb(s->pio_cpu_base + port);
} else {
v = readb(s->mmio_cpu_base + port);
}
return v;
}
| [
"static uint8_t FUNC_0(QPCIBus *bus, void *addr)\n{",
"QPCIBusSPAPR *s = container_of(bus, QPCIBusSPAPR, bus);",
"uint64_t port = (uintptr_t)addr;",
"uint8_t v;",
"if (port < s->pio.size) {",
"v = readb(s->pio_cpu_base + port);",
"} else {",
"v = readb(s->mmio_cpu_base + port);",
"}",
"return v;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
]
]
|
14,899 | static void bench_cb(void *opaque, int ret)
{
BenchData *b = opaque;
BlockAIOCB *acb;
if (ret < 0) {
error_report("Failed request: %s\n", strerror(-ret));
exit(EXIT_FAILURE);
}
if (b->in_flush) {
/* Just finished a flush with drained queue: Start next requests */
assert(b->in_flight == 0);
b->in_flush = false;
} else if (b->in_flight > 0) {
int remaining = b->n - b->in_flight;
b->n--;
b->in_flight--;
/* Time for flush? Drain queue if requested, then flush */
if (b->flush_interval && remaining % b->flush_interval == 0) {
if (!b->in_flight || !b->drain_on_flush) {
BlockCompletionFunc *cb;
if (b->drain_on_flush) {
b->in_flush = true;
cb = bench_cb;
} else {
cb = bench_undrained_flush_cb;
}
acb = blk_aio_flush(b->blk, cb, b);
if (!acb) {
error_report("Failed to issue flush request");
exit(EXIT_FAILURE);
}
}
if (b->drain_on_flush) {
return;
}
}
}
while (b->n > b->in_flight && b->in_flight < b->nrreq) {
if (b->write) {
acb = blk_aio_pwritev(b->blk, b->offset, b->qiov, 0,
bench_cb, b);
} else {
acb = blk_aio_preadv(b->blk, b->offset, b->qiov, 0,
bench_cb, b);
}
if (!acb) {
error_report("Failed to issue request");
exit(EXIT_FAILURE);
}
b->in_flight++;
b->offset += b->step;
b->offset %= b->image_size;
}
}
| false | qemu | df3c286c53ac51e7267f2761c7a0c62e11b6e815 | static void bench_cb(void *opaque, int ret)
{
BenchData *b = opaque;
BlockAIOCB *acb;
if (ret < 0) {
error_report("Failed request: %s\n", strerror(-ret));
exit(EXIT_FAILURE);
}
if (b->in_flush) {
assert(b->in_flight == 0);
b->in_flush = false;
} else if (b->in_flight > 0) {
int remaining = b->n - b->in_flight;
b->n--;
b->in_flight--;
if (b->flush_interval && remaining % b->flush_interval == 0) {
if (!b->in_flight || !b->drain_on_flush) {
BlockCompletionFunc *cb;
if (b->drain_on_flush) {
b->in_flush = true;
cb = bench_cb;
} else {
cb = bench_undrained_flush_cb;
}
acb = blk_aio_flush(b->blk, cb, b);
if (!acb) {
error_report("Failed to issue flush request");
exit(EXIT_FAILURE);
}
}
if (b->drain_on_flush) {
return;
}
}
}
while (b->n > b->in_flight && b->in_flight < b->nrreq) {
if (b->write) {
acb = blk_aio_pwritev(b->blk, b->offset, b->qiov, 0,
bench_cb, b);
} else {
acb = blk_aio_preadv(b->blk, b->offset, b->qiov, 0,
bench_cb, b);
}
if (!acb) {
error_report("Failed to issue request");
exit(EXIT_FAILURE);
}
b->in_flight++;
b->offset += b->step;
b->offset %= b->image_size;
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(void *VAR_0, int VAR_1)
{
BenchData *b = VAR_0;
BlockAIOCB *acb;
if (VAR_1 < 0) {
error_report("Failed request: %s\n", strerror(-VAR_1));
exit(EXIT_FAILURE);
}
if (b->in_flush) {
assert(b->in_flight == 0);
b->in_flush = false;
} else if (b->in_flight > 0) {
int VAR_2 = b->n - b->in_flight;
b->n--;
b->in_flight--;
if (b->flush_interval && VAR_2 % b->flush_interval == 0) {
if (!b->in_flight || !b->drain_on_flush) {
BlockCompletionFunc *cb;
if (b->drain_on_flush) {
b->in_flush = true;
cb = FUNC_0;
} else {
cb = bench_undrained_flush_cb;
}
acb = blk_aio_flush(b->blk, cb, b);
if (!acb) {
error_report("Failed to issue flush request");
exit(EXIT_FAILURE);
}
}
if (b->drain_on_flush) {
return;
}
}
}
while (b->n > b->in_flight && b->in_flight < b->nrreq) {
if (b->write) {
acb = blk_aio_pwritev(b->blk, b->offset, b->qiov, 0,
FUNC_0, b);
} else {
acb = blk_aio_preadv(b->blk, b->offset, b->qiov, 0,
FUNC_0, b);
}
if (!acb) {
error_report("Failed to issue request");
exit(EXIT_FAILURE);
}
b->in_flight++;
b->offset += b->step;
b->offset %= b->image_size;
}
}
| [
"static void FUNC_0(void *VAR_0, int VAR_1)\n{",
"BenchData *b = VAR_0;",
"BlockAIOCB *acb;",
"if (VAR_1 < 0) {",
"error_report(\"Failed request: %s\\n\", strerror(-VAR_1));",
"exit(EXIT_FAILURE);",
"}",
"if (b->in_flush) {",
"assert(b->in_flight == 0);",
"b->in_flush = false;",
"} else if (b->in_flight > 0) {",
"int VAR_2 = b->n - b->in_flight;",
"b->n--;",
"b->in_flight--;",
"if (b->flush_interval && VAR_2 % b->flush_interval == 0) {",
"if (!b->in_flight || !b->drain_on_flush) {",
"BlockCompletionFunc *cb;",
"if (b->drain_on_flush) {",
"b->in_flush = true;",
"cb = FUNC_0;",
"} else {",
"cb = bench_undrained_flush_cb;",
"}",
"acb = blk_aio_flush(b->blk, cb, b);",
"if (!acb) {",
"error_report(\"Failed to issue flush request\");",
"exit(EXIT_FAILURE);",
"}",
"}",
"if (b->drain_on_flush) {",
"return;",
"}",
"}",
"}",
"while (b->n > b->in_flight && b->in_flight < b->nrreq) {",
"if (b->write) {",
"acb = blk_aio_pwritev(b->blk, b->offset, b->qiov, 0,\nFUNC_0, b);",
"} else {",
"acb = blk_aio_preadv(b->blk, b->offset, b->qiov, 0,\nFUNC_0, b);",
"}",
"if (!acb) {",
"error_report(\"Failed to issue request\");",
"exit(EXIT_FAILURE);",
"}",
"b->in_flight++;",
"b->offset += b->step;",
"b->offset %= b->image_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
]
| [
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
15
],
[
17
],
[
21
],
[
25
],
[
27
],
[
29
],
[
31
],
[
35
],
[
37
],
[
43
],
[
45
],
[
47
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
89
],
[
91
],
[
93,
95
],
[
97
],
[
99,
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
]
]
|
14,900 | static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs,
int64_t offset,
int64_t length,
uint64_t addend,
bool decrease,
enum qcow2_discard_type type)
{
BDRVQcowState *s = bs->opaque;
int64_t start, last, cluster_offset;
void *refcount_block = NULL;
int64_t old_table_index = -1;
int ret;
#ifdef DEBUG_ALLOC2
fprintf(stderr, "update_refcount: offset=%" PRId64 " size=%" PRId64
" addend=%s%" PRIu64 "\n", offset, length, decrease ? "-" : "",
addend);
#endif
if (length < 0) {
return -EINVAL;
} else if (length == 0) {
return 0;
}
if (decrease) {
qcow2_cache_set_dependency(bs, s->refcount_block_cache,
s->l2_table_cache);
}
start = start_of_cluster(s, offset);
last = start_of_cluster(s, offset + length - 1);
for(cluster_offset = start; cluster_offset <= last;
cluster_offset += s->cluster_size)
{
int block_index;
uint64_t refcount;
int64_t cluster_index = cluster_offset >> s->cluster_bits;
int64_t table_index = cluster_index >> s->refcount_block_bits;
/* Load the refcount block and allocate it if needed */
if (table_index != old_table_index) {
if (refcount_block) {
ret = qcow2_cache_put(bs, s->refcount_block_cache,
&refcount_block);
if (ret < 0) {
goto fail;
}
}
ret = alloc_refcount_block(bs, cluster_index, &refcount_block);
if (ret < 0) {
goto fail;
}
}
old_table_index = table_index;
qcow2_cache_entry_mark_dirty(bs, s->refcount_block_cache,
refcount_block);
/* we can update the count and save it */
block_index = cluster_index & (s->refcount_block_size - 1);
refcount = s->get_refcount(refcount_block, block_index);
if (decrease ? (refcount - addend > refcount)
: (refcount + addend < refcount ||
refcount + addend > s->refcount_max))
{
ret = -EINVAL;
goto fail;
}
if (decrease) {
refcount -= addend;
} else {
refcount += addend;
}
if (refcount == 0 && cluster_index < s->free_cluster_index) {
s->free_cluster_index = cluster_index;
}
s->set_refcount(refcount_block, block_index, refcount);
if (refcount == 0 && s->discard_passthrough[type]) {
update_refcount_discard(bs, cluster_offset, s->cluster_size);
}
}
ret = 0;
fail:
if (!s->cache_discards) {
qcow2_process_discards(bs, ret);
}
/* Write last changed block to disk */
if (refcount_block) {
int wret;
wret = qcow2_cache_put(bs, s->refcount_block_cache, &refcount_block);
if (wret < 0) {
return ret < 0 ? ret : wret;
}
}
/*
* Try do undo any updates if an error is returned (This may succeed in
* some cases like ENOSPC for allocating a new refcount block)
*/
if (ret < 0) {
int dummy;
dummy = update_refcount(bs, offset, cluster_offset - offset, addend,
!decrease, QCOW2_DISCARD_NEVER);
(void)dummy;
}
return ret;
}
| false | qemu | a3f1afb43a09e4577571c044c48f2ba9e6e4ad06 | static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs,
int64_t offset,
int64_t length,
uint64_t addend,
bool decrease,
enum qcow2_discard_type type)
{
BDRVQcowState *s = bs->opaque;
int64_t start, last, cluster_offset;
void *refcount_block = NULL;
int64_t old_table_index = -1;
int ret;
#ifdef DEBUG_ALLOC2
fprintf(stderr, "update_refcount: offset=%" PRId64 " size=%" PRId64
" addend=%s%" PRIu64 "\n", offset, length, decrease ? "-" : "",
addend);
#endif
if (length < 0) {
return -EINVAL;
} else if (length == 0) {
return 0;
}
if (decrease) {
qcow2_cache_set_dependency(bs, s->refcount_block_cache,
s->l2_table_cache);
}
start = start_of_cluster(s, offset);
last = start_of_cluster(s, offset + length - 1);
for(cluster_offset = start; cluster_offset <= last;
cluster_offset += s->cluster_size)
{
int block_index;
uint64_t refcount;
int64_t cluster_index = cluster_offset >> s->cluster_bits;
int64_t table_index = cluster_index >> s->refcount_block_bits;
if (table_index != old_table_index) {
if (refcount_block) {
ret = qcow2_cache_put(bs, s->refcount_block_cache,
&refcount_block);
if (ret < 0) {
goto fail;
}
}
ret = alloc_refcount_block(bs, cluster_index, &refcount_block);
if (ret < 0) {
goto fail;
}
}
old_table_index = table_index;
qcow2_cache_entry_mark_dirty(bs, s->refcount_block_cache,
refcount_block);
block_index = cluster_index & (s->refcount_block_size - 1);
refcount = s->get_refcount(refcount_block, block_index);
if (decrease ? (refcount - addend > refcount)
: (refcount + addend < refcount ||
refcount + addend > s->refcount_max))
{
ret = -EINVAL;
goto fail;
}
if (decrease) {
refcount -= addend;
} else {
refcount += addend;
}
if (refcount == 0 && cluster_index < s->free_cluster_index) {
s->free_cluster_index = cluster_index;
}
s->set_refcount(refcount_block, block_index, refcount);
if (refcount == 0 && s->discard_passthrough[type]) {
update_refcount_discard(bs, cluster_offset, s->cluster_size);
}
}
ret = 0;
fail:
if (!s->cache_discards) {
qcow2_process_discards(bs, ret);
}
if (refcount_block) {
int wret;
wret = qcow2_cache_put(bs, s->refcount_block_cache, &refcount_block);
if (wret < 0) {
return ret < 0 ? ret : wret;
}
}
if (ret < 0) {
int dummy;
dummy = update_refcount(bs, offset, cluster_offset - offset, addend,
!decrease, QCOW2_DISCARD_NEVER);
(void)dummy;
}
return ret;
}
| {
"code": [],
"line_no": []
} | static int VAR_0 update_refcount(BlockDriverState *bs,
int64_t offset,
int64_t length,
uint64_t addend,
bool decrease,
enum qcow2_discard_type type)
{
BDRVQcowState *s = bs->opaque;
int64_t start, last, cluster_offset;
void *refcount_block = NULL;
int64_t old_table_index = -1;
int ret;
#ifdef DEBUG_ALLOC2
fprintf(stderr, "update_refcount: offset=%" PRId64 " size=%" PRId64
" addend=%s%" PRIu64 "\n", offset, length, decrease ? "-" : "",
addend);
#endif
if (length < 0) {
return -EINVAL;
} else if (length == 0) {
return 0;
}
if (decrease) {
qcow2_cache_set_dependency(bs, s->refcount_block_cache,
s->l2_table_cache);
}
start = start_of_cluster(s, offset);
last = start_of_cluster(s, offset + length - 1);
for(cluster_offset = start; cluster_offset <= last;
cluster_offset += s->cluster_size)
{
int block_index;
uint64_t refcount;
int64_t cluster_index = cluster_offset >> s->cluster_bits;
int64_t table_index = cluster_index >> s->refcount_block_bits;
if (table_index != old_table_index) {
if (refcount_block) {
ret = qcow2_cache_put(bs, s->refcount_block_cache,
&refcount_block);
if (ret < 0) {
goto fail;
}
}
ret = alloc_refcount_block(bs, cluster_index, &refcount_block);
if (ret < 0) {
goto fail;
}
}
old_table_index = table_index;
qcow2_cache_entry_mark_dirty(bs, s->refcount_block_cache,
refcount_block);
block_index = cluster_index & (s->refcount_block_size - 1);
refcount = s->get_refcount(refcount_block, block_index);
if (decrease ? (refcount - addend > refcount)
: (refcount + addend < refcount ||
refcount + addend > s->refcount_max))
{
ret = -EINVAL;
goto fail;
}
if (decrease) {
refcount -= addend;
} else {
refcount += addend;
}
if (refcount == 0 && cluster_index < s->free_cluster_index) {
s->free_cluster_index = cluster_index;
}
s->set_refcount(refcount_block, block_index, refcount);
if (refcount == 0 && s->discard_passthrough[type]) {
update_refcount_discard(bs, cluster_offset, s->cluster_size);
}
}
ret = 0;
fail:
if (!s->cache_discards) {
qcow2_process_discards(bs, ret);
}
if (refcount_block) {
int wret;
wret = qcow2_cache_put(bs, s->refcount_block_cache, &refcount_block);
if (wret < 0) {
return ret < 0 ? ret : wret;
}
}
if (ret < 0) {
int dummy;
dummy = update_refcount(bs, offset, cluster_offset - offset, addend,
!decrease, QCOW2_DISCARD_NEVER);
(void)dummy;
}
return ret;
}
| [
"static int VAR_0 update_refcount(BlockDriverState *bs,\nint64_t offset,\nint64_t length,\nuint64_t addend,\nbool decrease,\nenum qcow2_discard_type type)\n{",
"BDRVQcowState *s = bs->opaque;",
"int64_t start, last, cluster_offset;",
"void *refcount_block = NULL;",
"int64_t old_table_index = -1;",
"int ret;",
"#ifdef DEBUG_ALLOC2\nfprintf(stderr, \"update_refcount: offset=%\" PRId64 \" size=%\" PRId64\n\" addend=%s%\" PRIu64 \"\\n\", offset, length, decrease ? \"-\" : \"\",\naddend);",
"#endif\nif (length < 0) {",
"return -EINVAL;",
"} else if (length == 0) {",
"return 0;",
"}",
"if (decrease) {",
"qcow2_cache_set_dependency(bs, s->refcount_block_cache,\ns->l2_table_cache);",
"}",
"start = start_of_cluster(s, offset);",
"last = start_of_cluster(s, offset + length - 1);",
"for(cluster_offset = start; cluster_offset <= last;",
"cluster_offset += s->cluster_size)\n{",
"int block_index;",
"uint64_t refcount;",
"int64_t cluster_index = cluster_offset >> s->cluster_bits;",
"int64_t table_index = cluster_index >> s->refcount_block_bits;",
"if (table_index != old_table_index) {",
"if (refcount_block) {",
"ret = qcow2_cache_put(bs, s->refcount_block_cache,\n&refcount_block);",
"if (ret < 0) {",
"goto fail;",
"}",
"}",
"ret = alloc_refcount_block(bs, cluster_index, &refcount_block);",
"if (ret < 0) {",
"goto fail;",
"}",
"}",
"old_table_index = table_index;",
"qcow2_cache_entry_mark_dirty(bs, s->refcount_block_cache,\nrefcount_block);",
"block_index = cluster_index & (s->refcount_block_size - 1);",
"refcount = s->get_refcount(refcount_block, block_index);",
"if (decrease ? (refcount - addend > refcount)\n: (refcount + addend < refcount ||\nrefcount + addend > s->refcount_max))\n{",
"ret = -EINVAL;",
"goto fail;",
"}",
"if (decrease) {",
"refcount -= addend;",
"} else {",
"refcount += addend;",
"}",
"if (refcount == 0 && cluster_index < s->free_cluster_index) {",
"s->free_cluster_index = cluster_index;",
"}",
"s->set_refcount(refcount_block, block_index, refcount);",
"if (refcount == 0 && s->discard_passthrough[type]) {",
"update_refcount_discard(bs, cluster_offset, s->cluster_size);",
"}",
"}",
"ret = 0;",
"fail:\nif (!s->cache_discards) {",
"qcow2_process_discards(bs, ret);",
"}",
"if (refcount_block) {",
"int wret;",
"wret = qcow2_cache_put(bs, s->refcount_block_cache, &refcount_block);",
"if (wret < 0) {",
"return ret < 0 ? ret : wret;",
"}",
"}",
"if (ret < 0) {",
"int dummy;",
"dummy = update_refcount(bs, offset, cluster_offset - offset, addend,\n!decrease, QCOW2_DISCARD_NEVER);",
"(void)dummy;",
"}",
"return ret;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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,
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
49
],
[
51,
53
],
[
55
],
[
59
],
[
61
],
[
63
],
[
65,
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
81
],
[
83
],
[
85,
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
113,
115
],
[
121
],
[
125
],
[
127,
129,
131,
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149
],
[
151
],
[
153
],
[
155
],
[
157
],
[
161
],
[
163
],
[
165
],
[
167
],
[
171
],
[
173,
175
],
[
177
],
[
179
],
[
185
],
[
187
],
[
189
],
[
191
],
[
193
],
[
195
],
[
197
],
[
209
],
[
211
],
[
213,
215
],
[
217
],
[
219
],
[
223
],
[
225
]
]
|
14,901 | static void virtio_scsi_clear_aio(VirtIOSCSI *s)
{
VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);
int i;
if (s->ctrl_vring) {
aio_set_event_notifier(s->ctx, &s->ctrl_vring->host_notifier,
false, NULL);
}
if (s->event_vring) {
aio_set_event_notifier(s->ctx, &s->event_vring->host_notifier,
false, NULL);
}
if (s->cmd_vrings) {
for (i = 0; i < vs->conf.num_queues && s->cmd_vrings[i]; i++) {
aio_set_event_notifier(s->ctx, &s->cmd_vrings[i]->host_notifier,
false, NULL);
}
}
}
| false | qemu | 3a1e8074d74ad2acbcedf28d35aebedc3573f19e | static void virtio_scsi_clear_aio(VirtIOSCSI *s)
{
VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);
int i;
if (s->ctrl_vring) {
aio_set_event_notifier(s->ctx, &s->ctrl_vring->host_notifier,
false, NULL);
}
if (s->event_vring) {
aio_set_event_notifier(s->ctx, &s->event_vring->host_notifier,
false, NULL);
}
if (s->cmd_vrings) {
for (i = 0; i < vs->conf.num_queues && s->cmd_vrings[i]; i++) {
aio_set_event_notifier(s->ctx, &s->cmd_vrings[i]->host_notifier,
false, NULL);
}
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(VirtIOSCSI *VAR_0)
{
VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(VAR_0);
int VAR_1;
if (VAR_0->ctrl_vring) {
aio_set_event_notifier(VAR_0->ctx, &VAR_0->ctrl_vring->host_notifier,
false, NULL);
}
if (VAR_0->event_vring) {
aio_set_event_notifier(VAR_0->ctx, &VAR_0->event_vring->host_notifier,
false, NULL);
}
if (VAR_0->cmd_vrings) {
for (VAR_1 = 0; VAR_1 < vs->conf.num_queues && VAR_0->cmd_vrings[VAR_1]; VAR_1++) {
aio_set_event_notifier(VAR_0->ctx, &VAR_0->cmd_vrings[VAR_1]->host_notifier,
false, NULL);
}
}
}
| [
"static void FUNC_0(VirtIOSCSI *VAR_0)\n{",
"VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(VAR_0);",
"int VAR_1;",
"if (VAR_0->ctrl_vring) {",
"aio_set_event_notifier(VAR_0->ctx, &VAR_0->ctrl_vring->host_notifier,\nfalse, NULL);",
"}",
"if (VAR_0->event_vring) {",
"aio_set_event_notifier(VAR_0->ctx, &VAR_0->event_vring->host_notifier,\nfalse, NULL);",
"}",
"if (VAR_0->cmd_vrings) {",
"for (VAR_1 = 0; VAR_1 < vs->conf.num_queues && VAR_0->cmd_vrings[VAR_1]; VAR_1++) {",
"aio_set_event_notifier(VAR_0->ctx, &VAR_0->cmd_vrings[VAR_1]->host_notifier,\nfalse, NULL);",
"}",
"}",
"}"
]
| [
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
]
]
|
14,903 | create_iovec(BlockBackend *blk, QEMUIOVector *qiov, char **argv, int nr_iov,
int pattern)
{
size_t *sizes = g_new0(size_t, nr_iov);
size_t count = 0;
void *buf = NULL;
void *p;
int i;
for (i = 0; i < nr_iov; i++) {
char *arg = argv[i];
int64_t len;
len = cvtnum(arg);
if (len < 0) {
print_cvtnum_err(len, arg);
goto fail;
}
/* should be SIZE_T_MAX, but that doesn't exist */
if (len > INT_MAX) {
printf("Argument '%s' exceeds maximum size %d\n", arg, INT_MAX);
goto fail;
}
sizes[i] = len;
count += len;
}
qemu_iovec_init(qiov, nr_iov);
buf = p = qemu_io_alloc(blk, count, pattern);
for (i = 0; i < nr_iov; i++) {
qemu_iovec_add(qiov, p, sizes[i]);
p += sizes[i];
}
fail:
g_free(sizes);
return buf;
}
| false | qemu | a367467995d0528fe591d87ca2e437c7b7d7951b | create_iovec(BlockBackend *blk, QEMUIOVector *qiov, char **argv, int nr_iov,
int pattern)
{
size_t *sizes = g_new0(size_t, nr_iov);
size_t count = 0;
void *buf = NULL;
void *p;
int i;
for (i = 0; i < nr_iov; i++) {
char *arg = argv[i];
int64_t len;
len = cvtnum(arg);
if (len < 0) {
print_cvtnum_err(len, arg);
goto fail;
}
if (len > INT_MAX) {
printf("Argument '%s' exceeds maximum size %d\n", arg, INT_MAX);
goto fail;
}
sizes[i] = len;
count += len;
}
qemu_iovec_init(qiov, nr_iov);
buf = p = qemu_io_alloc(blk, count, pattern);
for (i = 0; i < nr_iov; i++) {
qemu_iovec_add(qiov, p, sizes[i]);
p += sizes[i];
}
fail:
g_free(sizes);
return buf;
}
| {
"code": [],
"line_no": []
} | FUNC_0(BlockBackend *VAR_0, QEMUIOVector *VAR_1, char **VAR_2, int VAR_3,
int VAR_4)
{
size_t *sizes = g_new0(size_t, VAR_3);
size_t count = 0;
void *VAR_5 = NULL;
void *VAR_6;
int VAR_7;
for (VAR_7 = 0; VAR_7 < VAR_3; VAR_7++) {
char *VAR_8 = VAR_2[VAR_7];
int64_t len;
len = cvtnum(VAR_8);
if (len < 0) {
print_cvtnum_err(len, VAR_8);
goto fail;
}
if (len > INT_MAX) {
printf("Argument '%s' exceeds maximum size %d\n", VAR_8, INT_MAX);
goto fail;
}
sizes[VAR_7] = len;
count += len;
}
qemu_iovec_init(VAR_1, VAR_3);
VAR_5 = VAR_6 = qemu_io_alloc(VAR_0, count, VAR_4);
for (VAR_7 = 0; VAR_7 < VAR_3; VAR_7++) {
qemu_iovec_add(VAR_1, VAR_6, sizes[VAR_7]);
VAR_6 += sizes[VAR_7];
}
fail:
g_free(sizes);
return VAR_5;
}
| [
"FUNC_0(BlockBackend *VAR_0, QEMUIOVector *VAR_1, char **VAR_2, int VAR_3,\nint VAR_4)\n{",
"size_t *sizes = g_new0(size_t, VAR_3);",
"size_t count = 0;",
"void *VAR_5 = NULL;",
"void *VAR_6;",
"int VAR_7;",
"for (VAR_7 = 0; VAR_7 < VAR_3; VAR_7++) {",
"char *VAR_8 = VAR_2[VAR_7];",
"int64_t len;",
"len = cvtnum(VAR_8);",
"if (len < 0) {",
"print_cvtnum_err(len, VAR_8);",
"goto fail;",
"}",
"if (len > INT_MAX) {",
"printf(\"Argument '%s' exceeds maximum size %d\\n\", VAR_8, INT_MAX);",
"goto fail;",
"}",
"sizes[VAR_7] = len;",
"count += len;",
"}",
"qemu_iovec_init(VAR_1, VAR_3);",
"VAR_5 = VAR_6 = qemu_io_alloc(VAR_0, count, VAR_4);",
"for (VAR_7 = 0; VAR_7 < VAR_3; VAR_7++) {",
"qemu_iovec_add(VAR_1, VAR_6, sizes[VAR_7]);",
"VAR_6 += sizes[VAR_7];",
"}",
"fail:\ng_free(sizes);",
"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
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
41
],
[
43
],
[
45
],
[
47
],
[
51
],
[
53
],
[
55
],
[
59
],
[
63
],
[
67
],
[
69
],
[
71
],
[
73
],
[
77,
79
],
[
81
],
[
83
]
]
|
14,905 | static void pflash_update(pflash_t *pfl, int offset,
int size)
{
int offset_end;
if (pfl->bs) {
offset_end = offset + size;
/* round to sectors */
offset = offset >> 9;
offset_end = (offset_end + 511) >> 9;
bdrv_write(pfl->bs, offset, pfl->storage + (offset << 9),
offset_end - offset);
}
}
| false | qemu | 4be746345f13e99e468c60acbd3a355e8183e3ce | static void pflash_update(pflash_t *pfl, int offset,
int size)
{
int offset_end;
if (pfl->bs) {
offset_end = offset + size;
offset = offset >> 9;
offset_end = (offset_end + 511) >> 9;
bdrv_write(pfl->bs, offset, pfl->storage + (offset << 9),
offset_end - offset);
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(pflash_t *VAR_0, int VAR_1,
int VAR_2)
{
int VAR_3;
if (VAR_0->bs) {
VAR_3 = VAR_1 + VAR_2;
VAR_1 = VAR_1 >> 9;
VAR_3 = (VAR_3 + 511) >> 9;
bdrv_write(VAR_0->bs, VAR_1, VAR_0->storage + (VAR_1 << 9),
VAR_3 - VAR_1);
}
}
| [
"static void FUNC_0(pflash_t *VAR_0, int VAR_1,\nint VAR_2)\n{",
"int VAR_3;",
"if (VAR_0->bs) {",
"VAR_3 = VAR_1 + VAR_2;",
"VAR_1 = VAR_1 >> 9;",
"VAR_3 = (VAR_3 + 511) >> 9;",
"bdrv_write(VAR_0->bs, VAR_1, VAR_0->storage + (VAR_1 << 9),\nVAR_3 - VAR_1);",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
19,
21
],
[
23
],
[
25
]
]
|
14,906 | static int piix4_initfn(PCIDevice *d)
{
uint8_t *pci_conf;
isa_bus_new(&d->qdev);
register_savevm("PIIX4", 0, 2, piix_save, piix_load, d);
pci_conf = d->config;
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82371AB_0); // 82371AB/EB/MB PIIX4 PCI-to-ISA bridge
pci_config_set_class(pci_conf, PCI_CLASS_BRIDGE_ISA);
pci_conf[PCI_HEADER_TYPE] =
PCI_HEADER_TYPE_NORMAL | PCI_HEADER_TYPE_MULTI_FUNCTION; // header_type = PCI_multifunction, generic
piix4_dev = d;
piix4_reset(d);
qemu_register_reset(piix4_reset, d);
return 0;
}
| false | qemu | c169998802505c244b8bcad562633f29de7d74a4 | static int piix4_initfn(PCIDevice *d)
{
uint8_t *pci_conf;
isa_bus_new(&d->qdev);
register_savevm("PIIX4", 0, 2, piix_save, piix_load, d);
pci_conf = d->config;
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82371AB_0);
pci_config_set_class(pci_conf, PCI_CLASS_BRIDGE_ISA);
pci_conf[PCI_HEADER_TYPE] =
PCI_HEADER_TYPE_NORMAL | PCI_HEADER_TYPE_MULTI_FUNCTION;
piix4_dev = d;
piix4_reset(d);
qemu_register_reset(piix4_reset, d);
return 0;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(PCIDevice *VAR_0)
{
uint8_t *pci_conf;
isa_bus_new(&VAR_0->qdev);
register_savevm("PIIX4", 0, 2, piix_save, piix_load, VAR_0);
pci_conf = VAR_0->config;
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82371AB_0);
pci_config_set_class(pci_conf, PCI_CLASS_BRIDGE_ISA);
pci_conf[PCI_HEADER_TYPE] =
PCI_HEADER_TYPE_NORMAL | PCI_HEADER_TYPE_MULTI_FUNCTION;
piix4_dev = VAR_0;
piix4_reset(VAR_0);
qemu_register_reset(piix4_reset, VAR_0);
return 0;
}
| [
"static int FUNC_0(PCIDevice *VAR_0)\n{",
"uint8_t *pci_conf;",
"isa_bus_new(&VAR_0->qdev);",
"register_savevm(\"PIIX4\", 0, 2, piix_save, piix_load, VAR_0);",
"pci_conf = VAR_0->config;",
"pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);",
"pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82371AB_0);",
"pci_config_set_class(pci_conf, PCI_CLASS_BRIDGE_ISA);",
"pci_conf[PCI_HEADER_TYPE] =\nPCI_HEADER_TYPE_NORMAL | PCI_HEADER_TYPE_MULTI_FUNCTION;",
"piix4_dev = VAR_0;",
"piix4_reset(VAR_0);",
"qemu_register_reset(piix4_reset, VAR_0);",
"return 0;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23,
25
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
]
]
|
14,907 | void nbd_client_session_detach_aio_context(NbdClientSession *client)
{
aio_set_fd_handler(bdrv_get_aio_context(client->bs), client->sock,
NULL, NULL, NULL);
}
| false | qemu | f53a829bb9ef14be800556cbc02d8b20fc1050a7 | void nbd_client_session_detach_aio_context(NbdClientSession *client)
{
aio_set_fd_handler(bdrv_get_aio_context(client->bs), client->sock,
NULL, NULL, NULL);
}
| {
"code": [],
"line_no": []
} | void FUNC_0(NbdClientSession *VAR_0)
{
aio_set_fd_handler(bdrv_get_aio_context(VAR_0->bs), VAR_0->sock,
NULL, NULL, NULL);
}
| [
"void FUNC_0(NbdClientSession *VAR_0)\n{",
"aio_set_fd_handler(bdrv_get_aio_context(VAR_0->bs), VAR_0->sock,\nNULL, NULL, NULL);",
"}"
]
| [
0,
0,
0
]
| [
[
1,
3
],
[
5,
7
],
[
9
]
]
|
14,908 | static void fd_put_notify(void *opaque)
{
QEMUFileFD *s = opaque;
/* Remove writable callback and do a put notify */
qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
qemu_file_put_notify(s->file);
}
| false | qemu | 871d2f079661323a7645b388eb5ae8d7eeb3117c | static void fd_put_notify(void *opaque)
{
QEMUFileFD *s = opaque;
qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
qemu_file_put_notify(s->file);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(void *VAR_0)
{
QEMUFileFD *s = VAR_0;
qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
qemu_file_put_notify(s->file);
}
| [
"static void FUNC_0(void *VAR_0)\n{",
"QEMUFileFD *s = VAR_0;",
"qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);",
"qemu_file_put_notify(s->file);",
"}"
]
| [
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
11
],
[
13
],
[
15
]
]
|
14,909 | int qemu_savevm_state_iterate(Monitor *mon, QEMUFile *f)
{
SaveStateEntry *se;
int ret = 1;
QTAILQ_FOREACH(se, &savevm_handlers, entry) {
if (se->save_live_state == NULL)
continue;
/* Section type */
qemu_put_byte(f, QEMU_VM_SECTION_PART);
qemu_put_be32(f, se->section_id);
ret = se->save_live_state(mon, f, QEMU_VM_SECTION_PART, se->opaque);
if (!ret) {
/* Do not proceed to the next vmstate before this one reported
completion of the current stage. This serializes the migration
and reduces the probability that a faster changing state is
synchronized over and over again. */
break;
}
}
if (ret != 0) {
return ret;
}
ret = qemu_file_get_error(f);
if (ret != 0) {
qemu_savevm_state_cancel(mon, f);
}
return ret;
}
| false | qemu | 2975725f6b3d634dbe924ea9d9f4d86b8a5b217d | int qemu_savevm_state_iterate(Monitor *mon, QEMUFile *f)
{
SaveStateEntry *se;
int ret = 1;
QTAILQ_FOREACH(se, &savevm_handlers, entry) {
if (se->save_live_state == NULL)
continue;
qemu_put_byte(f, QEMU_VM_SECTION_PART);
qemu_put_be32(f, se->section_id);
ret = se->save_live_state(mon, f, QEMU_VM_SECTION_PART, se->opaque);
if (!ret) {
break;
}
}
if (ret != 0) {
return ret;
}
ret = qemu_file_get_error(f);
if (ret != 0) {
qemu_savevm_state_cancel(mon, f);
}
return ret;
}
| {
"code": [],
"line_no": []
} | int FUNC_0(Monitor *VAR_0, QEMUFile *VAR_1)
{
SaveStateEntry *se;
int VAR_2 = 1;
QTAILQ_FOREACH(se, &savevm_handlers, entry) {
if (se->save_live_state == NULL)
continue;
qemu_put_byte(VAR_1, QEMU_VM_SECTION_PART);
qemu_put_be32(VAR_1, se->section_id);
VAR_2 = se->save_live_state(VAR_0, VAR_1, QEMU_VM_SECTION_PART, se->opaque);
if (!VAR_2) {
break;
}
}
if (VAR_2 != 0) {
return VAR_2;
}
VAR_2 = qemu_file_get_error(VAR_1);
if (VAR_2 != 0) {
qemu_savevm_state_cancel(VAR_0, VAR_1);
}
return VAR_2;
}
| [
"int FUNC_0(Monitor *VAR_0, QEMUFile *VAR_1)\n{",
"SaveStateEntry *se;",
"int VAR_2 = 1;",
"QTAILQ_FOREACH(se, &savevm_handlers, entry) {",
"if (se->save_live_state == NULL)\ncontinue;",
"qemu_put_byte(VAR_1, QEMU_VM_SECTION_PART);",
"qemu_put_be32(VAR_1, se->section_id);",
"VAR_2 = se->save_live_state(VAR_0, VAR_1, QEMU_VM_SECTION_PART, se->opaque);",
"if (!VAR_2) {",
"break;",
"}",
"}",
"if (VAR_2 != 0) {",
"return VAR_2;",
"}",
"VAR_2 = qemu_file_get_error(VAR_1);",
"if (VAR_2 != 0) {",
"qemu_savevm_state_cancel(VAR_0, VAR_1);",
"}",
"return VAR_2;",
"}"
]
| [
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
],
[
21
],
[
23
],
[
27
],
[
29
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
]
]
|
14,910 | int qcow2_alloc_cluster_offset(BlockDriverState *bs, uint64_t offset,
int n_start, int n_end, int *num, uint64_t *host_offset, QCowL2Meta **m)
{
BDRVQcowState *s = bs->opaque;
uint64_t start, remaining;
uint64_t cluster_offset;
uint64_t cur_bytes;
int ret;
trace_qcow2_alloc_clusters_offset(qemu_coroutine_self(), offset,
n_start, n_end);
assert(n_start * BDRV_SECTOR_SIZE == offset_into_cluster(s, offset));
offset = start_of_cluster(s, offset);
again:
start = offset + (n_start << BDRV_SECTOR_BITS);
remaining = (n_end - n_start) << BDRV_SECTOR_BITS;
cluster_offset = 0;
*host_offset = 0;
/*
* Now start gathering as many contiguous clusters as possible:
*
* 1. Check for overlaps with in-flight allocations
*
* a) Overlap not in the first cluster -> shorten this request and let
* the caller handle the rest in its next loop iteration.
*
* b) Real overlaps of two requests. Yield and restart the search for
* contiguous clusters (the situation could have changed while we
* were sleeping)
*
* c) TODO: Request starts in the same cluster as the in-flight
* allocation ends. Shorten the COW of the in-fight allocation, set
* cluster_offset to write to the same cluster and set up the right
* synchronisation between the in-flight request and the new one.
*/
cur_bytes = remaining;
ret = handle_dependencies(bs, start, &cur_bytes);
if (ret == -EAGAIN) {
goto again;
} else if (ret < 0) {
return ret;
} else {
/* handle_dependencies() may have decreased cur_bytes (shortened
* the allocations below) so that the next dependency is processed
* correctly during the next loop iteration. */
}
/*
* 2. Count contiguous COPIED clusters.
*/
ret = handle_copied(bs, start, &cluster_offset, &cur_bytes, m);
if (ret < 0) {
return ret;
} else if (ret) {
if (!*host_offset) {
*host_offset = start_of_cluster(s, cluster_offset);
}
start += cur_bytes;
remaining -= cur_bytes;
cluster_offset += cur_bytes;
cur_bytes = remaining;
} else if (cur_bytes == 0) {
goto done;
}
/* If there is something left to allocate, do that now */
if (remaining == 0) {
goto done;
}
/*
* 3. If the request still hasn't completed, allocate new clusters,
* considering any cluster_offset of steps 1c or 2.
*/
ret = handle_alloc(bs, start, &cluster_offset, &cur_bytes, m);
if (ret < 0) {
return ret;
} else if (ret) {
if (!*host_offset) {
*host_offset = start_of_cluster(s, cluster_offset);
}
start += cur_bytes;
remaining -= cur_bytes;
cluster_offset += cur_bytes;
}
/* Some cleanup work */
done:
*num = (n_end - n_start) - (remaining >> BDRV_SECTOR_BITS);
assert(*num > 0);
assert(*host_offset != 0);
return 0;
}
| false | qemu | 2c3b32d25620c26e26fd590c198ec6d9cf91da57 | int qcow2_alloc_cluster_offset(BlockDriverState *bs, uint64_t offset,
int n_start, int n_end, int *num, uint64_t *host_offset, QCowL2Meta **m)
{
BDRVQcowState *s = bs->opaque;
uint64_t start, remaining;
uint64_t cluster_offset;
uint64_t cur_bytes;
int ret;
trace_qcow2_alloc_clusters_offset(qemu_coroutine_self(), offset,
n_start, n_end);
assert(n_start * BDRV_SECTOR_SIZE == offset_into_cluster(s, offset));
offset = start_of_cluster(s, offset);
again:
start = offset + (n_start << BDRV_SECTOR_BITS);
remaining = (n_end - n_start) << BDRV_SECTOR_BITS;
cluster_offset = 0;
*host_offset = 0;
cur_bytes = remaining;
ret = handle_dependencies(bs, start, &cur_bytes);
if (ret == -EAGAIN) {
goto again;
} else if (ret < 0) {
return ret;
} else {
}
ret = handle_copied(bs, start, &cluster_offset, &cur_bytes, m);
if (ret < 0) {
return ret;
} else if (ret) {
if (!*host_offset) {
*host_offset = start_of_cluster(s, cluster_offset);
}
start += cur_bytes;
remaining -= cur_bytes;
cluster_offset += cur_bytes;
cur_bytes = remaining;
} else if (cur_bytes == 0) {
goto done;
}
if (remaining == 0) {
goto done;
}
ret = handle_alloc(bs, start, &cluster_offset, &cur_bytes, m);
if (ret < 0) {
return ret;
} else if (ret) {
if (!*host_offset) {
*host_offset = start_of_cluster(s, cluster_offset);
}
start += cur_bytes;
remaining -= cur_bytes;
cluster_offset += cur_bytes;
}
done:
*num = (n_end - n_start) - (remaining >> BDRV_SECTOR_BITS);
assert(*num > 0);
assert(*host_offset != 0);
return 0;
}
| {
"code": [],
"line_no": []
} | int FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1,
int VAR_2, int VAR_3, int *VAR_4, uint64_t *VAR_5, QCowL2Meta **VAR_6)
{
BDRVQcowState *s = VAR_0->opaque;
uint64_t start, remaining;
uint64_t cluster_offset;
uint64_t cur_bytes;
int VAR_7;
trace_qcow2_alloc_clusters_offset(qemu_coroutine_self(), VAR_1,
VAR_2, VAR_3);
assert(VAR_2 * BDRV_SECTOR_SIZE == offset_into_cluster(s, VAR_1));
VAR_1 = start_of_cluster(s, VAR_1);
again:
start = VAR_1 + (VAR_2 << BDRV_SECTOR_BITS);
remaining = (VAR_3 - VAR_2) << BDRV_SECTOR_BITS;
cluster_offset = 0;
*VAR_5 = 0;
cur_bytes = remaining;
VAR_7 = handle_dependencies(VAR_0, start, &cur_bytes);
if (VAR_7 == -EAGAIN) {
goto again;
} else if (VAR_7 < 0) {
return VAR_7;
} else {
}
VAR_7 = handle_copied(VAR_0, start, &cluster_offset, &cur_bytes, VAR_6);
if (VAR_7 < 0) {
return VAR_7;
} else if (VAR_7) {
if (!*VAR_5) {
*VAR_5 = start_of_cluster(s, cluster_offset);
}
start += cur_bytes;
remaining -= cur_bytes;
cluster_offset += cur_bytes;
cur_bytes = remaining;
} else if (cur_bytes == 0) {
goto done;
}
if (remaining == 0) {
goto done;
}
VAR_7 = handle_alloc(VAR_0, start, &cluster_offset, &cur_bytes, VAR_6);
if (VAR_7 < 0) {
return VAR_7;
} else if (VAR_7) {
if (!*VAR_5) {
*VAR_5 = start_of_cluster(s, cluster_offset);
}
start += cur_bytes;
remaining -= cur_bytes;
cluster_offset += cur_bytes;
}
done:
*VAR_4 = (VAR_3 - VAR_2) - (remaining >> BDRV_SECTOR_BITS);
assert(*VAR_4 > 0);
assert(*VAR_5 != 0);
return 0;
}
| [
"int FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1,\nint VAR_2, int VAR_3, int *VAR_4, uint64_t *VAR_5, QCowL2Meta **VAR_6)\n{",
"BDRVQcowState *s = VAR_0->opaque;",
"uint64_t start, remaining;",
"uint64_t cluster_offset;",
"uint64_t cur_bytes;",
"int VAR_7;",
"trace_qcow2_alloc_clusters_offset(qemu_coroutine_self(), VAR_1,\nVAR_2, VAR_3);",
"assert(VAR_2 * BDRV_SECTOR_SIZE == offset_into_cluster(s, VAR_1));",
"VAR_1 = start_of_cluster(s, VAR_1);",
"again:\nstart = VAR_1 + (VAR_2 << BDRV_SECTOR_BITS);",
"remaining = (VAR_3 - VAR_2) << BDRV_SECTOR_BITS;",
"cluster_offset = 0;",
"*VAR_5 = 0;",
"cur_bytes = remaining;",
"VAR_7 = handle_dependencies(VAR_0, start, &cur_bytes);",
"if (VAR_7 == -EAGAIN) {",
"goto again;",
"} else if (VAR_7 < 0) {",
"return VAR_7;",
"} else {",
"}",
"VAR_7 = handle_copied(VAR_0, start, &cluster_offset, &cur_bytes, VAR_6);",
"if (VAR_7 < 0) {",
"return VAR_7;",
"} else if (VAR_7) {",
"if (!*VAR_5) {",
"*VAR_5 = start_of_cluster(s, cluster_offset);",
"}",
"start += cur_bytes;",
"remaining -= cur_bytes;",
"cluster_offset += cur_bytes;",
"cur_bytes = remaining;",
"} else if (cur_bytes == 0) {",
"goto done;",
"}",
"if (remaining == 0) {",
"goto done;",
"}",
"VAR_7 = handle_alloc(VAR_0, start, &cluster_offset, &cur_bytes, VAR_6);",
"if (VAR_7 < 0) {",
"return VAR_7;",
"} else if (VAR_7) {",
"if (!*VAR_5) {",
"*VAR_5 = start_of_cluster(s, cluster_offset);",
"}",
"start += cur_bytes;",
"remaining -= cur_bytes;",
"cluster_offset += cur_bytes;",
"}",
"done:\n*VAR_4 = (VAR_3 - VAR_2) - (remaining >> BDRV_SECTOR_BITS);",
"assert(*VAR_4 > 0);",
"assert(*VAR_5 != 0);",
"return 0;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19,
21
],
[
25
],
[
27
],
[
31,
33
],
[
35
],
[
37
],
[
39
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
97
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
123
],
[
125
],
[
127
],
[
131
],
[
133
],
[
135
],
[
137
],
[
143
],
[
145
],
[
147
],
[
159
],
[
161
],
[
163
],
[
165
],
[
167
],
[
169
],
[
171
],
[
175
],
[
177
],
[
179
],
[
181
],
[
187,
189
],
[
191
],
[
193
],
[
197
],
[
199
]
]
|
14,912 | QemuConsole *graphic_console_init(DeviceState *dev, uint32_t head,
const GraphicHwOps *hw_ops,
void *opaque)
{
int width = 640;
int height = 480;
QemuConsole *s;
DisplayState *ds;
ds = get_alloc_displaystate();
trace_console_gfx_new();
s = new_console(ds, GRAPHIC_CONSOLE, head);
s->hw_ops = hw_ops;
s->hw = opaque;
if (dev) {
object_property_set_link(OBJECT(s), OBJECT(dev), "device",
&error_abort);
}
s->surface = qemu_create_displaysurface(width, height);
return s;
}
| false | qemu | 521a580d2352ad30086babcabb91e6338e47cf62 | QemuConsole *graphic_console_init(DeviceState *dev, uint32_t head,
const GraphicHwOps *hw_ops,
void *opaque)
{
int width = 640;
int height = 480;
QemuConsole *s;
DisplayState *ds;
ds = get_alloc_displaystate();
trace_console_gfx_new();
s = new_console(ds, GRAPHIC_CONSOLE, head);
s->hw_ops = hw_ops;
s->hw = opaque;
if (dev) {
object_property_set_link(OBJECT(s), OBJECT(dev), "device",
&error_abort);
}
s->surface = qemu_create_displaysurface(width, height);
return s;
}
| {
"code": [],
"line_no": []
} | QemuConsole *FUNC_0(DeviceState *dev, uint32_t head,
const GraphicHwOps *hw_ops,
void *opaque)
{
int VAR_0 = 640;
int VAR_1 = 480;
QemuConsole *s;
DisplayState *ds;
ds = get_alloc_displaystate();
trace_console_gfx_new();
s = new_console(ds, GRAPHIC_CONSOLE, head);
s->hw_ops = hw_ops;
s->hw = opaque;
if (dev) {
object_property_set_link(OBJECT(s), OBJECT(dev), "device",
&error_abort);
}
s->surface = qemu_create_displaysurface(VAR_0, VAR_1);
return s;
}
| [
"QemuConsole *FUNC_0(DeviceState *dev, uint32_t head,\nconst GraphicHwOps *hw_ops,\nvoid *opaque)\n{",
"int VAR_0 = 640;",
"int VAR_1 = 480;",
"QemuConsole *s;",
"DisplayState *ds;",
"ds = get_alloc_displaystate();",
"trace_console_gfx_new();",
"s = new_console(ds, GRAPHIC_CONSOLE, head);",
"s->hw_ops = hw_ops;",
"s->hw = opaque;",
"if (dev) {",
"object_property_set_link(OBJECT(s), OBJECT(dev), \"device\",\n&error_abort);",
"}",
"s->surface = qemu_create_displaysurface(VAR_0, VAR_1);",
"return s;",
"}"
]
| [
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
],
[
39
],
[
41
],
[
43
]
]
|
14,914 | static inline void stw_phys_internal(target_phys_addr_t addr, uint32_t val,
enum device_endian endian)
{
uint8_t *ptr;
MemoryRegionSection *section;
section = phys_page_find(addr >> TARGET_PAGE_BITS);
if (!memory_region_is_ram(section->mr) || section->readonly) {
addr = memory_region_section_addr(section, addr);
if (memory_region_is_ram(section->mr)) {
section = &phys_sections[phys_section_rom];
}
#if defined(TARGET_WORDS_BIGENDIAN)
if (endian == DEVICE_LITTLE_ENDIAN) {
val = bswap16(val);
}
#else
if (endian == DEVICE_BIG_ENDIAN) {
val = bswap16(val);
}
#endif
io_mem_write(section->mr, addr, val, 2);
} else {
unsigned long addr1;
addr1 = (memory_region_get_ram_addr(section->mr) & TARGET_PAGE_MASK)
+ memory_region_section_addr(section, addr);
/* RAM case */
ptr = qemu_get_ram_ptr(addr1);
switch (endian) {
case DEVICE_LITTLE_ENDIAN:
stw_le_p(ptr, val);
break;
case DEVICE_BIG_ENDIAN:
stw_be_p(ptr, val);
break;
default:
stw_p(ptr, val);
break;
}
invalidate_and_set_dirty(addr1, 2);
}
}
| false | qemu | ac1970fbe8ad5a70174f462109ac0f6c7bf1bc43 | static inline void stw_phys_internal(target_phys_addr_t addr, uint32_t val,
enum device_endian endian)
{
uint8_t *ptr;
MemoryRegionSection *section;
section = phys_page_find(addr >> TARGET_PAGE_BITS);
if (!memory_region_is_ram(section->mr) || section->readonly) {
addr = memory_region_section_addr(section, addr);
if (memory_region_is_ram(section->mr)) {
section = &phys_sections[phys_section_rom];
}
#if defined(TARGET_WORDS_BIGENDIAN)
if (endian == DEVICE_LITTLE_ENDIAN) {
val = bswap16(val);
}
#else
if (endian == DEVICE_BIG_ENDIAN) {
val = bswap16(val);
}
#endif
io_mem_write(section->mr, addr, val, 2);
} else {
unsigned long addr1;
addr1 = (memory_region_get_ram_addr(section->mr) & TARGET_PAGE_MASK)
+ memory_region_section_addr(section, addr);
ptr = qemu_get_ram_ptr(addr1);
switch (endian) {
case DEVICE_LITTLE_ENDIAN:
stw_le_p(ptr, val);
break;
case DEVICE_BIG_ENDIAN:
stw_be_p(ptr, val);
break;
default:
stw_p(ptr, val);
break;
}
invalidate_and_set_dirty(addr1, 2);
}
}
| {
"code": [],
"line_no": []
} | static inline void FUNC_0(target_phys_addr_t VAR_0, uint32_t VAR_1,
enum device_endian VAR_2)
{
uint8_t *ptr;
MemoryRegionSection *section;
section = phys_page_find(VAR_0 >> TARGET_PAGE_BITS);
if (!memory_region_is_ram(section->mr) || section->readonly) {
VAR_0 = memory_region_section_addr(section, VAR_0);
if (memory_region_is_ram(section->mr)) {
section = &phys_sections[phys_section_rom];
}
#if defined(TARGET_WORDS_BIGENDIAN)
if (VAR_2 == DEVICE_LITTLE_ENDIAN) {
VAR_1 = bswap16(VAR_1);
}
#else
if (VAR_2 == DEVICE_BIG_ENDIAN) {
VAR_1 = bswap16(VAR_1);
}
#endif
io_mem_write(section->mr, VAR_0, VAR_1, 2);
} else {
unsigned long VAR_3;
VAR_3 = (memory_region_get_ram_addr(section->mr) & TARGET_PAGE_MASK)
+ memory_region_section_addr(section, VAR_0);
ptr = qemu_get_ram_ptr(VAR_3);
switch (VAR_2) {
case DEVICE_LITTLE_ENDIAN:
stw_le_p(ptr, VAR_1);
break;
case DEVICE_BIG_ENDIAN:
stw_be_p(ptr, VAR_1);
break;
default:
stw_p(ptr, VAR_1);
break;
}
invalidate_and_set_dirty(VAR_3, 2);
}
}
| [
"static inline void FUNC_0(target_phys_addr_t VAR_0, uint32_t VAR_1,\nenum device_endian VAR_2)\n{",
"uint8_t *ptr;",
"MemoryRegionSection *section;",
"section = phys_page_find(VAR_0 >> TARGET_PAGE_BITS);",
"if (!memory_region_is_ram(section->mr) || section->readonly) {",
"VAR_0 = memory_region_section_addr(section, VAR_0);",
"if (memory_region_is_ram(section->mr)) {",
"section = &phys_sections[phys_section_rom];",
"}",
"#if defined(TARGET_WORDS_BIGENDIAN)\nif (VAR_2 == DEVICE_LITTLE_ENDIAN) {",
"VAR_1 = bswap16(VAR_1);",
"}",
"#else\nif (VAR_2 == DEVICE_BIG_ENDIAN) {",
"VAR_1 = bswap16(VAR_1);",
"}",
"#endif\nio_mem_write(section->mr, VAR_0, VAR_1, 2);",
"} else {",
"unsigned long VAR_3;",
"VAR_3 = (memory_region_get_ram_addr(section->mr) & TARGET_PAGE_MASK)\n+ memory_region_section_addr(section, VAR_0);",
"ptr = qemu_get_ram_ptr(VAR_3);",
"switch (VAR_2) {",
"case DEVICE_LITTLE_ENDIAN:\nstw_le_p(ptr, VAR_1);",
"break;",
"case DEVICE_BIG_ENDIAN:\nstw_be_p(ptr, VAR_1);",
"break;",
"default:\nstw_p(ptr, VAR_1);",
"break;",
"}",
"invalidate_and_set_dirty(VAR_3, 2);",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
13
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27,
29
],
[
31
],
[
33
],
[
35,
37
],
[
39
],
[
41
],
[
43,
45
],
[
47
],
[
49
],
[
51,
53
],
[
57
],
[
59
],
[
61,
63
],
[
65
],
[
67,
69
],
[
71
],
[
73,
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
]
]
|
14,915 | bool virtio_disk_is_eckd(void)
{
if (guessed_disk_nature) {
return (blk_cfg.blk_size == 4096);
}
return (blk_cfg.geometry.heads == 15)
&& (blk_cfg.geometry.sectors == 12)
&& (blk_cfg.blk_size == 4096);
}
| false | qemu | 92cb05574b7bd489be81f9c58497dc7dfe5d8859 | bool virtio_disk_is_eckd(void)
{
if (guessed_disk_nature) {
return (blk_cfg.blk_size == 4096);
}
return (blk_cfg.geometry.heads == 15)
&& (blk_cfg.geometry.sectors == 12)
&& (blk_cfg.blk_size == 4096);
}
| {
"code": [],
"line_no": []
} | bool FUNC_0(void)
{
if (guessed_disk_nature) {
return (blk_cfg.blk_size == 4096);
}
return (blk_cfg.geometry.heads == 15)
&& (blk_cfg.geometry.sectors == 12)
&& (blk_cfg.blk_size == 4096);
}
| [
"bool FUNC_0(void)\n{",
"if (guessed_disk_nature) {",
"return (blk_cfg.blk_size == 4096);",
"}",
"return (blk_cfg.geometry.heads == 15)\n&& (blk_cfg.geometry.sectors == 12)\n&& (blk_cfg.blk_size == 4096);",
"}"
]
| [
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11,
13,
15
],
[
17
]
]
|
14,916 | static int nbd_send_option_request(QIOChannel *ioc, uint32_t opt,
uint32_t len, const char *data,
Error **errp)
{
nbd_option req;
QEMU_BUILD_BUG_ON(sizeof(req) != 16);
if (len == -1) {
req.length = len = strlen(data);
}
TRACE("Sending option request %" PRIu32", len %" PRIu32, opt, len);
stq_be_p(&req.magic, NBD_OPTS_MAGIC);
stl_be_p(&req.option, opt);
stl_be_p(&req.length, len);
if (write_sync(ioc, &req, sizeof(req), errp) < 0) {
error_prepend(errp, "Failed to send option request header");
return -1;
}
if (len && write_sync(ioc, (char *) data, len, errp) < 0) {
error_prepend(errp, "Failed to send option request data");
return -1;
}
return 0;
}
| false | qemu | d1fdf257d52822695f5ace6c586e059aa17d4b79 | static int nbd_send_option_request(QIOChannel *ioc, uint32_t opt,
uint32_t len, const char *data,
Error **errp)
{
nbd_option req;
QEMU_BUILD_BUG_ON(sizeof(req) != 16);
if (len == -1) {
req.length = len = strlen(data);
}
TRACE("Sending option request %" PRIu32", len %" PRIu32, opt, len);
stq_be_p(&req.magic, NBD_OPTS_MAGIC);
stl_be_p(&req.option, opt);
stl_be_p(&req.length, len);
if (write_sync(ioc, &req, sizeof(req), errp) < 0) {
error_prepend(errp, "Failed to send option request header");
return -1;
}
if (len && write_sync(ioc, (char *) data, len, errp) < 0) {
error_prepend(errp, "Failed to send option request data");
return -1;
}
return 0;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(QIOChannel *VAR_0, uint32_t VAR_1,
uint32_t VAR_2, const char *VAR_3,
Error **VAR_4)
{
nbd_option req;
QEMU_BUILD_BUG_ON(sizeof(req) != 16);
if (VAR_2 == -1) {
req.length = VAR_2 = strlen(VAR_3);
}
TRACE("Sending option request %" PRIu32", VAR_2 %" PRIu32, VAR_1, VAR_2);
stq_be_p(&req.magic, NBD_OPTS_MAGIC);
stl_be_p(&req.option, VAR_1);
stl_be_p(&req.length, VAR_2);
if (write_sync(VAR_0, &req, sizeof(req), VAR_4) < 0) {
error_prepend(VAR_4, "Failed to send option request header");
return -1;
}
if (VAR_2 && write_sync(VAR_0, (char *) VAR_3, VAR_2, VAR_4) < 0) {
error_prepend(VAR_4, "Failed to send option request VAR_3");
return -1;
}
return 0;
}
| [
"static int FUNC_0(QIOChannel *VAR_0, uint32_t VAR_1,\nuint32_t VAR_2, const char *VAR_3,\nError **VAR_4)\n{",
"nbd_option req;",
"QEMU_BUILD_BUG_ON(sizeof(req) != 16);",
"if (VAR_2 == -1) {",
"req.length = VAR_2 = strlen(VAR_3);",
"}",
"TRACE(\"Sending option request %\" PRIu32\", VAR_2 %\" PRIu32, VAR_1, VAR_2);",
"stq_be_p(&req.magic, NBD_OPTS_MAGIC);",
"stl_be_p(&req.option, VAR_1);",
"stl_be_p(&req.length, VAR_2);",
"if (write_sync(VAR_0, &req, sizeof(req), VAR_4) < 0) {",
"error_prepend(VAR_4, \"Failed to send option request header\");",
"return -1;",
"}",
"if (VAR_2 && write_sync(VAR_0, (char *) VAR_3, VAR_2, VAR_4) < 0) {",
"error_prepend(VAR_4, \"Failed to send option request VAR_3\");",
"return -1;",
"}",
"return 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
],
[
43
],
[
45
],
[
47
],
[
49
],
[
53
],
[
55
]
]
|
14,917 | static void rtas_ibm_write_pci_config(sPAPREnvironment *spapr,
uint32_t token, uint32_t nargs,
target_ulong args,
uint32_t nret, target_ulong rets)
{
uint32_t val, size, addr;
uint64_t buid = ((uint64_t)rtas_ld(args, 1) << 32) | rtas_ld(args, 2);
PCIDevice *dev = find_dev(spapr, buid, rtas_ld(args, 0));
if (!dev) {
rtas_st(rets, 0, -1);
return;
}
val = rtas_ld(args, 4);
size = rtas_ld(args, 3);
addr = rtas_pci_cfgaddr(rtas_ld(args, 0));
pci_host_config_write_common(dev, addr, pci_config_size(dev), val, size);
rtas_st(rets, 0, 0);
}
| false | qemu | 88045ac55592cacc92567aa46cb6917854bf7241 | static void rtas_ibm_write_pci_config(sPAPREnvironment *spapr,
uint32_t token, uint32_t nargs,
target_ulong args,
uint32_t nret, target_ulong rets)
{
uint32_t val, size, addr;
uint64_t buid = ((uint64_t)rtas_ld(args, 1) << 32) | rtas_ld(args, 2);
PCIDevice *dev = find_dev(spapr, buid, rtas_ld(args, 0));
if (!dev) {
rtas_st(rets, 0, -1);
return;
}
val = rtas_ld(args, 4);
size = rtas_ld(args, 3);
addr = rtas_pci_cfgaddr(rtas_ld(args, 0));
pci_host_config_write_common(dev, addr, pci_config_size(dev), val, size);
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)
{
uint32_t val, size, addr;
uint64_t buid = ((uint64_t)rtas_ld(VAR_3, 1) << 32) | rtas_ld(VAR_3, 2);
PCIDevice *dev = find_dev(VAR_0, buid, rtas_ld(VAR_3, 0));
if (!dev) {
rtas_st(VAR_5, 0, -1);
return;
}
val = rtas_ld(VAR_3, 4);
size = rtas_ld(VAR_3, 3);
addr = rtas_pci_cfgaddr(rtas_ld(VAR_3, 0));
pci_host_config_write_common(dev, addr, pci_config_size(dev), val, size);
rtas_st(VAR_5, 0, 0);
}
| [
"static void FUNC_0(sPAPREnvironment *VAR_0,\nuint32_t VAR_1, uint32_t VAR_2,\ntarget_ulong VAR_3,\nuint32_t VAR_4, target_ulong VAR_5)\n{",
"uint32_t val, size, addr;",
"uint64_t buid = ((uint64_t)rtas_ld(VAR_3, 1) << 32) | rtas_ld(VAR_3, 2);",
"PCIDevice *dev = find_dev(VAR_0, buid, rtas_ld(VAR_3, 0));",
"if (!dev) {",
"rtas_st(VAR_5, 0, -1);",
"return;",
"}",
"val = rtas_ld(VAR_3, 4);",
"size = rtas_ld(VAR_3, 3);",
"addr = rtas_pci_cfgaddr(rtas_ld(VAR_3, 0));",
"pci_host_config_write_common(dev, addr, pci_config_size(dev), val, size);",
"rtas_st(VAR_5, 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
]
]
|
14,919 | static void *show_parts(void *arg)
{
char *device = arg;
int nbd;
/* linux just needs an open() to trigger
* the partition table update
* but remember to load the module with max_part != 0 :
* modprobe nbd max_part=63
*/
nbd = open(device, O_RDWR);
if (nbd != -1) {
close(nbd);
}
return NULL;
}
| false | qemu | fc19f8a02e45c4d8ad24dd7eb374330b03dfc28e | static void *show_parts(void *arg)
{
char *device = arg;
int nbd;
nbd = open(device, O_RDWR);
if (nbd != -1) {
close(nbd);
}
return NULL;
}
| {
"code": [],
"line_no": []
} | static void *FUNC_0(void *VAR_0)
{
char *VAR_1 = VAR_0;
int VAR_2;
VAR_2 = open(VAR_1, O_RDWR);
if (VAR_2 != -1) {
close(VAR_2);
}
return NULL;
}
| [
"static void *FUNC_0(void *VAR_0)\n{",
"char *VAR_1 = VAR_0;",
"int VAR_2;",
"VAR_2 = open(VAR_1, O_RDWR);",
"if (VAR_2 != -1) {",
"close(VAR_2);",
"}",
"return NULL;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
]
]
|
14,920 | static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr,
TCGArg *args, TCGOpDef *tcg_op_defs)
{
int i, nb_ops, op_index, nb_temps, nb_globals, nb_call_args;
TCGOpcode op;
const TCGOpDef *def;
TCGArg *gen_args;
TCGArg tmp;
TCGCond cond;
/* Array VALS has an element for each temp.
If this temp holds a constant then its value is kept in VALS' element.
If this temp is a copy of other ones then this equivalence class'
representative is kept in VALS' element.
If this temp is neither copy nor constant then corresponding VALS'
element is unused. */
nb_temps = s->nb_temps;
nb_globals = s->nb_globals;
memset(temps, 0, nb_temps * sizeof(struct tcg_temp_info));
nb_ops = tcg_opc_ptr - gen_opc_buf;
gen_args = args;
for (op_index = 0; op_index < nb_ops; op_index++) {
op = gen_opc_buf[op_index];
def = &tcg_op_defs[op];
/* Do copy propagation */
if (!(def->flags & (TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS))) {
assert(op != INDEX_op_call);
for (i = def->nb_oargs; i < def->nb_oargs + def->nb_iargs; i++) {
if (temps[args[i]].state == TCG_TEMP_COPY) {
args[i] = temps[args[i]].val;
}
}
}
/* For commutative operations make constant second argument */
switch (op) {
CASE_OP_32_64(add):
CASE_OP_32_64(mul):
CASE_OP_32_64(and):
CASE_OP_32_64(or):
CASE_OP_32_64(xor):
CASE_OP_32_64(eqv):
CASE_OP_32_64(nand):
CASE_OP_32_64(nor):
if (temps[args[1]].state == TCG_TEMP_CONST) {
tmp = args[1];
args[1] = args[2];
args[2] = tmp;
}
break;
CASE_OP_32_64(brcond):
if (temps[args[0]].state == TCG_TEMP_CONST
&& temps[args[1]].state != TCG_TEMP_CONST) {
tmp = args[0];
args[0] = args[1];
args[1] = tmp;
args[2] = tcg_swap_cond(args[2]);
}
break;
CASE_OP_32_64(setcond):
if (temps[args[1]].state == TCG_TEMP_CONST
&& temps[args[2]].state != TCG_TEMP_CONST) {
tmp = args[1];
args[1] = args[2];
args[2] = tmp;
args[3] = tcg_swap_cond(args[3]);
}
break;
CASE_OP_32_64(movcond):
cond = args[5];
if (temps[args[1]].state == TCG_TEMP_CONST
&& temps[args[2]].state != TCG_TEMP_CONST) {
tmp = args[1];
args[1] = args[2];
args[2] = tmp;
cond = tcg_swap_cond(cond);
}
/* For movcond, we canonicalize the "false" input reg to match
the destination reg so that the tcg backend can implement
a "move if true" operation. */
if (args[0] == args[3]) {
tmp = args[3];
args[3] = args[4];
args[4] = tmp;
cond = tcg_invert_cond(cond);
}
args[5] = cond;
default:
break;
}
/* Simplify expressions for "shift/rot r, 0, a => movi r, 0" */
switch (op) {
CASE_OP_32_64(shl):
CASE_OP_32_64(shr):
CASE_OP_32_64(sar):
CASE_OP_32_64(rotl):
CASE_OP_32_64(rotr):
if (temps[args[1]].state == TCG_TEMP_CONST
&& temps[args[1]].val == 0) {
gen_opc_buf[op_index] = op_to_movi(op);
tcg_opt_gen_movi(gen_args, args[0], 0, nb_temps, nb_globals);
args += 3;
gen_args += 2;
continue;
}
break;
default:
break;
}
/* Simplify expression for "op r, a, 0 => mov r, a" cases */
switch (op) {
CASE_OP_32_64(add):
CASE_OP_32_64(sub):
CASE_OP_32_64(shl):
CASE_OP_32_64(shr):
CASE_OP_32_64(sar):
CASE_OP_32_64(rotl):
CASE_OP_32_64(rotr):
CASE_OP_32_64(or):
CASE_OP_32_64(xor):
if (temps[args[1]].state == TCG_TEMP_CONST) {
/* Proceed with possible constant folding. */
break;
}
if (temps[args[2]].state == TCG_TEMP_CONST
&& temps[args[2]].val == 0) {
if ((temps[args[0]].state == TCG_TEMP_COPY
&& temps[args[0]].val == args[1])
|| args[0] == args[1]) {
gen_opc_buf[op_index] = INDEX_op_nop;
} else {
gen_opc_buf[op_index] = op_to_mov(op);
tcg_opt_gen_mov(gen_args, args[0], args[1],
nb_temps, nb_globals);
gen_args += 2;
}
args += 3;
continue;
}
break;
default:
break;
}
/* Simplify expression for "op r, a, 0 => movi r, 0" cases */
switch (op) {
CASE_OP_32_64(and):
CASE_OP_32_64(mul):
if ((temps[args[2]].state == TCG_TEMP_CONST
&& temps[args[2]].val == 0)) {
gen_opc_buf[op_index] = op_to_movi(op);
tcg_opt_gen_movi(gen_args, args[0], 0, nb_temps, nb_globals);
args += 3;
gen_args += 2;
continue;
}
break;
default:
break;
}
/* Simplify expression for "op r, a, a => mov r, a" cases */
switch (op) {
CASE_OP_32_64(or):
CASE_OP_32_64(and):
if (args[1] == args[2]) {
if (args[1] == args[0]) {
gen_opc_buf[op_index] = INDEX_op_nop;
} else {
gen_opc_buf[op_index] = op_to_mov(op);
tcg_opt_gen_mov(gen_args, args[0], args[1], nb_temps,
nb_globals);
gen_args += 2;
}
args += 3;
continue;
}
break;
default:
break;
}
/* Propagate constants through copy operations and do constant
folding. Constants will be substituted to arguments by register
allocator where needed and possible. Also detect copies. */
switch (op) {
CASE_OP_32_64(mov):
if ((temps[args[1]].state == TCG_TEMP_COPY
&& temps[args[1]].val == args[0])
|| args[0] == args[1]) {
args += 2;
gen_opc_buf[op_index] = INDEX_op_nop;
break;
}
if (temps[args[1]].state != TCG_TEMP_CONST) {
tcg_opt_gen_mov(gen_args, args[0], args[1],
nb_temps, nb_globals);
gen_args += 2;
args += 2;
break;
}
/* Source argument is constant. Rewrite the operation and
let movi case handle it. */
op = op_to_movi(op);
gen_opc_buf[op_index] = op;
args[1] = temps[args[1]].val;
/* fallthrough */
CASE_OP_32_64(movi):
tcg_opt_gen_movi(gen_args, args[0], args[1], nb_temps, nb_globals);
gen_args += 2;
args += 2;
break;
CASE_OP_32_64(not):
CASE_OP_32_64(neg):
CASE_OP_32_64(ext8s):
CASE_OP_32_64(ext8u):
CASE_OP_32_64(ext16s):
CASE_OP_32_64(ext16u):
case INDEX_op_ext32s_i64:
case INDEX_op_ext32u_i64:
if (temps[args[1]].state == TCG_TEMP_CONST) {
gen_opc_buf[op_index] = op_to_movi(op);
tmp = do_constant_folding(op, temps[args[1]].val, 0);
tcg_opt_gen_movi(gen_args, args[0], tmp, nb_temps, nb_globals);
} else {
reset_temp(args[0], nb_temps, nb_globals);
gen_args[0] = args[0];
gen_args[1] = args[1];
}
gen_args += 2;
args += 2;
break;
CASE_OP_32_64(add):
CASE_OP_32_64(sub):
CASE_OP_32_64(mul):
CASE_OP_32_64(or):
CASE_OP_32_64(and):
CASE_OP_32_64(xor):
CASE_OP_32_64(shl):
CASE_OP_32_64(shr):
CASE_OP_32_64(sar):
CASE_OP_32_64(rotl):
CASE_OP_32_64(rotr):
CASE_OP_32_64(andc):
CASE_OP_32_64(orc):
CASE_OP_32_64(eqv):
CASE_OP_32_64(nand):
CASE_OP_32_64(nor):
if (temps[args[1]].state == TCG_TEMP_CONST
&& temps[args[2]].state == TCG_TEMP_CONST) {
gen_opc_buf[op_index] = op_to_movi(op);
tmp = do_constant_folding(op, temps[args[1]].val,
temps[args[2]].val);
tcg_opt_gen_movi(gen_args, args[0], tmp, nb_temps, nb_globals);
gen_args += 2;
} else {
reset_temp(args[0], nb_temps, nb_globals);
gen_args[0] = args[0];
gen_args[1] = args[1];
gen_args[2] = args[2];
gen_args += 3;
}
args += 3;
break;
CASE_OP_32_64(setcond):
if (temps[args[1]].state == TCG_TEMP_CONST
&& temps[args[2]].state == TCG_TEMP_CONST) {
gen_opc_buf[op_index] = op_to_movi(op);
tmp = do_constant_folding_cond(op, temps[args[1]].val,
temps[args[2]].val, args[3]);
tcg_opt_gen_movi(gen_args, args[0], tmp, nb_temps, nb_globals);
gen_args += 2;
} else {
reset_temp(args[0], nb_temps, nb_globals);
gen_args[0] = args[0];
gen_args[1] = args[1];
gen_args[2] = args[2];
gen_args[3] = args[3];
gen_args += 4;
}
args += 4;
break;
CASE_OP_32_64(brcond):
if (temps[args[0]].state == TCG_TEMP_CONST
&& temps[args[1]].state == TCG_TEMP_CONST) {
if (do_constant_folding_cond(op, temps[args[0]].val,
temps[args[1]].val, args[2])) {
memset(temps, 0, nb_temps * sizeof(struct tcg_temp_info));
gen_opc_buf[op_index] = INDEX_op_br;
gen_args[0] = args[3];
gen_args += 1;
} else {
gen_opc_buf[op_index] = INDEX_op_nop;
}
} else {
memset(temps, 0, nb_temps * sizeof(struct tcg_temp_info));
reset_temp(args[0], nb_temps, nb_globals);
gen_args[0] = args[0];
gen_args[1] = args[1];
gen_args[2] = args[2];
gen_args[3] = args[3];
gen_args += 4;
}
args += 4;
break;
CASE_OP_32_64(movcond):
if (temps[args[1]].state == TCG_TEMP_CONST
&& temps[args[2]].state == TCG_TEMP_CONST) {
tmp = do_constant_folding_cond(op, temps[args[1]].val,
temps[args[2]].val, args[5]);
if (args[0] == args[4-tmp]
|| (temps[args[4-tmp]].state == TCG_TEMP_COPY
&& temps[args[4-tmp]].val == args[0])) {
gen_opc_buf[op_index] = INDEX_op_nop;
} else if (temps[args[4-tmp]].state == TCG_TEMP_CONST) {
gen_opc_buf[op_index] = op_to_movi(op);
tcg_opt_gen_movi(gen_args, args[0], temps[args[4-tmp]].val,
nb_temps, nb_globals);
gen_args += 2;
} else {
gen_opc_buf[op_index] = op_to_mov(op);
tcg_opt_gen_mov(gen_args, args[0], args[4-tmp],
nb_temps, nb_globals);
gen_args += 2;
}
} else {
reset_temp(args[0], nb_temps, nb_globals);
gen_args[0] = args[0];
gen_args[1] = args[1];
gen_args[2] = args[2];
gen_args[3] = args[3];
gen_args[4] = args[4];
gen_args[5] = args[5];
gen_args += 6;
}
args += 6;
break;
case INDEX_op_call:
nb_call_args = (args[0] >> 16) + (args[0] & 0xffff);
if (!(args[nb_call_args + 1] & (TCG_CALL_CONST | TCG_CALL_PURE))) {
for (i = 0; i < nb_globals; i++) {
reset_temp(i, nb_temps, nb_globals);
}
}
for (i = 0; i < (args[0] >> 16); i++) {
reset_temp(args[i + 1], nb_temps, nb_globals);
}
i = nb_call_args + 3;
while (i) {
*gen_args = *args;
args++;
gen_args++;
i--;
}
break;
default:
/* Default case: we do know nothing about operation so no
propagation is done. We trash everything if the operation
is the end of a basic block, otherwise we only trash the
output args. */
if (def->flags & TCG_OPF_BB_END) {
memset(temps, 0, nb_temps * sizeof(struct tcg_temp_info));
} else {
for (i = 0; i < def->nb_oargs; i++) {
reset_temp(args[i], nb_temps, nb_globals);
}
}
for (i = 0; i < def->nb_args; i++) {
gen_args[i] = args[i];
}
args += def->nb_args;
gen_args += def->nb_args;
break;
}
}
return gen_args;
}
| false | qemu | b80bb016d8c8e9d74345a90ab6dac1cb547904e0 | static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr,
TCGArg *args, TCGOpDef *tcg_op_defs)
{
int i, nb_ops, op_index, nb_temps, nb_globals, nb_call_args;
TCGOpcode op;
const TCGOpDef *def;
TCGArg *gen_args;
TCGArg tmp;
TCGCond cond;
nb_temps = s->nb_temps;
nb_globals = s->nb_globals;
memset(temps, 0, nb_temps * sizeof(struct tcg_temp_info));
nb_ops = tcg_opc_ptr - gen_opc_buf;
gen_args = args;
for (op_index = 0; op_index < nb_ops; op_index++) {
op = gen_opc_buf[op_index];
def = &tcg_op_defs[op];
if (!(def->flags & (TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS))) {
assert(op != INDEX_op_call);
for (i = def->nb_oargs; i < def->nb_oargs + def->nb_iargs; i++) {
if (temps[args[i]].state == TCG_TEMP_COPY) {
args[i] = temps[args[i]].val;
}
}
}
switch (op) {
CASE_OP_32_64(add):
CASE_OP_32_64(mul):
CASE_OP_32_64(and):
CASE_OP_32_64(or):
CASE_OP_32_64(xor):
CASE_OP_32_64(eqv):
CASE_OP_32_64(nand):
CASE_OP_32_64(nor):
if (temps[args[1]].state == TCG_TEMP_CONST) {
tmp = args[1];
args[1] = args[2];
args[2] = tmp;
}
break;
CASE_OP_32_64(brcond):
if (temps[args[0]].state == TCG_TEMP_CONST
&& temps[args[1]].state != TCG_TEMP_CONST) {
tmp = args[0];
args[0] = args[1];
args[1] = tmp;
args[2] = tcg_swap_cond(args[2]);
}
break;
CASE_OP_32_64(setcond):
if (temps[args[1]].state == TCG_TEMP_CONST
&& temps[args[2]].state != TCG_TEMP_CONST) {
tmp = args[1];
args[1] = args[2];
args[2] = tmp;
args[3] = tcg_swap_cond(args[3]);
}
break;
CASE_OP_32_64(movcond):
cond = args[5];
if (temps[args[1]].state == TCG_TEMP_CONST
&& temps[args[2]].state != TCG_TEMP_CONST) {
tmp = args[1];
args[1] = args[2];
args[2] = tmp;
cond = tcg_swap_cond(cond);
}
if (args[0] == args[3]) {
tmp = args[3];
args[3] = args[4];
args[4] = tmp;
cond = tcg_invert_cond(cond);
}
args[5] = cond;
default:
break;
}
switch (op) {
CASE_OP_32_64(shl):
CASE_OP_32_64(shr):
CASE_OP_32_64(sar):
CASE_OP_32_64(rotl):
CASE_OP_32_64(rotr):
if (temps[args[1]].state == TCG_TEMP_CONST
&& temps[args[1]].val == 0) {
gen_opc_buf[op_index] = op_to_movi(op);
tcg_opt_gen_movi(gen_args, args[0], 0, nb_temps, nb_globals);
args += 3;
gen_args += 2;
continue;
}
break;
default:
break;
}
switch (op) {
CASE_OP_32_64(add):
CASE_OP_32_64(sub):
CASE_OP_32_64(shl):
CASE_OP_32_64(shr):
CASE_OP_32_64(sar):
CASE_OP_32_64(rotl):
CASE_OP_32_64(rotr):
CASE_OP_32_64(or):
CASE_OP_32_64(xor):
if (temps[args[1]].state == TCG_TEMP_CONST) {
break;
}
if (temps[args[2]].state == TCG_TEMP_CONST
&& temps[args[2]].val == 0) {
if ((temps[args[0]].state == TCG_TEMP_COPY
&& temps[args[0]].val == args[1])
|| args[0] == args[1]) {
gen_opc_buf[op_index] = INDEX_op_nop;
} else {
gen_opc_buf[op_index] = op_to_mov(op);
tcg_opt_gen_mov(gen_args, args[0], args[1],
nb_temps, nb_globals);
gen_args += 2;
}
args += 3;
continue;
}
break;
default:
break;
}
switch (op) {
CASE_OP_32_64(and):
CASE_OP_32_64(mul):
if ((temps[args[2]].state == TCG_TEMP_CONST
&& temps[args[2]].val == 0)) {
gen_opc_buf[op_index] = op_to_movi(op);
tcg_opt_gen_movi(gen_args, args[0], 0, nb_temps, nb_globals);
args += 3;
gen_args += 2;
continue;
}
break;
default:
break;
}
switch (op) {
CASE_OP_32_64(or):
CASE_OP_32_64(and):
if (args[1] == args[2]) {
if (args[1] == args[0]) {
gen_opc_buf[op_index] = INDEX_op_nop;
} else {
gen_opc_buf[op_index] = op_to_mov(op);
tcg_opt_gen_mov(gen_args, args[0], args[1], nb_temps,
nb_globals);
gen_args += 2;
}
args += 3;
continue;
}
break;
default:
break;
}
switch (op) {
CASE_OP_32_64(mov):
if ((temps[args[1]].state == TCG_TEMP_COPY
&& temps[args[1]].val == args[0])
|| args[0] == args[1]) {
args += 2;
gen_opc_buf[op_index] = INDEX_op_nop;
break;
}
if (temps[args[1]].state != TCG_TEMP_CONST) {
tcg_opt_gen_mov(gen_args, args[0], args[1],
nb_temps, nb_globals);
gen_args += 2;
args += 2;
break;
}
op = op_to_movi(op);
gen_opc_buf[op_index] = op;
args[1] = temps[args[1]].val;
CASE_OP_32_64(movi):
tcg_opt_gen_movi(gen_args, args[0], args[1], nb_temps, nb_globals);
gen_args += 2;
args += 2;
break;
CASE_OP_32_64(not):
CASE_OP_32_64(neg):
CASE_OP_32_64(ext8s):
CASE_OP_32_64(ext8u):
CASE_OP_32_64(ext16s):
CASE_OP_32_64(ext16u):
case INDEX_op_ext32s_i64:
case INDEX_op_ext32u_i64:
if (temps[args[1]].state == TCG_TEMP_CONST) {
gen_opc_buf[op_index] = op_to_movi(op);
tmp = do_constant_folding(op, temps[args[1]].val, 0);
tcg_opt_gen_movi(gen_args, args[0], tmp, nb_temps, nb_globals);
} else {
reset_temp(args[0], nb_temps, nb_globals);
gen_args[0] = args[0];
gen_args[1] = args[1];
}
gen_args += 2;
args += 2;
break;
CASE_OP_32_64(add):
CASE_OP_32_64(sub):
CASE_OP_32_64(mul):
CASE_OP_32_64(or):
CASE_OP_32_64(and):
CASE_OP_32_64(xor):
CASE_OP_32_64(shl):
CASE_OP_32_64(shr):
CASE_OP_32_64(sar):
CASE_OP_32_64(rotl):
CASE_OP_32_64(rotr):
CASE_OP_32_64(andc):
CASE_OP_32_64(orc):
CASE_OP_32_64(eqv):
CASE_OP_32_64(nand):
CASE_OP_32_64(nor):
if (temps[args[1]].state == TCG_TEMP_CONST
&& temps[args[2]].state == TCG_TEMP_CONST) {
gen_opc_buf[op_index] = op_to_movi(op);
tmp = do_constant_folding(op, temps[args[1]].val,
temps[args[2]].val);
tcg_opt_gen_movi(gen_args, args[0], tmp, nb_temps, nb_globals);
gen_args += 2;
} else {
reset_temp(args[0], nb_temps, nb_globals);
gen_args[0] = args[0];
gen_args[1] = args[1];
gen_args[2] = args[2];
gen_args += 3;
}
args += 3;
break;
CASE_OP_32_64(setcond):
if (temps[args[1]].state == TCG_TEMP_CONST
&& temps[args[2]].state == TCG_TEMP_CONST) {
gen_opc_buf[op_index] = op_to_movi(op);
tmp = do_constant_folding_cond(op, temps[args[1]].val,
temps[args[2]].val, args[3]);
tcg_opt_gen_movi(gen_args, args[0], tmp, nb_temps, nb_globals);
gen_args += 2;
} else {
reset_temp(args[0], nb_temps, nb_globals);
gen_args[0] = args[0];
gen_args[1] = args[1];
gen_args[2] = args[2];
gen_args[3] = args[3];
gen_args += 4;
}
args += 4;
break;
CASE_OP_32_64(brcond):
if (temps[args[0]].state == TCG_TEMP_CONST
&& temps[args[1]].state == TCG_TEMP_CONST) {
if (do_constant_folding_cond(op, temps[args[0]].val,
temps[args[1]].val, args[2])) {
memset(temps, 0, nb_temps * sizeof(struct tcg_temp_info));
gen_opc_buf[op_index] = INDEX_op_br;
gen_args[0] = args[3];
gen_args += 1;
} else {
gen_opc_buf[op_index] = INDEX_op_nop;
}
} else {
memset(temps, 0, nb_temps * sizeof(struct tcg_temp_info));
reset_temp(args[0], nb_temps, nb_globals);
gen_args[0] = args[0];
gen_args[1] = args[1];
gen_args[2] = args[2];
gen_args[3] = args[3];
gen_args += 4;
}
args += 4;
break;
CASE_OP_32_64(movcond):
if (temps[args[1]].state == TCG_TEMP_CONST
&& temps[args[2]].state == TCG_TEMP_CONST) {
tmp = do_constant_folding_cond(op, temps[args[1]].val,
temps[args[2]].val, args[5]);
if (args[0] == args[4-tmp]
|| (temps[args[4-tmp]].state == TCG_TEMP_COPY
&& temps[args[4-tmp]].val == args[0])) {
gen_opc_buf[op_index] = INDEX_op_nop;
} else if (temps[args[4-tmp]].state == TCG_TEMP_CONST) {
gen_opc_buf[op_index] = op_to_movi(op);
tcg_opt_gen_movi(gen_args, args[0], temps[args[4-tmp]].val,
nb_temps, nb_globals);
gen_args += 2;
} else {
gen_opc_buf[op_index] = op_to_mov(op);
tcg_opt_gen_mov(gen_args, args[0], args[4-tmp],
nb_temps, nb_globals);
gen_args += 2;
}
} else {
reset_temp(args[0], nb_temps, nb_globals);
gen_args[0] = args[0];
gen_args[1] = args[1];
gen_args[2] = args[2];
gen_args[3] = args[3];
gen_args[4] = args[4];
gen_args[5] = args[5];
gen_args += 6;
}
args += 6;
break;
case INDEX_op_call:
nb_call_args = (args[0] >> 16) + (args[0] & 0xffff);
if (!(args[nb_call_args + 1] & (TCG_CALL_CONST | TCG_CALL_PURE))) {
for (i = 0; i < nb_globals; i++) {
reset_temp(i, nb_temps, nb_globals);
}
}
for (i = 0; i < (args[0] >> 16); i++) {
reset_temp(args[i + 1], nb_temps, nb_globals);
}
i = nb_call_args + 3;
while (i) {
*gen_args = *args;
args++;
gen_args++;
i--;
}
break;
default:
if (def->flags & TCG_OPF_BB_END) {
memset(temps, 0, nb_temps * sizeof(struct tcg_temp_info));
} else {
for (i = 0; i < def->nb_oargs; i++) {
reset_temp(args[i], nb_temps, nb_globals);
}
}
for (i = 0; i < def->nb_args; i++) {
gen_args[i] = args[i];
}
args += def->nb_args;
gen_args += def->nb_args;
break;
}
}
return gen_args;
}
| {
"code": [],
"line_no": []
} | static TCGArg *FUNC_0(TCGContext *s, uint16_t *tcg_opc_ptr,
TCGArg *args, TCGOpDef *tcg_op_defs)
{
int VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5;
TCGOpcode op;
const TCGOpDef *VAR_6;
TCGArg *gen_args;
TCGArg tmp;
TCGCond cond;
VAR_3 = s->VAR_3;
VAR_4 = s->VAR_4;
memset(temps, 0, VAR_3 * sizeof(struct tcg_temp_info));
VAR_1 = tcg_opc_ptr - gen_opc_buf;
gen_args = args;
for (VAR_2 = 0; VAR_2 < VAR_1; VAR_2++) {
op = gen_opc_buf[VAR_2];
VAR_6 = &tcg_op_defs[op];
if (!(VAR_6->flags & (TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS))) {
assert(op != INDEX_op_call);
for (VAR_0 = VAR_6->nb_oargs; VAR_0 < VAR_6->nb_oargs + VAR_6->nb_iargs; VAR_0++) {
if (temps[args[VAR_0]].state == TCG_TEMP_COPY) {
args[VAR_0] = temps[args[VAR_0]].val;
}
}
}
switch (op) {
CASE_OP_32_64(add):
CASE_OP_32_64(mul):
CASE_OP_32_64(and):
CASE_OP_32_64(or):
CASE_OP_32_64(xor):
CASE_OP_32_64(eqv):
CASE_OP_32_64(nand):
CASE_OP_32_64(nor):
if (temps[args[1]].state == TCG_TEMP_CONST) {
tmp = args[1];
args[1] = args[2];
args[2] = tmp;
}
break;
CASE_OP_32_64(brcond):
if (temps[args[0]].state == TCG_TEMP_CONST
&& temps[args[1]].state != TCG_TEMP_CONST) {
tmp = args[0];
args[0] = args[1];
args[1] = tmp;
args[2] = tcg_swap_cond(args[2]);
}
break;
CASE_OP_32_64(setcond):
if (temps[args[1]].state == TCG_TEMP_CONST
&& temps[args[2]].state != TCG_TEMP_CONST) {
tmp = args[1];
args[1] = args[2];
args[2] = tmp;
args[3] = tcg_swap_cond(args[3]);
}
break;
CASE_OP_32_64(movcond):
cond = args[5];
if (temps[args[1]].state == TCG_TEMP_CONST
&& temps[args[2]].state != TCG_TEMP_CONST) {
tmp = args[1];
args[1] = args[2];
args[2] = tmp;
cond = tcg_swap_cond(cond);
}
if (args[0] == args[3]) {
tmp = args[3];
args[3] = args[4];
args[4] = tmp;
cond = tcg_invert_cond(cond);
}
args[5] = cond;
default:
break;
}
switch (op) {
CASE_OP_32_64(shl):
CASE_OP_32_64(shr):
CASE_OP_32_64(sar):
CASE_OP_32_64(rotl):
CASE_OP_32_64(rotr):
if (temps[args[1]].state == TCG_TEMP_CONST
&& temps[args[1]].val == 0) {
gen_opc_buf[VAR_2] = op_to_movi(op);
tcg_opt_gen_movi(gen_args, args[0], 0, VAR_3, VAR_4);
args += 3;
gen_args += 2;
continue;
}
break;
default:
break;
}
switch (op) {
CASE_OP_32_64(add):
CASE_OP_32_64(sub):
CASE_OP_32_64(shl):
CASE_OP_32_64(shr):
CASE_OP_32_64(sar):
CASE_OP_32_64(rotl):
CASE_OP_32_64(rotr):
CASE_OP_32_64(or):
CASE_OP_32_64(xor):
if (temps[args[1]].state == TCG_TEMP_CONST) {
break;
}
if (temps[args[2]].state == TCG_TEMP_CONST
&& temps[args[2]].val == 0) {
if ((temps[args[0]].state == TCG_TEMP_COPY
&& temps[args[0]].val == args[1])
|| args[0] == args[1]) {
gen_opc_buf[VAR_2] = INDEX_op_nop;
} else {
gen_opc_buf[VAR_2] = op_to_mov(op);
tcg_opt_gen_mov(gen_args, args[0], args[1],
VAR_3, VAR_4);
gen_args += 2;
}
args += 3;
continue;
}
break;
default:
break;
}
switch (op) {
CASE_OP_32_64(and):
CASE_OP_32_64(mul):
if ((temps[args[2]].state == TCG_TEMP_CONST
&& temps[args[2]].val == 0)) {
gen_opc_buf[VAR_2] = op_to_movi(op);
tcg_opt_gen_movi(gen_args, args[0], 0, VAR_3, VAR_4);
args += 3;
gen_args += 2;
continue;
}
break;
default:
break;
}
switch (op) {
CASE_OP_32_64(or):
CASE_OP_32_64(and):
if (args[1] == args[2]) {
if (args[1] == args[0]) {
gen_opc_buf[VAR_2] = INDEX_op_nop;
} else {
gen_opc_buf[VAR_2] = op_to_mov(op);
tcg_opt_gen_mov(gen_args, args[0], args[1], VAR_3,
VAR_4);
gen_args += 2;
}
args += 3;
continue;
}
break;
default:
break;
}
switch (op) {
CASE_OP_32_64(mov):
if ((temps[args[1]].state == TCG_TEMP_COPY
&& temps[args[1]].val == args[0])
|| args[0] == args[1]) {
args += 2;
gen_opc_buf[VAR_2] = INDEX_op_nop;
break;
}
if (temps[args[1]].state != TCG_TEMP_CONST) {
tcg_opt_gen_mov(gen_args, args[0], args[1],
VAR_3, VAR_4);
gen_args += 2;
args += 2;
break;
}
op = op_to_movi(op);
gen_opc_buf[VAR_2] = op;
args[1] = temps[args[1]].val;
CASE_OP_32_64(movi):
tcg_opt_gen_movi(gen_args, args[0], args[1], VAR_3, VAR_4);
gen_args += 2;
args += 2;
break;
CASE_OP_32_64(not):
CASE_OP_32_64(neg):
CASE_OP_32_64(ext8s):
CASE_OP_32_64(ext8u):
CASE_OP_32_64(ext16s):
CASE_OP_32_64(ext16u):
case INDEX_op_ext32s_i64:
case INDEX_op_ext32u_i64:
if (temps[args[1]].state == TCG_TEMP_CONST) {
gen_opc_buf[VAR_2] = op_to_movi(op);
tmp = do_constant_folding(op, temps[args[1]].val, 0);
tcg_opt_gen_movi(gen_args, args[0], tmp, VAR_3, VAR_4);
} else {
reset_temp(args[0], VAR_3, VAR_4);
gen_args[0] = args[0];
gen_args[1] = args[1];
}
gen_args += 2;
args += 2;
break;
CASE_OP_32_64(add):
CASE_OP_32_64(sub):
CASE_OP_32_64(mul):
CASE_OP_32_64(or):
CASE_OP_32_64(and):
CASE_OP_32_64(xor):
CASE_OP_32_64(shl):
CASE_OP_32_64(shr):
CASE_OP_32_64(sar):
CASE_OP_32_64(rotl):
CASE_OP_32_64(rotr):
CASE_OP_32_64(andc):
CASE_OP_32_64(orc):
CASE_OP_32_64(eqv):
CASE_OP_32_64(nand):
CASE_OP_32_64(nor):
if (temps[args[1]].state == TCG_TEMP_CONST
&& temps[args[2]].state == TCG_TEMP_CONST) {
gen_opc_buf[VAR_2] = op_to_movi(op);
tmp = do_constant_folding(op, temps[args[1]].val,
temps[args[2]].val);
tcg_opt_gen_movi(gen_args, args[0], tmp, VAR_3, VAR_4);
gen_args += 2;
} else {
reset_temp(args[0], VAR_3, VAR_4);
gen_args[0] = args[0];
gen_args[1] = args[1];
gen_args[2] = args[2];
gen_args += 3;
}
args += 3;
break;
CASE_OP_32_64(setcond):
if (temps[args[1]].state == TCG_TEMP_CONST
&& temps[args[2]].state == TCG_TEMP_CONST) {
gen_opc_buf[VAR_2] = op_to_movi(op);
tmp = do_constant_folding_cond(op, temps[args[1]].val,
temps[args[2]].val, args[3]);
tcg_opt_gen_movi(gen_args, args[0], tmp, VAR_3, VAR_4);
gen_args += 2;
} else {
reset_temp(args[0], VAR_3, VAR_4);
gen_args[0] = args[0];
gen_args[1] = args[1];
gen_args[2] = args[2];
gen_args[3] = args[3];
gen_args += 4;
}
args += 4;
break;
CASE_OP_32_64(brcond):
if (temps[args[0]].state == TCG_TEMP_CONST
&& temps[args[1]].state == TCG_TEMP_CONST) {
if (do_constant_folding_cond(op, temps[args[0]].val,
temps[args[1]].val, args[2])) {
memset(temps, 0, VAR_3 * sizeof(struct tcg_temp_info));
gen_opc_buf[VAR_2] = INDEX_op_br;
gen_args[0] = args[3];
gen_args += 1;
} else {
gen_opc_buf[VAR_2] = INDEX_op_nop;
}
} else {
memset(temps, 0, VAR_3 * sizeof(struct tcg_temp_info));
reset_temp(args[0], VAR_3, VAR_4);
gen_args[0] = args[0];
gen_args[1] = args[1];
gen_args[2] = args[2];
gen_args[3] = args[3];
gen_args += 4;
}
args += 4;
break;
CASE_OP_32_64(movcond):
if (temps[args[1]].state == TCG_TEMP_CONST
&& temps[args[2]].state == TCG_TEMP_CONST) {
tmp = do_constant_folding_cond(op, temps[args[1]].val,
temps[args[2]].val, args[5]);
if (args[0] == args[4-tmp]
|| (temps[args[4-tmp]].state == TCG_TEMP_COPY
&& temps[args[4-tmp]].val == args[0])) {
gen_opc_buf[VAR_2] = INDEX_op_nop;
} else if (temps[args[4-tmp]].state == TCG_TEMP_CONST) {
gen_opc_buf[VAR_2] = op_to_movi(op);
tcg_opt_gen_movi(gen_args, args[0], temps[args[4-tmp]].val,
VAR_3, VAR_4);
gen_args += 2;
} else {
gen_opc_buf[VAR_2] = op_to_mov(op);
tcg_opt_gen_mov(gen_args, args[0], args[4-tmp],
VAR_3, VAR_4);
gen_args += 2;
}
} else {
reset_temp(args[0], VAR_3, VAR_4);
gen_args[0] = args[0];
gen_args[1] = args[1];
gen_args[2] = args[2];
gen_args[3] = args[3];
gen_args[4] = args[4];
gen_args[5] = args[5];
gen_args += 6;
}
args += 6;
break;
case INDEX_op_call:
VAR_5 = (args[0] >> 16) + (args[0] & 0xffff);
if (!(args[VAR_5 + 1] & (TCG_CALL_CONST | TCG_CALL_PURE))) {
for (VAR_0 = 0; VAR_0 < VAR_4; VAR_0++) {
reset_temp(VAR_0, VAR_3, VAR_4);
}
}
for (VAR_0 = 0; VAR_0 < (args[0] >> 16); VAR_0++) {
reset_temp(args[VAR_0 + 1], VAR_3, VAR_4);
}
VAR_0 = VAR_5 + 3;
while (VAR_0) {
*gen_args = *args;
args++;
gen_args++;
VAR_0--;
}
break;
default:
if (VAR_6->flags & TCG_OPF_BB_END) {
memset(temps, 0, VAR_3 * sizeof(struct tcg_temp_info));
} else {
for (VAR_0 = 0; VAR_0 < VAR_6->nb_oargs; VAR_0++) {
reset_temp(args[VAR_0], VAR_3, VAR_4);
}
}
for (VAR_0 = 0; VAR_0 < VAR_6->nb_args; VAR_0++) {
gen_args[VAR_0] = args[VAR_0];
}
args += VAR_6->nb_args;
gen_args += VAR_6->nb_args;
break;
}
}
return gen_args;
}
| [
"static TCGArg *FUNC_0(TCGContext *s, uint16_t *tcg_opc_ptr,\nTCGArg *args, TCGOpDef *tcg_op_defs)\n{",
"int VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5;",
"TCGOpcode op;",
"const TCGOpDef *VAR_6;",
"TCGArg *gen_args;",
"TCGArg tmp;",
"TCGCond cond;",
"VAR_3 = s->VAR_3;",
"VAR_4 = s->VAR_4;",
"memset(temps, 0, VAR_3 * sizeof(struct tcg_temp_info));",
"VAR_1 = tcg_opc_ptr - gen_opc_buf;",
"gen_args = args;",
"for (VAR_2 = 0; VAR_2 < VAR_1; VAR_2++) {",
"op = gen_opc_buf[VAR_2];",
"VAR_6 = &tcg_op_defs[op];",
"if (!(VAR_6->flags & (TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS))) {",
"assert(op != INDEX_op_call);",
"for (VAR_0 = VAR_6->nb_oargs; VAR_0 < VAR_6->nb_oargs + VAR_6->nb_iargs; VAR_0++) {",
"if (temps[args[VAR_0]].state == TCG_TEMP_COPY) {",
"args[VAR_0] = temps[args[VAR_0]].val;",
"}",
"}",
"}",
"switch (op) {",
"CASE_OP_32_64(add):\nCASE_OP_32_64(mul):\nCASE_OP_32_64(and):\nCASE_OP_32_64(or):\nCASE_OP_32_64(xor):\nCASE_OP_32_64(eqv):\nCASE_OP_32_64(nand):\nCASE_OP_32_64(nor):\nif (temps[args[1]].state == TCG_TEMP_CONST) {",
"tmp = args[1];",
"args[1] = args[2];",
"args[2] = tmp;",
"}",
"break;",
"CASE_OP_32_64(brcond):\nif (temps[args[0]].state == TCG_TEMP_CONST\n&& temps[args[1]].state != TCG_TEMP_CONST) {",
"tmp = args[0];",
"args[0] = args[1];",
"args[1] = tmp;",
"args[2] = tcg_swap_cond(args[2]);",
"}",
"break;",
"CASE_OP_32_64(setcond):\nif (temps[args[1]].state == TCG_TEMP_CONST\n&& temps[args[2]].state != TCG_TEMP_CONST) {",
"tmp = args[1];",
"args[1] = args[2];",
"args[2] = tmp;",
"args[3] = tcg_swap_cond(args[3]);",
"}",
"break;",
"CASE_OP_32_64(movcond):\ncond = args[5];",
"if (temps[args[1]].state == TCG_TEMP_CONST\n&& temps[args[2]].state != TCG_TEMP_CONST) {",
"tmp = args[1];",
"args[1] = args[2];",
"args[2] = tmp;",
"cond = tcg_swap_cond(cond);",
"}",
"if (args[0] == args[3]) {",
"tmp = args[3];",
"args[3] = args[4];",
"args[4] = tmp;",
"cond = tcg_invert_cond(cond);",
"}",
"args[5] = cond;",
"default:\nbreak;",
"}",
"switch (op) {",
"CASE_OP_32_64(shl):\nCASE_OP_32_64(shr):\nCASE_OP_32_64(sar):\nCASE_OP_32_64(rotl):\nCASE_OP_32_64(rotr):\nif (temps[args[1]].state == TCG_TEMP_CONST\n&& temps[args[1]].val == 0) {",
"gen_opc_buf[VAR_2] = op_to_movi(op);",
"tcg_opt_gen_movi(gen_args, args[0], 0, VAR_3, VAR_4);",
"args += 3;",
"gen_args += 2;",
"continue;",
"}",
"break;",
"default:\nbreak;",
"}",
"switch (op) {",
"CASE_OP_32_64(add):\nCASE_OP_32_64(sub):\nCASE_OP_32_64(shl):\nCASE_OP_32_64(shr):\nCASE_OP_32_64(sar):\nCASE_OP_32_64(rotl):\nCASE_OP_32_64(rotr):\nCASE_OP_32_64(or):\nCASE_OP_32_64(xor):\nif (temps[args[1]].state == TCG_TEMP_CONST) {",
"break;",
"}",
"if (temps[args[2]].state == TCG_TEMP_CONST\n&& temps[args[2]].val == 0) {",
"if ((temps[args[0]].state == TCG_TEMP_COPY\n&& temps[args[0]].val == args[1])\n|| args[0] == args[1]) {",
"gen_opc_buf[VAR_2] = INDEX_op_nop;",
"} else {",
"gen_opc_buf[VAR_2] = op_to_mov(op);",
"tcg_opt_gen_mov(gen_args, args[0], args[1],\nVAR_3, VAR_4);",
"gen_args += 2;",
"}",
"args += 3;",
"continue;",
"}",
"break;",
"default:\nbreak;",
"}",
"switch (op) {",
"CASE_OP_32_64(and):\nCASE_OP_32_64(mul):\nif ((temps[args[2]].state == TCG_TEMP_CONST\n&& temps[args[2]].val == 0)) {",
"gen_opc_buf[VAR_2] = op_to_movi(op);",
"tcg_opt_gen_movi(gen_args, args[0], 0, VAR_3, VAR_4);",
"args += 3;",
"gen_args += 2;",
"continue;",
"}",
"break;",
"default:\nbreak;",
"}",
"switch (op) {",
"CASE_OP_32_64(or):\nCASE_OP_32_64(and):\nif (args[1] == args[2]) {",
"if (args[1] == args[0]) {",
"gen_opc_buf[VAR_2] = INDEX_op_nop;",
"} else {",
"gen_opc_buf[VAR_2] = op_to_mov(op);",
"tcg_opt_gen_mov(gen_args, args[0], args[1], VAR_3,\nVAR_4);",
"gen_args += 2;",
"}",
"args += 3;",
"continue;",
"}",
"break;",
"default:\nbreak;",
"}",
"switch (op) {",
"CASE_OP_32_64(mov):\nif ((temps[args[1]].state == TCG_TEMP_COPY\n&& temps[args[1]].val == args[0])\n|| args[0] == args[1]) {",
"args += 2;",
"gen_opc_buf[VAR_2] = INDEX_op_nop;",
"break;",
"}",
"if (temps[args[1]].state != TCG_TEMP_CONST) {",
"tcg_opt_gen_mov(gen_args, args[0], args[1],\nVAR_3, VAR_4);",
"gen_args += 2;",
"args += 2;",
"break;",
"}",
"op = op_to_movi(op);",
"gen_opc_buf[VAR_2] = op;",
"args[1] = temps[args[1]].val;",
"CASE_OP_32_64(movi):\ntcg_opt_gen_movi(gen_args, args[0], args[1], VAR_3, VAR_4);",
"gen_args += 2;",
"args += 2;",
"break;",
"CASE_OP_32_64(not):\nCASE_OP_32_64(neg):\nCASE_OP_32_64(ext8s):\nCASE_OP_32_64(ext8u):\nCASE_OP_32_64(ext16s):\nCASE_OP_32_64(ext16u):\ncase INDEX_op_ext32s_i64:\ncase INDEX_op_ext32u_i64:\nif (temps[args[1]].state == TCG_TEMP_CONST) {",
"gen_opc_buf[VAR_2] = op_to_movi(op);",
"tmp = do_constant_folding(op, temps[args[1]].val, 0);",
"tcg_opt_gen_movi(gen_args, args[0], tmp, VAR_3, VAR_4);",
"} else {",
"reset_temp(args[0], VAR_3, VAR_4);",
"gen_args[0] = args[0];",
"gen_args[1] = args[1];",
"}",
"gen_args += 2;",
"args += 2;",
"break;",
"CASE_OP_32_64(add):\nCASE_OP_32_64(sub):\nCASE_OP_32_64(mul):\nCASE_OP_32_64(or):\nCASE_OP_32_64(and):\nCASE_OP_32_64(xor):\nCASE_OP_32_64(shl):\nCASE_OP_32_64(shr):\nCASE_OP_32_64(sar):\nCASE_OP_32_64(rotl):\nCASE_OP_32_64(rotr):\nCASE_OP_32_64(andc):\nCASE_OP_32_64(orc):\nCASE_OP_32_64(eqv):\nCASE_OP_32_64(nand):\nCASE_OP_32_64(nor):\nif (temps[args[1]].state == TCG_TEMP_CONST\n&& temps[args[2]].state == TCG_TEMP_CONST) {",
"gen_opc_buf[VAR_2] = op_to_movi(op);",
"tmp = do_constant_folding(op, temps[args[1]].val,\ntemps[args[2]].val);",
"tcg_opt_gen_movi(gen_args, args[0], tmp, VAR_3, VAR_4);",
"gen_args += 2;",
"} else {",
"reset_temp(args[0], VAR_3, VAR_4);",
"gen_args[0] = args[0];",
"gen_args[1] = args[1];",
"gen_args[2] = args[2];",
"gen_args += 3;",
"}",
"args += 3;",
"break;",
"CASE_OP_32_64(setcond):\nif (temps[args[1]].state == TCG_TEMP_CONST\n&& temps[args[2]].state == TCG_TEMP_CONST) {",
"gen_opc_buf[VAR_2] = op_to_movi(op);",
"tmp = do_constant_folding_cond(op, temps[args[1]].val,\ntemps[args[2]].val, args[3]);",
"tcg_opt_gen_movi(gen_args, args[0], tmp, VAR_3, VAR_4);",
"gen_args += 2;",
"} else {",
"reset_temp(args[0], VAR_3, VAR_4);",
"gen_args[0] = args[0];",
"gen_args[1] = args[1];",
"gen_args[2] = args[2];",
"gen_args[3] = args[3];",
"gen_args += 4;",
"}",
"args += 4;",
"break;",
"CASE_OP_32_64(brcond):\nif (temps[args[0]].state == TCG_TEMP_CONST\n&& temps[args[1]].state == TCG_TEMP_CONST) {",
"if (do_constant_folding_cond(op, temps[args[0]].val,\ntemps[args[1]].val, args[2])) {",
"memset(temps, 0, VAR_3 * sizeof(struct tcg_temp_info));",
"gen_opc_buf[VAR_2] = INDEX_op_br;",
"gen_args[0] = args[3];",
"gen_args += 1;",
"} else {",
"gen_opc_buf[VAR_2] = INDEX_op_nop;",
"}",
"} else {",
"memset(temps, 0, VAR_3 * sizeof(struct tcg_temp_info));",
"reset_temp(args[0], VAR_3, VAR_4);",
"gen_args[0] = args[0];",
"gen_args[1] = args[1];",
"gen_args[2] = args[2];",
"gen_args[3] = args[3];",
"gen_args += 4;",
"}",
"args += 4;",
"break;",
"CASE_OP_32_64(movcond):\nif (temps[args[1]].state == TCG_TEMP_CONST\n&& temps[args[2]].state == TCG_TEMP_CONST) {",
"tmp = do_constant_folding_cond(op, temps[args[1]].val,\ntemps[args[2]].val, args[5]);",
"if (args[0] == args[4-tmp]\n|| (temps[args[4-tmp]].state == TCG_TEMP_COPY\n&& temps[args[4-tmp]].val == args[0])) {",
"gen_opc_buf[VAR_2] = INDEX_op_nop;",
"} else if (temps[args[4-tmp]].state == TCG_TEMP_CONST) {",
"gen_opc_buf[VAR_2] = op_to_movi(op);",
"tcg_opt_gen_movi(gen_args, args[0], temps[args[4-tmp]].val,\nVAR_3, VAR_4);",
"gen_args += 2;",
"} else {",
"gen_opc_buf[VAR_2] = op_to_mov(op);",
"tcg_opt_gen_mov(gen_args, args[0], args[4-tmp],\nVAR_3, VAR_4);",
"gen_args += 2;",
"}",
"} else {",
"reset_temp(args[0], VAR_3, VAR_4);",
"gen_args[0] = args[0];",
"gen_args[1] = args[1];",
"gen_args[2] = args[2];",
"gen_args[3] = args[3];",
"gen_args[4] = args[4];",
"gen_args[5] = args[5];",
"gen_args += 6;",
"}",
"args += 6;",
"break;",
"case INDEX_op_call:\nVAR_5 = (args[0] >> 16) + (args[0] & 0xffff);",
"if (!(args[VAR_5 + 1] & (TCG_CALL_CONST | TCG_CALL_PURE))) {",
"for (VAR_0 = 0; VAR_0 < VAR_4; VAR_0++) {",
"reset_temp(VAR_0, VAR_3, VAR_4);",
"}",
"}",
"for (VAR_0 = 0; VAR_0 < (args[0] >> 16); VAR_0++) {",
"reset_temp(args[VAR_0 + 1], VAR_3, VAR_4);",
"}",
"VAR_0 = VAR_5 + 3;",
"while (VAR_0) {",
"*gen_args = *args;",
"args++;",
"gen_args++;",
"VAR_0--;",
"}",
"break;",
"default:\nif (VAR_6->flags & TCG_OPF_BB_END) {",
"memset(temps, 0, VAR_3 * sizeof(struct tcg_temp_info));",
"} else {",
"for (VAR_0 = 0; VAR_0 < VAR_6->nb_oargs; VAR_0++) {",
"reset_temp(args[VAR_0], VAR_3, VAR_4);",
"}",
"}",
"for (VAR_0 = 0; VAR_0 < VAR_6->nb_args; VAR_0++) {",
"gen_args[VAR_0] = args[VAR_0];",
"}",
"args += VAR_6->nb_args;",
"gen_args += VAR_6->nb_args;",
"break;",
"}",
"}",
"return gen_args;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
35
],
[
37
],
[
39
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
75
],
[
77,
79,
81,
83,
85,
87,
89,
91,
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105,
107,
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123,
125,
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141,
143
],
[
145,
147
],
[
149
],
[
151
],
[
153
],
[
155
],
[
157
],
[
165
],
[
167
],
[
169
],
[
171
],
[
173
],
[
175
],
[
177
],
[
179,
181
],
[
183
],
[
189
],
[
191,
193,
195,
197,
199,
201,
203
],
[
205
],
[
207
],
[
209
],
[
211
],
[
213
],
[
215
],
[
217
],
[
219,
221
],
[
223
],
[
229
],
[
231,
233,
235,
237,
239,
241,
243,
245,
247,
249
],
[
253
],
[
255
],
[
257,
259
],
[
261,
263,
265
],
[
267
],
[
269
],
[
271
],
[
273,
275
],
[
277
],
[
279
],
[
281
],
[
283
],
[
285
],
[
287
],
[
289,
291
],
[
293
],
[
299
],
[
301,
303,
305,
307
],
[
309
],
[
311
],
[
313
],
[
315
],
[
317
],
[
319
],
[
321
],
[
323,
325
],
[
327
],
[
333
],
[
335,
337,
339
],
[
341
],
[
343
],
[
345
],
[
347
],
[
349,
351
],
[
353
],
[
355
],
[
357
],
[
359
],
[
361
],
[
363
],
[
365,
367
],
[
369
],
[
379
],
[
381,
383,
385,
387
],
[
389
],
[
391
],
[
393
],
[
395
],
[
397
],
[
399,
401
],
[
403
],
[
405
],
[
407
],
[
409
],
[
415
],
[
417
],
[
419
],
[
423,
425
],
[
427
],
[
429
],
[
431
],
[
433,
435,
437,
439,
441,
443,
445,
447,
449
],
[
451
],
[
453
],
[
455
],
[
457
],
[
459
],
[
461
],
[
463
],
[
465
],
[
467
],
[
469
],
[
471
],
[
473,
475,
477,
479,
481,
483,
485,
487,
489,
491,
493,
495,
497,
499,
501,
503,
505,
507
],
[
509
],
[
511,
513
],
[
515
],
[
517
],
[
519
],
[
521
],
[
523
],
[
525
],
[
527
],
[
529
],
[
531
],
[
533
],
[
535
],
[
537,
539,
541
],
[
543
],
[
545,
547
],
[
549
],
[
551
],
[
553
],
[
555
],
[
557
],
[
559
],
[
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,
729
],
[
731
],
[
733
],
[
735
],
[
737
],
[
739
],
[
741
],
[
743
],
[
745
],
[
747
],
[
749
],
[
751
],
[
753
],
[
755
],
[
757
],
[
761
],
[
763
]
]
|
14,921 | static inline void tcg_out_sety(TCGContext *s, tcg_target_long val)
{
if (val == 0 || val == -1)
tcg_out32(s, WRY | INSN_IMM13(val));
else
fprintf(stderr, "unimplemented sety %ld\n", (long)val);
}
| false | qemu | 583d121520a81d07bacee7ebe9366d107c8b18b6 | static inline void tcg_out_sety(TCGContext *s, tcg_target_long val)
{
if (val == 0 || val == -1)
tcg_out32(s, WRY | INSN_IMM13(val));
else
fprintf(stderr, "unimplemented sety %ld\n", (long)val);
}
| {
"code": [],
"line_no": []
} | static inline void FUNC_0(TCGContext *VAR_0, tcg_target_long VAR_1)
{
if (VAR_1 == 0 || VAR_1 == -1)
tcg_out32(VAR_0, WRY | INSN_IMM13(VAR_1));
else
fprintf(stderr, "unimplemented sety %ld\n", (long)VAR_1);
}
| [
"static inline void FUNC_0(TCGContext *VAR_0, tcg_target_long VAR_1)\n{",
"if (VAR_1 == 0 || VAR_1 == -1)\ntcg_out32(VAR_0, WRY | INSN_IMM13(VAR_1));",
"else\nfprintf(stderr, \"unimplemented sety %ld\\n\", (long)VAR_1);",
"}"
]
| [
0,
0,
0,
0
]
| [
[
1,
3
],
[
5,
7
],
[
9,
11
],
[
13
]
]
|
14,922 | static void test_hba_spec(void)
{
AHCIQState *ahci;
ahci = ahci_boot();
ahci_pci_enable(ahci);
ahci_test_hba_spec(ahci);
ahci_shutdown(ahci);
}
| false | qemu | debaaa114a8877a939533ba846e64168fb287b7b | static void test_hba_spec(void)
{
AHCIQState *ahci;
ahci = ahci_boot();
ahci_pci_enable(ahci);
ahci_test_hba_spec(ahci);
ahci_shutdown(ahci);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(void)
{
AHCIQState *ahci;
ahci = ahci_boot();
ahci_pci_enable(ahci);
ahci_test_hba_spec(ahci);
ahci_shutdown(ahci);
}
| [
"static void FUNC_0(void)\n{",
"AHCIQState *ahci;",
"ahci = ahci_boot();",
"ahci_pci_enable(ahci);",
"ahci_test_hba_spec(ahci);",
"ahci_shutdown(ahci);",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
]
]
|
14,923 | void pdu_free(V9fsPDU *pdu)
{
if (pdu) {
V9fsState *s = pdu->s;
/*
* Cancelled pdu are added back to the freelist
* by flush request .
*/
if (!pdu->cancelled) {
QLIST_REMOVE(pdu, next);
QLIST_INSERT_HEAD(&s->free_list, pdu, next);
}
}
}
| false | qemu | 6868a420c519d74926ea814d48f6ce9beda35b98 | void pdu_free(V9fsPDU *pdu)
{
if (pdu) {
V9fsState *s = pdu->s;
if (!pdu->cancelled) {
QLIST_REMOVE(pdu, next);
QLIST_INSERT_HEAD(&s->free_list, pdu, next);
}
}
}
| {
"code": [],
"line_no": []
} | void FUNC_0(V9fsPDU *VAR_0)
{
if (VAR_0) {
V9fsState *s = VAR_0->s;
if (!VAR_0->cancelled) {
QLIST_REMOVE(VAR_0, next);
QLIST_INSERT_HEAD(&s->free_list, VAR_0, next);
}
}
}
| [
"void FUNC_0(V9fsPDU *VAR_0)\n{",
"if (VAR_0) {",
"V9fsState *s = VAR_0->s;",
"if (!VAR_0->cancelled) {",
"QLIST_REMOVE(VAR_0, next);",
"QLIST_INSERT_HEAD(&s->free_list, VAR_0, next);",
"}",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
]
]
|
14,924 | static av_noinline void emulated_edge_mc_mmxext(uint8_t *buf, const uint8_t *src,
ptrdiff_t buf_stride,
ptrdiff_t src_stride,
int block_w, int block_h,
int src_x, int src_y, int w, int h)
{
emulated_edge_mc(buf, src, buf_stride, src_stride, block_w, block_h,
src_x, src_y, w, h, vfixtbl_mmx, &ff_emu_edge_vvar_mmx,
hfixtbl_mmxext, &ff_emu_edge_hvar_mmxext);
}
| false | FFmpeg | 5bca5f87d1a32669e0357790e0d0ad8a5c9c998b | static av_noinline void emulated_edge_mc_mmxext(uint8_t *buf, const uint8_t *src,
ptrdiff_t buf_stride,
ptrdiff_t src_stride,
int block_w, int block_h,
int src_x, int src_y, int w, int h)
{
emulated_edge_mc(buf, src, buf_stride, src_stride, block_w, block_h,
src_x, src_y, w, h, vfixtbl_mmx, &ff_emu_edge_vvar_mmx,
hfixtbl_mmxext, &ff_emu_edge_hvar_mmxext);
}
| {
"code": [],
"line_no": []
} | static av_noinline void FUNC_0(uint8_t *buf, const uint8_t *src,
ptrdiff_t buf_stride,
ptrdiff_t src_stride,
int block_w, int block_h,
int src_x, int src_y, int w, int h)
{
emulated_edge_mc(buf, src, buf_stride, src_stride, block_w, block_h,
src_x, src_y, w, h, vfixtbl_mmx, &ff_emu_edge_vvar_mmx,
hfixtbl_mmxext, &ff_emu_edge_hvar_mmxext);
}
| [
"static av_noinline void FUNC_0(uint8_t *buf, const uint8_t *src,\nptrdiff_t buf_stride,\nptrdiff_t src_stride,\nint block_w, int block_h,\nint src_x, int src_y, int w, int h)\n{",
"emulated_edge_mc(buf, src, buf_stride, src_stride, block_w, block_h,\nsrc_x, src_y, w, h, vfixtbl_mmx, &ff_emu_edge_vvar_mmx,\nhfixtbl_mmxext, &ff_emu_edge_hvar_mmxext);",
"}"
]
| [
0,
0,
0
]
| [
[
1,
3,
5,
7,
9,
11
],
[
13,
15,
17
],
[
19
]
]
|
14,925 | static int token_is_operator(QObject *obj, char op)
{
const char *val;
if (token_get_type(obj) != JSON_OPERATOR) {
return 0;
}
val = token_get_value(obj);
return (val[0] == op) && (val[1] == 0);
}
| false | qemu | c54616608af442edf4cfb7397a1909c2653efba0 | static int token_is_operator(QObject *obj, char op)
{
const char *val;
if (token_get_type(obj) != JSON_OPERATOR) {
return 0;
}
val = token_get_value(obj);
return (val[0] == op) && (val[1] == 0);
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(QObject *VAR_0, char VAR_1)
{
const char *VAR_2;
if (token_get_type(VAR_0) != JSON_OPERATOR) {
return 0;
}
VAR_2 = token_get_value(VAR_0);
return (VAR_2[0] == VAR_1) && (VAR_2[1] == 0);
}
| [
"static int FUNC_0(QObject *VAR_0, char VAR_1)\n{",
"const char *VAR_2;",
"if (token_get_type(VAR_0) != JSON_OPERATOR) {",
"return 0;",
"}",
"VAR_2 = token_get_value(VAR_0);",
"return (VAR_2[0] == VAR_1) && (VAR_2[1] == 0);",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
17
],
[
21
],
[
23
]
]
|
14,926 | static void mirror_start_job(BlockDriverState *bs, BlockDriverState *target,
const char *replaces,
int64_t speed, int64_t granularity,
int64_t buf_size,
BlockdevOnError on_source_error,
BlockdevOnError on_target_error,
BlockCompletionFunc *cb,
void *opaque, Error **errp,
const BlockJobDriver *driver,
bool is_none_mode, BlockDriverState *base)
{
MirrorBlockJob *s;
if (granularity == 0) {
/* Choose the default granularity based on the target file's cluster
* size, clamped between 4k and 64k. */
BlockDriverInfo bdi;
if (bdrv_get_info(target, &bdi) >= 0 && bdi.cluster_size != 0) {
granularity = MAX(4096, bdi.cluster_size);
granularity = MIN(65536, granularity);
} else {
granularity = 65536;
}
}
assert ((granularity & (granularity - 1)) == 0);
if ((on_source_error == BLOCKDEV_ON_ERROR_STOP ||
on_source_error == BLOCKDEV_ON_ERROR_ENOSPC) &&
!bdrv_iostatus_is_enabled(bs)) {
error_set(errp, QERR_INVALID_PARAMETER, "on-source-error");
return;
}
s = block_job_create(driver, bs, speed, cb, opaque, errp);
if (!s) {
return;
}
s->replaces = g_strdup(replaces);
s->on_source_error = on_source_error;
s->on_target_error = on_target_error;
s->target = target;
s->is_none_mode = is_none_mode;
s->base = base;
s->granularity = granularity;
s->buf_size = MAX(buf_size, granularity);
s->dirty_bitmap = bdrv_create_dirty_bitmap(bs, granularity, errp);
if (!s->dirty_bitmap) {
return;
}
bdrv_set_enable_write_cache(s->target, true);
bdrv_set_on_error(s->target, on_target_error, on_target_error);
bdrv_iostatus_enable(s->target);
s->common.co = qemu_coroutine_create(mirror_run);
trace_mirror_start(bs, s, s->common.co, opaque);
qemu_coroutine_enter(s->common.co, s);
}
| false | qemu | 0db6e54a8a2c6e16780356422da671b71f862341 | static void mirror_start_job(BlockDriverState *bs, BlockDriverState *target,
const char *replaces,
int64_t speed, int64_t granularity,
int64_t buf_size,
BlockdevOnError on_source_error,
BlockdevOnError on_target_error,
BlockCompletionFunc *cb,
void *opaque, Error **errp,
const BlockJobDriver *driver,
bool is_none_mode, BlockDriverState *base)
{
MirrorBlockJob *s;
if (granularity == 0) {
BlockDriverInfo bdi;
if (bdrv_get_info(target, &bdi) >= 0 && bdi.cluster_size != 0) {
granularity = MAX(4096, bdi.cluster_size);
granularity = MIN(65536, granularity);
} else {
granularity = 65536;
}
}
assert ((granularity & (granularity - 1)) == 0);
if ((on_source_error == BLOCKDEV_ON_ERROR_STOP ||
on_source_error == BLOCKDEV_ON_ERROR_ENOSPC) &&
!bdrv_iostatus_is_enabled(bs)) {
error_set(errp, QERR_INVALID_PARAMETER, "on-source-error");
return;
}
s = block_job_create(driver, bs, speed, cb, opaque, errp);
if (!s) {
return;
}
s->replaces = g_strdup(replaces);
s->on_source_error = on_source_error;
s->on_target_error = on_target_error;
s->target = target;
s->is_none_mode = is_none_mode;
s->base = base;
s->granularity = granularity;
s->buf_size = MAX(buf_size, granularity);
s->dirty_bitmap = bdrv_create_dirty_bitmap(bs, granularity, errp);
if (!s->dirty_bitmap) {
return;
}
bdrv_set_enable_write_cache(s->target, true);
bdrv_set_on_error(s->target, on_target_error, on_target_error);
bdrv_iostatus_enable(s->target);
s->common.co = qemu_coroutine_create(mirror_run);
trace_mirror_start(bs, s, s->common.co, opaque);
qemu_coroutine_enter(s->common.co, s);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(BlockDriverState *VAR_0, BlockDriverState *VAR_1,
const char *VAR_2,
int64_t VAR_3, int64_t VAR_4,
int64_t VAR_5,
BlockdevOnError VAR_6,
BlockdevOnError VAR_7,
BlockCompletionFunc *VAR_8,
void *VAR_9, Error **VAR_10,
const BlockJobDriver *VAR_11,
bool VAR_12, BlockDriverState *VAR_13)
{
MirrorBlockJob *s;
if (VAR_4 == 0) {
BlockDriverInfo bdi;
if (bdrv_get_info(VAR_1, &bdi) >= 0 && bdi.cluster_size != 0) {
VAR_4 = MAX(4096, bdi.cluster_size);
VAR_4 = MIN(65536, VAR_4);
} else {
VAR_4 = 65536;
}
}
assert ((VAR_4 & (VAR_4 - 1)) == 0);
if ((VAR_6 == BLOCKDEV_ON_ERROR_STOP ||
VAR_6 == BLOCKDEV_ON_ERROR_ENOSPC) &&
!bdrv_iostatus_is_enabled(VAR_0)) {
error_set(VAR_10, QERR_INVALID_PARAMETER, "on-source-error");
return;
}
s = block_job_create(VAR_11, VAR_0, VAR_3, VAR_8, VAR_9, VAR_10);
if (!s) {
return;
}
s->VAR_2 = g_strdup(VAR_2);
s->VAR_6 = VAR_6;
s->VAR_7 = VAR_7;
s->VAR_1 = VAR_1;
s->VAR_12 = VAR_12;
s->VAR_13 = VAR_13;
s->VAR_4 = VAR_4;
s->VAR_5 = MAX(VAR_5, VAR_4);
s->dirty_bitmap = bdrv_create_dirty_bitmap(VAR_0, VAR_4, VAR_10);
if (!s->dirty_bitmap) {
return;
}
bdrv_set_enable_write_cache(s->VAR_1, true);
bdrv_set_on_error(s->VAR_1, VAR_7, VAR_7);
bdrv_iostatus_enable(s->VAR_1);
s->common.co = qemu_coroutine_create(mirror_run);
trace_mirror_start(VAR_0, s, s->common.co, VAR_9);
qemu_coroutine_enter(s->common.co, s);
}
| [
"static void FUNC_0(BlockDriverState *VAR_0, BlockDriverState *VAR_1,\nconst char *VAR_2,\nint64_t VAR_3, int64_t VAR_4,\nint64_t VAR_5,\nBlockdevOnError VAR_6,\nBlockdevOnError VAR_7,\nBlockCompletionFunc *VAR_8,\nvoid *VAR_9, Error **VAR_10,\nconst BlockJobDriver *VAR_11,\nbool VAR_12, BlockDriverState *VAR_13)\n{",
"MirrorBlockJob *s;",
"if (VAR_4 == 0) {",
"BlockDriverInfo bdi;",
"if (bdrv_get_info(VAR_1, &bdi) >= 0 && bdi.cluster_size != 0) {",
"VAR_4 = MAX(4096, bdi.cluster_size);",
"VAR_4 = MIN(65536, VAR_4);",
"} else {",
"VAR_4 = 65536;",
"}",
"}",
"assert ((VAR_4 & (VAR_4 - 1)) == 0);",
"if ((VAR_6 == BLOCKDEV_ON_ERROR_STOP ||\nVAR_6 == BLOCKDEV_ON_ERROR_ENOSPC) &&\n!bdrv_iostatus_is_enabled(VAR_0)) {",
"error_set(VAR_10, QERR_INVALID_PARAMETER, \"on-source-error\");",
"return;",
"}",
"s = block_job_create(VAR_11, VAR_0, VAR_3, VAR_8, VAR_9, VAR_10);",
"if (!s) {",
"return;",
"}",
"s->VAR_2 = g_strdup(VAR_2);",
"s->VAR_6 = VAR_6;",
"s->VAR_7 = VAR_7;",
"s->VAR_1 = VAR_1;",
"s->VAR_12 = VAR_12;",
"s->VAR_13 = VAR_13;",
"s->VAR_4 = VAR_4;",
"s->VAR_5 = MAX(VAR_5, VAR_4);",
"s->dirty_bitmap = bdrv_create_dirty_bitmap(VAR_0, VAR_4, VAR_10);",
"if (!s->dirty_bitmap) {",
"return;",
"}",
"bdrv_set_enable_write_cache(s->VAR_1, true);",
"bdrv_set_on_error(s->VAR_1, VAR_7, VAR_7);",
"bdrv_iostatus_enable(s->VAR_1);",
"s->common.co = qemu_coroutine_create(mirror_run);",
"trace_mirror_start(VAR_0, s, s->common.co, VAR_9);",
"qemu_coroutine_enter(s->common.co, 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,
0,
0
]
| [
[
1,
3,
5,
7,
9,
11,
13,
15,
17,
19,
21
],
[
23
],
[
27
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
51
],
[
55,
57,
59
],
[
61
],
[
63
],
[
65
],
[
71
],
[
73
],
[
75
],
[
77
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
]
]
|
14,927 | static void vnc_connect(VncDisplay *vd, QIOChannelSocket *sioc,
bool skipauth, bool websocket)
{
VncState *vs = g_new0(VncState, 1);
int i;
vs->sioc = sioc;
object_ref(OBJECT(vs->sioc));
vs->ioc = QIO_CHANNEL(sioc);
object_ref(OBJECT(vs->ioc));
vs->vd = vd;
buffer_init(&vs->input, "vnc-input/%p", sioc);
buffer_init(&vs->output, "vnc-output/%p", sioc);
buffer_init(&vs->jobs_buffer, "vnc-jobs_buffer/%p", sioc);
buffer_init(&vs->tight.tight, "vnc-tight/%p", sioc);
buffer_init(&vs->tight.zlib, "vnc-tight-zlib/%p", sioc);
buffer_init(&vs->tight.gradient, "vnc-tight-gradient/%p", sioc);
#ifdef CONFIG_VNC_JPEG
buffer_init(&vs->tight.jpeg, "vnc-tight-jpeg/%p", sioc);
#endif
#ifdef CONFIG_VNC_PNG
buffer_init(&vs->tight.png, "vnc-tight-png/%p", sioc);
#endif
buffer_init(&vs->zlib.zlib, "vnc-zlib/%p", sioc);
buffer_init(&vs->zrle.zrle, "vnc-zrle/%p", sioc);
buffer_init(&vs->zrle.fb, "vnc-zrle-fb/%p", sioc);
buffer_init(&vs->zrle.zlib, "vnc-zrle-zlib/%p", sioc);
if (skipauth) {
vs->auth = VNC_AUTH_NONE;
vs->subauth = VNC_AUTH_INVALID;
} else {
if (websocket) {
vs->auth = vd->ws_auth;
vs->subauth = VNC_AUTH_INVALID;
} else {
vs->auth = vd->auth;
vs->subauth = vd->subauth;
}
}
VNC_DEBUG("Client sioc=%p ws=%d auth=%d subauth=%d\n",
sioc, websocket, vs->auth, vs->subauth);
vs->lossy_rect = g_malloc0(VNC_STAT_ROWS * sizeof (*vs->lossy_rect));
for (i = 0; i < VNC_STAT_ROWS; ++i) {
vs->lossy_rect[i] = g_new0(uint8_t, VNC_STAT_COLS);
}
VNC_DEBUG("New client on socket %p\n", vs->sioc);
update_displaychangelistener(&vd->dcl, VNC_REFRESH_INTERVAL_BASE);
qio_channel_set_blocking(vs->ioc, false, NULL);
if (websocket) {
vs->websocket = 1;
if (vd->ws_tls) {
vs->ioc_tag = qio_channel_add_watch(
vs->ioc, G_IO_IN, vncws_tls_handshake_io, vs, NULL);
} else {
vs->ioc_tag = qio_channel_add_watch(
vs->ioc, G_IO_IN, vncws_handshake_io, vs, NULL);
}
} else {
vs->ioc_tag = qio_channel_add_watch(
vs->ioc, G_IO_IN, vnc_client_io, vs, NULL);
}
vnc_client_cache_addr(vs);
vnc_qmp_event(vs, QAPI_EVENT_VNC_CONNECTED);
vnc_set_share_mode(vs, VNC_SHARE_MODE_CONNECTING);
if (!vs->websocket) {
vnc_init_state(vs);
}
if (vd->num_connecting > vd->connections_limit) {
QTAILQ_FOREACH(vs, &vd->clients, next) {
if (vs->share_mode == VNC_SHARE_MODE_CONNECTING) {
vnc_disconnect_start(vs);
return;
}
}
}
}
| false | qemu | 38e5756a614e9a492d1bb181166cd031bc87e159 | static void vnc_connect(VncDisplay *vd, QIOChannelSocket *sioc,
bool skipauth, bool websocket)
{
VncState *vs = g_new0(VncState, 1);
int i;
vs->sioc = sioc;
object_ref(OBJECT(vs->sioc));
vs->ioc = QIO_CHANNEL(sioc);
object_ref(OBJECT(vs->ioc));
vs->vd = vd;
buffer_init(&vs->input, "vnc-input/%p", sioc);
buffer_init(&vs->output, "vnc-output/%p", sioc);
buffer_init(&vs->jobs_buffer, "vnc-jobs_buffer/%p", sioc);
buffer_init(&vs->tight.tight, "vnc-tight/%p", sioc);
buffer_init(&vs->tight.zlib, "vnc-tight-zlib/%p", sioc);
buffer_init(&vs->tight.gradient, "vnc-tight-gradient/%p", sioc);
#ifdef CONFIG_VNC_JPEG
buffer_init(&vs->tight.jpeg, "vnc-tight-jpeg/%p", sioc);
#endif
#ifdef CONFIG_VNC_PNG
buffer_init(&vs->tight.png, "vnc-tight-png/%p", sioc);
#endif
buffer_init(&vs->zlib.zlib, "vnc-zlib/%p", sioc);
buffer_init(&vs->zrle.zrle, "vnc-zrle/%p", sioc);
buffer_init(&vs->zrle.fb, "vnc-zrle-fb/%p", sioc);
buffer_init(&vs->zrle.zlib, "vnc-zrle-zlib/%p", sioc);
if (skipauth) {
vs->auth = VNC_AUTH_NONE;
vs->subauth = VNC_AUTH_INVALID;
} else {
if (websocket) {
vs->auth = vd->ws_auth;
vs->subauth = VNC_AUTH_INVALID;
} else {
vs->auth = vd->auth;
vs->subauth = vd->subauth;
}
}
VNC_DEBUG("Client sioc=%p ws=%d auth=%d subauth=%d\n",
sioc, websocket, vs->auth, vs->subauth);
vs->lossy_rect = g_malloc0(VNC_STAT_ROWS * sizeof (*vs->lossy_rect));
for (i = 0; i < VNC_STAT_ROWS; ++i) {
vs->lossy_rect[i] = g_new0(uint8_t, VNC_STAT_COLS);
}
VNC_DEBUG("New client on socket %p\n", vs->sioc);
update_displaychangelistener(&vd->dcl, VNC_REFRESH_INTERVAL_BASE);
qio_channel_set_blocking(vs->ioc, false, NULL);
if (websocket) {
vs->websocket = 1;
if (vd->ws_tls) {
vs->ioc_tag = qio_channel_add_watch(
vs->ioc, G_IO_IN, vncws_tls_handshake_io, vs, NULL);
} else {
vs->ioc_tag = qio_channel_add_watch(
vs->ioc, G_IO_IN, vncws_handshake_io, vs, NULL);
}
} else {
vs->ioc_tag = qio_channel_add_watch(
vs->ioc, G_IO_IN, vnc_client_io, vs, NULL);
}
vnc_client_cache_addr(vs);
vnc_qmp_event(vs, QAPI_EVENT_VNC_CONNECTED);
vnc_set_share_mode(vs, VNC_SHARE_MODE_CONNECTING);
if (!vs->websocket) {
vnc_init_state(vs);
}
if (vd->num_connecting > vd->connections_limit) {
QTAILQ_FOREACH(vs, &vd->clients, next) {
if (vs->share_mode == VNC_SHARE_MODE_CONNECTING) {
vnc_disconnect_start(vs);
return;
}
}
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(VncDisplay *VAR_0, QIOChannelSocket *VAR_1,
bool VAR_2, bool VAR_3)
{
VncState *vs = g_new0(VncState, 1);
int VAR_4;
vs->VAR_1 = VAR_1;
object_ref(OBJECT(vs->VAR_1));
vs->ioc = QIO_CHANNEL(VAR_1);
object_ref(OBJECT(vs->ioc));
vs->VAR_0 = VAR_0;
buffer_init(&vs->input, "vnc-input/%p", VAR_1);
buffer_init(&vs->output, "vnc-output/%p", VAR_1);
buffer_init(&vs->jobs_buffer, "vnc-jobs_buffer/%p", VAR_1);
buffer_init(&vs->tight.tight, "vnc-tight/%p", VAR_1);
buffer_init(&vs->tight.zlib, "vnc-tight-zlib/%p", VAR_1);
buffer_init(&vs->tight.gradient, "vnc-tight-gradient/%p", VAR_1);
#ifdef CONFIG_VNC_JPEG
buffer_init(&vs->tight.jpeg, "vnc-tight-jpeg/%p", VAR_1);
#endif
#ifdef CONFIG_VNC_PNG
buffer_init(&vs->tight.png, "vnc-tight-png/%p", VAR_1);
#endif
buffer_init(&vs->zlib.zlib, "vnc-zlib/%p", VAR_1);
buffer_init(&vs->zrle.zrle, "vnc-zrle/%p", VAR_1);
buffer_init(&vs->zrle.fb, "vnc-zrle-fb/%p", VAR_1);
buffer_init(&vs->zrle.zlib, "vnc-zrle-zlib/%p", VAR_1);
if (VAR_2) {
vs->auth = VNC_AUTH_NONE;
vs->subauth = VNC_AUTH_INVALID;
} else {
if (VAR_3) {
vs->auth = VAR_0->ws_auth;
vs->subauth = VNC_AUTH_INVALID;
} else {
vs->auth = VAR_0->auth;
vs->subauth = VAR_0->subauth;
}
}
VNC_DEBUG("Client VAR_1=%p ws=%d auth=%d subauth=%d\n",
VAR_1, VAR_3, vs->auth, vs->subauth);
vs->lossy_rect = g_malloc0(VNC_STAT_ROWS * sizeof (*vs->lossy_rect));
for (VAR_4 = 0; VAR_4 < VNC_STAT_ROWS; ++VAR_4) {
vs->lossy_rect[VAR_4] = g_new0(uint8_t, VNC_STAT_COLS);
}
VNC_DEBUG("New client on socket %p\n", vs->VAR_1);
update_displaychangelistener(&VAR_0->dcl, VNC_REFRESH_INTERVAL_BASE);
qio_channel_set_blocking(vs->ioc, false, NULL);
if (VAR_3) {
vs->VAR_3 = 1;
if (VAR_0->ws_tls) {
vs->ioc_tag = qio_channel_add_watch(
vs->ioc, G_IO_IN, vncws_tls_handshake_io, vs, NULL);
} else {
vs->ioc_tag = qio_channel_add_watch(
vs->ioc, G_IO_IN, vncws_handshake_io, vs, NULL);
}
} else {
vs->ioc_tag = qio_channel_add_watch(
vs->ioc, G_IO_IN, vnc_client_io, vs, NULL);
}
vnc_client_cache_addr(vs);
vnc_qmp_event(vs, QAPI_EVENT_VNC_CONNECTED);
vnc_set_share_mode(vs, VNC_SHARE_MODE_CONNECTING);
if (!vs->VAR_3) {
vnc_init_state(vs);
}
if (VAR_0->num_connecting > VAR_0->connections_limit) {
QTAILQ_FOREACH(vs, &VAR_0->clients, next) {
if (vs->share_mode == VNC_SHARE_MODE_CONNECTING) {
vnc_disconnect_start(vs);
return;
}
}
}
}
| [
"static void FUNC_0(VncDisplay *VAR_0, QIOChannelSocket *VAR_1,\nbool VAR_2, bool VAR_3)\n{",
"VncState *vs = g_new0(VncState, 1);",
"int VAR_4;",
"vs->VAR_1 = VAR_1;",
"object_ref(OBJECT(vs->VAR_1));",
"vs->ioc = QIO_CHANNEL(VAR_1);",
"object_ref(OBJECT(vs->ioc));",
"vs->VAR_0 = VAR_0;",
"buffer_init(&vs->input, \"vnc-input/%p\", VAR_1);",
"buffer_init(&vs->output, \"vnc-output/%p\", VAR_1);",
"buffer_init(&vs->jobs_buffer, \"vnc-jobs_buffer/%p\", VAR_1);",
"buffer_init(&vs->tight.tight, \"vnc-tight/%p\", VAR_1);",
"buffer_init(&vs->tight.zlib, \"vnc-tight-zlib/%p\", VAR_1);",
"buffer_init(&vs->tight.gradient, \"vnc-tight-gradient/%p\", VAR_1);",
"#ifdef CONFIG_VNC_JPEG\nbuffer_init(&vs->tight.jpeg, \"vnc-tight-jpeg/%p\", VAR_1);",
"#endif\n#ifdef CONFIG_VNC_PNG\nbuffer_init(&vs->tight.png, \"vnc-tight-png/%p\", VAR_1);",
"#endif\nbuffer_init(&vs->zlib.zlib, \"vnc-zlib/%p\", VAR_1);",
"buffer_init(&vs->zrle.zrle, \"vnc-zrle/%p\", VAR_1);",
"buffer_init(&vs->zrle.fb, \"vnc-zrle-fb/%p\", VAR_1);",
"buffer_init(&vs->zrle.zlib, \"vnc-zrle-zlib/%p\", VAR_1);",
"if (VAR_2) {",
"vs->auth = VNC_AUTH_NONE;",
"vs->subauth = VNC_AUTH_INVALID;",
"} else {",
"if (VAR_3) {",
"vs->auth = VAR_0->ws_auth;",
"vs->subauth = VNC_AUTH_INVALID;",
"} else {",
"vs->auth = VAR_0->auth;",
"vs->subauth = VAR_0->subauth;",
"}",
"}",
"VNC_DEBUG(\"Client VAR_1=%p ws=%d auth=%d subauth=%d\\n\",\nVAR_1, VAR_3, vs->auth, vs->subauth);",
"vs->lossy_rect = g_malloc0(VNC_STAT_ROWS * sizeof (*vs->lossy_rect));",
"for (VAR_4 = 0; VAR_4 < VNC_STAT_ROWS; ++VAR_4) {",
"vs->lossy_rect[VAR_4] = g_new0(uint8_t, VNC_STAT_COLS);",
"}",
"VNC_DEBUG(\"New client on socket %p\\n\", vs->VAR_1);",
"update_displaychangelistener(&VAR_0->dcl, VNC_REFRESH_INTERVAL_BASE);",
"qio_channel_set_blocking(vs->ioc, false, NULL);",
"if (VAR_3) {",
"vs->VAR_3 = 1;",
"if (VAR_0->ws_tls) {",
"vs->ioc_tag = qio_channel_add_watch(\nvs->ioc, G_IO_IN, vncws_tls_handshake_io, vs, NULL);",
"} else {",
"vs->ioc_tag = qio_channel_add_watch(\nvs->ioc, G_IO_IN, vncws_handshake_io, vs, NULL);",
"}",
"} else {",
"vs->ioc_tag = qio_channel_add_watch(\nvs->ioc, G_IO_IN, vnc_client_io, vs, NULL);",
"}",
"vnc_client_cache_addr(vs);",
"vnc_qmp_event(vs, QAPI_EVENT_VNC_CONNECTED);",
"vnc_set_share_mode(vs, VNC_SHARE_MODE_CONNECTING);",
"if (!vs->VAR_3) {",
"vnc_init_state(vs);",
"}",
"if (VAR_0->num_connecting > VAR_0->connections_limit) {",
"QTAILQ_FOREACH(vs, &VAR_0->clients, next) {",
"if (vs->share_mode == VNC_SHARE_MODE_CONNECTING) {",
"vnc_disconnect_start(vs);",
"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
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
],
[
37
],
[
39,
41
],
[
43,
45,
47
],
[
49,
51
],
[
53
],
[
55
],
[
57
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85,
87
],
[
91
],
[
93
],
[
95
],
[
97
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113,
115
],
[
117
],
[
119,
121
],
[
123
],
[
125
],
[
127,
129
],
[
131
],
[
135
],
[
137
],
[
139
],
[
143
],
[
145
],
[
147
],
[
151
],
[
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165
],
[
167
]
]
|
14,928 | static inline void tlb_reset_dirty_range(CPUTLBEntry *tlb_entry,
unsigned long start, unsigned long length)
{
unsigned long addr;
if ((tlb_entry->addr_write & ~TARGET_PAGE_MASK) == io_mem_ram.ram_addr) {
addr = (tlb_entry->addr_write & TARGET_PAGE_MASK) + tlb_entry->addend;
if ((addr - start) < length) {
tlb_entry->addr_write = (tlb_entry->addr_write & TARGET_PAGE_MASK) | TLB_NOTDIRTY;
}
}
}
| false | qemu | 7859cc6e39bf86f890bb1c72fd9ba41deb6ce2e7 | static inline void tlb_reset_dirty_range(CPUTLBEntry *tlb_entry,
unsigned long start, unsigned long length)
{
unsigned long addr;
if ((tlb_entry->addr_write & ~TARGET_PAGE_MASK) == io_mem_ram.ram_addr) {
addr = (tlb_entry->addr_write & TARGET_PAGE_MASK) + tlb_entry->addend;
if ((addr - start) < length) {
tlb_entry->addr_write = (tlb_entry->addr_write & TARGET_PAGE_MASK) | TLB_NOTDIRTY;
}
}
}
| {
"code": [],
"line_no": []
} | static inline void FUNC_0(CPUTLBEntry *VAR_0,
unsigned long VAR_1, unsigned long VAR_2)
{
unsigned long VAR_3;
if ((VAR_0->addr_write & ~TARGET_PAGE_MASK) == io_mem_ram.ram_addr) {
VAR_3 = (VAR_0->addr_write & TARGET_PAGE_MASK) + VAR_0->addend;
if ((VAR_3 - VAR_1) < VAR_2) {
VAR_0->addr_write = (VAR_0->addr_write & TARGET_PAGE_MASK) | TLB_NOTDIRTY;
}
}
}
| [
"static inline void FUNC_0(CPUTLBEntry *VAR_0,\nunsigned long VAR_1, unsigned long VAR_2)\n{",
"unsigned long VAR_3;",
"if ((VAR_0->addr_write & ~TARGET_PAGE_MASK) == io_mem_ram.ram_addr) {",
"VAR_3 = (VAR_0->addr_write & TARGET_PAGE_MASK) + VAR_0->addend;",
"if ((VAR_3 - VAR_1) < VAR_2) {",
"VAR_0->addr_write = (VAR_0->addr_write & TARGET_PAGE_MASK) | TLB_NOTDIRTY;",
"}",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
]
]
|
14,929 | static inline void gen_evmergehi(DisasContext *ctx)
{
if (unlikely(!ctx->spe_enabled)) {
gen_exception(ctx, POWERPC_EXCP_APU);
return;
}
#if defined(TARGET_PPC64)
TCGv t0 = tcg_temp_new();
TCGv t1 = tcg_temp_new();
tcg_gen_shri_tl(t0, cpu_gpr[rB(ctx->opcode)], 32);
tcg_gen_andi_tl(t1, cpu_gpr[rA(ctx->opcode)], 0xFFFFFFFF0000000ULL);
tcg_gen_or_tl(cpu_gpr[rD(ctx->opcode)], t0, t1);
tcg_temp_free(t0);
tcg_temp_free(t1);
#else
tcg_gen_mov_i32(cpu_gpr[rD(ctx->opcode)], cpu_gprh[rB(ctx->opcode)]);
tcg_gen_mov_i32(cpu_gprh[rD(ctx->opcode)], cpu_gprh[rA(ctx->opcode)]);
#endif
}
| false | qemu | 27a69bb088bee6d4efea254659422fb9c751b3c7 | static inline void gen_evmergehi(DisasContext *ctx)
{
if (unlikely(!ctx->spe_enabled)) {
gen_exception(ctx, POWERPC_EXCP_APU);
return;
}
#if defined(TARGET_PPC64)
TCGv t0 = tcg_temp_new();
TCGv t1 = tcg_temp_new();
tcg_gen_shri_tl(t0, cpu_gpr[rB(ctx->opcode)], 32);
tcg_gen_andi_tl(t1, cpu_gpr[rA(ctx->opcode)], 0xFFFFFFFF0000000ULL);
tcg_gen_or_tl(cpu_gpr[rD(ctx->opcode)], t0, t1);
tcg_temp_free(t0);
tcg_temp_free(t1);
#else
tcg_gen_mov_i32(cpu_gpr[rD(ctx->opcode)], cpu_gprh[rB(ctx->opcode)]);
tcg_gen_mov_i32(cpu_gprh[rD(ctx->opcode)], cpu_gprh[rA(ctx->opcode)]);
#endif
}
| {
"code": [],
"line_no": []
} | static inline void FUNC_0(DisasContext *VAR_0)
{
if (unlikely(!VAR_0->spe_enabled)) {
gen_exception(VAR_0, POWERPC_EXCP_APU);
return;
}
#if defined(TARGET_PPC64)
TCGv t0 = tcg_temp_new();
TCGv t1 = tcg_temp_new();
tcg_gen_shri_tl(t0, cpu_gpr[rB(VAR_0->opcode)], 32);
tcg_gen_andi_tl(t1, cpu_gpr[rA(VAR_0->opcode)], 0xFFFFFFFF0000000ULL);
tcg_gen_or_tl(cpu_gpr[rD(VAR_0->opcode)], t0, t1);
tcg_temp_free(t0);
tcg_temp_free(t1);
#else
tcg_gen_mov_i32(cpu_gpr[rD(VAR_0->opcode)], cpu_gprh[rB(VAR_0->opcode)]);
tcg_gen_mov_i32(cpu_gprh[rD(VAR_0->opcode)], cpu_gprh[rA(VAR_0->opcode)]);
#endif
}
| [
"static inline void FUNC_0(DisasContext *VAR_0)\n{",
"if (unlikely(!VAR_0->spe_enabled)) {",
"gen_exception(VAR_0, POWERPC_EXCP_APU);",
"return;",
"}",
"#if defined(TARGET_PPC64)\nTCGv t0 = tcg_temp_new();",
"TCGv t1 = tcg_temp_new();",
"tcg_gen_shri_tl(t0, cpu_gpr[rB(VAR_0->opcode)], 32);",
"tcg_gen_andi_tl(t1, cpu_gpr[rA(VAR_0->opcode)], 0xFFFFFFFF0000000ULL);",
"tcg_gen_or_tl(cpu_gpr[rD(VAR_0->opcode)], t0, t1);",
"tcg_temp_free(t0);",
"tcg_temp_free(t1);",
"#else\ntcg_gen_mov_i32(cpu_gpr[rD(VAR_0->opcode)], cpu_gprh[rB(VAR_0->opcode)]);",
"tcg_gen_mov_i32(cpu_gprh[rD(VAR_0->opcode)], cpu_gprh[rA(VAR_0->opcode)]);",
"#endif\n}"
]
| [
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
]
]
|
14,930 | static void simple_dict(void)
{
int i;
struct {
const char *encoded;
LiteralQObject decoded;
} test_cases[] = {
{
.encoded = "{\"foo\": 42, \"bar\": \"hello world\"}",
.decoded = QLIT_QDICT(((LiteralQDictEntry[]){
{ "foo", QLIT_QINT(42) },
{ "bar", QLIT_QSTR("hello world") },
{ }
})),
}, {
.encoded = "{}",
.decoded = QLIT_QDICT(((LiteralQDictEntry[]){
{ }
})),
}, {
.encoded = "{\"foo\": 43}",
.decoded = QLIT_QDICT(((LiteralQDictEntry[]){
{ "foo", QLIT_QINT(43) },
{ }
})),
},
{ }
};
for (i = 0; test_cases[i].encoded; i++) {
QObject *obj;
QString *str;
obj = qobject_from_json(test_cases[i].encoded);
g_assert(obj != NULL);
g_assert(qobject_type(obj) == QTYPE_QDICT);
g_assert(compare_litqobj_to_qobj(&test_cases[i].decoded, obj) == 1);
str = qobject_to_json(obj);
qobject_decref(obj);
obj = qobject_from_json(qstring_get_str(str));
g_assert(obj != NULL);
g_assert(qobject_type(obj) == QTYPE_QDICT);
g_assert(compare_litqobj_to_qobj(&test_cases[i].decoded, obj) == 1);
qobject_decref(obj);
QDECREF(str);
}
}
| false | qemu | 9eaaf971683c99ed197fa1b7d1a3ca9baabfb3ee | static void simple_dict(void)
{
int i;
struct {
const char *encoded;
LiteralQObject decoded;
} test_cases[] = {
{
.encoded = "{\"foo\": 42, \"bar\": \"hello world\"}",
.decoded = QLIT_QDICT(((LiteralQDictEntry[]){
{ "foo", QLIT_QINT(42) },
{ "bar", QLIT_QSTR("hello world") },
{ }
})),
}, {
.encoded = "{}",
.decoded = QLIT_QDICT(((LiteralQDictEntry[]){
{ }
})),
}, {
.encoded = "{\"foo\": 43}",
.decoded = QLIT_QDICT(((LiteralQDictEntry[]){
{ "foo", QLIT_QINT(43) },
{ }
})),
},
{ }
};
for (i = 0; test_cases[i].encoded; i++) {
QObject *obj;
QString *str;
obj = qobject_from_json(test_cases[i].encoded);
g_assert(obj != NULL);
g_assert(qobject_type(obj) == QTYPE_QDICT);
g_assert(compare_litqobj_to_qobj(&test_cases[i].decoded, obj) == 1);
str = qobject_to_json(obj);
qobject_decref(obj);
obj = qobject_from_json(qstring_get_str(str));
g_assert(obj != NULL);
g_assert(qobject_type(obj) == QTYPE_QDICT);
g_assert(compare_litqobj_to_qobj(&test_cases[i].decoded, obj) == 1);
qobject_decref(obj);
QDECREF(str);
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(void)
{
int VAR_0;
struct {
const char *encoded;
LiteralQObject decoded;
} VAR_1[] = {
{
.encoded = "{\"foo\": 42, \"bar\": \"hello world\"}",
.decoded = QLIT_QDICT(((LiteralQDictEntry[]){
{ "foo", QLIT_QINT(42) },
{ "bar", QLIT_QSTR("hello world") },
{ }
})),
}, {
.encoded = "{}",
.decoded = QLIT_QDICT(((LiteralQDictEntry[]){
{ }
})),
}, {
.encoded = "{\"foo\": 43}",
.decoded = QLIT_QDICT(((LiteralQDictEntry[]){
{ "foo", QLIT_QINT(43) },
{ }
})),
},
{ }
};
for (VAR_0 = 0; VAR_1[VAR_0].encoded; VAR_0++) {
QObject *obj;
QString *str;
obj = qobject_from_json(VAR_1[VAR_0].encoded);
g_assert(obj != NULL);
g_assert(qobject_type(obj) == QTYPE_QDICT);
g_assert(compare_litqobj_to_qobj(&VAR_1[VAR_0].decoded, obj) == 1);
str = qobject_to_json(obj);
qobject_decref(obj);
obj = qobject_from_json(qstring_get_str(str));
g_assert(obj != NULL);
g_assert(qobject_type(obj) == QTYPE_QDICT);
g_assert(compare_litqobj_to_qobj(&VAR_1[VAR_0].decoded, obj) == 1);
qobject_decref(obj);
QDECREF(str);
}
}
| [
"static void FUNC_0(void)\n{",
"int VAR_0;",
"struct {",
"const char *encoded;",
"LiteralQObject decoded;",
"} VAR_1[] = {",
"{",
".encoded = \"{\\\"foo\\\": 42, \\\"bar\\\": \\\"hello world\\\"}\",",
".decoded = QLIT_QDICT(((LiteralQDictEntry[]){",
"{ \"foo\", QLIT_QINT(42) },",
"{ \"bar\", QLIT_QSTR(\"hello world\") },",
"{ }",
"})),",
"}, {",
".encoded = \"{}\",",
".decoded = QLIT_QDICT(((LiteralQDictEntry[]){",
"{ }",
"})),",
"}, {",
".encoded = \"{\\\"foo\\\": 43}\",",
".decoded = QLIT_QDICT(((LiteralQDictEntry[]){",
"{ \"foo\", QLIT_QINT(43) },",
"{ }",
"})),",
"},",
"{ }",
"};",
"for (VAR_0 = 0; VAR_1[VAR_0].encoded; VAR_0++) {",
"QObject *obj;",
"QString *str;",
"obj = qobject_from_json(VAR_1[VAR_0].encoded);",
"g_assert(obj != NULL);",
"g_assert(qobject_type(obj) == QTYPE_QDICT);",
"g_assert(compare_litqobj_to_qobj(&VAR_1[VAR_0].decoded, obj) == 1);",
"str = qobject_to_json(obj);",
"qobject_decref(obj);",
"obj = qobject_from_json(qstring_get_str(str));",
"g_assert(obj != NULL);",
"g_assert(qobject_type(obj) == QTYPE_QDICT);",
"g_assert(compare_litqobj_to_qobj(&VAR_1[VAR_0].decoded, obj) == 1);",
"qobject_decref(obj);",
"QDECREF(str);",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
59
],
[
61
],
[
63
],
[
67
],
[
69
],
[
71
],
[
75
],
[
79
],
[
81
],
[
85
],
[
87
],
[
89
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
]
]
|
14,931 | static int local_open2(FsContext *fs_ctx, V9fsPath *dir_path, const char *name,
int flags, FsCred *credp)
{
char *path;
int fd = -1;
int err = -1;
int serrno = 0;
V9fsString fullname;
char buffer[PATH_MAX];
v9fs_string_init(&fullname);
v9fs_string_sprintf(&fullname, "%s/%s", dir_path->data, name);
path = fullname.data;
/* Determine the security model */
if (fs_ctx->fs_sm == SM_MAPPED) {
fd = open(rpath(fs_ctx, path, buffer), flags, SM_LOCAL_MODE_BITS);
if (fd == -1) {
err = fd;
goto out;
}
credp->fc_mode = credp->fc_mode|S_IFREG;
/* Set cleint credentials in xattr */
err = local_set_xattr(rpath(fs_ctx, path, buffer), credp);
if (err == -1) {
serrno = errno;
goto err_end;
}
} else if ((fs_ctx->fs_sm == SM_PASSTHROUGH) ||
(fs_ctx->fs_sm == SM_NONE)) {
fd = open(rpath(fs_ctx, path, buffer), flags, credp->fc_mode);
if (fd == -1) {
err = fd;
goto out;
}
err = local_post_create_passthrough(fs_ctx, path, credp);
if (err == -1) {
serrno = errno;
goto err_end;
}
}
err = fd;
goto out;
err_end:
close(fd);
remove(rpath(fs_ctx, path, buffer));
errno = serrno;
out:
v9fs_string_free(&fullname);
return err;
}
| false | qemu | b97400caef60ccfb0bc81c59f8bd824c43a0d6c8 | static int local_open2(FsContext *fs_ctx, V9fsPath *dir_path, const char *name,
int flags, FsCred *credp)
{
char *path;
int fd = -1;
int err = -1;
int serrno = 0;
V9fsString fullname;
char buffer[PATH_MAX];
v9fs_string_init(&fullname);
v9fs_string_sprintf(&fullname, "%s/%s", dir_path->data, name);
path = fullname.data;
if (fs_ctx->fs_sm == SM_MAPPED) {
fd = open(rpath(fs_ctx, path, buffer), flags, SM_LOCAL_MODE_BITS);
if (fd == -1) {
err = fd;
goto out;
}
credp->fc_mode = credp->fc_mode|S_IFREG;
err = local_set_xattr(rpath(fs_ctx, path, buffer), credp);
if (err == -1) {
serrno = errno;
goto err_end;
}
} else if ((fs_ctx->fs_sm == SM_PASSTHROUGH) ||
(fs_ctx->fs_sm == SM_NONE)) {
fd = open(rpath(fs_ctx, path, buffer), flags, credp->fc_mode);
if (fd == -1) {
err = fd;
goto out;
}
err = local_post_create_passthrough(fs_ctx, path, credp);
if (err == -1) {
serrno = errno;
goto err_end;
}
}
err = fd;
goto out;
err_end:
close(fd);
remove(rpath(fs_ctx, path, buffer));
errno = serrno;
out:
v9fs_string_free(&fullname);
return err;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1, const char *VAR_2,
int VAR_3, FsCred *VAR_4)
{
char *VAR_5;
int VAR_6 = -1;
int VAR_7 = -1;
int VAR_8 = 0;
V9fsString fullname;
char VAR_9[PATH_MAX];
v9fs_string_init(&fullname);
v9fs_string_sprintf(&fullname, "%s/%s", VAR_1->data, VAR_2);
VAR_5 = fullname.data;
if (VAR_0->fs_sm == SM_MAPPED) {
VAR_6 = open(rpath(VAR_0, VAR_5, VAR_9), VAR_3, SM_LOCAL_MODE_BITS);
if (VAR_6 == -1) {
VAR_7 = VAR_6;
goto out;
}
VAR_4->fc_mode = VAR_4->fc_mode|S_IFREG;
VAR_7 = local_set_xattr(rpath(VAR_0, VAR_5, VAR_9), VAR_4);
if (VAR_7 == -1) {
VAR_8 = errno;
goto err_end;
}
} else if ((VAR_0->fs_sm == SM_PASSTHROUGH) ||
(VAR_0->fs_sm == SM_NONE)) {
VAR_6 = open(rpath(VAR_0, VAR_5, VAR_9), VAR_3, VAR_4->fc_mode);
if (VAR_6 == -1) {
VAR_7 = VAR_6;
goto out;
}
VAR_7 = local_post_create_passthrough(VAR_0, VAR_5, VAR_4);
if (VAR_7 == -1) {
VAR_8 = errno;
goto err_end;
}
}
VAR_7 = VAR_6;
goto out;
err_end:
close(VAR_6);
remove(rpath(VAR_0, VAR_5, VAR_9));
errno = VAR_8;
out:
v9fs_string_free(&fullname);
return VAR_7;
}
| [
"static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1, const char *VAR_2,\nint VAR_3, FsCred *VAR_4)\n{",
"char *VAR_5;",
"int VAR_6 = -1;",
"int VAR_7 = -1;",
"int VAR_8 = 0;",
"V9fsString fullname;",
"char VAR_9[PATH_MAX];",
"v9fs_string_init(&fullname);",
"v9fs_string_sprintf(&fullname, \"%s/%s\", VAR_1->data, VAR_2);",
"VAR_5 = fullname.data;",
"if (VAR_0->fs_sm == SM_MAPPED) {",
"VAR_6 = open(rpath(VAR_0, VAR_5, VAR_9), VAR_3, SM_LOCAL_MODE_BITS);",
"if (VAR_6 == -1) {",
"VAR_7 = VAR_6;",
"goto out;",
"}",
"VAR_4->fc_mode = VAR_4->fc_mode|S_IFREG;",
"VAR_7 = local_set_xattr(rpath(VAR_0, VAR_5, VAR_9), VAR_4);",
"if (VAR_7 == -1) {",
"VAR_8 = errno;",
"goto err_end;",
"}",
"} else if ((VAR_0->fs_sm == SM_PASSTHROUGH) ||",
"(VAR_0->fs_sm == SM_NONE)) {",
"VAR_6 = open(rpath(VAR_0, VAR_5, VAR_9), VAR_3, VAR_4->fc_mode);",
"if (VAR_6 == -1) {",
"VAR_7 = VAR_6;",
"goto out;",
"}",
"VAR_7 = local_post_create_passthrough(VAR_0, VAR_5, VAR_4);",
"if (VAR_7 == -1) {",
"VAR_8 = errno;",
"goto err_end;",
"}",
"}",
"VAR_7 = VAR_6;",
"goto out;",
"err_end:\nclose(VAR_6);",
"remove(rpath(VAR_0, VAR_5, VAR_9));",
"errno = VAR_8;",
"out:\nv9fs_string_free(&fullname);",
"return VAR_7;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
89,
91
],
[
93
],
[
95
],
[
97,
99
],
[
101
],
[
103
]
]
|
14,932 | static void do_savevm(int argc, const char **argv)
{
if (argc != 2) {
help_cmd(argv[0]);
return;
}
if (qemu_savevm(argv[1]) < 0)
term_printf("I/O error when saving VM to '%s'\n", argv[1]);
}
| false | qemu | 9307c4c1d93939db9b04117b654253af5113dc21 | static void do_savevm(int argc, const char **argv)
{
if (argc != 2) {
help_cmd(argv[0]);
return;
}
if (qemu_savevm(argv[1]) < 0)
term_printf("I/O error when saving VM to '%s'\n", argv[1]);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(int VAR_0, const char **VAR_1)
{
if (VAR_0 != 2) {
help_cmd(VAR_1[0]);
return;
}
if (qemu_savevm(VAR_1[1]) < 0)
term_printf("I/O error when saving VM to '%s'\n", VAR_1[1]);
}
| [
"static void FUNC_0(int VAR_0, const char **VAR_1)\n{",
"if (VAR_0 != 2) {",
"help_cmd(VAR_1[0]);",
"return;",
"}",
"if (qemu_savevm(VAR_1[1]) < 0)\nterm_printf(\"I/O error when saving VM to '%s'\\n\", VAR_1[1]);",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13,
15
],
[
17
]
]
|
14,934 | static void evaluate_flags_writeback(uint32_t flags)
{
int x;
/* Extended arithmetics, leave the z flag alone. */
x = env->cc_x;
if ((x || env->cc_op == CC_OP_ADDC)
&& flags & Z_FLAG)
env->cc_mask &= ~Z_FLAG;
/* all insn clear the x-flag except setf or clrf. */
env->pregs[PR_CCS] &= ~(env->cc_mask | X_FLAG);
flags &= env->cc_mask;
env->pregs[PR_CCS] |= flags;
}
| false | qemu | a8cf66bb393ff420d40ae172a4c817bf2752918a | static void evaluate_flags_writeback(uint32_t flags)
{
int x;
x = env->cc_x;
if ((x || env->cc_op == CC_OP_ADDC)
&& flags & Z_FLAG)
env->cc_mask &= ~Z_FLAG;
env->pregs[PR_CCS] &= ~(env->cc_mask | X_FLAG);
flags &= env->cc_mask;
env->pregs[PR_CCS] |= flags;
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(uint32_t VAR_0)
{
int VAR_1;
VAR_1 = env->cc_x;
if ((VAR_1 || env->cc_op == CC_OP_ADDC)
&& VAR_0 & Z_FLAG)
env->cc_mask &= ~Z_FLAG;
env->pregs[PR_CCS] &= ~(env->cc_mask | X_FLAG);
VAR_0 &= env->cc_mask;
env->pregs[PR_CCS] |= VAR_0;
}
| [
"static void FUNC_0(uint32_t VAR_0)\n{",
"int VAR_1;",
"VAR_1 = env->cc_x;",
"if ((VAR_1 || env->cc_op == CC_OP_ADDC)\n&& VAR_0 & Z_FLAG)\nenv->cc_mask &= ~Z_FLAG;",
"env->pregs[PR_CCS] &= ~(env->cc_mask | X_FLAG);",
"VAR_0 &= env->cc_mask;",
"env->pregs[PR_CCS] |= VAR_0;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
11
],
[
13,
15,
17
],
[
23
],
[
25
],
[
27
],
[
29
]
]
|
14,935 | static int epzs_motion_search(MpegEncContext * s,
int *mx_ptr, int *my_ptr,
int P[5][2], int pred_x, int pred_y,
int xmin, int ymin, int xmax, int ymax, uint8_t * ref_picture)
{
int best[2]={0, 0};
int d, dmin;
UINT8 *new_pic, *old_pic;
const int pic_stride= s->linesize;
const int pic_xy= (s->mb_y*pic_stride + s->mb_x)*16;
UINT16 *mv_penalty= s->mv_penalty[s->f_code] + MAX_MV; // f_code of the prev frame
int quant= s->qscale; // qscale of the prev frame
const int shift= 1+s->quarter_sample;
new_pic = s->new_picture[0] + pic_xy;
old_pic = ref_picture + pic_xy;
dmin = pix_abs16x16(new_pic, old_pic, pic_stride);
if(dmin<Z_THRESHOLD){
*mx_ptr= 0;
*my_ptr= 0;
//printf("Z");
return dmin;
}
/* first line */
if ((s->mb_y == 0 || s->first_slice_line || s->first_gob_line)) {
CHECK_MV(P[1][0]>>shift, P[1][1]>>shift)
}else{
CHECK_MV(P[4][0]>>shift, P[4][1]>>shift)
if(dmin<Z_THRESHOLD){
*mx_ptr= P[4][0]>>shift;
*my_ptr= P[4][1]>>shift;
//printf("M\n");
return dmin;
}
CHECK_MV(P[1][0]>>shift, P[1][1]>>shift)
CHECK_MV(P[2][0]>>shift, P[2][1]>>shift)
CHECK_MV(P[3][0]>>shift, P[3][1]>>shift)
}
CHECK_MV(P[0][0]>>shift, P[0][1]>>shift)
//check(best[0],best[1],0, b0)
if(s->me_method==ME_EPZS)
dmin= small_diamond_search(s, best, dmin, new_pic, old_pic, pic_stride,
pred_x, pred_y, mv_penalty, quant, xmin, ymin, xmax, ymax, shift);
else
dmin= snake_search(s, best, dmin, new_pic, old_pic, pic_stride,
pred_x, pred_y, mv_penalty, quant, xmin, ymin, xmax, ymax, shift);
//check(best[0],best[1],0, b1)
*mx_ptr= best[0];
*my_ptr= best[1];
// printf("%d %d %d \n", best[0], best[1], dmin);
return dmin;
}
| false | FFmpeg | 0d21a84605bad4e75dacb8196e5859902ed36f01 | static int epzs_motion_search(MpegEncContext * s,
int *mx_ptr, int *my_ptr,
int P[5][2], int pred_x, int pred_y,
int xmin, int ymin, int xmax, int ymax, uint8_t * ref_picture)
{
int best[2]={0, 0};
int d, dmin;
UINT8 *new_pic, *old_pic;
const int pic_stride= s->linesize;
const int pic_xy= (s->mb_y*pic_stride + s->mb_x)*16;
UINT16 *mv_penalty= s->mv_penalty[s->f_code] + MAX_MV;
int quant= s->qscale;
const int shift= 1+s->quarter_sample;
new_pic = s->new_picture[0] + pic_xy;
old_pic = ref_picture + pic_xy;
dmin = pix_abs16x16(new_pic, old_pic, pic_stride);
if(dmin<Z_THRESHOLD){
*mx_ptr= 0;
*my_ptr= 0;
return dmin;
}
if ((s->mb_y == 0 || s->first_slice_line || s->first_gob_line)) {
CHECK_MV(P[1][0]>>shift, P[1][1]>>shift)
}else{
CHECK_MV(P[4][0]>>shift, P[4][1]>>shift)
if(dmin<Z_THRESHOLD){
*mx_ptr= P[4][0]>>shift;
*my_ptr= P[4][1]>>shift;
return dmin;
}
CHECK_MV(P[1][0]>>shift, P[1][1]>>shift)
CHECK_MV(P[2][0]>>shift, P[2][1]>>shift)
CHECK_MV(P[3][0]>>shift, P[3][1]>>shift)
}
CHECK_MV(P[0][0]>>shift, P[0][1]>>shift)
if(s->me_method==ME_EPZS)
dmin= small_diamond_search(s, best, dmin, new_pic, old_pic, pic_stride,
pred_x, pred_y, mv_penalty, quant, xmin, ymin, xmax, ymax, shift);
else
dmin= snake_search(s, best, dmin, new_pic, old_pic, pic_stride,
pred_x, pred_y, mv_penalty, quant, xmin, ymin, xmax, ymax, shift);
*mx_ptr= best[0];
*my_ptr= best[1];
return dmin;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(MpegEncContext * VAR_0,
int *VAR_1, int *VAR_2,
int VAR_3[5][2], int VAR_4, int VAR_5,
int VAR_6, int VAR_7, int VAR_8, int VAR_9, uint8_t * VAR_10)
{
int VAR_11[2]={0, 0};
int VAR_12, VAR_13;
UINT8 *new_pic, *old_pic;
const int VAR_14= VAR_0->linesize;
const int VAR_15= (VAR_0->mb_y*VAR_14 + VAR_0->mb_x)*16;
UINT16 *mv_penalty= VAR_0->mv_penalty[VAR_0->f_code] + MAX_MV;
int VAR_16= VAR_0->qscale;
const int VAR_17= 1+VAR_0->quarter_sample;
new_pic = VAR_0->new_picture[0] + VAR_15;
old_pic = VAR_10 + VAR_15;
VAR_13 = pix_abs16x16(new_pic, old_pic, VAR_14);
if(VAR_13<Z_THRESHOLD){
*VAR_1= 0;
*VAR_2= 0;
return VAR_13;
}
if ((VAR_0->mb_y == 0 || VAR_0->first_slice_line || VAR_0->first_gob_line)) {
CHECK_MV(VAR_3[1][0]>>VAR_17, VAR_3[1][1]>>VAR_17)
}else{
CHECK_MV(VAR_3[4][0]>>VAR_17, VAR_3[4][1]>>VAR_17)
if(VAR_13<Z_THRESHOLD){
*VAR_1= VAR_3[4][0]>>VAR_17;
*VAR_2= VAR_3[4][1]>>VAR_17;
return VAR_13;
}
CHECK_MV(VAR_3[1][0]>>VAR_17, VAR_3[1][1]>>VAR_17)
CHECK_MV(VAR_3[2][0]>>VAR_17, VAR_3[2][1]>>VAR_17)
CHECK_MV(VAR_3[3][0]>>VAR_17, VAR_3[3][1]>>VAR_17)
}
CHECK_MV(VAR_3[0][0]>>VAR_17, VAR_3[0][1]>>VAR_17)
if(VAR_0->me_method==ME_EPZS)
VAR_13= small_diamond_search(VAR_0, VAR_11, VAR_13, new_pic, old_pic, VAR_14,
VAR_4, VAR_5, mv_penalty, VAR_16, VAR_6, VAR_7, VAR_8, VAR_9, VAR_17);
else
VAR_13= snake_search(VAR_0, VAR_11, VAR_13, new_pic, old_pic, VAR_14,
VAR_4, VAR_5, mv_penalty, VAR_16, VAR_6, VAR_7, VAR_8, VAR_9, VAR_17);
*VAR_1= VAR_11[0];
*VAR_2= VAR_11[1];
return VAR_13;
}
| [
"static int FUNC_0(MpegEncContext * VAR_0,\nint *VAR_1, int *VAR_2,\nint VAR_3[5][2], int VAR_4, int VAR_5,\nint VAR_6, int VAR_7, int VAR_8, int VAR_9, uint8_t * VAR_10)\n{",
"int VAR_11[2]={0, 0};",
"int VAR_12, VAR_13;",
"UINT8 *new_pic, *old_pic;",
"const int VAR_14= VAR_0->linesize;",
"const int VAR_15= (VAR_0->mb_y*VAR_14 + VAR_0->mb_x)*16;",
"UINT16 *mv_penalty= VAR_0->mv_penalty[VAR_0->f_code] + MAX_MV;",
"int VAR_16= VAR_0->qscale;",
"const int VAR_17= 1+VAR_0->quarter_sample;",
"new_pic = VAR_0->new_picture[0] + VAR_15;",
"old_pic = VAR_10 + VAR_15;",
"VAR_13 = pix_abs16x16(new_pic, old_pic, VAR_14);",
"if(VAR_13<Z_THRESHOLD){",
"*VAR_1= 0;",
"*VAR_2= 0;",
"return VAR_13;",
"}",
"if ((VAR_0->mb_y == 0 || VAR_0->first_slice_line || VAR_0->first_gob_line)) {",
"CHECK_MV(VAR_3[1][0]>>VAR_17, VAR_3[1][1]>>VAR_17)\n}else{",
"CHECK_MV(VAR_3[4][0]>>VAR_17, VAR_3[4][1]>>VAR_17)\nif(VAR_13<Z_THRESHOLD){",
"*VAR_1= VAR_3[4][0]>>VAR_17;",
"*VAR_2= VAR_3[4][1]>>VAR_17;",
"return VAR_13;",
"}",
"CHECK_MV(VAR_3[1][0]>>VAR_17, VAR_3[1][1]>>VAR_17)\nCHECK_MV(VAR_3[2][0]>>VAR_17, VAR_3[2][1]>>VAR_17)\nCHECK_MV(VAR_3[3][0]>>VAR_17, VAR_3[3][1]>>VAR_17)\n}",
"CHECK_MV(VAR_3[0][0]>>VAR_17, VAR_3[0][1]>>VAR_17)\nif(VAR_0->me_method==ME_EPZS)\nVAR_13= small_diamond_search(VAR_0, VAR_11, VAR_13, new_pic, old_pic, VAR_14,\nVAR_4, VAR_5, mv_penalty, VAR_16, VAR_6, VAR_7, VAR_8, VAR_9, VAR_17);",
"else\nVAR_13= snake_search(VAR_0, VAR_11, VAR_13, new_pic, old_pic, VAR_14,\nVAR_4, VAR_5, mv_penalty, VAR_16, VAR_6, VAR_7, VAR_8, VAR_9, VAR_17);",
"*VAR_1= VAR_11[0];",
"*VAR_2= VAR_11[1];",
"return VAR_13;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
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
],
[
45
],
[
47
],
[
53
],
[
55,
57
],
[
59,
61
],
[
63
],
[
65
],
[
69
],
[
71
],
[
73,
75,
77,
79
],
[
81,
87,
89,
91
],
[
93,
95,
97
],
[
101
],
[
103
],
[
109
],
[
111
]
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.