id
int32 0
27.3k
| func
stringlengths 26
142k
| target
bool 2
classes | project
stringclasses 2
values | commit_id
stringlengths 40
40
| func_clean
stringlengths 26
131k
| vul_lines
dict | normalized_func
stringlengths 24
132k
| lines
sequencelengths 1
2.8k
| label
sequencelengths 1
2.8k
| line_no
sequencelengths 1
2.8k
|
---|---|---|---|---|---|---|---|---|---|---|
19,618 | static av_cold int libopus_decode_init(AVCodecContext *avc)
{
struct libopus_context *opus = avc->priv_data;
int ret, channel_map = 0, gain_db = 0, nb_streams, nb_coupled;
uint8_t mapping_arr[8] = { 0, 1 }, *mapping;
avc->sample_rate = 48000;
avc->sample_fmt = avc->request_sample_fmt == AV_SAMPLE_FMT_FLT ?
AV_SAMPLE_FMT_FLT : AV_SAMPLE_FMT_S16;
avc->channel_layout = avc->channels > 8 ? 0 :
ff_vorbis_channel_layouts[avc->channels - 1];
if (avc->extradata_size >= OPUS_HEAD_SIZE) {
gain_db = sign_extend(AV_RL16(avc->extradata + 16), 16);
channel_map = AV_RL8 (avc->extradata + 18);
if (avc->extradata_size >= OPUS_HEAD_SIZE + 2 + avc->channels) {
nb_streams = avc->extradata[OPUS_HEAD_SIZE + 0];
nb_coupled = avc->extradata[OPUS_HEAD_SIZE + 1];
if (nb_streams + nb_coupled != avc->channels)
av_log(avc, AV_LOG_WARNING, "Inconsistent channel mapping.\n");
mapping = avc->extradata + OPUS_HEAD_SIZE + 2;
} else {
if (avc->channels > 2 || channel_map) {
av_log(avc, AV_LOG_ERROR,
"No channel mapping for %d channels.\n", avc->channels);
return AVERROR(EINVAL);
nb_streams = 1;
nb_coupled = avc->channels > 1;
mapping = mapping_arr;
if (avc->channels > 2 && avc->channels <= 8) {
const uint8_t *vorbis_offset = ff_vorbis_channel_layout_offsets[avc->channels - 1];
int ch;
/* Remap channels from Vorbis order to libav order */
for (ch = 0; ch < avc->channels; ch++)
mapping_arr[ch] = mapping[vorbis_offset[ch]];
mapping = mapping_arr;
opus->dec = opus_multistream_decoder_create(avc->sample_rate, avc->channels,
nb_streams, nb_coupled,
mapping, &ret);
if (!opus->dec) {
av_log(avc, AV_LOG_ERROR, "Unable to create decoder: %s\n",
opus_strerror(ret));
return ff_opus_error_to_averror(ret);
ret = opus_multistream_decoder_ctl(opus->dec, OPUS_SET_GAIN(gain_db));
if (ret != OPUS_OK)
av_log(avc, AV_LOG_WARNING, "Failed to set gain: %s\n",
opus_strerror(ret));
avc->delay = 3840; /* Decoder delay (in samples) at 48kHz */
return 0; | true | FFmpeg | fc85646ad495f3418042468da415af73a7a07334 | static av_cold int libopus_decode_init(AVCodecContext *avc)
{
struct libopus_context *opus = avc->priv_data;
int ret, channel_map = 0, gain_db = 0, nb_streams, nb_coupled;
uint8_t mapping_arr[8] = { 0, 1 }, *mapping;
avc->sample_rate = 48000;
avc->sample_fmt = avc->request_sample_fmt == AV_SAMPLE_FMT_FLT ?
AV_SAMPLE_FMT_FLT : AV_SAMPLE_FMT_S16;
avc->channel_layout = avc->channels > 8 ? 0 :
ff_vorbis_channel_layouts[avc->channels - 1];
if (avc->extradata_size >= OPUS_HEAD_SIZE) {
gain_db = sign_extend(AV_RL16(avc->extradata + 16), 16);
channel_map = AV_RL8 (avc->extradata + 18);
if (avc->extradata_size >= OPUS_HEAD_SIZE + 2 + avc->channels) {
nb_streams = avc->extradata[OPUS_HEAD_SIZE + 0];
nb_coupled = avc->extradata[OPUS_HEAD_SIZE + 1];
if (nb_streams + nb_coupled != avc->channels)
av_log(avc, AV_LOG_WARNING, "Inconsistent channel mapping.\n");
mapping = avc->extradata + OPUS_HEAD_SIZE + 2;
} else {
if (avc->channels > 2 || channel_map) {
av_log(avc, AV_LOG_ERROR,
"No channel mapping for %d channels.\n", avc->channels);
return AVERROR(EINVAL);
nb_streams = 1;
nb_coupled = avc->channels > 1;
mapping = mapping_arr;
if (avc->channels > 2 && avc->channels <= 8) {
const uint8_t *vorbis_offset = ff_vorbis_channel_layout_offsets[avc->channels - 1];
int ch;
for (ch = 0; ch < avc->channels; ch++)
mapping_arr[ch] = mapping[vorbis_offset[ch]];
mapping = mapping_arr;
opus->dec = opus_multistream_decoder_create(avc->sample_rate, avc->channels,
nb_streams, nb_coupled,
mapping, &ret);
if (!opus->dec) {
av_log(avc, AV_LOG_ERROR, "Unable to create decoder: %s\n",
opus_strerror(ret));
return ff_opus_error_to_averror(ret);
ret = opus_multistream_decoder_ctl(opus->dec, OPUS_SET_GAIN(gain_db));
if (ret != OPUS_OK)
av_log(avc, AV_LOG_WARNING, "Failed to set gain: %s\n",
opus_strerror(ret));
avc->delay = 3840;
return 0; | {
"code": [],
"line_no": []
} | static av_cold int FUNC_0(AVCodecContext *avc)
{
struct libopus_context *VAR_0 = avc->priv_data;
int VAR_1, VAR_2 = 0, VAR_3 = 0, VAR_4, VAR_5;
uint8_t mapping_arr[8] = { 0, 1 }, *mapping;
avc->sample_rate = 48000;
avc->sample_fmt = avc->request_sample_fmt == AV_SAMPLE_FMT_FLT ?
AV_SAMPLE_FMT_FLT : AV_SAMPLE_FMT_S16;
avc->channel_layout = avc->channels > 8 ? 0 :
ff_vorbis_channel_layouts[avc->channels - 1];
if (avc->extradata_size >= OPUS_HEAD_SIZE) {
VAR_3 = sign_extend(AV_RL16(avc->extradata + 16), 16);
VAR_2 = AV_RL8 (avc->extradata + 18);
if (avc->extradata_size >= OPUS_HEAD_SIZE + 2 + avc->channels) {
VAR_4 = avc->extradata[OPUS_HEAD_SIZE + 0];
VAR_5 = avc->extradata[OPUS_HEAD_SIZE + 1];
if (VAR_4 + VAR_5 != avc->channels)
av_log(avc, AV_LOG_WARNING, "Inconsistent channel mapping.\n");
mapping = avc->extradata + OPUS_HEAD_SIZE + 2;
} else {
if (avc->channels > 2 || VAR_2) {
av_log(avc, AV_LOG_ERROR,
"No channel mapping for %d channels.\n", avc->channels);
return AVERROR(EINVAL);
VAR_4 = 1;
VAR_5 = avc->channels > 1;
mapping = mapping_arr;
if (avc->channels > 2 && avc->channels <= 8) {
const uint8_t *VAR_6 = ff_vorbis_channel_layout_offsets[avc->channels - 1];
int VAR_7;
for (VAR_7 = 0; VAR_7 < avc->channels; VAR_7++)
mapping_arr[VAR_7] = mapping[VAR_6[VAR_7]];
mapping = mapping_arr;
VAR_0->dec = opus_multistream_decoder_create(avc->sample_rate, avc->channels,
VAR_4, VAR_5,
mapping, &VAR_1);
if (!VAR_0->dec) {
av_log(avc, AV_LOG_ERROR, "Unable to create decoder: %s\n",
opus_strerror(VAR_1));
return ff_opus_error_to_averror(VAR_1);
VAR_1 = opus_multistream_decoder_ctl(VAR_0->dec, OPUS_SET_GAIN(VAR_3));
if (VAR_1 != OPUS_OK)
av_log(avc, AV_LOG_WARNING, "Failed to set gain: %s\n",
opus_strerror(VAR_1));
avc->delay = 3840;
return 0; | [
"static av_cold int FUNC_0(AVCodecContext *avc)\n{",
"struct libopus_context *VAR_0 = avc->priv_data;",
"int VAR_1, VAR_2 = 0, VAR_3 = 0, VAR_4, VAR_5;",
"uint8_t mapping_arr[8] = { 0, 1 }, *mapping;",
"avc->sample_rate = 48000;",
"avc->sample_fmt = avc->request_sample_fmt == AV_SAMPLE_FMT_FLT ?\nAV_SAMPLE_FMT_FLT : AV_SAMPLE_FMT_S16;",
"avc->channel_layout = avc->channels > 8 ? 0 :\nff_vorbis_channel_layouts[avc->channels - 1];",
"if (avc->extradata_size >= OPUS_HEAD_SIZE) {",
"VAR_3 = sign_extend(AV_RL16(avc->extradata + 16), 16);",
"VAR_2 = AV_RL8 (avc->extradata + 18);",
"if (avc->extradata_size >= OPUS_HEAD_SIZE + 2 + avc->channels) {",
"VAR_4 = avc->extradata[OPUS_HEAD_SIZE + 0];",
"VAR_5 = avc->extradata[OPUS_HEAD_SIZE + 1];",
"if (VAR_4 + VAR_5 != avc->channels)\nav_log(avc, AV_LOG_WARNING, \"Inconsistent channel mapping.\\n\");",
"mapping = avc->extradata + OPUS_HEAD_SIZE + 2;",
"} else {",
"if (avc->channels > 2 || VAR_2) {",
"av_log(avc, AV_LOG_ERROR,\n\"No channel mapping for %d channels.\\n\", avc->channels);",
"return AVERROR(EINVAL);",
"VAR_4 = 1;",
"VAR_5 = avc->channels > 1;",
"mapping = mapping_arr;",
"if (avc->channels > 2 && avc->channels <= 8) {",
"const uint8_t *VAR_6 = ff_vorbis_channel_layout_offsets[avc->channels - 1];",
"int VAR_7;",
"for (VAR_7 = 0; VAR_7 < avc->channels; VAR_7++)",
"mapping_arr[VAR_7] = mapping[VAR_6[VAR_7]];",
"mapping = mapping_arr;",
"VAR_0->dec = opus_multistream_decoder_create(avc->sample_rate, avc->channels,\nVAR_4, VAR_5,\nmapping, &VAR_1);",
"if (!VAR_0->dec) {",
"av_log(avc, AV_LOG_ERROR, \"Unable to create decoder: %s\\n\",\nopus_strerror(VAR_1));",
"return ff_opus_error_to_averror(VAR_1);",
"VAR_1 = opus_multistream_decoder_ctl(VAR_0->dec, OPUS_SET_GAIN(VAR_3));",
"if (VAR_1 != OPUS_OK)\nav_log(avc, AV_LOG_WARNING, \"Failed to set gain: %s\\n\",\nopus_strerror(VAR_1));",
"avc->delay = 3840;",
"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
] | [
[
1,
2
],
[
3
],
[
4
],
[
5
],
[
6
],
[
7,
8
],
[
9,
10
],
[
11
],
[
12
],
[
13
],
[
14
],
[
15
],
[
16
],
[
17,
18
],
[
19
],
[
20
],
[
21
],
[
22,
23
],
[
24
],
[
25
],
[
26
],
[
27
],
[
28
],
[
29
],
[
30
],
[
32
],
[
33
],
[
34
],
[
35,
36,
37
],
[
38
],
[
39,
40
],
[
41
],
[
42
],
[
43,
44,
45
],
[
46
],
[
47
]
] |
19,619 | gen_intermediate_code_internal(CPUCRISState *env, TranslationBlock *tb,
int search_pc)
{
uint16_t *gen_opc_end;
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;
qemu_log_try_set_file(stderr);
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->env = env;
dc->tb = tb;
gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;
dc->is_jmp = DISAS_NEXT;
dc->ppc = pc_start;
dc->pc = pc_start;
dc->singlestep_enabled = env->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_icount_start();
do {
check_breakpoint(env, dc);
if (search_pc) {
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
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) && env->singlestep_enabled) {
break;
}
} while (!dc->is_jmp && !dc->cpustate_changed
&& tcg_ctx.gen_opc_ptr < gen_opc_end
&& !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(env->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_icount_end(tb, num_insns);
*tcg_ctx.gen_opc_ptr = INDEX_op_end;
if (search_pc) {
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
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,
dc->env->pregs[PR_VR]);
qemu_log("\nisize=%d osize=%td\n",
dc->pc - pc_start, tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf);
}
#endif
#endif
}
| true | qemu | 632314c49ce20ee9c974f07544d9125fbbbfbe1b | gen_intermediate_code_internal(CPUCRISState *env, TranslationBlock *tb,
int search_pc)
{
uint16_t *gen_opc_end;
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;
qemu_log_try_set_file(stderr);
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->env = env;
dc->tb = tb;
gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;
dc->is_jmp = DISAS_NEXT;
dc->ppc = pc_start;
dc->pc = pc_start;
dc->singlestep_enabled = env->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_icount_start();
do {
check_breakpoint(env, dc);
if (search_pc) {
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
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) && env->singlestep_enabled) {
break;
}
} while (!dc->is_jmp && !dc->cpustate_changed
&& tcg_ctx.gen_opc_ptr < gen_opc_end
&& !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(env->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_icount_end(tb, num_insns);
*tcg_ctx.gen_opc_ptr = INDEX_op_end;
if (search_pc) {
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
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,
dc->env->pregs[PR_VR]);
qemu_log("\nisize=%d osize=%td\n",
dc->pc - pc_start, tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf);
}
#endif
#endif
}
| {
"code": [
" qemu_log_try_set_file(stderr);",
" qemu_log_try_set_file(stderr);",
" qemu_log_try_set_file(stderr);",
" qemu_log_try_set_file(stderr);"
],
"line_no": [
29,
29,
29,
29
]
} | FUNC_0(CPUCRISState *VAR_0, TranslationBlock *VAR_1,
int VAR_2)
{
uint16_t *gen_opc_end;
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;
qemu_log_try_set_file(stderr);
if (VAR_0->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;
gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;
VAR_7->is_jmp = DISAS_NEXT;
VAR_7->ppc = pc_start;
VAR_7->pc = pc_start;
VAR_7->singlestep_enabled = VAR_0->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,
VAR_0->btarget, (unsigned)VAR_1->flags & 7,
VAR_0->pregs[PR_CCS],
VAR_0->pregs[PR_PID], VAR_0->pregs[PR_USP],
VAR_0->regs[0], VAR_0->regs[1], VAR_0->regs[2], VAR_0->regs[3],
VAR_0->regs[4], VAR_0->regs[5], VAR_0->regs[6], VAR_0->regs[7],
VAR_0->regs[8], VAR_0->regs[9],
VAR_0->regs[10], VAR_0->regs[11],
VAR_0->regs[12], VAR_0->regs[13],
VAR_0->regs[14], VAR_0->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_icount_start();
do {
check_breakpoint(VAR_0, VAR_7);
if (VAR_2) {
VAR_4 = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
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(VAR_0, 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) && VAR_0->singlestep_enabled) {
break;
}
} while (!VAR_7->is_jmp && !VAR_7->cpustate_changed
&& tcg_ctx.gen_opc_ptr < gen_opc_end
&& !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(VAR_0->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_icount_end(VAR_1, VAR_8);
*tcg_ctx.gen_opc_ptr = INDEX_op_end;
if (VAR_2) {
VAR_4 = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
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(VAR_0, pc_start, VAR_7->pc - pc_start,
VAR_7->VAR_0->pregs[PR_VR]);
qemu_log("\nisize=%d osize=%td\n",
VAR_7->pc - pc_start, tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf);
}
#endif
#endif
}
| [
"FUNC_0(CPUCRISState *VAR_0, TranslationBlock *VAR_1,\nint VAR_2)\n{",
"uint16_t *gen_opc_end;",
"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;",
"qemu_log_try_set_file(stderr);",
"if (VAR_0->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;",
"gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;",
"VAR_7->is_jmp = DISAS_NEXT;",
"VAR_7->ppc = pc_start;",
"VAR_7->pc = pc_start;",
"VAR_7->singlestep_enabled = VAR_0->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,\nVAR_0->btarget, (unsigned)VAR_1->flags & 7,\nVAR_0->pregs[PR_CCS],\nVAR_0->pregs[PR_PID], VAR_0->pregs[PR_USP],\nVAR_0->regs[0], VAR_0->regs[1], VAR_0->regs[2], VAR_0->regs[3],\nVAR_0->regs[4], VAR_0->regs[5], VAR_0->regs[6], VAR_0->regs[7],\nVAR_0->regs[8], VAR_0->regs[9],\nVAR_0->regs[10], VAR_0->regs[11],\nVAR_0->regs[12], VAR_0->regs[13],\nVAR_0->regs[14], VAR_0->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_icount_start();",
"do {",
"check_breakpoint(VAR_0, VAR_7);",
"if (VAR_2) {",
"VAR_4 = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;",
"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(VAR_0, 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) && VAR_0->singlestep_enabled) {",
"break;",
"}",
"} while (!VAR_7->is_jmp && !VAR_7->cpustate_changed",
"&& tcg_ctx.gen_opc_ptr < gen_opc_end\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(VAR_0->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_icount_end(VAR_1, VAR_8);",
"*tcg_ctx.gen_opc_ptr = INDEX_op_end;",
"if (VAR_2) {",
"VAR_4 = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;",
"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(VAR_0, pc_start, VAR_7->pc - pc_start,\nVAR_7->VAR_0->pregs[PR_VR]);",
"qemu_log(\"\\nisize=%d osize=%td\\n\",\nVAR_7->pc - pc_start, tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf);",
"}",
"#endif\n#endif\n}"
] | [
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
] | [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
29
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
55
],
[
57
],
[
59
],
[
63
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
91
],
[
93
],
[
99,
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
117
],
[
121
],
[
123,
125,
127,
129,
131,
133,
135,
137,
139,
141,
143,
145,
147,
149,
151,
153,
155,
157
],
[
159
],
[
161
],
[
163
],
[
167
],
[
169
],
[
171
],
[
173
],
[
175
],
[
177
],
[
179
],
[
183
],
[
185
],
[
187
],
[
191
],
[
193
],
[
195
],
[
197
],
[
199
],
[
201
],
[
203
],
[
205
],
[
207
],
[
209
],
[
211
],
[
213
],
[
215
],
[
217
],
[
219
],
[
221
],
[
227
],
[
231
],
[
233
],
[
235
],
[
237
],
[
241
],
[
243
],
[
245
],
[
247
],
[
249
],
[
251
],
[
255
],
[
263
],
[
265
],
[
267
],
[
269
],
[
271
],
[
273
],
[
275,
277
],
[
279
],
[
281
],
[
285
],
[
287
],
[
289
],
[
291
],
[
295
],
[
297
],
[
301
],
[
303
],
[
309,
311
],
[
313
],
[
315
],
[
317
],
[
319
],
[
321
],
[
323
],
[
325
],
[
327
],
[
329
],
[
331
],
[
333
],
[
335
],
[
337
],
[
339
],
[
341
],
[
343
],
[
345
],
[
353
],
[
355
],
[
357
],
[
359
],
[
361,
363,
365,
367
],
[
371
],
[
373
],
[
375
],
[
379
],
[
383,
385
],
[
389,
391,
393
],
[
395
],
[
397
],
[
399
],
[
403
],
[
407
],
[
409
],
[
411
],
[
415
],
[
419
],
[
421
],
[
423
],
[
425
],
[
427
],
[
429
],
[
431
],
[
433,
435
],
[
437
],
[
439,
441,
443,
449
],
[
451
],
[
453,
455,
459
],
[
461
],
[
463
],
[
465
],
[
467
],
[
469
],
[
471
],
[
473
],
[
475
],
[
477
],
[
479
],
[
481
],
[
483
],
[
485
],
[
487
],
[
491,
493,
495
],
[
497,
499
],
[
501,
503
],
[
505
],
[
507,
509,
511
]
] |
19,621 | int fw_cfg_add_callback(FWCfgState *s, uint16_t key, FWCfgCallback callback,
void *callback_opaque, uint8_t *data, size_t len)
{
int arch = !!(key & FW_CFG_ARCH_LOCAL);
if (!(key & FW_CFG_WRITE_CHANNEL))
return 0;
key &= FW_CFG_ENTRY_MASK;
if (key >= FW_CFG_MAX_ENTRY || len > 65535)
return 0;
s->entries[arch][key].data = data;
s->entries[arch][key].len = len;
s->entries[arch][key].callback_opaque = callback_opaque;
s->entries[arch][key].callback = callback;
return 1;
}
| true | qemu | 4cad3867b6df2c0826ae508a9fe15dd0b9d8936a | int fw_cfg_add_callback(FWCfgState *s, uint16_t key, FWCfgCallback callback,
void *callback_opaque, uint8_t *data, size_t len)
{
int arch = !!(key & FW_CFG_ARCH_LOCAL);
if (!(key & FW_CFG_WRITE_CHANNEL))
return 0;
key &= FW_CFG_ENTRY_MASK;
if (key >= FW_CFG_MAX_ENTRY || len > 65535)
return 0;
s->entries[arch][key].data = data;
s->entries[arch][key].len = len;
s->entries[arch][key].callback_opaque = callback_opaque;
s->entries[arch][key].callback = callback;
return 1;
}
| {
"code": [
" return 0;",
" return 1;",
"int fw_cfg_add_callback(FWCfgState *s, uint16_t key, FWCfgCallback callback,",
" void *callback_opaque, uint8_t *data, size_t len)",
" if (!(key & FW_CFG_WRITE_CHANNEL))",
" return 0;",
" if (key >= FW_CFG_MAX_ENTRY || len > 65535)",
" return 0;",
" return 1;",
" return 0;",
" return 1;",
"int fw_cfg_add_callback(FWCfgState *s, uint16_t key, FWCfgCallback callback,"
],
"line_no": [
13,
37,
1,
3,
11,
13,
21,
13,
37,
13,
37,
1
]
} | int FUNC_0(FWCfgState *VAR_0, uint16_t VAR_1, FWCfgCallback VAR_2,
void *VAR_3, uint8_t *VAR_4, size_t VAR_5)
{
int VAR_6 = !!(VAR_1 & FW_CFG_ARCH_LOCAL);
if (!(VAR_1 & FW_CFG_WRITE_CHANNEL))
return 0;
VAR_1 &= FW_CFG_ENTRY_MASK;
if (VAR_1 >= FW_CFG_MAX_ENTRY || VAR_5 > 65535)
return 0;
VAR_0->entries[VAR_6][VAR_1].VAR_4 = VAR_4;
VAR_0->entries[VAR_6][VAR_1].VAR_5 = VAR_5;
VAR_0->entries[VAR_6][VAR_1].VAR_3 = VAR_3;
VAR_0->entries[VAR_6][VAR_1].VAR_2 = VAR_2;
return 1;
}
| [
"int FUNC_0(FWCfgState *VAR_0, uint16_t VAR_1, FWCfgCallback VAR_2,\nvoid *VAR_3, uint8_t *VAR_4, size_t VAR_5)\n{",
"int VAR_6 = !!(VAR_1 & FW_CFG_ARCH_LOCAL);",
"if (!(VAR_1 & FW_CFG_WRITE_CHANNEL))\nreturn 0;",
"VAR_1 &= FW_CFG_ENTRY_MASK;",
"if (VAR_1 >= FW_CFG_MAX_ENTRY || VAR_5 > 65535)\nreturn 0;",
"VAR_0->entries[VAR_6][VAR_1].VAR_4 = VAR_4;",
"VAR_0->entries[VAR_6][VAR_1].VAR_5 = VAR_5;",
"VAR_0->entries[VAR_6][VAR_1].VAR_3 = VAR_3;",
"VAR_0->entries[VAR_6][VAR_1].VAR_2 = VAR_2;",
"return 1;",
"}"
] | [
1,
0,
1,
0,
1,
0,
0,
0,
0,
1,
0
] | [
[
1,
3,
5
],
[
7
],
[
11,
13
],
[
17
],
[
21,
23
],
[
27
],
[
29
],
[
31
],
[
33
],
[
37
],
[
39
]
] |
19,622 | void do_subfmeo_64 (void)
{
T1 = T0;
T0 = ~T0 + xer_ca - 1;
if (likely(!((uint64_t)~T1 & ((uint64_t)~T1 ^ (uint64_t)T0) &
(1ULL << 63)))) {
xer_ov = 0;
} else {
xer_so = 1;
xer_ov = 1;
}
if (likely((uint64_t)T1 != UINT64_MAX))
xer_ca = 1;
}
| true | qemu | 966439a67830239a6c520c5df6c55627b8153c8b | void do_subfmeo_64 (void)
{
T1 = T0;
T0 = ~T0 + xer_ca - 1;
if (likely(!((uint64_t)~T1 & ((uint64_t)~T1 ^ (uint64_t)T0) &
(1ULL << 63)))) {
xer_ov = 0;
} else {
xer_so = 1;
xer_ov = 1;
}
if (likely((uint64_t)T1 != UINT64_MAX))
xer_ca = 1;
}
| {
"code": [
" xer_so = 1;",
" xer_so = 1;",
" xer_so = 1;",
" xer_so = 1;",
" xer_so = 1;",
" xer_so = 1;",
" xer_so = 1;",
" xer_so = 1;",
" xer_so = 1;",
" xer_so = 1;",
" xer_so = 1;",
" xer_so = 1;"
],
"line_no": [
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17
]
} | void FUNC_0 (void)
{
T1 = T0;
T0 = ~T0 + xer_ca - 1;
if (likely(!((uint64_t)~T1 & ((uint64_t)~T1 ^ (uint64_t)T0) &
(1ULL << 63)))) {
xer_ov = 0;
} else {
xer_so = 1;
xer_ov = 1;
}
if (likely((uint64_t)T1 != UINT64_MAX))
xer_ca = 1;
}
| [
"void FUNC_0 (void)\n{",
"T1 = T0;",
"T0 = ~T0 + xer_ca - 1;",
"if (likely(!((uint64_t)~T1 & ((uint64_t)~T1 ^ (uint64_t)T0) &\n(1ULL << 63)))) {",
"xer_ov = 0;",
"} else {",
"xer_so = 1;",
"xer_ov = 1;",
"}",
"if (likely((uint64_t)T1 != UINT64_MAX))\nxer_ca = 1;",
"}"
] | [
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9,
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23,
25
],
[
27
]
] |
19,623 | static void jpeg2000_dec_cleanup(Jpeg2000DecoderContext *s)
{
int tileno, compno;
for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++) {
if (s->tile[tileno].comp) {
for (compno = 0; compno < s->ncomponents; compno++) {
Jpeg2000Component *comp = s->tile[tileno].comp + compno;
Jpeg2000CodingStyle *codsty = s->tile[tileno].codsty + compno;
ff_jpeg2000_cleanup(comp, codsty);
}
av_freep(&s->tile[tileno].comp);
}
}
av_freep(&s->tile);
s->numXtiles = s->numYtiles = 0;
} | true | FFmpeg | fcd19d6c8db514b017662166d014ac8560fbe8f5 | static void jpeg2000_dec_cleanup(Jpeg2000DecoderContext *s)
{
int tileno, compno;
for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++) {
if (s->tile[tileno].comp) {
for (compno = 0; compno < s->ncomponents; compno++) {
Jpeg2000Component *comp = s->tile[tileno].comp + compno;
Jpeg2000CodingStyle *codsty = s->tile[tileno].codsty + compno;
ff_jpeg2000_cleanup(comp, codsty);
}
av_freep(&s->tile[tileno].comp);
}
}
av_freep(&s->tile);
s->numXtiles = s->numYtiles = 0;
} | {
"code": [],
"line_no": []
} | static void FUNC_0(Jpeg2000DecoderContext *VAR_0)
{
int VAR_1, VAR_2;
for (VAR_1 = 0; VAR_1 < VAR_0->numXtiles * VAR_0->numYtiles; VAR_1++) {
if (VAR_0->tile[VAR_1].comp) {
for (VAR_2 = 0; VAR_2 < VAR_0->ncomponents; VAR_2++) {
Jpeg2000Component *comp = VAR_0->tile[VAR_1].comp + VAR_2;
Jpeg2000CodingStyle *codsty = VAR_0->tile[VAR_1].codsty + VAR_2;
ff_jpeg2000_cleanup(comp, codsty);
}
av_freep(&VAR_0->tile[VAR_1].comp);
}
}
av_freep(&VAR_0->tile);
VAR_0->numXtiles = VAR_0->numYtiles = 0;
} | [
"static void FUNC_0(Jpeg2000DecoderContext *VAR_0)\n{",
"int VAR_1, VAR_2;",
"for (VAR_1 = 0; VAR_1 < VAR_0->numXtiles * VAR_0->numYtiles; VAR_1++) {",
"if (VAR_0->tile[VAR_1].comp) {",
"for (VAR_2 = 0; VAR_2 < VAR_0->ncomponents; VAR_2++) {",
"Jpeg2000Component *comp = VAR_0->tile[VAR_1].comp + VAR_2;",
"Jpeg2000CodingStyle *codsty = VAR_0->tile[VAR_1].codsty + VAR_2;",
"ff_jpeg2000_cleanup(comp, codsty);",
"}",
"av_freep(&VAR_0->tile[VAR_1].comp);",
"}",
"}",
"av_freep(&VAR_0->tile);",
"VAR_0->numXtiles = VAR_0->numYtiles = 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
],
[
33
],
[
35
]
] |
19,624 | static void quantize_and_encode_band_cost_ESC_mips(struct AACEncContext *s,
PutBitContext *pb, const float *in, float *out,
const float *scaled, int size, int scale_idx,
int cb, const float lambda, const float uplim,
int *bits, const float ROUNDING)
{
const float Q34 = ff_aac_pow34sf_tab[POW_SF2_ZERO - scale_idx + SCALE_ONE_POS - SCALE_DIV_512];
const float IQ = ff_aac_pow2sf_tab [POW_SF2_ZERO + scale_idx - SCALE_ONE_POS + SCALE_DIV_512];
int i;
int qc1, qc2, qc3, qc4;
uint8_t *p_bits = (uint8_t* )ff_aac_spectral_bits[cb-1];
uint16_t *p_codes = (uint16_t*)ff_aac_spectral_codes[cb-1];
float *p_vectors = (float* )ff_aac_codebook_vectors[cb-1];
abs_pow34_v(s->scoefs, in, size);
scaled = s->scoefs;
if (cb < 11) {
for (i = 0; i < size; i += 4) {
int curidx, curidx2, sign1, count1, sign2, count2;
int *in_int = (int *)&in[i];
uint8_t v_bits;
unsigned int v_codes;
int t0, t1, t2, t3, t4;
const float *vec1, *vec2;
qc1 = scaled[i ] * Q34 + ROUNDING;
qc2 = scaled[i+1] * Q34 + ROUNDING;
qc3 = scaled[i+2] * Q34 + ROUNDING;
qc4 = scaled[i+3] * Q34 + ROUNDING;
__asm__ volatile (
".set push \n\t"
".set noreorder \n\t"
"ori %[t4], $zero, 16 \n\t"
"ori %[sign1], $zero, 0 \n\t"
"ori %[sign2], $zero, 0 \n\t"
"slt %[t0], %[t4], %[qc1] \n\t"
"slt %[t1], %[t4], %[qc2] \n\t"
"slt %[t2], %[t4], %[qc3] \n\t"
"slt %[t3], %[t4], %[qc4] \n\t"
"movn %[qc1], %[t4], %[t0] \n\t"
"movn %[qc2], %[t4], %[t1] \n\t"
"movn %[qc3], %[t4], %[t2] \n\t"
"movn %[qc4], %[t4], %[t3] \n\t"
"lw %[t0], 0(%[in_int]) \n\t"
"lw %[t1], 4(%[in_int]) \n\t"
"lw %[t2], 8(%[in_int]) \n\t"
"lw %[t3], 12(%[in_int]) \n\t"
"slt %[t0], %[t0], $zero \n\t"
"movn %[sign1], %[t0], %[qc1] \n\t"
"slt %[t2], %[t2], $zero \n\t"
"movn %[sign2], %[t2], %[qc3] \n\t"
"slt %[t1], %[t1], $zero \n\t"
"sll %[t0], %[sign1], 1 \n\t"
"or %[t0], %[t0], %[t1] \n\t"
"movn %[sign1], %[t0], %[qc2] \n\t"
"slt %[t3], %[t3], $zero \n\t"
"sll %[t0], %[sign2], 1 \n\t"
"or %[t0], %[t0], %[t3] \n\t"
"movn %[sign2], %[t0], %[qc4] \n\t"
"slt %[count1], $zero, %[qc1] \n\t"
"slt %[t1], $zero, %[qc2] \n\t"
"slt %[count2], $zero, %[qc3] \n\t"
"slt %[t2], $zero, %[qc4] \n\t"
"addu %[count1], %[count1], %[t1] \n\t"
"addu %[count2], %[count2], %[t2] \n\t"
".set pop \n\t"
: [qc1]"+r"(qc1), [qc2]"+r"(qc2),
[qc3]"+r"(qc3), [qc4]"+r"(qc4),
[sign1]"=&r"(sign1), [count1]"=&r"(count1),
[sign2]"=&r"(sign2), [count2]"=&r"(count2),
[t0]"=&r"(t0), [t1]"=&r"(t1), [t2]"=&r"(t2), [t3]"=&r"(t3),
[t4]"=&r"(t4)
: [in_int]"r"(in_int)
: "memory"
);
curidx = 17 * qc1;
curidx += qc2;
curidx2 = 17 * qc3;
curidx2 += qc4;
v_codes = (p_codes[curidx] << count1) | sign1;
v_bits = p_bits[curidx] + count1;
put_bits(pb, v_bits, v_codes);
v_codes = (p_codes[curidx2] << count2) | sign2;
v_bits = p_bits[curidx2] + count2;
put_bits(pb, v_bits, v_codes);
if (out) {
vec1 = &p_vectors[curidx*2 ];
vec2 = &p_vectors[curidx2*2];
out[i+0] = copysignf(vec1[0] * IQ, in[i+0]);
out[i+1] = copysignf(vec1[1] * IQ, in[i+1]);
out[i+2] = copysignf(vec2[0] * IQ, in[i+2]);
out[i+3] = copysignf(vec2[1] * IQ, in[i+3]);
}
}
} else {
for (i = 0; i < size; i += 4) {
int curidx, curidx2, sign1, count1, sign2, count2;
int *in_int = (int *)&in[i];
uint8_t v_bits;
unsigned int v_codes;
int c1, c2, c3, c4;
int t0, t1, t2, t3, t4;
const float *vec1, *vec2;
qc1 = scaled[i ] * Q34 + ROUNDING;
qc2 = scaled[i+1] * Q34 + ROUNDING;
qc3 = scaled[i+2] * Q34 + ROUNDING;
qc4 = scaled[i+3] * Q34 + ROUNDING;
__asm__ volatile (
".set push \n\t"
".set noreorder \n\t"
"ori %[t4], $zero, 16 \n\t"
"ori %[sign1], $zero, 0 \n\t"
"ori %[sign2], $zero, 0 \n\t"
"shll_s.w %[c1], %[qc1], 18 \n\t"
"shll_s.w %[c2], %[qc2], 18 \n\t"
"shll_s.w %[c3], %[qc3], 18 \n\t"
"shll_s.w %[c4], %[qc4], 18 \n\t"
"srl %[c1], %[c1], 18 \n\t"
"srl %[c2], %[c2], 18 \n\t"
"srl %[c3], %[c3], 18 \n\t"
"srl %[c4], %[c4], 18 \n\t"
"slt %[t0], %[t4], %[qc1] \n\t"
"slt %[t1], %[t4], %[qc2] \n\t"
"slt %[t2], %[t4], %[qc3] \n\t"
"slt %[t3], %[t4], %[qc4] \n\t"
"movn %[qc1], %[t4], %[t0] \n\t"
"movn %[qc2], %[t4], %[t1] \n\t"
"movn %[qc3], %[t4], %[t2] \n\t"
"movn %[qc4], %[t4], %[t3] \n\t"
"lw %[t0], 0(%[in_int]) \n\t"
"lw %[t1], 4(%[in_int]) \n\t"
"lw %[t2], 8(%[in_int]) \n\t"
"lw %[t3], 12(%[in_int]) \n\t"
"slt %[t0], %[t0], $zero \n\t"
"movn %[sign1], %[t0], %[qc1] \n\t"
"slt %[t2], %[t2], $zero \n\t"
"movn %[sign2], %[t2], %[qc3] \n\t"
"slt %[t1], %[t1], $zero \n\t"
"sll %[t0], %[sign1], 1 \n\t"
"or %[t0], %[t0], %[t1] \n\t"
"movn %[sign1], %[t0], %[qc2] \n\t"
"slt %[t3], %[t3], $zero \n\t"
"sll %[t0], %[sign2], 1 \n\t"
"or %[t0], %[t0], %[t3] \n\t"
"movn %[sign2], %[t0], %[qc4] \n\t"
"slt %[count1], $zero, %[qc1] \n\t"
"slt %[t1], $zero, %[qc2] \n\t"
"slt %[count2], $zero, %[qc3] \n\t"
"slt %[t2], $zero, %[qc4] \n\t"
"addu %[count1], %[count1], %[t1] \n\t"
"addu %[count2], %[count2], %[t2] \n\t"
".set pop \n\t"
: [qc1]"+r"(qc1), [qc2]"+r"(qc2),
[qc3]"+r"(qc3), [qc4]"+r"(qc4),
[sign1]"=&r"(sign1), [count1]"=&r"(count1),
[sign2]"=&r"(sign2), [count2]"=&r"(count2),
[c1]"=&r"(c1), [c2]"=&r"(c2),
[c3]"=&r"(c3), [c4]"=&r"(c4),
[t0]"=&r"(t0), [t1]"=&r"(t1), [t2]"=&r"(t2), [t3]"=&r"(t3),
[t4]"=&r"(t4)
: [in_int]"r"(in_int)
: "memory"
);
curidx = 17 * qc1;
curidx += qc2;
curidx2 = 17 * qc3;
curidx2 += qc4;
v_codes = (p_codes[curidx] << count1) | sign1;
v_bits = p_bits[curidx] + count1;
put_bits(pb, v_bits, v_codes);
if (p_vectors[curidx*2 ] == 64.0f) {
int len = av_log2(c1);
v_codes = (((1 << (len - 3)) - 2) << len) | (c1 & ((1 << len) - 1));
put_bits(pb, len * 2 - 3, v_codes);
}
if (p_vectors[curidx*2+1] == 64.0f) {
int len = av_log2(c2);
v_codes = (((1 << (len - 3)) - 2) << len) | (c2 & ((1 << len) - 1));
put_bits(pb, len*2-3, v_codes);
}
v_codes = (p_codes[curidx2] << count2) | sign2;
v_bits = p_bits[curidx2] + count2;
put_bits(pb, v_bits, v_codes);
if (p_vectors[curidx2*2 ] == 64.0f) {
int len = av_log2(c3);
v_codes = (((1 << (len - 3)) - 2) << len) | (c3 & ((1 << len) - 1));
put_bits(pb, len* 2 - 3, v_codes);
}
if (p_vectors[curidx2*2+1] == 64.0f) {
int len = av_log2(c4);
v_codes = (((1 << (len - 3)) - 2) << len) | (c4 & ((1 << len) - 1));
put_bits(pb, len * 2 - 3, v_codes);
}
if (out) {
vec1 = &p_vectors[curidx*2];
vec2 = &p_vectors[curidx2*2];
out[i+0] = copysignf(c1 * cbrtf(c1) * IQ, in[i+0]);
out[i+1] = copysignf(c2 * cbrtf(c2) * IQ, in[i+1]);
out[i+2] = copysignf(c3 * cbrtf(c3) * IQ, in[i+2]);
out[i+3] = copysignf(c4 * cbrtf(c4) * IQ, in[i+3]);
}
}
}
}
| true | FFmpeg | 01ecb7172b684f1c4b3e748f95c5a9a494ca36ec | static void quantize_and_encode_band_cost_ESC_mips(struct AACEncContext *s,
PutBitContext *pb, const float *in, float *out,
const float *scaled, int size, int scale_idx,
int cb, const float lambda, const float uplim,
int *bits, const float ROUNDING)
{
const float Q34 = ff_aac_pow34sf_tab[POW_SF2_ZERO - scale_idx + SCALE_ONE_POS - SCALE_DIV_512];
const float IQ = ff_aac_pow2sf_tab [POW_SF2_ZERO + scale_idx - SCALE_ONE_POS + SCALE_DIV_512];
int i;
int qc1, qc2, qc3, qc4;
uint8_t *p_bits = (uint8_t* )ff_aac_spectral_bits[cb-1];
uint16_t *p_codes = (uint16_t*)ff_aac_spectral_codes[cb-1];
float *p_vectors = (float* )ff_aac_codebook_vectors[cb-1];
abs_pow34_v(s->scoefs, in, size);
scaled = s->scoefs;
if (cb < 11) {
for (i = 0; i < size; i += 4) {
int curidx, curidx2, sign1, count1, sign2, count2;
int *in_int = (int *)&in[i];
uint8_t v_bits;
unsigned int v_codes;
int t0, t1, t2, t3, t4;
const float *vec1, *vec2;
qc1 = scaled[i ] * Q34 + ROUNDING;
qc2 = scaled[i+1] * Q34 + ROUNDING;
qc3 = scaled[i+2] * Q34 + ROUNDING;
qc4 = scaled[i+3] * Q34 + ROUNDING;
__asm__ volatile (
".set push \n\t"
".set noreorder \n\t"
"ori %[t4], $zero, 16 \n\t"
"ori %[sign1], $zero, 0 \n\t"
"ori %[sign2], $zero, 0 \n\t"
"slt %[t0], %[t4], %[qc1] \n\t"
"slt %[t1], %[t4], %[qc2] \n\t"
"slt %[t2], %[t4], %[qc3] \n\t"
"slt %[t3], %[t4], %[qc4] \n\t"
"movn %[qc1], %[t4], %[t0] \n\t"
"movn %[qc2], %[t4], %[t1] \n\t"
"movn %[qc3], %[t4], %[t2] \n\t"
"movn %[qc4], %[t4], %[t3] \n\t"
"lw %[t0], 0(%[in_int]) \n\t"
"lw %[t1], 4(%[in_int]) \n\t"
"lw %[t2], 8(%[in_int]) \n\t"
"lw %[t3], 12(%[in_int]) \n\t"
"slt %[t0], %[t0], $zero \n\t"
"movn %[sign1], %[t0], %[qc1] \n\t"
"slt %[t2], %[t2], $zero \n\t"
"movn %[sign2], %[t2], %[qc3] \n\t"
"slt %[t1], %[t1], $zero \n\t"
"sll %[t0], %[sign1], 1 \n\t"
"or %[t0], %[t0], %[t1] \n\t"
"movn %[sign1], %[t0], %[qc2] \n\t"
"slt %[t3], %[t3], $zero \n\t"
"sll %[t0], %[sign2], 1 \n\t"
"or %[t0], %[t0], %[t3] \n\t"
"movn %[sign2], %[t0], %[qc4] \n\t"
"slt %[count1], $zero, %[qc1] \n\t"
"slt %[t1], $zero, %[qc2] \n\t"
"slt %[count2], $zero, %[qc3] \n\t"
"slt %[t2], $zero, %[qc4] \n\t"
"addu %[count1], %[count1], %[t1] \n\t"
"addu %[count2], %[count2], %[t2] \n\t"
".set pop \n\t"
: [qc1]"+r"(qc1), [qc2]"+r"(qc2),
[qc3]"+r"(qc3), [qc4]"+r"(qc4),
[sign1]"=&r"(sign1), [count1]"=&r"(count1),
[sign2]"=&r"(sign2), [count2]"=&r"(count2),
[t0]"=&r"(t0), [t1]"=&r"(t1), [t2]"=&r"(t2), [t3]"=&r"(t3),
[t4]"=&r"(t4)
: [in_int]"r"(in_int)
: "memory"
);
curidx = 17 * qc1;
curidx += qc2;
curidx2 = 17 * qc3;
curidx2 += qc4;
v_codes = (p_codes[curidx] << count1) | sign1;
v_bits = p_bits[curidx] + count1;
put_bits(pb, v_bits, v_codes);
v_codes = (p_codes[curidx2] << count2) | sign2;
v_bits = p_bits[curidx2] + count2;
put_bits(pb, v_bits, v_codes);
if (out) {
vec1 = &p_vectors[curidx*2 ];
vec2 = &p_vectors[curidx2*2];
out[i+0] = copysignf(vec1[0] * IQ, in[i+0]);
out[i+1] = copysignf(vec1[1] * IQ, in[i+1]);
out[i+2] = copysignf(vec2[0] * IQ, in[i+2]);
out[i+3] = copysignf(vec2[1] * IQ, in[i+3]);
}
}
} else {
for (i = 0; i < size; i += 4) {
int curidx, curidx2, sign1, count1, sign2, count2;
int *in_int = (int *)&in[i];
uint8_t v_bits;
unsigned int v_codes;
int c1, c2, c3, c4;
int t0, t1, t2, t3, t4;
const float *vec1, *vec2;
qc1 = scaled[i ] * Q34 + ROUNDING;
qc2 = scaled[i+1] * Q34 + ROUNDING;
qc3 = scaled[i+2] * Q34 + ROUNDING;
qc4 = scaled[i+3] * Q34 + ROUNDING;
__asm__ volatile (
".set push \n\t"
".set noreorder \n\t"
"ori %[t4], $zero, 16 \n\t"
"ori %[sign1], $zero, 0 \n\t"
"ori %[sign2], $zero, 0 \n\t"
"shll_s.w %[c1], %[qc1], 18 \n\t"
"shll_s.w %[c2], %[qc2], 18 \n\t"
"shll_s.w %[c3], %[qc3], 18 \n\t"
"shll_s.w %[c4], %[qc4], 18 \n\t"
"srl %[c1], %[c1], 18 \n\t"
"srl %[c2], %[c2], 18 \n\t"
"srl %[c3], %[c3], 18 \n\t"
"srl %[c4], %[c4], 18 \n\t"
"slt %[t0], %[t4], %[qc1] \n\t"
"slt %[t1], %[t4], %[qc2] \n\t"
"slt %[t2], %[t4], %[qc3] \n\t"
"slt %[t3], %[t4], %[qc4] \n\t"
"movn %[qc1], %[t4], %[t0] \n\t"
"movn %[qc2], %[t4], %[t1] \n\t"
"movn %[qc3], %[t4], %[t2] \n\t"
"movn %[qc4], %[t4], %[t3] \n\t"
"lw %[t0], 0(%[in_int]) \n\t"
"lw %[t1], 4(%[in_int]) \n\t"
"lw %[t2], 8(%[in_int]) \n\t"
"lw %[t3], 12(%[in_int]) \n\t"
"slt %[t0], %[t0], $zero \n\t"
"movn %[sign1], %[t0], %[qc1] \n\t"
"slt %[t2], %[t2], $zero \n\t"
"movn %[sign2], %[t2], %[qc3] \n\t"
"slt %[t1], %[t1], $zero \n\t"
"sll %[t0], %[sign1], 1 \n\t"
"or %[t0], %[t0], %[t1] \n\t"
"movn %[sign1], %[t0], %[qc2] \n\t"
"slt %[t3], %[t3], $zero \n\t"
"sll %[t0], %[sign2], 1 \n\t"
"or %[t0], %[t0], %[t3] \n\t"
"movn %[sign2], %[t0], %[qc4] \n\t"
"slt %[count1], $zero, %[qc1] \n\t"
"slt %[t1], $zero, %[qc2] \n\t"
"slt %[count2], $zero, %[qc3] \n\t"
"slt %[t2], $zero, %[qc4] \n\t"
"addu %[count1], %[count1], %[t1] \n\t"
"addu %[count2], %[count2], %[t2] \n\t"
".set pop \n\t"
: [qc1]"+r"(qc1), [qc2]"+r"(qc2),
[qc3]"+r"(qc3), [qc4]"+r"(qc4),
[sign1]"=&r"(sign1), [count1]"=&r"(count1),
[sign2]"=&r"(sign2), [count2]"=&r"(count2),
[c1]"=&r"(c1), [c2]"=&r"(c2),
[c3]"=&r"(c3), [c4]"=&r"(c4),
[t0]"=&r"(t0), [t1]"=&r"(t1), [t2]"=&r"(t2), [t3]"=&r"(t3),
[t4]"=&r"(t4)
: [in_int]"r"(in_int)
: "memory"
);
curidx = 17 * qc1;
curidx += qc2;
curidx2 = 17 * qc3;
curidx2 += qc4;
v_codes = (p_codes[curidx] << count1) | sign1;
v_bits = p_bits[curidx] + count1;
put_bits(pb, v_bits, v_codes);
if (p_vectors[curidx*2 ] == 64.0f) {
int len = av_log2(c1);
v_codes = (((1 << (len - 3)) - 2) << len) | (c1 & ((1 << len) - 1));
put_bits(pb, len * 2 - 3, v_codes);
}
if (p_vectors[curidx*2+1] == 64.0f) {
int len = av_log2(c2);
v_codes = (((1 << (len - 3)) - 2) << len) | (c2 & ((1 << len) - 1));
put_bits(pb, len*2-3, v_codes);
}
v_codes = (p_codes[curidx2] << count2) | sign2;
v_bits = p_bits[curidx2] + count2;
put_bits(pb, v_bits, v_codes);
if (p_vectors[curidx2*2 ] == 64.0f) {
int len = av_log2(c3);
v_codes = (((1 << (len - 3)) - 2) << len) | (c3 & ((1 << len) - 1));
put_bits(pb, len* 2 - 3, v_codes);
}
if (p_vectors[curidx2*2+1] == 64.0f) {
int len = av_log2(c4);
v_codes = (((1 << (len - 3)) - 2) << len) | (c4 & ((1 << len) - 1));
put_bits(pb, len * 2 - 3, v_codes);
}
if (out) {
vec1 = &p_vectors[curidx*2];
vec2 = &p_vectors[curidx2*2];
out[i+0] = copysignf(c1 * cbrtf(c1) * IQ, in[i+0]);
out[i+1] = copysignf(c2 * cbrtf(c2) * IQ, in[i+1]);
out[i+2] = copysignf(c3 * cbrtf(c3) * IQ, in[i+2]);
out[i+3] = copysignf(c4 * cbrtf(c4) * IQ, in[i+3]);
}
}
}
}
| {
"code": [
" int *bits, const float ROUNDING)",
" if (out) {",
" vec1 = &p_vectors[curidx*2 ];",
" vec2 = &p_vectors[curidx2*2];",
" out[i+0] = copysignf(vec1[0] * IQ, in[i+0]);",
" out[i+1] = copysignf(vec1[1] * IQ, in[i+1]);",
" out[i+2] = copysignf(vec2[0] * IQ, in[i+2]);",
" out[i+3] = copysignf(vec2[1] * IQ, in[i+3]);",
" if (out) {",
" vec1 = &p_vectors[curidx*2];",
" vec2 = &p_vectors[curidx2*2];",
" out[i+0] = copysignf(c1 * cbrtf(c1) * IQ, in[i+0]);",
" out[i+1] = copysignf(c2 * cbrtf(c2) * IQ, in[i+1]);",
" out[i+2] = copysignf(c3 * cbrtf(c3) * IQ, in[i+2]);",
" out[i+3] = copysignf(c4 * cbrtf(c4) * IQ, in[i+3]);"
],
"line_no": [
9,
191,
193,
195,
197,
199,
201,
203,
191,
433,
195,
437,
439,
441,
443
]
} | static void FUNC_0(struct AACEncContext *VAR_0,
PutBitContext *VAR_1, const float *VAR_2, float *VAR_3,
const float *VAR_4, int VAR_5, int VAR_6,
int VAR_7, const float VAR_8, const float VAR_9,
int *VAR_10, const float VAR_11)
{
const float VAR_12 = ff_aac_pow34sf_tab[POW_SF2_ZERO - VAR_6 + SCALE_ONE_POS - SCALE_DIV_512];
const float VAR_13 = ff_aac_pow2sf_tab [POW_SF2_ZERO + VAR_6 - SCALE_ONE_POS + SCALE_DIV_512];
int VAR_14;
int VAR_15, VAR_16, VAR_17, VAR_18;
uint8_t *p_bits = (uint8_t* )ff_aac_spectral_bits[VAR_7-1];
uint16_t *p_codes = (uint16_t*)ff_aac_spectral_codes[VAR_7-1];
float *VAR_19 = (float* )ff_aac_codebook_vectors[VAR_7-1];
abs_pow34_v(VAR_0->scoefs, VAR_2, VAR_5);
VAR_4 = VAR_0->scoefs;
if (VAR_7 < 11) {
for (VAR_14 = 0; VAR_14 < VAR_5; VAR_14 += 4) {
int VAR_35, VAR_35, VAR_35, VAR_35, VAR_35, VAR_35;
int *VAR_35 = (int *)&VAR_2[VAR_14];
uint8_t v_bits;
unsigned int VAR_35;
int VAR_39, VAR_39, VAR_39, VAR_39, VAR_39;
const float *VAR_39, *VAR_39;
VAR_15 = VAR_4[VAR_14 ] * VAR_12 + VAR_11;
VAR_16 = VAR_4[VAR_14+1] * VAR_12 + VAR_11;
VAR_17 = VAR_4[VAR_14+2] * VAR_12 + VAR_11;
VAR_18 = VAR_4[VAR_14+3] * VAR_12 + VAR_11;
__asm__ volatile (
".set push \n\t"
".set noreorder \n\t"
"ori %[VAR_39], $zero, 16 \n\t"
"ori %[VAR_35], $zero, 0 \n\t"
"ori %[VAR_35], $zero, 0 \n\t"
"slt %[VAR_39], %[VAR_39], %[VAR_15] \n\t"
"slt %[VAR_39], %[VAR_39], %[VAR_16] \n\t"
"slt %[VAR_39], %[VAR_39], %[VAR_17] \n\t"
"slt %[VAR_39], %[VAR_39], %[VAR_18] \n\t"
"movn %[VAR_15], %[VAR_39], %[VAR_39] \n\t"
"movn %[VAR_16], %[VAR_39], %[VAR_39] \n\t"
"movn %[VAR_17], %[VAR_39], %[VAR_39] \n\t"
"movn %[VAR_18], %[VAR_39], %[VAR_39] \n\t"
"lw %[VAR_39], 0(%[VAR_35]) \n\t"
"lw %[VAR_39], 4(%[VAR_35]) \n\t"
"lw %[VAR_39], 8(%[VAR_35]) \n\t"
"lw %[VAR_39], 12(%[VAR_35]) \n\t"
"slt %[VAR_39], %[VAR_39], $zero \n\t"
"movn %[VAR_35], %[VAR_39], %[VAR_15] \n\t"
"slt %[VAR_39], %[VAR_39], $zero \n\t"
"movn %[VAR_35], %[VAR_39], %[VAR_17] \n\t"
"slt %[VAR_39], %[VAR_39], $zero \n\t"
"sll %[VAR_39], %[VAR_35], 1 \n\t"
"or %[VAR_39], %[VAR_39], %[VAR_39] \n\t"
"movn %[VAR_35], %[VAR_39], %[VAR_16] \n\t"
"slt %[VAR_39], %[VAR_39], $zero \n\t"
"sll %[VAR_39], %[VAR_35], 1 \n\t"
"or %[VAR_39], %[VAR_39], %[VAR_39] \n\t"
"movn %[VAR_35], %[VAR_39], %[VAR_18] \n\t"
"slt %[VAR_35], $zero, %[VAR_15] \n\t"
"slt %[VAR_39], $zero, %[VAR_16] \n\t"
"slt %[VAR_35], $zero, %[VAR_17] \n\t"
"slt %[VAR_39], $zero, %[VAR_18] \n\t"
"addu %[VAR_35], %[VAR_35], %[VAR_39] \n\t"
"addu %[VAR_35], %[VAR_35], %[VAR_39] \n\t"
".set pop \n\t"
: [VAR_15]"+r"(VAR_15), [VAR_16]"+r"(VAR_16),
[VAR_17]"+r"(VAR_17), [VAR_18]"+r"(VAR_18),
[VAR_35]"=&r"(VAR_35), [VAR_35]"=&r"(VAR_35),
[VAR_35]"=&r"(VAR_35), [VAR_35]"=&r"(VAR_35),
[VAR_39]"=&r"(VAR_39), [VAR_39]"=&r"(VAR_39), [VAR_39]"=&r"(VAR_39), [VAR_39]"=&r"(VAR_39),
[VAR_39]"=&r"(VAR_39)
: [VAR_35]"r"(VAR_35)
: "memory"
);
VAR_35 = 17 * VAR_15;
VAR_35 += VAR_16;
VAR_35 = 17 * VAR_17;
VAR_35 += VAR_18;
VAR_35 = (p_codes[VAR_35] << VAR_35) | VAR_35;
v_bits = p_bits[VAR_35] + VAR_35;
put_bits(VAR_1, v_bits, VAR_35);
VAR_35 = (p_codes[VAR_35] << VAR_35) | VAR_35;
v_bits = p_bits[VAR_35] + VAR_35;
put_bits(VAR_1, v_bits, VAR_35);
if (VAR_3) {
VAR_39 = &VAR_19[VAR_35*2 ];
VAR_39 = &VAR_19[VAR_35*2];
VAR_3[VAR_14+0] = copysignf(VAR_39[0] * VAR_13, VAR_2[VAR_14+0]);
VAR_3[VAR_14+1] = copysignf(VAR_39[1] * VAR_13, VAR_2[VAR_14+1]);
VAR_3[VAR_14+2] = copysignf(VAR_39[0] * VAR_13, VAR_2[VAR_14+2]);
VAR_3[VAR_14+3] = copysignf(VAR_39[1] * VAR_13, VAR_2[VAR_14+3]);
}
}
} else {
for (VAR_14 = 0; VAR_14 < VAR_5; VAR_14 += 4) {
int VAR_35, VAR_35, VAR_35, VAR_35, VAR_35, VAR_35;
int *VAR_35 = (int *)&VAR_2[VAR_14];
uint8_t v_bits;
unsigned int VAR_35;
int VAR_35, VAR_36, VAR_37, VAR_38;
int VAR_39, VAR_39, VAR_39, VAR_39, VAR_39;
const float *VAR_39, *VAR_39;
VAR_15 = VAR_4[VAR_14 ] * VAR_12 + VAR_11;
VAR_16 = VAR_4[VAR_14+1] * VAR_12 + VAR_11;
VAR_17 = VAR_4[VAR_14+2] * VAR_12 + VAR_11;
VAR_18 = VAR_4[VAR_14+3] * VAR_12 + VAR_11;
__asm__ volatile (
".set push \n\t"
".set noreorder \n\t"
"ori %[VAR_39], $zero, 16 \n\t"
"ori %[VAR_35], $zero, 0 \n\t"
"ori %[VAR_35], $zero, 0 \n\t"
"shll_s.w %[VAR_35], %[VAR_15], 18 \n\t"
"shll_s.w %[VAR_36], %[VAR_16], 18 \n\t"
"shll_s.w %[VAR_37], %[VAR_17], 18 \n\t"
"shll_s.w %[VAR_38], %[VAR_18], 18 \n\t"
"srl %[VAR_35], %[VAR_35], 18 \n\t"
"srl %[VAR_36], %[VAR_36], 18 \n\t"
"srl %[VAR_37], %[VAR_37], 18 \n\t"
"srl %[VAR_38], %[VAR_38], 18 \n\t"
"slt %[VAR_39], %[VAR_39], %[VAR_15] \n\t"
"slt %[VAR_39], %[VAR_39], %[VAR_16] \n\t"
"slt %[VAR_39], %[VAR_39], %[VAR_17] \n\t"
"slt %[VAR_39], %[VAR_39], %[VAR_18] \n\t"
"movn %[VAR_15], %[VAR_39], %[VAR_39] \n\t"
"movn %[VAR_16], %[VAR_39], %[VAR_39] \n\t"
"movn %[VAR_17], %[VAR_39], %[VAR_39] \n\t"
"movn %[VAR_18], %[VAR_39], %[VAR_39] \n\t"
"lw %[VAR_39], 0(%[VAR_35]) \n\t"
"lw %[VAR_39], 4(%[VAR_35]) \n\t"
"lw %[VAR_39], 8(%[VAR_35]) \n\t"
"lw %[VAR_39], 12(%[VAR_35]) \n\t"
"slt %[VAR_39], %[VAR_39], $zero \n\t"
"movn %[VAR_35], %[VAR_39], %[VAR_15] \n\t"
"slt %[VAR_39], %[VAR_39], $zero \n\t"
"movn %[VAR_35], %[VAR_39], %[VAR_17] \n\t"
"slt %[VAR_39], %[VAR_39], $zero \n\t"
"sll %[VAR_39], %[VAR_35], 1 \n\t"
"or %[VAR_39], %[VAR_39], %[VAR_39] \n\t"
"movn %[VAR_35], %[VAR_39], %[VAR_16] \n\t"
"slt %[VAR_39], %[VAR_39], $zero \n\t"
"sll %[VAR_39], %[VAR_35], 1 \n\t"
"or %[VAR_39], %[VAR_39], %[VAR_39] \n\t"
"movn %[VAR_35], %[VAR_39], %[VAR_18] \n\t"
"slt %[VAR_35], $zero, %[VAR_15] \n\t"
"slt %[VAR_39], $zero, %[VAR_16] \n\t"
"slt %[VAR_35], $zero, %[VAR_17] \n\t"
"slt %[VAR_39], $zero, %[VAR_18] \n\t"
"addu %[VAR_35], %[VAR_35], %[VAR_39] \n\t"
"addu %[VAR_35], %[VAR_35], %[VAR_39] \n\t"
".set pop \n\t"
: [VAR_15]"+r"(VAR_15), [VAR_16]"+r"(VAR_16),
[VAR_17]"+r"(VAR_17), [VAR_18]"+r"(VAR_18),
[VAR_35]"=&r"(VAR_35), [VAR_35]"=&r"(VAR_35),
[VAR_35]"=&r"(VAR_35), [VAR_35]"=&r"(VAR_35),
[VAR_35]"=&r"(VAR_35), [VAR_36]"=&r"(VAR_36),
[VAR_37]"=&r"(VAR_37), [VAR_38]"=&r"(VAR_38),
[VAR_39]"=&r"(VAR_39), [VAR_39]"=&r"(VAR_39), [VAR_39]"=&r"(VAR_39), [VAR_39]"=&r"(VAR_39),
[VAR_39]"=&r"(VAR_39)
: [VAR_35]"r"(VAR_35)
: "memory"
);
VAR_35 = 17 * VAR_15;
VAR_35 += VAR_16;
VAR_35 = 17 * VAR_17;
VAR_35 += VAR_18;
VAR_35 = (p_codes[VAR_35] << VAR_35) | VAR_35;
v_bits = p_bits[VAR_35] + VAR_35;
put_bits(VAR_1, v_bits, VAR_35);
if (VAR_19[VAR_35*2 ] == 64.0f) {
int VAR_40 = av_log2(VAR_35);
VAR_35 = (((1 << (VAR_40 - 3)) - 2) << VAR_40) | (VAR_35 & ((1 << VAR_40) - 1));
put_bits(VAR_1, VAR_40 * 2 - 3, VAR_35);
}
if (VAR_19[VAR_35*2+1] == 64.0f) {
int VAR_40 = av_log2(VAR_36);
VAR_35 = (((1 << (VAR_40 - 3)) - 2) << VAR_40) | (VAR_36 & ((1 << VAR_40) - 1));
put_bits(VAR_1, VAR_40*2-3, VAR_35);
}
VAR_35 = (p_codes[VAR_35] << VAR_35) | VAR_35;
v_bits = p_bits[VAR_35] + VAR_35;
put_bits(VAR_1, v_bits, VAR_35);
if (VAR_19[VAR_35*2 ] == 64.0f) {
int VAR_40 = av_log2(VAR_37);
VAR_35 = (((1 << (VAR_40 - 3)) - 2) << VAR_40) | (VAR_37 & ((1 << VAR_40) - 1));
put_bits(VAR_1, VAR_40* 2 - 3, VAR_35);
}
if (VAR_19[VAR_35*2+1] == 64.0f) {
int VAR_40 = av_log2(VAR_38);
VAR_35 = (((1 << (VAR_40 - 3)) - 2) << VAR_40) | (VAR_38 & ((1 << VAR_40) - 1));
put_bits(VAR_1, VAR_40 * 2 - 3, VAR_35);
}
if (VAR_3) {
VAR_39 = &VAR_19[VAR_35*2];
VAR_39 = &VAR_19[VAR_35*2];
VAR_3[VAR_14+0] = copysignf(VAR_35 * cbrtf(VAR_35) * VAR_13, VAR_2[VAR_14+0]);
VAR_3[VAR_14+1] = copysignf(VAR_36 * cbrtf(VAR_36) * VAR_13, VAR_2[VAR_14+1]);
VAR_3[VAR_14+2] = copysignf(VAR_37 * cbrtf(VAR_37) * VAR_13, VAR_2[VAR_14+2]);
VAR_3[VAR_14+3] = copysignf(VAR_38 * cbrtf(VAR_38) * VAR_13, VAR_2[VAR_14+3]);
}
}
}
}
| [
"static void FUNC_0(struct AACEncContext *VAR_0,\nPutBitContext *VAR_1, const float *VAR_2, float *VAR_3,\nconst float *VAR_4, int VAR_5, int VAR_6,\nint VAR_7, const float VAR_8, const float VAR_9,\nint *VAR_10, const float VAR_11)\n{",
"const float VAR_12 = ff_aac_pow34sf_tab[POW_SF2_ZERO - VAR_6 + SCALE_ONE_POS - SCALE_DIV_512];",
"const float VAR_13 = ff_aac_pow2sf_tab [POW_SF2_ZERO + VAR_6 - SCALE_ONE_POS + SCALE_DIV_512];",
"int VAR_14;",
"int VAR_15, VAR_16, VAR_17, VAR_18;",
"uint8_t *p_bits = (uint8_t* )ff_aac_spectral_bits[VAR_7-1];",
"uint16_t *p_codes = (uint16_t*)ff_aac_spectral_codes[VAR_7-1];",
"float *VAR_19 = (float* )ff_aac_codebook_vectors[VAR_7-1];",
"abs_pow34_v(VAR_0->scoefs, VAR_2, VAR_5);",
"VAR_4 = VAR_0->scoefs;",
"if (VAR_7 < 11) {",
"for (VAR_14 = 0; VAR_14 < VAR_5; VAR_14 += 4) {",
"int VAR_35, VAR_35, VAR_35, VAR_35, VAR_35, VAR_35;",
"int *VAR_35 = (int *)&VAR_2[VAR_14];",
"uint8_t v_bits;",
"unsigned int VAR_35;",
"int VAR_39, VAR_39, VAR_39, VAR_39, VAR_39;",
"const float *VAR_39, *VAR_39;",
"VAR_15 = VAR_4[VAR_14 ] * VAR_12 + VAR_11;",
"VAR_16 = VAR_4[VAR_14+1] * VAR_12 + VAR_11;",
"VAR_17 = VAR_4[VAR_14+2] * VAR_12 + VAR_11;",
"VAR_18 = VAR_4[VAR_14+3] * VAR_12 + VAR_11;",
"__asm__ volatile (\n\".set push \\n\\t\"\n\".set noreorder \\n\\t\"\n\"ori %[VAR_39], $zero, 16 \\n\\t\"\n\"ori %[VAR_35], $zero, 0 \\n\\t\"\n\"ori %[VAR_35], $zero, 0 \\n\\t\"\n\"slt %[VAR_39], %[VAR_39], %[VAR_15] \\n\\t\"\n\"slt %[VAR_39], %[VAR_39], %[VAR_16] \\n\\t\"\n\"slt %[VAR_39], %[VAR_39], %[VAR_17] \\n\\t\"\n\"slt %[VAR_39], %[VAR_39], %[VAR_18] \\n\\t\"\n\"movn %[VAR_15], %[VAR_39], %[VAR_39] \\n\\t\"\n\"movn %[VAR_16], %[VAR_39], %[VAR_39] \\n\\t\"\n\"movn %[VAR_17], %[VAR_39], %[VAR_39] \\n\\t\"\n\"movn %[VAR_18], %[VAR_39], %[VAR_39] \\n\\t\"\n\"lw %[VAR_39], 0(%[VAR_35]) \\n\\t\"\n\"lw %[VAR_39], 4(%[VAR_35]) \\n\\t\"\n\"lw %[VAR_39], 8(%[VAR_35]) \\n\\t\"\n\"lw %[VAR_39], 12(%[VAR_35]) \\n\\t\"\n\"slt %[VAR_39], %[VAR_39], $zero \\n\\t\"\n\"movn %[VAR_35], %[VAR_39], %[VAR_15] \\n\\t\"\n\"slt %[VAR_39], %[VAR_39], $zero \\n\\t\"\n\"movn %[VAR_35], %[VAR_39], %[VAR_17] \\n\\t\"\n\"slt %[VAR_39], %[VAR_39], $zero \\n\\t\"\n\"sll %[VAR_39], %[VAR_35], 1 \\n\\t\"\n\"or %[VAR_39], %[VAR_39], %[VAR_39] \\n\\t\"\n\"movn %[VAR_35], %[VAR_39], %[VAR_16] \\n\\t\"\n\"slt %[VAR_39], %[VAR_39], $zero \\n\\t\"\n\"sll %[VAR_39], %[VAR_35], 1 \\n\\t\"\n\"or %[VAR_39], %[VAR_39], %[VAR_39] \\n\\t\"\n\"movn %[VAR_35], %[VAR_39], %[VAR_18] \\n\\t\"\n\"slt %[VAR_35], $zero, %[VAR_15] \\n\\t\"\n\"slt %[VAR_39], $zero, %[VAR_16] \\n\\t\"\n\"slt %[VAR_35], $zero, %[VAR_17] \\n\\t\"\n\"slt %[VAR_39], $zero, %[VAR_18] \\n\\t\"\n\"addu %[VAR_35], %[VAR_35], %[VAR_39] \\n\\t\"\n\"addu %[VAR_35], %[VAR_35], %[VAR_39] \\n\\t\"\n\".set pop \\n\\t\"\n: [VAR_15]\"+r\"(VAR_15), [VAR_16]\"+r\"(VAR_16),\n[VAR_17]\"+r\"(VAR_17), [VAR_18]\"+r\"(VAR_18),\n[VAR_35]\"=&r\"(VAR_35), [VAR_35]\"=&r\"(VAR_35),\n[VAR_35]\"=&r\"(VAR_35), [VAR_35]\"=&r\"(VAR_35),\n[VAR_39]\"=&r\"(VAR_39), [VAR_39]\"=&r\"(VAR_39), [VAR_39]\"=&r\"(VAR_39), [VAR_39]\"=&r\"(VAR_39),\n[VAR_39]\"=&r\"(VAR_39)\n: [VAR_35]\"r\"(VAR_35)\n: \"memory\"\n);",
"VAR_35 = 17 * VAR_15;",
"VAR_35 += VAR_16;",
"VAR_35 = 17 * VAR_17;",
"VAR_35 += VAR_18;",
"VAR_35 = (p_codes[VAR_35] << VAR_35) | VAR_35;",
"v_bits = p_bits[VAR_35] + VAR_35;",
"put_bits(VAR_1, v_bits, VAR_35);",
"VAR_35 = (p_codes[VAR_35] << VAR_35) | VAR_35;",
"v_bits = p_bits[VAR_35] + VAR_35;",
"put_bits(VAR_1, v_bits, VAR_35);",
"if (VAR_3) {",
"VAR_39 = &VAR_19[VAR_35*2 ];",
"VAR_39 = &VAR_19[VAR_35*2];",
"VAR_3[VAR_14+0] = copysignf(VAR_39[0] * VAR_13, VAR_2[VAR_14+0]);",
"VAR_3[VAR_14+1] = copysignf(VAR_39[1] * VAR_13, VAR_2[VAR_14+1]);",
"VAR_3[VAR_14+2] = copysignf(VAR_39[0] * VAR_13, VAR_2[VAR_14+2]);",
"VAR_3[VAR_14+3] = copysignf(VAR_39[1] * VAR_13, VAR_2[VAR_14+3]);",
"}",
"}",
"} else {",
"for (VAR_14 = 0; VAR_14 < VAR_5; VAR_14 += 4) {",
"int VAR_35, VAR_35, VAR_35, VAR_35, VAR_35, VAR_35;",
"int *VAR_35 = (int *)&VAR_2[VAR_14];",
"uint8_t v_bits;",
"unsigned int VAR_35;",
"int VAR_35, VAR_36, VAR_37, VAR_38;",
"int VAR_39, VAR_39, VAR_39, VAR_39, VAR_39;",
"const float *VAR_39, *VAR_39;",
"VAR_15 = VAR_4[VAR_14 ] * VAR_12 + VAR_11;",
"VAR_16 = VAR_4[VAR_14+1] * VAR_12 + VAR_11;",
"VAR_17 = VAR_4[VAR_14+2] * VAR_12 + VAR_11;",
"VAR_18 = VAR_4[VAR_14+3] * VAR_12 + VAR_11;",
"__asm__ volatile (\n\".set push \\n\\t\"\n\".set noreorder \\n\\t\"\n\"ori %[VAR_39], $zero, 16 \\n\\t\"\n\"ori %[VAR_35], $zero, 0 \\n\\t\"\n\"ori %[VAR_35], $zero, 0 \\n\\t\"\n\"shll_s.w %[VAR_35], %[VAR_15], 18 \\n\\t\"\n\"shll_s.w %[VAR_36], %[VAR_16], 18 \\n\\t\"\n\"shll_s.w %[VAR_37], %[VAR_17], 18 \\n\\t\"\n\"shll_s.w %[VAR_38], %[VAR_18], 18 \\n\\t\"\n\"srl %[VAR_35], %[VAR_35], 18 \\n\\t\"\n\"srl %[VAR_36], %[VAR_36], 18 \\n\\t\"\n\"srl %[VAR_37], %[VAR_37], 18 \\n\\t\"\n\"srl %[VAR_38], %[VAR_38], 18 \\n\\t\"\n\"slt %[VAR_39], %[VAR_39], %[VAR_15] \\n\\t\"\n\"slt %[VAR_39], %[VAR_39], %[VAR_16] \\n\\t\"\n\"slt %[VAR_39], %[VAR_39], %[VAR_17] \\n\\t\"\n\"slt %[VAR_39], %[VAR_39], %[VAR_18] \\n\\t\"\n\"movn %[VAR_15], %[VAR_39], %[VAR_39] \\n\\t\"\n\"movn %[VAR_16], %[VAR_39], %[VAR_39] \\n\\t\"\n\"movn %[VAR_17], %[VAR_39], %[VAR_39] \\n\\t\"\n\"movn %[VAR_18], %[VAR_39], %[VAR_39] \\n\\t\"\n\"lw %[VAR_39], 0(%[VAR_35]) \\n\\t\"\n\"lw %[VAR_39], 4(%[VAR_35]) \\n\\t\"\n\"lw %[VAR_39], 8(%[VAR_35]) \\n\\t\"\n\"lw %[VAR_39], 12(%[VAR_35]) \\n\\t\"\n\"slt %[VAR_39], %[VAR_39], $zero \\n\\t\"\n\"movn %[VAR_35], %[VAR_39], %[VAR_15] \\n\\t\"\n\"slt %[VAR_39], %[VAR_39], $zero \\n\\t\"\n\"movn %[VAR_35], %[VAR_39], %[VAR_17] \\n\\t\"\n\"slt %[VAR_39], %[VAR_39], $zero \\n\\t\"\n\"sll %[VAR_39], %[VAR_35], 1 \\n\\t\"\n\"or %[VAR_39], %[VAR_39], %[VAR_39] \\n\\t\"\n\"movn %[VAR_35], %[VAR_39], %[VAR_16] \\n\\t\"\n\"slt %[VAR_39], %[VAR_39], $zero \\n\\t\"\n\"sll %[VAR_39], %[VAR_35], 1 \\n\\t\"\n\"or %[VAR_39], %[VAR_39], %[VAR_39] \\n\\t\"\n\"movn %[VAR_35], %[VAR_39], %[VAR_18] \\n\\t\"\n\"slt %[VAR_35], $zero, %[VAR_15] \\n\\t\"\n\"slt %[VAR_39], $zero, %[VAR_16] \\n\\t\"\n\"slt %[VAR_35], $zero, %[VAR_17] \\n\\t\"\n\"slt %[VAR_39], $zero, %[VAR_18] \\n\\t\"\n\"addu %[VAR_35], %[VAR_35], %[VAR_39] \\n\\t\"\n\"addu %[VAR_35], %[VAR_35], %[VAR_39] \\n\\t\"\n\".set pop \\n\\t\"\n: [VAR_15]\"+r\"(VAR_15), [VAR_16]\"+r\"(VAR_16),\n[VAR_17]\"+r\"(VAR_17), [VAR_18]\"+r\"(VAR_18),\n[VAR_35]\"=&r\"(VAR_35), [VAR_35]\"=&r\"(VAR_35),\n[VAR_35]\"=&r\"(VAR_35), [VAR_35]\"=&r\"(VAR_35),\n[VAR_35]\"=&r\"(VAR_35), [VAR_36]\"=&r\"(VAR_36),\n[VAR_37]\"=&r\"(VAR_37), [VAR_38]\"=&r\"(VAR_38),\n[VAR_39]\"=&r\"(VAR_39), [VAR_39]\"=&r\"(VAR_39), [VAR_39]\"=&r\"(VAR_39), [VAR_39]\"=&r\"(VAR_39),\n[VAR_39]\"=&r\"(VAR_39)\n: [VAR_35]\"r\"(VAR_35)\n: \"memory\"\n);",
"VAR_35 = 17 * VAR_15;",
"VAR_35 += VAR_16;",
"VAR_35 = 17 * VAR_17;",
"VAR_35 += VAR_18;",
"VAR_35 = (p_codes[VAR_35] << VAR_35) | VAR_35;",
"v_bits = p_bits[VAR_35] + VAR_35;",
"put_bits(VAR_1, v_bits, VAR_35);",
"if (VAR_19[VAR_35*2 ] == 64.0f) {",
"int VAR_40 = av_log2(VAR_35);",
"VAR_35 = (((1 << (VAR_40 - 3)) - 2) << VAR_40) | (VAR_35 & ((1 << VAR_40) - 1));",
"put_bits(VAR_1, VAR_40 * 2 - 3, VAR_35);",
"}",
"if (VAR_19[VAR_35*2+1] == 64.0f) {",
"int VAR_40 = av_log2(VAR_36);",
"VAR_35 = (((1 << (VAR_40 - 3)) - 2) << VAR_40) | (VAR_36 & ((1 << VAR_40) - 1));",
"put_bits(VAR_1, VAR_40*2-3, VAR_35);",
"}",
"VAR_35 = (p_codes[VAR_35] << VAR_35) | VAR_35;",
"v_bits = p_bits[VAR_35] + VAR_35;",
"put_bits(VAR_1, v_bits, VAR_35);",
"if (VAR_19[VAR_35*2 ] == 64.0f) {",
"int VAR_40 = av_log2(VAR_37);",
"VAR_35 = (((1 << (VAR_40 - 3)) - 2) << VAR_40) | (VAR_37 & ((1 << VAR_40) - 1));",
"put_bits(VAR_1, VAR_40* 2 - 3, VAR_35);",
"}",
"if (VAR_19[VAR_35*2+1] == 64.0f) {",
"int VAR_40 = av_log2(VAR_38);",
"VAR_35 = (((1 << (VAR_40 - 3)) - 2) << VAR_40) | (VAR_38 & ((1 << VAR_40) - 1));",
"put_bits(VAR_1, VAR_40 * 2 - 3, VAR_35);",
"}",
"if (VAR_3) {",
"VAR_39 = &VAR_19[VAR_35*2];",
"VAR_39 = &VAR_19[VAR_35*2];",
"VAR_3[VAR_14+0] = copysignf(VAR_35 * cbrtf(VAR_35) * VAR_13, VAR_2[VAR_14+0]);",
"VAR_3[VAR_14+1] = copysignf(VAR_36 * cbrtf(VAR_36) * VAR_13, VAR_2[VAR_14+1]);",
"VAR_3[VAR_14+2] = copysignf(VAR_37 * cbrtf(VAR_37) * VAR_13, VAR_2[VAR_14+2]);",
"VAR_3[VAR_14+3] = copysignf(VAR_38 * cbrtf(VAR_38) * VAR_13, VAR_2[VAR_14+3]);",
"}",
"}",
"}",
"}"
] | [
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,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
1,
1,
1,
1,
0,
0,
0,
0
] | [
[
1,
3,
5,
7,
9,
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25
],
[
27
],
[
31
],
[
33
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
55
],
[
57
],
[
59
],
[
61
],
[
65,
67,
69,
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,
141,
145,
147,
149,
151,
153,
155,
157,
159,
161
],
[
165
],
[
167
],
[
169
],
[
171
],
[
175
],
[
177
],
[
179
],
[
183
],
[
185
],
[
187
],
[
191
],
[
193
],
[
195
],
[
197
],
[
199
],
[
201
],
[
203
],
[
205
],
[
207
],
[
209
],
[
211
],
[
213
],
[
215
],
[
217
],
[
219
],
[
221
],
[
223
],
[
225
],
[
229
],
[
231
],
[
233
],
[
235
],
[
239,
241,
243,
247,
249,
251,
253,
255,
257,
259,
261,
263,
265,
267,
269,
271,
273,
275,
277,
279,
281,
283,
285,
287,
289,
291,
293,
295,
297,
299,
301,
303,
305,
307,
309,
311,
313,
315,
317,
319,
321,
323,
325,
327,
331,
335,
337,
339,
341,
343,
345,
347,
349,
351,
353,
355
],
[
359
],
[
361
],
[
365
],
[
367
],
[
371
],
[
373
],
[
375
],
[
379
],
[
381
],
[
383
],
[
385
],
[
387
],
[
389
],
[
391
],
[
393
],
[
395
],
[
397
],
[
401
],
[
403
],
[
405
],
[
409
],
[
411
],
[
413
],
[
415
],
[
417
],
[
419
],
[
421
],
[
423
],
[
425
],
[
427
],
[
431
],
[
433
],
[
435
],
[
437
],
[
439
],
[
441
],
[
443
],
[
445
],
[
447
],
[
449
],
[
451
]
] |
19,626 | static int vc9_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
uint8_t *buf, int buf_size)
{
VC9Context *v = avctx->priv_data;
int ret = FRAME_SKIPED, len, start_code;
AVFrame *pict = data;
uint8_t *tmp_buf;
v->avctx = avctx;
//buf_size = 0 -> last frame
if (!buf_size) return 0;
len = avpicture_get_size(avctx->pix_fmt, avctx->width,
avctx->height);
tmp_buf = (uint8_t *)av_mallocz(len);
avpicture_fill((AVPicture *)pict, tmp_buf, avctx->pix_fmt,
avctx->width, avctx->height);
if (avctx->codec_id == CODEC_ID_WMV3)
{
init_get_bits(&v->gb, buf, buf_size*8);
av_log(avctx, AV_LOG_INFO, "Frame: %i bits to decode\n", buf_size*8);
#if HAS_ADVANCED_PROFILE
if (v->profile > PROFILE_MAIN)
{
if (advanced_decode_picture_header(v) == FRAME_SKIPED) return buf_size;
switch(v->pict_type)
{
case I_TYPE: ret = advanced_decode_i_mbs(v); break;
case P_TYPE: ret = decode_p_mbs(v); break;
case B_TYPE:
case BI_TYPE: ret = decode_b_mbs(v); break;
default: ret = FRAME_SKIPED;
}
if (ret == FRAME_SKIPED) return buf_size; //We ignore for now failures
}
else
#endif
{
if (standard_decode_picture_header(v) == FRAME_SKIPED) return buf_size;
switch(v->pict_type)
{
case I_TYPE: ret = standard_decode_i_mbs(v); break;
case P_TYPE: ret = decode_p_mbs(v); break;
case B_TYPE:
case BI_TYPE: ret = decode_b_mbs(v); break;
default: ret = FRAME_SKIPED;
}
if (ret == FRAME_SKIPED) return buf_size;
}
/* Size of the output data = image */
av_log(avctx, AV_LOG_DEBUG, "Consumed %i/%i bits\n",
get_bits_count(&v->gb), buf_size*8);
}
else
{
#if 0
// search for IDU's
// FIXME
uint32_t scp = 0;
int scs = 0, i = 0;
while (i < buf_size)
{
for (; i < buf_size && scp != 0x000001; i++)
scp = ((scp<<8)|buf[i])&0xffffff;
if (scp != 0x000001)
break; // eof ?
scs = buf[i++];
init_get_bits(&v->gb, buf+i, (buf_size-i)*8);
switch(scs)
{
case 0xf:
decode_sequence_header(avctx, &v->gb);
break;
// to be finished
}
i += get_bits_count(&v->gb)*8;
}
#else
av_abort();
#endif
}
*data_size = len;
/* Fake consumption of all data */
return buf_size; //Number of bytes consumed
}
| false | FFmpeg | e5540b3fd30367ce3cc33b2f34a04b660dbc4b38 | static int vc9_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
uint8_t *buf, int buf_size)
{
VC9Context *v = avctx->priv_data;
int ret = FRAME_SKIPED, len, start_code;
AVFrame *pict = data;
uint8_t *tmp_buf;
v->avctx = avctx;
if (!buf_size) return 0;
len = avpicture_get_size(avctx->pix_fmt, avctx->width,
avctx->height);
tmp_buf = (uint8_t *)av_mallocz(len);
avpicture_fill((AVPicture *)pict, tmp_buf, avctx->pix_fmt,
avctx->width, avctx->height);
if (avctx->codec_id == CODEC_ID_WMV3)
{
init_get_bits(&v->gb, buf, buf_size*8);
av_log(avctx, AV_LOG_INFO, "Frame: %i bits to decode\n", buf_size*8);
#if HAS_ADVANCED_PROFILE
if (v->profile > PROFILE_MAIN)
{
if (advanced_decode_picture_header(v) == FRAME_SKIPED) return buf_size;
switch(v->pict_type)
{
case I_TYPE: ret = advanced_decode_i_mbs(v); break;
case P_TYPE: ret = decode_p_mbs(v); break;
case B_TYPE:
case BI_TYPE: ret = decode_b_mbs(v); break;
default: ret = FRAME_SKIPED;
}
if (ret == FRAME_SKIPED) return buf_size;
}
else
#endif
{
if (standard_decode_picture_header(v) == FRAME_SKIPED) return buf_size;
switch(v->pict_type)
{
case I_TYPE: ret = standard_decode_i_mbs(v); break;
case P_TYPE: ret = decode_p_mbs(v); break;
case B_TYPE:
case BI_TYPE: ret = decode_b_mbs(v); break;
default: ret = FRAME_SKIPED;
}
if (ret == FRAME_SKIPED) return buf_size;
}
av_log(avctx, AV_LOG_DEBUG, "Consumed %i/%i bits\n",
get_bits_count(&v->gb), buf_size*8);
}
else
{
#if 0
uint32_t scp = 0;
int scs = 0, i = 0;
while (i < buf_size)
{
for (; i < buf_size && scp != 0x000001; i++)
scp = ((scp<<8)|buf[i])&0xffffff;
if (scp != 0x000001)
break;
scs = buf[i++];
init_get_bits(&v->gb, buf+i, (buf_size-i)*8);
switch(scs)
{
case 0xf:
decode_sequence_header(avctx, &v->gb);
break;
}
i += get_bits_count(&v->gb)*8;
}
#else
av_abort();
#endif
}
*data_size = len;
return buf_size;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(AVCodecContext *VAR_0,
void *VAR_1, int *VAR_2,
uint8_t *VAR_3, int VAR_4)
{
VC9Context *v = VAR_0->priv_data;
int VAR_5 = FRAME_SKIPED, VAR_6, VAR_7;
AVFrame *pict = VAR_1;
uint8_t *tmp_buf;
v->VAR_0 = VAR_0;
if (!VAR_4) return 0;
VAR_6 = avpicture_get_size(VAR_0->pix_fmt, VAR_0->width,
VAR_0->height);
tmp_buf = (uint8_t *)av_mallocz(VAR_6);
avpicture_fill((AVPicture *)pict, tmp_buf, VAR_0->pix_fmt,
VAR_0->width, VAR_0->height);
if (VAR_0->codec_id == CODEC_ID_WMV3)
{
init_get_bits(&v->gb, VAR_3, VAR_4*8);
av_log(VAR_0, AV_LOG_INFO, "Frame: %i bits to decode\n", VAR_4*8);
#if HAS_ADVANCED_PROFILE
if (v->profile > PROFILE_MAIN)
{
if (advanced_decode_picture_header(v) == FRAME_SKIPED) return VAR_4;
switch(v->pict_type)
{
case I_TYPE: VAR_5 = advanced_decode_i_mbs(v); break;
case P_TYPE: VAR_5 = decode_p_mbs(v); break;
case B_TYPE:
case BI_TYPE: VAR_5 = decode_b_mbs(v); break;
default: VAR_5 = FRAME_SKIPED;
}
if (VAR_5 == FRAME_SKIPED) return VAR_4;
}
else
#endif
{
if (standard_decode_picture_header(v) == FRAME_SKIPED) return VAR_4;
switch(v->pict_type)
{
case I_TYPE: VAR_5 = standard_decode_i_mbs(v); break;
case P_TYPE: VAR_5 = decode_p_mbs(v); break;
case B_TYPE:
case BI_TYPE: VAR_5 = decode_b_mbs(v); break;
default: VAR_5 = FRAME_SKIPED;
}
if (VAR_5 == FRAME_SKIPED) return VAR_4;
}
av_log(VAR_0, AV_LOG_DEBUG, "Consumed %i/%i bits\n",
get_bits_count(&v->gb), VAR_4*8);
}
else
{
#if 0
uint32_t scp = 0;
int scs = 0, i = 0;
while (i < VAR_4)
{
for (; i < VAR_4 && scp != 0x000001; i++)
scp = ((scp<<8)|VAR_3[i])&0xffffff;
if (scp != 0x000001)
break;
scs = VAR_3[i++];
init_get_bits(&v->gb, VAR_3+i, (VAR_4-i)*8);
switch(scs)
{
case 0xf:
decode_sequence_header(VAR_0, &v->gb);
break;
}
i += get_bits_count(&v->gb)*8;
}
#else
av_abort();
#endif
}
*VAR_2 = VAR_6;
return VAR_4;
}
| [
"static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nuint8_t *VAR_3, int VAR_4)\n{",
"VC9Context *v = VAR_0->priv_data;",
"int VAR_5 = FRAME_SKIPED, VAR_6, VAR_7;",
"AVFrame *pict = VAR_1;",
"uint8_t *tmp_buf;",
"v->VAR_0 = VAR_0;",
"if (!VAR_4) return 0;",
"VAR_6 = avpicture_get_size(VAR_0->pix_fmt, VAR_0->width,\nVAR_0->height);",
"tmp_buf = (uint8_t *)av_mallocz(VAR_6);",
"avpicture_fill((AVPicture *)pict, tmp_buf, VAR_0->pix_fmt,\nVAR_0->width, VAR_0->height);",
"if (VAR_0->codec_id == CODEC_ID_WMV3)\n{",
"init_get_bits(&v->gb, VAR_3, VAR_4*8);",
"av_log(VAR_0, AV_LOG_INFO, \"Frame: %i bits to decode\\n\", VAR_4*8);",
"#if HAS_ADVANCED_PROFILE\nif (v->profile > PROFILE_MAIN)\n{",
"if (advanced_decode_picture_header(v) == FRAME_SKIPED) return VAR_4;",
"switch(v->pict_type)\n{",
"case I_TYPE: VAR_5 = advanced_decode_i_mbs(v); break;",
"case P_TYPE: VAR_5 = decode_p_mbs(v); break;",
"case B_TYPE:\ncase BI_TYPE: VAR_5 = decode_b_mbs(v); break;",
"default: VAR_5 = FRAME_SKIPED;",
"}",
"if (VAR_5 == FRAME_SKIPED) return VAR_4;",
"}",
"else\n#endif\n{",
"if (standard_decode_picture_header(v) == FRAME_SKIPED) return VAR_4;",
"switch(v->pict_type)\n{",
"case I_TYPE: VAR_5 = standard_decode_i_mbs(v); break;",
"case P_TYPE: VAR_5 = decode_p_mbs(v); break;",
"case B_TYPE:\ncase BI_TYPE: VAR_5 = decode_b_mbs(v); break;",
"default: VAR_5 = FRAME_SKIPED;",
"}",
"if (VAR_5 == FRAME_SKIPED) return VAR_4;",
"}",
"av_log(VAR_0, AV_LOG_DEBUG, \"Consumed %i/%i bits\\n\",\nget_bits_count(&v->gb), VAR_4*8);",
"}",
"else\n{",
"#if 0\nuint32_t scp = 0;",
"int scs = 0, i = 0;",
"while (i < VAR_4)\n{",
"for (; i < VAR_4 && scp != 0x000001; i++)",
"scp = ((scp<<8)|VAR_3[i])&0xffffff;",
"if (scp != 0x000001)\nbreak;",
"scs = VAR_3[i++];",
"init_get_bits(&v->gb, VAR_3+i, (VAR_4-i)*8);",
"switch(scs)\n{",
"case 0xf:\ndecode_sequence_header(VAR_0, &v->gb);",
"break;",
"}",
"i += get_bits_count(&v->gb)*8;",
"}",
"#else\nav_abort();",
"#endif\n}",
"*VAR_2 = VAR_6;",
"return VAR_4;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5,
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
23
],
[
27,
29
],
[
31
],
[
33,
35
],
[
39,
41
],
[
43
],
[
45
],
[
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
],
[
109,
111
],
[
113
],
[
115,
117
],
[
119,
125
],
[
127
],
[
131,
133
],
[
135
],
[
137
],
[
141,
143
],
[
147
],
[
151
],
[
155,
157
],
[
159,
161
],
[
163
],
[
167
],
[
171
],
[
173
],
[
175,
177
],
[
179,
181
],
[
185
],
[
191
],
[
193
]
] |
19,627 | static int compand_delay(AVFilterContext *ctx, AVFrame *frame)
{
CompandContext *s = ctx->priv;
AVFilterLink *inlink = ctx->inputs[0];
const int channels = inlink->channels;
const int nb_samples = frame->nb_samples;
int chan, i, av_uninit(dindex), oindex, av_uninit(count);
AVFrame *out_frame = NULL;
if (s->pts == AV_NOPTS_VALUE) {
s->pts = (frame->pts == AV_NOPTS_VALUE) ? 0 : frame->pts;
}
av_assert1(channels > 0); /* would corrupt delay_count and delay_index */
for (chan = 0; chan < channels; chan++) {
AVFrame *delay_frame = s->delay_frame;
const double *src = (double *)frame->extended_data[chan];
double *dbuf = (double *)delay_frame->extended_data[chan];
ChanParam *cp = &s->channels[chan];
double *dst;
count = s->delay_count;
dindex = s->delay_index;
for (i = 0, oindex = 0; i < nb_samples; i++) {
const double in = src[i];
update_volume(cp, fabs(in));
if (count >= s->delay_samples) {
if (!out_frame) {
out_frame = ff_get_audio_buffer(inlink, nb_samples - i);
if (!out_frame) {
av_frame_free(&frame);
return AVERROR(ENOMEM);
}
av_frame_copy_props(out_frame, frame);
out_frame->pts = s->pts;
s->pts += av_rescale_q(nb_samples - i,
(AVRational){ 1, inlink->sample_rate },
inlink->time_base);
}
dst = (double *)out_frame->extended_data[chan];
dst[oindex++] = av_clipd(dbuf[dindex] *
get_volume(s, cp->volume), -1, 1);
} else {
count++;
}
dbuf[dindex] = in;
dindex = MOD(dindex + 1, s->delay_samples);
}
}
s->delay_count = count;
s->delay_index = dindex;
av_frame_free(&frame);
return out_frame ? ff_filter_frame(ctx->outputs[0], out_frame) : 0;
}
| false | FFmpeg | e509df4bc8eb3aebdda71b826955d581e717fb0e | static int compand_delay(AVFilterContext *ctx, AVFrame *frame)
{
CompandContext *s = ctx->priv;
AVFilterLink *inlink = ctx->inputs[0];
const int channels = inlink->channels;
const int nb_samples = frame->nb_samples;
int chan, i, av_uninit(dindex), oindex, av_uninit(count);
AVFrame *out_frame = NULL;
if (s->pts == AV_NOPTS_VALUE) {
s->pts = (frame->pts == AV_NOPTS_VALUE) ? 0 : frame->pts;
}
av_assert1(channels > 0);
for (chan = 0; chan < channels; chan++) {
AVFrame *delay_frame = s->delay_frame;
const double *src = (double *)frame->extended_data[chan];
double *dbuf = (double *)delay_frame->extended_data[chan];
ChanParam *cp = &s->channels[chan];
double *dst;
count = s->delay_count;
dindex = s->delay_index;
for (i = 0, oindex = 0; i < nb_samples; i++) {
const double in = src[i];
update_volume(cp, fabs(in));
if (count >= s->delay_samples) {
if (!out_frame) {
out_frame = ff_get_audio_buffer(inlink, nb_samples - i);
if (!out_frame) {
av_frame_free(&frame);
return AVERROR(ENOMEM);
}
av_frame_copy_props(out_frame, frame);
out_frame->pts = s->pts;
s->pts += av_rescale_q(nb_samples - i,
(AVRational){ 1, inlink->sample_rate },
inlink->time_base);
}
dst = (double *)out_frame->extended_data[chan];
dst[oindex++] = av_clipd(dbuf[dindex] *
get_volume(s, cp->volume), -1, 1);
} else {
count++;
}
dbuf[dindex] = in;
dindex = MOD(dindex + 1, s->delay_samples);
}
}
s->delay_count = count;
s->delay_index = dindex;
av_frame_free(&frame);
return out_frame ? ff_filter_frame(ctx->outputs[0], out_frame) : 0;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(AVFilterContext *VAR_0, AVFrame *VAR_1)
{
CompandContext *s = VAR_0->priv;
AVFilterLink *inlink = VAR_0->inputs[0];
const int VAR_2 = inlink->VAR_2;
const int VAR_3 = VAR_1->VAR_3;
int VAR_4, VAR_5, FUNC_1(dindex), oindex, FUNC_1(count);
AVFrame *out_frame = NULL;
if (s->pts == AV_NOPTS_VALUE) {
s->pts = (VAR_1->pts == AV_NOPTS_VALUE) ? 0 : VAR_1->pts;
}
av_assert1(VAR_2 > 0);
for (VAR_4 = 0; VAR_4 < VAR_2; VAR_4++) {
AVFrame *delay_frame = s->delay_frame;
const double *VAR_6 = (double *)VAR_1->extended_data[VAR_4];
double *VAR_7 = (double *)delay_frame->extended_data[VAR_4];
ChanParam *cp = &s->VAR_2[VAR_4];
double *VAR_8;
count = s->delay_count;
dindex = s->delay_index;
for (VAR_5 = 0, oindex = 0; VAR_5 < VAR_3; VAR_5++) {
const double VAR_9 = VAR_6[VAR_5];
update_volume(cp, fabs(VAR_9));
if (count >= s->delay_samples) {
if (!out_frame) {
out_frame = ff_get_audio_buffer(inlink, VAR_3 - VAR_5);
if (!out_frame) {
av_frame_free(&VAR_1);
return AVERROR(ENOMEM);
}
av_frame_copy_props(out_frame, VAR_1);
out_frame->pts = s->pts;
s->pts += av_rescale_q(VAR_3 - VAR_5,
(AVRational){ 1, inlink->sample_rate },
inlink->time_base);
}
VAR_8 = (double *)out_frame->extended_data[VAR_4];
VAR_8[oindex++] = av_clipd(VAR_7[dindex] *
get_volume(s, cp->volume), -1, 1);
} else {
count++;
}
VAR_7[dindex] = VAR_9;
dindex = MOD(dindex + 1, s->delay_samples);
}
}
s->delay_count = count;
s->delay_index = dindex;
av_frame_free(&VAR_1);
return out_frame ? ff_filter_frame(VAR_0->outputs[0], out_frame) : 0;
}
| [
"static int FUNC_0(AVFilterContext *VAR_0, AVFrame *VAR_1)\n{",
"CompandContext *s = VAR_0->priv;",
"AVFilterLink *inlink = VAR_0->inputs[0];",
"const int VAR_2 = inlink->VAR_2;",
"const int VAR_3 = VAR_1->VAR_3;",
"int VAR_4, VAR_5, FUNC_1(dindex), oindex, FUNC_1(count);",
"AVFrame *out_frame = NULL;",
"if (s->pts == AV_NOPTS_VALUE) {",
"s->pts = (VAR_1->pts == AV_NOPTS_VALUE) ? 0 : VAR_1->pts;",
"}",
"av_assert1(VAR_2 > 0);",
"for (VAR_4 = 0; VAR_4 < VAR_2; VAR_4++) {",
"AVFrame *delay_frame = s->delay_frame;",
"const double *VAR_6 = (double *)VAR_1->extended_data[VAR_4];",
"double *VAR_7 = (double *)delay_frame->extended_data[VAR_4];",
"ChanParam *cp = &s->VAR_2[VAR_4];",
"double *VAR_8;",
"count = s->delay_count;",
"dindex = s->delay_index;",
"for (VAR_5 = 0, oindex = 0; VAR_5 < VAR_3; VAR_5++) {",
"const double VAR_9 = VAR_6[VAR_5];",
"update_volume(cp, fabs(VAR_9));",
"if (count >= s->delay_samples) {",
"if (!out_frame) {",
"out_frame = ff_get_audio_buffer(inlink, VAR_3 - VAR_5);",
"if (!out_frame) {",
"av_frame_free(&VAR_1);",
"return AVERROR(ENOMEM);",
"}",
"av_frame_copy_props(out_frame, VAR_1);",
"out_frame->pts = s->pts;",
"s->pts += av_rescale_q(VAR_3 - VAR_5,\n(AVRational){ 1, inlink->sample_rate },",
"inlink->time_base);",
"}",
"VAR_8 = (double *)out_frame->extended_data[VAR_4];",
"VAR_8[oindex++] = av_clipd(VAR_7[dindex] *\nget_volume(s, cp->volume), -1, 1);",
"} else {",
"count++;",
"}",
"VAR_7[dindex] = VAR_9;",
"dindex = MOD(dindex + 1, s->delay_samples);",
"}",
"}",
"s->delay_count = count;",
"s->delay_index = dindex;",
"av_frame_free(&VAR_1);",
"return out_frame ? ff_filter_frame(VAR_0->outputs[0], out_frame) : 0;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75,
77
],
[
79
],
[
81
],
[
85
],
[
87,
89
],
[
91
],
[
93
],
[
95
],
[
99
],
[
101
],
[
103
],
[
105
],
[
109
],
[
111
],
[
115
],
[
117
],
[
119
]
] |
19,628 | static void vc1_overlap_block(MpegEncContext *s, DCTELEM block[64], int n, int do_hor, int do_vert)
{
int i;
if(do_hor) { //TODO
}
if(do_vert) { //TODO
}
for(i = 0; i < 64; i++)
block[i] += 128;
}
| false | FFmpeg | 65c7bb9ec4f521a46577a1e87d71ad9a8deee6cd | static void vc1_overlap_block(MpegEncContext *s, DCTELEM block[64], int n, int do_hor, int do_vert)
{
int i;
if(do_hor) {
}
if(do_vert) {
}
for(i = 0; i < 64; i++)
block[i] += 128;
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(MpegEncContext *VAR_0, DCTELEM VAR_1[64], int VAR_2, int VAR_3, int VAR_4)
{
int VAR_5;
if(VAR_3) {
}
if(VAR_4) {
}
for(VAR_5 = 0; VAR_5 < 64; VAR_5++)
VAR_1[VAR_5] += 128;
}
| [
"static void FUNC_0(MpegEncContext *VAR_0, DCTELEM VAR_1[64], int VAR_2, int VAR_3, int VAR_4)\n{",
"int VAR_5;",
"if(VAR_3) {",
"}",
"if(VAR_4) {",
"}",
"for(VAR_5 = 0; VAR_5 < 64; VAR_5++)",
"VAR_1[VAR_5] += 128;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23
]
] |
19,629 | static int32_t parse_gain(const char *gain)
{
char *fraction;
int scale = 10000;
int32_t mb = 0;
int db;
if (!gain)
return INT32_MIN;
gain += strspn(gain, " \t");
db = strtol(gain, &fraction, 0);
if (*fraction++ == '.') {
while (av_isdigit(*fraction) && scale) {
mb += scale * (*fraction - '0');
scale /= 10;
fraction++;
}
}
if (abs(db) > (INT32_MAX - mb) / 100000)
return INT32_MIN;
return db * 100000 + FFSIGN(db) * mb;
}
| false | FFmpeg | 25b6837f7cacd691b19cbc12b9dad1ce84a318a1 | static int32_t parse_gain(const char *gain)
{
char *fraction;
int scale = 10000;
int32_t mb = 0;
int db;
if (!gain)
return INT32_MIN;
gain += strspn(gain, " \t");
db = strtol(gain, &fraction, 0);
if (*fraction++ == '.') {
while (av_isdigit(*fraction) && scale) {
mb += scale * (*fraction - '0');
scale /= 10;
fraction++;
}
}
if (abs(db) > (INT32_MAX - mb) / 100000)
return INT32_MIN;
return db * 100000 + FFSIGN(db) * mb;
}
| {
"code": [],
"line_no": []
} | static int32_t FUNC_0(const char *gain)
{
char *VAR_0;
int VAR_1 = 10000;
int32_t mb = 0;
int VAR_2;
if (!gain)
return INT32_MIN;
gain += strspn(gain, " \t");
VAR_2 = strtol(gain, &VAR_0, 0);
if (*VAR_0++ == '.') {
while (av_isdigit(*VAR_0) && VAR_1) {
mb += VAR_1 * (*VAR_0 - '0');
VAR_1 /= 10;
VAR_0++;
}
}
if (abs(VAR_2) > (INT32_MAX - mb) / 100000)
return INT32_MIN;
return VAR_2 * 100000 + FFSIGN(VAR_2) * mb;
}
| [
"static int32_t FUNC_0(const char *gain)\n{",
"char *VAR_0;",
"int VAR_1 = 10000;",
"int32_t mb = 0;",
"int VAR_2;",
"if (!gain)\nreturn INT32_MIN;",
"gain += strspn(gain, \" \\t\");",
"VAR_2 = strtol(gain, &VAR_0, 0);",
"if (*VAR_0++ == '.') {",
"while (av_isdigit(*VAR_0) && VAR_1) {",
"mb += VAR_1 * (*VAR_0 - '0');",
"VAR_1 /= 10;",
"VAR_0++;",
"}",
"}",
"if (abs(VAR_2) > (INT32_MAX - mb) / 100000)\nreturn INT32_MIN;",
"return VAR_2 * 100000 + FFSIGN(VAR_2) * mb;",
"}"
] | [
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
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
43,
45
],
[
49
],
[
51
]
] |
19,630 | int ffurl_read(URLContext *h, unsigned char *buf, int size)
{
if (h->flags & AVIO_FLAG_WRITE)
return AVERROR(EIO);
return retry_transfer_wrapper(h, buf, size, 1, h->prot->url_read);
}
| true | FFmpeg | 26f6b8c571bcff7b325c7d6cc226c625dd465f8e | int ffurl_read(URLContext *h, unsigned char *buf, int size)
{
if (h->flags & AVIO_FLAG_WRITE)
return AVERROR(EIO);
return retry_transfer_wrapper(h, buf, size, 1, h->prot->url_read);
}
| {
"code": [
" if (h->flags & AVIO_FLAG_WRITE)",
" if (h->flags & AVIO_FLAG_WRITE)"
],
"line_no": [
5,
5
]
} | int FUNC_0(URLContext *VAR_0, unsigned char *VAR_1, int VAR_2)
{
if (VAR_0->flags & AVIO_FLAG_WRITE)
return AVERROR(EIO);
return retry_transfer_wrapper(VAR_0, VAR_1, VAR_2, 1, VAR_0->prot->url_read);
}
| [
"int FUNC_0(URLContext *VAR_0, unsigned char *VAR_1, int VAR_2)\n{",
"if (VAR_0->flags & AVIO_FLAG_WRITE)\nreturn AVERROR(EIO);",
"return retry_transfer_wrapper(VAR_0, VAR_1, VAR_2, 1, VAR_0->prot->url_read);",
"}"
] | [
0,
1,
0,
0
] | [
[
1,
3
],
[
5,
7
],
[
9
],
[
11
]
] |
19,631 | static void spapr_vio_bridge_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = spapr_vio_bridge_init;
dc->no_user = 1;
}
| true | qemu | efec3dd631d94160288392721a5f9c39e50fb2bc | static void spapr_vio_bridge_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = spapr_vio_bridge_init;
dc->no_user = 1;
}
| {
"code": [
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;"
],
"line_no": [
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13
]
} | static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)
{
DeviceClass *dc = DEVICE_CLASS(VAR_0);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(VAR_0);
k->init = spapr_vio_bridge_init;
dc->no_user = 1;
}
| [
"static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{",
"DeviceClass *dc = DEVICE_CLASS(VAR_0);",
"SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(VAR_0);",
"k->init = spapr_vio_bridge_init;",
"dc->no_user = 1;",
"}"
] | [
0,
0,
0,
0,
1,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
15
]
] |
19,632 | int kvm_arch_init_vcpu(CPUState *env)
{
struct {
struct kvm_cpuid2 cpuid;
struct kvm_cpuid_entry2 entries[100];
} __attribute__((packed)) cpuid_data;
uint32_t limit, i, j, cpuid_i;
uint32_t eax, ebx, ecx, edx;
cpuid_i = 0;
cpu_x86_cpuid(env, 0, 0, &eax, &ebx, &ecx, &edx);
limit = eax;
for (i = 0; i <= limit; i++) {
struct kvm_cpuid_entry2 *c = &cpuid_data.entries[cpuid_i++];
switch (i) {
case 2: {
/* Keep reading function 2 till all the input is received */
int times;
cpu_x86_cpuid(env, i, 0, &eax, &ebx, &ecx, &edx);
times = eax & 0xff;
c->function = i;
c->flags |= KVM_CPUID_FLAG_STATEFUL_FUNC;
c->flags |= KVM_CPUID_FLAG_STATE_READ_NEXT;
c->eax = eax;
c->ebx = ebx;
c->ecx = ecx;
c->edx = edx;
for (j = 1; j < times; ++j) {
cpu_x86_cpuid(env, i, 0, &eax, &ebx, &ecx, &edx);
c->function = i;
c->flags |= KVM_CPUID_FLAG_STATEFUL_FUNC;
c->eax = eax;
c->ebx = ebx;
c->ecx = ecx;
c->edx = edx;
c = &cpuid_data.entries[++cpuid_i];
}
break;
}
case 4:
case 0xb:
case 0xd:
for (j = 0; ; j++) {
cpu_x86_cpuid(env, i, j, &eax, &ebx, &ecx, &edx);
c->function = i;
c->flags = KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
c->index = j;
c->eax = eax;
c->ebx = ebx;
c->ecx = ecx;
c->edx = edx;
c = &cpuid_data.entries[++cpuid_i];
if (i == 4 && eax == 0)
break;
if (i == 0xb && !(ecx & 0xff00))
break;
if (i == 0xd && eax == 0)
break;
}
break;
default:
cpu_x86_cpuid(env, i, 0, &eax, &ebx, &ecx, &edx);
c->function = i;
c->eax = eax;
c->ebx = ebx;
c->ecx = ecx;
c->edx = edx;
break;
}
}
cpu_x86_cpuid(env, 0x80000000, 0, &eax, &ebx, &ecx, &edx);
limit = eax;
for (i = 0x80000000; i <= limit; i++) {
struct kvm_cpuid_entry2 *c = &cpuid_data.entries[cpuid_i++];
cpu_x86_cpuid(env, i, 0, &eax, &ebx, &ecx, &edx);
c->function = i;
c->eax = eax;
c->ebx = ebx;
c->ecx = ecx;
c->edx = edx;
}
cpuid_data.cpuid.nent = cpuid_i;
return kvm_vcpu_ioctl(env, KVM_SET_CPUID2, &cpuid_data);
}
| true | qemu | a33609cae0d57a7574608145f553cc5279221c31 | int kvm_arch_init_vcpu(CPUState *env)
{
struct {
struct kvm_cpuid2 cpuid;
struct kvm_cpuid_entry2 entries[100];
} __attribute__((packed)) cpuid_data;
uint32_t limit, i, j, cpuid_i;
uint32_t eax, ebx, ecx, edx;
cpuid_i = 0;
cpu_x86_cpuid(env, 0, 0, &eax, &ebx, &ecx, &edx);
limit = eax;
for (i = 0; i <= limit; i++) {
struct kvm_cpuid_entry2 *c = &cpuid_data.entries[cpuid_i++];
switch (i) {
case 2: {
int times;
cpu_x86_cpuid(env, i, 0, &eax, &ebx, &ecx, &edx);
times = eax & 0xff;
c->function = i;
c->flags |= KVM_CPUID_FLAG_STATEFUL_FUNC;
c->flags |= KVM_CPUID_FLAG_STATE_READ_NEXT;
c->eax = eax;
c->ebx = ebx;
c->ecx = ecx;
c->edx = edx;
for (j = 1; j < times; ++j) {
cpu_x86_cpuid(env, i, 0, &eax, &ebx, &ecx, &edx);
c->function = i;
c->flags |= KVM_CPUID_FLAG_STATEFUL_FUNC;
c->eax = eax;
c->ebx = ebx;
c->ecx = ecx;
c->edx = edx;
c = &cpuid_data.entries[++cpuid_i];
}
break;
}
case 4:
case 0xb:
case 0xd:
for (j = 0; ; j++) {
cpu_x86_cpuid(env, i, j, &eax, &ebx, &ecx, &edx);
c->function = i;
c->flags = KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
c->index = j;
c->eax = eax;
c->ebx = ebx;
c->ecx = ecx;
c->edx = edx;
c = &cpuid_data.entries[++cpuid_i];
if (i == 4 && eax == 0)
break;
if (i == 0xb && !(ecx & 0xff00))
break;
if (i == 0xd && eax == 0)
break;
}
break;
default:
cpu_x86_cpuid(env, i, 0, &eax, &ebx, &ecx, &edx);
c->function = i;
c->eax = eax;
c->ebx = ebx;
c->ecx = ecx;
c->edx = edx;
break;
}
}
cpu_x86_cpuid(env, 0x80000000, 0, &eax, &ebx, &ecx, &edx);
limit = eax;
for (i = 0x80000000; i <= limit; i++) {
struct kvm_cpuid_entry2 *c = &cpuid_data.entries[cpuid_i++];
cpu_x86_cpuid(env, i, 0, &eax, &ebx, &ecx, &edx);
c->function = i;
c->eax = eax;
c->ebx = ebx;
c->ecx = ecx;
c->edx = edx;
}
cpuid_data.cpuid.nent = cpuid_i;
return kvm_vcpu_ioctl(env, KVM_SET_CPUID2, &cpuid_data);
}
| {
"code": [
" uint32_t eax, ebx, ecx, edx;",
" cpu_x86_cpuid(env, 0, 0, &eax, &ebx, &ecx, &edx);",
" limit = eax;",
" cpu_x86_cpuid(env, i, 0, &eax, &ebx, &ecx, &edx);",
" times = eax & 0xff;",
" c->flags |= KVM_CPUID_FLAG_STATEFUL_FUNC;",
" c->flags |= KVM_CPUID_FLAG_STATE_READ_NEXT;",
" c->eax = eax;",
" c->ebx = ebx;",
" c->ecx = ecx;",
" c->edx = edx;",
" cpu_x86_cpuid(env, i, 0, &eax, &ebx, &ecx, &edx);",
" c->flags |= KVM_CPUID_FLAG_STATEFUL_FUNC;",
" c->eax = eax;",
" c->ebx = ebx;",
" c->ecx = ecx;",
" c->edx = edx;",
" c = &cpuid_data.entries[++cpuid_i];",
" cpu_x86_cpuid(env, i, j, &eax, &ebx, &ecx, &edx);",
" c->eax = eax;",
" c->ebx = ebx;",
" c->ecx = ecx;",
" c->edx = edx;",
" c = &cpuid_data.entries[++cpuid_i];",
" if (i == 4 && eax == 0)",
" if (i == 0xb && !(ecx & 0xff00))",
" if (i == 0xd && eax == 0)",
" cpu_x86_cpuid(env, i, 0, &eax, &ebx, &ecx, &edx);",
" c->eax = eax;",
" c->ebx = ebx;",
" c->ecx = ecx;",
" c->edx = edx;",
" cpu_x86_cpuid(env, 0x80000000, 0, &eax, &ebx, &ecx, &edx);",
" limit = eax;",
" cpu_x86_cpuid(env, i, 0, &eax, &ebx, &ecx, &edx);",
" c->eax = eax;",
" c->ebx = ebx;",
" c->ecx = ecx;",
" c->edx = edx;"
],
"line_no": [
15,
23,
25,
45,
47,
53,
55,
57,
59,
61,
63,
69,
73,
75,
77,
79,
81,
83,
99,
75,
77,
79,
81,
83,
119,
123,
127,
45,
57,
59,
61,
63,
155,
25,
167,
171,
173,
175,
177
]
} | int FUNC_0(CPUState *VAR_0)
{
struct {
struct kvm_cpuid2 cpuid;
struct kvm_cpuid_entry2 entries[100];
} __attribute__((packed)) VAR_1;
uint32_t limit, i, j, cpuid_i;
uint32_t eax, ebx, ecx, edx;
cpuid_i = 0;
cpu_x86_cpuid(VAR_0, 0, 0, &eax, &ebx, &ecx, &edx);
limit = eax;
for (i = 0; i <= limit; i++) {
struct kvm_cpuid_entry2 *c = &VAR_1.entries[cpuid_i++];
switch (i) {
case 2: {
int times;
cpu_x86_cpuid(VAR_0, i, 0, &eax, &ebx, &ecx, &edx);
times = eax & 0xff;
c->function = i;
c->flags |= KVM_CPUID_FLAG_STATEFUL_FUNC;
c->flags |= KVM_CPUID_FLAG_STATE_READ_NEXT;
c->eax = eax;
c->ebx = ebx;
c->ecx = ecx;
c->edx = edx;
for (j = 1; j < times; ++j) {
cpu_x86_cpuid(VAR_0, i, 0, &eax, &ebx, &ecx, &edx);
c->function = i;
c->flags |= KVM_CPUID_FLAG_STATEFUL_FUNC;
c->eax = eax;
c->ebx = ebx;
c->ecx = ecx;
c->edx = edx;
c = &VAR_1.entries[++cpuid_i];
}
break;
}
case 4:
case 0xb:
case 0xd:
for (j = 0; ; j++) {
cpu_x86_cpuid(VAR_0, i, j, &eax, &ebx, &ecx, &edx);
c->function = i;
c->flags = KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
c->index = j;
c->eax = eax;
c->ebx = ebx;
c->ecx = ecx;
c->edx = edx;
c = &VAR_1.entries[++cpuid_i];
if (i == 4 && eax == 0)
break;
if (i == 0xb && !(ecx & 0xff00))
break;
if (i == 0xd && eax == 0)
break;
}
break;
default:
cpu_x86_cpuid(VAR_0, i, 0, &eax, &ebx, &ecx, &edx);
c->function = i;
c->eax = eax;
c->ebx = ebx;
c->ecx = ecx;
c->edx = edx;
break;
}
}
cpu_x86_cpuid(VAR_0, 0x80000000, 0, &eax, &ebx, &ecx, &edx);
limit = eax;
for (i = 0x80000000; i <= limit; i++) {
struct kvm_cpuid_entry2 *c = &VAR_1.entries[cpuid_i++];
cpu_x86_cpuid(VAR_0, i, 0, &eax, &ebx, &ecx, &edx);
c->function = i;
c->eax = eax;
c->ebx = ebx;
c->ecx = ecx;
c->edx = edx;
}
VAR_1.cpuid.nent = cpuid_i;
return kvm_vcpu_ioctl(VAR_0, KVM_SET_CPUID2, &VAR_1);
}
| [
"int FUNC_0(CPUState *VAR_0)\n{",
"struct {",
"struct kvm_cpuid2 cpuid;",
"struct kvm_cpuid_entry2 entries[100];",
"} __attribute__((packed)) VAR_1;",
"uint32_t limit, i, j, cpuid_i;",
"uint32_t eax, ebx, ecx, edx;",
"cpuid_i = 0;",
"cpu_x86_cpuid(VAR_0, 0, 0, &eax, &ebx, &ecx, &edx);",
"limit = eax;",
"for (i = 0; i <= limit; i++) {",
"struct kvm_cpuid_entry2 *c = &VAR_1.entries[cpuid_i++];",
"switch (i) {",
"case 2: {",
"int times;",
"cpu_x86_cpuid(VAR_0, i, 0, &eax, &ebx, &ecx, &edx);",
"times = eax & 0xff;",
"c->function = i;",
"c->flags |= KVM_CPUID_FLAG_STATEFUL_FUNC;",
"c->flags |= KVM_CPUID_FLAG_STATE_READ_NEXT;",
"c->eax = eax;",
"c->ebx = ebx;",
"c->ecx = ecx;",
"c->edx = edx;",
"for (j = 1; j < times; ++j) {",
"cpu_x86_cpuid(VAR_0, i, 0, &eax, &ebx, &ecx, &edx);",
"c->function = i;",
"c->flags |= KVM_CPUID_FLAG_STATEFUL_FUNC;",
"c->eax = eax;",
"c->ebx = ebx;",
"c->ecx = ecx;",
"c->edx = edx;",
"c = &VAR_1.entries[++cpuid_i];",
"}",
"break;",
"}",
"case 4:\ncase 0xb:\ncase 0xd:\nfor (j = 0; ; j++) {",
"cpu_x86_cpuid(VAR_0, i, j, &eax, &ebx, &ecx, &edx);",
"c->function = i;",
"c->flags = KVM_CPUID_FLAG_SIGNIFCANT_INDEX;",
"c->index = j;",
"c->eax = eax;",
"c->ebx = ebx;",
"c->ecx = ecx;",
"c->edx = edx;",
"c = &VAR_1.entries[++cpuid_i];",
"if (i == 4 && eax == 0)\nbreak;",
"if (i == 0xb && !(ecx & 0xff00))\nbreak;",
"if (i == 0xd && eax == 0)\nbreak;",
"}",
"break;",
"default:\ncpu_x86_cpuid(VAR_0, i, 0, &eax, &ebx, &ecx, &edx);",
"c->function = i;",
"c->eax = eax;",
"c->ebx = ebx;",
"c->ecx = ecx;",
"c->edx = edx;",
"break;",
"}",
"}",
"cpu_x86_cpuid(VAR_0, 0x80000000, 0, &eax, &ebx, &ecx, &edx);",
"limit = eax;",
"for (i = 0x80000000; i <= limit; i++) {",
"struct kvm_cpuid_entry2 *c = &VAR_1.entries[cpuid_i++];",
"cpu_x86_cpuid(VAR_0, i, 0, &eax, &ebx, &ecx, &edx);",
"c->function = i;",
"c->eax = eax;",
"c->ebx = ebx;",
"c->ecx = ecx;",
"c->edx = edx;",
"}",
"VAR_1.cpuid.nent = cpuid_i;",
"return kvm_vcpu_ioctl(VAR_0, KVM_SET_CPUID2, &VAR_1);",
"}"
] | [
0,
0,
0,
0,
0,
0,
1,
0,
1,
1,
0,
0,
0,
0,
0,
1,
1,
0,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
1,
0,
1,
1,
1,
1,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
23
],
[
25
],
[
29
],
[
31
],
[
35
],
[
37
],
[
41
],
[
45
],
[
47
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91,
93,
95,
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
119,
121
],
[
123,
125
],
[
127,
129
],
[
131
],
[
133
],
[
135,
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149
],
[
151
],
[
153
],
[
155
],
[
157
],
[
161
],
[
163
],
[
167
],
[
169
],
[
171
],
[
173
],
[
175
],
[
177
],
[
179
],
[
183
],
[
187
],
[
189
]
] |
19,634 | static int webm_dash_manifest_read_header(AVFormatContext *s)
{
char *buf;
int ret = matroska_read_header(s);
MatroskaTrack *tracks;
MatroskaDemuxContext *matroska = s->priv_data;
if (ret) {
av_log(s, AV_LOG_ERROR, "Failed to read file headers\n");
return -1;
if (!matroska->is_live) {
buf = av_asprintf("%g", matroska->duration);
if (!buf) return AVERROR(ENOMEM);
av_dict_set(&s->streams[0]->metadata, DURATION, buf, 0);
av_free(buf);
// initialization range
// 5 is the offset of Cluster ID.
av_dict_set_int(&s->streams[0]->metadata, INITIALIZATION_RANGE, avio_tell(s->pb) - 5, 0);
// basename of the file
buf = strrchr(s->filename, '/');
av_dict_set(&s->streams[0]->metadata, FILENAME, buf ? ++buf : s->filename, 0);
// track number
tracks = matroska->tracks.elem;
av_dict_set_int(&s->streams[0]->metadata, TRACK_NUMBER, tracks[0].num, 0);
// parse the cues and populate Cue related fields
return matroska->is_live ? 0 : webm_dash_manifest_cues(s);
| true | FFmpeg | ff100c9dd97d2f1f456ff38b192edf84f9744738 | static int webm_dash_manifest_read_header(AVFormatContext *s)
{
char *buf;
int ret = matroska_read_header(s);
MatroskaTrack *tracks;
MatroskaDemuxContext *matroska = s->priv_data;
if (ret) {
av_log(s, AV_LOG_ERROR, "Failed to read file headers\n");
return -1;
if (!matroska->is_live) {
buf = av_asprintf("%g", matroska->duration);
if (!buf) return AVERROR(ENOMEM);
av_dict_set(&s->streams[0]->metadata, DURATION, buf, 0);
av_free(buf);
av_dict_set_int(&s->streams[0]->metadata, INITIALIZATION_RANGE, avio_tell(s->pb) - 5, 0);
buf = strrchr(s->filename, '/');
av_dict_set(&s->streams[0]->metadata, FILENAME, buf ? ++buf : s->filename, 0);
tracks = matroska->tracks.elem;
av_dict_set_int(&s->streams[0]->metadata, TRACK_NUMBER, tracks[0].num, 0);
return matroska->is_live ? 0 : webm_dash_manifest_cues(s);
| {
"code": [],
"line_no": []
} | static int FUNC_0(AVFormatContext *VAR_0)
{
char *VAR_1;
int VAR_2 = matroska_read_header(VAR_0);
MatroskaTrack *tracks;
MatroskaDemuxContext *matroska = VAR_0->priv_data;
if (VAR_2) {
av_log(VAR_0, AV_LOG_ERROR, "Failed to read file headers\n");
return -1;
if (!matroska->is_live) {
VAR_1 = av_asprintf("%g", matroska->duration);
if (!VAR_1) return AVERROR(ENOMEM);
av_dict_set(&VAR_0->streams[0]->metadata, DURATION, VAR_1, 0);
av_free(VAR_1);
av_dict_set_int(&VAR_0->streams[0]->metadata, INITIALIZATION_RANGE, avio_tell(VAR_0->pb) - 5, 0);
VAR_1 = strrchr(VAR_0->filename, '/');
av_dict_set(&VAR_0->streams[0]->metadata, FILENAME, VAR_1 ? ++VAR_1 : VAR_0->filename, 0);
tracks = matroska->tracks.elem;
av_dict_set_int(&VAR_0->streams[0]->metadata, TRACK_NUMBER, tracks[0].num, 0);
return matroska->is_live ? 0 : webm_dash_manifest_cues(VAR_0);
| [
"static int FUNC_0(AVFormatContext *VAR_0)\n{",
"char *VAR_1;",
"int VAR_2 = matroska_read_header(VAR_0);",
"MatroskaTrack *tracks;",
"MatroskaDemuxContext *matroska = VAR_0->priv_data;",
"if (VAR_2) {",
"av_log(VAR_0, AV_LOG_ERROR, \"Failed to read file headers\\n\");",
"return -1;",
"if (!matroska->is_live) {",
"VAR_1 = av_asprintf(\"%g\", matroska->duration);",
"if (!VAR_1) return AVERROR(ENOMEM);",
"av_dict_set(&VAR_0->streams[0]->metadata, DURATION, VAR_1, 0);",
"av_free(VAR_1);",
"av_dict_set_int(&VAR_0->streams[0]->metadata, INITIALIZATION_RANGE, avio_tell(VAR_0->pb) - 5, 0);",
"VAR_1 = strrchr(VAR_0->filename, '/');",
"av_dict_set(&VAR_0->streams[0]->metadata, FILENAME, VAR_1 ? ++VAR_1 : VAR_0->filename, 0);",
"tracks = matroska->tracks.elem;",
"av_dict_set_int(&VAR_0->streams[0]->metadata, TRACK_NUMBER, tracks[0].num, 0);",
"return matroska->is_live ? 0 : webm_dash_manifest_cues(VAR_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
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
43
],
[
50
],
[
52
],
[
58
],
[
60
],
[
66
]
] |
19,635 | static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
VLCcode *codes, int flags)
{
int table_size, table_index, index, code_prefix, symbol, subtable_bits;
int i, j, k, n, nb, inc;
uint32_t code;
VLC_TYPE (*table)[2];
table_size = 1 << table_nb_bits;
if (table_nb_bits > 30)
return -1;
table_index = alloc_table(vlc, table_size, flags & INIT_VLC_USE_NEW_STATIC);
av_dlog(NULL, "new table index=%d size=%d\n", table_index, table_size);
if (table_index < 0)
return table_index;
table = &vlc->table[table_index];
for (i = 0; i < table_size; i++) {
table[i][1] = 0; //bits
table[i][0] = -1; //codes
}
/* first pass: map codes and compute auxiliary table sizes */
for (i = 0; i < nb_codes; i++) {
n = codes[i].bits;
code = codes[i].code;
symbol = codes[i].symbol;
av_dlog(NULL, "i=%d n=%d code=0x%x\n", i, n, code);
if (n <= table_nb_bits) {
/* no need to add another table */
j = code >> (32 - table_nb_bits);
nb = 1 << (table_nb_bits - n);
inc = 1;
if (flags & INIT_VLC_LE) {
j = bitswap_32(code);
inc = 1 << n;
}
for (k = 0; k < nb; k++) {
av_dlog(NULL, "%4x: code=%d n=%d\n", j, i, n);
if (table[j][1] /*bits*/ != 0) {
av_log(NULL, AV_LOG_ERROR, "incorrect codes\n");
return AVERROR_INVALIDDATA;
}
table[j][1] = n; //bits
table[j][0] = symbol;
j += inc;
}
} else {
/* fill auxiliary table recursively */
n -= table_nb_bits;
code_prefix = code >> (32 - table_nb_bits);
subtable_bits = n;
codes[i].bits = n;
codes[i].code = code << table_nb_bits;
for (k = i+1; k < nb_codes; k++) {
n = codes[k].bits - table_nb_bits;
if (n <= 0)
break;
code = codes[k].code;
if (code >> (32 - table_nb_bits) != code_prefix)
break;
codes[k].bits = n;
codes[k].code = code << table_nb_bits;
subtable_bits = FFMAX(subtable_bits, n);
}
subtable_bits = FFMIN(subtable_bits, table_nb_bits);
j = (flags & INIT_VLC_LE) ? bitswap_32(code_prefix) >> (32 - table_nb_bits) : code_prefix;
table[j][1] = -subtable_bits;
av_dlog(NULL, "%4x: n=%d (subtable)\n",
j, codes[i].bits + table_nb_bits);
index = build_table(vlc, subtable_bits, k-i, codes+i, flags);
if (index < 0)
return index;
/* note: realloc has been done, so reload tables */
table = &vlc->table[table_index];
table[j][0] = index; //code
i = k-1;
}
}
return table_index;
} | true | FFmpeg | 622d463000371467cb0365744f0c1d92b56bed52 | static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
VLCcode *codes, int flags)
{
int table_size, table_index, index, code_prefix, symbol, subtable_bits;
int i, j, k, n, nb, inc;
uint32_t code;
VLC_TYPE (*table)[2];
table_size = 1 << table_nb_bits;
if (table_nb_bits > 30)
return -1;
table_index = alloc_table(vlc, table_size, flags & INIT_VLC_USE_NEW_STATIC);
av_dlog(NULL, "new table index=%d size=%d\n", table_index, table_size);
if (table_index < 0)
return table_index;
table = &vlc->table[table_index];
for (i = 0; i < table_size; i++) {
table[i][1] = 0;
table[i][0] = -1;
}
for (i = 0; i < nb_codes; i++) {
n = codes[i].bits;
code = codes[i].code;
symbol = codes[i].symbol;
av_dlog(NULL, "i=%d n=%d code=0x%x\n", i, n, code);
if (n <= table_nb_bits) {
j = code >> (32 - table_nb_bits);
nb = 1 << (table_nb_bits - n);
inc = 1;
if (flags & INIT_VLC_LE) {
j = bitswap_32(code);
inc = 1 << n;
}
for (k = 0; k < nb; k++) {
av_dlog(NULL, "%4x: code=%d n=%d\n", j, i, n);
if (table[j][1] != 0) {
av_log(NULL, AV_LOG_ERROR, "incorrect codes\n");
return AVERROR_INVALIDDATA;
}
table[j][1] = n;
table[j][0] = symbol;
j += inc;
}
} else {
n -= table_nb_bits;
code_prefix = code >> (32 - table_nb_bits);
subtable_bits = n;
codes[i].bits = n;
codes[i].code = code << table_nb_bits;
for (k = i+1; k < nb_codes; k++) {
n = codes[k].bits - table_nb_bits;
if (n <= 0)
break;
code = codes[k].code;
if (code >> (32 - table_nb_bits) != code_prefix)
break;
codes[k].bits = n;
codes[k].code = code << table_nb_bits;
subtable_bits = FFMAX(subtable_bits, n);
}
subtable_bits = FFMIN(subtable_bits, table_nb_bits);
j = (flags & INIT_VLC_LE) ? bitswap_32(code_prefix) >> (32 - table_nb_bits) : code_prefix;
table[j][1] = -subtable_bits;
av_dlog(NULL, "%4x: n=%d (subtable)\n",
j, codes[i].bits + table_nb_bits);
index = build_table(vlc, subtable_bits, k-i, codes+i, flags);
if (index < 0)
return index;
table = &vlc->table[table_index];
table[j][0] = index;
i = k-1;
}
}
return table_index;
} | {
"code": [],
"line_no": []
} | static int FUNC_0(VLC *VAR_0, int VAR_1, int VAR_2,
VLCcode *VAR_3, int VAR_4)
{
int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;
int VAR_11, VAR_12, VAR_13, VAR_14, VAR_15, VAR_16;
uint32_t code;
VLC_TYPE (*table)[2];
VAR_5 = 1 << VAR_1;
if (VAR_1 > 30)
return -1;
VAR_6 = alloc_table(VAR_0, VAR_5, VAR_4 & INIT_VLC_USE_NEW_STATIC);
av_dlog(NULL, "new table VAR_7=%d size=%d\VAR_14", VAR_6, VAR_5);
if (VAR_6 < 0)
return VAR_6;
table = &VAR_0->table[VAR_6];
for (VAR_11 = 0; VAR_11 < VAR_5; VAR_11++) {
table[VAR_11][1] = 0;
table[VAR_11][0] = -1;
}
for (VAR_11 = 0; VAR_11 < VAR_2; VAR_11++) {
VAR_14 = VAR_3[VAR_11].bits;
code = VAR_3[VAR_11].code;
VAR_9 = VAR_3[VAR_11].VAR_9;
av_dlog(NULL, "VAR_11=%d VAR_14=%d code=0x%x\VAR_14", VAR_11, VAR_14, code);
if (VAR_14 <= VAR_1) {
VAR_12 = code >> (32 - VAR_1);
VAR_15 = 1 << (VAR_1 - VAR_14);
VAR_16 = 1;
if (VAR_4 & INIT_VLC_LE) {
VAR_12 = bitswap_32(code);
VAR_16 = 1 << VAR_14;
}
for (VAR_13 = 0; VAR_13 < VAR_15; VAR_13++) {
av_dlog(NULL, "%4x: code=%d VAR_14=%d\VAR_14", VAR_12, VAR_11, VAR_14);
if (table[VAR_12][1] != 0) {
av_log(NULL, AV_LOG_ERROR, "incorrect VAR_3\VAR_14");
return AVERROR_INVALIDDATA;
}
table[VAR_12][1] = VAR_14;
table[VAR_12][0] = VAR_9;
VAR_12 += VAR_16;
}
} else {
VAR_14 -= VAR_1;
VAR_8 = code >> (32 - VAR_1);
VAR_10 = VAR_14;
VAR_3[VAR_11].bits = VAR_14;
VAR_3[VAR_11].code = code << VAR_1;
for (VAR_13 = VAR_11+1; VAR_13 < VAR_2; VAR_13++) {
VAR_14 = VAR_3[VAR_13].bits - VAR_1;
if (VAR_14 <= 0)
break;
code = VAR_3[VAR_13].code;
if (code >> (32 - VAR_1) != VAR_8)
break;
VAR_3[VAR_13].bits = VAR_14;
VAR_3[VAR_13].code = code << VAR_1;
VAR_10 = FFMAX(VAR_10, VAR_14);
}
VAR_10 = FFMIN(VAR_10, VAR_1);
VAR_12 = (VAR_4 & INIT_VLC_LE) ? bitswap_32(VAR_8) >> (32 - VAR_1) : VAR_8;
table[VAR_12][1] = -VAR_10;
av_dlog(NULL, "%4x: VAR_14=%d (subtable)\VAR_14",
VAR_12, VAR_3[VAR_11].bits + VAR_1);
VAR_7 = FUNC_0(VAR_0, VAR_10, VAR_13-VAR_11, VAR_3+VAR_11, VAR_4);
if (VAR_7 < 0)
return VAR_7;
table = &VAR_0->table[VAR_6];
table[VAR_12][0] = VAR_7;
VAR_11 = VAR_13-1;
}
}
return VAR_6;
} | [
"static int FUNC_0(VLC *VAR_0, int VAR_1, int VAR_2,\nVLCcode *VAR_3, int VAR_4)\n{",
"int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;",
"int VAR_11, VAR_12, VAR_13, VAR_14, VAR_15, VAR_16;",
"uint32_t code;",
"VLC_TYPE (*table)[2];",
"VAR_5 = 1 << VAR_1;",
"if (VAR_1 > 30)\nreturn -1;",
"VAR_6 = alloc_table(VAR_0, VAR_5, VAR_4 & INIT_VLC_USE_NEW_STATIC);",
"av_dlog(NULL, \"new table VAR_7=%d size=%d\\VAR_14\", VAR_6, VAR_5);",
"if (VAR_6 < 0)\nreturn VAR_6;",
"table = &VAR_0->table[VAR_6];",
"for (VAR_11 = 0; VAR_11 < VAR_5; VAR_11++) {",
"table[VAR_11][1] = 0;",
"table[VAR_11][0] = -1;",
"}",
"for (VAR_11 = 0; VAR_11 < VAR_2; VAR_11++) {",
"VAR_14 = VAR_3[VAR_11].bits;",
"code = VAR_3[VAR_11].code;",
"VAR_9 = VAR_3[VAR_11].VAR_9;",
"av_dlog(NULL, \"VAR_11=%d VAR_14=%d code=0x%x\\VAR_14\", VAR_11, VAR_14, code);",
"if (VAR_14 <= VAR_1) {",
"VAR_12 = code >> (32 - VAR_1);",
"VAR_15 = 1 << (VAR_1 - VAR_14);",
"VAR_16 = 1;",
"if (VAR_4 & INIT_VLC_LE) {",
"VAR_12 = bitswap_32(code);",
"VAR_16 = 1 << VAR_14;",
"}",
"for (VAR_13 = 0; VAR_13 < VAR_15; VAR_13++) {",
"av_dlog(NULL, \"%4x: code=%d VAR_14=%d\\VAR_14\", VAR_12, VAR_11, VAR_14);",
"if (table[VAR_12][1] != 0) {",
"av_log(NULL, AV_LOG_ERROR, \"incorrect VAR_3\\VAR_14\");",
"return AVERROR_INVALIDDATA;",
"}",
"table[VAR_12][1] = VAR_14;",
"table[VAR_12][0] = VAR_9;",
"VAR_12 += VAR_16;",
"}",
"} else {",
"VAR_14 -= VAR_1;",
"VAR_8 = code >> (32 - VAR_1);",
"VAR_10 = VAR_14;",
"VAR_3[VAR_11].bits = VAR_14;",
"VAR_3[VAR_11].code = code << VAR_1;",
"for (VAR_13 = VAR_11+1; VAR_13 < VAR_2; VAR_13++) {",
"VAR_14 = VAR_3[VAR_13].bits - VAR_1;",
"if (VAR_14 <= 0)\nbreak;",
"code = VAR_3[VAR_13].code;",
"if (code >> (32 - VAR_1) != VAR_8)\nbreak;",
"VAR_3[VAR_13].bits = VAR_14;",
"VAR_3[VAR_13].code = code << VAR_1;",
"VAR_10 = FFMAX(VAR_10, VAR_14);",
"}",
"VAR_10 = FFMIN(VAR_10, VAR_1);",
"VAR_12 = (VAR_4 & INIT_VLC_LE) ? bitswap_32(VAR_8) >> (32 - VAR_1) : VAR_8;",
"table[VAR_12][1] = -VAR_10;",
"av_dlog(NULL, \"%4x: VAR_14=%d (subtable)\\VAR_14\",\nVAR_12, VAR_3[VAR_11].bits + VAR_1);",
"VAR_7 = FUNC_0(VAR_0, VAR_10, VAR_13-VAR_11, VAR_3+VAR_11, VAR_4);",
"if (VAR_7 < 0)\nreturn VAR_7;",
"table = &VAR_0->table[VAR_6];",
"table[VAR_12][0] = VAR_7;",
"VAR_11 = VAR_13-1;",
"}",
"}",
"return VAR_6;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
35
],
[
37
],
[
39
],
[
41
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113,
115
],
[
117
],
[
119,
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137,
139
],
[
141
],
[
143,
145
],
[
149
],
[
151
],
[
154
],
[
156
],
[
158
],
[
160
],
[
162
]
] |
19,636 | static int mp3_write_audio_packet(AVFormatContext *s, AVPacket *pkt)
{
MP3Context *mp3 = s->priv_data;
if (pkt->data && pkt->size >= 4) {
MPADecodeHeader c;
int av_unused base;
avpriv_mpegaudio_decode_header(&c, AV_RB32(pkt->data));
if (!mp3->initial_bitrate)
mp3->initial_bitrate = c.bit_rate;
if ((c.bit_rate == 0) || (mp3->initial_bitrate != c.bit_rate))
mp3->has_variable_bitrate = 1;
#ifdef FILTER_VBR_HEADERS
/* filter out XING and INFO headers. */
base = 4 + xing_offtbl[c.lsf == 1][c.nb_channels == 1];
if (base + 4 <= pkt->size) {
uint32_t v = AV_RB32(pkt->data + base);
if (MKBETAG('X','i','n','g') == v || MKBETAG('I','n','f','o') == v)
return 0;
}
/* filter out VBRI headers. */
base = 4 + 32;
if (base + 4 <= pkt->size && MKBETAG('V','B','R','I') == AV_RB32(pkt->data + base))
return 0;
#endif
if (mp3->xing_offset)
mp3_xing_add_frame(mp3, pkt);
}
return ff_raw_write_packet(s, pkt);
}
| true | FFmpeg | 2dd0da787ce5008d4d1b8f461fbd1288c32e2c38 | static int mp3_write_audio_packet(AVFormatContext *s, AVPacket *pkt)
{
MP3Context *mp3 = s->priv_data;
if (pkt->data && pkt->size >= 4) {
MPADecodeHeader c;
int av_unused base;
avpriv_mpegaudio_decode_header(&c, AV_RB32(pkt->data));
if (!mp3->initial_bitrate)
mp3->initial_bitrate = c.bit_rate;
if ((c.bit_rate == 0) || (mp3->initial_bitrate != c.bit_rate))
mp3->has_variable_bitrate = 1;
#ifdef FILTER_VBR_HEADERS
base = 4 + xing_offtbl[c.lsf == 1][c.nb_channels == 1];
if (base + 4 <= pkt->size) {
uint32_t v = AV_RB32(pkt->data + base);
if (MKBETAG('X','i','n','g') == v || MKBETAG('I','n','f','o') == v)
return 0;
}
base = 4 + 32;
if (base + 4 <= pkt->size && MKBETAG('V','B','R','I') == AV_RB32(pkt->data + base))
return 0;
#endif
if (mp3->xing_offset)
mp3_xing_add_frame(mp3, pkt);
}
return ff_raw_write_packet(s, pkt);
}
| {
"code": [
" avpriv_mpegaudio_decode_header(&c, AV_RB32(pkt->data));"
],
"line_no": [
17
]
} | static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1)
{
MP3Context *mp3 = VAR_0->priv_data;
if (VAR_1->data && VAR_1->size >= 4) {
MPADecodeHeader c;
int VAR_2 base;
avpriv_mpegaudio_decode_header(&c, AV_RB32(VAR_1->data));
if (!mp3->initial_bitrate)
mp3->initial_bitrate = c.bit_rate;
if ((c.bit_rate == 0) || (mp3->initial_bitrate != c.bit_rate))
mp3->has_variable_bitrate = 1;
#ifdef FILTER_VBR_HEADERS
base = 4 + xing_offtbl[c.lsf == 1][c.nb_channels == 1];
if (base + 4 <= VAR_1->size) {
uint32_t v = AV_RB32(VAR_1->data + base);
if (MKBETAG('X','i','n','g') == v || MKBETAG('I','n','f','o') == v)
return 0;
}
base = 4 + 32;
if (base + 4 <= VAR_1->size && MKBETAG('V','B','R','I') == AV_RB32(VAR_1->data + base))
return 0;
#endif
if (mp3->xing_offset)
mp3_xing_add_frame(mp3, VAR_1);
}
return ff_raw_write_packet(VAR_0, VAR_1);
}
| [
"static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1)\n{",
"MP3Context *mp3 = VAR_0->priv_data;",
"if (VAR_1->data && VAR_1->size >= 4) {",
"MPADecodeHeader c;",
"int VAR_2 base;",
"avpriv_mpegaudio_decode_header(&c, AV_RB32(VAR_1->data));",
"if (!mp3->initial_bitrate)\nmp3->initial_bitrate = c.bit_rate;",
"if ((c.bit_rate == 0) || (mp3->initial_bitrate != c.bit_rate))\nmp3->has_variable_bitrate = 1;",
"#ifdef FILTER_VBR_HEADERS\nbase = 4 + xing_offtbl[c.lsf == 1][c.nb_channels == 1];",
"if (base + 4 <= VAR_1->size) {",
"uint32_t v = AV_RB32(VAR_1->data + base);",
"if (MKBETAG('X','i','n','g') == v || MKBETAG('I','n','f','o') == v)\nreturn 0;",
"}",
"base = 4 + 32;",
"if (base + 4 <= VAR_1->size && MKBETAG('V','B','R','I') == AV_RB32(VAR_1->data + base))\nreturn 0;",
"#endif\nif (mp3->xing_offset)\nmp3_xing_add_frame(mp3, VAR_1);",
"}",
"return ff_raw_write_packet(VAR_0, VAR_1);",
"}"
] | [
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
17
],
[
21,
23
],
[
25,
27
],
[
31,
35
],
[
39
],
[
41
],
[
45,
47
],
[
49
],
[
55
],
[
59,
61
],
[
63,
67,
69
],
[
71
],
[
75
],
[
77
]
] |
19,637 | static int handle_instruction(CPUState *env, struct kvm_run *run)
{
unsigned int ipa0 = (run->s390_sieic.ipa & 0xff00);
uint8_t ipa1 = run->s390_sieic.ipa & 0x00ff;
int ipb_code = (run->s390_sieic.ipb & 0x0fff0000) >> 16;
int r = -1;
dprintf("handle_instruction 0x%x 0x%x\n", run->s390_sieic.ipa, run->s390_sieic.ipb);
switch (ipa0) {
case IPA0_PRIV:
r = handle_priv(env, run, ipa1);
break;
case IPA0_DIAG:
r = handle_diag(env, run, ipb_code);
break;
case IPA0_SIGP:
r = handle_sigp(env, run, ipa1);
break;
}
if (r < 0) {
enter_pgmcheck(env, 0x0001);
}
return r;
}
| true | qemu | 359507eed1b6d8ae2392e0c8fe32d5f0de9d1d75 | static int handle_instruction(CPUState *env, struct kvm_run *run)
{
unsigned int ipa0 = (run->s390_sieic.ipa & 0xff00);
uint8_t ipa1 = run->s390_sieic.ipa & 0x00ff;
int ipb_code = (run->s390_sieic.ipb & 0x0fff0000) >> 16;
int r = -1;
dprintf("handle_instruction 0x%x 0x%x\n", run->s390_sieic.ipa, run->s390_sieic.ipb);
switch (ipa0) {
case IPA0_PRIV:
r = handle_priv(env, run, ipa1);
break;
case IPA0_DIAG:
r = handle_diag(env, run, ipb_code);
break;
case IPA0_SIGP:
r = handle_sigp(env, run, ipa1);
break;
}
if (r < 0) {
enter_pgmcheck(env, 0x0001);
}
return r;
}
| {
"code": [
" return r;"
],
"line_no": [
47
]
} | static int FUNC_0(CPUState *VAR_0, struct kvm_run *VAR_1)
{
unsigned int VAR_2 = (VAR_1->s390_sieic.ipa & 0xff00);
uint8_t ipa1 = VAR_1->s390_sieic.ipa & 0x00ff;
int VAR_3 = (VAR_1->s390_sieic.ipb & 0x0fff0000) >> 16;
int VAR_4 = -1;
dprintf("FUNC_0 0x%x 0x%x\n", VAR_1->s390_sieic.ipa, VAR_1->s390_sieic.ipb);
switch (VAR_2) {
case IPA0_PRIV:
VAR_4 = handle_priv(VAR_0, VAR_1, ipa1);
break;
case IPA0_DIAG:
VAR_4 = handle_diag(VAR_0, VAR_1, VAR_3);
break;
case IPA0_SIGP:
VAR_4 = handle_sigp(VAR_0, VAR_1, ipa1);
break;
}
if (VAR_4 < 0) {
enter_pgmcheck(VAR_0, 0x0001);
}
return VAR_4;
}
| [
"static int FUNC_0(CPUState *VAR_0, struct kvm_run *VAR_1)\n{",
"unsigned int VAR_2 = (VAR_1->s390_sieic.ipa & 0xff00);",
"uint8_t ipa1 = VAR_1->s390_sieic.ipa & 0x00ff;",
"int VAR_3 = (VAR_1->s390_sieic.ipb & 0x0fff0000) >> 16;",
"int VAR_4 = -1;",
"dprintf(\"FUNC_0 0x%x 0x%x\\n\", VAR_1->s390_sieic.ipa, VAR_1->s390_sieic.ipb);",
"switch (VAR_2) {",
"case IPA0_PRIV:\nVAR_4 = handle_priv(VAR_0, VAR_1, ipa1);",
"break;",
"case IPA0_DIAG:\nVAR_4 = handle_diag(VAR_0, VAR_1, VAR_3);",
"break;",
"case IPA0_SIGP:\nVAR_4 = handle_sigp(VAR_0, VAR_1, ipa1);",
"break;",
"}",
"if (VAR_4 < 0) {",
"enter_pgmcheck(VAR_0, 0x0001);",
"}",
"return VAR_4;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
19,
21
],
[
23
],
[
25,
27
],
[
29
],
[
31,
33
],
[
35
],
[
37
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
]
] |
19,638 | static int process_output_surface(AVCodecContext *avctx, AVPacket *pkt, NvencSurface *tmpoutsurf)
{
NvencContext *ctx = avctx->priv_data;
NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs;
NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &dl_fn->nvenc_funcs;
uint32_t slice_mode_data;
uint32_t *slice_offsets;
NV_ENC_LOCK_BITSTREAM lock_params = { 0 };
NVENCSTATUS nv_status;
int res = 0;
enum AVPictureType pict_type;
switch (avctx->codec->id) {
case AV_CODEC_ID_H264:
slice_mode_data = ctx->encode_config.encodeCodecConfig.h264Config.sliceModeData;
break;
case AV_CODEC_ID_H265:
slice_mode_data = ctx->encode_config.encodeCodecConfig.hevcConfig.sliceModeData;
break;
default:
av_log(avctx, AV_LOG_ERROR, "Unknown codec name\n");
res = AVERROR(EINVAL);
goto error;
}
slice_offsets = av_mallocz(slice_mode_data * sizeof(*slice_offsets));
if (!slice_offsets)
goto error;
lock_params.version = NV_ENC_LOCK_BITSTREAM_VER;
lock_params.doNotWait = 0;
lock_params.outputBitstream = tmpoutsurf->output_surface;
lock_params.sliceOffsets = slice_offsets;
nv_status = p_nvenc->nvEncLockBitstream(ctx->nvencoder, &lock_params);
if (nv_status != NV_ENC_SUCCESS) {
res = nvenc_print_error(avctx, nv_status, "Failed locking bitstream buffer");
goto error;
}
if (res = ff_alloc_packet2(avctx, pkt, lock_params.bitstreamSizeInBytes,0)) {
p_nvenc->nvEncUnlockBitstream(ctx->nvencoder, tmpoutsurf->output_surface);
goto error;
}
memcpy(pkt->data, lock_params.bitstreamBufferPtr, lock_params.bitstreamSizeInBytes);
nv_status = p_nvenc->nvEncUnlockBitstream(ctx->nvencoder, tmpoutsurf->output_surface);
if (nv_status != NV_ENC_SUCCESS)
nvenc_print_error(avctx, nv_status, "Failed unlocking bitstream buffer, expect the gates of mordor to open");
if (avctx->pix_fmt == AV_PIX_FMT_CUDA) {
p_nvenc->nvEncUnmapInputResource(ctx->nvencoder, tmpoutsurf->in_map.mappedResource);
av_frame_unref(tmpoutsurf->in_ref);
ctx->registered_frames[tmpoutsurf->reg_idx].mapped = 0;
tmpoutsurf->input_surface = NULL;
}
switch (lock_params.pictureType) {
case NV_ENC_PIC_TYPE_IDR:
pkt->flags |= AV_PKT_FLAG_KEY;
case NV_ENC_PIC_TYPE_I:
pict_type = AV_PICTURE_TYPE_I;
break;
case NV_ENC_PIC_TYPE_P:
pict_type = AV_PICTURE_TYPE_P;
break;
case NV_ENC_PIC_TYPE_B:
pict_type = AV_PICTURE_TYPE_B;
break;
case NV_ENC_PIC_TYPE_BI:
pict_type = AV_PICTURE_TYPE_BI;
break;
default:
av_log(avctx, AV_LOG_ERROR, "Unknown picture type encountered, expect the output to be broken.\n");
av_log(avctx, AV_LOG_ERROR, "Please report this error and include as much information on how to reproduce it as possible.\n");
res = AVERROR_EXTERNAL;
goto error;
}
#if FF_API_CODED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
avctx->coded_frame->pict_type = pict_type;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
ff_side_data_set_encoder_stats(pkt,
(lock_params.frameAvgQP - 1) * FF_QP2LAMBDA, NULL, 0, pict_type);
res = nvenc_set_timestamp(avctx, &lock_params, pkt);
if (res < 0)
goto error2;
av_free(slice_offsets);
return 0;
error:
timestamp_queue_dequeue(ctx->timestamp_list);
error2:
av_free(slice_offsets);
return res;
}
| true | FFmpeg | a19989cae581817e8857623d3afc447372b1c0e3 | static int process_output_surface(AVCodecContext *avctx, AVPacket *pkt, NvencSurface *tmpoutsurf)
{
NvencContext *ctx = avctx->priv_data;
NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs;
NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &dl_fn->nvenc_funcs;
uint32_t slice_mode_data;
uint32_t *slice_offsets;
NV_ENC_LOCK_BITSTREAM lock_params = { 0 };
NVENCSTATUS nv_status;
int res = 0;
enum AVPictureType pict_type;
switch (avctx->codec->id) {
case AV_CODEC_ID_H264:
slice_mode_data = ctx->encode_config.encodeCodecConfig.h264Config.sliceModeData;
break;
case AV_CODEC_ID_H265:
slice_mode_data = ctx->encode_config.encodeCodecConfig.hevcConfig.sliceModeData;
break;
default:
av_log(avctx, AV_LOG_ERROR, "Unknown codec name\n");
res = AVERROR(EINVAL);
goto error;
}
slice_offsets = av_mallocz(slice_mode_data * sizeof(*slice_offsets));
if (!slice_offsets)
goto error;
lock_params.version = NV_ENC_LOCK_BITSTREAM_VER;
lock_params.doNotWait = 0;
lock_params.outputBitstream = tmpoutsurf->output_surface;
lock_params.sliceOffsets = slice_offsets;
nv_status = p_nvenc->nvEncLockBitstream(ctx->nvencoder, &lock_params);
if (nv_status != NV_ENC_SUCCESS) {
res = nvenc_print_error(avctx, nv_status, "Failed locking bitstream buffer");
goto error;
}
if (res = ff_alloc_packet2(avctx, pkt, lock_params.bitstreamSizeInBytes,0)) {
p_nvenc->nvEncUnlockBitstream(ctx->nvencoder, tmpoutsurf->output_surface);
goto error;
}
memcpy(pkt->data, lock_params.bitstreamBufferPtr, lock_params.bitstreamSizeInBytes);
nv_status = p_nvenc->nvEncUnlockBitstream(ctx->nvencoder, tmpoutsurf->output_surface);
if (nv_status != NV_ENC_SUCCESS)
nvenc_print_error(avctx, nv_status, "Failed unlocking bitstream buffer, expect the gates of mordor to open");
if (avctx->pix_fmt == AV_PIX_FMT_CUDA) {
p_nvenc->nvEncUnmapInputResource(ctx->nvencoder, tmpoutsurf->in_map.mappedResource);
av_frame_unref(tmpoutsurf->in_ref);
ctx->registered_frames[tmpoutsurf->reg_idx].mapped = 0;
tmpoutsurf->input_surface = NULL;
}
switch (lock_params.pictureType) {
case NV_ENC_PIC_TYPE_IDR:
pkt->flags |= AV_PKT_FLAG_KEY;
case NV_ENC_PIC_TYPE_I:
pict_type = AV_PICTURE_TYPE_I;
break;
case NV_ENC_PIC_TYPE_P:
pict_type = AV_PICTURE_TYPE_P;
break;
case NV_ENC_PIC_TYPE_B:
pict_type = AV_PICTURE_TYPE_B;
break;
case NV_ENC_PIC_TYPE_BI:
pict_type = AV_PICTURE_TYPE_BI;
break;
default:
av_log(avctx, AV_LOG_ERROR, "Unknown picture type encountered, expect the output to be broken.\n");
av_log(avctx, AV_LOG_ERROR, "Please report this error and include as much information on how to reproduce it as possible.\n");
res = AVERROR_EXTERNAL;
goto error;
}
#if FF_API_CODED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
avctx->coded_frame->pict_type = pict_type;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
ff_side_data_set_encoder_stats(pkt,
(lock_params.frameAvgQP - 1) * FF_QP2LAMBDA, NULL, 0, pict_type);
res = nvenc_set_timestamp(avctx, &lock_params, pkt);
if (res < 0)
goto error2;
av_free(slice_offsets);
return 0;
error:
timestamp_queue_dequeue(ctx->timestamp_list);
error2:
av_free(slice_offsets);
return res;
}
| {
"code": [
" uint32_t *slice_offsets;"
],
"line_no": [
15
]
} | static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1, NvencSurface *VAR_2)
{
NvencContext *ctx = VAR_0->priv_data;
NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs;
NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &dl_fn->nvenc_funcs;
uint32_t slice_mode_data;
uint32_t *slice_offsets;
NV_ENC_LOCK_BITSTREAM lock_params = { 0 };
NVENCSTATUS nv_status;
int VAR_3 = 0;
enum AVPictureType VAR_4;
switch (VAR_0->codec->id) {
case AV_CODEC_ID_H264:
slice_mode_data = ctx->encode_config.encodeCodecConfig.h264Config.sliceModeData;
break;
case AV_CODEC_ID_H265:
slice_mode_data = ctx->encode_config.encodeCodecConfig.hevcConfig.sliceModeData;
break;
default:
av_log(VAR_0, AV_LOG_ERROR, "Unknown codec name\n");
VAR_3 = AVERROR(EINVAL);
goto error;
}
slice_offsets = av_mallocz(slice_mode_data * sizeof(*slice_offsets));
if (!slice_offsets)
goto error;
lock_params.version = NV_ENC_LOCK_BITSTREAM_VER;
lock_params.doNotWait = 0;
lock_params.outputBitstream = VAR_2->output_surface;
lock_params.sliceOffsets = slice_offsets;
nv_status = p_nvenc->nvEncLockBitstream(ctx->nvencoder, &lock_params);
if (nv_status != NV_ENC_SUCCESS) {
VAR_3 = nvenc_print_error(VAR_0, nv_status, "Failed locking bitstream buffer");
goto error;
}
if (VAR_3 = ff_alloc_packet2(VAR_0, VAR_1, lock_params.bitstreamSizeInBytes,0)) {
p_nvenc->nvEncUnlockBitstream(ctx->nvencoder, VAR_2->output_surface);
goto error;
}
memcpy(VAR_1->data, lock_params.bitstreamBufferPtr, lock_params.bitstreamSizeInBytes);
nv_status = p_nvenc->nvEncUnlockBitstream(ctx->nvencoder, VAR_2->output_surface);
if (nv_status != NV_ENC_SUCCESS)
nvenc_print_error(VAR_0, nv_status, "Failed unlocking bitstream buffer, expect the gates of mordor to open");
if (VAR_0->pix_fmt == AV_PIX_FMT_CUDA) {
p_nvenc->nvEncUnmapInputResource(ctx->nvencoder, VAR_2->in_map.mappedResource);
av_frame_unref(VAR_2->in_ref);
ctx->registered_frames[VAR_2->reg_idx].mapped = 0;
VAR_2->input_surface = NULL;
}
switch (lock_params.pictureType) {
case NV_ENC_PIC_TYPE_IDR:
VAR_1->flags |= AV_PKT_FLAG_KEY;
case NV_ENC_PIC_TYPE_I:
VAR_4 = AV_PICTURE_TYPE_I;
break;
case NV_ENC_PIC_TYPE_P:
VAR_4 = AV_PICTURE_TYPE_P;
break;
case NV_ENC_PIC_TYPE_B:
VAR_4 = AV_PICTURE_TYPE_B;
break;
case NV_ENC_PIC_TYPE_BI:
VAR_4 = AV_PICTURE_TYPE_BI;
break;
default:
av_log(VAR_0, AV_LOG_ERROR, "Unknown picture type encountered, expect the output to be broken.\n");
av_log(VAR_0, AV_LOG_ERROR, "Please report this error and include as much information on how to reproduce it as possible.\n");
VAR_3 = AVERROR_EXTERNAL;
goto error;
}
#if FF_API_CODED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
VAR_0->coded_frame->VAR_4 = VAR_4;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
ff_side_data_set_encoder_stats(VAR_1,
(lock_params.frameAvgQP - 1) * FF_QP2LAMBDA, NULL, 0, VAR_4);
VAR_3 = nvenc_set_timestamp(VAR_0, &lock_params, VAR_1);
if (VAR_3 < 0)
goto error2;
av_free(slice_offsets);
return 0;
error:
timestamp_queue_dequeue(ctx->timestamp_list);
error2:
av_free(slice_offsets);
return VAR_3;
}
| [
"static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1, NvencSurface *VAR_2)\n{",
"NvencContext *ctx = VAR_0->priv_data;",
"NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs;",
"NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &dl_fn->nvenc_funcs;",
"uint32_t slice_mode_data;",
"uint32_t *slice_offsets;",
"NV_ENC_LOCK_BITSTREAM lock_params = { 0 };",
"NVENCSTATUS nv_status;",
"int VAR_3 = 0;",
"enum AVPictureType VAR_4;",
"switch (VAR_0->codec->id) {",
"case AV_CODEC_ID_H264:\nslice_mode_data = ctx->encode_config.encodeCodecConfig.h264Config.sliceModeData;",
"break;",
"case AV_CODEC_ID_H265:\nslice_mode_data = ctx->encode_config.encodeCodecConfig.hevcConfig.sliceModeData;",
"break;",
"default:\nav_log(VAR_0, AV_LOG_ERROR, \"Unknown codec name\\n\");",
"VAR_3 = AVERROR(EINVAL);",
"goto error;",
"}",
"slice_offsets = av_mallocz(slice_mode_data * sizeof(*slice_offsets));",
"if (!slice_offsets)\ngoto error;",
"lock_params.version = NV_ENC_LOCK_BITSTREAM_VER;",
"lock_params.doNotWait = 0;",
"lock_params.outputBitstream = VAR_2->output_surface;",
"lock_params.sliceOffsets = slice_offsets;",
"nv_status = p_nvenc->nvEncLockBitstream(ctx->nvencoder, &lock_params);",
"if (nv_status != NV_ENC_SUCCESS) {",
"VAR_3 = nvenc_print_error(VAR_0, nv_status, \"Failed locking bitstream buffer\");",
"goto error;",
"}",
"if (VAR_3 = ff_alloc_packet2(VAR_0, VAR_1, lock_params.bitstreamSizeInBytes,0)) {",
"p_nvenc->nvEncUnlockBitstream(ctx->nvencoder, VAR_2->output_surface);",
"goto error;",
"}",
"memcpy(VAR_1->data, lock_params.bitstreamBufferPtr, lock_params.bitstreamSizeInBytes);",
"nv_status = p_nvenc->nvEncUnlockBitstream(ctx->nvencoder, VAR_2->output_surface);",
"if (nv_status != NV_ENC_SUCCESS)\nnvenc_print_error(VAR_0, nv_status, \"Failed unlocking bitstream buffer, expect the gates of mordor to open\");",
"if (VAR_0->pix_fmt == AV_PIX_FMT_CUDA) {",
"p_nvenc->nvEncUnmapInputResource(ctx->nvencoder, VAR_2->in_map.mappedResource);",
"av_frame_unref(VAR_2->in_ref);",
"ctx->registered_frames[VAR_2->reg_idx].mapped = 0;",
"VAR_2->input_surface = NULL;",
"}",
"switch (lock_params.pictureType) {",
"case NV_ENC_PIC_TYPE_IDR:\nVAR_1->flags |= AV_PKT_FLAG_KEY;",
"case NV_ENC_PIC_TYPE_I:\nVAR_4 = AV_PICTURE_TYPE_I;",
"break;",
"case NV_ENC_PIC_TYPE_P:\nVAR_4 = AV_PICTURE_TYPE_P;",
"break;",
"case NV_ENC_PIC_TYPE_B:\nVAR_4 = AV_PICTURE_TYPE_B;",
"break;",
"case NV_ENC_PIC_TYPE_BI:\nVAR_4 = AV_PICTURE_TYPE_BI;",
"break;",
"default:\nav_log(VAR_0, AV_LOG_ERROR, \"Unknown picture type encountered, expect the output to be broken.\\n\");",
"av_log(VAR_0, AV_LOG_ERROR, \"Please report this error and include as much information on how to reproduce it as possible.\\n\");",
"VAR_3 = AVERROR_EXTERNAL;",
"goto error;",
"}",
"#if FF_API_CODED_FRAME\nFF_DISABLE_DEPRECATION_WARNINGS\nVAR_0->coded_frame->VAR_4 = VAR_4;",
"FF_ENABLE_DEPRECATION_WARNINGS\n#endif\nff_side_data_set_encoder_stats(VAR_1,\n(lock_params.frameAvgQP - 1) * FF_QP2LAMBDA, NULL, 0, VAR_4);",
"VAR_3 = nvenc_set_timestamp(VAR_0, &lock_params, VAR_1);",
"if (VAR_3 < 0)\ngoto error2;",
"av_free(slice_offsets);",
"return 0;",
"error:\ntimestamp_queue_dequeue(ctx->timestamp_list);",
"error2:\nav_free(slice_offsets);",
"return VAR_3;",
"}"
] | [
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
29
],
[
31,
33
],
[
35
],
[
37,
39
],
[
41
],
[
43,
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
57,
59
],
[
63
],
[
67
],
[
69
],
[
71
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
87
],
[
89
],
[
91
],
[
93
],
[
97
],
[
101
],
[
103,
105
],
[
111
],
[
113
],
[
115
],
[
117
],
[
121
],
[
123
],
[
127
],
[
129,
131
],
[
133,
135
],
[
137
],
[
139,
141
],
[
143
],
[
145,
147
],
[
149
],
[
151,
153
],
[
155
],
[
157,
159
],
[
161
],
[
163
],
[
165
],
[
167
],
[
171,
173,
175
],
[
177,
179,
183,
185
],
[
189
],
[
191,
193
],
[
197
],
[
201
],
[
205,
207
],
[
211,
213
],
[
217
],
[
219
]
] |
19,639 | yuv2422_1_c_template(SwsContext *c, const int16_t *buf0,
const int16_t *ubuf[2], const int16_t *vbuf[2],
const int16_t *abuf0, uint8_t *dest, int dstW,
int uvalpha, int y, enum PixelFormat target)
{
const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
int i;
if (uvalpha < 2048) {
for (i = 0; i < (dstW >> 1); i++) {
int Y1 = buf0[i * 2] >> 7;
int Y2 = buf0[i * 2 + 1] >> 7;
int U = ubuf0[i] >> 7;
int V = vbuf0[i] >> 7;
output_pixels(i * 4, Y1, U, Y2, V);
}
} else {
const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
for (i = 0; i < (dstW >> 1); i++) {
int Y1 = buf0[i * 2] >> 7;
int Y2 = buf0[i * 2 + 1] >> 7;
int U = (ubuf0[i] + ubuf1[i]) >> 8;
int V = (vbuf0[i] + vbuf1[i]) >> 8;
output_pixels(i * 4, Y1, U, Y2, V);
}
}
} | true | FFmpeg | 9487fb4dea3498eb4711eb023f43199f68701b1e | yuv2422_1_c_template(SwsContext *c, const int16_t *buf0,
const int16_t *ubuf[2], const int16_t *vbuf[2],
const int16_t *abuf0, uint8_t *dest, int dstW,
int uvalpha, int y, enum PixelFormat target)
{
const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
int i;
if (uvalpha < 2048) {
for (i = 0; i < (dstW >> 1); i++) {
int Y1 = buf0[i * 2] >> 7;
int Y2 = buf0[i * 2 + 1] >> 7;
int U = ubuf0[i] >> 7;
int V = vbuf0[i] >> 7;
output_pixels(i * 4, Y1, U, Y2, V);
}
} else {
const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
for (i = 0; i < (dstW >> 1); i++) {
int Y1 = buf0[i * 2] >> 7;
int Y2 = buf0[i * 2 + 1] >> 7;
int U = (ubuf0[i] + ubuf1[i]) >> 8;
int V = (vbuf0[i] + vbuf1[i]) >> 8;
output_pixels(i * 4, Y1, U, Y2, V);
}
}
} | {
"code": [],
"line_no": []
} | FUNC_0(SwsContext *VAR_0, const int16_t *VAR_1,
const int16_t *VAR_2[2], const int16_t *VAR_3[2],
const int16_t *VAR_4, uint8_t *VAR_5, int VAR_6,
int VAR_7, int VAR_8, enum PixelFormat VAR_9)
{
const int16_t *VAR_10 = VAR_2[0], *vbuf0 = VAR_3[0];
int VAR_11;
if (VAR_7 < 2048) {
for (VAR_11 = 0; VAR_11 < (VAR_6 >> 1); VAR_11++) {
int VAR_17 = VAR_1[VAR_11 * 2] >> 7;
int VAR_17 = VAR_1[VAR_11 * 2 + 1] >> 7;
int VAR_17 = VAR_10[VAR_11] >> 7;
int VAR_17 = vbuf0[VAR_11] >> 7;
output_pixels(VAR_11 * 4, VAR_17, VAR_17, VAR_17, VAR_17);
}
} else {
const int16_t *VAR_16 = VAR_2[1], *vbuf1 = VAR_3[1];
for (VAR_11 = 0; VAR_11 < (VAR_6 >> 1); VAR_11++) {
int VAR_17 = VAR_1[VAR_11 * 2] >> 7;
int VAR_17 = VAR_1[VAR_11 * 2 + 1] >> 7;
int VAR_17 = (VAR_10[VAR_11] + VAR_16[VAR_11]) >> 8;
int VAR_17 = (vbuf0[VAR_11] + vbuf1[VAR_11]) >> 8;
output_pixels(VAR_11 * 4, VAR_17, VAR_17, VAR_17, VAR_17);
}
}
} | [
"FUNC_0(SwsContext *VAR_0, const int16_t *VAR_1,\nconst int16_t *VAR_2[2], const int16_t *VAR_3[2],\nconst int16_t *VAR_4, uint8_t *VAR_5, int VAR_6,\nint VAR_7, int VAR_8, enum PixelFormat VAR_9)\n{",
"const int16_t *VAR_10 = VAR_2[0], *vbuf0 = VAR_3[0];",
"int VAR_11;",
"if (VAR_7 < 2048) {",
"for (VAR_11 = 0; VAR_11 < (VAR_6 >> 1); VAR_11++) {",
"int VAR_17 = VAR_1[VAR_11 * 2] >> 7;",
"int VAR_17 = VAR_1[VAR_11 * 2 + 1] >> 7;",
"int VAR_17 = VAR_10[VAR_11] >> 7;",
"int VAR_17 = vbuf0[VAR_11] >> 7;",
"output_pixels(VAR_11 * 4, VAR_17, VAR_17, VAR_17, VAR_17);",
"}",
"} else {",
"const int16_t *VAR_16 = VAR_2[1], *vbuf1 = VAR_3[1];",
"for (VAR_11 = 0; VAR_11 < (VAR_6 >> 1); VAR_11++) {",
"int VAR_17 = VAR_1[VAR_11 * 2] >> 7;",
"int VAR_17 = VAR_1[VAR_11 * 2 + 1] >> 7;",
"int VAR_17 = (VAR_10[VAR_11] + VAR_16[VAR_11]) >> 8;",
"int VAR_17 = (vbuf0[VAR_11] + vbuf1[VAR_11]) >> 8;",
"output_pixels(VAR_11 * 4, VAR_17, VAR_17, VAR_17, VAR_17);",
"}",
"}",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
2,
3,
4,
5
],
[
6
],
[
7
],
[
8
],
[
9
],
[
10
],
[
11
],
[
12
],
[
13
],
[
14
],
[
15
],
[
16
],
[
17
],
[
18
],
[
19
],
[
20
],
[
21
],
[
22
],
[
23
],
[
24
],
[
25
],
[
26
]
] |
19,640 | static int coroutine_fn iscsi_co_readv(BlockDriverState *bs,
int64_t sector_num, int nb_sectors,
QEMUIOVector *iov)
{
IscsiLun *iscsilun = bs->opaque;
struct IscsiTask iTask;
uint64_t lba;
uint32_t num_sectors;
if (!is_sector_request_lun_aligned(sector_num, nb_sectors, iscsilun)) {
return -EINVAL;
}
if (bs->bl.max_transfer_length && nb_sectors > bs->bl.max_transfer_length) {
error_report("iSCSI Error: Read of %d sectors exceeds max_xfer_len "
"of %d sectors", nb_sectors, bs->bl.max_transfer_length);
return -EINVAL;
}
if (iscsilun->lbprz && nb_sectors >= ISCSI_CHECKALLOC_THRES &&
!iscsi_allocationmap_is_allocated(iscsilun, sector_num, nb_sectors)) {
int64_t ret;
int pnum;
BlockDriverState *file;
ret = iscsi_co_get_block_status(bs, sector_num, INT_MAX, &pnum, &file);
if (ret < 0) {
return ret;
}
if (ret & BDRV_BLOCK_ZERO && pnum >= nb_sectors) {
qemu_iovec_memset(iov, 0, 0x00, iov->size);
return 0;
}
}
lba = sector_qemu2lun(sector_num, iscsilun);
num_sectors = sector_qemu2lun(nb_sectors, iscsilun);
iscsi_co_init_iscsitask(iscsilun, &iTask);
retry:
if (iscsilun->use_16_for_rw) {
iTask.task = iscsi_read16_task(iscsilun->iscsi, iscsilun->lun, lba,
num_sectors * iscsilun->block_size,
iscsilun->block_size, 0, 0, 0, 0, 0,
iscsi_co_generic_cb, &iTask);
} else {
iTask.task = iscsi_read10_task(iscsilun->iscsi, iscsilun->lun, lba,
num_sectors * iscsilun->block_size,
iscsilun->block_size,
0, 0, 0, 0, 0,
iscsi_co_generic_cb, &iTask);
}
if (iTask.task == NULL) {
return -ENOMEM;
}
scsi_task_set_iov_in(iTask.task, (struct scsi_iovec *) iov->iov, iov->niov);
while (!iTask.complete) {
iscsi_set_events(iscsilun);
qemu_coroutine_yield();
}
if (iTask.task != NULL) {
scsi_free_scsi_task(iTask.task);
iTask.task = NULL;
}
if (iTask.do_retry) {
iTask.complete = 0;
goto retry;
}
if (iTask.status != SCSI_STATUS_GOOD) {
return iTask.err_code;
}
return 0;
}
| true | qemu | 0ead93120eb7bd770b32adc00b5ec1ee721626dc | static int coroutine_fn iscsi_co_readv(BlockDriverState *bs,
int64_t sector_num, int nb_sectors,
QEMUIOVector *iov)
{
IscsiLun *iscsilun = bs->opaque;
struct IscsiTask iTask;
uint64_t lba;
uint32_t num_sectors;
if (!is_sector_request_lun_aligned(sector_num, nb_sectors, iscsilun)) {
return -EINVAL;
}
if (bs->bl.max_transfer_length && nb_sectors > bs->bl.max_transfer_length) {
error_report("iSCSI Error: Read of %d sectors exceeds max_xfer_len "
"of %d sectors", nb_sectors, bs->bl.max_transfer_length);
return -EINVAL;
}
if (iscsilun->lbprz && nb_sectors >= ISCSI_CHECKALLOC_THRES &&
!iscsi_allocationmap_is_allocated(iscsilun, sector_num, nb_sectors)) {
int64_t ret;
int pnum;
BlockDriverState *file;
ret = iscsi_co_get_block_status(bs, sector_num, INT_MAX, &pnum, &file);
if (ret < 0) {
return ret;
}
if (ret & BDRV_BLOCK_ZERO && pnum >= nb_sectors) {
qemu_iovec_memset(iov, 0, 0x00, iov->size);
return 0;
}
}
lba = sector_qemu2lun(sector_num, iscsilun);
num_sectors = sector_qemu2lun(nb_sectors, iscsilun);
iscsi_co_init_iscsitask(iscsilun, &iTask);
retry:
if (iscsilun->use_16_for_rw) {
iTask.task = iscsi_read16_task(iscsilun->iscsi, iscsilun->lun, lba,
num_sectors * iscsilun->block_size,
iscsilun->block_size, 0, 0, 0, 0, 0,
iscsi_co_generic_cb, &iTask);
} else {
iTask.task = iscsi_read10_task(iscsilun->iscsi, iscsilun->lun, lba,
num_sectors * iscsilun->block_size,
iscsilun->block_size,
0, 0, 0, 0, 0,
iscsi_co_generic_cb, &iTask);
}
if (iTask.task == NULL) {
return -ENOMEM;
}
scsi_task_set_iov_in(iTask.task, (struct scsi_iovec *) iov->iov, iov->niov);
while (!iTask.complete) {
iscsi_set_events(iscsilun);
qemu_coroutine_yield();
}
if (iTask.task != NULL) {
scsi_free_scsi_task(iTask.task);
iTask.task = NULL;
}
if (iTask.do_retry) {
iTask.complete = 0;
goto retry;
}
if (iTask.status != SCSI_STATUS_GOOD) {
return iTask.err_code;
}
return 0;
}
| {
"code": [
" ret = iscsi_co_get_block_status(bs, sector_num, INT_MAX, &pnum, &file);"
],
"line_no": [
49
]
} | static int VAR_0 iscsi_co_readv(BlockDriverState *bs,
int64_t sector_num, int nb_sectors,
QEMUIOVector *iov)
{
IscsiLun *iscsilun = bs->opaque;
struct IscsiTask iTask;
uint64_t lba;
uint32_t num_sectors;
if (!is_sector_request_lun_aligned(sector_num, nb_sectors, iscsilun)) {
return -EINVAL;
}
if (bs->bl.max_transfer_length && nb_sectors > bs->bl.max_transfer_length) {
error_report("iSCSI Error: Read of %d sectors exceeds max_xfer_len "
"of %d sectors", nb_sectors, bs->bl.max_transfer_length);
return -EINVAL;
}
if (iscsilun->lbprz && nb_sectors >= ISCSI_CHECKALLOC_THRES &&
!iscsi_allocationmap_is_allocated(iscsilun, sector_num, nb_sectors)) {
int64_t ret;
int pnum;
BlockDriverState *file;
ret = iscsi_co_get_block_status(bs, sector_num, INT_MAX, &pnum, &file);
if (ret < 0) {
return ret;
}
if (ret & BDRV_BLOCK_ZERO && pnum >= nb_sectors) {
qemu_iovec_memset(iov, 0, 0x00, iov->size);
return 0;
}
}
lba = sector_qemu2lun(sector_num, iscsilun);
num_sectors = sector_qemu2lun(nb_sectors, iscsilun);
iscsi_co_init_iscsitask(iscsilun, &iTask);
retry:
if (iscsilun->use_16_for_rw) {
iTask.task = iscsi_read16_task(iscsilun->iscsi, iscsilun->lun, lba,
num_sectors * iscsilun->block_size,
iscsilun->block_size, 0, 0, 0, 0, 0,
iscsi_co_generic_cb, &iTask);
} else {
iTask.task = iscsi_read10_task(iscsilun->iscsi, iscsilun->lun, lba,
num_sectors * iscsilun->block_size,
iscsilun->block_size,
0, 0, 0, 0, 0,
iscsi_co_generic_cb, &iTask);
}
if (iTask.task == NULL) {
return -ENOMEM;
}
scsi_task_set_iov_in(iTask.task, (struct scsi_iovec *) iov->iov, iov->niov);
while (!iTask.complete) {
iscsi_set_events(iscsilun);
qemu_coroutine_yield();
}
if (iTask.task != NULL) {
scsi_free_scsi_task(iTask.task);
iTask.task = NULL;
}
if (iTask.do_retry) {
iTask.complete = 0;
goto retry;
}
if (iTask.status != SCSI_STATUS_GOOD) {
return iTask.err_code;
}
return 0;
}
| [
"static int VAR_0 iscsi_co_readv(BlockDriverState *bs,\nint64_t sector_num, int nb_sectors,\nQEMUIOVector *iov)\n{",
"IscsiLun *iscsilun = bs->opaque;",
"struct IscsiTask iTask;",
"uint64_t lba;",
"uint32_t num_sectors;",
"if (!is_sector_request_lun_aligned(sector_num, nb_sectors, iscsilun)) {",
"return -EINVAL;",
"}",
"if (bs->bl.max_transfer_length && nb_sectors > bs->bl.max_transfer_length) {",
"error_report(\"iSCSI Error: Read of %d sectors exceeds max_xfer_len \"\n\"of %d sectors\", nb_sectors, bs->bl.max_transfer_length);",
"return -EINVAL;",
"}",
"if (iscsilun->lbprz && nb_sectors >= ISCSI_CHECKALLOC_THRES &&\n!iscsi_allocationmap_is_allocated(iscsilun, sector_num, nb_sectors)) {",
"int64_t ret;",
"int pnum;",
"BlockDriverState *file;",
"ret = iscsi_co_get_block_status(bs, sector_num, INT_MAX, &pnum, &file);",
"if (ret < 0) {",
"return ret;",
"}",
"if (ret & BDRV_BLOCK_ZERO && pnum >= nb_sectors) {",
"qemu_iovec_memset(iov, 0, 0x00, iov->size);",
"return 0;",
"}",
"}",
"lba = sector_qemu2lun(sector_num, iscsilun);",
"num_sectors = sector_qemu2lun(nb_sectors, iscsilun);",
"iscsi_co_init_iscsitask(iscsilun, &iTask);",
"retry:\nif (iscsilun->use_16_for_rw) {",
"iTask.task = iscsi_read16_task(iscsilun->iscsi, iscsilun->lun, lba,\nnum_sectors * iscsilun->block_size,\niscsilun->block_size, 0, 0, 0, 0, 0,\niscsi_co_generic_cb, &iTask);",
"} else {",
"iTask.task = iscsi_read10_task(iscsilun->iscsi, iscsilun->lun, lba,\nnum_sectors * iscsilun->block_size,\niscsilun->block_size,\n0, 0, 0, 0, 0,\niscsi_co_generic_cb, &iTask);",
"}",
"if (iTask.task == NULL) {",
"return -ENOMEM;",
"}",
"scsi_task_set_iov_in(iTask.task, (struct scsi_iovec *) iov->iov, iov->niov);",
"while (!iTask.complete) {",
"iscsi_set_events(iscsilun);",
"qemu_coroutine_yield();",
"}",
"if (iTask.task != NULL) {",
"scsi_free_scsi_task(iTask.task);",
"iTask.task = NULL;",
"}",
"if (iTask.do_retry) {",
"iTask.complete = 0;",
"goto retry;",
"}",
"if (iTask.status != SCSI_STATUS_GOOD) {",
"return iTask.err_code;",
"}",
"return 0;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5,
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23
],
[
27
],
[
29,
31
],
[
33
],
[
35
],
[
39,
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
69
],
[
71
],
[
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
],
[
133
],
[
135
],
[
137
],
[
139
],
[
143
],
[
145
],
[
147
],
[
151
],
[
153
]
] |
19,641 | static void spapr_numa_cpu(const void *data)
{
char *cli;
QDict *resp;
QList *cpus;
const QObject *e;
cli = make_cli(data, "-smp 4,cores=4 "
"-numa node,nodeid=0 -numa node,nodeid=1 "
"-numa cpu,node-id=0,core-id=0 "
"-numa cpu,node-id=0,core-id=1 "
"-numa cpu,node-id=0,core-id=2 "
"-numa cpu,node-id=1,core-id=3");
qtest_start(cli);
cpus = get_cpus(&resp);
g_assert(cpus);
while ((e = qlist_pop(cpus))) {
QDict *cpu, *props;
int64_t core, node;
cpu = qobject_to_qdict(e);
g_assert(qdict_haskey(cpu, "props"));
props = qdict_get_qdict(cpu, "props");
g_assert(qdict_haskey(props, "node-id"));
node = qdict_get_int(props, "node-id");
g_assert(qdict_haskey(props, "core-id"));
core = qdict_get_int(props, "core-id");
if (core >= 0 && core < 3) {
g_assert_cmpint(node, ==, 0);
} else if (core == 3) {
g_assert_cmpint(node, ==, 1);
} else {
g_assert(false);
}
}
QDECREF(resp);
qtest_end();
g_free(cli);
}
| true | qemu | 5e39d89d20b17cf6fb7f09d181d34f17b2ae2160 | static void spapr_numa_cpu(const void *data)
{
char *cli;
QDict *resp;
QList *cpus;
const QObject *e;
cli = make_cli(data, "-smp 4,cores=4 "
"-numa node,nodeid=0 -numa node,nodeid=1 "
"-numa cpu,node-id=0,core-id=0 "
"-numa cpu,node-id=0,core-id=1 "
"-numa cpu,node-id=0,core-id=2 "
"-numa cpu,node-id=1,core-id=3");
qtest_start(cli);
cpus = get_cpus(&resp);
g_assert(cpus);
while ((e = qlist_pop(cpus))) {
QDict *cpu, *props;
int64_t core, node;
cpu = qobject_to_qdict(e);
g_assert(qdict_haskey(cpu, "props"));
props = qdict_get_qdict(cpu, "props");
g_assert(qdict_haskey(props, "node-id"));
node = qdict_get_int(props, "node-id");
g_assert(qdict_haskey(props, "core-id"));
core = qdict_get_int(props, "core-id");
if (core >= 0 && core < 3) {
g_assert_cmpint(node, ==, 0);
} else if (core == 3) {
g_assert_cmpint(node, ==, 1);
} else {
g_assert(false);
}
}
QDECREF(resp);
qtest_end();
g_free(cli);
}
| {
"code": [
" const QObject *e;",
" const QObject *e;",
" const QObject *e;",
" const QObject *e;"
],
"line_no": [
11,
11,
11,
11
]
} | static void FUNC_0(const void *VAR_0)
{
char *VAR_1;
QDict *resp;
QList *cpus;
const QObject *VAR_2;
VAR_1 = make_cli(VAR_0, "-smp 4,cores=4 "
"-numa node,nodeid=0 -numa node,nodeid=1 "
"-numa cpu,node-id=0,core-id=0 "
"-numa cpu,node-id=0,core-id=1 "
"-numa cpu,node-id=0,core-id=2 "
"-numa cpu,node-id=1,core-id=3");
qtest_start(VAR_1);
cpus = get_cpus(&resp);
g_assert(cpus);
while ((VAR_2 = qlist_pop(cpus))) {
QDict *cpu, *props;
int64_t core, node;
cpu = qobject_to_qdict(VAR_2);
g_assert(qdict_haskey(cpu, "props"));
props = qdict_get_qdict(cpu, "props");
g_assert(qdict_haskey(props, "node-id"));
node = qdict_get_int(props, "node-id");
g_assert(qdict_haskey(props, "core-id"));
core = qdict_get_int(props, "core-id");
if (core >= 0 && core < 3) {
g_assert_cmpint(node, ==, 0);
} else if (core == 3) {
g_assert_cmpint(node, ==, 1);
} else {
g_assert(false);
}
}
QDECREF(resp);
qtest_end();
g_free(VAR_1);
}
| [
"static void FUNC_0(const void *VAR_0)\n{",
"char *VAR_1;",
"QDict *resp;",
"QList *cpus;",
"const QObject *VAR_2;",
"VAR_1 = make_cli(VAR_0, \"-smp 4,cores=4 \"\n\"-numa node,nodeid=0 -numa node,nodeid=1 \"\n\"-numa cpu,node-id=0,core-id=0 \"\n\"-numa cpu,node-id=0,core-id=1 \"\n\"-numa cpu,node-id=0,core-id=2 \"\n\"-numa cpu,node-id=1,core-id=3\");",
"qtest_start(VAR_1);",
"cpus = get_cpus(&resp);",
"g_assert(cpus);",
"while ((VAR_2 = qlist_pop(cpus))) {",
"QDict *cpu, *props;",
"int64_t core, node;",
"cpu = qobject_to_qdict(VAR_2);",
"g_assert(qdict_haskey(cpu, \"props\"));",
"props = qdict_get_qdict(cpu, \"props\");",
"g_assert(qdict_haskey(props, \"node-id\"));",
"node = qdict_get_int(props, \"node-id\");",
"g_assert(qdict_haskey(props, \"core-id\"));",
"core = qdict_get_int(props, \"core-id\");",
"if (core >= 0 && core < 3) {",
"g_assert_cmpint(node, ==, 0);",
"} else if (core == 3) {",
"g_assert_cmpint(node, ==, 1);",
"} else {",
"g_assert(false);",
"}",
"}",
"QDECREF(resp);",
"qtest_end();",
"g_free(VAR_1);",
"}"
] | [
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15,
17,
19,
21,
23,
25
],
[
27
],
[
29
],
[
31
],
[
35
],
[
37
],
[
39
],
[
43
],
[
45
],
[
47
],
[
51
],
[
53
],
[
55
],
[
57
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
79
],
[
81
],
[
83
],
[
85
]
] |
19,642 | ssize_t vnc_client_read_buf(VncState *vs, uint8_t *data, size_t datalen)
{
ssize_t ret;
#ifdef CONFIG_VNC_TLS
if (vs->tls.session) {
ret = vnc_client_read_tls(&vs->tls.session, data, datalen);
} else {
#endif /* CONFIG_VNC_TLS */
ret = qemu_recv(vs->csock, data, datalen, 0);
#ifdef CONFIG_VNC_TLS
}
#endif /* CONFIG_VNC_TLS */
VNC_DEBUG("Read wire %p %zd -> %ld\n", data, datalen, ret);
return vnc_client_io_error(vs, ret, socket_error());
}
| true | qemu | 3e305e4a4752f70c0b5c3cf5b43ec957881714f7 | ssize_t vnc_client_read_buf(VncState *vs, uint8_t *data, size_t datalen)
{
ssize_t ret;
#ifdef CONFIG_VNC_TLS
if (vs->tls.session) {
ret = vnc_client_read_tls(&vs->tls.session, data, datalen);
} else {
#endif
ret = qemu_recv(vs->csock, data, datalen, 0);
#ifdef CONFIG_VNC_TLS
}
#endif
VNC_DEBUG("Read wire %p %zd -> %ld\n", data, datalen, ret);
return vnc_client_io_error(vs, ret, socket_error());
}
| {
"code": [
"#ifdef CONFIG_VNC_TLS",
"#ifdef CONFIG_VNC_TLS",
" } else {",
" if (vs->tls.session) {",
"#ifdef CONFIG_VNC_TLS",
"#ifdef CONFIG_VNC_TLS",
"#ifdef CONFIG_VNC_TLS",
"#ifdef CONFIG_VNC_TLS",
"#ifdef CONFIG_VNC_TLS",
"#ifdef CONFIG_VNC_TLS",
"#ifdef CONFIG_VNC_TLS",
"#ifdef CONFIG_VNC_TLS",
"#ifdef CONFIG_VNC_TLS",
" if (vs->tls.session) {",
"#ifdef CONFIG_VNC_TLS",
" return vnc_client_io_error(vs, ret, socket_error());",
"#ifdef CONFIG_VNC_TLS",
"#ifdef CONFIG_VNC_TLS",
" if (vs->tls.session) {",
" ret = vnc_client_read_tls(&vs->tls.session, data, datalen);",
"#ifdef CONFIG_VNC_TLS",
" return vnc_client_io_error(vs, ret, socket_error());",
"#ifdef CONFIG_VNC_TLS",
"#ifdef CONFIG_VNC_TLS",
"#ifdef CONFIG_VNC_TLS",
"#ifdef CONFIG_VNC_TLS",
"#ifdef CONFIG_VNC_TLS",
"#ifdef CONFIG_VNC_TLS",
"#ifdef CONFIG_VNC_TLS",
"#ifdef CONFIG_VNC_TLS",
"#ifdef CONFIG_VNC_TLS"
],
"line_no": [
7,
7,
13,
9,
7,
7,
7,
7,
7,
7,
7,
7,
7,
9,
7,
27,
7,
7,
9,
11,
7,
27,
7,
7,
7,
7,
7,
7,
7,
7,
7
]
} | ssize_t FUNC_0(VncState *vs, uint8_t *data, size_t datalen)
{
ssize_t ret;
#ifdef CONFIG_VNC_TLS
if (vs->tls.session) {
ret = vnc_client_read_tls(&vs->tls.session, data, datalen);
} else {
#endif
ret = qemu_recv(vs->csock, data, datalen, 0);
#ifdef CONFIG_VNC_TLS
}
#endif
VNC_DEBUG("Read wire %p %zd -> %ld\n", data, datalen, ret);
return vnc_client_io_error(vs, ret, socket_error());
}
| [
"ssize_t FUNC_0(VncState *vs, uint8_t *data, size_t datalen)\n{",
"ssize_t ret;",
"#ifdef CONFIG_VNC_TLS\nif (vs->tls.session) {",
"ret = vnc_client_read_tls(&vs->tls.session, data, datalen);",
"} else {",
"#endif\nret = qemu_recv(vs->csock, data, datalen, 0);",
"#ifdef CONFIG_VNC_TLS\n}",
"#endif\nVNC_DEBUG(\"Read wire %p %zd -> %ld\\n\", data, datalen, ret);",
"return vnc_client_io_error(vs, ret, socket_error());",
"}"
] | [
0,
0,
1,
1,
0,
0,
0,
0,
1,
0
] | [
[
1,
3
],
[
5
],
[
7,
9
],
[
11
],
[
13
],
[
15,
17
],
[
19,
21
],
[
23,
25
],
[
27
],
[
29
]
] |
19,644 | void qemu_put_be64(QEMUFile *f, uint64_t v)
{
qemu_put_be32(f, v >> 32);
qemu_put_be32(f, v);
}
| true | qemu | 60fe637bf0e4d7989e21e50f52526444765c63b4 | void qemu_put_be64(QEMUFile *f, uint64_t v)
{
qemu_put_be32(f, v >> 32);
qemu_put_be32(f, v);
}
| {
"code": [],
"line_no": []
} | void FUNC_0(QEMUFile *VAR_0, uint64_t VAR_1)
{
qemu_put_be32(VAR_0, VAR_1 >> 32);
qemu_put_be32(VAR_0, VAR_1);
}
| [
"void FUNC_0(QEMUFile *VAR_0, uint64_t VAR_1)\n{",
"qemu_put_be32(VAR_0, VAR_1 >> 32);",
"qemu_put_be32(VAR_0, VAR_1);",
"}"
] | [
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
]
] |
19,645 | void lance_init(NICInfo *nd, int irq, uint32_t leaddr, uint32_t ledaddr)
{
LANCEState *s;
int lance_io_memory, ledma_io_memory;
s = qemu_mallocz(sizeof(LANCEState));
if (!s)
return;
s->irq = irq;
lance_io_memory = cpu_register_io_memory(0, lance_mem_read, lance_mem_write, s);
cpu_register_physical_memory(leaddr, 4, lance_io_memory);
ledma_io_memory = cpu_register_io_memory(0, ledma_mem_read, ledma_mem_write, s);
cpu_register_physical_memory(ledaddr, 16, ledma_io_memory);
memcpy(s->macaddr, nd->macaddr, 6);
lance_reset(s);
s->vc = qemu_new_vlan_client(nd->vlan, lance_receive, s);
snprintf(s->vc->info_str, sizeof(s->vc->info_str),
"lance macaddr=%02x:%02x:%02x:%02x:%02x:%02x",
s->macaddr[0],
s->macaddr[1],
s->macaddr[2],
s->macaddr[3],
s->macaddr[4],
s->macaddr[5]);
register_savevm("lance", leaddr, 1, lance_save, lance_load, s);
qemu_register_reset(lance_reset, s);
}
| true | qemu | d861b05ea30e6ac177de9b679da96194ebe21afc | void lance_init(NICInfo *nd, int irq, uint32_t leaddr, uint32_t ledaddr)
{
LANCEState *s;
int lance_io_memory, ledma_io_memory;
s = qemu_mallocz(sizeof(LANCEState));
if (!s)
return;
s->irq = irq;
lance_io_memory = cpu_register_io_memory(0, lance_mem_read, lance_mem_write, s);
cpu_register_physical_memory(leaddr, 4, lance_io_memory);
ledma_io_memory = cpu_register_io_memory(0, ledma_mem_read, ledma_mem_write, s);
cpu_register_physical_memory(ledaddr, 16, ledma_io_memory);
memcpy(s->macaddr, nd->macaddr, 6);
lance_reset(s);
s->vc = qemu_new_vlan_client(nd->vlan, lance_receive, s);
snprintf(s->vc->info_str, sizeof(s->vc->info_str),
"lance macaddr=%02x:%02x:%02x:%02x:%02x:%02x",
s->macaddr[0],
s->macaddr[1],
s->macaddr[2],
s->macaddr[3],
s->macaddr[4],
s->macaddr[5]);
register_savevm("lance", leaddr, 1, lance_save, lance_load, s);
qemu_register_reset(lance_reset, s);
}
| {
"code": [
" s->vc = qemu_new_vlan_client(nd->vlan, lance_receive, s);"
],
"line_no": [
43
]
} | void FUNC_0(NICInfo *VAR_0, int VAR_1, uint32_t VAR_2, uint32_t VAR_3)
{
LANCEState *s;
int VAR_4, VAR_5;
s = qemu_mallocz(sizeof(LANCEState));
if (!s)
return;
s->VAR_1 = VAR_1;
VAR_4 = cpu_register_io_memory(0, lance_mem_read, lance_mem_write, s);
cpu_register_physical_memory(VAR_2, 4, VAR_4);
VAR_5 = cpu_register_io_memory(0, ledma_mem_read, ledma_mem_write, s);
cpu_register_physical_memory(VAR_3, 16, VAR_5);
memcpy(s->macaddr, VAR_0->macaddr, 6);
lance_reset(s);
s->vc = qemu_new_vlan_client(VAR_0->vlan, lance_receive, s);
snprintf(s->vc->info_str, sizeof(s->vc->info_str),
"lance macaddr=%02x:%02x:%02x:%02x:%02x:%02x",
s->macaddr[0],
s->macaddr[1],
s->macaddr[2],
s->macaddr[3],
s->macaddr[4],
s->macaddr[5]);
register_savevm("lance", VAR_2, 1, lance_save, lance_load, s);
qemu_register_reset(lance_reset, s);
}
| [
"void FUNC_0(NICInfo *VAR_0, int VAR_1, uint32_t VAR_2, uint32_t VAR_3)\n{",
"LANCEState *s;",
"int VAR_4, VAR_5;",
"s = qemu_mallocz(sizeof(LANCEState));",
"if (!s)\nreturn;",
"s->VAR_1 = VAR_1;",
"VAR_4 = cpu_register_io_memory(0, lance_mem_read, lance_mem_write, s);",
"cpu_register_physical_memory(VAR_2, 4, VAR_4);",
"VAR_5 = cpu_register_io_memory(0, ledma_mem_read, ledma_mem_write, s);",
"cpu_register_physical_memory(VAR_3, 16, VAR_5);",
"memcpy(s->macaddr, VAR_0->macaddr, 6);",
"lance_reset(s);",
"s->vc = qemu_new_vlan_client(VAR_0->vlan, lance_receive, s);",
"snprintf(s->vc->info_str, sizeof(s->vc->info_str),\n\"lance macaddr=%02x:%02x:%02x:%02x:%02x:%02x\",\ns->macaddr[0],\ns->macaddr[1],\ns->macaddr[2],\ns->macaddr[3],\ns->macaddr[4],\ns->macaddr[5]);",
"register_savevm(\"lance\", VAR_2, 1, lance_save, lance_load, s);",
"qemu_register_reset(lance_reset, s);",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13,
15
],
[
19
],
[
23
],
[
25
],
[
29
],
[
31
],
[
35
],
[
39
],
[
43
],
[
47,
49,
51,
53,
55,
57,
59,
61
],
[
65
],
[
67
],
[
69
]
] |
19,646 | static int wv_get_value(WavpackFrameContext *ctx, GetBitContext *gb, int channel, int *last)
{
int t, t2;
int sign, base, add, ret;
WvChannel *c = &ctx->ch[channel];
*last = 0;
if((ctx->ch[0].median[0] < 2U) && (ctx->ch[1].median[0] < 2U) && !ctx->zero && !ctx->one){
if(ctx->zeroes){
ctx->zeroes--;
if(ctx->zeroes){
c->slow_level -= LEVEL_DECAY(c->slow_level);
return 0;
}
}else{
t = get_unary_0_33(gb);
if(t >= 2) t = get_bits(gb, t - 1) | (1 << (t-1));
ctx->zeroes = t;
if(ctx->zeroes){
memset(ctx->ch[0].median, 0, sizeof(ctx->ch[0].median));
memset(ctx->ch[1].median, 0, sizeof(ctx->ch[1].median));
c->slow_level -= LEVEL_DECAY(c->slow_level);
return 0;
}
}
}
if(get_bits_count(gb) >= ctx->data_size){
*last = 1;
return 0;
}
if(ctx->zero){
t = 0;
ctx->zero = 0;
}else{
t = get_unary_0_33(gb);
if(get_bits_count(gb) >= ctx->data_size){
*last = 1;
return 0;
}
if(t == 16) {
t2 = get_unary_0_33(gb);
if(t2 < 2) t += t2;
else t += get_bits(gb, t2 - 1) | (1 << (t2 - 1));
}
if(ctx->one){
ctx->one = t&1;
t = (t>>1) + 1;
}else{
ctx->one = t&1;
t >>= 1;
}
ctx->zero = !ctx->one;
}
if(ctx->hybrid && !channel)
update_error_limit(ctx);
if(!t){
base = 0;
add = GET_MED(0) - 1;
DEC_MED(0);
}else if(t == 1){
base = GET_MED(0);
add = GET_MED(1) - 1;
INC_MED(0);
DEC_MED(1);
}else if(t == 2){
base = GET_MED(0) + GET_MED(1);
add = GET_MED(2) - 1;
INC_MED(0);
INC_MED(1);
DEC_MED(2);
}else{
base = GET_MED(0) + GET_MED(1) + GET_MED(2) * (t - 2);
add = GET_MED(2) - 1;
INC_MED(0);
INC_MED(1);
INC_MED(2);
}
if(!c->error_limit){
ret = base + get_tail(gb, add);
}else{
int mid = (base*2 + add + 1) >> 1;
while(add > c->error_limit){
if(get_bits1(gb)){
add -= (mid - base);
base = mid;
}else
add = mid - base - 1;
mid = (base*2 + add + 1) >> 1;
}
ret = mid;
}
sign = get_bits1(gb);
if(ctx->hybrid_bitrate)
c->slow_level += wp_log2(ret) - LEVEL_DECAY(c->slow_level);
return sign ? ~ret : ret;
}
| true | FFmpeg | 55354b7de21e7bb4bbeb1c12ff55ea17f807c70c | static int wv_get_value(WavpackFrameContext *ctx, GetBitContext *gb, int channel, int *last)
{
int t, t2;
int sign, base, add, ret;
WvChannel *c = &ctx->ch[channel];
*last = 0;
if((ctx->ch[0].median[0] < 2U) && (ctx->ch[1].median[0] < 2U) && !ctx->zero && !ctx->one){
if(ctx->zeroes){
ctx->zeroes--;
if(ctx->zeroes){
c->slow_level -= LEVEL_DECAY(c->slow_level);
return 0;
}
}else{
t = get_unary_0_33(gb);
if(t >= 2) t = get_bits(gb, t - 1) | (1 << (t-1));
ctx->zeroes = t;
if(ctx->zeroes){
memset(ctx->ch[0].median, 0, sizeof(ctx->ch[0].median));
memset(ctx->ch[1].median, 0, sizeof(ctx->ch[1].median));
c->slow_level -= LEVEL_DECAY(c->slow_level);
return 0;
}
}
}
if(get_bits_count(gb) >= ctx->data_size){
*last = 1;
return 0;
}
if(ctx->zero){
t = 0;
ctx->zero = 0;
}else{
t = get_unary_0_33(gb);
if(get_bits_count(gb) >= ctx->data_size){
*last = 1;
return 0;
}
if(t == 16) {
t2 = get_unary_0_33(gb);
if(t2 < 2) t += t2;
else t += get_bits(gb, t2 - 1) | (1 << (t2 - 1));
}
if(ctx->one){
ctx->one = t&1;
t = (t>>1) + 1;
}else{
ctx->one = t&1;
t >>= 1;
}
ctx->zero = !ctx->one;
}
if(ctx->hybrid && !channel)
update_error_limit(ctx);
if(!t){
base = 0;
add = GET_MED(0) - 1;
DEC_MED(0);
}else if(t == 1){
base = GET_MED(0);
add = GET_MED(1) - 1;
INC_MED(0);
DEC_MED(1);
}else if(t == 2){
base = GET_MED(0) + GET_MED(1);
add = GET_MED(2) - 1;
INC_MED(0);
INC_MED(1);
DEC_MED(2);
}else{
base = GET_MED(0) + GET_MED(1) + GET_MED(2) * (t - 2);
add = GET_MED(2) - 1;
INC_MED(0);
INC_MED(1);
INC_MED(2);
}
if(!c->error_limit){
ret = base + get_tail(gb, add);
}else{
int mid = (base*2 + add + 1) >> 1;
while(add > c->error_limit){
if(get_bits1(gb)){
add -= (mid - base);
base = mid;
}else
add = mid - base - 1;
mid = (base*2 + add + 1) >> 1;
}
ret = mid;
}
sign = get_bits1(gb);
if(ctx->hybrid_bitrate)
c->slow_level += wp_log2(ret) - LEVEL_DECAY(c->slow_level);
return sign ? ~ret : ret;
}
| {
"code": [
" if(t >= 2) t = get_bits(gb, t - 1) | (1 << (t-1));",
" if(get_bits_count(gb) >= ctx->data_size){",
" *last = 1;",
" return 0;",
" if(get_bits_count(gb) >= ctx->data_size){",
" *last = 1;",
" return 0;",
" if(t2 < 2) t += t2;",
" else t += get_bits(gb, t2 - 1) | (1 << (t2 - 1));"
],
"line_no": [
35,
57,
59,
61,
77,
79,
81,
89,
91
]
} | static int FUNC_0(WavpackFrameContext *VAR_0, GetBitContext *VAR_1, int VAR_2, int *VAR_3)
{
int VAR_4, VAR_5;
int VAR_6, VAR_7, VAR_8, VAR_9;
WvChannel *c = &VAR_0->ch[VAR_2];
*VAR_3 = 0;
if((VAR_0->ch[0].median[0] < 2U) && (VAR_0->ch[1].median[0] < 2U) && !VAR_0->zero && !VAR_0->one){
if(VAR_0->zeroes){
VAR_0->zeroes--;
if(VAR_0->zeroes){
c->slow_level -= LEVEL_DECAY(c->slow_level);
return 0;
}
}else{
VAR_4 = get_unary_0_33(VAR_1);
if(VAR_4 >= 2) VAR_4 = get_bits(VAR_1, VAR_4 - 1) | (1 << (VAR_4-1));
VAR_0->zeroes = VAR_4;
if(VAR_0->zeroes){
memset(VAR_0->ch[0].median, 0, sizeof(VAR_0->ch[0].median));
memset(VAR_0->ch[1].median, 0, sizeof(VAR_0->ch[1].median));
c->slow_level -= LEVEL_DECAY(c->slow_level);
return 0;
}
}
}
if(get_bits_count(VAR_1) >= VAR_0->data_size){
*VAR_3 = 1;
return 0;
}
if(VAR_0->zero){
VAR_4 = 0;
VAR_0->zero = 0;
}else{
VAR_4 = get_unary_0_33(VAR_1);
if(get_bits_count(VAR_1) >= VAR_0->data_size){
*VAR_3 = 1;
return 0;
}
if(VAR_4 == 16) {
VAR_5 = get_unary_0_33(VAR_1);
if(VAR_5 < 2) VAR_4 += VAR_5;
else VAR_4 += get_bits(VAR_1, VAR_5 - 1) | (1 << (VAR_5 - 1));
}
if(VAR_0->one){
VAR_0->one = VAR_4&1;
VAR_4 = (VAR_4>>1) + 1;
}else{
VAR_0->one = VAR_4&1;
VAR_4 >>= 1;
}
VAR_0->zero = !VAR_0->one;
}
if(VAR_0->hybrid && !VAR_2)
update_error_limit(VAR_0);
if(!VAR_4){
VAR_7 = 0;
VAR_8 = GET_MED(0) - 1;
DEC_MED(0);
}else if(VAR_4 == 1){
VAR_7 = GET_MED(0);
VAR_8 = GET_MED(1) - 1;
INC_MED(0);
DEC_MED(1);
}else if(VAR_4 == 2){
VAR_7 = GET_MED(0) + GET_MED(1);
VAR_8 = GET_MED(2) - 1;
INC_MED(0);
INC_MED(1);
DEC_MED(2);
}else{
VAR_7 = GET_MED(0) + GET_MED(1) + GET_MED(2) * (VAR_4 - 2);
VAR_8 = GET_MED(2) - 1;
INC_MED(0);
INC_MED(1);
INC_MED(2);
}
if(!c->error_limit){
VAR_9 = VAR_7 + get_tail(VAR_1, VAR_8);
}else{
int VAR_10 = (VAR_7*2 + VAR_8 + 1) >> 1;
while(VAR_8 > c->error_limit){
if(get_bits1(VAR_1)){
VAR_8 -= (VAR_10 - VAR_7);
VAR_7 = VAR_10;
}else
VAR_8 = VAR_10 - VAR_7 - 1;
VAR_10 = (VAR_7*2 + VAR_8 + 1) >> 1;
}
VAR_9 = VAR_10;
}
VAR_6 = get_bits1(VAR_1);
if(VAR_0->hybrid_bitrate)
c->slow_level += wp_log2(VAR_9) - LEVEL_DECAY(c->slow_level);
return VAR_6 ? ~VAR_9 : VAR_9;
}
| [
"static int FUNC_0(WavpackFrameContext *VAR_0, GetBitContext *VAR_1, int VAR_2, int *VAR_3)\n{",
"int VAR_4, VAR_5;",
"int VAR_6, VAR_7, VAR_8, VAR_9;",
"WvChannel *c = &VAR_0->ch[VAR_2];",
"*VAR_3 = 0;",
"if((VAR_0->ch[0].median[0] < 2U) && (VAR_0->ch[1].median[0] < 2U) && !VAR_0->zero && !VAR_0->one){",
"if(VAR_0->zeroes){",
"VAR_0->zeroes--;",
"if(VAR_0->zeroes){",
"c->slow_level -= LEVEL_DECAY(c->slow_level);",
"return 0;",
"}",
"}else{",
"VAR_4 = get_unary_0_33(VAR_1);",
"if(VAR_4 >= 2) VAR_4 = get_bits(VAR_1, VAR_4 - 1) | (1 << (VAR_4-1));",
"VAR_0->zeroes = VAR_4;",
"if(VAR_0->zeroes){",
"memset(VAR_0->ch[0].median, 0, sizeof(VAR_0->ch[0].median));",
"memset(VAR_0->ch[1].median, 0, sizeof(VAR_0->ch[1].median));",
"c->slow_level -= LEVEL_DECAY(c->slow_level);",
"return 0;",
"}",
"}",
"}",
"if(get_bits_count(VAR_1) >= VAR_0->data_size){",
"*VAR_3 = 1;",
"return 0;",
"}",
"if(VAR_0->zero){",
"VAR_4 = 0;",
"VAR_0->zero = 0;",
"}else{",
"VAR_4 = get_unary_0_33(VAR_1);",
"if(get_bits_count(VAR_1) >= VAR_0->data_size){",
"*VAR_3 = 1;",
"return 0;",
"}",
"if(VAR_4 == 16) {",
"VAR_5 = get_unary_0_33(VAR_1);",
"if(VAR_5 < 2) VAR_4 += VAR_5;",
"else VAR_4 += get_bits(VAR_1, VAR_5 - 1) | (1 << (VAR_5 - 1));",
"}",
"if(VAR_0->one){",
"VAR_0->one = VAR_4&1;",
"VAR_4 = (VAR_4>>1) + 1;",
"}else{",
"VAR_0->one = VAR_4&1;",
"VAR_4 >>= 1;",
"}",
"VAR_0->zero = !VAR_0->one;",
"}",
"if(VAR_0->hybrid && !VAR_2)\nupdate_error_limit(VAR_0);",
"if(!VAR_4){",
"VAR_7 = 0;",
"VAR_8 = GET_MED(0) - 1;",
"DEC_MED(0);",
"}else if(VAR_4 == 1){",
"VAR_7 = GET_MED(0);",
"VAR_8 = GET_MED(1) - 1;",
"INC_MED(0);",
"DEC_MED(1);",
"}else if(VAR_4 == 2){",
"VAR_7 = GET_MED(0) + GET_MED(1);",
"VAR_8 = GET_MED(2) - 1;",
"INC_MED(0);",
"INC_MED(1);",
"DEC_MED(2);",
"}else{",
"VAR_7 = GET_MED(0) + GET_MED(1) + GET_MED(2) * (VAR_4 - 2);",
"VAR_8 = GET_MED(2) - 1;",
"INC_MED(0);",
"INC_MED(1);",
"INC_MED(2);",
"}",
"if(!c->error_limit){",
"VAR_9 = VAR_7 + get_tail(VAR_1, VAR_8);",
"}else{",
"int VAR_10 = (VAR_7*2 + VAR_8 + 1) >> 1;",
"while(VAR_8 > c->error_limit){",
"if(get_bits1(VAR_1)){",
"VAR_8 -= (VAR_10 - VAR_7);",
"VAR_7 = VAR_10;",
"}else",
"VAR_8 = VAR_10 - VAR_7 - 1;",
"VAR_10 = (VAR_7*2 + VAR_8 + 1) >> 1;",
"}",
"VAR_9 = VAR_10;",
"}",
"VAR_6 = get_bits1(VAR_1);",
"if(VAR_0->hybrid_bitrate)\nc->slow_level += wp_log2(VAR_9) - LEVEL_DECAY(c->slow_level);",
"return VAR_6 ? ~VAR_9 : VAR_9;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
1,
0,
0,
0,
0,
0,
0,
1,
1,
1,
0,
0,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
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
],
[
185
],
[
187
],
[
189
],
[
191
],
[
193
],
[
195
],
[
197,
199
],
[
201
],
[
203
]
] |
19,647 | static int block_save_setup(QEMUFile *f, void *opaque)
{
int ret;
DPRINTF("Enter save live setup submitted %d transferred %d\n",
block_mig_state.submitted, block_mig_state.transferred);
qemu_mutex_lock_iothread();
init_blk_migration(f);
/* start track dirty blocks */
set_dirty_tracking();
qemu_mutex_unlock_iothread();
ret = flush_blks(f);
blk_mig_reset_dirty_cursor();
qemu_put_be64(f, BLK_MIG_FLAG_EOS);
return ret;
}
| true | qemu | b8afb520e479e693c227aa39c2fb7670743e104f | static int block_save_setup(QEMUFile *f, void *opaque)
{
int ret;
DPRINTF("Enter save live setup submitted %d transferred %d\n",
block_mig_state.submitted, block_mig_state.transferred);
qemu_mutex_lock_iothread();
init_blk_migration(f);
set_dirty_tracking();
qemu_mutex_unlock_iothread();
ret = flush_blks(f);
blk_mig_reset_dirty_cursor();
qemu_put_be64(f, BLK_MIG_FLAG_EOS);
return ret;
}
| {
"code": [
" init_blk_migration(f);",
" set_dirty_tracking();"
],
"line_no": [
17,
23
]
} | static int FUNC_0(QEMUFile *VAR_0, void *VAR_1)
{
int VAR_2;
DPRINTF("Enter save live setup submitted %d transferred %d\n",
block_mig_state.submitted, block_mig_state.transferred);
qemu_mutex_lock_iothread();
init_blk_migration(VAR_0);
set_dirty_tracking();
qemu_mutex_unlock_iothread();
VAR_2 = flush_blks(VAR_0);
blk_mig_reset_dirty_cursor();
qemu_put_be64(VAR_0, BLK_MIG_FLAG_EOS);
return VAR_2;
}
| [
"static int FUNC_0(QEMUFile *VAR_0, void *VAR_1)\n{",
"int VAR_2;",
"DPRINTF(\"Enter save live setup submitted %d transferred %d\\n\",\nblock_mig_state.submitted, block_mig_state.transferred);",
"qemu_mutex_lock_iothread();",
"init_blk_migration(VAR_0);",
"set_dirty_tracking();",
"qemu_mutex_unlock_iothread();",
"VAR_2 = flush_blks(VAR_0);",
"blk_mig_reset_dirty_cursor();",
"qemu_put_be64(VAR_0, BLK_MIG_FLAG_EOS);",
"return VAR_2;",
"}"
] | [
0,
0,
0,
0,
1,
1,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
9,
11
],
[
15
],
[
17
],
[
23
],
[
25
],
[
29
],
[
31
],
[
33
],
[
37
],
[
39
]
] |
19,649 | static void test_dynamic_globalprop(void)
{
MyType *mt;
static GlobalProperty props[] = {
{ TYPE_DYNAMIC_PROPS, "prop1", "101" },
{ TYPE_DYNAMIC_PROPS, "prop2", "102" },
{ TYPE_DYNAMIC_PROPS"-bad", "prop3", "103", true },
{}
};
int all_used;
qdev_prop_register_global_list(props);
mt = DYNAMIC_TYPE(object_new(TYPE_DYNAMIC_PROPS));
qdev_init_nofail(DEVICE(mt));
g_assert_cmpuint(mt->prop1, ==, 101);
g_assert_cmpuint(mt->prop2, ==, 102);
} | true | qemu | 711e2f1e9ecad845e142fdddbbf1e8037bce902b | static void test_dynamic_globalprop(void)
{
MyType *mt;
static GlobalProperty props[] = {
{ TYPE_DYNAMIC_PROPS, "prop1", "101" },
{ TYPE_DYNAMIC_PROPS, "prop2", "102" },
{ TYPE_DYNAMIC_PROPS"-bad", "prop3", "103", true },
{}
};
int all_used;
qdev_prop_register_global_list(props);
mt = DYNAMIC_TYPE(object_new(TYPE_DYNAMIC_PROPS));
qdev_init_nofail(DEVICE(mt));
g_assert_cmpuint(mt->prop1, ==, 101);
g_assert_cmpuint(mt->prop2, ==, 102);
} | {
"code": [],
"line_no": []
} | static void FUNC_0(void)
{
MyType *mt;
static GlobalProperty VAR_0[] = {
{ TYPE_DYNAMIC_PROPS, "prop1", "101" },
{ TYPE_DYNAMIC_PROPS, "prop2", "102" },
{ TYPE_DYNAMIC_PROPS"-bad", "prop3", "103", true },
{}
};
int VAR_1;
qdev_prop_register_global_list(VAR_0);
mt = DYNAMIC_TYPE(object_new(TYPE_DYNAMIC_PROPS));
qdev_init_nofail(DEVICE(mt));
g_assert_cmpuint(mt->prop1, ==, 101);
g_assert_cmpuint(mt->prop2, ==, 102);
} | [
"static void FUNC_0(void)\n{",
"MyType *mt;",
"static GlobalProperty VAR_0[] = {",
"{ TYPE_DYNAMIC_PROPS, \"prop1\", \"101\" },",
"{ TYPE_DYNAMIC_PROPS, \"prop2\", \"102\" },",
"{ TYPE_DYNAMIC_PROPS\"-bad\", \"prop3\", \"103\", true },",
"{}",
"};",
"int VAR_1;",
"qdev_prop_register_global_list(VAR_0);",
"mt = DYNAMIC_TYPE(object_new(TYPE_DYNAMIC_PROPS));",
"qdev_init_nofail(DEVICE(mt));",
"g_assert_cmpuint(mt->prop1, ==, 101);",
"g_assert_cmpuint(mt->prop2, ==, 102);",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
27
],
[
29
],
[
33
],
[
35
],
[
39
]
] |
19,651 | void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
{
if (min_size < *size)
return ptr;
min_size = FFMAX(min_size + min_size / 16 + 32, min_size);
ptr = av_realloc(ptr, min_size);
/* we could set this to the unmodified min_size but this is safer
* if the user lost the ptr and uses NULL now
*/
if (!ptr)
min_size = 0;
*size = min_size;
return ptr;
}
| false | FFmpeg | 21b5990da461e4f83cf53994715ed42e22cce9e0 | void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
{
if (min_size < *size)
return ptr;
min_size = FFMAX(min_size + min_size / 16 + 32, min_size);
ptr = av_realloc(ptr, min_size);
if (!ptr)
min_size = 0;
*size = min_size;
return ptr;
}
| {
"code": [],
"line_no": []
} | void *FUNC_0(void *VAR_0, unsigned int *VAR_1, size_t VAR_2)
{
if (VAR_2 < *VAR_1)
return VAR_0;
VAR_2 = FFMAX(VAR_2 + VAR_2 / 16 + 32, VAR_2);
VAR_0 = av_realloc(VAR_0, VAR_2);
if (!VAR_0)
VAR_2 = 0;
*VAR_1 = VAR_2;
return VAR_0;
}
| [
"void *FUNC_0(void *VAR_0, unsigned int *VAR_1, size_t VAR_2)\n{",
"if (VAR_2 < *VAR_1)\nreturn VAR_0;",
"VAR_2 = FFMAX(VAR_2 + VAR_2 / 16 + 32, VAR_2);",
"VAR_0 = av_realloc(VAR_0, VAR_2);",
"if (!VAR_0)\nVAR_2 = 0;",
"*VAR_1 = VAR_2;",
"return VAR_0;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5,
7
],
[
11
],
[
15
],
[
23,
25
],
[
29
],
[
33
],
[
35
]
] |
19,652 | static inline int decode_residual_inter(AVSContext *h)
{
int block;
/* get coded block pattern */
int cbp = get_ue_golomb(&h->gb);
if (cbp > 63) {
av_log(h->avctx, AV_LOG_ERROR, "illegal inter cbp\n");
return AVERROR_INVALIDDATA;
}
h->cbp = cbp_tab[cbp][1];
/* get quantizer */
if (h->cbp && !h->qp_fixed)
h->qp = (h->qp + get_se_golomb(&h->gb)) & 63;
for (block = 0; block < 4; block++)
if (h->cbp & (1 << block))
decode_residual_block(h, &h->gb, inter_dec, 0, h->qp,
h->cy + h->luma_scan[block], h->l_stride);
decode_residual_chroma(h);
return 0;
}
| false | FFmpeg | 39185ec4faa9ef33954dbf2394444e045b632673 | static inline int decode_residual_inter(AVSContext *h)
{
int block;
int cbp = get_ue_golomb(&h->gb);
if (cbp > 63) {
av_log(h->avctx, AV_LOG_ERROR, "illegal inter cbp\n");
return AVERROR_INVALIDDATA;
}
h->cbp = cbp_tab[cbp][1];
if (h->cbp && !h->qp_fixed)
h->qp = (h->qp + get_se_golomb(&h->gb)) & 63;
for (block = 0; block < 4; block++)
if (h->cbp & (1 << block))
decode_residual_block(h, &h->gb, inter_dec, 0, h->qp,
h->cy + h->luma_scan[block], h->l_stride);
decode_residual_chroma(h);
return 0;
}
| {
"code": [],
"line_no": []
} | static inline int FUNC_0(AVSContext *VAR_0)
{
int VAR_1;
int VAR_2 = get_ue_golomb(&VAR_0->gb);
if (VAR_2 > 63) {
av_log(VAR_0->avctx, AV_LOG_ERROR, "illegal inter VAR_2\n");
return AVERROR_INVALIDDATA;
}
VAR_0->VAR_2 = cbp_tab[VAR_2][1];
if (VAR_0->VAR_2 && !VAR_0->qp_fixed)
VAR_0->qp = (VAR_0->qp + get_se_golomb(&VAR_0->gb)) & 63;
for (VAR_1 = 0; VAR_1 < 4; VAR_1++)
if (VAR_0->VAR_2 & (1 << VAR_1))
decode_residual_block(VAR_0, &VAR_0->gb, inter_dec, 0, VAR_0->qp,
VAR_0->cy + VAR_0->luma_scan[VAR_1], VAR_0->l_stride);
decode_residual_chroma(VAR_0);
return 0;
}
| [
"static inline int FUNC_0(AVSContext *VAR_0)\n{",
"int VAR_1;",
"int VAR_2 = get_ue_golomb(&VAR_0->gb);",
"if (VAR_2 > 63) {",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"illegal inter VAR_2\\n\");",
"return AVERROR_INVALIDDATA;",
"}",
"VAR_0->VAR_2 = cbp_tab[VAR_2][1];",
"if (VAR_0->VAR_2 && !VAR_0->qp_fixed)\nVAR_0->qp = (VAR_0->qp + get_se_golomb(&VAR_0->gb)) & 63;",
"for (VAR_1 = 0; VAR_1 < 4; VAR_1++)",
"if (VAR_0->VAR_2 & (1 << VAR_1))\ndecode_residual_block(VAR_0, &VAR_0->gb, inter_dec, 0, VAR_0->qp,\nVAR_0->cy + VAR_0->luma_scan[VAR_1], VAR_0->l_stride);",
"decode_residual_chroma(VAR_0);",
"return 0;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
27,
29
],
[
31
],
[
33,
35,
37
],
[
39
],
[
43
],
[
45
]
] |
19,653 | static int decode_pulses(Pulse *pulse, GetBitContext *gb,
const uint16_t *swb_offset, int num_swb)
{
int i, pulse_swb;
pulse->num_pulse = get_bits(gb, 2) + 1;
pulse_swb = get_bits(gb, 6);
if (pulse_swb >= num_swb)
return -1;
pulse->pos[0] = swb_offset[pulse_swb];
pulse->pos[0] += get_bits(gb, 5);
if (pulse->pos[0] > 1023)
return -1;
pulse->amp[0] = get_bits(gb, 4);
for (i = 1; i < pulse->num_pulse; i++) {
pulse->pos[i] = get_bits(gb, 5) + pulse->pos[i - 1];
if (pulse->pos[i] > 1023)
return -1;
pulse->amp[i] = get_bits(gb, 4);
}
return 0;
}
| false | FFmpeg | 6e42ccb9dbc13836cd52cda594f819d17af9afa2 | static int decode_pulses(Pulse *pulse, GetBitContext *gb,
const uint16_t *swb_offset, int num_swb)
{
int i, pulse_swb;
pulse->num_pulse = get_bits(gb, 2) + 1;
pulse_swb = get_bits(gb, 6);
if (pulse_swb >= num_swb)
return -1;
pulse->pos[0] = swb_offset[pulse_swb];
pulse->pos[0] += get_bits(gb, 5);
if (pulse->pos[0] > 1023)
return -1;
pulse->amp[0] = get_bits(gb, 4);
for (i = 1; i < pulse->num_pulse; i++) {
pulse->pos[i] = get_bits(gb, 5) + pulse->pos[i - 1];
if (pulse->pos[i] > 1023)
return -1;
pulse->amp[i] = get_bits(gb, 4);
}
return 0;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(Pulse *VAR_0, GetBitContext *VAR_1,
const uint16_t *VAR_2, int VAR_3)
{
int VAR_4, VAR_5;
VAR_0->num_pulse = get_bits(VAR_1, 2) + 1;
VAR_5 = get_bits(VAR_1, 6);
if (VAR_5 >= VAR_3)
return -1;
VAR_0->pos[0] = VAR_2[VAR_5];
VAR_0->pos[0] += get_bits(VAR_1, 5);
if (VAR_0->pos[0] > 1023)
return -1;
VAR_0->amp[0] = get_bits(VAR_1, 4);
for (VAR_4 = 1; VAR_4 < VAR_0->num_pulse; VAR_4++) {
VAR_0->pos[VAR_4] = get_bits(VAR_1, 5) + VAR_0->pos[VAR_4 - 1];
if (VAR_0->pos[VAR_4] > 1023)
return -1;
VAR_0->amp[VAR_4] = get_bits(VAR_1, 4);
}
return 0;
}
| [
"static int FUNC_0(Pulse *VAR_0, GetBitContext *VAR_1,\nconst uint16_t *VAR_2, int VAR_3)\n{",
"int VAR_4, VAR_5;",
"VAR_0->num_pulse = get_bits(VAR_1, 2) + 1;",
"VAR_5 = get_bits(VAR_1, 6);",
"if (VAR_5 >= VAR_3)\nreturn -1;",
"VAR_0->pos[0] = VAR_2[VAR_5];",
"VAR_0->pos[0] += get_bits(VAR_1, 5);",
"if (VAR_0->pos[0] > 1023)\nreturn -1;",
"VAR_0->amp[0] = get_bits(VAR_1, 4);",
"for (VAR_4 = 1; VAR_4 < VAR_0->num_pulse; VAR_4++) {",
"VAR_0->pos[VAR_4] = get_bits(VAR_1, 5) + VAR_0->pos[VAR_4 - 1];",
"if (VAR_0->pos[VAR_4] > 1023)\nreturn -1;",
"VAR_0->amp[VAR_4] = get_bits(VAR_1, 4);",
"}",
"return 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
]
] |
19,655 | static int aiff_probe(AVProbeData *p)
{
/* check file header */
if (p->buf_size < 16)
return 0;
if (p->buf[0] == 'F' && p->buf[1] == 'O' &&
p->buf[2] == 'R' && p->buf[3] == 'M' &&
p->buf[8] == 'A' && p->buf[9] == 'I' &&
p->buf[10] == 'F' && (p->buf[11] == 'F' || p->buf[11] == 'C'))
return AVPROBE_SCORE_MAX;
else
return 0;
}
| false | FFmpeg | 87e8788680e16c51f6048af26f3f7830c35207a5 | static int aiff_probe(AVProbeData *p)
{
if (p->buf_size < 16)
return 0;
if (p->buf[0] == 'F' && p->buf[1] == 'O' &&
p->buf[2] == 'R' && p->buf[3] == 'M' &&
p->buf[8] == 'A' && p->buf[9] == 'I' &&
p->buf[10] == 'F' && (p->buf[11] == 'F' || p->buf[11] == 'C'))
return AVPROBE_SCORE_MAX;
else
return 0;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(AVProbeData *VAR_0)
{
if (VAR_0->buf_size < 16)
return 0;
if (VAR_0->buf[0] == 'F' && VAR_0->buf[1] == 'O' &&
VAR_0->buf[2] == 'R' && VAR_0->buf[3] == 'M' &&
VAR_0->buf[8] == 'A' && VAR_0->buf[9] == 'I' &&
VAR_0->buf[10] == 'F' && (VAR_0->buf[11] == 'F' || VAR_0->buf[11] == 'C'))
return AVPROBE_SCORE_MAX;
else
return 0;
}
| [
"static int FUNC_0(AVProbeData *VAR_0)\n{",
"if (VAR_0->buf_size < 16)\nreturn 0;",
"if (VAR_0->buf[0] == 'F' && VAR_0->buf[1] == 'O' &&\nVAR_0->buf[2] == 'R' && VAR_0->buf[3] == 'M' &&\nVAR_0->buf[8] == 'A' && VAR_0->buf[9] == 'I' &&\nVAR_0->buf[10] == 'F' && (VAR_0->buf[11] == 'F' || VAR_0->buf[11] == 'C'))\nreturn AVPROBE_SCORE_MAX;",
"else\nreturn 0;",
"}"
] | [
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
7,
9
],
[
11,
13,
15,
17,
19
],
[
21,
23
],
[
25
]
] |
19,656 | static int encode_residual(FlacEncodeContext *ctx, int ch)
{
int i, n;
int min_order, max_order, opt_order, precision, omethod;
int min_porder, max_porder;
FlacFrame *frame;
FlacSubframe *sub;
int32_t coefs[MAX_LPC_ORDER][MAX_LPC_ORDER];
int shift[MAX_LPC_ORDER];
int32_t *res, *smp;
frame = &ctx->frame;
sub = &frame->subframes[ch];
res = sub->residual;
smp = sub->samples;
n = frame->blocksize;
/* CONSTANT */
for(i=1; i<n; i++) {
if(smp[i] != smp[0]) break;
}
if(i == n) {
sub->type = sub->type_code = FLAC_SUBFRAME_CONSTANT;
res[0] = smp[0];
return sub->obits;
}
/* VERBATIM */
if(n < 5) {
sub->type = sub->type_code = FLAC_SUBFRAME_VERBATIM;
encode_residual_verbatim(res, smp, n);
return sub->obits * n;
}
min_order = ctx->options.min_prediction_order;
max_order = ctx->options.max_prediction_order;
min_porder = ctx->options.min_partition_order;
max_porder = ctx->options.max_partition_order;
precision = ctx->options.lpc_coeff_precision;
omethod = ctx->options.prediction_order_method;
/* FIXED */
if(!ctx->options.use_lpc || max_order == 0 || (n <= max_order)) {
uint32_t bits[MAX_FIXED_ORDER+1];
if(max_order > MAX_FIXED_ORDER) max_order = MAX_FIXED_ORDER;
opt_order = 0;
bits[0] = UINT32_MAX;
for(i=min_order; i<=max_order; i++) {
encode_residual_fixed(res, smp, n, i);
bits[i] = calc_rice_params_fixed(&sub->rc, min_porder, max_porder, res,
n, i, sub->obits);
if(bits[i] < bits[opt_order]) {
opt_order = i;
}
}
sub->order = opt_order;
sub->type = FLAC_SUBFRAME_FIXED;
sub->type_code = sub->type | sub->order;
if(sub->order != max_order) {
encode_residual_fixed(res, smp, n, sub->order);
return calc_rice_params_fixed(&sub->rc, min_porder, max_porder, res, n,
sub->order, sub->obits);
}
return bits[sub->order];
}
/* LPC */
opt_order = ff_lpc_calc_coefs(&ctx->dsp, smp, n, max_order, precision, coefs,
shift, ctx->options.use_lpc, omethod, MAX_LPC_SHIFT, 0);
if(omethod == ORDER_METHOD_2LEVEL ||
omethod == ORDER_METHOD_4LEVEL ||
omethod == ORDER_METHOD_8LEVEL) {
int levels = 1 << omethod;
uint32_t bits[levels];
int order;
int opt_index = levels-1;
opt_order = max_order-1;
bits[opt_index] = UINT32_MAX;
for(i=levels-1; i>=0; i--) {
order = min_order + (((max_order-min_order+1) * (i+1)) / levels)-1;
if(order < 0) order = 0;
encode_residual_lpc(res, smp, n, order+1, coefs[order], shift[order]);
bits[i] = calc_rice_params_lpc(&sub->rc, min_porder, max_porder,
res, n, order+1, sub->obits, precision);
if(bits[i] < bits[opt_index]) {
opt_index = i;
opt_order = order;
}
}
opt_order++;
} else if(omethod == ORDER_METHOD_SEARCH) {
// brute-force optimal order search
uint32_t bits[MAX_LPC_ORDER];
opt_order = 0;
bits[0] = UINT32_MAX;
for(i=min_order-1; i<max_order; i++) {
encode_residual_lpc(res, smp, n, i+1, coefs[i], shift[i]);
bits[i] = calc_rice_params_lpc(&sub->rc, min_porder, max_porder,
res, n, i+1, sub->obits, precision);
if(bits[i] < bits[opt_order]) {
opt_order = i;
}
}
opt_order++;
} else if(omethod == ORDER_METHOD_LOG) {
uint32_t bits[MAX_LPC_ORDER];
int step;
opt_order= min_order - 1 + (max_order-min_order)/3;
memset(bits, -1, sizeof(bits));
for(step=16 ;step; step>>=1){
int last= opt_order;
for(i=last-step; i<=last+step; i+= step){
if(i<min_order-1 || i>=max_order || bits[i] < UINT32_MAX)
continue;
encode_residual_lpc(res, smp, n, i+1, coefs[i], shift[i]);
bits[i] = calc_rice_params_lpc(&sub->rc, min_porder, max_porder,
res, n, i+1, sub->obits, precision);
if(bits[i] < bits[opt_order])
opt_order= i;
}
}
opt_order++;
}
sub->order = opt_order;
sub->type = FLAC_SUBFRAME_LPC;
sub->type_code = sub->type | (sub->order-1);
sub->shift = shift[sub->order-1];
for(i=0; i<sub->order; i++) {
sub->coefs[i] = coefs[sub->order-1][i];
}
encode_residual_lpc(res, smp, n, sub->order, sub->coefs, sub->shift);
return calc_rice_params_lpc(&sub->rc, min_porder, max_porder, res, n, sub->order,
sub->obits, precision);
}
| false | FFmpeg | 56c07e298914d0533a74bb4ba4be4abc8ea6b245 | static int encode_residual(FlacEncodeContext *ctx, int ch)
{
int i, n;
int min_order, max_order, opt_order, precision, omethod;
int min_porder, max_porder;
FlacFrame *frame;
FlacSubframe *sub;
int32_t coefs[MAX_LPC_ORDER][MAX_LPC_ORDER];
int shift[MAX_LPC_ORDER];
int32_t *res, *smp;
frame = &ctx->frame;
sub = &frame->subframes[ch];
res = sub->residual;
smp = sub->samples;
n = frame->blocksize;
for(i=1; i<n; i++) {
if(smp[i] != smp[0]) break;
}
if(i == n) {
sub->type = sub->type_code = FLAC_SUBFRAME_CONSTANT;
res[0] = smp[0];
return sub->obits;
}
if(n < 5) {
sub->type = sub->type_code = FLAC_SUBFRAME_VERBATIM;
encode_residual_verbatim(res, smp, n);
return sub->obits * n;
}
min_order = ctx->options.min_prediction_order;
max_order = ctx->options.max_prediction_order;
min_porder = ctx->options.min_partition_order;
max_porder = ctx->options.max_partition_order;
precision = ctx->options.lpc_coeff_precision;
omethod = ctx->options.prediction_order_method;
if(!ctx->options.use_lpc || max_order == 0 || (n <= max_order)) {
uint32_t bits[MAX_FIXED_ORDER+1];
if(max_order > MAX_FIXED_ORDER) max_order = MAX_FIXED_ORDER;
opt_order = 0;
bits[0] = UINT32_MAX;
for(i=min_order; i<=max_order; i++) {
encode_residual_fixed(res, smp, n, i);
bits[i] = calc_rice_params_fixed(&sub->rc, min_porder, max_porder, res,
n, i, sub->obits);
if(bits[i] < bits[opt_order]) {
opt_order = i;
}
}
sub->order = opt_order;
sub->type = FLAC_SUBFRAME_FIXED;
sub->type_code = sub->type | sub->order;
if(sub->order != max_order) {
encode_residual_fixed(res, smp, n, sub->order);
return calc_rice_params_fixed(&sub->rc, min_porder, max_porder, res, n,
sub->order, sub->obits);
}
return bits[sub->order];
}
opt_order = ff_lpc_calc_coefs(&ctx->dsp, smp, n, max_order, precision, coefs,
shift, ctx->options.use_lpc, omethod, MAX_LPC_SHIFT, 0);
if(omethod == ORDER_METHOD_2LEVEL ||
omethod == ORDER_METHOD_4LEVEL ||
omethod == ORDER_METHOD_8LEVEL) {
int levels = 1 << omethod;
uint32_t bits[levels];
int order;
int opt_index = levels-1;
opt_order = max_order-1;
bits[opt_index] = UINT32_MAX;
for(i=levels-1; i>=0; i--) {
order = min_order + (((max_order-min_order+1) * (i+1)) / levels)-1;
if(order < 0) order = 0;
encode_residual_lpc(res, smp, n, order+1, coefs[order], shift[order]);
bits[i] = calc_rice_params_lpc(&sub->rc, min_porder, max_porder,
res, n, order+1, sub->obits, precision);
if(bits[i] < bits[opt_index]) {
opt_index = i;
opt_order = order;
}
}
opt_order++;
} else if(omethod == ORDER_METHOD_SEARCH) {
uint32_t bits[MAX_LPC_ORDER];
opt_order = 0;
bits[0] = UINT32_MAX;
for(i=min_order-1; i<max_order; i++) {
encode_residual_lpc(res, smp, n, i+1, coefs[i], shift[i]);
bits[i] = calc_rice_params_lpc(&sub->rc, min_porder, max_porder,
res, n, i+1, sub->obits, precision);
if(bits[i] < bits[opt_order]) {
opt_order = i;
}
}
opt_order++;
} else if(omethod == ORDER_METHOD_LOG) {
uint32_t bits[MAX_LPC_ORDER];
int step;
opt_order= min_order - 1 + (max_order-min_order)/3;
memset(bits, -1, sizeof(bits));
for(step=16 ;step; step>>=1){
int last= opt_order;
for(i=last-step; i<=last+step; i+= step){
if(i<min_order-1 || i>=max_order || bits[i] < UINT32_MAX)
continue;
encode_residual_lpc(res, smp, n, i+1, coefs[i], shift[i]);
bits[i] = calc_rice_params_lpc(&sub->rc, min_porder, max_porder,
res, n, i+1, sub->obits, precision);
if(bits[i] < bits[opt_order])
opt_order= i;
}
}
opt_order++;
}
sub->order = opt_order;
sub->type = FLAC_SUBFRAME_LPC;
sub->type_code = sub->type | (sub->order-1);
sub->shift = shift[sub->order-1];
for(i=0; i<sub->order; i++) {
sub->coefs[i] = coefs[sub->order-1][i];
}
encode_residual_lpc(res, smp, n, sub->order, sub->coefs, sub->shift);
return calc_rice_params_lpc(&sub->rc, min_porder, max_porder, res, n, sub->order,
sub->obits, precision);
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(FlacEncodeContext *VAR_0, int VAR_1)
{
int VAR_2, VAR_3;
int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8;
int VAR_9, VAR_10;
FlacFrame *frame;
FlacSubframe *sub;
int32_t coefs[MAX_LPC_ORDER][MAX_LPC_ORDER];
int VAR_11[MAX_LPC_ORDER];
int32_t *res, *smp;
frame = &VAR_0->frame;
sub = &frame->subframes[VAR_1];
res = sub->residual;
smp = sub->samples;
VAR_3 = frame->blocksize;
for(VAR_2=1; VAR_2<VAR_3; VAR_2++) {
if(smp[VAR_2] != smp[0]) break;
}
if(VAR_2 == VAR_3) {
sub->type = sub->type_code = FLAC_SUBFRAME_CONSTANT;
res[0] = smp[0];
return sub->obits;
}
if(VAR_3 < 5) {
sub->type = sub->type_code = FLAC_SUBFRAME_VERBATIM;
encode_residual_verbatim(res, smp, VAR_3);
return sub->obits * VAR_3;
}
VAR_4 = VAR_0->options.min_prediction_order;
VAR_5 = VAR_0->options.max_prediction_order;
VAR_9 = VAR_0->options.min_partition_order;
VAR_10 = VAR_0->options.max_partition_order;
VAR_7 = VAR_0->options.lpc_coeff_precision;
VAR_8 = VAR_0->options.prediction_order_method;
if(!VAR_0->options.use_lpc || VAR_5 == 0 || (VAR_3 <= VAR_5)) {
uint32_t bits[MAX_FIXED_ORDER+1];
if(VAR_5 > MAX_FIXED_ORDER) VAR_5 = MAX_FIXED_ORDER;
VAR_6 = 0;
bits[0] = UINT32_MAX;
for(VAR_2=VAR_4; VAR_2<=VAR_5; VAR_2++) {
encode_residual_fixed(res, smp, VAR_3, VAR_2);
bits[VAR_2] = calc_rice_params_fixed(&sub->rc, VAR_9, VAR_10, res,
VAR_3, VAR_2, sub->obits);
if(bits[VAR_2] < bits[VAR_6]) {
VAR_6 = VAR_2;
}
}
sub->VAR_13 = VAR_6;
sub->type = FLAC_SUBFRAME_FIXED;
sub->type_code = sub->type | sub->VAR_13;
if(sub->VAR_13 != VAR_5) {
encode_residual_fixed(res, smp, VAR_3, sub->VAR_13);
return calc_rice_params_fixed(&sub->rc, VAR_9, VAR_10, res, VAR_3,
sub->VAR_13, sub->obits);
}
return bits[sub->VAR_13];
}
VAR_6 = ff_lpc_calc_coefs(&VAR_0->dsp, smp, VAR_3, VAR_5, VAR_7, coefs,
VAR_11, VAR_0->options.use_lpc, VAR_8, MAX_LPC_SHIFT, 0);
if(VAR_8 == ORDER_METHOD_2LEVEL ||
VAR_8 == ORDER_METHOD_4LEVEL ||
VAR_8 == ORDER_METHOD_8LEVEL) {
int VAR_12 = 1 << VAR_8;
uint32_t bits[VAR_12];
int VAR_13;
int VAR_14 = VAR_12-1;
VAR_6 = VAR_5-1;
bits[VAR_14] = UINT32_MAX;
for(VAR_2=VAR_12-1; VAR_2>=0; VAR_2--) {
VAR_13 = VAR_4 + (((VAR_5-VAR_4+1) * (VAR_2+1)) / VAR_12)-1;
if(VAR_13 < 0) VAR_13 = 0;
encode_residual_lpc(res, smp, VAR_3, VAR_13+1, coefs[VAR_13], VAR_11[VAR_13]);
bits[VAR_2] = calc_rice_params_lpc(&sub->rc, VAR_9, VAR_10,
res, VAR_3, VAR_13+1, sub->obits, VAR_7);
if(bits[VAR_2] < bits[VAR_14]) {
VAR_14 = VAR_2;
VAR_6 = VAR_13;
}
}
VAR_6++;
} else if(VAR_8 == ORDER_METHOD_SEARCH) {
uint32_t bits[MAX_LPC_ORDER];
VAR_6 = 0;
bits[0] = UINT32_MAX;
for(VAR_2=VAR_4-1; VAR_2<VAR_5; VAR_2++) {
encode_residual_lpc(res, smp, VAR_3, VAR_2+1, coefs[VAR_2], VAR_11[VAR_2]);
bits[VAR_2] = calc_rice_params_lpc(&sub->rc, VAR_9, VAR_10,
res, VAR_3, VAR_2+1, sub->obits, VAR_7);
if(bits[VAR_2] < bits[VAR_6]) {
VAR_6 = VAR_2;
}
}
VAR_6++;
} else if(VAR_8 == ORDER_METHOD_LOG) {
uint32_t bits[MAX_LPC_ORDER];
int VAR_15;
VAR_6= VAR_4 - 1 + (VAR_5-VAR_4)/3;
memset(bits, -1, sizeof(bits));
for(VAR_15=16 ;VAR_15; VAR_15>>=1){
int VAR_16= VAR_6;
for(VAR_2=VAR_16-VAR_15; VAR_2<=VAR_16+VAR_15; VAR_2+= VAR_15){
if(VAR_2<VAR_4-1 || VAR_2>=VAR_5 || bits[VAR_2] < UINT32_MAX)
continue;
encode_residual_lpc(res, smp, VAR_3, VAR_2+1, coefs[VAR_2], VAR_11[VAR_2]);
bits[VAR_2] = calc_rice_params_lpc(&sub->rc, VAR_9, VAR_10,
res, VAR_3, VAR_2+1, sub->obits, VAR_7);
if(bits[VAR_2] < bits[VAR_6])
VAR_6= VAR_2;
}
}
VAR_6++;
}
sub->VAR_13 = VAR_6;
sub->type = FLAC_SUBFRAME_LPC;
sub->type_code = sub->type | (sub->VAR_13-1);
sub->VAR_11 = VAR_11[sub->VAR_13-1];
for(VAR_2=0; VAR_2<sub->VAR_13; VAR_2++) {
sub->coefs[VAR_2] = coefs[sub->VAR_13-1][VAR_2];
}
encode_residual_lpc(res, smp, VAR_3, sub->VAR_13, sub->coefs, sub->VAR_11);
return calc_rice_params_lpc(&sub->rc, VAR_9, VAR_10, res, VAR_3, sub->VAR_13,
sub->obits, VAR_7);
}
| [
"static int FUNC_0(FlacEncodeContext *VAR_0, int VAR_1)\n{",
"int VAR_2, VAR_3;",
"int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8;",
"int VAR_9, VAR_10;",
"FlacFrame *frame;",
"FlacSubframe *sub;",
"int32_t coefs[MAX_LPC_ORDER][MAX_LPC_ORDER];",
"int VAR_11[MAX_LPC_ORDER];",
"int32_t *res, *smp;",
"frame = &VAR_0->frame;",
"sub = &frame->subframes[VAR_1];",
"res = sub->residual;",
"smp = sub->samples;",
"VAR_3 = frame->blocksize;",
"for(VAR_2=1; VAR_2<VAR_3; VAR_2++) {",
"if(smp[VAR_2] != smp[0]) break;",
"}",
"if(VAR_2 == VAR_3) {",
"sub->type = sub->type_code = FLAC_SUBFRAME_CONSTANT;",
"res[0] = smp[0];",
"return sub->obits;",
"}",
"if(VAR_3 < 5) {",
"sub->type = sub->type_code = FLAC_SUBFRAME_VERBATIM;",
"encode_residual_verbatim(res, smp, VAR_3);",
"return sub->obits * VAR_3;",
"}",
"VAR_4 = VAR_0->options.min_prediction_order;",
"VAR_5 = VAR_0->options.max_prediction_order;",
"VAR_9 = VAR_0->options.min_partition_order;",
"VAR_10 = VAR_0->options.max_partition_order;",
"VAR_7 = VAR_0->options.lpc_coeff_precision;",
"VAR_8 = VAR_0->options.prediction_order_method;",
"if(!VAR_0->options.use_lpc || VAR_5 == 0 || (VAR_3 <= VAR_5)) {",
"uint32_t bits[MAX_FIXED_ORDER+1];",
"if(VAR_5 > MAX_FIXED_ORDER) VAR_5 = MAX_FIXED_ORDER;",
"VAR_6 = 0;",
"bits[0] = UINT32_MAX;",
"for(VAR_2=VAR_4; VAR_2<=VAR_5; VAR_2++) {",
"encode_residual_fixed(res, smp, VAR_3, VAR_2);",
"bits[VAR_2] = calc_rice_params_fixed(&sub->rc, VAR_9, VAR_10, res,\nVAR_3, VAR_2, sub->obits);",
"if(bits[VAR_2] < bits[VAR_6]) {",
"VAR_6 = VAR_2;",
"}",
"}",
"sub->VAR_13 = VAR_6;",
"sub->type = FLAC_SUBFRAME_FIXED;",
"sub->type_code = sub->type | sub->VAR_13;",
"if(sub->VAR_13 != VAR_5) {",
"encode_residual_fixed(res, smp, VAR_3, sub->VAR_13);",
"return calc_rice_params_fixed(&sub->rc, VAR_9, VAR_10, res, VAR_3,\nsub->VAR_13, sub->obits);",
"}",
"return bits[sub->VAR_13];",
"}",
"VAR_6 = ff_lpc_calc_coefs(&VAR_0->dsp, smp, VAR_3, VAR_5, VAR_7, coefs,\nVAR_11, VAR_0->options.use_lpc, VAR_8, MAX_LPC_SHIFT, 0);",
"if(VAR_8 == ORDER_METHOD_2LEVEL ||\nVAR_8 == ORDER_METHOD_4LEVEL ||\nVAR_8 == ORDER_METHOD_8LEVEL) {",
"int VAR_12 = 1 << VAR_8;",
"uint32_t bits[VAR_12];",
"int VAR_13;",
"int VAR_14 = VAR_12-1;",
"VAR_6 = VAR_5-1;",
"bits[VAR_14] = UINT32_MAX;",
"for(VAR_2=VAR_12-1; VAR_2>=0; VAR_2--) {",
"VAR_13 = VAR_4 + (((VAR_5-VAR_4+1) * (VAR_2+1)) / VAR_12)-1;",
"if(VAR_13 < 0) VAR_13 = 0;",
"encode_residual_lpc(res, smp, VAR_3, VAR_13+1, coefs[VAR_13], VAR_11[VAR_13]);",
"bits[VAR_2] = calc_rice_params_lpc(&sub->rc, VAR_9, VAR_10,\nres, VAR_3, VAR_13+1, sub->obits, VAR_7);",
"if(bits[VAR_2] < bits[VAR_14]) {",
"VAR_14 = VAR_2;",
"VAR_6 = VAR_13;",
"}",
"}",
"VAR_6++;",
"} else if(VAR_8 == ORDER_METHOD_SEARCH) {",
"uint32_t bits[MAX_LPC_ORDER];",
"VAR_6 = 0;",
"bits[0] = UINT32_MAX;",
"for(VAR_2=VAR_4-1; VAR_2<VAR_5; VAR_2++) {",
"encode_residual_lpc(res, smp, VAR_3, VAR_2+1, coefs[VAR_2], VAR_11[VAR_2]);",
"bits[VAR_2] = calc_rice_params_lpc(&sub->rc, VAR_9, VAR_10,\nres, VAR_3, VAR_2+1, sub->obits, VAR_7);",
"if(bits[VAR_2] < bits[VAR_6]) {",
"VAR_6 = VAR_2;",
"}",
"}",
"VAR_6++;",
"} else if(VAR_8 == ORDER_METHOD_LOG) {",
"uint32_t bits[MAX_LPC_ORDER];",
"int VAR_15;",
"VAR_6= VAR_4 - 1 + (VAR_5-VAR_4)/3;",
"memset(bits, -1, sizeof(bits));",
"for(VAR_15=16 ;VAR_15; VAR_15>>=1){",
"int VAR_16= VAR_6;",
"for(VAR_2=VAR_16-VAR_15; VAR_2<=VAR_16+VAR_15; VAR_2+= VAR_15){",
"if(VAR_2<VAR_4-1 || VAR_2>=VAR_5 || bits[VAR_2] < UINT32_MAX)\ncontinue;",
"encode_residual_lpc(res, smp, VAR_3, VAR_2+1, coefs[VAR_2], VAR_11[VAR_2]);",
"bits[VAR_2] = calc_rice_params_lpc(&sub->rc, VAR_9, VAR_10,\nres, VAR_3, VAR_2+1, sub->obits, VAR_7);",
"if(bits[VAR_2] < bits[VAR_6])\nVAR_6= VAR_2;",
"}",
"}",
"VAR_6++;",
"}",
"sub->VAR_13 = VAR_6;",
"sub->type = FLAC_SUBFRAME_LPC;",
"sub->type_code = sub->type | (sub->VAR_13-1);",
"sub->VAR_11 = VAR_11[sub->VAR_13-1];",
"for(VAR_2=0; VAR_2<sub->VAR_13; VAR_2++) {",
"sub->coefs[VAR_2] = coefs[sub->VAR_13-1][VAR_2];",
"}",
"encode_residual_lpc(res, smp, VAR_3, sub->VAR_13, sub->coefs, sub->VAR_11);",
"return calc_rice_params_lpc(&sub->rc, VAR_9, VAR_10, res, VAR_3, sub->VAR_13,\nsub->obits, 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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99,
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121,
123
],
[
125
],
[
127
],
[
129
],
[
135,
137
],
[
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
],
[
219
],
[
221
],
[
225
],
[
227
],
[
229
],
[
231,
233
],
[
235
],
[
237,
239
],
[
241,
243
],
[
245
],
[
247
],
[
249
],
[
251
],
[
255
],
[
257
],
[
259
],
[
261
],
[
263
],
[
265
],
[
267
],
[
269
],
[
271,
273
],
[
275
]
] |
19,657 | static int decode_stream_header(NUTContext *nut){
AVFormatContext *s= nut->avf;
ByteIOContext *bc = &s->pb;
StreamContext *stc;
int class, nom, denom, stream_id;
uint64_t tmp, end;
AVStream *st;
end= get_packetheader(nut, bc, 1);
end += url_ftell(bc) - 4;
GET_V(stream_id, tmp < s->nb_streams && !nut->stream[tmp].time_base.num);
stc= &nut->stream[stream_id];
st = s->streams[stream_id];
if (!st)
return AVERROR_NOMEM;
class = get_v(bc);
tmp = get_fourcc(bc);
st->codec->codec_tag= tmp;
switch(class)
{
case 0:
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = codec_get_bmp_id(tmp);
if (st->codec->codec_id == CODEC_ID_NONE)
av_log(s, AV_LOG_ERROR, "Unknown codec?!\n");
break;
case 1:
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = codec_get_wav_id(tmp);
if (st->codec->codec_id == CODEC_ID_NONE)
av_log(s, AV_LOG_ERROR, "Unknown codec?!\n");
break;
case 2:
// st->codec->codec_type = CODEC_TYPE_TEXT;
// break;
case 3:
st->codec->codec_type = CODEC_TYPE_DATA;
break;
default:
av_log(s, AV_LOG_ERROR, "Unknown stream class (%d)\n", class);
return -1;
}
GET_V(stc->time_base_id , tmp < nut->time_base_count);
GET_V(stc->msb_pts_shift , tmp < 16);
stc->max_pts_distance= get_v(bc);
GET_V(stc->decode_delay , tmp < 1000); //sanity limit, raise this if moors law is true
st->codec->has_b_frames= stc->decode_delay;
get_v(bc); //stream flags
GET_V(st->codec->extradata_size, tmp < (1<<30));
if(st->codec->extradata_size){
st->codec->extradata= av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
get_buffer(bc, st->codec->extradata, st->codec->extradata_size);
}
if (st->codec->codec_type == CODEC_TYPE_VIDEO){
GET_V(st->codec->width , tmp > 0)
GET_V(st->codec->height, tmp > 0)
st->codec->sample_aspect_ratio.num= get_v(bc);
st->codec->sample_aspect_ratio.den= get_v(bc);
if((!st->codec->sample_aspect_ratio.num) != (!st->codec->sample_aspect_ratio.den)){
av_log(s, AV_LOG_ERROR, "invalid aspect ratio\n");
return -1;
}
get_v(bc); /* csp type */
}else if (st->codec->codec_type == CODEC_TYPE_AUDIO){
GET_V(st->codec->sample_rate , tmp > 0)
tmp= get_v(bc); // samplerate_den
if(tmp > st->codec->sample_rate){
av_log(s, AV_LOG_ERROR, "bleh, libnut muxed this ;)\n");
st->codec->sample_rate= tmp;
}
GET_V(st->codec->channels, tmp > 0)
}
if(skip_reserved(bc, end) || check_checksum(bc)){
av_log(s, AV_LOG_ERROR, "Stream header %d checksum mismatch\n", stream_id);
return -1;
}
stc->time_base= nut->time_base[stc->time_base_id];
av_set_pts_info(s->streams[stream_id], 63, stc->time_base.num, stc->time_base.den);
return 0;
}
| true | FFmpeg | 5d97d9d53ea1cc2c28411ad734565372ddeccc32 | static int decode_stream_header(NUTContext *nut){
AVFormatContext *s= nut->avf;
ByteIOContext *bc = &s->pb;
StreamContext *stc;
int class, nom, denom, stream_id;
uint64_t tmp, end;
AVStream *st;
end= get_packetheader(nut, bc, 1);
end += url_ftell(bc) - 4;
GET_V(stream_id, tmp < s->nb_streams && !nut->stream[tmp].time_base.num);
stc= &nut->stream[stream_id];
st = s->streams[stream_id];
if (!st)
return AVERROR_NOMEM;
class = get_v(bc);
tmp = get_fourcc(bc);
st->codec->codec_tag= tmp;
switch(class)
{
case 0:
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = codec_get_bmp_id(tmp);
if (st->codec->codec_id == CODEC_ID_NONE)
av_log(s, AV_LOG_ERROR, "Unknown codec?!\n");
break;
case 1:
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = codec_get_wav_id(tmp);
if (st->codec->codec_id == CODEC_ID_NONE)
av_log(s, AV_LOG_ERROR, "Unknown codec?!\n");
break;
case 2:
case 3:
st->codec->codec_type = CODEC_TYPE_DATA;
break;
default:
av_log(s, AV_LOG_ERROR, "Unknown stream class (%d)\n", class);
return -1;
}
GET_V(stc->time_base_id , tmp < nut->time_base_count);
GET_V(stc->msb_pts_shift , tmp < 16);
stc->max_pts_distance= get_v(bc);
GET_V(stc->decode_delay , tmp < 1000);
st->codec->has_b_frames= stc->decode_delay;
get_v(bc);
GET_V(st->codec->extradata_size, tmp < (1<<30));
if(st->codec->extradata_size){
st->codec->extradata= av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
get_buffer(bc, st->codec->extradata, st->codec->extradata_size);
}
if (st->codec->codec_type == CODEC_TYPE_VIDEO){
GET_V(st->codec->width , tmp > 0)
GET_V(st->codec->height, tmp > 0)
st->codec->sample_aspect_ratio.num= get_v(bc);
st->codec->sample_aspect_ratio.den= get_v(bc);
if((!st->codec->sample_aspect_ratio.num) != (!st->codec->sample_aspect_ratio.den)){
av_log(s, AV_LOG_ERROR, "invalid aspect ratio\n");
return -1;
}
get_v(bc);
}else if (st->codec->codec_type == CODEC_TYPE_AUDIO){
GET_V(st->codec->sample_rate , tmp > 0)
tmp= get_v(bc);
if(tmp > st->codec->sample_rate){
av_log(s, AV_LOG_ERROR, "bleh, libnut muxed this ;)\n");
st->codec->sample_rate= tmp;
}
GET_V(st->codec->channels, tmp > 0)
}
if(skip_reserved(bc, end) || check_checksum(bc)){
av_log(s, AV_LOG_ERROR, "Stream header %d checksum mismatch\n", stream_id);
return -1;
}
stc->time_base= nut->time_base[stc->time_base_id];
av_set_pts_info(s->streams[stream_id], 63, stc->time_base.num, stc->time_base.den);
return 0;
}
| {
"code": [
" return 0;",
" end += url_ftell(bc) - 4;",
" if(skip_reserved(bc, end) || check_checksum(bc)){",
" end += url_ftell(bc) - 4;",
" if(skip_reserved(bc, end) || check_checksum(bc)){",
" end += url_ftell(bc) - 4;",
" if(skip_reserved(bc, end) || check_checksum(bc)){",
" end += url_ftell(bc) - 4;",
" if(skip_reserved(bc, end) || check_checksum(bc)){",
" end += url_ftell(bc) - 4;",
" if(skip_reserved(bc, end) || check_checksum(bc)){"
],
"line_no": [
167,
19,
155,
19,
155,
19,
155,
19,
155,
19,
155
]
} | static int FUNC_0(NUTContext *VAR_0){
AVFormatContext *s= VAR_0->avf;
ByteIOContext *bc = &s->pb;
StreamContext *stc;
int VAR_1, VAR_2, VAR_3, VAR_4;
uint64_t tmp, end;
AVStream *st;
end= get_packetheader(VAR_0, bc, 1);
end += url_ftell(bc) - 4;
GET_V(VAR_4, tmp < s->nb_streams && !VAR_0->stream[tmp].time_base.num);
stc= &VAR_0->stream[VAR_4];
st = s->streams[VAR_4];
if (!st)
return AVERROR_NOMEM;
VAR_1 = get_v(bc);
tmp = get_fourcc(bc);
st->codec->codec_tag= tmp;
switch(VAR_1)
{
case 0:
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = codec_get_bmp_id(tmp);
if (st->codec->codec_id == CODEC_ID_NONE)
av_log(s, AV_LOG_ERROR, "Unknown codec?!\n");
break;
case 1:
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = codec_get_wav_id(tmp);
if (st->codec->codec_id == CODEC_ID_NONE)
av_log(s, AV_LOG_ERROR, "Unknown codec?!\n");
break;
case 2:
case 3:
st->codec->codec_type = CODEC_TYPE_DATA;
break;
default:
av_log(s, AV_LOG_ERROR, "Unknown stream VAR_1 (%d)\n", VAR_1);
return -1;
}
GET_V(stc->time_base_id , tmp < VAR_0->time_base_count);
GET_V(stc->msb_pts_shift , tmp < 16);
stc->max_pts_distance= get_v(bc);
GET_V(stc->decode_delay , tmp < 1000);
st->codec->has_b_frames= stc->decode_delay;
get_v(bc);
GET_V(st->codec->extradata_size, tmp < (1<<30));
if(st->codec->extradata_size){
st->codec->extradata= av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
get_buffer(bc, st->codec->extradata, st->codec->extradata_size);
}
if (st->codec->codec_type == CODEC_TYPE_VIDEO){
GET_V(st->codec->width , tmp > 0)
GET_V(st->codec->height, tmp > 0)
st->codec->sample_aspect_ratio.num= get_v(bc);
st->codec->sample_aspect_ratio.den= get_v(bc);
if((!st->codec->sample_aspect_ratio.num) != (!st->codec->sample_aspect_ratio.den)){
av_log(s, AV_LOG_ERROR, "invalid aspect ratio\n");
return -1;
}
get_v(bc);
}else if (st->codec->codec_type == CODEC_TYPE_AUDIO){
GET_V(st->codec->sample_rate , tmp > 0)
tmp= get_v(bc);
if(tmp > st->codec->sample_rate){
av_log(s, AV_LOG_ERROR, "bleh, libnut muxed this ;)\n");
st->codec->sample_rate= tmp;
}
GET_V(st->codec->channels, tmp > 0)
}
if(skip_reserved(bc, end) || check_checksum(bc)){
av_log(s, AV_LOG_ERROR, "Stream header %d checksum mismatch\n", VAR_4);
return -1;
}
stc->time_base= VAR_0->time_base[stc->time_base_id];
av_set_pts_info(s->streams[VAR_4], 63, stc->time_base.num, stc->time_base.den);
return 0;
}
| [
"static int FUNC_0(NUTContext *VAR_0){",
"AVFormatContext *s= VAR_0->avf;",
"ByteIOContext *bc = &s->pb;",
"StreamContext *stc;",
"int VAR_1, VAR_2, VAR_3, VAR_4;",
"uint64_t tmp, end;",
"AVStream *st;",
"end= get_packetheader(VAR_0, bc, 1);",
"end += url_ftell(bc) - 4;",
"GET_V(VAR_4, tmp < s->nb_streams && !VAR_0->stream[tmp].time_base.num);",
"stc= &VAR_0->stream[VAR_4];",
"st = s->streams[VAR_4];",
"if (!st)\nreturn AVERROR_NOMEM;",
"VAR_1 = get_v(bc);",
"tmp = get_fourcc(bc);",
"st->codec->codec_tag= tmp;",
"switch(VAR_1)\n{",
"case 0:\nst->codec->codec_type = CODEC_TYPE_VIDEO;",
"st->codec->codec_id = codec_get_bmp_id(tmp);",
"if (st->codec->codec_id == CODEC_ID_NONE)\nav_log(s, AV_LOG_ERROR, \"Unknown codec?!\\n\");",
"break;",
"case 1:\nst->codec->codec_type = CODEC_TYPE_AUDIO;",
"st->codec->codec_id = codec_get_wav_id(tmp);",
"if (st->codec->codec_id == CODEC_ID_NONE)\nav_log(s, AV_LOG_ERROR, \"Unknown codec?!\\n\");",
"break;",
"case 2:\ncase 3:\nst->codec->codec_type = CODEC_TYPE_DATA;",
"break;",
"default:\nav_log(s, AV_LOG_ERROR, \"Unknown stream VAR_1 (%d)\\n\", VAR_1);",
"return -1;",
"}",
"GET_V(stc->time_base_id , tmp < VAR_0->time_base_count);",
"GET_V(stc->msb_pts_shift , tmp < 16);",
"stc->max_pts_distance= get_v(bc);",
"GET_V(stc->decode_delay , tmp < 1000);",
"st->codec->has_b_frames= stc->decode_delay;",
"get_v(bc);",
"GET_V(st->codec->extradata_size, tmp < (1<<30));",
"if(st->codec->extradata_size){",
"st->codec->extradata= av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);",
"get_buffer(bc, st->codec->extradata, st->codec->extradata_size);",
"}",
"if (st->codec->codec_type == CODEC_TYPE_VIDEO){",
"GET_V(st->codec->width , tmp > 0)\nGET_V(st->codec->height, tmp > 0)\nst->codec->sample_aspect_ratio.num= get_v(bc);",
"st->codec->sample_aspect_ratio.den= get_v(bc);",
"if((!st->codec->sample_aspect_ratio.num) != (!st->codec->sample_aspect_ratio.den)){",
"av_log(s, AV_LOG_ERROR, \"invalid aspect ratio\\n\");",
"return -1;",
"}",
"get_v(bc);",
"}else if (st->codec->codec_type == CODEC_TYPE_AUDIO){",
"GET_V(st->codec->sample_rate , tmp > 0)\ntmp= get_v(bc);",
"if(tmp > st->codec->sample_rate){",
"av_log(s, AV_LOG_ERROR, \"bleh, libnut muxed this ;)\\n\");",
"st->codec->sample_rate= tmp;",
"}",
"GET_V(st->codec->channels, tmp > 0)\n}",
"if(skip_reserved(bc, end) || check_checksum(bc)){",
"av_log(s, AV_LOG_ERROR, \"Stream header %d checksum mismatch\\n\", VAR_4);",
"return -1;",
"}",
"stc->time_base= VAR_0->time_base[stc->time_base_id];",
"av_set_pts_info(s->streams[VAR_4], 63, stc->time_base.num, stc->time_base.den);",
"return 0;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
1,
0
] | [
[
1
],
[
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
19
],
[
23
],
[
25
],
[
29
],
[
31,
33
],
[
37
],
[
39
],
[
41
],
[
43,
45
],
[
47,
49
],
[
51
],
[
53,
55
],
[
57
],
[
59,
61
],
[
63
],
[
65,
67
],
[
69
],
[
71,
77,
79
],
[
81
],
[
83,
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
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
]
] |
19,658 | void avformat_close_input(AVFormatContext **ps)
{
AVFormatContext *s = *ps;
AVIOContext *pb = (s->iformat->flags & AVFMT_NOFILE) || (s->flags & AVFMT_FLAG_CUSTOM_IO) ?
NULL : s->pb;
flush_packet_queue(s);
if (s->iformat->read_close)
s->iformat->read_close(s);
avformat_free_context(s);
*ps = NULL;
avio_close(pb);
}
| true | FFmpeg | 44272c1cccfb92415801ae60693a7ed04e458916 | void avformat_close_input(AVFormatContext **ps)
{
AVFormatContext *s = *ps;
AVIOContext *pb = (s->iformat->flags & AVFMT_NOFILE) || (s->flags & AVFMT_FLAG_CUSTOM_IO) ?
NULL : s->pb;
flush_packet_queue(s);
if (s->iformat->read_close)
s->iformat->read_close(s);
avformat_free_context(s);
*ps = NULL;
avio_close(pb);
}
| {
"code": [
" AVIOContext *pb = (s->iformat->flags & AVFMT_NOFILE) || (s->flags & AVFMT_FLAG_CUSTOM_IO) ?",
" NULL : s->pb;",
" if (s->iformat->read_close)",
" s->iformat->read_close(s);"
],
"line_no": [
7,
9,
13,
15
]
} | void FUNC_0(AVFormatContext **VAR_0)
{
AVFormatContext *s = *VAR_0;
AVIOContext *pb = (s->iformat->flags & AVFMT_NOFILE) || (s->flags & AVFMT_FLAG_CUSTOM_IO) ?
NULL : s->pb;
flush_packet_queue(s);
if (s->iformat->read_close)
s->iformat->read_close(s);
avformat_free_context(s);
*VAR_0 = NULL;
avio_close(pb);
}
| [
"void FUNC_0(AVFormatContext **VAR_0)\n{",
"AVFormatContext *s = *VAR_0;",
"AVIOContext *pb = (s->iformat->flags & AVFMT_NOFILE) || (s->flags & AVFMT_FLAG_CUSTOM_IO) ?\nNULL : s->pb;",
"flush_packet_queue(s);",
"if (s->iformat->read_close)\ns->iformat->read_close(s);",
"avformat_free_context(s);",
"*VAR_0 = NULL;",
"avio_close(pb);",
"}"
] | [
0,
0,
1,
0,
1,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7,
9
],
[
11
],
[
13,
15
],
[
17
],
[
19
],
[
23
],
[
25
]
] |
19,660 | static void cris_alu(DisasContext *dc, int op,
TCGv d, TCGv op_a, TCGv op_b, int size)
{
TCGv tmp;
int writeback;
writeback = 1;
if (op == CC_OP_BOUND || op == CC_OP_BTST)
tmp = tcg_temp_local_new(TCG_TYPE_TL);
else
tmp = tcg_temp_new(TCG_TYPE_TL);
if (op == CC_OP_CMP) {
writeback = 0;
} else if (size == 4) {
tmp = d;
writeback = 0;
}
cris_pre_alu_update_cc(dc, op, op_a, op_b, size);
cris_alu_op_exec(dc, op, tmp, op_a, op_b, size);
cris_update_result(dc, tmp);
/* Writeback. */
if (writeback) {
if (size == 1)
tcg_gen_andi_tl(d, d, ~0xff);
else
tcg_gen_andi_tl(d, d, ~0xffff);
tcg_gen_or_tl(d, d, tmp);
}
if (tmp != d)
tcg_temp_free(tmp);
}
| true | qemu | 44696296d5c2ffccef9d43d37d4f525bba7d9f5c | static void cris_alu(DisasContext *dc, int op,
TCGv d, TCGv op_a, TCGv op_b, int size)
{
TCGv tmp;
int writeback;
writeback = 1;
if (op == CC_OP_BOUND || op == CC_OP_BTST)
tmp = tcg_temp_local_new(TCG_TYPE_TL);
else
tmp = tcg_temp_new(TCG_TYPE_TL);
if (op == CC_OP_CMP) {
writeback = 0;
} else if (size == 4) {
tmp = d;
writeback = 0;
}
cris_pre_alu_update_cc(dc, op, op_a, op_b, size);
cris_alu_op_exec(dc, op, tmp, op_a, op_b, size);
cris_update_result(dc, tmp);
if (writeback) {
if (size == 1)
tcg_gen_andi_tl(d, d, ~0xff);
else
tcg_gen_andi_tl(d, d, ~0xffff);
tcg_gen_or_tl(d, d, tmp);
}
if (tmp != d)
tcg_temp_free(tmp);
}
| {
"code": [
"\t\ttmp = tcg_temp_new(TCG_TYPE_TL);"
],
"line_no": [
23
]
} | static void FUNC_0(DisasContext *VAR_0, int VAR_1,
TCGv VAR_2, TCGv VAR_3, TCGv VAR_4, int VAR_5)
{
TCGv tmp;
int VAR_6;
VAR_6 = 1;
if (VAR_1 == CC_OP_BOUND || VAR_1 == CC_OP_BTST)
tmp = tcg_temp_local_new(TCG_TYPE_TL);
else
tmp = tcg_temp_new(TCG_TYPE_TL);
if (VAR_1 == CC_OP_CMP) {
VAR_6 = 0;
} else if (VAR_5 == 4) {
tmp = VAR_2;
VAR_6 = 0;
}
cris_pre_alu_update_cc(VAR_0, VAR_1, VAR_3, VAR_4, VAR_5);
cris_alu_op_exec(VAR_0, VAR_1, tmp, VAR_3, VAR_4, VAR_5);
cris_update_result(VAR_0, tmp);
if (VAR_6) {
if (VAR_5 == 1)
tcg_gen_andi_tl(VAR_2, VAR_2, ~0xff);
else
tcg_gen_andi_tl(VAR_2, VAR_2, ~0xffff);
tcg_gen_or_tl(VAR_2, VAR_2, tmp);
}
if (tmp != VAR_2)
tcg_temp_free(tmp);
}
| [
"static void FUNC_0(DisasContext *VAR_0, int VAR_1,\nTCGv VAR_2, TCGv VAR_3, TCGv VAR_4, int VAR_5)\n{",
"TCGv tmp;",
"int VAR_6;",
"VAR_6 = 1;",
"if (VAR_1 == CC_OP_BOUND || VAR_1 == CC_OP_BTST)\ntmp = tcg_temp_local_new(TCG_TYPE_TL);",
"else\ntmp = tcg_temp_new(TCG_TYPE_TL);",
"if (VAR_1 == CC_OP_CMP) {",
"VAR_6 = 0;",
"} else if (VAR_5 == 4) {",
"tmp = VAR_2;",
"VAR_6 = 0;",
"}",
"cris_pre_alu_update_cc(VAR_0, VAR_1, VAR_3, VAR_4, VAR_5);",
"cris_alu_op_exec(VAR_0, VAR_1, tmp, VAR_3, VAR_4, VAR_5);",
"cris_update_result(VAR_0, tmp);",
"if (VAR_6) {",
"if (VAR_5 == 1)\ntcg_gen_andi_tl(VAR_2, VAR_2, ~0xff);",
"else\ntcg_gen_andi_tl(VAR_2, VAR_2, ~0xffff);",
"tcg_gen_or_tl(VAR_2, VAR_2, tmp);",
"}",
"if (tmp != VAR_2)\ntcg_temp_free(tmp);",
"}"
] | [
0,
0,
0,
0,
0,
1,
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
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
41
],
[
43
],
[
45
],
[
51
],
[
53,
55
],
[
57,
59
],
[
61
],
[
63
],
[
65,
67
],
[
69
]
] |
19,661 | int avresample_set_matrix(AVAudioResampleContext *avr, const double *matrix,
int stride)
{
int in_channels, out_channels, i, o;
in_channels = av_get_channel_layout_nb_channels(avr->in_channel_layout);
out_channels = av_get_channel_layout_nb_channels(avr->out_channel_layout);
if ( in_channels < 0 || in_channels > AVRESAMPLE_MAX_CHANNELS ||
out_channels < 0 || out_channels > AVRESAMPLE_MAX_CHANNELS) {
av_log(avr, AV_LOG_ERROR, "Invalid channel layouts\n");
return AVERROR(EINVAL);
}
if (avr->am->matrix)
av_freep(avr->am->matrix);
#define CONVERT_MATRIX(type, expr) \
avr->am->matrix_## type[0] = av_mallocz(out_channels * in_channels * \
sizeof(*avr->am->matrix_## type[0])); \
if (!avr->am->matrix_## type[0]) \
return AVERROR(ENOMEM); \
for (o = 0; o < out_channels; o++) { \
if (o > 0) \
avr->am->matrix_## type[o] = avr->am->matrix_## type[o - 1] + \
in_channels; \
for (i = 0; i < in_channels; i++) { \
double v = matrix[o * stride + i]; \
avr->am->matrix_## type[o][i] = expr; \
} \
} \
avr->am->matrix = (void **)avr->am->matrix_## type;
switch (avr->mix_coeff_type) {
case AV_MIX_COEFF_TYPE_Q8:
CONVERT_MATRIX(q8, av_clip_int16(lrint(256.0 * v)))
break;
case AV_MIX_COEFF_TYPE_Q15:
CONVERT_MATRIX(q15, av_clipl_int32(llrint(32768.0 * v)))
break;
case AV_MIX_COEFF_TYPE_FLT:
CONVERT_MATRIX(flt, v)
break;
default:
av_log(avr, AV_LOG_ERROR, "Invalid mix coeff type\n");
return AVERROR(EINVAL);
}
/* TODO: detect situations where we can just swap around pointers
instead of doing matrix multiplications with 0.0 and 1.0 */
return 0;
}
| true | FFmpeg | 8821ae649e61097ec57ca58472c3e4239c82913c | int avresample_set_matrix(AVAudioResampleContext *avr, const double *matrix,
int stride)
{
int in_channels, out_channels, i, o;
in_channels = av_get_channel_layout_nb_channels(avr->in_channel_layout);
out_channels = av_get_channel_layout_nb_channels(avr->out_channel_layout);
if ( in_channels < 0 || in_channels > AVRESAMPLE_MAX_CHANNELS ||
out_channels < 0 || out_channels > AVRESAMPLE_MAX_CHANNELS) {
av_log(avr, AV_LOG_ERROR, "Invalid channel layouts\n");
return AVERROR(EINVAL);
}
if (avr->am->matrix)
av_freep(avr->am->matrix);
#define CONVERT_MATRIX(type, expr) \
avr->am->matrix_## type[0] = av_mallocz(out_channels * in_channels * \
sizeof(*avr->am->matrix_## type[0])); \
if (!avr->am->matrix_## type[0]) \
return AVERROR(ENOMEM); \
for (o = 0; o < out_channels; o++) { \
if (o > 0) \
avr->am->matrix_## type[o] = avr->am->matrix_## type[o - 1] + \
in_channels; \
for (i = 0; i < in_channels; i++) { \
double v = matrix[o * stride + i]; \
avr->am->matrix_## type[o][i] = expr; \
} \
} \
avr->am->matrix = (void **)avr->am->matrix_## type;
switch (avr->mix_coeff_type) {
case AV_MIX_COEFF_TYPE_Q8:
CONVERT_MATRIX(q8, av_clip_int16(lrint(256.0 * v)))
break;
case AV_MIX_COEFF_TYPE_Q15:
CONVERT_MATRIX(q15, av_clipl_int32(llrint(32768.0 * v)))
break;
case AV_MIX_COEFF_TYPE_FLT:
CONVERT_MATRIX(flt, v)
break;
default:
av_log(avr, AV_LOG_ERROR, "Invalid mix coeff type\n");
return AVERROR(EINVAL);
}
return 0;
}
| {
"code": [
" if ( in_channels < 0 || in_channels > AVRESAMPLE_MAX_CHANNELS ||",
" out_channels < 0 || out_channels > AVRESAMPLE_MAX_CHANNELS) {",
" if ( in_channels < 0 || in_channels > AVRESAMPLE_MAX_CHANNELS ||",
" out_channels < 0 || out_channels > AVRESAMPLE_MAX_CHANNELS) {",
" if (avr->am->matrix)",
" av_freep(avr->am->matrix);"
],
"line_no": [
17,
19,
17,
19,
29,
31
]
} | int FUNC_0(AVAudioResampleContext *VAR_0, const double *VAR_1,
int VAR_2)
{
int VAR_3, VAR_4, VAR_5, VAR_6;
VAR_3 = av_get_channel_layout_nb_channels(VAR_0->in_channel_layout);
VAR_4 = av_get_channel_layout_nb_channels(VAR_0->out_channel_layout);
if ( VAR_3 < 0 || VAR_3 > AVRESAMPLE_MAX_CHANNELS ||
VAR_4 < 0 || VAR_4 > AVRESAMPLE_MAX_CHANNELS) {
av_log(VAR_0, AV_LOG_ERROR, "Invalid channel layouts\n");
return AVERROR(EINVAL);
}
if (VAR_0->am->VAR_1)
av_freep(VAR_0->am->VAR_1);
#define CONVERT_MATRIX(type, expr) \
VAR_0->am->matrix_## type[0] = av_mallocz(VAR_4 * VAR_3 * \
sizeof(*VAR_0->am->matrix_## type[0])); \
if (!VAR_0->am->matrix_## type[0]) \
return AVERROR(ENOMEM); \
for (VAR_6 = 0; VAR_6 < VAR_4; VAR_6++) { \
if (VAR_6 > 0) \
VAR_0->am->matrix_## type[VAR_6] = VAR_0->am->matrix_## type[VAR_6 - 1] + \
VAR_3; \
for (VAR_5 = 0; VAR_5 < VAR_3; VAR_5++) { \
double VAR_7 = VAR_1[VAR_6 * VAR_2 + VAR_5]; \
VAR_0->am->matrix_## type[VAR_6][VAR_5] = expr; \
} \
} \
VAR_0->am->VAR_1 = (void **)VAR_0->am->matrix_## type;
switch (VAR_0->mix_coeff_type) {
case AV_MIX_COEFF_TYPE_Q8:
CONVERT_MATRIX(q8, av_clip_int16(lrint(256.0 * VAR_7)))
break;
case AV_MIX_COEFF_TYPE_Q15:
CONVERT_MATRIX(q15, av_clipl_int32(llrint(32768.0 * VAR_7)))
break;
case AV_MIX_COEFF_TYPE_FLT:
CONVERT_MATRIX(flt, VAR_7)
break;
default:
av_log(VAR_0, AV_LOG_ERROR, "Invalid mix coeff type\n");
return AVERROR(EINVAL);
}
return 0;
}
| [
"int FUNC_0(AVAudioResampleContext *VAR_0, const double *VAR_1,\nint VAR_2)\n{",
"int VAR_3, VAR_4, VAR_5, VAR_6;",
"VAR_3 = av_get_channel_layout_nb_channels(VAR_0->in_channel_layout);",
"VAR_4 = av_get_channel_layout_nb_channels(VAR_0->out_channel_layout);",
"if ( VAR_3 < 0 || VAR_3 > AVRESAMPLE_MAX_CHANNELS ||\nVAR_4 < 0 || VAR_4 > AVRESAMPLE_MAX_CHANNELS) {",
"av_log(VAR_0, AV_LOG_ERROR, \"Invalid channel layouts\\n\");",
"return AVERROR(EINVAL);",
"}",
"if (VAR_0->am->VAR_1)\nav_freep(VAR_0->am->VAR_1);",
"#define CONVERT_MATRIX(type, expr) \\\nVAR_0->am->matrix_## type[0] = av_mallocz(VAR_4 * VAR_3 * \\\nsizeof(*VAR_0->am->matrix_## type[0])); \\",
"if (!VAR_0->am->matrix_## type[0]) \\\nreturn AVERROR(ENOMEM); \\",
"for (VAR_6 = 0; VAR_6 < VAR_4; VAR_6++) { \\",
"if (VAR_6 > 0) \\\nVAR_0->am->matrix_## type[VAR_6] = VAR_0->am->matrix_## type[VAR_6 - 1] + \\\nVAR_3; \\",
"for (VAR_5 = 0; VAR_5 < VAR_3; VAR_5++) { \\",
"double VAR_7 = VAR_1[VAR_6 * VAR_2 + VAR_5]; \\",
"VAR_0->am->matrix_## type[VAR_6][VAR_5] = expr; \\",
"} \\",
"} \\",
"VAR_0->am->VAR_1 = (void **)VAR_0->am->matrix_## type;",
"switch (VAR_0->mix_coeff_type) {",
"case AV_MIX_COEFF_TYPE_Q8:\nCONVERT_MATRIX(q8, av_clip_int16(lrint(256.0 * VAR_7)))\nbreak;",
"case AV_MIX_COEFF_TYPE_Q15:\nCONVERT_MATRIX(q15, av_clipl_int32(llrint(32768.0 * VAR_7)))\nbreak;",
"case AV_MIX_COEFF_TYPE_FLT:\nCONVERT_MATRIX(flt, VAR_7)\nbreak;",
"default:\nav_log(VAR_0, AV_LOG_ERROR, \"Invalid mix coeff type\\n\");",
"return AVERROR(EINVAL);",
"}",
"return 0;",
"}"
] | [
0,
0,
0,
0,
1,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5
],
[
7
],
[
11
],
[
13
],
[
17,
19
],
[
21
],
[
23
],
[
25
],
[
29,
31
],
[
35,
37,
39
],
[
41,
43
],
[
45
],
[
47,
49,
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
67
],
[
69,
71,
73
],
[
75,
77,
79
],
[
81,
83,
85
],
[
87,
89
],
[
91
],
[
93
],
[
103
],
[
105
]
] |
19,663 | av_cold void ff_vp9dsp_init(VP9DSPContext *dsp, int bpp, int bitexact)
{
if (bpp == 8) {
ff_vp9dsp_init_8(dsp);
} else if (bpp == 10) {
ff_vp9dsp_init_10(dsp);
} else {
av_assert0(bpp == 12);
ff_vp9dsp_init_12(dsp);
}
if (ARCH_X86) ff_vp9dsp_init_x86(dsp, bpp, bitexact);
if (ARCH_MIPS) ff_vp9dsp_init_mips(dsp, bpp);
} | true | FFmpeg | 68caef9d48c4f1540b1b3181ebe7062a3417c62a | av_cold void ff_vp9dsp_init(VP9DSPContext *dsp, int bpp, int bitexact)
{
if (bpp == 8) {
ff_vp9dsp_init_8(dsp);
} else if (bpp == 10) {
ff_vp9dsp_init_10(dsp);
} else {
av_assert0(bpp == 12);
ff_vp9dsp_init_12(dsp);
}
if (ARCH_X86) ff_vp9dsp_init_x86(dsp, bpp, bitexact);
if (ARCH_MIPS) ff_vp9dsp_init_mips(dsp, bpp);
} | {
"code": [],
"line_no": []
} | av_cold void FUNC_0(VP9DSPContext *dsp, int bpp, int bitexact)
{
if (bpp == 8) {
ff_vp9dsp_init_8(dsp);
} else if (bpp == 10) {
ff_vp9dsp_init_10(dsp);
} else {
av_assert0(bpp == 12);
ff_vp9dsp_init_12(dsp);
}
if (ARCH_X86) ff_vp9dsp_init_x86(dsp, bpp, bitexact);
if (ARCH_MIPS) ff_vp9dsp_init_mips(dsp, bpp);
} | [
"av_cold void FUNC_0(VP9DSPContext *dsp, int bpp, int bitexact)\n{",
"if (bpp == 8) {",
"ff_vp9dsp_init_8(dsp);",
"} else if (bpp == 10) {",
"ff_vp9dsp_init_10(dsp);",
"} else {",
"av_assert0(bpp == 12);",
"ff_vp9dsp_init_12(dsp);",
"}",
"if (ARCH_X86) ff_vp9dsp_init_x86(dsp, bpp, bitexact);",
"if (ARCH_MIPS) ff_vp9dsp_init_mips(dsp, bpp);",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
24
],
[
26
],
[
28
]
] |
19,664 | FFAMediaCodec* ff_AMediaCodec_createCodecByName(const char *name)
{
JNIEnv *env = NULL;
FFAMediaCodec *codec = NULL;
jstring codec_name = NULL;
codec = av_mallocz(sizeof(FFAMediaCodec));
if (!codec) {
return NULL;
}
codec->class = &amediacodec_class;
env = ff_jni_get_env(codec);
if (!env) {
av_freep(&codec);
return NULL;
}
if (ff_jni_init_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec) < 0) {
goto fail;
}
codec_name = ff_jni_utf_chars_to_jstring(env, name, codec);
if (!codec_name) {
goto fail;
}
codec->object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_by_codec_name_id, codec_name);
if (ff_jni_exception_check(env, 1, codec) < 0) {
goto fail;
}
codec->object = (*env)->NewGlobalRef(env, codec->object);
if (!codec->object) {
goto fail;
}
if (codec_init_static_fields(codec) < 0) {
goto fail;
}
if (codec->jfields.get_input_buffer_id && codec->jfields.get_output_buffer_id) {
codec->has_get_i_o_buffer = 1;
}
return codec;
fail:
ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec);
if (codec_name) {
(*env)->DeleteLocalRef(env, codec_name);
}
av_freep(&codec);
return NULL;
}
| true | FFmpeg | 1795dccde0ad22fc8201142f92fb8d58c234f3e4 | FFAMediaCodec* ff_AMediaCodec_createCodecByName(const char *name)
{
JNIEnv *env = NULL;
FFAMediaCodec *codec = NULL;
jstring codec_name = NULL;
codec = av_mallocz(sizeof(FFAMediaCodec));
if (!codec) {
return NULL;
}
codec->class = &amediacodec_class;
env = ff_jni_get_env(codec);
if (!env) {
av_freep(&codec);
return NULL;
}
if (ff_jni_init_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec) < 0) {
goto fail;
}
codec_name = ff_jni_utf_chars_to_jstring(env, name, codec);
if (!codec_name) {
goto fail;
}
codec->object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_by_codec_name_id, codec_name);
if (ff_jni_exception_check(env, 1, codec) < 0) {
goto fail;
}
codec->object = (*env)->NewGlobalRef(env, codec->object);
if (!codec->object) {
goto fail;
}
if (codec_init_static_fields(codec) < 0) {
goto fail;
}
if (codec->jfields.get_input_buffer_id && codec->jfields.get_output_buffer_id) {
codec->has_get_i_o_buffer = 1;
}
return codec;
fail:
ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec);
if (codec_name) {
(*env)->DeleteLocalRef(env, codec_name);
}
av_freep(&codec);
return NULL;
}
| {
"code": [
" codec->object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_by_codec_name_id, codec_name);",
" codec->object = (*env)->NewGlobalRef(env, codec->object);",
" return codec;",
" ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec);",
" av_freep(&codec);",
" return NULL;",
" codec->object = (*env)->NewGlobalRef(env, codec->object);",
" return codec;",
" ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec);",
" av_freep(&codec);",
" return NULL;",
" codec->object = (*env)->NewGlobalRef(env, codec->object);",
" return codec;",
" ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec);",
" av_freep(&codec);",
" return NULL;"
],
"line_no": [
55,
65,
91,
95,
107,
111,
65,
91,
95,
107,
111,
65,
91,
95,
107,
111
]
} | FFAMediaCodec* FUNC_0(const char *name)
{
JNIEnv *env = NULL;
FFAMediaCodec *codec = NULL;
jstring codec_name = NULL;
codec = av_mallocz(sizeof(FFAMediaCodec));
if (!codec) {
return NULL;
}
codec->class = &amediacodec_class;
env = ff_jni_get_env(codec);
if (!env) {
av_freep(&codec);
return NULL;
}
if (ff_jni_init_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec) < 0) {
goto fail;
}
codec_name = ff_jni_utf_chars_to_jstring(env, name, codec);
if (!codec_name) {
goto fail;
}
codec->object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_by_codec_name_id, codec_name);
if (ff_jni_exception_check(env, 1, codec) < 0) {
goto fail;
}
codec->object = (*env)->NewGlobalRef(env, codec->object);
if (!codec->object) {
goto fail;
}
if (codec_init_static_fields(codec) < 0) {
goto fail;
}
if (codec->jfields.get_input_buffer_id && codec->jfields.get_output_buffer_id) {
codec->has_get_i_o_buffer = 1;
}
return codec;
fail:
ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec);
if (codec_name) {
(*env)->DeleteLocalRef(env, codec_name);
}
av_freep(&codec);
return NULL;
}
| [
"FFAMediaCodec* FUNC_0(const char *name)\n{",
"JNIEnv *env = NULL;",
"FFAMediaCodec *codec = NULL;",
"jstring codec_name = NULL;",
"codec = av_mallocz(sizeof(FFAMediaCodec));",
"if (!codec) {",
"return NULL;",
"}",
"codec->class = &amediacodec_class;",
"env = ff_jni_get_env(codec);",
"if (!env) {",
"av_freep(&codec);",
"return NULL;",
"}",
"if (ff_jni_init_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec) < 0) {",
"goto fail;",
"}",
"codec_name = ff_jni_utf_chars_to_jstring(env, name, codec);",
"if (!codec_name) {",
"goto fail;",
"}",
"codec->object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_by_codec_name_id, codec_name);",
"if (ff_jni_exception_check(env, 1, codec) < 0) {",
"goto fail;",
"}",
"codec->object = (*env)->NewGlobalRef(env, codec->object);",
"if (!codec->object) {",
"goto fail;",
"}",
"if (codec_init_static_fields(codec) < 0) {",
"goto fail;",
"}",
"if (codec->jfields.get_input_buffer_id && codec->jfields.get_output_buffer_id) {",
"codec->has_get_i_o_buffer = 1;",
"}",
"return codec;",
"fail:\nff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec);",
"if (codec_name) {",
"(*env)->DeleteLocalRef(env, codec_name);",
"}",
"av_freep(&codec);",
"return NULL;",
"}"
] | [
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,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
0,
0,
0,
1,
1,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
37
],
[
39
],
[
41
],
[
45
],
[
47
],
[
49
],
[
51
],
[
55
],
[
57
],
[
59
],
[
61
],
[
65
],
[
67
],
[
69
],
[
71
],
[
75
],
[
77
],
[
79
],
[
83
],
[
85
],
[
87
],
[
91
],
[
93,
95
],
[
99
],
[
101
],
[
103
],
[
107
],
[
111
],
[
113
]
] |
19,668 | void ide_drive_get(DriveInfo **hd, int max_bus)
{
int i;
if (drive_get_max_bus(IF_IDE) >= max_bus) {
fprintf(stderr, "qemu: too many IDE bus: %d\n", max_bus);
exit(1);
}
for(i = 0; i < max_bus * MAX_IDE_DEVS; i++) {
hd[i] = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS);
}
}
| true | qemu | d8f94e1bb275ab6a14a15220fd6afd0d04324aeb | void ide_drive_get(DriveInfo **hd, int max_bus)
{
int i;
if (drive_get_max_bus(IF_IDE) >= max_bus) {
fprintf(stderr, "qemu: too many IDE bus: %d\n", max_bus);
exit(1);
}
for(i = 0; i < max_bus * MAX_IDE_DEVS; i++) {
hd[i] = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS);
}
}
| {
"code": [
"void ide_drive_get(DriveInfo **hd, int max_bus)",
" if (drive_get_max_bus(IF_IDE) >= max_bus) {",
" fprintf(stderr, \"qemu: too many IDE bus: %d\\n\", max_bus);",
" for(i = 0; i < max_bus * MAX_IDE_DEVS; i++) {",
" hd[i] = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS);"
],
"line_no": [
1,
9,
11,
19,
21
]
} | void FUNC_0(DriveInfo **VAR_0, int VAR_1)
{
int VAR_2;
if (drive_get_max_bus(IF_IDE) >= VAR_1) {
fprintf(stderr, "qemu: too many IDE bus: %d\n", VAR_1);
exit(1);
}
for(VAR_2 = 0; VAR_2 < VAR_1 * MAX_IDE_DEVS; VAR_2++) {
VAR_0[VAR_2] = drive_get(IF_IDE, VAR_2 / MAX_IDE_DEVS, VAR_2 % MAX_IDE_DEVS);
}
}
| [
"void FUNC_0(DriveInfo **VAR_0, int VAR_1)\n{",
"int VAR_2;",
"if (drive_get_max_bus(IF_IDE) >= VAR_1) {",
"fprintf(stderr, \"qemu: too many IDE bus: %d\\n\", VAR_1);",
"exit(1);",
"}",
"for(VAR_2 = 0; VAR_2 < VAR_1 * MAX_IDE_DEVS; VAR_2++) {",
"VAR_0[VAR_2] = drive_get(IF_IDE, VAR_2 / MAX_IDE_DEVS, VAR_2 % MAX_IDE_DEVS);",
"}",
"}"
] | [
1,
0,
1,
1,
0,
0,
1,
1,
0,
0
] | [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23
],
[
25
]
] |
19,669 | static void release_keys(void *opaque)
{
int i;
for (i = 0; i < keycodes_size; i++) {
if (keycodes[i] & 0x80) {
kbd_put_keycode(0xe0);
}
kbd_put_keycode(keycodes[i]| 0x80);
}
free_keycodes();
}
| true | qemu | 153d02e338a063ad5c51ff0725d5d88285f44121 | static void release_keys(void *opaque)
{
int i;
for (i = 0; i < keycodes_size; i++) {
if (keycodes[i] & 0x80) {
kbd_put_keycode(0xe0);
}
kbd_put_keycode(keycodes[i]| 0x80);
}
free_keycodes();
}
| {
"code": [
" int i;",
" for (i = 0; i < keycodes_size; i++) {",
" if (keycodes[i] & 0x80) {",
" kbd_put_keycode(keycodes[i]| 0x80);"
],
"line_no": [
5,
9,
11,
17
]
} | static void FUNC_0(void *VAR_0)
{
int VAR_1;
for (VAR_1 = 0; VAR_1 < keycodes_size; VAR_1++) {
if (keycodes[VAR_1] & 0x80) {
kbd_put_keycode(0xe0);
}
kbd_put_keycode(keycodes[VAR_1]| 0x80);
}
free_keycodes();
}
| [
"static void FUNC_0(void *VAR_0)\n{",
"int VAR_1;",
"for (VAR_1 = 0; VAR_1 < keycodes_size; VAR_1++) {",
"if (keycodes[VAR_1] & 0x80) {",
"kbd_put_keycode(0xe0);",
"}",
"kbd_put_keycode(keycodes[VAR_1]| 0x80);",
"}",
"free_keycodes();",
"}"
] | [
0,
1,
1,
1,
0,
0,
1,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25
]
] |
19,670 | static int mace6_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
const uint8_t *buf, int buf_size)
{
int16_t *samples = data;
MACEContext *ctx = avctx->priv_data;
int i, j;
for(i = 0; i < avctx->channels; i++) {
int16_t *output = samples + i;
for (j = 0; j < buf_size / avctx->channels; j++) {
uint8_t pkt = buf[i + j*avctx->channels];
chomp6(&ctx->chd[i], output, pkt >> 5 , MACEtab1, MACEtab2,
8, avctx->channels);
output += avctx->channels << 1;
chomp6(&ctx->chd[i], output,(pkt >> 3) & 3, MACEtab3, MACEtab4,
4, avctx->channels);
output += avctx->channels << 1;
chomp6(&ctx->chd[i], output, pkt & 7, MACEtab1, MACEtab2,
8, avctx->channels);
output += avctx->channels << 1;
}
}
*data_size = 2 * 6 * buf_size;
return buf_size;
}
| true | FFmpeg | f36aec3b5e18c4c167612d0051a6d5b6144b3552 | static int mace6_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
const uint8_t *buf, int buf_size)
{
int16_t *samples = data;
MACEContext *ctx = avctx->priv_data;
int i, j;
for(i = 0; i < avctx->channels; i++) {
int16_t *output = samples + i;
for (j = 0; j < buf_size / avctx->channels; j++) {
uint8_t pkt = buf[i + j*avctx->channels];
chomp6(&ctx->chd[i], output, pkt >> 5 , MACEtab1, MACEtab2,
8, avctx->channels);
output += avctx->channels << 1;
chomp6(&ctx->chd[i], output,(pkt >> 3) & 3, MACEtab3, MACEtab4,
4, avctx->channels);
output += avctx->channels << 1;
chomp6(&ctx->chd[i], output, pkt & 7, MACEtab1, MACEtab2,
8, avctx->channels);
output += avctx->channels << 1;
}
}
*data_size = 2 * 6 * buf_size;
return buf_size;
}
| {
"code": [
" 8, avctx->channels);",
" 4, avctx->channels);",
" 8, avctx->channels);"
],
"line_no": [
31,
37,
31
]
} | static int FUNC_0(AVCodecContext *VAR_0,
void *VAR_1, int *VAR_2,
const uint8_t *VAR_3, int VAR_4)
{
int16_t *samples = VAR_1;
MACEContext *ctx = VAR_0->priv_data;
int VAR_5, VAR_6;
for(VAR_5 = 0; VAR_5 < VAR_0->channels; VAR_5++) {
int16_t *output = samples + VAR_5;
for (VAR_6 = 0; VAR_6 < VAR_4 / VAR_0->channels; VAR_6++) {
uint8_t pkt = VAR_3[VAR_5 + VAR_6*VAR_0->channels];
chomp6(&ctx->chd[VAR_5], output, pkt >> 5 , MACEtab1, MACEtab2,
8, VAR_0->channels);
output += VAR_0->channels << 1;
chomp6(&ctx->chd[VAR_5], output,(pkt >> 3) & 3, MACEtab3, MACEtab4,
4, VAR_0->channels);
output += VAR_0->channels << 1;
chomp6(&ctx->chd[VAR_5], output, pkt & 7, MACEtab1, MACEtab2,
8, VAR_0->channels);
output += VAR_0->channels << 1;
}
}
*VAR_2 = 2 * 6 * VAR_4;
return VAR_4;
}
| [
"static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nconst uint8_t *VAR_3, int VAR_4)\n{",
"int16_t *samples = VAR_1;",
"MACEContext *ctx = VAR_0->priv_data;",
"int VAR_5, VAR_6;",
"for(VAR_5 = 0; VAR_5 < VAR_0->channels; VAR_5++) {",
"int16_t *output = samples + VAR_5;",
"for (VAR_6 = 0; VAR_6 < VAR_4 / VAR_0->channels; VAR_6++) {",
"uint8_t pkt = VAR_3[VAR_5 + VAR_6*VAR_0->channels];",
"chomp6(&ctx->chd[VAR_5], output, pkt >> 5 , MACEtab1, MACEtab2,\n8, VAR_0->channels);",
"output += VAR_0->channels << 1;",
"chomp6(&ctx->chd[VAR_5], output,(pkt >> 3) & 3, MACEtab3, MACEtab4,\n4, VAR_0->channels);",
"output += VAR_0->channels << 1;",
"chomp6(&ctx->chd[VAR_5], output, pkt & 7, MACEtab1, MACEtab2,\n8, VAR_0->channels);",
"output += VAR_0->channels << 1;",
"}",
"}",
"*VAR_2 = 2 * 6 * VAR_4;",
"return VAR_4;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5,
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
19
],
[
23
],
[
25
],
[
29,
31
],
[
33
],
[
35,
37
],
[
39
],
[
41,
43
],
[
45
],
[
47
],
[
49
],
[
53
],
[
57
],
[
59
]
] |
19,671 | static void new_video_stream(AVFormatContext *oc)
{
AVStream *st;
AVCodecContext *video_enc;
enum CodecID codec_id;
AVCodec *codec= NULL;
st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0);
if (!st) {
fprintf(stderr, "Could not alloc stream\n");
ffmpeg_exit(1);
}
output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1);
if(!video_stream_copy){
if (video_codec_name) {
codec_id = find_codec_or_die(video_codec_name, AVMEDIA_TYPE_VIDEO, 1,
avcodec_opts[AVMEDIA_TYPE_VIDEO]->strict_std_compliance);
codec = avcodec_find_encoder_by_name(video_codec_name);
output_codecs[nb_output_codecs-1] = codec;
} else {
codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_VIDEO);
codec = avcodec_find_encoder(codec_id);
}
}
avcodec_get_context_defaults3(st->codec, codec);
bitstream_filters[nb_output_files] =
grow_array(bitstream_filters[nb_output_files],
sizeof(*bitstream_filters[nb_output_files]),
&nb_bitstream_filters[nb_output_files], oc->nb_streams);
bitstream_filters[nb_output_files][oc->nb_streams - 1]= video_bitstream_filters;
video_bitstream_filters= NULL;
avcodec_thread_init(st->codec, thread_count);
video_enc = st->codec;
if(video_codec_tag)
video_enc->codec_tag= video_codec_tag;
if( (video_global_header&1)
|| (video_global_header==0 && (oc->oformat->flags & AVFMT_GLOBALHEADER))){
video_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags|= CODEC_FLAG_GLOBAL_HEADER;
}
if(video_global_header&2){
video_enc->flags2 |= CODEC_FLAG2_LOCAL_HEADER;
avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags2|= CODEC_FLAG2_LOCAL_HEADER;
}
if (video_stream_copy) {
st->stream_copy = 1;
video_enc->codec_type = AVMEDIA_TYPE_VIDEO;
video_enc->sample_aspect_ratio =
st->sample_aspect_ratio = av_d2q(frame_aspect_ratio*frame_height/frame_width, 255);
} else {
const char *p;
int i;
AVRational fps= frame_rate.num ? frame_rate : (AVRational){25,1};
video_enc->codec_id = codec_id;
set_context_opts(video_enc, avcodec_opts[AVMEDIA_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, codec);
if (codec && codec->supported_framerates && !force_fps)
fps = codec->supported_framerates[av_find_nearest_q_idx(fps, codec->supported_framerates)];
video_enc->time_base.den = fps.num;
video_enc->time_base.num = fps.den;
video_enc->width = frame_width;
video_enc->height = frame_height;
video_enc->sample_aspect_ratio = av_d2q(frame_aspect_ratio*video_enc->height/video_enc->width, 255);
video_enc->pix_fmt = frame_pix_fmt;
st->sample_aspect_ratio = video_enc->sample_aspect_ratio;
choose_pixel_fmt(st, codec);
if (intra_only)
video_enc->gop_size = 0;
if (video_qscale || same_quality) {
video_enc->flags |= CODEC_FLAG_QSCALE;
video_enc->global_quality=
st->quality = FF_QP2LAMBDA * video_qscale;
}
if(intra_matrix)
video_enc->intra_matrix = intra_matrix;
if(inter_matrix)
video_enc->inter_matrix = inter_matrix;
p= video_rc_override_string;
for(i=0; p; i++){
int start, end, q;
int e=sscanf(p, "%d,%d,%d", &start, &end, &q);
if(e!=3){
fprintf(stderr, "error parsing rc_override\n");
ffmpeg_exit(1);
}
video_enc->rc_override=
av_realloc(video_enc->rc_override,
sizeof(RcOverride)*(i+1));
video_enc->rc_override[i].start_frame= start;
video_enc->rc_override[i].end_frame = end;
if(q>0){
video_enc->rc_override[i].qscale= q;
video_enc->rc_override[i].quality_factor= 1.0;
}
else{
video_enc->rc_override[i].qscale= 0;
video_enc->rc_override[i].quality_factor= -q/100.0;
}
p= strchr(p, '/');
if(p) p++;
}
video_enc->rc_override_count=i;
if (!video_enc->rc_initial_buffer_occupancy)
video_enc->rc_initial_buffer_occupancy = video_enc->rc_buffer_size*3/4;
video_enc->me_threshold= me_threshold;
video_enc->intra_dc_precision= intra_dc_precision - 8;
if (do_psnr)
video_enc->flags|= CODEC_FLAG_PSNR;
/* two pass mode */
if (do_pass) {
if (do_pass == 1) {
video_enc->flags |= CODEC_FLAG_PASS1;
} else {
video_enc->flags |= CODEC_FLAG_PASS2;
}
}
}
if (video_language) {
av_metadata_set2(&st->metadata, "language", video_language, 0);
av_freep(&video_language);
}
/* reset some key parameters */
video_disable = 0;
av_freep(&video_codec_name);
video_stream_copy = 0;
frame_pix_fmt = PIX_FMT_NONE;
}
| true | FFmpeg | ca8064d2d1b293d7a8011bf0a08005c11ae8ba67 | static void new_video_stream(AVFormatContext *oc)
{
AVStream *st;
AVCodecContext *video_enc;
enum CodecID codec_id;
AVCodec *codec= NULL;
st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0);
if (!st) {
fprintf(stderr, "Could not alloc stream\n");
ffmpeg_exit(1);
}
output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1);
if(!video_stream_copy){
if (video_codec_name) {
codec_id = find_codec_or_die(video_codec_name, AVMEDIA_TYPE_VIDEO, 1,
avcodec_opts[AVMEDIA_TYPE_VIDEO]->strict_std_compliance);
codec = avcodec_find_encoder_by_name(video_codec_name);
output_codecs[nb_output_codecs-1] = codec;
} else {
codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_VIDEO);
codec = avcodec_find_encoder(codec_id);
}
}
avcodec_get_context_defaults3(st->codec, codec);
bitstream_filters[nb_output_files] =
grow_array(bitstream_filters[nb_output_files],
sizeof(*bitstream_filters[nb_output_files]),
&nb_bitstream_filters[nb_output_files], oc->nb_streams);
bitstream_filters[nb_output_files][oc->nb_streams - 1]= video_bitstream_filters;
video_bitstream_filters= NULL;
avcodec_thread_init(st->codec, thread_count);
video_enc = st->codec;
if(video_codec_tag)
video_enc->codec_tag= video_codec_tag;
if( (video_global_header&1)
|| (video_global_header==0 && (oc->oformat->flags & AVFMT_GLOBALHEADER))){
video_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags|= CODEC_FLAG_GLOBAL_HEADER;
}
if(video_global_header&2){
video_enc->flags2 |= CODEC_FLAG2_LOCAL_HEADER;
avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags2|= CODEC_FLAG2_LOCAL_HEADER;
}
if (video_stream_copy) {
st->stream_copy = 1;
video_enc->codec_type = AVMEDIA_TYPE_VIDEO;
video_enc->sample_aspect_ratio =
st->sample_aspect_ratio = av_d2q(frame_aspect_ratio*frame_height/frame_width, 255);
} else {
const char *p;
int i;
AVRational fps= frame_rate.num ? frame_rate : (AVRational){25,1};
video_enc->codec_id = codec_id;
set_context_opts(video_enc, avcodec_opts[AVMEDIA_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, codec);
if (codec && codec->supported_framerates && !force_fps)
fps = codec->supported_framerates[av_find_nearest_q_idx(fps, codec->supported_framerates)];
video_enc->time_base.den = fps.num;
video_enc->time_base.num = fps.den;
video_enc->width = frame_width;
video_enc->height = frame_height;
video_enc->sample_aspect_ratio = av_d2q(frame_aspect_ratio*video_enc->height/video_enc->width, 255);
video_enc->pix_fmt = frame_pix_fmt;
st->sample_aspect_ratio = video_enc->sample_aspect_ratio;
choose_pixel_fmt(st, codec);
if (intra_only)
video_enc->gop_size = 0;
if (video_qscale || same_quality) {
video_enc->flags |= CODEC_FLAG_QSCALE;
video_enc->global_quality=
st->quality = FF_QP2LAMBDA * video_qscale;
}
if(intra_matrix)
video_enc->intra_matrix = intra_matrix;
if(inter_matrix)
video_enc->inter_matrix = inter_matrix;
p= video_rc_override_string;
for(i=0; p; i++){
int start, end, q;
int e=sscanf(p, "%d,%d,%d", &start, &end, &q);
if(e!=3){
fprintf(stderr, "error parsing rc_override\n");
ffmpeg_exit(1);
}
video_enc->rc_override=
av_realloc(video_enc->rc_override,
sizeof(RcOverride)*(i+1));
video_enc->rc_override[i].start_frame= start;
video_enc->rc_override[i].end_frame = end;
if(q>0){
video_enc->rc_override[i].qscale= q;
video_enc->rc_override[i].quality_factor= 1.0;
}
else{
video_enc->rc_override[i].qscale= 0;
video_enc->rc_override[i].quality_factor= -q/100.0;
}
p= strchr(p, '/');
if(p) p++;
}
video_enc->rc_override_count=i;
if (!video_enc->rc_initial_buffer_occupancy)
video_enc->rc_initial_buffer_occupancy = video_enc->rc_buffer_size*3/4;
video_enc->me_threshold= me_threshold;
video_enc->intra_dc_precision= intra_dc_precision - 8;
if (do_psnr)
video_enc->flags|= CODEC_FLAG_PSNR;
if (do_pass) {
if (do_pass == 1) {
video_enc->flags |= CODEC_FLAG_PASS1;
} else {
video_enc->flags |= CODEC_FLAG_PASS2;
}
}
}
if (video_language) {
av_metadata_set2(&st->metadata, "language", video_language, 0);
av_freep(&video_language);
}
video_disable = 0;
av_freep(&video_codec_name);
video_stream_copy = 0;
frame_pix_fmt = PIX_FMT_NONE;
}
| {
"code": [
"static void new_video_stream(AVFormatContext *oc)",
" bitstream_filters[nb_output_files] =",
" grow_array(bitstream_filters[nb_output_files],",
" sizeof(*bitstream_filters[nb_output_files]),",
" &nb_bitstream_filters[nb_output_files], oc->nb_streams);",
" bitstream_filters[nb_output_files][oc->nb_streams - 1]= video_bitstream_filters;",
" bitstream_filters[nb_output_files] =",
" grow_array(bitstream_filters[nb_output_files],",
" sizeof(*bitstream_filters[nb_output_files]),",
" &nb_bitstream_filters[nb_output_files], oc->nb_streams);",
" bitstream_filters[nb_output_files] =",
" grow_array(bitstream_filters[nb_output_files],",
" sizeof(*bitstream_filters[nb_output_files]),",
" &nb_bitstream_filters[nb_output_files], oc->nb_streams);"
],
"line_no": [
1,
55,
57,
59,
61,
63,
55,
57,
59,
61,
55,
57,
59,
61
]
} | static void FUNC_0(AVFormatContext *VAR_0)
{
AVStream *st;
AVCodecContext *video_enc;
enum CodecID VAR_1;
AVCodec *codec= NULL;
st = av_new_stream(VAR_0, VAR_0->nb_streams < nb_streamid_map ? streamid_map[VAR_0->nb_streams] : 0);
if (!st) {
fprintf(stderr, "Could not alloc stream\n");
ffmpeg_exit(1);
}
output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1);
if(!video_stream_copy){
if (video_codec_name) {
VAR_1 = find_codec_or_die(video_codec_name, AVMEDIA_TYPE_VIDEO, 1,
avcodec_opts[AVMEDIA_TYPE_VIDEO]->strict_std_compliance);
codec = avcodec_find_encoder_by_name(video_codec_name);
output_codecs[nb_output_codecs-1] = codec;
} else {
VAR_1 = av_guess_codec(VAR_0->oformat, NULL, VAR_0->filename, NULL, AVMEDIA_TYPE_VIDEO);
codec = avcodec_find_encoder(VAR_1);
}
}
avcodec_get_context_defaults3(st->codec, codec);
bitstream_filters[nb_output_files] =
grow_array(bitstream_filters[nb_output_files],
sizeof(*bitstream_filters[nb_output_files]),
&nb_bitstream_filters[nb_output_files], VAR_0->nb_streams);
bitstream_filters[nb_output_files][VAR_0->nb_streams - 1]= video_bitstream_filters;
video_bitstream_filters= NULL;
avcodec_thread_init(st->codec, thread_count);
video_enc = st->codec;
if(video_codec_tag)
video_enc->codec_tag= video_codec_tag;
if( (video_global_header&1)
|| (video_global_header==0 && (VAR_0->oformat->flags & AVFMT_GLOBALHEADER))){
video_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags|= CODEC_FLAG_GLOBAL_HEADER;
}
if(video_global_header&2){
video_enc->flags2 |= CODEC_FLAG2_LOCAL_HEADER;
avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags2|= CODEC_FLAG2_LOCAL_HEADER;
}
if (video_stream_copy) {
st->stream_copy = 1;
video_enc->codec_type = AVMEDIA_TYPE_VIDEO;
video_enc->sample_aspect_ratio =
st->sample_aspect_ratio = av_d2q(frame_aspect_ratio*frame_height/frame_width, 255);
} else {
const char *VAR_2;
int VAR_3;
AVRational fps= frame_rate.num ? frame_rate : (AVRational){25,1};
video_enc->VAR_1 = VAR_1;
set_context_opts(video_enc, avcodec_opts[AVMEDIA_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, codec);
if (codec && codec->supported_framerates && !force_fps)
fps = codec->supported_framerates[av_find_nearest_q_idx(fps, codec->supported_framerates)];
video_enc->time_base.den = fps.num;
video_enc->time_base.num = fps.den;
video_enc->width = frame_width;
video_enc->height = frame_height;
video_enc->sample_aspect_ratio = av_d2q(frame_aspect_ratio*video_enc->height/video_enc->width, 255);
video_enc->pix_fmt = frame_pix_fmt;
st->sample_aspect_ratio = video_enc->sample_aspect_ratio;
choose_pixel_fmt(st, codec);
if (intra_only)
video_enc->gop_size = 0;
if (video_qscale || same_quality) {
video_enc->flags |= CODEC_FLAG_QSCALE;
video_enc->global_quality=
st->quality = FF_QP2LAMBDA * video_qscale;
}
if(intra_matrix)
video_enc->intra_matrix = intra_matrix;
if(inter_matrix)
video_enc->inter_matrix = inter_matrix;
VAR_2= video_rc_override_string;
for(VAR_3=0; VAR_2; VAR_3++){
int VAR_4, VAR_5, VAR_6;
int VAR_7=sscanf(VAR_2, "%d,%d,%d", &VAR_4, &VAR_5, &VAR_6);
if(VAR_7!=3){
fprintf(stderr, "error parsing rc_override\n");
ffmpeg_exit(1);
}
video_enc->rc_override=
av_realloc(video_enc->rc_override,
sizeof(RcOverride)*(VAR_3+1));
video_enc->rc_override[VAR_3].start_frame= VAR_4;
video_enc->rc_override[VAR_3].end_frame = VAR_5;
if(VAR_6>0){
video_enc->rc_override[VAR_3].qscale= VAR_6;
video_enc->rc_override[VAR_3].quality_factor= 1.0;
}
else{
video_enc->rc_override[VAR_3].qscale= 0;
video_enc->rc_override[VAR_3].quality_factor= -VAR_6/100.0;
}
VAR_2= strchr(VAR_2, '/');
if(VAR_2) VAR_2++;
}
video_enc->rc_override_count=VAR_3;
if (!video_enc->rc_initial_buffer_occupancy)
video_enc->rc_initial_buffer_occupancy = video_enc->rc_buffer_size*3/4;
video_enc->me_threshold= me_threshold;
video_enc->intra_dc_precision= intra_dc_precision - 8;
if (do_psnr)
video_enc->flags|= CODEC_FLAG_PSNR;
if (do_pass) {
if (do_pass == 1) {
video_enc->flags |= CODEC_FLAG_PASS1;
} else {
video_enc->flags |= CODEC_FLAG_PASS2;
}
}
}
if (video_language) {
av_metadata_set2(&st->metadata, "language", video_language, 0);
av_freep(&video_language);
}
video_disable = 0;
av_freep(&video_codec_name);
video_stream_copy = 0;
frame_pix_fmt = PIX_FMT_NONE;
}
| [
"static void FUNC_0(AVFormatContext *VAR_0)\n{",
"AVStream *st;",
"AVCodecContext *video_enc;",
"enum CodecID VAR_1;",
"AVCodec *codec= NULL;",
"st = av_new_stream(VAR_0, VAR_0->nb_streams < nb_streamid_map ? streamid_map[VAR_0->nb_streams] : 0);",
"if (!st) {",
"fprintf(stderr, \"Could not alloc stream\\n\");",
"ffmpeg_exit(1);",
"}",
"output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1);",
"if(!video_stream_copy){",
"if (video_codec_name) {",
"VAR_1 = find_codec_or_die(video_codec_name, AVMEDIA_TYPE_VIDEO, 1,\navcodec_opts[AVMEDIA_TYPE_VIDEO]->strict_std_compliance);",
"codec = avcodec_find_encoder_by_name(video_codec_name);",
"output_codecs[nb_output_codecs-1] = codec;",
"} else {",
"VAR_1 = av_guess_codec(VAR_0->oformat, NULL, VAR_0->filename, NULL, AVMEDIA_TYPE_VIDEO);",
"codec = avcodec_find_encoder(VAR_1);",
"}",
"}",
"avcodec_get_context_defaults3(st->codec, codec);",
"bitstream_filters[nb_output_files] =\ngrow_array(bitstream_filters[nb_output_files],\nsizeof(*bitstream_filters[nb_output_files]),\n&nb_bitstream_filters[nb_output_files], VAR_0->nb_streams);",
"bitstream_filters[nb_output_files][VAR_0->nb_streams - 1]= video_bitstream_filters;",
"video_bitstream_filters= NULL;",
"avcodec_thread_init(st->codec, thread_count);",
"video_enc = st->codec;",
"if(video_codec_tag)\nvideo_enc->codec_tag= video_codec_tag;",
"if( (video_global_header&1)\n|| (video_global_header==0 && (VAR_0->oformat->flags & AVFMT_GLOBALHEADER))){",
"video_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;",
"avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags|= CODEC_FLAG_GLOBAL_HEADER;",
"}",
"if(video_global_header&2){",
"video_enc->flags2 |= CODEC_FLAG2_LOCAL_HEADER;",
"avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags2|= CODEC_FLAG2_LOCAL_HEADER;",
"}",
"if (video_stream_copy) {",
"st->stream_copy = 1;",
"video_enc->codec_type = AVMEDIA_TYPE_VIDEO;",
"video_enc->sample_aspect_ratio =\nst->sample_aspect_ratio = av_d2q(frame_aspect_ratio*frame_height/frame_width, 255);",
"} else {",
"const char *VAR_2;",
"int VAR_3;",
"AVRational fps= frame_rate.num ? frame_rate : (AVRational){25,1};",
"video_enc->VAR_1 = VAR_1;",
"set_context_opts(video_enc, avcodec_opts[AVMEDIA_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, codec);",
"if (codec && codec->supported_framerates && !force_fps)\nfps = codec->supported_framerates[av_find_nearest_q_idx(fps, codec->supported_framerates)];",
"video_enc->time_base.den = fps.num;",
"video_enc->time_base.num = fps.den;",
"video_enc->width = frame_width;",
"video_enc->height = frame_height;",
"video_enc->sample_aspect_ratio = av_d2q(frame_aspect_ratio*video_enc->height/video_enc->width, 255);",
"video_enc->pix_fmt = frame_pix_fmt;",
"st->sample_aspect_ratio = video_enc->sample_aspect_ratio;",
"choose_pixel_fmt(st, codec);",
"if (intra_only)\nvideo_enc->gop_size = 0;",
"if (video_qscale || same_quality) {",
"video_enc->flags |= CODEC_FLAG_QSCALE;",
"video_enc->global_quality=\nst->quality = FF_QP2LAMBDA * video_qscale;",
"}",
"if(intra_matrix)\nvideo_enc->intra_matrix = intra_matrix;",
"if(inter_matrix)\nvideo_enc->inter_matrix = inter_matrix;",
"VAR_2= video_rc_override_string;",
"for(VAR_3=0; VAR_2; VAR_3++){",
"int VAR_4, VAR_5, VAR_6;",
"int VAR_7=sscanf(VAR_2, \"%d,%d,%d\", &VAR_4, &VAR_5, &VAR_6);",
"if(VAR_7!=3){",
"fprintf(stderr, \"error parsing rc_override\\n\");",
"ffmpeg_exit(1);",
"}",
"video_enc->rc_override=\nav_realloc(video_enc->rc_override,\nsizeof(RcOverride)*(VAR_3+1));",
"video_enc->rc_override[VAR_3].start_frame= VAR_4;",
"video_enc->rc_override[VAR_3].end_frame = VAR_5;",
"if(VAR_6>0){",
"video_enc->rc_override[VAR_3].qscale= VAR_6;",
"video_enc->rc_override[VAR_3].quality_factor= 1.0;",
"}",
"else{",
"video_enc->rc_override[VAR_3].qscale= 0;",
"video_enc->rc_override[VAR_3].quality_factor= -VAR_6/100.0;",
"}",
"VAR_2= strchr(VAR_2, '/');",
"if(VAR_2) VAR_2++;",
"}",
"video_enc->rc_override_count=VAR_3;",
"if (!video_enc->rc_initial_buffer_occupancy)\nvideo_enc->rc_initial_buffer_occupancy = video_enc->rc_buffer_size*3/4;",
"video_enc->me_threshold= me_threshold;",
"video_enc->intra_dc_precision= intra_dc_precision - 8;",
"if (do_psnr)\nvideo_enc->flags|= CODEC_FLAG_PSNR;",
"if (do_pass) {",
"if (do_pass == 1) {",
"video_enc->flags |= CODEC_FLAG_PASS1;",
"} else {",
"video_enc->flags |= CODEC_FLAG_PASS2;",
"}",
"}",
"}",
"if (video_language) {",
"av_metadata_set2(&st->metadata, \"language\", video_language, 0);",
"av_freep(&video_language);",
"}",
"video_disable = 0;",
"av_freep(&video_codec_name);",
"video_stream_copy = 0;",
"frame_pix_fmt = PIX_FMT_NONE;",
"}"
] | [
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
27
],
[
29
],
[
31
],
[
33,
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
53
],
[
55,
57,
59,
61
],
[
63
],
[
65
],
[
69
],
[
73
],
[
77,
79
],
[
83,
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
103
],
[
105
],
[
107
],
[
109,
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
123
],
[
125
],
[
129,
131
],
[
133
],
[
135
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
151
],
[
155,
157
],
[
159
],
[
161
],
[
163,
165
],
[
167
],
[
171,
173
],
[
175,
177
],
[
181
],
[
183
],
[
185
],
[
187
],
[
189
],
[
191
],
[
193
],
[
195
],
[
197,
199,
201
],
[
203
],
[
205
],
[
207
],
[
209
],
[
211
],
[
213
],
[
215
],
[
217
],
[
219
],
[
221
],
[
223
],
[
225
],
[
227
],
[
229
],
[
231,
233
],
[
235
],
[
237
],
[
241,
243
],
[
249
],
[
251
],
[
253
],
[
255
],
[
257
],
[
259
],
[
261
],
[
263
],
[
265
],
[
267
],
[
269
],
[
271
],
[
277
],
[
279
],
[
281
],
[
283
],
[
285
]
] |
19,672 | void visit_start_implicit_struct(Visitor *v, void **obj, size_t size,
Error **errp)
{
if (!error_is_set(errp) && v->start_implicit_struct) {
v->start_implicit_struct(v, obj, size, errp);
}
}
| true | qemu | 297a3646c2947ee64a6d42ca264039732c6218e0 | void visit_start_implicit_struct(Visitor *v, void **obj, size_t size,
Error **errp)
{
if (!error_is_set(errp) && v->start_implicit_struct) {
v->start_implicit_struct(v, obj, size, errp);
}
}
| {
"code": [
" if (!error_is_set(errp) && v->start_implicit_struct) {"
],
"line_no": [
7
]
} | void FUNC_0(Visitor *VAR_0, void **VAR_1, size_t VAR_2,
Error **VAR_3)
{
if (!error_is_set(VAR_3) && VAR_0->start_implicit_struct) {
VAR_0->start_implicit_struct(VAR_0, VAR_1, VAR_2, VAR_3);
}
}
| [
"void FUNC_0(Visitor *VAR_0, void **VAR_1, size_t VAR_2,\nError **VAR_3)\n{",
"if (!error_is_set(VAR_3) && VAR_0->start_implicit_struct) {",
"VAR_0->start_implicit_struct(VAR_0, VAR_1, VAR_2, VAR_3);",
"}",
"}"
] | [
0,
1,
0,
0,
0
] | [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
]
] |
19,673 | static int multiwrite_f(int argc, char **argv)
{
struct timeval t1, t2;
int Cflag = 0, qflag = 0;
int c, cnt;
char **buf;
int64_t offset, first_offset = 0;
/* Some compilers get confused and warn if this is not initialized. */
int total = 0;
int nr_iov;
int nr_reqs;
int pattern = 0xcd;
QEMUIOVector *qiovs;
int i;
BlockRequest *reqs;
while ((c = getopt(argc, argv, "CqP:")) != EOF) {
switch (c) {
case 'C':
Cflag = 1;
break;
case 'q':
qflag = 1;
break;
case 'P':
pattern = parse_pattern(optarg);
if (pattern < 0) {
return 0;
}
break;
default:
return command_usage(&writev_cmd);
}
}
if (optind > argc - 2) {
return command_usage(&writev_cmd);
}
nr_reqs = 1;
for (i = optind; i < argc; i++) {
if (!strcmp(argv[i], ";")) {
nr_reqs++;
}
}
reqs = g_malloc0(nr_reqs * sizeof(*reqs));
buf = g_malloc0(nr_reqs * sizeof(*buf));
qiovs = g_malloc(nr_reqs * sizeof(*qiovs));
for (i = 0; i < nr_reqs; i++) {
int j;
/* Read the offset of the request */
offset = cvtnum(argv[optind]);
if (offset < 0) {
printf("non-numeric offset argument -- %s\n", argv[optind]);
return 0;
}
optind++;
if (offset & 0x1ff) {
printf("offset %lld is not sector aligned\n",
(long long)offset);
return 0;
}
if (i == 0) {
first_offset = offset;
}
/* Read lengths for qiov entries */
for (j = optind; j < argc; j++) {
if (!strcmp(argv[j], ";")) {
break;
}
}
nr_iov = j - optind;
/* Build request */
buf[i] = create_iovec(&qiovs[i], &argv[optind], nr_iov, pattern);
if (buf[i] == NULL) {
goto out;
}
reqs[i].qiov = &qiovs[i];
reqs[i].sector = offset >> 9;
reqs[i].nb_sectors = reqs[i].qiov->size >> 9;
optind = j + 1;
pattern++;
}
gettimeofday(&t1, NULL);
cnt = do_aio_multiwrite(reqs, nr_reqs, &total);
gettimeofday(&t2, NULL);
if (cnt < 0) {
printf("aio_multiwrite failed: %s\n", strerror(-cnt));
goto out;
}
if (qflag) {
goto out;
}
/* Finally, report back -- -C gives a parsable format */
t2 = tsub(t2, t1);
print_report("wrote", &t2, first_offset, total, total, cnt, Cflag);
out:
for (i = 0; i < nr_reqs; i++) {
qemu_io_free(buf[i]);
if (reqs[i].qiov != NULL) {
qemu_iovec_destroy(&qiovs[i]);
}
}
g_free(buf);
g_free(reqs);
g_free(qiovs);
return 0;
}
| true | qemu | 67403dbba76fb294fb3a2317227f4b77037145cc | static int multiwrite_f(int argc, char **argv)
{
struct timeval t1, t2;
int Cflag = 0, qflag = 0;
int c, cnt;
char **buf;
int64_t offset, first_offset = 0;
int total = 0;
int nr_iov;
int nr_reqs;
int pattern = 0xcd;
QEMUIOVector *qiovs;
int i;
BlockRequest *reqs;
while ((c = getopt(argc, argv, "CqP:")) != EOF) {
switch (c) {
case 'C':
Cflag = 1;
break;
case 'q':
qflag = 1;
break;
case 'P':
pattern = parse_pattern(optarg);
if (pattern < 0) {
return 0;
}
break;
default:
return command_usage(&writev_cmd);
}
}
if (optind > argc - 2) {
return command_usage(&writev_cmd);
}
nr_reqs = 1;
for (i = optind; i < argc; i++) {
if (!strcmp(argv[i], ";")) {
nr_reqs++;
}
}
reqs = g_malloc0(nr_reqs * sizeof(*reqs));
buf = g_malloc0(nr_reqs * sizeof(*buf));
qiovs = g_malloc(nr_reqs * sizeof(*qiovs));
for (i = 0; i < nr_reqs; i++) {
int j;
offset = cvtnum(argv[optind]);
if (offset < 0) {
printf("non-numeric offset argument -- %s\n", argv[optind]);
return 0;
}
optind++;
if (offset & 0x1ff) {
printf("offset %lld is not sector aligned\n",
(long long)offset);
return 0;
}
if (i == 0) {
first_offset = offset;
}
for (j = optind; j < argc; j++) {
if (!strcmp(argv[j], ";")) {
break;
}
}
nr_iov = j - optind;
buf[i] = create_iovec(&qiovs[i], &argv[optind], nr_iov, pattern);
if (buf[i] == NULL) {
goto out;
}
reqs[i].qiov = &qiovs[i];
reqs[i].sector = offset >> 9;
reqs[i].nb_sectors = reqs[i].qiov->size >> 9;
optind = j + 1;
pattern++;
}
gettimeofday(&t1, NULL);
cnt = do_aio_multiwrite(reqs, nr_reqs, &total);
gettimeofday(&t2, NULL);
if (cnt < 0) {
printf("aio_multiwrite failed: %s\n", strerror(-cnt));
goto out;
}
if (qflag) {
goto out;
}
t2 = tsub(t2, t1);
print_report("wrote", &t2, first_offset, total, total, cnt, Cflag);
out:
for (i = 0; i < nr_reqs; i++) {
qemu_io_free(buf[i]);
if (reqs[i].qiov != NULL) {
qemu_iovec_destroy(&qiovs[i]);
}
}
g_free(buf);
g_free(reqs);
g_free(qiovs);
return 0;
}
| {
"code": [
" for (i = 0; i < nr_reqs; i++) {",
" return 0;",
" return 0;"
],
"line_no": [
101,
115,
115
]
} | static int FUNC_0(int VAR_0, char **VAR_1)
{
struct timeval VAR_2, VAR_3;
int VAR_4 = 0, VAR_5 = 0;
int VAR_6, VAR_7;
char **VAR_8;
int64_t offset, first_offset = 0;
int VAR_9 = 0;
int VAR_10;
int VAR_11;
int VAR_12 = 0xcd;
QEMUIOVector *qiovs;
int VAR_13;
BlockRequest *reqs;
while ((VAR_6 = getopt(VAR_0, VAR_1, "CqP:")) != EOF) {
switch (VAR_6) {
case 'C':
VAR_4 = 1;
break;
case 'q':
VAR_5 = 1;
break;
case 'P':
VAR_12 = parse_pattern(optarg);
if (VAR_12 < 0) {
return 0;
}
break;
default:
return command_usage(&writev_cmd);
}
}
if (optind > VAR_0 - 2) {
return command_usage(&writev_cmd);
}
VAR_11 = 1;
for (VAR_13 = optind; VAR_13 < VAR_0; VAR_13++) {
if (!strcmp(VAR_1[VAR_13], ";")) {
VAR_11++;
}
}
reqs = g_malloc0(VAR_11 * sizeof(*reqs));
VAR_8 = g_malloc0(VAR_11 * sizeof(*VAR_8));
qiovs = g_malloc(VAR_11 * sizeof(*qiovs));
for (VAR_13 = 0; VAR_13 < VAR_11; VAR_13++) {
int VAR_14;
offset = cvtnum(VAR_1[optind]);
if (offset < 0) {
printf("non-numeric offset argument -- %s\n", VAR_1[optind]);
return 0;
}
optind++;
if (offset & 0x1ff) {
printf("offset %lld is not sector aligned\n",
(long long)offset);
return 0;
}
if (VAR_13 == 0) {
first_offset = offset;
}
for (VAR_14 = optind; VAR_14 < VAR_0; VAR_14++) {
if (!strcmp(VAR_1[VAR_14], ";")) {
break;
}
}
VAR_10 = VAR_14 - optind;
VAR_8[VAR_13] = create_iovec(&qiovs[VAR_13], &VAR_1[optind], VAR_10, VAR_12);
if (VAR_8[VAR_13] == NULL) {
goto out;
}
reqs[VAR_13].qiov = &qiovs[VAR_13];
reqs[VAR_13].sector = offset >> 9;
reqs[VAR_13].nb_sectors = reqs[VAR_13].qiov->size >> 9;
optind = VAR_14 + 1;
VAR_12++;
}
gettimeofday(&VAR_2, NULL);
VAR_7 = do_aio_multiwrite(reqs, VAR_11, &VAR_9);
gettimeofday(&VAR_3, NULL);
if (VAR_7 < 0) {
printf("aio_multiwrite failed: %s\n", strerror(-VAR_7));
goto out;
}
if (VAR_5) {
goto out;
}
VAR_3 = tsub(VAR_3, VAR_2);
print_report("wrote", &VAR_3, first_offset, VAR_9, VAR_9, VAR_7, VAR_4);
out:
for (VAR_13 = 0; VAR_13 < VAR_11; VAR_13++) {
qemu_io_free(VAR_8[VAR_13]);
if (reqs[VAR_13].qiov != NULL) {
qemu_iovec_destroy(&qiovs[VAR_13]);
}
}
g_free(VAR_8);
g_free(reqs);
g_free(qiovs);
return 0;
}
| [
"static int FUNC_0(int VAR_0, char **VAR_1)\n{",
"struct timeval VAR_2, VAR_3;",
"int VAR_4 = 0, VAR_5 = 0;",
"int VAR_6, VAR_7;",
"char **VAR_8;",
"int64_t offset, first_offset = 0;",
"int VAR_9 = 0;",
"int VAR_10;",
"int VAR_11;",
"int VAR_12 = 0xcd;",
"QEMUIOVector *qiovs;",
"int VAR_13;",
"BlockRequest *reqs;",
"while ((VAR_6 = getopt(VAR_0, VAR_1, \"CqP:\")) != EOF) {",
"switch (VAR_6) {",
"case 'C':\nVAR_4 = 1;",
"break;",
"case 'q':\nVAR_5 = 1;",
"break;",
"case 'P':\nVAR_12 = parse_pattern(optarg);",
"if (VAR_12 < 0) {",
"return 0;",
"}",
"break;",
"default:\nreturn command_usage(&writev_cmd);",
"}",
"}",
"if (optind > VAR_0 - 2) {",
"return command_usage(&writev_cmd);",
"}",
"VAR_11 = 1;",
"for (VAR_13 = optind; VAR_13 < VAR_0; VAR_13++) {",
"if (!strcmp(VAR_1[VAR_13], \";\")) {",
"VAR_11++;",
"}",
"}",
"reqs = g_malloc0(VAR_11 * sizeof(*reqs));",
"VAR_8 = g_malloc0(VAR_11 * sizeof(*VAR_8));",
"qiovs = g_malloc(VAR_11 * sizeof(*qiovs));",
"for (VAR_13 = 0; VAR_13 < VAR_11; VAR_13++) {",
"int VAR_14;",
"offset = cvtnum(VAR_1[optind]);",
"if (offset < 0) {",
"printf(\"non-numeric offset argument -- %s\\n\", VAR_1[optind]);",
"return 0;",
"}",
"optind++;",
"if (offset & 0x1ff) {",
"printf(\"offset %lld is not sector aligned\\n\",\n(long long)offset);",
"return 0;",
"}",
"if (VAR_13 == 0) {",
"first_offset = offset;",
"}",
"for (VAR_14 = optind; VAR_14 < VAR_0; VAR_14++) {",
"if (!strcmp(VAR_1[VAR_14], \";\")) {",
"break;",
"}",
"}",
"VAR_10 = VAR_14 - optind;",
"VAR_8[VAR_13] = create_iovec(&qiovs[VAR_13], &VAR_1[optind], VAR_10, VAR_12);",
"if (VAR_8[VAR_13] == NULL) {",
"goto out;",
"}",
"reqs[VAR_13].qiov = &qiovs[VAR_13];",
"reqs[VAR_13].sector = offset >> 9;",
"reqs[VAR_13].nb_sectors = reqs[VAR_13].qiov->size >> 9;",
"optind = VAR_14 + 1;",
"VAR_12++;",
"}",
"gettimeofday(&VAR_2, NULL);",
"VAR_7 = do_aio_multiwrite(reqs, VAR_11, &VAR_9);",
"gettimeofday(&VAR_3, NULL);",
"if (VAR_7 < 0) {",
"printf(\"aio_multiwrite failed: %s\\n\", strerror(-VAR_7));",
"goto out;",
"}",
"if (VAR_5) {",
"goto out;",
"}",
"VAR_3 = tsub(VAR_3, VAR_2);",
"print_report(\"wrote\", &VAR_3, first_offset, VAR_9, VAR_9, VAR_7, VAR_4);",
"out:\nfor (VAR_13 = 0; VAR_13 < VAR_11; VAR_13++) {",
"qemu_io_free(VAR_8[VAR_13]);",
"if (reqs[VAR_13].qiov != NULL) {",
"qemu_iovec_destroy(&qiovs[VAR_13]);",
"}",
"}",
"g_free(VAR_8);",
"g_free(reqs);",
"g_free(qiovs);",
"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,
1,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
],
[
37,
39
],
[
41
],
[
43,
45
],
[
47
],
[
49,
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61,
63
],
[
65
],
[
67
],
[
71
],
[
73
],
[
75
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
93
],
[
95
],
[
97
],
[
101
],
[
103
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
123
],
[
125,
127
],
[
129
],
[
131
],
[
135
],
[
137
],
[
139
],
[
145
],
[
147
],
[
149
],
[
151
],
[
153
],
[
157
],
[
163
],
[
165
],
[
167
],
[
169
],
[
173
],
[
175
],
[
177
],
[
181
],
[
185
],
[
187
],
[
191
],
[
193
],
[
195
],
[
199
],
[
201
],
[
203
],
[
205
],
[
209
],
[
211
],
[
213
],
[
219
],
[
221
],
[
223,
225
],
[
227
],
[
229
],
[
231
],
[
233
],
[
235
],
[
237
],
[
239
],
[
241
],
[
243
],
[
245
]
] |
19,675 | static void vaapi_encode_h264_write_sps(PutBitContext *pbc,
VAAPIEncodeContext *ctx)
{
VAEncSequenceParameterBufferH264 *vseq = ctx->codec_sequence_params;
VAAPIEncodeH264Context *priv = ctx->priv_data;
VAAPIEncodeH264MiscSequenceParams *mseq = &priv->misc_sequence_params;
int i;
vaapi_encode_h264_write_nal_header(pbc, NAL_SPS, 3);
u(8, mseq_var(profile_idc));
u(1, mseq_var(constraint_set0_flag));
u(1, mseq_var(constraint_set1_flag));
u(1, mseq_var(constraint_set2_flag));
u(1, mseq_var(constraint_set3_flag));
u(1, mseq_var(constraint_set4_flag));
u(1, mseq_var(constraint_set5_flag));
u(2, 0, reserved_zero_2bits);
u(8, vseq_var(level_idc));
ue(vseq_var(seq_parameter_set_id));
if (mseq->profile_idc == 100 || mseq->profile_idc == 110 ||
mseq->profile_idc == 122 || mseq->profile_idc == 244 ||
mseq->profile_idc == 44 || mseq->profile_idc == 83 ||
mseq->profile_idc == 86 || mseq->profile_idc == 118 ||
mseq->profile_idc == 128 || mseq->profile_idc == 138) {
ue(vseq_field(chroma_format_idc));
if (vseq->seq_fields.bits.chroma_format_idc == 3)
u(1, mseq_var(separate_colour_plane_flag));
ue(vseq_var(bit_depth_luma_minus8));
ue(vseq_var(bit_depth_chroma_minus8));
u(1, mseq_var(qpprime_y_zero_transform_bypass_flag));
u(1, vseq_field(seq_scaling_matrix_present_flag));
if (vseq->seq_fields.bits.seq_scaling_matrix_present_flag) {
av_assert0(0 && "scaling matrices not supported");
}
}
ue(vseq_field(log2_max_frame_num_minus4));
ue(vseq_field(pic_order_cnt_type));
if (vseq->seq_fields.bits.pic_order_cnt_type == 0) {
ue(vseq_field(log2_max_pic_order_cnt_lsb_minus4));
} else if (vseq->seq_fields.bits.pic_order_cnt_type == 1) {
u(1, mseq_var(delta_pic_order_always_zero_flag));
se(vseq_var(offset_for_non_ref_pic));
se(vseq_var(offset_for_top_to_bottom_field));
ue(vseq_var(num_ref_frames_in_pic_order_cnt_cycle));
for (i = 0; i < vseq->num_ref_frames_in_pic_order_cnt_cycle; i++)
se(vseq_var(offset_for_ref_frame[i]));
}
ue(vseq_var(max_num_ref_frames));
u(1, mseq_var(gaps_in_frame_num_allowed_flag));
ue(vseq->picture_width_in_mbs - 1, pic_width_in_mbs_minus1);
ue(vseq->picture_height_in_mbs - 1, pic_height_in_mbs_minus1);
u(1, vseq_field(frame_mbs_only_flag));
if (!vseq->seq_fields.bits.frame_mbs_only_flag)
u(1, vseq_field(mb_adaptive_frame_field_flag));
u(1, vseq_field(direct_8x8_inference_flag));
u(1, vseq_var(frame_cropping_flag));
if (vseq->frame_cropping_flag) {
ue(vseq_var(frame_crop_left_offset));
ue(vseq_var(frame_crop_right_offset));
ue(vseq_var(frame_crop_top_offset));
ue(vseq_var(frame_crop_bottom_offset));
}
u(1, vseq_var(vui_parameters_present_flag));
if (vseq->vui_parameters_present_flag)
vaapi_encode_h264_write_vui(pbc, ctx);
vaapi_encode_h264_write_trailing_rbsp(pbc);
}
| false | FFmpeg | 5c2fb561d94fc51d76ab21d6f7cc5b6cc3aa599c | static void vaapi_encode_h264_write_sps(PutBitContext *pbc,
VAAPIEncodeContext *ctx)
{
VAEncSequenceParameterBufferH264 *vseq = ctx->codec_sequence_params;
VAAPIEncodeH264Context *priv = ctx->priv_data;
VAAPIEncodeH264MiscSequenceParams *mseq = &priv->misc_sequence_params;
int i;
vaapi_encode_h264_write_nal_header(pbc, NAL_SPS, 3);
u(8, mseq_var(profile_idc));
u(1, mseq_var(constraint_set0_flag));
u(1, mseq_var(constraint_set1_flag));
u(1, mseq_var(constraint_set2_flag));
u(1, mseq_var(constraint_set3_flag));
u(1, mseq_var(constraint_set4_flag));
u(1, mseq_var(constraint_set5_flag));
u(2, 0, reserved_zero_2bits);
u(8, vseq_var(level_idc));
ue(vseq_var(seq_parameter_set_id));
if (mseq->profile_idc == 100 || mseq->profile_idc == 110 ||
mseq->profile_idc == 122 || mseq->profile_idc == 244 ||
mseq->profile_idc == 44 || mseq->profile_idc == 83 ||
mseq->profile_idc == 86 || mseq->profile_idc == 118 ||
mseq->profile_idc == 128 || mseq->profile_idc == 138) {
ue(vseq_field(chroma_format_idc));
if (vseq->seq_fields.bits.chroma_format_idc == 3)
u(1, mseq_var(separate_colour_plane_flag));
ue(vseq_var(bit_depth_luma_minus8));
ue(vseq_var(bit_depth_chroma_minus8));
u(1, mseq_var(qpprime_y_zero_transform_bypass_flag));
u(1, vseq_field(seq_scaling_matrix_present_flag));
if (vseq->seq_fields.bits.seq_scaling_matrix_present_flag) {
av_assert0(0 && "scaling matrices not supported");
}
}
ue(vseq_field(log2_max_frame_num_minus4));
ue(vseq_field(pic_order_cnt_type));
if (vseq->seq_fields.bits.pic_order_cnt_type == 0) {
ue(vseq_field(log2_max_pic_order_cnt_lsb_minus4));
} else if (vseq->seq_fields.bits.pic_order_cnt_type == 1) {
u(1, mseq_var(delta_pic_order_always_zero_flag));
se(vseq_var(offset_for_non_ref_pic));
se(vseq_var(offset_for_top_to_bottom_field));
ue(vseq_var(num_ref_frames_in_pic_order_cnt_cycle));
for (i = 0; i < vseq->num_ref_frames_in_pic_order_cnt_cycle; i++)
se(vseq_var(offset_for_ref_frame[i]));
}
ue(vseq_var(max_num_ref_frames));
u(1, mseq_var(gaps_in_frame_num_allowed_flag));
ue(vseq->picture_width_in_mbs - 1, pic_width_in_mbs_minus1);
ue(vseq->picture_height_in_mbs - 1, pic_height_in_mbs_minus1);
u(1, vseq_field(frame_mbs_only_flag));
if (!vseq->seq_fields.bits.frame_mbs_only_flag)
u(1, vseq_field(mb_adaptive_frame_field_flag));
u(1, vseq_field(direct_8x8_inference_flag));
u(1, vseq_var(frame_cropping_flag));
if (vseq->frame_cropping_flag) {
ue(vseq_var(frame_crop_left_offset));
ue(vseq_var(frame_crop_right_offset));
ue(vseq_var(frame_crop_top_offset));
ue(vseq_var(frame_crop_bottom_offset));
}
u(1, vseq_var(vui_parameters_present_flag));
if (vseq->vui_parameters_present_flag)
vaapi_encode_h264_write_vui(pbc, ctx);
vaapi_encode_h264_write_trailing_rbsp(pbc);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(PutBitContext *VAR_0,
VAAPIEncodeContext *VAR_1)
{
VAEncSequenceParameterBufferH264 *vseq = VAR_1->codec_sequence_params;
VAAPIEncodeH264Context *priv = VAR_1->priv_data;
VAAPIEncodeH264MiscSequenceParams *mseq = &priv->misc_sequence_params;
int VAR_2;
vaapi_encode_h264_write_nal_header(VAR_0, NAL_SPS, 3);
u(8, mseq_var(profile_idc));
u(1, mseq_var(constraint_set0_flag));
u(1, mseq_var(constraint_set1_flag));
u(1, mseq_var(constraint_set2_flag));
u(1, mseq_var(constraint_set3_flag));
u(1, mseq_var(constraint_set4_flag));
u(1, mseq_var(constraint_set5_flag));
u(2, 0, reserved_zero_2bits);
u(8, vseq_var(level_idc));
ue(vseq_var(seq_parameter_set_id));
if (mseq->profile_idc == 100 || mseq->profile_idc == 110 ||
mseq->profile_idc == 122 || mseq->profile_idc == 244 ||
mseq->profile_idc == 44 || mseq->profile_idc == 83 ||
mseq->profile_idc == 86 || mseq->profile_idc == 118 ||
mseq->profile_idc == 128 || mseq->profile_idc == 138) {
ue(vseq_field(chroma_format_idc));
if (vseq->seq_fields.bits.chroma_format_idc == 3)
u(1, mseq_var(separate_colour_plane_flag));
ue(vseq_var(bit_depth_luma_minus8));
ue(vseq_var(bit_depth_chroma_minus8));
u(1, mseq_var(qpprime_y_zero_transform_bypass_flag));
u(1, vseq_field(seq_scaling_matrix_present_flag));
if (vseq->seq_fields.bits.seq_scaling_matrix_present_flag) {
av_assert0(0 && "scaling matrices not supported");
}
}
ue(vseq_field(log2_max_frame_num_minus4));
ue(vseq_field(pic_order_cnt_type));
if (vseq->seq_fields.bits.pic_order_cnt_type == 0) {
ue(vseq_field(log2_max_pic_order_cnt_lsb_minus4));
} else if (vseq->seq_fields.bits.pic_order_cnt_type == 1) {
u(1, mseq_var(delta_pic_order_always_zero_flag));
se(vseq_var(offset_for_non_ref_pic));
se(vseq_var(offset_for_top_to_bottom_field));
ue(vseq_var(num_ref_frames_in_pic_order_cnt_cycle));
for (VAR_2 = 0; VAR_2 < vseq->num_ref_frames_in_pic_order_cnt_cycle; VAR_2++)
se(vseq_var(offset_for_ref_frame[VAR_2]));
}
ue(vseq_var(max_num_ref_frames));
u(1, mseq_var(gaps_in_frame_num_allowed_flag));
ue(vseq->picture_width_in_mbs - 1, pic_width_in_mbs_minus1);
ue(vseq->picture_height_in_mbs - 1, pic_height_in_mbs_minus1);
u(1, vseq_field(frame_mbs_only_flag));
if (!vseq->seq_fields.bits.frame_mbs_only_flag)
u(1, vseq_field(mb_adaptive_frame_field_flag));
u(1, vseq_field(direct_8x8_inference_flag));
u(1, vseq_var(frame_cropping_flag));
if (vseq->frame_cropping_flag) {
ue(vseq_var(frame_crop_left_offset));
ue(vseq_var(frame_crop_right_offset));
ue(vseq_var(frame_crop_top_offset));
ue(vseq_var(frame_crop_bottom_offset));
}
u(1, vseq_var(vui_parameters_present_flag));
if (vseq->vui_parameters_present_flag)
vaapi_encode_h264_write_vui(VAR_0, VAR_1);
vaapi_encode_h264_write_trailing_rbsp(VAR_0);
}
| [
"static void FUNC_0(PutBitContext *VAR_0,\nVAAPIEncodeContext *VAR_1)\n{",
"VAEncSequenceParameterBufferH264 *vseq = VAR_1->codec_sequence_params;",
"VAAPIEncodeH264Context *priv = VAR_1->priv_data;",
"VAAPIEncodeH264MiscSequenceParams *mseq = &priv->misc_sequence_params;",
"int VAR_2;",
"vaapi_encode_h264_write_nal_header(VAR_0, NAL_SPS, 3);",
"u(8, mseq_var(profile_idc));",
"u(1, mseq_var(constraint_set0_flag));",
"u(1, mseq_var(constraint_set1_flag));",
"u(1, mseq_var(constraint_set2_flag));",
"u(1, mseq_var(constraint_set3_flag));",
"u(1, mseq_var(constraint_set4_flag));",
"u(1, mseq_var(constraint_set5_flag));",
"u(2, 0, reserved_zero_2bits);",
"u(8, vseq_var(level_idc));",
"ue(vseq_var(seq_parameter_set_id));",
"if (mseq->profile_idc == 100 || mseq->profile_idc == 110 ||\nmseq->profile_idc == 122 || mseq->profile_idc == 244 ||\nmseq->profile_idc == 44 || mseq->profile_idc == 83 ||\nmseq->profile_idc == 86 || mseq->profile_idc == 118 ||\nmseq->profile_idc == 128 || mseq->profile_idc == 138) {",
"ue(vseq_field(chroma_format_idc));",
"if (vseq->seq_fields.bits.chroma_format_idc == 3)\nu(1, mseq_var(separate_colour_plane_flag));",
"ue(vseq_var(bit_depth_luma_minus8));",
"ue(vseq_var(bit_depth_chroma_minus8));",
"u(1, mseq_var(qpprime_y_zero_transform_bypass_flag));",
"u(1, vseq_field(seq_scaling_matrix_present_flag));",
"if (vseq->seq_fields.bits.seq_scaling_matrix_present_flag) {",
"av_assert0(0 && \"scaling matrices not supported\");",
"}",
"}",
"ue(vseq_field(log2_max_frame_num_minus4));",
"ue(vseq_field(pic_order_cnt_type));",
"if (vseq->seq_fields.bits.pic_order_cnt_type == 0) {",
"ue(vseq_field(log2_max_pic_order_cnt_lsb_minus4));",
"} else if (vseq->seq_fields.bits.pic_order_cnt_type == 1) {",
"u(1, mseq_var(delta_pic_order_always_zero_flag));",
"se(vseq_var(offset_for_non_ref_pic));",
"se(vseq_var(offset_for_top_to_bottom_field));",
"ue(vseq_var(num_ref_frames_in_pic_order_cnt_cycle));",
"for (VAR_2 = 0; VAR_2 < vseq->num_ref_frames_in_pic_order_cnt_cycle; VAR_2++)",
"se(vseq_var(offset_for_ref_frame[VAR_2]));",
"}",
"ue(vseq_var(max_num_ref_frames));",
"u(1, mseq_var(gaps_in_frame_num_allowed_flag));",
"ue(vseq->picture_width_in_mbs - 1, pic_width_in_mbs_minus1);",
"ue(vseq->picture_height_in_mbs - 1, pic_height_in_mbs_minus1);",
"u(1, vseq_field(frame_mbs_only_flag));",
"if (!vseq->seq_fields.bits.frame_mbs_only_flag)\nu(1, vseq_field(mb_adaptive_frame_field_flag));",
"u(1, vseq_field(direct_8x8_inference_flag));",
"u(1, vseq_var(frame_cropping_flag));",
"if (vseq->frame_cropping_flag) {",
"ue(vseq_var(frame_crop_left_offset));",
"ue(vseq_var(frame_crop_right_offset));",
"ue(vseq_var(frame_crop_top_offset));",
"ue(vseq_var(frame_crop_bottom_offset));",
"}",
"u(1, vseq_var(vui_parameters_present_flag));",
"if (vseq->vui_parameters_present_flag)\nvaapi_encode_h264_write_vui(VAR_0, VAR_1);",
"vaapi_encode_h264_write_trailing_rbsp(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
] | [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
39
],
[
43
],
[
47,
49,
51,
53,
55
],
[
57
],
[
61,
63
],
[
67
],
[
69
],
[
73
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
89
],
[
91
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
111
],
[
113
],
[
115
],
[
119
],
[
121
],
[
125
],
[
127
],
[
131
],
[
133,
135
],
[
139
],
[
143
],
[
145
],
[
147
],
[
149
],
[
151
],
[
153
],
[
155
],
[
159
],
[
161,
163
],
[
167
],
[
169
]
] |
19,676 | static int pix_norm1_c(uint8_t * pix, int line_size)
{
int s, i, j;
uint32_t *sq = ff_squareTbl + 256;
s = 0;
for (i = 0; i < 16; i++) {
for (j = 0; j < 16; j += 8) {
#if 0
s += sq[pix[0]];
s += sq[pix[1]];
s += sq[pix[2]];
s += sq[pix[3]];
s += sq[pix[4]];
s += sq[pix[5]];
s += sq[pix[6]];
s += sq[pix[7]];
#else
#if LONG_MAX > 2147483647
register uint64_t x=*(uint64_t*)pix;
s += sq[x&0xff];
s += sq[(x>>8)&0xff];
s += sq[(x>>16)&0xff];
s += sq[(x>>24)&0xff];
s += sq[(x>>32)&0xff];
s += sq[(x>>40)&0xff];
s += sq[(x>>48)&0xff];
s += sq[(x>>56)&0xff];
#else
register uint32_t x=*(uint32_t*)pix;
s += sq[x&0xff];
s += sq[(x>>8)&0xff];
s += sq[(x>>16)&0xff];
s += sq[(x>>24)&0xff];
x=*(uint32_t*)(pix+4);
s += sq[x&0xff];
s += sq[(x>>8)&0xff];
s += sq[(x>>16)&0xff];
s += sq[(x>>24)&0xff];
#endif
#endif
pix += 8;
}
pix += line_size - 16;
}
return s;
}
| false | FFmpeg | d9a9f50a3683b577e9c391ce8cab9edc9b239fcb | static int pix_norm1_c(uint8_t * pix, int line_size)
{
int s, i, j;
uint32_t *sq = ff_squareTbl + 256;
s = 0;
for (i = 0; i < 16; i++) {
for (j = 0; j < 16; j += 8) {
#if 0
s += sq[pix[0]];
s += sq[pix[1]];
s += sq[pix[2]];
s += sq[pix[3]];
s += sq[pix[4]];
s += sq[pix[5]];
s += sq[pix[6]];
s += sq[pix[7]];
#else
#if LONG_MAX > 2147483647
register uint64_t x=*(uint64_t*)pix;
s += sq[x&0xff];
s += sq[(x>>8)&0xff];
s += sq[(x>>16)&0xff];
s += sq[(x>>24)&0xff];
s += sq[(x>>32)&0xff];
s += sq[(x>>40)&0xff];
s += sq[(x>>48)&0xff];
s += sq[(x>>56)&0xff];
#else
register uint32_t x=*(uint32_t*)pix;
s += sq[x&0xff];
s += sq[(x>>8)&0xff];
s += sq[(x>>16)&0xff];
s += sq[(x>>24)&0xff];
x=*(uint32_t*)(pix+4);
s += sq[x&0xff];
s += sq[(x>>8)&0xff];
s += sq[(x>>16)&0xff];
s += sq[(x>>24)&0xff];
#endif
#endif
pix += 8;
}
pix += line_size - 16;
}
return s;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(uint8_t * VAR_0, int VAR_1)
{
int VAR_2, VAR_3, VAR_4;
uint32_t *sq = ff_squareTbl + 256;
VAR_2 = 0;
for (VAR_3 = 0; VAR_3 < 16; VAR_3++) {
for (VAR_4 = 0; VAR_4 < 16; VAR_4 += 8) {
#if 0
VAR_2 += sq[VAR_0[0]];
VAR_2 += sq[VAR_0[1]];
VAR_2 += sq[VAR_0[2]];
VAR_2 += sq[VAR_0[3]];
VAR_2 += sq[VAR_0[4]];
VAR_2 += sq[VAR_0[5]];
VAR_2 += sq[VAR_0[6]];
VAR_2 += sq[VAR_0[7]];
#else
#if LONG_MAX > 2147483647
register uint64_t VAR_5=*(uint64_t*)VAR_0;
VAR_2 += sq[VAR_5&0xff];
VAR_2 += sq[(VAR_5>>8)&0xff];
VAR_2 += sq[(VAR_5>>16)&0xff];
VAR_2 += sq[(VAR_5>>24)&0xff];
VAR_2 += sq[(VAR_5>>32)&0xff];
VAR_2 += sq[(VAR_5>>40)&0xff];
VAR_2 += sq[(VAR_5>>48)&0xff];
VAR_2 += sq[(VAR_5>>56)&0xff];
#else
register uint32_t VAR_5=*(uint32_t*)VAR_0;
VAR_2 += sq[VAR_5&0xff];
VAR_2 += sq[(VAR_5>>8)&0xff];
VAR_2 += sq[(VAR_5>>16)&0xff];
VAR_2 += sq[(VAR_5>>24)&0xff];
VAR_5=*(uint32_t*)(VAR_0+4);
VAR_2 += sq[VAR_5&0xff];
VAR_2 += sq[(VAR_5>>8)&0xff];
VAR_2 += sq[(VAR_5>>16)&0xff];
VAR_2 += sq[(VAR_5>>24)&0xff];
#endif
#endif
VAR_0 += 8;
}
VAR_0 += VAR_1 - 16;
}
return VAR_2;
}
| [
"static int FUNC_0(uint8_t * VAR_0, int VAR_1)\n{",
"int VAR_2, VAR_3, VAR_4;",
"uint32_t *sq = ff_squareTbl + 256;",
"VAR_2 = 0;",
"for (VAR_3 = 0; VAR_3 < 16; VAR_3++) {",
"for (VAR_4 = 0; VAR_4 < 16; VAR_4 += 8) {",
"#if 0\nVAR_2 += sq[VAR_0[0]];",
"VAR_2 += sq[VAR_0[1]];",
"VAR_2 += sq[VAR_0[2]];",
"VAR_2 += sq[VAR_0[3]];",
"VAR_2 += sq[VAR_0[4]];",
"VAR_2 += sq[VAR_0[5]];",
"VAR_2 += sq[VAR_0[6]];",
"VAR_2 += sq[VAR_0[7]];",
"#else\n#if LONG_MAX > 2147483647\nregister uint64_t VAR_5=*(uint64_t*)VAR_0;",
"VAR_2 += sq[VAR_5&0xff];",
"VAR_2 += sq[(VAR_5>>8)&0xff];",
"VAR_2 += sq[(VAR_5>>16)&0xff];",
"VAR_2 += sq[(VAR_5>>24)&0xff];",
"VAR_2 += sq[(VAR_5>>32)&0xff];",
"VAR_2 += sq[(VAR_5>>40)&0xff];",
"VAR_2 += sq[(VAR_5>>48)&0xff];",
"VAR_2 += sq[(VAR_5>>56)&0xff];",
"#else\nregister uint32_t VAR_5=*(uint32_t*)VAR_0;",
"VAR_2 += sq[VAR_5&0xff];",
"VAR_2 += sq[(VAR_5>>8)&0xff];",
"VAR_2 += sq[(VAR_5>>16)&0xff];",
"VAR_2 += sq[(VAR_5>>24)&0xff];",
"VAR_5=*(uint32_t*)(VAR_0+4);",
"VAR_2 += sq[VAR_5&0xff];",
"VAR_2 += sq[(VAR_5>>8)&0xff];",
"VAR_2 += sq[(VAR_5>>16)&0xff];",
"VAR_2 += sq[(VAR_5>>24)&0xff];",
"#endif\n#endif\nVAR_0 += 8;",
"}",
"VAR_0 += VAR_1 - 16;",
"}",
"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
] | [
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
15
],
[
17,
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35,
37,
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57,
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79,
81,
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
]
] |
19,677 | static void restore_median(uint8_t *src, int step, int stride,
int width, int height, int slices, int rmode)
{
int i, j, slice;
int A, B, C;
uint8_t *bsrc;
int slice_start, slice_height;
const int cmask = ~rmode;
for (slice = 0; slice < slices; slice++) {
slice_start = ((slice * height) / slices) & cmask;
slice_height = ((((slice + 1) * height) / slices) & cmask) -
slice_start;
bsrc = src + slice_start * stride;
// first line - left neighbour prediction
bsrc[0] += 0x80;
A = bsrc[0];
for (i = step; i < width * step; i += step) {
bsrc[i] += A;
A = bsrc[i];
}
bsrc += stride;
if (slice_height == 1)
continue;
// second line - first element has top prediction, the rest uses median
C = bsrc[-stride];
bsrc[0] += C;
A = bsrc[0];
for (i = step; i < width * step; i += step) {
B = bsrc[i - stride];
bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
C = B;
A = bsrc[i];
}
bsrc += stride;
// the rest of lines use continuous median prediction
for (j = 2; j < slice_height; j++) {
for (i = 0; i < width * step; i += step) {
B = bsrc[i - stride];
bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
C = B;
A = bsrc[i];
}
bsrc += stride;
}
}
}
| false | FFmpeg | 7656c4c6e66f8a787d384f027ad824cc1677fda1 | static void restore_median(uint8_t *src, int step, int stride,
int width, int height, int slices, int rmode)
{
int i, j, slice;
int A, B, C;
uint8_t *bsrc;
int slice_start, slice_height;
const int cmask = ~rmode;
for (slice = 0; slice < slices; slice++) {
slice_start = ((slice * height) / slices) & cmask;
slice_height = ((((slice + 1) * height) / slices) & cmask) -
slice_start;
bsrc = src + slice_start * stride;
bsrc[0] += 0x80;
A = bsrc[0];
for (i = step; i < width * step; i += step) {
bsrc[i] += A;
A = bsrc[i];
}
bsrc += stride;
if (slice_height == 1)
continue;
C = bsrc[-stride];
bsrc[0] += C;
A = bsrc[0];
for (i = step; i < width * step; i += step) {
B = bsrc[i - stride];
bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
C = B;
A = bsrc[i];
}
bsrc += stride;
for (j = 2; j < slice_height; j++) {
for (i = 0; i < width * step; i += step) {
B = bsrc[i - stride];
bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
C = B;
A = bsrc[i];
}
bsrc += stride;
}
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(uint8_t *VAR_0, int VAR_1, int VAR_2,
int VAR_3, int VAR_4, int VAR_5, int VAR_6)
{
int VAR_7, VAR_8, VAR_9;
int VAR_10, VAR_11, VAR_12;
uint8_t *bsrc;
int VAR_13, VAR_14;
const int VAR_15 = ~VAR_6;
for (VAR_9 = 0; VAR_9 < VAR_5; VAR_9++) {
VAR_13 = ((VAR_9 * VAR_4) / VAR_5) & VAR_15;
VAR_14 = ((((VAR_9 + 1) * VAR_4) / VAR_5) & VAR_15) -
VAR_13;
bsrc = VAR_0 + VAR_13 * VAR_2;
bsrc[0] += 0x80;
VAR_10 = bsrc[0];
for (VAR_7 = VAR_1; VAR_7 < VAR_3 * VAR_1; VAR_7 += VAR_1) {
bsrc[VAR_7] += VAR_10;
VAR_10 = bsrc[VAR_7];
}
bsrc += VAR_2;
if (VAR_14 == 1)
continue;
VAR_12 = bsrc[-VAR_2];
bsrc[0] += VAR_12;
VAR_10 = bsrc[0];
for (VAR_7 = VAR_1; VAR_7 < VAR_3 * VAR_1; VAR_7 += VAR_1) {
VAR_11 = bsrc[VAR_7 - VAR_2];
bsrc[VAR_7] += mid_pred(VAR_10, VAR_11, (uint8_t)(VAR_10 + VAR_11 - VAR_12));
VAR_12 = VAR_11;
VAR_10 = bsrc[VAR_7];
}
bsrc += VAR_2;
for (VAR_8 = 2; VAR_8 < VAR_14; VAR_8++) {
for (VAR_7 = 0; VAR_7 < VAR_3 * VAR_1; VAR_7 += VAR_1) {
VAR_11 = bsrc[VAR_7 - VAR_2];
bsrc[VAR_7] += mid_pred(VAR_10, VAR_11, (uint8_t)(VAR_10 + VAR_11 - VAR_12));
VAR_12 = VAR_11;
VAR_10 = bsrc[VAR_7];
}
bsrc += VAR_2;
}
}
}
| [
"static void FUNC_0(uint8_t *VAR_0, int VAR_1, int VAR_2,\nint VAR_3, int VAR_4, int VAR_5, int VAR_6)\n{",
"int VAR_7, VAR_8, VAR_9;",
"int VAR_10, VAR_11, VAR_12;",
"uint8_t *bsrc;",
"int VAR_13, VAR_14;",
"const int VAR_15 = ~VAR_6;",
"for (VAR_9 = 0; VAR_9 < VAR_5; VAR_9++) {",
"VAR_13 = ((VAR_9 * VAR_4) / VAR_5) & VAR_15;",
"VAR_14 = ((((VAR_9 + 1) * VAR_4) / VAR_5) & VAR_15) -\nVAR_13;",
"bsrc = VAR_0 + VAR_13 * VAR_2;",
"bsrc[0] += 0x80;",
"VAR_10 = bsrc[0];",
"for (VAR_7 = VAR_1; VAR_7 < VAR_3 * VAR_1; VAR_7 += VAR_1) {",
"bsrc[VAR_7] += VAR_10;",
"VAR_10 = bsrc[VAR_7];",
"}",
"bsrc += VAR_2;",
"if (VAR_14 == 1)\ncontinue;",
"VAR_12 = bsrc[-VAR_2];",
"bsrc[0] += VAR_12;",
"VAR_10 = bsrc[0];",
"for (VAR_7 = VAR_1; VAR_7 < VAR_3 * VAR_1; VAR_7 += VAR_1) {",
"VAR_11 = bsrc[VAR_7 - VAR_2];",
"bsrc[VAR_7] += mid_pred(VAR_10, VAR_11, (uint8_t)(VAR_10 + VAR_11 - VAR_12));",
"VAR_12 = VAR_11;",
"VAR_10 = bsrc[VAR_7];",
"}",
"bsrc += VAR_2;",
"for (VAR_8 = 2; VAR_8 < VAR_14; VAR_8++) {",
"for (VAR_7 = 0; VAR_7 < VAR_3 * VAR_1; VAR_7 += VAR_1) {",
"VAR_11 = bsrc[VAR_7 - VAR_2];",
"bsrc[VAR_7] += mid_pred(VAR_10, VAR_11, (uint8_t)(VAR_10 + VAR_11 - VAR_12));",
"VAR_12 = VAR_11;",
"VAR_10 = bsrc[VAR_7];",
"}",
"bsrc += 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
] | [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23,
25
],
[
29
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49,
51
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
]
] |
19,678 | 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 = s->cur;
uint8_t *current;
int result, i, x, y, width, height;
svq1_pmv *pmv;
if (cur->data[0])
avctx->release_buffer(avctx, cur);
/* 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);
if (buf_size < 36)
return AVERROR_INVALIDDATA;
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;
}
avcodec_set_dimensions(avctx, s->width, s->height);
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);
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) {
av_log(avctx, AV_LOG_ERROR,
"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) {
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->dsp,
&s->gb, ¤t[x],
previous, linesize,
pmv, x, y);
if (result) {
av_dlog(avctx,
"Error in svq1_decode_delta_block %i\n",
result);
goto err;
}
}
pmv[0].x =
pmv[0].y = 0;
current += 16 * linesize;
}
}
}
*(AVFrame*)data = *cur;
cur->qscale_table = NULL;
if (!s->nonref)
FFSWAP(AVFrame*, s->cur, s->prev);
*got_frame = 1;
result = buf_size;
err:
av_free(pmv);
return result;
}
| false | FFmpeg | 3b57bb478ff4455773378355e285877d757e151e | 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 = s->cur;
uint8_t *current;
int result, i, x, y, width, height;
svq1_pmv *pmv;
if (cur->data[0])
avctx->release_buffer(avctx, cur);
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);
if (buf_size < 36)
return AVERROR_INVALIDDATA;
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;
}
avcodec_set_dimensions(avctx, s->width, s->height);
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);
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) {
av_log(avctx, AV_LOG_ERROR,
"Error in svq1_decode_block %i (keyframe)\n",
result);
goto err;
}
}
current += 16 * linesize;
}
} else {
uint8_t *previous = s->prev->data[i];
if (!previous) {
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->dsp,
&s->gb, ¤t[x],
previous, linesize,
pmv, x, y);
if (result) {
av_dlog(avctx,
"Error in svq1_decode_delta_block %i\n",
result);
goto err;
}
}
pmv[0].x =
pmv[0].y = 0;
current += 16 * linesize;
}
}
}
*(AVFrame*)data = *cur;
cur->qscale_table = NULL;
if (!s->nonref)
FFSWAP(AVFrame*, s->cur, s->prev);
*got_frame = 1;
result = buf_size;
err:
av_free(pmv);
return result;
}
| {
"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;
SVQ1Context *s = VAR_0->priv_data;
AVFrame *cur = s->cur;
uint8_t *current;
int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11;
svq1_pmv *pmv;
if (cur->VAR_1[0])
VAR_0->release_buffer(VAR_0, cur);
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);
if (VAR_5 < 36)
return AVERROR_INVALIDDATA;
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;
}
avcodec_set_dimensions(VAR_0, s->VAR_10, s->VAR_11);
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);
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) {
av_log(VAR_0, AV_LOG_ERROR,
"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) {
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->dsp,
&s->gb, ¤t[VAR_8],
previous, VAR_12,
pmv, VAR_8, VAR_9);
if (VAR_6) {
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;
}
}
}
*(AVFrame*)VAR_1 = *cur;
cur->qscale_table = NULL;
if (!s->nonref)
FFSWAP(AVFrame*, s->cur, s->prev);
*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 = s->cur;",
"uint8_t *current;",
"int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11;",
"svq1_pmv *pmv;",
"if (cur->VAR_1[0])\nVAR_0->release_buffer(VAR_0, cur);",
"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);",
"if (VAR_5 < 36)\nreturn AVERROR_INVALIDDATA;",
"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;",
"}",
"avcodec_set_dimensions(VAR_0, s->VAR_10, s->VAR_11);",
"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);",
"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) {",
"av_log(VAR_0, AV_LOG_ERROR,\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) {",
"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->dsp,\n&s->gb, ¤t[VAR_8],\nprevious, VAR_12,\npmv, VAR_8, VAR_9);",
"if (VAR_6) {",
"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;",
"}",
"}",
"}",
"*(AVFrame*)VAR_1 = *cur;",
"cur->qscale_table = NULL;",
"if (!s->nonref)\nFFSWAP(AVFrame*, s->cur, s->prev);",
"*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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23,
25
],
[
31
],
[
37
],
[
41,
43
],
[
49
],
[
51
],
[
55,
57
],
[
61
],
[
63
],
[
65
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
83,
85,
87,
89,
91
],
[
95
],
[
97,
99
],
[
103
],
[
105,
107
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125,
127
],
[
129
],
[
131
],
[
133
],
[
137
],
[
141
],
[
145
],
[
147
],
[
149,
151
],
[
153
],
[
155,
157,
159
],
[
161
],
[
163
],
[
165
],
[
167
],
[
169
],
[
171
],
[
175
],
[
177
],
[
179
],
[
181
],
[
183
],
[
185
],
[
189
],
[
193
],
[
195
],
[
197,
199,
201,
203
],
[
205
],
[
207,
209,
211
],
[
213
],
[
215
],
[
217
],
[
221,
223
],
[
227
],
[
229
],
[
231
],
[
233
],
[
237
],
[
239
],
[
241,
243
],
[
247
],
[
249
],
[
253,
255
],
[
257
],
[
259
]
] |
19,679 | static int init_context_frame(MpegEncContext *s)
{
int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y;
s->mb_width = (s->width + 15) / 16;
s->mb_stride = s->mb_width + 1;
s->b8_stride = s->mb_width * 2 + 1;
s->b4_stride = s->mb_width * 4 + 1;
mb_array_size = s->mb_height * s->mb_stride;
mv_table_size = (s->mb_height + 2) * s->mb_stride + 1;
/* set default edge pos, will be overriden
* in decode_header if needed */
s->h_edge_pos = s->mb_width * 16;
s->v_edge_pos = s->mb_height * 16;
s->mb_num = s->mb_width * s->mb_height;
s->block_wrap[0] =
s->block_wrap[1] =
s->block_wrap[2] =
s->block_wrap[3] = s->b8_stride;
s->block_wrap[4] =
s->block_wrap[5] = s->mb_stride;
y_size = s->b8_stride * (2 * s->mb_height + 1);
c_size = s->mb_stride * (s->mb_height + 1);
yc_size = y_size + 2 * c_size;
if (s->mb_height & 1)
yc_size += 2*s->b8_stride + 2*s->mb_stride;
FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int), fail); // error ressilience code looks cleaner with this
for (y = 0; y < s->mb_height; y++)
for (x = 0; x < s->mb_width; x++)
s->mb_index2xy[x + y * s->mb_width] = x + y * s->mb_stride;
s->mb_index2xy[s->mb_height * s->mb_width] = (s->mb_height - 1) * s->mb_stride + s->mb_width; // FIXME really needed?
if (s->encoding) {
/* Allocate MV tables */
FF_ALLOCZ_OR_GOTO(s->avctx, s->p_mv_table_base, mv_table_size * 2 * sizeof(int16_t), fail)
FF_ALLOCZ_OR_GOTO(s->avctx, s->b_forw_mv_table_base, mv_table_size * 2 * sizeof(int16_t), fail)
FF_ALLOCZ_OR_GOTO(s->avctx, s->b_back_mv_table_base, mv_table_size * 2 * sizeof(int16_t), fail)
FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_forw_mv_table_base, mv_table_size * 2 * sizeof(int16_t), fail)
FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_back_mv_table_base, mv_table_size * 2 * sizeof(int16_t), fail)
FF_ALLOCZ_OR_GOTO(s->avctx, s->b_direct_mv_table_base, mv_table_size * 2 * sizeof(int16_t), fail)
s->p_mv_table = s->p_mv_table_base + s->mb_stride + 1;
s->b_forw_mv_table = s->b_forw_mv_table_base + s->mb_stride + 1;
s->b_back_mv_table = s->b_back_mv_table_base + s->mb_stride + 1;
s->b_bidir_forw_mv_table = s->b_bidir_forw_mv_table_base + s->mb_stride + 1;
s->b_bidir_back_mv_table = s->b_bidir_back_mv_table_base + s->mb_stride + 1;
s->b_direct_mv_table = s->b_direct_mv_table_base + s->mb_stride + 1;
/* Allocate MB type table */
FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_type, mb_array_size * sizeof(uint16_t), fail) // needed for encoding
FF_ALLOCZ_OR_GOTO(s->avctx, s->lambda_table, mb_array_size * sizeof(int), fail)
FF_ALLOC_OR_GOTO(s->avctx, s->cplx_tab,
mb_array_size * sizeof(float), fail);
FF_ALLOC_OR_GOTO(s->avctx, s->bits_tab,
mb_array_size * sizeof(float), fail);
}
if (s->codec_id == AV_CODEC_ID_MPEG4 ||
(s->flags & CODEC_FLAG_INTERLACED_ME)) {
/* interlaced direct mode decoding tables */
for (i = 0; i < 2; i++) {
int j, k;
for (j = 0; j < 2; j++) {
for (k = 0; k < 2; k++) {
FF_ALLOCZ_OR_GOTO(s->avctx,
s->b_field_mv_table_base[i][j][k],
mv_table_size * 2 * sizeof(int16_t),
fail);
s->b_field_mv_table[i][j][k] = s->b_field_mv_table_base[i][j][k] +
s->mb_stride + 1;
}
FF_ALLOCZ_OR_GOTO(s->avctx, s->b_field_select_table [i][j], mb_array_size * 2 * sizeof(uint8_t), fail)
FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_mv_table_base[i][j], mv_table_size * 2 * sizeof(int16_t), fail)
s->p_field_mv_table[i][j] = s->p_field_mv_table_base[i][j] + s->mb_stride + 1;
}
FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_select_table[i], mb_array_size * 2 * sizeof(uint8_t), fail)
}
}
if (s->out_format == FMT_H263) {
/* cbp values */
FF_ALLOCZ_OR_GOTO(s->avctx, s->coded_block_base, y_size + (s->mb_height&1)*2*s->b8_stride, fail);
s->coded_block = s->coded_block_base + s->b8_stride + 1;
/* cbp, ac_pred, pred_dir */
FF_ALLOCZ_OR_GOTO(s->avctx, s->cbp_table , mb_array_size * sizeof(uint8_t), fail);
FF_ALLOCZ_OR_GOTO(s->avctx, s->pred_dir_table, mb_array_size * sizeof(uint8_t), fail);
}
if (s->h263_pred || s->h263_plus || !s->encoding) {
/* dc values */
// MN: we need these for error resilience of intra-frames
FF_ALLOCZ_OR_GOTO(s->avctx, s->dc_val_base, yc_size * sizeof(int16_t), fail);
s->dc_val[0] = s->dc_val_base + s->b8_stride + 1;
s->dc_val[1] = s->dc_val_base + y_size + s->mb_stride + 1;
s->dc_val[2] = s->dc_val[1] + c_size;
for (i = 0; i < yc_size; i++)
s->dc_val_base[i] = 1024;
}
/* which mb is a intra block */
FF_ALLOCZ_OR_GOTO(s->avctx, s->mbintra_table, mb_array_size, fail);
memset(s->mbintra_table, 1, mb_array_size);
/* init macroblock skip table */
FF_ALLOCZ_OR_GOTO(s->avctx, s->mbskip_table, mb_array_size + 2, fail);
// Note the + 1 is for a quicker mpeg4 slice_end detection
return init_er(s);
fail:
return AVERROR(ENOMEM);
}
| false | FFmpeg | 9341e9497b1162726f09c1ff73edc95364b3c21a | static int init_context_frame(MpegEncContext *s)
{
int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y;
s->mb_width = (s->width + 15) / 16;
s->mb_stride = s->mb_width + 1;
s->b8_stride = s->mb_width * 2 + 1;
s->b4_stride = s->mb_width * 4 + 1;
mb_array_size = s->mb_height * s->mb_stride;
mv_table_size = (s->mb_height + 2) * s->mb_stride + 1;
s->h_edge_pos = s->mb_width * 16;
s->v_edge_pos = s->mb_height * 16;
s->mb_num = s->mb_width * s->mb_height;
s->block_wrap[0] =
s->block_wrap[1] =
s->block_wrap[2] =
s->block_wrap[3] = s->b8_stride;
s->block_wrap[4] =
s->block_wrap[5] = s->mb_stride;
y_size = s->b8_stride * (2 * s->mb_height + 1);
c_size = s->mb_stride * (s->mb_height + 1);
yc_size = y_size + 2 * c_size;
if (s->mb_height & 1)
yc_size += 2*s->b8_stride + 2*s->mb_stride;
FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int), fail);
for (y = 0; y < s->mb_height; y++)
for (x = 0; x < s->mb_width; x++)
s->mb_index2xy[x + y * s->mb_width] = x + y * s->mb_stride;
s->mb_index2xy[s->mb_height * s->mb_width] = (s->mb_height - 1) * s->mb_stride + s->mb_width;
if (s->encoding) {
FF_ALLOCZ_OR_GOTO(s->avctx, s->p_mv_table_base, mv_table_size * 2 * sizeof(int16_t), fail)
FF_ALLOCZ_OR_GOTO(s->avctx, s->b_forw_mv_table_base, mv_table_size * 2 * sizeof(int16_t), fail)
FF_ALLOCZ_OR_GOTO(s->avctx, s->b_back_mv_table_base, mv_table_size * 2 * sizeof(int16_t), fail)
FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_forw_mv_table_base, mv_table_size * 2 * sizeof(int16_t), fail)
FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_back_mv_table_base, mv_table_size * 2 * sizeof(int16_t), fail)
FF_ALLOCZ_OR_GOTO(s->avctx, s->b_direct_mv_table_base, mv_table_size * 2 * sizeof(int16_t), fail)
s->p_mv_table = s->p_mv_table_base + s->mb_stride + 1;
s->b_forw_mv_table = s->b_forw_mv_table_base + s->mb_stride + 1;
s->b_back_mv_table = s->b_back_mv_table_base + s->mb_stride + 1;
s->b_bidir_forw_mv_table = s->b_bidir_forw_mv_table_base + s->mb_stride + 1;
s->b_bidir_back_mv_table = s->b_bidir_back_mv_table_base + s->mb_stride + 1;
s->b_direct_mv_table = s->b_direct_mv_table_base + s->mb_stride + 1;
FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_type, mb_array_size * sizeof(uint16_t), fail)
FF_ALLOCZ_OR_GOTO(s->avctx, s->lambda_table, mb_array_size * sizeof(int), fail)
FF_ALLOC_OR_GOTO(s->avctx, s->cplx_tab,
mb_array_size * sizeof(float), fail);
FF_ALLOC_OR_GOTO(s->avctx, s->bits_tab,
mb_array_size * sizeof(float), fail);
}
if (s->codec_id == AV_CODEC_ID_MPEG4 ||
(s->flags & CODEC_FLAG_INTERLACED_ME)) {
for (i = 0; i < 2; i++) {
int j, k;
for (j = 0; j < 2; j++) {
for (k = 0; k < 2; k++) {
FF_ALLOCZ_OR_GOTO(s->avctx,
s->b_field_mv_table_base[i][j][k],
mv_table_size * 2 * sizeof(int16_t),
fail);
s->b_field_mv_table[i][j][k] = s->b_field_mv_table_base[i][j][k] +
s->mb_stride + 1;
}
FF_ALLOCZ_OR_GOTO(s->avctx, s->b_field_select_table [i][j], mb_array_size * 2 * sizeof(uint8_t), fail)
FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_mv_table_base[i][j], mv_table_size * 2 * sizeof(int16_t), fail)
s->p_field_mv_table[i][j] = s->p_field_mv_table_base[i][j] + s->mb_stride + 1;
}
FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_select_table[i], mb_array_size * 2 * sizeof(uint8_t), fail)
}
}
if (s->out_format == FMT_H263) {
FF_ALLOCZ_OR_GOTO(s->avctx, s->coded_block_base, y_size + (s->mb_height&1)*2*s->b8_stride, fail);
s->coded_block = s->coded_block_base + s->b8_stride + 1;
FF_ALLOCZ_OR_GOTO(s->avctx, s->cbp_table , mb_array_size * sizeof(uint8_t), fail);
FF_ALLOCZ_OR_GOTO(s->avctx, s->pred_dir_table, mb_array_size * sizeof(uint8_t), fail);
}
if (s->h263_pred || s->h263_plus || !s->encoding) {
FF_ALLOCZ_OR_GOTO(s->avctx, s->dc_val_base, yc_size * sizeof(int16_t), fail);
s->dc_val[0] = s->dc_val_base + s->b8_stride + 1;
s->dc_val[1] = s->dc_val_base + y_size + s->mb_stride + 1;
s->dc_val[2] = s->dc_val[1] + c_size;
for (i = 0; i < yc_size; i++)
s->dc_val_base[i] = 1024;
}
FF_ALLOCZ_OR_GOTO(s->avctx, s->mbintra_table, mb_array_size, fail);
memset(s->mbintra_table, 1, mb_array_size);
FF_ALLOCZ_OR_GOTO(s->avctx, s->mbskip_table, mb_array_size + 2, fail);
return init_er(s);
fail:
return AVERROR(ENOMEM);
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(MpegEncContext *VAR_0)
{
int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8;
VAR_0->mb_width = (VAR_0->width + 15) / 16;
VAR_0->mb_stride = VAR_0->mb_width + 1;
VAR_0->b8_stride = VAR_0->mb_width * 2 + 1;
VAR_0->b4_stride = VAR_0->mb_width * 4 + 1;
VAR_5 = VAR_0->mb_height * VAR_0->mb_stride;
VAR_6 = (VAR_0->mb_height + 2) * VAR_0->mb_stride + 1;
VAR_0->h_edge_pos = VAR_0->mb_width * 16;
VAR_0->v_edge_pos = VAR_0->mb_height * 16;
VAR_0->mb_num = VAR_0->mb_width * VAR_0->mb_height;
VAR_0->block_wrap[0] =
VAR_0->block_wrap[1] =
VAR_0->block_wrap[2] =
VAR_0->block_wrap[3] = VAR_0->b8_stride;
VAR_0->block_wrap[4] =
VAR_0->block_wrap[5] = VAR_0->mb_stride;
VAR_1 = VAR_0->b8_stride * (2 * VAR_0->mb_height + 1);
VAR_2 = VAR_0->mb_stride * (VAR_0->mb_height + 1);
VAR_3 = VAR_1 + 2 * VAR_2;
if (VAR_0->mb_height & 1)
VAR_3 += 2*VAR_0->b8_stride + 2*VAR_0->mb_stride;
FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->mb_index2xy, (VAR_0->mb_num + 1) * sizeof(int), fail);
for (VAR_8 = 0; VAR_8 < VAR_0->mb_height; VAR_8++)
for (VAR_7 = 0; VAR_7 < VAR_0->mb_width; VAR_7++)
VAR_0->mb_index2xy[VAR_7 + VAR_8 * VAR_0->mb_width] = VAR_7 + VAR_8 * VAR_0->mb_stride;
VAR_0->mb_index2xy[VAR_0->mb_height * VAR_0->mb_width] = (VAR_0->mb_height - 1) * VAR_0->mb_stride + VAR_0->mb_width;
if (VAR_0->encoding) {
FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->p_mv_table_base, VAR_6 * 2 * sizeof(int16_t), fail)
FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->b_forw_mv_table_base, VAR_6 * 2 * sizeof(int16_t), fail)
FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->b_back_mv_table_base, VAR_6 * 2 * sizeof(int16_t), fail)
FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->b_bidir_forw_mv_table_base, VAR_6 * 2 * sizeof(int16_t), fail)
FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->b_bidir_back_mv_table_base, VAR_6 * 2 * sizeof(int16_t), fail)
FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->b_direct_mv_table_base, VAR_6 * 2 * sizeof(int16_t), fail)
VAR_0->p_mv_table = VAR_0->p_mv_table_base + VAR_0->mb_stride + 1;
VAR_0->b_forw_mv_table = VAR_0->b_forw_mv_table_base + VAR_0->mb_stride + 1;
VAR_0->b_back_mv_table = VAR_0->b_back_mv_table_base + VAR_0->mb_stride + 1;
VAR_0->b_bidir_forw_mv_table = VAR_0->b_bidir_forw_mv_table_base + VAR_0->mb_stride + 1;
VAR_0->b_bidir_back_mv_table = VAR_0->b_bidir_back_mv_table_base + VAR_0->mb_stride + 1;
VAR_0->b_direct_mv_table = VAR_0->b_direct_mv_table_base + VAR_0->mb_stride + 1;
FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->mb_type, VAR_5 * sizeof(uint16_t), fail)
FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->lambda_table, VAR_5 * sizeof(int), fail)
FF_ALLOC_OR_GOTO(VAR_0->avctx, VAR_0->cplx_tab,
VAR_5 * sizeof(float), fail);
FF_ALLOC_OR_GOTO(VAR_0->avctx, VAR_0->bits_tab,
VAR_5 * sizeof(float), fail);
}
if (VAR_0->codec_id == AV_CODEC_ID_MPEG4 ||
(VAR_0->flags & CODEC_FLAG_INTERLACED_ME)) {
for (VAR_4 = 0; VAR_4 < 2; VAR_4++) {
int VAR_9, VAR_10;
for (VAR_9 = 0; VAR_9 < 2; VAR_9++) {
for (VAR_10 = 0; VAR_10 < 2; VAR_10++) {
FF_ALLOCZ_OR_GOTO(VAR_0->avctx,
VAR_0->b_field_mv_table_base[VAR_4][VAR_9][VAR_10],
VAR_6 * 2 * sizeof(int16_t),
fail);
VAR_0->b_field_mv_table[VAR_4][VAR_9][VAR_10] = VAR_0->b_field_mv_table_base[VAR_4][VAR_9][VAR_10] +
VAR_0->mb_stride + 1;
}
FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->b_field_select_table [VAR_4][VAR_9], VAR_5 * 2 * sizeof(uint8_t), fail)
FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->p_field_mv_table_base[VAR_4][VAR_9], VAR_6 * 2 * sizeof(int16_t), fail)
VAR_0->p_field_mv_table[VAR_4][VAR_9] = VAR_0->p_field_mv_table_base[VAR_4][VAR_9] + VAR_0->mb_stride + 1;
}
FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->p_field_select_table[VAR_4], VAR_5 * 2 * sizeof(uint8_t), fail)
}
}
if (VAR_0->out_format == FMT_H263) {
FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->coded_block_base, VAR_1 + (VAR_0->mb_height&1)*2*VAR_0->b8_stride, fail);
VAR_0->coded_block = VAR_0->coded_block_base + VAR_0->b8_stride + 1;
FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->cbp_table , VAR_5 * sizeof(uint8_t), fail);
FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->pred_dir_table, VAR_5 * sizeof(uint8_t), fail);
}
if (VAR_0->h263_pred || VAR_0->h263_plus || !VAR_0->encoding) {
FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->dc_val_base, VAR_3 * sizeof(int16_t), fail);
VAR_0->dc_val[0] = VAR_0->dc_val_base + VAR_0->b8_stride + 1;
VAR_0->dc_val[1] = VAR_0->dc_val_base + VAR_1 + VAR_0->mb_stride + 1;
VAR_0->dc_val[2] = VAR_0->dc_val[1] + VAR_2;
for (VAR_4 = 0; VAR_4 < VAR_3; VAR_4++)
VAR_0->dc_val_base[VAR_4] = 1024;
}
FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->mbintra_table, VAR_5, fail);
memset(VAR_0->mbintra_table, 1, VAR_5);
FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->mbskip_table, VAR_5 + 2, fail);
return init_er(VAR_0);
fail:
return AVERROR(ENOMEM);
}
| [
"static int FUNC_0(MpegEncContext *VAR_0)\n{",
"int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8;",
"VAR_0->mb_width = (VAR_0->width + 15) / 16;",
"VAR_0->mb_stride = VAR_0->mb_width + 1;",
"VAR_0->b8_stride = VAR_0->mb_width * 2 + 1;",
"VAR_0->b4_stride = VAR_0->mb_width * 4 + 1;",
"VAR_5 = VAR_0->mb_height * VAR_0->mb_stride;",
"VAR_6 = (VAR_0->mb_height + 2) * VAR_0->mb_stride + 1;",
"VAR_0->h_edge_pos = VAR_0->mb_width * 16;",
"VAR_0->v_edge_pos = VAR_0->mb_height * 16;",
"VAR_0->mb_num = VAR_0->mb_width * VAR_0->mb_height;",
"VAR_0->block_wrap[0] =\nVAR_0->block_wrap[1] =\nVAR_0->block_wrap[2] =\nVAR_0->block_wrap[3] = VAR_0->b8_stride;",
"VAR_0->block_wrap[4] =\nVAR_0->block_wrap[5] = VAR_0->mb_stride;",
"VAR_1 = VAR_0->b8_stride * (2 * VAR_0->mb_height + 1);",
"VAR_2 = VAR_0->mb_stride * (VAR_0->mb_height + 1);",
"VAR_3 = VAR_1 + 2 * VAR_2;",
"if (VAR_0->mb_height & 1)\nVAR_3 += 2*VAR_0->b8_stride + 2*VAR_0->mb_stride;",
"FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->mb_index2xy, (VAR_0->mb_num + 1) * sizeof(int), fail);",
"for (VAR_8 = 0; VAR_8 < VAR_0->mb_height; VAR_8++)",
"for (VAR_7 = 0; VAR_7 < VAR_0->mb_width; VAR_7++)",
"VAR_0->mb_index2xy[VAR_7 + VAR_8 * VAR_0->mb_width] = VAR_7 + VAR_8 * VAR_0->mb_stride;",
"VAR_0->mb_index2xy[VAR_0->mb_height * VAR_0->mb_width] = (VAR_0->mb_height - 1) * VAR_0->mb_stride + VAR_0->mb_width;",
"if (VAR_0->encoding) {",
"FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->p_mv_table_base, VAR_6 * 2 * sizeof(int16_t), fail)\nFF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->b_forw_mv_table_base, VAR_6 * 2 * sizeof(int16_t), fail)\nFF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->b_back_mv_table_base, VAR_6 * 2 * sizeof(int16_t), fail)\nFF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->b_bidir_forw_mv_table_base, VAR_6 * 2 * sizeof(int16_t), fail)\nFF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->b_bidir_back_mv_table_base, VAR_6 * 2 * sizeof(int16_t), fail)\nFF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->b_direct_mv_table_base, VAR_6 * 2 * sizeof(int16_t), fail)\nVAR_0->p_mv_table = VAR_0->p_mv_table_base + VAR_0->mb_stride + 1;",
"VAR_0->b_forw_mv_table = VAR_0->b_forw_mv_table_base + VAR_0->mb_stride + 1;",
"VAR_0->b_back_mv_table = VAR_0->b_back_mv_table_base + VAR_0->mb_stride + 1;",
"VAR_0->b_bidir_forw_mv_table = VAR_0->b_bidir_forw_mv_table_base + VAR_0->mb_stride + 1;",
"VAR_0->b_bidir_back_mv_table = VAR_0->b_bidir_back_mv_table_base + VAR_0->mb_stride + 1;",
"VAR_0->b_direct_mv_table = VAR_0->b_direct_mv_table_base + VAR_0->mb_stride + 1;",
"FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->mb_type, VAR_5 * sizeof(uint16_t), fail)\nFF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->lambda_table, VAR_5 * sizeof(int), fail)\nFF_ALLOC_OR_GOTO(VAR_0->avctx, VAR_0->cplx_tab,\nVAR_5 * sizeof(float), fail);",
"FF_ALLOC_OR_GOTO(VAR_0->avctx, VAR_0->bits_tab,\nVAR_5 * sizeof(float), fail);",
"}",
"if (VAR_0->codec_id == AV_CODEC_ID_MPEG4 ||\n(VAR_0->flags & CODEC_FLAG_INTERLACED_ME)) {",
"for (VAR_4 = 0; VAR_4 < 2; VAR_4++) {",
"int VAR_9, VAR_10;",
"for (VAR_9 = 0; VAR_9 < 2; VAR_9++) {",
"for (VAR_10 = 0; VAR_10 < 2; VAR_10++) {",
"FF_ALLOCZ_OR_GOTO(VAR_0->avctx,\nVAR_0->b_field_mv_table_base[VAR_4][VAR_9][VAR_10],\nVAR_6 * 2 * sizeof(int16_t),\nfail);",
"VAR_0->b_field_mv_table[VAR_4][VAR_9][VAR_10] = VAR_0->b_field_mv_table_base[VAR_4][VAR_9][VAR_10] +\nVAR_0->mb_stride + 1;",
"}",
"FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->b_field_select_table [VAR_4][VAR_9], VAR_5 * 2 * sizeof(uint8_t), fail)\nFF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->p_field_mv_table_base[VAR_4][VAR_9], VAR_6 * 2 * sizeof(int16_t), fail)\nVAR_0->p_field_mv_table[VAR_4][VAR_9] = VAR_0->p_field_mv_table_base[VAR_4][VAR_9] + VAR_0->mb_stride + 1;",
"}",
"FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->p_field_select_table[VAR_4], VAR_5 * 2 * sizeof(uint8_t), fail)\n}",
"}",
"if (VAR_0->out_format == FMT_H263) {",
"FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->coded_block_base, VAR_1 + (VAR_0->mb_height&1)*2*VAR_0->b8_stride, fail);",
"VAR_0->coded_block = VAR_0->coded_block_base + VAR_0->b8_stride + 1;",
"FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->cbp_table , VAR_5 * sizeof(uint8_t), fail);",
"FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->pred_dir_table, VAR_5 * sizeof(uint8_t), fail);",
"}",
"if (VAR_0->h263_pred || VAR_0->h263_plus || !VAR_0->encoding) {",
"FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->dc_val_base, VAR_3 * sizeof(int16_t), fail);",
"VAR_0->dc_val[0] = VAR_0->dc_val_base + VAR_0->b8_stride + 1;",
"VAR_0->dc_val[1] = VAR_0->dc_val_base + VAR_1 + VAR_0->mb_stride + 1;",
"VAR_0->dc_val[2] = VAR_0->dc_val[1] + VAR_2;",
"for (VAR_4 = 0; VAR_4 < VAR_3; VAR_4++)",
"VAR_0->dc_val_base[VAR_4] = 1024;",
"}",
"FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->mbintra_table, VAR_5, fail);",
"memset(VAR_0->mbintra_table, 1, VAR_5);",
"FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->mbskip_table, VAR_5 + 2, fail);",
"return init_er(VAR_0);",
"fail:\nreturn AVERROR(ENOMEM);",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
27
],
[
29
],
[
33
],
[
37,
39,
41,
43
],
[
45,
47
],
[
51
],
[
53
],
[
55
],
[
59,
61
],
[
65
],
[
67
],
[
69
],
[
71
],
[
75
],
[
79
],
[
83,
85,
87,
89,
91,
93,
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
111,
115,
119,
121
],
[
123,
125
],
[
129
],
[
133,
135
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147,
149,
151,
153
],
[
155,
157
],
[
159
],
[
161,
163,
165
],
[
167
],
[
169,
171
],
[
173
],
[
175
],
[
179
],
[
181
],
[
187
],
[
189
],
[
191
],
[
195
],
[
201
],
[
203
],
[
205
],
[
207
],
[
209
],
[
211
],
[
213
],
[
219
],
[
221
],
[
227
],
[
233
],
[
235,
237
],
[
239
]
] |
19,680 | static void mpeg4_encode_gop_header(MpegEncContext * s){
int hours, minutes, seconds;
int64_t time;
put_bits(&s->pb, 16, 0);
put_bits(&s->pb, 16, GOP_STARTCODE);
time= s->current_picture_ptr->pts;
if(s->reordered_input_picture[1])
time= FFMIN(time, s->reordered_input_picture[1]->pts);
time= time*s->avctx->time_base.num;
seconds= time/s->avctx->time_base.den;
minutes= seconds/60; seconds %= 60;
hours= minutes/60; minutes %= 60;
hours%=24;
put_bits(&s->pb, 5, hours);
put_bits(&s->pb, 6, minutes);
put_bits(&s->pb, 1, 1);
put_bits(&s->pb, 6, seconds);
put_bits(&s->pb, 1, !!(s->flags&CODEC_FLAG_CLOSED_GOP));
put_bits(&s->pb, 1, 0); //broken link == NO
s->last_time_base= time / s->avctx->time_base.den;
ff_mpeg4_stuffing(&s->pb);
}
| false | FFmpeg | 38bb5a5434f913451aa512624a92b12b9925690f | static void mpeg4_encode_gop_header(MpegEncContext * s){
int hours, minutes, seconds;
int64_t time;
put_bits(&s->pb, 16, 0);
put_bits(&s->pb, 16, GOP_STARTCODE);
time= s->current_picture_ptr->pts;
if(s->reordered_input_picture[1])
time= FFMIN(time, s->reordered_input_picture[1]->pts);
time= time*s->avctx->time_base.num;
seconds= time/s->avctx->time_base.den;
minutes= seconds/60; seconds %= 60;
hours= minutes/60; minutes %= 60;
hours%=24;
put_bits(&s->pb, 5, hours);
put_bits(&s->pb, 6, minutes);
put_bits(&s->pb, 1, 1);
put_bits(&s->pb, 6, seconds);
put_bits(&s->pb, 1, !!(s->flags&CODEC_FLAG_CLOSED_GOP));
put_bits(&s->pb, 1, 0);
s->last_time_base= time / s->avctx->time_base.den;
ff_mpeg4_stuffing(&s->pb);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(MpegEncContext * VAR_0){
int VAR_1, VAR_2, VAR_3;
int64_t time;
put_bits(&VAR_0->pb, 16, 0);
put_bits(&VAR_0->pb, 16, GOP_STARTCODE);
time= VAR_0->current_picture_ptr->pts;
if(VAR_0->reordered_input_picture[1])
time= FFMIN(time, VAR_0->reordered_input_picture[1]->pts);
time= time*VAR_0->avctx->time_base.num;
VAR_3= time/VAR_0->avctx->time_base.den;
VAR_2= VAR_3/60; VAR_3 %= 60;
VAR_1= VAR_2/60; VAR_2 %= 60;
VAR_1%=24;
put_bits(&VAR_0->pb, 5, VAR_1);
put_bits(&VAR_0->pb, 6, VAR_2);
put_bits(&VAR_0->pb, 1, 1);
put_bits(&VAR_0->pb, 6, VAR_3);
put_bits(&VAR_0->pb, 1, !!(VAR_0->flags&CODEC_FLAG_CLOSED_GOP));
put_bits(&VAR_0->pb, 1, 0);
VAR_0->last_time_base= time / VAR_0->avctx->time_base.den;
ff_mpeg4_stuffing(&VAR_0->pb);
}
| [
"static void FUNC_0(MpegEncContext * VAR_0){",
"int VAR_1, VAR_2, VAR_3;",
"int64_t time;",
"put_bits(&VAR_0->pb, 16, 0);",
"put_bits(&VAR_0->pb, 16, GOP_STARTCODE);",
"time= VAR_0->current_picture_ptr->pts;",
"if(VAR_0->reordered_input_picture[1])\ntime= FFMIN(time, VAR_0->reordered_input_picture[1]->pts);",
"time= time*VAR_0->avctx->time_base.num;",
"VAR_3= time/VAR_0->avctx->time_base.den;",
"VAR_2= VAR_3/60; VAR_3 %= 60;",
"VAR_1= VAR_2/60; VAR_2 %= 60;",
"VAR_1%=24;",
"put_bits(&VAR_0->pb, 5, VAR_1);",
"put_bits(&VAR_0->pb, 6, VAR_2);",
"put_bits(&VAR_0->pb, 1, 1);",
"put_bits(&VAR_0->pb, 6, VAR_3);",
"put_bits(&VAR_0->pb, 1, !!(VAR_0->flags&CODEC_FLAG_CLOSED_GOP));",
"put_bits(&VAR_0->pb, 1, 0);",
"VAR_0->last_time_base= time / VAR_0->avctx->time_base.den;",
"ff_mpeg4_stuffing(&VAR_0->pb);",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1
],
[
3
],
[
5
],
[
9
],
[
11
],
[
15
],
[
17,
19
],
[
21
],
[
25
],
[
27
],
[
29
],
[
31
],
[
35
],
[
37
],
[
39
],
[
41
],
[
45
],
[
47
],
[
51
],
[
55
],
[
57
]
] |
19,681 | static int ws_snd_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
// WSSNDContext *c = avctx->priv_data;
int in_size, out_size;
int sample = 128;
int i;
uint8_t *samples = data;
uint8_t *samples_end;
if (!buf_size)
return 0;
if (buf_size < 4) {
av_log(avctx, AV_LOG_ERROR, "packet is too small\n");
return AVERROR(EINVAL);
}
out_size = AV_RL16(&buf[0]);
in_size = AV_RL16(&buf[2]);
buf += 4;
if (out_size > *data_size) {
av_log(avctx, AV_LOG_ERROR, "Frame is too large to fit in buffer\n");
return -1;
}
if (in_size > buf_size) {
av_log(avctx, AV_LOG_ERROR, "Frame data is larger than input buffer\n");
return -1;
}
samples_end = samples + out_size;
if (in_size == out_size) {
for (i = 0; i < out_size; i++)
*samples++ = *buf++;
*data_size = out_size;
return buf_size;
}
while (samples < samples_end && buf - avpkt->data < buf_size) {
int code, smp, size;
uint8_t count;
code = (*buf) >> 6;
count = (*buf) & 0x3F;
buf++;
/* make sure we don't write past the output buffer */
switch (code) {
case 0: smp = 4; break;
case 1: smp = 2; break;
case 2: smp = (count & 0x20) ? 1 : count + 1; break;
default: smp = count + 1; break;
}
if (samples_end - samples < smp)
break;
/* make sure we don't read past the input buffer */
size = ((code == 2 && (count & 0x20)) || code == 3) ? 0 : count + 1;
if ((buf - avpkt->data) + size > buf_size)
break;
switch(code) {
case 0: /* ADPCM 2-bit */
for (count++; count > 0; count--) {
code = *buf++;
sample += ws_adpcm_2bit[code & 0x3];
sample = av_clip_uint8(sample);
*samples++ = sample;
sample += ws_adpcm_2bit[(code >> 2) & 0x3];
sample = av_clip_uint8(sample);
*samples++ = sample;
sample += ws_adpcm_2bit[(code >> 4) & 0x3];
sample = av_clip_uint8(sample);
*samples++ = sample;
sample += ws_adpcm_2bit[(code >> 6) & 0x3];
sample = av_clip_uint8(sample);
*samples++ = sample;
}
break;
case 1: /* ADPCM 4-bit */
for (count++; count > 0; count--) {
code = *buf++;
sample += ws_adpcm_4bit[code & 0xF];
sample = av_clip_uint8(sample);
*samples++ = sample;
sample += ws_adpcm_4bit[code >> 4];
sample = av_clip_uint8(sample);
*samples++ = sample;
}
break;
case 2: /* no compression */
if (count & 0x20) { /* big delta */
int8_t t;
t = count;
t <<= 3;
sample += t >> 3;
sample = av_clip_uint8(sample);
*samples++ = sample;
} else { /* copy */
for (count++; count > 0; count--) {
*samples++ = *buf++;
}
sample = buf[-1];
}
break;
default: /* run */
for(count++; count > 0; count--) {
*samples++ = sample;
}
}
}
*data_size = samples - (uint8_t *)data;
return buf_size;
}
| false | FFmpeg | 618b067d2132b0336e609bc311e85c557ffb30ed | static int ws_snd_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
int in_size, out_size;
int sample = 128;
int i;
uint8_t *samples = data;
uint8_t *samples_end;
if (!buf_size)
return 0;
if (buf_size < 4) {
av_log(avctx, AV_LOG_ERROR, "packet is too small\n");
return AVERROR(EINVAL);
}
out_size = AV_RL16(&buf[0]);
in_size = AV_RL16(&buf[2]);
buf += 4;
if (out_size > *data_size) {
av_log(avctx, AV_LOG_ERROR, "Frame is too large to fit in buffer\n");
return -1;
}
if (in_size > buf_size) {
av_log(avctx, AV_LOG_ERROR, "Frame data is larger than input buffer\n");
return -1;
}
samples_end = samples + out_size;
if (in_size == out_size) {
for (i = 0; i < out_size; i++)
*samples++ = *buf++;
*data_size = out_size;
return buf_size;
}
while (samples < samples_end && buf - avpkt->data < buf_size) {
int code, smp, size;
uint8_t count;
code = (*buf) >> 6;
count = (*buf) & 0x3F;
buf++;
switch (code) {
case 0: smp = 4; break;
case 1: smp = 2; break;
case 2: smp = (count & 0x20) ? 1 : count + 1; break;
default: smp = count + 1; break;
}
if (samples_end - samples < smp)
break;
size = ((code == 2 && (count & 0x20)) || code == 3) ? 0 : count + 1;
if ((buf - avpkt->data) + size > buf_size)
break;
switch(code) {
case 0:
for (count++; count > 0; count--) {
code = *buf++;
sample += ws_adpcm_2bit[code & 0x3];
sample = av_clip_uint8(sample);
*samples++ = sample;
sample += ws_adpcm_2bit[(code >> 2) & 0x3];
sample = av_clip_uint8(sample);
*samples++ = sample;
sample += ws_adpcm_2bit[(code >> 4) & 0x3];
sample = av_clip_uint8(sample);
*samples++ = sample;
sample += ws_adpcm_2bit[(code >> 6) & 0x3];
sample = av_clip_uint8(sample);
*samples++ = sample;
}
break;
case 1:
for (count++; count > 0; count--) {
code = *buf++;
sample += ws_adpcm_4bit[code & 0xF];
sample = av_clip_uint8(sample);
*samples++ = sample;
sample += ws_adpcm_4bit[code >> 4];
sample = av_clip_uint8(sample);
*samples++ = sample;
}
break;
case 2:
if (count & 0x20) {
int8_t t;
t = count;
t <<= 3;
sample += t >> 3;
sample = av_clip_uint8(sample);
*samples++ = sample;
} else {
for (count++; count > 0; count--) {
*samples++ = *buf++;
}
sample = buf[-1];
}
break;
default:
for(count++; count > 0; count--) {
*samples++ = sample;
}
}
}
*data_size = samples - (uint8_t *)data;
return buf_size;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(AVCodecContext *VAR_0,
void *VAR_1, int *VAR_2,
AVPacket *VAR_3)
{
const uint8_t *VAR_4 = VAR_3->VAR_1;
int VAR_5 = VAR_3->VAR_12;
int VAR_6, VAR_7;
int VAR_8 = 128;
int VAR_9;
uint8_t *samples = VAR_1;
uint8_t *samples_end;
if (!VAR_5)
return 0;
if (VAR_5 < 4) {
av_log(VAR_0, AV_LOG_ERROR, "packet is too small\n");
return AVERROR(EINVAL);
}
VAR_7 = AV_RL16(&VAR_4[0]);
VAR_6 = AV_RL16(&VAR_4[2]);
VAR_4 += 4;
if (VAR_7 > *VAR_2) {
av_log(VAR_0, AV_LOG_ERROR, "Frame is too large to fit in buffer\n");
return -1;
}
if (VAR_6 > VAR_5) {
av_log(VAR_0, AV_LOG_ERROR, "Frame VAR_1 is larger than input buffer\n");
return -1;
}
samples_end = samples + VAR_7;
if (VAR_6 == VAR_7) {
for (VAR_9 = 0; VAR_9 < VAR_7; VAR_9++)
*samples++ = *VAR_4++;
*VAR_2 = VAR_7;
return VAR_5;
}
while (samples < samples_end && VAR_4 - VAR_3->VAR_1 < VAR_5) {
int VAR_10, VAR_11, VAR_12;
uint8_t count;
VAR_10 = (*VAR_4) >> 6;
count = (*VAR_4) & 0x3F;
VAR_4++;
switch (VAR_10) {
case 0: VAR_11 = 4; break;
case 1: VAR_11 = 2; break;
case 2: VAR_11 = (count & 0x20) ? 1 : count + 1; break;
default: VAR_11 = count + 1; break;
}
if (samples_end - samples < VAR_11)
break;
VAR_12 = ((VAR_10 == 2 && (count & 0x20)) || VAR_10 == 3) ? 0 : count + 1;
if ((VAR_4 - VAR_3->VAR_1) + VAR_12 > VAR_5)
break;
switch(VAR_10) {
case 0:
for (count++; count > 0; count--) {
VAR_10 = *VAR_4++;
VAR_8 += ws_adpcm_2bit[VAR_10 & 0x3];
VAR_8 = av_clip_uint8(VAR_8);
*samples++ = VAR_8;
VAR_8 += ws_adpcm_2bit[(VAR_10 >> 2) & 0x3];
VAR_8 = av_clip_uint8(VAR_8);
*samples++ = VAR_8;
VAR_8 += ws_adpcm_2bit[(VAR_10 >> 4) & 0x3];
VAR_8 = av_clip_uint8(VAR_8);
*samples++ = VAR_8;
VAR_8 += ws_adpcm_2bit[(VAR_10 >> 6) & 0x3];
VAR_8 = av_clip_uint8(VAR_8);
*samples++ = VAR_8;
}
break;
case 1:
for (count++; count > 0; count--) {
VAR_10 = *VAR_4++;
VAR_8 += ws_adpcm_4bit[VAR_10 & 0xF];
VAR_8 = av_clip_uint8(VAR_8);
*samples++ = VAR_8;
VAR_8 += ws_adpcm_4bit[VAR_10 >> 4];
VAR_8 = av_clip_uint8(VAR_8);
*samples++ = VAR_8;
}
break;
case 2:
if (count & 0x20) {
int8_t t;
t = count;
t <<= 3;
VAR_8 += t >> 3;
VAR_8 = av_clip_uint8(VAR_8);
*samples++ = VAR_8;
} else {
for (count++; count > 0; count--) {
*samples++ = *VAR_4++;
}
VAR_8 = VAR_4[-1];
}
break;
default:
for(count++; count > 0; count--) {
*samples++ = VAR_8;
}
}
}
*VAR_2 = samples - (uint8_t *)VAR_1;
return VAR_5;
}
| [
"static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{",
"const uint8_t *VAR_4 = VAR_3->VAR_1;",
"int VAR_5 = VAR_3->VAR_12;",
"int VAR_6, VAR_7;",
"int VAR_8 = 128;",
"int VAR_9;",
"uint8_t *samples = VAR_1;",
"uint8_t *samples_end;",
"if (!VAR_5)\nreturn 0;",
"if (VAR_5 < 4) {",
"av_log(VAR_0, AV_LOG_ERROR, \"packet is too small\\n\");",
"return AVERROR(EINVAL);",
"}",
"VAR_7 = AV_RL16(&VAR_4[0]);",
"VAR_6 = AV_RL16(&VAR_4[2]);",
"VAR_4 += 4;",
"if (VAR_7 > *VAR_2) {",
"av_log(VAR_0, AV_LOG_ERROR, \"Frame is too large to fit in buffer\\n\");",
"return -1;",
"}",
"if (VAR_6 > VAR_5) {",
"av_log(VAR_0, AV_LOG_ERROR, \"Frame VAR_1 is larger than input buffer\\n\");",
"return -1;",
"}",
"samples_end = samples + VAR_7;",
"if (VAR_6 == VAR_7) {",
"for (VAR_9 = 0; VAR_9 < VAR_7; VAR_9++)",
"*samples++ = *VAR_4++;",
"*VAR_2 = VAR_7;",
"return VAR_5;",
"}",
"while (samples < samples_end && VAR_4 - VAR_3->VAR_1 < VAR_5) {",
"int VAR_10, VAR_11, VAR_12;",
"uint8_t count;",
"VAR_10 = (*VAR_4) >> 6;",
"count = (*VAR_4) & 0x3F;",
"VAR_4++;",
"switch (VAR_10) {",
"case 0: VAR_11 = 4; break;",
"case 1: VAR_11 = 2; break;",
"case 2: VAR_11 = (count & 0x20) ? 1 : count + 1; break;",
"default: VAR_11 = count + 1; break;",
"}",
"if (samples_end - samples < VAR_11)\nbreak;",
"VAR_12 = ((VAR_10 == 2 && (count & 0x20)) || VAR_10 == 3) ? 0 : count + 1;",
"if ((VAR_4 - VAR_3->VAR_1) + VAR_12 > VAR_5)\nbreak;",
"switch(VAR_10) {",
"case 0:\nfor (count++; count > 0; count--) {",
"VAR_10 = *VAR_4++;",
"VAR_8 += ws_adpcm_2bit[VAR_10 & 0x3];",
"VAR_8 = av_clip_uint8(VAR_8);",
"*samples++ = VAR_8;",
"VAR_8 += ws_adpcm_2bit[(VAR_10 >> 2) & 0x3];",
"VAR_8 = av_clip_uint8(VAR_8);",
"*samples++ = VAR_8;",
"VAR_8 += ws_adpcm_2bit[(VAR_10 >> 4) & 0x3];",
"VAR_8 = av_clip_uint8(VAR_8);",
"*samples++ = VAR_8;",
"VAR_8 += ws_adpcm_2bit[(VAR_10 >> 6) & 0x3];",
"VAR_8 = av_clip_uint8(VAR_8);",
"*samples++ = VAR_8;",
"}",
"break;",
"case 1:\nfor (count++; count > 0; count--) {",
"VAR_10 = *VAR_4++;",
"VAR_8 += ws_adpcm_4bit[VAR_10 & 0xF];",
"VAR_8 = av_clip_uint8(VAR_8);",
"*samples++ = VAR_8;",
"VAR_8 += ws_adpcm_4bit[VAR_10 >> 4];",
"VAR_8 = av_clip_uint8(VAR_8);",
"*samples++ = VAR_8;",
"}",
"break;",
"case 2:\nif (count & 0x20) {",
"int8_t t;",
"t = count;",
"t <<= 3;",
"VAR_8 += t >> 3;",
"VAR_8 = av_clip_uint8(VAR_8);",
"*samples++ = VAR_8;",
"} else {",
"for (count++; count > 0; count--) {",
"*samples++ = *VAR_4++;",
"}",
"VAR_8 = VAR_4[-1];",
"}",
"break;",
"default:\nfor(count++; count > 0; count--) {",
"*samples++ = VAR_8;",
"}",
"}",
"}",
"*VAR_2 = samples - (uint8_t *)VAR_1;",
"return VAR_5;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5,
7
],
[
9
],
[
11
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
29,
31
],
[
35
],
[
37
],
[
39
],
[
41
],
[
45
],
[
47
],
[
49
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115,
117
],
[
123
],
[
125,
127
],
[
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
],
[
233
],
[
237
],
[
239
]
] |
19,683 | static int doTest(uint8_t *ref[3], int refStride[3], int w, int h, int srcFormat, int dstFormat,
int srcW, int srcH, int dstW, int dstH, int flags){
uint8_t *src[3];
uint8_t *dst[3];
uint8_t *out[3];
int srcStride[3], dstStride[3];
int i;
uint64_t ssdY, ssdU, ssdV;
struct SwsContext *srcContext, *dstContext, *outContext;
int res;
res = 0;
for(i=0; i<3; i++){
// avoid stride % bpp != 0
if(srcFormat==PIX_FMT_RGB24 || srcFormat==PIX_FMT_BGR24)
srcStride[i]= srcW*3;
else
srcStride[i]= srcW*4;
if(dstFormat==PIX_FMT_RGB24 || dstFormat==PIX_FMT_BGR24)
dstStride[i]= dstW*3;
else
dstStride[i]= dstW*4;
src[i]= (uint8_t*) malloc(srcStride[i]*srcH);
dst[i]= (uint8_t*) malloc(dstStride[i]*dstH);
out[i]= (uint8_t*) malloc(refStride[i]*h);
if ((src[i] == NULL) || (dst[i] == NULL) || (out[i] == NULL)) {
perror("Malloc");
res = -1;
goto end;
}
}
dstContext = outContext = NULL;
srcContext= sws_getContext(w, h, PIX_FMT_YUV420P, srcW, srcH, srcFormat, flags, NULL, NULL, NULL);
if (srcContext == NULL) {
fprintf(stderr, "Failed to get %s ---> %s\n",
sws_format_name(PIX_FMT_YUV420P),
sws_format_name(srcFormat));
res = -1;
goto end;
}
dstContext= sws_getContext(srcW, srcH, srcFormat, dstW, dstH, dstFormat, flags, NULL, NULL, NULL);
if (dstContext == NULL) {
fprintf(stderr, "Failed to get %s ---> %s\n",
sws_format_name(srcFormat),
sws_format_name(dstFormat));
res = -1;
goto end;
}
outContext= sws_getContext(dstW, dstH, dstFormat, w, h, PIX_FMT_YUV420P, flags, NULL, NULL, NULL);
if (outContext == NULL) {
fprintf(stderr, "Failed to get %s ---> %s\n",
sws_format_name(dstFormat),
sws_format_name(PIX_FMT_YUV420P));
res = -1;
goto end;
}
// printf("test %X %X %X -> %X %X %X\n", (int)ref[0], (int)ref[1], (int)ref[2],
// (int)src[0], (int)src[1], (int)src[2]);
sws_scale(srcContext, ref, refStride, 0, h , src, srcStride);
sws_scale(dstContext, src, srcStride, 0, srcH, dst, dstStride);
sws_scale(outContext, dst, dstStride, 0, dstH, out, refStride);
#if defined(ARCH_X86)
asm volatile ("emms\n\t");
#endif
ssdY= getSSD(ref[0], out[0], refStride[0], refStride[0], w, h);
ssdU= getSSD(ref[1], out[1], refStride[1], refStride[1], (w+1)>>1, (h+1)>>1);
ssdV= getSSD(ref[2], out[2], refStride[2], refStride[2], (w+1)>>1, (h+1)>>1);
if(srcFormat == PIX_FMT_GRAY8 || dstFormat==PIX_FMT_GRAY8) ssdU=ssdV=0; //FIXME check that output is really gray
ssdY/= w*h;
ssdU/= w*h/4;
ssdV/= w*h/4;
if(ssdY>100 || ssdU>100 || ssdV>100){
printf(" %s %dx%d -> %s %4dx%4d flags=%2d SSD=%5lld,%5lld,%5lld\n",
sws_format_name(srcFormat), srcW, srcH,
sws_format_name(dstFormat), dstW, dstH,
flags,
ssdY, ssdU, ssdV);
}
end:
sws_freeContext(srcContext);
sws_freeContext(dstContext);
sws_freeContext(outContext);
for(i=0; i<3; i++){
free(src[i]);
free(dst[i]);
free(out[i]);
}
return res;
}
| true | FFmpeg | 221b804f3491638ecf2eec1302c669ad2d9ec799 | static int doTest(uint8_t *ref[3], int refStride[3], int w, int h, int srcFormat, int dstFormat,
int srcW, int srcH, int dstW, int dstH, int flags){
uint8_t *src[3];
uint8_t *dst[3];
uint8_t *out[3];
int srcStride[3], dstStride[3];
int i;
uint64_t ssdY, ssdU, ssdV;
struct SwsContext *srcContext, *dstContext, *outContext;
int res;
res = 0;
for(i=0; i<3; i++){
if(srcFormat==PIX_FMT_RGB24 || srcFormat==PIX_FMT_BGR24)
srcStride[i]= srcW*3;
else
srcStride[i]= srcW*4;
if(dstFormat==PIX_FMT_RGB24 || dstFormat==PIX_FMT_BGR24)
dstStride[i]= dstW*3;
else
dstStride[i]= dstW*4;
src[i]= (uint8_t*) malloc(srcStride[i]*srcH);
dst[i]= (uint8_t*) malloc(dstStride[i]*dstH);
out[i]= (uint8_t*) malloc(refStride[i]*h);
if ((src[i] == NULL) || (dst[i] == NULL) || (out[i] == NULL)) {
perror("Malloc");
res = -1;
goto end;
}
}
dstContext = outContext = NULL;
srcContext= sws_getContext(w, h, PIX_FMT_YUV420P, srcW, srcH, srcFormat, flags, NULL, NULL, NULL);
if (srcContext == NULL) {
fprintf(stderr, "Failed to get %s ---> %s\n",
sws_format_name(PIX_FMT_YUV420P),
sws_format_name(srcFormat));
res = -1;
goto end;
}
dstContext= sws_getContext(srcW, srcH, srcFormat, dstW, dstH, dstFormat, flags, NULL, NULL, NULL);
if (dstContext == NULL) {
fprintf(stderr, "Failed to get %s ---> %s\n",
sws_format_name(srcFormat),
sws_format_name(dstFormat));
res = -1;
goto end;
}
outContext= sws_getContext(dstW, dstH, dstFormat, w, h, PIX_FMT_YUV420P, flags, NULL, NULL, NULL);
if (outContext == NULL) {
fprintf(stderr, "Failed to get %s ---> %s\n",
sws_format_name(dstFormat),
sws_format_name(PIX_FMT_YUV420P));
res = -1;
goto end;
}
sws_scale(srcContext, ref, refStride, 0, h , src, srcStride);
sws_scale(dstContext, src, srcStride, 0, srcH, dst, dstStride);
sws_scale(outContext, dst, dstStride, 0, dstH, out, refStride);
#if defined(ARCH_X86)
asm volatile ("emms\n\t");
#endif
ssdY= getSSD(ref[0], out[0], refStride[0], refStride[0], w, h);
ssdU= getSSD(ref[1], out[1], refStride[1], refStride[1], (w+1)>>1, (h+1)>>1);
ssdV= getSSD(ref[2], out[2], refStride[2], refStride[2], (w+1)>>1, (h+1)>>1);
if(srcFormat == PIX_FMT_GRAY8 || dstFormat==PIX_FMT_GRAY8) ssdU=ssdV=0;
ssdY/= w*h;
ssdU/= w*h/4;
ssdV/= w*h/4;
if(ssdY>100 || ssdU>100 || ssdV>100){
printf(" %s %dx%d -> %s %4dx%4d flags=%2d SSD=%5lld,%5lld,%5lld\n",
sws_format_name(srcFormat), srcW, srcH,
sws_format_name(dstFormat), dstW, dstH,
flags,
ssdY, ssdU, ssdV);
}
end:
sws_freeContext(srcContext);
sws_freeContext(dstContext);
sws_freeContext(outContext);
for(i=0; i<3; i++){
free(src[i]);
free(dst[i]);
free(out[i]);
}
return res;
}
| {
"code": [
" int srcW, int srcH, int dstW, int dstH, int flags){",
"\tuint8_t *src[3];",
"\tuint8_t *dst[3];",
"\tuint8_t *out[3];",
"\tint srcStride[3], dstStride[3];",
"\tint i;",
"\tuint64_t ssdY, ssdU, ssdV;",
"\tstruct SwsContext *srcContext, *dstContext, *outContext;",
"\tint res;",
"\tres = 0;",
"\tfor(i=0; i<3; i++){",
"\t\tif(srcFormat==PIX_FMT_RGB24 || srcFormat==PIX_FMT_BGR24)",
"\t\t\tsrcStride[i]= srcW*3;",
"\t\t\tsrcStride[i]= srcW*4;",
"\t\tif(dstFormat==PIX_FMT_RGB24 || dstFormat==PIX_FMT_BGR24)",
"\t\t\tdstStride[i]= dstW*3;",
"\t\t\tdstStride[i]= dstW*4;",
"\t\tsrc[i]= (uint8_t*) malloc(srcStride[i]*srcH);",
"\t\tdst[i]= (uint8_t*) malloc(dstStride[i]*dstH);",
"\t\tout[i]= (uint8_t*) malloc(refStride[i]*h);",
"\t\tif ((src[i] == NULL) || (dst[i] == NULL) || (out[i] == NULL)) {",
"\t\t\tperror(\"Malloc\");",
"\t\t\tres = -1;",
"\t\t\tgoto end;",
"\tdstContext = outContext = NULL;",
"\tsrcContext= sws_getContext(w, h, PIX_FMT_YUV420P, srcW, srcH, srcFormat, flags, NULL, NULL, NULL);",
"\tif (srcContext == NULL) {",
"\t\tfprintf(stderr, \"Failed to get %s ---> %s\\n\",",
"\t\t\t\tsws_format_name(PIX_FMT_YUV420P),",
"\t\t\t\tsws_format_name(srcFormat));",
"\t\tres = -1;",
"\t\tgoto end;",
"\tdstContext= sws_getContext(srcW, srcH, srcFormat, dstW, dstH, dstFormat, flags, NULL, NULL, NULL);",
"\tif (dstContext == NULL) {",
"\t\tfprintf(stderr, \"Failed to get %s ---> %s\\n\",",
"\t\t\t\tsws_format_name(srcFormat),",
"\t\t\t\tsws_format_name(dstFormat));",
"\t\tres = -1;",
"\t\tgoto end;",
"\toutContext= sws_getContext(dstW, dstH, dstFormat, w, h, PIX_FMT_YUV420P, flags, NULL, NULL, NULL);",
"\tif (outContext == NULL) {",
"\t\tfprintf(stderr, \"Failed to get %s ---> %s\\n\",",
"\t\t\t\tsws_format_name(dstFormat),",
"\t\t\t\tsws_format_name(PIX_FMT_YUV420P));",
"\t\tres = -1;",
"\t\tgoto end;",
"\tsws_scale(srcContext, ref, refStride, 0, h , src, srcStride);",
"\tsws_scale(dstContext, src, srcStride, 0, srcH, dst, dstStride);",
"\tsws_scale(outContext, dst, dstStride, 0, dstH, out, refStride);",
"\tasm volatile (\"emms\\n\\t\");",
"\tssdY= getSSD(ref[0], out[0], refStride[0], refStride[0], w, h);",
"\tssdU= getSSD(ref[1], out[1], refStride[1], refStride[1], (w+1)>>1, (h+1)>>1);",
"\tssdV= getSSD(ref[2], out[2], refStride[2], refStride[2], (w+1)>>1, (h+1)>>1);",
"\tssdY/= w*h;",
"\tssdU/= w*h/4;",
"\tssdV/= w*h/4;",
"\tif(ssdY>100 || ssdU>100 || ssdV>100){",
"\t\tprintf(\" %s %dx%d -> %s %4dx%4d flags=%2d SSD=%5lld,%5lld,%5lld\\n\",",
"\t\t\tsws_format_name(srcFormat), srcW, srcH,",
"\t\t\tsws_format_name(dstFormat), dstW, dstH,",
"\t\t\tflags,",
"\t\t\tssdY, ssdU, ssdV);",
"\tend:",
"\tsws_freeContext(srcContext);",
"\tsws_freeContext(dstContext);",
"\tsws_freeContext(outContext);",
"\tfor(i=0; i<3; i++){",
"\t\tfree(src[i]);",
"\t\tfree(dst[i]);",
"\t\tfree(out[i]);",
"\treturn res;",
"\tasm volatile (\"emms\\n\\t\");",
"\tint i;",
"\tint i;",
"\tint i;",
"\tint i;",
"\tint i;",
"\tint i;",
"\tint i;",
"\tint i;",
"\tint i;",
"\tint i;",
"\tint i;",
"\tint i;",
"\tint i;",
"\tint i;",
"\tint i;",
"\tint i;"
],
"line_no": [
3,
5,
7,
9,
11,
13,
15,
17,
19,
23,
25,
29,
31,
35,
39,
41,
45,
49,
51,
53,
55,
57,
59,
63,
71,
73,
75,
77,
79,
81,
83,
87,
91,
93,
77,
97,
99,
83,
87,
109,
111,
77,
115,
117,
83,
87,
133,
135,
137,
143,
149,
151,
153,
161,
163,
165,
169,
171,
173,
175,
177,
179,
185,
189,
191,
193,
25,
199,
201,
203,
209,
143,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13
]
} | static int FUNC_0(uint8_t *VAR_0[3], int VAR_1[3], int VAR_2, int VAR_3, int VAR_4, int VAR_5,
int VAR_6, int VAR_7, int VAR_8, int VAR_9, int VAR_10){
uint8_t *src[3];
uint8_t *dst[3];
uint8_t *out[3];
int VAR_11[3], VAR_12[3];
int VAR_13;
uint64_t ssdY, ssdU, ssdV;
struct SwsContext *VAR_14, *VAR_15, *VAR_16;
int VAR_17;
VAR_17 = 0;
for(VAR_13=0; VAR_13<3; VAR_13++){
if(VAR_4==PIX_FMT_RGB24 || VAR_4==PIX_FMT_BGR24)
VAR_11[VAR_13]= VAR_6*3;
else
VAR_11[VAR_13]= VAR_6*4;
if(VAR_5==PIX_FMT_RGB24 || VAR_5==PIX_FMT_BGR24)
VAR_12[VAR_13]= VAR_8*3;
else
VAR_12[VAR_13]= VAR_8*4;
src[VAR_13]= (uint8_t*) malloc(VAR_11[VAR_13]*VAR_7);
dst[VAR_13]= (uint8_t*) malloc(VAR_12[VAR_13]*VAR_9);
out[VAR_13]= (uint8_t*) malloc(VAR_1[VAR_13]*VAR_3);
if ((src[VAR_13] == NULL) || (dst[VAR_13] == NULL) || (out[VAR_13] == NULL)) {
perror("Malloc");
VAR_17 = -1;
goto end;
}
}
VAR_15 = VAR_16 = NULL;
VAR_14= sws_getContext(VAR_2, VAR_3, PIX_FMT_YUV420P, VAR_6, VAR_7, VAR_4, VAR_10, NULL, NULL, NULL);
if (VAR_14 == NULL) {
fprintf(stderr, "Failed to get %s ---> %s\n",
sws_format_name(PIX_FMT_YUV420P),
sws_format_name(VAR_4));
VAR_17 = -1;
goto end;
}
VAR_15= sws_getContext(VAR_6, VAR_7, VAR_4, VAR_8, VAR_9, VAR_5, VAR_10, NULL, NULL, NULL);
if (VAR_15 == NULL) {
fprintf(stderr, "Failed to get %s ---> %s\n",
sws_format_name(VAR_4),
sws_format_name(VAR_5));
VAR_17 = -1;
goto end;
}
VAR_16= sws_getContext(VAR_8, VAR_9, VAR_5, VAR_2, VAR_3, PIX_FMT_YUV420P, VAR_10, NULL, NULL, NULL);
if (VAR_16 == NULL) {
fprintf(stderr, "Failed to get %s ---> %s\n",
sws_format_name(VAR_5),
sws_format_name(PIX_FMT_YUV420P));
VAR_17 = -1;
goto end;
}
sws_scale(VAR_14, VAR_0, VAR_1, 0, VAR_3 , src, VAR_11);
sws_scale(VAR_15, src, VAR_11, 0, VAR_7, dst, VAR_12);
sws_scale(VAR_16, dst, VAR_12, 0, VAR_9, out, VAR_1);
#if defined(ARCH_X86)
asm volatile ("emms\n\t");
#endif
ssdY= getSSD(VAR_0[0], out[0], VAR_1[0], VAR_1[0], VAR_2, VAR_3);
ssdU= getSSD(VAR_0[1], out[1], VAR_1[1], VAR_1[1], (VAR_2+1)>>1, (VAR_3+1)>>1);
ssdV= getSSD(VAR_0[2], out[2], VAR_1[2], VAR_1[2], (VAR_2+1)>>1, (VAR_3+1)>>1);
if(VAR_4 == PIX_FMT_GRAY8 || VAR_5==PIX_FMT_GRAY8) ssdU=ssdV=0;
ssdY/= VAR_2*VAR_3;
ssdU/= VAR_2*VAR_3/4;
ssdV/= VAR_2*VAR_3/4;
if(ssdY>100 || ssdU>100 || ssdV>100){
printf(" %s %dx%d -> %s %4dx%4d VAR_10=%2d SSD=%5lld,%5lld,%5lld\n",
sws_format_name(VAR_4), VAR_6, VAR_7,
sws_format_name(VAR_5), VAR_8, VAR_9,
VAR_10,
ssdY, ssdU, ssdV);
}
end:
sws_freeContext(VAR_14);
sws_freeContext(VAR_15);
sws_freeContext(VAR_16);
for(VAR_13=0; VAR_13<3; VAR_13++){
free(src[VAR_13]);
free(dst[VAR_13]);
free(out[VAR_13]);
}
return VAR_17;
}
| [
"static int FUNC_0(uint8_t *VAR_0[3], int VAR_1[3], int VAR_2, int VAR_3, int VAR_4, int VAR_5,\nint VAR_6, int VAR_7, int VAR_8, int VAR_9, int VAR_10){",
"uint8_t *src[3];",
"uint8_t *dst[3];",
"uint8_t *out[3];",
"int VAR_11[3], VAR_12[3];",
"int VAR_13;",
"uint64_t ssdY, ssdU, ssdV;",
"struct SwsContext *VAR_14, *VAR_15, *VAR_16;",
"int VAR_17;",
"VAR_17 = 0;",
"for(VAR_13=0; VAR_13<3; VAR_13++){",
"if(VAR_4==PIX_FMT_RGB24 || VAR_4==PIX_FMT_BGR24)\nVAR_11[VAR_13]= VAR_6*3;",
"else\nVAR_11[VAR_13]= VAR_6*4;",
"if(VAR_5==PIX_FMT_RGB24 || VAR_5==PIX_FMT_BGR24)\nVAR_12[VAR_13]= VAR_8*3;",
"else\nVAR_12[VAR_13]= VAR_8*4;",
"src[VAR_13]= (uint8_t*) malloc(VAR_11[VAR_13]*VAR_7);",
"dst[VAR_13]= (uint8_t*) malloc(VAR_12[VAR_13]*VAR_9);",
"out[VAR_13]= (uint8_t*) malloc(VAR_1[VAR_13]*VAR_3);",
"if ((src[VAR_13] == NULL) || (dst[VAR_13] == NULL) || (out[VAR_13] == NULL)) {",
"perror(\"Malloc\");",
"VAR_17 = -1;",
"goto end;",
"}",
"}",
"VAR_15 = VAR_16 = NULL;",
"VAR_14= sws_getContext(VAR_2, VAR_3, PIX_FMT_YUV420P, VAR_6, VAR_7, VAR_4, VAR_10, NULL, NULL, NULL);",
"if (VAR_14 == NULL) {",
"fprintf(stderr, \"Failed to get %s ---> %s\\n\",\nsws_format_name(PIX_FMT_YUV420P),\nsws_format_name(VAR_4));",
"VAR_17 = -1;",
"goto end;",
"}",
"VAR_15= sws_getContext(VAR_6, VAR_7, VAR_4, VAR_8, VAR_9, VAR_5, VAR_10, NULL, NULL, NULL);",
"if (VAR_15 == NULL) {",
"fprintf(stderr, \"Failed to get %s ---> %s\\n\",\nsws_format_name(VAR_4),\nsws_format_name(VAR_5));",
"VAR_17 = -1;",
"goto end;",
"}",
"VAR_16= sws_getContext(VAR_8, VAR_9, VAR_5, VAR_2, VAR_3, PIX_FMT_YUV420P, VAR_10, NULL, NULL, NULL);",
"if (VAR_16 == NULL) {",
"fprintf(stderr, \"Failed to get %s ---> %s\\n\",\nsws_format_name(VAR_5),\nsws_format_name(PIX_FMT_YUV420P));",
"VAR_17 = -1;",
"goto end;",
"}",
"sws_scale(VAR_14, VAR_0, VAR_1, 0, VAR_3 , src, VAR_11);",
"sws_scale(VAR_15, src, VAR_11, 0, VAR_7, dst, VAR_12);",
"sws_scale(VAR_16, dst, VAR_12, 0, VAR_9, out, VAR_1);",
"#if defined(ARCH_X86)\nasm volatile (\"emms\\n\\t\");",
"#endif\nssdY= getSSD(VAR_0[0], out[0], VAR_1[0], VAR_1[0], VAR_2, VAR_3);",
"ssdU= getSSD(VAR_0[1], out[1], VAR_1[1], VAR_1[1], (VAR_2+1)>>1, (VAR_3+1)>>1);",
"ssdV= getSSD(VAR_0[2], out[2], VAR_1[2], VAR_1[2], (VAR_2+1)>>1, (VAR_3+1)>>1);",
"if(VAR_4 == PIX_FMT_GRAY8 || VAR_5==PIX_FMT_GRAY8) ssdU=ssdV=0;",
"ssdY/= VAR_2*VAR_3;",
"ssdU/= VAR_2*VAR_3/4;",
"ssdV/= VAR_2*VAR_3/4;",
"if(ssdY>100 || ssdU>100 || ssdV>100){",
"printf(\" %s %dx%d -> %s %4dx%4d VAR_10=%2d SSD=%5lld,%5lld,%5lld\\n\",\nsws_format_name(VAR_4), VAR_6, VAR_7,\nsws_format_name(VAR_5), VAR_8, VAR_9,\nVAR_10,\nssdY, ssdU, ssdV);",
"}",
"end:\nsws_freeContext(VAR_14);",
"sws_freeContext(VAR_15);",
"sws_freeContext(VAR_16);",
"for(VAR_13=0; VAR_13<3; VAR_13++){",
"free(src[VAR_13]);",
"free(dst[VAR_13]);",
"free(out[VAR_13]);",
"}",
"return VAR_17;",
"}"
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
0,
0,
0,
1,
1,
1,
0,
0,
0,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
0,
1,
1,
1,
0,
1,
1,
1,
0,
1,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25
],
[
29,
31
],
[
33,
35
],
[
39,
41
],
[
43,
45
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
63
],
[
65
],
[
67
],
[
71
],
[
73
],
[
75
],
[
77,
79,
81
],
[
83
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95,
97,
99
],
[
101
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113,
115,
117
],
[
119
],
[
123
],
[
125
],
[
133
],
[
135
],
[
137
],
[
141,
143
],
[
145,
149
],
[
151
],
[
153
],
[
157
],
[
161
],
[
163
],
[
165
],
[
169
],
[
171,
173,
175,
177,
179
],
[
181
],
[
185,
189
],
[
191
],
[
193
],
[
197
],
[
199
],
[
201
],
[
203
],
[
205
],
[
209
],
[
211
]
] |
19,686 | static int local_mknod(FsContext *fs_ctx, const char *path, FsCred *credp)
{
int err = -1;
int serrno = 0;
/* Determine the security model */
if (fs_ctx->fs_sm == SM_MAPPED) {
err = mknod(rpath(fs_ctx, path), SM_LOCAL_MODE_BITS|S_IFREG, 0);
if (err == -1) {
return err;
}
local_set_xattr(rpath(fs_ctx, path), credp);
if (err == -1) {
serrno = errno;
goto err_end;
}
} else if (fs_ctx->fs_sm == SM_PASSTHROUGH) {
err = mknod(rpath(fs_ctx, path), credp->fc_mode, credp->fc_rdev);
if (err == -1) {
return err;
}
err = local_post_create_passthrough(fs_ctx, path, credp);
if (err == -1) {
serrno = errno;
goto err_end;
}
}
return err;
err_end:
remove(rpath(fs_ctx, path));
errno = serrno;
return err;
}
| true | qemu | 12848bfc5d719bad536c5448205a3226be1fda47 | static int local_mknod(FsContext *fs_ctx, const char *path, FsCred *credp)
{
int err = -1;
int serrno = 0;
if (fs_ctx->fs_sm == SM_MAPPED) {
err = mknod(rpath(fs_ctx, path), SM_LOCAL_MODE_BITS|S_IFREG, 0);
if (err == -1) {
return err;
}
local_set_xattr(rpath(fs_ctx, path), credp);
if (err == -1) {
serrno = errno;
goto err_end;
}
} else if (fs_ctx->fs_sm == SM_PASSTHROUGH) {
err = mknod(rpath(fs_ctx, path), credp->fc_mode, credp->fc_rdev);
if (err == -1) {
return err;
}
err = local_post_create_passthrough(fs_ctx, path, credp);
if (err == -1) {
serrno = errno;
goto err_end;
}
}
return err;
err_end:
remove(rpath(fs_ctx, path));
errno = serrno;
return err;
}
| {
"code": [
" } else if (fs_ctx->fs_sm == SM_PASSTHROUGH) {",
" } else if (fs_ctx->fs_sm == SM_PASSTHROUGH) {",
" } else if (fs_ctx->fs_sm == SM_PASSTHROUGH) {",
" } else if (fs_ctx->fs_sm == SM_PASSTHROUGH) {",
" } else if (fs_ctx->fs_sm == SM_PASSTHROUGH) {",
" } else if (fs_ctx->fs_sm == SM_PASSTHROUGH) {",
" serrno = errno;",
" goto err_end;",
" } else if (fs_ctx->fs_sm == SM_PASSTHROUGH) {"
],
"line_no": [
33,
33,
33,
33,
33,
33,
27,
29,
33
]
} | static int FUNC_0(FsContext *VAR_0, const char *VAR_1, FsCred *VAR_2)
{
int VAR_3 = -1;
int VAR_4 = 0;
if (VAR_0->fs_sm == SM_MAPPED) {
VAR_3 = mknod(rpath(VAR_0, VAR_1), SM_LOCAL_MODE_BITS|S_IFREG, 0);
if (VAR_3 == -1) {
return VAR_3;
}
local_set_xattr(rpath(VAR_0, VAR_1), VAR_2);
if (VAR_3 == -1) {
VAR_4 = errno;
goto err_end;
}
} else if (VAR_0->fs_sm == SM_PASSTHROUGH) {
VAR_3 = mknod(rpath(VAR_0, VAR_1), VAR_2->fc_mode, VAR_2->fc_rdev);
if (VAR_3 == -1) {
return VAR_3;
}
VAR_3 = local_post_create_passthrough(VAR_0, VAR_1, VAR_2);
if (VAR_3 == -1) {
VAR_4 = errno;
goto err_end;
}
}
return VAR_3;
err_end:
remove(rpath(VAR_0, VAR_1));
errno = VAR_4;
return VAR_3;
}
| [
"static int FUNC_0(FsContext *VAR_0, const char *VAR_1, FsCred *VAR_2)\n{",
"int VAR_3 = -1;",
"int VAR_4 = 0;",
"if (VAR_0->fs_sm == SM_MAPPED) {",
"VAR_3 = mknod(rpath(VAR_0, VAR_1), SM_LOCAL_MODE_BITS|S_IFREG, 0);",
"if (VAR_3 == -1) {",
"return VAR_3;",
"}",
"local_set_xattr(rpath(VAR_0, VAR_1), VAR_2);",
"if (VAR_3 == -1) {",
"VAR_4 = errno;",
"goto err_end;",
"}",
"} else if (VAR_0->fs_sm == SM_PASSTHROUGH) {",
"VAR_3 = mknod(rpath(VAR_0, VAR_1), VAR_2->fc_mode, VAR_2->fc_rdev);",
"if (VAR_3 == -1) {",
"return VAR_3;",
"}",
"VAR_3 = local_post_create_passthrough(VAR_0, VAR_1, VAR_2);",
"if (VAR_3 == -1) {",
"VAR_4 = errno;",
"goto err_end;",
"}",
"}",
"return VAR_3;",
"err_end:\nremove(rpath(VAR_0, VAR_1));",
"errno = VAR_4;",
"return VAR_3;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
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
],
[
65
],
[
67
]
] |
19,687 | uint32_t ff_celt_encode_band(CeltFrame *f, OpusRangeCoder *rc, const int band,
float *X, float *Y, int N, int b, uint32_t blocks,
float *lowband, int duration, float *lowband_out, int level,
float gain, float *lowband_scratch, int fill)
{
const uint8_t *cache;
int dualstereo, split;
int imid = 0, iside = 0;
//uint32_t N0 = N;
int N_B;
//int N_B0;
int B0 = blocks;
int time_divide = 0;
int recombine = 0;
int inv = 0;
float mid = 0, side = 0;
int longblocks = (B0 == 1);
uint32_t cm = 0;
//N_B0 = N_B = N / blocks;
split = dualstereo = (Y != NULL);
if (N == 1) {
/* special case for one sample - the decoder's output will be +- 1.0f!!! */
int i;
float *x = X;
for (i = 0; i <= dualstereo; i++) {
if (f->remaining2 >= 1<<3) {
ff_opus_rc_put_raw(rc, x[0] < 0, 1);
f->remaining2 -= 1 << 3;
b -= 1 << 3;
}
x = Y;
}
if (lowband_out)
lowband_out[0] = X[0];
return 1;
}
if (!dualstereo && level == 0) {
int tf_change = f->tf_change[band];
int k;
if (tf_change > 0)
recombine = tf_change;
/* Band recombining to increase frequency resolution */
if (lowband &&
(recombine || ((N_B & 1) == 0 && tf_change < 0) || B0 > 1)) {
int j;
for (j = 0; j < N; j++)
lowband_scratch[j] = lowband[j];
lowband = lowband_scratch;
}
for (k = 0; k < recombine; k++) {
celt_haar1(X, N >> k, 1 << k);
fill = ff_celt_bit_interleave[fill & 0xF] | ff_celt_bit_interleave[fill >> 4] << 2;
}
blocks >>= recombine;
N_B <<= recombine;
/* Increasing the time resolution */
while ((N_B & 1) == 0 && tf_change < 0) {
celt_haar1(X, N_B, blocks);
fill |= fill << blocks;
blocks <<= 1;
N_B >>= 1;
time_divide++;
tf_change++;
}
B0 = blocks;
//N_B0 = N_B;
/* Reorganize the samples in time order instead of frequency order */
if (B0 > 1)
celt_deinterleave_hadamard(f->scratch, X, N_B >> recombine,
B0 << recombine, longblocks);
}
/* If we need 1.5 more bit than we can produce, split the band in two. */
cache = ff_celt_cache_bits +
ff_celt_cache_index[(duration + 1) * CELT_MAX_BANDS + band];
if (!dualstereo && duration >= 0 && b > cache[cache[0]] + 12 && N > 2) {
N >>= 1;
Y = X + N;
split = 1;
duration -= 1;
if (blocks == 1)
fill = (fill & 1) | (fill << 1);
blocks = (blocks + 1) >> 1;
}
if (split) {
int qn;
int itheta = celt_calc_theta(X, Y, dualstereo, N);
int mbits, sbits, delta;
int qalloc;
int pulse_cap;
int offset;
int orig_fill;
int tell;
/* Decide on the resolution to give to the split parameter theta */
pulse_cap = ff_celt_log_freq_range[band] + duration * 8;
offset = (pulse_cap >> 1) - (dualstereo && N == 2 ? CELT_QTHETA_OFFSET_TWOPHASE :
CELT_QTHETA_OFFSET);
qn = (dualstereo && band >= f->intensity_stereo) ? 1 :
celt_compute_qn(N, b, offset, pulse_cap, dualstereo);
tell = opus_rc_tell_frac(rc);
if (qn != 1) {
itheta = (itheta*qn + 8192) >> 14;
/* Entropy coding of the angle. We use a uniform pdf for the
* time split, a step for stereo, and a triangular one for the rest. */
if (dualstereo && N > 2)
ff_opus_rc_enc_uint_step(rc, itheta, qn / 2);
else if (dualstereo || B0 > 1)
ff_opus_rc_enc_uint(rc, itheta, qn + 1);
else
ff_opus_rc_enc_uint_tri(rc, itheta, qn);
itheta = itheta * 16384 / qn;
if (dualstereo) {
if (itheta == 0)
celt_stereo_is_decouple(X, Y, f->block[0].lin_energy[band], f->block[1].lin_energy[band], N);
else
celt_stereo_ms_decouple(X, Y, N);
}
} else if (dualstereo) {
inv = itheta > 8192;
if (inv)
{
int j;
for (j=0;j<N;j++)
Y[j] = -Y[j];
}
celt_stereo_is_decouple(X, Y, f->block[0].lin_energy[band], f->block[1].lin_energy[band], N);
if (b > 2 << 3 && f->remaining2 > 2 << 3) {
ff_opus_rc_enc_log(rc, inv, 2);
} else {
inv = 0;
}
itheta = 0;
}
qalloc = opus_rc_tell_frac(rc) - tell;
b -= qalloc;
orig_fill = fill;
if (itheta == 0) {
imid = 32767;
iside = 0;
fill = av_mod_uintp2(fill, blocks);
delta = -16384;
} else if (itheta == 16384) {
imid = 0;
iside = 32767;
fill &= ((1 << blocks) - 1) << blocks;
delta = 16384;
} else {
imid = celt_cos(itheta);
iside = celt_cos(16384-itheta);
/* This is the mid vs side allocation that minimizes squared error
in that band. */
delta = ROUND_MUL16((N - 1) << 7, celt_log2tan(iside, imid));
}
mid = imid / 32768.0f;
side = iside / 32768.0f;
/* This is a special case for N=2 that only works for stereo and takes
advantage of the fact that mid and side are orthogonal to encode
the side with just one bit. */
if (N == 2 && dualstereo) {
int c;
int sign = 0;
float tmp;
float *x2, *y2;
mbits = b;
/* Only need one bit for the side */
sbits = (itheta != 0 && itheta != 16384) ? 1 << 3 : 0;
mbits -= sbits;
c = (itheta > 8192);
f->remaining2 -= qalloc+sbits;
x2 = c ? Y : X;
y2 = c ? X : Y;
if (sbits) {
sign = x2[0]*y2[1] - x2[1]*y2[0] < 0;
ff_opus_rc_put_raw(rc, sign, 1);
}
sign = 1 - 2 * sign;
/* We use orig_fill here because we want to fold the side, but if
itheta==16384, we'll have cleared the low bits of fill. */
cm = ff_celt_encode_band(f, rc, band, x2, NULL, N, mbits, blocks,
lowband, duration, lowband_out, level, gain,
lowband_scratch, orig_fill);
/* We don't split N=2 bands, so cm is either 1 or 0 (for a fold-collapse),
and there's no need to worry about mixing with the other channel. */
y2[0] = -sign * x2[1];
y2[1] = sign * x2[0];
X[0] *= mid;
X[1] *= mid;
Y[0] *= side;
Y[1] *= side;
tmp = X[0];
X[0] = tmp - Y[0];
Y[0] = tmp + Y[0];
tmp = X[1];
X[1] = tmp - Y[1];
Y[1] = tmp + Y[1];
} else {
/* "Normal" split code */
float *next_lowband2 = NULL;
float *next_lowband_out1 = NULL;
int next_level = 0;
int rebalance;
/* Give more bits to low-energy MDCTs than they would
* otherwise deserve */
if (B0 > 1 && !dualstereo && (itheta & 0x3fff)) {
if (itheta > 8192)
/* Rough approximation for pre-echo masking */
delta -= delta >> (4 - duration);
else
/* Corresponds to a forward-masking slope of
* 1.5 dB per 10 ms */
delta = FFMIN(0, delta + (N << 3 >> (5 - duration)));
}
mbits = av_clip((b - delta) / 2, 0, b);
sbits = b - mbits;
f->remaining2 -= qalloc;
if (lowband && !dualstereo)
next_lowband2 = lowband + N; /* >32-bit split case */
/* Only stereo needs to pass on lowband_out.
* Otherwise, it's handled at the end */
if (dualstereo)
next_lowband_out1 = lowband_out;
else
next_level = level + 1;
rebalance = f->remaining2;
if (mbits >= sbits) {
/* In stereo mode, we do not apply a scaling to the mid
* because we need the normalized mid for folding later */
cm = ff_celt_encode_band(f, rc, band, X, NULL, N, mbits, blocks,
lowband, duration, next_lowband_out1,
next_level, dualstereo ? 1.0f : (gain * mid),
lowband_scratch, fill);
rebalance = mbits - (rebalance - f->remaining2);
if (rebalance > 3 << 3 && itheta != 0)
sbits += rebalance - (3 << 3);
/* For a stereo split, the high bits of fill are always zero,
* so no folding will be done to the side. */
cm |= ff_celt_encode_band(f, rc, band, Y, NULL, N, sbits, blocks,
next_lowband2, duration, NULL,
next_level, gain * side, NULL,
fill >> blocks) << ((B0 >> 1) & (dualstereo - 1));
} else {
/* For a stereo split, the high bits of fill are always zero,
* so no folding will be done to the side. */
cm = ff_celt_encode_band(f, rc, band, Y, NULL, N, sbits, blocks,
next_lowband2, duration, NULL,
next_level, gain * side, NULL,
fill >> blocks) << ((B0 >> 1) & (dualstereo - 1));
rebalance = sbits - (rebalance - f->remaining2);
if (rebalance > 3 << 3 && itheta != 16384)
mbits += rebalance - (3 << 3);
/* In stereo mode, we do not apply a scaling to the mid because
* we need the normalized mid for folding later */
cm |= ff_celt_encode_band(f, rc, band, X, NULL, N, mbits, blocks,
lowband, duration, next_lowband_out1,
next_level, dualstereo ? 1.0f : (gain * mid),
lowband_scratch, fill);
}
}
} else {
/* This is the basic no-split case */
uint32_t q = celt_bits2pulses(cache, b);
uint32_t curr_bits = celt_pulses2bits(cache, q);
f->remaining2 -= curr_bits;
/* Ensures we can never bust the budget */
while (f->remaining2 < 0 && q > 0) {
f->remaining2 += curr_bits;
curr_bits = celt_pulses2bits(cache, --q);
f->remaining2 -= curr_bits;
}
if (q != 0) {
/* Finally do the actual quantization */
cm = celt_alg_quant(rc, X, N, (q < 8) ? q : (8 + (q & 7)) << ((q >> 3) - 1),
f->spread, blocks, gain);
}
}
return cm;
}
| true | FFmpeg | 1b90e2414df070d4ea7d12f300c4a950d3ecc975 | uint32_t ff_celt_encode_band(CeltFrame *f, OpusRangeCoder *rc, const int band,
float *X, float *Y, int N, int b, uint32_t blocks,
float *lowband, int duration, float *lowband_out, int level,
float gain, float *lowband_scratch, int fill)
{
const uint8_t *cache;
int dualstereo, split;
int imid = 0, iside = 0;
int N_B;
int B0 = blocks;
int time_divide = 0;
int recombine = 0;
int inv = 0;
float mid = 0, side = 0;
int longblocks = (B0 == 1);
uint32_t cm = 0;
split = dualstereo = (Y != NULL);
if (N == 1) {
int i;
float *x = X;
for (i = 0; i <= dualstereo; i++) {
if (f->remaining2 >= 1<<3) {
ff_opus_rc_put_raw(rc, x[0] < 0, 1);
f->remaining2 -= 1 << 3;
b -= 1 << 3;
}
x = Y;
}
if (lowband_out)
lowband_out[0] = X[0];
return 1;
}
if (!dualstereo && level == 0) {
int tf_change = f->tf_change[band];
int k;
if (tf_change > 0)
recombine = tf_change;
if (lowband &&
(recombine || ((N_B & 1) == 0 && tf_change < 0) || B0 > 1)) {
int j;
for (j = 0; j < N; j++)
lowband_scratch[j] = lowband[j];
lowband = lowband_scratch;
}
for (k = 0; k < recombine; k++) {
celt_haar1(X, N >> k, 1 << k);
fill = ff_celt_bit_interleave[fill & 0xF] | ff_celt_bit_interleave[fill >> 4] << 2;
}
blocks >>= recombine;
N_B <<= recombine;
while ((N_B & 1) == 0 && tf_change < 0) {
celt_haar1(X, N_B, blocks);
fill |= fill << blocks;
blocks <<= 1;
N_B >>= 1;
time_divide++;
tf_change++;
}
B0 = blocks;
if (B0 > 1)
celt_deinterleave_hadamard(f->scratch, X, N_B >> recombine,
B0 << recombine, longblocks);
}
cache = ff_celt_cache_bits +
ff_celt_cache_index[(duration + 1) * CELT_MAX_BANDS + band];
if (!dualstereo && duration >= 0 && b > cache[cache[0]] + 12 && N > 2) {
N >>= 1;
Y = X + N;
split = 1;
duration -= 1;
if (blocks == 1)
fill = (fill & 1) | (fill << 1);
blocks = (blocks + 1) >> 1;
}
if (split) {
int qn;
int itheta = celt_calc_theta(X, Y, dualstereo, N);
int mbits, sbits, delta;
int qalloc;
int pulse_cap;
int offset;
int orig_fill;
int tell;
pulse_cap = ff_celt_log_freq_range[band] + duration * 8;
offset = (pulse_cap >> 1) - (dualstereo && N == 2 ? CELT_QTHETA_OFFSET_TWOPHASE :
CELT_QTHETA_OFFSET);
qn = (dualstereo && band >= f->intensity_stereo) ? 1 :
celt_compute_qn(N, b, offset, pulse_cap, dualstereo);
tell = opus_rc_tell_frac(rc);
if (qn != 1) {
itheta = (itheta*qn + 8192) >> 14;
if (dualstereo && N > 2)
ff_opus_rc_enc_uint_step(rc, itheta, qn / 2);
else if (dualstereo || B0 > 1)
ff_opus_rc_enc_uint(rc, itheta, qn + 1);
else
ff_opus_rc_enc_uint_tri(rc, itheta, qn);
itheta = itheta * 16384 / qn;
if (dualstereo) {
if (itheta == 0)
celt_stereo_is_decouple(X, Y, f->block[0].lin_energy[band], f->block[1].lin_energy[band], N);
else
celt_stereo_ms_decouple(X, Y, N);
}
} else if (dualstereo) {
inv = itheta > 8192;
if (inv)
{
int j;
for (j=0;j<N;j++)
Y[j] = -Y[j];
}
celt_stereo_is_decouple(X, Y, f->block[0].lin_energy[band], f->block[1].lin_energy[band], N);
if (b > 2 << 3 && f->remaining2 > 2 << 3) {
ff_opus_rc_enc_log(rc, inv, 2);
} else {
inv = 0;
}
itheta = 0;
}
qalloc = opus_rc_tell_frac(rc) - tell;
b -= qalloc;
orig_fill = fill;
if (itheta == 0) {
imid = 32767;
iside = 0;
fill = av_mod_uintp2(fill, blocks);
delta = -16384;
} else if (itheta == 16384) {
imid = 0;
iside = 32767;
fill &= ((1 << blocks) - 1) << blocks;
delta = 16384;
} else {
imid = celt_cos(itheta);
iside = celt_cos(16384-itheta);
delta = ROUND_MUL16((N - 1) << 7, celt_log2tan(iside, imid));
}
mid = imid / 32768.0f;
side = iside / 32768.0f;
if (N == 2 && dualstereo) {
int c;
int sign = 0;
float tmp;
float *x2, *y2;
mbits = b;
sbits = (itheta != 0 && itheta != 16384) ? 1 << 3 : 0;
mbits -= sbits;
c = (itheta > 8192);
f->remaining2 -= qalloc+sbits;
x2 = c ? Y : X;
y2 = c ? X : Y;
if (sbits) {
sign = x2[0]*y2[1] - x2[1]*y2[0] < 0;
ff_opus_rc_put_raw(rc, sign, 1);
}
sign = 1 - 2 * sign;
cm = ff_celt_encode_band(f, rc, band, x2, NULL, N, mbits, blocks,
lowband, duration, lowband_out, level, gain,
lowband_scratch, orig_fill);
y2[0] = -sign * x2[1];
y2[1] = sign * x2[0];
X[0] *= mid;
X[1] *= mid;
Y[0] *= side;
Y[1] *= side;
tmp = X[0];
X[0] = tmp - Y[0];
Y[0] = tmp + Y[0];
tmp = X[1];
X[1] = tmp - Y[1];
Y[1] = tmp + Y[1];
} else {
float *next_lowband2 = NULL;
float *next_lowband_out1 = NULL;
int next_level = 0;
int rebalance;
if (B0 > 1 && !dualstereo && (itheta & 0x3fff)) {
if (itheta > 8192)
delta -= delta >> (4 - duration);
else
delta = FFMIN(0, delta + (N << 3 >> (5 - duration)));
}
mbits = av_clip((b - delta) / 2, 0, b);
sbits = b - mbits;
f->remaining2 -= qalloc;
if (lowband && !dualstereo)
next_lowband2 = lowband + N;
if (dualstereo)
next_lowband_out1 = lowband_out;
else
next_level = level + 1;
rebalance = f->remaining2;
if (mbits >= sbits) {
cm = ff_celt_encode_band(f, rc, band, X, NULL, N, mbits, blocks,
lowband, duration, next_lowband_out1,
next_level, dualstereo ? 1.0f : (gain * mid),
lowband_scratch, fill);
rebalance = mbits - (rebalance - f->remaining2);
if (rebalance > 3 << 3 && itheta != 0)
sbits += rebalance - (3 << 3);
cm |= ff_celt_encode_band(f, rc, band, Y, NULL, N, sbits, blocks,
next_lowband2, duration, NULL,
next_level, gain * side, NULL,
fill >> blocks) << ((B0 >> 1) & (dualstereo - 1));
} else {
cm = ff_celt_encode_band(f, rc, band, Y, NULL, N, sbits, blocks,
next_lowband2, duration, NULL,
next_level, gain * side, NULL,
fill >> blocks) << ((B0 >> 1) & (dualstereo - 1));
rebalance = sbits - (rebalance - f->remaining2);
if (rebalance > 3 << 3 && itheta != 16384)
mbits += rebalance - (3 << 3);
cm |= ff_celt_encode_band(f, rc, band, X, NULL, N, mbits, blocks,
lowband, duration, next_lowband_out1,
next_level, dualstereo ? 1.0f : (gain * mid),
lowband_scratch, fill);
}
}
} else {
uint32_t q = celt_bits2pulses(cache, b);
uint32_t curr_bits = celt_pulses2bits(cache, q);
f->remaining2 -= curr_bits;
while (f->remaining2 < 0 && q > 0) {
f->remaining2 += curr_bits;
curr_bits = celt_pulses2bits(cache, --q);
f->remaining2 -= curr_bits;
}
if (q != 0) {
cm = celt_alg_quant(rc, X, N, (q < 8) ? q : (8 + (q & 7)) << ((q >> 3) - 1),
f->spread, blocks, gain);
}
}
return cm;
}
| {
"code": [
" int N_B;"
],
"line_no": [
19
]
} | uint32_t FUNC_0(CeltFrame *f, OpusRangeCoder *rc, const int band,
float *X, float *Y, int N, int b, uint32_t blocks,
float *lowband, int duration, float *lowband_out, int level,
float gain, float *lowband_scratch, int fill)
{
const uint8_t *VAR_0;
int VAR_1, VAR_2;
int VAR_3 = 0, VAR_4 = 0;
int VAR_5;
int VAR_6 = blocks;
int VAR_7 = 0;
int VAR_8 = 0;
int VAR_9 = 0;
float VAR_10 = 0, VAR_11 = 0;
int VAR_12 = (VAR_6 == 1);
uint32_t cm = 0;
VAR_2 = VAR_1 = (Y != NULL);
if (N == 1) {
int VAR_13;
float *VAR_14 = X;
for (VAR_13 = 0; VAR_13 <= VAR_1; VAR_13++) {
if (f->remaining2 >= 1<<3) {
ff_opus_rc_put_raw(rc, VAR_14[0] < 0, 1);
f->remaining2 -= 1 << 3;
b -= 1 << 3;
}
VAR_14 = Y;
}
if (lowband_out)
lowband_out[0] = X[0];
return 1;
}
if (!VAR_1 && level == 0) {
int VAR_15 = f->VAR_15[band];
int VAR_16;
if (VAR_15 > 0)
VAR_8 = VAR_15;
if (lowband &&
(VAR_8 || ((VAR_5 & 1) == 0 && VAR_15 < 0) || VAR_6 > 1)) {
int VAR_28;
for (VAR_28 = 0; VAR_28 < N; VAR_28++)
lowband_scratch[VAR_28] = lowband[VAR_28];
lowband = lowband_scratch;
}
for (VAR_16 = 0; VAR_16 < VAR_8; VAR_16++) {
celt_haar1(X, N >> VAR_16, 1 << VAR_16);
fill = ff_celt_bit_interleave[fill & 0xF] | ff_celt_bit_interleave[fill >> 4] << 2;
}
blocks >>= VAR_8;
VAR_5 <<= VAR_8;
while ((VAR_5 & 1) == 0 && VAR_15 < 0) {
celt_haar1(X, VAR_5, blocks);
fill |= fill << blocks;
blocks <<= 1;
VAR_5 >>= 1;
VAR_7++;
VAR_15++;
}
VAR_6 = blocks;
if (VAR_6 > 1)
celt_deinterleave_hadamard(f->scratch, X, VAR_5 >> VAR_8,
VAR_6 << VAR_8, VAR_12);
}
VAR_0 = ff_celt_cache_bits +
ff_celt_cache_index[(duration + 1) * CELT_MAX_BANDS + band];
if (!VAR_1 && duration >= 0 && b > VAR_0[VAR_0[0]] + 12 && N > 2) {
N >>= 1;
Y = X + N;
VAR_2 = 1;
duration -= 1;
if (blocks == 1)
fill = (fill & 1) | (fill << 1);
blocks = (blocks + 1) >> 1;
}
if (VAR_2) {
int VAR_18;
int VAR_19 = celt_calc_theta(X, Y, VAR_1, N);
int VAR_20, VAR_21, VAR_22;
int VAR_23;
int VAR_24;
int VAR_25;
int VAR_26;
int VAR_27;
VAR_24 = ff_celt_log_freq_range[band] + duration * 8;
VAR_25 = (VAR_24 >> 1) - (VAR_1 && N == 2 ? CELT_QTHETA_OFFSET_TWOPHASE :
CELT_QTHETA_OFFSET);
VAR_18 = (VAR_1 && band >= f->intensity_stereo) ? 1 :
celt_compute_qn(N, b, VAR_25, VAR_24, VAR_1);
VAR_27 = opus_rc_tell_frac(rc);
if (VAR_18 != 1) {
VAR_19 = (VAR_19*VAR_18 + 8192) >> 14;
if (VAR_1 && N > 2)
ff_opus_rc_enc_uint_step(rc, VAR_19, VAR_18 / 2);
else if (VAR_1 || VAR_6 > 1)
ff_opus_rc_enc_uint(rc, VAR_19, VAR_18 + 1);
else
ff_opus_rc_enc_uint_tri(rc, VAR_19, VAR_18);
VAR_19 = VAR_19 * 16384 / VAR_18;
if (VAR_1) {
if (VAR_19 == 0)
celt_stereo_is_decouple(X, Y, f->block[0].lin_energy[band], f->block[1].lin_energy[band], N);
else
celt_stereo_ms_decouple(X, Y, N);
}
} else if (VAR_1) {
VAR_9 = VAR_19 > 8192;
if (VAR_9)
{
int VAR_28;
for (VAR_28=0;VAR_28<N;VAR_28++)
Y[VAR_28] = -Y[VAR_28];
}
celt_stereo_is_decouple(X, Y, f->block[0].lin_energy[band], f->block[1].lin_energy[band], N);
if (b > 2 << 3 && f->remaining2 > 2 << 3) {
ff_opus_rc_enc_log(rc, VAR_9, 2);
} else {
VAR_9 = 0;
}
VAR_19 = 0;
}
VAR_23 = opus_rc_tell_frac(rc) - VAR_27;
b -= VAR_23;
VAR_26 = fill;
if (VAR_19 == 0) {
VAR_3 = 32767;
VAR_4 = 0;
fill = av_mod_uintp2(fill, blocks);
VAR_22 = -16384;
} else if (VAR_19 == 16384) {
VAR_3 = 0;
VAR_4 = 32767;
fill &= ((1 << blocks) - 1) << blocks;
VAR_22 = 16384;
} else {
VAR_3 = celt_cos(VAR_19);
VAR_4 = celt_cos(16384-VAR_19);
VAR_22 = ROUND_MUL16((N - 1) << 7, celt_log2tan(VAR_4, VAR_3));
}
VAR_10 = VAR_3 / 32768.0f;
VAR_11 = VAR_4 / 32768.0f;
if (N == 2 && VAR_1) {
int VAR_28;
int VAR_29 = 0;
float VAR_30;
float *VAR_31, *VAR_32;
VAR_20 = b;
VAR_21 = (VAR_19 != 0 && VAR_19 != 16384) ? 1 << 3 : 0;
VAR_20 -= VAR_21;
VAR_28 = (VAR_19 > 8192);
f->remaining2 -= VAR_23+VAR_21;
VAR_31 = VAR_28 ? Y : X;
VAR_32 = VAR_28 ? X : Y;
if (VAR_21) {
VAR_29 = VAR_31[0]*VAR_32[1] - VAR_31[1]*VAR_32[0] < 0;
ff_opus_rc_put_raw(rc, VAR_29, 1);
}
VAR_29 = 1 - 2 * VAR_29;
cm = FUNC_0(f, rc, band, VAR_31, NULL, N, VAR_20, blocks,
lowband, duration, lowband_out, level, gain,
lowband_scratch, VAR_26);
VAR_32[0] = -VAR_29 * VAR_31[1];
VAR_32[1] = VAR_29 * VAR_31[0];
X[0] *= VAR_10;
X[1] *= VAR_10;
Y[0] *= VAR_11;
Y[1] *= VAR_11;
VAR_30 = X[0];
X[0] = VAR_30 - Y[0];
Y[0] = VAR_30 + Y[0];
VAR_30 = X[1];
X[1] = VAR_30 - Y[1];
Y[1] = VAR_30 + Y[1];
} else {
float *VAR_33 = NULL;
float *VAR_34 = NULL;
int VAR_35 = 0;
int VAR_36;
if (VAR_6 > 1 && !VAR_1 && (VAR_19 & 0x3fff)) {
if (VAR_19 > 8192)
VAR_22 -= VAR_22 >> (4 - duration);
else
VAR_22 = FFMIN(0, VAR_22 + (N << 3 >> (5 - duration)));
}
VAR_20 = av_clip((b - VAR_22) / 2, 0, b);
VAR_21 = b - VAR_20;
f->remaining2 -= VAR_23;
if (lowband && !VAR_1)
VAR_33 = lowband + N;
if (VAR_1)
VAR_34 = lowband_out;
else
VAR_35 = level + 1;
VAR_36 = f->remaining2;
if (VAR_20 >= VAR_21) {
cm = FUNC_0(f, rc, band, X, NULL, N, VAR_20, blocks,
lowband, duration, VAR_34,
VAR_35, VAR_1 ? 1.0f : (gain * VAR_10),
lowband_scratch, fill);
VAR_36 = VAR_20 - (VAR_36 - f->remaining2);
if (VAR_36 > 3 << 3 && VAR_19 != 0)
VAR_21 += VAR_36 - (3 << 3);
cm |= FUNC_0(f, rc, band, Y, NULL, N, VAR_21, blocks,
VAR_33, duration, NULL,
VAR_35, gain * VAR_11, NULL,
fill >> blocks) << ((VAR_6 >> 1) & (VAR_1 - 1));
} else {
cm = FUNC_0(f, rc, band, Y, NULL, N, VAR_21, blocks,
VAR_33, duration, NULL,
VAR_35, gain * VAR_11, NULL,
fill >> blocks) << ((VAR_6 >> 1) & (VAR_1 - 1));
VAR_36 = VAR_21 - (VAR_36 - f->remaining2);
if (VAR_36 > 3 << 3 && VAR_19 != 16384)
VAR_20 += VAR_36 - (3 << 3);
cm |= FUNC_0(f, rc, band, X, NULL, N, VAR_20, blocks,
lowband, duration, VAR_34,
VAR_35, VAR_1 ? 1.0f : (gain * VAR_10),
lowband_scratch, fill);
}
}
} else {
uint32_t q = celt_bits2pulses(VAR_0, b);
uint32_t curr_bits = celt_pulses2bits(VAR_0, q);
f->remaining2 -= curr_bits;
while (f->remaining2 < 0 && q > 0) {
f->remaining2 += curr_bits;
curr_bits = celt_pulses2bits(VAR_0, --q);
f->remaining2 -= curr_bits;
}
if (q != 0) {
cm = celt_alg_quant(rc, X, N, (q < 8) ? q : (8 + (q & 7)) << ((q >> 3) - 1),
f->spread, blocks, gain);
}
}
return cm;
}
| [
"uint32_t FUNC_0(CeltFrame *f, OpusRangeCoder *rc, const int band,\nfloat *X, float *Y, int N, int b, uint32_t blocks,\nfloat *lowband, int duration, float *lowband_out, int level,\nfloat gain, float *lowband_scratch, int fill)\n{",
"const uint8_t *VAR_0;",
"int VAR_1, VAR_2;",
"int VAR_3 = 0, VAR_4 = 0;",
"int VAR_5;",
"int VAR_6 = blocks;",
"int VAR_7 = 0;",
"int VAR_8 = 0;",
"int VAR_9 = 0;",
"float VAR_10 = 0, VAR_11 = 0;",
"int VAR_12 = (VAR_6 == 1);",
"uint32_t cm = 0;",
"VAR_2 = VAR_1 = (Y != NULL);",
"if (N == 1) {",
"int VAR_13;",
"float *VAR_14 = X;",
"for (VAR_13 = 0; VAR_13 <= VAR_1; VAR_13++) {",
"if (f->remaining2 >= 1<<3) {",
"ff_opus_rc_put_raw(rc, VAR_14[0] < 0, 1);",
"f->remaining2 -= 1 << 3;",
"b -= 1 << 3;",
"}",
"VAR_14 = Y;",
"}",
"if (lowband_out)\nlowband_out[0] = X[0];",
"return 1;",
"}",
"if (!VAR_1 && level == 0) {",
"int VAR_15 = f->VAR_15[band];",
"int VAR_16;",
"if (VAR_15 > 0)\nVAR_8 = VAR_15;",
"if (lowband &&\n(VAR_8 || ((VAR_5 & 1) == 0 && VAR_15 < 0) || VAR_6 > 1)) {",
"int VAR_28;",
"for (VAR_28 = 0; VAR_28 < N; VAR_28++)",
"lowband_scratch[VAR_28] = lowband[VAR_28];",
"lowband = lowband_scratch;",
"}",
"for (VAR_16 = 0; VAR_16 < VAR_8; VAR_16++) {",
"celt_haar1(X, N >> VAR_16, 1 << VAR_16);",
"fill = ff_celt_bit_interleave[fill & 0xF] | ff_celt_bit_interleave[fill >> 4] << 2;",
"}",
"blocks >>= VAR_8;",
"VAR_5 <<= VAR_8;",
"while ((VAR_5 & 1) == 0 && VAR_15 < 0) {",
"celt_haar1(X, VAR_5, blocks);",
"fill |= fill << blocks;",
"blocks <<= 1;",
"VAR_5 >>= 1;",
"VAR_7++;",
"VAR_15++;",
"}",
"VAR_6 = blocks;",
"if (VAR_6 > 1)\ncelt_deinterleave_hadamard(f->scratch, X, VAR_5 >> VAR_8,\nVAR_6 << VAR_8, VAR_12);",
"}",
"VAR_0 = ff_celt_cache_bits +\nff_celt_cache_index[(duration + 1) * CELT_MAX_BANDS + band];",
"if (!VAR_1 && duration >= 0 && b > VAR_0[VAR_0[0]] + 12 && N > 2) {",
"N >>= 1;",
"Y = X + N;",
"VAR_2 = 1;",
"duration -= 1;",
"if (blocks == 1)\nfill = (fill & 1) | (fill << 1);",
"blocks = (blocks + 1) >> 1;",
"}",
"if (VAR_2) {",
"int VAR_18;",
"int VAR_19 = celt_calc_theta(X, Y, VAR_1, N);",
"int VAR_20, VAR_21, VAR_22;",
"int VAR_23;",
"int VAR_24;",
"int VAR_25;",
"int VAR_26;",
"int VAR_27;",
"VAR_24 = ff_celt_log_freq_range[band] + duration * 8;",
"VAR_25 = (VAR_24 >> 1) - (VAR_1 && N == 2 ? CELT_QTHETA_OFFSET_TWOPHASE :\nCELT_QTHETA_OFFSET);",
"VAR_18 = (VAR_1 && band >= f->intensity_stereo) ? 1 :\ncelt_compute_qn(N, b, VAR_25, VAR_24, VAR_1);",
"VAR_27 = opus_rc_tell_frac(rc);",
"if (VAR_18 != 1) {",
"VAR_19 = (VAR_19*VAR_18 + 8192) >> 14;",
"if (VAR_1 && N > 2)\nff_opus_rc_enc_uint_step(rc, VAR_19, VAR_18 / 2);",
"else if (VAR_1 || VAR_6 > 1)\nff_opus_rc_enc_uint(rc, VAR_19, VAR_18 + 1);",
"else\nff_opus_rc_enc_uint_tri(rc, VAR_19, VAR_18);",
"VAR_19 = VAR_19 * 16384 / VAR_18;",
"if (VAR_1) {",
"if (VAR_19 == 0)\ncelt_stereo_is_decouple(X, Y, f->block[0].lin_energy[band], f->block[1].lin_energy[band], N);",
"else\ncelt_stereo_ms_decouple(X, Y, N);",
"}",
"} else if (VAR_1) {",
"VAR_9 = VAR_19 > 8192;",
"if (VAR_9)\n{",
"int VAR_28;",
"for (VAR_28=0;VAR_28<N;VAR_28++)",
"Y[VAR_28] = -Y[VAR_28];",
"}",
"celt_stereo_is_decouple(X, Y, f->block[0].lin_energy[band], f->block[1].lin_energy[band], N);",
"if (b > 2 << 3 && f->remaining2 > 2 << 3) {",
"ff_opus_rc_enc_log(rc, VAR_9, 2);",
"} else {",
"VAR_9 = 0;",
"}",
"VAR_19 = 0;",
"}",
"VAR_23 = opus_rc_tell_frac(rc) - VAR_27;",
"b -= VAR_23;",
"VAR_26 = fill;",
"if (VAR_19 == 0) {",
"VAR_3 = 32767;",
"VAR_4 = 0;",
"fill = av_mod_uintp2(fill, blocks);",
"VAR_22 = -16384;",
"} else if (VAR_19 == 16384) {",
"VAR_3 = 0;",
"VAR_4 = 32767;",
"fill &= ((1 << blocks) - 1) << blocks;",
"VAR_22 = 16384;",
"} else {",
"VAR_3 = celt_cos(VAR_19);",
"VAR_4 = celt_cos(16384-VAR_19);",
"VAR_22 = ROUND_MUL16((N - 1) << 7, celt_log2tan(VAR_4, VAR_3));",
"}",
"VAR_10 = VAR_3 / 32768.0f;",
"VAR_11 = VAR_4 / 32768.0f;",
"if (N == 2 && VAR_1) {",
"int VAR_28;",
"int VAR_29 = 0;",
"float VAR_30;",
"float *VAR_31, *VAR_32;",
"VAR_20 = b;",
"VAR_21 = (VAR_19 != 0 && VAR_19 != 16384) ? 1 << 3 : 0;",
"VAR_20 -= VAR_21;",
"VAR_28 = (VAR_19 > 8192);",
"f->remaining2 -= VAR_23+VAR_21;",
"VAR_31 = VAR_28 ? Y : X;",
"VAR_32 = VAR_28 ? X : Y;",
"if (VAR_21) {",
"VAR_29 = VAR_31[0]*VAR_32[1] - VAR_31[1]*VAR_32[0] < 0;",
"ff_opus_rc_put_raw(rc, VAR_29, 1);",
"}",
"VAR_29 = 1 - 2 * VAR_29;",
"cm = FUNC_0(f, rc, band, VAR_31, NULL, N, VAR_20, blocks,\nlowband, duration, lowband_out, level, gain,\nlowband_scratch, VAR_26);",
"VAR_32[0] = -VAR_29 * VAR_31[1];",
"VAR_32[1] = VAR_29 * VAR_31[0];",
"X[0] *= VAR_10;",
"X[1] *= VAR_10;",
"Y[0] *= VAR_11;",
"Y[1] *= VAR_11;",
"VAR_30 = X[0];",
"X[0] = VAR_30 - Y[0];",
"Y[0] = VAR_30 + Y[0];",
"VAR_30 = X[1];",
"X[1] = VAR_30 - Y[1];",
"Y[1] = VAR_30 + Y[1];",
"} else {",
"float *VAR_33 = NULL;",
"float *VAR_34 = NULL;",
"int VAR_35 = 0;",
"int VAR_36;",
"if (VAR_6 > 1 && !VAR_1 && (VAR_19 & 0x3fff)) {",
"if (VAR_19 > 8192)\nVAR_22 -= VAR_22 >> (4 - duration);",
"else\nVAR_22 = FFMIN(0, VAR_22 + (N << 3 >> (5 - duration)));",
"}",
"VAR_20 = av_clip((b - VAR_22) / 2, 0, b);",
"VAR_21 = b - VAR_20;",
"f->remaining2 -= VAR_23;",
"if (lowband && !VAR_1)\nVAR_33 = lowband + N;",
"if (VAR_1)\nVAR_34 = lowband_out;",
"else\nVAR_35 = level + 1;",
"VAR_36 = f->remaining2;",
"if (VAR_20 >= VAR_21) {",
"cm = FUNC_0(f, rc, band, X, NULL, N, VAR_20, blocks,\nlowband, duration, VAR_34,\nVAR_35, VAR_1 ? 1.0f : (gain * VAR_10),\nlowband_scratch, fill);",
"VAR_36 = VAR_20 - (VAR_36 - f->remaining2);",
"if (VAR_36 > 3 << 3 && VAR_19 != 0)\nVAR_21 += VAR_36 - (3 << 3);",
"cm |= FUNC_0(f, rc, band, Y, NULL, N, VAR_21, blocks,\nVAR_33, duration, NULL,\nVAR_35, gain * VAR_11, NULL,\nfill >> blocks) << ((VAR_6 >> 1) & (VAR_1 - 1));",
"} else {",
"cm = FUNC_0(f, rc, band, Y, NULL, N, VAR_21, blocks,\nVAR_33, duration, NULL,\nVAR_35, gain * VAR_11, NULL,\nfill >> blocks) << ((VAR_6 >> 1) & (VAR_1 - 1));",
"VAR_36 = VAR_21 - (VAR_36 - f->remaining2);",
"if (VAR_36 > 3 << 3 && VAR_19 != 16384)\nVAR_20 += VAR_36 - (3 << 3);",
"cm |= FUNC_0(f, rc, band, X, NULL, N, VAR_20, blocks,\nlowband, duration, VAR_34,\nVAR_35, VAR_1 ? 1.0f : (gain * VAR_10),\nlowband_scratch, fill);",
"}",
"}",
"} else {",
"uint32_t q = celt_bits2pulses(VAR_0, b);",
"uint32_t curr_bits = celt_pulses2bits(VAR_0, q);",
"f->remaining2 -= curr_bits;",
"while (f->remaining2 < 0 && q > 0) {",
"f->remaining2 += curr_bits;",
"curr_bits = celt_pulses2bits(VAR_0, --q);",
"f->remaining2 -= curr_bits;",
"}",
"if (q != 0) {",
"cm = celt_alg_quant(rc, X, N, (q < 8) ? q : (8 + (q & 7)) << ((q >> 3) - 1),\nf->spread, blocks, gain);",
"}",
"}",
"return cm;",
"}"
] | [
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5,
7,
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
41
],
[
45
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69,
71
],
[
73
],
[
75
],
[
79
],
[
81
],
[
83
],
[
85,
87
],
[
93,
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
149,
151,
153
],
[
155
],
[
161,
163
],
[
165
],
[
167
],
[
169
],
[
171
],
[
173
],
[
175,
177
],
[
179
],
[
181
],
[
185
],
[
187
],
[
189
],
[
191
],
[
193
],
[
195
],
[
197
],
[
199
],
[
201
],
[
207
],
[
209,
211
],
[
213,
215
],
[
217
],
[
221
],
[
225
],
[
233,
235
],
[
237,
239
],
[
241,
243
],
[
245
],
[
249
],
[
251,
253
],
[
255,
257
],
[
259
],
[
261
],
[
263
],
[
265,
267
],
[
269
],
[
271
],
[
273
],
[
275
],
[
277
],
[
281
],
[
283
],
[
285
],
[
287
],
[
289
],
[
293
],
[
295
],
[
297
],
[
299
],
[
303
],
[
305
],
[
307
],
[
309
],
[
311
],
[
313
],
[
315
],
[
317
],
[
319
],
[
321
],
[
323
],
[
325
],
[
327
],
[
329
],
[
335
],
[
337
],
[
341
],
[
343
],
[
353
],
[
355
],
[
357
],
[
359
],
[
361
],
[
363
],
[
367
],
[
369
],
[
371
],
[
373
],
[
377
],
[
379
],
[
381
],
[
383
],
[
385
],
[
387
],
[
389
],
[
395,
397,
399
],
[
405
],
[
407
],
[
409
],
[
411
],
[
413
],
[
415
],
[
417
],
[
419
],
[
421
],
[
423
],
[
425
],
[
427
],
[
429
],
[
433
],
[
435
],
[
437
],
[
439
],
[
447
],
[
449,
453
],
[
455,
461
],
[
463
],
[
465
],
[
467
],
[
469
],
[
473,
475
],
[
483,
485
],
[
487,
489
],
[
493
],
[
495
],
[
501,
503,
505,
507
],
[
511
],
[
513,
515
],
[
523,
525,
527,
529
],
[
531
],
[
537,
539,
541,
543
],
[
547
],
[
549,
551
],
[
559,
561,
563,
565
],
[
567
],
[
569
],
[
571
],
[
575
],
[
577
],
[
579
],
[
585
],
[
587
],
[
589
],
[
591
],
[
593
],
[
597
],
[
601,
603
],
[
605
],
[
607
],
[
611
],
[
613
]
] |
19,688 | static void pmsav5_data_ap_write(CPUARMState *env, const ARMCPRegInfo *ri,
uint64_t value)
{
env->cp15.c5_data = extended_mpu_ap_bits(value);
}
| true | qemu | 7e09797c299712cafa7bc05dd57c1b13afcc6039 | static void pmsav5_data_ap_write(CPUARMState *env, const ARMCPRegInfo *ri,
uint64_t value)
{
env->cp15.c5_data = extended_mpu_ap_bits(value);
}
| {
"code": [
" env->cp15.c5_data = extended_mpu_ap_bits(value);"
],
"line_no": [
7
]
} | static void FUNC_0(CPUARMState *VAR_0, const ARMCPRegInfo *VAR_1,
uint64_t VAR_2)
{
VAR_0->cp15.c5_data = extended_mpu_ap_bits(VAR_2);
}
| [
"static void FUNC_0(CPUARMState *VAR_0, const ARMCPRegInfo *VAR_1,\nuint64_t VAR_2)\n{",
"VAR_0->cp15.c5_data = extended_mpu_ap_bits(VAR_2);",
"}"
] | [
0,
1,
0
] | [
[
1,
3,
5
],
[
7
],
[
9
]
] |
19,690 | static int mv_read_packet(AVFormatContext *avctx, AVPacket *pkt)
{
MvContext *mv = avctx->priv_data;
AVIOContext *pb = avctx->pb;
AVStream *st = avctx->streams[mv->stream_index];
const AVIndexEntry *index;
int frame = mv->frame[mv->stream_index];
int ret;
uint64_t pos;
if (frame < st->nb_frames) {
index = &st->index_entries[frame];
pos = avio_tell(pb);
if (index->pos > pos)
avio_skip(pb, index->pos - pos);
else if (index->pos < pos) {
if (!pb->seekable)
return AVERROR(EIO);
ret = avio_seek(pb, index->pos, SEEK_SET);
if (ret < 0)
return ret;
}
ret = av_get_packet(pb, pkt, index->size);
if (ret < 0)
return ret;
pkt->stream_index = mv->stream_index;
pkt->pts = index->timestamp;
pkt->flags |= AV_PKT_FLAG_KEY;
mv->frame[mv->stream_index]++;
mv->eof_count = 0;
} else {
mv->eof_count++;
if (mv->eof_count >= avctx->nb_streams)
return AVERROR_EOF;
}
mv->stream_index++;
if (mv->stream_index >= avctx->nb_streams)
mv->stream_index = 0;
return 0;
}
| false | FFmpeg | 362271d72fc38cd1f4b076aff9a12b1104c26760 | static int mv_read_packet(AVFormatContext *avctx, AVPacket *pkt)
{
MvContext *mv = avctx->priv_data;
AVIOContext *pb = avctx->pb;
AVStream *st = avctx->streams[mv->stream_index];
const AVIndexEntry *index;
int frame = mv->frame[mv->stream_index];
int ret;
uint64_t pos;
if (frame < st->nb_frames) {
index = &st->index_entries[frame];
pos = avio_tell(pb);
if (index->pos > pos)
avio_skip(pb, index->pos - pos);
else if (index->pos < pos) {
if (!pb->seekable)
return AVERROR(EIO);
ret = avio_seek(pb, index->pos, SEEK_SET);
if (ret < 0)
return ret;
}
ret = av_get_packet(pb, pkt, index->size);
if (ret < 0)
return ret;
pkt->stream_index = mv->stream_index;
pkt->pts = index->timestamp;
pkt->flags |= AV_PKT_FLAG_KEY;
mv->frame[mv->stream_index]++;
mv->eof_count = 0;
} else {
mv->eof_count++;
if (mv->eof_count >= avctx->nb_streams)
return AVERROR_EOF;
}
mv->stream_index++;
if (mv->stream_index >= avctx->nb_streams)
mv->stream_index = 0;
return 0;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1)
{
MvContext *mv = VAR_0->priv_data;
AVIOContext *pb = VAR_0->pb;
AVStream *st = VAR_0->streams[mv->stream_index];
const AVIndexEntry *VAR_2;
int VAR_3 = mv->VAR_3[mv->stream_index];
int VAR_4;
uint64_t pos;
if (VAR_3 < st->nb_frames) {
VAR_2 = &st->index_entries[VAR_3];
pos = avio_tell(pb);
if (VAR_2->pos > pos)
avio_skip(pb, VAR_2->pos - pos);
else if (VAR_2->pos < pos) {
if (!pb->seekable)
return AVERROR(EIO);
VAR_4 = avio_seek(pb, VAR_2->pos, SEEK_SET);
if (VAR_4 < 0)
return VAR_4;
}
VAR_4 = av_get_packet(pb, VAR_1, VAR_2->size);
if (VAR_4 < 0)
return VAR_4;
VAR_1->stream_index = mv->stream_index;
VAR_1->pts = VAR_2->timestamp;
VAR_1->flags |= AV_PKT_FLAG_KEY;
mv->VAR_3[mv->stream_index]++;
mv->eof_count = 0;
} else {
mv->eof_count++;
if (mv->eof_count >= VAR_0->nb_streams)
return AVERROR_EOF;
}
mv->stream_index++;
if (mv->stream_index >= VAR_0->nb_streams)
mv->stream_index = 0;
return 0;
}
| [
"static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1)\n{",
"MvContext *mv = VAR_0->priv_data;",
"AVIOContext *pb = VAR_0->pb;",
"AVStream *st = VAR_0->streams[mv->stream_index];",
"const AVIndexEntry *VAR_2;",
"int VAR_3 = mv->VAR_3[mv->stream_index];",
"int VAR_4;",
"uint64_t pos;",
"if (VAR_3 < st->nb_frames) {",
"VAR_2 = &st->index_entries[VAR_3];",
"pos = avio_tell(pb);",
"if (VAR_2->pos > pos)\navio_skip(pb, VAR_2->pos - pos);",
"else if (VAR_2->pos < pos) {",
"if (!pb->seekable)\nreturn AVERROR(EIO);",
"VAR_4 = avio_seek(pb, VAR_2->pos, SEEK_SET);",
"if (VAR_4 < 0)\nreturn VAR_4;",
"}",
"VAR_4 = av_get_packet(pb, VAR_1, VAR_2->size);",
"if (VAR_4 < 0)\nreturn VAR_4;",
"VAR_1->stream_index = mv->stream_index;",
"VAR_1->pts = VAR_2->timestamp;",
"VAR_1->flags |= AV_PKT_FLAG_KEY;",
"mv->VAR_3[mv->stream_index]++;",
"mv->eof_count = 0;",
"} else {",
"mv->eof_count++;",
"if (mv->eof_count >= VAR_0->nb_streams)\nreturn AVERROR_EOF;",
"}",
"mv->stream_index++;",
"if (mv->stream_index >= VAR_0->nb_streams)\nmv->stream_index = 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
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
21
],
[
23
],
[
25
],
[
27,
29
],
[
31
],
[
33,
35
],
[
37
],
[
39,
41
],
[
43
],
[
45
],
[
47,
49
],
[
53
],
[
55
],
[
57
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69,
71
],
[
73
],
[
77
],
[
79,
81
],
[
85
],
[
87
]
] |
19,691 | static int adx_parse(AVCodecParserContext *s1,
AVCodecContext *avctx,
const uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size)
{
ADXParseContext *s = s1->priv_data;
ParseContext *pc = &s->pc;
int next = END_NOT_FOUND;
if (!avctx->extradata_size) {
int ret;
ff_combine_frame(pc, END_NOT_FOUND, &buf, &buf_size);
if (!s->header_size && pc->index >= MIN_HEADER_SIZE) {
if (ret = avpriv_adx_decode_header(avctx, pc->buffer, pc->index,
&s->header_size, NULL))
return AVERROR_INVALIDDATA;
s->block_size = BLOCK_SIZE * avctx->channels;
}
if (s->header_size && s->header_size <= pc->index) {
avctx->extradata = av_mallocz(s->header_size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!avctx->extradata)
return AVERROR(ENOMEM);
avctx->extradata_size = s->header_size;
memcpy(avctx->extradata, pc->buffer, s->header_size);
memmove(pc->buffer, pc->buffer + s->header_size, s->header_size);
pc->index -= s->header_size;
}
*poutbuf = NULL;
*poutbuf_size = 0;
return buf_size;
}
if (pc->index - s->buf_pos >= s->block_size) {
*poutbuf = &pc->buffer[s->buf_pos];
*poutbuf_size = s->block_size;
s->buf_pos += s->block_size;
return 0;
}
if (pc->index && s->buf_pos) {
memmove(pc->buffer, &pc->buffer[s->buf_pos], pc->index - s->buf_pos);
pc->index -= s->buf_pos;
s->buf_pos = 0;
}
if (buf_size + pc->index >= s->block_size)
next = s->block_size - pc->index;
if (ff_combine_frame(pc, next, &buf, &buf_size) < 0 || !buf_size) {
*poutbuf = NULL;
*poutbuf_size = 0;
return buf_size;
}
*poutbuf = buf;
*poutbuf_size = buf_size;
return next;
}
| false | FFmpeg | b024209b1fe57b7902d30a8e0d38f5ecb628e6f3 | static int adx_parse(AVCodecParserContext *s1,
AVCodecContext *avctx,
const uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size)
{
ADXParseContext *s = s1->priv_data;
ParseContext *pc = &s->pc;
int next = END_NOT_FOUND;
if (!avctx->extradata_size) {
int ret;
ff_combine_frame(pc, END_NOT_FOUND, &buf, &buf_size);
if (!s->header_size && pc->index >= MIN_HEADER_SIZE) {
if (ret = avpriv_adx_decode_header(avctx, pc->buffer, pc->index,
&s->header_size, NULL))
return AVERROR_INVALIDDATA;
s->block_size = BLOCK_SIZE * avctx->channels;
}
if (s->header_size && s->header_size <= pc->index) {
avctx->extradata = av_mallocz(s->header_size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!avctx->extradata)
return AVERROR(ENOMEM);
avctx->extradata_size = s->header_size;
memcpy(avctx->extradata, pc->buffer, s->header_size);
memmove(pc->buffer, pc->buffer + s->header_size, s->header_size);
pc->index -= s->header_size;
}
*poutbuf = NULL;
*poutbuf_size = 0;
return buf_size;
}
if (pc->index - s->buf_pos >= s->block_size) {
*poutbuf = &pc->buffer[s->buf_pos];
*poutbuf_size = s->block_size;
s->buf_pos += s->block_size;
return 0;
}
if (pc->index && s->buf_pos) {
memmove(pc->buffer, &pc->buffer[s->buf_pos], pc->index - s->buf_pos);
pc->index -= s->buf_pos;
s->buf_pos = 0;
}
if (buf_size + pc->index >= s->block_size)
next = s->block_size - pc->index;
if (ff_combine_frame(pc, next, &buf, &buf_size) < 0 || !buf_size) {
*poutbuf = NULL;
*poutbuf_size = 0;
return buf_size;
}
*poutbuf = buf;
*poutbuf_size = buf_size;
return next;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(AVCodecParserContext *VAR_0,
AVCodecContext *VAR_1,
const uint8_t **VAR_2, int *VAR_3,
const uint8_t *VAR_4, int VAR_5)
{
ADXParseContext *s = VAR_0->priv_data;
ParseContext *pc = &s->pc;
int VAR_6 = END_NOT_FOUND;
if (!VAR_1->extradata_size) {
int VAR_7;
ff_combine_frame(pc, END_NOT_FOUND, &VAR_4, &VAR_5);
if (!s->header_size && pc->index >= MIN_HEADER_SIZE) {
if (VAR_7 = avpriv_adx_decode_header(VAR_1, pc->buffer, pc->index,
&s->header_size, NULL))
return AVERROR_INVALIDDATA;
s->block_size = BLOCK_SIZE * VAR_1->channels;
}
if (s->header_size && s->header_size <= pc->index) {
VAR_1->extradata = av_mallocz(s->header_size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!VAR_1->extradata)
return AVERROR(ENOMEM);
VAR_1->extradata_size = s->header_size;
memcpy(VAR_1->extradata, pc->buffer, s->header_size);
memmove(pc->buffer, pc->buffer + s->header_size, s->header_size);
pc->index -= s->header_size;
}
*VAR_2 = NULL;
*VAR_3 = 0;
return VAR_5;
}
if (pc->index - s->buf_pos >= s->block_size) {
*VAR_2 = &pc->buffer[s->buf_pos];
*VAR_3 = s->block_size;
s->buf_pos += s->block_size;
return 0;
}
if (pc->index && s->buf_pos) {
memmove(pc->buffer, &pc->buffer[s->buf_pos], pc->index - s->buf_pos);
pc->index -= s->buf_pos;
s->buf_pos = 0;
}
if (VAR_5 + pc->index >= s->block_size)
VAR_6 = s->block_size - pc->index;
if (ff_combine_frame(pc, VAR_6, &VAR_4, &VAR_5) < 0 || !VAR_5) {
*VAR_2 = NULL;
*VAR_3 = 0;
return VAR_5;
}
*VAR_2 = VAR_4;
*VAR_3 = VAR_5;
return VAR_6;
}
| [
"static int FUNC_0(AVCodecParserContext *VAR_0,\nAVCodecContext *VAR_1,\nconst uint8_t **VAR_2, int *VAR_3,\nconst uint8_t *VAR_4, int VAR_5)\n{",
"ADXParseContext *s = VAR_0->priv_data;",
"ParseContext *pc = &s->pc;",
"int VAR_6 = END_NOT_FOUND;",
"if (!VAR_1->extradata_size) {",
"int VAR_7;",
"ff_combine_frame(pc, END_NOT_FOUND, &VAR_4, &VAR_5);",
"if (!s->header_size && pc->index >= MIN_HEADER_SIZE) {",
"if (VAR_7 = avpriv_adx_decode_header(VAR_1, pc->buffer, pc->index,\n&s->header_size, NULL))\nreturn AVERROR_INVALIDDATA;",
"s->block_size = BLOCK_SIZE * VAR_1->channels;",
"}",
"if (s->header_size && s->header_size <= pc->index) {",
"VAR_1->extradata = av_mallocz(s->header_size + FF_INPUT_BUFFER_PADDING_SIZE);",
"if (!VAR_1->extradata)\nreturn AVERROR(ENOMEM);",
"VAR_1->extradata_size = s->header_size;",
"memcpy(VAR_1->extradata, pc->buffer, s->header_size);",
"memmove(pc->buffer, pc->buffer + s->header_size, s->header_size);",
"pc->index -= s->header_size;",
"}",
"*VAR_2 = NULL;",
"*VAR_3 = 0;",
"return VAR_5;",
"}",
"if (pc->index - s->buf_pos >= s->block_size) {",
"*VAR_2 = &pc->buffer[s->buf_pos];",
"*VAR_3 = s->block_size;",
"s->buf_pos += s->block_size;",
"return 0;",
"}",
"if (pc->index && s->buf_pos) {",
"memmove(pc->buffer, &pc->buffer[s->buf_pos], pc->index - s->buf_pos);",
"pc->index -= s->buf_pos;",
"s->buf_pos = 0;",
"}",
"if (VAR_5 + pc->index >= s->block_size)\nVAR_6 = s->block_size - pc->index;",
"if (ff_combine_frame(pc, VAR_6, &VAR_4, &VAR_5) < 0 || !VAR_5) {",
"*VAR_2 = NULL;",
"*VAR_3 = 0;",
"return VAR_5;",
"}",
"*VAR_2 = VAR_4;",
"*VAR_3 = VAR_5;",
"return VAR_6;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5,
7,
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
25
],
[
29
],
[
31,
33,
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45,
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91,
93
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
]
] |
19,692 | void ff_put_h264_qpel8_mc10_msa(uint8_t *dst, const uint8_t *src,
ptrdiff_t stride)
{
avc_luma_hz_qrt_8w_msa(src - 2, stride, dst, stride, 8, 0);
}
| false | FFmpeg | b5da07d4340a8e8e40dcd1900977a76ff31fbb84 | void ff_put_h264_qpel8_mc10_msa(uint8_t *dst, const uint8_t *src,
ptrdiff_t stride)
{
avc_luma_hz_qrt_8w_msa(src - 2, stride, dst, stride, 8, 0);
}
| {
"code": [],
"line_no": []
} | void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1,
ptrdiff_t VAR_2)
{
avc_luma_hz_qrt_8w_msa(VAR_1 - 2, VAR_2, VAR_0, VAR_2, 8, 0);
}
| [
"void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1,\nptrdiff_t VAR_2)\n{",
"avc_luma_hz_qrt_8w_msa(VAR_1 - 2, VAR_2, VAR_0, VAR_2, 8, 0);",
"}"
] | [
0,
0,
0
] | [
[
1,
3,
5
],
[
7
],
[
9
]
] |
19,693 | static int decode_dvd_subtitles(AVSubtitle *sub_header,
const uint8_t *buf, int buf_size)
{
int cmd_pos, pos, cmd, x1, y1, x2, y2, offset1, offset2, next_cmd_pos;
int big_offsets, offset_size, is_8bit = 0;
const uint8_t *yuv_palette = 0;
uint8_t colormap[4], alpha[256];
int date;
int i;
int is_menu = 0;
if (buf_size < 10)
return -1;
memset(sub_header, 0, sizeof(*sub_header));
if (AV_RB16(buf) == 0) { /* HD subpicture with 4-byte offsets */
big_offsets = 1;
offset_size = 4;
cmd_pos = 6;
} else {
big_offsets = 0;
offset_size = 2;
cmd_pos = 2;
}
cmd_pos = READ_OFFSET(buf + cmd_pos);
while (cmd_pos > 0 && cmd_pos < buf_size - 2 - offset_size) {
date = AV_RB16(buf + cmd_pos);
next_cmd_pos = READ_OFFSET(buf + cmd_pos + 2);
av_dlog(NULL, "cmd_pos=0x%04x next=0x%04x date=%d\n",
cmd_pos, next_cmd_pos, date);
pos = cmd_pos + 2 + offset_size;
offset1 = -1;
offset2 = -1;
x1 = y1 = x2 = y2 = 0;
while (pos < buf_size) {
cmd = buf[pos++];
av_dlog(NULL, "cmd=%02x\n", cmd);
switch(cmd) {
case 0x00:
/* menu subpicture */
is_menu = 1;
break;
case 0x01:
/* set start date */
sub_header->start_display_time = (date << 10) / 90;
break;
case 0x02:
/* set end date */
sub_header->end_display_time = (date << 10) / 90;
break;
case 0x03:
/* set colormap */
if ((buf_size - pos) < 2)
goto fail;
colormap[3] = buf[pos] >> 4;
colormap[2] = buf[pos] & 0x0f;
colormap[1] = buf[pos + 1] >> 4;
colormap[0] = buf[pos + 1] & 0x0f;
pos += 2;
break;
case 0x04:
/* set alpha */
if ((buf_size - pos) < 2)
goto fail;
alpha[3] = buf[pos] >> 4;
alpha[2] = buf[pos] & 0x0f;
alpha[1] = buf[pos + 1] >> 4;
alpha[0] = buf[pos + 1] & 0x0f;
pos += 2;
av_dlog(NULL, "alpha=%x%x%x%x\n", alpha[0],alpha[1],alpha[2],alpha[3]);
break;
case 0x05:
case 0x85:
if ((buf_size - pos) < 6)
goto fail;
x1 = (buf[pos] << 4) | (buf[pos + 1] >> 4);
x2 = ((buf[pos + 1] & 0x0f) << 8) | buf[pos + 2];
y1 = (buf[pos + 3] << 4) | (buf[pos + 4] >> 4);
y2 = ((buf[pos + 4] & 0x0f) << 8) | buf[pos + 5];
if (cmd & 0x80)
is_8bit = 1;
av_dlog(NULL, "x1=%d x2=%d y1=%d y2=%d\n", x1, x2, y1, y2);
pos += 6;
break;
case 0x06:
if ((buf_size - pos) < 4)
goto fail;
offset1 = AV_RB16(buf + pos);
offset2 = AV_RB16(buf + pos + 2);
av_dlog(NULL, "offset1=0x%04x offset2=0x%04x\n", offset1, offset2);
pos += 4;
break;
case 0x86:
if ((buf_size - pos) < 8)
goto fail;
offset1 = AV_RB32(buf + pos);
offset2 = AV_RB32(buf + pos + 4);
av_dlog(NULL, "offset1=0x%04x offset2=0x%04x\n", offset1, offset2);
pos += 8;
break;
case 0x83:
/* HD set palette */
if ((buf_size - pos) < 768)
goto fail;
yuv_palette = buf + pos;
pos += 768;
break;
case 0x84:
/* HD set contrast (alpha) */
if ((buf_size - pos) < 256)
goto fail;
for (i = 0; i < 256; i++)
alpha[i] = 0xFF - buf[pos+i];
pos += 256;
break;
case 0xff:
goto the_end;
default:
av_dlog(NULL, "unrecognised subpicture command 0x%x\n", cmd);
goto the_end;
}
}
the_end:
if (offset1 >= 0) {
int w, h;
uint8_t *bitmap;
/* decode the bitmap */
w = x2 - x1 + 1;
if (w < 0)
w = 0;
h = y2 - y1;
if (h < 0)
h = 0;
if (w > 0 && h > 0) {
if (sub_header->rects != NULL) {
for (i = 0; i < sub_header->num_rects; i++) {
av_freep(&sub_header->rects[i]->pict.data[0]);
av_freep(&sub_header->rects[i]->pict.data[1]);
av_freep(&sub_header->rects[i]);
}
av_freep(&sub_header->rects);
sub_header->num_rects = 0;
}
bitmap = av_malloc(w * h);
sub_header->rects = av_mallocz(sizeof(*sub_header->rects));
sub_header->rects[0] = av_mallocz(sizeof(AVSubtitleRect));
sub_header->num_rects = 1;
sub_header->rects[0]->pict.data[0] = bitmap;
decode_rle(bitmap, w * 2, w, (h + 1) / 2,
buf, offset1, buf_size, is_8bit);
decode_rle(bitmap + w, w * 2, w, h / 2,
buf, offset2, buf_size, is_8bit);
sub_header->rects[0]->pict.data[1] = av_mallocz(AVPALETTE_SIZE);
if (is_8bit) {
if (yuv_palette == 0)
goto fail;
sub_header->rects[0]->nb_colors = 256;
yuv_a_to_rgba(yuv_palette, alpha, (uint32_t*)sub_header->rects[0]->pict.data[1], 256);
} else {
sub_header->rects[0]->nb_colors = 4;
guess_palette((uint32_t*)sub_header->rects[0]->pict.data[1],
colormap, alpha, 0xffff00);
}
sub_header->rects[0]->x = x1;
sub_header->rects[0]->y = y1;
sub_header->rects[0]->w = w;
sub_header->rects[0]->h = h;
sub_header->rects[0]->type = SUBTITLE_BITMAP;
sub_header->rects[0]->pict.linesize[0] = w;
}
}
if (next_cmd_pos == cmd_pos)
break;
cmd_pos = next_cmd_pos;
}
if (sub_header->num_rects > 0)
return is_menu;
fail:
if (sub_header->rects != NULL) {
for (i = 0; i < sub_header->num_rects; i++) {
av_freep(&sub_header->rects[i]->pict.data[0]);
av_freep(&sub_header->rects[i]->pict.data[1]);
av_freep(&sub_header->rects[i]);
}
av_freep(&sub_header->rects);
sub_header->num_rects = 0;
}
return -1;
}
| false | FFmpeg | 3ee8ca9b0894df3aaf5086c643283cb58ef9763d | static int decode_dvd_subtitles(AVSubtitle *sub_header,
const uint8_t *buf, int buf_size)
{
int cmd_pos, pos, cmd, x1, y1, x2, y2, offset1, offset2, next_cmd_pos;
int big_offsets, offset_size, is_8bit = 0;
const uint8_t *yuv_palette = 0;
uint8_t colormap[4], alpha[256];
int date;
int i;
int is_menu = 0;
if (buf_size < 10)
return -1;
memset(sub_header, 0, sizeof(*sub_header));
if (AV_RB16(buf) == 0) {
big_offsets = 1;
offset_size = 4;
cmd_pos = 6;
} else {
big_offsets = 0;
offset_size = 2;
cmd_pos = 2;
}
cmd_pos = READ_OFFSET(buf + cmd_pos);
while (cmd_pos > 0 && cmd_pos < buf_size - 2 - offset_size) {
date = AV_RB16(buf + cmd_pos);
next_cmd_pos = READ_OFFSET(buf + cmd_pos + 2);
av_dlog(NULL, "cmd_pos=0x%04x next=0x%04x date=%d\n",
cmd_pos, next_cmd_pos, date);
pos = cmd_pos + 2 + offset_size;
offset1 = -1;
offset2 = -1;
x1 = y1 = x2 = y2 = 0;
while (pos < buf_size) {
cmd = buf[pos++];
av_dlog(NULL, "cmd=%02x\n", cmd);
switch(cmd) {
case 0x00:
is_menu = 1;
break;
case 0x01:
sub_header->start_display_time = (date << 10) / 90;
break;
case 0x02:
sub_header->end_display_time = (date << 10) / 90;
break;
case 0x03:
if ((buf_size - pos) < 2)
goto fail;
colormap[3] = buf[pos] >> 4;
colormap[2] = buf[pos] & 0x0f;
colormap[1] = buf[pos + 1] >> 4;
colormap[0] = buf[pos + 1] & 0x0f;
pos += 2;
break;
case 0x04:
if ((buf_size - pos) < 2)
goto fail;
alpha[3] = buf[pos] >> 4;
alpha[2] = buf[pos] & 0x0f;
alpha[1] = buf[pos + 1] >> 4;
alpha[0] = buf[pos + 1] & 0x0f;
pos += 2;
av_dlog(NULL, "alpha=%x%x%x%x\n", alpha[0],alpha[1],alpha[2],alpha[3]);
break;
case 0x05:
case 0x85:
if ((buf_size - pos) < 6)
goto fail;
x1 = (buf[pos] << 4) | (buf[pos + 1] >> 4);
x2 = ((buf[pos + 1] & 0x0f) << 8) | buf[pos + 2];
y1 = (buf[pos + 3] << 4) | (buf[pos + 4] >> 4);
y2 = ((buf[pos + 4] & 0x0f) << 8) | buf[pos + 5];
if (cmd & 0x80)
is_8bit = 1;
av_dlog(NULL, "x1=%d x2=%d y1=%d y2=%d\n", x1, x2, y1, y2);
pos += 6;
break;
case 0x06:
if ((buf_size - pos) < 4)
goto fail;
offset1 = AV_RB16(buf + pos);
offset2 = AV_RB16(buf + pos + 2);
av_dlog(NULL, "offset1=0x%04x offset2=0x%04x\n", offset1, offset2);
pos += 4;
break;
case 0x86:
if ((buf_size - pos) < 8)
goto fail;
offset1 = AV_RB32(buf + pos);
offset2 = AV_RB32(buf + pos + 4);
av_dlog(NULL, "offset1=0x%04x offset2=0x%04x\n", offset1, offset2);
pos += 8;
break;
case 0x83:
if ((buf_size - pos) < 768)
goto fail;
yuv_palette = buf + pos;
pos += 768;
break;
case 0x84:
if ((buf_size - pos) < 256)
goto fail;
for (i = 0; i < 256; i++)
alpha[i] = 0xFF - buf[pos+i];
pos += 256;
break;
case 0xff:
goto the_end;
default:
av_dlog(NULL, "unrecognised subpicture command 0x%x\n", cmd);
goto the_end;
}
}
the_end:
if (offset1 >= 0) {
int w, h;
uint8_t *bitmap;
w = x2 - x1 + 1;
if (w < 0)
w = 0;
h = y2 - y1;
if (h < 0)
h = 0;
if (w > 0 && h > 0) {
if (sub_header->rects != NULL) {
for (i = 0; i < sub_header->num_rects; i++) {
av_freep(&sub_header->rects[i]->pict.data[0]);
av_freep(&sub_header->rects[i]->pict.data[1]);
av_freep(&sub_header->rects[i]);
}
av_freep(&sub_header->rects);
sub_header->num_rects = 0;
}
bitmap = av_malloc(w * h);
sub_header->rects = av_mallocz(sizeof(*sub_header->rects));
sub_header->rects[0] = av_mallocz(sizeof(AVSubtitleRect));
sub_header->num_rects = 1;
sub_header->rects[0]->pict.data[0] = bitmap;
decode_rle(bitmap, w * 2, w, (h + 1) / 2,
buf, offset1, buf_size, is_8bit);
decode_rle(bitmap + w, w * 2, w, h / 2,
buf, offset2, buf_size, is_8bit);
sub_header->rects[0]->pict.data[1] = av_mallocz(AVPALETTE_SIZE);
if (is_8bit) {
if (yuv_palette == 0)
goto fail;
sub_header->rects[0]->nb_colors = 256;
yuv_a_to_rgba(yuv_palette, alpha, (uint32_t*)sub_header->rects[0]->pict.data[1], 256);
} else {
sub_header->rects[0]->nb_colors = 4;
guess_palette((uint32_t*)sub_header->rects[0]->pict.data[1],
colormap, alpha, 0xffff00);
}
sub_header->rects[0]->x = x1;
sub_header->rects[0]->y = y1;
sub_header->rects[0]->w = w;
sub_header->rects[0]->h = h;
sub_header->rects[0]->type = SUBTITLE_BITMAP;
sub_header->rects[0]->pict.linesize[0] = w;
}
}
if (next_cmd_pos == cmd_pos)
break;
cmd_pos = next_cmd_pos;
}
if (sub_header->num_rects > 0)
return is_menu;
fail:
if (sub_header->rects != NULL) {
for (i = 0; i < sub_header->num_rects; i++) {
av_freep(&sub_header->rects[i]->pict.data[0]);
av_freep(&sub_header->rects[i]->pict.data[1]);
av_freep(&sub_header->rects[i]);
}
av_freep(&sub_header->rects);
sub_header->num_rects = 0;
}
return -1;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(AVSubtitle *VAR_0,
const uint8_t *VAR_1, int VAR_2)
{
int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12;
int VAR_13, VAR_14, VAR_15 = 0;
const uint8_t *VAR_16 = 0;
uint8_t colormap[4], alpha[256];
int VAR_17;
int VAR_18;
int VAR_19 = 0;
if (VAR_2 < 10)
return -1;
memset(VAR_0, 0, sizeof(*VAR_0));
if (AV_RB16(VAR_1) == 0) {
VAR_13 = 1;
VAR_14 = 4;
VAR_3 = 6;
} else {
VAR_13 = 0;
VAR_14 = 2;
VAR_3 = 2;
}
VAR_3 = READ_OFFSET(VAR_1 + VAR_3);
while (VAR_3 > 0 && VAR_3 < VAR_2 - 2 - VAR_14) {
VAR_17 = AV_RB16(VAR_1 + VAR_3);
VAR_12 = READ_OFFSET(VAR_1 + VAR_3 + 2);
av_dlog(NULL, "VAR_3=0x%04x next=0x%04x VAR_17=%d\n",
VAR_3, VAR_12, VAR_17);
VAR_4 = VAR_3 + 2 + VAR_14;
VAR_10 = -1;
VAR_11 = -1;
VAR_6 = VAR_7 = VAR_8 = VAR_9 = 0;
while (VAR_4 < VAR_2) {
VAR_5 = VAR_1[VAR_4++];
av_dlog(NULL, "VAR_5=%02x\n", VAR_5);
switch(VAR_5) {
case 0x00:
VAR_19 = 1;
break;
case 0x01:
VAR_0->start_display_time = (VAR_17 << 10) / 90;
break;
case 0x02:
VAR_0->end_display_time = (VAR_17 << 10) / 90;
break;
case 0x03:
if ((VAR_2 - VAR_4) < 2)
goto fail;
colormap[3] = VAR_1[VAR_4] >> 4;
colormap[2] = VAR_1[VAR_4] & 0x0f;
colormap[1] = VAR_1[VAR_4 + 1] >> 4;
colormap[0] = VAR_1[VAR_4 + 1] & 0x0f;
VAR_4 += 2;
break;
case 0x04:
if ((VAR_2 - VAR_4) < 2)
goto fail;
alpha[3] = VAR_1[VAR_4] >> 4;
alpha[2] = VAR_1[VAR_4] & 0x0f;
alpha[1] = VAR_1[VAR_4 + 1] >> 4;
alpha[0] = VAR_1[VAR_4 + 1] & 0x0f;
VAR_4 += 2;
av_dlog(NULL, "alpha=%x%x%x%x\n", alpha[0],alpha[1],alpha[2],alpha[3]);
break;
case 0x05:
case 0x85:
if ((VAR_2 - VAR_4) < 6)
goto fail;
VAR_6 = (VAR_1[VAR_4] << 4) | (VAR_1[VAR_4 + 1] >> 4);
VAR_8 = ((VAR_1[VAR_4 + 1] & 0x0f) << 8) | VAR_1[VAR_4 + 2];
VAR_7 = (VAR_1[VAR_4 + 3] << 4) | (VAR_1[VAR_4 + 4] >> 4);
VAR_9 = ((VAR_1[VAR_4 + 4] & 0x0f) << 8) | VAR_1[VAR_4 + 5];
if (VAR_5 & 0x80)
VAR_15 = 1;
av_dlog(NULL, "VAR_6=%d VAR_8=%d VAR_7=%d VAR_9=%d\n", VAR_6, VAR_8, VAR_7, VAR_9);
VAR_4 += 6;
break;
case 0x06:
if ((VAR_2 - VAR_4) < 4)
goto fail;
VAR_10 = AV_RB16(VAR_1 + VAR_4);
VAR_11 = AV_RB16(VAR_1 + VAR_4 + 2);
av_dlog(NULL, "VAR_10=0x%04x VAR_11=0x%04x\n", VAR_10, VAR_11);
VAR_4 += 4;
break;
case 0x86:
if ((VAR_2 - VAR_4) < 8)
goto fail;
VAR_10 = AV_RB32(VAR_1 + VAR_4);
VAR_11 = AV_RB32(VAR_1 + VAR_4 + 4);
av_dlog(NULL, "VAR_10=0x%04x VAR_11=0x%04x\n", VAR_10, VAR_11);
VAR_4 += 8;
break;
case 0x83:
if ((VAR_2 - VAR_4) < 768)
goto fail;
VAR_16 = VAR_1 + VAR_4;
VAR_4 += 768;
break;
case 0x84:
if ((VAR_2 - VAR_4) < 256)
goto fail;
for (VAR_18 = 0; VAR_18 < 256; VAR_18++)
alpha[VAR_18] = 0xFF - VAR_1[VAR_4+VAR_18];
VAR_4 += 256;
break;
case 0xff:
goto the_end;
default:
av_dlog(NULL, "unrecognised subpicture command 0x%x\n", VAR_5);
goto the_end;
}
}
the_end:
if (VAR_10 >= 0) {
int VAR_20, VAR_21;
uint8_t *bitmap;
VAR_20 = VAR_8 - VAR_6 + 1;
if (VAR_20 < 0)
VAR_20 = 0;
VAR_21 = VAR_9 - VAR_7;
if (VAR_21 < 0)
VAR_21 = 0;
if (VAR_20 > 0 && VAR_21 > 0) {
if (VAR_0->rects != NULL) {
for (VAR_18 = 0; VAR_18 < VAR_0->num_rects; VAR_18++) {
av_freep(&VAR_0->rects[VAR_18]->pict.data[0]);
av_freep(&VAR_0->rects[VAR_18]->pict.data[1]);
av_freep(&VAR_0->rects[VAR_18]);
}
av_freep(&VAR_0->rects);
VAR_0->num_rects = 0;
}
bitmap = av_malloc(VAR_20 * VAR_21);
VAR_0->rects = av_mallocz(sizeof(*VAR_0->rects));
VAR_0->rects[0] = av_mallocz(sizeof(AVSubtitleRect));
VAR_0->num_rects = 1;
VAR_0->rects[0]->pict.data[0] = bitmap;
decode_rle(bitmap, VAR_20 * 2, VAR_20, (VAR_21 + 1) / 2,
VAR_1, VAR_10, VAR_2, VAR_15);
decode_rle(bitmap + VAR_20, VAR_20 * 2, VAR_20, VAR_21 / 2,
VAR_1, VAR_11, VAR_2, VAR_15);
VAR_0->rects[0]->pict.data[1] = av_mallocz(AVPALETTE_SIZE);
if (VAR_15) {
if (VAR_16 == 0)
goto fail;
VAR_0->rects[0]->nb_colors = 256;
yuv_a_to_rgba(VAR_16, alpha, (uint32_t*)VAR_0->rects[0]->pict.data[1], 256);
} else {
VAR_0->rects[0]->nb_colors = 4;
guess_palette((uint32_t*)VAR_0->rects[0]->pict.data[1],
colormap, alpha, 0xffff00);
}
VAR_0->rects[0]->x = VAR_6;
VAR_0->rects[0]->y = VAR_7;
VAR_0->rects[0]->VAR_20 = VAR_20;
VAR_0->rects[0]->VAR_21 = VAR_21;
VAR_0->rects[0]->type = SUBTITLE_BITMAP;
VAR_0->rects[0]->pict.linesize[0] = VAR_20;
}
}
if (VAR_12 == VAR_3)
break;
VAR_3 = VAR_12;
}
if (VAR_0->num_rects > 0)
return VAR_19;
fail:
if (VAR_0->rects != NULL) {
for (VAR_18 = 0; VAR_18 < VAR_0->num_rects; VAR_18++) {
av_freep(&VAR_0->rects[VAR_18]->pict.data[0]);
av_freep(&VAR_0->rects[VAR_18]->pict.data[1]);
av_freep(&VAR_0->rects[VAR_18]);
}
av_freep(&VAR_0->rects);
VAR_0->num_rects = 0;
}
return -1;
}
| [
"static int FUNC_0(AVSubtitle *VAR_0,\nconst uint8_t *VAR_1, int VAR_2)\n{",
"int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12;",
"int VAR_13, VAR_14, VAR_15 = 0;",
"const uint8_t *VAR_16 = 0;",
"uint8_t colormap[4], alpha[256];",
"int VAR_17;",
"int VAR_18;",
"int VAR_19 = 0;",
"if (VAR_2 < 10)\nreturn -1;",
"memset(VAR_0, 0, sizeof(*VAR_0));",
"if (AV_RB16(VAR_1) == 0) {",
"VAR_13 = 1;",
"VAR_14 = 4;",
"VAR_3 = 6;",
"} else {",
"VAR_13 = 0;",
"VAR_14 = 2;",
"VAR_3 = 2;",
"}",
"VAR_3 = READ_OFFSET(VAR_1 + VAR_3);",
"while (VAR_3 > 0 && VAR_3 < VAR_2 - 2 - VAR_14) {",
"VAR_17 = AV_RB16(VAR_1 + VAR_3);",
"VAR_12 = READ_OFFSET(VAR_1 + VAR_3 + 2);",
"av_dlog(NULL, \"VAR_3=0x%04x next=0x%04x VAR_17=%d\\n\",\nVAR_3, VAR_12, VAR_17);",
"VAR_4 = VAR_3 + 2 + VAR_14;",
"VAR_10 = -1;",
"VAR_11 = -1;",
"VAR_6 = VAR_7 = VAR_8 = VAR_9 = 0;",
"while (VAR_4 < VAR_2) {",
"VAR_5 = VAR_1[VAR_4++];",
"av_dlog(NULL, \"VAR_5=%02x\\n\", VAR_5);",
"switch(VAR_5) {",
"case 0x00:\nVAR_19 = 1;",
"break;",
"case 0x01:\nVAR_0->start_display_time = (VAR_17 << 10) / 90;",
"break;",
"case 0x02:\nVAR_0->end_display_time = (VAR_17 << 10) / 90;",
"break;",
"case 0x03:\nif ((VAR_2 - VAR_4) < 2)\ngoto fail;",
"colormap[3] = VAR_1[VAR_4] >> 4;",
"colormap[2] = VAR_1[VAR_4] & 0x0f;",
"colormap[1] = VAR_1[VAR_4 + 1] >> 4;",
"colormap[0] = VAR_1[VAR_4 + 1] & 0x0f;",
"VAR_4 += 2;",
"break;",
"case 0x04:\nif ((VAR_2 - VAR_4) < 2)\ngoto fail;",
"alpha[3] = VAR_1[VAR_4] >> 4;",
"alpha[2] = VAR_1[VAR_4] & 0x0f;",
"alpha[1] = VAR_1[VAR_4 + 1] >> 4;",
"alpha[0] = VAR_1[VAR_4 + 1] & 0x0f;",
"VAR_4 += 2;",
"av_dlog(NULL, \"alpha=%x%x%x%x\\n\", alpha[0],alpha[1],alpha[2],alpha[3]);",
"break;",
"case 0x05:\ncase 0x85:\nif ((VAR_2 - VAR_4) < 6)\ngoto fail;",
"VAR_6 = (VAR_1[VAR_4] << 4) | (VAR_1[VAR_4 + 1] >> 4);",
"VAR_8 = ((VAR_1[VAR_4 + 1] & 0x0f) << 8) | VAR_1[VAR_4 + 2];",
"VAR_7 = (VAR_1[VAR_4 + 3] << 4) | (VAR_1[VAR_4 + 4] >> 4);",
"VAR_9 = ((VAR_1[VAR_4 + 4] & 0x0f) << 8) | VAR_1[VAR_4 + 5];",
"if (VAR_5 & 0x80)\nVAR_15 = 1;",
"av_dlog(NULL, \"VAR_6=%d VAR_8=%d VAR_7=%d VAR_9=%d\\n\", VAR_6, VAR_8, VAR_7, VAR_9);",
"VAR_4 += 6;",
"break;",
"case 0x06:\nif ((VAR_2 - VAR_4) < 4)\ngoto fail;",
"VAR_10 = AV_RB16(VAR_1 + VAR_4);",
"VAR_11 = AV_RB16(VAR_1 + VAR_4 + 2);",
"av_dlog(NULL, \"VAR_10=0x%04x VAR_11=0x%04x\\n\", VAR_10, VAR_11);",
"VAR_4 += 4;",
"break;",
"case 0x86:\nif ((VAR_2 - VAR_4) < 8)\ngoto fail;",
"VAR_10 = AV_RB32(VAR_1 + VAR_4);",
"VAR_11 = AV_RB32(VAR_1 + VAR_4 + 4);",
"av_dlog(NULL, \"VAR_10=0x%04x VAR_11=0x%04x\\n\", VAR_10, VAR_11);",
"VAR_4 += 8;",
"break;",
"case 0x83:\nif ((VAR_2 - VAR_4) < 768)\ngoto fail;",
"VAR_16 = VAR_1 + VAR_4;",
"VAR_4 += 768;",
"break;",
"case 0x84:\nif ((VAR_2 - VAR_4) < 256)\ngoto fail;",
"for (VAR_18 = 0; VAR_18 < 256; VAR_18++)",
"alpha[VAR_18] = 0xFF - VAR_1[VAR_4+VAR_18];",
"VAR_4 += 256;",
"break;",
"case 0xff:\ngoto the_end;",
"default:\nav_dlog(NULL, \"unrecognised subpicture command 0x%x\\n\", VAR_5);",
"goto the_end;",
"}",
"}",
"the_end:\nif (VAR_10 >= 0) {",
"int VAR_20, VAR_21;",
"uint8_t *bitmap;",
"VAR_20 = VAR_8 - VAR_6 + 1;",
"if (VAR_20 < 0)\nVAR_20 = 0;",
"VAR_21 = VAR_9 - VAR_7;",
"if (VAR_21 < 0)\nVAR_21 = 0;",
"if (VAR_20 > 0 && VAR_21 > 0) {",
"if (VAR_0->rects != NULL) {",
"for (VAR_18 = 0; VAR_18 < VAR_0->num_rects; VAR_18++) {",
"av_freep(&VAR_0->rects[VAR_18]->pict.data[0]);",
"av_freep(&VAR_0->rects[VAR_18]->pict.data[1]);",
"av_freep(&VAR_0->rects[VAR_18]);",
"}",
"av_freep(&VAR_0->rects);",
"VAR_0->num_rects = 0;",
"}",
"bitmap = av_malloc(VAR_20 * VAR_21);",
"VAR_0->rects = av_mallocz(sizeof(*VAR_0->rects));",
"VAR_0->rects[0] = av_mallocz(sizeof(AVSubtitleRect));",
"VAR_0->num_rects = 1;",
"VAR_0->rects[0]->pict.data[0] = bitmap;",
"decode_rle(bitmap, VAR_20 * 2, VAR_20, (VAR_21 + 1) / 2,\nVAR_1, VAR_10, VAR_2, VAR_15);",
"decode_rle(bitmap + VAR_20, VAR_20 * 2, VAR_20, VAR_21 / 2,\nVAR_1, VAR_11, VAR_2, VAR_15);",
"VAR_0->rects[0]->pict.data[1] = av_mallocz(AVPALETTE_SIZE);",
"if (VAR_15) {",
"if (VAR_16 == 0)\ngoto fail;",
"VAR_0->rects[0]->nb_colors = 256;",
"yuv_a_to_rgba(VAR_16, alpha, (uint32_t*)VAR_0->rects[0]->pict.data[1], 256);",
"} else {",
"VAR_0->rects[0]->nb_colors = 4;",
"guess_palette((uint32_t*)VAR_0->rects[0]->pict.data[1],\ncolormap, alpha, 0xffff00);",
"}",
"VAR_0->rects[0]->x = VAR_6;",
"VAR_0->rects[0]->y = VAR_7;",
"VAR_0->rects[0]->VAR_20 = VAR_20;",
"VAR_0->rects[0]->VAR_21 = VAR_21;",
"VAR_0->rects[0]->type = SUBTITLE_BITMAP;",
"VAR_0->rects[0]->pict.linesize[0] = VAR_20;",
"}",
"}",
"if (VAR_12 == VAR_3)\nbreak;",
"VAR_3 = VAR_12;",
"}",
"if (VAR_0->num_rects > 0)\nreturn VAR_19;",
"fail:\nif (VAR_0->rects != NULL) {",
"for (VAR_18 = 0; VAR_18 < VAR_0->num_rects; VAR_18++) {",
"av_freep(&VAR_0->rects[VAR_18]->pict.data[0]);",
"av_freep(&VAR_0->rects[VAR_18]->pict.data[1]);",
"av_freep(&VAR_0->rects[VAR_18]);",
"}",
"av_freep(&VAR_0->rects);",
"VAR_0->num_rects = 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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23,
25
],
[
27
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
51
],
[
55
],
[
57
],
[
59
],
[
61,
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81,
85
],
[
87
],
[
89,
93
],
[
95
],
[
97,
101
],
[
103
],
[
105,
109,
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125,
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
],
[
207,
211,
213
],
[
215
],
[
217
],
[
219
],
[
221,
225,
227
],
[
229
],
[
231
],
[
233
],
[
235
],
[
239,
241
],
[
243,
245
],
[
247
],
[
249
],
[
251
],
[
253,
255
],
[
257
],
[
259
],
[
265
],
[
267,
269
],
[
271
],
[
273,
275
],
[
277
],
[
279
],
[
281
],
[
283
],
[
285
],
[
287
],
[
289
],
[
291
],
[
293
],
[
295
],
[
299
],
[
301
],
[
303
],
[
305
],
[
307
],
[
309,
311
],
[
313,
315
],
[
317
],
[
319
],
[
321,
323
],
[
325
],
[
327
],
[
329
],
[
331
],
[
333,
335
],
[
337
],
[
339
],
[
341
],
[
343
],
[
345
],
[
347
],
[
349
],
[
351
],
[
353
],
[
355,
357
],
[
359
],
[
361
],
[
363,
365
],
[
367,
369
],
[
371
],
[
373
],
[
375
],
[
377
],
[
379
],
[
381
],
[
383
],
[
385
],
[
387
],
[
389
]
] |
19,694 | static AVFrame *apply_palette(AVFilterLink *inlink, AVFrame *in)
{
int x, y, w, h;
AVFilterContext *ctx = inlink->dst;
PaletteUseContext *s = ctx->priv;
AVFilterLink *outlink = inlink->dst->outputs[0];
AVFrame *out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
if (!out) {
av_frame_free(&in);
return NULL;
}
av_frame_copy_props(out, in);
set_processing_window(s->diff_mode, s->last_in, in,
s->last_out, out, &x, &y, &w, &h);
av_frame_free(&s->last_in);
av_frame_free(&s->last_out);
s->last_in = av_frame_clone(in);
s->last_out = av_frame_clone(out);
if (!s->last_in || !s->last_out ||
av_frame_make_writable(s->last_in) < 0) {
av_frame_free(&in);
av_frame_free(&out);
return NULL;
}
ff_dlog(ctx, "%dx%d rect: (%d;%d) -> (%d,%d) [area:%dx%d]\n",
w, h, x, y, x+w, y+h, in->width, in->height);
if (s->set_frame(s, out, in, x, y, w, h) < 0) {
av_frame_free(&out);
return NULL;
}
memcpy(out->data[1], s->palette, AVPALETTE_SIZE);
if (s->calc_mean_err)
debug_mean_error(s, in, out, inlink->frame_count_out);
av_frame_free(&in);
return out;
}
| false | FFmpeg | 6470abc740367cc881c181db866891f8dd1d342f | static AVFrame *apply_palette(AVFilterLink *inlink, AVFrame *in)
{
int x, y, w, h;
AVFilterContext *ctx = inlink->dst;
PaletteUseContext *s = ctx->priv;
AVFilterLink *outlink = inlink->dst->outputs[0];
AVFrame *out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
if (!out) {
av_frame_free(&in);
return NULL;
}
av_frame_copy_props(out, in);
set_processing_window(s->diff_mode, s->last_in, in,
s->last_out, out, &x, &y, &w, &h);
av_frame_free(&s->last_in);
av_frame_free(&s->last_out);
s->last_in = av_frame_clone(in);
s->last_out = av_frame_clone(out);
if (!s->last_in || !s->last_out ||
av_frame_make_writable(s->last_in) < 0) {
av_frame_free(&in);
av_frame_free(&out);
return NULL;
}
ff_dlog(ctx, "%dx%d rect: (%d;%d) -> (%d,%d) [area:%dx%d]\n",
w, h, x, y, x+w, y+h, in->width, in->height);
if (s->set_frame(s, out, in, x, y, w, h) < 0) {
av_frame_free(&out);
return NULL;
}
memcpy(out->data[1], s->palette, AVPALETTE_SIZE);
if (s->calc_mean_err)
debug_mean_error(s, in, out, inlink->frame_count_out);
av_frame_free(&in);
return out;
}
| {
"code": [],
"line_no": []
} | static AVFrame *FUNC_0(AVFilterLink *inlink, AVFrame *in)
{
int VAR_0, VAR_1, VAR_2, VAR_3;
AVFilterContext *ctx = inlink->dst;
PaletteUseContext *s = ctx->priv;
AVFilterLink *outlink = inlink->dst->outputs[0];
AVFrame *out = ff_get_video_buffer(outlink, outlink->VAR_2, outlink->VAR_3);
if (!out) {
av_frame_free(&in);
return NULL;
}
av_frame_copy_props(out, in);
set_processing_window(s->diff_mode, s->last_in, in,
s->last_out, out, &VAR_0, &VAR_1, &VAR_2, &VAR_3);
av_frame_free(&s->last_in);
av_frame_free(&s->last_out);
s->last_in = av_frame_clone(in);
s->last_out = av_frame_clone(out);
if (!s->last_in || !s->last_out ||
av_frame_make_writable(s->last_in) < 0) {
av_frame_free(&in);
av_frame_free(&out);
return NULL;
}
ff_dlog(ctx, "%dx%d rect: (%d;%d) -> (%d,%d) [area:%dx%d]\n",
VAR_2, VAR_3, VAR_0, VAR_1, VAR_0+VAR_2, VAR_1+VAR_3, in->width, in->height);
if (s->set_frame(s, out, in, VAR_0, VAR_1, VAR_2, VAR_3) < 0) {
av_frame_free(&out);
return NULL;
}
memcpy(out->data[1], s->palette, AVPALETTE_SIZE);
if (s->calc_mean_err)
debug_mean_error(s, in, out, inlink->frame_count_out);
av_frame_free(&in);
return out;
}
| [
"static AVFrame *FUNC_0(AVFilterLink *inlink, AVFrame *in)\n{",
"int VAR_0, VAR_1, VAR_2, VAR_3;",
"AVFilterContext *ctx = inlink->dst;",
"PaletteUseContext *s = ctx->priv;",
"AVFilterLink *outlink = inlink->dst->outputs[0];",
"AVFrame *out = ff_get_video_buffer(outlink, outlink->VAR_2, outlink->VAR_3);",
"if (!out) {",
"av_frame_free(&in);",
"return NULL;",
"}",
"av_frame_copy_props(out, in);",
"set_processing_window(s->diff_mode, s->last_in, in,\ns->last_out, out, &VAR_0, &VAR_1, &VAR_2, &VAR_3);",
"av_frame_free(&s->last_in);",
"av_frame_free(&s->last_out);",
"s->last_in = av_frame_clone(in);",
"s->last_out = av_frame_clone(out);",
"if (!s->last_in || !s->last_out ||\nav_frame_make_writable(s->last_in) < 0) {",
"av_frame_free(&in);",
"av_frame_free(&out);",
"return NULL;",
"}",
"ff_dlog(ctx, \"%dx%d rect: (%d;%d) -> (%d,%d) [area:%dx%d]\\n\",",
"VAR_2, VAR_3, VAR_0, VAR_1, VAR_0+VAR_2, VAR_1+VAR_3, in->width, in->height);",
"if (s->set_frame(s, out, in, VAR_0, VAR_1, VAR_2, VAR_3) < 0) {",
"av_frame_free(&out);",
"return NULL;",
"}",
"memcpy(out->data[1], s->palette, AVPALETTE_SIZE);",
"if (s->calc_mean_err)\ndebug_mean_error(s, in, out, inlink->frame_count_out);",
"av_frame_free(&in);",
"return out;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
29,
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41,
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
55
],
[
57
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71,
73
],
[
75
],
[
77
],
[
79
]
] |
19,695 | static av_cold int flic_decode_init(AVCodecContext *avctx)
{
FlicDecodeContext *s = avctx->priv_data;
unsigned char *fli_header = (unsigned char *)avctx->extradata;
int depth;
if (avctx->extradata_size != 0 &&
avctx->extradata_size != 12 &&
avctx->extradata_size != 128 &&
avctx->extradata_size != 1024) {
av_log(avctx, AV_LOG_ERROR, "Expected extradata of 12, 128 or 1024 bytes\n");
return AVERROR_INVALIDDATA;
}
s->avctx = avctx;
if (s->avctx->extradata_size == 12) {
/* special case for magic carpet FLIs */
s->fli_type = FLC_MAGIC_CARPET_SYNTHETIC_TYPE_CODE;
depth = 8;
} else if (avctx->extradata_size == 1024) {
uint8_t *ptr = avctx->extradata;
int i;
for (i = 0; i < 256; i++) {
s->palette[i] = AV_RL32(ptr);
ptr += 4;
}
depth = 8;
} else if (avctx->extradata_size == 0) {
/* FLI in MOV, see e.g. FFmpeg trac issue #626 */
s->fli_type = FLI_TYPE_CODE;
depth = 8;
} else {
s->fli_type = AV_RL16(&fli_header[4]);
depth = AV_RL16(&fli_header[12]);
}
if (depth == 0) {
depth = 8; /* Some FLC generators set depth to zero, when they mean 8Bpp. Fix up here */
}
if ((s->fli_type == FLC_FLX_TYPE_CODE) && (depth == 16)) {
depth = 15; /* Original Autodesk FLX's say the depth is 16Bpp when it is really 15Bpp */
}
switch (depth) {
case 8 : avctx->pix_fmt = PIX_FMT_PAL8; break;
case 15 : avctx->pix_fmt = PIX_FMT_RGB555; break;
case 16 : avctx->pix_fmt = PIX_FMT_RGB565; break;
case 24 : avctx->pix_fmt = PIX_FMT_BGR24; /* Supposedly BGR, but havent any files to test with */
av_log(avctx, AV_LOG_ERROR, "24Bpp FLC/FLX is unsupported due to no test files.\n");
return -1;
default :
av_log(avctx, AV_LOG_ERROR, "Unknown FLC/FLX depth of %d Bpp is unsupported.\n",depth);
return -1;
}
avcodec_get_frame_defaults(&s->frame);
s->frame.data[0] = NULL;
s->new_palette = 0;
return 0;
}
| true | FFmpeg | b4043ef504b77c357d33ffa2be28ed1c4eeecf7f | static av_cold int flic_decode_init(AVCodecContext *avctx)
{
FlicDecodeContext *s = avctx->priv_data;
unsigned char *fli_header = (unsigned char *)avctx->extradata;
int depth;
if (avctx->extradata_size != 0 &&
avctx->extradata_size != 12 &&
avctx->extradata_size != 128 &&
avctx->extradata_size != 1024) {
av_log(avctx, AV_LOG_ERROR, "Expected extradata of 12, 128 or 1024 bytes\n");
return AVERROR_INVALIDDATA;
}
s->avctx = avctx;
if (s->avctx->extradata_size == 12) {
s->fli_type = FLC_MAGIC_CARPET_SYNTHETIC_TYPE_CODE;
depth = 8;
} else if (avctx->extradata_size == 1024) {
uint8_t *ptr = avctx->extradata;
int i;
for (i = 0; i < 256; i++) {
s->palette[i] = AV_RL32(ptr);
ptr += 4;
}
depth = 8;
} else if (avctx->extradata_size == 0) {
s->fli_type = FLI_TYPE_CODE;
depth = 8;
} else {
s->fli_type = AV_RL16(&fli_header[4]);
depth = AV_RL16(&fli_header[12]);
}
if (depth == 0) {
depth = 8;
}
if ((s->fli_type == FLC_FLX_TYPE_CODE) && (depth == 16)) {
depth = 15;
}
switch (depth) {
case 8 : avctx->pix_fmt = PIX_FMT_PAL8; break;
case 15 : avctx->pix_fmt = PIX_FMT_RGB555; break;
case 16 : avctx->pix_fmt = PIX_FMT_RGB565; break;
case 24 : avctx->pix_fmt = PIX_FMT_BGR24;
av_log(avctx, AV_LOG_ERROR, "24Bpp FLC/FLX is unsupported due to no test files.\n");
return -1;
default :
av_log(avctx, AV_LOG_ERROR, "Unknown FLC/FLX depth of %d Bpp is unsupported.\n",depth);
return -1;
}
avcodec_get_frame_defaults(&s->frame);
s->frame.data[0] = NULL;
s->new_palette = 0;
return 0;
}
| {
"code": [
" av_log(avctx, AV_LOG_ERROR, \"Expected extradata of 12, 128 or 1024 bytes\\n\");"
],
"line_no": [
21
]
} | static av_cold int FUNC_0(AVCodecContext *avctx)
{
FlicDecodeContext *s = avctx->priv_data;
unsigned char *VAR_0 = (unsigned char *)avctx->extradata;
int VAR_1;
if (avctx->extradata_size != 0 &&
avctx->extradata_size != 12 &&
avctx->extradata_size != 128 &&
avctx->extradata_size != 1024) {
av_log(avctx, AV_LOG_ERROR, "Expected extradata of 12, 128 or 1024 bytes\n");
return AVERROR_INVALIDDATA;
}
s->avctx = avctx;
if (s->avctx->extradata_size == 12) {
s->fli_type = FLC_MAGIC_CARPET_SYNTHETIC_TYPE_CODE;
VAR_1 = 8;
} else if (avctx->extradata_size == 1024) {
uint8_t *ptr = avctx->extradata;
int VAR_2;
for (VAR_2 = 0; VAR_2 < 256; VAR_2++) {
s->palette[VAR_2] = AV_RL32(ptr);
ptr += 4;
}
VAR_1 = 8;
} else if (avctx->extradata_size == 0) {
s->fli_type = FLI_TYPE_CODE;
VAR_1 = 8;
} else {
s->fli_type = AV_RL16(&VAR_0[4]);
VAR_1 = AV_RL16(&VAR_0[12]);
}
if (VAR_1 == 0) {
VAR_1 = 8;
}
if ((s->fli_type == FLC_FLX_TYPE_CODE) && (VAR_1 == 16)) {
VAR_1 = 15;
}
switch (VAR_1) {
case 8 : avctx->pix_fmt = PIX_FMT_PAL8; break;
case 15 : avctx->pix_fmt = PIX_FMT_RGB555; break;
case 16 : avctx->pix_fmt = PIX_FMT_RGB565; break;
case 24 : avctx->pix_fmt = PIX_FMT_BGR24;
av_log(avctx, AV_LOG_ERROR, "24Bpp FLC/FLX is unsupported due to no test files.\n");
return -1;
default :
av_log(avctx, AV_LOG_ERROR, "Unknown FLC/FLX VAR_1 of %d Bpp is unsupported.\n",VAR_1);
return -1;
}
avcodec_get_frame_defaults(&s->frame);
s->frame.data[0] = NULL;
s->new_palette = 0;
return 0;
}
| [
"static av_cold int FUNC_0(AVCodecContext *avctx)\n{",
"FlicDecodeContext *s = avctx->priv_data;",
"unsigned char *VAR_0 = (unsigned char *)avctx->extradata;",
"int VAR_1;",
"if (avctx->extradata_size != 0 &&\navctx->extradata_size != 12 &&\navctx->extradata_size != 128 &&\navctx->extradata_size != 1024) {",
"av_log(avctx, AV_LOG_ERROR, \"Expected extradata of 12, 128 or 1024 bytes\\n\");",
"return AVERROR_INVALIDDATA;",
"}",
"s->avctx = avctx;",
"if (s->avctx->extradata_size == 12) {",
"s->fli_type = FLC_MAGIC_CARPET_SYNTHETIC_TYPE_CODE;",
"VAR_1 = 8;",
"} else if (avctx->extradata_size == 1024) {",
"uint8_t *ptr = avctx->extradata;",
"int VAR_2;",
"for (VAR_2 = 0; VAR_2 < 256; VAR_2++) {",
"s->palette[VAR_2] = AV_RL32(ptr);",
"ptr += 4;",
"}",
"VAR_1 = 8;",
"} else if (avctx->extradata_size == 0) {",
"s->fli_type = FLI_TYPE_CODE;",
"VAR_1 = 8;",
"} else {",
"s->fli_type = AV_RL16(&VAR_0[4]);",
"VAR_1 = AV_RL16(&VAR_0[12]);",
"}",
"if (VAR_1 == 0) {",
"VAR_1 = 8;",
"}",
"if ((s->fli_type == FLC_FLX_TYPE_CODE) && (VAR_1 == 16)) {",
"VAR_1 = 15;",
"}",
"switch (VAR_1) {",
"case 8 : avctx->pix_fmt = PIX_FMT_PAL8; break;",
"case 15 : avctx->pix_fmt = PIX_FMT_RGB555; break;",
"case 16 : avctx->pix_fmt = PIX_FMT_RGB565; break;",
"case 24 : avctx->pix_fmt = PIX_FMT_BGR24;",
"av_log(avctx, AV_LOG_ERROR, \"24Bpp FLC/FLX is unsupported due to no test files.\\n\");",
"return -1;",
"default :\nav_log(avctx, AV_LOG_ERROR, \"Unknown FLC/FLX VAR_1 of %d Bpp is unsupported.\\n\",VAR_1);",
"return -1;",
"}",
"avcodec_get_frame_defaults(&s->frame);",
"s->frame.data[0] = NULL;",
"s->new_palette = 0;",
"return 0;",
"}"
] | [
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13,
15,
17,
19
],
[
21
],
[
23
],
[
25
],
[
29
],
[
33
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
77
],
[
79
],
[
81
],
[
85
],
[
87
],
[
89
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107,
109
],
[
111
],
[
113
],
[
117
],
[
119
],
[
121
],
[
125
],
[
127
]
] |
19,696 | static int loadvm_postcopy_handle_advise(MigrationIncomingState *mis)
{
PostcopyState ps = postcopy_state_set(POSTCOPY_INCOMING_ADVISE);
uint64_t remote_hps, remote_tps;
trace_loadvm_postcopy_handle_advise();
if (ps != POSTCOPY_INCOMING_NONE) {
error_report("CMD_POSTCOPY_ADVISE in wrong postcopy state (%d)", ps);
return -1;
}
if (!postcopy_ram_supported_by_host()) {
postcopy_state_set(POSTCOPY_INCOMING_NONE);
return -1;
}
remote_hps = qemu_get_be64(mis->from_src_file);
if (remote_hps != getpagesize()) {
/*
* Some combinations of mismatch are probably possible but it gets
* a bit more complicated. In particular we need to place whole
* host pages on the dest at once, and we need to ensure that we
* handle dirtying to make sure we never end up sending part of
* a hostpage on it's own.
*/
error_report("Postcopy needs matching host page sizes (s=%d d=%d)",
(int)remote_hps, getpagesize());
return -1;
}
remote_tps = qemu_get_be64(mis->from_src_file);
if (remote_tps != (1ul << qemu_target_page_bits())) {
/*
* Again, some differences could be dealt with, but for now keep it
* simple.
*/
error_report("Postcopy needs matching target page sizes (s=%d d=%d)",
(int)remote_tps, 1 << qemu_target_page_bits());
return -1;
}
if (ram_postcopy_incoming_init(mis)) {
return -1;
}
postcopy_state_set(POSTCOPY_INCOMING_ADVISE);
return 0;
}
| true | qemu | e8ca1db29b349e780743c504cb735c8e1d542a8c | static int loadvm_postcopy_handle_advise(MigrationIncomingState *mis)
{
PostcopyState ps = postcopy_state_set(POSTCOPY_INCOMING_ADVISE);
uint64_t remote_hps, remote_tps;
trace_loadvm_postcopy_handle_advise();
if (ps != POSTCOPY_INCOMING_NONE) {
error_report("CMD_POSTCOPY_ADVISE in wrong postcopy state (%d)", ps);
return -1;
}
if (!postcopy_ram_supported_by_host()) {
postcopy_state_set(POSTCOPY_INCOMING_NONE);
return -1;
}
remote_hps = qemu_get_be64(mis->from_src_file);
if (remote_hps != getpagesize()) {
error_report("Postcopy needs matching host page sizes (s=%d d=%d)",
(int)remote_hps, getpagesize());
return -1;
}
remote_tps = qemu_get_be64(mis->from_src_file);
if (remote_tps != (1ul << qemu_target_page_bits())) {
error_report("Postcopy needs matching target page sizes (s=%d d=%d)",
(int)remote_tps, 1 << qemu_target_page_bits());
return -1;
}
if (ram_postcopy_incoming_init(mis)) {
return -1;
}
postcopy_state_set(POSTCOPY_INCOMING_ADVISE);
return 0;
}
| {
"code": [
" uint64_t remote_hps, remote_tps;",
" remote_hps = qemu_get_be64(mis->from_src_file);",
" if (remote_hps != getpagesize()) {",
" error_report(\"Postcopy needs matching host page sizes (s=%d d=%d)\",",
" (int)remote_hps, getpagesize());"
],
"line_no": [
7,
33,
35,
51,
53
]
} | static int FUNC_0(MigrationIncomingState *VAR_0)
{
PostcopyState ps = postcopy_state_set(POSTCOPY_INCOMING_ADVISE);
uint64_t remote_hps, remote_tps;
trace_loadvm_postcopy_handle_advise();
if (ps != POSTCOPY_INCOMING_NONE) {
error_report("CMD_POSTCOPY_ADVISE in wrong postcopy state (%d)", ps);
return -1;
}
if (!postcopy_ram_supported_by_host()) {
postcopy_state_set(POSTCOPY_INCOMING_NONE);
return -1;
}
remote_hps = qemu_get_be64(VAR_0->from_src_file);
if (remote_hps != getpagesize()) {
error_report("Postcopy needs matching host page sizes (s=%d d=%d)",
(int)remote_hps, getpagesize());
return -1;
}
remote_tps = qemu_get_be64(VAR_0->from_src_file);
if (remote_tps != (1ul << qemu_target_page_bits())) {
error_report("Postcopy needs matching target page sizes (s=%d d=%d)",
(int)remote_tps, 1 << qemu_target_page_bits());
return -1;
}
if (ram_postcopy_incoming_init(VAR_0)) {
return -1;
}
postcopy_state_set(POSTCOPY_INCOMING_ADVISE);
return 0;
}
| [
"static int FUNC_0(MigrationIncomingState *VAR_0)\n{",
"PostcopyState ps = postcopy_state_set(POSTCOPY_INCOMING_ADVISE);",
"uint64_t remote_hps, remote_tps;",
"trace_loadvm_postcopy_handle_advise();",
"if (ps != POSTCOPY_INCOMING_NONE) {",
"error_report(\"CMD_POSTCOPY_ADVISE in wrong postcopy state (%d)\", ps);",
"return -1;",
"}",
"if (!postcopy_ram_supported_by_host()) {",
"postcopy_state_set(POSTCOPY_INCOMING_NONE);",
"return -1;",
"}",
"remote_hps = qemu_get_be64(VAR_0->from_src_file);",
"if (remote_hps != getpagesize()) {",
"error_report(\"Postcopy needs matching host page sizes (s=%d d=%d)\",\n(int)remote_hps, getpagesize());",
"return -1;",
"}",
"remote_tps = qemu_get_be64(VAR_0->from_src_file);",
"if (remote_tps != (1ul << qemu_target_page_bits())) {",
"error_report(\"Postcopy needs matching target page sizes (s=%d d=%d)\",\n(int)remote_tps, 1 << qemu_target_page_bits());",
"return -1;",
"}",
"if (ram_postcopy_incoming_init(VAR_0)) {",
"return -1;",
"}",
"postcopy_state_set(POSTCOPY_INCOMING_ADVISE);",
"return 0;",
"}"
] | [
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
],
[
51,
53
],
[
55
],
[
57
],
[
61
],
[
63
],
[
73,
75
],
[
77
],
[
79
],
[
83
],
[
85
],
[
87
],
[
91
],
[
95
],
[
97
]
] |
19,697 | static void search_for_quantizers_twoloop(AVCodecContext *avctx,
AACEncContext *s,
SingleChannelElement *sce,
const float lambda)
{
int start = 0, i, w, w2, g;
int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels * (lambda / 120.f);
float dists[128] = { 0 }, uplims[128] = { 0 };
float maxvals[128];
int fflag, minscaler;
int its = 0;
int allz = 0;
float minthr = INFINITY;
// for values above this the decoder might end up in an endless loop
// due to always having more bits than what can be encoded.
destbits = FFMIN(destbits, 5800);
//XXX: some heuristic to determine initial quantizers will reduce search time
//determine zero bands and upper limits
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
for (g = 0; g < sce->ics.num_swb; g++) {
int nz = 0;
float uplim = 0.0f, energy = 0.0f;
for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
FFPsyBand *band = &s->psy.ch[s->cur_channel].psy_bands[(w+w2)*16+g];
uplim += band->threshold;
energy += band->energy;
if (band->energy <= band->threshold || band->threshold == 0.0f) {
sce->zeroes[(w+w2)*16+g] = 1;
continue;
}
nz = 1;
}
uplims[w*16+g] = uplim *512;
sce->zeroes[w*16+g] = !nz;
if (nz)
minthr = FFMIN(minthr, uplim);
allz |= nz;
}
}
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
for (g = 0; g < sce->ics.num_swb; g++) {
if (sce->zeroes[w*16+g]) {
sce->sf_idx[w*16+g] = SCALE_ONE_POS;
continue;
}
sce->sf_idx[w*16+g] = SCALE_ONE_POS + FFMIN(log2f(uplims[w*16+g]/minthr)*4,59);
}
}
if (!allz)
return;
abs_pow34_v(s->scoefs, sce->coeffs, 1024);
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
start = w*128;
for (g = 0; g < sce->ics.num_swb; g++) {
const float *scaled = s->scoefs + start;
maxvals[w*16+g] = find_max_val(sce->ics.group_len[w], sce->ics.swb_sizes[g], scaled);
start += sce->ics.swb_sizes[g];
}
}
//perform two-loop search
//outer loop - improve quality
do {
int tbits, qstep;
minscaler = sce->sf_idx[0];
//inner loop - quantize spectrum to fit into given number of bits
qstep = its ? 1 : 32;
do {
int prev = -1;
tbits = 0;
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
start = w*128;
for (g = 0; g < sce->ics.num_swb; g++) {
const float *coefs = sce->coeffs + start;
const float *scaled = s->scoefs + start;
int bits = 0;
int cb;
float dist = 0.0f;
if (sce->zeroes[w*16+g] || sce->sf_idx[w*16+g] >= 218) {
start += sce->ics.swb_sizes[g];
continue;
}
minscaler = FFMIN(minscaler, sce->sf_idx[w*16+g]);
cb = find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]);
for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
int b;
dist += quantize_band_cost(s, coefs + w2*128,
scaled + w2*128,
sce->ics.swb_sizes[g],
sce->sf_idx[w*16+g],
cb,
1.0f,
INFINITY,
&b,
0);
bits += b;
}
dists[w*16+g] = dist - bits;
if (prev != -1) {
bits += ff_aac_scalefactor_bits[sce->sf_idx[w*16+g] - prev + SCALE_DIFF_ZERO];
}
tbits += bits;
start += sce->ics.swb_sizes[g];
prev = sce->sf_idx[w*16+g];
}
}
if (tbits > destbits) {
for (i = 0; i < 128; i++)
if (sce->sf_idx[i] < 218 - qstep)
sce->sf_idx[i] += qstep;
} else {
for (i = 0; i < 128; i++)
if (sce->sf_idx[i] > 60 - qstep)
sce->sf_idx[i] -= qstep;
}
qstep >>= 1;
if (!qstep && tbits > destbits*1.02 && sce->sf_idx[0] < 217)
qstep = 1;
} while (qstep);
fflag = 0;
minscaler = av_clip(minscaler, 60, 255 - SCALE_MAX_DIFF);
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
for (g = 0; g < sce->ics.num_swb; g++) {
int prevsc = sce->sf_idx[w*16+g];
if (dists[w*16+g] > uplims[w*16+g] && sce->sf_idx[w*16+g] > 60) {
if (find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]-1))
sce->sf_idx[w*16+g]--;
else //Try to make sure there is some energy in every band
sce->sf_idx[w*16+g]-=2;
}
sce->sf_idx[w*16+g] = av_clip(sce->sf_idx[w*16+g], minscaler, minscaler + SCALE_MAX_DIFF);
sce->sf_idx[w*16+g] = FFMIN(sce->sf_idx[w*16+g], 219);
if (sce->sf_idx[w*16+g] != prevsc)
fflag = 1;
sce->band_type[w*16+g] = find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]);
}
}
its++;
} while (fflag && its < 10);
}
| true | FFmpeg | 32be264cea542b4dc721b10092bf1dfe511a28ee | static void search_for_quantizers_twoloop(AVCodecContext *avctx,
AACEncContext *s,
SingleChannelElement *sce,
const float lambda)
{
int start = 0, i, w, w2, g;
int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels * (lambda / 120.f);
float dists[128] = { 0 }, uplims[128] = { 0 };
float maxvals[128];
int fflag, minscaler;
int its = 0;
int allz = 0;
float minthr = INFINITY;
destbits = FFMIN(destbits, 5800);
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
for (g = 0; g < sce->ics.num_swb; g++) {
int nz = 0;
float uplim = 0.0f, energy = 0.0f;
for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
FFPsyBand *band = &s->psy.ch[s->cur_channel].psy_bands[(w+w2)*16+g];
uplim += band->threshold;
energy += band->energy;
if (band->energy <= band->threshold || band->threshold == 0.0f) {
sce->zeroes[(w+w2)*16+g] = 1;
continue;
}
nz = 1;
}
uplims[w*16+g] = uplim *512;
sce->zeroes[w*16+g] = !nz;
if (nz)
minthr = FFMIN(minthr, uplim);
allz |= nz;
}
}
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
for (g = 0; g < sce->ics.num_swb; g++) {
if (sce->zeroes[w*16+g]) {
sce->sf_idx[w*16+g] = SCALE_ONE_POS;
continue;
}
sce->sf_idx[w*16+g] = SCALE_ONE_POS + FFMIN(log2f(uplims[w*16+g]/minthr)*4,59);
}
}
if (!allz)
return;
abs_pow34_v(s->scoefs, sce->coeffs, 1024);
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
start = w*128;
for (g = 0; g < sce->ics.num_swb; g++) {
const float *scaled = s->scoefs + start;
maxvals[w*16+g] = find_max_val(sce->ics.group_len[w], sce->ics.swb_sizes[g], scaled);
start += sce->ics.swb_sizes[g];
}
}
do {
int tbits, qstep;
minscaler = sce->sf_idx[0];
qstep = its ? 1 : 32;
do {
int prev = -1;
tbits = 0;
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
start = w*128;
for (g = 0; g < sce->ics.num_swb; g++) {
const float *coefs = sce->coeffs + start;
const float *scaled = s->scoefs + start;
int bits = 0;
int cb;
float dist = 0.0f;
if (sce->zeroes[w*16+g] || sce->sf_idx[w*16+g] >= 218) {
start += sce->ics.swb_sizes[g];
continue;
}
minscaler = FFMIN(minscaler, sce->sf_idx[w*16+g]);
cb = find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]);
for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
int b;
dist += quantize_band_cost(s, coefs + w2*128,
scaled + w2*128,
sce->ics.swb_sizes[g],
sce->sf_idx[w*16+g],
cb,
1.0f,
INFINITY,
&b,
0);
bits += b;
}
dists[w*16+g] = dist - bits;
if (prev != -1) {
bits += ff_aac_scalefactor_bits[sce->sf_idx[w*16+g] - prev + SCALE_DIFF_ZERO];
}
tbits += bits;
start += sce->ics.swb_sizes[g];
prev = sce->sf_idx[w*16+g];
}
}
if (tbits > destbits) {
for (i = 0; i < 128; i++)
if (sce->sf_idx[i] < 218 - qstep)
sce->sf_idx[i] += qstep;
} else {
for (i = 0; i < 128; i++)
if (sce->sf_idx[i] > 60 - qstep)
sce->sf_idx[i] -= qstep;
}
qstep >>= 1;
if (!qstep && tbits > destbits*1.02 && sce->sf_idx[0] < 217)
qstep = 1;
} while (qstep);
fflag = 0;
minscaler = av_clip(minscaler, 60, 255 - SCALE_MAX_DIFF);
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
for (g = 0; g < sce->ics.num_swb; g++) {
int prevsc = sce->sf_idx[w*16+g];
if (dists[w*16+g] > uplims[w*16+g] && sce->sf_idx[w*16+g] > 60) {
if (find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]-1))
sce->sf_idx[w*16+g]--;
else
sce->sf_idx[w*16+g]-=2;
}
sce->sf_idx[w*16+g] = av_clip(sce->sf_idx[w*16+g], minscaler, minscaler + SCALE_MAX_DIFF);
sce->sf_idx[w*16+g] = FFMIN(sce->sf_idx[w*16+g], 219);
if (sce->sf_idx[w*16+g] != prevsc)
fflag = 1;
sce->band_type[w*16+g] = find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]);
}
}
its++;
} while (fflag && its < 10);
}
| {
"code": [
" const float *coefs = sce->coeffs + start;",
" const float *scaled = s->scoefs + start;"
],
"line_no": [
153,
155
]
} | static void FUNC_0(AVCodecContext *VAR_0,
AACEncContext *VAR_1,
SingleChannelElement *VAR_2,
const float VAR_3)
{
int VAR_4 = 0, VAR_5, VAR_6, VAR_7, VAR_8;
int VAR_9 = VAR_0->bit_rate * 1024.0 / VAR_0->sample_rate / VAR_0->channels * (VAR_3 / 120.f);
float VAR_10[128] = { 0 }, VAR_11[128] = { 0 };
float VAR_12[128];
int VAR_13, VAR_14;
int VAR_15 = 0;
int VAR_16 = 0;
float VAR_17 = INFINITY;
VAR_9 = FFMIN(VAR_9, 5800);
for (VAR_6 = 0; VAR_6 < VAR_2->ics.num_windows; VAR_6 += VAR_2->ics.group_len[VAR_6]) {
for (VAR_8 = 0; VAR_8 < VAR_2->ics.num_swb; VAR_8++) {
int nz = 0;
float uplim = 0.0f, energy = 0.0f;
for (VAR_7 = 0; VAR_7 < VAR_2->ics.group_len[VAR_6]; VAR_7++) {
FFPsyBand *band = &VAR_1->psy.ch[VAR_1->cur_channel].psy_bands[(VAR_6+VAR_7)*16+VAR_8];
uplim += band->threshold;
energy += band->energy;
if (band->energy <= band->threshold || band->threshold == 0.0f) {
VAR_2->zeroes[(VAR_6+VAR_7)*16+VAR_8] = 1;
continue;
}
nz = 1;
}
VAR_11[VAR_6*16+VAR_8] = uplim *512;
VAR_2->zeroes[VAR_6*16+VAR_8] = !nz;
if (nz)
VAR_17 = FFMIN(VAR_17, uplim);
VAR_16 |= nz;
}
}
for (VAR_6 = 0; VAR_6 < VAR_2->ics.num_windows; VAR_6 += VAR_2->ics.group_len[VAR_6]) {
for (VAR_8 = 0; VAR_8 < VAR_2->ics.num_swb; VAR_8++) {
if (VAR_2->zeroes[VAR_6*16+VAR_8]) {
VAR_2->sf_idx[VAR_6*16+VAR_8] = SCALE_ONE_POS;
continue;
}
VAR_2->sf_idx[VAR_6*16+VAR_8] = SCALE_ONE_POS + FFMIN(log2f(VAR_11[VAR_6*16+VAR_8]/VAR_17)*4,59);
}
}
if (!VAR_16)
return;
abs_pow34_v(VAR_1->scoefs, VAR_2->coeffs, 1024);
for (VAR_6 = 0; VAR_6 < VAR_2->ics.num_windows; VAR_6 += VAR_2->ics.group_len[VAR_6]) {
VAR_4 = VAR_6*128;
for (VAR_8 = 0; VAR_8 < VAR_2->ics.num_swb; VAR_8++) {
const float *scaled = VAR_1->scoefs + VAR_4;
VAR_12[VAR_6*16+VAR_8] = find_max_val(VAR_2->ics.group_len[VAR_6], VAR_2->ics.swb_sizes[VAR_8], scaled);
VAR_4 += VAR_2->ics.swb_sizes[VAR_8];
}
}
do {
int VAR_18, VAR_19;
VAR_14 = VAR_2->sf_idx[0];
VAR_19 = VAR_15 ? 1 : 32;
do {
int VAR_20 = -1;
VAR_18 = 0;
for (VAR_6 = 0; VAR_6 < VAR_2->ics.num_windows; VAR_6 += VAR_2->ics.group_len[VAR_6]) {
VAR_4 = VAR_6*128;
for (VAR_8 = 0; VAR_8 < VAR_2->ics.num_swb; VAR_8++) {
const float *coefs = VAR_2->coeffs + VAR_4;
const float *scaled = VAR_1->scoefs + VAR_4;
int bits = 0;
int cb;
float dist = 0.0f;
if (VAR_2->zeroes[VAR_6*16+VAR_8] || VAR_2->sf_idx[VAR_6*16+VAR_8] >= 218) {
VAR_4 += VAR_2->ics.swb_sizes[VAR_8];
continue;
}
VAR_14 = FFMIN(VAR_14, VAR_2->sf_idx[VAR_6*16+VAR_8]);
cb = find_min_book(VAR_12[VAR_6*16+VAR_8], VAR_2->sf_idx[VAR_6*16+VAR_8]);
for (VAR_7 = 0; VAR_7 < VAR_2->ics.group_len[VAR_6]; VAR_7++) {
int b;
dist += quantize_band_cost(VAR_1, coefs + VAR_7*128,
scaled + VAR_7*128,
VAR_2->ics.swb_sizes[VAR_8],
VAR_2->sf_idx[VAR_6*16+VAR_8],
cb,
1.0f,
INFINITY,
&b,
0);
bits += b;
}
VAR_10[VAR_6*16+VAR_8] = dist - bits;
if (VAR_20 != -1) {
bits += ff_aac_scalefactor_bits[VAR_2->sf_idx[VAR_6*16+VAR_8] - VAR_20 + SCALE_DIFF_ZERO];
}
VAR_18 += bits;
VAR_4 += VAR_2->ics.swb_sizes[VAR_8];
VAR_20 = VAR_2->sf_idx[VAR_6*16+VAR_8];
}
}
if (VAR_18 > VAR_9) {
for (VAR_5 = 0; VAR_5 < 128; VAR_5++)
if (VAR_2->sf_idx[VAR_5] < 218 - VAR_19)
VAR_2->sf_idx[VAR_5] += VAR_19;
} else {
for (VAR_5 = 0; VAR_5 < 128; VAR_5++)
if (VAR_2->sf_idx[VAR_5] > 60 - VAR_19)
VAR_2->sf_idx[VAR_5] -= VAR_19;
}
VAR_19 >>= 1;
if (!VAR_19 && VAR_18 > VAR_9*1.02 && VAR_2->sf_idx[0] < 217)
VAR_19 = 1;
} while (VAR_19);
VAR_13 = 0;
VAR_14 = av_clip(VAR_14, 60, 255 - SCALE_MAX_DIFF);
for (VAR_6 = 0; VAR_6 < VAR_2->ics.num_windows; VAR_6 += VAR_2->ics.group_len[VAR_6]) {
for (VAR_8 = 0; VAR_8 < VAR_2->ics.num_swb; VAR_8++) {
int prevsc = VAR_2->sf_idx[VAR_6*16+VAR_8];
if (VAR_10[VAR_6*16+VAR_8] > VAR_11[VAR_6*16+VAR_8] && VAR_2->sf_idx[VAR_6*16+VAR_8] > 60) {
if (find_min_book(VAR_12[VAR_6*16+VAR_8], VAR_2->sf_idx[VAR_6*16+VAR_8]-1))
VAR_2->sf_idx[VAR_6*16+VAR_8]--;
else
VAR_2->sf_idx[VAR_6*16+VAR_8]-=2;
}
VAR_2->sf_idx[VAR_6*16+VAR_8] = av_clip(VAR_2->sf_idx[VAR_6*16+VAR_8], VAR_14, VAR_14 + SCALE_MAX_DIFF);
VAR_2->sf_idx[VAR_6*16+VAR_8] = FFMIN(VAR_2->sf_idx[VAR_6*16+VAR_8], 219);
if (VAR_2->sf_idx[VAR_6*16+VAR_8] != prevsc)
VAR_13 = 1;
VAR_2->band_type[VAR_6*16+VAR_8] = find_min_book(VAR_12[VAR_6*16+VAR_8], VAR_2->sf_idx[VAR_6*16+VAR_8]);
}
}
VAR_15++;
} while (VAR_13 && VAR_15 < 10);
}
| [
"static void FUNC_0(AVCodecContext *VAR_0,\nAACEncContext *VAR_1,\nSingleChannelElement *VAR_2,\nconst float VAR_3)\n{",
"int VAR_4 = 0, VAR_5, VAR_6, VAR_7, VAR_8;",
"int VAR_9 = VAR_0->bit_rate * 1024.0 / VAR_0->sample_rate / VAR_0->channels * (VAR_3 / 120.f);",
"float VAR_10[128] = { 0 }, VAR_11[128] = { 0 };",
"float VAR_12[128];",
"int VAR_13, VAR_14;",
"int VAR_15 = 0;",
"int VAR_16 = 0;",
"float VAR_17 = INFINITY;",
"VAR_9 = FFMIN(VAR_9, 5800);",
"for (VAR_6 = 0; VAR_6 < VAR_2->ics.num_windows; VAR_6 += VAR_2->ics.group_len[VAR_6]) {",
"for (VAR_8 = 0; VAR_8 < VAR_2->ics.num_swb; VAR_8++) {",
"int nz = 0;",
"float uplim = 0.0f, energy = 0.0f;",
"for (VAR_7 = 0; VAR_7 < VAR_2->ics.group_len[VAR_6]; VAR_7++) {",
"FFPsyBand *band = &VAR_1->psy.ch[VAR_1->cur_channel].psy_bands[(VAR_6+VAR_7)*16+VAR_8];",
"uplim += band->threshold;",
"energy += band->energy;",
"if (band->energy <= band->threshold || band->threshold == 0.0f) {",
"VAR_2->zeroes[(VAR_6+VAR_7)*16+VAR_8] = 1;",
"continue;",
"}",
"nz = 1;",
"}",
"VAR_11[VAR_6*16+VAR_8] = uplim *512;",
"VAR_2->zeroes[VAR_6*16+VAR_8] = !nz;",
"if (nz)\nVAR_17 = FFMIN(VAR_17, uplim);",
"VAR_16 |= nz;",
"}",
"}",
"for (VAR_6 = 0; VAR_6 < VAR_2->ics.num_windows; VAR_6 += VAR_2->ics.group_len[VAR_6]) {",
"for (VAR_8 = 0; VAR_8 < VAR_2->ics.num_swb; VAR_8++) {",
"if (VAR_2->zeroes[VAR_6*16+VAR_8]) {",
"VAR_2->sf_idx[VAR_6*16+VAR_8] = SCALE_ONE_POS;",
"continue;",
"}",
"VAR_2->sf_idx[VAR_6*16+VAR_8] = SCALE_ONE_POS + FFMIN(log2f(VAR_11[VAR_6*16+VAR_8]/VAR_17)*4,59);",
"}",
"}",
"if (!VAR_16)\nreturn;",
"abs_pow34_v(VAR_1->scoefs, VAR_2->coeffs, 1024);",
"for (VAR_6 = 0; VAR_6 < VAR_2->ics.num_windows; VAR_6 += VAR_2->ics.group_len[VAR_6]) {",
"VAR_4 = VAR_6*128;",
"for (VAR_8 = 0; VAR_8 < VAR_2->ics.num_swb; VAR_8++) {",
"const float *scaled = VAR_1->scoefs + VAR_4;",
"VAR_12[VAR_6*16+VAR_8] = find_max_val(VAR_2->ics.group_len[VAR_6], VAR_2->ics.swb_sizes[VAR_8], scaled);",
"VAR_4 += VAR_2->ics.swb_sizes[VAR_8];",
"}",
"}",
"do {",
"int VAR_18, VAR_19;",
"VAR_14 = VAR_2->sf_idx[0];",
"VAR_19 = VAR_15 ? 1 : 32;",
"do {",
"int VAR_20 = -1;",
"VAR_18 = 0;",
"for (VAR_6 = 0; VAR_6 < VAR_2->ics.num_windows; VAR_6 += VAR_2->ics.group_len[VAR_6]) {",
"VAR_4 = VAR_6*128;",
"for (VAR_8 = 0; VAR_8 < VAR_2->ics.num_swb; VAR_8++) {",
"const float *coefs = VAR_2->coeffs + VAR_4;",
"const float *scaled = VAR_1->scoefs + VAR_4;",
"int bits = 0;",
"int cb;",
"float dist = 0.0f;",
"if (VAR_2->zeroes[VAR_6*16+VAR_8] || VAR_2->sf_idx[VAR_6*16+VAR_8] >= 218) {",
"VAR_4 += VAR_2->ics.swb_sizes[VAR_8];",
"continue;",
"}",
"VAR_14 = FFMIN(VAR_14, VAR_2->sf_idx[VAR_6*16+VAR_8]);",
"cb = find_min_book(VAR_12[VAR_6*16+VAR_8], VAR_2->sf_idx[VAR_6*16+VAR_8]);",
"for (VAR_7 = 0; VAR_7 < VAR_2->ics.group_len[VAR_6]; VAR_7++) {",
"int b;",
"dist += quantize_band_cost(VAR_1, coefs + VAR_7*128,\nscaled + VAR_7*128,\nVAR_2->ics.swb_sizes[VAR_8],\nVAR_2->sf_idx[VAR_6*16+VAR_8],\ncb,\n1.0f,\nINFINITY,\n&b,\n0);",
"bits += b;",
"}",
"VAR_10[VAR_6*16+VAR_8] = dist - bits;",
"if (VAR_20 != -1) {",
"bits += ff_aac_scalefactor_bits[VAR_2->sf_idx[VAR_6*16+VAR_8] - VAR_20 + SCALE_DIFF_ZERO];",
"}",
"VAR_18 += bits;",
"VAR_4 += VAR_2->ics.swb_sizes[VAR_8];",
"VAR_20 = VAR_2->sf_idx[VAR_6*16+VAR_8];",
"}",
"}",
"if (VAR_18 > VAR_9) {",
"for (VAR_5 = 0; VAR_5 < 128; VAR_5++)",
"if (VAR_2->sf_idx[VAR_5] < 218 - VAR_19)\nVAR_2->sf_idx[VAR_5] += VAR_19;",
"} else {",
"for (VAR_5 = 0; VAR_5 < 128; VAR_5++)",
"if (VAR_2->sf_idx[VAR_5] > 60 - VAR_19)\nVAR_2->sf_idx[VAR_5] -= VAR_19;",
"}",
"VAR_19 >>= 1;",
"if (!VAR_19 && VAR_18 > VAR_9*1.02 && VAR_2->sf_idx[0] < 217)\nVAR_19 = 1;",
"} while (VAR_19);",
"VAR_13 = 0;",
"VAR_14 = av_clip(VAR_14, 60, 255 - SCALE_MAX_DIFF);",
"for (VAR_6 = 0; VAR_6 < VAR_2->ics.num_windows; VAR_6 += VAR_2->ics.group_len[VAR_6]) {",
"for (VAR_8 = 0; VAR_8 < VAR_2->ics.num_swb; VAR_8++) {",
"int prevsc = VAR_2->sf_idx[VAR_6*16+VAR_8];",
"if (VAR_10[VAR_6*16+VAR_8] > VAR_11[VAR_6*16+VAR_8] && VAR_2->sf_idx[VAR_6*16+VAR_8] > 60) {",
"if (find_min_book(VAR_12[VAR_6*16+VAR_8], VAR_2->sf_idx[VAR_6*16+VAR_8]-1))\nVAR_2->sf_idx[VAR_6*16+VAR_8]--;",
"else\nVAR_2->sf_idx[VAR_6*16+VAR_8]-=2;",
"}",
"VAR_2->sf_idx[VAR_6*16+VAR_8] = av_clip(VAR_2->sf_idx[VAR_6*16+VAR_8], VAR_14, VAR_14 + SCALE_MAX_DIFF);",
"VAR_2->sf_idx[VAR_6*16+VAR_8] = FFMIN(VAR_2->sf_idx[VAR_6*16+VAR_8], 219);",
"if (VAR_2->sf_idx[VAR_6*16+VAR_8] != prevsc)\nVAR_13 = 1;",
"VAR_2->band_type[VAR_6*16+VAR_8] = find_min_book(VAR_12[VAR_6*16+VAR_8], VAR_2->sf_idx[VAR_6*16+VAR_8]);",
"}",
"}",
"VAR_15++;",
"} while (VAR_13 && VAR_15 < 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,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5,
7,
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
33
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71,
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
101,
103
],
[
105
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
131
],
[
133
],
[
135
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149
],
[
151
],
[
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
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
],
[
255
],
[
257
],
[
259
],
[
261
],
[
263,
265
],
[
267,
269
],
[
271
],
[
273
],
[
275
],
[
277,
279
],
[
281
],
[
283
],
[
285
],
[
287
],
[
289
],
[
291
]
] |
19,698 | static void compare_refcounts(BlockDriverState *bs, BdrvCheckResult *res,
BdrvCheckMode fix, bool *rebuild,
int64_t *highest_cluster,
uint16_t *refcount_table, int64_t nb_clusters)
{
BDRVQcowState *s = bs->opaque;
int64_t i;
uint64_t refcount1, refcount2;
int ret;
for (i = 0, *highest_cluster = 0; i < nb_clusters; i++) {
ret = qcow2_get_refcount(bs, i, &refcount1);
if (ret < 0) {
fprintf(stderr, "Can't get refcount for cluster %" PRId64 ": %s\n",
i, strerror(-ret));
res->check_errors++;
continue;
}
refcount2 = refcount_table[i];
if (refcount1 > 0 || refcount2 > 0) {
*highest_cluster = i;
}
if (refcount1 != refcount2) {
/* Check if we're allowed to fix the mismatch */
int *num_fixed = NULL;
if (refcount1 == 0) {
*rebuild = true;
} else if (refcount1 > refcount2 && (fix & BDRV_FIX_LEAKS)) {
num_fixed = &res->leaks_fixed;
} else if (refcount1 < refcount2 && (fix & BDRV_FIX_ERRORS)) {
num_fixed = &res->corruptions_fixed;
}
fprintf(stderr, "%s cluster %" PRId64 " refcount=%" PRIu64
" reference=%" PRIu64 "\n",
num_fixed != NULL ? "Repairing" :
refcount1 < refcount2 ? "ERROR" :
"Leaked",
i, refcount1, refcount2);
if (num_fixed) {
ret = update_refcount(bs, i << s->cluster_bits, 1,
refcount_diff(refcount1, refcount2),
refcount1 > refcount2,
QCOW2_DISCARD_ALWAYS);
if (ret >= 0) {
(*num_fixed)++;
continue;
}
}
/* And if we couldn't, print an error */
if (refcount1 < refcount2) {
res->corruptions++;
} else {
res->leaks++;
}
}
}
}
| true | qemu | 7453c96b78c2b09aa72924f933bb9616e5474194 | static void compare_refcounts(BlockDriverState *bs, BdrvCheckResult *res,
BdrvCheckMode fix, bool *rebuild,
int64_t *highest_cluster,
uint16_t *refcount_table, int64_t nb_clusters)
{
BDRVQcowState *s = bs->opaque;
int64_t i;
uint64_t refcount1, refcount2;
int ret;
for (i = 0, *highest_cluster = 0; i < nb_clusters; i++) {
ret = qcow2_get_refcount(bs, i, &refcount1);
if (ret < 0) {
fprintf(stderr, "Can't get refcount for cluster %" PRId64 ": %s\n",
i, strerror(-ret));
res->check_errors++;
continue;
}
refcount2 = refcount_table[i];
if (refcount1 > 0 || refcount2 > 0) {
*highest_cluster = i;
}
if (refcount1 != refcount2) {
int *num_fixed = NULL;
if (refcount1 == 0) {
*rebuild = true;
} else if (refcount1 > refcount2 && (fix & BDRV_FIX_LEAKS)) {
num_fixed = &res->leaks_fixed;
} else if (refcount1 < refcount2 && (fix & BDRV_FIX_ERRORS)) {
num_fixed = &res->corruptions_fixed;
}
fprintf(stderr, "%s cluster %" PRId64 " refcount=%" PRIu64
" reference=%" PRIu64 "\n",
num_fixed != NULL ? "Repairing" :
refcount1 < refcount2 ? "ERROR" :
"Leaked",
i, refcount1, refcount2);
if (num_fixed) {
ret = update_refcount(bs, i << s->cluster_bits, 1,
refcount_diff(refcount1, refcount2),
refcount1 > refcount2,
QCOW2_DISCARD_ALWAYS);
if (ret >= 0) {
(*num_fixed)++;
continue;
}
}
if (refcount1 < refcount2) {
res->corruptions++;
} else {
res->leaks++;
}
}
}
}
| {
"code": [
" uint16_t *refcount_table, int64_t nb_clusters)",
" refcount2 = refcount_table[i];"
],
"line_no": [
7,
39
]
} | static void FUNC_0(BlockDriverState *VAR_0, BdrvCheckResult *VAR_1,
BdrvCheckMode VAR_2, bool *VAR_3,
int64_t *VAR_4,
uint16_t *VAR_5, int64_t VAR_6)
{
BDRVQcowState *s = VAR_0->opaque;
int64_t i;
uint64_t refcount1, refcount2;
int VAR_7;
for (i = 0, *VAR_4 = 0; i < VAR_6; i++) {
VAR_7 = qcow2_get_refcount(VAR_0, i, &refcount1);
if (VAR_7 < 0) {
fprintf(stderr, "Can't get refcount for cluster %" PRId64 ": %s\n",
i, strerror(-VAR_7));
VAR_1->check_errors++;
continue;
}
refcount2 = VAR_5[i];
if (refcount1 > 0 || refcount2 > 0) {
*VAR_4 = i;
}
if (refcount1 != refcount2) {
int *num_fixed = NULL;
if (refcount1 == 0) {
*VAR_3 = true;
} else if (refcount1 > refcount2 && (VAR_2 & BDRV_FIX_LEAKS)) {
num_fixed = &VAR_1->leaks_fixed;
} else if (refcount1 < refcount2 && (VAR_2 & BDRV_FIX_ERRORS)) {
num_fixed = &VAR_1->corruptions_fixed;
}
fprintf(stderr, "%s cluster %" PRId64 " refcount=%" PRIu64
" reference=%" PRIu64 "\n",
num_fixed != NULL ? "Repairing" :
refcount1 < refcount2 ? "ERROR" :
"Leaked",
i, refcount1, refcount2);
if (num_fixed) {
VAR_7 = update_refcount(VAR_0, i << s->cluster_bits, 1,
refcount_diff(refcount1, refcount2),
refcount1 > refcount2,
QCOW2_DISCARD_ALWAYS);
if (VAR_7 >= 0) {
(*num_fixed)++;
continue;
}
}
if (refcount1 < refcount2) {
VAR_1->corruptions++;
} else {
VAR_1->leaks++;
}
}
}
}
| [
"static void FUNC_0(BlockDriverState *VAR_0, BdrvCheckResult *VAR_1,\nBdrvCheckMode VAR_2, bool *VAR_3,\nint64_t *VAR_4,\nuint16_t *VAR_5, int64_t VAR_6)\n{",
"BDRVQcowState *s = VAR_0->opaque;",
"int64_t i;",
"uint64_t refcount1, refcount2;",
"int VAR_7;",
"for (i = 0, *VAR_4 = 0; i < VAR_6; i++) {",
"VAR_7 = qcow2_get_refcount(VAR_0, i, &refcount1);",
"if (VAR_7 < 0) {",
"fprintf(stderr, \"Can't get refcount for cluster %\" PRId64 \": %s\\n\",\ni, strerror(-VAR_7));",
"VAR_1->check_errors++;",
"continue;",
"}",
"refcount2 = VAR_5[i];",
"if (refcount1 > 0 || refcount2 > 0) {",
"*VAR_4 = i;",
"}",
"if (refcount1 != refcount2) {",
"int *num_fixed = NULL;",
"if (refcount1 == 0) {",
"*VAR_3 = true;",
"} else if (refcount1 > refcount2 && (VAR_2 & BDRV_FIX_LEAKS)) {",
"num_fixed = &VAR_1->leaks_fixed;",
"} else if (refcount1 < refcount2 && (VAR_2 & BDRV_FIX_ERRORS)) {",
"num_fixed = &VAR_1->corruptions_fixed;",
"}",
"fprintf(stderr, \"%s cluster %\" PRId64 \" refcount=%\" PRIu64\n\" reference=%\" PRIu64 \"\\n\",\nnum_fixed != NULL ? \"Repairing\" :\nrefcount1 < refcount2 ? \"ERROR\" :\n\"Leaked\",\ni, refcount1, refcount2);",
"if (num_fixed) {",
"VAR_7 = update_refcount(VAR_0, i << s->cluster_bits, 1,\nrefcount_diff(refcount1, refcount2),\nrefcount1 > refcount2,\nQCOW2_DISCARD_ALWAYS);",
"if (VAR_7 >= 0) {",
"(*num_fixed)++;",
"continue;",
"}",
"}",
"if (refcount1 < refcount2) {",
"VAR_1->corruptions++;",
"} else {",
"VAR_1->leaks++;",
"}",
"}",
"}",
"}"
] | [
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5,
7,
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
21
],
[
23
],
[
25
],
[
27,
29
],
[
31
],
[
33
],
[
35
],
[
39
],
[
43
],
[
45
],
[
47
],
[
51
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
73,
75,
77,
79,
81,
83
],
[
87
],
[
89,
91,
93,
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
]
] |
19,699 | static void xilinx_spips_realize(DeviceState *dev, Error **errp)
{
XilinxSPIPS *s = XILINX_SPIPS(dev);
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
XilinxSPIPSClass *xsc = XILINX_SPIPS_GET_CLASS(s);
int i;
DB_PRINT_L(0, "realized spips\n");
s->spi = g_new(SSIBus *, s->num_busses);
for (i = 0; i < s->num_busses; ++i) {
char bus_name[16];
snprintf(bus_name, 16, "spi%d", i);
s->spi[i] = ssi_create_bus(dev, bus_name);
}
s->cs_lines = g_new0(qemu_irq, s->num_cs * s->num_busses);
ssi_auto_connect_slaves(DEVICE(s), s->cs_lines, s->spi[0]);
ssi_auto_connect_slaves(DEVICE(s), s->cs_lines, s->spi[1]);
sysbus_init_irq(sbd, &s->irq);
for (i = 0; i < s->num_cs * s->num_busses; ++i) {
sysbus_init_irq(sbd, &s->cs_lines[i]);
}
memory_region_init_io(&s->iomem, OBJECT(s), xsc->reg_ops, s,
"spi", XLNX_SPIPS_R_MAX * 4);
sysbus_init_mmio(sbd, &s->iomem);
s->irqline = -1;
fifo8_create(&s->rx_fifo, xsc->rx_fifo_size);
fifo8_create(&s->tx_fifo, xsc->tx_fifo_size);
}
| true | qemu | c8cccba3125d8d1a7ca66fc593a89543f3fe823d | static void xilinx_spips_realize(DeviceState *dev, Error **errp)
{
XilinxSPIPS *s = XILINX_SPIPS(dev);
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
XilinxSPIPSClass *xsc = XILINX_SPIPS_GET_CLASS(s);
int i;
DB_PRINT_L(0, "realized spips\n");
s->spi = g_new(SSIBus *, s->num_busses);
for (i = 0; i < s->num_busses; ++i) {
char bus_name[16];
snprintf(bus_name, 16, "spi%d", i);
s->spi[i] = ssi_create_bus(dev, bus_name);
}
s->cs_lines = g_new0(qemu_irq, s->num_cs * s->num_busses);
ssi_auto_connect_slaves(DEVICE(s), s->cs_lines, s->spi[0]);
ssi_auto_connect_slaves(DEVICE(s), s->cs_lines, s->spi[1]);
sysbus_init_irq(sbd, &s->irq);
for (i = 0; i < s->num_cs * s->num_busses; ++i) {
sysbus_init_irq(sbd, &s->cs_lines[i]);
}
memory_region_init_io(&s->iomem, OBJECT(s), xsc->reg_ops, s,
"spi", XLNX_SPIPS_R_MAX * 4);
sysbus_init_mmio(sbd, &s->iomem);
s->irqline = -1;
fifo8_create(&s->rx_fifo, xsc->rx_fifo_size);
fifo8_create(&s->tx_fifo, xsc->tx_fifo_size);
}
| {
"code": [
" ssi_auto_connect_slaves(DEVICE(s), s->cs_lines, s->spi[0]);",
" ssi_auto_connect_slaves(DEVICE(s), s->cs_lines, s->spi[1]);"
],
"line_no": [
35,
37
]
} | static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)
{
XilinxSPIPS *s = XILINX_SPIPS(VAR_0);
SysBusDevice *sbd = SYS_BUS_DEVICE(VAR_0);
XilinxSPIPSClass *xsc = XILINX_SPIPS_GET_CLASS(s);
int VAR_2;
DB_PRINT_L(0, "realized spips\n");
s->spi = g_new(SSIBus *, s->num_busses);
for (VAR_2 = 0; VAR_2 < s->num_busses; ++VAR_2) {
char bus_name[16];
snprintf(bus_name, 16, "spi%d", VAR_2);
s->spi[VAR_2] = ssi_create_bus(VAR_0, bus_name);
}
s->cs_lines = g_new0(qemu_irq, s->num_cs * s->num_busses);
ssi_auto_connect_slaves(DEVICE(s), s->cs_lines, s->spi[0]);
ssi_auto_connect_slaves(DEVICE(s), s->cs_lines, s->spi[1]);
sysbus_init_irq(sbd, &s->irq);
for (VAR_2 = 0; VAR_2 < s->num_cs * s->num_busses; ++VAR_2) {
sysbus_init_irq(sbd, &s->cs_lines[VAR_2]);
}
memory_region_init_io(&s->iomem, OBJECT(s), xsc->reg_ops, s,
"spi", XLNX_SPIPS_R_MAX * 4);
sysbus_init_mmio(sbd, &s->iomem);
s->irqline = -1;
fifo8_create(&s->rx_fifo, xsc->rx_fifo_size);
fifo8_create(&s->tx_fifo, xsc->tx_fifo_size);
}
| [
"static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)\n{",
"XilinxSPIPS *s = XILINX_SPIPS(VAR_0);",
"SysBusDevice *sbd = SYS_BUS_DEVICE(VAR_0);",
"XilinxSPIPSClass *xsc = XILINX_SPIPS_GET_CLASS(s);",
"int VAR_2;",
"DB_PRINT_L(0, \"realized spips\\n\");",
"s->spi = g_new(SSIBus *, s->num_busses);",
"for (VAR_2 = 0; VAR_2 < s->num_busses; ++VAR_2) {",
"char bus_name[16];",
"snprintf(bus_name, 16, \"spi%d\", VAR_2);",
"s->spi[VAR_2] = ssi_create_bus(VAR_0, bus_name);",
"}",
"s->cs_lines = g_new0(qemu_irq, s->num_cs * s->num_busses);",
"ssi_auto_connect_slaves(DEVICE(s), s->cs_lines, s->spi[0]);",
"ssi_auto_connect_slaves(DEVICE(s), s->cs_lines, s->spi[1]);",
"sysbus_init_irq(sbd, &s->irq);",
"for (VAR_2 = 0; VAR_2 < s->num_cs * s->num_busses; ++VAR_2) {",
"sysbus_init_irq(sbd, &s->cs_lines[VAR_2]);",
"}",
"memory_region_init_io(&s->iomem, OBJECT(s), xsc->reg_ops, s,\n\"spi\", XLNX_SPIPS_R_MAX * 4);",
"sysbus_init_mmio(sbd, &s->iomem);",
"s->irqline = -1;",
"fifo8_create(&s->rx_fifo, xsc->rx_fifo_size);",
"fifo8_create(&s->tx_fifo, xsc->tx_fifo_size);",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
49,
51
],
[
53
],
[
57
],
[
61
],
[
63
],
[
65
]
] |
19,700 | int32_t HELPER(sdiv)(int32_t num, int32_t den)
{
if (den == 0)
return 0;
return num / den;
} | true | qemu | 686eeb93d5738c84c59395b2ec6f8181c2b7cbed | int32_t HELPER(sdiv)(int32_t num, int32_t den)
{
if (den == 0)
return 0;
return num / den;
} | {
"code": [],
"line_no": []
} | int32_t FUNC_0(sdiv)(int32_t num, int32_t den)
{
if (den == 0)
return 0;
return num / den;
} | [
"int32_t FUNC_0(sdiv)(int32_t num, int32_t den)\n{",
"if (den == 0)\nreturn 0;",
"return num / den;",
"}"
] | [
0,
0,
0,
0
] | [
[
1,
3
],
[
5,
7
],
[
11
],
[
13
]
] |
19,701 | static void bdrv_move_feature_fields(BlockDriverState *bs_dest,
BlockDriverState *bs_src)
{
/* move some fields that need to stay attached to the device */
bs_dest->open_flags = bs_src->open_flags;
/* dev info */
bs_dest->dev_ops = bs_src->dev_ops;
bs_dest->dev_opaque = bs_src->dev_opaque;
bs_dest->dev = bs_src->dev;
bs_dest->guest_block_size = bs_src->guest_block_size;
bs_dest->copy_on_read = bs_src->copy_on_read;
bs_dest->enable_write_cache = bs_src->enable_write_cache;
/* i/o throttled req */
memcpy(&bs_dest->throttle_state,
&bs_src->throttle_state,
sizeof(ThrottleState));
bs_dest->throttled_reqs[0] = bs_src->throttled_reqs[0];
bs_dest->throttled_reqs[1] = bs_src->throttled_reqs[1];
bs_dest->io_limits_enabled = bs_src->io_limits_enabled;
/* r/w error */
bs_dest->on_read_error = bs_src->on_read_error;
bs_dest->on_write_error = bs_src->on_write_error;
/* i/o status */
bs_dest->iostatus_enabled = bs_src->iostatus_enabled;
bs_dest->iostatus = bs_src->iostatus;
/* dirty bitmap */
bs_dest->dirty_bitmaps = bs_src->dirty_bitmaps;
/* reference count */
bs_dest->refcnt = bs_src->refcnt;
/* job */
bs_dest->in_use = bs_src->in_use;
bs_dest->job = bs_src->job;
/* keep the same entry in bdrv_states */
pstrcpy(bs_dest->device_name, sizeof(bs_dest->device_name),
bs_src->device_name);
bs_dest->device_list = bs_src->device_list;
/* keep the same entry in graph_bdrv_states
* We do want to swap name but don't want to swap linked list entries
*/
bs_dest->node_list = bs_src->node_list;
}
| true | qemu | 90ce8a061bdcc485a56142cae68cfbfff270e634 | static void bdrv_move_feature_fields(BlockDriverState *bs_dest,
BlockDriverState *bs_src)
{
bs_dest->open_flags = bs_src->open_flags;
bs_dest->dev_ops = bs_src->dev_ops;
bs_dest->dev_opaque = bs_src->dev_opaque;
bs_dest->dev = bs_src->dev;
bs_dest->guest_block_size = bs_src->guest_block_size;
bs_dest->copy_on_read = bs_src->copy_on_read;
bs_dest->enable_write_cache = bs_src->enable_write_cache;
memcpy(&bs_dest->throttle_state,
&bs_src->throttle_state,
sizeof(ThrottleState));
bs_dest->throttled_reqs[0] = bs_src->throttled_reqs[0];
bs_dest->throttled_reqs[1] = bs_src->throttled_reqs[1];
bs_dest->io_limits_enabled = bs_src->io_limits_enabled;
bs_dest->on_read_error = bs_src->on_read_error;
bs_dest->on_write_error = bs_src->on_write_error;
bs_dest->iostatus_enabled = bs_src->iostatus_enabled;
bs_dest->iostatus = bs_src->iostatus;
bs_dest->dirty_bitmaps = bs_src->dirty_bitmaps;
bs_dest->refcnt = bs_src->refcnt;
bs_dest->in_use = bs_src->in_use;
bs_dest->job = bs_src->job;
pstrcpy(bs_dest->device_name, sizeof(bs_dest->device_name),
bs_src->device_name);
bs_dest->device_list = bs_src->device_list;
bs_dest->node_list = bs_src->node_list;
}
| {
"code": [
" bs_dest->node_list = bs_src->node_list;"
],
"line_no": [
99
]
} | static void FUNC_0(BlockDriverState *VAR_0,
BlockDriverState *VAR_1)
{
VAR_0->open_flags = VAR_1->open_flags;
VAR_0->dev_ops = VAR_1->dev_ops;
VAR_0->dev_opaque = VAR_1->dev_opaque;
VAR_0->dev = VAR_1->dev;
VAR_0->guest_block_size = VAR_1->guest_block_size;
VAR_0->copy_on_read = VAR_1->copy_on_read;
VAR_0->enable_write_cache = VAR_1->enable_write_cache;
memcpy(&VAR_0->throttle_state,
&VAR_1->throttle_state,
sizeof(ThrottleState));
VAR_0->throttled_reqs[0] = VAR_1->throttled_reqs[0];
VAR_0->throttled_reqs[1] = VAR_1->throttled_reqs[1];
VAR_0->io_limits_enabled = VAR_1->io_limits_enabled;
VAR_0->on_read_error = VAR_1->on_read_error;
VAR_0->on_write_error = VAR_1->on_write_error;
VAR_0->iostatus_enabled = VAR_1->iostatus_enabled;
VAR_0->iostatus = VAR_1->iostatus;
VAR_0->dirty_bitmaps = VAR_1->dirty_bitmaps;
VAR_0->refcnt = VAR_1->refcnt;
VAR_0->in_use = VAR_1->in_use;
VAR_0->job = VAR_1->job;
pstrcpy(VAR_0->device_name, sizeof(VAR_0->device_name),
VAR_1->device_name);
VAR_0->device_list = VAR_1->device_list;
VAR_0->node_list = VAR_1->node_list;
}
| [
"static void FUNC_0(BlockDriverState *VAR_0,\nBlockDriverState *VAR_1)\n{",
"VAR_0->open_flags = VAR_1->open_flags;",
"VAR_0->dev_ops = VAR_1->dev_ops;",
"VAR_0->dev_opaque = VAR_1->dev_opaque;",
"VAR_0->dev = VAR_1->dev;",
"VAR_0->guest_block_size = VAR_1->guest_block_size;",
"VAR_0->copy_on_read = VAR_1->copy_on_read;",
"VAR_0->enable_write_cache = VAR_1->enable_write_cache;",
"memcpy(&VAR_0->throttle_state,\n&VAR_1->throttle_state,\nsizeof(ThrottleState));",
"VAR_0->throttled_reqs[0] = VAR_1->throttled_reqs[0];",
"VAR_0->throttled_reqs[1] = VAR_1->throttled_reqs[1];",
"VAR_0->io_limits_enabled = VAR_1->io_limits_enabled;",
"VAR_0->on_read_error = VAR_1->on_read_error;",
"VAR_0->on_write_error = VAR_1->on_write_error;",
"VAR_0->iostatus_enabled = VAR_1->iostatus_enabled;",
"VAR_0->iostatus = VAR_1->iostatus;",
"VAR_0->dirty_bitmaps = VAR_1->dirty_bitmaps;",
"VAR_0->refcnt = VAR_1->refcnt;",
"VAR_0->in_use = VAR_1->in_use;",
"VAR_0->job = VAR_1->job;",
"pstrcpy(VAR_0->device_name, sizeof(VAR_0->device_name),\nVAR_1->device_name);",
"VAR_0->device_list = VAR_1->device_list;",
"VAR_0->node_list = VAR_1->node_list;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0
] | [
[
1,
3,
5
],
[
9
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
27
],
[
33,
35,
37
],
[
39
],
[
41
],
[
43
],
[
49
],
[
51
],
[
57
],
[
59
],
[
65
],
[
71
],
[
77
],
[
79
],
[
85,
87
],
[
89
],
[
99
],
[
101
]
] |
19,702 | int ff_dxva2_common_end_frame(AVCodecContext *avctx, AVFrame *frame,
const void *pp, unsigned pp_size,
const void *qm, unsigned qm_size,
int (*commit_bs_si)(AVCodecContext *,
DECODER_BUFFER_DESC *bs,
DECODER_BUFFER_DESC *slice))
{
AVDXVAContext *ctx = avctx->hwaccel_context;
unsigned buffer_count = 0;
#if CONFIG_D3D11VA
D3D11_VIDEO_DECODER_BUFFER_DESC buffer11[4];
#endif
#if CONFIG_DXVA2
DXVA2_DecodeBufferDesc buffer2[4];
#endif
DECODER_BUFFER_DESC *buffer,*buffer_slice;
int result, runs = 0;
HRESULT hr;
unsigned type;
do {
#if CONFIG_D3D11VA
if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD) {
if (D3D11VA_CONTEXT(ctx)->context_mutex != INVALID_HANDLE_VALUE)
WaitForSingleObjectEx(D3D11VA_CONTEXT(ctx)->context_mutex, INFINITE, FALSE);
hr = ID3D11VideoContext_DecoderBeginFrame(D3D11VA_CONTEXT(ctx)->video_context, D3D11VA_CONTEXT(ctx)->decoder,
ff_dxva2_get_surface(frame),
0, NULL);
}
#endif
#if CONFIG_DXVA2
if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD)
hr = IDirectXVideoDecoder_BeginFrame(DXVA2_CONTEXT(ctx)->decoder,
ff_dxva2_get_surface(frame),
NULL);
#endif
if (hr == E_PENDING)
av_usleep(2000);
} while (hr == E_PENDING && ++runs < 50);
if (FAILED(hr)) {
av_log(avctx, AV_LOG_ERROR, "Failed to begin frame: 0x%lx\n", hr);
#if CONFIG_D3D11VA
if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD)
if (D3D11VA_CONTEXT(ctx)->context_mutex != INVALID_HANDLE_VALUE)
ReleaseMutex(D3D11VA_CONTEXT(ctx)->context_mutex);
#endif
return -1;
}
#if CONFIG_D3D11VA
if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD) {
buffer = &buffer11[buffer_count];
type = D3D11_VIDEO_DECODER_BUFFER_PICTURE_PARAMETERS;
}
#endif
#if CONFIG_DXVA2
if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD) {
buffer = &buffer2[buffer_count];
type = DXVA2_PictureParametersBufferType;
}
#endif
result = ff_dxva2_commit_buffer(avctx, ctx, buffer,
type,
pp, pp_size, 0);
if (result) {
av_log(avctx, AV_LOG_ERROR,
"Failed to add picture parameter buffer\n");
goto end;
}
buffer_count++;
if (qm_size > 0) {
#if CONFIG_D3D11VA
if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD) {
buffer = &buffer11[buffer_count];
type = D3D11_VIDEO_DECODER_BUFFER_INVERSE_QUANTIZATION_MATRIX;
}
#endif
#if CONFIG_DXVA2
if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD) {
buffer = &buffer2[buffer_count];
type = DXVA2_InverseQuantizationMatrixBufferType;
}
#endif
result = ff_dxva2_commit_buffer(avctx, ctx, buffer,
type,
qm, qm_size, 0);
if (result) {
av_log(avctx, AV_LOG_ERROR,
"Failed to add inverse quantization matrix buffer\n");
goto end;
}
buffer_count++;
}
#if CONFIG_D3D11VA
if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD) {
buffer = &buffer11[buffer_count + 0];
buffer_slice = &buffer11[buffer_count + 1];
}
#endif
#if CONFIG_DXVA2
if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD) {
buffer = &buffer2[buffer_count + 0];
buffer_slice = &buffer2[buffer_count + 1];
}
#endif
result = commit_bs_si(avctx,
buffer,
buffer_slice);
if (result) {
av_log(avctx, AV_LOG_ERROR,
"Failed to add bitstream or slice control buffer\n");
goto end;
}
buffer_count += 2;
/* TODO Film Grain when possible */
assert(buffer_count == 1 + (qm_size > 0) + 2);
#if CONFIG_D3D11VA
if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD)
hr = ID3D11VideoContext_SubmitDecoderBuffers(D3D11VA_CONTEXT(ctx)->video_context,
D3D11VA_CONTEXT(ctx)->decoder,
buffer_count, buffer11);
#endif
#if CONFIG_DXVA2
if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD) {
DXVA2_DecodeExecuteParams exec = {
.NumCompBuffers = buffer_count,
.pCompressedBuffers = buffer2,
.pExtensionData = NULL,
};
hr = IDirectXVideoDecoder_Execute(DXVA2_CONTEXT(ctx)->decoder, &exec);
}
#endif
if (FAILED(hr)) {
av_log(avctx, AV_LOG_ERROR, "Failed to execute: 0x%lx\n", hr);
result = -1;
}
end:
#if CONFIG_D3D11VA
if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD) {
hr = ID3D11VideoContext_DecoderEndFrame(D3D11VA_CONTEXT(ctx)->video_context, D3D11VA_CONTEXT(ctx)->decoder);
if (D3D11VA_CONTEXT(ctx)->context_mutex != INVALID_HANDLE_VALUE)
ReleaseMutex(D3D11VA_CONTEXT(ctx)->context_mutex);
}
#endif
#if CONFIG_DXVA2
if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD)
hr = IDirectXVideoDecoder_EndFrame(DXVA2_CONTEXT(ctx)->decoder, NULL);
#endif
if (FAILED(hr)) {
av_log(avctx, AV_LOG_ERROR, "Failed to end frame: 0x%lx\n", hr);
result = -1;
}
return result;
}
| true | FFmpeg | 99cf943339a2e5171863c48cd1a73dd43dc243e1 | int ff_dxva2_common_end_frame(AVCodecContext *avctx, AVFrame *frame,
const void *pp, unsigned pp_size,
const void *qm, unsigned qm_size,
int (*commit_bs_si)(AVCodecContext *,
DECODER_BUFFER_DESC *bs,
DECODER_BUFFER_DESC *slice))
{
AVDXVAContext *ctx = avctx->hwaccel_context;
unsigned buffer_count = 0;
#if CONFIG_D3D11VA
D3D11_VIDEO_DECODER_BUFFER_DESC buffer11[4];
#endif
#if CONFIG_DXVA2
DXVA2_DecodeBufferDesc buffer2[4];
#endif
DECODER_BUFFER_DESC *buffer,*buffer_slice;
int result, runs = 0;
HRESULT hr;
unsigned type;
do {
#if CONFIG_D3D11VA
if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD) {
if (D3D11VA_CONTEXT(ctx)->context_mutex != INVALID_HANDLE_VALUE)
WaitForSingleObjectEx(D3D11VA_CONTEXT(ctx)->context_mutex, INFINITE, FALSE);
hr = ID3D11VideoContext_DecoderBeginFrame(D3D11VA_CONTEXT(ctx)->video_context, D3D11VA_CONTEXT(ctx)->decoder,
ff_dxva2_get_surface(frame),
0, NULL);
}
#endif
#if CONFIG_DXVA2
if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD)
hr = IDirectXVideoDecoder_BeginFrame(DXVA2_CONTEXT(ctx)->decoder,
ff_dxva2_get_surface(frame),
NULL);
#endif
if (hr == E_PENDING)
av_usleep(2000);
} while (hr == E_PENDING && ++runs < 50);
if (FAILED(hr)) {
av_log(avctx, AV_LOG_ERROR, "Failed to begin frame: 0x%lx\n", hr);
#if CONFIG_D3D11VA
if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD)
if (D3D11VA_CONTEXT(ctx)->context_mutex != INVALID_HANDLE_VALUE)
ReleaseMutex(D3D11VA_CONTEXT(ctx)->context_mutex);
#endif
return -1;
}
#if CONFIG_D3D11VA
if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD) {
buffer = &buffer11[buffer_count];
type = D3D11_VIDEO_DECODER_BUFFER_PICTURE_PARAMETERS;
}
#endif
#if CONFIG_DXVA2
if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD) {
buffer = &buffer2[buffer_count];
type = DXVA2_PictureParametersBufferType;
}
#endif
result = ff_dxva2_commit_buffer(avctx, ctx, buffer,
type,
pp, pp_size, 0);
if (result) {
av_log(avctx, AV_LOG_ERROR,
"Failed to add picture parameter buffer\n");
goto end;
}
buffer_count++;
if (qm_size > 0) {
#if CONFIG_D3D11VA
if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD) {
buffer = &buffer11[buffer_count];
type = D3D11_VIDEO_DECODER_BUFFER_INVERSE_QUANTIZATION_MATRIX;
}
#endif
#if CONFIG_DXVA2
if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD) {
buffer = &buffer2[buffer_count];
type = DXVA2_InverseQuantizationMatrixBufferType;
}
#endif
result = ff_dxva2_commit_buffer(avctx, ctx, buffer,
type,
qm, qm_size, 0);
if (result) {
av_log(avctx, AV_LOG_ERROR,
"Failed to add inverse quantization matrix buffer\n");
goto end;
}
buffer_count++;
}
#if CONFIG_D3D11VA
if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD) {
buffer = &buffer11[buffer_count + 0];
buffer_slice = &buffer11[buffer_count + 1];
}
#endif
#if CONFIG_DXVA2
if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD) {
buffer = &buffer2[buffer_count + 0];
buffer_slice = &buffer2[buffer_count + 1];
}
#endif
result = commit_bs_si(avctx,
buffer,
buffer_slice);
if (result) {
av_log(avctx, AV_LOG_ERROR,
"Failed to add bitstream or slice control buffer\n");
goto end;
}
buffer_count += 2;
assert(buffer_count == 1 + (qm_size > 0) + 2);
#if CONFIG_D3D11VA
if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD)
hr = ID3D11VideoContext_SubmitDecoderBuffers(D3D11VA_CONTEXT(ctx)->video_context,
D3D11VA_CONTEXT(ctx)->decoder,
buffer_count, buffer11);
#endif
#if CONFIG_DXVA2
if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD) {
DXVA2_DecodeExecuteParams exec = {
.NumCompBuffers = buffer_count,
.pCompressedBuffers = buffer2,
.pExtensionData = NULL,
};
hr = IDirectXVideoDecoder_Execute(DXVA2_CONTEXT(ctx)->decoder, &exec);
}
#endif
if (FAILED(hr)) {
av_log(avctx, AV_LOG_ERROR, "Failed to execute: 0x%lx\n", hr);
result = -1;
}
end:
#if CONFIG_D3D11VA
if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD) {
hr = ID3D11VideoContext_DecoderEndFrame(D3D11VA_CONTEXT(ctx)->video_context, D3D11VA_CONTEXT(ctx)->decoder);
if (D3D11VA_CONTEXT(ctx)->context_mutex != INVALID_HANDLE_VALUE)
ReleaseMutex(D3D11VA_CONTEXT(ctx)->context_mutex);
}
#endif
#if CONFIG_DXVA2
if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD)
hr = IDirectXVideoDecoder_EndFrame(DXVA2_CONTEXT(ctx)->decoder, NULL);
#endif
if (FAILED(hr)) {
av_log(avctx, AV_LOG_ERROR, "Failed to end frame: 0x%lx\n", hr);
result = -1;
}
return result;
}
| {
"code": [
" if (hr == E_PENDING)",
" av_usleep(2000);",
" } while (hr == E_PENDING && ++runs < 50);"
],
"line_no": [
73,
75,
77
]
} | VAR_7intVAR_7 VAR_7ff_dxva2_common_end_frameVAR_7(VAR_7AVCodecContextVAR_7 *VAR_7VAR_0VAR_7, VAR_7AVFrameVAR_7 *VAR_7VAR_1VAR_7,
VAR_7constVAR_7 VAR_7voidVAR_7 *VAR_7VAR_2VAR_7, VAR_7unsignedVAR_7 VAR_7VAR_3VAR_7,
VAR_7constVAR_7 VAR_7voidVAR_7 *VAR_7VAR_4VAR_7, VAR_7unsignedVAR_7 VAR_7VAR_5VAR_7,
VAR_7intVAR_7 (*VAR_7VAR_6VAR_7)(VAR_7AVCodecContextVAR_7 *,
VAR_7DECODER_BUFFER_DESCVAR_7 *VAR_7bsVAR_7,
VAR_7DECODER_BUFFER_DESCVAR_7 *VAR_7sliceVAR_7))
{
VAR_7AVDXVAContextVAR_7 *VAR_7ctxVAR_7 = VAR_7VAR_0VAR_7->VAR_7hwaccel_contextVAR_7;
VAR_7unsignedVAR_7 VAR_7buffer_countVAR_7 = VAR_70VAR_7;
#VAR_7ifVAR_7 VAR_7CONFIG_D3D11VAVAR_7
VAR_7D3D11_VIDEO_DECODER_BUFFER_DESCVAR_7 VAR_7buffer11VAR_7[VAR_74VAR_7];
#VAR_7endifVAR_7
#VAR_7ifVAR_7 VAR_7CONFIG_DXVA2VAR_7
VAR_7DXVA2_DecodeBufferDescVAR_7 VAR_7buffer2VAR_7[VAR_74VAR_7];
#VAR_7endifVAR_7
VAR_7DECODER_BUFFER_DESCVAR_7 *VAR_7bufferVAR_7,*VAR_7buffer_sliceVAR_7;
VAR_7intVAR_7 VAR_7resultVAR_7, VAR_7runsVAR_7 = VAR_70VAR_7;
VAR_7HRESULTVAR_7 VAR_7hrVAR_7;
VAR_7unsignedVAR_7 VAR_7typeVAR_7;
VAR_7doVAR_7 {
#VAR_7ifVAR_7 VAR_7CONFIG_D3D11VAVAR_7
VAR_7ifVAR_7 (VAR_7VAR_0VAR_7->VAR_7pix_fmtVAR_7 == VAR_7AV_PIX_FMT_D3D11VA_VLDVAR_7) {
VAR_7ifVAR_7 (VAR_7D3D11VA_CONTEXTVAR_7(VAR_7ctxVAR_7)->VAR_7context_mutexVAR_7 != VAR_7INVALID_HANDLE_VALUEVAR_7)
VAR_7WaitForSingleObjectExVAR_7(VAR_7D3D11VA_CONTEXTVAR_7(VAR_7ctxVAR_7)->VAR_7context_mutexVAR_7, VAR_7INFINITEVAR_7, VAR_7FALSEVAR_7);
VAR_7hrVAR_7 = VAR_7ID3D11VideoContext_DecoderBeginFrameVAR_7(VAR_7D3D11VA_CONTEXTVAR_7(VAR_7ctxVAR_7)->VAR_7video_contextVAR_7, VAR_7D3D11VA_CONTEXTVAR_7(VAR_7ctxVAR_7)->VAR_7decoderVAR_7,
VAR_7ff_dxva2_get_surfaceVAR_7(VAR_7VAR_1VAR_7),
VAR_70VAR_7, VAR_7NULLVAR_7);
}
#VAR_7endifVAR_7
#VAR_7ifVAR_7 VAR_7CONFIG_DXVA2VAR_7
VAR_7ifVAR_7 (VAR_7VAR_0VAR_7->VAR_7pix_fmtVAR_7 == VAR_7AV_PIX_FMT_DXVA2_VLDVAR_7)
VAR_7hrVAR_7 = VAR_7IDirectXVideoDecoder_BeginFrameVAR_7(VAR_7DXVA2_CONTEXTVAR_7(VAR_7ctxVAR_7)->VAR_7decoderVAR_7,
VAR_7ff_dxva2_get_surfaceVAR_7(VAR_7VAR_1VAR_7),
VAR_7NULLVAR_7);
#VAR_7endifVAR_7
VAR_7ifVAR_7 (VAR_7hrVAR_7 == VAR_7E_PENDINGVAR_7)
VAR_7av_usleepVAR_7(VAR_72000VAR_7);
} VAR_7whileVAR_7 (VAR_7hrVAR_7 == VAR_7E_PENDINGVAR_7 && ++VAR_7runsVAR_7 < VAR_750VAR_7);
VAR_7ifVAR_7 (VAR_7FAILEDVAR_7(VAR_7hrVAR_7)) {
VAR_7av_logVAR_7(VAR_7VAR_0VAR_7, VAR_7AV_LOG_ERRORVAR_7, "VAR_7FailedVAR_7 VAR_7toVAR_7 VAR_7beginVAR_7 VAR_7VAR_1VAR_7: VAR_70xVAR_7%VAR_7lxVAR_7\VAR_7nVAR_7", VAR_7hrVAR_7);
#VAR_7ifVAR_7 VAR_7CONFIG_D3D11VAVAR_7
VAR_7ifVAR_7 (VAR_7VAR_0VAR_7->VAR_7pix_fmtVAR_7 == VAR_7AV_PIX_FMT_D3D11VA_VLDVAR_7)
VAR_7ifVAR_7 (VAR_7D3D11VA_CONTEXTVAR_7(VAR_7ctxVAR_7)->VAR_7context_mutexVAR_7 != VAR_7INVALID_HANDLE_VALUEVAR_7)
VAR_7ReleaseMutexVAR_7(VAR_7D3D11VA_CONTEXTVAR_7(VAR_7ctxVAR_7)->VAR_7context_mutexVAR_7);
#VAR_7endifVAR_7
VAR_7returnVAR_7 -VAR_71VAR_7;
}
#VAR_7ifVAR_7 VAR_7CONFIG_D3D11VAVAR_7
VAR_7ifVAR_7 (VAR_7VAR_0VAR_7->VAR_7pix_fmtVAR_7 == VAR_7AV_PIX_FMT_D3D11VA_VLDVAR_7) {
VAR_7bufferVAR_7 = &VAR_7buffer11VAR_7[VAR_7buffer_countVAR_7];
VAR_7typeVAR_7 = VAR_7D3D11_VIDEO_DECODER_BUFFER_PICTURE_PARAMETERSVAR_7;
}
#VAR_7endifVAR_7
#VAR_7ifVAR_7 VAR_7CONFIG_DXVA2VAR_7
VAR_7ifVAR_7 (VAR_7VAR_0VAR_7->VAR_7pix_fmtVAR_7 == VAR_7AV_PIX_FMT_DXVA2_VLDVAR_7) {
VAR_7bufferVAR_7 = &VAR_7buffer2VAR_7[VAR_7buffer_countVAR_7];
VAR_7typeVAR_7 = VAR_7DXVA2_PictureParametersBufferTypeVAR_7;
}
#VAR_7endifVAR_7
VAR_7resultVAR_7 = VAR_7ff_dxva2_commit_bufferVAR_7(VAR_7VAR_0VAR_7, VAR_7ctxVAR_7, VAR_7bufferVAR_7,
VAR_7typeVAR_7,
VAR_7VAR_2VAR_7, VAR_7VAR_3VAR_7, VAR_70VAR_7);
VAR_7ifVAR_7 (VAR_7resultVAR_7) {
VAR_7av_logVAR_7(VAR_7VAR_0VAR_7, VAR_7AV_LOG_ERRORVAR_7,
"VAR_7FailedVAR_7 VAR_7toVAR_7 VAR_7addVAR_7 VAR_7pictureVAR_7 VAR_7parameterVAR_7 VAR_7bufferVAR_7\VAR_7nVAR_7");
VAR_7gotoVAR_7 VAR_7endVAR_7;
}
VAR_7buffer_countVAR_7++;
VAR_7ifVAR_7 (VAR_7VAR_5VAR_7 > VAR_70VAR_7) {
#VAR_7ifVAR_7 VAR_7CONFIG_D3D11VAVAR_7
VAR_7ifVAR_7 (VAR_7VAR_0VAR_7->VAR_7pix_fmtVAR_7 == VAR_7AV_PIX_FMT_D3D11VA_VLDVAR_7) {
VAR_7bufferVAR_7 = &VAR_7buffer11VAR_7[VAR_7buffer_countVAR_7];
VAR_7typeVAR_7 = VAR_7D3D11_VIDEO_DECODER_BUFFER_INVERSE_QUANTIZATION_MATRIXVAR_7;
}
#VAR_7endifVAR_7
#VAR_7ifVAR_7 VAR_7CONFIG_DXVA2VAR_7
VAR_7ifVAR_7 (VAR_7VAR_0VAR_7->VAR_7pix_fmtVAR_7 == VAR_7AV_PIX_FMT_DXVA2_VLDVAR_7) {
VAR_7bufferVAR_7 = &VAR_7buffer2VAR_7[VAR_7buffer_countVAR_7];
VAR_7typeVAR_7 = VAR_7DXVA2_InverseQuantizationMatrixBufferTypeVAR_7;
}
#VAR_7endifVAR_7
VAR_7resultVAR_7 = VAR_7ff_dxva2_commit_bufferVAR_7(VAR_7VAR_0VAR_7, VAR_7ctxVAR_7, VAR_7bufferVAR_7,
VAR_7typeVAR_7,
VAR_7VAR_4VAR_7, VAR_7VAR_5VAR_7, VAR_70VAR_7);
VAR_7ifVAR_7 (VAR_7resultVAR_7) {
VAR_7av_logVAR_7(VAR_7VAR_0VAR_7, VAR_7AV_LOG_ERRORVAR_7,
"VAR_7FailedVAR_7 VAR_7toVAR_7 VAR_7addVAR_7 VAR_7inverseVAR_7 VAR_7quantizationVAR_7 VAR_7matrixVAR_7 VAR_7bufferVAR_7\VAR_7nVAR_7");
VAR_7gotoVAR_7 VAR_7endVAR_7;
}
VAR_7buffer_countVAR_7++;
}
#VAR_7ifVAR_7 VAR_7CONFIG_D3D11VAVAR_7
VAR_7ifVAR_7 (VAR_7VAR_0VAR_7->VAR_7pix_fmtVAR_7 == VAR_7AV_PIX_FMT_D3D11VA_VLDVAR_7) {
VAR_7bufferVAR_7 = &VAR_7buffer11VAR_7[VAR_7buffer_countVAR_7 + VAR_70VAR_7];
VAR_7buffer_sliceVAR_7 = &VAR_7buffer11VAR_7[VAR_7buffer_countVAR_7 + VAR_71VAR_7];
}
#VAR_7endifVAR_7
#VAR_7ifVAR_7 VAR_7CONFIG_DXVA2VAR_7
VAR_7ifVAR_7 (VAR_7VAR_0VAR_7->VAR_7pix_fmtVAR_7 == VAR_7AV_PIX_FMT_DXVA2_VLDVAR_7) {
VAR_7bufferVAR_7 = &VAR_7buffer2VAR_7[VAR_7buffer_countVAR_7 + VAR_70VAR_7];
VAR_7buffer_sliceVAR_7 = &VAR_7buffer2VAR_7[VAR_7buffer_countVAR_7 + VAR_71VAR_7];
}
#VAR_7endifVAR_7
VAR_7resultVAR_7 = VAR_7VAR_6VAR_7(VAR_7VAR_0VAR_7,
VAR_7bufferVAR_7,
VAR_7buffer_sliceVAR_7);
VAR_7ifVAR_7 (VAR_7resultVAR_7) {
VAR_7av_logVAR_7(VAR_7VAR_0VAR_7, VAR_7AV_LOG_ERRORVAR_7,
"VAR_7FailedVAR_7 VAR_7toVAR_7 VAR_7addVAR_7 VAR_7bitstreamVAR_7 VAR_7orVAR_7 VAR_7sliceVAR_7 VAR_7controlVAR_7 VAR_7bufferVAR_7\VAR_7nVAR_7");
VAR_7gotoVAR_7 VAR_7endVAR_7;
}
VAR_7buffer_countVAR_7 += VAR_72VAR_7;
VAR_7assertVAR_7(VAR_7buffer_countVAR_7 == VAR_71VAR_7 + (VAR_7VAR_5VAR_7 > VAR_70VAR_7) + VAR_72VAR_7);
#VAR_7ifVAR_7 VAR_7CONFIG_D3D11VAVAR_7
VAR_7ifVAR_7 (VAR_7VAR_0VAR_7->VAR_7pix_fmtVAR_7 == VAR_7AV_PIX_FMT_D3D11VA_VLDVAR_7)
VAR_7hrVAR_7 = VAR_7ID3D11VideoContext_SubmitDecoderBuffersVAR_7(VAR_7D3D11VA_CONTEXTVAR_7(VAR_7ctxVAR_7)->VAR_7video_contextVAR_7,
VAR_7D3D11VA_CONTEXTVAR_7(VAR_7ctxVAR_7)->VAR_7decoderVAR_7,
VAR_7buffer_countVAR_7, VAR_7buffer11VAR_7);
#VAR_7endifVAR_7
#VAR_7ifVAR_7 VAR_7CONFIG_DXVA2VAR_7
VAR_7ifVAR_7 (VAR_7VAR_0VAR_7->VAR_7pix_fmtVAR_7 == VAR_7AV_PIX_FMT_DXVA2_VLDVAR_7) {
VAR_7DXVA2_DecodeExecuteParamsVAR_7 VAR_7execVAR_7 = {
.VAR_7NumCompBuffersVAR_7 = VAR_7buffer_countVAR_7,
.VAR_7pCompressedBuffersVAR_7 = VAR_7buffer2VAR_7,
.VAR_7pExtensionDataVAR_7 = VAR_7NULLVAR_7,
};
VAR_7hrVAR_7 = VAR_7IDirectXVideoDecoder_ExecuteVAR_7(VAR_7DXVA2_CONTEXTVAR_7(VAR_7ctxVAR_7)->VAR_7decoderVAR_7, &VAR_7execVAR_7);
}
#VAR_7endifVAR_7
VAR_7ifVAR_7 (VAR_7FAILEDVAR_7(VAR_7hrVAR_7)) {
VAR_7av_logVAR_7(VAR_7VAR_0VAR_7, VAR_7AV_LOG_ERRORVAR_7, "VAR_7FailedVAR_7 VAR_7toVAR_7 VAR_7executeVAR_7: VAR_70xVAR_7%VAR_7lxVAR_7\VAR_7nVAR_7", VAR_7hrVAR_7);
VAR_7resultVAR_7 = -VAR_71VAR_7;
}
VAR_7endVAR_7:
#VAR_7ifVAR_7 VAR_7CONFIG_D3D11VAVAR_7
VAR_7ifVAR_7 (VAR_7VAR_0VAR_7->VAR_7pix_fmtVAR_7 == VAR_7AV_PIX_FMT_D3D11VA_VLDVAR_7) {
VAR_7hrVAR_7 = VAR_7ID3D11VideoContext_DecoderEndFrameVAR_7(VAR_7D3D11VA_CONTEXTVAR_7(VAR_7ctxVAR_7)->VAR_7video_contextVAR_7, VAR_7D3D11VA_CONTEXTVAR_7(VAR_7ctxVAR_7)->VAR_7decoderVAR_7);
VAR_7ifVAR_7 (VAR_7D3D11VA_CONTEXTVAR_7(VAR_7ctxVAR_7)->VAR_7context_mutexVAR_7 != VAR_7INVALID_HANDLE_VALUEVAR_7)
VAR_7ReleaseMutexVAR_7(VAR_7D3D11VA_CONTEXTVAR_7(VAR_7ctxVAR_7)->VAR_7context_mutexVAR_7);
}
#VAR_7endifVAR_7
#VAR_7ifVAR_7 VAR_7CONFIG_DXVA2VAR_7
VAR_7ifVAR_7 (VAR_7VAR_0VAR_7->VAR_7pix_fmtVAR_7 == VAR_7AV_PIX_FMT_DXVA2_VLDVAR_7)
VAR_7hrVAR_7 = VAR_7IDirectXVideoDecoder_EndFrameVAR_7(VAR_7DXVA2_CONTEXTVAR_7(VAR_7ctxVAR_7)->VAR_7decoderVAR_7, VAR_7NULLVAR_7);
#VAR_7endifVAR_7
VAR_7ifVAR_7 (VAR_7FAILEDVAR_7(VAR_7hrVAR_7)) {
VAR_7av_logVAR_7(VAR_7VAR_0VAR_7, VAR_7AV_LOG_ERRORVAR_7, "VAR_7FailedVAR_7 VAR_7toVAR_7 VAR_7endVAR_7 VAR_7VAR_1VAR_7: VAR_70xVAR_7%VAR_7lxVAR_7\VAR_7nVAR_7", VAR_7hrVAR_7);
VAR_7resultVAR_7 = -VAR_71VAR_7;
}
VAR_7returnVAR_7 VAR_7resultVAR_7;
}
| [
"VAR_7intVAR_7 VAR_7ff_dxva2_common_end_frameVAR_7(VAR_7AVCodecContextVAR_7 *VAR_7VAR_0VAR_7, VAR_7AVFrameVAR_7 *VAR_7VAR_1VAR_7,\nVAR_7constVAR_7 VAR_7voidVAR_7 *VAR_7VAR_2VAR_7, VAR_7unsignedVAR_7 VAR_7VAR_3VAR_7,\nVAR_7constVAR_7 VAR_7voidVAR_7 *VAR_7VAR_4VAR_7, VAR_7unsignedVAR_7 VAR_7VAR_5VAR_7,\nVAR_7intVAR_7 (*VAR_7VAR_6VAR_7)(VAR_7AVCodecContextVAR_7 *,\nVAR_7DECODER_BUFFER_DESCVAR_7 *VAR_7bsVAR_7,\nVAR_7DECODER_BUFFER_DESCVAR_7 *VAR_7sliceVAR_7))\n{",
"VAR_7AVDXVAContextVAR_7 *VAR_7ctxVAR_7 = VAR_7VAR_0VAR_7->VAR_7hwaccel_contextVAR_7;",
"VAR_7unsignedVAR_7 VAR_7buffer_countVAR_7 = VAR_70VAR_7;",
"#VAR_7ifVAR_7 VAR_7CONFIG_D3D11VAVAR_7\nVAR_7D3D11_VIDEO_DECODER_BUFFER_DESCVAR_7 VAR_7buffer11VAR_7[VAR_74VAR_7];",
"#VAR_7endifVAR_7\n#VAR_7ifVAR_7 VAR_7CONFIG_DXVA2VAR_7\nVAR_7DXVA2_DecodeBufferDescVAR_7 VAR_7buffer2VAR_7[VAR_74VAR_7];",
"#VAR_7endifVAR_7\nVAR_7DECODER_BUFFER_DESCVAR_7 *VAR_7bufferVAR_7,*VAR_7buffer_sliceVAR_7;",
"VAR_7intVAR_7 VAR_7resultVAR_7, VAR_7runsVAR_7 = VAR_70VAR_7;",
"VAR_7HRESULTVAR_7 VAR_7hrVAR_7;",
"VAR_7unsignedVAR_7 VAR_7typeVAR_7;",
"VAR_7doVAR_7 {",
"#VAR_7ifVAR_7 VAR_7CONFIG_D3D11VAVAR_7\nVAR_7ifVAR_7 (VAR_7VAR_0VAR_7->VAR_7pix_fmtVAR_7 == VAR_7AV_PIX_FMT_D3D11VA_VLDVAR_7) {",
"VAR_7ifVAR_7 (VAR_7D3D11VA_CONTEXTVAR_7(VAR_7ctxVAR_7)->VAR_7context_mutexVAR_7 != VAR_7INVALID_HANDLE_VALUEVAR_7)\nVAR_7WaitForSingleObjectExVAR_7(VAR_7D3D11VA_CONTEXTVAR_7(VAR_7ctxVAR_7)->VAR_7context_mutexVAR_7, VAR_7INFINITEVAR_7, VAR_7FALSEVAR_7);",
"VAR_7hrVAR_7 = VAR_7ID3D11VideoContext_DecoderBeginFrameVAR_7(VAR_7D3D11VA_CONTEXTVAR_7(VAR_7ctxVAR_7)->VAR_7video_contextVAR_7, VAR_7D3D11VA_CONTEXTVAR_7(VAR_7ctxVAR_7)->VAR_7decoderVAR_7,\nVAR_7ff_dxva2_get_surfaceVAR_7(VAR_7VAR_1VAR_7),\nVAR_70VAR_7, VAR_7NULLVAR_7);",
"}",
"#VAR_7endifVAR_7\n#VAR_7ifVAR_7 VAR_7CONFIG_DXVA2VAR_7\nVAR_7ifVAR_7 (VAR_7VAR_0VAR_7->VAR_7pix_fmtVAR_7 == VAR_7AV_PIX_FMT_DXVA2_VLDVAR_7)\nVAR_7hrVAR_7 = VAR_7IDirectXVideoDecoder_BeginFrameVAR_7(VAR_7DXVA2_CONTEXTVAR_7(VAR_7ctxVAR_7)->VAR_7decoderVAR_7,\nVAR_7ff_dxva2_get_surfaceVAR_7(VAR_7VAR_1VAR_7),\nVAR_7NULLVAR_7);",
"#VAR_7endifVAR_7\nVAR_7ifVAR_7 (VAR_7hrVAR_7 == VAR_7E_PENDINGVAR_7)\nVAR_7av_usleepVAR_7(VAR_72000VAR_7);",
"} VAR_7whileVAR_7 (VAR_7hrVAR_7 == VAR_7E_PENDINGVAR_7 && ++VAR_7runsVAR_7 < VAR_750VAR_7);",
"VAR_7ifVAR_7 (VAR_7FAILEDVAR_7(VAR_7hrVAR_7)) {",
"VAR_7av_logVAR_7(VAR_7VAR_0VAR_7, VAR_7AV_LOG_ERRORVAR_7, \"VAR_7FailedVAR_7 VAR_7toVAR_7 VAR_7beginVAR_7 VAR_7VAR_1VAR_7: VAR_70xVAR_7%VAR_7lxVAR_7\\VAR_7nVAR_7\", VAR_7hrVAR_7);",
"#VAR_7ifVAR_7 VAR_7CONFIG_D3D11VAVAR_7\nVAR_7ifVAR_7 (VAR_7VAR_0VAR_7->VAR_7pix_fmtVAR_7 == VAR_7AV_PIX_FMT_D3D11VA_VLDVAR_7)\nVAR_7ifVAR_7 (VAR_7D3D11VA_CONTEXTVAR_7(VAR_7ctxVAR_7)->VAR_7context_mutexVAR_7 != VAR_7INVALID_HANDLE_VALUEVAR_7)\nVAR_7ReleaseMutexVAR_7(VAR_7D3D11VA_CONTEXTVAR_7(VAR_7ctxVAR_7)->VAR_7context_mutexVAR_7);",
"#VAR_7endifVAR_7\nVAR_7returnVAR_7 -VAR_71VAR_7;",
"}",
"#VAR_7ifVAR_7 VAR_7CONFIG_D3D11VAVAR_7\nVAR_7ifVAR_7 (VAR_7VAR_0VAR_7->VAR_7pix_fmtVAR_7 == VAR_7AV_PIX_FMT_D3D11VA_VLDVAR_7) {",
"VAR_7bufferVAR_7 = &VAR_7buffer11VAR_7[VAR_7buffer_countVAR_7];",
"VAR_7typeVAR_7 = VAR_7D3D11_VIDEO_DECODER_BUFFER_PICTURE_PARAMETERSVAR_7;",
"}",
"#VAR_7endifVAR_7\n#VAR_7ifVAR_7 VAR_7CONFIG_DXVA2VAR_7\nVAR_7ifVAR_7 (VAR_7VAR_0VAR_7->VAR_7pix_fmtVAR_7 == VAR_7AV_PIX_FMT_DXVA2_VLDVAR_7) {",
"VAR_7bufferVAR_7 = &VAR_7buffer2VAR_7[VAR_7buffer_countVAR_7];",
"VAR_7typeVAR_7 = VAR_7DXVA2_PictureParametersBufferTypeVAR_7;",
"}",
"#VAR_7endifVAR_7\nVAR_7resultVAR_7 = VAR_7ff_dxva2_commit_bufferVAR_7(VAR_7VAR_0VAR_7, VAR_7ctxVAR_7, VAR_7bufferVAR_7,\nVAR_7typeVAR_7,\nVAR_7VAR_2VAR_7, VAR_7VAR_3VAR_7, VAR_70VAR_7);",
"VAR_7ifVAR_7 (VAR_7resultVAR_7) {",
"VAR_7av_logVAR_7(VAR_7VAR_0VAR_7, VAR_7AV_LOG_ERRORVAR_7,\n\"VAR_7FailedVAR_7 VAR_7toVAR_7 VAR_7addVAR_7 VAR_7pictureVAR_7 VAR_7parameterVAR_7 VAR_7bufferVAR_7\\VAR_7nVAR_7\");",
"VAR_7gotoVAR_7 VAR_7endVAR_7;",
"}",
"VAR_7buffer_countVAR_7++;",
"VAR_7ifVAR_7 (VAR_7VAR_5VAR_7 > VAR_70VAR_7) {",
"#VAR_7ifVAR_7 VAR_7CONFIG_D3D11VAVAR_7\nVAR_7ifVAR_7 (VAR_7VAR_0VAR_7->VAR_7pix_fmtVAR_7 == VAR_7AV_PIX_FMT_D3D11VA_VLDVAR_7) {",
"VAR_7bufferVAR_7 = &VAR_7buffer11VAR_7[VAR_7buffer_countVAR_7];",
"VAR_7typeVAR_7 = VAR_7D3D11_VIDEO_DECODER_BUFFER_INVERSE_QUANTIZATION_MATRIXVAR_7;",
"}",
"#VAR_7endifVAR_7\n#VAR_7ifVAR_7 VAR_7CONFIG_DXVA2VAR_7\nVAR_7ifVAR_7 (VAR_7VAR_0VAR_7->VAR_7pix_fmtVAR_7 == VAR_7AV_PIX_FMT_DXVA2_VLDVAR_7) {",
"VAR_7bufferVAR_7 = &VAR_7buffer2VAR_7[VAR_7buffer_countVAR_7];",
"VAR_7typeVAR_7 = VAR_7DXVA2_InverseQuantizationMatrixBufferTypeVAR_7;",
"}",
"#VAR_7endifVAR_7\nVAR_7resultVAR_7 = VAR_7ff_dxva2_commit_bufferVAR_7(VAR_7VAR_0VAR_7, VAR_7ctxVAR_7, VAR_7bufferVAR_7,\nVAR_7typeVAR_7,\nVAR_7VAR_4VAR_7, VAR_7VAR_5VAR_7, VAR_70VAR_7);",
"VAR_7ifVAR_7 (VAR_7resultVAR_7) {",
"VAR_7av_logVAR_7(VAR_7VAR_0VAR_7, VAR_7AV_LOG_ERRORVAR_7,\n\"VAR_7FailedVAR_7 VAR_7toVAR_7 VAR_7addVAR_7 VAR_7inverseVAR_7 VAR_7quantizationVAR_7 VAR_7matrixVAR_7 VAR_7bufferVAR_7\\VAR_7nVAR_7\");",
"VAR_7gotoVAR_7 VAR_7endVAR_7;",
"}",
"VAR_7buffer_countVAR_7++;",
"}",
"#VAR_7ifVAR_7 VAR_7CONFIG_D3D11VAVAR_7\nVAR_7ifVAR_7 (VAR_7VAR_0VAR_7->VAR_7pix_fmtVAR_7 == VAR_7AV_PIX_FMT_D3D11VA_VLDVAR_7) {",
"VAR_7bufferVAR_7 = &VAR_7buffer11VAR_7[VAR_7buffer_countVAR_7 + VAR_70VAR_7];",
"VAR_7buffer_sliceVAR_7 = &VAR_7buffer11VAR_7[VAR_7buffer_countVAR_7 + VAR_71VAR_7];",
"}",
"#VAR_7endifVAR_7\n#VAR_7ifVAR_7 VAR_7CONFIG_DXVA2VAR_7\nVAR_7ifVAR_7 (VAR_7VAR_0VAR_7->VAR_7pix_fmtVAR_7 == VAR_7AV_PIX_FMT_DXVA2_VLDVAR_7) {",
"VAR_7bufferVAR_7 = &VAR_7buffer2VAR_7[VAR_7buffer_countVAR_7 + VAR_70VAR_7];",
"VAR_7buffer_sliceVAR_7 = &VAR_7buffer2VAR_7[VAR_7buffer_countVAR_7 + VAR_71VAR_7];",
"}",
"#VAR_7endifVAR_7\nVAR_7resultVAR_7 = VAR_7VAR_6VAR_7(VAR_7VAR_0VAR_7,\nVAR_7bufferVAR_7,\nVAR_7buffer_sliceVAR_7);",
"VAR_7ifVAR_7 (VAR_7resultVAR_7) {",
"VAR_7av_logVAR_7(VAR_7VAR_0VAR_7, VAR_7AV_LOG_ERRORVAR_7,\n\"VAR_7FailedVAR_7 VAR_7toVAR_7 VAR_7addVAR_7 VAR_7bitstreamVAR_7 VAR_7orVAR_7 VAR_7sliceVAR_7 VAR_7controlVAR_7 VAR_7bufferVAR_7\\VAR_7nVAR_7\");",
"VAR_7gotoVAR_7 VAR_7endVAR_7;",
"}",
"VAR_7buffer_countVAR_7 += VAR_72VAR_7;",
"VAR_7assertVAR_7(VAR_7buffer_countVAR_7 == VAR_71VAR_7 + (VAR_7VAR_5VAR_7 > VAR_70VAR_7) + VAR_72VAR_7);",
"#VAR_7ifVAR_7 VAR_7CONFIG_D3D11VAVAR_7\nVAR_7ifVAR_7 (VAR_7VAR_0VAR_7->VAR_7pix_fmtVAR_7 == VAR_7AV_PIX_FMT_D3D11VA_VLDVAR_7)\nVAR_7hrVAR_7 = VAR_7ID3D11VideoContext_SubmitDecoderBuffersVAR_7(VAR_7D3D11VA_CONTEXTVAR_7(VAR_7ctxVAR_7)->VAR_7video_contextVAR_7,\nVAR_7D3D11VA_CONTEXTVAR_7(VAR_7ctxVAR_7)->VAR_7decoderVAR_7,\nVAR_7buffer_countVAR_7, VAR_7buffer11VAR_7);",
"#VAR_7endifVAR_7\n#VAR_7ifVAR_7 VAR_7CONFIG_DXVA2VAR_7\nVAR_7ifVAR_7 (VAR_7VAR_0VAR_7->VAR_7pix_fmtVAR_7 == VAR_7AV_PIX_FMT_DXVA2_VLDVAR_7) {",
"VAR_7DXVA2_DecodeExecuteParamsVAR_7 VAR_7execVAR_7 = {",
".VAR_7NumCompBuffersVAR_7 = VAR_7buffer_countVAR_7,\n.VAR_7pCompressedBuffersVAR_7 = VAR_7buffer2VAR_7,\n.VAR_7pExtensionDataVAR_7 = VAR_7NULLVAR_7,\n};",
"VAR_7hrVAR_7 = VAR_7IDirectXVideoDecoder_ExecuteVAR_7(VAR_7DXVA2_CONTEXTVAR_7(VAR_7ctxVAR_7)->VAR_7decoderVAR_7, &VAR_7execVAR_7);",
"}",
"#VAR_7endifVAR_7\nVAR_7ifVAR_7 (VAR_7FAILEDVAR_7(VAR_7hrVAR_7)) {",
"VAR_7av_logVAR_7(VAR_7VAR_0VAR_7, VAR_7AV_LOG_ERRORVAR_7, \"VAR_7FailedVAR_7 VAR_7toVAR_7 VAR_7executeVAR_7: VAR_70xVAR_7%VAR_7lxVAR_7\\VAR_7nVAR_7\", VAR_7hrVAR_7);",
"VAR_7resultVAR_7 = -VAR_71VAR_7;",
"}",
"VAR_7endVAR_7:\n#VAR_7ifVAR_7 VAR_7CONFIG_D3D11VAVAR_7\nVAR_7ifVAR_7 (VAR_7VAR_0VAR_7->VAR_7pix_fmtVAR_7 == VAR_7AV_PIX_FMT_D3D11VA_VLDVAR_7) {",
"VAR_7hrVAR_7 = VAR_7ID3D11VideoContext_DecoderEndFrameVAR_7(VAR_7D3D11VA_CONTEXTVAR_7(VAR_7ctxVAR_7)->VAR_7video_contextVAR_7, VAR_7D3D11VA_CONTEXTVAR_7(VAR_7ctxVAR_7)->VAR_7decoderVAR_7);",
"VAR_7ifVAR_7 (VAR_7D3D11VA_CONTEXTVAR_7(VAR_7ctxVAR_7)->VAR_7context_mutexVAR_7 != VAR_7INVALID_HANDLE_VALUEVAR_7)\nVAR_7ReleaseMutexVAR_7(VAR_7D3D11VA_CONTEXTVAR_7(VAR_7ctxVAR_7)->VAR_7context_mutexVAR_7);",
"}",
"#VAR_7endifVAR_7\n#VAR_7ifVAR_7 VAR_7CONFIG_DXVA2VAR_7\nVAR_7ifVAR_7 (VAR_7VAR_0VAR_7->VAR_7pix_fmtVAR_7 == VAR_7AV_PIX_FMT_DXVA2_VLDVAR_7)\nVAR_7hrVAR_7 = VAR_7IDirectXVideoDecoder_EndFrameVAR_7(VAR_7DXVA2_CONTEXTVAR_7(VAR_7ctxVAR_7)->VAR_7decoderVAR_7, VAR_7NULLVAR_7);",
"#VAR_7endifVAR_7\nVAR_7ifVAR_7 (VAR_7FAILEDVAR_7(VAR_7hrVAR_7)) {",
"VAR_7av_logVAR_7(VAR_7VAR_0VAR_7, VAR_7AV_LOG_ERRORVAR_7, \"VAR_7FailedVAR_7 VAR_7toVAR_7 VAR_7endVAR_7 VAR_7VAR_1VAR_7: VAR_70xVAR_7%VAR_7lxVAR_7\\VAR_7nVAR_7\", VAR_7hrVAR_7);",
"VAR_7resultVAR_7 = -VAR_71VAR_7;",
"}",
"VAR_7returnVAR_7 VAR_7resultVAR_7;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5,
7,
9,
11,
13
],
[
15
],
[
17
],
[
19,
21
],
[
23,
25,
27
],
[
29,
31
],
[
33
],
[
35
],
[
37
],
[
41
],
[
43,
45
],
[
47,
49
],
[
51,
53,
55
],
[
57
],
[
59,
61,
63,
65,
67,
69
],
[
71,
73,
75
],
[
77
],
[
81
],
[
83
],
[
85,
87,
89,
91
],
[
93,
95
],
[
97
],
[
101,
103
],
[
105
],
[
107
],
[
109
],
[
111,
113,
115
],
[
117
],
[
119
],
[
121
],
[
123,
125,
127,
129
],
[
131
],
[
133,
135
],
[
137
],
[
139
],
[
141
],
[
145
],
[
147,
149
],
[
151
],
[
153
],
[
155
],
[
157,
159,
161
],
[
163
],
[
165
],
[
167
],
[
169,
171,
173,
175
],
[
177
],
[
179,
181
],
[
183
],
[
185
],
[
187
],
[
189
],
[
193,
195
],
[
197
],
[
199
],
[
201
],
[
203,
205,
207
],
[
209
],
[
211
],
[
213
],
[
215,
219,
221,
223
],
[
225
],
[
227,
229
],
[
231
],
[
233
],
[
235
],
[
243
],
[
247,
249,
251,
253,
255
],
[
257,
259,
261
],
[
263
],
[
265,
267,
269,
271
],
[
273
],
[
275
],
[
277,
279
],
[
281
],
[
283
],
[
285
],
[
289,
291,
293
],
[
295
],
[
297,
299
],
[
301
],
[
303,
305,
307,
309
],
[
311,
313
],
[
315
],
[
317
],
[
319
],
[
323
],
[
325
]
] |
19,703 | static int xsub_encode(AVCodecContext *avctx, unsigned char *buf,
int bufsize, void *data)
{
AVSubtitle *h = data;
uint64_t startTime = h->pts / 1000; // FIXME: need better solution...
uint64_t endTime = startTime + h->end_display_time - h->start_display_time;
int start_tc[4], end_tc[4];
uint8_t *hdr = buf + 27; // Point behind the timestamp
uint8_t *rlelenptr;
uint16_t width, height;
int i;
PutBitContext pb;
if (bufsize < 27 + 7*2 + 4*3) {
av_log(avctx, AV_LOG_ERROR, "Buffer too small for XSUB header.\n");
return -1;
}
// TODO: support multiple rects
if (h->num_rects > 1)
av_log(avctx, AV_LOG_WARNING, "Only single rects supported (%d in subtitle.)\n", h->num_rects);
// TODO: render text-based subtitles into bitmaps
if (!h->rects[0]->pict.data[0] || !h->rects[0]->pict.data[1]) {
av_log(avctx, AV_LOG_WARNING, "No subtitle bitmap available.\n");
return -1;
}
// TODO: color reduction, similar to dvdsub encoder
if (h->rects[0]->nb_colors > 4)
av_log(avctx, AV_LOG_WARNING, "No more than 4 subtitle colors supported (%d found.)\n", h->rects[0]->nb_colors);
// TODO: Palette swapping if color zero is not transparent
if (((uint32_t *)h->rects[0]->pict.data[1])[0] & 0xff)
av_log(avctx, AV_LOG_WARNING, "Color index 0 is not transparent. Transparency will be messed up.\n");
if (make_tc(startTime, start_tc) || make_tc(endTime, end_tc)) {
av_log(avctx, AV_LOG_WARNING, "Time code >= 100 hours.\n");
return -1;
}
snprintf(buf, 28,
"[%02d:%02d:%02d.%03d-%02d:%02d:%02d.%03d]",
start_tc[3], start_tc[2], start_tc[1], start_tc[0],
end_tc[3], end_tc[2], end_tc[1], end_tc[0]);
// Width and height must probably be multiples of 2.
// 2 pixels required on either side of subtitle.
// Possibly due to limitations of hardware renderers.
// TODO: check if the bitmap is already padded
width = FFALIGN(h->rects[0]->w, 2) + PADDING * 2;
height = FFALIGN(h->rects[0]->h, 2);
bytestream_put_le16(&hdr, width);
bytestream_put_le16(&hdr, height);
bytestream_put_le16(&hdr, h->rects[0]->x);
bytestream_put_le16(&hdr, h->rects[0]->y);
bytestream_put_le16(&hdr, h->rects[0]->x + width);
bytestream_put_le16(&hdr, h->rects[0]->y + height);
rlelenptr = hdr; // Will store length of first field here later.
hdr+=2;
// Palette
for (i=0; i<4; i++)
bytestream_put_be24(&hdr, ((uint32_t *)h->rects[0]->pict.data[1])[i]);
// Bitmap
// RLE buffer. Reserve 2 bytes for possible padding after the last row.
init_put_bits(&pb, hdr, bufsize - (hdr - buf) - 2);
if (xsub_encode_rle(&pb, h->rects[0]->pict.data[0],
h->rects[0]->pict.linesize[0]*2,
h->rects[0]->w, (h->rects[0]->h + 1) >> 1))
return -1;
bytestream_put_le16(&rlelenptr, put_bits_count(&pb) >> 3); // Length of first field
if (xsub_encode_rle(&pb, h->rects[0]->pict.data[0] + h->rects[0]->pict.linesize[0],
h->rects[0]->pict.linesize[0]*2,
h->rects[0]->w, h->rects[0]->h >> 1))
return -1;
// Enforce total height to be be multiple of 2
if (h->rects[0]->h & 1) {
put_xsub_rle(&pb, h->rects[0]->w, PADDING_COLOR);
align_put_bits(&pb);
}
flush_put_bits(&pb);
return hdr - buf + put_bits_count(&pb)/8;
}
| true | FFmpeg | 9522a752bf4179b69fa9e334ee755405ba8f4459 | static int xsub_encode(AVCodecContext *avctx, unsigned char *buf,
int bufsize, void *data)
{
AVSubtitle *h = data;
uint64_t startTime = h->pts / 1000;
uint64_t endTime = startTime + h->end_display_time - h->start_display_time;
int start_tc[4], end_tc[4];
uint8_t *hdr = buf + 27;
uint8_t *rlelenptr;
uint16_t width, height;
int i;
PutBitContext pb;
if (bufsize < 27 + 7*2 + 4*3) {
av_log(avctx, AV_LOG_ERROR, "Buffer too small for XSUB header.\n");
return -1;
}
if (h->num_rects > 1)
av_log(avctx, AV_LOG_WARNING, "Only single rects supported (%d in subtitle.)\n", h->num_rects);
if (!h->rects[0]->pict.data[0] || !h->rects[0]->pict.data[1]) {
av_log(avctx, AV_LOG_WARNING, "No subtitle bitmap available.\n");
return -1;
}
if (h->rects[0]->nb_colors > 4)
av_log(avctx, AV_LOG_WARNING, "No more than 4 subtitle colors supported (%d found.)\n", h->rects[0]->nb_colors);
if (((uint32_t *)h->rects[0]->pict.data[1])[0] & 0xff)
av_log(avctx, AV_LOG_WARNING, "Color index 0 is not transparent. Transparency will be messed up.\n");
if (make_tc(startTime, start_tc) || make_tc(endTime, end_tc)) {
av_log(avctx, AV_LOG_WARNING, "Time code >= 100 hours.\n");
return -1;
}
snprintf(buf, 28,
"[%02d:%02d:%02d.%03d-%02d:%02d:%02d.%03d]",
start_tc[3], start_tc[2], start_tc[1], start_tc[0],
end_tc[3], end_tc[2], end_tc[1], end_tc[0]);
width = FFALIGN(h->rects[0]->w, 2) + PADDING * 2;
height = FFALIGN(h->rects[0]->h, 2);
bytestream_put_le16(&hdr, width);
bytestream_put_le16(&hdr, height);
bytestream_put_le16(&hdr, h->rects[0]->x);
bytestream_put_le16(&hdr, h->rects[0]->y);
bytestream_put_le16(&hdr, h->rects[0]->x + width);
bytestream_put_le16(&hdr, h->rects[0]->y + height);
rlelenptr = hdr;
hdr+=2;
for (i=0; i<4; i++)
bytestream_put_be24(&hdr, ((uint32_t *)h->rects[0]->pict.data[1])[i]);
init_put_bits(&pb, hdr, bufsize - (hdr - buf) - 2);
if (xsub_encode_rle(&pb, h->rects[0]->pict.data[0],
h->rects[0]->pict.linesize[0]*2,
h->rects[0]->w, (h->rects[0]->h + 1) >> 1))
return -1;
bytestream_put_le16(&rlelenptr, put_bits_count(&pb) >> 3);
if (xsub_encode_rle(&pb, h->rects[0]->pict.data[0] + h->rects[0]->pict.linesize[0],
h->rects[0]->pict.linesize[0]*2,
h->rects[0]->w, h->rects[0]->h >> 1))
return -1;
if (h->rects[0]->h & 1) {
put_xsub_rle(&pb, h->rects[0]->w, PADDING_COLOR);
align_put_bits(&pb);
}
flush_put_bits(&pb);
return hdr - buf + put_bits_count(&pb)/8;
}
| {
"code": [
" if (h->num_rects > 1)"
],
"line_no": [
39
]
} | static int FUNC_0(AVCodecContext *VAR_0, unsigned char *VAR_1,
int VAR_2, void *VAR_3)
{
AVSubtitle *h = VAR_3;
uint64_t startTime = h->pts / 1000;
uint64_t endTime = startTime + h->end_display_time - h->start_display_time;
int VAR_4[4], VAR_5[4];
uint8_t *hdr = VAR_1 + 27;
uint8_t *rlelenptr;
uint16_t width, height;
int VAR_6;
PutBitContext pb;
if (VAR_2 < 27 + 7*2 + 4*3) {
av_log(VAR_0, AV_LOG_ERROR, "Buffer too small for XSUB header.\n");
return -1;
}
if (h->num_rects > 1)
av_log(VAR_0, AV_LOG_WARNING, "Only single rects supported (%d in subtitle.)\n", h->num_rects);
if (!h->rects[0]->pict.VAR_3[0] || !h->rects[0]->pict.VAR_3[1]) {
av_log(VAR_0, AV_LOG_WARNING, "No subtitle bitmap available.\n");
return -1;
}
if (h->rects[0]->nb_colors > 4)
av_log(VAR_0, AV_LOG_WARNING, "No more than 4 subtitle colors supported (%d found.)\n", h->rects[0]->nb_colors);
if (((uint32_t *)h->rects[0]->pict.VAR_3[1])[0] & 0xff)
av_log(VAR_0, AV_LOG_WARNING, "Color index 0 is not transparent. Transparency will be messed up.\n");
if (make_tc(startTime, VAR_4) || make_tc(endTime, VAR_5)) {
av_log(VAR_0, AV_LOG_WARNING, "Time code >= 100 hours.\n");
return -1;
}
snprintf(VAR_1, 28,
"[%02d:%02d:%02d.%03d-%02d:%02d:%02d.%03d]",
VAR_4[3], VAR_4[2], VAR_4[1], VAR_4[0],
VAR_5[3], VAR_5[2], VAR_5[1], VAR_5[0]);
width = FFALIGN(h->rects[0]->w, 2) + PADDING * 2;
height = FFALIGN(h->rects[0]->h, 2);
bytestream_put_le16(&hdr, width);
bytestream_put_le16(&hdr, height);
bytestream_put_le16(&hdr, h->rects[0]->x);
bytestream_put_le16(&hdr, h->rects[0]->y);
bytestream_put_le16(&hdr, h->rects[0]->x + width);
bytestream_put_le16(&hdr, h->rects[0]->y + height);
rlelenptr = hdr;
hdr+=2;
for (VAR_6=0; VAR_6<4; VAR_6++)
bytestream_put_be24(&hdr, ((uint32_t *)h->rects[0]->pict.VAR_3[1])[VAR_6]);
init_put_bits(&pb, hdr, VAR_2 - (hdr - VAR_1) - 2);
if (xsub_encode_rle(&pb, h->rects[0]->pict.VAR_3[0],
h->rects[0]->pict.linesize[0]*2,
h->rects[0]->w, (h->rects[0]->h + 1) >> 1))
return -1;
bytestream_put_le16(&rlelenptr, put_bits_count(&pb) >> 3);
if (xsub_encode_rle(&pb, h->rects[0]->pict.VAR_3[0] + h->rects[0]->pict.linesize[0],
h->rects[0]->pict.linesize[0]*2,
h->rects[0]->w, h->rects[0]->h >> 1))
return -1;
if (h->rects[0]->h & 1) {
put_xsub_rle(&pb, h->rects[0]->w, PADDING_COLOR);
align_put_bits(&pb);
}
flush_put_bits(&pb);
return hdr - VAR_1 + put_bits_count(&pb)/8;
}
| [
"static int FUNC_0(AVCodecContext *VAR_0, unsigned char *VAR_1,\nint VAR_2, void *VAR_3)\n{",
"AVSubtitle *h = VAR_3;",
"uint64_t startTime = h->pts / 1000;",
"uint64_t endTime = startTime + h->end_display_time - h->start_display_time;",
"int VAR_4[4], VAR_5[4];",
"uint8_t *hdr = VAR_1 + 27;",
"uint8_t *rlelenptr;",
"uint16_t width, height;",
"int VAR_6;",
"PutBitContext pb;",
"if (VAR_2 < 27 + 7*2 + 4*3) {",
"av_log(VAR_0, AV_LOG_ERROR, \"Buffer too small for XSUB header.\\n\");",
"return -1;",
"}",
"if (h->num_rects > 1)\nav_log(VAR_0, AV_LOG_WARNING, \"Only single rects supported (%d in subtitle.)\\n\", h->num_rects);",
"if (!h->rects[0]->pict.VAR_3[0] || !h->rects[0]->pict.VAR_3[1]) {",
"av_log(VAR_0, AV_LOG_WARNING, \"No subtitle bitmap available.\\n\");",
"return -1;",
"}",
"if (h->rects[0]->nb_colors > 4)\nav_log(VAR_0, AV_LOG_WARNING, \"No more than 4 subtitle colors supported (%d found.)\\n\", h->rects[0]->nb_colors);",
"if (((uint32_t *)h->rects[0]->pict.VAR_3[1])[0] & 0xff)\nav_log(VAR_0, AV_LOG_WARNING, \"Color index 0 is not transparent. Transparency will be messed up.\\n\");",
"if (make_tc(startTime, VAR_4) || make_tc(endTime, VAR_5)) {",
"av_log(VAR_0, AV_LOG_WARNING, \"Time code >= 100 hours.\\n\");",
"return -1;",
"}",
"snprintf(VAR_1, 28,\n\"[%02d:%02d:%02d.%03d-%02d:%02d:%02d.%03d]\",\nVAR_4[3], VAR_4[2], VAR_4[1], VAR_4[0],\nVAR_5[3], VAR_5[2], VAR_5[1], VAR_5[0]);",
"width = FFALIGN(h->rects[0]->w, 2) + PADDING * 2;",
"height = FFALIGN(h->rects[0]->h, 2);",
"bytestream_put_le16(&hdr, width);",
"bytestream_put_le16(&hdr, height);",
"bytestream_put_le16(&hdr, h->rects[0]->x);",
"bytestream_put_le16(&hdr, h->rects[0]->y);",
"bytestream_put_le16(&hdr, h->rects[0]->x + width);",
"bytestream_put_le16(&hdr, h->rects[0]->y + height);",
"rlelenptr = hdr;",
"hdr+=2;",
"for (VAR_6=0; VAR_6<4; VAR_6++)",
"bytestream_put_be24(&hdr, ((uint32_t *)h->rects[0]->pict.VAR_3[1])[VAR_6]);",
"init_put_bits(&pb, hdr, VAR_2 - (hdr - VAR_1) - 2);",
"if (xsub_encode_rle(&pb, h->rects[0]->pict.VAR_3[0],\nh->rects[0]->pict.linesize[0]*2,\nh->rects[0]->w, (h->rects[0]->h + 1) >> 1))\nreturn -1;",
"bytestream_put_le16(&rlelenptr, put_bits_count(&pb) >> 3);",
"if (xsub_encode_rle(&pb, h->rects[0]->pict.VAR_3[0] + h->rects[0]->pict.linesize[0],\nh->rects[0]->pict.linesize[0]*2,\nh->rects[0]->w, h->rects[0]->h >> 1))\nreturn -1;",
"if (h->rects[0]->h & 1) {",
"put_xsub_rle(&pb, h->rects[0]->w, PADDING_COLOR);",
"align_put_bits(&pb);",
"}",
"flush_put_bits(&pb);",
"return hdr - VAR_1 + put_bits_count(&pb)/8;",
"}"
] | [
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
] | [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
27
],
[
29
],
[
31
],
[
33
],
[
39,
41
],
[
47
],
[
49
],
[
51
],
[
53
],
[
59,
61
],
[
67,
69
],
[
73
],
[
75
],
[
77
],
[
79
],
[
83,
85,
87,
89
],
[
101
],
[
103
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
121
],
[
123
],
[
129
],
[
131
],
[
139
],
[
141,
143,
145,
147
],
[
149
],
[
153,
155,
157,
159
],
[
165
],
[
167
],
[
169
],
[
171
],
[
175
],
[
179
],
[
181
]
] |
19,704 | void avcodec_register_all(void)
{
static int initialized;
if (initialized)
return;
initialized = 1;
/* hardware accelerators */
REGISTER_HWACCEL(H263_CUVID, h263_cuvid);
REGISTER_HWACCEL(H263_VAAPI, h263_vaapi);
REGISTER_HWACCEL(H263_VIDEOTOOLBOX, h263_videotoolbox);
REGISTER_HWACCEL(H264_CUVID, h264_cuvid);
REGISTER_HWACCEL(H264_D3D11VA, h264_d3d11va);
REGISTER_HWACCEL(H264_DXVA2, h264_dxva2);
REGISTER_HWACCEL(H264_MEDIACODEC, h264_mediacodec);
REGISTER_HWACCEL(H264_MMAL, h264_mmal);
REGISTER_HWACCEL(H264_QSV, h264_qsv);
REGISTER_HWACCEL(H264_VAAPI, h264_vaapi);
REGISTER_HWACCEL(H264_VDA, h264_vda);
REGISTER_HWACCEL(H264_VDA_OLD, h264_vda_old);
REGISTER_HWACCEL(H264_VDPAU, h264_vdpau);
REGISTER_HWACCEL(H264_VIDEOTOOLBOX, h264_videotoolbox);
REGISTER_HWACCEL(HEVC_CUVID, hevc_cuvid);
REGISTER_HWACCEL(HEVC_D3D11VA, hevc_d3d11va);
REGISTER_HWACCEL(HEVC_DXVA2, hevc_dxva2);
REGISTER_HWACCEL(HEVC_QSV, hevc_qsv);
REGISTER_HWACCEL(HEVC_VAAPI, hevc_vaapi);
REGISTER_HWACCEL(HEVC_VDPAU, hevc_vdpau);
REGISTER_HWACCEL(MPEG1_XVMC, mpeg1_xvmc);
REGISTER_HWACCEL(MPEG1_VDPAU, mpeg1_vdpau);
REGISTER_HWACCEL(MPEG1_VIDEOTOOLBOX, mpeg1_videotoolbox);
REGISTER_HWACCEL(MPEG2_XVMC, mpeg2_xvmc);
REGISTER_HWACCEL(MPEG2_D3D11VA, mpeg2_d3d11va);
REGISTER_HWACCEL(MPEG2_DXVA2, mpeg2_dxva2);
REGISTER_HWACCEL(MPEG2_MMAL, mpeg2_mmal);
REGISTER_HWACCEL(MPEG2_QSV, mpeg2_qsv);
REGISTER_HWACCEL(MPEG2_VAAPI, mpeg2_vaapi);
REGISTER_HWACCEL(MPEG2_VDPAU, mpeg2_vdpau);
REGISTER_HWACCEL(MPEG2_VIDEOTOOLBOX, mpeg2_videotoolbox);
REGISTER_HWACCEL(MPEG4_CUVID, mpeg4_cuvid);
REGISTER_HWACCEL(MPEG4_MMAL, mpeg4_mmal);
REGISTER_HWACCEL(MPEG4_VAAPI, mpeg4_vaapi);
REGISTER_HWACCEL(MPEG4_VDPAU, mpeg4_vdpau);
REGISTER_HWACCEL(MPEG4_VIDEOTOOLBOX, mpeg4_videotoolbox);
REGISTER_HWACCEL(VC1_CUVID, vc1_cuvid);
REGISTER_HWACCEL(VC1_D3D11VA, vc1_d3d11va);
REGISTER_HWACCEL(VC1_DXVA2, vc1_dxva2);
REGISTER_HWACCEL(VC1_VAAPI, vc1_vaapi);
REGISTER_HWACCEL(VC1_VDPAU, vc1_vdpau);
REGISTER_HWACCEL(VC1_MMAL, vc1_mmal);
REGISTER_HWACCEL(VC1_QSV, vc1_qsv);
REGISTER_HWACCEL(VP8_CUVID, vp8_cuvid);
REGISTER_HWACCEL(VP9_CUVID, vp9_cuvid);
REGISTER_HWACCEL(VP9_D3D11VA, vp9_d3d11va);
REGISTER_HWACCEL(VP9_DXVA2, vp9_dxva2);
REGISTER_HWACCEL(VP9_VAAPI, vp9_vaapi);
REGISTER_HWACCEL(WMV3_D3D11VA, wmv3_d3d11va);
REGISTER_HWACCEL(WMV3_DXVA2, wmv3_dxva2);
REGISTER_HWACCEL(WMV3_VAAPI, wmv3_vaapi);
REGISTER_HWACCEL(WMV3_VDPAU, wmv3_vdpau);
/* video codecs */
REGISTER_ENCODER(A64MULTI, a64multi);
REGISTER_ENCODER(A64MULTI5, a64multi5);
REGISTER_DECODER(AASC, aasc);
REGISTER_DECODER(AIC, aic);
REGISTER_ENCDEC (ALIAS_PIX, alias_pix);
REGISTER_ENCDEC (AMV, amv);
REGISTER_DECODER(ANM, anm);
REGISTER_DECODER(ANSI, ansi);
REGISTER_ENCDEC (APNG, apng);
REGISTER_ENCDEC (ASV1, asv1);
REGISTER_ENCDEC (ASV2, asv2);
REGISTER_DECODER(AURA, aura);
REGISTER_DECODER(AURA2, aura2);
REGISTER_ENCDEC (AVRP, avrp);
REGISTER_DECODER(AVRN, avrn);
REGISTER_DECODER(AVS, avs);
REGISTER_ENCDEC (AVUI, avui);
REGISTER_ENCDEC (AYUV, ayuv);
REGISTER_DECODER(BETHSOFTVID, bethsoftvid);
REGISTER_DECODER(BFI, bfi);
REGISTER_DECODER(BINK, bink);
REGISTER_ENCDEC (BMP, bmp);
REGISTER_DECODER(BMV_VIDEO, bmv_video);
REGISTER_DECODER(BRENDER_PIX, brender_pix);
REGISTER_DECODER(C93, c93);
REGISTER_DECODER(CAVS, cavs);
REGISTER_DECODER(CDGRAPHICS, cdgraphics);
REGISTER_DECODER(CDXL, cdxl);
REGISTER_DECODER(CFHD, cfhd);
REGISTER_ENCDEC (CINEPAK, cinepak);
REGISTER_ENCDEC (CLJR, cljr);
REGISTER_DECODER(CLLC, cllc);
REGISTER_ENCDEC (COMFORTNOISE, comfortnoise);
REGISTER_DECODER(CPIA, cpia);
REGISTER_DECODER(CSCD, cscd);
REGISTER_DECODER(CYUV, cyuv);
REGISTER_DECODER(DDS, dds);
REGISTER_DECODER(DFA, dfa);
REGISTER_DECODER(DIRAC, dirac);
REGISTER_ENCDEC (DNXHD, dnxhd);
REGISTER_ENCDEC (DPX, dpx);
REGISTER_DECODER(DSICINVIDEO, dsicinvideo);
REGISTER_DECODER(DVAUDIO, dvaudio);
REGISTER_ENCDEC (DVVIDEO, dvvideo);
REGISTER_DECODER(DXA, dxa);
REGISTER_DECODER(DXTORY, dxtory);
REGISTER_DECODER(DXV, dxv);
REGISTER_DECODER(EACMV, eacmv);
REGISTER_DECODER(EAMAD, eamad);
REGISTER_DECODER(EATGQ, eatgq);
REGISTER_DECODER(EATGV, eatgv);
REGISTER_DECODER(EATQI, eatqi);
REGISTER_DECODER(EIGHTBPS, eightbps);
REGISTER_DECODER(EIGHTSVX_EXP, eightsvx_exp);
REGISTER_DECODER(EIGHTSVX_FIB, eightsvx_fib);
REGISTER_DECODER(ESCAPE124, escape124);
REGISTER_DECODER(ESCAPE130, escape130);
REGISTER_DECODER(EXR, exr);
REGISTER_ENCDEC (FFV1, ffv1);
REGISTER_ENCDEC (FFVHUFF, ffvhuff);
REGISTER_DECODER(FIC, fic);
REGISTER_ENCDEC (FLASHSV, flashsv);
REGISTER_ENCDEC (FLASHSV2, flashsv2);
REGISTER_DECODER(FLIC, flic);
REGISTER_ENCDEC (FLV, flv);
REGISTER_DECODER(FOURXM, fourxm);
REGISTER_DECODER(FRAPS, fraps);
REGISTER_DECODER(FRWU, frwu);
REGISTER_DECODER(G2M, g2m);
REGISTER_ENCDEC (GIF, gif);
REGISTER_ENCDEC (H261, h261);
REGISTER_ENCDEC (H263, h263);
REGISTER_DECODER(H263I, h263i);
REGISTER_ENCDEC (H263P, h263p);
REGISTER_DECODER(H264, h264);
REGISTER_DECODER(H264_CRYSTALHD, h264_crystalhd);
REGISTER_DECODER(H264_MEDIACODEC, h264_mediacodec);
REGISTER_DECODER(H264_MMAL, h264_mmal);
REGISTER_DECODER(H264_QSV, h264_qsv);
REGISTER_DECODER(H264_VDA, h264_vda);
#if FF_API_VDPAU
REGISTER_DECODER(H264_VDPAU, h264_vdpau);
#endif
REGISTER_ENCDEC (HAP, hap);
REGISTER_DECODER(HEVC, hevc);
REGISTER_DECODER(HEVC_QSV, hevc_qsv);
REGISTER_DECODER(HNM4_VIDEO, hnm4_video);
REGISTER_DECODER(HQ_HQA, hq_hqa);
REGISTER_DECODER(HQX, hqx);
REGISTER_ENCDEC (HUFFYUV, huffyuv);
REGISTER_DECODER(IDCIN, idcin);
REGISTER_DECODER(IFF_ILBM, iff_ilbm);
REGISTER_DECODER(INDEO2, indeo2);
REGISTER_DECODER(INDEO3, indeo3);
REGISTER_DECODER(INDEO4, indeo4);
REGISTER_DECODER(INDEO5, indeo5);
REGISTER_DECODER(INTERPLAY_VIDEO, interplay_video);
REGISTER_ENCDEC (JPEG2000, jpeg2000);
REGISTER_ENCDEC (JPEGLS, jpegls);
REGISTER_DECODER(JV, jv);
REGISTER_DECODER(KGV1, kgv1);
REGISTER_DECODER(KMVC, kmvc);
REGISTER_DECODER(LAGARITH, lagarith);
REGISTER_ENCODER(LJPEG, ljpeg);
REGISTER_DECODER(LOCO, loco);
REGISTER_DECODER(M101, m101);
REGISTER_DECODER(MAGICYUV, magicyuv);
REGISTER_DECODER(MDEC, mdec);
REGISTER_DECODER(MIMIC, mimic);
REGISTER_ENCDEC (MJPEG, mjpeg);
REGISTER_DECODER(MJPEGB, mjpegb);
REGISTER_DECODER(MMVIDEO, mmvideo);
REGISTER_DECODER(MOTIONPIXELS, motionpixels);
#if FF_API_XVMC
REGISTER_DECODER(MPEG_XVMC, mpeg_xvmc);
#endif /* FF_API_XVMC */
REGISTER_ENCDEC (MPEG1VIDEO, mpeg1video);
REGISTER_ENCDEC (MPEG2VIDEO, mpeg2video);
REGISTER_ENCDEC (MPEG4, mpeg4);
REGISTER_DECODER(MPEG4_CRYSTALHD, mpeg4_crystalhd);
REGISTER_DECODER(MPEG4_MMAL, mpeg4_mmal);
#if FF_API_VDPAU
REGISTER_DECODER(MPEG4_VDPAU, mpeg4_vdpau);
#endif
REGISTER_DECODER(MPEGVIDEO, mpegvideo);
#if FF_API_VDPAU
REGISTER_DECODER(MPEG_VDPAU, mpeg_vdpau);
REGISTER_DECODER(MPEG1_VDPAU, mpeg1_vdpau);
#endif
REGISTER_DECODER(MPEG2_MMAL, mpeg2_mmal);
REGISTER_DECODER(MPEG2_CRYSTALHD, mpeg2_crystalhd);
REGISTER_DECODER(MPEG2_QSV, mpeg2_qsv);
REGISTER_DECODER(MSA1, msa1);
REGISTER_DECODER(MSMPEG4_CRYSTALHD, msmpeg4_crystalhd);
REGISTER_DECODER(MSMPEG4V1, msmpeg4v1);
REGISTER_ENCDEC (MSMPEG4V2, msmpeg4v2);
REGISTER_ENCDEC (MSMPEG4V3, msmpeg4v3);
REGISTER_DECODER(MSRLE, msrle);
REGISTER_DECODER(MSS1, mss1);
REGISTER_DECODER(MSS2, mss2);
REGISTER_ENCDEC (MSVIDEO1, msvideo1);
REGISTER_DECODER(MSZH, mszh);
REGISTER_DECODER(MTS2, mts2);
REGISTER_DECODER(MVC1, mvc1);
REGISTER_DECODER(MVC2, mvc2);
REGISTER_DECODER(MXPEG, mxpeg);
REGISTER_DECODER(NUV, nuv);
REGISTER_DECODER(PAF_VIDEO, paf_video);
REGISTER_ENCDEC (PAM, pam);
REGISTER_ENCDEC (PBM, pbm);
REGISTER_ENCDEC (PCX, pcx);
REGISTER_ENCDEC (PGM, pgm);
REGISTER_ENCDEC (PGMYUV, pgmyuv);
REGISTER_DECODER(PICTOR, pictor);
REGISTER_ENCDEC (PNG, png);
REGISTER_ENCDEC (PPM, ppm);
REGISTER_ENCDEC (PRORES, prores);
REGISTER_ENCODER(PRORES_AW, prores_aw);
REGISTER_ENCODER(PRORES_KS, prores_ks);
REGISTER_DECODER(PRORES_LGPL, prores_lgpl);
REGISTER_DECODER(PTX, ptx);
REGISTER_DECODER(QDRAW, qdraw);
REGISTER_DECODER(QPEG, qpeg);
REGISTER_ENCDEC (QTRLE, qtrle);
REGISTER_ENCDEC (R10K, r10k);
REGISTER_ENCDEC (R210, r210);
REGISTER_ENCDEC (RAWVIDEO, rawvideo);
REGISTER_DECODER(RL2, rl2);
REGISTER_ENCDEC (ROQ, roq);
REGISTER_DECODER(RPZA, rpza);
REGISTER_DECODER(RSCC, rscc);
REGISTER_ENCDEC (RV10, rv10);
REGISTER_ENCDEC (RV20, rv20);
REGISTER_DECODER(RV30, rv30);
REGISTER_DECODER(RV40, rv40);
REGISTER_ENCDEC (S302M, s302m);
REGISTER_DECODER(SANM, sanm);
REGISTER_DECODER(SCREENPRESSO, screenpresso);
REGISTER_DECODER(SDX2_DPCM, sdx2_dpcm);
REGISTER_ENCDEC (SGI, sgi);
REGISTER_DECODER(SGIRLE, sgirle);
REGISTER_DECODER(SHEERVIDEO, sheervideo);
REGISTER_DECODER(SMACKER, smacker);
REGISTER_DECODER(SMC, smc);
REGISTER_DECODER(SMVJPEG, smvjpeg);
REGISTER_ENCDEC (SNOW, snow);
REGISTER_DECODER(SP5X, sp5x);
REGISTER_ENCDEC (SUNRAST, sunrast);
REGISTER_ENCDEC (SVQ1, svq1);
REGISTER_DECODER(SVQ3, svq3);
REGISTER_ENCDEC (TARGA, targa);
REGISTER_DECODER(TARGA_Y216, targa_y216);
REGISTER_DECODER(TDSC, tdsc);
REGISTER_DECODER(THEORA, theora);
REGISTER_DECODER(THP, thp);
REGISTER_DECODER(TIERTEXSEQVIDEO, tiertexseqvideo);
REGISTER_ENCDEC (TIFF, tiff);
REGISTER_DECODER(TMV, tmv);
REGISTER_DECODER(TRUEMOTION1, truemotion1);
REGISTER_DECODER(TRUEMOTION2, truemotion2);
REGISTER_DECODER(TRUEMOTION2RT, truemotion2rt);
REGISTER_DECODER(TSCC, tscc);
REGISTER_DECODER(TSCC2, tscc2);
REGISTER_DECODER(TXD, txd);
REGISTER_DECODER(ULTI, ulti);
REGISTER_ENCDEC (UTVIDEO, utvideo);
REGISTER_ENCDEC (V210, v210);
REGISTER_DECODER(V210X, v210x);
REGISTER_ENCDEC (V308, v308);
REGISTER_ENCDEC (V408, v408);
REGISTER_ENCDEC (V410, v410);
REGISTER_DECODER(VB, vb);
REGISTER_DECODER(VBLE, vble);
REGISTER_DECODER(VC1, vc1);
REGISTER_DECODER(VC1_CRYSTALHD, vc1_crystalhd);
#if FF_API_VDPAU
REGISTER_DECODER(VC1_VDPAU, vc1_vdpau);
#endif
REGISTER_DECODER(VC1IMAGE, vc1image);
REGISTER_DECODER(VC1_MMAL, vc1_mmal);
REGISTER_DECODER(VC1_QSV, vc1_qsv);
REGISTER_ENCODER(VC2, vc2);
REGISTER_DECODER(VCR1, vcr1);
REGISTER_DECODER(VMDVIDEO, vmdvideo);
REGISTER_DECODER(VMNC, vmnc);
REGISTER_DECODER(VP3, vp3);
REGISTER_DECODER(VP5, vp5);
REGISTER_DECODER(VP6, vp6);
REGISTER_DECODER(VP6A, vp6a);
REGISTER_DECODER(VP6F, vp6f);
REGISTER_DECODER(VP7, vp7);
REGISTER_DECODER(VP8, vp8);
REGISTER_DECODER(VP9, vp9);
REGISTER_DECODER(VQA, vqa);
REGISTER_DECODER(WEBP, webp);
REGISTER_ENCODER(WRAPPED_AVFRAME, wrapped_avframe);
REGISTER_ENCDEC (WMV1, wmv1);
REGISTER_ENCDEC (WMV2, wmv2);
REGISTER_DECODER(WMV3, wmv3);
REGISTER_DECODER(WMV3_CRYSTALHD, wmv3_crystalhd);
#if FF_API_VDPAU
REGISTER_DECODER(WMV3_VDPAU, wmv3_vdpau);
#endif
REGISTER_DECODER(WMV3IMAGE, wmv3image);
REGISTER_DECODER(WNV1, wnv1);
REGISTER_DECODER(XAN_WC3, xan_wc3);
REGISTER_DECODER(XAN_WC4, xan_wc4);
REGISTER_ENCDEC (XBM, xbm);
REGISTER_ENCDEC (XFACE, xface);
REGISTER_DECODER(XL, xl);
REGISTER_ENCDEC (XWD, xwd);
REGISTER_ENCDEC (Y41P, y41p);
REGISTER_DECODER(YLC, ylc);
REGISTER_DECODER(YOP, yop);
REGISTER_ENCDEC (YUV4, yuv4);
REGISTER_DECODER(ZERO12V, zero12v);
REGISTER_DECODER(ZEROCODEC, zerocodec);
REGISTER_ENCDEC (ZLIB, zlib);
REGISTER_ENCDEC (ZMBV, zmbv);
/* audio codecs */
REGISTER_ENCDEC (AAC, aac);
REGISTER_DECODER(AAC_FIXED, aac_fixed);
REGISTER_DECODER(AAC_LATM, aac_latm);
REGISTER_ENCDEC (AC3, ac3);
REGISTER_ENCDEC (AC3_FIXED, ac3_fixed);
REGISTER_ENCDEC (ALAC, alac);
REGISTER_DECODER(ALS, als);
REGISTER_DECODER(AMRNB, amrnb);
REGISTER_DECODER(AMRWB, amrwb);
REGISTER_DECODER(APE, ape);
REGISTER_DECODER(ATRAC1, atrac1);
REGISTER_DECODER(ATRAC3, atrac3);
REGISTER_DECODER(ATRAC3P, atrac3p);
REGISTER_DECODER(BINKAUDIO_DCT, binkaudio_dct);
REGISTER_DECODER(BINKAUDIO_RDFT, binkaudio_rdft);
REGISTER_DECODER(BMV_AUDIO, bmv_audio);
REGISTER_DECODER(COOK, cook);
REGISTER_ENCDEC (DCA, dca);
REGISTER_DECODER(DSD_LSBF, dsd_lsbf);
REGISTER_DECODER(DSD_MSBF, dsd_msbf);
REGISTER_DECODER(DSD_LSBF_PLANAR, dsd_lsbf_planar);
REGISTER_DECODER(DSD_MSBF_PLANAR, dsd_msbf_planar);
REGISTER_DECODER(DSICINAUDIO, dsicinaudio);
REGISTER_DECODER(DSS_SP, dss_sp);
REGISTER_DECODER(DST, dst);
REGISTER_ENCDEC (EAC3, eac3);
REGISTER_DECODER(EVRC, evrc);
REGISTER_DECODER(FFWAVESYNTH, ffwavesynth);
REGISTER_ENCDEC (FLAC, flac);
REGISTER_ENCDEC (G723_1, g723_1);
REGISTER_DECODER(G729, g729);
REGISTER_DECODER(GSM, gsm);
REGISTER_DECODER(GSM_MS, gsm_ms);
REGISTER_DECODER(IAC, iac);
REGISTER_DECODER(IMC, imc);
REGISTER_DECODER(INTERPLAY_ACM, interplay_acm);
REGISTER_DECODER(MACE3, mace3);
REGISTER_DECODER(MACE6, mace6);
REGISTER_DECODER(METASOUND, metasound);
REGISTER_DECODER(MLP, mlp);
REGISTER_DECODER(MP1, mp1);
REGISTER_DECODER(MP1FLOAT, mp1float);
REGISTER_ENCDEC (MP2, mp2);
REGISTER_DECODER(MP2FLOAT, mp2float);
REGISTER_ENCODER(MP2FIXED, mp2fixed);
REGISTER_DECODER(MP3, mp3);
REGISTER_DECODER(MP3FLOAT, mp3float);
REGISTER_DECODER(MP3ADU, mp3adu);
REGISTER_DECODER(MP3ADUFLOAT, mp3adufloat);
REGISTER_DECODER(MP3ON4, mp3on4);
REGISTER_DECODER(MP3ON4FLOAT, mp3on4float);
REGISTER_DECODER(MPC7, mpc7);
REGISTER_DECODER(MPC8, mpc8);
REGISTER_ENCDEC (NELLYMOSER, nellymoser);
REGISTER_DECODER(ON2AVC, on2avc);
REGISTER_DECODER(OPUS, opus);
REGISTER_DECODER(PAF_AUDIO, paf_audio);
REGISTER_DECODER(QCELP, qcelp);
REGISTER_DECODER(QDM2, qdm2);
REGISTER_ENCDEC (RA_144, ra_144);
REGISTER_DECODER(RA_288, ra_288);
REGISTER_DECODER(RALF, ralf);
REGISTER_DECODER(SHORTEN, shorten);
REGISTER_DECODER(SIPR, sipr);
REGISTER_DECODER(SMACKAUD, smackaud);
REGISTER_ENCDEC (SONIC, sonic);
REGISTER_ENCODER(SONIC_LS, sonic_ls);
REGISTER_DECODER(TAK, tak);
REGISTER_DECODER(TRUEHD, truehd);
REGISTER_DECODER(TRUESPEECH, truespeech);
REGISTER_ENCDEC (TTA, tta);
REGISTER_DECODER(TWINVQ, twinvq);
REGISTER_DECODER(VMDAUDIO, vmdaudio);
REGISTER_ENCDEC (VORBIS, vorbis);
REGISTER_ENCDEC (WAVPACK, wavpack);
REGISTER_DECODER(WMALOSSLESS, wmalossless);
REGISTER_DECODER(WMAPRO, wmapro);
REGISTER_ENCDEC (WMAV1, wmav1);
REGISTER_ENCDEC (WMAV2, wmav2);
REGISTER_DECODER(WMAVOICE, wmavoice);
REGISTER_DECODER(WS_SND1, ws_snd1);
REGISTER_DECODER(XMA1, xma1);
REGISTER_DECODER(XMA2, xma2);
/* PCM codecs */
REGISTER_ENCDEC (PCM_ALAW, pcm_alaw);
REGISTER_DECODER(PCM_BLURAY, pcm_bluray);
REGISTER_DECODER(PCM_DVD, pcm_dvd);
REGISTER_ENCDEC (PCM_F32BE, pcm_f32be);
REGISTER_ENCDEC (PCM_F32LE, pcm_f32le);
REGISTER_ENCDEC (PCM_F64BE, pcm_f64be);
REGISTER_ENCDEC (PCM_F64LE, pcm_f64le);
REGISTER_DECODER(PCM_LXF, pcm_lxf);
REGISTER_ENCDEC (PCM_MULAW, pcm_mulaw);
REGISTER_ENCDEC (PCM_S8, pcm_s8);
REGISTER_ENCDEC (PCM_S8_PLANAR, pcm_s8_planar);
REGISTER_ENCDEC (PCM_S16BE, pcm_s16be);
REGISTER_ENCDEC (PCM_S16BE_PLANAR, pcm_s16be_planar);
REGISTER_ENCDEC (PCM_S16LE, pcm_s16le);
REGISTER_ENCDEC (PCM_S16LE_PLANAR, pcm_s16le_planar);
REGISTER_ENCDEC (PCM_S24BE, pcm_s24be);
REGISTER_ENCDEC (PCM_S24DAUD, pcm_s24daud);
REGISTER_ENCDEC (PCM_S24LE, pcm_s24le);
REGISTER_ENCDEC (PCM_S24LE_PLANAR, pcm_s24le_planar);
REGISTER_ENCDEC (PCM_S32BE, pcm_s32be);
REGISTER_ENCDEC (PCM_S32LE, pcm_s32le);
REGISTER_ENCDEC (PCM_S32LE_PLANAR, pcm_s32le_planar);
REGISTER_ENCDEC (PCM_S64BE, pcm_s64be);
REGISTER_ENCDEC (PCM_S64LE, pcm_s64le);
REGISTER_ENCDEC (PCM_U8, pcm_u8);
REGISTER_ENCDEC (PCM_U16BE, pcm_u16be);
REGISTER_ENCDEC (PCM_U16LE, pcm_u16le);
REGISTER_ENCDEC (PCM_U24BE, pcm_u24be);
REGISTER_ENCDEC (PCM_U24LE, pcm_u24le);
REGISTER_ENCDEC (PCM_U32BE, pcm_u32be);
REGISTER_ENCDEC (PCM_U32LE, pcm_u32le);
REGISTER_DECODER(PCM_ZORK, pcm_zork);
/* DPCM codecs */
REGISTER_DECODER(INTERPLAY_DPCM, interplay_dpcm);
REGISTER_ENCDEC (ROQ_DPCM, roq_dpcm);
REGISTER_DECODER(SOL_DPCM, sol_dpcm);
REGISTER_DECODER(XAN_DPCM, xan_dpcm);
/* ADPCM codecs */
REGISTER_DECODER(ADPCM_4XM, adpcm_4xm);
REGISTER_ENCDEC (ADPCM_ADX, adpcm_adx);
REGISTER_DECODER(ADPCM_AFC, adpcm_afc);
REGISTER_DECODER(ADPCM_AICA, adpcm_aica);
REGISTER_DECODER(ADPCM_CT, adpcm_ct);
REGISTER_DECODER(ADPCM_DTK, adpcm_dtk);
REGISTER_DECODER(ADPCM_EA, adpcm_ea);
REGISTER_DECODER(ADPCM_EA_MAXIS_XA, adpcm_ea_maxis_xa);
REGISTER_DECODER(ADPCM_EA_R1, adpcm_ea_r1);
REGISTER_DECODER(ADPCM_EA_R2, adpcm_ea_r2);
REGISTER_DECODER(ADPCM_EA_R3, adpcm_ea_r3);
REGISTER_DECODER(ADPCM_EA_XAS, adpcm_ea_xas);
REGISTER_ENCDEC (ADPCM_G722, adpcm_g722);
REGISTER_ENCDEC (ADPCM_G726, adpcm_g726);
REGISTER_DECODER(ADPCM_G726LE, adpcm_g726le);
REGISTER_DECODER(ADPCM_IMA_AMV, adpcm_ima_amv);
REGISTER_DECODER(ADPCM_IMA_APC, adpcm_ima_apc);
REGISTER_DECODER(ADPCM_IMA_DAT4, adpcm_ima_dat4);
REGISTER_DECODER(ADPCM_IMA_DK3, adpcm_ima_dk3);
REGISTER_DECODER(ADPCM_IMA_DK4, adpcm_ima_dk4);
REGISTER_DECODER(ADPCM_IMA_EA_EACS, adpcm_ima_ea_eacs);
REGISTER_DECODER(ADPCM_IMA_EA_SEAD, adpcm_ima_ea_sead);
REGISTER_DECODER(ADPCM_IMA_ISS, adpcm_ima_iss);
REGISTER_DECODER(ADPCM_IMA_OKI, adpcm_ima_oki);
REGISTER_ENCDEC (ADPCM_IMA_QT, adpcm_ima_qt);
REGISTER_DECODER(ADPCM_IMA_RAD, adpcm_ima_rad);
REGISTER_DECODER(ADPCM_IMA_SMJPEG, adpcm_ima_smjpeg);
REGISTER_ENCDEC (ADPCM_IMA_WAV, adpcm_ima_wav);
REGISTER_DECODER(ADPCM_IMA_WS, adpcm_ima_ws);
REGISTER_ENCDEC (ADPCM_MS, adpcm_ms);
REGISTER_DECODER(ADPCM_MTAF, adpcm_mtaf);
REGISTER_DECODER(ADPCM_PSX, adpcm_psx);
REGISTER_DECODER(ADPCM_SBPRO_2, adpcm_sbpro_2);
REGISTER_DECODER(ADPCM_SBPRO_3, adpcm_sbpro_3);
REGISTER_DECODER(ADPCM_SBPRO_4, adpcm_sbpro_4);
REGISTER_ENCDEC (ADPCM_SWF, adpcm_swf);
REGISTER_DECODER(ADPCM_THP, adpcm_thp);
REGISTER_DECODER(ADPCM_THP_LE, adpcm_thp_le);
REGISTER_DECODER(ADPCM_VIMA, adpcm_vima);
REGISTER_DECODER(ADPCM_XA, adpcm_xa);
REGISTER_ENCDEC (ADPCM_YAMAHA, adpcm_yamaha);
/* subtitles */
REGISTER_ENCDEC (SSA, ssa);
REGISTER_ENCDEC (ASS, ass);
REGISTER_DECODER(CCAPTION, ccaption);
REGISTER_ENCDEC (DVBSUB, dvbsub);
REGISTER_ENCDEC (DVDSUB, dvdsub);
REGISTER_DECODER(JACOSUB, jacosub);
REGISTER_DECODER(MICRODVD, microdvd);
REGISTER_ENCDEC (MOVTEXT, movtext);
REGISTER_DECODER(MPL2, mpl2);
REGISTER_DECODER(PGSSUB, pgssub);
REGISTER_DECODER(PJS, pjs);
REGISTER_DECODER(REALTEXT, realtext);
REGISTER_DECODER(SAMI, sami);
REGISTER_ENCDEC (SRT, srt);
REGISTER_DECODER(STL, stl);
REGISTER_ENCDEC (SUBRIP, subrip);
REGISTER_DECODER(SUBVIEWER, subviewer);
REGISTER_DECODER(SUBVIEWER1, subviewer1);
REGISTER_ENCDEC (TEXT, text);
REGISTER_DECODER(VPLAYER, vplayer);
REGISTER_ENCDEC (WEBVTT, webvtt);
REGISTER_ENCDEC (XSUB, xsub);
/* external libraries */
REGISTER_ENCDEC (AAC_AT, aac_at);
REGISTER_DECODER(AC3_AT, ac3_at);
REGISTER_DECODER(ADPCM_IMA_QT_AT, adpcm_ima_qt_at);
REGISTER_ENCDEC (ALAC_AT, alac_at);
REGISTER_DECODER(AMR_NB_AT, amr_nb_at);
REGISTER_DECODER(EAC3_AT, eac3_at);
REGISTER_DECODER(GSM_MS_AT, gsm_ms_at);
REGISTER_ENCDEC (ILBC_AT, ilbc_at);
REGISTER_DECODER(MP1_AT, mp1_at);
REGISTER_DECODER(MP2_AT, mp2_at);
REGISTER_DECODER(MP3_AT, mp3_at);
REGISTER_ENCDEC (PCM_ALAW_AT, pcm_alaw_at);
REGISTER_ENCDEC (PCM_MULAW_AT, pcm_mulaw_at);
REGISTER_DECODER(QDMC_AT, qdmc_at);
REGISTER_DECODER(QDM2_AT, qdm2_at);
REGISTER_DECODER(LIBCELT, libcelt);
REGISTER_ENCODER(LIBFAAC, libfaac);
REGISTER_ENCDEC (LIBFDK_AAC, libfdk_aac);
REGISTER_ENCDEC (LIBGSM, libgsm);
REGISTER_ENCDEC (LIBGSM_MS, libgsm_ms);
REGISTER_ENCDEC (LIBILBC, libilbc);
REGISTER_ENCODER(LIBMP3LAME, libmp3lame);
REGISTER_ENCDEC (LIBOPENCORE_AMRNB, libopencore_amrnb);
REGISTER_DECODER(LIBOPENCORE_AMRWB, libopencore_amrwb);
REGISTER_ENCDEC (LIBOPENJPEG, libopenjpeg);
REGISTER_ENCDEC (LIBOPUS, libopus);
REGISTER_ENCDEC (LIBSCHROEDINGER, libschroedinger);
REGISTER_ENCODER(LIBSHINE, libshine);
REGISTER_ENCDEC (LIBSPEEX, libspeex);
REGISTER_ENCODER(LIBTHEORA, libtheora);
REGISTER_ENCODER(LIBTWOLAME, libtwolame);
REGISTER_ENCODER(LIBVO_AMRWBENC, libvo_amrwbenc);
REGISTER_ENCDEC (LIBVORBIS, libvorbis);
REGISTER_ENCDEC (LIBVPX_VP8, libvpx_vp8);
REGISTER_ENCDEC (LIBVPX_VP9, libvpx_vp9);
REGISTER_ENCODER(LIBWAVPACK, libwavpack);
REGISTER_ENCODER(LIBWEBP_ANIM, libwebp_anim); /* preferred over libwebp */
REGISTER_ENCODER(LIBWEBP, libwebp);
REGISTER_ENCODER(LIBX262, libx262);
REGISTER_ENCODER(LIBX264, libx264);
REGISTER_ENCODER(LIBX264RGB, libx264rgb);
REGISTER_ENCODER(LIBX265, libx265);
REGISTER_ENCODER(LIBXAVS, libxavs);
REGISTER_ENCODER(LIBXVID, libxvid);
REGISTER_DECODER(LIBZVBI_TELETEXT, libzvbi_teletext);
/* text */
REGISTER_DECODER(BINTEXT, bintext);
REGISTER_DECODER(XBIN, xbin);
REGISTER_DECODER(IDF, idf);
/* external libraries, that shouldn't be used by default if one of the
* above is available */
REGISTER_ENCDEC (LIBOPENH264, libopenh264);
REGISTER_DECODER(H263_CUVID, h263_cuvid);
REGISTER_DECODER(H264_CUVID, h264_cuvid);
REGISTER_ENCODER(H264_NVENC, h264_nvenc);
REGISTER_ENCODER(H264_OMX, h264_omx);
REGISTER_ENCODER(H264_QSV, h264_qsv);
REGISTER_ENCODER(H264_VAAPI, h264_vaapi);
REGISTER_ENCODER(H264_VIDEOTOOLBOX, h264_videotoolbox);
#if FF_API_NVENC_OLD_NAME
REGISTER_ENCODER(NVENC, nvenc);
REGISTER_ENCODER(NVENC_H264, nvenc_h264);
REGISTER_ENCODER(NVENC_HEVC, nvenc_hevc);
#endif
REGISTER_DECODER(HEVC_CUVID, hevc_cuvid);
REGISTER_ENCODER(HEVC_NVENC, hevc_nvenc);
REGISTER_ENCODER(HEVC_QSV, hevc_qsv);
REGISTER_ENCODER(HEVC_VAAPI, hevc_vaapi);
REGISTER_ENCODER(LIBKVAZAAR, libkvazaar);
REGISTER_DECODER(MJPEG_CUVID, mjpeg_cuvid);
REGISTER_ENCODER(MJPEG_VAAPI, mjpeg_vaapi);
REGISTER_DECODER(MPEG1_CUVID, mpeg1_cuvid);
REGISTER_DECODER(MPEG2_CUVID, mpeg2_cuvid);
REGISTER_ENCODER(MPEG2_QSV, mpeg2_qsv);
REGISTER_DECODER(MPEG4_CUVID, mpeg4_cuvid);
REGISTER_DECODER(VC1_CUVID, vc1_cuvid);
REGISTER_DECODER(VP8_CUVID, vp8_cuvid);
REGISTER_DECODER(VP9_CUVID, vp9_cuvid);
/* parsers */
REGISTER_PARSER(AAC, aac);
REGISTER_PARSER(AAC_LATM, aac_latm);
REGISTER_PARSER(AC3, ac3);
REGISTER_PARSER(ADX, adx);
REGISTER_PARSER(BMP, bmp);
REGISTER_PARSER(CAVSVIDEO, cavsvideo);
REGISTER_PARSER(COOK, cook);
REGISTER_PARSER(DCA, dca);
REGISTER_PARSER(DIRAC, dirac);
REGISTER_PARSER(DNXHD, dnxhd);
REGISTER_PARSER(DPX, dpx);
REGISTER_PARSER(DVAUDIO, dvaudio);
REGISTER_PARSER(DVBSUB, dvbsub);
REGISTER_PARSER(DVDSUB, dvdsub);
REGISTER_PARSER(DVD_NAV, dvd_nav);
REGISTER_PARSER(FLAC, flac);
REGISTER_PARSER(G729, g729);
REGISTER_PARSER(GSM, gsm);
REGISTER_PARSER(H261, h261);
REGISTER_PARSER(H263, h263);
REGISTER_PARSER(H264, h264);
REGISTER_PARSER(HEVC, hevc);
REGISTER_PARSER(MJPEG, mjpeg);
REGISTER_PARSER(MLP, mlp);
REGISTER_PARSER(MPEG4VIDEO, mpeg4video);
REGISTER_PARSER(MPEGAUDIO, mpegaudio);
REGISTER_PARSER(MPEGVIDEO, mpegvideo);
REGISTER_PARSER(OPUS, opus);
REGISTER_PARSER(PNG, png);
REGISTER_PARSER(PNM, pnm);
REGISTER_PARSER(RV30, rv30);
REGISTER_PARSER(RV40, rv40);
REGISTER_PARSER(TAK, tak);
REGISTER_PARSER(VC1, vc1);
REGISTER_PARSER(VORBIS, vorbis);
REGISTER_PARSER(VP3, vp3);
REGISTER_PARSER(VP8, vp8);
REGISTER_PARSER(VP9, vp9);
} | true | FFmpeg | 1891dfe0130991ee138d01f2877678de717b9e23 | void avcodec_register_all(void)
{
static int initialized;
if (initialized)
return;
initialized = 1;
REGISTER_HWACCEL(H263_CUVID, h263_cuvid);
REGISTER_HWACCEL(H263_VAAPI, h263_vaapi);
REGISTER_HWACCEL(H263_VIDEOTOOLBOX, h263_videotoolbox);
REGISTER_HWACCEL(H264_CUVID, h264_cuvid);
REGISTER_HWACCEL(H264_D3D11VA, h264_d3d11va);
REGISTER_HWACCEL(H264_DXVA2, h264_dxva2);
REGISTER_HWACCEL(H264_MEDIACODEC, h264_mediacodec);
REGISTER_HWACCEL(H264_MMAL, h264_mmal);
REGISTER_HWACCEL(H264_QSV, h264_qsv);
REGISTER_HWACCEL(H264_VAAPI, h264_vaapi);
REGISTER_HWACCEL(H264_VDA, h264_vda);
REGISTER_HWACCEL(H264_VDA_OLD, h264_vda_old);
REGISTER_HWACCEL(H264_VDPAU, h264_vdpau);
REGISTER_HWACCEL(H264_VIDEOTOOLBOX, h264_videotoolbox);
REGISTER_HWACCEL(HEVC_CUVID, hevc_cuvid);
REGISTER_HWACCEL(HEVC_D3D11VA, hevc_d3d11va);
REGISTER_HWACCEL(HEVC_DXVA2, hevc_dxva2);
REGISTER_HWACCEL(HEVC_QSV, hevc_qsv);
REGISTER_HWACCEL(HEVC_VAAPI, hevc_vaapi);
REGISTER_HWACCEL(HEVC_VDPAU, hevc_vdpau);
REGISTER_HWACCEL(MPEG1_XVMC, mpeg1_xvmc);
REGISTER_HWACCEL(MPEG1_VDPAU, mpeg1_vdpau);
REGISTER_HWACCEL(MPEG1_VIDEOTOOLBOX, mpeg1_videotoolbox);
REGISTER_HWACCEL(MPEG2_XVMC, mpeg2_xvmc);
REGISTER_HWACCEL(MPEG2_D3D11VA, mpeg2_d3d11va);
REGISTER_HWACCEL(MPEG2_DXVA2, mpeg2_dxva2);
REGISTER_HWACCEL(MPEG2_MMAL, mpeg2_mmal);
REGISTER_HWACCEL(MPEG2_QSV, mpeg2_qsv);
REGISTER_HWACCEL(MPEG2_VAAPI, mpeg2_vaapi);
REGISTER_HWACCEL(MPEG2_VDPAU, mpeg2_vdpau);
REGISTER_HWACCEL(MPEG2_VIDEOTOOLBOX, mpeg2_videotoolbox);
REGISTER_HWACCEL(MPEG4_CUVID, mpeg4_cuvid);
REGISTER_HWACCEL(MPEG4_MMAL, mpeg4_mmal);
REGISTER_HWACCEL(MPEG4_VAAPI, mpeg4_vaapi);
REGISTER_HWACCEL(MPEG4_VDPAU, mpeg4_vdpau);
REGISTER_HWACCEL(MPEG4_VIDEOTOOLBOX, mpeg4_videotoolbox);
REGISTER_HWACCEL(VC1_CUVID, vc1_cuvid);
REGISTER_HWACCEL(VC1_D3D11VA, vc1_d3d11va);
REGISTER_HWACCEL(VC1_DXVA2, vc1_dxva2);
REGISTER_HWACCEL(VC1_VAAPI, vc1_vaapi);
REGISTER_HWACCEL(VC1_VDPAU, vc1_vdpau);
REGISTER_HWACCEL(VC1_MMAL, vc1_mmal);
REGISTER_HWACCEL(VC1_QSV, vc1_qsv);
REGISTER_HWACCEL(VP8_CUVID, vp8_cuvid);
REGISTER_HWACCEL(VP9_CUVID, vp9_cuvid);
REGISTER_HWACCEL(VP9_D3D11VA, vp9_d3d11va);
REGISTER_HWACCEL(VP9_DXVA2, vp9_dxva2);
REGISTER_HWACCEL(VP9_VAAPI, vp9_vaapi);
REGISTER_HWACCEL(WMV3_D3D11VA, wmv3_d3d11va);
REGISTER_HWACCEL(WMV3_DXVA2, wmv3_dxva2);
REGISTER_HWACCEL(WMV3_VAAPI, wmv3_vaapi);
REGISTER_HWACCEL(WMV3_VDPAU, wmv3_vdpau);
REGISTER_ENCODER(A64MULTI, a64multi);
REGISTER_ENCODER(A64MULTI5, a64multi5);
REGISTER_DECODER(AASC, aasc);
REGISTER_DECODER(AIC, aic);
REGISTER_ENCDEC (ALIAS_PIX, alias_pix);
REGISTER_ENCDEC (AMV, amv);
REGISTER_DECODER(ANM, anm);
REGISTER_DECODER(ANSI, ansi);
REGISTER_ENCDEC (APNG, apng);
REGISTER_ENCDEC (ASV1, asv1);
REGISTER_ENCDEC (ASV2, asv2);
REGISTER_DECODER(AURA, aura);
REGISTER_DECODER(AURA2, aura2);
REGISTER_ENCDEC (AVRP, avrp);
REGISTER_DECODER(AVRN, avrn);
REGISTER_DECODER(AVS, avs);
REGISTER_ENCDEC (AVUI, avui);
REGISTER_ENCDEC (AYUV, ayuv);
REGISTER_DECODER(BETHSOFTVID, bethsoftvid);
REGISTER_DECODER(BFI, bfi);
REGISTER_DECODER(BINK, bink);
REGISTER_ENCDEC (BMP, bmp);
REGISTER_DECODER(BMV_VIDEO, bmv_video);
REGISTER_DECODER(BRENDER_PIX, brender_pix);
REGISTER_DECODER(C93, c93);
REGISTER_DECODER(CAVS, cavs);
REGISTER_DECODER(CDGRAPHICS, cdgraphics);
REGISTER_DECODER(CDXL, cdxl);
REGISTER_DECODER(CFHD, cfhd);
REGISTER_ENCDEC (CINEPAK, cinepak);
REGISTER_ENCDEC (CLJR, cljr);
REGISTER_DECODER(CLLC, cllc);
REGISTER_ENCDEC (COMFORTNOISE, comfortnoise);
REGISTER_DECODER(CPIA, cpia);
REGISTER_DECODER(CSCD, cscd);
REGISTER_DECODER(CYUV, cyuv);
REGISTER_DECODER(DDS, dds);
REGISTER_DECODER(DFA, dfa);
REGISTER_DECODER(DIRAC, dirac);
REGISTER_ENCDEC (DNXHD, dnxhd);
REGISTER_ENCDEC (DPX, dpx);
REGISTER_DECODER(DSICINVIDEO, dsicinvideo);
REGISTER_DECODER(DVAUDIO, dvaudio);
REGISTER_ENCDEC (DVVIDEO, dvvideo);
REGISTER_DECODER(DXA, dxa);
REGISTER_DECODER(DXTORY, dxtory);
REGISTER_DECODER(DXV, dxv);
REGISTER_DECODER(EACMV, eacmv);
REGISTER_DECODER(EAMAD, eamad);
REGISTER_DECODER(EATGQ, eatgq);
REGISTER_DECODER(EATGV, eatgv);
REGISTER_DECODER(EATQI, eatqi);
REGISTER_DECODER(EIGHTBPS, eightbps);
REGISTER_DECODER(EIGHTSVX_EXP, eightsvx_exp);
REGISTER_DECODER(EIGHTSVX_FIB, eightsvx_fib);
REGISTER_DECODER(ESCAPE124, escape124);
REGISTER_DECODER(ESCAPE130, escape130);
REGISTER_DECODER(EXR, exr);
REGISTER_ENCDEC (FFV1, ffv1);
REGISTER_ENCDEC (FFVHUFF, ffvhuff);
REGISTER_DECODER(FIC, fic);
REGISTER_ENCDEC (FLASHSV, flashsv);
REGISTER_ENCDEC (FLASHSV2, flashsv2);
REGISTER_DECODER(FLIC, flic);
REGISTER_ENCDEC (FLV, flv);
REGISTER_DECODER(FOURXM, fourxm);
REGISTER_DECODER(FRAPS, fraps);
REGISTER_DECODER(FRWU, frwu);
REGISTER_DECODER(G2M, g2m);
REGISTER_ENCDEC (GIF, gif);
REGISTER_ENCDEC (H261, h261);
REGISTER_ENCDEC (H263, h263);
REGISTER_DECODER(H263I, h263i);
REGISTER_ENCDEC (H263P, h263p);
REGISTER_DECODER(H264, h264);
REGISTER_DECODER(H264_CRYSTALHD, h264_crystalhd);
REGISTER_DECODER(H264_MEDIACODEC, h264_mediacodec);
REGISTER_DECODER(H264_MMAL, h264_mmal);
REGISTER_DECODER(H264_QSV, h264_qsv);
REGISTER_DECODER(H264_VDA, h264_vda);
#if FF_API_VDPAU
REGISTER_DECODER(H264_VDPAU, h264_vdpau);
#endif
REGISTER_ENCDEC (HAP, hap);
REGISTER_DECODER(HEVC, hevc);
REGISTER_DECODER(HEVC_QSV, hevc_qsv);
REGISTER_DECODER(HNM4_VIDEO, hnm4_video);
REGISTER_DECODER(HQ_HQA, hq_hqa);
REGISTER_DECODER(HQX, hqx);
REGISTER_ENCDEC (HUFFYUV, huffyuv);
REGISTER_DECODER(IDCIN, idcin);
REGISTER_DECODER(IFF_ILBM, iff_ilbm);
REGISTER_DECODER(INDEO2, indeo2);
REGISTER_DECODER(INDEO3, indeo3);
REGISTER_DECODER(INDEO4, indeo4);
REGISTER_DECODER(INDEO5, indeo5);
REGISTER_DECODER(INTERPLAY_VIDEO, interplay_video);
REGISTER_ENCDEC (JPEG2000, jpeg2000);
REGISTER_ENCDEC (JPEGLS, jpegls);
REGISTER_DECODER(JV, jv);
REGISTER_DECODER(KGV1, kgv1);
REGISTER_DECODER(KMVC, kmvc);
REGISTER_DECODER(LAGARITH, lagarith);
REGISTER_ENCODER(LJPEG, ljpeg);
REGISTER_DECODER(LOCO, loco);
REGISTER_DECODER(M101, m101);
REGISTER_DECODER(MAGICYUV, magicyuv);
REGISTER_DECODER(MDEC, mdec);
REGISTER_DECODER(MIMIC, mimic);
REGISTER_ENCDEC (MJPEG, mjpeg);
REGISTER_DECODER(MJPEGB, mjpegb);
REGISTER_DECODER(MMVIDEO, mmvideo);
REGISTER_DECODER(MOTIONPIXELS, motionpixels);
#if FF_API_XVMC
REGISTER_DECODER(MPEG_XVMC, mpeg_xvmc);
#endif
REGISTER_ENCDEC (MPEG1VIDEO, mpeg1video);
REGISTER_ENCDEC (MPEG2VIDEO, mpeg2video);
REGISTER_ENCDEC (MPEG4, mpeg4);
REGISTER_DECODER(MPEG4_CRYSTALHD, mpeg4_crystalhd);
REGISTER_DECODER(MPEG4_MMAL, mpeg4_mmal);
#if FF_API_VDPAU
REGISTER_DECODER(MPEG4_VDPAU, mpeg4_vdpau);
#endif
REGISTER_DECODER(MPEGVIDEO, mpegvideo);
#if FF_API_VDPAU
REGISTER_DECODER(MPEG_VDPAU, mpeg_vdpau);
REGISTER_DECODER(MPEG1_VDPAU, mpeg1_vdpau);
#endif
REGISTER_DECODER(MPEG2_MMAL, mpeg2_mmal);
REGISTER_DECODER(MPEG2_CRYSTALHD, mpeg2_crystalhd);
REGISTER_DECODER(MPEG2_QSV, mpeg2_qsv);
REGISTER_DECODER(MSA1, msa1);
REGISTER_DECODER(MSMPEG4_CRYSTALHD, msmpeg4_crystalhd);
REGISTER_DECODER(MSMPEG4V1, msmpeg4v1);
REGISTER_ENCDEC (MSMPEG4V2, msmpeg4v2);
REGISTER_ENCDEC (MSMPEG4V3, msmpeg4v3);
REGISTER_DECODER(MSRLE, msrle);
REGISTER_DECODER(MSS1, mss1);
REGISTER_DECODER(MSS2, mss2);
REGISTER_ENCDEC (MSVIDEO1, msvideo1);
REGISTER_DECODER(MSZH, mszh);
REGISTER_DECODER(MTS2, mts2);
REGISTER_DECODER(MVC1, mvc1);
REGISTER_DECODER(MVC2, mvc2);
REGISTER_DECODER(MXPEG, mxpeg);
REGISTER_DECODER(NUV, nuv);
REGISTER_DECODER(PAF_VIDEO, paf_video);
REGISTER_ENCDEC (PAM, pam);
REGISTER_ENCDEC (PBM, pbm);
REGISTER_ENCDEC (PCX, pcx);
REGISTER_ENCDEC (PGM, pgm);
REGISTER_ENCDEC (PGMYUV, pgmyuv);
REGISTER_DECODER(PICTOR, pictor);
REGISTER_ENCDEC (PNG, png);
REGISTER_ENCDEC (PPM, ppm);
REGISTER_ENCDEC (PRORES, prores);
REGISTER_ENCODER(PRORES_AW, prores_aw);
REGISTER_ENCODER(PRORES_KS, prores_ks);
REGISTER_DECODER(PRORES_LGPL, prores_lgpl);
REGISTER_DECODER(PTX, ptx);
REGISTER_DECODER(QDRAW, qdraw);
REGISTER_DECODER(QPEG, qpeg);
REGISTER_ENCDEC (QTRLE, qtrle);
REGISTER_ENCDEC (R10K, r10k);
REGISTER_ENCDEC (R210, r210);
REGISTER_ENCDEC (RAWVIDEO, rawvideo);
REGISTER_DECODER(RL2, rl2);
REGISTER_ENCDEC (ROQ, roq);
REGISTER_DECODER(RPZA, rpza);
REGISTER_DECODER(RSCC, rscc);
REGISTER_ENCDEC (RV10, rv10);
REGISTER_ENCDEC (RV20, rv20);
REGISTER_DECODER(RV30, rv30);
REGISTER_DECODER(RV40, rv40);
REGISTER_ENCDEC (S302M, s302m);
REGISTER_DECODER(SANM, sanm);
REGISTER_DECODER(SCREENPRESSO, screenpresso);
REGISTER_DECODER(SDX2_DPCM, sdx2_dpcm);
REGISTER_ENCDEC (SGI, sgi);
REGISTER_DECODER(SGIRLE, sgirle);
REGISTER_DECODER(SHEERVIDEO, sheervideo);
REGISTER_DECODER(SMACKER, smacker);
REGISTER_DECODER(SMC, smc);
REGISTER_DECODER(SMVJPEG, smvjpeg);
REGISTER_ENCDEC (SNOW, snow);
REGISTER_DECODER(SP5X, sp5x);
REGISTER_ENCDEC (SUNRAST, sunrast);
REGISTER_ENCDEC (SVQ1, svq1);
REGISTER_DECODER(SVQ3, svq3);
REGISTER_ENCDEC (TARGA, targa);
REGISTER_DECODER(TARGA_Y216, targa_y216);
REGISTER_DECODER(TDSC, tdsc);
REGISTER_DECODER(THEORA, theora);
REGISTER_DECODER(THP, thp);
REGISTER_DECODER(TIERTEXSEQVIDEO, tiertexseqvideo);
REGISTER_ENCDEC (TIFF, tiff);
REGISTER_DECODER(TMV, tmv);
REGISTER_DECODER(TRUEMOTION1, truemotion1);
REGISTER_DECODER(TRUEMOTION2, truemotion2);
REGISTER_DECODER(TRUEMOTION2RT, truemotion2rt);
REGISTER_DECODER(TSCC, tscc);
REGISTER_DECODER(TSCC2, tscc2);
REGISTER_DECODER(TXD, txd);
REGISTER_DECODER(ULTI, ulti);
REGISTER_ENCDEC (UTVIDEO, utvideo);
REGISTER_ENCDEC (V210, v210);
REGISTER_DECODER(V210X, v210x);
REGISTER_ENCDEC (V308, v308);
REGISTER_ENCDEC (V408, v408);
REGISTER_ENCDEC (V410, v410);
REGISTER_DECODER(VB, vb);
REGISTER_DECODER(VBLE, vble);
REGISTER_DECODER(VC1, vc1);
REGISTER_DECODER(VC1_CRYSTALHD, vc1_crystalhd);
#if FF_API_VDPAU
REGISTER_DECODER(VC1_VDPAU, vc1_vdpau);
#endif
REGISTER_DECODER(VC1IMAGE, vc1image);
REGISTER_DECODER(VC1_MMAL, vc1_mmal);
REGISTER_DECODER(VC1_QSV, vc1_qsv);
REGISTER_ENCODER(VC2, vc2);
REGISTER_DECODER(VCR1, vcr1);
REGISTER_DECODER(VMDVIDEO, vmdvideo);
REGISTER_DECODER(VMNC, vmnc);
REGISTER_DECODER(VP3, vp3);
REGISTER_DECODER(VP5, vp5);
REGISTER_DECODER(VP6, vp6);
REGISTER_DECODER(VP6A, vp6a);
REGISTER_DECODER(VP6F, vp6f);
REGISTER_DECODER(VP7, vp7);
REGISTER_DECODER(VP8, vp8);
REGISTER_DECODER(VP9, vp9);
REGISTER_DECODER(VQA, vqa);
REGISTER_DECODER(WEBP, webp);
REGISTER_ENCODER(WRAPPED_AVFRAME, wrapped_avframe);
REGISTER_ENCDEC (WMV1, wmv1);
REGISTER_ENCDEC (WMV2, wmv2);
REGISTER_DECODER(WMV3, wmv3);
REGISTER_DECODER(WMV3_CRYSTALHD, wmv3_crystalhd);
#if FF_API_VDPAU
REGISTER_DECODER(WMV3_VDPAU, wmv3_vdpau);
#endif
REGISTER_DECODER(WMV3IMAGE, wmv3image);
REGISTER_DECODER(WNV1, wnv1);
REGISTER_DECODER(XAN_WC3, xan_wc3);
REGISTER_DECODER(XAN_WC4, xan_wc4);
REGISTER_ENCDEC (XBM, xbm);
REGISTER_ENCDEC (XFACE, xface);
REGISTER_DECODER(XL, xl);
REGISTER_ENCDEC (XWD, xwd);
REGISTER_ENCDEC (Y41P, y41p);
REGISTER_DECODER(YLC, ylc);
REGISTER_DECODER(YOP, yop);
REGISTER_ENCDEC (YUV4, yuv4);
REGISTER_DECODER(ZERO12V, zero12v);
REGISTER_DECODER(ZEROCODEC, zerocodec);
REGISTER_ENCDEC (ZLIB, zlib);
REGISTER_ENCDEC (ZMBV, zmbv);
REGISTER_ENCDEC (AAC, aac);
REGISTER_DECODER(AAC_FIXED, aac_fixed);
REGISTER_DECODER(AAC_LATM, aac_latm);
REGISTER_ENCDEC (AC3, ac3);
REGISTER_ENCDEC (AC3_FIXED, ac3_fixed);
REGISTER_ENCDEC (ALAC, alac);
REGISTER_DECODER(ALS, als);
REGISTER_DECODER(AMRNB, amrnb);
REGISTER_DECODER(AMRWB, amrwb);
REGISTER_DECODER(APE, ape);
REGISTER_DECODER(ATRAC1, atrac1);
REGISTER_DECODER(ATRAC3, atrac3);
REGISTER_DECODER(ATRAC3P, atrac3p);
REGISTER_DECODER(BINKAUDIO_DCT, binkaudio_dct);
REGISTER_DECODER(BINKAUDIO_RDFT, binkaudio_rdft);
REGISTER_DECODER(BMV_AUDIO, bmv_audio);
REGISTER_DECODER(COOK, cook);
REGISTER_ENCDEC (DCA, dca);
REGISTER_DECODER(DSD_LSBF, dsd_lsbf);
REGISTER_DECODER(DSD_MSBF, dsd_msbf);
REGISTER_DECODER(DSD_LSBF_PLANAR, dsd_lsbf_planar);
REGISTER_DECODER(DSD_MSBF_PLANAR, dsd_msbf_planar);
REGISTER_DECODER(DSICINAUDIO, dsicinaudio);
REGISTER_DECODER(DSS_SP, dss_sp);
REGISTER_DECODER(DST, dst);
REGISTER_ENCDEC (EAC3, eac3);
REGISTER_DECODER(EVRC, evrc);
REGISTER_DECODER(FFWAVESYNTH, ffwavesynth);
REGISTER_ENCDEC (FLAC, flac);
REGISTER_ENCDEC (G723_1, g723_1);
REGISTER_DECODER(G729, g729);
REGISTER_DECODER(GSM, gsm);
REGISTER_DECODER(GSM_MS, gsm_ms);
REGISTER_DECODER(IAC, iac);
REGISTER_DECODER(IMC, imc);
REGISTER_DECODER(INTERPLAY_ACM, interplay_acm);
REGISTER_DECODER(MACE3, mace3);
REGISTER_DECODER(MACE6, mace6);
REGISTER_DECODER(METASOUND, metasound);
REGISTER_DECODER(MLP, mlp);
REGISTER_DECODER(MP1, mp1);
REGISTER_DECODER(MP1FLOAT, mp1float);
REGISTER_ENCDEC (MP2, mp2);
REGISTER_DECODER(MP2FLOAT, mp2float);
REGISTER_ENCODER(MP2FIXED, mp2fixed);
REGISTER_DECODER(MP3, mp3);
REGISTER_DECODER(MP3FLOAT, mp3float);
REGISTER_DECODER(MP3ADU, mp3adu);
REGISTER_DECODER(MP3ADUFLOAT, mp3adufloat);
REGISTER_DECODER(MP3ON4, mp3on4);
REGISTER_DECODER(MP3ON4FLOAT, mp3on4float);
REGISTER_DECODER(MPC7, mpc7);
REGISTER_DECODER(MPC8, mpc8);
REGISTER_ENCDEC (NELLYMOSER, nellymoser);
REGISTER_DECODER(ON2AVC, on2avc);
REGISTER_DECODER(OPUS, opus);
REGISTER_DECODER(PAF_AUDIO, paf_audio);
REGISTER_DECODER(QCELP, qcelp);
REGISTER_DECODER(QDM2, qdm2);
REGISTER_ENCDEC (RA_144, ra_144);
REGISTER_DECODER(RA_288, ra_288);
REGISTER_DECODER(RALF, ralf);
REGISTER_DECODER(SHORTEN, shorten);
REGISTER_DECODER(SIPR, sipr);
REGISTER_DECODER(SMACKAUD, smackaud);
REGISTER_ENCDEC (SONIC, sonic);
REGISTER_ENCODER(SONIC_LS, sonic_ls);
REGISTER_DECODER(TAK, tak);
REGISTER_DECODER(TRUEHD, truehd);
REGISTER_DECODER(TRUESPEECH, truespeech);
REGISTER_ENCDEC (TTA, tta);
REGISTER_DECODER(TWINVQ, twinvq);
REGISTER_DECODER(VMDAUDIO, vmdaudio);
REGISTER_ENCDEC (VORBIS, vorbis);
REGISTER_ENCDEC (WAVPACK, wavpack);
REGISTER_DECODER(WMALOSSLESS, wmalossless);
REGISTER_DECODER(WMAPRO, wmapro);
REGISTER_ENCDEC (WMAV1, wmav1);
REGISTER_ENCDEC (WMAV2, wmav2);
REGISTER_DECODER(WMAVOICE, wmavoice);
REGISTER_DECODER(WS_SND1, ws_snd1);
REGISTER_DECODER(XMA1, xma1);
REGISTER_DECODER(XMA2, xma2);
REGISTER_ENCDEC (PCM_ALAW, pcm_alaw);
REGISTER_DECODER(PCM_BLURAY, pcm_bluray);
REGISTER_DECODER(PCM_DVD, pcm_dvd);
REGISTER_ENCDEC (PCM_F32BE, pcm_f32be);
REGISTER_ENCDEC (PCM_F32LE, pcm_f32le);
REGISTER_ENCDEC (PCM_F64BE, pcm_f64be);
REGISTER_ENCDEC (PCM_F64LE, pcm_f64le);
REGISTER_DECODER(PCM_LXF, pcm_lxf);
REGISTER_ENCDEC (PCM_MULAW, pcm_mulaw);
REGISTER_ENCDEC (PCM_S8, pcm_s8);
REGISTER_ENCDEC (PCM_S8_PLANAR, pcm_s8_planar);
REGISTER_ENCDEC (PCM_S16BE, pcm_s16be);
REGISTER_ENCDEC (PCM_S16BE_PLANAR, pcm_s16be_planar);
REGISTER_ENCDEC (PCM_S16LE, pcm_s16le);
REGISTER_ENCDEC (PCM_S16LE_PLANAR, pcm_s16le_planar);
REGISTER_ENCDEC (PCM_S24BE, pcm_s24be);
REGISTER_ENCDEC (PCM_S24DAUD, pcm_s24daud);
REGISTER_ENCDEC (PCM_S24LE, pcm_s24le);
REGISTER_ENCDEC (PCM_S24LE_PLANAR, pcm_s24le_planar);
REGISTER_ENCDEC (PCM_S32BE, pcm_s32be);
REGISTER_ENCDEC (PCM_S32LE, pcm_s32le);
REGISTER_ENCDEC (PCM_S32LE_PLANAR, pcm_s32le_planar);
REGISTER_ENCDEC (PCM_S64BE, pcm_s64be);
REGISTER_ENCDEC (PCM_S64LE, pcm_s64le);
REGISTER_ENCDEC (PCM_U8, pcm_u8);
REGISTER_ENCDEC (PCM_U16BE, pcm_u16be);
REGISTER_ENCDEC (PCM_U16LE, pcm_u16le);
REGISTER_ENCDEC (PCM_U24BE, pcm_u24be);
REGISTER_ENCDEC (PCM_U24LE, pcm_u24le);
REGISTER_ENCDEC (PCM_U32BE, pcm_u32be);
REGISTER_ENCDEC (PCM_U32LE, pcm_u32le);
REGISTER_DECODER(PCM_ZORK, pcm_zork);
REGISTER_DECODER(INTERPLAY_DPCM, interplay_dpcm);
REGISTER_ENCDEC (ROQ_DPCM, roq_dpcm);
REGISTER_DECODER(SOL_DPCM, sol_dpcm);
REGISTER_DECODER(XAN_DPCM, xan_dpcm);
REGISTER_DECODER(ADPCM_4XM, adpcm_4xm);
REGISTER_ENCDEC (ADPCM_ADX, adpcm_adx);
REGISTER_DECODER(ADPCM_AFC, adpcm_afc);
REGISTER_DECODER(ADPCM_AICA, adpcm_aica);
REGISTER_DECODER(ADPCM_CT, adpcm_ct);
REGISTER_DECODER(ADPCM_DTK, adpcm_dtk);
REGISTER_DECODER(ADPCM_EA, adpcm_ea);
REGISTER_DECODER(ADPCM_EA_MAXIS_XA, adpcm_ea_maxis_xa);
REGISTER_DECODER(ADPCM_EA_R1, adpcm_ea_r1);
REGISTER_DECODER(ADPCM_EA_R2, adpcm_ea_r2);
REGISTER_DECODER(ADPCM_EA_R3, adpcm_ea_r3);
REGISTER_DECODER(ADPCM_EA_XAS, adpcm_ea_xas);
REGISTER_ENCDEC (ADPCM_G722, adpcm_g722);
REGISTER_ENCDEC (ADPCM_G726, adpcm_g726);
REGISTER_DECODER(ADPCM_G726LE, adpcm_g726le);
REGISTER_DECODER(ADPCM_IMA_AMV, adpcm_ima_amv);
REGISTER_DECODER(ADPCM_IMA_APC, adpcm_ima_apc);
REGISTER_DECODER(ADPCM_IMA_DAT4, adpcm_ima_dat4);
REGISTER_DECODER(ADPCM_IMA_DK3, adpcm_ima_dk3);
REGISTER_DECODER(ADPCM_IMA_DK4, adpcm_ima_dk4);
REGISTER_DECODER(ADPCM_IMA_EA_EACS, adpcm_ima_ea_eacs);
REGISTER_DECODER(ADPCM_IMA_EA_SEAD, adpcm_ima_ea_sead);
REGISTER_DECODER(ADPCM_IMA_ISS, adpcm_ima_iss);
REGISTER_DECODER(ADPCM_IMA_OKI, adpcm_ima_oki);
REGISTER_ENCDEC (ADPCM_IMA_QT, adpcm_ima_qt);
REGISTER_DECODER(ADPCM_IMA_RAD, adpcm_ima_rad);
REGISTER_DECODER(ADPCM_IMA_SMJPEG, adpcm_ima_smjpeg);
REGISTER_ENCDEC (ADPCM_IMA_WAV, adpcm_ima_wav);
REGISTER_DECODER(ADPCM_IMA_WS, adpcm_ima_ws);
REGISTER_ENCDEC (ADPCM_MS, adpcm_ms);
REGISTER_DECODER(ADPCM_MTAF, adpcm_mtaf);
REGISTER_DECODER(ADPCM_PSX, adpcm_psx);
REGISTER_DECODER(ADPCM_SBPRO_2, adpcm_sbpro_2);
REGISTER_DECODER(ADPCM_SBPRO_3, adpcm_sbpro_3);
REGISTER_DECODER(ADPCM_SBPRO_4, adpcm_sbpro_4);
REGISTER_ENCDEC (ADPCM_SWF, adpcm_swf);
REGISTER_DECODER(ADPCM_THP, adpcm_thp);
REGISTER_DECODER(ADPCM_THP_LE, adpcm_thp_le);
REGISTER_DECODER(ADPCM_VIMA, adpcm_vima);
REGISTER_DECODER(ADPCM_XA, adpcm_xa);
REGISTER_ENCDEC (ADPCM_YAMAHA, adpcm_yamaha);
REGISTER_ENCDEC (SSA, ssa);
REGISTER_ENCDEC (ASS, ass);
REGISTER_DECODER(CCAPTION, ccaption);
REGISTER_ENCDEC (DVBSUB, dvbsub);
REGISTER_ENCDEC (DVDSUB, dvdsub);
REGISTER_DECODER(JACOSUB, jacosub);
REGISTER_DECODER(MICRODVD, microdvd);
REGISTER_ENCDEC (MOVTEXT, movtext);
REGISTER_DECODER(MPL2, mpl2);
REGISTER_DECODER(PGSSUB, pgssub);
REGISTER_DECODER(PJS, pjs);
REGISTER_DECODER(REALTEXT, realtext);
REGISTER_DECODER(SAMI, sami);
REGISTER_ENCDEC (SRT, srt);
REGISTER_DECODER(STL, stl);
REGISTER_ENCDEC (SUBRIP, subrip);
REGISTER_DECODER(SUBVIEWER, subviewer);
REGISTER_DECODER(SUBVIEWER1, subviewer1);
REGISTER_ENCDEC (TEXT, text);
REGISTER_DECODER(VPLAYER, vplayer);
REGISTER_ENCDEC (WEBVTT, webvtt);
REGISTER_ENCDEC (XSUB, xsub);
REGISTER_ENCDEC (AAC_AT, aac_at);
REGISTER_DECODER(AC3_AT, ac3_at);
REGISTER_DECODER(ADPCM_IMA_QT_AT, adpcm_ima_qt_at);
REGISTER_ENCDEC (ALAC_AT, alac_at);
REGISTER_DECODER(AMR_NB_AT, amr_nb_at);
REGISTER_DECODER(EAC3_AT, eac3_at);
REGISTER_DECODER(GSM_MS_AT, gsm_ms_at);
REGISTER_ENCDEC (ILBC_AT, ilbc_at);
REGISTER_DECODER(MP1_AT, mp1_at);
REGISTER_DECODER(MP2_AT, mp2_at);
REGISTER_DECODER(MP3_AT, mp3_at);
REGISTER_ENCDEC (PCM_ALAW_AT, pcm_alaw_at);
REGISTER_ENCDEC (PCM_MULAW_AT, pcm_mulaw_at);
REGISTER_DECODER(QDMC_AT, qdmc_at);
REGISTER_DECODER(QDM2_AT, qdm2_at);
REGISTER_DECODER(LIBCELT, libcelt);
REGISTER_ENCODER(LIBFAAC, libfaac);
REGISTER_ENCDEC (LIBFDK_AAC, libfdk_aac);
REGISTER_ENCDEC (LIBGSM, libgsm);
REGISTER_ENCDEC (LIBGSM_MS, libgsm_ms);
REGISTER_ENCDEC (LIBILBC, libilbc);
REGISTER_ENCODER(LIBMP3LAME, libmp3lame);
REGISTER_ENCDEC (LIBOPENCORE_AMRNB, libopencore_amrnb);
REGISTER_DECODER(LIBOPENCORE_AMRWB, libopencore_amrwb);
REGISTER_ENCDEC (LIBOPENJPEG, libopenjpeg);
REGISTER_ENCDEC (LIBOPUS, libopus);
REGISTER_ENCDEC (LIBSCHROEDINGER, libschroedinger);
REGISTER_ENCODER(LIBSHINE, libshine);
REGISTER_ENCDEC (LIBSPEEX, libspeex);
REGISTER_ENCODER(LIBTHEORA, libtheora);
REGISTER_ENCODER(LIBTWOLAME, libtwolame);
REGISTER_ENCODER(LIBVO_AMRWBENC, libvo_amrwbenc);
REGISTER_ENCDEC (LIBVORBIS, libvorbis);
REGISTER_ENCDEC (LIBVPX_VP8, libvpx_vp8);
REGISTER_ENCDEC (LIBVPX_VP9, libvpx_vp9);
REGISTER_ENCODER(LIBWAVPACK, libwavpack);
REGISTER_ENCODER(LIBWEBP_ANIM, libwebp_anim);
REGISTER_ENCODER(LIBWEBP, libwebp);
REGISTER_ENCODER(LIBX262, libx262);
REGISTER_ENCODER(LIBX264, libx264);
REGISTER_ENCODER(LIBX264RGB, libx264rgb);
REGISTER_ENCODER(LIBX265, libx265);
REGISTER_ENCODER(LIBXAVS, libxavs);
REGISTER_ENCODER(LIBXVID, libxvid);
REGISTER_DECODER(LIBZVBI_TELETEXT, libzvbi_teletext);
REGISTER_DECODER(BINTEXT, bintext);
REGISTER_DECODER(XBIN, xbin);
REGISTER_DECODER(IDF, idf);
REGISTER_ENCDEC (LIBOPENH264, libopenh264);
REGISTER_DECODER(H263_CUVID, h263_cuvid);
REGISTER_DECODER(H264_CUVID, h264_cuvid);
REGISTER_ENCODER(H264_NVENC, h264_nvenc);
REGISTER_ENCODER(H264_OMX, h264_omx);
REGISTER_ENCODER(H264_QSV, h264_qsv);
REGISTER_ENCODER(H264_VAAPI, h264_vaapi);
REGISTER_ENCODER(H264_VIDEOTOOLBOX, h264_videotoolbox);
#if FF_API_NVENC_OLD_NAME
REGISTER_ENCODER(NVENC, nvenc);
REGISTER_ENCODER(NVENC_H264, nvenc_h264);
REGISTER_ENCODER(NVENC_HEVC, nvenc_hevc);
#endif
REGISTER_DECODER(HEVC_CUVID, hevc_cuvid);
REGISTER_ENCODER(HEVC_NVENC, hevc_nvenc);
REGISTER_ENCODER(HEVC_QSV, hevc_qsv);
REGISTER_ENCODER(HEVC_VAAPI, hevc_vaapi);
REGISTER_ENCODER(LIBKVAZAAR, libkvazaar);
REGISTER_DECODER(MJPEG_CUVID, mjpeg_cuvid);
REGISTER_ENCODER(MJPEG_VAAPI, mjpeg_vaapi);
REGISTER_DECODER(MPEG1_CUVID, mpeg1_cuvid);
REGISTER_DECODER(MPEG2_CUVID, mpeg2_cuvid);
REGISTER_ENCODER(MPEG2_QSV, mpeg2_qsv);
REGISTER_DECODER(MPEG4_CUVID, mpeg4_cuvid);
REGISTER_DECODER(VC1_CUVID, vc1_cuvid);
REGISTER_DECODER(VP8_CUVID, vp8_cuvid);
REGISTER_DECODER(VP9_CUVID, vp9_cuvid);
REGISTER_PARSER(AAC, aac);
REGISTER_PARSER(AAC_LATM, aac_latm);
REGISTER_PARSER(AC3, ac3);
REGISTER_PARSER(ADX, adx);
REGISTER_PARSER(BMP, bmp);
REGISTER_PARSER(CAVSVIDEO, cavsvideo);
REGISTER_PARSER(COOK, cook);
REGISTER_PARSER(DCA, dca);
REGISTER_PARSER(DIRAC, dirac);
REGISTER_PARSER(DNXHD, dnxhd);
REGISTER_PARSER(DPX, dpx);
REGISTER_PARSER(DVAUDIO, dvaudio);
REGISTER_PARSER(DVBSUB, dvbsub);
REGISTER_PARSER(DVDSUB, dvdsub);
REGISTER_PARSER(DVD_NAV, dvd_nav);
REGISTER_PARSER(FLAC, flac);
REGISTER_PARSER(G729, g729);
REGISTER_PARSER(GSM, gsm);
REGISTER_PARSER(H261, h261);
REGISTER_PARSER(H263, h263);
REGISTER_PARSER(H264, h264);
REGISTER_PARSER(HEVC, hevc);
REGISTER_PARSER(MJPEG, mjpeg);
REGISTER_PARSER(MLP, mlp);
REGISTER_PARSER(MPEG4VIDEO, mpeg4video);
REGISTER_PARSER(MPEGAUDIO, mpegaudio);
REGISTER_PARSER(MPEGVIDEO, mpegvideo);
REGISTER_PARSER(OPUS, opus);
REGISTER_PARSER(PNG, png);
REGISTER_PARSER(PNM, pnm);
REGISTER_PARSER(RV30, rv30);
REGISTER_PARSER(RV40, rv40);
REGISTER_PARSER(TAK, tak);
REGISTER_PARSER(VC1, vc1);
REGISTER_PARSER(VORBIS, vorbis);
REGISTER_PARSER(VP3, vp3);
REGISTER_PARSER(VP8, vp8);
REGISTER_PARSER(VP9, vp9);
} | {
"code": [],
"line_no": []
} | void FUNC_0(void)
{
static int VAR_0;
if (VAR_0)
return;
VAR_0 = 1;
REGISTER_HWACCEL(H263_CUVID, h263_cuvid);
REGISTER_HWACCEL(H263_VAAPI, h263_vaapi);
REGISTER_HWACCEL(H263_VIDEOTOOLBOX, h263_videotoolbox);
REGISTER_HWACCEL(H264_CUVID, h264_cuvid);
REGISTER_HWACCEL(H264_D3D11VA, h264_d3d11va);
REGISTER_HWACCEL(H264_DXVA2, h264_dxva2);
REGISTER_HWACCEL(H264_MEDIACODEC, h264_mediacodec);
REGISTER_HWACCEL(H264_MMAL, h264_mmal);
REGISTER_HWACCEL(H264_QSV, h264_qsv);
REGISTER_HWACCEL(H264_VAAPI, h264_vaapi);
REGISTER_HWACCEL(H264_VDA, h264_vda);
REGISTER_HWACCEL(H264_VDA_OLD, h264_vda_old);
REGISTER_HWACCEL(H264_VDPAU, h264_vdpau);
REGISTER_HWACCEL(H264_VIDEOTOOLBOX, h264_videotoolbox);
REGISTER_HWACCEL(HEVC_CUVID, hevc_cuvid);
REGISTER_HWACCEL(HEVC_D3D11VA, hevc_d3d11va);
REGISTER_HWACCEL(HEVC_DXVA2, hevc_dxva2);
REGISTER_HWACCEL(HEVC_QSV, hevc_qsv);
REGISTER_HWACCEL(HEVC_VAAPI, hevc_vaapi);
REGISTER_HWACCEL(HEVC_VDPAU, hevc_vdpau);
REGISTER_HWACCEL(MPEG1_XVMC, mpeg1_xvmc);
REGISTER_HWACCEL(MPEG1_VDPAU, mpeg1_vdpau);
REGISTER_HWACCEL(MPEG1_VIDEOTOOLBOX, mpeg1_videotoolbox);
REGISTER_HWACCEL(MPEG2_XVMC, mpeg2_xvmc);
REGISTER_HWACCEL(MPEG2_D3D11VA, mpeg2_d3d11va);
REGISTER_HWACCEL(MPEG2_DXVA2, mpeg2_dxva2);
REGISTER_HWACCEL(MPEG2_MMAL, mpeg2_mmal);
REGISTER_HWACCEL(MPEG2_QSV, mpeg2_qsv);
REGISTER_HWACCEL(MPEG2_VAAPI, mpeg2_vaapi);
REGISTER_HWACCEL(MPEG2_VDPAU, mpeg2_vdpau);
REGISTER_HWACCEL(MPEG2_VIDEOTOOLBOX, mpeg2_videotoolbox);
REGISTER_HWACCEL(MPEG4_CUVID, mpeg4_cuvid);
REGISTER_HWACCEL(MPEG4_MMAL, mpeg4_mmal);
REGISTER_HWACCEL(MPEG4_VAAPI, mpeg4_vaapi);
REGISTER_HWACCEL(MPEG4_VDPAU, mpeg4_vdpau);
REGISTER_HWACCEL(MPEG4_VIDEOTOOLBOX, mpeg4_videotoolbox);
REGISTER_HWACCEL(VC1_CUVID, vc1_cuvid);
REGISTER_HWACCEL(VC1_D3D11VA, vc1_d3d11va);
REGISTER_HWACCEL(VC1_DXVA2, vc1_dxva2);
REGISTER_HWACCEL(VC1_VAAPI, vc1_vaapi);
REGISTER_HWACCEL(VC1_VDPAU, vc1_vdpau);
REGISTER_HWACCEL(VC1_MMAL, vc1_mmal);
REGISTER_HWACCEL(VC1_QSV, vc1_qsv);
REGISTER_HWACCEL(VP8_CUVID, vp8_cuvid);
REGISTER_HWACCEL(VP9_CUVID, vp9_cuvid);
REGISTER_HWACCEL(VP9_D3D11VA, vp9_d3d11va);
REGISTER_HWACCEL(VP9_DXVA2, vp9_dxva2);
REGISTER_HWACCEL(VP9_VAAPI, vp9_vaapi);
REGISTER_HWACCEL(WMV3_D3D11VA, wmv3_d3d11va);
REGISTER_HWACCEL(WMV3_DXVA2, wmv3_dxva2);
REGISTER_HWACCEL(WMV3_VAAPI, wmv3_vaapi);
REGISTER_HWACCEL(WMV3_VDPAU, wmv3_vdpau);
REGISTER_ENCODER(A64MULTI, a64multi);
REGISTER_ENCODER(A64MULTI5, a64multi5);
REGISTER_DECODER(AASC, aasc);
REGISTER_DECODER(AIC, aic);
REGISTER_ENCDEC (ALIAS_PIX, alias_pix);
REGISTER_ENCDEC (AMV, amv);
REGISTER_DECODER(ANM, anm);
REGISTER_DECODER(ANSI, ansi);
REGISTER_ENCDEC (APNG, apng);
REGISTER_ENCDEC (ASV1, asv1);
REGISTER_ENCDEC (ASV2, asv2);
REGISTER_DECODER(AURA, aura);
REGISTER_DECODER(AURA2, aura2);
REGISTER_ENCDEC (AVRP, avrp);
REGISTER_DECODER(AVRN, avrn);
REGISTER_DECODER(AVS, avs);
REGISTER_ENCDEC (AVUI, avui);
REGISTER_ENCDEC (AYUV, ayuv);
REGISTER_DECODER(BETHSOFTVID, bethsoftvid);
REGISTER_DECODER(BFI, bfi);
REGISTER_DECODER(BINK, bink);
REGISTER_ENCDEC (BMP, bmp);
REGISTER_DECODER(BMV_VIDEO, bmv_video);
REGISTER_DECODER(BRENDER_PIX, brender_pix);
REGISTER_DECODER(C93, c93);
REGISTER_DECODER(CAVS, cavs);
REGISTER_DECODER(CDGRAPHICS, cdgraphics);
REGISTER_DECODER(CDXL, cdxl);
REGISTER_DECODER(CFHD, cfhd);
REGISTER_ENCDEC (CINEPAK, cinepak);
REGISTER_ENCDEC (CLJR, cljr);
REGISTER_DECODER(CLLC, cllc);
REGISTER_ENCDEC (COMFORTNOISE, comfortnoise);
REGISTER_DECODER(CPIA, cpia);
REGISTER_DECODER(CSCD, cscd);
REGISTER_DECODER(CYUV, cyuv);
REGISTER_DECODER(DDS, dds);
REGISTER_DECODER(DFA, dfa);
REGISTER_DECODER(DIRAC, dirac);
REGISTER_ENCDEC (DNXHD, dnxhd);
REGISTER_ENCDEC (DPX, dpx);
REGISTER_DECODER(DSICINVIDEO, dsicinvideo);
REGISTER_DECODER(DVAUDIO, dvaudio);
REGISTER_ENCDEC (DVVIDEO, dvvideo);
REGISTER_DECODER(DXA, dxa);
REGISTER_DECODER(DXTORY, dxtory);
REGISTER_DECODER(DXV, dxv);
REGISTER_DECODER(EACMV, eacmv);
REGISTER_DECODER(EAMAD, eamad);
REGISTER_DECODER(EATGQ, eatgq);
REGISTER_DECODER(EATGV, eatgv);
REGISTER_DECODER(EATQI, eatqi);
REGISTER_DECODER(EIGHTBPS, eightbps);
REGISTER_DECODER(EIGHTSVX_EXP, eightsvx_exp);
REGISTER_DECODER(EIGHTSVX_FIB, eightsvx_fib);
REGISTER_DECODER(ESCAPE124, escape124);
REGISTER_DECODER(ESCAPE130, escape130);
REGISTER_DECODER(EXR, exr);
REGISTER_ENCDEC (FFV1, ffv1);
REGISTER_ENCDEC (FFVHUFF, ffvhuff);
REGISTER_DECODER(FIC, fic);
REGISTER_ENCDEC (FLASHSV, flashsv);
REGISTER_ENCDEC (FLASHSV2, flashsv2);
REGISTER_DECODER(FLIC, flic);
REGISTER_ENCDEC (FLV, flv);
REGISTER_DECODER(FOURXM, fourxm);
REGISTER_DECODER(FRAPS, fraps);
REGISTER_DECODER(FRWU, frwu);
REGISTER_DECODER(G2M, g2m);
REGISTER_ENCDEC (GIF, gif);
REGISTER_ENCDEC (H261, h261);
REGISTER_ENCDEC (H263, h263);
REGISTER_DECODER(H263I, h263i);
REGISTER_ENCDEC (H263P, h263p);
REGISTER_DECODER(H264, h264);
REGISTER_DECODER(H264_CRYSTALHD, h264_crystalhd);
REGISTER_DECODER(H264_MEDIACODEC, h264_mediacodec);
REGISTER_DECODER(H264_MMAL, h264_mmal);
REGISTER_DECODER(H264_QSV, h264_qsv);
REGISTER_DECODER(H264_VDA, h264_vda);
#if FF_API_VDPAU
REGISTER_DECODER(H264_VDPAU, h264_vdpau);
#endif
REGISTER_ENCDEC (HAP, hap);
REGISTER_DECODER(HEVC, hevc);
REGISTER_DECODER(HEVC_QSV, hevc_qsv);
REGISTER_DECODER(HNM4_VIDEO, hnm4_video);
REGISTER_DECODER(HQ_HQA, hq_hqa);
REGISTER_DECODER(HQX, hqx);
REGISTER_ENCDEC (HUFFYUV, huffyuv);
REGISTER_DECODER(IDCIN, idcin);
REGISTER_DECODER(IFF_ILBM, iff_ilbm);
REGISTER_DECODER(INDEO2, indeo2);
REGISTER_DECODER(INDEO3, indeo3);
REGISTER_DECODER(INDEO4, indeo4);
REGISTER_DECODER(INDEO5, indeo5);
REGISTER_DECODER(INTERPLAY_VIDEO, interplay_video);
REGISTER_ENCDEC (JPEG2000, jpeg2000);
REGISTER_ENCDEC (JPEGLS, jpegls);
REGISTER_DECODER(JV, jv);
REGISTER_DECODER(KGV1, kgv1);
REGISTER_DECODER(KMVC, kmvc);
REGISTER_DECODER(LAGARITH, lagarith);
REGISTER_ENCODER(LJPEG, ljpeg);
REGISTER_DECODER(LOCO, loco);
REGISTER_DECODER(M101, m101);
REGISTER_DECODER(MAGICYUV, magicyuv);
REGISTER_DECODER(MDEC, mdec);
REGISTER_DECODER(MIMIC, mimic);
REGISTER_ENCDEC (MJPEG, mjpeg);
REGISTER_DECODER(MJPEGB, mjpegb);
REGISTER_DECODER(MMVIDEO, mmvideo);
REGISTER_DECODER(MOTIONPIXELS, motionpixels);
#if FF_API_XVMC
REGISTER_DECODER(MPEG_XVMC, mpeg_xvmc);
#endif
REGISTER_ENCDEC (MPEG1VIDEO, mpeg1video);
REGISTER_ENCDEC (MPEG2VIDEO, mpeg2video);
REGISTER_ENCDEC (MPEG4, mpeg4);
REGISTER_DECODER(MPEG4_CRYSTALHD, mpeg4_crystalhd);
REGISTER_DECODER(MPEG4_MMAL, mpeg4_mmal);
#if FF_API_VDPAU
REGISTER_DECODER(MPEG4_VDPAU, mpeg4_vdpau);
#endif
REGISTER_DECODER(MPEGVIDEO, mpegvideo);
#if FF_API_VDPAU
REGISTER_DECODER(MPEG_VDPAU, mpeg_vdpau);
REGISTER_DECODER(MPEG1_VDPAU, mpeg1_vdpau);
#endif
REGISTER_DECODER(MPEG2_MMAL, mpeg2_mmal);
REGISTER_DECODER(MPEG2_CRYSTALHD, mpeg2_crystalhd);
REGISTER_DECODER(MPEG2_QSV, mpeg2_qsv);
REGISTER_DECODER(MSA1, msa1);
REGISTER_DECODER(MSMPEG4_CRYSTALHD, msmpeg4_crystalhd);
REGISTER_DECODER(MSMPEG4V1, msmpeg4v1);
REGISTER_ENCDEC (MSMPEG4V2, msmpeg4v2);
REGISTER_ENCDEC (MSMPEG4V3, msmpeg4v3);
REGISTER_DECODER(MSRLE, msrle);
REGISTER_DECODER(MSS1, mss1);
REGISTER_DECODER(MSS2, mss2);
REGISTER_ENCDEC (MSVIDEO1, msvideo1);
REGISTER_DECODER(MSZH, mszh);
REGISTER_DECODER(MTS2, mts2);
REGISTER_DECODER(MVC1, mvc1);
REGISTER_DECODER(MVC2, mvc2);
REGISTER_DECODER(MXPEG, mxpeg);
REGISTER_DECODER(NUV, nuv);
REGISTER_DECODER(PAF_VIDEO, paf_video);
REGISTER_ENCDEC (PAM, pam);
REGISTER_ENCDEC (PBM, pbm);
REGISTER_ENCDEC (PCX, pcx);
REGISTER_ENCDEC (PGM, pgm);
REGISTER_ENCDEC (PGMYUV, pgmyuv);
REGISTER_DECODER(PICTOR, pictor);
REGISTER_ENCDEC (PNG, png);
REGISTER_ENCDEC (PPM, ppm);
REGISTER_ENCDEC (PRORES, prores);
REGISTER_ENCODER(PRORES_AW, prores_aw);
REGISTER_ENCODER(PRORES_KS, prores_ks);
REGISTER_DECODER(PRORES_LGPL, prores_lgpl);
REGISTER_DECODER(PTX, ptx);
REGISTER_DECODER(QDRAW, qdraw);
REGISTER_DECODER(QPEG, qpeg);
REGISTER_ENCDEC (QTRLE, qtrle);
REGISTER_ENCDEC (R10K, r10k);
REGISTER_ENCDEC (R210, r210);
REGISTER_ENCDEC (RAWVIDEO, rawvideo);
REGISTER_DECODER(RL2, rl2);
REGISTER_ENCDEC (ROQ, roq);
REGISTER_DECODER(RPZA, rpza);
REGISTER_DECODER(RSCC, rscc);
REGISTER_ENCDEC (RV10, rv10);
REGISTER_ENCDEC (RV20, rv20);
REGISTER_DECODER(RV30, rv30);
REGISTER_DECODER(RV40, rv40);
REGISTER_ENCDEC (S302M, s302m);
REGISTER_DECODER(SANM, sanm);
REGISTER_DECODER(SCREENPRESSO, screenpresso);
REGISTER_DECODER(SDX2_DPCM, sdx2_dpcm);
REGISTER_ENCDEC (SGI, sgi);
REGISTER_DECODER(SGIRLE, sgirle);
REGISTER_DECODER(SHEERVIDEO, sheervideo);
REGISTER_DECODER(SMACKER, smacker);
REGISTER_DECODER(SMC, smc);
REGISTER_DECODER(SMVJPEG, smvjpeg);
REGISTER_ENCDEC (SNOW, snow);
REGISTER_DECODER(SP5X, sp5x);
REGISTER_ENCDEC (SUNRAST, sunrast);
REGISTER_ENCDEC (SVQ1, svq1);
REGISTER_DECODER(SVQ3, svq3);
REGISTER_ENCDEC (TARGA, targa);
REGISTER_DECODER(TARGA_Y216, targa_y216);
REGISTER_DECODER(TDSC, tdsc);
REGISTER_DECODER(THEORA, theora);
REGISTER_DECODER(THP, thp);
REGISTER_DECODER(TIERTEXSEQVIDEO, tiertexseqvideo);
REGISTER_ENCDEC (TIFF, tiff);
REGISTER_DECODER(TMV, tmv);
REGISTER_DECODER(TRUEMOTION1, truemotion1);
REGISTER_DECODER(TRUEMOTION2, truemotion2);
REGISTER_DECODER(TRUEMOTION2RT, truemotion2rt);
REGISTER_DECODER(TSCC, tscc);
REGISTER_DECODER(TSCC2, tscc2);
REGISTER_DECODER(TXD, txd);
REGISTER_DECODER(ULTI, ulti);
REGISTER_ENCDEC (UTVIDEO, utvideo);
REGISTER_ENCDEC (V210, v210);
REGISTER_DECODER(V210X, v210x);
REGISTER_ENCDEC (V308, v308);
REGISTER_ENCDEC (V408, v408);
REGISTER_ENCDEC (V410, v410);
REGISTER_DECODER(VB, vb);
REGISTER_DECODER(VBLE, vble);
REGISTER_DECODER(VC1, vc1);
REGISTER_DECODER(VC1_CRYSTALHD, vc1_crystalhd);
#if FF_API_VDPAU
REGISTER_DECODER(VC1_VDPAU, vc1_vdpau);
#endif
REGISTER_DECODER(VC1IMAGE, vc1image);
REGISTER_DECODER(VC1_MMAL, vc1_mmal);
REGISTER_DECODER(VC1_QSV, vc1_qsv);
REGISTER_ENCODER(VC2, vc2);
REGISTER_DECODER(VCR1, vcr1);
REGISTER_DECODER(VMDVIDEO, vmdvideo);
REGISTER_DECODER(VMNC, vmnc);
REGISTER_DECODER(VP3, vp3);
REGISTER_DECODER(VP5, vp5);
REGISTER_DECODER(VP6, vp6);
REGISTER_DECODER(VP6A, vp6a);
REGISTER_DECODER(VP6F, vp6f);
REGISTER_DECODER(VP7, vp7);
REGISTER_DECODER(VP8, vp8);
REGISTER_DECODER(VP9, vp9);
REGISTER_DECODER(VQA, vqa);
REGISTER_DECODER(WEBP, webp);
REGISTER_ENCODER(WRAPPED_AVFRAME, wrapped_avframe);
REGISTER_ENCDEC (WMV1, wmv1);
REGISTER_ENCDEC (WMV2, wmv2);
REGISTER_DECODER(WMV3, wmv3);
REGISTER_DECODER(WMV3_CRYSTALHD, wmv3_crystalhd);
#if FF_API_VDPAU
REGISTER_DECODER(WMV3_VDPAU, wmv3_vdpau);
#endif
REGISTER_DECODER(WMV3IMAGE, wmv3image);
REGISTER_DECODER(WNV1, wnv1);
REGISTER_DECODER(XAN_WC3, xan_wc3);
REGISTER_DECODER(XAN_WC4, xan_wc4);
REGISTER_ENCDEC (XBM, xbm);
REGISTER_ENCDEC (XFACE, xface);
REGISTER_DECODER(XL, xl);
REGISTER_ENCDEC (XWD, xwd);
REGISTER_ENCDEC (Y41P, y41p);
REGISTER_DECODER(YLC, ylc);
REGISTER_DECODER(YOP, yop);
REGISTER_ENCDEC (YUV4, yuv4);
REGISTER_DECODER(ZERO12V, zero12v);
REGISTER_DECODER(ZEROCODEC, zerocodec);
REGISTER_ENCDEC (ZLIB, zlib);
REGISTER_ENCDEC (ZMBV, zmbv);
REGISTER_ENCDEC (AAC, aac);
REGISTER_DECODER(AAC_FIXED, aac_fixed);
REGISTER_DECODER(AAC_LATM, aac_latm);
REGISTER_ENCDEC (AC3, ac3);
REGISTER_ENCDEC (AC3_FIXED, ac3_fixed);
REGISTER_ENCDEC (ALAC, alac);
REGISTER_DECODER(ALS, als);
REGISTER_DECODER(AMRNB, amrnb);
REGISTER_DECODER(AMRWB, amrwb);
REGISTER_DECODER(APE, ape);
REGISTER_DECODER(ATRAC1, atrac1);
REGISTER_DECODER(ATRAC3, atrac3);
REGISTER_DECODER(ATRAC3P, atrac3p);
REGISTER_DECODER(BINKAUDIO_DCT, binkaudio_dct);
REGISTER_DECODER(BINKAUDIO_RDFT, binkaudio_rdft);
REGISTER_DECODER(BMV_AUDIO, bmv_audio);
REGISTER_DECODER(COOK, cook);
REGISTER_ENCDEC (DCA, dca);
REGISTER_DECODER(DSD_LSBF, dsd_lsbf);
REGISTER_DECODER(DSD_MSBF, dsd_msbf);
REGISTER_DECODER(DSD_LSBF_PLANAR, dsd_lsbf_planar);
REGISTER_DECODER(DSD_MSBF_PLANAR, dsd_msbf_planar);
REGISTER_DECODER(DSICINAUDIO, dsicinaudio);
REGISTER_DECODER(DSS_SP, dss_sp);
REGISTER_DECODER(DST, dst);
REGISTER_ENCDEC (EAC3, eac3);
REGISTER_DECODER(EVRC, evrc);
REGISTER_DECODER(FFWAVESYNTH, ffwavesynth);
REGISTER_ENCDEC (FLAC, flac);
REGISTER_ENCDEC (G723_1, g723_1);
REGISTER_DECODER(G729, g729);
REGISTER_DECODER(GSM, gsm);
REGISTER_DECODER(GSM_MS, gsm_ms);
REGISTER_DECODER(IAC, iac);
REGISTER_DECODER(IMC, imc);
REGISTER_DECODER(INTERPLAY_ACM, interplay_acm);
REGISTER_DECODER(MACE3, mace3);
REGISTER_DECODER(MACE6, mace6);
REGISTER_DECODER(METASOUND, metasound);
REGISTER_DECODER(MLP, mlp);
REGISTER_DECODER(MP1, mp1);
REGISTER_DECODER(MP1FLOAT, mp1float);
REGISTER_ENCDEC (MP2, mp2);
REGISTER_DECODER(MP2FLOAT, mp2float);
REGISTER_ENCODER(MP2FIXED, mp2fixed);
REGISTER_DECODER(MP3, mp3);
REGISTER_DECODER(MP3FLOAT, mp3float);
REGISTER_DECODER(MP3ADU, mp3adu);
REGISTER_DECODER(MP3ADUFLOAT, mp3adufloat);
REGISTER_DECODER(MP3ON4, mp3on4);
REGISTER_DECODER(MP3ON4FLOAT, mp3on4float);
REGISTER_DECODER(MPC7, mpc7);
REGISTER_DECODER(MPC8, mpc8);
REGISTER_ENCDEC (NELLYMOSER, nellymoser);
REGISTER_DECODER(ON2AVC, on2avc);
REGISTER_DECODER(OPUS, opus);
REGISTER_DECODER(PAF_AUDIO, paf_audio);
REGISTER_DECODER(QCELP, qcelp);
REGISTER_DECODER(QDM2, qdm2);
REGISTER_ENCDEC (RA_144, ra_144);
REGISTER_DECODER(RA_288, ra_288);
REGISTER_DECODER(RALF, ralf);
REGISTER_DECODER(SHORTEN, shorten);
REGISTER_DECODER(SIPR, sipr);
REGISTER_DECODER(SMACKAUD, smackaud);
REGISTER_ENCDEC (SONIC, sonic);
REGISTER_ENCODER(SONIC_LS, sonic_ls);
REGISTER_DECODER(TAK, tak);
REGISTER_DECODER(TRUEHD, truehd);
REGISTER_DECODER(TRUESPEECH, truespeech);
REGISTER_ENCDEC (TTA, tta);
REGISTER_DECODER(TWINVQ, twinvq);
REGISTER_DECODER(VMDAUDIO, vmdaudio);
REGISTER_ENCDEC (VORBIS, vorbis);
REGISTER_ENCDEC (WAVPACK, wavpack);
REGISTER_DECODER(WMALOSSLESS, wmalossless);
REGISTER_DECODER(WMAPRO, wmapro);
REGISTER_ENCDEC (WMAV1, wmav1);
REGISTER_ENCDEC (WMAV2, wmav2);
REGISTER_DECODER(WMAVOICE, wmavoice);
REGISTER_DECODER(WS_SND1, ws_snd1);
REGISTER_DECODER(XMA1, xma1);
REGISTER_DECODER(XMA2, xma2);
REGISTER_ENCDEC (PCM_ALAW, pcm_alaw);
REGISTER_DECODER(PCM_BLURAY, pcm_bluray);
REGISTER_DECODER(PCM_DVD, pcm_dvd);
REGISTER_ENCDEC (PCM_F32BE, pcm_f32be);
REGISTER_ENCDEC (PCM_F32LE, pcm_f32le);
REGISTER_ENCDEC (PCM_F64BE, pcm_f64be);
REGISTER_ENCDEC (PCM_F64LE, pcm_f64le);
REGISTER_DECODER(PCM_LXF, pcm_lxf);
REGISTER_ENCDEC (PCM_MULAW, pcm_mulaw);
REGISTER_ENCDEC (PCM_S8, pcm_s8);
REGISTER_ENCDEC (PCM_S8_PLANAR, pcm_s8_planar);
REGISTER_ENCDEC (PCM_S16BE, pcm_s16be);
REGISTER_ENCDEC (PCM_S16BE_PLANAR, pcm_s16be_planar);
REGISTER_ENCDEC (PCM_S16LE, pcm_s16le);
REGISTER_ENCDEC (PCM_S16LE_PLANAR, pcm_s16le_planar);
REGISTER_ENCDEC (PCM_S24BE, pcm_s24be);
REGISTER_ENCDEC (PCM_S24DAUD, pcm_s24daud);
REGISTER_ENCDEC (PCM_S24LE, pcm_s24le);
REGISTER_ENCDEC (PCM_S24LE_PLANAR, pcm_s24le_planar);
REGISTER_ENCDEC (PCM_S32BE, pcm_s32be);
REGISTER_ENCDEC (PCM_S32LE, pcm_s32le);
REGISTER_ENCDEC (PCM_S32LE_PLANAR, pcm_s32le_planar);
REGISTER_ENCDEC (PCM_S64BE, pcm_s64be);
REGISTER_ENCDEC (PCM_S64LE, pcm_s64le);
REGISTER_ENCDEC (PCM_U8, pcm_u8);
REGISTER_ENCDEC (PCM_U16BE, pcm_u16be);
REGISTER_ENCDEC (PCM_U16LE, pcm_u16le);
REGISTER_ENCDEC (PCM_U24BE, pcm_u24be);
REGISTER_ENCDEC (PCM_U24LE, pcm_u24le);
REGISTER_ENCDEC (PCM_U32BE, pcm_u32be);
REGISTER_ENCDEC (PCM_U32LE, pcm_u32le);
REGISTER_DECODER(PCM_ZORK, pcm_zork);
REGISTER_DECODER(INTERPLAY_DPCM, interplay_dpcm);
REGISTER_ENCDEC (ROQ_DPCM, roq_dpcm);
REGISTER_DECODER(SOL_DPCM, sol_dpcm);
REGISTER_DECODER(XAN_DPCM, xan_dpcm);
REGISTER_DECODER(ADPCM_4XM, adpcm_4xm);
REGISTER_ENCDEC (ADPCM_ADX, adpcm_adx);
REGISTER_DECODER(ADPCM_AFC, adpcm_afc);
REGISTER_DECODER(ADPCM_AICA, adpcm_aica);
REGISTER_DECODER(ADPCM_CT, adpcm_ct);
REGISTER_DECODER(ADPCM_DTK, adpcm_dtk);
REGISTER_DECODER(ADPCM_EA, adpcm_ea);
REGISTER_DECODER(ADPCM_EA_MAXIS_XA, adpcm_ea_maxis_xa);
REGISTER_DECODER(ADPCM_EA_R1, adpcm_ea_r1);
REGISTER_DECODER(ADPCM_EA_R2, adpcm_ea_r2);
REGISTER_DECODER(ADPCM_EA_R3, adpcm_ea_r3);
REGISTER_DECODER(ADPCM_EA_XAS, adpcm_ea_xas);
REGISTER_ENCDEC (ADPCM_G722, adpcm_g722);
REGISTER_ENCDEC (ADPCM_G726, adpcm_g726);
REGISTER_DECODER(ADPCM_G726LE, adpcm_g726le);
REGISTER_DECODER(ADPCM_IMA_AMV, adpcm_ima_amv);
REGISTER_DECODER(ADPCM_IMA_APC, adpcm_ima_apc);
REGISTER_DECODER(ADPCM_IMA_DAT4, adpcm_ima_dat4);
REGISTER_DECODER(ADPCM_IMA_DK3, adpcm_ima_dk3);
REGISTER_DECODER(ADPCM_IMA_DK4, adpcm_ima_dk4);
REGISTER_DECODER(ADPCM_IMA_EA_EACS, adpcm_ima_ea_eacs);
REGISTER_DECODER(ADPCM_IMA_EA_SEAD, adpcm_ima_ea_sead);
REGISTER_DECODER(ADPCM_IMA_ISS, adpcm_ima_iss);
REGISTER_DECODER(ADPCM_IMA_OKI, adpcm_ima_oki);
REGISTER_ENCDEC (ADPCM_IMA_QT, adpcm_ima_qt);
REGISTER_DECODER(ADPCM_IMA_RAD, adpcm_ima_rad);
REGISTER_DECODER(ADPCM_IMA_SMJPEG, adpcm_ima_smjpeg);
REGISTER_ENCDEC (ADPCM_IMA_WAV, adpcm_ima_wav);
REGISTER_DECODER(ADPCM_IMA_WS, adpcm_ima_ws);
REGISTER_ENCDEC (ADPCM_MS, adpcm_ms);
REGISTER_DECODER(ADPCM_MTAF, adpcm_mtaf);
REGISTER_DECODER(ADPCM_PSX, adpcm_psx);
REGISTER_DECODER(ADPCM_SBPRO_2, adpcm_sbpro_2);
REGISTER_DECODER(ADPCM_SBPRO_3, adpcm_sbpro_3);
REGISTER_DECODER(ADPCM_SBPRO_4, adpcm_sbpro_4);
REGISTER_ENCDEC (ADPCM_SWF, adpcm_swf);
REGISTER_DECODER(ADPCM_THP, adpcm_thp);
REGISTER_DECODER(ADPCM_THP_LE, adpcm_thp_le);
REGISTER_DECODER(ADPCM_VIMA, adpcm_vima);
REGISTER_DECODER(ADPCM_XA, adpcm_xa);
REGISTER_ENCDEC (ADPCM_YAMAHA, adpcm_yamaha);
REGISTER_ENCDEC (SSA, ssa);
REGISTER_ENCDEC (ASS, ass);
REGISTER_DECODER(CCAPTION, ccaption);
REGISTER_ENCDEC (DVBSUB, dvbsub);
REGISTER_ENCDEC (DVDSUB, dvdsub);
REGISTER_DECODER(JACOSUB, jacosub);
REGISTER_DECODER(MICRODVD, microdvd);
REGISTER_ENCDEC (MOVTEXT, movtext);
REGISTER_DECODER(MPL2, mpl2);
REGISTER_DECODER(PGSSUB, pgssub);
REGISTER_DECODER(PJS, pjs);
REGISTER_DECODER(REALTEXT, realtext);
REGISTER_DECODER(SAMI, sami);
REGISTER_ENCDEC (SRT, srt);
REGISTER_DECODER(STL, stl);
REGISTER_ENCDEC (SUBRIP, subrip);
REGISTER_DECODER(SUBVIEWER, subviewer);
REGISTER_DECODER(SUBVIEWER1, subviewer1);
REGISTER_ENCDEC (TEXT, text);
REGISTER_DECODER(VPLAYER, vplayer);
REGISTER_ENCDEC (WEBVTT, webvtt);
REGISTER_ENCDEC (XSUB, xsub);
REGISTER_ENCDEC (AAC_AT, aac_at);
REGISTER_DECODER(AC3_AT, ac3_at);
REGISTER_DECODER(ADPCM_IMA_QT_AT, adpcm_ima_qt_at);
REGISTER_ENCDEC (ALAC_AT, alac_at);
REGISTER_DECODER(AMR_NB_AT, amr_nb_at);
REGISTER_DECODER(EAC3_AT, eac3_at);
REGISTER_DECODER(GSM_MS_AT, gsm_ms_at);
REGISTER_ENCDEC (ILBC_AT, ilbc_at);
REGISTER_DECODER(MP1_AT, mp1_at);
REGISTER_DECODER(MP2_AT, mp2_at);
REGISTER_DECODER(MP3_AT, mp3_at);
REGISTER_ENCDEC (PCM_ALAW_AT, pcm_alaw_at);
REGISTER_ENCDEC (PCM_MULAW_AT, pcm_mulaw_at);
REGISTER_DECODER(QDMC_AT, qdmc_at);
REGISTER_DECODER(QDM2_AT, qdm2_at);
REGISTER_DECODER(LIBCELT, libcelt);
REGISTER_ENCODER(LIBFAAC, libfaac);
REGISTER_ENCDEC (LIBFDK_AAC, libfdk_aac);
REGISTER_ENCDEC (LIBGSM, libgsm);
REGISTER_ENCDEC (LIBGSM_MS, libgsm_ms);
REGISTER_ENCDEC (LIBILBC, libilbc);
REGISTER_ENCODER(LIBMP3LAME, libmp3lame);
REGISTER_ENCDEC (LIBOPENCORE_AMRNB, libopencore_amrnb);
REGISTER_DECODER(LIBOPENCORE_AMRWB, libopencore_amrwb);
REGISTER_ENCDEC (LIBOPENJPEG, libopenjpeg);
REGISTER_ENCDEC (LIBOPUS, libopus);
REGISTER_ENCDEC (LIBSCHROEDINGER, libschroedinger);
REGISTER_ENCODER(LIBSHINE, libshine);
REGISTER_ENCDEC (LIBSPEEX, libspeex);
REGISTER_ENCODER(LIBTHEORA, libtheora);
REGISTER_ENCODER(LIBTWOLAME, libtwolame);
REGISTER_ENCODER(LIBVO_AMRWBENC, libvo_amrwbenc);
REGISTER_ENCDEC (LIBVORBIS, libvorbis);
REGISTER_ENCDEC (LIBVPX_VP8, libvpx_vp8);
REGISTER_ENCDEC (LIBVPX_VP9, libvpx_vp9);
REGISTER_ENCODER(LIBWAVPACK, libwavpack);
REGISTER_ENCODER(LIBWEBP_ANIM, libwebp_anim);
REGISTER_ENCODER(LIBWEBP, libwebp);
REGISTER_ENCODER(LIBX262, libx262);
REGISTER_ENCODER(LIBX264, libx264);
REGISTER_ENCODER(LIBX264RGB, libx264rgb);
REGISTER_ENCODER(LIBX265, libx265);
REGISTER_ENCODER(LIBXAVS, libxavs);
REGISTER_ENCODER(LIBXVID, libxvid);
REGISTER_DECODER(LIBZVBI_TELETEXT, libzvbi_teletext);
REGISTER_DECODER(BINTEXT, bintext);
REGISTER_DECODER(XBIN, xbin);
REGISTER_DECODER(IDF, idf);
REGISTER_ENCDEC (LIBOPENH264, libopenh264);
REGISTER_DECODER(H263_CUVID, h263_cuvid);
REGISTER_DECODER(H264_CUVID, h264_cuvid);
REGISTER_ENCODER(H264_NVENC, h264_nvenc);
REGISTER_ENCODER(H264_OMX, h264_omx);
REGISTER_ENCODER(H264_QSV, h264_qsv);
REGISTER_ENCODER(H264_VAAPI, h264_vaapi);
REGISTER_ENCODER(H264_VIDEOTOOLBOX, h264_videotoolbox);
#if FF_API_NVENC_OLD_NAME
REGISTER_ENCODER(NVENC, nvenc);
REGISTER_ENCODER(NVENC_H264, nvenc_h264);
REGISTER_ENCODER(NVENC_HEVC, nvenc_hevc);
#endif
REGISTER_DECODER(HEVC_CUVID, hevc_cuvid);
REGISTER_ENCODER(HEVC_NVENC, hevc_nvenc);
REGISTER_ENCODER(HEVC_QSV, hevc_qsv);
REGISTER_ENCODER(HEVC_VAAPI, hevc_vaapi);
REGISTER_ENCODER(LIBKVAZAAR, libkvazaar);
REGISTER_DECODER(MJPEG_CUVID, mjpeg_cuvid);
REGISTER_ENCODER(MJPEG_VAAPI, mjpeg_vaapi);
REGISTER_DECODER(MPEG1_CUVID, mpeg1_cuvid);
REGISTER_DECODER(MPEG2_CUVID, mpeg2_cuvid);
REGISTER_ENCODER(MPEG2_QSV, mpeg2_qsv);
REGISTER_DECODER(MPEG4_CUVID, mpeg4_cuvid);
REGISTER_DECODER(VC1_CUVID, vc1_cuvid);
REGISTER_DECODER(VP8_CUVID, vp8_cuvid);
REGISTER_DECODER(VP9_CUVID, vp9_cuvid);
REGISTER_PARSER(AAC, aac);
REGISTER_PARSER(AAC_LATM, aac_latm);
REGISTER_PARSER(AC3, ac3);
REGISTER_PARSER(ADX, adx);
REGISTER_PARSER(BMP, bmp);
REGISTER_PARSER(CAVSVIDEO, cavsvideo);
REGISTER_PARSER(COOK, cook);
REGISTER_PARSER(DCA, dca);
REGISTER_PARSER(DIRAC, dirac);
REGISTER_PARSER(DNXHD, dnxhd);
REGISTER_PARSER(DPX, dpx);
REGISTER_PARSER(DVAUDIO, dvaudio);
REGISTER_PARSER(DVBSUB, dvbsub);
REGISTER_PARSER(DVDSUB, dvdsub);
REGISTER_PARSER(DVD_NAV, dvd_nav);
REGISTER_PARSER(FLAC, flac);
REGISTER_PARSER(G729, g729);
REGISTER_PARSER(GSM, gsm);
REGISTER_PARSER(H261, h261);
REGISTER_PARSER(H263, h263);
REGISTER_PARSER(H264, h264);
REGISTER_PARSER(HEVC, hevc);
REGISTER_PARSER(MJPEG, mjpeg);
REGISTER_PARSER(MLP, mlp);
REGISTER_PARSER(MPEG4VIDEO, mpeg4video);
REGISTER_PARSER(MPEGAUDIO, mpegaudio);
REGISTER_PARSER(MPEGVIDEO, mpegvideo);
REGISTER_PARSER(OPUS, opus);
REGISTER_PARSER(PNG, png);
REGISTER_PARSER(PNM, pnm);
REGISTER_PARSER(RV30, rv30);
REGISTER_PARSER(RV40, rv40);
REGISTER_PARSER(TAK, tak);
REGISTER_PARSER(VC1, vc1);
REGISTER_PARSER(VORBIS, vorbis);
REGISTER_PARSER(VP3, vp3);
REGISTER_PARSER(VP8, vp8);
REGISTER_PARSER(VP9, vp9);
} | [
"void FUNC_0(void)\n{",
"static int VAR_0;",
"if (VAR_0)\nreturn;",
"VAR_0 = 1;",
"REGISTER_HWACCEL(H263_CUVID, h263_cuvid);",
"REGISTER_HWACCEL(H263_VAAPI, h263_vaapi);",
"REGISTER_HWACCEL(H263_VIDEOTOOLBOX, h263_videotoolbox);",
"REGISTER_HWACCEL(H264_CUVID, h264_cuvid);",
"REGISTER_HWACCEL(H264_D3D11VA, h264_d3d11va);",
"REGISTER_HWACCEL(H264_DXVA2, h264_dxva2);",
"REGISTER_HWACCEL(H264_MEDIACODEC, h264_mediacodec);",
"REGISTER_HWACCEL(H264_MMAL, h264_mmal);",
"REGISTER_HWACCEL(H264_QSV, h264_qsv);",
"REGISTER_HWACCEL(H264_VAAPI, h264_vaapi);",
"REGISTER_HWACCEL(H264_VDA, h264_vda);",
"REGISTER_HWACCEL(H264_VDA_OLD, h264_vda_old);",
"REGISTER_HWACCEL(H264_VDPAU, h264_vdpau);",
"REGISTER_HWACCEL(H264_VIDEOTOOLBOX, h264_videotoolbox);",
"REGISTER_HWACCEL(HEVC_CUVID, hevc_cuvid);",
"REGISTER_HWACCEL(HEVC_D3D11VA, hevc_d3d11va);",
"REGISTER_HWACCEL(HEVC_DXVA2, hevc_dxva2);",
"REGISTER_HWACCEL(HEVC_QSV, hevc_qsv);",
"REGISTER_HWACCEL(HEVC_VAAPI, hevc_vaapi);",
"REGISTER_HWACCEL(HEVC_VDPAU, hevc_vdpau);",
"REGISTER_HWACCEL(MPEG1_XVMC, mpeg1_xvmc);",
"REGISTER_HWACCEL(MPEG1_VDPAU, mpeg1_vdpau);",
"REGISTER_HWACCEL(MPEG1_VIDEOTOOLBOX, mpeg1_videotoolbox);",
"REGISTER_HWACCEL(MPEG2_XVMC, mpeg2_xvmc);",
"REGISTER_HWACCEL(MPEG2_D3D11VA, mpeg2_d3d11va);",
"REGISTER_HWACCEL(MPEG2_DXVA2, mpeg2_dxva2);",
"REGISTER_HWACCEL(MPEG2_MMAL, mpeg2_mmal);",
"REGISTER_HWACCEL(MPEG2_QSV, mpeg2_qsv);",
"REGISTER_HWACCEL(MPEG2_VAAPI, mpeg2_vaapi);",
"REGISTER_HWACCEL(MPEG2_VDPAU, mpeg2_vdpau);",
"REGISTER_HWACCEL(MPEG2_VIDEOTOOLBOX, mpeg2_videotoolbox);",
"REGISTER_HWACCEL(MPEG4_CUVID, mpeg4_cuvid);",
"REGISTER_HWACCEL(MPEG4_MMAL, mpeg4_mmal);",
"REGISTER_HWACCEL(MPEG4_VAAPI, mpeg4_vaapi);",
"REGISTER_HWACCEL(MPEG4_VDPAU, mpeg4_vdpau);",
"REGISTER_HWACCEL(MPEG4_VIDEOTOOLBOX, mpeg4_videotoolbox);",
"REGISTER_HWACCEL(VC1_CUVID, vc1_cuvid);",
"REGISTER_HWACCEL(VC1_D3D11VA, vc1_d3d11va);",
"REGISTER_HWACCEL(VC1_DXVA2, vc1_dxva2);",
"REGISTER_HWACCEL(VC1_VAAPI, vc1_vaapi);",
"REGISTER_HWACCEL(VC1_VDPAU, vc1_vdpau);",
"REGISTER_HWACCEL(VC1_MMAL, vc1_mmal);",
"REGISTER_HWACCEL(VC1_QSV, vc1_qsv);",
"REGISTER_HWACCEL(VP8_CUVID, vp8_cuvid);",
"REGISTER_HWACCEL(VP9_CUVID, vp9_cuvid);",
"REGISTER_HWACCEL(VP9_D3D11VA, vp9_d3d11va);",
"REGISTER_HWACCEL(VP9_DXVA2, vp9_dxva2);",
"REGISTER_HWACCEL(VP9_VAAPI, vp9_vaapi);",
"REGISTER_HWACCEL(WMV3_D3D11VA, wmv3_d3d11va);",
"REGISTER_HWACCEL(WMV3_DXVA2, wmv3_dxva2);",
"REGISTER_HWACCEL(WMV3_VAAPI, wmv3_vaapi);",
"REGISTER_HWACCEL(WMV3_VDPAU, wmv3_vdpau);",
"REGISTER_ENCODER(A64MULTI, a64multi);",
"REGISTER_ENCODER(A64MULTI5, a64multi5);",
"REGISTER_DECODER(AASC, aasc);",
"REGISTER_DECODER(AIC, aic);",
"REGISTER_ENCDEC (ALIAS_PIX, alias_pix);",
"REGISTER_ENCDEC (AMV, amv);",
"REGISTER_DECODER(ANM, anm);",
"REGISTER_DECODER(ANSI, ansi);",
"REGISTER_ENCDEC (APNG, apng);",
"REGISTER_ENCDEC (ASV1, asv1);",
"REGISTER_ENCDEC (ASV2, asv2);",
"REGISTER_DECODER(AURA, aura);",
"REGISTER_DECODER(AURA2, aura2);",
"REGISTER_ENCDEC (AVRP, avrp);",
"REGISTER_DECODER(AVRN, avrn);",
"REGISTER_DECODER(AVS, avs);",
"REGISTER_ENCDEC (AVUI, avui);",
"REGISTER_ENCDEC (AYUV, ayuv);",
"REGISTER_DECODER(BETHSOFTVID, bethsoftvid);",
"REGISTER_DECODER(BFI, bfi);",
"REGISTER_DECODER(BINK, bink);",
"REGISTER_ENCDEC (BMP, bmp);",
"REGISTER_DECODER(BMV_VIDEO, bmv_video);",
"REGISTER_DECODER(BRENDER_PIX, brender_pix);",
"REGISTER_DECODER(C93, c93);",
"REGISTER_DECODER(CAVS, cavs);",
"REGISTER_DECODER(CDGRAPHICS, cdgraphics);",
"REGISTER_DECODER(CDXL, cdxl);",
"REGISTER_DECODER(CFHD, cfhd);",
"REGISTER_ENCDEC (CINEPAK, cinepak);",
"REGISTER_ENCDEC (CLJR, cljr);",
"REGISTER_DECODER(CLLC, cllc);",
"REGISTER_ENCDEC (COMFORTNOISE, comfortnoise);",
"REGISTER_DECODER(CPIA, cpia);",
"REGISTER_DECODER(CSCD, cscd);",
"REGISTER_DECODER(CYUV, cyuv);",
"REGISTER_DECODER(DDS, dds);",
"REGISTER_DECODER(DFA, dfa);",
"REGISTER_DECODER(DIRAC, dirac);",
"REGISTER_ENCDEC (DNXHD, dnxhd);",
"REGISTER_ENCDEC (DPX, dpx);",
"REGISTER_DECODER(DSICINVIDEO, dsicinvideo);",
"REGISTER_DECODER(DVAUDIO, dvaudio);",
"REGISTER_ENCDEC (DVVIDEO, dvvideo);",
"REGISTER_DECODER(DXA, dxa);",
"REGISTER_DECODER(DXTORY, dxtory);",
"REGISTER_DECODER(DXV, dxv);",
"REGISTER_DECODER(EACMV, eacmv);",
"REGISTER_DECODER(EAMAD, eamad);",
"REGISTER_DECODER(EATGQ, eatgq);",
"REGISTER_DECODER(EATGV, eatgv);",
"REGISTER_DECODER(EATQI, eatqi);",
"REGISTER_DECODER(EIGHTBPS, eightbps);",
"REGISTER_DECODER(EIGHTSVX_EXP, eightsvx_exp);",
"REGISTER_DECODER(EIGHTSVX_FIB, eightsvx_fib);",
"REGISTER_DECODER(ESCAPE124, escape124);",
"REGISTER_DECODER(ESCAPE130, escape130);",
"REGISTER_DECODER(EXR, exr);",
"REGISTER_ENCDEC (FFV1, ffv1);",
"REGISTER_ENCDEC (FFVHUFF, ffvhuff);",
"REGISTER_DECODER(FIC, fic);",
"REGISTER_ENCDEC (FLASHSV, flashsv);",
"REGISTER_ENCDEC (FLASHSV2, flashsv2);",
"REGISTER_DECODER(FLIC, flic);",
"REGISTER_ENCDEC (FLV, flv);",
"REGISTER_DECODER(FOURXM, fourxm);",
"REGISTER_DECODER(FRAPS, fraps);",
"REGISTER_DECODER(FRWU, frwu);",
"REGISTER_DECODER(G2M, g2m);",
"REGISTER_ENCDEC (GIF, gif);",
"REGISTER_ENCDEC (H261, h261);",
"REGISTER_ENCDEC (H263, h263);",
"REGISTER_DECODER(H263I, h263i);",
"REGISTER_ENCDEC (H263P, h263p);",
"REGISTER_DECODER(H264, h264);",
"REGISTER_DECODER(H264_CRYSTALHD, h264_crystalhd);",
"REGISTER_DECODER(H264_MEDIACODEC, h264_mediacodec);",
"REGISTER_DECODER(H264_MMAL, h264_mmal);",
"REGISTER_DECODER(H264_QSV, h264_qsv);",
"REGISTER_DECODER(H264_VDA, h264_vda);",
"#if FF_API_VDPAU\nREGISTER_DECODER(H264_VDPAU, h264_vdpau);",
"#endif\nREGISTER_ENCDEC (HAP, hap);",
"REGISTER_DECODER(HEVC, hevc);",
"REGISTER_DECODER(HEVC_QSV, hevc_qsv);",
"REGISTER_DECODER(HNM4_VIDEO, hnm4_video);",
"REGISTER_DECODER(HQ_HQA, hq_hqa);",
"REGISTER_DECODER(HQX, hqx);",
"REGISTER_ENCDEC (HUFFYUV, huffyuv);",
"REGISTER_DECODER(IDCIN, idcin);",
"REGISTER_DECODER(IFF_ILBM, iff_ilbm);",
"REGISTER_DECODER(INDEO2, indeo2);",
"REGISTER_DECODER(INDEO3, indeo3);",
"REGISTER_DECODER(INDEO4, indeo4);",
"REGISTER_DECODER(INDEO5, indeo5);",
"REGISTER_DECODER(INTERPLAY_VIDEO, interplay_video);",
"REGISTER_ENCDEC (JPEG2000, jpeg2000);",
"REGISTER_ENCDEC (JPEGLS, jpegls);",
"REGISTER_DECODER(JV, jv);",
"REGISTER_DECODER(KGV1, kgv1);",
"REGISTER_DECODER(KMVC, kmvc);",
"REGISTER_DECODER(LAGARITH, lagarith);",
"REGISTER_ENCODER(LJPEG, ljpeg);",
"REGISTER_DECODER(LOCO, loco);",
"REGISTER_DECODER(M101, m101);",
"REGISTER_DECODER(MAGICYUV, magicyuv);",
"REGISTER_DECODER(MDEC, mdec);",
"REGISTER_DECODER(MIMIC, mimic);",
"REGISTER_ENCDEC (MJPEG, mjpeg);",
"REGISTER_DECODER(MJPEGB, mjpegb);",
"REGISTER_DECODER(MMVIDEO, mmvideo);",
"REGISTER_DECODER(MOTIONPIXELS, motionpixels);",
"#if FF_API_XVMC\nREGISTER_DECODER(MPEG_XVMC, mpeg_xvmc);",
"#endif\nREGISTER_ENCDEC (MPEG1VIDEO, mpeg1video);",
"REGISTER_ENCDEC (MPEG2VIDEO, mpeg2video);",
"REGISTER_ENCDEC (MPEG4, mpeg4);",
"REGISTER_DECODER(MPEG4_CRYSTALHD, mpeg4_crystalhd);",
"REGISTER_DECODER(MPEG4_MMAL, mpeg4_mmal);",
"#if FF_API_VDPAU\nREGISTER_DECODER(MPEG4_VDPAU, mpeg4_vdpau);",
"#endif\nREGISTER_DECODER(MPEGVIDEO, mpegvideo);",
"#if FF_API_VDPAU\nREGISTER_DECODER(MPEG_VDPAU, mpeg_vdpau);",
"REGISTER_DECODER(MPEG1_VDPAU, mpeg1_vdpau);",
"#endif\nREGISTER_DECODER(MPEG2_MMAL, mpeg2_mmal);",
"REGISTER_DECODER(MPEG2_CRYSTALHD, mpeg2_crystalhd);",
"REGISTER_DECODER(MPEG2_QSV, mpeg2_qsv);",
"REGISTER_DECODER(MSA1, msa1);",
"REGISTER_DECODER(MSMPEG4_CRYSTALHD, msmpeg4_crystalhd);",
"REGISTER_DECODER(MSMPEG4V1, msmpeg4v1);",
"REGISTER_ENCDEC (MSMPEG4V2, msmpeg4v2);",
"REGISTER_ENCDEC (MSMPEG4V3, msmpeg4v3);",
"REGISTER_DECODER(MSRLE, msrle);",
"REGISTER_DECODER(MSS1, mss1);",
"REGISTER_DECODER(MSS2, mss2);",
"REGISTER_ENCDEC (MSVIDEO1, msvideo1);",
"REGISTER_DECODER(MSZH, mszh);",
"REGISTER_DECODER(MTS2, mts2);",
"REGISTER_DECODER(MVC1, mvc1);",
"REGISTER_DECODER(MVC2, mvc2);",
"REGISTER_DECODER(MXPEG, mxpeg);",
"REGISTER_DECODER(NUV, nuv);",
"REGISTER_DECODER(PAF_VIDEO, paf_video);",
"REGISTER_ENCDEC (PAM, pam);",
"REGISTER_ENCDEC (PBM, pbm);",
"REGISTER_ENCDEC (PCX, pcx);",
"REGISTER_ENCDEC (PGM, pgm);",
"REGISTER_ENCDEC (PGMYUV, pgmyuv);",
"REGISTER_DECODER(PICTOR, pictor);",
"REGISTER_ENCDEC (PNG, png);",
"REGISTER_ENCDEC (PPM, ppm);",
"REGISTER_ENCDEC (PRORES, prores);",
"REGISTER_ENCODER(PRORES_AW, prores_aw);",
"REGISTER_ENCODER(PRORES_KS, prores_ks);",
"REGISTER_DECODER(PRORES_LGPL, prores_lgpl);",
"REGISTER_DECODER(PTX, ptx);",
"REGISTER_DECODER(QDRAW, qdraw);",
"REGISTER_DECODER(QPEG, qpeg);",
"REGISTER_ENCDEC (QTRLE, qtrle);",
"REGISTER_ENCDEC (R10K, r10k);",
"REGISTER_ENCDEC (R210, r210);",
"REGISTER_ENCDEC (RAWVIDEO, rawvideo);",
"REGISTER_DECODER(RL2, rl2);",
"REGISTER_ENCDEC (ROQ, roq);",
"REGISTER_DECODER(RPZA, rpza);",
"REGISTER_DECODER(RSCC, rscc);",
"REGISTER_ENCDEC (RV10, rv10);",
"REGISTER_ENCDEC (RV20, rv20);",
"REGISTER_DECODER(RV30, rv30);",
"REGISTER_DECODER(RV40, rv40);",
"REGISTER_ENCDEC (S302M, s302m);",
"REGISTER_DECODER(SANM, sanm);",
"REGISTER_DECODER(SCREENPRESSO, screenpresso);",
"REGISTER_DECODER(SDX2_DPCM, sdx2_dpcm);",
"REGISTER_ENCDEC (SGI, sgi);",
"REGISTER_DECODER(SGIRLE, sgirle);",
"REGISTER_DECODER(SHEERVIDEO, sheervideo);",
"REGISTER_DECODER(SMACKER, smacker);",
"REGISTER_DECODER(SMC, smc);",
"REGISTER_DECODER(SMVJPEG, smvjpeg);",
"REGISTER_ENCDEC (SNOW, snow);",
"REGISTER_DECODER(SP5X, sp5x);",
"REGISTER_ENCDEC (SUNRAST, sunrast);",
"REGISTER_ENCDEC (SVQ1, svq1);",
"REGISTER_DECODER(SVQ3, svq3);",
"REGISTER_ENCDEC (TARGA, targa);",
"REGISTER_DECODER(TARGA_Y216, targa_y216);",
"REGISTER_DECODER(TDSC, tdsc);",
"REGISTER_DECODER(THEORA, theora);",
"REGISTER_DECODER(THP, thp);",
"REGISTER_DECODER(TIERTEXSEQVIDEO, tiertexseqvideo);",
"REGISTER_ENCDEC (TIFF, tiff);",
"REGISTER_DECODER(TMV, tmv);",
"REGISTER_DECODER(TRUEMOTION1, truemotion1);",
"REGISTER_DECODER(TRUEMOTION2, truemotion2);",
"REGISTER_DECODER(TRUEMOTION2RT, truemotion2rt);",
"REGISTER_DECODER(TSCC, tscc);",
"REGISTER_DECODER(TSCC2, tscc2);",
"REGISTER_DECODER(TXD, txd);",
"REGISTER_DECODER(ULTI, ulti);",
"REGISTER_ENCDEC (UTVIDEO, utvideo);",
"REGISTER_ENCDEC (V210, v210);",
"REGISTER_DECODER(V210X, v210x);",
"REGISTER_ENCDEC (V308, v308);",
"REGISTER_ENCDEC (V408, v408);",
"REGISTER_ENCDEC (V410, v410);",
"REGISTER_DECODER(VB, vb);",
"REGISTER_DECODER(VBLE, vble);",
"REGISTER_DECODER(VC1, vc1);",
"REGISTER_DECODER(VC1_CRYSTALHD, vc1_crystalhd);",
"#if FF_API_VDPAU\nREGISTER_DECODER(VC1_VDPAU, vc1_vdpau);",
"#endif\nREGISTER_DECODER(VC1IMAGE, vc1image);",
"REGISTER_DECODER(VC1_MMAL, vc1_mmal);",
"REGISTER_DECODER(VC1_QSV, vc1_qsv);",
"REGISTER_ENCODER(VC2, vc2);",
"REGISTER_DECODER(VCR1, vcr1);",
"REGISTER_DECODER(VMDVIDEO, vmdvideo);",
"REGISTER_DECODER(VMNC, vmnc);",
"REGISTER_DECODER(VP3, vp3);",
"REGISTER_DECODER(VP5, vp5);",
"REGISTER_DECODER(VP6, vp6);",
"REGISTER_DECODER(VP6A, vp6a);",
"REGISTER_DECODER(VP6F, vp6f);",
"REGISTER_DECODER(VP7, vp7);",
"REGISTER_DECODER(VP8, vp8);",
"REGISTER_DECODER(VP9, vp9);",
"REGISTER_DECODER(VQA, vqa);",
"REGISTER_DECODER(WEBP, webp);",
"REGISTER_ENCODER(WRAPPED_AVFRAME, wrapped_avframe);",
"REGISTER_ENCDEC (WMV1, wmv1);",
"REGISTER_ENCDEC (WMV2, wmv2);",
"REGISTER_DECODER(WMV3, wmv3);",
"REGISTER_DECODER(WMV3_CRYSTALHD, wmv3_crystalhd);",
"#if FF_API_VDPAU\nREGISTER_DECODER(WMV3_VDPAU, wmv3_vdpau);",
"#endif\nREGISTER_DECODER(WMV3IMAGE, wmv3image);",
"REGISTER_DECODER(WNV1, wnv1);",
"REGISTER_DECODER(XAN_WC3, xan_wc3);",
"REGISTER_DECODER(XAN_WC4, xan_wc4);",
"REGISTER_ENCDEC (XBM, xbm);",
"REGISTER_ENCDEC (XFACE, xface);",
"REGISTER_DECODER(XL, xl);",
"REGISTER_ENCDEC (XWD, xwd);",
"REGISTER_ENCDEC (Y41P, y41p);",
"REGISTER_DECODER(YLC, ylc);",
"REGISTER_DECODER(YOP, yop);",
"REGISTER_ENCDEC (YUV4, yuv4);",
"REGISTER_DECODER(ZERO12V, zero12v);",
"REGISTER_DECODER(ZEROCODEC, zerocodec);",
"REGISTER_ENCDEC (ZLIB, zlib);",
"REGISTER_ENCDEC (ZMBV, zmbv);",
"REGISTER_ENCDEC (AAC, aac);",
"REGISTER_DECODER(AAC_FIXED, aac_fixed);",
"REGISTER_DECODER(AAC_LATM, aac_latm);",
"REGISTER_ENCDEC (AC3, ac3);",
"REGISTER_ENCDEC (AC3_FIXED, ac3_fixed);",
"REGISTER_ENCDEC (ALAC, alac);",
"REGISTER_DECODER(ALS, als);",
"REGISTER_DECODER(AMRNB, amrnb);",
"REGISTER_DECODER(AMRWB, amrwb);",
"REGISTER_DECODER(APE, ape);",
"REGISTER_DECODER(ATRAC1, atrac1);",
"REGISTER_DECODER(ATRAC3, atrac3);",
"REGISTER_DECODER(ATRAC3P, atrac3p);",
"REGISTER_DECODER(BINKAUDIO_DCT, binkaudio_dct);",
"REGISTER_DECODER(BINKAUDIO_RDFT, binkaudio_rdft);",
"REGISTER_DECODER(BMV_AUDIO, bmv_audio);",
"REGISTER_DECODER(COOK, cook);",
"REGISTER_ENCDEC (DCA, dca);",
"REGISTER_DECODER(DSD_LSBF, dsd_lsbf);",
"REGISTER_DECODER(DSD_MSBF, dsd_msbf);",
"REGISTER_DECODER(DSD_LSBF_PLANAR, dsd_lsbf_planar);",
"REGISTER_DECODER(DSD_MSBF_PLANAR, dsd_msbf_planar);",
"REGISTER_DECODER(DSICINAUDIO, dsicinaudio);",
"REGISTER_DECODER(DSS_SP, dss_sp);",
"REGISTER_DECODER(DST, dst);",
"REGISTER_ENCDEC (EAC3, eac3);",
"REGISTER_DECODER(EVRC, evrc);",
"REGISTER_DECODER(FFWAVESYNTH, ffwavesynth);",
"REGISTER_ENCDEC (FLAC, flac);",
"REGISTER_ENCDEC (G723_1, g723_1);",
"REGISTER_DECODER(G729, g729);",
"REGISTER_DECODER(GSM, gsm);",
"REGISTER_DECODER(GSM_MS, gsm_ms);",
"REGISTER_DECODER(IAC, iac);",
"REGISTER_DECODER(IMC, imc);",
"REGISTER_DECODER(INTERPLAY_ACM, interplay_acm);",
"REGISTER_DECODER(MACE3, mace3);",
"REGISTER_DECODER(MACE6, mace6);",
"REGISTER_DECODER(METASOUND, metasound);",
"REGISTER_DECODER(MLP, mlp);",
"REGISTER_DECODER(MP1, mp1);",
"REGISTER_DECODER(MP1FLOAT, mp1float);",
"REGISTER_ENCDEC (MP2, mp2);",
"REGISTER_DECODER(MP2FLOAT, mp2float);",
"REGISTER_ENCODER(MP2FIXED, mp2fixed);",
"REGISTER_DECODER(MP3, mp3);",
"REGISTER_DECODER(MP3FLOAT, mp3float);",
"REGISTER_DECODER(MP3ADU, mp3adu);",
"REGISTER_DECODER(MP3ADUFLOAT, mp3adufloat);",
"REGISTER_DECODER(MP3ON4, mp3on4);",
"REGISTER_DECODER(MP3ON4FLOAT, mp3on4float);",
"REGISTER_DECODER(MPC7, mpc7);",
"REGISTER_DECODER(MPC8, mpc8);",
"REGISTER_ENCDEC (NELLYMOSER, nellymoser);",
"REGISTER_DECODER(ON2AVC, on2avc);",
"REGISTER_DECODER(OPUS, opus);",
"REGISTER_DECODER(PAF_AUDIO, paf_audio);",
"REGISTER_DECODER(QCELP, qcelp);",
"REGISTER_DECODER(QDM2, qdm2);",
"REGISTER_ENCDEC (RA_144, ra_144);",
"REGISTER_DECODER(RA_288, ra_288);",
"REGISTER_DECODER(RALF, ralf);",
"REGISTER_DECODER(SHORTEN, shorten);",
"REGISTER_DECODER(SIPR, sipr);",
"REGISTER_DECODER(SMACKAUD, smackaud);",
"REGISTER_ENCDEC (SONIC, sonic);",
"REGISTER_ENCODER(SONIC_LS, sonic_ls);",
"REGISTER_DECODER(TAK, tak);",
"REGISTER_DECODER(TRUEHD, truehd);",
"REGISTER_DECODER(TRUESPEECH, truespeech);",
"REGISTER_ENCDEC (TTA, tta);",
"REGISTER_DECODER(TWINVQ, twinvq);",
"REGISTER_DECODER(VMDAUDIO, vmdaudio);",
"REGISTER_ENCDEC (VORBIS, vorbis);",
"REGISTER_ENCDEC (WAVPACK, wavpack);",
"REGISTER_DECODER(WMALOSSLESS, wmalossless);",
"REGISTER_DECODER(WMAPRO, wmapro);",
"REGISTER_ENCDEC (WMAV1, wmav1);",
"REGISTER_ENCDEC (WMAV2, wmav2);",
"REGISTER_DECODER(WMAVOICE, wmavoice);",
"REGISTER_DECODER(WS_SND1, ws_snd1);",
"REGISTER_DECODER(XMA1, xma1);",
"REGISTER_DECODER(XMA2, xma2);",
"REGISTER_ENCDEC (PCM_ALAW, pcm_alaw);",
"REGISTER_DECODER(PCM_BLURAY, pcm_bluray);",
"REGISTER_DECODER(PCM_DVD, pcm_dvd);",
"REGISTER_ENCDEC (PCM_F32BE, pcm_f32be);",
"REGISTER_ENCDEC (PCM_F32LE, pcm_f32le);",
"REGISTER_ENCDEC (PCM_F64BE, pcm_f64be);",
"REGISTER_ENCDEC (PCM_F64LE, pcm_f64le);",
"REGISTER_DECODER(PCM_LXF, pcm_lxf);",
"REGISTER_ENCDEC (PCM_MULAW, pcm_mulaw);",
"REGISTER_ENCDEC (PCM_S8, pcm_s8);",
"REGISTER_ENCDEC (PCM_S8_PLANAR, pcm_s8_planar);",
"REGISTER_ENCDEC (PCM_S16BE, pcm_s16be);",
"REGISTER_ENCDEC (PCM_S16BE_PLANAR, pcm_s16be_planar);",
"REGISTER_ENCDEC (PCM_S16LE, pcm_s16le);",
"REGISTER_ENCDEC (PCM_S16LE_PLANAR, pcm_s16le_planar);",
"REGISTER_ENCDEC (PCM_S24BE, pcm_s24be);",
"REGISTER_ENCDEC (PCM_S24DAUD, pcm_s24daud);",
"REGISTER_ENCDEC (PCM_S24LE, pcm_s24le);",
"REGISTER_ENCDEC (PCM_S24LE_PLANAR, pcm_s24le_planar);",
"REGISTER_ENCDEC (PCM_S32BE, pcm_s32be);",
"REGISTER_ENCDEC (PCM_S32LE, pcm_s32le);",
"REGISTER_ENCDEC (PCM_S32LE_PLANAR, pcm_s32le_planar);",
"REGISTER_ENCDEC (PCM_S64BE, pcm_s64be);",
"REGISTER_ENCDEC (PCM_S64LE, pcm_s64le);",
"REGISTER_ENCDEC (PCM_U8, pcm_u8);",
"REGISTER_ENCDEC (PCM_U16BE, pcm_u16be);",
"REGISTER_ENCDEC (PCM_U16LE, pcm_u16le);",
"REGISTER_ENCDEC (PCM_U24BE, pcm_u24be);",
"REGISTER_ENCDEC (PCM_U24LE, pcm_u24le);",
"REGISTER_ENCDEC (PCM_U32BE, pcm_u32be);",
"REGISTER_ENCDEC (PCM_U32LE, pcm_u32le);",
"REGISTER_DECODER(PCM_ZORK, pcm_zork);",
"REGISTER_DECODER(INTERPLAY_DPCM, interplay_dpcm);",
"REGISTER_ENCDEC (ROQ_DPCM, roq_dpcm);",
"REGISTER_DECODER(SOL_DPCM, sol_dpcm);",
"REGISTER_DECODER(XAN_DPCM, xan_dpcm);",
"REGISTER_DECODER(ADPCM_4XM, adpcm_4xm);",
"REGISTER_ENCDEC (ADPCM_ADX, adpcm_adx);",
"REGISTER_DECODER(ADPCM_AFC, adpcm_afc);",
"REGISTER_DECODER(ADPCM_AICA, adpcm_aica);",
"REGISTER_DECODER(ADPCM_CT, adpcm_ct);",
"REGISTER_DECODER(ADPCM_DTK, adpcm_dtk);",
"REGISTER_DECODER(ADPCM_EA, adpcm_ea);",
"REGISTER_DECODER(ADPCM_EA_MAXIS_XA, adpcm_ea_maxis_xa);",
"REGISTER_DECODER(ADPCM_EA_R1, adpcm_ea_r1);",
"REGISTER_DECODER(ADPCM_EA_R2, adpcm_ea_r2);",
"REGISTER_DECODER(ADPCM_EA_R3, adpcm_ea_r3);",
"REGISTER_DECODER(ADPCM_EA_XAS, adpcm_ea_xas);",
"REGISTER_ENCDEC (ADPCM_G722, adpcm_g722);",
"REGISTER_ENCDEC (ADPCM_G726, adpcm_g726);",
"REGISTER_DECODER(ADPCM_G726LE, adpcm_g726le);",
"REGISTER_DECODER(ADPCM_IMA_AMV, adpcm_ima_amv);",
"REGISTER_DECODER(ADPCM_IMA_APC, adpcm_ima_apc);",
"REGISTER_DECODER(ADPCM_IMA_DAT4, adpcm_ima_dat4);",
"REGISTER_DECODER(ADPCM_IMA_DK3, adpcm_ima_dk3);",
"REGISTER_DECODER(ADPCM_IMA_DK4, adpcm_ima_dk4);",
"REGISTER_DECODER(ADPCM_IMA_EA_EACS, adpcm_ima_ea_eacs);",
"REGISTER_DECODER(ADPCM_IMA_EA_SEAD, adpcm_ima_ea_sead);",
"REGISTER_DECODER(ADPCM_IMA_ISS, adpcm_ima_iss);",
"REGISTER_DECODER(ADPCM_IMA_OKI, adpcm_ima_oki);",
"REGISTER_ENCDEC (ADPCM_IMA_QT, adpcm_ima_qt);",
"REGISTER_DECODER(ADPCM_IMA_RAD, adpcm_ima_rad);",
"REGISTER_DECODER(ADPCM_IMA_SMJPEG, adpcm_ima_smjpeg);",
"REGISTER_ENCDEC (ADPCM_IMA_WAV, adpcm_ima_wav);",
"REGISTER_DECODER(ADPCM_IMA_WS, adpcm_ima_ws);",
"REGISTER_ENCDEC (ADPCM_MS, adpcm_ms);",
"REGISTER_DECODER(ADPCM_MTAF, adpcm_mtaf);",
"REGISTER_DECODER(ADPCM_PSX, adpcm_psx);",
"REGISTER_DECODER(ADPCM_SBPRO_2, adpcm_sbpro_2);",
"REGISTER_DECODER(ADPCM_SBPRO_3, adpcm_sbpro_3);",
"REGISTER_DECODER(ADPCM_SBPRO_4, adpcm_sbpro_4);",
"REGISTER_ENCDEC (ADPCM_SWF, adpcm_swf);",
"REGISTER_DECODER(ADPCM_THP, adpcm_thp);",
"REGISTER_DECODER(ADPCM_THP_LE, adpcm_thp_le);",
"REGISTER_DECODER(ADPCM_VIMA, adpcm_vima);",
"REGISTER_DECODER(ADPCM_XA, adpcm_xa);",
"REGISTER_ENCDEC (ADPCM_YAMAHA, adpcm_yamaha);",
"REGISTER_ENCDEC (SSA, ssa);",
"REGISTER_ENCDEC (ASS, ass);",
"REGISTER_DECODER(CCAPTION, ccaption);",
"REGISTER_ENCDEC (DVBSUB, dvbsub);",
"REGISTER_ENCDEC (DVDSUB, dvdsub);",
"REGISTER_DECODER(JACOSUB, jacosub);",
"REGISTER_DECODER(MICRODVD, microdvd);",
"REGISTER_ENCDEC (MOVTEXT, movtext);",
"REGISTER_DECODER(MPL2, mpl2);",
"REGISTER_DECODER(PGSSUB, pgssub);",
"REGISTER_DECODER(PJS, pjs);",
"REGISTER_DECODER(REALTEXT, realtext);",
"REGISTER_DECODER(SAMI, sami);",
"REGISTER_ENCDEC (SRT, srt);",
"REGISTER_DECODER(STL, stl);",
"REGISTER_ENCDEC (SUBRIP, subrip);",
"REGISTER_DECODER(SUBVIEWER, subviewer);",
"REGISTER_DECODER(SUBVIEWER1, subviewer1);",
"REGISTER_ENCDEC (TEXT, text);",
"REGISTER_DECODER(VPLAYER, vplayer);",
"REGISTER_ENCDEC (WEBVTT, webvtt);",
"REGISTER_ENCDEC (XSUB, xsub);",
"REGISTER_ENCDEC (AAC_AT, aac_at);",
"REGISTER_DECODER(AC3_AT, ac3_at);",
"REGISTER_DECODER(ADPCM_IMA_QT_AT, adpcm_ima_qt_at);",
"REGISTER_ENCDEC (ALAC_AT, alac_at);",
"REGISTER_DECODER(AMR_NB_AT, amr_nb_at);",
"REGISTER_DECODER(EAC3_AT, eac3_at);",
"REGISTER_DECODER(GSM_MS_AT, gsm_ms_at);",
"REGISTER_ENCDEC (ILBC_AT, ilbc_at);",
"REGISTER_DECODER(MP1_AT, mp1_at);",
"REGISTER_DECODER(MP2_AT, mp2_at);",
"REGISTER_DECODER(MP3_AT, mp3_at);",
"REGISTER_ENCDEC (PCM_ALAW_AT, pcm_alaw_at);",
"REGISTER_ENCDEC (PCM_MULAW_AT, pcm_mulaw_at);",
"REGISTER_DECODER(QDMC_AT, qdmc_at);",
"REGISTER_DECODER(QDM2_AT, qdm2_at);",
"REGISTER_DECODER(LIBCELT, libcelt);",
"REGISTER_ENCODER(LIBFAAC, libfaac);",
"REGISTER_ENCDEC (LIBFDK_AAC, libfdk_aac);",
"REGISTER_ENCDEC (LIBGSM, libgsm);",
"REGISTER_ENCDEC (LIBGSM_MS, libgsm_ms);",
"REGISTER_ENCDEC (LIBILBC, libilbc);",
"REGISTER_ENCODER(LIBMP3LAME, libmp3lame);",
"REGISTER_ENCDEC (LIBOPENCORE_AMRNB, libopencore_amrnb);",
"REGISTER_DECODER(LIBOPENCORE_AMRWB, libopencore_amrwb);",
"REGISTER_ENCDEC (LIBOPENJPEG, libopenjpeg);",
"REGISTER_ENCDEC (LIBOPUS, libopus);",
"REGISTER_ENCDEC (LIBSCHROEDINGER, libschroedinger);",
"REGISTER_ENCODER(LIBSHINE, libshine);",
"REGISTER_ENCDEC (LIBSPEEX, libspeex);",
"REGISTER_ENCODER(LIBTHEORA, libtheora);",
"REGISTER_ENCODER(LIBTWOLAME, libtwolame);",
"REGISTER_ENCODER(LIBVO_AMRWBENC, libvo_amrwbenc);",
"REGISTER_ENCDEC (LIBVORBIS, libvorbis);",
"REGISTER_ENCDEC (LIBVPX_VP8, libvpx_vp8);",
"REGISTER_ENCDEC (LIBVPX_VP9, libvpx_vp9);",
"REGISTER_ENCODER(LIBWAVPACK, libwavpack);",
"REGISTER_ENCODER(LIBWEBP_ANIM, libwebp_anim);",
"REGISTER_ENCODER(LIBWEBP, libwebp);",
"REGISTER_ENCODER(LIBX262, libx262);",
"REGISTER_ENCODER(LIBX264, libx264);",
"REGISTER_ENCODER(LIBX264RGB, libx264rgb);",
"REGISTER_ENCODER(LIBX265, libx265);",
"REGISTER_ENCODER(LIBXAVS, libxavs);",
"REGISTER_ENCODER(LIBXVID, libxvid);",
"REGISTER_DECODER(LIBZVBI_TELETEXT, libzvbi_teletext);",
"REGISTER_DECODER(BINTEXT, bintext);",
"REGISTER_DECODER(XBIN, xbin);",
"REGISTER_DECODER(IDF, idf);",
"REGISTER_ENCDEC (LIBOPENH264, libopenh264);",
"REGISTER_DECODER(H263_CUVID, h263_cuvid);",
"REGISTER_DECODER(H264_CUVID, h264_cuvid);",
"REGISTER_ENCODER(H264_NVENC, h264_nvenc);",
"REGISTER_ENCODER(H264_OMX, h264_omx);",
"REGISTER_ENCODER(H264_QSV, h264_qsv);",
"REGISTER_ENCODER(H264_VAAPI, h264_vaapi);",
"REGISTER_ENCODER(H264_VIDEOTOOLBOX, h264_videotoolbox);",
"#if FF_API_NVENC_OLD_NAME\nREGISTER_ENCODER(NVENC, nvenc);",
"REGISTER_ENCODER(NVENC_H264, nvenc_h264);",
"REGISTER_ENCODER(NVENC_HEVC, nvenc_hevc);",
"#endif\nREGISTER_DECODER(HEVC_CUVID, hevc_cuvid);",
"REGISTER_ENCODER(HEVC_NVENC, hevc_nvenc);",
"REGISTER_ENCODER(HEVC_QSV, hevc_qsv);",
"REGISTER_ENCODER(HEVC_VAAPI, hevc_vaapi);",
"REGISTER_ENCODER(LIBKVAZAAR, libkvazaar);",
"REGISTER_DECODER(MJPEG_CUVID, mjpeg_cuvid);",
"REGISTER_ENCODER(MJPEG_VAAPI, mjpeg_vaapi);",
"REGISTER_DECODER(MPEG1_CUVID, mpeg1_cuvid);",
"REGISTER_DECODER(MPEG2_CUVID, mpeg2_cuvid);",
"REGISTER_ENCODER(MPEG2_QSV, mpeg2_qsv);",
"REGISTER_DECODER(MPEG4_CUVID, mpeg4_cuvid);",
"REGISTER_DECODER(VC1_CUVID, vc1_cuvid);",
"REGISTER_DECODER(VP8_CUVID, vp8_cuvid);",
"REGISTER_DECODER(VP9_CUVID, vp9_cuvid);",
"REGISTER_PARSER(AAC, aac);",
"REGISTER_PARSER(AAC_LATM, aac_latm);",
"REGISTER_PARSER(AC3, ac3);",
"REGISTER_PARSER(ADX, adx);",
"REGISTER_PARSER(BMP, bmp);",
"REGISTER_PARSER(CAVSVIDEO, cavsvideo);",
"REGISTER_PARSER(COOK, cook);",
"REGISTER_PARSER(DCA, dca);",
"REGISTER_PARSER(DIRAC, dirac);",
"REGISTER_PARSER(DNXHD, dnxhd);",
"REGISTER_PARSER(DPX, dpx);",
"REGISTER_PARSER(DVAUDIO, dvaudio);",
"REGISTER_PARSER(DVBSUB, dvbsub);",
"REGISTER_PARSER(DVDSUB, dvdsub);",
"REGISTER_PARSER(DVD_NAV, dvd_nav);",
"REGISTER_PARSER(FLAC, flac);",
"REGISTER_PARSER(G729, g729);",
"REGISTER_PARSER(GSM, gsm);",
"REGISTER_PARSER(H261, h261);",
"REGISTER_PARSER(H263, h263);",
"REGISTER_PARSER(H264, h264);",
"REGISTER_PARSER(HEVC, hevc);",
"REGISTER_PARSER(MJPEG, mjpeg);",
"REGISTER_PARSER(MLP, mlp);",
"REGISTER_PARSER(MPEG4VIDEO, mpeg4video);",
"REGISTER_PARSER(MPEGAUDIO, mpegaudio);",
"REGISTER_PARSER(MPEGVIDEO, mpegvideo);",
"REGISTER_PARSER(OPUS, opus);",
"REGISTER_PARSER(PNG, png);",
"REGISTER_PARSER(PNM, pnm);",
"REGISTER_PARSER(RV30, rv30);",
"REGISTER_PARSER(RV40, rv40);",
"REGISTER_PARSER(TAK, tak);",
"REGISTER_PARSER(VC1, vc1);",
"REGISTER_PARSER(VORBIS, vorbis);",
"REGISTER_PARSER(VP3, vp3);",
"REGISTER_PARSER(VP8, vp8);",
"REGISTER_PARSER(VP9, vp9);",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
9,
11
],
[
13
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
61
],
[
63
],
[
65
],
[
68
],
[
70
],
[
72
],
[
74
],
[
76
],
[
78
],
[
80
],
[
82
],
[
84
],
[
86
],
[
88
],
[
90
],
[
92
],
[
94
],
[
96
],
[
98
],
[
100
],
[
102
],
[
104
],
[
106
],
[
108
],
[
110
],
[
112
],
[
114
],
[
116
],
[
118
],
[
120
],
[
122
],
[
124
],
[
130
],
[
132
],
[
134
],
[
136
],
[
138
],
[
140
],
[
142
],
[
144
],
[
146
],
[
148
],
[
150
],
[
152
],
[
154
],
[
156
],
[
158
],
[
160
],
[
162
],
[
164
],
[
166
],
[
168
],
[
170
],
[
172
],
[
174
],
[
176
],
[
178
],
[
180
],
[
182
],
[
184
],
[
186
],
[
188
],
[
190
],
[
192
],
[
194
],
[
196
],
[
198
],
[
200
],
[
202
],
[
204
],
[
206
],
[
208
],
[
210
],
[
212
],
[
214
],
[
216
],
[
218
],
[
220
],
[
222
],
[
224
],
[
226
],
[
228
],
[
230
],
[
232
],
[
234
],
[
236
],
[
238
],
[
240
],
[
242
],
[
244
],
[
246
],
[
248
],
[
250
],
[
252
],
[
254
],
[
256
],
[
258
],
[
260
],
[
262
],
[
264
],
[
266
],
[
268
],
[
270
],
[
272
],
[
274
],
[
276
],
[
278
],
[
280
],
[
282
],
[
284
],
[
286
],
[
288
],
[
290,
292
],
[
294,
296
],
[
298
],
[
300
],
[
302
],
[
304
],
[
306
],
[
308
],
[
310
],
[
312
],
[
314
],
[
316
],
[
318
],
[
320
],
[
322
],
[
324
],
[
326
],
[
328
],
[
330
],
[
332
],
[
334
],
[
336
],
[
338
],
[
340
],
[
342
],
[
344
],
[
346
],
[
348
],
[
350
],
[
352
],
[
354
],
[
356,
358
],
[
360,
362
],
[
364
],
[
366
],
[
368
],
[
370
],
[
372,
374
],
[
376,
378
],
[
380,
382
],
[
384
],
[
386,
388
],
[
390
],
[
392
],
[
394
],
[
396
],
[
398
],
[
400
],
[
402
],
[
404
],
[
406
],
[
408
],
[
410
],
[
412
],
[
414
],
[
416
],
[
418
],
[
420
],
[
422
],
[
424
],
[
426
],
[
428
],
[
430
],
[
432
],
[
434
],
[
436
],
[
438
],
[
440
],
[
442
],
[
444
],
[
446
],
[
448
],
[
450
],
[
452
],
[
454
],
[
456
],
[
458
],
[
460
],
[
462
],
[
464
],
[
466
],
[
468
],
[
470
],
[
472
],
[
474
],
[
476
],
[
478
],
[
480
],
[
482
],
[
484
],
[
486
],
[
488
],
[
490
],
[
492
],
[
494
],
[
496
],
[
498
],
[
500
],
[
502
],
[
504
],
[
506
],
[
508
],
[
510
],
[
512
],
[
514
],
[
516
],
[
518
],
[
520
],
[
522
],
[
524
],
[
526
],
[
528
],
[
530
],
[
532
],
[
534
],
[
536
],
[
538
],
[
540
],
[
542
],
[
544
],
[
546
],
[
548
],
[
550
],
[
552
],
[
554
],
[
556
],
[
558
],
[
560,
562
],
[
564,
566
],
[
568
],
[
570
],
[
572
],
[
574
],
[
576
],
[
578
],
[
580
],
[
582
],
[
584
],
[
586
],
[
588
],
[
590
],
[
592
],
[
594
],
[
596
],
[
598
],
[
600
],
[
602
],
[
604
],
[
606
],
[
608
],
[
610,
612
],
[
614,
616
],
[
618
],
[
620
],
[
622
],
[
624
],
[
626
],
[
628
],
[
630
],
[
632
],
[
634
],
[
636
],
[
638
],
[
640
],
[
642
],
[
644
],
[
646
],
[
652
],
[
654
],
[
656
],
[
658
],
[
660
],
[
662
],
[
664
],
[
666
],
[
668
],
[
670
],
[
672
],
[
674
],
[
676
],
[
678
],
[
680
],
[
682
],
[
684
],
[
686
],
[
688
],
[
690
],
[
692
],
[
694
],
[
696
],
[
698
],
[
700
],
[
702
],
[
704
],
[
706
],
[
708
],
[
710
],
[
712
],
[
714
],
[
716
],
[
718
],
[
720
],
[
722
],
[
724
],
[
726
],
[
728
],
[
730
],
[
732
],
[
734
],
[
736
],
[
738
],
[
740
],
[
742
],
[
744
],
[
746
],
[
748
],
[
750
],
[
752
],
[
754
],
[
756
],
[
758
],
[
760
],
[
762
],
[
764
],
[
766
],
[
768
],
[
770
],
[
772
],
[
774
],
[
776
],
[
778
],
[
780
],
[
782
],
[
784
],
[
786
],
[
788
],
[
790
],
[
792
],
[
794
],
[
796
],
[
798
],
[
800
],
[
802
],
[
804
],
[
806
],
[
808
],
[
810
],
[
812
],
[
814
],
[
816
],
[
822
],
[
824
],
[
826
],
[
828
],
[
830
],
[
832
],
[
834
],
[
836
],
[
838
],
[
840
],
[
842
],
[
844
],
[
846
],
[
848
],
[
850
],
[
852
],
[
854
],
[
856
],
[
858
],
[
860
],
[
862
],
[
864
],
[
866
],
[
868
],
[
870
],
[
872
],
[
874
],
[
876
],
[
878
],
[
880
],
[
882
],
[
884
],
[
890
],
[
892
],
[
894
],
[
896
],
[
902
],
[
904
],
[
906
],
[
908
],
[
910
],
[
912
],
[
914
],
[
916
],
[
918
],
[
920
],
[
922
],
[
924
],
[
926
],
[
928
],
[
930
],
[
932
],
[
934
],
[
936
],
[
938
],
[
940
],
[
942
],
[
944
],
[
946
],
[
948
],
[
950
],
[
952
],
[
954
],
[
956
],
[
958
],
[
960
],
[
962
],
[
964
],
[
966
],
[
968
],
[
970
],
[
972
],
[
974
],
[
976
],
[
978
],
[
980
],
[
982
],
[
988
],
[
990
],
[
992
],
[
994
],
[
996
],
[
998
],
[
1000
],
[
1002
],
[
1004
],
[
1006
],
[
1008
],
[
1010
],
[
1012
],
[
1014
],
[
1016
],
[
1018
],
[
1020
],
[
1022
],
[
1024
],
[
1026
],
[
1028
],
[
1030
],
[
1036
],
[
1038
],
[
1040
],
[
1042
],
[
1044
],
[
1046
],
[
1048
],
[
1050
],
[
1052
],
[
1054
],
[
1056
],
[
1058
],
[
1060
],
[
1062
],
[
1064
],
[
1066
],
[
1068
],
[
1070
],
[
1072
],
[
1074
],
[
1076
],
[
1078
],
[
1080
],
[
1082
],
[
1084
],
[
1086
],
[
1088
],
[
1090
],
[
1092
],
[
1094
],
[
1096
],
[
1098
],
[
1100
],
[
1102
],
[
1104
],
[
1106
],
[
1108
],
[
1110
],
[
1112
],
[
1114
],
[
1116
],
[
1118
],
[
1120
],
[
1122
],
[
1124
],
[
1130
],
[
1132
],
[
1134
],
[
1142
],
[
1144
],
[
1146
],
[
1148
],
[
1150
],
[
1152
],
[
1154
],
[
1156
],
[
1158,
1160
],
[
1162
],
[
1164
],
[
1166,
1168
],
[
1170
],
[
1172
],
[
1174
],
[
1176
],
[
1178
],
[
1180
],
[
1182
],
[
1184
],
[
1186
],
[
1188
],
[
1190
],
[
1192
],
[
1194
],
[
1200
],
[
1202
],
[
1204
],
[
1206
],
[
1208
],
[
1210
],
[
1212
],
[
1214
],
[
1216
],
[
1218
],
[
1220
],
[
1222
],
[
1224
],
[
1226
],
[
1228
],
[
1230
],
[
1232
],
[
1234
],
[
1236
],
[
1238
],
[
1240
],
[
1242
],
[
1244
],
[
1246
],
[
1248
],
[
1250
],
[
1252
],
[
1254
],
[
1256
],
[
1258
],
[
1260
],
[
1262
],
[
1264
],
[
1266
],
[
1268
],
[
1270
],
[
1272
],
[
1274
],
[
1276
]
] |
19,705 | static void spapr_machine_device_unplug(HotplugHandler *hotplug_dev,
DeviceState *dev, Error **errp)
{
sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(qdev_get_machine());
if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
error_setg(errp, "Memory hot unplug not supported by sPAPR");
} else if (object_dynamic_cast(OBJECT(dev), TYPE_SPAPR_CPU_CORE)) {
if (!smc->dr_cpu_enabled) {
error_setg(errp, "CPU hot unplug not supported on this machine");
return;
}
spapr_core_unplug(hotplug_dev, dev, errp);
}
}
| true | qemu | 3c0c47e3464f3c54bd3f1cc6d4da2cbf7465e295 | static void spapr_machine_device_unplug(HotplugHandler *hotplug_dev,
DeviceState *dev, Error **errp)
{
sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(qdev_get_machine());
if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
error_setg(errp, "Memory hot unplug not supported by sPAPR");
} else if (object_dynamic_cast(OBJECT(dev), TYPE_SPAPR_CPU_CORE)) {
if (!smc->dr_cpu_enabled) {
error_setg(errp, "CPU hot unplug not supported on this machine");
return;
}
spapr_core_unplug(hotplug_dev, dev, errp);
}
}
| {
"code": [
" sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(qdev_get_machine());",
" if (!smc->dr_cpu_enabled) {"
],
"line_no": [
7,
17
]
} | static void FUNC_0(HotplugHandler *VAR_0,
DeviceState *VAR_1, Error **VAR_2)
{
sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(qdev_get_machine());
if (object_dynamic_cast(OBJECT(VAR_1), TYPE_PC_DIMM)) {
error_setg(VAR_2, "Memory hot unplug not supported by sPAPR");
} else if (object_dynamic_cast(OBJECT(VAR_1), TYPE_SPAPR_CPU_CORE)) {
if (!smc->dr_cpu_enabled) {
error_setg(VAR_2, "CPU hot unplug not supported on this machine");
return;
}
spapr_core_unplug(VAR_0, VAR_1, VAR_2);
}
}
| [
"static void FUNC_0(HotplugHandler *VAR_0,\nDeviceState *VAR_1, Error **VAR_2)\n{",
"sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(qdev_get_machine());",
"if (object_dynamic_cast(OBJECT(VAR_1), TYPE_PC_DIMM)) {",
"error_setg(VAR_2, \"Memory hot unplug not supported by sPAPR\");",
"} else if (object_dynamic_cast(OBJECT(VAR_1), TYPE_SPAPR_CPU_CORE)) {",
"if (!smc->dr_cpu_enabled) {",
"error_setg(VAR_2, \"CPU hot unplug not supported on this machine\");",
"return;",
"}",
"spapr_core_unplug(VAR_0, VAR_1, VAR_2);",
"}",
"}"
] | [
0,
1,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5
],
[
7
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
]
] |
19,706 | static int mkv_add_cuepoint(mkv_cues *cues, int stream, int64_t ts, int64_t cluster_pos)
{
mkv_cuepoint *entries = cues->entries;
entries = av_realloc(entries, (cues->num_entries + 1) * sizeof(mkv_cuepoint));
if (entries == NULL)
return AVERROR(ENOMEM);
if (ts < 0)
return 0;
entries[cues->num_entries ].pts = ts;
entries[cues->num_entries ].tracknum = stream + 1;
entries[cues->num_entries++].cluster_pos = cluster_pos - cues->segment_offset;
cues->entries = entries;
return 0;
}
| true | FFmpeg | 4ffbe3f3a5d9892841d9bc31d859916c2c61123f | static int mkv_add_cuepoint(mkv_cues *cues, int stream, int64_t ts, int64_t cluster_pos)
{
mkv_cuepoint *entries = cues->entries;
entries = av_realloc(entries, (cues->num_entries + 1) * sizeof(mkv_cuepoint));
if (entries == NULL)
return AVERROR(ENOMEM);
if (ts < 0)
return 0;
entries[cues->num_entries ].pts = ts;
entries[cues->num_entries ].tracknum = stream + 1;
entries[cues->num_entries++].cluster_pos = cluster_pos - cues->segment_offset;
cues->entries = entries;
return 0;
}
| {
"code": [
" if (ts < 0)",
" return 0;"
],
"line_no": [
17,
19
]
} | static int FUNC_0(mkv_cues *VAR_0, int VAR_1, int64_t VAR_2, int64_t VAR_3)
{
mkv_cuepoint *entries = VAR_0->entries;
entries = av_realloc(entries, (VAR_0->num_entries + 1) * sizeof(mkv_cuepoint));
if (entries == NULL)
return AVERROR(ENOMEM);
if (VAR_2 < 0)
return 0;
entries[VAR_0->num_entries ].pts = VAR_2;
entries[VAR_0->num_entries ].tracknum = VAR_1 + 1;
entries[VAR_0->num_entries++].VAR_3 = VAR_3 - VAR_0->segment_offset;
VAR_0->entries = entries;
return 0;
}
| [
"static int FUNC_0(mkv_cues *VAR_0, int VAR_1, int64_t VAR_2, int64_t VAR_3)\n{",
"mkv_cuepoint *entries = VAR_0->entries;",
"entries = av_realloc(entries, (VAR_0->num_entries + 1) * sizeof(mkv_cuepoint));",
"if (entries == NULL)\nreturn AVERROR(ENOMEM);",
"if (VAR_2 < 0)\nreturn 0;",
"entries[VAR_0->num_entries ].pts = VAR_2;",
"entries[VAR_0->num_entries ].tracknum = VAR_1 + 1;",
"entries[VAR_0->num_entries++].VAR_3 = VAR_3 - VAR_0->segment_offset;",
"VAR_0->entries = entries;",
"return 0;",
"}"
] | [
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
9
],
[
11,
13
],
[
17,
19
],
[
23
],
[
25
],
[
27
],
[
31
],
[
33
],
[
35
]
] |
19,708 | static void gen_exception(int excp)
{
TCGv tmp = new_tmp();
tcg_gen_movi_i32(tmp, excp);
gen_helper_exception(tmp);
dead_tmp(tmp);
}
| true | qemu | 7d1b0095bff7157e856d1d0e6c4295641ced2752 | static void gen_exception(int excp)
{
TCGv tmp = new_tmp();
tcg_gen_movi_i32(tmp, excp);
gen_helper_exception(tmp);
dead_tmp(tmp);
}
| {
"code": [
" TCGv tmp = new_tmp();",
" TCGv tmp = new_tmp();",
" TCGv tmp = new_tmp();",
" dead_tmp(tmp);",
" TCGv tmp = new_tmp();",
" dead_tmp(tmp);",
" TCGv tmp = new_tmp();",
" dead_tmp(tmp);",
" TCGv tmp = new_tmp();",
" dead_tmp(tmp);",
" TCGv tmp = new_tmp();",
" dead_tmp(tmp);",
" dead_tmp(tmp);",
" dead_tmp(tmp);",
" dead_tmp(tmp);",
" TCGv tmp = new_tmp();",
" dead_tmp(tmp);",
" dead_tmp(tmp);",
" TCGv tmp = new_tmp();",
" TCGv tmp = new_tmp();",
" TCGv tmp = new_tmp();",
" TCGv tmp = new_tmp();",
" TCGv tmp = new_tmp();",
" TCGv tmp = new_tmp();",
" TCGv tmp = new_tmp();",
" dead_tmp(tmp);",
" TCGv tmp = new_tmp();",
" dead_tmp(tmp);",
" TCGv tmp = new_tmp();",
" dead_tmp(tmp);",
" TCGv tmp = new_tmp();",
" dead_tmp(tmp);",
" TCGv tmp = new_tmp();",
" dead_tmp(tmp);",
" dead_tmp(tmp);",
" TCGv tmp = new_tmp();",
" dead_tmp(tmp);",
" dead_tmp(tmp);",
" TCGv tmp = new_tmp();",
" dead_tmp(tmp);",
" dead_tmp(tmp);"
],
"line_no": [
5,
5,
5,
11,
5,
11,
5,
11,
5,
11,
5,
11,
11,
11,
11,
5,
11,
11,
5,
5,
5,
5,
5,
5,
5,
11,
5,
11,
5,
11,
5,
11,
5,
11,
11,
5,
11,
11,
5,
11,
11
]
} | static void FUNC_0(int VAR_0)
{
TCGv tmp = new_tmp();
tcg_gen_movi_i32(tmp, VAR_0);
gen_helper_exception(tmp);
dead_tmp(tmp);
}
| [
"static void FUNC_0(int VAR_0)\n{",
"TCGv tmp = new_tmp();",
"tcg_gen_movi_i32(tmp, VAR_0);",
"gen_helper_exception(tmp);",
"dead_tmp(tmp);",
"}"
] | [
0,
1,
0,
0,
1,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
]
] |
19,710 | static int yop_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
AVPacket *avpkt)
{
YopDecContext *s = avctx->priv_data;
int tag, firstcolor, is_odd_frame;
int ret, i;
uint32_t *palette;
if (s->frame.data[0])
avctx->release_buffer(avctx, &s->frame);
if (avpkt->size < 4 + 3*s->num_pal_colors) {
av_log(avctx, AV_LOG_ERROR, "packet of size %d too small\n", avpkt->size);
return AVERROR_INVALIDDATA;
}
ret = avctx->get_buffer(avctx, &s->frame);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
s->frame.linesize[0] = avctx->width;
s->dstbuf = s->frame.data[0];
s->dstptr = s->frame.data[0];
s->srcptr = avpkt->data + 4;
s->row_pos = 0;
s->low_nibble = NULL;
is_odd_frame = avpkt->data[0];
if(is_odd_frame>1){
av_log(avctx, AV_LOG_ERROR, "frame is too odd %d\n", is_odd_frame);
return AVERROR_INVALIDDATA;
}
firstcolor = s->first_color[is_odd_frame];
palette = (uint32_t *)s->frame.data[1];
for (i = 0; i < s->num_pal_colors; i++, s->srcptr += 3) {
palette[i + firstcolor] = (s->srcptr[0] << 18) |
(s->srcptr[1] << 10) |
(s->srcptr[2] << 2);
palette[i + firstcolor] |= 0xFF << 24 |
(palette[i + firstcolor] >> 6) & 0x30303;
}
s->frame.palette_has_changed = 1;
while (s->dstptr - s->dstbuf <
avctx->width * avctx->height &&
s->srcptr - avpkt->data < avpkt->size) {
tag = yop_get_next_nibble(s);
if (tag != 0xf) {
yop_paint_block(s, tag);
}else {
tag = yop_get_next_nibble(s);
ret = yop_copy_previous_block(s, tag);
if (ret < 0) {
avctx->release_buffer(avctx, &s->frame);
return ret;
}
}
yop_next_macroblock(s);
}
*data_size = sizeof(AVFrame);
*(AVFrame *) data = s->frame;
return avpkt->size;
}
| true | FFmpeg | b12d92efd6c0d48665383a9baecc13e7ebbd8a22 | static int yop_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
AVPacket *avpkt)
{
YopDecContext *s = avctx->priv_data;
int tag, firstcolor, is_odd_frame;
int ret, i;
uint32_t *palette;
if (s->frame.data[0])
avctx->release_buffer(avctx, &s->frame);
if (avpkt->size < 4 + 3*s->num_pal_colors) {
av_log(avctx, AV_LOG_ERROR, "packet of size %d too small\n", avpkt->size);
return AVERROR_INVALIDDATA;
}
ret = avctx->get_buffer(avctx, &s->frame);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
s->frame.linesize[0] = avctx->width;
s->dstbuf = s->frame.data[0];
s->dstptr = s->frame.data[0];
s->srcptr = avpkt->data + 4;
s->row_pos = 0;
s->low_nibble = NULL;
is_odd_frame = avpkt->data[0];
if(is_odd_frame>1){
av_log(avctx, AV_LOG_ERROR, "frame is too odd %d\n", is_odd_frame);
return AVERROR_INVALIDDATA;
}
firstcolor = s->first_color[is_odd_frame];
palette = (uint32_t *)s->frame.data[1];
for (i = 0; i < s->num_pal_colors; i++, s->srcptr += 3) {
palette[i + firstcolor] = (s->srcptr[0] << 18) |
(s->srcptr[1] << 10) |
(s->srcptr[2] << 2);
palette[i + firstcolor] |= 0xFF << 24 |
(palette[i + firstcolor] >> 6) & 0x30303;
}
s->frame.palette_has_changed = 1;
while (s->dstptr - s->dstbuf <
avctx->width * avctx->height &&
s->srcptr - avpkt->data < avpkt->size) {
tag = yop_get_next_nibble(s);
if (tag != 0xf) {
yop_paint_block(s, tag);
}else {
tag = yop_get_next_nibble(s);
ret = yop_copy_previous_block(s, tag);
if (ret < 0) {
avctx->release_buffer(avctx, &s->frame);
return ret;
}
}
yop_next_macroblock(s);
}
*data_size = sizeof(AVFrame);
*(AVFrame *) data = s->frame;
return avpkt->size;
}
| {
"code": [
" palette[i + firstcolor] |= 0xFF << 24 |"
],
"line_no": [
85
]
} | static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2,
AVPacket *VAR_3)
{
YopDecContext *s = VAR_0->priv_data;
int VAR_4, VAR_5, VAR_6;
int VAR_7, VAR_8;
uint32_t *palette;
if (s->frame.VAR_1[0])
VAR_0->release_buffer(VAR_0, &s->frame);
if (VAR_3->size < 4 + 3*s->num_pal_colors) {
av_log(VAR_0, AV_LOG_ERROR, "packet of size %d too small\n", VAR_3->size);
return AVERROR_INVALIDDATA;
}
VAR_7 = VAR_0->get_buffer(VAR_0, &s->frame);
if (VAR_7 < 0) {
av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\n");
return VAR_7;
}
s->frame.linesize[0] = VAR_0->width;
s->dstbuf = s->frame.VAR_1[0];
s->dstptr = s->frame.VAR_1[0];
s->srcptr = VAR_3->VAR_1 + 4;
s->row_pos = 0;
s->low_nibble = NULL;
VAR_6 = VAR_3->VAR_1[0];
if(VAR_6>1){
av_log(VAR_0, AV_LOG_ERROR, "frame is too odd %d\n", VAR_6);
return AVERROR_INVALIDDATA;
}
VAR_5 = s->first_color[VAR_6];
palette = (uint32_t *)s->frame.VAR_1[1];
for (VAR_8 = 0; VAR_8 < s->num_pal_colors; VAR_8++, s->srcptr += 3) {
palette[VAR_8 + VAR_5] = (s->srcptr[0] << 18) |
(s->srcptr[1] << 10) |
(s->srcptr[2] << 2);
palette[VAR_8 + VAR_5] |= 0xFF << 24 |
(palette[VAR_8 + VAR_5] >> 6) & 0x30303;
}
s->frame.palette_has_changed = 1;
while (s->dstptr - s->dstbuf <
VAR_0->width * VAR_0->height &&
s->srcptr - VAR_3->VAR_1 < VAR_3->size) {
VAR_4 = yop_get_next_nibble(s);
if (VAR_4 != 0xf) {
yop_paint_block(s, VAR_4);
}else {
VAR_4 = yop_get_next_nibble(s);
VAR_7 = yop_copy_previous_block(s, VAR_4);
if (VAR_7 < 0) {
VAR_0->release_buffer(VAR_0, &s->frame);
return VAR_7;
}
}
yop_next_macroblock(s);
}
*VAR_2 = sizeof(AVFrame);
*(AVFrame *) VAR_1 = s->frame;
return VAR_3->size;
}
| [
"static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{",
"YopDecContext *s = VAR_0->priv_data;",
"int VAR_4, VAR_5, VAR_6;",
"int VAR_7, VAR_8;",
"uint32_t *palette;",
"if (s->frame.VAR_1[0])\nVAR_0->release_buffer(VAR_0, &s->frame);",
"if (VAR_3->size < 4 + 3*s->num_pal_colors) {",
"av_log(VAR_0, AV_LOG_ERROR, \"packet of size %d too small\\n\", VAR_3->size);",
"return AVERROR_INVALIDDATA;",
"}",
"VAR_7 = VAR_0->get_buffer(VAR_0, &s->frame);",
"if (VAR_7 < 0) {",
"av_log(VAR_0, AV_LOG_ERROR, \"get_buffer() failed\\n\");",
"return VAR_7;",
"}",
"s->frame.linesize[0] = VAR_0->width;",
"s->dstbuf = s->frame.VAR_1[0];",
"s->dstptr = s->frame.VAR_1[0];",
"s->srcptr = VAR_3->VAR_1 + 4;",
"s->row_pos = 0;",
"s->low_nibble = NULL;",
"VAR_6 = VAR_3->VAR_1[0];",
"if(VAR_6>1){",
"av_log(VAR_0, AV_LOG_ERROR, \"frame is too odd %d\\n\", VAR_6);",
"return AVERROR_INVALIDDATA;",
"}",
"VAR_5 = s->first_color[VAR_6];",
"palette = (uint32_t *)s->frame.VAR_1[1];",
"for (VAR_8 = 0; VAR_8 < s->num_pal_colors; VAR_8++, s->srcptr += 3) {",
"palette[VAR_8 + VAR_5] = (s->srcptr[0] << 18) |\n(s->srcptr[1] << 10) |\n(s->srcptr[2] << 2);",
"palette[VAR_8 + VAR_5] |= 0xFF << 24 |\n(palette[VAR_8 + VAR_5] >> 6) & 0x30303;",
"}",
"s->frame.palette_has_changed = 1;",
"while (s->dstptr - s->dstbuf <\nVAR_0->width * VAR_0->height &&\ns->srcptr - VAR_3->VAR_1 < VAR_3->size) {",
"VAR_4 = yop_get_next_nibble(s);",
"if (VAR_4 != 0xf) {",
"yop_paint_block(s, VAR_4);",
"}else {",
"VAR_4 = yop_get_next_nibble(s);",
"VAR_7 = yop_copy_previous_block(s, VAR_4);",
"if (VAR_7 < 0) {",
"VAR_0->release_buffer(VAR_0, &s->frame);",
"return VAR_7;",
"}",
"}",
"yop_next_macroblock(s);",
"}",
"*VAR_2 = sizeof(AVFrame);",
"*(AVFrame *) VAR_1 = s->frame;",
"return VAR_3->size;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
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
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
45
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
77
],
[
79,
81,
83
],
[
85,
87
],
[
89
],
[
93
],
[
97,
99,
101
],
[
105
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
135
],
[
137
],
[
139
],
[
141
]
] |
19,711 | static int dnxhd_encode_picture(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data)
{
DNXHDEncContext *ctx = avctx->priv_data;
int first_field = 1;
int offset, i, ret;
if (buf_size < ctx->cid_table->frame_size) {
av_log(avctx, AV_LOG_ERROR, "output buffer is too small to compress picture\n");
return -1;
}
dnxhd_load_picture(ctx, data);
encode_coding_unit:
for (i = 0; i < 3; i++) {
ctx->src[i] = ctx->frame.data[i];
if (ctx->interlaced && ctx->cur_field)
ctx->src[i] += ctx->frame.linesize[i];
}
dnxhd_write_header(avctx, buf);
if (avctx->mb_decision == FF_MB_DECISION_RD)
ret = dnxhd_encode_rdo(avctx, ctx);
else
ret = dnxhd_encode_fast(avctx, ctx);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "picture could not fit ratecontrol constraints\n");
return -1;
}
dnxhd_setup_threads_slices(ctx, buf);
offset = 0;
for (i = 0; i < ctx->m.mb_height; i++) {
AV_WB32(ctx->msip + i * 4, offset);
offset += ctx->slice_size[i];
assert(!(ctx->slice_size[i] & 3));
}
avctx->execute(avctx, dnxhd_encode_thread, (void**)&ctx->thread[0], NULL, avctx->thread_count, sizeof(void*));
AV_WB32(buf + ctx->cid_table->coding_unit_size - 4, 0x600DC0DE); // EOF
if (ctx->interlaced && first_field) {
first_field = 0;
ctx->cur_field ^= 1;
buf += ctx->cid_table->coding_unit_size;
buf_size -= ctx->cid_table->coding_unit_size;
goto encode_coding_unit;
}
ctx->frame.quality = ctx->qscale*FF_QP2LAMBDA;
return ctx->cid_table->frame_size;
} | true | FFmpeg | 301a24de52f5baa09beff0958327af2c2a7005dc | static int dnxhd_encode_picture(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data)
{
DNXHDEncContext *ctx = avctx->priv_data;
int first_field = 1;
int offset, i, ret;
if (buf_size < ctx->cid_table->frame_size) {
av_log(avctx, AV_LOG_ERROR, "output buffer is too small to compress picture\n");
return -1;
}
dnxhd_load_picture(ctx, data);
encode_coding_unit:
for (i = 0; i < 3; i++) {
ctx->src[i] = ctx->frame.data[i];
if (ctx->interlaced && ctx->cur_field)
ctx->src[i] += ctx->frame.linesize[i];
}
dnxhd_write_header(avctx, buf);
if (avctx->mb_decision == FF_MB_DECISION_RD)
ret = dnxhd_encode_rdo(avctx, ctx);
else
ret = dnxhd_encode_fast(avctx, ctx);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "picture could not fit ratecontrol constraints\n");
return -1;
}
dnxhd_setup_threads_slices(ctx, buf);
offset = 0;
for (i = 0; i < ctx->m.mb_height; i++) {
AV_WB32(ctx->msip + i * 4, offset);
offset += ctx->slice_size[i];
assert(!(ctx->slice_size[i] & 3));
}
avctx->execute(avctx, dnxhd_encode_thread, (void**)&ctx->thread[0], NULL, avctx->thread_count, sizeof(void*));
AV_WB32(buf + ctx->cid_table->coding_unit_size - 4, 0x600DC0DE);
if (ctx->interlaced && first_field) {
first_field = 0;
ctx->cur_field ^= 1;
buf += ctx->cid_table->coding_unit_size;
buf_size -= ctx->cid_table->coding_unit_size;
goto encode_coding_unit;
}
ctx->frame.quality = ctx->qscale*FF_QP2LAMBDA;
return ctx->cid_table->frame_size;
} | {
"code": [],
"line_no": []
} | static int FUNC_0(AVCodecContext *VAR_0, unsigned char *VAR_1, int VAR_2, void *VAR_3)
{
DNXHDEncContext *ctx = VAR_0->priv_data;
int VAR_4 = 1;
int VAR_5, VAR_6, VAR_7;
if (VAR_2 < ctx->cid_table->frame_size) {
av_log(VAR_0, AV_LOG_ERROR, "output buffer is too small to compress picture\n");
return -1;
}
dnxhd_load_picture(ctx, VAR_3);
encode_coding_unit:
for (VAR_6 = 0; VAR_6 < 3; VAR_6++) {
ctx->src[VAR_6] = ctx->frame.VAR_3[VAR_6];
if (ctx->interlaced && ctx->cur_field)
ctx->src[VAR_6] += ctx->frame.linesize[VAR_6];
}
dnxhd_write_header(VAR_0, VAR_1);
if (VAR_0->mb_decision == FF_MB_DECISION_RD)
VAR_7 = dnxhd_encode_rdo(VAR_0, ctx);
else
VAR_7 = dnxhd_encode_fast(VAR_0, ctx);
if (VAR_7 < 0) {
av_log(VAR_0, AV_LOG_ERROR, "picture could not fit ratecontrol constraints\n");
return -1;
}
dnxhd_setup_threads_slices(ctx, VAR_1);
VAR_5 = 0;
for (VAR_6 = 0; VAR_6 < ctx->m.mb_height; VAR_6++) {
AV_WB32(ctx->msip + VAR_6 * 4, VAR_5);
VAR_5 += ctx->slice_size[VAR_6];
assert(!(ctx->slice_size[VAR_6] & 3));
}
VAR_0->execute(VAR_0, dnxhd_encode_thread, (void**)&ctx->thread[0], NULL, VAR_0->thread_count, sizeof(void*));
AV_WB32(VAR_1 + ctx->cid_table->coding_unit_size - 4, 0x600DC0DE);
if (ctx->interlaced && VAR_4) {
VAR_4 = 0;
ctx->cur_field ^= 1;
VAR_1 += ctx->cid_table->coding_unit_size;
VAR_2 -= ctx->cid_table->coding_unit_size;
goto encode_coding_unit;
}
ctx->frame.quality = ctx->qscale*FF_QP2LAMBDA;
return ctx->cid_table->frame_size;
} | [
"static int FUNC_0(AVCodecContext *VAR_0, unsigned char *VAR_1, int VAR_2, void *VAR_3)\n{",
"DNXHDEncContext *ctx = VAR_0->priv_data;",
"int VAR_4 = 1;",
"int VAR_5, VAR_6, VAR_7;",
"if (VAR_2 < ctx->cid_table->frame_size) {",
"av_log(VAR_0, AV_LOG_ERROR, \"output buffer is too small to compress picture\\n\");",
"return -1;",
"}",
"dnxhd_load_picture(ctx, VAR_3);",
"encode_coding_unit:\nfor (VAR_6 = 0; VAR_6 < 3; VAR_6++) {",
"ctx->src[VAR_6] = ctx->frame.VAR_3[VAR_6];",
"if (ctx->interlaced && ctx->cur_field)\nctx->src[VAR_6] += ctx->frame.linesize[VAR_6];",
"}",
"dnxhd_write_header(VAR_0, VAR_1);",
"if (VAR_0->mb_decision == FF_MB_DECISION_RD)\nVAR_7 = dnxhd_encode_rdo(VAR_0, ctx);",
"else\nVAR_7 = dnxhd_encode_fast(VAR_0, ctx);",
"if (VAR_7 < 0) {",
"av_log(VAR_0, AV_LOG_ERROR, \"picture could not fit ratecontrol constraints\\n\");",
"return -1;",
"}",
"dnxhd_setup_threads_slices(ctx, VAR_1);",
"VAR_5 = 0;",
"for (VAR_6 = 0; VAR_6 < ctx->m.mb_height; VAR_6++) {",
"AV_WB32(ctx->msip + VAR_6 * 4, VAR_5);",
"VAR_5 += ctx->slice_size[VAR_6];",
"assert(!(ctx->slice_size[VAR_6] & 3));",
"}",
"VAR_0->execute(VAR_0, dnxhd_encode_thread, (void**)&ctx->thread[0], NULL, VAR_0->thread_count, sizeof(void*));",
"AV_WB32(VAR_1 + ctx->cid_table->coding_unit_size - 4, 0x600DC0DE);",
"if (ctx->interlaced && VAR_4) {",
"VAR_4 = 0;",
"ctx->cur_field ^= 1;",
"VAR_1 += ctx->cid_table->coding_unit_size;",
"VAR_2 -= ctx->cid_table->coding_unit_size;",
"goto encode_coding_unit;",
"}",
"ctx->frame.quality = ctx->qscale*FF_QP2LAMBDA;",
"return ctx->cid_table->frame_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
] | [
[
1,
2
],
[
3
],
[
4
],
[
5
],
[
6
],
[
7
],
[
8
],
[
9
],
[
10
],
[
11,
12
],
[
13
],
[
14,
15
],
[
16
],
[
17
],
[
18,
19
],
[
20,
21
],
[
22
],
[
23
],
[
24
],
[
25
],
[
26
],
[
27
],
[
28
],
[
29
],
[
30
],
[
31
],
[
32
],
[
33
],
[
34
],
[
35
],
[
36
],
[
37
],
[
38
],
[
39
],
[
40
],
[
41
],
[
42
],
[
43
],
[
44
]
] |
19,713 | static void mb_cpu_class_init(ObjectClass *oc, void *data)
{
DeviceClass *dc = DEVICE_CLASS(oc);
CPUClass *cc = CPU_CLASS(oc);
MicroBlazeCPUClass *mcc = MICROBLAZE_CPU_CLASS(oc);
mcc->parent_realize = dc->realize;
dc->realize = mb_cpu_realizefn;
mcc->parent_reset = cc->reset;
cc->reset = mb_cpu_reset;
cc->has_work = mb_cpu_has_work;
cc->do_interrupt = mb_cpu_do_interrupt;
cc->cpu_exec_interrupt = mb_cpu_exec_interrupt;
cc->dump_state = mb_cpu_dump_state;
cc->set_pc = mb_cpu_set_pc;
cc->gdb_read_register = mb_cpu_gdb_read_register;
cc->gdb_write_register = mb_cpu_gdb_write_register;
#ifdef CONFIG_USER_ONLY
cc->handle_mmu_fault = mb_cpu_handle_mmu_fault;
#else
cc->do_unassigned_access = mb_cpu_unassigned_access;
cc->get_phys_page_debug = mb_cpu_get_phys_page_debug;
#endif
dc->vmsd = &vmstate_mb_cpu;
dc->props = mb_properties;
cc->gdb_num_core_regs = 32 + 5;
cc->disas_set_info = mb_disas_set_info;
} | true | qemu | 4c315c27661502a0813b129e41c0bf640c34a8d6 | static void mb_cpu_class_init(ObjectClass *oc, void *data)
{
DeviceClass *dc = DEVICE_CLASS(oc);
CPUClass *cc = CPU_CLASS(oc);
MicroBlazeCPUClass *mcc = MICROBLAZE_CPU_CLASS(oc);
mcc->parent_realize = dc->realize;
dc->realize = mb_cpu_realizefn;
mcc->parent_reset = cc->reset;
cc->reset = mb_cpu_reset;
cc->has_work = mb_cpu_has_work;
cc->do_interrupt = mb_cpu_do_interrupt;
cc->cpu_exec_interrupt = mb_cpu_exec_interrupt;
cc->dump_state = mb_cpu_dump_state;
cc->set_pc = mb_cpu_set_pc;
cc->gdb_read_register = mb_cpu_gdb_read_register;
cc->gdb_write_register = mb_cpu_gdb_write_register;
#ifdef CONFIG_USER_ONLY
cc->handle_mmu_fault = mb_cpu_handle_mmu_fault;
#else
cc->do_unassigned_access = mb_cpu_unassigned_access;
cc->get_phys_page_debug = mb_cpu_get_phys_page_debug;
#endif
dc->vmsd = &vmstate_mb_cpu;
dc->props = mb_properties;
cc->gdb_num_core_regs = 32 + 5;
cc->disas_set_info = mb_disas_set_info;
} | {
"code": [],
"line_no": []
} | static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)
{
DeviceClass *dc = DEVICE_CLASS(VAR_0);
CPUClass *cc = CPU_CLASS(VAR_0);
MicroBlazeCPUClass *mcc = MICROBLAZE_CPU_CLASS(VAR_0);
mcc->parent_realize = dc->realize;
dc->realize = mb_cpu_realizefn;
mcc->parent_reset = cc->reset;
cc->reset = mb_cpu_reset;
cc->has_work = mb_cpu_has_work;
cc->do_interrupt = mb_cpu_do_interrupt;
cc->cpu_exec_interrupt = mb_cpu_exec_interrupt;
cc->dump_state = mb_cpu_dump_state;
cc->set_pc = mb_cpu_set_pc;
cc->gdb_read_register = mb_cpu_gdb_read_register;
cc->gdb_write_register = mb_cpu_gdb_write_register;
#ifdef CONFIG_USER_ONLY
cc->handle_mmu_fault = mb_cpu_handle_mmu_fault;
#else
cc->do_unassigned_access = mb_cpu_unassigned_access;
cc->get_phys_page_debug = mb_cpu_get_phys_page_debug;
#endif
dc->vmsd = &vmstate_mb_cpu;
dc->props = mb_properties;
cc->gdb_num_core_regs = 32 + 5;
cc->disas_set_info = mb_disas_set_info;
} | [
"static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{",
"DeviceClass *dc = DEVICE_CLASS(VAR_0);",
"CPUClass *cc = CPU_CLASS(VAR_0);",
"MicroBlazeCPUClass *mcc = MICROBLAZE_CPU_CLASS(VAR_0);",
"mcc->parent_realize = dc->realize;",
"dc->realize = mb_cpu_realizefn;",
"mcc->parent_reset = cc->reset;",
"cc->reset = mb_cpu_reset;",
"cc->has_work = mb_cpu_has_work;",
"cc->do_interrupt = mb_cpu_do_interrupt;",
"cc->cpu_exec_interrupt = mb_cpu_exec_interrupt;",
"cc->dump_state = mb_cpu_dump_state;",
"cc->set_pc = mb_cpu_set_pc;",
"cc->gdb_read_register = mb_cpu_gdb_read_register;",
"cc->gdb_write_register = mb_cpu_gdb_write_register;",
"#ifdef CONFIG_USER_ONLY\ncc->handle_mmu_fault = mb_cpu_handle_mmu_fault;",
"#else\ncc->do_unassigned_access = mb_cpu_unassigned_access;",
"cc->get_phys_page_debug = mb_cpu_get_phys_page_debug;",
"#endif\ndc->vmsd = &vmstate_mb_cpu;",
"dc->props = mb_properties;",
"cc->gdb_num_core_regs = 32 + 5;",
"cc->disas_set_info = mb_disas_set_info;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
2
],
[
3
],
[
4
],
[
5
],
[
6
],
[
7
],
[
8
],
[
9
],
[
10
],
[
11
],
[
12
],
[
13
],
[
14
],
[
15
],
[
16
],
[
17,
18
],
[
19,
20
],
[
21
],
[
22,
23
],
[
24
],
[
25
],
[
26
],
[
27
]
] |
19,714 | static int vfio_connect_container(VFIOGroup *group, AddressSpace *as,
Error **errp)
{
VFIOContainer *container;
int ret, fd;
VFIOAddressSpace *space;
space = vfio_get_address_space(as);
QLIST_FOREACH(container, &space->containers, next) {
if (!ioctl(group->fd, VFIO_GROUP_SET_CONTAINER, &container->fd)) {
group->container = container;
QLIST_INSERT_HEAD(&container->group_list, group, container_next);
vfio_kvm_device_add_group(group);
return 0;
fd = qemu_open("/dev/vfio/vfio", O_RDWR);
if (fd < 0) {
error_setg_errno(errp, errno, "failed to open /dev/vfio/vfio");
ret = -errno;
goto put_space_exit;
ret = ioctl(fd, VFIO_GET_API_VERSION);
if (ret != VFIO_API_VERSION) {
error_setg(errp, "supported vfio version: %d, "
"reported version: %d", VFIO_API_VERSION, ret);
ret = -EINVAL;
goto close_fd_exit;
container = g_malloc0(sizeof(*container));
container->space = space;
container->fd = fd;
QLIST_INIT(&container->giommu_list);
QLIST_INIT(&container->hostwin_list);
if (ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_TYPE1_IOMMU) ||
ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_TYPE1v2_IOMMU)) {
bool v2 = !!ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_TYPE1v2_IOMMU);
struct vfio_iommu_type1_info info;
ret = ioctl(group->fd, VFIO_GROUP_SET_CONTAINER, &fd);
error_setg_errno(errp, errno, "failed to set group container");
ret = -errno;
goto free_container_exit;
container->iommu_type = v2 ? VFIO_TYPE1v2_IOMMU : VFIO_TYPE1_IOMMU;
error_setg_errno(errp, errno, "failed to set iommu for container");
ret = -errno;
goto free_container_exit;
/*
* FIXME: This assumes that a Type1 IOMMU can map any 64-bit
* IOVA whatsoever. That's not actually true, but the current
* kernel interface doesn't tell us what it can map, and the
* existing Type1 IOMMUs generally support any IOVA we're
* going to actually try in practice.
*/
info.argsz = sizeof(info);
ret = ioctl(fd, VFIO_IOMMU_GET_INFO, &info);
/* Ignore errors */
if (ret || !(info.flags & VFIO_IOMMU_INFO_PGSIZES)) {
/* Assume 4k IOVA page size */
info.iova_pgsizes = 4096;
vfio_host_win_add(container, 0, (hwaddr)-1, info.iova_pgsizes);
} else if (ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_SPAPR_TCE_IOMMU) ||
ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_SPAPR_TCE_v2_IOMMU)) {
struct vfio_iommu_spapr_tce_info info;
bool v2 = !!ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_SPAPR_TCE_v2_IOMMU);
ret = ioctl(group->fd, VFIO_GROUP_SET_CONTAINER, &fd);
error_setg_errno(errp, errno, "failed to set group container");
ret = -errno;
goto free_container_exit;
container->iommu_type =
v2 ? VFIO_SPAPR_TCE_v2_IOMMU : VFIO_SPAPR_TCE_IOMMU;
error_setg_errno(errp, errno, "failed to set iommu for container");
ret = -errno;
goto free_container_exit;
/*
* The host kernel code implementing VFIO_IOMMU_DISABLE is called
* when container fd is closed so we do not call it explicitly
* in this file.
*/
if (!v2) {
ret = ioctl(fd, VFIO_IOMMU_ENABLE);
error_setg_errno(errp, errno, "failed to enable container");
ret = -errno;
goto free_container_exit;
} else {
container->prereg_listener = vfio_prereg_listener;
memory_listener_register(&container->prereg_listener,
&address_space_memory);
if (container->error) {
memory_listener_unregister(&container->prereg_listener);
ret = container->error;
error_setg(errp,
"RAM memory listener initialization failed for container");
goto free_container_exit;
info.argsz = sizeof(info);
ret = ioctl(fd, VFIO_IOMMU_SPAPR_TCE_GET_INFO, &info);
error_setg_errno(errp, errno,
"VFIO_IOMMU_SPAPR_TCE_GET_INFO failed");
ret = -errno;
if (v2) {
memory_listener_unregister(&container->prereg_listener);
goto free_container_exit;
if (v2) {
/*
* There is a default window in just created container.
* To make region_add/del simpler, we better remove this
* window now and let those iommu_listener callbacks
* create/remove them when needed.
*/
ret = vfio_spapr_remove_window(container, info.dma32_window_start);
error_setg_errno(errp, -ret,
"failed to remove existing window");
goto free_container_exit;
} else {
/* The default table uses 4K pages */
vfio_host_win_add(container, info.dma32_window_start,
info.dma32_window_start +
info.dma32_window_size - 1,
0x1000);
} else {
error_setg(errp, "No available IOMMU models");
ret = -EINVAL;
goto free_container_exit;
vfio_kvm_device_add_group(group);
QLIST_INIT(&container->group_list);
QLIST_INSERT_HEAD(&space->containers, container, next);
group->container = container;
QLIST_INSERT_HEAD(&container->group_list, group, container_next);
container->listener = vfio_memory_listener;
memory_listener_register(&container->listener, container->space->as);
if (container->error) {
ret = container->error;
error_setg_errno(errp, -ret,
"memory listener initialization failed for container");
goto listener_release_exit;
container->initialized = true;
return 0;
listener_release_exit:
QLIST_REMOVE(group, container_next);
QLIST_REMOVE(container, next);
vfio_kvm_device_del_group(group);
vfio_listener_release(container);
free_container_exit:
g_free(container);
close_fd_exit:
close(fd);
put_space_exit:
vfio_put_address_space(space);
return ret;
| true | qemu | c6e7958eb76ed267f7254b97f89773874df50e48 | static int vfio_connect_container(VFIOGroup *group, AddressSpace *as,
Error **errp)
{
VFIOContainer *container;
int ret, fd;
VFIOAddressSpace *space;
space = vfio_get_address_space(as);
QLIST_FOREACH(container, &space->containers, next) {
if (!ioctl(group->fd, VFIO_GROUP_SET_CONTAINER, &container->fd)) {
group->container = container;
QLIST_INSERT_HEAD(&container->group_list, group, container_next);
vfio_kvm_device_add_group(group);
return 0;
fd = qemu_open("/dev/vfio/vfio", O_RDWR);
if (fd < 0) {
error_setg_errno(errp, errno, "failed to open /dev/vfio/vfio");
ret = -errno;
goto put_space_exit;
ret = ioctl(fd, VFIO_GET_API_VERSION);
if (ret != VFIO_API_VERSION) {
error_setg(errp, "supported vfio version: %d, "
"reported version: %d", VFIO_API_VERSION, ret);
ret = -EINVAL;
goto close_fd_exit;
container = g_malloc0(sizeof(*container));
container->space = space;
container->fd = fd;
QLIST_INIT(&container->giommu_list);
QLIST_INIT(&container->hostwin_list);
if (ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_TYPE1_IOMMU) ||
ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_TYPE1v2_IOMMU)) {
bool v2 = !!ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_TYPE1v2_IOMMU);
struct vfio_iommu_type1_info info;
ret = ioctl(group->fd, VFIO_GROUP_SET_CONTAINER, &fd);
error_setg_errno(errp, errno, "failed to set group container");
ret = -errno;
goto free_container_exit;
container->iommu_type = v2 ? VFIO_TYPE1v2_IOMMU : VFIO_TYPE1_IOMMU;
error_setg_errno(errp, errno, "failed to set iommu for container");
ret = -errno;
goto free_container_exit;
info.argsz = sizeof(info);
ret = ioctl(fd, VFIO_IOMMU_GET_INFO, &info);
if (ret || !(info.flags & VFIO_IOMMU_INFO_PGSIZES)) {
info.iova_pgsizes = 4096;
vfio_host_win_add(container, 0, (hwaddr)-1, info.iova_pgsizes);
} else if (ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_SPAPR_TCE_IOMMU) ||
ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_SPAPR_TCE_v2_IOMMU)) {
struct vfio_iommu_spapr_tce_info info;
bool v2 = !!ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_SPAPR_TCE_v2_IOMMU);
ret = ioctl(group->fd, VFIO_GROUP_SET_CONTAINER, &fd);
error_setg_errno(errp, errno, "failed to set group container");
ret = -errno;
goto free_container_exit;
container->iommu_type =
v2 ? VFIO_SPAPR_TCE_v2_IOMMU : VFIO_SPAPR_TCE_IOMMU;
error_setg_errno(errp, errno, "failed to set iommu for container");
ret = -errno;
goto free_container_exit;
if (!v2) {
ret = ioctl(fd, VFIO_IOMMU_ENABLE);
error_setg_errno(errp, errno, "failed to enable container");
ret = -errno;
goto free_container_exit;
} else {
container->prereg_listener = vfio_prereg_listener;
memory_listener_register(&container->prereg_listener,
&address_space_memory);
if (container->error) {
memory_listener_unregister(&container->prereg_listener);
ret = container->error;
error_setg(errp,
"RAM memory listener initialization failed for container");
goto free_container_exit;
info.argsz = sizeof(info);
ret = ioctl(fd, VFIO_IOMMU_SPAPR_TCE_GET_INFO, &info);
error_setg_errno(errp, errno,
"VFIO_IOMMU_SPAPR_TCE_GET_INFO failed");
ret = -errno;
if (v2) {
memory_listener_unregister(&container->prereg_listener);
goto free_container_exit;
if (v2) {
ret = vfio_spapr_remove_window(container, info.dma32_window_start);
error_setg_errno(errp, -ret,
"failed to remove existing window");
goto free_container_exit;
} else {
vfio_host_win_add(container, info.dma32_window_start,
info.dma32_window_start +
info.dma32_window_size - 1,
0x1000);
} else {
error_setg(errp, "No available IOMMU models");
ret = -EINVAL;
goto free_container_exit;
vfio_kvm_device_add_group(group);
QLIST_INIT(&container->group_list);
QLIST_INSERT_HEAD(&space->containers, container, next);
group->container = container;
QLIST_INSERT_HEAD(&container->group_list, group, container_next);
container->listener = vfio_memory_listener;
memory_listener_register(&container->listener, container->space->as);
if (container->error) {
ret = container->error;
error_setg_errno(errp, -ret,
"memory listener initialization failed for container");
goto listener_release_exit;
container->initialized = true;
return 0;
listener_release_exit:
QLIST_REMOVE(group, container_next);
QLIST_REMOVE(container, next);
vfio_kvm_device_del_group(group);
vfio_listener_release(container);
free_container_exit:
g_free(container);
close_fd_exit:
close(fd);
put_space_exit:
vfio_put_address_space(space);
return ret;
| {
"code": [],
"line_no": []
} | static int FUNC_0(VFIOGroup *VAR_0, AddressSpace *VAR_1,
Error **VAR_2)
{
VFIOContainer *container;
int VAR_3, VAR_4;
VFIOAddressSpace *space;
space = vfio_get_address_space(VAR_1);
QLIST_FOREACH(container, &space->containers, next) {
if (!ioctl(VAR_0->VAR_4, VFIO_GROUP_SET_CONTAINER, &container->VAR_4)) {
VAR_0->container = container;
QLIST_INSERT_HEAD(&container->group_list, VAR_0, container_next);
vfio_kvm_device_add_group(VAR_0);
return 0;
VAR_4 = qemu_open("/dev/vfio/vfio", O_RDWR);
if (VAR_4 < 0) {
error_setg_errno(VAR_2, errno, "failed to open /dev/vfio/vfio");
VAR_3 = -errno;
goto put_space_exit;
VAR_3 = ioctl(VAR_4, VFIO_GET_API_VERSION);
if (VAR_3 != VFIO_API_VERSION) {
error_setg(VAR_2, "supported vfio version: %d, "
"reported version: %d", VFIO_API_VERSION, VAR_3);
VAR_3 = -EINVAL;
goto close_fd_exit;
container = g_malloc0(sizeof(*container));
container->space = space;
container->VAR_4 = VAR_4;
QLIST_INIT(&container->giommu_list);
QLIST_INIT(&container->hostwin_list);
if (ioctl(VAR_4, VFIO_CHECK_EXTENSION, VFIO_TYPE1_IOMMU) ||
ioctl(VAR_4, VFIO_CHECK_EXTENSION, VFIO_TYPE1v2_IOMMU)) {
bool v2 = !!ioctl(VAR_4, VFIO_CHECK_EXTENSION, VFIO_TYPE1v2_IOMMU);
struct vfio_iommu_type1_info info;
VAR_3 = ioctl(VAR_0->VAR_4, VFIO_GROUP_SET_CONTAINER, &VAR_4);
error_setg_errno(VAR_2, errno, "failed to set VAR_0 container");
VAR_3 = -errno;
goto free_container_exit;
container->iommu_type = v2 ? VFIO_TYPE1v2_IOMMU : VFIO_TYPE1_IOMMU;
error_setg_errno(VAR_2, errno, "failed to set iommu for container");
VAR_3 = -errno;
goto free_container_exit;
info.argsz = sizeof(info);
VAR_3 = ioctl(VAR_4, VFIO_IOMMU_GET_INFO, &info);
if (VAR_3 || !(info.flags & VFIO_IOMMU_INFO_PGSIZES)) {
info.iova_pgsizes = 4096;
vfio_host_win_add(container, 0, (hwaddr)-1, info.iova_pgsizes);
} else if (ioctl(VAR_4, VFIO_CHECK_EXTENSION, VFIO_SPAPR_TCE_IOMMU) ||
ioctl(VAR_4, VFIO_CHECK_EXTENSION, VFIO_SPAPR_TCE_v2_IOMMU)) {
struct vfio_iommu_spapr_tce_info info;
bool v2 = !!ioctl(VAR_4, VFIO_CHECK_EXTENSION, VFIO_SPAPR_TCE_v2_IOMMU);
VAR_3 = ioctl(VAR_0->VAR_4, VFIO_GROUP_SET_CONTAINER, &VAR_4);
error_setg_errno(VAR_2, errno, "failed to set VAR_0 container");
VAR_3 = -errno;
goto free_container_exit;
container->iommu_type =
v2 ? VFIO_SPAPR_TCE_v2_IOMMU : VFIO_SPAPR_TCE_IOMMU;
error_setg_errno(VAR_2, errno, "failed to set iommu for container");
VAR_3 = -errno;
goto free_container_exit;
if (!v2) {
VAR_3 = ioctl(VAR_4, VFIO_IOMMU_ENABLE);
error_setg_errno(VAR_2, errno, "failed to enable container");
VAR_3 = -errno;
goto free_container_exit;
} else {
container->prereg_listener = vfio_prereg_listener;
memory_listener_register(&container->prereg_listener,
&address_space_memory);
if (container->error) {
memory_listener_unregister(&container->prereg_listener);
VAR_3 = container->error;
error_setg(VAR_2,
"RAM memory listener initialization failed for container");
goto free_container_exit;
info.argsz = sizeof(info);
VAR_3 = ioctl(VAR_4, VFIO_IOMMU_SPAPR_TCE_GET_INFO, &info);
error_setg_errno(VAR_2, errno,
"VFIO_IOMMU_SPAPR_TCE_GET_INFO failed");
VAR_3 = -errno;
if (v2) {
memory_listener_unregister(&container->prereg_listener);
goto free_container_exit;
if (v2) {
VAR_3 = vfio_spapr_remove_window(container, info.dma32_window_start);
error_setg_errno(VAR_2, -VAR_3,
"failed to remove existing window");
goto free_container_exit;
} else {
vfio_host_win_add(container, info.dma32_window_start,
info.dma32_window_start +
info.dma32_window_size - 1,
0x1000);
} else {
error_setg(VAR_2, "No available IOMMU models");
VAR_3 = -EINVAL;
goto free_container_exit;
vfio_kvm_device_add_group(VAR_0);
QLIST_INIT(&container->group_list);
QLIST_INSERT_HEAD(&space->containers, container, next);
VAR_0->container = container;
QLIST_INSERT_HEAD(&container->group_list, VAR_0, container_next);
container->listener = vfio_memory_listener;
memory_listener_register(&container->listener, container->space->VAR_1);
if (container->error) {
VAR_3 = container->error;
error_setg_errno(VAR_2, -VAR_3,
"memory listener initialization failed for container");
goto listener_release_exit;
container->initialized = true;
return 0;
listener_release_exit:
QLIST_REMOVE(VAR_0, container_next);
QLIST_REMOVE(container, next);
vfio_kvm_device_del_group(VAR_0);
vfio_listener_release(container);
free_container_exit:
g_free(container);
close_fd_exit:
close(VAR_4);
put_space_exit:
vfio_put_address_space(space);
return VAR_3;
| [
"static int FUNC_0(VFIOGroup *VAR_0, AddressSpace *VAR_1,\nError **VAR_2)\n{",
"VFIOContainer *container;",
"int VAR_3, VAR_4;",
"VFIOAddressSpace *space;",
"space = vfio_get_address_space(VAR_1);",
"QLIST_FOREACH(container, &space->containers, next) {",
"if (!ioctl(VAR_0->VAR_4, VFIO_GROUP_SET_CONTAINER, &container->VAR_4)) {",
"VAR_0->container = container;",
"QLIST_INSERT_HEAD(&container->group_list, VAR_0, container_next);",
"vfio_kvm_device_add_group(VAR_0);",
"return 0;",
"VAR_4 = qemu_open(\"/dev/vfio/vfio\", O_RDWR);",
"if (VAR_4 < 0) {",
"error_setg_errno(VAR_2, errno, \"failed to open /dev/vfio/vfio\");",
"VAR_3 = -errno;",
"goto put_space_exit;",
"VAR_3 = ioctl(VAR_4, VFIO_GET_API_VERSION);",
"if (VAR_3 != VFIO_API_VERSION) {",
"error_setg(VAR_2, \"supported vfio version: %d, \"\n\"reported version: %d\", VFIO_API_VERSION, VAR_3);",
"VAR_3 = -EINVAL;",
"goto close_fd_exit;",
"container = g_malloc0(sizeof(*container));",
"container->space = space;",
"container->VAR_4 = VAR_4;",
"QLIST_INIT(&container->giommu_list);",
"QLIST_INIT(&container->hostwin_list);",
"if (ioctl(VAR_4, VFIO_CHECK_EXTENSION, VFIO_TYPE1_IOMMU) ||\nioctl(VAR_4, VFIO_CHECK_EXTENSION, VFIO_TYPE1v2_IOMMU)) {",
"bool v2 = !!ioctl(VAR_4, VFIO_CHECK_EXTENSION, VFIO_TYPE1v2_IOMMU);",
"struct vfio_iommu_type1_info info;",
"VAR_3 = ioctl(VAR_0->VAR_4, VFIO_GROUP_SET_CONTAINER, &VAR_4);",
"error_setg_errno(VAR_2, errno, \"failed to set VAR_0 container\");",
"VAR_3 = -errno;",
"goto free_container_exit;",
"container->iommu_type = v2 ? VFIO_TYPE1v2_IOMMU : VFIO_TYPE1_IOMMU;",
"error_setg_errno(VAR_2, errno, \"failed to set iommu for container\");",
"VAR_3 = -errno;",
"goto free_container_exit;",
"info.argsz = sizeof(info);",
"VAR_3 = ioctl(VAR_4, VFIO_IOMMU_GET_INFO, &info);",
"if (VAR_3 || !(info.flags & VFIO_IOMMU_INFO_PGSIZES)) {",
"info.iova_pgsizes = 4096;",
"vfio_host_win_add(container, 0, (hwaddr)-1, info.iova_pgsizes);",
"} else if (ioctl(VAR_4, VFIO_CHECK_EXTENSION, VFIO_SPAPR_TCE_IOMMU) ||",
"ioctl(VAR_4, VFIO_CHECK_EXTENSION, VFIO_SPAPR_TCE_v2_IOMMU)) {",
"struct vfio_iommu_spapr_tce_info info;",
"bool v2 = !!ioctl(VAR_4, VFIO_CHECK_EXTENSION, VFIO_SPAPR_TCE_v2_IOMMU);",
"VAR_3 = ioctl(VAR_0->VAR_4, VFIO_GROUP_SET_CONTAINER, &VAR_4);",
"error_setg_errno(VAR_2, errno, \"failed to set VAR_0 container\");",
"VAR_3 = -errno;",
"goto free_container_exit;",
"container->iommu_type =\nv2 ? VFIO_SPAPR_TCE_v2_IOMMU : VFIO_SPAPR_TCE_IOMMU;",
"error_setg_errno(VAR_2, errno, \"failed to set iommu for container\");",
"VAR_3 = -errno;",
"goto free_container_exit;",
"if (!v2) {",
"VAR_3 = ioctl(VAR_4, VFIO_IOMMU_ENABLE);",
"error_setg_errno(VAR_2, errno, \"failed to enable container\");",
"VAR_3 = -errno;",
"goto free_container_exit;",
"} else {",
"container->prereg_listener = vfio_prereg_listener;",
"memory_listener_register(&container->prereg_listener,\n&address_space_memory);",
"if (container->error) {",
"memory_listener_unregister(&container->prereg_listener);",
"VAR_3 = container->error;",
"error_setg(VAR_2,\n\"RAM memory listener initialization failed for container\");",
"goto free_container_exit;",
"info.argsz = sizeof(info);",
"VAR_3 = ioctl(VAR_4, VFIO_IOMMU_SPAPR_TCE_GET_INFO, &info);",
"error_setg_errno(VAR_2, errno,\n\"VFIO_IOMMU_SPAPR_TCE_GET_INFO failed\");",
"VAR_3 = -errno;",
"if (v2) {",
"memory_listener_unregister(&container->prereg_listener);",
"goto free_container_exit;",
"if (v2) {",
"VAR_3 = vfio_spapr_remove_window(container, info.dma32_window_start);",
"error_setg_errno(VAR_2, -VAR_3,\n\"failed to remove existing window\");",
"goto free_container_exit;",
"} else {",
"vfio_host_win_add(container, info.dma32_window_start,\ninfo.dma32_window_start +\ninfo.dma32_window_size - 1,\n0x1000);",
"} else {",
"error_setg(VAR_2, \"No available IOMMU models\");",
"VAR_3 = -EINVAL;",
"goto free_container_exit;",
"vfio_kvm_device_add_group(VAR_0);",
"QLIST_INIT(&container->group_list);",
"QLIST_INSERT_HEAD(&space->containers, container, next);",
"VAR_0->container = container;",
"QLIST_INSERT_HEAD(&container->group_list, VAR_0, container_next);",
"container->listener = vfio_memory_listener;",
"memory_listener_register(&container->listener, container->space->VAR_1);",
"if (container->error) {",
"VAR_3 = container->error;",
"error_setg_errno(VAR_2, -VAR_3,\n\"memory listener initialization failed for container\");",
"goto listener_release_exit;",
"container->initialized = true;",
"return 0;",
"listener_release_exit:\nQLIST_REMOVE(VAR_0, container_next);",
"QLIST_REMOVE(container, next);",
"vfio_kvm_device_del_group(VAR_0);",
"vfio_listener_release(container);",
"free_container_exit:\ng_free(container);",
"close_fd_exit:\nclose(VAR_4);",
"put_space_exit:\nvfio_put_address_space(space);",
"return VAR_3;"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
48
],
[
50
],
[
52,
54
],
[
56
],
[
58
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73,
75
],
[
77
],
[
79
],
[
83
],
[
86
],
[
88
],
[
90
],
[
95
],
[
99
],
[
101
],
[
103
],
[
122
],
[
124
],
[
128
],
[
132
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
147
],
[
150
],
[
152
],
[
154
],
[
157,
159
],
[
168
],
[
170
],
[
172
],
[
187
],
[
189
],
[
192
],
[
194
],
[
196
],
[
199
],
[
201
],
[
205,
207
],
[
209
],
[
211
],
[
213
],
[
215,
217
],
[
219
],
[
225
],
[
227
],
[
230,
232
],
[
234
],
[
236
],
[
238
],
[
241
],
[
246
],
[
260
],
[
263,
265
],
[
267
],
[
270
],
[
274,
276,
278,
280
],
[
283
],
[
285
],
[
287
],
[
289
],
[
294
],
[
298
],
[
300
],
[
304
],
[
306
],
[
310
],
[
314
],
[
318
],
[
320
],
[
322,
324
],
[
326
],
[
331
],
[
335
],
[
337,
339
],
[
341
],
[
343
],
[
345
],
[
349,
351
],
[
355,
357
],
[
361,
363
],
[
367
]
] |
19,715 | static void FUNCC(pred4x4_top_dc)(uint8_t *_src, const uint8_t *topright, int _stride){
pixel *src = (pixel*)_src;
int stride = _stride/sizeof(pixel);
const int dc= ( src[-stride] + src[1-stride] + src[2-stride] + src[3-stride] + 2) >>2;
((pixel4*)(src+0*stride))[0]=
((pixel4*)(src+1*stride))[0]=
((pixel4*)(src+2*stride))[0]=
((pixel4*)(src+3*stride))[0]= PIXEL_SPLAT_X4(dc);
}
| true | FFmpeg | 2caf19e90f270abe1e80a3e85acaf0eb5c9d0aac | static void FUNCC(pred4x4_top_dc)(uint8_t *_src, const uint8_t *topright, int _stride){
pixel *src = (pixel*)_src;
int stride = _stride/sizeof(pixel);
const int dc= ( src[-stride] + src[1-stride] + src[2-stride] + src[3-stride] + 2) >>2;
((pixel4*)(src+0*stride))[0]=
((pixel4*)(src+1*stride))[0]=
((pixel4*)(src+2*stride))[0]=
((pixel4*)(src+3*stride))[0]= PIXEL_SPLAT_X4(dc);
}
| {
"code": [
" ((pixel4*)(src+0*stride))[0]=",
" ((pixel4*)(src+1*stride))[0]=",
" ((pixel4*)(src+2*stride))[0]=",
" ((pixel4*)(src+3*stride))[0]= PIXEL_SPLAT_X4(dc);",
" ((pixel4*)(src+0*stride))[0]=",
" ((pixel4*)(src+1*stride))[0]=",
" ((pixel4*)(src+2*stride))[0]=",
" ((pixel4*)(src+3*stride))[0]= PIXEL_SPLAT_X4(dc);",
" ((pixel4*)(src+0*stride))[0]=",
" ((pixel4*)(src+1*stride))[0]=",
" ((pixel4*)(src+2*stride))[0]=",
" ((pixel4*)(src+3*stride))[0]= PIXEL_SPLAT_X4(dc);",
" ((pixel4*)(src+0*stride))[0]=",
" ((pixel4*)(src+1*stride))[0]=",
" ((pixel4*)(src+2*stride))[0]=",
" ((pixel4*)(src+0*stride))[0]=",
" ((pixel4*)(src+1*stride))[0]=",
" ((pixel4*)(src+2*stride))[0]=",
" ((pixel4*)(src+0*stride))[0]=",
" ((pixel4*)(src+1*stride))[0]=",
" ((pixel4*)(src+2*stride))[0]="
],
"line_no": [
11,
13,
15,
17,
11,
13,
15,
17,
11,
13,
15,
17,
11,
13,
15,
11,
13,
15,
11,
13,
15
]
} | static void FUNC_0(pred4x4_top_dc)(uint8_t *_src, const uint8_t *topright, int _stride){
pixel *src = (pixel*)_src;
int VAR_0 = _stride/sizeof(pixel);
const int VAR_1= ( src[-VAR_0] + src[1-VAR_0] + src[2-VAR_0] + src[3-VAR_0] + 2) >>2;
((pixel4*)(src+0*VAR_0))[0]=
((pixel4*)(src+1*VAR_0))[0]=
((pixel4*)(src+2*VAR_0))[0]=
((pixel4*)(src+3*VAR_0))[0]= PIXEL_SPLAT_X4(VAR_1);
}
| [
"static void FUNC_0(pred4x4_top_dc)(uint8_t *_src, const uint8_t *topright, int _stride){",
"pixel *src = (pixel*)_src;",
"int VAR_0 = _stride/sizeof(pixel);",
"const int VAR_1= ( src[-VAR_0] + src[1-VAR_0] + src[2-VAR_0] + src[3-VAR_0] + 2) >>2;",
"((pixel4*)(src+0*VAR_0))[0]=\n((pixel4*)(src+1*VAR_0))[0]=\n((pixel4*)(src+2*VAR_0))[0]=\n((pixel4*)(src+3*VAR_0))[0]= PIXEL_SPLAT_X4(VAR_1);",
"}"
] | [
0,
0,
0,
0,
1,
0
] | [
[
1
],
[
3
],
[
5
],
[
7
],
[
11,
13,
15,
17
],
[
19
]
] |
19,717 | static void print_report(int is_last_report, int64_t timer_start)
{
char buf[1024];
OutputStream *ost;
AVFormatContext *oc;
int64_t total_size;
AVCodecContext *enc;
int frame_number, vid, i;
double bitrate, ti1, pts;
static int64_t last_time = -1;
static int qp_histogram[52];
if (!print_stats && !is_last_report)
return;
if (!is_last_report) {
int64_t cur_time;
/* display the report every 0.5 seconds */
cur_time = av_gettime();
if (last_time == -1) {
last_time = cur_time;
return;
}
if ((cur_time - last_time) < 500000)
return;
last_time = cur_time;
}
oc = output_files[0]->ctx;
total_size = avio_size(oc->pb);
if (total_size <= 0) // FIXME improve avio_size() so it works with non seekable output too
total_size = avio_tell(oc->pb);
if (total_size < 0) {
char errbuf[128];
av_strerror(total_size, errbuf, sizeof(errbuf));
av_log(NULL, AV_LOG_VERBOSE, "Bitrate not available, "
"avio_tell() failed: %s\n", errbuf);
total_size = 0;
}
buf[0] = '\0';
ti1 = 1e10;
vid = 0;
for (i = 0; i < nb_output_streams; i++) {
float q = -1;
ost = output_streams[i];
enc = ost->st->codec;
if (!ost->stream_copy && enc->coded_frame)
q = enc->coded_frame->quality / (float)FF_QP2LAMBDA;
if (vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) {
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "q=%2.1f ", q);
}
if (!vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) {
float t = (av_gettime() - timer_start) / 1000000.0;
frame_number = ost->frame_number;
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "frame=%5d fps=%3d q=%3.1f ",
frame_number, (t > 1) ? (int)(frame_number / t + 0.5) : 0, q);
if (is_last_report)
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "L");
if (qp_hist) {
int j;
int qp = lrintf(q);
if (qp >= 0 && qp < FF_ARRAY_ELEMS(qp_histogram))
qp_histogram[qp]++;
for (j = 0; j < 32; j++)
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%X", (int)lrintf(log2(qp_histogram[j] + 1)));
}
if (enc->flags&CODEC_FLAG_PSNR) {
int j;
double error, error_sum = 0;
double scale, scale_sum = 0;
char type[3] = { 'Y','U','V' };
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "PSNR=");
for (j = 0; j < 3; j++) {
if (is_last_report) {
error = enc->error[j];
scale = enc->width * enc->height * 255.0 * 255.0 * frame_number;
} else {
error = enc->coded_frame->error[j];
scale = enc->width * enc->height * 255.0 * 255.0;
}
if (j)
scale /= 4;
error_sum += error;
scale_sum += scale;
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%c:%2.2f ", type[j], psnr(error / scale));
}
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "*:%2.2f ", psnr(error_sum / scale_sum));
}
vid = 1;
}
/* compute min output value */
pts = (double)ost->st->pts.val * av_q2d(ost->st->time_base);
if ((pts < ti1) && (pts > 0))
ti1 = pts;
}
if (ti1 < 0.01)
ti1 = 0.01;
bitrate = (double)(total_size * 8) / ti1 / 1000.0;
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
"size=%8.0fkB time=%0.2f bitrate=%6.1fkbits/s",
(double)total_size / 1024, ti1, bitrate);
if (nb_frames_dup || nb_frames_drop)
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " dup=%d drop=%d",
nb_frames_dup, nb_frames_drop);
av_log(NULL, AV_LOG_INFO, "%s \r", buf);
fflush(stderr);
if (is_last_report) {
int64_t raw= audio_size + video_size + extra_size;
av_log(NULL, AV_LOG_INFO, "\n");
av_log(NULL, AV_LOG_INFO, "video:%1.0fkB audio:%1.0fkB global headers:%1.0fkB muxing overhead %f%%\n",
video_size / 1024.0,
audio_size / 1024.0,
extra_size / 1024.0,
100.0 * (total_size - raw) / raw
);
}
}
| true | FFmpeg | 5c79d2e12d13959fc6aed92d102c25194a06de05 | static void print_report(int is_last_report, int64_t timer_start)
{
char buf[1024];
OutputStream *ost;
AVFormatContext *oc;
int64_t total_size;
AVCodecContext *enc;
int frame_number, vid, i;
double bitrate, ti1, pts;
static int64_t last_time = -1;
static int qp_histogram[52];
if (!print_stats && !is_last_report)
return;
if (!is_last_report) {
int64_t cur_time;
cur_time = av_gettime();
if (last_time == -1) {
last_time = cur_time;
return;
}
if ((cur_time - last_time) < 500000)
return;
last_time = cur_time;
}
oc = output_files[0]->ctx;
total_size = avio_size(oc->pb);
if (total_size <= 0)
total_size = avio_tell(oc->pb);
if (total_size < 0) {
char errbuf[128];
av_strerror(total_size, errbuf, sizeof(errbuf));
av_log(NULL, AV_LOG_VERBOSE, "Bitrate not available, "
"avio_tell() failed: %s\n", errbuf);
total_size = 0;
}
buf[0] = '\0';
ti1 = 1e10;
vid = 0;
for (i = 0; i < nb_output_streams; i++) {
float q = -1;
ost = output_streams[i];
enc = ost->st->codec;
if (!ost->stream_copy && enc->coded_frame)
q = enc->coded_frame->quality / (float)FF_QP2LAMBDA;
if (vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) {
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "q=%2.1f ", q);
}
if (!vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) {
float t = (av_gettime() - timer_start) / 1000000.0;
frame_number = ost->frame_number;
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "frame=%5d fps=%3d q=%3.1f ",
frame_number, (t > 1) ? (int)(frame_number / t + 0.5) : 0, q);
if (is_last_report)
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "L");
if (qp_hist) {
int j;
int qp = lrintf(q);
if (qp >= 0 && qp < FF_ARRAY_ELEMS(qp_histogram))
qp_histogram[qp]++;
for (j = 0; j < 32; j++)
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%X", (int)lrintf(log2(qp_histogram[j] + 1)));
}
if (enc->flags&CODEC_FLAG_PSNR) {
int j;
double error, error_sum = 0;
double scale, scale_sum = 0;
char type[3] = { 'Y','U','V' };
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "PSNR=");
for (j = 0; j < 3; j++) {
if (is_last_report) {
error = enc->error[j];
scale = enc->width * enc->height * 255.0 * 255.0 * frame_number;
} else {
error = enc->coded_frame->error[j];
scale = enc->width * enc->height * 255.0 * 255.0;
}
if (j)
scale /= 4;
error_sum += error;
scale_sum += scale;
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%c:%2.2f ", type[j], psnr(error / scale));
}
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "*:%2.2f ", psnr(error_sum / scale_sum));
}
vid = 1;
}
pts = (double)ost->st->pts.val * av_q2d(ost->st->time_base);
if ((pts < ti1) && (pts > 0))
ti1 = pts;
}
if (ti1 < 0.01)
ti1 = 0.01;
bitrate = (double)(total_size * 8) / ti1 / 1000.0;
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
"size=%8.0fkB time=%0.2f bitrate=%6.1fkbits/s",
(double)total_size / 1024, ti1, bitrate);
if (nb_frames_dup || nb_frames_drop)
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " dup=%d drop=%d",
nb_frames_dup, nb_frames_drop);
av_log(NULL, AV_LOG_INFO, "%s \r", buf);
fflush(stderr);
if (is_last_report) {
int64_t raw= audio_size + video_size + extra_size;
av_log(NULL, AV_LOG_INFO, "\n");
av_log(NULL, AV_LOG_INFO, "video:%1.0fkB audio:%1.0fkB global headers:%1.0fkB muxing overhead %f%%\n",
video_size / 1024.0,
audio_size / 1024.0,
extra_size / 1024.0,
100.0 * (total_size - raw) / raw
);
}
}
| {
"code": [
" int64_t raw= audio_size + video_size + extra_size;",
" 100.0 * (total_size - raw) / raw",
" );"
],
"line_no": [
235,
247,
249
]
} | static void FUNC_0(int VAR_0, int64_t VAR_1)
{
char VAR_2[1024];
OutputStream *ost;
AVFormatContext *oc;
int64_t total_size;
AVCodecContext *enc;
int VAR_3, VAR_4, VAR_5;
double VAR_6, VAR_7, VAR_8;
static int64_t VAR_9 = -1;
static int VAR_10[52];
if (!print_stats && !VAR_0)
return;
if (!VAR_0) {
int64_t cur_time;
cur_time = av_gettime();
if (VAR_9 == -1) {
VAR_9 = cur_time;
return;
}
if ((cur_time - VAR_9) < 500000)
return;
VAR_9 = cur_time;
}
oc = output_files[0]->ctx;
total_size = avio_size(oc->pb);
if (total_size <= 0)
total_size = avio_tell(oc->pb);
if (total_size < 0) {
char VAR_11[128];
av_strerror(total_size, VAR_11, sizeof(VAR_11));
av_log(NULL, AV_LOG_VERBOSE, "Bitrate not available, "
"avio_tell() failed: %s\n", VAR_11);
total_size = 0;
}
VAR_2[0] = '\0';
VAR_7 = 1e10;
VAR_4 = 0;
for (VAR_5 = 0; VAR_5 < nb_output_streams; VAR_5++) {
float q = -1;
ost = output_streams[VAR_5];
enc = ost->st->codec;
if (!ost->stream_copy && enc->coded_frame)
q = enc->coded_frame->quality / (float)FF_QP2LAMBDA;
if (VAR_4 && enc->codec_type == AVMEDIA_TYPE_VIDEO) {
snprintf(VAR_2 + strlen(VAR_2), sizeof(VAR_2) - strlen(VAR_2), "q=%2.1f ", q);
}
if (!VAR_4 && enc->codec_type == AVMEDIA_TYPE_VIDEO) {
float t = (av_gettime() - VAR_1) / 1000000.0;
VAR_3 = ost->VAR_3;
snprintf(VAR_2 + strlen(VAR_2), sizeof(VAR_2) - strlen(VAR_2), "frame=%5d fps=%3d q=%3.1f ",
VAR_3, (t > 1) ? (int)(VAR_3 / t + 0.5) : 0, q);
if (VAR_0)
snprintf(VAR_2 + strlen(VAR_2), sizeof(VAR_2) - strlen(VAR_2), "L");
if (qp_hist) {
int j;
int qp = lrintf(q);
if (qp >= 0 && qp < FF_ARRAY_ELEMS(VAR_10))
VAR_10[qp]++;
for (j = 0; j < 32; j++)
snprintf(VAR_2 + strlen(VAR_2), sizeof(VAR_2) - strlen(VAR_2), "%X", (int)lrintf(log2(VAR_10[j] + 1)));
}
if (enc->flags&CODEC_FLAG_PSNR) {
int j;
double error, error_sum = 0;
double scale, scale_sum = 0;
char type[3] = { 'Y','U','V' };
snprintf(VAR_2 + strlen(VAR_2), sizeof(VAR_2) - strlen(VAR_2), "PSNR=");
for (j = 0; j < 3; j++) {
if (VAR_0) {
error = enc->error[j];
scale = enc->width * enc->height * 255.0 * 255.0 * VAR_3;
} else {
error = enc->coded_frame->error[j];
scale = enc->width * enc->height * 255.0 * 255.0;
}
if (j)
scale /= 4;
error_sum += error;
scale_sum += scale;
snprintf(VAR_2 + strlen(VAR_2), sizeof(VAR_2) - strlen(VAR_2), "%c:%2.2f ", type[j], psnr(error / scale));
}
snprintf(VAR_2 + strlen(VAR_2), sizeof(VAR_2) - strlen(VAR_2), "*:%2.2f ", psnr(error_sum / scale_sum));
}
VAR_4 = 1;
}
VAR_8 = (double)ost->st->VAR_8.val * av_q2d(ost->st->time_base);
if ((VAR_8 < VAR_7) && (VAR_8 > 0))
VAR_7 = VAR_8;
}
if (VAR_7 < 0.01)
VAR_7 = 0.01;
VAR_6 = (double)(total_size * 8) / VAR_7 / 1000.0;
snprintf(VAR_2 + strlen(VAR_2), sizeof(VAR_2) - strlen(VAR_2),
"size=%8.0fkB time=%0.2f VAR_6=%6.1fkbits/s",
(double)total_size / 1024, VAR_7, VAR_6);
if (nb_frames_dup || nb_frames_drop)
snprintf(VAR_2 + strlen(VAR_2), sizeof(VAR_2) - strlen(VAR_2), " dup=%d drop=%d",
nb_frames_dup, nb_frames_drop);
av_log(NULL, AV_LOG_INFO, "%s \r", VAR_2);
fflush(stderr);
if (VAR_0) {
int64_t raw= audio_size + video_size + extra_size;
av_log(NULL, AV_LOG_INFO, "\n");
av_log(NULL, AV_LOG_INFO, "video:%1.0fkB audio:%1.0fkB global headers:%1.0fkB muxing overhead %f%%\n",
video_size / 1024.0,
audio_size / 1024.0,
extra_size / 1024.0,
100.0 * (total_size - raw) / raw
);
}
}
| [
"static void FUNC_0(int VAR_0, int64_t VAR_1)\n{",
"char VAR_2[1024];",
"OutputStream *ost;",
"AVFormatContext *oc;",
"int64_t total_size;",
"AVCodecContext *enc;",
"int VAR_3, VAR_4, VAR_5;",
"double VAR_6, VAR_7, VAR_8;",
"static int64_t VAR_9 = -1;",
"static int VAR_10[52];",
"if (!print_stats && !VAR_0)\nreturn;",
"if (!VAR_0) {",
"int64_t cur_time;",
"cur_time = av_gettime();",
"if (VAR_9 == -1) {",
"VAR_9 = cur_time;",
"return;",
"}",
"if ((cur_time - VAR_9) < 500000)\nreturn;",
"VAR_9 = cur_time;",
"}",
"oc = output_files[0]->ctx;",
"total_size = avio_size(oc->pb);",
"if (total_size <= 0)\ntotal_size = avio_tell(oc->pb);",
"if (total_size < 0) {",
"char VAR_11[128];",
"av_strerror(total_size, VAR_11, sizeof(VAR_11));",
"av_log(NULL, AV_LOG_VERBOSE, \"Bitrate not available, \"\n\"avio_tell() failed: %s\\n\", VAR_11);",
"total_size = 0;",
"}",
"VAR_2[0] = '\\0';",
"VAR_7 = 1e10;",
"VAR_4 = 0;",
"for (VAR_5 = 0; VAR_5 < nb_output_streams; VAR_5++) {",
"float q = -1;",
"ost = output_streams[VAR_5];",
"enc = ost->st->codec;",
"if (!ost->stream_copy && enc->coded_frame)\nq = enc->coded_frame->quality / (float)FF_QP2LAMBDA;",
"if (VAR_4 && enc->codec_type == AVMEDIA_TYPE_VIDEO) {",
"snprintf(VAR_2 + strlen(VAR_2), sizeof(VAR_2) - strlen(VAR_2), \"q=%2.1f \", q);",
"}",
"if (!VAR_4 && enc->codec_type == AVMEDIA_TYPE_VIDEO) {",
"float t = (av_gettime() - VAR_1) / 1000000.0;",
"VAR_3 = ost->VAR_3;",
"snprintf(VAR_2 + strlen(VAR_2), sizeof(VAR_2) - strlen(VAR_2), \"frame=%5d fps=%3d q=%3.1f \",\nVAR_3, (t > 1) ? (int)(VAR_3 / t + 0.5) : 0, q);",
"if (VAR_0)\nsnprintf(VAR_2 + strlen(VAR_2), sizeof(VAR_2) - strlen(VAR_2), \"L\");",
"if (qp_hist) {",
"int j;",
"int qp = lrintf(q);",
"if (qp >= 0 && qp < FF_ARRAY_ELEMS(VAR_10))\nVAR_10[qp]++;",
"for (j = 0; j < 32; j++)",
"snprintf(VAR_2 + strlen(VAR_2), sizeof(VAR_2) - strlen(VAR_2), \"%X\", (int)lrintf(log2(VAR_10[j] + 1)));",
"}",
"if (enc->flags&CODEC_FLAG_PSNR) {",
"int j;",
"double error, error_sum = 0;",
"double scale, scale_sum = 0;",
"char type[3] = { 'Y','U','V' };",
"snprintf(VAR_2 + strlen(VAR_2), sizeof(VAR_2) - strlen(VAR_2), \"PSNR=\");",
"for (j = 0; j < 3; j++) {",
"if (VAR_0) {",
"error = enc->error[j];",
"scale = enc->width * enc->height * 255.0 * 255.0 * VAR_3;",
"} else {",
"error = enc->coded_frame->error[j];",
"scale = enc->width * enc->height * 255.0 * 255.0;",
"}",
"if (j)\nscale /= 4;",
"error_sum += error;",
"scale_sum += scale;",
"snprintf(VAR_2 + strlen(VAR_2), sizeof(VAR_2) - strlen(VAR_2), \"%c:%2.2f \", type[j], psnr(error / scale));",
"}",
"snprintf(VAR_2 + strlen(VAR_2), sizeof(VAR_2) - strlen(VAR_2), \"*:%2.2f \", psnr(error_sum / scale_sum));",
"}",
"VAR_4 = 1;",
"}",
"VAR_8 = (double)ost->st->VAR_8.val * av_q2d(ost->st->time_base);",
"if ((VAR_8 < VAR_7) && (VAR_8 > 0))\nVAR_7 = VAR_8;",
"}",
"if (VAR_7 < 0.01)\nVAR_7 = 0.01;",
"VAR_6 = (double)(total_size * 8) / VAR_7 / 1000.0;",
"snprintf(VAR_2 + strlen(VAR_2), sizeof(VAR_2) - strlen(VAR_2),\n\"size=%8.0fkB time=%0.2f VAR_6=%6.1fkbits/s\",\n(double)total_size / 1024, VAR_7, VAR_6);",
"if (nb_frames_dup || nb_frames_drop)\nsnprintf(VAR_2 + strlen(VAR_2), sizeof(VAR_2) - strlen(VAR_2), \" dup=%d drop=%d\",\nnb_frames_dup, nb_frames_drop);",
"av_log(NULL, AV_LOG_INFO, \"%s \\r\", VAR_2);",
"fflush(stderr);",
"if (VAR_0) {",
"int64_t raw= audio_size + video_size + extra_size;",
"av_log(NULL, AV_LOG_INFO, \"\\n\");",
"av_log(NULL, AV_LOG_INFO, \"video:%1.0fkB audio:%1.0fkB global headers:%1.0fkB muxing overhead %f%%\\n\",\nvideo_size / 1024.0,\naudio_size / 1024.0,\nextra_size / 1024.0,\n100.0 * (total_size - raw) / raw\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,
1,
0,
1,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
25,
27
],
[
31
],
[
33
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47,
49
],
[
51
],
[
53
],
[
59
],
[
63
],
[
65,
67
],
[
69
],
[
71
],
[
73
],
[
75,
77
],
[
79
],
[
81
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99,
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
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
],
[
191
],
[
193,
195
],
[
197
],
[
199,
201
],
[
205
],
[
209,
211,
213
],
[
217,
219,
221
],
[
225
],
[
229
],
[
233
],
[
235
],
[
237
],
[
239,
241,
243,
245,
247,
249
],
[
251
],
[
253
]
] |
19,718 | static void store_slice_mmx(uint8_t *dst, const uint16_t *src,
int dst_stride, int src_stride,
int width, int height, int log2_scale,
const uint8_t dither[8][8])
{
int y;
for (y = 0; y < height; y++) {
uint8_t *dst1 = dst;
const int16_t *src1 = src;
__asm__ volatile(
"movq (%3), %%mm3 \n"
"movq (%3), %%mm4 \n"
"movd %4, %%mm2 \n"
"pxor %%mm0, %%mm0 \n"
"punpcklbw %%mm0, %%mm3 \n"
"punpckhbw %%mm0, %%mm4 \n"
"psraw %%mm2, %%mm3 \n"
"psraw %%mm2, %%mm4 \n"
"movd %5, %%mm2 \n"
"1: \n"
"movq (%0), %%mm0 \n"
"movq 8(%0), %%mm1 \n"
"paddw %%mm3, %%mm0 \n"
"paddw %%mm4, %%mm1 \n"
"psraw %%mm2, %%mm0 \n"
"psraw %%mm2, %%mm1 \n"
"packuswb %%mm1, %%mm0 \n"
"movq %%mm0, (%1) \n"
"add $16, %0 \n"
"add $8, %1 \n"
"cmp %2, %1 \n"
" jb 1b \n"
: "+r" (src1), "+r"(dst1)
: "r"(dst + width), "r"(dither[y]), "g"(log2_scale), "g"(MAX_LEVEL - log2_scale)
);
src += src_stride;
dst += dst_stride;
}
}
| true | FFmpeg | 6706a2986c48e3f20f1274b24345e6555d8f0f48 | static void store_slice_mmx(uint8_t *dst, const uint16_t *src,
int dst_stride, int src_stride,
int width, int height, int log2_scale,
const uint8_t dither[8][8])
{
int y;
for (y = 0; y < height; y++) {
uint8_t *dst1 = dst;
const int16_t *src1 = src;
__asm__ volatile(
"movq (%3), %%mm3 \n"
"movq (%3), %%mm4 \n"
"movd %4, %%mm2 \n"
"pxor %%mm0, %%mm0 \n"
"punpcklbw %%mm0, %%mm3 \n"
"punpckhbw %%mm0, %%mm4 \n"
"psraw %%mm2, %%mm3 \n"
"psraw %%mm2, %%mm4 \n"
"movd %5, %%mm2 \n"
"1: \n"
"movq (%0), %%mm0 \n"
"movq 8(%0), %%mm1 \n"
"paddw %%mm3, %%mm0 \n"
"paddw %%mm4, %%mm1 \n"
"psraw %%mm2, %%mm0 \n"
"psraw %%mm2, %%mm1 \n"
"packuswb %%mm1, %%mm0 \n"
"movq %%mm0, (%1) \n"
"add $16, %0 \n"
"add $8, %1 \n"
"cmp %2, %1 \n"
" jb 1b \n"
: "+r" (src1), "+r"(dst1)
: "r"(dst + width), "r"(dither[y]), "g"(log2_scale), "g"(MAX_LEVEL - log2_scale)
);
src += src_stride;
dst += dst_stride;
}
}
| {
"code": [
"static void store_slice_mmx(uint8_t *dst, const uint16_t *src,"
],
"line_no": [
1
]
} | static void FUNC_0(uint8_t *VAR_0, const uint16_t *VAR_1,
int VAR_2, int VAR_3,
int VAR_4, int VAR_5, int VAR_6,
const uint8_t VAR_7[8][8])
{
int VAR_8;
for (VAR_8 = 0; VAR_8 < VAR_5; VAR_8++) {
uint8_t *dst1 = VAR_0;
const int16_t *VAR_9 = VAR_1;
__asm__ volatile(
"movq (%3), %%mm3 \n"
"movq (%3), %%mm4 \n"
"movd %4, %%mm2 \n"
"pxor %%mm0, %%mm0 \n"
"punpcklbw %%mm0, %%mm3 \n"
"punpckhbw %%mm0, %%mm4 \n"
"psraw %%mm2, %%mm3 \n"
"psraw %%mm2, %%mm4 \n"
"movd %5, %%mm2 \n"
"1: \n"
"movq (%0), %%mm0 \n"
"movq 8(%0), %%mm1 \n"
"paddw %%mm3, %%mm0 \n"
"paddw %%mm4, %%mm1 \n"
"psraw %%mm2, %%mm0 \n"
"psraw %%mm2, %%mm1 \n"
"packuswb %%mm1, %%mm0 \n"
"movq %%mm0, (%1) \n"
"add $16, %0 \n"
"add $8, %1 \n"
"cmp %2, %1 \n"
" jb 1b \n"
: "+r" (VAR_9), "+r"(dst1)
: "r"(VAR_0 + VAR_4), "r"(VAR_7[VAR_8]), "g"(VAR_6), "g"(MAX_LEVEL - VAR_6)
);
VAR_1 += VAR_3;
VAR_0 += VAR_2;
}
}
| [
"static void FUNC_0(uint8_t *VAR_0, const uint16_t *VAR_1,\nint VAR_2, int VAR_3,\nint VAR_4, int VAR_5, int VAR_6,\nconst uint8_t VAR_7[8][8])\n{",
"int VAR_8;",
"for (VAR_8 = 0; VAR_8 < VAR_5; VAR_8++) {",
"uint8_t *dst1 = VAR_0;",
"const int16_t *VAR_9 = VAR_1;",
"__asm__ volatile(\n\"movq (%3), %%mm3 \\n\"\n\"movq (%3), %%mm4 \\n\"\n\"movd %4, %%mm2 \\n\"\n\"pxor %%mm0, %%mm0 \\n\"\n\"punpcklbw %%mm0, %%mm3 \\n\"\n\"punpckhbw %%mm0, %%mm4 \\n\"\n\"psraw %%mm2, %%mm3 \\n\"\n\"psraw %%mm2, %%mm4 \\n\"\n\"movd %5, %%mm2 \\n\"\n\"1: \\n\"\n\"movq (%0), %%mm0 \\n\"\n\"movq 8(%0), %%mm1 \\n\"\n\"paddw %%mm3, %%mm0 \\n\"\n\"paddw %%mm4, %%mm1 \\n\"\n\"psraw %%mm2, %%mm0 \\n\"\n\"psraw %%mm2, %%mm1 \\n\"\n\"packuswb %%mm1, %%mm0 \\n\"\n\"movq %%mm0, (%1) \\n\"\n\"add $16, %0 \\n\"\n\"add $8, %1 \\n\"\n\"cmp %2, %1 \\n\"\n\" jb 1b \\n\"\n: \"+r\" (VAR_9), \"+r\"(dst1)\n: \"r\"(VAR_0 + VAR_4), \"r\"(VAR_7[VAR_8]), \"g\"(VAR_6), \"g\"(MAX_LEVEL - VAR_6)\n);",
"VAR_1 += VAR_3;",
"VAR_0 += VAR_2;",
"}",
"}"
] | [
1,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5,
7,
9
],
[
11
],
[
15
],
[
17
],
[
19
],
[
21,
23,
25,
27,
29,
31,
33,
35,
37,
39,
41,
43,
45,
47,
49,
51,
53,
55,
57,
59,
61,
63,
65,
67,
69,
71
],
[
73
],
[
75
],
[
77
],
[
79
]
] |
19,719 | av_cold int ff_vc2enc_init_transforms(VC2TransformContext *s, int p_width, int p_height)
{
s->vc2_subband_dwt[VC2_TRANSFORM_9_7] = vc2_subband_dwt_97;
s->vc2_subband_dwt[VC2_TRANSFORM_5_3] = vc2_subband_dwt_53;
s->vc2_subband_dwt[VC2_TRANSFORM_HAAR] = vc2_subband_dwt_haar;
s->vc2_subband_dwt[VC2_TRANSFORM_HAAR_S] = vc2_subband_dwt_haar_shift;
s->buffer = av_malloc(2*p_width*p_height*sizeof(dwtcoef));
if (!s->buffer)
return 1;
return 0;
}
| true | FFmpeg | 3228ac730c11eca49d5680d5550128e397061c85 | av_cold int ff_vc2enc_init_transforms(VC2TransformContext *s, int p_width, int p_height)
{
s->vc2_subband_dwt[VC2_TRANSFORM_9_7] = vc2_subband_dwt_97;
s->vc2_subband_dwt[VC2_TRANSFORM_5_3] = vc2_subband_dwt_53;
s->vc2_subband_dwt[VC2_TRANSFORM_HAAR] = vc2_subband_dwt_haar;
s->vc2_subband_dwt[VC2_TRANSFORM_HAAR_S] = vc2_subband_dwt_haar_shift;
s->buffer = av_malloc(2*p_width*p_height*sizeof(dwtcoef));
if (!s->buffer)
return 1;
return 0;
}
| {
"code": [
"av_cold int ff_vc2enc_init_transforms(VC2TransformContext *s, int p_width, int p_height)",
" s->buffer = av_malloc(2*p_width*p_height*sizeof(dwtcoef));"
],
"line_no": [
1,
15
]
} | av_cold int FUNC_0(VC2TransformContext *s, int p_width, int p_height)
{
s->vc2_subband_dwt[VC2_TRANSFORM_9_7] = vc2_subband_dwt_97;
s->vc2_subband_dwt[VC2_TRANSFORM_5_3] = vc2_subband_dwt_53;
s->vc2_subband_dwt[VC2_TRANSFORM_HAAR] = vc2_subband_dwt_haar;
s->vc2_subband_dwt[VC2_TRANSFORM_HAAR_S] = vc2_subband_dwt_haar_shift;
s->buffer = av_malloc(2*p_width*p_height*sizeof(dwtcoef));
if (!s->buffer)
return 1;
return 0;
}
| [
"av_cold int FUNC_0(VC2TransformContext *s, int p_width, int p_height)\n{",
"s->vc2_subband_dwt[VC2_TRANSFORM_9_7] = vc2_subband_dwt_97;",
"s->vc2_subband_dwt[VC2_TRANSFORM_5_3] = vc2_subband_dwt_53;",
"s->vc2_subband_dwt[VC2_TRANSFORM_HAAR] = vc2_subband_dwt_haar;",
"s->vc2_subband_dwt[VC2_TRANSFORM_HAAR_S] = vc2_subband_dwt_haar_shift;",
"s->buffer = av_malloc(2*p_width*p_height*sizeof(dwtcoef));",
"if (!s->buffer)\nreturn 1;",
"return 0;",
"}"
] | [
1,
0,
0,
0,
0,
1,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17,
19
],
[
23
],
[
25
]
] |
19,720 | static void fill_buffer(AVIOContext *s)
{
int max_buffer_size = s->max_packet_size ?
s->max_packet_size : IO_BUFFER_SIZE;
uint8_t *dst = s->buf_end - s->buffer + max_buffer_size < s->buffer_size ?
s->buf_end : s->buffer;
int len = s->buffer_size - (dst - s->buffer);
/* can't fill the buffer without read_packet, just set EOF if appropriate */
if (!s->read_packet && s->buf_ptr >= s->buf_end)
s->eof_reached = 1;
/* no need to do anything if EOF already reached */
if (s->eof_reached)
return;
if (s->update_checksum && dst == s->buffer) {
if (s->buf_end > s->checksum_ptr)
s->checksum = s->update_checksum(s->checksum, s->checksum_ptr,
s->buf_end - s->checksum_ptr);
s->checksum_ptr = s->buffer;
}
/* make buffer smaller in case it ended up large after probing */
if (s->read_packet && s->orig_buffer_size && s->buffer_size > s->orig_buffer_size) {
if (dst == s->buffer) {
ffio_set_buf_size(s, s->orig_buffer_size);
s->checksum_ptr = dst = s->buffer;
}
av_assert0(len >= s->orig_buffer_size);
len = s->orig_buffer_size;
}
if (s->read_packet)
len = s->read_packet(s->opaque, dst, len);
else
len = 0;
if (len <= 0) {
/* do not modify buffer if EOF reached so that a seek back can
be done without rereading data */
s->eof_reached = 1;
if (len < 0)
s->error = len;
} else {
s->pos += len;
s->buf_ptr = dst;
s->buf_end = dst + len;
s->bytes_read += len;
}
}
| true | FFmpeg | 0023ea4e20b0bec70e1dedb7f1183dd58f9122d8 | static void fill_buffer(AVIOContext *s)
{
int max_buffer_size = s->max_packet_size ?
s->max_packet_size : IO_BUFFER_SIZE;
uint8_t *dst = s->buf_end - s->buffer + max_buffer_size < s->buffer_size ?
s->buf_end : s->buffer;
int len = s->buffer_size - (dst - s->buffer);
if (!s->read_packet && s->buf_ptr >= s->buf_end)
s->eof_reached = 1;
if (s->eof_reached)
return;
if (s->update_checksum && dst == s->buffer) {
if (s->buf_end > s->checksum_ptr)
s->checksum = s->update_checksum(s->checksum, s->checksum_ptr,
s->buf_end - s->checksum_ptr);
s->checksum_ptr = s->buffer;
}
if (s->read_packet && s->orig_buffer_size && s->buffer_size > s->orig_buffer_size) {
if (dst == s->buffer) {
ffio_set_buf_size(s, s->orig_buffer_size);
s->checksum_ptr = dst = s->buffer;
}
av_assert0(len >= s->orig_buffer_size);
len = s->orig_buffer_size;
}
if (s->read_packet)
len = s->read_packet(s->opaque, dst, len);
else
len = 0;
if (len <= 0) {
s->eof_reached = 1;
if (len < 0)
s->error = len;
} else {
s->pos += len;
s->buf_ptr = dst;
s->buf_end = dst + len;
s->bytes_read += len;
}
}
| {
"code": [
" ffio_set_buf_size(s, s->orig_buffer_size);"
],
"line_no": [
53
]
} | static void FUNC_0(AVIOContext *VAR_0)
{
int VAR_1 = VAR_0->max_packet_size ?
VAR_0->max_packet_size : IO_BUFFER_SIZE;
uint8_t *dst = VAR_0->buf_end - VAR_0->buffer + VAR_1 < VAR_0->buffer_size ?
VAR_0->buf_end : VAR_0->buffer;
int VAR_2 = VAR_0->buffer_size - (dst - VAR_0->buffer);
if (!VAR_0->read_packet && VAR_0->buf_ptr >= VAR_0->buf_end)
VAR_0->eof_reached = 1;
if (VAR_0->eof_reached)
return;
if (VAR_0->update_checksum && dst == VAR_0->buffer) {
if (VAR_0->buf_end > VAR_0->checksum_ptr)
VAR_0->checksum = VAR_0->update_checksum(VAR_0->checksum, VAR_0->checksum_ptr,
VAR_0->buf_end - VAR_0->checksum_ptr);
VAR_0->checksum_ptr = VAR_0->buffer;
}
if (VAR_0->read_packet && VAR_0->orig_buffer_size && VAR_0->buffer_size > VAR_0->orig_buffer_size) {
if (dst == VAR_0->buffer) {
ffio_set_buf_size(VAR_0, VAR_0->orig_buffer_size);
VAR_0->checksum_ptr = dst = VAR_0->buffer;
}
av_assert0(VAR_2 >= VAR_0->orig_buffer_size);
VAR_2 = VAR_0->orig_buffer_size;
}
if (VAR_0->read_packet)
VAR_2 = VAR_0->read_packet(VAR_0->opaque, dst, VAR_2);
else
VAR_2 = 0;
if (VAR_2 <= 0) {
VAR_0->eof_reached = 1;
if (VAR_2 < 0)
VAR_0->error = VAR_2;
} else {
VAR_0->pos += VAR_2;
VAR_0->buf_ptr = dst;
VAR_0->buf_end = dst + VAR_2;
VAR_0->bytes_read += VAR_2;
}
}
| [
"static void FUNC_0(AVIOContext *VAR_0)\n{",
"int VAR_1 = VAR_0->max_packet_size ?\nVAR_0->max_packet_size : IO_BUFFER_SIZE;",
"uint8_t *dst = VAR_0->buf_end - VAR_0->buffer + VAR_1 < VAR_0->buffer_size ?\nVAR_0->buf_end : VAR_0->buffer;",
"int VAR_2 = VAR_0->buffer_size - (dst - VAR_0->buffer);",
"if (!VAR_0->read_packet && VAR_0->buf_ptr >= VAR_0->buf_end)\nVAR_0->eof_reached = 1;",
"if (VAR_0->eof_reached)\nreturn;",
"if (VAR_0->update_checksum && dst == VAR_0->buffer) {",
"if (VAR_0->buf_end > VAR_0->checksum_ptr)\nVAR_0->checksum = VAR_0->update_checksum(VAR_0->checksum, VAR_0->checksum_ptr,\nVAR_0->buf_end - VAR_0->checksum_ptr);",
"VAR_0->checksum_ptr = VAR_0->buffer;",
"}",
"if (VAR_0->read_packet && VAR_0->orig_buffer_size && VAR_0->buffer_size > VAR_0->orig_buffer_size) {",
"if (dst == VAR_0->buffer) {",
"ffio_set_buf_size(VAR_0, VAR_0->orig_buffer_size);",
"VAR_0->checksum_ptr = dst = VAR_0->buffer;",
"}",
"av_assert0(VAR_2 >= VAR_0->orig_buffer_size);",
"VAR_2 = VAR_0->orig_buffer_size;",
"}",
"if (VAR_0->read_packet)\nVAR_2 = VAR_0->read_packet(VAR_0->opaque, dst, VAR_2);",
"else\nVAR_2 = 0;",
"if (VAR_2 <= 0) {",
"VAR_0->eof_reached = 1;",
"if (VAR_2 < 0)\nVAR_0->error = VAR_2;",
"} else {",
"VAR_0->pos += VAR_2;",
"VAR_0->buf_ptr = dst;",
"VAR_0->buf_end = dst + VAR_2;",
"VAR_0->bytes_read += VAR_2;",
"}",
"}"
] | [
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
] | [
[
1,
3
],
[
5,
7
],
[
9,
11
],
[
13
],
[
19,
21
],
[
27,
29
],
[
33
],
[
35,
37,
39
],
[
41
],
[
43
],
[
49
],
[
51
],
[
53
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
69,
71
],
[
73,
75
],
[
77
],
[
83
],
[
85,
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
]
] |
19,722 | static int apply_param_change(AVCodecContext *avctx, AVPacket *avpkt)
{
int size = 0, ret;
const uint8_t *data;
uint32_t flags;
data = av_packet_get_side_data(avpkt, AV_PKT_DATA_PARAM_CHANGE, &size);
if (!data)
return 0;
if (!(avctx->codec->capabilities & CODEC_CAP_PARAM_CHANGE)) {
av_log(avctx, AV_LOG_ERROR, "This decoder does not support parameter "
"changes, but PARAM_CHANGE side data was sent to it.\n");
return AVERROR(EINVAL);
}
if (size < 4)
goto fail;
flags = bytestream_get_le32(&data);
size -= 4;
if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) {
if (size < 4)
goto fail;
avctx->channels = bytestream_get_le32(&data);
size -= 4;
}
if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT) {
if (size < 8)
goto fail;
avctx->channel_layout = bytestream_get_le64(&data);
size -= 8;
}
if (flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) {
if (size < 4)
goto fail;
avctx->sample_rate = bytestream_get_le32(&data);
size -= 4;
}
if (flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS) {
if (size < 8)
goto fail;
avctx->width = bytestream_get_le32(&data);
avctx->height = bytestream_get_le32(&data);
size -= 8;
ret = ff_set_dimensions(avctx, avctx->width, avctx->height);
if (ret < 0)
return ret;
}
return 0;
fail:
av_log(avctx, AV_LOG_ERROR, "PARAM_CHANGE side data too small.\n");
return AVERROR_INVALIDDATA;
}
| false | FFmpeg | e83ffb48aca607ae3ec057f81c3d2eff9c075782 | static int apply_param_change(AVCodecContext *avctx, AVPacket *avpkt)
{
int size = 0, ret;
const uint8_t *data;
uint32_t flags;
data = av_packet_get_side_data(avpkt, AV_PKT_DATA_PARAM_CHANGE, &size);
if (!data)
return 0;
if (!(avctx->codec->capabilities & CODEC_CAP_PARAM_CHANGE)) {
av_log(avctx, AV_LOG_ERROR, "This decoder does not support parameter "
"changes, but PARAM_CHANGE side data was sent to it.\n");
return AVERROR(EINVAL);
}
if (size < 4)
goto fail;
flags = bytestream_get_le32(&data);
size -= 4;
if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) {
if (size < 4)
goto fail;
avctx->channels = bytestream_get_le32(&data);
size -= 4;
}
if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT) {
if (size < 8)
goto fail;
avctx->channel_layout = bytestream_get_le64(&data);
size -= 8;
}
if (flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) {
if (size < 4)
goto fail;
avctx->sample_rate = bytestream_get_le32(&data);
size -= 4;
}
if (flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS) {
if (size < 8)
goto fail;
avctx->width = bytestream_get_le32(&data);
avctx->height = bytestream_get_le32(&data);
size -= 8;
ret = ff_set_dimensions(avctx, avctx->width, avctx->height);
if (ret < 0)
return ret;
}
return 0;
fail:
av_log(avctx, AV_LOG_ERROR, "PARAM_CHANGE side data too small.\n");
return AVERROR_INVALIDDATA;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1)
{
int VAR_2 = 0, VAR_3;
const uint8_t *VAR_4;
uint32_t flags;
VAR_4 = av_packet_get_side_data(VAR_1, AV_PKT_DATA_PARAM_CHANGE, &VAR_2);
if (!VAR_4)
return 0;
if (!(VAR_0->codec->capabilities & CODEC_CAP_PARAM_CHANGE)) {
av_log(VAR_0, AV_LOG_ERROR, "This decoder does not support parameter "
"changes, but PARAM_CHANGE side VAR_4 was sent to it.\n");
return AVERROR(EINVAL);
}
if (VAR_2 < 4)
goto fail;
flags = bytestream_get_le32(&VAR_4);
VAR_2 -= 4;
if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) {
if (VAR_2 < 4)
goto fail;
VAR_0->channels = bytestream_get_le32(&VAR_4);
VAR_2 -= 4;
}
if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT) {
if (VAR_2 < 8)
goto fail;
VAR_0->channel_layout = bytestream_get_le64(&VAR_4);
VAR_2 -= 8;
}
if (flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) {
if (VAR_2 < 4)
goto fail;
VAR_0->sample_rate = bytestream_get_le32(&VAR_4);
VAR_2 -= 4;
}
if (flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS) {
if (VAR_2 < 8)
goto fail;
VAR_0->width = bytestream_get_le32(&VAR_4);
VAR_0->height = bytestream_get_le32(&VAR_4);
VAR_2 -= 8;
VAR_3 = ff_set_dimensions(VAR_0, VAR_0->width, VAR_0->height);
if (VAR_3 < 0)
return VAR_3;
}
return 0;
fail:
av_log(VAR_0, AV_LOG_ERROR, "PARAM_CHANGE side VAR_4 too small.\n");
return AVERROR_INVALIDDATA;
}
| [
"static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1)\n{",
"int VAR_2 = 0, VAR_3;",
"const uint8_t *VAR_4;",
"uint32_t flags;",
"VAR_4 = av_packet_get_side_data(VAR_1, AV_PKT_DATA_PARAM_CHANGE, &VAR_2);",
"if (!VAR_4)\nreturn 0;",
"if (!(VAR_0->codec->capabilities & CODEC_CAP_PARAM_CHANGE)) {",
"av_log(VAR_0, AV_LOG_ERROR, \"This decoder does not support parameter \"\n\"changes, but PARAM_CHANGE side VAR_4 was sent to it.\\n\");",
"return AVERROR(EINVAL);",
"}",
"if (VAR_2 < 4)\ngoto fail;",
"flags = bytestream_get_le32(&VAR_4);",
"VAR_2 -= 4;",
"if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) {",
"if (VAR_2 < 4)\ngoto fail;",
"VAR_0->channels = bytestream_get_le32(&VAR_4);",
"VAR_2 -= 4;",
"}",
"if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT) {",
"if (VAR_2 < 8)\ngoto fail;",
"VAR_0->channel_layout = bytestream_get_le64(&VAR_4);",
"VAR_2 -= 8;",
"}",
"if (flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) {",
"if (VAR_2 < 4)\ngoto fail;",
"VAR_0->sample_rate = bytestream_get_le32(&VAR_4);",
"VAR_2 -= 4;",
"}",
"if (flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS) {",
"if (VAR_2 < 8)\ngoto fail;",
"VAR_0->width = bytestream_get_le32(&VAR_4);",
"VAR_0->height = bytestream_get_le32(&VAR_4);",
"VAR_2 -= 8;",
"VAR_3 = ff_set_dimensions(VAR_0, VAR_0->width, VAR_0->height);",
"if (VAR_3 < 0)\nreturn VAR_3;",
"}",
"return 0;",
"fail:\nav_log(VAR_0, AV_LOG_ERROR, \"PARAM_CHANGE side VAR_4 too small.\\n\");",
"return AVERROR_INVALIDDATA;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15,
17
],
[
21
],
[
23,
25
],
[
27
],
[
29
],
[
33,
35
],
[
39
],
[
41
],
[
45
],
[
47,
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59,
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71,
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83,
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95,
97
],
[
99
],
[
103
],
[
105,
107
],
[
109
],
[
111
]
] |
19,723 | static int get_number(void *obj, const char *name, const AVOption **o_out, double *num, int *den, int64_t *intnum)
{
const AVOption *o = av_opt_find(obj, name, NULL, 0, 0);
void *dst;
if (!o || o->offset<=0)
goto error;
dst= ((uint8_t*)obj) + o->offset;
if (o_out) *o_out= o;
switch (o->type) {
case FF_OPT_TYPE_FLAGS: *intnum= *(unsigned int*)dst;return 0;
case FF_OPT_TYPE_INT: *intnum= *(int *)dst;return 0;
case FF_OPT_TYPE_INT64: *intnum= *(int64_t*)dst;return 0;
case FF_OPT_TYPE_FLOAT: *num= *(float *)dst;return 0;
case FF_OPT_TYPE_DOUBLE: *num= *(double *)dst;return 0;
case FF_OPT_TYPE_RATIONAL: *intnum= ((AVRational*)dst)->num;
*den = ((AVRational*)dst)->den;
return 0;
}
error:
*den=*intnum=0;
return -1;
}
| false | FFmpeg | 4dbcdfa86d1405f7e5c0ec14a4be7d2fb5903d7b | static int get_number(void *obj, const char *name, const AVOption **o_out, double *num, int *den, int64_t *intnum)
{
const AVOption *o = av_opt_find(obj, name, NULL, 0, 0);
void *dst;
if (!o || o->offset<=0)
goto error;
dst= ((uint8_t*)obj) + o->offset;
if (o_out) *o_out= o;
switch (o->type) {
case FF_OPT_TYPE_FLAGS: *intnum= *(unsigned int*)dst;return 0;
case FF_OPT_TYPE_INT: *intnum= *(int *)dst;return 0;
case FF_OPT_TYPE_INT64: *intnum= *(int64_t*)dst;return 0;
case FF_OPT_TYPE_FLOAT: *num= *(float *)dst;return 0;
case FF_OPT_TYPE_DOUBLE: *num= *(double *)dst;return 0;
case FF_OPT_TYPE_RATIONAL: *intnum= ((AVRational*)dst)->num;
*den = ((AVRational*)dst)->den;
return 0;
}
error:
*den=*intnum=0;
return -1;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(void *VAR_0, const char *VAR_1, const AVOption **VAR_2, double *VAR_3, int *VAR_4, int64_t *VAR_5)
{
const AVOption *VAR_6 = av_opt_find(VAR_0, VAR_1, NULL, 0, 0);
void *VAR_7;
if (!VAR_6 || VAR_6->offset<=0)
goto error;
VAR_7= ((uint8_t*)VAR_0) + VAR_6->offset;
if (VAR_2) *VAR_2= VAR_6;
switch (VAR_6->type) {
case FF_OPT_TYPE_FLAGS: *VAR_5= *(unsigned int*)VAR_7;return 0;
case FF_OPT_TYPE_INT: *VAR_5= *(int *)VAR_7;return 0;
case FF_OPT_TYPE_INT64: *VAR_5= *(int64_t*)VAR_7;return 0;
case FF_OPT_TYPE_FLOAT: *VAR_3= *(float *)VAR_7;return 0;
case FF_OPT_TYPE_DOUBLE: *VAR_3= *(double *)VAR_7;return 0;
case FF_OPT_TYPE_RATIONAL: *VAR_5= ((AVRational*)VAR_7)->VAR_3;
*VAR_4 = ((AVRational*)VAR_7)->VAR_4;
return 0;
}
error:
*VAR_4=*VAR_5=0;
return -1;
}
| [
"static int FUNC_0(void *VAR_0, const char *VAR_1, const AVOption **VAR_2, double *VAR_3, int *VAR_4, int64_t *VAR_5)\n{",
"const AVOption *VAR_6 = av_opt_find(VAR_0, VAR_1, NULL, 0, 0);",
"void *VAR_7;",
"if (!VAR_6 || VAR_6->offset<=0)\ngoto error;",
"VAR_7= ((uint8_t*)VAR_0) + VAR_6->offset;",
"if (VAR_2) *VAR_2= VAR_6;",
"switch (VAR_6->type) {",
"case FF_OPT_TYPE_FLAGS: *VAR_5= *(unsigned int*)VAR_7;return 0;",
"case FF_OPT_TYPE_INT: *VAR_5= *(int *)VAR_7;return 0;",
"case FF_OPT_TYPE_INT64: *VAR_5= *(int64_t*)VAR_7;return 0;",
"case FF_OPT_TYPE_FLOAT: *VAR_3= *(float *)VAR_7;return 0;",
"case FF_OPT_TYPE_DOUBLE: *VAR_3= *(double *)VAR_7;return 0;",
"case FF_OPT_TYPE_RATIONAL: *VAR_5= ((AVRational*)VAR_7)->VAR_3;",
"*VAR_4 = ((AVRational*)VAR_7)->VAR_4;",
"return 0;",
"}",
"error:\n*VAR_4=*VAR_5=0;",
"return -1;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9,
11
],
[
15
],
[
19
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43,
45
],
[
47
],
[
49
]
] |
19,726 | static int dts_probe(AVProbeData *p)
{
const uint8_t *buf, *bufp;
uint32_t state = -1;
int markers[4*16] = {0};
int exss_markers = 0, exss_nextpos = 0;
int sum, max, pos, i;
int64_t diff = 0;
uint8_t hdr[12 + AV_INPUT_BUFFER_PADDING_SIZE] = { 0 };
for (pos = FFMIN(4096, p->buf_size); pos < p->buf_size - 2; pos += 2) {
int marker, sample_blocks, sample_rate, sr_code, framesize;
int lfe, wide_hdr, hdr_size;
GetBitContext gb;
bufp = buf = p->buf + pos;
state = (state << 16) | bytestream_get_be16(&bufp);
if (pos >= 4)
diff += FFABS(((int16_t)AV_RL16(buf)) - (int16_t)AV_RL16(buf-4));
/* extension substream (EXSS) */
if (state == DCA_SYNCWORD_SUBSTREAM) {
if (pos < exss_nextpos)
continue;
init_get_bits(&gb, buf - 2, 96);
skip_bits_long(&gb, 42);
wide_hdr = get_bits1(&gb);
hdr_size = get_bits(&gb, 8 + 4 * wide_hdr) + 1;
framesize = get_bits(&gb, 16 + 4 * wide_hdr) + 1;
if (hdr_size & 3 || framesize & 3)
continue;
if (hdr_size < 16 || framesize < hdr_size)
continue;
if (pos - 2 + hdr_size > p->buf_size)
continue;
if (av_crc(av_crc_get_table(AV_CRC_16_CCITT), 0xffff, buf + 3, hdr_size - 5))
continue;
if (pos == exss_nextpos)
exss_markers++;
else
exss_markers = FFMAX(1, exss_markers - 1);
exss_nextpos = pos + framesize;
continue;
}
/* regular bitstream */
if (state == DCA_SYNCWORD_CORE_BE &&
(bytestream_get_be16(&bufp) & 0xFC00) == 0xFC00)
marker = 0;
else if (state == DCA_SYNCWORD_CORE_LE &&
(bytestream_get_be16(&bufp) & 0x00FC) == 0x00FC)
marker = 1;
/* 14 bits big-endian bitstream */
else if (state == DCA_SYNCWORD_CORE_14B_BE &&
(bytestream_get_be16(&bufp) & 0xFFF0) == 0x07F0)
marker = 2;
/* 14 bits little-endian bitstream */
else if (state == DCA_SYNCWORD_CORE_14B_LE &&
(bytestream_get_be16(&bufp) & 0xF0FF) == 0xF007)
marker = 3;
else
continue;
if (avpriv_dca_convert_bitstream(buf-2, 12, hdr, 12) < 0)
continue;
init_get_bits(&gb, hdr, 96);
skip_bits_long(&gb, 39);
sample_blocks = get_bits(&gb, 7) + 1;
if (sample_blocks < 8)
continue;
framesize = get_bits(&gb, 14) + 1;
if (framesize < 95)
continue;
skip_bits(&gb, 6);
sr_code = get_bits(&gb, 4);
sample_rate = avpriv_dca_sample_rates[sr_code];
if (sample_rate == 0)
continue;
get_bits(&gb, 5);
if (get_bits(&gb, 1))
continue;
skip_bits_long(&gb, 9);
lfe = get_bits(&gb, 2);
if (lfe > 2)
continue;
marker += 4* sr_code;
markers[marker] ++;
}
if (exss_markers > 3)
return AVPROBE_SCORE_EXTENSION + 1;
sum = max = 0;
for (i=0; i<FF_ARRAY_ELEMS(markers); i++) {
sum += markers[i];
if (markers[max] < markers[i])
max = i;
}
if (markers[max] > 3 && p->buf_size / markers[max] < 32*1024 &&
markers[max] * 4 > sum * 3 &&
diff / p->buf_size > 200)
return AVPROBE_SCORE_EXTENSION + 1;
return 0;
}
| false | FFmpeg | 3b7ec920af42f1dc3676b72db9e617227c220436 | static int dts_probe(AVProbeData *p)
{
const uint8_t *buf, *bufp;
uint32_t state = -1;
int markers[4*16] = {0};
int exss_markers = 0, exss_nextpos = 0;
int sum, max, pos, i;
int64_t diff = 0;
uint8_t hdr[12 + AV_INPUT_BUFFER_PADDING_SIZE] = { 0 };
for (pos = FFMIN(4096, p->buf_size); pos < p->buf_size - 2; pos += 2) {
int marker, sample_blocks, sample_rate, sr_code, framesize;
int lfe, wide_hdr, hdr_size;
GetBitContext gb;
bufp = buf = p->buf + pos;
state = (state << 16) | bytestream_get_be16(&bufp);
if (pos >= 4)
diff += FFABS(((int16_t)AV_RL16(buf)) - (int16_t)AV_RL16(buf-4));
if (state == DCA_SYNCWORD_SUBSTREAM) {
if (pos < exss_nextpos)
continue;
init_get_bits(&gb, buf - 2, 96);
skip_bits_long(&gb, 42);
wide_hdr = get_bits1(&gb);
hdr_size = get_bits(&gb, 8 + 4 * wide_hdr) + 1;
framesize = get_bits(&gb, 16 + 4 * wide_hdr) + 1;
if (hdr_size & 3 || framesize & 3)
continue;
if (hdr_size < 16 || framesize < hdr_size)
continue;
if (pos - 2 + hdr_size > p->buf_size)
continue;
if (av_crc(av_crc_get_table(AV_CRC_16_CCITT), 0xffff, buf + 3, hdr_size - 5))
continue;
if (pos == exss_nextpos)
exss_markers++;
else
exss_markers = FFMAX(1, exss_markers - 1);
exss_nextpos = pos + framesize;
continue;
}
if (state == DCA_SYNCWORD_CORE_BE &&
(bytestream_get_be16(&bufp) & 0xFC00) == 0xFC00)
marker = 0;
else if (state == DCA_SYNCWORD_CORE_LE &&
(bytestream_get_be16(&bufp) & 0x00FC) == 0x00FC)
marker = 1;
else if (state == DCA_SYNCWORD_CORE_14B_BE &&
(bytestream_get_be16(&bufp) & 0xFFF0) == 0x07F0)
marker = 2;
else if (state == DCA_SYNCWORD_CORE_14B_LE &&
(bytestream_get_be16(&bufp) & 0xF0FF) == 0xF007)
marker = 3;
else
continue;
if (avpriv_dca_convert_bitstream(buf-2, 12, hdr, 12) < 0)
continue;
init_get_bits(&gb, hdr, 96);
skip_bits_long(&gb, 39);
sample_blocks = get_bits(&gb, 7) + 1;
if (sample_blocks < 8)
continue;
framesize = get_bits(&gb, 14) + 1;
if (framesize < 95)
continue;
skip_bits(&gb, 6);
sr_code = get_bits(&gb, 4);
sample_rate = avpriv_dca_sample_rates[sr_code];
if (sample_rate == 0)
continue;
get_bits(&gb, 5);
if (get_bits(&gb, 1))
continue;
skip_bits_long(&gb, 9);
lfe = get_bits(&gb, 2);
if (lfe > 2)
continue;
marker += 4* sr_code;
markers[marker] ++;
}
if (exss_markers > 3)
return AVPROBE_SCORE_EXTENSION + 1;
sum = max = 0;
for (i=0; i<FF_ARRAY_ELEMS(markers); i++) {
sum += markers[i];
if (markers[max] < markers[i])
max = i;
}
if (markers[max] > 3 && p->buf_size / markers[max] < 32*1024 &&
markers[max] * 4 > sum * 3 &&
diff / p->buf_size > 200)
return AVPROBE_SCORE_EXTENSION + 1;
return 0;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(AVProbeData *VAR_0)
{
const uint8_t *VAR_1, *bufp;
uint32_t state = -1;
int VAR_2[4*16] = {0};
int VAR_3 = 0, VAR_4 = 0;
int VAR_5, VAR_6, VAR_7, VAR_8;
int64_t diff = 0;
uint8_t hdr[12 + AV_INPUT_BUFFER_PADDING_SIZE] = { 0 };
for (VAR_7 = FFMIN(4096, VAR_0->buf_size); VAR_7 < VAR_0->buf_size - 2; VAR_7 += 2) {
int marker, sample_blocks, sample_rate, sr_code, framesize;
int lfe, wide_hdr, hdr_size;
GetBitContext gb;
bufp = VAR_1 = VAR_0->VAR_1 + VAR_7;
state = (state << 16) | bytestream_get_be16(&bufp);
if (VAR_7 >= 4)
diff += FFABS(((int16_t)AV_RL16(VAR_1)) - (int16_t)AV_RL16(VAR_1-4));
if (state == DCA_SYNCWORD_SUBSTREAM) {
if (VAR_7 < VAR_4)
continue;
init_get_bits(&gb, VAR_1 - 2, 96);
skip_bits_long(&gb, 42);
wide_hdr = get_bits1(&gb);
hdr_size = get_bits(&gb, 8 + 4 * wide_hdr) + 1;
framesize = get_bits(&gb, 16 + 4 * wide_hdr) + 1;
if (hdr_size & 3 || framesize & 3)
continue;
if (hdr_size < 16 || framesize < hdr_size)
continue;
if (VAR_7 - 2 + hdr_size > VAR_0->buf_size)
continue;
if (av_crc(av_crc_get_table(AV_CRC_16_CCITT), 0xffff, VAR_1 + 3, hdr_size - 5))
continue;
if (VAR_7 == VAR_4)
VAR_3++;
else
VAR_3 = FFMAX(1, VAR_3 - 1);
VAR_4 = VAR_7 + framesize;
continue;
}
if (state == DCA_SYNCWORD_CORE_BE &&
(bytestream_get_be16(&bufp) & 0xFC00) == 0xFC00)
marker = 0;
else if (state == DCA_SYNCWORD_CORE_LE &&
(bytestream_get_be16(&bufp) & 0x00FC) == 0x00FC)
marker = 1;
else if (state == DCA_SYNCWORD_CORE_14B_BE &&
(bytestream_get_be16(&bufp) & 0xFFF0) == 0x07F0)
marker = 2;
else if (state == DCA_SYNCWORD_CORE_14B_LE &&
(bytestream_get_be16(&bufp) & 0xF0FF) == 0xF007)
marker = 3;
else
continue;
if (avpriv_dca_convert_bitstream(VAR_1-2, 12, hdr, 12) < 0)
continue;
init_get_bits(&gb, hdr, 96);
skip_bits_long(&gb, 39);
sample_blocks = get_bits(&gb, 7) + 1;
if (sample_blocks < 8)
continue;
framesize = get_bits(&gb, 14) + 1;
if (framesize < 95)
continue;
skip_bits(&gb, 6);
sr_code = get_bits(&gb, 4);
sample_rate = avpriv_dca_sample_rates[sr_code];
if (sample_rate == 0)
continue;
get_bits(&gb, 5);
if (get_bits(&gb, 1))
continue;
skip_bits_long(&gb, 9);
lfe = get_bits(&gb, 2);
if (lfe > 2)
continue;
marker += 4* sr_code;
VAR_2[marker] ++;
}
if (VAR_3 > 3)
return AVPROBE_SCORE_EXTENSION + 1;
VAR_5 = VAR_6 = 0;
for (VAR_8=0; VAR_8<FF_ARRAY_ELEMS(VAR_2); VAR_8++) {
VAR_5 += VAR_2[VAR_8];
if (VAR_2[VAR_6] < VAR_2[VAR_8])
VAR_6 = VAR_8;
}
if (VAR_2[VAR_6] > 3 && VAR_0->buf_size / VAR_2[VAR_6] < 32*1024 &&
VAR_2[VAR_6] * 4 > VAR_5 * 3 &&
diff / VAR_0->buf_size > 200)
return AVPROBE_SCORE_EXTENSION + 1;
return 0;
}
| [
"static int FUNC_0(AVProbeData *VAR_0)\n{",
"const uint8_t *VAR_1, *bufp;",
"uint32_t state = -1;",
"int VAR_2[4*16] = {0};",
"int VAR_3 = 0, VAR_4 = 0;",
"int VAR_5, VAR_6, VAR_7, VAR_8;",
"int64_t diff = 0;",
"uint8_t hdr[12 + AV_INPUT_BUFFER_PADDING_SIZE] = { 0 };",
"for (VAR_7 = FFMIN(4096, VAR_0->buf_size); VAR_7 < VAR_0->buf_size - 2; VAR_7 += 2) {",
"int marker, sample_blocks, sample_rate, sr_code, framesize;",
"int lfe, wide_hdr, hdr_size;",
"GetBitContext gb;",
"bufp = VAR_1 = VAR_0->VAR_1 + VAR_7;",
"state = (state << 16) | bytestream_get_be16(&bufp);",
"if (VAR_7 >= 4)\ndiff += FFABS(((int16_t)AV_RL16(VAR_1)) - (int16_t)AV_RL16(VAR_1-4));",
"if (state == DCA_SYNCWORD_SUBSTREAM) {",
"if (VAR_7 < VAR_4)\ncontinue;",
"init_get_bits(&gb, VAR_1 - 2, 96);",
"skip_bits_long(&gb, 42);",
"wide_hdr = get_bits1(&gb);",
"hdr_size = get_bits(&gb, 8 + 4 * wide_hdr) + 1;",
"framesize = get_bits(&gb, 16 + 4 * wide_hdr) + 1;",
"if (hdr_size & 3 || framesize & 3)\ncontinue;",
"if (hdr_size < 16 || framesize < hdr_size)\ncontinue;",
"if (VAR_7 - 2 + hdr_size > VAR_0->buf_size)\ncontinue;",
"if (av_crc(av_crc_get_table(AV_CRC_16_CCITT), 0xffff, VAR_1 + 3, hdr_size - 5))\ncontinue;",
"if (VAR_7 == VAR_4)\nVAR_3++;",
"else\nVAR_3 = FFMAX(1, VAR_3 - 1);",
"VAR_4 = VAR_7 + framesize;",
"continue;",
"}",
"if (state == DCA_SYNCWORD_CORE_BE &&\n(bytestream_get_be16(&bufp) & 0xFC00) == 0xFC00)\nmarker = 0;",
"else if (state == DCA_SYNCWORD_CORE_LE &&\n(bytestream_get_be16(&bufp) & 0x00FC) == 0x00FC)\nmarker = 1;",
"else if (state == DCA_SYNCWORD_CORE_14B_BE &&\n(bytestream_get_be16(&bufp) & 0xFFF0) == 0x07F0)\nmarker = 2;",
"else if (state == DCA_SYNCWORD_CORE_14B_LE &&\n(bytestream_get_be16(&bufp) & 0xF0FF) == 0xF007)\nmarker = 3;",
"else\ncontinue;",
"if (avpriv_dca_convert_bitstream(VAR_1-2, 12, hdr, 12) < 0)\ncontinue;",
"init_get_bits(&gb, hdr, 96);",
"skip_bits_long(&gb, 39);",
"sample_blocks = get_bits(&gb, 7) + 1;",
"if (sample_blocks < 8)\ncontinue;",
"framesize = get_bits(&gb, 14) + 1;",
"if (framesize < 95)\ncontinue;",
"skip_bits(&gb, 6);",
"sr_code = get_bits(&gb, 4);",
"sample_rate = avpriv_dca_sample_rates[sr_code];",
"if (sample_rate == 0)\ncontinue;",
"get_bits(&gb, 5);",
"if (get_bits(&gb, 1))\ncontinue;",
"skip_bits_long(&gb, 9);",
"lfe = get_bits(&gb, 2);",
"if (lfe > 2)\ncontinue;",
"marker += 4* sr_code;",
"VAR_2[marker] ++;",
"}",
"if (VAR_3 > 3)\nreturn AVPROBE_SCORE_EXTENSION + 1;",
"VAR_5 = VAR_6 = 0;",
"for (VAR_8=0; VAR_8<FF_ARRAY_ELEMS(VAR_2); VAR_8++) {",
"VAR_5 += VAR_2[VAR_8];",
"if (VAR_2[VAR_6] < VAR_2[VAR_8])\nVAR_6 = VAR_8;",
"}",
"if (VAR_2[VAR_6] > 3 && VAR_0->buf_size / VAR_2[VAR_6] < 32*1024 &&\nVAR_2[VAR_6] * 4 > VAR_5 * 3 &&\ndiff / VAR_0->buf_size > 200)\nreturn AVPROBE_SCORE_EXTENSION + 1;",
"return 0;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
21
],
[
23
],
[
25
],
[
27
],
[
31
],
[
33
],
[
37,
39
],
[
45
],
[
47,
49
],
[
53
],
[
55
],
[
59
],
[
61
],
[
63
],
[
65,
67
],
[
69,
71
],
[
73,
75
],
[
77,
79
],
[
83,
85
],
[
87,
89
],
[
91
],
[
93
],
[
95
],
[
101,
103,
105
],
[
107,
109,
111
],
[
117,
119,
121
],
[
127,
129,
131
],
[
133,
135
],
[
139,
141
],
[
145
],
[
147
],
[
151
],
[
153,
155
],
[
159
],
[
161,
163
],
[
167
],
[
169
],
[
171
],
[
173,
175
],
[
179
],
[
181,
183
],
[
187
],
[
189
],
[
191,
193
],
[
197
],
[
201
],
[
203
],
[
207,
209
],
[
213
],
[
215
],
[
217
],
[
219,
221
],
[
223
],
[
227,
229,
231,
233
],
[
237
],
[
239
]
] |
19,727 | static int wc3_read_packet(AVFormatContext *s,
AVPacket *pkt)
{
Wc3DemuxContext *wc3 = s->priv_data;
ByteIOContext *pb = s->pb;
unsigned int fourcc_tag;
unsigned int size;
int packet_read = 0;
int ret = 0;
unsigned char preamble[WC3_PREAMBLE_SIZE];
unsigned char text[1024];
unsigned int palette_number;
int i;
unsigned char r, g, b;
int base_palette_index;
while (!packet_read) {
/* get the next chunk preamble */
if ((ret = get_buffer(pb, preamble, WC3_PREAMBLE_SIZE)) !=
WC3_PREAMBLE_SIZE)
ret = AVERROR(EIO);
fourcc_tag = AV_RL32(&preamble[0]);
/* chunk sizes are 16-bit aligned */
size = (AV_RB32(&preamble[4]) + 1) & (~1);
switch (fourcc_tag) {
case BRCH_TAG:
/* no-op */
break;
case SHOT_TAG:
/* load up new palette */
if ((ret = get_buffer(pb, preamble, 4)) != 4)
return AVERROR(EIO);
palette_number = AV_RL32(&preamble[0]);
if (palette_number >= wc3->palette_count)
return AVERROR_INVALIDDATA;
base_palette_index = palette_number * PALETTE_COUNT * 3;
for (i = 0; i < PALETTE_COUNT; i++) {
r = wc3->palettes[base_palette_index + i * 3 + 0];
g = wc3->palettes[base_palette_index + i * 3 + 1];
b = wc3->palettes[base_palette_index + i * 3 + 2];
wc3->palette_control.palette[i] = (r << 16) | (g << 8) | (b);
}
wc3->palette_control.palette_changed = 1;
break;
case VGA__TAG:
/* send out video chunk */
ret= av_get_packet(pb, pkt, size);
pkt->stream_index = wc3->video_stream_index;
pkt->pts = wc3->pts;
if (ret != size)
ret = AVERROR(EIO);
packet_read = 1;
break;
case TEXT_TAG:
/* subtitle chunk */
#if 0
url_fseek(pb, size, SEEK_CUR);
#else
if ((unsigned)size > sizeof(text) || (ret = get_buffer(pb, text, size)) != size)
ret = AVERROR(EIO);
else {
int i = 0;
av_log (s, AV_LOG_DEBUG, "Subtitle time!\n");
av_log (s, AV_LOG_DEBUG, " inglish: %s\n", &text[i + 1]);
i += text[i] + 1;
av_log (s, AV_LOG_DEBUG, " doytsch: %s\n", &text[i + 1]);
i += text[i] + 1;
av_log (s, AV_LOG_DEBUG, " fronsay: %s\n", &text[i + 1]);
}
#endif
break;
case AUDI_TAG:
/* send out audio chunk */
ret= av_get_packet(pb, pkt, size);
pkt->stream_index = wc3->audio_stream_index;
pkt->pts = wc3->pts;
if (ret != size)
ret = AVERROR(EIO);
/* time to advance pts */
wc3->pts++;
packet_read = 1;
break;
default:
av_log (s, AV_LOG_ERROR, " unrecognized WC3 chunk: %c%c%c%c (0x%02X%02X%02X%02X)\n",
preamble[0], preamble[1], preamble[2], preamble[3],
preamble[0], preamble[1], preamble[2], preamble[3]);
ret = AVERROR_INVALIDDATA;
packet_read = 1;
break;
}
}
return ret;
}
| false | FFmpeg | e584914acddaeb21f5258d9947b530fbd9421ab8 | static int wc3_read_packet(AVFormatContext *s,
AVPacket *pkt)
{
Wc3DemuxContext *wc3 = s->priv_data;
ByteIOContext *pb = s->pb;
unsigned int fourcc_tag;
unsigned int size;
int packet_read = 0;
int ret = 0;
unsigned char preamble[WC3_PREAMBLE_SIZE];
unsigned char text[1024];
unsigned int palette_number;
int i;
unsigned char r, g, b;
int base_palette_index;
while (!packet_read) {
if ((ret = get_buffer(pb, preamble, WC3_PREAMBLE_SIZE)) !=
WC3_PREAMBLE_SIZE)
ret = AVERROR(EIO);
fourcc_tag = AV_RL32(&preamble[0]);
size = (AV_RB32(&preamble[4]) + 1) & (~1);
switch (fourcc_tag) {
case BRCH_TAG:
break;
case SHOT_TAG:
if ((ret = get_buffer(pb, preamble, 4)) != 4)
return AVERROR(EIO);
palette_number = AV_RL32(&preamble[0]);
if (palette_number >= wc3->palette_count)
return AVERROR_INVALIDDATA;
base_palette_index = palette_number * PALETTE_COUNT * 3;
for (i = 0; i < PALETTE_COUNT; i++) {
r = wc3->palettes[base_palette_index + i * 3 + 0];
g = wc3->palettes[base_palette_index + i * 3 + 1];
b = wc3->palettes[base_palette_index + i * 3 + 2];
wc3->palette_control.palette[i] = (r << 16) | (g << 8) | (b);
}
wc3->palette_control.palette_changed = 1;
break;
case VGA__TAG:
ret= av_get_packet(pb, pkt, size);
pkt->stream_index = wc3->video_stream_index;
pkt->pts = wc3->pts;
if (ret != size)
ret = AVERROR(EIO);
packet_read = 1;
break;
case TEXT_TAG:
#if 0
url_fseek(pb, size, SEEK_CUR);
#else
if ((unsigned)size > sizeof(text) || (ret = get_buffer(pb, text, size)) != size)
ret = AVERROR(EIO);
else {
int i = 0;
av_log (s, AV_LOG_DEBUG, "Subtitle time!\n");
av_log (s, AV_LOG_DEBUG, " inglish: %s\n", &text[i + 1]);
i += text[i] + 1;
av_log (s, AV_LOG_DEBUG, " doytsch: %s\n", &text[i + 1]);
i += text[i] + 1;
av_log (s, AV_LOG_DEBUG, " fronsay: %s\n", &text[i + 1]);
}
#endif
break;
case AUDI_TAG:
ret= av_get_packet(pb, pkt, size);
pkt->stream_index = wc3->audio_stream_index;
pkt->pts = wc3->pts;
if (ret != size)
ret = AVERROR(EIO);
wc3->pts++;
packet_read = 1;
break;
default:
av_log (s, AV_LOG_ERROR, " unrecognized WC3 chunk: %c%c%c%c (0x%02X%02X%02X%02X)\n",
preamble[0], preamble[1], preamble[2], preamble[3],
preamble[0], preamble[1], preamble[2], preamble[3]);
ret = AVERROR_INVALIDDATA;
packet_read = 1;
break;
}
}
return ret;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(AVFormatContext *VAR_0,
AVPacket *VAR_1)
{
Wc3DemuxContext *wc3 = VAR_0->priv_data;
ByteIOContext *pb = VAR_0->pb;
unsigned int VAR_2;
unsigned int VAR_3;
int VAR_4 = 0;
int VAR_5 = 0;
unsigned char VAR_6[WC3_PREAMBLE_SIZE];
unsigned char VAR_7[1024];
unsigned int VAR_8;
int VAR_14;
unsigned char VAR_10, VAR_11, VAR_12;
int VAR_13;
while (!VAR_4) {
if ((VAR_5 = get_buffer(pb, VAR_6, WC3_PREAMBLE_SIZE)) !=
WC3_PREAMBLE_SIZE)
VAR_5 = AVERROR(EIO);
VAR_2 = AV_RL32(&VAR_6[0]);
VAR_3 = (AV_RB32(&VAR_6[4]) + 1) & (~1);
switch (VAR_2) {
case BRCH_TAG:
break;
case SHOT_TAG:
if ((VAR_5 = get_buffer(pb, VAR_6, 4)) != 4)
return AVERROR(EIO);
VAR_8 = AV_RL32(&VAR_6[0]);
if (VAR_8 >= wc3->palette_count)
return AVERROR_INVALIDDATA;
VAR_13 = VAR_8 * PALETTE_COUNT * 3;
for (VAR_14 = 0; VAR_14 < PALETTE_COUNT; VAR_14++) {
VAR_10 = wc3->palettes[VAR_13 + VAR_14 * 3 + 0];
VAR_11 = wc3->palettes[VAR_13 + VAR_14 * 3 + 1];
VAR_12 = wc3->palettes[VAR_13 + VAR_14 * 3 + 2];
wc3->palette_control.palette[VAR_14] = (VAR_10 << 16) | (VAR_11 << 8) | (VAR_12);
}
wc3->palette_control.palette_changed = 1;
break;
case VGA__TAG:
VAR_5= av_get_packet(pb, VAR_1, VAR_3);
VAR_1->stream_index = wc3->video_stream_index;
VAR_1->pts = wc3->pts;
if (VAR_5 != VAR_3)
VAR_5 = AVERROR(EIO);
VAR_4 = 1;
break;
case TEXT_TAG:
#if 0
url_fseek(pb, VAR_3, SEEK_CUR);
#else
if ((unsigned)VAR_3 > sizeof(VAR_7) || (VAR_5 = get_buffer(pb, VAR_7, VAR_3)) != VAR_3)
VAR_5 = AVERROR(EIO);
else {
int VAR_14 = 0;
av_log (VAR_0, AV_LOG_DEBUG, "Subtitle time!\n");
av_log (VAR_0, AV_LOG_DEBUG, " inglish: %VAR_0\n", &VAR_7[VAR_14 + 1]);
VAR_14 += VAR_7[VAR_14] + 1;
av_log (VAR_0, AV_LOG_DEBUG, " doytsch: %VAR_0\n", &VAR_7[VAR_14 + 1]);
VAR_14 += VAR_7[VAR_14] + 1;
av_log (VAR_0, AV_LOG_DEBUG, " fronsay: %VAR_0\n", &VAR_7[VAR_14 + 1]);
}
#endif
break;
case AUDI_TAG:
VAR_5= av_get_packet(pb, VAR_1, VAR_3);
VAR_1->stream_index = wc3->audio_stream_index;
VAR_1->pts = wc3->pts;
if (VAR_5 != VAR_3)
VAR_5 = AVERROR(EIO);
wc3->pts++;
VAR_4 = 1;
break;
default:
av_log (VAR_0, AV_LOG_ERROR, " unrecognized WC3 chunk: %c%c%c%c (0x%02X%02X%02X%02X)\n",
VAR_6[0], VAR_6[1], VAR_6[2], VAR_6[3],
VAR_6[0], VAR_6[1], VAR_6[2], VAR_6[3]);
VAR_5 = AVERROR_INVALIDDATA;
VAR_4 = 1;
break;
}
}
return VAR_5;
}
| [
"static int FUNC_0(AVFormatContext *VAR_0,\nAVPacket *VAR_1)\n{",
"Wc3DemuxContext *wc3 = VAR_0->priv_data;",
"ByteIOContext *pb = VAR_0->pb;",
"unsigned int VAR_2;",
"unsigned int VAR_3;",
"int VAR_4 = 0;",
"int VAR_5 = 0;",
"unsigned char VAR_6[WC3_PREAMBLE_SIZE];",
"unsigned char VAR_7[1024];",
"unsigned int VAR_8;",
"int VAR_14;",
"unsigned char VAR_10, VAR_11, VAR_12;",
"int VAR_13;",
"while (!VAR_4) {",
"if ((VAR_5 = get_buffer(pb, VAR_6, WC3_PREAMBLE_SIZE)) !=\nWC3_PREAMBLE_SIZE)\nVAR_5 = AVERROR(EIO);",
"VAR_2 = AV_RL32(&VAR_6[0]);",
"VAR_3 = (AV_RB32(&VAR_6[4]) + 1) & (~1);",
"switch (VAR_2) {",
"case BRCH_TAG:\nbreak;",
"case SHOT_TAG:\nif ((VAR_5 = get_buffer(pb, VAR_6, 4)) != 4)\nreturn AVERROR(EIO);",
"VAR_8 = AV_RL32(&VAR_6[0]);",
"if (VAR_8 >= wc3->palette_count)\nreturn AVERROR_INVALIDDATA;",
"VAR_13 = VAR_8 * PALETTE_COUNT * 3;",
"for (VAR_14 = 0; VAR_14 < PALETTE_COUNT; VAR_14++) {",
"VAR_10 = wc3->palettes[VAR_13 + VAR_14 * 3 + 0];",
"VAR_11 = wc3->palettes[VAR_13 + VAR_14 * 3 + 1];",
"VAR_12 = wc3->palettes[VAR_13 + VAR_14 * 3 + 2];",
"wc3->palette_control.palette[VAR_14] = (VAR_10 << 16) | (VAR_11 << 8) | (VAR_12);",
"}",
"wc3->palette_control.palette_changed = 1;",
"break;",
"case VGA__TAG:\nVAR_5= av_get_packet(pb, VAR_1, VAR_3);",
"VAR_1->stream_index = wc3->video_stream_index;",
"VAR_1->pts = wc3->pts;",
"if (VAR_5 != VAR_3)\nVAR_5 = AVERROR(EIO);",
"VAR_4 = 1;",
"break;",
"case TEXT_TAG:\n#if 0\nurl_fseek(pb, VAR_3, SEEK_CUR);",
"#else\nif ((unsigned)VAR_3 > sizeof(VAR_7) || (VAR_5 = get_buffer(pb, VAR_7, VAR_3)) != VAR_3)\nVAR_5 = AVERROR(EIO);",
"else {",
"int VAR_14 = 0;",
"av_log (VAR_0, AV_LOG_DEBUG, \"Subtitle time!\\n\");",
"av_log (VAR_0, AV_LOG_DEBUG, \" inglish: %VAR_0\\n\", &VAR_7[VAR_14 + 1]);",
"VAR_14 += VAR_7[VAR_14] + 1;",
"av_log (VAR_0, AV_LOG_DEBUG, \" doytsch: %VAR_0\\n\", &VAR_7[VAR_14 + 1]);",
"VAR_14 += VAR_7[VAR_14] + 1;",
"av_log (VAR_0, AV_LOG_DEBUG, \" fronsay: %VAR_0\\n\", &VAR_7[VAR_14 + 1]);",
"}",
"#endif\nbreak;",
"case AUDI_TAG:\nVAR_5= av_get_packet(pb, VAR_1, VAR_3);",
"VAR_1->stream_index = wc3->audio_stream_index;",
"VAR_1->pts = wc3->pts;",
"if (VAR_5 != VAR_3)\nVAR_5 = AVERROR(EIO);",
"wc3->pts++;",
"VAR_4 = 1;",
"break;",
"default:\nav_log (VAR_0, AV_LOG_ERROR, \" unrecognized WC3 chunk: %c%c%c%c (0x%02X%02X%02X%02X)\\n\",\nVAR_6[0], VAR_6[1], VAR_6[2], VAR_6[3],\nVAR_6[0], VAR_6[1], VAR_6[2], VAR_6[3]);",
"VAR_5 = AVERROR_INVALIDDATA;",
"VAR_4 = 1;",
"break;",
"}",
"}",
"return VAR_5;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
39,
41,
43
],
[
47
],
[
51
],
[
55
],
[
59,
63
],
[
67,
71,
73
],
[
75
],
[
77,
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
101,
105
],
[
107
],
[
109
],
[
111,
113
],
[
115
],
[
117
],
[
121,
125,
127
],
[
129,
131,
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149
],
[
151
],
[
153,
155
],
[
159,
163
],
[
165
],
[
167
],
[
169,
171
],
[
177
],
[
181
],
[
183
],
[
187,
189,
191,
193
],
[
195
],
[
197
],
[
199
],
[
201
],
[
203
],
[
207
],
[
209
]
] |
19,729 | int ff_h264_field_end(H264Context *h, H264SliceContext *sl, int in_setup)
{
AVCodecContext *const avctx = h->avctx;
int err = 0;
h->mb_y = 0;
if (!in_setup && !h->droppable)
ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX,
h->picture_structure == PICT_BOTTOM_FIELD);
if (in_setup || !(avctx->active_thread_type & FF_THREAD_FRAME)) {
if (!h->droppable) {
err = ff_h264_execute_ref_pic_marking(h);
h->poc.prev_poc_msb = h->poc.poc_msb;
h->poc.prev_poc_lsb = h->poc.poc_lsb;
}
h->poc.prev_frame_num_offset = h->poc.frame_num_offset;
h->poc.prev_frame_num = h->poc.frame_num;
}
if (avctx->hwaccel) {
if (avctx->hwaccel->end_frame(avctx) < 0)
av_log(avctx, AV_LOG_ERROR,
"hardware accelerator failed to decode picture\n");
}
#if CONFIG_ERROR_RESILIENCE
/*
* FIXME: Error handling code does not seem to support interlaced
* when slices span multiple rows
* The ff_er_add_slice calls don't work right for bottom
* fields; they cause massive erroneous error concealing
* Error marking covers both fields (top and bottom).
* This causes a mismatched s->error_count
* and a bad error table. Further, the error count goes to
* INT_MAX when called for bottom field, because mb_y is
* past end by one (callers fault) and resync_mb_y != 0
* causes problems for the first MB line, too.
*/
if (!FIELD_PICTURE(h) && h->enable_er) {
h264_set_erpic(&sl->er.cur_pic, h->cur_pic_ptr);
h264_set_erpic(&sl->er.last_pic,
sl->ref_count[0] ? sl->ref_list[0][0].parent : NULL);
h264_set_erpic(&sl->er.next_pic,
sl->ref_count[1] ? sl->ref_list[1][0].parent : NULL);
ff_er_frame_end(&sl->er);
}
#endif /* CONFIG_ERROR_RESILIENCE */
emms_c();
h->current_slice = 0;
return err;
} | true | FFmpeg | 45286a625c6ced1f5c4c842244cbb4509429abba | int ff_h264_field_end(H264Context *h, H264SliceContext *sl, int in_setup)
{
AVCodecContext *const avctx = h->avctx;
int err = 0;
h->mb_y = 0;
if (!in_setup && !h->droppable)
ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX,
h->picture_structure == PICT_BOTTOM_FIELD);
if (in_setup || !(avctx->active_thread_type & FF_THREAD_FRAME)) {
if (!h->droppable) {
err = ff_h264_execute_ref_pic_marking(h);
h->poc.prev_poc_msb = h->poc.poc_msb;
h->poc.prev_poc_lsb = h->poc.poc_lsb;
}
h->poc.prev_frame_num_offset = h->poc.frame_num_offset;
h->poc.prev_frame_num = h->poc.frame_num;
}
if (avctx->hwaccel) {
if (avctx->hwaccel->end_frame(avctx) < 0)
av_log(avctx, AV_LOG_ERROR,
"hardware accelerator failed to decode picture\n");
}
#if CONFIG_ERROR_RESILIENCE
if (!FIELD_PICTURE(h) && h->enable_er) {
h264_set_erpic(&sl->er.cur_pic, h->cur_pic_ptr);
h264_set_erpic(&sl->er.last_pic,
sl->ref_count[0] ? sl->ref_list[0][0].parent : NULL);
h264_set_erpic(&sl->er.next_pic,
sl->ref_count[1] ? sl->ref_list[1][0].parent : NULL);
ff_er_frame_end(&sl->er);
}
#endif
emms_c();
h->current_slice = 0;
return err;
} | {
"code": [],
"line_no": []
} | int FUNC_0(H264Context *VAR_0, H264SliceContext *VAR_1, int VAR_2)
{
AVCodecContext *const avctx = VAR_0->avctx;
int VAR_3 = 0;
VAR_0->mb_y = 0;
if (!VAR_2 && !VAR_0->droppable)
ff_thread_report_progress(&VAR_0->cur_pic_ptr->tf, INT_MAX,
VAR_0->picture_structure == PICT_BOTTOM_FIELD);
if (VAR_2 || !(avctx->active_thread_type & FF_THREAD_FRAME)) {
if (!VAR_0->droppable) {
VAR_3 = ff_h264_execute_ref_pic_marking(VAR_0);
VAR_0->poc.prev_poc_msb = VAR_0->poc.poc_msb;
VAR_0->poc.prev_poc_lsb = VAR_0->poc.poc_lsb;
}
VAR_0->poc.prev_frame_num_offset = VAR_0->poc.frame_num_offset;
VAR_0->poc.prev_frame_num = VAR_0->poc.frame_num;
}
if (avctx->hwaccel) {
if (avctx->hwaccel->end_frame(avctx) < 0)
av_log(avctx, AV_LOG_ERROR,
"hardware accelerator failed to decode picture\n");
}
#if CONFIG_ERROR_RESILIENCE
if (!FIELD_PICTURE(VAR_0) && VAR_0->enable_er) {
h264_set_erpic(&VAR_1->er.cur_pic, VAR_0->cur_pic_ptr);
h264_set_erpic(&VAR_1->er.last_pic,
VAR_1->ref_count[0] ? VAR_1->ref_list[0][0].parent : NULL);
h264_set_erpic(&VAR_1->er.next_pic,
VAR_1->ref_count[1] ? VAR_1->ref_list[1][0].parent : NULL);
ff_er_frame_end(&VAR_1->er);
}
#endif
emms_c();
VAR_0->current_slice = 0;
return VAR_3;
} | [
"int FUNC_0(H264Context *VAR_0, H264SliceContext *VAR_1, int VAR_2)\n{",
"AVCodecContext *const avctx = VAR_0->avctx;",
"int VAR_3 = 0;",
"VAR_0->mb_y = 0;",
"if (!VAR_2 && !VAR_0->droppable)\nff_thread_report_progress(&VAR_0->cur_pic_ptr->tf, INT_MAX,\nVAR_0->picture_structure == PICT_BOTTOM_FIELD);",
"if (VAR_2 || !(avctx->active_thread_type & FF_THREAD_FRAME)) {",
"if (!VAR_0->droppable) {",
"VAR_3 = ff_h264_execute_ref_pic_marking(VAR_0);",
"VAR_0->poc.prev_poc_msb = VAR_0->poc.poc_msb;",
"VAR_0->poc.prev_poc_lsb = VAR_0->poc.poc_lsb;",
"}",
"VAR_0->poc.prev_frame_num_offset = VAR_0->poc.frame_num_offset;",
"VAR_0->poc.prev_frame_num = VAR_0->poc.frame_num;",
"}",
"if (avctx->hwaccel) {",
"if (avctx->hwaccel->end_frame(avctx) < 0)\nav_log(avctx, AV_LOG_ERROR,\n\"hardware accelerator failed to decode picture\\n\");",
"}",
"#if CONFIG_ERROR_RESILIENCE\nif (!FIELD_PICTURE(VAR_0) && VAR_0->enable_er) {",
"h264_set_erpic(&VAR_1->er.cur_pic, VAR_0->cur_pic_ptr);",
"h264_set_erpic(&VAR_1->er.last_pic,\nVAR_1->ref_count[0] ? VAR_1->ref_list[0][0].parent : NULL);",
"h264_set_erpic(&VAR_1->er.next_pic,\nVAR_1->ref_count[1] ? VAR_1->ref_list[1][0].parent : NULL);",
"ff_er_frame_end(&VAR_1->er);",
"}",
"#endif\nemms_c();",
"VAR_0->current_slice = 0;",
"return VAR_3;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13,
15,
17
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
41
],
[
43,
45,
47
],
[
49
],
[
53,
79
],
[
81
],
[
83,
85
],
[
87,
89
],
[
91
],
[
93
],
[
95,
99
],
[
103
],
[
108
],
[
110
]
] |
19,730 | static void pic_common_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
dc->vmsd = &vmstate_pic_common;
dc->no_user = 1;
dc->props = pic_properties_common;
dc->realize = pic_common_realize;
}
| true | qemu | efec3dd631d94160288392721a5f9c39e50fb2bc | static void pic_common_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
dc->vmsd = &vmstate_pic_common;
dc->no_user = 1;
dc->props = pic_properties_common;
dc->realize = pic_common_realize;
}
| {
"code": [
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;",
" dc->no_user = 1;"
],
"line_no": [
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,
11,
11,
11,
11,
11,
11
]
} | static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)
{
DeviceClass *dc = DEVICE_CLASS(VAR_0);
dc->vmsd = &vmstate_pic_common;
dc->no_user = 1;
dc->props = pic_properties_common;
dc->realize = pic_common_realize;
}
| [
"static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{",
"DeviceClass *dc = DEVICE_CLASS(VAR_0);",
"dc->vmsd = &vmstate_pic_common;",
"dc->no_user = 1;",
"dc->props = pic_properties_common;",
"dc->realize = pic_common_realize;",
"}"
] | [
0,
0,
0,
1,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
]
] |
19,731 | static AVFrame *alloc_frame(enum AVPixelFormat pixfmt, int w, int h)
{
AVFrame *frame = av_frame_alloc();
if (!frame)
return NULL;
frame->format = pixfmt;
frame->width = w;
frame->height = h;
if (av_frame_get_buffer(frame, 32) < 0)
return NULL;
return frame;
}
| true | FFmpeg | 7ad742b2247a0d6f742a656892b4963fa77744dd | static AVFrame *alloc_frame(enum AVPixelFormat pixfmt, int w, int h)
{
AVFrame *frame = av_frame_alloc();
if (!frame)
return NULL;
frame->format = pixfmt;
frame->width = w;
frame->height = h;
if (av_frame_get_buffer(frame, 32) < 0)
return NULL;
return frame;
}
| {
"code": [
" if (av_frame_get_buffer(frame, 32) < 0)"
],
"line_no": [
21
]
} | static AVFrame *FUNC_0(enum AVPixelFormat pixfmt, int w, int h)
{
AVFrame *frame = av_frame_alloc();
if (!frame)
return NULL;
frame->format = pixfmt;
frame->width = w;
frame->height = h;
if (av_frame_get_buffer(frame, 32) < 0)
return NULL;
return frame;
}
| [
"static AVFrame *FUNC_0(enum AVPixelFormat pixfmt, int w, int h)\n{",
"AVFrame *frame = av_frame_alloc();",
"if (!frame)\nreturn NULL;",
"frame->format = pixfmt;",
"frame->width = w;",
"frame->height = h;",
"if (av_frame_get_buffer(frame, 32) < 0)\nreturn NULL;",
"return frame;",
"}"
] | [
0,
0,
0,
0,
0,
0,
1,
0,
0
] | [
[
1,
3
],
[
5
],
[
7,
9
],
[
13
],
[
15
],
[
17
],
[
21,
23
],
[
27
],
[
29
]
] |
19,732 | void qdev_init_nofail(DeviceState *dev)
{
Error *err = NULL;
assert(!dev->realized);
object_property_set_bool(OBJECT(dev), true, "realized", &err);
if (err) {
error_reportf_err(err, "Initialization of device %s failed: ",
object_get_typename(OBJECT(dev)));
exit(1);
}
} | true | qemu | 0d4104e5760221547fad158bbbb655a4e4c22b50 | void qdev_init_nofail(DeviceState *dev)
{
Error *err = NULL;
assert(!dev->realized);
object_property_set_bool(OBJECT(dev), true, "realized", &err);
if (err) {
error_reportf_err(err, "Initialization of device %s failed: ",
object_get_typename(OBJECT(dev)));
exit(1);
}
} | {
"code": [],
"line_no": []
} | void FUNC_0(DeviceState *VAR_0)
{
Error *err = NULL;
assert(!VAR_0->realized);
object_property_set_bool(OBJECT(VAR_0), true, "realized", &err);
if (err) {
error_reportf_err(err, "Initialization of device %s failed: ",
object_get_typename(OBJECT(VAR_0)));
exit(1);
}
} | [
"void FUNC_0(DeviceState *VAR_0)\n{",
"Error *err = NULL;",
"assert(!VAR_0->realized);",
"object_property_set_bool(OBJECT(VAR_0), true, \"realized\", &err);",
"if (err) {",
"error_reportf_err(err, \"Initialization of device %s failed: \",\nobject_get_typename(OBJECT(VAR_0)));",
"exit(1);",
"}",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
9
],
[
14
],
[
16
],
[
18,
20
],
[
22
],
[
24
],
[
27
]
] |
19,733 | static int disas_neon_data_insn(CPUState * env, DisasContext *s, uint32_t insn)
{
int op;
int q;
int rd, rn, rm;
int size;
int shift;
int pass;
int count;
int pairwise;
int u;
int n;
uint32_t imm, mask;
TCGv tmp, tmp2, tmp3, tmp4, tmp5;
TCGv_i64 tmp64;
if (!s->vfp_enabled)
return 1;
q = (insn & (1 << 6)) != 0;
u = (insn >> 24) & 1;
VFP_DREG_D(rd, insn);
VFP_DREG_N(rn, insn);
VFP_DREG_M(rm, insn);
size = (insn >> 20) & 3;
if ((insn & (1 << 23)) == 0) {
/* Three register same length. */
op = ((insn >> 7) & 0x1e) | ((insn >> 4) & 1);
if (size == 3 && (op == 1 || op == 5 || op == 8 || op == 9
|| op == 10 || op == 11 || op == 16)) {
/* 64-bit element instructions. */
for (pass = 0; pass < (q ? 2 : 1); pass++) {
neon_load_reg64(cpu_V0, rn + pass);
neon_load_reg64(cpu_V1, rm + pass);
switch (op) {
case 1: /* VQADD */
if (u) {
gen_helper_neon_add_saturate_u64(CPU_V001);
} else {
gen_helper_neon_add_saturate_s64(CPU_V001);
}
break;
case 5: /* VQSUB */
if (u) {
gen_helper_neon_sub_saturate_u64(CPU_V001);
} else {
gen_helper_neon_sub_saturate_s64(CPU_V001);
}
break;
case 8: /* VSHL */
if (u) {
gen_helper_neon_shl_u64(cpu_V0, cpu_V1, cpu_V0);
} else {
gen_helper_neon_shl_s64(cpu_V0, cpu_V1, cpu_V0);
}
break;
case 9: /* VQSHL */
if (u) {
gen_helper_neon_qshl_u64(cpu_V0, cpu_env,
cpu_V1, cpu_V0);
} else {
gen_helper_neon_qshl_s64(cpu_V0, cpu_env,
cpu_V1, cpu_V0);
}
break;
case 10: /* VRSHL */
if (u) {
gen_helper_neon_rshl_u64(cpu_V0, cpu_V1, cpu_V0);
} else {
gen_helper_neon_rshl_s64(cpu_V0, cpu_V1, cpu_V0);
}
break;
case 11: /* VQRSHL */
if (u) {
gen_helper_neon_qrshl_u64(cpu_V0, cpu_env,
cpu_V1, cpu_V0);
} else {
gen_helper_neon_qrshl_s64(cpu_V0, cpu_env,
cpu_V1, cpu_V0);
}
break;
case 16:
if (u) {
tcg_gen_sub_i64(CPU_V001);
} else {
tcg_gen_add_i64(CPU_V001);
}
break;
default:
abort();
}
neon_store_reg64(cpu_V0, rd + pass);
}
return 0;
}
switch (op) {
case 8: /* VSHL */
case 9: /* VQSHL */
case 10: /* VRSHL */
case 11: /* VQRSHL */
{
int rtmp;
/* Shift instruction operands are reversed. */
rtmp = rn;
rn = rm;
rm = rtmp;
pairwise = 0;
}
break;
case 20: /* VPMAX */
case 21: /* VPMIN */
case 23: /* VPADD */
pairwise = 1;
break;
case 26: /* VPADD (float) */
pairwise = (u && size < 2);
break;
case 30: /* VPMIN/VPMAX (float) */
pairwise = u;
break;
default:
pairwise = 0;
break;
}
for (pass = 0; pass < (q ? 4 : 2); pass++) {
if (pairwise) {
/* Pairwise. */
if (q)
n = (pass & 1) * 2;
else
n = 0;
if (pass < q + 1) {
tmp = neon_load_reg(rn, n);
tmp2 = neon_load_reg(rn, n + 1);
} else {
tmp = neon_load_reg(rm, n);
tmp2 = neon_load_reg(rm, n + 1);
}
} else {
/* Elementwise. */
tmp = neon_load_reg(rn, pass);
tmp2 = neon_load_reg(rm, pass);
}
switch (op) {
case 0: /* VHADD */
GEN_NEON_INTEGER_OP(hadd);
break;
case 1: /* VQADD */
GEN_NEON_INTEGER_OP_ENV(qadd);
break;
case 2: /* VRHADD */
GEN_NEON_INTEGER_OP(rhadd);
break;
case 3: /* Logic ops. */
switch ((u << 2) | size) {
case 0: /* VAND */
tcg_gen_and_i32(tmp, tmp, tmp2);
break;
case 1: /* BIC */
tcg_gen_andc_i32(tmp, tmp, tmp2);
break;
case 2: /* VORR */
tcg_gen_or_i32(tmp, tmp, tmp2);
break;
case 3: /* VORN */
tcg_gen_orc_i32(tmp, tmp, tmp2);
break;
case 4: /* VEOR */
tcg_gen_xor_i32(tmp, tmp, tmp2);
break;
case 5: /* VBSL */
tmp3 = neon_load_reg(rd, pass);
gen_neon_bsl(tmp, tmp, tmp2, tmp3);
dead_tmp(tmp3);
break;
case 6: /* VBIT */
tmp3 = neon_load_reg(rd, pass);
gen_neon_bsl(tmp, tmp, tmp3, tmp2);
dead_tmp(tmp3);
break;
case 7: /* VBIF */
tmp3 = neon_load_reg(rd, pass);
gen_neon_bsl(tmp, tmp3, tmp, tmp2);
dead_tmp(tmp3);
break;
}
break;
case 4: /* VHSUB */
GEN_NEON_INTEGER_OP(hsub);
break;
case 5: /* VQSUB */
GEN_NEON_INTEGER_OP_ENV(qsub);
break;
case 6: /* VCGT */
GEN_NEON_INTEGER_OP(cgt);
break;
case 7: /* VCGE */
GEN_NEON_INTEGER_OP(cge);
break;
case 8: /* VSHL */
GEN_NEON_INTEGER_OP(shl);
break;
case 9: /* VQSHL */
GEN_NEON_INTEGER_OP_ENV(qshl);
break;
case 10: /* VRSHL */
GEN_NEON_INTEGER_OP(rshl);
break;
case 11: /* VQRSHL */
GEN_NEON_INTEGER_OP_ENV(qrshl);
break;
case 12: /* VMAX */
GEN_NEON_INTEGER_OP(max);
break;
case 13: /* VMIN */
GEN_NEON_INTEGER_OP(min);
break;
case 14: /* VABD */
GEN_NEON_INTEGER_OP(abd);
break;
case 15: /* VABA */
GEN_NEON_INTEGER_OP(abd);
dead_tmp(tmp2);
tmp2 = neon_load_reg(rd, pass);
gen_neon_add(size, tmp, tmp2);
break;
case 16:
if (!u) { /* VADD */
if (gen_neon_add(size, tmp, tmp2))
return 1;
} else { /* VSUB */
switch (size) {
case 0: gen_helper_neon_sub_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_sub_u16(tmp, tmp, tmp2); break;
case 2: tcg_gen_sub_i32(tmp, tmp, tmp2); break;
default: return 1;
}
}
break;
case 17:
if (!u) { /* VTST */
switch (size) {
case 0: gen_helper_neon_tst_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_tst_u16(tmp, tmp, tmp2); break;
case 2: gen_helper_neon_tst_u32(tmp, tmp, tmp2); break;
default: return 1;
}
} else { /* VCEQ */
switch (size) {
case 0: gen_helper_neon_ceq_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_ceq_u16(tmp, tmp, tmp2); break;
case 2: gen_helper_neon_ceq_u32(tmp, tmp, tmp2); break;
default: return 1;
}
}
break;
case 18: /* Multiply. */
switch (size) {
case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break;
case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break;
default: return 1;
}
dead_tmp(tmp2);
tmp2 = neon_load_reg(rd, pass);
if (u) { /* VMLS */
gen_neon_rsb(size, tmp, tmp2);
} else { /* VMLA */
gen_neon_add(size, tmp, tmp2);
}
break;
case 19: /* VMUL */
if (u) { /* polynomial */
gen_helper_neon_mul_p8(tmp, tmp, tmp2);
} else { /* Integer */
switch (size) {
case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break;
case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break;
default: return 1;
}
}
break;
case 20: /* VPMAX */
GEN_NEON_INTEGER_OP(pmax);
break;
case 21: /* VPMIN */
GEN_NEON_INTEGER_OP(pmin);
break;
case 22: /* Hultiply high. */
if (!u) { /* VQDMULH */
switch (size) {
case 1: gen_helper_neon_qdmulh_s16(tmp, cpu_env, tmp, tmp2); break;
case 2: gen_helper_neon_qdmulh_s32(tmp, cpu_env, tmp, tmp2); break;
default: return 1;
}
} else { /* VQRDHMUL */
switch (size) {
case 1: gen_helper_neon_qrdmulh_s16(tmp, cpu_env, tmp, tmp2); break;
case 2: gen_helper_neon_qrdmulh_s32(tmp, cpu_env, tmp, tmp2); break;
default: return 1;
}
}
break;
case 23: /* VPADD */
if (u)
return 1;
switch (size) {
case 0: gen_helper_neon_padd_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_padd_u16(tmp, tmp, tmp2); break;
case 2: tcg_gen_add_i32(tmp, tmp, tmp2); break;
default: return 1;
}
break;
case 26: /* Floating point arithnetic. */
switch ((u << 2) | size) {
case 0: /* VADD */
gen_helper_neon_add_f32(tmp, tmp, tmp2);
break;
case 2: /* VSUB */
gen_helper_neon_sub_f32(tmp, tmp, tmp2);
break;
case 4: /* VPADD */
gen_helper_neon_add_f32(tmp, tmp, tmp2);
break;
case 6: /* VABD */
gen_helper_neon_abd_f32(tmp, tmp, tmp2);
break;
default:
return 1;
}
break;
case 27: /* Float multiply. */
gen_helper_neon_mul_f32(tmp, tmp, tmp2);
if (!u) {
dead_tmp(tmp2);
tmp2 = neon_load_reg(rd, pass);
if (size == 0) {
gen_helper_neon_add_f32(tmp, tmp, tmp2);
} else {
gen_helper_neon_sub_f32(tmp, tmp2, tmp);
}
}
break;
case 28: /* Float compare. */
if (!u) {
gen_helper_neon_ceq_f32(tmp, tmp, tmp2);
} else {
if (size == 0)
gen_helper_neon_cge_f32(tmp, tmp, tmp2);
else
gen_helper_neon_cgt_f32(tmp, tmp, tmp2);
}
break;
case 29: /* Float compare absolute. */
if (!u)
return 1;
if (size == 0)
gen_helper_neon_acge_f32(tmp, tmp, tmp2);
else
gen_helper_neon_acgt_f32(tmp, tmp, tmp2);
break;
case 30: /* Float min/max. */
if (size == 0)
gen_helper_neon_max_f32(tmp, tmp, tmp2);
else
gen_helper_neon_min_f32(tmp, tmp, tmp2);
break;
case 31:
if (size == 0)
gen_helper_recps_f32(tmp, tmp, tmp2, cpu_env);
else
gen_helper_rsqrts_f32(tmp, tmp, tmp2, cpu_env);
break;
default:
abort();
}
dead_tmp(tmp2);
/* Save the result. For elementwise operations we can put it
straight into the destination register. For pairwise operations
we have to be careful to avoid clobbering the source operands. */
if (pairwise && rd == rm) {
neon_store_scratch(pass, tmp);
} else {
neon_store_reg(rd, pass, tmp);
}
} /* for pass */
if (pairwise && rd == rm) {
for (pass = 0; pass < (q ? 4 : 2); pass++) {
tmp = neon_load_scratch(pass);
neon_store_reg(rd, pass, tmp);
}
}
/* End of 3 register same size operations. */
} else if (insn & (1 << 4)) {
if ((insn & 0x00380080) != 0) {
/* Two registers and shift. */
op = (insn >> 8) & 0xf;
if (insn & (1 << 7)) {
/* 64-bit shift. */
size = 3;
} else {
size = 2;
while ((insn & (1 << (size + 19))) == 0)
size--;
}
shift = (insn >> 16) & ((1 << (3 + size)) - 1);
/* To avoid excessive dumplication of ops we implement shift
by immediate using the variable shift operations. */
if (op < 8) {
/* Shift by immediate:
VSHR, VSRA, VRSHR, VRSRA, VSRI, VSHL, VQSHL, VQSHLU. */
/* Right shifts are encoded as N - shift, where N is the
element size in bits. */
if (op <= 4)
shift = shift - (1 << (size + 3));
if (size == 3) {
count = q + 1;
} else {
count = q ? 4: 2;
}
switch (size) {
case 0:
imm = (uint8_t) shift;
imm |= imm << 8;
imm |= imm << 16;
break;
case 1:
imm = (uint16_t) shift;
imm |= imm << 16;
break;
case 2:
case 3:
imm = shift;
break;
default:
abort();
}
for (pass = 0; pass < count; pass++) {
if (size == 3) {
neon_load_reg64(cpu_V0, rm + pass);
tcg_gen_movi_i64(cpu_V1, imm);
switch (op) {
case 0: /* VSHR */
case 1: /* VSRA */
if (u)
gen_helper_neon_shl_u64(cpu_V0, cpu_V0, cpu_V1);
else
gen_helper_neon_shl_s64(cpu_V0, cpu_V0, cpu_V1);
break;
case 2: /* VRSHR */
case 3: /* VRSRA */
if (u)
gen_helper_neon_rshl_u64(cpu_V0, cpu_V0, cpu_V1);
else
gen_helper_neon_rshl_s64(cpu_V0, cpu_V0, cpu_V1);
break;
case 4: /* VSRI */
if (!u)
return 1;
gen_helper_neon_shl_u64(cpu_V0, cpu_V0, cpu_V1);
break;
case 5: /* VSHL, VSLI */
gen_helper_neon_shl_u64(cpu_V0, cpu_V0, cpu_V1);
break;
case 6: /* VQSHLU */
if (u) {
gen_helper_neon_qshlu_s64(cpu_V0, cpu_env,
cpu_V0, cpu_V1);
} else {
return 1;
}
break;
case 7: /* VQSHL */
if (u) {
gen_helper_neon_qshl_u64(cpu_V0, cpu_env,
cpu_V0, cpu_V1);
} else {
gen_helper_neon_qshl_s64(cpu_V0, cpu_env,
cpu_V0, cpu_V1);
}
break;
}
if (op == 1 || op == 3) {
/* Accumulate. */
neon_load_reg64(cpu_V1, rd + pass);
tcg_gen_add_i64(cpu_V0, cpu_V0, cpu_V1);
} else if (op == 4 || (op == 5 && u)) {
/* Insert */
cpu_abort(env, "VS[LR]I.64 not implemented");
}
neon_store_reg64(cpu_V0, rd + pass);
} else { /* size < 3 */
/* Operands in T0 and T1. */
tmp = neon_load_reg(rm, pass);
tmp2 = new_tmp();
tcg_gen_movi_i32(tmp2, imm);
switch (op) {
case 0: /* VSHR */
case 1: /* VSRA */
GEN_NEON_INTEGER_OP(shl);
break;
case 2: /* VRSHR */
case 3: /* VRSRA */
GEN_NEON_INTEGER_OP(rshl);
break;
case 4: /* VSRI */
if (!u)
return 1;
GEN_NEON_INTEGER_OP(shl);
break;
case 5: /* VSHL, VSLI */
switch (size) {
case 0: gen_helper_neon_shl_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_shl_u16(tmp, tmp, tmp2); break;
case 2: gen_helper_neon_shl_u32(tmp, tmp, tmp2); break;
default: return 1;
}
break;
case 6: /* VQSHLU */
if (!u) {
return 1;
}
switch (size) {
case 0:
gen_helper_neon_qshlu_s8(tmp, cpu_env,
tmp, tmp2);
break;
case 1:
gen_helper_neon_qshlu_s16(tmp, cpu_env,
tmp, tmp2);
break;
case 2:
gen_helper_neon_qshlu_s32(tmp, cpu_env,
tmp, tmp2);
break;
default:
return 1;
}
break;
case 7: /* VQSHL */
GEN_NEON_INTEGER_OP_ENV(qshl);
break;
}
dead_tmp(tmp2);
if (op == 1 || op == 3) {
/* Accumulate. */
tmp2 = neon_load_reg(rd, pass);
gen_neon_add(size, tmp, tmp2);
dead_tmp(tmp2);
} else if (op == 4 || (op == 5 && u)) {
/* Insert */
switch (size) {
case 0:
if (op == 4)
mask = 0xff >> -shift;
else
mask = (uint8_t)(0xff << shift);
mask |= mask << 8;
mask |= mask << 16;
break;
case 1:
if (op == 4)
mask = 0xffff >> -shift;
else
mask = (uint16_t)(0xffff << shift);
mask |= mask << 16;
break;
case 2:
if (shift < -31 || shift > 31) {
mask = 0;
} else {
if (op == 4)
mask = 0xffffffffu >> -shift;
else
mask = 0xffffffffu << shift;
}
break;
default:
abort();
}
tmp2 = neon_load_reg(rd, pass);
tcg_gen_andi_i32(tmp, tmp, mask);
tcg_gen_andi_i32(tmp2, tmp2, ~mask);
tcg_gen_or_i32(tmp, tmp, tmp2);
dead_tmp(tmp2);
}
neon_store_reg(rd, pass, tmp);
}
} /* for pass */
} else if (op < 10) {
/* Shift by immediate and narrow:
VSHRN, VRSHRN, VQSHRN, VQRSHRN. */
shift = shift - (1 << (size + 3));
size++;
switch (size) {
case 1:
imm = (uint16_t)shift;
imm |= imm << 16;
tmp2 = tcg_const_i32(imm);
TCGV_UNUSED_I64(tmp64);
break;
case 2:
imm = (uint32_t)shift;
tmp2 = tcg_const_i32(imm);
TCGV_UNUSED_I64(tmp64);
break;
case 3:
tmp64 = tcg_const_i64(shift);
TCGV_UNUSED(tmp2);
break;
default:
abort();
}
for (pass = 0; pass < 2; pass++) {
if (size == 3) {
neon_load_reg64(cpu_V0, rm + pass);
if (q) {
if (u)
gen_helper_neon_rshl_u64(cpu_V0, cpu_V0, tmp64);
else
gen_helper_neon_rshl_s64(cpu_V0, cpu_V0, tmp64);
} else {
if (u)
gen_helper_neon_shl_u64(cpu_V0, cpu_V0, tmp64);
else
gen_helper_neon_shl_s64(cpu_V0, cpu_V0, tmp64);
}
} else {
tmp = neon_load_reg(rm + pass, 0);
gen_neon_shift_narrow(size, tmp, tmp2, q, u);
tmp3 = neon_load_reg(rm + pass, 1);
gen_neon_shift_narrow(size, tmp3, tmp2, q, u);
tcg_gen_concat_i32_i64(cpu_V0, tmp, tmp3);
dead_tmp(tmp);
dead_tmp(tmp3);
}
tmp = new_tmp();
if (op == 8 && !u) {
gen_neon_narrow(size - 1, tmp, cpu_V0);
} else {
if (op == 8)
gen_neon_narrow_sats(size - 1, tmp, cpu_V0);
else
gen_neon_narrow_satu(size - 1, tmp, cpu_V0);
}
neon_store_reg(rd, pass, tmp);
} /* for pass */
if (size == 3) {
tcg_temp_free_i64(tmp64);
} else {
tcg_temp_free_i32(tmp2);
}
} else if (op == 10) {
/* VSHLL */
if (q || size == 3)
return 1;
tmp = neon_load_reg(rm, 0);
tmp2 = neon_load_reg(rm, 1);
for (pass = 0; pass < 2; pass++) {
if (pass == 1)
tmp = tmp2;
gen_neon_widen(cpu_V0, tmp, size, u);
if (shift != 0) {
/* The shift is less than the width of the source
type, so we can just shift the whole register. */
tcg_gen_shli_i64(cpu_V0, cpu_V0, shift);
if (size < 2 || !u) {
uint64_t imm64;
if (size == 0) {
imm = (0xffu >> (8 - shift));
imm |= imm << 16;
} else {
imm = 0xffff >> (16 - shift);
}
imm64 = imm | (((uint64_t)imm) << 32);
tcg_gen_andi_i64(cpu_V0, cpu_V0, imm64);
}
}
neon_store_reg64(cpu_V0, rd + pass);
}
} else if (op >= 14) {
/* VCVT fixed-point. */
/* We have already masked out the must-be-1 top bit of imm6,
* hence this 32-shift where the ARM ARM has 64-imm6.
*/
shift = 32 - shift;
for (pass = 0; pass < (q ? 4 : 2); pass++) {
tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, pass));
if (!(op & 1)) {
if (u)
gen_vfp_ulto(0, shift);
else
gen_vfp_slto(0, shift);
} else {
if (u)
gen_vfp_toul(0, shift);
else
gen_vfp_tosl(0, shift);
}
tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, pass));
}
} else {
return 1;
}
} else { /* (insn & 0x00380080) == 0 */
int invert;
op = (insn >> 8) & 0xf;
/* One register and immediate. */
imm = (u << 7) | ((insn >> 12) & 0x70) | (insn & 0xf);
invert = (insn & (1 << 5)) != 0;
switch (op) {
case 0: case 1:
/* no-op */
break;
case 2: case 3:
imm <<= 8;
break;
case 4: case 5:
imm <<= 16;
break;
case 6: case 7:
imm <<= 24;
break;
case 8: case 9:
imm |= imm << 16;
break;
case 10: case 11:
imm = (imm << 8) | (imm << 24);
break;
case 12:
imm = (imm << 8) | 0xff;
break;
case 13:
imm = (imm << 16) | 0xffff;
break;
case 14:
imm |= (imm << 8) | (imm << 16) | (imm << 24);
if (invert)
imm = ~imm;
break;
case 15:
imm = ((imm & 0x80) << 24) | ((imm & 0x3f) << 19)
| ((imm & 0x40) ? (0x1f << 25) : (1 << 30));
break;
}
if (invert)
imm = ~imm;
for (pass = 0; pass < (q ? 4 : 2); pass++) {
if (op & 1 && op < 12) {
tmp = neon_load_reg(rd, pass);
if (invert) {
/* The immediate value has already been inverted, so
BIC becomes AND. */
tcg_gen_andi_i32(tmp, tmp, imm);
} else {
tcg_gen_ori_i32(tmp, tmp, imm);
}
} else {
/* VMOV, VMVN. */
tmp = new_tmp();
if (op == 14 && invert) {
uint32_t val;
val = 0;
for (n = 0; n < 4; n++) {
if (imm & (1 << (n + (pass & 1) * 4)))
val |= 0xff << (n * 8);
}
tcg_gen_movi_i32(tmp, val);
} else {
tcg_gen_movi_i32(tmp, imm);
}
}
neon_store_reg(rd, pass, tmp);
}
}
} else { /* (insn & 0x00800010 == 0x00800000) */
if (size != 3) {
op = (insn >> 8) & 0xf;
if ((insn & (1 << 6)) == 0) {
/* Three registers of different lengths. */
int src1_wide;
int src2_wide;
int prewiden;
/* prewiden, src1_wide, src2_wide */
static const int neon_3reg_wide[16][3] = {
{1, 0, 0}, /* VADDL */
{1, 1, 0}, /* VADDW */
{1, 0, 0}, /* VSUBL */
{1, 1, 0}, /* VSUBW */
{0, 1, 1}, /* VADDHN */
{0, 0, 0}, /* VABAL */
{0, 1, 1}, /* VSUBHN */
{0, 0, 0}, /* VABDL */
{0, 0, 0}, /* VMLAL */
{0, 0, 0}, /* VQDMLAL */
{0, 0, 0}, /* VMLSL */
{0, 0, 0}, /* VQDMLSL */
{0, 0, 0}, /* Integer VMULL */
{0, 0, 0}, /* VQDMULL */
{0, 0, 0} /* Polynomial VMULL */
};
prewiden = neon_3reg_wide[op][0];
src1_wide = neon_3reg_wide[op][1];
src2_wide = neon_3reg_wide[op][2];
if (size == 0 && (op == 9 || op == 11 || op == 13))
return 1;
/* Avoid overlapping operands. Wide source operands are
always aligned so will never overlap with wide
destinations in problematic ways. */
if (rd == rm && !src2_wide) {
tmp = neon_load_reg(rm, 1);
neon_store_scratch(2, tmp);
} else if (rd == rn && !src1_wide) {
tmp = neon_load_reg(rn, 1);
neon_store_scratch(2, tmp);
}
TCGV_UNUSED(tmp3);
for (pass = 0; pass < 2; pass++) {
if (src1_wide) {
neon_load_reg64(cpu_V0, rn + pass);
TCGV_UNUSED(tmp);
} else {
if (pass == 1 && rd == rn) {
tmp = neon_load_scratch(2);
} else {
tmp = neon_load_reg(rn, pass);
}
if (prewiden) {
gen_neon_widen(cpu_V0, tmp, size, u);
}
}
if (src2_wide) {
neon_load_reg64(cpu_V1, rm + pass);
TCGV_UNUSED(tmp2);
} else {
if (pass == 1 && rd == rm) {
tmp2 = neon_load_scratch(2);
} else {
tmp2 = neon_load_reg(rm, pass);
}
if (prewiden) {
gen_neon_widen(cpu_V1, tmp2, size, u);
}
}
switch (op) {
case 0: case 1: case 4: /* VADDL, VADDW, VADDHN, VRADDHN */
gen_neon_addl(size);
break;
case 2: case 3: case 6: /* VSUBL, VSUBW, VSUBHN, VRSUBHN */
gen_neon_subl(size);
break;
case 5: case 7: /* VABAL, VABDL */
switch ((size << 1) | u) {
case 0:
gen_helper_neon_abdl_s16(cpu_V0, tmp, tmp2);
break;
case 1:
gen_helper_neon_abdl_u16(cpu_V0, tmp, tmp2);
break;
case 2:
gen_helper_neon_abdl_s32(cpu_V0, tmp, tmp2);
break;
case 3:
gen_helper_neon_abdl_u32(cpu_V0, tmp, tmp2);
break;
case 4:
gen_helper_neon_abdl_s64(cpu_V0, tmp, tmp2);
break;
case 5:
gen_helper_neon_abdl_u64(cpu_V0, tmp, tmp2);
break;
default: abort();
}
dead_tmp(tmp2);
dead_tmp(tmp);
break;
case 8: case 9: case 10: case 11: case 12: case 13:
/* VMLAL, VQDMLAL, VMLSL, VQDMLSL, VMULL, VQDMULL */
gen_neon_mull(cpu_V0, tmp, tmp2, size, u);
break;
case 14: /* Polynomial VMULL */
cpu_abort(env, "Polynomial VMULL not implemented");
default: /* 15 is RESERVED. */
return 1;
}
if (op == 5 || op == 13 || (op >= 8 && op <= 11)) {
/* Accumulate. */
if (op == 10 || op == 11) {
gen_neon_negl(cpu_V0, size);
}
if (op != 13) {
neon_load_reg64(cpu_V1, rd + pass);
}
switch (op) {
case 5: case 8: case 10: /* VABAL, VMLAL, VMLSL */
gen_neon_addl(size);
break;
case 9: case 11: /* VQDMLAL, VQDMLSL */
gen_neon_addl_saturate(cpu_V0, cpu_V0, size);
gen_neon_addl_saturate(cpu_V0, cpu_V1, size);
break;
/* Fall through. */
case 13: /* VQDMULL */
gen_neon_addl_saturate(cpu_V0, cpu_V0, size);
break;
default:
abort();
}
neon_store_reg64(cpu_V0, rd + pass);
} else if (op == 4 || op == 6) {
/* Narrowing operation. */
tmp = new_tmp();
if (!u) {
switch (size) {
case 0:
gen_helper_neon_narrow_high_u8(tmp, cpu_V0);
break;
case 1:
gen_helper_neon_narrow_high_u16(tmp, cpu_V0);
break;
case 2:
tcg_gen_shri_i64(cpu_V0, cpu_V0, 32);
tcg_gen_trunc_i64_i32(tmp, cpu_V0);
break;
default: abort();
}
} else {
switch (size) {
case 0:
gen_helper_neon_narrow_round_high_u8(tmp, cpu_V0);
break;
case 1:
gen_helper_neon_narrow_round_high_u16(tmp, cpu_V0);
break;
case 2:
tcg_gen_addi_i64(cpu_V0, cpu_V0, 1u << 31);
tcg_gen_shri_i64(cpu_V0, cpu_V0, 32);
tcg_gen_trunc_i64_i32(tmp, cpu_V0);
break;
default: abort();
}
}
if (pass == 0) {
tmp3 = tmp;
} else {
neon_store_reg(rd, 0, tmp3);
neon_store_reg(rd, 1, tmp);
}
} else {
/* Write back the result. */
neon_store_reg64(cpu_V0, rd + pass);
}
}
} else {
/* Two registers and a scalar. */
switch (op) {
case 0: /* Integer VMLA scalar */
case 1: /* Float VMLA scalar */
case 4: /* Integer VMLS scalar */
case 5: /* Floating point VMLS scalar */
case 8: /* Integer VMUL scalar */
case 9: /* Floating point VMUL scalar */
case 12: /* VQDMULH scalar */
case 13: /* VQRDMULH scalar */
tmp = neon_get_scalar(size, rm);
neon_store_scratch(0, tmp);
for (pass = 0; pass < (u ? 4 : 2); pass++) {
tmp = neon_load_scratch(0);
tmp2 = neon_load_reg(rn, pass);
if (op == 12) {
if (size == 1) {
gen_helper_neon_qdmulh_s16(tmp, cpu_env, tmp, tmp2);
} else {
gen_helper_neon_qdmulh_s32(tmp, cpu_env, tmp, tmp2);
}
} else if (op == 13) {
if (size == 1) {
gen_helper_neon_qrdmulh_s16(tmp, cpu_env, tmp, tmp2);
} else {
gen_helper_neon_qrdmulh_s32(tmp, cpu_env, tmp, tmp2);
}
} else if (op & 1) {
gen_helper_neon_mul_f32(tmp, tmp, tmp2);
} else {
switch (size) {
case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break;
case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break;
default: return 1;
}
}
dead_tmp(tmp2);
if (op < 8) {
/* Accumulate. */
tmp2 = neon_load_reg(rd, pass);
switch (op) {
case 0:
gen_neon_add(size, tmp, tmp2);
break;
case 1:
gen_helper_neon_add_f32(tmp, tmp, tmp2);
break;
case 4:
gen_neon_rsb(size, tmp, tmp2);
break;
case 5:
gen_helper_neon_sub_f32(tmp, tmp2, tmp);
break;
default:
abort();
}
dead_tmp(tmp2);
}
neon_store_reg(rd, pass, tmp);
}
break;
case 2: /* VMLAL sclar */
case 3: /* VQDMLAL scalar */
case 6: /* VMLSL scalar */
case 7: /* VQDMLSL scalar */
case 10: /* VMULL scalar */
case 11: /* VQDMULL scalar */
if (size == 0 && (op == 3 || op == 7 || op == 11))
return 1;
tmp2 = neon_get_scalar(size, rm);
/* We need a copy of tmp2 because gen_neon_mull
* deletes it during pass 0. */
tmp4 = new_tmp();
tcg_gen_mov_i32(tmp4, tmp2);
tmp3 = neon_load_reg(rn, 1);
for (pass = 0; pass < 2; pass++) {
if (pass == 0) {
tmp = neon_load_reg(rn, 0);
} else {
tmp = tmp3;
tmp2 = tmp4;
}
gen_neon_mull(cpu_V0, tmp, tmp2, size, u);
if (op == 6 || op == 7) {
gen_neon_negl(cpu_V0, size);
}
if (op != 11) {
neon_load_reg64(cpu_V1, rd + pass);
}
switch (op) {
case 2: case 6:
gen_neon_addl(size);
break;
case 3: case 7:
gen_neon_addl_saturate(cpu_V0, cpu_V0, size);
gen_neon_addl_saturate(cpu_V0, cpu_V1, size);
break;
case 10:
/* no-op */
break;
case 11:
gen_neon_addl_saturate(cpu_V0, cpu_V0, size);
break;
default:
abort();
}
neon_store_reg64(cpu_V0, rd + pass);
}
break;
default: /* 14 and 15 are RESERVED */
return 1;
}
}
} else { /* size == 3 */
if (!u) {
/* Extract. */
imm = (insn >> 8) & 0xf;
if (imm > 7 && !q)
return 1;
if (imm == 0) {
neon_load_reg64(cpu_V0, rn);
if (q) {
neon_load_reg64(cpu_V1, rn + 1);
}
} else if (imm == 8) {
neon_load_reg64(cpu_V0, rn + 1);
if (q) {
neon_load_reg64(cpu_V1, rm);
}
} else if (q) {
tmp64 = tcg_temp_new_i64();
if (imm < 8) {
neon_load_reg64(cpu_V0, rn);
neon_load_reg64(tmp64, rn + 1);
} else {
neon_load_reg64(cpu_V0, rn + 1);
neon_load_reg64(tmp64, rm);
}
tcg_gen_shri_i64(cpu_V0, cpu_V0, (imm & 7) * 8);
tcg_gen_shli_i64(cpu_V1, tmp64, 64 - ((imm & 7) * 8));
tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1);
if (imm < 8) {
neon_load_reg64(cpu_V1, rm);
} else {
neon_load_reg64(cpu_V1, rm + 1);
imm -= 8;
}
tcg_gen_shli_i64(cpu_V1, cpu_V1, 64 - (imm * 8));
tcg_gen_shri_i64(tmp64, tmp64, imm * 8);
tcg_gen_or_i64(cpu_V1, cpu_V1, tmp64);
tcg_temp_free_i64(tmp64);
} else {
/* BUGFIX */
neon_load_reg64(cpu_V0, rn);
tcg_gen_shri_i64(cpu_V0, cpu_V0, imm * 8);
neon_load_reg64(cpu_V1, rm);
tcg_gen_shli_i64(cpu_V1, cpu_V1, 64 - (imm * 8));
tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1);
}
neon_store_reg64(cpu_V0, rd);
if (q) {
neon_store_reg64(cpu_V1, rd + 1);
}
} else if ((insn & (1 << 11)) == 0) {
/* Two register misc. */
op = ((insn >> 12) & 0x30) | ((insn >> 7) & 0xf);
size = (insn >> 18) & 3;
switch (op) {
case 0: /* VREV64 */
if (size == 3)
return 1;
for (pass = 0; pass < (q ? 2 : 1); pass++) {
tmp = neon_load_reg(rm, pass * 2);
tmp2 = neon_load_reg(rm, pass * 2 + 1);
switch (size) {
case 0: tcg_gen_bswap32_i32(tmp, tmp); break;
case 1: gen_swap_half(tmp); break;
case 2: /* no-op */ break;
default: abort();
}
neon_store_reg(rd, pass * 2 + 1, tmp);
if (size == 2) {
neon_store_reg(rd, pass * 2, tmp2);
} else {
switch (size) {
case 0: tcg_gen_bswap32_i32(tmp2, tmp2); break;
case 1: gen_swap_half(tmp2); break;
default: abort();
}
neon_store_reg(rd, pass * 2, tmp2);
}
}
break;
case 4: case 5: /* VPADDL */
case 12: case 13: /* VPADAL */
if (size == 3)
return 1;
for (pass = 0; pass < q + 1; pass++) {
tmp = neon_load_reg(rm, pass * 2);
gen_neon_widen(cpu_V0, tmp, size, op & 1);
tmp = neon_load_reg(rm, pass * 2 + 1);
gen_neon_widen(cpu_V1, tmp, size, op & 1);
switch (size) {
case 0: gen_helper_neon_paddl_u16(CPU_V001); break;
case 1: gen_helper_neon_paddl_u32(CPU_V001); break;
case 2: tcg_gen_add_i64(CPU_V001); break;
default: abort();
}
if (op >= 12) {
/* Accumulate. */
neon_load_reg64(cpu_V1, rd + pass);
gen_neon_addl(size);
}
neon_store_reg64(cpu_V0, rd + pass);
}
break;
case 33: /* VTRN */
if (size == 2) {
for (n = 0; n < (q ? 4 : 2); n += 2) {
tmp = neon_load_reg(rm, n);
tmp2 = neon_load_reg(rd, n + 1);
neon_store_reg(rm, n, tmp2);
neon_store_reg(rd, n + 1, tmp);
}
} else {
goto elementwise;
}
break;
case 34: /* VUZP */
/* Reg Before After
Rd A3 A2 A1 A0 B2 B0 A2 A0
Rm B3 B2 B1 B0 B3 B1 A3 A1
*/
if (size == 3)
return 1;
gen_neon_unzip(rd, q, 0, size);
gen_neon_unzip(rm, q, 4, size);
if (q) {
static int unzip_order_q[8] =
{0, 2, 4, 6, 1, 3, 5, 7};
for (n = 0; n < 8; n++) {
int reg = (n < 4) ? rd : rm;
tmp = neon_load_scratch(unzip_order_q[n]);
neon_store_reg(reg, n % 4, tmp);
}
} else {
static int unzip_order[4] =
{0, 4, 1, 5};
for (n = 0; n < 4; n++) {
int reg = (n < 2) ? rd : rm;
tmp = neon_load_scratch(unzip_order[n]);
neon_store_reg(reg, n % 2, tmp);
}
}
break;
case 35: /* VZIP */
/* Reg Before After
Rd A3 A2 A1 A0 B1 A1 B0 A0
Rm B3 B2 B1 B0 B3 A3 B2 A2
*/
if (size == 3)
return 1;
count = (q ? 4 : 2);
for (n = 0; n < count; n++) {
tmp = neon_load_reg(rd, n);
tmp2 = neon_load_reg(rd, n);
switch (size) {
case 0: gen_neon_zip_u8(tmp, tmp2); break;
case 1: gen_neon_zip_u16(tmp, tmp2); break;
case 2: /* no-op */; break;
default: abort();
}
neon_store_scratch(n * 2, tmp);
neon_store_scratch(n * 2 + 1, tmp2);
}
for (n = 0; n < count * 2; n++) {
int reg = (n < count) ? rd : rm;
tmp = neon_load_scratch(n);
neon_store_reg(reg, n % count, tmp);
}
break;
case 36: case 37: /* VMOVN, VQMOVUN, VQMOVN */
if (size == 3)
return 1;
TCGV_UNUSED(tmp2);
for (pass = 0; pass < 2; pass++) {
neon_load_reg64(cpu_V0, rm + pass);
tmp = new_tmp();
if (op == 36 && q == 0) {
gen_neon_narrow(size, tmp, cpu_V0);
} else if (q) {
gen_neon_narrow_satu(size, tmp, cpu_V0);
} else {
gen_neon_narrow_sats(size, tmp, cpu_V0);
}
if (pass == 0) {
tmp2 = tmp;
} else {
neon_store_reg(rd, 0, tmp2);
neon_store_reg(rd, 1, tmp);
}
}
break;
case 38: /* VSHLL */
if (q || size == 3)
return 1;
tmp = neon_load_reg(rm, 0);
tmp2 = neon_load_reg(rm, 1);
for (pass = 0; pass < 2; pass++) {
if (pass == 1)
tmp = tmp2;
gen_neon_widen(cpu_V0, tmp, size, 1);
tcg_gen_shli_i64(cpu_V0, cpu_V0, 8 << size);
neon_store_reg64(cpu_V0, rd + pass);
}
break;
case 44: /* VCVT.F16.F32 */
if (!arm_feature(env, ARM_FEATURE_VFP_FP16))
return 1;
tmp = new_tmp();
tmp2 = new_tmp();
tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 0));
gen_helper_vfp_fcvt_f32_to_f16(tmp, cpu_F0s, cpu_env);
tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 1));
gen_helper_vfp_fcvt_f32_to_f16(tmp2, cpu_F0s, cpu_env);
tcg_gen_shli_i32(tmp2, tmp2, 16);
tcg_gen_or_i32(tmp2, tmp2, tmp);
tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 2));
gen_helper_vfp_fcvt_f32_to_f16(tmp, cpu_F0s, cpu_env);
tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 3));
neon_store_reg(rd, 0, tmp2);
tmp2 = new_tmp();
gen_helper_vfp_fcvt_f32_to_f16(tmp2, cpu_F0s, cpu_env);
tcg_gen_shli_i32(tmp2, tmp2, 16);
tcg_gen_or_i32(tmp2, tmp2, tmp);
neon_store_reg(rd, 1, tmp2);
dead_tmp(tmp);
break;
case 46: /* VCVT.F32.F16 */
if (!arm_feature(env, ARM_FEATURE_VFP_FP16))
return 1;
tmp3 = new_tmp();
tmp = neon_load_reg(rm, 0);
tmp2 = neon_load_reg(rm, 1);
tcg_gen_ext16u_i32(tmp3, tmp);
gen_helper_vfp_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);
tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 0));
tcg_gen_shri_i32(tmp3, tmp, 16);
gen_helper_vfp_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);
tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 1));
dead_tmp(tmp);
tcg_gen_ext16u_i32(tmp3, tmp2);
gen_helper_vfp_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);
tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 2));
tcg_gen_shri_i32(tmp3, tmp2, 16);
gen_helper_vfp_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);
tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 3));
dead_tmp(tmp2);
dead_tmp(tmp3);
break;
default:
elementwise:
for (pass = 0; pass < (q ? 4 : 2); pass++) {
if (op == 30 || op == 31 || op >= 58) {
tcg_gen_ld_f32(cpu_F0s, cpu_env,
neon_reg_offset(rm, pass));
TCGV_UNUSED(tmp);
} else {
tmp = neon_load_reg(rm, pass);
}
switch (op) {
case 1: /* VREV32 */
switch (size) {
case 0: tcg_gen_bswap32_i32(tmp, tmp); break;
case 1: gen_swap_half(tmp); break;
default: return 1;
}
break;
case 2: /* VREV16 */
if (size != 0)
return 1;
gen_rev16(tmp);
break;
case 8: /* CLS */
switch (size) {
case 0: gen_helper_neon_cls_s8(tmp, tmp); break;
case 1: gen_helper_neon_cls_s16(tmp, tmp); break;
case 2: gen_helper_neon_cls_s32(tmp, tmp); break;
default: return 1;
}
break;
case 9: /* CLZ */
switch (size) {
case 0: gen_helper_neon_clz_u8(tmp, tmp); break;
case 1: gen_helper_neon_clz_u16(tmp, tmp); break;
case 2: gen_helper_clz(tmp, tmp); break;
default: return 1;
}
break;
case 10: /* CNT */
if (size != 0)
return 1;
gen_helper_neon_cnt_u8(tmp, tmp);
break;
case 11: /* VNOT */
if (size != 0)
return 1;
tcg_gen_not_i32(tmp, tmp);
break;
case 14: /* VQABS */
switch (size) {
case 0: gen_helper_neon_qabs_s8(tmp, cpu_env, tmp); break;
case 1: gen_helper_neon_qabs_s16(tmp, cpu_env, tmp); break;
case 2: gen_helper_neon_qabs_s32(tmp, cpu_env, tmp); break;
default: return 1;
}
break;
case 15: /* VQNEG */
switch (size) {
case 0: gen_helper_neon_qneg_s8(tmp, cpu_env, tmp); break;
case 1: gen_helper_neon_qneg_s16(tmp, cpu_env, tmp); break;
case 2: gen_helper_neon_qneg_s32(tmp, cpu_env, tmp); break;
default: return 1;
}
break;
case 16: case 19: /* VCGT #0, VCLE #0 */
tmp2 = tcg_const_i32(0);
switch(size) {
case 0: gen_helper_neon_cgt_s8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_cgt_s16(tmp, tmp, tmp2); break;
case 2: gen_helper_neon_cgt_s32(tmp, tmp, tmp2); break;
default: return 1;
}
tcg_temp_free(tmp2);
if (op == 19)
tcg_gen_not_i32(tmp, tmp);
break;
case 17: case 20: /* VCGE #0, VCLT #0 */
tmp2 = tcg_const_i32(0);
switch(size) {
case 0: gen_helper_neon_cge_s8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_cge_s16(tmp, tmp, tmp2); break;
case 2: gen_helper_neon_cge_s32(tmp, tmp, tmp2); break;
default: return 1;
}
tcg_temp_free(tmp2);
if (op == 20)
tcg_gen_not_i32(tmp, tmp);
break;
case 18: /* VCEQ #0 */
tmp2 = tcg_const_i32(0);
switch(size) {
case 0: gen_helper_neon_ceq_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_ceq_u16(tmp, tmp, tmp2); break;
case 2: gen_helper_neon_ceq_u32(tmp, tmp, tmp2); break;
default: return 1;
}
tcg_temp_free(tmp2);
break;
case 22: /* VABS */
switch(size) {
case 0: gen_helper_neon_abs_s8(tmp, tmp); break;
case 1: gen_helper_neon_abs_s16(tmp, tmp); break;
case 2: tcg_gen_abs_i32(tmp, tmp); break;
default: return 1;
}
break;
case 23: /* VNEG */
if (size == 3)
return 1;
tmp2 = tcg_const_i32(0);
gen_neon_rsb(size, tmp, tmp2);
tcg_temp_free(tmp2);
break;
case 24: case 27: /* Float VCGT #0, Float VCLE #0 */
tmp2 = tcg_const_i32(0);
gen_helper_neon_cgt_f32(tmp, tmp, tmp2);
tcg_temp_free(tmp2);
if (op == 27)
tcg_gen_not_i32(tmp, tmp);
break;
case 25: case 28: /* Float VCGE #0, Float VCLT #0 */
tmp2 = tcg_const_i32(0);
gen_helper_neon_cge_f32(tmp, tmp, tmp2);
tcg_temp_free(tmp2);
if (op == 28)
tcg_gen_not_i32(tmp, tmp);
break;
case 26: /* Float VCEQ #0 */
tmp2 = tcg_const_i32(0);
gen_helper_neon_ceq_f32(tmp, tmp, tmp2);
tcg_temp_free(tmp2);
break;
case 30: /* Float VABS */
gen_vfp_abs(0);
break;
case 31: /* Float VNEG */
gen_vfp_neg(0);
break;
case 32: /* VSWP */
tmp2 = neon_load_reg(rd, pass);
neon_store_reg(rm, pass, tmp2);
break;
case 33: /* VTRN */
tmp2 = neon_load_reg(rd, pass);
switch (size) {
case 0: gen_neon_trn_u8(tmp, tmp2); break;
case 1: gen_neon_trn_u16(tmp, tmp2); break;
case 2: abort();
default: return 1;
}
neon_store_reg(rm, pass, tmp2);
break;
case 56: /* Integer VRECPE */
gen_helper_recpe_u32(tmp, tmp, cpu_env);
break;
case 57: /* Integer VRSQRTE */
gen_helper_rsqrte_u32(tmp, tmp, cpu_env);
break;
case 58: /* Float VRECPE */
gen_helper_recpe_f32(cpu_F0s, cpu_F0s, cpu_env);
break;
case 59: /* Float VRSQRTE */
gen_helper_rsqrte_f32(cpu_F0s, cpu_F0s, cpu_env);
break;
case 60: /* VCVT.F32.S32 */
gen_vfp_sito(0);
break;
case 61: /* VCVT.F32.U32 */
gen_vfp_uito(0);
break;
case 62: /* VCVT.S32.F32 */
gen_vfp_tosiz(0);
break;
case 63: /* VCVT.U32.F32 */
gen_vfp_touiz(0);
break;
default:
/* Reserved: 21, 29, 39-56 */
return 1;
}
if (op == 30 || op == 31 || op >= 58) {
tcg_gen_st_f32(cpu_F0s, cpu_env,
neon_reg_offset(rd, pass));
} else {
neon_store_reg(rd, pass, tmp);
}
}
break;
}
} else if ((insn & (1 << 10)) == 0) {
/* VTBL, VTBX. */
n = ((insn >> 5) & 0x18) + 8;
if (insn & (1 << 6)) {
tmp = neon_load_reg(rd, 0);
} else {
tmp = new_tmp();
tcg_gen_movi_i32(tmp, 0);
}
tmp2 = neon_load_reg(rm, 0);
tmp4 = tcg_const_i32(rn);
tmp5 = tcg_const_i32(n);
gen_helper_neon_tbl(tmp2, tmp2, tmp, tmp4, tmp5);
dead_tmp(tmp);
if (insn & (1 << 6)) {
tmp = neon_load_reg(rd, 1);
} else {
tmp = new_tmp();
tcg_gen_movi_i32(tmp, 0);
}
tmp3 = neon_load_reg(rm, 1);
gen_helper_neon_tbl(tmp3, tmp3, tmp, tmp4, tmp5);
tcg_temp_free_i32(tmp5);
tcg_temp_free_i32(tmp4);
neon_store_reg(rd, 0, tmp2);
neon_store_reg(rd, 1, tmp3);
dead_tmp(tmp);
} else if ((insn & 0x380) == 0) {
/* VDUP */
if (insn & (1 << 19)) {
tmp = neon_load_reg(rm, 1);
} else {
tmp = neon_load_reg(rm, 0);
}
if (insn & (1 << 16)) {
gen_neon_dup_u8(tmp, ((insn >> 17) & 3) * 8);
} else if (insn & (1 << 17)) {
if ((insn >> 18) & 1)
gen_neon_dup_high16(tmp);
else
gen_neon_dup_low16(tmp);
}
for (pass = 0; pass < (q ? 4 : 2); pass++) {
tmp2 = new_tmp();
tcg_gen_mov_i32(tmp2, tmp);
neon_store_reg(rd, pass, tmp2);
}
dead_tmp(tmp);
} else {
return 1;
}
}
}
return 0;
}
| true | qemu | 72902672dc2ed6281cdb205259c1d52ecf01f6b2 | static int disas_neon_data_insn(CPUState * env, DisasContext *s, uint32_t insn)
{
int op;
int q;
int rd, rn, rm;
int size;
int shift;
int pass;
int count;
int pairwise;
int u;
int n;
uint32_t imm, mask;
TCGv tmp, tmp2, tmp3, tmp4, tmp5;
TCGv_i64 tmp64;
if (!s->vfp_enabled)
return 1;
q = (insn & (1 << 6)) != 0;
u = (insn >> 24) & 1;
VFP_DREG_D(rd, insn);
VFP_DREG_N(rn, insn);
VFP_DREG_M(rm, insn);
size = (insn >> 20) & 3;
if ((insn & (1 << 23)) == 0) {
op = ((insn >> 7) & 0x1e) | ((insn >> 4) & 1);
if (size == 3 && (op == 1 || op == 5 || op == 8 || op == 9
|| op == 10 || op == 11 || op == 16)) {
for (pass = 0; pass < (q ? 2 : 1); pass++) {
neon_load_reg64(cpu_V0, rn + pass);
neon_load_reg64(cpu_V1, rm + pass);
switch (op) {
case 1:
if (u) {
gen_helper_neon_add_saturate_u64(CPU_V001);
} else {
gen_helper_neon_add_saturate_s64(CPU_V001);
}
break;
case 5:
if (u) {
gen_helper_neon_sub_saturate_u64(CPU_V001);
} else {
gen_helper_neon_sub_saturate_s64(CPU_V001);
}
break;
case 8:
if (u) {
gen_helper_neon_shl_u64(cpu_V0, cpu_V1, cpu_V0);
} else {
gen_helper_neon_shl_s64(cpu_V0, cpu_V1, cpu_V0);
}
break;
case 9:
if (u) {
gen_helper_neon_qshl_u64(cpu_V0, cpu_env,
cpu_V1, cpu_V0);
} else {
gen_helper_neon_qshl_s64(cpu_V0, cpu_env,
cpu_V1, cpu_V0);
}
break;
case 10:
if (u) {
gen_helper_neon_rshl_u64(cpu_V0, cpu_V1, cpu_V0);
} else {
gen_helper_neon_rshl_s64(cpu_V0, cpu_V1, cpu_V0);
}
break;
case 11:
if (u) {
gen_helper_neon_qrshl_u64(cpu_V0, cpu_env,
cpu_V1, cpu_V0);
} else {
gen_helper_neon_qrshl_s64(cpu_V0, cpu_env,
cpu_V1, cpu_V0);
}
break;
case 16:
if (u) {
tcg_gen_sub_i64(CPU_V001);
} else {
tcg_gen_add_i64(CPU_V001);
}
break;
default:
abort();
}
neon_store_reg64(cpu_V0, rd + pass);
}
return 0;
}
switch (op) {
case 8:
case 9:
case 10:
case 11:
{
int rtmp;
rtmp = rn;
rn = rm;
rm = rtmp;
pairwise = 0;
}
break;
case 20:
case 21:
case 23:
pairwise = 1;
break;
case 26:
pairwise = (u && size < 2);
break;
case 30:
pairwise = u;
break;
default:
pairwise = 0;
break;
}
for (pass = 0; pass < (q ? 4 : 2); pass++) {
if (pairwise) {
if (q)
n = (pass & 1) * 2;
else
n = 0;
if (pass < q + 1) {
tmp = neon_load_reg(rn, n);
tmp2 = neon_load_reg(rn, n + 1);
} else {
tmp = neon_load_reg(rm, n);
tmp2 = neon_load_reg(rm, n + 1);
}
} else {
tmp = neon_load_reg(rn, pass);
tmp2 = neon_load_reg(rm, pass);
}
switch (op) {
case 0:
GEN_NEON_INTEGER_OP(hadd);
break;
case 1:
GEN_NEON_INTEGER_OP_ENV(qadd);
break;
case 2:
GEN_NEON_INTEGER_OP(rhadd);
break;
case 3:
switch ((u << 2) | size) {
case 0:
tcg_gen_and_i32(tmp, tmp, tmp2);
break;
case 1:
tcg_gen_andc_i32(tmp, tmp, tmp2);
break;
case 2:
tcg_gen_or_i32(tmp, tmp, tmp2);
break;
case 3:
tcg_gen_orc_i32(tmp, tmp, tmp2);
break;
case 4:
tcg_gen_xor_i32(tmp, tmp, tmp2);
break;
case 5:
tmp3 = neon_load_reg(rd, pass);
gen_neon_bsl(tmp, tmp, tmp2, tmp3);
dead_tmp(tmp3);
break;
case 6:
tmp3 = neon_load_reg(rd, pass);
gen_neon_bsl(tmp, tmp, tmp3, tmp2);
dead_tmp(tmp3);
break;
case 7:
tmp3 = neon_load_reg(rd, pass);
gen_neon_bsl(tmp, tmp3, tmp, tmp2);
dead_tmp(tmp3);
break;
}
break;
case 4:
GEN_NEON_INTEGER_OP(hsub);
break;
case 5:
GEN_NEON_INTEGER_OP_ENV(qsub);
break;
case 6:
GEN_NEON_INTEGER_OP(cgt);
break;
case 7:
GEN_NEON_INTEGER_OP(cge);
break;
case 8:
GEN_NEON_INTEGER_OP(shl);
break;
case 9:
GEN_NEON_INTEGER_OP_ENV(qshl);
break;
case 10:
GEN_NEON_INTEGER_OP(rshl);
break;
case 11:
GEN_NEON_INTEGER_OP_ENV(qrshl);
break;
case 12:
GEN_NEON_INTEGER_OP(max);
break;
case 13:
GEN_NEON_INTEGER_OP(min);
break;
case 14:
GEN_NEON_INTEGER_OP(abd);
break;
case 15:
GEN_NEON_INTEGER_OP(abd);
dead_tmp(tmp2);
tmp2 = neon_load_reg(rd, pass);
gen_neon_add(size, tmp, tmp2);
break;
case 16:
if (!u) {
if (gen_neon_add(size, tmp, tmp2))
return 1;
} else {
switch (size) {
case 0: gen_helper_neon_sub_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_sub_u16(tmp, tmp, tmp2); break;
case 2: tcg_gen_sub_i32(tmp, tmp, tmp2); break;
default: return 1;
}
}
break;
case 17:
if (!u) {
switch (size) {
case 0: gen_helper_neon_tst_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_tst_u16(tmp, tmp, tmp2); break;
case 2: gen_helper_neon_tst_u32(tmp, tmp, tmp2); break;
default: return 1;
}
} else {
switch (size) {
case 0: gen_helper_neon_ceq_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_ceq_u16(tmp, tmp, tmp2); break;
case 2: gen_helper_neon_ceq_u32(tmp, tmp, tmp2); break;
default: return 1;
}
}
break;
case 18:
switch (size) {
case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break;
case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break;
default: return 1;
}
dead_tmp(tmp2);
tmp2 = neon_load_reg(rd, pass);
if (u) {
gen_neon_rsb(size, tmp, tmp2);
} else {
gen_neon_add(size, tmp, tmp2);
}
break;
case 19:
if (u) {
gen_helper_neon_mul_p8(tmp, tmp, tmp2);
} else {
switch (size) {
case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break;
case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break;
default: return 1;
}
}
break;
case 20:
GEN_NEON_INTEGER_OP(pmax);
break;
case 21:
GEN_NEON_INTEGER_OP(pmin);
break;
case 22:
if (!u) {
switch (size) {
case 1: gen_helper_neon_qdmulh_s16(tmp, cpu_env, tmp, tmp2); break;
case 2: gen_helper_neon_qdmulh_s32(tmp, cpu_env, tmp, tmp2); break;
default: return 1;
}
} else {
switch (size) {
case 1: gen_helper_neon_qrdmulh_s16(tmp, cpu_env, tmp, tmp2); break;
case 2: gen_helper_neon_qrdmulh_s32(tmp, cpu_env, tmp, tmp2); break;
default: return 1;
}
}
break;
case 23:
if (u)
return 1;
switch (size) {
case 0: gen_helper_neon_padd_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_padd_u16(tmp, tmp, tmp2); break;
case 2: tcg_gen_add_i32(tmp, tmp, tmp2); break;
default: return 1;
}
break;
case 26:
switch ((u << 2) | size) {
case 0:
gen_helper_neon_add_f32(tmp, tmp, tmp2);
break;
case 2:
gen_helper_neon_sub_f32(tmp, tmp, tmp2);
break;
case 4:
gen_helper_neon_add_f32(tmp, tmp, tmp2);
break;
case 6:
gen_helper_neon_abd_f32(tmp, tmp, tmp2);
break;
default:
return 1;
}
break;
case 27:
gen_helper_neon_mul_f32(tmp, tmp, tmp2);
if (!u) {
dead_tmp(tmp2);
tmp2 = neon_load_reg(rd, pass);
if (size == 0) {
gen_helper_neon_add_f32(tmp, tmp, tmp2);
} else {
gen_helper_neon_sub_f32(tmp, tmp2, tmp);
}
}
break;
case 28:
if (!u) {
gen_helper_neon_ceq_f32(tmp, tmp, tmp2);
} else {
if (size == 0)
gen_helper_neon_cge_f32(tmp, tmp, tmp2);
else
gen_helper_neon_cgt_f32(tmp, tmp, tmp2);
}
break;
case 29:
if (!u)
return 1;
if (size == 0)
gen_helper_neon_acge_f32(tmp, tmp, tmp2);
else
gen_helper_neon_acgt_f32(tmp, tmp, tmp2);
break;
case 30:
if (size == 0)
gen_helper_neon_max_f32(tmp, tmp, tmp2);
else
gen_helper_neon_min_f32(tmp, tmp, tmp2);
break;
case 31:
if (size == 0)
gen_helper_recps_f32(tmp, tmp, tmp2, cpu_env);
else
gen_helper_rsqrts_f32(tmp, tmp, tmp2, cpu_env);
break;
default:
abort();
}
dead_tmp(tmp2);
if (pairwise && rd == rm) {
neon_store_scratch(pass, tmp);
} else {
neon_store_reg(rd, pass, tmp);
}
}
if (pairwise && rd == rm) {
for (pass = 0; pass < (q ? 4 : 2); pass++) {
tmp = neon_load_scratch(pass);
neon_store_reg(rd, pass, tmp);
}
}
} else if (insn & (1 << 4)) {
if ((insn & 0x00380080) != 0) {
op = (insn >> 8) & 0xf;
if (insn & (1 << 7)) {
size = 3;
} else {
size = 2;
while ((insn & (1 << (size + 19))) == 0)
size--;
}
shift = (insn >> 16) & ((1 << (3 + size)) - 1);
if (op < 8) {
if (op <= 4)
shift = shift - (1 << (size + 3));
if (size == 3) {
count = q + 1;
} else {
count = q ? 4: 2;
}
switch (size) {
case 0:
imm = (uint8_t) shift;
imm |= imm << 8;
imm |= imm << 16;
break;
case 1:
imm = (uint16_t) shift;
imm |= imm << 16;
break;
case 2:
case 3:
imm = shift;
break;
default:
abort();
}
for (pass = 0; pass < count; pass++) {
if (size == 3) {
neon_load_reg64(cpu_V0, rm + pass);
tcg_gen_movi_i64(cpu_V1, imm);
switch (op) {
case 0:
case 1:
if (u)
gen_helper_neon_shl_u64(cpu_V0, cpu_V0, cpu_V1);
else
gen_helper_neon_shl_s64(cpu_V0, cpu_V0, cpu_V1);
break;
case 2:
case 3:
if (u)
gen_helper_neon_rshl_u64(cpu_V0, cpu_V0, cpu_V1);
else
gen_helper_neon_rshl_s64(cpu_V0, cpu_V0, cpu_V1);
break;
case 4:
if (!u)
return 1;
gen_helper_neon_shl_u64(cpu_V0, cpu_V0, cpu_V1);
break;
case 5:
gen_helper_neon_shl_u64(cpu_V0, cpu_V0, cpu_V1);
break;
case 6:
if (u) {
gen_helper_neon_qshlu_s64(cpu_V0, cpu_env,
cpu_V0, cpu_V1);
} else {
return 1;
}
break;
case 7:
if (u) {
gen_helper_neon_qshl_u64(cpu_V0, cpu_env,
cpu_V0, cpu_V1);
} else {
gen_helper_neon_qshl_s64(cpu_V0, cpu_env,
cpu_V0, cpu_V1);
}
break;
}
if (op == 1 || op == 3) {
neon_load_reg64(cpu_V1, rd + pass);
tcg_gen_add_i64(cpu_V0, cpu_V0, cpu_V1);
} else if (op == 4 || (op == 5 && u)) {
cpu_abort(env, "VS[LR]I.64 not implemented");
}
neon_store_reg64(cpu_V0, rd + pass);
} else {
tmp = neon_load_reg(rm, pass);
tmp2 = new_tmp();
tcg_gen_movi_i32(tmp2, imm);
switch (op) {
case 0:
case 1:
GEN_NEON_INTEGER_OP(shl);
break;
case 2:
case 3:
GEN_NEON_INTEGER_OP(rshl);
break;
case 4:
if (!u)
return 1;
GEN_NEON_INTEGER_OP(shl);
break;
case 5:
switch (size) {
case 0: gen_helper_neon_shl_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_shl_u16(tmp, tmp, tmp2); break;
case 2: gen_helper_neon_shl_u32(tmp, tmp, tmp2); break;
default: return 1;
}
break;
case 6:
if (!u) {
return 1;
}
switch (size) {
case 0:
gen_helper_neon_qshlu_s8(tmp, cpu_env,
tmp, tmp2);
break;
case 1:
gen_helper_neon_qshlu_s16(tmp, cpu_env,
tmp, tmp2);
break;
case 2:
gen_helper_neon_qshlu_s32(tmp, cpu_env,
tmp, tmp2);
break;
default:
return 1;
}
break;
case 7:
GEN_NEON_INTEGER_OP_ENV(qshl);
break;
}
dead_tmp(tmp2);
if (op == 1 || op == 3) {
tmp2 = neon_load_reg(rd, pass);
gen_neon_add(size, tmp, tmp2);
dead_tmp(tmp2);
} else if (op == 4 || (op == 5 && u)) {
switch (size) {
case 0:
if (op == 4)
mask = 0xff >> -shift;
else
mask = (uint8_t)(0xff << shift);
mask |= mask << 8;
mask |= mask << 16;
break;
case 1:
if (op == 4)
mask = 0xffff >> -shift;
else
mask = (uint16_t)(0xffff << shift);
mask |= mask << 16;
break;
case 2:
if (shift < -31 || shift > 31) {
mask = 0;
} else {
if (op == 4)
mask = 0xffffffffu >> -shift;
else
mask = 0xffffffffu << shift;
}
break;
default:
abort();
}
tmp2 = neon_load_reg(rd, pass);
tcg_gen_andi_i32(tmp, tmp, mask);
tcg_gen_andi_i32(tmp2, tmp2, ~mask);
tcg_gen_or_i32(tmp, tmp, tmp2);
dead_tmp(tmp2);
}
neon_store_reg(rd, pass, tmp);
}
}
} else if (op < 10) {
shift = shift - (1 << (size + 3));
size++;
switch (size) {
case 1:
imm = (uint16_t)shift;
imm |= imm << 16;
tmp2 = tcg_const_i32(imm);
TCGV_UNUSED_I64(tmp64);
break;
case 2:
imm = (uint32_t)shift;
tmp2 = tcg_const_i32(imm);
TCGV_UNUSED_I64(tmp64);
break;
case 3:
tmp64 = tcg_const_i64(shift);
TCGV_UNUSED(tmp2);
break;
default:
abort();
}
for (pass = 0; pass < 2; pass++) {
if (size == 3) {
neon_load_reg64(cpu_V0, rm + pass);
if (q) {
if (u)
gen_helper_neon_rshl_u64(cpu_V0, cpu_V0, tmp64);
else
gen_helper_neon_rshl_s64(cpu_V0, cpu_V0, tmp64);
} else {
if (u)
gen_helper_neon_shl_u64(cpu_V0, cpu_V0, tmp64);
else
gen_helper_neon_shl_s64(cpu_V0, cpu_V0, tmp64);
}
} else {
tmp = neon_load_reg(rm + pass, 0);
gen_neon_shift_narrow(size, tmp, tmp2, q, u);
tmp3 = neon_load_reg(rm + pass, 1);
gen_neon_shift_narrow(size, tmp3, tmp2, q, u);
tcg_gen_concat_i32_i64(cpu_V0, tmp, tmp3);
dead_tmp(tmp);
dead_tmp(tmp3);
}
tmp = new_tmp();
if (op == 8 && !u) {
gen_neon_narrow(size - 1, tmp, cpu_V0);
} else {
if (op == 8)
gen_neon_narrow_sats(size - 1, tmp, cpu_V0);
else
gen_neon_narrow_satu(size - 1, tmp, cpu_V0);
}
neon_store_reg(rd, pass, tmp);
}
if (size == 3) {
tcg_temp_free_i64(tmp64);
} else {
tcg_temp_free_i32(tmp2);
}
} else if (op == 10) {
if (q || size == 3)
return 1;
tmp = neon_load_reg(rm, 0);
tmp2 = neon_load_reg(rm, 1);
for (pass = 0; pass < 2; pass++) {
if (pass == 1)
tmp = tmp2;
gen_neon_widen(cpu_V0, tmp, size, u);
if (shift != 0) {
tcg_gen_shli_i64(cpu_V0, cpu_V0, shift);
if (size < 2 || !u) {
uint64_t imm64;
if (size == 0) {
imm = (0xffu >> (8 - shift));
imm |= imm << 16;
} else {
imm = 0xffff >> (16 - shift);
}
imm64 = imm | (((uint64_t)imm) << 32);
tcg_gen_andi_i64(cpu_V0, cpu_V0, imm64);
}
}
neon_store_reg64(cpu_V0, rd + pass);
}
} else if (op >= 14) {
shift = 32 - shift;
for (pass = 0; pass < (q ? 4 : 2); pass++) {
tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, pass));
if (!(op & 1)) {
if (u)
gen_vfp_ulto(0, shift);
else
gen_vfp_slto(0, shift);
} else {
if (u)
gen_vfp_toul(0, shift);
else
gen_vfp_tosl(0, shift);
}
tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, pass));
}
} else {
return 1;
}
} else {
int invert;
op = (insn >> 8) & 0xf;
imm = (u << 7) | ((insn >> 12) & 0x70) | (insn & 0xf);
invert = (insn & (1 << 5)) != 0;
switch (op) {
case 0: case 1:
break;
case 2: case 3:
imm <<= 8;
break;
case 4: case 5:
imm <<= 16;
break;
case 6: case 7:
imm <<= 24;
break;
case 8: case 9:
imm |= imm << 16;
break;
case 10: case 11:
imm = (imm << 8) | (imm << 24);
break;
case 12:
imm = (imm << 8) | 0xff;
break;
case 13:
imm = (imm << 16) | 0xffff;
break;
case 14:
imm |= (imm << 8) | (imm << 16) | (imm << 24);
if (invert)
imm = ~imm;
break;
case 15:
imm = ((imm & 0x80) << 24) | ((imm & 0x3f) << 19)
| ((imm & 0x40) ? (0x1f << 25) : (1 << 30));
break;
}
if (invert)
imm = ~imm;
for (pass = 0; pass < (q ? 4 : 2); pass++) {
if (op & 1 && op < 12) {
tmp = neon_load_reg(rd, pass);
if (invert) {
tcg_gen_andi_i32(tmp, tmp, imm);
} else {
tcg_gen_ori_i32(tmp, tmp, imm);
}
} else {
tmp = new_tmp();
if (op == 14 && invert) {
uint32_t val;
val = 0;
for (n = 0; n < 4; n++) {
if (imm & (1 << (n + (pass & 1) * 4)))
val |= 0xff << (n * 8);
}
tcg_gen_movi_i32(tmp, val);
} else {
tcg_gen_movi_i32(tmp, imm);
}
}
neon_store_reg(rd, pass, tmp);
}
}
} else {
if (size != 3) {
op = (insn >> 8) & 0xf;
if ((insn & (1 << 6)) == 0) {
int src1_wide;
int src2_wide;
int prewiden;
static const int neon_3reg_wide[16][3] = {
{1, 0, 0},
{1, 1, 0},
{1, 0, 0},
{1, 1, 0},
{0, 1, 1},
{0, 0, 0},
{0, 1, 1},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0}
};
prewiden = neon_3reg_wide[op][0];
src1_wide = neon_3reg_wide[op][1];
src2_wide = neon_3reg_wide[op][2];
if (size == 0 && (op == 9 || op == 11 || op == 13))
return 1;
if (rd == rm && !src2_wide) {
tmp = neon_load_reg(rm, 1);
neon_store_scratch(2, tmp);
} else if (rd == rn && !src1_wide) {
tmp = neon_load_reg(rn, 1);
neon_store_scratch(2, tmp);
}
TCGV_UNUSED(tmp3);
for (pass = 0; pass < 2; pass++) {
if (src1_wide) {
neon_load_reg64(cpu_V0, rn + pass);
TCGV_UNUSED(tmp);
} else {
if (pass == 1 && rd == rn) {
tmp = neon_load_scratch(2);
} else {
tmp = neon_load_reg(rn, pass);
}
if (prewiden) {
gen_neon_widen(cpu_V0, tmp, size, u);
}
}
if (src2_wide) {
neon_load_reg64(cpu_V1, rm + pass);
TCGV_UNUSED(tmp2);
} else {
if (pass == 1 && rd == rm) {
tmp2 = neon_load_scratch(2);
} else {
tmp2 = neon_load_reg(rm, pass);
}
if (prewiden) {
gen_neon_widen(cpu_V1, tmp2, size, u);
}
}
switch (op) {
case 0: case 1: case 4:
gen_neon_addl(size);
break;
case 2: case 3: case 6:
gen_neon_subl(size);
break;
case 5: case 7:
switch ((size << 1) | u) {
case 0:
gen_helper_neon_abdl_s16(cpu_V0, tmp, tmp2);
break;
case 1:
gen_helper_neon_abdl_u16(cpu_V0, tmp, tmp2);
break;
case 2:
gen_helper_neon_abdl_s32(cpu_V0, tmp, tmp2);
break;
case 3:
gen_helper_neon_abdl_u32(cpu_V0, tmp, tmp2);
break;
case 4:
gen_helper_neon_abdl_s64(cpu_V0, tmp, tmp2);
break;
case 5:
gen_helper_neon_abdl_u64(cpu_V0, tmp, tmp2);
break;
default: abort();
}
dead_tmp(tmp2);
dead_tmp(tmp);
break;
case 8: case 9: case 10: case 11: case 12: case 13:
gen_neon_mull(cpu_V0, tmp, tmp2, size, u);
break;
case 14:
cpu_abort(env, "Polynomial VMULL not implemented");
default:
return 1;
}
if (op == 5 || op == 13 || (op >= 8 && op <= 11)) {
if (op == 10 || op == 11) {
gen_neon_negl(cpu_V0, size);
}
if (op != 13) {
neon_load_reg64(cpu_V1, rd + pass);
}
switch (op) {
case 5: case 8: case 10:
gen_neon_addl(size);
break;
case 9: case 11:
gen_neon_addl_saturate(cpu_V0, cpu_V0, size);
gen_neon_addl_saturate(cpu_V0, cpu_V1, size);
break;
case 13:
gen_neon_addl_saturate(cpu_V0, cpu_V0, size);
break;
default:
abort();
}
neon_store_reg64(cpu_V0, rd + pass);
} else if (op == 4 || op == 6) {
tmp = new_tmp();
if (!u) {
switch (size) {
case 0:
gen_helper_neon_narrow_high_u8(tmp, cpu_V0);
break;
case 1:
gen_helper_neon_narrow_high_u16(tmp, cpu_V0);
break;
case 2:
tcg_gen_shri_i64(cpu_V0, cpu_V0, 32);
tcg_gen_trunc_i64_i32(tmp, cpu_V0);
break;
default: abort();
}
} else {
switch (size) {
case 0:
gen_helper_neon_narrow_round_high_u8(tmp, cpu_V0);
break;
case 1:
gen_helper_neon_narrow_round_high_u16(tmp, cpu_V0);
break;
case 2:
tcg_gen_addi_i64(cpu_V0, cpu_V0, 1u << 31);
tcg_gen_shri_i64(cpu_V0, cpu_V0, 32);
tcg_gen_trunc_i64_i32(tmp, cpu_V0);
break;
default: abort();
}
}
if (pass == 0) {
tmp3 = tmp;
} else {
neon_store_reg(rd, 0, tmp3);
neon_store_reg(rd, 1, tmp);
}
} else {
neon_store_reg64(cpu_V0, rd + pass);
}
}
} else {
switch (op) {
case 0:
case 1:
case 4:
case 5:
case 8:
case 9:
case 12:
case 13:
tmp = neon_get_scalar(size, rm);
neon_store_scratch(0, tmp);
for (pass = 0; pass < (u ? 4 : 2); pass++) {
tmp = neon_load_scratch(0);
tmp2 = neon_load_reg(rn, pass);
if (op == 12) {
if (size == 1) {
gen_helper_neon_qdmulh_s16(tmp, cpu_env, tmp, tmp2);
} else {
gen_helper_neon_qdmulh_s32(tmp, cpu_env, tmp, tmp2);
}
} else if (op == 13) {
if (size == 1) {
gen_helper_neon_qrdmulh_s16(tmp, cpu_env, tmp, tmp2);
} else {
gen_helper_neon_qrdmulh_s32(tmp, cpu_env, tmp, tmp2);
}
} else if (op & 1) {
gen_helper_neon_mul_f32(tmp, tmp, tmp2);
} else {
switch (size) {
case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break;
case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break;
default: return 1;
}
}
dead_tmp(tmp2);
if (op < 8) {
tmp2 = neon_load_reg(rd, pass);
switch (op) {
case 0:
gen_neon_add(size, tmp, tmp2);
break;
case 1:
gen_helper_neon_add_f32(tmp, tmp, tmp2);
break;
case 4:
gen_neon_rsb(size, tmp, tmp2);
break;
case 5:
gen_helper_neon_sub_f32(tmp, tmp2, tmp);
break;
default:
abort();
}
dead_tmp(tmp2);
}
neon_store_reg(rd, pass, tmp);
}
break;
case 2:
case 3:
case 6:
case 7:
case 10:
case 11:
if (size == 0 && (op == 3 || op == 7 || op == 11))
return 1;
tmp2 = neon_get_scalar(size, rm);
tmp4 = new_tmp();
tcg_gen_mov_i32(tmp4, tmp2);
tmp3 = neon_load_reg(rn, 1);
for (pass = 0; pass < 2; pass++) {
if (pass == 0) {
tmp = neon_load_reg(rn, 0);
} else {
tmp = tmp3;
tmp2 = tmp4;
}
gen_neon_mull(cpu_V0, tmp, tmp2, size, u);
if (op == 6 || op == 7) {
gen_neon_negl(cpu_V0, size);
}
if (op != 11) {
neon_load_reg64(cpu_V1, rd + pass);
}
switch (op) {
case 2: case 6:
gen_neon_addl(size);
break;
case 3: case 7:
gen_neon_addl_saturate(cpu_V0, cpu_V0, size);
gen_neon_addl_saturate(cpu_V0, cpu_V1, size);
break;
case 10:
break;
case 11:
gen_neon_addl_saturate(cpu_V0, cpu_V0, size);
break;
default:
abort();
}
neon_store_reg64(cpu_V0, rd + pass);
}
break;
default:
return 1;
}
}
} else {
if (!u) {
imm = (insn >> 8) & 0xf;
if (imm > 7 && !q)
return 1;
if (imm == 0) {
neon_load_reg64(cpu_V0, rn);
if (q) {
neon_load_reg64(cpu_V1, rn + 1);
}
} else if (imm == 8) {
neon_load_reg64(cpu_V0, rn + 1);
if (q) {
neon_load_reg64(cpu_V1, rm);
}
} else if (q) {
tmp64 = tcg_temp_new_i64();
if (imm < 8) {
neon_load_reg64(cpu_V0, rn);
neon_load_reg64(tmp64, rn + 1);
} else {
neon_load_reg64(cpu_V0, rn + 1);
neon_load_reg64(tmp64, rm);
}
tcg_gen_shri_i64(cpu_V0, cpu_V0, (imm & 7) * 8);
tcg_gen_shli_i64(cpu_V1, tmp64, 64 - ((imm & 7) * 8));
tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1);
if (imm < 8) {
neon_load_reg64(cpu_V1, rm);
} else {
neon_load_reg64(cpu_V1, rm + 1);
imm -= 8;
}
tcg_gen_shli_i64(cpu_V1, cpu_V1, 64 - (imm * 8));
tcg_gen_shri_i64(tmp64, tmp64, imm * 8);
tcg_gen_or_i64(cpu_V1, cpu_V1, tmp64);
tcg_temp_free_i64(tmp64);
} else {
neon_load_reg64(cpu_V0, rn);
tcg_gen_shri_i64(cpu_V0, cpu_V0, imm * 8);
neon_load_reg64(cpu_V1, rm);
tcg_gen_shli_i64(cpu_V1, cpu_V1, 64 - (imm * 8));
tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1);
}
neon_store_reg64(cpu_V0, rd);
if (q) {
neon_store_reg64(cpu_V1, rd + 1);
}
} else if ((insn & (1 << 11)) == 0) {
op = ((insn >> 12) & 0x30) | ((insn >> 7) & 0xf);
size = (insn >> 18) & 3;
switch (op) {
case 0:
if (size == 3)
return 1;
for (pass = 0; pass < (q ? 2 : 1); pass++) {
tmp = neon_load_reg(rm, pass * 2);
tmp2 = neon_load_reg(rm, pass * 2 + 1);
switch (size) {
case 0: tcg_gen_bswap32_i32(tmp, tmp); break;
case 1: gen_swap_half(tmp); break;
case 2: break;
default: abort();
}
neon_store_reg(rd, pass * 2 + 1, tmp);
if (size == 2) {
neon_store_reg(rd, pass * 2, tmp2);
} else {
switch (size) {
case 0: tcg_gen_bswap32_i32(tmp2, tmp2); break;
case 1: gen_swap_half(tmp2); break;
default: abort();
}
neon_store_reg(rd, pass * 2, tmp2);
}
}
break;
case 4: case 5:
case 12: case 13:
if (size == 3)
return 1;
for (pass = 0; pass < q + 1; pass++) {
tmp = neon_load_reg(rm, pass * 2);
gen_neon_widen(cpu_V0, tmp, size, op & 1);
tmp = neon_load_reg(rm, pass * 2 + 1);
gen_neon_widen(cpu_V1, tmp, size, op & 1);
switch (size) {
case 0: gen_helper_neon_paddl_u16(CPU_V001); break;
case 1: gen_helper_neon_paddl_u32(CPU_V001); break;
case 2: tcg_gen_add_i64(CPU_V001); break;
default: abort();
}
if (op >= 12) {
neon_load_reg64(cpu_V1, rd + pass);
gen_neon_addl(size);
}
neon_store_reg64(cpu_V0, rd + pass);
}
break;
case 33:
if (size == 2) {
for (n = 0; n < (q ? 4 : 2); n += 2) {
tmp = neon_load_reg(rm, n);
tmp2 = neon_load_reg(rd, n + 1);
neon_store_reg(rm, n, tmp2);
neon_store_reg(rd, n + 1, tmp);
}
} else {
goto elementwise;
}
break;
case 34:
if (size == 3)
return 1;
gen_neon_unzip(rd, q, 0, size);
gen_neon_unzip(rm, q, 4, size);
if (q) {
static int unzip_order_q[8] =
{0, 2, 4, 6, 1, 3, 5, 7};
for (n = 0; n < 8; n++) {
int reg = (n < 4) ? rd : rm;
tmp = neon_load_scratch(unzip_order_q[n]);
neon_store_reg(reg, n % 4, tmp);
}
} else {
static int unzip_order[4] =
{0, 4, 1, 5};
for (n = 0; n < 4; n++) {
int reg = (n < 2) ? rd : rm;
tmp = neon_load_scratch(unzip_order[n]);
neon_store_reg(reg, n % 2, tmp);
}
}
break;
case 35:
if (size == 3)
return 1;
count = (q ? 4 : 2);
for (n = 0; n < count; n++) {
tmp = neon_load_reg(rd, n);
tmp2 = neon_load_reg(rd, n);
switch (size) {
case 0: gen_neon_zip_u8(tmp, tmp2); break;
case 1: gen_neon_zip_u16(tmp, tmp2); break;
case 2: ; break;
default: abort();
}
neon_store_scratch(n * 2, tmp);
neon_store_scratch(n * 2 + 1, tmp2);
}
for (n = 0; n < count * 2; n++) {
int reg = (n < count) ? rd : rm;
tmp = neon_load_scratch(n);
neon_store_reg(reg, n % count, tmp);
}
break;
case 36: case 37:
if (size == 3)
return 1;
TCGV_UNUSED(tmp2);
for (pass = 0; pass < 2; pass++) {
neon_load_reg64(cpu_V0, rm + pass);
tmp = new_tmp();
if (op == 36 && q == 0) {
gen_neon_narrow(size, tmp, cpu_V0);
} else if (q) {
gen_neon_narrow_satu(size, tmp, cpu_V0);
} else {
gen_neon_narrow_sats(size, tmp, cpu_V0);
}
if (pass == 0) {
tmp2 = tmp;
} else {
neon_store_reg(rd, 0, tmp2);
neon_store_reg(rd, 1, tmp);
}
}
break;
case 38:
if (q || size == 3)
return 1;
tmp = neon_load_reg(rm, 0);
tmp2 = neon_load_reg(rm, 1);
for (pass = 0; pass < 2; pass++) {
if (pass == 1)
tmp = tmp2;
gen_neon_widen(cpu_V0, tmp, size, 1);
tcg_gen_shli_i64(cpu_V0, cpu_V0, 8 << size);
neon_store_reg64(cpu_V0, rd + pass);
}
break;
case 44:
if (!arm_feature(env, ARM_FEATURE_VFP_FP16))
return 1;
tmp = new_tmp();
tmp2 = new_tmp();
tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 0));
gen_helper_vfp_fcvt_f32_to_f16(tmp, cpu_F0s, cpu_env);
tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 1));
gen_helper_vfp_fcvt_f32_to_f16(tmp2, cpu_F0s, cpu_env);
tcg_gen_shli_i32(tmp2, tmp2, 16);
tcg_gen_or_i32(tmp2, tmp2, tmp);
tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 2));
gen_helper_vfp_fcvt_f32_to_f16(tmp, cpu_F0s, cpu_env);
tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 3));
neon_store_reg(rd, 0, tmp2);
tmp2 = new_tmp();
gen_helper_vfp_fcvt_f32_to_f16(tmp2, cpu_F0s, cpu_env);
tcg_gen_shli_i32(tmp2, tmp2, 16);
tcg_gen_or_i32(tmp2, tmp2, tmp);
neon_store_reg(rd, 1, tmp2);
dead_tmp(tmp);
break;
case 46:
if (!arm_feature(env, ARM_FEATURE_VFP_FP16))
return 1;
tmp3 = new_tmp();
tmp = neon_load_reg(rm, 0);
tmp2 = neon_load_reg(rm, 1);
tcg_gen_ext16u_i32(tmp3, tmp);
gen_helper_vfp_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);
tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 0));
tcg_gen_shri_i32(tmp3, tmp, 16);
gen_helper_vfp_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);
tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 1));
dead_tmp(tmp);
tcg_gen_ext16u_i32(tmp3, tmp2);
gen_helper_vfp_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);
tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 2));
tcg_gen_shri_i32(tmp3, tmp2, 16);
gen_helper_vfp_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);
tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 3));
dead_tmp(tmp2);
dead_tmp(tmp3);
break;
default:
elementwise:
for (pass = 0; pass < (q ? 4 : 2); pass++) {
if (op == 30 || op == 31 || op >= 58) {
tcg_gen_ld_f32(cpu_F0s, cpu_env,
neon_reg_offset(rm, pass));
TCGV_UNUSED(tmp);
} else {
tmp = neon_load_reg(rm, pass);
}
switch (op) {
case 1:
switch (size) {
case 0: tcg_gen_bswap32_i32(tmp, tmp); break;
case 1: gen_swap_half(tmp); break;
default: return 1;
}
break;
case 2:
if (size != 0)
return 1;
gen_rev16(tmp);
break;
case 8:
switch (size) {
case 0: gen_helper_neon_cls_s8(tmp, tmp); break;
case 1: gen_helper_neon_cls_s16(tmp, tmp); break;
case 2: gen_helper_neon_cls_s32(tmp, tmp); break;
default: return 1;
}
break;
case 9:
switch (size) {
case 0: gen_helper_neon_clz_u8(tmp, tmp); break;
case 1: gen_helper_neon_clz_u16(tmp, tmp); break;
case 2: gen_helper_clz(tmp, tmp); break;
default: return 1;
}
break;
case 10:
if (size != 0)
return 1;
gen_helper_neon_cnt_u8(tmp, tmp);
break;
case 11:
if (size != 0)
return 1;
tcg_gen_not_i32(tmp, tmp);
break;
case 14:
switch (size) {
case 0: gen_helper_neon_qabs_s8(tmp, cpu_env, tmp); break;
case 1: gen_helper_neon_qabs_s16(tmp, cpu_env, tmp); break;
case 2: gen_helper_neon_qabs_s32(tmp, cpu_env, tmp); break;
default: return 1;
}
break;
case 15:
switch (size) {
case 0: gen_helper_neon_qneg_s8(tmp, cpu_env, tmp); break;
case 1: gen_helper_neon_qneg_s16(tmp, cpu_env, tmp); break;
case 2: gen_helper_neon_qneg_s32(tmp, cpu_env, tmp); break;
default: return 1;
}
break;
case 16: case 19:
tmp2 = tcg_const_i32(0);
switch(size) {
case 0: gen_helper_neon_cgt_s8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_cgt_s16(tmp, tmp, tmp2); break;
case 2: gen_helper_neon_cgt_s32(tmp, tmp, tmp2); break;
default: return 1;
}
tcg_temp_free(tmp2);
if (op == 19)
tcg_gen_not_i32(tmp, tmp);
break;
case 17: case 20:
tmp2 = tcg_const_i32(0);
switch(size) {
case 0: gen_helper_neon_cge_s8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_cge_s16(tmp, tmp, tmp2); break;
case 2: gen_helper_neon_cge_s32(tmp, tmp, tmp2); break;
default: return 1;
}
tcg_temp_free(tmp2);
if (op == 20)
tcg_gen_not_i32(tmp, tmp);
break;
case 18:
tmp2 = tcg_const_i32(0);
switch(size) {
case 0: gen_helper_neon_ceq_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_ceq_u16(tmp, tmp, tmp2); break;
case 2: gen_helper_neon_ceq_u32(tmp, tmp, tmp2); break;
default: return 1;
}
tcg_temp_free(tmp2);
break;
case 22:
switch(size) {
case 0: gen_helper_neon_abs_s8(tmp, tmp); break;
case 1: gen_helper_neon_abs_s16(tmp, tmp); break;
case 2: tcg_gen_abs_i32(tmp, tmp); break;
default: return 1;
}
break;
case 23:
if (size == 3)
return 1;
tmp2 = tcg_const_i32(0);
gen_neon_rsb(size, tmp, tmp2);
tcg_temp_free(tmp2);
break;
case 24: case 27:
tmp2 = tcg_const_i32(0);
gen_helper_neon_cgt_f32(tmp, tmp, tmp2);
tcg_temp_free(tmp2);
if (op == 27)
tcg_gen_not_i32(tmp, tmp);
break;
case 25: case 28:
tmp2 = tcg_const_i32(0);
gen_helper_neon_cge_f32(tmp, tmp, tmp2);
tcg_temp_free(tmp2);
if (op == 28)
tcg_gen_not_i32(tmp, tmp);
break;
case 26:
tmp2 = tcg_const_i32(0);
gen_helper_neon_ceq_f32(tmp, tmp, tmp2);
tcg_temp_free(tmp2);
break;
case 30:
gen_vfp_abs(0);
break;
case 31:
gen_vfp_neg(0);
break;
case 32:
tmp2 = neon_load_reg(rd, pass);
neon_store_reg(rm, pass, tmp2);
break;
case 33:
tmp2 = neon_load_reg(rd, pass);
switch (size) {
case 0: gen_neon_trn_u8(tmp, tmp2); break;
case 1: gen_neon_trn_u16(tmp, tmp2); break;
case 2: abort();
default: return 1;
}
neon_store_reg(rm, pass, tmp2);
break;
case 56:
gen_helper_recpe_u32(tmp, tmp, cpu_env);
break;
case 57:
gen_helper_rsqrte_u32(tmp, tmp, cpu_env);
break;
case 58:
gen_helper_recpe_f32(cpu_F0s, cpu_F0s, cpu_env);
break;
case 59:
gen_helper_rsqrte_f32(cpu_F0s, cpu_F0s, cpu_env);
break;
case 60:
gen_vfp_sito(0);
break;
case 61:
gen_vfp_uito(0);
break;
case 62:
gen_vfp_tosiz(0);
break;
case 63:
gen_vfp_touiz(0);
break;
default:
return 1;
}
if (op == 30 || op == 31 || op >= 58) {
tcg_gen_st_f32(cpu_F0s, cpu_env,
neon_reg_offset(rd, pass));
} else {
neon_store_reg(rd, pass, tmp);
}
}
break;
}
} else if ((insn & (1 << 10)) == 0) {
n = ((insn >> 5) & 0x18) + 8;
if (insn & (1 << 6)) {
tmp = neon_load_reg(rd, 0);
} else {
tmp = new_tmp();
tcg_gen_movi_i32(tmp, 0);
}
tmp2 = neon_load_reg(rm, 0);
tmp4 = tcg_const_i32(rn);
tmp5 = tcg_const_i32(n);
gen_helper_neon_tbl(tmp2, tmp2, tmp, tmp4, tmp5);
dead_tmp(tmp);
if (insn & (1 << 6)) {
tmp = neon_load_reg(rd, 1);
} else {
tmp = new_tmp();
tcg_gen_movi_i32(tmp, 0);
}
tmp3 = neon_load_reg(rm, 1);
gen_helper_neon_tbl(tmp3, tmp3, tmp, tmp4, tmp5);
tcg_temp_free_i32(tmp5);
tcg_temp_free_i32(tmp4);
neon_store_reg(rd, 0, tmp2);
neon_store_reg(rd, 1, tmp3);
dead_tmp(tmp);
} else if ((insn & 0x380) == 0) {
if (insn & (1 << 19)) {
tmp = neon_load_reg(rm, 1);
} else {
tmp = neon_load_reg(rm, 0);
}
if (insn & (1 << 16)) {
gen_neon_dup_u8(tmp, ((insn >> 17) & 3) * 8);
} else if (insn & (1 << 17)) {
if ((insn >> 18) & 1)
gen_neon_dup_high16(tmp);
else
gen_neon_dup_low16(tmp);
}
for (pass = 0; pass < (q ? 4 : 2); pass++) {
tmp2 = new_tmp();
tcg_gen_mov_i32(tmp2, tmp);
neon_store_reg(rd, pass, tmp2);
}
dead_tmp(tmp);
} else {
return 1;
}
}
}
return 0;
}
| {
"code": [
" gen_helper_neon_add_saturate_u64(CPU_V001);",
" gen_helper_neon_add_saturate_s64(CPU_V001);",
" gen_helper_neon_sub_saturate_u64(CPU_V001);",
" gen_helper_neon_sub_saturate_s64(CPU_V001);"
],
"line_no": [
73,
77,
87,
91
]
} | static int FUNC_0(CPUState * VAR_0, DisasContext *VAR_1, uint32_t VAR_2)
{
int VAR_3;
int VAR_4;
int VAR_5, VAR_6, VAR_7;
int VAR_8;
int VAR_9;
int VAR_10;
int VAR_11;
int VAR_12;
int VAR_13;
int VAR_14;
uint32_t imm, mask;
TCGv tmp, tmp2, tmp3, tmp4, tmp5;
TCGv_i64 tmp64;
if (!VAR_1->vfp_enabled)
return 1;
VAR_4 = (VAR_2 & (1 << 6)) != 0;
VAR_13 = (VAR_2 >> 24) & 1;
VFP_DREG_D(VAR_5, VAR_2);
VFP_DREG_N(VAR_6, VAR_2);
VFP_DREG_M(VAR_7, VAR_2);
VAR_8 = (VAR_2 >> 20) & 3;
if ((VAR_2 & (1 << 23)) == 0) {
VAR_3 = ((VAR_2 >> 7) & 0x1e) | ((VAR_2 >> 4) & 1);
if (VAR_8 == 3 && (VAR_3 == 1 || VAR_3 == 5 || VAR_3 == 8 || VAR_3 == 9
|| VAR_3 == 10 || VAR_3 == 11 || VAR_3 == 16)) {
for (VAR_10 = 0; VAR_10 < (VAR_4 ? 2 : 1); VAR_10++) {
neon_load_reg64(cpu_V0, VAR_6 + VAR_10);
neon_load_reg64(cpu_V1, VAR_7 + VAR_10);
switch (VAR_3) {
case 1:
if (VAR_13) {
gen_helper_neon_add_saturate_u64(CPU_V001);
} else {
gen_helper_neon_add_saturate_s64(CPU_V001);
}
break;
case 5:
if (VAR_13) {
gen_helper_neon_sub_saturate_u64(CPU_V001);
} else {
gen_helper_neon_sub_saturate_s64(CPU_V001);
}
break;
case 8:
if (VAR_13) {
gen_helper_neon_shl_u64(cpu_V0, cpu_V1, cpu_V0);
} else {
gen_helper_neon_shl_s64(cpu_V0, cpu_V1, cpu_V0);
}
break;
case 9:
if (VAR_13) {
gen_helper_neon_qshl_u64(cpu_V0, cpu_env,
cpu_V1, cpu_V0);
} else {
gen_helper_neon_qshl_s64(cpu_V0, cpu_env,
cpu_V1, cpu_V0);
}
break;
case 10:
if (VAR_13) {
gen_helper_neon_rshl_u64(cpu_V0, cpu_V1, cpu_V0);
} else {
gen_helper_neon_rshl_s64(cpu_V0, cpu_V1, cpu_V0);
}
break;
case 11:
if (VAR_13) {
gen_helper_neon_qrshl_u64(cpu_V0, cpu_env,
cpu_V1, cpu_V0);
} else {
gen_helper_neon_qrshl_s64(cpu_V0, cpu_env,
cpu_V1, cpu_V0);
}
break;
case 16:
if (VAR_13) {
tcg_gen_sub_i64(CPU_V001);
} else {
tcg_gen_add_i64(CPU_V001);
}
break;
default:
abort();
}
neon_store_reg64(cpu_V0, VAR_5 + VAR_10);
}
return 0;
}
switch (VAR_3) {
case 8:
case 9:
case 10:
case 11:
{
int VAR_15;
VAR_15 = VAR_6;
VAR_6 = VAR_7;
VAR_7 = VAR_15;
VAR_12 = 0;
}
break;
case 20:
case 21:
case 23:
VAR_12 = 1;
break;
case 26:
VAR_12 = (VAR_13 && VAR_8 < 2);
break;
case 30:
VAR_12 = VAR_13;
break;
default:
VAR_12 = 0;
break;
}
for (VAR_10 = 0; VAR_10 < (VAR_4 ? 4 : 2); VAR_10++) {
if (VAR_12) {
if (VAR_4)
VAR_14 = (VAR_10 & 1) * 2;
else
VAR_14 = 0;
if (VAR_10 < VAR_4 + 1) {
tmp = neon_load_reg(VAR_6, VAR_14);
tmp2 = neon_load_reg(VAR_6, VAR_14 + 1);
} else {
tmp = neon_load_reg(VAR_7, VAR_14);
tmp2 = neon_load_reg(VAR_7, VAR_14 + 1);
}
} else {
tmp = neon_load_reg(VAR_6, VAR_10);
tmp2 = neon_load_reg(VAR_7, VAR_10);
}
switch (VAR_3) {
case 0:
GEN_NEON_INTEGER_OP(hadd);
break;
case 1:
GEN_NEON_INTEGER_OP_ENV(qadd);
break;
case 2:
GEN_NEON_INTEGER_OP(rhadd);
break;
case 3:
switch ((VAR_13 << 2) | VAR_8) {
case 0:
tcg_gen_and_i32(tmp, tmp, tmp2);
break;
case 1:
tcg_gen_andc_i32(tmp, tmp, tmp2);
break;
case 2:
tcg_gen_or_i32(tmp, tmp, tmp2);
break;
case 3:
tcg_gen_orc_i32(tmp, tmp, tmp2);
break;
case 4:
tcg_gen_xor_i32(tmp, tmp, tmp2);
break;
case 5:
tmp3 = neon_load_reg(VAR_5, VAR_10);
gen_neon_bsl(tmp, tmp, tmp2, tmp3);
dead_tmp(tmp3);
break;
case 6:
tmp3 = neon_load_reg(VAR_5, VAR_10);
gen_neon_bsl(tmp, tmp, tmp3, tmp2);
dead_tmp(tmp3);
break;
case 7:
tmp3 = neon_load_reg(VAR_5, VAR_10);
gen_neon_bsl(tmp, tmp3, tmp, tmp2);
dead_tmp(tmp3);
break;
}
break;
case 4:
GEN_NEON_INTEGER_OP(hsub);
break;
case 5:
GEN_NEON_INTEGER_OP_ENV(qsub);
break;
case 6:
GEN_NEON_INTEGER_OP(cgt);
break;
case 7:
GEN_NEON_INTEGER_OP(cge);
break;
case 8:
GEN_NEON_INTEGER_OP(shl);
break;
case 9:
GEN_NEON_INTEGER_OP_ENV(qshl);
break;
case 10:
GEN_NEON_INTEGER_OP(rshl);
break;
case 11:
GEN_NEON_INTEGER_OP_ENV(qrshl);
break;
case 12:
GEN_NEON_INTEGER_OP(max);
break;
case 13:
GEN_NEON_INTEGER_OP(min);
break;
case 14:
GEN_NEON_INTEGER_OP(abd);
break;
case 15:
GEN_NEON_INTEGER_OP(abd);
dead_tmp(tmp2);
tmp2 = neon_load_reg(VAR_5, VAR_10);
gen_neon_add(VAR_8, tmp, tmp2);
break;
case 16:
if (!VAR_13) {
if (gen_neon_add(VAR_8, tmp, tmp2))
return 1;
} else {
switch (VAR_8) {
case 0: gen_helper_neon_sub_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_sub_u16(tmp, tmp, tmp2); break;
case 2: tcg_gen_sub_i32(tmp, tmp, tmp2); break;
default: return 1;
}
}
break;
case 17:
if (!VAR_13) {
switch (VAR_8) {
case 0: gen_helper_neon_tst_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_tst_u16(tmp, tmp, tmp2); break;
case 2: gen_helper_neon_tst_u32(tmp, tmp, tmp2); break;
default: return 1;
}
} else {
switch (VAR_8) {
case 0: gen_helper_neon_ceq_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_ceq_u16(tmp, tmp, tmp2); break;
case 2: gen_helper_neon_ceq_u32(tmp, tmp, tmp2); break;
default: return 1;
}
}
break;
case 18:
switch (VAR_8) {
case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break;
case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break;
default: return 1;
}
dead_tmp(tmp2);
tmp2 = neon_load_reg(VAR_5, VAR_10);
if (VAR_13) {
gen_neon_rsb(VAR_8, tmp, tmp2);
} else {
gen_neon_add(VAR_8, tmp, tmp2);
}
break;
case 19:
if (VAR_13) {
gen_helper_neon_mul_p8(tmp, tmp, tmp2);
} else {
switch (VAR_8) {
case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break;
case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break;
default: return 1;
}
}
break;
case 20:
GEN_NEON_INTEGER_OP(pmax);
break;
case 21:
GEN_NEON_INTEGER_OP(pmin);
break;
case 22:
if (!VAR_13) {
switch (VAR_8) {
case 1: gen_helper_neon_qdmulh_s16(tmp, cpu_env, tmp, tmp2); break;
case 2: gen_helper_neon_qdmulh_s32(tmp, cpu_env, tmp, tmp2); break;
default: return 1;
}
} else {
switch (VAR_8) {
case 1: gen_helper_neon_qrdmulh_s16(tmp, cpu_env, tmp, tmp2); break;
case 2: gen_helper_neon_qrdmulh_s32(tmp, cpu_env, tmp, tmp2); break;
default: return 1;
}
}
break;
case 23:
if (VAR_13)
return 1;
switch (VAR_8) {
case 0: gen_helper_neon_padd_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_padd_u16(tmp, tmp, tmp2); break;
case 2: tcg_gen_add_i32(tmp, tmp, tmp2); break;
default: return 1;
}
break;
case 26:
switch ((VAR_13 << 2) | VAR_8) {
case 0:
gen_helper_neon_add_f32(tmp, tmp, tmp2);
break;
case 2:
gen_helper_neon_sub_f32(tmp, tmp, tmp2);
break;
case 4:
gen_helper_neon_add_f32(tmp, tmp, tmp2);
break;
case 6:
gen_helper_neon_abd_f32(tmp, tmp, tmp2);
break;
default:
return 1;
}
break;
case 27:
gen_helper_neon_mul_f32(tmp, tmp, tmp2);
if (!VAR_13) {
dead_tmp(tmp2);
tmp2 = neon_load_reg(VAR_5, VAR_10);
if (VAR_8 == 0) {
gen_helper_neon_add_f32(tmp, tmp, tmp2);
} else {
gen_helper_neon_sub_f32(tmp, tmp2, tmp);
}
}
break;
case 28:
if (!VAR_13) {
gen_helper_neon_ceq_f32(tmp, tmp, tmp2);
} else {
if (VAR_8 == 0)
gen_helper_neon_cge_f32(tmp, tmp, tmp2);
else
gen_helper_neon_cgt_f32(tmp, tmp, tmp2);
}
break;
case 29:
if (!VAR_13)
return 1;
if (VAR_8 == 0)
gen_helper_neon_acge_f32(tmp, tmp, tmp2);
else
gen_helper_neon_acgt_f32(tmp, tmp, tmp2);
break;
case 30:
if (VAR_8 == 0)
gen_helper_neon_max_f32(tmp, tmp, tmp2);
else
gen_helper_neon_min_f32(tmp, tmp, tmp2);
break;
case 31:
if (VAR_8 == 0)
gen_helper_recps_f32(tmp, tmp, tmp2, cpu_env);
else
gen_helper_rsqrts_f32(tmp, tmp, tmp2, cpu_env);
break;
default:
abort();
}
dead_tmp(tmp2);
if (VAR_12 && VAR_5 == VAR_7) {
neon_store_scratch(VAR_10, tmp);
} else {
neon_store_reg(VAR_5, VAR_10, tmp);
}
}
if (VAR_12 && VAR_5 == VAR_7) {
for (VAR_10 = 0; VAR_10 < (VAR_4 ? 4 : 2); VAR_10++) {
tmp = neon_load_scratch(VAR_10);
neon_store_reg(VAR_5, VAR_10, tmp);
}
}
} else if (VAR_2 & (1 << 4)) {
if ((VAR_2 & 0x00380080) != 0) {
VAR_3 = (VAR_2 >> 8) & 0xf;
if (VAR_2 & (1 << 7)) {
VAR_8 = 3;
} else {
VAR_8 = 2;
while ((VAR_2 & (1 << (VAR_8 + 19))) == 0)
VAR_8--;
}
VAR_9 = (VAR_2 >> 16) & ((1 << (3 + VAR_8)) - 1);
if (VAR_3 < 8) {
if (VAR_3 <= 4)
VAR_9 = VAR_9 - (1 << (VAR_8 + 3));
if (VAR_8 == 3) {
VAR_11 = VAR_4 + 1;
} else {
VAR_11 = VAR_4 ? 4: 2;
}
switch (VAR_8) {
case 0:
imm = (uint8_t) VAR_9;
imm |= imm << 8;
imm |= imm << 16;
break;
case 1:
imm = (uint16_t) VAR_9;
imm |= imm << 16;
break;
case 2:
case 3:
imm = VAR_9;
break;
default:
abort();
}
for (VAR_10 = 0; VAR_10 < VAR_11; VAR_10++) {
if (VAR_8 == 3) {
neon_load_reg64(cpu_V0, VAR_7 + VAR_10);
tcg_gen_movi_i64(cpu_V1, imm);
switch (VAR_3) {
case 0:
case 1:
if (VAR_13)
gen_helper_neon_shl_u64(cpu_V0, cpu_V0, cpu_V1);
else
gen_helper_neon_shl_s64(cpu_V0, cpu_V0, cpu_V1);
break;
case 2:
case 3:
if (VAR_13)
gen_helper_neon_rshl_u64(cpu_V0, cpu_V0, cpu_V1);
else
gen_helper_neon_rshl_s64(cpu_V0, cpu_V0, cpu_V1);
break;
case 4:
if (!VAR_13)
return 1;
gen_helper_neon_shl_u64(cpu_V0, cpu_V0, cpu_V1);
break;
case 5:
gen_helper_neon_shl_u64(cpu_V0, cpu_V0, cpu_V1);
break;
case 6:
if (VAR_13) {
gen_helper_neon_qshlu_s64(cpu_V0, cpu_env,
cpu_V0, cpu_V1);
} else {
return 1;
}
break;
case 7:
if (VAR_13) {
gen_helper_neon_qshl_u64(cpu_V0, cpu_env,
cpu_V0, cpu_V1);
} else {
gen_helper_neon_qshl_s64(cpu_V0, cpu_env,
cpu_V0, cpu_V1);
}
break;
}
if (VAR_3 == 1 || VAR_3 == 3) {
neon_load_reg64(cpu_V1, VAR_5 + VAR_10);
tcg_gen_add_i64(cpu_V0, cpu_V0, cpu_V1);
} else if (VAR_3 == 4 || (VAR_3 == 5 && VAR_13)) {
cpu_abort(VAR_0, "VS[LR]I.64 not implemented");
}
neon_store_reg64(cpu_V0, VAR_5 + VAR_10);
} else {
tmp = neon_load_reg(VAR_7, VAR_10);
tmp2 = new_tmp();
tcg_gen_movi_i32(tmp2, imm);
switch (VAR_3) {
case 0:
case 1:
GEN_NEON_INTEGER_OP(shl);
break;
case 2:
case 3:
GEN_NEON_INTEGER_OP(rshl);
break;
case 4:
if (!VAR_13)
return 1;
GEN_NEON_INTEGER_OP(shl);
break;
case 5:
switch (VAR_8) {
case 0: gen_helper_neon_shl_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_shl_u16(tmp, tmp, tmp2); break;
case 2: gen_helper_neon_shl_u32(tmp, tmp, tmp2); break;
default: return 1;
}
break;
case 6:
if (!VAR_13) {
return 1;
}
switch (VAR_8) {
case 0:
gen_helper_neon_qshlu_s8(tmp, cpu_env,
tmp, tmp2);
break;
case 1:
gen_helper_neon_qshlu_s16(tmp, cpu_env,
tmp, tmp2);
break;
case 2:
gen_helper_neon_qshlu_s32(tmp, cpu_env,
tmp, tmp2);
break;
default:
return 1;
}
break;
case 7:
GEN_NEON_INTEGER_OP_ENV(qshl);
break;
}
dead_tmp(tmp2);
if (VAR_3 == 1 || VAR_3 == 3) {
tmp2 = neon_load_reg(VAR_5, VAR_10);
gen_neon_add(VAR_8, tmp, tmp2);
dead_tmp(tmp2);
} else if (VAR_3 == 4 || (VAR_3 == 5 && VAR_13)) {
switch (VAR_8) {
case 0:
if (VAR_3 == 4)
mask = 0xff >> -VAR_9;
else
mask = (uint8_t)(0xff << VAR_9);
mask |= mask << 8;
mask |= mask << 16;
break;
case 1:
if (VAR_3 == 4)
mask = 0xffff >> -VAR_9;
else
mask = (uint16_t)(0xffff << VAR_9);
mask |= mask << 16;
break;
case 2:
if (VAR_9 < -31 || VAR_9 > 31) {
mask = 0;
} else {
if (VAR_3 == 4)
mask = 0xffffffffu >> -VAR_9;
else
mask = 0xffffffffu << VAR_9;
}
break;
default:
abort();
}
tmp2 = neon_load_reg(VAR_5, VAR_10);
tcg_gen_andi_i32(tmp, tmp, mask);
tcg_gen_andi_i32(tmp2, tmp2, ~mask);
tcg_gen_or_i32(tmp, tmp, tmp2);
dead_tmp(tmp2);
}
neon_store_reg(VAR_5, VAR_10, tmp);
}
}
} else if (VAR_3 < 10) {
VAR_9 = VAR_9 - (1 << (VAR_8 + 3));
VAR_8++;
switch (VAR_8) {
case 1:
imm = (uint16_t)VAR_9;
imm |= imm << 16;
tmp2 = tcg_const_i32(imm);
TCGV_UNUSED_I64(tmp64);
break;
case 2:
imm = (uint32_t)VAR_9;
tmp2 = tcg_const_i32(imm);
TCGV_UNUSED_I64(tmp64);
break;
case 3:
tmp64 = tcg_const_i64(VAR_9);
TCGV_UNUSED(tmp2);
break;
default:
abort();
}
for (VAR_10 = 0; VAR_10 < 2; VAR_10++) {
if (VAR_8 == 3) {
neon_load_reg64(cpu_V0, VAR_7 + VAR_10);
if (VAR_4) {
if (VAR_13)
gen_helper_neon_rshl_u64(cpu_V0, cpu_V0, tmp64);
else
gen_helper_neon_rshl_s64(cpu_V0, cpu_V0, tmp64);
} else {
if (VAR_13)
gen_helper_neon_shl_u64(cpu_V0, cpu_V0, tmp64);
else
gen_helper_neon_shl_s64(cpu_V0, cpu_V0, tmp64);
}
} else {
tmp = neon_load_reg(VAR_7 + VAR_10, 0);
gen_neon_shift_narrow(VAR_8, tmp, tmp2, VAR_4, VAR_13);
tmp3 = neon_load_reg(VAR_7 + VAR_10, 1);
gen_neon_shift_narrow(VAR_8, tmp3, tmp2, VAR_4, VAR_13);
tcg_gen_concat_i32_i64(cpu_V0, tmp, tmp3);
dead_tmp(tmp);
dead_tmp(tmp3);
}
tmp = new_tmp();
if (VAR_3 == 8 && !VAR_13) {
gen_neon_narrow(VAR_8 - 1, tmp, cpu_V0);
} else {
if (VAR_3 == 8)
gen_neon_narrow_sats(VAR_8 - 1, tmp, cpu_V0);
else
gen_neon_narrow_satu(VAR_8 - 1, tmp, cpu_V0);
}
neon_store_reg(VAR_5, VAR_10, tmp);
}
if (VAR_8 == 3) {
tcg_temp_free_i64(tmp64);
} else {
tcg_temp_free_i32(tmp2);
}
} else if (VAR_3 == 10) {
if (VAR_4 || VAR_8 == 3)
return 1;
tmp = neon_load_reg(VAR_7, 0);
tmp2 = neon_load_reg(VAR_7, 1);
for (VAR_10 = 0; VAR_10 < 2; VAR_10++) {
if (VAR_10 == 1)
tmp = tmp2;
gen_neon_widen(cpu_V0, tmp, VAR_8, VAR_13);
if (VAR_9 != 0) {
tcg_gen_shli_i64(cpu_V0, cpu_V0, VAR_9);
if (VAR_8 < 2 || !VAR_13) {
uint64_t imm64;
if (VAR_8 == 0) {
imm = (0xffu >> (8 - VAR_9));
imm |= imm << 16;
} else {
imm = 0xffff >> (16 - VAR_9);
}
imm64 = imm | (((uint64_t)imm) << 32);
tcg_gen_andi_i64(cpu_V0, cpu_V0, imm64);
}
}
neon_store_reg64(cpu_V0, VAR_5 + VAR_10);
}
} else if (VAR_3 >= 14) {
VAR_9 = 32 - VAR_9;
for (VAR_10 = 0; VAR_10 < (VAR_4 ? 4 : 2); VAR_10++) {
tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_7, VAR_10));
if (!(VAR_3 & 1)) {
if (VAR_13)
gen_vfp_ulto(0, VAR_9);
else
gen_vfp_slto(0, VAR_9);
} else {
if (VAR_13)
gen_vfp_toul(0, VAR_9);
else
gen_vfp_tosl(0, VAR_9);
}
tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_5, VAR_10));
}
} else {
return 1;
}
} else {
int VAR_16;
VAR_3 = (VAR_2 >> 8) & 0xf;
imm = (VAR_13 << 7) | ((VAR_2 >> 12) & 0x70) | (VAR_2 & 0xf);
VAR_16 = (VAR_2 & (1 << 5)) != 0;
switch (VAR_3) {
case 0: case 1:
break;
case 2: case 3:
imm <<= 8;
break;
case 4: case 5:
imm <<= 16;
break;
case 6: case 7:
imm <<= 24;
break;
case 8: case 9:
imm |= imm << 16;
break;
case 10: case 11:
imm = (imm << 8) | (imm << 24);
break;
case 12:
imm = (imm << 8) | 0xff;
break;
case 13:
imm = (imm << 16) | 0xffff;
break;
case 14:
imm |= (imm << 8) | (imm << 16) | (imm << 24);
if (VAR_16)
imm = ~imm;
break;
case 15:
imm = ((imm & 0x80) << 24) | ((imm & 0x3f) << 19)
| ((imm & 0x40) ? (0x1f << 25) : (1 << 30));
break;
}
if (VAR_16)
imm = ~imm;
for (VAR_10 = 0; VAR_10 < (VAR_4 ? 4 : 2); VAR_10++) {
if (VAR_3 & 1 && VAR_3 < 12) {
tmp = neon_load_reg(VAR_5, VAR_10);
if (VAR_16) {
tcg_gen_andi_i32(tmp, tmp, imm);
} else {
tcg_gen_ori_i32(tmp, tmp, imm);
}
} else {
tmp = new_tmp();
if (VAR_3 == 14 && VAR_16) {
uint32_t val;
val = 0;
for (VAR_14 = 0; VAR_14 < 4; VAR_14++) {
if (imm & (1 << (VAR_14 + (VAR_10 & 1) * 4)))
val |= 0xff << (VAR_14 * 8);
}
tcg_gen_movi_i32(tmp, val);
} else {
tcg_gen_movi_i32(tmp, imm);
}
}
neon_store_reg(VAR_5, VAR_10, tmp);
}
}
} else {
if (VAR_8 != 3) {
VAR_3 = (VAR_2 >> 8) & 0xf;
if ((VAR_2 & (1 << 6)) == 0) {
int VAR_17;
int VAR_18;
int VAR_19;
static const int VAR_20[16][3] = {
{1, 0, 0},
{1, 1, 0},
{1, 0, 0},
{1, 1, 0},
{0, 1, 1},
{0, 0, 0},
{0, 1, 1},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0}
};
VAR_19 = VAR_20[VAR_3][0];
VAR_17 = VAR_20[VAR_3][1];
VAR_18 = VAR_20[VAR_3][2];
if (VAR_8 == 0 && (VAR_3 == 9 || VAR_3 == 11 || VAR_3 == 13))
return 1;
if (VAR_5 == VAR_7 && !VAR_18) {
tmp = neon_load_reg(VAR_7, 1);
neon_store_scratch(2, tmp);
} else if (VAR_5 == VAR_6 && !VAR_17) {
tmp = neon_load_reg(VAR_6, 1);
neon_store_scratch(2, tmp);
}
TCGV_UNUSED(tmp3);
for (VAR_10 = 0; VAR_10 < 2; VAR_10++) {
if (VAR_17) {
neon_load_reg64(cpu_V0, VAR_6 + VAR_10);
TCGV_UNUSED(tmp);
} else {
if (VAR_10 == 1 && VAR_5 == VAR_6) {
tmp = neon_load_scratch(2);
} else {
tmp = neon_load_reg(VAR_6, VAR_10);
}
if (VAR_19) {
gen_neon_widen(cpu_V0, tmp, VAR_8, VAR_13);
}
}
if (VAR_18) {
neon_load_reg64(cpu_V1, VAR_7 + VAR_10);
TCGV_UNUSED(tmp2);
} else {
if (VAR_10 == 1 && VAR_5 == VAR_7) {
tmp2 = neon_load_scratch(2);
} else {
tmp2 = neon_load_reg(VAR_7, VAR_10);
}
if (VAR_19) {
gen_neon_widen(cpu_V1, tmp2, VAR_8, VAR_13);
}
}
switch (VAR_3) {
case 0: case 1: case 4:
gen_neon_addl(VAR_8);
break;
case 2: case 3: case 6:
gen_neon_subl(VAR_8);
break;
case 5: case 7:
switch ((VAR_8 << 1) | VAR_13) {
case 0:
gen_helper_neon_abdl_s16(cpu_V0, tmp, tmp2);
break;
case 1:
gen_helper_neon_abdl_u16(cpu_V0, tmp, tmp2);
break;
case 2:
gen_helper_neon_abdl_s32(cpu_V0, tmp, tmp2);
break;
case 3:
gen_helper_neon_abdl_u32(cpu_V0, tmp, tmp2);
break;
case 4:
gen_helper_neon_abdl_s64(cpu_V0, tmp, tmp2);
break;
case 5:
gen_helper_neon_abdl_u64(cpu_V0, tmp, tmp2);
break;
default: abort();
}
dead_tmp(tmp2);
dead_tmp(tmp);
break;
case 8: case 9: case 10: case 11: case 12: case 13:
gen_neon_mull(cpu_V0, tmp, tmp2, VAR_8, VAR_13);
break;
case 14:
cpu_abort(VAR_0, "Polynomial VMULL not implemented");
default:
return 1;
}
if (VAR_3 == 5 || VAR_3 == 13 || (VAR_3 >= 8 && VAR_3 <= 11)) {
if (VAR_3 == 10 || VAR_3 == 11) {
gen_neon_negl(cpu_V0, VAR_8);
}
if (VAR_3 != 13) {
neon_load_reg64(cpu_V1, VAR_5 + VAR_10);
}
switch (VAR_3) {
case 5: case 8: case 10:
gen_neon_addl(VAR_8);
break;
case 9: case 11:
gen_neon_addl_saturate(cpu_V0, cpu_V0, VAR_8);
gen_neon_addl_saturate(cpu_V0, cpu_V1, VAR_8);
break;
case 13:
gen_neon_addl_saturate(cpu_V0, cpu_V0, VAR_8);
break;
default:
abort();
}
neon_store_reg64(cpu_V0, VAR_5 + VAR_10);
} else if (VAR_3 == 4 || VAR_3 == 6) {
tmp = new_tmp();
if (!VAR_13) {
switch (VAR_8) {
case 0:
gen_helper_neon_narrow_high_u8(tmp, cpu_V0);
break;
case 1:
gen_helper_neon_narrow_high_u16(tmp, cpu_V0);
break;
case 2:
tcg_gen_shri_i64(cpu_V0, cpu_V0, 32);
tcg_gen_trunc_i64_i32(tmp, cpu_V0);
break;
default: abort();
}
} else {
switch (VAR_8) {
case 0:
gen_helper_neon_narrow_round_high_u8(tmp, cpu_V0);
break;
case 1:
gen_helper_neon_narrow_round_high_u16(tmp, cpu_V0);
break;
case 2:
tcg_gen_addi_i64(cpu_V0, cpu_V0, 1u << 31);
tcg_gen_shri_i64(cpu_V0, cpu_V0, 32);
tcg_gen_trunc_i64_i32(tmp, cpu_V0);
break;
default: abort();
}
}
if (VAR_10 == 0) {
tmp3 = tmp;
} else {
neon_store_reg(VAR_5, 0, tmp3);
neon_store_reg(VAR_5, 1, tmp);
}
} else {
neon_store_reg64(cpu_V0, VAR_5 + VAR_10);
}
}
} else {
switch (VAR_3) {
case 0:
case 1:
case 4:
case 5:
case 8:
case 9:
case 12:
case 13:
tmp = neon_get_scalar(VAR_8, VAR_7);
neon_store_scratch(0, tmp);
for (VAR_10 = 0; VAR_10 < (VAR_13 ? 4 : 2); VAR_10++) {
tmp = neon_load_scratch(0);
tmp2 = neon_load_reg(VAR_6, VAR_10);
if (VAR_3 == 12) {
if (VAR_8 == 1) {
gen_helper_neon_qdmulh_s16(tmp, cpu_env, tmp, tmp2);
} else {
gen_helper_neon_qdmulh_s32(tmp, cpu_env, tmp, tmp2);
}
} else if (VAR_3 == 13) {
if (VAR_8 == 1) {
gen_helper_neon_qrdmulh_s16(tmp, cpu_env, tmp, tmp2);
} else {
gen_helper_neon_qrdmulh_s32(tmp, cpu_env, tmp, tmp2);
}
} else if (VAR_3 & 1) {
gen_helper_neon_mul_f32(tmp, tmp, tmp2);
} else {
switch (VAR_8) {
case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break;
case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break;
default: return 1;
}
}
dead_tmp(tmp2);
if (VAR_3 < 8) {
tmp2 = neon_load_reg(VAR_5, VAR_10);
switch (VAR_3) {
case 0:
gen_neon_add(VAR_8, tmp, tmp2);
break;
case 1:
gen_helper_neon_add_f32(tmp, tmp, tmp2);
break;
case 4:
gen_neon_rsb(VAR_8, tmp, tmp2);
break;
case 5:
gen_helper_neon_sub_f32(tmp, tmp2, tmp);
break;
default:
abort();
}
dead_tmp(tmp2);
}
neon_store_reg(VAR_5, VAR_10, tmp);
}
break;
case 2:
case 3:
case 6:
case 7:
case 10:
case 11:
if (VAR_8 == 0 && (VAR_3 == 3 || VAR_3 == 7 || VAR_3 == 11))
return 1;
tmp2 = neon_get_scalar(VAR_8, VAR_7);
tmp4 = new_tmp();
tcg_gen_mov_i32(tmp4, tmp2);
tmp3 = neon_load_reg(VAR_6, 1);
for (VAR_10 = 0; VAR_10 < 2; VAR_10++) {
if (VAR_10 == 0) {
tmp = neon_load_reg(VAR_6, 0);
} else {
tmp = tmp3;
tmp2 = tmp4;
}
gen_neon_mull(cpu_V0, tmp, tmp2, VAR_8, VAR_13);
if (VAR_3 == 6 || VAR_3 == 7) {
gen_neon_negl(cpu_V0, VAR_8);
}
if (VAR_3 != 11) {
neon_load_reg64(cpu_V1, VAR_5 + VAR_10);
}
switch (VAR_3) {
case 2: case 6:
gen_neon_addl(VAR_8);
break;
case 3: case 7:
gen_neon_addl_saturate(cpu_V0, cpu_V0, VAR_8);
gen_neon_addl_saturate(cpu_V0, cpu_V1, VAR_8);
break;
case 10:
break;
case 11:
gen_neon_addl_saturate(cpu_V0, cpu_V0, VAR_8);
break;
default:
abort();
}
neon_store_reg64(cpu_V0, VAR_5 + VAR_10);
}
break;
default:
return 1;
}
}
} else {
if (!VAR_13) {
imm = (VAR_2 >> 8) & 0xf;
if (imm > 7 && !VAR_4)
return 1;
if (imm == 0) {
neon_load_reg64(cpu_V0, VAR_6);
if (VAR_4) {
neon_load_reg64(cpu_V1, VAR_6 + 1);
}
} else if (imm == 8) {
neon_load_reg64(cpu_V0, VAR_6 + 1);
if (VAR_4) {
neon_load_reg64(cpu_V1, VAR_7);
}
} else if (VAR_4) {
tmp64 = tcg_temp_new_i64();
if (imm < 8) {
neon_load_reg64(cpu_V0, VAR_6);
neon_load_reg64(tmp64, VAR_6 + 1);
} else {
neon_load_reg64(cpu_V0, VAR_6 + 1);
neon_load_reg64(tmp64, VAR_7);
}
tcg_gen_shri_i64(cpu_V0, cpu_V0, (imm & 7) * 8);
tcg_gen_shli_i64(cpu_V1, tmp64, 64 - ((imm & 7) * 8));
tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1);
if (imm < 8) {
neon_load_reg64(cpu_V1, VAR_7);
} else {
neon_load_reg64(cpu_V1, VAR_7 + 1);
imm -= 8;
}
tcg_gen_shli_i64(cpu_V1, cpu_V1, 64 - (imm * 8));
tcg_gen_shri_i64(tmp64, tmp64, imm * 8);
tcg_gen_or_i64(cpu_V1, cpu_V1, tmp64);
tcg_temp_free_i64(tmp64);
} else {
neon_load_reg64(cpu_V0, VAR_6);
tcg_gen_shri_i64(cpu_V0, cpu_V0, imm * 8);
neon_load_reg64(cpu_V1, VAR_7);
tcg_gen_shli_i64(cpu_V1, cpu_V1, 64 - (imm * 8));
tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1);
}
neon_store_reg64(cpu_V0, VAR_5);
if (VAR_4) {
neon_store_reg64(cpu_V1, VAR_5 + 1);
}
} else if ((VAR_2 & (1 << 11)) == 0) {
VAR_3 = ((VAR_2 >> 12) & 0x30) | ((VAR_2 >> 7) & 0xf);
VAR_8 = (VAR_2 >> 18) & 3;
switch (VAR_3) {
case 0:
if (VAR_8 == 3)
return 1;
for (VAR_10 = 0; VAR_10 < (VAR_4 ? 2 : 1); VAR_10++) {
tmp = neon_load_reg(VAR_7, VAR_10 * 2);
tmp2 = neon_load_reg(VAR_7, VAR_10 * 2 + 1);
switch (VAR_8) {
case 0: tcg_gen_bswap32_i32(tmp, tmp); break;
case 1: gen_swap_half(tmp); break;
case 2: break;
default: abort();
}
neon_store_reg(VAR_5, VAR_10 * 2 + 1, tmp);
if (VAR_8 == 2) {
neon_store_reg(VAR_5, VAR_10 * 2, tmp2);
} else {
switch (VAR_8) {
case 0: tcg_gen_bswap32_i32(tmp2, tmp2); break;
case 1: gen_swap_half(tmp2); break;
default: abort();
}
neon_store_reg(VAR_5, VAR_10 * 2, tmp2);
}
}
break;
case 4: case 5:
case 12: case 13:
if (VAR_8 == 3)
return 1;
for (VAR_10 = 0; VAR_10 < VAR_4 + 1; VAR_10++) {
tmp = neon_load_reg(VAR_7, VAR_10 * 2);
gen_neon_widen(cpu_V0, tmp, VAR_8, VAR_3 & 1);
tmp = neon_load_reg(VAR_7, VAR_10 * 2 + 1);
gen_neon_widen(cpu_V1, tmp, VAR_8, VAR_3 & 1);
switch (VAR_8) {
case 0: gen_helper_neon_paddl_u16(CPU_V001); break;
case 1: gen_helper_neon_paddl_u32(CPU_V001); break;
case 2: tcg_gen_add_i64(CPU_V001); break;
default: abort();
}
if (VAR_3 >= 12) {
neon_load_reg64(cpu_V1, VAR_5 + VAR_10);
gen_neon_addl(VAR_8);
}
neon_store_reg64(cpu_V0, VAR_5 + VAR_10);
}
break;
case 33:
if (VAR_8 == 2) {
for (VAR_14 = 0; VAR_14 < (VAR_4 ? 4 : 2); VAR_14 += 2) {
tmp = neon_load_reg(VAR_7, VAR_14);
tmp2 = neon_load_reg(VAR_5, VAR_14 + 1);
neon_store_reg(VAR_7, VAR_14, tmp2);
neon_store_reg(VAR_5, VAR_14 + 1, tmp);
}
} else {
goto elementwise;
}
break;
case 34:
if (VAR_8 == 3)
return 1;
gen_neon_unzip(VAR_5, VAR_4, 0, VAR_8);
gen_neon_unzip(VAR_7, VAR_4, 4, VAR_8);
if (VAR_4) {
static int VAR_21[8] =
{0, 2, 4, 6, 1, 3, 5, 7};
for (VAR_14 = 0; VAR_14 < 8; VAR_14++) {
int VAR_24 = (VAR_14 < 4) ? VAR_5 : VAR_7;
tmp = neon_load_scratch(VAR_21[VAR_14]);
neon_store_reg(VAR_24, VAR_14 % 4, tmp);
}
} else {
static int VAR_23[4] =
{0, 4, 1, 5};
for (VAR_14 = 0; VAR_14 < 4; VAR_14++) {
int VAR_24 = (VAR_14 < 2) ? VAR_5 : VAR_7;
tmp = neon_load_scratch(VAR_23[VAR_14]);
neon_store_reg(VAR_24, VAR_14 % 2, tmp);
}
}
break;
case 35:
if (VAR_8 == 3)
return 1;
VAR_11 = (VAR_4 ? 4 : 2);
for (VAR_14 = 0; VAR_14 < VAR_11; VAR_14++) {
tmp = neon_load_reg(VAR_5, VAR_14);
tmp2 = neon_load_reg(VAR_5, VAR_14);
switch (VAR_8) {
case 0: gen_neon_zip_u8(tmp, tmp2); break;
case 1: gen_neon_zip_u16(tmp, tmp2); break;
case 2: ; break;
default: abort();
}
neon_store_scratch(VAR_14 * 2, tmp);
neon_store_scratch(VAR_14 * 2 + 1, tmp2);
}
for (VAR_14 = 0; VAR_14 < VAR_11 * 2; VAR_14++) {
int VAR_24 = (VAR_14 < VAR_11) ? VAR_5 : VAR_7;
tmp = neon_load_scratch(VAR_14);
neon_store_reg(VAR_24, VAR_14 % VAR_11, tmp);
}
break;
case 36: case 37:
if (VAR_8 == 3)
return 1;
TCGV_UNUSED(tmp2);
for (VAR_10 = 0; VAR_10 < 2; VAR_10++) {
neon_load_reg64(cpu_V0, VAR_7 + VAR_10);
tmp = new_tmp();
if (VAR_3 == 36 && VAR_4 == 0) {
gen_neon_narrow(VAR_8, tmp, cpu_V0);
} else if (VAR_4) {
gen_neon_narrow_satu(VAR_8, tmp, cpu_V0);
} else {
gen_neon_narrow_sats(VAR_8, tmp, cpu_V0);
}
if (VAR_10 == 0) {
tmp2 = tmp;
} else {
neon_store_reg(VAR_5, 0, tmp2);
neon_store_reg(VAR_5, 1, tmp);
}
}
break;
case 38:
if (VAR_4 || VAR_8 == 3)
return 1;
tmp = neon_load_reg(VAR_7, 0);
tmp2 = neon_load_reg(VAR_7, 1);
for (VAR_10 = 0; VAR_10 < 2; VAR_10++) {
if (VAR_10 == 1)
tmp = tmp2;
gen_neon_widen(cpu_V0, tmp, VAR_8, 1);
tcg_gen_shli_i64(cpu_V0, cpu_V0, 8 << VAR_8);
neon_store_reg64(cpu_V0, VAR_5 + VAR_10);
}
break;
case 44:
if (!arm_feature(VAR_0, ARM_FEATURE_VFP_FP16))
return 1;
tmp = new_tmp();
tmp2 = new_tmp();
tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_7, 0));
gen_helper_vfp_fcvt_f32_to_f16(tmp, cpu_F0s, cpu_env);
tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_7, 1));
gen_helper_vfp_fcvt_f32_to_f16(tmp2, cpu_F0s, cpu_env);
tcg_gen_shli_i32(tmp2, tmp2, 16);
tcg_gen_or_i32(tmp2, tmp2, tmp);
tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_7, 2));
gen_helper_vfp_fcvt_f32_to_f16(tmp, cpu_F0s, cpu_env);
tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_7, 3));
neon_store_reg(VAR_5, 0, tmp2);
tmp2 = new_tmp();
gen_helper_vfp_fcvt_f32_to_f16(tmp2, cpu_F0s, cpu_env);
tcg_gen_shli_i32(tmp2, tmp2, 16);
tcg_gen_or_i32(tmp2, tmp2, tmp);
neon_store_reg(VAR_5, 1, tmp2);
dead_tmp(tmp);
break;
case 46:
if (!arm_feature(VAR_0, ARM_FEATURE_VFP_FP16))
return 1;
tmp3 = new_tmp();
tmp = neon_load_reg(VAR_7, 0);
tmp2 = neon_load_reg(VAR_7, 1);
tcg_gen_ext16u_i32(tmp3, tmp);
gen_helper_vfp_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);
tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_5, 0));
tcg_gen_shri_i32(tmp3, tmp, 16);
gen_helper_vfp_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);
tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_5, 1));
dead_tmp(tmp);
tcg_gen_ext16u_i32(tmp3, tmp2);
gen_helper_vfp_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);
tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_5, 2));
tcg_gen_shri_i32(tmp3, tmp2, 16);
gen_helper_vfp_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);
tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_5, 3));
dead_tmp(tmp2);
dead_tmp(tmp3);
break;
default:
elementwise:
for (VAR_10 = 0; VAR_10 < (VAR_4 ? 4 : 2); VAR_10++) {
if (VAR_3 == 30 || VAR_3 == 31 || VAR_3 >= 58) {
tcg_gen_ld_f32(cpu_F0s, cpu_env,
neon_reg_offset(VAR_7, VAR_10));
TCGV_UNUSED(tmp);
} else {
tmp = neon_load_reg(VAR_7, VAR_10);
}
switch (VAR_3) {
case 1:
switch (VAR_8) {
case 0: tcg_gen_bswap32_i32(tmp, tmp); break;
case 1: gen_swap_half(tmp); break;
default: return 1;
}
break;
case 2:
if (VAR_8 != 0)
return 1;
gen_rev16(tmp);
break;
case 8:
switch (VAR_8) {
case 0: gen_helper_neon_cls_s8(tmp, tmp); break;
case 1: gen_helper_neon_cls_s16(tmp, tmp); break;
case 2: gen_helper_neon_cls_s32(tmp, tmp); break;
default: return 1;
}
break;
case 9:
switch (VAR_8) {
case 0: gen_helper_neon_clz_u8(tmp, tmp); break;
case 1: gen_helper_neon_clz_u16(tmp, tmp); break;
case 2: gen_helper_clz(tmp, tmp); break;
default: return 1;
}
break;
case 10:
if (VAR_8 != 0)
return 1;
gen_helper_neon_cnt_u8(tmp, tmp);
break;
case 11:
if (VAR_8 != 0)
return 1;
tcg_gen_not_i32(tmp, tmp);
break;
case 14:
switch (VAR_8) {
case 0: gen_helper_neon_qabs_s8(tmp, cpu_env, tmp); break;
case 1: gen_helper_neon_qabs_s16(tmp, cpu_env, tmp); break;
case 2: gen_helper_neon_qabs_s32(tmp, cpu_env, tmp); break;
default: return 1;
}
break;
case 15:
switch (VAR_8) {
case 0: gen_helper_neon_qneg_s8(tmp, cpu_env, tmp); break;
case 1: gen_helper_neon_qneg_s16(tmp, cpu_env, tmp); break;
case 2: gen_helper_neon_qneg_s32(tmp, cpu_env, tmp); break;
default: return 1;
}
break;
case 16: case 19:
tmp2 = tcg_const_i32(0);
switch(VAR_8) {
case 0: gen_helper_neon_cgt_s8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_cgt_s16(tmp, tmp, tmp2); break;
case 2: gen_helper_neon_cgt_s32(tmp, tmp, tmp2); break;
default: return 1;
}
tcg_temp_free(tmp2);
if (VAR_3 == 19)
tcg_gen_not_i32(tmp, tmp);
break;
case 17: case 20:
tmp2 = tcg_const_i32(0);
switch(VAR_8) {
case 0: gen_helper_neon_cge_s8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_cge_s16(tmp, tmp, tmp2); break;
case 2: gen_helper_neon_cge_s32(tmp, tmp, tmp2); break;
default: return 1;
}
tcg_temp_free(tmp2);
if (VAR_3 == 20)
tcg_gen_not_i32(tmp, tmp);
break;
case 18:
tmp2 = tcg_const_i32(0);
switch(VAR_8) {
case 0: gen_helper_neon_ceq_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_ceq_u16(tmp, tmp, tmp2); break;
case 2: gen_helper_neon_ceq_u32(tmp, tmp, tmp2); break;
default: return 1;
}
tcg_temp_free(tmp2);
break;
case 22:
switch(VAR_8) {
case 0: gen_helper_neon_abs_s8(tmp, tmp); break;
case 1: gen_helper_neon_abs_s16(tmp, tmp); break;
case 2: tcg_gen_abs_i32(tmp, tmp); break;
default: return 1;
}
break;
case 23:
if (VAR_8 == 3)
return 1;
tmp2 = tcg_const_i32(0);
gen_neon_rsb(VAR_8, tmp, tmp2);
tcg_temp_free(tmp2);
break;
case 24: case 27:
tmp2 = tcg_const_i32(0);
gen_helper_neon_cgt_f32(tmp, tmp, tmp2);
tcg_temp_free(tmp2);
if (VAR_3 == 27)
tcg_gen_not_i32(tmp, tmp);
break;
case 25: case 28:
tmp2 = tcg_const_i32(0);
gen_helper_neon_cge_f32(tmp, tmp, tmp2);
tcg_temp_free(tmp2);
if (VAR_3 == 28)
tcg_gen_not_i32(tmp, tmp);
break;
case 26:
tmp2 = tcg_const_i32(0);
gen_helper_neon_ceq_f32(tmp, tmp, tmp2);
tcg_temp_free(tmp2);
break;
case 30:
gen_vfp_abs(0);
break;
case 31:
gen_vfp_neg(0);
break;
case 32:
tmp2 = neon_load_reg(VAR_5, VAR_10);
neon_store_reg(VAR_7, VAR_10, tmp2);
break;
case 33:
tmp2 = neon_load_reg(VAR_5, VAR_10);
switch (VAR_8) {
case 0: gen_neon_trn_u8(tmp, tmp2); break;
case 1: gen_neon_trn_u16(tmp, tmp2); break;
case 2: abort();
default: return 1;
}
neon_store_reg(VAR_7, VAR_10, tmp2);
break;
case 56:
gen_helper_recpe_u32(tmp, tmp, cpu_env);
break;
case 57:
gen_helper_rsqrte_u32(tmp, tmp, cpu_env);
break;
case 58:
gen_helper_recpe_f32(cpu_F0s, cpu_F0s, cpu_env);
break;
case 59:
gen_helper_rsqrte_f32(cpu_F0s, cpu_F0s, cpu_env);
break;
case 60:
gen_vfp_sito(0);
break;
case 61:
gen_vfp_uito(0);
break;
case 62:
gen_vfp_tosiz(0);
break;
case 63:
gen_vfp_touiz(0);
break;
default:
return 1;
}
if (VAR_3 == 30 || VAR_3 == 31 || VAR_3 >= 58) {
tcg_gen_st_f32(cpu_F0s, cpu_env,
neon_reg_offset(VAR_5, VAR_10));
} else {
neon_store_reg(VAR_5, VAR_10, tmp);
}
}
break;
}
} else if ((VAR_2 & (1 << 10)) == 0) {
VAR_14 = ((VAR_2 >> 5) & 0x18) + 8;
if (VAR_2 & (1 << 6)) {
tmp = neon_load_reg(VAR_5, 0);
} else {
tmp = new_tmp();
tcg_gen_movi_i32(tmp, 0);
}
tmp2 = neon_load_reg(VAR_7, 0);
tmp4 = tcg_const_i32(VAR_6);
tmp5 = tcg_const_i32(VAR_14);
gen_helper_neon_tbl(tmp2, tmp2, tmp, tmp4, tmp5);
dead_tmp(tmp);
if (VAR_2 & (1 << 6)) {
tmp = neon_load_reg(VAR_5, 1);
} else {
tmp = new_tmp();
tcg_gen_movi_i32(tmp, 0);
}
tmp3 = neon_load_reg(VAR_7, 1);
gen_helper_neon_tbl(tmp3, tmp3, tmp, tmp4, tmp5);
tcg_temp_free_i32(tmp5);
tcg_temp_free_i32(tmp4);
neon_store_reg(VAR_5, 0, tmp2);
neon_store_reg(VAR_5, 1, tmp3);
dead_tmp(tmp);
} else if ((VAR_2 & 0x380) == 0) {
if (VAR_2 & (1 << 19)) {
tmp = neon_load_reg(VAR_7, 1);
} else {
tmp = neon_load_reg(VAR_7, 0);
}
if (VAR_2 & (1 << 16)) {
gen_neon_dup_u8(tmp, ((VAR_2 >> 17) & 3) * 8);
} else if (VAR_2 & (1 << 17)) {
if ((VAR_2 >> 18) & 1)
gen_neon_dup_high16(tmp);
else
gen_neon_dup_low16(tmp);
}
for (VAR_10 = 0; VAR_10 < (VAR_4 ? 4 : 2); VAR_10++) {
tmp2 = new_tmp();
tcg_gen_mov_i32(tmp2, tmp);
neon_store_reg(VAR_5, VAR_10, tmp2);
}
dead_tmp(tmp);
} else {
return 1;
}
}
}
return 0;
}
| [
"static int FUNC_0(CPUState * VAR_0, DisasContext *VAR_1, uint32_t VAR_2)\n{",
"int VAR_3;",
"int VAR_4;",
"int VAR_5, VAR_6, VAR_7;",
"int VAR_8;",
"int VAR_9;",
"int VAR_10;",
"int VAR_11;",
"int VAR_12;",
"int VAR_13;",
"int VAR_14;",
"uint32_t imm, mask;",
"TCGv tmp, tmp2, tmp3, tmp4, tmp5;",
"TCGv_i64 tmp64;",
"if (!VAR_1->vfp_enabled)\nreturn 1;",
"VAR_4 = (VAR_2 & (1 << 6)) != 0;",
"VAR_13 = (VAR_2 >> 24) & 1;",
"VFP_DREG_D(VAR_5, VAR_2);",
"VFP_DREG_N(VAR_6, VAR_2);",
"VFP_DREG_M(VAR_7, VAR_2);",
"VAR_8 = (VAR_2 >> 20) & 3;",
"if ((VAR_2 & (1 << 23)) == 0) {",
"VAR_3 = ((VAR_2 >> 7) & 0x1e) | ((VAR_2 >> 4) & 1);",
"if (VAR_8 == 3 && (VAR_3 == 1 || VAR_3 == 5 || VAR_3 == 8 || VAR_3 == 9\n|| VAR_3 == 10 || VAR_3 == 11 || VAR_3 == 16)) {",
"for (VAR_10 = 0; VAR_10 < (VAR_4 ? 2 : 1); VAR_10++) {",
"neon_load_reg64(cpu_V0, VAR_6 + VAR_10);",
"neon_load_reg64(cpu_V1, VAR_7 + VAR_10);",
"switch (VAR_3) {",
"case 1:\nif (VAR_13) {",
"gen_helper_neon_add_saturate_u64(CPU_V001);",
"} else {",
"gen_helper_neon_add_saturate_s64(CPU_V001);",
"}",
"break;",
"case 5:\nif (VAR_13) {",
"gen_helper_neon_sub_saturate_u64(CPU_V001);",
"} else {",
"gen_helper_neon_sub_saturate_s64(CPU_V001);",
"}",
"break;",
"case 8:\nif (VAR_13) {",
"gen_helper_neon_shl_u64(cpu_V0, cpu_V1, cpu_V0);",
"} else {",
"gen_helper_neon_shl_s64(cpu_V0, cpu_V1, cpu_V0);",
"}",
"break;",
"case 9:\nif (VAR_13) {",
"gen_helper_neon_qshl_u64(cpu_V0, cpu_env,\ncpu_V1, cpu_V0);",
"} else {",
"gen_helper_neon_qshl_s64(cpu_V0, cpu_env,\ncpu_V1, cpu_V0);",
"}",
"break;",
"case 10:\nif (VAR_13) {",
"gen_helper_neon_rshl_u64(cpu_V0, cpu_V1, cpu_V0);",
"} else {",
"gen_helper_neon_rshl_s64(cpu_V0, cpu_V1, cpu_V0);",
"}",
"break;",
"case 11:\nif (VAR_13) {",
"gen_helper_neon_qrshl_u64(cpu_V0, cpu_env,\ncpu_V1, cpu_V0);",
"} else {",
"gen_helper_neon_qrshl_s64(cpu_V0, cpu_env,\ncpu_V1, cpu_V0);",
"}",
"break;",
"case 16:\nif (VAR_13) {",
"tcg_gen_sub_i64(CPU_V001);",
"} else {",
"tcg_gen_add_i64(CPU_V001);",
"}",
"break;",
"default:\nabort();",
"}",
"neon_store_reg64(cpu_V0, VAR_5 + VAR_10);",
"}",
"return 0;",
"}",
"switch (VAR_3) {",
"case 8:\ncase 9:\ncase 10:\ncase 11:\n{",
"int VAR_15;",
"VAR_15 = VAR_6;",
"VAR_6 = VAR_7;",
"VAR_7 = VAR_15;",
"VAR_12 = 0;",
"}",
"break;",
"case 20:\ncase 21:\ncase 23:\nVAR_12 = 1;",
"break;",
"case 26:\nVAR_12 = (VAR_13 && VAR_8 < 2);",
"break;",
"case 30:\nVAR_12 = VAR_13;",
"break;",
"default:\nVAR_12 = 0;",
"break;",
"}",
"for (VAR_10 = 0; VAR_10 < (VAR_4 ? 4 : 2); VAR_10++) {",
"if (VAR_12) {",
"if (VAR_4)\nVAR_14 = (VAR_10 & 1) * 2;",
"else\nVAR_14 = 0;",
"if (VAR_10 < VAR_4 + 1) {",
"tmp = neon_load_reg(VAR_6, VAR_14);",
"tmp2 = neon_load_reg(VAR_6, VAR_14 + 1);",
"} else {",
"tmp = neon_load_reg(VAR_7, VAR_14);",
"tmp2 = neon_load_reg(VAR_7, VAR_14 + 1);",
"}",
"} else {",
"tmp = neon_load_reg(VAR_6, VAR_10);",
"tmp2 = neon_load_reg(VAR_7, VAR_10);",
"}",
"switch (VAR_3) {",
"case 0:\nGEN_NEON_INTEGER_OP(hadd);",
"break;",
"case 1:\nGEN_NEON_INTEGER_OP_ENV(qadd);",
"break;",
"case 2:\nGEN_NEON_INTEGER_OP(rhadd);",
"break;",
"case 3:\nswitch ((VAR_13 << 2) | VAR_8) {",
"case 0:\ntcg_gen_and_i32(tmp, tmp, tmp2);",
"break;",
"case 1:\ntcg_gen_andc_i32(tmp, tmp, tmp2);",
"break;",
"case 2:\ntcg_gen_or_i32(tmp, tmp, tmp2);",
"break;",
"case 3:\ntcg_gen_orc_i32(tmp, tmp, tmp2);",
"break;",
"case 4:\ntcg_gen_xor_i32(tmp, tmp, tmp2);",
"break;",
"case 5:\ntmp3 = neon_load_reg(VAR_5, VAR_10);",
"gen_neon_bsl(tmp, tmp, tmp2, tmp3);",
"dead_tmp(tmp3);",
"break;",
"case 6:\ntmp3 = neon_load_reg(VAR_5, VAR_10);",
"gen_neon_bsl(tmp, tmp, tmp3, tmp2);",
"dead_tmp(tmp3);",
"break;",
"case 7:\ntmp3 = neon_load_reg(VAR_5, VAR_10);",
"gen_neon_bsl(tmp, tmp3, tmp, tmp2);",
"dead_tmp(tmp3);",
"break;",
"}",
"break;",
"case 4:\nGEN_NEON_INTEGER_OP(hsub);",
"break;",
"case 5:\nGEN_NEON_INTEGER_OP_ENV(qsub);",
"break;",
"case 6:\nGEN_NEON_INTEGER_OP(cgt);",
"break;",
"case 7:\nGEN_NEON_INTEGER_OP(cge);",
"break;",
"case 8:\nGEN_NEON_INTEGER_OP(shl);",
"break;",
"case 9:\nGEN_NEON_INTEGER_OP_ENV(qshl);",
"break;",
"case 10:\nGEN_NEON_INTEGER_OP(rshl);",
"break;",
"case 11:\nGEN_NEON_INTEGER_OP_ENV(qrshl);",
"break;",
"case 12:\nGEN_NEON_INTEGER_OP(max);",
"break;",
"case 13:\nGEN_NEON_INTEGER_OP(min);",
"break;",
"case 14:\nGEN_NEON_INTEGER_OP(abd);",
"break;",
"case 15:\nGEN_NEON_INTEGER_OP(abd);",
"dead_tmp(tmp2);",
"tmp2 = neon_load_reg(VAR_5, VAR_10);",
"gen_neon_add(VAR_8, tmp, tmp2);",
"break;",
"case 16:\nif (!VAR_13) {",
"if (gen_neon_add(VAR_8, tmp, tmp2))\nreturn 1;",
"} else {",
"switch (VAR_8) {",
"case 0: gen_helper_neon_sub_u8(tmp, tmp, tmp2); break;",
"case 1: gen_helper_neon_sub_u16(tmp, tmp, tmp2); break;",
"case 2: tcg_gen_sub_i32(tmp, tmp, tmp2); break;",
"default: return 1;",
"}",
"}",
"break;",
"case 17:\nif (!VAR_13) {",
"switch (VAR_8) {",
"case 0: gen_helper_neon_tst_u8(tmp, tmp, tmp2); break;",
"case 1: gen_helper_neon_tst_u16(tmp, tmp, tmp2); break;",
"case 2: gen_helper_neon_tst_u32(tmp, tmp, tmp2); break;",
"default: return 1;",
"}",
"} else {",
"switch (VAR_8) {",
"case 0: gen_helper_neon_ceq_u8(tmp, tmp, tmp2); break;",
"case 1: gen_helper_neon_ceq_u16(tmp, tmp, tmp2); break;",
"case 2: gen_helper_neon_ceq_u32(tmp, tmp, tmp2); break;",
"default: return 1;",
"}",
"}",
"break;",
"case 18:\nswitch (VAR_8) {",
"case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break;",
"case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break;",
"case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break;",
"default: return 1;",
"}",
"dead_tmp(tmp2);",
"tmp2 = neon_load_reg(VAR_5, VAR_10);",
"if (VAR_13) {",
"gen_neon_rsb(VAR_8, tmp, tmp2);",
"} else {",
"gen_neon_add(VAR_8, tmp, tmp2);",
"}",
"break;",
"case 19:\nif (VAR_13) {",
"gen_helper_neon_mul_p8(tmp, tmp, tmp2);",
"} else {",
"switch (VAR_8) {",
"case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break;",
"case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break;",
"case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break;",
"default: return 1;",
"}",
"}",
"break;",
"case 20:\nGEN_NEON_INTEGER_OP(pmax);",
"break;",
"case 21:\nGEN_NEON_INTEGER_OP(pmin);",
"break;",
"case 22:\nif (!VAR_13) {",
"switch (VAR_8) {",
"case 1: gen_helper_neon_qdmulh_s16(tmp, cpu_env, tmp, tmp2); break;",
"case 2: gen_helper_neon_qdmulh_s32(tmp, cpu_env, tmp, tmp2); break;",
"default: return 1;",
"}",
"} else {",
"switch (VAR_8) {",
"case 1: gen_helper_neon_qrdmulh_s16(tmp, cpu_env, tmp, tmp2); break;",
"case 2: gen_helper_neon_qrdmulh_s32(tmp, cpu_env, tmp, tmp2); break;",
"default: return 1;",
"}",
"}",
"break;",
"case 23:\nif (VAR_13)\nreturn 1;",
"switch (VAR_8) {",
"case 0: gen_helper_neon_padd_u8(tmp, tmp, tmp2); break;",
"case 1: gen_helper_neon_padd_u16(tmp, tmp, tmp2); break;",
"case 2: tcg_gen_add_i32(tmp, tmp, tmp2); break;",
"default: return 1;",
"}",
"break;",
"case 26:\nswitch ((VAR_13 << 2) | VAR_8) {",
"case 0:\ngen_helper_neon_add_f32(tmp, tmp, tmp2);",
"break;",
"case 2:\ngen_helper_neon_sub_f32(tmp, tmp, tmp2);",
"break;",
"case 4:\ngen_helper_neon_add_f32(tmp, tmp, tmp2);",
"break;",
"case 6:\ngen_helper_neon_abd_f32(tmp, tmp, tmp2);",
"break;",
"default:\nreturn 1;",
"}",
"break;",
"case 27:\ngen_helper_neon_mul_f32(tmp, tmp, tmp2);",
"if (!VAR_13) {",
"dead_tmp(tmp2);",
"tmp2 = neon_load_reg(VAR_5, VAR_10);",
"if (VAR_8 == 0) {",
"gen_helper_neon_add_f32(tmp, tmp, tmp2);",
"} else {",
"gen_helper_neon_sub_f32(tmp, tmp2, tmp);",
"}",
"}",
"break;",
"case 28:\nif (!VAR_13) {",
"gen_helper_neon_ceq_f32(tmp, tmp, tmp2);",
"} else {",
"if (VAR_8 == 0)\ngen_helper_neon_cge_f32(tmp, tmp, tmp2);",
"else\ngen_helper_neon_cgt_f32(tmp, tmp, tmp2);",
"}",
"break;",
"case 29:\nif (!VAR_13)\nreturn 1;",
"if (VAR_8 == 0)\ngen_helper_neon_acge_f32(tmp, tmp, tmp2);",
"else\ngen_helper_neon_acgt_f32(tmp, tmp, tmp2);",
"break;",
"case 30:\nif (VAR_8 == 0)\ngen_helper_neon_max_f32(tmp, tmp, tmp2);",
"else\ngen_helper_neon_min_f32(tmp, tmp, tmp2);",
"break;",
"case 31:\nif (VAR_8 == 0)\ngen_helper_recps_f32(tmp, tmp, tmp2, cpu_env);",
"else\ngen_helper_rsqrts_f32(tmp, tmp, tmp2, cpu_env);",
"break;",
"default:\nabort();",
"}",
"dead_tmp(tmp2);",
"if (VAR_12 && VAR_5 == VAR_7) {",
"neon_store_scratch(VAR_10, tmp);",
"} else {",
"neon_store_reg(VAR_5, VAR_10, tmp);",
"}",
"}",
"if (VAR_12 && VAR_5 == VAR_7) {",
"for (VAR_10 = 0; VAR_10 < (VAR_4 ? 4 : 2); VAR_10++) {",
"tmp = neon_load_scratch(VAR_10);",
"neon_store_reg(VAR_5, VAR_10, tmp);",
"}",
"}",
"} else if (VAR_2 & (1 << 4)) {",
"if ((VAR_2 & 0x00380080) != 0) {",
"VAR_3 = (VAR_2 >> 8) & 0xf;",
"if (VAR_2 & (1 << 7)) {",
"VAR_8 = 3;",
"} else {",
"VAR_8 = 2;",
"while ((VAR_2 & (1 << (VAR_8 + 19))) == 0)\nVAR_8--;",
"}",
"VAR_9 = (VAR_2 >> 16) & ((1 << (3 + VAR_8)) - 1);",
"if (VAR_3 < 8) {",
"if (VAR_3 <= 4)\nVAR_9 = VAR_9 - (1 << (VAR_8 + 3));",
"if (VAR_8 == 3) {",
"VAR_11 = VAR_4 + 1;",
"} else {",
"VAR_11 = VAR_4 ? 4: 2;",
"}",
"switch (VAR_8) {",
"case 0:\nimm = (uint8_t) VAR_9;",
"imm |= imm << 8;",
"imm |= imm << 16;",
"break;",
"case 1:\nimm = (uint16_t) VAR_9;",
"imm |= imm << 16;",
"break;",
"case 2:\ncase 3:\nimm = VAR_9;",
"break;",
"default:\nabort();",
"}",
"for (VAR_10 = 0; VAR_10 < VAR_11; VAR_10++) {",
"if (VAR_8 == 3) {",
"neon_load_reg64(cpu_V0, VAR_7 + VAR_10);",
"tcg_gen_movi_i64(cpu_V1, imm);",
"switch (VAR_3) {",
"case 0:\ncase 1:\nif (VAR_13)\ngen_helper_neon_shl_u64(cpu_V0, cpu_V0, cpu_V1);",
"else\ngen_helper_neon_shl_s64(cpu_V0, cpu_V0, cpu_V1);",
"break;",
"case 2:\ncase 3:\nif (VAR_13)\ngen_helper_neon_rshl_u64(cpu_V0, cpu_V0, cpu_V1);",
"else\ngen_helper_neon_rshl_s64(cpu_V0, cpu_V0, cpu_V1);",
"break;",
"case 4:\nif (!VAR_13)\nreturn 1;",
"gen_helper_neon_shl_u64(cpu_V0, cpu_V0, cpu_V1);",
"break;",
"case 5:\ngen_helper_neon_shl_u64(cpu_V0, cpu_V0, cpu_V1);",
"break;",
"case 6:\nif (VAR_13) {",
"gen_helper_neon_qshlu_s64(cpu_V0, cpu_env,\ncpu_V0, cpu_V1);",
"} else {",
"return 1;",
"}",
"break;",
"case 7:\nif (VAR_13) {",
"gen_helper_neon_qshl_u64(cpu_V0, cpu_env,\ncpu_V0, cpu_V1);",
"} else {",
"gen_helper_neon_qshl_s64(cpu_V0, cpu_env,\ncpu_V0, cpu_V1);",
"}",
"break;",
"}",
"if (VAR_3 == 1 || VAR_3 == 3) {",
"neon_load_reg64(cpu_V1, VAR_5 + VAR_10);",
"tcg_gen_add_i64(cpu_V0, cpu_V0, cpu_V1);",
"} else if (VAR_3 == 4 || (VAR_3 == 5 && VAR_13)) {",
"cpu_abort(VAR_0, \"VS[LR]I.64 not implemented\");",
"}",
"neon_store_reg64(cpu_V0, VAR_5 + VAR_10);",
"} else {",
"tmp = neon_load_reg(VAR_7, VAR_10);",
"tmp2 = new_tmp();",
"tcg_gen_movi_i32(tmp2, imm);",
"switch (VAR_3) {",
"case 0:\ncase 1:\nGEN_NEON_INTEGER_OP(shl);",
"break;",
"case 2:\ncase 3:\nGEN_NEON_INTEGER_OP(rshl);",
"break;",
"case 4:\nif (!VAR_13)\nreturn 1;",
"GEN_NEON_INTEGER_OP(shl);",
"break;",
"case 5:\nswitch (VAR_8) {",
"case 0: gen_helper_neon_shl_u8(tmp, tmp, tmp2); break;",
"case 1: gen_helper_neon_shl_u16(tmp, tmp, tmp2); break;",
"case 2: gen_helper_neon_shl_u32(tmp, tmp, tmp2); break;",
"default: return 1;",
"}",
"break;",
"case 6:\nif (!VAR_13) {",
"return 1;",
"}",
"switch (VAR_8) {",
"case 0:\ngen_helper_neon_qshlu_s8(tmp, cpu_env,\ntmp, tmp2);",
"break;",
"case 1:\ngen_helper_neon_qshlu_s16(tmp, cpu_env,\ntmp, tmp2);",
"break;",
"case 2:\ngen_helper_neon_qshlu_s32(tmp, cpu_env,\ntmp, tmp2);",
"break;",
"default:\nreturn 1;",
"}",
"break;",
"case 7:\nGEN_NEON_INTEGER_OP_ENV(qshl);",
"break;",
"}",
"dead_tmp(tmp2);",
"if (VAR_3 == 1 || VAR_3 == 3) {",
"tmp2 = neon_load_reg(VAR_5, VAR_10);",
"gen_neon_add(VAR_8, tmp, tmp2);",
"dead_tmp(tmp2);",
"} else if (VAR_3 == 4 || (VAR_3 == 5 && VAR_13)) {",
"switch (VAR_8) {",
"case 0:\nif (VAR_3 == 4)\nmask = 0xff >> -VAR_9;",
"else\nmask = (uint8_t)(0xff << VAR_9);",
"mask |= mask << 8;",
"mask |= mask << 16;",
"break;",
"case 1:\nif (VAR_3 == 4)\nmask = 0xffff >> -VAR_9;",
"else\nmask = (uint16_t)(0xffff << VAR_9);",
"mask |= mask << 16;",
"break;",
"case 2:\nif (VAR_9 < -31 || VAR_9 > 31) {",
"mask = 0;",
"} else {",
"if (VAR_3 == 4)\nmask = 0xffffffffu >> -VAR_9;",
"else\nmask = 0xffffffffu << VAR_9;",
"}",
"break;",
"default:\nabort();",
"}",
"tmp2 = neon_load_reg(VAR_5, VAR_10);",
"tcg_gen_andi_i32(tmp, tmp, mask);",
"tcg_gen_andi_i32(tmp2, tmp2, ~mask);",
"tcg_gen_or_i32(tmp, tmp, tmp2);",
"dead_tmp(tmp2);",
"}",
"neon_store_reg(VAR_5, VAR_10, tmp);",
"}",
"}",
"} else if (VAR_3 < 10) {",
"VAR_9 = VAR_9 - (1 << (VAR_8 + 3));",
"VAR_8++;",
"switch (VAR_8) {",
"case 1:\nimm = (uint16_t)VAR_9;",
"imm |= imm << 16;",
"tmp2 = tcg_const_i32(imm);",
"TCGV_UNUSED_I64(tmp64);",
"break;",
"case 2:\nimm = (uint32_t)VAR_9;",
"tmp2 = tcg_const_i32(imm);",
"TCGV_UNUSED_I64(tmp64);",
"break;",
"case 3:\ntmp64 = tcg_const_i64(VAR_9);",
"TCGV_UNUSED(tmp2);",
"break;",
"default:\nabort();",
"}",
"for (VAR_10 = 0; VAR_10 < 2; VAR_10++) {",
"if (VAR_8 == 3) {",
"neon_load_reg64(cpu_V0, VAR_7 + VAR_10);",
"if (VAR_4) {",
"if (VAR_13)\ngen_helper_neon_rshl_u64(cpu_V0, cpu_V0, tmp64);",
"else\ngen_helper_neon_rshl_s64(cpu_V0, cpu_V0, tmp64);",
"} else {",
"if (VAR_13)\ngen_helper_neon_shl_u64(cpu_V0, cpu_V0, tmp64);",
"else\ngen_helper_neon_shl_s64(cpu_V0, cpu_V0, tmp64);",
"}",
"} else {",
"tmp = neon_load_reg(VAR_7 + VAR_10, 0);",
"gen_neon_shift_narrow(VAR_8, tmp, tmp2, VAR_4, VAR_13);",
"tmp3 = neon_load_reg(VAR_7 + VAR_10, 1);",
"gen_neon_shift_narrow(VAR_8, tmp3, tmp2, VAR_4, VAR_13);",
"tcg_gen_concat_i32_i64(cpu_V0, tmp, tmp3);",
"dead_tmp(tmp);",
"dead_tmp(tmp3);",
"}",
"tmp = new_tmp();",
"if (VAR_3 == 8 && !VAR_13) {",
"gen_neon_narrow(VAR_8 - 1, tmp, cpu_V0);",
"} else {",
"if (VAR_3 == 8)\ngen_neon_narrow_sats(VAR_8 - 1, tmp, cpu_V0);",
"else\ngen_neon_narrow_satu(VAR_8 - 1, tmp, cpu_V0);",
"}",
"neon_store_reg(VAR_5, VAR_10, tmp);",
"}",
"if (VAR_8 == 3) {",
"tcg_temp_free_i64(tmp64);",
"} else {",
"tcg_temp_free_i32(tmp2);",
"}",
"} else if (VAR_3 == 10) {",
"if (VAR_4 || VAR_8 == 3)\nreturn 1;",
"tmp = neon_load_reg(VAR_7, 0);",
"tmp2 = neon_load_reg(VAR_7, 1);",
"for (VAR_10 = 0; VAR_10 < 2; VAR_10++) {",
"if (VAR_10 == 1)\ntmp = tmp2;",
"gen_neon_widen(cpu_V0, tmp, VAR_8, VAR_13);",
"if (VAR_9 != 0) {",
"tcg_gen_shli_i64(cpu_V0, cpu_V0, VAR_9);",
"if (VAR_8 < 2 || !VAR_13) {",
"uint64_t imm64;",
"if (VAR_8 == 0) {",
"imm = (0xffu >> (8 - VAR_9));",
"imm |= imm << 16;",
"} else {",
"imm = 0xffff >> (16 - VAR_9);",
"}",
"imm64 = imm | (((uint64_t)imm) << 32);",
"tcg_gen_andi_i64(cpu_V0, cpu_V0, imm64);",
"}",
"}",
"neon_store_reg64(cpu_V0, VAR_5 + VAR_10);",
"}",
"} else if (VAR_3 >= 14) {",
"VAR_9 = 32 - VAR_9;",
"for (VAR_10 = 0; VAR_10 < (VAR_4 ? 4 : 2); VAR_10++) {",
"tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_7, VAR_10));",
"if (!(VAR_3 & 1)) {",
"if (VAR_13)\ngen_vfp_ulto(0, VAR_9);",
"else\ngen_vfp_slto(0, VAR_9);",
"} else {",
"if (VAR_13)\ngen_vfp_toul(0, VAR_9);",
"else\ngen_vfp_tosl(0, VAR_9);",
"}",
"tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_5, VAR_10));",
"}",
"} else {",
"return 1;",
"}",
"} else {",
"int VAR_16;",
"VAR_3 = (VAR_2 >> 8) & 0xf;",
"imm = (VAR_13 << 7) | ((VAR_2 >> 12) & 0x70) | (VAR_2 & 0xf);",
"VAR_16 = (VAR_2 & (1 << 5)) != 0;",
"switch (VAR_3) {",
"case 0: case 1:\nbreak;",
"case 2: case 3:\nimm <<= 8;",
"break;",
"case 4: case 5:\nimm <<= 16;",
"break;",
"case 6: case 7:\nimm <<= 24;",
"break;",
"case 8: case 9:\nimm |= imm << 16;",
"break;",
"case 10: case 11:\nimm = (imm << 8) | (imm << 24);",
"break;",
"case 12:\nimm = (imm << 8) | 0xff;",
"break;",
"case 13:\nimm = (imm << 16) | 0xffff;",
"break;",
"case 14:\nimm |= (imm << 8) | (imm << 16) | (imm << 24);",
"if (VAR_16)\nimm = ~imm;",
"break;",
"case 15:\nimm = ((imm & 0x80) << 24) | ((imm & 0x3f) << 19)\n| ((imm & 0x40) ? (0x1f << 25) : (1 << 30));",
"break;",
"}",
"if (VAR_16)\nimm = ~imm;",
"for (VAR_10 = 0; VAR_10 < (VAR_4 ? 4 : 2); VAR_10++) {",
"if (VAR_3 & 1 && VAR_3 < 12) {",
"tmp = neon_load_reg(VAR_5, VAR_10);",
"if (VAR_16) {",
"tcg_gen_andi_i32(tmp, tmp, imm);",
"} else {",
"tcg_gen_ori_i32(tmp, tmp, imm);",
"}",
"} else {",
"tmp = new_tmp();",
"if (VAR_3 == 14 && VAR_16) {",
"uint32_t val;",
"val = 0;",
"for (VAR_14 = 0; VAR_14 < 4; VAR_14++) {",
"if (imm & (1 << (VAR_14 + (VAR_10 & 1) * 4)))\nval |= 0xff << (VAR_14 * 8);",
"}",
"tcg_gen_movi_i32(tmp, val);",
"} else {",
"tcg_gen_movi_i32(tmp, imm);",
"}",
"}",
"neon_store_reg(VAR_5, VAR_10, tmp);",
"}",
"}",
"} else {",
"if (VAR_8 != 3) {",
"VAR_3 = (VAR_2 >> 8) & 0xf;",
"if ((VAR_2 & (1 << 6)) == 0) {",
"int VAR_17;",
"int VAR_18;",
"int VAR_19;",
"static const int VAR_20[16][3] = {",
"{1, 0, 0},",
"{1, 1, 0},",
"{1, 0, 0},",
"{1, 1, 0},",
"{0, 1, 1},",
"{0, 0, 0},",
"{0, 1, 1},",
"{0, 0, 0},",
"{0, 0, 0},",
"{0, 0, 0},",
"{0, 0, 0},",
"{0, 0, 0},",
"{0, 0, 0},",
"{0, 0, 0},",
"{0, 0, 0}",
"};",
"VAR_19 = VAR_20[VAR_3][0];",
"VAR_17 = VAR_20[VAR_3][1];",
"VAR_18 = VAR_20[VAR_3][2];",
"if (VAR_8 == 0 && (VAR_3 == 9 || VAR_3 == 11 || VAR_3 == 13))\nreturn 1;",
"if (VAR_5 == VAR_7 && !VAR_18) {",
"tmp = neon_load_reg(VAR_7, 1);",
"neon_store_scratch(2, tmp);",
"} else if (VAR_5 == VAR_6 && !VAR_17) {",
"tmp = neon_load_reg(VAR_6, 1);",
"neon_store_scratch(2, tmp);",
"}",
"TCGV_UNUSED(tmp3);",
"for (VAR_10 = 0; VAR_10 < 2; VAR_10++) {",
"if (VAR_17) {",
"neon_load_reg64(cpu_V0, VAR_6 + VAR_10);",
"TCGV_UNUSED(tmp);",
"} else {",
"if (VAR_10 == 1 && VAR_5 == VAR_6) {",
"tmp = neon_load_scratch(2);",
"} else {",
"tmp = neon_load_reg(VAR_6, VAR_10);",
"}",
"if (VAR_19) {",
"gen_neon_widen(cpu_V0, tmp, VAR_8, VAR_13);",
"}",
"}",
"if (VAR_18) {",
"neon_load_reg64(cpu_V1, VAR_7 + VAR_10);",
"TCGV_UNUSED(tmp2);",
"} else {",
"if (VAR_10 == 1 && VAR_5 == VAR_7) {",
"tmp2 = neon_load_scratch(2);",
"} else {",
"tmp2 = neon_load_reg(VAR_7, VAR_10);",
"}",
"if (VAR_19) {",
"gen_neon_widen(cpu_V1, tmp2, VAR_8, VAR_13);",
"}",
"}",
"switch (VAR_3) {",
"case 0: case 1: case 4:\ngen_neon_addl(VAR_8);",
"break;",
"case 2: case 3: case 6:\ngen_neon_subl(VAR_8);",
"break;",
"case 5: case 7:\nswitch ((VAR_8 << 1) | VAR_13) {",
"case 0:\ngen_helper_neon_abdl_s16(cpu_V0, tmp, tmp2);",
"break;",
"case 1:\ngen_helper_neon_abdl_u16(cpu_V0, tmp, tmp2);",
"break;",
"case 2:\ngen_helper_neon_abdl_s32(cpu_V0, tmp, tmp2);",
"break;",
"case 3:\ngen_helper_neon_abdl_u32(cpu_V0, tmp, tmp2);",
"break;",
"case 4:\ngen_helper_neon_abdl_s64(cpu_V0, tmp, tmp2);",
"break;",
"case 5:\ngen_helper_neon_abdl_u64(cpu_V0, tmp, tmp2);",
"break;",
"default: abort();",
"}",
"dead_tmp(tmp2);",
"dead_tmp(tmp);",
"break;",
"case 8: case 9: case 10: case 11: case 12: case 13:\ngen_neon_mull(cpu_V0, tmp, tmp2, VAR_8, VAR_13);",
"break;",
"case 14:\ncpu_abort(VAR_0, \"Polynomial VMULL not implemented\");",
"default:\nreturn 1;",
"}",
"if (VAR_3 == 5 || VAR_3 == 13 || (VAR_3 >= 8 && VAR_3 <= 11)) {",
"if (VAR_3 == 10 || VAR_3 == 11) {",
"gen_neon_negl(cpu_V0, VAR_8);",
"}",
"if (VAR_3 != 13) {",
"neon_load_reg64(cpu_V1, VAR_5 + VAR_10);",
"}",
"switch (VAR_3) {",
"case 5: case 8: case 10:\ngen_neon_addl(VAR_8);",
"break;",
"case 9: case 11:\ngen_neon_addl_saturate(cpu_V0, cpu_V0, VAR_8);",
"gen_neon_addl_saturate(cpu_V0, cpu_V1, VAR_8);",
"break;",
"case 13:\ngen_neon_addl_saturate(cpu_V0, cpu_V0, VAR_8);",
"break;",
"default:\nabort();",
"}",
"neon_store_reg64(cpu_V0, VAR_5 + VAR_10);",
"} else if (VAR_3 == 4 || VAR_3 == 6) {",
"tmp = new_tmp();",
"if (!VAR_13) {",
"switch (VAR_8) {",
"case 0:\ngen_helper_neon_narrow_high_u8(tmp, cpu_V0);",
"break;",
"case 1:\ngen_helper_neon_narrow_high_u16(tmp, cpu_V0);",
"break;",
"case 2:\ntcg_gen_shri_i64(cpu_V0, cpu_V0, 32);",
"tcg_gen_trunc_i64_i32(tmp, cpu_V0);",
"break;",
"default: abort();",
"}",
"} else {",
"switch (VAR_8) {",
"case 0:\ngen_helper_neon_narrow_round_high_u8(tmp, cpu_V0);",
"break;",
"case 1:\ngen_helper_neon_narrow_round_high_u16(tmp, cpu_V0);",
"break;",
"case 2:\ntcg_gen_addi_i64(cpu_V0, cpu_V0, 1u << 31);",
"tcg_gen_shri_i64(cpu_V0, cpu_V0, 32);",
"tcg_gen_trunc_i64_i32(tmp, cpu_V0);",
"break;",
"default: abort();",
"}",
"}",
"if (VAR_10 == 0) {",
"tmp3 = tmp;",
"} else {",
"neon_store_reg(VAR_5, 0, tmp3);",
"neon_store_reg(VAR_5, 1, tmp);",
"}",
"} else {",
"neon_store_reg64(cpu_V0, VAR_5 + VAR_10);",
"}",
"}",
"} else {",
"switch (VAR_3) {",
"case 0:\ncase 1:\ncase 4:\ncase 5:\ncase 8:\ncase 9:\ncase 12:\ncase 13:\ntmp = neon_get_scalar(VAR_8, VAR_7);",
"neon_store_scratch(0, tmp);",
"for (VAR_10 = 0; VAR_10 < (VAR_13 ? 4 : 2); VAR_10++) {",
"tmp = neon_load_scratch(0);",
"tmp2 = neon_load_reg(VAR_6, VAR_10);",
"if (VAR_3 == 12) {",
"if (VAR_8 == 1) {",
"gen_helper_neon_qdmulh_s16(tmp, cpu_env, tmp, tmp2);",
"} else {",
"gen_helper_neon_qdmulh_s32(tmp, cpu_env, tmp, tmp2);",
"}",
"} else if (VAR_3 == 13) {",
"if (VAR_8 == 1) {",
"gen_helper_neon_qrdmulh_s16(tmp, cpu_env, tmp, tmp2);",
"} else {",
"gen_helper_neon_qrdmulh_s32(tmp, cpu_env, tmp, tmp2);",
"}",
"} else if (VAR_3 & 1) {",
"gen_helper_neon_mul_f32(tmp, tmp, tmp2);",
"} else {",
"switch (VAR_8) {",
"case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break;",
"case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break;",
"case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break;",
"default: return 1;",
"}",
"}",
"dead_tmp(tmp2);",
"if (VAR_3 < 8) {",
"tmp2 = neon_load_reg(VAR_5, VAR_10);",
"switch (VAR_3) {",
"case 0:\ngen_neon_add(VAR_8, tmp, tmp2);",
"break;",
"case 1:\ngen_helper_neon_add_f32(tmp, tmp, tmp2);",
"break;",
"case 4:\ngen_neon_rsb(VAR_8, tmp, tmp2);",
"break;",
"case 5:\ngen_helper_neon_sub_f32(tmp, tmp2, tmp);",
"break;",
"default:\nabort();",
"}",
"dead_tmp(tmp2);",
"}",
"neon_store_reg(VAR_5, VAR_10, tmp);",
"}",
"break;",
"case 2:\ncase 3:\ncase 6:\ncase 7:\ncase 10:\ncase 11:\nif (VAR_8 == 0 && (VAR_3 == 3 || VAR_3 == 7 || VAR_3 == 11))\nreturn 1;",
"tmp2 = neon_get_scalar(VAR_8, VAR_7);",
"tmp4 = new_tmp();",
"tcg_gen_mov_i32(tmp4, tmp2);",
"tmp3 = neon_load_reg(VAR_6, 1);",
"for (VAR_10 = 0; VAR_10 < 2; VAR_10++) {",
"if (VAR_10 == 0) {",
"tmp = neon_load_reg(VAR_6, 0);",
"} else {",
"tmp = tmp3;",
"tmp2 = tmp4;",
"}",
"gen_neon_mull(cpu_V0, tmp, tmp2, VAR_8, VAR_13);",
"if (VAR_3 == 6 || VAR_3 == 7) {",
"gen_neon_negl(cpu_V0, VAR_8);",
"}",
"if (VAR_3 != 11) {",
"neon_load_reg64(cpu_V1, VAR_5 + VAR_10);",
"}",
"switch (VAR_3) {",
"case 2: case 6:\ngen_neon_addl(VAR_8);",
"break;",
"case 3: case 7:\ngen_neon_addl_saturate(cpu_V0, cpu_V0, VAR_8);",
"gen_neon_addl_saturate(cpu_V0, cpu_V1, VAR_8);",
"break;",
"case 10:\nbreak;",
"case 11:\ngen_neon_addl_saturate(cpu_V0, cpu_V0, VAR_8);",
"break;",
"default:\nabort();",
"}",
"neon_store_reg64(cpu_V0, VAR_5 + VAR_10);",
"}",
"break;",
"default:\nreturn 1;",
"}",
"}",
"} else {",
"if (!VAR_13) {",
"imm = (VAR_2 >> 8) & 0xf;",
"if (imm > 7 && !VAR_4)\nreturn 1;",
"if (imm == 0) {",
"neon_load_reg64(cpu_V0, VAR_6);",
"if (VAR_4) {",
"neon_load_reg64(cpu_V1, VAR_6 + 1);",
"}",
"} else if (imm == 8) {",
"neon_load_reg64(cpu_V0, VAR_6 + 1);",
"if (VAR_4) {",
"neon_load_reg64(cpu_V1, VAR_7);",
"}",
"} else if (VAR_4) {",
"tmp64 = tcg_temp_new_i64();",
"if (imm < 8) {",
"neon_load_reg64(cpu_V0, VAR_6);",
"neon_load_reg64(tmp64, VAR_6 + 1);",
"} else {",
"neon_load_reg64(cpu_V0, VAR_6 + 1);",
"neon_load_reg64(tmp64, VAR_7);",
"}",
"tcg_gen_shri_i64(cpu_V0, cpu_V0, (imm & 7) * 8);",
"tcg_gen_shli_i64(cpu_V1, tmp64, 64 - ((imm & 7) * 8));",
"tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1);",
"if (imm < 8) {",
"neon_load_reg64(cpu_V1, VAR_7);",
"} else {",
"neon_load_reg64(cpu_V1, VAR_7 + 1);",
"imm -= 8;",
"}",
"tcg_gen_shli_i64(cpu_V1, cpu_V1, 64 - (imm * 8));",
"tcg_gen_shri_i64(tmp64, tmp64, imm * 8);",
"tcg_gen_or_i64(cpu_V1, cpu_V1, tmp64);",
"tcg_temp_free_i64(tmp64);",
"} else {",
"neon_load_reg64(cpu_V0, VAR_6);",
"tcg_gen_shri_i64(cpu_V0, cpu_V0, imm * 8);",
"neon_load_reg64(cpu_V1, VAR_7);",
"tcg_gen_shli_i64(cpu_V1, cpu_V1, 64 - (imm * 8));",
"tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1);",
"}",
"neon_store_reg64(cpu_V0, VAR_5);",
"if (VAR_4) {",
"neon_store_reg64(cpu_V1, VAR_5 + 1);",
"}",
"} else if ((VAR_2 & (1 << 11)) == 0) {",
"VAR_3 = ((VAR_2 >> 12) & 0x30) | ((VAR_2 >> 7) & 0xf);",
"VAR_8 = (VAR_2 >> 18) & 3;",
"switch (VAR_3) {",
"case 0:\nif (VAR_8 == 3)\nreturn 1;",
"for (VAR_10 = 0; VAR_10 < (VAR_4 ? 2 : 1); VAR_10++) {",
"tmp = neon_load_reg(VAR_7, VAR_10 * 2);",
"tmp2 = neon_load_reg(VAR_7, VAR_10 * 2 + 1);",
"switch (VAR_8) {",
"case 0: tcg_gen_bswap32_i32(tmp, tmp); break;",
"case 1: gen_swap_half(tmp); break;",
"case 2: break;",
"default: abort();",
"}",
"neon_store_reg(VAR_5, VAR_10 * 2 + 1, tmp);",
"if (VAR_8 == 2) {",
"neon_store_reg(VAR_5, VAR_10 * 2, tmp2);",
"} else {",
"switch (VAR_8) {",
"case 0: tcg_gen_bswap32_i32(tmp2, tmp2); break;",
"case 1: gen_swap_half(tmp2); break;",
"default: abort();",
"}",
"neon_store_reg(VAR_5, VAR_10 * 2, tmp2);",
"}",
"}",
"break;",
"case 4: case 5:\ncase 12: case 13:\nif (VAR_8 == 3)\nreturn 1;",
"for (VAR_10 = 0; VAR_10 < VAR_4 + 1; VAR_10++) {",
"tmp = neon_load_reg(VAR_7, VAR_10 * 2);",
"gen_neon_widen(cpu_V0, tmp, VAR_8, VAR_3 & 1);",
"tmp = neon_load_reg(VAR_7, VAR_10 * 2 + 1);",
"gen_neon_widen(cpu_V1, tmp, VAR_8, VAR_3 & 1);",
"switch (VAR_8) {",
"case 0: gen_helper_neon_paddl_u16(CPU_V001); break;",
"case 1: gen_helper_neon_paddl_u32(CPU_V001); break;",
"case 2: tcg_gen_add_i64(CPU_V001); break;",
"default: abort();",
"}",
"if (VAR_3 >= 12) {",
"neon_load_reg64(cpu_V1, VAR_5 + VAR_10);",
"gen_neon_addl(VAR_8);",
"}",
"neon_store_reg64(cpu_V0, VAR_5 + VAR_10);",
"}",
"break;",
"case 33:\nif (VAR_8 == 2) {",
"for (VAR_14 = 0; VAR_14 < (VAR_4 ? 4 : 2); VAR_14 += 2) {",
"tmp = neon_load_reg(VAR_7, VAR_14);",
"tmp2 = neon_load_reg(VAR_5, VAR_14 + 1);",
"neon_store_reg(VAR_7, VAR_14, tmp2);",
"neon_store_reg(VAR_5, VAR_14 + 1, tmp);",
"}",
"} else {",
"goto elementwise;",
"}",
"break;",
"case 34:\nif (VAR_8 == 3)\nreturn 1;",
"gen_neon_unzip(VAR_5, VAR_4, 0, VAR_8);",
"gen_neon_unzip(VAR_7, VAR_4, 4, VAR_8);",
"if (VAR_4) {",
"static int VAR_21[8] =\n{0, 2, 4, 6, 1, 3, 5, 7};",
"for (VAR_14 = 0; VAR_14 < 8; VAR_14++) {",
"int VAR_24 = (VAR_14 < 4) ? VAR_5 : VAR_7;",
"tmp = neon_load_scratch(VAR_21[VAR_14]);",
"neon_store_reg(VAR_24, VAR_14 % 4, tmp);",
"}",
"} else {",
"static int VAR_23[4] =\n{0, 4, 1, 5};",
"for (VAR_14 = 0; VAR_14 < 4; VAR_14++) {",
"int VAR_24 = (VAR_14 < 2) ? VAR_5 : VAR_7;",
"tmp = neon_load_scratch(VAR_23[VAR_14]);",
"neon_store_reg(VAR_24, VAR_14 % 2, tmp);",
"}",
"}",
"break;",
"case 35:\nif (VAR_8 == 3)\nreturn 1;",
"VAR_11 = (VAR_4 ? 4 : 2);",
"for (VAR_14 = 0; VAR_14 < VAR_11; VAR_14++) {",
"tmp = neon_load_reg(VAR_5, VAR_14);",
"tmp2 = neon_load_reg(VAR_5, VAR_14);",
"switch (VAR_8) {",
"case 0: gen_neon_zip_u8(tmp, tmp2); break;",
"case 1: gen_neon_zip_u16(tmp, tmp2); break;",
"case 2: ; break;",
"default: abort();",
"}",
"neon_store_scratch(VAR_14 * 2, tmp);",
"neon_store_scratch(VAR_14 * 2 + 1, tmp2);",
"}",
"for (VAR_14 = 0; VAR_14 < VAR_11 * 2; VAR_14++) {",
"int VAR_24 = (VAR_14 < VAR_11) ? VAR_5 : VAR_7;",
"tmp = neon_load_scratch(VAR_14);",
"neon_store_reg(VAR_24, VAR_14 % VAR_11, tmp);",
"}",
"break;",
"case 36: case 37:\nif (VAR_8 == 3)\nreturn 1;",
"TCGV_UNUSED(tmp2);",
"for (VAR_10 = 0; VAR_10 < 2; VAR_10++) {",
"neon_load_reg64(cpu_V0, VAR_7 + VAR_10);",
"tmp = new_tmp();",
"if (VAR_3 == 36 && VAR_4 == 0) {",
"gen_neon_narrow(VAR_8, tmp, cpu_V0);",
"} else if (VAR_4) {",
"gen_neon_narrow_satu(VAR_8, tmp, cpu_V0);",
"} else {",
"gen_neon_narrow_sats(VAR_8, tmp, cpu_V0);",
"}",
"if (VAR_10 == 0) {",
"tmp2 = tmp;",
"} else {",
"neon_store_reg(VAR_5, 0, tmp2);",
"neon_store_reg(VAR_5, 1, tmp);",
"}",
"}",
"break;",
"case 38:\nif (VAR_4 || VAR_8 == 3)\nreturn 1;",
"tmp = neon_load_reg(VAR_7, 0);",
"tmp2 = neon_load_reg(VAR_7, 1);",
"for (VAR_10 = 0; VAR_10 < 2; VAR_10++) {",
"if (VAR_10 == 1)\ntmp = tmp2;",
"gen_neon_widen(cpu_V0, tmp, VAR_8, 1);",
"tcg_gen_shli_i64(cpu_V0, cpu_V0, 8 << VAR_8);",
"neon_store_reg64(cpu_V0, VAR_5 + VAR_10);",
"}",
"break;",
"case 44:\nif (!arm_feature(VAR_0, ARM_FEATURE_VFP_FP16))\nreturn 1;",
"tmp = new_tmp();",
"tmp2 = new_tmp();",
"tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_7, 0));",
"gen_helper_vfp_fcvt_f32_to_f16(tmp, cpu_F0s, cpu_env);",
"tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_7, 1));",
"gen_helper_vfp_fcvt_f32_to_f16(tmp2, cpu_F0s, cpu_env);",
"tcg_gen_shli_i32(tmp2, tmp2, 16);",
"tcg_gen_or_i32(tmp2, tmp2, tmp);",
"tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_7, 2));",
"gen_helper_vfp_fcvt_f32_to_f16(tmp, cpu_F0s, cpu_env);",
"tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_7, 3));",
"neon_store_reg(VAR_5, 0, tmp2);",
"tmp2 = new_tmp();",
"gen_helper_vfp_fcvt_f32_to_f16(tmp2, cpu_F0s, cpu_env);",
"tcg_gen_shli_i32(tmp2, tmp2, 16);",
"tcg_gen_or_i32(tmp2, tmp2, tmp);",
"neon_store_reg(VAR_5, 1, tmp2);",
"dead_tmp(tmp);",
"break;",
"case 46:\nif (!arm_feature(VAR_0, ARM_FEATURE_VFP_FP16))\nreturn 1;",
"tmp3 = new_tmp();",
"tmp = neon_load_reg(VAR_7, 0);",
"tmp2 = neon_load_reg(VAR_7, 1);",
"tcg_gen_ext16u_i32(tmp3, tmp);",
"gen_helper_vfp_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);",
"tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_5, 0));",
"tcg_gen_shri_i32(tmp3, tmp, 16);",
"gen_helper_vfp_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);",
"tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_5, 1));",
"dead_tmp(tmp);",
"tcg_gen_ext16u_i32(tmp3, tmp2);",
"gen_helper_vfp_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);",
"tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_5, 2));",
"tcg_gen_shri_i32(tmp3, tmp2, 16);",
"gen_helper_vfp_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);",
"tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_5, 3));",
"dead_tmp(tmp2);",
"dead_tmp(tmp3);",
"break;",
"default:\nelementwise:\nfor (VAR_10 = 0; VAR_10 < (VAR_4 ? 4 : 2); VAR_10++) {",
"if (VAR_3 == 30 || VAR_3 == 31 || VAR_3 >= 58) {",
"tcg_gen_ld_f32(cpu_F0s, cpu_env,\nneon_reg_offset(VAR_7, VAR_10));",
"TCGV_UNUSED(tmp);",
"} else {",
"tmp = neon_load_reg(VAR_7, VAR_10);",
"}",
"switch (VAR_3) {",
"case 1:\nswitch (VAR_8) {",
"case 0: tcg_gen_bswap32_i32(tmp, tmp); break;",
"case 1: gen_swap_half(tmp); break;",
"default: return 1;",
"}",
"break;",
"case 2:\nif (VAR_8 != 0)\nreturn 1;",
"gen_rev16(tmp);",
"break;",
"case 8:\nswitch (VAR_8) {",
"case 0: gen_helper_neon_cls_s8(tmp, tmp); break;",
"case 1: gen_helper_neon_cls_s16(tmp, tmp); break;",
"case 2: gen_helper_neon_cls_s32(tmp, tmp); break;",
"default: return 1;",
"}",
"break;",
"case 9:\nswitch (VAR_8) {",
"case 0: gen_helper_neon_clz_u8(tmp, tmp); break;",
"case 1: gen_helper_neon_clz_u16(tmp, tmp); break;",
"case 2: gen_helper_clz(tmp, tmp); break;",
"default: return 1;",
"}",
"break;",
"case 10:\nif (VAR_8 != 0)\nreturn 1;",
"gen_helper_neon_cnt_u8(tmp, tmp);",
"break;",
"case 11:\nif (VAR_8 != 0)\nreturn 1;",
"tcg_gen_not_i32(tmp, tmp);",
"break;",
"case 14:\nswitch (VAR_8) {",
"case 0: gen_helper_neon_qabs_s8(tmp, cpu_env, tmp); break;",
"case 1: gen_helper_neon_qabs_s16(tmp, cpu_env, tmp); break;",
"case 2: gen_helper_neon_qabs_s32(tmp, cpu_env, tmp); break;",
"default: return 1;",
"}",
"break;",
"case 15:\nswitch (VAR_8) {",
"case 0: gen_helper_neon_qneg_s8(tmp, cpu_env, tmp); break;",
"case 1: gen_helper_neon_qneg_s16(tmp, cpu_env, tmp); break;",
"case 2: gen_helper_neon_qneg_s32(tmp, cpu_env, tmp); break;",
"default: return 1;",
"}",
"break;",
"case 16: case 19:\ntmp2 = tcg_const_i32(0);",
"switch(VAR_8) {",
"case 0: gen_helper_neon_cgt_s8(tmp, tmp, tmp2); break;",
"case 1: gen_helper_neon_cgt_s16(tmp, tmp, tmp2); break;",
"case 2: gen_helper_neon_cgt_s32(tmp, tmp, tmp2); break;",
"default: return 1;",
"}",
"tcg_temp_free(tmp2);",
"if (VAR_3 == 19)\ntcg_gen_not_i32(tmp, tmp);",
"break;",
"case 17: case 20:\ntmp2 = tcg_const_i32(0);",
"switch(VAR_8) {",
"case 0: gen_helper_neon_cge_s8(tmp, tmp, tmp2); break;",
"case 1: gen_helper_neon_cge_s16(tmp, tmp, tmp2); break;",
"case 2: gen_helper_neon_cge_s32(tmp, tmp, tmp2); break;",
"default: return 1;",
"}",
"tcg_temp_free(tmp2);",
"if (VAR_3 == 20)\ntcg_gen_not_i32(tmp, tmp);",
"break;",
"case 18:\ntmp2 = tcg_const_i32(0);",
"switch(VAR_8) {",
"case 0: gen_helper_neon_ceq_u8(tmp, tmp, tmp2); break;",
"case 1: gen_helper_neon_ceq_u16(tmp, tmp, tmp2); break;",
"case 2: gen_helper_neon_ceq_u32(tmp, tmp, tmp2); break;",
"default: return 1;",
"}",
"tcg_temp_free(tmp2);",
"break;",
"case 22:\nswitch(VAR_8) {",
"case 0: gen_helper_neon_abs_s8(tmp, tmp); break;",
"case 1: gen_helper_neon_abs_s16(tmp, tmp); break;",
"case 2: tcg_gen_abs_i32(tmp, tmp); break;",
"default: return 1;",
"}",
"break;",
"case 23:\nif (VAR_8 == 3)\nreturn 1;",
"tmp2 = tcg_const_i32(0);",
"gen_neon_rsb(VAR_8, tmp, tmp2);",
"tcg_temp_free(tmp2);",
"break;",
"case 24: case 27:\ntmp2 = tcg_const_i32(0);",
"gen_helper_neon_cgt_f32(tmp, tmp, tmp2);",
"tcg_temp_free(tmp2);",
"if (VAR_3 == 27)\ntcg_gen_not_i32(tmp, tmp);",
"break;",
"case 25: case 28:\ntmp2 = tcg_const_i32(0);",
"gen_helper_neon_cge_f32(tmp, tmp, tmp2);",
"tcg_temp_free(tmp2);",
"if (VAR_3 == 28)\ntcg_gen_not_i32(tmp, tmp);",
"break;",
"case 26:\ntmp2 = tcg_const_i32(0);",
"gen_helper_neon_ceq_f32(tmp, tmp, tmp2);",
"tcg_temp_free(tmp2);",
"break;",
"case 30:\ngen_vfp_abs(0);",
"break;",
"case 31:\ngen_vfp_neg(0);",
"break;",
"case 32:\ntmp2 = neon_load_reg(VAR_5, VAR_10);",
"neon_store_reg(VAR_7, VAR_10, tmp2);",
"break;",
"case 33:\ntmp2 = neon_load_reg(VAR_5, VAR_10);",
"switch (VAR_8) {",
"case 0: gen_neon_trn_u8(tmp, tmp2); break;",
"case 1: gen_neon_trn_u16(tmp, tmp2); break;",
"case 2: abort();",
"default: return 1;",
"}",
"neon_store_reg(VAR_7, VAR_10, tmp2);",
"break;",
"case 56:\ngen_helper_recpe_u32(tmp, tmp, cpu_env);",
"break;",
"case 57:\ngen_helper_rsqrte_u32(tmp, tmp, cpu_env);",
"break;",
"case 58:\ngen_helper_recpe_f32(cpu_F0s, cpu_F0s, cpu_env);",
"break;",
"case 59:\ngen_helper_rsqrte_f32(cpu_F0s, cpu_F0s, cpu_env);",
"break;",
"case 60:\ngen_vfp_sito(0);",
"break;",
"case 61:\ngen_vfp_uito(0);",
"break;",
"case 62:\ngen_vfp_tosiz(0);",
"break;",
"case 63:\ngen_vfp_touiz(0);",
"break;",
"default:\nreturn 1;",
"}",
"if (VAR_3 == 30 || VAR_3 == 31 || VAR_3 >= 58) {",
"tcg_gen_st_f32(cpu_F0s, cpu_env,\nneon_reg_offset(VAR_5, VAR_10));",
"} else {",
"neon_store_reg(VAR_5, VAR_10, tmp);",
"}",
"}",
"break;",
"}",
"} else if ((VAR_2 & (1 << 10)) == 0) {",
"VAR_14 = ((VAR_2 >> 5) & 0x18) + 8;",
"if (VAR_2 & (1 << 6)) {",
"tmp = neon_load_reg(VAR_5, 0);",
"} else {",
"tmp = new_tmp();",
"tcg_gen_movi_i32(tmp, 0);",
"}",
"tmp2 = neon_load_reg(VAR_7, 0);",
"tmp4 = tcg_const_i32(VAR_6);",
"tmp5 = tcg_const_i32(VAR_14);",
"gen_helper_neon_tbl(tmp2, tmp2, tmp, tmp4, tmp5);",
"dead_tmp(tmp);",
"if (VAR_2 & (1 << 6)) {",
"tmp = neon_load_reg(VAR_5, 1);",
"} else {",
"tmp = new_tmp();",
"tcg_gen_movi_i32(tmp, 0);",
"}",
"tmp3 = neon_load_reg(VAR_7, 1);",
"gen_helper_neon_tbl(tmp3, tmp3, tmp, tmp4, tmp5);",
"tcg_temp_free_i32(tmp5);",
"tcg_temp_free_i32(tmp4);",
"neon_store_reg(VAR_5, 0, tmp2);",
"neon_store_reg(VAR_5, 1, tmp3);",
"dead_tmp(tmp);",
"} else if ((VAR_2 & 0x380) == 0) {",
"if (VAR_2 & (1 << 19)) {",
"tmp = neon_load_reg(VAR_7, 1);",
"} else {",
"tmp = neon_load_reg(VAR_7, 0);",
"}",
"if (VAR_2 & (1 << 16)) {",
"gen_neon_dup_u8(tmp, ((VAR_2 >> 17) & 3) * 8);",
"} else if (VAR_2 & (1 << 17)) {",
"if ((VAR_2 >> 18) & 1)\ngen_neon_dup_high16(tmp);",
"else\ngen_neon_dup_low16(tmp);",
"}",
"for (VAR_10 = 0; VAR_10 < (VAR_4 ? 4 : 2); VAR_10++) {",
"tmp2 = new_tmp();",
"tcg_gen_mov_i32(tmp2, tmp);",
"neon_store_reg(VAR_5, VAR_10, tmp2);",
"}",
"dead_tmp(tmp);",
"} else {",
"return 1;",
"}",
"}",
"}",
"return 0;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
1,
0,
0,
0,
1,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
33,
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
53
],
[
55,
57
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69,
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83,
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97,
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111,
113
],
[
115,
117
],
[
119
],
[
121,
123
],
[
125
],
[
127
],
[
129,
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143,
145
],
[
147,
149
],
[
151
],
[
153,
155
],
[
157
],
[
159
],
[
161,
163
],
[
165
],
[
167
],
[
169
],
[
171
],
[
173
],
[
175,
177
],
[
179
],
[
181
],
[
183
],
[
185
],
[
187
],
[
189
],
[
191,
193,
195,
197,
199
],
[
201
],
[
205
],
[
207
],
[
209
],
[
211
],
[
213
],
[
215
],
[
217,
219,
221,
223
],
[
225
],
[
227,
229
],
[
231
],
[
233,
235
],
[
237
],
[
239,
241
],
[
243
],
[
245
],
[
249
],
[
253
],
[
257,
259
],
[
261,
263
],
[
265
],
[
267
],
[
269
],
[
271
],
[
273
],
[
275
],
[
277
],
[
279
],
[
283
],
[
285
],
[
287
],
[
289
],
[
291,
293
],
[
295
],
[
297,
299
],
[
301
],
[
303,
305
],
[
307
],
[
309,
311
],
[
313,
315
],
[
317
],
[
319,
321
],
[
323
],
[
325,
327
],
[
329
],
[
331,
333
],
[
335
],
[
337,
339
],
[
341
],
[
343,
345
],
[
347
],
[
349
],
[
351
],
[
353,
355
],
[
357
],
[
359
],
[
361
],
[
363,
365
],
[
367
],
[
369
],
[
371
],
[
373
],
[
375
],
[
377,
379
],
[
381
],
[
383,
385
],
[
387
],
[
389,
391
],
[
393
],
[
395,
397
],
[
399
],
[
401,
403
],
[
405
],
[
407,
409
],
[
411
],
[
413,
415
],
[
417
],
[
419,
421
],
[
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
],
[
721,
723
],
[
725
],
[
727,
729,
731
],
[
733,
735
],
[
737
],
[
739,
741,
743
],
[
745,
747
],
[
749
],
[
751,
753
],
[
755
],
[
757
],
[
767
],
[
769
],
[
771
],
[
773
],
[
775
],
[
779
],
[
781
],
[
783
],
[
785
],
[
787
],
[
789
],
[
791
],
[
795
],
[
797
],
[
801
],
[
803
],
[
807
],
[
809
],
[
811
],
[
813,
815
],
[
817
],
[
819
],
[
825
],
[
835,
837
],
[
839
],
[
841
],
[
843
],
[
845
],
[
847
],
[
849
],
[
851,
853
],
[
855
],
[
857
],
[
859
],
[
861,
863
],
[
865
],
[
867
],
[
869,
871,
873
],
[
875
],
[
877,
879
],
[
881
],
[
885
],
[
887
],
[
889
],
[
891
],
[
893
],
[
895,
897,
899,
901
],
[
903,
905
],
[
907
],
[
909,
911,
913,
915
],
[
917,
919
],
[
921
],
[
923,
925,
927
],
[
929
],
[
931
],
[
933,
935
],
[
937
],
[
939,
941
],
[
943,
945
],
[
947
],
[
949
],
[
951
],
[
953
],
[
955,
957
],
[
959,
961
],
[
963
],
[
965,
967
],
[
969
],
[
971
],
[
973
],
[
975
],
[
979
],
[
981
],
[
983
],
[
987
],
[
989
],
[
991
],
[
993
],
[
997
],
[
999
],
[
1001
],
[
1003
],
[
1005,
1007,
1009
],
[
1011
],
[
1013,
1015,
1017
],
[
1019
],
[
1021,
1023,
1025
],
[
1027
],
[
1029
],
[
1031,
1033
],
[
1035
],
[
1037
],
[
1039
],
[
1041
],
[
1043
],
[
1045
],
[
1047,
1049
],
[
1051
],
[
1053
],
[
1055
],
[
1057,
1059,
1061
],
[
1063
],
[
1065,
1067,
1069
],
[
1071
],
[
1073,
1075,
1077
],
[
1079
],
[
1081,
1083
],
[
1085
],
[
1087
],
[
1089,
1091
],
[
1093
],
[
1095
],
[
1097
],
[
1101
],
[
1105
],
[
1107
],
[
1109
],
[
1111
],
[
1115
],
[
1117,
1119,
1121
],
[
1123,
1125
],
[
1127
],
[
1129
],
[
1131
],
[
1133,
1135,
1137
],
[
1139,
1141
],
[
1143
],
[
1145
],
[
1147,
1149
],
[
1151
],
[
1153
],
[
1155,
1157
],
[
1159,
1161
],
[
1163
],
[
1165
],
[
1167,
1169
],
[
1171
],
[
1173
],
[
1175
],
[
1177
],
[
1179
],
[
1181
],
[
1183
],
[
1185
],
[
1187
],
[
1189
],
[
1191
],
[
1197
],
[
1199
],
[
1201
],
[
1203,
1205
],
[
1207
],
[
1209
],
[
1211
],
[
1213
],
[
1215,
1217
],
[
1219
],
[
1221
],
[
1223
],
[
1225,
1227
],
[
1229
],
[
1231
],
[
1233,
1235
],
[
1237
],
[
1241
],
[
1243
],
[
1245
],
[
1247
],
[
1249,
1251
],
[
1253,
1255
],
[
1257
],
[
1259,
1261
],
[
1263,
1265
],
[
1267
],
[
1269
],
[
1271
],
[
1273
],
[
1275
],
[
1277
],
[
1279
],
[
1281
],
[
1283
],
[
1285
],
[
1287
],
[
1289
],
[
1291
],
[
1293
],
[
1295,
1297
],
[
1299,
1301
],
[
1303
],
[
1305
],
[
1307
],
[
1309
],
[
1311
],
[
1313
],
[
1315
],
[
1317
],
[
1319
],
[
1323,
1325
],
[
1327
],
[
1329
],
[
1331
],
[
1333,
1335
],
[
1339
],
[
1343
],
[
1349
],
[
1351
],
[
1353
],
[
1355
],
[
1357
],
[
1359
],
[
1361
],
[
1363
],
[
1365
],
[
1367
],
[
1369
],
[
1371
],
[
1373
],
[
1375
],
[
1377
],
[
1379
],
[
1389
],
[
1391
],
[
1393
],
[
1395
],
[
1397,
1399
],
[
1401,
1403
],
[
1405
],
[
1407,
1409
],
[
1411,
1413
],
[
1415
],
[
1417
],
[
1419
],
[
1421
],
[
1423
],
[
1425
],
[
1427
],
[
1429
],
[
1433
],
[
1437
],
[
1439
],
[
1441
],
[
1443,
1447
],
[
1449,
1451
],
[
1453
],
[
1455,
1457
],
[
1459
],
[
1461,
1463
],
[
1465
],
[
1467,
1469
],
[
1471
],
[
1473,
1475
],
[
1477
],
[
1479,
1481
],
[
1483
],
[
1485,
1487
],
[
1489
],
[
1491,
1493
],
[
1495,
1497
],
[
1499
],
[
1501,
1503,
1505
],
[
1507
],
[
1509
],
[
1511,
1513
],
[
1517
],
[
1519
],
[
1521
],
[
1523
],
[
1529
],
[
1531
],
[
1533
],
[
1535
],
[
1537
],
[
1541
],
[
1543
],
[
1545
],
[
1547
],
[
1549
],
[
1551,
1553
],
[
1555
],
[
1557
],
[
1559
],
[
1561
],
[
1563
],
[
1565
],
[
1567
],
[
1569
],
[
1571
],
[
1573
],
[
1575
],
[
1577
],
[
1579
],
[
1583
],
[
1585
],
[
1587
],
[
1591
],
[
1593
],
[
1595
],
[
1597
],
[
1599
],
[
1601
],
[
1603
],
[
1605
],
[
1607
],
[
1609
],
[
1611
],
[
1613
],
[
1615
],
[
1617
],
[
1619
],
[
1621
],
[
1623
],
[
1627
],
[
1629
],
[
1631
],
[
1635,
1637
],
[
1647
],
[
1649
],
[
1651
],
[
1653
],
[
1655
],
[
1657
],
[
1659
],
[
1661
],
[
1663
],
[
1665
],
[
1667
],
[
1669
],
[
1671
],
[
1673
],
[
1675
],
[
1677
],
[
1679
],
[
1681
],
[
1683
],
[
1685
],
[
1687
],
[
1689
],
[
1691
],
[
1693
],
[
1695
],
[
1697
],
[
1699
],
[
1701
],
[
1703
],
[
1705
],
[
1707
],
[
1709
],
[
1711
],
[
1713
],
[
1715
],
[
1717
],
[
1719,
1721
],
[
1723
],
[
1725,
1727
],
[
1729
],
[
1731,
1733
],
[
1735,
1737
],
[
1739
],
[
1741,
1743
],
[
1745
],
[
1747,
1749
],
[
1751
],
[
1753,
1755
],
[
1757
],
[
1759,
1761
],
[
1763
],
[
1765,
1767
],
[
1769
],
[
1771
],
[
1773
],
[
1775
],
[
1777
],
[
1779
],
[
1781,
1785
],
[
1787
],
[
1789,
1791
],
[
1795,
1797
],
[
1799
],
[
1801
],
[
1805
],
[
1807
],
[
1809
],
[
1813
],
[
1815
],
[
1817
],
[
1821
],
[
1823,
1825
],
[
1827
],
[
1829,
1831
],
[
1833
],
[
1835
],
[
1839,
1841
],
[
1843
],
[
1845,
1847
],
[
1849
],
[
1851
],
[
1853
],
[
1857
],
[
1859
],
[
1861
],
[
1863,
1865
],
[
1867
],
[
1869,
1871
],
[
1873
],
[
1875,
1877
],
[
1879
],
[
1881
],
[
1883
],
[
1885
],
[
1887
],
[
1889
],
[
1891,
1893
],
[
1895
],
[
1897,
1899
],
[
1901
],
[
1903,
1905
],
[
1907
],
[
1909
],
[
1911
],
[
1913
],
[
1915
],
[
1917
],
[
1919
],
[
1921
],
[
1923
],
[
1925
],
[
1927
],
[
1929
],
[
1931
],
[
1935
],
[
1937
],
[
1939
],
[
1941
],
[
1945
],
[
1947,
1949,
1951,
1953,
1955,
1957,
1959,
1961,
1963
],
[
1965
],
[
1967
],
[
1969
],
[
1971
],
[
1973
],
[
1975
],
[
1977
],
[
1979
],
[
1981
],
[
1983
],
[
1985
],
[
1987
],
[
1989
],
[
1991
],
[
1993
],
[
1995
],
[
1997
],
[
1999
],
[
2001
],
[
2003
],
[
2005
],
[
2007
],
[
2009
],
[
2011
],
[
2013
],
[
2015
],
[
2017
],
[
2019
],
[
2023
],
[
2025
],
[
2027,
2029
],
[
2031
],
[
2033,
2035
],
[
2037
],
[
2039,
2041
],
[
2043
],
[
2045,
2047
],
[
2049
],
[
2051,
2053
],
[
2055
],
[
2057
],
[
2059
],
[
2061
],
[
2063
],
[
2065
],
[
2067,
2069,
2071,
2073,
2075,
2077,
2079,
2081
],
[
2085
],
[
2091
],
[
2093
],
[
2095
],
[
2099
],
[
2101
],
[
2103
],
[
2105
],
[
2107
],
[
2109
],
[
2111
],
[
2113
],
[
2115
],
[
2117
],
[
2119
],
[
2121
],
[
2123
],
[
2125
],
[
2127
],
[
2129,
2131
],
[
2133
],
[
2135,
2137
],
[
2139
],
[
2141
],
[
2143,
2147
],
[
2149,
2151
],
[
2153
],
[
2155,
2157
],
[
2159
],
[
2161
],
[
2163
],
[
2169
],
[
2171,
2173
],
[
2175
],
[
2177
],
[
2179
],
[
2181
],
[
2185
],
[
2189,
2191
],
[
2195
],
[
2197
],
[
2199
],
[
2201
],
[
2203
],
[
2205
],
[
2207
],
[
2209
],
[
2211
],
[
2213
],
[
2215
],
[
2217
],
[
2219
],
[
2221
],
[
2223
],
[
2225
],
[
2227
],
[
2229
],
[
2231
],
[
2233
],
[
2235
],
[
2237
],
[
2239
],
[
2241
],
[
2243
],
[
2245
],
[
2247
],
[
2249
],
[
2251
],
[
2253
],
[
2255
],
[
2257
],
[
2259
],
[
2263
],
[
2265
],
[
2267
],
[
2269
],
[
2271
],
[
2273
],
[
2275
],
[
2277
],
[
2279
],
[
2281
],
[
2283
],
[
2287
],
[
2289
],
[
2291
],
[
2293,
2295,
2297
],
[
2299
],
[
2301
],
[
2303
],
[
2305
],
[
2307
],
[
2309
],
[
2311
],
[
2313
],
[
2315
],
[
2317
],
[
2319
],
[
2321
],
[
2323
],
[
2325
],
[
2327
],
[
2329
],
[
2331
],
[
2333
],
[
2335
],
[
2337
],
[
2339
],
[
2341
],
[
2343,
2345,
2347,
2349
],
[
2351
],
[
2353
],
[
2355
],
[
2357
],
[
2359
],
[
2361
],
[
2363
],
[
2365
],
[
2367
],
[
2369
],
[
2371
],
[
2373
],
[
2377
],
[
2379
],
[
2381
],
[
2383
],
[
2385
],
[
2387
],
[
2389,
2391
],
[
2393
],
[
2395
],
[
2397
],
[
2399
],
[
2401
],
[
2403
],
[
2405
],
[
2407
],
[
2409
],
[
2411
],
[
2413,
2423,
2425
],
[
2427
],
[
2429
],
[
2431
],
[
2433,
2435
],
[
2437
],
[
2439
],
[
2441
],
[
2443
],
[
2445
],
[
2447
],
[
2449,
2451
],
[
2453
],
[
2455
],
[
2457
],
[
2459
],
[
2461
],
[
2463
],
[
2465
],
[
2467,
2477,
2479
],
[
2481
],
[
2483
],
[
2485
],
[
2487
],
[
2489
],
[
2491
],
[
2493
],
[
2495
],
[
2497
],
[
2499
],
[
2501
],
[
2503
],
[
2505
],
[
2507
],
[
2509
],
[
2511
],
[
2513
],
[
2515
],
[
2517
],
[
2519,
2521,
2523
],
[
2525
],
[
2527
],
[
2529
],
[
2531
],
[
2533
],
[
2535
],
[
2537
],
[
2539
],
[
2541
],
[
2543
],
[
2545
],
[
2547
],
[
2549
],
[
2551
],
[
2553
],
[
2555
],
[
2557
],
[
2559
],
[
2561
],
[
2563,
2565,
2567
],
[
2569
],
[
2571
],
[
2573
],
[
2575,
2577
],
[
2579
],
[
2581
],
[
2583
],
[
2585
],
[
2587
],
[
2589,
2591,
2593
],
[
2595
],
[
2597
],
[
2599
],
[
2601
],
[
2603
],
[
2605
],
[
2607
],
[
2609
],
[
2611
],
[
2613
],
[
2615
],
[
2617
],
[
2619
],
[
2621
],
[
2623
],
[
2625
],
[
2627
],
[
2629
],
[
2631
],
[
2633,
2635,
2637
],
[
2639
],
[
2641
],
[
2643
],
[
2645
],
[
2647
],
[
2649
],
[
2651
],
[
2653
],
[
2655
],
[
2657
],
[
2659
],
[
2661
],
[
2663
],
[
2665
],
[
2667
],
[
2669
],
[
2671
],
[
2673
],
[
2675
],
[
2677,
2679,
2681
],
[
2683
],
[
2685,
2687
],
[
2689
],
[
2691
],
[
2693
],
[
2695
],
[
2697
],
[
2699,
2701
],
[
2703
],
[
2705
],
[
2707
],
[
2709
],
[
2711
],
[
2713,
2715,
2717
],
[
2719
],
[
2721
],
[
2723,
2725
],
[
2727
],
[
2729
],
[
2731
],
[
2733
],
[
2735
],
[
2737
],
[
2739,
2741
],
[
2743
],
[
2745
],
[
2747
],
[
2749
],
[
2751
],
[
2753
],
[
2755,
2757,
2759
],
[
2761
],
[
2763
],
[
2765,
2767,
2769
],
[
2771
],
[
2773
],
[
2775,
2777
],
[
2779
],
[
2781
],
[
2783
],
[
2785
],
[
2787
],
[
2789
],
[
2791,
2793
],
[
2795
],
[
2797
],
[
2799
],
[
2801
],
[
2803
],
[
2805
],
[
2807,
2809
],
[
2811
],
[
2813
],
[
2815
],
[
2817
],
[
2819
],
[
2821
],
[
2823
],
[
2825,
2827
],
[
2829
],
[
2831,
2833
],
[
2835
],
[
2837
],
[
2839
],
[
2841
],
[
2843
],
[
2845
],
[
2847
],
[
2849,
2851
],
[
2853
],
[
2855,
2857
],
[
2859
],
[
2861
],
[
2863
],
[
2865
],
[
2867
],
[
2869
],
[
2871
],
[
2873
],
[
2875,
2877
],
[
2879
],
[
2881
],
[
2883
],
[
2885
],
[
2887
],
[
2889
],
[
2891,
2893,
2895
],
[
2897
],
[
2899
],
[
2901
],
[
2903
],
[
2905,
2907
],
[
2909
],
[
2911
],
[
2913,
2915
],
[
2917
],
[
2919,
2921
],
[
2923
],
[
2925
],
[
2927,
2929
],
[
2931
],
[
2933,
2935
],
[
2937
],
[
2939
],
[
2941
],
[
2943,
2945
],
[
2947
],
[
2949,
2951
],
[
2953
],
[
2955,
2957
],
[
2959
],
[
2961
],
[
2963,
2965
],
[
2967
],
[
2969
],
[
2971
],
[
2973
],
[
2975
],
[
2977
],
[
2979
],
[
2981
],
[
2983,
2985
],
[
2987
],
[
2989,
2991
],
[
2993
],
[
2995,
2997
],
[
2999
],
[
3001,
3003
],
[
3005
],
[
3007,
3009
],
[
3011
],
[
3013,
3015
],
[
3017
],
[
3019,
3021
],
[
3023
],
[
3025,
3027
],
[
3029
],
[
3031,
3035
],
[
3037
],
[
3039
],
[
3041,
3043
],
[
3045
],
[
3047
],
[
3049
],
[
3051
],
[
3053
],
[
3055
],
[
3057
],
[
3061
],
[
3063
],
[
3065
],
[
3067
],
[
3069
],
[
3071
],
[
3073
],
[
3075
],
[
3077
],
[
3079
],
[
3081
],
[
3083
],
[
3085
],
[
3087
],
[
3089
],
[
3091
],
[
3093
],
[
3095
],
[
3097
],
[
3099
],
[
3101
],
[
3103
],
[
3105
],
[
3107
],
[
3109
],
[
3111
],
[
3115
],
[
3117
],
[
3119
],
[
3121
],
[
3123
],
[
3125
],
[
3127
],
[
3129
],
[
3131,
3133
],
[
3135,
3137
],
[
3139
],
[
3141
],
[
3143
],
[
3145
],
[
3147
],
[
3149
],
[
3151
],
[
3153
],
[
3155
],
[
3157
],
[
3159
],
[
3161
],
[
3163
],
[
3165
]
] |
19,735 | static av_cold int pcx_end(AVCodecContext *avctx) {
PCXContext *s = avctx->priv_data;
if(s->picture.data[0])
avctx->release_buffer(avctx, &s->picture);
return 0;
}
| true | FFmpeg | 8cd1c0febe88b757e915e9af15559575c21ca728 | static av_cold int pcx_end(AVCodecContext *avctx) {
PCXContext *s = avctx->priv_data;
if(s->picture.data[0])
avctx->release_buffer(avctx, &s->picture);
return 0;
}
| {
"code": [
"static av_cold int pcx_end(AVCodecContext *avctx) {"
],
"line_no": [
1
]
} | static av_cold int FUNC_0(AVCodecContext *avctx) {
PCXContext *s = avctx->priv_data;
if(s->picture.data[0])
avctx->release_buffer(avctx, &s->picture);
return 0;
}
| [
"static av_cold int FUNC_0(AVCodecContext *avctx) {",
"PCXContext *s = avctx->priv_data;",
"if(s->picture.data[0])\navctx->release_buffer(avctx, &s->picture);",
"return 0;",
"}"
] | [
1,
0,
0,
0,
0
] | [
[
1
],
[
3
],
[
7,
9
],
[
13
],
[
15
]
] |
19,736 | static void gen_dccci(DisasContext *ctx)
{
#if defined(CONFIG_USER_ONLY)
gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);
#else
if (unlikely(ctx->pr)) {
gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);
return;
}
/* interpreted as no-op */
#endif
}
| true | qemu | 9b2fadda3e0196ffd485adde4fe9cdd6fae35300 | static void gen_dccci(DisasContext *ctx)
{
#if defined(CONFIG_USER_ONLY)
gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);
#else
if (unlikely(ctx->pr)) {
gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);
return;
}
#endif
}
| {
"code": [
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#if defined(CONFIG_USER_ONLY)",
"#else",
" if (unlikely(ctx->pr)) {",
"#endif",
"#if defined(CONFIG_USER_ONLY)",
"#else",
" if (unlikely(ctx->pr)) {",
"#endif",
"#endif",
"#if defined(CONFIG_USER_ONLY)",
"#else",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" if (unlikely(ctx->pr)) {",
"#endif",
" if (unlikely(ctx->pr)) {",
"#endif",
" if (unlikely(ctx->pr)) {",
"#endif",
" if (unlikely(ctx->pr)) {",
"#endif",
" if (unlikely(ctx->pr)) {",
"#endif",
" if (unlikely(ctx->pr)) {",
"#endif",
" if (unlikely(ctx->pr)) {",
"#endif",
" if (unlikely(ctx->pr)) {",
"#endif",
" if (unlikely(ctx->pr)) {",
"#endif",
" if (unlikely(ctx->pr)) {",
"#endif",
" if (unlikely(ctx->pr)) {",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" if (unlikely(ctx->pr)) {",
"#endif",
" if (unlikely(ctx->pr)) {",
"#endif",
" if (unlikely(ctx->pr)) {",
"#endif",
" if (unlikely(ctx->pr)) {",
"#endif",
"#if defined(CONFIG_USER_ONLY)",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#else",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
"#if defined(CONFIG_USER_ONLY)",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#else",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
"#if defined(CONFIG_USER_ONLY)",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#else",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
"#if defined(CONFIG_USER_ONLY)",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif"
],
"line_no": [
13,
7,
11,
13,
7,
11,
13,
7,
13,
5,
9,
11,
21,
5,
9,
11,
21,
21,
5,
9,
11,
7,
11,
13,
21,
11,
21,
11,
21,
11,
21,
11,
21,
11,
21,
11,
21,
11,
21,
11,
21,
11,
21,
11,
21,
11,
21,
7,
13,
21,
7,
11,
13,
21,
7,
13,
21,
7,
13,
21,
7,
11,
13,
21,
7,
11,
13,
21,
21,
7,
11,
13,
21,
7,
11,
13,
21,
7,
11,
13,
21,
7,
11,
13,
21,
7,
11,
13,
21,
7,
11,
13,
21,
7,
11,
13,
21,
7,
11,
13,
21,
7,
11,
13,
21,
7,
11,
13,
21,
11,
21,
11,
21,
11,
21,
11,
21,
5,
7,
9,
11,
13,
21,
7,
11,
13,
21,
5,
7,
9,
11,
13,
21,
5,
7,
9,
11,
13,
21,
7,
11,
13,
21,
7,
11,
13,
21,
7,
11,
13,
21,
7,
11,
13,
21,
7,
11,
13,
21,
7,
11,
13,
21,
7,
11,
13,
21,
7,
11,
13,
21,
7,
11,
13,
21,
7,
11,
13,
21,
5,
7,
11,
13,
21,
7,
11,
13,
21,
7,
11,
13,
21,
7,
11,
13,
21,
7,
11,
13,
21,
7,
11,
13,
21,
7,
11,
13,
21,
7,
11,
13,
21,
7,
11,
13,
21
]
} | static void FUNC_0(DisasContext *VAR_0)
{
#if defined(CONFIG_USER_ONLY)
gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC);
#else
if (unlikely(VAR_0->pr)) {
gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC);
return;
}
#endif
}
| [
"static void FUNC_0(DisasContext *VAR_0)\n{",
"#if defined(CONFIG_USER_ONLY)\ngen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC);",
"#else\nif (unlikely(VAR_0->pr)) {",
"gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC);",
"return;",
"}",
"#endif\n}"
] | [
0,
1,
1,
1,
0,
0,
1
] | [
[
1,
3
],
[
5,
7
],
[
9,
11
],
[
13
],
[
15
],
[
17
],
[
21,
23
]
] |
19,737 | static void vmsvga_init(struct vmsvga_state_s *s,
MemoryRegion *address_space, MemoryRegion *io)
{
DisplaySurface *surface;
s->scratch_size = SVGA_SCRATCH_SIZE;
s->scratch = g_malloc(s->scratch_size * 4);
s->vga.con = graphic_console_init(vmsvga_update_display,
vmsvga_invalidate_display,
vmsvga_screen_dump,
vmsvga_text_update, s);
surface = qemu_console_surface(s->vga.con);
s->fifo_size = SVGA_FIFO_SIZE;
memory_region_init_ram(&s->fifo_ram, "vmsvga.fifo", s->fifo_size);
vmstate_register_ram_global(&s->fifo_ram);
s->fifo_ptr = memory_region_get_ram_ptr(&s->fifo_ram);
vga_common_init(&s->vga);
vga_init(&s->vga, address_space, io, true);
vmstate_register(NULL, 0, &vmstate_vga_common, &s->vga);
/* Save some values here in case they are changed later.
* This is suspicious and needs more though why it is needed. */
s->depth = surface_bits_per_pixel(surface);
s->bypp = surface_bytes_per_pixel(surface);
}
| true | qemu | eb2f9b024d68884a3b25e63e4dbf90b67f8da236 | static void vmsvga_init(struct vmsvga_state_s *s,
MemoryRegion *address_space, MemoryRegion *io)
{
DisplaySurface *surface;
s->scratch_size = SVGA_SCRATCH_SIZE;
s->scratch = g_malloc(s->scratch_size * 4);
s->vga.con = graphic_console_init(vmsvga_update_display,
vmsvga_invalidate_display,
vmsvga_screen_dump,
vmsvga_text_update, s);
surface = qemu_console_surface(s->vga.con);
s->fifo_size = SVGA_FIFO_SIZE;
memory_region_init_ram(&s->fifo_ram, "vmsvga.fifo", s->fifo_size);
vmstate_register_ram_global(&s->fifo_ram);
s->fifo_ptr = memory_region_get_ram_ptr(&s->fifo_ram);
vga_common_init(&s->vga);
vga_init(&s->vga, address_space, io, true);
vmstate_register(NULL, 0, &vmstate_vga_common, &s->vga);
s->depth = surface_bits_per_pixel(surface);
s->bypp = surface_bytes_per_pixel(surface);
}
| {
"code": [
" DisplaySurface *surface;",
" surface = qemu_console_surface(s->vga.con);",
" s->depth = surface_bits_per_pixel(surface);",
" s->bypp = surface_bytes_per_pixel(surface);"
],
"line_no": [
7,
25,
49,
51
]
} | static void FUNC_0(struct vmsvga_state_s *VAR_0,
MemoryRegion *VAR_1, MemoryRegion *VAR_2)
{
DisplaySurface *surface;
VAR_0->scratch_size = SVGA_SCRATCH_SIZE;
VAR_0->scratch = g_malloc(VAR_0->scratch_size * 4);
VAR_0->vga.con = graphic_console_init(vmsvga_update_display,
vmsvga_invalidate_display,
vmsvga_screen_dump,
vmsvga_text_update, VAR_0);
surface = qemu_console_surface(VAR_0->vga.con);
VAR_0->fifo_size = SVGA_FIFO_SIZE;
memory_region_init_ram(&VAR_0->fifo_ram, "vmsvga.fifo", VAR_0->fifo_size);
vmstate_register_ram_global(&VAR_0->fifo_ram);
VAR_0->fifo_ptr = memory_region_get_ram_ptr(&VAR_0->fifo_ram);
vga_common_init(&VAR_0->vga);
vga_init(&VAR_0->vga, VAR_1, VAR_2, true);
vmstate_register(NULL, 0, &vmstate_vga_common, &VAR_0->vga);
VAR_0->depth = surface_bits_per_pixel(surface);
VAR_0->bypp = surface_bytes_per_pixel(surface);
}
| [
"static void FUNC_0(struct vmsvga_state_s *VAR_0,\nMemoryRegion *VAR_1, MemoryRegion *VAR_2)\n{",
"DisplaySurface *surface;",
"VAR_0->scratch_size = SVGA_SCRATCH_SIZE;",
"VAR_0->scratch = g_malloc(VAR_0->scratch_size * 4);",
"VAR_0->vga.con = graphic_console_init(vmsvga_update_display,\nvmsvga_invalidate_display,\nvmsvga_screen_dump,\nvmsvga_text_update, VAR_0);",
"surface = qemu_console_surface(VAR_0->vga.con);",
"VAR_0->fifo_size = SVGA_FIFO_SIZE;",
"memory_region_init_ram(&VAR_0->fifo_ram, \"vmsvga.fifo\", VAR_0->fifo_size);",
"vmstate_register_ram_global(&VAR_0->fifo_ram);",
"VAR_0->fifo_ptr = memory_region_get_ram_ptr(&VAR_0->fifo_ram);",
"vga_common_init(&VAR_0->vga);",
"vga_init(&VAR_0->vga, VAR_1, VAR_2, true);",
"vmstate_register(NULL, 0, &vmstate_vga_common, &VAR_0->vga);",
"VAR_0->depth = surface_bits_per_pixel(surface);",
"VAR_0->bypp = surface_bytes_per_pixel(surface);",
"}"
] | [
0,
1,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
1,
1,
0
] | [
[
1,
3,
5
],
[
7
],
[
11
],
[
13
],
[
17,
19,
21,
23
],
[
25
],
[
29
],
[
31
],
[
33
],
[
35
],
[
39
],
[
41
],
[
43
],
[
49
],
[
51
],
[
53
]
] |
19,738 | static void init_frame_decoder(APEContext *ctx)
{
int i;
init_entropy_decoder(ctx);
init_predictor_decoder(ctx);
for (i = 0; i < APE_FILTER_LEVELS; i++) {
if (!ape_filter_orders[ctx->fset][i])
break;
init_filter(ctx, ctx->filters[i], ctx->filterbuf[i],
ape_filter_orders[ctx->fset][i]);
}
}
| true | FFmpeg | a4c32c9a63142b602820800742f2d543b58cd278 | static void init_frame_decoder(APEContext *ctx)
{
int i;
init_entropy_decoder(ctx);
init_predictor_decoder(ctx);
for (i = 0; i < APE_FILTER_LEVELS; i++) {
if (!ape_filter_orders[ctx->fset][i])
break;
init_filter(ctx, ctx->filters[i], ctx->filterbuf[i],
ape_filter_orders[ctx->fset][i]);
}
}
| {
"code": [
"static void init_frame_decoder(APEContext *ctx)",
" int i;",
" init_entropy_decoder(ctx);"
],
"line_no": [
1,
5,
7
]
} | static void FUNC_0(APEContext *VAR_0)
{
int VAR_1;
init_entropy_decoder(VAR_0);
init_predictor_decoder(VAR_0);
for (VAR_1 = 0; VAR_1 < APE_FILTER_LEVELS; VAR_1++) {
if (!ape_filter_orders[VAR_0->fset][VAR_1])
break;
init_filter(VAR_0, VAR_0->filters[VAR_1], VAR_0->filterbuf[VAR_1],
ape_filter_orders[VAR_0->fset][VAR_1]);
}
}
| [
"static void FUNC_0(APEContext *VAR_0)\n{",
"int VAR_1;",
"init_entropy_decoder(VAR_0);",
"init_predictor_decoder(VAR_0);",
"for (VAR_1 = 0; VAR_1 < APE_FILTER_LEVELS; VAR_1++) {",
"if (!ape_filter_orders[VAR_0->fset][VAR_1])\nbreak;",
"init_filter(VAR_0, VAR_0->filters[VAR_1], VAR_0->filterbuf[VAR_1],\nape_filter_orders[VAR_0->fset][VAR_1]);",
"}",
"}"
] | [
1,
1,
1,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15,
17
],
[
19,
21
],
[
23
],
[
25
]
] |
19,739 | static ssize_t local_readlink(FsContext *fs_ctx, const char *path,
char *buf, size_t bufsz)
{
ssize_t tsize = -1;
if (fs_ctx->fs_sm == SM_MAPPED) {
int fd;
fd = open(rpath(fs_ctx, path), O_RDONLY);
if (fd == -1) {
return -1;
}
do {
tsize = read(fd, (void *)buf, bufsz);
} while (tsize == -1 && errno == EINTR);
close(fd);
return tsize;
} else if (fs_ctx->fs_sm == SM_PASSTHROUGH) {
tsize = readlink(rpath(fs_ctx, path), buf, bufsz);
}
return tsize;
}
| true | qemu | 12848bfc5d719bad536c5448205a3226be1fda47 | static ssize_t local_readlink(FsContext *fs_ctx, const char *path,
char *buf, size_t bufsz)
{
ssize_t tsize = -1;
if (fs_ctx->fs_sm == SM_MAPPED) {
int fd;
fd = open(rpath(fs_ctx, path), O_RDONLY);
if (fd == -1) {
return -1;
}
do {
tsize = read(fd, (void *)buf, bufsz);
} while (tsize == -1 && errno == EINTR);
close(fd);
return tsize;
} else if (fs_ctx->fs_sm == SM_PASSTHROUGH) {
tsize = readlink(rpath(fs_ctx, path), buf, bufsz);
}
return tsize;
}
| {
"code": [
" } else if (fs_ctx->fs_sm == SM_PASSTHROUGH) {",
" } else if (fs_ctx->fs_sm == SM_PASSTHROUGH) {",
" } else if (fs_ctx->fs_sm == SM_PASSTHROUGH) {",
" } else if (fs_ctx->fs_sm == SM_PASSTHROUGH) {",
" } else if (fs_ctx->fs_sm == SM_PASSTHROUGH) {",
" } else if (fs_ctx->fs_sm == SM_PASSTHROUGH) {",
" } else if (fs_ctx->fs_sm == SM_PASSTHROUGH) {"
],
"line_no": [
31,
31,
31,
31,
31,
31,
31
]
} | static ssize_t FUNC_0(FsContext *fs_ctx, const char *path,
char *buf, size_t bufsz)
{
ssize_t tsize = -1;
if (fs_ctx->fs_sm == SM_MAPPED) {
int VAR_0;
VAR_0 = open(rpath(fs_ctx, path), O_RDONLY);
if (VAR_0 == -1) {
return -1;
}
do {
tsize = read(VAR_0, (void *)buf, bufsz);
} while (tsize == -1 && errno == EINTR);
close(VAR_0);
return tsize;
} else if (fs_ctx->fs_sm == SM_PASSTHROUGH) {
tsize = readlink(rpath(fs_ctx, path), buf, bufsz);
}
return tsize;
}
| [
"static ssize_t FUNC_0(FsContext *fs_ctx, const char *path,\nchar *buf, size_t bufsz)\n{",
"ssize_t tsize = -1;",
"if (fs_ctx->fs_sm == SM_MAPPED) {",
"int VAR_0;",
"VAR_0 = open(rpath(fs_ctx, path), O_RDONLY);",
"if (VAR_0 == -1) {",
"return -1;",
"}",
"do {",
"tsize = read(VAR_0, (void *)buf, bufsz);",
"} while (tsize == -1 && errno == EINTR);",
"close(VAR_0);",
"return tsize;",
"} else if (fs_ctx->fs_sm == SM_PASSTHROUGH) {",
"tsize = readlink(rpath(fs_ctx, path), buf, bufsz);",
"}",
"return tsize;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0
] | [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
]
] |
19,740 | static int dump_cleanup(DumpState *s)
{
int ret = 0;
guest_phys_blocks_free(&s->guest_phys_blocks);
memory_mapping_list_free(&s->list);
if (s->fd != -1) {
close(s->fd);
}
if (s->resume) {
vm_start();
}
return ret;
}
| true | qemu | 2928207ac1bb2751a1554ea0f9a9641179f51488 | static int dump_cleanup(DumpState *s)
{
int ret = 0;
guest_phys_blocks_free(&s->guest_phys_blocks);
memory_mapping_list_free(&s->list);
if (s->fd != -1) {
close(s->fd);
}
if (s->resume) {
vm_start();
}
return ret;
}
| {
"code": [
" int ret = 0;",
" if (s->fd != -1) {",
" close(s->fd);",
" return ret;",
" guest_phys_blocks_free(&s->guest_phys_blocks);",
" if (s->resume) {",
" vm_start();"
],
"line_no": [
5,
13,
15,
27,
9,
19,
21
]
} | static int FUNC_0(DumpState *VAR_0)
{
int VAR_1 = 0;
guest_phys_blocks_free(&VAR_0->guest_phys_blocks);
memory_mapping_list_free(&VAR_0->list);
if (VAR_0->fd != -1) {
close(VAR_0->fd);
}
if (VAR_0->resume) {
vm_start();
}
return VAR_1;
}
| [
"static int FUNC_0(DumpState *VAR_0)\n{",
"int VAR_1 = 0;",
"guest_phys_blocks_free(&VAR_0->guest_phys_blocks);",
"memory_mapping_list_free(&VAR_0->list);",
"if (VAR_0->fd != -1) {",
"close(VAR_0->fd);",
"}",
"if (VAR_0->resume) {",
"vm_start();",
"}",
"return VAR_1;",
"}"
] | [
0,
1,
1,
0,
1,
1,
0,
1,
1,
0,
1,
0
] | [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
27
],
[
29
]
] |
19,741 | static int svq1_decode_block_intra(GetBitContext *bitbuf, uint8_t *pixels,
ptrdiff_t pitch)
{
uint32_t bit_cache;
uint8_t *list[63];
uint32_t *dst;
const uint32_t *codebook;
int entries[6];
int i, j, m, n;
int stages;
unsigned mean;
unsigned x, y, width, height, level;
uint32_t n1, n2, n3, n4;
/* initialize list for breadth first processing of vectors */
list[0] = pixels;
/* recursively process vector */
for (i = 0, m = 1, n = 1, level = 5; i < n; i++) {
SVQ1_PROCESS_VECTOR();
/* destination address and vector size */
dst = (uint32_t *)list[i];
width = 1 << ((4 + level) / 2);
height = 1 << ((3 + level) / 2);
/* get number of stages (-1 skips vector, 0 for mean only) */
stages = get_vlc2(bitbuf, svq1_intra_multistage[level].table, 3, 3) - 1;
if (stages == -1) {
for (y = 0; y < height; y++)
memset(&dst[y * (pitch / 4)], 0, width);
continue; /* skip vector */
}
if ((stages > 0 && level >= 4)) {
ff_dlog(NULL,
"Error (svq1_decode_block_intra): invalid vector: stages=%i level=%i\n",
stages, level);
return AVERROR_INVALIDDATA; /* invalid vector */
}
av_assert0(stages >= 0);
mean = get_vlc2(bitbuf, svq1_intra_mean.table, 8, 3);
if (stages == 0) {
for (y = 0; y < height; y++)
memset(&dst[y * (pitch / 4)], mean, width);
} else {
SVQ1_CALC_CODEBOOK_ENTRIES(ff_svq1_intra_codebooks);
for (y = 0; y < height; y++) {
for (x = 0; x < width / 4; x++, codebook++) {
n1 = n4;
n2 = n4;
SVQ1_ADD_CODEBOOK()
/* store result */
dst[x] = n1 << 8 | n2;
}
dst += pitch / 4;
}
}
}
return 0;
}
| true | FFmpeg | aed84ee4d1b0c9e315a84b1ee0918fa49ee9cc09 | static int svq1_decode_block_intra(GetBitContext *bitbuf, uint8_t *pixels,
ptrdiff_t pitch)
{
uint32_t bit_cache;
uint8_t *list[63];
uint32_t *dst;
const uint32_t *codebook;
int entries[6];
int i, j, m, n;
int stages;
unsigned mean;
unsigned x, y, width, height, level;
uint32_t n1, n2, n3, n4;
list[0] = pixels;
for (i = 0, m = 1, n = 1, level = 5; i < n; i++) {
SVQ1_PROCESS_VECTOR();
dst = (uint32_t *)list[i];
width = 1 << ((4 + level) / 2);
height = 1 << ((3 + level) / 2);
stages = get_vlc2(bitbuf, svq1_intra_multistage[level].table, 3, 3) - 1;
if (stages == -1) {
for (y = 0; y < height; y++)
memset(&dst[y * (pitch / 4)], 0, width);
continue;
}
if ((stages > 0 && level >= 4)) {
ff_dlog(NULL,
"Error (svq1_decode_block_intra): invalid vector: stages=%i level=%i\n",
stages, level);
return AVERROR_INVALIDDATA;
}
av_assert0(stages >= 0);
mean = get_vlc2(bitbuf, svq1_intra_mean.table, 8, 3);
if (stages == 0) {
for (y = 0; y < height; y++)
memset(&dst[y * (pitch / 4)], mean, width);
} else {
SVQ1_CALC_CODEBOOK_ENTRIES(ff_svq1_intra_codebooks);
for (y = 0; y < height; y++) {
for (x = 0; x < width / 4; x++, codebook++) {
n1 = n4;
n2 = n4;
SVQ1_ADD_CODEBOOK()
dst[x] = n1 << 8 | n2;
}
dst += pitch / 4;
}
}
}
return 0;
}
| {
"code": [
" int entries[6];",
" int entries[6];"
],
"line_no": [
15,
15
]
} | static int FUNC_0(GetBitContext *VAR_0, uint8_t *VAR_1,
ptrdiff_t VAR_2)
{
uint32_t bit_cache;
uint8_t *list[63];
uint32_t *dst;
const uint32_t *VAR_3;
int VAR_4[6];
int VAR_5, VAR_6, VAR_7, VAR_8;
int VAR_9;
unsigned VAR_10;
unsigned VAR_11, VAR_12, VAR_13, VAR_14, VAR_15;
uint32_t n1, n2, n3, n4;
list[0] = VAR_1;
for (VAR_5 = 0, VAR_7 = 1, VAR_8 = 1, VAR_15 = 5; VAR_5 < VAR_8; VAR_5++) {
SVQ1_PROCESS_VECTOR();
dst = (uint32_t *)list[VAR_5];
VAR_13 = 1 << ((4 + VAR_15) / 2);
VAR_14 = 1 << ((3 + VAR_15) / 2);
VAR_9 = get_vlc2(VAR_0, svq1_intra_multistage[VAR_15].table, 3, 3) - 1;
if (VAR_9 == -1) {
for (VAR_12 = 0; VAR_12 < VAR_14; VAR_12++)
memset(&dst[VAR_12 * (VAR_2 / 4)], 0, VAR_13);
continue;
}
if ((VAR_9 > 0 && VAR_15 >= 4)) {
ff_dlog(NULL,
"Error (FUNC_0): invalid vector: VAR_9=%VAR_5 VAR_15=%VAR_5\VAR_8",
VAR_9, VAR_15);
return AVERROR_INVALIDDATA;
}
av_assert0(VAR_9 >= 0);
VAR_10 = get_vlc2(VAR_0, svq1_intra_mean.table, 8, 3);
if (VAR_9 == 0) {
for (VAR_12 = 0; VAR_12 < VAR_14; VAR_12++)
memset(&dst[VAR_12 * (VAR_2 / 4)], VAR_10, VAR_13);
} else {
SVQ1_CALC_CODEBOOK_ENTRIES(ff_svq1_intra_codebooks);
for (VAR_12 = 0; VAR_12 < VAR_14; VAR_12++) {
for (VAR_11 = 0; VAR_11 < VAR_13 / 4; VAR_11++, VAR_3++) {
n1 = n4;
n2 = n4;
SVQ1_ADD_CODEBOOK()
dst[VAR_11] = n1 << 8 | n2;
}
dst += VAR_2 / 4;
}
}
}
return 0;
}
| [
"static int FUNC_0(GetBitContext *VAR_0, uint8_t *VAR_1,\nptrdiff_t VAR_2)\n{",
"uint32_t bit_cache;",
"uint8_t *list[63];",
"uint32_t *dst;",
"const uint32_t *VAR_3;",
"int VAR_4[6];",
"int VAR_5, VAR_6, VAR_7, VAR_8;",
"int VAR_9;",
"unsigned VAR_10;",
"unsigned VAR_11, VAR_12, VAR_13, VAR_14, VAR_15;",
"uint32_t n1, n2, n3, n4;",
"list[0] = VAR_1;",
"for (VAR_5 = 0, VAR_7 = 1, VAR_8 = 1, VAR_15 = 5; VAR_5 < VAR_8; VAR_5++) {",
"SVQ1_PROCESS_VECTOR();",
"dst = (uint32_t *)list[VAR_5];",
"VAR_13 = 1 << ((4 + VAR_15) / 2);",
"VAR_14 = 1 << ((3 + VAR_15) / 2);",
"VAR_9 = get_vlc2(VAR_0, svq1_intra_multistage[VAR_15].table, 3, 3) - 1;",
"if (VAR_9 == -1) {",
"for (VAR_12 = 0; VAR_12 < VAR_14; VAR_12++)",
"memset(&dst[VAR_12 * (VAR_2 / 4)], 0, VAR_13);",
"continue;",
"}",
"if ((VAR_9 > 0 && VAR_15 >= 4)) {",
"ff_dlog(NULL,\n\"Error (FUNC_0): invalid vector: VAR_9=%VAR_5 VAR_15=%VAR_5\\VAR_8\",\nVAR_9, VAR_15);",
"return AVERROR_INVALIDDATA;",
"}",
"av_assert0(VAR_9 >= 0);",
"VAR_10 = get_vlc2(VAR_0, svq1_intra_mean.table, 8, 3);",
"if (VAR_9 == 0) {",
"for (VAR_12 = 0; VAR_12 < VAR_14; VAR_12++)",
"memset(&dst[VAR_12 * (VAR_2 / 4)], VAR_10, VAR_13);",
"} else {",
"SVQ1_CALC_CODEBOOK_ENTRIES(ff_svq1_intra_codebooks);",
"for (VAR_12 = 0; VAR_12 < VAR_14; VAR_12++) {",
"for (VAR_11 = 0; VAR_11 < VAR_13 / 4; VAR_11++, VAR_3++) {",
"n1 = n4;",
"n2 = n4;",
"SVQ1_ADD_CODEBOOK()\ndst[VAR_11] = n1 << 8 | n2;",
"}",
"dst += VAR_2 / 4;",
"}",
"}",
"}",
"return 0;",
"}"
] | [
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
31
],
[
37
],
[
39
],
[
45
],
[
47
],
[
49
],
[
55
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
71
],
[
73,
75,
77
],
[
79
],
[
81
],
[
83
],
[
87
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111,
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
129
],
[
131
]
] |
19,742 | static int omap2_intc_init(SysBusDevice *sbd)
{
DeviceState *dev = DEVICE(sbd);
struct omap_intr_handler_s *s = OMAP_INTC(dev);
if (!s->iclk) {
hw_error("omap2-intc: iclk not connected\n");
}
if (!s->fclk) {
hw_error("omap2-intc: fclk not connected\n");
}
s->level_only = 1;
s->nbanks = 3;
sysbus_init_irq(sbd, &s->parent_intr[0]);
sysbus_init_irq(sbd, &s->parent_intr[1]);
qdev_init_gpio_in(dev, omap_set_intr_noedge, s->nbanks * 32);
memory_region_init_io(&s->mmio, OBJECT(s), &omap2_inth_mem_ops, s,
"omap2-intc", 0x1000);
sysbus_init_mmio(sbd, &s->mmio);
return 0;
}
| true | qemu | 84a3a53cf61ef691478bd91afa455c801696053c | static int omap2_intc_init(SysBusDevice *sbd)
{
DeviceState *dev = DEVICE(sbd);
struct omap_intr_handler_s *s = OMAP_INTC(dev);
if (!s->iclk) {
hw_error("omap2-intc: iclk not connected\n");
}
if (!s->fclk) {
hw_error("omap2-intc: fclk not connected\n");
}
s->level_only = 1;
s->nbanks = 3;
sysbus_init_irq(sbd, &s->parent_intr[0]);
sysbus_init_irq(sbd, &s->parent_intr[1]);
qdev_init_gpio_in(dev, omap_set_intr_noedge, s->nbanks * 32);
memory_region_init_io(&s->mmio, OBJECT(s), &omap2_inth_mem_ops, s,
"omap2-intc", 0x1000);
sysbus_init_mmio(sbd, &s->mmio);
return 0;
}
| {
"code": [
" hw_error(\"omap2-intc: iclk not connected\\n\");",
" hw_error(\"omap2-intc: fclk not connected\\n\");"
],
"line_no": [
13,
19
]
} | static int FUNC_0(SysBusDevice *VAR_0)
{
DeviceState *dev = DEVICE(VAR_0);
struct omap_intr_handler_s *VAR_1 = OMAP_INTC(dev);
if (!VAR_1->iclk) {
hw_error("omap2-intc: iclk not connected\n");
}
if (!VAR_1->fclk) {
hw_error("omap2-intc: fclk not connected\n");
}
VAR_1->level_only = 1;
VAR_1->nbanks = 3;
sysbus_init_irq(VAR_0, &VAR_1->parent_intr[0]);
sysbus_init_irq(VAR_0, &VAR_1->parent_intr[1]);
qdev_init_gpio_in(dev, omap_set_intr_noedge, VAR_1->nbanks * 32);
memory_region_init_io(&VAR_1->mmio, OBJECT(VAR_1), &omap2_inth_mem_ops, VAR_1,
"omap2-intc", 0x1000);
sysbus_init_mmio(VAR_0, &VAR_1->mmio);
return 0;
}
| [
"static int FUNC_0(SysBusDevice *VAR_0)\n{",
"DeviceState *dev = DEVICE(VAR_0);",
"struct omap_intr_handler_s *VAR_1 = OMAP_INTC(dev);",
"if (!VAR_1->iclk) {",
"hw_error(\"omap2-intc: iclk not connected\\n\");",
"}",
"if (!VAR_1->fclk) {",
"hw_error(\"omap2-intc: fclk not connected\\n\");",
"}",
"VAR_1->level_only = 1;",
"VAR_1->nbanks = 3;",
"sysbus_init_irq(VAR_0, &VAR_1->parent_intr[0]);",
"sysbus_init_irq(VAR_0, &VAR_1->parent_intr[1]);",
"qdev_init_gpio_in(dev, omap_set_intr_noedge, VAR_1->nbanks * 32);",
"memory_region_init_io(&VAR_1->mmio, OBJECT(VAR_1), &omap2_inth_mem_ops, VAR_1,\n\"omap2-intc\", 0x1000);",
"sysbus_init_mmio(VAR_0, &VAR_1->mmio);",
"return 0;",
"}"
] | [
0,
0,
0,
0,
1,
0,
0,
1,
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
]
] |
19,743 | static int h264_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
H264Context *h = avctx->priv_data;
AVFrame *pict = data;
int buf_index = 0;
H264Picture *out;
int i, out_idx;
int ret;
h->flags = avctx->flags;
ff_h264_unref_picture(h, &h->last_pic_for_ec);
/* end of stream, output what is still in the buffers */
if (buf_size == 0) {
out:
h->cur_pic_ptr = NULL;
h->first_field = 0;
// FIXME factorize this with the output code below
out = h->delayed_pic[0];
out_idx = 0;
for (i = 1;
h->delayed_pic[i] &&
!h->delayed_pic[i]->f->key_frame &&
!h->delayed_pic[i]->mmco_reset;
i++)
if (h->delayed_pic[i]->poc < out->poc) {
out = h->delayed_pic[i];
out_idx = i;
for (i = out_idx; h->delayed_pic[i]; i++)
h->delayed_pic[i] = h->delayed_pic[i + 1];
if (out) {
out->reference &= ~DELAYED_PIC_REF;
ret = output_frame(h, pict, out);
if (ret < 0)
return ret;
*got_frame = 1;
return buf_index;
if (h->is_avc && av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, NULL)) {
int side_size;
uint8_t *side = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size);
if (is_extra(side, side_size))
ff_h264_decode_extradata(h, side, side_size);
if(h->is_avc && buf_size >= 9 && buf[0]==1 && buf[2]==0 && (buf[4]&0xFC)==0xFC && (buf[5]&0x1F) && buf[8]==0x67){
if (is_extra(buf, buf_size))
return ff_h264_decode_extradata(h, buf, buf_size);
buf_index = decode_nal_units(h, buf, buf_size, 0);
if (buf_index < 0)
return AVERROR_INVALIDDATA;
if (!h->cur_pic_ptr && h->nal_unit_type == NAL_END_SEQUENCE) {
av_assert0(buf_index <= buf_size);
goto out;
if (!(avctx->flags2 & CODEC_FLAG2_CHUNKS) && !h->cur_pic_ptr) {
if (avctx->skip_frame >= AVDISCARD_NONREF ||
buf_size >= 4 && !memcmp("Q264", buf, 4))
return buf_size;
av_log(avctx, AV_LOG_ERROR, "no frame!\n");
return AVERROR_INVALIDDATA;
if (!(avctx->flags2 & CODEC_FLAG2_CHUNKS) ||
(h->mb_y >= h->mb_height && h->mb_height)) {
if (avctx->flags2 & CODEC_FLAG2_CHUNKS)
decode_postinit(h, 1);
ff_h264_field_end(h, &h->slice_ctx[0], 0);
/* Wait for second field. */
*got_frame = 0;
if (h->next_output_pic && (
h->next_output_pic->recovered)) {
if (!h->next_output_pic->recovered)
h->next_output_pic->f->flags |= AV_FRAME_FLAG_CORRUPT;
if (!h->avctx->hwaccel &&
(h->next_output_pic->field_poc[0] == INT_MAX ||
h->next_output_pic->field_poc[1] == INT_MAX)
) {
int p;
AVFrame *f = h->next_output_pic->f;
int field = h->next_output_pic->field_poc[0] == INT_MAX;
uint8_t *dst_data[4];
int linesizes[4];
const uint8_t *src_data[4];
av_log(h->avctx, AV_LOG_DEBUG, "Duplicating field %d to fill missing\n", field);
for (p = 0; p<4; p++) {
dst_data[p] = f->data[p] + (field^1)*f->linesize[p];
src_data[p] = f->data[p] + field *f->linesize[p];
linesizes[p] = 2*f->linesize[p];
av_image_copy(dst_data, linesizes, src_data, linesizes,
f->format, f->width, f->height>>1);
ret = output_frame(h, pict, h->next_output_pic);
if (ret < 0)
return ret;
*got_frame = 1;
if (CONFIG_MPEGVIDEO) {
ff_print_debug_info2(h->avctx, pict, NULL,
h->next_output_pic->mb_type,
h->next_output_pic->qscale_table,
h->next_output_pic->motion_val,
&h->low_delay,
h->mb_width, h->mb_height, h->mb_stride, 1);
av_assert0(pict->buf[0] || !*got_frame);
ff_h264_unref_picture(h, &h->last_pic_for_ec);
return get_consumed_bytes(buf_index, buf_size); | true | FFmpeg | 1189af429211ac650aac730368a6cf5b23756605 | static int h264_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
H264Context *h = avctx->priv_data;
AVFrame *pict = data;
int buf_index = 0;
H264Picture *out;
int i, out_idx;
int ret;
h->flags = avctx->flags;
ff_h264_unref_picture(h, &h->last_pic_for_ec);
if (buf_size == 0) {
out:
h->cur_pic_ptr = NULL;
h->first_field = 0;
out = h->delayed_pic[0];
out_idx = 0;
for (i = 1;
h->delayed_pic[i] &&
!h->delayed_pic[i]->f->key_frame &&
!h->delayed_pic[i]->mmco_reset;
i++)
if (h->delayed_pic[i]->poc < out->poc) {
out = h->delayed_pic[i];
out_idx = i;
for (i = out_idx; h->delayed_pic[i]; i++)
h->delayed_pic[i] = h->delayed_pic[i + 1];
if (out) {
out->reference &= ~DELAYED_PIC_REF;
ret = output_frame(h, pict, out);
if (ret < 0)
return ret;
*got_frame = 1;
return buf_index;
if (h->is_avc && av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, NULL)) {
int side_size;
uint8_t *side = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size);
if (is_extra(side, side_size))
ff_h264_decode_extradata(h, side, side_size);
if(h->is_avc && buf_size >= 9 && buf[0]==1 && buf[2]==0 && (buf[4]&0xFC)==0xFC && (buf[5]&0x1F) && buf[8]==0x67){
if (is_extra(buf, buf_size))
return ff_h264_decode_extradata(h, buf, buf_size);
buf_index = decode_nal_units(h, buf, buf_size, 0);
if (buf_index < 0)
return AVERROR_INVALIDDATA;
if (!h->cur_pic_ptr && h->nal_unit_type == NAL_END_SEQUENCE) {
av_assert0(buf_index <= buf_size);
goto out;
if (!(avctx->flags2 & CODEC_FLAG2_CHUNKS) && !h->cur_pic_ptr) {
if (avctx->skip_frame >= AVDISCARD_NONREF ||
buf_size >= 4 && !memcmp("Q264", buf, 4))
return buf_size;
av_log(avctx, AV_LOG_ERROR, "no frame!\n");
return AVERROR_INVALIDDATA;
if (!(avctx->flags2 & CODEC_FLAG2_CHUNKS) ||
(h->mb_y >= h->mb_height && h->mb_height)) {
if (avctx->flags2 & CODEC_FLAG2_CHUNKS)
decode_postinit(h, 1);
ff_h264_field_end(h, &h->slice_ctx[0], 0);
*got_frame = 0;
if (h->next_output_pic && (
h->next_output_pic->recovered)) {
if (!h->next_output_pic->recovered)
h->next_output_pic->f->flags |= AV_FRAME_FLAG_CORRUPT;
if (!h->avctx->hwaccel &&
(h->next_output_pic->field_poc[0] == INT_MAX ||
h->next_output_pic->field_poc[1] == INT_MAX)
) {
int p;
AVFrame *f = h->next_output_pic->f;
int field = h->next_output_pic->field_poc[0] == INT_MAX;
uint8_t *dst_data[4];
int linesizes[4];
const uint8_t *src_data[4];
av_log(h->avctx, AV_LOG_DEBUG, "Duplicating field %d to fill missing\n", field);
for (p = 0; p<4; p++) {
dst_data[p] = f->data[p] + (field^1)*f->linesize[p];
src_data[p] = f->data[p] + field *f->linesize[p];
linesizes[p] = 2*f->linesize[p];
av_image_copy(dst_data, linesizes, src_data, linesizes,
f->format, f->width, f->height>>1);
ret = output_frame(h, pict, h->next_output_pic);
if (ret < 0)
return ret;
*got_frame = 1;
if (CONFIG_MPEGVIDEO) {
ff_print_debug_info2(h->avctx, pict, NULL,
h->next_output_pic->mb_type,
h->next_output_pic->qscale_table,
h->next_output_pic->motion_val,
&h->low_delay,
h->mb_width, h->mb_height, h->mb_stride, 1);
av_assert0(pict->buf[0] || !*got_frame);
ff_h264_unref_picture(h, &h->last_pic_for_ec);
return get_consumed_bytes(buf_index, buf_size); | {
"code": [],
"line_no": []
} | static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,
int *VAR_2, AVPacket *VAR_3)
{
const uint8_t *VAR_4 = VAR_3->VAR_1;
int VAR_5 = VAR_3->size;
H264Context *h = VAR_0->priv_data;
AVFrame *pict = VAR_1;
int VAR_6 = 0;
H264Picture *out;
int VAR_7, VAR_8;
int VAR_9;
h->flags = VAR_0->flags;
ff_h264_unref_picture(h, &h->last_pic_for_ec);
if (VAR_5 == 0) {
out:
h->cur_pic_ptr = NULL;
h->first_field = 0;
out = h->delayed_pic[0];
VAR_8 = 0;
for (VAR_7 = 1;
h->delayed_pic[VAR_7] &&
!h->delayed_pic[VAR_7]->f->key_frame &&
!h->delayed_pic[VAR_7]->mmco_reset;
VAR_7++)
if (h->delayed_pic[VAR_7]->poc < out->poc) {
out = h->delayed_pic[VAR_7];
VAR_8 = VAR_7;
for (VAR_7 = VAR_8; h->delayed_pic[VAR_7]; VAR_7++)
h->delayed_pic[VAR_7] = h->delayed_pic[VAR_7 + 1];
if (out) {
out->reference &= ~DELAYED_PIC_REF;
VAR_9 = output_frame(h, pict, out);
if (VAR_9 < 0)
return VAR_9;
*VAR_2 = 1;
return VAR_6;
if (h->is_avc && av_packet_get_side_data(VAR_3, AV_PKT_DATA_NEW_EXTRADATA, NULL)) {
int side_size;
uint8_t *side = av_packet_get_side_data(VAR_3, AV_PKT_DATA_NEW_EXTRADATA, &side_size);
if (is_extra(side, side_size))
ff_h264_decode_extradata(h, side, side_size);
if(h->is_avc && VAR_5 >= 9 && VAR_4[0]==1 && VAR_4[2]==0 && (VAR_4[4]&0xFC)==0xFC && (VAR_4[5]&0x1F) && VAR_4[8]==0x67){
if (is_extra(VAR_4, VAR_5))
return ff_h264_decode_extradata(h, VAR_4, VAR_5);
VAR_6 = decode_nal_units(h, VAR_4, VAR_5, 0);
if (VAR_6 < 0)
return AVERROR_INVALIDDATA;
if (!h->cur_pic_ptr && h->nal_unit_type == NAL_END_SEQUENCE) {
av_assert0(VAR_6 <= VAR_5);
goto out;
if (!(VAR_0->flags2 & CODEC_FLAG2_CHUNKS) && !h->cur_pic_ptr) {
if (VAR_0->skip_frame >= AVDISCARD_NONREF ||
VAR_5 >= 4 && !memcmp("Q264", VAR_4, 4))
return VAR_5;
av_log(VAR_0, AV_LOG_ERROR, "no frame!\n");
return AVERROR_INVALIDDATA;
if (!(VAR_0->flags2 & CODEC_FLAG2_CHUNKS) ||
(h->mb_y >= h->mb_height && h->mb_height)) {
if (VAR_0->flags2 & CODEC_FLAG2_CHUNKS)
decode_postinit(h, 1);
ff_h264_field_end(h, &h->slice_ctx[0], 0);
*VAR_2 = 0;
if (h->next_output_pic && (
h->next_output_pic->recovered)) {
if (!h->next_output_pic->recovered)
h->next_output_pic->f->flags |= AV_FRAME_FLAG_CORRUPT;
if (!h->VAR_0->hwaccel &&
(h->next_output_pic->field_poc[0] == INT_MAX ||
h->next_output_pic->field_poc[1] == INT_MAX)
) {
int p;
AVFrame *f = h->next_output_pic->f;
int field = h->next_output_pic->field_poc[0] == INT_MAX;
uint8_t *dst_data[4];
int linesizes[4];
const uint8_t *src_data[4];
av_log(h->VAR_0, AV_LOG_DEBUG, "Duplicating field %d to fill missing\n", field);
for (p = 0; p<4; p++) {
dst_data[p] = f->VAR_1[p] + (field^1)*f->linesize[p];
src_data[p] = f->VAR_1[p] + field *f->linesize[p];
linesizes[p] = 2*f->linesize[p];
av_image_copy(dst_data, linesizes, src_data, linesizes,
f->format, f->width, f->height>>1);
VAR_9 = output_frame(h, pict, h->next_output_pic);
if (VAR_9 < 0)
return VAR_9;
*VAR_2 = 1;
if (CONFIG_MPEGVIDEO) {
ff_print_debug_info2(h->VAR_0, pict, NULL,
h->next_output_pic->mb_type,
h->next_output_pic->qscale_table,
h->next_output_pic->motion_val,
&h->low_delay,
h->mb_width, h->mb_height, h->mb_stride, 1);
av_assert0(pict->VAR_4[0] || !*VAR_2);
ff_h264_unref_picture(h, &h->last_pic_for_ec);
return get_consumed_bytes(VAR_6, VAR_5); | [
"static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{",
"const uint8_t *VAR_4 = VAR_3->VAR_1;",
"int VAR_5 = VAR_3->size;",
"H264Context *h = VAR_0->priv_data;",
"AVFrame *pict = VAR_1;",
"int VAR_6 = 0;",
"H264Picture *out;",
"int VAR_7, VAR_8;",
"int VAR_9;",
"h->flags = VAR_0->flags;",
"ff_h264_unref_picture(h, &h->last_pic_for_ec);",
"if (VAR_5 == 0) {",
"out:\nh->cur_pic_ptr = NULL;",
"h->first_field = 0;",
"out = h->delayed_pic[0];",
"VAR_8 = 0;",
"for (VAR_7 = 1;",
"h->delayed_pic[VAR_7] &&\n!h->delayed_pic[VAR_7]->f->key_frame &&\n!h->delayed_pic[VAR_7]->mmco_reset;",
"VAR_7++)\nif (h->delayed_pic[VAR_7]->poc < out->poc) {",
"out = h->delayed_pic[VAR_7];",
"VAR_8 = VAR_7;",
"for (VAR_7 = VAR_8; h->delayed_pic[VAR_7]; VAR_7++)",
"h->delayed_pic[VAR_7] = h->delayed_pic[VAR_7 + 1];",
"if (out) {",
"out->reference &= ~DELAYED_PIC_REF;",
"VAR_9 = output_frame(h, pict, out);",
"if (VAR_9 < 0)\nreturn VAR_9;",
"*VAR_2 = 1;",
"return VAR_6;",
"if (h->is_avc && av_packet_get_side_data(VAR_3, AV_PKT_DATA_NEW_EXTRADATA, NULL)) {",
"int side_size;",
"uint8_t *side = av_packet_get_side_data(VAR_3, AV_PKT_DATA_NEW_EXTRADATA, &side_size);",
"if (is_extra(side, side_size))\nff_h264_decode_extradata(h, side, side_size);",
"if(h->is_avc && VAR_5 >= 9 && VAR_4[0]==1 && VAR_4[2]==0 && (VAR_4[4]&0xFC)==0xFC && (VAR_4[5]&0x1F) && VAR_4[8]==0x67){",
"if (is_extra(VAR_4, VAR_5))\nreturn ff_h264_decode_extradata(h, VAR_4, VAR_5);",
"VAR_6 = decode_nal_units(h, VAR_4, VAR_5, 0);",
"if (VAR_6 < 0)\nreturn AVERROR_INVALIDDATA;",
"if (!h->cur_pic_ptr && h->nal_unit_type == NAL_END_SEQUENCE) {",
"av_assert0(VAR_6 <= VAR_5);",
"goto out;",
"if (!(VAR_0->flags2 & CODEC_FLAG2_CHUNKS) && !h->cur_pic_ptr) {",
"if (VAR_0->skip_frame >= AVDISCARD_NONREF ||\nVAR_5 >= 4 && !memcmp(\"Q264\", VAR_4, 4))\nreturn VAR_5;",
"av_log(VAR_0, AV_LOG_ERROR, \"no frame!\\n\");",
"return AVERROR_INVALIDDATA;",
"if (!(VAR_0->flags2 & CODEC_FLAG2_CHUNKS) ||\n(h->mb_y >= h->mb_height && h->mb_height)) {",
"if (VAR_0->flags2 & CODEC_FLAG2_CHUNKS)\ndecode_postinit(h, 1);",
"ff_h264_field_end(h, &h->slice_ctx[0], 0);",
"*VAR_2 = 0;",
"if (h->next_output_pic && (\nh->next_output_pic->recovered)) {",
"if (!h->next_output_pic->recovered)\nh->next_output_pic->f->flags |= AV_FRAME_FLAG_CORRUPT;",
"if (!h->VAR_0->hwaccel &&\n(h->next_output_pic->field_poc[0] == INT_MAX ||\nh->next_output_pic->field_poc[1] == INT_MAX)\n) {",
"int p;",
"AVFrame *f = h->next_output_pic->f;",
"int field = h->next_output_pic->field_poc[0] == INT_MAX;",
"uint8_t *dst_data[4];",
"int linesizes[4];",
"const uint8_t *src_data[4];",
"av_log(h->VAR_0, AV_LOG_DEBUG, \"Duplicating field %d to fill missing\\n\", field);",
"for (p = 0; p<4; p++) {",
"dst_data[p] = f->VAR_1[p] + (field^1)*f->linesize[p];",
"src_data[p] = f->VAR_1[p] + field *f->linesize[p];",
"linesizes[p] = 2*f->linesize[p];",
"av_image_copy(dst_data, linesizes, src_data, linesizes,\nf->format, f->width, f->height>>1);",
"VAR_9 = output_frame(h, pict, h->next_output_pic);",
"if (VAR_9 < 0)\nreturn VAR_9;",
"*VAR_2 = 1;",
"if (CONFIG_MPEGVIDEO) {",
"ff_print_debug_info2(h->VAR_0, pict, NULL,\nh->next_output_pic->mb_type,\nh->next_output_pic->qscale_table,\nh->next_output_pic->motion_val,\n&h->low_delay,\nh->mb_width, h->mb_height, h->mb_stride, 1);",
"av_assert0(pict->VAR_4[0] || !*VAR_2);",
"ff_h264_unref_picture(h, &h->last_pic_for_ec);",
"return get_consumed_bytes(VAR_6, VAR_5);"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
2,
3
],
[
4
],
[
5
],
[
6
],
[
7
],
[
8
],
[
9
],
[
10
],
[
11
],
[
12
],
[
13
],
[
15
],
[
16,
17
],
[
18
],
[
20
],
[
21
],
[
22
],
[
23,
24,
25
],
[
26,
27
],
[
28
],
[
29
],
[
30
],
[
31
],
[
32
],
[
33
],
[
34
],
[
35,
36
],
[
37
],
[
38
],
[
39
],
[
40
],
[
41
],
[
42,
43
],
[
44
],
[
45,
46
],
[
47
],
[
48,
49
],
[
50
],
[
51
],
[
52
],
[
53
],
[
54,
55,
56
],
[
57
],
[
58
],
[
59,
60
],
[
61,
62
],
[
63
],
[
65
],
[
66,
67
],
[
68,
69
],
[
70,
71,
72,
73
],
[
74
],
[
75
],
[
76
],
[
77
],
[
78
],
[
79
],
[
80
],
[
81
],
[
82
],
[
83
],
[
84
],
[
85,
86
],
[
87
],
[
88,
89
],
[
90
],
[
91
],
[
92,
93,
94,
95,
96,
97
],
[
98
],
[
99
],
[
100
]
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.