id
int32 0
27.3k
| func
stringlengths 26
142k
| target
bool 2
classes | project
stringclasses 2
values | commit_id
stringlengths 40
40
| func_clean
stringlengths 26
131k
| vul_lines
dict | normalized_func
stringlengths 24
132k
| lines
listlengths 1
2.8k
| label
listlengths 1
2.8k
| line_no
listlengths 1
2.8k
|
---|---|---|---|---|---|---|---|---|---|---|
12,341 | static void av_noinline filter_mb_edgecv( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) {
const unsigned int index_a = 52 + qp + h->slice_alpha_c0_offset;
const int alpha = alpha_table[index_a];
const int beta = (beta_table+52)[qp + h->slice_beta_offset];
if (alpha ==0 || beta == 0) return;
if( bS[0] < 4 ) {
int8_t tc[4];
tc[0] = tc0_table[index_a][bS[0]]+1;
tc[1] = tc0_table[index_a][bS[1]]+1;
tc[2] = tc0_table[index_a][bS[2]]+1;
tc[3] = tc0_table[index_a][bS[3]]+1;
h->s.dsp.h264_h_loop_filter_chroma(pix, stride, alpha, beta, tc);
} else {
h->s.dsp.h264_h_loop_filter_chroma_intra(pix, stride, alpha, beta);
}
}
| false | FFmpeg | 0c32e19d584ba6ddbc27f0a796260404daaf4b6a | static void av_noinline filter_mb_edgecv( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) {
const unsigned int index_a = 52 + qp + h->slice_alpha_c0_offset;
const int alpha = alpha_table[index_a];
const int beta = (beta_table+52)[qp + h->slice_beta_offset];
if (alpha ==0 || beta == 0) return;
if( bS[0] < 4 ) {
int8_t tc[4];
tc[0] = tc0_table[index_a][bS[0]]+1;
tc[1] = tc0_table[index_a][bS[1]]+1;
tc[2] = tc0_table[index_a][bS[2]]+1;
tc[3] = tc0_table[index_a][bS[3]]+1;
h->s.dsp.h264_h_loop_filter_chroma(pix, stride, alpha, beta, tc);
} else {
h->s.dsp.h264_h_loop_filter_chroma_intra(pix, stride, alpha, beta);
}
}
| {
"code": [],
"line_no": []
} | static void VAR_0 filter_mb_edgecv( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) {
const unsigned int index_a = 52 + qp + h->slice_alpha_c0_offset;
const int alpha = alpha_table[index_a];
const int beta = (beta_table+52)[qp + h->slice_beta_offset];
if (alpha ==0 || beta == 0) return;
if( bS[0] < 4 ) {
int8_t tc[4];
tc[0] = tc0_table[index_a][bS[0]]+1;
tc[1] = tc0_table[index_a][bS[1]]+1;
tc[2] = tc0_table[index_a][bS[2]]+1;
tc[3] = tc0_table[index_a][bS[3]]+1;
h->s.dsp.h264_h_loop_filter_chroma(pix, stride, alpha, beta, tc);
} else {
h->s.dsp.h264_h_loop_filter_chroma_intra(pix, stride, alpha, beta);
}
}
| [
"static void VAR_0 filter_mb_edgecv( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) {",
"const unsigned int index_a = 52 + qp + h->slice_alpha_c0_offset;",
"const int alpha = alpha_table[index_a];",
"const int beta = (beta_table+52)[qp + h->slice_beta_offset];",
"if (alpha ==0 || beta == 0) return;",
"if( bS[0] < 4 ) {",
"int8_t tc[4];",
"tc[0] = tc0_table[index_a][bS[0]]+1;",
"tc[1] = tc0_table[index_a][bS[1]]+1;",
"tc[2] = tc0_table[index_a][bS[2]]+1;",
"tc[3] = tc0_table[index_a][bS[3]]+1;",
"h->s.dsp.h264_h_loop_filter_chroma(pix, stride, alpha, beta, tc);",
"} else {",
"h->s.dsp.h264_h_loop_filter_chroma_intra(pix, stride, alpha, beta);",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1
],
[
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
]
]
|
12,342 | int qemu_recvv(int sockfd, struct iovec *iov, int len, int iov_offset)
{
return do_sendv_recvv(sockfd, iov, len, iov_offset, 0);
}
| true | qemu | 3e80bf9351f8fec9085c46df6da075efd5e71003 | int qemu_recvv(int sockfd, struct iovec *iov, int len, int iov_offset)
{
return do_sendv_recvv(sockfd, iov, len, iov_offset, 0);
}
| {
"code": [
"int qemu_recvv(int sockfd, struct iovec *iov, int len, int iov_offset)",
" return do_sendv_recvv(sockfd, iov, len, iov_offset, 0);"
],
"line_no": [
1,
5
]
} | int FUNC_0(int VAR_0, struct iovec *VAR_1, int VAR_2, int VAR_3)
{
return do_sendv_recvv(VAR_0, VAR_1, VAR_2, VAR_3, 0);
}
| [
"int FUNC_0(int VAR_0, struct iovec *VAR_1, int VAR_2, int VAR_3)\n{",
"return do_sendv_recvv(VAR_0, VAR_1, VAR_2, VAR_3, 0);",
"}"
]
| [
1,
1,
0
]
| [
[
1,
3
],
[
5
],
[
7
]
]
|
12,343 | static void vmxnet3_complete_packet(VMXNET3State *s, int qidx, uint32_t tx_ridx)
{
struct Vmxnet3_TxCompDesc txcq_descr;
PCIDevice *d = PCI_DEVICE(s);
VMXNET3_RING_DUMP(VMW_RIPRN, "TXC", qidx, &s->txq_descr[qidx].comp_ring);
txcq_descr.txdIdx = tx_ridx;
txcq_descr.gen = vmxnet3_ring_curr_gen(&s->txq_descr[qidx].comp_ring);
vmxnet3_ring_write_curr_cell(d, &s->txq_descr[qidx].comp_ring, &txcq_descr);
/* Flush changes in TX descriptor before changing the counter value */
smp_wmb();
vmxnet3_inc_tx_completion_counter(s, qidx);
vmxnet3_trigger_interrupt(s, s->txq_descr[qidx].intr_idx);
} | true | qemu | fdda170e50b8af062cf5741e12c4fb5e57a2eacf | static void vmxnet3_complete_packet(VMXNET3State *s, int qidx, uint32_t tx_ridx)
{
struct Vmxnet3_TxCompDesc txcq_descr;
PCIDevice *d = PCI_DEVICE(s);
VMXNET3_RING_DUMP(VMW_RIPRN, "TXC", qidx, &s->txq_descr[qidx].comp_ring);
txcq_descr.txdIdx = tx_ridx;
txcq_descr.gen = vmxnet3_ring_curr_gen(&s->txq_descr[qidx].comp_ring);
vmxnet3_ring_write_curr_cell(d, &s->txq_descr[qidx].comp_ring, &txcq_descr);
smp_wmb();
vmxnet3_inc_tx_completion_counter(s, qidx);
vmxnet3_trigger_interrupt(s, s->txq_descr[qidx].intr_idx);
} | {
"code": [],
"line_no": []
} | static void FUNC_0(VMXNET3State *VAR_0, int VAR_1, uint32_t VAR_2)
{
struct Vmxnet3_TxCompDesc VAR_3;
PCIDevice *d = PCI_DEVICE(VAR_0);
VMXNET3_RING_DUMP(VMW_RIPRN, "TXC", VAR_1, &VAR_0->txq_descr[VAR_1].comp_ring);
VAR_3.txdIdx = VAR_2;
VAR_3.gen = vmxnet3_ring_curr_gen(&VAR_0->txq_descr[VAR_1].comp_ring);
vmxnet3_ring_write_curr_cell(d, &VAR_0->txq_descr[VAR_1].comp_ring, &VAR_3);
smp_wmb();
vmxnet3_inc_tx_completion_counter(VAR_0, VAR_1);
vmxnet3_trigger_interrupt(VAR_0, VAR_0->txq_descr[VAR_1].intr_idx);
} | [
"static void FUNC_0(VMXNET3State *VAR_0, int VAR_1, uint32_t VAR_2)\n{",
"struct Vmxnet3_TxCompDesc VAR_3;",
"PCIDevice *d = PCI_DEVICE(VAR_0);",
"VMXNET3_RING_DUMP(VMW_RIPRN, \"TXC\", VAR_1, &VAR_0->txq_descr[VAR_1].comp_ring);",
"VAR_3.txdIdx = VAR_2;",
"VAR_3.gen = vmxnet3_ring_curr_gen(&VAR_0->txq_descr[VAR_1].comp_ring);",
"vmxnet3_ring_write_curr_cell(d, &VAR_0->txq_descr[VAR_1].comp_ring, &VAR_3);",
"smp_wmb();",
"vmxnet3_inc_tx_completion_counter(VAR_0, VAR_1);",
"vmxnet3_trigger_interrupt(VAR_0, VAR_0->txq_descr[VAR_1].intr_idx);",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
16
],
[
18
],
[
22
],
[
28
],
[
32
],
[
34
],
[
36
]
]
|
12,344 | static void gen_mtc0(DisasContext *ctx, TCGv arg, int reg, int sel)
{
const char *rn = "invalid";
if (sel != 0)
check_insn(ctx, ISA_MIPS32);
if (ctx->tb->cflags & CF_USE_ICOUNT) {
gen_io_start();
}
switch (reg) {
case 0:
switch (sel) {
case 0:
gen_helper_mtc0_index(cpu_env, arg);
rn = "Index";
case 1:
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mtc0_mvpcontrol(cpu_env, arg);
rn = "MVPControl";
CP0_CHECK(ctx->insn_flags & ASE_MT);
/* ignored */
rn = "MVPConf0";
CP0_CHECK(ctx->insn_flags & ASE_MT);
/* ignored */
rn = "MVPConf1";
CP0_CHECK(ctx->vp);
/* ignored */
rn = "VPControl";
default:
goto cp0_unimplemented;
}
case 1:
switch (sel) {
case 0:
/* ignored */
rn = "Random";
case 1:
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mtc0_vpecontrol(cpu_env, arg);
rn = "VPEControl";
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mtc0_vpeconf0(cpu_env, arg);
rn = "VPEConf0";
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mtc0_vpeconf1(cpu_env, arg);
rn = "VPEConf1";
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mtc0_yqmask(cpu_env, arg);
rn = "YQMask";
case 5:
CP0_CHECK(ctx->insn_flags & ASE_MT);
tcg_gen_st_tl(arg, cpu_env,
offsetof(CPUMIPSState, CP0_VPESchedule));
rn = "VPESchedule";
case 6:
CP0_CHECK(ctx->insn_flags & ASE_MT);
tcg_gen_st_tl(arg, cpu_env,
offsetof(CPUMIPSState, CP0_VPEScheFBack));
rn = "VPEScheFBack";
case 7:
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mtc0_vpeopt(cpu_env, arg);
rn = "VPEOpt";
default:
goto cp0_unimplemented;
}
switch (sel) {
case 0:
gen_helper_mtc0_entrylo0(cpu_env, arg);
rn = "EntryLo0";
case 1:
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mtc0_tcstatus(cpu_env, arg);
rn = "TCStatus";
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mtc0_tcbind(cpu_env, arg);
rn = "TCBind";
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mtc0_tcrestart(cpu_env, arg);
rn = "TCRestart";
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mtc0_tchalt(cpu_env, arg);
rn = "TCHalt";
case 5:
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mtc0_tccontext(cpu_env, arg);
rn = "TCContext";
case 6:
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mtc0_tcschedule(cpu_env, arg);
rn = "TCSchedule";
case 7:
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mtc0_tcschefback(cpu_env, arg);
rn = "TCScheFBack";
default:
goto cp0_unimplemented;
}
switch (sel) {
case 0:
gen_helper_mtc0_entrylo1(cpu_env, arg);
rn = "EntryLo1";
case 1:
CP0_CHECK(ctx->vp);
/* ignored */
rn = "GlobalNumber";
default:
goto cp0_unimplemented;
}
switch (sel) {
case 0:
gen_helper_mtc0_context(cpu_env, arg);
rn = "Context";
case 1:
// gen_helper_mtc0_contextconfig(cpu_env, arg); /* SmartMIPS ASE */
rn = "ContextConfig";
goto cp0_unimplemented;
CP0_CHECK(ctx->ulri);
tcg_gen_st_tl(arg, cpu_env,
offsetof(CPUMIPSState, active_tc.CP0_UserLocal));
rn = "UserLocal";
default:
goto cp0_unimplemented;
}
case 5:
switch (sel) {
case 0:
gen_helper_mtc0_pagemask(cpu_env, arg);
rn = "PageMask";
case 1:
check_insn(ctx, ISA_MIPS32R2);
gen_helper_mtc0_pagegrain(cpu_env, arg);
rn = "PageGrain";
ctx->bstate = BS_STOP;
default:
goto cp0_unimplemented;
}
case 6:
switch (sel) {
case 0:
gen_helper_mtc0_wired(cpu_env, arg);
rn = "Wired";
case 1:
check_insn(ctx, ISA_MIPS32R2);
gen_helper_mtc0_srsconf0(cpu_env, arg);
rn = "SRSConf0";
check_insn(ctx, ISA_MIPS32R2);
gen_helper_mtc0_srsconf1(cpu_env, arg);
rn = "SRSConf1";
check_insn(ctx, ISA_MIPS32R2);
gen_helper_mtc0_srsconf2(cpu_env, arg);
rn = "SRSConf2";
check_insn(ctx, ISA_MIPS32R2);
gen_helper_mtc0_srsconf3(cpu_env, arg);
rn = "SRSConf3";
case 5:
check_insn(ctx, ISA_MIPS32R2);
gen_helper_mtc0_srsconf4(cpu_env, arg);
rn = "SRSConf4";
default:
goto cp0_unimplemented;
}
case 7:
switch (sel) {
case 0:
check_insn(ctx, ISA_MIPS32R2);
gen_helper_mtc0_hwrena(cpu_env, arg);
ctx->bstate = BS_STOP;
rn = "HWREna";
default:
goto cp0_unimplemented;
}
case 8:
switch (sel) {
case 0:
/* ignored */
rn = "BadVAddr";
case 1:
/* ignored */
rn = "BadInstr";
/* ignored */
rn = "BadInstrP";
default:
goto cp0_unimplemented;
}
case 9:
switch (sel) {
case 0:
gen_helper_mtc0_count(cpu_env, arg);
rn = "Count";
/* 6,7 are implementation dependent */
default:
goto cp0_unimplemented;
}
case 10:
switch (sel) {
case 0:
gen_helper_mtc0_entryhi(cpu_env, arg);
rn = "EntryHi";
default:
goto cp0_unimplemented;
}
case 11:
switch (sel) {
case 0:
gen_helper_mtc0_compare(cpu_env, arg);
rn = "Compare";
/* 6,7 are implementation dependent */
default:
goto cp0_unimplemented;
}
case 12:
switch (sel) {
case 0:
save_cpu_state(ctx, 1);
gen_helper_mtc0_status(cpu_env, arg);
/* BS_STOP isn't good enough here, hflags may have changed. */
gen_save_pc(ctx->pc + 4);
ctx->bstate = BS_EXCP;
rn = "Status";
case 1:
check_insn(ctx, ISA_MIPS32R2);
gen_helper_mtc0_intctl(cpu_env, arg);
/* Stop translation as we may have switched the execution mode */
ctx->bstate = BS_STOP;
rn = "IntCtl";
check_insn(ctx, ISA_MIPS32R2);
gen_helper_mtc0_srsctl(cpu_env, arg);
/* Stop translation as we may have switched the execution mode */
ctx->bstate = BS_STOP;
rn = "SRSCtl";
check_insn(ctx, ISA_MIPS32R2);
gen_mtc0_store32(arg, offsetof(CPUMIPSState, CP0_SRSMap));
/* Stop translation as we may have switched the execution mode */
ctx->bstate = BS_STOP;
rn = "SRSMap";
default:
goto cp0_unimplemented;
}
case 13:
switch (sel) {
case 0:
save_cpu_state(ctx, 1);
gen_helper_mtc0_cause(cpu_env, arg);
rn = "Cause";
default:
goto cp0_unimplemented;
}
case 14:
switch (sel) {
case 0:
tcg_gen_st_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_EPC));
rn = "EPC";
default:
goto cp0_unimplemented;
}
case 15:
switch (sel) {
case 0:
/* ignored */
rn = "PRid";
case 1:
check_insn(ctx, ISA_MIPS32R2);
gen_helper_mtc0_ebase(cpu_env, arg);
rn = "EBase";
default:
goto cp0_unimplemented;
}
case 16:
switch (sel) {
case 0:
gen_helper_mtc0_config0(cpu_env, arg);
rn = "Config";
/* Stop translation as we may have switched the execution mode */
ctx->bstate = BS_STOP;
case 1:
/* ignored, read only */
rn = "Config1";
gen_helper_mtc0_config2(cpu_env, arg);
rn = "Config2";
/* Stop translation as we may have switched the execution mode */
ctx->bstate = BS_STOP;
gen_helper_mtc0_config3(cpu_env, arg);
rn = "Config3";
/* Stop translation as we may have switched the execution mode */
ctx->bstate = BS_STOP;
gen_helper_mtc0_config4(cpu_env, arg);
rn = "Config4";
ctx->bstate = BS_STOP;
case 5:
gen_helper_mtc0_config5(cpu_env, arg);
rn = "Config5";
/* Stop translation as we may have switched the execution mode */
ctx->bstate = BS_STOP;
/* 6,7 are implementation dependent */
case 6:
/* ignored */
rn = "Config6";
case 7:
/* ignored */
rn = "Config7";
default:
rn = "Invalid config selector";
goto cp0_unimplemented;
}
case 17:
switch (sel) {
case 0:
gen_helper_mtc0_lladdr(cpu_env, arg);
rn = "LLAddr";
case 1:
CP0_CHECK(ctx->mrp);
gen_helper_mtc0_maar(cpu_env, arg);
rn = "MAAR";
CP0_CHECK(ctx->mrp);
gen_helper_mtc0_maari(cpu_env, arg);
rn = "MAARI";
default:
goto cp0_unimplemented;
}
case 18:
switch (sel) {
case 0 ... 7:
gen_helper_0e1i(mtc0_watchlo, arg, sel);
rn = "WatchLo";
default:
goto cp0_unimplemented;
}
case 19:
switch (sel) {
case 0 ... 7:
gen_helper_0e1i(mtc0_watchhi, arg, sel);
rn = "WatchHi";
default:
goto cp0_unimplemented;
}
case 20:
switch (sel) {
case 0:
#if defined(TARGET_MIPS64)
check_insn(ctx, ISA_MIPS3);
gen_helper_mtc0_xcontext(cpu_env, arg);
rn = "XContext";
#endif
default:
goto cp0_unimplemented;
}
case 21:
/* Officially reserved, but sel 0 is used for R1x000 framemask */
CP0_CHECK(!(ctx->insn_flags & ISA_MIPS32R6));
switch (sel) {
case 0:
gen_helper_mtc0_framemask(cpu_env, arg);
rn = "Framemask";
default:
goto cp0_unimplemented;
}
case 22:
/* ignored */
rn = "Diagnostic"; /* implementation dependent */
case 23:
switch (sel) {
case 0:
gen_helper_mtc0_debug(cpu_env, arg); /* EJTAG support */
/* BS_STOP isn't good enough here, hflags may have changed. */
gen_save_pc(ctx->pc + 4);
ctx->bstate = BS_EXCP;
rn = "Debug";
case 1:
// gen_helper_mtc0_tracecontrol(cpu_env, arg); /* PDtrace support */
rn = "TraceControl";
/* Stop translation as we may have switched the execution mode */
ctx->bstate = BS_STOP;
goto cp0_unimplemented;
// gen_helper_mtc0_tracecontrol2(cpu_env, arg); /* PDtrace support */
rn = "TraceControl2";
/* Stop translation as we may have switched the execution mode */
ctx->bstate = BS_STOP;
goto cp0_unimplemented;
/* Stop translation as we may have switched the execution mode */
ctx->bstate = BS_STOP;
// gen_helper_mtc0_usertracedata(cpu_env, arg); /* PDtrace support */
rn = "UserTraceData";
/* Stop translation as we may have switched the execution mode */
ctx->bstate = BS_STOP;
goto cp0_unimplemented;
// gen_helper_mtc0_tracebpc(cpu_env, arg); /* PDtrace support */
/* Stop translation as we may have switched the execution mode */
ctx->bstate = BS_STOP;
rn = "TraceBPC";
goto cp0_unimplemented;
default:
goto cp0_unimplemented;
}
case 24:
switch (sel) {
case 0:
/* EJTAG support */
tcg_gen_st_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_DEPC));
rn = "DEPC";
default:
goto cp0_unimplemented;
}
case 25:
switch (sel) {
case 0:
gen_helper_mtc0_performance0(cpu_env, arg);
rn = "Performance0";
case 1:
// gen_helper_mtc0_performance1(arg);
rn = "Performance1";
goto cp0_unimplemented;
// gen_helper_mtc0_performance2(arg);
rn = "Performance2";
goto cp0_unimplemented;
// gen_helper_mtc0_performance3(arg);
rn = "Performance3";
goto cp0_unimplemented;
// gen_helper_mtc0_performance4(arg);
rn = "Performance4";
goto cp0_unimplemented;
case 5:
// gen_helper_mtc0_performance5(arg);
rn = "Performance5";
goto cp0_unimplemented;
case 6:
// gen_helper_mtc0_performance6(arg);
rn = "Performance6";
goto cp0_unimplemented;
case 7:
// gen_helper_mtc0_performance7(arg);
rn = "Performance7";
goto cp0_unimplemented;
default:
goto cp0_unimplemented;
}
case 26:
switch (sel) {
case 0:
gen_helper_mtc0_errctl(cpu_env, arg);
ctx->bstate = BS_STOP;
rn = "ErrCtl";
default:
goto cp0_unimplemented;
}
case 27:
switch (sel) {
case 0 ... 3:
/* ignored */
rn = "CacheErr";
default:
goto cp0_unimplemented;
}
case 28:
switch (sel) {
case 0:
case 6:
gen_helper_mtc0_taglo(cpu_env, arg);
rn = "TagLo";
case 1:
case 5:
case 7:
gen_helper_mtc0_datalo(cpu_env, arg);
rn = "DataLo";
default:
goto cp0_unimplemented;
}
case 29:
switch (sel) {
case 0:
case 6:
gen_helper_mtc0_taghi(cpu_env, arg);
rn = "TagHi";
case 1:
case 5:
case 7:
gen_helper_mtc0_datahi(cpu_env, arg);
rn = "DataHi";
default:
rn = "invalid sel";
goto cp0_unimplemented;
}
case 30:
switch (sel) {
case 0:
tcg_gen_st_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_ErrorEPC));
rn = "ErrorEPC";
default:
goto cp0_unimplemented;
}
case 31:
switch (sel) {
case 0:
/* EJTAG support */
gen_mtc0_store32(arg, offsetof(CPUMIPSState, CP0_DESAVE));
rn = "DESAVE";
case 2 ... 7:
CP0_CHECK(ctx->kscrexist & (1 << sel));
tcg_gen_st_tl(arg, cpu_env,
offsetof(CPUMIPSState, CP0_KScratch[sel-2]));
rn = "KScratch";
default:
goto cp0_unimplemented;
}
/* Stop translation as we may have switched the execution mode */
ctx->bstate = BS_STOP;
default:
goto cp0_unimplemented;
}
trace_mips_translate_c0("mtc0", rn, reg, sel);
/* For simplicity assume that all writes can cause interrupts. */
if (ctx->tb->cflags & CF_USE_ICOUNT) {
gen_io_end();
ctx->bstate = BS_STOP;
}
return;
cp0_unimplemented:
qemu_log_mask(LOG_UNIMP, "mtc0 %s (reg %d sel %d)\n", rn, reg, sel);
} | true | qemu | cec56a733dd2c3fa81dbedbecf03922258747f7d | static void gen_mtc0(DisasContext *ctx, TCGv arg, int reg, int sel)
{
const char *rn = "invalid";
if (sel != 0)
check_insn(ctx, ISA_MIPS32);
if (ctx->tb->cflags & CF_USE_ICOUNT) {
gen_io_start();
}
switch (reg) {
case 0:
switch (sel) {
case 0:
gen_helper_mtc0_index(cpu_env, arg);
rn = "Index";
case 1:
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mtc0_mvpcontrol(cpu_env, arg);
rn = "MVPControl";
CP0_CHECK(ctx->insn_flags & ASE_MT);
rn = "MVPConf0";
CP0_CHECK(ctx->insn_flags & ASE_MT);
rn = "MVPConf1";
CP0_CHECK(ctx->vp);
rn = "VPControl";
default:
goto cp0_unimplemented;
}
case 1:
switch (sel) {
case 0:
rn = "Random";
case 1:
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mtc0_vpecontrol(cpu_env, arg);
rn = "VPEControl";
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mtc0_vpeconf0(cpu_env, arg);
rn = "VPEConf0";
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mtc0_vpeconf1(cpu_env, arg);
rn = "VPEConf1";
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mtc0_yqmask(cpu_env, arg);
rn = "YQMask";
case 5:
CP0_CHECK(ctx->insn_flags & ASE_MT);
tcg_gen_st_tl(arg, cpu_env,
offsetof(CPUMIPSState, CP0_VPESchedule));
rn = "VPESchedule";
case 6:
CP0_CHECK(ctx->insn_flags & ASE_MT);
tcg_gen_st_tl(arg, cpu_env,
offsetof(CPUMIPSState, CP0_VPEScheFBack));
rn = "VPEScheFBack";
case 7:
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mtc0_vpeopt(cpu_env, arg);
rn = "VPEOpt";
default:
goto cp0_unimplemented;
}
switch (sel) {
case 0:
gen_helper_mtc0_entrylo0(cpu_env, arg);
rn = "EntryLo0";
case 1:
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mtc0_tcstatus(cpu_env, arg);
rn = "TCStatus";
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mtc0_tcbind(cpu_env, arg);
rn = "TCBind";
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mtc0_tcrestart(cpu_env, arg);
rn = "TCRestart";
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mtc0_tchalt(cpu_env, arg);
rn = "TCHalt";
case 5:
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mtc0_tccontext(cpu_env, arg);
rn = "TCContext";
case 6:
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mtc0_tcschedule(cpu_env, arg);
rn = "TCSchedule";
case 7:
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mtc0_tcschefback(cpu_env, arg);
rn = "TCScheFBack";
default:
goto cp0_unimplemented;
}
switch (sel) {
case 0:
gen_helper_mtc0_entrylo1(cpu_env, arg);
rn = "EntryLo1";
case 1:
CP0_CHECK(ctx->vp);
rn = "GlobalNumber";
default:
goto cp0_unimplemented;
}
switch (sel) {
case 0:
gen_helper_mtc0_context(cpu_env, arg);
rn = "Context";
case 1:
rn = "ContextConfig";
goto cp0_unimplemented;
CP0_CHECK(ctx->ulri);
tcg_gen_st_tl(arg, cpu_env,
offsetof(CPUMIPSState, active_tc.CP0_UserLocal));
rn = "UserLocal";
default:
goto cp0_unimplemented;
}
case 5:
switch (sel) {
case 0:
gen_helper_mtc0_pagemask(cpu_env, arg);
rn = "PageMask";
case 1:
check_insn(ctx, ISA_MIPS32R2);
gen_helper_mtc0_pagegrain(cpu_env, arg);
rn = "PageGrain";
ctx->bstate = BS_STOP;
default:
goto cp0_unimplemented;
}
case 6:
switch (sel) {
case 0:
gen_helper_mtc0_wired(cpu_env, arg);
rn = "Wired";
case 1:
check_insn(ctx, ISA_MIPS32R2);
gen_helper_mtc0_srsconf0(cpu_env, arg);
rn = "SRSConf0";
check_insn(ctx, ISA_MIPS32R2);
gen_helper_mtc0_srsconf1(cpu_env, arg);
rn = "SRSConf1";
check_insn(ctx, ISA_MIPS32R2);
gen_helper_mtc0_srsconf2(cpu_env, arg);
rn = "SRSConf2";
check_insn(ctx, ISA_MIPS32R2);
gen_helper_mtc0_srsconf3(cpu_env, arg);
rn = "SRSConf3";
case 5:
check_insn(ctx, ISA_MIPS32R2);
gen_helper_mtc0_srsconf4(cpu_env, arg);
rn = "SRSConf4";
default:
goto cp0_unimplemented;
}
case 7:
switch (sel) {
case 0:
check_insn(ctx, ISA_MIPS32R2);
gen_helper_mtc0_hwrena(cpu_env, arg);
ctx->bstate = BS_STOP;
rn = "HWREna";
default:
goto cp0_unimplemented;
}
case 8:
switch (sel) {
case 0:
rn = "BadVAddr";
case 1:
rn = "BadInstr";
rn = "BadInstrP";
default:
goto cp0_unimplemented;
}
case 9:
switch (sel) {
case 0:
gen_helper_mtc0_count(cpu_env, arg);
rn = "Count";
default:
goto cp0_unimplemented;
}
case 10:
switch (sel) {
case 0:
gen_helper_mtc0_entryhi(cpu_env, arg);
rn = "EntryHi";
default:
goto cp0_unimplemented;
}
case 11:
switch (sel) {
case 0:
gen_helper_mtc0_compare(cpu_env, arg);
rn = "Compare";
default:
goto cp0_unimplemented;
}
case 12:
switch (sel) {
case 0:
save_cpu_state(ctx, 1);
gen_helper_mtc0_status(cpu_env, arg);
gen_save_pc(ctx->pc + 4);
ctx->bstate = BS_EXCP;
rn = "Status";
case 1:
check_insn(ctx, ISA_MIPS32R2);
gen_helper_mtc0_intctl(cpu_env, arg);
ctx->bstate = BS_STOP;
rn = "IntCtl";
check_insn(ctx, ISA_MIPS32R2);
gen_helper_mtc0_srsctl(cpu_env, arg);
ctx->bstate = BS_STOP;
rn = "SRSCtl";
check_insn(ctx, ISA_MIPS32R2);
gen_mtc0_store32(arg, offsetof(CPUMIPSState, CP0_SRSMap));
ctx->bstate = BS_STOP;
rn = "SRSMap";
default:
goto cp0_unimplemented;
}
case 13:
switch (sel) {
case 0:
save_cpu_state(ctx, 1);
gen_helper_mtc0_cause(cpu_env, arg);
rn = "Cause";
default:
goto cp0_unimplemented;
}
case 14:
switch (sel) {
case 0:
tcg_gen_st_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_EPC));
rn = "EPC";
default:
goto cp0_unimplemented;
}
case 15:
switch (sel) {
case 0:
rn = "PRid";
case 1:
check_insn(ctx, ISA_MIPS32R2);
gen_helper_mtc0_ebase(cpu_env, arg);
rn = "EBase";
default:
goto cp0_unimplemented;
}
case 16:
switch (sel) {
case 0:
gen_helper_mtc0_config0(cpu_env, arg);
rn = "Config";
ctx->bstate = BS_STOP;
case 1:
rn = "Config1";
gen_helper_mtc0_config2(cpu_env, arg);
rn = "Config2";
ctx->bstate = BS_STOP;
gen_helper_mtc0_config3(cpu_env, arg);
rn = "Config3";
ctx->bstate = BS_STOP;
gen_helper_mtc0_config4(cpu_env, arg);
rn = "Config4";
ctx->bstate = BS_STOP;
case 5:
gen_helper_mtc0_config5(cpu_env, arg);
rn = "Config5";
ctx->bstate = BS_STOP;
case 6:
rn = "Config6";
case 7:
rn = "Config7";
default:
rn = "Invalid config selector";
goto cp0_unimplemented;
}
case 17:
switch (sel) {
case 0:
gen_helper_mtc0_lladdr(cpu_env, arg);
rn = "LLAddr";
case 1:
CP0_CHECK(ctx->mrp);
gen_helper_mtc0_maar(cpu_env, arg);
rn = "MAAR";
CP0_CHECK(ctx->mrp);
gen_helper_mtc0_maari(cpu_env, arg);
rn = "MAARI";
default:
goto cp0_unimplemented;
}
case 18:
switch (sel) {
case 0 ... 7:
gen_helper_0e1i(mtc0_watchlo, arg, sel);
rn = "WatchLo";
default:
goto cp0_unimplemented;
}
case 19:
switch (sel) {
case 0 ... 7:
gen_helper_0e1i(mtc0_watchhi, arg, sel);
rn = "WatchHi";
default:
goto cp0_unimplemented;
}
case 20:
switch (sel) {
case 0:
#if defined(TARGET_MIPS64)
check_insn(ctx, ISA_MIPS3);
gen_helper_mtc0_xcontext(cpu_env, arg);
rn = "XContext";
#endif
default:
goto cp0_unimplemented;
}
case 21:
CP0_CHECK(!(ctx->insn_flags & ISA_MIPS32R6));
switch (sel) {
case 0:
gen_helper_mtc0_framemask(cpu_env, arg);
rn = "Framemask";
default:
goto cp0_unimplemented;
}
case 22:
rn = "Diagnostic";
case 23:
switch (sel) {
case 0:
gen_helper_mtc0_debug(cpu_env, arg);
gen_save_pc(ctx->pc + 4);
ctx->bstate = BS_EXCP;
rn = "Debug";
case 1:
rn = "TraceControl";
ctx->bstate = BS_STOP;
goto cp0_unimplemented;
rn = "TraceControl2";
ctx->bstate = BS_STOP;
goto cp0_unimplemented;
ctx->bstate = BS_STOP;
rn = "UserTraceData";
ctx->bstate = BS_STOP;
goto cp0_unimplemented;
ctx->bstate = BS_STOP;
rn = "TraceBPC";
goto cp0_unimplemented;
default:
goto cp0_unimplemented;
}
case 24:
switch (sel) {
case 0:
tcg_gen_st_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_DEPC));
rn = "DEPC";
default:
goto cp0_unimplemented;
}
case 25:
switch (sel) {
case 0:
gen_helper_mtc0_performance0(cpu_env, arg);
rn = "Performance0";
case 1:
rn = "Performance1";
goto cp0_unimplemented;
rn = "Performance2";
goto cp0_unimplemented;
rn = "Performance3";
goto cp0_unimplemented;
rn = "Performance4";
goto cp0_unimplemented;
case 5:
rn = "Performance5";
goto cp0_unimplemented;
case 6:
rn = "Performance6";
goto cp0_unimplemented;
case 7:
rn = "Performance7";
goto cp0_unimplemented;
default:
goto cp0_unimplemented;
}
case 26:
switch (sel) {
case 0:
gen_helper_mtc0_errctl(cpu_env, arg);
ctx->bstate = BS_STOP;
rn = "ErrCtl";
default:
goto cp0_unimplemented;
}
case 27:
switch (sel) {
case 0 ... 3:
rn = "CacheErr";
default:
goto cp0_unimplemented;
}
case 28:
switch (sel) {
case 0:
case 6:
gen_helper_mtc0_taglo(cpu_env, arg);
rn = "TagLo";
case 1:
case 5:
case 7:
gen_helper_mtc0_datalo(cpu_env, arg);
rn = "DataLo";
default:
goto cp0_unimplemented;
}
case 29:
switch (sel) {
case 0:
case 6:
gen_helper_mtc0_taghi(cpu_env, arg);
rn = "TagHi";
case 1:
case 5:
case 7:
gen_helper_mtc0_datahi(cpu_env, arg);
rn = "DataHi";
default:
rn = "invalid sel";
goto cp0_unimplemented;
}
case 30:
switch (sel) {
case 0:
tcg_gen_st_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_ErrorEPC));
rn = "ErrorEPC";
default:
goto cp0_unimplemented;
}
case 31:
switch (sel) {
case 0:
gen_mtc0_store32(arg, offsetof(CPUMIPSState, CP0_DESAVE));
rn = "DESAVE";
case 2 ... 7:
CP0_CHECK(ctx->kscrexist & (1 << sel));
tcg_gen_st_tl(arg, cpu_env,
offsetof(CPUMIPSState, CP0_KScratch[sel-2]));
rn = "KScratch";
default:
goto cp0_unimplemented;
}
ctx->bstate = BS_STOP;
default:
goto cp0_unimplemented;
}
trace_mips_translate_c0("mtc0", rn, reg, sel);
if (ctx->tb->cflags & CF_USE_ICOUNT) {
gen_io_end();
ctx->bstate = BS_STOP;
}
return;
cp0_unimplemented:
qemu_log_mask(LOG_UNIMP, "mtc0 %s (reg %d sel %d)\n", rn, reg, sel);
} | {
"code": [],
"line_no": []
} | static void FUNC_0(DisasContext *VAR_0, TCGv VAR_1, int VAR_2, int VAR_3)
{
const char *VAR_4 = "invalid";
if (VAR_3 != 0)
check_insn(VAR_0, ISA_MIPS32);
if (VAR_0->tb->cflags & CF_USE_ICOUNT) {
gen_io_start();
}
switch (VAR_2) {
case 0:
switch (VAR_3) {
case 0:
gen_helper_mtc0_index(cpu_env, VAR_1);
VAR_4 = "Index";
case 1:
CP0_CHECK(VAR_0->insn_flags & ASE_MT);
gen_helper_mtc0_mvpcontrol(cpu_env, VAR_1);
VAR_4 = "MVPControl";
CP0_CHECK(VAR_0->insn_flags & ASE_MT);
VAR_4 = "MVPConf0";
CP0_CHECK(VAR_0->insn_flags & ASE_MT);
VAR_4 = "MVPConf1";
CP0_CHECK(VAR_0->vp);
VAR_4 = "VPControl";
default:
goto cp0_unimplemented;
}
case 1:
switch (VAR_3) {
case 0:
VAR_4 = "Random";
case 1:
CP0_CHECK(VAR_0->insn_flags & ASE_MT);
gen_helper_mtc0_vpecontrol(cpu_env, VAR_1);
VAR_4 = "VPEControl";
CP0_CHECK(VAR_0->insn_flags & ASE_MT);
gen_helper_mtc0_vpeconf0(cpu_env, VAR_1);
VAR_4 = "VPEConf0";
CP0_CHECK(VAR_0->insn_flags & ASE_MT);
gen_helper_mtc0_vpeconf1(cpu_env, VAR_1);
VAR_4 = "VPEConf1";
CP0_CHECK(VAR_0->insn_flags & ASE_MT);
gen_helper_mtc0_yqmask(cpu_env, VAR_1);
VAR_4 = "YQMask";
case 5:
CP0_CHECK(VAR_0->insn_flags & ASE_MT);
tcg_gen_st_tl(VAR_1, cpu_env,
offsetof(CPUMIPSState, CP0_VPESchedule));
VAR_4 = "VPESchedule";
case 6:
CP0_CHECK(VAR_0->insn_flags & ASE_MT);
tcg_gen_st_tl(VAR_1, cpu_env,
offsetof(CPUMIPSState, CP0_VPEScheFBack));
VAR_4 = "VPEScheFBack";
case 7:
CP0_CHECK(VAR_0->insn_flags & ASE_MT);
gen_helper_mtc0_vpeopt(cpu_env, VAR_1);
VAR_4 = "VPEOpt";
default:
goto cp0_unimplemented;
}
switch (VAR_3) {
case 0:
gen_helper_mtc0_entrylo0(cpu_env, VAR_1);
VAR_4 = "EntryLo0";
case 1:
CP0_CHECK(VAR_0->insn_flags & ASE_MT);
gen_helper_mtc0_tcstatus(cpu_env, VAR_1);
VAR_4 = "TCStatus";
CP0_CHECK(VAR_0->insn_flags & ASE_MT);
gen_helper_mtc0_tcbind(cpu_env, VAR_1);
VAR_4 = "TCBind";
CP0_CHECK(VAR_0->insn_flags & ASE_MT);
gen_helper_mtc0_tcrestart(cpu_env, VAR_1);
VAR_4 = "TCRestart";
CP0_CHECK(VAR_0->insn_flags & ASE_MT);
gen_helper_mtc0_tchalt(cpu_env, VAR_1);
VAR_4 = "TCHalt";
case 5:
CP0_CHECK(VAR_0->insn_flags & ASE_MT);
gen_helper_mtc0_tccontext(cpu_env, VAR_1);
VAR_4 = "TCContext";
case 6:
CP0_CHECK(VAR_0->insn_flags & ASE_MT);
gen_helper_mtc0_tcschedule(cpu_env, VAR_1);
VAR_4 = "TCSchedule";
case 7:
CP0_CHECK(VAR_0->insn_flags & ASE_MT);
gen_helper_mtc0_tcschefback(cpu_env, VAR_1);
VAR_4 = "TCScheFBack";
default:
goto cp0_unimplemented;
}
switch (VAR_3) {
case 0:
gen_helper_mtc0_entrylo1(cpu_env, VAR_1);
VAR_4 = "EntryLo1";
case 1:
CP0_CHECK(VAR_0->vp);
VAR_4 = "GlobalNumber";
default:
goto cp0_unimplemented;
}
switch (VAR_3) {
case 0:
gen_helper_mtc0_context(cpu_env, VAR_1);
VAR_4 = "Context";
case 1:
VAR_4 = "ContextConfig";
goto cp0_unimplemented;
CP0_CHECK(VAR_0->ulri);
tcg_gen_st_tl(VAR_1, cpu_env,
offsetof(CPUMIPSState, active_tc.CP0_UserLocal));
VAR_4 = "UserLocal";
default:
goto cp0_unimplemented;
}
case 5:
switch (VAR_3) {
case 0:
gen_helper_mtc0_pagemask(cpu_env, VAR_1);
VAR_4 = "PageMask";
case 1:
check_insn(VAR_0, ISA_MIPS32R2);
gen_helper_mtc0_pagegrain(cpu_env, VAR_1);
VAR_4 = "PageGrain";
VAR_0->bstate = BS_STOP;
default:
goto cp0_unimplemented;
}
case 6:
switch (VAR_3) {
case 0:
gen_helper_mtc0_wired(cpu_env, VAR_1);
VAR_4 = "Wired";
case 1:
check_insn(VAR_0, ISA_MIPS32R2);
gen_helper_mtc0_srsconf0(cpu_env, VAR_1);
VAR_4 = "SRSConf0";
check_insn(VAR_0, ISA_MIPS32R2);
gen_helper_mtc0_srsconf1(cpu_env, VAR_1);
VAR_4 = "SRSConf1";
check_insn(VAR_0, ISA_MIPS32R2);
gen_helper_mtc0_srsconf2(cpu_env, VAR_1);
VAR_4 = "SRSConf2";
check_insn(VAR_0, ISA_MIPS32R2);
gen_helper_mtc0_srsconf3(cpu_env, VAR_1);
VAR_4 = "SRSConf3";
case 5:
check_insn(VAR_0, ISA_MIPS32R2);
gen_helper_mtc0_srsconf4(cpu_env, VAR_1);
VAR_4 = "SRSConf4";
default:
goto cp0_unimplemented;
}
case 7:
switch (VAR_3) {
case 0:
check_insn(VAR_0, ISA_MIPS32R2);
gen_helper_mtc0_hwrena(cpu_env, VAR_1);
VAR_0->bstate = BS_STOP;
VAR_4 = "HWREna";
default:
goto cp0_unimplemented;
}
case 8:
switch (VAR_3) {
case 0:
VAR_4 = "BadVAddr";
case 1:
VAR_4 = "BadInstr";
VAR_4 = "BadInstrP";
default:
goto cp0_unimplemented;
}
case 9:
switch (VAR_3) {
case 0:
gen_helper_mtc0_count(cpu_env, VAR_1);
VAR_4 = "Count";
default:
goto cp0_unimplemented;
}
case 10:
switch (VAR_3) {
case 0:
gen_helper_mtc0_entryhi(cpu_env, VAR_1);
VAR_4 = "EntryHi";
default:
goto cp0_unimplemented;
}
case 11:
switch (VAR_3) {
case 0:
gen_helper_mtc0_compare(cpu_env, VAR_1);
VAR_4 = "Compare";
default:
goto cp0_unimplemented;
}
case 12:
switch (VAR_3) {
case 0:
save_cpu_state(VAR_0, 1);
gen_helper_mtc0_status(cpu_env, VAR_1);
gen_save_pc(VAR_0->pc + 4);
VAR_0->bstate = BS_EXCP;
VAR_4 = "Status";
case 1:
check_insn(VAR_0, ISA_MIPS32R2);
gen_helper_mtc0_intctl(cpu_env, VAR_1);
VAR_0->bstate = BS_STOP;
VAR_4 = "IntCtl";
check_insn(VAR_0, ISA_MIPS32R2);
gen_helper_mtc0_srsctl(cpu_env, VAR_1);
VAR_0->bstate = BS_STOP;
VAR_4 = "SRSCtl";
check_insn(VAR_0, ISA_MIPS32R2);
gen_mtc0_store32(VAR_1, offsetof(CPUMIPSState, CP0_SRSMap));
VAR_0->bstate = BS_STOP;
VAR_4 = "SRSMap";
default:
goto cp0_unimplemented;
}
case 13:
switch (VAR_3) {
case 0:
save_cpu_state(VAR_0, 1);
gen_helper_mtc0_cause(cpu_env, VAR_1);
VAR_4 = "Cause";
default:
goto cp0_unimplemented;
}
case 14:
switch (VAR_3) {
case 0:
tcg_gen_st_tl(VAR_1, cpu_env, offsetof(CPUMIPSState, CP0_EPC));
VAR_4 = "EPC";
default:
goto cp0_unimplemented;
}
case 15:
switch (VAR_3) {
case 0:
VAR_4 = "PRid";
case 1:
check_insn(VAR_0, ISA_MIPS32R2);
gen_helper_mtc0_ebase(cpu_env, VAR_1);
VAR_4 = "EBase";
default:
goto cp0_unimplemented;
}
case 16:
switch (VAR_3) {
case 0:
gen_helper_mtc0_config0(cpu_env, VAR_1);
VAR_4 = "Config";
VAR_0->bstate = BS_STOP;
case 1:
VAR_4 = "Config1";
gen_helper_mtc0_config2(cpu_env, VAR_1);
VAR_4 = "Config2";
VAR_0->bstate = BS_STOP;
gen_helper_mtc0_config3(cpu_env, VAR_1);
VAR_4 = "Config3";
VAR_0->bstate = BS_STOP;
gen_helper_mtc0_config4(cpu_env, VAR_1);
VAR_4 = "Config4";
VAR_0->bstate = BS_STOP;
case 5:
gen_helper_mtc0_config5(cpu_env, VAR_1);
VAR_4 = "Config5";
VAR_0->bstate = BS_STOP;
case 6:
VAR_4 = "Config6";
case 7:
VAR_4 = "Config7";
default:
VAR_4 = "Invalid config selector";
goto cp0_unimplemented;
}
case 17:
switch (VAR_3) {
case 0:
gen_helper_mtc0_lladdr(cpu_env, VAR_1);
VAR_4 = "LLAddr";
case 1:
CP0_CHECK(VAR_0->mrp);
gen_helper_mtc0_maar(cpu_env, VAR_1);
VAR_4 = "MAAR";
CP0_CHECK(VAR_0->mrp);
gen_helper_mtc0_maari(cpu_env, VAR_1);
VAR_4 = "MAARI";
default:
goto cp0_unimplemented;
}
case 18:
switch (VAR_3) {
case 0 ... 7:
gen_helper_0e1i(mtc0_watchlo, VAR_1, VAR_3);
VAR_4 = "WatchLo";
default:
goto cp0_unimplemented;
}
case 19:
switch (VAR_3) {
case 0 ... 7:
gen_helper_0e1i(mtc0_watchhi, VAR_1, VAR_3);
VAR_4 = "WatchHi";
default:
goto cp0_unimplemented;
}
case 20:
switch (VAR_3) {
case 0:
#if defined(TARGET_MIPS64)
check_insn(VAR_0, ISA_MIPS3);
gen_helper_mtc0_xcontext(cpu_env, VAR_1);
VAR_4 = "XContext";
#endif
default:
goto cp0_unimplemented;
}
case 21:
CP0_CHECK(!(VAR_0->insn_flags & ISA_MIPS32R6));
switch (VAR_3) {
case 0:
gen_helper_mtc0_framemask(cpu_env, VAR_1);
VAR_4 = "Framemask";
default:
goto cp0_unimplemented;
}
case 22:
VAR_4 = "Diagnostic";
case 23:
switch (VAR_3) {
case 0:
gen_helper_mtc0_debug(cpu_env, VAR_1);
gen_save_pc(VAR_0->pc + 4);
VAR_0->bstate = BS_EXCP;
VAR_4 = "Debug";
case 1:
VAR_4 = "TraceControl";
VAR_0->bstate = BS_STOP;
goto cp0_unimplemented;
VAR_4 = "TraceControl2";
VAR_0->bstate = BS_STOP;
goto cp0_unimplemented;
VAR_0->bstate = BS_STOP;
VAR_4 = "UserTraceData";
VAR_0->bstate = BS_STOP;
goto cp0_unimplemented;
VAR_0->bstate = BS_STOP;
VAR_4 = "TraceBPC";
goto cp0_unimplemented;
default:
goto cp0_unimplemented;
}
case 24:
switch (VAR_3) {
case 0:
tcg_gen_st_tl(VAR_1, cpu_env, offsetof(CPUMIPSState, CP0_DEPC));
VAR_4 = "DEPC";
default:
goto cp0_unimplemented;
}
case 25:
switch (VAR_3) {
case 0:
gen_helper_mtc0_performance0(cpu_env, VAR_1);
VAR_4 = "Performance0";
case 1:
VAR_4 = "Performance1";
goto cp0_unimplemented;
VAR_4 = "Performance2";
goto cp0_unimplemented;
VAR_4 = "Performance3";
goto cp0_unimplemented;
VAR_4 = "Performance4";
goto cp0_unimplemented;
case 5:
VAR_4 = "Performance5";
goto cp0_unimplemented;
case 6:
VAR_4 = "Performance6";
goto cp0_unimplemented;
case 7:
VAR_4 = "Performance7";
goto cp0_unimplemented;
default:
goto cp0_unimplemented;
}
case 26:
switch (VAR_3) {
case 0:
gen_helper_mtc0_errctl(cpu_env, VAR_1);
VAR_0->bstate = BS_STOP;
VAR_4 = "ErrCtl";
default:
goto cp0_unimplemented;
}
case 27:
switch (VAR_3) {
case 0 ... 3:
VAR_4 = "CacheErr";
default:
goto cp0_unimplemented;
}
case 28:
switch (VAR_3) {
case 0:
case 6:
gen_helper_mtc0_taglo(cpu_env, VAR_1);
VAR_4 = "TagLo";
case 1:
case 5:
case 7:
gen_helper_mtc0_datalo(cpu_env, VAR_1);
VAR_4 = "DataLo";
default:
goto cp0_unimplemented;
}
case 29:
switch (VAR_3) {
case 0:
case 6:
gen_helper_mtc0_taghi(cpu_env, VAR_1);
VAR_4 = "TagHi";
case 1:
case 5:
case 7:
gen_helper_mtc0_datahi(cpu_env, VAR_1);
VAR_4 = "DataHi";
default:
VAR_4 = "invalid VAR_3";
goto cp0_unimplemented;
}
case 30:
switch (VAR_3) {
case 0:
tcg_gen_st_tl(VAR_1, cpu_env, offsetof(CPUMIPSState, CP0_ErrorEPC));
VAR_4 = "ErrorEPC";
default:
goto cp0_unimplemented;
}
case 31:
switch (VAR_3) {
case 0:
gen_mtc0_store32(VAR_1, offsetof(CPUMIPSState, CP0_DESAVE));
VAR_4 = "DESAVE";
case 2 ... 7:
CP0_CHECK(VAR_0->kscrexist & (1 << VAR_3));
tcg_gen_st_tl(VAR_1, cpu_env,
offsetof(CPUMIPSState, CP0_KScratch[VAR_3-2]));
VAR_4 = "KScratch";
default:
goto cp0_unimplemented;
}
VAR_0->bstate = BS_STOP;
default:
goto cp0_unimplemented;
}
trace_mips_translate_c0("mtc0", VAR_4, VAR_2, VAR_3);
if (VAR_0->tb->cflags & CF_USE_ICOUNT) {
gen_io_end();
VAR_0->bstate = BS_STOP;
}
return;
cp0_unimplemented:
qemu_log_mask(LOG_UNIMP, "mtc0 %s (VAR_2 %d VAR_3 %d)\n", VAR_4, VAR_2, VAR_3);
} | [
"static void FUNC_0(DisasContext *VAR_0, TCGv VAR_1, int VAR_2, int VAR_3)\n{",
"const char *VAR_4 = \"invalid\";",
"if (VAR_3 != 0)\ncheck_insn(VAR_0, ISA_MIPS32);",
"if (VAR_0->tb->cflags & CF_USE_ICOUNT) {",
"gen_io_start();",
"}",
"switch (VAR_2) {",
"case 0:\nswitch (VAR_3) {",
"case 0:\ngen_helper_mtc0_index(cpu_env, VAR_1);",
"VAR_4 = \"Index\";",
"case 1:\nCP0_CHECK(VAR_0->insn_flags & ASE_MT);",
"gen_helper_mtc0_mvpcontrol(cpu_env, VAR_1);",
"VAR_4 = \"MVPControl\";",
"CP0_CHECK(VAR_0->insn_flags & ASE_MT);",
"VAR_4 = \"MVPConf0\";",
"CP0_CHECK(VAR_0->insn_flags & ASE_MT);",
"VAR_4 = \"MVPConf1\";",
"CP0_CHECK(VAR_0->vp);",
"VAR_4 = \"VPControl\";",
"default:\ngoto cp0_unimplemented;",
"}",
"case 1:\nswitch (VAR_3) {",
"case 0:\nVAR_4 = \"Random\";",
"case 1:\nCP0_CHECK(VAR_0->insn_flags & ASE_MT);",
"gen_helper_mtc0_vpecontrol(cpu_env, VAR_1);",
"VAR_4 = \"VPEControl\";",
"CP0_CHECK(VAR_0->insn_flags & ASE_MT);",
"gen_helper_mtc0_vpeconf0(cpu_env, VAR_1);",
"VAR_4 = \"VPEConf0\";",
"CP0_CHECK(VAR_0->insn_flags & ASE_MT);",
"gen_helper_mtc0_vpeconf1(cpu_env, VAR_1);",
"VAR_4 = \"VPEConf1\";",
"CP0_CHECK(VAR_0->insn_flags & ASE_MT);",
"gen_helper_mtc0_yqmask(cpu_env, VAR_1);",
"VAR_4 = \"YQMask\";",
"case 5:\nCP0_CHECK(VAR_0->insn_flags & ASE_MT);",
"tcg_gen_st_tl(VAR_1, cpu_env,\noffsetof(CPUMIPSState, CP0_VPESchedule));",
"VAR_4 = \"VPESchedule\";",
"case 6:\nCP0_CHECK(VAR_0->insn_flags & ASE_MT);",
"tcg_gen_st_tl(VAR_1, cpu_env,\noffsetof(CPUMIPSState, CP0_VPEScheFBack));",
"VAR_4 = \"VPEScheFBack\";",
"case 7:\nCP0_CHECK(VAR_0->insn_flags & ASE_MT);",
"gen_helper_mtc0_vpeopt(cpu_env, VAR_1);",
"VAR_4 = \"VPEOpt\";",
"default:\ngoto cp0_unimplemented;",
"}",
"switch (VAR_3) {",
"case 0:\ngen_helper_mtc0_entrylo0(cpu_env, VAR_1);",
"VAR_4 = \"EntryLo0\";",
"case 1:\nCP0_CHECK(VAR_0->insn_flags & ASE_MT);",
"gen_helper_mtc0_tcstatus(cpu_env, VAR_1);",
"VAR_4 = \"TCStatus\";",
"CP0_CHECK(VAR_0->insn_flags & ASE_MT);",
"gen_helper_mtc0_tcbind(cpu_env, VAR_1);",
"VAR_4 = \"TCBind\";",
"CP0_CHECK(VAR_0->insn_flags & ASE_MT);",
"gen_helper_mtc0_tcrestart(cpu_env, VAR_1);",
"VAR_4 = \"TCRestart\";",
"CP0_CHECK(VAR_0->insn_flags & ASE_MT);",
"gen_helper_mtc0_tchalt(cpu_env, VAR_1);",
"VAR_4 = \"TCHalt\";",
"case 5:\nCP0_CHECK(VAR_0->insn_flags & ASE_MT);",
"gen_helper_mtc0_tccontext(cpu_env, VAR_1);",
"VAR_4 = \"TCContext\";",
"case 6:\nCP0_CHECK(VAR_0->insn_flags & ASE_MT);",
"gen_helper_mtc0_tcschedule(cpu_env, VAR_1);",
"VAR_4 = \"TCSchedule\";",
"case 7:\nCP0_CHECK(VAR_0->insn_flags & ASE_MT);",
"gen_helper_mtc0_tcschefback(cpu_env, VAR_1);",
"VAR_4 = \"TCScheFBack\";",
"default:\ngoto cp0_unimplemented;",
"}",
"switch (VAR_3) {",
"case 0:\ngen_helper_mtc0_entrylo1(cpu_env, VAR_1);",
"VAR_4 = \"EntryLo1\";",
"case 1:\nCP0_CHECK(VAR_0->vp);",
"VAR_4 = \"GlobalNumber\";",
"default:\ngoto cp0_unimplemented;",
"}",
"switch (VAR_3) {",
"case 0:\ngen_helper_mtc0_context(cpu_env, VAR_1);",
"VAR_4 = \"Context\";",
"case 1:\nVAR_4 = \"ContextConfig\";",
"goto cp0_unimplemented;",
"CP0_CHECK(VAR_0->ulri);",
"tcg_gen_st_tl(VAR_1, cpu_env,\noffsetof(CPUMIPSState, active_tc.CP0_UserLocal));",
"VAR_4 = \"UserLocal\";",
"default:\ngoto cp0_unimplemented;",
"}",
"case 5:\nswitch (VAR_3) {",
"case 0:\ngen_helper_mtc0_pagemask(cpu_env, VAR_1);",
"VAR_4 = \"PageMask\";",
"case 1:\ncheck_insn(VAR_0, ISA_MIPS32R2);",
"gen_helper_mtc0_pagegrain(cpu_env, VAR_1);",
"VAR_4 = \"PageGrain\";",
"VAR_0->bstate = BS_STOP;",
"default:\ngoto cp0_unimplemented;",
"}",
"case 6:\nswitch (VAR_3) {",
"case 0:\ngen_helper_mtc0_wired(cpu_env, VAR_1);",
"VAR_4 = \"Wired\";",
"case 1:\ncheck_insn(VAR_0, ISA_MIPS32R2);",
"gen_helper_mtc0_srsconf0(cpu_env, VAR_1);",
"VAR_4 = \"SRSConf0\";",
"check_insn(VAR_0, ISA_MIPS32R2);",
"gen_helper_mtc0_srsconf1(cpu_env, VAR_1);",
"VAR_4 = \"SRSConf1\";",
"check_insn(VAR_0, ISA_MIPS32R2);",
"gen_helper_mtc0_srsconf2(cpu_env, VAR_1);",
"VAR_4 = \"SRSConf2\";",
"check_insn(VAR_0, ISA_MIPS32R2);",
"gen_helper_mtc0_srsconf3(cpu_env, VAR_1);",
"VAR_4 = \"SRSConf3\";",
"case 5:\ncheck_insn(VAR_0, ISA_MIPS32R2);",
"gen_helper_mtc0_srsconf4(cpu_env, VAR_1);",
"VAR_4 = \"SRSConf4\";",
"default:\ngoto cp0_unimplemented;",
"}",
"case 7:\nswitch (VAR_3) {",
"case 0:\ncheck_insn(VAR_0, ISA_MIPS32R2);",
"gen_helper_mtc0_hwrena(cpu_env, VAR_1);",
"VAR_0->bstate = BS_STOP;",
"VAR_4 = \"HWREna\";",
"default:\ngoto cp0_unimplemented;",
"}",
"case 8:\nswitch (VAR_3) {",
"case 0:\nVAR_4 = \"BadVAddr\";",
"case 1:\nVAR_4 = \"BadInstr\";",
"VAR_4 = \"BadInstrP\";",
"default:\ngoto cp0_unimplemented;",
"}",
"case 9:\nswitch (VAR_3) {",
"case 0:\ngen_helper_mtc0_count(cpu_env, VAR_1);",
"VAR_4 = \"Count\";",
"default:\ngoto cp0_unimplemented;",
"}",
"case 10:\nswitch (VAR_3) {",
"case 0:\ngen_helper_mtc0_entryhi(cpu_env, VAR_1);",
"VAR_4 = \"EntryHi\";",
"default:\ngoto cp0_unimplemented;",
"}",
"case 11:\nswitch (VAR_3) {",
"case 0:\ngen_helper_mtc0_compare(cpu_env, VAR_1);",
"VAR_4 = \"Compare\";",
"default:\ngoto cp0_unimplemented;",
"}",
"case 12:\nswitch (VAR_3) {",
"case 0:\nsave_cpu_state(VAR_0, 1);",
"gen_helper_mtc0_status(cpu_env, VAR_1);",
"gen_save_pc(VAR_0->pc + 4);",
"VAR_0->bstate = BS_EXCP;",
"VAR_4 = \"Status\";",
"case 1:\ncheck_insn(VAR_0, ISA_MIPS32R2);",
"gen_helper_mtc0_intctl(cpu_env, VAR_1);",
"VAR_0->bstate = BS_STOP;",
"VAR_4 = \"IntCtl\";",
"check_insn(VAR_0, ISA_MIPS32R2);",
"gen_helper_mtc0_srsctl(cpu_env, VAR_1);",
"VAR_0->bstate = BS_STOP;",
"VAR_4 = \"SRSCtl\";",
"check_insn(VAR_0, ISA_MIPS32R2);",
"gen_mtc0_store32(VAR_1, offsetof(CPUMIPSState, CP0_SRSMap));",
"VAR_0->bstate = BS_STOP;",
"VAR_4 = \"SRSMap\";",
"default:\ngoto cp0_unimplemented;",
"}",
"case 13:\nswitch (VAR_3) {",
"case 0:\nsave_cpu_state(VAR_0, 1);",
"gen_helper_mtc0_cause(cpu_env, VAR_1);",
"VAR_4 = \"Cause\";",
"default:\ngoto cp0_unimplemented;",
"}",
"case 14:\nswitch (VAR_3) {",
"case 0:\ntcg_gen_st_tl(VAR_1, cpu_env, offsetof(CPUMIPSState, CP0_EPC));",
"VAR_4 = \"EPC\";",
"default:\ngoto cp0_unimplemented;",
"}",
"case 15:\nswitch (VAR_3) {",
"case 0:\nVAR_4 = \"PRid\";",
"case 1:\ncheck_insn(VAR_0, ISA_MIPS32R2);",
"gen_helper_mtc0_ebase(cpu_env, VAR_1);",
"VAR_4 = \"EBase\";",
"default:\ngoto cp0_unimplemented;",
"}",
"case 16:\nswitch (VAR_3) {",
"case 0:\ngen_helper_mtc0_config0(cpu_env, VAR_1);",
"VAR_4 = \"Config\";",
"VAR_0->bstate = BS_STOP;",
"case 1:\nVAR_4 = \"Config1\";",
"gen_helper_mtc0_config2(cpu_env, VAR_1);",
"VAR_4 = \"Config2\";",
"VAR_0->bstate = BS_STOP;",
"gen_helper_mtc0_config3(cpu_env, VAR_1);",
"VAR_4 = \"Config3\";",
"VAR_0->bstate = BS_STOP;",
"gen_helper_mtc0_config4(cpu_env, VAR_1);",
"VAR_4 = \"Config4\";",
"VAR_0->bstate = BS_STOP;",
"case 5:\ngen_helper_mtc0_config5(cpu_env, VAR_1);",
"VAR_4 = \"Config5\";",
"VAR_0->bstate = BS_STOP;",
"case 6:\nVAR_4 = \"Config6\";",
"case 7:\nVAR_4 = \"Config7\";",
"default:\nVAR_4 = \"Invalid config selector\";",
"goto cp0_unimplemented;",
"}",
"case 17:\nswitch (VAR_3) {",
"case 0:\ngen_helper_mtc0_lladdr(cpu_env, VAR_1);",
"VAR_4 = \"LLAddr\";",
"case 1:\nCP0_CHECK(VAR_0->mrp);",
"gen_helper_mtc0_maar(cpu_env, VAR_1);",
"VAR_4 = \"MAAR\";",
"CP0_CHECK(VAR_0->mrp);",
"gen_helper_mtc0_maari(cpu_env, VAR_1);",
"VAR_4 = \"MAARI\";",
"default:\ngoto cp0_unimplemented;",
"}",
"case 18:\nswitch (VAR_3) {",
"case 0 ... 7:\ngen_helper_0e1i(mtc0_watchlo, VAR_1, VAR_3);",
"VAR_4 = \"WatchLo\";",
"default:\ngoto cp0_unimplemented;",
"}",
"case 19:\nswitch (VAR_3) {",
"case 0 ... 7:\ngen_helper_0e1i(mtc0_watchhi, VAR_1, VAR_3);",
"VAR_4 = \"WatchHi\";",
"default:\ngoto cp0_unimplemented;",
"}",
"case 20:\nswitch (VAR_3) {",
"case 0:\n#if defined(TARGET_MIPS64)\ncheck_insn(VAR_0, ISA_MIPS3);",
"gen_helper_mtc0_xcontext(cpu_env, VAR_1);",
"VAR_4 = \"XContext\";",
"#endif\ndefault:\ngoto cp0_unimplemented;",
"}",
"case 21:\nCP0_CHECK(!(VAR_0->insn_flags & ISA_MIPS32R6));",
"switch (VAR_3) {",
"case 0:\ngen_helper_mtc0_framemask(cpu_env, VAR_1);",
"VAR_4 = \"Framemask\";",
"default:\ngoto cp0_unimplemented;",
"}",
"case 22:\nVAR_4 = \"Diagnostic\";",
"case 23:\nswitch (VAR_3) {",
"case 0:\ngen_helper_mtc0_debug(cpu_env, VAR_1);",
"gen_save_pc(VAR_0->pc + 4);",
"VAR_0->bstate = BS_EXCP;",
"VAR_4 = \"Debug\";",
"case 1:\nVAR_4 = \"TraceControl\";",
"VAR_0->bstate = BS_STOP;",
"goto cp0_unimplemented;",
"VAR_4 = \"TraceControl2\";",
"VAR_0->bstate = BS_STOP;",
"goto cp0_unimplemented;",
"VAR_0->bstate = BS_STOP;",
"VAR_4 = \"UserTraceData\";",
"VAR_0->bstate = BS_STOP;",
"goto cp0_unimplemented;",
"VAR_0->bstate = BS_STOP;",
"VAR_4 = \"TraceBPC\";",
"goto cp0_unimplemented;",
"default:\ngoto cp0_unimplemented;",
"}",
"case 24:\nswitch (VAR_3) {",
"case 0:\ntcg_gen_st_tl(VAR_1, cpu_env, offsetof(CPUMIPSState, CP0_DEPC));",
"VAR_4 = \"DEPC\";",
"default:\ngoto cp0_unimplemented;",
"}",
"case 25:\nswitch (VAR_3) {",
"case 0:\ngen_helper_mtc0_performance0(cpu_env, VAR_1);",
"VAR_4 = \"Performance0\";",
"case 1:\nVAR_4 = \"Performance1\";",
"goto cp0_unimplemented;",
"VAR_4 = \"Performance2\";",
"goto cp0_unimplemented;",
"VAR_4 = \"Performance3\";",
"goto cp0_unimplemented;",
"VAR_4 = \"Performance4\";",
"goto cp0_unimplemented;",
"case 5:\nVAR_4 = \"Performance5\";",
"goto cp0_unimplemented;",
"case 6:\nVAR_4 = \"Performance6\";",
"goto cp0_unimplemented;",
"case 7:\nVAR_4 = \"Performance7\";",
"goto cp0_unimplemented;",
"default:\ngoto cp0_unimplemented;",
"}",
"case 26:\nswitch (VAR_3) {",
"case 0:\ngen_helper_mtc0_errctl(cpu_env, VAR_1);",
"VAR_0->bstate = BS_STOP;",
"VAR_4 = \"ErrCtl\";",
"default:\ngoto cp0_unimplemented;",
"}",
"case 27:\nswitch (VAR_3) {",
"case 0 ... 3:\nVAR_4 = \"CacheErr\";",
"default:\ngoto cp0_unimplemented;",
"}",
"case 28:\nswitch (VAR_3) {",
"case 0:\ncase 6:\ngen_helper_mtc0_taglo(cpu_env, VAR_1);",
"VAR_4 = \"TagLo\";",
"case 1:\ncase 5:\ncase 7:\ngen_helper_mtc0_datalo(cpu_env, VAR_1);",
"VAR_4 = \"DataLo\";",
"default:\ngoto cp0_unimplemented;",
"}",
"case 29:\nswitch (VAR_3) {",
"case 0:\ncase 6:\ngen_helper_mtc0_taghi(cpu_env, VAR_1);",
"VAR_4 = \"TagHi\";",
"case 1:\ncase 5:\ncase 7:\ngen_helper_mtc0_datahi(cpu_env, VAR_1);",
"VAR_4 = \"DataHi\";",
"default:\nVAR_4 = \"invalid VAR_3\";",
"goto cp0_unimplemented;",
"}",
"case 30:\nswitch (VAR_3) {",
"case 0:\ntcg_gen_st_tl(VAR_1, cpu_env, offsetof(CPUMIPSState, CP0_ErrorEPC));",
"VAR_4 = \"ErrorEPC\";",
"default:\ngoto cp0_unimplemented;",
"}",
"case 31:\nswitch (VAR_3) {",
"case 0:\ngen_mtc0_store32(VAR_1, offsetof(CPUMIPSState, CP0_DESAVE));",
"VAR_4 = \"DESAVE\";",
"case 2 ... 7:\nCP0_CHECK(VAR_0->kscrexist & (1 << VAR_3));",
"tcg_gen_st_tl(VAR_1, cpu_env,\noffsetof(CPUMIPSState, CP0_KScratch[VAR_3-2]));",
"VAR_4 = \"KScratch\";",
"default:\ngoto cp0_unimplemented;",
"}",
"VAR_0->bstate = BS_STOP;",
"default:\ngoto cp0_unimplemented;",
"}",
"trace_mips_translate_c0(\"mtc0\", VAR_4, VAR_2, VAR_3);",
"if (VAR_0->tb->cflags & CF_USE_ICOUNT) {",
"gen_io_end();",
"VAR_0->bstate = BS_STOP;",
"}",
"return;",
"cp0_unimplemented:\nqemu_log_mask(LOG_UNIMP, \"mtc0 %s (VAR_2 %d VAR_3 %d)\\n\", VAR_4, VAR_2, VAR_3);",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
9,
11
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25,
27
],
[
29,
31
],
[
33
],
[
36,
38
],
[
40
],
[
42
],
[
46
],
[
50
],
[
54
],
[
58
],
[
62
],
[
66
],
[
69,
71
],
[
73
],
[
76,
78
],
[
80,
84
],
[
87,
89
],
[
91
],
[
93
],
[
97
],
[
99
],
[
101
],
[
105
],
[
107
],
[
109
],
[
113
],
[
115
],
[
117
],
[
120,
122
],
[
124,
126
],
[
128
],
[
131,
133
],
[
135,
137
],
[
139
],
[
142,
144
],
[
146
],
[
148
],
[
151,
153
],
[
155
],
[
159
],
[
161,
163
],
[
165
],
[
168,
170
],
[
172
],
[
174
],
[
178
],
[
180
],
[
182
],
[
186
],
[
188
],
[
190
],
[
194
],
[
196
],
[
198
],
[
201,
203
],
[
205
],
[
207
],
[
210,
212
],
[
214
],
[
216
],
[
219,
221
],
[
223
],
[
225
],
[
228,
230
],
[
232
],
[
236
],
[
238,
240
],
[
242
],
[
245,
247
],
[
251
],
[
254,
256
],
[
258
],
[
262
],
[
264,
266
],
[
268
],
[
271,
275
],
[
277
],
[
280
],
[
282,
284
],
[
286
],
[
289,
291
],
[
293
],
[
296,
298
],
[
300,
302
],
[
304
],
[
307,
309
],
[
311
],
[
313
],
[
315
],
[
333,
335
],
[
337
],
[
340,
342
],
[
344,
346
],
[
348
],
[
351,
353
],
[
355
],
[
357
],
[
361
],
[
363
],
[
365
],
[
369
],
[
371
],
[
373
],
[
377
],
[
379
],
[
381
],
[
384,
386
],
[
388
],
[
390
],
[
393,
395
],
[
397
],
[
400,
402
],
[
404,
406
],
[
408
],
[
410
],
[
412
],
[
415,
417
],
[
419
],
[
422,
424
],
[
426,
430
],
[
433,
437
],
[
443
],
[
446,
448
],
[
450
],
[
453,
455
],
[
457,
459
],
[
461
],
[
466,
468
],
[
470
],
[
473,
475
],
[
477,
479
],
[
481
],
[
484,
486
],
[
488
],
[
491,
493
],
[
495,
497
],
[
499
],
[
504,
506
],
[
508
],
[
511,
513
],
[
515,
517
],
[
519
],
[
523
],
[
525
],
[
527
],
[
530,
532
],
[
534
],
[
538
],
[
540
],
[
544
],
[
546
],
[
550
],
[
552
],
[
556
],
[
558
],
[
562
],
[
564
],
[
567,
569
],
[
571
],
[
574,
576
],
[
578,
580
],
[
582
],
[
584
],
[
587,
589
],
[
591
],
[
594,
596
],
[
598,
600
],
[
602
],
[
605,
607
],
[
609
],
[
612,
614
],
[
616,
620
],
[
623,
625
],
[
627
],
[
629
],
[
632,
634
],
[
636
],
[
639,
641
],
[
643,
645
],
[
647
],
[
651
],
[
654,
658
],
[
662
],
[
664
],
[
668
],
[
672
],
[
674
],
[
678
],
[
682
],
[
684
],
[
686
],
[
689,
691
],
[
693
],
[
697
],
[
702,
706
],
[
709,
713
],
[
716,
718
],
[
720
],
[
722
],
[
725,
727
],
[
729,
731
],
[
733
],
[
736,
738
],
[
740
],
[
742
],
[
746
],
[
748
],
[
750
],
[
753,
755
],
[
757
],
[
760,
762
],
[
764,
766
],
[
768
],
[
771,
773
],
[
775
],
[
778,
780
],
[
782,
784
],
[
786
],
[
789,
791
],
[
793
],
[
796,
798
],
[
800,
802,
804
],
[
806
],
[
808
],
[
811,
813,
815
],
[
817
],
[
820,
824
],
[
826
],
[
828,
830
],
[
832
],
[
835,
837
],
[
839
],
[
842,
846
],
[
849,
851
],
[
853,
855
],
[
859
],
[
861
],
[
863
],
[
866,
870
],
[
874
],
[
876
],
[
881
],
[
885
],
[
887
],
[
892
],
[
896
],
[
900
],
[
902
],
[
909
],
[
911
],
[
913
],
[
915,
917
],
[
919
],
[
922,
924
],
[
926,
930
],
[
932
],
[
935,
937
],
[
939
],
[
942,
944
],
[
946,
948
],
[
950
],
[
953,
957
],
[
959
],
[
964
],
[
966
],
[
971
],
[
973
],
[
978
],
[
980
],
[
982,
986
],
[
988
],
[
990,
994
],
[
996
],
[
998,
1002
],
[
1004
],
[
1006,
1008
],
[
1010
],
[
1013,
1015
],
[
1017,
1019
],
[
1021
],
[
1023
],
[
1026,
1028
],
[
1030
],
[
1033,
1035
],
[
1037,
1041
],
[
1044,
1046
],
[
1048
],
[
1051,
1053
],
[
1055,
1059,
1061
],
[
1063
],
[
1066,
1069,
1071,
1073
],
[
1075
],
[
1078,
1080
],
[
1082
],
[
1085,
1087
],
[
1089,
1093,
1095
],
[
1097
],
[
1100,
1103,
1105,
1107
],
[
1109
],
[
1112,
1114
],
[
1116
],
[
1118
],
[
1121,
1123
],
[
1125,
1127
],
[
1129
],
[
1132,
1134
],
[
1136
],
[
1139,
1141
],
[
1143,
1147
],
[
1149
],
[
1152,
1154
],
[
1156,
1158
],
[
1160
],
[
1163,
1165
],
[
1167
],
[
1171
],
[
1174,
1176
],
[
1178
],
[
1180
],
[
1186
],
[
1188
],
[
1190
],
[
1192
],
[
1194
],
[
1198,
1200
],
[
1202
]
]
|
12,345 | void cpu_loop(CPUARMState *env)
{
int trapnr;
unsigned int n, insn;
target_siginfo_t info;
uint32_t addr;
for(;;) {
cpu_exec_start(env);
trapnr = cpu_arm_exec(env);
cpu_exec_end(env);
switch(trapnr) {
case EXCP_UDEF:
{
TaskState *ts = env->opaque;
uint32_t opcode;
int rc;
/* we handle the FPU emulation here, as Linux */
/* we get the opcode */
/* FIXME - what to do if get_user() fails? */
get_user_u32(opcode, env->regs[15]);
rc = EmulateAll(opcode, &ts->fpa, env);
if (rc == 0) { /* illegal instruction */
info.si_signo = SIGILL;
info.si_errno = 0;
info.si_code = TARGET_ILL_ILLOPN;
info._sifields._sigfault._addr = env->regs[15];
queue_signal(env, info.si_signo, &info);
} else if (rc < 0) { /* FP exception */
int arm_fpe=0;
/* translate softfloat flags to FPSR flags */
if (-rc & float_flag_invalid)
arm_fpe |= BIT_IOC;
if (-rc & float_flag_divbyzero)
arm_fpe |= BIT_DZC;
if (-rc & float_flag_overflow)
arm_fpe |= BIT_OFC;
if (-rc & float_flag_underflow)
arm_fpe |= BIT_UFC;
if (-rc & float_flag_inexact)
arm_fpe |= BIT_IXC;
FPSR fpsr = ts->fpa.fpsr;
//printf("fpsr 0x%x, arm_fpe 0x%x\n",fpsr,arm_fpe);
if (fpsr & (arm_fpe << 16)) { /* exception enabled? */
info.si_signo = SIGFPE;
info.si_errno = 0;
/* ordered by priority, least first */
if (arm_fpe & BIT_IXC) info.si_code = TARGET_FPE_FLTRES;
if (arm_fpe & BIT_UFC) info.si_code = TARGET_FPE_FLTUND;
if (arm_fpe & BIT_OFC) info.si_code = TARGET_FPE_FLTOVF;
if (arm_fpe & BIT_DZC) info.si_code = TARGET_FPE_FLTDIV;
if (arm_fpe & BIT_IOC) info.si_code = TARGET_FPE_FLTINV;
info._sifields._sigfault._addr = env->regs[15];
queue_signal(env, info.si_signo, &info);
} else {
env->regs[15] += 4;
}
/* accumulate unenabled exceptions */
if ((!(fpsr & BIT_IXE)) && (arm_fpe & BIT_IXC))
fpsr |= BIT_IXC;
if ((!(fpsr & BIT_UFE)) && (arm_fpe & BIT_UFC))
fpsr |= BIT_UFC;
if ((!(fpsr & BIT_OFE)) && (arm_fpe & BIT_OFC))
fpsr |= BIT_OFC;
if ((!(fpsr & BIT_DZE)) && (arm_fpe & BIT_DZC))
fpsr |= BIT_DZC;
if ((!(fpsr & BIT_IOE)) && (arm_fpe & BIT_IOC))
fpsr |= BIT_IOC;
ts->fpa.fpsr=fpsr;
} else { /* everything OK */
/* increment PC */
env->regs[15] += 4;
}
}
break;
case EXCP_SWI:
case EXCP_BKPT:
{
env->eabi = 1;
/* system call */
if (trapnr == EXCP_BKPT) {
if (env->thumb) {
/* FIXME - what to do if get_user() fails? */
get_user_u16(insn, env->regs[15]);
n = insn & 0xff;
env->regs[15] += 2;
} else {
/* FIXME - what to do if get_user() fails? */
get_user_u32(insn, env->regs[15]);
n = (insn & 0xf) | ((insn >> 4) & 0xff0);
env->regs[15] += 4;
}
} else {
if (env->thumb) {
/* FIXME - what to do if get_user() fails? */
get_user_u16(insn, env->regs[15] - 2);
n = insn & 0xff;
} else {
/* FIXME - what to do if get_user() fails? */
get_user_u32(insn, env->regs[15] - 4);
n = insn & 0xffffff;
}
}
if (n == ARM_NR_cacheflush) {
/* nop */
} else if (n == ARM_NR_semihosting
|| n == ARM_NR_thumb_semihosting) {
env->regs[0] = do_arm_semihosting (env);
} else if (n == 0 || n >= ARM_SYSCALL_BASE
|| (env->thumb && n == ARM_THUMB_SYSCALL)) {
/* linux syscall */
if (env->thumb || n == 0) {
n = env->regs[7];
} else {
n -= ARM_SYSCALL_BASE;
env->eabi = 0;
}
if ( n > ARM_NR_BASE) {
switch (n) {
case ARM_NR_cacheflush:
/* nop */
break;
case ARM_NR_set_tls:
cpu_set_tls(env, env->regs[0]);
env->regs[0] = 0;
break;
default:
gemu_log("qemu: Unsupported ARM syscall: 0x%x\n",
n);
env->regs[0] = -TARGET_ENOSYS;
break;
}
} else {
env->regs[0] = do_syscall(env,
n,
env->regs[0],
env->regs[1],
env->regs[2],
env->regs[3],
env->regs[4],
env->regs[5],
0, 0);
}
} else {
goto error;
}
}
break;
case EXCP_INTERRUPT:
/* just indicate that signals should be handled asap */
break;
case EXCP_PREFETCH_ABORT:
addr = env->cp15.c6_insn;
goto do_segv;
case EXCP_DATA_ABORT:
addr = env->cp15.c6_data;
do_segv:
{
info.si_signo = SIGSEGV;
info.si_errno = 0;
/* XXX: check env->error_code */
info.si_code = TARGET_SEGV_MAPERR;
info._sifields._sigfault._addr = addr;
queue_signal(env, info.si_signo, &info);
}
break;
case EXCP_DEBUG:
{
int sig;
sig = gdb_handlesig (env, TARGET_SIGTRAP);
if (sig)
{
info.si_signo = sig;
info.si_errno = 0;
info.si_code = TARGET_TRAP_BRKPT;
queue_signal(env, info.si_signo, &info);
}
}
break;
case EXCP_KERNEL_TRAP:
if (do_kernel_trap(env))
goto error;
break;
case EXCP_STREX:
if (do_strex(env)) {
addr = env->cp15.c6_data;
goto do_segv;
}
break;
default:
error:
fprintf(stderr, "qemu: unhandled CPU exception 0x%x - aborting\n",
trapnr);
cpu_dump_state(env, stderr, fprintf, 0);
abort();
}
process_pending_signals(env);
}
}
| true | qemu | d8fd2954996255ba6ad610917e7849832d0120b7 | void cpu_loop(CPUARMState *env)
{
int trapnr;
unsigned int n, insn;
target_siginfo_t info;
uint32_t addr;
for(;;) {
cpu_exec_start(env);
trapnr = cpu_arm_exec(env);
cpu_exec_end(env);
switch(trapnr) {
case EXCP_UDEF:
{
TaskState *ts = env->opaque;
uint32_t opcode;
int rc;
get_user_u32(opcode, env->regs[15]);
rc = EmulateAll(opcode, &ts->fpa, env);
if (rc == 0) {
info.si_signo = SIGILL;
info.si_errno = 0;
info.si_code = TARGET_ILL_ILLOPN;
info._sifields._sigfault._addr = env->regs[15];
queue_signal(env, info.si_signo, &info);
} else if (rc < 0) {
int arm_fpe=0;
if (-rc & float_flag_invalid)
arm_fpe |= BIT_IOC;
if (-rc & float_flag_divbyzero)
arm_fpe |= BIT_DZC;
if (-rc & float_flag_overflow)
arm_fpe |= BIT_OFC;
if (-rc & float_flag_underflow)
arm_fpe |= BIT_UFC;
if (-rc & float_flag_inexact)
arm_fpe |= BIT_IXC;
FPSR fpsr = ts->fpa.fpsr;
if (fpsr & (arm_fpe << 16)) {
info.si_signo = SIGFPE;
info.si_errno = 0;
if (arm_fpe & BIT_IXC) info.si_code = TARGET_FPE_FLTRES;
if (arm_fpe & BIT_UFC) info.si_code = TARGET_FPE_FLTUND;
if (arm_fpe & BIT_OFC) info.si_code = TARGET_FPE_FLTOVF;
if (arm_fpe & BIT_DZC) info.si_code = TARGET_FPE_FLTDIV;
if (arm_fpe & BIT_IOC) info.si_code = TARGET_FPE_FLTINV;
info._sifields._sigfault._addr = env->regs[15];
queue_signal(env, info.si_signo, &info);
} else {
env->regs[15] += 4;
}
if ((!(fpsr & BIT_IXE)) && (arm_fpe & BIT_IXC))
fpsr |= BIT_IXC;
if ((!(fpsr & BIT_UFE)) && (arm_fpe & BIT_UFC))
fpsr |= BIT_UFC;
if ((!(fpsr & BIT_OFE)) && (arm_fpe & BIT_OFC))
fpsr |= BIT_OFC;
if ((!(fpsr & BIT_DZE)) && (arm_fpe & BIT_DZC))
fpsr |= BIT_DZC;
if ((!(fpsr & BIT_IOE)) && (arm_fpe & BIT_IOC))
fpsr |= BIT_IOC;
ts->fpa.fpsr=fpsr;
} else {
env->regs[15] += 4;
}
}
break;
case EXCP_SWI:
case EXCP_BKPT:
{
env->eabi = 1;
if (trapnr == EXCP_BKPT) {
if (env->thumb) {
get_user_u16(insn, env->regs[15]);
n = insn & 0xff;
env->regs[15] += 2;
} else {
get_user_u32(insn, env->regs[15]);
n = (insn & 0xf) | ((insn >> 4) & 0xff0);
env->regs[15] += 4;
}
} else {
if (env->thumb) {
get_user_u16(insn, env->regs[15] - 2);
n = insn & 0xff;
} else {
get_user_u32(insn, env->regs[15] - 4);
n = insn & 0xffffff;
}
}
if (n == ARM_NR_cacheflush) {
} else if (n == ARM_NR_semihosting
|| n == ARM_NR_thumb_semihosting) {
env->regs[0] = do_arm_semihosting (env);
} else if (n == 0 || n >= ARM_SYSCALL_BASE
|| (env->thumb && n == ARM_THUMB_SYSCALL)) {
if (env->thumb || n == 0) {
n = env->regs[7];
} else {
n -= ARM_SYSCALL_BASE;
env->eabi = 0;
}
if ( n > ARM_NR_BASE) {
switch (n) {
case ARM_NR_cacheflush:
break;
case ARM_NR_set_tls:
cpu_set_tls(env, env->regs[0]);
env->regs[0] = 0;
break;
default:
gemu_log("qemu: Unsupported ARM syscall: 0x%x\n",
n);
env->regs[0] = -TARGET_ENOSYS;
break;
}
} else {
env->regs[0] = do_syscall(env,
n,
env->regs[0],
env->regs[1],
env->regs[2],
env->regs[3],
env->regs[4],
env->regs[5],
0, 0);
}
} else {
goto error;
}
}
break;
case EXCP_INTERRUPT:
break;
case EXCP_PREFETCH_ABORT:
addr = env->cp15.c6_insn;
goto do_segv;
case EXCP_DATA_ABORT:
addr = env->cp15.c6_data;
do_segv:
{
info.si_signo = SIGSEGV;
info.si_errno = 0;
info.si_code = TARGET_SEGV_MAPERR;
info._sifields._sigfault._addr = addr;
queue_signal(env, info.si_signo, &info);
}
break;
case EXCP_DEBUG:
{
int sig;
sig = gdb_handlesig (env, TARGET_SIGTRAP);
if (sig)
{
info.si_signo = sig;
info.si_errno = 0;
info.si_code = TARGET_TRAP_BRKPT;
queue_signal(env, info.si_signo, &info);
}
}
break;
case EXCP_KERNEL_TRAP:
if (do_kernel_trap(env))
goto error;
break;
case EXCP_STREX:
if (do_strex(env)) {
addr = env->cp15.c6_data;
goto do_segv;
}
break;
default:
error:
fprintf(stderr, "qemu: unhandled CPU exception 0x%x - aborting\n",
trapnr);
cpu_dump_state(env, stderr, fprintf, 0);
abort();
}
process_pending_signals(env);
}
}
| {
"code": [
" get_user_u32(opcode, env->regs[15]);",
" get_user_u16(insn, env->regs[15]);",
" get_user_u32(insn, env->regs[15]);",
" get_user_u16(insn, env->regs[15] - 2);",
" get_user_u32(insn, env->regs[15] - 4);"
],
"line_no": [
43,
183,
193,
207,
215
]
} | void FUNC_0(CPUARMState *VAR_0)
{
int VAR_1;
unsigned int VAR_2, VAR_3;
target_siginfo_t info;
uint32_t addr;
for(;;) {
cpu_exec_start(VAR_0);
VAR_1 = cpu_arm_exec(VAR_0);
cpu_exec_end(VAR_0);
switch(VAR_1) {
case EXCP_UDEF:
{
TaskState *ts = VAR_0->opaque;
uint32_t opcode;
int VAR_4;
get_user_u32(opcode, VAR_0->regs[15]);
VAR_4 = EmulateAll(opcode, &ts->fpa, VAR_0);
if (VAR_4 == 0) {
info.si_signo = SIGILL;
info.si_errno = 0;
info.si_code = TARGET_ILL_ILLOPN;
info._sifields._sigfault._addr = VAR_0->regs[15];
queue_signal(VAR_0, info.si_signo, &info);
} else if (VAR_4 < 0) {
int VAR_5=0;
if (-VAR_4 & float_flag_invalid)
VAR_5 |= BIT_IOC;
if (-VAR_4 & float_flag_divbyzero)
VAR_5 |= BIT_DZC;
if (-VAR_4 & float_flag_overflow)
VAR_5 |= BIT_OFC;
if (-VAR_4 & float_flag_underflow)
VAR_5 |= BIT_UFC;
if (-VAR_4 & float_flag_inexact)
VAR_5 |= BIT_IXC;
FPSR fpsr = ts->fpa.fpsr;
if (fpsr & (VAR_5 << 16)) {
info.si_signo = SIGFPE;
info.si_errno = 0;
if (VAR_5 & BIT_IXC) info.si_code = TARGET_FPE_FLTRES;
if (VAR_5 & BIT_UFC) info.si_code = TARGET_FPE_FLTUND;
if (VAR_5 & BIT_OFC) info.si_code = TARGET_FPE_FLTOVF;
if (VAR_5 & BIT_DZC) info.si_code = TARGET_FPE_FLTDIV;
if (VAR_5 & BIT_IOC) info.si_code = TARGET_FPE_FLTINV;
info._sifields._sigfault._addr = VAR_0->regs[15];
queue_signal(VAR_0, info.si_signo, &info);
} else {
VAR_0->regs[15] += 4;
}
if ((!(fpsr & BIT_IXE)) && (VAR_5 & BIT_IXC))
fpsr |= BIT_IXC;
if ((!(fpsr & BIT_UFE)) && (VAR_5 & BIT_UFC))
fpsr |= BIT_UFC;
if ((!(fpsr & BIT_OFE)) && (VAR_5 & BIT_OFC))
fpsr |= BIT_OFC;
if ((!(fpsr & BIT_DZE)) && (VAR_5 & BIT_DZC))
fpsr |= BIT_DZC;
if ((!(fpsr & BIT_IOE)) && (VAR_5 & BIT_IOC))
fpsr |= BIT_IOC;
ts->fpa.fpsr=fpsr;
} else {
VAR_0->regs[15] += 4;
}
}
break;
case EXCP_SWI:
case EXCP_BKPT:
{
VAR_0->eabi = 1;
if (VAR_1 == EXCP_BKPT) {
if (VAR_0->thumb) {
get_user_u16(VAR_3, VAR_0->regs[15]);
VAR_2 = VAR_3 & 0xff;
VAR_0->regs[15] += 2;
} else {
get_user_u32(VAR_3, VAR_0->regs[15]);
VAR_2 = (VAR_3 & 0xf) | ((VAR_3 >> 4) & 0xff0);
VAR_0->regs[15] += 4;
}
} else {
if (VAR_0->thumb) {
get_user_u16(VAR_3, VAR_0->regs[15] - 2);
VAR_2 = VAR_3 & 0xff;
} else {
get_user_u32(VAR_3, VAR_0->regs[15] - 4);
VAR_2 = VAR_3 & 0xffffff;
}
}
if (VAR_2 == ARM_NR_cacheflush) {
} else if (VAR_2 == ARM_NR_semihosting
|| VAR_2 == ARM_NR_thumb_semihosting) {
VAR_0->regs[0] = do_arm_semihosting (VAR_0);
} else if (VAR_2 == 0 || VAR_2 >= ARM_SYSCALL_BASE
|| (VAR_0->thumb && VAR_2 == ARM_THUMB_SYSCALL)) {
if (VAR_0->thumb || VAR_2 == 0) {
VAR_2 = VAR_0->regs[7];
} else {
VAR_2 -= ARM_SYSCALL_BASE;
VAR_0->eabi = 0;
}
if ( VAR_2 > ARM_NR_BASE) {
switch (VAR_2) {
case ARM_NR_cacheflush:
break;
case ARM_NR_set_tls:
cpu_set_tls(VAR_0, VAR_0->regs[0]);
VAR_0->regs[0] = 0;
break;
default:
gemu_log("qemu: Unsupported ARM syscall: 0x%x\VAR_2",
VAR_2);
VAR_0->regs[0] = -TARGET_ENOSYS;
break;
}
} else {
VAR_0->regs[0] = do_syscall(VAR_0,
VAR_2,
VAR_0->regs[0],
VAR_0->regs[1],
VAR_0->regs[2],
VAR_0->regs[3],
VAR_0->regs[4],
VAR_0->regs[5],
0, 0);
}
} else {
goto error;
}
}
break;
case EXCP_INTERRUPT:
break;
case EXCP_PREFETCH_ABORT:
addr = VAR_0->cp15.c6_insn;
goto do_segv;
case EXCP_DATA_ABORT:
addr = VAR_0->cp15.c6_data;
do_segv:
{
info.si_signo = SIGSEGV;
info.si_errno = 0;
info.si_code = TARGET_SEGV_MAPERR;
info._sifields._sigfault._addr = addr;
queue_signal(VAR_0, info.si_signo, &info);
}
break;
case EXCP_DEBUG:
{
int VAR_6;
VAR_6 = gdb_handlesig (VAR_0, TARGET_SIGTRAP);
if (VAR_6)
{
info.si_signo = VAR_6;
info.si_errno = 0;
info.si_code = TARGET_TRAP_BRKPT;
queue_signal(VAR_0, info.si_signo, &info);
}
}
break;
case EXCP_KERNEL_TRAP:
if (do_kernel_trap(VAR_0))
goto error;
break;
case EXCP_STREX:
if (do_strex(VAR_0)) {
addr = VAR_0->cp15.c6_data;
goto do_segv;
}
break;
default:
error:
fprintf(stderr, "qemu: unhandled CPU exception 0x%x - aborting\VAR_2",
VAR_1);
cpu_dump_state(VAR_0, stderr, fprintf, 0);
abort();
}
process_pending_signals(VAR_0);
}
}
| [
"void FUNC_0(CPUARMState *VAR_0)\n{",
"int VAR_1;",
"unsigned int VAR_2, VAR_3;",
"target_siginfo_t info;",
"uint32_t addr;",
"for(;;) {",
"cpu_exec_start(VAR_0);",
"VAR_1 = cpu_arm_exec(VAR_0);",
"cpu_exec_end(VAR_0);",
"switch(VAR_1) {",
"case EXCP_UDEF:\n{",
"TaskState *ts = VAR_0->opaque;",
"uint32_t opcode;",
"int VAR_4;",
"get_user_u32(opcode, VAR_0->regs[15]);",
"VAR_4 = EmulateAll(opcode, &ts->fpa, VAR_0);",
"if (VAR_4 == 0) {",
"info.si_signo = SIGILL;",
"info.si_errno = 0;",
"info.si_code = TARGET_ILL_ILLOPN;",
"info._sifields._sigfault._addr = VAR_0->regs[15];",
"queue_signal(VAR_0, info.si_signo, &info);",
"} else if (VAR_4 < 0) {",
"int VAR_5=0;",
"if (-VAR_4 & float_flag_invalid)\nVAR_5 |= BIT_IOC;",
"if (-VAR_4 & float_flag_divbyzero)\nVAR_5 |= BIT_DZC;",
"if (-VAR_4 & float_flag_overflow)\nVAR_5 |= BIT_OFC;",
"if (-VAR_4 & float_flag_underflow)\nVAR_5 |= BIT_UFC;",
"if (-VAR_4 & float_flag_inexact)\nVAR_5 |= BIT_IXC;",
"FPSR fpsr = ts->fpa.fpsr;",
"if (fpsr & (VAR_5 << 16)) {",
"info.si_signo = SIGFPE;",
"info.si_errno = 0;",
"if (VAR_5 & BIT_IXC) info.si_code = TARGET_FPE_FLTRES;",
"if (VAR_5 & BIT_UFC) info.si_code = TARGET_FPE_FLTUND;",
"if (VAR_5 & BIT_OFC) info.si_code = TARGET_FPE_FLTOVF;",
"if (VAR_5 & BIT_DZC) info.si_code = TARGET_FPE_FLTDIV;",
"if (VAR_5 & BIT_IOC) info.si_code = TARGET_FPE_FLTINV;",
"info._sifields._sigfault._addr = VAR_0->regs[15];",
"queue_signal(VAR_0, info.si_signo, &info);",
"} else {",
"VAR_0->regs[15] += 4;",
"}",
"if ((!(fpsr & BIT_IXE)) && (VAR_5 & BIT_IXC))\nfpsr |= BIT_IXC;",
"if ((!(fpsr & BIT_UFE)) && (VAR_5 & BIT_UFC))\nfpsr |= BIT_UFC;",
"if ((!(fpsr & BIT_OFE)) && (VAR_5 & BIT_OFC))\nfpsr |= BIT_OFC;",
"if ((!(fpsr & BIT_DZE)) && (VAR_5 & BIT_DZC))\nfpsr |= BIT_DZC;",
"if ((!(fpsr & BIT_IOE)) && (VAR_5 & BIT_IOC))\nfpsr |= BIT_IOC;",
"ts->fpa.fpsr=fpsr;",
"} else {",
"VAR_0->regs[15] += 4;",
"}",
"}",
"break;",
"case EXCP_SWI:\ncase EXCP_BKPT:\n{",
"VAR_0->eabi = 1;",
"if (VAR_1 == EXCP_BKPT) {",
"if (VAR_0->thumb) {",
"get_user_u16(VAR_3, VAR_0->regs[15]);",
"VAR_2 = VAR_3 & 0xff;",
"VAR_0->regs[15] += 2;",
"} else {",
"get_user_u32(VAR_3, VAR_0->regs[15]);",
"VAR_2 = (VAR_3 & 0xf) | ((VAR_3 >> 4) & 0xff0);",
"VAR_0->regs[15] += 4;",
"}",
"} else {",
"if (VAR_0->thumb) {",
"get_user_u16(VAR_3, VAR_0->regs[15] - 2);",
"VAR_2 = VAR_3 & 0xff;",
"} else {",
"get_user_u32(VAR_3, VAR_0->regs[15] - 4);",
"VAR_2 = VAR_3 & 0xffffff;",
"}",
"}",
"if (VAR_2 == ARM_NR_cacheflush) {",
"} else if (VAR_2 == ARM_NR_semihosting",
"|| VAR_2 == ARM_NR_thumb_semihosting) {",
"VAR_0->regs[0] = do_arm_semihosting (VAR_0);",
"} else if (VAR_2 == 0 || VAR_2 >= ARM_SYSCALL_BASE",
"|| (VAR_0->thumb && VAR_2 == ARM_THUMB_SYSCALL)) {",
"if (VAR_0->thumb || VAR_2 == 0) {",
"VAR_2 = VAR_0->regs[7];",
"} else {",
"VAR_2 -= ARM_SYSCALL_BASE;",
"VAR_0->eabi = 0;",
"}",
"if ( VAR_2 > ARM_NR_BASE) {",
"switch (VAR_2) {",
"case ARM_NR_cacheflush:\nbreak;",
"case ARM_NR_set_tls:\ncpu_set_tls(VAR_0, VAR_0->regs[0]);",
"VAR_0->regs[0] = 0;",
"break;",
"default:\ngemu_log(\"qemu: Unsupported ARM syscall: 0x%x\\VAR_2\",\nVAR_2);",
"VAR_0->regs[0] = -TARGET_ENOSYS;",
"break;",
"}",
"} else {",
"VAR_0->regs[0] = do_syscall(VAR_0,\nVAR_2,\nVAR_0->regs[0],\nVAR_0->regs[1],\nVAR_0->regs[2],\nVAR_0->regs[3],\nVAR_0->regs[4],\nVAR_0->regs[5],\n0, 0);",
"}",
"} else {",
"goto error;",
"}",
"}",
"break;",
"case EXCP_INTERRUPT:\nbreak;",
"case EXCP_PREFETCH_ABORT:\naddr = VAR_0->cp15.c6_insn;",
"goto do_segv;",
"case EXCP_DATA_ABORT:\naddr = VAR_0->cp15.c6_data;",
"do_segv:\n{",
"info.si_signo = SIGSEGV;",
"info.si_errno = 0;",
"info.si_code = TARGET_SEGV_MAPERR;",
"info._sifields._sigfault._addr = addr;",
"queue_signal(VAR_0, info.si_signo, &info);",
"}",
"break;",
"case EXCP_DEBUG:\n{",
"int VAR_6;",
"VAR_6 = gdb_handlesig (VAR_0, TARGET_SIGTRAP);",
"if (VAR_6)\n{",
"info.si_signo = VAR_6;",
"info.si_errno = 0;",
"info.si_code = TARGET_TRAP_BRKPT;",
"queue_signal(VAR_0, info.si_signo, &info);",
"}",
"}",
"break;",
"case EXCP_KERNEL_TRAP:\nif (do_kernel_trap(VAR_0))\ngoto error;",
"break;",
"case EXCP_STREX:\nif (do_strex(VAR_0)) {",
"addr = VAR_0->cp15.c6_data;",
"goto do_segv;",
"}",
"break;",
"default:\nerror:\nfprintf(stderr, \"qemu: unhandled CPU exception 0x%x - aborting\\VAR_2\",\nVAR_1);",
"cpu_dump_state(VAR_0, stderr, fprintf, 0);",
"abort();",
"}",
"process_pending_signals(VAR_0);",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
1,
0,
0,
0,
0,
0,
1,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
43
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
69,
71
],
[
73,
75
],
[
77,
79
],
[
81,
83
],
[
85,
87
],
[
91
],
[
97
],
[
99
],
[
101
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
133,
135
],
[
137,
139
],
[
141,
143
],
[
145,
147
],
[
149,
151
],
[
153
],
[
155
],
[
159
],
[
161
],
[
163
],
[
165
],
[
167,
169,
171
],
[
173
],
[
177
],
[
179
],
[
183
],
[
185
],
[
187
],
[
189
],
[
193
],
[
195
],
[
197
],
[
199
],
[
201
],
[
203
],
[
207
],
[
209
],
[
211
],
[
215
],
[
217
],
[
219
],
[
221
],
[
225
],
[
229
],
[
231
],
[
233
],
[
235
],
[
237
],
[
241
],
[
243
],
[
245
],
[
247
],
[
249
],
[
251
],
[
253
],
[
255
],
[
257,
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,
319
],
[
321,
323
],
[
325
],
[
327,
329
],
[
331,
333
],
[
335
],
[
337
],
[
341
],
[
343
],
[
345
],
[
347
],
[
349
],
[
351,
353
],
[
355
],
[
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
]
]
|
12,346 | static uint32_t cc_calc_abs_32(int32_t dst)
{
if ((uint32_t)dst == 0x80000000UL) {
return 3;
} else if (dst) {
return 1;
} else {
return 0;
}
}
| true | qemu | 2aaa1940684a3bf2b381fd2a8ff26c287a05109d | static uint32_t cc_calc_abs_32(int32_t dst)
{
if ((uint32_t)dst == 0x80000000UL) {
return 3;
} else if (dst) {
return 1;
} else {
return 0;
}
}
| {
"code": [
" return 1;",
" return 1;"
],
"line_no": [
11,
11
]
} | static uint32_t FUNC_0(int32_t dst)
{
if ((uint32_t)dst == 0x80000000UL) {
return 3;
} else if (dst) {
return 1;
} else {
return 0;
}
}
| [
"static uint32_t FUNC_0(int32_t dst)\n{",
"if ((uint32_t)dst == 0x80000000UL) {",
"return 3;",
"} else if (dst) {",
"return 1;",
"} else {",
"return 0;",
"}",
"}"
]
| [
0,
0,
0,
0,
1,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
]
]
|
12,348 | static int qemu_chr_open_pipe(QemuOpts *opts, CharDriverState **_chr)
{
int fd_in, fd_out;
char filename_in[256], filename_out[256];
const char *filename = qemu_opt_get(opts, "path");
if (filename == NULL) {
fprintf(stderr, "chardev: pipe: no filename given\n");
return -EINVAL;
}
snprintf(filename_in, 256, "%s.in", filename);
snprintf(filename_out, 256, "%s.out", filename);
TFR(fd_in = qemu_open(filename_in, O_RDWR | O_BINARY));
TFR(fd_out = qemu_open(filename_out, O_RDWR | O_BINARY));
if (fd_in < 0 || fd_out < 0) {
if (fd_in >= 0)
close(fd_in);
if (fd_out >= 0)
close(fd_out);
TFR(fd_in = fd_out = qemu_open(filename, O_RDWR | O_BINARY));
if (fd_in < 0) {
return -errno;
}
}
*_chr = qemu_chr_open_fd(fd_in, fd_out);
return 0;
}
| true | qemu | 1f51470d044852592922f91000e741c381582cdc | static int qemu_chr_open_pipe(QemuOpts *opts, CharDriverState **_chr)
{
int fd_in, fd_out;
char filename_in[256], filename_out[256];
const char *filename = qemu_opt_get(opts, "path");
if (filename == NULL) {
fprintf(stderr, "chardev: pipe: no filename given\n");
return -EINVAL;
}
snprintf(filename_in, 256, "%s.in", filename);
snprintf(filename_out, 256, "%s.out", filename);
TFR(fd_in = qemu_open(filename_in, O_RDWR | O_BINARY));
TFR(fd_out = qemu_open(filename_out, O_RDWR | O_BINARY));
if (fd_in < 0 || fd_out < 0) {
if (fd_in >= 0)
close(fd_in);
if (fd_out >= 0)
close(fd_out);
TFR(fd_in = fd_out = qemu_open(filename, O_RDWR | O_BINARY));
if (fd_in < 0) {
return -errno;
}
}
*_chr = qemu_chr_open_fd(fd_in, fd_out);
return 0;
}
| {
"code": [
" return 0;",
" return 0;",
" return 0;",
" return 0;",
" return 0;",
"static int qemu_chr_open_pipe(QemuOpts *opts, CharDriverState **_chr)",
" return -EINVAL;",
" TFR(fd_in = fd_out = qemu_open(filename, O_RDWR | O_BINARY));",
" if (fd_in < 0) {",
" return -errno;",
" *_chr = qemu_chr_open_fd(fd_in, fd_out);",
" return 0;",
" return 0;",
" return 0;",
" return 0;",
" return 0;",
" return 0;",
" return 0;",
" return 0;",
" return 0;",
" return 0;",
" return 0;",
" return 0;",
" return -EINVAL;",
" return -EINVAL;",
" return 0;"
],
"line_no": [
55,
55,
55,
55,
55,
1,
17,
41,
43,
45,
53,
55,
55,
55,
55,
55,
55,
55,
55,
55,
55,
55,
55,
17,
17,
55
]
} | static int FUNC_0(QemuOpts *VAR_0, CharDriverState **VAR_1)
{
int VAR_2, VAR_3;
char VAR_4[256], VAR_5[256];
const char *VAR_6 = qemu_opt_get(VAR_0, "path");
if (VAR_6 == NULL) {
fprintf(stderr, "chardev: pipe: no VAR_6 given\n");
return -EINVAL;
}
snprintf(VAR_4, 256, "%s.in", VAR_6);
snprintf(VAR_5, 256, "%s.out", VAR_6);
TFR(VAR_2 = qemu_open(VAR_4, O_RDWR | O_BINARY));
TFR(VAR_3 = qemu_open(VAR_5, O_RDWR | O_BINARY));
if (VAR_2 < 0 || VAR_3 < 0) {
if (VAR_2 >= 0)
close(VAR_2);
if (VAR_3 >= 0)
close(VAR_3);
TFR(VAR_2 = VAR_3 = qemu_open(VAR_6, O_RDWR | O_BINARY));
if (VAR_2 < 0) {
return -errno;
}
}
*VAR_1 = qemu_chr_open_fd(VAR_2, VAR_3);
return 0;
}
| [
"static int FUNC_0(QemuOpts *VAR_0, CharDriverState **VAR_1)\n{",
"int VAR_2, VAR_3;",
"char VAR_4[256], VAR_5[256];",
"const char *VAR_6 = qemu_opt_get(VAR_0, \"path\");",
"if (VAR_6 == NULL) {",
"fprintf(stderr, \"chardev: pipe: no VAR_6 given\\n\");",
"return -EINVAL;",
"}",
"snprintf(VAR_4, 256, \"%s.in\", VAR_6);",
"snprintf(VAR_5, 256, \"%s.out\", VAR_6);",
"TFR(VAR_2 = qemu_open(VAR_4, O_RDWR | O_BINARY));",
"TFR(VAR_3 = qemu_open(VAR_5, O_RDWR | O_BINARY));",
"if (VAR_2 < 0 || VAR_3 < 0) {",
"if (VAR_2 >= 0)\nclose(VAR_2);",
"if (VAR_3 >= 0)\nclose(VAR_3);",
"TFR(VAR_2 = VAR_3 = qemu_open(VAR_6, O_RDWR | O_BINARY));",
"if (VAR_2 < 0) {",
"return -errno;",
"}",
"}",
"*VAR_1 = qemu_chr_open_fd(VAR_2, VAR_3);",
"return 0;",
"}"
]
| [
1,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
1,
0,
0,
1,
1,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33,
35
],
[
37,
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
53
],
[
55
],
[
57
]
]
|
12,349 | static void vp5_parse_coeff(VP56Context *s)
{
VP56RangeCoder *c = &s->c;
VP56Model *model = s->modelp;
uint8_t *permute = s->idct_scantable;
uint8_t *model1, *model2;
int coeff, sign, coeff_idx;
int b, i, cg, idx, ctx, ctx_last;
int pt = 0; /* plane type (0 for Y, 1 for U or V) */
for (b=0; b<6; b++) {
int ct = 1; /* code type */
if (b > 3) pt = 1;
ctx = 6*s->coeff_ctx[ff_vp56_b6to4[b]][0]
+ s->above_blocks[s->above_block_idx[b]].not_null_dc;
model1 = model->coeff_dccv[pt];
model2 = model->coeff_dcct[pt][ctx];
coeff_idx = 0;
for (;;) {
if (vp56_rac_get_prob_branchy(c, model2[0])) {
if (vp56_rac_get_prob_branchy(c, model2[2])) {
if (vp56_rac_get_prob_branchy(c, model2[3])) {
s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx] = 4;
idx = vp56_rac_get_tree(c, ff_vp56_pc_tree, model1);
sign = vp56_rac_get(c);
coeff = ff_vp56_coeff_bias[idx+5];
for (i=ff_vp56_coeff_bit_length[idx]; i>=0; i--)
coeff += vp56_rac_get_prob(c, ff_vp56_coeff_parse_table[idx][i]) << i;
} else {
if (vp56_rac_get_prob_branchy(c, model2[4])) {
coeff = 3 + vp56_rac_get_prob(c, model1[5]);
s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx] = 3;
} else {
coeff = 2;
s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx] = 2;
}
sign = vp56_rac_get(c);
}
ct = 2;
} else {
ct = 1;
s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx] = 1;
sign = vp56_rac_get(c);
coeff = 1;
}
coeff = (coeff ^ -sign) + sign;
if (coeff_idx)
coeff *= s->dequant_ac;
s->block_coeff[b][permute[coeff_idx]] = coeff;
} else {
if (ct && !vp56_rac_get_prob_branchy(c, model2[1]))
break;
ct = 0;
s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx] = 0;
}
coeff_idx++;
if (coeff_idx >= 64)
break;
cg = vp5_coeff_groups[coeff_idx];
ctx = s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx];
model1 = model->coeff_ract[pt][ct][cg];
model2 = cg > 2 ? model1 : model->coeff_acct[pt][ct][cg][ctx];
}
ctx_last = FFMIN(s->coeff_ctx_last[ff_vp56_b6to4[b]], 24);
s->coeff_ctx_last[ff_vp56_b6to4[b]] = coeff_idx;
if (coeff_idx < ctx_last)
for (i=coeff_idx; i<=ctx_last; i++)
s->coeff_ctx[ff_vp56_b6to4[b]][i] = 5;
s->above_blocks[s->above_block_idx[b]].not_null_dc = s->coeff_ctx[ff_vp56_b6to4[b]][0];
}
}
| true | FFmpeg | 9e6a2427558a718be0c1fffacffd935f630a7a8d | static void vp5_parse_coeff(VP56Context *s)
{
VP56RangeCoder *c = &s->c;
VP56Model *model = s->modelp;
uint8_t *permute = s->idct_scantable;
uint8_t *model1, *model2;
int coeff, sign, coeff_idx;
int b, i, cg, idx, ctx, ctx_last;
int pt = 0;
for (b=0; b<6; b++) {
int ct = 1;
if (b > 3) pt = 1;
ctx = 6*s->coeff_ctx[ff_vp56_b6to4[b]][0]
+ s->above_blocks[s->above_block_idx[b]].not_null_dc;
model1 = model->coeff_dccv[pt];
model2 = model->coeff_dcct[pt][ctx];
coeff_idx = 0;
for (;;) {
if (vp56_rac_get_prob_branchy(c, model2[0])) {
if (vp56_rac_get_prob_branchy(c, model2[2])) {
if (vp56_rac_get_prob_branchy(c, model2[3])) {
s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx] = 4;
idx = vp56_rac_get_tree(c, ff_vp56_pc_tree, model1);
sign = vp56_rac_get(c);
coeff = ff_vp56_coeff_bias[idx+5];
for (i=ff_vp56_coeff_bit_length[idx]; i>=0; i--)
coeff += vp56_rac_get_prob(c, ff_vp56_coeff_parse_table[idx][i]) << i;
} else {
if (vp56_rac_get_prob_branchy(c, model2[4])) {
coeff = 3 + vp56_rac_get_prob(c, model1[5]);
s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx] = 3;
} else {
coeff = 2;
s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx] = 2;
}
sign = vp56_rac_get(c);
}
ct = 2;
} else {
ct = 1;
s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx] = 1;
sign = vp56_rac_get(c);
coeff = 1;
}
coeff = (coeff ^ -sign) + sign;
if (coeff_idx)
coeff *= s->dequant_ac;
s->block_coeff[b][permute[coeff_idx]] = coeff;
} else {
if (ct && !vp56_rac_get_prob_branchy(c, model2[1]))
break;
ct = 0;
s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx] = 0;
}
coeff_idx++;
if (coeff_idx >= 64)
break;
cg = vp5_coeff_groups[coeff_idx];
ctx = s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx];
model1 = model->coeff_ract[pt][ct][cg];
model2 = cg > 2 ? model1 : model->coeff_acct[pt][ct][cg][ctx];
}
ctx_last = FFMIN(s->coeff_ctx_last[ff_vp56_b6to4[b]], 24);
s->coeff_ctx_last[ff_vp56_b6to4[b]] = coeff_idx;
if (coeff_idx < ctx_last)
for (i=coeff_idx; i<=ctx_last; i++)
s->coeff_ctx[ff_vp56_b6to4[b]][i] = 5;
s->above_blocks[s->above_block_idx[b]].not_null_dc = s->coeff_ctx[ff_vp56_b6to4[b]][0];
}
}
| {
"code": [
"static void vp5_parse_coeff(VP56Context *s)"
],
"line_no": [
1
]
} | static void FUNC_0(VP56Context *VAR_0)
{
VP56RangeCoder *c = &VAR_0->c;
VP56Model *model = VAR_0->modelp;
uint8_t *permute = VAR_0->idct_scantable;
uint8_t *model1, *model2;
int VAR_1, VAR_2, VAR_3;
int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;
int VAR_10 = 0;
for (VAR_4=0; VAR_4<6; VAR_4++) {
int VAR_11 = 1;
if (VAR_4 > 3) VAR_10 = 1;
VAR_8 = 6*VAR_0->coeff_ctx[ff_vp56_b6to4[VAR_4]][0]
+ VAR_0->above_blocks[VAR_0->above_block_idx[VAR_4]].not_null_dc;
model1 = model->coeff_dccv[VAR_10];
model2 = model->coeff_dcct[VAR_10][VAR_8];
VAR_3 = 0;
for (;;) {
if (vp56_rac_get_prob_branchy(c, model2[0])) {
if (vp56_rac_get_prob_branchy(c, model2[2])) {
if (vp56_rac_get_prob_branchy(c, model2[3])) {
VAR_0->coeff_ctx[ff_vp56_b6to4[VAR_4]][VAR_3] = 4;
VAR_7 = vp56_rac_get_tree(c, ff_vp56_pc_tree, model1);
VAR_2 = vp56_rac_get(c);
VAR_1 = ff_vp56_coeff_bias[VAR_7+5];
for (VAR_5=ff_vp56_coeff_bit_length[VAR_7]; VAR_5>=0; VAR_5--)
VAR_1 += vp56_rac_get_prob(c, ff_vp56_coeff_parse_table[VAR_7][VAR_5]) << VAR_5;
} else {
if (vp56_rac_get_prob_branchy(c, model2[4])) {
VAR_1 = 3 + vp56_rac_get_prob(c, model1[5]);
VAR_0->coeff_ctx[ff_vp56_b6to4[VAR_4]][VAR_3] = 3;
} else {
VAR_1 = 2;
VAR_0->coeff_ctx[ff_vp56_b6to4[VAR_4]][VAR_3] = 2;
}
VAR_2 = vp56_rac_get(c);
}
VAR_11 = 2;
} else {
VAR_11 = 1;
VAR_0->coeff_ctx[ff_vp56_b6to4[VAR_4]][VAR_3] = 1;
VAR_2 = vp56_rac_get(c);
VAR_1 = 1;
}
VAR_1 = (VAR_1 ^ -VAR_2) + VAR_2;
if (VAR_3)
VAR_1 *= VAR_0->dequant_ac;
VAR_0->block_coeff[VAR_4][permute[VAR_3]] = VAR_1;
} else {
if (VAR_11 && !vp56_rac_get_prob_branchy(c, model2[1]))
break;
VAR_11 = 0;
VAR_0->coeff_ctx[ff_vp56_b6to4[VAR_4]][VAR_3] = 0;
}
VAR_3++;
if (VAR_3 >= 64)
break;
VAR_6 = vp5_coeff_groups[VAR_3];
VAR_8 = VAR_0->coeff_ctx[ff_vp56_b6to4[VAR_4]][VAR_3];
model1 = model->coeff_ract[VAR_10][VAR_11][VAR_6];
model2 = VAR_6 > 2 ? model1 : model->coeff_acct[VAR_10][VAR_11][VAR_6][VAR_8];
}
VAR_9 = FFMIN(VAR_0->coeff_ctx_last[ff_vp56_b6to4[VAR_4]], 24);
VAR_0->coeff_ctx_last[ff_vp56_b6to4[VAR_4]] = VAR_3;
if (VAR_3 < VAR_9)
for (VAR_5=VAR_3; VAR_5<=VAR_9; VAR_5++)
VAR_0->coeff_ctx[ff_vp56_b6to4[VAR_4]][VAR_5] = 5;
VAR_0->above_blocks[VAR_0->above_block_idx[VAR_4]].not_null_dc = VAR_0->coeff_ctx[ff_vp56_b6to4[VAR_4]][0];
}
}
| [
"static void FUNC_0(VP56Context *VAR_0)\n{",
"VP56RangeCoder *c = &VAR_0->c;",
"VP56Model *model = VAR_0->modelp;",
"uint8_t *permute = VAR_0->idct_scantable;",
"uint8_t *model1, *model2;",
"int VAR_1, VAR_2, VAR_3;",
"int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;",
"int VAR_10 = 0;",
"for (VAR_4=0; VAR_4<6; VAR_4++) {",
"int VAR_11 = 1;",
"if (VAR_4 > 3) VAR_10 = 1;",
"VAR_8 = 6*VAR_0->coeff_ctx[ff_vp56_b6to4[VAR_4]][0]\n+ VAR_0->above_blocks[VAR_0->above_block_idx[VAR_4]].not_null_dc;",
"model1 = model->coeff_dccv[VAR_10];",
"model2 = model->coeff_dcct[VAR_10][VAR_8];",
"VAR_3 = 0;",
"for (;;) {",
"if (vp56_rac_get_prob_branchy(c, model2[0])) {",
"if (vp56_rac_get_prob_branchy(c, model2[2])) {",
"if (vp56_rac_get_prob_branchy(c, model2[3])) {",
"VAR_0->coeff_ctx[ff_vp56_b6to4[VAR_4]][VAR_3] = 4;",
"VAR_7 = vp56_rac_get_tree(c, ff_vp56_pc_tree, model1);",
"VAR_2 = vp56_rac_get(c);",
"VAR_1 = ff_vp56_coeff_bias[VAR_7+5];",
"for (VAR_5=ff_vp56_coeff_bit_length[VAR_7]; VAR_5>=0; VAR_5--)",
"VAR_1 += vp56_rac_get_prob(c, ff_vp56_coeff_parse_table[VAR_7][VAR_5]) << VAR_5;",
"} else {",
"if (vp56_rac_get_prob_branchy(c, model2[4])) {",
"VAR_1 = 3 + vp56_rac_get_prob(c, model1[5]);",
"VAR_0->coeff_ctx[ff_vp56_b6to4[VAR_4]][VAR_3] = 3;",
"} else {",
"VAR_1 = 2;",
"VAR_0->coeff_ctx[ff_vp56_b6to4[VAR_4]][VAR_3] = 2;",
"}",
"VAR_2 = vp56_rac_get(c);",
"}",
"VAR_11 = 2;",
"} else {",
"VAR_11 = 1;",
"VAR_0->coeff_ctx[ff_vp56_b6to4[VAR_4]][VAR_3] = 1;",
"VAR_2 = vp56_rac_get(c);",
"VAR_1 = 1;",
"}",
"VAR_1 = (VAR_1 ^ -VAR_2) + VAR_2;",
"if (VAR_3)\nVAR_1 *= VAR_0->dequant_ac;",
"VAR_0->block_coeff[VAR_4][permute[VAR_3]] = VAR_1;",
"} else {",
"if (VAR_11 && !vp56_rac_get_prob_branchy(c, model2[1]))\nbreak;",
"VAR_11 = 0;",
"VAR_0->coeff_ctx[ff_vp56_b6to4[VAR_4]][VAR_3] = 0;",
"}",
"VAR_3++;",
"if (VAR_3 >= 64)\nbreak;",
"VAR_6 = vp5_coeff_groups[VAR_3];",
"VAR_8 = VAR_0->coeff_ctx[ff_vp56_b6to4[VAR_4]][VAR_3];",
"model1 = model->coeff_ract[VAR_10][VAR_11][VAR_6];",
"model2 = VAR_6 > 2 ? model1 : model->coeff_acct[VAR_10][VAR_11][VAR_6][VAR_8];",
"}",
"VAR_9 = FFMIN(VAR_0->coeff_ctx_last[ff_vp56_b6to4[VAR_4]], 24);",
"VAR_0->coeff_ctx_last[ff_vp56_b6to4[VAR_4]] = VAR_3;",
"if (VAR_3 < VAR_9)\nfor (VAR_5=VAR_3; VAR_5<=VAR_9; VAR_5++)",
"VAR_0->coeff_ctx[ff_vp56_b6to4[VAR_4]][VAR_5] = 5;",
"VAR_0->above_blocks[VAR_0->above_block_idx[VAR_4]].not_null_dc = VAR_0->coeff_ctx[ff_vp56_b6to4[VAR_4]][0];",
"}",
"}"
]
| [
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
21
],
[
23
],
[
27
],
[
31,
33
],
[
35
],
[
37
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99,
101
],
[
103
],
[
105
],
[
107,
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119,
121
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
137
],
[
139
],
[
141,
143
],
[
145
],
[
147
],
[
149
],
[
151
]
]
|
12,350 | static int nvdec_vc1_end_frame(AVCodecContext *avctx)
{
NVDECContext *ctx = avctx->internal->hwaccel_priv_data;
int ret = ff_nvdec_end_frame(avctx);
ctx->bitstream = NULL;
return ret;
}
| false | FFmpeg | 4c7b023d56e09a78a587d036db1b64bf7c493b3d | static int nvdec_vc1_end_frame(AVCodecContext *avctx)
{
NVDECContext *ctx = avctx->internal->hwaccel_priv_data;
int ret = ff_nvdec_end_frame(avctx);
ctx->bitstream = NULL;
return ret;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(AVCodecContext *VAR_0)
{
NVDECContext *ctx = VAR_0->internal->hwaccel_priv_data;
int VAR_1 = ff_nvdec_end_frame(VAR_0);
ctx->bitstream = NULL;
return VAR_1;
}
| [
"static int FUNC_0(AVCodecContext *VAR_0)\n{",
"NVDECContext *ctx = VAR_0->internal->hwaccel_priv_data;",
"int VAR_1 = ff_nvdec_end_frame(VAR_0);",
"ctx->bitstream = NULL;",
"return VAR_1;",
"}"
]
| [
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
]
]
|
12,352 | static inline void RENAME(yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
long width, long height,
long lumStride, long chromStride, long srcStride)
{
long y;
const long chromWidth= width>>1;
for(y=0; y<height; y+=2)
{
#ifdef HAVE_MMX
asm volatile(
"xor %%"REG_a", %%"REG_a" \n\t"
"pcmpeqw %%mm7, %%mm7 \n\t"
"psrlw $8, %%mm7 \n\t" // FF,00,FF,00...
ASMALIGN16
"1: \n\t"
PREFETCH" 64(%0, %%"REG_a", 4) \n\t"
"movq (%0, %%"REG_a", 4), %%mm0 \n\t" // YUYV YUYV(0)
"movq 8(%0, %%"REG_a", 4), %%mm1\n\t" // YUYV YUYV(4)
"movq %%mm0, %%mm2 \n\t" // YUYV YUYV(0)
"movq %%mm1, %%mm3 \n\t" // YUYV YUYV(4)
"psrlw $8, %%mm0 \n\t" // U0V0 U0V0(0)
"psrlw $8, %%mm1 \n\t" // U0V0 U0V0(4)
"pand %%mm7, %%mm2 \n\t" // Y0Y0 Y0Y0(0)
"pand %%mm7, %%mm3 \n\t" // Y0Y0 Y0Y0(4)
"packuswb %%mm1, %%mm0 \n\t" // UVUV UVUV(0)
"packuswb %%mm3, %%mm2 \n\t" // YYYY YYYY(0)
MOVNTQ" %%mm2, (%1, %%"REG_a", 2)\n\t"
"movq 16(%0, %%"REG_a", 4), %%mm1\n\t" // YUYV YUYV(8)
"movq 24(%0, %%"REG_a", 4), %%mm2\n\t" // YUYV YUYV(12)
"movq %%mm1, %%mm3 \n\t" // YUYV YUYV(8)
"movq %%mm2, %%mm4 \n\t" // YUYV YUYV(12)
"psrlw $8, %%mm1 \n\t" // U0V0 U0V0(8)
"psrlw $8, %%mm2 \n\t" // U0V0 U0V0(12)
"pand %%mm7, %%mm3 \n\t" // Y0Y0 Y0Y0(8)
"pand %%mm7, %%mm4 \n\t" // Y0Y0 Y0Y0(12)
"packuswb %%mm2, %%mm1 \n\t" // UVUV UVUV(8)
"packuswb %%mm4, %%mm3 \n\t" // YYYY YYYY(8)
MOVNTQ" %%mm3, 8(%1, %%"REG_a", 2)\n\t"
"movq %%mm0, %%mm2 \n\t" // UVUV UVUV(0)
"movq %%mm1, %%mm3 \n\t" // UVUV UVUV(8)
"psrlw $8, %%mm0 \n\t" // V0V0 V0V0(0)
"psrlw $8, %%mm1 \n\t" // V0V0 V0V0(8)
"pand %%mm7, %%mm2 \n\t" // U0U0 U0U0(0)
"pand %%mm7, %%mm3 \n\t" // U0U0 U0U0(8)
"packuswb %%mm1, %%mm0 \n\t" // VVVV VVVV(0)
"packuswb %%mm3, %%mm2 \n\t" // UUUU UUUU(0)
MOVNTQ" %%mm0, (%3, %%"REG_a") \n\t"
MOVNTQ" %%mm2, (%2, %%"REG_a") \n\t"
"add $8, %%"REG_a" \n\t"
"cmp %4, %%"REG_a" \n\t"
" jb 1b \n\t"
::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (chromWidth)
: "memory", "%"REG_a
);
ydst += lumStride;
src += srcStride;
asm volatile(
"xor %%"REG_a", %%"REG_a" \n\t"
ASMALIGN16
"1: \n\t"
PREFETCH" 64(%0, %%"REG_a", 4) \n\t"
"movq (%0, %%"REG_a", 4), %%mm0 \n\t" // YUYV YUYV(0)
"movq 8(%0, %%"REG_a", 4), %%mm1\n\t" // YUYV YUYV(4)
"movq 16(%0, %%"REG_a", 4), %%mm2\n\t" // YUYV YUYV(8)
"movq 24(%0, %%"REG_a", 4), %%mm3\n\t" // YUYV YUYV(12)
"pand %%mm7, %%mm0 \n\t" // Y0Y0 Y0Y0(0)
"pand %%mm7, %%mm1 \n\t" // Y0Y0 Y0Y0(4)
"pand %%mm7, %%mm2 \n\t" // Y0Y0 Y0Y0(8)
"pand %%mm7, %%mm3 \n\t" // Y0Y0 Y0Y0(12)
"packuswb %%mm1, %%mm0 \n\t" // YYYY YYYY(0)
"packuswb %%mm3, %%mm2 \n\t" // YYYY YYYY(8)
MOVNTQ" %%mm0, (%1, %%"REG_a", 2)\n\t"
MOVNTQ" %%mm2, 8(%1, %%"REG_a", 2)\n\t"
"add $8, %%"REG_a" \n\t"
"cmp %4, %%"REG_a" \n\t"
" jb 1b \n\t"
::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (chromWidth)
: "memory", "%"REG_a
);
#else
long i;
for(i=0; i<chromWidth; i++)
{
ydst[2*i+0] = src[4*i+0];
udst[i] = src[4*i+1];
ydst[2*i+1] = src[4*i+2];
vdst[i] = src[4*i+3];
}
ydst += lumStride;
src += srcStride;
for(i=0; i<chromWidth; i++)
{
ydst[2*i+0] = src[4*i+0];
ydst[2*i+1] = src[4*i+2];
}
#endif
udst += chromStride;
vdst += chromStride;
ydst += lumStride;
src += srcStride;
}
#ifdef HAVE_MMX
asm volatile( EMMS" \n\t"
SFENCE" \n\t"
:::"memory");
#endif
}
| false | FFmpeg | 4bff9ef9d0781c4de228bf1f85634d2706fc589b | static inline void RENAME(yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
long width, long height,
long lumStride, long chromStride, long srcStride)
{
long y;
const long chromWidth= width>>1;
for(y=0; y<height; y+=2)
{
#ifdef HAVE_MMX
asm volatile(
"xor %%"REG_a", %%"REG_a" \n\t"
"pcmpeqw %%mm7, %%mm7 \n\t"
"psrlw $8, %%mm7 \n\t"
ASMALIGN16
"1: \n\t"
PREFETCH" 64(%0, %%"REG_a", 4) \n\t"
"movq (%0, %%"REG_a", 4), %%mm0 \n\t"
"movq 8(%0, %%"REG_a", 4), %%mm1\n\t"
"movq %%mm0, %%mm2 \n\t"
"movq %%mm1, %%mm3 \n\t"
"psrlw $8, %%mm0 \n\t"
"psrlw $8, %%mm1 \n\t"
"pand %%mm7, %%mm2 \n\t"
"pand %%mm7, %%mm3 \n\t"
"packuswb %%mm1, %%mm0 \n\t"
"packuswb %%mm3, %%mm2 \n\t"
MOVNTQ" %%mm2, (%1, %%"REG_a", 2)\n\t"
"movq 16(%0, %%"REG_a", 4), %%mm1\n\t"
"movq 24(%0, %%"REG_a", 4), %%mm2\n\t"
"movq %%mm1, %%mm3 \n\t"
"movq %%mm2, %%mm4 \n\t"
"psrlw $8, %%mm1 \n\t"
"psrlw $8, %%mm2 \n\t"
"pand %%mm7, %%mm3 \n\t"
"pand %%mm7, %%mm4 \n\t"
"packuswb %%mm2, %%mm1 \n\t"
"packuswb %%mm4, %%mm3 \n\t"
MOVNTQ" %%mm3, 8(%1, %%"REG_a", 2)\n\t"
"movq %%mm0, %%mm2 \n\t"
"movq %%mm1, %%mm3 \n\t"
"psrlw $8, %%mm0 \n\t"
"psrlw $8, %%mm1 \n\t"
"pand %%mm7, %%mm2 \n\t"
"pand %%mm7, %%mm3 \n\t"
"packuswb %%mm1, %%mm0 \n\t"
"packuswb %%mm3, %%mm2 \n\t"
MOVNTQ" %%mm0, (%3, %%"REG_a") \n\t"
MOVNTQ" %%mm2, (%2, %%"REG_a") \n\t"
"add $8, %%"REG_a" \n\t"
"cmp %4, %%"REG_a" \n\t"
" jb 1b \n\t"
::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (chromWidth)
: "memory", "%"REG_a
);
ydst += lumStride;
src += srcStride;
asm volatile(
"xor %%"REG_a", %%"REG_a" \n\t"
ASMALIGN16
"1: \n\t"
PREFETCH" 64(%0, %%"REG_a", 4) \n\t"
"movq (%0, %%"REG_a", 4), %%mm0 \n\t"
"movq 8(%0, %%"REG_a", 4), %%mm1\n\t"
"movq 16(%0, %%"REG_a", 4), %%mm2\n\t"
"movq 24(%0, %%"REG_a", 4), %%mm3\n\t"
"pand %%mm7, %%mm0 \n\t"
"pand %%mm7, %%mm1 \n\t"
"pand %%mm7, %%mm2 \n\t"
"pand %%mm7, %%mm3 \n\t"
"packuswb %%mm1, %%mm0 \n\t"
"packuswb %%mm3, %%mm2 \n\t"
MOVNTQ" %%mm0, (%1, %%"REG_a", 2)\n\t"
MOVNTQ" %%mm2, 8(%1, %%"REG_a", 2)\n\t"
"add $8, %%"REG_a" \n\t"
"cmp %4, %%"REG_a" \n\t"
" jb 1b \n\t"
::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (chromWidth)
: "memory", "%"REG_a
);
#else
long i;
for(i=0; i<chromWidth; i++)
{
ydst[2*i+0] = src[4*i+0];
udst[i] = src[4*i+1];
ydst[2*i+1] = src[4*i+2];
vdst[i] = src[4*i+3];
}
ydst += lumStride;
src += srcStride;
for(i=0; i<chromWidth; i++)
{
ydst[2*i+0] = src[4*i+0];
ydst[2*i+1] = src[4*i+2];
}
#endif
udst += chromStride;
vdst += chromStride;
ydst += lumStride;
src += srcStride;
}
#ifdef HAVE_MMX
asm volatile( EMMS" \n\t"
SFENCE" \n\t"
:::"memory");
#endif
}
| {
"code": [],
"line_no": []
} | static inline void FUNC_0(yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
long width, long height,
long lumStride, long chromStride, long srcStride)
{
long VAR_0;
const long VAR_1= width>>1;
for(VAR_0=0; VAR_0<height; VAR_0+=2)
{
#ifdef HAVE_MMX
asm volatile(
"xor %%"REG_a", %%"REG_a" \n\t"
"pcmpeqw %%mm7, %%mm7 \n\t"
"psrlw $8, %%mm7 \n\t"
ASMALIGN16
"1: \n\t"
PREFETCH" 64(%0, %%"REG_a", 4) \n\t"
"movq (%0, %%"REG_a", 4), %%mm0 \n\t"
"movq 8(%0, %%"REG_a", 4), %%mm1\n\t"
"movq %%mm0, %%mm2 \n\t"
"movq %%mm1, %%mm3 \n\t"
"psrlw $8, %%mm0 \n\t"
"psrlw $8, %%mm1 \n\t"
"pand %%mm7, %%mm2 \n\t"
"pand %%mm7, %%mm3 \n\t"
"packuswb %%mm1, %%mm0 \n\t"
"packuswb %%mm3, %%mm2 \n\t"
MOVNTQ" %%mm2, (%1, %%"REG_a", 2)\n\t"
"movq 16(%0, %%"REG_a", 4), %%mm1\n\t"
"movq 24(%0, %%"REG_a", 4), %%mm2\n\t"
"movq %%mm1, %%mm3 \n\t"
"movq %%mm2, %%mm4 \n\t"
"psrlw $8, %%mm1 \n\t"
"psrlw $8, %%mm2 \n\t"
"pand %%mm7, %%mm3 \n\t"
"pand %%mm7, %%mm4 \n\t"
"packuswb %%mm2, %%mm1 \n\t"
"packuswb %%mm4, %%mm3 \n\t"
MOVNTQ" %%mm3, 8(%1, %%"REG_a", 2)\n\t"
"movq %%mm0, %%mm2 \n\t"
"movq %%mm1, %%mm3 \n\t"
"psrlw $8, %%mm0 \n\t"
"psrlw $8, %%mm1 \n\t"
"pand %%mm7, %%mm2 \n\t"
"pand %%mm7, %%mm3 \n\t"
"packuswb %%mm1, %%mm0 \n\t"
"packuswb %%mm3, %%mm2 \n\t"
MOVNTQ" %%mm0, (%3, %%"REG_a") \n\t"
MOVNTQ" %%mm2, (%2, %%"REG_a") \n\t"
"add $8, %%"REG_a" \n\t"
"cmp %4, %%"REG_a" \n\t"
" jb 1b \n\t"
::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (VAR_1)
: "memory", "%"REG_a
);
ydst += lumStride;
src += srcStride;
asm volatile(
"xor %%"REG_a", %%"REG_a" \n\t"
ASMALIGN16
"1: \n\t"
PREFETCH" 64(%0, %%"REG_a", 4) \n\t"
"movq (%0, %%"REG_a", 4), %%mm0 \n\t"
"movq 8(%0, %%"REG_a", 4), %%mm1\n\t"
"movq 16(%0, %%"REG_a", 4), %%mm2\n\t"
"movq 24(%0, %%"REG_a", 4), %%mm3\n\t"
"pand %%mm7, %%mm0 \n\t"
"pand %%mm7, %%mm1 \n\t"
"pand %%mm7, %%mm2 \n\t"
"pand %%mm7, %%mm3 \n\t"
"packuswb %%mm1, %%mm0 \n\t"
"packuswb %%mm3, %%mm2 \n\t"
MOVNTQ" %%mm0, (%1, %%"REG_a", 2)\n\t"
MOVNTQ" %%mm2, 8(%1, %%"REG_a", 2)\n\t"
"add $8, %%"REG_a" \n\t"
"cmp %4, %%"REG_a" \n\t"
" jb 1b \n\t"
::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (VAR_1)
: "memory", "%"REG_a
);
#else
long i;
for(i=0; i<VAR_1; i++)
{
ydst[2*i+0] = src[4*i+0];
udst[i] = src[4*i+1];
ydst[2*i+1] = src[4*i+2];
vdst[i] = src[4*i+3];
}
ydst += lumStride;
src += srcStride;
for(i=0; i<VAR_1; i++)
{
ydst[2*i+0] = src[4*i+0];
ydst[2*i+1] = src[4*i+2];
}
#endif
udst += chromStride;
vdst += chromStride;
ydst += lumStride;
src += srcStride;
}
#ifdef HAVE_MMX
asm volatile( EMMS" \n\t"
SFENCE" \n\t"
:::"memory");
#endif
}
| [
"static inline void FUNC_0(yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,\nlong width, long height,\nlong lumStride, long chromStride, long srcStride)\n{",
"long VAR_0;",
"const long VAR_1= width>>1;",
"for(VAR_0=0; VAR_0<height; VAR_0+=2)",
"{",
"#ifdef HAVE_MMX\nasm volatile(\n\"xor %%\"REG_a\", %%\"REG_a\"\t\\n\\t\"\n\"pcmpeqw %%mm7, %%mm7\t\t\\n\\t\"\n\"psrlw $8, %%mm7\t\t\\n\\t\"\nASMALIGN16\n\"1:\t\t\t\t\\n\\t\"\nPREFETCH\" 64(%0, %%\"REG_a\", 4)\t\\n\\t\"\n\"movq (%0, %%\"REG_a\", 4), %%mm0\t\\n\\t\"\n\"movq 8(%0, %%\"REG_a\", 4), %%mm1\\n\\t\"\n\"movq %%mm0, %%mm2\t\t\\n\\t\"\n\"movq %%mm1, %%mm3\t\t\\n\\t\"\n\"psrlw $8, %%mm0\t\t\\n\\t\"\n\"psrlw $8, %%mm1\t\t\\n\\t\"\n\"pand %%mm7, %%mm2\t\t\\n\\t\"\n\"pand %%mm7, %%mm3\t\t\\n\\t\"\n\"packuswb %%mm1, %%mm0\t\t\\n\\t\"\n\"packuswb %%mm3, %%mm2\t\t\\n\\t\"\nMOVNTQ\" %%mm2, (%1, %%\"REG_a\", 2)\\n\\t\"\n\"movq 16(%0, %%\"REG_a\", 4), %%mm1\\n\\t\"\n\"movq 24(%0, %%\"REG_a\", 4), %%mm2\\n\\t\"\n\"movq %%mm1, %%mm3\t\t\\n\\t\"\n\"movq %%mm2, %%mm4\t\t\\n\\t\"\n\"psrlw $8, %%mm1\t\t\\n\\t\"\n\"psrlw $8, %%mm2\t\t\\n\\t\"\n\"pand %%mm7, %%mm3\t\t\\n\\t\"\n\"pand %%mm7, %%mm4\t\t\\n\\t\"\n\"packuswb %%mm2, %%mm1\t\t\\n\\t\"\n\"packuswb %%mm4, %%mm3\t\t\\n\\t\"\nMOVNTQ\" %%mm3, 8(%1, %%\"REG_a\", 2)\\n\\t\"\n\"movq %%mm0, %%mm2\t\t\\n\\t\"\n\"movq %%mm1, %%mm3\t\t\\n\\t\"\n\"psrlw $8, %%mm0\t\t\\n\\t\"\n\"psrlw $8, %%mm1\t\t\\n\\t\"\n\"pand %%mm7, %%mm2\t\t\\n\\t\"\n\"pand %%mm7, %%mm3\t\t\\n\\t\"\n\"packuswb %%mm1, %%mm0\t\t\\n\\t\"\n\"packuswb %%mm3, %%mm2\t\t\\n\\t\"\nMOVNTQ\" %%mm0, (%3, %%\"REG_a\")\t\\n\\t\"\nMOVNTQ\" %%mm2, (%2, %%\"REG_a\")\t\\n\\t\"\n\"add $8, %%\"REG_a\"\t\t\\n\\t\"\n\"cmp %4, %%\"REG_a\"\t\t\\n\\t\"\n\" jb 1b\t\t\t\t\\n\\t\"\n::\"r\"(src), \"r\"(ydst), \"r\"(udst), \"r\"(vdst), \"g\" (VAR_1)\n: \"memory\", \"%\"REG_a\n);",
"ydst += lumStride;",
"src += srcStride;",
"asm volatile(\n\"xor %%\"REG_a\", %%\"REG_a\"\t\\n\\t\"\nASMALIGN16\n\"1:\t\t\t\t\\n\\t\"\nPREFETCH\" 64(%0, %%\"REG_a\", 4)\t\\n\\t\"\n\"movq (%0, %%\"REG_a\", 4), %%mm0\t\\n\\t\"\n\"movq 8(%0, %%\"REG_a\", 4), %%mm1\\n\\t\"\n\"movq 16(%0, %%\"REG_a\", 4), %%mm2\\n\\t\"\n\"movq 24(%0, %%\"REG_a\", 4), %%mm3\\n\\t\"\n\"pand %%mm7, %%mm0\t\t\\n\\t\"\n\"pand %%mm7, %%mm1\t\t\\n\\t\"\n\"pand %%mm7, %%mm2\t\t\\n\\t\"\n\"pand %%mm7, %%mm3\t\t\\n\\t\"\n\"packuswb %%mm1, %%mm0\t\t\\n\\t\"\n\"packuswb %%mm3, %%mm2\t\t\\n\\t\"\nMOVNTQ\" %%mm0, (%1, %%\"REG_a\", 2)\\n\\t\"\nMOVNTQ\" %%mm2, 8(%1, %%\"REG_a\", 2)\\n\\t\"\n\"add $8, %%\"REG_a\"\t\t\\n\\t\"\n\"cmp %4, %%\"REG_a\"\t\t\\n\\t\"\n\" jb 1b\t\t\t\t\\n\\t\"\n::\"r\"(src), \"r\"(ydst), \"r\"(udst), \"r\"(vdst), \"g\" (VAR_1)\n: \"memory\", \"%\"REG_a\n);",
"#else\nlong i;",
"for(i=0; i<VAR_1; i++)",
"{",
"ydst[2*i+0] \t= src[4*i+0];",
"udst[i] \t= src[4*i+1];",
"ydst[2*i+1] \t= src[4*i+2];",
"vdst[i] \t= src[4*i+3];",
"}",
"ydst += lumStride;",
"src += srcStride;",
"for(i=0; i<VAR_1; i++)",
"{",
"ydst[2*i+0] \t= src[4*i+0];",
"ydst[2*i+1] \t= src[4*i+2];",
"}",
"#endif\nudst += chromStride;",
"vdst += chromStride;",
"ydst += lumStride;",
"src += srcStride;",
"}",
"#ifdef HAVE_MMX\nasm volatile( EMMS\" \\n\\t\"\nSFENCE\" \\n\\t\"\n:::\"memory\");",
"#endif\n}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5,
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17,
19,
21,
23,
25,
27,
29,
31,
33,
35,
37,
39,
41,
43,
45,
47,
49,
51,
55,
59,
61,
63,
65,
67,
69,
71,
73,
75,
77,
81,
85,
87,
89,
91,
93,
95,
97,
99,
103,
105,
109,
111,
113,
115,
117,
119
],
[
123
],
[
125
],
[
129,
131,
133,
135,
137,
139,
141,
143,
145,
147,
149,
151,
153,
155,
157,
161,
163,
167,
169,
171,
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
]
]
|
12,354 | static int qtrle_decode_init(AVCodecContext *avctx)
{
QtrleContext *s = avctx->priv_data;
s->avctx = avctx;
switch (avctx->bits_per_sample) {
case 1:
case 2:
case 4:
case 8:
case 33:
case 34:
case 36:
case 40:
avctx->pix_fmt = PIX_FMT_PAL8;
break;
case 16:
avctx->pix_fmt = PIX_FMT_RGB555;
break;
case 24:
avctx->pix_fmt = PIX_FMT_RGB24;
break;
case 32:
avctx->pix_fmt = PIX_FMT_RGB32;
break;
default:
av_log (avctx, AV_LOG_ERROR, "Unsupported colorspace: %d bits/sample?\n",
avctx->bits_per_sample);
break;
}
dsputil_init(&s->dsp, avctx);
s->frame.data[0] = NULL;
return 0;
}
| false | FFmpeg | 32c3047cac9294bb56d23c89a40a22409db5cc70 | static int qtrle_decode_init(AVCodecContext *avctx)
{
QtrleContext *s = avctx->priv_data;
s->avctx = avctx;
switch (avctx->bits_per_sample) {
case 1:
case 2:
case 4:
case 8:
case 33:
case 34:
case 36:
case 40:
avctx->pix_fmt = PIX_FMT_PAL8;
break;
case 16:
avctx->pix_fmt = PIX_FMT_RGB555;
break;
case 24:
avctx->pix_fmt = PIX_FMT_RGB24;
break;
case 32:
avctx->pix_fmt = PIX_FMT_RGB32;
break;
default:
av_log (avctx, AV_LOG_ERROR, "Unsupported colorspace: %d bits/sample?\n",
avctx->bits_per_sample);
break;
}
dsputil_init(&s->dsp, avctx);
s->frame.data[0] = NULL;
return 0;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(AVCodecContext *VAR_0)
{
QtrleContext *s = VAR_0->priv_data;
s->VAR_0 = VAR_0;
switch (VAR_0->bits_per_sample) {
case 1:
case 2:
case 4:
case 8:
case 33:
case 34:
case 36:
case 40:
VAR_0->pix_fmt = PIX_FMT_PAL8;
break;
case 16:
VAR_0->pix_fmt = PIX_FMT_RGB555;
break;
case 24:
VAR_0->pix_fmt = PIX_FMT_RGB24;
break;
case 32:
VAR_0->pix_fmt = PIX_FMT_RGB32;
break;
default:
av_log (VAR_0, AV_LOG_ERROR, "Unsupported colorspace: %d bits/sample?\n",
VAR_0->bits_per_sample);
break;
}
dsputil_init(&s->dsp, VAR_0);
s->frame.data[0] = NULL;
return 0;
}
| [
"static int FUNC_0(AVCodecContext *VAR_0)\n{",
"QtrleContext *s = VAR_0->priv_data;",
"s->VAR_0 = VAR_0;",
"switch (VAR_0->bits_per_sample) {",
"case 1:\ncase 2:\ncase 4:\ncase 8:\ncase 33:\ncase 34:\ncase 36:\ncase 40:\nVAR_0->pix_fmt = PIX_FMT_PAL8;",
"break;",
"case 16:\nVAR_0->pix_fmt = PIX_FMT_RGB555;",
"break;",
"case 24:\nVAR_0->pix_fmt = PIX_FMT_RGB24;",
"break;",
"case 32:\nVAR_0->pix_fmt = PIX_FMT_RGB32;",
"break;",
"default:\nav_log (VAR_0, AV_LOG_ERROR, \"Unsupported colorspace: %d bits/sample?\\n\",\nVAR_0->bits_per_sample);",
"break;",
"}",
"dsputil_init(&s->dsp, VAR_0);",
"s->frame.data[0] = NULL;",
"return 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,
21,
23,
25,
27,
29
],
[
31
],
[
35,
37
],
[
39
],
[
43,
45
],
[
47
],
[
51,
53
],
[
55
],
[
59,
61,
63
],
[
65
],
[
67
],
[
69
],
[
73
],
[
77
],
[
79
]
]
|
12,355 | void vp8_mc_part(VP8Context *s, uint8_t *dst[3],
AVFrame *ref_frame, int x_off, int y_off,
int bx_off, int by_off,
int block_w, int block_h,
int width, int height, VP56mv *mv)
{
VP56mv uvmv = *mv;
/* Y */
vp8_mc(s, 1, dst[0] + by_off * s->linesize + bx_off,
ref_frame->data[0], mv, x_off + bx_off, y_off + by_off,
block_w, block_h, width, height, s->linesize,
s->put_pixels_tab[block_w == 8]);
/* U/V */
if (s->profile == 3) {
uvmv.x &= ~7;
uvmv.y &= ~7;
}
x_off >>= 1; y_off >>= 1;
bx_off >>= 1; by_off >>= 1;
width >>= 1; height >>= 1;
block_w >>= 1; block_h >>= 1;
vp8_mc(s, 0, dst[1] + by_off * s->uvlinesize + bx_off,
ref_frame->data[1], &uvmv, x_off + bx_off, y_off + by_off,
block_w, block_h, width, height, s->uvlinesize,
s->put_pixels_tab[1 + (block_w == 4)]);
vp8_mc(s, 0, dst[2] + by_off * s->uvlinesize + bx_off,
ref_frame->data[2], &uvmv, x_off + bx_off, y_off + by_off,
block_w, block_h, width, height, s->uvlinesize,
s->put_pixels_tab[1 + (block_w == 4)]);
}
| false | FFmpeg | 5ad4335c2233d5a6d9487d2d56387b7484aecded | void vp8_mc_part(VP8Context *s, uint8_t *dst[3],
AVFrame *ref_frame, int x_off, int y_off,
int bx_off, int by_off,
int block_w, int block_h,
int width, int height, VP56mv *mv)
{
VP56mv uvmv = *mv;
vp8_mc(s, 1, dst[0] + by_off * s->linesize + bx_off,
ref_frame->data[0], mv, x_off + bx_off, y_off + by_off,
block_w, block_h, width, height, s->linesize,
s->put_pixels_tab[block_w == 8]);
if (s->profile == 3) {
uvmv.x &= ~7;
uvmv.y &= ~7;
}
x_off >>= 1; y_off >>= 1;
bx_off >>= 1; by_off >>= 1;
width >>= 1; height >>= 1;
block_w >>= 1; block_h >>= 1;
vp8_mc(s, 0, dst[1] + by_off * s->uvlinesize + bx_off,
ref_frame->data[1], &uvmv, x_off + bx_off, y_off + by_off,
block_w, block_h, width, height, s->uvlinesize,
s->put_pixels_tab[1 + (block_w == 4)]);
vp8_mc(s, 0, dst[2] + by_off * s->uvlinesize + bx_off,
ref_frame->data[2], &uvmv, x_off + bx_off, y_off + by_off,
block_w, block_h, width, height, s->uvlinesize,
s->put_pixels_tab[1 + (block_w == 4)]);
}
| {
"code": [],
"line_no": []
} | void FUNC_0(VP8Context *VAR_0, uint8_t *VAR_1[3],
AVFrame *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, VP56mv *VAR_11)
{
VP56mv uvmv = *VAR_11;
vp8_mc(VAR_0, 1, VAR_1[0] + VAR_6 * VAR_0->linesize + VAR_5,
VAR_2->data[0], VAR_11, VAR_3 + VAR_5, VAR_4 + VAR_6,
VAR_7, VAR_8, VAR_9, VAR_10, VAR_0->linesize,
VAR_0->put_pixels_tab[VAR_7 == 8]);
if (VAR_0->profile == 3) {
uvmv.x &= ~7;
uvmv.y &= ~7;
}
VAR_3 >>= 1; VAR_4 >>= 1;
VAR_5 >>= 1; VAR_6 >>= 1;
VAR_9 >>= 1; VAR_10 >>= 1;
VAR_7 >>= 1; VAR_8 >>= 1;
vp8_mc(VAR_0, 0, VAR_1[1] + VAR_6 * VAR_0->uvlinesize + VAR_5,
VAR_2->data[1], &uvmv, VAR_3 + VAR_5, VAR_4 + VAR_6,
VAR_7, VAR_8, VAR_9, VAR_10, VAR_0->uvlinesize,
VAR_0->put_pixels_tab[1 + (VAR_7 == 4)]);
vp8_mc(VAR_0, 0, VAR_1[2] + VAR_6 * VAR_0->uvlinesize + VAR_5,
VAR_2->data[2], &uvmv, VAR_3 + VAR_5, VAR_4 + VAR_6,
VAR_7, VAR_8, VAR_9, VAR_10, VAR_0->uvlinesize,
VAR_0->put_pixels_tab[1 + (VAR_7 == 4)]);
}
| [
"void FUNC_0(VP8Context *VAR_0, uint8_t *VAR_1[3],\nAVFrame *VAR_2, int VAR_3, int VAR_4,\nint VAR_5, int VAR_6,\nint VAR_7, int VAR_8,\nint VAR_9, int VAR_10, VP56mv *VAR_11)\n{",
"VP56mv uvmv = *VAR_11;",
"vp8_mc(VAR_0, 1, VAR_1[0] + VAR_6 * VAR_0->linesize + VAR_5,\nVAR_2->data[0], VAR_11, VAR_3 + VAR_5, VAR_4 + VAR_6,\nVAR_7, VAR_8, VAR_9, VAR_10, VAR_0->linesize,\nVAR_0->put_pixels_tab[VAR_7 == 8]);",
"if (VAR_0->profile == 3) {",
"uvmv.x &= ~7;",
"uvmv.y &= ~7;",
"}",
"VAR_3 >>= 1; VAR_4 >>= 1;",
"VAR_5 >>= 1; VAR_6 >>= 1;",
"VAR_9 >>= 1; VAR_10 >>= 1;",
"VAR_7 >>= 1; VAR_8 >>= 1;",
"vp8_mc(VAR_0, 0, VAR_1[1] + VAR_6 * VAR_0->uvlinesize + VAR_5,\nVAR_2->data[1], &uvmv, VAR_3 + VAR_5, VAR_4 + VAR_6,\nVAR_7, VAR_8, VAR_9, VAR_10, VAR_0->uvlinesize,\nVAR_0->put_pixels_tab[1 + (VAR_7 == 4)]);",
"vp8_mc(VAR_0, 0, VAR_1[2] + VAR_6 * VAR_0->uvlinesize + VAR_5,\nVAR_2->data[2], &uvmv, VAR_3 + VAR_5, VAR_4 + VAR_6,\nVAR_7, VAR_8, VAR_9, VAR_10, VAR_0->uvlinesize,\nVAR_0->put_pixels_tab[1 + (VAR_7 == 4)]);",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5,
7,
9,
11
],
[
13
],
[
19,
21,
23,
25
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47,
49,
51,
53
],
[
55,
57,
59,
61
],
[
63
]
]
|
12,356 | static int decode_p_frame(FourXContext *f, const uint8_t *buf, int length){
int x, y;
const int width= f->avctx->width;
const int height= f->avctx->height;
uint16_t *src= (uint16_t*)f->last_picture.data[0];
uint16_t *dst= (uint16_t*)f->current_picture.data[0];
const int stride= f->current_picture.linesize[0]>>1;
unsigned int bitstream_size, bytestream_size, wordstream_size, extra;
if(f->version>1){
extra=20;
bitstream_size= AV_RL32(buf+8);
wordstream_size= AV_RL32(buf+12);
bytestream_size= AV_RL32(buf+16);
}else{
extra=0;
bitstream_size = AV_RL16(buf-4);
wordstream_size= AV_RL16(buf-2);
bytestream_size= FFMAX(length - bitstream_size - wordstream_size, 0);
}
if(bitstream_size+ bytestream_size+ wordstream_size + extra != length
|| bitstream_size > (1<<26)
|| bytestream_size > (1<<26)
|| wordstream_size > (1<<26)
){
av_log(f->avctx, AV_LOG_ERROR, "lengths %d %d %d %d\n", bitstream_size, bytestream_size, wordstream_size,
bitstream_size+ bytestream_size+ wordstream_size - length);
return -1;
}
av_fast_malloc(&f->bitstream_buffer, &f->bitstream_buffer_size, bitstream_size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!f->bitstream_buffer)
return AVERROR(ENOMEM);
f->dsp.bswap_buf(f->bitstream_buffer, (const uint32_t*)(buf + extra), bitstream_size/4);
memset((uint8_t*)f->bitstream_buffer + bitstream_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
init_get_bits(&f->gb, f->bitstream_buffer, 8*bitstream_size);
f->wordstream= (const uint16_t*)(buf + extra + bitstream_size);
f->bytestream= buf + extra + bitstream_size + wordstream_size;
init_mv(f);
for(y=0; y<height; y+=8){
for(x=0; x<width; x+=8){
decode_p_block(f, dst + x, src + x, 3, 3, stride);
}
src += 8*stride;
dst += 8*stride;
}
if( bitstream_size != (get_bits_count(&f->gb)+31)/32*4
|| (((const char*)f->wordstream - (const char*)buf + 2)&~2) != extra + bitstream_size + wordstream_size
|| (((const char*)f->bytestream - (const char*)buf + 3)&~3) != extra + bitstream_size + wordstream_size + bytestream_size)
av_log(f->avctx, AV_LOG_ERROR, " %d %td %td bytes left\n",
bitstream_size - (get_bits_count(&f->gb)+31)/32*4,
-(((const char*)f->bytestream - (const char*)buf + 3)&~3) + (extra + bitstream_size + wordstream_size + bytestream_size),
-(((const char*)f->wordstream - (const char*)buf + 2)&~2) + (extra + bitstream_size + wordstream_size)
);
return 0;
}
| false | FFmpeg | bc78ceec2be6613c265387017221c7ceda15aa7d | static int decode_p_frame(FourXContext *f, const uint8_t *buf, int length){
int x, y;
const int width= f->avctx->width;
const int height= f->avctx->height;
uint16_t *src= (uint16_t*)f->last_picture.data[0];
uint16_t *dst= (uint16_t*)f->current_picture.data[0];
const int stride= f->current_picture.linesize[0]>>1;
unsigned int bitstream_size, bytestream_size, wordstream_size, extra;
if(f->version>1){
extra=20;
bitstream_size= AV_RL32(buf+8);
wordstream_size= AV_RL32(buf+12);
bytestream_size= AV_RL32(buf+16);
}else{
extra=0;
bitstream_size = AV_RL16(buf-4);
wordstream_size= AV_RL16(buf-2);
bytestream_size= FFMAX(length - bitstream_size - wordstream_size, 0);
}
if(bitstream_size+ bytestream_size+ wordstream_size + extra != length
|| bitstream_size > (1<<26)
|| bytestream_size > (1<<26)
|| wordstream_size > (1<<26)
){
av_log(f->avctx, AV_LOG_ERROR, "lengths %d %d %d %d\n", bitstream_size, bytestream_size, wordstream_size,
bitstream_size+ bytestream_size+ wordstream_size - length);
return -1;
}
av_fast_malloc(&f->bitstream_buffer, &f->bitstream_buffer_size, bitstream_size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!f->bitstream_buffer)
return AVERROR(ENOMEM);
f->dsp.bswap_buf(f->bitstream_buffer, (const uint32_t*)(buf + extra), bitstream_size/4);
memset((uint8_t*)f->bitstream_buffer + bitstream_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
init_get_bits(&f->gb, f->bitstream_buffer, 8*bitstream_size);
f->wordstream= (const uint16_t*)(buf + extra + bitstream_size);
f->bytestream= buf + extra + bitstream_size + wordstream_size;
init_mv(f);
for(y=0; y<height; y+=8){
for(x=0; x<width; x+=8){
decode_p_block(f, dst + x, src + x, 3, 3, stride);
}
src += 8*stride;
dst += 8*stride;
}
if( bitstream_size != (get_bits_count(&f->gb)+31)/32*4
|| (((const char*)f->wordstream - (const char*)buf + 2)&~2) != extra + bitstream_size + wordstream_size
|| (((const char*)f->bytestream - (const char*)buf + 3)&~3) != extra + bitstream_size + wordstream_size + bytestream_size)
av_log(f->avctx, AV_LOG_ERROR, " %d %td %td bytes left\n",
bitstream_size - (get_bits_count(&f->gb)+31)/32*4,
-(((const char*)f->bytestream - (const char*)buf + 3)&~3) + (extra + bitstream_size + wordstream_size + bytestream_size),
-(((const char*)f->wordstream - (const char*)buf + 2)&~2) + (extra + bitstream_size + wordstream_size)
);
return 0;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(FourXContext *VAR_0, const uint8_t *VAR_1, int VAR_2){
int VAR_3, VAR_4;
const int VAR_5= VAR_0->avctx->VAR_5;
const int VAR_6= VAR_0->avctx->VAR_6;
uint16_t *src= (uint16_t*)VAR_0->last_picture.data[0];
uint16_t *dst= (uint16_t*)VAR_0->current_picture.data[0];
const int VAR_7= VAR_0->current_picture.linesize[0]>>1;
unsigned int VAR_8, VAR_9, VAR_10, VAR_11;
if(VAR_0->version>1){
VAR_11=20;
VAR_8= AV_RL32(VAR_1+8);
VAR_10= AV_RL32(VAR_1+12);
VAR_9= AV_RL32(VAR_1+16);
}else{
VAR_11=0;
VAR_8 = AV_RL16(VAR_1-4);
VAR_10= AV_RL16(VAR_1-2);
VAR_9= FFMAX(VAR_2 - VAR_8 - VAR_10, 0);
}
if(VAR_8+ VAR_9+ VAR_10 + VAR_11 != VAR_2
|| VAR_8 > (1<<26)
|| VAR_9 > (1<<26)
|| VAR_10 > (1<<26)
){
av_log(VAR_0->avctx, AV_LOG_ERROR, "lengths %d %d %d %d\n", VAR_8, VAR_9, VAR_10,
VAR_8+ VAR_9+ VAR_10 - VAR_2);
return -1;
}
av_fast_malloc(&VAR_0->bitstream_buffer, &VAR_0->bitstream_buffer_size, VAR_8 + FF_INPUT_BUFFER_PADDING_SIZE);
if (!VAR_0->bitstream_buffer)
return AVERROR(ENOMEM);
VAR_0->dsp.bswap_buf(VAR_0->bitstream_buffer, (const uint32_t*)(VAR_1 + VAR_11), VAR_8/4);
memset((uint8_t*)VAR_0->bitstream_buffer + VAR_8, 0, FF_INPUT_BUFFER_PADDING_SIZE);
init_get_bits(&VAR_0->gb, VAR_0->bitstream_buffer, 8*VAR_8);
VAR_0->wordstream= (const uint16_t*)(VAR_1 + VAR_11 + VAR_8);
VAR_0->bytestream= VAR_1 + VAR_11 + VAR_8 + VAR_10;
init_mv(VAR_0);
for(VAR_4=0; VAR_4<VAR_6; VAR_4+=8){
for(VAR_3=0; VAR_3<VAR_5; VAR_3+=8){
decode_p_block(VAR_0, dst + VAR_3, src + VAR_3, 3, 3, VAR_7);
}
src += 8*VAR_7;
dst += 8*VAR_7;
}
if( VAR_8 != (get_bits_count(&VAR_0->gb)+31)/32*4
|| (((const char*)VAR_0->wordstream - (const char*)VAR_1 + 2)&~2) != VAR_11 + VAR_8 + VAR_10
|| (((const char*)VAR_0->bytestream - (const char*)VAR_1 + 3)&~3) != VAR_11 + VAR_8 + VAR_10 + VAR_9)
av_log(VAR_0->avctx, AV_LOG_ERROR, " %d %td %td bytes left\n",
VAR_8 - (get_bits_count(&VAR_0->gb)+31)/32*4,
-(((const char*)VAR_0->bytestream - (const char*)VAR_1 + 3)&~3) + (VAR_11 + VAR_8 + VAR_10 + VAR_9),
-(((const char*)VAR_0->wordstream - (const char*)VAR_1 + 2)&~2) + (VAR_11 + VAR_8 + VAR_10)
);
return 0;
}
| [
"static int FUNC_0(FourXContext *VAR_0, const uint8_t *VAR_1, int VAR_2){",
"int VAR_3, VAR_4;",
"const int VAR_5= VAR_0->avctx->VAR_5;",
"const int VAR_6= VAR_0->avctx->VAR_6;",
"uint16_t *src= (uint16_t*)VAR_0->last_picture.data[0];",
"uint16_t *dst= (uint16_t*)VAR_0->current_picture.data[0];",
"const int VAR_7= VAR_0->current_picture.linesize[0]>>1;",
"unsigned int VAR_8, VAR_9, VAR_10, VAR_11;",
"if(VAR_0->version>1){",
"VAR_11=20;",
"VAR_8= AV_RL32(VAR_1+8);",
"VAR_10= AV_RL32(VAR_1+12);",
"VAR_9= AV_RL32(VAR_1+16);",
"}else{",
"VAR_11=0;",
"VAR_8 = AV_RL16(VAR_1-4);",
"VAR_10= AV_RL16(VAR_1-2);",
"VAR_9= FFMAX(VAR_2 - VAR_8 - VAR_10, 0);",
"}",
"if(VAR_8+ VAR_9+ VAR_10 + VAR_11 != VAR_2\n|| VAR_8 > (1<<26)\n|| VAR_9 > (1<<26)\n|| VAR_10 > (1<<26)\n){",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"lengths %d %d %d %d\\n\", VAR_8, VAR_9, VAR_10,\nVAR_8+ VAR_9+ VAR_10 - VAR_2);",
"return -1;",
"}",
"av_fast_malloc(&VAR_0->bitstream_buffer, &VAR_0->bitstream_buffer_size, VAR_8 + FF_INPUT_BUFFER_PADDING_SIZE);",
"if (!VAR_0->bitstream_buffer)\nreturn AVERROR(ENOMEM);",
"VAR_0->dsp.bswap_buf(VAR_0->bitstream_buffer, (const uint32_t*)(VAR_1 + VAR_11), VAR_8/4);",
"memset((uint8_t*)VAR_0->bitstream_buffer + VAR_8, 0, FF_INPUT_BUFFER_PADDING_SIZE);",
"init_get_bits(&VAR_0->gb, VAR_0->bitstream_buffer, 8*VAR_8);",
"VAR_0->wordstream= (const uint16_t*)(VAR_1 + VAR_11 + VAR_8);",
"VAR_0->bytestream= VAR_1 + VAR_11 + VAR_8 + VAR_10;",
"init_mv(VAR_0);",
"for(VAR_4=0; VAR_4<VAR_6; VAR_4+=8){",
"for(VAR_3=0; VAR_3<VAR_5; VAR_3+=8){",
"decode_p_block(VAR_0, dst + VAR_3, src + VAR_3, 3, 3, VAR_7);",
"}",
"src += 8*VAR_7;",
"dst += 8*VAR_7;",
"}",
"if( VAR_8 != (get_bits_count(&VAR_0->gb)+31)/32*4\n|| (((const char*)VAR_0->wordstream - (const char*)VAR_1 + 2)&~2) != VAR_11 + VAR_8 + VAR_10\n|| (((const char*)VAR_0->bytestream - (const char*)VAR_1 + 3)&~3) != VAR_11 + VAR_8 + VAR_10 + VAR_9)\nav_log(VAR_0->avctx, AV_LOG_ERROR, \" %d %td %td bytes left\\n\",\nVAR_8 - (get_bits_count(&VAR_0->gb)+31)/32*4,\n-(((const char*)VAR_0->bytestream - (const char*)VAR_1 + 3)&~3) + (VAR_11 + VAR_8 + VAR_10 + VAR_9),\n-(((const char*)VAR_0->wordstream - (const char*)VAR_1 + 2)&~2) + (VAR_11 + VAR_8 + VAR_10)\n);",
"return 0;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1
],
[
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
43,
45,
47,
49,
51
],
[
53,
55
],
[
57
],
[
59
],
[
63
],
[
65,
67
],
[
69
],
[
71
],
[
73
],
[
77
],
[
79
],
[
83
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
103,
105,
107,
109,
111,
113,
115,
117
],
[
121
],
[
123
]
]
|
12,358 | static inline int halfpel_motion_search(MpegEncContext * s,
int *mx_ptr, int *my_ptr, int dmin,
int xmin, int ymin, int xmax, int ymax,
int pred_x, int pred_y, uint8_t *ref_picture)
{
UINT16 *mv_penalty= s->mv_penalty[s->f_code] + MAX_MV; // f_code of the prev frame
const int quant= s->qscale;
int pen_x, pen_y;
int mx, my, mx1, my1, d, xx, yy, dminh;
UINT8 *pix, *ptr;
mx = *mx_ptr;
my = *my_ptr;
ptr = ref_picture + (my * s->linesize) + mx;
xx = 16 * s->mb_x;
yy = 16 * s->mb_y;
pix = s->new_picture[0] + (yy * s->linesize) + xx;
dminh = dmin;
if (mx > xmin && mx < xmax &&
my > ymin && my < ymax) {
mx= mx1= 2*(mx - xx);
my= my1= 2*(my - yy);
if(dmin < Z_THRESHOLD && mx==0 && my==0){
*mx_ptr = 0;
*my_ptr = 0;
return dmin;
}
pen_x= pred_x + mx;
pen_y= pred_y + my;
ptr-= s->linesize;
CHECK_HALF_MV(xy2, -1, -1)
CHECK_HALF_MV(y2 , 0, -1)
CHECK_HALF_MV(xy2, +1, -1)
ptr+= s->linesize;
CHECK_HALF_MV(x2 , -1, 0)
CHECK_HALF_MV(x2 , +1, 0)
CHECK_HALF_MV(xy2, -1, +1)
CHECK_HALF_MV(y2 , 0, +1)
CHECK_HALF_MV(xy2, +1, +1)
}else{
mx= 2*(mx - xx);
my= 2*(my - yy);
}
*mx_ptr = mx;
*my_ptr = my;
return dminh;
}
| false | FFmpeg | 0d21a84605bad4e75dacb8196e5859902ed36f01 | static inline int halfpel_motion_search(MpegEncContext * s,
int *mx_ptr, int *my_ptr, int dmin,
int xmin, int ymin, int xmax, int ymax,
int pred_x, int pred_y, uint8_t *ref_picture)
{
UINT16 *mv_penalty= s->mv_penalty[s->f_code] + MAX_MV;
const int quant= s->qscale;
int pen_x, pen_y;
int mx, my, mx1, my1, d, xx, yy, dminh;
UINT8 *pix, *ptr;
mx = *mx_ptr;
my = *my_ptr;
ptr = ref_picture + (my * s->linesize) + mx;
xx = 16 * s->mb_x;
yy = 16 * s->mb_y;
pix = s->new_picture[0] + (yy * s->linesize) + xx;
dminh = dmin;
if (mx > xmin && mx < xmax &&
my > ymin && my < ymax) {
mx= mx1= 2*(mx - xx);
my= my1= 2*(my - yy);
if(dmin < Z_THRESHOLD && mx==0 && my==0){
*mx_ptr = 0;
*my_ptr = 0;
return dmin;
}
pen_x= pred_x + mx;
pen_y= pred_y + my;
ptr-= s->linesize;
CHECK_HALF_MV(xy2, -1, -1)
CHECK_HALF_MV(y2 , 0, -1)
CHECK_HALF_MV(xy2, +1, -1)
ptr+= s->linesize;
CHECK_HALF_MV(x2 , -1, 0)
CHECK_HALF_MV(x2 , +1, 0)
CHECK_HALF_MV(xy2, -1, +1)
CHECK_HALF_MV(y2 , 0, +1)
CHECK_HALF_MV(xy2, +1, +1)
}else{
mx= 2*(mx - xx);
my= 2*(my - yy);
}
*mx_ptr = mx;
*my_ptr = my;
return dminh;
}
| {
"code": [],
"line_no": []
} | static inline int FUNC_0(MpegEncContext * VAR_0,
int *VAR_1, int *VAR_2, int VAR_3,
int VAR_4, int VAR_5, int VAR_6, int VAR_7,
int VAR_8, int VAR_9, uint8_t *VAR_10)
{
UINT16 *mv_penalty= VAR_0->mv_penalty[VAR_0->f_code] + MAX_MV;
const int VAR_11= VAR_0->qscale;
int VAR_12, VAR_13;
int VAR_14, VAR_15, VAR_16, VAR_17, VAR_18, VAR_19, VAR_20, VAR_21;
UINT8 *pix, *ptr;
VAR_14 = *VAR_1;
VAR_15 = *VAR_2;
ptr = VAR_10 + (VAR_15 * VAR_0->linesize) + VAR_14;
VAR_19 = 16 * VAR_0->mb_x;
VAR_20 = 16 * VAR_0->mb_y;
pix = VAR_0->new_picture[0] + (VAR_20 * VAR_0->linesize) + VAR_19;
VAR_21 = VAR_3;
if (VAR_14 > VAR_4 && VAR_14 < VAR_6 &&
VAR_15 > VAR_5 && VAR_15 < VAR_7) {
VAR_14= VAR_16= 2*(VAR_14 - VAR_19);
VAR_15= VAR_17= 2*(VAR_15 - VAR_20);
if(VAR_3 < Z_THRESHOLD && VAR_14==0 && VAR_15==0){
*VAR_1 = 0;
*VAR_2 = 0;
return VAR_3;
}
VAR_12= VAR_8 + VAR_14;
VAR_13= VAR_9 + VAR_15;
ptr-= VAR_0->linesize;
CHECK_HALF_MV(xy2, -1, -1)
CHECK_HALF_MV(y2 , 0, -1)
CHECK_HALF_MV(xy2, +1, -1)
ptr+= VAR_0->linesize;
CHECK_HALF_MV(x2 , -1, 0)
CHECK_HALF_MV(x2 , +1, 0)
CHECK_HALF_MV(xy2, -1, +1)
CHECK_HALF_MV(y2 , 0, +1)
CHECK_HALF_MV(xy2, +1, +1)
}else{
VAR_14= 2*(VAR_14 - VAR_19);
VAR_15= 2*(VAR_15 - VAR_20);
}
*VAR_1 = VAR_14;
*VAR_2 = VAR_15;
return VAR_21;
}
| [
"static inline int FUNC_0(MpegEncContext * VAR_0,\nint *VAR_1, int *VAR_2, int VAR_3,\nint VAR_4, int VAR_5, int VAR_6, int VAR_7,\nint VAR_8, int VAR_9, uint8_t *VAR_10)\n{",
"UINT16 *mv_penalty= VAR_0->mv_penalty[VAR_0->f_code] + MAX_MV;",
"const int VAR_11= VAR_0->qscale;",
"int VAR_12, VAR_13;",
"int VAR_14, VAR_15, VAR_16, VAR_17, VAR_18, VAR_19, VAR_20, VAR_21;",
"UINT8 *pix, *ptr;",
"VAR_14 = *VAR_1;",
"VAR_15 = *VAR_2;",
"ptr = VAR_10 + (VAR_15 * VAR_0->linesize) + VAR_14;",
"VAR_19 = 16 * VAR_0->mb_x;",
"VAR_20 = 16 * VAR_0->mb_y;",
"pix = VAR_0->new_picture[0] + (VAR_20 * VAR_0->linesize) + VAR_19;",
"VAR_21 = VAR_3;",
"if (VAR_14 > VAR_4 && VAR_14 < VAR_6 &&\nVAR_15 > VAR_5 && VAR_15 < VAR_7) {",
"VAR_14= VAR_16= 2*(VAR_14 - VAR_19);",
"VAR_15= VAR_17= 2*(VAR_15 - VAR_20);",
"if(VAR_3 < Z_THRESHOLD && VAR_14==0 && VAR_15==0){",
"*VAR_1 = 0;",
"*VAR_2 = 0;",
"return VAR_3;",
"}",
"VAR_12= VAR_8 + VAR_14;",
"VAR_13= VAR_9 + VAR_15;",
"ptr-= VAR_0->linesize;",
"CHECK_HALF_MV(xy2, -1, -1)\nCHECK_HALF_MV(y2 , 0, -1)\nCHECK_HALF_MV(xy2, +1, -1)\nptr+= VAR_0->linesize;",
"CHECK_HALF_MV(x2 , -1, 0)\nCHECK_HALF_MV(x2 , +1, 0)\nCHECK_HALF_MV(xy2, -1, +1)\nCHECK_HALF_MV(y2 , 0, +1)\nCHECK_HALF_MV(xy2, +1, +1)\n}else{",
"VAR_14= 2*(VAR_14 - VAR_19);",
"VAR_15= 2*(VAR_15 - VAR_20);",
"}",
"*VAR_1 = VAR_14;",
"*VAR_2 = VAR_15;",
"return VAR_21;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
39
],
[
43,
45
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
65
],
[
67
],
[
71
],
[
73,
75,
77,
81
],
[
83,
85,
87,
89,
91,
95
],
[
97
],
[
99
],
[
101
],
[
105
],
[
107
],
[
109
],
[
111
]
]
|
12,359 | void ff_avg_h264_qpel16_mc02_msa(uint8_t *dst, const uint8_t *src,
ptrdiff_t stride)
{
avc_luma_vt_and_aver_dst_16x16_msa(src - (stride * 2), stride, dst, stride);
}
| false | FFmpeg | 72dbc610be3272ba36603f78a39cc2d2d8fe0cc3 | void ff_avg_h264_qpel16_mc02_msa(uint8_t *dst, const uint8_t *src,
ptrdiff_t stride)
{
avc_luma_vt_and_aver_dst_16x16_msa(src - (stride * 2), stride, dst, stride);
}
| {
"code": [],
"line_no": []
} | void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1,
ptrdiff_t VAR_2)
{
avc_luma_vt_and_aver_dst_16x16_msa(VAR_1 - (VAR_2 * 2), VAR_2, VAR_0, VAR_2);
}
| [
"void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1,\nptrdiff_t VAR_2)\n{",
"avc_luma_vt_and_aver_dst_16x16_msa(VAR_1 - (VAR_2 * 2), VAR_2, VAR_0, VAR_2);",
"}"
]
| [
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
]
]
|
12,360 | static inline int check_input_motion(MpegEncContext * s, int mb_x, int mb_y, int p_type){
MotionEstContext * const c= &s->me;
Picture *p= s->current_picture_ptr;
int mb_xy= mb_x + mb_y*s->mb_stride;
int xy= 2*mb_x + 2*mb_y*s->b8_stride;
int mb_type= s->current_picture.mb_type[mb_xy];
int flags= c->flags;
int shift= (flags&FLAG_QPEL) + 1;
int mask= (1<<shift)-1;
int x, y, i;
int d=0;
me_cmp_func cmpf= s->dsp.sse[0];
me_cmp_func chroma_cmpf= s->dsp.sse[1];
assert(p_type==0 || !USES_LIST(mb_type, 1));
assert(IS_INTRA(mb_type) || USES_LIST(mb_type,0) || USES_LIST(mb_type,1));
if(IS_INTERLACED(mb_type)){
int xy2= xy + s->b8_stride;
s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_INTRA;
c->stride<<=1;
c->uvstride<<=1;
if(!(s->flags & CODEC_FLAG_INTERLACED_ME)){
av_log(c->avctx, AV_LOG_ERROR, "Interlaced macroblock selected but interlaced motion estimation disabled\n");
return -1;
}
if(USES_LIST(mb_type, 0)){
int field_select0= p->ref_index[0][xy ];
int field_select1= p->ref_index[0][xy2];
assert(field_select0==0 ||field_select0==1);
assert(field_select1==0 ||field_select1==1);
init_interlaced_ref(s, 0);
if(p_type){
s->p_field_select_table[0][mb_xy]= field_select0;
s->p_field_select_table[1][mb_xy]= field_select1;
*(uint32_t*)s->p_field_mv_table[0][field_select0][mb_xy]= *(uint32_t*)p->motion_val[0][xy ];
*(uint32_t*)s->p_field_mv_table[1][field_select1][mb_xy]= *(uint32_t*)p->motion_val[0][xy2];
s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_INTER_I;
}else{
s->b_field_select_table[0][0][mb_xy]= field_select0;
s->b_field_select_table[0][1][mb_xy]= field_select1;
*(uint32_t*)s->b_field_mv_table[0][0][field_select0][mb_xy]= *(uint32_t*)p->motion_val[0][xy ];
*(uint32_t*)s->b_field_mv_table[0][1][field_select1][mb_xy]= *(uint32_t*)p->motion_val[0][xy2];
s->mb_type[mb_xy]= CANDIDATE_MB_TYPE_FORWARD_I;
}
x= p->motion_val[0][xy ][0];
y= p->motion_val[0][xy ][1];
d = cmp(s, x>>shift, y>>shift, x&mask, y&mask, 0, 8, field_select0, 0, cmpf, chroma_cmpf, flags);
x= p->motion_val[0][xy2][0];
y= p->motion_val[0][xy2][1];
d+= cmp(s, x>>shift, y>>shift, x&mask, y&mask, 0, 8, field_select1, 1, cmpf, chroma_cmpf, flags);
}
if(USES_LIST(mb_type, 1)){
int field_select0= p->ref_index[1][xy ];
int field_select1= p->ref_index[1][xy2];
assert(field_select0==0 ||field_select0==1);
assert(field_select1==0 ||field_select1==1);
init_interlaced_ref(s, 2);
s->b_field_select_table[1][0][mb_xy]= field_select0;
s->b_field_select_table[1][1][mb_xy]= field_select1;
*(uint32_t*)s->b_field_mv_table[1][0][field_select0][mb_xy]= *(uint32_t*)p->motion_val[1][xy ];
*(uint32_t*)s->b_field_mv_table[1][1][field_select1][mb_xy]= *(uint32_t*)p->motion_val[1][xy2];
if(USES_LIST(mb_type, 0)){
s->mb_type[mb_xy]= CANDIDATE_MB_TYPE_BIDIR_I;
}else{
s->mb_type[mb_xy]= CANDIDATE_MB_TYPE_BACKWARD_I;
}
x= p->motion_val[1][xy ][0];
y= p->motion_val[1][xy ][1];
d = cmp(s, x>>shift, y>>shift, x&mask, y&mask, 0, 8, field_select0+2, 0, cmpf, chroma_cmpf, flags);
x= p->motion_val[1][xy2][0];
y= p->motion_val[1][xy2][1];
d+= cmp(s, x>>shift, y>>shift, x&mask, y&mask, 0, 8, field_select1+2, 1, cmpf, chroma_cmpf, flags);
//FIXME bidir scores
}
c->stride>>=1;
c->uvstride>>=1;
}else if(IS_8X8(mb_type)){
if(!(s->flags & CODEC_FLAG_4MV)){
av_log(c->avctx, AV_LOG_ERROR, "4MV macroblock selected but 4MV encoding disabled\n");
return -1;
}
cmpf= s->dsp.sse[1];
chroma_cmpf= s->dsp.sse[1];
init_mv4_ref(c);
for(i=0; i<4; i++){
xy= s->block_index[i];
x= p->motion_val[0][xy][0];
y= p->motion_val[0][xy][1];
d+= cmp(s, x>>shift, y>>shift, x&mask, y&mask, 1, 8, i, i, cmpf, chroma_cmpf, flags);
}
s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_INTER4V;
}else{
if(USES_LIST(mb_type, 0)){
if(p_type){
*(uint32_t*)s->p_mv_table[mb_xy]= *(uint32_t*)p->motion_val[0][xy];
s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_INTER;
}else if(USES_LIST(mb_type, 1)){
*(uint32_t*)s->b_bidir_forw_mv_table[mb_xy]= *(uint32_t*)p->motion_val[0][xy];
*(uint32_t*)s->b_bidir_back_mv_table[mb_xy]= *(uint32_t*)p->motion_val[1][xy];
s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_BIDIR;
}else{
*(uint32_t*)s->b_forw_mv_table[mb_xy]= *(uint32_t*)p->motion_val[0][xy];
s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_FORWARD;
}
x= p->motion_val[0][xy][0];
y= p->motion_val[0][xy][1];
d = cmp(s, x>>shift, y>>shift, x&mask, y&mask, 0, 16, 0, 0, cmpf, chroma_cmpf, flags);
}else if(USES_LIST(mb_type, 1)){
*(uint32_t*)s->b_back_mv_table[mb_xy]= *(uint32_t*)p->motion_val[1][xy];
s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_BACKWARD;
x= p->motion_val[1][xy][0];
y= p->motion_val[1][xy][1];
d = cmp(s, x>>shift, y>>shift, x&mask, y&mask, 0, 16, 2, 0, cmpf, chroma_cmpf, flags);
}else
s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_INTRA;
}
return d;
}
| false | FFmpeg | ae1dbde1cf6a9a96d802dc38b6741824857b24c5 | static inline int check_input_motion(MpegEncContext * s, int mb_x, int mb_y, int p_type){
MotionEstContext * const c= &s->me;
Picture *p= s->current_picture_ptr;
int mb_xy= mb_x + mb_y*s->mb_stride;
int xy= 2*mb_x + 2*mb_y*s->b8_stride;
int mb_type= s->current_picture.mb_type[mb_xy];
int flags= c->flags;
int shift= (flags&FLAG_QPEL) + 1;
int mask= (1<<shift)-1;
int x, y, i;
int d=0;
me_cmp_func cmpf= s->dsp.sse[0];
me_cmp_func chroma_cmpf= s->dsp.sse[1];
assert(p_type==0 || !USES_LIST(mb_type, 1));
assert(IS_INTRA(mb_type) || USES_LIST(mb_type,0) || USES_LIST(mb_type,1));
if(IS_INTERLACED(mb_type)){
int xy2= xy + s->b8_stride;
s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_INTRA;
c->stride<<=1;
c->uvstride<<=1;
if(!(s->flags & CODEC_FLAG_INTERLACED_ME)){
av_log(c->avctx, AV_LOG_ERROR, "Interlaced macroblock selected but interlaced motion estimation disabled\n");
return -1;
}
if(USES_LIST(mb_type, 0)){
int field_select0= p->ref_index[0][xy ];
int field_select1= p->ref_index[0][xy2];
assert(field_select0==0 ||field_select0==1);
assert(field_select1==0 ||field_select1==1);
init_interlaced_ref(s, 0);
if(p_type){
s->p_field_select_table[0][mb_xy]= field_select0;
s->p_field_select_table[1][mb_xy]= field_select1;
*(uint32_t*)s->p_field_mv_table[0][field_select0][mb_xy]= *(uint32_t*)p->motion_val[0][xy ];
*(uint32_t*)s->p_field_mv_table[1][field_select1][mb_xy]= *(uint32_t*)p->motion_val[0][xy2];
s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_INTER_I;
}else{
s->b_field_select_table[0][0][mb_xy]= field_select0;
s->b_field_select_table[0][1][mb_xy]= field_select1;
*(uint32_t*)s->b_field_mv_table[0][0][field_select0][mb_xy]= *(uint32_t*)p->motion_val[0][xy ];
*(uint32_t*)s->b_field_mv_table[0][1][field_select1][mb_xy]= *(uint32_t*)p->motion_val[0][xy2];
s->mb_type[mb_xy]= CANDIDATE_MB_TYPE_FORWARD_I;
}
x= p->motion_val[0][xy ][0];
y= p->motion_val[0][xy ][1];
d = cmp(s, x>>shift, y>>shift, x&mask, y&mask, 0, 8, field_select0, 0, cmpf, chroma_cmpf, flags);
x= p->motion_val[0][xy2][0];
y= p->motion_val[0][xy2][1];
d+= cmp(s, x>>shift, y>>shift, x&mask, y&mask, 0, 8, field_select1, 1, cmpf, chroma_cmpf, flags);
}
if(USES_LIST(mb_type, 1)){
int field_select0= p->ref_index[1][xy ];
int field_select1= p->ref_index[1][xy2];
assert(field_select0==0 ||field_select0==1);
assert(field_select1==0 ||field_select1==1);
init_interlaced_ref(s, 2);
s->b_field_select_table[1][0][mb_xy]= field_select0;
s->b_field_select_table[1][1][mb_xy]= field_select1;
*(uint32_t*)s->b_field_mv_table[1][0][field_select0][mb_xy]= *(uint32_t*)p->motion_val[1][xy ];
*(uint32_t*)s->b_field_mv_table[1][1][field_select1][mb_xy]= *(uint32_t*)p->motion_val[1][xy2];
if(USES_LIST(mb_type, 0)){
s->mb_type[mb_xy]= CANDIDATE_MB_TYPE_BIDIR_I;
}else{
s->mb_type[mb_xy]= CANDIDATE_MB_TYPE_BACKWARD_I;
}
x= p->motion_val[1][xy ][0];
y= p->motion_val[1][xy ][1];
d = cmp(s, x>>shift, y>>shift, x&mask, y&mask, 0, 8, field_select0+2, 0, cmpf, chroma_cmpf, flags);
x= p->motion_val[1][xy2][0];
y= p->motion_val[1][xy2][1];
d+= cmp(s, x>>shift, y>>shift, x&mask, y&mask, 0, 8, field_select1+2, 1, cmpf, chroma_cmpf, flags);
}
c->stride>>=1;
c->uvstride>>=1;
}else if(IS_8X8(mb_type)){
if(!(s->flags & CODEC_FLAG_4MV)){
av_log(c->avctx, AV_LOG_ERROR, "4MV macroblock selected but 4MV encoding disabled\n");
return -1;
}
cmpf= s->dsp.sse[1];
chroma_cmpf= s->dsp.sse[1];
init_mv4_ref(c);
for(i=0; i<4; i++){
xy= s->block_index[i];
x= p->motion_val[0][xy][0];
y= p->motion_val[0][xy][1];
d+= cmp(s, x>>shift, y>>shift, x&mask, y&mask, 1, 8, i, i, cmpf, chroma_cmpf, flags);
}
s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_INTER4V;
}else{
if(USES_LIST(mb_type, 0)){
if(p_type){
*(uint32_t*)s->p_mv_table[mb_xy]= *(uint32_t*)p->motion_val[0][xy];
s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_INTER;
}else if(USES_LIST(mb_type, 1)){
*(uint32_t*)s->b_bidir_forw_mv_table[mb_xy]= *(uint32_t*)p->motion_val[0][xy];
*(uint32_t*)s->b_bidir_back_mv_table[mb_xy]= *(uint32_t*)p->motion_val[1][xy];
s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_BIDIR;
}else{
*(uint32_t*)s->b_forw_mv_table[mb_xy]= *(uint32_t*)p->motion_val[0][xy];
s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_FORWARD;
}
x= p->motion_val[0][xy][0];
y= p->motion_val[0][xy][1];
d = cmp(s, x>>shift, y>>shift, x&mask, y&mask, 0, 16, 0, 0, cmpf, chroma_cmpf, flags);
}else if(USES_LIST(mb_type, 1)){
*(uint32_t*)s->b_back_mv_table[mb_xy]= *(uint32_t*)p->motion_val[1][xy];
s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_BACKWARD;
x= p->motion_val[1][xy][0];
y= p->motion_val[1][xy][1];
d = cmp(s, x>>shift, y>>shift, x&mask, y&mask, 0, 16, 2, 0, cmpf, chroma_cmpf, flags);
}else
s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_INTRA;
}
return d;
}
| {
"code": [],
"line_no": []
} | static inline int FUNC_0(MpegEncContext * VAR_0, int VAR_1, int VAR_2, int VAR_3){
MotionEstContext * const c= &VAR_0->me;
Picture *p= VAR_0->current_picture_ptr;
int VAR_4= VAR_1 + VAR_2*VAR_0->mb_stride;
int VAR_5= 2*VAR_1 + 2*VAR_2*VAR_0->b8_stride;
int VAR_6= VAR_0->current_picture.VAR_6[VAR_4];
int VAR_7= c->VAR_7;
int VAR_8= (VAR_7&FLAG_QPEL) + 1;
int VAR_9= (1<<VAR_8)-1;
int VAR_10, VAR_11, VAR_12;
int VAR_13=0;
me_cmp_func cmpf= VAR_0->dsp.sse[0];
me_cmp_func chroma_cmpf= VAR_0->dsp.sse[1];
assert(VAR_3==0 || !USES_LIST(VAR_6, 1));
assert(IS_INTRA(VAR_6) || USES_LIST(VAR_6,0) || USES_LIST(VAR_6,1));
if(IS_INTERLACED(VAR_6)){
int VAR_14= VAR_5 + VAR_0->b8_stride;
VAR_0->VAR_6[VAR_4]=CANDIDATE_MB_TYPE_INTRA;
c->stride<<=1;
c->uvstride<<=1;
if(!(VAR_0->VAR_7 & CODEC_FLAG_INTERLACED_ME)){
av_log(c->avctx, AV_LOG_ERROR, "Interlaced macroblock selected but interlaced motion estimation disabled\n");
return -1;
}
if(USES_LIST(VAR_6, 0)){
int VAR_17= p->ref_index[0][VAR_5 ];
int VAR_17= p->ref_index[0][VAR_14];
assert(VAR_17==0 ||VAR_17==1);
assert(VAR_17==0 ||VAR_17==1);
init_interlaced_ref(VAR_0, 0);
if(VAR_3){
VAR_0->p_field_select_table[0][VAR_4]= VAR_17;
VAR_0->p_field_select_table[1][VAR_4]= VAR_17;
*(uint32_t*)VAR_0->p_field_mv_table[0][VAR_17][VAR_4]= *(uint32_t*)p->motion_val[0][VAR_5 ];
*(uint32_t*)VAR_0->p_field_mv_table[1][VAR_17][VAR_4]= *(uint32_t*)p->motion_val[0][VAR_14];
VAR_0->VAR_6[VAR_4]=CANDIDATE_MB_TYPE_INTER_I;
}else{
VAR_0->b_field_select_table[0][0][VAR_4]= VAR_17;
VAR_0->b_field_select_table[0][1][VAR_4]= VAR_17;
*(uint32_t*)VAR_0->b_field_mv_table[0][0][VAR_17][VAR_4]= *(uint32_t*)p->motion_val[0][VAR_5 ];
*(uint32_t*)VAR_0->b_field_mv_table[0][1][VAR_17][VAR_4]= *(uint32_t*)p->motion_val[0][VAR_14];
VAR_0->VAR_6[VAR_4]= CANDIDATE_MB_TYPE_FORWARD_I;
}
VAR_10= p->motion_val[0][VAR_5 ][0];
VAR_11= p->motion_val[0][VAR_5 ][1];
VAR_13 = cmp(VAR_0, VAR_10>>VAR_8, VAR_11>>VAR_8, VAR_10&VAR_9, VAR_11&VAR_9, 0, 8, VAR_17, 0, cmpf, chroma_cmpf, VAR_7);
VAR_10= p->motion_val[0][VAR_14][0];
VAR_11= p->motion_val[0][VAR_14][1];
VAR_13+= cmp(VAR_0, VAR_10>>VAR_8, VAR_11>>VAR_8, VAR_10&VAR_9, VAR_11&VAR_9, 0, 8, VAR_17, 1, cmpf, chroma_cmpf, VAR_7);
}
if(USES_LIST(VAR_6, 1)){
int VAR_17= p->ref_index[1][VAR_5 ];
int VAR_17= p->ref_index[1][VAR_14];
assert(VAR_17==0 ||VAR_17==1);
assert(VAR_17==0 ||VAR_17==1);
init_interlaced_ref(VAR_0, 2);
VAR_0->b_field_select_table[1][0][VAR_4]= VAR_17;
VAR_0->b_field_select_table[1][1][VAR_4]= VAR_17;
*(uint32_t*)VAR_0->b_field_mv_table[1][0][VAR_17][VAR_4]= *(uint32_t*)p->motion_val[1][VAR_5 ];
*(uint32_t*)VAR_0->b_field_mv_table[1][1][VAR_17][VAR_4]= *(uint32_t*)p->motion_val[1][VAR_14];
if(USES_LIST(VAR_6, 0)){
VAR_0->VAR_6[VAR_4]= CANDIDATE_MB_TYPE_BIDIR_I;
}else{
VAR_0->VAR_6[VAR_4]= CANDIDATE_MB_TYPE_BACKWARD_I;
}
VAR_10= p->motion_val[1][VAR_5 ][0];
VAR_11= p->motion_val[1][VAR_5 ][1];
VAR_13 = cmp(VAR_0, VAR_10>>VAR_8, VAR_11>>VAR_8, VAR_10&VAR_9, VAR_11&VAR_9, 0, 8, VAR_17+2, 0, cmpf, chroma_cmpf, VAR_7);
VAR_10= p->motion_val[1][VAR_14][0];
VAR_11= p->motion_val[1][VAR_14][1];
VAR_13+= cmp(VAR_0, VAR_10>>VAR_8, VAR_11>>VAR_8, VAR_10&VAR_9, VAR_11&VAR_9, 0, 8, VAR_17+2, 1, cmpf, chroma_cmpf, VAR_7);
}
c->stride>>=1;
c->uvstride>>=1;
}else if(IS_8X8(VAR_6)){
if(!(VAR_0->VAR_7 & CODEC_FLAG_4MV)){
av_log(c->avctx, AV_LOG_ERROR, "4MV macroblock selected but 4MV encoding disabled\n");
return -1;
}
cmpf= VAR_0->dsp.sse[1];
chroma_cmpf= VAR_0->dsp.sse[1];
init_mv4_ref(c);
for(VAR_12=0; VAR_12<4; VAR_12++){
VAR_5= VAR_0->block_index[VAR_12];
VAR_10= p->motion_val[0][VAR_5][0];
VAR_11= p->motion_val[0][VAR_5][1];
VAR_13+= cmp(VAR_0, VAR_10>>VAR_8, VAR_11>>VAR_8, VAR_10&VAR_9, VAR_11&VAR_9, 1, 8, VAR_12, VAR_12, cmpf, chroma_cmpf, VAR_7);
}
VAR_0->VAR_6[VAR_4]=CANDIDATE_MB_TYPE_INTER4V;
}else{
if(USES_LIST(VAR_6, 0)){
if(VAR_3){
*(uint32_t*)VAR_0->p_mv_table[VAR_4]= *(uint32_t*)p->motion_val[0][VAR_5];
VAR_0->VAR_6[VAR_4]=CANDIDATE_MB_TYPE_INTER;
}else if(USES_LIST(VAR_6, 1)){
*(uint32_t*)VAR_0->b_bidir_forw_mv_table[VAR_4]= *(uint32_t*)p->motion_val[0][VAR_5];
*(uint32_t*)VAR_0->b_bidir_back_mv_table[VAR_4]= *(uint32_t*)p->motion_val[1][VAR_5];
VAR_0->VAR_6[VAR_4]=CANDIDATE_MB_TYPE_BIDIR;
}else{
*(uint32_t*)VAR_0->b_forw_mv_table[VAR_4]= *(uint32_t*)p->motion_val[0][VAR_5];
VAR_0->VAR_6[VAR_4]=CANDIDATE_MB_TYPE_FORWARD;
}
VAR_10= p->motion_val[0][VAR_5][0];
VAR_11= p->motion_val[0][VAR_5][1];
VAR_13 = cmp(VAR_0, VAR_10>>VAR_8, VAR_11>>VAR_8, VAR_10&VAR_9, VAR_11&VAR_9, 0, 16, 0, 0, cmpf, chroma_cmpf, VAR_7);
}else if(USES_LIST(VAR_6, 1)){
*(uint32_t*)VAR_0->b_back_mv_table[VAR_4]= *(uint32_t*)p->motion_val[1][VAR_5];
VAR_0->VAR_6[VAR_4]=CANDIDATE_MB_TYPE_BACKWARD;
VAR_10= p->motion_val[1][VAR_5][0];
VAR_11= p->motion_val[1][VAR_5][1];
VAR_13 = cmp(VAR_0, VAR_10>>VAR_8, VAR_11>>VAR_8, VAR_10&VAR_9, VAR_11&VAR_9, 0, 16, 2, 0, cmpf, chroma_cmpf, VAR_7);
}else
VAR_0->VAR_6[VAR_4]=CANDIDATE_MB_TYPE_INTRA;
}
return VAR_13;
}
| [
"static inline int FUNC_0(MpegEncContext * VAR_0, int VAR_1, int VAR_2, int VAR_3){",
"MotionEstContext * const c= &VAR_0->me;",
"Picture *p= VAR_0->current_picture_ptr;",
"int VAR_4= VAR_1 + VAR_2*VAR_0->mb_stride;",
"int VAR_5= 2*VAR_1 + 2*VAR_2*VAR_0->b8_stride;",
"int VAR_6= VAR_0->current_picture.VAR_6[VAR_4];",
"int VAR_7= c->VAR_7;",
"int VAR_8= (VAR_7&FLAG_QPEL) + 1;",
"int VAR_9= (1<<VAR_8)-1;",
"int VAR_10, VAR_11, VAR_12;",
"int VAR_13=0;",
"me_cmp_func cmpf= VAR_0->dsp.sse[0];",
"me_cmp_func chroma_cmpf= VAR_0->dsp.sse[1];",
"assert(VAR_3==0 || !USES_LIST(VAR_6, 1));",
"assert(IS_INTRA(VAR_6) || USES_LIST(VAR_6,0) || USES_LIST(VAR_6,1));",
"if(IS_INTERLACED(VAR_6)){",
"int VAR_14= VAR_5 + VAR_0->b8_stride;",
"VAR_0->VAR_6[VAR_4]=CANDIDATE_MB_TYPE_INTRA;",
"c->stride<<=1;",
"c->uvstride<<=1;",
"if(!(VAR_0->VAR_7 & CODEC_FLAG_INTERLACED_ME)){",
"av_log(c->avctx, AV_LOG_ERROR, \"Interlaced macroblock selected but interlaced motion estimation disabled\\n\");",
"return -1;",
"}",
"if(USES_LIST(VAR_6, 0)){",
"int VAR_17= p->ref_index[0][VAR_5 ];",
"int VAR_17= p->ref_index[0][VAR_14];",
"assert(VAR_17==0 ||VAR_17==1);",
"assert(VAR_17==0 ||VAR_17==1);",
"init_interlaced_ref(VAR_0, 0);",
"if(VAR_3){",
"VAR_0->p_field_select_table[0][VAR_4]= VAR_17;",
"VAR_0->p_field_select_table[1][VAR_4]= VAR_17;",
"*(uint32_t*)VAR_0->p_field_mv_table[0][VAR_17][VAR_4]= *(uint32_t*)p->motion_val[0][VAR_5 ];",
"*(uint32_t*)VAR_0->p_field_mv_table[1][VAR_17][VAR_4]= *(uint32_t*)p->motion_val[0][VAR_14];",
"VAR_0->VAR_6[VAR_4]=CANDIDATE_MB_TYPE_INTER_I;",
"}else{",
"VAR_0->b_field_select_table[0][0][VAR_4]= VAR_17;",
"VAR_0->b_field_select_table[0][1][VAR_4]= VAR_17;",
"*(uint32_t*)VAR_0->b_field_mv_table[0][0][VAR_17][VAR_4]= *(uint32_t*)p->motion_val[0][VAR_5 ];",
"*(uint32_t*)VAR_0->b_field_mv_table[0][1][VAR_17][VAR_4]= *(uint32_t*)p->motion_val[0][VAR_14];",
"VAR_0->VAR_6[VAR_4]= CANDIDATE_MB_TYPE_FORWARD_I;",
"}",
"VAR_10= p->motion_val[0][VAR_5 ][0];",
"VAR_11= p->motion_val[0][VAR_5 ][1];",
"VAR_13 = cmp(VAR_0, VAR_10>>VAR_8, VAR_11>>VAR_8, VAR_10&VAR_9, VAR_11&VAR_9, 0, 8, VAR_17, 0, cmpf, chroma_cmpf, VAR_7);",
"VAR_10= p->motion_val[0][VAR_14][0];",
"VAR_11= p->motion_val[0][VAR_14][1];",
"VAR_13+= cmp(VAR_0, VAR_10>>VAR_8, VAR_11>>VAR_8, VAR_10&VAR_9, VAR_11&VAR_9, 0, 8, VAR_17, 1, cmpf, chroma_cmpf, VAR_7);",
"}",
"if(USES_LIST(VAR_6, 1)){",
"int VAR_17= p->ref_index[1][VAR_5 ];",
"int VAR_17= p->ref_index[1][VAR_14];",
"assert(VAR_17==0 ||VAR_17==1);",
"assert(VAR_17==0 ||VAR_17==1);",
"init_interlaced_ref(VAR_0, 2);",
"VAR_0->b_field_select_table[1][0][VAR_4]= VAR_17;",
"VAR_0->b_field_select_table[1][1][VAR_4]= VAR_17;",
"*(uint32_t*)VAR_0->b_field_mv_table[1][0][VAR_17][VAR_4]= *(uint32_t*)p->motion_val[1][VAR_5 ];",
"*(uint32_t*)VAR_0->b_field_mv_table[1][1][VAR_17][VAR_4]= *(uint32_t*)p->motion_val[1][VAR_14];",
"if(USES_LIST(VAR_6, 0)){",
"VAR_0->VAR_6[VAR_4]= CANDIDATE_MB_TYPE_BIDIR_I;",
"}else{",
"VAR_0->VAR_6[VAR_4]= CANDIDATE_MB_TYPE_BACKWARD_I;",
"}",
"VAR_10= p->motion_val[1][VAR_5 ][0];",
"VAR_11= p->motion_val[1][VAR_5 ][1];",
"VAR_13 = cmp(VAR_0, VAR_10>>VAR_8, VAR_11>>VAR_8, VAR_10&VAR_9, VAR_11&VAR_9, 0, 8, VAR_17+2, 0, cmpf, chroma_cmpf, VAR_7);",
"VAR_10= p->motion_val[1][VAR_14][0];",
"VAR_11= p->motion_val[1][VAR_14][1];",
"VAR_13+= cmp(VAR_0, VAR_10>>VAR_8, VAR_11>>VAR_8, VAR_10&VAR_9, VAR_11&VAR_9, 0, 8, VAR_17+2, 1, cmpf, chroma_cmpf, VAR_7);",
"}",
"c->stride>>=1;",
"c->uvstride>>=1;",
"}else if(IS_8X8(VAR_6)){",
"if(!(VAR_0->VAR_7 & CODEC_FLAG_4MV)){",
"av_log(c->avctx, AV_LOG_ERROR, \"4MV macroblock selected but 4MV encoding disabled\\n\");",
"return -1;",
"}",
"cmpf= VAR_0->dsp.sse[1];",
"chroma_cmpf= VAR_0->dsp.sse[1];",
"init_mv4_ref(c);",
"for(VAR_12=0; VAR_12<4; VAR_12++){",
"VAR_5= VAR_0->block_index[VAR_12];",
"VAR_10= p->motion_val[0][VAR_5][0];",
"VAR_11= p->motion_val[0][VAR_5][1];",
"VAR_13+= cmp(VAR_0, VAR_10>>VAR_8, VAR_11>>VAR_8, VAR_10&VAR_9, VAR_11&VAR_9, 1, 8, VAR_12, VAR_12, cmpf, chroma_cmpf, VAR_7);",
"}",
"VAR_0->VAR_6[VAR_4]=CANDIDATE_MB_TYPE_INTER4V;",
"}else{",
"if(USES_LIST(VAR_6, 0)){",
"if(VAR_3){",
"*(uint32_t*)VAR_0->p_mv_table[VAR_4]= *(uint32_t*)p->motion_val[0][VAR_5];",
"VAR_0->VAR_6[VAR_4]=CANDIDATE_MB_TYPE_INTER;",
"}else if(USES_LIST(VAR_6, 1)){",
"*(uint32_t*)VAR_0->b_bidir_forw_mv_table[VAR_4]= *(uint32_t*)p->motion_val[0][VAR_5];",
"*(uint32_t*)VAR_0->b_bidir_back_mv_table[VAR_4]= *(uint32_t*)p->motion_val[1][VAR_5];",
"VAR_0->VAR_6[VAR_4]=CANDIDATE_MB_TYPE_BIDIR;",
"}else{",
"*(uint32_t*)VAR_0->b_forw_mv_table[VAR_4]= *(uint32_t*)p->motion_val[0][VAR_5];",
"VAR_0->VAR_6[VAR_4]=CANDIDATE_MB_TYPE_FORWARD;",
"}",
"VAR_10= p->motion_val[0][VAR_5][0];",
"VAR_11= p->motion_val[0][VAR_5][1];",
"VAR_13 = cmp(VAR_0, VAR_10>>VAR_8, VAR_11>>VAR_8, VAR_10&VAR_9, VAR_11&VAR_9, 0, 16, 0, 0, cmpf, chroma_cmpf, VAR_7);",
"}else if(USES_LIST(VAR_6, 1)){",
"*(uint32_t*)VAR_0->b_back_mv_table[VAR_4]= *(uint32_t*)p->motion_val[1][VAR_5];",
"VAR_0->VAR_6[VAR_4]=CANDIDATE_MB_TYPE_BACKWARD;",
"VAR_10= p->motion_val[1][VAR_5][0];",
"VAR_11= p->motion_val[1][VAR_5][1];",
"VAR_13 = cmp(VAR_0, VAR_10>>VAR_8, VAR_11>>VAR_8, VAR_10&VAR_9, VAR_11&VAR_9, 0, 16, 2, 0, cmpf, chroma_cmpf, VAR_7);",
"}else",
"VAR_0->VAR_6[VAR_4]=CANDIDATE_MB_TYPE_INTRA;",
"}",
"return VAR_13;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1
],
[
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
29
],
[
31
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
47
],
[
49
],
[
51
],
[
53
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
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
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
147
],
[
149
],
[
151
],
[
153
],
[
155
],
[
157
],
[
161
],
[
163
],
[
165
],
[
167
],
[
169
],
[
171
],
[
173
],
[
175
],
[
177
],
[
179
],
[
181
],
[
183
],
[
185
],
[
187
],
[
189
],
[
191
],
[
193
],
[
195
],
[
197
],
[
199
],
[
201
],
[
203
],
[
205
],
[
207
],
[
209
],
[
211
],
[
213
],
[
215
],
[
217
],
[
219
],
[
221
],
[
223
],
[
225
],
[
227
],
[
229
],
[
231
],
[
233
],
[
237
],
[
239
],
[
241
],
[
243
],
[
245
],
[
247
],
[
249
],
[
251
]
]
|
12,361 | void *checkasm_check_func(void *func, const char *name, ...)
{
char name_buf[256];
void *ref = func;
CheckasmFuncVersion *v;
int name_length;
va_list arg;
va_start(arg, name);
name_length = vsnprintf(name_buf, sizeof(name_buf), name, arg);
va_end(arg);
if (!func || name_length <= 0 || name_length >= sizeof(name_buf))
return NULL;
state.current_func = get_func(name_buf, name_length);
v = &state.current_func->versions;
if (v->func) {
CheckasmFuncVersion *prev;
do {
/* Only test functions that haven't already been tested */
if (v->func == func)
return NULL;
if (v->ok)
ref = v->func;
prev = v;
} while ((v = v->next));
v = prev->next = checkasm_malloc(sizeof(CheckasmFuncVersion));
}
v->func = func;
v->ok = 1;
v->cpu = state.cpu_flag;
state.current_func_ver = v;
if (state.cpu_flag)
state.num_checked++;
return ref;
}
| false | FFmpeg | 2ab65b652dc5e69fb738f1afdc55f7a2f9cbc0e0 | void *checkasm_check_func(void *func, const char *name, ...)
{
char name_buf[256];
void *ref = func;
CheckasmFuncVersion *v;
int name_length;
va_list arg;
va_start(arg, name);
name_length = vsnprintf(name_buf, sizeof(name_buf), name, arg);
va_end(arg);
if (!func || name_length <= 0 || name_length >= sizeof(name_buf))
return NULL;
state.current_func = get_func(name_buf, name_length);
v = &state.current_func->versions;
if (v->func) {
CheckasmFuncVersion *prev;
do {
if (v->func == func)
return NULL;
if (v->ok)
ref = v->func;
prev = v;
} while ((v = v->next));
v = prev->next = checkasm_malloc(sizeof(CheckasmFuncVersion));
}
v->func = func;
v->ok = 1;
v->cpu = state.cpu_flag;
state.current_func_ver = v;
if (state.cpu_flag)
state.num_checked++;
return ref;
}
| {
"code": [],
"line_no": []
} | void *FUNC_0(void *VAR_0, const char *VAR_1, ...)
{
char VAR_2[256];
void *VAR_3 = VAR_0;
CheckasmFuncVersion *v;
int VAR_4;
va_list arg;
va_start(arg, VAR_1);
VAR_4 = vsnprintf(VAR_2, sizeof(VAR_2), VAR_1, arg);
va_end(arg);
if (!VAR_0 || VAR_4 <= 0 || VAR_4 >= sizeof(VAR_2))
return NULL;
state.current_func = get_func(VAR_2, VAR_4);
v = &state.current_func->versions;
if (v->VAR_0) {
CheckasmFuncVersion *prev;
do {
if (v->VAR_0 == VAR_0)
return NULL;
if (v->ok)
VAR_3 = v->VAR_0;
prev = v;
} while ((v = v->next));
v = prev->next = checkasm_malloc(sizeof(CheckasmFuncVersion));
}
v->VAR_0 = VAR_0;
v->ok = 1;
v->cpu = state.cpu_flag;
state.current_func_ver = v;
if (state.cpu_flag)
state.num_checked++;
return VAR_3;
}
| [
"void *FUNC_0(void *VAR_0, const char *VAR_1, ...)\n{",
"char VAR_2[256];",
"void *VAR_3 = VAR_0;",
"CheckasmFuncVersion *v;",
"int VAR_4;",
"va_list arg;",
"va_start(arg, VAR_1);",
"VAR_4 = vsnprintf(VAR_2, sizeof(VAR_2), VAR_1, arg);",
"va_end(arg);",
"if (!VAR_0 || VAR_4 <= 0 || VAR_4 >= sizeof(VAR_2))\nreturn NULL;",
"state.current_func = get_func(VAR_2, VAR_4);",
"v = &state.current_func->versions;",
"if (v->VAR_0) {",
"CheckasmFuncVersion *prev;",
"do {",
"if (v->VAR_0 == VAR_0)\nreturn NULL;",
"if (v->ok)\nVAR_3 = v->VAR_0;",
"prev = v;",
"} while ((v = v->next));",
"v = prev->next = checkasm_malloc(sizeof(CheckasmFuncVersion));",
"}",
"v->VAR_0 = VAR_0;",
"v->ok = 1;",
"v->cpu = state.cpu_flag;",
"state.current_func_ver = v;",
"if (state.cpu_flag)\nstate.num_checked++;",
"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
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
19
],
[
21
],
[
25,
27
],
[
31
],
[
33
],
[
37
],
[
39
],
[
41
],
[
45,
47
],
[
51,
53
],
[
57
],
[
59
],
[
63
],
[
65
],
[
69
],
[
71
],
[
73
],
[
75
],
[
79,
81
],
[
85
],
[
87
]
]
|
12,363 | void ff_dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx)
{
int mm_flags = av_get_cpu_flags();
if (mm_flags & AV_CPU_FLAG_MMX) {
#if HAVE_INLINE_ASM
const int idct_algo = avctx->idct_algo;
if (avctx->bits_per_raw_sample <= 8) {
if (idct_algo == FF_IDCT_AUTO || idct_algo == FF_IDCT_SIMPLEMMX) {
c->idct_put = ff_simple_idct_put_mmx;
c->idct_add = ff_simple_idct_add_mmx;
c->idct = ff_simple_idct_mmx;
c->idct_permutation_type = FF_SIMPLE_IDCT_PERM;
} else if (idct_algo == FF_IDCT_CAVS) {
c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
} else if (idct_algo == FF_IDCT_XVIDMMX) {
if (mm_flags & AV_CPU_FLAG_SSE2) {
c->idct_put = ff_idct_xvid_sse2_put;
c->idct_add = ff_idct_xvid_sse2_add;
c->idct = ff_idct_xvid_sse2;
c->idct_permutation_type = FF_SSE2_IDCT_PERM;
} else if (mm_flags & AV_CPU_FLAG_MMXEXT) {
c->idct_put = ff_idct_xvid_mmx2_put;
c->idct_add = ff_idct_xvid_mmx2_add;
c->idct = ff_idct_xvid_mmx2;
} else {
c->idct_put = ff_idct_xvid_mmx_put;
c->idct_add = ff_idct_xvid_mmx_add;
c->idct = ff_idct_xvid_mmx;
}
}
}
#endif /* HAVE_INLINE_ASM */
dsputil_init_mmx(c, avctx, mm_flags);
}
if (mm_flags & AV_CPU_FLAG_MMXEXT)
dsputil_init_mmx2(c, avctx, mm_flags);
if (mm_flags & AV_CPU_FLAG_3DNOW && HAVE_AMD3DNOW)
dsputil_init_3dnow(c, avctx, mm_flags);
if (mm_flags & AV_CPU_FLAG_3DNOWEXT && HAVE_AMD3DNOWEXT)
dsputil_init_3dnowext(c, avctx, mm_flags);
if (mm_flags & AV_CPU_FLAG_SSE && HAVE_SSE)
dsputil_init_sse(c, avctx, mm_flags);
if (mm_flags & AV_CPU_FLAG_SSE2)
dsputil_init_sse2(c, avctx, mm_flags);
if (mm_flags & AV_CPU_FLAG_SSSE3)
dsputil_init_ssse3(c, avctx, mm_flags);
if (mm_flags & AV_CPU_FLAG_SSE4 && HAVE_SSE)
dsputil_init_sse4(c, avctx, mm_flags);
if (mm_flags & AV_CPU_FLAG_AVX)
dsputil_init_avx(c, avctx, mm_flags);
if (CONFIG_ENCODERS)
ff_dsputilenc_init_mmx(c, avctx);
}
| false | FFmpeg | ef6ba1f2378ac1e40c3c1d606b4ace47ea119ac8 | void ff_dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx)
{
int mm_flags = av_get_cpu_flags();
if (mm_flags & AV_CPU_FLAG_MMX) {
#if HAVE_INLINE_ASM
const int idct_algo = avctx->idct_algo;
if (avctx->bits_per_raw_sample <= 8) {
if (idct_algo == FF_IDCT_AUTO || idct_algo == FF_IDCT_SIMPLEMMX) {
c->idct_put = ff_simple_idct_put_mmx;
c->idct_add = ff_simple_idct_add_mmx;
c->idct = ff_simple_idct_mmx;
c->idct_permutation_type = FF_SIMPLE_IDCT_PERM;
} else if (idct_algo == FF_IDCT_CAVS) {
c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
} else if (idct_algo == FF_IDCT_XVIDMMX) {
if (mm_flags & AV_CPU_FLAG_SSE2) {
c->idct_put = ff_idct_xvid_sse2_put;
c->idct_add = ff_idct_xvid_sse2_add;
c->idct = ff_idct_xvid_sse2;
c->idct_permutation_type = FF_SSE2_IDCT_PERM;
} else if (mm_flags & AV_CPU_FLAG_MMXEXT) {
c->idct_put = ff_idct_xvid_mmx2_put;
c->idct_add = ff_idct_xvid_mmx2_add;
c->idct = ff_idct_xvid_mmx2;
} else {
c->idct_put = ff_idct_xvid_mmx_put;
c->idct_add = ff_idct_xvid_mmx_add;
c->idct = ff_idct_xvid_mmx;
}
}
}
#endif
dsputil_init_mmx(c, avctx, mm_flags);
}
if (mm_flags & AV_CPU_FLAG_MMXEXT)
dsputil_init_mmx2(c, avctx, mm_flags);
if (mm_flags & AV_CPU_FLAG_3DNOW && HAVE_AMD3DNOW)
dsputil_init_3dnow(c, avctx, mm_flags);
if (mm_flags & AV_CPU_FLAG_3DNOWEXT && HAVE_AMD3DNOWEXT)
dsputil_init_3dnowext(c, avctx, mm_flags);
if (mm_flags & AV_CPU_FLAG_SSE && HAVE_SSE)
dsputil_init_sse(c, avctx, mm_flags);
if (mm_flags & AV_CPU_FLAG_SSE2)
dsputil_init_sse2(c, avctx, mm_flags);
if (mm_flags & AV_CPU_FLAG_SSSE3)
dsputil_init_ssse3(c, avctx, mm_flags);
if (mm_flags & AV_CPU_FLAG_SSE4 && HAVE_SSE)
dsputil_init_sse4(c, avctx, mm_flags);
if (mm_flags & AV_CPU_FLAG_AVX)
dsputil_init_avx(c, avctx, mm_flags);
if (CONFIG_ENCODERS)
ff_dsputilenc_init_mmx(c, avctx);
}
| {
"code": [],
"line_no": []
} | void FUNC_0(DSPContext *VAR_0, AVCodecContext *VAR_1)
{
int VAR_2 = av_get_cpu_flags();
if (VAR_2 & AV_CPU_FLAG_MMX) {
#if HAVE_INLINE_ASM
const int idct_algo = VAR_1->idct_algo;
if (VAR_1->bits_per_raw_sample <= 8) {
if (idct_algo == FF_IDCT_AUTO || idct_algo == FF_IDCT_SIMPLEMMX) {
VAR_0->idct_put = ff_simple_idct_put_mmx;
VAR_0->idct_add = ff_simple_idct_add_mmx;
VAR_0->idct = ff_simple_idct_mmx;
VAR_0->idct_permutation_type = FF_SIMPLE_IDCT_PERM;
} else if (idct_algo == FF_IDCT_CAVS) {
VAR_0->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
} else if (idct_algo == FF_IDCT_XVIDMMX) {
if (VAR_2 & AV_CPU_FLAG_SSE2) {
VAR_0->idct_put = ff_idct_xvid_sse2_put;
VAR_0->idct_add = ff_idct_xvid_sse2_add;
VAR_0->idct = ff_idct_xvid_sse2;
VAR_0->idct_permutation_type = FF_SSE2_IDCT_PERM;
} else if (VAR_2 & AV_CPU_FLAG_MMXEXT) {
VAR_0->idct_put = ff_idct_xvid_mmx2_put;
VAR_0->idct_add = ff_idct_xvid_mmx2_add;
VAR_0->idct = ff_idct_xvid_mmx2;
} else {
VAR_0->idct_put = ff_idct_xvid_mmx_put;
VAR_0->idct_add = ff_idct_xvid_mmx_add;
VAR_0->idct = ff_idct_xvid_mmx;
}
}
}
#endif
dsputil_init_mmx(VAR_0, VAR_1, VAR_2);
}
if (VAR_2 & AV_CPU_FLAG_MMXEXT)
dsputil_init_mmx2(VAR_0, VAR_1, VAR_2);
if (VAR_2 & AV_CPU_FLAG_3DNOW && HAVE_AMD3DNOW)
dsputil_init_3dnow(VAR_0, VAR_1, VAR_2);
if (VAR_2 & AV_CPU_FLAG_3DNOWEXT && HAVE_AMD3DNOWEXT)
dsputil_init_3dnowext(VAR_0, VAR_1, VAR_2);
if (VAR_2 & AV_CPU_FLAG_SSE && HAVE_SSE)
dsputil_init_sse(VAR_0, VAR_1, VAR_2);
if (VAR_2 & AV_CPU_FLAG_SSE2)
dsputil_init_sse2(VAR_0, VAR_1, VAR_2);
if (VAR_2 & AV_CPU_FLAG_SSSE3)
dsputil_init_ssse3(VAR_0, VAR_1, VAR_2);
if (VAR_2 & AV_CPU_FLAG_SSE4 && HAVE_SSE)
dsputil_init_sse4(VAR_0, VAR_1, VAR_2);
if (VAR_2 & AV_CPU_FLAG_AVX)
dsputil_init_avx(VAR_0, VAR_1, VAR_2);
if (CONFIG_ENCODERS)
ff_dsputilenc_init_mmx(VAR_0, VAR_1);
}
| [
"void FUNC_0(DSPContext *VAR_0, AVCodecContext *VAR_1)\n{",
"int VAR_2 = av_get_cpu_flags();",
"if (VAR_2 & AV_CPU_FLAG_MMX) {",
"#if HAVE_INLINE_ASM\nconst int idct_algo = VAR_1->idct_algo;",
"if (VAR_1->bits_per_raw_sample <= 8) {",
"if (idct_algo == FF_IDCT_AUTO || idct_algo == FF_IDCT_SIMPLEMMX) {",
"VAR_0->idct_put = ff_simple_idct_put_mmx;",
"VAR_0->idct_add = ff_simple_idct_add_mmx;",
"VAR_0->idct = ff_simple_idct_mmx;",
"VAR_0->idct_permutation_type = FF_SIMPLE_IDCT_PERM;",
"} else if (idct_algo == FF_IDCT_CAVS) {",
"VAR_0->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;",
"} else if (idct_algo == FF_IDCT_XVIDMMX) {",
"if (VAR_2 & AV_CPU_FLAG_SSE2) {",
"VAR_0->idct_put = ff_idct_xvid_sse2_put;",
"VAR_0->idct_add = ff_idct_xvid_sse2_add;",
"VAR_0->idct = ff_idct_xvid_sse2;",
"VAR_0->idct_permutation_type = FF_SSE2_IDCT_PERM;",
"} else if (VAR_2 & AV_CPU_FLAG_MMXEXT) {",
"VAR_0->idct_put = ff_idct_xvid_mmx2_put;",
"VAR_0->idct_add = ff_idct_xvid_mmx2_add;",
"VAR_0->idct = ff_idct_xvid_mmx2;",
"} else {",
"VAR_0->idct_put = ff_idct_xvid_mmx_put;",
"VAR_0->idct_add = ff_idct_xvid_mmx_add;",
"VAR_0->idct = ff_idct_xvid_mmx;",
"}",
"}",
"}",
"#endif\ndsputil_init_mmx(VAR_0, VAR_1, VAR_2);",
"}",
"if (VAR_2 & AV_CPU_FLAG_MMXEXT)\ndsputil_init_mmx2(VAR_0, VAR_1, VAR_2);",
"if (VAR_2 & AV_CPU_FLAG_3DNOW && HAVE_AMD3DNOW)\ndsputil_init_3dnow(VAR_0, VAR_1, VAR_2);",
"if (VAR_2 & AV_CPU_FLAG_3DNOWEXT && HAVE_AMD3DNOWEXT)\ndsputil_init_3dnowext(VAR_0, VAR_1, VAR_2);",
"if (VAR_2 & AV_CPU_FLAG_SSE && HAVE_SSE)\ndsputil_init_sse(VAR_0, VAR_1, VAR_2);",
"if (VAR_2 & AV_CPU_FLAG_SSE2)\ndsputil_init_sse2(VAR_0, VAR_1, VAR_2);",
"if (VAR_2 & AV_CPU_FLAG_SSSE3)\ndsputil_init_ssse3(VAR_0, VAR_1, VAR_2);",
"if (VAR_2 & AV_CPU_FLAG_SSE4 && HAVE_SSE)\ndsputil_init_sse4(VAR_0, VAR_1, VAR_2);",
"if (VAR_2 & AV_CPU_FLAG_AVX)\ndsputil_init_avx(VAR_0, VAR_1, VAR_2);",
"if (CONFIG_ENCODERS)\nff_dsputilenc_init_mmx(VAR_0, VAR_1);",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
9
],
[
11,
13
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67,
71
],
[
73
],
[
77,
79
],
[
83,
85
],
[
89,
91
],
[
95,
97
],
[
101,
103
],
[
107,
109
],
[
113,
115
],
[
119,
121
],
[
125,
127
],
[
129
]
]
|
12,366 | QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename)
{
char host[65], port[33], width[8], height[8];
int pos;
const char *p;
QemuOpts *opts;
Error *local_err = NULL;
opts = qemu_opts_create(qemu_find_opts("chardev"), label, 1, &local_err);
if (local_err) {
error_report_err(local_err);
return NULL;
}
if (strstart(filename, "mon:", &p)) {
filename = p;
qemu_opt_set(opts, "mux", "on", &error_abort);
if (strcmp(filename, "stdio") == 0) {
/* Monitor is muxed to stdio: do not exit on Ctrl+C by default
* but pass it to the guest. Handle this only for compat syntax,
* for -chardev syntax we have special option for this.
* This is what -nographic did, redirecting+muxing serial+monitor
* to stdio causing Ctrl+C to be passed to guest. */
qemu_opt_set(opts, "signal", "off", &error_abort);
}
}
if (strcmp(filename, "null") == 0 ||
strcmp(filename, "pty") == 0 ||
strcmp(filename, "msmouse") == 0 ||
strcmp(filename, "braille") == 0 ||
strcmp(filename, "testdev") == 0 ||
strcmp(filename, "stdio") == 0) {
qemu_opt_set(opts, "backend", filename, &error_abort);
return opts;
}
if (strstart(filename, "vc", &p)) {
qemu_opt_set(opts, "backend", "vc", &error_abort);
if (*p == ':') {
if (sscanf(p+1, "%7[0-9]x%7[0-9]", width, height) == 2) {
/* pixels */
qemu_opt_set(opts, "width", width, &error_abort);
qemu_opt_set(opts, "height", height, &error_abort);
} else if (sscanf(p+1, "%7[0-9]Cx%7[0-9]C", width, height) == 2) {
/* chars */
qemu_opt_set(opts, "cols", width, &error_abort);
qemu_opt_set(opts, "rows", height, &error_abort);
} else {
goto fail;
}
}
return opts;
}
if (strcmp(filename, "con:") == 0) {
qemu_opt_set(opts, "backend", "console", &error_abort);
return opts;
}
if (strstart(filename, "COM", NULL)) {
qemu_opt_set(opts, "backend", "serial", &error_abort);
qemu_opt_set(opts, "path", filename, &error_abort);
return opts;
}
if (strstart(filename, "file:", &p)) {
qemu_opt_set(opts, "backend", "file", &error_abort);
qemu_opt_set(opts, "path", p, &error_abort);
return opts;
}
if (strstart(filename, "pipe:", &p)) {
qemu_opt_set(opts, "backend", "pipe", &error_abort);
qemu_opt_set(opts, "path", p, &error_abort);
return opts;
}
if (strstart(filename, "tcp:", &p) ||
strstart(filename, "telnet:", &p)) {
if (sscanf(p, "%64[^:]:%32[^,]%n", host, port, &pos) < 2) {
host[0] = 0;
if (sscanf(p, ":%32[^,]%n", port, &pos) < 1)
goto fail;
}
qemu_opt_set(opts, "backend", "socket", &error_abort);
qemu_opt_set(opts, "host", host, &error_abort);
qemu_opt_set(opts, "port", port, &error_abort);
if (p[pos] == ',') {
if (qemu_opts_do_parse(opts, p+pos+1, NULL) != 0)
goto fail;
}
if (strstart(filename, "telnet:", &p))
qemu_opt_set(opts, "telnet", "on", &error_abort);
return opts;
}
if (strstart(filename, "udp:", &p)) {
qemu_opt_set(opts, "backend", "udp", &error_abort);
if (sscanf(p, "%64[^:]:%32[^@,]%n", host, port, &pos) < 2) {
host[0] = 0;
if (sscanf(p, ":%32[^@,]%n", port, &pos) < 1) {
goto fail;
}
}
qemu_opt_set(opts, "host", host, &error_abort);
qemu_opt_set(opts, "port", port, &error_abort);
if (p[pos] == '@') {
p += pos + 1;
if (sscanf(p, "%64[^:]:%32[^,]%n", host, port, &pos) < 2) {
host[0] = 0;
if (sscanf(p, ":%32[^,]%n", port, &pos) < 1) {
goto fail;
}
}
qemu_opt_set(opts, "localaddr", host, &error_abort);
qemu_opt_set(opts, "localport", port, &error_abort);
}
return opts;
}
if (strstart(filename, "unix:", &p)) {
qemu_opt_set(opts, "backend", "socket", &error_abort);
if (qemu_opts_do_parse(opts, p, "path") != 0)
goto fail;
return opts;
}
if (strstart(filename, "/dev/parport", NULL) ||
strstart(filename, "/dev/ppi", NULL)) {
qemu_opt_set(opts, "backend", "parport", &error_abort);
qemu_opt_set(opts, "path", filename, &error_abort);
return opts;
}
if (strstart(filename, "/dev/", NULL)) {
qemu_opt_set(opts, "backend", "tty", &error_abort);
qemu_opt_set(opts, "path", filename, &error_abort);
return opts;
}
fail:
qemu_opts_del(opts);
return NULL;
}
| false | qemu | dc523cd348c47372faa7271c9aab2030f94c290d | QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename)
{
char host[65], port[33], width[8], height[8];
int pos;
const char *p;
QemuOpts *opts;
Error *local_err = NULL;
opts = qemu_opts_create(qemu_find_opts("chardev"), label, 1, &local_err);
if (local_err) {
error_report_err(local_err);
return NULL;
}
if (strstart(filename, "mon:", &p)) {
filename = p;
qemu_opt_set(opts, "mux", "on", &error_abort);
if (strcmp(filename, "stdio") == 0) {
qemu_opt_set(opts, "signal", "off", &error_abort);
}
}
if (strcmp(filename, "null") == 0 ||
strcmp(filename, "pty") == 0 ||
strcmp(filename, "msmouse") == 0 ||
strcmp(filename, "braille") == 0 ||
strcmp(filename, "testdev") == 0 ||
strcmp(filename, "stdio") == 0) {
qemu_opt_set(opts, "backend", filename, &error_abort);
return opts;
}
if (strstart(filename, "vc", &p)) {
qemu_opt_set(opts, "backend", "vc", &error_abort);
if (*p == ':') {
if (sscanf(p+1, "%7[0-9]x%7[0-9]", width, height) == 2) {
qemu_opt_set(opts, "width", width, &error_abort);
qemu_opt_set(opts, "height", height, &error_abort);
} else if (sscanf(p+1, "%7[0-9]Cx%7[0-9]C", width, height) == 2) {
qemu_opt_set(opts, "cols", width, &error_abort);
qemu_opt_set(opts, "rows", height, &error_abort);
} else {
goto fail;
}
}
return opts;
}
if (strcmp(filename, "con:") == 0) {
qemu_opt_set(opts, "backend", "console", &error_abort);
return opts;
}
if (strstart(filename, "COM", NULL)) {
qemu_opt_set(opts, "backend", "serial", &error_abort);
qemu_opt_set(opts, "path", filename, &error_abort);
return opts;
}
if (strstart(filename, "file:", &p)) {
qemu_opt_set(opts, "backend", "file", &error_abort);
qemu_opt_set(opts, "path", p, &error_abort);
return opts;
}
if (strstart(filename, "pipe:", &p)) {
qemu_opt_set(opts, "backend", "pipe", &error_abort);
qemu_opt_set(opts, "path", p, &error_abort);
return opts;
}
if (strstart(filename, "tcp:", &p) ||
strstart(filename, "telnet:", &p)) {
if (sscanf(p, "%64[^:]:%32[^,]%n", host, port, &pos) < 2) {
host[0] = 0;
if (sscanf(p, ":%32[^,]%n", port, &pos) < 1)
goto fail;
}
qemu_opt_set(opts, "backend", "socket", &error_abort);
qemu_opt_set(opts, "host", host, &error_abort);
qemu_opt_set(opts, "port", port, &error_abort);
if (p[pos] == ',') {
if (qemu_opts_do_parse(opts, p+pos+1, NULL) != 0)
goto fail;
}
if (strstart(filename, "telnet:", &p))
qemu_opt_set(opts, "telnet", "on", &error_abort);
return opts;
}
if (strstart(filename, "udp:", &p)) {
qemu_opt_set(opts, "backend", "udp", &error_abort);
if (sscanf(p, "%64[^:]:%32[^@,]%n", host, port, &pos) < 2) {
host[0] = 0;
if (sscanf(p, ":%32[^@,]%n", port, &pos) < 1) {
goto fail;
}
}
qemu_opt_set(opts, "host", host, &error_abort);
qemu_opt_set(opts, "port", port, &error_abort);
if (p[pos] == '@') {
p += pos + 1;
if (sscanf(p, "%64[^:]:%32[^,]%n", host, port, &pos) < 2) {
host[0] = 0;
if (sscanf(p, ":%32[^,]%n", port, &pos) < 1) {
goto fail;
}
}
qemu_opt_set(opts, "localaddr", host, &error_abort);
qemu_opt_set(opts, "localport", port, &error_abort);
}
return opts;
}
if (strstart(filename, "unix:", &p)) {
qemu_opt_set(opts, "backend", "socket", &error_abort);
if (qemu_opts_do_parse(opts, p, "path") != 0)
goto fail;
return opts;
}
if (strstart(filename, "/dev/parport", NULL) ||
strstart(filename, "/dev/ppi", NULL)) {
qemu_opt_set(opts, "backend", "parport", &error_abort);
qemu_opt_set(opts, "path", filename, &error_abort);
return opts;
}
if (strstart(filename, "/dev/", NULL)) {
qemu_opt_set(opts, "backend", "tty", &error_abort);
qemu_opt_set(opts, "path", filename, &error_abort);
return opts;
}
fail:
qemu_opts_del(opts);
return NULL;
}
| {
"code": [],
"line_no": []
} | QemuOpts *FUNC_0(const char *label, const char *filename)
{
char VAR_0[65], VAR_1[33], VAR_2[8], VAR_3[8];
int VAR_4;
const char *VAR_5;
QemuOpts *opts;
Error *local_err = NULL;
opts = qemu_opts_create(qemu_find_opts("chardev"), label, 1, &local_err);
if (local_err) {
error_report_err(local_err);
return NULL;
}
if (strstart(filename, "mon:", &VAR_5)) {
filename = VAR_5;
qemu_opt_set(opts, "mux", "on", &error_abort);
if (strcmp(filename, "stdio") == 0) {
qemu_opt_set(opts, "signal", "off", &error_abort);
}
}
if (strcmp(filename, "null") == 0 ||
strcmp(filename, "pty") == 0 ||
strcmp(filename, "msmouse") == 0 ||
strcmp(filename, "braille") == 0 ||
strcmp(filename, "testdev") == 0 ||
strcmp(filename, "stdio") == 0) {
qemu_opt_set(opts, "backend", filename, &error_abort);
return opts;
}
if (strstart(filename, "vc", &VAR_5)) {
qemu_opt_set(opts, "backend", "vc", &error_abort);
if (*VAR_5 == ':') {
if (sscanf(VAR_5+1, "%7[0-9]x%7[0-9]", VAR_2, VAR_3) == 2) {
qemu_opt_set(opts, "VAR_2", VAR_2, &error_abort);
qemu_opt_set(opts, "VAR_3", VAR_3, &error_abort);
} else if (sscanf(VAR_5+1, "%7[0-9]Cx%7[0-9]C", VAR_2, VAR_3) == 2) {
qemu_opt_set(opts, "cols", VAR_2, &error_abort);
qemu_opt_set(opts, "rows", VAR_3, &error_abort);
} else {
goto fail;
}
}
return opts;
}
if (strcmp(filename, "con:") == 0) {
qemu_opt_set(opts, "backend", "console", &error_abort);
return opts;
}
if (strstart(filename, "COM", NULL)) {
qemu_opt_set(opts, "backend", "serial", &error_abort);
qemu_opt_set(opts, "path", filename, &error_abort);
return opts;
}
if (strstart(filename, "file:", &VAR_5)) {
qemu_opt_set(opts, "backend", "file", &error_abort);
qemu_opt_set(opts, "path", VAR_5, &error_abort);
return opts;
}
if (strstart(filename, "pipe:", &VAR_5)) {
qemu_opt_set(opts, "backend", "pipe", &error_abort);
qemu_opt_set(opts, "path", VAR_5, &error_abort);
return opts;
}
if (strstart(filename, "tcp:", &VAR_5) ||
strstart(filename, "telnet:", &VAR_5)) {
if (sscanf(VAR_5, "%64[^:]:%32[^,]%n", VAR_0, VAR_1, &VAR_4) < 2) {
VAR_0[0] = 0;
if (sscanf(VAR_5, ":%32[^,]%n", VAR_1, &VAR_4) < 1)
goto fail;
}
qemu_opt_set(opts, "backend", "socket", &error_abort);
qemu_opt_set(opts, "VAR_0", VAR_0, &error_abort);
qemu_opt_set(opts, "VAR_1", VAR_1, &error_abort);
if (VAR_5[VAR_4] == ',') {
if (qemu_opts_do_parse(opts, VAR_5+VAR_4+1, NULL) != 0)
goto fail;
}
if (strstart(filename, "telnet:", &VAR_5))
qemu_opt_set(opts, "telnet", "on", &error_abort);
return opts;
}
if (strstart(filename, "udp:", &VAR_5)) {
qemu_opt_set(opts, "backend", "udp", &error_abort);
if (sscanf(VAR_5, "%64[^:]:%32[^@,]%n", VAR_0, VAR_1, &VAR_4) < 2) {
VAR_0[0] = 0;
if (sscanf(VAR_5, ":%32[^@,]%n", VAR_1, &VAR_4) < 1) {
goto fail;
}
}
qemu_opt_set(opts, "VAR_0", VAR_0, &error_abort);
qemu_opt_set(opts, "VAR_1", VAR_1, &error_abort);
if (VAR_5[VAR_4] == '@') {
VAR_5 += VAR_4 + 1;
if (sscanf(VAR_5, "%64[^:]:%32[^,]%n", VAR_0, VAR_1, &VAR_4) < 2) {
VAR_0[0] = 0;
if (sscanf(VAR_5, ":%32[^,]%n", VAR_1, &VAR_4) < 1) {
goto fail;
}
}
qemu_opt_set(opts, "localaddr", VAR_0, &error_abort);
qemu_opt_set(opts, "localport", VAR_1, &error_abort);
}
return opts;
}
if (strstart(filename, "unix:", &VAR_5)) {
qemu_opt_set(opts, "backend", "socket", &error_abort);
if (qemu_opts_do_parse(opts, VAR_5, "path") != 0)
goto fail;
return opts;
}
if (strstart(filename, "/dev/parport", NULL) ||
strstart(filename, "/dev/ppi", NULL)) {
qemu_opt_set(opts, "backend", "parport", &error_abort);
qemu_opt_set(opts, "path", filename, &error_abort);
return opts;
}
if (strstart(filename, "/dev/", NULL)) {
qemu_opt_set(opts, "backend", "tty", &error_abort);
qemu_opt_set(opts, "path", filename, &error_abort);
return opts;
}
fail:
qemu_opts_del(opts);
return NULL;
}
| [
"QemuOpts *FUNC_0(const char *label, const char *filename)\n{",
"char VAR_0[65], VAR_1[33], VAR_2[8], VAR_3[8];",
"int VAR_4;",
"const char *VAR_5;",
"QemuOpts *opts;",
"Error *local_err = NULL;",
"opts = qemu_opts_create(qemu_find_opts(\"chardev\"), label, 1, &local_err);",
"if (local_err) {",
"error_report_err(local_err);",
"return NULL;",
"}",
"if (strstart(filename, \"mon:\", &VAR_5)) {",
"filename = VAR_5;",
"qemu_opt_set(opts, \"mux\", \"on\", &error_abort);",
"if (strcmp(filename, \"stdio\") == 0) {",
"qemu_opt_set(opts, \"signal\", \"off\", &error_abort);",
"}",
"}",
"if (strcmp(filename, \"null\") == 0 ||\nstrcmp(filename, \"pty\") == 0 ||\nstrcmp(filename, \"msmouse\") == 0 ||\nstrcmp(filename, \"braille\") == 0 ||\nstrcmp(filename, \"testdev\") == 0 ||\nstrcmp(filename, \"stdio\") == 0) {",
"qemu_opt_set(opts, \"backend\", filename, &error_abort);",
"return opts;",
"}",
"if (strstart(filename, \"vc\", &VAR_5)) {",
"qemu_opt_set(opts, \"backend\", \"vc\", &error_abort);",
"if (*VAR_5 == ':') {",
"if (sscanf(VAR_5+1, \"%7[0-9]x%7[0-9]\", VAR_2, VAR_3) == 2) {",
"qemu_opt_set(opts, \"VAR_2\", VAR_2, &error_abort);",
"qemu_opt_set(opts, \"VAR_3\", VAR_3, &error_abort);",
"} else if (sscanf(VAR_5+1, \"%7[0-9]Cx%7[0-9]C\", VAR_2, VAR_3) == 2) {",
"qemu_opt_set(opts, \"cols\", VAR_2, &error_abort);",
"qemu_opt_set(opts, \"rows\", VAR_3, &error_abort);",
"} else {",
"goto fail;",
"}",
"}",
"return opts;",
"}",
"if (strcmp(filename, \"con:\") == 0) {",
"qemu_opt_set(opts, \"backend\", \"console\", &error_abort);",
"return opts;",
"}",
"if (strstart(filename, \"COM\", NULL)) {",
"qemu_opt_set(opts, \"backend\", \"serial\", &error_abort);",
"qemu_opt_set(opts, \"path\", filename, &error_abort);",
"return opts;",
"}",
"if (strstart(filename, \"file:\", &VAR_5)) {",
"qemu_opt_set(opts, \"backend\", \"file\", &error_abort);",
"qemu_opt_set(opts, \"path\", VAR_5, &error_abort);",
"return opts;",
"}",
"if (strstart(filename, \"pipe:\", &VAR_5)) {",
"qemu_opt_set(opts, \"backend\", \"pipe\", &error_abort);",
"qemu_opt_set(opts, \"path\", VAR_5, &error_abort);",
"return opts;",
"}",
"if (strstart(filename, \"tcp:\", &VAR_5) ||\nstrstart(filename, \"telnet:\", &VAR_5)) {",
"if (sscanf(VAR_5, \"%64[^:]:%32[^,]%n\", VAR_0, VAR_1, &VAR_4) < 2) {",
"VAR_0[0] = 0;",
"if (sscanf(VAR_5, \":%32[^,]%n\", VAR_1, &VAR_4) < 1)\ngoto fail;",
"}",
"qemu_opt_set(opts, \"backend\", \"socket\", &error_abort);",
"qemu_opt_set(opts, \"VAR_0\", VAR_0, &error_abort);",
"qemu_opt_set(opts, \"VAR_1\", VAR_1, &error_abort);",
"if (VAR_5[VAR_4] == ',') {",
"if (qemu_opts_do_parse(opts, VAR_5+VAR_4+1, NULL) != 0)\ngoto fail;",
"}",
"if (strstart(filename, \"telnet:\", &VAR_5))\nqemu_opt_set(opts, \"telnet\", \"on\", &error_abort);",
"return opts;",
"}",
"if (strstart(filename, \"udp:\", &VAR_5)) {",
"qemu_opt_set(opts, \"backend\", \"udp\", &error_abort);",
"if (sscanf(VAR_5, \"%64[^:]:%32[^@,]%n\", VAR_0, VAR_1, &VAR_4) < 2) {",
"VAR_0[0] = 0;",
"if (sscanf(VAR_5, \":%32[^@,]%n\", VAR_1, &VAR_4) < 1) {",
"goto fail;",
"}",
"}",
"qemu_opt_set(opts, \"VAR_0\", VAR_0, &error_abort);",
"qemu_opt_set(opts, \"VAR_1\", VAR_1, &error_abort);",
"if (VAR_5[VAR_4] == '@') {",
"VAR_5 += VAR_4 + 1;",
"if (sscanf(VAR_5, \"%64[^:]:%32[^,]%n\", VAR_0, VAR_1, &VAR_4) < 2) {",
"VAR_0[0] = 0;",
"if (sscanf(VAR_5, \":%32[^,]%n\", VAR_1, &VAR_4) < 1) {",
"goto fail;",
"}",
"}",
"qemu_opt_set(opts, \"localaddr\", VAR_0, &error_abort);",
"qemu_opt_set(opts, \"localport\", VAR_1, &error_abort);",
"}",
"return opts;",
"}",
"if (strstart(filename, \"unix:\", &VAR_5)) {",
"qemu_opt_set(opts, \"backend\", \"socket\", &error_abort);",
"if (qemu_opts_do_parse(opts, VAR_5, \"path\") != 0)\ngoto fail;",
"return opts;",
"}",
"if (strstart(filename, \"/dev/parport\", NULL) ||\nstrstart(filename, \"/dev/ppi\", NULL)) {",
"qemu_opt_set(opts, \"backend\", \"parport\", &error_abort);",
"qemu_opt_set(opts, \"path\", filename, &error_abort);",
"return opts;",
"}",
"if (strstart(filename, \"/dev/\", NULL)) {",
"qemu_opt_set(opts, \"backend\", \"tty\", &error_abort);",
"qemu_opt_set(opts, \"path\", filename, &error_abort);",
"return opts;",
"}",
"fail:\nqemu_opts_del(opts);",
"return NULL;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
29
],
[
31
],
[
33
],
[
35
],
[
47
],
[
49
],
[
51
],
[
55,
57,
59,
61,
63,
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
83
],
[
85
],
[
87
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145,
147
],
[
149
],
[
151
],
[
153,
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165
],
[
167,
169
],
[
171
],
[
173,
175
],
[
177
],
[
179
],
[
181
],
[
183
],
[
185
],
[
187
],
[
189
],
[
191
],
[
193
],
[
195
],
[
197
],
[
199
],
[
201
],
[
203
],
[
205
],
[
207
],
[
209
],
[
211
],
[
213
],
[
215
],
[
217
],
[
219
],
[
221
],
[
223
],
[
225
],
[
227
],
[
229
],
[
231,
233
],
[
235
],
[
237
],
[
239,
241
],
[
243
],
[
245
],
[
247
],
[
249
],
[
251
],
[
253
],
[
255
],
[
257
],
[
259
],
[
263,
265
],
[
267
],
[
269
]
]
|
12,368 | static int check_refcounts_l1(BlockDriverState *bs,
BdrvCheckResult *res,
uint16_t *refcount_table,
int refcount_table_size,
int64_t l1_table_offset, int l1_size,
int check_copied)
{
BDRVQcowState *s = bs->opaque;
uint64_t *l1_table, l2_offset, l1_size2;
int i, refcount, ret;
l1_size2 = l1_size * sizeof(uint64_t);
/* Mark L1 table as used */
inc_refcounts(bs, res, refcount_table, refcount_table_size,
l1_table_offset, l1_size2);
/* Read L1 table entries from disk */
if (l1_size2 == 0) {
l1_table = NULL;
} else {
l1_table = g_malloc(l1_size2);
if (bdrv_pread(bs->file, l1_table_offset,
l1_table, l1_size2) != l1_size2)
goto fail;
for(i = 0;i < l1_size; i++)
be64_to_cpus(&l1_table[i]);
}
/* Do the actual checks */
for(i = 0; i < l1_size; i++) {
l2_offset = l1_table[i];
if (l2_offset) {
/* QCOW_OFLAG_COPIED must be set iff refcount == 1 */
if (check_copied) {
refcount = get_refcount(bs, (l2_offset & ~QCOW_OFLAG_COPIED)
>> s->cluster_bits);
if (refcount < 0) {
fprintf(stderr, "Can't get refcount for l2_offset %"
PRIx64 ": %s\n", l2_offset, strerror(-refcount));
goto fail;
}
if ((refcount == 1) != ((l2_offset & QCOW_OFLAG_COPIED) != 0)) {
fprintf(stderr, "ERROR OFLAG_COPIED: l2_offset=%" PRIx64
" refcount=%d\n", l2_offset, refcount);
res->corruptions++;
}
}
/* Mark L2 table as used */
l2_offset &= ~QCOW_OFLAG_COPIED;
inc_refcounts(bs, res, refcount_table, refcount_table_size,
l2_offset, s->cluster_size);
/* L2 tables are cluster aligned */
if (l2_offset & (s->cluster_size - 1)) {
fprintf(stderr, "ERROR l2_offset=%" PRIx64 ": Table is not "
"cluster aligned; L1 entry corrupted\n", l2_offset);
res->corruptions++;
}
/* Process and check L2 entries */
ret = check_refcounts_l2(bs, res, refcount_table,
refcount_table_size, l2_offset, check_copied);
if (ret < 0) {
goto fail;
}
}
}
g_free(l1_table);
return 0;
fail:
fprintf(stderr, "ERROR: I/O error in check_refcounts_l1\n");
res->check_errors++;
g_free(l1_table);
return -EIO;
}
| false | qemu | afdf0abe779f4b11712eb306ab2d4299820457b8 | static int check_refcounts_l1(BlockDriverState *bs,
BdrvCheckResult *res,
uint16_t *refcount_table,
int refcount_table_size,
int64_t l1_table_offset, int l1_size,
int check_copied)
{
BDRVQcowState *s = bs->opaque;
uint64_t *l1_table, l2_offset, l1_size2;
int i, refcount, ret;
l1_size2 = l1_size * sizeof(uint64_t);
inc_refcounts(bs, res, refcount_table, refcount_table_size,
l1_table_offset, l1_size2);
if (l1_size2 == 0) {
l1_table = NULL;
} else {
l1_table = g_malloc(l1_size2);
if (bdrv_pread(bs->file, l1_table_offset,
l1_table, l1_size2) != l1_size2)
goto fail;
for(i = 0;i < l1_size; i++)
be64_to_cpus(&l1_table[i]);
}
for(i = 0; i < l1_size; i++) {
l2_offset = l1_table[i];
if (l2_offset) {
if (check_copied) {
refcount = get_refcount(bs, (l2_offset & ~QCOW_OFLAG_COPIED)
>> s->cluster_bits);
if (refcount < 0) {
fprintf(stderr, "Can't get refcount for l2_offset %"
PRIx64 ": %s\n", l2_offset, strerror(-refcount));
goto fail;
}
if ((refcount == 1) != ((l2_offset & QCOW_OFLAG_COPIED) != 0)) {
fprintf(stderr, "ERROR OFLAG_COPIED: l2_offset=%" PRIx64
" refcount=%d\n", l2_offset, refcount);
res->corruptions++;
}
}
l2_offset &= ~QCOW_OFLAG_COPIED;
inc_refcounts(bs, res, refcount_table, refcount_table_size,
l2_offset, s->cluster_size);
if (l2_offset & (s->cluster_size - 1)) {
fprintf(stderr, "ERROR l2_offset=%" PRIx64 ": Table is not "
"cluster aligned; L1 entry corrupted\n", l2_offset);
res->corruptions++;
}
ret = check_refcounts_l2(bs, res, refcount_table,
refcount_table_size, l2_offset, check_copied);
if (ret < 0) {
goto fail;
}
}
}
g_free(l1_table);
return 0;
fail:
fprintf(stderr, "ERROR: I/O error in check_refcounts_l1\n");
res->check_errors++;
g_free(l1_table);
return -EIO;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(BlockDriverState *VAR_0,
BdrvCheckResult *VAR_1,
uint16_t *VAR_2,
int VAR_3,
int64_t VAR_4, int VAR_5,
int VAR_6)
{
BDRVQcowState *s = VAR_0->opaque;
uint64_t *l1_table, l2_offset, l1_size2;
int VAR_7, VAR_8, VAR_9;
l1_size2 = VAR_5 * sizeof(uint64_t);
inc_refcounts(VAR_0, VAR_1, VAR_2, VAR_3,
VAR_4, l1_size2);
if (l1_size2 == 0) {
l1_table = NULL;
} else {
l1_table = g_malloc(l1_size2);
if (bdrv_pread(VAR_0->file, VAR_4,
l1_table, l1_size2) != l1_size2)
goto fail;
for(VAR_7 = 0;VAR_7 < VAR_5; VAR_7++)
be64_to_cpus(&l1_table[VAR_7]);
}
for(VAR_7 = 0; VAR_7 < VAR_5; VAR_7++) {
l2_offset = l1_table[VAR_7];
if (l2_offset) {
if (VAR_6) {
VAR_8 = get_refcount(VAR_0, (l2_offset & ~QCOW_OFLAG_COPIED)
>> s->cluster_bits);
if (VAR_8 < 0) {
fprintf(stderr, "Can't get VAR_8 for l2_offset %"
PRIx64 ": %s\n", l2_offset, strerror(-VAR_8));
goto fail;
}
if ((VAR_8 == 1) != ((l2_offset & QCOW_OFLAG_COPIED) != 0)) {
fprintf(stderr, "ERROR OFLAG_COPIED: l2_offset=%" PRIx64
" VAR_8=%d\n", l2_offset, VAR_8);
VAR_1->corruptions++;
}
}
l2_offset &= ~QCOW_OFLAG_COPIED;
inc_refcounts(VAR_0, VAR_1, VAR_2, VAR_3,
l2_offset, s->cluster_size);
if (l2_offset & (s->cluster_size - 1)) {
fprintf(stderr, "ERROR l2_offset=%" PRIx64 ": Table is not "
"cluster aligned; L1 entry corrupted\n", l2_offset);
VAR_1->corruptions++;
}
VAR_9 = check_refcounts_l2(VAR_0, VAR_1, VAR_2,
VAR_3, l2_offset, VAR_6);
if (VAR_9 < 0) {
goto fail;
}
}
}
g_free(l1_table);
return 0;
fail:
fprintf(stderr, "ERROR: I/O error in FUNC_0\n");
VAR_1->check_errors++;
g_free(l1_table);
return -EIO;
}
| [
"static int FUNC_0(BlockDriverState *VAR_0,\nBdrvCheckResult *VAR_1,\nuint16_t *VAR_2,\nint VAR_3,\nint64_t VAR_4, int VAR_5,\nint VAR_6)\n{",
"BDRVQcowState *s = VAR_0->opaque;",
"uint64_t *l1_table, l2_offset, l1_size2;",
"int VAR_7, VAR_8, VAR_9;",
"l1_size2 = VAR_5 * sizeof(uint64_t);",
"inc_refcounts(VAR_0, VAR_1, VAR_2, VAR_3,\nVAR_4, l1_size2);",
"if (l1_size2 == 0) {",
"l1_table = NULL;",
"} else {",
"l1_table = g_malloc(l1_size2);",
"if (bdrv_pread(VAR_0->file, VAR_4,\nl1_table, l1_size2) != l1_size2)\ngoto fail;",
"for(VAR_7 = 0;VAR_7 < VAR_5; VAR_7++)",
"be64_to_cpus(&l1_table[VAR_7]);",
"}",
"for(VAR_7 = 0; VAR_7 < VAR_5; VAR_7++) {",
"l2_offset = l1_table[VAR_7];",
"if (l2_offset) {",
"if (VAR_6) {",
"VAR_8 = get_refcount(VAR_0, (l2_offset & ~QCOW_OFLAG_COPIED)\n>> s->cluster_bits);",
"if (VAR_8 < 0) {",
"fprintf(stderr, \"Can't get VAR_8 for l2_offset %\"\nPRIx64 \": %s\\n\", l2_offset, strerror(-VAR_8));",
"goto fail;",
"}",
"if ((VAR_8 == 1) != ((l2_offset & QCOW_OFLAG_COPIED) != 0)) {",
"fprintf(stderr, \"ERROR OFLAG_COPIED: l2_offset=%\" PRIx64\n\" VAR_8=%d\\n\", l2_offset, VAR_8);",
"VAR_1->corruptions++;",
"}",
"}",
"l2_offset &= ~QCOW_OFLAG_COPIED;",
"inc_refcounts(VAR_0, VAR_1, VAR_2, VAR_3,\nl2_offset, s->cluster_size);",
"if (l2_offset & (s->cluster_size - 1)) {",
"fprintf(stderr, \"ERROR l2_offset=%\" PRIx64 \": Table is not \"\n\"cluster aligned; L1 entry corrupted\\n\", l2_offset);",
"VAR_1->corruptions++;",
"}",
"VAR_9 = check_refcounts_l2(VAR_0, VAR_1, VAR_2,\nVAR_3, l2_offset, VAR_6);",
"if (VAR_9 < 0) {",
"goto fail;",
"}",
"}",
"}",
"g_free(l1_table);",
"return 0;",
"fail:\nfprintf(stderr, \"ERROR: I/O error in FUNC_0\\n\");",
"VAR_1->check_errors++;",
"g_free(l1_table);",
"return -EIO;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5,
7,
9,
11,
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
29,
31
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45,
47,
49
],
[
51
],
[
53
],
[
55
],
[
61
],
[
63
],
[
65
],
[
69
],
[
71,
73
],
[
75
],
[
77,
79
],
[
81
],
[
83
],
[
85
],
[
87,
89
],
[
91
],
[
93
],
[
95
],
[
101
],
[
103,
105
],
[
111
],
[
113,
115
],
[
117
],
[
119
],
[
125,
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
145,
147
],
[
149
],
[
151
],
[
153
],
[
155
]
]
|
12,369 | static always_inline void gen_qemu_lds (TCGv t0, TCGv t1, int flags)
{
TCGv tmp = tcg_temp_new(TCG_TYPE_I32);
tcg_gen_qemu_ld32u(tmp, t1, flags);
tcg_gen_helper_1_1(helper_memory_to_s, t0, tmp);
tcg_temp_free(tmp);
}
| false | qemu | a7812ae412311d7d47f8aa85656faadac9d64b56 | static always_inline void gen_qemu_lds (TCGv t0, TCGv t1, int flags)
{
TCGv tmp = tcg_temp_new(TCG_TYPE_I32);
tcg_gen_qemu_ld32u(tmp, t1, flags);
tcg_gen_helper_1_1(helper_memory_to_s, t0, tmp);
tcg_temp_free(tmp);
}
| {
"code": [],
"line_no": []
} | static always_inline void FUNC_0 (TCGv t0, TCGv t1, int flags)
{
TCGv tmp = tcg_temp_new(TCG_TYPE_I32);
tcg_gen_qemu_ld32u(tmp, t1, flags);
tcg_gen_helper_1_1(helper_memory_to_s, t0, tmp);
tcg_temp_free(tmp);
}
| [
"static always_inline void FUNC_0 (TCGv t0, TCGv t1, int flags)\n{",
"TCGv tmp = tcg_temp_new(TCG_TYPE_I32);",
"tcg_gen_qemu_ld32u(tmp, t1, flags);",
"tcg_gen_helper_1_1(helper_memory_to_s, t0, tmp);",
"tcg_temp_free(tmp);",
"}"
]
| [
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
]
]
|
12,370 | static void pmac_ide_flush(DBDMA_io *io)
{
MACIOIDEState *m = io->opaque;
if (m->aiocb) {
bdrv_drain_all();
}
}
| false | qemu | 4be746345f13e99e468c60acbd3a355e8183e3ce | static void pmac_ide_flush(DBDMA_io *io)
{
MACIOIDEState *m = io->opaque;
if (m->aiocb) {
bdrv_drain_all();
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(DBDMA_io *VAR_0)
{
MACIOIDEState *m = VAR_0->opaque;
if (m->aiocb) {
bdrv_drain_all();
}
}
| [
"static void FUNC_0(DBDMA_io *VAR_0)\n{",
"MACIOIDEState *m = VAR_0->opaque;",
"if (m->aiocb) {",
"bdrv_drain_all();",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
]
]
|
12,371 | static void socket_start_outgoing_migration(MigrationState *s,
SocketAddress *saddr,
Error **errp)
{
QIOChannelSocket *sioc = qio_channel_socket_new();
struct SocketConnectData *data = g_new0(struct SocketConnectData, 1);
data->s = s;
if (saddr->type == SOCKET_ADDRESS_KIND_INET) {
data->hostname = g_strdup(saddr->u.inet.data->host);
}
qio_channel_set_name(QIO_CHANNEL(sioc), "migration-socket-outgoing");
qio_channel_socket_connect_async(sioc,
saddr,
socket_outgoing_migration,
data,
socket_connect_data_free);
qapi_free_SocketAddress(saddr);
}
| false | qemu | dfd100f242370886bb6732f70f1f7cbd8eb9fedc | static void socket_start_outgoing_migration(MigrationState *s,
SocketAddress *saddr,
Error **errp)
{
QIOChannelSocket *sioc = qio_channel_socket_new();
struct SocketConnectData *data = g_new0(struct SocketConnectData, 1);
data->s = s;
if (saddr->type == SOCKET_ADDRESS_KIND_INET) {
data->hostname = g_strdup(saddr->u.inet.data->host);
}
qio_channel_set_name(QIO_CHANNEL(sioc), "migration-socket-outgoing");
qio_channel_socket_connect_async(sioc,
saddr,
socket_outgoing_migration,
data,
socket_connect_data_free);
qapi_free_SocketAddress(saddr);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(MigrationState *VAR_0,
SocketAddress *VAR_1,
Error **VAR_2)
{
QIOChannelSocket *sioc = qio_channel_socket_new();
struct SocketConnectData *VAR_3 = g_new0(struct SocketConnectData, 1);
VAR_3->VAR_0 = VAR_0;
if (VAR_1->type == SOCKET_ADDRESS_KIND_INET) {
VAR_3->hostname = g_strdup(VAR_1->u.inet.VAR_3->host);
}
qio_channel_set_name(QIO_CHANNEL(sioc), "migration-socket-outgoing");
qio_channel_socket_connect_async(sioc,
VAR_1,
socket_outgoing_migration,
VAR_3,
socket_connect_data_free);
qapi_free_SocketAddress(VAR_1);
}
| [
"static void FUNC_0(MigrationState *VAR_0,\nSocketAddress *VAR_1,\nError **VAR_2)\n{",
"QIOChannelSocket *sioc = qio_channel_socket_new();",
"struct SocketConnectData *VAR_3 = g_new0(struct SocketConnectData, 1);",
"VAR_3->VAR_0 = VAR_0;",
"if (VAR_1->type == SOCKET_ADDRESS_KIND_INET) {",
"VAR_3->hostname = g_strdup(VAR_1->u.inet.VAR_3->host);",
"}",
"qio_channel_set_name(QIO_CHANNEL(sioc), \"migration-socket-outgoing\");",
"qio_channel_socket_connect_async(sioc,\nVAR_1,\nsocket_outgoing_migration,\nVAR_3,\nsocket_connect_data_free);",
"qapi_free_SocketAddress(VAR_1);",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5,
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
19
],
[
21
],
[
25
],
[
27,
29,
31,
33,
35
],
[
37
],
[
39
]
]
|
12,372 | void qio_dns_resolver_lookup_async(QIODNSResolver *resolver,
SocketAddressLegacy *addr,
QIOTaskFunc func,
gpointer opaque,
GDestroyNotify notify)
{
QIOTask *task;
struct QIODNSResolverLookupData *data =
g_new0(struct QIODNSResolverLookupData, 1);
data->addr = QAPI_CLONE(SocketAddressLegacy, addr);
task = qio_task_new(OBJECT(resolver), func, opaque, notify);
qio_task_run_in_thread(task,
qio_dns_resolver_lookup_worker,
data,
qio_dns_resolver_lookup_data_free);
}
| false | qemu | bd269ebc82fbaa5fe7ce5bc7c1770ac8acecd884 | void qio_dns_resolver_lookup_async(QIODNSResolver *resolver,
SocketAddressLegacy *addr,
QIOTaskFunc func,
gpointer opaque,
GDestroyNotify notify)
{
QIOTask *task;
struct QIODNSResolverLookupData *data =
g_new0(struct QIODNSResolverLookupData, 1);
data->addr = QAPI_CLONE(SocketAddressLegacy, addr);
task = qio_task_new(OBJECT(resolver), func, opaque, notify);
qio_task_run_in_thread(task,
qio_dns_resolver_lookup_worker,
data,
qio_dns_resolver_lookup_data_free);
}
| {
"code": [],
"line_no": []
} | void FUNC_0(QIODNSResolver *VAR_0,
SocketAddressLegacy *VAR_1,
QIOTaskFunc VAR_2,
gpointer VAR_3,
GDestroyNotify VAR_4)
{
QIOTask *task;
struct QIODNSResolverLookupData *VAR_5 =
g_new0(struct QIODNSResolverLookupData, 1);
VAR_5->VAR_1 = QAPI_CLONE(SocketAddressLegacy, VAR_1);
task = qio_task_new(OBJECT(VAR_0), VAR_2, VAR_3, VAR_4);
qio_task_run_in_thread(task,
qio_dns_resolver_lookup_worker,
VAR_5,
qio_dns_resolver_lookup_data_free);
}
| [
"void FUNC_0(QIODNSResolver *VAR_0,\nSocketAddressLegacy *VAR_1,\nQIOTaskFunc VAR_2,\ngpointer VAR_3,\nGDestroyNotify VAR_4)\n{",
"QIOTask *task;",
"struct QIODNSResolverLookupData *VAR_5 =\ng_new0(struct QIODNSResolverLookupData, 1);",
"VAR_5->VAR_1 = QAPI_CLONE(SocketAddressLegacy, VAR_1);",
"task = qio_task_new(OBJECT(VAR_0), VAR_2, VAR_3, VAR_4);",
"qio_task_run_in_thread(task,\nqio_dns_resolver_lookup_worker,\nVAR_5,\nqio_dns_resolver_lookup_data_free);",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5,
7,
9,
11
],
[
13
],
[
15,
17
],
[
21
],
[
25
],
[
29,
31,
33,
35
],
[
37
]
]
|
12,374 | int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt)
{
AVFrame *frame = data;
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
MJpegDecodeContext *s = avctx->priv_data;
const uint8_t *buf_end, *buf_ptr;
const uint8_t *unescaped_buf_ptr;
int hshift, vshift;
int unescaped_buf_size;
int start_code;
int i, index;
int ret = 0;
av_dict_free(&s->exif_metadata);
av_freep(&s->stereo3d);
buf_ptr = buf;
buf_end = buf + buf_size;
while (buf_ptr < buf_end) {
/* find start next marker */
start_code = ff_mjpeg_find_marker(s, &buf_ptr, buf_end,
&unescaped_buf_ptr,
&unescaped_buf_size);
/* EOF */
if (start_code < 0) {
break;
} else if (unescaped_buf_size > INT_MAX / 8) {
av_log(avctx, AV_LOG_ERROR,
"MJPEG packet 0x%x too big (%d/%d), corrupt data?\n",
start_code, unescaped_buf_size, buf_size);
return AVERROR_INVALIDDATA;
}
av_log(avctx, AV_LOG_DEBUG, "marker=%x avail_size_in_buf=%td\n",
start_code, buf_end - buf_ptr);
ret = init_get_bits8(&s->gb, unescaped_buf_ptr, unescaped_buf_size);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "invalid buffer\n");
goto fail;
}
s->start_code = start_code;
if (s->avctx->debug & FF_DEBUG_STARTCODE)
av_log(avctx, AV_LOG_DEBUG, "startcode: %X\n", start_code);
/* process markers */
if (start_code >= 0xd0 && start_code <= 0xd7)
av_log(avctx, AV_LOG_DEBUG,
"restart marker: %d\n", start_code & 0x0f);
/* APP fields */
else if (start_code >= APP0 && start_code <= APP15)
mjpeg_decode_app(s);
/* Comment */
else if (start_code == COM)
mjpeg_decode_com(s);
ret = -1;
if (!CONFIG_JPEGLS_DECODER &&
(start_code == SOF48 || start_code == LSE)) {
av_log(avctx, AV_LOG_ERROR, "JPEG-LS support not enabled.\n");
return AVERROR(ENOSYS);
}
switch (start_code) {
case SOI:
s->restart_interval = 0;
s->restart_count = 0;
/* nothing to do on SOI */
break;
case DQT:
ff_mjpeg_decode_dqt(s);
break;
case DHT:
if ((ret = ff_mjpeg_decode_dht(s)) < 0) {
av_log(avctx, AV_LOG_ERROR, "huffman table decode error\n");
goto fail;
}
break;
case SOF0:
case SOF1:
s->lossless = 0;
s->ls = 0;
s->progressive = 0;
if ((ret = ff_mjpeg_decode_sof(s)) < 0)
goto fail;
break;
case SOF2:
s->lossless = 0;
s->ls = 0;
s->progressive = 1;
if ((ret = ff_mjpeg_decode_sof(s)) < 0)
goto fail;
break;
case SOF3:
s->lossless = 1;
s->ls = 0;
s->progressive = 0;
if ((ret = ff_mjpeg_decode_sof(s)) < 0)
goto fail;
break;
case SOF48:
s->lossless = 1;
s->ls = 1;
s->progressive = 0;
if ((ret = ff_mjpeg_decode_sof(s)) < 0)
goto fail;
break;
case LSE:
if (!CONFIG_JPEGLS_DECODER ||
(ret = ff_jpegls_decode_lse(s)) < 0)
goto fail;
break;
case EOI:
eoi_parser:
s->cur_scan = 0;
if (!s->got_picture) {
av_log(avctx, AV_LOG_WARNING,
"Found EOI before any SOF, ignoring\n");
break;
}
if (s->interlaced) {
s->bottom_field ^= 1;
/* if not bottom field, do not output image yet */
if (s->bottom_field == !s->interlace_polarity)
break;
}
if ((ret = av_frame_ref(frame, s->picture_ptr)) < 0)
return ret;
*got_frame = 1;
s->got_picture = 0;
if (!s->lossless) {
int qp = FFMAX3(s->qscale[0],
s->qscale[1],
s->qscale[2]);
int qpw = (s->width + 15) / 16;
AVBufferRef *qp_table_buf = av_buffer_alloc(qpw);
if (qp_table_buf) {
memset(qp_table_buf->data, qp, qpw);
av_frame_set_qp_table(data, qp_table_buf, 0, FF_QSCALE_TYPE_MPEG1);
}
if(avctx->debug & FF_DEBUG_QP)
av_log(avctx, AV_LOG_DEBUG, "QP: %d\n", qp);
}
goto the_end;
case SOS:
s->cur_scan++;
if ((ret = ff_mjpeg_decode_sos(s, NULL, 0, NULL)) < 0 &&
(avctx->err_recognition & AV_EF_EXPLODE))
goto fail;
break;
case DRI:
mjpeg_decode_dri(s);
break;
case SOF5:
case SOF6:
case SOF7:
case SOF9:
case SOF10:
case SOF11:
case SOF13:
case SOF14:
case SOF15:
case JPG:
av_log(avctx, AV_LOG_ERROR,
"mjpeg: unsupported coding type (%x)\n", start_code);
break;
}
/* eof process start code */
buf_ptr += (get_bits_count(&s->gb) + 7) / 8;
av_log(avctx, AV_LOG_DEBUG,
"marker parser used %d bytes (%d bits)\n",
(get_bits_count(&s->gb) + 7) / 8, get_bits_count(&s->gb));
}
if (s->got_picture && s->cur_scan) {
av_log(avctx, AV_LOG_WARNING, "EOI missing, emulating\n");
goto eoi_parser;
}
av_log(avctx, AV_LOG_FATAL, "No JPEG data found in image\n");
return AVERROR_INVALIDDATA;
fail:
s->got_picture = 0;
return ret;
the_end:
if (s->upscale_h) {
uint8_t *line = s->picture_ptr->data[s->upscale_h];
av_assert0(avctx->pix_fmt == AV_PIX_FMT_YUVJ444P ||
avctx->pix_fmt == AV_PIX_FMT_YUV444P ||
avctx->pix_fmt == AV_PIX_FMT_YUVJ440P ||
avctx->pix_fmt == AV_PIX_FMT_YUV440P);
for (i = 0; i < s->chroma_height; i++) {
for (index = s->width - 1; index; index--)
line[index] = (line[index / 2] + line[(index + 1) / 2]) >> 1;
line += s->linesize[s->upscale_h];
}
}
if (s->upscale_v) {
uint8_t *dst = &((uint8_t *)s->picture_ptr->data[s->upscale_v])[(s->height - 1) * s->linesize[s->upscale_v]];
int w;
avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift);
w = s->width >> hshift;
av_assert0(avctx->pix_fmt == AV_PIX_FMT_YUVJ444P ||
avctx->pix_fmt == AV_PIX_FMT_YUV444P ||
avctx->pix_fmt == AV_PIX_FMT_YUVJ422P ||
avctx->pix_fmt == AV_PIX_FMT_YUV422P);
for (i = s->height - 1; i; i--) {
uint8_t *src1 = &((uint8_t *)s->picture_ptr->data[s->upscale_v])[i / 2 * s->linesize[s->upscale_v]];
uint8_t *src2 = &((uint8_t *)s->picture_ptr->data[s->upscale_v])[(i + 1) / 2 * s->linesize[s->upscale_v]];
if (src1 == src2) {
memcpy(dst, src1, w);
} else {
for (index = 0; index < w; index++)
dst[index] = (src1[index] + src2[index]) >> 1;
}
dst -= s->linesize[s->upscale_v];
}
}
if (s->flipped) {
int j;
avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift);
for (index=0; index<4; index++) {
uint8_t *dst = s->picture_ptr->data[index];
int w = s->picture_ptr->width;
int h = s->picture_ptr->height;
if(index && index<3){
w = FF_CEIL_RSHIFT(w, hshift);
h = FF_CEIL_RSHIFT(h, vshift);
}
if(dst){
uint8_t *dst2 = dst + s->linesize[index]*(h-1);
for (i=0; i<h/2; i++) {
for (j=0; j<w; j++)
FFSWAP(int, dst[j], dst2[j]);
dst += s->linesize[index];
dst2 -= s->linesize[index];
}
}
}
}
if (s->stereo3d) {
AVStereo3D *stereo = av_stereo3d_create_side_data(data);
if (stereo) {
stereo->type = s->stereo3d->type;
stereo->flags = s->stereo3d->flags;
}
av_freep(&s->stereo3d);
}
av_dict_copy(avpriv_frame_get_metadatap(data), s->exif_metadata, 0);
av_dict_free(&s->exif_metadata);
av_log(avctx, AV_LOG_DEBUG, "decode frame unused %td bytes\n",
buf_end - buf_ptr);
// return buf_end - buf_ptr;
return buf_ptr - buf;
}
| false | FFmpeg | 19b41f86457d945e98c236f67faf59d560861a4c | int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt)
{
AVFrame *frame = data;
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
MJpegDecodeContext *s = avctx->priv_data;
const uint8_t *buf_end, *buf_ptr;
const uint8_t *unescaped_buf_ptr;
int hshift, vshift;
int unescaped_buf_size;
int start_code;
int i, index;
int ret = 0;
av_dict_free(&s->exif_metadata);
av_freep(&s->stereo3d);
buf_ptr = buf;
buf_end = buf + buf_size;
while (buf_ptr < buf_end) {
start_code = ff_mjpeg_find_marker(s, &buf_ptr, buf_end,
&unescaped_buf_ptr,
&unescaped_buf_size);
if (start_code < 0) {
break;
} else if (unescaped_buf_size > INT_MAX / 8) {
av_log(avctx, AV_LOG_ERROR,
"MJPEG packet 0x%x too big (%d/%d), corrupt data?\n",
start_code, unescaped_buf_size, buf_size);
return AVERROR_INVALIDDATA;
}
av_log(avctx, AV_LOG_DEBUG, "marker=%x avail_size_in_buf=%td\n",
start_code, buf_end - buf_ptr);
ret = init_get_bits8(&s->gb, unescaped_buf_ptr, unescaped_buf_size);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "invalid buffer\n");
goto fail;
}
s->start_code = start_code;
if (s->avctx->debug & FF_DEBUG_STARTCODE)
av_log(avctx, AV_LOG_DEBUG, "startcode: %X\n", start_code);
if (start_code >= 0xd0 && start_code <= 0xd7)
av_log(avctx, AV_LOG_DEBUG,
"restart marker: %d\n", start_code & 0x0f);
else if (start_code >= APP0 && start_code <= APP15)
mjpeg_decode_app(s);
else if (start_code == COM)
mjpeg_decode_com(s);
ret = -1;
if (!CONFIG_JPEGLS_DECODER &&
(start_code == SOF48 || start_code == LSE)) {
av_log(avctx, AV_LOG_ERROR, "JPEG-LS support not enabled.\n");
return AVERROR(ENOSYS);
}
switch (start_code) {
case SOI:
s->restart_interval = 0;
s->restart_count = 0;
break;
case DQT:
ff_mjpeg_decode_dqt(s);
break;
case DHT:
if ((ret = ff_mjpeg_decode_dht(s)) < 0) {
av_log(avctx, AV_LOG_ERROR, "huffman table decode error\n");
goto fail;
}
break;
case SOF0:
case SOF1:
s->lossless = 0;
s->ls = 0;
s->progressive = 0;
if ((ret = ff_mjpeg_decode_sof(s)) < 0)
goto fail;
break;
case SOF2:
s->lossless = 0;
s->ls = 0;
s->progressive = 1;
if ((ret = ff_mjpeg_decode_sof(s)) < 0)
goto fail;
break;
case SOF3:
s->lossless = 1;
s->ls = 0;
s->progressive = 0;
if ((ret = ff_mjpeg_decode_sof(s)) < 0)
goto fail;
break;
case SOF48:
s->lossless = 1;
s->ls = 1;
s->progressive = 0;
if ((ret = ff_mjpeg_decode_sof(s)) < 0)
goto fail;
break;
case LSE:
if (!CONFIG_JPEGLS_DECODER ||
(ret = ff_jpegls_decode_lse(s)) < 0)
goto fail;
break;
case EOI:
eoi_parser:
s->cur_scan = 0;
if (!s->got_picture) {
av_log(avctx, AV_LOG_WARNING,
"Found EOI before any SOF, ignoring\n");
break;
}
if (s->interlaced) {
s->bottom_field ^= 1;
if (s->bottom_field == !s->interlace_polarity)
break;
}
if ((ret = av_frame_ref(frame, s->picture_ptr)) < 0)
return ret;
*got_frame = 1;
s->got_picture = 0;
if (!s->lossless) {
int qp = FFMAX3(s->qscale[0],
s->qscale[1],
s->qscale[2]);
int qpw = (s->width + 15) / 16;
AVBufferRef *qp_table_buf = av_buffer_alloc(qpw);
if (qp_table_buf) {
memset(qp_table_buf->data, qp, qpw);
av_frame_set_qp_table(data, qp_table_buf, 0, FF_QSCALE_TYPE_MPEG1);
}
if(avctx->debug & FF_DEBUG_QP)
av_log(avctx, AV_LOG_DEBUG, "QP: %d\n", qp);
}
goto the_end;
case SOS:
s->cur_scan++;
if ((ret = ff_mjpeg_decode_sos(s, NULL, 0, NULL)) < 0 &&
(avctx->err_recognition & AV_EF_EXPLODE))
goto fail;
break;
case DRI:
mjpeg_decode_dri(s);
break;
case SOF5:
case SOF6:
case SOF7:
case SOF9:
case SOF10:
case SOF11:
case SOF13:
case SOF14:
case SOF15:
case JPG:
av_log(avctx, AV_LOG_ERROR,
"mjpeg: unsupported coding type (%x)\n", start_code);
break;
}
buf_ptr += (get_bits_count(&s->gb) + 7) / 8;
av_log(avctx, AV_LOG_DEBUG,
"marker parser used %d bytes (%d bits)\n",
(get_bits_count(&s->gb) + 7) / 8, get_bits_count(&s->gb));
}
if (s->got_picture && s->cur_scan) {
av_log(avctx, AV_LOG_WARNING, "EOI missing, emulating\n");
goto eoi_parser;
}
av_log(avctx, AV_LOG_FATAL, "No JPEG data found in image\n");
return AVERROR_INVALIDDATA;
fail:
s->got_picture = 0;
return ret;
the_end:
if (s->upscale_h) {
uint8_t *line = s->picture_ptr->data[s->upscale_h];
av_assert0(avctx->pix_fmt == AV_PIX_FMT_YUVJ444P ||
avctx->pix_fmt == AV_PIX_FMT_YUV444P ||
avctx->pix_fmt == AV_PIX_FMT_YUVJ440P ||
avctx->pix_fmt == AV_PIX_FMT_YUV440P);
for (i = 0; i < s->chroma_height; i++) {
for (index = s->width - 1; index; index--)
line[index] = (line[index / 2] + line[(index + 1) / 2]) >> 1;
line += s->linesize[s->upscale_h];
}
}
if (s->upscale_v) {
uint8_t *dst = &((uint8_t *)s->picture_ptr->data[s->upscale_v])[(s->height - 1) * s->linesize[s->upscale_v]];
int w;
avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift);
w = s->width >> hshift;
av_assert0(avctx->pix_fmt == AV_PIX_FMT_YUVJ444P ||
avctx->pix_fmt == AV_PIX_FMT_YUV444P ||
avctx->pix_fmt == AV_PIX_FMT_YUVJ422P ||
avctx->pix_fmt == AV_PIX_FMT_YUV422P);
for (i = s->height - 1; i; i--) {
uint8_t *src1 = &((uint8_t *)s->picture_ptr->data[s->upscale_v])[i / 2 * s->linesize[s->upscale_v]];
uint8_t *src2 = &((uint8_t *)s->picture_ptr->data[s->upscale_v])[(i + 1) / 2 * s->linesize[s->upscale_v]];
if (src1 == src2) {
memcpy(dst, src1, w);
} else {
for (index = 0; index < w; index++)
dst[index] = (src1[index] + src2[index]) >> 1;
}
dst -= s->linesize[s->upscale_v];
}
}
if (s->flipped) {
int j;
avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift);
for (index=0; index<4; index++) {
uint8_t *dst = s->picture_ptr->data[index];
int w = s->picture_ptr->width;
int h = s->picture_ptr->height;
if(index && index<3){
w = FF_CEIL_RSHIFT(w, hshift);
h = FF_CEIL_RSHIFT(h, vshift);
}
if(dst){
uint8_t *dst2 = dst + s->linesize[index]*(h-1);
for (i=0; i<h/2; i++) {
for (j=0; j<w; j++)
FFSWAP(int, dst[j], dst2[j]);
dst += s->linesize[index];
dst2 -= s->linesize[index];
}
}
}
}
if (s->stereo3d) {
AVStereo3D *stereo = av_stereo3d_create_side_data(data);
if (stereo) {
stereo->type = s->stereo3d->type;
stereo->flags = s->stereo3d->flags;
}
av_freep(&s->stereo3d);
}
av_dict_copy(avpriv_frame_get_metadatap(data), s->exif_metadata, 0);
av_dict_free(&s->exif_metadata);
av_log(avctx, AV_LOG_DEBUG, "decode frame unused %td bytes\n",
buf_end - buf_ptr);
return buf_ptr - buf;
}
| {
"code": [],
"line_no": []
} | int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2,
AVPacket *VAR_3)
{
AVFrame *frame = VAR_1;
const uint8_t *VAR_4 = VAR_3->VAR_1;
int VAR_5 = VAR_3->size;
MJpegDecodeContext *s = VAR_0->priv_data;
const uint8_t *VAR_6, *buf_ptr;
const uint8_t *VAR_7;
int VAR_8, VAR_9;
int VAR_10;
int VAR_11;
int VAR_12, VAR_13;
int VAR_14 = 0;
av_dict_free(&s->exif_metadata);
av_freep(&s->stereo3d);
buf_ptr = VAR_4;
VAR_6 = VAR_4 + VAR_5;
while (buf_ptr < VAR_6) {
VAR_11 = ff_mjpeg_find_marker(s, &buf_ptr, VAR_6,
&VAR_7,
&VAR_10);
if (VAR_11 < 0) {
break;
} else if (VAR_10 > INT_MAX / 8) {
av_log(VAR_0, AV_LOG_ERROR,
"MJPEG packet 0x%x too big (%d/%d), corrupt VAR_1?\n",
VAR_11, VAR_10, VAR_5);
return AVERROR_INVALIDDATA;
}
av_log(VAR_0, AV_LOG_DEBUG, "marker=%x avail_size_in_buf=%td\n",
VAR_11, VAR_6 - buf_ptr);
VAR_14 = init_get_bits8(&s->gb, VAR_7, VAR_10);
if (VAR_14 < 0) {
av_log(VAR_0, AV_LOG_ERROR, "invalid buffer\n");
goto fail;
}
s->VAR_11 = VAR_11;
if (s->VAR_0->debug & FF_DEBUG_STARTCODE)
av_log(VAR_0, AV_LOG_DEBUG, "startcode: %X\n", VAR_11);
if (VAR_11 >= 0xd0 && VAR_11 <= 0xd7)
av_log(VAR_0, AV_LOG_DEBUG,
"restart marker: %d\n", VAR_11 & 0x0f);
else if (VAR_11 >= APP0 && VAR_11 <= APP15)
mjpeg_decode_app(s);
else if (VAR_11 == COM)
mjpeg_decode_com(s);
VAR_14 = -1;
if (!CONFIG_JPEGLS_DECODER &&
(VAR_11 == SOF48 || VAR_11 == LSE)) {
av_log(VAR_0, AV_LOG_ERROR, "JPEG-LS support not enabled.\n");
return AVERROR(ENOSYS);
}
switch (VAR_11) {
case SOI:
s->restart_interval = 0;
s->restart_count = 0;
break;
case DQT:
ff_mjpeg_decode_dqt(s);
break;
case DHT:
if ((VAR_14 = ff_mjpeg_decode_dht(s)) < 0) {
av_log(VAR_0, AV_LOG_ERROR, "huffman table decode error\n");
goto fail;
}
break;
case SOF0:
case SOF1:
s->lossless = 0;
s->ls = 0;
s->progressive = 0;
if ((VAR_14 = ff_mjpeg_decode_sof(s)) < 0)
goto fail;
break;
case SOF2:
s->lossless = 0;
s->ls = 0;
s->progressive = 1;
if ((VAR_14 = ff_mjpeg_decode_sof(s)) < 0)
goto fail;
break;
case SOF3:
s->lossless = 1;
s->ls = 0;
s->progressive = 0;
if ((VAR_14 = ff_mjpeg_decode_sof(s)) < 0)
goto fail;
break;
case SOF48:
s->lossless = 1;
s->ls = 1;
s->progressive = 0;
if ((VAR_14 = ff_mjpeg_decode_sof(s)) < 0)
goto fail;
break;
case LSE:
if (!CONFIG_JPEGLS_DECODER ||
(VAR_14 = ff_jpegls_decode_lse(s)) < 0)
goto fail;
break;
case EOI:
eoi_parser:
s->cur_scan = 0;
if (!s->got_picture) {
av_log(VAR_0, AV_LOG_WARNING,
"Found EOI before any SOF, ignoring\n");
break;
}
if (s->interlaced) {
s->bottom_field ^= 1;
if (s->bottom_field == !s->interlace_polarity)
break;
}
if ((VAR_14 = av_frame_ref(frame, s->picture_ptr)) < 0)
return VAR_14;
*VAR_2 = 1;
s->got_picture = 0;
if (!s->lossless) {
int VAR_15 = FFMAX3(s->qscale[0],
s->qscale[1],
s->qscale[2]);
int VAR_16 = (s->width + 15) / 16;
AVBufferRef *qp_table_buf = av_buffer_alloc(VAR_16);
if (qp_table_buf) {
memset(qp_table_buf->VAR_1, VAR_15, VAR_16);
av_frame_set_qp_table(VAR_1, qp_table_buf, 0, FF_QSCALE_TYPE_MPEG1);
}
if(VAR_0->debug & FF_DEBUG_QP)
av_log(VAR_0, AV_LOG_DEBUG, "QP: %d\n", VAR_15);
}
goto the_end;
case SOS:
s->cur_scan++;
if ((VAR_14 = ff_mjpeg_decode_sos(s, NULL, 0, NULL)) < 0 &&
(VAR_0->err_recognition & AV_EF_EXPLODE))
goto fail;
break;
case DRI:
mjpeg_decode_dri(s);
break;
case SOF5:
case SOF6:
case SOF7:
case SOF9:
case SOF10:
case SOF11:
case SOF13:
case SOF14:
case SOF15:
case JPG:
av_log(VAR_0, AV_LOG_ERROR,
"mjpeg: unsupported coding type (%x)\n", VAR_11);
break;
}
buf_ptr += (get_bits_count(&s->gb) + 7) / 8;
av_log(VAR_0, AV_LOG_DEBUG,
"marker parser used %d bytes (%d bits)\n",
(get_bits_count(&s->gb) + 7) / 8, get_bits_count(&s->gb));
}
if (s->got_picture && s->cur_scan) {
av_log(VAR_0, AV_LOG_WARNING, "EOI missing, emulating\n");
goto eoi_parser;
}
av_log(VAR_0, AV_LOG_FATAL, "No JPEG VAR_1 found in image\n");
return AVERROR_INVALIDDATA;
fail:
s->got_picture = 0;
return VAR_14;
the_end:
if (s->upscale_h) {
uint8_t *line = s->picture_ptr->VAR_1[s->upscale_h];
av_assert0(VAR_0->pix_fmt == AV_PIX_FMT_YUVJ444P ||
VAR_0->pix_fmt == AV_PIX_FMT_YUV444P ||
VAR_0->pix_fmt == AV_PIX_FMT_YUVJ440P ||
VAR_0->pix_fmt == AV_PIX_FMT_YUV440P);
for (VAR_12 = 0; VAR_12 < s->chroma_height; VAR_12++) {
for (VAR_13 = s->width - 1; VAR_13; VAR_13--)
line[VAR_13] = (line[VAR_13 / 2] + line[(VAR_13 + 1) / 2]) >> 1;
line += s->linesize[s->upscale_h];
}
}
if (s->upscale_v) {
uint8_t *dst = &((uint8_t *)s->picture_ptr->VAR_1[s->upscale_v])[(s->height - 1) * s->linesize[s->upscale_v]];
int VAR_19;
avcodec_get_chroma_sub_sample(s->VAR_0->pix_fmt, &VAR_8, &VAR_9);
VAR_19 = s->width >> VAR_8;
av_assert0(VAR_0->pix_fmt == AV_PIX_FMT_YUVJ444P ||
VAR_0->pix_fmt == AV_PIX_FMT_YUV444P ||
VAR_0->pix_fmt == AV_PIX_FMT_YUVJ422P ||
VAR_0->pix_fmt == AV_PIX_FMT_YUV422P);
for (VAR_12 = s->height - 1; VAR_12; VAR_12--) {
uint8_t *src1 = &((uint8_t *)s->picture_ptr->VAR_1[s->upscale_v])[VAR_12 / 2 * s->linesize[s->upscale_v]];
uint8_t *src2 = &((uint8_t *)s->picture_ptr->VAR_1[s->upscale_v])[(VAR_12 + 1) / 2 * s->linesize[s->upscale_v]];
if (src1 == src2) {
memcpy(dst, src1, VAR_19);
} else {
for (VAR_13 = 0; VAR_13 < VAR_19; VAR_13++)
dst[VAR_13] = (src1[VAR_13] + src2[VAR_13]) >> 1;
}
dst -= s->linesize[s->upscale_v];
}
}
if (s->flipped) {
int VAR_18;
avcodec_get_chroma_sub_sample(s->VAR_0->pix_fmt, &VAR_8, &VAR_9);
for (VAR_13=0; VAR_13<4; VAR_13++) {
uint8_t *dst = s->picture_ptr->VAR_1[VAR_13];
int VAR_19 = s->picture_ptr->width;
int VAR_19 = s->picture_ptr->height;
if(VAR_13 && VAR_13<3){
VAR_19 = FF_CEIL_RSHIFT(VAR_19, VAR_8);
VAR_19 = FF_CEIL_RSHIFT(VAR_19, VAR_9);
}
if(dst){
uint8_t *dst2 = dst + s->linesize[VAR_13]*(VAR_19-1);
for (VAR_12=0; VAR_12<VAR_19/2; VAR_12++) {
for (VAR_18=0; VAR_18<VAR_19; VAR_18++)
FFSWAP(int, dst[VAR_18], dst2[VAR_18]);
dst += s->linesize[VAR_13];
dst2 -= s->linesize[VAR_13];
}
}
}
}
if (s->stereo3d) {
AVStereo3D *stereo = av_stereo3d_create_side_data(VAR_1);
if (stereo) {
stereo->type = s->stereo3d->type;
stereo->flags = s->stereo3d->flags;
}
av_freep(&s->stereo3d);
}
av_dict_copy(avpriv_frame_get_metadatap(VAR_1), s->exif_metadata, 0);
av_dict_free(&s->exif_metadata);
av_log(VAR_0, AV_LOG_DEBUG, "decode frame unused %td bytes\n",
VAR_6 - buf_ptr);
return buf_ptr - VAR_4;
}
| [
"int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{",
"AVFrame *frame = VAR_1;",
"const uint8_t *VAR_4 = VAR_3->VAR_1;",
"int VAR_5 = VAR_3->size;",
"MJpegDecodeContext *s = VAR_0->priv_data;",
"const uint8_t *VAR_6, *buf_ptr;",
"const uint8_t *VAR_7;",
"int VAR_8, VAR_9;",
"int VAR_10;",
"int VAR_11;",
"int VAR_12, VAR_13;",
"int VAR_14 = 0;",
"av_dict_free(&s->exif_metadata);",
"av_freep(&s->stereo3d);",
"buf_ptr = VAR_4;",
"VAR_6 = VAR_4 + VAR_5;",
"while (buf_ptr < VAR_6) {",
"VAR_11 = ff_mjpeg_find_marker(s, &buf_ptr, VAR_6,\n&VAR_7,\n&VAR_10);",
"if (VAR_11 < 0) {",
"break;",
"} else if (VAR_10 > INT_MAX / 8) {",
"av_log(VAR_0, AV_LOG_ERROR,\n\"MJPEG packet 0x%x too big (%d/%d), corrupt VAR_1?\\n\",\nVAR_11, VAR_10, VAR_5);",
"return AVERROR_INVALIDDATA;",
"}",
"av_log(VAR_0, AV_LOG_DEBUG, \"marker=%x avail_size_in_buf=%td\\n\",\nVAR_11, VAR_6 - buf_ptr);",
"VAR_14 = init_get_bits8(&s->gb, VAR_7, VAR_10);",
"if (VAR_14 < 0) {",
"av_log(VAR_0, AV_LOG_ERROR, \"invalid buffer\\n\");",
"goto fail;",
"}",
"s->VAR_11 = VAR_11;",
"if (s->VAR_0->debug & FF_DEBUG_STARTCODE)\nav_log(VAR_0, AV_LOG_DEBUG, \"startcode: %X\\n\", VAR_11);",
"if (VAR_11 >= 0xd0 && VAR_11 <= 0xd7)\nav_log(VAR_0, AV_LOG_DEBUG,\n\"restart marker: %d\\n\", VAR_11 & 0x0f);",
"else if (VAR_11 >= APP0 && VAR_11 <= APP15)\nmjpeg_decode_app(s);",
"else if (VAR_11 == COM)\nmjpeg_decode_com(s);",
"VAR_14 = -1;",
"if (!CONFIG_JPEGLS_DECODER &&\n(VAR_11 == SOF48 || VAR_11 == LSE)) {",
"av_log(VAR_0, AV_LOG_ERROR, \"JPEG-LS support not enabled.\\n\");",
"return AVERROR(ENOSYS);",
"}",
"switch (VAR_11) {",
"case SOI:\ns->restart_interval = 0;",
"s->restart_count = 0;",
"break;",
"case DQT:\nff_mjpeg_decode_dqt(s);",
"break;",
"case DHT:\nif ((VAR_14 = ff_mjpeg_decode_dht(s)) < 0) {",
"av_log(VAR_0, AV_LOG_ERROR, \"huffman table decode error\\n\");",
"goto fail;",
"}",
"break;",
"case SOF0:\ncase SOF1:\ns->lossless = 0;",
"s->ls = 0;",
"s->progressive = 0;",
"if ((VAR_14 = ff_mjpeg_decode_sof(s)) < 0)\ngoto fail;",
"break;",
"case SOF2:\ns->lossless = 0;",
"s->ls = 0;",
"s->progressive = 1;",
"if ((VAR_14 = ff_mjpeg_decode_sof(s)) < 0)\ngoto fail;",
"break;",
"case SOF3:\ns->lossless = 1;",
"s->ls = 0;",
"s->progressive = 0;",
"if ((VAR_14 = ff_mjpeg_decode_sof(s)) < 0)\ngoto fail;",
"break;",
"case SOF48:\ns->lossless = 1;",
"s->ls = 1;",
"s->progressive = 0;",
"if ((VAR_14 = ff_mjpeg_decode_sof(s)) < 0)\ngoto fail;",
"break;",
"case LSE:\nif (!CONFIG_JPEGLS_DECODER ||\n(VAR_14 = ff_jpegls_decode_lse(s)) < 0)\ngoto fail;",
"break;",
"case EOI:\neoi_parser:\ns->cur_scan = 0;",
"if (!s->got_picture) {",
"av_log(VAR_0, AV_LOG_WARNING,\n\"Found EOI before any SOF, ignoring\\n\");",
"break;",
"}",
"if (s->interlaced) {",
"s->bottom_field ^= 1;",
"if (s->bottom_field == !s->interlace_polarity)\nbreak;",
"}",
"if ((VAR_14 = av_frame_ref(frame, s->picture_ptr)) < 0)\nreturn VAR_14;",
"*VAR_2 = 1;",
"s->got_picture = 0;",
"if (!s->lossless) {",
"int VAR_15 = FFMAX3(s->qscale[0],\ns->qscale[1],\ns->qscale[2]);",
"int VAR_16 = (s->width + 15) / 16;",
"AVBufferRef *qp_table_buf = av_buffer_alloc(VAR_16);",
"if (qp_table_buf) {",
"memset(qp_table_buf->VAR_1, VAR_15, VAR_16);",
"av_frame_set_qp_table(VAR_1, qp_table_buf, 0, FF_QSCALE_TYPE_MPEG1);",
"}",
"if(VAR_0->debug & FF_DEBUG_QP)\nav_log(VAR_0, AV_LOG_DEBUG, \"QP: %d\\n\", VAR_15);",
"}",
"goto the_end;",
"case SOS:\ns->cur_scan++;",
"if ((VAR_14 = ff_mjpeg_decode_sos(s, NULL, 0, NULL)) < 0 &&\n(VAR_0->err_recognition & AV_EF_EXPLODE))\ngoto fail;",
"break;",
"case DRI:\nmjpeg_decode_dri(s);",
"break;",
"case SOF5:\ncase SOF6:\ncase SOF7:\ncase SOF9:\ncase SOF10:\ncase SOF11:\ncase SOF13:\ncase SOF14:\ncase SOF15:\ncase JPG:\nav_log(VAR_0, AV_LOG_ERROR,\n\"mjpeg: unsupported coding type (%x)\\n\", VAR_11);",
"break;",
"}",
"buf_ptr += (get_bits_count(&s->gb) + 7) / 8;",
"av_log(VAR_0, AV_LOG_DEBUG,\n\"marker parser used %d bytes (%d bits)\\n\",\n(get_bits_count(&s->gb) + 7) / 8, get_bits_count(&s->gb));",
"}",
"if (s->got_picture && s->cur_scan) {",
"av_log(VAR_0, AV_LOG_WARNING, \"EOI missing, emulating\\n\");",
"goto eoi_parser;",
"}",
"av_log(VAR_0, AV_LOG_FATAL, \"No JPEG VAR_1 found in image\\n\");",
"return AVERROR_INVALIDDATA;",
"fail:\ns->got_picture = 0;",
"return VAR_14;",
"the_end:\nif (s->upscale_h) {",
"uint8_t *line = s->picture_ptr->VAR_1[s->upscale_h];",
"av_assert0(VAR_0->pix_fmt == AV_PIX_FMT_YUVJ444P ||\nVAR_0->pix_fmt == AV_PIX_FMT_YUV444P ||\nVAR_0->pix_fmt == AV_PIX_FMT_YUVJ440P ||\nVAR_0->pix_fmt == AV_PIX_FMT_YUV440P);",
"for (VAR_12 = 0; VAR_12 < s->chroma_height; VAR_12++) {",
"for (VAR_13 = s->width - 1; VAR_13; VAR_13--)",
"line[VAR_13] = (line[VAR_13 / 2] + line[(VAR_13 + 1) / 2]) >> 1;",
"line += s->linesize[s->upscale_h];",
"}",
"}",
"if (s->upscale_v) {",
"uint8_t *dst = &((uint8_t *)s->picture_ptr->VAR_1[s->upscale_v])[(s->height - 1) * s->linesize[s->upscale_v]];",
"int VAR_19;",
"avcodec_get_chroma_sub_sample(s->VAR_0->pix_fmt, &VAR_8, &VAR_9);",
"VAR_19 = s->width >> VAR_8;",
"av_assert0(VAR_0->pix_fmt == AV_PIX_FMT_YUVJ444P ||\nVAR_0->pix_fmt == AV_PIX_FMT_YUV444P ||\nVAR_0->pix_fmt == AV_PIX_FMT_YUVJ422P ||\nVAR_0->pix_fmt == AV_PIX_FMT_YUV422P);",
"for (VAR_12 = s->height - 1; VAR_12; VAR_12--) {",
"uint8_t *src1 = &((uint8_t *)s->picture_ptr->VAR_1[s->upscale_v])[VAR_12 / 2 * s->linesize[s->upscale_v]];",
"uint8_t *src2 = &((uint8_t *)s->picture_ptr->VAR_1[s->upscale_v])[(VAR_12 + 1) / 2 * s->linesize[s->upscale_v]];",
"if (src1 == src2) {",
"memcpy(dst, src1, VAR_19);",
"} else {",
"for (VAR_13 = 0; VAR_13 < VAR_19; VAR_13++)",
"dst[VAR_13] = (src1[VAR_13] + src2[VAR_13]) >> 1;",
"}",
"dst -= s->linesize[s->upscale_v];",
"}",
"}",
"if (s->flipped) {",
"int VAR_18;",
"avcodec_get_chroma_sub_sample(s->VAR_0->pix_fmt, &VAR_8, &VAR_9);",
"for (VAR_13=0; VAR_13<4; VAR_13++) {",
"uint8_t *dst = s->picture_ptr->VAR_1[VAR_13];",
"int VAR_19 = s->picture_ptr->width;",
"int VAR_19 = s->picture_ptr->height;",
"if(VAR_13 && VAR_13<3){",
"VAR_19 = FF_CEIL_RSHIFT(VAR_19, VAR_8);",
"VAR_19 = FF_CEIL_RSHIFT(VAR_19, VAR_9);",
"}",
"if(dst){",
"uint8_t *dst2 = dst + s->linesize[VAR_13]*(VAR_19-1);",
"for (VAR_12=0; VAR_12<VAR_19/2; VAR_12++) {",
"for (VAR_18=0; VAR_18<VAR_19; VAR_18++)",
"FFSWAP(int, dst[VAR_18], dst2[VAR_18]);",
"dst += s->linesize[VAR_13];",
"dst2 -= s->linesize[VAR_13];",
"}",
"}",
"}",
"}",
"if (s->stereo3d) {",
"AVStereo3D *stereo = av_stereo3d_create_side_data(VAR_1);",
"if (stereo) {",
"stereo->type = s->stereo3d->type;",
"stereo->flags = s->stereo3d->flags;",
"}",
"av_freep(&s->stereo3d);",
"}",
"av_dict_copy(avpriv_frame_get_metadatap(VAR_1), s->exif_metadata, 0);",
"av_dict_free(&s->exif_metadata);",
"av_log(VAR_0, AV_LOG_DEBUG, \"decode frame unused %td bytes\\n\",\nVAR_6 - buf_ptr);",
"return buf_ptr - VAR_4;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
31
],
[
33
],
[
37
],
[
39
],
[
41
],
[
45,
47,
49
],
[
53
],
[
55
],
[
57
],
[
59,
61,
63
],
[
65
],
[
67
],
[
69,
71
],
[
75
],
[
79
],
[
81
],
[
83
],
[
85
],
[
89
],
[
91,
93
],
[
99,
101,
103
],
[
107,
109
],
[
113,
115
],
[
119
],
[
123,
125
],
[
127
],
[
129
],
[
131
],
[
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,
191
],
[
193
],
[
195,
197
],
[
199
],
[
201
],
[
203,
205
],
[
207
],
[
209,
211
],
[
213
],
[
215
],
[
217,
219
],
[
221
],
[
223,
225,
227,
229
],
[
231
],
[
233,
235,
237
],
[
239
],
[
241,
243
],
[
245
],
[
247
],
[
249
],
[
251
],
[
255,
257
],
[
259
],
[
261,
263
],
[
265
],
[
267
],
[
271
],
[
273,
275,
277
],
[
279
],
[
281
],
[
283
],
[
285
],
[
287
],
[
289
],
[
293,
295
],
[
297
],
[
301
],
[
303,
305
],
[
307,
309,
311
],
[
313
],
[
315,
317
],
[
319
],
[
321,
323,
325,
327,
329,
331,
333,
335,
337,
339,
341,
343
],
[
345
],
[
347
],
[
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
],
[
495
],
[
497
],
[
499
],
[
501
],
[
503
],
[
505
],
[
507
],
[
509
],
[
513
],
[
515
],
[
519,
521
],
[
525
],
[
527
]
]
|
12,380 | void hpet_init(qemu_irq *irq) {
int i, iomemtype;
HPETState *s;
dprintf ("hpet_init\n");
s = qemu_mallocz(sizeof(HPETState));
hpet_statep = s;
s->irqs = irq;
for (i=0; i<HPET_NUM_TIMERS; i++) {
HPETTimer *timer = &s->timer[i];
timer->qemu_timer = qemu_new_timer(vm_clock, hpet_timer, timer);
}
hpet_reset(s);
vmstate_register(-1, &vmstate_hpet, s);
qemu_register_reset(hpet_reset, s);
/* HPET Area */
iomemtype = cpu_register_io_memory(hpet_ram_read,
hpet_ram_write, s);
cpu_register_physical_memory(HPET_BASE, 0x400, iomemtype);
}
| false | qemu | c169998802505c244b8bcad562633f29de7d74a4 | void hpet_init(qemu_irq *irq) {
int i, iomemtype;
HPETState *s;
dprintf ("hpet_init\n");
s = qemu_mallocz(sizeof(HPETState));
hpet_statep = s;
s->irqs = irq;
for (i=0; i<HPET_NUM_TIMERS; i++) {
HPETTimer *timer = &s->timer[i];
timer->qemu_timer = qemu_new_timer(vm_clock, hpet_timer, timer);
}
hpet_reset(s);
vmstate_register(-1, &vmstate_hpet, s);
qemu_register_reset(hpet_reset, s);
iomemtype = cpu_register_io_memory(hpet_ram_read,
hpet_ram_write, s);
cpu_register_physical_memory(HPET_BASE, 0x400, iomemtype);
}
| {
"code": [],
"line_no": []
} | void FUNC_0(qemu_irq *VAR_0) {
int VAR_1, VAR_2;
HPETState *s;
dprintf ("FUNC_0\n");
s = qemu_mallocz(sizeof(HPETState));
hpet_statep = s;
s->irqs = VAR_0;
for (VAR_1=0; VAR_1<HPET_NUM_TIMERS; VAR_1++) {
HPETTimer *timer = &s->timer[VAR_1];
timer->qemu_timer = qemu_new_timer(vm_clock, hpet_timer, timer);
}
hpet_reset(s);
vmstate_register(-1, &vmstate_hpet, s);
qemu_register_reset(hpet_reset, s);
VAR_2 = cpu_register_io_memory(hpet_ram_read,
hpet_ram_write, s);
cpu_register_physical_memory(HPET_BASE, 0x400, VAR_2);
}
| [
"void FUNC_0(qemu_irq *VAR_0) {",
"int VAR_1, VAR_2;",
"HPETState *s;",
"dprintf (\"FUNC_0\\n\");",
"s = qemu_mallocz(sizeof(HPETState));",
"hpet_statep = s;",
"s->irqs = VAR_0;",
"for (VAR_1=0; VAR_1<HPET_NUM_TIMERS; VAR_1++) {",
"HPETTimer *timer = &s->timer[VAR_1];",
"timer->qemu_timer = qemu_new_timer(vm_clock, hpet_timer, timer);",
"}",
"hpet_reset(s);",
"vmstate_register(-1, &vmstate_hpet, s);",
"qemu_register_reset(hpet_reset, s);",
"VAR_2 = cpu_register_io_memory(hpet_ram_read,\nhpet_ram_write, s);",
"cpu_register_physical_memory(HPET_BASE, 0x400, VAR_2);",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1
],
[
3
],
[
5
],
[
9
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
35,
37
],
[
39
],
[
41
]
]
|
12,381 | static void x86_cpu_initfn(Object *obj)
{
CPUState *cs = CPU(obj);
X86CPU *cpu = X86_CPU(obj);
X86CPUClass *xcc = X86_CPU_GET_CLASS(obj);
CPUX86State *env = &cpu->env;
FeatureWord w;
cs->env_ptr = env;
cpu_exec_init(cs, &error_abort);
object_property_add(obj, "family", "int",
x86_cpuid_version_get_family,
x86_cpuid_version_set_family, NULL, NULL, NULL);
object_property_add(obj, "model", "int",
x86_cpuid_version_get_model,
x86_cpuid_version_set_model, NULL, NULL, NULL);
object_property_add(obj, "stepping", "int",
x86_cpuid_version_get_stepping,
x86_cpuid_version_set_stepping, NULL, NULL, NULL);
object_property_add_str(obj, "vendor",
x86_cpuid_get_vendor,
x86_cpuid_set_vendor, NULL);
object_property_add_str(obj, "model-id",
x86_cpuid_get_model_id,
x86_cpuid_set_model_id, NULL);
object_property_add(obj, "tsc-frequency", "int",
x86_cpuid_get_tsc_freq,
x86_cpuid_set_tsc_freq, NULL, NULL, NULL);
object_property_add(obj, "apic-id", "int",
x86_cpuid_get_apic_id,
x86_cpuid_set_apic_id, NULL, NULL, NULL);
object_property_add(obj, "feature-words", "X86CPUFeatureWordInfo",
x86_cpu_get_feature_words,
NULL, NULL, (void *)env->features, NULL);
object_property_add(obj, "filtered-features", "X86CPUFeatureWordInfo",
x86_cpu_get_feature_words,
NULL, NULL, (void *)cpu->filtered_features, NULL);
cpu->hyperv_spinlock_attempts = HYPERV_SPINLOCK_NEVER_RETRY;
#ifndef CONFIG_USER_ONLY
/* Any code creating new X86CPU objects have to set apic-id explicitly */
cpu->apic_id = -1;
#endif
for (w = 0; w < FEATURE_WORDS; w++) {
int bitnr;
for (bitnr = 0; bitnr < 32; bitnr++) {
x86_cpu_register_feature_bit_props(cpu, w, bitnr);
}
}
x86_cpu_load_def(cpu, xcc->cpu_def, &error_abort);
}
| false | qemu | 42ecabaae16c0054dde6d8b0fdf90a8c7cce270d | static void x86_cpu_initfn(Object *obj)
{
CPUState *cs = CPU(obj);
X86CPU *cpu = X86_CPU(obj);
X86CPUClass *xcc = X86_CPU_GET_CLASS(obj);
CPUX86State *env = &cpu->env;
FeatureWord w;
cs->env_ptr = env;
cpu_exec_init(cs, &error_abort);
object_property_add(obj, "family", "int",
x86_cpuid_version_get_family,
x86_cpuid_version_set_family, NULL, NULL, NULL);
object_property_add(obj, "model", "int",
x86_cpuid_version_get_model,
x86_cpuid_version_set_model, NULL, NULL, NULL);
object_property_add(obj, "stepping", "int",
x86_cpuid_version_get_stepping,
x86_cpuid_version_set_stepping, NULL, NULL, NULL);
object_property_add_str(obj, "vendor",
x86_cpuid_get_vendor,
x86_cpuid_set_vendor, NULL);
object_property_add_str(obj, "model-id",
x86_cpuid_get_model_id,
x86_cpuid_set_model_id, NULL);
object_property_add(obj, "tsc-frequency", "int",
x86_cpuid_get_tsc_freq,
x86_cpuid_set_tsc_freq, NULL, NULL, NULL);
object_property_add(obj, "apic-id", "int",
x86_cpuid_get_apic_id,
x86_cpuid_set_apic_id, NULL, NULL, NULL);
object_property_add(obj, "feature-words", "X86CPUFeatureWordInfo",
x86_cpu_get_feature_words,
NULL, NULL, (void *)env->features, NULL);
object_property_add(obj, "filtered-features", "X86CPUFeatureWordInfo",
x86_cpu_get_feature_words,
NULL, NULL, (void *)cpu->filtered_features, NULL);
cpu->hyperv_spinlock_attempts = HYPERV_SPINLOCK_NEVER_RETRY;
#ifndef CONFIG_USER_ONLY
cpu->apic_id = -1;
#endif
for (w = 0; w < FEATURE_WORDS; w++) {
int bitnr;
for (bitnr = 0; bitnr < 32; bitnr++) {
x86_cpu_register_feature_bit_props(cpu, w, bitnr);
}
}
x86_cpu_load_def(cpu, xcc->cpu_def, &error_abort);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(Object *VAR_0)
{
CPUState *cs = CPU(VAR_0);
X86CPU *cpu = X86_CPU(VAR_0);
X86CPUClass *xcc = X86_CPU_GET_CLASS(VAR_0);
CPUX86State *env = &cpu->env;
FeatureWord w;
cs->env_ptr = env;
cpu_exec_init(cs, &error_abort);
object_property_add(VAR_0, "family", "int",
x86_cpuid_version_get_family,
x86_cpuid_version_set_family, NULL, NULL, NULL);
object_property_add(VAR_0, "model", "int",
x86_cpuid_version_get_model,
x86_cpuid_version_set_model, NULL, NULL, NULL);
object_property_add(VAR_0, "stepping", "int",
x86_cpuid_version_get_stepping,
x86_cpuid_version_set_stepping, NULL, NULL, NULL);
object_property_add_str(VAR_0, "vendor",
x86_cpuid_get_vendor,
x86_cpuid_set_vendor, NULL);
object_property_add_str(VAR_0, "model-id",
x86_cpuid_get_model_id,
x86_cpuid_set_model_id, NULL);
object_property_add(VAR_0, "tsc-frequency", "int",
x86_cpuid_get_tsc_freq,
x86_cpuid_set_tsc_freq, NULL, NULL, NULL);
object_property_add(VAR_0, "apic-id", "int",
x86_cpuid_get_apic_id,
x86_cpuid_set_apic_id, NULL, NULL, NULL);
object_property_add(VAR_0, "feature-words", "X86CPUFeatureWordInfo",
x86_cpu_get_feature_words,
NULL, NULL, (void *)env->features, NULL);
object_property_add(VAR_0, "filtered-features", "X86CPUFeatureWordInfo",
x86_cpu_get_feature_words,
NULL, NULL, (void *)cpu->filtered_features, NULL);
cpu->hyperv_spinlock_attempts = HYPERV_SPINLOCK_NEVER_RETRY;
#ifndef CONFIG_USER_ONLY
cpu->apic_id = -1;
#endif
for (w = 0; w < FEATURE_WORDS; w++) {
int bitnr;
for (bitnr = 0; bitnr < 32; bitnr++) {
x86_cpu_register_feature_bit_props(cpu, w, bitnr);
}
}
x86_cpu_load_def(cpu, xcc->cpu_def, &error_abort);
}
| [
"static void FUNC_0(Object *VAR_0)\n{",
"CPUState *cs = CPU(VAR_0);",
"X86CPU *cpu = X86_CPU(VAR_0);",
"X86CPUClass *xcc = X86_CPU_GET_CLASS(VAR_0);",
"CPUX86State *env = &cpu->env;",
"FeatureWord w;",
"cs->env_ptr = env;",
"cpu_exec_init(cs, &error_abort);",
"object_property_add(VAR_0, \"family\", \"int\",\nx86_cpuid_version_get_family,\nx86_cpuid_version_set_family, NULL, NULL, NULL);",
"object_property_add(VAR_0, \"model\", \"int\",\nx86_cpuid_version_get_model,\nx86_cpuid_version_set_model, NULL, NULL, NULL);",
"object_property_add(VAR_0, \"stepping\", \"int\",\nx86_cpuid_version_get_stepping,\nx86_cpuid_version_set_stepping, NULL, NULL, NULL);",
"object_property_add_str(VAR_0, \"vendor\",\nx86_cpuid_get_vendor,\nx86_cpuid_set_vendor, NULL);",
"object_property_add_str(VAR_0, \"model-id\",\nx86_cpuid_get_model_id,\nx86_cpuid_set_model_id, NULL);",
"object_property_add(VAR_0, \"tsc-frequency\", \"int\",\nx86_cpuid_get_tsc_freq,\nx86_cpuid_set_tsc_freq, NULL, NULL, NULL);",
"object_property_add(VAR_0, \"apic-id\", \"int\",\nx86_cpuid_get_apic_id,\nx86_cpuid_set_apic_id, NULL, NULL, NULL);",
"object_property_add(VAR_0, \"feature-words\", \"X86CPUFeatureWordInfo\",\nx86_cpu_get_feature_words,\nNULL, NULL, (void *)env->features, NULL);",
"object_property_add(VAR_0, \"filtered-features\", \"X86CPUFeatureWordInfo\",\nx86_cpu_get_feature_words,\nNULL, NULL, (void *)cpu->filtered_features, NULL);",
"cpu->hyperv_spinlock_attempts = HYPERV_SPINLOCK_NEVER_RETRY;",
"#ifndef CONFIG_USER_ONLY\ncpu->apic_id = -1;",
"#endif\nfor (w = 0; w < FEATURE_WORDS; w++) {",
"int bitnr;",
"for (bitnr = 0; bitnr < 32; bitnr++) {",
"x86_cpu_register_feature_bit_props(cpu, w, bitnr);",
"}",
"}",
"x86_cpu_load_def(cpu, xcc->cpu_def, &error_abort);",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
19
],
[
23,
25,
27
],
[
29,
31,
33
],
[
35,
37,
39
],
[
41,
43,
45
],
[
47,
49,
51
],
[
53,
55,
57
],
[
59,
61,
63
],
[
65,
67,
69
],
[
71,
73,
75
],
[
79
],
[
83,
87
],
[
89,
93
],
[
95
],
[
99
],
[
101
],
[
103
],
[
105
],
[
109
],
[
111
]
]
|
12,382 | build_dsdt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info)
{
Aml *scope, *dsdt;
const MemMapEntry *memmap = guest_info->memmap;
const int *irqmap = guest_info->irqmap;
dsdt = init_aml_allocator();
/* Reserve space for header */
acpi_data_push(dsdt->buf, sizeof(AcpiTableHeader));
/* When booting the VM with UEFI, UEFI takes ownership of the RTC hardware.
* While UEFI can use libfdt to disable the RTC device node in the DTB that
* it passes to the OS, it cannot modify AML. Therefore, we won't generate
* the RTC ACPI device at all when using UEFI.
*/
scope = aml_scope("\\_SB");
acpi_dsdt_add_cpus(scope, guest_info->smp_cpus);
acpi_dsdt_add_uart(scope, &memmap[VIRT_UART],
(irqmap[VIRT_UART] + ARM_SPI_BASE));
acpi_dsdt_add_flash(scope, &memmap[VIRT_FLASH]);
acpi_dsdt_add_virtio(scope, &memmap[VIRT_MMIO],
(irqmap[VIRT_MMIO] + ARM_SPI_BASE), NUM_VIRTIO_TRANSPORTS);
acpi_dsdt_add_pci(scope, memmap, (irqmap[VIRT_PCIE] + ARM_SPI_BASE),
guest_info->use_highmem);
acpi_dsdt_add_gpio(scope, &memmap[VIRT_GPIO],
(irqmap[VIRT_GPIO] + ARM_SPI_BASE));
acpi_dsdt_add_power_button(scope);
aml_append(dsdt, scope);
/* copy AML table into ACPI tables blob and patch header there */
g_array_append_vals(table_data, dsdt->buf->data, dsdt->buf->len);
build_header(linker, table_data,
(void *)(table_data->data + table_data->len - dsdt->buf->len),
"DSDT", dsdt->buf->len, 2, NULL);
free_aml_allocator();
}
| false | qemu | 37ad223c515da2fe9f1c679768cb5ccaa42e57e1 | build_dsdt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info)
{
Aml *scope, *dsdt;
const MemMapEntry *memmap = guest_info->memmap;
const int *irqmap = guest_info->irqmap;
dsdt = init_aml_allocator();
acpi_data_push(dsdt->buf, sizeof(AcpiTableHeader));
scope = aml_scope("\\_SB");
acpi_dsdt_add_cpus(scope, guest_info->smp_cpus);
acpi_dsdt_add_uart(scope, &memmap[VIRT_UART],
(irqmap[VIRT_UART] + ARM_SPI_BASE));
acpi_dsdt_add_flash(scope, &memmap[VIRT_FLASH]);
acpi_dsdt_add_virtio(scope, &memmap[VIRT_MMIO],
(irqmap[VIRT_MMIO] + ARM_SPI_BASE), NUM_VIRTIO_TRANSPORTS);
acpi_dsdt_add_pci(scope, memmap, (irqmap[VIRT_PCIE] + ARM_SPI_BASE),
guest_info->use_highmem);
acpi_dsdt_add_gpio(scope, &memmap[VIRT_GPIO],
(irqmap[VIRT_GPIO] + ARM_SPI_BASE));
acpi_dsdt_add_power_button(scope);
aml_append(dsdt, scope);
g_array_append_vals(table_data, dsdt->buf->data, dsdt->buf->len);
build_header(linker, table_data,
(void *)(table_data->data + table_data->len - dsdt->buf->len),
"DSDT", dsdt->buf->len, 2, NULL);
free_aml_allocator();
}
| {
"code": [],
"line_no": []
} | FUNC_0(GArray *VAR_0, GArray *VAR_1, VirtGuestInfo *VAR_2)
{
Aml *scope, *dsdt;
const MemMapEntry *VAR_3 = VAR_2->VAR_3;
const int *VAR_4 = VAR_2->VAR_4;
dsdt = init_aml_allocator();
acpi_data_push(dsdt->buf, sizeof(AcpiTableHeader));
scope = aml_scope("\\_SB");
acpi_dsdt_add_cpus(scope, VAR_2->smp_cpus);
acpi_dsdt_add_uart(scope, &VAR_3[VIRT_UART],
(VAR_4[VIRT_UART] + ARM_SPI_BASE));
acpi_dsdt_add_flash(scope, &VAR_3[VIRT_FLASH]);
acpi_dsdt_add_virtio(scope, &VAR_3[VIRT_MMIO],
(VAR_4[VIRT_MMIO] + ARM_SPI_BASE), NUM_VIRTIO_TRANSPORTS);
acpi_dsdt_add_pci(scope, VAR_3, (VAR_4[VIRT_PCIE] + ARM_SPI_BASE),
VAR_2->use_highmem);
acpi_dsdt_add_gpio(scope, &VAR_3[VIRT_GPIO],
(VAR_4[VIRT_GPIO] + ARM_SPI_BASE));
acpi_dsdt_add_power_button(scope);
aml_append(dsdt, scope);
g_array_append_vals(VAR_0, dsdt->buf->data, dsdt->buf->len);
build_header(VAR_1, VAR_0,
(void *)(VAR_0->data + VAR_0->len - dsdt->buf->len),
"DSDT", dsdt->buf->len, 2, NULL);
free_aml_allocator();
}
| [
"FUNC_0(GArray *VAR_0, GArray *VAR_1, VirtGuestInfo *VAR_2)\n{",
"Aml *scope, *dsdt;",
"const MemMapEntry *VAR_3 = VAR_2->VAR_3;",
"const int *VAR_4 = VAR_2->VAR_4;",
"dsdt = init_aml_allocator();",
"acpi_data_push(dsdt->buf, sizeof(AcpiTableHeader));",
"scope = aml_scope(\"\\\\_SB\");",
"acpi_dsdt_add_cpus(scope, VAR_2->smp_cpus);",
"acpi_dsdt_add_uart(scope, &VAR_3[VIRT_UART],\n(VAR_4[VIRT_UART] + ARM_SPI_BASE));",
"acpi_dsdt_add_flash(scope, &VAR_3[VIRT_FLASH]);",
"acpi_dsdt_add_virtio(scope, &VAR_3[VIRT_MMIO],\n(VAR_4[VIRT_MMIO] + ARM_SPI_BASE), NUM_VIRTIO_TRANSPORTS);",
"acpi_dsdt_add_pci(scope, VAR_3, (VAR_4[VIRT_PCIE] + ARM_SPI_BASE),\nVAR_2->use_highmem);",
"acpi_dsdt_add_gpio(scope, &VAR_3[VIRT_GPIO],\n(VAR_4[VIRT_GPIO] + ARM_SPI_BASE));",
"acpi_dsdt_add_power_button(scope);",
"aml_append(dsdt, scope);",
"g_array_append_vals(VAR_0, dsdt->buf->data, dsdt->buf->len);",
"build_header(VAR_1, VAR_0,\n(void *)(VAR_0->data + VAR_0->len - dsdt->buf->len),\n\"DSDT\", dsdt->buf->len, 2, NULL);",
"free_aml_allocator();",
"}"
]
| [
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
],
[
31
],
[
33
],
[
35,
37
],
[
39
],
[
41,
43
],
[
45,
47
],
[
49,
51
],
[
53
],
[
57
],
[
63
],
[
65,
67,
69
],
[
71
],
[
73
]
]
|
12,385 | static int lag_decode_frame(AVCodecContext *avctx,
void *data, int *got_frame, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
unsigned int buf_size = avpkt->size;
LagarithContext *l = avctx->priv_data;
ThreadFrame frame = { .f = data };
AVFrame *const p = data;
uint8_t frametype = 0;
uint32_t offset_gu = 0, offset_bv = 0, offset_ry = 9;
uint32_t offs[4];
uint8_t *srcs[4], *dst;
int i, j, planes = 3;
int ret;
p->key_frame = 1;
frametype = buf[0];
offset_gu = AV_RL32(buf + 1);
offset_bv = AV_RL32(buf + 5);
switch (frametype) {
case FRAME_SOLID_RGBA:
avctx->pix_fmt = AV_PIX_FMT_RGB32;
case FRAME_SOLID_GRAY:
if (frametype == FRAME_SOLID_GRAY)
if (avctx->bits_per_coded_sample == 24) {
avctx->pix_fmt = AV_PIX_FMT_RGB24;
} else {
avctx->pix_fmt = AV_PIX_FMT_0RGB32;
planes = 4;
}
if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
return ret;
dst = p->data[0];
if (frametype == FRAME_SOLID_RGBA) {
for (j = 0; j < avctx->height; j++) {
for (i = 0; i < avctx->width; i++)
AV_WN32(dst + i * 4, offset_gu);
dst += p->linesize[0];
}
} else {
for (j = 0; j < avctx->height; j++) {
memset(dst, buf[1], avctx->width * planes);
dst += p->linesize[0];
}
}
break;
case FRAME_SOLID_COLOR:
if (avctx->bits_per_coded_sample == 24) {
avctx->pix_fmt = AV_PIX_FMT_RGB24;
} else {
avctx->pix_fmt = AV_PIX_FMT_RGB32;
offset_gu |= 0xFFU << 24;
}
if ((ret = ff_thread_get_buffer(avctx, &frame,0)) < 0)
return ret;
dst = p->data[0];
for (j = 0; j < avctx->height; j++) {
for (i = 0; i < avctx->width; i++)
if (avctx->bits_per_coded_sample == 24) {
AV_WB24(dst + i * 3, offset_gu);
} else {
AV_WN32(dst + i * 4, offset_gu);
}
dst += p->linesize[0];
}
break;
case FRAME_ARITH_RGBA:
avctx->pix_fmt = AV_PIX_FMT_RGB32;
planes = 4;
offset_ry += 4;
offs[3] = AV_RL32(buf + 9);
case FRAME_ARITH_RGB24:
case FRAME_U_RGB24:
if (frametype == FRAME_ARITH_RGB24 || frametype == FRAME_U_RGB24)
avctx->pix_fmt = AV_PIX_FMT_RGB24;
if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
return ret;
offs[0] = offset_bv;
offs[1] = offset_gu;
offs[2] = offset_ry;
l->rgb_stride = FFALIGN(avctx->width, 16);
av_fast_malloc(&l->rgb_planes, &l->rgb_planes_allocated,
l->rgb_stride * avctx->height * planes + 1);
if (!l->rgb_planes) {
av_log(avctx, AV_LOG_ERROR, "cannot allocate temporary buffer\n");
return AVERROR(ENOMEM);
}
for (i = 0; i < planes; i++)
srcs[i] = l->rgb_planes + (i + 1) * l->rgb_stride * avctx->height - l->rgb_stride;
for (i = 0; i < planes; i++)
if (buf_size <= offs[i]) {
av_log(avctx, AV_LOG_ERROR,
"Invalid frame offsets\n");
return AVERROR_INVALIDDATA;
}
for (i = 0; i < planes; i++)
lag_decode_arith_plane(l, srcs[i],
avctx->width, avctx->height,
-l->rgb_stride, buf + offs[i],
buf_size - offs[i]);
dst = p->data[0];
for (i = 0; i < planes; i++)
srcs[i] = l->rgb_planes + i * l->rgb_stride * avctx->height;
for (j = 0; j < avctx->height; j++) {
for (i = 0; i < avctx->width; i++) {
uint8_t r, g, b, a;
r = srcs[0][i];
g = srcs[1][i];
b = srcs[2][i];
r += g;
b += g;
if (frametype == FRAME_ARITH_RGBA) {
a = srcs[3][i];
AV_WN32(dst + i * 4, MKBETAG(a, r, g, b));
} else {
dst[i * 3 + 0] = r;
dst[i * 3 + 1] = g;
dst[i * 3 + 2] = b;
}
}
dst += p->linesize[0];
for (i = 0; i < planes; i++)
srcs[i] += l->rgb_stride;
}
break;
case FRAME_ARITH_YUY2:
avctx->pix_fmt = AV_PIX_FMT_YUV422P;
if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
return ret;
if (offset_ry >= buf_size ||
offset_gu >= buf_size ||
offset_bv >= buf_size) {
av_log(avctx, AV_LOG_ERROR,
"Invalid frame offsets\n");
return AVERROR_INVALIDDATA;
}
lag_decode_arith_plane(l, p->data[0], avctx->width, avctx->height,
p->linesize[0], buf + offset_ry,
buf_size - offset_ry);
lag_decode_arith_plane(l, p->data[1], avctx->width / 2,
avctx->height, p->linesize[1],
buf + offset_gu, buf_size - offset_gu);
lag_decode_arith_plane(l, p->data[2], avctx->width / 2,
avctx->height, p->linesize[2],
buf + offset_bv, buf_size - offset_bv);
break;
case FRAME_ARITH_YV12:
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
return ret;
if (buf_size <= offset_ry || buf_size <= offset_gu || buf_size <= offset_bv) {
return AVERROR_INVALIDDATA;
}
if (offset_ry >= buf_size ||
offset_gu >= buf_size ||
offset_bv >= buf_size) {
av_log(avctx, AV_LOG_ERROR,
"Invalid frame offsets\n");
return AVERROR_INVALIDDATA;
}
lag_decode_arith_plane(l, p->data[0], avctx->width, avctx->height,
p->linesize[0], buf + offset_ry,
buf_size - offset_ry);
lag_decode_arith_plane(l, p->data[2], avctx->width / 2,
avctx->height / 2, p->linesize[2],
buf + offset_gu, buf_size - offset_gu);
lag_decode_arith_plane(l, p->data[1], avctx->width / 2,
avctx->height / 2, p->linesize[1],
buf + offset_bv, buf_size - offset_bv);
break;
default:
av_log(avctx, AV_LOG_ERROR,
"Unsupported Lagarith frame type: %#"PRIx8"\n", frametype);
return AVERROR_PATCHWELCOME;
}
*got_frame = 1;
return buf_size;
}
| false | FFmpeg | e981de81fea7b2c07ae178b917305184f6596430 | static int lag_decode_frame(AVCodecContext *avctx,
void *data, int *got_frame, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
unsigned int buf_size = avpkt->size;
LagarithContext *l = avctx->priv_data;
ThreadFrame frame = { .f = data };
AVFrame *const p = data;
uint8_t frametype = 0;
uint32_t offset_gu = 0, offset_bv = 0, offset_ry = 9;
uint32_t offs[4];
uint8_t *srcs[4], *dst;
int i, j, planes = 3;
int ret;
p->key_frame = 1;
frametype = buf[0];
offset_gu = AV_RL32(buf + 1);
offset_bv = AV_RL32(buf + 5);
switch (frametype) {
case FRAME_SOLID_RGBA:
avctx->pix_fmt = AV_PIX_FMT_RGB32;
case FRAME_SOLID_GRAY:
if (frametype == FRAME_SOLID_GRAY)
if (avctx->bits_per_coded_sample == 24) {
avctx->pix_fmt = AV_PIX_FMT_RGB24;
} else {
avctx->pix_fmt = AV_PIX_FMT_0RGB32;
planes = 4;
}
if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
return ret;
dst = p->data[0];
if (frametype == FRAME_SOLID_RGBA) {
for (j = 0; j < avctx->height; j++) {
for (i = 0; i < avctx->width; i++)
AV_WN32(dst + i * 4, offset_gu);
dst += p->linesize[0];
}
} else {
for (j = 0; j < avctx->height; j++) {
memset(dst, buf[1], avctx->width * planes);
dst += p->linesize[0];
}
}
break;
case FRAME_SOLID_COLOR:
if (avctx->bits_per_coded_sample == 24) {
avctx->pix_fmt = AV_PIX_FMT_RGB24;
} else {
avctx->pix_fmt = AV_PIX_FMT_RGB32;
offset_gu |= 0xFFU << 24;
}
if ((ret = ff_thread_get_buffer(avctx, &frame,0)) < 0)
return ret;
dst = p->data[0];
for (j = 0; j < avctx->height; j++) {
for (i = 0; i < avctx->width; i++)
if (avctx->bits_per_coded_sample == 24) {
AV_WB24(dst + i * 3, offset_gu);
} else {
AV_WN32(dst + i * 4, offset_gu);
}
dst += p->linesize[0];
}
break;
case FRAME_ARITH_RGBA:
avctx->pix_fmt = AV_PIX_FMT_RGB32;
planes = 4;
offset_ry += 4;
offs[3] = AV_RL32(buf + 9);
case FRAME_ARITH_RGB24:
case FRAME_U_RGB24:
if (frametype == FRAME_ARITH_RGB24 || frametype == FRAME_U_RGB24)
avctx->pix_fmt = AV_PIX_FMT_RGB24;
if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
return ret;
offs[0] = offset_bv;
offs[1] = offset_gu;
offs[2] = offset_ry;
l->rgb_stride = FFALIGN(avctx->width, 16);
av_fast_malloc(&l->rgb_planes, &l->rgb_planes_allocated,
l->rgb_stride * avctx->height * planes + 1);
if (!l->rgb_planes) {
av_log(avctx, AV_LOG_ERROR, "cannot allocate temporary buffer\n");
return AVERROR(ENOMEM);
}
for (i = 0; i < planes; i++)
srcs[i] = l->rgb_planes + (i + 1) * l->rgb_stride * avctx->height - l->rgb_stride;
for (i = 0; i < planes; i++)
if (buf_size <= offs[i]) {
av_log(avctx, AV_LOG_ERROR,
"Invalid frame offsets\n");
return AVERROR_INVALIDDATA;
}
for (i = 0; i < planes; i++)
lag_decode_arith_plane(l, srcs[i],
avctx->width, avctx->height,
-l->rgb_stride, buf + offs[i],
buf_size - offs[i]);
dst = p->data[0];
for (i = 0; i < planes; i++)
srcs[i] = l->rgb_planes + i * l->rgb_stride * avctx->height;
for (j = 0; j < avctx->height; j++) {
for (i = 0; i < avctx->width; i++) {
uint8_t r, g, b, a;
r = srcs[0][i];
g = srcs[1][i];
b = srcs[2][i];
r += g;
b += g;
if (frametype == FRAME_ARITH_RGBA) {
a = srcs[3][i];
AV_WN32(dst + i * 4, MKBETAG(a, r, g, b));
} else {
dst[i * 3 + 0] = r;
dst[i * 3 + 1] = g;
dst[i * 3 + 2] = b;
}
}
dst += p->linesize[0];
for (i = 0; i < planes; i++)
srcs[i] += l->rgb_stride;
}
break;
case FRAME_ARITH_YUY2:
avctx->pix_fmt = AV_PIX_FMT_YUV422P;
if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
return ret;
if (offset_ry >= buf_size ||
offset_gu >= buf_size ||
offset_bv >= buf_size) {
av_log(avctx, AV_LOG_ERROR,
"Invalid frame offsets\n");
return AVERROR_INVALIDDATA;
}
lag_decode_arith_plane(l, p->data[0], avctx->width, avctx->height,
p->linesize[0], buf + offset_ry,
buf_size - offset_ry);
lag_decode_arith_plane(l, p->data[1], avctx->width / 2,
avctx->height, p->linesize[1],
buf + offset_gu, buf_size - offset_gu);
lag_decode_arith_plane(l, p->data[2], avctx->width / 2,
avctx->height, p->linesize[2],
buf + offset_bv, buf_size - offset_bv);
break;
case FRAME_ARITH_YV12:
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
return ret;
if (buf_size <= offset_ry || buf_size <= offset_gu || buf_size <= offset_bv) {
return AVERROR_INVALIDDATA;
}
if (offset_ry >= buf_size ||
offset_gu >= buf_size ||
offset_bv >= buf_size) {
av_log(avctx, AV_LOG_ERROR,
"Invalid frame offsets\n");
return AVERROR_INVALIDDATA;
}
lag_decode_arith_plane(l, p->data[0], avctx->width, avctx->height,
p->linesize[0], buf + offset_ry,
buf_size - offset_ry);
lag_decode_arith_plane(l, p->data[2], avctx->width / 2,
avctx->height / 2, p->linesize[2],
buf + offset_gu, buf_size - offset_gu);
lag_decode_arith_plane(l, p->data[1], avctx->width / 2,
avctx->height / 2, p->linesize[1],
buf + offset_bv, buf_size - offset_bv);
break;
default:
av_log(avctx, AV_LOG_ERROR,
"Unsupported Lagarith frame type: %#"PRIx8"\n", frametype);
return AVERROR_PATCHWELCOME;
}
*got_frame = 1;
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;
unsigned int VAR_5 = VAR_3->size;
LagarithContext *l = VAR_0->priv_data;
ThreadFrame frame = { .f = VAR_1 };
AVFrame *const p = VAR_1;
uint8_t frametype = 0;
uint32_t offset_gu = 0, offset_bv = 0, offset_ry = 9;
uint32_t offs[4];
uint8_t *srcs[4], *dst;
int VAR_6, VAR_7, VAR_8 = 3;
int VAR_9;
p->key_frame = 1;
frametype = VAR_4[0];
offset_gu = AV_RL32(VAR_4 + 1);
offset_bv = AV_RL32(VAR_4 + 5);
switch (frametype) {
case FRAME_SOLID_RGBA:
VAR_0->pix_fmt = AV_PIX_FMT_RGB32;
case FRAME_SOLID_GRAY:
if (frametype == FRAME_SOLID_GRAY)
if (VAR_0->bits_per_coded_sample == 24) {
VAR_0->pix_fmt = AV_PIX_FMT_RGB24;
} else {
VAR_0->pix_fmt = AV_PIX_FMT_0RGB32;
VAR_8 = 4;
}
if ((VAR_9 = ff_thread_get_buffer(VAR_0, &frame, 0)) < 0)
return VAR_9;
dst = p->VAR_1[0];
if (frametype == FRAME_SOLID_RGBA) {
for (VAR_7 = 0; VAR_7 < VAR_0->height; VAR_7++) {
for (VAR_6 = 0; VAR_6 < VAR_0->width; VAR_6++)
AV_WN32(dst + VAR_6 * 4, offset_gu);
dst += p->linesize[0];
}
} else {
for (VAR_7 = 0; VAR_7 < VAR_0->height; VAR_7++) {
memset(dst, VAR_4[1], VAR_0->width * VAR_8);
dst += p->linesize[0];
}
}
break;
case FRAME_SOLID_COLOR:
if (VAR_0->bits_per_coded_sample == 24) {
VAR_0->pix_fmt = AV_PIX_FMT_RGB24;
} else {
VAR_0->pix_fmt = AV_PIX_FMT_RGB32;
offset_gu |= 0xFFU << 24;
}
if ((VAR_9 = ff_thread_get_buffer(VAR_0, &frame,0)) < 0)
return VAR_9;
dst = p->VAR_1[0];
for (VAR_7 = 0; VAR_7 < VAR_0->height; VAR_7++) {
for (VAR_6 = 0; VAR_6 < VAR_0->width; VAR_6++)
if (VAR_0->bits_per_coded_sample == 24) {
AV_WB24(dst + VAR_6 * 3, offset_gu);
} else {
AV_WN32(dst + VAR_6 * 4, offset_gu);
}
dst += p->linesize[0];
}
break;
case FRAME_ARITH_RGBA:
VAR_0->pix_fmt = AV_PIX_FMT_RGB32;
VAR_8 = 4;
offset_ry += 4;
offs[3] = AV_RL32(VAR_4 + 9);
case FRAME_ARITH_RGB24:
case FRAME_U_RGB24:
if (frametype == FRAME_ARITH_RGB24 || frametype == FRAME_U_RGB24)
VAR_0->pix_fmt = AV_PIX_FMT_RGB24;
if ((VAR_9 = ff_thread_get_buffer(VAR_0, &frame, 0)) < 0)
return VAR_9;
offs[0] = offset_bv;
offs[1] = offset_gu;
offs[2] = offset_ry;
l->rgb_stride = FFALIGN(VAR_0->width, 16);
av_fast_malloc(&l->rgb_planes, &l->rgb_planes_allocated,
l->rgb_stride * VAR_0->height * VAR_8 + 1);
if (!l->rgb_planes) {
av_log(VAR_0, AV_LOG_ERROR, "cannot allocate temporary buffer\n");
return AVERROR(ENOMEM);
}
for (VAR_6 = 0; VAR_6 < VAR_8; VAR_6++)
srcs[VAR_6] = l->rgb_planes + (VAR_6 + 1) * l->rgb_stride * VAR_0->height - l->rgb_stride;
for (VAR_6 = 0; VAR_6 < VAR_8; VAR_6++)
if (VAR_5 <= offs[VAR_6]) {
av_log(VAR_0, AV_LOG_ERROR,
"Invalid frame offsets\n");
return AVERROR_INVALIDDATA;
}
for (VAR_6 = 0; VAR_6 < VAR_8; VAR_6++)
lag_decode_arith_plane(l, srcs[VAR_6],
VAR_0->width, VAR_0->height,
-l->rgb_stride, VAR_4 + offs[VAR_6],
VAR_5 - offs[VAR_6]);
dst = p->VAR_1[0];
for (VAR_6 = 0; VAR_6 < VAR_8; VAR_6++)
srcs[VAR_6] = l->rgb_planes + VAR_6 * l->rgb_stride * VAR_0->height;
for (VAR_7 = 0; VAR_7 < VAR_0->height; VAR_7++) {
for (VAR_6 = 0; VAR_6 < VAR_0->width; VAR_6++) {
uint8_t r, g, b, a;
r = srcs[0][VAR_6];
g = srcs[1][VAR_6];
b = srcs[2][VAR_6];
r += g;
b += g;
if (frametype == FRAME_ARITH_RGBA) {
a = srcs[3][VAR_6];
AV_WN32(dst + VAR_6 * 4, MKBETAG(a, r, g, b));
} else {
dst[VAR_6 * 3 + 0] = r;
dst[VAR_6 * 3 + 1] = g;
dst[VAR_6 * 3 + 2] = b;
}
}
dst += p->linesize[0];
for (VAR_6 = 0; VAR_6 < VAR_8; VAR_6++)
srcs[VAR_6] += l->rgb_stride;
}
break;
case FRAME_ARITH_YUY2:
VAR_0->pix_fmt = AV_PIX_FMT_YUV422P;
if ((VAR_9 = ff_thread_get_buffer(VAR_0, &frame, 0)) < 0)
return VAR_9;
if (offset_ry >= VAR_5 ||
offset_gu >= VAR_5 ||
offset_bv >= VAR_5) {
av_log(VAR_0, AV_LOG_ERROR,
"Invalid frame offsets\n");
return AVERROR_INVALIDDATA;
}
lag_decode_arith_plane(l, p->VAR_1[0], VAR_0->width, VAR_0->height,
p->linesize[0], VAR_4 + offset_ry,
VAR_5 - offset_ry);
lag_decode_arith_plane(l, p->VAR_1[1], VAR_0->width / 2,
VAR_0->height, p->linesize[1],
VAR_4 + offset_gu, VAR_5 - offset_gu);
lag_decode_arith_plane(l, p->VAR_1[2], VAR_0->width / 2,
VAR_0->height, p->linesize[2],
VAR_4 + offset_bv, VAR_5 - offset_bv);
break;
case FRAME_ARITH_YV12:
VAR_0->pix_fmt = AV_PIX_FMT_YUV420P;
if ((VAR_9 = ff_thread_get_buffer(VAR_0, &frame, 0)) < 0)
return VAR_9;
if (VAR_5 <= offset_ry || VAR_5 <= offset_gu || VAR_5 <= offset_bv) {
return AVERROR_INVALIDDATA;
}
if (offset_ry >= VAR_5 ||
offset_gu >= VAR_5 ||
offset_bv >= VAR_5) {
av_log(VAR_0, AV_LOG_ERROR,
"Invalid frame offsets\n");
return AVERROR_INVALIDDATA;
}
lag_decode_arith_plane(l, p->VAR_1[0], VAR_0->width, VAR_0->height,
p->linesize[0], VAR_4 + offset_ry,
VAR_5 - offset_ry);
lag_decode_arith_plane(l, p->VAR_1[2], VAR_0->width / 2,
VAR_0->height / 2, p->linesize[2],
VAR_4 + offset_gu, VAR_5 - offset_gu);
lag_decode_arith_plane(l, p->VAR_1[1], VAR_0->width / 2,
VAR_0->height / 2, p->linesize[1],
VAR_4 + offset_bv, VAR_5 - offset_bv);
break;
default:
av_log(VAR_0, AV_LOG_ERROR,
"Unsupported Lagarith frame type: %#"PRIx8"\n", frametype);
return AVERROR_PATCHWELCOME;
}
*VAR_2 = 1;
return VAR_5;
}
| [
"static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2, AVPacket *VAR_3)\n{",
"const uint8_t *VAR_4 = VAR_3->VAR_1;",
"unsigned int VAR_5 = VAR_3->size;",
"LagarithContext *l = VAR_0->priv_data;",
"ThreadFrame frame = { .f = VAR_1 };",
"AVFrame *const p = VAR_1;",
"uint8_t frametype = 0;",
"uint32_t offset_gu = 0, offset_bv = 0, offset_ry = 9;",
"uint32_t offs[4];",
"uint8_t *srcs[4], *dst;",
"int VAR_6, VAR_7, VAR_8 = 3;",
"int VAR_9;",
"p->key_frame = 1;",
"frametype = VAR_4[0];",
"offset_gu = AV_RL32(VAR_4 + 1);",
"offset_bv = AV_RL32(VAR_4 + 5);",
"switch (frametype) {",
"case FRAME_SOLID_RGBA:\nVAR_0->pix_fmt = AV_PIX_FMT_RGB32;",
"case FRAME_SOLID_GRAY:\nif (frametype == FRAME_SOLID_GRAY)\nif (VAR_0->bits_per_coded_sample == 24) {",
"VAR_0->pix_fmt = AV_PIX_FMT_RGB24;",
"} else {",
"VAR_0->pix_fmt = AV_PIX_FMT_0RGB32;",
"VAR_8 = 4;",
"}",
"if ((VAR_9 = ff_thread_get_buffer(VAR_0, &frame, 0)) < 0)\nreturn VAR_9;",
"dst = p->VAR_1[0];",
"if (frametype == FRAME_SOLID_RGBA) {",
"for (VAR_7 = 0; VAR_7 < VAR_0->height; VAR_7++) {",
"for (VAR_6 = 0; VAR_6 < VAR_0->width; VAR_6++)",
"AV_WN32(dst + VAR_6 * 4, offset_gu);",
"dst += p->linesize[0];",
"}",
"} else {",
"for (VAR_7 = 0; VAR_7 < VAR_0->height; VAR_7++) {",
"memset(dst, VAR_4[1], VAR_0->width * VAR_8);",
"dst += p->linesize[0];",
"}",
"}",
"break;",
"case FRAME_SOLID_COLOR:\nif (VAR_0->bits_per_coded_sample == 24) {",
"VAR_0->pix_fmt = AV_PIX_FMT_RGB24;",
"} else {",
"VAR_0->pix_fmt = AV_PIX_FMT_RGB32;",
"offset_gu |= 0xFFU << 24;",
"}",
"if ((VAR_9 = ff_thread_get_buffer(VAR_0, &frame,0)) < 0)\nreturn VAR_9;",
"dst = p->VAR_1[0];",
"for (VAR_7 = 0; VAR_7 < VAR_0->height; VAR_7++) {",
"for (VAR_6 = 0; VAR_6 < VAR_0->width; VAR_6++)",
"if (VAR_0->bits_per_coded_sample == 24) {",
"AV_WB24(dst + VAR_6 * 3, offset_gu);",
"} else {",
"AV_WN32(dst + VAR_6 * 4, offset_gu);",
"}",
"dst += p->linesize[0];",
"}",
"break;",
"case FRAME_ARITH_RGBA:\nVAR_0->pix_fmt = AV_PIX_FMT_RGB32;",
"VAR_8 = 4;",
"offset_ry += 4;",
"offs[3] = AV_RL32(VAR_4 + 9);",
"case FRAME_ARITH_RGB24:\ncase FRAME_U_RGB24:\nif (frametype == FRAME_ARITH_RGB24 || frametype == FRAME_U_RGB24)\nVAR_0->pix_fmt = AV_PIX_FMT_RGB24;",
"if ((VAR_9 = ff_thread_get_buffer(VAR_0, &frame, 0)) < 0)\nreturn VAR_9;",
"offs[0] = offset_bv;",
"offs[1] = offset_gu;",
"offs[2] = offset_ry;",
"l->rgb_stride = FFALIGN(VAR_0->width, 16);",
"av_fast_malloc(&l->rgb_planes, &l->rgb_planes_allocated,\nl->rgb_stride * VAR_0->height * VAR_8 + 1);",
"if (!l->rgb_planes) {",
"av_log(VAR_0, AV_LOG_ERROR, \"cannot allocate temporary buffer\\n\");",
"return AVERROR(ENOMEM);",
"}",
"for (VAR_6 = 0; VAR_6 < VAR_8; VAR_6++)",
"srcs[VAR_6] = l->rgb_planes + (VAR_6 + 1) * l->rgb_stride * VAR_0->height - l->rgb_stride;",
"for (VAR_6 = 0; VAR_6 < VAR_8; VAR_6++)",
"if (VAR_5 <= offs[VAR_6]) {",
"av_log(VAR_0, AV_LOG_ERROR,\n\"Invalid frame offsets\\n\");",
"return AVERROR_INVALIDDATA;",
"}",
"for (VAR_6 = 0; VAR_6 < VAR_8; VAR_6++)",
"lag_decode_arith_plane(l, srcs[VAR_6],\nVAR_0->width, VAR_0->height,\n-l->rgb_stride, VAR_4 + offs[VAR_6],\nVAR_5 - offs[VAR_6]);",
"dst = p->VAR_1[0];",
"for (VAR_6 = 0; VAR_6 < VAR_8; VAR_6++)",
"srcs[VAR_6] = l->rgb_planes + VAR_6 * l->rgb_stride * VAR_0->height;",
"for (VAR_7 = 0; VAR_7 < VAR_0->height; VAR_7++) {",
"for (VAR_6 = 0; VAR_6 < VAR_0->width; VAR_6++) {",
"uint8_t r, g, b, a;",
"r = srcs[0][VAR_6];",
"g = srcs[1][VAR_6];",
"b = srcs[2][VAR_6];",
"r += g;",
"b += g;",
"if (frametype == FRAME_ARITH_RGBA) {",
"a = srcs[3][VAR_6];",
"AV_WN32(dst + VAR_6 * 4, MKBETAG(a, r, g, b));",
"} else {",
"dst[VAR_6 * 3 + 0] = r;",
"dst[VAR_6 * 3 + 1] = g;",
"dst[VAR_6 * 3 + 2] = b;",
"}",
"}",
"dst += p->linesize[0];",
"for (VAR_6 = 0; VAR_6 < VAR_8; VAR_6++)",
"srcs[VAR_6] += l->rgb_stride;",
"}",
"break;",
"case FRAME_ARITH_YUY2:\nVAR_0->pix_fmt = AV_PIX_FMT_YUV422P;",
"if ((VAR_9 = ff_thread_get_buffer(VAR_0, &frame, 0)) < 0)\nreturn VAR_9;",
"if (offset_ry >= VAR_5 ||\noffset_gu >= VAR_5 ||\noffset_bv >= VAR_5) {",
"av_log(VAR_0, AV_LOG_ERROR,\n\"Invalid frame offsets\\n\");",
"return AVERROR_INVALIDDATA;",
"}",
"lag_decode_arith_plane(l, p->VAR_1[0], VAR_0->width, VAR_0->height,\np->linesize[0], VAR_4 + offset_ry,\nVAR_5 - offset_ry);",
"lag_decode_arith_plane(l, p->VAR_1[1], VAR_0->width / 2,\nVAR_0->height, p->linesize[1],\nVAR_4 + offset_gu, VAR_5 - offset_gu);",
"lag_decode_arith_plane(l, p->VAR_1[2], VAR_0->width / 2,\nVAR_0->height, p->linesize[2],\nVAR_4 + offset_bv, VAR_5 - offset_bv);",
"break;",
"case FRAME_ARITH_YV12:\nVAR_0->pix_fmt = AV_PIX_FMT_YUV420P;",
"if ((VAR_9 = ff_thread_get_buffer(VAR_0, &frame, 0)) < 0)\nreturn VAR_9;",
"if (VAR_5 <= offset_ry || VAR_5 <= offset_gu || VAR_5 <= offset_bv) {",
"return AVERROR_INVALIDDATA;",
"}",
"if (offset_ry >= VAR_5 ||\noffset_gu >= VAR_5 ||\noffset_bv >= VAR_5) {",
"av_log(VAR_0, AV_LOG_ERROR,\n\"Invalid frame offsets\\n\");",
"return AVERROR_INVALIDDATA;",
"}",
"lag_decode_arith_plane(l, p->VAR_1[0], VAR_0->width, VAR_0->height,\np->linesize[0], VAR_4 + offset_ry,\nVAR_5 - offset_ry);",
"lag_decode_arith_plane(l, p->VAR_1[2], VAR_0->width / 2,\nVAR_0->height / 2, p->linesize[2],\nVAR_4 + offset_gu, VAR_5 - offset_gu);",
"lag_decode_arith_plane(l, p->VAR_1[1], VAR_0->width / 2,\nVAR_0->height / 2, p->linesize[1],\nVAR_4 + offset_bv, VAR_5 - offset_bv);",
"break;",
"default:\nav_log(VAR_0, AV_LOG_ERROR,\n\"Unsupported Lagarith frame type: %#\"PRIx8\"\\n\", frametype);",
"return AVERROR_PATCHWELCOME;",
"}",
"*VAR_2 = 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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
31
],
[
35
],
[
39
],
[
41
],
[
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
],
[
111
],
[
113
],
[
115
],
[
119,
121
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147,
149
],
[
151
],
[
153
],
[
155
],
[
157,
159,
161,
163
],
[
167,
169
],
[
173
],
[
175
],
[
177
],
[
181
],
[
183,
185
],
[
187
],
[
189
],
[
191
],
[
193
],
[
195
],
[
197
],
[
199
],
[
201
],
[
203,
205
],
[
207
],
[
209
],
[
213
],
[
215,
217,
219,
221
],
[
223
],
[
225
],
[
227
],
[
229
],
[
231
],
[
233
],
[
235
],
[
237
],
[
239
],
[
241
],
[
243
],
[
245
],
[
247
],
[
249
],
[
251
],
[
253
],
[
255
],
[
257
],
[
259
],
[
261
],
[
263
],
[
265
],
[
267
],
[
269
],
[
271
],
[
273,
275
],
[
279,
281
],
[
285,
287,
289
],
[
291,
293
],
[
295
],
[
297
],
[
301,
303,
305
],
[
307,
309,
311
],
[
313,
315,
317
],
[
319
],
[
321,
323
],
[
327,
329
],
[
331
],
[
333
],
[
335
],
[
339,
341,
343
],
[
345,
347
],
[
349
],
[
351
],
[
355,
357,
359
],
[
361,
363,
365
],
[
367,
369,
371
],
[
373
],
[
375,
377,
379
],
[
381
],
[
383
],
[
387
],
[
391
],
[
393
]
]
|
12,387 | static int line_in_init (HWVoiceIn *hw, struct audsettings *as)
{
SpiceVoiceIn *in = container_of (hw, SpiceVoiceIn, hw);
struct audsettings settings;
#if SPICE_INTERFACE_RECORD_MAJOR > 2 || SPICE_INTERFACE_RECORD_MINOR >= 3
settings.freq = spice_server_get_best_record_rate(NULL);
#else
settings.freq = SPICE_INTERFACE_RECORD_FREQ;
#endif
settings.nchannels = SPICE_INTERFACE_RECORD_CHAN;
settings.fmt = AUD_FMT_S16;
settings.endianness = AUDIO_HOST_ENDIANNESS;
audio_pcm_init_info (&hw->info, &settings);
hw->samples = LINE_IN_SAMPLES;
in->active = 0;
in->sin.base.sif = &record_sif.base;
qemu_spice_add_interface (&in->sin.base);
#if SPICE_INTERFACE_RECORD_MAJOR > 2 || SPICE_INTERFACE_RECORD_MINOR >= 3
spice_server_set_record_rate(&in->sin, settings.freq);
#endif
return 0;
}
| true | qemu | 5706db1deb061ee9affdcea81e59c4c2cad7c41e | static int line_in_init (HWVoiceIn *hw, struct audsettings *as)
{
SpiceVoiceIn *in = container_of (hw, SpiceVoiceIn, hw);
struct audsettings settings;
#if SPICE_INTERFACE_RECORD_MAJOR > 2 || SPICE_INTERFACE_RECORD_MINOR >= 3
settings.freq = spice_server_get_best_record_rate(NULL);
#else
settings.freq = SPICE_INTERFACE_RECORD_FREQ;
#endif
settings.nchannels = SPICE_INTERFACE_RECORD_CHAN;
settings.fmt = AUD_FMT_S16;
settings.endianness = AUDIO_HOST_ENDIANNESS;
audio_pcm_init_info (&hw->info, &settings);
hw->samples = LINE_IN_SAMPLES;
in->active = 0;
in->sin.base.sif = &record_sif.base;
qemu_spice_add_interface (&in->sin.base);
#if SPICE_INTERFACE_RECORD_MAJOR > 2 || SPICE_INTERFACE_RECORD_MINOR >= 3
spice_server_set_record_rate(&in->sin, settings.freq);
#endif
return 0;
}
| {
"code": [
"static int line_in_init (HWVoiceIn *hw, struct audsettings *as)"
],
"line_no": [
1
]
} | static int FUNC_0 (HWVoiceIn *VAR_0, struct audsettings *VAR_1)
{
SpiceVoiceIn *in = container_of (VAR_0, SpiceVoiceIn, VAR_0);
struct audsettings VAR_2;
#if SPICE_INTERFACE_RECORD_MAJOR > 2 || SPICE_INTERFACE_RECORD_MINOR >= 3
VAR_2.freq = spice_server_get_best_record_rate(NULL);
#else
VAR_2.freq = SPICE_INTERFACE_RECORD_FREQ;
#endif
VAR_2.nchannels = SPICE_INTERFACE_RECORD_CHAN;
VAR_2.fmt = AUD_FMT_S16;
VAR_2.endianness = AUDIO_HOST_ENDIANNESS;
audio_pcm_init_info (&VAR_0->info, &VAR_2);
VAR_0->samples = LINE_IN_SAMPLES;
in->active = 0;
in->sin.base.sif = &record_sif.base;
qemu_spice_add_interface (&in->sin.base);
#if SPICE_INTERFACE_RECORD_MAJOR > 2 || SPICE_INTERFACE_RECORD_MINOR >= 3
spice_server_set_record_rate(&in->sin, VAR_2.freq);
#endif
return 0;
}
| [
"static int FUNC_0 (HWVoiceIn *VAR_0, struct audsettings *VAR_1)\n{",
"SpiceVoiceIn *in = container_of (VAR_0, SpiceVoiceIn, VAR_0);",
"struct audsettings VAR_2;",
"#if SPICE_INTERFACE_RECORD_MAJOR > 2 || SPICE_INTERFACE_RECORD_MINOR >= 3\nVAR_2.freq = spice_server_get_best_record_rate(NULL);",
"#else\nVAR_2.freq = SPICE_INTERFACE_RECORD_FREQ;",
"#endif\nVAR_2.nchannels = SPICE_INTERFACE_RECORD_CHAN;",
"VAR_2.fmt = AUD_FMT_S16;",
"VAR_2.endianness = AUDIO_HOST_ENDIANNESS;",
"audio_pcm_init_info (&VAR_0->info, &VAR_2);",
"VAR_0->samples = LINE_IN_SAMPLES;",
"in->active = 0;",
"in->sin.base.sif = &record_sif.base;",
"qemu_spice_add_interface (&in->sin.base);",
"#if SPICE_INTERFACE_RECORD_MAJOR > 2 || SPICE_INTERFACE_RECORD_MINOR >= 3\nspice_server_set_record_rate(&in->sin, VAR_2.freq);",
"#endif\nreturn 0;",
"}"
]
| [
1,
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
],
[
29
],
[
31
],
[
33
],
[
37
],
[
39
],
[
41,
43
],
[
45,
47
],
[
49
]
]
|
12,388 | static void virtio_queue_guest_notifier_read(EventNotifier *n)
{
VirtQueue *vq = container_of(n, VirtQueue, guest_notifier);
if (event_notifier_test_and_clear(n)) {
virtio_irq(vq);
}
}
| true | qemu | 83d768b5640946b7da55ce8335509df297e2c7cd | static void virtio_queue_guest_notifier_read(EventNotifier *n)
{
VirtQueue *vq = container_of(n, VirtQueue, guest_notifier);
if (event_notifier_test_and_clear(n)) {
virtio_irq(vq);
}
}
| {
"code": [
" virtio_irq(vq);"
],
"line_no": [
9
]
} | static void FUNC_0(EventNotifier *VAR_0)
{
VirtQueue *vq = container_of(VAR_0, VirtQueue, guest_notifier);
if (event_notifier_test_and_clear(VAR_0)) {
virtio_irq(vq);
}
}
| [
"static void FUNC_0(EventNotifier *VAR_0)\n{",
"VirtQueue *vq = container_of(VAR_0, VirtQueue, guest_notifier);",
"if (event_notifier_test_and_clear(VAR_0)) {",
"virtio_irq(vq);",
"}",
"}"
]
| [
0,
0,
0,
1,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
]
]
|
12,389 | int spapr_tce_dma_zero(VIOsPAPRDevice *dev, uint64_t taddr, uint32_t size)
{
/* FIXME: allocating a temp buffer is nasty, but just stepping
* through writing zeroes is awkward. This will do for now. */
uint8_t zeroes[size];
#ifdef DEBUG_TCE
fprintf(stderr, "spapr_tce_dma_zero taddr=0x%llx size=0x%x\n",
(unsigned long long)taddr, size);
#endif
memset(zeroes, 0, size);
return spapr_tce_dma_write(dev, taddr, zeroes, size);
}
| true | qemu | ad0ebb91cd8b5fdc4a583b03645677771f420a46 | int spapr_tce_dma_zero(VIOsPAPRDevice *dev, uint64_t taddr, uint32_t size)
{
uint8_t zeroes[size];
#ifdef DEBUG_TCE
fprintf(stderr, "spapr_tce_dma_zero taddr=0x%llx size=0x%x\n",
(unsigned long long)taddr, size);
#endif
memset(zeroes, 0, size);
return spapr_tce_dma_write(dev, taddr, zeroes, size);
}
| {
"code": [
"#ifdef DEBUG_TCE",
"#endif",
"#ifdef DEBUG_TCE",
"#endif",
"#ifdef DEBUG_TCE",
" (unsigned long long)taddr, size);",
"#endif",
"#ifdef DEBUG_TCE",
"#endif",
"#ifdef DEBUG_TCE",
"#endif",
"int spapr_tce_dma_zero(VIOsPAPRDevice *dev, uint64_t taddr, uint32_t size)",
" uint8_t zeroes[size];",
"#ifdef DEBUG_TCE",
" fprintf(stderr, \"spapr_tce_dma_zero taddr=0x%llx size=0x%x\\n\",",
" (unsigned long long)taddr, size);",
"#endif",
" memset(zeroes, 0, size);",
" return spapr_tce_dma_write(dev, taddr, zeroes, size);",
"#ifdef DEBUG_TCE",
" (unsigned long long)taddr, size);",
"#endif",
"#ifdef DEBUG_TCE",
"#endif",
"#ifdef DEBUG_TCE",
"#endif"
],
"line_no": [
13,
19,
13,
19,
13,
17,
19,
13,
19,
13,
19,
1,
9,
13,
15,
17,
19,
23,
25,
13,
17,
19,
13,
19,
13,
19
]
} | int FUNC_0(VIOsPAPRDevice *VAR_0, uint64_t VAR_1, uint32_t VAR_2)
{
uint8_t zeroes[VAR_2];
#ifdef DEBUG_TCE
fprintf(stderr, "FUNC_0 VAR_1=0x%llx VAR_2=0x%x\n",
(unsigned long long)VAR_1, VAR_2);
#endif
memset(zeroes, 0, VAR_2);
return spapr_tce_dma_write(VAR_0, VAR_1, zeroes, VAR_2);
}
| [
"int FUNC_0(VIOsPAPRDevice *VAR_0, uint64_t VAR_1, uint32_t VAR_2)\n{",
"uint8_t zeroes[VAR_2];",
"#ifdef DEBUG_TCE\nfprintf(stderr, \"FUNC_0 VAR_1=0x%llx VAR_2=0x%x\\n\",\n(unsigned long long)VAR_1, VAR_2);",
"#endif\nmemset(zeroes, 0, VAR_2);",
"return spapr_tce_dma_write(VAR_0, VAR_1, zeroes, VAR_2);",
"}"
]
| [
1,
1,
1,
1,
1,
0
]
| [
[
1,
3
],
[
9
],
[
13,
15,
17
],
[
19,
23
],
[
25
],
[
27
]
]
|
12,390 | static void do_video_out(AVFormatContext *s,
AVOutputStream *ost,
AVInputStream *ist,
AVPicture *picture1)
{
int n1, n2, nb, i, ret, frame_number;
AVPicture *picture, *picture2, *pict;
AVPicture picture_tmp1, picture_tmp2;
UINT8 video_buffer[128*1024];
UINT8 *buf = NULL, *buf1 = NULL;
AVCodecContext *enc, *dec;
enc = &ost->st->codec;
dec = &ist->st->codec;
frame_number = ist->frame_number;
/* first drop frame if needed */
n1 = ((INT64)frame_number * enc->frame_rate) / dec->frame_rate;
n2 = (((INT64)frame_number + 1) * enc->frame_rate) / dec->frame_rate;
nb = n2 - n1;
if (nb <= 0)
return;
/* deinterlace : must be done before any resize */
if (do_deinterlace) {
int size;
/* create temporary picture */
size = avpicture_get_size(dec->pix_fmt, dec->width, dec->height);
buf1 = malloc(size);
if (!buf1)
return;
picture2 = &picture_tmp2;
avpicture_fill(picture2, buf1, dec->pix_fmt, dec->width, dec->height);
if (avpicture_deinterlace(picture2, picture1,
dec->pix_fmt, dec->width, dec->height) < 0) {
/* if error, do not deinterlace */
free(buf1);
buf1 = NULL;
picture2 = picture1;
}
} else {
picture2 = picture1;
}
/* convert pixel format if needed */
if (enc->pix_fmt != dec->pix_fmt) {
int size;
/* create temporary picture */
size = avpicture_get_size(enc->pix_fmt, dec->width, dec->height);
buf = malloc(size);
if (!buf)
return;
pict = &picture_tmp1;
avpicture_fill(pict, buf, enc->pix_fmt, dec->width, dec->height);
if (img_convert(pict, enc->pix_fmt,
picture2, dec->pix_fmt,
dec->width, dec->height) < 0) {
fprintf(stderr, "pixel format conversion not handled\n");
goto the_end;
}
} else {
pict = picture2;
}
/* XXX: resampling could be done before raw format convertion in
some cases to go faster */
/* XXX: only works for YUV420P */
if (ost->video_resample) {
picture = &ost->pict_tmp;
img_resample(ost->img_resample_ctx, picture, pict);
} else {
picture = pict;
}
/* duplicates frame if needed */
/* XXX: pb because no interleaving */
for(i=0;i<nb;i++) {
if (enc->codec_id != CODEC_ID_RAWVIDEO) {
/* handles sameq here. This is not correct because it may
not be a global option */
if (same_quality) {
enc->quality = dec->quality;
}
ret = avcodec_encode_video(enc,
video_buffer, sizeof(video_buffer),
picture);
s->format->write_packet(s, ost->index, video_buffer, ret);
} else {
write_picture(s, ost->index, picture, enc->pix_fmt, enc->width, enc->height);
}
}
the_end:
if (buf)
free(buf);
if (buf1)
free(buf1);
}
| true | FFmpeg | 544286b3d39365b30298ae07e66a755200b0895c | static void do_video_out(AVFormatContext *s,
AVOutputStream *ost,
AVInputStream *ist,
AVPicture *picture1)
{
int n1, n2, nb, i, ret, frame_number;
AVPicture *picture, *picture2, *pict;
AVPicture picture_tmp1, picture_tmp2;
UINT8 video_buffer[128*1024];
UINT8 *buf = NULL, *buf1 = NULL;
AVCodecContext *enc, *dec;
enc = &ost->st->codec;
dec = &ist->st->codec;
frame_number = ist->frame_number;
n1 = ((INT64)frame_number * enc->frame_rate) / dec->frame_rate;
n2 = (((INT64)frame_number + 1) * enc->frame_rate) / dec->frame_rate;
nb = n2 - n1;
if (nb <= 0)
return;
if (do_deinterlace) {
int size;
size = avpicture_get_size(dec->pix_fmt, dec->width, dec->height);
buf1 = malloc(size);
if (!buf1)
return;
picture2 = &picture_tmp2;
avpicture_fill(picture2, buf1, dec->pix_fmt, dec->width, dec->height);
if (avpicture_deinterlace(picture2, picture1,
dec->pix_fmt, dec->width, dec->height) < 0) {
free(buf1);
buf1 = NULL;
picture2 = picture1;
}
} else {
picture2 = picture1;
}
if (enc->pix_fmt != dec->pix_fmt) {
int size;
size = avpicture_get_size(enc->pix_fmt, dec->width, dec->height);
buf = malloc(size);
if (!buf)
return;
pict = &picture_tmp1;
avpicture_fill(pict, buf, enc->pix_fmt, dec->width, dec->height);
if (img_convert(pict, enc->pix_fmt,
picture2, dec->pix_fmt,
dec->width, dec->height) < 0) {
fprintf(stderr, "pixel format conversion not handled\n");
goto the_end;
}
} else {
pict = picture2;
}
if (ost->video_resample) {
picture = &ost->pict_tmp;
img_resample(ost->img_resample_ctx, picture, pict);
} else {
picture = pict;
}
for(i=0;i<nb;i++) {
if (enc->codec_id != CODEC_ID_RAWVIDEO) {
if (same_quality) {
enc->quality = dec->quality;
}
ret = avcodec_encode_video(enc,
video_buffer, sizeof(video_buffer),
picture);
s->format->write_packet(s, ost->index, video_buffer, ret);
} else {
write_picture(s, ost->index, picture, enc->pix_fmt, enc->width, enc->height);
}
}
the_end:
if (buf)
free(buf);
if (buf1)
free(buf1);
}
| {
"code": [
" UINT8 video_buffer[128*1024];",
" UINT8 video_buffer[128*1024];"
],
"line_no": [
17,
17
]
} | static void FUNC_0(AVFormatContext *VAR_0,
AVOutputStream *VAR_1,
AVInputStream *VAR_2,
AVPicture *VAR_3)
{
int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;
AVPicture *picture, *picture2, *pict;
AVPicture picture_tmp1, picture_tmp2;
UINT8 video_buffer[128*1024];
UINT8 *buf = NULL, *buf1 = NULL;
AVCodecContext *enc, *dec;
enc = &VAR_1->st->codec;
dec = &VAR_2->st->codec;
VAR_9 = VAR_2->VAR_9;
VAR_4 = ((INT64)VAR_9 * enc->frame_rate) / dec->frame_rate;
VAR_5 = (((INT64)VAR_9 + 1) * enc->frame_rate) / dec->frame_rate;
VAR_6 = VAR_5 - VAR_4;
if (VAR_6 <= 0)
return;
if (do_deinterlace) {
int VAR_11;
VAR_11 = avpicture_get_size(dec->pix_fmt, dec->width, dec->height);
buf1 = malloc(VAR_11);
if (!buf1)
return;
picture2 = &picture_tmp2;
avpicture_fill(picture2, buf1, dec->pix_fmt, dec->width, dec->height);
if (avpicture_deinterlace(picture2, VAR_3,
dec->pix_fmt, dec->width, dec->height) < 0) {
free(buf1);
buf1 = NULL;
picture2 = VAR_3;
}
} else {
picture2 = VAR_3;
}
if (enc->pix_fmt != dec->pix_fmt) {
int VAR_11;
VAR_11 = avpicture_get_size(enc->pix_fmt, dec->width, dec->height);
buf = malloc(VAR_11);
if (!buf)
return;
pict = &picture_tmp1;
avpicture_fill(pict, buf, enc->pix_fmt, dec->width, dec->height);
if (img_convert(pict, enc->pix_fmt,
picture2, dec->pix_fmt,
dec->width, dec->height) < 0) {
fprintf(stderr, "pixel format conversion not handled\n");
goto the_end;
}
} else {
pict = picture2;
}
if (VAR_1->video_resample) {
picture = &VAR_1->pict_tmp;
img_resample(VAR_1->img_resample_ctx, picture, pict);
} else {
picture = pict;
}
for(VAR_7=0;VAR_7<VAR_6;VAR_7++) {
if (enc->codec_id != CODEC_ID_RAWVIDEO) {
if (same_quality) {
enc->quality = dec->quality;
}
VAR_8 = avcodec_encode_video(enc,
video_buffer, sizeof(video_buffer),
picture);
VAR_0->format->write_packet(VAR_0, VAR_1->index, video_buffer, VAR_8);
} else {
write_picture(VAR_0, VAR_1->index, picture, enc->pix_fmt, enc->width, enc->height);
}
}
the_end:
if (buf)
free(buf);
if (buf1)
free(buf1);
}
| [
"static void FUNC_0(AVFormatContext *VAR_0,\nAVOutputStream *VAR_1,\nAVInputStream *VAR_2,\nAVPicture *VAR_3)\n{",
"int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;",
"AVPicture *picture, *picture2, *pict;",
"AVPicture picture_tmp1, picture_tmp2;",
"UINT8 video_buffer[128*1024];",
"UINT8 *buf = NULL, *buf1 = NULL;",
"AVCodecContext *enc, *dec;",
"enc = &VAR_1->st->codec;",
"dec = &VAR_2->st->codec;",
"VAR_9 = VAR_2->VAR_9;",
"VAR_4 = ((INT64)VAR_9 * enc->frame_rate) / dec->frame_rate;",
"VAR_5 = (((INT64)VAR_9 + 1) * enc->frame_rate) / dec->frame_rate;",
"VAR_6 = VAR_5 - VAR_4;",
"if (VAR_6 <= 0)\nreturn;",
"if (do_deinterlace) {",
"int VAR_11;",
"VAR_11 = avpicture_get_size(dec->pix_fmt, dec->width, dec->height);",
"buf1 = malloc(VAR_11);",
"if (!buf1)\nreturn;",
"picture2 = &picture_tmp2;",
"avpicture_fill(picture2, buf1, dec->pix_fmt, dec->width, dec->height);",
"if (avpicture_deinterlace(picture2, VAR_3,\ndec->pix_fmt, dec->width, dec->height) < 0) {",
"free(buf1);",
"buf1 = NULL;",
"picture2 = VAR_3;",
"}",
"} else {",
"picture2 = VAR_3;",
"}",
"if (enc->pix_fmt != dec->pix_fmt) {",
"int VAR_11;",
"VAR_11 = avpicture_get_size(enc->pix_fmt, dec->width, dec->height);",
"buf = malloc(VAR_11);",
"if (!buf)\nreturn;",
"pict = &picture_tmp1;",
"avpicture_fill(pict, buf, enc->pix_fmt, dec->width, dec->height);",
"if (img_convert(pict, enc->pix_fmt,\npicture2, dec->pix_fmt,\ndec->width, dec->height) < 0) {",
"fprintf(stderr, \"pixel format conversion not handled\\n\");",
"goto the_end;",
"}",
"} else {",
"pict = picture2;",
"}",
"if (VAR_1->video_resample) {",
"picture = &VAR_1->pict_tmp;",
"img_resample(VAR_1->img_resample_ctx, picture, pict);",
"} else {",
"picture = pict;",
"}",
"for(VAR_7=0;VAR_7<VAR_6;VAR_7++) {",
"if (enc->codec_id != CODEC_ID_RAWVIDEO) {",
"if (same_quality) {",
"enc->quality = dec->quality;",
"}",
"VAR_8 = avcodec_encode_video(enc,\nvideo_buffer, sizeof(video_buffer),\npicture);",
"VAR_0->format->write_packet(VAR_0, VAR_1->index, video_buffer, VAR_8);",
"} else {",
"write_picture(VAR_0, VAR_1->index, picture, enc->pix_fmt, enc->width, enc->height);",
"}",
"}",
"the_end:\nif (buf)\nfree(buf);",
"if (buf1)\nfree(buf1);",
"}"
]
| [
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
]
| [
[
1,
3,
5,
7,
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
25
],
[
27
],
[
31
],
[
35
],
[
37
],
[
39
],
[
41,
43
],
[
49
],
[
51
],
[
57
],
[
59
],
[
61,
63
],
[
67
],
[
69
],
[
73,
75
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
97
],
[
99
],
[
105
],
[
107
],
[
109,
111
],
[
113
],
[
115
],
[
119,
121,
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
145
],
[
147
],
[
149
],
[
151
],
[
153
],
[
155
],
[
163
],
[
165
],
[
171
],
[
173
],
[
175
],
[
177,
179,
181
],
[
183
],
[
185
],
[
187
],
[
189
],
[
191
],
[
193,
195,
197
],
[
199,
201
],
[
203
]
]
|
12,391 | static void test_visitor_in_fuzz(TestInputVisitorData *data,
const void *unused)
{
int64_t ires;
bool bres;
double nres;
char *sres;
EnumOne eres;
Error *errp = NULL;
Visitor *v;
unsigned int i;
char buf[10000];
for (i = 0; i < 100; i++) {
unsigned int j;
j = g_test_rand_int_range(0, sizeof(buf) - 1);
buf[j] = '\0';
if (j != 0) {
for (j--; j != 0; j--) {
buf[j - 1] = (char)g_test_rand_int_range(0, 256);
}
}
v = visitor_input_test_init(data, buf);
visit_type_int(v, &ires, NULL, &errp);
v = visitor_input_test_init(data, buf);
visit_type_bool(v, &bres, NULL, &errp);
visitor_input_teardown(data, NULL);
v = visitor_input_test_init(data, buf);
visit_type_number(v, &nres, NULL, &errp);
v = visitor_input_test_init(data, buf);
visit_type_str(v, &sres, NULL, &errp);
g_free(sres);
v = visitor_input_test_init(data, buf);
visit_type_EnumOne(v, &eres, NULL, &errp);
visitor_input_teardown(data, NULL);
}
}
| true | qemu | 0184543814354d37eab75132712c3874d71dd776 | static void test_visitor_in_fuzz(TestInputVisitorData *data,
const void *unused)
{
int64_t ires;
bool bres;
double nres;
char *sres;
EnumOne eres;
Error *errp = NULL;
Visitor *v;
unsigned int i;
char buf[10000];
for (i = 0; i < 100; i++) {
unsigned int j;
j = g_test_rand_int_range(0, sizeof(buf) - 1);
buf[j] = '\0';
if (j != 0) {
for (j--; j != 0; j--) {
buf[j - 1] = (char)g_test_rand_int_range(0, 256);
}
}
v = visitor_input_test_init(data, buf);
visit_type_int(v, &ires, NULL, &errp);
v = visitor_input_test_init(data, buf);
visit_type_bool(v, &bres, NULL, &errp);
visitor_input_teardown(data, NULL);
v = visitor_input_test_init(data, buf);
visit_type_number(v, &nres, NULL, &errp);
v = visitor_input_test_init(data, buf);
visit_type_str(v, &sres, NULL, &errp);
g_free(sres);
v = visitor_input_test_init(data, buf);
visit_type_EnumOne(v, &eres, NULL, &errp);
visitor_input_teardown(data, NULL);
}
}
| {
"code": [
" Error *errp = NULL;",
" visit_type_int(v, &ires, NULL, &errp);",
" visit_type_bool(v, &bres, NULL, &errp);",
" visit_type_number(v, &nres, NULL, &errp);",
" visit_type_str(v, &sres, NULL, &errp);",
" visit_type_EnumOne(v, &eres, NULL, &errp);"
],
"line_no": [
17,
55,
61,
69,
75,
83
]
} | static void FUNC_0(TestInputVisitorData *VAR_0,
const void *VAR_1)
{
int64_t ires;
bool bres;
double VAR_2;
char *VAR_3;
EnumOne eres;
Error *errp = NULL;
Visitor *v;
unsigned int VAR_4;
char VAR_5[10000];
for (VAR_4 = 0; VAR_4 < 100; VAR_4++) {
unsigned int VAR_6;
VAR_6 = g_test_rand_int_range(0, sizeof(VAR_5) - 1);
VAR_5[VAR_6] = '\0';
if (VAR_6 != 0) {
for (VAR_6--; VAR_6 != 0; VAR_6--) {
VAR_5[VAR_6 - 1] = (char)g_test_rand_int_range(0, 256);
}
}
v = visitor_input_test_init(VAR_0, VAR_5);
visit_type_int(v, &ires, NULL, &errp);
v = visitor_input_test_init(VAR_0, VAR_5);
visit_type_bool(v, &bres, NULL, &errp);
visitor_input_teardown(VAR_0, NULL);
v = visitor_input_test_init(VAR_0, VAR_5);
visit_type_number(v, &VAR_2, NULL, &errp);
v = visitor_input_test_init(VAR_0, VAR_5);
visit_type_str(v, &VAR_3, NULL, &errp);
g_free(VAR_3);
v = visitor_input_test_init(VAR_0, VAR_5);
visit_type_EnumOne(v, &eres, NULL, &errp);
visitor_input_teardown(VAR_0, NULL);
}
}
| [
"static void FUNC_0(TestInputVisitorData *VAR_0,\nconst void *VAR_1)\n{",
"int64_t ires;",
"bool bres;",
"double VAR_2;",
"char *VAR_3;",
"EnumOne eres;",
"Error *errp = NULL;",
"Visitor *v;",
"unsigned int VAR_4;",
"char VAR_5[10000];",
"for (VAR_4 = 0; VAR_4 < 100; VAR_4++) {",
"unsigned int VAR_6;",
"VAR_6 = g_test_rand_int_range(0, sizeof(VAR_5) - 1);",
"VAR_5[VAR_6] = '\\0';",
"if (VAR_6 != 0) {",
"for (VAR_6--; VAR_6 != 0; VAR_6--) {",
"VAR_5[VAR_6 - 1] = (char)g_test_rand_int_range(0, 256);",
"}",
"}",
"v = visitor_input_test_init(VAR_0, VAR_5);",
"visit_type_int(v, &ires, NULL, &errp);",
"v = visitor_input_test_init(VAR_0, VAR_5);",
"visit_type_bool(v, &bres, NULL, &errp);",
"visitor_input_teardown(VAR_0, NULL);",
"v = visitor_input_test_init(VAR_0, VAR_5);",
"visit_type_number(v, &VAR_2, NULL, &errp);",
"v = visitor_input_test_init(VAR_0, VAR_5);",
"visit_type_str(v, &VAR_3, NULL, &errp);",
"g_free(VAR_3);",
"v = visitor_input_test_init(VAR_0, VAR_5);",
"visit_type_EnumOne(v, &eres, NULL, &errp);",
"visitor_input_teardown(VAR_0, NULL);",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
1,
0,
0,
1,
0,
1,
0,
0,
1,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
27
],
[
29
],
[
33
],
[
37
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
53
],
[
55
],
[
59
],
[
61
],
[
63
],
[
67
],
[
69
],
[
73
],
[
75
],
[
77
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
]
]
|
12,392 | static inline int _find_pte(CPUState *env, mmu_ctx_t *ctx, int is_64b, int h,
int rw, int type, int target_page_bits)
{
target_phys_addr_t pteg_off;
target_ulong pte0, pte1;
int i, good = -1;
int ret, r;
ret = -1; /* No entry found */
pteg_off = get_pteg_offset(env, ctx->hash[h],
is_64b ? HASH_PTE_SIZE_64 : HASH_PTE_SIZE_32);
for (i = 0; i < 8; i++) {
#if defined(TARGET_PPC64)
if (is_64b) {
if (env->external_htab) {
pte0 = ldq_p(env->external_htab + pteg_off + (i * 16));
pte1 = ldq_p(env->external_htab + pteg_off + (i * 16) + 8);
} else {
pte0 = ldq_phys(env->htab_base + pteg_off + (i * 16));
pte1 = ldq_phys(env->htab_base + pteg_off + (i * 16) + 8);
}
/* We have a TLB that saves 4K pages, so let's
* split a huge page to 4k chunks */
if (target_page_bits != TARGET_PAGE_BITS)
pte1 |= (ctx->eaddr & (( 1 << target_page_bits ) - 1))
& TARGET_PAGE_MASK;
r = pte64_check(ctx, pte0, pte1, h, rw, type);
LOG_MMU("Load pte from " TARGET_FMT_lx " => " TARGET_FMT_lx " "
TARGET_FMT_lx " %d %d %d " TARGET_FMT_lx "\n",
pteg_base + (i * 16), pte0, pte1, (int)(pte0 & 1), h,
(int)((pte0 >> 1) & 1), ctx->ptem);
} else
#endif
{
if (env->external_htab) {
pte0 = ldl_p(env->external_htab + pteg_off + (i * 8));
pte1 = ldl_p(env->external_htab + pteg_off + (i * 8) + 4);
} else {
pte0 = ldl_phys(env->htab_base + pteg_off + (i * 8));
pte1 = ldl_phys(env->htab_base + pteg_off + (i * 8) + 4);
}
r = pte32_check(ctx, pte0, pte1, h, rw, type);
LOG_MMU("Load pte from " TARGET_FMT_lx " => " TARGET_FMT_lx " "
TARGET_FMT_lx " %d %d %d " TARGET_FMT_lx "\n",
pteg_base + (i * 8), pte0, pte1, (int)(pte0 >> 31), h,
(int)((pte0 >> 6) & 1), ctx->ptem);
}
switch (r) {
case -3:
/* PTE inconsistency */
return -1;
case -2:
/* Access violation */
ret = -2;
good = i;
break;
case -1:
default:
/* No PTE match */
break;
case 0:
/* access granted */
/* XXX: we should go on looping to check all PTEs consistency
* but if we can speed-up the whole thing as the
* result would be undefined if PTEs are not consistent.
*/
ret = 0;
good = i;
goto done;
}
}
if (good != -1) {
done:
LOG_MMU("found PTE at addr " TARGET_FMT_lx " prot=%01x ret=%d\n",
ctx->raddr, ctx->prot, ret);
/* Update page flags */
pte1 = ctx->raddr;
if (pte_update_flags(ctx, &pte1, ret, rw) == 1) {
#if defined(TARGET_PPC64)
if (is_64b) {
if (env->external_htab) {
stq_p(env->external_htab + pteg_off + (good * 16) + 8,
pte1);
} else {
stq_phys_notdirty(env->htab_base + pteg_off +
(good * 16) + 8, pte1);
}
} else
#endif
{
if (env->external_htab) {
stl_p(env->external_htab + pteg_off + (good * 8) + 4,
pte1);
} else {
stl_phys_notdirty(env->htab_base + pteg_off +
(good * 8) + 4, pte1);
}
}
}
}
return ret;
}
| true | qemu | decb471488dd9e7e7ab9957f120cb501c4489f63 | static inline int _find_pte(CPUState *env, mmu_ctx_t *ctx, int is_64b, int h,
int rw, int type, int target_page_bits)
{
target_phys_addr_t pteg_off;
target_ulong pte0, pte1;
int i, good = -1;
int ret, r;
ret = -1;
pteg_off = get_pteg_offset(env, ctx->hash[h],
is_64b ? HASH_PTE_SIZE_64 : HASH_PTE_SIZE_32);
for (i = 0; i < 8; i++) {
#if defined(TARGET_PPC64)
if (is_64b) {
if (env->external_htab) {
pte0 = ldq_p(env->external_htab + pteg_off + (i * 16));
pte1 = ldq_p(env->external_htab + pteg_off + (i * 16) + 8);
} else {
pte0 = ldq_phys(env->htab_base + pteg_off + (i * 16));
pte1 = ldq_phys(env->htab_base + pteg_off + (i * 16) + 8);
}
if (target_page_bits != TARGET_PAGE_BITS)
pte1 |= (ctx->eaddr & (( 1 << target_page_bits ) - 1))
& TARGET_PAGE_MASK;
r = pte64_check(ctx, pte0, pte1, h, rw, type);
LOG_MMU("Load pte from " TARGET_FMT_lx " => " TARGET_FMT_lx " "
TARGET_FMT_lx " %d %d %d " TARGET_FMT_lx "\n",
pteg_base + (i * 16), pte0, pte1, (int)(pte0 & 1), h,
(int)((pte0 >> 1) & 1), ctx->ptem);
} else
#endif
{
if (env->external_htab) {
pte0 = ldl_p(env->external_htab + pteg_off + (i * 8));
pte1 = ldl_p(env->external_htab + pteg_off + (i * 8) + 4);
} else {
pte0 = ldl_phys(env->htab_base + pteg_off + (i * 8));
pte1 = ldl_phys(env->htab_base + pteg_off + (i * 8) + 4);
}
r = pte32_check(ctx, pte0, pte1, h, rw, type);
LOG_MMU("Load pte from " TARGET_FMT_lx " => " TARGET_FMT_lx " "
TARGET_FMT_lx " %d %d %d " TARGET_FMT_lx "\n",
pteg_base + (i * 8), pte0, pte1, (int)(pte0 >> 31), h,
(int)((pte0 >> 6) & 1), ctx->ptem);
}
switch (r) {
case -3:
return -1;
case -2:
ret = -2;
good = i;
break;
case -1:
default:
break;
case 0:
ret = 0;
good = i;
goto done;
}
}
if (good != -1) {
done:
LOG_MMU("found PTE at addr " TARGET_FMT_lx " prot=%01x ret=%d\n",
ctx->raddr, ctx->prot, ret);
pte1 = ctx->raddr;
if (pte_update_flags(ctx, &pte1, ret, rw) == 1) {
#if defined(TARGET_PPC64)
if (is_64b) {
if (env->external_htab) {
stq_p(env->external_htab + pteg_off + (good * 16) + 8,
pte1);
} else {
stq_phys_notdirty(env->htab_base + pteg_off +
(good * 16) + 8, pte1);
}
} else
#endif
{
if (env->external_htab) {
stl_p(env->external_htab + pteg_off + (good * 8) + 4,
pte1);
} else {
stl_phys_notdirty(env->htab_base + pteg_off +
(good * 8) + 4, pte1);
}
}
}
}
return ret;
}
| {
"code": [
" pteg_base + (i * 16), pte0, pte1, (int)(pte0 & 1), h,",
" pteg_base + (i * 8), pte0, pte1, (int)(pte0 >> 31), h,"
],
"line_no": [
63,
93
]
} | static inline int FUNC_0(CPUState *VAR_0, mmu_ctx_t *VAR_1, int VAR_2, int VAR_3,
int VAR_4, int VAR_5, int VAR_6)
{
target_phys_addr_t pteg_off;
target_ulong pte0, pte1;
int VAR_7, VAR_8 = -1;
int VAR_9, VAR_10;
VAR_9 = -1;
pteg_off = get_pteg_offset(VAR_0, VAR_1->hash[VAR_3],
VAR_2 ? HASH_PTE_SIZE_64 : HASH_PTE_SIZE_32);
for (VAR_7 = 0; VAR_7 < 8; VAR_7++) {
#if defined(TARGET_PPC64)
if (VAR_2) {
if (VAR_0->external_htab) {
pte0 = ldq_p(VAR_0->external_htab + pteg_off + (VAR_7 * 16));
pte1 = ldq_p(VAR_0->external_htab + pteg_off + (VAR_7 * 16) + 8);
} else {
pte0 = ldq_phys(VAR_0->htab_base + pteg_off + (VAR_7 * 16));
pte1 = ldq_phys(VAR_0->htab_base + pteg_off + (VAR_7 * 16) + 8);
}
if (VAR_6 != TARGET_PAGE_BITS)
pte1 |= (VAR_1->eaddr & (( 1 << VAR_6 ) - 1))
& TARGET_PAGE_MASK;
VAR_10 = pte64_check(VAR_1, pte0, pte1, VAR_3, VAR_4, VAR_5);
LOG_MMU("Load pte from " TARGET_FMT_lx " => " TARGET_FMT_lx " "
TARGET_FMT_lx " %d %d %d " TARGET_FMT_lx "\n",
pteg_base + (VAR_7 * 16), pte0, pte1, (int)(pte0 & 1), VAR_3,
(int)((pte0 >> 1) & 1), VAR_1->ptem);
} else
#endif
{
if (VAR_0->external_htab) {
pte0 = ldl_p(VAR_0->external_htab + pteg_off + (VAR_7 * 8));
pte1 = ldl_p(VAR_0->external_htab + pteg_off + (VAR_7 * 8) + 4);
} else {
pte0 = ldl_phys(VAR_0->htab_base + pteg_off + (VAR_7 * 8));
pte1 = ldl_phys(VAR_0->htab_base + pteg_off + (VAR_7 * 8) + 4);
}
VAR_10 = pte32_check(VAR_1, pte0, pte1, VAR_3, VAR_4, VAR_5);
LOG_MMU("Load pte from " TARGET_FMT_lx " => " TARGET_FMT_lx " "
TARGET_FMT_lx " %d %d %d " TARGET_FMT_lx "\n",
pteg_base + (VAR_7 * 8), pte0, pte1, (int)(pte0 >> 31), VAR_3,
(int)((pte0 >> 6) & 1), VAR_1->ptem);
}
switch (VAR_10) {
case -3:
return -1;
case -2:
VAR_9 = -2;
VAR_8 = VAR_7;
break;
case -1:
default:
break;
case 0:
VAR_9 = 0;
VAR_8 = VAR_7;
goto done;
}
}
if (VAR_8 != -1) {
done:
LOG_MMU("found PTE at addr " TARGET_FMT_lx " prot=%01x VAR_9=%d\n",
VAR_1->raddr, VAR_1->prot, VAR_9);
pte1 = VAR_1->raddr;
if (pte_update_flags(VAR_1, &pte1, VAR_9, VAR_4) == 1) {
#if defined(TARGET_PPC64)
if (VAR_2) {
if (VAR_0->external_htab) {
stq_p(VAR_0->external_htab + pteg_off + (VAR_8 * 16) + 8,
pte1);
} else {
stq_phys_notdirty(VAR_0->htab_base + pteg_off +
(VAR_8 * 16) + 8, pte1);
}
} else
#endif
{
if (VAR_0->external_htab) {
stl_p(VAR_0->external_htab + pteg_off + (VAR_8 * 8) + 4,
pte1);
} else {
stl_phys_notdirty(VAR_0->htab_base + pteg_off +
(VAR_8 * 8) + 4, pte1);
}
}
}
}
return VAR_9;
}
| [
"static inline int FUNC_0(CPUState *VAR_0, mmu_ctx_t *VAR_1, int VAR_2, int VAR_3,\nint VAR_4, int VAR_5, int VAR_6)\n{",
"target_phys_addr_t pteg_off;",
"target_ulong pte0, pte1;",
"int VAR_7, VAR_8 = -1;",
"int VAR_9, VAR_10;",
"VAR_9 = -1;",
"pteg_off = get_pteg_offset(VAR_0, VAR_1->hash[VAR_3],\nVAR_2 ? HASH_PTE_SIZE_64 : HASH_PTE_SIZE_32);",
"for (VAR_7 = 0; VAR_7 < 8; VAR_7++) {",
"#if defined(TARGET_PPC64)\nif (VAR_2) {",
"if (VAR_0->external_htab) {",
"pte0 = ldq_p(VAR_0->external_htab + pteg_off + (VAR_7 * 16));",
"pte1 = ldq_p(VAR_0->external_htab + pteg_off + (VAR_7 * 16) + 8);",
"} else {",
"pte0 = ldq_phys(VAR_0->htab_base + pteg_off + (VAR_7 * 16));",
"pte1 = ldq_phys(VAR_0->htab_base + pteg_off + (VAR_7 * 16) + 8);",
"}",
"if (VAR_6 != TARGET_PAGE_BITS)\npte1 |= (VAR_1->eaddr & (( 1 << VAR_6 ) - 1))\n& TARGET_PAGE_MASK;",
"VAR_10 = pte64_check(VAR_1, pte0, pte1, VAR_3, VAR_4, VAR_5);",
"LOG_MMU(\"Load pte from \" TARGET_FMT_lx \" => \" TARGET_FMT_lx \" \"\nTARGET_FMT_lx \" %d %d %d \" TARGET_FMT_lx \"\\n\",\npteg_base + (VAR_7 * 16), pte0, pte1, (int)(pte0 & 1), VAR_3,\n(int)((pte0 >> 1) & 1), VAR_1->ptem);",
"} else",
"#endif\n{",
"if (VAR_0->external_htab) {",
"pte0 = ldl_p(VAR_0->external_htab + pteg_off + (VAR_7 * 8));",
"pte1 = ldl_p(VAR_0->external_htab + pteg_off + (VAR_7 * 8) + 4);",
"} else {",
"pte0 = ldl_phys(VAR_0->htab_base + pteg_off + (VAR_7 * 8));",
"pte1 = ldl_phys(VAR_0->htab_base + pteg_off + (VAR_7 * 8) + 4);",
"}",
"VAR_10 = pte32_check(VAR_1, pte0, pte1, VAR_3, VAR_4, VAR_5);",
"LOG_MMU(\"Load pte from \" TARGET_FMT_lx \" => \" TARGET_FMT_lx \" \"\nTARGET_FMT_lx \" %d %d %d \" TARGET_FMT_lx \"\\n\",\npteg_base + (VAR_7 * 8), pte0, pte1, (int)(pte0 >> 31), VAR_3,\n(int)((pte0 >> 6) & 1), VAR_1->ptem);",
"}",
"switch (VAR_10) {",
"case -3:\nreturn -1;",
"case -2:\nVAR_9 = -2;",
"VAR_8 = VAR_7;",
"break;",
"case -1:\ndefault:\nbreak;",
"case 0:\nVAR_9 = 0;",
"VAR_8 = VAR_7;",
"goto done;",
"}",
"}",
"if (VAR_8 != -1) {",
"done:\nLOG_MMU(\"found PTE at addr \" TARGET_FMT_lx \" prot=%01x VAR_9=%d\\n\",\nVAR_1->raddr, VAR_1->prot, VAR_9);",
"pte1 = VAR_1->raddr;",
"if (pte_update_flags(VAR_1, &pte1, VAR_9, VAR_4) == 1) {",
"#if defined(TARGET_PPC64)\nif (VAR_2) {",
"if (VAR_0->external_htab) {",
"stq_p(VAR_0->external_htab + pteg_off + (VAR_8 * 16) + 8,\npte1);",
"} else {",
"stq_phys_notdirty(VAR_0->htab_base + pteg_off +\n(VAR_8 * 16) + 8, pte1);",
"}",
"} else",
"#endif\n{",
"if (VAR_0->external_htab) {",
"stl_p(VAR_0->external_htab + pteg_off + (VAR_8 * 8) + 4,\npte1);",
"} else {",
"stl_phys_notdirty(VAR_0->htab_base + pteg_off +\n(VAR_8 * 8) + 4, pte1);",
"}",
"}",
"}",
"}",
"return VAR_9;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
19,
21
],
[
23
],
[
25,
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
49,
51,
53
],
[
57
],
[
59,
61,
63,
65
],
[
67
],
[
69,
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89,
91,
93,
95
],
[
97
],
[
99
],
[
101,
105
],
[
107,
111
],
[
113
],
[
115
],
[
117,
119,
123
],
[
125,
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149,
151,
153
],
[
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
],
[
209
]
]
|
12,393 | static int decode_sequence_header(AVCodecContext *avctx, GetBitContext *gb)
{
VC9Context *v = avctx->priv_data;
v->profile = get_bits(gb, 2);
av_log(avctx, AV_LOG_DEBUG, "Profile: %i\n", v->profile);
#if HAS_ADVANCED_PROFILE
if (v->profile > PROFILE_MAIN)
{
v->level = get_bits(gb, 3);
v->chromaformat = get_bits(gb, 2);
if (v->chromaformat != 1)
{
av_log(avctx, AV_LOG_ERROR,
"Only 4:2:0 chroma format supported\n");
return -1;
}
}
else
#endif
{
v->res_sm = get_bits(gb, 2); //reserved
if (v->res_sm)
{
av_log(avctx, AV_LOG_ERROR,
"Reserved RES_SM=%i is forbidden\n", v->res_sm);
//return -1;
}
}
// (fps-2)/4 (->30)
v->frmrtq_postproc = get_bits(gb, 3); //common
// (bitrate-32kbps)/64kbps
v->bitrtq_postproc = get_bits(gb, 5); //common
v->loopfilter = get_bits(gb, 1); //common
#if HAS_ADVANCED_PROFILE
if (v->profile <= PROFILE_MAIN)
#endif
{
v->res_x8 = get_bits(gb, 1); //reserved
if (v->res_x8)
{
av_log(avctx, AV_LOG_ERROR,
"1 for reserved RES_X8 is forbidden\n");
return -1;
}
v->multires = get_bits(gb, 1);
v->res_fasttx = get_bits(gb, 1);
if (!v->res_fasttx)
{
av_log(avctx, AV_LOG_ERROR,
"0 for reserved RES_FASTTX is forbidden\n");
//return -1;
}
}
v->fastuvmc = get_bits(gb, 1); //common
if (!v->profile && !v->fastuvmc)
{
av_log(avctx, AV_LOG_ERROR,
"FASTUVMC unavailable in Simple Profile\n");
return -1;
}
v->extended_mv = get_bits(gb, 1); //common
if (!v->profile && v->extended_mv)
{
av_log(avctx, AV_LOG_ERROR,
"Extended MVs unavailable in Simple Profile\n");
return -1;
}
v->dquant = get_bits(gb, 2); //common
v->vstransform = get_bits(gb, 1); //common
#if HAS_ADVANCED_PROFILE
if (v->profile <= PROFILE_MAIN)
#endif
{
v->res_transtab = get_bits(gb, 1);
if (v->res_transtab)
{
av_log(avctx, AV_LOG_ERROR,
"1 for reserved RES_TRANSTAB is forbidden\n");
return -1;
}
}
v->overlap = get_bits(gb, 1); //common
#if HAS_ADVANCED_PROFILE
if (v->profile <= PROFILE_MAIN)
#endif
{
v->syncmarker = get_bits(gb, 1);
v->rangered = get_bits(gb, 1);
}
avctx->max_b_frames = get_bits(gb, 3); //common
v->quantizer_mode = get_bits(gb, 2); //common
#if HAS_ADVANCED_PROFILE
if (v->profile <= PROFILE_MAIN)
#endif
{
v->finterpflag = get_bits(gb, 1); //common
v->res_rtm_flag = get_bits(gb, 1); //reserved
if (!v->res_rtm_flag)
{
av_log(avctx, AV_LOG_ERROR,
"0 for reserved RES_RTM_FLAG is forbidden\n");
//return -1;
}
#if TRACE
av_log(avctx, AV_LOG_INFO,
"Profile %i:\nfrmrtq_postproc=%i, bitrtq_postproc=%i\n"
"LoopFilter=%i, MultiRes=%i, FastUVMV=%i, Extended MV=%i\n"
"Rangered=%i, VSTransform=%i, Overlap=%i, SyncMarker=%i\n"
"DQuant=%i, Quantizer mode=%i, Max B frames=%i\n",
v->profile, v->frmrtq_postproc, v->bitrtq_postproc,
v->loopfilter, v->multires, v->fastuvmc, v->extended_mv,
v->rangered, v->vstransform, v->overlap, v->syncmarker,
v->dquant, v->quantizer_mode, avctx->max_b_frames
);
#endif
}
#if HAS_ADVANCED_PROFILE
else decode_advanced_sequence_header(avctx, gb);
#endif
}
| false | FFmpeg | e5540b3fd30367ce3cc33b2f34a04b660dbc4b38 | static int decode_sequence_header(AVCodecContext *avctx, GetBitContext *gb)
{
VC9Context *v = avctx->priv_data;
v->profile = get_bits(gb, 2);
av_log(avctx, AV_LOG_DEBUG, "Profile: %i\n", v->profile);
#if HAS_ADVANCED_PROFILE
if (v->profile > PROFILE_MAIN)
{
v->level = get_bits(gb, 3);
v->chromaformat = get_bits(gb, 2);
if (v->chromaformat != 1)
{
av_log(avctx, AV_LOG_ERROR,
"Only 4:2:0 chroma format supported\n");
return -1;
}
}
else
#endif
{
v->res_sm = get_bits(gb, 2);
if (v->res_sm)
{
av_log(avctx, AV_LOG_ERROR,
"Reserved RES_SM=%i is forbidden\n", v->res_sm);
}
}
v->frmrtq_postproc = get_bits(gb, 3);
v->bitrtq_postproc = get_bits(gb, 5);
v->loopfilter = get_bits(gb, 1);
#if HAS_ADVANCED_PROFILE
if (v->profile <= PROFILE_MAIN)
#endif
{
v->res_x8 = get_bits(gb, 1);
if (v->res_x8)
{
av_log(avctx, AV_LOG_ERROR,
"1 for reserved RES_X8 is forbidden\n");
return -1;
}
v->multires = get_bits(gb, 1);
v->res_fasttx = get_bits(gb, 1);
if (!v->res_fasttx)
{
av_log(avctx, AV_LOG_ERROR,
"0 for reserved RES_FASTTX is forbidden\n");
}
}
v->fastuvmc = get_bits(gb, 1);
if (!v->profile && !v->fastuvmc)
{
av_log(avctx, AV_LOG_ERROR,
"FASTUVMC unavailable in Simple Profile\n");
return -1;
}
v->extended_mv = get_bits(gb, 1);
if (!v->profile && v->extended_mv)
{
av_log(avctx, AV_LOG_ERROR,
"Extended MVs unavailable in Simple Profile\n");
return -1;
}
v->dquant = get_bits(gb, 2);
v->vstransform = get_bits(gb, 1);
#if HAS_ADVANCED_PROFILE
if (v->profile <= PROFILE_MAIN)
#endif
{
v->res_transtab = get_bits(gb, 1);
if (v->res_transtab)
{
av_log(avctx, AV_LOG_ERROR,
"1 for reserved RES_TRANSTAB is forbidden\n");
return -1;
}
}
v->overlap = get_bits(gb, 1);
#if HAS_ADVANCED_PROFILE
if (v->profile <= PROFILE_MAIN)
#endif
{
v->syncmarker = get_bits(gb, 1);
v->rangered = get_bits(gb, 1);
}
avctx->max_b_frames = get_bits(gb, 3);
v->quantizer_mode = get_bits(gb, 2);
#if HAS_ADVANCED_PROFILE
if (v->profile <= PROFILE_MAIN)
#endif
{
v->finterpflag = get_bits(gb, 1);
v->res_rtm_flag = get_bits(gb, 1);
if (!v->res_rtm_flag)
{
av_log(avctx, AV_LOG_ERROR,
"0 for reserved RES_RTM_FLAG is forbidden\n");
}
#if TRACE
av_log(avctx, AV_LOG_INFO,
"Profile %i:\nfrmrtq_postproc=%i, bitrtq_postproc=%i\n"
"LoopFilter=%i, MultiRes=%i, FastUVMV=%i, Extended MV=%i\n"
"Rangered=%i, VSTransform=%i, Overlap=%i, SyncMarker=%i\n"
"DQuant=%i, Quantizer mode=%i, Max B frames=%i\n",
v->profile, v->frmrtq_postproc, v->bitrtq_postproc,
v->loopfilter, v->multires, v->fastuvmc, v->extended_mv,
v->rangered, v->vstransform, v->overlap, v->syncmarker,
v->dquant, v->quantizer_mode, avctx->max_b_frames
);
#endif
}
#if HAS_ADVANCED_PROFILE
else decode_advanced_sequence_header(avctx, gb);
#endif
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(AVCodecContext *VAR_0, GetBitContext *VAR_1)
{
VC9Context *v = VAR_0->priv_data;
v->profile = get_bits(VAR_1, 2);
av_log(VAR_0, AV_LOG_DEBUG, "Profile: %i\n", v->profile);
#if HAS_ADVANCED_PROFILE
if (v->profile > PROFILE_MAIN)
{
v->level = get_bits(VAR_1, 3);
v->chromaformat = get_bits(VAR_1, 2);
if (v->chromaformat != 1)
{
av_log(VAR_0, AV_LOG_ERROR,
"Only 4:2:0 chroma format supported\n");
return -1;
}
}
else
#endif
{
v->res_sm = get_bits(VAR_1, 2);
if (v->res_sm)
{
av_log(VAR_0, AV_LOG_ERROR,
"Reserved RES_SM=%i is forbidden\n", v->res_sm);
}
}
v->frmrtq_postproc = get_bits(VAR_1, 3);
v->bitrtq_postproc = get_bits(VAR_1, 5);
v->loopfilter = get_bits(VAR_1, 1);
#if HAS_ADVANCED_PROFILE
if (v->profile <= PROFILE_MAIN)
#endif
{
v->res_x8 = get_bits(VAR_1, 1);
if (v->res_x8)
{
av_log(VAR_0, AV_LOG_ERROR,
"1 for reserved RES_X8 is forbidden\n");
return -1;
}
v->multires = get_bits(VAR_1, 1);
v->res_fasttx = get_bits(VAR_1, 1);
if (!v->res_fasttx)
{
av_log(VAR_0, AV_LOG_ERROR,
"0 for reserved RES_FASTTX is forbidden\n");
}
}
v->fastuvmc = get_bits(VAR_1, 1);
if (!v->profile && !v->fastuvmc)
{
av_log(VAR_0, AV_LOG_ERROR,
"FASTUVMC unavailable in Simple Profile\n");
return -1;
}
v->extended_mv = get_bits(VAR_1, 1);
if (!v->profile && v->extended_mv)
{
av_log(VAR_0, AV_LOG_ERROR,
"Extended MVs unavailable in Simple Profile\n");
return -1;
}
v->dquant = get_bits(VAR_1, 2);
v->vstransform = get_bits(VAR_1, 1);
#if HAS_ADVANCED_PROFILE
if (v->profile <= PROFILE_MAIN)
#endif
{
v->res_transtab = get_bits(VAR_1, 1);
if (v->res_transtab)
{
av_log(VAR_0, AV_LOG_ERROR,
"1 for reserved RES_TRANSTAB is forbidden\n");
return -1;
}
}
v->overlap = get_bits(VAR_1, 1);
#if HAS_ADVANCED_PROFILE
if (v->profile <= PROFILE_MAIN)
#endif
{
v->syncmarker = get_bits(VAR_1, 1);
v->rangered = get_bits(VAR_1, 1);
}
VAR_0->max_b_frames = get_bits(VAR_1, 3);
v->quantizer_mode = get_bits(VAR_1, 2);
#if HAS_ADVANCED_PROFILE
if (v->profile <= PROFILE_MAIN)
#endif
{
v->finterpflag = get_bits(VAR_1, 1);
v->res_rtm_flag = get_bits(VAR_1, 1);
if (!v->res_rtm_flag)
{
av_log(VAR_0, AV_LOG_ERROR,
"0 for reserved RES_RTM_FLAG is forbidden\n");
}
#if TRACE
av_log(VAR_0, AV_LOG_INFO,
"Profile %i:\nfrmrtq_postproc=%i, bitrtq_postproc=%i\n"
"LoopFilter=%i, MultiRes=%i, FastUVMV=%i, Extended MV=%i\n"
"Rangered=%i, VSTransform=%i, Overlap=%i, SyncMarker=%i\n"
"DQuant=%i, Quantizer mode=%i, Max B frames=%i\n",
v->profile, v->frmrtq_postproc, v->bitrtq_postproc,
v->loopfilter, v->multires, v->fastuvmc, v->extended_mv,
v->rangered, v->vstransform, v->overlap, v->syncmarker,
v->dquant, v->quantizer_mode, VAR_0->max_b_frames
);
#endif
}
#if HAS_ADVANCED_PROFILE
else decode_advanced_sequence_header(VAR_0, VAR_1);
#endif
}
| [
"static int FUNC_0(AVCodecContext *VAR_0, GetBitContext *VAR_1)\n{",
"VC9Context *v = VAR_0->priv_data;",
"v->profile = get_bits(VAR_1, 2);",
"av_log(VAR_0, AV_LOG_DEBUG, \"Profile: %i\\n\", v->profile);",
"#if HAS_ADVANCED_PROFILE\nif (v->profile > PROFILE_MAIN)\n{",
"v->level = get_bits(VAR_1, 3);",
"v->chromaformat = get_bits(VAR_1, 2);",
"if (v->chromaformat != 1)\n{",
"av_log(VAR_0, AV_LOG_ERROR,\n\"Only 4:2:0 chroma format supported\\n\");",
"return -1;",
"}",
"}",
"else\n#endif\n{",
"v->res_sm = get_bits(VAR_1, 2);",
"if (v->res_sm)\n{",
"av_log(VAR_0, AV_LOG_ERROR,\n\"Reserved RES_SM=%i is forbidden\\n\", v->res_sm);",
"}",
"}",
"v->frmrtq_postproc = get_bits(VAR_1, 3);",
"v->bitrtq_postproc = get_bits(VAR_1, 5);",
"v->loopfilter = get_bits(VAR_1, 1);",
"#if HAS_ADVANCED_PROFILE\nif (v->profile <= PROFILE_MAIN)\n#endif\n{",
"v->res_x8 = get_bits(VAR_1, 1);",
"if (v->res_x8)\n{",
"av_log(VAR_0, AV_LOG_ERROR,\n\"1 for reserved RES_X8 is forbidden\\n\");",
"return -1;",
"}",
"v->multires = get_bits(VAR_1, 1);",
"v->res_fasttx = get_bits(VAR_1, 1);",
"if (!v->res_fasttx)\n{",
"av_log(VAR_0, AV_LOG_ERROR,\n\"0 for reserved RES_FASTTX is forbidden\\n\");",
"}",
"}",
"v->fastuvmc = get_bits(VAR_1, 1);",
"if (!v->profile && !v->fastuvmc)\n{",
"av_log(VAR_0, AV_LOG_ERROR,\n\"FASTUVMC unavailable in Simple Profile\\n\");",
"return -1;",
"}",
"v->extended_mv = get_bits(VAR_1, 1);",
"if (!v->profile && v->extended_mv)\n{",
"av_log(VAR_0, AV_LOG_ERROR,\n\"Extended MVs unavailable in Simple Profile\\n\");",
"return -1;",
"}",
"v->dquant = get_bits(VAR_1, 2);",
"v->vstransform = get_bits(VAR_1, 1);",
"#if HAS_ADVANCED_PROFILE\nif (v->profile <= PROFILE_MAIN)\n#endif\n{",
"v->res_transtab = get_bits(VAR_1, 1);",
"if (v->res_transtab)\n{",
"av_log(VAR_0, AV_LOG_ERROR,\n\"1 for reserved RES_TRANSTAB is forbidden\\n\");",
"return -1;",
"}",
"}",
"v->overlap = get_bits(VAR_1, 1);",
"#if HAS_ADVANCED_PROFILE\nif (v->profile <= PROFILE_MAIN)\n#endif\n{",
"v->syncmarker = get_bits(VAR_1, 1);",
"v->rangered = get_bits(VAR_1, 1);",
"}",
"VAR_0->max_b_frames = get_bits(VAR_1, 3);",
"v->quantizer_mode = get_bits(VAR_1, 2);",
"#if HAS_ADVANCED_PROFILE\nif (v->profile <= PROFILE_MAIN)\n#endif\n{",
"v->finterpflag = get_bits(VAR_1, 1);",
"v->res_rtm_flag = get_bits(VAR_1, 1);",
"if (!v->res_rtm_flag)\n{",
"av_log(VAR_0, AV_LOG_ERROR,\n\"0 for reserved RES_RTM_FLAG is forbidden\\n\");",
"}",
"#if TRACE\nav_log(VAR_0, AV_LOG_INFO,\n\"Profile %i:\\nfrmrtq_postproc=%i, bitrtq_postproc=%i\\n\"\n\"LoopFilter=%i, MultiRes=%i, FastUVMV=%i, Extended MV=%i\\n\"\n\"Rangered=%i, VSTransform=%i, Overlap=%i, SyncMarker=%i\\n\"\n\"DQuant=%i, Quantizer mode=%i, Max B frames=%i\\n\",\nv->profile, v->frmrtq_postproc, v->bitrtq_postproc,\nv->loopfilter, v->multires, v->fastuvmc, v->extended_mv,\nv->rangered, v->vstransform, v->overlap, v->syncmarker,\nv->dquant, v->quantizer_mode, VAR_0->max_b_frames\n);",
"#endif\n}",
"#if HAS_ADVANCED_PROFILE\nelse decode_advanced_sequence_header(VAR_0, VAR_1);",
"#endif\n}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
15,
17,
19
],
[
21
],
[
23
],
[
25,
27
],
[
29,
31
],
[
33
],
[
35
],
[
37
],
[
39,
41,
43
],
[
45
],
[
47,
49
],
[
51,
53
],
[
57
],
[
59
],
[
65
],
[
69
],
[
71
],
[
75,
77,
79,
81
],
[
83
],
[
85,
87
],
[
89,
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101,
103
],
[
105,
107
],
[
111
],
[
113
],
[
117
],
[
119,
121
],
[
123,
125
],
[
127
],
[
129
],
[
131
],
[
133,
135
],
[
137,
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
151,
153,
155,
157
],
[
159
],
[
161,
163
],
[
165,
167
],
[
169
],
[
171
],
[
173
],
[
177
],
[
181,
183,
185,
187
],
[
189
],
[
191
],
[
193
],
[
197
],
[
199
],
[
203,
205,
207,
209
],
[
211
],
[
213
],
[
215,
217
],
[
219,
221
],
[
225
],
[
227,
229,
231,
233,
235,
237,
239,
241,
243,
245,
247
],
[
249,
251
],
[
253,
255
],
[
257,
259
]
]
|
12,394 | static int mov_probe(AVProbeData *p)
{
int64_t offset;
uint32_t tag;
int score = 0;
/* check file header */
offset = 0;
for (;;) {
/* ignore invalid offset */
if ((offset + 8) > (unsigned int)p->buf_size)
return score;
tag = AV_RL32(p->buf + offset + 4);
switch(tag) {
/* check for obvious tags */
case MKTAG('j','P',' ',' '): /* jpeg 2000 signature */
case MKTAG('m','o','o','v'):
case MKTAG('m','d','a','t'):
case MKTAG('p','n','o','t'): /* detect movs with preview pics like ew.mov and april.mov */
case MKTAG('u','d','t','a'): /* Packet Video PVAuthor adds this and a lot of more junk */
case MKTAG('f','t','y','p'):
return AVPROBE_SCORE_MAX;
/* those are more common words, so rate then a bit less */
case MKTAG('e','d','i','w'): /* xdcam files have reverted first tags */
case MKTAG('w','i','d','e'):
case MKTAG('f','r','e','e'):
case MKTAG('j','u','n','k'):
case MKTAG('p','i','c','t'):
return AVPROBE_SCORE_MAX - 5;
case MKTAG(0x82,0x82,0x7f,0x7d):
case MKTAG('s','k','i','p'):
case MKTAG('u','u','i','d'):
case MKTAG('p','r','f','l'):
offset = AV_RB32(p->buf+offset) + offset;
/* if we only find those cause probedata is too small at least rate them */
score = AVPROBE_SCORE_MAX - 50;
break;
default:
/* unrecognized tag */
return score;
}
}
}
| false | FFmpeg | 7abf394814d818973db562102f21ab9d10540840 | static int mov_probe(AVProbeData *p)
{
int64_t offset;
uint32_t tag;
int score = 0;
offset = 0;
for (;;) {
if ((offset + 8) > (unsigned int)p->buf_size)
return score;
tag = AV_RL32(p->buf + offset + 4);
switch(tag) {
case MKTAG('j','P',' ',' '):
case MKTAG('m','o','o','v'):
case MKTAG('m','d','a','t'):
case MKTAG('p','n','o','t'):
case MKTAG('u','d','t','a'):
case MKTAG('f','t','y','p'):
return AVPROBE_SCORE_MAX;
case MKTAG('e','d','i','w'):
case MKTAG('w','i','d','e'):
case MKTAG('f','r','e','e'):
case MKTAG('j','u','n','k'):
case MKTAG('p','i','c','t'):
return AVPROBE_SCORE_MAX - 5;
case MKTAG(0x82,0x82,0x7f,0x7d):
case MKTAG('s','k','i','p'):
case MKTAG('u','u','i','d'):
case MKTAG('p','r','f','l'):
offset = AV_RB32(p->buf+offset) + offset;
score = AVPROBE_SCORE_MAX - 50;
break;
default:
return score;
}
}
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(AVProbeData *VAR_0)
{
int64_t offset;
uint32_t tag;
int VAR_1 = 0;
offset = 0;
for (;;) {
if ((offset + 8) > (unsigned int)VAR_0->buf_size)
return VAR_1;
tag = AV_RL32(VAR_0->buf + offset + 4);
switch(tag) {
case MKTAG('j','P',' ',' '):
case MKTAG('m','o','o','v'):
case MKTAG('m','d','a','t'):
case MKTAG('VAR_0','n','o','t'):
case MKTAG('u','d','t','a'):
case MKTAG('f','t','y','VAR_0'):
return AVPROBE_SCORE_MAX;
case MKTAG('e','d','i','w'):
case MKTAG('w','i','d','e'):
case MKTAG('f','r','e','e'):
case MKTAG('j','u','n','k'):
case MKTAG('VAR_0','i','c','t'):
return AVPROBE_SCORE_MAX - 5;
case MKTAG(0x82,0x82,0x7f,0x7d):
case MKTAG('s','k','i','VAR_0'):
case MKTAG('u','u','i','d'):
case MKTAG('VAR_0','r','f','l'):
offset = AV_RB32(VAR_0->buf+offset) + offset;
VAR_1 = AVPROBE_SCORE_MAX - 50;
break;
default:
return VAR_1;
}
}
}
| [
"static int FUNC_0(AVProbeData *VAR_0)\n{",
"int64_t offset;",
"uint32_t tag;",
"int VAR_1 = 0;",
"offset = 0;",
"for (;;) {",
"if ((offset + 8) > (unsigned int)VAR_0->buf_size)\nreturn VAR_1;",
"tag = AV_RL32(VAR_0->buf + offset + 4);",
"switch(tag) {",
"case MKTAG('j','P',' ',' '):\ncase MKTAG('m','o','o','v'):\ncase MKTAG('m','d','a','t'):\ncase MKTAG('VAR_0','n','o','t'):\ncase MKTAG('u','d','t','a'):\ncase MKTAG('f','t','y','VAR_0'):\nreturn AVPROBE_SCORE_MAX;",
"case MKTAG('e','d','i','w'):\ncase MKTAG('w','i','d','e'):\ncase MKTAG('f','r','e','e'):\ncase MKTAG('j','u','n','k'):\ncase MKTAG('VAR_0','i','c','t'):\nreturn AVPROBE_SCORE_MAX - 5;",
"case MKTAG(0x82,0x82,0x7f,0x7d):\ncase MKTAG('s','k','i','VAR_0'):\ncase MKTAG('u','u','i','d'):\ncase MKTAG('VAR_0','r','f','l'):\noffset = AV_RB32(VAR_0->buf+offset) + offset;",
"VAR_1 = AVPROBE_SCORE_MAX - 50;",
"break;",
"default:\nreturn VAR_1;",
"}",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
15
],
[
17
],
[
21,
23
],
[
25
],
[
27
],
[
31,
33,
35,
37,
39,
41,
43
],
[
47,
49,
51,
53,
55,
57
],
[
59,
61,
63,
65,
67
],
[
71
],
[
73
],
[
75,
79
],
[
81
],
[
83
],
[
85
]
]
|
12,398 | static inline void RENAME(rgb32to15)(const uint8_t *src, uint8_t *dst, long src_size)
{
const uint8_t *s = src;
const uint8_t *end;
#ifdef HAVE_MMX
const uint8_t *mm_end;
#endif
uint16_t *d = (uint16_t *)dst;
end = s + src_size;
#ifdef HAVE_MMX
mm_end = end - 15;
#if 1 //is faster only if multiplies are reasonable fast (FIXME figure out on which cpus this is faster, on Athlon its slightly faster)
asm volatile(
"movq %3, %%mm5 \n\t"
"movq %4, %%mm6 \n\t"
"movq %5, %%mm7 \n\t"
ASMALIGN16
"1: \n\t"
PREFETCH" 32(%1) \n\t"
"movd (%1), %%mm0 \n\t"
"movd 4(%1), %%mm3 \n\t"
"punpckldq 8(%1), %%mm0 \n\t"
"punpckldq 12(%1), %%mm3 \n\t"
"movq %%mm0, %%mm1 \n\t"
"movq %%mm3, %%mm4 \n\t"
"pand %%mm6, %%mm0 \n\t"
"pand %%mm6, %%mm3 \n\t"
"pmaddwd %%mm7, %%mm0 \n\t"
"pmaddwd %%mm7, %%mm3 \n\t"
"pand %%mm5, %%mm1 \n\t"
"pand %%mm5, %%mm4 \n\t"
"por %%mm1, %%mm0 \n\t"
"por %%mm4, %%mm3 \n\t"
"psrld $6, %%mm0 \n\t"
"pslld $10, %%mm3 \n\t"
"por %%mm3, %%mm0 \n\t"
MOVNTQ" %%mm0, (%0) \n\t"
"add $16, %1 \n\t"
"add $8, %0 \n\t"
"cmp %2, %1 \n\t"
" jb 1b \n\t"
: "+r" (d), "+r"(s)
: "r" (mm_end), "m" (mask3215g), "m" (mask3216br), "m" (mul3215)
);
#else
__asm __volatile(PREFETCH" %0"::"m"(*src):"memory");
__asm __volatile(
"movq %0, %%mm7\n\t"
"movq %1, %%mm6\n\t"
::"m"(red_15mask),"m"(green_15mask));
while(s < mm_end)
{
__asm __volatile(
PREFETCH" 32%1\n\t"
"movd %1, %%mm0\n\t"
"movd 4%1, %%mm3\n\t"
"punpckldq 8%1, %%mm0\n\t"
"punpckldq 12%1, %%mm3\n\t"
"movq %%mm0, %%mm1\n\t"
"movq %%mm0, %%mm2\n\t"
"movq %%mm3, %%mm4\n\t"
"movq %%mm3, %%mm5\n\t"
"psrlq $3, %%mm0\n\t"
"psrlq $3, %%mm3\n\t"
"pand %2, %%mm0\n\t"
"pand %2, %%mm3\n\t"
"psrlq $6, %%mm1\n\t"
"psrlq $6, %%mm4\n\t"
"pand %%mm6, %%mm1\n\t"
"pand %%mm6, %%mm4\n\t"
"psrlq $9, %%mm2\n\t"
"psrlq $9, %%mm5\n\t"
"pand %%mm7, %%mm2\n\t"
"pand %%mm7, %%mm5\n\t"
"por %%mm1, %%mm0\n\t"
"por %%mm4, %%mm3\n\t"
"por %%mm2, %%mm0\n\t"
"por %%mm5, %%mm3\n\t"
"psllq $16, %%mm3\n\t"
"por %%mm3, %%mm0\n\t"
MOVNTQ" %%mm0, %0\n\t"
:"=m"(*d):"m"(*s),"m"(blue_15mask):"memory");
d += 4;
s += 16;
}
#endif
__asm __volatile(SFENCE:::"memory");
__asm __volatile(EMMS:::"memory");
#endif
while(s < end)
{
register int rgb = *(uint32_t*)s; s += 4;
*d++ = ((rgb&0xFF)>>3) + ((rgb&0xF800)>>6) + ((rgb&0xF80000)>>9);
}
}
| false | FFmpeg | 4bff9ef9d0781c4de228bf1f85634d2706fc589b | static inline void RENAME(rgb32to15)(const uint8_t *src, uint8_t *dst, long src_size)
{
const uint8_t *s = src;
const uint8_t *end;
#ifdef HAVE_MMX
const uint8_t *mm_end;
#endif
uint16_t *d = (uint16_t *)dst;
end = s + src_size;
#ifdef HAVE_MMX
mm_end = end - 15;
#if 1
asm volatile(
"movq %3, %%mm5 \n\t"
"movq %4, %%mm6 \n\t"
"movq %5, %%mm7 \n\t"
ASMALIGN16
"1: \n\t"
PREFETCH" 32(%1) \n\t"
"movd (%1), %%mm0 \n\t"
"movd 4(%1), %%mm3 \n\t"
"punpckldq 8(%1), %%mm0 \n\t"
"punpckldq 12(%1), %%mm3 \n\t"
"movq %%mm0, %%mm1 \n\t"
"movq %%mm3, %%mm4 \n\t"
"pand %%mm6, %%mm0 \n\t"
"pand %%mm6, %%mm3 \n\t"
"pmaddwd %%mm7, %%mm0 \n\t"
"pmaddwd %%mm7, %%mm3 \n\t"
"pand %%mm5, %%mm1 \n\t"
"pand %%mm5, %%mm4 \n\t"
"por %%mm1, %%mm0 \n\t"
"por %%mm4, %%mm3 \n\t"
"psrld $6, %%mm0 \n\t"
"pslld $10, %%mm3 \n\t"
"por %%mm3, %%mm0 \n\t"
MOVNTQ" %%mm0, (%0) \n\t"
"add $16, %1 \n\t"
"add $8, %0 \n\t"
"cmp %2, %1 \n\t"
" jb 1b \n\t"
: "+r" (d), "+r"(s)
: "r" (mm_end), "m" (mask3215g), "m" (mask3216br), "m" (mul3215)
);
#else
__asm __volatile(PREFETCH" %0"::"m"(*src):"memory");
__asm __volatile(
"movq %0, %%mm7\n\t"
"movq %1, %%mm6\n\t"
::"m"(red_15mask),"m"(green_15mask));
while(s < mm_end)
{
__asm __volatile(
PREFETCH" 32%1\n\t"
"movd %1, %%mm0\n\t"
"movd 4%1, %%mm3\n\t"
"punpckldq 8%1, %%mm0\n\t"
"punpckldq 12%1, %%mm3\n\t"
"movq %%mm0, %%mm1\n\t"
"movq %%mm0, %%mm2\n\t"
"movq %%mm3, %%mm4\n\t"
"movq %%mm3, %%mm5\n\t"
"psrlq $3, %%mm0\n\t"
"psrlq $3, %%mm3\n\t"
"pand %2, %%mm0\n\t"
"pand %2, %%mm3\n\t"
"psrlq $6, %%mm1\n\t"
"psrlq $6, %%mm4\n\t"
"pand %%mm6, %%mm1\n\t"
"pand %%mm6, %%mm4\n\t"
"psrlq $9, %%mm2\n\t"
"psrlq $9, %%mm5\n\t"
"pand %%mm7, %%mm2\n\t"
"pand %%mm7, %%mm5\n\t"
"por %%mm1, %%mm0\n\t"
"por %%mm4, %%mm3\n\t"
"por %%mm2, %%mm0\n\t"
"por %%mm5, %%mm3\n\t"
"psllq $16, %%mm3\n\t"
"por %%mm3, %%mm0\n\t"
MOVNTQ" %%mm0, %0\n\t"
:"=m"(*d):"m"(*s),"m"(blue_15mask):"memory");
d += 4;
s += 16;
}
#endif
__asm __volatile(SFENCE:::"memory");
__asm __volatile(EMMS:::"memory");
#endif
while(s < end)
{
register int rgb = *(uint32_t*)s; s += 4;
*d++ = ((rgb&0xFF)>>3) + ((rgb&0xF800)>>6) + ((rgb&0xF80000)>>9);
}
}
| {
"code": [],
"line_no": []
} | static inline void FUNC_0(rgb32to15)(const uint8_t *src, uint8_t *dst, long src_size)
{
const uint8_t *VAR_0 = src;
const uint8_t *VAR_1;
#ifdef HAVE_MMX
const uint8_t *mm_end;
#endif
uint16_t *d = (uint16_t *)dst;
VAR_1 = VAR_0 + src_size;
#ifdef HAVE_MMX
mm_end = VAR_1 - 15;
#if 1
asm volatile(
"movq %3, %%mm5 \n\t"
"movq %4, %%mm6 \n\t"
"movq %5, %%mm7 \n\t"
ASMALIGN16
"1: \n\t"
PREFETCH" 32(%1) \n\t"
"movd (%1), %%mm0 \n\t"
"movd 4(%1), %%mm3 \n\t"
"punpckldq 8(%1), %%mm0 \n\t"
"punpckldq 12(%1), %%mm3 \n\t"
"movq %%mm0, %%mm1 \n\t"
"movq %%mm3, %%mm4 \n\t"
"pand %%mm6, %%mm0 \n\t"
"pand %%mm6, %%mm3 \n\t"
"pmaddwd %%mm7, %%mm0 \n\t"
"pmaddwd %%mm7, %%mm3 \n\t"
"pand %%mm5, %%mm1 \n\t"
"pand %%mm5, %%mm4 \n\t"
"por %%mm1, %%mm0 \n\t"
"por %%mm4, %%mm3 \n\t"
"psrld $6, %%mm0 \n\t"
"pslld $10, %%mm3 \n\t"
"por %%mm3, %%mm0 \n\t"
MOVNTQ" %%mm0, (%0) \n\t"
"add $16, %1 \n\t"
"add $8, %0 \n\t"
"cmp %2, %1 \n\t"
" jb 1b \n\t"
: "+r" (d), "+r"(VAR_0)
: "r" (mm_end), "m" (mask3215g), "m" (mask3216br), "m" (mul3215)
);
#else
__asm __volatile(PREFETCH" %0"::"m"(*src):"memory");
__asm __volatile(
"movq %0, %%mm7\n\t"
"movq %1, %%mm6\n\t"
::"m"(red_15mask),"m"(green_15mask));
while(VAR_0 < mm_end)
{
__asm __volatile(
PREFETCH" 32%1\n\t"
"movd %1, %%mm0\n\t"
"movd 4%1, %%mm3\n\t"
"punpckldq 8%1, %%mm0\n\t"
"punpckldq 12%1, %%mm3\n\t"
"movq %%mm0, %%mm1\n\t"
"movq %%mm0, %%mm2\n\t"
"movq %%mm3, %%mm4\n\t"
"movq %%mm3, %%mm5\n\t"
"psrlq $3, %%mm0\n\t"
"psrlq $3, %%mm3\n\t"
"pand %2, %%mm0\n\t"
"pand %2, %%mm3\n\t"
"psrlq $6, %%mm1\n\t"
"psrlq $6, %%mm4\n\t"
"pand %%mm6, %%mm1\n\t"
"pand %%mm6, %%mm4\n\t"
"psrlq $9, %%mm2\n\t"
"psrlq $9, %%mm5\n\t"
"pand %%mm7, %%mm2\n\t"
"pand %%mm7, %%mm5\n\t"
"por %%mm1, %%mm0\n\t"
"por %%mm4, %%mm3\n\t"
"por %%mm2, %%mm0\n\t"
"por %%mm5, %%mm3\n\t"
"psllq $16, %%mm3\n\t"
"por %%mm3, %%mm0\n\t"
MOVNTQ" %%mm0, %0\n\t"
:"=m"(*d):"m"(*VAR_0),"m"(blue_15mask):"memory");
d += 4;
VAR_0 += 16;
}
#endif
__asm __volatile(SFENCE:::"memory");
__asm __volatile(EMMS:::"memory");
#endif
while(VAR_0 < VAR_1)
{
register int VAR_2 = *(uint32_t*)VAR_0; VAR_0 += 4;
*d++ = ((VAR_2&0xFF)>>3) + ((VAR_2&0xF800)>>6) + ((VAR_2&0xF80000)>>9);
}
}
| [
"static inline void FUNC_0(rgb32to15)(const uint8_t *src, uint8_t *dst, long src_size)\n{",
"const uint8_t *VAR_0 = src;",
"const uint8_t *VAR_1;",
"#ifdef HAVE_MMX\nconst uint8_t *mm_end;",
"#endif\nuint16_t *d = (uint16_t *)dst;",
"VAR_1 = VAR_0 + src_size;",
"#ifdef HAVE_MMX\nmm_end = VAR_1 - 15;",
"#if 1\nasm volatile(\n\"movq %3, %%mm5\t\t\t\\n\\t\"\n\"movq %4, %%mm6\t\t\t\\n\\t\"\n\"movq %5, %%mm7\t\t\t\\n\\t\"\nASMALIGN16\n\"1:\t\t\t\t\\n\\t\"\nPREFETCH\" 32(%1)\t\t\\n\\t\"\n\"movd\t(%1), %%mm0\t\t\\n\\t\"\n\"movd\t4(%1), %%mm3\t\t\\n\\t\"\n\"punpckldq 8(%1), %%mm0\t\t\\n\\t\"\n\"punpckldq 12(%1), %%mm3\t\\n\\t\"\n\"movq %%mm0, %%mm1\t\t\\n\\t\"\n\"movq %%mm3, %%mm4\t\t\\n\\t\"\n\"pand %%mm6, %%mm0\t\t\\n\\t\"\n\"pand %%mm6, %%mm3\t\t\\n\\t\"\n\"pmaddwd %%mm7, %%mm0\t\t\\n\\t\"\n\"pmaddwd %%mm7, %%mm3\t\t\\n\\t\"\n\"pand %%mm5, %%mm1\t\t\\n\\t\"\n\"pand %%mm5, %%mm4\t\t\\n\\t\"\n\"por %%mm1, %%mm0\t\t\\n\\t\"\n\"por %%mm4, %%mm3\t\t\\n\\t\"\n\"psrld $6, %%mm0\t\t\\n\\t\"\n\"pslld $10, %%mm3\t\t\\n\\t\"\n\"por %%mm3, %%mm0\t\t\\n\\t\"\nMOVNTQ\"\t%%mm0, (%0)\t\t\\n\\t\"\n\"add $16, %1\t\t\t\\n\\t\"\n\"add $8, %0\t\t\t\\n\\t\"\n\"cmp %2, %1\t\t\t\\n\\t\"\n\" jb 1b\t\t\t\t\\n\\t\"\n: \"+r\" (d), \"+r\"(VAR_0)\n: \"r\" (mm_end), \"m\" (mask3215g), \"m\" (mask3216br), \"m\" (mul3215)\n);",
"#else\n__asm __volatile(PREFETCH\"\t%0\"::\"m\"(*src):\"memory\");",
"__asm __volatile(\n\"movq\t%0, %%mm7\\n\\t\"\n\"movq\t%1, %%mm6\\n\\t\"\n::\"m\"(red_15mask),\"m\"(green_15mask));",
"while(VAR_0 < mm_end)\n{",
"__asm __volatile(\nPREFETCH\" 32%1\\n\\t\"\n\"movd\t%1, %%mm0\\n\\t\"\n\"movd\t4%1, %%mm3\\n\\t\"\n\"punpckldq 8%1, %%mm0\\n\\t\"\n\"punpckldq 12%1, %%mm3\\n\\t\"\n\"movq\t%%mm0, %%mm1\\n\\t\"\n\"movq\t%%mm0, %%mm2\\n\\t\"\n\"movq\t%%mm3, %%mm4\\n\\t\"\n\"movq\t%%mm3, %%mm5\\n\\t\"\n\"psrlq\t$3, %%mm0\\n\\t\"\n\"psrlq\t$3, %%mm3\\n\\t\"\n\"pand\t%2, %%mm0\\n\\t\"\n\"pand\t%2, %%mm3\\n\\t\"\n\"psrlq\t$6, %%mm1\\n\\t\"\n\"psrlq\t$6, %%mm4\\n\\t\"\n\"pand\t%%mm6, %%mm1\\n\\t\"\n\"pand\t%%mm6, %%mm4\\n\\t\"\n\"psrlq\t$9, %%mm2\\n\\t\"\n\"psrlq\t$9, %%mm5\\n\\t\"\n\"pand\t%%mm7, %%mm2\\n\\t\"\n\"pand\t%%mm7, %%mm5\\n\\t\"\n\"por\t%%mm1, %%mm0\\n\\t\"\n\"por\t%%mm4, %%mm3\\n\\t\"\n\"por\t%%mm2, %%mm0\\n\\t\"\n\"por\t%%mm5, %%mm3\\n\\t\"\n\"psllq\t$16, %%mm3\\n\\t\"\n\"por\t%%mm3, %%mm0\\n\\t\"\nMOVNTQ\"\t%%mm0, %0\\n\\t\"\n:\"=m\"(*d):\"m\"(*VAR_0),\"m\"(blue_15mask):\"memory\");",
"d += 4;",
"VAR_0 += 16;",
"}",
"#endif\n__asm __volatile(SFENCE:::\"memory\");",
"__asm __volatile(EMMS:::\"memory\");",
"#endif\nwhile(VAR_0 < VAR_1)\n{",
"register int VAR_2 = *(uint32_t*)VAR_0; VAR_0 += 4;",
"*d++ = ((VAR_2&0xFF)>>3) + ((VAR_2&0xF800)>>6) + ((VAR_2&0xF80000)>>9);",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9,
11
],
[
13,
15
],
[
17
],
[
19,
21
],
[
23,
25,
27,
29,
31,
33,
35,
37,
39,
41,
43,
45,
47,
49,
51,
53,
55,
57,
59,
61,
63,
65,
67,
69,
71,
73,
75,
77,
79,
81,
83,
85,
87
],
[
89,
91
],
[
93,
95,
97,
99
],
[
101,
103
],
[
105,
107,
109,
111,
113,
115,
117,
119,
121,
123,
125,
127,
129,
131,
133,
135,
137,
139,
141,
143,
145,
147,
149,
151,
153,
155,
157,
159,
161,
163
],
[
165
],
[
167
],
[
169
],
[
171,
173
],
[
175
],
[
177,
179,
181
],
[
183
],
[
185
],
[
187
],
[
189
]
]
|
12,400 | static int source_request_frame(AVFilterLink *outlink)
{
Frei0rContext *frei0r = outlink->src->priv;
AVFilterBufferRef *picref = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
int ret;
picref->video->pixel_aspect = (AVRational) {1, 1};
picref->pts = frei0r->pts++;
picref->pos = -1;
ret = ff_start_frame(outlink, avfilter_ref_buffer(picref, ~0));
if (ret < 0)
goto fail;
frei0r->update(frei0r->instance, av_rescale_q(picref->pts, frei0r->time_base, (AVRational){1,1000}),
NULL, (uint32_t *)picref->data[0]);
ret = ff_draw_slice(outlink, 0, outlink->h, 1);
if (ret < 0)
goto fail;
ret = ff_end_frame(outlink);
fail:
avfilter_unref_buffer(picref);
return ret;
}
| false | FFmpeg | 1dc42050185d63c1de5d16146fbaee92640af187 | static int source_request_frame(AVFilterLink *outlink)
{
Frei0rContext *frei0r = outlink->src->priv;
AVFilterBufferRef *picref = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
int ret;
picref->video->pixel_aspect = (AVRational) {1, 1};
picref->pts = frei0r->pts++;
picref->pos = -1;
ret = ff_start_frame(outlink, avfilter_ref_buffer(picref, ~0));
if (ret < 0)
goto fail;
frei0r->update(frei0r->instance, av_rescale_q(picref->pts, frei0r->time_base, (AVRational){1,1000}),
NULL, (uint32_t *)picref->data[0]);
ret = ff_draw_slice(outlink, 0, outlink->h, 1);
if (ret < 0)
goto fail;
ret = ff_end_frame(outlink);
fail:
avfilter_unref_buffer(picref);
return ret;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(AVFilterLink *VAR_0)
{
Frei0rContext *frei0r = VAR_0->src->priv;
AVFilterBufferRef *picref = ff_get_video_buffer(VAR_0, AV_PERM_WRITE, VAR_0->w, VAR_0->h);
int VAR_1;
picref->video->pixel_aspect = (AVRational) {1, 1};
picref->pts = frei0r->pts++;
picref->pos = -1;
VAR_1 = ff_start_frame(VAR_0, avfilter_ref_buffer(picref, ~0));
if (VAR_1 < 0)
goto fail;
frei0r->update(frei0r->instance, av_rescale_q(picref->pts, frei0r->time_base, (AVRational){1,1000}),
NULL, (uint32_t *)picref->data[0]);
VAR_1 = ff_draw_slice(VAR_0, 0, VAR_0->h, 1);
if (VAR_1 < 0)
goto fail;
VAR_1 = ff_end_frame(VAR_0);
fail:
avfilter_unref_buffer(picref);
return VAR_1;
}
| [
"static int FUNC_0(AVFilterLink *VAR_0)\n{",
"Frei0rContext *frei0r = VAR_0->src->priv;",
"AVFilterBufferRef *picref = ff_get_video_buffer(VAR_0, AV_PERM_WRITE, VAR_0->w, VAR_0->h);",
"int VAR_1;",
"picref->video->pixel_aspect = (AVRational) {1, 1};",
"picref->pts = frei0r->pts++;",
"picref->pos = -1;",
"VAR_1 = ff_start_frame(VAR_0, avfilter_ref_buffer(picref, ~0));",
"if (VAR_1 < 0)\ngoto fail;",
"frei0r->update(frei0r->instance, av_rescale_q(picref->pts, frei0r->time_base, (AVRational){1,1000}),",
"NULL, (uint32_t *)picref->data[0]);",
"VAR_1 = ff_draw_slice(VAR_0, 0, VAR_0->h, 1);",
"if (VAR_1 < 0)\ngoto fail;",
"VAR_1 = ff_end_frame(VAR_0);",
"fail:\navfilter_unref_buffer(picref);",
"return VAR_1;",
"}"
]
| [
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
],
[
29
],
[
31
],
[
33
],
[
35,
37
],
[
41
],
[
45,
47
],
[
51
],
[
53
]
]
|
12,401 | static int vmdk_is_allocated(BlockDriverState *bs, int64_t sector_num,
int nb_sectors, int *pnum)
{
BDRVVmdkState *s = bs->opaque;
int index_in_cluster, n;
uint64_t cluster_offset;
cluster_offset = get_cluster_offset(bs, sector_num << 9, 0);
index_in_cluster = sector_num % s->cluster_sectors;
n = s->cluster_sectors - index_in_cluster;
if (n > nb_sectors)
n = nb_sectors;
*pnum = n;
return (cluster_offset != 0);
}
| true | qemu | 630530a6529bc3da9ab8aead7053dc753cb9ac77 | static int vmdk_is_allocated(BlockDriverState *bs, int64_t sector_num,
int nb_sectors, int *pnum)
{
BDRVVmdkState *s = bs->opaque;
int index_in_cluster, n;
uint64_t cluster_offset;
cluster_offset = get_cluster_offset(bs, sector_num << 9, 0);
index_in_cluster = sector_num % s->cluster_sectors;
n = s->cluster_sectors - index_in_cluster;
if (n > nb_sectors)
n = nb_sectors;
*pnum = n;
return (cluster_offset != 0);
}
| {
"code": [
" cluster_offset = get_cluster_offset(bs, sector_num << 9, 0);"
],
"line_no": [
15
]
} | static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1,
int VAR_2, int *VAR_3)
{
BDRVVmdkState *s = VAR_0->opaque;
int VAR_4, VAR_5;
uint64_t cluster_offset;
cluster_offset = get_cluster_offset(VAR_0, VAR_1 << 9, 0);
VAR_4 = VAR_1 % s->cluster_sectors;
VAR_5 = s->cluster_sectors - VAR_4;
if (VAR_5 > VAR_2)
VAR_5 = VAR_2;
*VAR_3 = VAR_5;
return (cluster_offset != 0);
}
| [
"static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1,\nint VAR_2, int *VAR_3)\n{",
"BDRVVmdkState *s = VAR_0->opaque;",
"int VAR_4, VAR_5;",
"uint64_t cluster_offset;",
"cluster_offset = get_cluster_offset(VAR_0, VAR_1 << 9, 0);",
"VAR_4 = VAR_1 % s->cluster_sectors;",
"VAR_5 = s->cluster_sectors - VAR_4;",
"if (VAR_5 > VAR_2)\nVAR_5 = VAR_2;",
"*VAR_3 = VAR_5;",
"return (cluster_offset != 0);",
"}"
]
| [
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
19
],
[
21,
23
],
[
25
],
[
27
],
[
29
]
]
|
12,403 | void put_vp8_epel_h_altivec_core(uint8_t *dst, int dst_stride,
uint8_t *src, int src_stride,
int h, int mx, int w, int is6tap)
{
LOAD_H_SUBPEL_FILTER(mx-1);
vec_u8 align_vec0, align_vec8, permh0, permh8, filt;
vec_u8 perm_6tap0, perm_6tap8, perml0, perml8;
vec_u8 a, b, pixh, pixl, outer;
vec_s16 f16h, f16l;
vec_s32 filth, filtl;
vec_u8 perm_inner = { 1,2,3,4, 2,3,4,5, 3,4,5,6, 4,5,6,7 };
vec_u8 perm_outer = { 4,9, 0,5, 5,10, 1,6, 6,11, 2,7, 7,12, 3,8 };
vec_s32 c64 = vec_sl(vec_splat_s32(1), vec_splat_u32(6));
vec_u16 c7 = vec_splat_u16(7);
align_vec0 = vec_lvsl( -2, src);
align_vec8 = vec_lvsl(8-2, src);
permh0 = vec_perm(align_vec0, align_vec0, perm_inner);
permh8 = vec_perm(align_vec8, align_vec8, perm_inner);
perm_inner = vec_add(perm_inner, vec_splat_u8(4));
perml0 = vec_perm(align_vec0, align_vec0, perm_inner);
perml8 = vec_perm(align_vec8, align_vec8, perm_inner);
perm_6tap0 = vec_perm(align_vec0, align_vec0, perm_outer);
perm_6tap8 = vec_perm(align_vec8, align_vec8, perm_outer);
while (h --> 0) {
FILTER_H(f16h, 0);
if (w == 16) {
FILTER_H(f16l, 8);
filt = vec_packsu(f16h, f16l);
vec_st(filt, 0, dst);
} else {
filt = vec_packsu(f16h, f16h);
vec_ste((vec_u32)filt, 0, (uint32_t*)dst);
if (w == 8)
vec_ste((vec_u32)filt, 4, (uint32_t*)dst);
}
src += src_stride;
dst += dst_stride;
}
}
| true | FFmpeg | e0e46cae377347cbe1cd27c0d85568921b12c2ad | void put_vp8_epel_h_altivec_core(uint8_t *dst, int dst_stride,
uint8_t *src, int src_stride,
int h, int mx, int w, int is6tap)
{
LOAD_H_SUBPEL_FILTER(mx-1);
vec_u8 align_vec0, align_vec8, permh0, permh8, filt;
vec_u8 perm_6tap0, perm_6tap8, perml0, perml8;
vec_u8 a, b, pixh, pixl, outer;
vec_s16 f16h, f16l;
vec_s32 filth, filtl;
vec_u8 perm_inner = { 1,2,3,4, 2,3,4,5, 3,4,5,6, 4,5,6,7 };
vec_u8 perm_outer = { 4,9, 0,5, 5,10, 1,6, 6,11, 2,7, 7,12, 3,8 };
vec_s32 c64 = vec_sl(vec_splat_s32(1), vec_splat_u32(6));
vec_u16 c7 = vec_splat_u16(7);
align_vec0 = vec_lvsl( -2, src);
align_vec8 = vec_lvsl(8-2, src);
permh0 = vec_perm(align_vec0, align_vec0, perm_inner);
permh8 = vec_perm(align_vec8, align_vec8, perm_inner);
perm_inner = vec_add(perm_inner, vec_splat_u8(4));
perml0 = vec_perm(align_vec0, align_vec0, perm_inner);
perml8 = vec_perm(align_vec8, align_vec8, perm_inner);
perm_6tap0 = vec_perm(align_vec0, align_vec0, perm_outer);
perm_6tap8 = vec_perm(align_vec8, align_vec8, perm_outer);
while (h --> 0) {
FILTER_H(f16h, 0);
if (w == 16) {
FILTER_H(f16l, 8);
filt = vec_packsu(f16h, f16l);
vec_st(filt, 0, dst);
} else {
filt = vec_packsu(f16h, f16h);
vec_ste((vec_u32)filt, 0, (uint32_t*)dst);
if (w == 8)
vec_ste((vec_u32)filt, 4, (uint32_t*)dst);
}
src += src_stride;
dst += dst_stride;
}
}
| {
"code": [
" vec_u8 perm_inner = { 1,2,3,4, 2,3,4,5, 3,4,5,6, 4,5,6,7 };",
" align_vec0 = vec_lvsl( -2, src);",
" align_vec8 = vec_lvsl(8-2, src);"
],
"line_no": [
23,
33,
35
]
} | void FUNC_0(uint8_t *VAR_0, int VAR_1,
uint8_t *VAR_2, int VAR_3,
int VAR_4, int VAR_5, int VAR_6, int VAR_7)
{
LOAD_H_SUBPEL_FILTER(VAR_5-1);
vec_u8 align_vec0, align_vec8, permh0, permh8, filt;
vec_u8 perm_6tap0, perm_6tap8, perml0, perml8;
vec_u8 a, b, pixh, pixl, outer;
vec_s16 f16h, f16l;
vec_s32 filth, filtl;
vec_u8 perm_inner = { 1,2,3,4, 2,3,4,5, 3,4,5,6, 4,5,6,7 };
vec_u8 perm_outer = { 4,9, 0,5, 5,10, 1,6, 6,11, 2,7, 7,12, 3,8 };
vec_s32 c64 = vec_sl(vec_splat_s32(1), vec_splat_u32(6));
vec_u16 c7 = vec_splat_u16(7);
align_vec0 = vec_lvsl( -2, VAR_2);
align_vec8 = vec_lvsl(8-2, VAR_2);
permh0 = vec_perm(align_vec0, align_vec0, perm_inner);
permh8 = vec_perm(align_vec8, align_vec8, perm_inner);
perm_inner = vec_add(perm_inner, vec_splat_u8(4));
perml0 = vec_perm(align_vec0, align_vec0, perm_inner);
perml8 = vec_perm(align_vec8, align_vec8, perm_inner);
perm_6tap0 = vec_perm(align_vec0, align_vec0, perm_outer);
perm_6tap8 = vec_perm(align_vec8, align_vec8, perm_outer);
while (VAR_4 --> 0) {
FILTER_H(f16h, 0);
if (VAR_6 == 16) {
FILTER_H(f16l, 8);
filt = vec_packsu(f16h, f16l);
vec_st(filt, 0, VAR_0);
} else {
filt = vec_packsu(f16h, f16h);
vec_ste((vec_u32)filt, 0, (uint32_t*)VAR_0);
if (VAR_6 == 8)
vec_ste((vec_u32)filt, 4, (uint32_t*)VAR_0);
}
VAR_2 += VAR_3;
VAR_0 += VAR_1;
}
}
| [
"void FUNC_0(uint8_t *VAR_0, int VAR_1,\nuint8_t *VAR_2, int VAR_3,\nint VAR_4, int VAR_5, int VAR_6, int VAR_7)\n{",
"LOAD_H_SUBPEL_FILTER(VAR_5-1);",
"vec_u8 align_vec0, align_vec8, permh0, permh8, filt;",
"vec_u8 perm_6tap0, perm_6tap8, perml0, perml8;",
"vec_u8 a, b, pixh, pixl, outer;",
"vec_s16 f16h, f16l;",
"vec_s32 filth, filtl;",
"vec_u8 perm_inner = { 1,2,3,4, 2,3,4,5, 3,4,5,6, 4,5,6,7 };",
"vec_u8 perm_outer = { 4,9, 0,5, 5,10, 1,6, 6,11, 2,7, 7,12, 3,8 };",
"vec_s32 c64 = vec_sl(vec_splat_s32(1), vec_splat_u32(6));",
"vec_u16 c7 = vec_splat_u16(7);",
"align_vec0 = vec_lvsl( -2, VAR_2);",
"align_vec8 = vec_lvsl(8-2, VAR_2);",
"permh0 = vec_perm(align_vec0, align_vec0, perm_inner);",
"permh8 = vec_perm(align_vec8, align_vec8, perm_inner);",
"perm_inner = vec_add(perm_inner, vec_splat_u8(4));",
"perml0 = vec_perm(align_vec0, align_vec0, perm_inner);",
"perml8 = vec_perm(align_vec8, align_vec8, perm_inner);",
"perm_6tap0 = vec_perm(align_vec0, align_vec0, perm_outer);",
"perm_6tap8 = vec_perm(align_vec8, align_vec8, perm_outer);",
"while (VAR_4 --> 0) {",
"FILTER_H(f16h, 0);",
"if (VAR_6 == 16) {",
"FILTER_H(f16l, 8);",
"filt = vec_packsu(f16h, f16l);",
"vec_st(filt, 0, VAR_0);",
"} else {",
"filt = vec_packsu(f16h, f16h);",
"vec_ste((vec_u32)filt, 0, (uint32_t*)VAR_0);",
"if (VAR_6 == 8)\nvec_ste((vec_u32)filt, 4, (uint32_t*)VAR_0);",
"}",
"VAR_2 += VAR_3;",
"VAR_0 += VAR_1;",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
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
]
| [
[
1,
3,
5,
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
55
],
[
57
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75,
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
]
]
|
12,404 | static int mpidr_read(CPUARMState *env, const ARMCPRegInfo *ri,
uint64_t *value)
{
CPUState *cs = CPU(arm_env_get_cpu(env));
uint32_t mpidr = cs->cpu_index;
/* We don't support setting cluster ID ([8..11])
* so these bits always RAZ.
*/
if (arm_feature(env, ARM_FEATURE_V7MP)) {
mpidr |= (1 << 31);
/* Cores which are uniprocessor (non-coherent)
* but still implement the MP extensions set
* bit 30. (For instance, A9UP.) However we do
* not currently model any of those cores.
*/
}
*value = mpidr;
return 0;
}
| true | qemu | 78dbbbe4dff95369c63bf77ee0df23371e1d6602 | static int mpidr_read(CPUARMState *env, const ARMCPRegInfo *ri,
uint64_t *value)
{
CPUState *cs = CPU(arm_env_get_cpu(env));
uint32_t mpidr = cs->cpu_index;
if (arm_feature(env, ARM_FEATURE_V7MP)) {
mpidr |= (1 << 31);
}
*value = mpidr;
return 0;
}
| {
"code": [
" mpidr |= (1 << 31);"
],
"line_no": [
19
]
} | static int FUNC_0(CPUARMState *VAR_0, const ARMCPRegInfo *VAR_1,
uint64_t *VAR_2)
{
CPUState *cs = CPU(arm_env_get_cpu(VAR_0));
uint32_t mpidr = cs->cpu_index;
if (arm_feature(VAR_0, ARM_FEATURE_V7MP)) {
mpidr |= (1 << 31);
}
*VAR_2 = mpidr;
return 0;
}
| [
"static int FUNC_0(CPUARMState *VAR_0, const ARMCPRegInfo *VAR_1,\nuint64_t *VAR_2)\n{",
"CPUState *cs = CPU(arm_env_get_cpu(VAR_0));",
"uint32_t mpidr = cs->cpu_index;",
"if (arm_feature(VAR_0, ARM_FEATURE_V7MP)) {",
"mpidr |= (1 << 31);",
"}",
"*VAR_2 = mpidr;",
"return 0;",
"}"
]
| [
0,
0,
0,
0,
1,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
17
],
[
19
],
[
31
],
[
33
],
[
35
],
[
37
]
]
|
12,405 | void cpu_loop (CPUSPARCState *env)
{
int trapnr, ret;
target_siginfo_t info;
while (1) {
trapnr = cpu_sparc_exec (env);
switch (trapnr) {
#ifndef TARGET_SPARC64
case 0x88:
case 0x90:
#else
case 0x110:
case 0x16d:
#endif
ret = do_syscall (env, env->gregs[1],
env->regwptr[0], env->regwptr[1],
env->regwptr[2], env->regwptr[3],
env->regwptr[4], env->regwptr[5]);
if ((unsigned int)ret >= (unsigned int)(-515)) {
#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
env->xcc |= PSR_CARRY;
#else
env->psr |= PSR_CARRY;
#endif
ret = -ret;
} else {
#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
env->xcc &= ~PSR_CARRY;
#else
env->psr &= ~PSR_CARRY;
#endif
}
env->regwptr[0] = ret;
/* next instruction */
env->pc = env->npc;
env->npc = env->npc + 4;
break;
case 0x83: /* flush windows */
#ifdef TARGET_ABI32
case 0x103:
#endif
flush_windows(env);
/* next instruction */
env->pc = env->npc;
env->npc = env->npc + 4;
break;
#ifndef TARGET_SPARC64
case TT_WIN_OVF: /* window overflow */
save_window(env);
break;
case TT_WIN_UNF: /* window underflow */
restore_window(env);
break;
case TT_TFAULT:
case TT_DFAULT:
{
info.si_signo = SIGSEGV;
info.si_errno = 0;
/* XXX: check env->error_code */
info.si_code = TARGET_SEGV_MAPERR;
info._sifields._sigfault._addr = env->mmuregs[4];
queue_signal(env, info.si_signo, &info);
}
break;
#else
case TT_SPILL: /* window overflow */
save_window(env);
break;
case TT_FILL: /* window underflow */
restore_window(env);
break;
case TT_TFAULT:
case TT_DFAULT:
{
info.si_signo = SIGSEGV;
info.si_errno = 0;
/* XXX: check env->error_code */
info.si_code = TARGET_SEGV_MAPERR;
if (trapnr == TT_DFAULT)
info._sifields._sigfault._addr = env->dmmuregs[4];
else
info._sifields._sigfault._addr = env->tsptr->tpc;
queue_signal(env, info.si_signo, &info);
}
break;
#ifndef TARGET_ABI32
case 0x16e:
flush_windows(env);
sparc64_get_context(env);
break;
case 0x16f:
flush_windows(env);
sparc64_set_context(env);
break;
#endif
#endif
case EXCP_INTERRUPT:
/* just indicate that signals should be handled asap */
break;
case EXCP_DEBUG:
{
int sig;
sig = gdb_handlesig (env, TARGET_SIGTRAP);
if (sig)
{
info.si_signo = sig;
info.si_errno = 0;
info.si_code = TARGET_TRAP_BRKPT;
queue_signal(env, info.si_signo, &info);
}
}
break;
default:
printf ("Unhandled trap: 0x%x\n", trapnr);
cpu_dump_state(env, stderr, fprintf, 0);
exit (1);
}
process_pending_signals (env);
}
}
| true | qemu | 8194f35a0c71a3bf169459bf715bea53b7bbc904 | void cpu_loop (CPUSPARCState *env)
{
int trapnr, ret;
target_siginfo_t info;
while (1) {
trapnr = cpu_sparc_exec (env);
switch (trapnr) {
#ifndef TARGET_SPARC64
case 0x88:
case 0x90:
#else
case 0x110:
case 0x16d:
#endif
ret = do_syscall (env, env->gregs[1],
env->regwptr[0], env->regwptr[1],
env->regwptr[2], env->regwptr[3],
env->regwptr[4], env->regwptr[5]);
if ((unsigned int)ret >= (unsigned int)(-515)) {
#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
env->xcc |= PSR_CARRY;
#else
env->psr |= PSR_CARRY;
#endif
ret = -ret;
} else {
#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
env->xcc &= ~PSR_CARRY;
#else
env->psr &= ~PSR_CARRY;
#endif
}
env->regwptr[0] = ret;
env->pc = env->npc;
env->npc = env->npc + 4;
break;
case 0x83:
#ifdef TARGET_ABI32
case 0x103:
#endif
flush_windows(env);
env->pc = env->npc;
env->npc = env->npc + 4;
break;
#ifndef TARGET_SPARC64
case TT_WIN_OVF:
save_window(env);
break;
case TT_WIN_UNF:
restore_window(env);
break;
case TT_TFAULT:
case TT_DFAULT:
{
info.si_signo = SIGSEGV;
info.si_errno = 0;
info.si_code = TARGET_SEGV_MAPERR;
info._sifields._sigfault._addr = env->mmuregs[4];
queue_signal(env, info.si_signo, &info);
}
break;
#else
case TT_SPILL:
save_window(env);
break;
case TT_FILL:
restore_window(env);
break;
case TT_TFAULT:
case TT_DFAULT:
{
info.si_signo = SIGSEGV;
info.si_errno = 0;
info.si_code = TARGET_SEGV_MAPERR;
if (trapnr == TT_DFAULT)
info._sifields._sigfault._addr = env->dmmuregs[4];
else
info._sifields._sigfault._addr = env->tsptr->tpc;
queue_signal(env, info.si_signo, &info);
}
break;
#ifndef TARGET_ABI32
case 0x16e:
flush_windows(env);
sparc64_get_context(env);
break;
case 0x16f:
flush_windows(env);
sparc64_set_context(env);
break;
#endif
#endif
case EXCP_INTERRUPT:
break;
case EXCP_DEBUG:
{
int sig;
sig = gdb_handlesig (env, TARGET_SIGTRAP);
if (sig)
{
info.si_signo = sig;
info.si_errno = 0;
info.si_code = TARGET_TRAP_BRKPT;
queue_signal(env, info.si_signo, &info);
}
}
break;
default:
printf ("Unhandled trap: 0x%x\n", trapnr);
cpu_dump_state(env, stderr, fprintf, 0);
exit (1);
}
process_pending_signals (env);
}
}
| {
"code": [
" info._sifields._sigfault._addr = env->tsptr->tpc;"
],
"line_no": [
167
]
} | void FUNC_0 (CPUSPARCState *VAR_0)
{
int VAR_1, VAR_2;
target_siginfo_t info;
while (1) {
VAR_1 = cpu_sparc_exec (VAR_0);
switch (VAR_1) {
#ifndef TARGET_SPARC64
case 0x88:
case 0x90:
#else
case 0x110:
case 0x16d:
#endif
VAR_2 = do_syscall (VAR_0, VAR_0->gregs[1],
VAR_0->regwptr[0], VAR_0->regwptr[1],
VAR_0->regwptr[2], VAR_0->regwptr[3],
VAR_0->regwptr[4], VAR_0->regwptr[5]);
if ((unsigned int)VAR_2 >= (unsigned int)(-515)) {
#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
VAR_0->xcc |= PSR_CARRY;
#else
VAR_0->psr |= PSR_CARRY;
#endif
VAR_2 = -VAR_2;
} else {
#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
VAR_0->xcc &= ~PSR_CARRY;
#else
VAR_0->psr &= ~PSR_CARRY;
#endif
}
VAR_0->regwptr[0] = VAR_2;
VAR_0->pc = VAR_0->npc;
VAR_0->npc = VAR_0->npc + 4;
break;
case 0x83:
#ifdef TARGET_ABI32
case 0x103:
#endif
flush_windows(VAR_0);
VAR_0->pc = VAR_0->npc;
VAR_0->npc = VAR_0->npc + 4;
break;
#ifndef TARGET_SPARC64
case TT_WIN_OVF:
save_window(VAR_0);
break;
case TT_WIN_UNF:
restore_window(VAR_0);
break;
case TT_TFAULT:
case TT_DFAULT:
{
info.si_signo = SIGSEGV;
info.si_errno = 0;
info.si_code = TARGET_SEGV_MAPERR;
info._sifields._sigfault._addr = VAR_0->mmuregs[4];
queue_signal(VAR_0, info.si_signo, &info);
}
break;
#else
case TT_SPILL:
save_window(VAR_0);
break;
case TT_FILL:
restore_window(VAR_0);
break;
case TT_TFAULT:
case TT_DFAULT:
{
info.si_signo = SIGSEGV;
info.si_errno = 0;
info.si_code = TARGET_SEGV_MAPERR;
if (VAR_1 == TT_DFAULT)
info._sifields._sigfault._addr = VAR_0->dmmuregs[4];
else
info._sifields._sigfault._addr = VAR_0->tsptr->tpc;
queue_signal(VAR_0, info.si_signo, &info);
}
break;
#ifndef TARGET_ABI32
case 0x16e:
flush_windows(VAR_0);
sparc64_get_context(VAR_0);
break;
case 0x16f:
flush_windows(VAR_0);
sparc64_set_context(VAR_0);
break;
#endif
#endif
case EXCP_INTERRUPT:
break;
case EXCP_DEBUG:
{
int VAR_3;
VAR_3 = gdb_handlesig (VAR_0, TARGET_SIGTRAP);
if (VAR_3)
{
info.si_signo = VAR_3;
info.si_errno = 0;
info.si_code = TARGET_TRAP_BRKPT;
queue_signal(VAR_0, info.si_signo, &info);
}
}
break;
default:
printf ("Unhandled trap: 0x%x\n", VAR_1);
cpu_dump_state(VAR_0, stderr, fprintf, 0);
exit (1);
}
process_pending_signals (VAR_0);
}
}
| [
"void FUNC_0 (CPUSPARCState *VAR_0)\n{",
"int VAR_1, VAR_2;",
"target_siginfo_t info;",
"while (1) {",
"VAR_1 = cpu_sparc_exec (VAR_0);",
"switch (VAR_1) {",
"#ifndef TARGET_SPARC64\ncase 0x88:\ncase 0x90:\n#else\ncase 0x110:\ncase 0x16d:\n#endif\nVAR_2 = do_syscall (VAR_0, VAR_0->gregs[1],\nVAR_0->regwptr[0], VAR_0->regwptr[1],\nVAR_0->regwptr[2], VAR_0->regwptr[3],\nVAR_0->regwptr[4], VAR_0->regwptr[5]);",
"if ((unsigned int)VAR_2 >= (unsigned int)(-515)) {",
"#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)\nVAR_0->xcc |= PSR_CARRY;",
"#else\nVAR_0->psr |= PSR_CARRY;",
"#endif\nVAR_2 = -VAR_2;",
"} else {",
"#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)\nVAR_0->xcc &= ~PSR_CARRY;",
"#else\nVAR_0->psr &= ~PSR_CARRY;",
"#endif\n}",
"VAR_0->regwptr[0] = VAR_2;",
"VAR_0->pc = VAR_0->npc;",
"VAR_0->npc = VAR_0->npc + 4;",
"break;",
"case 0x83:\n#ifdef TARGET_ABI32\ncase 0x103:\n#endif\nflush_windows(VAR_0);",
"VAR_0->pc = VAR_0->npc;",
"VAR_0->npc = VAR_0->npc + 4;",
"break;",
"#ifndef TARGET_SPARC64\ncase TT_WIN_OVF:\nsave_window(VAR_0);",
"break;",
"case TT_WIN_UNF:\nrestore_window(VAR_0);",
"break;",
"case TT_TFAULT:\ncase TT_DFAULT:\n{",
"info.si_signo = SIGSEGV;",
"info.si_errno = 0;",
"info.si_code = TARGET_SEGV_MAPERR;",
"info._sifields._sigfault._addr = VAR_0->mmuregs[4];",
"queue_signal(VAR_0, info.si_signo, &info);",
"}",
"break;",
"#else\ncase TT_SPILL:\nsave_window(VAR_0);",
"break;",
"case TT_FILL:\nrestore_window(VAR_0);",
"break;",
"case TT_TFAULT:\ncase TT_DFAULT:\n{",
"info.si_signo = SIGSEGV;",
"info.si_errno = 0;",
"info.si_code = TARGET_SEGV_MAPERR;",
"if (VAR_1 == TT_DFAULT)\ninfo._sifields._sigfault._addr = VAR_0->dmmuregs[4];",
"else\ninfo._sifields._sigfault._addr = VAR_0->tsptr->tpc;",
"queue_signal(VAR_0, info.si_signo, &info);",
"}",
"break;",
"#ifndef TARGET_ABI32\ncase 0x16e:\nflush_windows(VAR_0);",
"sparc64_get_context(VAR_0);",
"break;",
"case 0x16f:\nflush_windows(VAR_0);",
"sparc64_set_context(VAR_0);",
"break;",
"#endif\n#endif\ncase EXCP_INTERRUPT:\nbreak;",
"case EXCP_DEBUG:\n{",
"int VAR_3;",
"VAR_3 = gdb_handlesig (VAR_0, TARGET_SIGTRAP);",
"if (VAR_3)\n{",
"info.si_signo = VAR_3;",
"info.si_errno = 0;",
"info.si_code = TARGET_TRAP_BRKPT;",
"queue_signal(VAR_0, info.si_signo, &info);",
"}",
"}",
"break;",
"default:\nprintf (\"Unhandled trap: 0x%x\\n\", VAR_1);",
"cpu_dump_state(VAR_0, stderr, fprintf, 0);",
"exit (1);",
"}",
"process_pending_signals (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,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
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
],
[
73
],
[
75
],
[
77
],
[
79,
81,
83,
85,
87
],
[
91
],
[
93
],
[
95
],
[
97,
99,
101
],
[
103
],
[
105,
107
],
[
109
],
[
111,
113,
115
],
[
117
],
[
119
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133,
135,
137
],
[
139
],
[
141,
143
],
[
145
],
[
147,
149,
151
],
[
153
],
[
155
],
[
159
],
[
161,
163
],
[
165,
167
],
[
169
],
[
171
],
[
173
],
[
175,
177,
179
],
[
181
],
[
183
],
[
185,
187
],
[
189
],
[
191
],
[
193,
195,
197,
201
],
[
203,
205
],
[
207
],
[
211
],
[
213,
215
],
[
217
],
[
219
],
[
221
],
[
223
],
[
225
],
[
227
],
[
229
],
[
231,
233
],
[
235
],
[
237
],
[
239
],
[
241
],
[
243
],
[
245
]
]
|
12,406 | static av_cold int init(AVFilterContext *ctx, const char *args0)
{
PanContext *const pan = ctx->priv;
char *arg, *arg0, *tokenizer, *args = av_strdup(args0);
int out_ch_id, in_ch_id, len, named, ret;
int nb_in_channels[2] = { 0, 0 }; // number of unnamed and named input channels
double gain;
if (!args0) {
av_log(ctx, AV_LOG_ERROR,
"pan filter needs a channel layout and a set "
"of channels definitions as parameter\n");
return AVERROR(EINVAL);
}
if (!args)
return AVERROR(ENOMEM);
arg = av_strtok(args, ":", &tokenizer);
ret = ff_parse_channel_layout(&pan->out_channel_layout, arg, ctx);
if (ret < 0)
return ret;
pan->nb_output_channels = av_get_channel_layout_nb_channels(pan->out_channel_layout);
/* parse channel specifications */
while ((arg = arg0 = av_strtok(NULL, ":", &tokenizer))) {
/* channel name */
if (parse_channel_name(&arg, &out_ch_id, &named)) {
av_log(ctx, AV_LOG_ERROR,
"Expected out channel name, got \"%.8s\"\n", arg);
return AVERROR(EINVAL);
}
if (named) {
if (!((pan->out_channel_layout >> out_ch_id) & 1)) {
av_log(ctx, AV_LOG_ERROR,
"Channel \"%.8s\" does not exist in the chosen layout\n", arg0);
return AVERROR(EINVAL);
}
/* get the channel number in the output channel layout:
* out_channel_layout & ((1 << out_ch_id) - 1) are all the
* channels that come before out_ch_id,
* so their count is the index of out_ch_id */
out_ch_id = av_get_channel_layout_nb_channels(pan->out_channel_layout & (((int64_t)1 << out_ch_id) - 1));
}
if (out_ch_id < 0 || out_ch_id >= pan->nb_output_channels) {
av_log(ctx, AV_LOG_ERROR,
"Invalid out channel name \"%.8s\"\n", arg0);
return AVERROR(EINVAL);
}
if (*arg == '=') {
arg++;
} else if (*arg == '<') {
pan->need_renorm |= (int64_t)1 << out_ch_id;
arg++;
} else {
av_log(ctx, AV_LOG_ERROR,
"Syntax error after channel name in \"%.8s\"\n", arg0);
return AVERROR(EINVAL);
}
/* gains */
while (1) {
gain = 1;
if (sscanf(arg, " %lf %n* %n", &gain, &len, &len))
arg += len;
if (parse_channel_name(&arg, &in_ch_id, &named)){
av_log(ctx, AV_LOG_ERROR,
"Expected in channel name, got \"%.8s\"\n", arg);
return AVERROR(EINVAL);
}
nb_in_channels[named]++;
if (nb_in_channels[!named]) {
av_log(ctx, AV_LOG_ERROR,
"Can not mix named and numbered channels\n");
return AVERROR(EINVAL);
}
pan->gain[out_ch_id][in_ch_id] = gain;
if (!*arg)
break;
if (*arg != '+') {
av_log(ctx, AV_LOG_ERROR, "Syntax error near \"%.8s\"\n", arg);
return AVERROR(EINVAL);
}
arg++;
skip_spaces(&arg);
}
}
pan->need_renumber = !!nb_in_channels[1];
av_free(args);
return 0;
}
| true | FFmpeg | e3a1eb9edf65edda301f3a727f11e0224b9f5ae2 | static av_cold int init(AVFilterContext *ctx, const char *args0)
{
PanContext *const pan = ctx->priv;
char *arg, *arg0, *tokenizer, *args = av_strdup(args0);
int out_ch_id, in_ch_id, len, named, ret;
int nb_in_channels[2] = { 0, 0 };
double gain;
if (!args0) {
av_log(ctx, AV_LOG_ERROR,
"pan filter needs a channel layout and a set "
"of channels definitions as parameter\n");
return AVERROR(EINVAL);
}
if (!args)
return AVERROR(ENOMEM);
arg = av_strtok(args, ":", &tokenizer);
ret = ff_parse_channel_layout(&pan->out_channel_layout, arg, ctx);
if (ret < 0)
return ret;
pan->nb_output_channels = av_get_channel_layout_nb_channels(pan->out_channel_layout);
while ((arg = arg0 = av_strtok(NULL, ":", &tokenizer))) {
if (parse_channel_name(&arg, &out_ch_id, &named)) {
av_log(ctx, AV_LOG_ERROR,
"Expected out channel name, got \"%.8s\"\n", arg);
return AVERROR(EINVAL);
}
if (named) {
if (!((pan->out_channel_layout >> out_ch_id) & 1)) {
av_log(ctx, AV_LOG_ERROR,
"Channel \"%.8s\" does not exist in the chosen layout\n", arg0);
return AVERROR(EINVAL);
}
out_ch_id = av_get_channel_layout_nb_channels(pan->out_channel_layout & (((int64_t)1 << out_ch_id) - 1));
}
if (out_ch_id < 0 || out_ch_id >= pan->nb_output_channels) {
av_log(ctx, AV_LOG_ERROR,
"Invalid out channel name \"%.8s\"\n", arg0);
return AVERROR(EINVAL);
}
if (*arg == '=') {
arg++;
} else if (*arg == '<') {
pan->need_renorm |= (int64_t)1 << out_ch_id;
arg++;
} else {
av_log(ctx, AV_LOG_ERROR,
"Syntax error after channel name in \"%.8s\"\n", arg0);
return AVERROR(EINVAL);
}
while (1) {
gain = 1;
if (sscanf(arg, " %lf %n* %n", &gain, &len, &len))
arg += len;
if (parse_channel_name(&arg, &in_ch_id, &named)){
av_log(ctx, AV_LOG_ERROR,
"Expected in channel name, got \"%.8s\"\n", arg);
return AVERROR(EINVAL);
}
nb_in_channels[named]++;
if (nb_in_channels[!named]) {
av_log(ctx, AV_LOG_ERROR,
"Can not mix named and numbered channels\n");
return AVERROR(EINVAL);
}
pan->gain[out_ch_id][in_ch_id] = gain;
if (!*arg)
break;
if (*arg != '+') {
av_log(ctx, AV_LOG_ERROR, "Syntax error near \"%.8s\"\n", arg);
return AVERROR(EINVAL);
}
arg++;
skip_spaces(&arg);
}
}
pan->need_renumber = !!nb_in_channels[1];
av_free(args);
return 0;
}
| {
"code": [
" if (sscanf(arg, \" %lf %n* %n\", &gain, &len, &len))",
" skip_spaces(&arg);"
],
"line_no": [
121,
163
]
} | static av_cold int FUNC_0(AVFilterContext *ctx, const char *args0)
{
PanContext *const pan = ctx->priv;
char *VAR_0, *VAR_1, *VAR_2, *VAR_3 = av_strdup(args0);
int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8;
int VAR_9[2] = { 0, 0 };
double VAR_10;
if (!args0) {
av_log(ctx, AV_LOG_ERROR,
"pan filter needs a channel layout and a set "
"of channels definitions as parameter\n");
return AVERROR(EINVAL);
}
if (!VAR_3)
return AVERROR(ENOMEM);
VAR_0 = av_strtok(VAR_3, ":", &VAR_2);
VAR_8 = ff_parse_channel_layout(&pan->out_channel_layout, VAR_0, ctx);
if (VAR_8 < 0)
return VAR_8;
pan->nb_output_channels = av_get_channel_layout_nb_channels(pan->out_channel_layout);
while ((VAR_0 = VAR_1 = av_strtok(NULL, ":", &VAR_2))) {
if (parse_channel_name(&VAR_0, &VAR_4, &VAR_7)) {
av_log(ctx, AV_LOG_ERROR,
"Expected out channel name, got \"%.8s\"\n", VAR_0);
return AVERROR(EINVAL);
}
if (VAR_7) {
if (!((pan->out_channel_layout >> VAR_4) & 1)) {
av_log(ctx, AV_LOG_ERROR,
"Channel \"%.8s\" does not exist in the chosen layout\n", VAR_1);
return AVERROR(EINVAL);
}
VAR_4 = av_get_channel_layout_nb_channels(pan->out_channel_layout & (((int64_t)1 << VAR_4) - 1));
}
if (VAR_4 < 0 || VAR_4 >= pan->nb_output_channels) {
av_log(ctx, AV_LOG_ERROR,
"Invalid out channel name \"%.8s\"\n", VAR_1);
return AVERROR(EINVAL);
}
if (*VAR_0 == '=') {
VAR_0++;
} else if (*VAR_0 == '<') {
pan->need_renorm |= (int64_t)1 << VAR_4;
VAR_0++;
} else {
av_log(ctx, AV_LOG_ERROR,
"Syntax error after channel name in \"%.8s\"\n", VAR_1);
return AVERROR(EINVAL);
}
while (1) {
VAR_10 = 1;
if (sscanf(VAR_0, " %lf %n* %n", &VAR_10, &VAR_6, &VAR_6))
VAR_0 += VAR_6;
if (parse_channel_name(&VAR_0, &VAR_5, &VAR_7)){
av_log(ctx, AV_LOG_ERROR,
"Expected in channel name, got \"%.8s\"\n", VAR_0);
return AVERROR(EINVAL);
}
VAR_9[VAR_7]++;
if (VAR_9[!VAR_7]) {
av_log(ctx, AV_LOG_ERROR,
"Can not mix VAR_7 and numbered channels\n");
return AVERROR(EINVAL);
}
pan->VAR_10[VAR_4][VAR_5] = VAR_10;
if (!*VAR_0)
break;
if (*VAR_0 != '+') {
av_log(ctx, AV_LOG_ERROR, "Syntax error near \"%.8s\"\n", VAR_0);
return AVERROR(EINVAL);
}
VAR_0++;
skip_spaces(&VAR_0);
}
}
pan->need_renumber = !!VAR_9[1];
av_free(VAR_3);
return 0;
}
| [
"static av_cold int FUNC_0(AVFilterContext *ctx, const char *args0)\n{",
"PanContext *const pan = ctx->priv;",
"char *VAR_0, *VAR_1, *VAR_2, *VAR_3 = av_strdup(args0);",
"int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8;",
"int VAR_9[2] = { 0, 0 };",
"double VAR_10;",
"if (!args0) {",
"av_log(ctx, AV_LOG_ERROR,\n\"pan filter needs a channel layout and a set \"\n\"of channels definitions as parameter\\n\");",
"return AVERROR(EINVAL);",
"}",
"if (!VAR_3)\nreturn AVERROR(ENOMEM);",
"VAR_0 = av_strtok(VAR_3, \":\", &VAR_2);",
"VAR_8 = ff_parse_channel_layout(&pan->out_channel_layout, VAR_0, ctx);",
"if (VAR_8 < 0)\nreturn VAR_8;",
"pan->nb_output_channels = av_get_channel_layout_nb_channels(pan->out_channel_layout);",
"while ((VAR_0 = VAR_1 = av_strtok(NULL, \":\", &VAR_2))) {",
"if (parse_channel_name(&VAR_0, &VAR_4, &VAR_7)) {",
"av_log(ctx, AV_LOG_ERROR,\n\"Expected out channel name, got \\\"%.8s\\\"\\n\", VAR_0);",
"return AVERROR(EINVAL);",
"}",
"if (VAR_7) {",
"if (!((pan->out_channel_layout >> VAR_4) & 1)) {",
"av_log(ctx, AV_LOG_ERROR,\n\"Channel \\\"%.8s\\\" does not exist in the chosen layout\\n\", VAR_1);",
"return AVERROR(EINVAL);",
"}",
"VAR_4 = av_get_channel_layout_nb_channels(pan->out_channel_layout & (((int64_t)1 << VAR_4) - 1));",
"}",
"if (VAR_4 < 0 || VAR_4 >= pan->nb_output_channels) {",
"av_log(ctx, AV_LOG_ERROR,\n\"Invalid out channel name \\\"%.8s\\\"\\n\", VAR_1);",
"return AVERROR(EINVAL);",
"}",
"if (*VAR_0 == '=') {",
"VAR_0++;",
"} else if (*VAR_0 == '<') {",
"pan->need_renorm |= (int64_t)1 << VAR_4;",
"VAR_0++;",
"} else {",
"av_log(ctx, AV_LOG_ERROR,\n\"Syntax error after channel name in \\\"%.8s\\\"\\n\", VAR_1);",
"return AVERROR(EINVAL);",
"}",
"while (1) {",
"VAR_10 = 1;",
"if (sscanf(VAR_0, \" %lf %n* %n\", &VAR_10, &VAR_6, &VAR_6))\nVAR_0 += VAR_6;",
"if (parse_channel_name(&VAR_0, &VAR_5, &VAR_7)){",
"av_log(ctx, AV_LOG_ERROR,\n\"Expected in channel name, got \\\"%.8s\\\"\\n\", VAR_0);",
"return AVERROR(EINVAL);",
"}",
"VAR_9[VAR_7]++;",
"if (VAR_9[!VAR_7]) {",
"av_log(ctx, AV_LOG_ERROR,\n\"Can not mix VAR_7 and numbered channels\\n\");",
"return AVERROR(EINVAL);",
"}",
"pan->VAR_10[VAR_4][VAR_5] = VAR_10;",
"if (!*VAR_0)\nbreak;",
"if (*VAR_0 != '+') {",
"av_log(ctx, AV_LOG_ERROR, \"Syntax error near \\\"%.8s\\\"\\n\", VAR_0);",
"return AVERROR(EINVAL);",
"}",
"VAR_0++;",
"skip_spaces(&VAR_0);",
"}",
"}",
"pan->need_renumber = !!VAR_9[1];",
"av_free(VAR_3);",
"return 0;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
19,
21,
23
],
[
25
],
[
27
],
[
29,
31
],
[
33
],
[
35
],
[
37,
39
],
[
41
],
[
47
],
[
51
],
[
53,
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65,
67
],
[
69
],
[
71
],
[
81
],
[
83
],
[
85
],
[
87,
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
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
],
[
173
],
[
175
],
[
177
]
]
|
12,407 | static void pvpanic_isa_realizefn(DeviceState *dev, Error **errp)
{
ISADevice *d = ISA_DEVICE(dev);
PVPanicState *s = ISA_PVPANIC_DEVICE(dev);
static bool port_configured;
FWCfgState *fw_cfg;
isa_register_ioport(d, &s->io, s->ioport);
if (!port_configured) {
fw_cfg = fw_cfg_find();
if (fw_cfg) {
fw_cfg_add_file(fw_cfg, "etc/pvpanic-port",
g_memdup(&s->ioport, sizeof(s->ioport)),
sizeof(s->ioport));
port_configured = true;
}
}
}
| true | qemu | bc3e6a0d6c8ab6cd7cd4b576ed567756f1dcabd2 | static void pvpanic_isa_realizefn(DeviceState *dev, Error **errp)
{
ISADevice *d = ISA_DEVICE(dev);
PVPanicState *s = ISA_PVPANIC_DEVICE(dev);
static bool port_configured;
FWCfgState *fw_cfg;
isa_register_ioport(d, &s->io, s->ioport);
if (!port_configured) {
fw_cfg = fw_cfg_find();
if (fw_cfg) {
fw_cfg_add_file(fw_cfg, "etc/pvpanic-port",
g_memdup(&s->ioport, sizeof(s->ioport)),
sizeof(s->ioport));
port_configured = true;
}
}
}
| {
"code": [
" static bool port_configured;",
" FWCfgState *fw_cfg;",
" if (!port_configured) {",
" fw_cfg = fw_cfg_find();",
" if (fw_cfg) {",
" fw_cfg_add_file(fw_cfg, \"etc/pvpanic-port\",",
" g_memdup(&s->ioport, sizeof(s->ioport)),",
" sizeof(s->ioport));",
" port_configured = true;"
],
"line_no": [
9,
11,
19,
21,
23,
25,
27,
29,
31
]
} | static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)
{
ISADevice *d = ISA_DEVICE(VAR_0);
PVPanicState *s = ISA_PVPANIC_DEVICE(VAR_0);
static bool VAR_2;
FWCfgState *fw_cfg;
isa_register_ioport(d, &s->io, s->ioport);
if (!VAR_2) {
fw_cfg = fw_cfg_find();
if (fw_cfg) {
fw_cfg_add_file(fw_cfg, "etc/pvpanic-port",
g_memdup(&s->ioport, sizeof(s->ioport)),
sizeof(s->ioport));
VAR_2 = true;
}
}
}
| [
"static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)\n{",
"ISADevice *d = ISA_DEVICE(VAR_0);",
"PVPanicState *s = ISA_PVPANIC_DEVICE(VAR_0);",
"static bool VAR_2;",
"FWCfgState *fw_cfg;",
"isa_register_ioport(d, &s->io, s->ioport);",
"if (!VAR_2) {",
"fw_cfg = fw_cfg_find();",
"if (fw_cfg) {",
"fw_cfg_add_file(fw_cfg, \"etc/pvpanic-port\",\ng_memdup(&s->ioport, sizeof(s->ioport)),\nsizeof(s->ioport));",
"VAR_2 = true;",
"}",
"}",
"}"
]
| [
0,
0,
0,
1,
1,
0,
1,
1,
1,
1,
1,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
19
],
[
21
],
[
23
],
[
25,
27,
29
],
[
31
],
[
33
],
[
35
],
[
37
]
]
|
12,408 | static TRBCCode xhci_address_slot(XHCIState *xhci, unsigned int slotid,
uint64_t pictx, bool bsr)
{
XHCISlot *slot;
USBPort *uport;
USBDevice *dev;
dma_addr_t ictx, octx, dcbaap;
uint64_t poctx;
uint32_t ictl_ctx[2];
uint32_t slot_ctx[4];
uint32_t ep0_ctx[5];
int i;
TRBCCode res;
trace_usb_xhci_slot_address(slotid);
assert(slotid >= 1 && slotid <= xhci->numslots);
dcbaap = xhci_addr64(xhci->dcbaap_low, xhci->dcbaap_high);
poctx = ldq_le_pci_dma(&xhci->pci_dev, dcbaap + 8*slotid);
ictx = xhci_mask64(pictx);
octx = xhci_mask64(poctx);
DPRINTF("xhci: input context at "DMA_ADDR_FMT"\n", ictx);
DPRINTF("xhci: output context at "DMA_ADDR_FMT"\n", octx);
xhci_dma_read_u32s(xhci, ictx, ictl_ctx, sizeof(ictl_ctx));
if (ictl_ctx[0] != 0x0 || ictl_ctx[1] != 0x3) {
fprintf(stderr, "xhci: invalid input context control %08x %08x\n",
ictl_ctx[0], ictl_ctx[1]);
return CC_TRB_ERROR;
}
xhci_dma_read_u32s(xhci, ictx+32, slot_ctx, sizeof(slot_ctx));
xhci_dma_read_u32s(xhci, ictx+64, ep0_ctx, sizeof(ep0_ctx));
DPRINTF("xhci: input slot context: %08x %08x %08x %08x\n",
slot_ctx[0], slot_ctx[1], slot_ctx[2], slot_ctx[3]);
DPRINTF("xhci: input ep0 context: %08x %08x %08x %08x %08x\n",
ep0_ctx[0], ep0_ctx[1], ep0_ctx[2], ep0_ctx[3], ep0_ctx[4]);
uport = xhci_lookup_uport(xhci, slot_ctx);
if (uport == NULL) {
fprintf(stderr, "xhci: port not found\n");
return CC_TRB_ERROR;
}
dev = uport->dev;
if (!dev) {
fprintf(stderr, "xhci: port %s not connected\n", uport->path);
return CC_USB_TRANSACTION_ERROR;
}
for (i = 0; i < xhci->numslots; i++) {
if (i == slotid-1) {
continue;
}
if (xhci->slots[i].uport == uport) {
fprintf(stderr, "xhci: port %s already assigned to slot %d\n",
uport->path, i+1);
return CC_TRB_ERROR;
}
}
slot = &xhci->slots[slotid-1];
slot->uport = uport;
slot->ctx = octx;
if (bsr) {
slot_ctx[3] = SLOT_DEFAULT << SLOT_STATE_SHIFT;
} else {
USBPacket p;
slot_ctx[3] = (SLOT_ADDRESSED << SLOT_STATE_SHIFT) | slotid;
usb_device_reset(dev);
usb_packet_setup(&p, USB_TOKEN_OUT,
usb_ep_get(dev, USB_TOKEN_OUT, 0), 0,
0, false, false);
usb_device_handle_control(dev, &p,
DeviceOutRequest | USB_REQ_SET_ADDRESS,
slotid, 0, 0, NULL);
assert(p.status != USB_RET_ASYNC);
}
res = xhci_enable_ep(xhci, slotid, 1, octx+32, ep0_ctx);
DPRINTF("xhci: output slot context: %08x %08x %08x %08x\n",
slot_ctx[0], slot_ctx[1], slot_ctx[2], slot_ctx[3]);
DPRINTF("xhci: output ep0 context: %08x %08x %08x %08x %08x\n",
ep0_ctx[0], ep0_ctx[1], ep0_ctx[2], ep0_ctx[3], ep0_ctx[4]);
xhci_dma_write_u32s(xhci, octx, slot_ctx, sizeof(slot_ctx));
xhci_dma_write_u32s(xhci, octx+32, ep0_ctx, sizeof(ep0_ctx));
return res;
} | true | qemu | a67188743bc30a3ad1358b8cd0a2a3cb64c10ff9 | static TRBCCode xhci_address_slot(XHCIState *xhci, unsigned int slotid,
uint64_t pictx, bool bsr)
{
XHCISlot *slot;
USBPort *uport;
USBDevice *dev;
dma_addr_t ictx, octx, dcbaap;
uint64_t poctx;
uint32_t ictl_ctx[2];
uint32_t slot_ctx[4];
uint32_t ep0_ctx[5];
int i;
TRBCCode res;
trace_usb_xhci_slot_address(slotid);
assert(slotid >= 1 && slotid <= xhci->numslots);
dcbaap = xhci_addr64(xhci->dcbaap_low, xhci->dcbaap_high);
poctx = ldq_le_pci_dma(&xhci->pci_dev, dcbaap + 8*slotid);
ictx = xhci_mask64(pictx);
octx = xhci_mask64(poctx);
DPRINTF("xhci: input context at "DMA_ADDR_FMT"\n", ictx);
DPRINTF("xhci: output context at "DMA_ADDR_FMT"\n", octx);
xhci_dma_read_u32s(xhci, ictx, ictl_ctx, sizeof(ictl_ctx));
if (ictl_ctx[0] != 0x0 || ictl_ctx[1] != 0x3) {
fprintf(stderr, "xhci: invalid input context control %08x %08x\n",
ictl_ctx[0], ictl_ctx[1]);
return CC_TRB_ERROR;
}
xhci_dma_read_u32s(xhci, ictx+32, slot_ctx, sizeof(slot_ctx));
xhci_dma_read_u32s(xhci, ictx+64, ep0_ctx, sizeof(ep0_ctx));
DPRINTF("xhci: input slot context: %08x %08x %08x %08x\n",
slot_ctx[0], slot_ctx[1], slot_ctx[2], slot_ctx[3]);
DPRINTF("xhci: input ep0 context: %08x %08x %08x %08x %08x\n",
ep0_ctx[0], ep0_ctx[1], ep0_ctx[2], ep0_ctx[3], ep0_ctx[4]);
uport = xhci_lookup_uport(xhci, slot_ctx);
if (uport == NULL) {
fprintf(stderr, "xhci: port not found\n");
return CC_TRB_ERROR;
}
dev = uport->dev;
if (!dev) {
fprintf(stderr, "xhci: port %s not connected\n", uport->path);
return CC_USB_TRANSACTION_ERROR;
}
for (i = 0; i < xhci->numslots; i++) {
if (i == slotid-1) {
continue;
}
if (xhci->slots[i].uport == uport) {
fprintf(stderr, "xhci: port %s already assigned to slot %d\n",
uport->path, i+1);
return CC_TRB_ERROR;
}
}
slot = &xhci->slots[slotid-1];
slot->uport = uport;
slot->ctx = octx;
if (bsr) {
slot_ctx[3] = SLOT_DEFAULT << SLOT_STATE_SHIFT;
} else {
USBPacket p;
slot_ctx[3] = (SLOT_ADDRESSED << SLOT_STATE_SHIFT) | slotid;
usb_device_reset(dev);
usb_packet_setup(&p, USB_TOKEN_OUT,
usb_ep_get(dev, USB_TOKEN_OUT, 0), 0,
0, false, false);
usb_device_handle_control(dev, &p,
DeviceOutRequest | USB_REQ_SET_ADDRESS,
slotid, 0, 0, NULL);
assert(p.status != USB_RET_ASYNC);
}
res = xhci_enable_ep(xhci, slotid, 1, octx+32, ep0_ctx);
DPRINTF("xhci: output slot context: %08x %08x %08x %08x\n",
slot_ctx[0], slot_ctx[1], slot_ctx[2], slot_ctx[3]);
DPRINTF("xhci: output ep0 context: %08x %08x %08x %08x %08x\n",
ep0_ctx[0], ep0_ctx[1], ep0_ctx[2], ep0_ctx[3], ep0_ctx[4]);
xhci_dma_write_u32s(xhci, octx, slot_ctx, sizeof(slot_ctx));
xhci_dma_write_u32s(xhci, octx+32, ep0_ctx, sizeof(ep0_ctx));
return res;
} | {
"code": [],
"line_no": []
} | static TRBCCode FUNC_0(XHCIState *xhci, unsigned int slotid,
uint64_t pictx, bool bsr)
{
XHCISlot *slot;
USBPort *uport;
USBDevice *dev;
dma_addr_t ictx, octx, dcbaap;
uint64_t poctx;
uint32_t ictl_ctx[2];
uint32_t slot_ctx[4];
uint32_t ep0_ctx[5];
int VAR_0;
TRBCCode res;
trace_usb_xhci_slot_address(slotid);
assert(slotid >= 1 && slotid <= xhci->numslots);
dcbaap = xhci_addr64(xhci->dcbaap_low, xhci->dcbaap_high);
poctx = ldq_le_pci_dma(&xhci->pci_dev, dcbaap + 8*slotid);
ictx = xhci_mask64(pictx);
octx = xhci_mask64(poctx);
DPRINTF("xhci: input context at "DMA_ADDR_FMT"\n", ictx);
DPRINTF("xhci: output context at "DMA_ADDR_FMT"\n", octx);
xhci_dma_read_u32s(xhci, ictx, ictl_ctx, sizeof(ictl_ctx));
if (ictl_ctx[0] != 0x0 || ictl_ctx[1] != 0x3) {
fprintf(stderr, "xhci: invalid input context control %08x %08x\n",
ictl_ctx[0], ictl_ctx[1]);
return CC_TRB_ERROR;
}
xhci_dma_read_u32s(xhci, ictx+32, slot_ctx, sizeof(slot_ctx));
xhci_dma_read_u32s(xhci, ictx+64, ep0_ctx, sizeof(ep0_ctx));
DPRINTF("xhci: input slot context: %08x %08x %08x %08x\n",
slot_ctx[0], slot_ctx[1], slot_ctx[2], slot_ctx[3]);
DPRINTF("xhci: input ep0 context: %08x %08x %08x %08x %08x\n",
ep0_ctx[0], ep0_ctx[1], ep0_ctx[2], ep0_ctx[3], ep0_ctx[4]);
uport = xhci_lookup_uport(xhci, slot_ctx);
if (uport == NULL) {
fprintf(stderr, "xhci: port not found\n");
return CC_TRB_ERROR;
}
dev = uport->dev;
if (!dev) {
fprintf(stderr, "xhci: port %s not connected\n", uport->path);
return CC_USB_TRANSACTION_ERROR;
}
for (VAR_0 = 0; VAR_0 < xhci->numslots; VAR_0++) {
if (VAR_0 == slotid-1) {
continue;
}
if (xhci->slots[VAR_0].uport == uport) {
fprintf(stderr, "xhci: port %s already assigned to slot %d\n",
uport->path, VAR_0+1);
return CC_TRB_ERROR;
}
}
slot = &xhci->slots[slotid-1];
slot->uport = uport;
slot->ctx = octx;
if (bsr) {
slot_ctx[3] = SLOT_DEFAULT << SLOT_STATE_SHIFT;
} else {
USBPacket p;
slot_ctx[3] = (SLOT_ADDRESSED << SLOT_STATE_SHIFT) | slotid;
usb_device_reset(dev);
usb_packet_setup(&p, USB_TOKEN_OUT,
usb_ep_get(dev, USB_TOKEN_OUT, 0), 0,
0, false, false);
usb_device_handle_control(dev, &p,
DeviceOutRequest | USB_REQ_SET_ADDRESS,
slotid, 0, 0, NULL);
assert(p.status != USB_RET_ASYNC);
}
res = xhci_enable_ep(xhci, slotid, 1, octx+32, ep0_ctx);
DPRINTF("xhci: output slot context: %08x %08x %08x %08x\n",
slot_ctx[0], slot_ctx[1], slot_ctx[2], slot_ctx[3]);
DPRINTF("xhci: output ep0 context: %08x %08x %08x %08x %08x\n",
ep0_ctx[0], ep0_ctx[1], ep0_ctx[2], ep0_ctx[3], ep0_ctx[4]);
xhci_dma_write_u32s(xhci, octx, slot_ctx, sizeof(slot_ctx));
xhci_dma_write_u32s(xhci, octx+32, ep0_ctx, sizeof(ep0_ctx));
return res;
} | [
"static TRBCCode FUNC_0(XHCIState *xhci, unsigned int slotid,\nuint64_t pictx, bool bsr)\n{",
"XHCISlot *slot;",
"USBPort *uport;",
"USBDevice *dev;",
"dma_addr_t ictx, octx, dcbaap;",
"uint64_t poctx;",
"uint32_t ictl_ctx[2];",
"uint32_t slot_ctx[4];",
"uint32_t ep0_ctx[5];",
"int VAR_0;",
"TRBCCode res;",
"trace_usb_xhci_slot_address(slotid);",
"assert(slotid >= 1 && slotid <= xhci->numslots);",
"dcbaap = xhci_addr64(xhci->dcbaap_low, xhci->dcbaap_high);",
"poctx = ldq_le_pci_dma(&xhci->pci_dev, dcbaap + 8*slotid);",
"ictx = xhci_mask64(pictx);",
"octx = xhci_mask64(poctx);",
"DPRINTF(\"xhci: input context at \"DMA_ADDR_FMT\"\\n\", ictx);",
"DPRINTF(\"xhci: output context at \"DMA_ADDR_FMT\"\\n\", octx);",
"xhci_dma_read_u32s(xhci, ictx, ictl_ctx, sizeof(ictl_ctx));",
"if (ictl_ctx[0] != 0x0 || ictl_ctx[1] != 0x3) {",
"fprintf(stderr, \"xhci: invalid input context control %08x %08x\\n\",\nictl_ctx[0], ictl_ctx[1]);",
"return CC_TRB_ERROR;",
"}",
"xhci_dma_read_u32s(xhci, ictx+32, slot_ctx, sizeof(slot_ctx));",
"xhci_dma_read_u32s(xhci, ictx+64, ep0_ctx, sizeof(ep0_ctx));",
"DPRINTF(\"xhci: input slot context: %08x %08x %08x %08x\\n\",\nslot_ctx[0], slot_ctx[1], slot_ctx[2], slot_ctx[3]);",
"DPRINTF(\"xhci: input ep0 context: %08x %08x %08x %08x %08x\\n\",\nep0_ctx[0], ep0_ctx[1], ep0_ctx[2], ep0_ctx[3], ep0_ctx[4]);",
"uport = xhci_lookup_uport(xhci, slot_ctx);",
"if (uport == NULL) {",
"fprintf(stderr, \"xhci: port not found\\n\");",
"return CC_TRB_ERROR;",
"}",
"dev = uport->dev;",
"if (!dev) {",
"fprintf(stderr, \"xhci: port %s not connected\\n\", uport->path);",
"return CC_USB_TRANSACTION_ERROR;",
"}",
"for (VAR_0 = 0; VAR_0 < xhci->numslots; VAR_0++) {",
"if (VAR_0 == slotid-1) {",
"continue;",
"}",
"if (xhci->slots[VAR_0].uport == uport) {",
"fprintf(stderr, \"xhci: port %s already assigned to slot %d\\n\",\nuport->path, VAR_0+1);",
"return CC_TRB_ERROR;",
"}",
"}",
"slot = &xhci->slots[slotid-1];",
"slot->uport = uport;",
"slot->ctx = octx;",
"if (bsr) {",
"slot_ctx[3] = SLOT_DEFAULT << SLOT_STATE_SHIFT;",
"} else {",
"USBPacket p;",
"slot_ctx[3] = (SLOT_ADDRESSED << SLOT_STATE_SHIFT) | slotid;",
"usb_device_reset(dev);",
"usb_packet_setup(&p, USB_TOKEN_OUT,\nusb_ep_get(dev, USB_TOKEN_OUT, 0), 0,\n0, false, false);",
"usb_device_handle_control(dev, &p,\nDeviceOutRequest | USB_REQ_SET_ADDRESS,\nslotid, 0, 0, NULL);",
"assert(p.status != USB_RET_ASYNC);",
"}",
"res = xhci_enable_ep(xhci, slotid, 1, octx+32, ep0_ctx);",
"DPRINTF(\"xhci: output slot context: %08x %08x %08x %08x\\n\",\nslot_ctx[0], slot_ctx[1], slot_ctx[2], slot_ctx[3]);",
"DPRINTF(\"xhci: output ep0 context: %08x %08x %08x %08x %08x\\n\",\nep0_ctx[0], ep0_ctx[1], ep0_ctx[2], ep0_ctx[3], ep0_ctx[4]);",
"xhci_dma_write_u32s(xhci, octx, slot_ctx, sizeof(slot_ctx));",
"xhci_dma_write_u32s(xhci, octx+32, ep0_ctx, sizeof(ep0_ctx));",
"return res;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
2,
3
],
[
4
],
[
5
],
[
6
],
[
7
],
[
8
],
[
9
],
[
10
],
[
11
],
[
12
],
[
13
],
[
14
],
[
15
],
[
16
],
[
17
],
[
18
],
[
19
],
[
20
],
[
21
],
[
22
],
[
23
],
[
24,
25
],
[
26
],
[
27
],
[
28
],
[
29
],
[
30,
31
],
[
32,
33
],
[
34
],
[
35
],
[
36
],
[
37
],
[
38
],
[
39
],
[
40
],
[
41
],
[
42
],
[
43
],
[
44
],
[
45
],
[
46
],
[
47
],
[
48
],
[
49,
50
],
[
51
],
[
52
],
[
53
],
[
54
],
[
55
],
[
56
],
[
57
],
[
58
],
[
59
],
[
60
],
[
61
],
[
62
],
[
63,
64,
65
],
[
66,
67,
68
],
[
69
],
[
70
],
[
71
],
[
72,
73
],
[
74,
75
],
[
76
],
[
77
],
[
78
],
[
79
]
]
|
12,410 | static int compare_ocl_device_desc(const void *a, const void *b)
{
return ((const OpenCLDeviceBenchmark*)a)->runtime - ((const OpenCLDeviceBenchmark*)b)->runtime;
}
| true | FFmpeg | 92e483f8ed70d88d4f64337f65bae212502735d4 | static int compare_ocl_device_desc(const void *a, const void *b)
{
return ((const OpenCLDeviceBenchmark*)a)->runtime - ((const OpenCLDeviceBenchmark*)b)->runtime;
}
| {
"code": [
" return ((const OpenCLDeviceBenchmark*)a)->runtime - ((const OpenCLDeviceBenchmark*)b)->runtime;"
],
"line_no": [
5
]
} | static int FUNC_0(const void *VAR_0, const void *VAR_1)
{
return ((const OpenCLDeviceBenchmark*)VAR_0)->runtime - ((const OpenCLDeviceBenchmark*)VAR_1)->runtime;
}
| [
"static int FUNC_0(const void *VAR_0, const void *VAR_1)\n{",
"return ((const OpenCLDeviceBenchmark*)VAR_0)->runtime - ((const OpenCLDeviceBenchmark*)VAR_1)->runtime;",
"}"
]
| [
0,
1,
0
]
| [
[
1,
3
],
[
5
],
[
7
]
]
|
12,411 | void ff_vc1dsp_init_mmx(VC1DSPContext *dsp)
{
int mm_flags = av_get_cpu_flags();
#if HAVE_INLINE_ASM
if (mm_flags & AV_CPU_FLAG_MMX) {
dsp->put_vc1_mspel_pixels_tab[ 0] = ff_put_vc1_mspel_mc00_mmx;
dsp->put_vc1_mspel_pixels_tab[ 4] = put_vc1_mspel_mc01_mmx;
dsp->put_vc1_mspel_pixels_tab[ 8] = put_vc1_mspel_mc02_mmx;
dsp->put_vc1_mspel_pixels_tab[12] = put_vc1_mspel_mc03_mmx;
dsp->put_vc1_mspel_pixels_tab[ 1] = put_vc1_mspel_mc10_mmx;
dsp->put_vc1_mspel_pixels_tab[ 5] = put_vc1_mspel_mc11_mmx;
dsp->put_vc1_mspel_pixels_tab[ 9] = put_vc1_mspel_mc12_mmx;
dsp->put_vc1_mspel_pixels_tab[13] = put_vc1_mspel_mc13_mmx;
dsp->put_vc1_mspel_pixels_tab[ 2] = put_vc1_mspel_mc20_mmx;
dsp->put_vc1_mspel_pixels_tab[ 6] = put_vc1_mspel_mc21_mmx;
dsp->put_vc1_mspel_pixels_tab[10] = put_vc1_mspel_mc22_mmx;
dsp->put_vc1_mspel_pixels_tab[14] = put_vc1_mspel_mc23_mmx;
dsp->put_vc1_mspel_pixels_tab[ 3] = put_vc1_mspel_mc30_mmx;
dsp->put_vc1_mspel_pixels_tab[ 7] = put_vc1_mspel_mc31_mmx;
dsp->put_vc1_mspel_pixels_tab[11] = put_vc1_mspel_mc32_mmx;
dsp->put_vc1_mspel_pixels_tab[15] = put_vc1_mspel_mc33_mmx;
}
if (mm_flags & AV_CPU_FLAG_MMX2){
dsp->avg_vc1_mspel_pixels_tab[ 0] = ff_avg_vc1_mspel_mc00_mmx2;
dsp->avg_vc1_mspel_pixels_tab[ 4] = avg_vc1_mspel_mc01_mmx2;
dsp->avg_vc1_mspel_pixels_tab[ 8] = avg_vc1_mspel_mc02_mmx2;
dsp->avg_vc1_mspel_pixels_tab[12] = avg_vc1_mspel_mc03_mmx2;
dsp->avg_vc1_mspel_pixels_tab[ 1] = avg_vc1_mspel_mc10_mmx2;
dsp->avg_vc1_mspel_pixels_tab[ 5] = avg_vc1_mspel_mc11_mmx2;
dsp->avg_vc1_mspel_pixels_tab[ 9] = avg_vc1_mspel_mc12_mmx2;
dsp->avg_vc1_mspel_pixels_tab[13] = avg_vc1_mspel_mc13_mmx2;
dsp->avg_vc1_mspel_pixels_tab[ 2] = avg_vc1_mspel_mc20_mmx2;
dsp->avg_vc1_mspel_pixels_tab[ 6] = avg_vc1_mspel_mc21_mmx2;
dsp->avg_vc1_mspel_pixels_tab[10] = avg_vc1_mspel_mc22_mmx2;
dsp->avg_vc1_mspel_pixels_tab[14] = avg_vc1_mspel_mc23_mmx2;
dsp->avg_vc1_mspel_pixels_tab[ 3] = avg_vc1_mspel_mc30_mmx2;
dsp->avg_vc1_mspel_pixels_tab[ 7] = avg_vc1_mspel_mc31_mmx2;
dsp->avg_vc1_mspel_pixels_tab[11] = avg_vc1_mspel_mc32_mmx2;
dsp->avg_vc1_mspel_pixels_tab[15] = avg_vc1_mspel_mc33_mmx2;
dsp->vc1_inv_trans_8x8_dc = vc1_inv_trans_8x8_dc_mmx2;
dsp->vc1_inv_trans_4x8_dc = vc1_inv_trans_4x8_dc_mmx2;
dsp->vc1_inv_trans_8x4_dc = vc1_inv_trans_8x4_dc_mmx2;
dsp->vc1_inv_trans_4x4_dc = vc1_inv_trans_4x4_dc_mmx2;
}
#endif /* HAVE_INLINE_ASM */
#define ASSIGN_LF(EXT) \
dsp->vc1_v_loop_filter4 = ff_vc1_v_loop_filter4_ ## EXT; \
dsp->vc1_h_loop_filter4 = ff_vc1_h_loop_filter4_ ## EXT; \
dsp->vc1_v_loop_filter8 = ff_vc1_v_loop_filter8_ ## EXT; \
dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_ ## EXT; \
dsp->vc1_v_loop_filter16 = vc1_v_loop_filter16_ ## EXT; \
dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_ ## EXT
#if HAVE_YASM
if (mm_flags & AV_CPU_FLAG_MMX) {
dsp->put_no_rnd_vc1_chroma_pixels_tab[0]= ff_put_vc1_chroma_mc8_mmx_nornd;
}
return;
if (mm_flags & AV_CPU_FLAG_MMX2) {
ASSIGN_LF(mmx2);
dsp->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_mmx2_nornd;
} else if (mm_flags & AV_CPU_FLAG_3DNOW) {
dsp->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_3dnow_nornd;
}
if (mm_flags & AV_CPU_FLAG_SSE2) {
dsp->vc1_v_loop_filter8 = ff_vc1_v_loop_filter8_sse2;
dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_sse2;
dsp->vc1_v_loop_filter16 = vc1_v_loop_filter16_sse2;
dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_sse2;
}
if (mm_flags & AV_CPU_FLAG_SSSE3) {
ASSIGN_LF(ssse3);
dsp->put_no_rnd_vc1_chroma_pixels_tab[0]= ff_put_vc1_chroma_mc8_ssse3_nornd;
dsp->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_ssse3_nornd;
}
if (mm_flags & AV_CPU_FLAG_SSE4) {
dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_sse4;
dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_sse4;
}
#endif
}
| false | FFmpeg | f2fd167835b6f039a593e46ab3a84e1b9a453660 | void ff_vc1dsp_init_mmx(VC1DSPContext *dsp)
{
int mm_flags = av_get_cpu_flags();
#if HAVE_INLINE_ASM
if (mm_flags & AV_CPU_FLAG_MMX) {
dsp->put_vc1_mspel_pixels_tab[ 0] = ff_put_vc1_mspel_mc00_mmx;
dsp->put_vc1_mspel_pixels_tab[ 4] = put_vc1_mspel_mc01_mmx;
dsp->put_vc1_mspel_pixels_tab[ 8] = put_vc1_mspel_mc02_mmx;
dsp->put_vc1_mspel_pixels_tab[12] = put_vc1_mspel_mc03_mmx;
dsp->put_vc1_mspel_pixels_tab[ 1] = put_vc1_mspel_mc10_mmx;
dsp->put_vc1_mspel_pixels_tab[ 5] = put_vc1_mspel_mc11_mmx;
dsp->put_vc1_mspel_pixels_tab[ 9] = put_vc1_mspel_mc12_mmx;
dsp->put_vc1_mspel_pixels_tab[13] = put_vc1_mspel_mc13_mmx;
dsp->put_vc1_mspel_pixels_tab[ 2] = put_vc1_mspel_mc20_mmx;
dsp->put_vc1_mspel_pixels_tab[ 6] = put_vc1_mspel_mc21_mmx;
dsp->put_vc1_mspel_pixels_tab[10] = put_vc1_mspel_mc22_mmx;
dsp->put_vc1_mspel_pixels_tab[14] = put_vc1_mspel_mc23_mmx;
dsp->put_vc1_mspel_pixels_tab[ 3] = put_vc1_mspel_mc30_mmx;
dsp->put_vc1_mspel_pixels_tab[ 7] = put_vc1_mspel_mc31_mmx;
dsp->put_vc1_mspel_pixels_tab[11] = put_vc1_mspel_mc32_mmx;
dsp->put_vc1_mspel_pixels_tab[15] = put_vc1_mspel_mc33_mmx;
}
if (mm_flags & AV_CPU_FLAG_MMX2){
dsp->avg_vc1_mspel_pixels_tab[ 0] = ff_avg_vc1_mspel_mc00_mmx2;
dsp->avg_vc1_mspel_pixels_tab[ 4] = avg_vc1_mspel_mc01_mmx2;
dsp->avg_vc1_mspel_pixels_tab[ 8] = avg_vc1_mspel_mc02_mmx2;
dsp->avg_vc1_mspel_pixels_tab[12] = avg_vc1_mspel_mc03_mmx2;
dsp->avg_vc1_mspel_pixels_tab[ 1] = avg_vc1_mspel_mc10_mmx2;
dsp->avg_vc1_mspel_pixels_tab[ 5] = avg_vc1_mspel_mc11_mmx2;
dsp->avg_vc1_mspel_pixels_tab[ 9] = avg_vc1_mspel_mc12_mmx2;
dsp->avg_vc1_mspel_pixels_tab[13] = avg_vc1_mspel_mc13_mmx2;
dsp->avg_vc1_mspel_pixels_tab[ 2] = avg_vc1_mspel_mc20_mmx2;
dsp->avg_vc1_mspel_pixels_tab[ 6] = avg_vc1_mspel_mc21_mmx2;
dsp->avg_vc1_mspel_pixels_tab[10] = avg_vc1_mspel_mc22_mmx2;
dsp->avg_vc1_mspel_pixels_tab[14] = avg_vc1_mspel_mc23_mmx2;
dsp->avg_vc1_mspel_pixels_tab[ 3] = avg_vc1_mspel_mc30_mmx2;
dsp->avg_vc1_mspel_pixels_tab[ 7] = avg_vc1_mspel_mc31_mmx2;
dsp->avg_vc1_mspel_pixels_tab[11] = avg_vc1_mspel_mc32_mmx2;
dsp->avg_vc1_mspel_pixels_tab[15] = avg_vc1_mspel_mc33_mmx2;
dsp->vc1_inv_trans_8x8_dc = vc1_inv_trans_8x8_dc_mmx2;
dsp->vc1_inv_trans_4x8_dc = vc1_inv_trans_4x8_dc_mmx2;
dsp->vc1_inv_trans_8x4_dc = vc1_inv_trans_8x4_dc_mmx2;
dsp->vc1_inv_trans_4x4_dc = vc1_inv_trans_4x4_dc_mmx2;
}
#endif
#define ASSIGN_LF(EXT) \
dsp->vc1_v_loop_filter4 = ff_vc1_v_loop_filter4_ ## EXT; \
dsp->vc1_h_loop_filter4 = ff_vc1_h_loop_filter4_ ## EXT; \
dsp->vc1_v_loop_filter8 = ff_vc1_v_loop_filter8_ ## EXT; \
dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_ ## EXT; \
dsp->vc1_v_loop_filter16 = vc1_v_loop_filter16_ ## EXT; \
dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_ ## EXT
#if HAVE_YASM
if (mm_flags & AV_CPU_FLAG_MMX) {
dsp->put_no_rnd_vc1_chroma_pixels_tab[0]= ff_put_vc1_chroma_mc8_mmx_nornd;
}
return;
if (mm_flags & AV_CPU_FLAG_MMX2) {
ASSIGN_LF(mmx2);
dsp->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_mmx2_nornd;
} else if (mm_flags & AV_CPU_FLAG_3DNOW) {
dsp->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_3dnow_nornd;
}
if (mm_flags & AV_CPU_FLAG_SSE2) {
dsp->vc1_v_loop_filter8 = ff_vc1_v_loop_filter8_sse2;
dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_sse2;
dsp->vc1_v_loop_filter16 = vc1_v_loop_filter16_sse2;
dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_sse2;
}
if (mm_flags & AV_CPU_FLAG_SSSE3) {
ASSIGN_LF(ssse3);
dsp->put_no_rnd_vc1_chroma_pixels_tab[0]= ff_put_vc1_chroma_mc8_ssse3_nornd;
dsp->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_ssse3_nornd;
}
if (mm_flags & AV_CPU_FLAG_SSE4) {
dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_sse4;
dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_sse4;
}
#endif
}
| {
"code": [],
"line_no": []
} | void FUNC_0(VC1DSPContext *VAR_0)
{
int VAR_1 = av_get_cpu_flags();
#if HAVE_INLINE_ASM
if (VAR_1 & AV_CPU_FLAG_MMX) {
VAR_0->put_vc1_mspel_pixels_tab[ 0] = ff_put_vc1_mspel_mc00_mmx;
VAR_0->put_vc1_mspel_pixels_tab[ 4] = put_vc1_mspel_mc01_mmx;
VAR_0->put_vc1_mspel_pixels_tab[ 8] = put_vc1_mspel_mc02_mmx;
VAR_0->put_vc1_mspel_pixels_tab[12] = put_vc1_mspel_mc03_mmx;
VAR_0->put_vc1_mspel_pixels_tab[ 1] = put_vc1_mspel_mc10_mmx;
VAR_0->put_vc1_mspel_pixels_tab[ 5] = put_vc1_mspel_mc11_mmx;
VAR_0->put_vc1_mspel_pixels_tab[ 9] = put_vc1_mspel_mc12_mmx;
VAR_0->put_vc1_mspel_pixels_tab[13] = put_vc1_mspel_mc13_mmx;
VAR_0->put_vc1_mspel_pixels_tab[ 2] = put_vc1_mspel_mc20_mmx;
VAR_0->put_vc1_mspel_pixels_tab[ 6] = put_vc1_mspel_mc21_mmx;
VAR_0->put_vc1_mspel_pixels_tab[10] = put_vc1_mspel_mc22_mmx;
VAR_0->put_vc1_mspel_pixels_tab[14] = put_vc1_mspel_mc23_mmx;
VAR_0->put_vc1_mspel_pixels_tab[ 3] = put_vc1_mspel_mc30_mmx;
VAR_0->put_vc1_mspel_pixels_tab[ 7] = put_vc1_mspel_mc31_mmx;
VAR_0->put_vc1_mspel_pixels_tab[11] = put_vc1_mspel_mc32_mmx;
VAR_0->put_vc1_mspel_pixels_tab[15] = put_vc1_mspel_mc33_mmx;
}
if (VAR_1 & AV_CPU_FLAG_MMX2){
VAR_0->avg_vc1_mspel_pixels_tab[ 0] = ff_avg_vc1_mspel_mc00_mmx2;
VAR_0->avg_vc1_mspel_pixels_tab[ 4] = avg_vc1_mspel_mc01_mmx2;
VAR_0->avg_vc1_mspel_pixels_tab[ 8] = avg_vc1_mspel_mc02_mmx2;
VAR_0->avg_vc1_mspel_pixels_tab[12] = avg_vc1_mspel_mc03_mmx2;
VAR_0->avg_vc1_mspel_pixels_tab[ 1] = avg_vc1_mspel_mc10_mmx2;
VAR_0->avg_vc1_mspel_pixels_tab[ 5] = avg_vc1_mspel_mc11_mmx2;
VAR_0->avg_vc1_mspel_pixels_tab[ 9] = avg_vc1_mspel_mc12_mmx2;
VAR_0->avg_vc1_mspel_pixels_tab[13] = avg_vc1_mspel_mc13_mmx2;
VAR_0->avg_vc1_mspel_pixels_tab[ 2] = avg_vc1_mspel_mc20_mmx2;
VAR_0->avg_vc1_mspel_pixels_tab[ 6] = avg_vc1_mspel_mc21_mmx2;
VAR_0->avg_vc1_mspel_pixels_tab[10] = avg_vc1_mspel_mc22_mmx2;
VAR_0->avg_vc1_mspel_pixels_tab[14] = avg_vc1_mspel_mc23_mmx2;
VAR_0->avg_vc1_mspel_pixels_tab[ 3] = avg_vc1_mspel_mc30_mmx2;
VAR_0->avg_vc1_mspel_pixels_tab[ 7] = avg_vc1_mspel_mc31_mmx2;
VAR_0->avg_vc1_mspel_pixels_tab[11] = avg_vc1_mspel_mc32_mmx2;
VAR_0->avg_vc1_mspel_pixels_tab[15] = avg_vc1_mspel_mc33_mmx2;
VAR_0->vc1_inv_trans_8x8_dc = vc1_inv_trans_8x8_dc_mmx2;
VAR_0->vc1_inv_trans_4x8_dc = vc1_inv_trans_4x8_dc_mmx2;
VAR_0->vc1_inv_trans_8x4_dc = vc1_inv_trans_8x4_dc_mmx2;
VAR_0->vc1_inv_trans_4x4_dc = vc1_inv_trans_4x4_dc_mmx2;
}
#endif
#define ASSIGN_LF(EXT) \
VAR_0->vc1_v_loop_filter4 = ff_vc1_v_loop_filter4_ ## EXT; \
VAR_0->vc1_h_loop_filter4 = ff_vc1_h_loop_filter4_ ## EXT; \
VAR_0->vc1_v_loop_filter8 = ff_vc1_v_loop_filter8_ ## EXT; \
VAR_0->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_ ## EXT; \
VAR_0->vc1_v_loop_filter16 = vc1_v_loop_filter16_ ## EXT; \
VAR_0->vc1_h_loop_filter16 = vc1_h_loop_filter16_ ## EXT
#if HAVE_YASM
if (VAR_1 & AV_CPU_FLAG_MMX) {
VAR_0->put_no_rnd_vc1_chroma_pixels_tab[0]= ff_put_vc1_chroma_mc8_mmx_nornd;
}
return;
if (VAR_1 & AV_CPU_FLAG_MMX2) {
ASSIGN_LF(mmx2);
VAR_0->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_mmx2_nornd;
} else if (VAR_1 & AV_CPU_FLAG_3DNOW) {
VAR_0->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_3dnow_nornd;
}
if (VAR_1 & AV_CPU_FLAG_SSE2) {
VAR_0->vc1_v_loop_filter8 = ff_vc1_v_loop_filter8_sse2;
VAR_0->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_sse2;
VAR_0->vc1_v_loop_filter16 = vc1_v_loop_filter16_sse2;
VAR_0->vc1_h_loop_filter16 = vc1_h_loop_filter16_sse2;
}
if (VAR_1 & AV_CPU_FLAG_SSSE3) {
ASSIGN_LF(ssse3);
VAR_0->put_no_rnd_vc1_chroma_pixels_tab[0]= ff_put_vc1_chroma_mc8_ssse3_nornd;
VAR_0->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_ssse3_nornd;
}
if (VAR_1 & AV_CPU_FLAG_SSE4) {
VAR_0->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_sse4;
VAR_0->vc1_h_loop_filter16 = vc1_h_loop_filter16_sse4;
}
#endif
}
| [
"void FUNC_0(VC1DSPContext *VAR_0)\n{",
"int VAR_1 = av_get_cpu_flags();",
"#if HAVE_INLINE_ASM\nif (VAR_1 & AV_CPU_FLAG_MMX) {",
"VAR_0->put_vc1_mspel_pixels_tab[ 0] = ff_put_vc1_mspel_mc00_mmx;",
"VAR_0->put_vc1_mspel_pixels_tab[ 4] = put_vc1_mspel_mc01_mmx;",
"VAR_0->put_vc1_mspel_pixels_tab[ 8] = put_vc1_mspel_mc02_mmx;",
"VAR_0->put_vc1_mspel_pixels_tab[12] = put_vc1_mspel_mc03_mmx;",
"VAR_0->put_vc1_mspel_pixels_tab[ 1] = put_vc1_mspel_mc10_mmx;",
"VAR_0->put_vc1_mspel_pixels_tab[ 5] = put_vc1_mspel_mc11_mmx;",
"VAR_0->put_vc1_mspel_pixels_tab[ 9] = put_vc1_mspel_mc12_mmx;",
"VAR_0->put_vc1_mspel_pixels_tab[13] = put_vc1_mspel_mc13_mmx;",
"VAR_0->put_vc1_mspel_pixels_tab[ 2] = put_vc1_mspel_mc20_mmx;",
"VAR_0->put_vc1_mspel_pixels_tab[ 6] = put_vc1_mspel_mc21_mmx;",
"VAR_0->put_vc1_mspel_pixels_tab[10] = put_vc1_mspel_mc22_mmx;",
"VAR_0->put_vc1_mspel_pixels_tab[14] = put_vc1_mspel_mc23_mmx;",
"VAR_0->put_vc1_mspel_pixels_tab[ 3] = put_vc1_mspel_mc30_mmx;",
"VAR_0->put_vc1_mspel_pixels_tab[ 7] = put_vc1_mspel_mc31_mmx;",
"VAR_0->put_vc1_mspel_pixels_tab[11] = put_vc1_mspel_mc32_mmx;",
"VAR_0->put_vc1_mspel_pixels_tab[15] = put_vc1_mspel_mc33_mmx;",
"}",
"if (VAR_1 & AV_CPU_FLAG_MMX2){",
"VAR_0->avg_vc1_mspel_pixels_tab[ 0] = ff_avg_vc1_mspel_mc00_mmx2;",
"VAR_0->avg_vc1_mspel_pixels_tab[ 4] = avg_vc1_mspel_mc01_mmx2;",
"VAR_0->avg_vc1_mspel_pixels_tab[ 8] = avg_vc1_mspel_mc02_mmx2;",
"VAR_0->avg_vc1_mspel_pixels_tab[12] = avg_vc1_mspel_mc03_mmx2;",
"VAR_0->avg_vc1_mspel_pixels_tab[ 1] = avg_vc1_mspel_mc10_mmx2;",
"VAR_0->avg_vc1_mspel_pixels_tab[ 5] = avg_vc1_mspel_mc11_mmx2;",
"VAR_0->avg_vc1_mspel_pixels_tab[ 9] = avg_vc1_mspel_mc12_mmx2;",
"VAR_0->avg_vc1_mspel_pixels_tab[13] = avg_vc1_mspel_mc13_mmx2;",
"VAR_0->avg_vc1_mspel_pixels_tab[ 2] = avg_vc1_mspel_mc20_mmx2;",
"VAR_0->avg_vc1_mspel_pixels_tab[ 6] = avg_vc1_mspel_mc21_mmx2;",
"VAR_0->avg_vc1_mspel_pixels_tab[10] = avg_vc1_mspel_mc22_mmx2;",
"VAR_0->avg_vc1_mspel_pixels_tab[14] = avg_vc1_mspel_mc23_mmx2;",
"VAR_0->avg_vc1_mspel_pixels_tab[ 3] = avg_vc1_mspel_mc30_mmx2;",
"VAR_0->avg_vc1_mspel_pixels_tab[ 7] = avg_vc1_mspel_mc31_mmx2;",
"VAR_0->avg_vc1_mspel_pixels_tab[11] = avg_vc1_mspel_mc32_mmx2;",
"VAR_0->avg_vc1_mspel_pixels_tab[15] = avg_vc1_mspel_mc33_mmx2;",
"VAR_0->vc1_inv_trans_8x8_dc = vc1_inv_trans_8x8_dc_mmx2;",
"VAR_0->vc1_inv_trans_4x8_dc = vc1_inv_trans_4x8_dc_mmx2;",
"VAR_0->vc1_inv_trans_8x4_dc = vc1_inv_trans_8x4_dc_mmx2;",
"VAR_0->vc1_inv_trans_4x4_dc = vc1_inv_trans_4x4_dc_mmx2;",
"}",
"#endif\n#define ASSIGN_LF(EXT) \\\nVAR_0->vc1_v_loop_filter4 = ff_vc1_v_loop_filter4_ ## EXT; \\",
"VAR_0->vc1_h_loop_filter4 = ff_vc1_h_loop_filter4_ ## EXT; \\",
"VAR_0->vc1_v_loop_filter8 = ff_vc1_v_loop_filter8_ ## EXT; \\",
"VAR_0->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_ ## EXT; \\",
"VAR_0->vc1_v_loop_filter16 = vc1_v_loop_filter16_ ## EXT; \\",
"VAR_0->vc1_h_loop_filter16 = vc1_h_loop_filter16_ ## EXT\n#if HAVE_YASM\nif (VAR_1 & AV_CPU_FLAG_MMX) {",
"VAR_0->put_no_rnd_vc1_chroma_pixels_tab[0]= ff_put_vc1_chroma_mc8_mmx_nornd;",
"}",
"return;",
"if (VAR_1 & AV_CPU_FLAG_MMX2) {",
"ASSIGN_LF(mmx2);",
"VAR_0->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_mmx2_nornd;",
"} else if (VAR_1 & AV_CPU_FLAG_3DNOW) {",
"VAR_0->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_3dnow_nornd;",
"}",
"if (VAR_1 & AV_CPU_FLAG_SSE2) {",
"VAR_0->vc1_v_loop_filter8 = ff_vc1_v_loop_filter8_sse2;",
"VAR_0->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_sse2;",
"VAR_0->vc1_v_loop_filter16 = vc1_v_loop_filter16_sse2;",
"VAR_0->vc1_h_loop_filter16 = vc1_h_loop_filter16_sse2;",
"}",
"if (VAR_1 & AV_CPU_FLAG_SSSE3) {",
"ASSIGN_LF(ssse3);",
"VAR_0->put_no_rnd_vc1_chroma_pixels_tab[0]= ff_put_vc1_chroma_mc8_ssse3_nornd;",
"VAR_0->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_ssse3_nornd;",
"}",
"if (VAR_1 & AV_CPU_FLAG_SSE4) {",
"VAR_0->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_sse4;",
"VAR_0->vc1_h_loop_filter16 = vc1_h_loop_filter16_sse4;",
"}",
"#endif\n}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
9,
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
],
[
37
],
[
39
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
67
],
[
69
],
[
71
],
[
73
],
[
77
],
[
79
],
[
81
],
[
83
],
[
87
],
[
89
],
[
91
],
[
93
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107,
111,
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123,
127,
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
151
],
[
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165
],
[
167
],
[
169
],
[
171
],
[
173
],
[
175
],
[
177
],
[
179
],
[
181,
183
]
]
|
12,413 | static av_cold int ffv1_encode_close(AVCodecContext *avctx)
{
av_frame_free(&avctx->coded_frame);
ffv1_close(avctx);
return 0;
}
| false | FFmpeg | d6604b29ef544793479d7fb4e05ef6622bb3e534 | static av_cold int ffv1_encode_close(AVCodecContext *avctx)
{
av_frame_free(&avctx->coded_frame);
ffv1_close(avctx);
return 0;
}
| {
"code": [],
"line_no": []
} | static av_cold int FUNC_0(AVCodecContext *avctx)
{
av_frame_free(&avctx->coded_frame);
ffv1_close(avctx);
return 0;
}
| [
"static av_cold int FUNC_0(AVCodecContext *avctx)\n{",
"av_frame_free(&avctx->coded_frame);",
"ffv1_close(avctx);",
"return 0;",
"}"
]
| [
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
]
]
|
12,414 | static inline void conv_to_float(float *arr, int32_t *cof, int num)
{
int i;
for (i = 0; i < num; i++)
arr[i] = (float)cof[i]/INT32_MAX;
}
| false | FFmpeg | f20b67173ca6a05b8c3dee02dad3b7243b96292b | static inline void conv_to_float(float *arr, int32_t *cof, int num)
{
int i;
for (i = 0; i < num; i++)
arr[i] = (float)cof[i]/INT32_MAX;
}
| {
"code": [],
"line_no": []
} | static inline void FUNC_0(float *VAR_0, int32_t *VAR_1, int VAR_2)
{
int VAR_3;
for (VAR_3 = 0; VAR_3 < VAR_2; VAR_3++)
VAR_0[VAR_3] = (float)VAR_1[VAR_3]/INT32_MAX;
}
| [
"static inline void FUNC_0(float *VAR_0, int32_t *VAR_1, int VAR_2)\n{",
"int VAR_3;",
"for (VAR_3 = 0; VAR_3 < VAR_2; VAR_3++)",
"VAR_0[VAR_3] = (float)VAR_1[VAR_3]/INT32_MAX;",
"}"
]
| [
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
]
]
|
12,415 | static int process_input(int file_index)
{
InputFile *ifile = input_files[file_index];
AVFormatContext *is;
InputStream *ist;
AVPacket pkt;
int ret, i, j;
int64_t duration;
int64_t pkt_dts;
is = ifile->ctx;
ret = get_input_packet(ifile, &pkt);
if (ret == AVERROR(EAGAIN)) {
ifile->eagain = 1;
return ret;
}
if (ret < 0 && ifile->loop) {
if ((ret = seek_to_start(ifile, is)) < 0)
return ret;
ret = get_input_packet(ifile, &pkt);
}
if (ret < 0) {
if (ret != AVERROR_EOF) {
print_error(is->filename, ret);
if (exit_on_error)
exit_program(1);
}
for (i = 0; i < ifile->nb_streams; i++) {
ist = input_streams[ifile->ist_index + i];
if (ist->decoding_needed) {
ret = process_input_packet(ist, NULL, 0);
if (ret>0)
return 0;
}
/* mark all outputs that don't go through lavfi as finished */
for (j = 0; j < nb_output_streams; j++) {
OutputStream *ost = output_streams[j];
if (ost->source_index == ifile->ist_index + i &&
(ost->stream_copy || ost->enc->type == AVMEDIA_TYPE_SUBTITLE))
finish_output_stream(ost);
}
}
ifile->eof_reached = 1;
return AVERROR(EAGAIN);
}
reset_eagain();
if (do_pkt_dump) {
av_pkt_dump_log2(NULL, AV_LOG_DEBUG, &pkt, do_hex_dump,
is->streams[pkt.stream_index]);
}
/* the following test is needed in case new streams appear
dynamically in stream : we ignore them */
if (pkt.stream_index >= ifile->nb_streams) {
report_new_stream(file_index, &pkt);
goto discard_packet;
}
ist = input_streams[ifile->ist_index + pkt.stream_index];
ist->data_size += pkt.size;
ist->nb_packets++;
if (ist->discard)
goto discard_packet;
if (exit_on_error && (pkt.flags & AV_PKT_FLAG_CORRUPT)) {
av_log(NULL, AV_LOG_FATAL, "%s: corrupt input packet in stream %d\n", is->filename, pkt.stream_index);
exit_program(1);
}
if (debug_ts) {
av_log(NULL, AV_LOG_INFO, "demuxer -> ist_index:%d type:%s "
"next_dts:%s next_dts_time:%s next_pts:%s next_pts_time:%s pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s off:%s off_time:%s\n",
ifile->ist_index + pkt.stream_index, av_get_media_type_string(ist->dec_ctx->codec_type),
av_ts2str(ist->next_dts), av_ts2timestr(ist->next_dts, &AV_TIME_BASE_Q),
av_ts2str(ist->next_pts), av_ts2timestr(ist->next_pts, &AV_TIME_BASE_Q),
av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &ist->st->time_base),
av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &ist->st->time_base),
av_ts2str(input_files[ist->file_index]->ts_offset),
av_ts2timestr(input_files[ist->file_index]->ts_offset, &AV_TIME_BASE_Q));
}
if(!ist->wrap_correction_done && is->start_time != AV_NOPTS_VALUE && ist->st->pts_wrap_bits < 64){
int64_t stime, stime2;
// Correcting starttime based on the enabled streams
// FIXME this ideally should be done before the first use of starttime but we do not know which are the enabled streams at that point.
// so we instead do it here as part of discontinuity handling
if ( ist->next_dts == AV_NOPTS_VALUE
&& ifile->ts_offset == -is->start_time
&& (is->iformat->flags & AVFMT_TS_DISCONT)) {
int64_t new_start_time = INT64_MAX;
for (i=0; i<is->nb_streams; i++) {
AVStream *st = is->streams[i];
if(st->discard == AVDISCARD_ALL || st->start_time == AV_NOPTS_VALUE)
continue;
new_start_time = FFMIN(new_start_time, av_rescale_q(st->start_time, st->time_base, AV_TIME_BASE_Q));
}
if (new_start_time > is->start_time) {
av_log(is, AV_LOG_VERBOSE, "Correcting start time by %"PRId64"\n", new_start_time - is->start_time);
ifile->ts_offset = -new_start_time;
}
}
stime = av_rescale_q(is->start_time, AV_TIME_BASE_Q, ist->st->time_base);
stime2= stime + (1ULL<<ist->st->pts_wrap_bits);
ist->wrap_correction_done = 1;
if(stime2 > stime && pkt.dts != AV_NOPTS_VALUE && pkt.dts > stime + (1LL<<(ist->st->pts_wrap_bits-1))) {
pkt.dts -= 1ULL<<ist->st->pts_wrap_bits;
ist->wrap_correction_done = 0;
}
if(stime2 > stime && pkt.pts != AV_NOPTS_VALUE && pkt.pts > stime + (1LL<<(ist->st->pts_wrap_bits-1))) {
pkt.pts -= 1ULL<<ist->st->pts_wrap_bits;
ist->wrap_correction_done = 0;
}
}
/* add the stream-global side data to the first packet */
if (ist->nb_packets == 1) {
if (ist->st->nb_side_data)
av_packet_split_side_data(&pkt);
for (i = 0; i < ist->st->nb_side_data; i++) {
AVPacketSideData *src_sd = &ist->st->side_data[i];
uint8_t *dst_data;
if (av_packet_get_side_data(&pkt, src_sd->type, NULL))
continue;
if (ist->autorotate && src_sd->type == AV_PKT_DATA_DISPLAYMATRIX)
continue;
dst_data = av_packet_new_side_data(&pkt, src_sd->type, src_sd->size);
if (!dst_data)
exit_program(1);
memcpy(dst_data, src_sd->data, src_sd->size);
}
}
if (pkt.dts != AV_NOPTS_VALUE)
pkt.dts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base);
if (pkt.pts != AV_NOPTS_VALUE)
pkt.pts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base);
if (pkt.pts != AV_NOPTS_VALUE)
pkt.pts *= ist->ts_scale;
if (pkt.dts != AV_NOPTS_VALUE)
pkt.dts *= ist->ts_scale;
pkt_dts = av_rescale_q_rnd(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
if ((ist->dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO ||
ist->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) &&
pkt_dts != AV_NOPTS_VALUE && ist->next_dts == AV_NOPTS_VALUE && !copy_ts
&& (is->iformat->flags & AVFMT_TS_DISCONT) && ifile->last_ts != AV_NOPTS_VALUE) {
int64_t delta = pkt_dts - ifile->last_ts;
if (delta < -1LL*dts_delta_threshold*AV_TIME_BASE ||
delta > 1LL*dts_delta_threshold*AV_TIME_BASE){
ifile->ts_offset -= delta;
av_log(NULL, AV_LOG_DEBUG,
"Inter stream timestamp discontinuity %"PRId64", new offset= %"PRId64"\n",
delta, ifile->ts_offset);
pkt.dts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);
if (pkt.pts != AV_NOPTS_VALUE)
pkt.pts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);
}
}
duration = av_rescale_q(ifile->duration, ifile->time_base, ist->st->time_base);
if (pkt.pts != AV_NOPTS_VALUE) {
pkt.pts += duration;
ist->max_pts = FFMAX(pkt.pts, ist->max_pts);
ist->min_pts = FFMIN(pkt.pts, ist->min_pts);
}
if (pkt.dts != AV_NOPTS_VALUE)
pkt.dts += duration;
pkt_dts = av_rescale_q_rnd(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
if ((ist->dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO ||
ist->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) &&
pkt_dts != AV_NOPTS_VALUE && ist->next_dts != AV_NOPTS_VALUE &&
!copy_ts) {
int64_t delta = pkt_dts - ist->next_dts;
if (is->iformat->flags & AVFMT_TS_DISCONT) {
if (delta < -1LL*dts_delta_threshold*AV_TIME_BASE ||
delta > 1LL*dts_delta_threshold*AV_TIME_BASE ||
pkt_dts + AV_TIME_BASE/10 < FFMAX(ist->pts, ist->dts)) {
ifile->ts_offset -= delta;
av_log(NULL, AV_LOG_DEBUG,
"timestamp discontinuity %"PRId64", new offset= %"PRId64"\n",
delta, ifile->ts_offset);
pkt.dts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);
if (pkt.pts != AV_NOPTS_VALUE)
pkt.pts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);
}
} else {
if ( delta < -1LL*dts_error_threshold*AV_TIME_BASE ||
delta > 1LL*dts_error_threshold*AV_TIME_BASE) {
av_log(NULL, AV_LOG_WARNING, "DTS %"PRId64", next:%"PRId64" st:%d invalid dropping\n", pkt.dts, ist->next_dts, pkt.stream_index);
pkt.dts = AV_NOPTS_VALUE;
}
if (pkt.pts != AV_NOPTS_VALUE){
int64_t pkt_pts = av_rescale_q(pkt.pts, ist->st->time_base, AV_TIME_BASE_Q);
delta = pkt_pts - ist->next_dts;
if ( delta < -1LL*dts_error_threshold*AV_TIME_BASE ||
delta > 1LL*dts_error_threshold*AV_TIME_BASE) {
av_log(NULL, AV_LOG_WARNING, "PTS %"PRId64", next:%"PRId64" invalid dropping st:%d\n", pkt.pts, ist->next_dts, pkt.stream_index);
pkt.pts = AV_NOPTS_VALUE;
}
}
}
}
if (pkt.dts != AV_NOPTS_VALUE)
ifile->last_ts = av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q);
if (debug_ts) {
av_log(NULL, AV_LOG_INFO, "demuxer+ffmpeg -> ist_index:%d type:%s pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s off:%s off_time:%s\n",
ifile->ist_index + pkt.stream_index, av_get_media_type_string(ist->dec_ctx->codec_type),
av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &ist->st->time_base),
av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &ist->st->time_base),
av_ts2str(input_files[ist->file_index]->ts_offset),
av_ts2timestr(input_files[ist->file_index]->ts_offset, &AV_TIME_BASE_Q));
}
sub2video_heartbeat(ist, pkt.pts);
process_input_packet(ist, &pkt, 0);
discard_packet:
av_packet_unref(&pkt);
return 0;
}
| false | FFmpeg | 46cbb4c2312c654c44a94054e870840913a80024 | static int process_input(int file_index)
{
InputFile *ifile = input_files[file_index];
AVFormatContext *is;
InputStream *ist;
AVPacket pkt;
int ret, i, j;
int64_t duration;
int64_t pkt_dts;
is = ifile->ctx;
ret = get_input_packet(ifile, &pkt);
if (ret == AVERROR(EAGAIN)) {
ifile->eagain = 1;
return ret;
}
if (ret < 0 && ifile->loop) {
if ((ret = seek_to_start(ifile, is)) < 0)
return ret;
ret = get_input_packet(ifile, &pkt);
}
if (ret < 0) {
if (ret != AVERROR_EOF) {
print_error(is->filename, ret);
if (exit_on_error)
exit_program(1);
}
for (i = 0; i < ifile->nb_streams; i++) {
ist = input_streams[ifile->ist_index + i];
if (ist->decoding_needed) {
ret = process_input_packet(ist, NULL, 0);
if (ret>0)
return 0;
}
for (j = 0; j < nb_output_streams; j++) {
OutputStream *ost = output_streams[j];
if (ost->source_index == ifile->ist_index + i &&
(ost->stream_copy || ost->enc->type == AVMEDIA_TYPE_SUBTITLE))
finish_output_stream(ost);
}
}
ifile->eof_reached = 1;
return AVERROR(EAGAIN);
}
reset_eagain();
if (do_pkt_dump) {
av_pkt_dump_log2(NULL, AV_LOG_DEBUG, &pkt, do_hex_dump,
is->streams[pkt.stream_index]);
}
if (pkt.stream_index >= ifile->nb_streams) {
report_new_stream(file_index, &pkt);
goto discard_packet;
}
ist = input_streams[ifile->ist_index + pkt.stream_index];
ist->data_size += pkt.size;
ist->nb_packets++;
if (ist->discard)
goto discard_packet;
if (exit_on_error && (pkt.flags & AV_PKT_FLAG_CORRUPT)) {
av_log(NULL, AV_LOG_FATAL, "%s: corrupt input packet in stream %d\n", is->filename, pkt.stream_index);
exit_program(1);
}
if (debug_ts) {
av_log(NULL, AV_LOG_INFO, "demuxer -> ist_index:%d type:%s "
"next_dts:%s next_dts_time:%s next_pts:%s next_pts_time:%s pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s off:%s off_time:%s\n",
ifile->ist_index + pkt.stream_index, av_get_media_type_string(ist->dec_ctx->codec_type),
av_ts2str(ist->next_dts), av_ts2timestr(ist->next_dts, &AV_TIME_BASE_Q),
av_ts2str(ist->next_pts), av_ts2timestr(ist->next_pts, &AV_TIME_BASE_Q),
av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &ist->st->time_base),
av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &ist->st->time_base),
av_ts2str(input_files[ist->file_index]->ts_offset),
av_ts2timestr(input_files[ist->file_index]->ts_offset, &AV_TIME_BASE_Q));
}
if(!ist->wrap_correction_done && is->start_time != AV_NOPTS_VALUE && ist->st->pts_wrap_bits < 64){
int64_t stime, stime2;
if ( ist->next_dts == AV_NOPTS_VALUE
&& ifile->ts_offset == -is->start_time
&& (is->iformat->flags & AVFMT_TS_DISCONT)) {
int64_t new_start_time = INT64_MAX;
for (i=0; i<is->nb_streams; i++) {
AVStream *st = is->streams[i];
if(st->discard == AVDISCARD_ALL || st->start_time == AV_NOPTS_VALUE)
continue;
new_start_time = FFMIN(new_start_time, av_rescale_q(st->start_time, st->time_base, AV_TIME_BASE_Q));
}
if (new_start_time > is->start_time) {
av_log(is, AV_LOG_VERBOSE, "Correcting start time by %"PRId64"\n", new_start_time - is->start_time);
ifile->ts_offset = -new_start_time;
}
}
stime = av_rescale_q(is->start_time, AV_TIME_BASE_Q, ist->st->time_base);
stime2= stime + (1ULL<<ist->st->pts_wrap_bits);
ist->wrap_correction_done = 1;
if(stime2 > stime && pkt.dts != AV_NOPTS_VALUE && pkt.dts > stime + (1LL<<(ist->st->pts_wrap_bits-1))) {
pkt.dts -= 1ULL<<ist->st->pts_wrap_bits;
ist->wrap_correction_done = 0;
}
if(stime2 > stime && pkt.pts != AV_NOPTS_VALUE && pkt.pts > stime + (1LL<<(ist->st->pts_wrap_bits-1))) {
pkt.pts -= 1ULL<<ist->st->pts_wrap_bits;
ist->wrap_correction_done = 0;
}
}
if (ist->nb_packets == 1) {
if (ist->st->nb_side_data)
av_packet_split_side_data(&pkt);
for (i = 0; i < ist->st->nb_side_data; i++) {
AVPacketSideData *src_sd = &ist->st->side_data[i];
uint8_t *dst_data;
if (av_packet_get_side_data(&pkt, src_sd->type, NULL))
continue;
if (ist->autorotate && src_sd->type == AV_PKT_DATA_DISPLAYMATRIX)
continue;
dst_data = av_packet_new_side_data(&pkt, src_sd->type, src_sd->size);
if (!dst_data)
exit_program(1);
memcpy(dst_data, src_sd->data, src_sd->size);
}
}
if (pkt.dts != AV_NOPTS_VALUE)
pkt.dts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base);
if (pkt.pts != AV_NOPTS_VALUE)
pkt.pts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base);
if (pkt.pts != AV_NOPTS_VALUE)
pkt.pts *= ist->ts_scale;
if (pkt.dts != AV_NOPTS_VALUE)
pkt.dts *= ist->ts_scale;
pkt_dts = av_rescale_q_rnd(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
if ((ist->dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO ||
ist->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) &&
pkt_dts != AV_NOPTS_VALUE && ist->next_dts == AV_NOPTS_VALUE && !copy_ts
&& (is->iformat->flags & AVFMT_TS_DISCONT) && ifile->last_ts != AV_NOPTS_VALUE) {
int64_t delta = pkt_dts - ifile->last_ts;
if (delta < -1LL*dts_delta_threshold*AV_TIME_BASE ||
delta > 1LL*dts_delta_threshold*AV_TIME_BASE){
ifile->ts_offset -= delta;
av_log(NULL, AV_LOG_DEBUG,
"Inter stream timestamp discontinuity %"PRId64", new offset= %"PRId64"\n",
delta, ifile->ts_offset);
pkt.dts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);
if (pkt.pts != AV_NOPTS_VALUE)
pkt.pts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);
}
}
duration = av_rescale_q(ifile->duration, ifile->time_base, ist->st->time_base);
if (pkt.pts != AV_NOPTS_VALUE) {
pkt.pts += duration;
ist->max_pts = FFMAX(pkt.pts, ist->max_pts);
ist->min_pts = FFMIN(pkt.pts, ist->min_pts);
}
if (pkt.dts != AV_NOPTS_VALUE)
pkt.dts += duration;
pkt_dts = av_rescale_q_rnd(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
if ((ist->dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO ||
ist->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) &&
pkt_dts != AV_NOPTS_VALUE && ist->next_dts != AV_NOPTS_VALUE &&
!copy_ts) {
int64_t delta = pkt_dts - ist->next_dts;
if (is->iformat->flags & AVFMT_TS_DISCONT) {
if (delta < -1LL*dts_delta_threshold*AV_TIME_BASE ||
delta > 1LL*dts_delta_threshold*AV_TIME_BASE ||
pkt_dts + AV_TIME_BASE/10 < FFMAX(ist->pts, ist->dts)) {
ifile->ts_offset -= delta;
av_log(NULL, AV_LOG_DEBUG,
"timestamp discontinuity %"PRId64", new offset= %"PRId64"\n",
delta, ifile->ts_offset);
pkt.dts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);
if (pkt.pts != AV_NOPTS_VALUE)
pkt.pts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);
}
} else {
if ( delta < -1LL*dts_error_threshold*AV_TIME_BASE ||
delta > 1LL*dts_error_threshold*AV_TIME_BASE) {
av_log(NULL, AV_LOG_WARNING, "DTS %"PRId64", next:%"PRId64" st:%d invalid dropping\n", pkt.dts, ist->next_dts, pkt.stream_index);
pkt.dts = AV_NOPTS_VALUE;
}
if (pkt.pts != AV_NOPTS_VALUE){
int64_t pkt_pts = av_rescale_q(pkt.pts, ist->st->time_base, AV_TIME_BASE_Q);
delta = pkt_pts - ist->next_dts;
if ( delta < -1LL*dts_error_threshold*AV_TIME_BASE ||
delta > 1LL*dts_error_threshold*AV_TIME_BASE) {
av_log(NULL, AV_LOG_WARNING, "PTS %"PRId64", next:%"PRId64" invalid dropping st:%d\n", pkt.pts, ist->next_dts, pkt.stream_index);
pkt.pts = AV_NOPTS_VALUE;
}
}
}
}
if (pkt.dts != AV_NOPTS_VALUE)
ifile->last_ts = av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q);
if (debug_ts) {
av_log(NULL, AV_LOG_INFO, "demuxer+ffmpeg -> ist_index:%d type:%s pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s off:%s off_time:%s\n",
ifile->ist_index + pkt.stream_index, av_get_media_type_string(ist->dec_ctx->codec_type),
av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &ist->st->time_base),
av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &ist->st->time_base),
av_ts2str(input_files[ist->file_index]->ts_offset),
av_ts2timestr(input_files[ist->file_index]->ts_offset, &AV_TIME_BASE_Q));
}
sub2video_heartbeat(ist, pkt.pts);
process_input_packet(ist, &pkt, 0);
discard_packet:
av_packet_unref(&pkt);
return 0;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(int VAR_0)
{
InputFile *ifile = input_files[VAR_0];
AVFormatContext *is;
InputStream *ist;
AVPacket pkt;
int VAR_1, VAR_2, VAR_3;
int64_t duration;
int64_t pkt_dts;
is = ifile->ctx;
VAR_1 = get_input_packet(ifile, &pkt);
if (VAR_1 == AVERROR(EAGAIN)) {
ifile->eagain = 1;
return VAR_1;
}
if (VAR_1 < 0 && ifile->loop) {
if ((VAR_1 = seek_to_start(ifile, is)) < 0)
return VAR_1;
VAR_1 = get_input_packet(ifile, &pkt);
}
if (VAR_1 < 0) {
if (VAR_1 != AVERROR_EOF) {
print_error(is->filename, VAR_1);
if (exit_on_error)
exit_program(1);
}
for (VAR_2 = 0; VAR_2 < ifile->nb_streams; VAR_2++) {
ist = input_streams[ifile->ist_index + VAR_2];
if (ist->decoding_needed) {
VAR_1 = process_input_packet(ist, NULL, 0);
if (VAR_1>0)
return 0;
}
for (VAR_3 = 0; VAR_3 < nb_output_streams; VAR_3++) {
OutputStream *ost = output_streams[VAR_3];
if (ost->source_index == ifile->ist_index + VAR_2 &&
(ost->stream_copy || ost->enc->type == AVMEDIA_TYPE_SUBTITLE))
finish_output_stream(ost);
}
}
ifile->eof_reached = 1;
return AVERROR(EAGAIN);
}
reset_eagain();
if (do_pkt_dump) {
av_pkt_dump_log2(NULL, AV_LOG_DEBUG, &pkt, do_hex_dump,
is->streams[pkt.stream_index]);
}
if (pkt.stream_index >= ifile->nb_streams) {
report_new_stream(VAR_0, &pkt);
goto discard_packet;
}
ist = input_streams[ifile->ist_index + pkt.stream_index];
ist->data_size += pkt.size;
ist->nb_packets++;
if (ist->discard)
goto discard_packet;
if (exit_on_error && (pkt.flags & AV_PKT_FLAG_CORRUPT)) {
av_log(NULL, AV_LOG_FATAL, "%s: corrupt input packet in stream %d\n", is->filename, pkt.stream_index);
exit_program(1);
}
if (debug_ts) {
av_log(NULL, AV_LOG_INFO, "demuxer -> ist_index:%d type:%s "
"next_dts:%s next_dts_time:%s next_pts:%s next_pts_time:%s pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s off:%s off_time:%s\n",
ifile->ist_index + pkt.stream_index, av_get_media_type_string(ist->dec_ctx->codec_type),
av_ts2str(ist->next_dts), av_ts2timestr(ist->next_dts, &AV_TIME_BASE_Q),
av_ts2str(ist->next_pts), av_ts2timestr(ist->next_pts, &AV_TIME_BASE_Q),
av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &ist->st->time_base),
av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &ist->st->time_base),
av_ts2str(input_files[ist->VAR_0]->ts_offset),
av_ts2timestr(input_files[ist->VAR_0]->ts_offset, &AV_TIME_BASE_Q));
}
if(!ist->wrap_correction_done && is->start_time != AV_NOPTS_VALUE && ist->st->pts_wrap_bits < 64){
int64_t stime, stime2;
if ( ist->next_dts == AV_NOPTS_VALUE
&& ifile->ts_offset == -is->start_time
&& (is->iformat->flags & AVFMT_TS_DISCONT)) {
int64_t new_start_time = INT64_MAX;
for (VAR_2=0; VAR_2<is->nb_streams; VAR_2++) {
AVStream *st = is->streams[VAR_2];
if(st->discard == AVDISCARD_ALL || st->start_time == AV_NOPTS_VALUE)
continue;
new_start_time = FFMIN(new_start_time, av_rescale_q(st->start_time, st->time_base, AV_TIME_BASE_Q));
}
if (new_start_time > is->start_time) {
av_log(is, AV_LOG_VERBOSE, "Correcting start time by %"PRId64"\n", new_start_time - is->start_time);
ifile->ts_offset = -new_start_time;
}
}
stime = av_rescale_q(is->start_time, AV_TIME_BASE_Q, ist->st->time_base);
stime2= stime + (1ULL<<ist->st->pts_wrap_bits);
ist->wrap_correction_done = 1;
if(stime2 > stime && pkt.dts != AV_NOPTS_VALUE && pkt.dts > stime + (1LL<<(ist->st->pts_wrap_bits-1))) {
pkt.dts -= 1ULL<<ist->st->pts_wrap_bits;
ist->wrap_correction_done = 0;
}
if(stime2 > stime && pkt.pts != AV_NOPTS_VALUE && pkt.pts > stime + (1LL<<(ist->st->pts_wrap_bits-1))) {
pkt.pts -= 1ULL<<ist->st->pts_wrap_bits;
ist->wrap_correction_done = 0;
}
}
if (ist->nb_packets == 1) {
if (ist->st->nb_side_data)
av_packet_split_side_data(&pkt);
for (VAR_2 = 0; VAR_2 < ist->st->nb_side_data; VAR_2++) {
AVPacketSideData *src_sd = &ist->st->side_data[VAR_2];
uint8_t *dst_data;
if (av_packet_get_side_data(&pkt, src_sd->type, NULL))
continue;
if (ist->autorotate && src_sd->type == AV_PKT_DATA_DISPLAYMATRIX)
continue;
dst_data = av_packet_new_side_data(&pkt, src_sd->type, src_sd->size);
if (!dst_data)
exit_program(1);
memcpy(dst_data, src_sd->data, src_sd->size);
}
}
if (pkt.dts != AV_NOPTS_VALUE)
pkt.dts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base);
if (pkt.pts != AV_NOPTS_VALUE)
pkt.pts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base);
if (pkt.pts != AV_NOPTS_VALUE)
pkt.pts *= ist->ts_scale;
if (pkt.dts != AV_NOPTS_VALUE)
pkt.dts *= ist->ts_scale;
pkt_dts = av_rescale_q_rnd(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
if ((ist->dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO ||
ist->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) &&
pkt_dts != AV_NOPTS_VALUE && ist->next_dts == AV_NOPTS_VALUE && !copy_ts
&& (is->iformat->flags & AVFMT_TS_DISCONT) && ifile->last_ts != AV_NOPTS_VALUE) {
int64_t delta = pkt_dts - ifile->last_ts;
if (delta < -1LL*dts_delta_threshold*AV_TIME_BASE ||
delta > 1LL*dts_delta_threshold*AV_TIME_BASE){
ifile->ts_offset -= delta;
av_log(NULL, AV_LOG_DEBUG,
"Inter stream timestamp discontinuity %"PRId64", new offset= %"PRId64"\n",
delta, ifile->ts_offset);
pkt.dts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);
if (pkt.pts != AV_NOPTS_VALUE)
pkt.pts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);
}
}
duration = av_rescale_q(ifile->duration, ifile->time_base, ist->st->time_base);
if (pkt.pts != AV_NOPTS_VALUE) {
pkt.pts += duration;
ist->max_pts = FFMAX(pkt.pts, ist->max_pts);
ist->min_pts = FFMIN(pkt.pts, ist->min_pts);
}
if (pkt.dts != AV_NOPTS_VALUE)
pkt.dts += duration;
pkt_dts = av_rescale_q_rnd(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
if ((ist->dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO ||
ist->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) &&
pkt_dts != AV_NOPTS_VALUE && ist->next_dts != AV_NOPTS_VALUE &&
!copy_ts) {
int64_t delta = pkt_dts - ist->next_dts;
if (is->iformat->flags & AVFMT_TS_DISCONT) {
if (delta < -1LL*dts_delta_threshold*AV_TIME_BASE ||
delta > 1LL*dts_delta_threshold*AV_TIME_BASE ||
pkt_dts + AV_TIME_BASE/10 < FFMAX(ist->pts, ist->dts)) {
ifile->ts_offset -= delta;
av_log(NULL, AV_LOG_DEBUG,
"timestamp discontinuity %"PRId64", new offset= %"PRId64"\n",
delta, ifile->ts_offset);
pkt.dts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);
if (pkt.pts != AV_NOPTS_VALUE)
pkt.pts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);
}
} else {
if ( delta < -1LL*dts_error_threshold*AV_TIME_BASE ||
delta > 1LL*dts_error_threshold*AV_TIME_BASE) {
av_log(NULL, AV_LOG_WARNING, "DTS %"PRId64", next:%"PRId64" st:%d invalid dropping\n", pkt.dts, ist->next_dts, pkt.stream_index);
pkt.dts = AV_NOPTS_VALUE;
}
if (pkt.pts != AV_NOPTS_VALUE){
int64_t pkt_pts = av_rescale_q(pkt.pts, ist->st->time_base, AV_TIME_BASE_Q);
delta = pkt_pts - ist->next_dts;
if ( delta < -1LL*dts_error_threshold*AV_TIME_BASE ||
delta > 1LL*dts_error_threshold*AV_TIME_BASE) {
av_log(NULL, AV_LOG_WARNING, "PTS %"PRId64", next:%"PRId64" invalid dropping st:%d\n", pkt.pts, ist->next_dts, pkt.stream_index);
pkt.pts = AV_NOPTS_VALUE;
}
}
}
}
if (pkt.dts != AV_NOPTS_VALUE)
ifile->last_ts = av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q);
if (debug_ts) {
av_log(NULL, AV_LOG_INFO, "demuxer+ffmpeg -> ist_index:%d type:%s pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s off:%s off_time:%s\n",
ifile->ist_index + pkt.stream_index, av_get_media_type_string(ist->dec_ctx->codec_type),
av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &ist->st->time_base),
av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &ist->st->time_base),
av_ts2str(input_files[ist->VAR_0]->ts_offset),
av_ts2timestr(input_files[ist->VAR_0]->ts_offset, &AV_TIME_BASE_Q));
}
sub2video_heartbeat(ist, pkt.pts);
process_input_packet(ist, &pkt, 0);
discard_packet:
av_packet_unref(&pkt);
return 0;
}
| [
"static int FUNC_0(int VAR_0)\n{",
"InputFile *ifile = input_files[VAR_0];",
"AVFormatContext *is;",
"InputStream *ist;",
"AVPacket pkt;",
"int VAR_1, VAR_2, VAR_3;",
"int64_t duration;",
"int64_t pkt_dts;",
"is = ifile->ctx;",
"VAR_1 = get_input_packet(ifile, &pkt);",
"if (VAR_1 == AVERROR(EAGAIN)) {",
"ifile->eagain = 1;",
"return VAR_1;",
"}",
"if (VAR_1 < 0 && ifile->loop) {",
"if ((VAR_1 = seek_to_start(ifile, is)) < 0)\nreturn VAR_1;",
"VAR_1 = get_input_packet(ifile, &pkt);",
"}",
"if (VAR_1 < 0) {",
"if (VAR_1 != AVERROR_EOF) {",
"print_error(is->filename, VAR_1);",
"if (exit_on_error)\nexit_program(1);",
"}",
"for (VAR_2 = 0; VAR_2 < ifile->nb_streams; VAR_2++) {",
"ist = input_streams[ifile->ist_index + VAR_2];",
"if (ist->decoding_needed) {",
"VAR_1 = process_input_packet(ist, NULL, 0);",
"if (VAR_1>0)\nreturn 0;",
"}",
"for (VAR_3 = 0; VAR_3 < nb_output_streams; VAR_3++) {",
"OutputStream *ost = output_streams[VAR_3];",
"if (ost->source_index == ifile->ist_index + VAR_2 &&\n(ost->stream_copy || ost->enc->type == AVMEDIA_TYPE_SUBTITLE))\nfinish_output_stream(ost);",
"}",
"}",
"ifile->eof_reached = 1;",
"return AVERROR(EAGAIN);",
"}",
"reset_eagain();",
"if (do_pkt_dump) {",
"av_pkt_dump_log2(NULL, AV_LOG_DEBUG, &pkt, do_hex_dump,\nis->streams[pkt.stream_index]);",
"}",
"if (pkt.stream_index >= ifile->nb_streams) {",
"report_new_stream(VAR_0, &pkt);",
"goto discard_packet;",
"}",
"ist = input_streams[ifile->ist_index + pkt.stream_index];",
"ist->data_size += pkt.size;",
"ist->nb_packets++;",
"if (ist->discard)\ngoto discard_packet;",
"if (exit_on_error && (pkt.flags & AV_PKT_FLAG_CORRUPT)) {",
"av_log(NULL, AV_LOG_FATAL, \"%s: corrupt input packet in stream %d\\n\", is->filename, pkt.stream_index);",
"exit_program(1);",
"}",
"if (debug_ts) {",
"av_log(NULL, AV_LOG_INFO, \"demuxer -> ist_index:%d type:%s \"\n\"next_dts:%s next_dts_time:%s next_pts:%s next_pts_time:%s pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s off:%s off_time:%s\\n\",\nifile->ist_index + pkt.stream_index, av_get_media_type_string(ist->dec_ctx->codec_type),\nav_ts2str(ist->next_dts), av_ts2timestr(ist->next_dts, &AV_TIME_BASE_Q),\nav_ts2str(ist->next_pts), av_ts2timestr(ist->next_pts, &AV_TIME_BASE_Q),\nav_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &ist->st->time_base),\nav_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &ist->st->time_base),\nav_ts2str(input_files[ist->VAR_0]->ts_offset),\nav_ts2timestr(input_files[ist->VAR_0]->ts_offset, &AV_TIME_BASE_Q));",
"}",
"if(!ist->wrap_correction_done && is->start_time != AV_NOPTS_VALUE && ist->st->pts_wrap_bits < 64){",
"int64_t stime, stime2;",
"if ( ist->next_dts == AV_NOPTS_VALUE\n&& ifile->ts_offset == -is->start_time\n&& (is->iformat->flags & AVFMT_TS_DISCONT)) {",
"int64_t new_start_time = INT64_MAX;",
"for (VAR_2=0; VAR_2<is->nb_streams; VAR_2++) {",
"AVStream *st = is->streams[VAR_2];",
"if(st->discard == AVDISCARD_ALL || st->start_time == AV_NOPTS_VALUE)\ncontinue;",
"new_start_time = FFMIN(new_start_time, av_rescale_q(st->start_time, st->time_base, AV_TIME_BASE_Q));",
"}",
"if (new_start_time > is->start_time) {",
"av_log(is, AV_LOG_VERBOSE, \"Correcting start time by %\"PRId64\"\\n\", new_start_time - is->start_time);",
"ifile->ts_offset = -new_start_time;",
"}",
"}",
"stime = av_rescale_q(is->start_time, AV_TIME_BASE_Q, ist->st->time_base);",
"stime2= stime + (1ULL<<ist->st->pts_wrap_bits);",
"ist->wrap_correction_done = 1;",
"if(stime2 > stime && pkt.dts != AV_NOPTS_VALUE && pkt.dts > stime + (1LL<<(ist->st->pts_wrap_bits-1))) {",
"pkt.dts -= 1ULL<<ist->st->pts_wrap_bits;",
"ist->wrap_correction_done = 0;",
"}",
"if(stime2 > stime && pkt.pts != AV_NOPTS_VALUE && pkt.pts > stime + (1LL<<(ist->st->pts_wrap_bits-1))) {",
"pkt.pts -= 1ULL<<ist->st->pts_wrap_bits;",
"ist->wrap_correction_done = 0;",
"}",
"}",
"if (ist->nb_packets == 1) {",
"if (ist->st->nb_side_data)\nav_packet_split_side_data(&pkt);",
"for (VAR_2 = 0; VAR_2 < ist->st->nb_side_data; VAR_2++) {",
"AVPacketSideData *src_sd = &ist->st->side_data[VAR_2];",
"uint8_t *dst_data;",
"if (av_packet_get_side_data(&pkt, src_sd->type, NULL))\ncontinue;",
"if (ist->autorotate && src_sd->type == AV_PKT_DATA_DISPLAYMATRIX)\ncontinue;",
"dst_data = av_packet_new_side_data(&pkt, src_sd->type, src_sd->size);",
"if (!dst_data)\nexit_program(1);",
"memcpy(dst_data, src_sd->data, src_sd->size);",
"}",
"}",
"if (pkt.dts != AV_NOPTS_VALUE)\npkt.dts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base);",
"if (pkt.pts != AV_NOPTS_VALUE)\npkt.pts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base);",
"if (pkt.pts != AV_NOPTS_VALUE)\npkt.pts *= ist->ts_scale;",
"if (pkt.dts != AV_NOPTS_VALUE)\npkt.dts *= ist->ts_scale;",
"pkt_dts = av_rescale_q_rnd(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);",
"if ((ist->dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO ||\nist->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) &&\npkt_dts != AV_NOPTS_VALUE && ist->next_dts == AV_NOPTS_VALUE && !copy_ts\n&& (is->iformat->flags & AVFMT_TS_DISCONT) && ifile->last_ts != AV_NOPTS_VALUE) {",
"int64_t delta = pkt_dts - ifile->last_ts;",
"if (delta < -1LL*dts_delta_threshold*AV_TIME_BASE ||\ndelta > 1LL*dts_delta_threshold*AV_TIME_BASE){",
"ifile->ts_offset -= delta;",
"av_log(NULL, AV_LOG_DEBUG,\n\"Inter stream timestamp discontinuity %\"PRId64\", new offset= %\"PRId64\"\\n\",\ndelta, ifile->ts_offset);",
"pkt.dts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);",
"if (pkt.pts != AV_NOPTS_VALUE)\npkt.pts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);",
"}",
"}",
"duration = av_rescale_q(ifile->duration, ifile->time_base, ist->st->time_base);",
"if (pkt.pts != AV_NOPTS_VALUE) {",
"pkt.pts += duration;",
"ist->max_pts = FFMAX(pkt.pts, ist->max_pts);",
"ist->min_pts = FFMIN(pkt.pts, ist->min_pts);",
"}",
"if (pkt.dts != AV_NOPTS_VALUE)\npkt.dts += duration;",
"pkt_dts = av_rescale_q_rnd(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);",
"if ((ist->dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO ||\nist->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) &&\npkt_dts != AV_NOPTS_VALUE && ist->next_dts != AV_NOPTS_VALUE &&\n!copy_ts) {",
"int64_t delta = pkt_dts - ist->next_dts;",
"if (is->iformat->flags & AVFMT_TS_DISCONT) {",
"if (delta < -1LL*dts_delta_threshold*AV_TIME_BASE ||\ndelta > 1LL*dts_delta_threshold*AV_TIME_BASE ||\npkt_dts + AV_TIME_BASE/10 < FFMAX(ist->pts, ist->dts)) {",
"ifile->ts_offset -= delta;",
"av_log(NULL, AV_LOG_DEBUG,\n\"timestamp discontinuity %\"PRId64\", new offset= %\"PRId64\"\\n\",\ndelta, ifile->ts_offset);",
"pkt.dts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);",
"if (pkt.pts != AV_NOPTS_VALUE)\npkt.pts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);",
"}",
"} else {",
"if ( delta < -1LL*dts_error_threshold*AV_TIME_BASE ||\ndelta > 1LL*dts_error_threshold*AV_TIME_BASE) {",
"av_log(NULL, AV_LOG_WARNING, \"DTS %\"PRId64\", next:%\"PRId64\" st:%d invalid dropping\\n\", pkt.dts, ist->next_dts, pkt.stream_index);",
"pkt.dts = AV_NOPTS_VALUE;",
"}",
"if (pkt.pts != AV_NOPTS_VALUE){",
"int64_t pkt_pts = av_rescale_q(pkt.pts, ist->st->time_base, AV_TIME_BASE_Q);",
"delta = pkt_pts - ist->next_dts;",
"if ( delta < -1LL*dts_error_threshold*AV_TIME_BASE ||\ndelta > 1LL*dts_error_threshold*AV_TIME_BASE) {",
"av_log(NULL, AV_LOG_WARNING, \"PTS %\"PRId64\", next:%\"PRId64\" invalid dropping st:%d\\n\", pkt.pts, ist->next_dts, pkt.stream_index);",
"pkt.pts = AV_NOPTS_VALUE;",
"}",
"}",
"}",
"}",
"if (pkt.dts != AV_NOPTS_VALUE)\nifile->last_ts = av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q);",
"if (debug_ts) {",
"av_log(NULL, AV_LOG_INFO, \"demuxer+ffmpeg -> ist_index:%d type:%s pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s off:%s off_time:%s\\n\",\nifile->ist_index + pkt.stream_index, av_get_media_type_string(ist->dec_ctx->codec_type),\nav_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &ist->st->time_base),\nav_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &ist->st->time_base),\nav_ts2str(input_files[ist->VAR_0]->ts_offset),\nav_ts2timestr(input_files[ist->VAR_0]->ts_offset, &AV_TIME_BASE_Q));",
"}",
"sub2video_heartbeat(ist, pkt.pts);",
"process_input_packet(ist, &pkt, 0);",
"discard_packet:\nav_packet_unref(&pkt);",
"return 0;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
21
],
[
23
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37,
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51,
53
],
[
55
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67,
69
],
[
71
],
[
77
],
[
79
],
[
83,
85,
87
],
[
89
],
[
91
],
[
95
],
[
97
],
[
99
],
[
103
],
[
107
],
[
109,
111
],
[
113
],
[
119
],
[
121
],
[
123
],
[
125
],
[
129
],
[
133
],
[
135
],
[
139,
141
],
[
145
],
[
147
],
[
149
],
[
151
],
[
155
],
[
157,
159,
161,
163,
165,
167,
169,
171,
173
],
[
175
],
[
179
],
[
181
],
[
189,
191,
193
],
[
195
],
[
197
],
[
199
],
[
201,
203
],
[
205
],
[
207
],
[
209
],
[
211
],
[
213
],
[
215
],
[
217
],
[
221
],
[
223
],
[
225
],
[
229
],
[
231
],
[
233
],
[
235
],
[
237
],
[
239
],
[
241
],
[
243
],
[
245
],
[
251
],
[
253,
255
],
[
257
],
[
259
],
[
261
],
[
265,
267
],
[
269,
271
],
[
275
],
[
277,
279
],
[
283
],
[
285
],
[
287
],
[
291,
293
],
[
295,
297
],
[
301,
303
],
[
305,
307
],
[
311
],
[
313,
315,
317,
319
],
[
321
],
[
323,
325
],
[
327
],
[
329,
331,
333
],
[
335
],
[
337,
339
],
[
341
],
[
343
],
[
347
],
[
349
],
[
351
],
[
353
],
[
355
],
[
357
],
[
361,
363
],
[
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
],
[
439,
441
],
[
445
],
[
447,
449,
451,
453,
455,
457
],
[
459
],
[
463
],
[
467
],
[
471,
473
],
[
477
],
[
479
]
]
|
12,416 | void ff_put_h264_qpel4_mc23_msa(uint8_t *dst, const uint8_t *src,
ptrdiff_t stride)
{
avc_luma_midv_qrt_4w_msa(src - (2 * stride) - 2, stride, dst, stride, 4, 1);
}
| false | FFmpeg | 662234a9a22f1cd0f0ac83b8bb1ffadedca90c0a | void ff_put_h264_qpel4_mc23_msa(uint8_t *dst, const uint8_t *src,
ptrdiff_t stride)
{
avc_luma_midv_qrt_4w_msa(src - (2 * stride) - 2, stride, dst, stride, 4, 1);
}
| {
"code": [],
"line_no": []
} | void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1,
ptrdiff_t VAR_2)
{
avc_luma_midv_qrt_4w_msa(VAR_1 - (2 * VAR_2) - 2, VAR_2, VAR_0, VAR_2, 4, 1);
}
| [
"void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1,\nptrdiff_t VAR_2)\n{",
"avc_luma_midv_qrt_4w_msa(VAR_1 - (2 * VAR_2) - 2, VAR_2, VAR_0, VAR_2, 4, 1);",
"}"
]
| [
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
]
]
|
12,417 | static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
{
AVFilterLink *outlink = inlink->dst->outputs[0];
AVFilterBufferRef *outpicref = NULL;
int ret = 0;
if (inpicref->perms & AV_PERM_PRESERVE) {
outpicref = ff_get_video_buffer(outlink, AV_PERM_WRITE,
outlink->w, outlink->h);
if (!outpicref)
return AVERROR(ENOMEM);
avfilter_copy_buffer_ref_props(outpicref, inpicref);
outpicref->video->w = outlink->w;
outpicref->video->h = outlink->h;
} else {
outpicref = avfilter_ref_buffer(inpicref, ~0);
if (!outpicref)
return AVERROR(ENOMEM);
}
ret = ff_start_frame(outlink, avfilter_ref_buffer(outpicref, ~0));
if (ret < 0) {
avfilter_unref_bufferp(&outpicref);
return ret;
}
outlink->out_buf = outpicref;
return 0;
}
| false | FFmpeg | 1dc42050185d63c1de5d16146fbaee92640af187 | static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
{
AVFilterLink *outlink = inlink->dst->outputs[0];
AVFilterBufferRef *outpicref = NULL;
int ret = 0;
if (inpicref->perms & AV_PERM_PRESERVE) {
outpicref = ff_get_video_buffer(outlink, AV_PERM_WRITE,
outlink->w, outlink->h);
if (!outpicref)
return AVERROR(ENOMEM);
avfilter_copy_buffer_ref_props(outpicref, inpicref);
outpicref->video->w = outlink->w;
outpicref->video->h = outlink->h;
} else {
outpicref = avfilter_ref_buffer(inpicref, ~0);
if (!outpicref)
return AVERROR(ENOMEM);
}
ret = ff_start_frame(outlink, avfilter_ref_buffer(outpicref, ~0));
if (ret < 0) {
avfilter_unref_bufferp(&outpicref);
return ret;
}
outlink->out_buf = outpicref;
return 0;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(AVFilterLink *VAR_0, AVFilterBufferRef *VAR_1)
{
AVFilterLink *outlink = VAR_0->dst->outputs[0];
AVFilterBufferRef *outpicref = NULL;
int VAR_2 = 0;
if (VAR_1->perms & AV_PERM_PRESERVE) {
outpicref = ff_get_video_buffer(outlink, AV_PERM_WRITE,
outlink->w, outlink->h);
if (!outpicref)
return AVERROR(ENOMEM);
avfilter_copy_buffer_ref_props(outpicref, VAR_1);
outpicref->video->w = outlink->w;
outpicref->video->h = outlink->h;
} else {
outpicref = avfilter_ref_buffer(VAR_1, ~0);
if (!outpicref)
return AVERROR(ENOMEM);
}
VAR_2 = ff_start_frame(outlink, avfilter_ref_buffer(outpicref, ~0));
if (VAR_2 < 0) {
avfilter_unref_bufferp(&outpicref);
return VAR_2;
}
outlink->out_buf = outpicref;
return 0;
}
| [
"static int FUNC_0(AVFilterLink *VAR_0, AVFilterBufferRef *VAR_1)\n{",
"AVFilterLink *outlink = VAR_0->dst->outputs[0];",
"AVFilterBufferRef *outpicref = NULL;",
"int VAR_2 = 0;",
"if (VAR_1->perms & AV_PERM_PRESERVE) {",
"outpicref = ff_get_video_buffer(outlink, AV_PERM_WRITE,\noutlink->w, outlink->h);",
"if (!outpicref)\nreturn AVERROR(ENOMEM);",
"avfilter_copy_buffer_ref_props(outpicref, VAR_1);",
"outpicref->video->w = outlink->w;",
"outpicref->video->h = outlink->h;",
"} else {",
"outpicref = avfilter_ref_buffer(VAR_1, ~0);",
"if (!outpicref)\nreturn AVERROR(ENOMEM);",
"}",
"VAR_2 = ff_start_frame(outlink, avfilter_ref_buffer(outpicref, ~0));",
"if (VAR_2 < 0) {",
"avfilter_unref_bufferp(&outpicref);",
"return VAR_2;",
"}",
"outlink->out_buf = outpicref;",
"return 0;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15,
17
],
[
19,
21
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35,
37
],
[
39
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
55
],
[
57
],
[
59
]
]
|
12,420 | host_memory_backend_memory_complete(UserCreatable *uc, Error **errp)
{
HostMemoryBackend *backend = MEMORY_BACKEND(uc);
HostMemoryBackendClass *bc = MEMORY_BACKEND_GET_CLASS(uc);
Error *local_err = NULL;
void *ptr;
uint64_t sz;
if (bc->alloc) {
bc->alloc(backend, &local_err);
if (local_err) {
goto out;
}
ptr = memory_region_get_ram_ptr(&backend->mr);
sz = memory_region_size(&backend->mr);
if (backend->merge) {
qemu_madvise(ptr, sz, QEMU_MADV_MERGEABLE);
}
if (!backend->dump) {
qemu_madvise(ptr, sz, QEMU_MADV_DONTDUMP);
}
#ifdef CONFIG_NUMA
unsigned long lastbit = find_last_bit(backend->host_nodes, MAX_NODES);
/* lastbit == MAX_NODES means maxnode = 0 */
unsigned long maxnode = (lastbit + 1) % (MAX_NODES + 1);
/* ensure policy won't be ignored in case memory is preallocated
* before mbind(). note: MPOL_MF_STRICT is ignored on hugepages so
* this doesn't catch hugepage case. */
unsigned flags = MPOL_MF_STRICT | MPOL_MF_MOVE;
/* check for invalid host-nodes and policies and give more verbose
* error messages than mbind(). */
if (maxnode && backend->policy == MPOL_DEFAULT) {
error_setg(errp, "host-nodes must be empty for policy default,"
" or you should explicitly specify a policy other"
" than default");
return;
} else if (maxnode == 0 && backend->policy != MPOL_DEFAULT) {
error_setg(errp, "host-nodes must be set for policy %s",
HostMemPolicy_lookup[backend->policy]);
return;
}
/* We can have up to MAX_NODES nodes, but we need to pass maxnode+1
* as argument to mbind() due to an old Linux bug (feature?) which
* cuts off the last specified node. This means backend->host_nodes
* must have MAX_NODES+1 bits available.
*/
assert(sizeof(backend->host_nodes) >=
BITS_TO_LONGS(MAX_NODES + 1) * sizeof(unsigned long));
assert(maxnode <= MAX_NODES);
if (mbind(ptr, sz, backend->policy,
maxnode ? backend->host_nodes : NULL, maxnode + 1, flags)) {
if (backend->policy != MPOL_DEFAULT || errno != ENOSYS) {
error_setg_errno(errp, errno,
"cannot bind memory to host NUMA nodes");
return;
}
}
#endif
/* Preallocate memory after the NUMA policy has been instantiated.
* This is necessary to guarantee memory is allocated with
* specified NUMA policy in place.
*/
if (backend->prealloc) {
os_mem_prealloc(memory_region_get_fd(&backend->mr), ptr, sz,
&local_err);
if (local_err) {
goto out;
}
}
}
out:
error_propagate(errp, local_err);
}
| true | qemu | 1e356fc14beaa3ece6c0e961bd479af58be3198b | host_memory_backend_memory_complete(UserCreatable *uc, Error **errp)
{
HostMemoryBackend *backend = MEMORY_BACKEND(uc);
HostMemoryBackendClass *bc = MEMORY_BACKEND_GET_CLASS(uc);
Error *local_err = NULL;
void *ptr;
uint64_t sz;
if (bc->alloc) {
bc->alloc(backend, &local_err);
if (local_err) {
goto out;
}
ptr = memory_region_get_ram_ptr(&backend->mr);
sz = memory_region_size(&backend->mr);
if (backend->merge) {
qemu_madvise(ptr, sz, QEMU_MADV_MERGEABLE);
}
if (!backend->dump) {
qemu_madvise(ptr, sz, QEMU_MADV_DONTDUMP);
}
#ifdef CONFIG_NUMA
unsigned long lastbit = find_last_bit(backend->host_nodes, MAX_NODES);
unsigned long maxnode = (lastbit + 1) % (MAX_NODES + 1);
unsigned flags = MPOL_MF_STRICT | MPOL_MF_MOVE;
if (maxnode && backend->policy == MPOL_DEFAULT) {
error_setg(errp, "host-nodes must be empty for policy default,"
" or you should explicitly specify a policy other"
" than default");
return;
} else if (maxnode == 0 && backend->policy != MPOL_DEFAULT) {
error_setg(errp, "host-nodes must be set for policy %s",
HostMemPolicy_lookup[backend->policy]);
return;
}
assert(sizeof(backend->host_nodes) >=
BITS_TO_LONGS(MAX_NODES + 1) * sizeof(unsigned long));
assert(maxnode <= MAX_NODES);
if (mbind(ptr, sz, backend->policy,
maxnode ? backend->host_nodes : NULL, maxnode + 1, flags)) {
if (backend->policy != MPOL_DEFAULT || errno != ENOSYS) {
error_setg_errno(errp, errno,
"cannot bind memory to host NUMA nodes");
return;
}
}
#endif
if (backend->prealloc) {
os_mem_prealloc(memory_region_get_fd(&backend->mr), ptr, sz,
&local_err);
if (local_err) {
goto out;
}
}
}
out:
error_propagate(errp, local_err);
}
| {
"code": [
" &local_err);"
],
"line_no": [
137
]
} | FUNC_0(UserCreatable *VAR_0, Error **VAR_1)
{
HostMemoryBackend *backend = MEMORY_BACKEND(VAR_0);
HostMemoryBackendClass *bc = MEMORY_BACKEND_GET_CLASS(VAR_0);
Error *local_err = NULL;
void *VAR_2;
uint64_t sz;
if (bc->alloc) {
bc->alloc(backend, &local_err);
if (local_err) {
goto out;
}
VAR_2 = memory_region_get_ram_ptr(&backend->mr);
sz = memory_region_size(&backend->mr);
if (backend->merge) {
qemu_madvise(VAR_2, sz, QEMU_MADV_MERGEABLE);
}
if (!backend->dump) {
qemu_madvise(VAR_2, sz, QEMU_MADV_DONTDUMP);
}
#ifdef CONFIG_NUMA
unsigned long lastbit = find_last_bit(backend->host_nodes, MAX_NODES);
unsigned long maxnode = (lastbit + 1) % (MAX_NODES + 1);
unsigned flags = MPOL_MF_STRICT | MPOL_MF_MOVE;
if (maxnode && backend->policy == MPOL_DEFAULT) {
error_setg(VAR_1, "host-nodes must be empty for policy default,"
" or you should explicitly specify a policy other"
" than default");
return;
} else if (maxnode == 0 && backend->policy != MPOL_DEFAULT) {
error_setg(VAR_1, "host-nodes must be set for policy %s",
HostMemPolicy_lookup[backend->policy]);
return;
}
assert(sizeof(backend->host_nodes) >=
BITS_TO_LONGS(MAX_NODES + 1) * sizeof(unsigned long));
assert(maxnode <= MAX_NODES);
if (mbind(VAR_2, sz, backend->policy,
maxnode ? backend->host_nodes : NULL, maxnode + 1, flags)) {
if (backend->policy != MPOL_DEFAULT || errno != ENOSYS) {
error_setg_errno(VAR_1, errno,
"cannot bind memory to host NUMA nodes");
return;
}
}
#endif
if (backend->prealloc) {
os_mem_prealloc(memory_region_get_fd(&backend->mr), VAR_2, sz,
&local_err);
if (local_err) {
goto out;
}
}
}
out:
error_propagate(VAR_1, local_err);
}
| [
"FUNC_0(UserCreatable *VAR_0, Error **VAR_1)\n{",
"HostMemoryBackend *backend = MEMORY_BACKEND(VAR_0);",
"HostMemoryBackendClass *bc = MEMORY_BACKEND_GET_CLASS(VAR_0);",
"Error *local_err = NULL;",
"void *VAR_2;",
"uint64_t sz;",
"if (bc->alloc) {",
"bc->alloc(backend, &local_err);",
"if (local_err) {",
"goto out;",
"}",
"VAR_2 = memory_region_get_ram_ptr(&backend->mr);",
"sz = memory_region_size(&backend->mr);",
"if (backend->merge) {",
"qemu_madvise(VAR_2, sz, QEMU_MADV_MERGEABLE);",
"}",
"if (!backend->dump) {",
"qemu_madvise(VAR_2, sz, QEMU_MADV_DONTDUMP);",
"}",
"#ifdef CONFIG_NUMA\nunsigned long lastbit = find_last_bit(backend->host_nodes, MAX_NODES);",
"unsigned long maxnode = (lastbit + 1) % (MAX_NODES + 1);",
"unsigned flags = MPOL_MF_STRICT | MPOL_MF_MOVE;",
"if (maxnode && backend->policy == MPOL_DEFAULT) {",
"error_setg(VAR_1, \"host-nodes must be empty for policy default,\"\n\" or you should explicitly specify a policy other\"\n\" than default\");",
"return;",
"} else if (maxnode == 0 && backend->policy != MPOL_DEFAULT) {",
"error_setg(VAR_1, \"host-nodes must be set for policy %s\",\nHostMemPolicy_lookup[backend->policy]);",
"return;",
"}",
"assert(sizeof(backend->host_nodes) >=\nBITS_TO_LONGS(MAX_NODES + 1) * sizeof(unsigned long));",
"assert(maxnode <= MAX_NODES);",
"if (mbind(VAR_2, sz, backend->policy,\nmaxnode ? backend->host_nodes : NULL, maxnode + 1, flags)) {",
"if (backend->policy != MPOL_DEFAULT || errno != ENOSYS) {",
"error_setg_errno(VAR_1, errno,\n\"cannot bind memory to host NUMA nodes\");",
"return;",
"}",
"}",
"#endif\nif (backend->prealloc) {",
"os_mem_prealloc(memory_region_get_fd(&backend->mr), VAR_2, sz,\n&local_err);",
"if (local_err) {",
"goto out;",
"}",
"}",
"}",
"out:\nerror_propagate(VAR_1, local_err);",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
29
],
[
31
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47,
49
],
[
53
],
[
61
],
[
69
],
[
71,
73,
75
],
[
77
],
[
79
],
[
81,
83
],
[
85
],
[
87
],
[
101,
103
],
[
105
],
[
107,
109
],
[
111
],
[
113,
115
],
[
117
],
[
119
],
[
121
],
[
123,
133
],
[
135,
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149,
151
],
[
153
]
]
|
12,421 | static void fill_gv_table(int table[256 + 2*YUVRGB_TABLE_HEADROOM], const int elemsize, const int inc)
{
int i;
int off = -(inc >> 9);
for (i = 0; i < 256 + 2*YUVRGB_TABLE_HEADROOM; i++) {
int64_t cb = av_clip(i-YUVRGB_TABLE_HEADROOM, 0, 255)*inc;
table[i] = elemsize * (off + (cb >> 16));
}
}
| true | FFmpeg | cccb45751e93142d71be78f6bb90bbfb50ee13be | static void fill_gv_table(int table[256 + 2*YUVRGB_TABLE_HEADROOM], const int elemsize, const int inc)
{
int i;
int off = -(inc >> 9);
for (i = 0; i < 256 + 2*YUVRGB_TABLE_HEADROOM; i++) {
int64_t cb = av_clip(i-YUVRGB_TABLE_HEADROOM, 0, 255)*inc;
table[i] = elemsize * (off + (cb >> 16));
}
}
| {
"code": [
"static void fill_gv_table(int table[256 + 2*YUVRGB_TABLE_HEADROOM], const int elemsize, const int inc)"
],
"line_no": [
1
]
} | static void FUNC_0(int VAR_0[256 + 2*YUVRGB_TABLE_HEADROOM], const int VAR_1, const int VAR_2)
{
int VAR_3;
int VAR_4 = -(VAR_2 >> 9);
for (VAR_3 = 0; VAR_3 < 256 + 2*YUVRGB_TABLE_HEADROOM; VAR_3++) {
int64_t cb = av_clip(VAR_3-YUVRGB_TABLE_HEADROOM, 0, 255)*VAR_2;
VAR_0[VAR_3] = VAR_1 * (VAR_4 + (cb >> 16));
}
}
| [
"static void FUNC_0(int VAR_0[256 + 2*YUVRGB_TABLE_HEADROOM], const int VAR_1, const int VAR_2)\n{",
"int VAR_3;",
"int VAR_4 = -(VAR_2 >> 9);",
"for (VAR_3 = 0; VAR_3 < 256 + 2*YUVRGB_TABLE_HEADROOM; VAR_3++) {",
"int64_t cb = av_clip(VAR_3-YUVRGB_TABLE_HEADROOM, 0, 255)*VAR_2;",
"VAR_0[VAR_3] = VAR_1 * (VAR_4 + (cb >> 16));",
"}",
"}"
]
| [
1,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
]
]
|
12,422 | static ssize_t write_console_data(SCLPEvent *event, const uint8_t *buf,
size_t len)
{
SCLPConsole *scon = SCLP_CONSOLE(event);
if (!scon->chr) {
/* If there's no backend, we can just say we consumed all data. */
return len;
}
return qemu_chr_fe_write_all(scon->chr, buf, len);
} | true | qemu | 6ab3fc32ea640026726bc5f9f4db622d0954fb8a | static ssize_t write_console_data(SCLPEvent *event, const uint8_t *buf,
size_t len)
{
SCLPConsole *scon = SCLP_CONSOLE(event);
if (!scon->chr) {
return len;
}
return qemu_chr_fe_write_all(scon->chr, buf, len);
} | {
"code": [],
"line_no": []
} | static ssize_t FUNC_0(SCLPEvent *event, const uint8_t *buf,
size_t len)
{
SCLPConsole *scon = SCLP_CONSOLE(event);
if (!scon->chr) {
return len;
}
return qemu_chr_fe_write_all(scon->chr, buf, len);
} | [
"static ssize_t FUNC_0(SCLPEvent *event, const uint8_t *buf,\nsize_t len)\n{",
"SCLPConsole *scon = SCLP_CONSOLE(event);",
"if (!scon->chr) {",
"return len;",
"}",
"return qemu_chr_fe_write_all(scon->chr, buf, len);",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
11
],
[
15
],
[
17
],
[
23
],
[
25
]
]
|
12,423 | static int rewrite_footer(BlockDriverState* bs)
{
int ret;
BDRVVPCState *s = bs->opaque;
int64_t offset = s->free_data_block_offset;
ret = bdrv_pwrite(bs->file, offset, s->footer_buf, HEADER_SIZE);
if (ret < 0)
return ret;
return 0;
}
| true | qemu | 078a458e077d6b0db262c4b05fee51d01de2d1d2 | static int rewrite_footer(BlockDriverState* bs)
{
int ret;
BDRVVPCState *s = bs->opaque;
int64_t offset = s->free_data_block_offset;
ret = bdrv_pwrite(bs->file, offset, s->footer_buf, HEADER_SIZE);
if (ret < 0)
return ret;
return 0;
}
| {
"code": [
" ret = bdrv_pwrite(bs->file, offset, s->footer_buf, HEADER_SIZE);"
],
"line_no": [
13
]
} | static int FUNC_0(BlockDriverState* VAR_0)
{
int VAR_1;
BDRVVPCState *s = VAR_0->opaque;
int64_t offset = s->free_data_block_offset;
VAR_1 = bdrv_pwrite(VAR_0->file, offset, s->footer_buf, HEADER_SIZE);
if (VAR_1 < 0)
return VAR_1;
return 0;
}
| [
"static int FUNC_0(BlockDriverState* VAR_0)\n{",
"int VAR_1;",
"BDRVVPCState *s = VAR_0->opaque;",
"int64_t offset = s->free_data_block_offset;",
"VAR_1 = bdrv_pwrite(VAR_0->file, offset, s->footer_buf, HEADER_SIZE);",
"if (VAR_1 < 0)\nreturn VAR_1;",
"return 0;",
"}"
]
| [
0,
0,
0,
0,
1,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15,
17
],
[
21
],
[
23
]
]
|
12,424 | static uint32_t sdhci_read_dataport(SDHCIState *s, unsigned size)
{
uint32_t value = 0;
int i;
/* first check that a valid data exists in host controller input buffer */
if ((s->prnsts & SDHC_DATA_AVAILABLE) == 0) {
ERRPRINT("Trying to read from empty buffer\n");
return 0;
}
for (i = 0; i < size; i++) {
value |= s->fifo_buffer[s->data_count] << i * 8;
s->data_count++;
/* check if we've read all valid data (blksize bytes) from buffer */
if ((s->data_count) >= (s->blksize & 0x0fff)) {
DPRINT_L2("All %u bytes of data have been read from input buffer\n",
s->data_count);
s->prnsts &= ~SDHC_DATA_AVAILABLE; /* no more data in a buffer */
s->data_count = 0; /* next buff read must start at position [0] */
if (s->trnmod & SDHC_TRNS_BLK_CNT_EN) {
s->blkcnt--;
}
/* if that was the last block of data */
if ((s->trnmod & SDHC_TRNS_MULTI) == 0 ||
((s->trnmod & SDHC_TRNS_BLK_CNT_EN) && (s->blkcnt == 0)) ||
/* stop at gap request */
(s->stopped_state == sdhc_gap_read &&
!(s->prnsts & SDHC_DAT_LINE_ACTIVE))) {
sdhci_end_transfer(s);
} else { /* if there are more data, read next block from card */
sdhci_read_block_from_card(s);
}
break;
}
}
return value;
}
| true | qemu | 8be487d8f184f2f721cabeac559fb7a6cba18c95 | static uint32_t sdhci_read_dataport(SDHCIState *s, unsigned size)
{
uint32_t value = 0;
int i;
if ((s->prnsts & SDHC_DATA_AVAILABLE) == 0) {
ERRPRINT("Trying to read from empty buffer\n");
return 0;
}
for (i = 0; i < size; i++) {
value |= s->fifo_buffer[s->data_count] << i * 8;
s->data_count++;
if ((s->data_count) >= (s->blksize & 0x0fff)) {
DPRINT_L2("All %u bytes of data have been read from input buffer\n",
s->data_count);
s->prnsts &= ~SDHC_DATA_AVAILABLE;
s->data_count = 0;
if (s->trnmod & SDHC_TRNS_BLK_CNT_EN) {
s->blkcnt--;
}
if ((s->trnmod & SDHC_TRNS_MULTI) == 0 ||
((s->trnmod & SDHC_TRNS_BLK_CNT_EN) && (s->blkcnt == 0)) ||
(s->stopped_state == sdhc_gap_read &&
!(s->prnsts & SDHC_DAT_LINE_ACTIVE))) {
sdhci_end_transfer(s);
} else {
sdhci_read_block_from_card(s);
}
break;
}
}
return value;
}
| {
"code": [
" ERRPRINT(\"Trying to read from empty buffer\\n\");",
" DPRINT_L2(\"All %u bytes of data have been read from input buffer\\n\",",
" s->data_count);",
" s->data_count);"
],
"line_no": [
15,
33,
35,
35
]
} | static uint32_t FUNC_0(SDHCIState *s, unsigned size)
{
uint32_t value = 0;
int VAR_0;
if ((s->prnsts & SDHC_DATA_AVAILABLE) == 0) {
ERRPRINT("Trying to read from empty buffer\n");
return 0;
}
for (VAR_0 = 0; VAR_0 < size; VAR_0++) {
value |= s->fifo_buffer[s->data_count] << VAR_0 * 8;
s->data_count++;
if ((s->data_count) >= (s->blksize & 0x0fff)) {
DPRINT_L2("All %u bytes of data have been read from input buffer\n",
s->data_count);
s->prnsts &= ~SDHC_DATA_AVAILABLE;
s->data_count = 0;
if (s->trnmod & SDHC_TRNS_BLK_CNT_EN) {
s->blkcnt--;
}
if ((s->trnmod & SDHC_TRNS_MULTI) == 0 ||
((s->trnmod & SDHC_TRNS_BLK_CNT_EN) && (s->blkcnt == 0)) ||
(s->stopped_state == sdhc_gap_read &&
!(s->prnsts & SDHC_DAT_LINE_ACTIVE))) {
sdhci_end_transfer(s);
} else {
sdhci_read_block_from_card(s);
}
break;
}
}
return value;
}
| [
"static uint32_t FUNC_0(SDHCIState *s, unsigned size)\n{",
"uint32_t value = 0;",
"int VAR_0;",
"if ((s->prnsts & SDHC_DATA_AVAILABLE) == 0) {",
"ERRPRINT(\"Trying to read from empty buffer\\n\");",
"return 0;",
"}",
"for (VAR_0 = 0; VAR_0 < size; VAR_0++) {",
"value |= s->fifo_buffer[s->data_count] << VAR_0 * 8;",
"s->data_count++;",
"if ((s->data_count) >= (s->blksize & 0x0fff)) {",
"DPRINT_L2(\"All %u bytes of data have been read from input buffer\\n\",\ns->data_count);",
"s->prnsts &= ~SDHC_DATA_AVAILABLE;",
"s->data_count = 0;",
"if (s->trnmod & SDHC_TRNS_BLK_CNT_EN) {",
"s->blkcnt--;",
"}",
"if ((s->trnmod & SDHC_TRNS_MULTI) == 0 ||\n((s->trnmod & SDHC_TRNS_BLK_CNT_EN) && (s->blkcnt == 0)) ||\n(s->stopped_state == sdhc_gap_read &&\n!(s->prnsts & SDHC_DAT_LINE_ACTIVE))) {",
"sdhci_end_transfer(s);",
"} else {",
"sdhci_read_block_from_card(s);",
"}",
"break;",
"}",
"}",
"return value;",
"}"
]
| [
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25
],
[
27
],
[
31
],
[
33,
35
],
[
37
],
[
39
],
[
43
],
[
45
],
[
47
],
[
53,
55,
59,
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
79
],
[
81
]
]
|
12,425 | static int archipelago_aio_segmented_rw(BDRVArchipelagoState *s,
size_t count,
off_t offset,
ArchipelagoAIOCB *aio_cb,
int op)
{
int i, ret, segments_nr, last_segment_size;
ArchipelagoSegmentedRequest *segreq;
segreq = g_malloc(sizeof(ArchipelagoSegmentedRequest));
if (op == ARCHIP_OP_FLUSH) {
segments_nr = 1;
segreq->ref = segments_nr;
segreq->total = count;
segreq->count = 0;
segreq->failed = 0;
ret = archipelago_submit_request(s, 0, count, offset, aio_cb,
segreq, ARCHIP_OP_FLUSH);
if (ret < 0) {
goto err_exit;
}
return 0;
}
segments_nr = (int)(count / MAX_REQUEST_SIZE) + \
((count % MAX_REQUEST_SIZE) ? 1 : 0);
last_segment_size = (int)(count % MAX_REQUEST_SIZE);
segreq->ref = segments_nr;
segreq->total = count;
segreq->count = 0;
segreq->failed = 0;
for (i = 0; i < segments_nr - 1; i++) {
ret = archipelago_submit_request(s, i * MAX_REQUEST_SIZE,
MAX_REQUEST_SIZE,
offset + i * MAX_REQUEST_SIZE,
aio_cb, segreq, op);
if (ret < 0) {
goto err_exit;
}
}
if ((segments_nr > 1) && last_segment_size) {
ret = archipelago_submit_request(s, i * MAX_REQUEST_SIZE,
last_segment_size,
offset + i * MAX_REQUEST_SIZE,
aio_cb, segreq, op);
} else if ((segments_nr > 1) && !last_segment_size) {
ret = archipelago_submit_request(s, i * MAX_REQUEST_SIZE,
MAX_REQUEST_SIZE,
offset + i * MAX_REQUEST_SIZE,
aio_cb, segreq, op);
} else if (segments_nr == 1) {
ret = archipelago_submit_request(s, 0, count, offset, aio_cb,
segreq, op);
}
if (ret < 0) {
goto err_exit;
}
return 0;
err_exit:
__sync_add_and_fetch(&segreq->failed, 1);
if (segments_nr == 1) {
if (__sync_add_and_fetch(&segreq->ref, -1) == 0) {
g_free(segreq);
}
} else {
if ((__sync_add_and_fetch(&segreq->ref, -segments_nr + i)) == 0) {
g_free(segreq);
}
}
return ret;
}
| true | qemu | 5839e53bbc0fec56021d758aab7610df421ed8c8 | static int archipelago_aio_segmented_rw(BDRVArchipelagoState *s,
size_t count,
off_t offset,
ArchipelagoAIOCB *aio_cb,
int op)
{
int i, ret, segments_nr, last_segment_size;
ArchipelagoSegmentedRequest *segreq;
segreq = g_malloc(sizeof(ArchipelagoSegmentedRequest));
if (op == ARCHIP_OP_FLUSH) {
segments_nr = 1;
segreq->ref = segments_nr;
segreq->total = count;
segreq->count = 0;
segreq->failed = 0;
ret = archipelago_submit_request(s, 0, count, offset, aio_cb,
segreq, ARCHIP_OP_FLUSH);
if (ret < 0) {
goto err_exit;
}
return 0;
}
segments_nr = (int)(count / MAX_REQUEST_SIZE) + \
((count % MAX_REQUEST_SIZE) ? 1 : 0);
last_segment_size = (int)(count % MAX_REQUEST_SIZE);
segreq->ref = segments_nr;
segreq->total = count;
segreq->count = 0;
segreq->failed = 0;
for (i = 0; i < segments_nr - 1; i++) {
ret = archipelago_submit_request(s, i * MAX_REQUEST_SIZE,
MAX_REQUEST_SIZE,
offset + i * MAX_REQUEST_SIZE,
aio_cb, segreq, op);
if (ret < 0) {
goto err_exit;
}
}
if ((segments_nr > 1) && last_segment_size) {
ret = archipelago_submit_request(s, i * MAX_REQUEST_SIZE,
last_segment_size,
offset + i * MAX_REQUEST_SIZE,
aio_cb, segreq, op);
} else if ((segments_nr > 1) && !last_segment_size) {
ret = archipelago_submit_request(s, i * MAX_REQUEST_SIZE,
MAX_REQUEST_SIZE,
offset + i * MAX_REQUEST_SIZE,
aio_cb, segreq, op);
} else if (segments_nr == 1) {
ret = archipelago_submit_request(s, 0, count, offset, aio_cb,
segreq, op);
}
if (ret < 0) {
goto err_exit;
}
return 0;
err_exit:
__sync_add_and_fetch(&segreq->failed, 1);
if (segments_nr == 1) {
if (__sync_add_and_fetch(&segreq->ref, -1) == 0) {
g_free(segreq);
}
} else {
if ((__sync_add_and_fetch(&segreq->ref, -segments_nr + i)) == 0) {
g_free(segreq);
}
}
return ret;
}
| {
"code": [
" segreq = g_malloc(sizeof(ArchipelagoSegmentedRequest));"
],
"line_no": [
19
]
} | static int FUNC_0(BDRVArchipelagoState *VAR_0,
size_t VAR_1,
off_t VAR_2,
ArchipelagoAIOCB *VAR_3,
int VAR_4)
{
int VAR_5, VAR_6, VAR_7, VAR_8;
ArchipelagoSegmentedRequest *segreq;
segreq = g_malloc(sizeof(ArchipelagoSegmentedRequest));
if (VAR_4 == ARCHIP_OP_FLUSH) {
VAR_7 = 1;
segreq->ref = VAR_7;
segreq->total = VAR_1;
segreq->VAR_1 = 0;
segreq->failed = 0;
VAR_6 = archipelago_submit_request(VAR_0, 0, VAR_1, VAR_2, VAR_3,
segreq, ARCHIP_OP_FLUSH);
if (VAR_6 < 0) {
goto err_exit;
}
return 0;
}
VAR_7 = (int)(VAR_1 / MAX_REQUEST_SIZE) + \
((VAR_1 % MAX_REQUEST_SIZE) ? 1 : 0);
VAR_8 = (int)(VAR_1 % MAX_REQUEST_SIZE);
segreq->ref = VAR_7;
segreq->total = VAR_1;
segreq->VAR_1 = 0;
segreq->failed = 0;
for (VAR_5 = 0; VAR_5 < VAR_7 - 1; VAR_5++) {
VAR_6 = archipelago_submit_request(VAR_0, VAR_5 * MAX_REQUEST_SIZE,
MAX_REQUEST_SIZE,
VAR_2 + VAR_5 * MAX_REQUEST_SIZE,
VAR_3, segreq, VAR_4);
if (VAR_6 < 0) {
goto err_exit;
}
}
if ((VAR_7 > 1) && VAR_8) {
VAR_6 = archipelago_submit_request(VAR_0, VAR_5 * MAX_REQUEST_SIZE,
VAR_8,
VAR_2 + VAR_5 * MAX_REQUEST_SIZE,
VAR_3, segreq, VAR_4);
} else if ((VAR_7 > 1) && !VAR_8) {
VAR_6 = archipelago_submit_request(VAR_0, VAR_5 * MAX_REQUEST_SIZE,
MAX_REQUEST_SIZE,
VAR_2 + VAR_5 * MAX_REQUEST_SIZE,
VAR_3, segreq, VAR_4);
} else if (VAR_7 == 1) {
VAR_6 = archipelago_submit_request(VAR_0, 0, VAR_1, VAR_2, VAR_3,
segreq, VAR_4);
}
if (VAR_6 < 0) {
goto err_exit;
}
return 0;
err_exit:
__sync_add_and_fetch(&segreq->failed, 1);
if (VAR_7 == 1) {
if (__sync_add_and_fetch(&segreq->ref, -1) == 0) {
g_free(segreq);
}
} else {
if ((__sync_add_and_fetch(&segreq->ref, -VAR_7 + VAR_5)) == 0) {
g_free(segreq);
}
}
return VAR_6;
}
| [
"static int FUNC_0(BDRVArchipelagoState *VAR_0,\nsize_t VAR_1,\noff_t VAR_2,\nArchipelagoAIOCB *VAR_3,\nint VAR_4)\n{",
"int VAR_5, VAR_6, VAR_7, VAR_8;",
"ArchipelagoSegmentedRequest *segreq;",
"segreq = g_malloc(sizeof(ArchipelagoSegmentedRequest));",
"if (VAR_4 == ARCHIP_OP_FLUSH) {",
"VAR_7 = 1;",
"segreq->ref = VAR_7;",
"segreq->total = VAR_1;",
"segreq->VAR_1 = 0;",
"segreq->failed = 0;",
"VAR_6 = archipelago_submit_request(VAR_0, 0, VAR_1, VAR_2, VAR_3,\nsegreq, ARCHIP_OP_FLUSH);",
"if (VAR_6 < 0) {",
"goto err_exit;",
"}",
"return 0;",
"}",
"VAR_7 = (int)(VAR_1 / MAX_REQUEST_SIZE) + \\\n((VAR_1 % MAX_REQUEST_SIZE) ? 1 : 0);",
"VAR_8 = (int)(VAR_1 % MAX_REQUEST_SIZE);",
"segreq->ref = VAR_7;",
"segreq->total = VAR_1;",
"segreq->VAR_1 = 0;",
"segreq->failed = 0;",
"for (VAR_5 = 0; VAR_5 < VAR_7 - 1; VAR_5++) {",
"VAR_6 = archipelago_submit_request(VAR_0, VAR_5 * MAX_REQUEST_SIZE,\nMAX_REQUEST_SIZE,\nVAR_2 + VAR_5 * MAX_REQUEST_SIZE,\nVAR_3, segreq, VAR_4);",
"if (VAR_6 < 0) {",
"goto err_exit;",
"}",
"}",
"if ((VAR_7 > 1) && VAR_8) {",
"VAR_6 = archipelago_submit_request(VAR_0, VAR_5 * MAX_REQUEST_SIZE,\nVAR_8,\nVAR_2 + VAR_5 * MAX_REQUEST_SIZE,\nVAR_3, segreq, VAR_4);",
"} else if ((VAR_7 > 1) && !VAR_8) {",
"VAR_6 = archipelago_submit_request(VAR_0, VAR_5 * MAX_REQUEST_SIZE,\nMAX_REQUEST_SIZE,\nVAR_2 + VAR_5 * MAX_REQUEST_SIZE,\nVAR_3, segreq, VAR_4);",
"} else if (VAR_7 == 1) {",
"VAR_6 = archipelago_submit_request(VAR_0, 0, VAR_1, VAR_2, VAR_3,\nsegreq, VAR_4);",
"}",
"if (VAR_6 < 0) {",
"goto err_exit;",
"}",
"return 0;",
"err_exit:\n__sync_add_and_fetch(&segreq->failed, 1);",
"if (VAR_7 == 1) {",
"if (__sync_add_and_fetch(&segreq->ref, -1) == 0) {",
"g_free(segreq);",
"}",
"} else {",
"if ((__sync_add_and_fetch(&segreq->ref, -VAR_7 + VAR_5)) == 0) {",
"g_free(segreq);",
"}",
"}",
"return VAR_6;",
"}"
]
| [
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,
3,
5,
7,
9,
11
],
[
13
],
[
15
],
[
19
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35,
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
51,
53
],
[
55
],
[
59
],
[
61
],
[
63
],
[
65
],
[
69
],
[
71,
73,
75,
77
],
[
81
],
[
83
],
[
85
],
[
87
],
[
91
],
[
93,
95,
97,
99
],
[
101
],
[
103,
105,
107,
109
],
[
111
],
[
113,
115
],
[
117
],
[
121
],
[
123
],
[
125
],
[
129
],
[
133,
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149
],
[
151
],
[
153
],
[
157
],
[
159
]
]
|
12,427 | static int ram_load_dead(QEMUFile *f, void *opaque)
{
RamDecompressState s1, *s = &s1;
uint8_t buf[10];
ram_addr_t i;
if (ram_decompress_open(s, f) < 0)
return -EINVAL;
for(i = 0; i < last_ram_offset; i+= BDRV_HASH_BLOCK_SIZE) {
if (ram_decompress_buf(s, buf, 1) < 0) {
fprintf(stderr, "Error while reading ram block header\n");
goto error;
}
if (buf[0] == 0) {
if (ram_decompress_buf(s, qemu_get_ram_ptr(i),
BDRV_HASH_BLOCK_SIZE) < 0) {
fprintf(stderr, "Error while reading ram block address=0x%08" PRIx64, (uint64_t)i);
goto error;
}
} else {
error:
printf("Error block header\n");
return -EINVAL;
}
}
ram_decompress_close(s);
return 0;
}
| true | qemu | 94fb0909645de18481cc726ee0ec9b5afa861394 | static int ram_load_dead(QEMUFile *f, void *opaque)
{
RamDecompressState s1, *s = &s1;
uint8_t buf[10];
ram_addr_t i;
if (ram_decompress_open(s, f) < 0)
return -EINVAL;
for(i = 0; i < last_ram_offset; i+= BDRV_HASH_BLOCK_SIZE) {
if (ram_decompress_buf(s, buf, 1) < 0) {
fprintf(stderr, "Error while reading ram block header\n");
goto error;
}
if (buf[0] == 0) {
if (ram_decompress_buf(s, qemu_get_ram_ptr(i),
BDRV_HASH_BLOCK_SIZE) < 0) {
fprintf(stderr, "Error while reading ram block address=0x%08" PRIx64, (uint64_t)i);
goto error;
}
} else {
error:
printf("Error block header\n");
return -EINVAL;
}
}
ram_decompress_close(s);
return 0;
}
| {
"code": [
" return 0;",
" return 0;",
"static int ram_load_dead(QEMUFile *f, void *opaque)",
" RamDecompressState s1, *s = &s1;",
" uint8_t buf[10];",
" ram_addr_t i;",
" if (ram_decompress_open(s, f) < 0)",
" return -EINVAL;",
" for(i = 0; i < last_ram_offset; i+= BDRV_HASH_BLOCK_SIZE) {",
" if (ram_decompress_buf(s, buf, 1) < 0) {",
" fprintf(stderr, \"Error while reading ram block header\\n\");",
" goto error;",
" if (buf[0] == 0) {",
" if (ram_decompress_buf(s, qemu_get_ram_ptr(i),",
" BDRV_HASH_BLOCK_SIZE) < 0) {",
" fprintf(stderr, \"Error while reading ram block address=0x%08\" PRIx64, (uint64_t)i);",
" goto error;",
" } else {",
" error:",
" printf(\"Error block header\\n\");",
" return -EINVAL;",
" ram_decompress_close(s);",
" return 0;",
" return -EINVAL;"
],
"line_no": [
55,
55,
1,
5,
7,
9,
13,
15,
17,
19,
21,
23,
27,
29,
31,
33,
35,
39,
41,
43,
45,
51,
55,
45
]
} | static int FUNC_0(QEMUFile *VAR_0, void *VAR_1)
{
RamDecompressState s1, *s = &s1;
uint8_t buf[10];
ram_addr_t i;
if (ram_decompress_open(s, VAR_0) < 0)
return -EINVAL;
for(i = 0; i < last_ram_offset; i+= BDRV_HASH_BLOCK_SIZE) {
if (ram_decompress_buf(s, buf, 1) < 0) {
fprintf(stderr, "Error while reading ram block header\n");
goto error;
}
if (buf[0] == 0) {
if (ram_decompress_buf(s, qemu_get_ram_ptr(i),
BDRV_HASH_BLOCK_SIZE) < 0) {
fprintf(stderr, "Error while reading ram block address=0x%08" PRIx64, (uint64_t)i);
goto error;
}
} else {
error:
printf("Error block header\n");
return -EINVAL;
}
}
ram_decompress_close(s);
return 0;
}
| [
"static int FUNC_0(QEMUFile *VAR_0, void *VAR_1)\n{",
"RamDecompressState s1, *s = &s1;",
"uint8_t buf[10];",
"ram_addr_t i;",
"if (ram_decompress_open(s, VAR_0) < 0)\nreturn -EINVAL;",
"for(i = 0; i < last_ram_offset; i+= BDRV_HASH_BLOCK_SIZE) {",
"if (ram_decompress_buf(s, buf, 1) < 0) {",
"fprintf(stderr, \"Error while reading ram block header\\n\");",
"goto error;",
"}",
"if (buf[0] == 0) {",
"if (ram_decompress_buf(s, qemu_get_ram_ptr(i),\nBDRV_HASH_BLOCK_SIZE) < 0) {",
"fprintf(stderr, \"Error while reading ram block address=0x%08\" PRIx64, (uint64_t)i);",
"goto error;",
"}",
"} else {",
"error:\nprintf(\"Error block header\\n\");",
"return -EINVAL;",
"}",
"}",
"ram_decompress_close(s);",
"return 0;",
"}"
]
| [
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
0,
0,
1,
1,
0,
0,
1,
1,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13,
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29,
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41,
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
55
],
[
57
]
]
|
12,428 | static void v9fs_attach(void *opaque)
{
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
int32_t fid, afid, n_uname;
V9fsString uname, aname;
V9fsFidState *fidp;
size_t offset = 7;
V9fsQID qid;
ssize_t err;
pdu_unmarshal(pdu, offset, "ddssd", &fid, &afid, &uname, &aname, &n_uname);
trace_v9fs_attach(pdu->tag, pdu->id, fid, afid, uname.data, aname.data);
fidp = alloc_fid(s, fid);
if (fidp == NULL) {
err = -EINVAL;
goto out_nofid;
}
fidp->uid = n_uname;
err = v9fs_co_name_to_path(pdu, NULL, "/", &fidp->path);
if (err < 0) {
err = -EINVAL;
clunk_fid(s, fid);
goto out;
}
err = fid_to_qid(pdu, fidp, &qid);
if (err < 0) {
err = -EINVAL;
clunk_fid(s, fid);
goto out;
}
offset += pdu_marshal(pdu, offset, "Q", &qid);
err = offset;
out:
put_fid(pdu, fidp);
out_nofid:
complete_pdu(s, pdu, err);
v9fs_string_free(&uname);
v9fs_string_free(&aname);
} | true | qemu | c572f23a3e7180dbeab5e86583e43ea2afed6271 | static void v9fs_attach(void *opaque)
{
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
int32_t fid, afid, n_uname;
V9fsString uname, aname;
V9fsFidState *fidp;
size_t offset = 7;
V9fsQID qid;
ssize_t err;
pdu_unmarshal(pdu, offset, "ddssd", &fid, &afid, &uname, &aname, &n_uname);
trace_v9fs_attach(pdu->tag, pdu->id, fid, afid, uname.data, aname.data);
fidp = alloc_fid(s, fid);
if (fidp == NULL) {
err = -EINVAL;
goto out_nofid;
}
fidp->uid = n_uname;
err = v9fs_co_name_to_path(pdu, NULL, "/", &fidp->path);
if (err < 0) {
err = -EINVAL;
clunk_fid(s, fid);
goto out;
}
err = fid_to_qid(pdu, fidp, &qid);
if (err < 0) {
err = -EINVAL;
clunk_fid(s, fid);
goto out;
}
offset += pdu_marshal(pdu, offset, "Q", &qid);
err = offset;
out:
put_fid(pdu, fidp);
out_nofid:
complete_pdu(s, pdu, err);
v9fs_string_free(&uname);
v9fs_string_free(&aname);
} | {
"code": [],
"line_no": []
} | static void FUNC_0(void *VAR_0)
{
V9fsPDU *pdu = VAR_0;
V9fsState *s = pdu->s;
int32_t fid, afid, n_uname;
V9fsString uname, aname;
V9fsFidState *fidp;
size_t offset = 7;
V9fsQID qid;
ssize_t err;
pdu_unmarshal(pdu, offset, "ddssd", &fid, &afid, &uname, &aname, &n_uname);
trace_v9fs_attach(pdu->tag, pdu->id, fid, afid, uname.data, aname.data);
fidp = alloc_fid(s, fid);
if (fidp == NULL) {
err = -EINVAL;
goto out_nofid;
}
fidp->uid = n_uname;
err = v9fs_co_name_to_path(pdu, NULL, "/", &fidp->path);
if (err < 0) {
err = -EINVAL;
clunk_fid(s, fid);
goto out;
}
err = fid_to_qid(pdu, fidp, &qid);
if (err < 0) {
err = -EINVAL;
clunk_fid(s, fid);
goto out;
}
offset += pdu_marshal(pdu, offset, "Q", &qid);
err = offset;
out:
put_fid(pdu, fidp);
out_nofid:
complete_pdu(s, pdu, err);
v9fs_string_free(&uname);
v9fs_string_free(&aname);
} | [
"static void FUNC_0(void *VAR_0)\n{",
"V9fsPDU *pdu = VAR_0;",
"V9fsState *s = pdu->s;",
"int32_t fid, afid, n_uname;",
"V9fsString uname, aname;",
"V9fsFidState *fidp;",
"size_t offset = 7;",
"V9fsQID qid;",
"ssize_t err;",
"pdu_unmarshal(pdu, offset, \"ddssd\", &fid, &afid, &uname, &aname, &n_uname);",
"trace_v9fs_attach(pdu->tag, pdu->id, fid, afid, uname.data, aname.data);",
"fidp = alloc_fid(s, fid);",
"if (fidp == NULL) {",
"err = -EINVAL;",
"goto out_nofid;",
"}",
"fidp->uid = n_uname;",
"err = v9fs_co_name_to_path(pdu, NULL, \"/\", &fidp->path);",
"if (err < 0) {",
"err = -EINVAL;",
"clunk_fid(s, fid);",
"goto out;",
"}",
"err = fid_to_qid(pdu, fidp, &qid);",
"if (err < 0) {",
"err = -EINVAL;",
"clunk_fid(s, fid);",
"goto out;",
"}",
"offset += pdu_marshal(pdu, offset, \"Q\", &qid);",
"err = offset;",
"out:\nput_fid(pdu, fidp);",
"out_nofid:\ncomplete_pdu(s, pdu, err);",
"v9fs_string_free(&uname);",
"v9fs_string_free(&aname);",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69,
71
],
[
73,
77
],
[
79
],
[
81
],
[
83
]
]
|
12,430 | static void virtio_blk_free_request(VirtIOBlockReq *req)
{
if (req) {
g_slice_free(VirtQueueElement, req->elem);
g_slice_free(VirtIOBlockReq, req);
}
}
| true | qemu | f897bf751fbd95e4015b95d202c706548586813a | static void virtio_blk_free_request(VirtIOBlockReq *req)
{
if (req) {
g_slice_free(VirtQueueElement, req->elem);
g_slice_free(VirtIOBlockReq, req);
}
}
| {
"code": [
"static void virtio_blk_free_request(VirtIOBlockReq *req)",
" g_slice_free(VirtQueueElement, req->elem);"
],
"line_no": [
1,
7
]
} | static void FUNC_0(VirtIOBlockReq *VAR_0)
{
if (VAR_0) {
g_slice_free(VirtQueueElement, VAR_0->elem);
g_slice_free(VirtIOBlockReq, VAR_0);
}
}
| [
"static void FUNC_0(VirtIOBlockReq *VAR_0)\n{",
"if (VAR_0) {",
"g_slice_free(VirtQueueElement, VAR_0->elem);",
"g_slice_free(VirtIOBlockReq, VAR_0);",
"}",
"}"
]
| [
1,
0,
1,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
]
]
|
12,431 | static int vmd_decode(VmdVideoContext *s, AVFrame *frame)
{
int i;
unsigned int *palette32;
unsigned char r, g, b;
GetByteContext gb;
unsigned char meth;
unsigned char *dp; /* pointer to current frame */
unsigned char *pp; /* pointer to previous frame */
unsigned char len;
int ofs;
int frame_x, frame_y;
int frame_width, frame_height;
frame_x = AV_RL16(&s->buf[6]);
frame_y = AV_RL16(&s->buf[8]);
frame_width = AV_RL16(&s->buf[10]) - frame_x + 1;
frame_height = AV_RL16(&s->buf[12]) - frame_y + 1;
if ((frame_width == s->avctx->width && frame_height == s->avctx->height) &&
(frame_x || frame_y)) {
s->x_off = frame_x;
s->y_off = frame_y;
}
frame_x -= s->x_off;
frame_y -= s->y_off;
if (frame_x < 0 || frame_width < 0 ||
frame_x >= s->avctx->width ||
frame_width > s->avctx->width ||
frame_x + frame_width > s->avctx->width) {
av_log(s->avctx, AV_LOG_ERROR,
"Invalid horizontal range %d-%d\n",
frame_x, frame_width);
return AVERROR_INVALIDDATA;
}
if (frame_y < 0 || frame_height < 0 ||
frame_y >= s->avctx->height ||
frame_height > s->avctx->height ||
frame_y + frame_height > s->avctx->height) {
av_log(s->avctx, AV_LOG_ERROR,
"Invalid vertical range %d-%d\n",
frame_x, frame_width);
return AVERROR_INVALIDDATA;
}
/* if only a certain region will be updated, copy the entire previous
* frame before the decode */
if (s->prev_frame->data[0] &&
(frame_x || frame_y || (frame_width != s->avctx->width) ||
(frame_height != s->avctx->height))) {
memcpy(frame->data[0], s->prev_frame->data[0],
s->avctx->height * frame->linesize[0]);
}
/* check if there is a new palette */
bytestream2_init(&gb, s->buf + 16, s->size - 16);
if (s->buf[15] & 0x02) {
bytestream2_skip(&gb, 2);
palette32 = (unsigned int *)s->palette;
if (bytestream2_get_bytes_left(&gb) >= PALETTE_COUNT * 3) {
for (i = 0; i < PALETTE_COUNT; i++) {
r = bytestream2_get_byteu(&gb) * 4;
g = bytestream2_get_byteu(&gb) * 4;
b = bytestream2_get_byteu(&gb) * 4;
palette32[i] = 0xFFU << 24 | (r << 16) | (g << 8) | (b);
palette32[i] |= palette32[i] >> 6 & 0x30303;
}
} else {
av_log(s->avctx, AV_LOG_ERROR, "Incomplete palette\n");
return AVERROR_INVALIDDATA;
}
}
if (!s->size)
return 0;
/* originally UnpackFrame in VAG's code */
if (bytestream2_get_bytes_left(&gb) < 1)
return AVERROR_INVALIDDATA;
meth = bytestream2_get_byteu(&gb);
if (meth & 0x80) {
if (!s->unpack_buffer_size) {
av_log(s->avctx, AV_LOG_ERROR,
"Trying to unpack LZ-compressed frame with no LZ buffer\n");
return AVERROR_INVALIDDATA;
}
lz_unpack(gb.buffer, bytestream2_get_bytes_left(&gb),
s->unpack_buffer, s->unpack_buffer_size);
meth &= 0x7F;
bytestream2_init(&gb, s->unpack_buffer, s->unpack_buffer_size);
}
dp = &frame->data[0][frame_y * frame->linesize[0] + frame_x];
pp = &s->prev_frame->data[0][frame_y * s->prev_frame->linesize[0] + frame_x];
switch (meth) {
case 1:
for (i = 0; i < frame_height; i++) {
ofs = 0;
do {
len = bytestream2_get_byte(&gb);
if (len & 0x80) {
len = (len & 0x7F) + 1;
if (ofs + len > frame_width ||
bytestream2_get_bytes_left(&gb) < len)
return AVERROR_INVALIDDATA;
bytestream2_get_bufferu(&gb, &dp[ofs], len);
ofs += len;
} else {
/* interframe pixel copy */
if (ofs + len + 1 > frame_width || !s->prev_frame->data[0])
return AVERROR_INVALIDDATA;
memcpy(&dp[ofs], &pp[ofs], len + 1);
ofs += len + 1;
}
} while (ofs < frame_width);
if (ofs > frame_width) {
av_log(s->avctx, AV_LOG_ERROR,
"offset > width (%d > %d)\n",
ofs, frame_width);
return AVERROR_INVALIDDATA;
}
dp += frame->linesize[0];
pp += s->prev_frame->linesize[0];
}
break;
case 2:
for (i = 0; i < frame_height; i++) {
bytestream2_get_buffer(&gb, dp, frame_width);
dp += frame->linesize[0];
pp += s->prev_frame->linesize[0];
}
break;
case 3:
for (i = 0; i < frame_height; i++) {
ofs = 0;
do {
len = bytestream2_get_byte(&gb);
if (len & 0x80) {
len = (len & 0x7F) + 1;
if (bytestream2_peek_byte(&gb) == 0xFF) {
int slen = len;
bytestream2_get_byte(&gb);
len = rle_unpack(gb.buffer, &dp[ofs],
len, bytestream2_get_bytes_left(&gb),
frame_width - ofs);
ofs += slen;
bytestream2_skip(&gb, len);
} else {
bytestream2_get_buffer(&gb, &dp[ofs], len);
ofs += len;
}
} else {
/* interframe pixel copy */
if (ofs + len + 1 > frame_width || !s->prev_frame->data[0])
return AVERROR_INVALIDDATA;
memcpy(&dp[ofs], &pp[ofs], len + 1);
ofs += len + 1;
}
} while (ofs < frame_width);
if (ofs > frame_width) {
av_log(s->avctx, AV_LOG_ERROR,
"offset > width (%d > %d)\n",
ofs, frame_width);
return AVERROR_INVALIDDATA;
}
dp += frame->linesize[0];
pp += s->prev_frame->linesize[0];
}
break;
}
return 0;
}
| true | FFmpeg | f07ca542e371ec137d7192ccecf61ea889c13510 | static int vmd_decode(VmdVideoContext *s, AVFrame *frame)
{
int i;
unsigned int *palette32;
unsigned char r, g, b;
GetByteContext gb;
unsigned char meth;
unsigned char *dp;
unsigned char *pp;
unsigned char len;
int ofs;
int frame_x, frame_y;
int frame_width, frame_height;
frame_x = AV_RL16(&s->buf[6]);
frame_y = AV_RL16(&s->buf[8]);
frame_width = AV_RL16(&s->buf[10]) - frame_x + 1;
frame_height = AV_RL16(&s->buf[12]) - frame_y + 1;
if ((frame_width == s->avctx->width && frame_height == s->avctx->height) &&
(frame_x || frame_y)) {
s->x_off = frame_x;
s->y_off = frame_y;
}
frame_x -= s->x_off;
frame_y -= s->y_off;
if (frame_x < 0 || frame_width < 0 ||
frame_x >= s->avctx->width ||
frame_width > s->avctx->width ||
frame_x + frame_width > s->avctx->width) {
av_log(s->avctx, AV_LOG_ERROR,
"Invalid horizontal range %d-%d\n",
frame_x, frame_width);
return AVERROR_INVALIDDATA;
}
if (frame_y < 0 || frame_height < 0 ||
frame_y >= s->avctx->height ||
frame_height > s->avctx->height ||
frame_y + frame_height > s->avctx->height) {
av_log(s->avctx, AV_LOG_ERROR,
"Invalid vertical range %d-%d\n",
frame_x, frame_width);
return AVERROR_INVALIDDATA;
}
if (s->prev_frame->data[0] &&
(frame_x || frame_y || (frame_width != s->avctx->width) ||
(frame_height != s->avctx->height))) {
memcpy(frame->data[0], s->prev_frame->data[0],
s->avctx->height * frame->linesize[0]);
}
bytestream2_init(&gb, s->buf + 16, s->size - 16);
if (s->buf[15] & 0x02) {
bytestream2_skip(&gb, 2);
palette32 = (unsigned int *)s->palette;
if (bytestream2_get_bytes_left(&gb) >= PALETTE_COUNT * 3) {
for (i = 0; i < PALETTE_COUNT; i++) {
r = bytestream2_get_byteu(&gb) * 4;
g = bytestream2_get_byteu(&gb) * 4;
b = bytestream2_get_byteu(&gb) * 4;
palette32[i] = 0xFFU << 24 | (r << 16) | (g << 8) | (b);
palette32[i] |= palette32[i] >> 6 & 0x30303;
}
} else {
av_log(s->avctx, AV_LOG_ERROR, "Incomplete palette\n");
return AVERROR_INVALIDDATA;
}
}
if (!s->size)
return 0;
if (bytestream2_get_bytes_left(&gb) < 1)
return AVERROR_INVALIDDATA;
meth = bytestream2_get_byteu(&gb);
if (meth & 0x80) {
if (!s->unpack_buffer_size) {
av_log(s->avctx, AV_LOG_ERROR,
"Trying to unpack LZ-compressed frame with no LZ buffer\n");
return AVERROR_INVALIDDATA;
}
lz_unpack(gb.buffer, bytestream2_get_bytes_left(&gb),
s->unpack_buffer, s->unpack_buffer_size);
meth &= 0x7F;
bytestream2_init(&gb, s->unpack_buffer, s->unpack_buffer_size);
}
dp = &frame->data[0][frame_y * frame->linesize[0] + frame_x];
pp = &s->prev_frame->data[0][frame_y * s->prev_frame->linesize[0] + frame_x];
switch (meth) {
case 1:
for (i = 0; i < frame_height; i++) {
ofs = 0;
do {
len = bytestream2_get_byte(&gb);
if (len & 0x80) {
len = (len & 0x7F) + 1;
if (ofs + len > frame_width ||
bytestream2_get_bytes_left(&gb) < len)
return AVERROR_INVALIDDATA;
bytestream2_get_bufferu(&gb, &dp[ofs], len);
ofs += len;
} else {
if (ofs + len + 1 > frame_width || !s->prev_frame->data[0])
return AVERROR_INVALIDDATA;
memcpy(&dp[ofs], &pp[ofs], len + 1);
ofs += len + 1;
}
} while (ofs < frame_width);
if (ofs > frame_width) {
av_log(s->avctx, AV_LOG_ERROR,
"offset > width (%d > %d)\n",
ofs, frame_width);
return AVERROR_INVALIDDATA;
}
dp += frame->linesize[0];
pp += s->prev_frame->linesize[0];
}
break;
case 2:
for (i = 0; i < frame_height; i++) {
bytestream2_get_buffer(&gb, dp, frame_width);
dp += frame->linesize[0];
pp += s->prev_frame->linesize[0];
}
break;
case 3:
for (i = 0; i < frame_height; i++) {
ofs = 0;
do {
len = bytestream2_get_byte(&gb);
if (len & 0x80) {
len = (len & 0x7F) + 1;
if (bytestream2_peek_byte(&gb) == 0xFF) {
int slen = len;
bytestream2_get_byte(&gb);
len = rle_unpack(gb.buffer, &dp[ofs],
len, bytestream2_get_bytes_left(&gb),
frame_width - ofs);
ofs += slen;
bytestream2_skip(&gb, len);
} else {
bytestream2_get_buffer(&gb, &dp[ofs], len);
ofs += len;
}
} else {
if (ofs + len + 1 > frame_width || !s->prev_frame->data[0])
return AVERROR_INVALIDDATA;
memcpy(&dp[ofs], &pp[ofs], len + 1);
ofs += len + 1;
}
} while (ofs < frame_width);
if (ofs > frame_width) {
av_log(s->avctx, AV_LOG_ERROR,
"offset > width (%d > %d)\n",
ofs, frame_width);
return AVERROR_INVALIDDATA;
}
dp += frame->linesize[0];
pp += s->prev_frame->linesize[0];
}
break;
}
return 0;
}
| {
"code": [
" lz_unpack(gb.buffer, bytestream2_get_bytes_left(&gb),",
" s->unpack_buffer, s->unpack_buffer_size);",
" bytestream2_init(&gb, s->unpack_buffer, s->unpack_buffer_size);"
],
"line_no": [
185,
187,
191
]
} | static int FUNC_0(VmdVideoContext *VAR_0, AVFrame *VAR_1)
{
int VAR_2;
unsigned int *VAR_3;
unsigned char VAR_4, VAR_5, VAR_6;
GetByteContext gb;
unsigned char VAR_7;
unsigned char *VAR_8;
unsigned char *VAR_9;
unsigned char VAR_10;
int VAR_11;
int VAR_12, VAR_13;
int VAR_14, VAR_15;
VAR_12 = AV_RL16(&VAR_0->buf[6]);
VAR_13 = AV_RL16(&VAR_0->buf[8]);
VAR_14 = AV_RL16(&VAR_0->buf[10]) - VAR_12 + 1;
VAR_15 = AV_RL16(&VAR_0->buf[12]) - VAR_13 + 1;
if ((VAR_14 == VAR_0->avctx->width && VAR_15 == VAR_0->avctx->height) &&
(VAR_12 || VAR_13)) {
VAR_0->x_off = VAR_12;
VAR_0->y_off = VAR_13;
}
VAR_12 -= VAR_0->x_off;
VAR_13 -= VAR_0->y_off;
if (VAR_12 < 0 || VAR_14 < 0 ||
VAR_12 >= VAR_0->avctx->width ||
VAR_14 > VAR_0->avctx->width ||
VAR_12 + VAR_14 > VAR_0->avctx->width) {
av_log(VAR_0->avctx, AV_LOG_ERROR,
"Invalid horizontal range %d-%d\n",
VAR_12, VAR_14);
return AVERROR_INVALIDDATA;
}
if (VAR_13 < 0 || VAR_15 < 0 ||
VAR_13 >= VAR_0->avctx->height ||
VAR_15 > VAR_0->avctx->height ||
VAR_13 + VAR_15 > VAR_0->avctx->height) {
av_log(VAR_0->avctx, AV_LOG_ERROR,
"Invalid vertical range %d-%d\n",
VAR_12, VAR_14);
return AVERROR_INVALIDDATA;
}
if (VAR_0->prev_frame->data[0] &&
(VAR_12 || VAR_13 || (VAR_14 != VAR_0->avctx->width) ||
(VAR_15 != VAR_0->avctx->height))) {
memcpy(VAR_1->data[0], VAR_0->prev_frame->data[0],
VAR_0->avctx->height * VAR_1->linesize[0]);
}
bytestream2_init(&gb, VAR_0->buf + 16, VAR_0->size - 16);
if (VAR_0->buf[15] & 0x02) {
bytestream2_skip(&gb, 2);
VAR_3 = (unsigned int *)VAR_0->palette;
if (bytestream2_get_bytes_left(&gb) >= PALETTE_COUNT * 3) {
for (VAR_2 = 0; VAR_2 < PALETTE_COUNT; VAR_2++) {
VAR_4 = bytestream2_get_byteu(&gb) * 4;
VAR_5 = bytestream2_get_byteu(&gb) * 4;
VAR_6 = bytestream2_get_byteu(&gb) * 4;
VAR_3[VAR_2] = 0xFFU << 24 | (VAR_4 << 16) | (VAR_5 << 8) | (VAR_6);
VAR_3[VAR_2] |= VAR_3[VAR_2] >> 6 & 0x30303;
}
} else {
av_log(VAR_0->avctx, AV_LOG_ERROR, "Incomplete palette\n");
return AVERROR_INVALIDDATA;
}
}
if (!VAR_0->size)
return 0;
if (bytestream2_get_bytes_left(&gb) < 1)
return AVERROR_INVALIDDATA;
VAR_7 = bytestream2_get_byteu(&gb);
if (VAR_7 & 0x80) {
if (!VAR_0->unpack_buffer_size) {
av_log(VAR_0->avctx, AV_LOG_ERROR,
"Trying to unpack LZ-compressed VAR_1 with no LZ buffer\n");
return AVERROR_INVALIDDATA;
}
lz_unpack(gb.buffer, bytestream2_get_bytes_left(&gb),
VAR_0->unpack_buffer, VAR_0->unpack_buffer_size);
VAR_7 &= 0x7F;
bytestream2_init(&gb, VAR_0->unpack_buffer, VAR_0->unpack_buffer_size);
}
VAR_8 = &VAR_1->data[0][VAR_13 * VAR_1->linesize[0] + VAR_12];
VAR_9 = &VAR_0->prev_frame->data[0][VAR_13 * VAR_0->prev_frame->linesize[0] + VAR_12];
switch (VAR_7) {
case 1:
for (VAR_2 = 0; VAR_2 < VAR_15; VAR_2++) {
VAR_11 = 0;
do {
VAR_10 = bytestream2_get_byte(&gb);
if (VAR_10 & 0x80) {
VAR_10 = (VAR_10 & 0x7F) + 1;
if (VAR_11 + VAR_10 > VAR_14 ||
bytestream2_get_bytes_left(&gb) < VAR_10)
return AVERROR_INVALIDDATA;
bytestream2_get_bufferu(&gb, &VAR_8[VAR_11], VAR_10);
VAR_11 += VAR_10;
} else {
if (VAR_11 + VAR_10 + 1 > VAR_14 || !VAR_0->prev_frame->data[0])
return AVERROR_INVALIDDATA;
memcpy(&VAR_8[VAR_11], &VAR_9[VAR_11], VAR_10 + 1);
VAR_11 += VAR_10 + 1;
}
} while (VAR_11 < VAR_14);
if (VAR_11 > VAR_14) {
av_log(VAR_0->avctx, AV_LOG_ERROR,
"offset > width (%d > %d)\n",
VAR_11, VAR_14);
return AVERROR_INVALIDDATA;
}
VAR_8 += VAR_1->linesize[0];
VAR_9 += VAR_0->prev_frame->linesize[0];
}
break;
case 2:
for (VAR_2 = 0; VAR_2 < VAR_15; VAR_2++) {
bytestream2_get_buffer(&gb, VAR_8, VAR_14);
VAR_8 += VAR_1->linesize[0];
VAR_9 += VAR_0->prev_frame->linesize[0];
}
break;
case 3:
for (VAR_2 = 0; VAR_2 < VAR_15; VAR_2++) {
VAR_11 = 0;
do {
VAR_10 = bytestream2_get_byte(&gb);
if (VAR_10 & 0x80) {
VAR_10 = (VAR_10 & 0x7F) + 1;
if (bytestream2_peek_byte(&gb) == 0xFF) {
int VAR_16 = VAR_10;
bytestream2_get_byte(&gb);
VAR_10 = rle_unpack(gb.buffer, &VAR_8[VAR_11],
VAR_10, bytestream2_get_bytes_left(&gb),
VAR_14 - VAR_11);
VAR_11 += VAR_16;
bytestream2_skip(&gb, VAR_10);
} else {
bytestream2_get_buffer(&gb, &VAR_8[VAR_11], VAR_10);
VAR_11 += VAR_10;
}
} else {
if (VAR_11 + VAR_10 + 1 > VAR_14 || !VAR_0->prev_frame->data[0])
return AVERROR_INVALIDDATA;
memcpy(&VAR_8[VAR_11], &VAR_9[VAR_11], VAR_10 + 1);
VAR_11 += VAR_10 + 1;
}
} while (VAR_11 < VAR_14);
if (VAR_11 > VAR_14) {
av_log(VAR_0->avctx, AV_LOG_ERROR,
"offset > width (%d > %d)\n",
VAR_11, VAR_14);
return AVERROR_INVALIDDATA;
}
VAR_8 += VAR_1->linesize[0];
VAR_9 += VAR_0->prev_frame->linesize[0];
}
break;
}
return 0;
}
| [
"static int FUNC_0(VmdVideoContext *VAR_0, AVFrame *VAR_1)\n{",
"int VAR_2;",
"unsigned int *VAR_3;",
"unsigned char VAR_4, VAR_5, VAR_6;",
"GetByteContext gb;",
"unsigned char VAR_7;",
"unsigned char *VAR_8;",
"unsigned char *VAR_9;",
"unsigned char VAR_10;",
"int VAR_11;",
"int VAR_12, VAR_13;",
"int VAR_14, VAR_15;",
"VAR_12 = AV_RL16(&VAR_0->buf[6]);",
"VAR_13 = AV_RL16(&VAR_0->buf[8]);",
"VAR_14 = AV_RL16(&VAR_0->buf[10]) - VAR_12 + 1;",
"VAR_15 = AV_RL16(&VAR_0->buf[12]) - VAR_13 + 1;",
"if ((VAR_14 == VAR_0->avctx->width && VAR_15 == VAR_0->avctx->height) &&\n(VAR_12 || VAR_13)) {",
"VAR_0->x_off = VAR_12;",
"VAR_0->y_off = VAR_13;",
"}",
"VAR_12 -= VAR_0->x_off;",
"VAR_13 -= VAR_0->y_off;",
"if (VAR_12 < 0 || VAR_14 < 0 ||\nVAR_12 >= VAR_0->avctx->width ||\nVAR_14 > VAR_0->avctx->width ||\nVAR_12 + VAR_14 > VAR_0->avctx->width) {",
"av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"Invalid horizontal range %d-%d\\n\",\nVAR_12, VAR_14);",
"return AVERROR_INVALIDDATA;",
"}",
"if (VAR_13 < 0 || VAR_15 < 0 ||\nVAR_13 >= VAR_0->avctx->height ||\nVAR_15 > VAR_0->avctx->height ||\nVAR_13 + VAR_15 > VAR_0->avctx->height) {",
"av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"Invalid vertical range %d-%d\\n\",\nVAR_12, VAR_14);",
"return AVERROR_INVALIDDATA;",
"}",
"if (VAR_0->prev_frame->data[0] &&\n(VAR_12 || VAR_13 || (VAR_14 != VAR_0->avctx->width) ||\n(VAR_15 != VAR_0->avctx->height))) {",
"memcpy(VAR_1->data[0], VAR_0->prev_frame->data[0],\nVAR_0->avctx->height * VAR_1->linesize[0]);",
"}",
"bytestream2_init(&gb, VAR_0->buf + 16, VAR_0->size - 16);",
"if (VAR_0->buf[15] & 0x02) {",
"bytestream2_skip(&gb, 2);",
"VAR_3 = (unsigned int *)VAR_0->palette;",
"if (bytestream2_get_bytes_left(&gb) >= PALETTE_COUNT * 3) {",
"for (VAR_2 = 0; VAR_2 < PALETTE_COUNT; VAR_2++) {",
"VAR_4 = bytestream2_get_byteu(&gb) * 4;",
"VAR_5 = bytestream2_get_byteu(&gb) * 4;",
"VAR_6 = bytestream2_get_byteu(&gb) * 4;",
"VAR_3[VAR_2] = 0xFFU << 24 | (VAR_4 << 16) | (VAR_5 << 8) | (VAR_6);",
"VAR_3[VAR_2] |= VAR_3[VAR_2] >> 6 & 0x30303;",
"}",
"} else {",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"Incomplete palette\\n\");",
"return AVERROR_INVALIDDATA;",
"}",
"}",
"if (!VAR_0->size)\nreturn 0;",
"if (bytestream2_get_bytes_left(&gb) < 1)\nreturn AVERROR_INVALIDDATA;",
"VAR_7 = bytestream2_get_byteu(&gb);",
"if (VAR_7 & 0x80) {",
"if (!VAR_0->unpack_buffer_size) {",
"av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"Trying to unpack LZ-compressed VAR_1 with no LZ buffer\\n\");",
"return AVERROR_INVALIDDATA;",
"}",
"lz_unpack(gb.buffer, bytestream2_get_bytes_left(&gb),\nVAR_0->unpack_buffer, VAR_0->unpack_buffer_size);",
"VAR_7 &= 0x7F;",
"bytestream2_init(&gb, VAR_0->unpack_buffer, VAR_0->unpack_buffer_size);",
"}",
"VAR_8 = &VAR_1->data[0][VAR_13 * VAR_1->linesize[0] + VAR_12];",
"VAR_9 = &VAR_0->prev_frame->data[0][VAR_13 * VAR_0->prev_frame->linesize[0] + VAR_12];",
"switch (VAR_7) {",
"case 1:\nfor (VAR_2 = 0; VAR_2 < VAR_15; VAR_2++) {",
"VAR_11 = 0;",
"do {",
"VAR_10 = bytestream2_get_byte(&gb);",
"if (VAR_10 & 0x80) {",
"VAR_10 = (VAR_10 & 0x7F) + 1;",
"if (VAR_11 + VAR_10 > VAR_14 ||\nbytestream2_get_bytes_left(&gb) < VAR_10)\nreturn AVERROR_INVALIDDATA;",
"bytestream2_get_bufferu(&gb, &VAR_8[VAR_11], VAR_10);",
"VAR_11 += VAR_10;",
"} else {",
"if (VAR_11 + VAR_10 + 1 > VAR_14 || !VAR_0->prev_frame->data[0])\nreturn AVERROR_INVALIDDATA;",
"memcpy(&VAR_8[VAR_11], &VAR_9[VAR_11], VAR_10 + 1);",
"VAR_11 += VAR_10 + 1;",
"}",
"} while (VAR_11 < VAR_14);",
"if (VAR_11 > VAR_14) {",
"av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"offset > width (%d > %d)\\n\",\nVAR_11, VAR_14);",
"return AVERROR_INVALIDDATA;",
"}",
"VAR_8 += VAR_1->linesize[0];",
"VAR_9 += VAR_0->prev_frame->linesize[0];",
"}",
"break;",
"case 2:\nfor (VAR_2 = 0; VAR_2 < VAR_15; VAR_2++) {",
"bytestream2_get_buffer(&gb, VAR_8, VAR_14);",
"VAR_8 += VAR_1->linesize[0];",
"VAR_9 += VAR_0->prev_frame->linesize[0];",
"}",
"break;",
"case 3:\nfor (VAR_2 = 0; VAR_2 < VAR_15; VAR_2++) {",
"VAR_11 = 0;",
"do {",
"VAR_10 = bytestream2_get_byte(&gb);",
"if (VAR_10 & 0x80) {",
"VAR_10 = (VAR_10 & 0x7F) + 1;",
"if (bytestream2_peek_byte(&gb) == 0xFF) {",
"int VAR_16 = VAR_10;",
"bytestream2_get_byte(&gb);",
"VAR_10 = rle_unpack(gb.buffer, &VAR_8[VAR_11],\nVAR_10, bytestream2_get_bytes_left(&gb),\nVAR_14 - VAR_11);",
"VAR_11 += VAR_16;",
"bytestream2_skip(&gb, VAR_10);",
"} else {",
"bytestream2_get_buffer(&gb, &VAR_8[VAR_11], VAR_10);",
"VAR_11 += VAR_10;",
"}",
"} else {",
"if (VAR_11 + VAR_10 + 1 > VAR_14 || !VAR_0->prev_frame->data[0])\nreturn AVERROR_INVALIDDATA;",
"memcpy(&VAR_8[VAR_11], &VAR_9[VAR_11], VAR_10 + 1);",
"VAR_11 += VAR_10 + 1;",
"}",
"} while (VAR_11 < VAR_14);",
"if (VAR_11 > VAR_14) {",
"av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"offset > width (%d > %d)\\n\",\nVAR_11, VAR_14);",
"return AVERROR_INVALIDDATA;",
"}",
"VAR_8 += VAR_1->linesize[0];",
"VAR_9 += VAR_0->prev_frame->linesize[0];",
"}",
"break;",
"}",
"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,
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
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
29
],
[
31
],
[
35
],
[
37
],
[
39
],
[
41
],
[
45,
47
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
63,
65,
67,
69
],
[
71,
73,
75
],
[
77
],
[
79
],
[
81,
83,
85,
87
],
[
89,
91,
93
],
[
95
],
[
97
],
[
105,
107,
109
],
[
113,
115
],
[
117
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149
],
[
151
],
[
153
],
[
155
],
[
159,
161
],
[
167,
169
],
[
171
],
[
173
],
[
175
],
[
177,
179
],
[
181
],
[
183
],
[
185,
187
],
[
189
],
[
191
],
[
193
],
[
197
],
[
199
],
[
201
],
[
203,
205
],
[
207
],
[
209
],
[
211
],
[
213
],
[
215
],
[
217,
219,
221
],
[
223
],
[
225
],
[
227
],
[
231,
233
],
[
235
],
[
237
],
[
239
],
[
241
],
[
243
],
[
245,
247,
249
],
[
251
],
[
253
],
[
255
],
[
257
],
[
259
],
[
261
],
[
265,
267
],
[
269
],
[
271
],
[
273
],
[
275
],
[
277
],
[
281,
283
],
[
285
],
[
287
],
[
289
],
[
291
],
[
293
],
[
295
],
[
297
],
[
299
],
[
301,
303,
305
],
[
307
],
[
309
],
[
311
],
[
313
],
[
315
],
[
317
],
[
319
],
[
323,
325
],
[
327
],
[
329
],
[
331
],
[
333
],
[
335
],
[
337,
339,
341
],
[
343
],
[
345
],
[
347
],
[
349
],
[
351
],
[
353
],
[
355
],
[
357
],
[
359
]
]
|
12,432 | static void show_program(WriterContext *w, AVFormatContext *fmt_ctx, AVProgram *program)
{
int i;
writer_print_section_header(w, SECTION_ID_PROGRAM);
print_int("program_id", program->id);
print_int("program_num", program->program_num);
print_int("nb_streams", program->nb_stream_indexes);
print_int("pmt_pid", program->pmt_pid);
print_int("pcr_pid", program->pcr_pid);
print_ts("start_pts", program->start_time);
print_time("start_time", program->start_time, &AV_TIME_BASE_Q);
print_ts("end_pts", program->end_time);
print_time("end_time", program->end_time, &AV_TIME_BASE_Q);
show_tags(w, program->metadata, SECTION_ID_PROGRAM_TAGS);
writer_print_section_header(w, SECTION_ID_PROGRAM_STREAMS);
for (i = 0; i < program->nb_stream_indexes; i++) {
if (selected_streams[program->stream_index[i]])
show_stream(w, fmt_ctx, program->stream_index[i], 1);
}
writer_print_section_footer(w);
writer_print_section_footer(w);
}
| false | FFmpeg | e87190f5d20d380608f792ceb14d0def1d80e24b | static void show_program(WriterContext *w, AVFormatContext *fmt_ctx, AVProgram *program)
{
int i;
writer_print_section_header(w, SECTION_ID_PROGRAM);
print_int("program_id", program->id);
print_int("program_num", program->program_num);
print_int("nb_streams", program->nb_stream_indexes);
print_int("pmt_pid", program->pmt_pid);
print_int("pcr_pid", program->pcr_pid);
print_ts("start_pts", program->start_time);
print_time("start_time", program->start_time, &AV_TIME_BASE_Q);
print_ts("end_pts", program->end_time);
print_time("end_time", program->end_time, &AV_TIME_BASE_Q);
show_tags(w, program->metadata, SECTION_ID_PROGRAM_TAGS);
writer_print_section_header(w, SECTION_ID_PROGRAM_STREAMS);
for (i = 0; i < program->nb_stream_indexes; i++) {
if (selected_streams[program->stream_index[i]])
show_stream(w, fmt_ctx, program->stream_index[i], 1);
}
writer_print_section_footer(w);
writer_print_section_footer(w);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(WriterContext *VAR_0, AVFormatContext *VAR_1, AVProgram *VAR_2)
{
int VAR_3;
writer_print_section_header(VAR_0, SECTION_ID_PROGRAM);
print_int("program_id", VAR_2->id);
print_int("program_num", VAR_2->program_num);
print_int("nb_streams", VAR_2->nb_stream_indexes);
print_int("pmt_pid", VAR_2->pmt_pid);
print_int("pcr_pid", VAR_2->pcr_pid);
print_ts("start_pts", VAR_2->start_time);
print_time("start_time", VAR_2->start_time, &AV_TIME_BASE_Q);
print_ts("end_pts", VAR_2->end_time);
print_time("end_time", VAR_2->end_time, &AV_TIME_BASE_Q);
show_tags(VAR_0, VAR_2->metadata, SECTION_ID_PROGRAM_TAGS);
writer_print_section_header(VAR_0, SECTION_ID_PROGRAM_STREAMS);
for (VAR_3 = 0; VAR_3 < VAR_2->nb_stream_indexes; VAR_3++) {
if (selected_streams[VAR_2->stream_index[VAR_3]])
show_stream(VAR_0, VAR_1, VAR_2->stream_index[VAR_3], 1);
}
writer_print_section_footer(VAR_0);
writer_print_section_footer(VAR_0);
}
| [
"static void FUNC_0(WriterContext *VAR_0, AVFormatContext *VAR_1, AVProgram *VAR_2)\n{",
"int VAR_3;",
"writer_print_section_header(VAR_0, SECTION_ID_PROGRAM);",
"print_int(\"program_id\", VAR_2->id);",
"print_int(\"program_num\", VAR_2->program_num);",
"print_int(\"nb_streams\", VAR_2->nb_stream_indexes);",
"print_int(\"pmt_pid\", VAR_2->pmt_pid);",
"print_int(\"pcr_pid\", VAR_2->pcr_pid);",
"print_ts(\"start_pts\", VAR_2->start_time);",
"print_time(\"start_time\", VAR_2->start_time, &AV_TIME_BASE_Q);",
"print_ts(\"end_pts\", VAR_2->end_time);",
"print_time(\"end_time\", VAR_2->end_time, &AV_TIME_BASE_Q);",
"show_tags(VAR_0, VAR_2->metadata, SECTION_ID_PROGRAM_TAGS);",
"writer_print_section_header(VAR_0, SECTION_ID_PROGRAM_STREAMS);",
"for (VAR_3 = 0; VAR_3 < VAR_2->nb_stream_indexes; VAR_3++) {",
"if (selected_streams[VAR_2->stream_index[VAR_3]])\nshow_stream(VAR_0, VAR_1, VAR_2->stream_index[VAR_3], 1);",
"}",
"writer_print_section_footer(VAR_0);",
"writer_print_section_footer(VAR_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
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
],
[
37,
39
],
[
41
],
[
43
],
[
47
],
[
49
]
]
|
12,433 | static int vaapi_encode_h264_write_extra_header(AVCodecContext *avctx,
VAAPIEncodePicture *pic,
int index, int *type,
char *data, size_t *data_len)
{
VAAPIEncodeContext *ctx = avctx->priv_data;
VAAPIEncodeH264Context *priv = ctx->priv_data;
VAAPIEncodeH264Options *opt = ctx->codec_options;
CodedBitstreamFragment *au = &priv->current_access_unit;
int err, i;
if (priv->sei_needed) {
if (priv->aud_needed) {
vaapi_encode_h264_add_nal(avctx, au, &priv->aud);
priv->aud_needed = 0;
}
memset(&priv->sei, 0, sizeof(priv->sei));
priv->sei.nal_unit_header.nal_unit_type = H264_NAL_SEI;
i = 0;
if (pic->encode_order == 0 && opt->sei & SEI_IDENTIFIER) {
priv->sei.payload[i].payload_type = H264_SEI_TYPE_USER_DATA_UNREGISTERED;
priv->sei.payload[i].payload.user_data_unregistered = priv->identifier;
++i;
}
if (opt->sei & SEI_TIMING) {
if (pic->type == PICTURE_TYPE_IDR) {
priv->sei.payload[i].payload_type = H264_SEI_TYPE_BUFFERING_PERIOD;
priv->sei.payload[i].payload.buffering_period = priv->buffering_period;
++i;
}
priv->sei.payload[i].payload_type = H264_SEI_TYPE_PIC_TIMING;
priv->sei.payload[i].payload.pic_timing = priv->pic_timing;
++i;
}
if (opt->sei & SEI_RECOVERY_POINT && pic->type == PICTURE_TYPE_I) {
priv->sei.payload[i].payload_type = H264_SEI_TYPE_RECOVERY_POINT;
priv->sei.payload[i].payload.recovery_point = priv->recovery_point;
++i;
}
priv->sei.payload_count = i;
av_assert0(priv->sei.payload_count > 0);
err = vaapi_encode_h264_add_nal(avctx, au, &priv->sei);
if (err < 0)
goto fail;
priv->sei_needed = 0;
err = vaapi_encode_h264_write_access_unit(avctx, data, data_len, au);
if (err < 0)
goto fail;
ff_cbs_fragment_uninit(&priv->cbc, au);
*type = VAEncPackedHeaderRawData;
return 0;
#if !HAVE_VAAPI_1
} else if (priv->sei_cbr_workaround_needed) {
// Insert a zero-length header using the old SEI type. This is
// required to avoid triggering broken behaviour on Intel platforms
// in CBR mode where an invalid SEI message is generated by the
// driver and inserted into the stream.
*data_len = 0;
*type = VAEncPackedHeaderH264_SEI;
priv->sei_cbr_workaround_needed = 0;
return 0;
#endif
} else {
return AVERROR_EOF;
}
fail:
ff_cbs_fragment_uninit(&priv->cbc, au);
return err;
}
| false | FFmpeg | 620f88a0b94a651c6cc912b1fb32d308762d59b5 | static int vaapi_encode_h264_write_extra_header(AVCodecContext *avctx,
VAAPIEncodePicture *pic,
int index, int *type,
char *data, size_t *data_len)
{
VAAPIEncodeContext *ctx = avctx->priv_data;
VAAPIEncodeH264Context *priv = ctx->priv_data;
VAAPIEncodeH264Options *opt = ctx->codec_options;
CodedBitstreamFragment *au = &priv->current_access_unit;
int err, i;
if (priv->sei_needed) {
if (priv->aud_needed) {
vaapi_encode_h264_add_nal(avctx, au, &priv->aud);
priv->aud_needed = 0;
}
memset(&priv->sei, 0, sizeof(priv->sei));
priv->sei.nal_unit_header.nal_unit_type = H264_NAL_SEI;
i = 0;
if (pic->encode_order == 0 && opt->sei & SEI_IDENTIFIER) {
priv->sei.payload[i].payload_type = H264_SEI_TYPE_USER_DATA_UNREGISTERED;
priv->sei.payload[i].payload.user_data_unregistered = priv->identifier;
++i;
}
if (opt->sei & SEI_TIMING) {
if (pic->type == PICTURE_TYPE_IDR) {
priv->sei.payload[i].payload_type = H264_SEI_TYPE_BUFFERING_PERIOD;
priv->sei.payload[i].payload.buffering_period = priv->buffering_period;
++i;
}
priv->sei.payload[i].payload_type = H264_SEI_TYPE_PIC_TIMING;
priv->sei.payload[i].payload.pic_timing = priv->pic_timing;
++i;
}
if (opt->sei & SEI_RECOVERY_POINT && pic->type == PICTURE_TYPE_I) {
priv->sei.payload[i].payload_type = H264_SEI_TYPE_RECOVERY_POINT;
priv->sei.payload[i].payload.recovery_point = priv->recovery_point;
++i;
}
priv->sei.payload_count = i;
av_assert0(priv->sei.payload_count > 0);
err = vaapi_encode_h264_add_nal(avctx, au, &priv->sei);
if (err < 0)
goto fail;
priv->sei_needed = 0;
err = vaapi_encode_h264_write_access_unit(avctx, data, data_len, au);
if (err < 0)
goto fail;
ff_cbs_fragment_uninit(&priv->cbc, au);
*type = VAEncPackedHeaderRawData;
return 0;
#if !HAVE_VAAPI_1
} else if (priv->sei_cbr_workaround_needed) {
*data_len = 0;
*type = VAEncPackedHeaderH264_SEI;
priv->sei_cbr_workaround_needed = 0;
return 0;
#endif
} else {
return AVERROR_EOF;
}
fail:
ff_cbs_fragment_uninit(&priv->cbc, au);
return err;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(AVCodecContext *VAR_0,
VAAPIEncodePicture *VAR_1,
int VAR_2, int *VAR_3,
char *VAR_4, size_t *VAR_5)
{
VAAPIEncodeContext *ctx = VAR_0->priv_data;
VAAPIEncodeH264Context *priv = ctx->priv_data;
VAAPIEncodeH264Options *opt = ctx->codec_options;
CodedBitstreamFragment *au = &priv->current_access_unit;
int VAR_6, VAR_7;
if (priv->sei_needed) {
if (priv->aud_needed) {
vaapi_encode_h264_add_nal(VAR_0, au, &priv->aud);
priv->aud_needed = 0;
}
memset(&priv->sei, 0, sizeof(priv->sei));
priv->sei.nal_unit_header.nal_unit_type = H264_NAL_SEI;
VAR_7 = 0;
if (VAR_1->encode_order == 0 && opt->sei & SEI_IDENTIFIER) {
priv->sei.payload[VAR_7].payload_type = H264_SEI_TYPE_USER_DATA_UNREGISTERED;
priv->sei.payload[VAR_7].payload.user_data_unregistered = priv->identifier;
++VAR_7;
}
if (opt->sei & SEI_TIMING) {
if (VAR_1->VAR_3 == PICTURE_TYPE_IDR) {
priv->sei.payload[VAR_7].payload_type = H264_SEI_TYPE_BUFFERING_PERIOD;
priv->sei.payload[VAR_7].payload.buffering_period = priv->buffering_period;
++VAR_7;
}
priv->sei.payload[VAR_7].payload_type = H264_SEI_TYPE_PIC_TIMING;
priv->sei.payload[VAR_7].payload.pic_timing = priv->pic_timing;
++VAR_7;
}
if (opt->sei & SEI_RECOVERY_POINT && VAR_1->VAR_3 == PICTURE_TYPE_I) {
priv->sei.payload[VAR_7].payload_type = H264_SEI_TYPE_RECOVERY_POINT;
priv->sei.payload[VAR_7].payload.recovery_point = priv->recovery_point;
++VAR_7;
}
priv->sei.payload_count = VAR_7;
av_assert0(priv->sei.payload_count > 0);
VAR_6 = vaapi_encode_h264_add_nal(VAR_0, au, &priv->sei);
if (VAR_6 < 0)
goto fail;
priv->sei_needed = 0;
VAR_6 = vaapi_encode_h264_write_access_unit(VAR_0, VAR_4, VAR_5, au);
if (VAR_6 < 0)
goto fail;
ff_cbs_fragment_uninit(&priv->cbc, au);
*VAR_3 = VAEncPackedHeaderRawData;
return 0;
#if !HAVE_VAAPI_1
} else if (priv->sei_cbr_workaround_needed) {
*VAR_5 = 0;
*VAR_3 = VAEncPackedHeaderH264_SEI;
priv->sei_cbr_workaround_needed = 0;
return 0;
#endif
} else {
return AVERROR_EOF;
}
fail:
ff_cbs_fragment_uninit(&priv->cbc, au);
return VAR_6;
}
| [
"static int FUNC_0(AVCodecContext *VAR_0,\nVAAPIEncodePicture *VAR_1,\nint VAR_2, int *VAR_3,\nchar *VAR_4, size_t *VAR_5)\n{",
"VAAPIEncodeContext *ctx = VAR_0->priv_data;",
"VAAPIEncodeH264Context *priv = ctx->priv_data;",
"VAAPIEncodeH264Options *opt = ctx->codec_options;",
"CodedBitstreamFragment *au = &priv->current_access_unit;",
"int VAR_6, VAR_7;",
"if (priv->sei_needed) {",
"if (priv->aud_needed) {",
"vaapi_encode_h264_add_nal(VAR_0, au, &priv->aud);",
"priv->aud_needed = 0;",
"}",
"memset(&priv->sei, 0, sizeof(priv->sei));",
"priv->sei.nal_unit_header.nal_unit_type = H264_NAL_SEI;",
"VAR_7 = 0;",
"if (VAR_1->encode_order == 0 && opt->sei & SEI_IDENTIFIER) {",
"priv->sei.payload[VAR_7].payload_type = H264_SEI_TYPE_USER_DATA_UNREGISTERED;",
"priv->sei.payload[VAR_7].payload.user_data_unregistered = priv->identifier;",
"++VAR_7;",
"}",
"if (opt->sei & SEI_TIMING) {",
"if (VAR_1->VAR_3 == PICTURE_TYPE_IDR) {",
"priv->sei.payload[VAR_7].payload_type = H264_SEI_TYPE_BUFFERING_PERIOD;",
"priv->sei.payload[VAR_7].payload.buffering_period = priv->buffering_period;",
"++VAR_7;",
"}",
"priv->sei.payload[VAR_7].payload_type = H264_SEI_TYPE_PIC_TIMING;",
"priv->sei.payload[VAR_7].payload.pic_timing = priv->pic_timing;",
"++VAR_7;",
"}",
"if (opt->sei & SEI_RECOVERY_POINT && VAR_1->VAR_3 == PICTURE_TYPE_I) {",
"priv->sei.payload[VAR_7].payload_type = H264_SEI_TYPE_RECOVERY_POINT;",
"priv->sei.payload[VAR_7].payload.recovery_point = priv->recovery_point;",
"++VAR_7;",
"}",
"priv->sei.payload_count = VAR_7;",
"av_assert0(priv->sei.payload_count > 0);",
"VAR_6 = vaapi_encode_h264_add_nal(VAR_0, au, &priv->sei);",
"if (VAR_6 < 0)\ngoto fail;",
"priv->sei_needed = 0;",
"VAR_6 = vaapi_encode_h264_write_access_unit(VAR_0, VAR_4, VAR_5, au);",
"if (VAR_6 < 0)\ngoto fail;",
"ff_cbs_fragment_uninit(&priv->cbc, au);",
"*VAR_3 = VAEncPackedHeaderRawData;",
"return 0;",
"#if !HAVE_VAAPI_1\n} else if (priv->sei_cbr_workaround_needed) {",
"*VAR_5 = 0;",
"*VAR_3 = VAEncPackedHeaderH264_SEI;",
"priv->sei_cbr_workaround_needed = 0;",
"return 0;",
"#endif\n} else {",
"return AVERROR_EOF;",
"}",
"fail:\nff_cbs_fragment_uninit(&priv->cbc, au);",
"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
]
| [
[
1,
3,
5,
7,
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
35
],
[
37
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
85
],
[
87
],
[
91
],
[
93,
95
],
[
97
],
[
101
],
[
103,
105
],
[
109
],
[
113
],
[
115
],
[
119,
121
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139,
143
],
[
145
],
[
147
],
[
151,
153
],
[
155
],
[
157
]
]
|
12,435 | unsigned int DoubleCPDO(const unsigned int opcode)
{
FPA11 *fpa11 = GET_FPA11();
float64 rFm, rFn = 0;
unsigned int Fd, Fm, Fn, nRc = 1;
//printk("DoubleCPDO(0x%08x)\n",opcode);
Fm = getFm(opcode);
if (CONSTANT_FM(opcode))
{
rFm = getDoubleConstant(Fm);
}
else
{
switch (fpa11->fType[Fm])
{
case typeSingle:
rFm = float32_to_float64(fpa11->fpreg[Fm].fSingle, &fpa11->fp_status);
break;
case typeDouble:
rFm = fpa11->fpreg[Fm].fDouble;
break;
case typeExtended:
// !! patb
//printk("not implemented! why not?\n");
//!! ScottB
// should never get here, if extended involved
// then other operand should be promoted then
// ExtendedCPDO called.
break;
default: return 0;
}
}
if (!MONADIC_INSTRUCTION(opcode))
{
Fn = getFn(opcode);
switch (fpa11->fType[Fn])
{
case typeSingle:
rFn = float32_to_float64(fpa11->fpreg[Fn].fSingle, &fpa11->fp_status);
break;
case typeDouble:
rFn = fpa11->fpreg[Fn].fDouble;
break;
default: return 0;
}
}
Fd = getFd(opcode);
/* !! this switch isn't optimized; better (opcode & MASK_ARITHMETIC_OPCODE)>>24, sort of */
switch (opcode & MASK_ARITHMETIC_OPCODE)
{
/* dyadic opcodes */
case ADF_CODE:
fpa11->fpreg[Fd].fDouble = float64_add(rFn,rFm, &fpa11->fp_status);
break;
case MUF_CODE:
case FML_CODE:
fpa11->fpreg[Fd].fDouble = float64_mul(rFn,rFm, &fpa11->fp_status);
break;
case SUF_CODE:
fpa11->fpreg[Fd].fDouble = float64_sub(rFn,rFm, &fpa11->fp_status);
break;
case RSF_CODE:
fpa11->fpreg[Fd].fDouble = float64_sub(rFm,rFn, &fpa11->fp_status);
break;
case DVF_CODE:
case FDV_CODE:
fpa11->fpreg[Fd].fDouble = float64_div(rFn,rFm, &fpa11->fp_status);
break;
case RDF_CODE:
case FRD_CODE:
fpa11->fpreg[Fd].fDouble = float64_div(rFm,rFn, &fpa11->fp_status);
break;
#if 0
case POW_CODE:
fpa11->fpreg[Fd].fDouble = float64_pow(rFn,rFm);
break;
case RPW_CODE:
fpa11->fpreg[Fd].fDouble = float64_pow(rFm,rFn);
break;
#endif
case RMF_CODE:
fpa11->fpreg[Fd].fDouble = float64_rem(rFn,rFm, &fpa11->fp_status);
break;
#if 0
case POL_CODE:
fpa11->fpreg[Fd].fDouble = float64_pol(rFn,rFm);
break;
#endif
/* monadic opcodes */
case MVF_CODE:
fpa11->fpreg[Fd].fDouble = rFm;
break;
case MNF_CODE:
{
unsigned int *p = (unsigned int*)&rFm;
#ifdef WORDS_BIGENDIAN
p[0] ^= 0x80000000;
#else
p[1] ^= 0x80000000;
#endif
fpa11->fpreg[Fd].fDouble = rFm;
}
break;
case ABS_CODE:
{
unsigned int *p = (unsigned int*)&rFm;
#ifdef WORDS_BIGENDIAN
p[0] &= 0x7fffffff;
#else
p[1] &= 0x7fffffff;
#endif
fpa11->fpreg[Fd].fDouble = rFm;
}
break;
case RND_CODE:
case URD_CODE:
fpa11->fpreg[Fd].fDouble = float64_round_to_int(rFm, &fpa11->fp_status);
break;
case SQT_CODE:
fpa11->fpreg[Fd].fDouble = float64_sqrt(rFm, &fpa11->fp_status);
break;
#if 0
case LOG_CODE:
fpa11->fpreg[Fd].fDouble = float64_log(rFm);
break;
case LGN_CODE:
fpa11->fpreg[Fd].fDouble = float64_ln(rFm);
break;
case EXP_CODE:
fpa11->fpreg[Fd].fDouble = float64_exp(rFm);
break;
case SIN_CODE:
fpa11->fpreg[Fd].fDouble = float64_sin(rFm);
break;
case COS_CODE:
fpa11->fpreg[Fd].fDouble = float64_cos(rFm);
break;
case TAN_CODE:
fpa11->fpreg[Fd].fDouble = float64_tan(rFm);
break;
case ASN_CODE:
fpa11->fpreg[Fd].fDouble = float64_arcsin(rFm);
break;
case ACS_CODE:
fpa11->fpreg[Fd].fDouble = float64_arccos(rFm);
break;
case ATN_CODE:
fpa11->fpreg[Fd].fDouble = float64_arctan(rFm);
break;
#endif
case NRM_CODE:
break;
default:
{
nRc = 0;
}
}
if (0 != nRc) fpa11->fType[Fd] = typeDouble;
return nRc;
}
| false | qemu | f090c9d4ad5812fb92843d6470a1111c15190c4c | unsigned int DoubleCPDO(const unsigned int opcode)
{
FPA11 *fpa11 = GET_FPA11();
float64 rFm, rFn = 0;
unsigned int Fd, Fm, Fn, nRc = 1;
Fm = getFm(opcode);
if (CONSTANT_FM(opcode))
{
rFm = getDoubleConstant(Fm);
}
else
{
switch (fpa11->fType[Fm])
{
case typeSingle:
rFm = float32_to_float64(fpa11->fpreg[Fm].fSingle, &fpa11->fp_status);
break;
case typeDouble:
rFm = fpa11->fpreg[Fm].fDouble;
break;
case typeExtended:
break;
default: return 0;
}
}
if (!MONADIC_INSTRUCTION(opcode))
{
Fn = getFn(opcode);
switch (fpa11->fType[Fn])
{
case typeSingle:
rFn = float32_to_float64(fpa11->fpreg[Fn].fSingle, &fpa11->fp_status);
break;
case typeDouble:
rFn = fpa11->fpreg[Fn].fDouble;
break;
default: return 0;
}
}
Fd = getFd(opcode);
switch (opcode & MASK_ARITHMETIC_OPCODE)
{
case ADF_CODE:
fpa11->fpreg[Fd].fDouble = float64_add(rFn,rFm, &fpa11->fp_status);
break;
case MUF_CODE:
case FML_CODE:
fpa11->fpreg[Fd].fDouble = float64_mul(rFn,rFm, &fpa11->fp_status);
break;
case SUF_CODE:
fpa11->fpreg[Fd].fDouble = float64_sub(rFn,rFm, &fpa11->fp_status);
break;
case RSF_CODE:
fpa11->fpreg[Fd].fDouble = float64_sub(rFm,rFn, &fpa11->fp_status);
break;
case DVF_CODE:
case FDV_CODE:
fpa11->fpreg[Fd].fDouble = float64_div(rFn,rFm, &fpa11->fp_status);
break;
case RDF_CODE:
case FRD_CODE:
fpa11->fpreg[Fd].fDouble = float64_div(rFm,rFn, &fpa11->fp_status);
break;
#if 0
case POW_CODE:
fpa11->fpreg[Fd].fDouble = float64_pow(rFn,rFm);
break;
case RPW_CODE:
fpa11->fpreg[Fd].fDouble = float64_pow(rFm,rFn);
break;
#endif
case RMF_CODE:
fpa11->fpreg[Fd].fDouble = float64_rem(rFn,rFm, &fpa11->fp_status);
break;
#if 0
case POL_CODE:
fpa11->fpreg[Fd].fDouble = float64_pol(rFn,rFm);
break;
#endif
case MVF_CODE:
fpa11->fpreg[Fd].fDouble = rFm;
break;
case MNF_CODE:
{
unsigned int *p = (unsigned int*)&rFm;
#ifdef WORDS_BIGENDIAN
p[0] ^= 0x80000000;
#else
p[1] ^= 0x80000000;
#endif
fpa11->fpreg[Fd].fDouble = rFm;
}
break;
case ABS_CODE:
{
unsigned int *p = (unsigned int*)&rFm;
#ifdef WORDS_BIGENDIAN
p[0] &= 0x7fffffff;
#else
p[1] &= 0x7fffffff;
#endif
fpa11->fpreg[Fd].fDouble = rFm;
}
break;
case RND_CODE:
case URD_CODE:
fpa11->fpreg[Fd].fDouble = float64_round_to_int(rFm, &fpa11->fp_status);
break;
case SQT_CODE:
fpa11->fpreg[Fd].fDouble = float64_sqrt(rFm, &fpa11->fp_status);
break;
#if 0
case LOG_CODE:
fpa11->fpreg[Fd].fDouble = float64_log(rFm);
break;
case LGN_CODE:
fpa11->fpreg[Fd].fDouble = float64_ln(rFm);
break;
case EXP_CODE:
fpa11->fpreg[Fd].fDouble = float64_exp(rFm);
break;
case SIN_CODE:
fpa11->fpreg[Fd].fDouble = float64_sin(rFm);
break;
case COS_CODE:
fpa11->fpreg[Fd].fDouble = float64_cos(rFm);
break;
case TAN_CODE:
fpa11->fpreg[Fd].fDouble = float64_tan(rFm);
break;
case ASN_CODE:
fpa11->fpreg[Fd].fDouble = float64_arcsin(rFm);
break;
case ACS_CODE:
fpa11->fpreg[Fd].fDouble = float64_arccos(rFm);
break;
case ATN_CODE:
fpa11->fpreg[Fd].fDouble = float64_arctan(rFm);
break;
#endif
case NRM_CODE:
break;
default:
{
nRc = 0;
}
}
if (0 != nRc) fpa11->fType[Fd] = typeDouble;
return nRc;
}
| {
"code": [],
"line_no": []
} | unsigned int FUNC_0(const unsigned int VAR_0)
{
FPA11 *fpa11 = GET_FPA11();
float64 rFm, rFn = 0;
unsigned int VAR_1, VAR_2, VAR_3, VAR_4 = 1;
VAR_2 = getFm(VAR_0);
if (CONSTANT_FM(VAR_0))
{
rFm = getDoubleConstant(VAR_2);
}
else
{
switch (fpa11->fType[VAR_2])
{
case typeSingle:
rFm = float32_to_float64(fpa11->fpreg[VAR_2].fSingle, &fpa11->fp_status);
break;
case typeDouble:
rFm = fpa11->fpreg[VAR_2].fDouble;
break;
case typeExtended:
break;
default: return 0;
}
}
if (!MONADIC_INSTRUCTION(VAR_0))
{
VAR_3 = getFn(VAR_0);
switch (fpa11->fType[VAR_3])
{
case typeSingle:
rFn = float32_to_float64(fpa11->fpreg[VAR_3].fSingle, &fpa11->fp_status);
break;
case typeDouble:
rFn = fpa11->fpreg[VAR_3].fDouble;
break;
default: return 0;
}
}
VAR_1 = getFd(VAR_0);
switch (VAR_0 & MASK_ARITHMETIC_OPCODE)
{
case ADF_CODE:
fpa11->fpreg[VAR_1].fDouble = float64_add(rFn,rFm, &fpa11->fp_status);
break;
case MUF_CODE:
case FML_CODE:
fpa11->fpreg[VAR_1].fDouble = float64_mul(rFn,rFm, &fpa11->fp_status);
break;
case SUF_CODE:
fpa11->fpreg[VAR_1].fDouble = float64_sub(rFn,rFm, &fpa11->fp_status);
break;
case RSF_CODE:
fpa11->fpreg[VAR_1].fDouble = float64_sub(rFm,rFn, &fpa11->fp_status);
break;
case DVF_CODE:
case FDV_CODE:
fpa11->fpreg[VAR_1].fDouble = float64_div(rFn,rFm, &fpa11->fp_status);
break;
case RDF_CODE:
case FRD_CODE:
fpa11->fpreg[VAR_1].fDouble = float64_div(rFm,rFn, &fpa11->fp_status);
break;
#if 0
case POW_CODE:
fpa11->fpreg[VAR_1].fDouble = float64_pow(rFn,rFm);
break;
case RPW_CODE:
fpa11->fpreg[VAR_1].fDouble = float64_pow(rFm,rFn);
break;
#endif
case RMF_CODE:
fpa11->fpreg[VAR_1].fDouble = float64_rem(rFn,rFm, &fpa11->fp_status);
break;
#if 0
case POL_CODE:
fpa11->fpreg[VAR_1].fDouble = float64_pol(rFn,rFm);
break;
#endif
case MVF_CODE:
fpa11->fpreg[VAR_1].fDouble = rFm;
break;
case MNF_CODE:
{
unsigned int *VAR_6 = (unsigned int*)&rFm;
#ifdef WORDS_BIGENDIAN
VAR_6[0] ^= 0x80000000;
#else
VAR_6[1] ^= 0x80000000;
#endif
fpa11->fpreg[VAR_1].fDouble = rFm;
}
break;
case ABS_CODE:
{
unsigned int *VAR_6 = (unsigned int*)&rFm;
#ifdef WORDS_BIGENDIAN
VAR_6[0] &= 0x7fffffff;
#else
VAR_6[1] &= 0x7fffffff;
#endif
fpa11->fpreg[VAR_1].fDouble = rFm;
}
break;
case RND_CODE:
case URD_CODE:
fpa11->fpreg[VAR_1].fDouble = float64_round_to_int(rFm, &fpa11->fp_status);
break;
case SQT_CODE:
fpa11->fpreg[VAR_1].fDouble = float64_sqrt(rFm, &fpa11->fp_status);
break;
#if 0
case LOG_CODE:
fpa11->fpreg[VAR_1].fDouble = float64_log(rFm);
break;
case LGN_CODE:
fpa11->fpreg[VAR_1].fDouble = float64_ln(rFm);
break;
case EXP_CODE:
fpa11->fpreg[VAR_1].fDouble = float64_exp(rFm);
break;
case SIN_CODE:
fpa11->fpreg[VAR_1].fDouble = float64_sin(rFm);
break;
case COS_CODE:
fpa11->fpreg[VAR_1].fDouble = float64_cos(rFm);
break;
case TAN_CODE:
fpa11->fpreg[VAR_1].fDouble = float64_tan(rFm);
break;
case ASN_CODE:
fpa11->fpreg[VAR_1].fDouble = float64_arcsin(rFm);
break;
case ACS_CODE:
fpa11->fpreg[VAR_1].fDouble = float64_arccos(rFm);
break;
case ATN_CODE:
fpa11->fpreg[VAR_1].fDouble = float64_arctan(rFm);
break;
#endif
case NRM_CODE:
break;
default:
{
VAR_4 = 0;
}
}
if (0 != VAR_4) fpa11->fType[VAR_1] = typeDouble;
return VAR_4;
}
| [
"unsigned int FUNC_0(const unsigned int VAR_0)\n{",
"FPA11 *fpa11 = GET_FPA11();",
"float64 rFm, rFn = 0;",
"unsigned int VAR_1, VAR_2, VAR_3, VAR_4 = 1;",
"VAR_2 = getFm(VAR_0);",
"if (CONSTANT_FM(VAR_0))\n{",
"rFm = getDoubleConstant(VAR_2);",
"}",
"else\n{",
"switch (fpa11->fType[VAR_2])\n{",
"case typeSingle:\nrFm = float32_to_float64(fpa11->fpreg[VAR_2].fSingle, &fpa11->fp_status);",
"break;",
"case typeDouble:\nrFm = fpa11->fpreg[VAR_2].fDouble;",
"break;",
"case typeExtended:\nbreak;",
"default: return 0;",
"}",
"}",
"if (!MONADIC_INSTRUCTION(VAR_0))\n{",
"VAR_3 = getFn(VAR_0);",
"switch (fpa11->fType[VAR_3])\n{",
"case typeSingle:\nrFn = float32_to_float64(fpa11->fpreg[VAR_3].fSingle, &fpa11->fp_status);",
"break;",
"case typeDouble:\nrFn = fpa11->fpreg[VAR_3].fDouble;",
"break;",
"default: return 0;",
"}",
"}",
"VAR_1 = getFd(VAR_0);",
"switch (VAR_0 & MASK_ARITHMETIC_OPCODE)\n{",
"case ADF_CODE:\nfpa11->fpreg[VAR_1].fDouble = float64_add(rFn,rFm, &fpa11->fp_status);",
"break;",
"case MUF_CODE:\ncase FML_CODE:\nfpa11->fpreg[VAR_1].fDouble = float64_mul(rFn,rFm, &fpa11->fp_status);",
"break;",
"case SUF_CODE:\nfpa11->fpreg[VAR_1].fDouble = float64_sub(rFn,rFm, &fpa11->fp_status);",
"break;",
"case RSF_CODE:\nfpa11->fpreg[VAR_1].fDouble = float64_sub(rFm,rFn, &fpa11->fp_status);",
"break;",
"case DVF_CODE:\ncase FDV_CODE:\nfpa11->fpreg[VAR_1].fDouble = float64_div(rFn,rFm, &fpa11->fp_status);",
"break;",
"case RDF_CODE:\ncase FRD_CODE:\nfpa11->fpreg[VAR_1].fDouble = float64_div(rFm,rFn, &fpa11->fp_status);",
"break;",
"#if 0\ncase POW_CODE:\nfpa11->fpreg[VAR_1].fDouble = float64_pow(rFn,rFm);",
"break;",
"case RPW_CODE:\nfpa11->fpreg[VAR_1].fDouble = float64_pow(rFm,rFn);",
"break;",
"#endif\ncase RMF_CODE:\nfpa11->fpreg[VAR_1].fDouble = float64_rem(rFn,rFm, &fpa11->fp_status);",
"break;",
"#if 0\ncase POL_CODE:\nfpa11->fpreg[VAR_1].fDouble = float64_pol(rFn,rFm);",
"break;",
"#endif\ncase MVF_CODE:\nfpa11->fpreg[VAR_1].fDouble = rFm;",
"break;",
"case MNF_CODE:\n{",
"unsigned int *VAR_6 = (unsigned int*)&rFm;",
"#ifdef WORDS_BIGENDIAN\nVAR_6[0] ^= 0x80000000;",
"#else\nVAR_6[1] ^= 0x80000000;",
"#endif\nfpa11->fpreg[VAR_1].fDouble = rFm;",
"}",
"break;",
"case ABS_CODE:\n{",
"unsigned int *VAR_6 = (unsigned int*)&rFm;",
"#ifdef WORDS_BIGENDIAN\nVAR_6[0] &= 0x7fffffff;",
"#else\nVAR_6[1] &= 0x7fffffff;",
"#endif\nfpa11->fpreg[VAR_1].fDouble = rFm;",
"}",
"break;",
"case RND_CODE:\ncase URD_CODE:\nfpa11->fpreg[VAR_1].fDouble = float64_round_to_int(rFm, &fpa11->fp_status);",
"break;",
"case SQT_CODE:\nfpa11->fpreg[VAR_1].fDouble = float64_sqrt(rFm, &fpa11->fp_status);",
"break;",
"#if 0\ncase LOG_CODE:\nfpa11->fpreg[VAR_1].fDouble = float64_log(rFm);",
"break;",
"case LGN_CODE:\nfpa11->fpreg[VAR_1].fDouble = float64_ln(rFm);",
"break;",
"case EXP_CODE:\nfpa11->fpreg[VAR_1].fDouble = float64_exp(rFm);",
"break;",
"case SIN_CODE:\nfpa11->fpreg[VAR_1].fDouble = float64_sin(rFm);",
"break;",
"case COS_CODE:\nfpa11->fpreg[VAR_1].fDouble = float64_cos(rFm);",
"break;",
"case TAN_CODE:\nfpa11->fpreg[VAR_1].fDouble = float64_tan(rFm);",
"break;",
"case ASN_CODE:\nfpa11->fpreg[VAR_1].fDouble = float64_arcsin(rFm);",
"break;",
"case ACS_CODE:\nfpa11->fpreg[VAR_1].fDouble = float64_arccos(rFm);",
"break;",
"case ATN_CODE:\nfpa11->fpreg[VAR_1].fDouble = float64_arctan(rFm);",
"break;",
"#endif\ncase NRM_CODE:\nbreak;",
"default:\n{",
"VAR_4 = 0;",
"}",
"}",
"if (0 != VAR_4) fpa11->fType[VAR_1] = typeDouble;",
"return VAR_4;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
17
],
[
19,
21
],
[
23
],
[
25
],
[
27,
29
],
[
31,
33
],
[
35,
37
],
[
39
],
[
43,
45
],
[
47
],
[
51,
65
],
[
69
],
[
71
],
[
73
],
[
77,
79
],
[
81
],
[
83,
85
],
[
87,
89
],
[
91
],
[
95,
97
],
[
99
],
[
103
],
[
105
],
[
107
],
[
111
],
[
115,
117
],
[
121,
123
],
[
125
],
[
129,
131,
133
],
[
135
],
[
139,
141
],
[
143
],
[
147,
149
],
[
151
],
[
155,
157,
159
],
[
161
],
[
165,
167,
169
],
[
171
],
[
175,
177,
179
],
[
181
],
[
185,
187
],
[
189
],
[
191,
195,
197
],
[
199
],
[
203,
205,
207
],
[
209
],
[
211,
217,
219
],
[
221
],
[
225,
227
],
[
229
],
[
231,
233
],
[
235,
237
],
[
239,
241
],
[
243
],
[
245
],
[
249,
251
],
[
253
],
[
255,
257
],
[
259,
261
],
[
263,
265
],
[
267
],
[
269
],
[
273,
275,
277
],
[
279
],
[
283,
285
],
[
287
],
[
291,
293,
295
],
[
297
],
[
301,
303
],
[
305
],
[
309,
311
],
[
313
],
[
317,
319
],
[
321
],
[
325,
327
],
[
329
],
[
333,
335
],
[
337
],
[
341,
343
],
[
345
],
[
349,
351
],
[
353
],
[
357,
359
],
[
361
],
[
363,
367,
369
],
[
373,
375
],
[
377
],
[
379
],
[
381
],
[
385
],
[
387
],
[
389
]
]
|
12,436 | static void pci_nop(void)
{
qvirtio_scsi_start(NULL);
qvirtio_scsi_stop();
}
| false | qemu | a980f7f2c2f4d7e9a1eba4f804cd66dbd458b6d4 | static void pci_nop(void)
{
qvirtio_scsi_start(NULL);
qvirtio_scsi_stop();
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(void)
{
qvirtio_scsi_start(NULL);
qvirtio_scsi_stop();
}
| [
"static void FUNC_0(void)\n{",
"qvirtio_scsi_start(NULL);",
"qvirtio_scsi_stop();",
"}"
]
| [
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
]
]
|
12,437 | long do_sigreturn(CPUS390XState *env)
{
sigframe *frame;
abi_ulong frame_addr = env->regs[15];
qemu_log("%s: frame_addr 0x%llx\n", __FUNCTION__,
(unsigned long long)frame_addr);
target_sigset_t target_set;
sigset_t set;
if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) {
goto badframe;
}
if (__get_user(target_set.sig[0], &frame->sc.oldmask[0])) {
goto badframe;
}
target_to_host_sigset_internal(&set, &target_set);
sigprocmask(SIG_SETMASK, &set, NULL); /* ~_BLOCKABLE? */
if (restore_sigregs(env, &frame->sregs)) {
goto badframe;
}
unlock_user_struct(frame, frame_addr, 0);
return env->regs[2];
badframe:
unlock_user_struct(frame, frame_addr, 0);
force_sig(TARGET_SIGSEGV);
return 0;
}
| false | qemu | 1c275925bfbbc2de84a8f0e09d1dd70bbefb6da3 | long do_sigreturn(CPUS390XState *env)
{
sigframe *frame;
abi_ulong frame_addr = env->regs[15];
qemu_log("%s: frame_addr 0x%llx\n", __FUNCTION__,
(unsigned long long)frame_addr);
target_sigset_t target_set;
sigset_t set;
if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) {
goto badframe;
}
if (__get_user(target_set.sig[0], &frame->sc.oldmask[0])) {
goto badframe;
}
target_to_host_sigset_internal(&set, &target_set);
sigprocmask(SIG_SETMASK, &set, NULL);
if (restore_sigregs(env, &frame->sregs)) {
goto badframe;
}
unlock_user_struct(frame, frame_addr, 0);
return env->regs[2];
badframe:
unlock_user_struct(frame, frame_addr, 0);
force_sig(TARGET_SIGSEGV);
return 0;
}
| {
"code": [],
"line_no": []
} | long FUNC_0(CPUS390XState *VAR_0)
{
sigframe *frame;
abi_ulong frame_addr = VAR_0->regs[15];
qemu_log("%s: frame_addr 0x%llx\n", __FUNCTION__,
(unsigned long long)frame_addr);
target_sigset_t target_set;
sigset_t set;
if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) {
goto badframe;
}
if (__get_user(target_set.sig[0], &frame->sc.oldmask[0])) {
goto badframe;
}
target_to_host_sigset_internal(&set, &target_set);
sigprocmask(SIG_SETMASK, &set, NULL);
if (restore_sigregs(VAR_0, &frame->sregs)) {
goto badframe;
}
unlock_user_struct(frame, frame_addr, 0);
return VAR_0->regs[2];
badframe:
unlock_user_struct(frame, frame_addr, 0);
force_sig(TARGET_SIGSEGV);
return 0;
}
| [
"long FUNC_0(CPUS390XState *VAR_0)\n{",
"sigframe *frame;",
"abi_ulong frame_addr = VAR_0->regs[15];",
"qemu_log(\"%s: frame_addr 0x%llx\\n\", __FUNCTION__,\n(unsigned long long)frame_addr);",
"target_sigset_t target_set;",
"sigset_t set;",
"if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) {",
"goto badframe;",
"}",
"if (__get_user(target_set.sig[0], &frame->sc.oldmask[0])) {",
"goto badframe;",
"}",
"target_to_host_sigset_internal(&set, &target_set);",
"sigprocmask(SIG_SETMASK, &set, NULL);",
"if (restore_sigregs(VAR_0, &frame->sregs)) {",
"goto badframe;",
"}",
"unlock_user_struct(frame, frame_addr, 0);",
"return VAR_0->regs[2];",
"badframe:\nunlock_user_struct(frame, frame_addr, 0);",
"force_sig(TARGET_SIGSEGV);",
"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
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9,
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
],
[
39
],
[
41
],
[
43
],
[
47
],
[
49
],
[
53,
55
],
[
57
],
[
59
],
[
61
]
]
|
12,438 | void helper_check_iow(CPUX86State *env, uint32_t t0)
{
check_io(env, t0, 2);
}
| false | qemu | 81cf8d8adc64203567e03326c13ea4abec9fe5df | void helper_check_iow(CPUX86State *env, uint32_t t0)
{
check_io(env, t0, 2);
}
| {
"code": [],
"line_no": []
} | void FUNC_0(CPUX86State *VAR_0, uint32_t VAR_1)
{
check_io(VAR_0, VAR_1, 2);
}
| [
"void FUNC_0(CPUX86State *VAR_0, uint32_t VAR_1)\n{",
"check_io(VAR_0, VAR_1, 2);",
"}"
]
| [
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
]
]
|
12,439 | AVStream *av_new_stream(AVFormatContext *s, int id)
{
AVStream *st;
int i;
#if LIBAVFORMAT_VERSION_MAJOR >= 53
AVStream **streams;
if (s->nb_streams >= INT_MAX/sizeof(*streams))
return NULL;
streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams));
if (!streams)
return NULL;
s->streams = streams;
#else
if (s->nb_streams >= MAX_STREAMS){
av_log(s, AV_LOG_ERROR, "Too many streams\n");
return NULL;
}
#endif
st = av_mallocz(sizeof(AVStream));
if (!st)
return NULL;
st->codec= avcodec_alloc_context();
if (s->iformat) {
/* no default bitrate if decoding */
st->codec->bit_rate = 0;
}
st->index = s->nb_streams;
st->id = id;
st->start_time = AV_NOPTS_VALUE;
st->duration = AV_NOPTS_VALUE;
/* we set the current DTS to 0 so that formats without any timestamps
but durations get some timestamps, formats with some unknown
timestamps have their first few packets buffered and the
timestamps corrected before they are returned to the user */
st->cur_dts = 0;
st->first_dts = AV_NOPTS_VALUE;
st->probe_packets = MAX_PROBE_PACKETS;
/* default pts setting is MPEG-like */
av_set_pts_info(st, 33, 1, 90000);
st->last_IP_pts = AV_NOPTS_VALUE;
for(i=0; i<MAX_REORDER_DELAY+1; i++)
st->pts_buffer[i]= AV_NOPTS_VALUE;
st->reference_dts = AV_NOPTS_VALUE;
st->sample_aspect_ratio = (AVRational){0,1};
s->streams[s->nb_streams++] = st;
return st;
}
| false | FFmpeg | 61138c43e08b7bb039fbcf50f1e71d6e735e04a5 | AVStream *av_new_stream(AVFormatContext *s, int id)
{
AVStream *st;
int i;
#if LIBAVFORMAT_VERSION_MAJOR >= 53
AVStream **streams;
if (s->nb_streams >= INT_MAX/sizeof(*streams))
return NULL;
streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams));
if (!streams)
return NULL;
s->streams = streams;
#else
if (s->nb_streams >= MAX_STREAMS){
av_log(s, AV_LOG_ERROR, "Too many streams\n");
return NULL;
}
#endif
st = av_mallocz(sizeof(AVStream));
if (!st)
return NULL;
st->codec= avcodec_alloc_context();
if (s->iformat) {
st->codec->bit_rate = 0;
}
st->index = s->nb_streams;
st->id = id;
st->start_time = AV_NOPTS_VALUE;
st->duration = AV_NOPTS_VALUE;
st->cur_dts = 0;
st->first_dts = AV_NOPTS_VALUE;
st->probe_packets = MAX_PROBE_PACKETS;
av_set_pts_info(st, 33, 1, 90000);
st->last_IP_pts = AV_NOPTS_VALUE;
for(i=0; i<MAX_REORDER_DELAY+1; i++)
st->pts_buffer[i]= AV_NOPTS_VALUE;
st->reference_dts = AV_NOPTS_VALUE;
st->sample_aspect_ratio = (AVRational){0,1};
s->streams[s->nb_streams++] = st;
return st;
}
| {
"code": [],
"line_no": []
} | AVStream *FUNC_0(AVFormatContext *s, int id)
{
AVStream *st;
int VAR_0;
#if LIBAVFORMAT_VERSION_MAJOR >= 53
AVStream **streams;
if (s->nb_streams >= INT_MAX/sizeof(*streams))
return NULL;
streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams));
if (!streams)
return NULL;
s->streams = streams;
#else
if (s->nb_streams >= MAX_STREAMS){
av_log(s, AV_LOG_ERROR, "Too many streams\n");
return NULL;
}
#endif
st = av_mallocz(sizeof(AVStream));
if (!st)
return NULL;
st->codec= avcodec_alloc_context();
if (s->iformat) {
st->codec->bit_rate = 0;
}
st->index = s->nb_streams;
st->id = id;
st->start_time = AV_NOPTS_VALUE;
st->duration = AV_NOPTS_VALUE;
st->cur_dts = 0;
st->first_dts = AV_NOPTS_VALUE;
st->probe_packets = MAX_PROBE_PACKETS;
av_set_pts_info(st, 33, 1, 90000);
st->last_IP_pts = AV_NOPTS_VALUE;
for(VAR_0=0; VAR_0<MAX_REORDER_DELAY+1; VAR_0++)
st->pts_buffer[VAR_0]= AV_NOPTS_VALUE;
st->reference_dts = AV_NOPTS_VALUE;
st->sample_aspect_ratio = (AVRational){0,1};
s->streams[s->nb_streams++] = st;
return st;
}
| [
"AVStream *FUNC_0(AVFormatContext *s, int id)\n{",
"AVStream *st;",
"int VAR_0;",
"#if LIBAVFORMAT_VERSION_MAJOR >= 53\nAVStream **streams;",
"if (s->nb_streams >= INT_MAX/sizeof(*streams))\nreturn NULL;",
"streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams));",
"if (!streams)\nreturn NULL;",
"s->streams = streams;",
"#else\nif (s->nb_streams >= MAX_STREAMS){",
"av_log(s, AV_LOG_ERROR, \"Too many streams\\n\");",
"return NULL;",
"}",
"#endif\nst = av_mallocz(sizeof(AVStream));",
"if (!st)\nreturn NULL;",
"st->codec= avcodec_alloc_context();",
"if (s->iformat) {",
"st->codec->bit_rate = 0;",
"}",
"st->index = s->nb_streams;",
"st->id = id;",
"st->start_time = AV_NOPTS_VALUE;",
"st->duration = AV_NOPTS_VALUE;",
"st->cur_dts = 0;",
"st->first_dts = AV_NOPTS_VALUE;",
"st->probe_packets = MAX_PROBE_PACKETS;",
"av_set_pts_info(st, 33, 1, 90000);",
"st->last_IP_pts = AV_NOPTS_VALUE;",
"for(VAR_0=0; VAR_0<MAX_REORDER_DELAY+1; VAR_0++)",
"st->pts_buffer[VAR_0]= AV_NOPTS_VALUE;",
"st->reference_dts = AV_NOPTS_VALUE;",
"st->sample_aspect_ratio = (AVRational){0,1};",
"s->streams[s->nb_streams++] = st;",
"return st;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9,
11
],
[
15,
17
],
[
19
],
[
21,
23
],
[
25
],
[
27,
29
],
[
31
],
[
33
],
[
35
],
[
37,
41
],
[
43,
45
],
[
49
],
[
51
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
75
],
[
77
],
[
79
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
97
],
[
101
],
[
103
],
[
105
]
]
|
12,441 | void tcg_prologue_init(TCGContext *s)
{
size_t prologue_size, total_size;
void *buf0, *buf1;
/* Put the prologue at the beginning of code_gen_buffer. */
buf0 = s->code_gen_buffer;
s->code_ptr = buf0;
s->code_buf = buf0;
s->code_gen_prologue = buf0;
/* Generate the prologue. */
tcg_target_qemu_prologue(s);
buf1 = s->code_ptr;
flush_icache_range((uintptr_t)buf0, (uintptr_t)buf1);
/* Deduct the prologue from the buffer. */
prologue_size = tcg_current_code_size(s);
s->code_gen_ptr = buf1;
s->code_gen_buffer = buf1;
s->code_buf = buf1;
total_size = s->code_gen_buffer_size - prologue_size;
s->code_gen_buffer_size = total_size;
/* Compute a high-water mark, at which we voluntarily flush the buffer
and start over. The size here is arbitrary, significantly larger
than we expect the code generation for any one opcode to require. */
/* ??? We currently have no good estimate for, or checks in,
tcg_out_tb_finalize. If there are quite a lot of guest memory ops,
the number of out-of-line fragments could be quite high. In the
short-term, increase the highwater buffer. */
s->code_gen_highwater = s->code_gen_buffer + (total_size - 64*1024);
tcg_register_jit(s->code_gen_buffer, total_size);
#ifdef DEBUG_DISAS
if (qemu_loglevel_mask(CPU_LOG_TB_OUT_ASM)) {
qemu_log("PROLOGUE: [size=%zu]\n", prologue_size);
log_disas(buf0, prologue_size);
qemu_log("\n");
qemu_log_flush();
}
#endif
}
| false | qemu | 23dceda62a3643f734b7aa474fa6052593ae1a70 | void tcg_prologue_init(TCGContext *s)
{
size_t prologue_size, total_size;
void *buf0, *buf1;
buf0 = s->code_gen_buffer;
s->code_ptr = buf0;
s->code_buf = buf0;
s->code_gen_prologue = buf0;
tcg_target_qemu_prologue(s);
buf1 = s->code_ptr;
flush_icache_range((uintptr_t)buf0, (uintptr_t)buf1);
prologue_size = tcg_current_code_size(s);
s->code_gen_ptr = buf1;
s->code_gen_buffer = buf1;
s->code_buf = buf1;
total_size = s->code_gen_buffer_size - prologue_size;
s->code_gen_buffer_size = total_size;
s->code_gen_highwater = s->code_gen_buffer + (total_size - 64*1024);
tcg_register_jit(s->code_gen_buffer, total_size);
#ifdef DEBUG_DISAS
if (qemu_loglevel_mask(CPU_LOG_TB_OUT_ASM)) {
qemu_log("PROLOGUE: [size=%zu]\n", prologue_size);
log_disas(buf0, prologue_size);
qemu_log("\n");
qemu_log_flush();
}
#endif
}
| {
"code": [],
"line_no": []
} | void FUNC_0(TCGContext *VAR_0)
{
size_t prologue_size, total_size;
void *VAR_1, *VAR_2;
VAR_1 = VAR_0->code_gen_buffer;
VAR_0->code_ptr = VAR_1;
VAR_0->code_buf = VAR_1;
VAR_0->code_gen_prologue = VAR_1;
tcg_target_qemu_prologue(VAR_0);
VAR_2 = VAR_0->code_ptr;
flush_icache_range((uintptr_t)VAR_1, (uintptr_t)VAR_2);
prologue_size = tcg_current_code_size(VAR_0);
VAR_0->code_gen_ptr = VAR_2;
VAR_0->code_gen_buffer = VAR_2;
VAR_0->code_buf = VAR_2;
total_size = VAR_0->code_gen_buffer_size - prologue_size;
VAR_0->code_gen_buffer_size = total_size;
VAR_0->code_gen_highwater = VAR_0->code_gen_buffer + (total_size - 64*1024);
tcg_register_jit(VAR_0->code_gen_buffer, total_size);
#ifdef DEBUG_DISAS
if (qemu_loglevel_mask(CPU_LOG_TB_OUT_ASM)) {
qemu_log("PROLOGUE: [size=%zu]\n", prologue_size);
log_disas(VAR_1, prologue_size);
qemu_log("\n");
qemu_log_flush();
}
#endif
}
| [
"void FUNC_0(TCGContext *VAR_0)\n{",
"size_t prologue_size, total_size;",
"void *VAR_1, *VAR_2;",
"VAR_1 = VAR_0->code_gen_buffer;",
"VAR_0->code_ptr = VAR_1;",
"VAR_0->code_buf = VAR_1;",
"VAR_0->code_gen_prologue = VAR_1;",
"tcg_target_qemu_prologue(VAR_0);",
"VAR_2 = VAR_0->code_ptr;",
"flush_icache_range((uintptr_t)VAR_1, (uintptr_t)VAR_2);",
"prologue_size = tcg_current_code_size(VAR_0);",
"VAR_0->code_gen_ptr = VAR_2;",
"VAR_0->code_gen_buffer = VAR_2;",
"VAR_0->code_buf = VAR_2;",
"total_size = VAR_0->code_gen_buffer_size - prologue_size;",
"VAR_0->code_gen_buffer_size = total_size;",
"VAR_0->code_gen_highwater = VAR_0->code_gen_buffer + (total_size - 64*1024);",
"tcg_register_jit(VAR_0->code_gen_buffer, total_size);",
"#ifdef DEBUG_DISAS\nif (qemu_loglevel_mask(CPU_LOG_TB_OUT_ASM)) {",
"qemu_log(\"PROLOGUE: [size=%zu]\\n\", prologue_size);",
"log_disas(VAR_1, prologue_size);",
"qemu_log(\"\\n\");",
"qemu_log_flush();",
"}",
"#endif\n}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
13
],
[
15
],
[
17
],
[
19
],
[
25
],
[
27
],
[
29
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
63
],
[
67
],
[
71,
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85,
87
]
]
|
12,442 | void qemu_clock_warp(QEMUClockType type)
{
int64_t clock;
int64_t deadline;
/*
* There are too many global variables to make the "warp" behavior
* applicable to other clocks. But a clock argument removes the
* need for if statements all over the place.
*/
if (type != QEMU_CLOCK_VIRTUAL || !use_icount) {
return;
}
if (icount_sleep) {
/*
* If the CPUs have been sleeping, advance QEMU_CLOCK_VIRTUAL timer now.
* This ensures that the deadline for the timer is computed correctly
* below.
* This also makes sure that the insn counter is synchronized before
* the CPU starts running, in case the CPU is woken by an event other
* than the earliest QEMU_CLOCK_VIRTUAL timer.
*/
icount_warp_rt(NULL);
timer_del(icount_warp_timer);
}
if (!all_cpu_threads_idle()) {
return;
}
if (qtest_enabled()) {
/* When testing, qtest commands advance icount. */
return;
}
/* We want to use the earliest deadline from ALL vm_clocks */
clock = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL_RT);
deadline = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL);
if (deadline < 0) {
static bool notified;
if (!icount_sleep && !notified) {
error_report("WARNING: icount sleep disabled and no active timers");
notified = true;
}
return;
}
if (deadline > 0) {
/*
* Ensure QEMU_CLOCK_VIRTUAL proceeds even when the virtual CPU goes to
* sleep. Otherwise, the CPU might be waiting for a future timer
* interrupt to wake it up, but the interrupt never comes because
* the vCPU isn't running any insns and thus doesn't advance the
* QEMU_CLOCK_VIRTUAL.
*/
if (!icount_sleep) {
/*
* We never let VCPUs sleep in no sleep icount mode.
* If there is a pending QEMU_CLOCK_VIRTUAL timer we just advance
* to the next QEMU_CLOCK_VIRTUAL event and notify it.
* It is useful when we want a deterministic execution time,
* isolated from host latencies.
*/
seqlock_write_lock(&timers_state.vm_clock_seqlock);
timers_state.qemu_icount_bias += deadline;
seqlock_write_unlock(&timers_state.vm_clock_seqlock);
qemu_clock_notify(QEMU_CLOCK_VIRTUAL);
} else {
/*
* We do stop VCPUs and only advance QEMU_CLOCK_VIRTUAL after some
* "real" time, (related to the time left until the next event) has
* passed. The QEMU_CLOCK_VIRTUAL_RT clock will do this.
* This avoids that the warps are visible externally; for example,
* you will not be sending network packets continuously instead of
* every 100ms.
*/
seqlock_write_lock(&timers_state.vm_clock_seqlock);
if (vm_clock_warp_start == -1 || vm_clock_warp_start > clock) {
vm_clock_warp_start = clock;
}
seqlock_write_unlock(&timers_state.vm_clock_seqlock);
timer_mod_anticipate(icount_warp_timer, clock + deadline);
}
} else if (deadline == 0) {
qemu_clock_notify(QEMU_CLOCK_VIRTUAL);
}
}
| false | qemu | efab87cf79077a9624f675fc5fc8f034eaedfe4d | void qemu_clock_warp(QEMUClockType type)
{
int64_t clock;
int64_t deadline;
if (type != QEMU_CLOCK_VIRTUAL || !use_icount) {
return;
}
if (icount_sleep) {
icount_warp_rt(NULL);
timer_del(icount_warp_timer);
}
if (!all_cpu_threads_idle()) {
return;
}
if (qtest_enabled()) {
return;
}
clock = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL_RT);
deadline = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL);
if (deadline < 0) {
static bool notified;
if (!icount_sleep && !notified) {
error_report("WARNING: icount sleep disabled and no active timers");
notified = true;
}
return;
}
if (deadline > 0) {
if (!icount_sleep) {
seqlock_write_lock(&timers_state.vm_clock_seqlock);
timers_state.qemu_icount_bias += deadline;
seqlock_write_unlock(&timers_state.vm_clock_seqlock);
qemu_clock_notify(QEMU_CLOCK_VIRTUAL);
} else {
seqlock_write_lock(&timers_state.vm_clock_seqlock);
if (vm_clock_warp_start == -1 || vm_clock_warp_start > clock) {
vm_clock_warp_start = clock;
}
seqlock_write_unlock(&timers_state.vm_clock_seqlock);
timer_mod_anticipate(icount_warp_timer, clock + deadline);
}
} else if (deadline == 0) {
qemu_clock_notify(QEMU_CLOCK_VIRTUAL);
}
}
| {
"code": [],
"line_no": []
} | void FUNC_0(QEMUClockType VAR_0)
{
int64_t clock;
int64_t deadline;
if (VAR_0 != QEMU_CLOCK_VIRTUAL || !use_icount) {
return;
}
if (icount_sleep) {
icount_warp_rt(NULL);
timer_del(icount_warp_timer);
}
if (!all_cpu_threads_idle()) {
return;
}
if (qtest_enabled()) {
return;
}
clock = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL_RT);
deadline = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL);
if (deadline < 0) {
static bool VAR_1;
if (!icount_sleep && !VAR_1) {
error_report("WARNING: icount sleep disabled and no active timers");
VAR_1 = true;
}
return;
}
if (deadline > 0) {
if (!icount_sleep) {
seqlock_write_lock(&timers_state.vm_clock_seqlock);
timers_state.qemu_icount_bias += deadline;
seqlock_write_unlock(&timers_state.vm_clock_seqlock);
qemu_clock_notify(QEMU_CLOCK_VIRTUAL);
} else {
seqlock_write_lock(&timers_state.vm_clock_seqlock);
if (vm_clock_warp_start == -1 || vm_clock_warp_start > clock) {
vm_clock_warp_start = clock;
}
seqlock_write_unlock(&timers_state.vm_clock_seqlock);
timer_mod_anticipate(icount_warp_timer, clock + deadline);
}
} else if (deadline == 0) {
qemu_clock_notify(QEMU_CLOCK_VIRTUAL);
}
}
| [
"void FUNC_0(QEMUClockType VAR_0)\n{",
"int64_t clock;",
"int64_t deadline;",
"if (VAR_0 != QEMU_CLOCK_VIRTUAL || !use_icount) {",
"return;",
"}",
"if (icount_sleep) {",
"icount_warp_rt(NULL);",
"timer_del(icount_warp_timer);",
"}",
"if (!all_cpu_threads_idle()) {",
"return;",
"}",
"if (qtest_enabled()) {",
"return;",
"}",
"clock = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL_RT);",
"deadline = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL);",
"if (deadline < 0) {",
"static bool VAR_1;",
"if (!icount_sleep && !VAR_1) {",
"error_report(\"WARNING: icount sleep disabled and no active timers\");",
"VAR_1 = true;",
"}",
"return;",
"}",
"if (deadline > 0) {",
"if (!icount_sleep) {",
"seqlock_write_lock(&timers_state.vm_clock_seqlock);",
"timers_state.qemu_icount_bias += deadline;",
"seqlock_write_unlock(&timers_state.vm_clock_seqlock);",
"qemu_clock_notify(QEMU_CLOCK_VIRTUAL);",
"} else {",
"seqlock_write_lock(&timers_state.vm_clock_seqlock);",
"if (vm_clock_warp_start == -1 || vm_clock_warp_start > clock) {",
"vm_clock_warp_start = clock;",
"}",
"seqlock_write_unlock(&timers_state.vm_clock_seqlock);",
"timer_mod_anticipate(icount_warp_timer, clock + deadline);",
"}",
"} else if (deadline == 0) {",
"qemu_clock_notify(QEMU_CLOCK_VIRTUAL);",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
21
],
[
23
],
[
25
],
[
29
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
61
],
[
65
],
[
67
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
95
],
[
111
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165
],
[
167
],
[
169
],
[
171
],
[
173
]
]
|
12,443 | static void report_unavailable_features(FeatureWord w, uint32_t mask)
{
FeatureWordInfo *f = &feature_word_info[w];
int i;
for (i = 0; i < 32; ++i) {
if ((1UL << i) & mask) {
const char *reg = get_register_name_32(f->cpuid_reg);
assert(reg);
fprintf(stderr, "warning: %s doesn't support requested feature: "
"CPUID.%02XH:%s%s%s [bit %d]\n",
kvm_enabled() ? "host" : "TCG",
f->cpuid_eax, reg,
f->feat_names[i] ? "." : "",
f->feat_names[i] ? f->feat_names[i] : "", i);
}
}
}
| false | qemu | 8297be80f7cf71e09617669a8bd8b2836dcfd4c3 | static void report_unavailable_features(FeatureWord w, uint32_t mask)
{
FeatureWordInfo *f = &feature_word_info[w];
int i;
for (i = 0; i < 32; ++i) {
if ((1UL << i) & mask) {
const char *reg = get_register_name_32(f->cpuid_reg);
assert(reg);
fprintf(stderr, "warning: %s doesn't support requested feature: "
"CPUID.%02XH:%s%s%s [bit %d]\n",
kvm_enabled() ? "host" : "TCG",
f->cpuid_eax, reg,
f->feat_names[i] ? "." : "",
f->feat_names[i] ? f->feat_names[i] : "", i);
}
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(FeatureWord VAR_0, uint32_t VAR_1)
{
FeatureWordInfo *f = &feature_word_info[VAR_0];
int VAR_2;
for (VAR_2 = 0; VAR_2 < 32; ++VAR_2) {
if ((1UL << VAR_2) & VAR_1) {
const char *VAR_3 = get_register_name_32(f->cpuid_reg);
assert(VAR_3);
fprintf(stderr, "warning: %s doesn't support requested feature: "
"CPUID.%02XH:%s%s%s [bit %d]\n",
kvm_enabled() ? "host" : "TCG",
f->cpuid_eax, VAR_3,
f->feat_names[VAR_2] ? "." : "",
f->feat_names[VAR_2] ? f->feat_names[VAR_2] : "", VAR_2);
}
}
}
| [
"static void FUNC_0(FeatureWord VAR_0, uint32_t VAR_1)\n{",
"FeatureWordInfo *f = &feature_word_info[VAR_0];",
"int VAR_2;",
"for (VAR_2 = 0; VAR_2 < 32; ++VAR_2) {",
"if ((1UL << VAR_2) & VAR_1) {",
"const char *VAR_3 = get_register_name_32(f->cpuid_reg);",
"assert(VAR_3);",
"fprintf(stderr, \"warning: %s doesn't support requested feature: \"\n\"CPUID.%02XH:%s%s%s [bit %d]\\n\",\nkvm_enabled() ? \"host\" : \"TCG\",\nf->cpuid_eax, VAR_3,\nf->feat_names[VAR_2] ? \".\" : \"\",\nf->feat_names[VAR_2] ? f->feat_names[VAR_2] : \"\", VAR_2);",
"}",
"}",
"}"
]
| [
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
]
]
|
12,444 | static int nbd_receive_option_reply(QIOChannel *ioc, uint32_t opt,
nbd_opt_reply *reply, Error **errp)
{
QEMU_BUILD_BUG_ON(sizeof(*reply) != 20);
if (nbd_read(ioc, reply, sizeof(*reply), errp) < 0) {
error_prepend(errp, "failed to read option reply");
nbd_send_opt_abort(ioc);
return -1;
}
be64_to_cpus(&reply->magic);
be32_to_cpus(&reply->option);
be32_to_cpus(&reply->type);
be32_to_cpus(&reply->length);
trace_nbd_receive_option_reply(reply->option, reply->type, reply->length);
if (reply->magic != NBD_REP_MAGIC) {
error_setg(errp, "Unexpected option reply magic");
nbd_send_opt_abort(ioc);
return -1;
}
if (reply->option != opt) {
error_setg(errp, "Unexpected option type %x expected %x",
reply->option, opt);
nbd_send_opt_abort(ioc);
return -1;
}
return 0;
}
| false | qemu | 3736cc5be31f0399999e37d8b28ca9a3ed0b4ccb | static int nbd_receive_option_reply(QIOChannel *ioc, uint32_t opt,
nbd_opt_reply *reply, Error **errp)
{
QEMU_BUILD_BUG_ON(sizeof(*reply) != 20);
if (nbd_read(ioc, reply, sizeof(*reply), errp) < 0) {
error_prepend(errp, "failed to read option reply");
nbd_send_opt_abort(ioc);
return -1;
}
be64_to_cpus(&reply->magic);
be32_to_cpus(&reply->option);
be32_to_cpus(&reply->type);
be32_to_cpus(&reply->length);
trace_nbd_receive_option_reply(reply->option, reply->type, reply->length);
if (reply->magic != NBD_REP_MAGIC) {
error_setg(errp, "Unexpected option reply magic");
nbd_send_opt_abort(ioc);
return -1;
}
if (reply->option != opt) {
error_setg(errp, "Unexpected option type %x expected %x",
reply->option, opt);
nbd_send_opt_abort(ioc);
return -1;
}
return 0;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(QIOChannel *VAR_0, uint32_t VAR_1,
nbd_opt_reply *VAR_2, Error **VAR_3)
{
QEMU_BUILD_BUG_ON(sizeof(*VAR_2) != 20);
if (nbd_read(VAR_0, VAR_2, sizeof(*VAR_2), VAR_3) < 0) {
error_prepend(VAR_3, "failed to read option VAR_2");
nbd_send_opt_abort(VAR_0);
return -1;
}
be64_to_cpus(&VAR_2->magic);
be32_to_cpus(&VAR_2->option);
be32_to_cpus(&VAR_2->type);
be32_to_cpus(&VAR_2->length);
trace_nbd_receive_option_reply(VAR_2->option, VAR_2->type, VAR_2->length);
if (VAR_2->magic != NBD_REP_MAGIC) {
error_setg(VAR_3, "Unexpected option VAR_2 magic");
nbd_send_opt_abort(VAR_0);
return -1;
}
if (VAR_2->option != VAR_1) {
error_setg(VAR_3, "Unexpected option type %x expected %x",
VAR_2->option, VAR_1);
nbd_send_opt_abort(VAR_0);
return -1;
}
return 0;
}
| [
"static int FUNC_0(QIOChannel *VAR_0, uint32_t VAR_1,\nnbd_opt_reply *VAR_2, Error **VAR_3)\n{",
"QEMU_BUILD_BUG_ON(sizeof(*VAR_2) != 20);",
"if (nbd_read(VAR_0, VAR_2, sizeof(*VAR_2), VAR_3) < 0) {",
"error_prepend(VAR_3, \"failed to read option VAR_2\");",
"nbd_send_opt_abort(VAR_0);",
"return -1;",
"}",
"be64_to_cpus(&VAR_2->magic);",
"be32_to_cpus(&VAR_2->option);",
"be32_to_cpus(&VAR_2->type);",
"be32_to_cpus(&VAR_2->length);",
"trace_nbd_receive_option_reply(VAR_2->option, VAR_2->type, VAR_2->length);",
"if (VAR_2->magic != NBD_REP_MAGIC) {",
"error_setg(VAR_3, \"Unexpected option VAR_2 magic\");",
"nbd_send_opt_abort(VAR_0);",
"return -1;",
"}",
"if (VAR_2->option != VAR_1) {",
"error_setg(VAR_3, \"Unexpected option type %x expected %x\",\nVAR_2->option, VAR_1);",
"nbd_send_opt_abort(VAR_0);",
"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
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
29
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45,
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
]
]
|
12,445 | void omap_badwidth_write8(void *opaque, target_phys_addr_t addr,
uint32_t value)
{
uint8_t val8 = value;
OMAP_8B_REG(addr);
cpu_physical_memory_write(addr, (void *) &val8, 1);
}
| false | qemu | a8170e5e97ad17ca169c64ba87ae2f53850dab4c | void omap_badwidth_write8(void *opaque, target_phys_addr_t addr,
uint32_t value)
{
uint8_t val8 = value;
OMAP_8B_REG(addr);
cpu_physical_memory_write(addr, (void *) &val8, 1);
}
| {
"code": [],
"line_no": []
} | void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,
uint32_t VAR_2)
{
uint8_t val8 = VAR_2;
OMAP_8B_REG(VAR_1);
cpu_physical_memory_write(VAR_1, (void *) &val8, 1);
}
| [
"void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint32_t VAR_2)\n{",
"uint8_t val8 = VAR_2;",
"OMAP_8B_REG(VAR_1);",
"cpu_physical_memory_write(VAR_1, (void *) &val8, 1);",
"}"
]
| [
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
11
],
[
13
],
[
15
]
]
|
12,447 | static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon,
const char *devaddr,
const char *opts)
{
PCIDevice *dev;
DriveInfo *dinfo = NULL;
int type = -1;
char buf[128];
if (get_param_value(buf, sizeof(buf), "if", opts)) {
if (!strcmp(buf, "scsi"))
type = IF_SCSI;
else if (!strcmp(buf, "virtio")) {
type = IF_VIRTIO;
} else {
monitor_printf(mon, "type %s not a hotpluggable PCI device.\n", buf);
return NULL;
}
} else {
monitor_printf(mon, "no if= specified\n");
return NULL;
}
if (get_param_value(buf, sizeof(buf), "file", opts)) {
dinfo = add_init_drive(opts);
if (!dinfo)
return NULL;
if (dinfo->devaddr) {
monitor_printf(mon, "Parameter addr not supported\n");
return NULL;
}
} else {
dinfo = NULL;
}
switch (type) {
case IF_SCSI:
dev = pci_create("lsi53c895a", devaddr);
break;
case IF_VIRTIO:
if (!dinfo) {
monitor_printf(mon, "virtio requires a backing file/device.\n");
return NULL;
}
dev = pci_create("virtio-blk-pci", devaddr);
qdev_prop_set_drive(&dev->qdev, "drive", dinfo);
break;
default:
dev = NULL;
}
if (dev)
qdev_init(&dev->qdev);
return dev;
}
| false | qemu | 49bd1458da8909434eb83c5cda472c63ff6a529c | static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon,
const char *devaddr,
const char *opts)
{
PCIDevice *dev;
DriveInfo *dinfo = NULL;
int type = -1;
char buf[128];
if (get_param_value(buf, sizeof(buf), "if", opts)) {
if (!strcmp(buf, "scsi"))
type = IF_SCSI;
else if (!strcmp(buf, "virtio")) {
type = IF_VIRTIO;
} else {
monitor_printf(mon, "type %s not a hotpluggable PCI device.\n", buf);
return NULL;
}
} else {
monitor_printf(mon, "no if= specified\n");
return NULL;
}
if (get_param_value(buf, sizeof(buf), "file", opts)) {
dinfo = add_init_drive(opts);
if (!dinfo)
return NULL;
if (dinfo->devaddr) {
monitor_printf(mon, "Parameter addr not supported\n");
return NULL;
}
} else {
dinfo = NULL;
}
switch (type) {
case IF_SCSI:
dev = pci_create("lsi53c895a", devaddr);
break;
case IF_VIRTIO:
if (!dinfo) {
monitor_printf(mon, "virtio requires a backing file/device.\n");
return NULL;
}
dev = pci_create("virtio-blk-pci", devaddr);
qdev_prop_set_drive(&dev->qdev, "drive", dinfo);
break;
default:
dev = NULL;
}
if (dev)
qdev_init(&dev->qdev);
return dev;
}
| {
"code": [],
"line_no": []
} | static PCIDevice *FUNC_0(Monitor *mon,
const char *devaddr,
const char *opts)
{
PCIDevice *dev;
DriveInfo *dinfo = NULL;
int VAR_0 = -1;
char VAR_1[128];
if (get_param_value(VAR_1, sizeof(VAR_1), "if", opts)) {
if (!strcmp(VAR_1, "scsi"))
VAR_0 = IF_SCSI;
else if (!strcmp(VAR_1, "virtio")) {
VAR_0 = IF_VIRTIO;
} else {
monitor_printf(mon, "VAR_0 %s not a hotpluggable PCI device.\n", VAR_1);
return NULL;
}
} else {
monitor_printf(mon, "no if= specified\n");
return NULL;
}
if (get_param_value(VAR_1, sizeof(VAR_1), "file", opts)) {
dinfo = add_init_drive(opts);
if (!dinfo)
return NULL;
if (dinfo->devaddr) {
monitor_printf(mon, "Parameter addr not supported\n");
return NULL;
}
} else {
dinfo = NULL;
}
switch (VAR_0) {
case IF_SCSI:
dev = pci_create("lsi53c895a", devaddr);
break;
case IF_VIRTIO:
if (!dinfo) {
monitor_printf(mon, "virtio requires a backing file/device.\n");
return NULL;
}
dev = pci_create("virtio-blk-pci", devaddr);
qdev_prop_set_drive(&dev->qdev, "drive", dinfo);
break;
default:
dev = NULL;
}
if (dev)
qdev_init(&dev->qdev);
return dev;
}
| [
"static PCIDevice *FUNC_0(Monitor *mon,\nconst char *devaddr,\nconst char *opts)\n{",
"PCIDevice *dev;",
"DriveInfo *dinfo = NULL;",
"int VAR_0 = -1;",
"char VAR_1[128];",
"if (get_param_value(VAR_1, sizeof(VAR_1), \"if\", opts)) {",
"if (!strcmp(VAR_1, \"scsi\"))\nVAR_0 = IF_SCSI;",
"else if (!strcmp(VAR_1, \"virtio\")) {",
"VAR_0 = IF_VIRTIO;",
"} else {",
"monitor_printf(mon, \"VAR_0 %s not a hotpluggable PCI device.\\n\", VAR_1);",
"return NULL;",
"}",
"} else {",
"monitor_printf(mon, \"no if= specified\\n\");",
"return NULL;",
"}",
"if (get_param_value(VAR_1, sizeof(VAR_1), \"file\", opts)) {",
"dinfo = add_init_drive(opts);",
"if (!dinfo)\nreturn NULL;",
"if (dinfo->devaddr) {",
"monitor_printf(mon, \"Parameter addr not supported\\n\");",
"return NULL;",
"}",
"} else {",
"dinfo = NULL;",
"}",
"switch (VAR_0) {",
"case IF_SCSI:\ndev = pci_create(\"lsi53c895a\", devaddr);",
"break;",
"case IF_VIRTIO:\nif (!dinfo) {",
"monitor_printf(mon, \"virtio requires a backing file/device.\\n\");",
"return NULL;",
"}",
"dev = pci_create(\"virtio-blk-pci\", devaddr);",
"qdev_prop_set_drive(&dev->qdev, \"drive\", dinfo);",
"break;",
"default:\ndev = NULL;",
"}",
"if (dev)\nqdev_init(&dev->qdev);",
"return dev;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5,
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21,
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
47
],
[
49
],
[
51,
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
71
],
[
73,
75
],
[
77
],
[
79,
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95,
97
],
[
99
],
[
101,
103
],
[
105
],
[
107
]
]
|
12,448 | static inline void clear_float_exceptions(CPUSPARCState *env)
{
set_float_exception_flags(0, &env->fp_status);
}
| false | qemu | 7385aed20db5d83979f683b9d0048674411e963c | static inline void clear_float_exceptions(CPUSPARCState *env)
{
set_float_exception_flags(0, &env->fp_status);
}
| {
"code": [],
"line_no": []
} | static inline void FUNC_0(CPUSPARCState *VAR_0)
{
set_float_exception_flags(0, &VAR_0->fp_status);
}
| [
"static inline void FUNC_0(CPUSPARCState *VAR_0)\n{",
"set_float_exception_flags(0, &VAR_0->fp_status);",
"}"
]
| [
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
]
]
|
12,449 | void helper_ldxfsr(CPUSPARCState *env, uint64_t new_fsr)
{
env->fsr = (new_fsr & FSR_LDXFSR_MASK) | (env->fsr & FSR_LDXFSR_OLDMASK);
set_fsr(env);
}
| false | qemu | 7385aed20db5d83979f683b9d0048674411e963c | void helper_ldxfsr(CPUSPARCState *env, uint64_t new_fsr)
{
env->fsr = (new_fsr & FSR_LDXFSR_MASK) | (env->fsr & FSR_LDXFSR_OLDMASK);
set_fsr(env);
}
| {
"code": [],
"line_no": []
} | void FUNC_0(CPUSPARCState *VAR_0, uint64_t VAR_1)
{
VAR_0->fsr = (VAR_1 & FSR_LDXFSR_MASK) | (VAR_0->fsr & FSR_LDXFSR_OLDMASK);
set_fsr(VAR_0);
}
| [
"void FUNC_0(CPUSPARCState *VAR_0, uint64_t VAR_1)\n{",
"VAR_0->fsr = (VAR_1 & FSR_LDXFSR_MASK) | (VAR_0->fsr & FSR_LDXFSR_OLDMASK);",
"set_fsr(VAR_0);",
"}"
]
| [
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
]
]
|
12,450 | static void apply_motion_4x4(RoqContext *ri, int x, int y, unsigned char mv,
signed char mean_x, signed char mean_y)
{
int i, hw, mx, my;
unsigned char *pa, *pb;
mx = x + 8 - (mv >> 4) - mean_x;
my = y + 8 - (mv & 0xf) - mean_y;
pa = ri->current_frame.data[0] + (y * ri->y_stride) + x;
pb = ri->last_frame.data[0] + (my * ri->y_stride) + mx;
for(i = 0; i < 4; i++) {
pa[0] = pb[0];
pa[1] = pb[1];
pa[2] = pb[2];
pa[3] = pb[3];
pa += ri->y_stride;
pb += ri->y_stride;
}
#if 0
pa = ri->current_frame.data[1] + (y/2) * (ri->c_stride) + x/2;
pb = ri->last_frame.data[1] + (my/2) * (ri->c_stride) + (mx + 1)/2;
for(i = 0; i < 2; i++) {
pa[0] = pb[0];
pa[1] = pb[1];
pa += ri->c_stride;
pb += ri->c_stride;
}
pa = ri->current_frame.data[2] + (y/2) * (ri->c_stride) + x/2;
pb = ri->last_frame.data[2] + (my/2) * (ri->c_stride) + (mx + 1)/2;
for(i = 0; i < 2; i++) {
pa[0] = pb[0];
pa[1] = pb[1];
pa += ri->c_stride;
pb += ri->c_stride;
}
#else
hw = ri->y_stride/2;
pa = ri->current_frame.data[1] + (y * ri->y_stride)/4 + x/2;
pb = ri->last_frame.data[1] + (my/2) * (ri->y_stride/2) + (mx + 1)/2;
for(i = 0; i < 2; i++) {
switch(((my & 0x01) << 1) | (mx & 0x01)) {
case 0:
pa[0] = pb[0];
pa[1] = pb[1];
pa[hw] = pb[hw];
pa[hw+1] = pb[hw+1];
break;
case 1:
pa[0] = avg2(pb[0], pb[1]);
pa[1] = avg2(pb[1], pb[2]);
pa[hw] = avg2(pb[hw], pb[hw+1]);
pa[hw+1] = avg2(pb[hw+1], pb[hw+2]);
break;
case 2:
pa[0] = avg2(pb[0], pb[hw]);
pa[1] = avg2(pb[1], pb[hw+1]);
pa[hw] = avg2(pb[hw], pb[hw*2]);
pa[hw+1] = avg2(pb[hw+1], pb[(hw*2)+1]);
break;
case 3:
pa[0] = avg4(pb[0], pb[1], pb[hw], pb[hw+1]);
pa[1] = avg4(pb[1], pb[2], pb[hw+1], pb[hw+2]);
pa[hw] = avg4(pb[hw], pb[hw+1], pb[hw*2], pb[(hw*2)+1]);
pa[hw+1] = avg4(pb[hw+1], pb[hw+2], pb[(hw*2)+1], pb[(hw*2)+1]);
break;
}
pa = ri->current_frame.data[2] + (y * ri->y_stride)/4 + x/2;
pb = ri->last_frame.data[2] + (my/2) * (ri->y_stride/2) + (mx + 1)/2;
}
#endif
}
| false | FFmpeg | b9029997d4694b6533556480fe0ab1f3f9779a56 | static void apply_motion_4x4(RoqContext *ri, int x, int y, unsigned char mv,
signed char mean_x, signed char mean_y)
{
int i, hw, mx, my;
unsigned char *pa, *pb;
mx = x + 8 - (mv >> 4) - mean_x;
my = y + 8 - (mv & 0xf) - mean_y;
pa = ri->current_frame.data[0] + (y * ri->y_stride) + x;
pb = ri->last_frame.data[0] + (my * ri->y_stride) + mx;
for(i = 0; i < 4; i++) {
pa[0] = pb[0];
pa[1] = pb[1];
pa[2] = pb[2];
pa[3] = pb[3];
pa += ri->y_stride;
pb += ri->y_stride;
}
#if 0
pa = ri->current_frame.data[1] + (y/2) * (ri->c_stride) + x/2;
pb = ri->last_frame.data[1] + (my/2) * (ri->c_stride) + (mx + 1)/2;
for(i = 0; i < 2; i++) {
pa[0] = pb[0];
pa[1] = pb[1];
pa += ri->c_stride;
pb += ri->c_stride;
}
pa = ri->current_frame.data[2] + (y/2) * (ri->c_stride) + x/2;
pb = ri->last_frame.data[2] + (my/2) * (ri->c_stride) + (mx + 1)/2;
for(i = 0; i < 2; i++) {
pa[0] = pb[0];
pa[1] = pb[1];
pa += ri->c_stride;
pb += ri->c_stride;
}
#else
hw = ri->y_stride/2;
pa = ri->current_frame.data[1] + (y * ri->y_stride)/4 + x/2;
pb = ri->last_frame.data[1] + (my/2) * (ri->y_stride/2) + (mx + 1)/2;
for(i = 0; i < 2; i++) {
switch(((my & 0x01) << 1) | (mx & 0x01)) {
case 0:
pa[0] = pb[0];
pa[1] = pb[1];
pa[hw] = pb[hw];
pa[hw+1] = pb[hw+1];
break;
case 1:
pa[0] = avg2(pb[0], pb[1]);
pa[1] = avg2(pb[1], pb[2]);
pa[hw] = avg2(pb[hw], pb[hw+1]);
pa[hw+1] = avg2(pb[hw+1], pb[hw+2]);
break;
case 2:
pa[0] = avg2(pb[0], pb[hw]);
pa[1] = avg2(pb[1], pb[hw+1]);
pa[hw] = avg2(pb[hw], pb[hw*2]);
pa[hw+1] = avg2(pb[hw+1], pb[(hw*2)+1]);
break;
case 3:
pa[0] = avg4(pb[0], pb[1], pb[hw], pb[hw+1]);
pa[1] = avg4(pb[1], pb[2], pb[hw+1], pb[hw+2]);
pa[hw] = avg4(pb[hw], pb[hw+1], pb[hw*2], pb[(hw*2)+1]);
pa[hw+1] = avg4(pb[hw+1], pb[hw+2], pb[(hw*2)+1], pb[(hw*2)+1]);
break;
}
pa = ri->current_frame.data[2] + (y * ri->y_stride)/4 + x/2;
pb = ri->last_frame.data[2] + (my/2) * (ri->y_stride/2) + (mx + 1)/2;
}
#endif
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(RoqContext *VAR_0, int VAR_1, int VAR_2, unsigned char VAR_3,
signed char VAR_4, signed char VAR_5)
{
int VAR_6, VAR_7, VAR_8, VAR_9;
unsigned char *VAR_10, *VAR_11;
VAR_8 = VAR_1 + 8 - (VAR_3 >> 4) - VAR_4;
VAR_9 = VAR_2 + 8 - (VAR_3 & 0xf) - VAR_5;
VAR_10 = VAR_0->current_frame.data[0] + (VAR_2 * VAR_0->y_stride) + VAR_1;
VAR_11 = VAR_0->last_frame.data[0] + (VAR_9 * VAR_0->y_stride) + VAR_8;
for(VAR_6 = 0; VAR_6 < 4; VAR_6++) {
VAR_10[0] = VAR_11[0];
VAR_10[1] = VAR_11[1];
VAR_10[2] = VAR_11[2];
VAR_10[3] = VAR_11[3];
VAR_10 += VAR_0->y_stride;
VAR_11 += VAR_0->y_stride;
}
#if 0
VAR_10 = VAR_0->current_frame.data[1] + (VAR_2/2) * (VAR_0->c_stride) + VAR_1/2;
VAR_11 = VAR_0->last_frame.data[1] + (VAR_9/2) * (VAR_0->c_stride) + (VAR_8 + 1)/2;
for(VAR_6 = 0; VAR_6 < 2; VAR_6++) {
VAR_10[0] = VAR_11[0];
VAR_10[1] = VAR_11[1];
VAR_10 += VAR_0->c_stride;
VAR_11 += VAR_0->c_stride;
}
VAR_10 = VAR_0->current_frame.data[2] + (VAR_2/2) * (VAR_0->c_stride) + VAR_1/2;
VAR_11 = VAR_0->last_frame.data[2] + (VAR_9/2) * (VAR_0->c_stride) + (VAR_8 + 1)/2;
for(VAR_6 = 0; VAR_6 < 2; VAR_6++) {
VAR_10[0] = VAR_11[0];
VAR_10[1] = VAR_11[1];
VAR_10 += VAR_0->c_stride;
VAR_11 += VAR_0->c_stride;
}
#else
VAR_7 = VAR_0->y_stride/2;
VAR_10 = VAR_0->current_frame.data[1] + (VAR_2 * VAR_0->y_stride)/4 + VAR_1/2;
VAR_11 = VAR_0->last_frame.data[1] + (VAR_9/2) * (VAR_0->y_stride/2) + (VAR_8 + 1)/2;
for(VAR_6 = 0; VAR_6 < 2; VAR_6++) {
switch(((VAR_9 & 0x01) << 1) | (VAR_8 & 0x01)) {
case 0:
VAR_10[0] = VAR_11[0];
VAR_10[1] = VAR_11[1];
VAR_10[VAR_7] = VAR_11[VAR_7];
VAR_10[VAR_7+1] = VAR_11[VAR_7+1];
break;
case 1:
VAR_10[0] = avg2(VAR_11[0], VAR_11[1]);
VAR_10[1] = avg2(VAR_11[1], VAR_11[2]);
VAR_10[VAR_7] = avg2(VAR_11[VAR_7], VAR_11[VAR_7+1]);
VAR_10[VAR_7+1] = avg2(VAR_11[VAR_7+1], VAR_11[VAR_7+2]);
break;
case 2:
VAR_10[0] = avg2(VAR_11[0], VAR_11[VAR_7]);
VAR_10[1] = avg2(VAR_11[1], VAR_11[VAR_7+1]);
VAR_10[VAR_7] = avg2(VAR_11[VAR_7], VAR_11[VAR_7*2]);
VAR_10[VAR_7+1] = avg2(VAR_11[VAR_7+1], VAR_11[(VAR_7*2)+1]);
break;
case 3:
VAR_10[0] = avg4(VAR_11[0], VAR_11[1], VAR_11[VAR_7], VAR_11[VAR_7+1]);
VAR_10[1] = avg4(VAR_11[1], VAR_11[2], VAR_11[VAR_7+1], VAR_11[VAR_7+2]);
VAR_10[VAR_7] = avg4(VAR_11[VAR_7], VAR_11[VAR_7+1], VAR_11[VAR_7*2], VAR_11[(VAR_7*2)+1]);
VAR_10[VAR_7+1] = avg4(VAR_11[VAR_7+1], VAR_11[VAR_7+2], VAR_11[(VAR_7*2)+1], VAR_11[(VAR_7*2)+1]);
break;
}
VAR_10 = VAR_0->current_frame.data[2] + (VAR_2 * VAR_0->y_stride)/4 + VAR_1/2;
VAR_11 = VAR_0->last_frame.data[2] + (VAR_9/2) * (VAR_0->y_stride/2) + (VAR_8 + 1)/2;
}
#endif
}
| [
"static void FUNC_0(RoqContext *VAR_0, int VAR_1, int VAR_2, unsigned char VAR_3,\nsigned char VAR_4, signed char VAR_5)\n{",
"int VAR_6, VAR_7, VAR_8, VAR_9;",
"unsigned char *VAR_10, *VAR_11;",
"VAR_8 = VAR_1 + 8 - (VAR_3 >> 4) - VAR_4;",
"VAR_9 = VAR_2 + 8 - (VAR_3 & 0xf) - VAR_5;",
"VAR_10 = VAR_0->current_frame.data[0] + (VAR_2 * VAR_0->y_stride) + VAR_1;",
"VAR_11 = VAR_0->last_frame.data[0] + (VAR_9 * VAR_0->y_stride) + VAR_8;",
"for(VAR_6 = 0; VAR_6 < 4; VAR_6++) {",
"VAR_10[0] = VAR_11[0];",
"VAR_10[1] = VAR_11[1];",
"VAR_10[2] = VAR_11[2];",
"VAR_10[3] = VAR_11[3];",
"VAR_10 += VAR_0->y_stride;",
"VAR_11 += VAR_0->y_stride;",
"}",
"#if 0\nVAR_10 = VAR_0->current_frame.data[1] + (VAR_2/2) * (VAR_0->c_stride) + VAR_1/2;",
"VAR_11 = VAR_0->last_frame.data[1] + (VAR_9/2) * (VAR_0->c_stride) + (VAR_8 + 1)/2;",
"for(VAR_6 = 0; VAR_6 < 2; VAR_6++) {",
"VAR_10[0] = VAR_11[0];",
"VAR_10[1] = VAR_11[1];",
"VAR_10 += VAR_0->c_stride;",
"VAR_11 += VAR_0->c_stride;",
"}",
"VAR_10 = VAR_0->current_frame.data[2] + (VAR_2/2) * (VAR_0->c_stride) + VAR_1/2;",
"VAR_11 = VAR_0->last_frame.data[2] + (VAR_9/2) * (VAR_0->c_stride) + (VAR_8 + 1)/2;",
"for(VAR_6 = 0; VAR_6 < 2; VAR_6++) {",
"VAR_10[0] = VAR_11[0];",
"VAR_10[1] = VAR_11[1];",
"VAR_10 += VAR_0->c_stride;",
"VAR_11 += VAR_0->c_stride;",
"}",
"#else\nVAR_7 = VAR_0->y_stride/2;",
"VAR_10 = VAR_0->current_frame.data[1] + (VAR_2 * VAR_0->y_stride)/4 + VAR_1/2;",
"VAR_11 = VAR_0->last_frame.data[1] + (VAR_9/2) * (VAR_0->y_stride/2) + (VAR_8 + 1)/2;",
"for(VAR_6 = 0; VAR_6 < 2; VAR_6++) {",
"switch(((VAR_9 & 0x01) << 1) | (VAR_8 & 0x01)) {",
"case 0:\nVAR_10[0] = VAR_11[0];",
"VAR_10[1] = VAR_11[1];",
"VAR_10[VAR_7] = VAR_11[VAR_7];",
"VAR_10[VAR_7+1] = VAR_11[VAR_7+1];",
"break;",
"case 1:\nVAR_10[0] = avg2(VAR_11[0], VAR_11[1]);",
"VAR_10[1] = avg2(VAR_11[1], VAR_11[2]);",
"VAR_10[VAR_7] = avg2(VAR_11[VAR_7], VAR_11[VAR_7+1]);",
"VAR_10[VAR_7+1] = avg2(VAR_11[VAR_7+1], VAR_11[VAR_7+2]);",
"break;",
"case 2:\nVAR_10[0] = avg2(VAR_11[0], VAR_11[VAR_7]);",
"VAR_10[1] = avg2(VAR_11[1], VAR_11[VAR_7+1]);",
"VAR_10[VAR_7] = avg2(VAR_11[VAR_7], VAR_11[VAR_7*2]);",
"VAR_10[VAR_7+1] = avg2(VAR_11[VAR_7+1], VAR_11[(VAR_7*2)+1]);",
"break;",
"case 3:\nVAR_10[0] = avg4(VAR_11[0], VAR_11[1], VAR_11[VAR_7], VAR_11[VAR_7+1]);",
"VAR_10[1] = avg4(VAR_11[1], VAR_11[2], VAR_11[VAR_7+1], VAR_11[VAR_7+2]);",
"VAR_10[VAR_7] = avg4(VAR_11[VAR_7], VAR_11[VAR_7+1], VAR_11[VAR_7*2], VAR_11[(VAR_7*2)+1]);",
"VAR_10[VAR_7+1] = avg4(VAR_11[VAR_7+1], VAR_11[VAR_7+2], VAR_11[(VAR_7*2)+1], VAR_11[(VAR_7*2)+1]);",
"break;",
"}",
"VAR_10 = VAR_0->current_frame.data[2] + (VAR_2 * VAR_0->y_stride)/4 + VAR_1/2;",
"VAR_11 = VAR_0->last_frame.data[2] + (VAR_9/2) * (VAR_0->y_stride/2) + (VAR_8 + 1)/2;",
"}",
"#endif\n}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
41,
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77,
79
],
[
81
],
[
83
],
[
87
],
[
89
],
[
93,
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
107,
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
121,
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
135,
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
151
],
[
153
],
[
155
],
[
157,
159
]
]
|
12,453 | static void pty_chr_update_read_handler(CharDriverState *chr)
{
PtyCharDriver *s = chr->opaque;
GPollFD pfd;
pfd.fd = g_io_channel_unix_get_fd(s->fd);
pfd.events = G_IO_OUT;
pfd.revents = 0;
g_poll(&pfd, 1, 0);
if (pfd.revents & G_IO_HUP) {
pty_chr_state(chr, 0);
} else {
pty_chr_state(chr, 1);
}
}
| false | qemu | 9005b2a7589540a3733b3abdcfbccfe7746cd1a1 | static void pty_chr_update_read_handler(CharDriverState *chr)
{
PtyCharDriver *s = chr->opaque;
GPollFD pfd;
pfd.fd = g_io_channel_unix_get_fd(s->fd);
pfd.events = G_IO_OUT;
pfd.revents = 0;
g_poll(&pfd, 1, 0);
if (pfd.revents & G_IO_HUP) {
pty_chr_state(chr, 0);
} else {
pty_chr_state(chr, 1);
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(CharDriverState *VAR_0)
{
PtyCharDriver *s = VAR_0->opaque;
GPollFD pfd;
pfd.fd = g_io_channel_unix_get_fd(s->fd);
pfd.events = G_IO_OUT;
pfd.revents = 0;
g_poll(&pfd, 1, 0);
if (pfd.revents & G_IO_HUP) {
pty_chr_state(VAR_0, 0);
} else {
pty_chr_state(VAR_0, 1);
}
}
| [
"static void FUNC_0(CharDriverState *VAR_0)\n{",
"PtyCharDriver *s = VAR_0->opaque;",
"GPollFD pfd;",
"pfd.fd = g_io_channel_unix_get_fd(s->fd);",
"pfd.events = G_IO_OUT;",
"pfd.revents = 0;",
"g_poll(&pfd, 1, 0);",
"if (pfd.revents & G_IO_HUP) {",
"pty_chr_state(VAR_0, 0);",
"} else {",
"pty_chr_state(VAR_0, 1);",
"}",
"}"
]
| [
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
]
]
|
12,454 | static int protocol_client_vencrypt_auth(VncState *vs, uint8_t *data, size_t len)
{
int auth = read_u32(data, 0);
if (auth != vs->vd->subauth) {
VNC_DEBUG("Rejecting auth %d\n", auth);
vnc_write_u8(vs, 0); /* Reject auth */
vnc_flush(vs);
vnc_client_error(vs);
} else {
VNC_DEBUG("Accepting auth %d, starting handshake\n", auth);
vnc_write_u8(vs, 1); /* Accept auth */
vnc_flush(vs);
if (vnc_start_tls(vs) < 0) {
VNC_DEBUG("Failed to complete TLS\n");
return 0;
}
if (vs->wiremode == VNC_WIREMODE_TLS) {
VNC_DEBUG("Starting VeNCrypt subauth\n");
return start_auth_vencrypt_subauth(vs);
} else {
VNC_DEBUG("TLS handshake blocked\n");
return 0;
}
}
return 0;
}
| true | qemu | adc5ec856c557f75adc60b310e5b1d38210a289c | static int protocol_client_vencrypt_auth(VncState *vs, uint8_t *data, size_t len)
{
int auth = read_u32(data, 0);
if (auth != vs->vd->subauth) {
VNC_DEBUG("Rejecting auth %d\n", auth);
vnc_write_u8(vs, 0);
vnc_flush(vs);
vnc_client_error(vs);
} else {
VNC_DEBUG("Accepting auth %d, starting handshake\n", auth);
vnc_write_u8(vs, 1);
vnc_flush(vs);
if (vnc_start_tls(vs) < 0) {
VNC_DEBUG("Failed to complete TLS\n");
return 0;
}
if (vs->wiremode == VNC_WIREMODE_TLS) {
VNC_DEBUG("Starting VeNCrypt subauth\n");
return start_auth_vencrypt_subauth(vs);
} else {
VNC_DEBUG("TLS handshake blocked\n");
return 0;
}
}
return 0;
}
| {
"code": [
"\tif (vs->wiremode == VNC_WIREMODE_TLS) {",
"\t VNC_DEBUG(\"Starting VeNCrypt subauth\\n\");",
"\t return start_auth_vencrypt_subauth(vs);",
"\t} else {",
"\t VNC_DEBUG(\"TLS handshake blocked\\n\");",
"\t return 0;"
],
"line_no": [
39,
41,
43,
45,
47,
33
]
} | static int FUNC_0(VncState *VAR_0, uint8_t *VAR_1, size_t VAR_2)
{
int VAR_3 = read_u32(VAR_1, 0);
if (VAR_3 != VAR_0->vd->subauth) {
VNC_DEBUG("Rejecting VAR_3 %d\n", VAR_3);
vnc_write_u8(VAR_0, 0);
vnc_flush(VAR_0);
vnc_client_error(VAR_0);
} else {
VNC_DEBUG("Accepting VAR_3 %d, starting handshake\n", VAR_3);
vnc_write_u8(VAR_0, 1);
vnc_flush(VAR_0);
if (vnc_start_tls(VAR_0) < 0) {
VNC_DEBUG("Failed to complete TLS\n");
return 0;
}
if (VAR_0->wiremode == VNC_WIREMODE_TLS) {
VNC_DEBUG("Starting VeNCrypt subauth\n");
return start_auth_vencrypt_subauth(VAR_0);
} else {
VNC_DEBUG("TLS handshake blocked\n");
return 0;
}
}
return 0;
}
| [
"static int FUNC_0(VncState *VAR_0, uint8_t *VAR_1, size_t VAR_2)\n{",
"int VAR_3 = read_u32(VAR_1, 0);",
"if (VAR_3 != VAR_0->vd->subauth) {",
"VNC_DEBUG(\"Rejecting VAR_3 %d\\n\", VAR_3);",
"vnc_write_u8(VAR_0, 0);",
"vnc_flush(VAR_0);",
"vnc_client_error(VAR_0);",
"} else {",
"VNC_DEBUG(\"Accepting VAR_3 %d, starting handshake\\n\", VAR_3);",
"vnc_write_u8(VAR_0, 1);",
"vnc_flush(VAR_0);",
"if (vnc_start_tls(VAR_0) < 0) {",
"VNC_DEBUG(\"Failed to complete TLS\\n\");",
"return 0;",
"}",
"if (VAR_0->wiremode == VNC_WIREMODE_TLS) {",
"VNC_DEBUG(\"Starting VeNCrypt subauth\\n\");",
"return start_auth_vencrypt_subauth(VAR_0);",
"} else {",
"VNC_DEBUG(\"TLS handshake blocked\\n\");",
"return 0;",
"}",
"}",
"return 0;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
1,
1,
1,
0,
1,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
29
],
[
31
],
[
33
],
[
35
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
]
]
|
12,455 | static int ata_passthrough_16_xfer_size(SCSIDevice *dev, uint8_t *buf)
{
int extend = buf[1] & 0x1;
int length = buf[2] & 0x3;
int xfer;
int unit = ata_passthrough_xfer_unit(dev, buf);
switch (length) {
case 0:
case 3: /* USB-specific. */
xfer = 0;
break;
case 1:
xfer = buf[4];
xfer |= (extend ? buf[3] << 8 : 0);
break;
case 2:
xfer = buf[6];
xfer |= (extend ? buf[5] << 8 : 0);
break;
}
return xfer * unit;
} | true | qemu | d83c951cce14dd3c7600c386d3791c4993744622 | static int ata_passthrough_16_xfer_size(SCSIDevice *dev, uint8_t *buf)
{
int extend = buf[1] & 0x1;
int length = buf[2] & 0x3;
int xfer;
int unit = ata_passthrough_xfer_unit(dev, buf);
switch (length) {
case 0:
case 3:
xfer = 0;
break;
case 1:
xfer = buf[4];
xfer |= (extend ? buf[3] << 8 : 0);
break;
case 2:
xfer = buf[6];
xfer |= (extend ? buf[5] << 8 : 0);
break;
}
return xfer * unit;
} | {
"code": [],
"line_no": []
} | static int FUNC_0(SCSIDevice *VAR_0, uint8_t *VAR_1)
{
int VAR_2 = VAR_1[1] & 0x1;
int VAR_3 = VAR_1[2] & 0x3;
int VAR_4;
int VAR_5 = ata_passthrough_xfer_unit(VAR_0, VAR_1);
switch (VAR_3) {
case 0:
case 3:
VAR_4 = 0;
break;
case 1:
VAR_4 = VAR_1[4];
VAR_4 |= (VAR_2 ? VAR_1[3] << 8 : 0);
break;
case 2:
VAR_4 = VAR_1[6];
VAR_4 |= (VAR_2 ? VAR_1[5] << 8 : 0);
break;
}
return VAR_4 * VAR_5;
} | [
"static int FUNC_0(SCSIDevice *VAR_0, uint8_t *VAR_1)\n{",
"int VAR_2 = VAR_1[1] & 0x1;",
"int VAR_3 = VAR_1[2] & 0x3;",
"int VAR_4;",
"int VAR_5 = ata_passthrough_xfer_unit(VAR_0, VAR_1);",
"switch (VAR_3) {",
"case 0:\ncase 3:\nVAR_4 = 0;",
"break;",
"case 1:\nVAR_4 = VAR_1[4];",
"VAR_4 |= (VAR_2 ? VAR_1[3] << 8 : 0);",
"break;",
"case 2:\nVAR_4 = VAR_1[6];",
"VAR_4 |= (VAR_2 ? VAR_1[5] << 8 : 0);",
"break;",
"}",
"return VAR_4 * VAR_5;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17,
19,
22
],
[
24
],
[
26,
28
],
[
30
],
[
32
],
[
34,
36
],
[
38
],
[
40
],
[
42
],
[
46
],
[
48
]
]
|
12,456 | void dsputil_init(DSPContext* c, AVCodecContext *avctx)
{
int i;
ff_check_alignment();
#if CONFIG_ENCODERS
if(avctx->dct_algo==FF_DCT_FASTINT) {
c->fdct = fdct_ifast;
c->fdct248 = fdct_ifast248;
}
else if(avctx->dct_algo==FF_DCT_FAAN) {
c->fdct = ff_faandct;
c->fdct248 = ff_faandct248;
}
else {
c->fdct = ff_jpeg_fdct_islow; //slow/accurate/default
c->fdct248 = ff_fdct248_islow;
}
#endif //CONFIG_ENCODERS
if(avctx->lowres==1){
if(avctx->idct_algo==FF_IDCT_INT || avctx->idct_algo==FF_IDCT_AUTO || !CONFIG_H264_DECODER){
c->idct_put= ff_jref_idct4_put;
c->idct_add= ff_jref_idct4_add;
}else{
c->idct_put= ff_h264_lowres_idct_put_c;
c->idct_add= ff_h264_lowres_idct_add_c;
}
c->idct = j_rev_dct4;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}else if(avctx->lowres==2){
c->idct_put= ff_jref_idct2_put;
c->idct_add= ff_jref_idct2_add;
c->idct = j_rev_dct2;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}else if(avctx->lowres==3){
c->idct_put= ff_jref_idct1_put;
c->idct_add= ff_jref_idct1_add;
c->idct = j_rev_dct1;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}else{
if(avctx->idct_algo==FF_IDCT_INT){
c->idct_put= ff_jref_idct_put;
c->idct_add= ff_jref_idct_add;
c->idct = j_rev_dct;
c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;
}else if((CONFIG_VP3_DECODER || CONFIG_VP5_DECODER || CONFIG_VP6_DECODER ) &&
avctx->idct_algo==FF_IDCT_VP3){
c->idct_put= ff_vp3_idct_put_c;
c->idct_add= ff_vp3_idct_add_c;
c->idct = ff_vp3_idct_c;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}else if(avctx->idct_algo==FF_IDCT_WMV2){
c->idct_put= ff_wmv2_idct_put_c;
c->idct_add= ff_wmv2_idct_add_c;
c->idct = ff_wmv2_idct_c;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}else if(avctx->idct_algo==FF_IDCT_FAAN){
c->idct_put= ff_faanidct_put;
c->idct_add= ff_faanidct_add;
c->idct = ff_faanidct;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}else if(CONFIG_EATGQ_DECODER && avctx->idct_algo==FF_IDCT_EA) {
c->idct_put= ff_ea_idct_put_c;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}else{ //accurate/default
c->idct_put= ff_simple_idct_put;
c->idct_add= ff_simple_idct_add;
c->idct = ff_simple_idct;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}
}
if (CONFIG_H264_DECODER) {
c->h264_idct_add= ff_h264_idct_add_c;
c->h264_idct8_add= ff_h264_idct8_add_c;
c->h264_idct_dc_add= ff_h264_idct_dc_add_c;
c->h264_idct8_dc_add= ff_h264_idct8_dc_add_c;
c->h264_idct_add16 = ff_h264_idct_add16_c;
c->h264_idct8_add4 = ff_h264_idct8_add4_c;
c->h264_idct_add8 = ff_h264_idct_add8_c;
c->h264_idct_add16intra= ff_h264_idct_add16intra_c;
}
c->get_pixels = get_pixels_c;
c->diff_pixels = diff_pixels_c;
c->put_pixels_clamped = put_pixels_clamped_c;
c->put_signed_pixels_clamped = put_signed_pixels_clamped_c;
c->add_pixels_clamped = add_pixels_clamped_c;
c->add_pixels8 = add_pixels8_c;
c->add_pixels4 = add_pixels4_c;
c->sum_abs_dctelem = sum_abs_dctelem_c;
c->gmc1 = gmc1_c;
c->gmc = ff_gmc_c;
c->clear_block = clear_block_c;
c->clear_blocks = clear_blocks_c;
c->pix_sum = pix_sum_c;
c->pix_norm1 = pix_norm1_c;
/* TODO [0] 16 [1] 8 */
c->pix_abs[0][0] = pix_abs16_c;
c->pix_abs[0][1] = pix_abs16_x2_c;
c->pix_abs[0][2] = pix_abs16_y2_c;
c->pix_abs[0][3] = pix_abs16_xy2_c;
c->pix_abs[1][0] = pix_abs8_c;
c->pix_abs[1][1] = pix_abs8_x2_c;
c->pix_abs[1][2] = pix_abs8_y2_c;
c->pix_abs[1][3] = pix_abs8_xy2_c;
#define dspfunc(PFX, IDX, NUM) \
c->PFX ## _pixels_tab[IDX][0] = PFX ## _pixels ## NUM ## _c; \
c->PFX ## _pixels_tab[IDX][1] = PFX ## _pixels ## NUM ## _x2_c; \
c->PFX ## _pixels_tab[IDX][2] = PFX ## _pixels ## NUM ## _y2_c; \
c->PFX ## _pixels_tab[IDX][3] = PFX ## _pixels ## NUM ## _xy2_c
dspfunc(put, 0, 16);
dspfunc(put_no_rnd, 0, 16);
dspfunc(put, 1, 8);
dspfunc(put_no_rnd, 1, 8);
dspfunc(put, 2, 4);
dspfunc(put, 3, 2);
dspfunc(avg, 0, 16);
dspfunc(avg_no_rnd, 0, 16);
dspfunc(avg, 1, 8);
dspfunc(avg_no_rnd, 1, 8);
dspfunc(avg, 2, 4);
dspfunc(avg, 3, 2);
#undef dspfunc
c->put_no_rnd_pixels_l2[0]= put_no_rnd_pixels16_l2_c;
c->put_no_rnd_pixels_l2[1]= put_no_rnd_pixels8_l2_c;
c->put_tpel_pixels_tab[ 0] = put_tpel_pixels_mc00_c;
c->put_tpel_pixels_tab[ 1] = put_tpel_pixels_mc10_c;
c->put_tpel_pixels_tab[ 2] = put_tpel_pixels_mc20_c;
c->put_tpel_pixels_tab[ 4] = put_tpel_pixels_mc01_c;
c->put_tpel_pixels_tab[ 5] = put_tpel_pixels_mc11_c;
c->put_tpel_pixels_tab[ 6] = put_tpel_pixels_mc21_c;
c->put_tpel_pixels_tab[ 8] = put_tpel_pixels_mc02_c;
c->put_tpel_pixels_tab[ 9] = put_tpel_pixels_mc12_c;
c->put_tpel_pixels_tab[10] = put_tpel_pixels_mc22_c;
c->avg_tpel_pixels_tab[ 0] = avg_tpel_pixels_mc00_c;
c->avg_tpel_pixels_tab[ 1] = avg_tpel_pixels_mc10_c;
c->avg_tpel_pixels_tab[ 2] = avg_tpel_pixels_mc20_c;
c->avg_tpel_pixels_tab[ 4] = avg_tpel_pixels_mc01_c;
c->avg_tpel_pixels_tab[ 5] = avg_tpel_pixels_mc11_c;
c->avg_tpel_pixels_tab[ 6] = avg_tpel_pixels_mc21_c;
c->avg_tpel_pixels_tab[ 8] = avg_tpel_pixels_mc02_c;
c->avg_tpel_pixels_tab[ 9] = avg_tpel_pixels_mc12_c;
c->avg_tpel_pixels_tab[10] = avg_tpel_pixels_mc22_c;
#define dspfunc(PFX, IDX, NUM) \
c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_c; \
c->PFX ## _pixels_tab[IDX][ 1] = PFX ## NUM ## _mc10_c; \
c->PFX ## _pixels_tab[IDX][ 2] = PFX ## NUM ## _mc20_c; \
c->PFX ## _pixels_tab[IDX][ 3] = PFX ## NUM ## _mc30_c; \
c->PFX ## _pixels_tab[IDX][ 4] = PFX ## NUM ## _mc01_c; \
c->PFX ## _pixels_tab[IDX][ 5] = PFX ## NUM ## _mc11_c; \
c->PFX ## _pixels_tab[IDX][ 6] = PFX ## NUM ## _mc21_c; \
c->PFX ## _pixels_tab[IDX][ 7] = PFX ## NUM ## _mc31_c; \
c->PFX ## _pixels_tab[IDX][ 8] = PFX ## NUM ## _mc02_c; \
c->PFX ## _pixels_tab[IDX][ 9] = PFX ## NUM ## _mc12_c; \
c->PFX ## _pixels_tab[IDX][10] = PFX ## NUM ## _mc22_c; \
c->PFX ## _pixels_tab[IDX][11] = PFX ## NUM ## _mc32_c; \
c->PFX ## _pixels_tab[IDX][12] = PFX ## NUM ## _mc03_c; \
c->PFX ## _pixels_tab[IDX][13] = PFX ## NUM ## _mc13_c; \
c->PFX ## _pixels_tab[IDX][14] = PFX ## NUM ## _mc23_c; \
c->PFX ## _pixels_tab[IDX][15] = PFX ## NUM ## _mc33_c
dspfunc(put_qpel, 0, 16);
dspfunc(put_no_rnd_qpel, 0, 16);
dspfunc(avg_qpel, 0, 16);
/* dspfunc(avg_no_rnd_qpel, 0, 16); */
dspfunc(put_qpel, 1, 8);
dspfunc(put_no_rnd_qpel, 1, 8);
dspfunc(avg_qpel, 1, 8);
/* dspfunc(avg_no_rnd_qpel, 1, 8); */
dspfunc(put_h264_qpel, 0, 16);
dspfunc(put_h264_qpel, 1, 8);
dspfunc(put_h264_qpel, 2, 4);
dspfunc(put_h264_qpel, 3, 2);
dspfunc(avg_h264_qpel, 0, 16);
dspfunc(avg_h264_qpel, 1, 8);
dspfunc(avg_h264_qpel, 2, 4);
#undef dspfunc
c->put_h264_chroma_pixels_tab[0]= put_h264_chroma_mc8_c;
c->put_h264_chroma_pixels_tab[1]= put_h264_chroma_mc4_c;
c->put_h264_chroma_pixels_tab[2]= put_h264_chroma_mc2_c;
c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_c;
c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_c;
c->avg_h264_chroma_pixels_tab[2]= avg_h264_chroma_mc2_c;
c->put_no_rnd_vc1_chroma_pixels_tab[0]= put_no_rnd_vc1_chroma_mc8_c;
c->avg_no_rnd_vc1_chroma_pixels_tab[0]= avg_no_rnd_vc1_chroma_mc8_c;
c->weight_h264_pixels_tab[0]= weight_h264_pixels16x16_c;
c->weight_h264_pixels_tab[1]= weight_h264_pixels16x8_c;
c->weight_h264_pixels_tab[2]= weight_h264_pixels8x16_c;
c->weight_h264_pixels_tab[3]= weight_h264_pixels8x8_c;
c->weight_h264_pixels_tab[4]= weight_h264_pixels8x4_c;
c->weight_h264_pixels_tab[5]= weight_h264_pixels4x8_c;
c->weight_h264_pixels_tab[6]= weight_h264_pixels4x4_c;
c->weight_h264_pixels_tab[7]= weight_h264_pixels4x2_c;
c->weight_h264_pixels_tab[8]= weight_h264_pixels2x4_c;
c->weight_h264_pixels_tab[9]= weight_h264_pixels2x2_c;
c->biweight_h264_pixels_tab[0]= biweight_h264_pixels16x16_c;
c->biweight_h264_pixels_tab[1]= biweight_h264_pixels16x8_c;
c->biweight_h264_pixels_tab[2]= biweight_h264_pixels8x16_c;
c->biweight_h264_pixels_tab[3]= biweight_h264_pixels8x8_c;
c->biweight_h264_pixels_tab[4]= biweight_h264_pixels8x4_c;
c->biweight_h264_pixels_tab[5]= biweight_h264_pixels4x8_c;
c->biweight_h264_pixels_tab[6]= biweight_h264_pixels4x4_c;
c->biweight_h264_pixels_tab[7]= biweight_h264_pixels4x2_c;
c->biweight_h264_pixels_tab[8]= biweight_h264_pixels2x4_c;
c->biweight_h264_pixels_tab[9]= biweight_h264_pixels2x2_c;
c->draw_edges = draw_edges_c;
#if CONFIG_CAVS_DECODER
ff_cavsdsp_init(c,avctx);
#endif
#if CONFIG_MLP_DECODER || CONFIG_TRUEHD_DECODER
ff_mlp_init(c, avctx);
#endif
#if CONFIG_VC1_DECODER || CONFIG_WMV3_DECODER
ff_vc1dsp_init(c,avctx);
#endif
#if CONFIG_WMV2_DECODER || CONFIG_VC1_DECODER || CONFIG_WMV3_DECODER
ff_intrax8dsp_init(c,avctx);
#endif
#if CONFIG_RV30_DECODER
ff_rv30dsp_init(c,avctx);
#endif
#if CONFIG_RV40_DECODER
ff_rv40dsp_init(c,avctx);
c->put_rv40_qpel_pixels_tab[0][15] = put_rv40_qpel16_mc33_c;
c->avg_rv40_qpel_pixels_tab[0][15] = avg_rv40_qpel16_mc33_c;
c->put_rv40_qpel_pixels_tab[1][15] = put_rv40_qpel8_mc33_c;
c->avg_rv40_qpel_pixels_tab[1][15] = avg_rv40_qpel8_mc33_c;
#endif
c->put_mspel_pixels_tab[0]= put_mspel8_mc00_c;
c->put_mspel_pixels_tab[1]= put_mspel8_mc10_c;
c->put_mspel_pixels_tab[2]= put_mspel8_mc20_c;
c->put_mspel_pixels_tab[3]= put_mspel8_mc30_c;
c->put_mspel_pixels_tab[4]= put_mspel8_mc02_c;
c->put_mspel_pixels_tab[5]= put_mspel8_mc12_c;
c->put_mspel_pixels_tab[6]= put_mspel8_mc22_c;
c->put_mspel_pixels_tab[7]= put_mspel8_mc32_c;
#define SET_CMP_FUNC(name) \
c->name[0]= name ## 16_c;\
c->name[1]= name ## 8x8_c;
SET_CMP_FUNC(hadamard8_diff)
c->hadamard8_diff[4]= hadamard8_intra16_c;
c->hadamard8_diff[5]= hadamard8_intra8x8_c;
SET_CMP_FUNC(dct_sad)
SET_CMP_FUNC(dct_max)
#if CONFIG_GPL
SET_CMP_FUNC(dct264_sad)
#endif
c->sad[0]= pix_abs16_c;
c->sad[1]= pix_abs8_c;
c->sse[0]= sse16_c;
c->sse[1]= sse8_c;
c->sse[2]= sse4_c;
SET_CMP_FUNC(quant_psnr)
SET_CMP_FUNC(rd)
SET_CMP_FUNC(bit)
c->vsad[0]= vsad16_c;
c->vsad[4]= vsad_intra16_c;
c->vsad[5]= vsad_intra8_c;
c->vsse[0]= vsse16_c;
c->vsse[4]= vsse_intra16_c;
c->vsse[5]= vsse_intra8_c;
c->nsse[0]= nsse16_c;
c->nsse[1]= nsse8_c;
#if CONFIG_SNOW_ENCODER
c->w53[0]= w53_16_c;
c->w53[1]= w53_8_c;
c->w97[0]= w97_16_c;
c->w97[1]= w97_8_c;
#endif
c->ssd_int8_vs_int16 = ssd_int8_vs_int16_c;
c->add_bytes= add_bytes_c;
c->add_bytes_l2= add_bytes_l2_c;
c->diff_bytes= diff_bytes_c;
c->add_hfyu_median_prediction= add_hfyu_median_prediction_c;
c->sub_hfyu_median_prediction= sub_hfyu_median_prediction_c;
c->bswap_buf= bswap_buf;
#if CONFIG_PNG_DECODER
c->add_png_paeth_prediction= ff_add_png_paeth_prediction;
#endif
c->h264_v_loop_filter_luma= h264_v_loop_filter_luma_c;
c->h264_h_loop_filter_luma= h264_h_loop_filter_luma_c;
c->h264_v_loop_filter_luma_intra= h264_v_loop_filter_luma_intra_c;
c->h264_h_loop_filter_luma_intra= h264_h_loop_filter_luma_intra_c;
c->h264_v_loop_filter_chroma= h264_v_loop_filter_chroma_c;
c->h264_h_loop_filter_chroma= h264_h_loop_filter_chroma_c;
c->h264_v_loop_filter_chroma_intra= h264_v_loop_filter_chroma_intra_c;
c->h264_h_loop_filter_chroma_intra= h264_h_loop_filter_chroma_intra_c;
c->h264_loop_filter_strength= NULL;
if (CONFIG_ANY_H263) {
c->h263_h_loop_filter= h263_h_loop_filter_c;
c->h263_v_loop_filter= h263_v_loop_filter_c;
}
if (CONFIG_VP3_DECODER) {
c->vp3_h_loop_filter= ff_vp3_h_loop_filter_c;
c->vp3_v_loop_filter= ff_vp3_v_loop_filter_c;
}
if (CONFIG_VP6_DECODER) {
c->vp6_filter_diag4= ff_vp6_filter_diag4_c;
}
c->h261_loop_filter= h261_loop_filter_c;
c->try_8x8basis= try_8x8basis_c;
c->add_8x8basis= add_8x8basis_c;
#if CONFIG_SNOW_DECODER
c->vertical_compose97i = ff_snow_vertical_compose97i;
c->horizontal_compose97i = ff_snow_horizontal_compose97i;
c->inner_add_yblock = ff_snow_inner_add_yblock;
#endif
#if CONFIG_VORBIS_DECODER
c->vorbis_inverse_coupling = vorbis_inverse_coupling;
#endif
#if CONFIG_AC3_DECODER
c->ac3_downmix = ff_ac3_downmix_c;
#endif
#if CONFIG_FLAC_ENCODER
c->flac_compute_autocorr = ff_flac_compute_autocorr;
#endif
c->vector_fmul = vector_fmul_c;
c->vector_fmul_reverse = vector_fmul_reverse_c;
c->vector_fmul_add_add = ff_vector_fmul_add_add_c;
c->vector_fmul_window = ff_vector_fmul_window_c;
c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_c;
c->float_to_int16 = ff_float_to_int16_c;
c->float_to_int16_interleave = ff_float_to_int16_interleave_c;
c->add_int16 = add_int16_c;
c->sub_int16 = sub_int16_c;
c->scalarproduct_int16 = scalarproduct_int16_c;
c->shrink[0]= ff_img_copy_plane;
c->shrink[1]= ff_shrink22;
c->shrink[2]= ff_shrink44;
c->shrink[3]= ff_shrink88;
c->prefetch= just_return;
memset(c->put_2tap_qpel_pixels_tab, 0, sizeof(c->put_2tap_qpel_pixels_tab));
memset(c->avg_2tap_qpel_pixels_tab, 0, sizeof(c->avg_2tap_qpel_pixels_tab));
if (HAVE_MMX) dsputil_init_mmx (c, avctx);
if (ARCH_ARM) dsputil_init_arm (c, avctx);
if (CONFIG_MLIB) dsputil_init_mlib (c, avctx);
if (HAVE_VIS) dsputil_init_vis (c, avctx);
if (ARCH_ALPHA) dsputil_init_alpha (c, avctx);
if (ARCH_PPC) dsputil_init_ppc (c, avctx);
if (HAVE_MMI) dsputil_init_mmi (c, avctx);
if (ARCH_SH4) dsputil_init_sh4 (c, avctx);
if (ARCH_BFIN) dsputil_init_bfin (c, avctx);
for(i=0; i<64; i++){
if(!c->put_2tap_qpel_pixels_tab[0][i])
c->put_2tap_qpel_pixels_tab[0][i]= c->put_h264_qpel_pixels_tab[0][i];
if(!c->avg_2tap_qpel_pixels_tab[0][i])
c->avg_2tap_qpel_pixels_tab[0][i]= c->avg_h264_qpel_pixels_tab[0][i];
}
switch(c->idct_permutation_type){
case FF_NO_IDCT_PERM:
for(i=0; i<64; i++)
c->idct_permutation[i]= i;
break;
case FF_LIBMPEG2_IDCT_PERM:
for(i=0; i<64; i++)
c->idct_permutation[i]= (i & 0x38) | ((i & 6) >> 1) | ((i & 1) << 2);
break;
case FF_SIMPLE_IDCT_PERM:
for(i=0; i<64; i++)
c->idct_permutation[i]= simple_mmx_permutation[i];
break;
case FF_TRANSPOSE_IDCT_PERM:
for(i=0; i<64; i++)
c->idct_permutation[i]= ((i&7)<<3) | (i>>3);
break;
case FF_PARTTRANS_IDCT_PERM:
for(i=0; i<64; i++)
c->idct_permutation[i]= (i&0x24) | ((i&3)<<3) | ((i>>3)&3);
break;
case FF_SSE2_IDCT_PERM:
for(i=0; i<64; i++)
c->idct_permutation[i]= (i&0x38) | idct_sse2_row_perm[i&7];
break;
default:
av_log(avctx, AV_LOG_ERROR, "Internal error, IDCT permutation not set\n");
}
}
| false | FFmpeg | 9be6f0d2f8393100a11c8527c7ba18c1dc2f1450 | void dsputil_init(DSPContext* c, AVCodecContext *avctx)
{
int i;
ff_check_alignment();
#if CONFIG_ENCODERS
if(avctx->dct_algo==FF_DCT_FASTINT) {
c->fdct = fdct_ifast;
c->fdct248 = fdct_ifast248;
}
else if(avctx->dct_algo==FF_DCT_FAAN) {
c->fdct = ff_faandct;
c->fdct248 = ff_faandct248;
}
else {
c->fdct = ff_jpeg_fdct_islow;
c->fdct248 = ff_fdct248_islow;
}
#endif
if(avctx->lowres==1){
if(avctx->idct_algo==FF_IDCT_INT || avctx->idct_algo==FF_IDCT_AUTO || !CONFIG_H264_DECODER){
c->idct_put= ff_jref_idct4_put;
c->idct_add= ff_jref_idct4_add;
}else{
c->idct_put= ff_h264_lowres_idct_put_c;
c->idct_add= ff_h264_lowres_idct_add_c;
}
c->idct = j_rev_dct4;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}else if(avctx->lowres==2){
c->idct_put= ff_jref_idct2_put;
c->idct_add= ff_jref_idct2_add;
c->idct = j_rev_dct2;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}else if(avctx->lowres==3){
c->idct_put= ff_jref_idct1_put;
c->idct_add= ff_jref_idct1_add;
c->idct = j_rev_dct1;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}else{
if(avctx->idct_algo==FF_IDCT_INT){
c->idct_put= ff_jref_idct_put;
c->idct_add= ff_jref_idct_add;
c->idct = j_rev_dct;
c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;
}else if((CONFIG_VP3_DECODER || CONFIG_VP5_DECODER || CONFIG_VP6_DECODER ) &&
avctx->idct_algo==FF_IDCT_VP3){
c->idct_put= ff_vp3_idct_put_c;
c->idct_add= ff_vp3_idct_add_c;
c->idct = ff_vp3_idct_c;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}else if(avctx->idct_algo==FF_IDCT_WMV2){
c->idct_put= ff_wmv2_idct_put_c;
c->idct_add= ff_wmv2_idct_add_c;
c->idct = ff_wmv2_idct_c;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}else if(avctx->idct_algo==FF_IDCT_FAAN){
c->idct_put= ff_faanidct_put;
c->idct_add= ff_faanidct_add;
c->idct = ff_faanidct;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}else if(CONFIG_EATGQ_DECODER && avctx->idct_algo==FF_IDCT_EA) {
c->idct_put= ff_ea_idct_put_c;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}else{
c->idct_put= ff_simple_idct_put;
c->idct_add= ff_simple_idct_add;
c->idct = ff_simple_idct;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}
}
if (CONFIG_H264_DECODER) {
c->h264_idct_add= ff_h264_idct_add_c;
c->h264_idct8_add= ff_h264_idct8_add_c;
c->h264_idct_dc_add= ff_h264_idct_dc_add_c;
c->h264_idct8_dc_add= ff_h264_idct8_dc_add_c;
c->h264_idct_add16 = ff_h264_idct_add16_c;
c->h264_idct8_add4 = ff_h264_idct8_add4_c;
c->h264_idct_add8 = ff_h264_idct_add8_c;
c->h264_idct_add16intra= ff_h264_idct_add16intra_c;
}
c->get_pixels = get_pixels_c;
c->diff_pixels = diff_pixels_c;
c->put_pixels_clamped = put_pixels_clamped_c;
c->put_signed_pixels_clamped = put_signed_pixels_clamped_c;
c->add_pixels_clamped = add_pixels_clamped_c;
c->add_pixels8 = add_pixels8_c;
c->add_pixels4 = add_pixels4_c;
c->sum_abs_dctelem = sum_abs_dctelem_c;
c->gmc1 = gmc1_c;
c->gmc = ff_gmc_c;
c->clear_block = clear_block_c;
c->clear_blocks = clear_blocks_c;
c->pix_sum = pix_sum_c;
c->pix_norm1 = pix_norm1_c;
c->pix_abs[0][0] = pix_abs16_c;
c->pix_abs[0][1] = pix_abs16_x2_c;
c->pix_abs[0][2] = pix_abs16_y2_c;
c->pix_abs[0][3] = pix_abs16_xy2_c;
c->pix_abs[1][0] = pix_abs8_c;
c->pix_abs[1][1] = pix_abs8_x2_c;
c->pix_abs[1][2] = pix_abs8_y2_c;
c->pix_abs[1][3] = pix_abs8_xy2_c;
#define dspfunc(PFX, IDX, NUM) \
c->PFX ## _pixels_tab[IDX][0] = PFX ## _pixels ## NUM ## _c; \
c->PFX ## _pixels_tab[IDX][1] = PFX ## _pixels ## NUM ## _x2_c; \
c->PFX ## _pixels_tab[IDX][2] = PFX ## _pixels ## NUM ## _y2_c; \
c->PFX ## _pixels_tab[IDX][3] = PFX ## _pixels ## NUM ## _xy2_c
dspfunc(put, 0, 16);
dspfunc(put_no_rnd, 0, 16);
dspfunc(put, 1, 8);
dspfunc(put_no_rnd, 1, 8);
dspfunc(put, 2, 4);
dspfunc(put, 3, 2);
dspfunc(avg, 0, 16);
dspfunc(avg_no_rnd, 0, 16);
dspfunc(avg, 1, 8);
dspfunc(avg_no_rnd, 1, 8);
dspfunc(avg, 2, 4);
dspfunc(avg, 3, 2);
#undef dspfunc
c->put_no_rnd_pixels_l2[0]= put_no_rnd_pixels16_l2_c;
c->put_no_rnd_pixels_l2[1]= put_no_rnd_pixels8_l2_c;
c->put_tpel_pixels_tab[ 0] = put_tpel_pixels_mc00_c;
c->put_tpel_pixels_tab[ 1] = put_tpel_pixels_mc10_c;
c->put_tpel_pixels_tab[ 2] = put_tpel_pixels_mc20_c;
c->put_tpel_pixels_tab[ 4] = put_tpel_pixels_mc01_c;
c->put_tpel_pixels_tab[ 5] = put_tpel_pixels_mc11_c;
c->put_tpel_pixels_tab[ 6] = put_tpel_pixels_mc21_c;
c->put_tpel_pixels_tab[ 8] = put_tpel_pixels_mc02_c;
c->put_tpel_pixels_tab[ 9] = put_tpel_pixels_mc12_c;
c->put_tpel_pixels_tab[10] = put_tpel_pixels_mc22_c;
c->avg_tpel_pixels_tab[ 0] = avg_tpel_pixels_mc00_c;
c->avg_tpel_pixels_tab[ 1] = avg_tpel_pixels_mc10_c;
c->avg_tpel_pixels_tab[ 2] = avg_tpel_pixels_mc20_c;
c->avg_tpel_pixels_tab[ 4] = avg_tpel_pixels_mc01_c;
c->avg_tpel_pixels_tab[ 5] = avg_tpel_pixels_mc11_c;
c->avg_tpel_pixels_tab[ 6] = avg_tpel_pixels_mc21_c;
c->avg_tpel_pixels_tab[ 8] = avg_tpel_pixels_mc02_c;
c->avg_tpel_pixels_tab[ 9] = avg_tpel_pixels_mc12_c;
c->avg_tpel_pixels_tab[10] = avg_tpel_pixels_mc22_c;
#define dspfunc(PFX, IDX, NUM) \
c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_c; \
c->PFX ## _pixels_tab[IDX][ 1] = PFX ## NUM ## _mc10_c; \
c->PFX ## _pixels_tab[IDX][ 2] = PFX ## NUM ## _mc20_c; \
c->PFX ## _pixels_tab[IDX][ 3] = PFX ## NUM ## _mc30_c; \
c->PFX ## _pixels_tab[IDX][ 4] = PFX ## NUM ## _mc01_c; \
c->PFX ## _pixels_tab[IDX][ 5] = PFX ## NUM ## _mc11_c; \
c->PFX ## _pixels_tab[IDX][ 6] = PFX ## NUM ## _mc21_c; \
c->PFX ## _pixels_tab[IDX][ 7] = PFX ## NUM ## _mc31_c; \
c->PFX ## _pixels_tab[IDX][ 8] = PFX ## NUM ## _mc02_c; \
c->PFX ## _pixels_tab[IDX][ 9] = PFX ## NUM ## _mc12_c; \
c->PFX ## _pixels_tab[IDX][10] = PFX ## NUM ## _mc22_c; \
c->PFX ## _pixels_tab[IDX][11] = PFX ## NUM ## _mc32_c; \
c->PFX ## _pixels_tab[IDX][12] = PFX ## NUM ## _mc03_c; \
c->PFX ## _pixels_tab[IDX][13] = PFX ## NUM ## _mc13_c; \
c->PFX ## _pixels_tab[IDX][14] = PFX ## NUM ## _mc23_c; \
c->PFX ## _pixels_tab[IDX][15] = PFX ## NUM ## _mc33_c
dspfunc(put_qpel, 0, 16);
dspfunc(put_no_rnd_qpel, 0, 16);
dspfunc(avg_qpel, 0, 16);
dspfunc(put_qpel, 1, 8);
dspfunc(put_no_rnd_qpel, 1, 8);
dspfunc(avg_qpel, 1, 8);
dspfunc(put_h264_qpel, 0, 16);
dspfunc(put_h264_qpel, 1, 8);
dspfunc(put_h264_qpel, 2, 4);
dspfunc(put_h264_qpel, 3, 2);
dspfunc(avg_h264_qpel, 0, 16);
dspfunc(avg_h264_qpel, 1, 8);
dspfunc(avg_h264_qpel, 2, 4);
#undef dspfunc
c->put_h264_chroma_pixels_tab[0]= put_h264_chroma_mc8_c;
c->put_h264_chroma_pixels_tab[1]= put_h264_chroma_mc4_c;
c->put_h264_chroma_pixels_tab[2]= put_h264_chroma_mc2_c;
c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_c;
c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_c;
c->avg_h264_chroma_pixels_tab[2]= avg_h264_chroma_mc2_c;
c->put_no_rnd_vc1_chroma_pixels_tab[0]= put_no_rnd_vc1_chroma_mc8_c;
c->avg_no_rnd_vc1_chroma_pixels_tab[0]= avg_no_rnd_vc1_chroma_mc8_c;
c->weight_h264_pixels_tab[0]= weight_h264_pixels16x16_c;
c->weight_h264_pixels_tab[1]= weight_h264_pixels16x8_c;
c->weight_h264_pixels_tab[2]= weight_h264_pixels8x16_c;
c->weight_h264_pixels_tab[3]= weight_h264_pixels8x8_c;
c->weight_h264_pixels_tab[4]= weight_h264_pixels8x4_c;
c->weight_h264_pixels_tab[5]= weight_h264_pixels4x8_c;
c->weight_h264_pixels_tab[6]= weight_h264_pixels4x4_c;
c->weight_h264_pixels_tab[7]= weight_h264_pixels4x2_c;
c->weight_h264_pixels_tab[8]= weight_h264_pixels2x4_c;
c->weight_h264_pixels_tab[9]= weight_h264_pixels2x2_c;
c->biweight_h264_pixels_tab[0]= biweight_h264_pixels16x16_c;
c->biweight_h264_pixels_tab[1]= biweight_h264_pixels16x8_c;
c->biweight_h264_pixels_tab[2]= biweight_h264_pixels8x16_c;
c->biweight_h264_pixels_tab[3]= biweight_h264_pixels8x8_c;
c->biweight_h264_pixels_tab[4]= biweight_h264_pixels8x4_c;
c->biweight_h264_pixels_tab[5]= biweight_h264_pixels4x8_c;
c->biweight_h264_pixels_tab[6]= biweight_h264_pixels4x4_c;
c->biweight_h264_pixels_tab[7]= biweight_h264_pixels4x2_c;
c->biweight_h264_pixels_tab[8]= biweight_h264_pixels2x4_c;
c->biweight_h264_pixels_tab[9]= biweight_h264_pixels2x2_c;
c->draw_edges = draw_edges_c;
#if CONFIG_CAVS_DECODER
ff_cavsdsp_init(c,avctx);
#endif
#if CONFIG_MLP_DECODER || CONFIG_TRUEHD_DECODER
ff_mlp_init(c, avctx);
#endif
#if CONFIG_VC1_DECODER || CONFIG_WMV3_DECODER
ff_vc1dsp_init(c,avctx);
#endif
#if CONFIG_WMV2_DECODER || CONFIG_VC1_DECODER || CONFIG_WMV3_DECODER
ff_intrax8dsp_init(c,avctx);
#endif
#if CONFIG_RV30_DECODER
ff_rv30dsp_init(c,avctx);
#endif
#if CONFIG_RV40_DECODER
ff_rv40dsp_init(c,avctx);
c->put_rv40_qpel_pixels_tab[0][15] = put_rv40_qpel16_mc33_c;
c->avg_rv40_qpel_pixels_tab[0][15] = avg_rv40_qpel16_mc33_c;
c->put_rv40_qpel_pixels_tab[1][15] = put_rv40_qpel8_mc33_c;
c->avg_rv40_qpel_pixels_tab[1][15] = avg_rv40_qpel8_mc33_c;
#endif
c->put_mspel_pixels_tab[0]= put_mspel8_mc00_c;
c->put_mspel_pixels_tab[1]= put_mspel8_mc10_c;
c->put_mspel_pixels_tab[2]= put_mspel8_mc20_c;
c->put_mspel_pixels_tab[3]= put_mspel8_mc30_c;
c->put_mspel_pixels_tab[4]= put_mspel8_mc02_c;
c->put_mspel_pixels_tab[5]= put_mspel8_mc12_c;
c->put_mspel_pixels_tab[6]= put_mspel8_mc22_c;
c->put_mspel_pixels_tab[7]= put_mspel8_mc32_c;
#define SET_CMP_FUNC(name) \
c->name[0]= name ## 16_c;\
c->name[1]= name ## 8x8_c;
SET_CMP_FUNC(hadamard8_diff)
c->hadamard8_diff[4]= hadamard8_intra16_c;
c->hadamard8_diff[5]= hadamard8_intra8x8_c;
SET_CMP_FUNC(dct_sad)
SET_CMP_FUNC(dct_max)
#if CONFIG_GPL
SET_CMP_FUNC(dct264_sad)
#endif
c->sad[0]= pix_abs16_c;
c->sad[1]= pix_abs8_c;
c->sse[0]= sse16_c;
c->sse[1]= sse8_c;
c->sse[2]= sse4_c;
SET_CMP_FUNC(quant_psnr)
SET_CMP_FUNC(rd)
SET_CMP_FUNC(bit)
c->vsad[0]= vsad16_c;
c->vsad[4]= vsad_intra16_c;
c->vsad[5]= vsad_intra8_c;
c->vsse[0]= vsse16_c;
c->vsse[4]= vsse_intra16_c;
c->vsse[5]= vsse_intra8_c;
c->nsse[0]= nsse16_c;
c->nsse[1]= nsse8_c;
#if CONFIG_SNOW_ENCODER
c->w53[0]= w53_16_c;
c->w53[1]= w53_8_c;
c->w97[0]= w97_16_c;
c->w97[1]= w97_8_c;
#endif
c->ssd_int8_vs_int16 = ssd_int8_vs_int16_c;
c->add_bytes= add_bytes_c;
c->add_bytes_l2= add_bytes_l2_c;
c->diff_bytes= diff_bytes_c;
c->add_hfyu_median_prediction= add_hfyu_median_prediction_c;
c->sub_hfyu_median_prediction= sub_hfyu_median_prediction_c;
c->bswap_buf= bswap_buf;
#if CONFIG_PNG_DECODER
c->add_png_paeth_prediction= ff_add_png_paeth_prediction;
#endif
c->h264_v_loop_filter_luma= h264_v_loop_filter_luma_c;
c->h264_h_loop_filter_luma= h264_h_loop_filter_luma_c;
c->h264_v_loop_filter_luma_intra= h264_v_loop_filter_luma_intra_c;
c->h264_h_loop_filter_luma_intra= h264_h_loop_filter_luma_intra_c;
c->h264_v_loop_filter_chroma= h264_v_loop_filter_chroma_c;
c->h264_h_loop_filter_chroma= h264_h_loop_filter_chroma_c;
c->h264_v_loop_filter_chroma_intra= h264_v_loop_filter_chroma_intra_c;
c->h264_h_loop_filter_chroma_intra= h264_h_loop_filter_chroma_intra_c;
c->h264_loop_filter_strength= NULL;
if (CONFIG_ANY_H263) {
c->h263_h_loop_filter= h263_h_loop_filter_c;
c->h263_v_loop_filter= h263_v_loop_filter_c;
}
if (CONFIG_VP3_DECODER) {
c->vp3_h_loop_filter= ff_vp3_h_loop_filter_c;
c->vp3_v_loop_filter= ff_vp3_v_loop_filter_c;
}
if (CONFIG_VP6_DECODER) {
c->vp6_filter_diag4= ff_vp6_filter_diag4_c;
}
c->h261_loop_filter= h261_loop_filter_c;
c->try_8x8basis= try_8x8basis_c;
c->add_8x8basis= add_8x8basis_c;
#if CONFIG_SNOW_DECODER
c->vertical_compose97i = ff_snow_vertical_compose97i;
c->horizontal_compose97i = ff_snow_horizontal_compose97i;
c->inner_add_yblock = ff_snow_inner_add_yblock;
#endif
#if CONFIG_VORBIS_DECODER
c->vorbis_inverse_coupling = vorbis_inverse_coupling;
#endif
#if CONFIG_AC3_DECODER
c->ac3_downmix = ff_ac3_downmix_c;
#endif
#if CONFIG_FLAC_ENCODER
c->flac_compute_autocorr = ff_flac_compute_autocorr;
#endif
c->vector_fmul = vector_fmul_c;
c->vector_fmul_reverse = vector_fmul_reverse_c;
c->vector_fmul_add_add = ff_vector_fmul_add_add_c;
c->vector_fmul_window = ff_vector_fmul_window_c;
c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_c;
c->float_to_int16 = ff_float_to_int16_c;
c->float_to_int16_interleave = ff_float_to_int16_interleave_c;
c->add_int16 = add_int16_c;
c->sub_int16 = sub_int16_c;
c->scalarproduct_int16 = scalarproduct_int16_c;
c->shrink[0]= ff_img_copy_plane;
c->shrink[1]= ff_shrink22;
c->shrink[2]= ff_shrink44;
c->shrink[3]= ff_shrink88;
c->prefetch= just_return;
memset(c->put_2tap_qpel_pixels_tab, 0, sizeof(c->put_2tap_qpel_pixels_tab));
memset(c->avg_2tap_qpel_pixels_tab, 0, sizeof(c->avg_2tap_qpel_pixels_tab));
if (HAVE_MMX) dsputil_init_mmx (c, avctx);
if (ARCH_ARM) dsputil_init_arm (c, avctx);
if (CONFIG_MLIB) dsputil_init_mlib (c, avctx);
if (HAVE_VIS) dsputil_init_vis (c, avctx);
if (ARCH_ALPHA) dsputil_init_alpha (c, avctx);
if (ARCH_PPC) dsputil_init_ppc (c, avctx);
if (HAVE_MMI) dsputil_init_mmi (c, avctx);
if (ARCH_SH4) dsputil_init_sh4 (c, avctx);
if (ARCH_BFIN) dsputil_init_bfin (c, avctx);
for(i=0; i<64; i++){
if(!c->put_2tap_qpel_pixels_tab[0][i])
c->put_2tap_qpel_pixels_tab[0][i]= c->put_h264_qpel_pixels_tab[0][i];
if(!c->avg_2tap_qpel_pixels_tab[0][i])
c->avg_2tap_qpel_pixels_tab[0][i]= c->avg_h264_qpel_pixels_tab[0][i];
}
switch(c->idct_permutation_type){
case FF_NO_IDCT_PERM:
for(i=0; i<64; i++)
c->idct_permutation[i]= i;
break;
case FF_LIBMPEG2_IDCT_PERM:
for(i=0; i<64; i++)
c->idct_permutation[i]= (i & 0x38) | ((i & 6) >> 1) | ((i & 1) << 2);
break;
case FF_SIMPLE_IDCT_PERM:
for(i=0; i<64; i++)
c->idct_permutation[i]= simple_mmx_permutation[i];
break;
case FF_TRANSPOSE_IDCT_PERM:
for(i=0; i<64; i++)
c->idct_permutation[i]= ((i&7)<<3) | (i>>3);
break;
case FF_PARTTRANS_IDCT_PERM:
for(i=0; i<64; i++)
c->idct_permutation[i]= (i&0x24) | ((i&3)<<3) | ((i>>3)&3);
break;
case FF_SSE2_IDCT_PERM:
for(i=0; i<64; i++)
c->idct_permutation[i]= (i&0x38) | idct_sse2_row_perm[i&7];
break;
default:
av_log(avctx, AV_LOG_ERROR, "Internal error, IDCT permutation not set\n");
}
}
| {
"code": [],
"line_no": []
} | void FUNC_0(DSPContext* VAR_0, AVCodecContext *VAR_1)
{
int VAR_2;
ff_check_alignment();
#if CONFIG_ENCODERS
if(VAR_1->dct_algo==FF_DCT_FASTINT) {
VAR_0->fdct = fdct_ifast;
VAR_0->fdct248 = fdct_ifast248;
}
else if(VAR_1->dct_algo==FF_DCT_FAAN) {
VAR_0->fdct = ff_faandct;
VAR_0->fdct248 = ff_faandct248;
}
else {
VAR_0->fdct = ff_jpeg_fdct_islow;
VAR_0->fdct248 = ff_fdct248_islow;
}
#endif
if(VAR_1->lowres==1){
if(VAR_1->idct_algo==FF_IDCT_INT || VAR_1->idct_algo==FF_IDCT_AUTO || !CONFIG_H264_DECODER){
VAR_0->idct_put= ff_jref_idct4_put;
VAR_0->idct_add= ff_jref_idct4_add;
}else{
VAR_0->idct_put= ff_h264_lowres_idct_put_c;
VAR_0->idct_add= ff_h264_lowres_idct_add_c;
}
VAR_0->idct = j_rev_dct4;
VAR_0->idct_permutation_type= FF_NO_IDCT_PERM;
}else if(VAR_1->lowres==2){
VAR_0->idct_put= ff_jref_idct2_put;
VAR_0->idct_add= ff_jref_idct2_add;
VAR_0->idct = j_rev_dct2;
VAR_0->idct_permutation_type= FF_NO_IDCT_PERM;
}else if(VAR_1->lowres==3){
VAR_0->idct_put= ff_jref_idct1_put;
VAR_0->idct_add= ff_jref_idct1_add;
VAR_0->idct = j_rev_dct1;
VAR_0->idct_permutation_type= FF_NO_IDCT_PERM;
}else{
if(VAR_1->idct_algo==FF_IDCT_INT){
VAR_0->idct_put= ff_jref_idct_put;
VAR_0->idct_add= ff_jref_idct_add;
VAR_0->idct = j_rev_dct;
VAR_0->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;
}else if((CONFIG_VP3_DECODER || CONFIG_VP5_DECODER || CONFIG_VP6_DECODER ) &&
VAR_1->idct_algo==FF_IDCT_VP3){
VAR_0->idct_put= ff_vp3_idct_put_c;
VAR_0->idct_add= ff_vp3_idct_add_c;
VAR_0->idct = ff_vp3_idct_c;
VAR_0->idct_permutation_type= FF_NO_IDCT_PERM;
}else if(VAR_1->idct_algo==FF_IDCT_WMV2){
VAR_0->idct_put= ff_wmv2_idct_put_c;
VAR_0->idct_add= ff_wmv2_idct_add_c;
VAR_0->idct = ff_wmv2_idct_c;
VAR_0->idct_permutation_type= FF_NO_IDCT_PERM;
}else if(VAR_1->idct_algo==FF_IDCT_FAAN){
VAR_0->idct_put= ff_faanidct_put;
VAR_0->idct_add= ff_faanidct_add;
VAR_0->idct = ff_faanidct;
VAR_0->idct_permutation_type= FF_NO_IDCT_PERM;
}else if(CONFIG_EATGQ_DECODER && VAR_1->idct_algo==FF_IDCT_EA) {
VAR_0->idct_put= ff_ea_idct_put_c;
VAR_0->idct_permutation_type= FF_NO_IDCT_PERM;
}else{
VAR_0->idct_put= ff_simple_idct_put;
VAR_0->idct_add= ff_simple_idct_add;
VAR_0->idct = ff_simple_idct;
VAR_0->idct_permutation_type= FF_NO_IDCT_PERM;
}
}
if (CONFIG_H264_DECODER) {
VAR_0->h264_idct_add= ff_h264_idct_add_c;
VAR_0->h264_idct8_add= ff_h264_idct8_add_c;
VAR_0->h264_idct_dc_add= ff_h264_idct_dc_add_c;
VAR_0->h264_idct8_dc_add= ff_h264_idct8_dc_add_c;
VAR_0->h264_idct_add16 = ff_h264_idct_add16_c;
VAR_0->h264_idct8_add4 = ff_h264_idct8_add4_c;
VAR_0->h264_idct_add8 = ff_h264_idct_add8_c;
VAR_0->h264_idct_add16intra= ff_h264_idct_add16intra_c;
}
VAR_0->get_pixels = get_pixels_c;
VAR_0->diff_pixels = diff_pixels_c;
VAR_0->put_pixels_clamped = put_pixels_clamped_c;
VAR_0->put_signed_pixels_clamped = put_signed_pixels_clamped_c;
VAR_0->add_pixels_clamped = add_pixels_clamped_c;
VAR_0->add_pixels8 = add_pixels8_c;
VAR_0->add_pixels4 = add_pixels4_c;
VAR_0->sum_abs_dctelem = sum_abs_dctelem_c;
VAR_0->gmc1 = gmc1_c;
VAR_0->gmc = ff_gmc_c;
VAR_0->clear_block = clear_block_c;
VAR_0->clear_blocks = clear_blocks_c;
VAR_0->pix_sum = pix_sum_c;
VAR_0->pix_norm1 = pix_norm1_c;
VAR_0->pix_abs[0][0] = pix_abs16_c;
VAR_0->pix_abs[0][1] = pix_abs16_x2_c;
VAR_0->pix_abs[0][2] = pix_abs16_y2_c;
VAR_0->pix_abs[0][3] = pix_abs16_xy2_c;
VAR_0->pix_abs[1][0] = pix_abs8_c;
VAR_0->pix_abs[1][1] = pix_abs8_x2_c;
VAR_0->pix_abs[1][2] = pix_abs8_y2_c;
VAR_0->pix_abs[1][3] = pix_abs8_xy2_c;
#define dspfunc(PFX, IDX, NUM) \
VAR_0->PFX ## _pixels_tab[IDX][0] = PFX ## _pixels ## NUM ## _c; \
VAR_0->PFX ## _pixels_tab[IDX][1] = PFX ## _pixels ## NUM ## _x2_c; \
VAR_0->PFX ## _pixels_tab[IDX][2] = PFX ## _pixels ## NUM ## _y2_c; \
VAR_0->PFX ## _pixels_tab[IDX][3] = PFX ## _pixels ## NUM ## _xy2_c
dspfunc(put, 0, 16);
dspfunc(put_no_rnd, 0, 16);
dspfunc(put, 1, 8);
dspfunc(put_no_rnd, 1, 8);
dspfunc(put, 2, 4);
dspfunc(put, 3, 2);
dspfunc(avg, 0, 16);
dspfunc(avg_no_rnd, 0, 16);
dspfunc(avg, 1, 8);
dspfunc(avg_no_rnd, 1, 8);
dspfunc(avg, 2, 4);
dspfunc(avg, 3, 2);
#undef dspfunc
VAR_0->put_no_rnd_pixels_l2[0]= put_no_rnd_pixels16_l2_c;
VAR_0->put_no_rnd_pixels_l2[1]= put_no_rnd_pixels8_l2_c;
VAR_0->put_tpel_pixels_tab[ 0] = put_tpel_pixels_mc00_c;
VAR_0->put_tpel_pixels_tab[ 1] = put_tpel_pixels_mc10_c;
VAR_0->put_tpel_pixels_tab[ 2] = put_tpel_pixels_mc20_c;
VAR_0->put_tpel_pixels_tab[ 4] = put_tpel_pixels_mc01_c;
VAR_0->put_tpel_pixels_tab[ 5] = put_tpel_pixels_mc11_c;
VAR_0->put_tpel_pixels_tab[ 6] = put_tpel_pixels_mc21_c;
VAR_0->put_tpel_pixels_tab[ 8] = put_tpel_pixels_mc02_c;
VAR_0->put_tpel_pixels_tab[ 9] = put_tpel_pixels_mc12_c;
VAR_0->put_tpel_pixels_tab[10] = put_tpel_pixels_mc22_c;
VAR_0->avg_tpel_pixels_tab[ 0] = avg_tpel_pixels_mc00_c;
VAR_0->avg_tpel_pixels_tab[ 1] = avg_tpel_pixels_mc10_c;
VAR_0->avg_tpel_pixels_tab[ 2] = avg_tpel_pixels_mc20_c;
VAR_0->avg_tpel_pixels_tab[ 4] = avg_tpel_pixels_mc01_c;
VAR_0->avg_tpel_pixels_tab[ 5] = avg_tpel_pixels_mc11_c;
VAR_0->avg_tpel_pixels_tab[ 6] = avg_tpel_pixels_mc21_c;
VAR_0->avg_tpel_pixels_tab[ 8] = avg_tpel_pixels_mc02_c;
VAR_0->avg_tpel_pixels_tab[ 9] = avg_tpel_pixels_mc12_c;
VAR_0->avg_tpel_pixels_tab[10] = avg_tpel_pixels_mc22_c;
#define dspfunc(PFX, IDX, NUM) \
VAR_0->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_c; \
VAR_0->PFX ## _pixels_tab[IDX][ 1] = PFX ## NUM ## _mc10_c; \
VAR_0->PFX ## _pixels_tab[IDX][ 2] = PFX ## NUM ## _mc20_c; \
VAR_0->PFX ## _pixels_tab[IDX][ 3] = PFX ## NUM ## _mc30_c; \
VAR_0->PFX ## _pixels_tab[IDX][ 4] = PFX ## NUM ## _mc01_c; \
VAR_0->PFX ## _pixels_tab[IDX][ 5] = PFX ## NUM ## _mc11_c; \
VAR_0->PFX ## _pixels_tab[IDX][ 6] = PFX ## NUM ## _mc21_c; \
VAR_0->PFX ## _pixels_tab[IDX][ 7] = PFX ## NUM ## _mc31_c; \
VAR_0->PFX ## _pixels_tab[IDX][ 8] = PFX ## NUM ## _mc02_c; \
VAR_0->PFX ## _pixels_tab[IDX][ 9] = PFX ## NUM ## _mc12_c; \
VAR_0->PFX ## _pixels_tab[IDX][10] = PFX ## NUM ## _mc22_c; \
VAR_0->PFX ## _pixels_tab[IDX][11] = PFX ## NUM ## _mc32_c; \
VAR_0->PFX ## _pixels_tab[IDX][12] = PFX ## NUM ## _mc03_c; \
VAR_0->PFX ## _pixels_tab[IDX][13] = PFX ## NUM ## _mc13_c; \
VAR_0->PFX ## _pixels_tab[IDX][14] = PFX ## NUM ## _mc23_c; \
VAR_0->PFX ## _pixels_tab[IDX][15] = PFX ## NUM ## _mc33_c
dspfunc(put_qpel, 0, 16);
dspfunc(put_no_rnd_qpel, 0, 16);
dspfunc(avg_qpel, 0, 16);
dspfunc(put_qpel, 1, 8);
dspfunc(put_no_rnd_qpel, 1, 8);
dspfunc(avg_qpel, 1, 8);
dspfunc(put_h264_qpel, 0, 16);
dspfunc(put_h264_qpel, 1, 8);
dspfunc(put_h264_qpel, 2, 4);
dspfunc(put_h264_qpel, 3, 2);
dspfunc(avg_h264_qpel, 0, 16);
dspfunc(avg_h264_qpel, 1, 8);
dspfunc(avg_h264_qpel, 2, 4);
#undef dspfunc
VAR_0->put_h264_chroma_pixels_tab[0]= put_h264_chroma_mc8_c;
VAR_0->put_h264_chroma_pixels_tab[1]= put_h264_chroma_mc4_c;
VAR_0->put_h264_chroma_pixels_tab[2]= put_h264_chroma_mc2_c;
VAR_0->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_c;
VAR_0->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_c;
VAR_0->avg_h264_chroma_pixels_tab[2]= avg_h264_chroma_mc2_c;
VAR_0->put_no_rnd_vc1_chroma_pixels_tab[0]= put_no_rnd_vc1_chroma_mc8_c;
VAR_0->avg_no_rnd_vc1_chroma_pixels_tab[0]= avg_no_rnd_vc1_chroma_mc8_c;
VAR_0->weight_h264_pixels_tab[0]= weight_h264_pixels16x16_c;
VAR_0->weight_h264_pixels_tab[1]= weight_h264_pixels16x8_c;
VAR_0->weight_h264_pixels_tab[2]= weight_h264_pixels8x16_c;
VAR_0->weight_h264_pixels_tab[3]= weight_h264_pixels8x8_c;
VAR_0->weight_h264_pixels_tab[4]= weight_h264_pixels8x4_c;
VAR_0->weight_h264_pixels_tab[5]= weight_h264_pixels4x8_c;
VAR_0->weight_h264_pixels_tab[6]= weight_h264_pixels4x4_c;
VAR_0->weight_h264_pixels_tab[7]= weight_h264_pixels4x2_c;
VAR_0->weight_h264_pixels_tab[8]= weight_h264_pixels2x4_c;
VAR_0->weight_h264_pixels_tab[9]= weight_h264_pixels2x2_c;
VAR_0->biweight_h264_pixels_tab[0]= biweight_h264_pixels16x16_c;
VAR_0->biweight_h264_pixels_tab[1]= biweight_h264_pixels16x8_c;
VAR_0->biweight_h264_pixels_tab[2]= biweight_h264_pixels8x16_c;
VAR_0->biweight_h264_pixels_tab[3]= biweight_h264_pixels8x8_c;
VAR_0->biweight_h264_pixels_tab[4]= biweight_h264_pixels8x4_c;
VAR_0->biweight_h264_pixels_tab[5]= biweight_h264_pixels4x8_c;
VAR_0->biweight_h264_pixels_tab[6]= biweight_h264_pixels4x4_c;
VAR_0->biweight_h264_pixels_tab[7]= biweight_h264_pixels4x2_c;
VAR_0->biweight_h264_pixels_tab[8]= biweight_h264_pixels2x4_c;
VAR_0->biweight_h264_pixels_tab[9]= biweight_h264_pixels2x2_c;
VAR_0->draw_edges = draw_edges_c;
#if CONFIG_CAVS_DECODER
ff_cavsdsp_init(VAR_0,VAR_1);
#endif
#if CONFIG_MLP_DECODER || CONFIG_TRUEHD_DECODER
ff_mlp_init(VAR_0, VAR_1);
#endif
#if CONFIG_VC1_DECODER || CONFIG_WMV3_DECODER
ff_vc1dsp_init(VAR_0,VAR_1);
#endif
#if CONFIG_WMV2_DECODER || CONFIG_VC1_DECODER || CONFIG_WMV3_DECODER
ff_intrax8dsp_init(VAR_0,VAR_1);
#endif
#if CONFIG_RV30_DECODER
ff_rv30dsp_init(VAR_0,VAR_1);
#endif
#if CONFIG_RV40_DECODER
ff_rv40dsp_init(VAR_0,VAR_1);
VAR_0->put_rv40_qpel_pixels_tab[0][15] = put_rv40_qpel16_mc33_c;
VAR_0->avg_rv40_qpel_pixels_tab[0][15] = avg_rv40_qpel16_mc33_c;
VAR_0->put_rv40_qpel_pixels_tab[1][15] = put_rv40_qpel8_mc33_c;
VAR_0->avg_rv40_qpel_pixels_tab[1][15] = avg_rv40_qpel8_mc33_c;
#endif
VAR_0->put_mspel_pixels_tab[0]= put_mspel8_mc00_c;
VAR_0->put_mspel_pixels_tab[1]= put_mspel8_mc10_c;
VAR_0->put_mspel_pixels_tab[2]= put_mspel8_mc20_c;
VAR_0->put_mspel_pixels_tab[3]= put_mspel8_mc30_c;
VAR_0->put_mspel_pixels_tab[4]= put_mspel8_mc02_c;
VAR_0->put_mspel_pixels_tab[5]= put_mspel8_mc12_c;
VAR_0->put_mspel_pixels_tab[6]= put_mspel8_mc22_c;
VAR_0->put_mspel_pixels_tab[7]= put_mspel8_mc32_c;
#define SET_CMP_FUNC(name) \
VAR_0->name[0]= name ## 16_c;\
VAR_0->name[1]= name ## 8x8_c;
SET_CMP_FUNC(hadamard8_diff)
VAR_0->hadamard8_diff[4]= hadamard8_intra16_c;
VAR_0->hadamard8_diff[5]= hadamard8_intra8x8_c;
SET_CMP_FUNC(dct_sad)
SET_CMP_FUNC(dct_max)
#if CONFIG_GPL
SET_CMP_FUNC(dct264_sad)
#endif
VAR_0->sad[0]= pix_abs16_c;
VAR_0->sad[1]= pix_abs8_c;
VAR_0->sse[0]= sse16_c;
VAR_0->sse[1]= sse8_c;
VAR_0->sse[2]= sse4_c;
SET_CMP_FUNC(quant_psnr)
SET_CMP_FUNC(rd)
SET_CMP_FUNC(bit)
VAR_0->vsad[0]= vsad16_c;
VAR_0->vsad[4]= vsad_intra16_c;
VAR_0->vsad[5]= vsad_intra8_c;
VAR_0->vsse[0]= vsse16_c;
VAR_0->vsse[4]= vsse_intra16_c;
VAR_0->vsse[5]= vsse_intra8_c;
VAR_0->nsse[0]= nsse16_c;
VAR_0->nsse[1]= nsse8_c;
#if CONFIG_SNOW_ENCODER
VAR_0->w53[0]= w53_16_c;
VAR_0->w53[1]= w53_8_c;
VAR_0->w97[0]= w97_16_c;
VAR_0->w97[1]= w97_8_c;
#endif
VAR_0->ssd_int8_vs_int16 = ssd_int8_vs_int16_c;
VAR_0->add_bytes= add_bytes_c;
VAR_0->add_bytes_l2= add_bytes_l2_c;
VAR_0->diff_bytes= diff_bytes_c;
VAR_0->add_hfyu_median_prediction= add_hfyu_median_prediction_c;
VAR_0->sub_hfyu_median_prediction= sub_hfyu_median_prediction_c;
VAR_0->bswap_buf= bswap_buf;
#if CONFIG_PNG_DECODER
VAR_0->add_png_paeth_prediction= ff_add_png_paeth_prediction;
#endif
VAR_0->h264_v_loop_filter_luma= h264_v_loop_filter_luma_c;
VAR_0->h264_h_loop_filter_luma= h264_h_loop_filter_luma_c;
VAR_0->h264_v_loop_filter_luma_intra= h264_v_loop_filter_luma_intra_c;
VAR_0->h264_h_loop_filter_luma_intra= h264_h_loop_filter_luma_intra_c;
VAR_0->h264_v_loop_filter_chroma= h264_v_loop_filter_chroma_c;
VAR_0->h264_h_loop_filter_chroma= h264_h_loop_filter_chroma_c;
VAR_0->h264_v_loop_filter_chroma_intra= h264_v_loop_filter_chroma_intra_c;
VAR_0->h264_h_loop_filter_chroma_intra= h264_h_loop_filter_chroma_intra_c;
VAR_0->h264_loop_filter_strength= NULL;
if (CONFIG_ANY_H263) {
VAR_0->h263_h_loop_filter= h263_h_loop_filter_c;
VAR_0->h263_v_loop_filter= h263_v_loop_filter_c;
}
if (CONFIG_VP3_DECODER) {
VAR_0->vp3_h_loop_filter= ff_vp3_h_loop_filter_c;
VAR_0->vp3_v_loop_filter= ff_vp3_v_loop_filter_c;
}
if (CONFIG_VP6_DECODER) {
VAR_0->vp6_filter_diag4= ff_vp6_filter_diag4_c;
}
VAR_0->h261_loop_filter= h261_loop_filter_c;
VAR_0->try_8x8basis= try_8x8basis_c;
VAR_0->add_8x8basis= add_8x8basis_c;
#if CONFIG_SNOW_DECODER
VAR_0->vertical_compose97i = ff_snow_vertical_compose97i;
VAR_0->horizontal_compose97i = ff_snow_horizontal_compose97i;
VAR_0->inner_add_yblock = ff_snow_inner_add_yblock;
#endif
#if CONFIG_VORBIS_DECODER
VAR_0->vorbis_inverse_coupling = vorbis_inverse_coupling;
#endif
#if CONFIG_AC3_DECODER
VAR_0->ac3_downmix = ff_ac3_downmix_c;
#endif
#if CONFIG_FLAC_ENCODER
VAR_0->flac_compute_autocorr = ff_flac_compute_autocorr;
#endif
VAR_0->vector_fmul = vector_fmul_c;
VAR_0->vector_fmul_reverse = vector_fmul_reverse_c;
VAR_0->vector_fmul_add_add = ff_vector_fmul_add_add_c;
VAR_0->vector_fmul_window = ff_vector_fmul_window_c;
VAR_0->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_c;
VAR_0->float_to_int16 = ff_float_to_int16_c;
VAR_0->float_to_int16_interleave = ff_float_to_int16_interleave_c;
VAR_0->add_int16 = add_int16_c;
VAR_0->sub_int16 = sub_int16_c;
VAR_0->scalarproduct_int16 = scalarproduct_int16_c;
VAR_0->shrink[0]= ff_img_copy_plane;
VAR_0->shrink[1]= ff_shrink22;
VAR_0->shrink[2]= ff_shrink44;
VAR_0->shrink[3]= ff_shrink88;
VAR_0->prefetch= just_return;
memset(VAR_0->put_2tap_qpel_pixels_tab, 0, sizeof(VAR_0->put_2tap_qpel_pixels_tab));
memset(VAR_0->avg_2tap_qpel_pixels_tab, 0, sizeof(VAR_0->avg_2tap_qpel_pixels_tab));
if (HAVE_MMX) dsputil_init_mmx (VAR_0, VAR_1);
if (ARCH_ARM) dsputil_init_arm (VAR_0, VAR_1);
if (CONFIG_MLIB) dsputil_init_mlib (VAR_0, VAR_1);
if (HAVE_VIS) dsputil_init_vis (VAR_0, VAR_1);
if (ARCH_ALPHA) dsputil_init_alpha (VAR_0, VAR_1);
if (ARCH_PPC) dsputil_init_ppc (VAR_0, VAR_1);
if (HAVE_MMI) dsputil_init_mmi (VAR_0, VAR_1);
if (ARCH_SH4) dsputil_init_sh4 (VAR_0, VAR_1);
if (ARCH_BFIN) dsputil_init_bfin (VAR_0, VAR_1);
for(VAR_2=0; VAR_2<64; VAR_2++){
if(!VAR_0->put_2tap_qpel_pixels_tab[0][VAR_2])
VAR_0->put_2tap_qpel_pixels_tab[0][VAR_2]= VAR_0->put_h264_qpel_pixels_tab[0][VAR_2];
if(!VAR_0->avg_2tap_qpel_pixels_tab[0][VAR_2])
VAR_0->avg_2tap_qpel_pixels_tab[0][VAR_2]= VAR_0->avg_h264_qpel_pixels_tab[0][VAR_2];
}
switch(VAR_0->idct_permutation_type){
case FF_NO_IDCT_PERM:
for(VAR_2=0; VAR_2<64; VAR_2++)
VAR_0->idct_permutation[VAR_2]= VAR_2;
break;
case FF_LIBMPEG2_IDCT_PERM:
for(VAR_2=0; VAR_2<64; VAR_2++)
VAR_0->idct_permutation[VAR_2]= (VAR_2 & 0x38) | ((VAR_2 & 6) >> 1) | ((VAR_2 & 1) << 2);
break;
case FF_SIMPLE_IDCT_PERM:
for(VAR_2=0; VAR_2<64; VAR_2++)
VAR_0->idct_permutation[VAR_2]= simple_mmx_permutation[VAR_2];
break;
case FF_TRANSPOSE_IDCT_PERM:
for(VAR_2=0; VAR_2<64; VAR_2++)
VAR_0->idct_permutation[VAR_2]= ((VAR_2&7)<<3) | (VAR_2>>3);
break;
case FF_PARTTRANS_IDCT_PERM:
for(VAR_2=0; VAR_2<64; VAR_2++)
VAR_0->idct_permutation[VAR_2]= (VAR_2&0x24) | ((VAR_2&3)<<3) | ((VAR_2>>3)&3);
break;
case FF_SSE2_IDCT_PERM:
for(VAR_2=0; VAR_2<64; VAR_2++)
VAR_0->idct_permutation[VAR_2]= (VAR_2&0x38) | idct_sse2_row_perm[VAR_2&7];
break;
default:
av_log(VAR_1, AV_LOG_ERROR, "Internal error, IDCT permutation not set\n");
}
}
| [
"void FUNC_0(DSPContext* VAR_0, AVCodecContext *VAR_1)\n{",
"int VAR_2;",
"ff_check_alignment();",
"#if CONFIG_ENCODERS\nif(VAR_1->dct_algo==FF_DCT_FASTINT) {",
"VAR_0->fdct = fdct_ifast;",
"VAR_0->fdct248 = fdct_ifast248;",
"}",
"else if(VAR_1->dct_algo==FF_DCT_FAAN) {",
"VAR_0->fdct = ff_faandct;",
"VAR_0->fdct248 = ff_faandct248;",
"}",
"else {",
"VAR_0->fdct = ff_jpeg_fdct_islow;",
"VAR_0->fdct248 = ff_fdct248_islow;",
"}",
"#endif\nif(VAR_1->lowres==1){",
"if(VAR_1->idct_algo==FF_IDCT_INT || VAR_1->idct_algo==FF_IDCT_AUTO || !CONFIG_H264_DECODER){",
"VAR_0->idct_put= ff_jref_idct4_put;",
"VAR_0->idct_add= ff_jref_idct4_add;",
"}else{",
"VAR_0->idct_put= ff_h264_lowres_idct_put_c;",
"VAR_0->idct_add= ff_h264_lowres_idct_add_c;",
"}",
"VAR_0->idct = j_rev_dct4;",
"VAR_0->idct_permutation_type= FF_NO_IDCT_PERM;",
"}else if(VAR_1->lowres==2){",
"VAR_0->idct_put= ff_jref_idct2_put;",
"VAR_0->idct_add= ff_jref_idct2_add;",
"VAR_0->idct = j_rev_dct2;",
"VAR_0->idct_permutation_type= FF_NO_IDCT_PERM;",
"}else if(VAR_1->lowres==3){",
"VAR_0->idct_put= ff_jref_idct1_put;",
"VAR_0->idct_add= ff_jref_idct1_add;",
"VAR_0->idct = j_rev_dct1;",
"VAR_0->idct_permutation_type= FF_NO_IDCT_PERM;",
"}else{",
"if(VAR_1->idct_algo==FF_IDCT_INT){",
"VAR_0->idct_put= ff_jref_idct_put;",
"VAR_0->idct_add= ff_jref_idct_add;",
"VAR_0->idct = j_rev_dct;",
"VAR_0->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;",
"}else if((CONFIG_VP3_DECODER || CONFIG_VP5_DECODER || CONFIG_VP6_DECODER ) &&",
"VAR_1->idct_algo==FF_IDCT_VP3){",
"VAR_0->idct_put= ff_vp3_idct_put_c;",
"VAR_0->idct_add= ff_vp3_idct_add_c;",
"VAR_0->idct = ff_vp3_idct_c;",
"VAR_0->idct_permutation_type= FF_NO_IDCT_PERM;",
"}else if(VAR_1->idct_algo==FF_IDCT_WMV2){",
"VAR_0->idct_put= ff_wmv2_idct_put_c;",
"VAR_0->idct_add= ff_wmv2_idct_add_c;",
"VAR_0->idct = ff_wmv2_idct_c;",
"VAR_0->idct_permutation_type= FF_NO_IDCT_PERM;",
"}else if(VAR_1->idct_algo==FF_IDCT_FAAN){",
"VAR_0->idct_put= ff_faanidct_put;",
"VAR_0->idct_add= ff_faanidct_add;",
"VAR_0->idct = ff_faanidct;",
"VAR_0->idct_permutation_type= FF_NO_IDCT_PERM;",
"}else if(CONFIG_EATGQ_DECODER && VAR_1->idct_algo==FF_IDCT_EA) {",
"VAR_0->idct_put= ff_ea_idct_put_c;",
"VAR_0->idct_permutation_type= FF_NO_IDCT_PERM;",
"}else{",
"VAR_0->idct_put= ff_simple_idct_put;",
"VAR_0->idct_add= ff_simple_idct_add;",
"VAR_0->idct = ff_simple_idct;",
"VAR_0->idct_permutation_type= FF_NO_IDCT_PERM;",
"}",
"}",
"if (CONFIG_H264_DECODER) {",
"VAR_0->h264_idct_add= ff_h264_idct_add_c;",
"VAR_0->h264_idct8_add= ff_h264_idct8_add_c;",
"VAR_0->h264_idct_dc_add= ff_h264_idct_dc_add_c;",
"VAR_0->h264_idct8_dc_add= ff_h264_idct8_dc_add_c;",
"VAR_0->h264_idct_add16 = ff_h264_idct_add16_c;",
"VAR_0->h264_idct8_add4 = ff_h264_idct8_add4_c;",
"VAR_0->h264_idct_add8 = ff_h264_idct_add8_c;",
"VAR_0->h264_idct_add16intra= ff_h264_idct_add16intra_c;",
"}",
"VAR_0->get_pixels = get_pixels_c;",
"VAR_0->diff_pixels = diff_pixels_c;",
"VAR_0->put_pixels_clamped = put_pixels_clamped_c;",
"VAR_0->put_signed_pixels_clamped = put_signed_pixels_clamped_c;",
"VAR_0->add_pixels_clamped = add_pixels_clamped_c;",
"VAR_0->add_pixels8 = add_pixels8_c;",
"VAR_0->add_pixels4 = add_pixels4_c;",
"VAR_0->sum_abs_dctelem = sum_abs_dctelem_c;",
"VAR_0->gmc1 = gmc1_c;",
"VAR_0->gmc = ff_gmc_c;",
"VAR_0->clear_block = clear_block_c;",
"VAR_0->clear_blocks = clear_blocks_c;",
"VAR_0->pix_sum = pix_sum_c;",
"VAR_0->pix_norm1 = pix_norm1_c;",
"VAR_0->pix_abs[0][0] = pix_abs16_c;",
"VAR_0->pix_abs[0][1] = pix_abs16_x2_c;",
"VAR_0->pix_abs[0][2] = pix_abs16_y2_c;",
"VAR_0->pix_abs[0][3] = pix_abs16_xy2_c;",
"VAR_0->pix_abs[1][0] = pix_abs8_c;",
"VAR_0->pix_abs[1][1] = pix_abs8_x2_c;",
"VAR_0->pix_abs[1][2] = pix_abs8_y2_c;",
"VAR_0->pix_abs[1][3] = pix_abs8_xy2_c;",
"#define dspfunc(PFX, IDX, NUM) \\\nVAR_0->PFX ## _pixels_tab[IDX][0] = PFX ## _pixels ## NUM ## _c; \\",
"VAR_0->PFX ## _pixels_tab[IDX][1] = PFX ## _pixels ## NUM ## _x2_c; \\",
"VAR_0->PFX ## _pixels_tab[IDX][2] = PFX ## _pixels ## NUM ## _y2_c; \\",
"VAR_0->PFX ## _pixels_tab[IDX][3] = PFX ## _pixels ## NUM ## _xy2_c\ndspfunc(put, 0, 16);",
"dspfunc(put_no_rnd, 0, 16);",
"dspfunc(put, 1, 8);",
"dspfunc(put_no_rnd, 1, 8);",
"dspfunc(put, 2, 4);",
"dspfunc(put, 3, 2);",
"dspfunc(avg, 0, 16);",
"dspfunc(avg_no_rnd, 0, 16);",
"dspfunc(avg, 1, 8);",
"dspfunc(avg_no_rnd, 1, 8);",
"dspfunc(avg, 2, 4);",
"dspfunc(avg, 3, 2);",
"#undef dspfunc\nVAR_0->put_no_rnd_pixels_l2[0]= put_no_rnd_pixels16_l2_c;",
"VAR_0->put_no_rnd_pixels_l2[1]= put_no_rnd_pixels8_l2_c;",
"VAR_0->put_tpel_pixels_tab[ 0] = put_tpel_pixels_mc00_c;",
"VAR_0->put_tpel_pixels_tab[ 1] = put_tpel_pixels_mc10_c;",
"VAR_0->put_tpel_pixels_tab[ 2] = put_tpel_pixels_mc20_c;",
"VAR_0->put_tpel_pixels_tab[ 4] = put_tpel_pixels_mc01_c;",
"VAR_0->put_tpel_pixels_tab[ 5] = put_tpel_pixels_mc11_c;",
"VAR_0->put_tpel_pixels_tab[ 6] = put_tpel_pixels_mc21_c;",
"VAR_0->put_tpel_pixels_tab[ 8] = put_tpel_pixels_mc02_c;",
"VAR_0->put_tpel_pixels_tab[ 9] = put_tpel_pixels_mc12_c;",
"VAR_0->put_tpel_pixels_tab[10] = put_tpel_pixels_mc22_c;",
"VAR_0->avg_tpel_pixels_tab[ 0] = avg_tpel_pixels_mc00_c;",
"VAR_0->avg_tpel_pixels_tab[ 1] = avg_tpel_pixels_mc10_c;",
"VAR_0->avg_tpel_pixels_tab[ 2] = avg_tpel_pixels_mc20_c;",
"VAR_0->avg_tpel_pixels_tab[ 4] = avg_tpel_pixels_mc01_c;",
"VAR_0->avg_tpel_pixels_tab[ 5] = avg_tpel_pixels_mc11_c;",
"VAR_0->avg_tpel_pixels_tab[ 6] = avg_tpel_pixels_mc21_c;",
"VAR_0->avg_tpel_pixels_tab[ 8] = avg_tpel_pixels_mc02_c;",
"VAR_0->avg_tpel_pixels_tab[ 9] = avg_tpel_pixels_mc12_c;",
"VAR_0->avg_tpel_pixels_tab[10] = avg_tpel_pixels_mc22_c;",
"#define dspfunc(PFX, IDX, NUM) \\\nVAR_0->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_c; \\",
"VAR_0->PFX ## _pixels_tab[IDX][ 1] = PFX ## NUM ## _mc10_c; \\",
"VAR_0->PFX ## _pixels_tab[IDX][ 2] = PFX ## NUM ## _mc20_c; \\",
"VAR_0->PFX ## _pixels_tab[IDX][ 3] = PFX ## NUM ## _mc30_c; \\",
"VAR_0->PFX ## _pixels_tab[IDX][ 4] = PFX ## NUM ## _mc01_c; \\",
"VAR_0->PFX ## _pixels_tab[IDX][ 5] = PFX ## NUM ## _mc11_c; \\",
"VAR_0->PFX ## _pixels_tab[IDX][ 6] = PFX ## NUM ## _mc21_c; \\",
"VAR_0->PFX ## _pixels_tab[IDX][ 7] = PFX ## NUM ## _mc31_c; \\",
"VAR_0->PFX ## _pixels_tab[IDX][ 8] = PFX ## NUM ## _mc02_c; \\",
"VAR_0->PFX ## _pixels_tab[IDX][ 9] = PFX ## NUM ## _mc12_c; \\",
"VAR_0->PFX ## _pixels_tab[IDX][10] = PFX ## NUM ## _mc22_c; \\",
"VAR_0->PFX ## _pixels_tab[IDX][11] = PFX ## NUM ## _mc32_c; \\",
"VAR_0->PFX ## _pixels_tab[IDX][12] = PFX ## NUM ## _mc03_c; \\",
"VAR_0->PFX ## _pixels_tab[IDX][13] = PFX ## NUM ## _mc13_c; \\",
"VAR_0->PFX ## _pixels_tab[IDX][14] = PFX ## NUM ## _mc23_c; \\",
"VAR_0->PFX ## _pixels_tab[IDX][15] = PFX ## NUM ## _mc33_c\ndspfunc(put_qpel, 0, 16);",
"dspfunc(put_no_rnd_qpel, 0, 16);",
"dspfunc(avg_qpel, 0, 16);",
"dspfunc(put_qpel, 1, 8);",
"dspfunc(put_no_rnd_qpel, 1, 8);",
"dspfunc(avg_qpel, 1, 8);",
"dspfunc(put_h264_qpel, 0, 16);",
"dspfunc(put_h264_qpel, 1, 8);",
"dspfunc(put_h264_qpel, 2, 4);",
"dspfunc(put_h264_qpel, 3, 2);",
"dspfunc(avg_h264_qpel, 0, 16);",
"dspfunc(avg_h264_qpel, 1, 8);",
"dspfunc(avg_h264_qpel, 2, 4);",
"#undef dspfunc\nVAR_0->put_h264_chroma_pixels_tab[0]= put_h264_chroma_mc8_c;",
"VAR_0->put_h264_chroma_pixels_tab[1]= put_h264_chroma_mc4_c;",
"VAR_0->put_h264_chroma_pixels_tab[2]= put_h264_chroma_mc2_c;",
"VAR_0->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_c;",
"VAR_0->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_c;",
"VAR_0->avg_h264_chroma_pixels_tab[2]= avg_h264_chroma_mc2_c;",
"VAR_0->put_no_rnd_vc1_chroma_pixels_tab[0]= put_no_rnd_vc1_chroma_mc8_c;",
"VAR_0->avg_no_rnd_vc1_chroma_pixels_tab[0]= avg_no_rnd_vc1_chroma_mc8_c;",
"VAR_0->weight_h264_pixels_tab[0]= weight_h264_pixels16x16_c;",
"VAR_0->weight_h264_pixels_tab[1]= weight_h264_pixels16x8_c;",
"VAR_0->weight_h264_pixels_tab[2]= weight_h264_pixels8x16_c;",
"VAR_0->weight_h264_pixels_tab[3]= weight_h264_pixels8x8_c;",
"VAR_0->weight_h264_pixels_tab[4]= weight_h264_pixels8x4_c;",
"VAR_0->weight_h264_pixels_tab[5]= weight_h264_pixels4x8_c;",
"VAR_0->weight_h264_pixels_tab[6]= weight_h264_pixels4x4_c;",
"VAR_0->weight_h264_pixels_tab[7]= weight_h264_pixels4x2_c;",
"VAR_0->weight_h264_pixels_tab[8]= weight_h264_pixels2x4_c;",
"VAR_0->weight_h264_pixels_tab[9]= weight_h264_pixels2x2_c;",
"VAR_0->biweight_h264_pixels_tab[0]= biweight_h264_pixels16x16_c;",
"VAR_0->biweight_h264_pixels_tab[1]= biweight_h264_pixels16x8_c;",
"VAR_0->biweight_h264_pixels_tab[2]= biweight_h264_pixels8x16_c;",
"VAR_0->biweight_h264_pixels_tab[3]= biweight_h264_pixels8x8_c;",
"VAR_0->biweight_h264_pixels_tab[4]= biweight_h264_pixels8x4_c;",
"VAR_0->biweight_h264_pixels_tab[5]= biweight_h264_pixels4x8_c;",
"VAR_0->biweight_h264_pixels_tab[6]= biweight_h264_pixels4x4_c;",
"VAR_0->biweight_h264_pixels_tab[7]= biweight_h264_pixels4x2_c;",
"VAR_0->biweight_h264_pixels_tab[8]= biweight_h264_pixels2x4_c;",
"VAR_0->biweight_h264_pixels_tab[9]= biweight_h264_pixels2x2_c;",
"VAR_0->draw_edges = draw_edges_c;",
"#if CONFIG_CAVS_DECODER\nff_cavsdsp_init(VAR_0,VAR_1);",
"#endif\n#if CONFIG_MLP_DECODER || CONFIG_TRUEHD_DECODER\nff_mlp_init(VAR_0, VAR_1);",
"#endif\n#if CONFIG_VC1_DECODER || CONFIG_WMV3_DECODER\nff_vc1dsp_init(VAR_0,VAR_1);",
"#endif\n#if CONFIG_WMV2_DECODER || CONFIG_VC1_DECODER || CONFIG_WMV3_DECODER\nff_intrax8dsp_init(VAR_0,VAR_1);",
"#endif\n#if CONFIG_RV30_DECODER\nff_rv30dsp_init(VAR_0,VAR_1);",
"#endif\n#if CONFIG_RV40_DECODER\nff_rv40dsp_init(VAR_0,VAR_1);",
"VAR_0->put_rv40_qpel_pixels_tab[0][15] = put_rv40_qpel16_mc33_c;",
"VAR_0->avg_rv40_qpel_pixels_tab[0][15] = avg_rv40_qpel16_mc33_c;",
"VAR_0->put_rv40_qpel_pixels_tab[1][15] = put_rv40_qpel8_mc33_c;",
"VAR_0->avg_rv40_qpel_pixels_tab[1][15] = avg_rv40_qpel8_mc33_c;",
"#endif\nVAR_0->put_mspel_pixels_tab[0]= put_mspel8_mc00_c;",
"VAR_0->put_mspel_pixels_tab[1]= put_mspel8_mc10_c;",
"VAR_0->put_mspel_pixels_tab[2]= put_mspel8_mc20_c;",
"VAR_0->put_mspel_pixels_tab[3]= put_mspel8_mc30_c;",
"VAR_0->put_mspel_pixels_tab[4]= put_mspel8_mc02_c;",
"VAR_0->put_mspel_pixels_tab[5]= put_mspel8_mc12_c;",
"VAR_0->put_mspel_pixels_tab[6]= put_mspel8_mc22_c;",
"VAR_0->put_mspel_pixels_tab[7]= put_mspel8_mc32_c;",
"#define SET_CMP_FUNC(name) \\\nVAR_0->name[0]= name ## 16_c;\\",
"VAR_0->name[1]= name ## 8x8_c;",
"SET_CMP_FUNC(hadamard8_diff)\nVAR_0->hadamard8_diff[4]= hadamard8_intra16_c;",
"VAR_0->hadamard8_diff[5]= hadamard8_intra8x8_c;",
"SET_CMP_FUNC(dct_sad)\nSET_CMP_FUNC(dct_max)\n#if CONFIG_GPL\nSET_CMP_FUNC(dct264_sad)\n#endif\nVAR_0->sad[0]= pix_abs16_c;",
"VAR_0->sad[1]= pix_abs8_c;",
"VAR_0->sse[0]= sse16_c;",
"VAR_0->sse[1]= sse8_c;",
"VAR_0->sse[2]= sse4_c;",
"SET_CMP_FUNC(quant_psnr)\nSET_CMP_FUNC(rd)\nSET_CMP_FUNC(bit)\nVAR_0->vsad[0]= vsad16_c;",
"VAR_0->vsad[4]= vsad_intra16_c;",
"VAR_0->vsad[5]= vsad_intra8_c;",
"VAR_0->vsse[0]= vsse16_c;",
"VAR_0->vsse[4]= vsse_intra16_c;",
"VAR_0->vsse[5]= vsse_intra8_c;",
"VAR_0->nsse[0]= nsse16_c;",
"VAR_0->nsse[1]= nsse8_c;",
"#if CONFIG_SNOW_ENCODER\nVAR_0->w53[0]= w53_16_c;",
"VAR_0->w53[1]= w53_8_c;",
"VAR_0->w97[0]= w97_16_c;",
"VAR_0->w97[1]= w97_8_c;",
"#endif\nVAR_0->ssd_int8_vs_int16 = ssd_int8_vs_int16_c;",
"VAR_0->add_bytes= add_bytes_c;",
"VAR_0->add_bytes_l2= add_bytes_l2_c;",
"VAR_0->diff_bytes= diff_bytes_c;",
"VAR_0->add_hfyu_median_prediction= add_hfyu_median_prediction_c;",
"VAR_0->sub_hfyu_median_prediction= sub_hfyu_median_prediction_c;",
"VAR_0->bswap_buf= bswap_buf;",
"#if CONFIG_PNG_DECODER\nVAR_0->add_png_paeth_prediction= ff_add_png_paeth_prediction;",
"#endif\nVAR_0->h264_v_loop_filter_luma= h264_v_loop_filter_luma_c;",
"VAR_0->h264_h_loop_filter_luma= h264_h_loop_filter_luma_c;",
"VAR_0->h264_v_loop_filter_luma_intra= h264_v_loop_filter_luma_intra_c;",
"VAR_0->h264_h_loop_filter_luma_intra= h264_h_loop_filter_luma_intra_c;",
"VAR_0->h264_v_loop_filter_chroma= h264_v_loop_filter_chroma_c;",
"VAR_0->h264_h_loop_filter_chroma= h264_h_loop_filter_chroma_c;",
"VAR_0->h264_v_loop_filter_chroma_intra= h264_v_loop_filter_chroma_intra_c;",
"VAR_0->h264_h_loop_filter_chroma_intra= h264_h_loop_filter_chroma_intra_c;",
"VAR_0->h264_loop_filter_strength= NULL;",
"if (CONFIG_ANY_H263) {",
"VAR_0->h263_h_loop_filter= h263_h_loop_filter_c;",
"VAR_0->h263_v_loop_filter= h263_v_loop_filter_c;",
"}",
"if (CONFIG_VP3_DECODER) {",
"VAR_0->vp3_h_loop_filter= ff_vp3_h_loop_filter_c;",
"VAR_0->vp3_v_loop_filter= ff_vp3_v_loop_filter_c;",
"}",
"if (CONFIG_VP6_DECODER) {",
"VAR_0->vp6_filter_diag4= ff_vp6_filter_diag4_c;",
"}",
"VAR_0->h261_loop_filter= h261_loop_filter_c;",
"VAR_0->try_8x8basis= try_8x8basis_c;",
"VAR_0->add_8x8basis= add_8x8basis_c;",
"#if CONFIG_SNOW_DECODER\nVAR_0->vertical_compose97i = ff_snow_vertical_compose97i;",
"VAR_0->horizontal_compose97i = ff_snow_horizontal_compose97i;",
"VAR_0->inner_add_yblock = ff_snow_inner_add_yblock;",
"#endif\n#if CONFIG_VORBIS_DECODER\nVAR_0->vorbis_inverse_coupling = vorbis_inverse_coupling;",
"#endif\n#if CONFIG_AC3_DECODER\nVAR_0->ac3_downmix = ff_ac3_downmix_c;",
"#endif\n#if CONFIG_FLAC_ENCODER\nVAR_0->flac_compute_autocorr = ff_flac_compute_autocorr;",
"#endif\nVAR_0->vector_fmul = vector_fmul_c;",
"VAR_0->vector_fmul_reverse = vector_fmul_reverse_c;",
"VAR_0->vector_fmul_add_add = ff_vector_fmul_add_add_c;",
"VAR_0->vector_fmul_window = ff_vector_fmul_window_c;",
"VAR_0->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_c;",
"VAR_0->float_to_int16 = ff_float_to_int16_c;",
"VAR_0->float_to_int16_interleave = ff_float_to_int16_interleave_c;",
"VAR_0->add_int16 = add_int16_c;",
"VAR_0->sub_int16 = sub_int16_c;",
"VAR_0->scalarproduct_int16 = scalarproduct_int16_c;",
"VAR_0->shrink[0]= ff_img_copy_plane;",
"VAR_0->shrink[1]= ff_shrink22;",
"VAR_0->shrink[2]= ff_shrink44;",
"VAR_0->shrink[3]= ff_shrink88;",
"VAR_0->prefetch= just_return;",
"memset(VAR_0->put_2tap_qpel_pixels_tab, 0, sizeof(VAR_0->put_2tap_qpel_pixels_tab));",
"memset(VAR_0->avg_2tap_qpel_pixels_tab, 0, sizeof(VAR_0->avg_2tap_qpel_pixels_tab));",
"if (HAVE_MMX) dsputil_init_mmx (VAR_0, VAR_1);",
"if (ARCH_ARM) dsputil_init_arm (VAR_0, VAR_1);",
"if (CONFIG_MLIB) dsputil_init_mlib (VAR_0, VAR_1);",
"if (HAVE_VIS) dsputil_init_vis (VAR_0, VAR_1);",
"if (ARCH_ALPHA) dsputil_init_alpha (VAR_0, VAR_1);",
"if (ARCH_PPC) dsputil_init_ppc (VAR_0, VAR_1);",
"if (HAVE_MMI) dsputil_init_mmi (VAR_0, VAR_1);",
"if (ARCH_SH4) dsputil_init_sh4 (VAR_0, VAR_1);",
"if (ARCH_BFIN) dsputil_init_bfin (VAR_0, VAR_1);",
"for(VAR_2=0; VAR_2<64; VAR_2++){",
"if(!VAR_0->put_2tap_qpel_pixels_tab[0][VAR_2])\nVAR_0->put_2tap_qpel_pixels_tab[0][VAR_2]= VAR_0->put_h264_qpel_pixels_tab[0][VAR_2];",
"if(!VAR_0->avg_2tap_qpel_pixels_tab[0][VAR_2])\nVAR_0->avg_2tap_qpel_pixels_tab[0][VAR_2]= VAR_0->avg_h264_qpel_pixels_tab[0][VAR_2];",
"}",
"switch(VAR_0->idct_permutation_type){",
"case FF_NO_IDCT_PERM:\nfor(VAR_2=0; VAR_2<64; VAR_2++)",
"VAR_0->idct_permutation[VAR_2]= VAR_2;",
"break;",
"case FF_LIBMPEG2_IDCT_PERM:\nfor(VAR_2=0; VAR_2<64; VAR_2++)",
"VAR_0->idct_permutation[VAR_2]= (VAR_2 & 0x38) | ((VAR_2 & 6) >> 1) | ((VAR_2 & 1) << 2);",
"break;",
"case FF_SIMPLE_IDCT_PERM:\nfor(VAR_2=0; VAR_2<64; VAR_2++)",
"VAR_0->idct_permutation[VAR_2]= simple_mmx_permutation[VAR_2];",
"break;",
"case FF_TRANSPOSE_IDCT_PERM:\nfor(VAR_2=0; VAR_2<64; VAR_2++)",
"VAR_0->idct_permutation[VAR_2]= ((VAR_2&7)<<3) | (VAR_2>>3);",
"break;",
"case FF_PARTTRANS_IDCT_PERM:\nfor(VAR_2=0; VAR_2<64; VAR_2++)",
"VAR_0->idct_permutation[VAR_2]= (VAR_2&0x24) | ((VAR_2&3)<<3) | ((VAR_2>>3)&3);",
"break;",
"case FF_SSE2_IDCT_PERM:\nfor(VAR_2=0; VAR_2<64; VAR_2++)",
"VAR_0->idct_permutation[VAR_2]= (VAR_2&0x38) | idct_sse2_row_perm[VAR_2&7];",
"break;",
"default:\nav_log(VAR_1, AV_LOG_ERROR, \"Internal error, IDCT permutation not set\\n\");",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
13,
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39,
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
149
],
[
151
],
[
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165
],
[
167
],
[
171
],
[
173
],
[
175
],
[
177
],
[
179
],
[
181
],
[
183
],
[
185
],
[
187
],
[
189
],
[
191
],
[
193
],
[
195
],
[
197
],
[
203
],
[
205
],
[
207
],
[
209
],
[
211
],
[
213
],
[
215
],
[
217
],
[
221,
223
],
[
225
],
[
227
],
[
229,
233
],
[
235
],
[
237
],
[
239
],
[
241
],
[
243
],
[
247
],
[
249
],
[
251
],
[
253
],
[
255
],
[
257
],
[
259,
263
],
[
265
],
[
269
],
[
271
],
[
273
],
[
275
],
[
277
],
[
279
],
[
281
],
[
283
],
[
285
],
[
289
],
[
291
],
[
293
],
[
295
],
[
297
],
[
299
],
[
301
],
[
303
],
[
305
],
[
309,
311
],
[
313
],
[
315
],
[
317
],
[
319
],
[
321
],
[
323
],
[
325
],
[
327
],
[
329
],
[
331
],
[
333
],
[
335
],
[
337
],
[
339
],
[
341,
345
],
[
347
],
[
351
],
[
357
],
[
359
],
[
363
],
[
369
],
[
371
],
[
373
],
[
375
],
[
377
],
[
379
],
[
381
],
[
385,
387
],
[
389
],
[
391
],
[
393
],
[
395
],
[
397
],
[
399
],
[
401
],
[
405
],
[
407
],
[
409
],
[
411
],
[
413
],
[
415
],
[
417
],
[
419
],
[
421
],
[
423
],
[
425
],
[
427
],
[
429
],
[
431
],
[
433
],
[
435
],
[
437
],
[
439
],
[
441
],
[
443
],
[
447
],
[
451,
453
],
[
455,
459,
461
],
[
463,
465,
467
],
[
469,
471,
473
],
[
475,
477,
479
],
[
481,
483,
485
],
[
487
],
[
489
],
[
491
],
[
493
],
[
495,
499
],
[
501
],
[
503
],
[
505
],
[
507
],
[
509
],
[
511
],
[
513
],
[
517,
519
],
[
521
],
[
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,
587
],
[
591
],
[
593
],
[
595
],
[
597
],
[
599
],
[
601
],
[
603,
605
],
[
607,
611
],
[
613
],
[
615
],
[
617
],
[
619
],
[
621
],
[
623
],
[
625
],
[
627
],
[
631
],
[
633
],
[
635
],
[
637
],
[
641
],
[
643
],
[
645
],
[
647
],
[
649
],
[
651
],
[
653
],
[
657
],
[
661
],
[
663
],
[
667,
669
],
[
671
],
[
673
],
[
675,
679,
681
],
[
683,
685,
687
],
[
689,
691,
693
],
[
695,
697
],
[
699
],
[
701
],
[
703
],
[
705
],
[
707
],
[
709
],
[
711
],
[
713
],
[
715
],
[
719
],
[
721
],
[
723
],
[
725
],
[
729
],
[
733
],
[
735
],
[
739
],
[
741
],
[
743
],
[
745
],
[
747
],
[
749
],
[
751
],
[
753
],
[
755
],
[
759
],
[
761,
763
],
[
765,
767
],
[
769
],
[
773
],
[
775,
777
],
[
779
],
[
781
],
[
783,
785
],
[
787
],
[
789
],
[
791,
793
],
[
795
],
[
797
],
[
799,
801
],
[
803
],
[
805
],
[
807,
809
],
[
811
],
[
813
],
[
815,
817
],
[
819
],
[
821
],
[
823,
825
],
[
827
],
[
829
]
]
|
12,457 | static void qio_channel_websock_handshake_send_res_ok(QIOChannelWebsock *ioc,
const char *key,
Error **errp)
{
char combined_key[QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN +
QIO_CHANNEL_WEBSOCK_GUID_LEN + 1];
char *accept = NULL;
char *date = qio_channel_websock_date_str();
g_strlcpy(combined_key, key, QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN + 1);
g_strlcat(combined_key, QIO_CHANNEL_WEBSOCK_GUID,
QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN +
QIO_CHANNEL_WEBSOCK_GUID_LEN + 1);
/* hash and encode it */
if (qcrypto_hash_base64(QCRYPTO_HASH_ALG_SHA1,
combined_key,
QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN +
QIO_CHANNEL_WEBSOCK_GUID_LEN,
&accept,
errp) < 0) {
qio_channel_websock_handshake_send_res_err(
ioc, QIO_CHANNEL_WEBSOCK_HANDSHAKE_RES_SERVER_ERR);
return;
}
qio_channel_websock_handshake_send_res(
ioc, QIO_CHANNEL_WEBSOCK_HANDSHAKE_RES_OK, date, accept);
g_free(date);
g_free(accept);
}
| true | qemu | 7fc3fcefe2fc5966c6aa1ef4f10e9740d8d73bf2 | static void qio_channel_websock_handshake_send_res_ok(QIOChannelWebsock *ioc,
const char *key,
Error **errp)
{
char combined_key[QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN +
QIO_CHANNEL_WEBSOCK_GUID_LEN + 1];
char *accept = NULL;
char *date = qio_channel_websock_date_str();
g_strlcpy(combined_key, key, QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN + 1);
g_strlcat(combined_key, QIO_CHANNEL_WEBSOCK_GUID,
QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN +
QIO_CHANNEL_WEBSOCK_GUID_LEN + 1);
if (qcrypto_hash_base64(QCRYPTO_HASH_ALG_SHA1,
combined_key,
QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN +
QIO_CHANNEL_WEBSOCK_GUID_LEN,
&accept,
errp) < 0) {
qio_channel_websock_handshake_send_res_err(
ioc, QIO_CHANNEL_WEBSOCK_HANDSHAKE_RES_SERVER_ERR);
return;
}
qio_channel_websock_handshake_send_res(
ioc, QIO_CHANNEL_WEBSOCK_HANDSHAKE_RES_OK, date, accept);
g_free(date);
g_free(accept);
}
| {
"code": [
" char *date = qio_channel_websock_date_str();"
],
"line_no": [
15
]
} | static void FUNC_0(QIOChannelWebsock *VAR_0,
const char *VAR_1,
Error **VAR_2)
{
char VAR_3[QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN +
QIO_CHANNEL_WEBSOCK_GUID_LEN + 1];
char *VAR_4 = NULL;
char *VAR_5 = qio_channel_websock_date_str();
g_strlcpy(VAR_3, VAR_1, QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN + 1);
g_strlcat(VAR_3, QIO_CHANNEL_WEBSOCK_GUID,
QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN +
QIO_CHANNEL_WEBSOCK_GUID_LEN + 1);
if (qcrypto_hash_base64(QCRYPTO_HASH_ALG_SHA1,
VAR_3,
QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN +
QIO_CHANNEL_WEBSOCK_GUID_LEN,
&VAR_4,
VAR_2) < 0) {
qio_channel_websock_handshake_send_res_err(
VAR_0, QIO_CHANNEL_WEBSOCK_HANDSHAKE_RES_SERVER_ERR);
return;
}
qio_channel_websock_handshake_send_res(
VAR_0, QIO_CHANNEL_WEBSOCK_HANDSHAKE_RES_OK, VAR_5, VAR_4);
g_free(VAR_5);
g_free(VAR_4);
}
| [
"static void FUNC_0(QIOChannelWebsock *VAR_0,\nconst char *VAR_1,\nError **VAR_2)\n{",
"char VAR_3[QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN +\nQIO_CHANNEL_WEBSOCK_GUID_LEN + 1];",
"char *VAR_4 = NULL;",
"char *VAR_5 = qio_channel_websock_date_str();",
"g_strlcpy(VAR_3, VAR_1, QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN + 1);",
"g_strlcat(VAR_3, QIO_CHANNEL_WEBSOCK_GUID,\nQIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN +\nQIO_CHANNEL_WEBSOCK_GUID_LEN + 1);",
"if (qcrypto_hash_base64(QCRYPTO_HASH_ALG_SHA1,\nVAR_3,\nQIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN +\nQIO_CHANNEL_WEBSOCK_GUID_LEN,\n&VAR_4,\nVAR_2) < 0) {",
"qio_channel_websock_handshake_send_res_err(\nVAR_0, QIO_CHANNEL_WEBSOCK_HANDSHAKE_RES_SERVER_ERR);",
"return;",
"}",
"qio_channel_websock_handshake_send_res(\nVAR_0, QIO_CHANNEL_WEBSOCK_HANDSHAKE_RES_OK, VAR_5, VAR_4);",
"g_free(VAR_5);",
"g_free(VAR_4);",
"}"
]
| [
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5,
7
],
[
9,
11
],
[
13
],
[
15
],
[
19
],
[
21,
23,
25
],
[
31,
33,
35,
37,
39,
41
],
[
43,
45
],
[
47
],
[
49
],
[
53,
55
],
[
59
],
[
61
],
[
63
]
]
|
12,458 | static int a64_write_trailer(struct AVFormatContext *s)
{
A64MuxerContext *c = s->priv_data;
AVPacket pkt;
/* need to flush last packet? */
if(c->interleaved) a64_write_packet(s, &pkt);
return 0;
}
| true | FFmpeg | 8731c86d03d062ad19f098b77ab1f1bc4ad7c406 | static int a64_write_trailer(struct AVFormatContext *s)
{
A64MuxerContext *c = s->priv_data;
AVPacket pkt;
if(c->interleaved) a64_write_packet(s, &pkt);
return 0;
}
| {
"code": [
" AVPacket pkt;"
],
"line_no": [
7
]
} | static int FUNC_0(struct AVFormatContext *VAR_0)
{
A64MuxerContext *c = VAR_0->priv_data;
AVPacket pkt;
if(c->interleaved) a64_write_packet(VAR_0, &pkt);
return 0;
}
| [
"static int FUNC_0(struct AVFormatContext *VAR_0)\n{",
"A64MuxerContext *c = VAR_0->priv_data;",
"AVPacket pkt;",
"if(c->interleaved) a64_write_packet(VAR_0, &pkt);",
"return 0;",
"}"
]
| [
0,
0,
1,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
15
]
]
|
12,459 | void vnc_display_open(const char *id, Error **errp)
{
VncDisplay *vs = vnc_display_find(id);
QemuOpts *opts = qemu_opts_find(&qemu_vnc_opts, id);
QemuOpts *sopts, *wsopts;
const char *share, *device_id;
QemuConsole *con;
bool password = false;
bool reverse = false;
const char *vnc;
const char *has_to;
char *h;
bool has_ipv4 = false;
bool has_ipv6 = false;
const char *websocket;
bool tls = false, x509 = false;
#ifdef CONFIG_VNC_TLS
const char *path;
#endif
bool sasl = false;
#ifdef CONFIG_VNC_SASL
int saslErr;
#endif
#if defined(CONFIG_VNC_TLS) || defined(CONFIG_VNC_SASL)
int acl = 0;
#endif
int lock_key_sync = 1;
if (!vs) {
error_setg(errp, "VNC display not active");
return;
}
vnc_display_close(vs);
if (!opts) {
return;
}
vnc = qemu_opt_get(opts, "vnc");
if (!vnc || strcmp(vnc, "none") == 0) {
return;
}
sopts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort);
wsopts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort);
h = strrchr(vnc, ':');
if (h) {
char *host = g_strndup(vnc, h - vnc);
qemu_opt_set(sopts, "host", host, &error_abort);
qemu_opt_set(wsopts, "host", host, &error_abort);
qemu_opt_set(sopts, "port", h+1, &error_abort);
g_free(host);
} else {
error_setg(errp, "no vnc port specified");
goto fail;
}
has_to = qemu_opt_get(opts, "to");
has_ipv4 = qemu_opt_get_bool(opts, "ipv4", false);
has_ipv6 = qemu_opt_get_bool(opts, "ipv6", false);
if (has_to) {
qemu_opt_set(sopts, "to", has_to, &error_abort);
qemu_opt_set(wsopts, "to", has_to, &error_abort);
}
if (has_ipv4) {
qemu_opt_set(sopts, "ipv4", "on", &error_abort);
qemu_opt_set(wsopts, "ipv4", "on", &error_abort);
}
if (has_ipv6) {
qemu_opt_set(sopts, "ipv6", "on", &error_abort);
qemu_opt_set(wsopts, "ipv6", "on", &error_abort);
}
password = qemu_opt_get_bool(opts, "password", false);
if (password && fips_get_state()) {
error_setg(errp,
"VNC password auth disabled due to FIPS mode, "
"consider using the VeNCrypt or SASL authentication "
"methods as an alternative");
goto fail;
}
reverse = qemu_opt_get_bool(opts, "reverse", false);
lock_key_sync = qemu_opt_get_bool(opts, "lock-key-sync", true);
sasl = qemu_opt_get_bool(opts, "sasl", false);
#ifndef CONFIG_VNC_SASL
if (sasl) {
error_setg(errp, "VNC SASL auth requires cyrus-sasl support");
goto fail;
}
#endif /* CONFIG_VNC_SASL */
tls = qemu_opt_get_bool(opts, "tls", false);
#ifdef CONFIG_VNC_TLS
path = qemu_opt_get(opts, "x509");
if (!path) {
path = qemu_opt_get(opts, "x509verify");
if (path) {
vs->tls.x509verify = true;
}
}
if (path) {
x509 = true;
if (vnc_tls_set_x509_creds_dir(vs, path) < 0) {
error_setg(errp, "Failed to find x509 certificates/keys in %s",
path);
goto fail;
}
}
#else /* ! CONFIG_VNC_TLS */
if (tls) {
error_setg(errp, "VNC TLS auth requires gnutls support");
goto fail;
}
#endif /* ! CONFIG_VNC_TLS */
#if defined(CONFIG_VNC_TLS) || defined(CONFIG_VNC_SASL)
acl = qemu_opt_get_bool(opts, "acl", false);
#endif
share = qemu_opt_get(opts, "share");
if (share) {
if (strcmp(share, "ignore") == 0) {
vs->share_policy = VNC_SHARE_POLICY_IGNORE;
} else if (strcmp(share, "allow-exclusive") == 0) {
vs->share_policy = VNC_SHARE_POLICY_ALLOW_EXCLUSIVE;
} else if (strcmp(share, "force-shared") == 0) {
vs->share_policy = VNC_SHARE_POLICY_FORCE_SHARED;
} else {
error_setg(errp, "unknown vnc share= option");
goto fail;
}
} else {
vs->share_policy = VNC_SHARE_POLICY_ALLOW_EXCLUSIVE;
}
vs->connections_limit = qemu_opt_get_number(opts, "connections", 32);
websocket = qemu_opt_get(opts, "websocket");
if (websocket) {
#ifdef CONFIG_VNC_WS
vs->ws_enabled = true;
qemu_opt_set(wsopts, "port", websocket, &error_abort);
#else /* ! CONFIG_VNC_WS */
error_setg(errp, "Websockets protocol requires gnutls support");
goto fail;
#endif /* ! CONFIG_VNC_WS */
}
#ifdef CONFIG_VNC_JPEG
vs->lossy = qemu_opt_get_bool(opts, "lossy", false);
#endif
vs->non_adaptive = qemu_opt_get_bool(opts, "non-adaptive", false);
/* adaptive updates are only used with tight encoding and
* if lossy updates are enabled so we can disable all the
* calculations otherwise */
if (!vs->lossy) {
vs->non_adaptive = true;
}
#ifdef CONFIG_VNC_TLS
if (acl && x509 && vs->tls.x509verify) {
char *aclname;
if (strcmp(vs->id, "default") == 0) {
aclname = g_strdup("vnc.x509dname");
} else {
aclname = g_strdup_printf("vnc.%s.x509dname", vs->id);
}
vs->tls.acl = qemu_acl_init(aclname);
if (!vs->tls.acl) {
fprintf(stderr, "Failed to create x509 dname ACL\n");
exit(1);
}
g_free(aclname);
}
#endif
#ifdef CONFIG_VNC_SASL
if (acl && sasl) {
char *aclname;
if (strcmp(vs->id, "default") == 0) {
aclname = g_strdup("vnc.username");
} else {
aclname = g_strdup_printf("vnc.%s.username", vs->id);
}
vs->sasl.acl = qemu_acl_init(aclname);
if (!vs->sasl.acl) {
fprintf(stderr, "Failed to create username ACL\n");
exit(1);
}
g_free(aclname);
}
#endif
vnc_display_setup_auth(vs, password, sasl, tls, x509, websocket);
#ifdef CONFIG_VNC_SASL
if ((saslErr = sasl_server_init(NULL, "qemu")) != SASL_OK) {
error_setg(errp, "Failed to initialize SASL auth: %s",
sasl_errstring(saslErr, NULL, NULL));
goto fail;
}
#endif
vs->lock_key_sync = lock_key_sync;
device_id = qemu_opt_get(opts, "display");
if (device_id) {
DeviceState *dev;
int head = qemu_opt_get_number(opts, "head", 0);
dev = qdev_find_recursive(sysbus_get_default(), device_id);
if (dev == NULL) {
error_setg(errp, "Device '%s' not found", device_id);
goto fail;
}
con = qemu_console_lookup_by_device(dev, head);
if (con == NULL) {
error_setg(errp, "Device %s is not bound to a QemuConsole",
device_id);
goto fail;
}
} else {
con = NULL;
}
if (con != vs->dcl.con) {
unregister_displaychangelistener(&vs->dcl);
vs->dcl.con = con;
register_displaychangelistener(&vs->dcl);
}
if (reverse) {
/* connect to viewer */
int csock;
vs->lsock = -1;
#ifdef CONFIG_VNC_WS
vs->lwebsock = -1;
#endif
if (strncmp(vnc, "unix:", 5) == 0) {
csock = unix_connect(vnc+5, errp);
} else {
csock = inet_connect(vnc, errp);
}
if (csock < 0) {
goto fail;
}
vnc_connect(vs, csock, false, false);
} else {
/* listen for connects */
if (strncmp(vnc, "unix:", 5) == 0) {
vs->lsock = unix_listen(vnc+5, NULL, 0, errp);
vs->is_unix = true;
} else {
vs->lsock = inet_listen_opts(sopts, 5900, errp);
if (vs->lsock < 0) {
goto fail;
}
#ifdef CONFIG_VNC_WS
if (vs->ws_enabled) {
vs->lwebsock = inet_listen_opts(wsopts, 0, errp);
if (vs->lwebsock < 0) {
if (vs->lsock != -1) {
close(vs->lsock);
vs->lsock = -1;
}
goto fail;
}
}
#endif /* CONFIG_VNC_WS */
}
vs->enabled = true;
qemu_set_fd_handler2(vs->lsock, NULL,
vnc_listen_regular_read, NULL, vs);
#ifdef CONFIG_VNC_WS
if (vs->ws_enabled) {
qemu_set_fd_handler2(vs->lwebsock, NULL,
vnc_listen_websocket_read, NULL, vs);
}
#endif /* CONFIG_VNC_WS */
}
qemu_opts_del(sopts);
qemu_opts_del(wsopts);
return;
fail:
qemu_opts_del(sopts);
qemu_opts_del(wsopts);
vs->enabled = false;
#ifdef CONFIG_VNC_WS
vs->ws_enabled = false;
#endif /* CONFIG_VNC_WS */
}
| true | qemu | 274c3b52e10466a4771d591f6298ef61e8354ce0 | void vnc_display_open(const char *id, Error **errp)
{
VncDisplay *vs = vnc_display_find(id);
QemuOpts *opts = qemu_opts_find(&qemu_vnc_opts, id);
QemuOpts *sopts, *wsopts;
const char *share, *device_id;
QemuConsole *con;
bool password = false;
bool reverse = false;
const char *vnc;
const char *has_to;
char *h;
bool has_ipv4 = false;
bool has_ipv6 = false;
const char *websocket;
bool tls = false, x509 = false;
#ifdef CONFIG_VNC_TLS
const char *path;
#endif
bool sasl = false;
#ifdef CONFIG_VNC_SASL
int saslErr;
#endif
#if defined(CONFIG_VNC_TLS) || defined(CONFIG_VNC_SASL)
int acl = 0;
#endif
int lock_key_sync = 1;
if (!vs) {
error_setg(errp, "VNC display not active");
return;
}
vnc_display_close(vs);
if (!opts) {
return;
}
vnc = qemu_opt_get(opts, "vnc");
if (!vnc || strcmp(vnc, "none") == 0) {
return;
}
sopts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort);
wsopts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort);
h = strrchr(vnc, ':');
if (h) {
char *host = g_strndup(vnc, h - vnc);
qemu_opt_set(sopts, "host", host, &error_abort);
qemu_opt_set(wsopts, "host", host, &error_abort);
qemu_opt_set(sopts, "port", h+1, &error_abort);
g_free(host);
} else {
error_setg(errp, "no vnc port specified");
goto fail;
}
has_to = qemu_opt_get(opts, "to");
has_ipv4 = qemu_opt_get_bool(opts, "ipv4", false);
has_ipv6 = qemu_opt_get_bool(opts, "ipv6", false);
if (has_to) {
qemu_opt_set(sopts, "to", has_to, &error_abort);
qemu_opt_set(wsopts, "to", has_to, &error_abort);
}
if (has_ipv4) {
qemu_opt_set(sopts, "ipv4", "on", &error_abort);
qemu_opt_set(wsopts, "ipv4", "on", &error_abort);
}
if (has_ipv6) {
qemu_opt_set(sopts, "ipv6", "on", &error_abort);
qemu_opt_set(wsopts, "ipv6", "on", &error_abort);
}
password = qemu_opt_get_bool(opts, "password", false);
if (password && fips_get_state()) {
error_setg(errp,
"VNC password auth disabled due to FIPS mode, "
"consider using the VeNCrypt or SASL authentication "
"methods as an alternative");
goto fail;
}
reverse = qemu_opt_get_bool(opts, "reverse", false);
lock_key_sync = qemu_opt_get_bool(opts, "lock-key-sync", true);
sasl = qemu_opt_get_bool(opts, "sasl", false);
#ifndef CONFIG_VNC_SASL
if (sasl) {
error_setg(errp, "VNC SASL auth requires cyrus-sasl support");
goto fail;
}
#endif
tls = qemu_opt_get_bool(opts, "tls", false);
#ifdef CONFIG_VNC_TLS
path = qemu_opt_get(opts, "x509");
if (!path) {
path = qemu_opt_get(opts, "x509verify");
if (path) {
vs->tls.x509verify = true;
}
}
if (path) {
x509 = true;
if (vnc_tls_set_x509_creds_dir(vs, path) < 0) {
error_setg(errp, "Failed to find x509 certificates/keys in %s",
path);
goto fail;
}
}
#else
if (tls) {
error_setg(errp, "VNC TLS auth requires gnutls support");
goto fail;
}
#endif
#if defined(CONFIG_VNC_TLS) || defined(CONFIG_VNC_SASL)
acl = qemu_opt_get_bool(opts, "acl", false);
#endif
share = qemu_opt_get(opts, "share");
if (share) {
if (strcmp(share, "ignore") == 0) {
vs->share_policy = VNC_SHARE_POLICY_IGNORE;
} else if (strcmp(share, "allow-exclusive") == 0) {
vs->share_policy = VNC_SHARE_POLICY_ALLOW_EXCLUSIVE;
} else if (strcmp(share, "force-shared") == 0) {
vs->share_policy = VNC_SHARE_POLICY_FORCE_SHARED;
} else {
error_setg(errp, "unknown vnc share= option");
goto fail;
}
} else {
vs->share_policy = VNC_SHARE_POLICY_ALLOW_EXCLUSIVE;
}
vs->connections_limit = qemu_opt_get_number(opts, "connections", 32);
websocket = qemu_opt_get(opts, "websocket");
if (websocket) {
#ifdef CONFIG_VNC_WS
vs->ws_enabled = true;
qemu_opt_set(wsopts, "port", websocket, &error_abort);
#else
error_setg(errp, "Websockets protocol requires gnutls support");
goto fail;
#endif
}
#ifdef CONFIG_VNC_JPEG
vs->lossy = qemu_opt_get_bool(opts, "lossy", false);
#endif
vs->non_adaptive = qemu_opt_get_bool(opts, "non-adaptive", false);
if (!vs->lossy) {
vs->non_adaptive = true;
}
#ifdef CONFIG_VNC_TLS
if (acl && x509 && vs->tls.x509verify) {
char *aclname;
if (strcmp(vs->id, "default") == 0) {
aclname = g_strdup("vnc.x509dname");
} else {
aclname = g_strdup_printf("vnc.%s.x509dname", vs->id);
}
vs->tls.acl = qemu_acl_init(aclname);
if (!vs->tls.acl) {
fprintf(stderr, "Failed to create x509 dname ACL\n");
exit(1);
}
g_free(aclname);
}
#endif
#ifdef CONFIG_VNC_SASL
if (acl && sasl) {
char *aclname;
if (strcmp(vs->id, "default") == 0) {
aclname = g_strdup("vnc.username");
} else {
aclname = g_strdup_printf("vnc.%s.username", vs->id);
}
vs->sasl.acl = qemu_acl_init(aclname);
if (!vs->sasl.acl) {
fprintf(stderr, "Failed to create username ACL\n");
exit(1);
}
g_free(aclname);
}
#endif
vnc_display_setup_auth(vs, password, sasl, tls, x509, websocket);
#ifdef CONFIG_VNC_SASL
if ((saslErr = sasl_server_init(NULL, "qemu")) != SASL_OK) {
error_setg(errp, "Failed to initialize SASL auth: %s",
sasl_errstring(saslErr, NULL, NULL));
goto fail;
}
#endif
vs->lock_key_sync = lock_key_sync;
device_id = qemu_opt_get(opts, "display");
if (device_id) {
DeviceState *dev;
int head = qemu_opt_get_number(opts, "head", 0);
dev = qdev_find_recursive(sysbus_get_default(), device_id);
if (dev == NULL) {
error_setg(errp, "Device '%s' not found", device_id);
goto fail;
}
con = qemu_console_lookup_by_device(dev, head);
if (con == NULL) {
error_setg(errp, "Device %s is not bound to a QemuConsole",
device_id);
goto fail;
}
} else {
con = NULL;
}
if (con != vs->dcl.con) {
unregister_displaychangelistener(&vs->dcl);
vs->dcl.con = con;
register_displaychangelistener(&vs->dcl);
}
if (reverse) {
int csock;
vs->lsock = -1;
#ifdef CONFIG_VNC_WS
vs->lwebsock = -1;
#endif
if (strncmp(vnc, "unix:", 5) == 0) {
csock = unix_connect(vnc+5, errp);
} else {
csock = inet_connect(vnc, errp);
}
if (csock < 0) {
goto fail;
}
vnc_connect(vs, csock, false, false);
} else {
if (strncmp(vnc, "unix:", 5) == 0) {
vs->lsock = unix_listen(vnc+5, NULL, 0, errp);
vs->is_unix = true;
} else {
vs->lsock = inet_listen_opts(sopts, 5900, errp);
if (vs->lsock < 0) {
goto fail;
}
#ifdef CONFIG_VNC_WS
if (vs->ws_enabled) {
vs->lwebsock = inet_listen_opts(wsopts, 0, errp);
if (vs->lwebsock < 0) {
if (vs->lsock != -1) {
close(vs->lsock);
vs->lsock = -1;
}
goto fail;
}
}
#endif
}
vs->enabled = true;
qemu_set_fd_handler2(vs->lsock, NULL,
vnc_listen_regular_read, NULL, vs);
#ifdef CONFIG_VNC_WS
if (vs->ws_enabled) {
qemu_set_fd_handler2(vs->lwebsock, NULL,
vnc_listen_websocket_read, NULL, vs);
}
#endif
}
qemu_opts_del(sopts);
qemu_opts_del(wsopts);
return;
fail:
qemu_opts_del(sopts);
qemu_opts_del(wsopts);
vs->enabled = false;
#ifdef CONFIG_VNC_WS
vs->ws_enabled = false;
#endif
}
| {
"code": [
" char *host = g_strndup(vnc, h - vnc);"
],
"line_no": [
95
]
} | void FUNC_0(const char *VAR_0, Error **VAR_1)
{
VncDisplay *vs = vnc_display_find(VAR_0);
QemuOpts *opts = qemu_opts_find(&qemu_vnc_opts, VAR_0);
QemuOpts *sopts, *wsopts;
const char *VAR_2, *VAR_3;
QemuConsole *con;
bool password = false;
bool reverse = false;
const char *VAR_4;
const char *VAR_5;
char *VAR_6;
bool has_ipv4 = false;
bool has_ipv6 = false;
const char *VAR_7;
bool tls = false, x509 = false;
#ifdef CONFIG_VNC_TLS
const char *path;
#endif
bool sasl = false;
#ifdef CONFIG_VNC_SASL
int saslErr;
#endif
#if defined(CONFIG_VNC_TLS) || defined(CONFIG_VNC_SASL)
int acl = 0;
#endif
int VAR_8 = 1;
if (!vs) {
error_setg(VAR_1, "VNC display not active");
return;
}
vnc_display_close(vs);
if (!opts) {
return;
}
VAR_4 = qemu_opt_get(opts, "VAR_4");
if (!VAR_4 || strcmp(VAR_4, "none") == 0) {
return;
}
sopts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort);
wsopts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort);
VAR_6 = strrchr(VAR_4, ':');
if (VAR_6) {
char *VAR_9 = g_strndup(VAR_4, VAR_6 - VAR_4);
qemu_opt_set(sopts, "VAR_9", VAR_9, &error_abort);
qemu_opt_set(wsopts, "VAR_9", VAR_9, &error_abort);
qemu_opt_set(sopts, "port", VAR_6+1, &error_abort);
g_free(VAR_9);
} else {
error_setg(VAR_1, "no VAR_4 port specified");
goto fail;
}
VAR_5 = qemu_opt_get(opts, "to");
has_ipv4 = qemu_opt_get_bool(opts, "ipv4", false);
has_ipv6 = qemu_opt_get_bool(opts, "ipv6", false);
if (VAR_5) {
qemu_opt_set(sopts, "to", VAR_5, &error_abort);
qemu_opt_set(wsopts, "to", VAR_5, &error_abort);
}
if (has_ipv4) {
qemu_opt_set(sopts, "ipv4", "on", &error_abort);
qemu_opt_set(wsopts, "ipv4", "on", &error_abort);
}
if (has_ipv6) {
qemu_opt_set(sopts, "ipv6", "on", &error_abort);
qemu_opt_set(wsopts, "ipv6", "on", &error_abort);
}
password = qemu_opt_get_bool(opts, "password", false);
if (password && fips_get_state()) {
error_setg(VAR_1,
"VNC password auth disabled due to FIPS mode, "
"consider using the VeNCrypt or SASL authentication "
"methods as an alternative");
goto fail;
}
reverse = qemu_opt_get_bool(opts, "reverse", false);
VAR_8 = qemu_opt_get_bool(opts, "lock-key-sync", true);
sasl = qemu_opt_get_bool(opts, "sasl", false);
#ifndef CONFIG_VNC_SASL
if (sasl) {
error_setg(VAR_1, "VNC SASL auth requires cyrus-sasl support");
goto fail;
}
#endif
tls = qemu_opt_get_bool(opts, "tls", false);
#ifdef CONFIG_VNC_TLS
path = qemu_opt_get(opts, "x509");
if (!path) {
path = qemu_opt_get(opts, "x509verify");
if (path) {
vs->tls.x509verify = true;
}
}
if (path) {
x509 = true;
if (vnc_tls_set_x509_creds_dir(vs, path) < 0) {
error_setg(VAR_1, "Failed to find x509 certificates/keys in %s",
path);
goto fail;
}
}
#else
if (tls) {
error_setg(VAR_1, "VNC TLS auth requires gnutls support");
goto fail;
}
#endif
#if defined(CONFIG_VNC_TLS) || defined(CONFIG_VNC_SASL)
acl = qemu_opt_get_bool(opts, "acl", false);
#endif
VAR_2 = qemu_opt_get(opts, "VAR_2");
if (VAR_2) {
if (strcmp(VAR_2, "ignore") == 0) {
vs->share_policy = VNC_SHARE_POLICY_IGNORE;
} else if (strcmp(VAR_2, "allow-exclusive") == 0) {
vs->share_policy = VNC_SHARE_POLICY_ALLOW_EXCLUSIVE;
} else if (strcmp(VAR_2, "force-shared") == 0) {
vs->share_policy = VNC_SHARE_POLICY_FORCE_SHARED;
} else {
error_setg(VAR_1, "unknown VAR_4 VAR_2= option");
goto fail;
}
} else {
vs->share_policy = VNC_SHARE_POLICY_ALLOW_EXCLUSIVE;
}
vs->connections_limit = qemu_opt_get_number(opts, "connections", 32);
VAR_7 = qemu_opt_get(opts, "VAR_7");
if (VAR_7) {
#ifdef CONFIG_VNC_WS
vs->ws_enabled = true;
qemu_opt_set(wsopts, "port", VAR_7, &error_abort);
#else
error_setg(VAR_1, "Websockets protocol requires gnutls support");
goto fail;
#endif
}
#ifdef CONFIG_VNC_JPEG
vs->lossy = qemu_opt_get_bool(opts, "lossy", false);
#endif
vs->non_adaptive = qemu_opt_get_bool(opts, "non-adaptive", false);
if (!vs->lossy) {
vs->non_adaptive = true;
}
#ifdef CONFIG_VNC_TLS
if (acl && x509 && vs->tls.x509verify) {
char *aclname;
if (strcmp(vs->VAR_0, "default") == 0) {
aclname = g_strdup("VAR_4.x509dname");
} else {
aclname = g_strdup_printf("VAR_4.%s.x509dname", vs->VAR_0);
}
vs->tls.acl = qemu_acl_init(aclname);
if (!vs->tls.acl) {
fprintf(stderr, "Failed to create x509 dname ACL\n");
exit(1);
}
g_free(aclname);
}
#endif
#ifdef CONFIG_VNC_SASL
if (acl && sasl) {
char *aclname;
if (strcmp(vs->VAR_0, "default") == 0) {
aclname = g_strdup("VAR_4.username");
} else {
aclname = g_strdup_printf("VAR_4.%s.username", vs->VAR_0);
}
vs->sasl.acl = qemu_acl_init(aclname);
if (!vs->sasl.acl) {
fprintf(stderr, "Failed to create username ACL\n");
exit(1);
}
g_free(aclname);
}
#endif
vnc_display_setup_auth(vs, password, sasl, tls, x509, VAR_7);
#ifdef CONFIG_VNC_SASL
if ((saslErr = sasl_server_init(NULL, "qemu")) != SASL_OK) {
error_setg(VAR_1, "Failed to initialize SASL auth: %s",
sasl_errstring(saslErr, NULL, NULL));
goto fail;
}
#endif
vs->VAR_8 = VAR_8;
VAR_3 = qemu_opt_get(opts, "display");
if (VAR_3) {
DeviceState *dev;
int VAR_10 = qemu_opt_get_number(opts, "VAR_10", 0);
dev = qdev_find_recursive(sysbus_get_default(), VAR_3);
if (dev == NULL) {
error_setg(VAR_1, "Device '%s' not found", VAR_3);
goto fail;
}
con = qemu_console_lookup_by_device(dev, VAR_10);
if (con == NULL) {
error_setg(VAR_1, "Device %s is not bound to a QemuConsole",
VAR_3);
goto fail;
}
} else {
con = NULL;
}
if (con != vs->dcl.con) {
unregister_displaychangelistener(&vs->dcl);
vs->dcl.con = con;
register_displaychangelistener(&vs->dcl);
}
if (reverse) {
int VAR_11;
vs->lsock = -1;
#ifdef CONFIG_VNC_WS
vs->lwebsock = -1;
#endif
if (strncmp(VAR_4, "unix:", 5) == 0) {
VAR_11 = unix_connect(VAR_4+5, VAR_1);
} else {
VAR_11 = inet_connect(VAR_4, VAR_1);
}
if (VAR_11 < 0) {
goto fail;
}
vnc_connect(vs, VAR_11, false, false);
} else {
if (strncmp(VAR_4, "unix:", 5) == 0) {
vs->lsock = unix_listen(VAR_4+5, NULL, 0, VAR_1);
vs->is_unix = true;
} else {
vs->lsock = inet_listen_opts(sopts, 5900, VAR_1);
if (vs->lsock < 0) {
goto fail;
}
#ifdef CONFIG_VNC_WS
if (vs->ws_enabled) {
vs->lwebsock = inet_listen_opts(wsopts, 0, VAR_1);
if (vs->lwebsock < 0) {
if (vs->lsock != -1) {
close(vs->lsock);
vs->lsock = -1;
}
goto fail;
}
}
#endif
}
vs->enabled = true;
qemu_set_fd_handler2(vs->lsock, NULL,
vnc_listen_regular_read, NULL, vs);
#ifdef CONFIG_VNC_WS
if (vs->ws_enabled) {
qemu_set_fd_handler2(vs->lwebsock, NULL,
vnc_listen_websocket_read, NULL, vs);
}
#endif
}
qemu_opts_del(sopts);
qemu_opts_del(wsopts);
return;
fail:
qemu_opts_del(sopts);
qemu_opts_del(wsopts);
vs->enabled = false;
#ifdef CONFIG_VNC_WS
vs->ws_enabled = false;
#endif
}
| [
"void FUNC_0(const char *VAR_0, Error **VAR_1)\n{",
"VncDisplay *vs = vnc_display_find(VAR_0);",
"QemuOpts *opts = qemu_opts_find(&qemu_vnc_opts, VAR_0);",
"QemuOpts *sopts, *wsopts;",
"const char *VAR_2, *VAR_3;",
"QemuConsole *con;",
"bool password = false;",
"bool reverse = false;",
"const char *VAR_4;",
"const char *VAR_5;",
"char *VAR_6;",
"bool has_ipv4 = false;",
"bool has_ipv6 = false;",
"const char *VAR_7;",
"bool tls = false, x509 = false;",
"#ifdef CONFIG_VNC_TLS\nconst char *path;",
"#endif\nbool sasl = false;",
"#ifdef CONFIG_VNC_SASL\nint saslErr;",
"#endif\n#if defined(CONFIG_VNC_TLS) || defined(CONFIG_VNC_SASL)\nint acl = 0;",
"#endif\nint VAR_8 = 1;",
"if (!vs) {",
"error_setg(VAR_1, \"VNC display not active\");",
"return;",
"}",
"vnc_display_close(vs);",
"if (!opts) {",
"return;",
"}",
"VAR_4 = qemu_opt_get(opts, \"VAR_4\");",
"if (!VAR_4 || strcmp(VAR_4, \"none\") == 0) {",
"return;",
"}",
"sopts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort);",
"wsopts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort);",
"VAR_6 = strrchr(VAR_4, ':');",
"if (VAR_6) {",
"char *VAR_9 = g_strndup(VAR_4, VAR_6 - VAR_4);",
"qemu_opt_set(sopts, \"VAR_9\", VAR_9, &error_abort);",
"qemu_opt_set(wsopts, \"VAR_9\", VAR_9, &error_abort);",
"qemu_opt_set(sopts, \"port\", VAR_6+1, &error_abort);",
"g_free(VAR_9);",
"} else {",
"error_setg(VAR_1, \"no VAR_4 port specified\");",
"goto fail;",
"}",
"VAR_5 = qemu_opt_get(opts, \"to\");",
"has_ipv4 = qemu_opt_get_bool(opts, \"ipv4\", false);",
"has_ipv6 = qemu_opt_get_bool(opts, \"ipv6\", false);",
"if (VAR_5) {",
"qemu_opt_set(sopts, \"to\", VAR_5, &error_abort);",
"qemu_opt_set(wsopts, \"to\", VAR_5, &error_abort);",
"}",
"if (has_ipv4) {",
"qemu_opt_set(sopts, \"ipv4\", \"on\", &error_abort);",
"qemu_opt_set(wsopts, \"ipv4\", \"on\", &error_abort);",
"}",
"if (has_ipv6) {",
"qemu_opt_set(sopts, \"ipv6\", \"on\", &error_abort);",
"qemu_opt_set(wsopts, \"ipv6\", \"on\", &error_abort);",
"}",
"password = qemu_opt_get_bool(opts, \"password\", false);",
"if (password && fips_get_state()) {",
"error_setg(VAR_1,\n\"VNC password auth disabled due to FIPS mode, \"\n\"consider using the VeNCrypt or SASL authentication \"\n\"methods as an alternative\");",
"goto fail;",
"}",
"reverse = qemu_opt_get_bool(opts, \"reverse\", false);",
"VAR_8 = qemu_opt_get_bool(opts, \"lock-key-sync\", true);",
"sasl = qemu_opt_get_bool(opts, \"sasl\", false);",
"#ifndef CONFIG_VNC_SASL\nif (sasl) {",
"error_setg(VAR_1, \"VNC SASL auth requires cyrus-sasl support\");",
"goto fail;",
"}",
"#endif\ntls = qemu_opt_get_bool(opts, \"tls\", false);",
"#ifdef CONFIG_VNC_TLS\npath = qemu_opt_get(opts, \"x509\");",
"if (!path) {",
"path = qemu_opt_get(opts, \"x509verify\");",
"if (path) {",
"vs->tls.x509verify = true;",
"}",
"}",
"if (path) {",
"x509 = true;",
"if (vnc_tls_set_x509_creds_dir(vs, path) < 0) {",
"error_setg(VAR_1, \"Failed to find x509 certificates/keys in %s\",\npath);",
"goto fail;",
"}",
"}",
"#else\nif (tls) {",
"error_setg(VAR_1, \"VNC TLS auth requires gnutls support\");",
"goto fail;",
"}",
"#endif\n#if defined(CONFIG_VNC_TLS) || defined(CONFIG_VNC_SASL)\nacl = qemu_opt_get_bool(opts, \"acl\", false);",
"#endif\nVAR_2 = qemu_opt_get(opts, \"VAR_2\");",
"if (VAR_2) {",
"if (strcmp(VAR_2, \"ignore\") == 0) {",
"vs->share_policy = VNC_SHARE_POLICY_IGNORE;",
"} else if (strcmp(VAR_2, \"allow-exclusive\") == 0) {",
"vs->share_policy = VNC_SHARE_POLICY_ALLOW_EXCLUSIVE;",
"} else if (strcmp(VAR_2, \"force-shared\") == 0) {",
"vs->share_policy = VNC_SHARE_POLICY_FORCE_SHARED;",
"} else {",
"error_setg(VAR_1, \"unknown VAR_4 VAR_2= option\");",
"goto fail;",
"}",
"} else {",
"vs->share_policy = VNC_SHARE_POLICY_ALLOW_EXCLUSIVE;",
"}",
"vs->connections_limit = qemu_opt_get_number(opts, \"connections\", 32);",
"VAR_7 = qemu_opt_get(opts, \"VAR_7\");",
"if (VAR_7) {",
"#ifdef CONFIG_VNC_WS\nvs->ws_enabled = true;",
"qemu_opt_set(wsopts, \"port\", VAR_7, &error_abort);",
"#else\nerror_setg(VAR_1, \"Websockets protocol requires gnutls support\");",
"goto fail;",
"#endif\n}",
"#ifdef CONFIG_VNC_JPEG\nvs->lossy = qemu_opt_get_bool(opts, \"lossy\", false);",
"#endif\nvs->non_adaptive = qemu_opt_get_bool(opts, \"non-adaptive\", false);",
"if (!vs->lossy) {",
"vs->non_adaptive = true;",
"}",
"#ifdef CONFIG_VNC_TLS\nif (acl && x509 && vs->tls.x509verify) {",
"char *aclname;",
"if (strcmp(vs->VAR_0, \"default\") == 0) {",
"aclname = g_strdup(\"VAR_4.x509dname\");",
"} else {",
"aclname = g_strdup_printf(\"VAR_4.%s.x509dname\", vs->VAR_0);",
"}",
"vs->tls.acl = qemu_acl_init(aclname);",
"if (!vs->tls.acl) {",
"fprintf(stderr, \"Failed to create x509 dname ACL\\n\");",
"exit(1);",
"}",
"g_free(aclname);",
"}",
"#endif\n#ifdef CONFIG_VNC_SASL\nif (acl && sasl) {",
"char *aclname;",
"if (strcmp(vs->VAR_0, \"default\") == 0) {",
"aclname = g_strdup(\"VAR_4.username\");",
"} else {",
"aclname = g_strdup_printf(\"VAR_4.%s.username\", vs->VAR_0);",
"}",
"vs->sasl.acl = qemu_acl_init(aclname);",
"if (!vs->sasl.acl) {",
"fprintf(stderr, \"Failed to create username ACL\\n\");",
"exit(1);",
"}",
"g_free(aclname);",
"}",
"#endif\nvnc_display_setup_auth(vs, password, sasl, tls, x509, VAR_7);",
"#ifdef CONFIG_VNC_SASL\nif ((saslErr = sasl_server_init(NULL, \"qemu\")) != SASL_OK) {",
"error_setg(VAR_1, \"Failed to initialize SASL auth: %s\",\nsasl_errstring(saslErr, NULL, NULL));",
"goto fail;",
"}",
"#endif\nvs->VAR_8 = VAR_8;",
"VAR_3 = qemu_opt_get(opts, \"display\");",
"if (VAR_3) {",
"DeviceState *dev;",
"int VAR_10 = qemu_opt_get_number(opts, \"VAR_10\", 0);",
"dev = qdev_find_recursive(sysbus_get_default(), VAR_3);",
"if (dev == NULL) {",
"error_setg(VAR_1, \"Device '%s' not found\", VAR_3);",
"goto fail;",
"}",
"con = qemu_console_lookup_by_device(dev, VAR_10);",
"if (con == NULL) {",
"error_setg(VAR_1, \"Device %s is not bound to a QemuConsole\",\nVAR_3);",
"goto fail;",
"}",
"} else {",
"con = NULL;",
"}",
"if (con != vs->dcl.con) {",
"unregister_displaychangelistener(&vs->dcl);",
"vs->dcl.con = con;",
"register_displaychangelistener(&vs->dcl);",
"}",
"if (reverse) {",
"int VAR_11;",
"vs->lsock = -1;",
"#ifdef CONFIG_VNC_WS\nvs->lwebsock = -1;",
"#endif\nif (strncmp(VAR_4, \"unix:\", 5) == 0) {",
"VAR_11 = unix_connect(VAR_4+5, VAR_1);",
"} else {",
"VAR_11 = inet_connect(VAR_4, VAR_1);",
"}",
"if (VAR_11 < 0) {",
"goto fail;",
"}",
"vnc_connect(vs, VAR_11, false, false);",
"} else {",
"if (strncmp(VAR_4, \"unix:\", 5) == 0) {",
"vs->lsock = unix_listen(VAR_4+5, NULL, 0, VAR_1);",
"vs->is_unix = true;",
"} else {",
"vs->lsock = inet_listen_opts(sopts, 5900, VAR_1);",
"if (vs->lsock < 0) {",
"goto fail;",
"}",
"#ifdef CONFIG_VNC_WS\nif (vs->ws_enabled) {",
"vs->lwebsock = inet_listen_opts(wsopts, 0, VAR_1);",
"if (vs->lwebsock < 0) {",
"if (vs->lsock != -1) {",
"close(vs->lsock);",
"vs->lsock = -1;",
"}",
"goto fail;",
"}",
"}",
"#endif\n}",
"vs->enabled = true;",
"qemu_set_fd_handler2(vs->lsock, NULL,\nvnc_listen_regular_read, NULL, vs);",
"#ifdef CONFIG_VNC_WS\nif (vs->ws_enabled) {",
"qemu_set_fd_handler2(vs->lwebsock, NULL,\nvnc_listen_websocket_read, NULL, vs);",
"}",
"#endif\n}",
"qemu_opts_del(sopts);",
"qemu_opts_del(wsopts);",
"return;",
"fail:\nqemu_opts_del(sopts);",
"qemu_opts_del(wsopts);",
"vs->enabled = false;",
"#ifdef CONFIG_VNC_WS\nvs->ws_enabled = false;",
"#endif\n}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33,
35
],
[
37,
39
],
[
41,
43
],
[
45,
47,
49
],
[
51,
53
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
85
],
[
87
],
[
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
],
[
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,
237
],
[
239
],
[
241
],
[
243
],
[
245
],
[
247
],
[
249
],
[
251
],
[
253
],
[
255
],
[
257
],
[
259
],
[
261
],
[
263
],
[
265
],
[
267
],
[
271
],
[
273
],
[
275,
277
],
[
279
],
[
281,
283
],
[
285
],
[
287,
289
],
[
293,
295
],
[
297,
299
],
[
307
],
[
309
],
[
311
],
[
315,
317
],
[
319
],
[
323
],
[
325
],
[
327
],
[
329
],
[
331
],
[
333
],
[
335
],
[
337
],
[
339
],
[
341
],
[
343
],
[
345
],
[
347,
349,
351
],
[
353
],
[
357
],
[
359
],
[
361
],
[
363
],
[
365
],
[
367
],
[
369
],
[
371
],
[
373
],
[
375
],
[
377
],
[
379
],
[
381,
385
],
[
389,
391
],
[
393,
395
],
[
397
],
[
399
],
[
401,
403
],
[
407
],
[
409
],
[
411
],
[
413
],
[
417
],
[
419
],
[
421
],
[
423
],
[
425
],
[
429
],
[
431
],
[
433,
435
],
[
437
],
[
439
],
[
441
],
[
443
],
[
445
],
[
449
],
[
451
],
[
453
],
[
455
],
[
457
],
[
461
],
[
465
],
[
467
],
[
469,
471
],
[
473,
475
],
[
477
],
[
479
],
[
481
],
[
483
],
[
485
],
[
487
],
[
489
],
[
491
],
[
493
],
[
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
],
[
567,
569
],
[
571
],
[
573
],
[
575,
577
],
[
579,
581
]
]
|
12,460 | static int rm_read_header(AVFormatContext *s)
{
RMDemuxContext *rm = s->priv_data;
AVStream *st;
AVIOContext *pb = s->pb;
unsigned int tag;
int tag_size;
unsigned int start_time, duration;
unsigned int data_off = 0, indx_off = 0;
char buf[128], mime[128];
int flags = 0;
tag = avio_rl32(pb);
if (tag == MKTAG('.', 'r', 'a', 0xfd)) {
/* very old .ra format */
return rm_read_header_old(s);
} else if (tag != MKTAG('.', 'R', 'M', 'F')) {
return AVERROR(EIO);
}
tag_size = avio_rb32(pb);
avio_skip(pb, tag_size - 8);
for(;;) {
if (url_feof(pb))
return -1;
tag = avio_rl32(pb);
tag_size = avio_rb32(pb);
avio_rb16(pb);
av_dlog(s, "tag=%c%c%c%c (%08x) size=%d\n",
(tag ) & 0xff,
(tag >> 8) & 0xff,
(tag >> 16) & 0xff,
(tag >> 24) & 0xff,
tag,
tag_size);
if (tag_size < 10 && tag != MKTAG('D', 'A', 'T', 'A'))
return -1;
switch(tag) {
case MKTAG('P', 'R', 'O', 'P'):
/* file header */
avio_rb32(pb); /* max bit rate */
avio_rb32(pb); /* avg bit rate */
avio_rb32(pb); /* max packet size */
avio_rb32(pb); /* avg packet size */
avio_rb32(pb); /* nb packets */
duration = avio_rb32(pb); /* duration */
s->duration = av_rescale(duration, AV_TIME_BASE, 1000);
avio_rb32(pb); /* preroll */
indx_off = avio_rb32(pb); /* index offset */
data_off = avio_rb32(pb); /* data offset */
avio_rb16(pb); /* nb streams */
flags = avio_rb16(pb); /* flags */
break;
case MKTAG('C', 'O', 'N', 'T'):
rm_read_metadata(s, 1);
break;
case MKTAG('M', 'D', 'P', 'R'):
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
st->id = avio_rb16(pb);
avio_rb32(pb); /* max bit rate */
st->codec->bit_rate = avio_rb32(pb); /* bit rate */
avio_rb32(pb); /* max packet size */
avio_rb32(pb); /* avg packet size */
start_time = avio_rb32(pb); /* start time */
avio_rb32(pb); /* preroll */
duration = avio_rb32(pb); /* duration */
st->start_time = start_time;
st->duration = duration;
if(duration>0)
s->duration = AV_NOPTS_VALUE;
get_str8(pb, buf, sizeof(buf)); /* desc */
get_str8(pb, mime, sizeof(mime)); /* mimetype */
st->codec->codec_type = AVMEDIA_TYPE_DATA;
st->priv_data = ff_rm_alloc_rmstream();
if (ff_rm_read_mdpr_codecdata(s, s->pb, st, st->priv_data,
avio_rb32(pb), mime) < 0)
return -1;
break;
case MKTAG('D', 'A', 'T', 'A'):
goto header_end;
default:
/* unknown tag: skip it */
avio_skip(pb, tag_size - 10);
break;
}
}
header_end:
rm->nb_packets = avio_rb32(pb); /* number of packets */
if (!rm->nb_packets && (flags & 4))
rm->nb_packets = 3600 * 25;
avio_rb32(pb); /* next data header */
if (!data_off)
data_off = avio_tell(pb) - 18;
if (indx_off && pb->seekable && !(s->flags & AVFMT_FLAG_IGNIDX) &&
avio_seek(pb, indx_off, SEEK_SET) >= 0) {
rm_read_index(s);
avio_seek(pb, data_off + 18, SEEK_SET);
}
return 0;
}
| true | FFmpeg | bf87908cd8da31e8f8fe75c06577170928ea70a8 | static int rm_read_header(AVFormatContext *s)
{
RMDemuxContext *rm = s->priv_data;
AVStream *st;
AVIOContext *pb = s->pb;
unsigned int tag;
int tag_size;
unsigned int start_time, duration;
unsigned int data_off = 0, indx_off = 0;
char buf[128], mime[128];
int flags = 0;
tag = avio_rl32(pb);
if (tag == MKTAG('.', 'r', 'a', 0xfd)) {
return rm_read_header_old(s);
} else if (tag != MKTAG('.', 'R', 'M', 'F')) {
return AVERROR(EIO);
}
tag_size = avio_rb32(pb);
avio_skip(pb, tag_size - 8);
for(;;) {
if (url_feof(pb))
return -1;
tag = avio_rl32(pb);
tag_size = avio_rb32(pb);
avio_rb16(pb);
av_dlog(s, "tag=%c%c%c%c (%08x) size=%d\n",
(tag ) & 0xff,
(tag >> 8) & 0xff,
(tag >> 16) & 0xff,
(tag >> 24) & 0xff,
tag,
tag_size);
if (tag_size < 10 && tag != MKTAG('D', 'A', 'T', 'A'))
return -1;
switch(tag) {
case MKTAG('P', 'R', 'O', 'P'):
avio_rb32(pb);
avio_rb32(pb);
avio_rb32(pb);
avio_rb32(pb);
avio_rb32(pb);
duration = avio_rb32(pb);
s->duration = av_rescale(duration, AV_TIME_BASE, 1000);
avio_rb32(pb);
indx_off = avio_rb32(pb);
data_off = avio_rb32(pb);
avio_rb16(pb);
flags = avio_rb16(pb);
break;
case MKTAG('C', 'O', 'N', 'T'):
rm_read_metadata(s, 1);
break;
case MKTAG('M', 'D', 'P', 'R'):
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
st->id = avio_rb16(pb);
avio_rb32(pb);
st->codec->bit_rate = avio_rb32(pb);
avio_rb32(pb);
avio_rb32(pb);
start_time = avio_rb32(pb);
avio_rb32(pb);
duration = avio_rb32(pb);
st->start_time = start_time;
st->duration = duration;
if(duration>0)
s->duration = AV_NOPTS_VALUE;
get_str8(pb, buf, sizeof(buf));
get_str8(pb, mime, sizeof(mime));
st->codec->codec_type = AVMEDIA_TYPE_DATA;
st->priv_data = ff_rm_alloc_rmstream();
if (ff_rm_read_mdpr_codecdata(s, s->pb, st, st->priv_data,
avio_rb32(pb), mime) < 0)
return -1;
break;
case MKTAG('D', 'A', 'T', 'A'):
goto header_end;
default:
avio_skip(pb, tag_size - 10);
break;
}
}
header_end:
rm->nb_packets = avio_rb32(pb);
if (!rm->nb_packets && (flags & 4))
rm->nb_packets = 3600 * 25;
avio_rb32(pb);
if (!data_off)
data_off = avio_tell(pb) - 18;
if (indx_off && pb->seekable && !(s->flags & AVFMT_FLAG_IGNIDX) &&
avio_seek(pb, indx_off, SEEK_SET) >= 0) {
rm_read_index(s);
avio_seek(pb, data_off + 18, SEEK_SET);
}
return 0;
}
| {
"code": [
" rm_read_metadata(s, 1);"
],
"line_no": [
111
]
} | static int FUNC_0(AVFormatContext *VAR_0)
{
RMDemuxContext *rm = VAR_0->priv_data;
AVStream *st;
AVIOContext *pb = VAR_0->pb;
unsigned int VAR_1;
int VAR_2;
unsigned int VAR_3, VAR_4;
unsigned int VAR_5 = 0, VAR_6 = 0;
char VAR_7[128], VAR_8[128];
int VAR_9 = 0;
VAR_1 = avio_rl32(pb);
if (VAR_1 == MKTAG('.', 'r', 'a', 0xfd)) {
return rm_read_header_old(VAR_0);
} else if (VAR_1 != MKTAG('.', 'R', 'M', 'F')) {
return AVERROR(EIO);
}
VAR_2 = avio_rb32(pb);
avio_skip(pb, VAR_2 - 8);
for(;;) {
if (url_feof(pb))
return -1;
VAR_1 = avio_rl32(pb);
VAR_2 = avio_rb32(pb);
avio_rb16(pb);
av_dlog(VAR_0, "VAR_1=%c%c%c%c (%08x) size=%d\n",
(VAR_1 ) & 0xff,
(VAR_1 >> 8) & 0xff,
(VAR_1 >> 16) & 0xff,
(VAR_1 >> 24) & 0xff,
VAR_1,
VAR_2);
if (VAR_2 < 10 && VAR_1 != MKTAG('D', 'A', 'T', 'A'))
return -1;
switch(VAR_1) {
case MKTAG('P', 'R', 'O', 'P'):
avio_rb32(pb);
avio_rb32(pb);
avio_rb32(pb);
avio_rb32(pb);
avio_rb32(pb);
VAR_4 = avio_rb32(pb);
VAR_0->VAR_4 = av_rescale(VAR_4, AV_TIME_BASE, 1000);
avio_rb32(pb);
VAR_6 = avio_rb32(pb);
VAR_5 = avio_rb32(pb);
avio_rb16(pb);
VAR_9 = avio_rb16(pb);
break;
case MKTAG('C', 'O', 'N', 'T'):
rm_read_metadata(VAR_0, 1);
break;
case MKTAG('M', 'D', 'P', 'R'):
st = avformat_new_stream(VAR_0, NULL);
if (!st)
return AVERROR(ENOMEM);
st->id = avio_rb16(pb);
avio_rb32(pb);
st->codec->bit_rate = avio_rb32(pb);
avio_rb32(pb);
avio_rb32(pb);
VAR_3 = avio_rb32(pb);
avio_rb32(pb);
VAR_4 = avio_rb32(pb);
st->VAR_3 = VAR_3;
st->VAR_4 = VAR_4;
if(VAR_4>0)
VAR_0->VAR_4 = AV_NOPTS_VALUE;
get_str8(pb, VAR_7, sizeof(VAR_7));
get_str8(pb, VAR_8, sizeof(VAR_8));
st->codec->codec_type = AVMEDIA_TYPE_DATA;
st->priv_data = ff_rm_alloc_rmstream();
if (ff_rm_read_mdpr_codecdata(VAR_0, VAR_0->pb, st, st->priv_data,
avio_rb32(pb), VAR_8) < 0)
return -1;
break;
case MKTAG('D', 'A', 'T', 'A'):
goto header_end;
default:
avio_skip(pb, VAR_2 - 10);
break;
}
}
header_end:
rm->nb_packets = avio_rb32(pb);
if (!rm->nb_packets && (VAR_9 & 4))
rm->nb_packets = 3600 * 25;
avio_rb32(pb);
if (!VAR_5)
VAR_5 = avio_tell(pb) - 18;
if (VAR_6 && pb->seekable && !(VAR_0->VAR_9 & AVFMT_FLAG_IGNIDX) &&
avio_seek(pb, VAR_6, SEEK_SET) >= 0) {
rm_read_index(VAR_0);
avio_seek(pb, VAR_5 + 18, SEEK_SET);
}
return 0;
}
| [
"static int FUNC_0(AVFormatContext *VAR_0)\n{",
"RMDemuxContext *rm = VAR_0->priv_data;",
"AVStream *st;",
"AVIOContext *pb = VAR_0->pb;",
"unsigned int VAR_1;",
"int VAR_2;",
"unsigned int VAR_3, VAR_4;",
"unsigned int VAR_5 = 0, VAR_6 = 0;",
"char VAR_7[128], VAR_8[128];",
"int VAR_9 = 0;",
"VAR_1 = avio_rl32(pb);",
"if (VAR_1 == MKTAG('.', 'r', 'a', 0xfd)) {",
"return rm_read_header_old(VAR_0);",
"} else if (VAR_1 != MKTAG('.', 'R', 'M', 'F')) {",
"return AVERROR(EIO);",
"}",
"VAR_2 = avio_rb32(pb);",
"avio_skip(pb, VAR_2 - 8);",
"for(;;) {",
"if (url_feof(pb))\nreturn -1;",
"VAR_1 = avio_rl32(pb);",
"VAR_2 = avio_rb32(pb);",
"avio_rb16(pb);",
"av_dlog(VAR_0, \"VAR_1=%c%c%c%c (%08x) size=%d\\n\",\n(VAR_1 ) & 0xff,\n(VAR_1 >> 8) & 0xff,\n(VAR_1 >> 16) & 0xff,\n(VAR_1 >> 24) & 0xff,\nVAR_1,\nVAR_2);",
"if (VAR_2 < 10 && VAR_1 != MKTAG('D', 'A', 'T', 'A'))\nreturn -1;",
"switch(VAR_1) {",
"case MKTAG('P', 'R', 'O', 'P'):\navio_rb32(pb);",
"avio_rb32(pb);",
"avio_rb32(pb);",
"avio_rb32(pb);",
"avio_rb32(pb);",
"VAR_4 = avio_rb32(pb);",
"VAR_0->VAR_4 = av_rescale(VAR_4, AV_TIME_BASE, 1000);",
"avio_rb32(pb);",
"VAR_6 = avio_rb32(pb);",
"VAR_5 = avio_rb32(pb);",
"avio_rb16(pb);",
"VAR_9 = avio_rb16(pb);",
"break;",
"case MKTAG('C', 'O', 'N', 'T'):\nrm_read_metadata(VAR_0, 1);",
"break;",
"case MKTAG('M', 'D', 'P', 'R'):\nst = avformat_new_stream(VAR_0, NULL);",
"if (!st)\nreturn AVERROR(ENOMEM);",
"st->id = avio_rb16(pb);",
"avio_rb32(pb);",
"st->codec->bit_rate = avio_rb32(pb);",
"avio_rb32(pb);",
"avio_rb32(pb);",
"VAR_3 = avio_rb32(pb);",
"avio_rb32(pb);",
"VAR_4 = avio_rb32(pb);",
"st->VAR_3 = VAR_3;",
"st->VAR_4 = VAR_4;",
"if(VAR_4>0)\nVAR_0->VAR_4 = AV_NOPTS_VALUE;",
"get_str8(pb, VAR_7, sizeof(VAR_7));",
"get_str8(pb, VAR_8, sizeof(VAR_8));",
"st->codec->codec_type = AVMEDIA_TYPE_DATA;",
"st->priv_data = ff_rm_alloc_rmstream();",
"if (ff_rm_read_mdpr_codecdata(VAR_0, VAR_0->pb, st, st->priv_data,\navio_rb32(pb), VAR_8) < 0)\nreturn -1;",
"break;",
"case MKTAG('D', 'A', 'T', 'A'):\ngoto header_end;",
"default:\navio_skip(pb, VAR_2 - 10);",
"break;",
"}",
"}",
"header_end:\nrm->nb_packets = avio_rb32(pb);",
"if (!rm->nb_packets && (VAR_9 & 4))\nrm->nb_packets = 3600 * 25;",
"avio_rb32(pb);",
"if (!VAR_5)\nVAR_5 = avio_tell(pb) - 18;",
"if (VAR_6 && pb->seekable && !(VAR_0->VAR_9 & AVFMT_FLAG_IGNIDX) &&\navio_seek(pb, VAR_6, SEEK_SET) >= 0) {",
"rm_read_index(VAR_0);",
"avio_seek(pb, VAR_5 + 18, SEEK_SET);",
"}",
"return 0;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
25
],
[
27
],
[
31
],
[
33
],
[
35
],
[
37
],
[
41
],
[
43
],
[
47
],
[
49,
51
],
[
53
],
[
55
],
[
57
],
[
59,
61,
63,
65,
67,
69,
71
],
[
73,
75
],
[
77
],
[
79,
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109,
111
],
[
113
],
[
115,
117
],
[
119,
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143,
145
],
[
147
],
[
149
],
[
151
],
[
153
],
[
155,
157,
159
],
[
161
],
[
163,
165
],
[
167,
171
],
[
173
],
[
175
],
[
177
],
[
179,
181
],
[
183,
185
],
[
187
],
[
191,
193
],
[
195,
197
],
[
199
],
[
201
],
[
203
],
[
207
],
[
209
]
]
|
12,461 | int av_write_frame(AVFormatContext *s, int stream_index, const uint8_t *buf,
int size)
{
AVStream *st;
int64_t pts_mask;
int ret, frame_size;
st = s->streams[stream_index];
pts_mask = (1LL << s->pts_wrap_bits) - 1;
ret = s->oformat->write_packet(s, stream_index, buf, size,
st->pts.val & pts_mask);
if (ret < 0)
return ret;
/* update pts */
switch (st->codec.codec_type) {
case CODEC_TYPE_AUDIO:
frame_size = get_audio_frame_size(&st->codec, size);
/* note, we skip the initial 0-size packets as they are most likely equal to the encoder delay,
but it would be better if we had the real timestamps from the encoder */
// av_log(s, AV_LOG_DEBUG, "%d %lld %lld\n", size, st->pts.num, st->pts.val);
if (frame_size >= 0 && (size || st->pts.num!=st->pts.den>>1 || st->pts.val)) {
av_frac_add(&st->pts,
(int64_t)s->pts_den * frame_size);
}
break;
case CODEC_TYPE_VIDEO:
av_frac_add(&st->pts,
(int64_t)s->pts_den * st->codec.frame_rate_base);
break;
default:
break;
}
return ret;
}
| false | FFmpeg | b0c7f5a9d82feb7f4c4cdf77f1537193670ab58b | int av_write_frame(AVFormatContext *s, int stream_index, const uint8_t *buf,
int size)
{
AVStream *st;
int64_t pts_mask;
int ret, frame_size;
st = s->streams[stream_index];
pts_mask = (1LL << s->pts_wrap_bits) - 1;
ret = s->oformat->write_packet(s, stream_index, buf, size,
st->pts.val & pts_mask);
if (ret < 0)
return ret;
switch (st->codec.codec_type) {
case CODEC_TYPE_AUDIO:
frame_size = get_audio_frame_size(&st->codec, size);
if (frame_size >= 0 && (size || st->pts.num!=st->pts.den>>1 || st->pts.val)) {
av_frac_add(&st->pts,
(int64_t)s->pts_den * frame_size);
}
break;
case CODEC_TYPE_VIDEO:
av_frac_add(&st->pts,
(int64_t)s->pts_den * st->codec.frame_rate_base);
break;
default:
break;
}
return ret;
}
| {
"code": [],
"line_no": []
} | int FUNC_0(AVFormatContext *VAR_0, int VAR_1, const uint8_t *VAR_2,
int VAR_3)
{
AVStream *st;
int64_t pts_mask;
int VAR_4, VAR_5;
st = VAR_0->streams[VAR_1];
pts_mask = (1LL << VAR_0->pts_wrap_bits) - 1;
VAR_4 = VAR_0->oformat->write_packet(VAR_0, VAR_1, VAR_2, VAR_3,
st->pts.val & pts_mask);
if (VAR_4 < 0)
return VAR_4;
switch (st->codec.codec_type) {
case CODEC_TYPE_AUDIO:
VAR_5 = get_audio_frame_size(&st->codec, VAR_3);
if (VAR_5 >= 0 && (VAR_3 || st->pts.num!=st->pts.den>>1 || st->pts.val)) {
av_frac_add(&st->pts,
(int64_t)VAR_0->pts_den * VAR_5);
}
break;
case CODEC_TYPE_VIDEO:
av_frac_add(&st->pts,
(int64_t)VAR_0->pts_den * st->codec.frame_rate_base);
break;
default:
break;
}
return VAR_4;
}
| [
"int FUNC_0(AVFormatContext *VAR_0, int VAR_1, const uint8_t *VAR_2,\nint VAR_3)\n{",
"AVStream *st;",
"int64_t pts_mask;",
"int VAR_4, VAR_5;",
"st = VAR_0->streams[VAR_1];",
"pts_mask = (1LL << VAR_0->pts_wrap_bits) - 1;",
"VAR_4 = VAR_0->oformat->write_packet(VAR_0, VAR_1, VAR_2, VAR_3,\nst->pts.val & pts_mask);",
"if (VAR_4 < 0)\nreturn VAR_4;",
"switch (st->codec.codec_type) {",
"case CODEC_TYPE_AUDIO:\nVAR_5 = get_audio_frame_size(&st->codec, VAR_3);",
"if (VAR_5 >= 0 && (VAR_3 || st->pts.num!=st->pts.den>>1 || st->pts.val)) {",
"av_frac_add(&st->pts,\n(int64_t)VAR_0->pts_den * VAR_5);",
"}",
"break;",
"case CODEC_TYPE_VIDEO:\nav_frac_add(&st->pts,\n(int64_t)VAR_0->pts_den * st->codec.frame_rate_base);",
"break;",
"default:\nbreak;",
"}",
"return VAR_4;",
"}"
]
| [
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
],
[
31
],
[
33,
35
],
[
45
],
[
47,
49
],
[
51
],
[
53
],
[
55,
57,
59
],
[
61
],
[
63,
65
],
[
67
],
[
69
],
[
71
]
]
|
12,462 | static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
{
CCaptionSubContext *ctx = avctx->priv_data;
AVSubtitle *sub = data;
const int64_t start_time = sub->pts;
uint8_t *bptr = NULL;
int len = avpkt->size;
int ret = 0;
int i;
if (ctx->pktbuf->size < len) {
ret = av_buffer_realloc(&ctx->pktbuf, len);
if (ret < 0) {
av_log(ctx, AV_LOG_WARNING, "Insufficient Memory of %d truncated to %d\n", len, ctx->pktbuf->size);
len = ctx->pktbuf->size;
ret = 0;
}
}
memcpy(ctx->pktbuf->data, avpkt->data, len);
bptr = ctx->pktbuf->data;
for (i = 0; i < len; i += 3) {
uint8_t cc_type = *(bptr + i) & 3;
if (validate_cc_data_pair(bptr + i))
continue;
/* ignoring data field 1 */
if(cc_type == 1)
continue;
else
process_cc608(ctx, start_time, *(bptr + i + 1) & 0x7f, *(bptr + i + 2) & 0x7f);
if (!ctx->buffer_changed)
continue;
ctx->buffer_changed = 0;
if (*ctx->buffer.str || ctx->real_time)
{
ff_dlog(ctx, "cdp writing data (%s)\n",ctx->buffer.str);
ret = ff_ass_add_rect(sub, ctx->buffer.str, ctx->readorder++, 0, NULL, NULL);
if (ret < 0)
return ret;
sub->pts = ctx->start_time;
if (!ctx->real_time)
sub->end_display_time = av_rescale_q(ctx->end_time - ctx->start_time,
AV_TIME_BASE_Q, ms_tb);
else
sub->end_display_time = -1;
ctx->buffer_changed = 0;
ctx->last_real_time = sub->pts;
ctx->screen_touched = 0;
}
}
if (ctx->real_time && ctx->screen_touched &&
sub->pts > ctx->last_real_time + av_rescale_q(200, ms_tb, AV_TIME_BASE_Q)) {
ctx->last_real_time = sub->pts;
ctx->screen_touched = 0;
capture_screen(ctx);
ctx->buffer_changed = 0;
ret = ff_ass_add_rect(sub, ctx->buffer.str, ctx->readorder++, 0, NULL, NULL);
if (ret < 0)
return ret;
sub->end_display_time = -1;
}
*got_sub = sub->num_rects > 0;
return ret;
}
| false | FFmpeg | 752e6dfa3ea97e7901870bdd9e5a51f860607240 | static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
{
CCaptionSubContext *ctx = avctx->priv_data;
AVSubtitle *sub = data;
const int64_t start_time = sub->pts;
uint8_t *bptr = NULL;
int len = avpkt->size;
int ret = 0;
int i;
if (ctx->pktbuf->size < len) {
ret = av_buffer_realloc(&ctx->pktbuf, len);
if (ret < 0) {
av_log(ctx, AV_LOG_WARNING, "Insufficient Memory of %d truncated to %d\n", len, ctx->pktbuf->size);
len = ctx->pktbuf->size;
ret = 0;
}
}
memcpy(ctx->pktbuf->data, avpkt->data, len);
bptr = ctx->pktbuf->data;
for (i = 0; i < len; i += 3) {
uint8_t cc_type = *(bptr + i) & 3;
if (validate_cc_data_pair(bptr + i))
continue;
if(cc_type == 1)
continue;
else
process_cc608(ctx, start_time, *(bptr + i + 1) & 0x7f, *(bptr + i + 2) & 0x7f);
if (!ctx->buffer_changed)
continue;
ctx->buffer_changed = 0;
if (*ctx->buffer.str || ctx->real_time)
{
ff_dlog(ctx, "cdp writing data (%s)\n",ctx->buffer.str);
ret = ff_ass_add_rect(sub, ctx->buffer.str, ctx->readorder++, 0, NULL, NULL);
if (ret < 0)
return ret;
sub->pts = ctx->start_time;
if (!ctx->real_time)
sub->end_display_time = av_rescale_q(ctx->end_time - ctx->start_time,
AV_TIME_BASE_Q, ms_tb);
else
sub->end_display_time = -1;
ctx->buffer_changed = 0;
ctx->last_real_time = sub->pts;
ctx->screen_touched = 0;
}
}
if (ctx->real_time && ctx->screen_touched &&
sub->pts > ctx->last_real_time + av_rescale_q(200, ms_tb, AV_TIME_BASE_Q)) {
ctx->last_real_time = sub->pts;
ctx->screen_touched = 0;
capture_screen(ctx);
ctx->buffer_changed = 0;
ret = ff_ass_add_rect(sub, ctx->buffer.str, ctx->readorder++, 0, NULL, NULL);
if (ret < 0)
return ret;
sub->end_display_time = -1;
}
*got_sub = sub->num_rects > 0;
return ret;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3)
{
CCaptionSubContext *ctx = VAR_0->priv_data;
AVSubtitle *sub = VAR_1;
const int64_t VAR_4 = sub->pts;
uint8_t *bptr = NULL;
int VAR_5 = VAR_3->size;
int VAR_6 = 0;
int VAR_7;
if (ctx->pktbuf->size < VAR_5) {
VAR_6 = av_buffer_realloc(&ctx->pktbuf, VAR_5);
if (VAR_6 < 0) {
av_log(ctx, AV_LOG_WARNING, "Insufficient Memory of %d truncated to %d\n", VAR_5, ctx->pktbuf->size);
VAR_5 = ctx->pktbuf->size;
VAR_6 = 0;
}
}
memcpy(ctx->pktbuf->VAR_1, VAR_3->VAR_1, VAR_5);
bptr = ctx->pktbuf->VAR_1;
for (VAR_7 = 0; VAR_7 < VAR_5; VAR_7 += 3) {
uint8_t cc_type = *(bptr + VAR_7) & 3;
if (validate_cc_data_pair(bptr + VAR_7))
continue;
if(cc_type == 1)
continue;
else
process_cc608(ctx, VAR_4, *(bptr + VAR_7 + 1) & 0x7f, *(bptr + VAR_7 + 2) & 0x7f);
if (!ctx->buffer_changed)
continue;
ctx->buffer_changed = 0;
if (*ctx->buffer.str || ctx->real_time)
{
ff_dlog(ctx, "cdp writing VAR_1 (%s)\n",ctx->buffer.str);
VAR_6 = ff_ass_add_rect(sub, ctx->buffer.str, ctx->readorder++, 0, NULL, NULL);
if (VAR_6 < 0)
return VAR_6;
sub->pts = ctx->VAR_4;
if (!ctx->real_time)
sub->end_display_time = av_rescale_q(ctx->end_time - ctx->VAR_4,
AV_TIME_BASE_Q, ms_tb);
else
sub->end_display_time = -1;
ctx->buffer_changed = 0;
ctx->last_real_time = sub->pts;
ctx->screen_touched = 0;
}
}
if (ctx->real_time && ctx->screen_touched &&
sub->pts > ctx->last_real_time + av_rescale_q(200, ms_tb, AV_TIME_BASE_Q)) {
ctx->last_real_time = sub->pts;
ctx->screen_touched = 0;
capture_screen(ctx);
ctx->buffer_changed = 0;
VAR_6 = ff_ass_add_rect(sub, ctx->buffer.str, ctx->readorder++, 0, NULL, NULL);
if (VAR_6 < 0)
return VAR_6;
sub->end_display_time = -1;
}
*VAR_2 = sub->num_rects > 0;
return VAR_6;
}
| [
"static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3)\n{",
"CCaptionSubContext *ctx = VAR_0->priv_data;",
"AVSubtitle *sub = VAR_1;",
"const int64_t VAR_4 = sub->pts;",
"uint8_t *bptr = NULL;",
"int VAR_5 = VAR_3->size;",
"int VAR_6 = 0;",
"int VAR_7;",
"if (ctx->pktbuf->size < VAR_5) {",
"VAR_6 = av_buffer_realloc(&ctx->pktbuf, VAR_5);",
"if (VAR_6 < 0) {",
"av_log(ctx, AV_LOG_WARNING, \"Insufficient Memory of %d truncated to %d\\n\", VAR_5, ctx->pktbuf->size);",
"VAR_5 = ctx->pktbuf->size;",
"VAR_6 = 0;",
"}",
"}",
"memcpy(ctx->pktbuf->VAR_1, VAR_3->VAR_1, VAR_5);",
"bptr = ctx->pktbuf->VAR_1;",
"for (VAR_7 = 0; VAR_7 < VAR_5; VAR_7 += 3) {",
"uint8_t cc_type = *(bptr + VAR_7) & 3;",
"if (validate_cc_data_pair(bptr + VAR_7))\ncontinue;",
"if(cc_type == 1)\ncontinue;",
"else\nprocess_cc608(ctx, VAR_4, *(bptr + VAR_7 + 1) & 0x7f, *(bptr + VAR_7 + 2) & 0x7f);",
"if (!ctx->buffer_changed)\ncontinue;",
"ctx->buffer_changed = 0;",
"if (*ctx->buffer.str || ctx->real_time)\n{",
"ff_dlog(ctx, \"cdp writing VAR_1 (%s)\\n\",ctx->buffer.str);",
"VAR_6 = ff_ass_add_rect(sub, ctx->buffer.str, ctx->readorder++, 0, NULL, NULL);",
"if (VAR_6 < 0)\nreturn VAR_6;",
"sub->pts = ctx->VAR_4;",
"if (!ctx->real_time)\nsub->end_display_time = av_rescale_q(ctx->end_time - ctx->VAR_4,\nAV_TIME_BASE_Q, ms_tb);",
"else\nsub->end_display_time = -1;",
"ctx->buffer_changed = 0;",
"ctx->last_real_time = sub->pts;",
"ctx->screen_touched = 0;",
"}",
"}",
"if (ctx->real_time && ctx->screen_touched &&\nsub->pts > ctx->last_real_time + av_rescale_q(200, ms_tb, AV_TIME_BASE_Q)) {",
"ctx->last_real_time = sub->pts;",
"ctx->screen_touched = 0;",
"capture_screen(ctx);",
"ctx->buffer_changed = 0;",
"VAR_6 = ff_ass_add_rect(sub, ctx->buffer.str, ctx->readorder++, 0, NULL, NULL);",
"if (VAR_6 < 0)\nreturn VAR_6;",
"sub->end_display_time = -1;",
"}",
"*VAR_2 = sub->num_rects > 0;",
"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
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
43
],
[
45
],
[
47,
49
],
[
53,
55
],
[
57,
59
],
[
63,
65
],
[
67
],
[
71,
73
],
[
75
],
[
77
],
[
79,
81
],
[
83
],
[
85,
87,
89
],
[
91,
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
107,
109
],
[
111
],
[
113
],
[
117
],
[
119
],
[
123
],
[
125,
127
],
[
129
],
[
131
],
[
135
],
[
137
],
[
139
]
]
|
12,463 | static int config(struct vf_instance *vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
switch (vf->priv->mode) {
case 0:
case 3:
return ff_vf_next_config(vf,width,height*2,d_width,d_height*2,flags,outfmt);
case 1: /* odd frames */
case 2: /* even frames */
case 4: /* alternate frame (height-preserving) interlacing */
return ff_vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
return 0;
}
| false | FFmpeg | 04001767728fd4ed8b4f9d2ebbb9f9a8c9a7be0d | static int config(struct vf_instance *vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
switch (vf->priv->mode) {
case 0:
case 3:
return ff_vf_next_config(vf,width,height*2,d_width,d_height*2,flags,outfmt);
case 1:
case 2:
case 4:
return ff_vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
return 0;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(struct vf_instance *VAR_0,
int VAR_1, int VAR_2, int VAR_3, int VAR_4,
unsigned int VAR_5, unsigned int VAR_6)
{
switch (VAR_0->priv->mode) {
case 0:
case 3:
return ff_vf_next_config(VAR_0,VAR_1,VAR_2*2,VAR_3,VAR_4*2,VAR_5,VAR_6);
case 1:
case 2:
case 4:
return ff_vf_next_config(VAR_0,VAR_1,VAR_2,VAR_3,VAR_4,VAR_5,VAR_6);
}
return 0;
}
| [
"static int FUNC_0(struct vf_instance *VAR_0,\nint VAR_1, int VAR_2, int VAR_3, int VAR_4,\nunsigned int VAR_5, unsigned int VAR_6)\n{",
"switch (VAR_0->priv->mode) {",
"case 0:\ncase 3:\nreturn ff_vf_next_config(VAR_0,VAR_1,VAR_2*2,VAR_3,VAR_4*2,VAR_5,VAR_6);",
"case 1:\ncase 2:\ncase 4:\nreturn ff_vf_next_config(VAR_0,VAR_1,VAR_2,VAR_3,VAR_4,VAR_5,VAR_6);",
"}",
"return 0;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5,
7
],
[
9
],
[
11,
13,
15
],
[
17,
19,
21,
23
],
[
25
],
[
27
],
[
29
]
]
|
12,464 | static av_cold int vqa_decode_init(AVCodecContext *avctx)
{
VqaContext *s = avctx->priv_data;
unsigned char *vqa_header;
int i, j, codebook_index;
s->avctx = avctx;
avctx->pix_fmt = PIX_FMT_PAL8;
/* make sure the extradata made it */
if (s->avctx->extradata_size != VQA_HEADER_SIZE) {
av_log(s->avctx, AV_LOG_ERROR, " VQA video: expected extradata size of %d\n", VQA_HEADER_SIZE);
return -1;
}
/* load up the VQA parameters from the header */
vqa_header = (unsigned char *)s->avctx->extradata;
s->vqa_version = vqa_header[0];
s->width = AV_RL16(&vqa_header[6]);
s->height = AV_RL16(&vqa_header[8]);
if(av_image_check_size(s->width, s->height, 0, avctx)){
s->width= s->height= 0;
return -1;
}
s->vector_width = vqa_header[10];
s->vector_height = vqa_header[11];
s->partial_count = s->partial_countdown = vqa_header[13];
/* the vector dimensions have to meet very stringent requirements */
if ((s->vector_width != 4) ||
((s->vector_height != 2) && (s->vector_height != 4))) {
/* return without further initialization */
return -1;
}
/* allocate codebooks */
s->codebook_size = MAX_CODEBOOK_SIZE;
s->codebook = av_malloc(s->codebook_size);
s->next_codebook_buffer = av_malloc(s->codebook_size);
/* initialize the solid-color vectors */
if (s->vector_height == 4) {
codebook_index = 0xFF00 * 16;
for (i = 0; i < 256; i++)
for (j = 0; j < 16; j++)
s->codebook[codebook_index++] = i;
} else {
codebook_index = 0xF00 * 8;
for (i = 0; i < 256; i++)
for (j = 0; j < 8; j++)
s->codebook[codebook_index++] = i;
}
s->next_codebook_buffer_index = 0;
/* allocate decode buffer */
s->decode_buffer_size = (s->width / s->vector_width) *
(s->height / s->vector_height) * 2;
s->decode_buffer = av_malloc(s->decode_buffer_size);
s->frame.data[0] = NULL;
return 0;
}
| false | FFmpeg | 341404f753fdbcddebb9fbce51f2ef057cceb79c | static av_cold int vqa_decode_init(AVCodecContext *avctx)
{
VqaContext *s = avctx->priv_data;
unsigned char *vqa_header;
int i, j, codebook_index;
s->avctx = avctx;
avctx->pix_fmt = PIX_FMT_PAL8;
if (s->avctx->extradata_size != VQA_HEADER_SIZE) {
av_log(s->avctx, AV_LOG_ERROR, " VQA video: expected extradata size of %d\n", VQA_HEADER_SIZE);
return -1;
}
vqa_header = (unsigned char *)s->avctx->extradata;
s->vqa_version = vqa_header[0];
s->width = AV_RL16(&vqa_header[6]);
s->height = AV_RL16(&vqa_header[8]);
if(av_image_check_size(s->width, s->height, 0, avctx)){
s->width= s->height= 0;
return -1;
}
s->vector_width = vqa_header[10];
s->vector_height = vqa_header[11];
s->partial_count = s->partial_countdown = vqa_header[13];
if ((s->vector_width != 4) ||
((s->vector_height != 2) && (s->vector_height != 4))) {
return -1;
}
s->codebook_size = MAX_CODEBOOK_SIZE;
s->codebook = av_malloc(s->codebook_size);
s->next_codebook_buffer = av_malloc(s->codebook_size);
if (s->vector_height == 4) {
codebook_index = 0xFF00 * 16;
for (i = 0; i < 256; i++)
for (j = 0; j < 16; j++)
s->codebook[codebook_index++] = i;
} else {
codebook_index = 0xF00 * 8;
for (i = 0; i < 256; i++)
for (j = 0; j < 8; j++)
s->codebook[codebook_index++] = i;
}
s->next_codebook_buffer_index = 0;
s->decode_buffer_size = (s->width / s->vector_width) *
(s->height / s->vector_height) * 2;
s->decode_buffer = av_malloc(s->decode_buffer_size);
s->frame.data[0] = NULL;
return 0;
}
| {
"code": [],
"line_no": []
} | static av_cold int FUNC_0(AVCodecContext *avctx)
{
VqaContext *s = avctx->priv_data;
unsigned char *VAR_0;
int VAR_1, VAR_2, VAR_3;
s->avctx = avctx;
avctx->pix_fmt = PIX_FMT_PAL8;
if (s->avctx->extradata_size != VQA_HEADER_SIZE) {
av_log(s->avctx, AV_LOG_ERROR, " VQA video: expected extradata size of %d\n", VQA_HEADER_SIZE);
return -1;
}
VAR_0 = (unsigned char *)s->avctx->extradata;
s->vqa_version = VAR_0[0];
s->width = AV_RL16(&VAR_0[6]);
s->height = AV_RL16(&VAR_0[8]);
if(av_image_check_size(s->width, s->height, 0, avctx)){
s->width= s->height= 0;
return -1;
}
s->vector_width = VAR_0[10];
s->vector_height = VAR_0[11];
s->partial_count = s->partial_countdown = VAR_0[13];
if ((s->vector_width != 4) ||
((s->vector_height != 2) && (s->vector_height != 4))) {
return -1;
}
s->codebook_size = MAX_CODEBOOK_SIZE;
s->codebook = av_malloc(s->codebook_size);
s->next_codebook_buffer = av_malloc(s->codebook_size);
if (s->vector_height == 4) {
VAR_3 = 0xFF00 * 16;
for (VAR_1 = 0; VAR_1 < 256; VAR_1++)
for (VAR_2 = 0; VAR_2 < 16; VAR_2++)
s->codebook[VAR_3++] = VAR_1;
} else {
VAR_3 = 0xF00 * 8;
for (VAR_1 = 0; VAR_1 < 256; VAR_1++)
for (VAR_2 = 0; VAR_2 < 8; VAR_2++)
s->codebook[VAR_3++] = VAR_1;
}
s->next_codebook_buffer_index = 0;
s->decode_buffer_size = (s->width / s->vector_width) *
(s->height / s->vector_height) * 2;
s->decode_buffer = av_malloc(s->decode_buffer_size);
s->frame.data[0] = NULL;
return 0;
}
| [
"static av_cold int FUNC_0(AVCodecContext *avctx)\n{",
"VqaContext *s = avctx->priv_data;",
"unsigned char *VAR_0;",
"int VAR_1, VAR_2, VAR_3;",
"s->avctx = avctx;",
"avctx->pix_fmt = PIX_FMT_PAL8;",
"if (s->avctx->extradata_size != VQA_HEADER_SIZE) {",
"av_log(s->avctx, AV_LOG_ERROR, \" VQA video: expected extradata size of %d\\n\", VQA_HEADER_SIZE);",
"return -1;",
"}",
"VAR_0 = (unsigned char *)s->avctx->extradata;",
"s->vqa_version = VAR_0[0];",
"s->width = AV_RL16(&VAR_0[6]);",
"s->height = AV_RL16(&VAR_0[8]);",
"if(av_image_check_size(s->width, s->height, 0, avctx)){",
"s->width= s->height= 0;",
"return -1;",
"}",
"s->vector_width = VAR_0[10];",
"s->vector_height = VAR_0[11];",
"s->partial_count = s->partial_countdown = VAR_0[13];",
"if ((s->vector_width != 4) ||\n((s->vector_height != 2) && (s->vector_height != 4))) {",
"return -1;",
"}",
"s->codebook_size = MAX_CODEBOOK_SIZE;",
"s->codebook = av_malloc(s->codebook_size);",
"s->next_codebook_buffer = av_malloc(s->codebook_size);",
"if (s->vector_height == 4) {",
"VAR_3 = 0xFF00 * 16;",
"for (VAR_1 = 0; VAR_1 < 256; VAR_1++)",
"for (VAR_2 = 0; VAR_2 < 16; VAR_2++)",
"s->codebook[VAR_3++] = VAR_1;",
"} else {",
"VAR_3 = 0xF00 * 8;",
"for (VAR_1 = 0; VAR_1 < 256; VAR_1++)",
"for (VAR_2 = 0; VAR_2 < 8; VAR_2++)",
"s->codebook[VAR_3++] = VAR_1;",
"}",
"s->next_codebook_buffer_index = 0;",
"s->decode_buffer_size = (s->width / s->vector_width) *\n(s->height / s->vector_height) * 2;",
"s->decode_buffer = av_malloc(s->decode_buffer_size);",
"s->frame.data[0] = NULL;",
"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
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
21
],
[
23
],
[
25
],
[
27
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
59,
61
],
[
65
],
[
67
],
[
73
],
[
75
],
[
77
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
111,
113
],
[
115
],
[
119
],
[
123
],
[
125
]
]
|
12,465 | static int coroutine_fn mirror_dirty_init(MirrorBlockJob *s)
{
int64_t sector_num, end;
BlockDriverState *base = s->base;
BlockDriverState *bs = blk_bs(s->common.blk);
BlockDriverState *target_bs = blk_bs(s->target);
int ret, n;
end = s->bdev_length / BDRV_SECTOR_SIZE;
if (base == NULL && !bdrv_has_zero_init(target_bs)) {
if (!bdrv_can_write_zeroes_with_unmap(target_bs)) {
bdrv_set_dirty_bitmap(s->dirty_bitmap, 0, end);
return 0;
}
for (sector_num = 0; sector_num < end; ) {
int nb_sectors = MIN(end - sector_num,
QEMU_ALIGN_DOWN(INT_MAX, s->granularity) >> BDRV_SECTOR_BITS);
mirror_throttle(s);
if (block_job_is_cancelled(&s->common)) {
return 0;
}
if (s->in_flight >= MAX_IN_FLIGHT) {
trace_mirror_yield(s, s->in_flight, s->buf_free_count, -1);
mirror_wait_for_io(s);
continue;
}
mirror_do_zero_or_discard(s, sector_num, nb_sectors, false);
sector_num += nb_sectors;
}
mirror_drain(s);
}
/* First part, loop on the sectors and initialize the dirty bitmap. */
for (sector_num = 0; sector_num < end; ) {
/* Just to make sure we are not exceeding int limit. */
int nb_sectors = MIN(INT_MAX >> BDRV_SECTOR_BITS,
end - sector_num);
mirror_throttle(s);
if (block_job_is_cancelled(&s->common)) {
return 0;
}
ret = bdrv_is_allocated_above(bs, base, sector_num, nb_sectors, &n);
if (ret < 0) {
return ret;
}
assert(n > 0);
if (ret == 1) {
bdrv_set_dirty_bitmap(s->dirty_bitmap, sector_num, n);
}
sector_num += n;
}
return 0;
}
| false | qemu | bae8196d9f97916de6323e70e3e374362ee16ec4 | static int coroutine_fn mirror_dirty_init(MirrorBlockJob *s)
{
int64_t sector_num, end;
BlockDriverState *base = s->base;
BlockDriverState *bs = blk_bs(s->common.blk);
BlockDriverState *target_bs = blk_bs(s->target);
int ret, n;
end = s->bdev_length / BDRV_SECTOR_SIZE;
if (base == NULL && !bdrv_has_zero_init(target_bs)) {
if (!bdrv_can_write_zeroes_with_unmap(target_bs)) {
bdrv_set_dirty_bitmap(s->dirty_bitmap, 0, end);
return 0;
}
for (sector_num = 0; sector_num < end; ) {
int nb_sectors = MIN(end - sector_num,
QEMU_ALIGN_DOWN(INT_MAX, s->granularity) >> BDRV_SECTOR_BITS);
mirror_throttle(s);
if (block_job_is_cancelled(&s->common)) {
return 0;
}
if (s->in_flight >= MAX_IN_FLIGHT) {
trace_mirror_yield(s, s->in_flight, s->buf_free_count, -1);
mirror_wait_for_io(s);
continue;
}
mirror_do_zero_or_discard(s, sector_num, nb_sectors, false);
sector_num += nb_sectors;
}
mirror_drain(s);
}
for (sector_num = 0; sector_num < end; ) {
int nb_sectors = MIN(INT_MAX >> BDRV_SECTOR_BITS,
end - sector_num);
mirror_throttle(s);
if (block_job_is_cancelled(&s->common)) {
return 0;
}
ret = bdrv_is_allocated_above(bs, base, sector_num, nb_sectors, &n);
if (ret < 0) {
return ret;
}
assert(n > 0);
if (ret == 1) {
bdrv_set_dirty_bitmap(s->dirty_bitmap, sector_num, n);
}
sector_num += n;
}
return 0;
}
| {
"code": [],
"line_no": []
} | static int VAR_0 mirror_dirty_init(MirrorBlockJob *s)
{
int64_t sector_num, end;
BlockDriverState *base = s->base;
BlockDriverState *bs = blk_bs(s->common.blk);
BlockDriverState *target_bs = blk_bs(s->target);
int ret, n;
end = s->bdev_length / BDRV_SECTOR_SIZE;
if (base == NULL && !bdrv_has_zero_init(target_bs)) {
if (!bdrv_can_write_zeroes_with_unmap(target_bs)) {
bdrv_set_dirty_bitmap(s->dirty_bitmap, 0, end);
return 0;
}
for (sector_num = 0; sector_num < end; ) {
int nb_sectors = MIN(end - sector_num,
QEMU_ALIGN_DOWN(INT_MAX, s->granularity) >> BDRV_SECTOR_BITS);
mirror_throttle(s);
if (block_job_is_cancelled(&s->common)) {
return 0;
}
if (s->in_flight >= MAX_IN_FLIGHT) {
trace_mirror_yield(s, s->in_flight, s->buf_free_count, -1);
mirror_wait_for_io(s);
continue;
}
mirror_do_zero_or_discard(s, sector_num, nb_sectors, false);
sector_num += nb_sectors;
}
mirror_drain(s);
}
for (sector_num = 0; sector_num < end; ) {
int nb_sectors = MIN(INT_MAX >> BDRV_SECTOR_BITS,
end - sector_num);
mirror_throttle(s);
if (block_job_is_cancelled(&s->common)) {
return 0;
}
ret = bdrv_is_allocated_above(bs, base, sector_num, nb_sectors, &n);
if (ret < 0) {
return ret;
}
assert(n > 0);
if (ret == 1) {
bdrv_set_dirty_bitmap(s->dirty_bitmap, sector_num, n);
}
sector_num += n;
}
return 0;
}
| [
"static int VAR_0 mirror_dirty_init(MirrorBlockJob *s)\n{",
"int64_t sector_num, end;",
"BlockDriverState *base = s->base;",
"BlockDriverState *bs = blk_bs(s->common.blk);",
"BlockDriverState *target_bs = blk_bs(s->target);",
"int ret, n;",
"end = s->bdev_length / BDRV_SECTOR_SIZE;",
"if (base == NULL && !bdrv_has_zero_init(target_bs)) {",
"if (!bdrv_can_write_zeroes_with_unmap(target_bs)) {",
"bdrv_set_dirty_bitmap(s->dirty_bitmap, 0, end);",
"return 0;",
"}",
"for (sector_num = 0; sector_num < end; ) {",
"int nb_sectors = MIN(end - sector_num,\nQEMU_ALIGN_DOWN(INT_MAX, s->granularity) >> BDRV_SECTOR_BITS);",
"mirror_throttle(s);",
"if (block_job_is_cancelled(&s->common)) {",
"return 0;",
"}",
"if (s->in_flight >= MAX_IN_FLIGHT) {",
"trace_mirror_yield(s, s->in_flight, s->buf_free_count, -1);",
"mirror_wait_for_io(s);",
"continue;",
"}",
"mirror_do_zero_or_discard(s, sector_num, nb_sectors, false);",
"sector_num += nb_sectors;",
"}",
"mirror_drain(s);",
"}",
"for (sector_num = 0; sector_num < end; ) {",
"int nb_sectors = MIN(INT_MAX >> BDRV_SECTOR_BITS,\nend - sector_num);",
"mirror_throttle(s);",
"if (block_job_is_cancelled(&s->common)) {",
"return 0;",
"}",
"ret = bdrv_is_allocated_above(bs, base, sector_num, nb_sectors, &n);",
"if (ret < 0) {",
"return ret;",
"}",
"assert(n > 0);",
"if (ret == 1) {",
"bdrv_set_dirty_bitmap(s->dirty_bitmap, sector_num, n);",
"}",
"sector_num += n;",
"}",
"return 0;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35,
37
],
[
41
],
[
45
],
[
47
],
[
49
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
65
],
[
67
],
[
69
],
[
73
],
[
75
],
[
81
],
[
85,
87
],
[
91
],
[
95
],
[
97
],
[
99
],
[
103
],
[
105
],
[
107
],
[
109
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
]
]
|
12,466 | int xen_domain_build_pv(const char *kernel, const char *ramdisk,
const char *cmdline)
{
uint32_t ssidref = 0;
uint32_t flags = 0;
xen_domain_handle_t uuid;
unsigned int xenstore_port = 0, console_port = 0;
unsigned long xenstore_mfn = 0, console_mfn = 0;
int rc;
memcpy(uuid, qemu_uuid, sizeof(uuid));
rc = xc_domain_create(xen_xc, ssidref, uuid, flags, &xen_domid);
if (rc < 0) {
fprintf(stderr, "xen: xc_domain_create() failed\n");
goto err;
}
qemu_log("xen: created domain %d\n", xen_domid);
atexit(xen_domain_cleanup);
xen_domain_watcher();
xenstore_domain_init1(kernel, ramdisk, cmdline);
rc = xc_domain_max_vcpus(xen_xc, xen_domid, smp_cpus);
if (rc < 0) {
fprintf(stderr, "xen: xc_domain_max_vcpus() failed\n");
goto err;
}
#if 0
rc = xc_domain_setcpuweight(xen_xc, xen_domid, 256);
if (rc < 0) {
fprintf(stderr, "xen: xc_domain_setcpuweight() failed\n");
goto err;
}
#endif
rc = xc_domain_setmaxmem(xen_xc, xen_domid, ram_size >> 10);
if (rc < 0) {
fprintf(stderr, "xen: xc_domain_setmaxmem() failed\n");
goto err;
}
xenstore_port = xc_evtchn_alloc_unbound(xen_xc, xen_domid, 0);
console_port = xc_evtchn_alloc_unbound(xen_xc, xen_domid, 0);
rc = xc_linux_build(xen_xc, xen_domid, ram_size >> 20,
kernel, ramdisk, cmdline,
0, flags,
xenstore_port, &xenstore_mfn,
console_port, &console_mfn);
if (rc < 0) {
fprintf(stderr, "xen: xc_linux_build() failed\n");
goto err;
}
xenstore_domain_init2(xenstore_port, xenstore_mfn,
console_port, console_mfn);
qemu_log("xen: unpausing domain %d\n", xen_domid);
rc = xc_domain_unpause(xen_xc, xen_domid);
if (rc < 0) {
fprintf(stderr, "xen: xc_domain_unpause() failed\n");
goto err;
}
xen_poll = qemu_new_timer(rt_clock, xen_domain_poll, NULL);
qemu_mod_timer(xen_poll, qemu_get_clock(rt_clock) + 1000);
return 0;
err:
return -1;
}
| false | qemu | acdc3f0c59d076099c63425158c4811aaee984b6 | int xen_domain_build_pv(const char *kernel, const char *ramdisk,
const char *cmdline)
{
uint32_t ssidref = 0;
uint32_t flags = 0;
xen_domain_handle_t uuid;
unsigned int xenstore_port = 0, console_port = 0;
unsigned long xenstore_mfn = 0, console_mfn = 0;
int rc;
memcpy(uuid, qemu_uuid, sizeof(uuid));
rc = xc_domain_create(xen_xc, ssidref, uuid, flags, &xen_domid);
if (rc < 0) {
fprintf(stderr, "xen: xc_domain_create() failed\n");
goto err;
}
qemu_log("xen: created domain %d\n", xen_domid);
atexit(xen_domain_cleanup);
xen_domain_watcher();
xenstore_domain_init1(kernel, ramdisk, cmdline);
rc = xc_domain_max_vcpus(xen_xc, xen_domid, smp_cpus);
if (rc < 0) {
fprintf(stderr, "xen: xc_domain_max_vcpus() failed\n");
goto err;
}
#if 0
rc = xc_domain_setcpuweight(xen_xc, xen_domid, 256);
if (rc < 0) {
fprintf(stderr, "xen: xc_domain_setcpuweight() failed\n");
goto err;
}
#endif
rc = xc_domain_setmaxmem(xen_xc, xen_domid, ram_size >> 10);
if (rc < 0) {
fprintf(stderr, "xen: xc_domain_setmaxmem() failed\n");
goto err;
}
xenstore_port = xc_evtchn_alloc_unbound(xen_xc, xen_domid, 0);
console_port = xc_evtchn_alloc_unbound(xen_xc, xen_domid, 0);
rc = xc_linux_build(xen_xc, xen_domid, ram_size >> 20,
kernel, ramdisk, cmdline,
0, flags,
xenstore_port, &xenstore_mfn,
console_port, &console_mfn);
if (rc < 0) {
fprintf(stderr, "xen: xc_linux_build() failed\n");
goto err;
}
xenstore_domain_init2(xenstore_port, xenstore_mfn,
console_port, console_mfn);
qemu_log("xen: unpausing domain %d\n", xen_domid);
rc = xc_domain_unpause(xen_xc, xen_domid);
if (rc < 0) {
fprintf(stderr, "xen: xc_domain_unpause() failed\n");
goto err;
}
xen_poll = qemu_new_timer(rt_clock, xen_domain_poll, NULL);
qemu_mod_timer(xen_poll, qemu_get_clock(rt_clock) + 1000);
return 0;
err:
return -1;
}
| {
"code": [],
"line_no": []
} | int FUNC_0(const char *VAR_0, const char *VAR_1,
const char *VAR_2)
{
uint32_t ssidref = 0;
uint32_t flags = 0;
xen_domain_handle_t uuid;
unsigned int VAR_3 = 0, VAR_4 = 0;
unsigned long VAR_5 = 0, VAR_6 = 0;
int VAR_7;
memcpy(uuid, qemu_uuid, sizeof(uuid));
VAR_7 = xc_domain_create(xen_xc, ssidref, uuid, flags, &xen_domid);
if (VAR_7 < 0) {
fprintf(stderr, "xen: xc_domain_create() failed\n");
goto err;
}
qemu_log("xen: created domain %d\n", xen_domid);
atexit(xen_domain_cleanup);
xen_domain_watcher();
xenstore_domain_init1(VAR_0, VAR_1, VAR_2);
VAR_7 = xc_domain_max_vcpus(xen_xc, xen_domid, smp_cpus);
if (VAR_7 < 0) {
fprintf(stderr, "xen: xc_domain_max_vcpus() failed\n");
goto err;
}
#if 0
VAR_7 = xc_domain_setcpuweight(xen_xc, xen_domid, 256);
if (VAR_7 < 0) {
fprintf(stderr, "xen: xc_domain_setcpuweight() failed\n");
goto err;
}
#endif
VAR_7 = xc_domain_setmaxmem(xen_xc, xen_domid, ram_size >> 10);
if (VAR_7 < 0) {
fprintf(stderr, "xen: xc_domain_setmaxmem() failed\n");
goto err;
}
VAR_3 = xc_evtchn_alloc_unbound(xen_xc, xen_domid, 0);
VAR_4 = xc_evtchn_alloc_unbound(xen_xc, xen_domid, 0);
VAR_7 = xc_linux_build(xen_xc, xen_domid, ram_size >> 20,
VAR_0, VAR_1, VAR_2,
0, flags,
VAR_3, &VAR_5,
VAR_4, &VAR_6);
if (VAR_7 < 0) {
fprintf(stderr, "xen: xc_linux_build() failed\n");
goto err;
}
xenstore_domain_init2(VAR_3, VAR_5,
VAR_4, VAR_6);
qemu_log("xen: unpausing domain %d\n", xen_domid);
VAR_7 = xc_domain_unpause(xen_xc, xen_domid);
if (VAR_7 < 0) {
fprintf(stderr, "xen: xc_domain_unpause() failed\n");
goto err;
}
xen_poll = qemu_new_timer(rt_clock, xen_domain_poll, NULL);
qemu_mod_timer(xen_poll, qemu_get_clock(rt_clock) + 1000);
return 0;
err:
return -1;
}
| [
"int FUNC_0(const char *VAR_0, const char *VAR_1,\nconst char *VAR_2)\n{",
"uint32_t ssidref = 0;",
"uint32_t flags = 0;",
"xen_domain_handle_t uuid;",
"unsigned int VAR_3 = 0, VAR_4 = 0;",
"unsigned long VAR_5 = 0, VAR_6 = 0;",
"int VAR_7;",
"memcpy(uuid, qemu_uuid, sizeof(uuid));",
"VAR_7 = xc_domain_create(xen_xc, ssidref, uuid, flags, &xen_domid);",
"if (VAR_7 < 0) {",
"fprintf(stderr, \"xen: xc_domain_create() failed\\n\");",
"goto err;",
"}",
"qemu_log(\"xen: created domain %d\\n\", xen_domid);",
"atexit(xen_domain_cleanup);",
"xen_domain_watcher();",
"xenstore_domain_init1(VAR_0, VAR_1, VAR_2);",
"VAR_7 = xc_domain_max_vcpus(xen_xc, xen_domid, smp_cpus);",
"if (VAR_7 < 0) {",
"fprintf(stderr, \"xen: xc_domain_max_vcpus() failed\\n\");",
"goto err;",
"}",
"#if 0\nVAR_7 = xc_domain_setcpuweight(xen_xc, xen_domid, 256);",
"if (VAR_7 < 0) {",
"fprintf(stderr, \"xen: xc_domain_setcpuweight() failed\\n\");",
"goto err;",
"}",
"#endif\nVAR_7 = xc_domain_setmaxmem(xen_xc, xen_domid, ram_size >> 10);",
"if (VAR_7 < 0) {",
"fprintf(stderr, \"xen: xc_domain_setmaxmem() failed\\n\");",
"goto err;",
"}",
"VAR_3 = xc_evtchn_alloc_unbound(xen_xc, xen_domid, 0);",
"VAR_4 = xc_evtchn_alloc_unbound(xen_xc, xen_domid, 0);",
"VAR_7 = xc_linux_build(xen_xc, xen_domid, ram_size >> 20,\nVAR_0, VAR_1, VAR_2,\n0, flags,\nVAR_3, &VAR_5,\nVAR_4, &VAR_6);",
"if (VAR_7 < 0) {",
"fprintf(stderr, \"xen: xc_linux_build() failed\\n\");",
"goto err;",
"}",
"xenstore_domain_init2(VAR_3, VAR_5,\nVAR_4, VAR_6);",
"qemu_log(\"xen: unpausing domain %d\\n\", xen_domid);",
"VAR_7 = xc_domain_unpause(xen_xc, xen_domid);",
"if (VAR_7 < 0) {",
"fprintf(stderr, \"xen: xc_domain_unpause() failed\\n\");",
"goto err;",
"}",
"xen_poll = qemu_new_timer(rt_clock, xen_domain_poll, NULL);",
"qemu_mod_timer(xen_poll, qemu_get_clock(rt_clock) + 1000);",
"return 0;",
"err:\nreturn -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
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
41
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
57,
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69,
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
85
],
[
87
],
[
91,
93,
95,
97,
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
111,
113
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
131
],
[
133
],
[
135
],
[
139,
141
],
[
143
]
]
|
12,467 | static int kvm_physical_sync_dirty_bitmap(target_phys_addr_t start_addr,
target_phys_addr_t end_addr)
{
KVMState *s = kvm_state;
unsigned long size, allocated_size = 0;
KVMDirtyLog d;
KVMSlot *mem;
int ret = 0;
d.dirty_bitmap = NULL;
while (start_addr < end_addr) {
mem = kvm_lookup_overlapping_slot(s, start_addr, end_addr);
if (mem == NULL) {
break;
}
size = ALIGN(((mem->memory_size) >> TARGET_PAGE_BITS), HOST_LONG_BITS) / 8;
if (!d.dirty_bitmap) {
d.dirty_bitmap = qemu_malloc(size);
} else if (size > allocated_size) {
d.dirty_bitmap = qemu_realloc(d.dirty_bitmap, size);
}
allocated_size = size;
memset(d.dirty_bitmap, 0, allocated_size);
d.slot = mem->slot;
if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) == -1) {
DPRINTF("ioctl failed %d\n", errno);
ret = -1;
break;
}
kvm_get_dirty_pages_log_range(mem->start_addr, d.dirty_bitmap,
mem->start_addr, mem->memory_size);
start_addr = mem->start_addr + mem->memory_size;
}
qemu_free(d.dirty_bitmap);
return ret;
}
| false | qemu | a426e122173f36f05ea2cb72dcff77b7408546ce | static int kvm_physical_sync_dirty_bitmap(target_phys_addr_t start_addr,
target_phys_addr_t end_addr)
{
KVMState *s = kvm_state;
unsigned long size, allocated_size = 0;
KVMDirtyLog d;
KVMSlot *mem;
int ret = 0;
d.dirty_bitmap = NULL;
while (start_addr < end_addr) {
mem = kvm_lookup_overlapping_slot(s, start_addr, end_addr);
if (mem == NULL) {
break;
}
size = ALIGN(((mem->memory_size) >> TARGET_PAGE_BITS), HOST_LONG_BITS) / 8;
if (!d.dirty_bitmap) {
d.dirty_bitmap = qemu_malloc(size);
} else if (size > allocated_size) {
d.dirty_bitmap = qemu_realloc(d.dirty_bitmap, size);
}
allocated_size = size;
memset(d.dirty_bitmap, 0, allocated_size);
d.slot = mem->slot;
if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) == -1) {
DPRINTF("ioctl failed %d\n", errno);
ret = -1;
break;
}
kvm_get_dirty_pages_log_range(mem->start_addr, d.dirty_bitmap,
mem->start_addr, mem->memory_size);
start_addr = mem->start_addr + mem->memory_size;
}
qemu_free(d.dirty_bitmap);
return ret;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(target_phys_addr_t VAR_0,
target_phys_addr_t VAR_1)
{
KVMState *s = kvm_state;
unsigned long VAR_2, VAR_3 = 0;
KVMDirtyLog d;
KVMSlot *mem;
int VAR_4 = 0;
d.dirty_bitmap = NULL;
while (VAR_0 < VAR_1) {
mem = kvm_lookup_overlapping_slot(s, VAR_0, VAR_1);
if (mem == NULL) {
break;
}
VAR_2 = ALIGN(((mem->memory_size) >> TARGET_PAGE_BITS), HOST_LONG_BITS) / 8;
if (!d.dirty_bitmap) {
d.dirty_bitmap = qemu_malloc(VAR_2);
} else if (VAR_2 > VAR_3) {
d.dirty_bitmap = qemu_realloc(d.dirty_bitmap, VAR_2);
}
VAR_3 = VAR_2;
memset(d.dirty_bitmap, 0, VAR_3);
d.slot = mem->slot;
if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) == -1) {
DPRINTF("ioctl failed %d\n", errno);
VAR_4 = -1;
break;
}
kvm_get_dirty_pages_log_range(mem->VAR_0, d.dirty_bitmap,
mem->VAR_0, mem->memory_size);
VAR_0 = mem->VAR_0 + mem->memory_size;
}
qemu_free(d.dirty_bitmap);
return VAR_4;
}
| [
"static int FUNC_0(target_phys_addr_t VAR_0,\ntarget_phys_addr_t VAR_1)\n{",
"KVMState *s = kvm_state;",
"unsigned long VAR_2, VAR_3 = 0;",
"KVMDirtyLog d;",
"KVMSlot *mem;",
"int VAR_4 = 0;",
"d.dirty_bitmap = NULL;",
"while (VAR_0 < VAR_1) {",
"mem = kvm_lookup_overlapping_slot(s, VAR_0, VAR_1);",
"if (mem == NULL) {",
"break;",
"}",
"VAR_2 = ALIGN(((mem->memory_size) >> TARGET_PAGE_BITS), HOST_LONG_BITS) / 8;",
"if (!d.dirty_bitmap) {",
"d.dirty_bitmap = qemu_malloc(VAR_2);",
"} else if (VAR_2 > VAR_3) {",
"d.dirty_bitmap = qemu_realloc(d.dirty_bitmap, VAR_2);",
"}",
"VAR_3 = VAR_2;",
"memset(d.dirty_bitmap, 0, VAR_3);",
"d.slot = mem->slot;",
"if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) == -1) {",
"DPRINTF(\"ioctl failed %d\\n\", errno);",
"VAR_4 = -1;",
"break;",
"}",
"kvm_get_dirty_pages_log_range(mem->VAR_0, d.dirty_bitmap,\nmem->VAR_0, mem->memory_size);",
"VAR_0 = mem->VAR_0 + mem->memory_size;",
"}",
"qemu_free(d.dirty_bitmap);",
"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
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
51
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
67,
69
],
[
71
],
[
73
],
[
75
],
[
79
],
[
81
]
]
|
12,468 | static void gic_dist_writew(void *opaque, target_phys_addr_t offset,
uint32_t value)
{
gic_dist_writeb(opaque, offset, value & 0xff);
gic_dist_writeb(opaque, offset + 1, value >> 8);
}
| false | qemu | a8170e5e97ad17ca169c64ba87ae2f53850dab4c | static void gic_dist_writew(void *opaque, target_phys_addr_t offset,
uint32_t value)
{
gic_dist_writeb(opaque, offset, value & 0xff);
gic_dist_writeb(opaque, offset + 1, value >> 8);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,
uint32_t VAR_2)
{
gic_dist_writeb(VAR_0, VAR_1, VAR_2 & 0xff);
gic_dist_writeb(VAR_0, VAR_1 + 1, VAR_2 >> 8);
}
| [
"static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint32_t VAR_2)\n{",
"gic_dist_writeb(VAR_0, VAR_1, VAR_2 & 0xff);",
"gic_dist_writeb(VAR_0, VAR_1 + 1, VAR_2 >> 8);",
"}"
]
| [
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
]
]
|
12,469 | static float64 roundAndPackFloat64( flag zSign, int16 zExp, bits64 zSig STATUS_PARAM)
{
int8 roundingMode;
flag roundNearestEven;
int16 roundIncrement, roundBits;
flag isTiny;
roundingMode = STATUS(float_rounding_mode);
roundNearestEven = ( roundingMode == float_round_nearest_even );
roundIncrement = 0x200;
if ( ! roundNearestEven ) {
if ( roundingMode == float_round_to_zero ) {
roundIncrement = 0;
}
else {
roundIncrement = 0x3FF;
if ( zSign ) {
if ( roundingMode == float_round_up ) roundIncrement = 0;
}
else {
if ( roundingMode == float_round_down ) roundIncrement = 0;
}
}
}
roundBits = zSig & 0x3FF;
if ( 0x7FD <= (bits16) zExp ) {
if ( ( 0x7FD < zExp )
|| ( ( zExp == 0x7FD )
&& ( (sbits64) ( zSig + roundIncrement ) < 0 ) )
) {
float_raise( float_flag_overflow | float_flag_inexact STATUS_VAR);
return packFloat64( zSign, 0x7FF, 0 ) - ( roundIncrement == 0 );
}
if ( zExp < 0 ) {
isTiny =
( STATUS(float_detect_tininess) == float_tininess_before_rounding )
|| ( zExp < -1 )
|| ( zSig + roundIncrement < LIT64( 0x8000000000000000 ) );
shift64RightJamming( zSig, - zExp, &zSig );
zExp = 0;
roundBits = zSig & 0x3FF;
if ( isTiny && roundBits ) float_raise( float_flag_underflow STATUS_VAR);
}
}
if ( roundBits ) STATUS(float_exception_flags) |= float_flag_inexact;
zSig = ( zSig + roundIncrement )>>10;
zSig &= ~ ( ( ( roundBits ^ 0x200 ) == 0 ) & roundNearestEven );
if ( zSig == 0 ) zExp = 0;
return packFloat64( zSign, zExp, zSig );
}
| false | qemu | f090c9d4ad5812fb92843d6470a1111c15190c4c | static float64 roundAndPackFloat64( flag zSign, int16 zExp, bits64 zSig STATUS_PARAM)
{
int8 roundingMode;
flag roundNearestEven;
int16 roundIncrement, roundBits;
flag isTiny;
roundingMode = STATUS(float_rounding_mode);
roundNearestEven = ( roundingMode == float_round_nearest_even );
roundIncrement = 0x200;
if ( ! roundNearestEven ) {
if ( roundingMode == float_round_to_zero ) {
roundIncrement = 0;
}
else {
roundIncrement = 0x3FF;
if ( zSign ) {
if ( roundingMode == float_round_up ) roundIncrement = 0;
}
else {
if ( roundingMode == float_round_down ) roundIncrement = 0;
}
}
}
roundBits = zSig & 0x3FF;
if ( 0x7FD <= (bits16) zExp ) {
if ( ( 0x7FD < zExp )
|| ( ( zExp == 0x7FD )
&& ( (sbits64) ( zSig + roundIncrement ) < 0 ) )
) {
float_raise( float_flag_overflow | float_flag_inexact STATUS_VAR);
return packFloat64( zSign, 0x7FF, 0 ) - ( roundIncrement == 0 );
}
if ( zExp < 0 ) {
isTiny =
( STATUS(float_detect_tininess) == float_tininess_before_rounding )
|| ( zExp < -1 )
|| ( zSig + roundIncrement < LIT64( 0x8000000000000000 ) );
shift64RightJamming( zSig, - zExp, &zSig );
zExp = 0;
roundBits = zSig & 0x3FF;
if ( isTiny && roundBits ) float_raise( float_flag_underflow STATUS_VAR);
}
}
if ( roundBits ) STATUS(float_exception_flags) |= float_flag_inexact;
zSig = ( zSig + roundIncrement )>>10;
zSig &= ~ ( ( ( roundBits ^ 0x200 ) == 0 ) & roundNearestEven );
if ( zSig == 0 ) zExp = 0;
return packFloat64( zSign, zExp, zSig );
}
| {
"code": [],
"line_no": []
} | static float64 FUNC_0( flag zSign, int16 zExp, bits64 zSig STATUS_PARAM)
{
int8 roundingMode;
flag roundNearestEven;
int16 roundIncrement, roundBits;
flag isTiny;
roundingMode = STATUS(float_rounding_mode);
roundNearestEven = ( roundingMode == float_round_nearest_even );
roundIncrement = 0x200;
if ( ! roundNearestEven ) {
if ( roundingMode == float_round_to_zero ) {
roundIncrement = 0;
}
else {
roundIncrement = 0x3FF;
if ( zSign ) {
if ( roundingMode == float_round_up ) roundIncrement = 0;
}
else {
if ( roundingMode == float_round_down ) roundIncrement = 0;
}
}
}
roundBits = zSig & 0x3FF;
if ( 0x7FD <= (bits16) zExp ) {
if ( ( 0x7FD < zExp )
|| ( ( zExp == 0x7FD )
&& ( (sbits64) ( zSig + roundIncrement ) < 0 ) )
) {
float_raise( float_flag_overflow | float_flag_inexact STATUS_VAR);
return packFloat64( zSign, 0x7FF, 0 ) - ( roundIncrement == 0 );
}
if ( zExp < 0 ) {
isTiny =
( STATUS(float_detect_tininess) == float_tininess_before_rounding )
|| ( zExp < -1 )
|| ( zSig + roundIncrement < LIT64( 0x8000000000000000 ) );
shift64RightJamming( zSig, - zExp, &zSig );
zExp = 0;
roundBits = zSig & 0x3FF;
if ( isTiny && roundBits ) float_raise( float_flag_underflow STATUS_VAR);
}
}
if ( roundBits ) STATUS(float_exception_flags) |= float_flag_inexact;
zSig = ( zSig + roundIncrement )>>10;
zSig &= ~ ( ( ( roundBits ^ 0x200 ) == 0 ) & roundNearestEven );
if ( zSig == 0 ) zExp = 0;
return packFloat64( zSign, zExp, zSig );
}
| [
"static float64 FUNC_0( flag zSign, int16 zExp, bits64 zSig STATUS_PARAM)\n{",
"int8 roundingMode;",
"flag roundNearestEven;",
"int16 roundIncrement, roundBits;",
"flag isTiny;",
"roundingMode = STATUS(float_rounding_mode);",
"roundNearestEven = ( roundingMode == float_round_nearest_even );",
"roundIncrement = 0x200;",
"if ( ! roundNearestEven ) {",
"if ( roundingMode == float_round_to_zero ) {",
"roundIncrement = 0;",
"}",
"else {",
"roundIncrement = 0x3FF;",
"if ( zSign ) {",
"if ( roundingMode == float_round_up ) roundIncrement = 0;",
"}",
"else {",
"if ( roundingMode == float_round_down ) roundIncrement = 0;",
"}",
"}",
"}",
"roundBits = zSig & 0x3FF;",
"if ( 0x7FD <= (bits16) zExp ) {",
"if ( ( 0x7FD < zExp )\n|| ( ( zExp == 0x7FD )\n&& ( (sbits64) ( zSig + roundIncrement ) < 0 ) )\n) {",
"float_raise( float_flag_overflow | float_flag_inexact STATUS_VAR);",
"return packFloat64( zSign, 0x7FF, 0 ) - ( roundIncrement == 0 );",
"}",
"if ( zExp < 0 ) {",
"isTiny =\n( STATUS(float_detect_tininess) == float_tininess_before_rounding )\n|| ( zExp < -1 )\n|| ( zSig + roundIncrement < LIT64( 0x8000000000000000 ) );",
"shift64RightJamming( zSig, - zExp, &zSig );",
"zExp = 0;",
"roundBits = zSig & 0x3FF;",
"if ( isTiny && roundBits ) float_raise( float_flag_underflow STATUS_VAR);",
"}",
"}",
"if ( roundBits ) STATUS(float_exception_flags) |= float_flag_inexact;",
"zSig = ( zSig + roundIncrement )>>10;",
"zSig &= ~ ( ( ( roundBits ^ 0x200 ) == 0 ) & roundNearestEven );",
"if ( zSig == 0 ) zExp = 0;",
"return packFloat64( zSign, zExp, zSig );",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53,
55,
57,
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69,
71,
73,
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
101
]
]
|
12,471 | static void intel_hda_parse_bdl(IntelHDAState *d, IntelHDAStream *st)
{
target_phys_addr_t addr;
uint8_t buf[16];
uint32_t i;
addr = intel_hda_addr(st->bdlp_lbase, st->bdlp_ubase);
st->bentries = st->lvi +1;
g_free(st->bpl);
st->bpl = g_malloc(sizeof(bpl) * st->bentries);
for (i = 0; i < st->bentries; i++, addr += 16) {
pci_dma_read(&d->pci, addr, buf, 16);
st->bpl[i].addr = le64_to_cpu(*(uint64_t *)buf);
st->bpl[i].len = le32_to_cpu(*(uint32_t *)(buf + 8));
st->bpl[i].flags = le32_to_cpu(*(uint32_t *)(buf + 12));
dprint(d, 1, "bdl/%d: 0x%" PRIx64 " +0x%x, 0x%x\n",
i, st->bpl[i].addr, st->bpl[i].len, st->bpl[i].flags);
}
st->bsize = st->cbl;
st->lpib = 0;
st->be = 0;
st->bp = 0;
}
| false | qemu | a8170e5e97ad17ca169c64ba87ae2f53850dab4c | static void intel_hda_parse_bdl(IntelHDAState *d, IntelHDAStream *st)
{
target_phys_addr_t addr;
uint8_t buf[16];
uint32_t i;
addr = intel_hda_addr(st->bdlp_lbase, st->bdlp_ubase);
st->bentries = st->lvi +1;
g_free(st->bpl);
st->bpl = g_malloc(sizeof(bpl) * st->bentries);
for (i = 0; i < st->bentries; i++, addr += 16) {
pci_dma_read(&d->pci, addr, buf, 16);
st->bpl[i].addr = le64_to_cpu(*(uint64_t *)buf);
st->bpl[i].len = le32_to_cpu(*(uint32_t *)(buf + 8));
st->bpl[i].flags = le32_to_cpu(*(uint32_t *)(buf + 12));
dprint(d, 1, "bdl/%d: 0x%" PRIx64 " +0x%x, 0x%x\n",
i, st->bpl[i].addr, st->bpl[i].len, st->bpl[i].flags);
}
st->bsize = st->cbl;
st->lpib = 0;
st->be = 0;
st->bp = 0;
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(IntelHDAState *VAR_0, IntelHDAStream *VAR_1)
{
target_phys_addr_t addr;
uint8_t buf[16];
uint32_t i;
addr = intel_hda_addr(VAR_1->bdlp_lbase, VAR_1->bdlp_ubase);
VAR_1->bentries = VAR_1->lvi +1;
g_free(VAR_1->bpl);
VAR_1->bpl = g_malloc(sizeof(bpl) * VAR_1->bentries);
for (i = 0; i < VAR_1->bentries; i++, addr += 16) {
pci_dma_read(&VAR_0->pci, addr, buf, 16);
VAR_1->bpl[i].addr = le64_to_cpu(*(uint64_t *)buf);
VAR_1->bpl[i].len = le32_to_cpu(*(uint32_t *)(buf + 8));
VAR_1->bpl[i].flags = le32_to_cpu(*(uint32_t *)(buf + 12));
dprint(VAR_0, 1, "bdl/%VAR_0: 0x%" PRIx64 " +0x%x, 0x%x\n",
i, VAR_1->bpl[i].addr, VAR_1->bpl[i].len, VAR_1->bpl[i].flags);
}
VAR_1->bsize = VAR_1->cbl;
VAR_1->lpib = 0;
VAR_1->be = 0;
VAR_1->bp = 0;
}
| [
"static void FUNC_0(IntelHDAState *VAR_0, IntelHDAStream *VAR_1)\n{",
"target_phys_addr_t addr;",
"uint8_t buf[16];",
"uint32_t i;",
"addr = intel_hda_addr(VAR_1->bdlp_lbase, VAR_1->bdlp_ubase);",
"VAR_1->bentries = VAR_1->lvi +1;",
"g_free(VAR_1->bpl);",
"VAR_1->bpl = g_malloc(sizeof(bpl) * VAR_1->bentries);",
"for (i = 0; i < VAR_1->bentries; i++, addr += 16) {",
"pci_dma_read(&VAR_0->pci, addr, buf, 16);",
"VAR_1->bpl[i].addr = le64_to_cpu(*(uint64_t *)buf);",
"VAR_1->bpl[i].len = le32_to_cpu(*(uint32_t *)(buf + 8));",
"VAR_1->bpl[i].flags = le32_to_cpu(*(uint32_t *)(buf + 12));",
"dprint(VAR_0, 1, \"bdl/%VAR_0: 0x%\" PRIx64 \" +0x%x, 0x%x\\n\",\ni, VAR_1->bpl[i].addr, VAR_1->bpl[i].len, VAR_1->bpl[i].flags);",
"}",
"VAR_1->bsize = VAR_1->cbl;",
"VAR_1->lpib = 0;",
"VAR_1->be = 0;",
"VAR_1->bp = 0;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31,
33
],
[
35
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
]
]
|
12,472 | static void mptsas_fetch_request(MPTSASState *s)
{
PCIDevice *pci = (PCIDevice *) s;
char req[MPTSAS_MAX_REQUEST_SIZE];
MPIRequestHeader *hdr = (MPIRequestHeader *)req;
hwaddr addr;
int size;
if (s->state != MPI_IOC_STATE_OPERATIONAL) {
mptsas_set_fault(s, MPI_IOCSTATUS_INVALID_STATE);
return;
}
/* Read the message header from the guest first. */
addr = s->host_mfa_high_addr | MPTSAS_FIFO_GET(s, request_post);
pci_dma_read(pci, addr, req, sizeof(hdr));
if (hdr->Function < ARRAY_SIZE(mpi_request_sizes) &&
mpi_request_sizes[hdr->Function]) {
/* Read the rest of the request based on the type. Do not
* reread everything, as that could cause a TOC/TOU mismatch
* and leak data from the QEMU stack.
*/
size = mpi_request_sizes[hdr->Function];
assert(size <= MPTSAS_MAX_REQUEST_SIZE);
pci_dma_read(pci, addr + sizeof(hdr), &req[sizeof(hdr)],
size - sizeof(hdr));
}
if (hdr->Function == MPI_FUNCTION_SCSI_IO_REQUEST) {
/* SCSI I/O requests are separate from mptsas_process_message
* because they cannot be sent through the doorbell yet.
*/
mptsas_process_scsi_io_request(s, (MPIMsgSCSIIORequest *)req, addr);
} else {
mptsas_process_message(s, (MPIRequestHeader *)req);
}
}
| false | qemu | 06630554ccbdd25780aa03c3548aaff1eb56dffd | static void mptsas_fetch_request(MPTSASState *s)
{
PCIDevice *pci = (PCIDevice *) s;
char req[MPTSAS_MAX_REQUEST_SIZE];
MPIRequestHeader *hdr = (MPIRequestHeader *)req;
hwaddr addr;
int size;
if (s->state != MPI_IOC_STATE_OPERATIONAL) {
mptsas_set_fault(s, MPI_IOCSTATUS_INVALID_STATE);
return;
}
addr = s->host_mfa_high_addr | MPTSAS_FIFO_GET(s, request_post);
pci_dma_read(pci, addr, req, sizeof(hdr));
if (hdr->Function < ARRAY_SIZE(mpi_request_sizes) &&
mpi_request_sizes[hdr->Function]) {
size = mpi_request_sizes[hdr->Function];
assert(size <= MPTSAS_MAX_REQUEST_SIZE);
pci_dma_read(pci, addr + sizeof(hdr), &req[sizeof(hdr)],
size - sizeof(hdr));
}
if (hdr->Function == MPI_FUNCTION_SCSI_IO_REQUEST) {
mptsas_process_scsi_io_request(s, (MPIMsgSCSIIORequest *)req, addr);
} else {
mptsas_process_message(s, (MPIRequestHeader *)req);
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(MPTSASState *VAR_0)
{
PCIDevice *pci = (PCIDevice *) VAR_0;
char VAR_1[MPTSAS_MAX_REQUEST_SIZE];
MPIRequestHeader *hdr = (MPIRequestHeader *)VAR_1;
hwaddr addr;
int VAR_2;
if (VAR_0->state != MPI_IOC_STATE_OPERATIONAL) {
mptsas_set_fault(VAR_0, MPI_IOCSTATUS_INVALID_STATE);
return;
}
addr = VAR_0->host_mfa_high_addr | MPTSAS_FIFO_GET(VAR_0, request_post);
pci_dma_read(pci, addr, VAR_1, sizeof(hdr));
if (hdr->Function < ARRAY_SIZE(mpi_request_sizes) &&
mpi_request_sizes[hdr->Function]) {
VAR_2 = mpi_request_sizes[hdr->Function];
assert(VAR_2 <= MPTSAS_MAX_REQUEST_SIZE);
pci_dma_read(pci, addr + sizeof(hdr), &VAR_1[sizeof(hdr)],
VAR_2 - sizeof(hdr));
}
if (hdr->Function == MPI_FUNCTION_SCSI_IO_REQUEST) {
mptsas_process_scsi_io_request(VAR_0, (MPIMsgSCSIIORequest *)VAR_1, addr);
} else {
mptsas_process_message(VAR_0, (MPIRequestHeader *)VAR_1);
}
}
| [
"static void FUNC_0(MPTSASState *VAR_0)\n{",
"PCIDevice *pci = (PCIDevice *) VAR_0;",
"char VAR_1[MPTSAS_MAX_REQUEST_SIZE];",
"MPIRequestHeader *hdr = (MPIRequestHeader *)VAR_1;",
"hwaddr addr;",
"int VAR_2;",
"if (VAR_0->state != MPI_IOC_STATE_OPERATIONAL) {",
"mptsas_set_fault(VAR_0, MPI_IOCSTATUS_INVALID_STATE);",
"return;",
"}",
"addr = VAR_0->host_mfa_high_addr | MPTSAS_FIFO_GET(VAR_0, request_post);",
"pci_dma_read(pci, addr, VAR_1, sizeof(hdr));",
"if (hdr->Function < ARRAY_SIZE(mpi_request_sizes) &&\nmpi_request_sizes[hdr->Function]) {",
"VAR_2 = mpi_request_sizes[hdr->Function];",
"assert(VAR_2 <= MPTSAS_MAX_REQUEST_SIZE);",
"pci_dma_read(pci, addr + sizeof(hdr), &VAR_1[sizeof(hdr)],\nVAR_2 - sizeof(hdr));",
"}",
"if (hdr->Function == MPI_FUNCTION_SCSI_IO_REQUEST) {",
"mptsas_process_scsi_io_request(VAR_0, (MPIMsgSCSIIORequest *)VAR_1, addr);",
"} else {",
"mptsas_process_message(VAR_0, (MPIRequestHeader *)VAR_1);",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
19
],
[
21
],
[
23
],
[
29
],
[
31
],
[
35,
37
],
[
47
],
[
49
],
[
51,
53
],
[
55
],
[
59
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
]
]
|
12,473 | static void test_qemu_strtoull_full_max(void)
{
char *str = g_strdup_printf("%lld", ULLONG_MAX);
uint64_t res = 999;
int err;
err = qemu_strtoull(str, NULL, 0, &res);
g_assert_cmpint(err, ==, 0);
g_assert_cmpint(res, ==, ULLONG_MAX);
g_free(str);
}
| false | qemu | bc7c08a2c375acb7ae4d433054415588b176d34c | static void test_qemu_strtoull_full_max(void)
{
char *str = g_strdup_printf("%lld", ULLONG_MAX);
uint64_t res = 999;
int err;
err = qemu_strtoull(str, NULL, 0, &res);
g_assert_cmpint(err, ==, 0);
g_assert_cmpint(res, ==, ULLONG_MAX);
g_free(str);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(void)
{
char *VAR_0 = g_strdup_printf("%lld", ULLONG_MAX);
uint64_t res = 999;
int VAR_1;
VAR_1 = qemu_strtoull(VAR_0, NULL, 0, &res);
g_assert_cmpint(VAR_1, ==, 0);
g_assert_cmpint(res, ==, ULLONG_MAX);
g_free(VAR_0);
}
| [
"static void FUNC_0(void)\n{",
"char *VAR_0 = g_strdup_printf(\"%lld\", ULLONG_MAX);",
"uint64_t res = 999;",
"int VAR_1;",
"VAR_1 = qemu_strtoull(VAR_0, NULL, 0, &res);",
"g_assert_cmpint(VAR_1, ==, 0);",
"g_assert_cmpint(res, ==, ULLONG_MAX);",
"g_free(VAR_0);",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
17
],
[
19
],
[
21
],
[
23
]
]
|
12,474 | static void mem_add(MemoryListener *listener, MemoryRegionSection *section)
{
AddressSpaceDispatch *d = container_of(listener, AddressSpaceDispatch, listener);
MemoryRegionSection now = limit(*section), remain = limit(*section);
if ((now.offset_within_address_space & ~TARGET_PAGE_MASK)
|| (now.size < TARGET_PAGE_SIZE)) {
now.size = MIN(TARGET_PAGE_ALIGN(now.offset_within_address_space)
- now.offset_within_address_space,
now.size);
register_subpage(d, &now);
remain.size -= now.size;
remain.offset_within_address_space += now.size;
remain.offset_within_region += now.size;
}
while (remain.size >= TARGET_PAGE_SIZE) {
now = remain;
if (remain.offset_within_region & ~TARGET_PAGE_MASK) {
now.size = TARGET_PAGE_SIZE;
register_subpage(d, &now);
} else {
now.size &= TARGET_PAGE_MASK;
register_multipage(d, &now);
}
remain.size -= now.size;
remain.offset_within_address_space += now.size;
remain.offset_within_region += now.size;
}
now = remain;
if (now.size) {
register_subpage(d, &now);
}
}
| false | qemu | 99b9cc0679585b2d495d7d31ce556549b6b2721c | static void mem_add(MemoryListener *listener, MemoryRegionSection *section)
{
AddressSpaceDispatch *d = container_of(listener, AddressSpaceDispatch, listener);
MemoryRegionSection now = limit(*section), remain = limit(*section);
if ((now.offset_within_address_space & ~TARGET_PAGE_MASK)
|| (now.size < TARGET_PAGE_SIZE)) {
now.size = MIN(TARGET_PAGE_ALIGN(now.offset_within_address_space)
- now.offset_within_address_space,
now.size);
register_subpage(d, &now);
remain.size -= now.size;
remain.offset_within_address_space += now.size;
remain.offset_within_region += now.size;
}
while (remain.size >= TARGET_PAGE_SIZE) {
now = remain;
if (remain.offset_within_region & ~TARGET_PAGE_MASK) {
now.size = TARGET_PAGE_SIZE;
register_subpage(d, &now);
} else {
now.size &= TARGET_PAGE_MASK;
register_multipage(d, &now);
}
remain.size -= now.size;
remain.offset_within_address_space += now.size;
remain.offset_within_region += now.size;
}
now = remain;
if (now.size) {
register_subpage(d, &now);
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(MemoryListener *VAR_0, MemoryRegionSection *VAR_1)
{
AddressSpaceDispatch *d = container_of(VAR_0, AddressSpaceDispatch, VAR_0);
MemoryRegionSection now = limit(*VAR_1), remain = limit(*VAR_1);
if ((now.offset_within_address_space & ~TARGET_PAGE_MASK)
|| (now.size < TARGET_PAGE_SIZE)) {
now.size = MIN(TARGET_PAGE_ALIGN(now.offset_within_address_space)
- now.offset_within_address_space,
now.size);
register_subpage(d, &now);
remain.size -= now.size;
remain.offset_within_address_space += now.size;
remain.offset_within_region += now.size;
}
while (remain.size >= TARGET_PAGE_SIZE) {
now = remain;
if (remain.offset_within_region & ~TARGET_PAGE_MASK) {
now.size = TARGET_PAGE_SIZE;
register_subpage(d, &now);
} else {
now.size &= TARGET_PAGE_MASK;
register_multipage(d, &now);
}
remain.size -= now.size;
remain.offset_within_address_space += now.size;
remain.offset_within_region += now.size;
}
now = remain;
if (now.size) {
register_subpage(d, &now);
}
}
| [
"static void FUNC_0(MemoryListener *VAR_0, MemoryRegionSection *VAR_1)\n{",
"AddressSpaceDispatch *d = container_of(VAR_0, AddressSpaceDispatch, VAR_0);",
"MemoryRegionSection now = limit(*VAR_1), remain = limit(*VAR_1);",
"if ((now.offset_within_address_space & ~TARGET_PAGE_MASK)\n|| (now.size < TARGET_PAGE_SIZE)) {",
"now.size = MIN(TARGET_PAGE_ALIGN(now.offset_within_address_space)\n- now.offset_within_address_space,\nnow.size);",
"register_subpage(d, &now);",
"remain.size -= now.size;",
"remain.offset_within_address_space += now.size;",
"remain.offset_within_region += now.size;",
"}",
"while (remain.size >= TARGET_PAGE_SIZE) {",
"now = remain;",
"if (remain.offset_within_region & ~TARGET_PAGE_MASK) {",
"now.size = TARGET_PAGE_SIZE;",
"register_subpage(d, &now);",
"} else {",
"now.size &= TARGET_PAGE_MASK;",
"register_multipage(d, &now);",
"}",
"remain.size -= now.size;",
"remain.offset_within_address_space += now.size;",
"remain.offset_within_region += now.size;",
"}",
"now = remain;",
"if (now.size) {",
"register_subpage(d, &now);",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
]
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.