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
|
---|---|---|---|---|---|---|---|---|---|---|
9,569 |
int pit_get_initial_count(PITState *pit, int channel)
{
PITChannelState *s = &pit->channels[channel];
return s->count;
}
| false |
qemu
|
64d7e9a421fea0ac50b44541f5521de455e7cd5d
|
int pit_get_initial_count(PITState *pit, int channel)
{
PITChannelState *s = &pit->channels[channel];
return s->count;
}
|
{
"code": [],
"line_no": []
}
|
int FUNC_0(PITState *VAR_0, int VAR_1)
{
PITChannelState *s = &VAR_0->channels[VAR_1];
return s->count;
}
|
[
"int FUNC_0(PITState *VAR_0, int VAR_1)\n{",
"PITChannelState *s = &VAR_0->channels[VAR_1];",
"return s->count;",
"}"
] |
[
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
]
] |
9,570 |
static void net_socket_update_fd_handler(NetSocketState *s)
{
qemu_set_fd_handler2(s->fd,
s->read_poll ? net_socket_can_send : NULL,
s->read_poll ? s->send_fn : NULL,
s->write_poll ? net_socket_writable : NULL,
s);
}
| false |
qemu
|
6e99c631f116221d169ea53953d91b8aa74d297a
|
static void net_socket_update_fd_handler(NetSocketState *s)
{
qemu_set_fd_handler2(s->fd,
s->read_poll ? net_socket_can_send : NULL,
s->read_poll ? s->send_fn : NULL,
s->write_poll ? net_socket_writable : NULL,
s);
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(NetSocketState *VAR_0)
{
qemu_set_fd_handler2(VAR_0->fd,
VAR_0->read_poll ? net_socket_can_send : NULL,
VAR_0->read_poll ? VAR_0->send_fn : NULL,
VAR_0->write_poll ? net_socket_writable : NULL,
VAR_0);
}
|
[
"static void FUNC_0(NetSocketState *VAR_0)\n{",
"qemu_set_fd_handler2(VAR_0->fd,\nVAR_0->read_poll ? net_socket_can_send : NULL,\nVAR_0->read_poll ? VAR_0->send_fn : NULL,\nVAR_0->write_poll ? net_socket_writable : NULL,\nVAR_0);",
"}"
] |
[
0,
0,
0
] |
[
[
1,
3
],
[
5,
7,
9,
11,
13
],
[
15
]
] |
9,571 |
static void bdrv_throttle_read_timer_cb(void *opaque)
{
BlockDriverState *bs = opaque;
qemu_co_enter_next(&bs->throttled_reqs[0]);
}
| false |
qemu
|
61007b316cd71ee7333ff7a0a749a8949527575f
|
static void bdrv_throttle_read_timer_cb(void *opaque)
{
BlockDriverState *bs = opaque;
qemu_co_enter_next(&bs->throttled_reqs[0]);
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(void *VAR_0)
{
BlockDriverState *bs = VAR_0;
qemu_co_enter_next(&bs->throttled_reqs[0]);
}
|
[
"static void FUNC_0(void *VAR_0)\n{",
"BlockDriverState *bs = VAR_0;",
"qemu_co_enter_next(&bs->throttled_reqs[0]);",
"}"
] |
[
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
]
] |
9,572 |
static void host_x86_cpu_initfn(Object *obj)
{
X86CPU *cpu = X86_CPU(obj);
CPUX86State *env = &cpu->env;
KVMState *s = kvm_state;
/* We can't fill the features array here because we don't know yet if
* "migratable" is true or false.
*/
cpu->host_features = true;
/* If KVM is disabled, cpu_x86_create() will already report an error */
if (kvm_enabled()) {
env->cpuid_level = kvm_arch_get_supported_cpuid(s, 0x0, 0, R_EAX);
env->cpuid_xlevel = kvm_arch_get_supported_cpuid(s, 0x80000000, 0, R_EAX);
env->cpuid_xlevel2 = kvm_arch_get_supported_cpuid(s, 0xC0000000, 0, R_EAX);
}
object_property_set_bool(OBJECT(cpu), true, "pmu", &error_abort);
}
| false |
qemu
|
104494ea25ef6286d79e2f17d609f7ef4cd2dcce
|
static void host_x86_cpu_initfn(Object *obj)
{
X86CPU *cpu = X86_CPU(obj);
CPUX86State *env = &cpu->env;
KVMState *s = kvm_state;
cpu->host_features = true;
if (kvm_enabled()) {
env->cpuid_level = kvm_arch_get_supported_cpuid(s, 0x0, 0, R_EAX);
env->cpuid_xlevel = kvm_arch_get_supported_cpuid(s, 0x80000000, 0, R_EAX);
env->cpuid_xlevel2 = kvm_arch_get_supported_cpuid(s, 0xC0000000, 0, R_EAX);
}
object_property_set_bool(OBJECT(cpu), true, "pmu", &error_abort);
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(Object *VAR_0)
{
X86CPU *cpu = X86_CPU(VAR_0);
CPUX86State *env = &cpu->env;
KVMState *s = kvm_state;
cpu->host_features = true;
if (kvm_enabled()) {
env->cpuid_level = kvm_arch_get_supported_cpuid(s, 0x0, 0, R_EAX);
env->cpuid_xlevel = kvm_arch_get_supported_cpuid(s, 0x80000000, 0, R_EAX);
env->cpuid_xlevel2 = kvm_arch_get_supported_cpuid(s, 0xC0000000, 0, R_EAX);
}
object_property_set_bool(OBJECT(cpu), true, "pmu", &error_abort);
}
|
[
"static void FUNC_0(Object *VAR_0)\n{",
"X86CPU *cpu = X86_CPU(VAR_0);",
"CPUX86State *env = &cpu->env;",
"KVMState *s = kvm_state;",
"cpu->host_features = true;",
"if (kvm_enabled()) {",
"env->cpuid_level = kvm_arch_get_supported_cpuid(s, 0x0, 0, R_EAX);",
"env->cpuid_xlevel = kvm_arch_get_supported_cpuid(s, 0x80000000, 0, R_EAX);",
"env->cpuid_xlevel2 = kvm_arch_get_supported_cpuid(s, 0xC0000000, 0, R_EAX);",
"}",
"object_property_set_bool(OBJECT(cpu), true, \"pmu\", &error_abort);",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
19
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
37
],
[
39
]
] |
9,573 |
void usb_device_attach(USBDevice *dev, Error **errp)
{
USBBus *bus = usb_bus_from_device(dev);
USBPort *port = dev->port;
char devspeed[32], portspeed[32];
assert(port != NULL);
assert(!dev->attached);
usb_mask_to_str(devspeed, sizeof(devspeed), dev->speedmask);
usb_mask_to_str(portspeed, sizeof(portspeed), port->speedmask);
trace_usb_port_attach(bus->busnr, port->path,
devspeed, portspeed);
if (!(port->speedmask & dev->speedmask)) {
error_setg(errp, "Warning: speed mismatch trying to attach"
" usb device \"%s\" (%s speed)"
" to bus \"%s\", port \"%s\" (%s speed)",
dev->product_desc, devspeed,
bus->qbus.name, port->path, portspeed);
return;
}
dev->attached++;
usb_attach(port);
}
| false |
qemu
|
594a53607e5bd4a2b7555a7a2908d2c406fea9aa
|
void usb_device_attach(USBDevice *dev, Error **errp)
{
USBBus *bus = usb_bus_from_device(dev);
USBPort *port = dev->port;
char devspeed[32], portspeed[32];
assert(port != NULL);
assert(!dev->attached);
usb_mask_to_str(devspeed, sizeof(devspeed), dev->speedmask);
usb_mask_to_str(portspeed, sizeof(portspeed), port->speedmask);
trace_usb_port_attach(bus->busnr, port->path,
devspeed, portspeed);
if (!(port->speedmask & dev->speedmask)) {
error_setg(errp, "Warning: speed mismatch trying to attach"
" usb device \"%s\" (%s speed)"
" to bus \"%s\", port \"%s\" (%s speed)",
dev->product_desc, devspeed,
bus->qbus.name, port->path, portspeed);
return;
}
dev->attached++;
usb_attach(port);
}
|
{
"code": [],
"line_no": []
}
|
void FUNC_0(USBDevice *VAR_0, Error **VAR_1)
{
USBBus *bus = usb_bus_from_device(VAR_0);
USBPort *port = VAR_0->port;
char VAR_2[32], VAR_3[32];
assert(port != NULL);
assert(!VAR_0->attached);
usb_mask_to_str(VAR_2, sizeof(VAR_2), VAR_0->speedmask);
usb_mask_to_str(VAR_3, sizeof(VAR_3), port->speedmask);
trace_usb_port_attach(bus->busnr, port->path,
VAR_2, VAR_3);
if (!(port->speedmask & VAR_0->speedmask)) {
error_setg(VAR_1, "Warning: speed mismatch trying to attach"
" usb device \"%s\" (%s speed)"
" to bus \"%s\", port \"%s\" (%s speed)",
VAR_0->product_desc, VAR_2,
bus->qbus.name, port->path, VAR_3);
return;
}
VAR_0->attached++;
usb_attach(port);
}
|
[
"void FUNC_0(USBDevice *VAR_0, Error **VAR_1)\n{",
"USBBus *bus = usb_bus_from_device(VAR_0);",
"USBPort *port = VAR_0->port;",
"char VAR_2[32], VAR_3[32];",
"assert(port != NULL);",
"assert(!VAR_0->attached);",
"usb_mask_to_str(VAR_2, sizeof(VAR_2), VAR_0->speedmask);",
"usb_mask_to_str(VAR_3, sizeof(VAR_3), port->speedmask);",
"trace_usb_port_attach(bus->busnr, port->path,\nVAR_2, VAR_3);",
"if (!(port->speedmask & VAR_0->speedmask)) {",
"error_setg(VAR_1, \"Warning: speed mismatch trying to attach\"\n\" usb device \\\"%s\\\" (%s speed)\"\n\" to bus \\\"%s\\\", port \\\"%s\\\" (%s speed)\",\nVAR_0->product_desc, VAR_2,\nbus->qbus.name, port->path, VAR_3);",
"return;",
"}",
"VAR_0->attached++;",
"usb_attach(port);",
"}"
] |
[
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
],
[
27
],
[
29,
31,
33,
35,
37
],
[
39
],
[
41
],
[
45
],
[
47
],
[
49
]
] |
9,575 |
static void gen_store_exclusive(DisasContext *s, int rd, int rt, int rt2,
TCGv_i32 addr, int size)
{
TCGv_i32 tmp;
TCGv_i64 val64, extaddr;
int done_label;
int fail_label;
/* if (env->exclusive_addr == addr && env->exclusive_val == [addr]) {
[addr] = {Rt};
{Rd} = 0;
} else {
{Rd} = 1;
} */
fail_label = gen_new_label();
done_label = gen_new_label();
extaddr = tcg_temp_new_i64();
tcg_gen_extu_i32_i64(extaddr, addr);
tcg_gen_brcond_i64(TCG_COND_NE, extaddr, cpu_exclusive_addr, fail_label);
tcg_temp_free_i64(extaddr);
tmp = tcg_temp_new_i32();
switch (size) {
case 0:
gen_aa32_ld8u(tmp, addr, get_mem_index(s));
break;
case 1:
gen_aa32_ld16u(tmp, addr, get_mem_index(s));
break;
case 2:
case 3:
gen_aa32_ld32u(tmp, addr, get_mem_index(s));
break;
default:
abort();
}
val64 = tcg_temp_new_i64();
if (size == 3) {
TCGv_i32 tmp2 = tcg_temp_new_i32();
TCGv_i32 tmp3 = tcg_temp_new_i32();
tcg_gen_addi_i32(tmp2, addr, 4);
gen_aa32_ld32u(tmp3, tmp2, get_mem_index(s));
tcg_temp_free_i32(tmp2);
tcg_gen_concat_i32_i64(val64, tmp, tmp3);
tcg_temp_free_i32(tmp3);
} else {
tcg_gen_extu_i32_i64(val64, tmp);
}
tcg_temp_free_i32(tmp);
tcg_gen_brcond_i64(TCG_COND_NE, val64, cpu_exclusive_val, fail_label);
tcg_temp_free_i64(val64);
tmp = load_reg(s, rt);
switch (size) {
case 0:
gen_aa32_st8(tmp, addr, get_mem_index(s));
break;
case 1:
gen_aa32_st16(tmp, addr, get_mem_index(s));
break;
case 2:
case 3:
gen_aa32_st32(tmp, addr, get_mem_index(s));
break;
default:
abort();
}
tcg_temp_free_i32(tmp);
if (size == 3) {
tcg_gen_addi_i32(addr, addr, 4);
tmp = load_reg(s, rt2);
gen_aa32_st32(tmp, addr, get_mem_index(s));
tcg_temp_free_i32(tmp);
}
tcg_gen_movi_i32(cpu_R[rd], 0);
tcg_gen_br(done_label);
gen_set_label(fail_label);
tcg_gen_movi_i32(cpu_R[rd], 1);
gen_set_label(done_label);
tcg_gen_movi_i64(cpu_exclusive_addr, -1);
}
| false |
qemu
|
42a268c241183877192c376d03bd9b6d527407c7
|
static void gen_store_exclusive(DisasContext *s, int rd, int rt, int rt2,
TCGv_i32 addr, int size)
{
TCGv_i32 tmp;
TCGv_i64 val64, extaddr;
int done_label;
int fail_label;
fail_label = gen_new_label();
done_label = gen_new_label();
extaddr = tcg_temp_new_i64();
tcg_gen_extu_i32_i64(extaddr, addr);
tcg_gen_brcond_i64(TCG_COND_NE, extaddr, cpu_exclusive_addr, fail_label);
tcg_temp_free_i64(extaddr);
tmp = tcg_temp_new_i32();
switch (size) {
case 0:
gen_aa32_ld8u(tmp, addr, get_mem_index(s));
break;
case 1:
gen_aa32_ld16u(tmp, addr, get_mem_index(s));
break;
case 2:
case 3:
gen_aa32_ld32u(tmp, addr, get_mem_index(s));
break;
default:
abort();
}
val64 = tcg_temp_new_i64();
if (size == 3) {
TCGv_i32 tmp2 = tcg_temp_new_i32();
TCGv_i32 tmp3 = tcg_temp_new_i32();
tcg_gen_addi_i32(tmp2, addr, 4);
gen_aa32_ld32u(tmp3, tmp2, get_mem_index(s));
tcg_temp_free_i32(tmp2);
tcg_gen_concat_i32_i64(val64, tmp, tmp3);
tcg_temp_free_i32(tmp3);
} else {
tcg_gen_extu_i32_i64(val64, tmp);
}
tcg_temp_free_i32(tmp);
tcg_gen_brcond_i64(TCG_COND_NE, val64, cpu_exclusive_val, fail_label);
tcg_temp_free_i64(val64);
tmp = load_reg(s, rt);
switch (size) {
case 0:
gen_aa32_st8(tmp, addr, get_mem_index(s));
break;
case 1:
gen_aa32_st16(tmp, addr, get_mem_index(s));
break;
case 2:
case 3:
gen_aa32_st32(tmp, addr, get_mem_index(s));
break;
default:
abort();
}
tcg_temp_free_i32(tmp);
if (size == 3) {
tcg_gen_addi_i32(addr, addr, 4);
tmp = load_reg(s, rt2);
gen_aa32_st32(tmp, addr, get_mem_index(s));
tcg_temp_free_i32(tmp);
}
tcg_gen_movi_i32(cpu_R[rd], 0);
tcg_gen_br(done_label);
gen_set_label(fail_label);
tcg_gen_movi_i32(cpu_R[rd], 1);
gen_set_label(done_label);
tcg_gen_movi_i64(cpu_exclusive_addr, -1);
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(DisasContext *VAR_0, int VAR_1, int VAR_2, int VAR_3,
TCGv_i32 VAR_4, int VAR_5)
{
TCGv_i32 tmp;
TCGv_i64 val64, extaddr;
int VAR_6;
int VAR_7;
VAR_7 = gen_new_label();
VAR_6 = gen_new_label();
extaddr = tcg_temp_new_i64();
tcg_gen_extu_i32_i64(extaddr, VAR_4);
tcg_gen_brcond_i64(TCG_COND_NE, extaddr, cpu_exclusive_addr, VAR_7);
tcg_temp_free_i64(extaddr);
tmp = tcg_temp_new_i32();
switch (VAR_5) {
case 0:
gen_aa32_ld8u(tmp, VAR_4, get_mem_index(VAR_0));
break;
case 1:
gen_aa32_ld16u(tmp, VAR_4, get_mem_index(VAR_0));
break;
case 2:
case 3:
gen_aa32_ld32u(tmp, VAR_4, get_mem_index(VAR_0));
break;
default:
abort();
}
val64 = tcg_temp_new_i64();
if (VAR_5 == 3) {
TCGv_i32 tmp2 = tcg_temp_new_i32();
TCGv_i32 tmp3 = tcg_temp_new_i32();
tcg_gen_addi_i32(tmp2, VAR_4, 4);
gen_aa32_ld32u(tmp3, tmp2, get_mem_index(VAR_0));
tcg_temp_free_i32(tmp2);
tcg_gen_concat_i32_i64(val64, tmp, tmp3);
tcg_temp_free_i32(tmp3);
} else {
tcg_gen_extu_i32_i64(val64, tmp);
}
tcg_temp_free_i32(tmp);
tcg_gen_brcond_i64(TCG_COND_NE, val64, cpu_exclusive_val, VAR_7);
tcg_temp_free_i64(val64);
tmp = load_reg(VAR_0, VAR_2);
switch (VAR_5) {
case 0:
gen_aa32_st8(tmp, VAR_4, get_mem_index(VAR_0));
break;
case 1:
gen_aa32_st16(tmp, VAR_4, get_mem_index(VAR_0));
break;
case 2:
case 3:
gen_aa32_st32(tmp, VAR_4, get_mem_index(VAR_0));
break;
default:
abort();
}
tcg_temp_free_i32(tmp);
if (VAR_5 == 3) {
tcg_gen_addi_i32(VAR_4, VAR_4, 4);
tmp = load_reg(VAR_0, VAR_3);
gen_aa32_st32(tmp, VAR_4, get_mem_index(VAR_0));
tcg_temp_free_i32(tmp);
}
tcg_gen_movi_i32(cpu_R[VAR_1], 0);
tcg_gen_br(VAR_6);
gen_set_label(VAR_7);
tcg_gen_movi_i32(cpu_R[VAR_1], 1);
gen_set_label(VAR_6);
tcg_gen_movi_i64(cpu_exclusive_addr, -1);
}
|
[
"static void FUNC_0(DisasContext *VAR_0, int VAR_1, int VAR_2, int VAR_3,\nTCGv_i32 VAR_4, int VAR_5)\n{",
"TCGv_i32 tmp;",
"TCGv_i64 val64, extaddr;",
"int VAR_6;",
"int VAR_7;",
"VAR_7 = gen_new_label();",
"VAR_6 = gen_new_label();",
"extaddr = tcg_temp_new_i64();",
"tcg_gen_extu_i32_i64(extaddr, VAR_4);",
"tcg_gen_brcond_i64(TCG_COND_NE, extaddr, cpu_exclusive_addr, VAR_7);",
"tcg_temp_free_i64(extaddr);",
"tmp = tcg_temp_new_i32();",
"switch (VAR_5) {",
"case 0:\ngen_aa32_ld8u(tmp, VAR_4, get_mem_index(VAR_0));",
"break;",
"case 1:\ngen_aa32_ld16u(tmp, VAR_4, get_mem_index(VAR_0));",
"break;",
"case 2:\ncase 3:\ngen_aa32_ld32u(tmp, VAR_4, get_mem_index(VAR_0));",
"break;",
"default:\nabort();",
"}",
"val64 = tcg_temp_new_i64();",
"if (VAR_5 == 3) {",
"TCGv_i32 tmp2 = tcg_temp_new_i32();",
"TCGv_i32 tmp3 = tcg_temp_new_i32();",
"tcg_gen_addi_i32(tmp2, VAR_4, 4);",
"gen_aa32_ld32u(tmp3, tmp2, get_mem_index(VAR_0));",
"tcg_temp_free_i32(tmp2);",
"tcg_gen_concat_i32_i64(val64, tmp, tmp3);",
"tcg_temp_free_i32(tmp3);",
"} else {",
"tcg_gen_extu_i32_i64(val64, tmp);",
"}",
"tcg_temp_free_i32(tmp);",
"tcg_gen_brcond_i64(TCG_COND_NE, val64, cpu_exclusive_val, VAR_7);",
"tcg_temp_free_i64(val64);",
"tmp = load_reg(VAR_0, VAR_2);",
"switch (VAR_5) {",
"case 0:\ngen_aa32_st8(tmp, VAR_4, get_mem_index(VAR_0));",
"break;",
"case 1:\ngen_aa32_st16(tmp, VAR_4, get_mem_index(VAR_0));",
"break;",
"case 2:\ncase 3:\ngen_aa32_st32(tmp, VAR_4, get_mem_index(VAR_0));",
"break;",
"default:\nabort();",
"}",
"tcg_temp_free_i32(tmp);",
"if (VAR_5 == 3) {",
"tcg_gen_addi_i32(VAR_4, VAR_4, 4);",
"tmp = load_reg(VAR_0, VAR_3);",
"gen_aa32_st32(tmp, VAR_4, get_mem_index(VAR_0));",
"tcg_temp_free_i32(tmp);",
"}",
"tcg_gen_movi_i32(cpu_R[VAR_1], 0);",
"tcg_gen_br(VAR_6);",
"gen_set_label(VAR_7);",
"tcg_gen_movi_i32(cpu_R[VAR_1], 1);",
"gen_set_label(VAR_6);",
"tcg_gen_movi_i64(cpu_exclusive_addr, -1);",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
43
],
[
45
],
[
47,
49
],
[
51
],
[
53,
55
],
[
57
],
[
59,
61,
63
],
[
65
],
[
67,
69
],
[
71
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
103
],
[
105
],
[
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
]
] |
9,578 |
static int gdbserver_open(int port)
{
struct sockaddr_in sockaddr;
int fd, ret;
fd = socket(PF_INET, SOCK_STREAM, 0);
if (fd < 0) {
perror("socket");
return -1;
}
#ifndef _WIN32
fcntl(fd, F_SETFD, FD_CLOEXEC);
#endif
socket_set_fast_reuse(fd);
sockaddr.sin_family = AF_INET;
sockaddr.sin_port = htons(port);
sockaddr.sin_addr.s_addr = 0;
ret = bind(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr));
if (ret < 0) {
perror("bind");
close(fd);
return -1;
}
ret = listen(fd, 0);
if (ret < 0) {
perror("listen");
close(fd);
return -1;
}
return fd;
}
| false |
qemu
|
96165b9eb4207a34a87c46df731d3cc42c052e13
|
static int gdbserver_open(int port)
{
struct sockaddr_in sockaddr;
int fd, ret;
fd = socket(PF_INET, SOCK_STREAM, 0);
if (fd < 0) {
perror("socket");
return -1;
}
#ifndef _WIN32
fcntl(fd, F_SETFD, FD_CLOEXEC);
#endif
socket_set_fast_reuse(fd);
sockaddr.sin_family = AF_INET;
sockaddr.sin_port = htons(port);
sockaddr.sin_addr.s_addr = 0;
ret = bind(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr));
if (ret < 0) {
perror("bind");
close(fd);
return -1;
}
ret = listen(fd, 0);
if (ret < 0) {
perror("listen");
close(fd);
return -1;
}
return fd;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(int VAR_0)
{
struct sockaddr_in VAR_1;
int VAR_2, VAR_3;
VAR_2 = socket(PF_INET, SOCK_STREAM, 0);
if (VAR_2 < 0) {
perror("socket");
return -1;
}
#ifndef _WIN32
fcntl(VAR_2, F_SETFD, FD_CLOEXEC);
#endif
socket_set_fast_reuse(VAR_2);
VAR_1.sin_family = AF_INET;
VAR_1.sin_port = htons(VAR_0);
VAR_1.sin_addr.s_addr = 0;
VAR_3 = bind(VAR_2, (struct VAR_1 *)&VAR_1, sizeof(VAR_1));
if (VAR_3 < 0) {
perror("bind");
close(VAR_2);
return -1;
}
VAR_3 = listen(VAR_2, 0);
if (VAR_3 < 0) {
perror("listen");
close(VAR_2);
return -1;
}
return VAR_2;
}
|
[
"static int FUNC_0(int VAR_0)\n{",
"struct sockaddr_in VAR_1;",
"int VAR_2, VAR_3;",
"VAR_2 = socket(PF_INET, SOCK_STREAM, 0);",
"if (VAR_2 < 0) {",
"perror(\"socket\");",
"return -1;",
"}",
"#ifndef _WIN32\nfcntl(VAR_2, F_SETFD, FD_CLOEXEC);",
"#endif\nsocket_set_fast_reuse(VAR_2);",
"VAR_1.sin_family = AF_INET;",
"VAR_1.sin_port = htons(VAR_0);",
"VAR_1.sin_addr.s_addr = 0;",
"VAR_3 = bind(VAR_2, (struct VAR_1 *)&VAR_1, sizeof(VAR_1));",
"if (VAR_3 < 0) {",
"perror(\"bind\");",
"close(VAR_2);",
"return -1;",
"}",
"VAR_3 = listen(VAR_2, 0);",
"if (VAR_3 < 0) {",
"perror(\"listen\");",
"close(VAR_2);",
"return -1;",
"}",
"return VAR_2;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21,
23
],
[
25,
29
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
]
] |
9,580 |
void bdrv_get_geometry_hint(BlockDriverState *bs,
int *pcyls, int *pheads, int *psecs)
{
*pcyls = bs->cyls;
*pheads = bs->heads;
*psecs = bs->secs;
}
| false |
qemu
|
2b584959ed300ddff4acba0d7554becad5f274fd
|
void bdrv_get_geometry_hint(BlockDriverState *bs,
int *pcyls, int *pheads, int *psecs)
{
*pcyls = bs->cyls;
*pheads = bs->heads;
*psecs = bs->secs;
}
|
{
"code": [],
"line_no": []
}
|
void FUNC_0(BlockDriverState *VAR_0,
int *VAR_1, int *VAR_2, int *VAR_3)
{
*VAR_1 = VAR_0->cyls;
*VAR_2 = VAR_0->heads;
*VAR_3 = VAR_0->secs;
}
|
[
"void FUNC_0(BlockDriverState *VAR_0,\nint *VAR_1, int *VAR_2, int *VAR_3)\n{",
"*VAR_1 = VAR_0->cyls;",
"*VAR_2 = VAR_0->heads;",
"*VAR_3 = VAR_0->secs;",
"}"
] |
[
0,
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
]
] |
9,581 |
static uint64_t arm_thiswdog_read(void *opaque, target_phys_addr_t addr,
unsigned size)
{
arm_mptimer_state *s = (arm_mptimer_state *)opaque;
int id = get_current_cpu(s);
return timerblock_read(&s->timerblock[id * 2 + 1], addr, size);
}
| false |
qemu
|
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
|
static uint64_t arm_thiswdog_read(void *opaque, target_phys_addr_t addr,
unsigned size)
{
arm_mptimer_state *s = (arm_mptimer_state *)opaque;
int id = get_current_cpu(s);
return timerblock_read(&s->timerblock[id * 2 + 1], addr, size);
}
|
{
"code": [],
"line_no": []
}
|
static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr,
unsigned size)
{
arm_mptimer_state *s = (arm_mptimer_state *)opaque;
int VAR_0 = get_current_cpu(s);
return timerblock_read(&s->timerblock[VAR_0 * 2 + 1], addr, size);
}
|
[
"static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr,\nunsigned size)\n{",
"arm_mptimer_state *s = (arm_mptimer_state *)opaque;",
"int VAR_0 = get_current_cpu(s);",
"return timerblock_read(&s->timerblock[VAR_0 * 2 + 1], addr, size);",
"}"
] |
[
0,
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
]
] |
9,582 |
e1000_set_link_status(NetClientState *nc)
{
E1000State *s = qemu_get_nic_opaque(nc);
uint32_t old_status = s->mac_reg[STATUS];
if (nc->link_down) {
e1000_link_down(s);
} else {
if (s->compat_flags & E1000_FLAG_AUTONEG &&
s->phy_reg[PHY_CTRL] & MII_CR_AUTO_NEG_EN &&
s->phy_reg[PHY_CTRL] & MII_CR_RESTART_AUTO_NEG &&
!(s->phy_reg[PHY_STATUS] & MII_SR_AUTONEG_COMPLETE)) {
/* emulate auto-negotiation if supported */
timer_mod(s->autoneg_timer,
qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + 500);
} else {
e1000_link_up(s);
}
}
if (s->mac_reg[STATUS] != old_status)
set_ics(s, 0, E1000_ICR_LSC);
}
| false |
qemu
|
d7a4155265416a1c8f3067b59e68bf5fda1d6215
|
e1000_set_link_status(NetClientState *nc)
{
E1000State *s = qemu_get_nic_opaque(nc);
uint32_t old_status = s->mac_reg[STATUS];
if (nc->link_down) {
e1000_link_down(s);
} else {
if (s->compat_flags & E1000_FLAG_AUTONEG &&
s->phy_reg[PHY_CTRL] & MII_CR_AUTO_NEG_EN &&
s->phy_reg[PHY_CTRL] & MII_CR_RESTART_AUTO_NEG &&
!(s->phy_reg[PHY_STATUS] & MII_SR_AUTONEG_COMPLETE)) {
timer_mod(s->autoneg_timer,
qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + 500);
} else {
e1000_link_up(s);
}
}
if (s->mac_reg[STATUS] != old_status)
set_ics(s, 0, E1000_ICR_LSC);
}
|
{
"code": [],
"line_no": []
}
|
FUNC_0(NetClientState *VAR_0)
{
E1000State *s = qemu_get_nic_opaque(VAR_0);
uint32_t old_status = s->mac_reg[STATUS];
if (VAR_0->link_down) {
e1000_link_down(s);
} else {
if (s->compat_flags & E1000_FLAG_AUTONEG &&
s->phy_reg[PHY_CTRL] & MII_CR_AUTO_NEG_EN &&
s->phy_reg[PHY_CTRL] & MII_CR_RESTART_AUTO_NEG &&
!(s->phy_reg[PHY_STATUS] & MII_SR_AUTONEG_COMPLETE)) {
timer_mod(s->autoneg_timer,
qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + 500);
} else {
e1000_link_up(s);
}
}
if (s->mac_reg[STATUS] != old_status)
set_ics(s, 0, E1000_ICR_LSC);
}
|
[
"FUNC_0(NetClientState *VAR_0)\n{",
"E1000State *s = qemu_get_nic_opaque(VAR_0);",
"uint32_t old_status = s->mac_reg[STATUS];",
"if (VAR_0->link_down) {",
"e1000_link_down(s);",
"} else {",
"if (s->compat_flags & E1000_FLAG_AUTONEG &&\ns->phy_reg[PHY_CTRL] & MII_CR_AUTO_NEG_EN &&\ns->phy_reg[PHY_CTRL] & MII_CR_RESTART_AUTO_NEG &&\n!(s->phy_reg[PHY_STATUS] & MII_SR_AUTONEG_COMPLETE)) {",
"timer_mod(s->autoneg_timer,\nqemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + 500);",
"} else {",
"e1000_link_up(s);",
"}",
"}",
"if (s->mac_reg[STATUS] != old_status)\nset_ics(s, 0, E1000_ICR_LSC);",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
15
],
[
17,
19,
21,
23
],
[
27,
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
41,
43
],
[
45
]
] |
9,587 |
static inline void backup_mb_border(H264Context *h, uint8_t *src_y, uint8_t *src_cb, uint8_t *src_cr, int linesize, int uvlinesize, int simple){
MpegEncContext * const s = &h->s;
int i;
int step = 1;
int offset = 1;
int uvoffset= 1;
int top_idx = 1;
int skiplast= 0;
src_y -= linesize;
src_cb -= uvlinesize;
src_cr -= uvlinesize;
if(!simple && FRAME_MBAFF){
if(s->mb_y&1){
offset = MB_MBAFF ? 1 : 17;
uvoffset= MB_MBAFF ? 1 : 9;
if(!MB_MBAFF){
*(uint64_t*)(h->top_borders[0][s->mb_x]+ 0)= *(uint64_t*)(src_y + 15*linesize);
*(uint64_t*)(h->top_borders[0][s->mb_x]+ 8)= *(uint64_t*)(src_y +8+15*linesize);
if(simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
*(uint64_t*)(h->top_borders[0][s->mb_x]+16)= *(uint64_t*)(src_cb+7*uvlinesize);
*(uint64_t*)(h->top_borders[0][s->mb_x]+24)= *(uint64_t*)(src_cr+7*uvlinesize);
}
}
}else{
if(!MB_MBAFF){
h->left_border[0]= h->top_borders[0][s->mb_x][15];
if(simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
h->left_border[34 ]= h->top_borders[0][s->mb_x][16+7 ];
h->left_border[34+18]= h->top_borders[0][s->mb_x][16+8+7];
}
skiplast= 1;
}
offset =
uvoffset=
top_idx = MB_MBAFF ? 0 : 1;
}
step= MB_MBAFF ? 2 : 1;
}
// There are two lines saved, the line above the the top macroblock of a pair,
// and the line above the bottom macroblock
h->left_border[offset]= h->top_borders[top_idx][s->mb_x][15];
for(i=1; i<17 - skiplast; i++){
h->left_border[offset+i*step]= src_y[15+i* linesize];
}
*(uint64_t*)(h->top_borders[top_idx][s->mb_x]+0)= *(uint64_t*)(src_y + 16*linesize);
*(uint64_t*)(h->top_borders[top_idx][s->mb_x]+8)= *(uint64_t*)(src_y +8+16*linesize);
if(simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
h->left_border[uvoffset+34 ]= h->top_borders[top_idx][s->mb_x][16+7];
h->left_border[uvoffset+34+18]= h->top_borders[top_idx][s->mb_x][24+7];
for(i=1; i<9 - skiplast; i++){
h->left_border[uvoffset+34 +i*step]= src_cb[7+i*uvlinesize];
h->left_border[uvoffset+34+18+i*step]= src_cr[7+i*uvlinesize];
}
*(uint64_t*)(h->top_borders[top_idx][s->mb_x]+16)= *(uint64_t*)(src_cb+8*uvlinesize);
*(uint64_t*)(h->top_borders[top_idx][s->mb_x]+24)= *(uint64_t*)(src_cr+8*uvlinesize);
}
}
| false |
FFmpeg
|
c988f97566cdf536ba0dcbc0d77d885456852060
|
static inline void backup_mb_border(H264Context *h, uint8_t *src_y, uint8_t *src_cb, uint8_t *src_cr, int linesize, int uvlinesize, int simple){
MpegEncContext * const s = &h->s;
int i;
int step = 1;
int offset = 1;
int uvoffset= 1;
int top_idx = 1;
int skiplast= 0;
src_y -= linesize;
src_cb -= uvlinesize;
src_cr -= uvlinesize;
if(!simple && FRAME_MBAFF){
if(s->mb_y&1){
offset = MB_MBAFF ? 1 : 17;
uvoffset= MB_MBAFF ? 1 : 9;
if(!MB_MBAFF){
*(uint64_t*)(h->top_borders[0][s->mb_x]+ 0)= *(uint64_t*)(src_y + 15*linesize);
*(uint64_t*)(h->top_borders[0][s->mb_x]+ 8)= *(uint64_t*)(src_y +8+15*linesize);
if(simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
*(uint64_t*)(h->top_borders[0][s->mb_x]+16)= *(uint64_t*)(src_cb+7*uvlinesize);
*(uint64_t*)(h->top_borders[0][s->mb_x]+24)= *(uint64_t*)(src_cr+7*uvlinesize);
}
}
}else{
if(!MB_MBAFF){
h->left_border[0]= h->top_borders[0][s->mb_x][15];
if(simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
h->left_border[34 ]= h->top_borders[0][s->mb_x][16+7 ];
h->left_border[34+18]= h->top_borders[0][s->mb_x][16+8+7];
}
skiplast= 1;
}
offset =
uvoffset=
top_idx = MB_MBAFF ? 0 : 1;
}
step= MB_MBAFF ? 2 : 1;
}
h->left_border[offset]= h->top_borders[top_idx][s->mb_x][15];
for(i=1; i<17 - skiplast; i++){
h->left_border[offset+i*step]= src_y[15+i* linesize];
}
*(uint64_t*)(h->top_borders[top_idx][s->mb_x]+0)= *(uint64_t*)(src_y + 16*linesize);
*(uint64_t*)(h->top_borders[top_idx][s->mb_x]+8)= *(uint64_t*)(src_y +8+16*linesize);
if(simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
h->left_border[uvoffset+34 ]= h->top_borders[top_idx][s->mb_x][16+7];
h->left_border[uvoffset+34+18]= h->top_borders[top_idx][s->mb_x][24+7];
for(i=1; i<9 - skiplast; i++){
h->left_border[uvoffset+34 +i*step]= src_cb[7+i*uvlinesize];
h->left_border[uvoffset+34+18+i*step]= src_cr[7+i*uvlinesize];
}
*(uint64_t*)(h->top_borders[top_idx][s->mb_x]+16)= *(uint64_t*)(src_cb+8*uvlinesize);
*(uint64_t*)(h->top_borders[top_idx][s->mb_x]+24)= *(uint64_t*)(src_cr+8*uvlinesize);
}
}
|
{
"code": [],
"line_no": []
}
|
static inline void FUNC_0(H264Context *VAR_0, uint8_t *VAR_1, uint8_t *VAR_2, uint8_t *VAR_3, int VAR_4, int VAR_5, int VAR_6){
MpegEncContext * const s = &VAR_0->s;
int VAR_7;
int VAR_8 = 1;
int VAR_9 = 1;
int VAR_10= 1;
int VAR_11 = 1;
int VAR_12= 0;
VAR_1 -= VAR_4;
VAR_2 -= VAR_5;
VAR_3 -= VAR_5;
if(!VAR_6 && FRAME_MBAFF){
if(s->mb_y&1){
VAR_9 = MB_MBAFF ? 1 : 17;
VAR_10= MB_MBAFF ? 1 : 9;
if(!MB_MBAFF){
*(uint64_t*)(VAR_0->top_borders[0][s->mb_x]+ 0)= *(uint64_t*)(VAR_1 + 15*VAR_4);
*(uint64_t*)(VAR_0->top_borders[0][s->mb_x]+ 8)= *(uint64_t*)(VAR_1 +8+15*VAR_4);
if(VAR_6 || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
*(uint64_t*)(VAR_0->top_borders[0][s->mb_x]+16)= *(uint64_t*)(VAR_2+7*VAR_5);
*(uint64_t*)(VAR_0->top_borders[0][s->mb_x]+24)= *(uint64_t*)(VAR_3+7*VAR_5);
}
}
}else{
if(!MB_MBAFF){
VAR_0->left_border[0]= VAR_0->top_borders[0][s->mb_x][15];
if(VAR_6 || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
VAR_0->left_border[34 ]= VAR_0->top_borders[0][s->mb_x][16+7 ];
VAR_0->left_border[34+18]= VAR_0->top_borders[0][s->mb_x][16+8+7];
}
VAR_12= 1;
}
VAR_9 =
VAR_10=
VAR_11 = MB_MBAFF ? 0 : 1;
}
VAR_8= MB_MBAFF ? 2 : 1;
}
VAR_0->left_border[VAR_9]= VAR_0->top_borders[VAR_11][s->mb_x][15];
for(VAR_7=1; VAR_7<17 - VAR_12; VAR_7++){
VAR_0->left_border[VAR_9+VAR_7*VAR_8]= VAR_1[15+VAR_7* VAR_4];
}
*(uint64_t*)(VAR_0->top_borders[VAR_11][s->mb_x]+0)= *(uint64_t*)(VAR_1 + 16*VAR_4);
*(uint64_t*)(VAR_0->top_borders[VAR_11][s->mb_x]+8)= *(uint64_t*)(VAR_1 +8+16*VAR_4);
if(VAR_6 || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
VAR_0->left_border[VAR_10+34 ]= VAR_0->top_borders[VAR_11][s->mb_x][16+7];
VAR_0->left_border[VAR_10+34+18]= VAR_0->top_borders[VAR_11][s->mb_x][24+7];
for(VAR_7=1; VAR_7<9 - VAR_12; VAR_7++){
VAR_0->left_border[VAR_10+34 +VAR_7*VAR_8]= VAR_2[7+VAR_7*VAR_5];
VAR_0->left_border[VAR_10+34+18+VAR_7*VAR_8]= VAR_3[7+VAR_7*VAR_5];
}
*(uint64_t*)(VAR_0->top_borders[VAR_11][s->mb_x]+16)= *(uint64_t*)(VAR_2+8*VAR_5);
*(uint64_t*)(VAR_0->top_borders[VAR_11][s->mb_x]+24)= *(uint64_t*)(VAR_3+8*VAR_5);
}
}
|
[
"static inline void FUNC_0(H264Context *VAR_0, uint8_t *VAR_1, uint8_t *VAR_2, uint8_t *VAR_3, int VAR_4, int VAR_5, int VAR_6){",
"MpegEncContext * const s = &VAR_0->s;",
"int VAR_7;",
"int VAR_8 = 1;",
"int VAR_9 = 1;",
"int VAR_10= 1;",
"int VAR_11 = 1;",
"int VAR_12= 0;",
"VAR_1 -= VAR_4;",
"VAR_2 -= VAR_5;",
"VAR_3 -= VAR_5;",
"if(!VAR_6 && FRAME_MBAFF){",
"if(s->mb_y&1){",
"VAR_9 = MB_MBAFF ? 1 : 17;",
"VAR_10= MB_MBAFF ? 1 : 9;",
"if(!MB_MBAFF){",
"*(uint64_t*)(VAR_0->top_borders[0][s->mb_x]+ 0)= *(uint64_t*)(VAR_1 + 15*VAR_4);",
"*(uint64_t*)(VAR_0->top_borders[0][s->mb_x]+ 8)= *(uint64_t*)(VAR_1 +8+15*VAR_4);",
"if(VAR_6 || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){",
"*(uint64_t*)(VAR_0->top_borders[0][s->mb_x]+16)= *(uint64_t*)(VAR_2+7*VAR_5);",
"*(uint64_t*)(VAR_0->top_borders[0][s->mb_x]+24)= *(uint64_t*)(VAR_3+7*VAR_5);",
"}",
"}",
"}else{",
"if(!MB_MBAFF){",
"VAR_0->left_border[0]= VAR_0->top_borders[0][s->mb_x][15];",
"if(VAR_6 || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){",
"VAR_0->left_border[34 ]= VAR_0->top_borders[0][s->mb_x][16+7 ];",
"VAR_0->left_border[34+18]= VAR_0->top_borders[0][s->mb_x][16+8+7];",
"}",
"VAR_12= 1;",
"}",
"VAR_9 =\nVAR_10=\nVAR_11 = MB_MBAFF ? 0 : 1;",
"}",
"VAR_8= MB_MBAFF ? 2 : 1;",
"}",
"VAR_0->left_border[VAR_9]= VAR_0->top_borders[VAR_11][s->mb_x][15];",
"for(VAR_7=1; VAR_7<17 - VAR_12; VAR_7++){",
"VAR_0->left_border[VAR_9+VAR_7*VAR_8]= VAR_1[15+VAR_7* VAR_4];",
"}",
"*(uint64_t*)(VAR_0->top_borders[VAR_11][s->mb_x]+0)= *(uint64_t*)(VAR_1 + 16*VAR_4);",
"*(uint64_t*)(VAR_0->top_borders[VAR_11][s->mb_x]+8)= *(uint64_t*)(VAR_1 +8+16*VAR_4);",
"if(VAR_6 || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){",
"VAR_0->left_border[VAR_10+34 ]= VAR_0->top_borders[VAR_11][s->mb_x][16+7];",
"VAR_0->left_border[VAR_10+34+18]= VAR_0->top_borders[VAR_11][s->mb_x][24+7];",
"for(VAR_7=1; VAR_7<9 - VAR_12; VAR_7++){",
"VAR_0->left_border[VAR_10+34 +VAR_7*VAR_8]= VAR_2[7+VAR_7*VAR_5];",
"VAR_0->left_border[VAR_10+34+18+VAR_7*VAR_8]= VAR_3[7+VAR_7*VAR_5];",
"}",
"*(uint64_t*)(VAR_0->top_borders[VAR_11][s->mb_x]+16)= *(uint64_t*)(VAR_2+8*VAR_5);",
"*(uint64_t*)(VAR_0->top_borders[VAR_11][s->mb_x]+24)= *(uint64_t*)(VAR_3+8*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
] |
[
[
1
],
[
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69,
71,
73
],
[
75
],
[
77
],
[
79
],
[
87
],
[
89
],
[
91
],
[
93
],
[
97
],
[
99
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
]
] |
9,588 |
static ssize_t qio_channel_file_readv(QIOChannel *ioc,
const struct iovec *iov,
size_t niov,
int **fds,
size_t *nfds,
Error **errp)
{
QIOChannelFile *fioc = QIO_CHANNEL_FILE(ioc);
ssize_t ret;
retry:
ret = readv(fioc->fd, iov, niov);
if (ret < 0) {
if (errno == EAGAIN ||
errno == EWOULDBLOCK) {
return QIO_CHANNEL_ERR_BLOCK;
}
if (errno == EINTR) {
goto retry;
}
error_setg_errno(errp, errno,
"Unable to read from file");
return -1;
}
return ret;
}
| false |
qemu
|
30fd3e27907dfd1c0c66cc1339657af1a2ce1d4b
|
static ssize_t qio_channel_file_readv(QIOChannel *ioc,
const struct iovec *iov,
size_t niov,
int **fds,
size_t *nfds,
Error **errp)
{
QIOChannelFile *fioc = QIO_CHANNEL_FILE(ioc);
ssize_t ret;
retry:
ret = readv(fioc->fd, iov, niov);
if (ret < 0) {
if (errno == EAGAIN ||
errno == EWOULDBLOCK) {
return QIO_CHANNEL_ERR_BLOCK;
}
if (errno == EINTR) {
goto retry;
}
error_setg_errno(errp, errno,
"Unable to read from file");
return -1;
}
return ret;
}
|
{
"code": [],
"line_no": []
}
|
static ssize_t FUNC_0(QIOChannel *ioc,
const struct iovec *iov,
size_t niov,
int **fds,
size_t *nfds,
Error **errp)
{
QIOChannelFile *fioc = QIO_CHANNEL_FILE(ioc);
ssize_t ret;
retry:
ret = readv(fioc->fd, iov, niov);
if (ret < 0) {
if (errno == EAGAIN ||
errno == EWOULDBLOCK) {
return QIO_CHANNEL_ERR_BLOCK;
}
if (errno == EINTR) {
goto retry;
}
error_setg_errno(errp, errno,
"Unable to read from file");
return -1;
}
return ret;
}
|
[
"static ssize_t FUNC_0(QIOChannel *ioc,\nconst struct iovec *iov,\nsize_t niov,\nint **fds,\nsize_t *nfds,\nError **errp)\n{",
"QIOChannelFile *fioc = QIO_CHANNEL_FILE(ioc);",
"ssize_t ret;",
"retry:\nret = readv(fioc->fd, iov, niov);",
"if (ret < 0) {",
"if (errno == EAGAIN ||\nerrno == EWOULDBLOCK) {",
"return QIO_CHANNEL_ERR_BLOCK;",
"}",
"if (errno == EINTR) {",
"goto retry;",
"}",
"error_setg_errno(errp, errno,\n\"Unable to read from file\");",
"return -1;",
"}",
"return ret;",
"}"
] |
[
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
]
] |
9,589 |
int mmap_frag(unsigned long host_start,
unsigned long start, unsigned long end,
int prot, int flags, int fd, unsigned long offset)
{
unsigned long host_end, ret, addr;
int prot1, prot_new;
host_end = host_start + qemu_host_page_size;
/* get the protection of the target pages outside the mapping */
prot1 = 0;
for(addr = host_start; addr < host_end; addr++) {
if (addr < start || addr >= end)
prot1 |= page_get_flags(addr);
}
if (prot1 == 0) {
/* no page was there, so we allocate one */
ret = (long)mmap((void *)host_start, qemu_host_page_size, prot,
flags | MAP_ANONYMOUS, -1, 0);
if (ret == -1)
return ret;
}
prot1 &= PAGE_BITS;
prot_new = prot | prot1;
if (!(flags & MAP_ANONYMOUS)) {
/* msync() won't work here, so we return an error if write is
possible while it is a shared mapping */
#ifndef __APPLE__
if ((flags & MAP_TYPE) == MAP_SHARED &&
#else
if ((flags & MAP_SHARED) &&
#endif
(prot & PROT_WRITE))
return -EINVAL;
/* adjust protection to be able to read */
if (!(prot1 & PROT_WRITE))
mprotect((void *)host_start, qemu_host_page_size, prot1 | PROT_WRITE);
/* read the corresponding file data */
pread(fd, (void *)start, end - start, offset);
/* put final protection */
if (prot_new != (prot1 | PROT_WRITE))
mprotect((void *)host_start, qemu_host_page_size, prot_new);
} else {
/* just update the protection */
if (prot_new != prot1) {
mprotect((void *)host_start, qemu_host_page_size, prot_new);
}
}
return 0;
}
| false |
qemu
|
059bca46bbfd7f16cd2ccca631b91334e08d9abb
|
int mmap_frag(unsigned long host_start,
unsigned long start, unsigned long end,
int prot, int flags, int fd, unsigned long offset)
{
unsigned long host_end, ret, addr;
int prot1, prot_new;
host_end = host_start + qemu_host_page_size;
prot1 = 0;
for(addr = host_start; addr < host_end; addr++) {
if (addr < start || addr >= end)
prot1 |= page_get_flags(addr);
}
if (prot1 == 0) {
ret = (long)mmap((void *)host_start, qemu_host_page_size, prot,
flags | MAP_ANONYMOUS, -1, 0);
if (ret == -1)
return ret;
}
prot1 &= PAGE_BITS;
prot_new = prot | prot1;
if (!(flags & MAP_ANONYMOUS)) {
#ifndef __APPLE__
if ((flags & MAP_TYPE) == MAP_SHARED &&
#else
if ((flags & MAP_SHARED) &&
#endif
(prot & PROT_WRITE))
return -EINVAL;
if (!(prot1 & PROT_WRITE))
mprotect((void *)host_start, qemu_host_page_size, prot1 | PROT_WRITE);
pread(fd, (void *)start, end - start, offset);
if (prot_new != (prot1 | PROT_WRITE))
mprotect((void *)host_start, qemu_host_page_size, prot_new);
} else {
if (prot_new != prot1) {
mprotect((void *)host_start, qemu_host_page_size, prot_new);
}
}
return 0;
}
|
{
"code": [],
"line_no": []
}
|
int FUNC_0(unsigned long VAR_0,
unsigned long VAR_1, unsigned long VAR_2,
int VAR_3, int VAR_4, int VAR_5, unsigned long VAR_6)
{
unsigned long VAR_7, VAR_8, VAR_9;
int VAR_10, VAR_11;
VAR_7 = VAR_0 + qemu_host_page_size;
VAR_10 = 0;
for(VAR_9 = VAR_0; VAR_9 < VAR_7; VAR_9++) {
if (VAR_9 < VAR_1 || VAR_9 >= VAR_2)
VAR_10 |= page_get_flags(VAR_9);
}
if (VAR_10 == 0) {
VAR_8 = (long)mmap((void *)VAR_0, qemu_host_page_size, VAR_3,
VAR_4 | MAP_ANONYMOUS, -1, 0);
if (VAR_8 == -1)
return VAR_8;
}
VAR_10 &= PAGE_BITS;
VAR_11 = VAR_3 | VAR_10;
if (!(VAR_4 & MAP_ANONYMOUS)) {
#ifndef __APPLE__
if ((VAR_4 & MAP_TYPE) == MAP_SHARED &&
#else
if ((VAR_4 & MAP_SHARED) &&
#endif
(VAR_3 & PROT_WRITE))
return -EINVAL;
if (!(VAR_10 & PROT_WRITE))
mprotect((void *)VAR_0, qemu_host_page_size, VAR_10 | PROT_WRITE);
pread(VAR_5, (void *)VAR_1, VAR_2 - VAR_1, VAR_6);
if (VAR_11 != (VAR_10 | PROT_WRITE))
mprotect((void *)VAR_0, qemu_host_page_size, VAR_11);
} else {
if (VAR_11 != VAR_10) {
mprotect((void *)VAR_0, qemu_host_page_size, VAR_11);
}
}
return 0;
}
|
[
"int FUNC_0(unsigned long VAR_0,\nunsigned long VAR_1, unsigned long VAR_2,\nint VAR_3, int VAR_4, int VAR_5, unsigned long VAR_6)\n{",
"unsigned long VAR_7, VAR_8, VAR_9;",
"int VAR_10, VAR_11;",
"VAR_7 = VAR_0 + qemu_host_page_size;",
"VAR_10 = 0;",
"for(VAR_9 = VAR_0; VAR_9 < VAR_7; VAR_9++) {",
"if (VAR_9 < VAR_1 || VAR_9 >= VAR_2)\nVAR_10 |= page_get_flags(VAR_9);",
"}",
"if (VAR_10 == 0) {",
"VAR_8 = (long)mmap((void *)VAR_0, qemu_host_page_size, VAR_3,\nVAR_4 | MAP_ANONYMOUS, -1, 0);",
"if (VAR_8 == -1)\nreturn VAR_8;",
"}",
"VAR_10 &= PAGE_BITS;",
"VAR_11 = VAR_3 | VAR_10;",
"if (!(VAR_4 & MAP_ANONYMOUS)) {",
"#ifndef __APPLE__\nif ((VAR_4 & MAP_TYPE) == MAP_SHARED &&\n#else\nif ((VAR_4 & MAP_SHARED) &&\n#endif\n(VAR_3 & PROT_WRITE))\nreturn -EINVAL;",
"if (!(VAR_10 & PROT_WRITE))\nmprotect((void *)VAR_0, qemu_host_page_size, VAR_10 | PROT_WRITE);",
"pread(VAR_5, (void *)VAR_1, VAR_2 - VAR_1, VAR_6);",
"if (VAR_11 != (VAR_10 | PROT_WRITE))\nmprotect((void *)VAR_0, qemu_host_page_size, VAR_11);",
"} else {",
"if (VAR_11 != VAR_10) {",
"mprotect((void *)VAR_0, qemu_host_page_size, VAR_11);",
"}",
"}",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5,
7
],
[
9
],
[
11
],
[
15
],
[
21
],
[
23
],
[
25,
27
],
[
29
],
[
33
],
[
37,
39
],
[
41,
43
],
[
45
],
[
47
],
[
51
],
[
53
],
[
59,
61,
63,
65,
67,
69,
71
],
[
77,
79
],
[
85
],
[
91,
93
],
[
95
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
]
] |
9,590 |
static int decode_cabac_field_decoding_flag(H264Context *h) {
MpegEncContext * const s = &h->s;
const int mb_x = s->mb_x;
const int mb_y = s->mb_y & ~1;
const int mba_xy = mb_x - 1 + mb_y *s->mb_stride;
const int mbb_xy = mb_x + (mb_y-2)*s->mb_stride;
unsigned int ctx = 0;
if( h->slice_table[mba_xy] == h->slice_num && IS_INTERLACED( s->current_picture.mb_type[mba_xy] ) ) {
ctx += 1;
}
if( h->slice_table[mbb_xy] == h->slice_num && IS_INTERLACED( s->current_picture.mb_type[mbb_xy] ) ) {
ctx += 1;
}
return get_cabac( &h->cabac, &h->cabac_state[70 + ctx] );
}
| false |
FFmpeg
|
851ded8918c977d8160c6617b69604f758cabf50
|
static int decode_cabac_field_decoding_flag(H264Context *h) {
MpegEncContext * const s = &h->s;
const int mb_x = s->mb_x;
const int mb_y = s->mb_y & ~1;
const int mba_xy = mb_x - 1 + mb_y *s->mb_stride;
const int mbb_xy = mb_x + (mb_y-2)*s->mb_stride;
unsigned int ctx = 0;
if( h->slice_table[mba_xy] == h->slice_num && IS_INTERLACED( s->current_picture.mb_type[mba_xy] ) ) {
ctx += 1;
}
if( h->slice_table[mbb_xy] == h->slice_num && IS_INTERLACED( s->current_picture.mb_type[mbb_xy] ) ) {
ctx += 1;
}
return get_cabac( &h->cabac, &h->cabac_state[70 + ctx] );
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(H264Context *VAR_0) {
MpegEncContext * const s = &VAR_0->s;
const int VAR_1 = s->VAR_1;
const int VAR_2 = s->VAR_2 & ~1;
const int VAR_3 = VAR_1 - 1 + VAR_2 *s->mb_stride;
const int VAR_4 = VAR_1 + (VAR_2-2)*s->mb_stride;
unsigned int VAR_5 = 0;
if( VAR_0->slice_table[VAR_3] == VAR_0->slice_num && IS_INTERLACED( s->current_picture.mb_type[VAR_3] ) ) {
VAR_5 += 1;
}
if( VAR_0->slice_table[VAR_4] == VAR_0->slice_num && IS_INTERLACED( s->current_picture.mb_type[VAR_4] ) ) {
VAR_5 += 1;
}
return get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[70 + VAR_5] );
}
|
[
"static int FUNC_0(H264Context *VAR_0) {",
"MpegEncContext * const s = &VAR_0->s;",
"const int VAR_1 = s->VAR_1;",
"const int VAR_2 = s->VAR_2 & ~1;",
"const int VAR_3 = VAR_1 - 1 + VAR_2 *s->mb_stride;",
"const int VAR_4 = VAR_1 + (VAR_2-2)*s->mb_stride;",
"unsigned int VAR_5 = 0;",
"if( VAR_0->slice_table[VAR_3] == VAR_0->slice_num && IS_INTERLACED( s->current_picture.mb_type[VAR_3] ) ) {",
"VAR_5 += 1;",
"}",
"if( VAR_0->slice_table[VAR_4] == VAR_0->slice_num && IS_INTERLACED( s->current_picture.mb_type[VAR_4] ) ) {",
"VAR_5 += 1;",
"}",
"return get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[70 + VAR_5] );",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1
],
[
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
]
] |
9,591 |
static int bayer_to_rgb24_wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dst[], int dstStride[])
{
uint8_t *dstPtr= dst[0];
const uint8_t *srcPtr= src[0];
int i;
void (*copy) (const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int width);
void (*interpolate)(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int width);
switch(c->srcFormat) {
#define CASE(pixfmt, prefix) \
case pixfmt: copy = bayer_##prefix##_to_rgb24_copy; \
interpolate = bayer_##prefix##_to_rgb24_interpolate; \
break;
CASE(AV_PIX_FMT_BAYER_BGGR8, bggr8)
CASE(AV_PIX_FMT_BAYER_BGGR16LE, bggr16le)
CASE(AV_PIX_FMT_BAYER_BGGR16BE, bggr16be)
CASE(AV_PIX_FMT_BAYER_RGGB8, rggb8)
CASE(AV_PIX_FMT_BAYER_RGGB16LE, rggb16le)
CASE(AV_PIX_FMT_BAYER_RGGB16BE, rggb16be)
CASE(AV_PIX_FMT_BAYER_GBRG8, gbrg8)
CASE(AV_PIX_FMT_BAYER_GBRG16LE, gbrg16le)
CASE(AV_PIX_FMT_BAYER_GBRG16BE, gbrg16be)
CASE(AV_PIX_FMT_BAYER_GRBG8, grbg8)
CASE(AV_PIX_FMT_BAYER_GRBG16LE, grbg16le)
CASE(AV_PIX_FMT_BAYER_GRBG16BE, grbg16be)
#undef CASE
default: return 0;
}
copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->srcW);
srcPtr += 2 * srcStride[0];
dstPtr += 2 * dstStride[0];
for (i = 2; i < srcSliceH - 2; i += 2) {
interpolate(srcPtr, srcStride[0], dstPtr, dstStride[0], c->srcW);
srcPtr += 2 * srcStride[0];
dstPtr += 2 * dstStride[0];
}
copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->srcW);
return srcSliceH;
}
| false |
FFmpeg
|
ad3b6fa7d83db7de951ed891649af93a47e74be5
|
static int bayer_to_rgb24_wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dst[], int dstStride[])
{
uint8_t *dstPtr= dst[0];
const uint8_t *srcPtr= src[0];
int i;
void (*copy) (const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int width);
void (*interpolate)(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int width);
switch(c->srcFormat) {
#define CASE(pixfmt, prefix) \
case pixfmt: copy = bayer_##prefix##_to_rgb24_copy; \
interpolate = bayer_##prefix##_to_rgb24_interpolate; \
break;
CASE(AV_PIX_FMT_BAYER_BGGR8, bggr8)
CASE(AV_PIX_FMT_BAYER_BGGR16LE, bggr16le)
CASE(AV_PIX_FMT_BAYER_BGGR16BE, bggr16be)
CASE(AV_PIX_FMT_BAYER_RGGB8, rggb8)
CASE(AV_PIX_FMT_BAYER_RGGB16LE, rggb16le)
CASE(AV_PIX_FMT_BAYER_RGGB16BE, rggb16be)
CASE(AV_PIX_FMT_BAYER_GBRG8, gbrg8)
CASE(AV_PIX_FMT_BAYER_GBRG16LE, gbrg16le)
CASE(AV_PIX_FMT_BAYER_GBRG16BE, gbrg16be)
CASE(AV_PIX_FMT_BAYER_GRBG8, grbg8)
CASE(AV_PIX_FMT_BAYER_GRBG16LE, grbg16le)
CASE(AV_PIX_FMT_BAYER_GRBG16BE, grbg16be)
#undef CASE
default: return 0;
}
copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->srcW);
srcPtr += 2 * srcStride[0];
dstPtr += 2 * dstStride[0];
for (i = 2; i < srcSliceH - 2; i += 2) {
interpolate(srcPtr, srcStride[0], dstPtr, dstStride[0], c->srcW);
srcPtr += 2 * srcStride[0];
dstPtr += 2 * dstStride[0];
}
copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->srcW);
return srcSliceH;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(SwsContext *VAR_0, const uint8_t* VAR_14[], int VAR_2[], int VAR_3,
int VAR_4, uint8_t* VAR_14[], int VAR_6[])
{
uint8_t *dstPtr= VAR_14[0];
const uint8_t *VAR_7= VAR_14[0];
int VAR_8;
void (*VAR_9) (const uint8_t *VAR_14, int VAR_14, uint8_t *VAR_14, int VAR_14, int VAR_14);
void (*VAR_13)(const uint8_t *VAR_14, int VAR_14, uint8_t *VAR_14, int VAR_14, int VAR_14);
switch(VAR_0->srcFormat) {
#define CASE(pixfmt, prefix) \
case pixfmt: VAR_9 = bayer_##prefix##_to_rgb24_copy; \
VAR_13 = bayer_##prefix##_to_rgb24_interpolate; \
break;
CASE(AV_PIX_FMT_BAYER_BGGR8, bggr8)
CASE(AV_PIX_FMT_BAYER_BGGR16LE, bggr16le)
CASE(AV_PIX_FMT_BAYER_BGGR16BE, bggr16be)
CASE(AV_PIX_FMT_BAYER_RGGB8, rggb8)
CASE(AV_PIX_FMT_BAYER_RGGB16LE, rggb16le)
CASE(AV_PIX_FMT_BAYER_RGGB16BE, rggb16be)
CASE(AV_PIX_FMT_BAYER_GBRG8, gbrg8)
CASE(AV_PIX_FMT_BAYER_GBRG16LE, gbrg16le)
CASE(AV_PIX_FMT_BAYER_GBRG16BE, gbrg16be)
CASE(AV_PIX_FMT_BAYER_GRBG8, grbg8)
CASE(AV_PIX_FMT_BAYER_GRBG16LE, grbg16le)
CASE(AV_PIX_FMT_BAYER_GRBG16BE, grbg16be)
#undef CASE
default: return 0;
}
VAR_9(VAR_7, VAR_2[0], dstPtr, VAR_6[0], VAR_0->srcW);
VAR_7 += 2 * VAR_2[0];
dstPtr += 2 * VAR_6[0];
for (VAR_8 = 2; VAR_8 < VAR_4 - 2; VAR_8 += 2) {
VAR_13(VAR_7, VAR_2[0], dstPtr, VAR_6[0], VAR_0->srcW);
VAR_7 += 2 * VAR_2[0];
dstPtr += 2 * VAR_6[0];
}
VAR_9(VAR_7, VAR_2[0], dstPtr, VAR_6[0], VAR_0->srcW);
return VAR_4;
}
|
[
"static int FUNC_0(SwsContext *VAR_0, const uint8_t* VAR_14[], int VAR_2[], int VAR_3,\nint VAR_4, uint8_t* VAR_14[], int VAR_6[])\n{",
"uint8_t *dstPtr= VAR_14[0];",
"const uint8_t *VAR_7= VAR_14[0];",
"int VAR_8;",
"void (*VAR_9) (const uint8_t *VAR_14, int VAR_14, uint8_t *VAR_14, int VAR_14, int VAR_14);",
"void (*VAR_13)(const uint8_t *VAR_14, int VAR_14, uint8_t *VAR_14, int VAR_14, int VAR_14);",
"switch(VAR_0->srcFormat) {",
"#define CASE(pixfmt, prefix) \\\ncase pixfmt: VAR_9 = bayer_##prefix##_to_rgb24_copy; \\",
"VAR_13 = bayer_##prefix##_to_rgb24_interpolate; \\",
"break;",
"CASE(AV_PIX_FMT_BAYER_BGGR8, bggr8)\nCASE(AV_PIX_FMT_BAYER_BGGR16LE, bggr16le)\nCASE(AV_PIX_FMT_BAYER_BGGR16BE, bggr16be)\nCASE(AV_PIX_FMT_BAYER_RGGB8, rggb8)\nCASE(AV_PIX_FMT_BAYER_RGGB16LE, rggb16le)\nCASE(AV_PIX_FMT_BAYER_RGGB16BE, rggb16be)\nCASE(AV_PIX_FMT_BAYER_GBRG8, gbrg8)\nCASE(AV_PIX_FMT_BAYER_GBRG16LE, gbrg16le)\nCASE(AV_PIX_FMT_BAYER_GBRG16BE, gbrg16be)\nCASE(AV_PIX_FMT_BAYER_GRBG8, grbg8)\nCASE(AV_PIX_FMT_BAYER_GRBG16LE, grbg16le)\nCASE(AV_PIX_FMT_BAYER_GRBG16BE, grbg16be)\n#undef CASE\ndefault: return 0;",
"}",
"VAR_9(VAR_7, VAR_2[0], dstPtr, VAR_6[0], VAR_0->srcW);",
"VAR_7 += 2 * VAR_2[0];",
"dstPtr += 2 * VAR_6[0];",
"for (VAR_8 = 2; VAR_8 < VAR_4 - 2; VAR_8 += 2) {",
"VAR_13(VAR_7, VAR_2[0], dstPtr, VAR_6[0], VAR_0->srcW);",
"VAR_7 += 2 * VAR_2[0];",
"dstPtr += 2 * VAR_6[0];",
"}",
"VAR_9(VAR_7, VAR_2[0], dstPtr, VAR_6[0], VAR_0->srcW);",
"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
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21,
23
],
[
25
],
[
27
],
[
29,
31,
33,
35,
37,
39,
41,
43,
45,
47,
49,
51,
53,
55
],
[
57
],
[
61
],
[
63
],
[
65
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
81
],
[
83
],
[
85
]
] |
9,592 |
static void ff_h264_idct_add16_mmx(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
int i;
for(i=0; i<16; i++){
if(nnzc[ scan8[i] ])
ff_h264_idct_add_mmx(dst + block_offset[i], block + i*16, stride);
}
}
| false |
FFmpeg
|
1d16a1cf99488f16492b1bb48e023f4da8377e07
|
static void ff_h264_idct_add16_mmx(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
int i;
for(i=0; i<16; i++){
if(nnzc[ scan8[i] ])
ff_h264_idct_add_mmx(dst + block_offset[i], block + i*16, stride);
}
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(uint8_t *VAR_0, const int *VAR_1, DCTELEM *VAR_2, int VAR_3, const uint8_t VAR_4[6*8]){
int VAR_5;
for(VAR_5=0; VAR_5<16; VAR_5++){
if(VAR_4[ scan8[VAR_5] ])
ff_h264_idct_add_mmx(VAR_0 + VAR_1[VAR_5], VAR_2 + VAR_5*16, VAR_3);
}
}
|
[
"static void FUNC_0(uint8_t *VAR_0, const int *VAR_1, DCTELEM *VAR_2, int VAR_3, const uint8_t VAR_4[6*8]){",
"int VAR_5;",
"for(VAR_5=0; VAR_5<16; VAR_5++){",
"if(VAR_4[ scan8[VAR_5] ])\nff_h264_idct_add_mmx(VAR_0 + VAR_1[VAR_5], VAR_2 + VAR_5*16, VAR_3);",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0
] |
[
[
1
],
[
3
],
[
5
],
[
7,
9
],
[
11
],
[
13
]
] |
9,593 |
static char *make_digest_auth(HTTPAuthState *state, const char *username,
const char *password, const char *uri,
const char *method)
{
DigestParams *digest = &state->digest_params;
int len;
uint32_t cnonce_buf[2];
char cnonce[17];
char nc[9];
int i;
char A1hash[33], A2hash[33], response[33];
struct AVMD5 *md5ctx;
uint8_t hash[16];
char *authstr;
digest->nc++;
snprintf(nc, sizeof(nc), "%08x", digest->nc);
/* Generate a client nonce. */
for (i = 0; i < 2; i++)
cnonce_buf[i] = av_get_random_seed();
ff_data_to_hex(cnonce, (const uint8_t*) cnonce_buf, sizeof(cnonce_buf), 1);
cnonce[2*sizeof(cnonce_buf)] = 0;
md5ctx = av_md5_alloc();
if (!md5ctx)
return NULL;
av_md5_init(md5ctx);
update_md5_strings(md5ctx, username, ":", state->realm, ":", password, NULL);
av_md5_final(md5ctx, hash);
ff_data_to_hex(A1hash, hash, 16, 1);
A1hash[32] = 0;
if (!strcmp(digest->algorithm, "") || !strcmp(digest->algorithm, "MD5")) {
} else if (!strcmp(digest->algorithm, "MD5-sess")) {
av_md5_init(md5ctx);
update_md5_strings(md5ctx, A1hash, ":", digest->nonce, ":", cnonce, NULL);
av_md5_final(md5ctx, hash);
ff_data_to_hex(A1hash, hash, 16, 1);
A1hash[32] = 0;
} else {
/* Unsupported algorithm */
av_free(md5ctx);
return NULL;
}
av_md5_init(md5ctx);
update_md5_strings(md5ctx, method, ":", uri, NULL);
av_md5_final(md5ctx, hash);
ff_data_to_hex(A2hash, hash, 16, 1);
A2hash[32] = 0;
av_md5_init(md5ctx);
update_md5_strings(md5ctx, A1hash, ":", digest->nonce, NULL);
if (!strcmp(digest->qop, "auth") || !strcmp(digest->qop, "auth-int")) {
update_md5_strings(md5ctx, ":", nc, ":", cnonce, ":", digest->qop, NULL);
}
update_md5_strings(md5ctx, ":", A2hash, NULL);
av_md5_final(md5ctx, hash);
ff_data_to_hex(response, hash, 16, 1);
response[32] = 0;
av_free(md5ctx);
if (!strcmp(digest->qop, "") || !strcmp(digest->qop, "auth")) {
} else if (!strcmp(digest->qop, "auth-int")) {
/* qop=auth-int not supported */
return NULL;
} else {
/* Unsupported qop value. */
return NULL;
}
len = strlen(username) + strlen(state->realm) + strlen(digest->nonce) +
strlen(uri) + strlen(response) + strlen(digest->algorithm) +
strlen(digest->opaque) + strlen(digest->qop) + strlen(cnonce) +
strlen(nc) + 150;
authstr = av_malloc(len);
if (!authstr)
return NULL;
snprintf(authstr, len, "Authorization: Digest ");
/* TODO: Escape the quoted strings properly. */
av_strlcatf(authstr, len, "username=\"%s\"", username);
av_strlcatf(authstr, len, ",realm=\"%s\"", state->realm);
av_strlcatf(authstr, len, ",nonce=\"%s\"", digest->nonce);
av_strlcatf(authstr, len, ",uri=\"%s\"", uri);
av_strlcatf(authstr, len, ",response=\"%s\"", response);
if (digest->algorithm[0])
av_strlcatf(authstr, len, ",algorithm=%s", digest->algorithm);
if (digest->opaque[0])
av_strlcatf(authstr, len, ",opaque=\"%s\"", digest->opaque);
if (digest->qop[0]) {
av_strlcatf(authstr, len, ",qop=\"%s\"", digest->qop);
av_strlcatf(authstr, len, ",cnonce=\"%s\"", cnonce);
av_strlcatf(authstr, len, ",nc=%s", nc);
}
av_strlcatf(authstr, len, "\r\n");
return authstr;
}
| false |
FFmpeg
|
3ba056017f978ba69ea933c593f0e616b3632261
|
static char *make_digest_auth(HTTPAuthState *state, const char *username,
const char *password, const char *uri,
const char *method)
{
DigestParams *digest = &state->digest_params;
int len;
uint32_t cnonce_buf[2];
char cnonce[17];
char nc[9];
int i;
char A1hash[33], A2hash[33], response[33];
struct AVMD5 *md5ctx;
uint8_t hash[16];
char *authstr;
digest->nc++;
snprintf(nc, sizeof(nc), "%08x", digest->nc);
for (i = 0; i < 2; i++)
cnonce_buf[i] = av_get_random_seed();
ff_data_to_hex(cnonce, (const uint8_t*) cnonce_buf, sizeof(cnonce_buf), 1);
cnonce[2*sizeof(cnonce_buf)] = 0;
md5ctx = av_md5_alloc();
if (!md5ctx)
return NULL;
av_md5_init(md5ctx);
update_md5_strings(md5ctx, username, ":", state->realm, ":", password, NULL);
av_md5_final(md5ctx, hash);
ff_data_to_hex(A1hash, hash, 16, 1);
A1hash[32] = 0;
if (!strcmp(digest->algorithm, "") || !strcmp(digest->algorithm, "MD5")) {
} else if (!strcmp(digest->algorithm, "MD5-sess")) {
av_md5_init(md5ctx);
update_md5_strings(md5ctx, A1hash, ":", digest->nonce, ":", cnonce, NULL);
av_md5_final(md5ctx, hash);
ff_data_to_hex(A1hash, hash, 16, 1);
A1hash[32] = 0;
} else {
av_free(md5ctx);
return NULL;
}
av_md5_init(md5ctx);
update_md5_strings(md5ctx, method, ":", uri, NULL);
av_md5_final(md5ctx, hash);
ff_data_to_hex(A2hash, hash, 16, 1);
A2hash[32] = 0;
av_md5_init(md5ctx);
update_md5_strings(md5ctx, A1hash, ":", digest->nonce, NULL);
if (!strcmp(digest->qop, "auth") || !strcmp(digest->qop, "auth-int")) {
update_md5_strings(md5ctx, ":", nc, ":", cnonce, ":", digest->qop, NULL);
}
update_md5_strings(md5ctx, ":", A2hash, NULL);
av_md5_final(md5ctx, hash);
ff_data_to_hex(response, hash, 16, 1);
response[32] = 0;
av_free(md5ctx);
if (!strcmp(digest->qop, "") || !strcmp(digest->qop, "auth")) {
} else if (!strcmp(digest->qop, "auth-int")) {
return NULL;
} else {
return NULL;
}
len = strlen(username) + strlen(state->realm) + strlen(digest->nonce) +
strlen(uri) + strlen(response) + strlen(digest->algorithm) +
strlen(digest->opaque) + strlen(digest->qop) + strlen(cnonce) +
strlen(nc) + 150;
authstr = av_malloc(len);
if (!authstr)
return NULL;
snprintf(authstr, len, "Authorization: Digest ");
av_strlcatf(authstr, len, "username=\"%s\"", username);
av_strlcatf(authstr, len, ",realm=\"%s\"", state->realm);
av_strlcatf(authstr, len, ",nonce=\"%s\"", digest->nonce);
av_strlcatf(authstr, len, ",uri=\"%s\"", uri);
av_strlcatf(authstr, len, ",response=\"%s\"", response);
if (digest->algorithm[0])
av_strlcatf(authstr, len, ",algorithm=%s", digest->algorithm);
if (digest->opaque[0])
av_strlcatf(authstr, len, ",opaque=\"%s\"", digest->opaque);
if (digest->qop[0]) {
av_strlcatf(authstr, len, ",qop=\"%s\"", digest->qop);
av_strlcatf(authstr, len, ",cnonce=\"%s\"", cnonce);
av_strlcatf(authstr, len, ",nc=%s", nc);
}
av_strlcatf(authstr, len, "\r\n");
return authstr;
}
|
{
"code": [],
"line_no": []
}
|
static char *FUNC_0(HTTPAuthState *VAR_0, const char *VAR_1,
const char *VAR_2, const char *VAR_3,
const char *VAR_4)
{
DigestParams *digest = &VAR_0->digest_params;
int VAR_5;
uint32_t cnonce_buf[2];
char VAR_6[17];
char VAR_7[9];
int VAR_8;
char VAR_9[33], VAR_10[33], VAR_11[33];
struct AVMD5 *VAR_12;
uint8_t hash[16];
char *VAR_13;
digest->VAR_7++;
snprintf(VAR_7, sizeof(VAR_7), "%08x", digest->VAR_7);
for (VAR_8 = 0; VAR_8 < 2; VAR_8++)
cnonce_buf[VAR_8] = av_get_random_seed();
ff_data_to_hex(VAR_6, (const uint8_t*) cnonce_buf, sizeof(cnonce_buf), 1);
VAR_6[2*sizeof(cnonce_buf)] = 0;
VAR_12 = av_md5_alloc();
if (!VAR_12)
return NULL;
av_md5_init(VAR_12);
update_md5_strings(VAR_12, VAR_1, ":", VAR_0->realm, ":", VAR_2, NULL);
av_md5_final(VAR_12, hash);
ff_data_to_hex(VAR_9, hash, 16, 1);
VAR_9[32] = 0;
if (!strcmp(digest->algorithm, "") || !strcmp(digest->algorithm, "MD5")) {
} else if (!strcmp(digest->algorithm, "MD5-sess")) {
av_md5_init(VAR_12);
update_md5_strings(VAR_12, VAR_9, ":", digest->nonce, ":", VAR_6, NULL);
av_md5_final(VAR_12, hash);
ff_data_to_hex(VAR_9, hash, 16, 1);
VAR_9[32] = 0;
} else {
av_free(VAR_12);
return NULL;
}
av_md5_init(VAR_12);
update_md5_strings(VAR_12, VAR_4, ":", VAR_3, NULL);
av_md5_final(VAR_12, hash);
ff_data_to_hex(VAR_10, hash, 16, 1);
VAR_10[32] = 0;
av_md5_init(VAR_12);
update_md5_strings(VAR_12, VAR_9, ":", digest->nonce, NULL);
if (!strcmp(digest->qop, "auth") || !strcmp(digest->qop, "auth-int")) {
update_md5_strings(VAR_12, ":", VAR_7, ":", VAR_6, ":", digest->qop, NULL);
}
update_md5_strings(VAR_12, ":", VAR_10, NULL);
av_md5_final(VAR_12, hash);
ff_data_to_hex(VAR_11, hash, 16, 1);
VAR_11[32] = 0;
av_free(VAR_12);
if (!strcmp(digest->qop, "") || !strcmp(digest->qop, "auth")) {
} else if (!strcmp(digest->qop, "auth-int")) {
return NULL;
} else {
return NULL;
}
VAR_5 = strlen(VAR_1) + strlen(VAR_0->realm) + strlen(digest->nonce) +
strlen(VAR_3) + strlen(VAR_11) + strlen(digest->algorithm) +
strlen(digest->opaque) + strlen(digest->qop) + strlen(VAR_6) +
strlen(VAR_7) + 150;
VAR_13 = av_malloc(VAR_5);
if (!VAR_13)
return NULL;
snprintf(VAR_13, VAR_5, "Authorization: Digest ");
av_strlcatf(VAR_13, VAR_5, "VAR_1=\"%s\"", VAR_1);
av_strlcatf(VAR_13, VAR_5, ",realm=\"%s\"", VAR_0->realm);
av_strlcatf(VAR_13, VAR_5, ",nonce=\"%s\"", digest->nonce);
av_strlcatf(VAR_13, VAR_5, ",VAR_3=\"%s\"", VAR_3);
av_strlcatf(VAR_13, VAR_5, ",VAR_11=\"%s\"", VAR_11);
if (digest->algorithm[0])
av_strlcatf(VAR_13, VAR_5, ",algorithm=%s", digest->algorithm);
if (digest->opaque[0])
av_strlcatf(VAR_13, VAR_5, ",opaque=\"%s\"", digest->opaque);
if (digest->qop[0]) {
av_strlcatf(VAR_13, VAR_5, ",qop=\"%s\"", digest->qop);
av_strlcatf(VAR_13, VAR_5, ",VAR_6=\"%s\"", VAR_6);
av_strlcatf(VAR_13, VAR_5, ",VAR_7=%s", VAR_7);
}
av_strlcatf(VAR_13, VAR_5, "\r\n");
return VAR_13;
}
|
[
"static char *FUNC_0(HTTPAuthState *VAR_0, const char *VAR_1,\nconst char *VAR_2, const char *VAR_3,\nconst char *VAR_4)\n{",
"DigestParams *digest = &VAR_0->digest_params;",
"int VAR_5;",
"uint32_t cnonce_buf[2];",
"char VAR_6[17];",
"char VAR_7[9];",
"int VAR_8;",
"char VAR_9[33], VAR_10[33], VAR_11[33];",
"struct AVMD5 *VAR_12;",
"uint8_t hash[16];",
"char *VAR_13;",
"digest->VAR_7++;",
"snprintf(VAR_7, sizeof(VAR_7), \"%08x\", digest->VAR_7);",
"for (VAR_8 = 0; VAR_8 < 2; VAR_8++)",
"cnonce_buf[VAR_8] = av_get_random_seed();",
"ff_data_to_hex(VAR_6, (const uint8_t*) cnonce_buf, sizeof(cnonce_buf), 1);",
"VAR_6[2*sizeof(cnonce_buf)] = 0;",
"VAR_12 = av_md5_alloc();",
"if (!VAR_12)\nreturn NULL;",
"av_md5_init(VAR_12);",
"update_md5_strings(VAR_12, VAR_1, \":\", VAR_0->realm, \":\", VAR_2, NULL);",
"av_md5_final(VAR_12, hash);",
"ff_data_to_hex(VAR_9, hash, 16, 1);",
"VAR_9[32] = 0;",
"if (!strcmp(digest->algorithm, \"\") || !strcmp(digest->algorithm, \"MD5\")) {",
"} else if (!strcmp(digest->algorithm, \"MD5-sess\")) {",
"av_md5_init(VAR_12);",
"update_md5_strings(VAR_12, VAR_9, \":\", digest->nonce, \":\", VAR_6, NULL);",
"av_md5_final(VAR_12, hash);",
"ff_data_to_hex(VAR_9, hash, 16, 1);",
"VAR_9[32] = 0;",
"} else {",
"av_free(VAR_12);",
"return NULL;",
"}",
"av_md5_init(VAR_12);",
"update_md5_strings(VAR_12, VAR_4, \":\", VAR_3, NULL);",
"av_md5_final(VAR_12, hash);",
"ff_data_to_hex(VAR_10, hash, 16, 1);",
"VAR_10[32] = 0;",
"av_md5_init(VAR_12);",
"update_md5_strings(VAR_12, VAR_9, \":\", digest->nonce, NULL);",
"if (!strcmp(digest->qop, \"auth\") || !strcmp(digest->qop, \"auth-int\")) {",
"update_md5_strings(VAR_12, \":\", VAR_7, \":\", VAR_6, \":\", digest->qop, NULL);",
"}",
"update_md5_strings(VAR_12, \":\", VAR_10, NULL);",
"av_md5_final(VAR_12, hash);",
"ff_data_to_hex(VAR_11, hash, 16, 1);",
"VAR_11[32] = 0;",
"av_free(VAR_12);",
"if (!strcmp(digest->qop, \"\") || !strcmp(digest->qop, \"auth\")) {",
"} else if (!strcmp(digest->qop, \"auth-int\")) {",
"return NULL;",
"} else {",
"return NULL;",
"}",
"VAR_5 = strlen(VAR_1) + strlen(VAR_0->realm) + strlen(digest->nonce) +\nstrlen(VAR_3) + strlen(VAR_11) + strlen(digest->algorithm) +\nstrlen(digest->opaque) + strlen(digest->qop) + strlen(VAR_6) +\nstrlen(VAR_7) + 150;",
"VAR_13 = av_malloc(VAR_5);",
"if (!VAR_13)\nreturn NULL;",
"snprintf(VAR_13, VAR_5, \"Authorization: Digest \");",
"av_strlcatf(VAR_13, VAR_5, \"VAR_1=\\\"%s\\\"\", VAR_1);",
"av_strlcatf(VAR_13, VAR_5, \",realm=\\\"%s\\\"\", VAR_0->realm);",
"av_strlcatf(VAR_13, VAR_5, \",nonce=\\\"%s\\\"\", digest->nonce);",
"av_strlcatf(VAR_13, VAR_5, \",VAR_3=\\\"%s\\\"\", VAR_3);",
"av_strlcatf(VAR_13, VAR_5, \",VAR_11=\\\"%s\\\"\", VAR_11);",
"if (digest->algorithm[0])\nav_strlcatf(VAR_13, VAR_5, \",algorithm=%s\", digest->algorithm);",
"if (digest->opaque[0])\nav_strlcatf(VAR_13, VAR_5, \",opaque=\\\"%s\\\"\", digest->opaque);",
"if (digest->qop[0]) {",
"av_strlcatf(VAR_13, VAR_5, \",qop=\\\"%s\\\"\", digest->qop);",
"av_strlcatf(VAR_13, VAR_5, \",VAR_6=\\\"%s\\\"\", VAR_6);",
"av_strlcatf(VAR_13, VAR_5, \",VAR_7=%s\", VAR_7);",
"}",
"av_strlcatf(VAR_13, VAR_5, \"\\r\\n\");",
"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
] |
[
[
1,
3,
5,
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
31
],
[
33
],
[
39
],
[
41
],
[
43
],
[
45
],
[
49
],
[
51,
53
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
87
],
[
89
],
[
91
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
127
],
[
131
],
[
133
],
[
137
],
[
139
],
[
143
],
[
145
],
[
149,
151,
153,
155
],
[
159
],
[
161,
163
],
[
165
],
[
171
],
[
173
],
[
175
],
[
177
],
[
179
],
[
181,
183
],
[
185,
187
],
[
189
],
[
191
],
[
193
],
[
195
],
[
197
],
[
201
],
[
205
],
[
207
]
] |
9,594 |
static void vector_fmul_vfp(float *dst, const float *src, int len)
{
int tmp;
asm volatile(
"fmrx %[tmp], fpscr\n\t"
"orr %[tmp], %[tmp], #(3 << 16)\n\t" /* set vector size to 4 */
"fmxr fpscr, %[tmp]\n\t"
"fldmias %[dst_r]!, {s0-s3}\n\t"
"fldmias %[src]!, {s8-s11}\n\t"
"fldmias %[dst_r]!, {s4-s7}\n\t"
"fldmias %[src]!, {s12-s15}\n\t"
"fmuls s8, s0, s8\n\t"
"1:\n\t"
"subs %[len], %[len], #16\n\t"
"fmuls s12, s4, s12\n\t"
"fldmiasge %[dst_r]!, {s16-s19}\n\t"
"fldmiasge %[src]!, {s24-s27}\n\t"
"fldmiasge %[dst_r]!, {s20-s23}\n\t"
"fldmiasge %[src]!, {s28-s31}\n\t"
"fmulsge s24, s16, s24\n\t"
"fstmias %[dst_w]!, {s8-s11}\n\t"
"fstmias %[dst_w]!, {s12-s15}\n\t"
"fmulsge s28, s20, s28\n\t"
"fldmiasgt %[dst_r]!, {s0-s3}\n\t"
"fldmiasgt %[src]!, {s8-s11}\n\t"
"fldmiasgt %[dst_r]!, {s4-s7}\n\t"
"fldmiasgt %[src]!, {s12-s15}\n\t"
"fmulsge s8, s0, s8\n\t"
"fstmiasge %[dst_w]!, {s24-s27}\n\t"
"fstmiasge %[dst_w]!, {s28-s31}\n\t"
"bgt 1b\n\t"
"bic %[tmp], %[tmp], #(7 << 16)\n\t" /* set vector size back to 1 */
"fmxr fpscr, %[tmp]\n\t"
: [dst_w] "+&r" (dst), [dst_r] "+&r" (dst), [src] "+&r" (src), [len] "+&r" (len), [tmp] "=&r" (tmp)
:
: "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
"s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15",
"s16", "s17", "s18", "s19", "s20", "s21", "s22", "s23",
"s24", "s25", "s26", "s27", "s28", "s29", "s30", "s31",
"cc", "memory");
}
| true |
FFmpeg
|
28215b3700723da0c0beb93945702b6fb2b3596d
|
static void vector_fmul_vfp(float *dst, const float *src, int len)
{
int tmp;
asm volatile(
"fmrx %[tmp], fpscr\n\t"
"orr %[tmp], %[tmp], #(3 << 16)\n\t"
"fmxr fpscr, %[tmp]\n\t"
"fldmias %[dst_r]!, {s0-s3}\n\t"
"fldmias %[src]!, {s8-s11}\n\t"
"fldmias %[dst_r]!, {s4-s7}\n\t"
"fldmias %[src]!, {s12-s15}\n\t"
"fmuls s8, s0, s8\n\t"
"1:\n\t"
"subs %[len], %[len], #16\n\t"
"fmuls s12, s4, s12\n\t"
"fldmiasge %[dst_r]!, {s16-s19}\n\t"
"fldmiasge %[src]!, {s24-s27}\n\t"
"fldmiasge %[dst_r]!, {s20-s23}\n\t"
"fldmiasge %[src]!, {s28-s31}\n\t"
"fmulsge s24, s16, s24\n\t"
"fstmias %[dst_w]!, {s8-s11}\n\t"
"fstmias %[dst_w]!, {s12-s15}\n\t"
"fmulsge s28, s20, s28\n\t"
"fldmiasgt %[dst_r]!, {s0-s3}\n\t"
"fldmiasgt %[src]!, {s8-s11}\n\t"
"fldmiasgt %[dst_r]!, {s4-s7}\n\t"
"fldmiasgt %[src]!, {s12-s15}\n\t"
"fmulsge s8, s0, s8\n\t"
"fstmiasge %[dst_w]!, {s24-s27}\n\t"
"fstmiasge %[dst_w]!, {s28-s31}\n\t"
"bgt 1b\n\t"
"bic %[tmp], %[tmp], #(7 << 16)\n\t"
"fmxr fpscr, %[tmp]\n\t"
: [dst_w] "+&r" (dst), [dst_r] "+&r" (dst), [src] "+&r" (src), [len] "+&r" (len), [tmp] "=&r" (tmp)
:
: "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
"s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15",
"s16", "s17", "s18", "s19", "s20", "s21", "s22", "s23",
"s24", "s25", "s26", "s27", "s28", "s29", "s30", "s31",
"cc", "memory");
}
|
{
"code": [
"static void vector_fmul_vfp(float *dst, const float *src, int len)\r",
" int tmp;\r",
" asm volatile(\r",
" \"fmrx %[tmp], fpscr\\n\\t\"\r",
" \"fmxr fpscr, %[tmp]\\n\\t\"\r",
" \"fldmias %[dst_r]!, {s0-s3}\\n\\t\"\r",
" \"fldmias %[src]!, {s8-s11}\\n\\t\"\r",
" \"fldmias %[dst_r]!, {s4-s7}\\n\\t\"\r",
" \"fldmias %[src]!, {s12-s15}\\n\\t\"\r",
" \"fmuls s8, s0, s8\\n\\t\"\r",
" \"1:\\n\\t\"\r",
" \"subs %[len], %[len], #16\\n\\t\"\r",
" \"fmuls s12, s4, s12\\n\\t\"\r",
" \"fldmiasge %[dst_r]!, {s16-s19}\\n\\t\"\r",
" \"fldmiasge %[src]!, {s24-s27}\\n\\t\"\r",
" \"fldmiasge %[dst_r]!, {s20-s23}\\n\\t\"\r",
" \"fldmiasge %[src]!, {s28-s31}\\n\\t\"\r",
" \"fmulsge s24, s16, s24\\n\\t\"\r",
" \"fstmias %[dst_w]!, {s8-s11}\\n\\t\"\r",
" \"fstmias %[dst_w]!, {s12-s15}\\n\\t\"\r",
" \"fmulsge s28, s20, s28\\n\\t\"\r",
" \"fldmiasgt %[dst_r]!, {s0-s3}\\n\\t\"\r",
" \"fldmiasgt %[src]!, {s8-s11}\\n\\t\"\r",
" \"fldmiasgt %[dst_r]!, {s4-s7}\\n\\t\"\r",
" \"fldmiasgt %[src]!, {s12-s15}\\n\\t\"\r",
" \"fmulsge s8, s0, s8\\n\\t\"\r",
" \"fstmiasge %[dst_w]!, {s24-s27}\\n\\t\"\r",
" \"fstmiasge %[dst_w]!, {s28-s31}\\n\\t\"\r",
" \"bgt 1b\\n\\t\"\r",
" \"fmxr fpscr, %[tmp]\\n\\t\"\r",
" : [dst_w] \"+&r\" (dst), [dst_r] \"+&r\" (dst), [src] \"+&r\" (src), [len] \"+&r\" (len), [tmp] \"=&r\" (tmp)\r",
" : \"s0\", \"s1\", \"s2\", \"s3\", \"s4\", \"s5\", \"s6\", \"s7\",\r",
" \"s8\", \"s9\", \"s10\", \"s11\", \"s12\", \"s13\", \"s14\", \"s15\",\r",
" \"s16\", \"s17\", \"s18\", \"s19\", \"s20\", \"s21\", \"s22\", \"s23\",\r",
" \"s24\", \"s25\", \"s26\", \"s27\", \"s28\", \"s29\", \"s30\", \"s31\",\r",
" \"cc\", \"memory\");\r",
" asm volatile(\r",
" \"1:\\n\\t\"\r",
" \"subs %[len], %[len], #16\\n\\t\"\r",
" \"bgt 1b\\n\\t\"\r",
" : \"s0\", \"s1\", \"s2\", \"s3\", \"s4\", \"s5\", \"s6\", \"s7\",\r",
" \"s8\", \"s9\", \"s10\", \"s11\", \"s12\", \"s13\", \"s14\", \"s15\",\r",
" \"s16\", \"s17\", \"s18\", \"s19\", \"s20\", \"s21\", \"s22\", \"s23\",\r",
" \"s24\", \"s25\", \"s26\", \"s27\", \"s28\", \"s29\", \"s30\", \"s31\",\r",
" \"cc\", \"memory\");\r",
" asm volatile(\r",
" \"1:\\n\\t\"\r",
" \"bgt 1b\\n\\t\"\r",
" : \"s0\", \"s1\", \"s2\", \"s3\", \"s4\", \"s5\", \"s6\", \"s7\",\r",
" \"s16\", \"s17\", \"s18\", \"s19\", \"s20\", \"s21\", \"s22\", \"s23\",\r",
" \"cc\", \"memory\");\r"
],
"line_no": [
1,
5,
7,
9,
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,
13,
71,
75,
77,
79,
81,
83,
7,
27,
29,
63,
75,
77,
79,
81,
83,
7,
27,
63,
75,
79,
83
]
}
|
static void FUNC_0(float *VAR_0, const float *VAR_1, int VAR_2)
{
int VAR_3;
asm volatile(
"fmrx %[VAR_3], fpscr\n\t"
"orr %[VAR_3], %[VAR_3], #(3 << 16)\n\t"
"fmxr fpscr, %[VAR_3]\n\t"
"fldmias %[dst_r]!, {s0-s3}\n\t"
"fldmias %[VAR_1]!, {s8-s11}\n\t"
"fldmias %[dst_r]!, {s4-s7}\n\t"
"fldmias %[VAR_1]!, {s12-s15}\n\t"
"fmuls s8, s0, s8\n\t"
"1:\n\t"
"subs %[VAR_2], %[VAR_2], #16\n\t"
"fmuls s12, s4, s12\n\t"
"fldmiasge %[dst_r]!, {s16-s19}\n\t"
"fldmiasge %[VAR_1]!, {s24-s27}\n\t"
"fldmiasge %[dst_r]!, {s20-s23}\n\t"
"fldmiasge %[VAR_1]!, {s28-s31}\n\t"
"fmulsge s24, s16, s24\n\t"
"fstmias %[dst_w]!, {s8-s11}\n\t"
"fstmias %[dst_w]!, {s12-s15}\n\t"
"fmulsge s28, s20, s28\n\t"
"fldmiasgt %[dst_r]!, {s0-s3}\n\t"
"fldmiasgt %[VAR_1]!, {s8-s11}\n\t"
"fldmiasgt %[dst_r]!, {s4-s7}\n\t"
"fldmiasgt %[VAR_1]!, {s12-s15}\n\t"
"fmulsge s8, s0, s8\n\t"
"fstmiasge %[dst_w]!, {s24-s27}\n\t"
"fstmiasge %[dst_w]!, {s28-s31}\n\t"
"bgt 1b\n\t"
"bic %[VAR_3], %[VAR_3], #(7 << 16)\n\t"
"fmxr fpscr, %[VAR_3]\n\t"
: [dst_w] "+&r" (VAR_0), [dst_r] "+&r" (VAR_0), [VAR_1] "+&r" (VAR_1), [VAR_2] "+&r" (VAR_2), [VAR_3] "=&r" (VAR_3)
:
: "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
"s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15",
"s16", "s17", "s18", "s19", "s20", "s21", "s22", "s23",
"s24", "s25", "s26", "s27", "s28", "s29", "s30", "s31",
"cc", "memory");
}
|
[
"static void FUNC_0(float *VAR_0, const float *VAR_1, int VAR_2)\n{",
"int VAR_3;",
"asm volatile(\n\"fmrx %[VAR_3], fpscr\\n\\t\"\n\"orr %[VAR_3], %[VAR_3], #(3 << 16)\\n\\t\"\n\"fmxr fpscr, %[VAR_3]\\n\\t\"\n\"fldmias %[dst_r]!, {s0-s3}\\n\\t\"",
"\"fldmias %[VAR_1]!, {s8-s11}\\n\\t\"",
"\"fldmias %[dst_r]!, {s4-s7}\\n\\t\"",
"\"fldmias %[VAR_1]!, {s12-s15}\\n\\t\"",
"\"fmuls s8, s0, s8\\n\\t\"\n\"1:\\n\\t\"\n\"subs %[VAR_2], %[VAR_2], #16\\n\\t\"\n\"fmuls s12, s4, s12\\n\\t\"\n\"fldmiasge %[dst_r]!, {s16-s19}\\n\\t\"",
"\"fldmiasge %[VAR_1]!, {s24-s27}\\n\\t\"",
"\"fldmiasge %[dst_r]!, {s20-s23}\\n\\t\"",
"\"fldmiasge %[VAR_1]!, {s28-s31}\\n\\t\"",
"\"fmulsge s24, s16, s24\\n\\t\"\n\"fstmias %[dst_w]!, {s8-s11}\\n\\t\"",
"\"fstmias %[dst_w]!, {s12-s15}\\n\\t\"",
"\"fmulsge s28, s20, s28\\n\\t\"\n\"fldmiasgt %[dst_r]!, {s0-s3}\\n\\t\"",
"\"fldmiasgt %[VAR_1]!, {s8-s11}\\n\\t\"",
"\"fldmiasgt %[dst_r]!, {s4-s7}\\n\\t\"",
"\"fldmiasgt %[VAR_1]!, {s12-s15}\\n\\t\"",
"\"fmulsge s8, s0, s8\\n\\t\"\n\"fstmiasge %[dst_w]!, {s24-s27}\\n\\t\"",
"\"fstmiasge %[dst_w]!, {s28-s31}\\n\\t\"",
"\"bgt 1b\\n\\t\"\n\"bic %[VAR_3], %[VAR_3], #(7 << 16)\\n\\t\"\n\"fmxr fpscr, %[VAR_3]\\n\\t\"\n: [dst_w] \"+&r\" (VAR_0), [dst_r] \"+&r\" (VAR_0), [VAR_1] \"+&r\" (VAR_1), [VAR_2] \"+&r\" (VAR_2), [VAR_3] \"=&r\" (VAR_3)\n:\n: \"s0\", \"s1\", \"s2\", \"s3\", \"s4\", \"s5\", \"s6\", \"s7\",\n\"s8\", \"s9\", \"s10\", \"s11\", \"s12\", \"s13\", \"s14\", \"s15\",\n\"s16\", \"s17\", \"s18\", \"s19\", \"s20\", \"s21\", \"s22\", \"s23\",\n\"s24\", \"s25\", \"s26\", \"s27\", \"s28\", \"s29\", \"s30\", \"s31\",\n\"cc\", \"memory\");",
"}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0
] |
[
[
1,
3
],
[
5
],
[
7,
9,
11,
13,
17
],
[
19
],
[
21
],
[
23
],
[
25,
27,
29,
31,
33
],
[
35
],
[
37
],
[
39
],
[
41,
43
],
[
45
],
[
47,
49
],
[
51
],
[
53
],
[
55
],
[
57,
59
],
[
61
],
[
63,
67,
69,
71,
73,
75,
77,
79,
81,
83
],
[
85
]
] |
9,595 |
static void decode_opc (CPUState *env, DisasContext *ctx, int *is_branch)
{
int32_t offset;
int rs, rt, rd, sa;
uint32_t op, op1, op2;
int16_t imm;
/* make sure instructions are on a word boundary */
if (ctx->pc & 0x3) {
env->CP0_BadVAddr = ctx->pc;
generate_exception(ctx, EXCP_AdEL);
return;
}
/* Handle blikely not taken case */
if ((ctx->hflags & MIPS_HFLAG_BMASK_BASE) == MIPS_HFLAG_BL) {
int l1 = gen_new_label();
MIPS_DEBUG("blikely condition (" TARGET_FMT_lx ")", ctx->pc + 4);
tcg_gen_brcondi_tl(TCG_COND_NE, bcond, 0, l1);
tcg_gen_movi_i32(hflags, ctx->hflags & ~MIPS_HFLAG_BMASK);
gen_goto_tb(ctx, 1, ctx->pc + 4);
gen_set_label(l1);
}
if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP)))
tcg_gen_debug_insn_start(ctx->pc);
op = MASK_OP_MAJOR(ctx->opcode);
rs = (ctx->opcode >> 21) & 0x1f;
rt = (ctx->opcode >> 16) & 0x1f;
rd = (ctx->opcode >> 11) & 0x1f;
sa = (ctx->opcode >> 6) & 0x1f;
imm = (int16_t)ctx->opcode;
switch (op) {
case OPC_SPECIAL:
op1 = MASK_SPECIAL(ctx->opcode);
switch (op1) {
case OPC_SLL: /* Shift with immediate */
case OPC_SRA:
gen_shift_imm(env, ctx, op1, rd, rt, sa);
break;
case OPC_SRL:
switch ((ctx->opcode >> 21) & 0x1f) {
case 1:
/* rotr is decoded as srl on non-R2 CPUs */
if (env->insn_flags & ISA_MIPS32R2) {
op1 = OPC_ROTR;
}
/* Fallthrough */
case 0:
gen_shift_imm(env, ctx, op1, rd, rt, sa);
break;
default:
generate_exception(ctx, EXCP_RI);
break;
}
break;
case OPC_MOVN: /* Conditional move */
case OPC_MOVZ:
check_insn(env, ctx, ISA_MIPS4 | ISA_MIPS32 |
INSN_LOONGSON2E | INSN_LOONGSON2F);
gen_cond_move(env, op1, rd, rs, rt);
break;
case OPC_ADD ... OPC_SUBU:
gen_arith(env, ctx, op1, rd, rs, rt);
break;
case OPC_SLLV: /* Shifts */
case OPC_SRAV:
gen_shift(env, ctx, op1, rd, rs, rt);
break;
case OPC_SRLV:
switch ((ctx->opcode >> 6) & 0x1f) {
case 1:
/* rotrv is decoded as srlv on non-R2 CPUs */
if (env->insn_flags & ISA_MIPS32R2) {
op1 = OPC_ROTRV;
}
/* Fallthrough */
case 0:
gen_shift(env, ctx, op1, rd, rs, rt);
break;
default:
generate_exception(ctx, EXCP_RI);
break;
}
break;
case OPC_SLT: /* Set on less than */
case OPC_SLTU:
gen_slt(env, op1, rd, rs, rt);
break;
case OPC_AND: /* Logic*/
case OPC_OR:
case OPC_NOR:
case OPC_XOR:
gen_logic(env, op1, rd, rs, rt);
break;
case OPC_MULT ... OPC_DIVU:
if (sa) {
check_insn(env, ctx, INSN_VR54XX);
op1 = MASK_MUL_VR54XX(ctx->opcode);
gen_mul_vr54xx(ctx, op1, rd, rs, rt);
} else
gen_muldiv(ctx, op1, rs, rt);
break;
case OPC_JR ... OPC_JALR:
gen_compute_branch(ctx, op1, 4, rs, rd, sa);
*is_branch = 1;
break;
case OPC_TGE ... OPC_TEQ: /* Traps */
case OPC_TNE:
gen_trap(ctx, op1, rs, rt, -1);
break;
case OPC_MFHI: /* Move from HI/LO */
case OPC_MFLO:
gen_HILO(ctx, op1, rd);
break;
case OPC_MTHI:
case OPC_MTLO: /* Move to HI/LO */
gen_HILO(ctx, op1, rs);
break;
case OPC_PMON: /* Pmon entry point, also R4010 selsl */
#ifdef MIPS_STRICT_STANDARD
MIPS_INVAL("PMON / selsl");
generate_exception(ctx, EXCP_RI);
#else
gen_helper_0i(pmon, sa);
#endif
break;
case OPC_SYSCALL:
generate_exception(ctx, EXCP_SYSCALL);
ctx->bstate = BS_STOP;
break;
case OPC_BREAK:
generate_exception(ctx, EXCP_BREAK);
break;
case OPC_SPIM:
#ifdef MIPS_STRICT_STANDARD
MIPS_INVAL("SPIM");
generate_exception(ctx, EXCP_RI);
#else
/* Implemented as RI exception for now. */
MIPS_INVAL("spim (unofficial)");
generate_exception(ctx, EXCP_RI);
#endif
break;
case OPC_SYNC:
/* Treat as NOP. */
break;
case OPC_MOVCI:
check_insn(env, ctx, ISA_MIPS4 | ISA_MIPS32);
if (env->CP0_Config1 & (1 << CP0C1_FP)) {
check_cp1_enabled(ctx);
gen_movci(ctx, rd, rs, (ctx->opcode >> 18) & 0x7,
(ctx->opcode >> 16) & 1);
} else {
generate_exception_err(ctx, EXCP_CpU, 1);
}
break;
#if defined(TARGET_MIPS64)
/* MIPS64 specific opcodes */
case OPC_DSLL:
case OPC_DSRA:
case OPC_DSLL32:
case OPC_DSRA32:
check_insn(env, ctx, ISA_MIPS3);
check_mips_64(ctx);
gen_shift_imm(env, ctx, op1, rd, rt, sa);
break;
case OPC_DSRL:
switch ((ctx->opcode >> 21) & 0x1f) {
case 1:
/* drotr is decoded as dsrl on non-R2 CPUs */
if (env->insn_flags & ISA_MIPS32R2) {
op1 = OPC_DROTR;
}
/* Fallthrough */
case 0:
check_insn(env, ctx, ISA_MIPS3);
check_mips_64(ctx);
gen_shift_imm(env, ctx, op1, rd, rt, sa);
break;
default:
generate_exception(ctx, EXCP_RI);
break;
}
break;
case OPC_DSRL32:
switch ((ctx->opcode >> 21) & 0x1f) {
case 1:
/* drotr32 is decoded as dsrl32 on non-R2 CPUs */
if (env->insn_flags & ISA_MIPS32R2) {
op1 = OPC_DROTR32;
}
/* Fallthrough */
case 0:
check_insn(env, ctx, ISA_MIPS3);
check_mips_64(ctx);
gen_shift_imm(env, ctx, op1, rd, rt, sa);
break;
default:
generate_exception(ctx, EXCP_RI);
break;
}
break;
case OPC_DADD ... OPC_DSUBU:
check_insn(env, ctx, ISA_MIPS3);
check_mips_64(ctx);
gen_arith(env, ctx, op1, rd, rs, rt);
break;
case OPC_DSLLV:
case OPC_DSRAV:
check_insn(env, ctx, ISA_MIPS3);
check_mips_64(ctx);
gen_shift(env, ctx, op1, rd, rs, rt);
break;
case OPC_DSRLV:
switch ((ctx->opcode >> 6) & 0x1f) {
case 1:
/* drotrv is decoded as dsrlv on non-R2 CPUs */
if (env->insn_flags & ISA_MIPS32R2) {
op1 = OPC_DROTRV;
}
/* Fallthrough */
case 0:
check_insn(env, ctx, ISA_MIPS3);
check_mips_64(ctx);
gen_shift(env, ctx, op1, rd, rs, rt);
break;
default:
generate_exception(ctx, EXCP_RI);
break;
}
break;
case OPC_DMULT ... OPC_DDIVU:
check_insn(env, ctx, ISA_MIPS3);
check_mips_64(ctx);
gen_muldiv(ctx, op1, rs, rt);
break;
#endif
default: /* Invalid */
MIPS_INVAL("special");
generate_exception(ctx, EXCP_RI);
break;
}
break;
case OPC_SPECIAL2:
op1 = MASK_SPECIAL2(ctx->opcode);
switch (op1) {
case OPC_MADD ... OPC_MADDU: /* Multiply and add/sub */
case OPC_MSUB ... OPC_MSUBU:
check_insn(env, ctx, ISA_MIPS32);
gen_muldiv(ctx, op1, rs, rt);
break;
case OPC_MUL:
gen_arith(env, ctx, op1, rd, rs, rt);
break;
case OPC_CLO:
case OPC_CLZ:
check_insn(env, ctx, ISA_MIPS32);
gen_cl(ctx, op1, rd, rs);
break;
case OPC_SDBBP:
/* XXX: not clear which exception should be raised
* when in debug mode...
*/
check_insn(env, ctx, ISA_MIPS32);
if (!(ctx->hflags & MIPS_HFLAG_DM)) {
generate_exception(ctx, EXCP_DBp);
} else {
generate_exception(ctx, EXCP_DBp);
}
/* Treat as NOP. */
break;
case OPC_DIV_G_2F:
case OPC_DIVU_G_2F:
case OPC_MULT_G_2F:
case OPC_MULTU_G_2F:
case OPC_MOD_G_2F:
case OPC_MODU_G_2F:
check_insn(env, ctx, INSN_LOONGSON2F);
gen_loongson_integer(ctx, op1, rd, rs, rt);
break;
#if defined(TARGET_MIPS64)
case OPC_DCLO:
case OPC_DCLZ:
check_insn(env, ctx, ISA_MIPS64);
check_mips_64(ctx);
gen_cl(ctx, op1, rd, rs);
break;
case OPC_DMULT_G_2F:
case OPC_DMULTU_G_2F:
case OPC_DDIV_G_2F:
case OPC_DDIVU_G_2F:
case OPC_DMOD_G_2F:
case OPC_DMODU_G_2F:
check_insn(env, ctx, INSN_LOONGSON2F);
gen_loongson_integer(ctx, op1, rd, rs, rt);
break;
#endif
default: /* Invalid */
MIPS_INVAL("special2");
generate_exception(ctx, EXCP_RI);
break;
}
break;
case OPC_SPECIAL3:
op1 = MASK_SPECIAL3(ctx->opcode);
switch (op1) {
case OPC_EXT:
case OPC_INS:
check_insn(env, ctx, ISA_MIPS32R2);
gen_bitops(ctx, op1, rt, rs, sa, rd);
break;
case OPC_BSHFL:
check_insn(env, ctx, ISA_MIPS32R2);
op2 = MASK_BSHFL(ctx->opcode);
gen_bshfl(ctx, op2, rt, rd);
break;
case OPC_RDHWR:
gen_rdhwr(env, ctx, rt, rd);
break;
case OPC_FORK:
check_insn(env, ctx, ASE_MT);
{
TCGv t0 = tcg_temp_new();
TCGv t1 = tcg_temp_new();
gen_load_gpr(t0, rt);
gen_load_gpr(t1, rs);
gen_helper_fork(t0, t1);
tcg_temp_free(t0);
tcg_temp_free(t1);
}
break;
case OPC_YIELD:
check_insn(env, ctx, ASE_MT);
{
TCGv t0 = tcg_temp_new();
save_cpu_state(ctx, 1);
gen_load_gpr(t0, rs);
gen_helper_yield(t0, t0);
gen_store_gpr(t0, rd);
tcg_temp_free(t0);
}
break;
case OPC_DIV_G_2E ... OPC_DIVU_G_2E:
case OPC_MULT_G_2E ... OPC_MULTU_G_2E:
case OPC_MOD_G_2E ... OPC_MODU_G_2E:
check_insn(env, ctx, INSN_LOONGSON2E);
gen_loongson_integer(ctx, op1, rd, rs, rt);
break;
#if defined(TARGET_MIPS64)
case OPC_DEXTM ... OPC_DEXT:
case OPC_DINSM ... OPC_DINS:
check_insn(env, ctx, ISA_MIPS64R2);
check_mips_64(ctx);
gen_bitops(ctx, op1, rt, rs, sa, rd);
break;
case OPC_DBSHFL:
check_insn(env, ctx, ISA_MIPS64R2);
check_mips_64(ctx);
op2 = MASK_DBSHFL(ctx->opcode);
gen_bshfl(ctx, op2, rt, rd);
break;
case OPC_DDIV_G_2E ... OPC_DDIVU_G_2E:
case OPC_DMULT_G_2E ... OPC_DMULTU_G_2E:
case OPC_DMOD_G_2E ... OPC_DMODU_G_2E:
check_insn(env, ctx, INSN_LOONGSON2E);
gen_loongson_integer(ctx, op1, rd, rs, rt);
break;
#endif
default: /* Invalid */
MIPS_INVAL("special3");
generate_exception(ctx, EXCP_RI);
break;
}
break;
case OPC_REGIMM:
op1 = MASK_REGIMM(ctx->opcode);
switch (op1) {
case OPC_BLTZ ... OPC_BGEZL: /* REGIMM branches */
case OPC_BLTZAL ... OPC_BGEZALL:
gen_compute_branch(ctx, op1, 4, rs, -1, imm << 2);
*is_branch = 1;
break;
case OPC_TGEI ... OPC_TEQI: /* REGIMM traps */
case OPC_TNEI:
gen_trap(ctx, op1, rs, -1, imm);
break;
case OPC_SYNCI:
check_insn(env, ctx, ISA_MIPS32R2);
/* Treat as NOP. */
break;
default: /* Invalid */
MIPS_INVAL("regimm");
generate_exception(ctx, EXCP_RI);
break;
}
break;
case OPC_CP0:
check_cp0_enabled(ctx);
op1 = MASK_CP0(ctx->opcode);
switch (op1) {
case OPC_MFC0:
case OPC_MTC0:
case OPC_MFTR:
case OPC_MTTR:
#if defined(TARGET_MIPS64)
case OPC_DMFC0:
case OPC_DMTC0:
#endif
#ifndef CONFIG_USER_ONLY
gen_cp0(env, ctx, op1, rt, rd);
#endif /* !CONFIG_USER_ONLY */
break;
case OPC_C0_FIRST ... OPC_C0_LAST:
#ifndef CONFIG_USER_ONLY
gen_cp0(env, ctx, MASK_C0(ctx->opcode), rt, rd);
#endif /* !CONFIG_USER_ONLY */
break;
case OPC_MFMC0:
#ifndef CONFIG_USER_ONLY
{
TCGv t0 = tcg_temp_new();
op2 = MASK_MFMC0(ctx->opcode);
switch (op2) {
case OPC_DMT:
check_insn(env, ctx, ASE_MT);
gen_helper_dmt(t0, t0);
gen_store_gpr(t0, rt);
break;
case OPC_EMT:
check_insn(env, ctx, ASE_MT);
gen_helper_emt(t0, t0);
gen_store_gpr(t0, rt);
break;
case OPC_DVPE:
check_insn(env, ctx, ASE_MT);
gen_helper_dvpe(t0, t0);
gen_store_gpr(t0, rt);
break;
case OPC_EVPE:
check_insn(env, ctx, ASE_MT);
gen_helper_evpe(t0, t0);
gen_store_gpr(t0, rt);
break;
case OPC_DI:
check_insn(env, ctx, ISA_MIPS32R2);
save_cpu_state(ctx, 1);
gen_helper_di(t0);
gen_store_gpr(t0, rt);
/* Stop translation as we may have switched the execution mode */
ctx->bstate = BS_STOP;
break;
case OPC_EI:
check_insn(env, ctx, ISA_MIPS32R2);
save_cpu_state(ctx, 1);
gen_helper_ei(t0);
gen_store_gpr(t0, rt);
/* Stop translation as we may have switched the execution mode */
ctx->bstate = BS_STOP;
break;
default: /* Invalid */
MIPS_INVAL("mfmc0");
generate_exception(ctx, EXCP_RI);
break;
}
tcg_temp_free(t0);
}
#endif /* !CONFIG_USER_ONLY */
break;
case OPC_RDPGPR:
check_insn(env, ctx, ISA_MIPS32R2);
gen_load_srsgpr(rt, rd);
break;
case OPC_WRPGPR:
check_insn(env, ctx, ISA_MIPS32R2);
gen_store_srsgpr(rt, rd);
break;
default:
MIPS_INVAL("cp0");
generate_exception(ctx, EXCP_RI);
break;
}
break;
case OPC_ADDI: /* Arithmetic with immediate opcode */
case OPC_ADDIU:
gen_arith_imm(env, ctx, op, rt, rs, imm);
break;
case OPC_SLTI: /* Set on less than with immediate opcode */
case OPC_SLTIU:
gen_slt_imm(env, op, rt, rs, imm);
break;
case OPC_ANDI: /* Arithmetic with immediate opcode */
case OPC_LUI:
case OPC_ORI:
case OPC_XORI:
gen_logic_imm(env, op, rt, rs, imm);
break;
case OPC_J ... OPC_JAL: /* Jump */
offset = (int32_t)(ctx->opcode & 0x3FFFFFF) << 2;
gen_compute_branch(ctx, op, 4, rs, rt, offset);
*is_branch = 1;
break;
case OPC_BEQ ... OPC_BGTZ: /* Branch */
case OPC_BEQL ... OPC_BGTZL:
gen_compute_branch(ctx, op, 4, rs, rt, imm << 2);
*is_branch = 1;
break;
case OPC_LB ... OPC_LWR: /* Load and stores */
case OPC_LL:
gen_ld(env, ctx, op, rt, rs, imm);
break;
case OPC_SB ... OPC_SW:
case OPC_SWR:
gen_st(ctx, op, rt, rs, imm);
break;
case OPC_SC:
gen_st_cond(ctx, op, rt, rs, imm);
break;
case OPC_CACHE:
check_insn(env, ctx, ISA_MIPS3 | ISA_MIPS32);
/* Treat as NOP. */
break;
case OPC_PREF:
check_insn(env, ctx, ISA_MIPS4 | ISA_MIPS32);
/* Treat as NOP. */
break;
/* Floating point (COP1). */
case OPC_LWC1:
case OPC_LDC1:
case OPC_SWC1:
case OPC_SDC1:
gen_cop1_ldst(env, ctx, op, rt, rs, imm);
break;
case OPC_CP1:
if (env->CP0_Config1 & (1 << CP0C1_FP)) {
check_cp1_enabled(ctx);
op1 = MASK_CP1(ctx->opcode);
switch (op1) {
case OPC_MFHC1:
case OPC_MTHC1:
check_insn(env, ctx, ISA_MIPS32R2);
case OPC_MFC1:
case OPC_CFC1:
case OPC_MTC1:
case OPC_CTC1:
gen_cp1(ctx, op1, rt, rd);
break;
#if defined(TARGET_MIPS64)
case OPC_DMFC1:
case OPC_DMTC1:
check_insn(env, ctx, ISA_MIPS3);
gen_cp1(ctx, op1, rt, rd);
break;
#endif
case OPC_BC1ANY2:
case OPC_BC1ANY4:
check_cop1x(ctx);
check_insn(env, ctx, ASE_MIPS3D);
/* fall through */
case OPC_BC1:
gen_compute_branch1(env, ctx, MASK_BC1(ctx->opcode),
(rt >> 2) & 0x7, imm << 2);
*is_branch = 1;
break;
case OPC_S_FMT:
case OPC_D_FMT:
case OPC_W_FMT:
case OPC_L_FMT:
case OPC_PS_FMT:
gen_farith(ctx, ctx->opcode & FOP(0x3f, 0x1f), rt, rd, sa,
(imm >> 8) & 0x7);
break;
default:
MIPS_INVAL("cp1");
generate_exception (ctx, EXCP_RI);
break;
}
} else {
generate_exception_err(ctx, EXCP_CpU, 1);
}
break;
/* COP2. */
case OPC_LWC2:
case OPC_LDC2:
case OPC_SWC2:
case OPC_SDC2:
case OPC_CP2:
/* COP2: Not implemented. */
generate_exception_err(ctx, EXCP_CpU, 2);
break;
case OPC_CP3:
if (env->CP0_Config1 & (1 << CP0C1_FP)) {
check_cp1_enabled(ctx);
op1 = MASK_CP3(ctx->opcode);
switch (op1) {
case OPC_LWXC1:
case OPC_LDXC1:
case OPC_LUXC1:
case OPC_SWXC1:
case OPC_SDXC1:
case OPC_SUXC1:
gen_flt3_ldst(ctx, op1, sa, rd, rs, rt);
break;
case OPC_PREFX:
/* Treat as NOP. */
break;
case OPC_ALNV_PS:
case OPC_MADD_S:
case OPC_MADD_D:
case OPC_MADD_PS:
case OPC_MSUB_S:
case OPC_MSUB_D:
case OPC_MSUB_PS:
case OPC_NMADD_S:
case OPC_NMADD_D:
case OPC_NMADD_PS:
case OPC_NMSUB_S:
case OPC_NMSUB_D:
case OPC_NMSUB_PS:
gen_flt3_arith(ctx, op1, sa, rs, rd, rt);
break;
default:
MIPS_INVAL("cp3");
generate_exception (ctx, EXCP_RI);
break;
}
} else {
generate_exception_err(ctx, EXCP_CpU, 1);
}
break;
#if defined(TARGET_MIPS64)
/* MIPS64 opcodes */
case OPC_LWU:
case OPC_LDL ... OPC_LDR:
case OPC_LLD:
case OPC_LD:
check_insn(env, ctx, ISA_MIPS3);
check_mips_64(ctx);
gen_ld(env, ctx, op, rt, rs, imm);
break;
case OPC_SDL ... OPC_SDR:
case OPC_SD:
check_insn(env, ctx, ISA_MIPS3);
check_mips_64(ctx);
gen_st(ctx, op, rt, rs, imm);
break;
case OPC_SCD:
check_insn(env, ctx, ISA_MIPS3);
check_mips_64(ctx);
gen_st_cond(ctx, op, rt, rs, imm);
break;
case OPC_DADDI:
case OPC_DADDIU:
check_insn(env, ctx, ISA_MIPS3);
check_mips_64(ctx);
gen_arith_imm(env, ctx, op, rt, rs, imm);
break;
#endif
case OPC_JALX:
check_insn(env, ctx, ASE_MIPS16 | ASE_MICROMIPS);
offset = (int32_t)(ctx->opcode & 0x3FFFFFF) << 2;
gen_compute_branch(ctx, op, 4, rs, rt, offset);
*is_branch = 1;
break;
case OPC_MDMX:
check_insn(env, ctx, ASE_MDMX);
/* MDMX: Not implemented. */
default: /* Invalid */
MIPS_INVAL("major opcode");
generate_exception(ctx, EXCP_RI);
break;
}
}
| true |
qemu
|
9ed5726c043958359b0f1fa44ab3e4f25f9d9a47
|
static void decode_opc (CPUState *env, DisasContext *ctx, int *is_branch)
{
int32_t offset;
int rs, rt, rd, sa;
uint32_t op, op1, op2;
int16_t imm;
if (ctx->pc & 0x3) {
env->CP0_BadVAddr = ctx->pc;
generate_exception(ctx, EXCP_AdEL);
return;
}
if ((ctx->hflags & MIPS_HFLAG_BMASK_BASE) == MIPS_HFLAG_BL) {
int l1 = gen_new_label();
MIPS_DEBUG("blikely condition (" TARGET_FMT_lx ")", ctx->pc + 4);
tcg_gen_brcondi_tl(TCG_COND_NE, bcond, 0, l1);
tcg_gen_movi_i32(hflags, ctx->hflags & ~MIPS_HFLAG_BMASK);
gen_goto_tb(ctx, 1, ctx->pc + 4);
gen_set_label(l1);
}
if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP)))
tcg_gen_debug_insn_start(ctx->pc);
op = MASK_OP_MAJOR(ctx->opcode);
rs = (ctx->opcode >> 21) & 0x1f;
rt = (ctx->opcode >> 16) & 0x1f;
rd = (ctx->opcode >> 11) & 0x1f;
sa = (ctx->opcode >> 6) & 0x1f;
imm = (int16_t)ctx->opcode;
switch (op) {
case OPC_SPECIAL:
op1 = MASK_SPECIAL(ctx->opcode);
switch (op1) {
case OPC_SLL:
case OPC_SRA:
gen_shift_imm(env, ctx, op1, rd, rt, sa);
break;
case OPC_SRL:
switch ((ctx->opcode >> 21) & 0x1f) {
case 1:
if (env->insn_flags & ISA_MIPS32R2) {
op1 = OPC_ROTR;
}
case 0:
gen_shift_imm(env, ctx, op1, rd, rt, sa);
break;
default:
generate_exception(ctx, EXCP_RI);
break;
}
break;
case OPC_MOVN:
case OPC_MOVZ:
check_insn(env, ctx, ISA_MIPS4 | ISA_MIPS32 |
INSN_LOONGSON2E | INSN_LOONGSON2F);
gen_cond_move(env, op1, rd, rs, rt);
break;
case OPC_ADD ... OPC_SUBU:
gen_arith(env, ctx, op1, rd, rs, rt);
break;
case OPC_SLLV:
case OPC_SRAV:
gen_shift(env, ctx, op1, rd, rs, rt);
break;
case OPC_SRLV:
switch ((ctx->opcode >> 6) & 0x1f) {
case 1:
if (env->insn_flags & ISA_MIPS32R2) {
op1 = OPC_ROTRV;
}
case 0:
gen_shift(env, ctx, op1, rd, rs, rt);
break;
default:
generate_exception(ctx, EXCP_RI);
break;
}
break;
case OPC_SLT:
case OPC_SLTU:
gen_slt(env, op1, rd, rs, rt);
break;
case OPC_AND:
case OPC_OR:
case OPC_NOR:
case OPC_XOR:
gen_logic(env, op1, rd, rs, rt);
break;
case OPC_MULT ... OPC_DIVU:
if (sa) {
check_insn(env, ctx, INSN_VR54XX);
op1 = MASK_MUL_VR54XX(ctx->opcode);
gen_mul_vr54xx(ctx, op1, rd, rs, rt);
} else
gen_muldiv(ctx, op1, rs, rt);
break;
case OPC_JR ... OPC_JALR:
gen_compute_branch(ctx, op1, 4, rs, rd, sa);
*is_branch = 1;
break;
case OPC_TGE ... OPC_TEQ:
case OPC_TNE:
gen_trap(ctx, op1, rs, rt, -1);
break;
case OPC_MFHI:
case OPC_MFLO:
gen_HILO(ctx, op1, rd);
break;
case OPC_MTHI:
case OPC_MTLO:
gen_HILO(ctx, op1, rs);
break;
case OPC_PMON:
#ifdef MIPS_STRICT_STANDARD
MIPS_INVAL("PMON / selsl");
generate_exception(ctx, EXCP_RI);
#else
gen_helper_0i(pmon, sa);
#endif
break;
case OPC_SYSCALL:
generate_exception(ctx, EXCP_SYSCALL);
ctx->bstate = BS_STOP;
break;
case OPC_BREAK:
generate_exception(ctx, EXCP_BREAK);
break;
case OPC_SPIM:
#ifdef MIPS_STRICT_STANDARD
MIPS_INVAL("SPIM");
generate_exception(ctx, EXCP_RI);
#else
MIPS_INVAL("spim (unofficial)");
generate_exception(ctx, EXCP_RI);
#endif
break;
case OPC_SYNC:
break;
case OPC_MOVCI:
check_insn(env, ctx, ISA_MIPS4 | ISA_MIPS32);
if (env->CP0_Config1 & (1 << CP0C1_FP)) {
check_cp1_enabled(ctx);
gen_movci(ctx, rd, rs, (ctx->opcode >> 18) & 0x7,
(ctx->opcode >> 16) & 1);
} else {
generate_exception_err(ctx, EXCP_CpU, 1);
}
break;
#if defined(TARGET_MIPS64)
case OPC_DSLL:
case OPC_DSRA:
case OPC_DSLL32:
case OPC_DSRA32:
check_insn(env, ctx, ISA_MIPS3);
check_mips_64(ctx);
gen_shift_imm(env, ctx, op1, rd, rt, sa);
break;
case OPC_DSRL:
switch ((ctx->opcode >> 21) & 0x1f) {
case 1:
if (env->insn_flags & ISA_MIPS32R2) {
op1 = OPC_DROTR;
}
case 0:
check_insn(env, ctx, ISA_MIPS3);
check_mips_64(ctx);
gen_shift_imm(env, ctx, op1, rd, rt, sa);
break;
default:
generate_exception(ctx, EXCP_RI);
break;
}
break;
case OPC_DSRL32:
switch ((ctx->opcode >> 21) & 0x1f) {
case 1:
if (env->insn_flags & ISA_MIPS32R2) {
op1 = OPC_DROTR32;
}
case 0:
check_insn(env, ctx, ISA_MIPS3);
check_mips_64(ctx);
gen_shift_imm(env, ctx, op1, rd, rt, sa);
break;
default:
generate_exception(ctx, EXCP_RI);
break;
}
break;
case OPC_DADD ... OPC_DSUBU:
check_insn(env, ctx, ISA_MIPS3);
check_mips_64(ctx);
gen_arith(env, ctx, op1, rd, rs, rt);
break;
case OPC_DSLLV:
case OPC_DSRAV:
check_insn(env, ctx, ISA_MIPS3);
check_mips_64(ctx);
gen_shift(env, ctx, op1, rd, rs, rt);
break;
case OPC_DSRLV:
switch ((ctx->opcode >> 6) & 0x1f) {
case 1:
if (env->insn_flags & ISA_MIPS32R2) {
op1 = OPC_DROTRV;
}
case 0:
check_insn(env, ctx, ISA_MIPS3);
check_mips_64(ctx);
gen_shift(env, ctx, op1, rd, rs, rt);
break;
default:
generate_exception(ctx, EXCP_RI);
break;
}
break;
case OPC_DMULT ... OPC_DDIVU:
check_insn(env, ctx, ISA_MIPS3);
check_mips_64(ctx);
gen_muldiv(ctx, op1, rs, rt);
break;
#endif
default:
MIPS_INVAL("special");
generate_exception(ctx, EXCP_RI);
break;
}
break;
case OPC_SPECIAL2:
op1 = MASK_SPECIAL2(ctx->opcode);
switch (op1) {
case OPC_MADD ... OPC_MADDU:
case OPC_MSUB ... OPC_MSUBU:
check_insn(env, ctx, ISA_MIPS32);
gen_muldiv(ctx, op1, rs, rt);
break;
case OPC_MUL:
gen_arith(env, ctx, op1, rd, rs, rt);
break;
case OPC_CLO:
case OPC_CLZ:
check_insn(env, ctx, ISA_MIPS32);
gen_cl(ctx, op1, rd, rs);
break;
case OPC_SDBBP:
check_insn(env, ctx, ISA_MIPS32);
if (!(ctx->hflags & MIPS_HFLAG_DM)) {
generate_exception(ctx, EXCP_DBp);
} else {
generate_exception(ctx, EXCP_DBp);
}
break;
case OPC_DIV_G_2F:
case OPC_DIVU_G_2F:
case OPC_MULT_G_2F:
case OPC_MULTU_G_2F:
case OPC_MOD_G_2F:
case OPC_MODU_G_2F:
check_insn(env, ctx, INSN_LOONGSON2F);
gen_loongson_integer(ctx, op1, rd, rs, rt);
break;
#if defined(TARGET_MIPS64)
case OPC_DCLO:
case OPC_DCLZ:
check_insn(env, ctx, ISA_MIPS64);
check_mips_64(ctx);
gen_cl(ctx, op1, rd, rs);
break;
case OPC_DMULT_G_2F:
case OPC_DMULTU_G_2F:
case OPC_DDIV_G_2F:
case OPC_DDIVU_G_2F:
case OPC_DMOD_G_2F:
case OPC_DMODU_G_2F:
check_insn(env, ctx, INSN_LOONGSON2F);
gen_loongson_integer(ctx, op1, rd, rs, rt);
break;
#endif
default:
MIPS_INVAL("special2");
generate_exception(ctx, EXCP_RI);
break;
}
break;
case OPC_SPECIAL3:
op1 = MASK_SPECIAL3(ctx->opcode);
switch (op1) {
case OPC_EXT:
case OPC_INS:
check_insn(env, ctx, ISA_MIPS32R2);
gen_bitops(ctx, op1, rt, rs, sa, rd);
break;
case OPC_BSHFL:
check_insn(env, ctx, ISA_MIPS32R2);
op2 = MASK_BSHFL(ctx->opcode);
gen_bshfl(ctx, op2, rt, rd);
break;
case OPC_RDHWR:
gen_rdhwr(env, ctx, rt, rd);
break;
case OPC_FORK:
check_insn(env, ctx, ASE_MT);
{
TCGv t0 = tcg_temp_new();
TCGv t1 = tcg_temp_new();
gen_load_gpr(t0, rt);
gen_load_gpr(t1, rs);
gen_helper_fork(t0, t1);
tcg_temp_free(t0);
tcg_temp_free(t1);
}
break;
case OPC_YIELD:
check_insn(env, ctx, ASE_MT);
{
TCGv t0 = tcg_temp_new();
save_cpu_state(ctx, 1);
gen_load_gpr(t0, rs);
gen_helper_yield(t0, t0);
gen_store_gpr(t0, rd);
tcg_temp_free(t0);
}
break;
case OPC_DIV_G_2E ... OPC_DIVU_G_2E:
case OPC_MULT_G_2E ... OPC_MULTU_G_2E:
case OPC_MOD_G_2E ... OPC_MODU_G_2E:
check_insn(env, ctx, INSN_LOONGSON2E);
gen_loongson_integer(ctx, op1, rd, rs, rt);
break;
#if defined(TARGET_MIPS64)
case OPC_DEXTM ... OPC_DEXT:
case OPC_DINSM ... OPC_DINS:
check_insn(env, ctx, ISA_MIPS64R2);
check_mips_64(ctx);
gen_bitops(ctx, op1, rt, rs, sa, rd);
break;
case OPC_DBSHFL:
check_insn(env, ctx, ISA_MIPS64R2);
check_mips_64(ctx);
op2 = MASK_DBSHFL(ctx->opcode);
gen_bshfl(ctx, op2, rt, rd);
break;
case OPC_DDIV_G_2E ... OPC_DDIVU_G_2E:
case OPC_DMULT_G_2E ... OPC_DMULTU_G_2E:
case OPC_DMOD_G_2E ... OPC_DMODU_G_2E:
check_insn(env, ctx, INSN_LOONGSON2E);
gen_loongson_integer(ctx, op1, rd, rs, rt);
break;
#endif
default:
MIPS_INVAL("special3");
generate_exception(ctx, EXCP_RI);
break;
}
break;
case OPC_REGIMM:
op1 = MASK_REGIMM(ctx->opcode);
switch (op1) {
case OPC_BLTZ ... OPC_BGEZL:
case OPC_BLTZAL ... OPC_BGEZALL:
gen_compute_branch(ctx, op1, 4, rs, -1, imm << 2);
*is_branch = 1;
break;
case OPC_TGEI ... OPC_TEQI:
case OPC_TNEI:
gen_trap(ctx, op1, rs, -1, imm);
break;
case OPC_SYNCI:
check_insn(env, ctx, ISA_MIPS32R2);
break;
default:
MIPS_INVAL("regimm");
generate_exception(ctx, EXCP_RI);
break;
}
break;
case OPC_CP0:
check_cp0_enabled(ctx);
op1 = MASK_CP0(ctx->opcode);
switch (op1) {
case OPC_MFC0:
case OPC_MTC0:
case OPC_MFTR:
case OPC_MTTR:
#if defined(TARGET_MIPS64)
case OPC_DMFC0:
case OPC_DMTC0:
#endif
#ifndef CONFIG_USER_ONLY
gen_cp0(env, ctx, op1, rt, rd);
#endif
break;
case OPC_C0_FIRST ... OPC_C0_LAST:
#ifndef CONFIG_USER_ONLY
gen_cp0(env, ctx, MASK_C0(ctx->opcode), rt, rd);
#endif
break;
case OPC_MFMC0:
#ifndef CONFIG_USER_ONLY
{
TCGv t0 = tcg_temp_new();
op2 = MASK_MFMC0(ctx->opcode);
switch (op2) {
case OPC_DMT:
check_insn(env, ctx, ASE_MT);
gen_helper_dmt(t0, t0);
gen_store_gpr(t0, rt);
break;
case OPC_EMT:
check_insn(env, ctx, ASE_MT);
gen_helper_emt(t0, t0);
gen_store_gpr(t0, rt);
break;
case OPC_DVPE:
check_insn(env, ctx, ASE_MT);
gen_helper_dvpe(t0, t0);
gen_store_gpr(t0, rt);
break;
case OPC_EVPE:
check_insn(env, ctx, ASE_MT);
gen_helper_evpe(t0, t0);
gen_store_gpr(t0, rt);
break;
case OPC_DI:
check_insn(env, ctx, ISA_MIPS32R2);
save_cpu_state(ctx, 1);
gen_helper_di(t0);
gen_store_gpr(t0, rt);
ctx->bstate = BS_STOP;
break;
case OPC_EI:
check_insn(env, ctx, ISA_MIPS32R2);
save_cpu_state(ctx, 1);
gen_helper_ei(t0);
gen_store_gpr(t0, rt);
ctx->bstate = BS_STOP;
break;
default:
MIPS_INVAL("mfmc0");
generate_exception(ctx, EXCP_RI);
break;
}
tcg_temp_free(t0);
}
#endif
break;
case OPC_RDPGPR:
check_insn(env, ctx, ISA_MIPS32R2);
gen_load_srsgpr(rt, rd);
break;
case OPC_WRPGPR:
check_insn(env, ctx, ISA_MIPS32R2);
gen_store_srsgpr(rt, rd);
break;
default:
MIPS_INVAL("cp0");
generate_exception(ctx, EXCP_RI);
break;
}
break;
case OPC_ADDI:
case OPC_ADDIU:
gen_arith_imm(env, ctx, op, rt, rs, imm);
break;
case OPC_SLTI:
case OPC_SLTIU:
gen_slt_imm(env, op, rt, rs, imm);
break;
case OPC_ANDI:
case OPC_LUI:
case OPC_ORI:
case OPC_XORI:
gen_logic_imm(env, op, rt, rs, imm);
break;
case OPC_J ... OPC_JAL:
offset = (int32_t)(ctx->opcode & 0x3FFFFFF) << 2;
gen_compute_branch(ctx, op, 4, rs, rt, offset);
*is_branch = 1;
break;
case OPC_BEQ ... OPC_BGTZ:
case OPC_BEQL ... OPC_BGTZL:
gen_compute_branch(ctx, op, 4, rs, rt, imm << 2);
*is_branch = 1;
break;
case OPC_LB ... OPC_LWR:
case OPC_LL:
gen_ld(env, ctx, op, rt, rs, imm);
break;
case OPC_SB ... OPC_SW:
case OPC_SWR:
gen_st(ctx, op, rt, rs, imm);
break;
case OPC_SC:
gen_st_cond(ctx, op, rt, rs, imm);
break;
case OPC_CACHE:
check_insn(env, ctx, ISA_MIPS3 | ISA_MIPS32);
break;
case OPC_PREF:
check_insn(env, ctx, ISA_MIPS4 | ISA_MIPS32);
break;
case OPC_LWC1:
case OPC_LDC1:
case OPC_SWC1:
case OPC_SDC1:
gen_cop1_ldst(env, ctx, op, rt, rs, imm);
break;
case OPC_CP1:
if (env->CP0_Config1 & (1 << CP0C1_FP)) {
check_cp1_enabled(ctx);
op1 = MASK_CP1(ctx->opcode);
switch (op1) {
case OPC_MFHC1:
case OPC_MTHC1:
check_insn(env, ctx, ISA_MIPS32R2);
case OPC_MFC1:
case OPC_CFC1:
case OPC_MTC1:
case OPC_CTC1:
gen_cp1(ctx, op1, rt, rd);
break;
#if defined(TARGET_MIPS64)
case OPC_DMFC1:
case OPC_DMTC1:
check_insn(env, ctx, ISA_MIPS3);
gen_cp1(ctx, op1, rt, rd);
break;
#endif
case OPC_BC1ANY2:
case OPC_BC1ANY4:
check_cop1x(ctx);
check_insn(env, ctx, ASE_MIPS3D);
case OPC_BC1:
gen_compute_branch1(env, ctx, MASK_BC1(ctx->opcode),
(rt >> 2) & 0x7, imm << 2);
*is_branch = 1;
break;
case OPC_S_FMT:
case OPC_D_FMT:
case OPC_W_FMT:
case OPC_L_FMT:
case OPC_PS_FMT:
gen_farith(ctx, ctx->opcode & FOP(0x3f, 0x1f), rt, rd, sa,
(imm >> 8) & 0x7);
break;
default:
MIPS_INVAL("cp1");
generate_exception (ctx, EXCP_RI);
break;
}
} else {
generate_exception_err(ctx, EXCP_CpU, 1);
}
break;
case OPC_LWC2:
case OPC_LDC2:
case OPC_SWC2:
case OPC_SDC2:
case OPC_CP2:
generate_exception_err(ctx, EXCP_CpU, 2);
break;
case OPC_CP3:
if (env->CP0_Config1 & (1 << CP0C1_FP)) {
check_cp1_enabled(ctx);
op1 = MASK_CP3(ctx->opcode);
switch (op1) {
case OPC_LWXC1:
case OPC_LDXC1:
case OPC_LUXC1:
case OPC_SWXC1:
case OPC_SDXC1:
case OPC_SUXC1:
gen_flt3_ldst(ctx, op1, sa, rd, rs, rt);
break;
case OPC_PREFX:
break;
case OPC_ALNV_PS:
case OPC_MADD_S:
case OPC_MADD_D:
case OPC_MADD_PS:
case OPC_MSUB_S:
case OPC_MSUB_D:
case OPC_MSUB_PS:
case OPC_NMADD_S:
case OPC_NMADD_D:
case OPC_NMADD_PS:
case OPC_NMSUB_S:
case OPC_NMSUB_D:
case OPC_NMSUB_PS:
gen_flt3_arith(ctx, op1, sa, rs, rd, rt);
break;
default:
MIPS_INVAL("cp3");
generate_exception (ctx, EXCP_RI);
break;
}
} else {
generate_exception_err(ctx, EXCP_CpU, 1);
}
break;
#if defined(TARGET_MIPS64)
case OPC_LWU:
case OPC_LDL ... OPC_LDR:
case OPC_LLD:
case OPC_LD:
check_insn(env, ctx, ISA_MIPS3);
check_mips_64(ctx);
gen_ld(env, ctx, op, rt, rs, imm);
break;
case OPC_SDL ... OPC_SDR:
case OPC_SD:
check_insn(env, ctx, ISA_MIPS3);
check_mips_64(ctx);
gen_st(ctx, op, rt, rs, imm);
break;
case OPC_SCD:
check_insn(env, ctx, ISA_MIPS3);
check_mips_64(ctx);
gen_st_cond(ctx, op, rt, rs, imm);
break;
case OPC_DADDI:
case OPC_DADDIU:
check_insn(env, ctx, ISA_MIPS3);
check_mips_64(ctx);
gen_arith_imm(env, ctx, op, rt, rs, imm);
break;
#endif
case OPC_JALX:
check_insn(env, ctx, ASE_MIPS16 | ASE_MICROMIPS);
offset = (int32_t)(ctx->opcode & 0x3FFFFFF) << 2;
gen_compute_branch(ctx, op, 4, rs, rt, offset);
*is_branch = 1;
break;
case OPC_MDMX:
check_insn(env, ctx, ASE_MDMX);
default:
MIPS_INVAL("major opcode");
generate_exception(ctx, EXCP_RI);
break;
}
}
|
{
"code": [
" gen_helper_dmt(t0, t0);",
" gen_helper_emt(t0, t0);",
" gen_helper_dvpe(t0, t0);",
" gen_helper_evpe(t0, t0);"
],
"line_no": [
867,
877,
887,
897
]
}
|
static void FUNC_0 (CPUState *VAR_0, DisasContext *VAR_1, int *VAR_2)
{
int32_t offset;
int VAR_3, VAR_4, VAR_5, VAR_6;
uint32_t op, op1, op2;
int16_t imm;
if (VAR_1->pc & 0x3) {
VAR_0->CP0_BadVAddr = VAR_1->pc;
generate_exception(VAR_1, EXCP_AdEL);
return;
}
if ((VAR_1->hflags & MIPS_HFLAG_BMASK_BASE) == MIPS_HFLAG_BL) {
int VAR_7 = gen_new_label();
MIPS_DEBUG("blikely condition (" TARGET_FMT_lx ")", VAR_1->pc + 4);
tcg_gen_brcondi_tl(TCG_COND_NE, bcond, 0, VAR_7);
tcg_gen_movi_i32(hflags, VAR_1->hflags & ~MIPS_HFLAG_BMASK);
gen_goto_tb(VAR_1, 1, VAR_1->pc + 4);
gen_set_label(VAR_7);
}
if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP)))
tcg_gen_debug_insn_start(VAR_1->pc);
op = MASK_OP_MAJOR(VAR_1->opcode);
VAR_3 = (VAR_1->opcode >> 21) & 0x1f;
VAR_4 = (VAR_1->opcode >> 16) & 0x1f;
VAR_5 = (VAR_1->opcode >> 11) & 0x1f;
VAR_6 = (VAR_1->opcode >> 6) & 0x1f;
imm = (int16_t)VAR_1->opcode;
switch (op) {
case OPC_SPECIAL:
op1 = MASK_SPECIAL(VAR_1->opcode);
switch (op1) {
case OPC_SLL:
case OPC_SRA:
gen_shift_imm(VAR_0, VAR_1, op1, VAR_5, VAR_4, VAR_6);
break;
case OPC_SRL:
switch ((VAR_1->opcode >> 21) & 0x1f) {
case 1:
if (VAR_0->insn_flags & ISA_MIPS32R2) {
op1 = OPC_ROTR;
}
case 0:
gen_shift_imm(VAR_0, VAR_1, op1, VAR_5, VAR_4, VAR_6);
break;
default:
generate_exception(VAR_1, EXCP_RI);
break;
}
break;
case OPC_MOVN:
case OPC_MOVZ:
check_insn(VAR_0, VAR_1, ISA_MIPS4 | ISA_MIPS32 |
INSN_LOONGSON2E | INSN_LOONGSON2F);
gen_cond_move(VAR_0, op1, VAR_5, VAR_3, VAR_4);
break;
case OPC_ADD ... OPC_SUBU:
gen_arith(VAR_0, VAR_1, op1, VAR_5, VAR_3, VAR_4);
break;
case OPC_SLLV:
case OPC_SRAV:
gen_shift(VAR_0, VAR_1, op1, VAR_5, VAR_3, VAR_4);
break;
case OPC_SRLV:
switch ((VAR_1->opcode >> 6) & 0x1f) {
case 1:
if (VAR_0->insn_flags & ISA_MIPS32R2) {
op1 = OPC_ROTRV;
}
case 0:
gen_shift(VAR_0, VAR_1, op1, VAR_5, VAR_3, VAR_4);
break;
default:
generate_exception(VAR_1, EXCP_RI);
break;
}
break;
case OPC_SLT:
case OPC_SLTU:
gen_slt(VAR_0, op1, VAR_5, VAR_3, VAR_4);
break;
case OPC_AND:
case OPC_OR:
case OPC_NOR:
case OPC_XOR:
gen_logic(VAR_0, op1, VAR_5, VAR_3, VAR_4);
break;
case OPC_MULT ... OPC_DIVU:
if (VAR_6) {
check_insn(VAR_0, VAR_1, INSN_VR54XX);
op1 = MASK_MUL_VR54XX(VAR_1->opcode);
gen_mul_vr54xx(VAR_1, op1, VAR_5, VAR_3, VAR_4);
} else
gen_muldiv(VAR_1, op1, VAR_3, VAR_4);
break;
case OPC_JR ... OPC_JALR:
gen_compute_branch(VAR_1, op1, 4, VAR_3, VAR_5, VAR_6);
*VAR_2 = 1;
break;
case OPC_TGE ... OPC_TEQ:
case OPC_TNE:
gen_trap(VAR_1, op1, VAR_3, VAR_4, -1);
break;
case OPC_MFHI:
case OPC_MFLO:
gen_HILO(VAR_1, op1, VAR_5);
break;
case OPC_MTHI:
case OPC_MTLO:
gen_HILO(VAR_1, op1, VAR_3);
break;
case OPC_PMON:
#ifdef MIPS_STRICT_STANDARD
MIPS_INVAL("PMON / selsl");
generate_exception(VAR_1, EXCP_RI);
#else
gen_helper_0i(pmon, VAR_6);
#endif
break;
case OPC_SYSCALL:
generate_exception(VAR_1, EXCP_SYSCALL);
VAR_1->bstate = BS_STOP;
break;
case OPC_BREAK:
generate_exception(VAR_1, EXCP_BREAK);
break;
case OPC_SPIM:
#ifdef MIPS_STRICT_STANDARD
MIPS_INVAL("SPIM");
generate_exception(VAR_1, EXCP_RI);
#else
MIPS_INVAL("spim (unofficial)");
generate_exception(VAR_1, EXCP_RI);
#endif
break;
case OPC_SYNC:
break;
case OPC_MOVCI:
check_insn(VAR_0, VAR_1, ISA_MIPS4 | ISA_MIPS32);
if (VAR_0->CP0_Config1 & (1 << CP0C1_FP)) {
check_cp1_enabled(VAR_1);
gen_movci(VAR_1, VAR_5, VAR_3, (VAR_1->opcode >> 18) & 0x7,
(VAR_1->opcode >> 16) & 1);
} else {
generate_exception_err(VAR_1, EXCP_CpU, 1);
}
break;
#if defined(TARGET_MIPS64)
case OPC_DSLL:
case OPC_DSRA:
case OPC_DSLL32:
case OPC_DSRA32:
check_insn(VAR_0, VAR_1, ISA_MIPS3);
check_mips_64(VAR_1);
gen_shift_imm(VAR_0, VAR_1, op1, VAR_5, VAR_4, VAR_6);
break;
case OPC_DSRL:
switch ((VAR_1->opcode >> 21) & 0x1f) {
case 1:
if (VAR_0->insn_flags & ISA_MIPS32R2) {
op1 = OPC_DROTR;
}
case 0:
check_insn(VAR_0, VAR_1, ISA_MIPS3);
check_mips_64(VAR_1);
gen_shift_imm(VAR_0, VAR_1, op1, VAR_5, VAR_4, VAR_6);
break;
default:
generate_exception(VAR_1, EXCP_RI);
break;
}
break;
case OPC_DSRL32:
switch ((VAR_1->opcode >> 21) & 0x1f) {
case 1:
if (VAR_0->insn_flags & ISA_MIPS32R2) {
op1 = OPC_DROTR32;
}
case 0:
check_insn(VAR_0, VAR_1, ISA_MIPS3);
check_mips_64(VAR_1);
gen_shift_imm(VAR_0, VAR_1, op1, VAR_5, VAR_4, VAR_6);
break;
default:
generate_exception(VAR_1, EXCP_RI);
break;
}
break;
case OPC_DADD ... OPC_DSUBU:
check_insn(VAR_0, VAR_1, ISA_MIPS3);
check_mips_64(VAR_1);
gen_arith(VAR_0, VAR_1, op1, VAR_5, VAR_3, VAR_4);
break;
case OPC_DSLLV:
case OPC_DSRAV:
check_insn(VAR_0, VAR_1, ISA_MIPS3);
check_mips_64(VAR_1);
gen_shift(VAR_0, VAR_1, op1, VAR_5, VAR_3, VAR_4);
break;
case OPC_DSRLV:
switch ((VAR_1->opcode >> 6) & 0x1f) {
case 1:
if (VAR_0->insn_flags & ISA_MIPS32R2) {
op1 = OPC_DROTRV;
}
case 0:
check_insn(VAR_0, VAR_1, ISA_MIPS3);
check_mips_64(VAR_1);
gen_shift(VAR_0, VAR_1, op1, VAR_5, VAR_3, VAR_4);
break;
default:
generate_exception(VAR_1, EXCP_RI);
break;
}
break;
case OPC_DMULT ... OPC_DDIVU:
check_insn(VAR_0, VAR_1, ISA_MIPS3);
check_mips_64(VAR_1);
gen_muldiv(VAR_1, op1, VAR_3, VAR_4);
break;
#endif
default:
MIPS_INVAL("special");
generate_exception(VAR_1, EXCP_RI);
break;
}
break;
case OPC_SPECIAL2:
op1 = MASK_SPECIAL2(VAR_1->opcode);
switch (op1) {
case OPC_MADD ... OPC_MADDU:
case OPC_MSUB ... OPC_MSUBU:
check_insn(VAR_0, VAR_1, ISA_MIPS32);
gen_muldiv(VAR_1, op1, VAR_3, VAR_4);
break;
case OPC_MUL:
gen_arith(VAR_0, VAR_1, op1, VAR_5, VAR_3, VAR_4);
break;
case OPC_CLO:
case OPC_CLZ:
check_insn(VAR_0, VAR_1, ISA_MIPS32);
gen_cl(VAR_1, op1, VAR_5, VAR_3);
break;
case OPC_SDBBP:
check_insn(VAR_0, VAR_1, ISA_MIPS32);
if (!(VAR_1->hflags & MIPS_HFLAG_DM)) {
generate_exception(VAR_1, EXCP_DBp);
} else {
generate_exception(VAR_1, EXCP_DBp);
}
break;
case OPC_DIV_G_2F:
case OPC_DIVU_G_2F:
case OPC_MULT_G_2F:
case OPC_MULTU_G_2F:
case OPC_MOD_G_2F:
case OPC_MODU_G_2F:
check_insn(VAR_0, VAR_1, INSN_LOONGSON2F);
gen_loongson_integer(VAR_1, op1, VAR_5, VAR_3, VAR_4);
break;
#if defined(TARGET_MIPS64)
case OPC_DCLO:
case OPC_DCLZ:
check_insn(VAR_0, VAR_1, ISA_MIPS64);
check_mips_64(VAR_1);
gen_cl(VAR_1, op1, VAR_5, VAR_3);
break;
case OPC_DMULT_G_2F:
case OPC_DMULTU_G_2F:
case OPC_DDIV_G_2F:
case OPC_DDIVU_G_2F:
case OPC_DMOD_G_2F:
case OPC_DMODU_G_2F:
check_insn(VAR_0, VAR_1, INSN_LOONGSON2F);
gen_loongson_integer(VAR_1, op1, VAR_5, VAR_3, VAR_4);
break;
#endif
default:
MIPS_INVAL("special2");
generate_exception(VAR_1, EXCP_RI);
break;
}
break;
case OPC_SPECIAL3:
op1 = MASK_SPECIAL3(VAR_1->opcode);
switch (op1) {
case OPC_EXT:
case OPC_INS:
check_insn(VAR_0, VAR_1, ISA_MIPS32R2);
gen_bitops(VAR_1, op1, VAR_4, VAR_3, VAR_6, VAR_5);
break;
case OPC_BSHFL:
check_insn(VAR_0, VAR_1, ISA_MIPS32R2);
op2 = MASK_BSHFL(VAR_1->opcode);
gen_bshfl(VAR_1, op2, VAR_4, VAR_5);
break;
case OPC_RDHWR:
gen_rdhwr(VAR_0, VAR_1, VAR_4, VAR_5);
break;
case OPC_FORK:
check_insn(VAR_0, VAR_1, ASE_MT);
{
TCGv t0 = tcg_temp_new();
TCGv t1 = tcg_temp_new();
gen_load_gpr(t0, VAR_4);
gen_load_gpr(t1, VAR_3);
gen_helper_fork(t0, t1);
tcg_temp_free(t0);
tcg_temp_free(t1);
}
break;
case OPC_YIELD:
check_insn(VAR_0, VAR_1, ASE_MT);
{
TCGv t0 = tcg_temp_new();
save_cpu_state(VAR_1, 1);
gen_load_gpr(t0, VAR_3);
gen_helper_yield(t0, t0);
gen_store_gpr(t0, VAR_5);
tcg_temp_free(t0);
}
break;
case OPC_DIV_G_2E ... OPC_DIVU_G_2E:
case OPC_MULT_G_2E ... OPC_MULTU_G_2E:
case OPC_MOD_G_2E ... OPC_MODU_G_2E:
check_insn(VAR_0, VAR_1, INSN_LOONGSON2E);
gen_loongson_integer(VAR_1, op1, VAR_5, VAR_3, VAR_4);
break;
#if defined(TARGET_MIPS64)
case OPC_DEXTM ... OPC_DEXT:
case OPC_DINSM ... OPC_DINS:
check_insn(VAR_0, VAR_1, ISA_MIPS64R2);
check_mips_64(VAR_1);
gen_bitops(VAR_1, op1, VAR_4, VAR_3, VAR_6, VAR_5);
break;
case OPC_DBSHFL:
check_insn(VAR_0, VAR_1, ISA_MIPS64R2);
check_mips_64(VAR_1);
op2 = MASK_DBSHFL(VAR_1->opcode);
gen_bshfl(VAR_1, op2, VAR_4, VAR_5);
break;
case OPC_DDIV_G_2E ... OPC_DDIVU_G_2E:
case OPC_DMULT_G_2E ... OPC_DMULTU_G_2E:
case OPC_DMOD_G_2E ... OPC_DMODU_G_2E:
check_insn(VAR_0, VAR_1, INSN_LOONGSON2E);
gen_loongson_integer(VAR_1, op1, VAR_5, VAR_3, VAR_4);
break;
#endif
default:
MIPS_INVAL("special3");
generate_exception(VAR_1, EXCP_RI);
break;
}
break;
case OPC_REGIMM:
op1 = MASK_REGIMM(VAR_1->opcode);
switch (op1) {
case OPC_BLTZ ... OPC_BGEZL:
case OPC_BLTZAL ... OPC_BGEZALL:
gen_compute_branch(VAR_1, op1, 4, VAR_3, -1, imm << 2);
*VAR_2 = 1;
break;
case OPC_TGEI ... OPC_TEQI:
case OPC_TNEI:
gen_trap(VAR_1, op1, VAR_3, -1, imm);
break;
case OPC_SYNCI:
check_insn(VAR_0, VAR_1, ISA_MIPS32R2);
break;
default:
MIPS_INVAL("regimm");
generate_exception(VAR_1, EXCP_RI);
break;
}
break;
case OPC_CP0:
check_cp0_enabled(VAR_1);
op1 = MASK_CP0(VAR_1->opcode);
switch (op1) {
case OPC_MFC0:
case OPC_MTC0:
case OPC_MFTR:
case OPC_MTTR:
#if defined(TARGET_MIPS64)
case OPC_DMFC0:
case OPC_DMTC0:
#endif
#ifndef CONFIG_USER_ONLY
gen_cp0(VAR_0, VAR_1, op1, VAR_4, VAR_5);
#endif
break;
case OPC_C0_FIRST ... OPC_C0_LAST:
#ifndef CONFIG_USER_ONLY
gen_cp0(VAR_0, VAR_1, MASK_C0(VAR_1->opcode), VAR_4, VAR_5);
#endif
break;
case OPC_MFMC0:
#ifndef CONFIG_USER_ONLY
{
TCGv t0 = tcg_temp_new();
op2 = MASK_MFMC0(VAR_1->opcode);
switch (op2) {
case OPC_DMT:
check_insn(VAR_0, VAR_1, ASE_MT);
gen_helper_dmt(t0, t0);
gen_store_gpr(t0, VAR_4);
break;
case OPC_EMT:
check_insn(VAR_0, VAR_1, ASE_MT);
gen_helper_emt(t0, t0);
gen_store_gpr(t0, VAR_4);
break;
case OPC_DVPE:
check_insn(VAR_0, VAR_1, ASE_MT);
gen_helper_dvpe(t0, t0);
gen_store_gpr(t0, VAR_4);
break;
case OPC_EVPE:
check_insn(VAR_0, VAR_1, ASE_MT);
gen_helper_evpe(t0, t0);
gen_store_gpr(t0, VAR_4);
break;
case OPC_DI:
check_insn(VAR_0, VAR_1, ISA_MIPS32R2);
save_cpu_state(VAR_1, 1);
gen_helper_di(t0);
gen_store_gpr(t0, VAR_4);
VAR_1->bstate = BS_STOP;
break;
case OPC_EI:
check_insn(VAR_0, VAR_1, ISA_MIPS32R2);
save_cpu_state(VAR_1, 1);
gen_helper_ei(t0);
gen_store_gpr(t0, VAR_4);
VAR_1->bstate = BS_STOP;
break;
default:
MIPS_INVAL("mfmc0");
generate_exception(VAR_1, EXCP_RI);
break;
}
tcg_temp_free(t0);
}
#endif
break;
case OPC_RDPGPR:
check_insn(VAR_0, VAR_1, ISA_MIPS32R2);
gen_load_srsgpr(VAR_4, VAR_5);
break;
case OPC_WRPGPR:
check_insn(VAR_0, VAR_1, ISA_MIPS32R2);
gen_store_srsgpr(VAR_4, VAR_5);
break;
default:
MIPS_INVAL("cp0");
generate_exception(VAR_1, EXCP_RI);
break;
}
break;
case OPC_ADDI:
case OPC_ADDIU:
gen_arith_imm(VAR_0, VAR_1, op, VAR_4, VAR_3, imm);
break;
case OPC_SLTI:
case OPC_SLTIU:
gen_slt_imm(VAR_0, op, VAR_4, VAR_3, imm);
break;
case OPC_ANDI:
case OPC_LUI:
case OPC_ORI:
case OPC_XORI:
gen_logic_imm(VAR_0, op, VAR_4, VAR_3, imm);
break;
case OPC_J ... OPC_JAL:
offset = (int32_t)(VAR_1->opcode & 0x3FFFFFF) << 2;
gen_compute_branch(VAR_1, op, 4, VAR_3, VAR_4, offset);
*VAR_2 = 1;
break;
case OPC_BEQ ... OPC_BGTZ:
case OPC_BEQL ... OPC_BGTZL:
gen_compute_branch(VAR_1, op, 4, VAR_3, VAR_4, imm << 2);
*VAR_2 = 1;
break;
case OPC_LB ... OPC_LWR:
case OPC_LL:
gen_ld(VAR_0, VAR_1, op, VAR_4, VAR_3, imm);
break;
case OPC_SB ... OPC_SW:
case OPC_SWR:
gen_st(VAR_1, op, VAR_4, VAR_3, imm);
break;
case OPC_SC:
gen_st_cond(VAR_1, op, VAR_4, VAR_3, imm);
break;
case OPC_CACHE:
check_insn(VAR_0, VAR_1, ISA_MIPS3 | ISA_MIPS32);
break;
case OPC_PREF:
check_insn(VAR_0, VAR_1, ISA_MIPS4 | ISA_MIPS32);
break;
case OPC_LWC1:
case OPC_LDC1:
case OPC_SWC1:
case OPC_SDC1:
gen_cop1_ldst(VAR_0, VAR_1, op, VAR_4, VAR_3, imm);
break;
case OPC_CP1:
if (VAR_0->CP0_Config1 & (1 << CP0C1_FP)) {
check_cp1_enabled(VAR_1);
op1 = MASK_CP1(VAR_1->opcode);
switch (op1) {
case OPC_MFHC1:
case OPC_MTHC1:
check_insn(VAR_0, VAR_1, ISA_MIPS32R2);
case OPC_MFC1:
case OPC_CFC1:
case OPC_MTC1:
case OPC_CTC1:
gen_cp1(VAR_1, op1, VAR_4, VAR_5);
break;
#if defined(TARGET_MIPS64)
case OPC_DMFC1:
case OPC_DMTC1:
check_insn(VAR_0, VAR_1, ISA_MIPS3);
gen_cp1(VAR_1, op1, VAR_4, VAR_5);
break;
#endif
case OPC_BC1ANY2:
case OPC_BC1ANY4:
check_cop1x(VAR_1);
check_insn(VAR_0, VAR_1, ASE_MIPS3D);
case OPC_BC1:
gen_compute_branch1(VAR_0, VAR_1, MASK_BC1(VAR_1->opcode),
(VAR_4 >> 2) & 0x7, imm << 2);
*VAR_2 = 1;
break;
case OPC_S_FMT:
case OPC_D_FMT:
case OPC_W_FMT:
case OPC_L_FMT:
case OPC_PS_FMT:
gen_farith(VAR_1, VAR_1->opcode & FOP(0x3f, 0x1f), VAR_4, VAR_5, VAR_6,
(imm >> 8) & 0x7);
break;
default:
MIPS_INVAL("cp1");
generate_exception (VAR_1, EXCP_RI);
break;
}
} else {
generate_exception_err(VAR_1, EXCP_CpU, 1);
}
break;
case OPC_LWC2:
case OPC_LDC2:
case OPC_SWC2:
case OPC_SDC2:
case OPC_CP2:
generate_exception_err(VAR_1, EXCP_CpU, 2);
break;
case OPC_CP3:
if (VAR_0->CP0_Config1 & (1 << CP0C1_FP)) {
check_cp1_enabled(VAR_1);
op1 = MASK_CP3(VAR_1->opcode);
switch (op1) {
case OPC_LWXC1:
case OPC_LDXC1:
case OPC_LUXC1:
case OPC_SWXC1:
case OPC_SDXC1:
case OPC_SUXC1:
gen_flt3_ldst(VAR_1, op1, VAR_6, VAR_5, VAR_3, VAR_4);
break;
case OPC_PREFX:
break;
case OPC_ALNV_PS:
case OPC_MADD_S:
case OPC_MADD_D:
case OPC_MADD_PS:
case OPC_MSUB_S:
case OPC_MSUB_D:
case OPC_MSUB_PS:
case OPC_NMADD_S:
case OPC_NMADD_D:
case OPC_NMADD_PS:
case OPC_NMSUB_S:
case OPC_NMSUB_D:
case OPC_NMSUB_PS:
gen_flt3_arith(VAR_1, op1, VAR_6, VAR_3, VAR_5, VAR_4);
break;
default:
MIPS_INVAL("cp3");
generate_exception (VAR_1, EXCP_RI);
break;
}
} else {
generate_exception_err(VAR_1, EXCP_CpU, 1);
}
break;
#if defined(TARGET_MIPS64)
case OPC_LWU:
case OPC_LDL ... OPC_LDR:
case OPC_LLD:
case OPC_LD:
check_insn(VAR_0, VAR_1, ISA_MIPS3);
check_mips_64(VAR_1);
gen_ld(VAR_0, VAR_1, op, VAR_4, VAR_3, imm);
break;
case OPC_SDL ... OPC_SDR:
case OPC_SD:
check_insn(VAR_0, VAR_1, ISA_MIPS3);
check_mips_64(VAR_1);
gen_st(VAR_1, op, VAR_4, VAR_3, imm);
break;
case OPC_SCD:
check_insn(VAR_0, VAR_1, ISA_MIPS3);
check_mips_64(VAR_1);
gen_st_cond(VAR_1, op, VAR_4, VAR_3, imm);
break;
case OPC_DADDI:
case OPC_DADDIU:
check_insn(VAR_0, VAR_1, ISA_MIPS3);
check_mips_64(VAR_1);
gen_arith_imm(VAR_0, VAR_1, op, VAR_4, VAR_3, imm);
break;
#endif
case OPC_JALX:
check_insn(VAR_0, VAR_1, ASE_MIPS16 | ASE_MICROMIPS);
offset = (int32_t)(VAR_1->opcode & 0x3FFFFFF) << 2;
gen_compute_branch(VAR_1, op, 4, VAR_3, VAR_4, offset);
*VAR_2 = 1;
break;
case OPC_MDMX:
check_insn(VAR_0, VAR_1, ASE_MDMX);
default:
MIPS_INVAL("major opcode");
generate_exception(VAR_1, EXCP_RI);
break;
}
}
|
[
"static void FUNC_0 (CPUState *VAR_0, DisasContext *VAR_1, int *VAR_2)\n{",
"int32_t offset;",
"int VAR_3, VAR_4, VAR_5, VAR_6;",
"uint32_t op, op1, op2;",
"int16_t imm;",
"if (VAR_1->pc & 0x3) {",
"VAR_0->CP0_BadVAddr = VAR_1->pc;",
"generate_exception(VAR_1, EXCP_AdEL);",
"return;",
"}",
"if ((VAR_1->hflags & MIPS_HFLAG_BMASK_BASE) == MIPS_HFLAG_BL) {",
"int VAR_7 = gen_new_label();",
"MIPS_DEBUG(\"blikely condition (\" TARGET_FMT_lx \")\", VAR_1->pc + 4);",
"tcg_gen_brcondi_tl(TCG_COND_NE, bcond, 0, VAR_7);",
"tcg_gen_movi_i32(hflags, VAR_1->hflags & ~MIPS_HFLAG_BMASK);",
"gen_goto_tb(VAR_1, 1, VAR_1->pc + 4);",
"gen_set_label(VAR_7);",
"}",
"if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP)))\ntcg_gen_debug_insn_start(VAR_1->pc);",
"op = MASK_OP_MAJOR(VAR_1->opcode);",
"VAR_3 = (VAR_1->opcode >> 21) & 0x1f;",
"VAR_4 = (VAR_1->opcode >> 16) & 0x1f;",
"VAR_5 = (VAR_1->opcode >> 11) & 0x1f;",
"VAR_6 = (VAR_1->opcode >> 6) & 0x1f;",
"imm = (int16_t)VAR_1->opcode;",
"switch (op) {",
"case OPC_SPECIAL:\nop1 = MASK_SPECIAL(VAR_1->opcode);",
"switch (op1) {",
"case OPC_SLL:\ncase OPC_SRA:\ngen_shift_imm(VAR_0, VAR_1, op1, VAR_5, VAR_4, VAR_6);",
"break;",
"case OPC_SRL:\nswitch ((VAR_1->opcode >> 21) & 0x1f) {",
"case 1:\nif (VAR_0->insn_flags & ISA_MIPS32R2) {",
"op1 = OPC_ROTR;",
"}",
"case 0:\ngen_shift_imm(VAR_0, VAR_1, op1, VAR_5, VAR_4, VAR_6);",
"break;",
"default:\ngenerate_exception(VAR_1, EXCP_RI);",
"break;",
"}",
"break;",
"case OPC_MOVN:\ncase OPC_MOVZ:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS4 | ISA_MIPS32 |\nINSN_LOONGSON2E | INSN_LOONGSON2F);",
"gen_cond_move(VAR_0, op1, VAR_5, VAR_3, VAR_4);",
"break;",
"case OPC_ADD ... OPC_SUBU:\ngen_arith(VAR_0, VAR_1, op1, VAR_5, VAR_3, VAR_4);",
"break;",
"case OPC_SLLV:\ncase OPC_SRAV:\ngen_shift(VAR_0, VAR_1, op1, VAR_5, VAR_3, VAR_4);",
"break;",
"case OPC_SRLV:\nswitch ((VAR_1->opcode >> 6) & 0x1f) {",
"case 1:\nif (VAR_0->insn_flags & ISA_MIPS32R2) {",
"op1 = OPC_ROTRV;",
"}",
"case 0:\ngen_shift(VAR_0, VAR_1, op1, VAR_5, VAR_3, VAR_4);",
"break;",
"default:\ngenerate_exception(VAR_1, EXCP_RI);",
"break;",
"}",
"break;",
"case OPC_SLT:\ncase OPC_SLTU:\ngen_slt(VAR_0, op1, VAR_5, VAR_3, VAR_4);",
"break;",
"case OPC_AND:\ncase OPC_OR:\ncase OPC_NOR:\ncase OPC_XOR:\ngen_logic(VAR_0, op1, VAR_5, VAR_3, VAR_4);",
"break;",
"case OPC_MULT ... OPC_DIVU:\nif (VAR_6) {",
"check_insn(VAR_0, VAR_1, INSN_VR54XX);",
"op1 = MASK_MUL_VR54XX(VAR_1->opcode);",
"gen_mul_vr54xx(VAR_1, op1, VAR_5, VAR_3, VAR_4);",
"} else",
"gen_muldiv(VAR_1, op1, VAR_3, VAR_4);",
"break;",
"case OPC_JR ... OPC_JALR:\ngen_compute_branch(VAR_1, op1, 4, VAR_3, VAR_5, VAR_6);",
"*VAR_2 = 1;",
"break;",
"case OPC_TGE ... OPC_TEQ:\ncase OPC_TNE:\ngen_trap(VAR_1, op1, VAR_3, VAR_4, -1);",
"break;",
"case OPC_MFHI:\ncase OPC_MFLO:\ngen_HILO(VAR_1, op1, VAR_5);",
"break;",
"case OPC_MTHI:\ncase OPC_MTLO:\ngen_HILO(VAR_1, op1, VAR_3);",
"break;",
"case OPC_PMON:\n#ifdef MIPS_STRICT_STANDARD\nMIPS_INVAL(\"PMON / selsl\");",
"generate_exception(VAR_1, EXCP_RI);",
"#else\ngen_helper_0i(pmon, VAR_6);",
"#endif\nbreak;",
"case OPC_SYSCALL:\ngenerate_exception(VAR_1, EXCP_SYSCALL);",
"VAR_1->bstate = BS_STOP;",
"break;",
"case OPC_BREAK:\ngenerate_exception(VAR_1, EXCP_BREAK);",
"break;",
"case OPC_SPIM:\n#ifdef MIPS_STRICT_STANDARD\nMIPS_INVAL(\"SPIM\");",
"generate_exception(VAR_1, EXCP_RI);",
"#else\nMIPS_INVAL(\"spim (unofficial)\");",
"generate_exception(VAR_1, EXCP_RI);",
"#endif\nbreak;",
"case OPC_SYNC:\nbreak;",
"case OPC_MOVCI:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS4 | ISA_MIPS32);",
"if (VAR_0->CP0_Config1 & (1 << CP0C1_FP)) {",
"check_cp1_enabled(VAR_1);",
"gen_movci(VAR_1, VAR_5, VAR_3, (VAR_1->opcode >> 18) & 0x7,\n(VAR_1->opcode >> 16) & 1);",
"} else {",
"generate_exception_err(VAR_1, EXCP_CpU, 1);",
"}",
"break;",
"#if defined(TARGET_MIPS64)\ncase OPC_DSLL:\ncase OPC_DSRA:\ncase OPC_DSLL32:\ncase OPC_DSRA32:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS3);",
"check_mips_64(VAR_1);",
"gen_shift_imm(VAR_0, VAR_1, op1, VAR_5, VAR_4, VAR_6);",
"break;",
"case OPC_DSRL:\nswitch ((VAR_1->opcode >> 21) & 0x1f) {",
"case 1:\nif (VAR_0->insn_flags & ISA_MIPS32R2) {",
"op1 = OPC_DROTR;",
"}",
"case 0:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS3);",
"check_mips_64(VAR_1);",
"gen_shift_imm(VAR_0, VAR_1, op1, VAR_5, VAR_4, VAR_6);",
"break;",
"default:\ngenerate_exception(VAR_1, EXCP_RI);",
"break;",
"}",
"break;",
"case OPC_DSRL32:\nswitch ((VAR_1->opcode >> 21) & 0x1f) {",
"case 1:\nif (VAR_0->insn_flags & ISA_MIPS32R2) {",
"op1 = OPC_DROTR32;",
"}",
"case 0:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS3);",
"check_mips_64(VAR_1);",
"gen_shift_imm(VAR_0, VAR_1, op1, VAR_5, VAR_4, VAR_6);",
"break;",
"default:\ngenerate_exception(VAR_1, EXCP_RI);",
"break;",
"}",
"break;",
"case OPC_DADD ... OPC_DSUBU:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS3);",
"check_mips_64(VAR_1);",
"gen_arith(VAR_0, VAR_1, op1, VAR_5, VAR_3, VAR_4);",
"break;",
"case OPC_DSLLV:\ncase OPC_DSRAV:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS3);",
"check_mips_64(VAR_1);",
"gen_shift(VAR_0, VAR_1, op1, VAR_5, VAR_3, VAR_4);",
"break;",
"case OPC_DSRLV:\nswitch ((VAR_1->opcode >> 6) & 0x1f) {",
"case 1:\nif (VAR_0->insn_flags & ISA_MIPS32R2) {",
"op1 = OPC_DROTRV;",
"}",
"case 0:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS3);",
"check_mips_64(VAR_1);",
"gen_shift(VAR_0, VAR_1, op1, VAR_5, VAR_3, VAR_4);",
"break;",
"default:\ngenerate_exception(VAR_1, EXCP_RI);",
"break;",
"}",
"break;",
"case OPC_DMULT ... OPC_DDIVU:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS3);",
"check_mips_64(VAR_1);",
"gen_muldiv(VAR_1, op1, VAR_3, VAR_4);",
"break;",
"#endif\ndefault:\nMIPS_INVAL(\"special\");",
"generate_exception(VAR_1, EXCP_RI);",
"break;",
"}",
"break;",
"case OPC_SPECIAL2:\nop1 = MASK_SPECIAL2(VAR_1->opcode);",
"switch (op1) {",
"case OPC_MADD ... OPC_MADDU:\ncase OPC_MSUB ... OPC_MSUBU:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS32);",
"gen_muldiv(VAR_1, op1, VAR_3, VAR_4);",
"break;",
"case OPC_MUL:\ngen_arith(VAR_0, VAR_1, op1, VAR_5, VAR_3, VAR_4);",
"break;",
"case OPC_CLO:\ncase OPC_CLZ:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS32);",
"gen_cl(VAR_1, op1, VAR_5, VAR_3);",
"break;",
"case OPC_SDBBP:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS32);",
"if (!(VAR_1->hflags & MIPS_HFLAG_DM)) {",
"generate_exception(VAR_1, EXCP_DBp);",
"} else {",
"generate_exception(VAR_1, EXCP_DBp);",
"}",
"break;",
"case OPC_DIV_G_2F:\ncase OPC_DIVU_G_2F:\ncase OPC_MULT_G_2F:\ncase OPC_MULTU_G_2F:\ncase OPC_MOD_G_2F:\ncase OPC_MODU_G_2F:\ncheck_insn(VAR_0, VAR_1, INSN_LOONGSON2F);",
"gen_loongson_integer(VAR_1, op1, VAR_5, VAR_3, VAR_4);",
"break;",
"#if defined(TARGET_MIPS64)\ncase OPC_DCLO:\ncase OPC_DCLZ:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS64);",
"check_mips_64(VAR_1);",
"gen_cl(VAR_1, op1, VAR_5, VAR_3);",
"break;",
"case OPC_DMULT_G_2F:\ncase OPC_DMULTU_G_2F:\ncase OPC_DDIV_G_2F:\ncase OPC_DDIVU_G_2F:\ncase OPC_DMOD_G_2F:\ncase OPC_DMODU_G_2F:\ncheck_insn(VAR_0, VAR_1, INSN_LOONGSON2F);",
"gen_loongson_integer(VAR_1, op1, VAR_5, VAR_3, VAR_4);",
"break;",
"#endif\ndefault:\nMIPS_INVAL(\"special2\");",
"generate_exception(VAR_1, EXCP_RI);",
"break;",
"}",
"break;",
"case OPC_SPECIAL3:\nop1 = MASK_SPECIAL3(VAR_1->opcode);",
"switch (op1) {",
"case OPC_EXT:\ncase OPC_INS:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS32R2);",
"gen_bitops(VAR_1, op1, VAR_4, VAR_3, VAR_6, VAR_5);",
"break;",
"case OPC_BSHFL:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS32R2);",
"op2 = MASK_BSHFL(VAR_1->opcode);",
"gen_bshfl(VAR_1, op2, VAR_4, VAR_5);",
"break;",
"case OPC_RDHWR:\ngen_rdhwr(VAR_0, VAR_1, VAR_4, VAR_5);",
"break;",
"case OPC_FORK:\ncheck_insn(VAR_0, VAR_1, ASE_MT);",
"{",
"TCGv t0 = tcg_temp_new();",
"TCGv t1 = tcg_temp_new();",
"gen_load_gpr(t0, VAR_4);",
"gen_load_gpr(t1, VAR_3);",
"gen_helper_fork(t0, t1);",
"tcg_temp_free(t0);",
"tcg_temp_free(t1);",
"}",
"break;",
"case OPC_YIELD:\ncheck_insn(VAR_0, VAR_1, ASE_MT);",
"{",
"TCGv t0 = tcg_temp_new();",
"save_cpu_state(VAR_1, 1);",
"gen_load_gpr(t0, VAR_3);",
"gen_helper_yield(t0, t0);",
"gen_store_gpr(t0, VAR_5);",
"tcg_temp_free(t0);",
"}",
"break;",
"case OPC_DIV_G_2E ... OPC_DIVU_G_2E:\ncase OPC_MULT_G_2E ... OPC_MULTU_G_2E:\ncase OPC_MOD_G_2E ... OPC_MODU_G_2E:\ncheck_insn(VAR_0, VAR_1, INSN_LOONGSON2E);",
"gen_loongson_integer(VAR_1, op1, VAR_5, VAR_3, VAR_4);",
"break;",
"#if defined(TARGET_MIPS64)\ncase OPC_DEXTM ... OPC_DEXT:\ncase OPC_DINSM ... OPC_DINS:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS64R2);",
"check_mips_64(VAR_1);",
"gen_bitops(VAR_1, op1, VAR_4, VAR_3, VAR_6, VAR_5);",
"break;",
"case OPC_DBSHFL:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS64R2);",
"check_mips_64(VAR_1);",
"op2 = MASK_DBSHFL(VAR_1->opcode);",
"gen_bshfl(VAR_1, op2, VAR_4, VAR_5);",
"break;",
"case OPC_DDIV_G_2E ... OPC_DDIVU_G_2E:\ncase OPC_DMULT_G_2E ... OPC_DMULTU_G_2E:\ncase OPC_DMOD_G_2E ... OPC_DMODU_G_2E:\ncheck_insn(VAR_0, VAR_1, INSN_LOONGSON2E);",
"gen_loongson_integer(VAR_1, op1, VAR_5, VAR_3, VAR_4);",
"break;",
"#endif\ndefault:\nMIPS_INVAL(\"special3\");",
"generate_exception(VAR_1, EXCP_RI);",
"break;",
"}",
"break;",
"case OPC_REGIMM:\nop1 = MASK_REGIMM(VAR_1->opcode);",
"switch (op1) {",
"case OPC_BLTZ ... OPC_BGEZL:\ncase OPC_BLTZAL ... OPC_BGEZALL:\ngen_compute_branch(VAR_1, op1, 4, VAR_3, -1, imm << 2);",
"*VAR_2 = 1;",
"break;",
"case OPC_TGEI ... OPC_TEQI:\ncase OPC_TNEI:\ngen_trap(VAR_1, op1, VAR_3, -1, imm);",
"break;",
"case OPC_SYNCI:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS32R2);",
"break;",
"default:\nMIPS_INVAL(\"regimm\");",
"generate_exception(VAR_1, EXCP_RI);",
"break;",
"}",
"break;",
"case OPC_CP0:\ncheck_cp0_enabled(VAR_1);",
"op1 = MASK_CP0(VAR_1->opcode);",
"switch (op1) {",
"case OPC_MFC0:\ncase OPC_MTC0:\ncase OPC_MFTR:\ncase OPC_MTTR:\n#if defined(TARGET_MIPS64)\ncase OPC_DMFC0:\ncase OPC_DMTC0:\n#endif\n#ifndef CONFIG_USER_ONLY\ngen_cp0(VAR_0, VAR_1, op1, VAR_4, VAR_5);",
"#endif\nbreak;",
"case OPC_C0_FIRST ... OPC_C0_LAST:\n#ifndef CONFIG_USER_ONLY\ngen_cp0(VAR_0, VAR_1, MASK_C0(VAR_1->opcode), VAR_4, VAR_5);",
"#endif\nbreak;",
"case OPC_MFMC0:\n#ifndef CONFIG_USER_ONLY\n{",
"TCGv t0 = tcg_temp_new();",
"op2 = MASK_MFMC0(VAR_1->opcode);",
"switch (op2) {",
"case OPC_DMT:\ncheck_insn(VAR_0, VAR_1, ASE_MT);",
"gen_helper_dmt(t0, t0);",
"gen_store_gpr(t0, VAR_4);",
"break;",
"case OPC_EMT:\ncheck_insn(VAR_0, VAR_1, ASE_MT);",
"gen_helper_emt(t0, t0);",
"gen_store_gpr(t0, VAR_4);",
"break;",
"case OPC_DVPE:\ncheck_insn(VAR_0, VAR_1, ASE_MT);",
"gen_helper_dvpe(t0, t0);",
"gen_store_gpr(t0, VAR_4);",
"break;",
"case OPC_EVPE:\ncheck_insn(VAR_0, VAR_1, ASE_MT);",
"gen_helper_evpe(t0, t0);",
"gen_store_gpr(t0, VAR_4);",
"break;",
"case OPC_DI:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS32R2);",
"save_cpu_state(VAR_1, 1);",
"gen_helper_di(t0);",
"gen_store_gpr(t0, VAR_4);",
"VAR_1->bstate = BS_STOP;",
"break;",
"case OPC_EI:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS32R2);",
"save_cpu_state(VAR_1, 1);",
"gen_helper_ei(t0);",
"gen_store_gpr(t0, VAR_4);",
"VAR_1->bstate = BS_STOP;",
"break;",
"default:\nMIPS_INVAL(\"mfmc0\");",
"generate_exception(VAR_1, EXCP_RI);",
"break;",
"}",
"tcg_temp_free(t0);",
"}",
"#endif\nbreak;",
"case OPC_RDPGPR:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS32R2);",
"gen_load_srsgpr(VAR_4, VAR_5);",
"break;",
"case OPC_WRPGPR:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS32R2);",
"gen_store_srsgpr(VAR_4, VAR_5);",
"break;",
"default:\nMIPS_INVAL(\"cp0\");",
"generate_exception(VAR_1, EXCP_RI);",
"break;",
"}",
"break;",
"case OPC_ADDI:\ncase OPC_ADDIU:\ngen_arith_imm(VAR_0, VAR_1, op, VAR_4, VAR_3, imm);",
"break;",
"case OPC_SLTI:\ncase OPC_SLTIU:\ngen_slt_imm(VAR_0, op, VAR_4, VAR_3, imm);",
"break;",
"case OPC_ANDI:\ncase OPC_LUI:\ncase OPC_ORI:\ncase OPC_XORI:\ngen_logic_imm(VAR_0, op, VAR_4, VAR_3, imm);",
"break;",
"case OPC_J ... OPC_JAL:\noffset = (int32_t)(VAR_1->opcode & 0x3FFFFFF) << 2;",
"gen_compute_branch(VAR_1, op, 4, VAR_3, VAR_4, offset);",
"*VAR_2 = 1;",
"break;",
"case OPC_BEQ ... OPC_BGTZ:\ncase OPC_BEQL ... OPC_BGTZL:\ngen_compute_branch(VAR_1, op, 4, VAR_3, VAR_4, imm << 2);",
"*VAR_2 = 1;",
"break;",
"case OPC_LB ... OPC_LWR:\ncase OPC_LL:\ngen_ld(VAR_0, VAR_1, op, VAR_4, VAR_3, imm);",
"break;",
"case OPC_SB ... OPC_SW:\ncase OPC_SWR:\ngen_st(VAR_1, op, VAR_4, VAR_3, imm);",
"break;",
"case OPC_SC:\ngen_st_cond(VAR_1, op, VAR_4, VAR_3, imm);",
"break;",
"case OPC_CACHE:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS3 | ISA_MIPS32);",
"break;",
"case OPC_PREF:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS4 | ISA_MIPS32);",
"break;",
"case OPC_LWC1:\ncase OPC_LDC1:\ncase OPC_SWC1:\ncase OPC_SDC1:\ngen_cop1_ldst(VAR_0, VAR_1, op, VAR_4, VAR_3, imm);",
"break;",
"case OPC_CP1:\nif (VAR_0->CP0_Config1 & (1 << CP0C1_FP)) {",
"check_cp1_enabled(VAR_1);",
"op1 = MASK_CP1(VAR_1->opcode);",
"switch (op1) {",
"case OPC_MFHC1:\ncase OPC_MTHC1:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS32R2);",
"case OPC_MFC1:\ncase OPC_CFC1:\ncase OPC_MTC1:\ncase OPC_CTC1:\ngen_cp1(VAR_1, op1, VAR_4, VAR_5);",
"break;",
"#if defined(TARGET_MIPS64)\ncase OPC_DMFC1:\ncase OPC_DMTC1:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS3);",
"gen_cp1(VAR_1, op1, VAR_4, VAR_5);",
"break;",
"#endif\ncase OPC_BC1ANY2:\ncase OPC_BC1ANY4:\ncheck_cop1x(VAR_1);",
"check_insn(VAR_0, VAR_1, ASE_MIPS3D);",
"case OPC_BC1:\ngen_compute_branch1(VAR_0, VAR_1, MASK_BC1(VAR_1->opcode),\n(VAR_4 >> 2) & 0x7, imm << 2);",
"*VAR_2 = 1;",
"break;",
"case OPC_S_FMT:\ncase OPC_D_FMT:\ncase OPC_W_FMT:\ncase OPC_L_FMT:\ncase OPC_PS_FMT:\ngen_farith(VAR_1, VAR_1->opcode & FOP(0x3f, 0x1f), VAR_4, VAR_5, VAR_6,\n(imm >> 8) & 0x7);",
"break;",
"default:\nMIPS_INVAL(\"cp1\");",
"generate_exception (VAR_1, EXCP_RI);",
"break;",
"}",
"} else {",
"generate_exception_err(VAR_1, EXCP_CpU, 1);",
"}",
"break;",
"case OPC_LWC2:\ncase OPC_LDC2:\ncase OPC_SWC2:\ncase OPC_SDC2:\ncase OPC_CP2:\ngenerate_exception_err(VAR_1, EXCP_CpU, 2);",
"break;",
"case OPC_CP3:\nif (VAR_0->CP0_Config1 & (1 << CP0C1_FP)) {",
"check_cp1_enabled(VAR_1);",
"op1 = MASK_CP3(VAR_1->opcode);",
"switch (op1) {",
"case OPC_LWXC1:\ncase OPC_LDXC1:\ncase OPC_LUXC1:\ncase OPC_SWXC1:\ncase OPC_SDXC1:\ncase OPC_SUXC1:\ngen_flt3_ldst(VAR_1, op1, VAR_6, VAR_5, VAR_3, VAR_4);",
"break;",
"case OPC_PREFX:\nbreak;",
"case OPC_ALNV_PS:\ncase OPC_MADD_S:\ncase OPC_MADD_D:\ncase OPC_MADD_PS:\ncase OPC_MSUB_S:\ncase OPC_MSUB_D:\ncase OPC_MSUB_PS:\ncase OPC_NMADD_S:\ncase OPC_NMADD_D:\ncase OPC_NMADD_PS:\ncase OPC_NMSUB_S:\ncase OPC_NMSUB_D:\ncase OPC_NMSUB_PS:\ngen_flt3_arith(VAR_1, op1, VAR_6, VAR_3, VAR_5, VAR_4);",
"break;",
"default:\nMIPS_INVAL(\"cp3\");",
"generate_exception (VAR_1, EXCP_RI);",
"break;",
"}",
"} else {",
"generate_exception_err(VAR_1, EXCP_CpU, 1);",
"}",
"break;",
"#if defined(TARGET_MIPS64)\ncase OPC_LWU:\ncase OPC_LDL ... OPC_LDR:\ncase OPC_LLD:\ncase OPC_LD:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS3);",
"check_mips_64(VAR_1);",
"gen_ld(VAR_0, VAR_1, op, VAR_4, VAR_3, imm);",
"break;",
"case OPC_SDL ... OPC_SDR:\ncase OPC_SD:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS3);",
"check_mips_64(VAR_1);",
"gen_st(VAR_1, op, VAR_4, VAR_3, imm);",
"break;",
"case OPC_SCD:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS3);",
"check_mips_64(VAR_1);",
"gen_st_cond(VAR_1, op, VAR_4, VAR_3, imm);",
"break;",
"case OPC_DADDI:\ncase OPC_DADDIU:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS3);",
"check_mips_64(VAR_1);",
"gen_arith_imm(VAR_0, VAR_1, op, VAR_4, VAR_3, imm);",
"break;",
"#endif\ncase OPC_JALX:\ncheck_insn(VAR_0, VAR_1, ASE_MIPS16 | ASE_MICROMIPS);",
"offset = (int32_t)(VAR_1->opcode & 0x3FFFFFF) << 2;",
"gen_compute_branch(VAR_1, op, 4, VAR_3, VAR_4, offset);",
"*VAR_2 = 1;",
"break;",
"case OPC_MDMX:\ncheck_insn(VAR_0, VAR_1, ASE_MDMX);",
"default:\nMIPS_INVAL(\"major opcode\");",
"generate_exception(VAR_1, EXCP_RI);",
"break;",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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,
1,
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
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
31
],
[
33
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
51,
53
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71,
73
],
[
75
],
[
77,
79,
81
],
[
83
],
[
85,
87
],
[
89,
93
],
[
95
],
[
97
],
[
101,
103
],
[
105
],
[
107,
109
],
[
111
],
[
113
],
[
115
],
[
117,
119,
121,
123
],
[
125
],
[
127
],
[
129,
131
],
[
133
],
[
135,
137,
139
],
[
141
],
[
143,
145
],
[
147,
151
],
[
153
],
[
155
],
[
159,
161
],
[
163
],
[
165,
167
],
[
169
],
[
171
],
[
173
],
[
175,
177,
179
],
[
181
],
[
183,
185,
187,
189,
191
],
[
193
],
[
195,
197
],
[
199
],
[
201
],
[
203
],
[
205
],
[
207
],
[
209
],
[
211,
213
],
[
215
],
[
217
],
[
219,
221,
223
],
[
225
],
[
227,
229,
231
],
[
233
],
[
235,
237,
239
],
[
241
],
[
243,
245,
247
],
[
249
],
[
251,
253
],
[
255,
257
],
[
259,
261
],
[
263
],
[
265
],
[
267,
269
],
[
271
],
[
273,
275,
277
],
[
279
],
[
281,
285
],
[
287
],
[
289,
291
],
[
293,
297
],
[
301,
303
],
[
305
],
[
307
],
[
309,
311
],
[
313
],
[
315
],
[
317
],
[
319
],
[
323,
327,
329,
331,
333,
335
],
[
337
],
[
339
],
[
341
],
[
343,
345
],
[
347,
351
],
[
353
],
[
355
],
[
359,
361
],
[
363
],
[
365
],
[
367
],
[
369,
371
],
[
373
],
[
375
],
[
377
],
[
379,
381
],
[
383,
387
],
[
389
],
[
391
],
[
395,
397
],
[
399
],
[
401
],
[
403
],
[
405,
407
],
[
409
],
[
411
],
[
413
],
[
415,
417
],
[
419
],
[
421
],
[
423
],
[
425,
427,
429
],
[
431
],
[
433
],
[
435
],
[
437,
439
],
[
441,
445
],
[
447
],
[
449
],
[
453,
455
],
[
457
],
[
459
],
[
461
],
[
463,
465
],
[
467
],
[
469
],
[
471
],
[
473,
475
],
[
477
],
[
479
],
[
481
],
[
483,
485,
487
],
[
489
],
[
491
],
[
493
],
[
495
],
[
497,
499
],
[
501
],
[
503,
505,
507
],
[
509
],
[
511
],
[
513,
515
],
[
517
],
[
519,
521,
523
],
[
525
],
[
527
],
[
529,
537
],
[
539
],
[
541
],
[
543
],
[
545
],
[
547
],
[
551
],
[
553,
555,
557,
559,
561,
563,
565
],
[
567
],
[
569
],
[
571,
573,
575,
577
],
[
579
],
[
581
],
[
583
],
[
585,
587,
589,
591,
593,
595,
597
],
[
599
],
[
601
],
[
603,
605,
607
],
[
609
],
[
611
],
[
613
],
[
615
],
[
617,
619
],
[
621
],
[
623,
625,
627
],
[
629
],
[
631
],
[
633,
635
],
[
637
],
[
639
],
[
641
],
[
643,
645
],
[
647
],
[
649,
651
],
[
653
],
[
655
],
[
657
],
[
661
],
[
663
],
[
665
],
[
667
],
[
669
],
[
671
],
[
673
],
[
675,
677
],
[
679
],
[
681
],
[
685
],
[
687
],
[
689
],
[
691
],
[
693
],
[
695
],
[
697
],
[
699,
701,
703,
705
],
[
707
],
[
709
],
[
711,
713,
715,
717
],
[
719
],
[
721
],
[
723
],
[
725,
727
],
[
729
],
[
731
],
[
733
],
[
735
],
[
737,
739,
741,
743
],
[
745
],
[
747
],
[
749,
751,
753
],
[
755
],
[
757
],
[
759
],
[
761
],
[
763,
765
],
[
767
],
[
769,
771,
773
],
[
775
],
[
777
],
[
779,
781,
783
],
[
785
],
[
787,
789
],
[
793
],
[
795,
797
],
[
799
],
[
801
],
[
803
],
[
805
],
[
807,
809
],
[
811
],
[
813
],
[
815,
817,
819,
821,
823,
825,
827,
829,
831,
833
],
[
835,
837
],
[
839,
841,
843
],
[
845,
847
],
[
849,
851,
853
],
[
855
],
[
859
],
[
861
],
[
863,
865
],
[
867
],
[
869
],
[
871
],
[
873,
875
],
[
877
],
[
879
],
[
881
],
[
883,
885
],
[
887
],
[
889
],
[
891
],
[
893,
895
],
[
897
],
[
899
],
[
901
],
[
903,
905
],
[
907
],
[
909
],
[
911
],
[
915
],
[
917
],
[
919,
921
],
[
923
],
[
925
],
[
927
],
[
931
],
[
933
],
[
935,
937
],
[
939
],
[
941
],
[
943
],
[
945
],
[
947
],
[
949,
951
],
[
953,
955
],
[
957
],
[
959
],
[
961,
963
],
[
965
],
[
967
],
[
969,
971
],
[
973
],
[
975
],
[
977
],
[
979
],
[
981,
983,
985
],
[
987
],
[
989,
991,
993
],
[
995
],
[
997,
999,
1001,
1003,
1005
],
[
1007
],
[
1009,
1011
],
[
1013
],
[
1015
],
[
1017
],
[
1019,
1021,
1023
],
[
1025
],
[
1027
],
[
1029,
1031,
1033
],
[
1035
],
[
1037,
1039,
1041
],
[
1043
],
[
1045,
1047
],
[
1049
],
[
1051,
1053
],
[
1057
],
[
1059,
1061
],
[
1065
],
[
1071,
1073,
1075,
1077,
1079
],
[
1081
],
[
1085,
1087
],
[
1089
],
[
1091
],
[
1093
],
[
1095,
1097,
1099
],
[
1101,
1103,
1105,
1107,
1109
],
[
1111
],
[
1113,
1115,
1117,
1119
],
[
1121
],
[
1123
],
[
1125,
1127,
1129,
1131
],
[
1133
],
[
1137,
1139,
1141
],
[
1143
],
[
1145
],
[
1147,
1149,
1151,
1153,
1155,
1157,
1159
],
[
1161
],
[
1163,
1165
],
[
1167
],
[
1169
],
[
1171
],
[
1173
],
[
1175
],
[
1177
],
[
1179
],
[
1185,
1187,
1189,
1191,
1193,
1197
],
[
1199
],
[
1203,
1205
],
[
1207
],
[
1209
],
[
1211
],
[
1213,
1215,
1217,
1219,
1221,
1223,
1225
],
[
1227
],
[
1229,
1233
],
[
1235,
1237,
1239,
1241,
1243,
1245,
1247,
1249,
1251,
1253,
1255,
1257,
1259,
1261
],
[
1263
],
[
1265,
1267
],
[
1269
],
[
1271
],
[
1273
],
[
1275
],
[
1277
],
[
1279
],
[
1281
],
[
1285,
1289,
1291,
1293,
1295,
1297
],
[
1299
],
[
1301
],
[
1303
],
[
1305,
1307,
1309
],
[
1311
],
[
1313
],
[
1315
],
[
1317,
1319
],
[
1321
],
[
1323
],
[
1325
],
[
1327,
1329,
1331
],
[
1333
],
[
1335
],
[
1337
],
[
1339,
1341,
1343
],
[
1345
],
[
1347
],
[
1349
],
[
1351
],
[
1353,
1355
],
[
1359,
1361
],
[
1363
],
[
1365
],
[
1367
],
[
1369
]
] |
9,596 |
static void generate_2_noise_channels(MLPDecodeContext *m, unsigned int substr)
{
SubStream *s = &m->substream[substr];
unsigned int i;
uint32_t seed = s->noisegen_seed;
unsigned int maxchan = s->max_matrix_channel;
for (i = 0; i < s->blockpos; i++) {
uint16_t seed_shr7 = seed >> 7;
m->sample_buffer[i][maxchan+1] = ((int8_t)(seed >> 15)) << s->noise_shift;
m->sample_buffer[i][maxchan+2] = ((int8_t) seed_shr7) << s->noise_shift;
seed = (seed << 16) ^ seed_shr7 ^ (seed_shr7 << 5);
}
s->noisegen_seed = seed;
}
| true |
FFmpeg
|
74dc728a2c2cc353da20cdc09b8cdfbbe14b7be8
|
static void generate_2_noise_channels(MLPDecodeContext *m, unsigned int substr)
{
SubStream *s = &m->substream[substr];
unsigned int i;
uint32_t seed = s->noisegen_seed;
unsigned int maxchan = s->max_matrix_channel;
for (i = 0; i < s->blockpos; i++) {
uint16_t seed_shr7 = seed >> 7;
m->sample_buffer[i][maxchan+1] = ((int8_t)(seed >> 15)) << s->noise_shift;
m->sample_buffer[i][maxchan+2] = ((int8_t) seed_shr7) << s->noise_shift;
seed = (seed << 16) ^ seed_shr7 ^ (seed_shr7 << 5);
}
s->noisegen_seed = seed;
}
|
{
"code": [
" m->sample_buffer[i][maxchan+1] = ((int8_t)(seed >> 15)) << s->noise_shift;",
" m->sample_buffer[i][maxchan+2] = ((int8_t) seed_shr7) << s->noise_shift;"
],
"line_no": [
19,
21
]
}
|
static void FUNC_0(MLPDecodeContext *VAR_0, unsigned int VAR_1)
{
SubStream *s = &VAR_0->substream[VAR_1];
unsigned int VAR_2;
uint32_t seed = s->noisegen_seed;
unsigned int VAR_3 = s->max_matrix_channel;
for (VAR_2 = 0; VAR_2 < s->blockpos; VAR_2++) {
uint16_t seed_shr7 = seed >> 7;
VAR_0->sample_buffer[VAR_2][VAR_3+1] = ((int8_t)(seed >> 15)) << s->noise_shift;
VAR_0->sample_buffer[VAR_2][VAR_3+2] = ((int8_t) seed_shr7) << s->noise_shift;
seed = (seed << 16) ^ seed_shr7 ^ (seed_shr7 << 5);
}
s->noisegen_seed = seed;
}
|
[
"static void FUNC_0(MLPDecodeContext *VAR_0, unsigned int VAR_1)\n{",
"SubStream *s = &VAR_0->substream[VAR_1];",
"unsigned int VAR_2;",
"uint32_t seed = s->noisegen_seed;",
"unsigned int VAR_3 = s->max_matrix_channel;",
"for (VAR_2 = 0; VAR_2 < s->blockpos; VAR_2++) {",
"uint16_t seed_shr7 = seed >> 7;",
"VAR_0->sample_buffer[VAR_2][VAR_3+1] = ((int8_t)(seed >> 15)) << s->noise_shift;",
"VAR_0->sample_buffer[VAR_2][VAR_3+2] = ((int8_t) seed_shr7) << s->noise_shift;",
"seed = (seed << 16) ^ seed_shr7 ^ (seed_shr7 << 5);",
"}",
"s->noisegen_seed = seed;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
1,
1,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
19
],
[
21
],
[
25
],
[
27
],
[
31
],
[
33
]
] |
9,597 |
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
{
AVFilterContext *ctx = inlink->dst;
AudioEchoContext *s = ctx->priv;
AVFrame *out_frame;
if (av_frame_is_writable(frame)) {
out_frame = frame;
} else {
out_frame = ff_get_audio_buffer(inlink, frame->nb_samples);
if (!out_frame)
return AVERROR(ENOMEM);
av_frame_copy_props(out_frame, frame);
}
s->echo_samples(s, s->delayptrs, frame->extended_data, out_frame->extended_data,
frame->nb_samples, inlink->channels);
s->next_pts = frame->pts + av_rescale_q(frame->nb_samples, (AVRational){1, inlink->sample_rate}, inlink->time_base);
if (frame != out_frame)
av_frame_free(&frame);
return ff_filter_frame(ctx->outputs[0], out_frame);
}
| true |
FFmpeg
|
142894d7202b5559d87f58df30baf48107a816f6
|
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
{
AVFilterContext *ctx = inlink->dst;
AudioEchoContext *s = ctx->priv;
AVFrame *out_frame;
if (av_frame_is_writable(frame)) {
out_frame = frame;
} else {
out_frame = ff_get_audio_buffer(inlink, frame->nb_samples);
if (!out_frame)
return AVERROR(ENOMEM);
av_frame_copy_props(out_frame, frame);
}
s->echo_samples(s, s->delayptrs, frame->extended_data, out_frame->extended_data,
frame->nb_samples, inlink->channels);
s->next_pts = frame->pts + av_rescale_q(frame->nb_samples, (AVRational){1, inlink->sample_rate}, inlink->time_base);
if (frame != out_frame)
av_frame_free(&frame);
return ff_filter_frame(ctx->outputs[0], out_frame);
}
|
{
"code": [
" if (!out_frame)",
" if (!out_frame)"
],
"line_no": [
21,
21
]
}
|
static int FUNC_0(AVFilterLink *VAR_0, AVFrame *VAR_1)
{
AVFilterContext *ctx = VAR_0->dst;
AudioEchoContext *s = ctx->priv;
AVFrame *out_frame;
if (av_frame_is_writable(VAR_1)) {
out_frame = VAR_1;
} else {
out_frame = ff_get_audio_buffer(VAR_0, VAR_1->nb_samples);
if (!out_frame)
return AVERROR(ENOMEM);
av_frame_copy_props(out_frame, VAR_1);
}
s->echo_samples(s, s->delayptrs, VAR_1->extended_data, out_frame->extended_data,
VAR_1->nb_samples, VAR_0->channels);
s->next_pts = VAR_1->pts + av_rescale_q(VAR_1->nb_samples, (AVRational){1, VAR_0->sample_rate}, VAR_0->time_base);
if (VAR_1 != out_frame)
av_frame_free(&VAR_1);
return ff_filter_frame(ctx->outputs[0], out_frame);
}
|
[
"static int FUNC_0(AVFilterLink *VAR_0, AVFrame *VAR_1)\n{",
"AVFilterContext *ctx = VAR_0->dst;",
"AudioEchoContext *s = ctx->priv;",
"AVFrame *out_frame;",
"if (av_frame_is_writable(VAR_1)) {",
"out_frame = VAR_1;",
"} else {",
"out_frame = ff_get_audio_buffer(VAR_0, VAR_1->nb_samples);",
"if (!out_frame)\nreturn AVERROR(ENOMEM);",
"av_frame_copy_props(out_frame, VAR_1);",
"}",
"s->echo_samples(s, s->delayptrs, VAR_1->extended_data, out_frame->extended_data,\nVAR_1->nb_samples, VAR_0->channels);",
"s->next_pts = VAR_1->pts + av_rescale_q(VAR_1->nb_samples, (AVRational){1, VAR_0->sample_rate}, VAR_0->time_base);",
"if (VAR_1 != out_frame)\nav_frame_free(&VAR_1);",
"return ff_filter_frame(ctx->outputs[0], out_frame);",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21,
23
],
[
25
],
[
27
],
[
31,
33
],
[
37
],
[
41,
43
],
[
47
],
[
49
]
] |
9,599 |
static int pci_add_option_rom(PCIDevice *pdev, bool is_default_rom)
{
int size;
char *path;
void *ptr;
char name[32];
if (!pdev->romfile)
return 0;
if (strlen(pdev->romfile) == 0)
return 0;
if (!pdev->rom_bar) {
/*
* Load rom via fw_cfg instead of creating a rom bar,
* for 0.11 compatibility.
*/
int class = pci_get_word(pdev->config + PCI_CLASS_DEVICE);
if (class == 0x0300) {
rom_add_vga(pdev->romfile);
} else {
rom_add_option(pdev->romfile, -1);
}
return 0;
}
path = qemu_find_file(QEMU_FILE_TYPE_BIOS, pdev->romfile);
if (path == NULL) {
path = qemu_strdup(pdev->romfile);
}
size = get_image_size(path);
if (size < 0) {
error_report("%s: failed to find romfile \"%s\"",
__FUNCTION__, pdev->romfile);
return -1;
}
if (size & (size - 1)) {
size = 1 << qemu_fls(size);
}
if (pdev->qdev.info->vmsd)
snprintf(name, sizeof(name), "%s.rom", pdev->qdev.info->vmsd->name);
else
snprintf(name, sizeof(name), "%s.rom", pdev->qdev.info->name);
pdev->rom_offset = qemu_ram_alloc(&pdev->qdev, name, size);
ptr = qemu_get_ram_ptr(pdev->rom_offset);
load_image(path, ptr);
if (is_default_rom) {
/* Only the default rom images will be patched (if needed). */
pci_patch_ids(pdev, ptr, size);
}
pci_register_bar(pdev, PCI_ROM_SLOT, size,
0, pci_map_option_rom);
return 0;
}
| true |
qemu
|
386bbf45720b00496d5b9f9137359801c4e7ac0e
|
static int pci_add_option_rom(PCIDevice *pdev, bool is_default_rom)
{
int size;
char *path;
void *ptr;
char name[32];
if (!pdev->romfile)
return 0;
if (strlen(pdev->romfile) == 0)
return 0;
if (!pdev->rom_bar) {
int class = pci_get_word(pdev->config + PCI_CLASS_DEVICE);
if (class == 0x0300) {
rom_add_vga(pdev->romfile);
} else {
rom_add_option(pdev->romfile, -1);
}
return 0;
}
path = qemu_find_file(QEMU_FILE_TYPE_BIOS, pdev->romfile);
if (path == NULL) {
path = qemu_strdup(pdev->romfile);
}
size = get_image_size(path);
if (size < 0) {
error_report("%s: failed to find romfile \"%s\"",
__FUNCTION__, pdev->romfile);
return -1;
}
if (size & (size - 1)) {
size = 1 << qemu_fls(size);
}
if (pdev->qdev.info->vmsd)
snprintf(name, sizeof(name), "%s.rom", pdev->qdev.info->vmsd->name);
else
snprintf(name, sizeof(name), "%s.rom", pdev->qdev.info->name);
pdev->rom_offset = qemu_ram_alloc(&pdev->qdev, name, size);
ptr = qemu_get_ram_ptr(pdev->rom_offset);
load_image(path, ptr);
if (is_default_rom) {
pci_patch_ids(pdev, ptr, size);
}
pci_register_bar(pdev, PCI_ROM_SLOT, size,
0, pci_map_option_rom);
return 0;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(PCIDevice *VAR_0, bool VAR_1)
{
int VAR_2;
char *VAR_3;
void *VAR_4;
char VAR_5[32];
if (!VAR_0->romfile)
return 0;
if (strlen(VAR_0->romfile) == 0)
return 0;
if (!VAR_0->rom_bar) {
int VAR_6 = pci_get_word(VAR_0->config + PCI_CLASS_DEVICE);
if (VAR_6 == 0x0300) {
rom_add_vga(VAR_0->romfile);
} else {
rom_add_option(VAR_0->romfile, -1);
}
return 0;
}
VAR_3 = qemu_find_file(QEMU_FILE_TYPE_BIOS, VAR_0->romfile);
if (VAR_3 == NULL) {
VAR_3 = qemu_strdup(VAR_0->romfile);
}
VAR_2 = get_image_size(VAR_3);
if (VAR_2 < 0) {
error_report("%s: failed to find romfile \"%s\"",
__FUNCTION__, VAR_0->romfile);
return -1;
}
if (VAR_2 & (VAR_2 - 1)) {
VAR_2 = 1 << qemu_fls(VAR_2);
}
if (VAR_0->qdev.info->vmsd)
snprintf(VAR_5, sizeof(VAR_5), "%s.rom", VAR_0->qdev.info->vmsd->VAR_5);
else
snprintf(VAR_5, sizeof(VAR_5), "%s.rom", VAR_0->qdev.info->VAR_5);
VAR_0->rom_offset = qemu_ram_alloc(&VAR_0->qdev, VAR_5, VAR_2);
VAR_4 = qemu_get_ram_ptr(VAR_0->rom_offset);
load_image(VAR_3, VAR_4);
if (VAR_1) {
pci_patch_ids(VAR_0, VAR_4, VAR_2);
}
pci_register_bar(VAR_0, PCI_ROM_SLOT, VAR_2,
0, pci_map_option_rom);
return 0;
}
|
[
"static int FUNC_0(PCIDevice *VAR_0, bool VAR_1)\n{",
"int VAR_2;",
"char *VAR_3;",
"void *VAR_4;",
"char VAR_5[32];",
"if (!VAR_0->romfile)\nreturn 0;",
"if (strlen(VAR_0->romfile) == 0)\nreturn 0;",
"if (!VAR_0->rom_bar) {",
"int VAR_6 = pci_get_word(VAR_0->config + PCI_CLASS_DEVICE);",
"if (VAR_6 == 0x0300) {",
"rom_add_vga(VAR_0->romfile);",
"} else {",
"rom_add_option(VAR_0->romfile, -1);",
"}",
"return 0;",
"}",
"VAR_3 = qemu_find_file(QEMU_FILE_TYPE_BIOS, VAR_0->romfile);",
"if (VAR_3 == NULL) {",
"VAR_3 = qemu_strdup(VAR_0->romfile);",
"}",
"VAR_2 = get_image_size(VAR_3);",
"if (VAR_2 < 0) {",
"error_report(\"%s: failed to find romfile \\\"%s\\\"\",\n__FUNCTION__, VAR_0->romfile);",
"return -1;",
"}",
"if (VAR_2 & (VAR_2 - 1)) {",
"VAR_2 = 1 << qemu_fls(VAR_2);",
"}",
"if (VAR_0->qdev.info->vmsd)\nsnprintf(VAR_5, sizeof(VAR_5), \"%s.rom\", VAR_0->qdev.info->vmsd->VAR_5);",
"else\nsnprintf(VAR_5, sizeof(VAR_5), \"%s.rom\", VAR_0->qdev.info->VAR_5);",
"VAR_0->rom_offset = qemu_ram_alloc(&VAR_0->qdev, VAR_5, VAR_2);",
"VAR_4 = qemu_get_ram_ptr(VAR_0->rom_offset);",
"load_image(VAR_3, VAR_4);",
"if (VAR_1) {",
"pci_patch_ids(VAR_0, VAR_4, VAR_2);",
"}",
"pci_register_bar(VAR_0, PCI_ROM_SLOT, VAR_2,\n0, pci_map_option_rom);",
"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,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15,
17
],
[
19,
21
],
[
25
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
53
],
[
55
],
[
57
],
[
59
],
[
63
],
[
65
],
[
67,
69
],
[
72
],
[
74
],
[
76
],
[
78
],
[
80
],
[
84,
86
],
[
88,
90
],
[
92
],
[
96
],
[
98
],
[
103
],
[
107
],
[
109
],
[
113,
115
],
[
119
],
[
121
]
] |
9,600 |
void qemu_system_reset_request(void)
{
if (no_reboot) {
shutdown_requested = 1;
} else {
reset_requested = 1;
}
cpu_stop_current();
qemu_notify_event();
}
| true |
qemu
|
aedbe19297907143f17b733a7ff0e0534377bed1
|
void qemu_system_reset_request(void)
{
if (no_reboot) {
shutdown_requested = 1;
} else {
reset_requested = 1;
}
cpu_stop_current();
qemu_notify_event();
}
|
{
"code": [
" shutdown_requested = 1;",
" reset_requested = 1;"
],
"line_no": [
7,
11
]
}
|
void FUNC_0(void)
{
if (no_reboot) {
shutdown_requested = 1;
} else {
reset_requested = 1;
}
cpu_stop_current();
qemu_notify_event();
}
|
[
"void FUNC_0(void)\n{",
"if (no_reboot) {",
"shutdown_requested = 1;",
"} else {",
"reset_requested = 1;",
"}",
"cpu_stop_current();",
"qemu_notify_event();",
"}"
] |
[
0,
0,
1,
0,
1,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
]
] |
9,601 |
static void encode_frame(VC2EncContext *s, const AVFrame *frame,
const char *aux_data, int field)
{
int i;
/* Sequence header */
encode_parse_info(s, DIRAC_PCODE_SEQ_HEADER);
encode_seq_header(s);
/* Encoder version */
if (aux_data) {
encode_parse_info(s, DIRAC_PCODE_AUX);
avpriv_put_string(&s->pb, aux_data, 1);
}
/* Picture header */
encode_parse_info(s, DIRAC_PCODE_PICTURE_HQ);
encode_picture_start(s);
for (i = 0; i < 3; i++) {
s->transform_args[i].ctx = s;
s->transform_args[i].field = field;
s->transform_args[i].plane = &s->plane[i];
s->transform_args[i].idata = frame->data[i];
s->transform_args[i].istride = frame->linesize[i];
}
/* Do a DWT transform */
s->avctx->execute(s->avctx, dwt_plane, s->transform_args, NULL, 3,
sizeof(TransformArgs));
/* Calculate per-slice quantizers and sizes */
calc_slice_sizes(s);
/* Init planes and encode slices */
encode_slices(s);
/* End sequence */
encode_parse_info(s, DIRAC_PCODE_END_SEQ);
}
| true |
FFmpeg
|
b88be742fac7a77a8095e8155ba8790db4b77568
|
static void encode_frame(VC2EncContext *s, const AVFrame *frame,
const char *aux_data, int field)
{
int i;
encode_parse_info(s, DIRAC_PCODE_SEQ_HEADER);
encode_seq_header(s);
if (aux_data) {
encode_parse_info(s, DIRAC_PCODE_AUX);
avpriv_put_string(&s->pb, aux_data, 1);
}
encode_parse_info(s, DIRAC_PCODE_PICTURE_HQ);
encode_picture_start(s);
for (i = 0; i < 3; i++) {
s->transform_args[i].ctx = s;
s->transform_args[i].field = field;
s->transform_args[i].plane = &s->plane[i];
s->transform_args[i].idata = frame->data[i];
s->transform_args[i].istride = frame->linesize[i];
}
s->avctx->execute(s->avctx, dwt_plane, s->transform_args, NULL, 3,
sizeof(TransformArgs));
calc_slice_sizes(s);
encode_slices(s);
encode_parse_info(s, DIRAC_PCODE_END_SEQ);
}
|
{
"code": [
"static void encode_frame(VC2EncContext *s, const AVFrame *frame,",
" const char *aux_data, int field)",
" int i;",
" for (i = 0; i < 3; i++) {",
" s->transform_args[i].ctx = s;",
" s->transform_args[i].field = field;",
" s->transform_args[i].plane = &s->plane[i];",
" s->transform_args[i].idata = frame->data[i];",
" s->transform_args[i].istride = frame->linesize[i];",
" s->avctx->execute(s->avctx, dwt_plane, s->transform_args, NULL, 3,",
" sizeof(TransformArgs));",
" calc_slice_sizes(s);"
],
"line_no": [
1,
3,
7,
39,
41,
43,
45,
47,
49,
57,
59,
65
]
}
|
static void FUNC_0(VC2EncContext *VAR_0, const AVFrame *VAR_1,
const char *VAR_2, int VAR_3)
{
int VAR_4;
encode_parse_info(VAR_0, DIRAC_PCODE_SEQ_HEADER);
encode_seq_header(VAR_0);
if (VAR_2) {
encode_parse_info(VAR_0, DIRAC_PCODE_AUX);
avpriv_put_string(&VAR_0->pb, VAR_2, 1);
}
encode_parse_info(VAR_0, DIRAC_PCODE_PICTURE_HQ);
encode_picture_start(VAR_0);
for (VAR_4 = 0; VAR_4 < 3; VAR_4++) {
VAR_0->transform_args[VAR_4].ctx = VAR_0;
VAR_0->transform_args[VAR_4].VAR_3 = VAR_3;
VAR_0->transform_args[VAR_4].plane = &VAR_0->plane[VAR_4];
VAR_0->transform_args[VAR_4].idata = VAR_1->data[VAR_4];
VAR_0->transform_args[VAR_4].istride = VAR_1->linesize[VAR_4];
}
VAR_0->avctx->execute(VAR_0->avctx, dwt_plane, VAR_0->transform_args, NULL, 3,
sizeof(TransformArgs));
calc_slice_sizes(VAR_0);
encode_slices(VAR_0);
encode_parse_info(VAR_0, DIRAC_PCODE_END_SEQ);
}
|
[
"static void FUNC_0(VC2EncContext *VAR_0, const AVFrame *VAR_1,\nconst char *VAR_2, int VAR_3)\n{",
"int VAR_4;",
"encode_parse_info(VAR_0, DIRAC_PCODE_SEQ_HEADER);",
"encode_seq_header(VAR_0);",
"if (VAR_2) {",
"encode_parse_info(VAR_0, DIRAC_PCODE_AUX);",
"avpriv_put_string(&VAR_0->pb, VAR_2, 1);",
"}",
"encode_parse_info(VAR_0, DIRAC_PCODE_PICTURE_HQ);",
"encode_picture_start(VAR_0);",
"for (VAR_4 = 0; VAR_4 < 3; VAR_4++) {",
"VAR_0->transform_args[VAR_4].ctx = VAR_0;",
"VAR_0->transform_args[VAR_4].VAR_3 = VAR_3;",
"VAR_0->transform_args[VAR_4].plane = &VAR_0->plane[VAR_4];",
"VAR_0->transform_args[VAR_4].idata = VAR_1->data[VAR_4];",
"VAR_0->transform_args[VAR_4].istride = VAR_1->linesize[VAR_4];",
"}",
"VAR_0->avctx->execute(VAR_0->avctx, dwt_plane, VAR_0->transform_args, NULL, 3,\nsizeof(TransformArgs));",
"calc_slice_sizes(VAR_0);",
"encode_slices(VAR_0);",
"encode_parse_info(VAR_0, DIRAC_PCODE_END_SEQ);",
"}"
] |
[
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
1,
1,
1,
1,
0,
1,
1,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
13
],
[
15
],
[
21
],
[
23
],
[
25
],
[
27
],
[
33
],
[
35
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
57,
59
],
[
65
],
[
71
],
[
77
],
[
79
]
] |
9,602 |
static void gen_tlbre_booke206(DisasContext *ctx)
{
#if defined(CONFIG_USER_ONLY)
gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);
#else
if (unlikely(ctx->pr)) {
gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);
return;
}
gen_helper_booke206_tlbre(cpu_env);
#endif
}
| true |
qemu
|
9b2fadda3e0196ffd485adde4fe9cdd6fae35300
|
static void gen_tlbre_booke206(DisasContext *ctx)
{
#if defined(CONFIG_USER_ONLY)
gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);
#else
if (unlikely(ctx->pr)) {
gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);
return;
}
gen_helper_booke206_tlbre(cpu_env);
#endif
}
|
{
"code": [
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#if defined(CONFIG_USER_ONLY)",
"#else",
" if (unlikely(ctx->pr)) {",
"#endif",
"#if defined(CONFIG_USER_ONLY)",
"#else",
" if (unlikely(ctx->pr)) {",
"#endif",
"#endif",
"#if defined(CONFIG_USER_ONLY)",
"#else",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" if (unlikely(ctx->pr)) {",
"#endif",
" if (unlikely(ctx->pr)) {",
"#endif",
" if (unlikely(ctx->pr)) {",
"#endif",
" if (unlikely(ctx->pr)) {",
"#endif",
" if (unlikely(ctx->pr)) {",
"#endif",
" if (unlikely(ctx->pr)) {",
"#endif",
" if (unlikely(ctx->pr)) {",
"#endif",
" if (unlikely(ctx->pr)) {",
"#endif",
" if (unlikely(ctx->pr)) {",
"#endif",
" if (unlikely(ctx->pr)) {",
"#endif",
" if (unlikely(ctx->pr)) {",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" if (unlikely(ctx->pr)) {",
"#endif",
" if (unlikely(ctx->pr)) {",
"#endif",
" if (unlikely(ctx->pr)) {",
"#endif",
" if (unlikely(ctx->pr)) {",
"#endif",
"#if defined(CONFIG_USER_ONLY)",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#else",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
"#if defined(CONFIG_USER_ONLY)",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#else",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
"#if defined(CONFIG_USER_ONLY)",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#else",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
"#if defined(CONFIG_USER_ONLY)",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
" if (unlikely(ctx->pr)) {",
" gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);",
"#endif"
],
"line_no": [
13,
7,
11,
13,
7,
11,
13,
7,
13,
5,
9,
11,
23,
5,
9,
11,
23,
23,
5,
9,
11,
7,
11,
13,
23,
11,
23,
11,
23,
11,
23,
11,
23,
11,
23,
11,
23,
11,
23,
11,
23,
11,
23,
11,
23,
11,
23,
7,
13,
23,
7,
11,
13,
23,
7,
13,
23,
7,
13,
23,
7,
11,
13,
23,
7,
11,
13,
23,
23,
7,
11,
13,
23,
7,
11,
13,
23,
7,
11,
13,
23,
7,
11,
13,
23,
7,
11,
13,
23,
7,
11,
13,
23,
7,
11,
13,
23,
7,
11,
13,
23,
7,
11,
13,
23,
7,
11,
13,
23,
11,
23,
11,
23,
11,
23,
11,
23,
5,
7,
9,
11,
13,
23,
7,
11,
13,
23,
5,
7,
9,
11,
13,
23,
5,
7,
9,
11,
13,
23,
7,
11,
13,
23,
7,
11,
13,
23,
7,
11,
13,
23,
7,
11,
13,
23,
7,
11,
13,
23,
7,
11,
13,
23,
7,
11,
13,
23,
7,
11,
13,
23,
7,
11,
13,
23,
7,
11,
13,
23,
5,
7,
11,
13,
23,
7,
11,
13,
23,
7,
11,
13,
23,
7,
11,
13,
23,
7,
11,
13,
23,
7,
11,
13,
23,
7,
11,
13,
23,
7,
11,
13,
23,
7,
11,
13,
23
]
}
|
static void FUNC_0(DisasContext *VAR_0)
{
#if defined(CONFIG_USER_ONLY)
gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC);
#else
if (unlikely(VAR_0->pr)) {
gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC);
return;
}
gen_helper_booke206_tlbre(cpu_env);
#endif
}
|
[
"static void FUNC_0(DisasContext *VAR_0)\n{",
"#if defined(CONFIG_USER_ONLY)\ngen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC);",
"#else\nif (unlikely(VAR_0->pr)) {",
"gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC);",
"return;",
"}",
"gen_helper_booke206_tlbre(cpu_env);",
"#endif\n}"
] |
[
0,
1,
1,
1,
0,
0,
0,
1
] |
[
[
1,
3
],
[
5,
7
],
[
9,
11
],
[
13
],
[
15
],
[
17
],
[
21
],
[
23,
25
]
] |
9,603 |
static inline av_flatten int get_symbol_inline(RangeCoder *c, uint8_t *state,
int is_signed)
{
if (get_rac(c, state + 0))
return 0;
else {
int i, e, a;
e = 0;
while (get_rac(c, state + 1 + FFMIN(e, 9))) { // 1..10
e++;
if (e > 31)
return AVERROR_INVALIDDATA;
}
a = 1;
for (i = e - 1; i >= 0; i--)
a += a + get_rac(c, state + 22 + FFMIN(i, 9)); // 22..31
e = -(is_signed && get_rac(c, state + 11 + FFMIN(e, 10))); // 11..21
return (a ^ e) - e;
}
}
| true |
FFmpeg
|
8630b2cd36c57918acfe18302fe77d1ceefbd676
|
static inline av_flatten int get_symbol_inline(RangeCoder *c, uint8_t *state,
int is_signed)
{
if (get_rac(c, state + 0))
return 0;
else {
int i, e, a;
e = 0;
while (get_rac(c, state + 1 + FFMIN(e, 9))) {
e++;
if (e > 31)
return AVERROR_INVALIDDATA;
}
a = 1;
for (i = e - 1; i >= 0; i--)
a += a + get_rac(c, state + 22 + FFMIN(i, 9));
e = -(is_signed && get_rac(c, state + 11 + FFMIN(e, 10)));
return (a ^ e) - e;
}
}
|
{
"code": [
" int i, e, a;"
],
"line_no": [
13
]
}
|
static inline av_flatten int FUNC_0(RangeCoder *c, uint8_t *state,
int is_signed)
{
if (get_rac(c, state + 0))
return 0;
else {
int VAR_0, VAR_1, VAR_2;
VAR_1 = 0;
while (get_rac(c, state + 1 + FFMIN(VAR_1, 9))) {
VAR_1++;
if (VAR_1 > 31)
return AVERROR_INVALIDDATA;
}
VAR_2 = 1;
for (VAR_0 = VAR_1 - 1; VAR_0 >= 0; VAR_0--)
VAR_2 += VAR_2 + get_rac(c, state + 22 + FFMIN(VAR_0, 9));
VAR_1 = -(is_signed && get_rac(c, state + 11 + FFMIN(VAR_1, 10)));
return (VAR_2 ^ VAR_1) - VAR_1;
}
}
|
[
"static inline av_flatten int FUNC_0(RangeCoder *c, uint8_t *state,\nint is_signed)\n{",
"if (get_rac(c, state + 0))\nreturn 0;",
"else {",
"int VAR_0, VAR_1, VAR_2;",
"VAR_1 = 0;",
"while (get_rac(c, state + 1 + FFMIN(VAR_1, 9))) {",
"VAR_1++;",
"if (VAR_1 > 31)\nreturn AVERROR_INVALIDDATA;",
"}",
"VAR_2 = 1;",
"for (VAR_0 = VAR_1 - 1; VAR_0 >= 0; VAR_0--)",
"VAR_2 += VAR_2 + get_rac(c, state + 22 + FFMIN(VAR_0, 9));",
"VAR_1 = -(is_signed && get_rac(c, state + 11 + FFMIN(VAR_1, 10)));",
"return (VAR_2 ^ VAR_1) - VAR_1;",
"}",
"}"
] |
[
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7,
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21,
23
],
[
25
],
[
29
],
[
31
],
[
33
],
[
37
],
[
39
],
[
41
],
[
43
]
] |
9,604 |
static int mpeg_mux_end(AVFormatContext *ctx)
{
MpegMuxContext *s = ctx->priv_data;
StreamInfo *stream;
int i;
/* flush each packet */
for(i=0;i<ctx->nb_streams;i++) {
stream = ctx->streams[i]->priv_data;
while (stream->buffer_ptr > 0) {
flush_packet(ctx, i, AV_NOPTS_VALUE, AV_NOPTS_VALUE, s->last_scr);
}
}
/* End header according to MPEG1 systems standard. We do not write
it as it is usually not needed by decoders and because it
complicates MPEG stream concatenation. */
//put_be32(&ctx->pb, ISO_11172_END_CODE);
//put_flush_packet(&ctx->pb);
for(i=0;i<ctx->nb_streams;i++)
av_freep(&ctx->streams[i]->priv_data);
return 0;
}
| true |
FFmpeg
|
0dbb48d91e9e97c7eb11f4ebc03c4ff4b6f5b692
|
static int mpeg_mux_end(AVFormatContext *ctx)
{
MpegMuxContext *s = ctx->priv_data;
StreamInfo *stream;
int i;
for(i=0;i<ctx->nb_streams;i++) {
stream = ctx->streams[i]->priv_data;
while (stream->buffer_ptr > 0) {
flush_packet(ctx, i, AV_NOPTS_VALUE, AV_NOPTS_VALUE, s->last_scr);
}
}
for(i=0;i<ctx->nb_streams;i++)
av_freep(&ctx->streams[i]->priv_data);
return 0;
}
|
{
"code": [
" while (stream->buffer_ptr > 0) {",
" flush_packet(ctx, i, AV_NOPTS_VALUE, AV_NOPTS_VALUE, s->last_scr);"
],
"line_no": [
19,
21
]
}
|
static int FUNC_0(AVFormatContext *VAR_0)
{
MpegMuxContext *s = VAR_0->priv_data;
StreamInfo *stream;
int VAR_1;
for(VAR_1=0;VAR_1<VAR_0->nb_streams;VAR_1++) {
stream = VAR_0->streams[VAR_1]->priv_data;
while (stream->buffer_ptr > 0) {
flush_packet(VAR_0, VAR_1, AV_NOPTS_VALUE, AV_NOPTS_VALUE, s->last_scr);
}
}
for(VAR_1=0;VAR_1<VAR_0->nb_streams;VAR_1++)
av_freep(&VAR_0->streams[VAR_1]->priv_data);
return 0;
}
|
[
"static int FUNC_0(AVFormatContext *VAR_0)\n{",
"MpegMuxContext *s = VAR_0->priv_data;",
"StreamInfo *stream;",
"int VAR_1;",
"for(VAR_1=0;VAR_1<VAR_0->nb_streams;VAR_1++) {",
"stream = VAR_0->streams[VAR_1]->priv_data;",
"while (stream->buffer_ptr > 0) {",
"flush_packet(VAR_0, VAR_1, AV_NOPTS_VALUE, AV_NOPTS_VALUE, s->last_scr);",
"}",
"}",
"for(VAR_1=0;VAR_1<VAR_0->nb_streams;VAR_1++)",
"av_freep(&VAR_0->streams[VAR_1]->priv_data);",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
1,
1,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
41
],
[
43
],
[
47
],
[
49
]
] |
9,605 |
static coroutine_fn int hdev_co_write_zeroes(BlockDriverState *bs,
int64_t sector_num, int nb_sectors, BdrvRequestFlags flags)
{
BDRVRawState *s = bs->opaque;
int rc;
rc = fd_open(bs);
if (rc < 0) {
return rc;
}
if (!(flags & BDRV_REQ_MAY_UNMAP)) {
return -ENOTSUP;
}
if (!s->discard_zeroes) {
return -ENOTSUP;
}
return paio_submit_co(bs, s->fd, sector_num, NULL, nb_sectors,
QEMU_AIO_DISCARD|QEMU_AIO_BLKDEV);
}
| true |
qemu
|
97a2ae34537882df34810d538ab1f51085499d2c
|
static coroutine_fn int hdev_co_write_zeroes(BlockDriverState *bs,
int64_t sector_num, int nb_sectors, BdrvRequestFlags flags)
{
BDRVRawState *s = bs->opaque;
int rc;
rc = fd_open(bs);
if (rc < 0) {
return rc;
}
if (!(flags & BDRV_REQ_MAY_UNMAP)) {
return -ENOTSUP;
}
if (!s->discard_zeroes) {
return -ENOTSUP;
}
return paio_submit_co(bs, s->fd, sector_num, NULL, nb_sectors,
QEMU_AIO_DISCARD|QEMU_AIO_BLKDEV);
}
|
{
"code": [
" return -ENOTSUP;",
" if (!s->discard_zeroes) {",
" return -ENOTSUP;",
" return paio_submit_co(bs, s->fd, sector_num, NULL, nb_sectors,",
" return -ENOTSUP;",
" if (!s->discard_zeroes) {",
" return -ENOTSUP;",
" return paio_submit_co(bs, s->fd, sector_num, NULL, nb_sectors,",
" QEMU_AIO_DISCARD|QEMU_AIO_BLKDEV);"
],
"line_no": [
23,
27,
23,
33,
23,
27,
23,
33,
35
]
}
|
static coroutine_fn int FUNC_0(BlockDriverState *bs,
int64_t sector_num, int nb_sectors, BdrvRequestFlags flags)
{
BDRVRawState *s = bs->opaque;
int VAR_0;
VAR_0 = fd_open(bs);
if (VAR_0 < 0) {
return VAR_0;
}
if (!(flags & BDRV_REQ_MAY_UNMAP)) {
return -ENOTSUP;
}
if (!s->discard_zeroes) {
return -ENOTSUP;
}
return paio_submit_co(bs, s->fd, sector_num, NULL, nb_sectors,
QEMU_AIO_DISCARD|QEMU_AIO_BLKDEV);
}
|
[
"static coroutine_fn int FUNC_0(BlockDriverState *bs,\nint64_t sector_num, int nb_sectors, BdrvRequestFlags flags)\n{",
"BDRVRawState *s = bs->opaque;",
"int VAR_0;",
"VAR_0 = fd_open(bs);",
"if (VAR_0 < 0) {",
"return VAR_0;",
"}",
"if (!(flags & BDRV_REQ_MAY_UNMAP)) {",
"return -ENOTSUP;",
"}",
"if (!s->discard_zeroes) {",
"return -ENOTSUP;",
"}",
"return paio_submit_co(bs, s->fd, sector_num, NULL, nb_sectors,\nQEMU_AIO_DISCARD|QEMU_AIO_BLKDEV);",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
1,
0,
0,
1,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33,
35
],
[
37
]
] |
9,606 |
theora_gptopts(AVFormatContext *ctx, int idx, uint64_t gp, int64_t *dts)
{
struct ogg *ogg = ctx->priv_data;
struct ogg_stream *os = ogg->streams + idx;
struct theora_params *thp = os->private;
uint64_t iframe = gp >> thp->gpshift;
uint64_t pframe = gp & thp->gpmask;
if (thp->version < 0x030201)
iframe++;
if(!pframe)
os->pflags |= AV_PKT_FLAG_KEY;
if (dts)
*dts = iframe + pframe;
return iframe + pframe;
}
| true |
FFmpeg
|
f927c5b753f2ec1f037ad38cb55b4407dd7a9d79
|
theora_gptopts(AVFormatContext *ctx, int idx, uint64_t gp, int64_t *dts)
{
struct ogg *ogg = ctx->priv_data;
struct ogg_stream *os = ogg->streams + idx;
struct theora_params *thp = os->private;
uint64_t iframe = gp >> thp->gpshift;
uint64_t pframe = gp & thp->gpmask;
if (thp->version < 0x030201)
iframe++;
if(!pframe)
os->pflags |= AV_PKT_FLAG_KEY;
if (dts)
*dts = iframe + pframe;
return iframe + pframe;
}
|
{
"code": [
" uint64_t iframe = gp >> thp->gpshift;",
" uint64_t pframe = gp & thp->gpmask;"
],
"line_no": [
11,
13
]
}
|
FUNC_0(AVFormatContext *VAR_0, int VAR_1, uint64_t VAR_2, int64_t *VAR_3)
{
struct VAR_4 *VAR_4 = VAR_0->priv_data;
struct ogg_stream *VAR_5 = VAR_4->streams + VAR_1;
struct theora_params *VAR_6 = VAR_5->private;
uint64_t iframe = VAR_2 >> VAR_6->gpshift;
uint64_t pframe = VAR_2 & VAR_6->gpmask;
if (VAR_6->version < 0x030201)
iframe++;
if(!pframe)
VAR_5->pflags |= AV_PKT_FLAG_KEY;
if (VAR_3)
*VAR_3 = iframe + pframe;
return iframe + pframe;
}
|
[
"FUNC_0(AVFormatContext *VAR_0, int VAR_1, uint64_t VAR_2, int64_t *VAR_3)\n{",
"struct VAR_4 *VAR_4 = VAR_0->priv_data;",
"struct ogg_stream *VAR_5 = VAR_4->streams + VAR_1;",
"struct theora_params *VAR_6 = VAR_5->private;",
"uint64_t iframe = VAR_2 >> VAR_6->gpshift;",
"uint64_t pframe = VAR_2 & VAR_6->gpmask;",
"if (VAR_6->version < 0x030201)\niframe++;",
"if(!pframe)\nVAR_5->pflags |= AV_PKT_FLAG_KEY;",
"if (VAR_3)\n*VAR_3 = iframe + pframe;",
"return iframe + pframe;",
"}"
] |
[
0,
0,
0,
0,
1,
1,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17,
19
],
[
23,
25
],
[
29,
31
],
[
35
],
[
37
]
] |
9,608 |
static void qtrle_decode_32bpp(QtrleContext *s, int stream_ptr, int row_ptr, int lines_to_change)
{
int rle_code;
int pixel_ptr;
int row_inc = s->frame.linesize[0];
unsigned char a, r, g, b;
unsigned int argb;
unsigned char *rgb = s->frame.data[0];
int pixel_limit = s->frame.linesize[0] * s->avctx->height;
while (lines_to_change--) {
CHECK_STREAM_PTR(2);
pixel_ptr = row_ptr + (s->buf[stream_ptr++] - 1) * 4;
while ((rle_code = (signed char)s->buf[stream_ptr++]) != -1) {
if (rle_code == 0) {
/* there's another skip code in the stream */
CHECK_STREAM_PTR(1);
pixel_ptr += (s->buf[stream_ptr++] - 1) * 4;
} else if (rle_code < 0) {
/* decode the run length code */
rle_code = -rle_code;
CHECK_STREAM_PTR(4);
a = s->buf[stream_ptr++];
r = s->buf[stream_ptr++];
g = s->buf[stream_ptr++];
b = s->buf[stream_ptr++];
argb = (a << 24) | (r << 16) | (g << 8) | (b << 0);
CHECK_PIXEL_PTR(rle_code * 4);
while (rle_code--) {
*(unsigned int *)(&rgb[pixel_ptr]) = argb;
pixel_ptr += 4;
}
} else {
CHECK_STREAM_PTR(rle_code * 4);
CHECK_PIXEL_PTR(rle_code * 4);
/* copy pixels directly to output */
while (rle_code--) {
a = s->buf[stream_ptr++];
r = s->buf[stream_ptr++];
g = s->buf[stream_ptr++];
b = s->buf[stream_ptr++];
argb = (a << 24) | (r << 16) | (g << 8) | (b << 0);
*(unsigned int *)(&rgb[pixel_ptr]) = argb;
pixel_ptr += 4;
}
}
}
row_ptr += row_inc;
}
}
| true |
FFmpeg
|
7fb92be7e50ea4ba5712804326c6814ae02dd190
|
static void qtrle_decode_32bpp(QtrleContext *s, int stream_ptr, int row_ptr, int lines_to_change)
{
int rle_code;
int pixel_ptr;
int row_inc = s->frame.linesize[0];
unsigned char a, r, g, b;
unsigned int argb;
unsigned char *rgb = s->frame.data[0];
int pixel_limit = s->frame.linesize[0] * s->avctx->height;
while (lines_to_change--) {
CHECK_STREAM_PTR(2);
pixel_ptr = row_ptr + (s->buf[stream_ptr++] - 1) * 4;
while ((rle_code = (signed char)s->buf[stream_ptr++]) != -1) {
if (rle_code == 0) {
CHECK_STREAM_PTR(1);
pixel_ptr += (s->buf[stream_ptr++] - 1) * 4;
} else if (rle_code < 0) {
rle_code = -rle_code;
CHECK_STREAM_PTR(4);
a = s->buf[stream_ptr++];
r = s->buf[stream_ptr++];
g = s->buf[stream_ptr++];
b = s->buf[stream_ptr++];
argb = (a << 24) | (r << 16) | (g << 8) | (b << 0);
CHECK_PIXEL_PTR(rle_code * 4);
while (rle_code--) {
*(unsigned int *)(&rgb[pixel_ptr]) = argb;
pixel_ptr += 4;
}
} else {
CHECK_STREAM_PTR(rle_code * 4);
CHECK_PIXEL_PTR(rle_code * 4);
while (rle_code--) {
a = s->buf[stream_ptr++];
r = s->buf[stream_ptr++];
g = s->buf[stream_ptr++];
b = s->buf[stream_ptr++];
argb = (a << 24) | (r << 16) | (g << 8) | (b << 0);
*(unsigned int *)(&rgb[pixel_ptr]) = argb;
pixel_ptr += 4;
}
}
}
row_ptr += row_inc;
}
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(QtrleContext *VAR_0, int VAR_1, int VAR_2, int VAR_3)
{
int VAR_4;
int VAR_5;
int VAR_6 = VAR_0->frame.linesize[0];
unsigned char VAR_7, VAR_8, VAR_9, VAR_10;
unsigned int VAR_11;
unsigned char *VAR_12 = VAR_0->frame.data[0];
int VAR_13 = VAR_0->frame.linesize[0] * VAR_0->avctx->height;
while (VAR_3--) {
CHECK_STREAM_PTR(2);
VAR_5 = VAR_2 + (VAR_0->buf[VAR_1++] - 1) * 4;
while ((VAR_4 = (signed char)VAR_0->buf[VAR_1++]) != -1) {
if (VAR_4 == 0) {
CHECK_STREAM_PTR(1);
VAR_5 += (VAR_0->buf[VAR_1++] - 1) * 4;
} else if (VAR_4 < 0) {
VAR_4 = -VAR_4;
CHECK_STREAM_PTR(4);
VAR_7 = VAR_0->buf[VAR_1++];
VAR_8 = VAR_0->buf[VAR_1++];
VAR_9 = VAR_0->buf[VAR_1++];
VAR_10 = VAR_0->buf[VAR_1++];
VAR_11 = (VAR_7 << 24) | (VAR_8 << 16) | (VAR_9 << 8) | (VAR_10 << 0);
CHECK_PIXEL_PTR(VAR_4 * 4);
while (VAR_4--) {
*(unsigned int *)(&VAR_12[VAR_5]) = VAR_11;
VAR_5 += 4;
}
} else {
CHECK_STREAM_PTR(VAR_4 * 4);
CHECK_PIXEL_PTR(VAR_4 * 4);
while (VAR_4--) {
VAR_7 = VAR_0->buf[VAR_1++];
VAR_8 = VAR_0->buf[VAR_1++];
VAR_9 = VAR_0->buf[VAR_1++];
VAR_10 = VAR_0->buf[VAR_1++];
VAR_11 = (VAR_7 << 24) | (VAR_8 << 16) | (VAR_9 << 8) | (VAR_10 << 0);
*(unsigned int *)(&VAR_12[VAR_5]) = VAR_11;
VAR_5 += 4;
}
}
}
VAR_2 += VAR_6;
}
}
|
[
"static void FUNC_0(QtrleContext *VAR_0, int VAR_1, int VAR_2, int VAR_3)\n{",
"int VAR_4;",
"int VAR_5;",
"int VAR_6 = VAR_0->frame.linesize[0];",
"unsigned char VAR_7, VAR_8, VAR_9, VAR_10;",
"unsigned int VAR_11;",
"unsigned char *VAR_12 = VAR_0->frame.data[0];",
"int VAR_13 = VAR_0->frame.linesize[0] * VAR_0->avctx->height;",
"while (VAR_3--) {",
"CHECK_STREAM_PTR(2);",
"VAR_5 = VAR_2 + (VAR_0->buf[VAR_1++] - 1) * 4;",
"while ((VAR_4 = (signed char)VAR_0->buf[VAR_1++]) != -1) {",
"if (VAR_4 == 0) {",
"CHECK_STREAM_PTR(1);",
"VAR_5 += (VAR_0->buf[VAR_1++] - 1) * 4;",
"} else if (VAR_4 < 0) {",
"VAR_4 = -VAR_4;",
"CHECK_STREAM_PTR(4);",
"VAR_7 = VAR_0->buf[VAR_1++];",
"VAR_8 = VAR_0->buf[VAR_1++];",
"VAR_9 = VAR_0->buf[VAR_1++];",
"VAR_10 = VAR_0->buf[VAR_1++];",
"VAR_11 = (VAR_7 << 24) | (VAR_8 << 16) | (VAR_9 << 8) | (VAR_10 << 0);",
"CHECK_PIXEL_PTR(VAR_4 * 4);",
"while (VAR_4--) {",
"*(unsigned int *)(&VAR_12[VAR_5]) = VAR_11;",
"VAR_5 += 4;",
"}",
"} else {",
"CHECK_STREAM_PTR(VAR_4 * 4);",
"CHECK_PIXEL_PTR(VAR_4 * 4);",
"while (VAR_4--) {",
"VAR_7 = VAR_0->buf[VAR_1++];",
"VAR_8 = VAR_0->buf[VAR_1++];",
"VAR_9 = VAR_0->buf[VAR_1++];",
"VAR_10 = VAR_0->buf[VAR_1++];",
"VAR_11 = (VAR_7 << 24) | (VAR_8 << 16) | (VAR_9 << 8) | (VAR_10 << 0);",
"*(unsigned int *)(&VAR_12[VAR_5]) = VAR_11;",
"VAR_5 += 4;",
"}",
"}",
"}",
"VAR_2 += 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
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
21
],
[
23
],
[
25
],
[
30
],
[
32
],
[
36
],
[
38
],
[
41
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
61
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
]
] |
9,609 |
int loader_exec(const char * filename, char ** argv, char ** envp,
struct target_pt_regs * regs, struct image_info *infop)
{
struct linux_binprm bprm;
int retval;
int i;
bprm.p = TARGET_PAGE_SIZE*MAX_ARG_PAGES-sizeof(unsigned int);
for (i=0 ; i<MAX_ARG_PAGES ; i++) /* clear page-table */
bprm.page[i] = NULL;
retval = open(filename, O_RDONLY);
if (retval < 0)
return retval;
bprm.fd = retval;
bprm.filename = (char *)filename;
bprm.argc = count(argv);
bprm.argv = argv;
bprm.envc = count(envp);
bprm.envp = envp;
retval = prepare_binprm(&bprm);
if(retval>=0) {
if (bprm.buf[0] == 0x7f
&& bprm.buf[1] == 'E'
&& bprm.buf[2] == 'L'
&& bprm.buf[3] == 'F') {
retval = load_elf_binary(&bprm,regs,infop);
} else {
fprintf(stderr, "Unknown binary format\n");
return -1;
}
}
if(retval>=0) {
/* success. Initialize important registers */
do_init_thread(regs, infop);
return retval;
}
/* Something went wrong, return the inode and free the argument pages*/
for (i=0 ; i<MAX_ARG_PAGES ; i++) {
free(bprm.page[i]);
}
return(retval);
}
| true |
qemu
|
c580dee4e170adad1ebdf901d32f0e1ed7d125b9
|
int loader_exec(const char * filename, char ** argv, char ** envp,
struct target_pt_regs * regs, struct image_info *infop)
{
struct linux_binprm bprm;
int retval;
int i;
bprm.p = TARGET_PAGE_SIZE*MAX_ARG_PAGES-sizeof(unsigned int);
for (i=0 ; i<MAX_ARG_PAGES ; i++)
bprm.page[i] = NULL;
retval = open(filename, O_RDONLY);
if (retval < 0)
return retval;
bprm.fd = retval;
bprm.filename = (char *)filename;
bprm.argc = count(argv);
bprm.argv = argv;
bprm.envc = count(envp);
bprm.envp = envp;
retval = prepare_binprm(&bprm);
if(retval>=0) {
if (bprm.buf[0] == 0x7f
&& bprm.buf[1] == 'E'
&& bprm.buf[2] == 'L'
&& bprm.buf[3] == 'F') {
retval = load_elf_binary(&bprm,regs,infop);
} else {
fprintf(stderr, "Unknown binary format\n");
return -1;
}
}
if(retval>=0) {
do_init_thread(regs, infop);
return retval;
}
for (i=0 ; i<MAX_ARG_PAGES ; i++) {
free(bprm.page[i]);
}
return(retval);
}
|
{
"code": [
" free(bprm.page[i]);"
],
"line_no": [
85
]
}
|
int FUNC_0(const char * VAR_0, char ** VAR_1, char ** VAR_2,
struct target_pt_regs * VAR_3, struct image_info *VAR_4)
{
struct linux_binprm VAR_5;
int VAR_6;
int VAR_7;
VAR_5.p = TARGET_PAGE_SIZE*MAX_ARG_PAGES-sizeof(unsigned int);
for (VAR_7=0 ; VAR_7<MAX_ARG_PAGES ; VAR_7++)
VAR_5.page[VAR_7] = NULL;
VAR_6 = open(VAR_0, O_RDONLY);
if (VAR_6 < 0)
return VAR_6;
VAR_5.fd = VAR_6;
VAR_5.VAR_0 = (char *)VAR_0;
VAR_5.argc = count(VAR_1);
VAR_5.VAR_1 = VAR_1;
VAR_5.envc = count(VAR_2);
VAR_5.VAR_2 = VAR_2;
VAR_6 = prepare_binprm(&VAR_5);
if(VAR_6>=0) {
if (VAR_5.buf[0] == 0x7f
&& VAR_5.buf[1] == 'E'
&& VAR_5.buf[2] == 'L'
&& VAR_5.buf[3] == 'F') {
VAR_6 = load_elf_binary(&VAR_5,VAR_3,VAR_4);
} else {
fprintf(stderr, "Unknown binary format\n");
return -1;
}
}
if(VAR_6>=0) {
do_init_thread(VAR_3, VAR_4);
return VAR_6;
}
for (VAR_7=0 ; VAR_7<MAX_ARG_PAGES ; VAR_7++) {
free(VAR_5.page[VAR_7]);
}
return(VAR_6);
}
|
[
"int FUNC_0(const char * VAR_0, char ** VAR_1, char ** VAR_2,\nstruct target_pt_regs * VAR_3, struct image_info *VAR_4)\n{",
"struct linux_binprm VAR_5;",
"int VAR_6;",
"int VAR_7;",
"VAR_5.p = TARGET_PAGE_SIZE*MAX_ARG_PAGES-sizeof(unsigned int);",
"for (VAR_7=0 ; VAR_7<MAX_ARG_PAGES ; VAR_7++)",
"VAR_5.page[VAR_7] = NULL;",
"VAR_6 = open(VAR_0, O_RDONLY);",
"if (VAR_6 < 0)\nreturn VAR_6;",
"VAR_5.fd = VAR_6;",
"VAR_5.VAR_0 = (char *)VAR_0;",
"VAR_5.argc = count(VAR_1);",
"VAR_5.VAR_1 = VAR_1;",
"VAR_5.envc = count(VAR_2);",
"VAR_5.VAR_2 = VAR_2;",
"VAR_6 = prepare_binprm(&VAR_5);",
"if(VAR_6>=0) {",
"if (VAR_5.buf[0] == 0x7f\n&& VAR_5.buf[1] == 'E'\n&& VAR_5.buf[2] == 'L'\n&& VAR_5.buf[3] == 'F') {",
"VAR_6 = load_elf_binary(&VAR_5,VAR_3,VAR_4);",
"} else {",
"fprintf(stderr, \"Unknown binary format\\n\");",
"return -1;",
"}",
"}",
"if(VAR_6>=0) {",
"do_init_thread(VAR_3, VAR_4);",
"return VAR_6;",
"}",
"for (VAR_7=0 ; VAR_7<MAX_ARG_PAGES ; VAR_7++) {",
"free(VAR_5.page[VAR_7]);",
"}",
"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,
1,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23,
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
41
],
[
45
],
[
47,
49,
51,
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
69
],
[
73
],
[
75
],
[
77
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
]
] |
9,610 |
static av_always_inline SoftFloat autocorr_calc(int64_t accu)
{
int nz, mant, expo, round;
int i = (int)(accu >> 32);
if (i == 0) {
nz = 1;
} else {
nz = 0;
while (FFABS(i) < 0x40000000) {
i <<= 1;
nz++;
}
nz = 32-nz;
}
round = 1 << (nz-1);
mant = (int)((accu + round) >> nz);
mant = (mant + 0x40)>>7;
mant <<= 6;
expo = nz + 15;
return av_int2sf(mant, 30 - expo);
}
| true |
FFmpeg
|
ad2296ab3a131d3560c385e43437841987166804
|
static av_always_inline SoftFloat autocorr_calc(int64_t accu)
{
int nz, mant, expo, round;
int i = (int)(accu >> 32);
if (i == 0) {
nz = 1;
} else {
nz = 0;
while (FFABS(i) < 0x40000000) {
i <<= 1;
nz++;
}
nz = 32-nz;
}
round = 1 << (nz-1);
mant = (int)((accu + round) >> nz);
mant = (mant + 0x40)>>7;
mant <<= 6;
expo = nz + 15;
return av_int2sf(mant, 30 - expo);
}
|
{
"code": [
" int nz, mant, expo, round;",
" round = 1 << (nz-1);"
],
"line_no": [
5,
31
]
}
|
static av_always_inline VAR_0 autocorr_calc(int64_t accu)
{
int nz, mant, expo, round;
int i = (int)(accu >> 32);
if (i == 0) {
nz = 1;
} else {
nz = 0;
while (FFABS(i) < 0x40000000) {
i <<= 1;
nz++;
}
nz = 32-nz;
}
round = 1 << (nz-1);
mant = (int)((accu + round) >> nz);
mant = (mant + 0x40)>>7;
mant <<= 6;
expo = nz + 15;
return av_int2sf(mant, 30 - expo);
}
|
[
"static av_always_inline VAR_0 autocorr_calc(int64_t accu)\n{",
"int nz, mant, expo, round;",
"int i = (int)(accu >> 32);",
"if (i == 0) {",
"nz = 1;",
"} else {",
"nz = 0;",
"while (FFABS(i) < 0x40000000) {",
"i <<= 1;",
"nz++;",
"}",
"nz = 32-nz;",
"}",
"round = 1 << (nz-1);",
"mant = (int)((accu + round) >> nz);",
"mant = (mant + 0x40)>>7;",
"mant <<= 6;",
"expo = nz + 15;",
"return av_int2sf(mant, 30 - expo);",
"}"
] |
[
0,
1,
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
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
]
] |
9,612 |
static void search_for_ms(AACEncContext *s, ChannelElement *cpe,
const float lambda)
{
int start = 0, i, w, w2, g;
float M[128], S[128];
float *L34 = s->scoefs, *R34 = s->scoefs + 128, *M34 = s->scoefs + 128*2, *S34 = s->scoefs + 128*3;
SingleChannelElement *sce0 = &cpe->ch[0];
SingleChannelElement *sce1 = &cpe->ch[1];
if (!cpe->common_window)
return;
for (w = 0; w < sce0->ics.num_windows; w += sce0->ics.group_len[w]) {
for (g = 0; g < sce0->ics.num_swb; g++) {
if (!cpe->ch[0].zeroes[w*16+g] && !cpe->ch[1].zeroes[w*16+g]) {
float dist1 = 0.0f, dist2 = 0.0f;
for (w2 = 0; w2 < sce0->ics.group_len[w]; w2++) {
FFPsyBand *band0 = &s->psy.ch[s->cur_channel+0].psy_bands[(w+w2)*16+g];
FFPsyBand *band1 = &s->psy.ch[s->cur_channel+1].psy_bands[(w+w2)*16+g];
float minthr = FFMIN(band0->threshold, band1->threshold);
float maxthr = FFMAX(band0->threshold, band1->threshold);
for (i = 0; i < sce0->ics.swb_sizes[g]; i++) {
M[i] = (sce0->coeffs[start+w2*128+i]
+ sce1->coeffs[start+w2*128+i]) * 0.5;
S[i] = M[i]
- sce1->coeffs[start+w2*128+i];
}
abs_pow34_v(L34, sce0->coeffs+start+w2*128, sce0->ics.swb_sizes[g]);
abs_pow34_v(R34, sce1->coeffs+start+w2*128, sce0->ics.swb_sizes[g]);
abs_pow34_v(M34, M, sce0->ics.swb_sizes[g]);
abs_pow34_v(S34, S, sce0->ics.swb_sizes[g]);
dist1 += quantize_band_cost(s, sce0->coeffs + start + w2*128,
L34,
sce0->ics.swb_sizes[g],
sce0->sf_idx[(w+w2)*16+g],
sce0->band_type[(w+w2)*16+g],
lambda / band0->threshold, INFINITY, NULL);
dist1 += quantize_band_cost(s, sce1->coeffs + start + w2*128,
R34,
sce1->ics.swb_sizes[g],
sce1->sf_idx[(w+w2)*16+g],
sce1->band_type[(w+w2)*16+g],
lambda / band1->threshold, INFINITY, NULL);
dist2 += quantize_band_cost(s, M,
M34,
sce0->ics.swb_sizes[g],
sce0->sf_idx[(w+w2)*16+g],
sce0->band_type[(w+w2)*16+g],
lambda / maxthr, INFINITY, NULL);
dist2 += quantize_band_cost(s, S,
S34,
sce1->ics.swb_sizes[g],
sce1->sf_idx[(w+w2)*16+g],
sce1->band_type[(w+w2)*16+g],
lambda / minthr, INFINITY, NULL);
}
cpe->ms_mask[w*16+g] = dist2 < dist1;
}
start += sce0->ics.swb_sizes[g];
}
}
}
| true |
FFmpeg
|
6394acaf36da3106f4793bda32730f8ff6b0ddb1
|
static void search_for_ms(AACEncContext *s, ChannelElement *cpe,
const float lambda)
{
int start = 0, i, w, w2, g;
float M[128], S[128];
float *L34 = s->scoefs, *R34 = s->scoefs + 128, *M34 = s->scoefs + 128*2, *S34 = s->scoefs + 128*3;
SingleChannelElement *sce0 = &cpe->ch[0];
SingleChannelElement *sce1 = &cpe->ch[1];
if (!cpe->common_window)
return;
for (w = 0; w < sce0->ics.num_windows; w += sce0->ics.group_len[w]) {
for (g = 0; g < sce0->ics.num_swb; g++) {
if (!cpe->ch[0].zeroes[w*16+g] && !cpe->ch[1].zeroes[w*16+g]) {
float dist1 = 0.0f, dist2 = 0.0f;
for (w2 = 0; w2 < sce0->ics.group_len[w]; w2++) {
FFPsyBand *band0 = &s->psy.ch[s->cur_channel+0].psy_bands[(w+w2)*16+g];
FFPsyBand *band1 = &s->psy.ch[s->cur_channel+1].psy_bands[(w+w2)*16+g];
float minthr = FFMIN(band0->threshold, band1->threshold);
float maxthr = FFMAX(band0->threshold, band1->threshold);
for (i = 0; i < sce0->ics.swb_sizes[g]; i++) {
M[i] = (sce0->coeffs[start+w2*128+i]
+ sce1->coeffs[start+w2*128+i]) * 0.5;
S[i] = M[i]
- sce1->coeffs[start+w2*128+i];
}
abs_pow34_v(L34, sce0->coeffs+start+w2*128, sce0->ics.swb_sizes[g]);
abs_pow34_v(R34, sce1->coeffs+start+w2*128, sce0->ics.swb_sizes[g]);
abs_pow34_v(M34, M, sce0->ics.swb_sizes[g]);
abs_pow34_v(S34, S, sce0->ics.swb_sizes[g]);
dist1 += quantize_band_cost(s, sce0->coeffs + start + w2*128,
L34,
sce0->ics.swb_sizes[g],
sce0->sf_idx[(w+w2)*16+g],
sce0->band_type[(w+w2)*16+g],
lambda / band0->threshold, INFINITY, NULL);
dist1 += quantize_band_cost(s, sce1->coeffs + start + w2*128,
R34,
sce1->ics.swb_sizes[g],
sce1->sf_idx[(w+w2)*16+g],
sce1->band_type[(w+w2)*16+g],
lambda / band1->threshold, INFINITY, NULL);
dist2 += quantize_band_cost(s, M,
M34,
sce0->ics.swb_sizes[g],
sce0->sf_idx[(w+w2)*16+g],
sce0->band_type[(w+w2)*16+g],
lambda / maxthr, INFINITY, NULL);
dist2 += quantize_band_cost(s, S,
S34,
sce1->ics.swb_sizes[g],
sce1->sf_idx[(w+w2)*16+g],
sce1->band_type[(w+w2)*16+g],
lambda / minthr, INFINITY, NULL);
}
cpe->ms_mask[w*16+g] = dist2 < dist1;
}
start += sce0->ics.swb_sizes[g];
}
}
}
|
{
"code": [
" M[i] = (sce0->coeffs[start+w2*128+i]",
" + sce1->coeffs[start+w2*128+i]) * 0.5;",
" - sce1->coeffs[start+w2*128+i];"
],
"line_no": [
41,
43,
47
]
}
|
static void FUNC_0(AACEncContext *VAR_0, ChannelElement *VAR_1,
const float VAR_2)
{
int VAR_3 = 0, VAR_4, VAR_5, VAR_6, VAR_7;
float VAR_8[128], VAR_9[128];
float *VAR_10 = VAR_0->scoefs, *VAR_11 = VAR_0->scoefs + 128, *VAR_12 = VAR_0->scoefs + 128*2, *VAR_13 = VAR_0->scoefs + 128*3;
SingleChannelElement *sce0 = &VAR_1->ch[0];
SingleChannelElement *sce1 = &VAR_1->ch[1];
if (!VAR_1->common_window)
return;
for (VAR_5 = 0; VAR_5 < sce0->ics.num_windows; VAR_5 += sce0->ics.group_len[VAR_5]) {
for (VAR_7 = 0; VAR_7 < sce0->ics.num_swb; VAR_7++) {
if (!VAR_1->ch[0].zeroes[VAR_5*16+VAR_7] && !VAR_1->ch[1].zeroes[VAR_5*16+VAR_7]) {
float dist1 = 0.0f, dist2 = 0.0f;
for (VAR_6 = 0; VAR_6 < sce0->ics.group_len[VAR_5]; VAR_6++) {
FFPsyBand *band0 = &VAR_0->psy.ch[VAR_0->cur_channel+0].psy_bands[(VAR_5+VAR_6)*16+VAR_7];
FFPsyBand *band1 = &VAR_0->psy.ch[VAR_0->cur_channel+1].psy_bands[(VAR_5+VAR_6)*16+VAR_7];
float minthr = FFMIN(band0->threshold, band1->threshold);
float maxthr = FFMAX(band0->threshold, band1->threshold);
for (VAR_4 = 0; VAR_4 < sce0->ics.swb_sizes[VAR_7]; VAR_4++) {
VAR_8[VAR_4] = (sce0->coeffs[VAR_3+VAR_6*128+VAR_4]
+ sce1->coeffs[VAR_3+VAR_6*128+VAR_4]) * 0.5;
VAR_9[VAR_4] = VAR_8[VAR_4]
- sce1->coeffs[VAR_3+VAR_6*128+VAR_4];
}
abs_pow34_v(VAR_10, sce0->coeffs+VAR_3+VAR_6*128, sce0->ics.swb_sizes[VAR_7]);
abs_pow34_v(VAR_11, sce1->coeffs+VAR_3+VAR_6*128, sce0->ics.swb_sizes[VAR_7]);
abs_pow34_v(VAR_12, VAR_8, sce0->ics.swb_sizes[VAR_7]);
abs_pow34_v(VAR_13, VAR_9, sce0->ics.swb_sizes[VAR_7]);
dist1 += quantize_band_cost(VAR_0, sce0->coeffs + VAR_3 + VAR_6*128,
VAR_10,
sce0->ics.swb_sizes[VAR_7],
sce0->sf_idx[(VAR_5+VAR_6)*16+VAR_7],
sce0->band_type[(VAR_5+VAR_6)*16+VAR_7],
VAR_2 / band0->threshold, INFINITY, NULL);
dist1 += quantize_band_cost(VAR_0, sce1->coeffs + VAR_3 + VAR_6*128,
VAR_11,
sce1->ics.swb_sizes[VAR_7],
sce1->sf_idx[(VAR_5+VAR_6)*16+VAR_7],
sce1->band_type[(VAR_5+VAR_6)*16+VAR_7],
VAR_2 / band1->threshold, INFINITY, NULL);
dist2 += quantize_band_cost(VAR_0, VAR_8,
VAR_12,
sce0->ics.swb_sizes[VAR_7],
sce0->sf_idx[(VAR_5+VAR_6)*16+VAR_7],
sce0->band_type[(VAR_5+VAR_6)*16+VAR_7],
VAR_2 / maxthr, INFINITY, NULL);
dist2 += quantize_band_cost(VAR_0, VAR_9,
VAR_13,
sce1->ics.swb_sizes[VAR_7],
sce1->sf_idx[(VAR_5+VAR_6)*16+VAR_7],
sce1->band_type[(VAR_5+VAR_6)*16+VAR_7],
VAR_2 / minthr, INFINITY, NULL);
}
VAR_1->ms_mask[VAR_5*16+VAR_7] = dist2 < dist1;
}
VAR_3 += sce0->ics.swb_sizes[VAR_7];
}
}
}
|
[
"static void FUNC_0(AACEncContext *VAR_0, ChannelElement *VAR_1,\nconst float VAR_2)\n{",
"int VAR_3 = 0, VAR_4, VAR_5, VAR_6, VAR_7;",
"float VAR_8[128], VAR_9[128];",
"float *VAR_10 = VAR_0->scoefs, *VAR_11 = VAR_0->scoefs + 128, *VAR_12 = VAR_0->scoefs + 128*2, *VAR_13 = VAR_0->scoefs + 128*3;",
"SingleChannelElement *sce0 = &VAR_1->ch[0];",
"SingleChannelElement *sce1 = &VAR_1->ch[1];",
"if (!VAR_1->common_window)\nreturn;",
"for (VAR_5 = 0; VAR_5 < sce0->ics.num_windows; VAR_5 += sce0->ics.group_len[VAR_5]) {",
"for (VAR_7 = 0; VAR_7 < sce0->ics.num_swb; VAR_7++) {",
"if (!VAR_1->ch[0].zeroes[VAR_5*16+VAR_7] && !VAR_1->ch[1].zeroes[VAR_5*16+VAR_7]) {",
"float dist1 = 0.0f, dist2 = 0.0f;",
"for (VAR_6 = 0; VAR_6 < sce0->ics.group_len[VAR_5]; VAR_6++) {",
"FFPsyBand *band0 = &VAR_0->psy.ch[VAR_0->cur_channel+0].psy_bands[(VAR_5+VAR_6)*16+VAR_7];",
"FFPsyBand *band1 = &VAR_0->psy.ch[VAR_0->cur_channel+1].psy_bands[(VAR_5+VAR_6)*16+VAR_7];",
"float minthr = FFMIN(band0->threshold, band1->threshold);",
"float maxthr = FFMAX(band0->threshold, band1->threshold);",
"for (VAR_4 = 0; VAR_4 < sce0->ics.swb_sizes[VAR_7]; VAR_4++) {",
"VAR_8[VAR_4] = (sce0->coeffs[VAR_3+VAR_6*128+VAR_4]\n+ sce1->coeffs[VAR_3+VAR_6*128+VAR_4]) * 0.5;",
"VAR_9[VAR_4] = VAR_8[VAR_4]\n- sce1->coeffs[VAR_3+VAR_6*128+VAR_4];",
"}",
"abs_pow34_v(VAR_10, sce0->coeffs+VAR_3+VAR_6*128, sce0->ics.swb_sizes[VAR_7]);",
"abs_pow34_v(VAR_11, sce1->coeffs+VAR_3+VAR_6*128, sce0->ics.swb_sizes[VAR_7]);",
"abs_pow34_v(VAR_12, VAR_8, sce0->ics.swb_sizes[VAR_7]);",
"abs_pow34_v(VAR_13, VAR_9, sce0->ics.swb_sizes[VAR_7]);",
"dist1 += quantize_band_cost(VAR_0, sce0->coeffs + VAR_3 + VAR_6*128,\nVAR_10,\nsce0->ics.swb_sizes[VAR_7],\nsce0->sf_idx[(VAR_5+VAR_6)*16+VAR_7],\nsce0->band_type[(VAR_5+VAR_6)*16+VAR_7],\nVAR_2 / band0->threshold, INFINITY, NULL);",
"dist1 += quantize_band_cost(VAR_0, sce1->coeffs + VAR_3 + VAR_6*128,\nVAR_11,\nsce1->ics.swb_sizes[VAR_7],\nsce1->sf_idx[(VAR_5+VAR_6)*16+VAR_7],\nsce1->band_type[(VAR_5+VAR_6)*16+VAR_7],\nVAR_2 / band1->threshold, INFINITY, NULL);",
"dist2 += quantize_band_cost(VAR_0, VAR_8,\nVAR_12,\nsce0->ics.swb_sizes[VAR_7],\nsce0->sf_idx[(VAR_5+VAR_6)*16+VAR_7],\nsce0->band_type[(VAR_5+VAR_6)*16+VAR_7],\nVAR_2 / maxthr, INFINITY, NULL);",
"dist2 += quantize_band_cost(VAR_0, VAR_9,\nVAR_13,\nsce1->ics.swb_sizes[VAR_7],\nsce1->sf_idx[(VAR_5+VAR_6)*16+VAR_7],\nsce1->band_type[(VAR_5+VAR_6)*16+VAR_7],\nVAR_2 / minthr, INFINITY, NULL);",
"}",
"VAR_1->ms_mask[VAR_5*16+VAR_7] = dist2 < dist1;",
"}",
"VAR_3 += sce0->ics.swb_sizes[VAR_7];",
"}",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
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
]
] |
9,614 |
struct SwrContext *swr_alloc_set_opts(struct SwrContext *s,
int64_t out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate,
int64_t in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate,
int log_offset, void *log_ctx){
if(!s) s= swr_alloc();
if(!s) return NULL;
s->log_level_offset= log_offset;
s->log_ctx= log_ctx;
av_opt_set_int(s, "ocl", out_ch_layout, 0);
av_opt_set_int(s, "osf", out_sample_fmt, 0);
av_opt_set_int(s, "osr", out_sample_rate, 0);
av_opt_set_int(s, "icl", in_ch_layout, 0);
av_opt_set_int(s, "isf", in_sample_fmt, 0);
av_opt_set_int(s, "isr", in_sample_rate, 0);
av_opt_set_int(s, "tsf", AV_SAMPLE_FMT_NONE, 0);
av_opt_set_int(s, "ich", av_get_channel_layout_nb_channels(s-> in_ch_layout), 0);
av_opt_set_int(s, "och", av_get_channel_layout_nb_channels(s->out_ch_layout), 0);
av_opt_set_int(s, "uch", 0, 0);
return s;
}
| true |
FFmpeg
|
f4e814f787d050ac65f507b1304dcdc4ffa56f29
|
struct SwrContext *swr_alloc_set_opts(struct SwrContext *s,
int64_t out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate,
int64_t in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate,
int log_offset, void *log_ctx){
if(!s) s= swr_alloc();
if(!s) return NULL;
s->log_level_offset= log_offset;
s->log_ctx= log_ctx;
av_opt_set_int(s, "ocl", out_ch_layout, 0);
av_opt_set_int(s, "osf", out_sample_fmt, 0);
av_opt_set_int(s, "osr", out_sample_rate, 0);
av_opt_set_int(s, "icl", in_ch_layout, 0);
av_opt_set_int(s, "isf", in_sample_fmt, 0);
av_opt_set_int(s, "isr", in_sample_rate, 0);
av_opt_set_int(s, "tsf", AV_SAMPLE_FMT_NONE, 0);
av_opt_set_int(s, "ich", av_get_channel_layout_nb_channels(s-> in_ch_layout), 0);
av_opt_set_int(s, "och", av_get_channel_layout_nb_channels(s->out_ch_layout), 0);
av_opt_set_int(s, "uch", 0, 0);
return s;
}
|
{
"code": [
" av_opt_set_int(s, \"ocl\", out_ch_layout, 0);",
" av_opt_set_int(s, \"osf\", out_sample_fmt, 0);",
" av_opt_set_int(s, \"osr\", out_sample_rate, 0);",
" av_opt_set_int(s, \"icl\", in_ch_layout, 0);",
" av_opt_set_int(s, \"isf\", in_sample_fmt, 0);",
" av_opt_set_int(s, \"isr\", in_sample_rate, 0);",
" av_opt_set_int(s, \"tsf\", AV_SAMPLE_FMT_NONE, 0);",
" av_opt_set_int(s, \"ich\", av_get_channel_layout_nb_channels(s-> in_ch_layout), 0);",
" av_opt_set_int(s, \"och\", av_get_channel_layout_nb_channels(s->out_ch_layout), 0);"
],
"line_no": [
21,
23,
25,
27,
29,
31,
33,
35,
37
]
}
|
struct SwrContext *FUNC_0(struct SwrContext *VAR_0,
int64_t VAR_1, enum AVSampleFormat VAR_2, int VAR_3,
int64_t VAR_4, enum AVSampleFormat VAR_5, int VAR_6,
int VAR_7, void *VAR_8){
if(!VAR_0) VAR_0= swr_alloc();
if(!VAR_0) return NULL;
VAR_0->log_level_offset= VAR_7;
VAR_0->VAR_8= VAR_8;
av_opt_set_int(VAR_0, "ocl", VAR_1, 0);
av_opt_set_int(VAR_0, "osf", VAR_2, 0);
av_opt_set_int(VAR_0, "osr", VAR_3, 0);
av_opt_set_int(VAR_0, "icl", VAR_4, 0);
av_opt_set_int(VAR_0, "isf", VAR_5, 0);
av_opt_set_int(VAR_0, "isr", VAR_6, 0);
av_opt_set_int(VAR_0, "tsf", AV_SAMPLE_FMT_NONE, 0);
av_opt_set_int(VAR_0, "ich", av_get_channel_layout_nb_channels(VAR_0-> VAR_4), 0);
av_opt_set_int(VAR_0, "och", av_get_channel_layout_nb_channels(VAR_0->VAR_1), 0);
av_opt_set_int(VAR_0, "uch", 0, 0);
return VAR_0;
}
|
[
"struct SwrContext *FUNC_0(struct SwrContext *VAR_0,\nint64_t VAR_1, enum AVSampleFormat VAR_2, int VAR_3,\nint64_t VAR_4, enum AVSampleFormat VAR_5, int VAR_6,\nint VAR_7, void *VAR_8){",
"if(!VAR_0) VAR_0= swr_alloc();",
"if(!VAR_0) return NULL;",
"VAR_0->log_level_offset= VAR_7;",
"VAR_0->VAR_8= VAR_8;",
"av_opt_set_int(VAR_0, \"ocl\", VAR_1, 0);",
"av_opt_set_int(VAR_0, \"osf\", VAR_2, 0);",
"av_opt_set_int(VAR_0, \"osr\", VAR_3, 0);",
"av_opt_set_int(VAR_0, \"icl\", VAR_4, 0);",
"av_opt_set_int(VAR_0, \"isf\", VAR_5, 0);",
"av_opt_set_int(VAR_0, \"isr\", VAR_6, 0);",
"av_opt_set_int(VAR_0, \"tsf\", AV_SAMPLE_FMT_NONE, 0);",
"av_opt_set_int(VAR_0, \"ich\", av_get_channel_layout_nb_channels(VAR_0-> VAR_4), 0);",
"av_opt_set_int(VAR_0, \"och\", av_get_channel_layout_nb_channels(VAR_0->VAR_1), 0);",
"av_opt_set_int(VAR_0, \"uch\", 0, 0);",
"return VAR_0;",
"}"
] |
[
0,
0,
0,
0,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0
] |
[
[
1,
3,
5,
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
]
] |
9,615 |
static int ipvideo_decode_block_opcode_0x8(IpvideoContext *s, AVFrame *frame)
{
int x, y;
unsigned char P[4];
unsigned int flags = 0;
/* 2-color encoding for each 4x4 quadrant, or 2-color encoding on
* either top and bottom or left and right halves */
P[0] = bytestream2_get_byte(&s->stream_ptr);
P[1] = bytestream2_get_byte(&s->stream_ptr);
if (P[0] <= P[1]) {
for (y = 0; y < 16; y++) {
// new values for each 4x4 block
if (!(y & 3)) {
if (y) {
P[0] = bytestream2_get_byte(&s->stream_ptr);
P[1] = bytestream2_get_byte(&s->stream_ptr);
flags = bytestream2_get_le16(&s->stream_ptr);
for (x = 0; x < 4; x++, flags >>= 1)
*s->pixel_ptr++ = P[flags & 1];
s->pixel_ptr += s->stride - 4;
// switch to right half
if (y == 7) s->pixel_ptr -= 8 * s->stride - 4;
} else {
flags = bytestream2_get_le32(&s->stream_ptr);
P[2] = bytestream2_get_byte(&s->stream_ptr);
P[3] = bytestream2_get_byte(&s->stream_ptr);
if (P[2] <= P[3]) {
/* vertical split; left & right halves are 2-color encoded */
for (y = 0; y < 16; y++) {
for (x = 0; x < 4; x++, flags >>= 1)
*s->pixel_ptr++ = P[flags & 1];
s->pixel_ptr += s->stride - 4;
// switch to right half
if (y == 7) {
s->pixel_ptr -= 8 * s->stride - 4;
P[0] = P[2];
P[1] = P[3];
flags = bytestream2_get_le32(&s->stream_ptr);
} else {
/* horizontal split; top & bottom halves are 2-color encoded */
for (y = 0; y < 8; y++) {
if (y == 4) {
P[0] = P[2];
P[1] = P[3];
flags = bytestream2_get_le32(&s->stream_ptr);
for (x = 0; x < 8; x++, flags >>= 1)
*s->pixel_ptr++ = P[flags & 1];
s->pixel_ptr += s->line_inc;
/* report success */
return 0;
| true |
FFmpeg
|
8eb76217d0137b7adad438f6c923310fbc1fc4c1
|
static int ipvideo_decode_block_opcode_0x8(IpvideoContext *s, AVFrame *frame)
{
int x, y;
unsigned char P[4];
unsigned int flags = 0;
P[0] = bytestream2_get_byte(&s->stream_ptr);
P[1] = bytestream2_get_byte(&s->stream_ptr);
if (P[0] <= P[1]) {
for (y = 0; y < 16; y++) {
if (!(y & 3)) {
if (y) {
P[0] = bytestream2_get_byte(&s->stream_ptr);
P[1] = bytestream2_get_byte(&s->stream_ptr);
flags = bytestream2_get_le16(&s->stream_ptr);
for (x = 0; x < 4; x++, flags >>= 1)
*s->pixel_ptr++ = P[flags & 1];
s->pixel_ptr += s->stride - 4;
if (y == 7) s->pixel_ptr -= 8 * s->stride - 4;
} else {
flags = bytestream2_get_le32(&s->stream_ptr);
P[2] = bytestream2_get_byte(&s->stream_ptr);
P[3] = bytestream2_get_byte(&s->stream_ptr);
if (P[2] <= P[3]) {
for (y = 0; y < 16; y++) {
for (x = 0; x < 4; x++, flags >>= 1)
*s->pixel_ptr++ = P[flags & 1];
s->pixel_ptr += s->stride - 4;
if (y == 7) {
s->pixel_ptr -= 8 * s->stride - 4;
P[0] = P[2];
P[1] = P[3];
flags = bytestream2_get_le32(&s->stream_ptr);
} else {
for (y = 0; y < 8; y++) {
if (y == 4) {
P[0] = P[2];
P[1] = P[3];
flags = bytestream2_get_le32(&s->stream_ptr);
for (x = 0; x < 8; x++, flags >>= 1)
*s->pixel_ptr++ = P[flags & 1];
s->pixel_ptr += s->line_inc;
return 0;
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(IpvideoContext *VAR_0, AVFrame *VAR_1)
{
int VAR_2, VAR_3;
unsigned char VAR_4[4];
unsigned int VAR_5 = 0;
VAR_4[0] = bytestream2_get_byte(&VAR_0->stream_ptr);
VAR_4[1] = bytestream2_get_byte(&VAR_0->stream_ptr);
if (VAR_4[0] <= VAR_4[1]) {
for (VAR_3 = 0; VAR_3 < 16; VAR_3++) {
if (!(VAR_3 & 3)) {
if (VAR_3) {
VAR_4[0] = bytestream2_get_byte(&VAR_0->stream_ptr);
VAR_4[1] = bytestream2_get_byte(&VAR_0->stream_ptr);
VAR_5 = bytestream2_get_le16(&VAR_0->stream_ptr);
for (VAR_2 = 0; VAR_2 < 4; VAR_2++, VAR_5 >>= 1)
*VAR_0->pixel_ptr++ = VAR_4[VAR_5 & 1];
VAR_0->pixel_ptr += VAR_0->stride - 4;
if (VAR_3 == 7) VAR_0->pixel_ptr -= 8 * VAR_0->stride - 4;
} else {
VAR_5 = bytestream2_get_le32(&VAR_0->stream_ptr);
VAR_4[2] = bytestream2_get_byte(&VAR_0->stream_ptr);
VAR_4[3] = bytestream2_get_byte(&VAR_0->stream_ptr);
if (VAR_4[2] <= VAR_4[3]) {
for (VAR_3 = 0; VAR_3 < 16; VAR_3++) {
for (VAR_2 = 0; VAR_2 < 4; VAR_2++, VAR_5 >>= 1)
*VAR_0->pixel_ptr++ = VAR_4[VAR_5 & 1];
VAR_0->pixel_ptr += VAR_0->stride - 4;
if (VAR_3 == 7) {
VAR_0->pixel_ptr -= 8 * VAR_0->stride - 4;
VAR_4[0] = VAR_4[2];
VAR_4[1] = VAR_4[3];
VAR_5 = bytestream2_get_le32(&VAR_0->stream_ptr);
} else {
for (VAR_3 = 0; VAR_3 < 8; VAR_3++) {
if (VAR_3 == 4) {
VAR_4[0] = VAR_4[2];
VAR_4[1] = VAR_4[3];
VAR_5 = bytestream2_get_le32(&VAR_0->stream_ptr);
for (VAR_2 = 0; VAR_2 < 8; VAR_2++, VAR_5 >>= 1)
*VAR_0->pixel_ptr++ = VAR_4[VAR_5 & 1];
VAR_0->pixel_ptr += VAR_0->line_inc;
return 0;
|
[
"static int FUNC_0(IpvideoContext *VAR_0, AVFrame *VAR_1)\n{",
"int VAR_2, VAR_3;",
"unsigned char VAR_4[4];",
"unsigned int VAR_5 = 0;",
"VAR_4[0] = bytestream2_get_byte(&VAR_0->stream_ptr);",
"VAR_4[1] = bytestream2_get_byte(&VAR_0->stream_ptr);",
"if (VAR_4[0] <= VAR_4[1]) {",
"for (VAR_3 = 0; VAR_3 < 16; VAR_3++) {",
"if (!(VAR_3 & 3)) {",
"if (VAR_3) {",
"VAR_4[0] = bytestream2_get_byte(&VAR_0->stream_ptr);",
"VAR_4[1] = bytestream2_get_byte(&VAR_0->stream_ptr);",
"VAR_5 = bytestream2_get_le16(&VAR_0->stream_ptr);",
"for (VAR_2 = 0; VAR_2 < 4; VAR_2++, VAR_5 >>= 1)",
"*VAR_0->pixel_ptr++ = VAR_4[VAR_5 & 1];",
"VAR_0->pixel_ptr += VAR_0->stride - 4;",
"if (VAR_3 == 7) VAR_0->pixel_ptr -= 8 * VAR_0->stride - 4;",
"} else {",
"VAR_5 = bytestream2_get_le32(&VAR_0->stream_ptr);",
"VAR_4[2] = bytestream2_get_byte(&VAR_0->stream_ptr);",
"VAR_4[3] = bytestream2_get_byte(&VAR_0->stream_ptr);",
"if (VAR_4[2] <= VAR_4[3]) {",
"for (VAR_3 = 0; VAR_3 < 16; VAR_3++) {",
"for (VAR_2 = 0; VAR_2 < 4; VAR_2++, VAR_5 >>= 1)",
"*VAR_0->pixel_ptr++ = VAR_4[VAR_5 & 1];",
"VAR_0->pixel_ptr += VAR_0->stride - 4;",
"if (VAR_3 == 7) {",
"VAR_0->pixel_ptr -= 8 * VAR_0->stride - 4;",
"VAR_4[0] = VAR_4[2];",
"VAR_4[1] = VAR_4[3];",
"VAR_5 = bytestream2_get_le32(&VAR_0->stream_ptr);",
"} else {",
"for (VAR_3 = 0; VAR_3 < 8; VAR_3++) {",
"if (VAR_3 == 4) {",
"VAR_4[0] = VAR_4[2];",
"VAR_4[1] = VAR_4[3];",
"VAR_5 = bytestream2_get_le32(&VAR_0->stream_ptr);",
"for (VAR_2 = 0; VAR_2 < 8; VAR_2++, VAR_5 >>= 1)",
"*VAR_0->pixel_ptr++ = VAR_4[VAR_5 & 1];",
"VAR_0->pixel_ptr += VAR_0->line_inc;",
"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,
2
],
[
3
],
[
4
],
[
5
],
[
8
],
[
9
],
[
10
],
[
11
],
[
13
],
[
14
],
[
15
],
[
16
],
[
17
],
[
18
],
[
19
],
[
20
],
[
22
],
[
23
],
[
24
],
[
25
],
[
26
],
[
27
],
[
29
],
[
30
],
[
31
],
[
32
],
[
34
],
[
35
],
[
36
],
[
37
],
[
38
],
[
39
],
[
41
],
[
42
],
[
43
],
[
44
],
[
45
],
[
46
],
[
47
],
[
48
],
[
50
]
] |
9,617 |
FpPort *fp_port_alloc(Rocker *r, char *sw_name,
MACAddr *start_mac, unsigned int index,
NICPeers *peers)
{
FpPort *port = g_malloc0(sizeof(FpPort));
if (!port) {
return NULL;
}
port->r = r;
port->index = index;
port->pport = index + 1;
/* front-panel switch port names are 1-based */
port->name = g_strdup_printf("%sp%d", sw_name, port->pport);
memcpy(port->conf.macaddr.a, start_mac, sizeof(port->conf.macaddr.a));
port->conf.macaddr.a[5] += index;
port->conf.bootindex = -1;
port->conf.peers = *peers;
port->nic = qemu_new_nic(&fp_port_info, &port->conf,
sw_name, NULL, port);
qemu_format_nic_info_str(qemu_get_queue(port->nic),
port->conf.macaddr.a);
fp_port_reset(port);
return port;
}
| true |
qemu
|
778358d0a8f74a76488daea3c1b6fb327d8135b4
|
FpPort *fp_port_alloc(Rocker *r, char *sw_name,
MACAddr *start_mac, unsigned int index,
NICPeers *peers)
{
FpPort *port = g_malloc0(sizeof(FpPort));
if (!port) {
return NULL;
}
port->r = r;
port->index = index;
port->pport = index + 1;
port->name = g_strdup_printf("%sp%d", sw_name, port->pport);
memcpy(port->conf.macaddr.a, start_mac, sizeof(port->conf.macaddr.a));
port->conf.macaddr.a[5] += index;
port->conf.bootindex = -1;
port->conf.peers = *peers;
port->nic = qemu_new_nic(&fp_port_info, &port->conf,
sw_name, NULL, port);
qemu_format_nic_info_str(qemu_get_queue(port->nic),
port->conf.macaddr.a);
fp_port_reset(port);
return port;
}
|
{
"code": [
" FpPort *port = g_malloc0(sizeof(FpPort));"
],
"line_no": [
9
]
}
|
FpPort *FUNC_0(Rocker *r, char *sw_name,
MACAddr *start_mac, unsigned int index,
NICPeers *peers)
{
FpPort *port = g_malloc0(sizeof(FpPort));
if (!port) {
return NULL;
}
port->r = r;
port->index = index;
port->pport = index + 1;
port->name = g_strdup_printf("%sp%d", sw_name, port->pport);
memcpy(port->conf.macaddr.a, start_mac, sizeof(port->conf.macaddr.a));
port->conf.macaddr.a[5] += index;
port->conf.bootindex = -1;
port->conf.peers = *peers;
port->nic = qemu_new_nic(&fp_port_info, &port->conf,
sw_name, NULL, port);
qemu_format_nic_info_str(qemu_get_queue(port->nic),
port->conf.macaddr.a);
fp_port_reset(port);
return port;
}
|
[
"FpPort *FUNC_0(Rocker *r, char *sw_name,\nMACAddr *start_mac, unsigned int index,\nNICPeers *peers)\n{",
"FpPort *port = g_malloc0(sizeof(FpPort));",
"if (!port) {",
"return NULL;",
"}",
"port->r = r;",
"port->index = index;",
"port->pport = index + 1;",
"port->name = g_strdup_printf(\"%sp%d\", sw_name, port->pport);",
"memcpy(port->conf.macaddr.a, start_mac, sizeof(port->conf.macaddr.a));",
"port->conf.macaddr.a[5] += index;",
"port->conf.bootindex = -1;",
"port->conf.peers = *peers;",
"port->nic = qemu_new_nic(&fp_port_info, &port->conf,\nsw_name, NULL, port);",
"qemu_format_nic_info_str(qemu_get_queue(port->nic),\nport->conf.macaddr.a);",
"fp_port_reset(port);",
"return port;",
"}"
] |
[
0,
1,
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
],
[
33
],
[
37
],
[
39
],
[
41
],
[
43
],
[
47,
49
],
[
51,
53
],
[
57
],
[
61
],
[
63
]
] |
9,618 |
static void show_stream(AVFormatContext *fmt_ctx, int stream_idx)
{
AVStream *stream = fmt_ctx->streams[stream_idx];
AVCodecContext *dec_ctx;
AVCodec *dec;
const char *profile;
char val_str[128];
AVRational display_aspect_ratio;
probe_object_header("stream");
probe_int("index", stream->index);
if ((dec_ctx = stream->codec)) {
if ((dec = dec_ctx->codec)) {
probe_str("codec_name", dec->name);
probe_str("codec_long_name", dec->long_name);
} else {
probe_str("codec_name", "unknown");
}
probe_str("codec_type", media_type_string(dec_ctx->codec_type));
probe_str("codec_time_base",
rational_string(val_str, sizeof(val_str),
"/", &dec_ctx->time_base));
/* print AVI/FourCC tag */
av_get_codec_tag_string(val_str, sizeof(val_str), dec_ctx->codec_tag);
probe_str("codec_tag_string", val_str);
probe_str("codec_tag", tag_string(val_str, sizeof(val_str),
dec_ctx->codec_tag));
/* print profile, if there is one */
if (dec && (profile = av_get_profile_name(dec, dec_ctx->profile)))
probe_str("profile", profile);
switch (dec_ctx->codec_type) {
case AVMEDIA_TYPE_VIDEO:
probe_int("width", dec_ctx->width);
probe_int("height", dec_ctx->height);
probe_int("has_b_frames", dec_ctx->has_b_frames);
if (dec_ctx->sample_aspect_ratio.num) {
probe_str("sample_aspect_ratio",
rational_string(val_str, sizeof(val_str), ":",
&dec_ctx->sample_aspect_ratio));
av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
dec_ctx->width * dec_ctx->sample_aspect_ratio.num,
dec_ctx->height * dec_ctx->sample_aspect_ratio.den,
1024*1024);
probe_str("display_aspect_ratio",
rational_string(val_str, sizeof(val_str), ":",
&display_aspect_ratio));
}
probe_str("pix_fmt",
dec_ctx->pix_fmt != PIX_FMT_NONE ? av_pix_fmt_descriptors[dec_ctx->pix_fmt].name
: "unknown");
probe_int("level", dec_ctx->level);
break;
case AVMEDIA_TYPE_AUDIO:
probe_str("sample_rate",
value_string(val_str, sizeof(val_str),
dec_ctx->sample_rate,
unit_hertz_str));
probe_int("channels", dec_ctx->channels);
probe_int("bits_per_sample",
av_get_bits_per_sample(dec_ctx->codec_id));
break;
}
} else {
probe_str("codec_type", "unknown");
}
if (fmt_ctx->iformat->flags & AVFMT_SHOW_IDS)
probe_int("id", stream->id);
probe_str("r_frame_rate",
rational_string(val_str, sizeof(val_str), "/",
&stream->r_frame_rate));
probe_str("avg_frame_rate",
rational_string(val_str, sizeof(val_str), "/",
&stream->avg_frame_rate));
probe_str("time_base",
rational_string(val_str, sizeof(val_str), "/",
&stream->time_base));
probe_str("start_time",
time_value_string(val_str, sizeof(val_str),
stream->start_time, &stream->time_base));
probe_str("duration",
time_value_string(val_str, sizeof(val_str),
stream->duration, &stream->time_base));
if (stream->nb_frames)
probe_int("nb_frames", stream->nb_frames);
probe_dict(stream->metadata, "tags");
probe_object_footer("stream");
}
| true |
FFmpeg
|
aba232cfa9b193604ed98f3fa505378d006b1b3b
|
static void show_stream(AVFormatContext *fmt_ctx, int stream_idx)
{
AVStream *stream = fmt_ctx->streams[stream_idx];
AVCodecContext *dec_ctx;
AVCodec *dec;
const char *profile;
char val_str[128];
AVRational display_aspect_ratio;
probe_object_header("stream");
probe_int("index", stream->index);
if ((dec_ctx = stream->codec)) {
if ((dec = dec_ctx->codec)) {
probe_str("codec_name", dec->name);
probe_str("codec_long_name", dec->long_name);
} else {
probe_str("codec_name", "unknown");
}
probe_str("codec_type", media_type_string(dec_ctx->codec_type));
probe_str("codec_time_base",
rational_string(val_str, sizeof(val_str),
"/", &dec_ctx->time_base));
av_get_codec_tag_string(val_str, sizeof(val_str), dec_ctx->codec_tag);
probe_str("codec_tag_string", val_str);
probe_str("codec_tag", tag_string(val_str, sizeof(val_str),
dec_ctx->codec_tag));
if (dec && (profile = av_get_profile_name(dec, dec_ctx->profile)))
probe_str("profile", profile);
switch (dec_ctx->codec_type) {
case AVMEDIA_TYPE_VIDEO:
probe_int("width", dec_ctx->width);
probe_int("height", dec_ctx->height);
probe_int("has_b_frames", dec_ctx->has_b_frames);
if (dec_ctx->sample_aspect_ratio.num) {
probe_str("sample_aspect_ratio",
rational_string(val_str, sizeof(val_str), ":",
&dec_ctx->sample_aspect_ratio));
av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
dec_ctx->width * dec_ctx->sample_aspect_ratio.num,
dec_ctx->height * dec_ctx->sample_aspect_ratio.den,
1024*1024);
probe_str("display_aspect_ratio",
rational_string(val_str, sizeof(val_str), ":",
&display_aspect_ratio));
}
probe_str("pix_fmt",
dec_ctx->pix_fmt != PIX_FMT_NONE ? av_pix_fmt_descriptors[dec_ctx->pix_fmt].name
: "unknown");
probe_int("level", dec_ctx->level);
break;
case AVMEDIA_TYPE_AUDIO:
probe_str("sample_rate",
value_string(val_str, sizeof(val_str),
dec_ctx->sample_rate,
unit_hertz_str));
probe_int("channels", dec_ctx->channels);
probe_int("bits_per_sample",
av_get_bits_per_sample(dec_ctx->codec_id));
break;
}
} else {
probe_str("codec_type", "unknown");
}
if (fmt_ctx->iformat->flags & AVFMT_SHOW_IDS)
probe_int("id", stream->id);
probe_str("r_frame_rate",
rational_string(val_str, sizeof(val_str), "/",
&stream->r_frame_rate));
probe_str("avg_frame_rate",
rational_string(val_str, sizeof(val_str), "/",
&stream->avg_frame_rate));
probe_str("time_base",
rational_string(val_str, sizeof(val_str), "/",
&stream->time_base));
probe_str("start_time",
time_value_string(val_str, sizeof(val_str),
stream->start_time, &stream->time_base));
probe_str("duration",
time_value_string(val_str, sizeof(val_str),
stream->duration, &stream->time_base));
if (stream->nb_frames)
probe_int("nb_frames", stream->nb_frames);
probe_dict(stream->metadata, "tags");
probe_object_footer("stream");
}
|
{
"code": [
" probe_str(\"r_frame_rate\",",
" rational_string(val_str, sizeof(val_str), \"/\",",
" &stream->r_frame_rate));"
],
"line_no": [
151,
153,
155
]
}
|
static void FUNC_0(AVFormatContext *VAR_0, int VAR_1)
{
AVStream *stream = VAR_0->streams[VAR_1];
AVCodecContext *dec_ctx;
AVCodec *dec;
const char *VAR_2;
char VAR_3[128];
AVRational display_aspect_ratio;
probe_object_header("stream");
probe_int("index", stream->index);
if ((dec_ctx = stream->codec)) {
if ((dec = dec_ctx->codec)) {
probe_str("codec_name", dec->name);
probe_str("codec_long_name", dec->long_name);
} else {
probe_str("codec_name", "unknown");
}
probe_str("codec_type", media_type_string(dec_ctx->codec_type));
probe_str("codec_time_base",
rational_string(VAR_3, sizeof(VAR_3),
"/", &dec_ctx->time_base));
av_get_codec_tag_string(VAR_3, sizeof(VAR_3), dec_ctx->codec_tag);
probe_str("codec_tag_string", VAR_3);
probe_str("codec_tag", tag_string(VAR_3, sizeof(VAR_3),
dec_ctx->codec_tag));
if (dec && (VAR_2 = av_get_profile_name(dec, dec_ctx->VAR_2)))
probe_str("VAR_2", VAR_2);
switch (dec_ctx->codec_type) {
case AVMEDIA_TYPE_VIDEO:
probe_int("width", dec_ctx->width);
probe_int("height", dec_ctx->height);
probe_int("has_b_frames", dec_ctx->has_b_frames);
if (dec_ctx->sample_aspect_ratio.num) {
probe_str("sample_aspect_ratio",
rational_string(VAR_3, sizeof(VAR_3), ":",
&dec_ctx->sample_aspect_ratio));
av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
dec_ctx->width * dec_ctx->sample_aspect_ratio.num,
dec_ctx->height * dec_ctx->sample_aspect_ratio.den,
1024*1024);
probe_str("display_aspect_ratio",
rational_string(VAR_3, sizeof(VAR_3), ":",
&display_aspect_ratio));
}
probe_str("pix_fmt",
dec_ctx->pix_fmt != PIX_FMT_NONE ? av_pix_fmt_descriptors[dec_ctx->pix_fmt].name
: "unknown");
probe_int("level", dec_ctx->level);
break;
case AVMEDIA_TYPE_AUDIO:
probe_str("sample_rate",
value_string(VAR_3, sizeof(VAR_3),
dec_ctx->sample_rate,
unit_hertz_str));
probe_int("channels", dec_ctx->channels);
probe_int("bits_per_sample",
av_get_bits_per_sample(dec_ctx->codec_id));
break;
}
} else {
probe_str("codec_type", "unknown");
}
if (VAR_0->iformat->flags & AVFMT_SHOW_IDS)
probe_int("id", stream->id);
probe_str("r_frame_rate",
rational_string(VAR_3, sizeof(VAR_3), "/",
&stream->r_frame_rate));
probe_str("avg_frame_rate",
rational_string(VAR_3, sizeof(VAR_3), "/",
&stream->avg_frame_rate));
probe_str("time_base",
rational_string(VAR_3, sizeof(VAR_3), "/",
&stream->time_base));
probe_str("start_time",
time_value_string(VAR_3, sizeof(VAR_3),
stream->start_time, &stream->time_base));
probe_str("duration",
time_value_string(VAR_3, sizeof(VAR_3),
stream->duration, &stream->time_base));
if (stream->nb_frames)
probe_int("nb_frames", stream->nb_frames);
probe_dict(stream->metadata, "tags");
probe_object_footer("stream");
}
|
[
"static void FUNC_0(AVFormatContext *VAR_0, int VAR_1)\n{",
"AVStream *stream = VAR_0->streams[VAR_1];",
"AVCodecContext *dec_ctx;",
"AVCodec *dec;",
"const char *VAR_2;",
"char VAR_3[128];",
"AVRational display_aspect_ratio;",
"probe_object_header(\"stream\");",
"probe_int(\"index\", stream->index);",
"if ((dec_ctx = stream->codec)) {",
"if ((dec = dec_ctx->codec)) {",
"probe_str(\"codec_name\", dec->name);",
"probe_str(\"codec_long_name\", dec->long_name);",
"} else {",
"probe_str(\"codec_name\", \"unknown\");",
"}",
"probe_str(\"codec_type\", media_type_string(dec_ctx->codec_type));",
"probe_str(\"codec_time_base\",\nrational_string(VAR_3, sizeof(VAR_3),\n\"/\", &dec_ctx->time_base));",
"av_get_codec_tag_string(VAR_3, sizeof(VAR_3), dec_ctx->codec_tag);",
"probe_str(\"codec_tag_string\", VAR_3);",
"probe_str(\"codec_tag\", tag_string(VAR_3, sizeof(VAR_3),\ndec_ctx->codec_tag));",
"if (dec && (VAR_2 = av_get_profile_name(dec, dec_ctx->VAR_2)))\nprobe_str(\"VAR_2\", VAR_2);",
"switch (dec_ctx->codec_type) {",
"case AVMEDIA_TYPE_VIDEO:\nprobe_int(\"width\", dec_ctx->width);",
"probe_int(\"height\", dec_ctx->height);",
"probe_int(\"has_b_frames\", dec_ctx->has_b_frames);",
"if (dec_ctx->sample_aspect_ratio.num) {",
"probe_str(\"sample_aspect_ratio\",\nrational_string(VAR_3, sizeof(VAR_3), \":\",\n&dec_ctx->sample_aspect_ratio));",
"av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,\ndec_ctx->width * dec_ctx->sample_aspect_ratio.num,\ndec_ctx->height * dec_ctx->sample_aspect_ratio.den,\n1024*1024);",
"probe_str(\"display_aspect_ratio\",\nrational_string(VAR_3, sizeof(VAR_3), \":\",\n&display_aspect_ratio));",
"}",
"probe_str(\"pix_fmt\",\ndec_ctx->pix_fmt != PIX_FMT_NONE ? av_pix_fmt_descriptors[dec_ctx->pix_fmt].name\n: \"unknown\");",
"probe_int(\"level\", dec_ctx->level);",
"break;",
"case AVMEDIA_TYPE_AUDIO:\nprobe_str(\"sample_rate\",\nvalue_string(VAR_3, sizeof(VAR_3),\ndec_ctx->sample_rate,\nunit_hertz_str));",
"probe_int(\"channels\", dec_ctx->channels);",
"probe_int(\"bits_per_sample\",\nav_get_bits_per_sample(dec_ctx->codec_id));",
"break;",
"}",
"} else {",
"probe_str(\"codec_type\", \"unknown\");",
"}",
"if (VAR_0->iformat->flags & AVFMT_SHOW_IDS)\nprobe_int(\"id\", stream->id);",
"probe_str(\"r_frame_rate\",\nrational_string(VAR_3, sizeof(VAR_3), \"/\",\n&stream->r_frame_rate));",
"probe_str(\"avg_frame_rate\",\nrational_string(VAR_3, sizeof(VAR_3), \"/\",\n&stream->avg_frame_rate));",
"probe_str(\"time_base\",\nrational_string(VAR_3, sizeof(VAR_3), \"/\",\n&stream->time_base));",
"probe_str(\"start_time\",\ntime_value_string(VAR_3, sizeof(VAR_3),\nstream->start_time, &stream->time_base));",
"probe_str(\"duration\",\ntime_value_string(VAR_3, sizeof(VAR_3),\nstream->duration, &stream->time_base));",
"if (stream->nb_frames)\nprobe_int(\"nb_frames\", stream->nb_frames);",
"probe_dict(stream->metadata, \"tags\");",
"probe_object_footer(\"stream\");",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
23
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
43
],
[
45,
47,
49
],
[
55
],
[
57
],
[
59,
61
],
[
67,
69
],
[
73
],
[
75,
77
],
[
79
],
[
81
],
[
83
],
[
85,
87,
89
],
[
91,
93,
95,
97
],
[
99,
101,
103
],
[
105
],
[
107,
109,
111
],
[
113
],
[
115
],
[
119,
121,
123,
125,
127
],
[
129
],
[
131,
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
147,
149
],
[
151,
153,
155
],
[
157,
159,
161
],
[
163,
165,
167
],
[
169,
171,
173
],
[
175,
177,
179
],
[
181,
183
],
[
187
],
[
191
],
[
193
]
] |
9,620 |
static int is_not_zero(const uint8_t *sector, int len)
{
/*
* Use long as the biggest available internal data type that fits into the
* CPU register and unroll the loop to smooth out the effect of memory
* latency.
*/
int i;
long d0, d1, d2, d3;
const long * const data = (const long *) sector;
len /= sizeof(long);
for(i = 0; i < len; i += 4) {
d0 = data[i + 0];
d1 = data[i + 1];
d2 = data[i + 2];
d3 = data[i + 3];
if (d0 || d1 || d2 || d3) {
return 1;
}
}
return 0;
}
| false |
qemu
|
1a6d39fd71ddf90c5b76026cac4d5ff51fbaf8d8
|
static int is_not_zero(const uint8_t *sector, int len)
{
int i;
long d0, d1, d2, d3;
const long * const data = (const long *) sector;
len /= sizeof(long);
for(i = 0; i < len; i += 4) {
d0 = data[i + 0];
d1 = data[i + 1];
d2 = data[i + 2];
d3 = data[i + 3];
if (d0 || d1 || d2 || d3) {
return 1;
}
}
return 0;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(const uint8_t *VAR_0, int VAR_1)
{
int VAR_2;
long VAR_3, VAR_4, VAR_5, VAR_6;
const long * const VAR_7 = (const long *) VAR_0;
VAR_1 /= sizeof(long);
for(VAR_2 = 0; VAR_2 < VAR_1; VAR_2 += 4) {
VAR_3 = VAR_7[VAR_2 + 0];
VAR_4 = VAR_7[VAR_2 + 1];
VAR_5 = VAR_7[VAR_2 + 2];
VAR_6 = VAR_7[VAR_2 + 3];
if (VAR_3 || VAR_4 || VAR_5 || VAR_6) {
return 1;
}
}
return 0;
}
|
[
"static int FUNC_0(const uint8_t *VAR_0, int VAR_1)\n{",
"int VAR_2;",
"long VAR_3, VAR_4, VAR_5, VAR_6;",
"const long * const VAR_7 = (const long *) VAR_0;",
"VAR_1 /= sizeof(long);",
"for(VAR_2 = 0; VAR_2 < VAR_1; VAR_2 += 4) {",
"VAR_3 = VAR_7[VAR_2 + 0];",
"VAR_4 = VAR_7[VAR_2 + 1];",
"VAR_5 = VAR_7[VAR_2 + 2];",
"VAR_6 = VAR_7[VAR_2 + 3];",
"if (VAR_3 || VAR_4 || VAR_5 || VAR_6) {",
"return 1;",
"}",
"}",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
17
],
[
19
],
[
21
],
[
25
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
41
],
[
43
],
[
45
],
[
47
],
[
51
],
[
53
]
] |
9,621 |
static void taihu_405ep_init(ram_addr_t ram_size,
const char *boot_device,
const char *kernel_filename,
const char *kernel_cmdline,
const char *initrd_filename,
const char *cpu_model)
{
char *filename;
CPUPPCState *env;
qemu_irq *pic;
ram_addr_t bios_offset;
target_phys_addr_t ram_bases[2], ram_sizes[2];
target_ulong bios_size;
target_ulong kernel_base, kernel_size, initrd_base, initrd_size;
int linux_boot;
int fl_idx, fl_sectors;
DriveInfo *dinfo;
/* RAM is soldered to the board so the size cannot be changed */
ram_bases[0] = qemu_ram_alloc(NULL, "taihu_405ep.ram-0", 0x04000000);
ram_sizes[0] = 0x04000000;
ram_bases[1] = qemu_ram_alloc(NULL, "taihu_405ep.ram-1", 0x04000000);
ram_sizes[1] = 0x04000000;
ram_size = 0x08000000;
#ifdef DEBUG_BOARD_INIT
printf("%s: register cpu\n", __func__);
#endif
env = ppc405ep_init(ram_bases, ram_sizes, 33333333, &pic,
kernel_filename == NULL ? 0 : 1);
/* allocate and load BIOS */
#ifdef DEBUG_BOARD_INIT
printf("%s: register BIOS\n", __func__);
#endif
fl_idx = 0;
#if defined(USE_FLASH_BIOS)
dinfo = drive_get(IF_PFLASH, 0, fl_idx);
if (dinfo) {
bios_size = bdrv_getlength(dinfo->bdrv);
/* XXX: should check that size is 2MB */
// bios_size = 2 * 1024 * 1024;
fl_sectors = (bios_size + 65535) >> 16;
bios_offset = qemu_ram_alloc(NULL, "taihu_405ep.bios", bios_size);
#ifdef DEBUG_BOARD_INIT
printf("Register parallel flash %d size " TARGET_FMT_lx
" at offset %08lx addr " TARGET_FMT_lx " '%s' %d\n",
fl_idx, bios_size, bios_offset, -bios_size,
bdrv_get_device_name(dinfo->bdrv), fl_sectors);
#endif
pflash_cfi02_register((uint32_t)(-bios_size), bios_offset,
dinfo->bdrv, 65536, fl_sectors, 1,
4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
1);
fl_idx++;
} else
#endif
{
#ifdef DEBUG_BOARD_INIT
printf("Load BIOS from file\n");
#endif
if (bios_name == NULL)
bios_name = BIOS_FILENAME;
bios_offset = qemu_ram_alloc(NULL, "taihu_405ep.bios", BIOS_SIZE);
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
if (filename) {
bios_size = load_image(filename, qemu_get_ram_ptr(bios_offset));
} else {
bios_size = -1;
}
if (bios_size < 0 || bios_size > BIOS_SIZE) {
fprintf(stderr, "qemu: could not load PowerPC bios '%s'\n",
bios_name);
exit(1);
}
bios_size = (bios_size + 0xfff) & ~0xfff;
cpu_register_physical_memory((uint32_t)(-bios_size),
bios_size, bios_offset | IO_MEM_ROM);
}
/* Register Linux flash */
dinfo = drive_get(IF_PFLASH, 0, fl_idx);
if (dinfo) {
bios_size = bdrv_getlength(dinfo->bdrv);
/* XXX: should check that size is 32MB */
bios_size = 32 * 1024 * 1024;
fl_sectors = (bios_size + 65535) >> 16;
#ifdef DEBUG_BOARD_INIT
printf("Register parallel flash %d size " TARGET_FMT_lx
" at offset %08lx addr " TARGET_FMT_lx " '%s'\n",
fl_idx, bios_size, bios_offset, (target_ulong)0xfc000000,
bdrv_get_device_name(dinfo->bdrv));
#endif
bios_offset = qemu_ram_alloc(NULL, "taihu_405ep.flash", bios_size);
pflash_cfi02_register(0xfc000000, bios_offset,
dinfo->bdrv, 65536, fl_sectors, 1,
4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
1);
fl_idx++;
}
/* Register CLPD & LCD display */
#ifdef DEBUG_BOARD_INIT
printf("%s: register CPLD\n", __func__);
#endif
taihu_cpld_init(0x50100000);
/* Load kernel */
linux_boot = (kernel_filename != NULL);
if (linux_boot) {
#ifdef DEBUG_BOARD_INIT
printf("%s: load kernel\n", __func__);
#endif
kernel_base = KERNEL_LOAD_ADDR;
/* now we can load the kernel */
kernel_size = load_image_targphys(kernel_filename, kernel_base,
ram_size - kernel_base);
if (kernel_size < 0) {
fprintf(stderr, "qemu: could not load kernel '%s'\n",
kernel_filename);
exit(1);
}
/* load initrd */
if (initrd_filename) {
initrd_base = INITRD_LOAD_ADDR;
initrd_size = load_image_targphys(initrd_filename, initrd_base,
ram_size - initrd_base);
if (initrd_size < 0) {
fprintf(stderr,
"qemu: could not load initial ram disk '%s'\n",
initrd_filename);
exit(1);
}
} else {
initrd_base = 0;
initrd_size = 0;
}
} else {
kernel_base = 0;
kernel_size = 0;
initrd_base = 0;
initrd_size = 0;
}
#ifdef DEBUG_BOARD_INIT
printf("%s: Done\n", __func__);
#endif
}
| false |
qemu
|
093209cd681fe9fb65bd8a1c2ff711b8168bbfcd
|
static void taihu_405ep_init(ram_addr_t ram_size,
const char *boot_device,
const char *kernel_filename,
const char *kernel_cmdline,
const char *initrd_filename,
const char *cpu_model)
{
char *filename;
CPUPPCState *env;
qemu_irq *pic;
ram_addr_t bios_offset;
target_phys_addr_t ram_bases[2], ram_sizes[2];
target_ulong bios_size;
target_ulong kernel_base, kernel_size, initrd_base, initrd_size;
int linux_boot;
int fl_idx, fl_sectors;
DriveInfo *dinfo;
ram_bases[0] = qemu_ram_alloc(NULL, "taihu_405ep.ram-0", 0x04000000);
ram_sizes[0] = 0x04000000;
ram_bases[1] = qemu_ram_alloc(NULL, "taihu_405ep.ram-1", 0x04000000);
ram_sizes[1] = 0x04000000;
ram_size = 0x08000000;
#ifdef DEBUG_BOARD_INIT
printf("%s: register cpu\n", __func__);
#endif
env = ppc405ep_init(ram_bases, ram_sizes, 33333333, &pic,
kernel_filename == NULL ? 0 : 1);
#ifdef DEBUG_BOARD_INIT
printf("%s: register BIOS\n", __func__);
#endif
fl_idx = 0;
#if defined(USE_FLASH_BIOS)
dinfo = drive_get(IF_PFLASH, 0, fl_idx);
if (dinfo) {
bios_size = bdrv_getlength(dinfo->bdrv);
fl_sectors = (bios_size + 65535) >> 16;
bios_offset = qemu_ram_alloc(NULL, "taihu_405ep.bios", bios_size);
#ifdef DEBUG_BOARD_INIT
printf("Register parallel flash %d size " TARGET_FMT_lx
" at offset %08lx addr " TARGET_FMT_lx " '%s' %d\n",
fl_idx, bios_size, bios_offset, -bios_size,
bdrv_get_device_name(dinfo->bdrv), fl_sectors);
#endif
pflash_cfi02_register((uint32_t)(-bios_size), bios_offset,
dinfo->bdrv, 65536, fl_sectors, 1,
4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
1);
fl_idx++;
} else
#endif
{
#ifdef DEBUG_BOARD_INIT
printf("Load BIOS from file\n");
#endif
if (bios_name == NULL)
bios_name = BIOS_FILENAME;
bios_offset = qemu_ram_alloc(NULL, "taihu_405ep.bios", BIOS_SIZE);
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
if (filename) {
bios_size = load_image(filename, qemu_get_ram_ptr(bios_offset));
} else {
bios_size = -1;
}
if (bios_size < 0 || bios_size > BIOS_SIZE) {
fprintf(stderr, "qemu: could not load PowerPC bios '%s'\n",
bios_name);
exit(1);
}
bios_size = (bios_size + 0xfff) & ~0xfff;
cpu_register_physical_memory((uint32_t)(-bios_size),
bios_size, bios_offset | IO_MEM_ROM);
}
dinfo = drive_get(IF_PFLASH, 0, fl_idx);
if (dinfo) {
bios_size = bdrv_getlength(dinfo->bdrv);
bios_size = 32 * 1024 * 1024;
fl_sectors = (bios_size + 65535) >> 16;
#ifdef DEBUG_BOARD_INIT
printf("Register parallel flash %d size " TARGET_FMT_lx
" at offset %08lx addr " TARGET_FMT_lx " '%s'\n",
fl_idx, bios_size, bios_offset, (target_ulong)0xfc000000,
bdrv_get_device_name(dinfo->bdrv));
#endif
bios_offset = qemu_ram_alloc(NULL, "taihu_405ep.flash", bios_size);
pflash_cfi02_register(0xfc000000, bios_offset,
dinfo->bdrv, 65536, fl_sectors, 1,
4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
1);
fl_idx++;
}
#ifdef DEBUG_BOARD_INIT
printf("%s: register CPLD\n", __func__);
#endif
taihu_cpld_init(0x50100000);
linux_boot = (kernel_filename != NULL);
if (linux_boot) {
#ifdef DEBUG_BOARD_INIT
printf("%s: load kernel\n", __func__);
#endif
kernel_base = KERNEL_LOAD_ADDR;
kernel_size = load_image_targphys(kernel_filename, kernel_base,
ram_size - kernel_base);
if (kernel_size < 0) {
fprintf(stderr, "qemu: could not load kernel '%s'\n",
kernel_filename);
exit(1);
}
if (initrd_filename) {
initrd_base = INITRD_LOAD_ADDR;
initrd_size = load_image_targphys(initrd_filename, initrd_base,
ram_size - initrd_base);
if (initrd_size < 0) {
fprintf(stderr,
"qemu: could not load initial ram disk '%s'\n",
initrd_filename);
exit(1);
}
} else {
initrd_base = 0;
initrd_size = 0;
}
} else {
kernel_base = 0;
kernel_size = 0;
initrd_base = 0;
initrd_size = 0;
}
#ifdef DEBUG_BOARD_INIT
printf("%s: Done\n", __func__);
#endif
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(ram_addr_t VAR_0,
const char *VAR_1,
const char *VAR_2,
const char *VAR_3,
const char *VAR_4,
const char *VAR_5)
{
char *VAR_6;
CPUPPCState *env;
qemu_irq *pic;
ram_addr_t bios_offset;
target_phys_addr_t ram_bases[2], ram_sizes[2];
target_ulong bios_size;
target_ulong kernel_base, kernel_size, initrd_base, initrd_size;
int VAR_7;
int VAR_8, VAR_9;
DriveInfo *dinfo;
ram_bases[0] = qemu_ram_alloc(NULL, "taihu_405ep.ram-0", 0x04000000);
ram_sizes[0] = 0x04000000;
ram_bases[1] = qemu_ram_alloc(NULL, "taihu_405ep.ram-1", 0x04000000);
ram_sizes[1] = 0x04000000;
VAR_0 = 0x08000000;
#ifdef DEBUG_BOARD_INIT
printf("%s: register cpu\n", __func__);
#endif
env = ppc405ep_init(ram_bases, ram_sizes, 33333333, &pic,
VAR_2 == NULL ? 0 : 1);
#ifdef DEBUG_BOARD_INIT
printf("%s: register BIOS\n", __func__);
#endif
VAR_8 = 0;
#if defined(USE_FLASH_BIOS)
dinfo = drive_get(IF_PFLASH, 0, VAR_8);
if (dinfo) {
bios_size = bdrv_getlength(dinfo->bdrv);
VAR_9 = (bios_size + 65535) >> 16;
bios_offset = qemu_ram_alloc(NULL, "taihu_405ep.bios", bios_size);
#ifdef DEBUG_BOARD_INIT
printf("Register parallel flash %d size " TARGET_FMT_lx
" at offset %08lx addr " TARGET_FMT_lx " '%s' %d\n",
VAR_8, bios_size, bios_offset, -bios_size,
bdrv_get_device_name(dinfo->bdrv), VAR_9);
#endif
pflash_cfi02_register((uint32_t)(-bios_size), bios_offset,
dinfo->bdrv, 65536, VAR_9, 1,
4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
1);
VAR_8++;
} else
#endif
{
#ifdef DEBUG_BOARD_INIT
printf("Load BIOS from file\n");
#endif
if (bios_name == NULL)
bios_name = BIOS_FILENAME;
bios_offset = qemu_ram_alloc(NULL, "taihu_405ep.bios", BIOS_SIZE);
VAR_6 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
if (VAR_6) {
bios_size = load_image(VAR_6, qemu_get_ram_ptr(bios_offset));
} else {
bios_size = -1;
}
if (bios_size < 0 || bios_size > BIOS_SIZE) {
fprintf(stderr, "qemu: could not load PowerPC bios '%s'\n",
bios_name);
exit(1);
}
bios_size = (bios_size + 0xfff) & ~0xfff;
cpu_register_physical_memory((uint32_t)(-bios_size),
bios_size, bios_offset | IO_MEM_ROM);
}
dinfo = drive_get(IF_PFLASH, 0, VAR_8);
if (dinfo) {
bios_size = bdrv_getlength(dinfo->bdrv);
bios_size = 32 * 1024 * 1024;
VAR_9 = (bios_size + 65535) >> 16;
#ifdef DEBUG_BOARD_INIT
printf("Register parallel flash %d size " TARGET_FMT_lx
" at offset %08lx addr " TARGET_FMT_lx " '%s'\n",
VAR_8, bios_size, bios_offset, (target_ulong)0xfc000000,
bdrv_get_device_name(dinfo->bdrv));
#endif
bios_offset = qemu_ram_alloc(NULL, "taihu_405ep.flash", bios_size);
pflash_cfi02_register(0xfc000000, bios_offset,
dinfo->bdrv, 65536, VAR_9, 1,
4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
1);
VAR_8++;
}
#ifdef DEBUG_BOARD_INIT
printf("%s: register CPLD\n", __func__);
#endif
taihu_cpld_init(0x50100000);
VAR_7 = (VAR_2 != NULL);
if (VAR_7) {
#ifdef DEBUG_BOARD_INIT
printf("%s: load kernel\n", __func__);
#endif
kernel_base = KERNEL_LOAD_ADDR;
kernel_size = load_image_targphys(VAR_2, kernel_base,
VAR_0 - kernel_base);
if (kernel_size < 0) {
fprintf(stderr, "qemu: could not load kernel '%s'\n",
VAR_2);
exit(1);
}
if (VAR_4) {
initrd_base = INITRD_LOAD_ADDR;
initrd_size = load_image_targphys(VAR_4, initrd_base,
VAR_0 - initrd_base);
if (initrd_size < 0) {
fprintf(stderr,
"qemu: could not load initial ram disk '%s'\n",
VAR_4);
exit(1);
}
} else {
initrd_base = 0;
initrd_size = 0;
}
} else {
kernel_base = 0;
kernel_size = 0;
initrd_base = 0;
initrd_size = 0;
}
#ifdef DEBUG_BOARD_INIT
printf("%s: Done\n", __func__);
#endif
}
|
[
"static void FUNC_0(ram_addr_t VAR_0,\nconst char *VAR_1,\nconst char *VAR_2,\nconst char *VAR_3,\nconst char *VAR_4,\nconst char *VAR_5)\n{",
"char *VAR_6;",
"CPUPPCState *env;",
"qemu_irq *pic;",
"ram_addr_t bios_offset;",
"target_phys_addr_t ram_bases[2], ram_sizes[2];",
"target_ulong bios_size;",
"target_ulong kernel_base, kernel_size, initrd_base, initrd_size;",
"int VAR_7;",
"int VAR_8, VAR_9;",
"DriveInfo *dinfo;",
"ram_bases[0] = qemu_ram_alloc(NULL, \"taihu_405ep.ram-0\", 0x04000000);",
"ram_sizes[0] = 0x04000000;",
"ram_bases[1] = qemu_ram_alloc(NULL, \"taihu_405ep.ram-1\", 0x04000000);",
"ram_sizes[1] = 0x04000000;",
"VAR_0 = 0x08000000;",
"#ifdef DEBUG_BOARD_INIT\nprintf(\"%s: register cpu\\n\", __func__);",
"#endif\nenv = ppc405ep_init(ram_bases, ram_sizes, 33333333, &pic,\nVAR_2 == NULL ? 0 : 1);",
"#ifdef DEBUG_BOARD_INIT\nprintf(\"%s: register BIOS\\n\", __func__);",
"#endif\nVAR_8 = 0;",
"#if defined(USE_FLASH_BIOS)\ndinfo = drive_get(IF_PFLASH, 0, VAR_8);",
"if (dinfo) {",
"bios_size = bdrv_getlength(dinfo->bdrv);",
"VAR_9 = (bios_size + 65535) >> 16;",
"bios_offset = qemu_ram_alloc(NULL, \"taihu_405ep.bios\", bios_size);",
"#ifdef DEBUG_BOARD_INIT\nprintf(\"Register parallel flash %d size \" TARGET_FMT_lx\n\" at offset %08lx addr \" TARGET_FMT_lx \" '%s' %d\\n\",\nVAR_8, bios_size, bios_offset, -bios_size,\nbdrv_get_device_name(dinfo->bdrv), VAR_9);",
"#endif\npflash_cfi02_register((uint32_t)(-bios_size), bios_offset,\ndinfo->bdrv, 65536, VAR_9, 1,\n4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,\n1);",
"VAR_8++;",
"} else",
"#endif\n{",
"#ifdef DEBUG_BOARD_INIT\nprintf(\"Load BIOS from file\\n\");",
"#endif\nif (bios_name == NULL)\nbios_name = BIOS_FILENAME;",
"bios_offset = qemu_ram_alloc(NULL, \"taihu_405ep.bios\", BIOS_SIZE);",
"VAR_6 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);",
"if (VAR_6) {",
"bios_size = load_image(VAR_6, qemu_get_ram_ptr(bios_offset));",
"} else {",
"bios_size = -1;",
"}",
"if (bios_size < 0 || bios_size > BIOS_SIZE) {",
"fprintf(stderr, \"qemu: could not load PowerPC bios '%s'\\n\",\nbios_name);",
"exit(1);",
"}",
"bios_size = (bios_size + 0xfff) & ~0xfff;",
"cpu_register_physical_memory((uint32_t)(-bios_size),\nbios_size, bios_offset | IO_MEM_ROM);",
"}",
"dinfo = drive_get(IF_PFLASH, 0, VAR_8);",
"if (dinfo) {",
"bios_size = bdrv_getlength(dinfo->bdrv);",
"bios_size = 32 * 1024 * 1024;",
"VAR_9 = (bios_size + 65535) >> 16;",
"#ifdef DEBUG_BOARD_INIT\nprintf(\"Register parallel flash %d size \" TARGET_FMT_lx\n\" at offset %08lx addr \" TARGET_FMT_lx \" '%s'\\n\",\nVAR_8, bios_size, bios_offset, (target_ulong)0xfc000000,\nbdrv_get_device_name(dinfo->bdrv));",
"#endif\nbios_offset = qemu_ram_alloc(NULL, \"taihu_405ep.flash\", bios_size);",
"pflash_cfi02_register(0xfc000000, bios_offset,\ndinfo->bdrv, 65536, VAR_9, 1,\n4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,\n1);",
"VAR_8++;",
"}",
"#ifdef DEBUG_BOARD_INIT\nprintf(\"%s: register CPLD\\n\", __func__);",
"#endif\ntaihu_cpld_init(0x50100000);",
"VAR_7 = (VAR_2 != NULL);",
"if (VAR_7) {",
"#ifdef DEBUG_BOARD_INIT\nprintf(\"%s: load kernel\\n\", __func__);",
"#endif\nkernel_base = KERNEL_LOAD_ADDR;",
"kernel_size = load_image_targphys(VAR_2, kernel_base,\nVAR_0 - kernel_base);",
"if (kernel_size < 0) {",
"fprintf(stderr, \"qemu: could not load kernel '%s'\\n\",\nVAR_2);",
"exit(1);",
"}",
"if (VAR_4) {",
"initrd_base = INITRD_LOAD_ADDR;",
"initrd_size = load_image_targphys(VAR_4, initrd_base,\nVAR_0 - initrd_base);",
"if (initrd_size < 0) {",
"fprintf(stderr,\n\"qemu: could not load initial ram disk '%s'\\n\",\nVAR_4);",
"exit(1);",
"}",
"} else {",
"initrd_base = 0;",
"initrd_size = 0;",
"}",
"} else {",
"kernel_base = 0;",
"kernel_size = 0;",
"initrd_base = 0;",
"initrd_size = 0;",
"}",
"#ifdef DEBUG_BOARD_INIT\nprintf(\"%s: Done\\n\", __func__);",
"#endif\n}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5,
7,
9,
11,
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49,
51
],
[
53,
55,
57
],
[
61,
63
],
[
65,
67
],
[
69,
71
],
[
73
],
[
75
],
[
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
],
[
157
],
[
159
],
[
161
],
[
165
],
[
167
],
[
169,
171,
173,
175,
177
],
[
179,
181
],
[
183,
185,
187,
189
],
[
191
],
[
193
],
[
197,
199
],
[
201,
203
],
[
207
],
[
209
],
[
211,
213
],
[
215,
217
],
[
221,
223
],
[
225
],
[
227,
229
],
[
231
],
[
233
],
[
237
],
[
239
],
[
241,
243
],
[
245
],
[
247,
249,
251
],
[
253
],
[
255
],
[
257
],
[
259
],
[
261
],
[
263
],
[
265
],
[
267
],
[
269
],
[
271
],
[
273
],
[
275
],
[
277,
279
],
[
281,
283
]
] |
9,622 |
static int decode_frame_header (bit_buffer_t *bitbuf,MpegEncContext *s) {
int frame_size_code;
/* unknown field */
get_bits (bitbuf, 8);
/* frame type */
s->pict_type = get_bits (bitbuf, 2);
if (s->pict_type == 3)
return -1;
if (s->pict_type == SVQ1_FRAME_INTRA) {
/* unknown fields */
if (s->f_code == 0x50 || s->f_code == 0x60) {
get_bits (bitbuf, 16);
}
if ((s->f_code ^ 0x10) >= 0x50) {
skip_bits(bitbuf,8*get_bits (bitbuf, 8));
}
get_bits (bitbuf, 2);
get_bits (bitbuf, 2);
get_bits (bitbuf, 1);
/* load frame size */
frame_size_code = get_bits (bitbuf, 3);
if (frame_size_code == 7) {
/* load width, height (12 bits each) */
s->width = get_bits (bitbuf, 12);
s->height = get_bits (bitbuf, 12);
if (!s->width || !s->height)
return -1;
} else {
/* get width, height from table */
s->width = frame_size_table[frame_size_code].width;
s->height = frame_size_table[frame_size_code].height;
}
}
/* unknown fields */
if (get_bits (bitbuf, 1) == 1) {
get_bits (bitbuf, 1);
get_bits (bitbuf, 1);
if (get_bits (bitbuf, 2) != 0)
return -1;
}
if (get_bits (bitbuf, 1) == 1) {
get_bits (bitbuf, 1);
get_bits (bitbuf, 4);
get_bits (bitbuf, 1);
get_bits (bitbuf, 2);
while (get_bits (bitbuf, 1) == 1) {
get_bits (bitbuf, 8);
}
}
return 0;
}
| false |
FFmpeg
|
82dd7d0dec29ee59af91ce18c29eb151b363ff37
|
static int decode_frame_header (bit_buffer_t *bitbuf,MpegEncContext *s) {
int frame_size_code;
get_bits (bitbuf, 8);
s->pict_type = get_bits (bitbuf, 2);
if (s->pict_type == 3)
return -1;
if (s->pict_type == SVQ1_FRAME_INTRA) {
if (s->f_code == 0x50 || s->f_code == 0x60) {
get_bits (bitbuf, 16);
}
if ((s->f_code ^ 0x10) >= 0x50) {
skip_bits(bitbuf,8*get_bits (bitbuf, 8));
}
get_bits (bitbuf, 2);
get_bits (bitbuf, 2);
get_bits (bitbuf, 1);
frame_size_code = get_bits (bitbuf, 3);
if (frame_size_code == 7) {
s->width = get_bits (bitbuf, 12);
s->height = get_bits (bitbuf, 12);
if (!s->width || !s->height)
return -1;
} else {
s->width = frame_size_table[frame_size_code].width;
s->height = frame_size_table[frame_size_code].height;
}
}
if (get_bits (bitbuf, 1) == 1) {
get_bits (bitbuf, 1);
get_bits (bitbuf, 1);
if (get_bits (bitbuf, 2) != 0)
return -1;
}
if (get_bits (bitbuf, 1) == 1) {
get_bits (bitbuf, 1);
get_bits (bitbuf, 4);
get_bits (bitbuf, 1);
get_bits (bitbuf, 2);
while (get_bits (bitbuf, 1) == 1) {
get_bits (bitbuf, 8);
}
}
return 0;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0 (bit_buffer_t *VAR_0,MpegEncContext *VAR_1) {
int VAR_2;
get_bits (VAR_0, 8);
VAR_1->pict_type = get_bits (VAR_0, 2);
if (VAR_1->pict_type == 3)
return -1;
if (VAR_1->pict_type == SVQ1_FRAME_INTRA) {
if (VAR_1->f_code == 0x50 || VAR_1->f_code == 0x60) {
get_bits (VAR_0, 16);
}
if ((VAR_1->f_code ^ 0x10) >= 0x50) {
skip_bits(VAR_0,8*get_bits (VAR_0, 8));
}
get_bits (VAR_0, 2);
get_bits (VAR_0, 2);
get_bits (VAR_0, 1);
VAR_2 = get_bits (VAR_0, 3);
if (VAR_2 == 7) {
VAR_1->width = get_bits (VAR_0, 12);
VAR_1->height = get_bits (VAR_0, 12);
if (!VAR_1->width || !VAR_1->height)
return -1;
} else {
VAR_1->width = frame_size_table[VAR_2].width;
VAR_1->height = frame_size_table[VAR_2].height;
}
}
if (get_bits (VAR_0, 1) == 1) {
get_bits (VAR_0, 1);
get_bits (VAR_0, 1);
if (get_bits (VAR_0, 2) != 0)
return -1;
}
if (get_bits (VAR_0, 1) == 1) {
get_bits (VAR_0, 1);
get_bits (VAR_0, 4);
get_bits (VAR_0, 1);
get_bits (VAR_0, 2);
while (get_bits (VAR_0, 1) == 1) {
get_bits (VAR_0, 8);
}
}
return 0;
}
|
[
"static int FUNC_0 (bit_buffer_t *VAR_0,MpegEncContext *VAR_1) {",
"int VAR_2;",
"get_bits (VAR_0, 8);",
"VAR_1->pict_type = get_bits (VAR_0, 2);",
"if (VAR_1->pict_type == 3)\nreturn -1;",
"if (VAR_1->pict_type == SVQ1_FRAME_INTRA) {",
"if (VAR_1->f_code == 0x50 || VAR_1->f_code == 0x60) {",
"get_bits (VAR_0, 16);",
"}",
"if ((VAR_1->f_code ^ 0x10) >= 0x50) {",
"skip_bits(VAR_0,8*get_bits (VAR_0, 8));",
"}",
"get_bits (VAR_0, 2);",
"get_bits (VAR_0, 2);",
"get_bits (VAR_0, 1);",
"VAR_2 = get_bits (VAR_0, 3);",
"if (VAR_2 == 7) {",
"VAR_1->width = get_bits (VAR_0, 12);",
"VAR_1->height = get_bits (VAR_0, 12);",
"if (!VAR_1->width || !VAR_1->height)\nreturn -1;",
"} else {",
"VAR_1->width = frame_size_table[VAR_2].width;",
"VAR_1->height = frame_size_table[VAR_2].height;",
"}",
"}",
"if (get_bits (VAR_0, 1) == 1) {",
"get_bits (VAR_0, 1);",
"get_bits (VAR_0, 1);",
"if (get_bits (VAR_0, 2) != 0)\nreturn -1;",
"}",
"if (get_bits (VAR_0, 1) == 1) {",
"get_bits (VAR_0, 1);",
"get_bits (VAR_0, 4);",
"get_bits (VAR_0, 1);",
"get_bits (VAR_0, 2);",
"while (get_bits (VAR_0, 1) == 1) {",
"get_bits (VAR_0, 8);",
"}",
"}",
"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
],
[
9
],
[
15
],
[
19,
21
],
[
25
],
[
31
],
[
33
],
[
35
],
[
39
],
[
41
],
[
43
],
[
47
],
[
49
],
[
51
],
[
57
],
[
61
],
[
65
],
[
67
],
[
71,
73
],
[
75
],
[
79
],
[
81
],
[
83
],
[
85
],
[
91
],
[
93
],
[
95
],
[
99,
101
],
[
103
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
119
],
[
121
],
[
123
],
[
125
],
[
129
],
[
131
]
] |
9,623 |
static void posix_aio_read(void *opaque)
{
PosixAioState *s = opaque;
RawAIOCB *acb, **pacb;
int ret;
ssize_t len;
/* read all bytes from signal pipe */
for (;;) {
char bytes[16];
len = read(s->rfd, bytes, sizeof(bytes));
if (len == -1 && errno == EINTR)
continue; /* try again */
if (len == sizeof(bytes))
continue; /* more to read */
break;
}
for(;;) {
pacb = &s->first_aio;
for(;;) {
acb = *pacb;
if (!acb)
goto the_end;
ret = aio_error(&acb->aiocb);
if (ret == ECANCELED) {
/* remove the request */
*pacb = acb->next;
raw_fd_pool_put(acb);
qemu_aio_release(acb);
} else if (ret != EINPROGRESS) {
/* end of aio */
if (ret == 0) {
ret = aio_return(&acb->aiocb);
if (ret == acb->aiocb.aio_nbytes)
ret = 0;
else
ret = -EINVAL;
} else {
ret = -ret;
}
/* remove the request */
*pacb = acb->next;
/* call the callback */
acb->common.cb(acb->common.opaque, ret);
raw_fd_pool_put(acb);
qemu_aio_release(acb);
break;
} else {
pacb = &acb->next;
}
}
}
the_end: ;
}
| false |
qemu
|
3c529d935923a70519557d420db1d5a09a65086a
|
static void posix_aio_read(void *opaque)
{
PosixAioState *s = opaque;
RawAIOCB *acb, **pacb;
int ret;
ssize_t len;
for (;;) {
char bytes[16];
len = read(s->rfd, bytes, sizeof(bytes));
if (len == -1 && errno == EINTR)
continue;
if (len == sizeof(bytes))
continue;
break;
}
for(;;) {
pacb = &s->first_aio;
for(;;) {
acb = *pacb;
if (!acb)
goto the_end;
ret = aio_error(&acb->aiocb);
if (ret == ECANCELED) {
*pacb = acb->next;
raw_fd_pool_put(acb);
qemu_aio_release(acb);
} else if (ret != EINPROGRESS) {
if (ret == 0) {
ret = aio_return(&acb->aiocb);
if (ret == acb->aiocb.aio_nbytes)
ret = 0;
else
ret = -EINVAL;
} else {
ret = -ret;
}
*pacb = acb->next;
acb->common.cb(acb->common.opaque, ret);
raw_fd_pool_put(acb);
qemu_aio_release(acb);
break;
} else {
pacb = &acb->next;
}
}
}
the_end: ;
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(void *VAR_0)
{
PosixAioState *s = VAR_0;
RawAIOCB *acb, **pacb;
int VAR_1;
ssize_t len;
for (;;) {
char VAR_2[16];
len = read(s->rfd, VAR_2, sizeof(VAR_2));
if (len == -1 && errno == EINTR)
continue;
if (len == sizeof(VAR_2))
continue;
break;
}
for(;;) {
pacb = &s->first_aio;
for(;;) {
acb = *pacb;
if (!acb)
goto the_end;
VAR_1 = aio_error(&acb->aiocb);
if (VAR_1 == ECANCELED) {
*pacb = acb->next;
raw_fd_pool_put(acb);
qemu_aio_release(acb);
} else if (VAR_1 != EINPROGRESS) {
if (VAR_1 == 0) {
VAR_1 = aio_return(&acb->aiocb);
if (VAR_1 == acb->aiocb.aio_nbytes)
VAR_1 = 0;
else
VAR_1 = -EINVAL;
} else {
VAR_1 = -VAR_1;
}
*pacb = acb->next;
acb->common.cb(acb->common.VAR_0, VAR_1);
raw_fd_pool_put(acb);
qemu_aio_release(acb);
break;
} else {
pacb = &acb->next;
}
}
}
the_end: ;
}
|
[
"static void FUNC_0(void *VAR_0)\n{",
"PosixAioState *s = VAR_0;",
"RawAIOCB *acb, **pacb;",
"int VAR_1;",
"ssize_t len;",
"for (;;) {",
"char VAR_2[16];",
"len = read(s->rfd, VAR_2, sizeof(VAR_2));",
"if (len == -1 && errno == EINTR)\ncontinue;",
"if (len == sizeof(VAR_2))\ncontinue;",
"break;",
"}",
"for(;;) {",
"pacb = &s->first_aio;",
"for(;;) {",
"acb = *pacb;",
"if (!acb)\ngoto the_end;",
"VAR_1 = aio_error(&acb->aiocb);",
"if (VAR_1 == ECANCELED) {",
"*pacb = acb->next;",
"raw_fd_pool_put(acb);",
"qemu_aio_release(acb);",
"} else if (VAR_1 != EINPROGRESS) {",
"if (VAR_1 == 0) {",
"VAR_1 = aio_return(&acb->aiocb);",
"if (VAR_1 == acb->aiocb.aio_nbytes)\nVAR_1 = 0;",
"else\nVAR_1 = -EINVAL;",
"} else {",
"VAR_1 = -VAR_1;",
"}",
"*pacb = acb->next;",
"acb->common.cb(acb->common.VAR_0, VAR_1);",
"raw_fd_pool_put(acb);",
"qemu_aio_release(acb);",
"break;",
"} else {",
"pacb = &acb->next;",
"}",
"}",
"}",
"the_end: ;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
17
],
[
19
],
[
23
],
[
25,
27
],
[
29,
31
],
[
33
],
[
35
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47,
49
],
[
51
],
[
53
],
[
57
],
[
59
],
[
61
],
[
63
],
[
67
],
[
69
],
[
71,
73
],
[
75,
77
],
[
79
],
[
81
],
[
83
],
[
87
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
]
] |
9,624 |
static int usbredir_handle_data(USBDevice *udev, USBPacket *p)
{
USBRedirDevice *dev = DO_UPCAST(USBRedirDevice, dev, udev);
uint8_t ep;
ep = p->devep;
if (p->pid == USB_TOKEN_IN) {
ep |= USB_DIR_IN;
}
switch (dev->endpoint[EP2I(ep)].type) {
case USB_ENDPOINT_XFER_CONTROL:
ERROR("handle_data called for control transfer on ep %02X\n", ep);
return USB_RET_NAK;
case USB_ENDPOINT_XFER_ISOC:
return usbredir_handle_iso_data(dev, p, ep);
case USB_ENDPOINT_XFER_BULK:
return usbredir_handle_bulk_data(dev, p, ep);
case USB_ENDPOINT_XFER_INT:
return usbredir_handle_interrupt_data(dev, p, ep);
default:
ERROR("handle_data ep %02X has unknown type %d\n", ep,
dev->endpoint[EP2I(ep)].type);
return USB_RET_NAK;
}
}
| false |
qemu
|
079d0b7f1eedcc634c371fe05b617fdc55c8b762
|
static int usbredir_handle_data(USBDevice *udev, USBPacket *p)
{
USBRedirDevice *dev = DO_UPCAST(USBRedirDevice, dev, udev);
uint8_t ep;
ep = p->devep;
if (p->pid == USB_TOKEN_IN) {
ep |= USB_DIR_IN;
}
switch (dev->endpoint[EP2I(ep)].type) {
case USB_ENDPOINT_XFER_CONTROL:
ERROR("handle_data called for control transfer on ep %02X\n", ep);
return USB_RET_NAK;
case USB_ENDPOINT_XFER_ISOC:
return usbredir_handle_iso_data(dev, p, ep);
case USB_ENDPOINT_XFER_BULK:
return usbredir_handle_bulk_data(dev, p, ep);
case USB_ENDPOINT_XFER_INT:
return usbredir_handle_interrupt_data(dev, p, ep);
default:
ERROR("handle_data ep %02X has unknown type %d\n", ep,
dev->endpoint[EP2I(ep)].type);
return USB_RET_NAK;
}
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(USBDevice *VAR_0, USBPacket *VAR_1)
{
USBRedirDevice *dev = DO_UPCAST(USBRedirDevice, dev, VAR_0);
uint8_t ep;
ep = VAR_1->devep;
if (VAR_1->pid == USB_TOKEN_IN) {
ep |= USB_DIR_IN;
}
switch (dev->endpoint[EP2I(ep)].type) {
case USB_ENDPOINT_XFER_CONTROL:
ERROR("handle_data called for control transfer on ep %02X\n", ep);
return USB_RET_NAK;
case USB_ENDPOINT_XFER_ISOC:
return usbredir_handle_iso_data(dev, VAR_1, ep);
case USB_ENDPOINT_XFER_BULK:
return usbredir_handle_bulk_data(dev, VAR_1, ep);
case USB_ENDPOINT_XFER_INT:
return usbredir_handle_interrupt_data(dev, VAR_1, ep);
default:
ERROR("handle_data ep %02X has unknown type %d\n", ep,
dev->endpoint[EP2I(ep)].type);
return USB_RET_NAK;
}
}
|
[
"static int FUNC_0(USBDevice *VAR_0, USBPacket *VAR_1)\n{",
"USBRedirDevice *dev = DO_UPCAST(USBRedirDevice, dev, VAR_0);",
"uint8_t ep;",
"ep = VAR_1->devep;",
"if (VAR_1->pid == USB_TOKEN_IN) {",
"ep |= USB_DIR_IN;",
"}",
"switch (dev->endpoint[EP2I(ep)].type) {",
"case USB_ENDPOINT_XFER_CONTROL:\nERROR(\"handle_data called for control transfer on ep %02X\\n\", ep);",
"return USB_RET_NAK;",
"case USB_ENDPOINT_XFER_ISOC:\nreturn usbredir_handle_iso_data(dev, VAR_1, ep);",
"case USB_ENDPOINT_XFER_BULK:\nreturn usbredir_handle_bulk_data(dev, VAR_1, ep);",
"case USB_ENDPOINT_XFER_INT:\nreturn usbredir_handle_interrupt_data(dev, VAR_1, ep);",
"default:\nERROR(\"handle_data ep %02X has unknown type %d\\n\", ep,\ndev->endpoint[EP2I(ep)].type);",
"return USB_RET_NAK;",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
15
],
[
17
],
[
21
],
[
23,
25
],
[
27
],
[
29,
31
],
[
33,
35
],
[
37,
39
],
[
41,
43,
45
],
[
47
],
[
49
],
[
51
]
] |
9,625 |
int kvm_s390_vcpu_interrupt_post_load(S390CPU *cpu)
{
CPUState *cs = CPU(cpu);
struct kvm_s390_irq_state irq_state;
int r;
if (!kvm_check_extension(kvm_state, KVM_CAP_S390_IRQ_STATE)) {
return -ENOSYS;
}
if (cpu->irqstate_saved_size == 0) {
return 0;
}
irq_state.buf = (uint64_t) cpu->irqstate;
irq_state.len = cpu->irqstate_saved_size;
r = kvm_vcpu_ioctl(cs, KVM_S390_SET_IRQ_STATE, &irq_state);
if (r) {
error_report("Setting interrupt state failed %d", r);
}
return r;
}
| false |
qemu
|
b853d4cbf2062813e84f9bb880feff8daf467e05
|
int kvm_s390_vcpu_interrupt_post_load(S390CPU *cpu)
{
CPUState *cs = CPU(cpu);
struct kvm_s390_irq_state irq_state;
int r;
if (!kvm_check_extension(kvm_state, KVM_CAP_S390_IRQ_STATE)) {
return -ENOSYS;
}
if (cpu->irqstate_saved_size == 0) {
return 0;
}
irq_state.buf = (uint64_t) cpu->irqstate;
irq_state.len = cpu->irqstate_saved_size;
r = kvm_vcpu_ioctl(cs, KVM_S390_SET_IRQ_STATE, &irq_state);
if (r) {
error_report("Setting interrupt state failed %d", r);
}
return r;
}
|
{
"code": [],
"line_no": []
}
|
int FUNC_0(S390CPU *VAR_0)
{
CPUState *cs = CPU(VAR_0);
struct kvm_s390_irq_state VAR_1;
int VAR_2;
if (!kvm_check_extension(kvm_state, KVM_CAP_S390_IRQ_STATE)) {
return -ENOSYS;
}
if (VAR_0->irqstate_saved_size == 0) {
return 0;
}
VAR_1.buf = (uint64_t) VAR_0->irqstate;
VAR_1.len = VAR_0->irqstate_saved_size;
VAR_2 = kvm_vcpu_ioctl(cs, KVM_S390_SET_IRQ_STATE, &VAR_1);
if (VAR_2) {
error_report("Setting interrupt state failed %d", VAR_2);
}
return VAR_2;
}
|
[
"int FUNC_0(S390CPU *VAR_0)\n{",
"CPUState *cs = CPU(VAR_0);",
"struct kvm_s390_irq_state VAR_1;",
"int VAR_2;",
"if (!kvm_check_extension(kvm_state, KVM_CAP_S390_IRQ_STATE)) {",
"return -ENOSYS;",
"}",
"if (VAR_0->irqstate_saved_size == 0) {",
"return 0;",
"}",
"VAR_1.buf = (uint64_t) VAR_0->irqstate;",
"VAR_1.len = VAR_0->irqstate_saved_size;",
"VAR_2 = kvm_vcpu_ioctl(cs, KVM_S390_SET_IRQ_STATE, &VAR_1);",
"if (VAR_2) {",
"error_report(\"Setting interrupt state failed %d\", VAR_2);",
"}",
"return VAR_2;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
17
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
]
] |
9,626 |
void do_info_roms(Monitor *mon)
{
Rom *rom;
QTAILQ_FOREACH(rom, &roms, next) {
if (!rom->fw_file) {
monitor_printf(mon, "addr=" TARGET_FMT_plx
" size=0x%06zx mem=%s name=\"%s\" \n",
rom->addr, rom->romsize,
rom->isrom ? "rom" : "ram",
rom->name);
} else {
monitor_printf(mon, "fw=%s%s%s"
" size=0x%06zx name=\"%s\" \n",
rom->fw_dir ? rom->fw_dir : "",
rom->fw_dir ? "/" : "",
rom->fw_file,
rom->romsize,
rom->name);
}
}
}
| false |
qemu
|
bdb5ee3064d5ae786b0bcb6cf6ff4e3554a72990
|
void do_info_roms(Monitor *mon)
{
Rom *rom;
QTAILQ_FOREACH(rom, &roms, next) {
if (!rom->fw_file) {
monitor_printf(mon, "addr=" TARGET_FMT_plx
" size=0x%06zx mem=%s name=\"%s\" \n",
rom->addr, rom->romsize,
rom->isrom ? "rom" : "ram",
rom->name);
} else {
monitor_printf(mon, "fw=%s%s%s"
" size=0x%06zx name=\"%s\" \n",
rom->fw_dir ? rom->fw_dir : "",
rom->fw_dir ? "/" : "",
rom->fw_file,
rom->romsize,
rom->name);
}
}
}
|
{
"code": [],
"line_no": []
}
|
void FUNC_0(Monitor *VAR_0)
{
Rom *rom;
QTAILQ_FOREACH(rom, &roms, next) {
if (!rom->fw_file) {
monitor_printf(VAR_0, "addr=" TARGET_FMT_plx
" size=0x%06zx mem=%s name=\"%s\" \n",
rom->addr, rom->romsize,
rom->isrom ? "rom" : "ram",
rom->name);
} else {
monitor_printf(VAR_0, "fw=%s%s%s"
" size=0x%06zx name=\"%s\" \n",
rom->fw_dir ? rom->fw_dir : "",
rom->fw_dir ? "/" : "",
rom->fw_file,
rom->romsize,
rom->name);
}
}
}
|
[
"void FUNC_0(Monitor *VAR_0)\n{",
"Rom *rom;",
"QTAILQ_FOREACH(rom, &roms, next) {",
"if (!rom->fw_file) {",
"monitor_printf(VAR_0, \"addr=\" TARGET_FMT_plx\n\" size=0x%06zx mem=%s name=\\\"%s\\\" \\n\",\nrom->addr, rom->romsize,\nrom->isrom ? \"rom\" : \"ram\",\nrom->name);",
"} else {",
"monitor_printf(VAR_0, \"fw=%s%s%s\"\n\" size=0x%06zx name=\\\"%s\\\" \\n\",\nrom->fw_dir ? rom->fw_dir : \"\",\nrom->fw_dir ? \"/\" : \"\",\nrom->fw_file,\nrom->romsize,\nrom->name);",
"}",
"}",
"}"
] |
[
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,
33,
35,
37
],
[
39
],
[
41
],
[
43
]
] |
9,628 |
static void do_smbios_option(const char *optarg)
{
if (smbios_entry_add(optarg) < 0) {
fprintf(stderr, "Wrong smbios provided\n");
exit(1);
}
}
| false |
qemu
|
ad96090a01d848df67d70c5259ed8aa321fa8716
|
static void do_smbios_option(const char *optarg)
{
if (smbios_entry_add(optarg) < 0) {
fprintf(stderr, "Wrong smbios provided\n");
exit(1);
}
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(const char *VAR_0)
{
if (smbios_entry_add(VAR_0) < 0) {
fprintf(stderr, "Wrong smbios provided\n");
exit(1);
}
}
|
[
"static void FUNC_0(const char *VAR_0)\n{",
"if (smbios_entry_add(VAR_0) < 0) {",
"fprintf(stderr, \"Wrong smbios provided\\n\");",
"exit(1);",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
]
] |
9,631 |
static ExitStatus gen_store_conditional(DisasContext *ctx, int ra, int rb,
int32_t disp16, int quad)
{
TCGv addr;
if (ra == 31) {
/* ??? Don't bother storing anything. The user can't tell
the difference, since the zero register always reads zero. */
return NO_EXIT;
}
#if defined(CONFIG_USER_ONLY)
addr = cpu_lock_st_addr;
#else
addr = tcg_temp_local_new();
#endif
tcg_gen_addi_i64(addr, load_gpr(ctx, rb), disp16);
#if defined(CONFIG_USER_ONLY)
/* ??? This is handled via a complicated version of compare-and-swap
in the cpu_loop. Hopefully one day we'll have a real CAS opcode
in TCG so that this isn't necessary. */
return gen_excp(ctx, quad ? EXCP_STQ_C : EXCP_STL_C, ra);
#else
/* ??? In system mode we are never multi-threaded, so CAS can be
implemented via a non-atomic load-compare-store sequence. */
{
int lab_fail, lab_done;
TCGv val;
lab_fail = gen_new_label();
lab_done = gen_new_label();
tcg_gen_brcond_i64(TCG_COND_NE, addr, cpu_lock_addr, lab_fail);
val = tcg_temp_new();
tcg_gen_qemu_ld_i64(val, addr, ctx->mem_idx, quad ? MO_LEQ : MO_LESL);
tcg_gen_brcond_i64(TCG_COND_NE, val, cpu_lock_value, lab_fail);
tcg_gen_qemu_st_i64(cpu_ir[ra], addr, ctx->mem_idx,
quad ? MO_LEQ : MO_LEUL);
tcg_gen_movi_i64(cpu_ir[ra], 1);
tcg_gen_br(lab_done);
gen_set_label(lab_fail);
tcg_gen_movi_i64(cpu_ir[ra], 0);
gen_set_label(lab_done);
tcg_gen_movi_i64(cpu_lock_addr, -1);
tcg_temp_free(addr);
return NO_EXIT;
}
#endif
}
| false |
qemu
|
42a268c241183877192c376d03bd9b6d527407c7
|
static ExitStatus gen_store_conditional(DisasContext *ctx, int ra, int rb,
int32_t disp16, int quad)
{
TCGv addr;
if (ra == 31) {
return NO_EXIT;
}
#if defined(CONFIG_USER_ONLY)
addr = cpu_lock_st_addr;
#else
addr = tcg_temp_local_new();
#endif
tcg_gen_addi_i64(addr, load_gpr(ctx, rb), disp16);
#if defined(CONFIG_USER_ONLY)
return gen_excp(ctx, quad ? EXCP_STQ_C : EXCP_STL_C, ra);
#else
{
int lab_fail, lab_done;
TCGv val;
lab_fail = gen_new_label();
lab_done = gen_new_label();
tcg_gen_brcond_i64(TCG_COND_NE, addr, cpu_lock_addr, lab_fail);
val = tcg_temp_new();
tcg_gen_qemu_ld_i64(val, addr, ctx->mem_idx, quad ? MO_LEQ : MO_LESL);
tcg_gen_brcond_i64(TCG_COND_NE, val, cpu_lock_value, lab_fail);
tcg_gen_qemu_st_i64(cpu_ir[ra], addr, ctx->mem_idx,
quad ? MO_LEQ : MO_LEUL);
tcg_gen_movi_i64(cpu_ir[ra], 1);
tcg_gen_br(lab_done);
gen_set_label(lab_fail);
tcg_gen_movi_i64(cpu_ir[ra], 0);
gen_set_label(lab_done);
tcg_gen_movi_i64(cpu_lock_addr, -1);
tcg_temp_free(addr);
return NO_EXIT;
}
#endif
}
|
{
"code": [],
"line_no": []
}
|
static ExitStatus FUNC_0(DisasContext *ctx, int ra, int rb,
int32_t disp16, int quad)
{
TCGv addr;
if (ra == 31) {
return NO_EXIT;
}
#if defined(CONFIG_USER_ONLY)
addr = cpu_lock_st_addr;
#else
addr = tcg_temp_local_new();
#endif
tcg_gen_addi_i64(addr, load_gpr(ctx, rb), disp16);
#if defined(CONFIG_USER_ONLY)
return gen_excp(ctx, quad ? EXCP_STQ_C : EXCP_STL_C, ra);
#else
{
int VAR_0, VAR_1;
TCGv val;
VAR_0 = gen_new_label();
VAR_1 = gen_new_label();
tcg_gen_brcond_i64(TCG_COND_NE, addr, cpu_lock_addr, VAR_0);
val = tcg_temp_new();
tcg_gen_qemu_ld_i64(val, addr, ctx->mem_idx, quad ? MO_LEQ : MO_LESL);
tcg_gen_brcond_i64(TCG_COND_NE, val, cpu_lock_value, VAR_0);
tcg_gen_qemu_st_i64(cpu_ir[ra], addr, ctx->mem_idx,
quad ? MO_LEQ : MO_LEUL);
tcg_gen_movi_i64(cpu_ir[ra], 1);
tcg_gen_br(VAR_1);
gen_set_label(VAR_0);
tcg_gen_movi_i64(cpu_ir[ra], 0);
gen_set_label(VAR_1);
tcg_gen_movi_i64(cpu_lock_addr, -1);
tcg_temp_free(addr);
return NO_EXIT;
}
#endif
}
|
[
"static ExitStatus FUNC_0(DisasContext *ctx, int ra, int rb,\nint32_t disp16, int quad)\n{",
"TCGv addr;",
"if (ra == 31) {",
"return NO_EXIT;",
"}",
"#if defined(CONFIG_USER_ONLY)\naddr = cpu_lock_st_addr;",
"#else\naddr = tcg_temp_local_new();",
"#endif\ntcg_gen_addi_i64(addr, load_gpr(ctx, rb), disp16);",
"#if defined(CONFIG_USER_ONLY)\nreturn gen_excp(ctx, quad ? EXCP_STQ_C : EXCP_STL_C, ra);",
"#else\n{",
"int VAR_0, VAR_1;",
"TCGv val;",
"VAR_0 = gen_new_label();",
"VAR_1 = gen_new_label();",
"tcg_gen_brcond_i64(TCG_COND_NE, addr, cpu_lock_addr, VAR_0);",
"val = tcg_temp_new();",
"tcg_gen_qemu_ld_i64(val, addr, ctx->mem_idx, quad ? MO_LEQ : MO_LESL);",
"tcg_gen_brcond_i64(TCG_COND_NE, val, cpu_lock_value, VAR_0);",
"tcg_gen_qemu_st_i64(cpu_ir[ra], addr, ctx->mem_idx,\nquad ? MO_LEQ : MO_LEUL);",
"tcg_gen_movi_i64(cpu_ir[ra], 1);",
"tcg_gen_br(VAR_1);",
"gen_set_label(VAR_0);",
"tcg_gen_movi_i64(cpu_ir[ra], 0);",
"gen_set_label(VAR_1);",
"tcg_gen_movi_i64(cpu_lock_addr, -1);",
"tcg_temp_free(addr);",
"return NO_EXIT;",
"}",
"#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
] |
[
[
1,
3,
5
],
[
7
],
[
11
],
[
17
],
[
19
],
[
23,
25
],
[
27,
29
],
[
31,
35
],
[
39,
47
],
[
49,
55
],
[
57
],
[
59
],
[
63
],
[
65
],
[
67
],
[
71
],
[
73
],
[
75
],
[
79,
81
],
[
83
],
[
85
],
[
89
],
[
91
],
[
95
],
[
97
],
[
101
],
[
103
],
[
105
],
[
107,
109
]
] |
9,632 |
static int mp_pacl_setxattr(FsContext *ctx, const char *path, const char *name,
void *value, size_t size, int flags)
{
char buffer[PATH_MAX];
return lsetxattr(rpath(ctx, path, buffer), MAP_ACL_ACCESS, value,
size, flags);
}
| false |
qemu
|
4fa4ce7107c6ec432f185307158c5df91ce54308
|
static int mp_pacl_setxattr(FsContext *ctx, const char *path, const char *name,
void *value, size_t size, int flags)
{
char buffer[PATH_MAX];
return lsetxattr(rpath(ctx, path, buffer), MAP_ACL_ACCESS, value,
size, flags);
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(FsContext *VAR_0, const char *VAR_1, const char *VAR_2,
void *VAR_3, size_t VAR_4, int VAR_5)
{
char VAR_6[PATH_MAX];
return lsetxattr(rpath(VAR_0, VAR_1, VAR_6), MAP_ACL_ACCESS, VAR_3,
VAR_4, VAR_5);
}
|
[
"static int FUNC_0(FsContext *VAR_0, const char *VAR_1, const char *VAR_2,\nvoid *VAR_3, size_t VAR_4, int VAR_5)\n{",
"char VAR_6[PATH_MAX];",
"return lsetxattr(rpath(VAR_0, VAR_1, VAR_6), MAP_ACL_ACCESS, VAR_3,\nVAR_4, VAR_5);",
"}"
] |
[
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9,
11
],
[
13
]
] |
9,633 |
static int mkv_write_attachments(AVFormatContext *s)
{
MatroskaMuxContext *mkv = s->priv_data;
AVIOContext *dyn_cp, *pb = s->pb;
ebml_master attachments;
AVLFG c;
int i, ret;
if (!mkv->have_attachments)
return 0;
mkv->attachments = av_mallocz(sizeof(*mkv->attachments));
if (!mkv->attachments)
return ret;
av_lfg_init(&c, av_get_random_seed());
ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_ATTACHMENTS, avio_tell(pb));
if (ret < 0) return ret;
ret = start_ebml_master_crc32(pb, &dyn_cp, &attachments, MATROSKA_ID_ATTACHMENTS, 0);
if (ret < 0) return ret;
for (i = 0; i < s->nb_streams; i++) {
AVStream *st = s->streams[i];
ebml_master attached_file;
mkv_attachment *attachment = mkv->attachments->entries;
AVDictionaryEntry *t;
const char *mimetype = NULL;
uint32_t fileuid;
if (st->codecpar->codec_type != AVMEDIA_TYPE_ATTACHMENT)
continue;
attachment = av_realloc_array(attachment, mkv->attachments->num_entries + 1, sizeof(mkv_attachment));
if (!attachment)
return AVERROR(ENOMEM);
mkv->attachments->entries = attachment;
attached_file = start_ebml_master(dyn_cp, MATROSKA_ID_ATTACHEDFILE, 0);
if (t = av_dict_get(st->metadata, "title", NULL, 0))
put_ebml_string(dyn_cp, MATROSKA_ID_FILEDESC, t->value);
if (!(t = av_dict_get(st->metadata, "filename", NULL, 0))) {
av_log(s, AV_LOG_ERROR, "Attachment stream %d has no filename tag.\n", i);
return AVERROR(EINVAL);
}
put_ebml_string(dyn_cp, MATROSKA_ID_FILENAME, t->value);
if (t = av_dict_get(st->metadata, "mimetype", NULL, 0))
mimetype = t->value;
else if (st->codecpar->codec_id != AV_CODEC_ID_NONE ) {
int i;
for (i = 0; ff_mkv_mime_tags[i].id != AV_CODEC_ID_NONE; i++)
if (ff_mkv_mime_tags[i].id == st->codecpar->codec_id) {
mimetype = ff_mkv_mime_tags[i].str;
break;
}
for (i = 0; ff_mkv_image_mime_tags[i].id != AV_CODEC_ID_NONE; i++)
if (ff_mkv_image_mime_tags[i].id == st->codecpar->codec_id) {
mimetype = ff_mkv_image_mime_tags[i].str;
break;
}
}
if (!mimetype) {
av_log(s, AV_LOG_ERROR, "Attachment stream %d has no mimetype tag and "
"it cannot be deduced from the codec id.\n", i);
return AVERROR(EINVAL);
}
if (s->flags & AVFMT_FLAG_BITEXACT) {
struct AVSHA *sha = av_sha_alloc();
uint8_t digest[20];
if (!sha)
return AVERROR(ENOMEM);
av_sha_init(sha, 160);
av_sha_update(sha, st->codecpar->extradata, st->codecpar->extradata_size);
av_sha_final(sha, digest);
av_free(sha);
fileuid = AV_RL32(digest);
} else {
fileuid = av_lfg_get(&c);
}
av_log(s, AV_LOG_VERBOSE, "Using %.8"PRIx32" for attachment %d\n",
fileuid, mkv->attachments->num_entries);
put_ebml_string(dyn_cp, MATROSKA_ID_FILEMIMETYPE, mimetype);
put_ebml_binary(dyn_cp, MATROSKA_ID_FILEDATA, st->codecpar->extradata, st->codecpar->extradata_size);
put_ebml_uint(dyn_cp, MATROSKA_ID_FILEUID, fileuid);
end_ebml_master(dyn_cp, attached_file);
mkv->attachments->entries[mkv->attachments->num_entries].stream_idx = i;
mkv->attachments->entries[mkv->attachments->num_entries++].fileuid = fileuid;
}
end_ebml_master_crc32(pb, &dyn_cp, mkv, attachments);
return 0;
}
| false |
FFmpeg
|
eabbc64728c2fdb74f565aededec2ab023d20699
|
static int mkv_write_attachments(AVFormatContext *s)
{
MatroskaMuxContext *mkv = s->priv_data;
AVIOContext *dyn_cp, *pb = s->pb;
ebml_master attachments;
AVLFG c;
int i, ret;
if (!mkv->have_attachments)
return 0;
mkv->attachments = av_mallocz(sizeof(*mkv->attachments));
if (!mkv->attachments)
return ret;
av_lfg_init(&c, av_get_random_seed());
ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_ATTACHMENTS, avio_tell(pb));
if (ret < 0) return ret;
ret = start_ebml_master_crc32(pb, &dyn_cp, &attachments, MATROSKA_ID_ATTACHMENTS, 0);
if (ret < 0) return ret;
for (i = 0; i < s->nb_streams; i++) {
AVStream *st = s->streams[i];
ebml_master attached_file;
mkv_attachment *attachment = mkv->attachments->entries;
AVDictionaryEntry *t;
const char *mimetype = NULL;
uint32_t fileuid;
if (st->codecpar->codec_type != AVMEDIA_TYPE_ATTACHMENT)
continue;
attachment = av_realloc_array(attachment, mkv->attachments->num_entries + 1, sizeof(mkv_attachment));
if (!attachment)
return AVERROR(ENOMEM);
mkv->attachments->entries = attachment;
attached_file = start_ebml_master(dyn_cp, MATROSKA_ID_ATTACHEDFILE, 0);
if (t = av_dict_get(st->metadata, "title", NULL, 0))
put_ebml_string(dyn_cp, MATROSKA_ID_FILEDESC, t->value);
if (!(t = av_dict_get(st->metadata, "filename", NULL, 0))) {
av_log(s, AV_LOG_ERROR, "Attachment stream %d has no filename tag.\n", i);
return AVERROR(EINVAL);
}
put_ebml_string(dyn_cp, MATROSKA_ID_FILENAME, t->value);
if (t = av_dict_get(st->metadata, "mimetype", NULL, 0))
mimetype = t->value;
else if (st->codecpar->codec_id != AV_CODEC_ID_NONE ) {
int i;
for (i = 0; ff_mkv_mime_tags[i].id != AV_CODEC_ID_NONE; i++)
if (ff_mkv_mime_tags[i].id == st->codecpar->codec_id) {
mimetype = ff_mkv_mime_tags[i].str;
break;
}
for (i = 0; ff_mkv_image_mime_tags[i].id != AV_CODEC_ID_NONE; i++)
if (ff_mkv_image_mime_tags[i].id == st->codecpar->codec_id) {
mimetype = ff_mkv_image_mime_tags[i].str;
break;
}
}
if (!mimetype) {
av_log(s, AV_LOG_ERROR, "Attachment stream %d has no mimetype tag and "
"it cannot be deduced from the codec id.\n", i);
return AVERROR(EINVAL);
}
if (s->flags & AVFMT_FLAG_BITEXACT) {
struct AVSHA *sha = av_sha_alloc();
uint8_t digest[20];
if (!sha)
return AVERROR(ENOMEM);
av_sha_init(sha, 160);
av_sha_update(sha, st->codecpar->extradata, st->codecpar->extradata_size);
av_sha_final(sha, digest);
av_free(sha);
fileuid = AV_RL32(digest);
} else {
fileuid = av_lfg_get(&c);
}
av_log(s, AV_LOG_VERBOSE, "Using %.8"PRIx32" for attachment %d\n",
fileuid, mkv->attachments->num_entries);
put_ebml_string(dyn_cp, MATROSKA_ID_FILEMIMETYPE, mimetype);
put_ebml_binary(dyn_cp, MATROSKA_ID_FILEDATA, st->codecpar->extradata, st->codecpar->extradata_size);
put_ebml_uint(dyn_cp, MATROSKA_ID_FILEUID, fileuid);
end_ebml_master(dyn_cp, attached_file);
mkv->attachments->entries[mkv->attachments->num_entries].stream_idx = i;
mkv->attachments->entries[mkv->attachments->num_entries++].fileuid = fileuid;
}
end_ebml_master_crc32(pb, &dyn_cp, mkv, attachments);
return 0;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(AVFormatContext *VAR_0)
{
MatroskaMuxContext *mkv = VAR_0->priv_data;
AVIOContext *dyn_cp, *pb = VAR_0->pb;
ebml_master attachments;
AVLFG c;
int VAR_1, VAR_2;
if (!mkv->have_attachments)
return 0;
mkv->attachments = av_mallocz(sizeof(*mkv->attachments));
if (!mkv->attachments)
return VAR_2;
av_lfg_init(&c, av_get_random_seed());
VAR_2 = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_ATTACHMENTS, avio_tell(pb));
if (VAR_2 < 0) return VAR_2;
VAR_2 = start_ebml_master_crc32(pb, &dyn_cp, &attachments, MATROSKA_ID_ATTACHMENTS, 0);
if (VAR_2 < 0) return VAR_2;
for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) {
AVStream *st = VAR_0->streams[VAR_1];
ebml_master attached_file;
mkv_attachment *attachment = mkv->attachments->entries;
AVDictionaryEntry *t;
const char *mimetype = NULL;
uint32_t fileuid;
if (st->codecpar->codec_type != AVMEDIA_TYPE_ATTACHMENT)
continue;
attachment = av_realloc_array(attachment, mkv->attachments->num_entries + 1, sizeof(mkv_attachment));
if (!attachment)
return AVERROR(ENOMEM);
mkv->attachments->entries = attachment;
attached_file = start_ebml_master(dyn_cp, MATROSKA_ID_ATTACHEDFILE, 0);
if (t = av_dict_get(st->metadata, "title", NULL, 0))
put_ebml_string(dyn_cp, MATROSKA_ID_FILEDESC, t->value);
if (!(t = av_dict_get(st->metadata, "filename", NULL, 0))) {
av_log(VAR_0, AV_LOG_ERROR, "Attachment stream %d has no filename tag.\n", VAR_1);
return AVERROR(EINVAL);
}
put_ebml_string(dyn_cp, MATROSKA_ID_FILENAME, t->value);
if (t = av_dict_get(st->metadata, "mimetype", NULL, 0))
mimetype = t->value;
else if (st->codecpar->codec_id != AV_CODEC_ID_NONE ) {
int VAR_1;
for (VAR_1 = 0; ff_mkv_mime_tags[VAR_1].id != AV_CODEC_ID_NONE; VAR_1++)
if (ff_mkv_mime_tags[VAR_1].id == st->codecpar->codec_id) {
mimetype = ff_mkv_mime_tags[VAR_1].str;
break;
}
for (VAR_1 = 0; ff_mkv_image_mime_tags[VAR_1].id != AV_CODEC_ID_NONE; VAR_1++)
if (ff_mkv_image_mime_tags[VAR_1].id == st->codecpar->codec_id) {
mimetype = ff_mkv_image_mime_tags[VAR_1].str;
break;
}
}
if (!mimetype) {
av_log(VAR_0, AV_LOG_ERROR, "Attachment stream %d has no mimetype tag and "
"it cannot be deduced from the codec id.\n", VAR_1);
return AVERROR(EINVAL);
}
if (VAR_0->flags & AVFMT_FLAG_BITEXACT) {
struct AVSHA *sha = av_sha_alloc();
uint8_t digest[20];
if (!sha)
return AVERROR(ENOMEM);
av_sha_init(sha, 160);
av_sha_update(sha, st->codecpar->extradata, st->codecpar->extradata_size);
av_sha_final(sha, digest);
av_free(sha);
fileuid = AV_RL32(digest);
} else {
fileuid = av_lfg_get(&c);
}
av_log(VAR_0, AV_LOG_VERBOSE, "Using %.8"PRIx32" for attachment %d\n",
fileuid, mkv->attachments->num_entries);
put_ebml_string(dyn_cp, MATROSKA_ID_FILEMIMETYPE, mimetype);
put_ebml_binary(dyn_cp, MATROSKA_ID_FILEDATA, st->codecpar->extradata, st->codecpar->extradata_size);
put_ebml_uint(dyn_cp, MATROSKA_ID_FILEUID, fileuid);
end_ebml_master(dyn_cp, attached_file);
mkv->attachments->entries[mkv->attachments->num_entries].stream_idx = VAR_1;
mkv->attachments->entries[mkv->attachments->num_entries++].fileuid = fileuid;
}
end_ebml_master_crc32(pb, &dyn_cp, mkv, attachments);
return 0;
}
|
[
"static int FUNC_0(AVFormatContext *VAR_0)\n{",
"MatroskaMuxContext *mkv = VAR_0->priv_data;",
"AVIOContext *dyn_cp, *pb = VAR_0->pb;",
"ebml_master attachments;",
"AVLFG c;",
"int VAR_1, VAR_2;",
"if (!mkv->have_attachments)\nreturn 0;",
"mkv->attachments = av_mallocz(sizeof(*mkv->attachments));",
"if (!mkv->attachments)\nreturn VAR_2;",
"av_lfg_init(&c, av_get_random_seed());",
"VAR_2 = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_ATTACHMENTS, avio_tell(pb));",
"if (VAR_2 < 0) return VAR_2;",
"VAR_2 = start_ebml_master_crc32(pb, &dyn_cp, &attachments, MATROSKA_ID_ATTACHMENTS, 0);",
"if (VAR_2 < 0) return VAR_2;",
"for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) {",
"AVStream *st = VAR_0->streams[VAR_1];",
"ebml_master attached_file;",
"mkv_attachment *attachment = mkv->attachments->entries;",
"AVDictionaryEntry *t;",
"const char *mimetype = NULL;",
"uint32_t fileuid;",
"if (st->codecpar->codec_type != AVMEDIA_TYPE_ATTACHMENT)\ncontinue;",
"attachment = av_realloc_array(attachment, mkv->attachments->num_entries + 1, sizeof(mkv_attachment));",
"if (!attachment)\nreturn AVERROR(ENOMEM);",
"mkv->attachments->entries = attachment;",
"attached_file = start_ebml_master(dyn_cp, MATROSKA_ID_ATTACHEDFILE, 0);",
"if (t = av_dict_get(st->metadata, \"title\", NULL, 0))\nput_ebml_string(dyn_cp, MATROSKA_ID_FILEDESC, t->value);",
"if (!(t = av_dict_get(st->metadata, \"filename\", NULL, 0))) {",
"av_log(VAR_0, AV_LOG_ERROR, \"Attachment stream %d has no filename tag.\\n\", VAR_1);",
"return AVERROR(EINVAL);",
"}",
"put_ebml_string(dyn_cp, MATROSKA_ID_FILENAME, t->value);",
"if (t = av_dict_get(st->metadata, \"mimetype\", NULL, 0))\nmimetype = t->value;",
"else if (st->codecpar->codec_id != AV_CODEC_ID_NONE ) {",
"int VAR_1;",
"for (VAR_1 = 0; ff_mkv_mime_tags[VAR_1].id != AV_CODEC_ID_NONE; VAR_1++)",
"if (ff_mkv_mime_tags[VAR_1].id == st->codecpar->codec_id) {",
"mimetype = ff_mkv_mime_tags[VAR_1].str;",
"break;",
"}",
"for (VAR_1 = 0; ff_mkv_image_mime_tags[VAR_1].id != AV_CODEC_ID_NONE; VAR_1++)",
"if (ff_mkv_image_mime_tags[VAR_1].id == st->codecpar->codec_id) {",
"mimetype = ff_mkv_image_mime_tags[VAR_1].str;",
"break;",
"}",
"}",
"if (!mimetype) {",
"av_log(VAR_0, AV_LOG_ERROR, \"Attachment stream %d has no mimetype tag and \"\n\"it cannot be deduced from the codec id.\\n\", VAR_1);",
"return AVERROR(EINVAL);",
"}",
"if (VAR_0->flags & AVFMT_FLAG_BITEXACT) {",
"struct AVSHA *sha = av_sha_alloc();",
"uint8_t digest[20];",
"if (!sha)\nreturn AVERROR(ENOMEM);",
"av_sha_init(sha, 160);",
"av_sha_update(sha, st->codecpar->extradata, st->codecpar->extradata_size);",
"av_sha_final(sha, digest);",
"av_free(sha);",
"fileuid = AV_RL32(digest);",
"} else {",
"fileuid = av_lfg_get(&c);",
"}",
"av_log(VAR_0, AV_LOG_VERBOSE, \"Using %.8\"PRIx32\" for attachment %d\\n\",\nfileuid, mkv->attachments->num_entries);",
"put_ebml_string(dyn_cp, MATROSKA_ID_FILEMIMETYPE, mimetype);",
"put_ebml_binary(dyn_cp, MATROSKA_ID_FILEDATA, st->codecpar->extradata, st->codecpar->extradata_size);",
"put_ebml_uint(dyn_cp, MATROSKA_ID_FILEUID, fileuid);",
"end_ebml_master(dyn_cp, attached_file);",
"mkv->attachments->entries[mkv->attachments->num_entries].stream_idx = VAR_1;",
"mkv->attachments->entries[mkv->attachments->num_entries++].fileuid = fileuid;",
"}",
"end_ebml_master_crc32(pb, &dyn_cp, mkv, attachments);",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17,
19
],
[
23
],
[
25,
27
],
[
31
],
[
35
],
[
37
],
[
41
],
[
43
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
63,
65
],
[
69
],
[
71,
73
],
[
75
],
[
79
],
[
83,
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97,
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129,
131
],
[
133
],
[
135
],
[
139
],
[
141
],
[
143
],
[
145,
147
],
[
149
],
[
151
],
[
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165,
167
],
[
171
],
[
173
],
[
175
],
[
177
],
[
181
],
[
183
],
[
185
],
[
187
],
[
191
],
[
193
]
] |
9,634 |
static void spr_write_dbatu (void *opaque, int sprn)
{
DisasContext *ctx = opaque;
gen_op_store_dbatu((sprn - SPR_DBAT0U) / 2);
RET_STOP(ctx);
}
| false |
qemu
|
e1833e1f96456fd8fc17463246fe0b2050e68efb
|
static void spr_write_dbatu (void *opaque, int sprn)
{
DisasContext *ctx = opaque;
gen_op_store_dbatu((sprn - SPR_DBAT0U) / 2);
RET_STOP(ctx);
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0 (void *VAR_0, int VAR_1)
{
DisasContext *ctx = VAR_0;
gen_op_store_dbatu((VAR_1 - SPR_DBAT0U) / 2);
RET_STOP(ctx);
}
|
[
"static void FUNC_0 (void *VAR_0, int VAR_1)\n{",
"DisasContext *ctx = VAR_0;",
"gen_op_store_dbatu((VAR_1 - SPR_DBAT0U) / 2);",
"RET_STOP(ctx);",
"}"
] |
[
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
]
] |
9,635 |
void vga_hw_invalidate(void)
{
if (active_console->hw_invalidate)
active_console->hw_invalidate(active_console->hw);
}
| false |
qemu
|
26572b8a0e90ee0c77587173a78fa293a1d2beb6
|
void vga_hw_invalidate(void)
{
if (active_console->hw_invalidate)
active_console->hw_invalidate(active_console->hw);
}
|
{
"code": [],
"line_no": []
}
|
void FUNC_0(void)
{
if (active_console->hw_invalidate)
active_console->hw_invalidate(active_console->hw);
}
|
[
"void FUNC_0(void)\n{",
"if (active_console->hw_invalidate)\nactive_console->hw_invalidate(active_console->hw);",
"}"
] |
[
0,
0,
0
] |
[
[
1,
3
],
[
5,
7
],
[
9
]
] |
9,636 |
static uint32_t pmac_ide_readw (void *opaque,target_phys_addr_t addr)
{
uint16_t retval;
MACIOIDEState *d = opaque;
addr = (addr & 0xFFF) >> 4;
if (addr == 0) {
retval = ide_data_readw(&d->bus, 0);
} else {
retval = 0xFFFF;
}
retval = bswap16(retval);
return retval;
}
| false |
qemu
|
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
|
static uint32_t pmac_ide_readw (void *opaque,target_phys_addr_t addr)
{
uint16_t retval;
MACIOIDEState *d = opaque;
addr = (addr & 0xFFF) >> 4;
if (addr == 0) {
retval = ide_data_readw(&d->bus, 0);
} else {
retval = 0xFFFF;
}
retval = bswap16(retval);
return retval;
}
|
{
"code": [],
"line_no": []
}
|
static uint32_t FUNC_0 (void *opaque,target_phys_addr_t addr)
{
uint16_t retval;
MACIOIDEState *d = opaque;
addr = (addr & 0xFFF) >> 4;
if (addr == 0) {
retval = ide_data_readw(&d->bus, 0);
} else {
retval = 0xFFFF;
}
retval = bswap16(retval);
return retval;
}
|
[
"static uint32_t FUNC_0 (void *opaque,target_phys_addr_t addr)\n{",
"uint16_t retval;",
"MACIOIDEState *d = opaque;",
"addr = (addr & 0xFFF) >> 4;",
"if (addr == 0) {",
"retval = ide_data_readw(&d->bus, 0);",
"} else {",
"retval = 0xFFFF;",
"}",
"retval = bswap16(retval);",
"return retval;",
"}"
] |
[
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
]
] |
9,637 |
DeviceState *pxa2xx_gpio_init(target_phys_addr_t base,
CPUState *env, qemu_irq *pic, int lines)
{
DeviceState *dev;
dev = qdev_create(NULL, "pxa2xx-gpio");
qdev_prop_set_int32(dev, "lines", lines);
qdev_prop_set_int32(dev, "ncpu", env->cpu_index);
qdev_init_nofail(dev);
sysbus_mmio_map(sysbus_from_qdev(dev), 0, base);
sysbus_connect_irq(sysbus_from_qdev(dev), 0, pic[PXA2XX_PIC_GPIO_0]);
sysbus_connect_irq(sysbus_from_qdev(dev), 1, pic[PXA2XX_PIC_GPIO_1]);
sysbus_connect_irq(sysbus_from_qdev(dev), 2, pic[PXA2XX_PIC_GPIO_X]);
return dev;
}
| false |
qemu
|
e1f8c729fa890c67bb4532f22c22ace6fb0e1aaf
|
DeviceState *pxa2xx_gpio_init(target_phys_addr_t base,
CPUState *env, qemu_irq *pic, int lines)
{
DeviceState *dev;
dev = qdev_create(NULL, "pxa2xx-gpio");
qdev_prop_set_int32(dev, "lines", lines);
qdev_prop_set_int32(dev, "ncpu", env->cpu_index);
qdev_init_nofail(dev);
sysbus_mmio_map(sysbus_from_qdev(dev), 0, base);
sysbus_connect_irq(sysbus_from_qdev(dev), 0, pic[PXA2XX_PIC_GPIO_0]);
sysbus_connect_irq(sysbus_from_qdev(dev), 1, pic[PXA2XX_PIC_GPIO_1]);
sysbus_connect_irq(sysbus_from_qdev(dev), 2, pic[PXA2XX_PIC_GPIO_X]);
return dev;
}
|
{
"code": [],
"line_no": []
}
|
DeviceState *FUNC_0(target_phys_addr_t base,
CPUState *env, qemu_irq *pic, int lines)
{
DeviceState *dev;
dev = qdev_create(NULL, "pxa2xx-gpio");
qdev_prop_set_int32(dev, "lines", lines);
qdev_prop_set_int32(dev, "ncpu", env->cpu_index);
qdev_init_nofail(dev);
sysbus_mmio_map(sysbus_from_qdev(dev), 0, base);
sysbus_connect_irq(sysbus_from_qdev(dev), 0, pic[PXA2XX_PIC_GPIO_0]);
sysbus_connect_irq(sysbus_from_qdev(dev), 1, pic[PXA2XX_PIC_GPIO_1]);
sysbus_connect_irq(sysbus_from_qdev(dev), 2, pic[PXA2XX_PIC_GPIO_X]);
return dev;
}
|
[
"DeviceState *FUNC_0(target_phys_addr_t base,\nCPUState *env, qemu_irq *pic, int lines)\n{",
"DeviceState *dev;",
"dev = qdev_create(NULL, \"pxa2xx-gpio\");",
"qdev_prop_set_int32(dev, \"lines\", lines);",
"qdev_prop_set_int32(dev, \"ncpu\", env->cpu_index);",
"qdev_init_nofail(dev);",
"sysbus_mmio_map(sysbus_from_qdev(dev), 0, base);",
"sysbus_connect_irq(sysbus_from_qdev(dev), 0, pic[PXA2XX_PIC_GPIO_0]);",
"sysbus_connect_irq(sysbus_from_qdev(dev), 1, pic[PXA2XX_PIC_GPIO_1]);",
"sysbus_connect_irq(sysbus_from_qdev(dev), 2, pic[PXA2XX_PIC_GPIO_X]);",
"return dev;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
11
],
[
13
],
[
15
],
[
17
],
[
21
],
[
23
],
[
25
],
[
27
],
[
31
],
[
33
]
] |
9,638 |
static void v9fs_renameat(void *opaque)
{
ssize_t err = 0;
size_t offset = 7;
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
int32_t olddirfid, newdirfid;
V9fsString old_name, new_name;
pdu_unmarshal(pdu, offset, "dsds", &olddirfid,
&old_name, &newdirfid, &new_name);
v9fs_path_write_lock(s);
err = v9fs_complete_renameat(pdu, olddirfid,
&old_name, newdirfid, &new_name);
v9fs_path_unlock(s);
if (!err) {
err = offset;
}
complete_pdu(s, pdu, err);
v9fs_string_free(&old_name);
v9fs_string_free(&new_name);
}
| false |
qemu
|
ddca7f86ac022289840e0200fd4050b2b58e9176
|
static void v9fs_renameat(void *opaque)
{
ssize_t err = 0;
size_t offset = 7;
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
int32_t olddirfid, newdirfid;
V9fsString old_name, new_name;
pdu_unmarshal(pdu, offset, "dsds", &olddirfid,
&old_name, &newdirfid, &new_name);
v9fs_path_write_lock(s);
err = v9fs_complete_renameat(pdu, olddirfid,
&old_name, newdirfid, &new_name);
v9fs_path_unlock(s);
if (!err) {
err = offset;
}
complete_pdu(s, pdu, err);
v9fs_string_free(&old_name);
v9fs_string_free(&new_name);
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(void *VAR_0)
{
ssize_t err = 0;
size_t offset = 7;
V9fsPDU *pdu = VAR_0;
V9fsState *s = pdu->s;
int32_t olddirfid, newdirfid;
V9fsString old_name, new_name;
pdu_unmarshal(pdu, offset, "dsds", &olddirfid,
&old_name, &newdirfid, &new_name);
v9fs_path_write_lock(s);
err = v9fs_complete_renameat(pdu, olddirfid,
&old_name, newdirfid, &new_name);
v9fs_path_unlock(s);
if (!err) {
err = offset;
}
complete_pdu(s, pdu, err);
v9fs_string_free(&old_name);
v9fs_string_free(&new_name);
}
|
[
"static void FUNC_0(void *VAR_0)\n{",
"ssize_t err = 0;",
"size_t offset = 7;",
"V9fsPDU *pdu = VAR_0;",
"V9fsState *s = pdu->s;",
"int32_t olddirfid, newdirfid;",
"V9fsString old_name, new_name;",
"pdu_unmarshal(pdu, offset, \"dsds\", &olddirfid,\n&old_name, &newdirfid, &new_name);",
"v9fs_path_write_lock(s);",
"err = v9fs_complete_renameat(pdu, olddirfid,\n&old_name, newdirfid, &new_name);",
"v9fs_path_unlock(s);",
"if (!err) {",
"err = offset;",
"}",
"complete_pdu(s, pdu, err);",
"v9fs_string_free(&old_name);",
"v9fs_string_free(&new_name);",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19,
21
],
[
25
],
[
27,
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
]
] |
9,640 |
static int ssi_sd_init(SSISlave *d)
{
DeviceState *dev = DEVICE(d);
ssi_sd_state *s = FROM_SSI_SLAVE(ssi_sd_state, d);
DriveInfo *dinfo;
s->mode = SSI_SD_CMD;
dinfo = drive_get_next(IF_SD);
s->sd = sd_init(dinfo ? blk_bs(blk_by_legacy_dinfo(dinfo)) : NULL, true);
if (s->sd == NULL) {
return -1;
}
register_savevm(dev, "ssi_sd", -1, 1, ssi_sd_save, ssi_sd_load, s);
return 0;
}
| false |
qemu
|
4be746345f13e99e468c60acbd3a355e8183e3ce
|
static int ssi_sd_init(SSISlave *d)
{
DeviceState *dev = DEVICE(d);
ssi_sd_state *s = FROM_SSI_SLAVE(ssi_sd_state, d);
DriveInfo *dinfo;
s->mode = SSI_SD_CMD;
dinfo = drive_get_next(IF_SD);
s->sd = sd_init(dinfo ? blk_bs(blk_by_legacy_dinfo(dinfo)) : NULL, true);
if (s->sd == NULL) {
return -1;
}
register_savevm(dev, "ssi_sd", -1, 1, ssi_sd_save, ssi_sd_load, s);
return 0;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(SSISlave *VAR_0)
{
DeviceState *dev = DEVICE(VAR_0);
ssi_sd_state *s = FROM_SSI_SLAVE(ssi_sd_state, VAR_0);
DriveInfo *dinfo;
s->mode = SSI_SD_CMD;
dinfo = drive_get_next(IF_SD);
s->sd = sd_init(dinfo ? blk_bs(blk_by_legacy_dinfo(dinfo)) : NULL, true);
if (s->sd == NULL) {
return -1;
}
register_savevm(dev, "ssi_sd", -1, 1, ssi_sd_save, ssi_sd_load, s);
return 0;
}
|
[
"static int FUNC_0(SSISlave *VAR_0)\n{",
"DeviceState *dev = DEVICE(VAR_0);",
"ssi_sd_state *s = FROM_SSI_SLAVE(ssi_sd_state, VAR_0);",
"DriveInfo *dinfo;",
"s->mode = SSI_SD_CMD;",
"dinfo = drive_get_next(IF_SD);",
"s->sd = sd_init(dinfo ? blk_bs(blk_by_legacy_dinfo(dinfo)) : NULL, true);",
"if (s->sd == NULL) {",
"return -1;",
"}",
"register_savevm(dev, \"ssi_sd\", -1, 1, ssi_sd_save, ssi_sd_load, s);",
"return 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
]
] |
9,641 |
static int vfio_mmap_bar(VFIOBAR *bar, MemoryRegion *mem, MemoryRegion *submem,
void **map, size_t size, off_t offset,
const char *name)
{
int ret = 0;
if (size && bar->flags & VFIO_REGION_INFO_FLAG_MMAP) {
int prot = 0;
if (bar->flags & VFIO_REGION_INFO_FLAG_READ) {
prot |= PROT_READ;
}
if (bar->flags & VFIO_REGION_INFO_FLAG_WRITE) {
prot |= PROT_WRITE;
}
*map = mmap(NULL, size, prot, MAP_SHARED,
bar->fd, bar->fd_offset + offset);
if (*map == MAP_FAILED) {
*map = NULL;
ret = -errno;
goto empty_region;
}
memory_region_init_ram_ptr(submem, name, size, *map);
} else {
empty_region:
/* Create a zero sized sub-region to make cleanup easy. */
memory_region_init(submem, name, 0);
}
memory_region_add_subregion(mem, offset, submem);
return ret;
}
| false |
qemu
|
82ca891283a08cddd659b534592fe00f2159bc74
|
static int vfio_mmap_bar(VFIOBAR *bar, MemoryRegion *mem, MemoryRegion *submem,
void **map, size_t size, off_t offset,
const char *name)
{
int ret = 0;
if (size && bar->flags & VFIO_REGION_INFO_FLAG_MMAP) {
int prot = 0;
if (bar->flags & VFIO_REGION_INFO_FLAG_READ) {
prot |= PROT_READ;
}
if (bar->flags & VFIO_REGION_INFO_FLAG_WRITE) {
prot |= PROT_WRITE;
}
*map = mmap(NULL, size, prot, MAP_SHARED,
bar->fd, bar->fd_offset + offset);
if (*map == MAP_FAILED) {
*map = NULL;
ret = -errno;
goto empty_region;
}
memory_region_init_ram_ptr(submem, name, size, *map);
} else {
empty_region:
memory_region_init(submem, name, 0);
}
memory_region_add_subregion(mem, offset, submem);
return ret;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(VFIOBAR *VAR_0, MemoryRegion *VAR_1, MemoryRegion *VAR_2,
void **VAR_3, size_t VAR_4, off_t VAR_5,
const char *VAR_6)
{
int VAR_7 = 0;
if (VAR_4 && VAR_0->flags & VFIO_REGION_INFO_FLAG_MMAP) {
int VAR_8 = 0;
if (VAR_0->flags & VFIO_REGION_INFO_FLAG_READ) {
VAR_8 |= PROT_READ;
}
if (VAR_0->flags & VFIO_REGION_INFO_FLAG_WRITE) {
VAR_8 |= PROT_WRITE;
}
*VAR_3 = mmap(NULL, VAR_4, VAR_8, MAP_SHARED,
VAR_0->fd, VAR_0->fd_offset + VAR_5);
if (*VAR_3 == MAP_FAILED) {
*VAR_3 = NULL;
VAR_7 = -errno;
goto empty_region;
}
memory_region_init_ram_ptr(VAR_2, VAR_6, VAR_4, *VAR_3);
} else {
empty_region:
memory_region_init(VAR_2, VAR_6, 0);
}
memory_region_add_subregion(VAR_1, VAR_5, VAR_2);
return VAR_7;
}
|
[
"static int FUNC_0(VFIOBAR *VAR_0, MemoryRegion *VAR_1, MemoryRegion *VAR_2,\nvoid **VAR_3, size_t VAR_4, off_t VAR_5,\nconst char *VAR_6)\n{",
"int VAR_7 = 0;",
"if (VAR_4 && VAR_0->flags & VFIO_REGION_INFO_FLAG_MMAP) {",
"int VAR_8 = 0;",
"if (VAR_0->flags & VFIO_REGION_INFO_FLAG_READ) {",
"VAR_8 |= PROT_READ;",
"}",
"if (VAR_0->flags & VFIO_REGION_INFO_FLAG_WRITE) {",
"VAR_8 |= PROT_WRITE;",
"}",
"*VAR_3 = mmap(NULL, VAR_4, VAR_8, MAP_SHARED,\nVAR_0->fd, VAR_0->fd_offset + VAR_5);",
"if (*VAR_3 == MAP_FAILED) {",
"*VAR_3 = NULL;",
"VAR_7 = -errno;",
"goto empty_region;",
"}",
"memory_region_init_ram_ptr(VAR_2, VAR_6, VAR_4, *VAR_3);",
"} else {",
"empty_region:\nmemory_region_init(VAR_2, VAR_6, 0);",
"}",
"memory_region_add_subregion(VAR_1, VAR_5, VAR_2);",
"return VAR_7;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5,
7
],
[
9
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23
],
[
27
],
[
29
],
[
31
],
[
35,
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
51
],
[
53
],
[
55,
59
],
[
61
],
[
65
],
[
69
],
[
71
]
] |
9,644 |
int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic){
AVFrame temp_pic;
int i;
assert(s->codec_type == AVMEDIA_TYPE_VIDEO);
if (pic->data[0] && (pic->width != s->width || pic->height != s->height || pic->format != s->pix_fmt)) {
av_log(s, AV_LOG_WARNING, "Picture changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s in reget buffer()\n",
pic->width, pic->height, av_get_pix_fmt_name(pic->format), s->width, s->height, av_get_pix_fmt_name(s->pix_fmt));
s->release_buffer(s, pic);
}
/* If no picture return a new buffer */
if(pic->data[0] == NULL) {
/* We will copy from buffer, so must be readable */
pic->buffer_hints |= FF_BUFFER_HINTS_READABLE;
return s->get_buffer(s, pic);
}
/* If internal buffer type return the same buffer */
if(pic->type == FF_BUFFER_TYPE_INTERNAL) {
if(s->pkt) pic->pkt_pts= s->pkt->pts;
else pic->pkt_pts= AV_NOPTS_VALUE;
pic->reordered_opaque= s->reordered_opaque;
return 0;
}
/*
* Not internal type and reget_buffer not overridden, emulate cr buffer
*/
temp_pic = *pic;
for(i = 0; i < AV_NUM_DATA_POINTERS; i++)
pic->data[i] = pic->base[i] = NULL;
pic->opaque = NULL;
/* Allocate new frame */
if (s->get_buffer(s, pic))
return -1;
/* Copy image data from old buffer to new buffer */
av_picture_copy((AVPicture*)pic, (AVPicture*)&temp_pic, s->pix_fmt, s->width,
s->height);
s->release_buffer(s, &temp_pic); // Release old frame
return 0;
}
| false |
FFmpeg
|
e49780f749b2ce8e229fb8257cd01f60e0661b54
|
int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic){
AVFrame temp_pic;
int i;
assert(s->codec_type == AVMEDIA_TYPE_VIDEO);
if (pic->data[0] && (pic->width != s->width || pic->height != s->height || pic->format != s->pix_fmt)) {
av_log(s, AV_LOG_WARNING, "Picture changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s in reget buffer()\n",
pic->width, pic->height, av_get_pix_fmt_name(pic->format), s->width, s->height, av_get_pix_fmt_name(s->pix_fmt));
s->release_buffer(s, pic);
}
if(pic->data[0] == NULL) {
pic->buffer_hints |= FF_BUFFER_HINTS_READABLE;
return s->get_buffer(s, pic);
}
if(pic->type == FF_BUFFER_TYPE_INTERNAL) {
if(s->pkt) pic->pkt_pts= s->pkt->pts;
else pic->pkt_pts= AV_NOPTS_VALUE;
pic->reordered_opaque= s->reordered_opaque;
return 0;
}
temp_pic = *pic;
for(i = 0; i < AV_NUM_DATA_POINTERS; i++)
pic->data[i] = pic->base[i] = NULL;
pic->opaque = NULL;
if (s->get_buffer(s, pic))
return -1;
av_picture_copy((AVPicture*)pic, (AVPicture*)&temp_pic, s->pix_fmt, s->width,
s->height);
s->release_buffer(s, &temp_pic);
return 0;
}
|
{
"code": [],
"line_no": []
}
|
int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1){
AVFrame temp_pic;
int VAR_2;
assert(VAR_0->codec_type == AVMEDIA_TYPE_VIDEO);
if (VAR_1->data[0] && (VAR_1->width != VAR_0->width || VAR_1->height != VAR_0->height || VAR_1->format != VAR_0->pix_fmt)) {
av_log(VAR_0, AV_LOG_WARNING, "Picture changed from size:%dx%d fmt:%VAR_0 to size:%dx%d fmt:%VAR_0 in reget buffer()\n",
VAR_1->width, VAR_1->height, av_get_pix_fmt_name(VAR_1->format), VAR_0->width, VAR_0->height, av_get_pix_fmt_name(VAR_0->pix_fmt));
VAR_0->release_buffer(VAR_0, VAR_1);
}
if(VAR_1->data[0] == NULL) {
VAR_1->buffer_hints |= FF_BUFFER_HINTS_READABLE;
return VAR_0->get_buffer(VAR_0, VAR_1);
}
if(VAR_1->type == FF_BUFFER_TYPE_INTERNAL) {
if(VAR_0->pkt) VAR_1->pkt_pts= VAR_0->pkt->pts;
else VAR_1->pkt_pts= AV_NOPTS_VALUE;
VAR_1->reordered_opaque= VAR_0->reordered_opaque;
return 0;
}
temp_pic = *VAR_1;
for(VAR_2 = 0; VAR_2 < AV_NUM_DATA_POINTERS; VAR_2++)
VAR_1->data[VAR_2] = VAR_1->base[VAR_2] = NULL;
VAR_1->opaque = NULL;
if (VAR_0->get_buffer(VAR_0, VAR_1))
return -1;
av_picture_copy((AVPicture*)VAR_1, (AVPicture*)&temp_pic, VAR_0->pix_fmt, VAR_0->width,
VAR_0->height);
VAR_0->release_buffer(VAR_0, &temp_pic);
return 0;
}
|
[
"int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1){",
"AVFrame temp_pic;",
"int VAR_2;",
"assert(VAR_0->codec_type == AVMEDIA_TYPE_VIDEO);",
"if (VAR_1->data[0] && (VAR_1->width != VAR_0->width || VAR_1->height != VAR_0->height || VAR_1->format != VAR_0->pix_fmt)) {",
"av_log(VAR_0, AV_LOG_WARNING, \"Picture changed from size:%dx%d fmt:%VAR_0 to size:%dx%d fmt:%VAR_0 in reget buffer()\\n\",\nVAR_1->width, VAR_1->height, av_get_pix_fmt_name(VAR_1->format), VAR_0->width, VAR_0->height, av_get_pix_fmt_name(VAR_0->pix_fmt));",
"VAR_0->release_buffer(VAR_0, VAR_1);",
"}",
"if(VAR_1->data[0] == NULL) {",
"VAR_1->buffer_hints |= FF_BUFFER_HINTS_READABLE;",
"return VAR_0->get_buffer(VAR_0, VAR_1);",
"}",
"if(VAR_1->type == FF_BUFFER_TYPE_INTERNAL) {",
"if(VAR_0->pkt) VAR_1->pkt_pts= VAR_0->pkt->pts;",
"else VAR_1->pkt_pts= AV_NOPTS_VALUE;",
"VAR_1->reordered_opaque= VAR_0->reordered_opaque;",
"return 0;",
"}",
"temp_pic = *VAR_1;",
"for(VAR_2 = 0; VAR_2 < AV_NUM_DATA_POINTERS; VAR_2++)",
"VAR_1->data[VAR_2] = VAR_1->base[VAR_2] = NULL;",
"VAR_1->opaque = NULL;",
"if (VAR_0->get_buffer(VAR_0, VAR_1))\nreturn -1;",
"av_picture_copy((AVPicture*)VAR_1, (AVPicture*)&temp_pic, VAR_0->pix_fmt, VAR_0->width,\nVAR_0->height);",
"VAR_0->release_buffer(VAR_0, &temp_pic);",
"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
] |
[
[
1
],
[
3
],
[
5
],
[
9
],
[
13
],
[
15,
17
],
[
19
],
[
21
],
[
27
],
[
31
],
[
33
],
[
35
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
61
],
[
63
],
[
65
],
[
67
],
[
71,
73
],
[
77,
79
],
[
81
],
[
83
],
[
85
]
] |
9,645 |
void helper_ldfsr(CPUSPARCState *env, uint32_t new_fsr)
{
env->fsr = (new_fsr & FSR_LDFSR_MASK) | (env->fsr & FSR_LDFSR_OLDMASK);
set_fsr(env);
}
| false |
qemu
|
7385aed20db5d83979f683b9d0048674411e963c
|
void helper_ldfsr(CPUSPARCState *env, uint32_t new_fsr)
{
env->fsr = (new_fsr & FSR_LDFSR_MASK) | (env->fsr & FSR_LDFSR_OLDMASK);
set_fsr(env);
}
|
{
"code": [],
"line_no": []
}
|
void FUNC_0(CPUSPARCState *VAR_0, uint32_t VAR_1)
{
VAR_0->fsr = (VAR_1 & FSR_LDFSR_MASK) | (VAR_0->fsr & FSR_LDFSR_OLDMASK);
set_fsr(VAR_0);
}
|
[
"void FUNC_0(CPUSPARCState *VAR_0, uint32_t VAR_1)\n{",
"VAR_0->fsr = (VAR_1 & FSR_LDFSR_MASK) | (VAR_0->fsr & FSR_LDFSR_OLDMASK);",
"set_fsr(VAR_0);",
"}"
] |
[
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
]
] |
9,646 |
void qemu_thread_self(QemuThread *thread)
{
thread->thread = pthread_self();
}
| false |
qemu
|
b7680cb6078bd7294a3dd86473d3f2fdee991dd0
|
void qemu_thread_self(QemuThread *thread)
{
thread->thread = pthread_self();
}
|
{
"code": [],
"line_no": []
}
|
void FUNC_0(QemuThread *VAR_0)
{
VAR_0->VAR_0 = pthread_self();
}
|
[
"void FUNC_0(QemuThread *VAR_0)\n{",
"VAR_0->VAR_0 = pthread_self();",
"}"
] |
[
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
]
] |
9,648 |
static int create_shared_memory_BAR(IVShmemState *s, int fd, uint8_t attr,
Error **errp)
{
void * ptr;
ptr = mmap(0, s->ivshmem_size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
if (ptr == MAP_FAILED) {
error_setg_errno(errp, errno, "Failed to mmap shared memory");
return -1;
}
s->shm_fd = fd;
memory_region_init_ram_ptr(&s->ivshmem, OBJECT(s), "ivshmem.bar2",
s->ivshmem_size, ptr);
vmstate_register_ram(&s->ivshmem, DEVICE(s));
memory_region_add_subregion(&s->bar, 0, &s->ivshmem);
/* region for shared memory */
pci_register_bar(PCI_DEVICE(s), 2, attr, &s->bar);
return 0;
}
| true |
qemu
|
f689d2811a36894618087e1e2cc3ade78e758e94
|
static int create_shared_memory_BAR(IVShmemState *s, int fd, uint8_t attr,
Error **errp)
{
void * ptr;
ptr = mmap(0, s->ivshmem_size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
if (ptr == MAP_FAILED) {
error_setg_errno(errp, errno, "Failed to mmap shared memory");
return -1;
}
s->shm_fd = fd;
memory_region_init_ram_ptr(&s->ivshmem, OBJECT(s), "ivshmem.bar2",
s->ivshmem_size, ptr);
vmstate_register_ram(&s->ivshmem, DEVICE(s));
memory_region_add_subregion(&s->bar, 0, &s->ivshmem);
pci_register_bar(PCI_DEVICE(s), 2, attr, &s->bar);
return 0;
}
|
{
"code": [
" s->shm_fd = fd;"
],
"line_no": [
23
]
}
|
static int FUNC_0(IVShmemState *VAR_0, int VAR_1, uint8_t VAR_2,
Error **VAR_3)
{
void * VAR_4;
VAR_4 = mmap(0, VAR_0->ivshmem_size, PROT_READ|PROT_WRITE, MAP_SHARED, VAR_1, 0);
if (VAR_4 == MAP_FAILED) {
error_setg_errno(VAR_3, errno, "Failed to mmap shared memory");
return -1;
}
VAR_0->shm_fd = VAR_1;
memory_region_init_ram_ptr(&VAR_0->ivshmem, OBJECT(VAR_0), "ivshmem.bar2",
VAR_0->ivshmem_size, VAR_4);
vmstate_register_ram(&VAR_0->ivshmem, DEVICE(VAR_0));
memory_region_add_subregion(&VAR_0->bar, 0, &VAR_0->ivshmem);
pci_register_bar(PCI_DEVICE(VAR_0), 2, VAR_2, &VAR_0->bar);
return 0;
}
|
[
"static int FUNC_0(IVShmemState *VAR_0, int VAR_1, uint8_t VAR_2,\nError **VAR_3)\n{",
"void * VAR_4;",
"VAR_4 = mmap(0, VAR_0->ivshmem_size, PROT_READ|PROT_WRITE, MAP_SHARED, VAR_1, 0);",
"if (VAR_4 == MAP_FAILED) {",
"error_setg_errno(VAR_3, errno, \"Failed to mmap shared memory\");",
"return -1;",
"}",
"VAR_0->shm_fd = VAR_1;",
"memory_region_init_ram_ptr(&VAR_0->ivshmem, OBJECT(VAR_0), \"ivshmem.bar2\",\nVAR_0->ivshmem_size, VAR_4);",
"vmstate_register_ram(&VAR_0->ivshmem, DEVICE(VAR_0));",
"memory_region_add_subregion(&VAR_0->bar, 0, &VAR_0->ivshmem);",
"pci_register_bar(PCI_DEVICE(VAR_0), 2, VAR_2, &VAR_0->bar);",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
27,
29
],
[
31
],
[
33
],
[
39
],
[
43
],
[
45
]
] |
9,652 |
static av_always_inline int vc1_filter_line(uint8_t* src, int stride, int pq){
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
int a0 = (2*(src[-2*stride] - src[ 1*stride]) - 5*(src[-1*stride] - src[ 0*stride]) + 4) >> 3;
int a0_sign = a0 >> 31; /* Store sign */
a0 = (a0 ^ a0_sign) - a0_sign; /* a0 = FFABS(a0); */
if(a0 < pq){
int a1 = FFABS((2*(src[-4*stride] - src[-1*stride]) - 5*(src[-3*stride] - src[-2*stride]) + 4) >> 3);
int a2 = FFABS((2*(src[ 0*stride] - src[ 3*stride]) - 5*(src[ 1*stride] - src[ 2*stride]) + 4) >> 3);
if(a1 < a0 || a2 < a0){
int clip = src[-1*stride] - src[ 0*stride];
int clip_sign = clip >> 31;
clip = ((clip ^ clip_sign) - clip_sign)>>1;
if(clip){
int a3 = FFMIN(a1, a2);
int d = 5 * (a3 - a0);
int d_sign = (d >> 31);
d = ((d ^ d_sign) - d_sign) >> 3;
d_sign ^= a0_sign;
if( d_sign ^ clip_sign )
d = 0;
else{
d = FFMIN(d, clip);
d = (d ^ d_sign) - d_sign; /* Restore sign */
src[-1*stride] = cm[src[-1*stride] - d];
src[ 0*stride] = cm[src[ 0*stride] + d];
}
return 1;
}
}
}
return 0;
}
| true |
FFmpeg
|
c23acbaed40101c677dfcfbbfe0d2c230a8e8f44
|
static av_always_inline int vc1_filter_line(uint8_t* src, int stride, int pq){
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
int a0 = (2*(src[-2*stride] - src[ 1*stride]) - 5*(src[-1*stride] - src[ 0*stride]) + 4) >> 3;
int a0_sign = a0 >> 31;
a0 = (a0 ^ a0_sign) - a0_sign;
if(a0 < pq){
int a1 = FFABS((2*(src[-4*stride] - src[-1*stride]) - 5*(src[-3*stride] - src[-2*stride]) + 4) >> 3);
int a2 = FFABS((2*(src[ 0*stride] - src[ 3*stride]) - 5*(src[ 1*stride] - src[ 2*stride]) + 4) >> 3);
if(a1 < a0 || a2 < a0){
int clip = src[-1*stride] - src[ 0*stride];
int clip_sign = clip >> 31;
clip = ((clip ^ clip_sign) - clip_sign)>>1;
if(clip){
int a3 = FFMIN(a1, a2);
int d = 5 * (a3 - a0);
int d_sign = (d >> 31);
d = ((d ^ d_sign) - d_sign) >> 3;
d_sign ^= a0_sign;
if( d_sign ^ clip_sign )
d = 0;
else{
d = FFMIN(d, clip);
d = (d ^ d_sign) - d_sign;
src[-1*stride] = cm[src[-1*stride] - d];
src[ 0*stride] = cm[src[ 0*stride] + d];
}
return 1;
}
}
}
return 0;
}
|
{
"code": [
" uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;",
" uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;",
" uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;",
" uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;",
" uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;",
" uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;",
" uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;",
" uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;",
" uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;",
" uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;",
" uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;",
" src[-1*stride] = cm[src[-1*stride] - d];",
" src[ 0*stride] = cm[src[ 0*stride] + d];",
" uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;",
" uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;"
],
"line_no": [
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
51,
53,
3,
3
]
}
|
static av_always_inline int FUNC_0(uint8_t* src, int stride, int pq){
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
int VAR_0 = (2*(src[-2*stride] - src[ 1*stride]) - 5*(src[-1*stride] - src[ 0*stride]) + 4) >> 3;
int VAR_1 = VAR_0 >> 31;
VAR_0 = (VAR_0 ^ VAR_1) - VAR_1;
if(VAR_0 < pq){
int VAR_2 = FFABS((2*(src[-4*stride] - src[-1*stride]) - 5*(src[-3*stride] - src[-2*stride]) + 4) >> 3);
int VAR_3 = FFABS((2*(src[ 0*stride] - src[ 3*stride]) - 5*(src[ 1*stride] - src[ 2*stride]) + 4) >> 3);
if(VAR_2 < VAR_0 || VAR_3 < VAR_0){
int VAR_4 = src[-1*stride] - src[ 0*stride];
int VAR_5 = VAR_4 >> 31;
VAR_4 = ((VAR_4 ^ VAR_5) - VAR_5)>>1;
if(VAR_4){
int VAR_6 = FFMIN(VAR_2, VAR_3);
int VAR_7 = 5 * (VAR_6 - VAR_0);
int VAR_8 = (VAR_7 >> 31);
VAR_7 = ((VAR_7 ^ VAR_8) - VAR_8) >> 3;
VAR_8 ^= VAR_1;
if( VAR_8 ^ VAR_5 )
VAR_7 = 0;
else{
VAR_7 = FFMIN(VAR_7, VAR_4);
VAR_7 = (VAR_7 ^ VAR_8) - VAR_8;
src[-1*stride] = cm[src[-1*stride] - VAR_7];
src[ 0*stride] = cm[src[ 0*stride] + VAR_7];
}
return 1;
}
}
}
return 0;
}
|
[
"static av_always_inline int FUNC_0(uint8_t* src, int stride, int pq){",
"uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;",
"int VAR_0 = (2*(src[-2*stride] - src[ 1*stride]) - 5*(src[-1*stride] - src[ 0*stride]) + 4) >> 3;",
"int VAR_1 = VAR_0 >> 31;",
"VAR_0 = (VAR_0 ^ VAR_1) - VAR_1;",
"if(VAR_0 < pq){",
"int VAR_2 = FFABS((2*(src[-4*stride] - src[-1*stride]) - 5*(src[-3*stride] - src[-2*stride]) + 4) >> 3);",
"int VAR_3 = FFABS((2*(src[ 0*stride] - src[ 3*stride]) - 5*(src[ 1*stride] - src[ 2*stride]) + 4) >> 3);",
"if(VAR_2 < VAR_0 || VAR_3 < VAR_0){",
"int VAR_4 = src[-1*stride] - src[ 0*stride];",
"int VAR_5 = VAR_4 >> 31;",
"VAR_4 = ((VAR_4 ^ VAR_5) - VAR_5)>>1;",
"if(VAR_4){",
"int VAR_6 = FFMIN(VAR_2, VAR_3);",
"int VAR_7 = 5 * (VAR_6 - VAR_0);",
"int VAR_8 = (VAR_7 >> 31);",
"VAR_7 = ((VAR_7 ^ VAR_8) - VAR_8) >> 3;",
"VAR_8 ^= VAR_1;",
"if( VAR_8 ^ VAR_5 )\nVAR_7 = 0;",
"else{",
"VAR_7 = FFMIN(VAR_7, VAR_4);",
"VAR_7 = (VAR_7 ^ VAR_8) - VAR_8;",
"src[-1*stride] = cm[src[-1*stride] - VAR_7];",
"src[ 0*stride] = cm[src[ 0*stride] + VAR_7];",
"}",
"return 1;",
"}",
"}",
"}",
"return 0;",
"}"
] |
[
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1
],
[
3
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
41,
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
]
] |
9,653 |
static AVCodec *choose_codec(OptionsContext *o, AVFormatContext *s, AVStream *st, enum AVMediaType type)
{
char *codec_name = NULL;
MATCH_PER_STREAM_OPT(codec_names, str, codec_name, s, st);
if (!codec_name) {
if (s->oformat) {
st->codec->codec_id = av_guess_codec(s->oformat, NULL, s->filename, NULL, type);
return avcodec_find_encoder(st->codec->codec_id);
}
} else if (!strcmp(codec_name, "copy"))
st->stream_copy = 1;
else {
st->codec->codec_id = find_codec_or_die(codec_name, type, s->iformat == NULL);
return s->oformat ? avcodec_find_encoder_by_name(codec_name) :
avcodec_find_decoder_by_name(codec_name);
}
return NULL;
}
| false |
FFmpeg
|
1b648c7cdbee335c642bd2c05fe624fc195b85e6
|
static AVCodec *choose_codec(OptionsContext *o, AVFormatContext *s, AVStream *st, enum AVMediaType type)
{
char *codec_name = NULL;
MATCH_PER_STREAM_OPT(codec_names, str, codec_name, s, st);
if (!codec_name) {
if (s->oformat) {
st->codec->codec_id = av_guess_codec(s->oformat, NULL, s->filename, NULL, type);
return avcodec_find_encoder(st->codec->codec_id);
}
} else if (!strcmp(codec_name, "copy"))
st->stream_copy = 1;
else {
st->codec->codec_id = find_codec_or_die(codec_name, type, s->iformat == NULL);
return s->oformat ? avcodec_find_encoder_by_name(codec_name) :
avcodec_find_decoder_by_name(codec_name);
}
return NULL;
}
|
{
"code": [],
"line_no": []
}
|
static AVCodec *FUNC_0(OptionsContext *o, AVFormatContext *s, AVStream *st, enum AVMediaType type)
{
char *VAR_0 = NULL;
MATCH_PER_STREAM_OPT(codec_names, str, VAR_0, s, st);
if (!VAR_0) {
if (s->oformat) {
st->codec->codec_id = av_guess_codec(s->oformat, NULL, s->filename, NULL, type);
return avcodec_find_encoder(st->codec->codec_id);
}
} else if (!strcmp(VAR_0, "copy"))
st->stream_copy = 1;
else {
st->codec->codec_id = find_codec_or_die(VAR_0, type, s->iformat == NULL);
return s->oformat ? avcodec_find_encoder_by_name(VAR_0) :
avcodec_find_decoder_by_name(VAR_0);
}
return NULL;
}
|
[
"static AVCodec *FUNC_0(OptionsContext *o, AVFormatContext *s, AVStream *st, enum AVMediaType type)\n{",
"char *VAR_0 = NULL;",
"MATCH_PER_STREAM_OPT(codec_names, str, VAR_0, s, st);",
"if (!VAR_0) {",
"if (s->oformat) {",
"st->codec->codec_id = av_guess_codec(s->oformat, NULL, s->filename, NULL, type);",
"return avcodec_find_encoder(st->codec->codec_id);",
"}",
"} else if (!strcmp(VAR_0, \"copy\"))",
"st->stream_copy = 1;",
"else {",
"st->codec->codec_id = find_codec_or_die(VAR_0, type, s->iformat == NULL);",
"return s->oformat ? avcodec_find_encoder_by_name(VAR_0) :\navcodec_find_decoder_by_name(VAR_0);",
"}",
"return NULL;",
"}"
] |
[
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
],
[
39
],
[
41
]
] |
9,654 |
static uint16_t nvme_create_cq(NvmeCtrl *n, NvmeCmd *cmd)
{
NvmeCQueue *cq;
NvmeCreateCq *c = (NvmeCreateCq *)cmd;
uint16_t cqid = le16_to_cpu(c->cqid);
uint16_t vector = le16_to_cpu(c->irq_vector);
uint16_t qsize = le16_to_cpu(c->qsize);
uint16_t qflags = le16_to_cpu(c->cq_flags);
uint64_t prp1 = le64_to_cpu(c->prp1);
if (!cqid || !nvme_check_cqid(n, cqid)) {
return NVME_INVALID_CQID | NVME_DNR;
}
if (!qsize || qsize > NVME_CAP_MQES(n->bar.cap)) {
return NVME_MAX_QSIZE_EXCEEDED | NVME_DNR;
}
if (!prp1) {
return NVME_INVALID_FIELD | NVME_DNR;
}
if (vector > n->num_queues) {
return NVME_INVALID_IRQ_VECTOR | NVME_DNR;
}
if (!(NVME_CQ_FLAGS_PC(qflags))) {
return NVME_INVALID_FIELD | NVME_DNR;
}
cq = g_malloc0(sizeof(*cq));
nvme_init_cq(cq, n, prp1, cqid, vector, qsize + 1,
NVME_CQ_FLAGS_IEN(qflags));
return NVME_SUCCESS;
}
| true |
qemu
|
1ee24514aed34760fb2863d98bea3a1b705d9c9f
|
static uint16_t nvme_create_cq(NvmeCtrl *n, NvmeCmd *cmd)
{
NvmeCQueue *cq;
NvmeCreateCq *c = (NvmeCreateCq *)cmd;
uint16_t cqid = le16_to_cpu(c->cqid);
uint16_t vector = le16_to_cpu(c->irq_vector);
uint16_t qsize = le16_to_cpu(c->qsize);
uint16_t qflags = le16_to_cpu(c->cq_flags);
uint64_t prp1 = le64_to_cpu(c->prp1);
if (!cqid || !nvme_check_cqid(n, cqid)) {
return NVME_INVALID_CQID | NVME_DNR;
}
if (!qsize || qsize > NVME_CAP_MQES(n->bar.cap)) {
return NVME_MAX_QSIZE_EXCEEDED | NVME_DNR;
}
if (!prp1) {
return NVME_INVALID_FIELD | NVME_DNR;
}
if (vector > n->num_queues) {
return NVME_INVALID_IRQ_VECTOR | NVME_DNR;
}
if (!(NVME_CQ_FLAGS_PC(qflags))) {
return NVME_INVALID_FIELD | NVME_DNR;
}
cq = g_malloc0(sizeof(*cq));
nvme_init_cq(cq, n, prp1, cqid, vector, qsize + 1,
NVME_CQ_FLAGS_IEN(qflags));
return NVME_SUCCESS;
}
|
{
"code": [
" if (!prp1) {",
" if (!qsize || qsize > NVME_CAP_MQES(n->bar.cap)) {",
" if (!cqid || !nvme_check_cqid(n, cqid)) {",
" if (!qsize || qsize > NVME_CAP_MQES(n->bar.cap)) {",
" if (!prp1) {",
" if (vector > n->num_queues) {",
" if (!(NVME_CQ_FLAGS_PC(qflags))) {"
],
"line_no": [
33,
27,
21,
27,
33,
39,
45
]
}
|
static uint16_t FUNC_0(NvmeCtrl *n, NvmeCmd *cmd)
{
NvmeCQueue *cq;
NvmeCreateCq *c = (NvmeCreateCq *)cmd;
uint16_t cqid = le16_to_cpu(c->cqid);
uint16_t vector = le16_to_cpu(c->irq_vector);
uint16_t qsize = le16_to_cpu(c->qsize);
uint16_t qflags = le16_to_cpu(c->cq_flags);
uint64_t prp1 = le64_to_cpu(c->prp1);
if (!cqid || !nvme_check_cqid(n, cqid)) {
return NVME_INVALID_CQID | NVME_DNR;
}
if (!qsize || qsize > NVME_CAP_MQES(n->bar.cap)) {
return NVME_MAX_QSIZE_EXCEEDED | NVME_DNR;
}
if (!prp1) {
return NVME_INVALID_FIELD | NVME_DNR;
}
if (vector > n->num_queues) {
return NVME_INVALID_IRQ_VECTOR | NVME_DNR;
}
if (!(NVME_CQ_FLAGS_PC(qflags))) {
return NVME_INVALID_FIELD | NVME_DNR;
}
cq = g_malloc0(sizeof(*cq));
nvme_init_cq(cq, n, prp1, cqid, vector, qsize + 1,
NVME_CQ_FLAGS_IEN(qflags));
return NVME_SUCCESS;
}
|
[
"static uint16_t FUNC_0(NvmeCtrl *n, NvmeCmd *cmd)\n{",
"NvmeCQueue *cq;",
"NvmeCreateCq *c = (NvmeCreateCq *)cmd;",
"uint16_t cqid = le16_to_cpu(c->cqid);",
"uint16_t vector = le16_to_cpu(c->irq_vector);",
"uint16_t qsize = le16_to_cpu(c->qsize);",
"uint16_t qflags = le16_to_cpu(c->cq_flags);",
"uint64_t prp1 = le64_to_cpu(c->prp1);",
"if (!cqid || !nvme_check_cqid(n, cqid)) {",
"return NVME_INVALID_CQID | NVME_DNR;",
"}",
"if (!qsize || qsize > NVME_CAP_MQES(n->bar.cap)) {",
"return NVME_MAX_QSIZE_EXCEEDED | NVME_DNR;",
"}",
"if (!prp1) {",
"return NVME_INVALID_FIELD | NVME_DNR;",
"}",
"if (vector > n->num_queues) {",
"return NVME_INVALID_IRQ_VECTOR | NVME_DNR;",
"}",
"if (!(NVME_CQ_FLAGS_PC(qflags))) {",
"return NVME_INVALID_FIELD | NVME_DNR;",
"}",
"cq = g_malloc0(sizeof(*cq));",
"nvme_init_cq(cq, n, prp1, cqid, vector, qsize + 1,\nNVME_CQ_FLAGS_IEN(qflags));",
"return NVME_SUCCESS;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
1,
0,
0,
1,
0,
0,
1,
0,
0,
1,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
53
],
[
55,
57
],
[
59
],
[
61
]
] |
9,655 |
static void FUNC(put_hevc_epel_bi_w_hv)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
int16_t *src2,
int height, int denom, int wx0, int wx1,
int ox0, int ox1, intptr_t mx, intptr_t my, int width)
{
int x, y;
pixel *src = (pixel *)_src;
ptrdiff_t srcstride = _srcstride / sizeof(pixel);
pixel *dst = (pixel *)_dst;
ptrdiff_t dststride = _dststride / sizeof(pixel);
const int8_t *filter = ff_hevc_epel_filters[mx - 1];
int16_t tmp_array[(MAX_PB_SIZE + EPEL_EXTRA) * MAX_PB_SIZE];
int16_t *tmp = tmp_array;
int shift = 14 + 1 - BIT_DEPTH;
int log2Wd = denom + shift - 1;
src -= EPEL_EXTRA_BEFORE * srcstride;
for (y = 0; y < height + EPEL_EXTRA; y++) {
for (x = 0; x < width; x++)
tmp[x] = EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8);
src += srcstride;
tmp += MAX_PB_SIZE;
}
tmp = tmp_array + EPEL_EXTRA_BEFORE * MAX_PB_SIZE;
filter = ff_hevc_epel_filters[my - 1];
ox0 = ox0 * (1 << (BIT_DEPTH - 8));
ox1 = ox1 * (1 << (BIT_DEPTH - 8));
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++)
dst[x] = av_clip_pixel(((EPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) * wx1 + src2[x] * wx0 +
((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));
tmp += MAX_PB_SIZE;
dst += dststride;
src2 += MAX_PB_SIZE;
}
}
| true |
FFmpeg
|
fbdab6eca7874fbeba6aa79c269f345e4d43f5d4
|
static void FUNC(put_hevc_epel_bi_w_hv)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
int16_t *src2,
int height, int denom, int wx0, int wx1,
int ox0, int ox1, intptr_t mx, intptr_t my, int width)
{
int x, y;
pixel *src = (pixel *)_src;
ptrdiff_t srcstride = _srcstride / sizeof(pixel);
pixel *dst = (pixel *)_dst;
ptrdiff_t dststride = _dststride / sizeof(pixel);
const int8_t *filter = ff_hevc_epel_filters[mx - 1];
int16_t tmp_array[(MAX_PB_SIZE + EPEL_EXTRA) * MAX_PB_SIZE];
int16_t *tmp = tmp_array;
int shift = 14 + 1 - BIT_DEPTH;
int log2Wd = denom + shift - 1;
src -= EPEL_EXTRA_BEFORE * srcstride;
for (y = 0; y < height + EPEL_EXTRA; y++) {
for (x = 0; x < width; x++)
tmp[x] = EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8);
src += srcstride;
tmp += MAX_PB_SIZE;
}
tmp = tmp_array + EPEL_EXTRA_BEFORE * MAX_PB_SIZE;
filter = ff_hevc_epel_filters[my - 1];
ox0 = ox0 * (1 << (BIT_DEPTH - 8));
ox1 = ox1 * (1 << (BIT_DEPTH - 8));
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++)
dst[x] = av_clip_pixel(((EPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) * wx1 + src2[x] * wx0 +
((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));
tmp += MAX_PB_SIZE;
dst += dststride;
src2 += MAX_PB_SIZE;
}
}
|
{
"code": [
" ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));"
],
"line_no": [
67
]
}
|
static void FUNC_0(put_hevc_epel_bi_w_hv)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
int16_t *src2,
int height, int denom, int wx0, int wx1,
int ox0, int ox1, intptr_t mx, intptr_t my, int width)
{
int VAR_0, VAR_1;
pixel *src = (pixel *)_src;
ptrdiff_t srcstride = _srcstride / sizeof(pixel);
pixel *dst = (pixel *)_dst;
ptrdiff_t dststride = _dststride / sizeof(pixel);
const int8_t *VAR_2 = ff_hevc_epel_filters[mx - 1];
int16_t tmp_array[(MAX_PB_SIZE + EPEL_EXTRA) * MAX_PB_SIZE];
int16_t *tmp = tmp_array;
int VAR_3 = 14 + 1 - BIT_DEPTH;
int VAR_4 = denom + VAR_3 - 1;
src -= EPEL_EXTRA_BEFORE * srcstride;
for (VAR_1 = 0; VAR_1 < height + EPEL_EXTRA; VAR_1++) {
for (VAR_0 = 0; VAR_0 < width; VAR_0++)
tmp[VAR_0] = EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8);
src += srcstride;
tmp += MAX_PB_SIZE;
}
tmp = tmp_array + EPEL_EXTRA_BEFORE * MAX_PB_SIZE;
VAR_2 = ff_hevc_epel_filters[my - 1];
ox0 = ox0 * (1 << (BIT_DEPTH - 8));
ox1 = ox1 * (1 << (BIT_DEPTH - 8));
for (VAR_1 = 0; VAR_1 < height; VAR_1++) {
for (VAR_0 = 0; VAR_0 < width; VAR_0++)
dst[VAR_0] = av_clip_pixel(((EPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) * wx1 + src2[VAR_0] * wx0 +
((ox0 + ox1 + 1) << VAR_4)) >> (VAR_4 + 1));
tmp += MAX_PB_SIZE;
dst += dststride;
src2 += MAX_PB_SIZE;
}
}
|
[
"static void FUNC_0(put_hevc_epel_bi_w_hv)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,\nint16_t *src2,\nint height, int denom, int wx0, int wx1,\nint ox0, int ox1, intptr_t mx, intptr_t my, int width)\n{",
"int VAR_0, VAR_1;",
"pixel *src = (pixel *)_src;",
"ptrdiff_t srcstride = _srcstride / sizeof(pixel);",
"pixel *dst = (pixel *)_dst;",
"ptrdiff_t dststride = _dststride / sizeof(pixel);",
"const int8_t *VAR_2 = ff_hevc_epel_filters[mx - 1];",
"int16_t tmp_array[(MAX_PB_SIZE + EPEL_EXTRA) * MAX_PB_SIZE];",
"int16_t *tmp = tmp_array;",
"int VAR_3 = 14 + 1 - BIT_DEPTH;",
"int VAR_4 = denom + VAR_3 - 1;",
"src -= EPEL_EXTRA_BEFORE * srcstride;",
"for (VAR_1 = 0; VAR_1 < height + EPEL_EXTRA; VAR_1++) {",
"for (VAR_0 = 0; VAR_0 < width; VAR_0++)",
"tmp[VAR_0] = EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8);",
"src += srcstride;",
"tmp += MAX_PB_SIZE;",
"}",
"tmp = tmp_array + EPEL_EXTRA_BEFORE * MAX_PB_SIZE;",
"VAR_2 = ff_hevc_epel_filters[my - 1];",
"ox0 = ox0 * (1 << (BIT_DEPTH - 8));",
"ox1 = ox1 * (1 << (BIT_DEPTH - 8));",
"for (VAR_1 = 0; VAR_1 < height; VAR_1++) {",
"for (VAR_0 = 0; VAR_0 < width; VAR_0++)",
"dst[VAR_0] = av_clip_pixel(((EPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) * wx1 + src2[VAR_0] * wx0 +\n((ox0 + ox1 + 1) << VAR_4)) >> (VAR_4 + 1));",
"tmp += MAX_PB_SIZE;",
"dst += dststride;",
"src2 += MAX_PB_SIZE;",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5,
7,
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
51
],
[
53
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65,
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
]
] |
9,656 |
static int vc1_decode_p_mb(VC1Context *v, DCTELEM block[6][64])
{
MpegEncContext *s = &v->s;
GetBitContext *gb = &s->gb;
int i, j;
int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
int cbp; /* cbp decoding stuff */
int mqdiff, mquant; /* MB quantization */
int ttmb = v->ttfrm; /* MB Transform type */
int status;
static const int size_table[6] = { 0, 2, 3, 4, 5, 8 },
offset_table[6] = { 0, 1, 3, 7, 15, 31 };
int mb_has_coeffs = 1; /* last_flag */
int dmv_x, dmv_y; /* Differential MV components */
int index, index1; /* LUT indices */
int val, sign; /* temp values */
int first_block = 1;
int dst_idx, off;
int skipped, fourmv;
mquant = v->pq; /* Loosy initialization */
if (v->mv_type_is_raw)
fourmv = get_bits1(gb);
else
fourmv = v->mv_type_mb_plane[mb_pos];
if (v->skip_is_raw)
skipped = get_bits1(gb);
else
skipped = v->s.mbskip_table[mb_pos];
s->dsp.clear_blocks(s->block[0]);
if (!fourmv) /* 1MV mode */
{
if (!skipped)
{
GET_MVDATA(dmv_x, dmv_y);
s->current_picture.mb_type[mb_pos] = s->mb_intra ? MB_TYPE_INTRA : MB_TYPE_16x16;
vc1_pred_mv(s, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0]);
/* FIXME Set DC val for inter block ? */
if (s->mb_intra && !mb_has_coeffs)
{
GET_MQUANT();
s->ac_pred = get_bits(gb, 1);
cbp = 0;
}
else if (mb_has_coeffs)
{
if (s->mb_intra) s->ac_pred = get_bits(gb, 1);
cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
GET_MQUANT();
}
else
{
mquant = v->pq;
cbp = 0;
}
s->current_picture.qscale_table[mb_pos] = mquant;
if (!v->ttmbf && !s->mb_intra && mb_has_coeffs)
ttmb = get_vlc2(gb, vc1_ttmb_vlc[v->tt_index].table,
VC1_TTMB_VLC_BITS, 2);
if(!s->mb_intra) vc1_mc_1mv(v);
dst_idx = 0;
for (i=0; i<6; i++)
{
s->dc_val[0][s->block_index[i]] = 0;
dst_idx += i >> 2;
val = ((cbp >> (5 - i)) & 1);
off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize);
v->mb_type[0][s->block_index[i]] = s->mb_intra;
if(s->mb_intra) {
/* check if prediction blocks A and C are available */
v->a_avail = v->c_avail = 0;
if(i == 2 || i == 3 || s->mb_y)
v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]];
if(i == 1 || i == 3 || s->mb_x)
v->c_avail = v->mb_type[0][s->block_index[i] - 1];
vc1_decode_intra_block(v, block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset);
vc1_inv_trans(block[i], 8, 8);
for(j = 0; j < 64; j++) block[i][j] += 128;
s->dsp.put_pixels_clamped(block[i], s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2));
/* TODO: proper loop filtering */
if(v->pq >= 9 && v->overlap) {
if(v->a_avail)
s->dsp.h263_v_loop_filter(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2), s->y_dc_scale);
if(v->c_avail)
s->dsp.h263_h_loop_filter(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2), s->y_dc_scale);
}
} else if(val) {
vc1_decode_p_block(v, block[i], i, mquant, ttmb, first_block);
if(!v->ttmbf && ttmb < 8) ttmb = -1;
first_block = 0;
s->dsp.add_pixels_clamped(block[i], s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize);
}
}
}
else //Skipped
{
s->mb_intra = 0;
for(i = 0; i < 6; i++) v->mb_type[0][s->block_index[i]] = 0;
s->current_picture.mb_type[mb_pos] = MB_TYPE_SKIP;
s->current_picture.qscale_table[mb_pos] = 0;
vc1_pred_mv(s, 0, 0, 0, 1, v->range_x, v->range_y, v->mb_type[0]);
vc1_mc_1mv(v);
return 0;
}
} //1MV mode
else //4MV mode
{
if (!skipped /* unskipped MB */)
{
int intra_count = 0, coded_inter = 0;
int is_intra[6], is_coded[6];
/* Get CBPCY */
cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
for (i=0; i<6; i++)
{
val = ((cbp >> (5 - i)) & 1);
s->dc_val[0][s->block_index[i]] = 0;
s->mb_intra = 0;
if(i < 4) {
dmv_x = dmv_y = 0;
s->mb_intra = 0;
mb_has_coeffs = 0;
if(val) {
GET_MVDATA(dmv_x, dmv_y);
}
vc1_pred_mv(s, i, dmv_x, dmv_y, 0, v->range_x, v->range_y, v->mb_type[0]);
if(!s->mb_intra) vc1_mc_4mv_luma(v, i);
intra_count += s->mb_intra;
is_intra[i] = s->mb_intra;
is_coded[i] = mb_has_coeffs;
}
if(i&4){
is_intra[i] = (intra_count >= 3);
is_coded[i] = val;
}
if(i == 4) vc1_mc_4mv_chroma(v);
v->mb_type[0][s->block_index[i]] = is_intra[i];
if(!coded_inter) coded_inter = !is_intra[i] & is_coded[i];
}
dst_idx = 0;
GET_MQUANT();
s->current_picture.qscale_table[mb_pos] = mquant;
/* test if block is intra and has pred */
{
int intrapred = 0;
for(i=0; i<6; i++)
if(is_intra[i]) {
if(v->mb_type[0][s->block_index[i] - s->block_wrap[i]] || v->mb_type[0][s->block_index[i] - 1]) {
intrapred = 1;
break;
}
}
if(intrapred)s->ac_pred = get_bits(gb, 1);
else s->ac_pred = 0;
}
if (!v->ttmbf && coded_inter)
ttmb = get_vlc2(gb, vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 12);
for (i=0; i<6; i++)
{
dst_idx += i >> 2;
off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize);
s->mb_intra = is_intra[i];
if (is_intra[i]) {
/* check if prediction blocks A and C are available */
v->a_avail = v->c_avail = 0;
if(i == 2 || i == 3 || s->mb_y)
v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]];
if(i == 1 || i == 3 || s->mb_x)
v->c_avail = v->mb_type[0][s->block_index[i] - 1];
vc1_decode_intra_block(v, s->block[i], i, is_coded[i], mquant, (i&4)?v->codingset2:v->codingset);
vc1_inv_trans(block[i], 8, 8);
for(j = 0; j < 64; j++) block[i][j] += 128;
s->dsp.put_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize);
/* TODO: proper loop filtering */
if(v->pq >= 9 && v->overlap) {
if(v->a_avail)
s->dsp.h263_v_loop_filter(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2), s->y_dc_scale);
if(v->c_avail)
s->dsp.h263_h_loop_filter(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2), s->y_dc_scale);
}
} else if(is_coded[i]) {
status = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block);
if(!v->ttmbf && ttmb < 8) ttmb = -1;
first_block = 0;
s->dsp.add_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize);
}
}
return status;
}
else //Skipped MB
{
s->mb_intra = 0;
for (i=0; i<6; i++) v->mb_type[0][s->block_index[i]] = 0;
for (i=0; i<4; i++)
{
vc1_pred_mv(s, i, 0, 0, 0, v->range_x, v->range_y, v->mb_type[0]);
vc1_mc_4mv_luma(v, i);
}
vc1_mc_4mv_chroma(v);
s->current_picture.qscale_table[mb_pos] = 0;
return 0;
}
}
/* Should never happen */
return -1;
}
| true |
FFmpeg
|
928dc49d0e37db50a9d1359ef910cb1856aabfaf
|
static int vc1_decode_p_mb(VC1Context *v, DCTELEM block[6][64])
{
MpegEncContext *s = &v->s;
GetBitContext *gb = &s->gb;
int i, j;
int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
int cbp;
int mqdiff, mquant;
int ttmb = v->ttfrm;
int status;
static const int size_table[6] = { 0, 2, 3, 4, 5, 8 },
offset_table[6] = { 0, 1, 3, 7, 15, 31 };
int mb_has_coeffs = 1;
int dmv_x, dmv_y;
int index, index1;
int val, sign;
int first_block = 1;
int dst_idx, off;
int skipped, fourmv;
mquant = v->pq;
if (v->mv_type_is_raw)
fourmv = get_bits1(gb);
else
fourmv = v->mv_type_mb_plane[mb_pos];
if (v->skip_is_raw)
skipped = get_bits1(gb);
else
skipped = v->s.mbskip_table[mb_pos];
s->dsp.clear_blocks(s->block[0]);
if (!fourmv)
{
if (!skipped)
{
GET_MVDATA(dmv_x, dmv_y);
s->current_picture.mb_type[mb_pos] = s->mb_intra ? MB_TYPE_INTRA : MB_TYPE_16x16;
vc1_pred_mv(s, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0]);
if (s->mb_intra && !mb_has_coeffs)
{
GET_MQUANT();
s->ac_pred = get_bits(gb, 1);
cbp = 0;
}
else if (mb_has_coeffs)
{
if (s->mb_intra) s->ac_pred = get_bits(gb, 1);
cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
GET_MQUANT();
}
else
{
mquant = v->pq;
cbp = 0;
}
s->current_picture.qscale_table[mb_pos] = mquant;
if (!v->ttmbf && !s->mb_intra && mb_has_coeffs)
ttmb = get_vlc2(gb, vc1_ttmb_vlc[v->tt_index].table,
VC1_TTMB_VLC_BITS, 2);
if(!s->mb_intra) vc1_mc_1mv(v);
dst_idx = 0;
for (i=0; i<6; i++)
{
s->dc_val[0][s->block_index[i]] = 0;
dst_idx += i >> 2;
val = ((cbp >> (5 - i)) & 1);
off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize);
v->mb_type[0][s->block_index[i]] = s->mb_intra;
if(s->mb_intra) {
v->a_avail = v->c_avail = 0;
if(i == 2 || i == 3 || s->mb_y)
v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]];
if(i == 1 || i == 3 || s->mb_x)
v->c_avail = v->mb_type[0][s->block_index[i] - 1];
vc1_decode_intra_block(v, block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset);
vc1_inv_trans(block[i], 8, 8);
for(j = 0; j < 64; j++) block[i][j] += 128;
s->dsp.put_pixels_clamped(block[i], s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2));
if(v->pq >= 9 && v->overlap) {
if(v->a_avail)
s->dsp.h263_v_loop_filter(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2), s->y_dc_scale);
if(v->c_avail)
s->dsp.h263_h_loop_filter(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2), s->y_dc_scale);
}
} else if(val) {
vc1_decode_p_block(v, block[i], i, mquant, ttmb, first_block);
if(!v->ttmbf && ttmb < 8) ttmb = -1;
first_block = 0;
s->dsp.add_pixels_clamped(block[i], s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize);
}
}
}
else
{
s->mb_intra = 0;
for(i = 0; i < 6; i++) v->mb_type[0][s->block_index[i]] = 0;
s->current_picture.mb_type[mb_pos] = MB_TYPE_SKIP;
s->current_picture.qscale_table[mb_pos] = 0;
vc1_pred_mv(s, 0, 0, 0, 1, v->range_x, v->range_y, v->mb_type[0]);
vc1_mc_1mv(v);
return 0;
}
}
else
{
if (!skipped )
{
int intra_count = 0, coded_inter = 0;
int is_intra[6], is_coded[6];
cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
for (i=0; i<6; i++)
{
val = ((cbp >> (5 - i)) & 1);
s->dc_val[0][s->block_index[i]] = 0;
s->mb_intra = 0;
if(i < 4) {
dmv_x = dmv_y = 0;
s->mb_intra = 0;
mb_has_coeffs = 0;
if(val) {
GET_MVDATA(dmv_x, dmv_y);
}
vc1_pred_mv(s, i, dmv_x, dmv_y, 0, v->range_x, v->range_y, v->mb_type[0]);
if(!s->mb_intra) vc1_mc_4mv_luma(v, i);
intra_count += s->mb_intra;
is_intra[i] = s->mb_intra;
is_coded[i] = mb_has_coeffs;
}
if(i&4){
is_intra[i] = (intra_count >= 3);
is_coded[i] = val;
}
if(i == 4) vc1_mc_4mv_chroma(v);
v->mb_type[0][s->block_index[i]] = is_intra[i];
if(!coded_inter) coded_inter = !is_intra[i] & is_coded[i];
}
dst_idx = 0;
GET_MQUANT();
s->current_picture.qscale_table[mb_pos] = mquant;
{
int intrapred = 0;
for(i=0; i<6; i++)
if(is_intra[i]) {
if(v->mb_type[0][s->block_index[i] - s->block_wrap[i]] || v->mb_type[0][s->block_index[i] - 1]) {
intrapred = 1;
break;
}
}
if(intrapred)s->ac_pred = get_bits(gb, 1);
else s->ac_pred = 0;
}
if (!v->ttmbf && coded_inter)
ttmb = get_vlc2(gb, vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 12);
for (i=0; i<6; i++)
{
dst_idx += i >> 2;
off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize);
s->mb_intra = is_intra[i];
if (is_intra[i]) {
v->a_avail = v->c_avail = 0;
if(i == 2 || i == 3 || s->mb_y)
v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]];
if(i == 1 || i == 3 || s->mb_x)
v->c_avail = v->mb_type[0][s->block_index[i] - 1];
vc1_decode_intra_block(v, s->block[i], i, is_coded[i], mquant, (i&4)?v->codingset2:v->codingset);
vc1_inv_trans(block[i], 8, 8);
for(j = 0; j < 64; j++) block[i][j] += 128;
s->dsp.put_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize);
if(v->pq >= 9 && v->overlap) {
if(v->a_avail)
s->dsp.h263_v_loop_filter(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2), s->y_dc_scale);
if(v->c_avail)
s->dsp.h263_h_loop_filter(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2), s->y_dc_scale);
}
} else if(is_coded[i]) {
status = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block);
if(!v->ttmbf && ttmb < 8) ttmb = -1;
first_block = 0;
s->dsp.add_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize);
}
}
return status;
}
else MB
{
s->mb_intra = 0;
for (i=0; i<6; i++) v->mb_type[0][s->block_index[i]] = 0;
for (i=0; i<4; i++)
{
vc1_pred_mv(s, i, 0, 0, 0, v->range_x, v->range_y, v->mb_type[0]);
vc1_mc_4mv_luma(v, i);
}
vc1_mc_4mv_chroma(v);
s->current_picture.qscale_table[mb_pos] = 0;
return 0;
}
}
return -1;
}
|
{
"code": [
" if(v->mb_type[0][s->block_index[i] - s->block_wrap[i]] || v->mb_type[0][s->block_index[i] - 1]) {"
],
"line_no": [
311
]
}
|
static int FUNC_0(VC1Context *VAR_0, DCTELEM VAR_1[6][64])
{
MpegEncContext *s = &VAR_0->s;
GetBitContext *gb = &s->gb;
int VAR_2, VAR_3;
int VAR_4 = s->mb_x + s->mb_y * s->mb_stride;
int VAR_5;
int VAR_6, VAR_7;
int VAR_8 = VAR_0->ttfrm;
int VAR_9;
static const int VAR_10[6] = { 0, 2, 3, 4, 5, 8 },
VAR_11[6] = { 0, 1, 3, 7, 15, 31 };
int VAR_12 = 1;
int VAR_13, VAR_14;
int VAR_15, VAR_16;
int VAR_17, VAR_18;
int VAR_19 = 1;
int VAR_20, VAR_21;
int VAR_22, VAR_23;
VAR_7 = VAR_0->pq;
if (VAR_0->mv_type_is_raw)
VAR_23 = get_bits1(gb);
else
VAR_23 = VAR_0->mv_type_mb_plane[VAR_4];
if (VAR_0->skip_is_raw)
VAR_22 = get_bits1(gb);
else
VAR_22 = VAR_0->s.mbskip_table[VAR_4];
s->dsp.clear_blocks(s->VAR_1[0]);
if (!VAR_23)
{
if (!VAR_22)
{
GET_MVDATA(VAR_13, VAR_14);
s->current_picture.mb_type[VAR_4] = s->mb_intra ? MB_TYPE_INTRA : MB_TYPE_16x16;
vc1_pred_mv(s, 0, VAR_13, VAR_14, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0]);
if (s->mb_intra && !VAR_12)
{
GET_MQUANT();
s->ac_pred = get_bits(gb, 1);
VAR_5 = 0;
}
else if (VAR_12)
{
if (s->mb_intra) s->ac_pred = get_bits(gb, 1);
VAR_5 = get_vlc2(&VAR_0->s.gb, VAR_0->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
GET_MQUANT();
}
else
{
VAR_7 = VAR_0->pq;
VAR_5 = 0;
}
s->current_picture.qscale_table[VAR_4] = VAR_7;
if (!VAR_0->ttmbf && !s->mb_intra && VAR_12)
VAR_8 = get_vlc2(gb, vc1_ttmb_vlc[VAR_0->tt_index].table,
VC1_TTMB_VLC_BITS, 2);
if(!s->mb_intra) vc1_mc_1mv(VAR_0);
VAR_20 = 0;
for (VAR_2=0; VAR_2<6; VAR_2++)
{
s->dc_val[0][s->block_index[VAR_2]] = 0;
VAR_20 += VAR_2 >> 2;
VAR_17 = ((VAR_5 >> (5 - VAR_2)) & 1);
VAR_21 = (VAR_2 & 4) ? 0 : ((VAR_2 & 1) * 8 + (VAR_2 & 2) * 4 * s->linesize);
VAR_0->mb_type[0][s->block_index[VAR_2]] = s->mb_intra;
if(s->mb_intra) {
VAR_0->a_avail = VAR_0->c_avail = 0;
if(VAR_2 == 2 || VAR_2 == 3 || s->mb_y)
VAR_0->a_avail = VAR_0->mb_type[0][s->block_index[VAR_2] - s->block_wrap[VAR_2]];
if(VAR_2 == 1 || VAR_2 == 3 || s->mb_x)
VAR_0->c_avail = VAR_0->mb_type[0][s->block_index[VAR_2] - 1];
vc1_decode_intra_block(VAR_0, VAR_1[VAR_2], VAR_2, VAR_17, VAR_7, (VAR_2&4)?VAR_0->codingset2:VAR_0->codingset);
vc1_inv_trans(VAR_1[VAR_2], 8, 8);
for(VAR_3 = 0; VAR_3 < 64; VAR_3++) VAR_1[VAR_2][VAR_3] += 128;
s->dsp.put_pixels_clamped(VAR_1[VAR_2], s->dest[VAR_20] + VAR_21, s->linesize >> ((VAR_2 & 4) >> 2));
if(VAR_0->pq >= 9 && VAR_0->overlap) {
if(VAR_0->a_avail)
s->dsp.h263_v_loop_filter(s->dest[VAR_20] + VAR_21, s->linesize >> ((VAR_2 & 4) >> 2), s->y_dc_scale);
if(VAR_0->c_avail)
s->dsp.h263_h_loop_filter(s->dest[VAR_20] + VAR_21, s->linesize >> ((VAR_2 & 4) >> 2), s->y_dc_scale);
}
} else if(VAR_17) {
vc1_decode_p_block(VAR_0, VAR_1[VAR_2], VAR_2, VAR_7, VAR_8, VAR_19);
if(!VAR_0->ttmbf && VAR_8 < 8) VAR_8 = -1;
VAR_19 = 0;
s->dsp.add_pixels_clamped(VAR_1[VAR_2], s->dest[VAR_20] + VAR_21, (VAR_2&4)?s->uvlinesize:s->linesize);
}
}
}
else
{
s->mb_intra = 0;
for(VAR_2 = 0; VAR_2 < 6; VAR_2++) VAR_0->mb_type[0][s->block_index[VAR_2]] = 0;
s->current_picture.mb_type[VAR_4] = MB_TYPE_SKIP;
s->current_picture.qscale_table[VAR_4] = 0;
vc1_pred_mv(s, 0, 0, 0, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0]);
vc1_mc_1mv(VAR_0);
return 0;
}
}
else
{
if (!VAR_22 )
{
int VAR_24 = 0, VAR_25 = 0;
int VAR_26[6], VAR_27[6];
VAR_5 = get_vlc2(&VAR_0->s.gb, VAR_0->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
for (VAR_2=0; VAR_2<6; VAR_2++)
{
VAR_17 = ((VAR_5 >> (5 - VAR_2)) & 1);
s->dc_val[0][s->block_index[VAR_2]] = 0;
s->mb_intra = 0;
if(VAR_2 < 4) {
VAR_13 = VAR_14 = 0;
s->mb_intra = 0;
VAR_12 = 0;
if(VAR_17) {
GET_MVDATA(VAR_13, VAR_14);
}
vc1_pred_mv(s, VAR_2, VAR_13, VAR_14, 0, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0]);
if(!s->mb_intra) vc1_mc_4mv_luma(VAR_0, VAR_2);
VAR_24 += s->mb_intra;
VAR_26[VAR_2] = s->mb_intra;
VAR_27[VAR_2] = VAR_12;
}
if(VAR_2&4){
VAR_26[VAR_2] = (VAR_24 >= 3);
VAR_27[VAR_2] = VAR_17;
}
if(VAR_2 == 4) vc1_mc_4mv_chroma(VAR_0);
VAR_0->mb_type[0][s->block_index[VAR_2]] = VAR_26[VAR_2];
if(!VAR_25) VAR_25 = !VAR_26[VAR_2] & VAR_27[VAR_2];
}
VAR_20 = 0;
GET_MQUANT();
s->current_picture.qscale_table[VAR_4] = VAR_7;
{
int VAR_28 = 0;
for(VAR_2=0; VAR_2<6; VAR_2++)
if(VAR_26[VAR_2]) {
if(VAR_0->mb_type[0][s->block_index[VAR_2] - s->block_wrap[VAR_2]] || VAR_0->mb_type[0][s->block_index[VAR_2] - 1]) {
VAR_28 = 1;
break;
}
}
if(VAR_28)s->ac_pred = get_bits(gb, 1);
else s->ac_pred = 0;
}
if (!VAR_0->ttmbf && VAR_25)
VAR_8 = get_vlc2(gb, vc1_ttmb_vlc[VAR_0->tt_index].table, VC1_TTMB_VLC_BITS, 12);
for (VAR_2=0; VAR_2<6; VAR_2++)
{
VAR_20 += VAR_2 >> 2;
VAR_21 = (VAR_2 & 4) ? 0 : ((VAR_2 & 1) * 8 + (VAR_2 & 2) * 4 * s->linesize);
s->mb_intra = VAR_26[VAR_2];
if (VAR_26[VAR_2]) {
VAR_0->a_avail = VAR_0->c_avail = 0;
if(VAR_2 == 2 || VAR_2 == 3 || s->mb_y)
VAR_0->a_avail = VAR_0->mb_type[0][s->block_index[VAR_2] - s->block_wrap[VAR_2]];
if(VAR_2 == 1 || VAR_2 == 3 || s->mb_x)
VAR_0->c_avail = VAR_0->mb_type[0][s->block_index[VAR_2] - 1];
vc1_decode_intra_block(VAR_0, s->VAR_1[VAR_2], VAR_2, VAR_27[VAR_2], VAR_7, (VAR_2&4)?VAR_0->codingset2:VAR_0->codingset);
vc1_inv_trans(VAR_1[VAR_2], 8, 8);
for(VAR_3 = 0; VAR_3 < 64; VAR_3++) VAR_1[VAR_2][VAR_3] += 128;
s->dsp.put_pixels_clamped(s->VAR_1[VAR_2], s->dest[VAR_20] + VAR_21, (VAR_2&4)?s->uvlinesize:s->linesize);
if(VAR_0->pq >= 9 && VAR_0->overlap) {
if(VAR_0->a_avail)
s->dsp.h263_v_loop_filter(s->dest[VAR_20] + VAR_21, s->linesize >> ((VAR_2 & 4) >> 2), s->y_dc_scale);
if(VAR_0->c_avail)
s->dsp.h263_h_loop_filter(s->dest[VAR_20] + VAR_21, s->linesize >> ((VAR_2 & 4) >> 2), s->y_dc_scale);
}
} else if(VAR_27[VAR_2]) {
VAR_9 = vc1_decode_p_block(VAR_0, s->VAR_1[VAR_2], VAR_2, VAR_7, VAR_8, VAR_19);
if(!VAR_0->ttmbf && VAR_8 < 8) VAR_8 = -1;
VAR_19 = 0;
s->dsp.add_pixels_clamped(s->VAR_1[VAR_2], s->dest[VAR_20] + VAR_21, (VAR_2&4)?s->uvlinesize:s->linesize);
}
}
return VAR_9;
}
else MB
{
s->mb_intra = 0;
for (VAR_2=0; VAR_2<6; VAR_2++) VAR_0->mb_type[0][s->block_index[VAR_2]] = 0;
for (VAR_2=0; VAR_2<4; VAR_2++)
{
vc1_pred_mv(s, VAR_2, 0, 0, 0, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0]);
vc1_mc_4mv_luma(VAR_0, VAR_2);
}
vc1_mc_4mv_chroma(VAR_0);
s->current_picture.qscale_table[VAR_4] = 0;
return 0;
}
}
return -1;
}
|
[
"static int FUNC_0(VC1Context *VAR_0, DCTELEM VAR_1[6][64])\n{",
"MpegEncContext *s = &VAR_0->s;",
"GetBitContext *gb = &s->gb;",
"int VAR_2, VAR_3;",
"int VAR_4 = s->mb_x + s->mb_y * s->mb_stride;",
"int VAR_5;",
"int VAR_6, VAR_7;",
"int VAR_8 = VAR_0->ttfrm;",
"int VAR_9;",
"static const int VAR_10[6] = { 0, 2, 3, 4, 5, 8 },",
"VAR_11[6] = { 0, 1, 3, 7, 15, 31 };",
"int VAR_12 = 1;",
"int VAR_13, VAR_14;",
"int VAR_15, VAR_16;",
"int VAR_17, VAR_18;",
"int VAR_19 = 1;",
"int VAR_20, VAR_21;",
"int VAR_22, VAR_23;",
"VAR_7 = VAR_0->pq;",
"if (VAR_0->mv_type_is_raw)\nVAR_23 = get_bits1(gb);",
"else\nVAR_23 = VAR_0->mv_type_mb_plane[VAR_4];",
"if (VAR_0->skip_is_raw)\nVAR_22 = get_bits1(gb);",
"else\nVAR_22 = VAR_0->s.mbskip_table[VAR_4];",
"s->dsp.clear_blocks(s->VAR_1[0]);",
"if (!VAR_23)\n{",
"if (!VAR_22)\n{",
"GET_MVDATA(VAR_13, VAR_14);",
"s->current_picture.mb_type[VAR_4] = s->mb_intra ? MB_TYPE_INTRA : MB_TYPE_16x16;",
"vc1_pred_mv(s, 0, VAR_13, VAR_14, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0]);",
"if (s->mb_intra && !VAR_12)\n{",
"GET_MQUANT();",
"s->ac_pred = get_bits(gb, 1);",
"VAR_5 = 0;",
"}",
"else if (VAR_12)\n{",
"if (s->mb_intra) s->ac_pred = get_bits(gb, 1);",
"VAR_5 = get_vlc2(&VAR_0->s.gb, VAR_0->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);",
"GET_MQUANT();",
"}",
"else\n{",
"VAR_7 = VAR_0->pq;",
"VAR_5 = 0;",
"}",
"s->current_picture.qscale_table[VAR_4] = VAR_7;",
"if (!VAR_0->ttmbf && !s->mb_intra && VAR_12)\nVAR_8 = get_vlc2(gb, vc1_ttmb_vlc[VAR_0->tt_index].table,\nVC1_TTMB_VLC_BITS, 2);",
"if(!s->mb_intra) vc1_mc_1mv(VAR_0);",
"VAR_20 = 0;",
"for (VAR_2=0; VAR_2<6; VAR_2++)",
"{",
"s->dc_val[0][s->block_index[VAR_2]] = 0;",
"VAR_20 += VAR_2 >> 2;",
"VAR_17 = ((VAR_5 >> (5 - VAR_2)) & 1);",
"VAR_21 = (VAR_2 & 4) ? 0 : ((VAR_2 & 1) * 8 + (VAR_2 & 2) * 4 * s->linesize);",
"VAR_0->mb_type[0][s->block_index[VAR_2]] = s->mb_intra;",
"if(s->mb_intra) {",
"VAR_0->a_avail = VAR_0->c_avail = 0;",
"if(VAR_2 == 2 || VAR_2 == 3 || s->mb_y)\nVAR_0->a_avail = VAR_0->mb_type[0][s->block_index[VAR_2] - s->block_wrap[VAR_2]];",
"if(VAR_2 == 1 || VAR_2 == 3 || s->mb_x)\nVAR_0->c_avail = VAR_0->mb_type[0][s->block_index[VAR_2] - 1];",
"vc1_decode_intra_block(VAR_0, VAR_1[VAR_2], VAR_2, VAR_17, VAR_7, (VAR_2&4)?VAR_0->codingset2:VAR_0->codingset);",
"vc1_inv_trans(VAR_1[VAR_2], 8, 8);",
"for(VAR_3 = 0; VAR_3 < 64; VAR_3++) VAR_1[VAR_2][VAR_3] += 128;",
"s->dsp.put_pixels_clamped(VAR_1[VAR_2], s->dest[VAR_20] + VAR_21, s->linesize >> ((VAR_2 & 4) >> 2));",
"if(VAR_0->pq >= 9 && VAR_0->overlap) {",
"if(VAR_0->a_avail)\ns->dsp.h263_v_loop_filter(s->dest[VAR_20] + VAR_21, s->linesize >> ((VAR_2 & 4) >> 2), s->y_dc_scale);",
"if(VAR_0->c_avail)\ns->dsp.h263_h_loop_filter(s->dest[VAR_20] + VAR_21, s->linesize >> ((VAR_2 & 4) >> 2), s->y_dc_scale);",
"}",
"} else if(VAR_17) {",
"vc1_decode_p_block(VAR_0, VAR_1[VAR_2], VAR_2, VAR_7, VAR_8, VAR_19);",
"if(!VAR_0->ttmbf && VAR_8 < 8) VAR_8 = -1;",
"VAR_19 = 0;",
"s->dsp.add_pixels_clamped(VAR_1[VAR_2], s->dest[VAR_20] + VAR_21, (VAR_2&4)?s->uvlinesize:s->linesize);",
"}",
"}",
"}",
"else\n{",
"s->mb_intra = 0;",
"for(VAR_2 = 0; VAR_2 < 6; VAR_2++) VAR_0->mb_type[0][s->block_index[VAR_2]] = 0;",
"s->current_picture.mb_type[VAR_4] = MB_TYPE_SKIP;",
"s->current_picture.qscale_table[VAR_4] = 0;",
"vc1_pred_mv(s, 0, 0, 0, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0]);",
"vc1_mc_1mv(VAR_0);",
"return 0;",
"}",
"}",
"else\n{",
"if (!VAR_22 )\n{",
"int VAR_24 = 0, VAR_25 = 0;",
"int VAR_26[6], VAR_27[6];",
"VAR_5 = get_vlc2(&VAR_0->s.gb, VAR_0->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);",
"for (VAR_2=0; VAR_2<6; VAR_2++)",
"{",
"VAR_17 = ((VAR_5 >> (5 - VAR_2)) & 1);",
"s->dc_val[0][s->block_index[VAR_2]] = 0;",
"s->mb_intra = 0;",
"if(VAR_2 < 4) {",
"VAR_13 = VAR_14 = 0;",
"s->mb_intra = 0;",
"VAR_12 = 0;",
"if(VAR_17) {",
"GET_MVDATA(VAR_13, VAR_14);",
"}",
"vc1_pred_mv(s, VAR_2, VAR_13, VAR_14, 0, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0]);",
"if(!s->mb_intra) vc1_mc_4mv_luma(VAR_0, VAR_2);",
"VAR_24 += s->mb_intra;",
"VAR_26[VAR_2] = s->mb_intra;",
"VAR_27[VAR_2] = VAR_12;",
"}",
"if(VAR_2&4){",
"VAR_26[VAR_2] = (VAR_24 >= 3);",
"VAR_27[VAR_2] = VAR_17;",
"}",
"if(VAR_2 == 4) vc1_mc_4mv_chroma(VAR_0);",
"VAR_0->mb_type[0][s->block_index[VAR_2]] = VAR_26[VAR_2];",
"if(!VAR_25) VAR_25 = !VAR_26[VAR_2] & VAR_27[VAR_2];",
"}",
"VAR_20 = 0;",
"GET_MQUANT();",
"s->current_picture.qscale_table[VAR_4] = VAR_7;",
"{",
"int VAR_28 = 0;",
"for(VAR_2=0; VAR_2<6; VAR_2++)",
"if(VAR_26[VAR_2]) {",
"if(VAR_0->mb_type[0][s->block_index[VAR_2] - s->block_wrap[VAR_2]] || VAR_0->mb_type[0][s->block_index[VAR_2] - 1]) {",
"VAR_28 = 1;",
"break;",
"}",
"}",
"if(VAR_28)s->ac_pred = get_bits(gb, 1);",
"else s->ac_pred = 0;",
"}",
"if (!VAR_0->ttmbf && VAR_25)\nVAR_8 = get_vlc2(gb, vc1_ttmb_vlc[VAR_0->tt_index].table, VC1_TTMB_VLC_BITS, 12);",
"for (VAR_2=0; VAR_2<6; VAR_2++)",
"{",
"VAR_20 += VAR_2 >> 2;",
"VAR_21 = (VAR_2 & 4) ? 0 : ((VAR_2 & 1) * 8 + (VAR_2 & 2) * 4 * s->linesize);",
"s->mb_intra = VAR_26[VAR_2];",
"if (VAR_26[VAR_2]) {",
"VAR_0->a_avail = VAR_0->c_avail = 0;",
"if(VAR_2 == 2 || VAR_2 == 3 || s->mb_y)\nVAR_0->a_avail = VAR_0->mb_type[0][s->block_index[VAR_2] - s->block_wrap[VAR_2]];",
"if(VAR_2 == 1 || VAR_2 == 3 || s->mb_x)\nVAR_0->c_avail = VAR_0->mb_type[0][s->block_index[VAR_2] - 1];",
"vc1_decode_intra_block(VAR_0, s->VAR_1[VAR_2], VAR_2, VAR_27[VAR_2], VAR_7, (VAR_2&4)?VAR_0->codingset2:VAR_0->codingset);",
"vc1_inv_trans(VAR_1[VAR_2], 8, 8);",
"for(VAR_3 = 0; VAR_3 < 64; VAR_3++) VAR_1[VAR_2][VAR_3] += 128;",
"s->dsp.put_pixels_clamped(s->VAR_1[VAR_2], s->dest[VAR_20] + VAR_21, (VAR_2&4)?s->uvlinesize:s->linesize);",
"if(VAR_0->pq >= 9 && VAR_0->overlap) {",
"if(VAR_0->a_avail)\ns->dsp.h263_v_loop_filter(s->dest[VAR_20] + VAR_21, s->linesize >> ((VAR_2 & 4) >> 2), s->y_dc_scale);",
"if(VAR_0->c_avail)\ns->dsp.h263_h_loop_filter(s->dest[VAR_20] + VAR_21, s->linesize >> ((VAR_2 & 4) >> 2), s->y_dc_scale);",
"}",
"} else if(VAR_27[VAR_2]) {",
"VAR_9 = vc1_decode_p_block(VAR_0, s->VAR_1[VAR_2], VAR_2, VAR_7, VAR_8, VAR_19);",
"if(!VAR_0->ttmbf && VAR_8 < 8) VAR_8 = -1;",
"VAR_19 = 0;",
"s->dsp.add_pixels_clamped(s->VAR_1[VAR_2], s->dest[VAR_20] + VAR_21, (VAR_2&4)?s->uvlinesize:s->linesize);",
"}",
"}",
"return VAR_9;",
"}",
"else MB\n{",
"s->mb_intra = 0;",
"for (VAR_2=0; VAR_2<6; VAR_2++) VAR_0->mb_type[0][s->block_index[VAR_2]] = 0;",
"for (VAR_2=0; VAR_2<4; VAR_2++)",
"{",
"vc1_pred_mv(s, VAR_2, 0, 0, 0, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0]);",
"vc1_mc_4mv_luma(VAR_0, VAR_2);",
"}",
"vc1_mc_4mv_chroma(VAR_0);",
"s->current_picture.qscale_table[VAR_4] = 0;",
"return 0;",
"}",
"}",
"return -1;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
43
],
[
47,
49
],
[
51,
53
],
[
55,
57
],
[
59,
61
],
[
65
],
[
69,
71
],
[
73,
75
],
[
77
],
[
81
],
[
83
],
[
89,
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101,
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113,
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
127,
129,
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149
],
[
151
],
[
155
],
[
157,
159
],
[
161,
163
],
[
167
],
[
169
],
[
171
],
[
173
],
[
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
],
[
241
],
[
243
],
[
245
],
[
247
],
[
249
],
[
251
],
[
253
],
[
255
],
[
257
],
[
259
],
[
261
],
[
263
],
[
265
],
[
267
],
[
269
],
[
271
],
[
273
],
[
275
],
[
277
],
[
279
],
[
281
],
[
283
],
[
285
],
[
287
],
[
289
],
[
291
],
[
293
],
[
295
],
[
297
],
[
299
],
[
303
],
[
305
],
[
307
],
[
309
],
[
311
],
[
313
],
[
315
],
[
317
],
[
319
],
[
321
],
[
323
],
[
325
],
[
327,
329
],
[
331
],
[
333
],
[
335
],
[
337
],
[
339
],
[
341
],
[
345
],
[
347,
349
],
[
351,
353
],
[
357
],
[
359
],
[
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
],
[
429
],
[
431
]
] |
9,657 |
void qemu_co_rwlock_rdlock(CoRwlock *lock)
{
while (lock->writer) {
qemu_co_queue_wait(&lock->queue);
}
lock->reader++;
}
| true |
qemu
|
1b7f01d966f97b7820f3cdd471461cf0799a93cc
|
void qemu_co_rwlock_rdlock(CoRwlock *lock)
{
while (lock->writer) {
qemu_co_queue_wait(&lock->queue);
}
lock->reader++;
}
|
{
"code": [],
"line_no": []
}
|
void FUNC_0(CoRwlock *VAR_0)
{
while (VAR_0->writer) {
qemu_co_queue_wait(&VAR_0->queue);
}
VAR_0->reader++;
}
|
[
"void FUNC_0(CoRwlock *VAR_0)\n{",
"while (VAR_0->writer) {",
"qemu_co_queue_wait(&VAR_0->queue);",
"}",
"VAR_0->reader++;",
"}"
] |
[
0,
0,
0,
0,
0,
0
] |
[
[
1,
2
],
[
3
],
[
4
],
[
5
],
[
6
],
[
7
]
] |
9,658 |
static Qcow2BitmapList *bitmap_list_load(BlockDriverState *bs, uint64_t offset,
uint64_t size, Error **errp)
{
int ret;
BDRVQcow2State *s = bs->opaque;
uint8_t *dir, *dir_end;
Qcow2BitmapDirEntry *e;
uint32_t nb_dir_entries = 0;
Qcow2BitmapList *bm_list = NULL;
if (size == 0) {
error_setg(errp, "Requested bitmap directory size is zero");
return NULL;
}
if (size > QCOW2_MAX_BITMAP_DIRECTORY_SIZE) {
error_setg(errp, "Requested bitmap directory size is too big");
return NULL;
}
dir = g_try_malloc(size);
if (dir == NULL) {
error_setg(errp, "Failed to allocate space for bitmap directory");
return NULL;
}
dir_end = dir + size;
ret = bdrv_pread(bs->file, offset, dir, size);
if (ret < 0) {
error_setg_errno(errp, -ret, "Failed to read bitmap directory");
goto fail;
}
bm_list = bitmap_list_new();
for (e = (Qcow2BitmapDirEntry *)dir;
e < (Qcow2BitmapDirEntry *)dir_end;
e = next_dir_entry(e))
{
Qcow2Bitmap *bm;
if ((uint8_t *)(e + 1) > dir_end) {
goto broken_dir;
}
if (++nb_dir_entries > s->nb_bitmaps) {
error_setg(errp, "More bitmaps found than specified in header"
" extension");
goto fail;
}
bitmap_dir_entry_to_cpu(e);
if ((uint8_t *)next_dir_entry(e) > dir_end) {
goto broken_dir;
}
if (e->extra_data_size != 0) {
error_setg(errp, "Bitmap extra data is not supported");
goto fail;
}
ret = check_dir_entry(bs, e);
if (ret < 0) {
error_setg(errp, "Bitmap '%.*s' doesn't satisfy the constraints",
e->name_size, dir_entry_name_field(e));
goto fail;
}
bm = g_new(Qcow2Bitmap, 1);
bm->table.offset = e->bitmap_table_offset;
bm->table.size = e->bitmap_table_size;
bm->flags = e->flags;
bm->granularity_bits = e->granularity_bits;
bm->name = dir_entry_copy_name(e);
QSIMPLEQ_INSERT_TAIL(bm_list, bm, entry);
}
if (nb_dir_entries != s->nb_bitmaps) {
error_setg(errp, "Less bitmaps found than specified in header"
" extension");
goto fail;
}
if ((uint8_t *)e != dir_end) {
goto broken_dir;
}
g_free(dir);
return bm_list;
broken_dir:
ret = -EINVAL;
error_setg(errp, "Broken bitmap directory");
fail:
g_free(dir);
bitmap_list_free(bm_list);
return NULL;
}
| true |
qemu
|
5330f32b71b1868bdb3b444733063cb5adc4e8e6
|
static Qcow2BitmapList *bitmap_list_load(BlockDriverState *bs, uint64_t offset,
uint64_t size, Error **errp)
{
int ret;
BDRVQcow2State *s = bs->opaque;
uint8_t *dir, *dir_end;
Qcow2BitmapDirEntry *e;
uint32_t nb_dir_entries = 0;
Qcow2BitmapList *bm_list = NULL;
if (size == 0) {
error_setg(errp, "Requested bitmap directory size is zero");
return NULL;
}
if (size > QCOW2_MAX_BITMAP_DIRECTORY_SIZE) {
error_setg(errp, "Requested bitmap directory size is too big");
return NULL;
}
dir = g_try_malloc(size);
if (dir == NULL) {
error_setg(errp, "Failed to allocate space for bitmap directory");
return NULL;
}
dir_end = dir + size;
ret = bdrv_pread(bs->file, offset, dir, size);
if (ret < 0) {
error_setg_errno(errp, -ret, "Failed to read bitmap directory");
goto fail;
}
bm_list = bitmap_list_new();
for (e = (Qcow2BitmapDirEntry *)dir;
e < (Qcow2BitmapDirEntry *)dir_end;
e = next_dir_entry(e))
{
Qcow2Bitmap *bm;
if ((uint8_t *)(e + 1) > dir_end) {
goto broken_dir;
}
if (++nb_dir_entries > s->nb_bitmaps) {
error_setg(errp, "More bitmaps found than specified in header"
" extension");
goto fail;
}
bitmap_dir_entry_to_cpu(e);
if ((uint8_t *)next_dir_entry(e) > dir_end) {
goto broken_dir;
}
if (e->extra_data_size != 0) {
error_setg(errp, "Bitmap extra data is not supported");
goto fail;
}
ret = check_dir_entry(bs, e);
if (ret < 0) {
error_setg(errp, "Bitmap '%.*s' doesn't satisfy the constraints",
e->name_size, dir_entry_name_field(e));
goto fail;
}
bm = g_new(Qcow2Bitmap, 1);
bm->table.offset = e->bitmap_table_offset;
bm->table.size = e->bitmap_table_size;
bm->flags = e->flags;
bm->granularity_bits = e->granularity_bits;
bm->name = dir_entry_copy_name(e);
QSIMPLEQ_INSERT_TAIL(bm_list, bm, entry);
}
if (nb_dir_entries != s->nb_bitmaps) {
error_setg(errp, "Less bitmaps found than specified in header"
" extension");
goto fail;
}
if ((uint8_t *)e != dir_end) {
goto broken_dir;
}
g_free(dir);
return bm_list;
broken_dir:
ret = -EINVAL;
error_setg(errp, "Broken bitmap directory");
fail:
g_free(dir);
bitmap_list_free(bm_list);
return NULL;
}
|
{
"code": [
" bm = g_new(Qcow2Bitmap, 1);"
],
"line_no": [
135
]
}
|
static Qcow2BitmapList *FUNC_0(BlockDriverState *bs, uint64_t offset,
uint64_t size, Error **errp)
{
int VAR_0;
BDRVQcow2State *s = bs->opaque;
uint8_t *dir, *dir_end;
Qcow2BitmapDirEntry *e;
uint32_t nb_dir_entries = 0;
Qcow2BitmapList *bm_list = NULL;
if (size == 0) {
error_setg(errp, "Requested bitmap directory size is zero");
return NULL;
}
if (size > QCOW2_MAX_BITMAP_DIRECTORY_SIZE) {
error_setg(errp, "Requested bitmap directory size is too big");
return NULL;
}
dir = g_try_malloc(size);
if (dir == NULL) {
error_setg(errp, "Failed to allocate space for bitmap directory");
return NULL;
}
dir_end = dir + size;
VAR_0 = bdrv_pread(bs->file, offset, dir, size);
if (VAR_0 < 0) {
error_setg_errno(errp, -VAR_0, "Failed to read bitmap directory");
goto fail;
}
bm_list = bitmap_list_new();
for (e = (Qcow2BitmapDirEntry *)dir;
e < (Qcow2BitmapDirEntry *)dir_end;
e = next_dir_entry(e))
{
Qcow2Bitmap *bm;
if ((uint8_t *)(e + 1) > dir_end) {
goto broken_dir;
}
if (++nb_dir_entries > s->nb_bitmaps) {
error_setg(errp, "More bitmaps found than specified in header"
" extension");
goto fail;
}
bitmap_dir_entry_to_cpu(e);
if ((uint8_t *)next_dir_entry(e) > dir_end) {
goto broken_dir;
}
if (e->extra_data_size != 0) {
error_setg(errp, "Bitmap extra data is not supported");
goto fail;
}
VAR_0 = check_dir_entry(bs, e);
if (VAR_0 < 0) {
error_setg(errp, "Bitmap '%.*s' doesn't satisfy the constraints",
e->name_size, dir_entry_name_field(e));
goto fail;
}
bm = g_new(Qcow2Bitmap, 1);
bm->table.offset = e->bitmap_table_offset;
bm->table.size = e->bitmap_table_size;
bm->flags = e->flags;
bm->granularity_bits = e->granularity_bits;
bm->name = dir_entry_copy_name(e);
QSIMPLEQ_INSERT_TAIL(bm_list, bm, entry);
}
if (nb_dir_entries != s->nb_bitmaps) {
error_setg(errp, "Less bitmaps found than specified in header"
" extension");
goto fail;
}
if ((uint8_t *)e != dir_end) {
goto broken_dir;
}
g_free(dir);
return bm_list;
broken_dir:
VAR_0 = -EINVAL;
error_setg(errp, "Broken bitmap directory");
fail:
g_free(dir);
bitmap_list_free(bm_list);
return NULL;
}
|
[
"static Qcow2BitmapList *FUNC_0(BlockDriverState *bs, uint64_t offset,\nuint64_t size, Error **errp)\n{",
"int VAR_0;",
"BDRVQcow2State *s = bs->opaque;",
"uint8_t *dir, *dir_end;",
"Qcow2BitmapDirEntry *e;",
"uint32_t nb_dir_entries = 0;",
"Qcow2BitmapList *bm_list = NULL;",
"if (size == 0) {",
"error_setg(errp, \"Requested bitmap directory size is zero\");",
"return NULL;",
"}",
"if (size > QCOW2_MAX_BITMAP_DIRECTORY_SIZE) {",
"error_setg(errp, \"Requested bitmap directory size is too big\");",
"return NULL;",
"}",
"dir = g_try_malloc(size);",
"if (dir == NULL) {",
"error_setg(errp, \"Failed to allocate space for bitmap directory\");",
"return NULL;",
"}",
"dir_end = dir + size;",
"VAR_0 = bdrv_pread(bs->file, offset, dir, size);",
"if (VAR_0 < 0) {",
"error_setg_errno(errp, -VAR_0, \"Failed to read bitmap directory\");",
"goto fail;",
"}",
"bm_list = bitmap_list_new();",
"for (e = (Qcow2BitmapDirEntry *)dir;",
"e < (Qcow2BitmapDirEntry *)dir_end;",
"e = next_dir_entry(e))\n{",
"Qcow2Bitmap *bm;",
"if ((uint8_t *)(e + 1) > dir_end) {",
"goto broken_dir;",
"}",
"if (++nb_dir_entries > s->nb_bitmaps) {",
"error_setg(errp, \"More bitmaps found than specified in header\"\n\" extension\");",
"goto fail;",
"}",
"bitmap_dir_entry_to_cpu(e);",
"if ((uint8_t *)next_dir_entry(e) > dir_end) {",
"goto broken_dir;",
"}",
"if (e->extra_data_size != 0) {",
"error_setg(errp, \"Bitmap extra data is not supported\");",
"goto fail;",
"}",
"VAR_0 = check_dir_entry(bs, e);",
"if (VAR_0 < 0) {",
"error_setg(errp, \"Bitmap '%.*s' doesn't satisfy the constraints\",\ne->name_size, dir_entry_name_field(e));",
"goto fail;",
"}",
"bm = g_new(Qcow2Bitmap, 1);",
"bm->table.offset = e->bitmap_table_offset;",
"bm->table.size = e->bitmap_table_size;",
"bm->flags = e->flags;",
"bm->granularity_bits = e->granularity_bits;",
"bm->name = dir_entry_copy_name(e);",
"QSIMPLEQ_INSERT_TAIL(bm_list, bm, entry);",
"}",
"if (nb_dir_entries != s->nb_bitmaps) {",
"error_setg(errp, \"Less bitmaps found than specified in header\"\n\" extension\");",
"goto fail;",
"}",
"if ((uint8_t *)e != dir_end) {",
"goto broken_dir;",
"}",
"g_free(dir);",
"return bm_list;",
"broken_dir:\nVAR_0 = -EINVAL;",
"error_setg(errp, \"Broken bitmap directory\");",
"fail:\ng_free(dir);",
"bitmap_list_free(bm_list);",
"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,
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
],
[
21
],
[
23
],
[
25
],
[
27
],
[
31
],
[
33
],
[
35
],
[
37
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
67
],
[
69
],
[
71
],
[
73,
75
],
[
77
],
[
81
],
[
83
],
[
85
],
[
89
],
[
91,
93
],
[
95
],
[
97
],
[
99
],
[
103
],
[
105
],
[
107
],
[
111
],
[
113
],
[
115
],
[
117
],
[
121
],
[
123
],
[
125,
127
],
[
129
],
[
131
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149
],
[
153
],
[
155,
157
],
[
159
],
[
161
],
[
165
],
[
167
],
[
169
],
[
173
],
[
175
],
[
179,
181
],
[
183
],
[
187,
189
],
[
191
],
[
195
],
[
197
]
] |
9,662 |
static void test_copy(const AVCodec *c1, const AVCodec *c2)
{
AVCodecContext *ctx1, *ctx2;
printf("%s -> %s\nclosed:\n", c1 ? c1->name : "NULL", c2 ? c2->name : "NULL");
ctx1 = avcodec_alloc_context3(c1);
ctx2 = avcodec_alloc_context3(c2);
ctx1->width = ctx1->height = 128;
if (ctx2->codec && ctx2->codec->priv_class && ctx2->codec->priv_data_size) {
av_opt_set(ctx2->priv_data, "num", "667", 0);
av_opt_set(ctx2->priv_data, "str", "i'm dest value before copy", 0);
}
avcodec_copy_context(ctx2, ctx1);
test_copy_print_codec(ctx1);
test_copy_print_codec(ctx2);
if (ctx1->codec) {
printf("opened:\n");
avcodec_open2(ctx1, ctx1->codec, NULL);
if (ctx2->codec && ctx2->codec->priv_class && ctx2->codec->priv_data_size) {
av_opt_set(ctx2->priv_data, "num", "667", 0);
av_opt_set(ctx2->priv_data, "str", "i'm dest value before copy", 0);
}
avcodec_copy_context(ctx2, ctx1);
test_copy_print_codec(ctx1);
test_copy_print_codec(ctx2);
avcodec_close(ctx1);
}
avcodec_free_context(&ctx1);
avcodec_free_context(&ctx2);
}
| false |
FFmpeg
|
699201ac0ef64baee261bc6fc587d00724f195af
|
static void test_copy(const AVCodec *c1, const AVCodec *c2)
{
AVCodecContext *ctx1, *ctx2;
printf("%s -> %s\nclosed:\n", c1 ? c1->name : "NULL", c2 ? c2->name : "NULL");
ctx1 = avcodec_alloc_context3(c1);
ctx2 = avcodec_alloc_context3(c2);
ctx1->width = ctx1->height = 128;
if (ctx2->codec && ctx2->codec->priv_class && ctx2->codec->priv_data_size) {
av_opt_set(ctx2->priv_data, "num", "667", 0);
av_opt_set(ctx2->priv_data, "str", "i'm dest value before copy", 0);
}
avcodec_copy_context(ctx2, ctx1);
test_copy_print_codec(ctx1);
test_copy_print_codec(ctx2);
if (ctx1->codec) {
printf("opened:\n");
avcodec_open2(ctx1, ctx1->codec, NULL);
if (ctx2->codec && ctx2->codec->priv_class && ctx2->codec->priv_data_size) {
av_opt_set(ctx2->priv_data, "num", "667", 0);
av_opt_set(ctx2->priv_data, "str", "i'm dest value before copy", 0);
}
avcodec_copy_context(ctx2, ctx1);
test_copy_print_codec(ctx1);
test_copy_print_codec(ctx2);
avcodec_close(ctx1);
}
avcodec_free_context(&ctx1);
avcodec_free_context(&ctx2);
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(const AVCodec *VAR_0, const AVCodec *VAR_1)
{
AVCodecContext *ctx1, *ctx2;
printf("%s -> %s\nclosed:\n", VAR_0 ? VAR_0->name : "NULL", VAR_1 ? VAR_1->name : "NULL");
ctx1 = avcodec_alloc_context3(VAR_0);
ctx2 = avcodec_alloc_context3(VAR_1);
ctx1->width = ctx1->height = 128;
if (ctx2->codec && ctx2->codec->priv_class && ctx2->codec->priv_data_size) {
av_opt_set(ctx2->priv_data, "num", "667", 0);
av_opt_set(ctx2->priv_data, "str", "i'm dest value before copy", 0);
}
avcodec_copy_context(ctx2, ctx1);
test_copy_print_codec(ctx1);
test_copy_print_codec(ctx2);
if (ctx1->codec) {
printf("opened:\n");
avcodec_open2(ctx1, ctx1->codec, NULL);
if (ctx2->codec && ctx2->codec->priv_class && ctx2->codec->priv_data_size) {
av_opt_set(ctx2->priv_data, "num", "667", 0);
av_opt_set(ctx2->priv_data, "str", "i'm dest value before copy", 0);
}
avcodec_copy_context(ctx2, ctx1);
test_copy_print_codec(ctx1);
test_copy_print_codec(ctx2);
avcodec_close(ctx1);
}
avcodec_free_context(&ctx1);
avcodec_free_context(&ctx2);
}
|
[
"static void FUNC_0(const AVCodec *VAR_0, const AVCodec *VAR_1)\n{",
"AVCodecContext *ctx1, *ctx2;",
"printf(\"%s -> %s\\nclosed:\\n\", VAR_0 ? VAR_0->name : \"NULL\", VAR_1 ? VAR_1->name : \"NULL\");",
"ctx1 = avcodec_alloc_context3(VAR_0);",
"ctx2 = avcodec_alloc_context3(VAR_1);",
"ctx1->width = ctx1->height = 128;",
"if (ctx2->codec && ctx2->codec->priv_class && ctx2->codec->priv_data_size) {",
"av_opt_set(ctx2->priv_data, \"num\", \"667\", 0);",
"av_opt_set(ctx2->priv_data, \"str\", \"i'm dest value before copy\", 0);",
"}",
"avcodec_copy_context(ctx2, ctx1);",
"test_copy_print_codec(ctx1);",
"test_copy_print_codec(ctx2);",
"if (ctx1->codec) {",
"printf(\"opened:\\n\");",
"avcodec_open2(ctx1, ctx1->codec, NULL);",
"if (ctx2->codec && ctx2->codec->priv_class && ctx2->codec->priv_data_size) {",
"av_opt_set(ctx2->priv_data, \"num\", \"667\", 0);",
"av_opt_set(ctx2->priv_data, \"str\", \"i'm dest value before copy\", 0);",
"}",
"avcodec_copy_context(ctx2, ctx1);",
"test_copy_print_codec(ctx1);",
"test_copy_print_codec(ctx2);",
"avcodec_close(ctx1);",
"}",
"avcodec_free_context(&ctx1);",
"avcodec_free_context(&ctx2);",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
]
] |
9,663 |
static int process_audio_header_elements(AVFormatContext *s)
{
int inHeader = 1;
EaDemuxContext *ea = s->priv_data;
ByteIOContext *pb = &s->pb;
int compression_type;
ea->num_channels = 1;
while (inHeader) {
int inSubheader;
uint8_t byte;
byte = get_byte(pb);
switch (byte) {
case 0xFD:
av_log (s, AV_LOG_INFO, "entered audio subheader\n");
inSubheader = 1;
while (inSubheader) {
uint8_t subbyte;
subbyte = get_byte(pb);
switch (subbyte) {
case 0x82:
ea->num_channels = read_arbitary(pb);
av_log (s, AV_LOG_INFO, "num_channels (element 0x82) set to 0x%08x\n", ea->num_channels);
break;
case 0x83:
compression_type = read_arbitary(pb);
av_log (s, AV_LOG_INFO, "compression_type (element 0x83) set to 0x%08x\n", compression_type);
break;
case 0x85:
ea->num_samples = read_arbitary(pb);
av_log (s, AV_LOG_INFO, "num_samples (element 0x85) set to 0x%08x\n", ea->num_samples);
break;
case 0x8A:
av_log (s, AV_LOG_INFO, "element 0x%02x set to 0x%08x\n", subbyte, read_arbitary(pb));
av_log (s, AV_LOG_INFO, "exited audio subheader\n");
inSubheader = 0;
break;
case 0xFF:
av_log (s, AV_LOG_INFO, "end of header block reached (within audio subheader)\n");
inSubheader = 0;
inHeader = 0;
break;
default:
av_log (s, AV_LOG_INFO, "element 0x%02x set to 0x%08x\n", subbyte, read_arbitary(pb));
break;
}
}
break;
case 0xFF:
av_log (s, AV_LOG_INFO, "end of header block reached\n");
inHeader = 0;
break;
default:
av_log (s, AV_LOG_INFO, "header element 0x%02x set to 0x%08x\n", byte, read_arbitary(pb));
break;
}
}
ea->audio_codec = CODEC_ID_ADPCM_EA;
return 1;
}
| false |
FFmpeg
|
93fa8b2bf5eb4302b2b188e7cbc44bf4909fd510
|
static int process_audio_header_elements(AVFormatContext *s)
{
int inHeader = 1;
EaDemuxContext *ea = s->priv_data;
ByteIOContext *pb = &s->pb;
int compression_type;
ea->num_channels = 1;
while (inHeader) {
int inSubheader;
uint8_t byte;
byte = get_byte(pb);
switch (byte) {
case 0xFD:
av_log (s, AV_LOG_INFO, "entered audio subheader\n");
inSubheader = 1;
while (inSubheader) {
uint8_t subbyte;
subbyte = get_byte(pb);
switch (subbyte) {
case 0x82:
ea->num_channels = read_arbitary(pb);
av_log (s, AV_LOG_INFO, "num_channels (element 0x82) set to 0x%08x\n", ea->num_channels);
break;
case 0x83:
compression_type = read_arbitary(pb);
av_log (s, AV_LOG_INFO, "compression_type (element 0x83) set to 0x%08x\n", compression_type);
break;
case 0x85:
ea->num_samples = read_arbitary(pb);
av_log (s, AV_LOG_INFO, "num_samples (element 0x85) set to 0x%08x\n", ea->num_samples);
break;
case 0x8A:
av_log (s, AV_LOG_INFO, "element 0x%02x set to 0x%08x\n", subbyte, read_arbitary(pb));
av_log (s, AV_LOG_INFO, "exited audio subheader\n");
inSubheader = 0;
break;
case 0xFF:
av_log (s, AV_LOG_INFO, "end of header block reached (within audio subheader)\n");
inSubheader = 0;
inHeader = 0;
break;
default:
av_log (s, AV_LOG_INFO, "element 0x%02x set to 0x%08x\n", subbyte, read_arbitary(pb));
break;
}
}
break;
case 0xFF:
av_log (s, AV_LOG_INFO, "end of header block reached\n");
inHeader = 0;
break;
default:
av_log (s, AV_LOG_INFO, "header element 0x%02x set to 0x%08x\n", byte, read_arbitary(pb));
break;
}
}
ea->audio_codec = CODEC_ID_ADPCM_EA;
return 1;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(AVFormatContext *VAR_0)
{
int VAR_1 = 1;
EaDemuxContext *ea = VAR_0->priv_data;
ByteIOContext *pb = &VAR_0->pb;
int VAR_2;
ea->num_channels = 1;
while (VAR_1) {
int VAR_3;
uint8_t byte;
byte = get_byte(pb);
switch (byte) {
case 0xFD:
av_log (VAR_0, AV_LOG_INFO, "entered audio subheader\n");
VAR_3 = 1;
while (VAR_3) {
uint8_t subbyte;
subbyte = get_byte(pb);
switch (subbyte) {
case 0x82:
ea->num_channels = read_arbitary(pb);
av_log (VAR_0, AV_LOG_INFO, "num_channels (element 0x82) set to 0x%08x\n", ea->num_channels);
break;
case 0x83:
VAR_2 = read_arbitary(pb);
av_log (VAR_0, AV_LOG_INFO, "VAR_2 (element 0x83) set to 0x%08x\n", VAR_2);
break;
case 0x85:
ea->num_samples = read_arbitary(pb);
av_log (VAR_0, AV_LOG_INFO, "num_samples (element 0x85) set to 0x%08x\n", ea->num_samples);
break;
case 0x8A:
av_log (VAR_0, AV_LOG_INFO, "element 0x%02x set to 0x%08x\n", subbyte, read_arbitary(pb));
av_log (VAR_0, AV_LOG_INFO, "exited audio subheader\n");
VAR_3 = 0;
break;
case 0xFF:
av_log (VAR_0, AV_LOG_INFO, "end of header block reached (within audio subheader)\n");
VAR_3 = 0;
VAR_1 = 0;
break;
default:
av_log (VAR_0, AV_LOG_INFO, "element 0x%02x set to 0x%08x\n", subbyte, read_arbitary(pb));
break;
}
}
break;
case 0xFF:
av_log (VAR_0, AV_LOG_INFO, "end of header block reached\n");
VAR_1 = 0;
break;
default:
av_log (VAR_0, AV_LOG_INFO, "header element 0x%02x set to 0x%08x\n", byte, read_arbitary(pb));
break;
}
}
ea->audio_codec = CODEC_ID_ADPCM_EA;
return 1;
}
|
[
"static int FUNC_0(AVFormatContext *VAR_0)\n{",
"int VAR_1 = 1;",
"EaDemuxContext *ea = VAR_0->priv_data;",
"ByteIOContext *pb = &VAR_0->pb;",
"int VAR_2;",
"ea->num_channels = 1;",
"while (VAR_1) {",
"int VAR_3;",
"uint8_t byte;",
"byte = get_byte(pb);",
"switch (byte) {",
"case 0xFD:\nav_log (VAR_0, AV_LOG_INFO, \"entered audio subheader\\n\");",
"VAR_3 = 1;",
"while (VAR_3) {",
"uint8_t subbyte;",
"subbyte = get_byte(pb);",
"switch (subbyte) {",
"case 0x82:\nea->num_channels = read_arbitary(pb);",
"av_log (VAR_0, AV_LOG_INFO, \"num_channels (element 0x82) set to 0x%08x\\n\", ea->num_channels);",
"break;",
"case 0x83:\nVAR_2 = read_arbitary(pb);",
"av_log (VAR_0, AV_LOG_INFO, \"VAR_2 (element 0x83) set to 0x%08x\\n\", VAR_2);",
"break;",
"case 0x85:\nea->num_samples = read_arbitary(pb);",
"av_log (VAR_0, AV_LOG_INFO, \"num_samples (element 0x85) set to 0x%08x\\n\", ea->num_samples);",
"break;",
"case 0x8A:\nav_log (VAR_0, AV_LOG_INFO, \"element 0x%02x set to 0x%08x\\n\", subbyte, read_arbitary(pb));",
"av_log (VAR_0, AV_LOG_INFO, \"exited audio subheader\\n\");",
"VAR_3 = 0;",
"break;",
"case 0xFF:\nav_log (VAR_0, AV_LOG_INFO, \"end of header block reached (within audio subheader)\\n\");",
"VAR_3 = 0;",
"VAR_1 = 0;",
"break;",
"default:\nav_log (VAR_0, AV_LOG_INFO, \"element 0x%02x set to 0x%08x\\n\", subbyte, read_arbitary(pb));",
"break;",
"}",
"}",
"break;",
"case 0xFF:\nav_log (VAR_0, AV_LOG_INFO, \"end of header block reached\\n\");",
"VAR_1 = 0;",
"break;",
"default:\nav_log (VAR_0, AV_LOG_INFO, \"header element 0x%02x set to 0x%08x\\n\", byte, read_arbitary(pb));",
"break;",
"}",
"}",
"ea->audio_codec = CODEC_ID_ADPCM_EA;",
"return 1;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
19
],
[
21
],
[
23
],
[
25
],
[
29
],
[
31,
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
45
],
[
47,
49
],
[
51
],
[
53
],
[
55,
57
],
[
59
],
[
61
],
[
63,
65
],
[
67
],
[
69
],
[
71,
73
],
[
75
],
[
77
],
[
79
],
[
81,
83
],
[
85
],
[
87
],
[
89
],
[
91,
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103,
105
],
[
107
],
[
109
],
[
111,
113
],
[
115
],
[
117
],
[
119
],
[
123
],
[
127
],
[
129
]
] |
9,664 |
static int vc1_decode_b_mb_intfr(VC1Context *v)
{
MpegEncContext *s = &v->s;
GetBitContext *gb = &s->gb;
int i, j;
int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
int cbp = 0; /* cbp decoding stuff */
int mqdiff, mquant; /* MB quantization */
int ttmb = v->ttfrm; /* MB Transform type */
int mvsw = 0; /* motion vector switch */
int mb_has_coeffs = 1; /* last_flag */
int dmv_x, dmv_y; /* Differential MV components */
int val; /* temp value */
int first_block = 1;
int dst_idx, off;
int skipped, direct, twomv = 0;
int block_cbp = 0, pat, block_tt = 0;
int idx_mbmode = 0, mvbp;
int stride_y, fieldtx;
int bmvtype = BMV_TYPE_BACKWARD;
int dir, dir2;
mquant = v->pq; /* Lossy initialization */
s->mb_intra = 0;
if (v->skip_is_raw)
skipped = get_bits1(gb);
else
skipped = v->s.mbskip_table[mb_pos];
if (!skipped) {
idx_mbmode = get_vlc2(gb, v->mbmode_vlc->table, VC1_INTFR_NON4MV_MBMODE_VLC_BITS, 2);
if (ff_vc1_mbmode_intfrp[0][idx_mbmode][0] == MV_PMODE_INTFR_2MV_FIELD) {
twomv = 1;
v->blk_mv_type[s->block_index[0]] = 1;
v->blk_mv_type[s->block_index[1]] = 1;
v->blk_mv_type[s->block_index[2]] = 1;
v->blk_mv_type[s->block_index[3]] = 1;
} else {
v->blk_mv_type[s->block_index[0]] = 0;
v->blk_mv_type[s->block_index[1]] = 0;
v->blk_mv_type[s->block_index[2]] = 0;
v->blk_mv_type[s->block_index[3]] = 0;
}
}
if (v->dmb_is_raw)
direct = get_bits1(gb);
else
direct = v->direct_mb_plane[mb_pos];
if (direct) {
s->mv[0][0][0] = s->current_picture.motion_val[0][s->block_index[0]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][0], v->bfraction, 0, s->quarter_sample);
s->mv[0][0][1] = s->current_picture.motion_val[0][s->block_index[0]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][1], v->bfraction, 0, s->quarter_sample);
s->mv[1][0][0] = s->current_picture.motion_val[1][s->block_index[0]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][0], v->bfraction, 1, s->quarter_sample);
s->mv[1][0][1] = s->current_picture.motion_val[1][s->block_index[0]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][1], v->bfraction, 1, s->quarter_sample);
if (twomv) {
s->mv[0][2][0] = s->current_picture.motion_val[0][s->block_index[2]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][0], v->bfraction, 0, s->quarter_sample);
s->mv[0][2][1] = s->current_picture.motion_val[0][s->block_index[2]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][1], v->bfraction, 0, s->quarter_sample);
s->mv[1][2][0] = s->current_picture.motion_val[1][s->block_index[2]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][0], v->bfraction, 1, s->quarter_sample);
s->mv[1][2][1] = s->current_picture.motion_val[1][s->block_index[2]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][1], v->bfraction, 1, s->quarter_sample);
for (i = 1; i < 4; i += 2) {
s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0] = s->mv[0][i-1][0];
s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1] = s->mv[0][i-1][1];
s->mv[1][i][0] = s->current_picture.motion_val[1][s->block_index[i]][0] = s->mv[1][i-1][0];
s->mv[1][i][1] = s->current_picture.motion_val[1][s->block_index[i]][1] = s->mv[1][i-1][1];
}
} else {
for (i = 1; i < 4; i++) {
s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0] = s->mv[0][0][0];
s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1] = s->mv[0][0][1];
s->mv[1][i][0] = s->current_picture.motion_val[1][s->block_index[i]][0] = s->mv[1][0][0];
s->mv[1][i][1] = s->current_picture.motion_val[1][s->block_index[i]][1] = s->mv[1][0][1];
}
}
}
if (ff_vc1_mbmode_intfrp[0][idx_mbmode][0] == MV_PMODE_INTFR_INTRA) { // intra MB
for (i = 0; i < 4; i++) {
s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0] = 0;
s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1] = 0;
s->mv[1][i][0] = s->current_picture.motion_val[1][s->block_index[i]][0] = 0;
s->mv[1][i][1] = s->current_picture.motion_val[1][s->block_index[i]][1] = 0;
}
s->current_picture.mb_type[mb_pos] = MB_TYPE_INTRA;
s->mb_intra = v->is_intra[s->mb_x] = 1;
for (i = 0; i < 6; i++)
v->mb_type[0][s->block_index[i]] = 1;
fieldtx = v->fieldtx_plane[mb_pos] = get_bits1(gb);
mb_has_coeffs = get_bits1(gb);
if (mb_has_coeffs)
cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb);
GET_MQUANT();
s->current_picture.qscale_table[mb_pos] = mquant;
/* Set DC scale - y and c use the same (not sure if necessary here) */
s->y_dc_scale = s->y_dc_scale_table[mquant];
s->c_dc_scale = s->c_dc_scale_table[mquant];
dst_idx = 0;
for (i = 0; i < 6; i++) {
s->dc_val[0][s->block_index[i]] = 0;
dst_idx += i >> 2;
val = ((cbp >> (5 - i)) & 1);
v->mb_type[0][s->block_index[i]] = s->mb_intra;
v->a_avail = v->c_avail = 0;
if (i == 2 || i == 3 || !s->first_slice_line)
v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]];
if (i == 1 || i == 3 || s->mb_x)
v->c_avail = v->mb_type[0][s->block_index[i] - 1];
vc1_decode_intra_block(v, s->block[i], i, val, mquant,
(i & 4) ? v->codingset2 : v->codingset);
if (i > 3 && (s->flags & CODEC_FLAG_GRAY))
continue;
v->vc1dsp.vc1_inv_trans_8x8(s->block[i]);
if (i < 4) {
stride_y = s->linesize << fieldtx;
off = (fieldtx) ? ((i & 1) * 8) + ((i & 2) >> 1) * s->linesize : (i & 1) * 8 + 4 * (i & 2) * s->linesize;
} else {
stride_y = s->uvlinesize;
off = 0;
}
s->idsp.put_signed_pixels_clamped(s->block[i],
s->dest[dst_idx] + off,
stride_y);
}
} else {
s->mb_intra = v->is_intra[s->mb_x] = 0;
if (!direct) {
if (skipped || !s->mb_intra) {
bmvtype = decode012(gb);
switch (bmvtype) {
case 0:
bmvtype = (v->bfraction >= (B_FRACTION_DEN/2)) ? BMV_TYPE_BACKWARD : BMV_TYPE_FORWARD;
break;
case 1:
bmvtype = (v->bfraction >= (B_FRACTION_DEN/2)) ? BMV_TYPE_FORWARD : BMV_TYPE_BACKWARD;
break;
case 2:
bmvtype = BMV_TYPE_INTERPOLATED;
}
}
if (twomv && bmvtype != BMV_TYPE_INTERPOLATED)
mvsw = get_bits1(gb);
}
if (!skipped) { // inter MB
mb_has_coeffs = ff_vc1_mbmode_intfrp[0][idx_mbmode][3];
if (mb_has_coeffs)
cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
if (!direct) {
if (bmvtype == BMV_TYPE_INTERPOLATED && twomv) {
v->fourmvbp = get_vlc2(gb, v->fourmvbp_vlc->table, VC1_4MV_BLOCK_PATTERN_VLC_BITS, 1);
} else if (bmvtype == BMV_TYPE_INTERPOLATED || twomv) {
v->twomvbp = get_vlc2(gb, v->twomvbp_vlc->table, VC1_2MV_BLOCK_PATTERN_VLC_BITS, 1);
}
}
for (i = 0; i < 6; i++)
v->mb_type[0][s->block_index[i]] = 0;
fieldtx = v->fieldtx_plane[mb_pos] = ff_vc1_mbmode_intfrp[0][idx_mbmode][1];
/* for all motion vector read MVDATA and motion compensate each block */
dst_idx = 0;
if (direct) {
if (twomv) {
for (i = 0; i < 4; i++) {
ff_vc1_mc_4mv_luma(v, i, 0, 0);
ff_vc1_mc_4mv_luma(v, i, 1, 1);
}
ff_vc1_mc_4mv_chroma4(v, 0, 0, 0);
ff_vc1_mc_4mv_chroma4(v, 1, 1, 1);
} else {
ff_vc1_mc_1mv(v, 0);
ff_vc1_interp_mc(v);
}
} else if (twomv && bmvtype == BMV_TYPE_INTERPOLATED) {
mvbp = v->fourmvbp;
for (i = 0; i < 4; i++) {
dir = i==1 || i==3;
dmv_x = dmv_y = 0;
val = ((mvbp >> (3 - i)) & 1);
if (val)
get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0);
j = i > 1 ? 2 : 0;
ff_vc1_pred_mv_intfr(v, j, dmv_x, dmv_y, 2, v->range_x, v->range_y, v->mb_type[0], dir);
ff_vc1_mc_4mv_luma(v, j, dir, dir);
ff_vc1_mc_4mv_luma(v, j+1, dir, dir);
}
ff_vc1_mc_4mv_chroma4(v, 0, 0, 0);
ff_vc1_mc_4mv_chroma4(v, 1, 1, 1);
} else if (bmvtype == BMV_TYPE_INTERPOLATED) {
mvbp = v->twomvbp;
dmv_x = dmv_y = 0;
if (mvbp & 2)
get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0);
ff_vc1_pred_mv_intfr(v, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0], 0);
ff_vc1_mc_1mv(v, 0);
dmv_x = dmv_y = 0;
if (mvbp & 1)
get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0);
ff_vc1_pred_mv_intfr(v, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0], 1);
ff_vc1_interp_mc(v);
} else if (twomv) {
dir = bmvtype == BMV_TYPE_BACKWARD;
dir2 = dir;
if (mvsw)
dir2 = !dir;
mvbp = v->twomvbp;
dmv_x = dmv_y = 0;
if (mvbp & 2)
get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0);
ff_vc1_pred_mv_intfr(v, 0, dmv_x, dmv_y, 2, v->range_x, v->range_y, v->mb_type[0], dir);
dmv_x = dmv_y = 0;
if (mvbp & 1)
get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0);
ff_vc1_pred_mv_intfr(v, 2, dmv_x, dmv_y, 2, v->range_x, v->range_y, v->mb_type[0], dir2);
if (mvsw) {
for (i = 0; i < 2; i++) {
s->mv[dir][i+2][0] = s->mv[dir][i][0] = s->current_picture.motion_val[dir][s->block_index[i+2]][0] = s->current_picture.motion_val[dir][s->block_index[i]][0];
s->mv[dir][i+2][1] = s->mv[dir][i][1] = s->current_picture.motion_val[dir][s->block_index[i+2]][1] = s->current_picture.motion_val[dir][s->block_index[i]][1];
s->mv[dir2][i+2][0] = s->mv[dir2][i][0] = s->current_picture.motion_val[dir2][s->block_index[i]][0] = s->current_picture.motion_val[dir2][s->block_index[i+2]][0];
s->mv[dir2][i+2][1] = s->mv[dir2][i][1] = s->current_picture.motion_val[dir2][s->block_index[i]][1] = s->current_picture.motion_val[dir2][s->block_index[i+2]][1];
}
} else {
ff_vc1_pred_mv_intfr(v, 0, 0, 0, 2, v->range_x, v->range_y, v->mb_type[0], !dir);
ff_vc1_pred_mv_intfr(v, 2, 0, 0, 2, v->range_x, v->range_y, v->mb_type[0], !dir);
}
ff_vc1_mc_4mv_luma(v, 0, dir, 0);
ff_vc1_mc_4mv_luma(v, 1, dir, 0);
ff_vc1_mc_4mv_luma(v, 2, dir2, 0);
ff_vc1_mc_4mv_luma(v, 3, dir2, 0);
ff_vc1_mc_4mv_chroma4(v, dir, dir2, 0);
} else {
dir = bmvtype == BMV_TYPE_BACKWARD;
mvbp = ff_vc1_mbmode_intfrp[0][idx_mbmode][2];
dmv_x = dmv_y = 0;
if (mvbp)
get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0);
ff_vc1_pred_mv_intfr(v, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0], dir);
v->blk_mv_type[s->block_index[0]] = 1;
v->blk_mv_type[s->block_index[1]] = 1;
v->blk_mv_type[s->block_index[2]] = 1;
v->blk_mv_type[s->block_index[3]] = 1;
ff_vc1_pred_mv_intfr(v, 0, 0, 0, 2, v->range_x, v->range_y, 0, !dir);
for (i = 0; i < 2; i++) {
s->mv[!dir][i+2][0] = s->mv[!dir][i][0] = s->current_picture.motion_val[!dir][s->block_index[i+2]][0] = s->current_picture.motion_val[!dir][s->block_index[i]][0];
s->mv[!dir][i+2][1] = s->mv[!dir][i][1] = s->current_picture.motion_val[!dir][s->block_index[i+2]][1] = s->current_picture.motion_val[!dir][s->block_index[i]][1];
}
ff_vc1_mc_1mv(v, dir);
}
if (cbp)
GET_MQUANT(); // p. 227
s->current_picture.qscale_table[mb_pos] = mquant;
if (!v->ttmbf && cbp)
ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2);
for (i = 0; i < 6; i++) {
s->dc_val[0][s->block_index[i]] = 0;
dst_idx += i >> 2;
val = ((cbp >> (5 - i)) & 1);
if (!fieldtx)
off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize);
else
off = (i & 4) ? 0 : ((i & 1) * 8 + ((i > 1) * s->linesize));
if (val) {
pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb,
first_block, s->dest[dst_idx] + off,
(i & 4) ? s->uvlinesize : (s->linesize << fieldtx),
(i & 4) && (s->flags & CODEC_FLAG_GRAY), &block_tt);
block_cbp |= pat << (i << 2);
if (!v->ttmbf && ttmb < 8)
ttmb = -1;
first_block = 0;
}
}
} else { // skipped
dir = 0;
for (i = 0; i < 6; i++) {
v->mb_type[0][s->block_index[i]] = 0;
s->dc_val[0][s->block_index[i]] = 0;
}
s->current_picture.mb_type[mb_pos] = MB_TYPE_SKIP;
s->current_picture.qscale_table[mb_pos] = 0;
v->blk_mv_type[s->block_index[0]] = 0;
v->blk_mv_type[s->block_index[1]] = 0;
v->blk_mv_type[s->block_index[2]] = 0;
v->blk_mv_type[s->block_index[3]] = 0;
if (!direct) {
if (bmvtype == BMV_TYPE_INTERPOLATED) {
ff_vc1_pred_mv_intfr(v, 0, 0, 0, 1, v->range_x, v->range_y, v->mb_type[0], 0);
ff_vc1_pred_mv_intfr(v, 0, 0, 0, 1, v->range_x, v->range_y, v->mb_type[0], 1);
} else {
dir = bmvtype == BMV_TYPE_BACKWARD;
ff_vc1_pred_mv_intfr(v, 0, 0, 0, 1, v->range_x, v->range_y, v->mb_type[0], dir);
if (mvsw) {
int dir2 = dir;
if (mvsw)
dir2 = !dir;
for (i = 0; i < 2; i++) {
s->mv[dir][i+2][0] = s->mv[dir][i][0] = s->current_picture.motion_val[dir][s->block_index[i+2]][0] = s->current_picture.motion_val[dir][s->block_index[i]][0];
s->mv[dir][i+2][1] = s->mv[dir][i][1] = s->current_picture.motion_val[dir][s->block_index[i+2]][1] = s->current_picture.motion_val[dir][s->block_index[i]][1];
s->mv[dir2][i+2][0] = s->mv[dir2][i][0] = s->current_picture.motion_val[dir2][s->block_index[i]][0] = s->current_picture.motion_val[dir2][s->block_index[i+2]][0];
s->mv[dir2][i+2][1] = s->mv[dir2][i][1] = s->current_picture.motion_val[dir2][s->block_index[i]][1] = s->current_picture.motion_val[dir2][s->block_index[i+2]][1];
}
} else {
v->blk_mv_type[s->block_index[0]] = 1;
v->blk_mv_type[s->block_index[1]] = 1;
v->blk_mv_type[s->block_index[2]] = 1;
v->blk_mv_type[s->block_index[3]] = 1;
ff_vc1_pred_mv_intfr(v, 0, 0, 0, 2, v->range_x, v->range_y, 0, !dir);
for (i = 0; i < 2; i++) {
s->mv[!dir][i+2][0] = s->mv[!dir][i][0] = s->current_picture.motion_val[!dir][s->block_index[i+2]][0] = s->current_picture.motion_val[!dir][s->block_index[i]][0];
s->mv[!dir][i+2][1] = s->mv[!dir][i][1] = s->current_picture.motion_val[!dir][s->block_index[i+2]][1] = s->current_picture.motion_val[!dir][s->block_index[i]][1];
}
}
}
}
ff_vc1_mc_1mv(v, dir);
if (direct || bmvtype == BMV_TYPE_INTERPOLATED) {
ff_vc1_interp_mc(v);
}
}
}
if (s->mb_x == s->mb_width - 1)
memmove(v->is_intra_base, v->is_intra, sizeof(v->is_intra_base[0]) * s->mb_stride);
v->cbp[s->mb_x] = block_cbp;
v->ttblk[s->mb_x] = block_tt;
return 0;
}
| false |
FFmpeg
|
b67138598ce158e3083f6295a27b63e2065d5ecb
|
static int vc1_decode_b_mb_intfr(VC1Context *v)
{
MpegEncContext *s = &v->s;
GetBitContext *gb = &s->gb;
int i, j;
int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
int cbp = 0;
int mqdiff, mquant;
int ttmb = v->ttfrm;
int mvsw = 0;
int mb_has_coeffs = 1;
int dmv_x, dmv_y;
int val;
int first_block = 1;
int dst_idx, off;
int skipped, direct, twomv = 0;
int block_cbp = 0, pat, block_tt = 0;
int idx_mbmode = 0, mvbp;
int stride_y, fieldtx;
int bmvtype = BMV_TYPE_BACKWARD;
int dir, dir2;
mquant = v->pq;
s->mb_intra = 0;
if (v->skip_is_raw)
skipped = get_bits1(gb);
else
skipped = v->s.mbskip_table[mb_pos];
if (!skipped) {
idx_mbmode = get_vlc2(gb, v->mbmode_vlc->table, VC1_INTFR_NON4MV_MBMODE_VLC_BITS, 2);
if (ff_vc1_mbmode_intfrp[0][idx_mbmode][0] == MV_PMODE_INTFR_2MV_FIELD) {
twomv = 1;
v->blk_mv_type[s->block_index[0]] = 1;
v->blk_mv_type[s->block_index[1]] = 1;
v->blk_mv_type[s->block_index[2]] = 1;
v->blk_mv_type[s->block_index[3]] = 1;
} else {
v->blk_mv_type[s->block_index[0]] = 0;
v->blk_mv_type[s->block_index[1]] = 0;
v->blk_mv_type[s->block_index[2]] = 0;
v->blk_mv_type[s->block_index[3]] = 0;
}
}
if (v->dmb_is_raw)
direct = get_bits1(gb);
else
direct = v->direct_mb_plane[mb_pos];
if (direct) {
s->mv[0][0][0] = s->current_picture.motion_val[0][s->block_index[0]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][0], v->bfraction, 0, s->quarter_sample);
s->mv[0][0][1] = s->current_picture.motion_val[0][s->block_index[0]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][1], v->bfraction, 0, s->quarter_sample);
s->mv[1][0][0] = s->current_picture.motion_val[1][s->block_index[0]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][0], v->bfraction, 1, s->quarter_sample);
s->mv[1][0][1] = s->current_picture.motion_val[1][s->block_index[0]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][1], v->bfraction, 1, s->quarter_sample);
if (twomv) {
s->mv[0][2][0] = s->current_picture.motion_val[0][s->block_index[2]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][0], v->bfraction, 0, s->quarter_sample);
s->mv[0][2][1] = s->current_picture.motion_val[0][s->block_index[2]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][1], v->bfraction, 0, s->quarter_sample);
s->mv[1][2][0] = s->current_picture.motion_val[1][s->block_index[2]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][0], v->bfraction, 1, s->quarter_sample);
s->mv[1][2][1] = s->current_picture.motion_val[1][s->block_index[2]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][1], v->bfraction, 1, s->quarter_sample);
for (i = 1; i < 4; i += 2) {
s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0] = s->mv[0][i-1][0];
s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1] = s->mv[0][i-1][1];
s->mv[1][i][0] = s->current_picture.motion_val[1][s->block_index[i]][0] = s->mv[1][i-1][0];
s->mv[1][i][1] = s->current_picture.motion_val[1][s->block_index[i]][1] = s->mv[1][i-1][1];
}
} else {
for (i = 1; i < 4; i++) {
s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0] = s->mv[0][0][0];
s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1] = s->mv[0][0][1];
s->mv[1][i][0] = s->current_picture.motion_val[1][s->block_index[i]][0] = s->mv[1][0][0];
s->mv[1][i][1] = s->current_picture.motion_val[1][s->block_index[i]][1] = s->mv[1][0][1];
}
}
}
if (ff_vc1_mbmode_intfrp[0][idx_mbmode][0] == MV_PMODE_INTFR_INTRA) {
for (i = 0; i < 4; i++) {
s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0] = 0;
s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1] = 0;
s->mv[1][i][0] = s->current_picture.motion_val[1][s->block_index[i]][0] = 0;
s->mv[1][i][1] = s->current_picture.motion_val[1][s->block_index[i]][1] = 0;
}
s->current_picture.mb_type[mb_pos] = MB_TYPE_INTRA;
s->mb_intra = v->is_intra[s->mb_x] = 1;
for (i = 0; i < 6; i++)
v->mb_type[0][s->block_index[i]] = 1;
fieldtx = v->fieldtx_plane[mb_pos] = get_bits1(gb);
mb_has_coeffs = get_bits1(gb);
if (mb_has_coeffs)
cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb);
GET_MQUANT();
s->current_picture.qscale_table[mb_pos] = mquant;
s->y_dc_scale = s->y_dc_scale_table[mquant];
s->c_dc_scale = s->c_dc_scale_table[mquant];
dst_idx = 0;
for (i = 0; i < 6; i++) {
s->dc_val[0][s->block_index[i]] = 0;
dst_idx += i >> 2;
val = ((cbp >> (5 - i)) & 1);
v->mb_type[0][s->block_index[i]] = s->mb_intra;
v->a_avail = v->c_avail = 0;
if (i == 2 || i == 3 || !s->first_slice_line)
v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]];
if (i == 1 || i == 3 || s->mb_x)
v->c_avail = v->mb_type[0][s->block_index[i] - 1];
vc1_decode_intra_block(v, s->block[i], i, val, mquant,
(i & 4) ? v->codingset2 : v->codingset);
if (i > 3 && (s->flags & CODEC_FLAG_GRAY))
continue;
v->vc1dsp.vc1_inv_trans_8x8(s->block[i]);
if (i < 4) {
stride_y = s->linesize << fieldtx;
off = (fieldtx) ? ((i & 1) * 8) + ((i & 2) >> 1) * s->linesize : (i & 1) * 8 + 4 * (i & 2) * s->linesize;
} else {
stride_y = s->uvlinesize;
off = 0;
}
s->idsp.put_signed_pixels_clamped(s->block[i],
s->dest[dst_idx] + off,
stride_y);
}
} else {
s->mb_intra = v->is_intra[s->mb_x] = 0;
if (!direct) {
if (skipped || !s->mb_intra) {
bmvtype = decode012(gb);
switch (bmvtype) {
case 0:
bmvtype = (v->bfraction >= (B_FRACTION_DEN/2)) ? BMV_TYPE_BACKWARD : BMV_TYPE_FORWARD;
break;
case 1:
bmvtype = (v->bfraction >= (B_FRACTION_DEN/2)) ? BMV_TYPE_FORWARD : BMV_TYPE_BACKWARD;
break;
case 2:
bmvtype = BMV_TYPE_INTERPOLATED;
}
}
if (twomv && bmvtype != BMV_TYPE_INTERPOLATED)
mvsw = get_bits1(gb);
}
if (!skipped) {
mb_has_coeffs = ff_vc1_mbmode_intfrp[0][idx_mbmode][3];
if (mb_has_coeffs)
cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
if (!direct) {
if (bmvtype == BMV_TYPE_INTERPOLATED && twomv) {
v->fourmvbp = get_vlc2(gb, v->fourmvbp_vlc->table, VC1_4MV_BLOCK_PATTERN_VLC_BITS, 1);
} else if (bmvtype == BMV_TYPE_INTERPOLATED || twomv) {
v->twomvbp = get_vlc2(gb, v->twomvbp_vlc->table, VC1_2MV_BLOCK_PATTERN_VLC_BITS, 1);
}
}
for (i = 0; i < 6; i++)
v->mb_type[0][s->block_index[i]] = 0;
fieldtx = v->fieldtx_plane[mb_pos] = ff_vc1_mbmode_intfrp[0][idx_mbmode][1];
dst_idx = 0;
if (direct) {
if (twomv) {
for (i = 0; i < 4; i++) {
ff_vc1_mc_4mv_luma(v, i, 0, 0);
ff_vc1_mc_4mv_luma(v, i, 1, 1);
}
ff_vc1_mc_4mv_chroma4(v, 0, 0, 0);
ff_vc1_mc_4mv_chroma4(v, 1, 1, 1);
} else {
ff_vc1_mc_1mv(v, 0);
ff_vc1_interp_mc(v);
}
} else if (twomv && bmvtype == BMV_TYPE_INTERPOLATED) {
mvbp = v->fourmvbp;
for (i = 0; i < 4; i++) {
dir = i==1 || i==3;
dmv_x = dmv_y = 0;
val = ((mvbp >> (3 - i)) & 1);
if (val)
get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0);
j = i > 1 ? 2 : 0;
ff_vc1_pred_mv_intfr(v, j, dmv_x, dmv_y, 2, v->range_x, v->range_y, v->mb_type[0], dir);
ff_vc1_mc_4mv_luma(v, j, dir, dir);
ff_vc1_mc_4mv_luma(v, j+1, dir, dir);
}
ff_vc1_mc_4mv_chroma4(v, 0, 0, 0);
ff_vc1_mc_4mv_chroma4(v, 1, 1, 1);
} else if (bmvtype == BMV_TYPE_INTERPOLATED) {
mvbp = v->twomvbp;
dmv_x = dmv_y = 0;
if (mvbp & 2)
get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0);
ff_vc1_pred_mv_intfr(v, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0], 0);
ff_vc1_mc_1mv(v, 0);
dmv_x = dmv_y = 0;
if (mvbp & 1)
get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0);
ff_vc1_pred_mv_intfr(v, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0], 1);
ff_vc1_interp_mc(v);
} else if (twomv) {
dir = bmvtype == BMV_TYPE_BACKWARD;
dir2 = dir;
if (mvsw)
dir2 = !dir;
mvbp = v->twomvbp;
dmv_x = dmv_y = 0;
if (mvbp & 2)
get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0);
ff_vc1_pred_mv_intfr(v, 0, dmv_x, dmv_y, 2, v->range_x, v->range_y, v->mb_type[0], dir);
dmv_x = dmv_y = 0;
if (mvbp & 1)
get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0);
ff_vc1_pred_mv_intfr(v, 2, dmv_x, dmv_y, 2, v->range_x, v->range_y, v->mb_type[0], dir2);
if (mvsw) {
for (i = 0; i < 2; i++) {
s->mv[dir][i+2][0] = s->mv[dir][i][0] = s->current_picture.motion_val[dir][s->block_index[i+2]][0] = s->current_picture.motion_val[dir][s->block_index[i]][0];
s->mv[dir][i+2][1] = s->mv[dir][i][1] = s->current_picture.motion_val[dir][s->block_index[i+2]][1] = s->current_picture.motion_val[dir][s->block_index[i]][1];
s->mv[dir2][i+2][0] = s->mv[dir2][i][0] = s->current_picture.motion_val[dir2][s->block_index[i]][0] = s->current_picture.motion_val[dir2][s->block_index[i+2]][0];
s->mv[dir2][i+2][1] = s->mv[dir2][i][1] = s->current_picture.motion_val[dir2][s->block_index[i]][1] = s->current_picture.motion_val[dir2][s->block_index[i+2]][1];
}
} else {
ff_vc1_pred_mv_intfr(v, 0, 0, 0, 2, v->range_x, v->range_y, v->mb_type[0], !dir);
ff_vc1_pred_mv_intfr(v, 2, 0, 0, 2, v->range_x, v->range_y, v->mb_type[0], !dir);
}
ff_vc1_mc_4mv_luma(v, 0, dir, 0);
ff_vc1_mc_4mv_luma(v, 1, dir, 0);
ff_vc1_mc_4mv_luma(v, 2, dir2, 0);
ff_vc1_mc_4mv_luma(v, 3, dir2, 0);
ff_vc1_mc_4mv_chroma4(v, dir, dir2, 0);
} else {
dir = bmvtype == BMV_TYPE_BACKWARD;
mvbp = ff_vc1_mbmode_intfrp[0][idx_mbmode][2];
dmv_x = dmv_y = 0;
if (mvbp)
get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0);
ff_vc1_pred_mv_intfr(v, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0], dir);
v->blk_mv_type[s->block_index[0]] = 1;
v->blk_mv_type[s->block_index[1]] = 1;
v->blk_mv_type[s->block_index[2]] = 1;
v->blk_mv_type[s->block_index[3]] = 1;
ff_vc1_pred_mv_intfr(v, 0, 0, 0, 2, v->range_x, v->range_y, 0, !dir);
for (i = 0; i < 2; i++) {
s->mv[!dir][i+2][0] = s->mv[!dir][i][0] = s->current_picture.motion_val[!dir][s->block_index[i+2]][0] = s->current_picture.motion_val[!dir][s->block_index[i]][0];
s->mv[!dir][i+2][1] = s->mv[!dir][i][1] = s->current_picture.motion_val[!dir][s->block_index[i+2]][1] = s->current_picture.motion_val[!dir][s->block_index[i]][1];
}
ff_vc1_mc_1mv(v, dir);
}
if (cbp)
GET_MQUANT();
s->current_picture.qscale_table[mb_pos] = mquant;
if (!v->ttmbf && cbp)
ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2);
for (i = 0; i < 6; i++) {
s->dc_val[0][s->block_index[i]] = 0;
dst_idx += i >> 2;
val = ((cbp >> (5 - i)) & 1);
if (!fieldtx)
off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize);
else
off = (i & 4) ? 0 : ((i & 1) * 8 + ((i > 1) * s->linesize));
if (val) {
pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb,
first_block, s->dest[dst_idx] + off,
(i & 4) ? s->uvlinesize : (s->linesize << fieldtx),
(i & 4) && (s->flags & CODEC_FLAG_GRAY), &block_tt);
block_cbp |= pat << (i << 2);
if (!v->ttmbf && ttmb < 8)
ttmb = -1;
first_block = 0;
}
}
} else {
dir = 0;
for (i = 0; i < 6; i++) {
v->mb_type[0][s->block_index[i]] = 0;
s->dc_val[0][s->block_index[i]] = 0;
}
s->current_picture.mb_type[mb_pos] = MB_TYPE_SKIP;
s->current_picture.qscale_table[mb_pos] = 0;
v->blk_mv_type[s->block_index[0]] = 0;
v->blk_mv_type[s->block_index[1]] = 0;
v->blk_mv_type[s->block_index[2]] = 0;
v->blk_mv_type[s->block_index[3]] = 0;
if (!direct) {
if (bmvtype == BMV_TYPE_INTERPOLATED) {
ff_vc1_pred_mv_intfr(v, 0, 0, 0, 1, v->range_x, v->range_y, v->mb_type[0], 0);
ff_vc1_pred_mv_intfr(v, 0, 0, 0, 1, v->range_x, v->range_y, v->mb_type[0], 1);
} else {
dir = bmvtype == BMV_TYPE_BACKWARD;
ff_vc1_pred_mv_intfr(v, 0, 0, 0, 1, v->range_x, v->range_y, v->mb_type[0], dir);
if (mvsw) {
int dir2 = dir;
if (mvsw)
dir2 = !dir;
for (i = 0; i < 2; i++) {
s->mv[dir][i+2][0] = s->mv[dir][i][0] = s->current_picture.motion_val[dir][s->block_index[i+2]][0] = s->current_picture.motion_val[dir][s->block_index[i]][0];
s->mv[dir][i+2][1] = s->mv[dir][i][1] = s->current_picture.motion_val[dir][s->block_index[i+2]][1] = s->current_picture.motion_val[dir][s->block_index[i]][1];
s->mv[dir2][i+2][0] = s->mv[dir2][i][0] = s->current_picture.motion_val[dir2][s->block_index[i]][0] = s->current_picture.motion_val[dir2][s->block_index[i+2]][0];
s->mv[dir2][i+2][1] = s->mv[dir2][i][1] = s->current_picture.motion_val[dir2][s->block_index[i]][1] = s->current_picture.motion_val[dir2][s->block_index[i+2]][1];
}
} else {
v->blk_mv_type[s->block_index[0]] = 1;
v->blk_mv_type[s->block_index[1]] = 1;
v->blk_mv_type[s->block_index[2]] = 1;
v->blk_mv_type[s->block_index[3]] = 1;
ff_vc1_pred_mv_intfr(v, 0, 0, 0, 2, v->range_x, v->range_y, 0, !dir);
for (i = 0; i < 2; i++) {
s->mv[!dir][i+2][0] = s->mv[!dir][i][0] = s->current_picture.motion_val[!dir][s->block_index[i+2]][0] = s->current_picture.motion_val[!dir][s->block_index[i]][0];
s->mv[!dir][i+2][1] = s->mv[!dir][i][1] = s->current_picture.motion_val[!dir][s->block_index[i+2]][1] = s->current_picture.motion_val[!dir][s->block_index[i]][1];
}
}
}
}
ff_vc1_mc_1mv(v, dir);
if (direct || bmvtype == BMV_TYPE_INTERPOLATED) {
ff_vc1_interp_mc(v);
}
}
}
if (s->mb_x == s->mb_width - 1)
memmove(v->is_intra_base, v->is_intra, sizeof(v->is_intra_base[0]) * s->mb_stride);
v->cbp[s->mb_x] = block_cbp;
v->ttblk[s->mb_x] = block_tt;
return 0;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(VC1Context *VAR_0)
{
MpegEncContext *s = &VAR_0->s;
GetBitContext *gb = &s->gb;
int VAR_1, VAR_2;
int VAR_3 = s->mb_x + s->mb_y * s->mb_stride;
int VAR_4 = 0;
int VAR_5, VAR_6;
int VAR_7 = VAR_0->ttfrm;
int VAR_8 = 0;
int VAR_9 = 1;
int VAR_10, VAR_11;
int VAR_12;
int VAR_13 = 1;
int VAR_14, VAR_15;
int VAR_16, VAR_17, VAR_18 = 0;
int VAR_19 = 0, VAR_20, VAR_21 = 0;
int VAR_22 = 0, VAR_23;
int VAR_24, VAR_25;
int VAR_26 = BMV_TYPE_BACKWARD;
int VAR_27, VAR_29;
VAR_6 = VAR_0->pq;
s->mb_intra = 0;
if (VAR_0->skip_is_raw)
VAR_16 = get_bits1(gb);
else
VAR_16 = VAR_0->s.mbskip_table[VAR_3];
if (!VAR_16) {
VAR_22 = get_vlc2(gb, VAR_0->mbmode_vlc->table, VC1_INTFR_NON4MV_MBMODE_VLC_BITS, 2);
if (ff_vc1_mbmode_intfrp[0][VAR_22][0] == MV_PMODE_INTFR_2MV_FIELD) {
VAR_18 = 1;
VAR_0->blk_mv_type[s->block_index[0]] = 1;
VAR_0->blk_mv_type[s->block_index[1]] = 1;
VAR_0->blk_mv_type[s->block_index[2]] = 1;
VAR_0->blk_mv_type[s->block_index[3]] = 1;
} else {
VAR_0->blk_mv_type[s->block_index[0]] = 0;
VAR_0->blk_mv_type[s->block_index[1]] = 0;
VAR_0->blk_mv_type[s->block_index[2]] = 0;
VAR_0->blk_mv_type[s->block_index[3]] = 0;
}
}
if (VAR_0->dmb_is_raw)
VAR_17 = get_bits1(gb);
else
VAR_17 = VAR_0->direct_mb_plane[VAR_3];
if (VAR_17) {
s->mv[0][0][0] = s->current_picture.motion_val[0][s->block_index[0]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][0], VAR_0->bfraction, 0, s->quarter_sample);
s->mv[0][0][1] = s->current_picture.motion_val[0][s->block_index[0]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][1], VAR_0->bfraction, 0, s->quarter_sample);
s->mv[1][0][0] = s->current_picture.motion_val[1][s->block_index[0]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][0], VAR_0->bfraction, 1, s->quarter_sample);
s->mv[1][0][1] = s->current_picture.motion_val[1][s->block_index[0]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][1], VAR_0->bfraction, 1, s->quarter_sample);
if (VAR_18) {
s->mv[0][2][0] = s->current_picture.motion_val[0][s->block_index[2]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][0], VAR_0->bfraction, 0, s->quarter_sample);
s->mv[0][2][1] = s->current_picture.motion_val[0][s->block_index[2]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][1], VAR_0->bfraction, 0, s->quarter_sample);
s->mv[1][2][0] = s->current_picture.motion_val[1][s->block_index[2]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][0], VAR_0->bfraction, 1, s->quarter_sample);
s->mv[1][2][1] = s->current_picture.motion_val[1][s->block_index[2]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][1], VAR_0->bfraction, 1, s->quarter_sample);
for (VAR_1 = 1; VAR_1 < 4; VAR_1 += 2) {
s->mv[0][VAR_1][0] = s->current_picture.motion_val[0][s->block_index[VAR_1]][0] = s->mv[0][VAR_1-1][0];
s->mv[0][VAR_1][1] = s->current_picture.motion_val[0][s->block_index[VAR_1]][1] = s->mv[0][VAR_1-1][1];
s->mv[1][VAR_1][0] = s->current_picture.motion_val[1][s->block_index[VAR_1]][0] = s->mv[1][VAR_1-1][0];
s->mv[1][VAR_1][1] = s->current_picture.motion_val[1][s->block_index[VAR_1]][1] = s->mv[1][VAR_1-1][1];
}
} else {
for (VAR_1 = 1; VAR_1 < 4; VAR_1++) {
s->mv[0][VAR_1][0] = s->current_picture.motion_val[0][s->block_index[VAR_1]][0] = s->mv[0][0][0];
s->mv[0][VAR_1][1] = s->current_picture.motion_val[0][s->block_index[VAR_1]][1] = s->mv[0][0][1];
s->mv[1][VAR_1][0] = s->current_picture.motion_val[1][s->block_index[VAR_1]][0] = s->mv[1][0][0];
s->mv[1][VAR_1][1] = s->current_picture.motion_val[1][s->block_index[VAR_1]][1] = s->mv[1][0][1];
}
}
}
if (ff_vc1_mbmode_intfrp[0][VAR_22][0] == MV_PMODE_INTFR_INTRA) {
for (VAR_1 = 0; VAR_1 < 4; VAR_1++) {
s->mv[0][VAR_1][0] = s->current_picture.motion_val[0][s->block_index[VAR_1]][0] = 0;
s->mv[0][VAR_1][1] = s->current_picture.motion_val[0][s->block_index[VAR_1]][1] = 0;
s->mv[1][VAR_1][0] = s->current_picture.motion_val[1][s->block_index[VAR_1]][0] = 0;
s->mv[1][VAR_1][1] = s->current_picture.motion_val[1][s->block_index[VAR_1]][1] = 0;
}
s->current_picture.mb_type[VAR_3] = MB_TYPE_INTRA;
s->mb_intra = VAR_0->is_intra[s->mb_x] = 1;
for (VAR_1 = 0; VAR_1 < 6; VAR_1++)
VAR_0->mb_type[0][s->block_index[VAR_1]] = 1;
VAR_25 = VAR_0->fieldtx_plane[VAR_3] = get_bits1(gb);
VAR_9 = get_bits1(gb);
if (VAR_9)
VAR_4 = 1 + get_vlc2(&VAR_0->s.gb, VAR_0->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
VAR_0->s.ac_pred = VAR_0->acpred_plane[VAR_3] = get_bits1(gb);
GET_MQUANT();
s->current_picture.qscale_table[VAR_3] = VAR_6;
s->y_dc_scale = s->y_dc_scale_table[VAR_6];
s->c_dc_scale = s->c_dc_scale_table[VAR_6];
VAR_14 = 0;
for (VAR_1 = 0; VAR_1 < 6; VAR_1++) {
s->dc_val[0][s->block_index[VAR_1]] = 0;
VAR_14 += VAR_1 >> 2;
VAR_12 = ((VAR_4 >> (5 - VAR_1)) & 1);
VAR_0->mb_type[0][s->block_index[VAR_1]] = s->mb_intra;
VAR_0->a_avail = VAR_0->c_avail = 0;
if (VAR_1 == 2 || VAR_1 == 3 || !s->first_slice_line)
VAR_0->a_avail = VAR_0->mb_type[0][s->block_index[VAR_1] - s->block_wrap[VAR_1]];
if (VAR_1 == 1 || VAR_1 == 3 || s->mb_x)
VAR_0->c_avail = VAR_0->mb_type[0][s->block_index[VAR_1] - 1];
vc1_decode_intra_block(VAR_0, s->block[VAR_1], VAR_1, VAR_12, VAR_6,
(VAR_1 & 4) ? VAR_0->codingset2 : VAR_0->codingset);
if (VAR_1 > 3 && (s->flags & CODEC_FLAG_GRAY))
continue;
VAR_0->vc1dsp.vc1_inv_trans_8x8(s->block[VAR_1]);
if (VAR_1 < 4) {
VAR_24 = s->linesize << VAR_25;
VAR_15 = (VAR_25) ? ((VAR_1 & 1) * 8) + ((VAR_1 & 2) >> 1) * s->linesize : (VAR_1 & 1) * 8 + 4 * (VAR_1 & 2) * s->linesize;
} else {
VAR_24 = s->uvlinesize;
VAR_15 = 0;
}
s->idsp.put_signed_pixels_clamped(s->block[VAR_1],
s->dest[VAR_14] + VAR_15,
VAR_24);
}
} else {
s->mb_intra = VAR_0->is_intra[s->mb_x] = 0;
if (!VAR_17) {
if (VAR_16 || !s->mb_intra) {
VAR_26 = decode012(gb);
switch (VAR_26) {
case 0:
VAR_26 = (VAR_0->bfraction >= (B_FRACTION_DEN/2)) ? BMV_TYPE_BACKWARD : BMV_TYPE_FORWARD;
break;
case 1:
VAR_26 = (VAR_0->bfraction >= (B_FRACTION_DEN/2)) ? BMV_TYPE_FORWARD : BMV_TYPE_BACKWARD;
break;
case 2:
VAR_26 = BMV_TYPE_INTERPOLATED;
}
}
if (VAR_18 && VAR_26 != BMV_TYPE_INTERPOLATED)
VAR_8 = get_bits1(gb);
}
if (!VAR_16) {
VAR_9 = ff_vc1_mbmode_intfrp[0][VAR_22][3];
if (VAR_9)
VAR_4 = 1 + get_vlc2(&VAR_0->s.gb, VAR_0->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
if (!VAR_17) {
if (VAR_26 == BMV_TYPE_INTERPOLATED && VAR_18) {
VAR_0->fourmvbp = get_vlc2(gb, VAR_0->fourmvbp_vlc->table, VC1_4MV_BLOCK_PATTERN_VLC_BITS, 1);
} else if (VAR_26 == BMV_TYPE_INTERPOLATED || VAR_18) {
VAR_0->twomvbp = get_vlc2(gb, VAR_0->twomvbp_vlc->table, VC1_2MV_BLOCK_PATTERN_VLC_BITS, 1);
}
}
for (VAR_1 = 0; VAR_1 < 6; VAR_1++)
VAR_0->mb_type[0][s->block_index[VAR_1]] = 0;
VAR_25 = VAR_0->fieldtx_plane[VAR_3] = ff_vc1_mbmode_intfrp[0][VAR_22][1];
VAR_14 = 0;
if (VAR_17) {
if (VAR_18) {
for (VAR_1 = 0; VAR_1 < 4; VAR_1++) {
ff_vc1_mc_4mv_luma(VAR_0, VAR_1, 0, 0);
ff_vc1_mc_4mv_luma(VAR_0, VAR_1, 1, 1);
}
ff_vc1_mc_4mv_chroma4(VAR_0, 0, 0, 0);
ff_vc1_mc_4mv_chroma4(VAR_0, 1, 1, 1);
} else {
ff_vc1_mc_1mv(VAR_0, 0);
ff_vc1_interp_mc(VAR_0);
}
} else if (VAR_18 && VAR_26 == BMV_TYPE_INTERPOLATED) {
VAR_23 = VAR_0->fourmvbp;
for (VAR_1 = 0; VAR_1 < 4; VAR_1++) {
VAR_27 = VAR_1==1 || VAR_1==3;
VAR_10 = VAR_11 = 0;
VAR_12 = ((VAR_23 >> (3 - VAR_1)) & 1);
if (VAR_12)
get_mvdata_interlaced(VAR_0, &VAR_10, &VAR_11, 0);
VAR_2 = VAR_1 > 1 ? 2 : 0;
ff_vc1_pred_mv_intfr(VAR_0, VAR_2, VAR_10, VAR_11, 2, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], VAR_27);
ff_vc1_mc_4mv_luma(VAR_0, VAR_2, VAR_27, VAR_27);
ff_vc1_mc_4mv_luma(VAR_0, VAR_2+1, VAR_27, VAR_27);
}
ff_vc1_mc_4mv_chroma4(VAR_0, 0, 0, 0);
ff_vc1_mc_4mv_chroma4(VAR_0, 1, 1, 1);
} else if (VAR_26 == BMV_TYPE_INTERPOLATED) {
VAR_23 = VAR_0->twomvbp;
VAR_10 = VAR_11 = 0;
if (VAR_23 & 2)
get_mvdata_interlaced(VAR_0, &VAR_10, &VAR_11, 0);
ff_vc1_pred_mv_intfr(VAR_0, 0, VAR_10, VAR_11, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], 0);
ff_vc1_mc_1mv(VAR_0, 0);
VAR_10 = VAR_11 = 0;
if (VAR_23 & 1)
get_mvdata_interlaced(VAR_0, &VAR_10, &VAR_11, 0);
ff_vc1_pred_mv_intfr(VAR_0, 0, VAR_10, VAR_11, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], 1);
ff_vc1_interp_mc(VAR_0);
} else if (VAR_18) {
VAR_27 = VAR_26 == BMV_TYPE_BACKWARD;
VAR_29 = VAR_27;
if (VAR_8)
VAR_29 = !VAR_27;
VAR_23 = VAR_0->twomvbp;
VAR_10 = VAR_11 = 0;
if (VAR_23 & 2)
get_mvdata_interlaced(VAR_0, &VAR_10, &VAR_11, 0);
ff_vc1_pred_mv_intfr(VAR_0, 0, VAR_10, VAR_11, 2, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], VAR_27);
VAR_10 = VAR_11 = 0;
if (VAR_23 & 1)
get_mvdata_interlaced(VAR_0, &VAR_10, &VAR_11, 0);
ff_vc1_pred_mv_intfr(VAR_0, 2, VAR_10, VAR_11, 2, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], VAR_29);
if (VAR_8) {
for (VAR_1 = 0; VAR_1 < 2; VAR_1++) {
s->mv[VAR_27][VAR_1+2][0] = s->mv[VAR_27][VAR_1][0] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1+2]][0] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1]][0];
s->mv[VAR_27][VAR_1+2][1] = s->mv[VAR_27][VAR_1][1] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1+2]][1] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1]][1];
s->mv[VAR_29][VAR_1+2][0] = s->mv[VAR_29][VAR_1][0] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1]][0] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1+2]][0];
s->mv[VAR_29][VAR_1+2][1] = s->mv[VAR_29][VAR_1][1] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1]][1] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1+2]][1];
}
} else {
ff_vc1_pred_mv_intfr(VAR_0, 0, 0, 0, 2, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], !VAR_27);
ff_vc1_pred_mv_intfr(VAR_0, 2, 0, 0, 2, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], !VAR_27);
}
ff_vc1_mc_4mv_luma(VAR_0, 0, VAR_27, 0);
ff_vc1_mc_4mv_luma(VAR_0, 1, VAR_27, 0);
ff_vc1_mc_4mv_luma(VAR_0, 2, VAR_29, 0);
ff_vc1_mc_4mv_luma(VAR_0, 3, VAR_29, 0);
ff_vc1_mc_4mv_chroma4(VAR_0, VAR_27, VAR_29, 0);
} else {
VAR_27 = VAR_26 == BMV_TYPE_BACKWARD;
VAR_23 = ff_vc1_mbmode_intfrp[0][VAR_22][2];
VAR_10 = VAR_11 = 0;
if (VAR_23)
get_mvdata_interlaced(VAR_0, &VAR_10, &VAR_11, 0);
ff_vc1_pred_mv_intfr(VAR_0, 0, VAR_10, VAR_11, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], VAR_27);
VAR_0->blk_mv_type[s->block_index[0]] = 1;
VAR_0->blk_mv_type[s->block_index[1]] = 1;
VAR_0->blk_mv_type[s->block_index[2]] = 1;
VAR_0->blk_mv_type[s->block_index[3]] = 1;
ff_vc1_pred_mv_intfr(VAR_0, 0, 0, 0, 2, VAR_0->range_x, VAR_0->range_y, 0, !VAR_27);
for (VAR_1 = 0; VAR_1 < 2; VAR_1++) {
s->mv[!VAR_27][VAR_1+2][0] = s->mv[!VAR_27][VAR_1][0] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1+2]][0] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1]][0];
s->mv[!VAR_27][VAR_1+2][1] = s->mv[!VAR_27][VAR_1][1] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1+2]][1] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1]][1];
}
ff_vc1_mc_1mv(VAR_0, VAR_27);
}
if (VAR_4)
GET_MQUANT();
s->current_picture.qscale_table[VAR_3] = VAR_6;
if (!VAR_0->ttmbf && VAR_4)
VAR_7 = get_vlc2(gb, ff_vc1_ttmb_vlc[VAR_0->tt_index].table, VC1_TTMB_VLC_BITS, 2);
for (VAR_1 = 0; VAR_1 < 6; VAR_1++) {
s->dc_val[0][s->block_index[VAR_1]] = 0;
VAR_14 += VAR_1 >> 2;
VAR_12 = ((VAR_4 >> (5 - VAR_1)) & 1);
if (!VAR_25)
VAR_15 = (VAR_1 & 4) ? 0 : ((VAR_1 & 1) * 8 + (VAR_1 & 2) * 4 * s->linesize);
else
VAR_15 = (VAR_1 & 4) ? 0 : ((VAR_1 & 1) * 8 + ((VAR_1 > 1) * s->linesize));
if (VAR_12) {
VAR_20 = vc1_decode_p_block(VAR_0, s->block[VAR_1], VAR_1, VAR_6, VAR_7,
VAR_13, s->dest[VAR_14] + VAR_15,
(VAR_1 & 4) ? s->uvlinesize : (s->linesize << VAR_25),
(VAR_1 & 4) && (s->flags & CODEC_FLAG_GRAY), &VAR_21);
VAR_19 |= VAR_20 << (VAR_1 << 2);
if (!VAR_0->ttmbf && VAR_7 < 8)
VAR_7 = -1;
VAR_13 = 0;
}
}
} else {
VAR_27 = 0;
for (VAR_1 = 0; VAR_1 < 6; VAR_1++) {
VAR_0->mb_type[0][s->block_index[VAR_1]] = 0;
s->dc_val[0][s->block_index[VAR_1]] = 0;
}
s->current_picture.mb_type[VAR_3] = MB_TYPE_SKIP;
s->current_picture.qscale_table[VAR_3] = 0;
VAR_0->blk_mv_type[s->block_index[0]] = 0;
VAR_0->blk_mv_type[s->block_index[1]] = 0;
VAR_0->blk_mv_type[s->block_index[2]] = 0;
VAR_0->blk_mv_type[s->block_index[3]] = 0;
if (!VAR_17) {
if (VAR_26 == BMV_TYPE_INTERPOLATED) {
ff_vc1_pred_mv_intfr(VAR_0, 0, 0, 0, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], 0);
ff_vc1_pred_mv_intfr(VAR_0, 0, 0, 0, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], 1);
} else {
VAR_27 = VAR_26 == BMV_TYPE_BACKWARD;
ff_vc1_pred_mv_intfr(VAR_0, 0, 0, 0, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], VAR_27);
if (VAR_8) {
int VAR_29 = VAR_27;
if (VAR_8)
VAR_29 = !VAR_27;
for (VAR_1 = 0; VAR_1 < 2; VAR_1++) {
s->mv[VAR_27][VAR_1+2][0] = s->mv[VAR_27][VAR_1][0] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1+2]][0] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1]][0];
s->mv[VAR_27][VAR_1+2][1] = s->mv[VAR_27][VAR_1][1] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1+2]][1] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1]][1];
s->mv[VAR_29][VAR_1+2][0] = s->mv[VAR_29][VAR_1][0] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1]][0] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1+2]][0];
s->mv[VAR_29][VAR_1+2][1] = s->mv[VAR_29][VAR_1][1] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1]][1] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1+2]][1];
}
} else {
VAR_0->blk_mv_type[s->block_index[0]] = 1;
VAR_0->blk_mv_type[s->block_index[1]] = 1;
VAR_0->blk_mv_type[s->block_index[2]] = 1;
VAR_0->blk_mv_type[s->block_index[3]] = 1;
ff_vc1_pred_mv_intfr(VAR_0, 0, 0, 0, 2, VAR_0->range_x, VAR_0->range_y, 0, !VAR_27);
for (VAR_1 = 0; VAR_1 < 2; VAR_1++) {
s->mv[!VAR_27][VAR_1+2][0] = s->mv[!VAR_27][VAR_1][0] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1+2]][0] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1]][0];
s->mv[!VAR_27][VAR_1+2][1] = s->mv[!VAR_27][VAR_1][1] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1+2]][1] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1]][1];
}
}
}
}
ff_vc1_mc_1mv(VAR_0, VAR_27);
if (VAR_17 || VAR_26 == BMV_TYPE_INTERPOLATED) {
ff_vc1_interp_mc(VAR_0);
}
}
}
if (s->mb_x == s->mb_width - 1)
memmove(VAR_0->is_intra_base, VAR_0->is_intra, sizeof(VAR_0->is_intra_base[0]) * s->mb_stride);
VAR_0->VAR_4[s->mb_x] = VAR_19;
VAR_0->ttblk[s->mb_x] = VAR_21;
return 0;
}
|
[
"static int FUNC_0(VC1Context *VAR_0)\n{",
"MpegEncContext *s = &VAR_0->s;",
"GetBitContext *gb = &s->gb;",
"int VAR_1, VAR_2;",
"int VAR_3 = s->mb_x + s->mb_y * s->mb_stride;",
"int VAR_4 = 0;",
"int VAR_5, VAR_6;",
"int VAR_7 = VAR_0->ttfrm;",
"int VAR_8 = 0;",
"int VAR_9 = 1;",
"int VAR_10, VAR_11;",
"int VAR_12;",
"int VAR_13 = 1;",
"int VAR_14, VAR_15;",
"int VAR_16, VAR_17, VAR_18 = 0;",
"int VAR_19 = 0, VAR_20, VAR_21 = 0;",
"int VAR_22 = 0, VAR_23;",
"int VAR_24, VAR_25;",
"int VAR_26 = BMV_TYPE_BACKWARD;",
"int VAR_27, VAR_29;",
"VAR_6 = VAR_0->pq;",
"s->mb_intra = 0;",
"if (VAR_0->skip_is_raw)\nVAR_16 = get_bits1(gb);",
"else\nVAR_16 = VAR_0->s.mbskip_table[VAR_3];",
"if (!VAR_16) {",
"VAR_22 = get_vlc2(gb, VAR_0->mbmode_vlc->table, VC1_INTFR_NON4MV_MBMODE_VLC_BITS, 2);",
"if (ff_vc1_mbmode_intfrp[0][VAR_22][0] == MV_PMODE_INTFR_2MV_FIELD) {",
"VAR_18 = 1;",
"VAR_0->blk_mv_type[s->block_index[0]] = 1;",
"VAR_0->blk_mv_type[s->block_index[1]] = 1;",
"VAR_0->blk_mv_type[s->block_index[2]] = 1;",
"VAR_0->blk_mv_type[s->block_index[3]] = 1;",
"} else {",
"VAR_0->blk_mv_type[s->block_index[0]] = 0;",
"VAR_0->blk_mv_type[s->block_index[1]] = 0;",
"VAR_0->blk_mv_type[s->block_index[2]] = 0;",
"VAR_0->blk_mv_type[s->block_index[3]] = 0;",
"}",
"}",
"if (VAR_0->dmb_is_raw)\nVAR_17 = get_bits1(gb);",
"else\nVAR_17 = VAR_0->direct_mb_plane[VAR_3];",
"if (VAR_17) {",
"s->mv[0][0][0] = s->current_picture.motion_val[0][s->block_index[0]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][0], VAR_0->bfraction, 0, s->quarter_sample);",
"s->mv[0][0][1] = s->current_picture.motion_val[0][s->block_index[0]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][1], VAR_0->bfraction, 0, s->quarter_sample);",
"s->mv[1][0][0] = s->current_picture.motion_val[1][s->block_index[0]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][0], VAR_0->bfraction, 1, s->quarter_sample);",
"s->mv[1][0][1] = s->current_picture.motion_val[1][s->block_index[0]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][1], VAR_0->bfraction, 1, s->quarter_sample);",
"if (VAR_18) {",
"s->mv[0][2][0] = s->current_picture.motion_val[0][s->block_index[2]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][0], VAR_0->bfraction, 0, s->quarter_sample);",
"s->mv[0][2][1] = s->current_picture.motion_val[0][s->block_index[2]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][1], VAR_0->bfraction, 0, s->quarter_sample);",
"s->mv[1][2][0] = s->current_picture.motion_val[1][s->block_index[2]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][0], VAR_0->bfraction, 1, s->quarter_sample);",
"s->mv[1][2][1] = s->current_picture.motion_val[1][s->block_index[2]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][1], VAR_0->bfraction, 1, s->quarter_sample);",
"for (VAR_1 = 1; VAR_1 < 4; VAR_1 += 2) {",
"s->mv[0][VAR_1][0] = s->current_picture.motion_val[0][s->block_index[VAR_1]][0] = s->mv[0][VAR_1-1][0];",
"s->mv[0][VAR_1][1] = s->current_picture.motion_val[0][s->block_index[VAR_1]][1] = s->mv[0][VAR_1-1][1];",
"s->mv[1][VAR_1][0] = s->current_picture.motion_val[1][s->block_index[VAR_1]][0] = s->mv[1][VAR_1-1][0];",
"s->mv[1][VAR_1][1] = s->current_picture.motion_val[1][s->block_index[VAR_1]][1] = s->mv[1][VAR_1-1][1];",
"}",
"} else {",
"for (VAR_1 = 1; VAR_1 < 4; VAR_1++) {",
"s->mv[0][VAR_1][0] = s->current_picture.motion_val[0][s->block_index[VAR_1]][0] = s->mv[0][0][0];",
"s->mv[0][VAR_1][1] = s->current_picture.motion_val[0][s->block_index[VAR_1]][1] = s->mv[0][0][1];",
"s->mv[1][VAR_1][0] = s->current_picture.motion_val[1][s->block_index[VAR_1]][0] = s->mv[1][0][0];",
"s->mv[1][VAR_1][1] = s->current_picture.motion_val[1][s->block_index[VAR_1]][1] = s->mv[1][0][1];",
"}",
"}",
"}",
"if (ff_vc1_mbmode_intfrp[0][VAR_22][0] == MV_PMODE_INTFR_INTRA) {",
"for (VAR_1 = 0; VAR_1 < 4; VAR_1++) {",
"s->mv[0][VAR_1][0] = s->current_picture.motion_val[0][s->block_index[VAR_1]][0] = 0;",
"s->mv[0][VAR_1][1] = s->current_picture.motion_val[0][s->block_index[VAR_1]][1] = 0;",
"s->mv[1][VAR_1][0] = s->current_picture.motion_val[1][s->block_index[VAR_1]][0] = 0;",
"s->mv[1][VAR_1][1] = s->current_picture.motion_val[1][s->block_index[VAR_1]][1] = 0;",
"}",
"s->current_picture.mb_type[VAR_3] = MB_TYPE_INTRA;",
"s->mb_intra = VAR_0->is_intra[s->mb_x] = 1;",
"for (VAR_1 = 0; VAR_1 < 6; VAR_1++)",
"VAR_0->mb_type[0][s->block_index[VAR_1]] = 1;",
"VAR_25 = VAR_0->fieldtx_plane[VAR_3] = get_bits1(gb);",
"VAR_9 = get_bits1(gb);",
"if (VAR_9)\nVAR_4 = 1 + get_vlc2(&VAR_0->s.gb, VAR_0->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);",
"VAR_0->s.ac_pred = VAR_0->acpred_plane[VAR_3] = get_bits1(gb);",
"GET_MQUANT();",
"s->current_picture.qscale_table[VAR_3] = VAR_6;",
"s->y_dc_scale = s->y_dc_scale_table[VAR_6];",
"s->c_dc_scale = s->c_dc_scale_table[VAR_6];",
"VAR_14 = 0;",
"for (VAR_1 = 0; VAR_1 < 6; VAR_1++) {",
"s->dc_val[0][s->block_index[VAR_1]] = 0;",
"VAR_14 += VAR_1 >> 2;",
"VAR_12 = ((VAR_4 >> (5 - VAR_1)) & 1);",
"VAR_0->mb_type[0][s->block_index[VAR_1]] = s->mb_intra;",
"VAR_0->a_avail = VAR_0->c_avail = 0;",
"if (VAR_1 == 2 || VAR_1 == 3 || !s->first_slice_line)\nVAR_0->a_avail = VAR_0->mb_type[0][s->block_index[VAR_1] - s->block_wrap[VAR_1]];",
"if (VAR_1 == 1 || VAR_1 == 3 || s->mb_x)\nVAR_0->c_avail = VAR_0->mb_type[0][s->block_index[VAR_1] - 1];",
"vc1_decode_intra_block(VAR_0, s->block[VAR_1], VAR_1, VAR_12, VAR_6,\n(VAR_1 & 4) ? VAR_0->codingset2 : VAR_0->codingset);",
"if (VAR_1 > 3 && (s->flags & CODEC_FLAG_GRAY))\ncontinue;",
"VAR_0->vc1dsp.vc1_inv_trans_8x8(s->block[VAR_1]);",
"if (VAR_1 < 4) {",
"VAR_24 = s->linesize << VAR_25;",
"VAR_15 = (VAR_25) ? ((VAR_1 & 1) * 8) + ((VAR_1 & 2) >> 1) * s->linesize : (VAR_1 & 1) * 8 + 4 * (VAR_1 & 2) * s->linesize;",
"} else {",
"VAR_24 = s->uvlinesize;",
"VAR_15 = 0;",
"}",
"s->idsp.put_signed_pixels_clamped(s->block[VAR_1],\ns->dest[VAR_14] + VAR_15,\nVAR_24);",
"}",
"} else {",
"s->mb_intra = VAR_0->is_intra[s->mb_x] = 0;",
"if (!VAR_17) {",
"if (VAR_16 || !s->mb_intra) {",
"VAR_26 = decode012(gb);",
"switch (VAR_26) {",
"case 0:\nVAR_26 = (VAR_0->bfraction >= (B_FRACTION_DEN/2)) ? BMV_TYPE_BACKWARD : BMV_TYPE_FORWARD;",
"break;",
"case 1:\nVAR_26 = (VAR_0->bfraction >= (B_FRACTION_DEN/2)) ? BMV_TYPE_FORWARD : BMV_TYPE_BACKWARD;",
"break;",
"case 2:\nVAR_26 = BMV_TYPE_INTERPOLATED;",
"}",
"}",
"if (VAR_18 && VAR_26 != BMV_TYPE_INTERPOLATED)\nVAR_8 = get_bits1(gb);",
"}",
"if (!VAR_16) {",
"VAR_9 = ff_vc1_mbmode_intfrp[0][VAR_22][3];",
"if (VAR_9)\nVAR_4 = 1 + get_vlc2(&VAR_0->s.gb, VAR_0->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);",
"if (!VAR_17) {",
"if (VAR_26 == BMV_TYPE_INTERPOLATED && VAR_18) {",
"VAR_0->fourmvbp = get_vlc2(gb, VAR_0->fourmvbp_vlc->table, VC1_4MV_BLOCK_PATTERN_VLC_BITS, 1);",
"} else if (VAR_26 == BMV_TYPE_INTERPOLATED || VAR_18) {",
"VAR_0->twomvbp = get_vlc2(gb, VAR_0->twomvbp_vlc->table, VC1_2MV_BLOCK_PATTERN_VLC_BITS, 1);",
"}",
"}",
"for (VAR_1 = 0; VAR_1 < 6; VAR_1++)",
"VAR_0->mb_type[0][s->block_index[VAR_1]] = 0;",
"VAR_25 = VAR_0->fieldtx_plane[VAR_3] = ff_vc1_mbmode_intfrp[0][VAR_22][1];",
"VAR_14 = 0;",
"if (VAR_17) {",
"if (VAR_18) {",
"for (VAR_1 = 0; VAR_1 < 4; VAR_1++) {",
"ff_vc1_mc_4mv_luma(VAR_0, VAR_1, 0, 0);",
"ff_vc1_mc_4mv_luma(VAR_0, VAR_1, 1, 1);",
"}",
"ff_vc1_mc_4mv_chroma4(VAR_0, 0, 0, 0);",
"ff_vc1_mc_4mv_chroma4(VAR_0, 1, 1, 1);",
"} else {",
"ff_vc1_mc_1mv(VAR_0, 0);",
"ff_vc1_interp_mc(VAR_0);",
"}",
"} else if (VAR_18 && VAR_26 == BMV_TYPE_INTERPOLATED) {",
"VAR_23 = VAR_0->fourmvbp;",
"for (VAR_1 = 0; VAR_1 < 4; VAR_1++) {",
"VAR_27 = VAR_1==1 || VAR_1==3;",
"VAR_10 = VAR_11 = 0;",
"VAR_12 = ((VAR_23 >> (3 - VAR_1)) & 1);",
"if (VAR_12)\nget_mvdata_interlaced(VAR_0, &VAR_10, &VAR_11, 0);",
"VAR_2 = VAR_1 > 1 ? 2 : 0;",
"ff_vc1_pred_mv_intfr(VAR_0, VAR_2, VAR_10, VAR_11, 2, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], VAR_27);",
"ff_vc1_mc_4mv_luma(VAR_0, VAR_2, VAR_27, VAR_27);",
"ff_vc1_mc_4mv_luma(VAR_0, VAR_2+1, VAR_27, VAR_27);",
"}",
"ff_vc1_mc_4mv_chroma4(VAR_0, 0, 0, 0);",
"ff_vc1_mc_4mv_chroma4(VAR_0, 1, 1, 1);",
"} else if (VAR_26 == BMV_TYPE_INTERPOLATED) {",
"VAR_23 = VAR_0->twomvbp;",
"VAR_10 = VAR_11 = 0;",
"if (VAR_23 & 2)\nget_mvdata_interlaced(VAR_0, &VAR_10, &VAR_11, 0);",
"ff_vc1_pred_mv_intfr(VAR_0, 0, VAR_10, VAR_11, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], 0);",
"ff_vc1_mc_1mv(VAR_0, 0);",
"VAR_10 = VAR_11 = 0;",
"if (VAR_23 & 1)\nget_mvdata_interlaced(VAR_0, &VAR_10, &VAR_11, 0);",
"ff_vc1_pred_mv_intfr(VAR_0, 0, VAR_10, VAR_11, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], 1);",
"ff_vc1_interp_mc(VAR_0);",
"} else if (VAR_18) {",
"VAR_27 = VAR_26 == BMV_TYPE_BACKWARD;",
"VAR_29 = VAR_27;",
"if (VAR_8)\nVAR_29 = !VAR_27;",
"VAR_23 = VAR_0->twomvbp;",
"VAR_10 = VAR_11 = 0;",
"if (VAR_23 & 2)\nget_mvdata_interlaced(VAR_0, &VAR_10, &VAR_11, 0);",
"ff_vc1_pred_mv_intfr(VAR_0, 0, VAR_10, VAR_11, 2, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], VAR_27);",
"VAR_10 = VAR_11 = 0;",
"if (VAR_23 & 1)\nget_mvdata_interlaced(VAR_0, &VAR_10, &VAR_11, 0);",
"ff_vc1_pred_mv_intfr(VAR_0, 2, VAR_10, VAR_11, 2, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], VAR_29);",
"if (VAR_8) {",
"for (VAR_1 = 0; VAR_1 < 2; VAR_1++) {",
"s->mv[VAR_27][VAR_1+2][0] = s->mv[VAR_27][VAR_1][0] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1+2]][0] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1]][0];",
"s->mv[VAR_27][VAR_1+2][1] = s->mv[VAR_27][VAR_1][1] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1+2]][1] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1]][1];",
"s->mv[VAR_29][VAR_1+2][0] = s->mv[VAR_29][VAR_1][0] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1]][0] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1+2]][0];",
"s->mv[VAR_29][VAR_1+2][1] = s->mv[VAR_29][VAR_1][1] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1]][1] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1+2]][1];",
"}",
"} else {",
"ff_vc1_pred_mv_intfr(VAR_0, 0, 0, 0, 2, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], !VAR_27);",
"ff_vc1_pred_mv_intfr(VAR_0, 2, 0, 0, 2, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], !VAR_27);",
"}",
"ff_vc1_mc_4mv_luma(VAR_0, 0, VAR_27, 0);",
"ff_vc1_mc_4mv_luma(VAR_0, 1, VAR_27, 0);",
"ff_vc1_mc_4mv_luma(VAR_0, 2, VAR_29, 0);",
"ff_vc1_mc_4mv_luma(VAR_0, 3, VAR_29, 0);",
"ff_vc1_mc_4mv_chroma4(VAR_0, VAR_27, VAR_29, 0);",
"} else {",
"VAR_27 = VAR_26 == BMV_TYPE_BACKWARD;",
"VAR_23 = ff_vc1_mbmode_intfrp[0][VAR_22][2];",
"VAR_10 = VAR_11 = 0;",
"if (VAR_23)\nget_mvdata_interlaced(VAR_0, &VAR_10, &VAR_11, 0);",
"ff_vc1_pred_mv_intfr(VAR_0, 0, VAR_10, VAR_11, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], VAR_27);",
"VAR_0->blk_mv_type[s->block_index[0]] = 1;",
"VAR_0->blk_mv_type[s->block_index[1]] = 1;",
"VAR_0->blk_mv_type[s->block_index[2]] = 1;",
"VAR_0->blk_mv_type[s->block_index[3]] = 1;",
"ff_vc1_pred_mv_intfr(VAR_0, 0, 0, 0, 2, VAR_0->range_x, VAR_0->range_y, 0, !VAR_27);",
"for (VAR_1 = 0; VAR_1 < 2; VAR_1++) {",
"s->mv[!VAR_27][VAR_1+2][0] = s->mv[!VAR_27][VAR_1][0] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1+2]][0] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1]][0];",
"s->mv[!VAR_27][VAR_1+2][1] = s->mv[!VAR_27][VAR_1][1] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1+2]][1] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1]][1];",
"}",
"ff_vc1_mc_1mv(VAR_0, VAR_27);",
"}",
"if (VAR_4)\nGET_MQUANT();",
"s->current_picture.qscale_table[VAR_3] = VAR_6;",
"if (!VAR_0->ttmbf && VAR_4)\nVAR_7 = get_vlc2(gb, ff_vc1_ttmb_vlc[VAR_0->tt_index].table, VC1_TTMB_VLC_BITS, 2);",
"for (VAR_1 = 0; VAR_1 < 6; VAR_1++) {",
"s->dc_val[0][s->block_index[VAR_1]] = 0;",
"VAR_14 += VAR_1 >> 2;",
"VAR_12 = ((VAR_4 >> (5 - VAR_1)) & 1);",
"if (!VAR_25)\nVAR_15 = (VAR_1 & 4) ? 0 : ((VAR_1 & 1) * 8 + (VAR_1 & 2) * 4 * s->linesize);",
"else\nVAR_15 = (VAR_1 & 4) ? 0 : ((VAR_1 & 1) * 8 + ((VAR_1 > 1) * s->linesize));",
"if (VAR_12) {",
"VAR_20 = vc1_decode_p_block(VAR_0, s->block[VAR_1], VAR_1, VAR_6, VAR_7,\nVAR_13, s->dest[VAR_14] + VAR_15,\n(VAR_1 & 4) ? s->uvlinesize : (s->linesize << VAR_25),\n(VAR_1 & 4) && (s->flags & CODEC_FLAG_GRAY), &VAR_21);",
"VAR_19 |= VAR_20 << (VAR_1 << 2);",
"if (!VAR_0->ttmbf && VAR_7 < 8)\nVAR_7 = -1;",
"VAR_13 = 0;",
"}",
"}",
"} else {",
"VAR_27 = 0;",
"for (VAR_1 = 0; VAR_1 < 6; VAR_1++) {",
"VAR_0->mb_type[0][s->block_index[VAR_1]] = 0;",
"s->dc_val[0][s->block_index[VAR_1]] = 0;",
"}",
"s->current_picture.mb_type[VAR_3] = MB_TYPE_SKIP;",
"s->current_picture.qscale_table[VAR_3] = 0;",
"VAR_0->blk_mv_type[s->block_index[0]] = 0;",
"VAR_0->blk_mv_type[s->block_index[1]] = 0;",
"VAR_0->blk_mv_type[s->block_index[2]] = 0;",
"VAR_0->blk_mv_type[s->block_index[3]] = 0;",
"if (!VAR_17) {",
"if (VAR_26 == BMV_TYPE_INTERPOLATED) {",
"ff_vc1_pred_mv_intfr(VAR_0, 0, 0, 0, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], 0);",
"ff_vc1_pred_mv_intfr(VAR_0, 0, 0, 0, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], 1);",
"} else {",
"VAR_27 = VAR_26 == BMV_TYPE_BACKWARD;",
"ff_vc1_pred_mv_intfr(VAR_0, 0, 0, 0, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], VAR_27);",
"if (VAR_8) {",
"int VAR_29 = VAR_27;",
"if (VAR_8)\nVAR_29 = !VAR_27;",
"for (VAR_1 = 0; VAR_1 < 2; VAR_1++) {",
"s->mv[VAR_27][VAR_1+2][0] = s->mv[VAR_27][VAR_1][0] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1+2]][0] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1]][0];",
"s->mv[VAR_27][VAR_1+2][1] = s->mv[VAR_27][VAR_1][1] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1+2]][1] = s->current_picture.motion_val[VAR_27][s->block_index[VAR_1]][1];",
"s->mv[VAR_29][VAR_1+2][0] = s->mv[VAR_29][VAR_1][0] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1]][0] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1+2]][0];",
"s->mv[VAR_29][VAR_1+2][1] = s->mv[VAR_29][VAR_1][1] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1]][1] = s->current_picture.motion_val[VAR_29][s->block_index[VAR_1+2]][1];",
"}",
"} else {",
"VAR_0->blk_mv_type[s->block_index[0]] = 1;",
"VAR_0->blk_mv_type[s->block_index[1]] = 1;",
"VAR_0->blk_mv_type[s->block_index[2]] = 1;",
"VAR_0->blk_mv_type[s->block_index[3]] = 1;",
"ff_vc1_pred_mv_intfr(VAR_0, 0, 0, 0, 2, VAR_0->range_x, VAR_0->range_y, 0, !VAR_27);",
"for (VAR_1 = 0; VAR_1 < 2; VAR_1++) {",
"s->mv[!VAR_27][VAR_1+2][0] = s->mv[!VAR_27][VAR_1][0] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1+2]][0] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1]][0];",
"s->mv[!VAR_27][VAR_1+2][1] = s->mv[!VAR_27][VAR_1][1] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1+2]][1] = s->current_picture.motion_val[!VAR_27][s->block_index[VAR_1]][1];",
"}",
"}",
"}",
"}",
"ff_vc1_mc_1mv(VAR_0, VAR_27);",
"if (VAR_17 || VAR_26 == BMV_TYPE_INTERPOLATED) {",
"ff_vc1_interp_mc(VAR_0);",
"}",
"}",
"}",
"if (s->mb_x == s->mb_width - 1)\nmemmove(VAR_0->is_intra_base, VAR_0->is_intra, sizeof(VAR_0->is_intra_base[0]) * s->mb_stride);",
"VAR_0->VAR_4[s->mb_x] = VAR_19;",
"VAR_0->ttblk[s->mb_x] = VAR_21;",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
45
],
[
47
],
[
49,
51
],
[
53,
55
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
91,
93
],
[
95,
97
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
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
],
[
195
],
[
197
],
[
199
],
[
201
],
[
203
],
[
205
],
[
207
],
[
209
],
[
211
],
[
213,
215
],
[
217,
219
],
[
223,
225
],
[
227,
229
],
[
231
],
[
233
],
[
235
],
[
237
],
[
239
],
[
241
],
[
243
],
[
245
],
[
247,
249,
251
],
[
253
],
[
255
],
[
257
],
[
259
],
[
261
],
[
263
],
[
265
],
[
267,
269
],
[
271
],
[
273,
275
],
[
277
],
[
279,
281
],
[
283
],
[
285
],
[
289,
291
],
[
293
],
[
297
],
[
299
],
[
301,
303
],
[
305
],
[
307
],
[
309
],
[
311
],
[
313
],
[
315
],
[
317
],
[
321
],
[
323
],
[
325
],
[
329
],
[
331
],
[
333
],
[
335
],
[
337
],
[
339
],
[
341
],
[
343
],
[
345
],
[
347
],
[
349
],
[
351
],
[
353
],
[
355
],
[
357
],
[
359
],
[
361
],
[
363
],
[
365
],
[
367,
369
],
[
371
],
[
373
],
[
375
],
[
377
],
[
379
],
[
383
],
[
385
],
[
387
],
[
389
],
[
391
],
[
393,
395
],
[
399
],
[
401
],
[
405
],
[
407,
409
],
[
413
],
[
415
],
[
417
],
[
419
],
[
421
],
[
423,
425
],
[
427
],
[
429
],
[
431,
433
],
[
435
],
[
439
],
[
441,
443
],
[
445
],
[
449
],
[
451
],
[
453
],
[
455
],
[
457
],
[
459
],
[
461
],
[
463
],
[
465
],
[
467
],
[
469
],
[
473
],
[
475
],
[
477
],
[
479
],
[
481
],
[
483
],
[
485
],
[
489
],
[
491
],
[
493,
495
],
[
499
],
[
501
],
[
503
],
[
505
],
[
507
],
[
509
],
[
511
],
[
513
],
[
515
],
[
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
],
[
575
],
[
577
],
[
579
],
[
581
],
[
583
],
[
585
],
[
587
],
[
589
],
[
591
],
[
593
],
[
595
],
[
597
],
[
601
],
[
603
],
[
605
],
[
607
],
[
609
],
[
611
],
[
613
],
[
615
],
[
617
],
[
619,
621
],
[
623
],
[
625
],
[
627
],
[
629
],
[
631
],
[
633
],
[
635
],
[
637
],
[
639
],
[
641
],
[
643
],
[
645
],
[
647
],
[
649
],
[
651
],
[
653
],
[
655
],
[
657
],
[
659
],
[
663
],
[
665
],
[
667
],
[
669
],
[
671
],
[
673
],
[
675,
677
],
[
679
],
[
681
],
[
683
],
[
685
]
] |
9,665 |
static void search_for_pns(AACEncContext *s, AVCodecContext *avctx, SingleChannelElement *sce)
{
int start = 0, w, w2, g;
const float lambda = s->lambda;
const float freq_mult = avctx->sample_rate/(1024.0f/sce->ics.num_windows)/2.0f;
const float spread_threshold = NOISE_SPREAD_THRESHOLD*(lambda/120.f);
const float thr_mult = NOISE_LAMBDA_NUMERATOR/lambda;
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
start = 0;
for (g = 0; g < sce->ics.num_swb; g++) {
if (start*freq_mult > NOISE_LOW_LIMIT*(lambda/170.0f)) {
float energy = 0.0f, threshold = 0.0f, spread = 0.0f;
for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
FFPsyBand *band = &s->psy.ch[s->cur_channel+0].psy_bands[(w+w2)*16+g];
energy += band->energy;
threshold += band->threshold;
spread += band->spread;
}
if (spread > spread_threshold*sce->ics.group_len[w] &&
((sce->zeroes[w*16+g] && energy >= threshold) ||
energy < threshold*thr_mult*sce->ics.group_len[w])) {
sce->band_type[w*16+g] = NOISE_BT;
sce->pns_ener[w*16+g] = energy / sce->ics.group_len[w];
sce->zeroes[w*16+g] = 0;
}
}
start += sce->ics.swb_sizes[g];
}
}
}
| false |
FFmpeg
|
033e58941e684ac7190d6d1b06f31a677be4539f
|
static void search_for_pns(AACEncContext *s, AVCodecContext *avctx, SingleChannelElement *sce)
{
int start = 0, w, w2, g;
const float lambda = s->lambda;
const float freq_mult = avctx->sample_rate/(1024.0f/sce->ics.num_windows)/2.0f;
const float spread_threshold = NOISE_SPREAD_THRESHOLD*(lambda/120.f);
const float thr_mult = NOISE_LAMBDA_NUMERATOR/lambda;
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
start = 0;
for (g = 0; g < sce->ics.num_swb; g++) {
if (start*freq_mult > NOISE_LOW_LIMIT*(lambda/170.0f)) {
float energy = 0.0f, threshold = 0.0f, spread = 0.0f;
for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
FFPsyBand *band = &s->psy.ch[s->cur_channel+0].psy_bands[(w+w2)*16+g];
energy += band->energy;
threshold += band->threshold;
spread += band->spread;
}
if (spread > spread_threshold*sce->ics.group_len[w] &&
((sce->zeroes[w*16+g] && energy >= threshold) ||
energy < threshold*thr_mult*sce->ics.group_len[w])) {
sce->band_type[w*16+g] = NOISE_BT;
sce->pns_ener[w*16+g] = energy / sce->ics.group_len[w];
sce->zeroes[w*16+g] = 0;
}
}
start += sce->ics.swb_sizes[g];
}
}
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(AACEncContext *VAR_0, AVCodecContext *VAR_1, SingleChannelElement *VAR_2)
{
int VAR_3 = 0, VAR_4, VAR_5, VAR_6;
const float VAR_7 = VAR_0->VAR_7;
const float VAR_8 = VAR_1->sample_rate/(1024.0f/VAR_2->ics.num_windows)/2.0f;
const float VAR_9 = NOISE_SPREAD_THRESHOLD*(VAR_7/120.f);
const float VAR_10 = NOISE_LAMBDA_NUMERATOR/VAR_7;
for (VAR_4 = 0; VAR_4 < VAR_2->ics.num_windows; VAR_4 += VAR_2->ics.group_len[VAR_4]) {
VAR_3 = 0;
for (VAR_6 = 0; VAR_6 < VAR_2->ics.num_swb; VAR_6++) {
if (VAR_3*VAR_8 > NOISE_LOW_LIMIT*(VAR_7/170.0f)) {
float energy = 0.0f, threshold = 0.0f, spread = 0.0f;
for (VAR_5 = 0; VAR_5 < VAR_2->ics.group_len[VAR_4]; VAR_5++) {
FFPsyBand *band = &VAR_0->psy.ch[VAR_0->cur_channel+0].psy_bands[(VAR_4+VAR_5)*16+VAR_6];
energy += band->energy;
threshold += band->threshold;
spread += band->spread;
}
if (spread > VAR_9*VAR_2->ics.group_len[VAR_4] &&
((VAR_2->zeroes[VAR_4*16+VAR_6] && energy >= threshold) ||
energy < threshold*VAR_10*VAR_2->ics.group_len[VAR_4])) {
VAR_2->band_type[VAR_4*16+VAR_6] = NOISE_BT;
VAR_2->pns_ener[VAR_4*16+VAR_6] = energy / VAR_2->ics.group_len[VAR_4];
VAR_2->zeroes[VAR_4*16+VAR_6] = 0;
}
}
VAR_3 += VAR_2->ics.swb_sizes[VAR_6];
}
}
}
|
[
"static void FUNC_0(AACEncContext *VAR_0, AVCodecContext *VAR_1, SingleChannelElement *VAR_2)\n{",
"int VAR_3 = 0, VAR_4, VAR_5, VAR_6;",
"const float VAR_7 = VAR_0->VAR_7;",
"const float VAR_8 = VAR_1->sample_rate/(1024.0f/VAR_2->ics.num_windows)/2.0f;",
"const float VAR_9 = NOISE_SPREAD_THRESHOLD*(VAR_7/120.f);",
"const float VAR_10 = NOISE_LAMBDA_NUMERATOR/VAR_7;",
"for (VAR_4 = 0; VAR_4 < VAR_2->ics.num_windows; VAR_4 += VAR_2->ics.group_len[VAR_4]) {",
"VAR_3 = 0;",
"for (VAR_6 = 0; VAR_6 < VAR_2->ics.num_swb; VAR_6++) {",
"if (VAR_3*VAR_8 > NOISE_LOW_LIMIT*(VAR_7/170.0f)) {",
"float energy = 0.0f, threshold = 0.0f, spread = 0.0f;",
"for (VAR_5 = 0; VAR_5 < VAR_2->ics.group_len[VAR_4]; VAR_5++) {",
"FFPsyBand *band = &VAR_0->psy.ch[VAR_0->cur_channel+0].psy_bands[(VAR_4+VAR_5)*16+VAR_6];",
"energy += band->energy;",
"threshold += band->threshold;",
"spread += band->spread;",
"}",
"if (spread > VAR_9*VAR_2->ics.group_len[VAR_4] &&\n((VAR_2->zeroes[VAR_4*16+VAR_6] && energy >= threshold) ||\nenergy < threshold*VAR_10*VAR_2->ics.group_len[VAR_4])) {",
"VAR_2->band_type[VAR_4*16+VAR_6] = NOISE_BT;",
"VAR_2->pns_ener[VAR_4*16+VAR_6] = energy / VAR_2->ics.group_len[VAR_4];",
"VAR_2->zeroes[VAR_4*16+VAR_6] = 0;",
"}",
"}",
"VAR_3 += VAR_2->ics.swb_sizes[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
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39,
41,
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
]
] |
9,667 |
static void curses_calc_pad(void)
{
if (is_graphic_console()) {
width = gwidth;
height = gheight;
} else {
width = COLS;
height = LINES;
}
if (screenpad)
delwin(screenpad);
clear();
refresh();
screenpad = newpad(height, width);
if (width > COLS) {
px = (width - COLS) / 2;
sminx = 0;
smaxx = COLS;
} else {
px = 0;
sminx = (COLS - width) / 2;
smaxx = sminx + width;
}
if (height > LINES) {
py = (height - LINES) / 2;
sminy = 0;
smaxy = LINES;
} else {
py = 0;
sminy = (LINES - height) / 2;
smaxy = sminy + height;
}
}
| false |
qemu
|
c21bbcfa3ff4f6dc49fb01080ef598851aa424dd
|
static void curses_calc_pad(void)
{
if (is_graphic_console()) {
width = gwidth;
height = gheight;
} else {
width = COLS;
height = LINES;
}
if (screenpad)
delwin(screenpad);
clear();
refresh();
screenpad = newpad(height, width);
if (width > COLS) {
px = (width - COLS) / 2;
sminx = 0;
smaxx = COLS;
} else {
px = 0;
sminx = (COLS - width) / 2;
smaxx = sminx + width;
}
if (height > LINES) {
py = (height - LINES) / 2;
sminy = 0;
smaxy = LINES;
} else {
py = 0;
sminy = (LINES - height) / 2;
smaxy = sminy + height;
}
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(void)
{
if (is_graphic_console()) {
width = gwidth;
height = gheight;
} else {
width = COLS;
height = LINES;
}
if (screenpad)
delwin(screenpad);
clear();
refresh();
screenpad = newpad(height, width);
if (width > COLS) {
px = (width - COLS) / 2;
sminx = 0;
smaxx = COLS;
} else {
px = 0;
sminx = (COLS - width) / 2;
smaxx = sminx + width;
}
if (height > LINES) {
py = (height - LINES) / 2;
sminy = 0;
smaxy = LINES;
} else {
py = 0;
sminy = (LINES - height) / 2;
smaxy = sminy + height;
}
}
|
[
"static void FUNC_0(void)\n{",
"if (is_graphic_console()) {",
"width = gwidth;",
"height = gheight;",
"} else {",
"width = COLS;",
"height = LINES;",
"}",
"if (screenpad)\ndelwin(screenpad);",
"clear();",
"refresh();",
"screenpad = newpad(height, width);",
"if (width > COLS) {",
"px = (width - COLS) / 2;",
"sminx = 0;",
"smaxx = COLS;",
"} else {",
"px = 0;",
"sminx = (COLS - width) / 2;",
"smaxx = sminx + width;",
"}",
"if (height > LINES) {",
"py = (height - LINES) / 2;",
"sminy = 0;",
"smaxy = LINES;",
"} else {",
"py = 0;",
"sminy = (LINES - height) / 2;",
"smaxy = sminy + height;",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
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
],
[
33
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
]
] |
9,668 |
static void fpu_dump_state(CPUState *env, FILE *f,
int (*fpu_fprintf)(FILE *f, const char *fmt, ...),
int flags)
{
int i;
int is_fpu64 = !!(env->hflags & MIPS_HFLAG_F64);
#define printfpr(fp) \
do { \
if (is_fpu64) \
fpu_fprintf(f, "w:%08x d:%016" PRIx64 \
" fd:%13g fs:%13g psu: %13g\n", \
(fp)->w[FP_ENDIAN_IDX], (fp)->d, \
(double)(fp)->fd, \
(double)(fp)->fs[FP_ENDIAN_IDX], \
(double)(fp)->fs[!FP_ENDIAN_IDX]); \
else { \
fpr_t tmp; \
tmp.w[FP_ENDIAN_IDX] = (fp)->w[FP_ENDIAN_IDX]; \
tmp.w[!FP_ENDIAN_IDX] = ((fp) + 1)->w[FP_ENDIAN_IDX]; \
fpu_fprintf(f, "w:%08x d:%016" PRIx64 \
" fd:%13g fs:%13g psu:%13g\n", \
tmp.w[FP_ENDIAN_IDX], tmp.d, \
(double)tmp.fd, \
(double)tmp.fs[FP_ENDIAN_IDX], \
(double)tmp.fs[!FP_ENDIAN_IDX]); \
} \
} while(0)
fpu_fprintf(f, "CP1 FCR0 0x%08x FCR31 0x%08x SR.FR %d fp_status 0x%08x(0x%02x)\n",
env->active_fpu.fcr0, env->active_fpu.fcr31, is_fpu64, env->active_fpu.fp_status,
get_float_exception_flags(&env->active_fpu.fp_status));
for (i = 0; i < 32; (is_fpu64) ? i++ : (i += 2)) {
fpu_fprintf(f, "%3s: ", fregnames[i]);
printfpr(&env->active_fpu.fpr[i]);
}
#undef printfpr
}
| false |
qemu
|
9a78eead0c74333a394c0f7bbfc4423ac746fcd5
|
static void fpu_dump_state(CPUState *env, FILE *f,
int (*fpu_fprintf)(FILE *f, const char *fmt, ...),
int flags)
{
int i;
int is_fpu64 = !!(env->hflags & MIPS_HFLAG_F64);
#define printfpr(fp) \
do { \
if (is_fpu64) \
fpu_fprintf(f, "w:%08x d:%016" PRIx64 \
" fd:%13g fs:%13g psu: %13g\n", \
(fp)->w[FP_ENDIAN_IDX], (fp)->d, \
(double)(fp)->fd, \
(double)(fp)->fs[FP_ENDIAN_IDX], \
(double)(fp)->fs[!FP_ENDIAN_IDX]); \
else { \
fpr_t tmp; \
tmp.w[FP_ENDIAN_IDX] = (fp)->w[FP_ENDIAN_IDX]; \
tmp.w[!FP_ENDIAN_IDX] = ((fp) + 1)->w[FP_ENDIAN_IDX]; \
fpu_fprintf(f, "w:%08x d:%016" PRIx64 \
" fd:%13g fs:%13g psu:%13g\n", \
tmp.w[FP_ENDIAN_IDX], tmp.d, \
(double)tmp.fd, \
(double)tmp.fs[FP_ENDIAN_IDX], \
(double)tmp.fs[!FP_ENDIAN_IDX]); \
} \
} while(0)
fpu_fprintf(f, "CP1 FCR0 0x%08x FCR31 0x%08x SR.FR %d fp_status 0x%08x(0x%02x)\n",
env->active_fpu.fcr0, env->active_fpu.fcr31, is_fpu64, env->active_fpu.fp_status,
get_float_exception_flags(&env->active_fpu.fp_status));
for (i = 0; i < 32; (is_fpu64) ? i++ : (i += 2)) {
fpu_fprintf(f, "%3s: ", fregnames[i]);
printfpr(&env->active_fpu.fpr[i]);
}
#undef printfpr
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(CPUState *VAR_0, FILE *VAR_3,
int (*VAR_2)(FILE *VAR_3, const char *VAR_3, ...),
int VAR_4)
{
int VAR_5;
int VAR_6 = !!(VAR_0->hflags & MIPS_HFLAG_F64);
#define printfpr(fp) \
do { \
if (VAR_6) \
VAR_2(VAR_3, "w:%08x d:%016" PRIx64 \
" fd:%13g fs:%13g psu: %13g\n", \
(fp)->w[FP_ENDIAN_IDX], (fp)->d, \
(double)(fp)->fd, \
(double)(fp)->fs[FP_ENDIAN_IDX], \
(double)(fp)->fs[!FP_ENDIAN_IDX]); \
else { \
fpr_t tmp; \
tmp.w[FP_ENDIAN_IDX] = (fp)->w[FP_ENDIAN_IDX]; \
tmp.w[!FP_ENDIAN_IDX] = ((fp) + 1)->w[FP_ENDIAN_IDX]; \
VAR_2(VAR_3, "w:%08x d:%016" PRIx64 \
" fd:%13g fs:%13g psu:%13g\n", \
tmp.w[FP_ENDIAN_IDX], tmp.d, \
(double)tmp.fd, \
(double)tmp.fs[FP_ENDIAN_IDX], \
(double)tmp.fs[!FP_ENDIAN_IDX]); \
} \
} while(0)
VAR_2(VAR_3, "CP1 FCR0 0x%08x FCR31 0x%08x SR.FR %d fp_status 0x%08x(0x%02x)\n",
VAR_0->active_fpu.fcr0, VAR_0->active_fpu.fcr31, VAR_6, VAR_0->active_fpu.fp_status,
get_float_exception_flags(&VAR_0->active_fpu.fp_status));
for (VAR_5 = 0; VAR_5 < 32; (VAR_6) ? VAR_5++ : (VAR_5 += 2)) {
VAR_2(VAR_3, "%3s: ", fregnames[VAR_5]);
printfpr(&VAR_0->active_fpu.fpr[VAR_5]);
}
#undef printfpr
}
|
[
"static void FUNC_0(CPUState *VAR_0, FILE *VAR_3,\nint (*VAR_2)(FILE *VAR_3, const char *VAR_3, ...),\nint VAR_4)\n{",
"int VAR_5;",
"int VAR_6 = !!(VAR_0->hflags & MIPS_HFLAG_F64);",
"#define printfpr(fp) \\\ndo { \\",
"if (VAR_6) \\\nVAR_2(VAR_3, \"w:%08x d:%016\" PRIx64 \\\n\" fd:%13g fs:%13g psu: %13g\\n\", \\\n(fp)->w[FP_ENDIAN_IDX], (fp)->d, \\\n(double)(fp)->fd, \\\n(double)(fp)->fs[FP_ENDIAN_IDX], \\\n(double)(fp)->fs[!FP_ENDIAN_IDX]); \\",
"else { \\",
"fpr_t tmp; \\",
"tmp.w[FP_ENDIAN_IDX] = (fp)->w[FP_ENDIAN_IDX]; \\",
"tmp.w[!FP_ENDIAN_IDX] = ((fp) + 1)->w[FP_ENDIAN_IDX]; \\",
"VAR_2(VAR_3, \"w:%08x d:%016\" PRIx64 \\\n\" fd:%13g fs:%13g psu:%13g\\n\", \\\ntmp.w[FP_ENDIAN_IDX], tmp.d, \\\n(double)tmp.fd, \\\n(double)tmp.fs[FP_ENDIAN_IDX], \\\n(double)tmp.fs[!FP_ENDIAN_IDX]); \\",
"} \\",
"} while(0)",
"VAR_2(VAR_3, \"CP1 FCR0 0x%08x FCR31 0x%08x SR.FR %d fp_status 0x%08x(0x%02x)\\n\",\nVAR_0->active_fpu.fcr0, VAR_0->active_fpu.fcr31, VAR_6, VAR_0->active_fpu.fp_status,\nget_float_exception_flags(&VAR_0->active_fpu.fp_status));",
"for (VAR_5 = 0; VAR_5 < 32; (VAR_6) ? VAR_5++ : (VAR_5 += 2)) {",
"VAR_2(VAR_3, \"%3s: \", fregnames[VAR_5]);",
"printfpr(&VAR_0->active_fpu.fpr[VAR_5]);",
"}",
"#undef printfpr\n}"
] |
[
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
],
[
61,
63,
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
77,
79
]
] |
9,671 |
static void qxl_hw_screen_dump(void *opaque, const char *filename, bool cswitch,
Error **errp)
{
PCIQXLDevice *qxl = opaque;
VGACommonState *vga = &qxl->vga;
switch (qxl->mode) {
case QXL_MODE_COMPAT:
case QXL_MODE_NATIVE:
qxl_render_update(qxl);
ppm_save(filename, qxl->ssd.ds, errp);
break;
case QXL_MODE_VGA:
vga->screen_dump(vga, filename, cswitch, errp);
break;
default:
break;
}
}
| false |
qemu
|
2c62f08ddbf3fa80dc7202eb9a2ea60ae44e2cc5
|
static void qxl_hw_screen_dump(void *opaque, const char *filename, bool cswitch,
Error **errp)
{
PCIQXLDevice *qxl = opaque;
VGACommonState *vga = &qxl->vga;
switch (qxl->mode) {
case QXL_MODE_COMPAT:
case QXL_MODE_NATIVE:
qxl_render_update(qxl);
ppm_save(filename, qxl->ssd.ds, errp);
break;
case QXL_MODE_VGA:
vga->screen_dump(vga, filename, cswitch, errp);
break;
default:
break;
}
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(void *VAR_0, const char *VAR_1, bool VAR_2,
Error **VAR_3)
{
PCIQXLDevice *qxl = VAR_0;
VGACommonState *vga = &qxl->vga;
switch (qxl->mode) {
case QXL_MODE_COMPAT:
case QXL_MODE_NATIVE:
qxl_render_update(qxl);
ppm_save(VAR_1, qxl->ssd.ds, VAR_3);
break;
case QXL_MODE_VGA:
vga->screen_dump(vga, VAR_1, VAR_2, VAR_3);
break;
default:
break;
}
}
|
[
"static void FUNC_0(void *VAR_0, const char *VAR_1, bool VAR_2,\nError **VAR_3)\n{",
"PCIQXLDevice *qxl = VAR_0;",
"VGACommonState *vga = &qxl->vga;",
"switch (qxl->mode) {",
"case QXL_MODE_COMPAT:\ncase QXL_MODE_NATIVE:\nqxl_render_update(qxl);",
"ppm_save(VAR_1, qxl->ssd.ds, VAR_3);",
"break;",
"case QXL_MODE_VGA:\nvga->screen_dump(vga, VAR_1, VAR_2, VAR_3);",
"break;",
"default:\nbreak;",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
13
],
[
15,
17,
19
],
[
21
],
[
23
],
[
25,
27
],
[
29
],
[
31,
33
],
[
35
],
[
37
]
] |
9,672 |
void qmp_input_send_event(int64_t console, InputEventList *events,
Error **errp)
{
InputEventList *e;
QemuConsole *con;
con = qemu_console_lookup_by_index(console);
if (!con) {
error_setg(errp, "console %" PRId64 " not found", console);
return;
}
if (!runstate_is_running() && !runstate_check(RUN_STATE_SUSPENDED)) {
error_setg(errp, "VM not running");
return;
}
for (e = events; e != NULL; e = e->next) {
InputEvent *event = e->value;
if (!qemu_input_find_handler(1 << event->kind, con)) {
error_setg(errp, "Input handler not found for "
"event type %s",
InputEventKind_lookup[event->kind]);
return;
}
}
for (e = events; e != NULL; e = e->next) {
InputEvent *event = e->value;
qemu_input_event_send(con, event);
}
qemu_input_event_sync();
}
| false |
qemu
|
51fc44768a5b71ad78fa40e609a58f71ed62775a
|
void qmp_input_send_event(int64_t console, InputEventList *events,
Error **errp)
{
InputEventList *e;
QemuConsole *con;
con = qemu_console_lookup_by_index(console);
if (!con) {
error_setg(errp, "console %" PRId64 " not found", console);
return;
}
if (!runstate_is_running() && !runstate_check(RUN_STATE_SUSPENDED)) {
error_setg(errp, "VM not running");
return;
}
for (e = events; e != NULL; e = e->next) {
InputEvent *event = e->value;
if (!qemu_input_find_handler(1 << event->kind, con)) {
error_setg(errp, "Input handler not found for "
"event type %s",
InputEventKind_lookup[event->kind]);
return;
}
}
for (e = events; e != NULL; e = e->next) {
InputEvent *event = e->value;
qemu_input_event_send(con, event);
}
qemu_input_event_sync();
}
|
{
"code": [],
"line_no": []
}
|
void FUNC_0(int64_t VAR_0, InputEventList *VAR_1,
Error **VAR_2)
{
InputEventList *e;
QemuConsole *con;
con = qemu_console_lookup_by_index(VAR_0);
if (!con) {
error_setg(VAR_2, "VAR_0 %" PRId64 " not found", VAR_0);
return;
}
if (!runstate_is_running() && !runstate_check(RUN_STATE_SUSPENDED)) {
error_setg(VAR_2, "VM not running");
return;
}
for (e = VAR_1; e != NULL; e = e->next) {
InputEvent *event = e->value;
if (!qemu_input_find_handler(1 << event->kind, con)) {
error_setg(VAR_2, "Input handler not found for "
"event type %s",
InputEventKind_lookup[event->kind]);
return;
}
}
for (e = VAR_1; e != NULL; e = e->next) {
InputEvent *event = e->value;
qemu_input_event_send(con, event);
}
qemu_input_event_sync();
}
|
[
"void FUNC_0(int64_t VAR_0, InputEventList *VAR_1,\nError **VAR_2)\n{",
"InputEventList *e;",
"QemuConsole *con;",
"con = qemu_console_lookup_by_index(VAR_0);",
"if (!con) {",
"error_setg(VAR_2, \"VAR_0 %\" PRId64 \" not found\", VAR_0);",
"return;",
"}",
"if (!runstate_is_running() && !runstate_check(RUN_STATE_SUSPENDED)) {",
"error_setg(VAR_2, \"VM not running\");",
"return;",
"}",
"for (e = VAR_1; e != NULL; e = e->next) {",
"InputEvent *event = e->value;",
"if (!qemu_input_find_handler(1 << event->kind, con)) {",
"error_setg(VAR_2, \"Input handler not found for \"\n\"event type %s\",\nInputEventKind_lookup[event->kind]);",
"return;",
"}",
"}",
"for (e = VAR_1; e != NULL; e = e->next) {",
"InputEvent *event = e->value;",
"qemu_input_event_send(con, event);",
"}",
"qemu_input_event_sync();",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
25
],
[
27
],
[
29
],
[
31
],
[
35
],
[
37
],
[
41
],
[
43,
45,
47
],
[
49
],
[
51
],
[
53
],
[
57
],
[
59
],
[
63
],
[
65
],
[
69
],
[
71
]
] |
9,673 |
static av_cold int cuvid_decode_init(AVCodecContext *avctx)
{
CuvidContext *ctx = avctx->priv_data;
AVCUDADeviceContext *device_hwctx;
AVHWDeviceContext *device_ctx;
AVHWFramesContext *hwframe_ctx;
CUVIDSOURCEDATAPACKET seq_pkt;
CUcontext cuda_ctx = NULL;
CUcontext dummy;
const AVBitStreamFilter *bsf;
int ret = 0;
enum AVPixelFormat pix_fmts[3] = { AV_PIX_FMT_CUDA,
AV_PIX_FMT_NV12,
AV_PIX_FMT_NONE };
int probed_width = avctx->coded_width ? avctx->coded_width : 1280;
int probed_height = avctx->coded_height ? avctx->coded_height : 720;
// Accelerated transcoding scenarios with 'ffmpeg' require that the
// pix_fmt be set to AV_PIX_FMT_CUDA early. The sw_pix_fmt, and the
// pix_fmt for non-accelerated transcoding, do not need to be correct
// but need to be set to something. We arbitrarily pick NV12.
ret = ff_get_format(avctx, pix_fmts);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "ff_get_format failed: %d\n", ret);
return ret;
}
avctx->pix_fmt = ret;
if (ctx->resize_expr && sscanf(ctx->resize_expr, "%dx%d",
&ctx->resize.width, &ctx->resize.height) != 2) {
av_log(avctx, AV_LOG_ERROR, "Invalid resize expressions\n");
ret = AVERROR(EINVAL);
goto error;
}
if (ctx->crop_expr && sscanf(ctx->crop_expr, "%dx%dx%dx%d",
&ctx->crop.top, &ctx->crop.bottom,
&ctx->crop.left, &ctx->crop.right) != 4) {
av_log(avctx, AV_LOG_ERROR, "Invalid cropping expressions\n");
ret = AVERROR(EINVAL);
goto error;
}
ret = cuvid_load_functions(&ctx->cvdl);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "Failed loading nvcuvid.\n");
goto error;
}
ctx->frame_queue = av_fifo_alloc(ctx->nb_surfaces * sizeof(CuvidParsedFrame));
if (!ctx->frame_queue) {
ret = AVERROR(ENOMEM);
goto error;
}
if (avctx->hw_frames_ctx) {
ctx->hwframe = av_buffer_ref(avctx->hw_frames_ctx);
if (!ctx->hwframe) {
ret = AVERROR(ENOMEM);
goto error;
}
hwframe_ctx = (AVHWFramesContext*)ctx->hwframe->data;
ctx->hwdevice = av_buffer_ref(hwframe_ctx->device_ref);
if (!ctx->hwdevice) {
ret = AVERROR(ENOMEM);
goto error;
}
} else {
if (avctx->hw_device_ctx) {
ctx->hwdevice = av_buffer_ref(avctx->hw_device_ctx);
if (!ctx->hwdevice) {
ret = AVERROR(ENOMEM);
goto error;
}
} else {
ret = av_hwdevice_ctx_create(&ctx->hwdevice, AV_HWDEVICE_TYPE_CUDA, ctx->cu_gpu, NULL, 0);
if (ret < 0)
goto error;
}
ctx->hwframe = av_hwframe_ctx_alloc(ctx->hwdevice);
if (!ctx->hwframe) {
av_log(avctx, AV_LOG_ERROR, "av_hwframe_ctx_alloc failed\n");
ret = AVERROR(ENOMEM);
goto error;
}
hwframe_ctx = (AVHWFramesContext*)ctx->hwframe->data;
}
device_ctx = hwframe_ctx->device_ctx;
device_hwctx = device_ctx->hwctx;
cuda_ctx = device_hwctx->cuda_ctx;
ctx->cudl = device_hwctx->internal->cuda_dl;
memset(&ctx->cuparseinfo, 0, sizeof(ctx->cuparseinfo));
memset(&ctx->cuparse_ext, 0, sizeof(ctx->cuparse_ext));
memset(&seq_pkt, 0, sizeof(seq_pkt));
ctx->cuparseinfo.pExtVideoInfo = &ctx->cuparse_ext;
switch (avctx->codec->id) {
#if CONFIG_H264_CUVID_DECODER
case AV_CODEC_ID_H264:
ctx->cuparseinfo.CodecType = cudaVideoCodec_H264;
break;
#endif
#if CONFIG_HEVC_CUVID_DECODER
case AV_CODEC_ID_HEVC:
ctx->cuparseinfo.CodecType = cudaVideoCodec_HEVC;
break;
#endif
#if CONFIG_MJPEG_CUVID_DECODER
case AV_CODEC_ID_MJPEG:
ctx->cuparseinfo.CodecType = cudaVideoCodec_JPEG;
break;
#endif
#if CONFIG_MPEG1_CUVID_DECODER
case AV_CODEC_ID_MPEG1VIDEO:
ctx->cuparseinfo.CodecType = cudaVideoCodec_MPEG1;
break;
#endif
#if CONFIG_MPEG2_CUVID_DECODER
case AV_CODEC_ID_MPEG2VIDEO:
ctx->cuparseinfo.CodecType = cudaVideoCodec_MPEG2;
break;
#endif
#if CONFIG_MPEG4_CUVID_DECODER
case AV_CODEC_ID_MPEG4:
ctx->cuparseinfo.CodecType = cudaVideoCodec_MPEG4;
break;
#endif
#if CONFIG_VP8_CUVID_DECODER
case AV_CODEC_ID_VP8:
ctx->cuparseinfo.CodecType = cudaVideoCodec_VP8;
break;
#endif
#if CONFIG_VP9_CUVID_DECODER
case AV_CODEC_ID_VP9:
ctx->cuparseinfo.CodecType = cudaVideoCodec_VP9;
break;
#endif
#if CONFIG_VC1_CUVID_DECODER
case AV_CODEC_ID_VC1:
ctx->cuparseinfo.CodecType = cudaVideoCodec_VC1;
break;
#endif
default:
av_log(avctx, AV_LOG_ERROR, "Invalid CUVID codec!\n");
return AVERROR_BUG;
}
if (avctx->codec->id == AV_CODEC_ID_H264 || avctx->codec->id == AV_CODEC_ID_HEVC) {
if (avctx->codec->id == AV_CODEC_ID_H264)
bsf = av_bsf_get_by_name("h264_mp4toannexb");
else
bsf = av_bsf_get_by_name("hevc_mp4toannexb");
if (!bsf) {
ret = AVERROR_BSF_NOT_FOUND;
goto error;
}
if (ret = av_bsf_alloc(bsf, &ctx->bsf)) {
goto error;
}
if (((ret = avcodec_parameters_from_context(ctx->bsf->par_in, avctx)) < 0) || ((ret = av_bsf_init(ctx->bsf)) < 0)) {
av_bsf_free(&ctx->bsf);
goto error;
}
ctx->cuparse_ext.format.seqhdr_data_length = ctx->bsf->par_out->extradata_size;
memcpy(ctx->cuparse_ext.raw_seqhdr_data,
ctx->bsf->par_out->extradata,
FFMIN(sizeof(ctx->cuparse_ext.raw_seqhdr_data), ctx->bsf->par_out->extradata_size));
} else if (avctx->extradata_size > 0) {
ctx->cuparse_ext.format.seqhdr_data_length = avctx->extradata_size;
memcpy(ctx->cuparse_ext.raw_seqhdr_data,
avctx->extradata,
FFMIN(sizeof(ctx->cuparse_ext.raw_seqhdr_data), avctx->extradata_size));
}
ctx->cuparseinfo.ulMaxNumDecodeSurfaces = ctx->nb_surfaces;
ctx->cuparseinfo.ulMaxDisplayDelay = 4;
ctx->cuparseinfo.pUserData = avctx;
ctx->cuparseinfo.pfnSequenceCallback = cuvid_handle_video_sequence;
ctx->cuparseinfo.pfnDecodePicture = cuvid_handle_picture_decode;
ctx->cuparseinfo.pfnDisplayPicture = cuvid_handle_picture_display;
ret = CHECK_CU(ctx->cudl->cuCtxPushCurrent(cuda_ctx));
if (ret < 0)
goto error;
ret = cuvid_test_dummy_decoder(avctx, &ctx->cuparseinfo,
probed_width,
probed_height);
if (ret < 0)
goto error;
ret = CHECK_CU(ctx->cvdl->cuvidCreateVideoParser(&ctx->cuparser, &ctx->cuparseinfo));
if (ret < 0)
goto error;
seq_pkt.payload = ctx->cuparse_ext.raw_seqhdr_data;
seq_pkt.payload_size = ctx->cuparse_ext.format.seqhdr_data_length;
if (seq_pkt.payload && seq_pkt.payload_size) {
ret = CHECK_CU(ctx->cvdl->cuvidParseVideoData(ctx->cuparser, &seq_pkt));
if (ret < 0)
goto error;
}
ret = CHECK_CU(ctx->cudl->cuCtxPopCurrent(&dummy));
if (ret < 0)
goto error;
ctx->prev_pts = INT64_MIN;
if (!avctx->pkt_timebase.num || !avctx->pkt_timebase.den)
av_log(avctx, AV_LOG_WARNING, "Invalid pkt_timebase, passing timestamps as-is.\n");
return 0;
error:
cuvid_decode_end(avctx);
return ret;
}
| false |
FFmpeg
|
fea471347218be0b8d1313b8f14ea9512e555d76
|
static av_cold int cuvid_decode_init(AVCodecContext *avctx)
{
CuvidContext *ctx = avctx->priv_data;
AVCUDADeviceContext *device_hwctx;
AVHWDeviceContext *device_ctx;
AVHWFramesContext *hwframe_ctx;
CUVIDSOURCEDATAPACKET seq_pkt;
CUcontext cuda_ctx = NULL;
CUcontext dummy;
const AVBitStreamFilter *bsf;
int ret = 0;
enum AVPixelFormat pix_fmts[3] = { AV_PIX_FMT_CUDA,
AV_PIX_FMT_NV12,
AV_PIX_FMT_NONE };
int probed_width = avctx->coded_width ? avctx->coded_width : 1280;
int probed_height = avctx->coded_height ? avctx->coded_height : 720;
ret = ff_get_format(avctx, pix_fmts);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "ff_get_format failed: %d\n", ret);
return ret;
}
avctx->pix_fmt = ret;
if (ctx->resize_expr && sscanf(ctx->resize_expr, "%dx%d",
&ctx->resize.width, &ctx->resize.height) != 2) {
av_log(avctx, AV_LOG_ERROR, "Invalid resize expressions\n");
ret = AVERROR(EINVAL);
goto error;
}
if (ctx->crop_expr && sscanf(ctx->crop_expr, "%dx%dx%dx%d",
&ctx->crop.top, &ctx->crop.bottom,
&ctx->crop.left, &ctx->crop.right) != 4) {
av_log(avctx, AV_LOG_ERROR, "Invalid cropping expressions\n");
ret = AVERROR(EINVAL);
goto error;
}
ret = cuvid_load_functions(&ctx->cvdl);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "Failed loading nvcuvid.\n");
goto error;
}
ctx->frame_queue = av_fifo_alloc(ctx->nb_surfaces * sizeof(CuvidParsedFrame));
if (!ctx->frame_queue) {
ret = AVERROR(ENOMEM);
goto error;
}
if (avctx->hw_frames_ctx) {
ctx->hwframe = av_buffer_ref(avctx->hw_frames_ctx);
if (!ctx->hwframe) {
ret = AVERROR(ENOMEM);
goto error;
}
hwframe_ctx = (AVHWFramesContext*)ctx->hwframe->data;
ctx->hwdevice = av_buffer_ref(hwframe_ctx->device_ref);
if (!ctx->hwdevice) {
ret = AVERROR(ENOMEM);
goto error;
}
} else {
if (avctx->hw_device_ctx) {
ctx->hwdevice = av_buffer_ref(avctx->hw_device_ctx);
if (!ctx->hwdevice) {
ret = AVERROR(ENOMEM);
goto error;
}
} else {
ret = av_hwdevice_ctx_create(&ctx->hwdevice, AV_HWDEVICE_TYPE_CUDA, ctx->cu_gpu, NULL, 0);
if (ret < 0)
goto error;
}
ctx->hwframe = av_hwframe_ctx_alloc(ctx->hwdevice);
if (!ctx->hwframe) {
av_log(avctx, AV_LOG_ERROR, "av_hwframe_ctx_alloc failed\n");
ret = AVERROR(ENOMEM);
goto error;
}
hwframe_ctx = (AVHWFramesContext*)ctx->hwframe->data;
}
device_ctx = hwframe_ctx->device_ctx;
device_hwctx = device_ctx->hwctx;
cuda_ctx = device_hwctx->cuda_ctx;
ctx->cudl = device_hwctx->internal->cuda_dl;
memset(&ctx->cuparseinfo, 0, sizeof(ctx->cuparseinfo));
memset(&ctx->cuparse_ext, 0, sizeof(ctx->cuparse_ext));
memset(&seq_pkt, 0, sizeof(seq_pkt));
ctx->cuparseinfo.pExtVideoInfo = &ctx->cuparse_ext;
switch (avctx->codec->id) {
#if CONFIG_H264_CUVID_DECODER
case AV_CODEC_ID_H264:
ctx->cuparseinfo.CodecType = cudaVideoCodec_H264;
break;
#endif
#if CONFIG_HEVC_CUVID_DECODER
case AV_CODEC_ID_HEVC:
ctx->cuparseinfo.CodecType = cudaVideoCodec_HEVC;
break;
#endif
#if CONFIG_MJPEG_CUVID_DECODER
case AV_CODEC_ID_MJPEG:
ctx->cuparseinfo.CodecType = cudaVideoCodec_JPEG;
break;
#endif
#if CONFIG_MPEG1_CUVID_DECODER
case AV_CODEC_ID_MPEG1VIDEO:
ctx->cuparseinfo.CodecType = cudaVideoCodec_MPEG1;
break;
#endif
#if CONFIG_MPEG2_CUVID_DECODER
case AV_CODEC_ID_MPEG2VIDEO:
ctx->cuparseinfo.CodecType = cudaVideoCodec_MPEG2;
break;
#endif
#if CONFIG_MPEG4_CUVID_DECODER
case AV_CODEC_ID_MPEG4:
ctx->cuparseinfo.CodecType = cudaVideoCodec_MPEG4;
break;
#endif
#if CONFIG_VP8_CUVID_DECODER
case AV_CODEC_ID_VP8:
ctx->cuparseinfo.CodecType = cudaVideoCodec_VP8;
break;
#endif
#if CONFIG_VP9_CUVID_DECODER
case AV_CODEC_ID_VP9:
ctx->cuparseinfo.CodecType = cudaVideoCodec_VP9;
break;
#endif
#if CONFIG_VC1_CUVID_DECODER
case AV_CODEC_ID_VC1:
ctx->cuparseinfo.CodecType = cudaVideoCodec_VC1;
break;
#endif
default:
av_log(avctx, AV_LOG_ERROR, "Invalid CUVID codec!\n");
return AVERROR_BUG;
}
if (avctx->codec->id == AV_CODEC_ID_H264 || avctx->codec->id == AV_CODEC_ID_HEVC) {
if (avctx->codec->id == AV_CODEC_ID_H264)
bsf = av_bsf_get_by_name("h264_mp4toannexb");
else
bsf = av_bsf_get_by_name("hevc_mp4toannexb");
if (!bsf) {
ret = AVERROR_BSF_NOT_FOUND;
goto error;
}
if (ret = av_bsf_alloc(bsf, &ctx->bsf)) {
goto error;
}
if (((ret = avcodec_parameters_from_context(ctx->bsf->par_in, avctx)) < 0) || ((ret = av_bsf_init(ctx->bsf)) < 0)) {
av_bsf_free(&ctx->bsf);
goto error;
}
ctx->cuparse_ext.format.seqhdr_data_length = ctx->bsf->par_out->extradata_size;
memcpy(ctx->cuparse_ext.raw_seqhdr_data,
ctx->bsf->par_out->extradata,
FFMIN(sizeof(ctx->cuparse_ext.raw_seqhdr_data), ctx->bsf->par_out->extradata_size));
} else if (avctx->extradata_size > 0) {
ctx->cuparse_ext.format.seqhdr_data_length = avctx->extradata_size;
memcpy(ctx->cuparse_ext.raw_seqhdr_data,
avctx->extradata,
FFMIN(sizeof(ctx->cuparse_ext.raw_seqhdr_data), avctx->extradata_size));
}
ctx->cuparseinfo.ulMaxNumDecodeSurfaces = ctx->nb_surfaces;
ctx->cuparseinfo.ulMaxDisplayDelay = 4;
ctx->cuparseinfo.pUserData = avctx;
ctx->cuparseinfo.pfnSequenceCallback = cuvid_handle_video_sequence;
ctx->cuparseinfo.pfnDecodePicture = cuvid_handle_picture_decode;
ctx->cuparseinfo.pfnDisplayPicture = cuvid_handle_picture_display;
ret = CHECK_CU(ctx->cudl->cuCtxPushCurrent(cuda_ctx));
if (ret < 0)
goto error;
ret = cuvid_test_dummy_decoder(avctx, &ctx->cuparseinfo,
probed_width,
probed_height);
if (ret < 0)
goto error;
ret = CHECK_CU(ctx->cvdl->cuvidCreateVideoParser(&ctx->cuparser, &ctx->cuparseinfo));
if (ret < 0)
goto error;
seq_pkt.payload = ctx->cuparse_ext.raw_seqhdr_data;
seq_pkt.payload_size = ctx->cuparse_ext.format.seqhdr_data_length;
if (seq_pkt.payload && seq_pkt.payload_size) {
ret = CHECK_CU(ctx->cvdl->cuvidParseVideoData(ctx->cuparser, &seq_pkt));
if (ret < 0)
goto error;
}
ret = CHECK_CU(ctx->cudl->cuCtxPopCurrent(&dummy));
if (ret < 0)
goto error;
ctx->prev_pts = INT64_MIN;
if (!avctx->pkt_timebase.num || !avctx->pkt_timebase.den)
av_log(avctx, AV_LOG_WARNING, "Invalid pkt_timebase, passing timestamps as-is.\n");
return 0;
error:
cuvid_decode_end(avctx);
return ret;
}
|
{
"code": [],
"line_no": []
}
|
static av_cold int FUNC_0(AVCodecContext *avctx)
{
CuvidContext *ctx = avctx->priv_data;
AVCUDADeviceContext *device_hwctx;
AVHWDeviceContext *device_ctx;
AVHWFramesContext *hwframe_ctx;
CUVIDSOURCEDATAPACKET seq_pkt;
CUcontext cuda_ctx = NULL;
CUcontext dummy;
const AVBitStreamFilter *VAR_0;
int VAR_1 = 0;
enum AVPixelFormat VAR_2[3] = { AV_PIX_FMT_CUDA,
AV_PIX_FMT_NV12,
AV_PIX_FMT_NONE };
int VAR_3 = avctx->coded_width ? avctx->coded_width : 1280;
int VAR_4 = avctx->coded_height ? avctx->coded_height : 720;
VAR_1 = ff_get_format(avctx, VAR_2);
if (VAR_1 < 0) {
av_log(avctx, AV_LOG_ERROR, "ff_get_format failed: %d\n", VAR_1);
return VAR_1;
}
avctx->pix_fmt = VAR_1;
if (ctx->resize_expr && sscanf(ctx->resize_expr, "%dx%d",
&ctx->resize.width, &ctx->resize.height) != 2) {
av_log(avctx, AV_LOG_ERROR, "Invalid resize expressions\n");
VAR_1 = AVERROR(EINVAL);
goto error;
}
if (ctx->crop_expr && sscanf(ctx->crop_expr, "%dx%dx%dx%d",
&ctx->crop.top, &ctx->crop.bottom,
&ctx->crop.left, &ctx->crop.right) != 4) {
av_log(avctx, AV_LOG_ERROR, "Invalid cropping expressions\n");
VAR_1 = AVERROR(EINVAL);
goto error;
}
VAR_1 = cuvid_load_functions(&ctx->cvdl);
if (VAR_1 < 0) {
av_log(avctx, AV_LOG_ERROR, "Failed loading nvcuvid.\n");
goto error;
}
ctx->frame_queue = av_fifo_alloc(ctx->nb_surfaces * sizeof(CuvidParsedFrame));
if (!ctx->frame_queue) {
VAR_1 = AVERROR(ENOMEM);
goto error;
}
if (avctx->hw_frames_ctx) {
ctx->hwframe = av_buffer_ref(avctx->hw_frames_ctx);
if (!ctx->hwframe) {
VAR_1 = AVERROR(ENOMEM);
goto error;
}
hwframe_ctx = (AVHWFramesContext*)ctx->hwframe->data;
ctx->hwdevice = av_buffer_ref(hwframe_ctx->device_ref);
if (!ctx->hwdevice) {
VAR_1 = AVERROR(ENOMEM);
goto error;
}
} else {
if (avctx->hw_device_ctx) {
ctx->hwdevice = av_buffer_ref(avctx->hw_device_ctx);
if (!ctx->hwdevice) {
VAR_1 = AVERROR(ENOMEM);
goto error;
}
} else {
VAR_1 = av_hwdevice_ctx_create(&ctx->hwdevice, AV_HWDEVICE_TYPE_CUDA, ctx->cu_gpu, NULL, 0);
if (VAR_1 < 0)
goto error;
}
ctx->hwframe = av_hwframe_ctx_alloc(ctx->hwdevice);
if (!ctx->hwframe) {
av_log(avctx, AV_LOG_ERROR, "av_hwframe_ctx_alloc failed\n");
VAR_1 = AVERROR(ENOMEM);
goto error;
}
hwframe_ctx = (AVHWFramesContext*)ctx->hwframe->data;
}
device_ctx = hwframe_ctx->device_ctx;
device_hwctx = device_ctx->hwctx;
cuda_ctx = device_hwctx->cuda_ctx;
ctx->cudl = device_hwctx->internal->cuda_dl;
memset(&ctx->cuparseinfo, 0, sizeof(ctx->cuparseinfo));
memset(&ctx->cuparse_ext, 0, sizeof(ctx->cuparse_ext));
memset(&seq_pkt, 0, sizeof(seq_pkt));
ctx->cuparseinfo.pExtVideoInfo = &ctx->cuparse_ext;
switch (avctx->codec->id) {
#if CONFIG_H264_CUVID_DECODER
case AV_CODEC_ID_H264:
ctx->cuparseinfo.CodecType = cudaVideoCodec_H264;
break;
#endif
#if CONFIG_HEVC_CUVID_DECODER
case AV_CODEC_ID_HEVC:
ctx->cuparseinfo.CodecType = cudaVideoCodec_HEVC;
break;
#endif
#if CONFIG_MJPEG_CUVID_DECODER
case AV_CODEC_ID_MJPEG:
ctx->cuparseinfo.CodecType = cudaVideoCodec_JPEG;
break;
#endif
#if CONFIG_MPEG1_CUVID_DECODER
case AV_CODEC_ID_MPEG1VIDEO:
ctx->cuparseinfo.CodecType = cudaVideoCodec_MPEG1;
break;
#endif
#if CONFIG_MPEG2_CUVID_DECODER
case AV_CODEC_ID_MPEG2VIDEO:
ctx->cuparseinfo.CodecType = cudaVideoCodec_MPEG2;
break;
#endif
#if CONFIG_MPEG4_CUVID_DECODER
case AV_CODEC_ID_MPEG4:
ctx->cuparseinfo.CodecType = cudaVideoCodec_MPEG4;
break;
#endif
#if CONFIG_VP8_CUVID_DECODER
case AV_CODEC_ID_VP8:
ctx->cuparseinfo.CodecType = cudaVideoCodec_VP8;
break;
#endif
#if CONFIG_VP9_CUVID_DECODER
case AV_CODEC_ID_VP9:
ctx->cuparseinfo.CodecType = cudaVideoCodec_VP9;
break;
#endif
#if CONFIG_VC1_CUVID_DECODER
case AV_CODEC_ID_VC1:
ctx->cuparseinfo.CodecType = cudaVideoCodec_VC1;
break;
#endif
default:
av_log(avctx, AV_LOG_ERROR, "Invalid CUVID codec!\n");
return AVERROR_BUG;
}
if (avctx->codec->id == AV_CODEC_ID_H264 || avctx->codec->id == AV_CODEC_ID_HEVC) {
if (avctx->codec->id == AV_CODEC_ID_H264)
VAR_0 = av_bsf_get_by_name("h264_mp4toannexb");
else
VAR_0 = av_bsf_get_by_name("hevc_mp4toannexb");
if (!VAR_0) {
VAR_1 = AVERROR_BSF_NOT_FOUND;
goto error;
}
if (VAR_1 = av_bsf_alloc(VAR_0, &ctx->VAR_0)) {
goto error;
}
if (((VAR_1 = avcodec_parameters_from_context(ctx->VAR_0->par_in, avctx)) < 0) || ((VAR_1 = av_bsf_init(ctx->VAR_0)) < 0)) {
av_bsf_free(&ctx->VAR_0);
goto error;
}
ctx->cuparse_ext.format.seqhdr_data_length = ctx->VAR_0->par_out->extradata_size;
memcpy(ctx->cuparse_ext.raw_seqhdr_data,
ctx->VAR_0->par_out->extradata,
FFMIN(sizeof(ctx->cuparse_ext.raw_seqhdr_data), ctx->VAR_0->par_out->extradata_size));
} else if (avctx->extradata_size > 0) {
ctx->cuparse_ext.format.seqhdr_data_length = avctx->extradata_size;
memcpy(ctx->cuparse_ext.raw_seqhdr_data,
avctx->extradata,
FFMIN(sizeof(ctx->cuparse_ext.raw_seqhdr_data), avctx->extradata_size));
}
ctx->cuparseinfo.ulMaxNumDecodeSurfaces = ctx->nb_surfaces;
ctx->cuparseinfo.ulMaxDisplayDelay = 4;
ctx->cuparseinfo.pUserData = avctx;
ctx->cuparseinfo.pfnSequenceCallback = cuvid_handle_video_sequence;
ctx->cuparseinfo.pfnDecodePicture = cuvid_handle_picture_decode;
ctx->cuparseinfo.pfnDisplayPicture = cuvid_handle_picture_display;
VAR_1 = CHECK_CU(ctx->cudl->cuCtxPushCurrent(cuda_ctx));
if (VAR_1 < 0)
goto error;
VAR_1 = cuvid_test_dummy_decoder(avctx, &ctx->cuparseinfo,
VAR_3,
VAR_4);
if (VAR_1 < 0)
goto error;
VAR_1 = CHECK_CU(ctx->cvdl->cuvidCreateVideoParser(&ctx->cuparser, &ctx->cuparseinfo));
if (VAR_1 < 0)
goto error;
seq_pkt.payload = ctx->cuparse_ext.raw_seqhdr_data;
seq_pkt.payload_size = ctx->cuparse_ext.format.seqhdr_data_length;
if (seq_pkt.payload && seq_pkt.payload_size) {
VAR_1 = CHECK_CU(ctx->cvdl->cuvidParseVideoData(ctx->cuparser, &seq_pkt));
if (VAR_1 < 0)
goto error;
}
VAR_1 = CHECK_CU(ctx->cudl->cuCtxPopCurrent(&dummy));
if (VAR_1 < 0)
goto error;
ctx->prev_pts = INT64_MIN;
if (!avctx->pkt_timebase.num || !avctx->pkt_timebase.den)
av_log(avctx, AV_LOG_WARNING, "Invalid pkt_timebase, passing timestamps as-is.\n");
return 0;
error:
cuvid_decode_end(avctx);
return VAR_1;
}
|
[
"static av_cold int FUNC_0(AVCodecContext *avctx)\n{",
"CuvidContext *ctx = avctx->priv_data;",
"AVCUDADeviceContext *device_hwctx;",
"AVHWDeviceContext *device_ctx;",
"AVHWFramesContext *hwframe_ctx;",
"CUVIDSOURCEDATAPACKET seq_pkt;",
"CUcontext cuda_ctx = NULL;",
"CUcontext dummy;",
"const AVBitStreamFilter *VAR_0;",
"int VAR_1 = 0;",
"enum AVPixelFormat VAR_2[3] = { AV_PIX_FMT_CUDA,",
"AV_PIX_FMT_NV12,\nAV_PIX_FMT_NONE };",
"int VAR_3 = avctx->coded_width ? avctx->coded_width : 1280;",
"int VAR_4 = avctx->coded_height ? avctx->coded_height : 720;",
"VAR_1 = ff_get_format(avctx, VAR_2);",
"if (VAR_1 < 0) {",
"av_log(avctx, AV_LOG_ERROR, \"ff_get_format failed: %d\\n\", VAR_1);",
"return VAR_1;",
"}",
"avctx->pix_fmt = VAR_1;",
"if (ctx->resize_expr && sscanf(ctx->resize_expr, \"%dx%d\",\n&ctx->resize.width, &ctx->resize.height) != 2) {",
"av_log(avctx, AV_LOG_ERROR, \"Invalid resize expressions\\n\");",
"VAR_1 = AVERROR(EINVAL);",
"goto error;",
"}",
"if (ctx->crop_expr && sscanf(ctx->crop_expr, \"%dx%dx%dx%d\",\n&ctx->crop.top, &ctx->crop.bottom,\n&ctx->crop.left, &ctx->crop.right) != 4) {",
"av_log(avctx, AV_LOG_ERROR, \"Invalid cropping expressions\\n\");",
"VAR_1 = AVERROR(EINVAL);",
"goto error;",
"}",
"VAR_1 = cuvid_load_functions(&ctx->cvdl);",
"if (VAR_1 < 0) {",
"av_log(avctx, AV_LOG_ERROR, \"Failed loading nvcuvid.\\n\");",
"goto error;",
"}",
"ctx->frame_queue = av_fifo_alloc(ctx->nb_surfaces * sizeof(CuvidParsedFrame));",
"if (!ctx->frame_queue) {",
"VAR_1 = AVERROR(ENOMEM);",
"goto error;",
"}",
"if (avctx->hw_frames_ctx) {",
"ctx->hwframe = av_buffer_ref(avctx->hw_frames_ctx);",
"if (!ctx->hwframe) {",
"VAR_1 = AVERROR(ENOMEM);",
"goto error;",
"}",
"hwframe_ctx = (AVHWFramesContext*)ctx->hwframe->data;",
"ctx->hwdevice = av_buffer_ref(hwframe_ctx->device_ref);",
"if (!ctx->hwdevice) {",
"VAR_1 = AVERROR(ENOMEM);",
"goto error;",
"}",
"} else {",
"if (avctx->hw_device_ctx) {",
"ctx->hwdevice = av_buffer_ref(avctx->hw_device_ctx);",
"if (!ctx->hwdevice) {",
"VAR_1 = AVERROR(ENOMEM);",
"goto error;",
"}",
"} else {",
"VAR_1 = av_hwdevice_ctx_create(&ctx->hwdevice, AV_HWDEVICE_TYPE_CUDA, ctx->cu_gpu, NULL, 0);",
"if (VAR_1 < 0)\ngoto error;",
"}",
"ctx->hwframe = av_hwframe_ctx_alloc(ctx->hwdevice);",
"if (!ctx->hwframe) {",
"av_log(avctx, AV_LOG_ERROR, \"av_hwframe_ctx_alloc failed\\n\");",
"VAR_1 = AVERROR(ENOMEM);",
"goto error;",
"}",
"hwframe_ctx = (AVHWFramesContext*)ctx->hwframe->data;",
"}",
"device_ctx = hwframe_ctx->device_ctx;",
"device_hwctx = device_ctx->hwctx;",
"cuda_ctx = device_hwctx->cuda_ctx;",
"ctx->cudl = device_hwctx->internal->cuda_dl;",
"memset(&ctx->cuparseinfo, 0, sizeof(ctx->cuparseinfo));",
"memset(&ctx->cuparse_ext, 0, sizeof(ctx->cuparse_ext));",
"memset(&seq_pkt, 0, sizeof(seq_pkt));",
"ctx->cuparseinfo.pExtVideoInfo = &ctx->cuparse_ext;",
"switch (avctx->codec->id) {",
"#if CONFIG_H264_CUVID_DECODER\ncase AV_CODEC_ID_H264:\nctx->cuparseinfo.CodecType = cudaVideoCodec_H264;",
"break;",
"#endif\n#if CONFIG_HEVC_CUVID_DECODER\ncase AV_CODEC_ID_HEVC:\nctx->cuparseinfo.CodecType = cudaVideoCodec_HEVC;",
"break;",
"#endif\n#if CONFIG_MJPEG_CUVID_DECODER\ncase AV_CODEC_ID_MJPEG:\nctx->cuparseinfo.CodecType = cudaVideoCodec_JPEG;",
"break;",
"#endif\n#if CONFIG_MPEG1_CUVID_DECODER\ncase AV_CODEC_ID_MPEG1VIDEO:\nctx->cuparseinfo.CodecType = cudaVideoCodec_MPEG1;",
"break;",
"#endif\n#if CONFIG_MPEG2_CUVID_DECODER\ncase AV_CODEC_ID_MPEG2VIDEO:\nctx->cuparseinfo.CodecType = cudaVideoCodec_MPEG2;",
"break;",
"#endif\n#if CONFIG_MPEG4_CUVID_DECODER\ncase AV_CODEC_ID_MPEG4:\nctx->cuparseinfo.CodecType = cudaVideoCodec_MPEG4;",
"break;",
"#endif\n#if CONFIG_VP8_CUVID_DECODER\ncase AV_CODEC_ID_VP8:\nctx->cuparseinfo.CodecType = cudaVideoCodec_VP8;",
"break;",
"#endif\n#if CONFIG_VP9_CUVID_DECODER\ncase AV_CODEC_ID_VP9:\nctx->cuparseinfo.CodecType = cudaVideoCodec_VP9;",
"break;",
"#endif\n#if CONFIG_VC1_CUVID_DECODER\ncase AV_CODEC_ID_VC1:\nctx->cuparseinfo.CodecType = cudaVideoCodec_VC1;",
"break;",
"#endif\ndefault:\nav_log(avctx, AV_LOG_ERROR, \"Invalid CUVID codec!\\n\");",
"return AVERROR_BUG;",
"}",
"if (avctx->codec->id == AV_CODEC_ID_H264 || avctx->codec->id == AV_CODEC_ID_HEVC) {",
"if (avctx->codec->id == AV_CODEC_ID_H264)\nVAR_0 = av_bsf_get_by_name(\"h264_mp4toannexb\");",
"else\nVAR_0 = av_bsf_get_by_name(\"hevc_mp4toannexb\");",
"if (!VAR_0) {",
"VAR_1 = AVERROR_BSF_NOT_FOUND;",
"goto error;",
"}",
"if (VAR_1 = av_bsf_alloc(VAR_0, &ctx->VAR_0)) {",
"goto error;",
"}",
"if (((VAR_1 = avcodec_parameters_from_context(ctx->VAR_0->par_in, avctx)) < 0) || ((VAR_1 = av_bsf_init(ctx->VAR_0)) < 0)) {",
"av_bsf_free(&ctx->VAR_0);",
"goto error;",
"}",
"ctx->cuparse_ext.format.seqhdr_data_length = ctx->VAR_0->par_out->extradata_size;",
"memcpy(ctx->cuparse_ext.raw_seqhdr_data,\nctx->VAR_0->par_out->extradata,\nFFMIN(sizeof(ctx->cuparse_ext.raw_seqhdr_data), ctx->VAR_0->par_out->extradata_size));",
"} else if (avctx->extradata_size > 0) {",
"ctx->cuparse_ext.format.seqhdr_data_length = avctx->extradata_size;",
"memcpy(ctx->cuparse_ext.raw_seqhdr_data,\navctx->extradata,\nFFMIN(sizeof(ctx->cuparse_ext.raw_seqhdr_data), avctx->extradata_size));",
"}",
"ctx->cuparseinfo.ulMaxNumDecodeSurfaces = ctx->nb_surfaces;",
"ctx->cuparseinfo.ulMaxDisplayDelay = 4;",
"ctx->cuparseinfo.pUserData = avctx;",
"ctx->cuparseinfo.pfnSequenceCallback = cuvid_handle_video_sequence;",
"ctx->cuparseinfo.pfnDecodePicture = cuvid_handle_picture_decode;",
"ctx->cuparseinfo.pfnDisplayPicture = cuvid_handle_picture_display;",
"VAR_1 = CHECK_CU(ctx->cudl->cuCtxPushCurrent(cuda_ctx));",
"if (VAR_1 < 0)\ngoto error;",
"VAR_1 = cuvid_test_dummy_decoder(avctx, &ctx->cuparseinfo,\nVAR_3,\nVAR_4);",
"if (VAR_1 < 0)\ngoto error;",
"VAR_1 = CHECK_CU(ctx->cvdl->cuvidCreateVideoParser(&ctx->cuparser, &ctx->cuparseinfo));",
"if (VAR_1 < 0)\ngoto error;",
"seq_pkt.payload = ctx->cuparse_ext.raw_seqhdr_data;",
"seq_pkt.payload_size = ctx->cuparse_ext.format.seqhdr_data_length;",
"if (seq_pkt.payload && seq_pkt.payload_size) {",
"VAR_1 = CHECK_CU(ctx->cvdl->cuvidParseVideoData(ctx->cuparser, &seq_pkt));",
"if (VAR_1 < 0)\ngoto error;",
"}",
"VAR_1 = CHECK_CU(ctx->cudl->cuCtxPopCurrent(&dummy));",
"if (VAR_1 < 0)\ngoto error;",
"ctx->prev_pts = INT64_MIN;",
"if (!avctx->pkt_timebase.num || !avctx->pkt_timebase.den)\nav_log(avctx, AV_LOG_WARNING, \"Invalid pkt_timebase, passing timestamps as-is.\\n\");",
"return 0;",
"error:\ncuvid_decode_end(avctx);",
"return VAR_1;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
25
],
[
27,
29
],
[
33
],
[
35
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
61,
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
75,
77,
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
129
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149
],
[
151
],
[
153
],
[
155
],
[
157
],
[
159
],
[
161,
163
],
[
165
],
[
169
],
[
171
],
[
173
],
[
175
],
[
177
],
[
179
],
[
183
],
[
185
],
[
189
],
[
191
],
[
195
],
[
197
],
[
201
],
[
203
],
[
205
],
[
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,
277,
279
],
[
281
],
[
283,
285,
287,
289
],
[
291
],
[
293,
295,
297,
299
],
[
301
],
[
303,
305,
307
],
[
309
],
[
311
],
[
315
],
[
317,
319
],
[
321,
323
],
[
327
],
[
329
],
[
331
],
[
333
],
[
335
],
[
337
],
[
339
],
[
341
],
[
343
],
[
345
],
[
347
],
[
351
],
[
353,
355,
357
],
[
359
],
[
361
],
[
363,
365,
367
],
[
369
],
[
373
],
[
375
],
[
377
],
[
379
],
[
381
],
[
383
],
[
387
],
[
389,
391
],
[
395,
397,
399
],
[
401,
403
],
[
407
],
[
409,
411
],
[
415
],
[
417
],
[
421
],
[
423
],
[
425,
427
],
[
429
],
[
433
],
[
435,
437
],
[
441
],
[
445,
447
],
[
451
],
[
455,
457
],
[
459
],
[
461
]
] |
9,674 |
static void default_end_frame(AVFilterLink *inlink)
{
AVFilterLink *outlink = NULL;
if (inlink->dst->nb_outputs)
outlink = inlink->dst->outputs[0];
if (outlink) {
if (outlink->out_buf) {
avfilter_unref_buffer(outlink->out_buf);
outlink->out_buf = NULL;
}
ff_end_frame(outlink);
}
}
| false |
FFmpeg
|
4c9080a7ef18ad71fb0a75c8d1c1803edd780edd
|
static void default_end_frame(AVFilterLink *inlink)
{
AVFilterLink *outlink = NULL;
if (inlink->dst->nb_outputs)
outlink = inlink->dst->outputs[0];
if (outlink) {
if (outlink->out_buf) {
avfilter_unref_buffer(outlink->out_buf);
outlink->out_buf = NULL;
}
ff_end_frame(outlink);
}
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(AVFilterLink *VAR_0)
{
AVFilterLink *outlink = NULL;
if (VAR_0->dst->nb_outputs)
outlink = VAR_0->dst->outputs[0];
if (outlink) {
if (outlink->out_buf) {
avfilter_unref_buffer(outlink->out_buf);
outlink->out_buf = NULL;
}
ff_end_frame(outlink);
}
}
|
[
"static void FUNC_0(AVFilterLink *VAR_0)\n{",
"AVFilterLink *outlink = NULL;",
"if (VAR_0->dst->nb_outputs)\noutlink = VAR_0->dst->outputs[0];",
"if (outlink) {",
"if (outlink->out_buf) {",
"avfilter_unref_buffer(outlink->out_buf);",
"outlink->out_buf = NULL;",
"}",
"ff_end_frame(outlink);",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
9,
11
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
]
] |
9,675 |
static inline void gen_op_addq_ESP_im(int32_t val)
{
tcg_gen_ld_tl(cpu_tmp0, cpu_env, offsetof(CPUState, regs[R_ESP]));
tcg_gen_addi_tl(cpu_tmp0, cpu_tmp0, val);
tcg_gen_st_tl(cpu_tmp0, cpu_env, offsetof(CPUState, regs[R_ESP]));
}
| false |
qemu
|
6e0d8677cb443e7408c0b7a25a93c6596d7fa380
|
static inline void gen_op_addq_ESP_im(int32_t val)
{
tcg_gen_ld_tl(cpu_tmp0, cpu_env, offsetof(CPUState, regs[R_ESP]));
tcg_gen_addi_tl(cpu_tmp0, cpu_tmp0, val);
tcg_gen_st_tl(cpu_tmp0, cpu_env, offsetof(CPUState, regs[R_ESP]));
}
|
{
"code": [],
"line_no": []
}
|
static inline void FUNC_0(int32_t VAR_0)
{
tcg_gen_ld_tl(cpu_tmp0, cpu_env, offsetof(CPUState, regs[R_ESP]));
tcg_gen_addi_tl(cpu_tmp0, cpu_tmp0, VAR_0);
tcg_gen_st_tl(cpu_tmp0, cpu_env, offsetof(CPUState, regs[R_ESP]));
}
|
[
"static inline void FUNC_0(int32_t VAR_0)\n{",
"tcg_gen_ld_tl(cpu_tmp0, cpu_env, offsetof(CPUState, regs[R_ESP]));",
"tcg_gen_addi_tl(cpu_tmp0, cpu_tmp0, VAR_0);",
"tcg_gen_st_tl(cpu_tmp0, cpu_env, offsetof(CPUState, regs[R_ESP]));",
"}"
] |
[
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
]
] |
9,676 |
static int img_snapshot(int argc, char **argv)
{
BlockDriverState *bs;
QEMUSnapshotInfo sn;
char *filename, *snapshot_name = NULL;
int c, ret = 0, bdrv_oflags;
int action = 0;
qemu_timeval tv;
bdrv_oflags = BDRV_O_FLAGS | BDRV_O_RDWR;
/* Parse commandline parameters */
for(;;) {
c = getopt(argc, argv, "la:c:d:h");
if (c == -1) {
break;
}
switch(c) {
case '?':
case 'h':
help();
return 0;
case 'l':
if (action) {
help();
return 0;
}
action = SNAPSHOT_LIST;
bdrv_oflags &= ~BDRV_O_RDWR; /* no need for RW */
break;
case 'a':
if (action) {
help();
return 0;
}
action = SNAPSHOT_APPLY;
snapshot_name = optarg;
break;
case 'c':
if (action) {
help();
return 0;
}
action = SNAPSHOT_CREATE;
snapshot_name = optarg;
break;
case 'd':
if (action) {
help();
return 0;
}
action = SNAPSHOT_DELETE;
snapshot_name = optarg;
break;
}
}
if (optind >= argc) {
help();
}
filename = argv[optind++];
/* Open the image */
bs = bdrv_new_open(filename, NULL, bdrv_oflags);
if (!bs) {
return 1;
}
/* Perform the requested action */
switch(action) {
case SNAPSHOT_LIST:
dump_snapshots(bs);
break;
case SNAPSHOT_CREATE:
memset(&sn, 0, sizeof(sn));
pstrcpy(sn.name, sizeof(sn.name), snapshot_name);
qemu_gettimeofday(&tv);
sn.date_sec = tv.tv_sec;
sn.date_nsec = tv.tv_usec * 1000;
ret = bdrv_snapshot_create(bs, &sn);
if (ret) {
error_report("Could not create snapshot '%s': %d (%s)",
snapshot_name, ret, strerror(-ret));
}
break;
case SNAPSHOT_APPLY:
ret = bdrv_snapshot_goto(bs, snapshot_name);
if (ret) {
error_report("Could not apply snapshot '%s': %d (%s)",
snapshot_name, ret, strerror(-ret));
}
break;
case SNAPSHOT_DELETE:
ret = bdrv_snapshot_delete(bs, snapshot_name);
if (ret) {
error_report("Could not delete snapshot '%s': %d (%s)",
snapshot_name, ret, strerror(-ret));
}
break;
}
/* Cleanup */
bdrv_delete(bs);
if (ret) {
return 1;
}
return 0;
}
| false |
qemu
|
f0536bb848ad6eb2709a7dc675f261bd160c751b
|
static int img_snapshot(int argc, char **argv)
{
BlockDriverState *bs;
QEMUSnapshotInfo sn;
char *filename, *snapshot_name = NULL;
int c, ret = 0, bdrv_oflags;
int action = 0;
qemu_timeval tv;
bdrv_oflags = BDRV_O_FLAGS | BDRV_O_RDWR;
for(;;) {
c = getopt(argc, argv, "la:c:d:h");
if (c == -1) {
break;
}
switch(c) {
case '?':
case 'h':
help();
return 0;
case 'l':
if (action) {
help();
return 0;
}
action = SNAPSHOT_LIST;
bdrv_oflags &= ~BDRV_O_RDWR;
break;
case 'a':
if (action) {
help();
return 0;
}
action = SNAPSHOT_APPLY;
snapshot_name = optarg;
break;
case 'c':
if (action) {
help();
return 0;
}
action = SNAPSHOT_CREATE;
snapshot_name = optarg;
break;
case 'd':
if (action) {
help();
return 0;
}
action = SNAPSHOT_DELETE;
snapshot_name = optarg;
break;
}
}
if (optind >= argc) {
help();
}
filename = argv[optind++];
bs = bdrv_new_open(filename, NULL, bdrv_oflags);
if (!bs) {
return 1;
}
switch(action) {
case SNAPSHOT_LIST:
dump_snapshots(bs);
break;
case SNAPSHOT_CREATE:
memset(&sn, 0, sizeof(sn));
pstrcpy(sn.name, sizeof(sn.name), snapshot_name);
qemu_gettimeofday(&tv);
sn.date_sec = tv.tv_sec;
sn.date_nsec = tv.tv_usec * 1000;
ret = bdrv_snapshot_create(bs, &sn);
if (ret) {
error_report("Could not create snapshot '%s': %d (%s)",
snapshot_name, ret, strerror(-ret));
}
break;
case SNAPSHOT_APPLY:
ret = bdrv_snapshot_goto(bs, snapshot_name);
if (ret) {
error_report("Could not apply snapshot '%s': %d (%s)",
snapshot_name, ret, strerror(-ret));
}
break;
case SNAPSHOT_DELETE:
ret = bdrv_snapshot_delete(bs, snapshot_name);
if (ret) {
error_report("Could not delete snapshot '%s': %d (%s)",
snapshot_name, ret, strerror(-ret));
}
break;
}
bdrv_delete(bs);
if (ret) {
return 1;
}
return 0;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(int VAR_0, char **VAR_1)
{
BlockDriverState *bs;
QEMUSnapshotInfo sn;
char *VAR_2, *VAR_3 = NULL;
int VAR_4, VAR_5 = 0, VAR_6;
int VAR_7 = 0;
qemu_timeval tv;
VAR_6 = BDRV_O_FLAGS | BDRV_O_RDWR;
for(;;) {
VAR_4 = getopt(VAR_0, VAR_1, "la:VAR_4:d:h");
if (VAR_4 == -1) {
break;
}
switch(VAR_4) {
case '?':
case 'h':
help();
return 0;
case 'l':
if (VAR_7) {
help();
return 0;
}
VAR_7 = SNAPSHOT_LIST;
VAR_6 &= ~BDRV_O_RDWR;
break;
case 'a':
if (VAR_7) {
help();
return 0;
}
VAR_7 = SNAPSHOT_APPLY;
VAR_3 = optarg;
break;
case 'VAR_4':
if (VAR_7) {
help();
return 0;
}
VAR_7 = SNAPSHOT_CREATE;
VAR_3 = optarg;
break;
case 'd':
if (VAR_7) {
help();
return 0;
}
VAR_7 = SNAPSHOT_DELETE;
VAR_3 = optarg;
break;
}
}
if (optind >= VAR_0) {
help();
}
VAR_2 = VAR_1[optind++];
bs = bdrv_new_open(VAR_2, NULL, VAR_6);
if (!bs) {
return 1;
}
switch(VAR_7) {
case SNAPSHOT_LIST:
dump_snapshots(bs);
break;
case SNAPSHOT_CREATE:
memset(&sn, 0, sizeof(sn));
pstrcpy(sn.name, sizeof(sn.name), VAR_3);
qemu_gettimeofday(&tv);
sn.date_sec = tv.tv_sec;
sn.date_nsec = tv.tv_usec * 1000;
VAR_5 = bdrv_snapshot_create(bs, &sn);
if (VAR_5) {
error_report("Could not create snapshot '%s': %d (%s)",
VAR_3, VAR_5, strerror(-VAR_5));
}
break;
case SNAPSHOT_APPLY:
VAR_5 = bdrv_snapshot_goto(bs, VAR_3);
if (VAR_5) {
error_report("Could not apply snapshot '%s': %d (%s)",
VAR_3, VAR_5, strerror(-VAR_5));
}
break;
case SNAPSHOT_DELETE:
VAR_5 = bdrv_snapshot_delete(bs, VAR_3);
if (VAR_5) {
error_report("Could not delete snapshot '%s': %d (%s)",
VAR_3, VAR_5, strerror(-VAR_5));
}
break;
}
bdrv_delete(bs);
if (VAR_5) {
return 1;
}
return 0;
}
|
[
"static int FUNC_0(int VAR_0, char **VAR_1)\n{",
"BlockDriverState *bs;",
"QEMUSnapshotInfo sn;",
"char *VAR_2, *VAR_3 = NULL;",
"int VAR_4, VAR_5 = 0, VAR_6;",
"int VAR_7 = 0;",
"qemu_timeval tv;",
"VAR_6 = BDRV_O_FLAGS | BDRV_O_RDWR;",
"for(;;) {",
"VAR_4 = getopt(VAR_0, VAR_1, \"la:VAR_4:d:h\");",
"if (VAR_4 == -1) {",
"break;",
"}",
"switch(VAR_4) {",
"case '?':\ncase 'h':\nhelp();",
"return 0;",
"case 'l':\nif (VAR_7) {",
"help();",
"return 0;",
"}",
"VAR_7 = SNAPSHOT_LIST;",
"VAR_6 &= ~BDRV_O_RDWR;",
"break;",
"case 'a':\nif (VAR_7) {",
"help();",
"return 0;",
"}",
"VAR_7 = SNAPSHOT_APPLY;",
"VAR_3 = optarg;",
"break;",
"case 'VAR_4':\nif (VAR_7) {",
"help();",
"return 0;",
"}",
"VAR_7 = SNAPSHOT_CREATE;",
"VAR_3 = optarg;",
"break;",
"case 'd':\nif (VAR_7) {",
"help();",
"return 0;",
"}",
"VAR_7 = SNAPSHOT_DELETE;",
"VAR_3 = optarg;",
"break;",
"}",
"}",
"if (optind >= VAR_0) {",
"help();",
"}",
"VAR_2 = VAR_1[optind++];",
"bs = bdrv_new_open(VAR_2, NULL, VAR_6);",
"if (!bs) {",
"return 1;",
"}",
"switch(VAR_7) {",
"case SNAPSHOT_LIST:\ndump_snapshots(bs);",
"break;",
"case SNAPSHOT_CREATE:\nmemset(&sn, 0, sizeof(sn));",
"pstrcpy(sn.name, sizeof(sn.name), VAR_3);",
"qemu_gettimeofday(&tv);",
"sn.date_sec = tv.tv_sec;",
"sn.date_nsec = tv.tv_usec * 1000;",
"VAR_5 = bdrv_snapshot_create(bs, &sn);",
"if (VAR_5) {",
"error_report(\"Could not create snapshot '%s': %d (%s)\",\nVAR_3, VAR_5, strerror(-VAR_5));",
"}",
"break;",
"case SNAPSHOT_APPLY:\nVAR_5 = bdrv_snapshot_goto(bs, VAR_3);",
"if (VAR_5) {",
"error_report(\"Could not apply snapshot '%s': %d (%s)\",\nVAR_3, VAR_5, strerror(-VAR_5));",
"}",
"break;",
"case SNAPSHOT_DELETE:\nVAR_5 = bdrv_snapshot_delete(bs, VAR_3);",
"if (VAR_5) {",
"error_report(\"Could not delete snapshot '%s': %d (%s)\",\nVAR_3, VAR_5, strerror(-VAR_5));",
"}",
"break;",
"}",
"bdrv_delete(bs);",
"if (VAR_5) {",
"return 1;",
"}",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
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,
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91,
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
113
],
[
115
],
[
117
],
[
119
],
[
125
],
[
127
],
[
129
],
[
131
],
[
137
],
[
139,
141
],
[
143
],
[
147,
149
],
[
151
],
[
155
],
[
157
],
[
159
],
[
163
],
[
165
],
[
167,
169
],
[
171
],
[
173
],
[
177,
179
],
[
181
],
[
183,
185
],
[
187
],
[
189
],
[
193,
195
],
[
197
],
[
199,
201
],
[
203
],
[
205
],
[
207
],
[
213
],
[
215
],
[
217
],
[
219
],
[
221
],
[
223
]
] |
9,677 |
static void pcnet_aprom_writeb(void *opaque, uint32_t addr, uint32_t val)
{
PCNetState *s = opaque;
#ifdef PCNET_DEBUG
printf("pcnet_aprom_writeb addr=0x%08x val=0x%02x\n", addr, val);
#endif
/* Check APROMWE bit to enable write access */
if (pcnet_bcr_readw(s,2) & 0x100)
s->prom[addr & 15] = val;
}
| false |
qemu
|
488a1a5dfe9a9ba57fa6c6b6b98136ea494e0296
|
static void pcnet_aprom_writeb(void *opaque, uint32_t addr, uint32_t val)
{
PCNetState *s = opaque;
#ifdef PCNET_DEBUG
printf("pcnet_aprom_writeb addr=0x%08x val=0x%02x\n", addr, val);
#endif
if (pcnet_bcr_readw(s,2) & 0x100)
s->prom[addr & 15] = val;
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(void *VAR_0, uint32_t VAR_1, uint32_t VAR_2)
{
PCNetState *s = VAR_0;
#ifdef PCNET_DEBUG
printf("FUNC_0 VAR_1=0x%08x VAR_2=0x%02x\n", VAR_1, VAR_2);
#endif
if (pcnet_bcr_readw(s,2) & 0x100)
s->prom[VAR_1 & 15] = VAR_2;
}
|
[
"static void FUNC_0(void *VAR_0, uint32_t VAR_1, uint32_t VAR_2)\n{",
"PCNetState *s = VAR_0;",
"#ifdef PCNET_DEBUG\nprintf(\"FUNC_0 VAR_1=0x%08x VAR_2=0x%02x\\n\", VAR_1, VAR_2);",
"#endif\nif (pcnet_bcr_readw(s,2) & 0x100)\ns->prom[VAR_1 & 15] = VAR_2;",
"}"
] |
[
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7,
9
],
[
11,
15,
17
],
[
19
]
] |
9,679 |
static int qcow2_create2(const char *filename, int64_t total_size,
const char *backing_file, const char *backing_format,
int flags, size_t cluster_size, PreallocMode prealloc,
QemuOpts *opts, int version, int refcount_order,
const char *encryptfmt, Error **errp)
{
int cluster_bits;
QDict *options;
/* Calculate cluster_bits */
cluster_bits = ctz32(cluster_size);
if (cluster_bits < MIN_CLUSTER_BITS || cluster_bits > MAX_CLUSTER_BITS ||
(1 << cluster_bits) != cluster_size)
{
error_setg(errp, "Cluster size must be a power of two between %d and "
"%dk", 1 << MIN_CLUSTER_BITS, 1 << (MAX_CLUSTER_BITS - 10));
return -EINVAL;
}
/*
* Open the image file and write a minimal qcow2 header.
*
* We keep things simple and start with a zero-sized image. We also
* do without refcount blocks or a L1 table for now. We'll fix the
* inconsistency later.
*
* We do need a refcount table because growing the refcount table means
* allocating two new refcount blocks - the seconds of which would be at
* 2 GB for 64k clusters, and we don't want to have a 2 GB initial file
* size for any qcow2 image.
*/
BlockBackend *blk;
QCowHeader *header;
uint64_t* refcount_table;
Error *local_err = NULL;
int ret;
if (prealloc == PREALLOC_MODE_FULL || prealloc == PREALLOC_MODE_FALLOC) {
int64_t prealloc_size =
qcow2_calc_prealloc_size(total_size, cluster_size, refcount_order);
qemu_opt_set_number(opts, BLOCK_OPT_SIZE, prealloc_size, &error_abort);
qemu_opt_set(opts, BLOCK_OPT_PREALLOC, PreallocMode_lookup[prealloc],
&error_abort);
}
ret = bdrv_create_file(filename, opts, &local_err);
if (ret < 0) {
error_propagate(errp, local_err);
return ret;
}
blk = blk_new_open(filename, NULL, NULL,
BDRV_O_RDWR | BDRV_O_RESIZE | BDRV_O_PROTOCOL,
&local_err);
if (blk == NULL) {
error_propagate(errp, local_err);
return -EIO;
}
blk_set_allow_write_beyond_eof(blk, true);
/* Write the header */
QEMU_BUILD_BUG_ON((1 << MIN_CLUSTER_BITS) < sizeof(*header));
header = g_malloc0(cluster_size);
*header = (QCowHeader) {
.magic = cpu_to_be32(QCOW_MAGIC),
.version = cpu_to_be32(version),
.cluster_bits = cpu_to_be32(cluster_bits),
.size = cpu_to_be64(0),
.l1_table_offset = cpu_to_be64(0),
.l1_size = cpu_to_be32(0),
.refcount_table_offset = cpu_to_be64(cluster_size),
.refcount_table_clusters = cpu_to_be32(1),
.refcount_order = cpu_to_be32(refcount_order),
.header_length = cpu_to_be32(sizeof(*header)),
};
/* We'll update this to correct value later */
header->crypt_method = cpu_to_be32(QCOW_CRYPT_NONE);
if (flags & BLOCK_FLAG_LAZY_REFCOUNTS) {
header->compatible_features |=
cpu_to_be64(QCOW2_COMPAT_LAZY_REFCOUNTS);
}
ret = blk_pwrite(blk, 0, header, cluster_size, 0);
g_free(header);
if (ret < 0) {
error_setg_errno(errp, -ret, "Could not write qcow2 header");
goto out;
}
/* Write a refcount table with one refcount block */
refcount_table = g_malloc0(2 * cluster_size);
refcount_table[0] = cpu_to_be64(2 * cluster_size);
ret = blk_pwrite(blk, cluster_size, refcount_table, 2 * cluster_size, 0);
g_free(refcount_table);
if (ret < 0) {
error_setg_errno(errp, -ret, "Could not write refcount table");
goto out;
}
blk_unref(blk);
blk = NULL;
/*
* And now open the image and make it consistent first (i.e. increase the
* refcount of the cluster that is occupied by the header and the refcount
* table)
*/
options = qdict_new();
qdict_put_str(options, "driver", "qcow2");
blk = blk_new_open(filename, NULL, options,
BDRV_O_RDWR | BDRV_O_RESIZE | BDRV_O_NO_FLUSH,
&local_err);
if (blk == NULL) {
error_propagate(errp, local_err);
ret = -EIO;
goto out;
}
ret = qcow2_alloc_clusters(blk_bs(blk), 3 * cluster_size);
if (ret < 0) {
error_setg_errno(errp, -ret, "Could not allocate clusters for qcow2 "
"header and refcount table");
goto out;
} else if (ret != 0) {
error_report("Huh, first cluster in empty image is already in use?");
abort();
}
/* Create a full header (including things like feature table) */
ret = qcow2_update_header(blk_bs(blk));
if (ret < 0) {
error_setg_errno(errp, -ret, "Could not update qcow2 header");
goto out;
}
/* Okay, now that we have a valid image, let's give it the right size */
ret = blk_truncate(blk, total_size, errp);
if (ret < 0) {
error_prepend(errp, "Could not resize image: ");
goto out;
}
/* Want a backing file? There you go.*/
if (backing_file) {
ret = bdrv_change_backing_file(blk_bs(blk), backing_file, backing_format);
if (ret < 0) {
error_setg_errno(errp, -ret, "Could not assign backing file '%s' "
"with format '%s'", backing_file, backing_format);
goto out;
}
}
/* Want encryption? There you go. */
if (encryptfmt) {
ret = qcow2_set_up_encryption(blk_bs(blk), encryptfmt, opts, errp);
if (ret < 0) {
goto out;
}
}
/* And if we're supposed to preallocate metadata, do that now */
if (prealloc != PREALLOC_MODE_OFF) {
BDRVQcow2State *s = blk_bs(blk)->opaque;
qemu_co_mutex_lock(&s->lock);
ret = preallocate(blk_bs(blk));
qemu_co_mutex_unlock(&s->lock);
if (ret < 0) {
error_setg_errno(errp, -ret, "Could not preallocate metadata");
goto out;
}
}
blk_unref(blk);
blk = NULL;
/* Reopen the image without BDRV_O_NO_FLUSH to flush it before returning.
* Using BDRV_O_NO_IO, since encryption is now setup we don't want to
* have to setup decryption context. We're not doing any I/O on the top
* level BlockDriverState, only lower layers, where BDRV_O_NO_IO does
* not have effect.
*/
options = qdict_new();
qdict_put_str(options, "driver", "qcow2");
blk = blk_new_open(filename, NULL, options,
BDRV_O_RDWR | BDRV_O_NO_BACKING | BDRV_O_NO_IO,
&local_err);
if (blk == NULL) {
error_propagate(errp, local_err);
ret = -EIO;
goto out;
}
ret = 0;
out:
if (blk) {
blk_unref(blk);
}
return ret;
}
| false |
qemu
|
0eb4a8c1df6db29e835daeb954352bfaa8994374
|
static int qcow2_create2(const char *filename, int64_t total_size,
const char *backing_file, const char *backing_format,
int flags, size_t cluster_size, PreallocMode prealloc,
QemuOpts *opts, int version, int refcount_order,
const char *encryptfmt, Error **errp)
{
int cluster_bits;
QDict *options;
cluster_bits = ctz32(cluster_size);
if (cluster_bits < MIN_CLUSTER_BITS || cluster_bits > MAX_CLUSTER_BITS ||
(1 << cluster_bits) != cluster_size)
{
error_setg(errp, "Cluster size must be a power of two between %d and "
"%dk", 1 << MIN_CLUSTER_BITS, 1 << (MAX_CLUSTER_BITS - 10));
return -EINVAL;
}
BlockBackend *blk;
QCowHeader *header;
uint64_t* refcount_table;
Error *local_err = NULL;
int ret;
if (prealloc == PREALLOC_MODE_FULL || prealloc == PREALLOC_MODE_FALLOC) {
int64_t prealloc_size =
qcow2_calc_prealloc_size(total_size, cluster_size, refcount_order);
qemu_opt_set_number(opts, BLOCK_OPT_SIZE, prealloc_size, &error_abort);
qemu_opt_set(opts, BLOCK_OPT_PREALLOC, PreallocMode_lookup[prealloc],
&error_abort);
}
ret = bdrv_create_file(filename, opts, &local_err);
if (ret < 0) {
error_propagate(errp, local_err);
return ret;
}
blk = blk_new_open(filename, NULL, NULL,
BDRV_O_RDWR | BDRV_O_RESIZE | BDRV_O_PROTOCOL,
&local_err);
if (blk == NULL) {
error_propagate(errp, local_err);
return -EIO;
}
blk_set_allow_write_beyond_eof(blk, true);
QEMU_BUILD_BUG_ON((1 << MIN_CLUSTER_BITS) < sizeof(*header));
header = g_malloc0(cluster_size);
*header = (QCowHeader) {
.magic = cpu_to_be32(QCOW_MAGIC),
.version = cpu_to_be32(version),
.cluster_bits = cpu_to_be32(cluster_bits),
.size = cpu_to_be64(0),
.l1_table_offset = cpu_to_be64(0),
.l1_size = cpu_to_be32(0),
.refcount_table_offset = cpu_to_be64(cluster_size),
.refcount_table_clusters = cpu_to_be32(1),
.refcount_order = cpu_to_be32(refcount_order),
.header_length = cpu_to_be32(sizeof(*header)),
};
header->crypt_method = cpu_to_be32(QCOW_CRYPT_NONE);
if (flags & BLOCK_FLAG_LAZY_REFCOUNTS) {
header->compatible_features |=
cpu_to_be64(QCOW2_COMPAT_LAZY_REFCOUNTS);
}
ret = blk_pwrite(blk, 0, header, cluster_size, 0);
g_free(header);
if (ret < 0) {
error_setg_errno(errp, -ret, "Could not write qcow2 header");
goto out;
}
refcount_table = g_malloc0(2 * cluster_size);
refcount_table[0] = cpu_to_be64(2 * cluster_size);
ret = blk_pwrite(blk, cluster_size, refcount_table, 2 * cluster_size, 0);
g_free(refcount_table);
if (ret < 0) {
error_setg_errno(errp, -ret, "Could not write refcount table");
goto out;
}
blk_unref(blk);
blk = NULL;
options = qdict_new();
qdict_put_str(options, "driver", "qcow2");
blk = blk_new_open(filename, NULL, options,
BDRV_O_RDWR | BDRV_O_RESIZE | BDRV_O_NO_FLUSH,
&local_err);
if (blk == NULL) {
error_propagate(errp, local_err);
ret = -EIO;
goto out;
}
ret = qcow2_alloc_clusters(blk_bs(blk), 3 * cluster_size);
if (ret < 0) {
error_setg_errno(errp, -ret, "Could not allocate clusters for qcow2 "
"header and refcount table");
goto out;
} else if (ret != 0) {
error_report("Huh, first cluster in empty image is already in use?");
abort();
}
ret = qcow2_update_header(blk_bs(blk));
if (ret < 0) {
error_setg_errno(errp, -ret, "Could not update qcow2 header");
goto out;
}
ret = blk_truncate(blk, total_size, errp);
if (ret < 0) {
error_prepend(errp, "Could not resize image: ");
goto out;
}
if (backing_file) {
ret = bdrv_change_backing_file(blk_bs(blk), backing_file, backing_format);
if (ret < 0) {
error_setg_errno(errp, -ret, "Could not assign backing file '%s' "
"with format '%s'", backing_file, backing_format);
goto out;
}
}
if (encryptfmt) {
ret = qcow2_set_up_encryption(blk_bs(blk), encryptfmt, opts, errp);
if (ret < 0) {
goto out;
}
}
if (prealloc != PREALLOC_MODE_OFF) {
BDRVQcow2State *s = blk_bs(blk)->opaque;
qemu_co_mutex_lock(&s->lock);
ret = preallocate(blk_bs(blk));
qemu_co_mutex_unlock(&s->lock);
if (ret < 0) {
error_setg_errno(errp, -ret, "Could not preallocate metadata");
goto out;
}
}
blk_unref(blk);
blk = NULL;
options = qdict_new();
qdict_put_str(options, "driver", "qcow2");
blk = blk_new_open(filename, NULL, options,
BDRV_O_RDWR | BDRV_O_NO_BACKING | BDRV_O_NO_IO,
&local_err);
if (blk == NULL) {
error_propagate(errp, local_err);
ret = -EIO;
goto out;
}
ret = 0;
out:
if (blk) {
blk_unref(blk);
}
return ret;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(const char *VAR_0, int64_t VAR_1,
const char *VAR_2, const char *VAR_3,
int VAR_4, size_t VAR_5, PreallocMode VAR_6,
QemuOpts *VAR_7, int VAR_8, int VAR_9,
const char *VAR_10, Error **VAR_11)
{
int VAR_12;
QDict *options;
VAR_12 = ctz32(VAR_5);
if (VAR_12 < MIN_CLUSTER_BITS || VAR_12 > MAX_CLUSTER_BITS ||
(1 << VAR_12) != VAR_5)
{
error_setg(VAR_11, "Cluster size must be a power of two between %d and "
"%dk", 1 << MIN_CLUSTER_BITS, 1 << (MAX_CLUSTER_BITS - 10));
return -EINVAL;
}
BlockBackend *blk;
QCowHeader *header;
uint64_t* refcount_table;
Error *local_err = NULL;
int VAR_13;
if (VAR_6 == PREALLOC_MODE_FULL || VAR_6 == PREALLOC_MODE_FALLOC) {
int64_t prealloc_size =
qcow2_calc_prealloc_size(VAR_1, VAR_5, VAR_9);
qemu_opt_set_number(VAR_7, BLOCK_OPT_SIZE, prealloc_size, &error_abort);
qemu_opt_set(VAR_7, BLOCK_OPT_PREALLOC, PreallocMode_lookup[VAR_6],
&error_abort);
}
VAR_13 = bdrv_create_file(VAR_0, VAR_7, &local_err);
if (VAR_13 < 0) {
error_propagate(VAR_11, local_err);
return VAR_13;
}
blk = blk_new_open(VAR_0, NULL, NULL,
BDRV_O_RDWR | BDRV_O_RESIZE | BDRV_O_PROTOCOL,
&local_err);
if (blk == NULL) {
error_propagate(VAR_11, local_err);
return -EIO;
}
blk_set_allow_write_beyond_eof(blk, true);
QEMU_BUILD_BUG_ON((1 << MIN_CLUSTER_BITS) < sizeof(*header));
header = g_malloc0(VAR_5);
*header = (QCowHeader) {
.magic = cpu_to_be32(QCOW_MAGIC),
.VAR_8 = cpu_to_be32(VAR_8),
.VAR_12 = cpu_to_be32(VAR_12),
.size = cpu_to_be64(0),
.l1_table_offset = cpu_to_be64(0),
.l1_size = cpu_to_be32(0),
.refcount_table_offset = cpu_to_be64(VAR_5),
.refcount_table_clusters = cpu_to_be32(1),
.VAR_9 = cpu_to_be32(VAR_9),
.header_length = cpu_to_be32(sizeof(*header)),
};
header->crypt_method = cpu_to_be32(QCOW_CRYPT_NONE);
if (VAR_4 & BLOCK_FLAG_LAZY_REFCOUNTS) {
header->compatible_features |=
cpu_to_be64(QCOW2_COMPAT_LAZY_REFCOUNTS);
}
VAR_13 = blk_pwrite(blk, 0, header, VAR_5, 0);
g_free(header);
if (VAR_13 < 0) {
error_setg_errno(VAR_11, -VAR_13, "Could not write qcow2 header");
goto out;
}
refcount_table = g_malloc0(2 * VAR_5);
refcount_table[0] = cpu_to_be64(2 * VAR_5);
VAR_13 = blk_pwrite(blk, VAR_5, refcount_table, 2 * VAR_5, 0);
g_free(refcount_table);
if (VAR_13 < 0) {
error_setg_errno(VAR_11, -VAR_13, "Could not write refcount table");
goto out;
}
blk_unref(blk);
blk = NULL;
options = qdict_new();
qdict_put_str(options, "driver", "qcow2");
blk = blk_new_open(VAR_0, NULL, options,
BDRV_O_RDWR | BDRV_O_RESIZE | BDRV_O_NO_FLUSH,
&local_err);
if (blk == NULL) {
error_propagate(VAR_11, local_err);
VAR_13 = -EIO;
goto out;
}
VAR_13 = qcow2_alloc_clusters(blk_bs(blk), 3 * VAR_5);
if (VAR_13 < 0) {
error_setg_errno(VAR_11, -VAR_13, "Could not allocate clusters for qcow2 "
"header and refcount table");
goto out;
} else if (VAR_13 != 0) {
error_report("Huh, first cluster in empty image is already in use?");
abort();
}
VAR_13 = qcow2_update_header(blk_bs(blk));
if (VAR_13 < 0) {
error_setg_errno(VAR_11, -VAR_13, "Could not update qcow2 header");
goto out;
}
VAR_13 = blk_truncate(blk, VAR_1, VAR_11);
if (VAR_13 < 0) {
error_prepend(VAR_11, "Could not resize image: ");
goto out;
}
if (VAR_2) {
VAR_13 = bdrv_change_backing_file(blk_bs(blk), VAR_2, VAR_3);
if (VAR_13 < 0) {
error_setg_errno(VAR_11, -VAR_13, "Could not assign backing file '%s' "
"with format '%s'", VAR_2, VAR_3);
goto out;
}
}
if (VAR_10) {
VAR_13 = qcow2_set_up_encryption(blk_bs(blk), VAR_10, VAR_7, VAR_11);
if (VAR_13 < 0) {
goto out;
}
}
if (VAR_6 != PREALLOC_MODE_OFF) {
BDRVQcow2State *s = blk_bs(blk)->opaque;
qemu_co_mutex_lock(&s->lock);
VAR_13 = preallocate(blk_bs(blk));
qemu_co_mutex_unlock(&s->lock);
if (VAR_13 < 0) {
error_setg_errno(VAR_11, -VAR_13, "Could not preallocate metadata");
goto out;
}
}
blk_unref(blk);
blk = NULL;
options = qdict_new();
qdict_put_str(options, "driver", "qcow2");
blk = blk_new_open(VAR_0, NULL, options,
BDRV_O_RDWR | BDRV_O_NO_BACKING | BDRV_O_NO_IO,
&local_err);
if (blk == NULL) {
error_propagate(VAR_11, local_err);
VAR_13 = -EIO;
goto out;
}
VAR_13 = 0;
out:
if (blk) {
blk_unref(blk);
}
return VAR_13;
}
|
[
"static int FUNC_0(const char *VAR_0, int64_t VAR_1,\nconst char *VAR_2, const char *VAR_3,\nint VAR_4, size_t VAR_5, PreallocMode VAR_6,\nQemuOpts *VAR_7, int VAR_8, int VAR_9,\nconst char *VAR_10, Error **VAR_11)\n{",
"int VAR_12;",
"QDict *options;",
"VAR_12 = ctz32(VAR_5);",
"if (VAR_12 < MIN_CLUSTER_BITS || VAR_12 > MAX_CLUSTER_BITS ||\n(1 << VAR_12) != VAR_5)\n{",
"error_setg(VAR_11, \"Cluster size must be a power of two between %d and \"\n\"%dk\", 1 << MIN_CLUSTER_BITS, 1 << (MAX_CLUSTER_BITS - 10));",
"return -EINVAL;",
"}",
"BlockBackend *blk;",
"QCowHeader *header;",
"uint64_t* refcount_table;",
"Error *local_err = NULL;",
"int VAR_13;",
"if (VAR_6 == PREALLOC_MODE_FULL || VAR_6 == PREALLOC_MODE_FALLOC) {",
"int64_t prealloc_size =\nqcow2_calc_prealloc_size(VAR_1, VAR_5, VAR_9);",
"qemu_opt_set_number(VAR_7, BLOCK_OPT_SIZE, prealloc_size, &error_abort);",
"qemu_opt_set(VAR_7, BLOCK_OPT_PREALLOC, PreallocMode_lookup[VAR_6],\n&error_abort);",
"}",
"VAR_13 = bdrv_create_file(VAR_0, VAR_7, &local_err);",
"if (VAR_13 < 0) {",
"error_propagate(VAR_11, local_err);",
"return VAR_13;",
"}",
"blk = blk_new_open(VAR_0, NULL, NULL,\nBDRV_O_RDWR | BDRV_O_RESIZE | BDRV_O_PROTOCOL,\n&local_err);",
"if (blk == NULL) {",
"error_propagate(VAR_11, local_err);",
"return -EIO;",
"}",
"blk_set_allow_write_beyond_eof(blk, true);",
"QEMU_BUILD_BUG_ON((1 << MIN_CLUSTER_BITS) < sizeof(*header));",
"header = g_malloc0(VAR_5);",
"*header = (QCowHeader) {",
".magic = cpu_to_be32(QCOW_MAGIC),\n.VAR_8 = cpu_to_be32(VAR_8),\n.VAR_12 = cpu_to_be32(VAR_12),\n.size = cpu_to_be64(0),\n.l1_table_offset = cpu_to_be64(0),\n.l1_size = cpu_to_be32(0),\n.refcount_table_offset = cpu_to_be64(VAR_5),\n.refcount_table_clusters = cpu_to_be32(1),\n.VAR_9 = cpu_to_be32(VAR_9),\n.header_length = cpu_to_be32(sizeof(*header)),\n};",
"header->crypt_method = cpu_to_be32(QCOW_CRYPT_NONE);",
"if (VAR_4 & BLOCK_FLAG_LAZY_REFCOUNTS) {",
"header->compatible_features |=\ncpu_to_be64(QCOW2_COMPAT_LAZY_REFCOUNTS);",
"}",
"VAR_13 = blk_pwrite(blk, 0, header, VAR_5, 0);",
"g_free(header);",
"if (VAR_13 < 0) {",
"error_setg_errno(VAR_11, -VAR_13, \"Could not write qcow2 header\");",
"goto out;",
"}",
"refcount_table = g_malloc0(2 * VAR_5);",
"refcount_table[0] = cpu_to_be64(2 * VAR_5);",
"VAR_13 = blk_pwrite(blk, VAR_5, refcount_table, 2 * VAR_5, 0);",
"g_free(refcount_table);",
"if (VAR_13 < 0) {",
"error_setg_errno(VAR_11, -VAR_13, \"Could not write refcount table\");",
"goto out;",
"}",
"blk_unref(blk);",
"blk = NULL;",
"options = qdict_new();",
"qdict_put_str(options, \"driver\", \"qcow2\");",
"blk = blk_new_open(VAR_0, NULL, options,\nBDRV_O_RDWR | BDRV_O_RESIZE | BDRV_O_NO_FLUSH,\n&local_err);",
"if (blk == NULL) {",
"error_propagate(VAR_11, local_err);",
"VAR_13 = -EIO;",
"goto out;",
"}",
"VAR_13 = qcow2_alloc_clusters(blk_bs(blk), 3 * VAR_5);",
"if (VAR_13 < 0) {",
"error_setg_errno(VAR_11, -VAR_13, \"Could not allocate clusters for qcow2 \"\n\"header and refcount table\");",
"goto out;",
"} else if (VAR_13 != 0) {",
"error_report(\"Huh, first cluster in empty image is already in use?\");",
"abort();",
"}",
"VAR_13 = qcow2_update_header(blk_bs(blk));",
"if (VAR_13 < 0) {",
"error_setg_errno(VAR_11, -VAR_13, \"Could not update qcow2 header\");",
"goto out;",
"}",
"VAR_13 = blk_truncate(blk, VAR_1, VAR_11);",
"if (VAR_13 < 0) {",
"error_prepend(VAR_11, \"Could not resize image: \");",
"goto out;",
"}",
"if (VAR_2) {",
"VAR_13 = bdrv_change_backing_file(blk_bs(blk), VAR_2, VAR_3);",
"if (VAR_13 < 0) {",
"error_setg_errno(VAR_11, -VAR_13, \"Could not assign backing file '%s' \"\n\"with format '%s'\", VAR_2, VAR_3);",
"goto out;",
"}",
"}",
"if (VAR_10) {",
"VAR_13 = qcow2_set_up_encryption(blk_bs(blk), VAR_10, VAR_7, VAR_11);",
"if (VAR_13 < 0) {",
"goto out;",
"}",
"}",
"if (VAR_6 != PREALLOC_MODE_OFF) {",
"BDRVQcow2State *s = blk_bs(blk)->opaque;",
"qemu_co_mutex_lock(&s->lock);",
"VAR_13 = preallocate(blk_bs(blk));",
"qemu_co_mutex_unlock(&s->lock);",
"if (VAR_13 < 0) {",
"error_setg_errno(VAR_11, -VAR_13, \"Could not preallocate metadata\");",
"goto out;",
"}",
"}",
"blk_unref(blk);",
"blk = NULL;",
"options = qdict_new();",
"qdict_put_str(options, \"driver\", \"qcow2\");",
"blk = blk_new_open(VAR_0, NULL, options,\nBDRV_O_RDWR | BDRV_O_NO_BACKING | BDRV_O_NO_IO,\n&local_err);",
"if (blk == NULL) {",
"error_propagate(VAR_11, local_err);",
"VAR_13 = -EIO;",
"goto out;",
"}",
"VAR_13 = 0;",
"out:\nif (blk) {",
"blk_unref(blk);",
"}",
"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,
0,
0
] |
[
[
1,
3,
5,
7,
9,
11
],
[
13
],
[
15
],
[
21
],
[
23,
25,
27
],
[
29,
31
],
[
33
],
[
35
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
75
],
[
77,
79
],
[
81
],
[
83,
85
],
[
87
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
103,
105,
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
119
],
[
125
],
[
127
],
[
129
],
[
131,
133,
135,
137,
139,
141,
143,
145,
147,
149,
151
],
[
157
],
[
161
],
[
163,
165
],
[
167
],
[
171
],
[
173
],
[
175
],
[
177
],
[
179
],
[
181
],
[
187
],
[
189
],
[
191
],
[
193
],
[
197
],
[
199
],
[
201
],
[
203
],
[
207
],
[
209
],
[
223
],
[
225
],
[
227,
229,
231
],
[
233
],
[
235
],
[
237
],
[
239
],
[
241
],
[
245
],
[
247
],
[
249,
251
],
[
253
],
[
257
],
[
259
],
[
261
],
[
263
],
[
269
],
[
271
],
[
273
],
[
275
],
[
277
],
[
283
],
[
285
],
[
287
],
[
289
],
[
291
],
[
297
],
[
299
],
[
301
],
[
303,
305
],
[
307
],
[
309
],
[
311
],
[
317
],
[
319
],
[
321
],
[
323
],
[
325
],
[
327
],
[
333
],
[
335
],
[
337
],
[
339
],
[
341
],
[
343
],
[
345
],
[
347
],
[
349
],
[
351
],
[
355
],
[
357
],
[
373
],
[
375
],
[
377,
379,
381
],
[
383
],
[
385
],
[
387
],
[
389
],
[
391
],
[
395
],
[
397,
399
],
[
401
],
[
403
],
[
405
],
[
407
]
] |
9,680 |
static int protocol_version(VncState *vs, char *version, size_t len)
{
char local[13];
int maj, min;
memcpy(local, version, 12);
local[12] = 0;
if (sscanf(local, "RFB %03d.%03d\n", &maj, &min) != 2) {
vnc_client_error(vs);
return 0;
}
vnc_write_u32(vs, 1); /* None */
vnc_flush(vs);
vnc_read_when(vs, protocol_client_init, 1);
return 0;
}
| false |
qemu
|
7084851534c834f00652f90a9da5e4032bd22130
|
static int protocol_version(VncState *vs, char *version, size_t len)
{
char local[13];
int maj, min;
memcpy(local, version, 12);
local[12] = 0;
if (sscanf(local, "RFB %03d.%03d\n", &maj, &min) != 2) {
vnc_client_error(vs);
return 0;
}
vnc_write_u32(vs, 1);
vnc_flush(vs);
vnc_read_when(vs, protocol_client_init, 1);
return 0;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(VncState *VAR_0, char *VAR_1, size_t VAR_2)
{
char VAR_3[13];
int VAR_4, VAR_5;
memcpy(VAR_3, VAR_1, 12);
VAR_3[12] = 0;
if (sscanf(VAR_3, "RFB %03d.%03d\n", &VAR_4, &VAR_5) != 2) {
vnc_client_error(VAR_0);
return 0;
}
vnc_write_u32(VAR_0, 1);
vnc_flush(VAR_0);
vnc_read_when(VAR_0, protocol_client_init, 1);
return 0;
}
|
[
"static int FUNC_0(VncState *VAR_0, char *VAR_1, size_t VAR_2)\n{",
"char VAR_3[13];",
"int VAR_4, VAR_5;",
"memcpy(VAR_3, VAR_1, 12);",
"VAR_3[12] = 0;",
"if (sscanf(VAR_3, \"RFB %03d.%03d\\n\", &VAR_4, &VAR_5) != 2) {",
"vnc_client_error(VAR_0);",
"return 0;",
"}",
"vnc_write_u32(VAR_0, 1);",
"vnc_flush(VAR_0);",
"vnc_read_when(VAR_0, protocol_client_init, 1);",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
17
],
[
19
],
[
21
],
[
23
],
[
27
],
[
29
],
[
33
],
[
37
],
[
39
]
] |
9,681 |
void ppce500_init(MachineState *machine, PPCE500Params *params)
{
MemoryRegion *address_space_mem = get_system_memory();
MemoryRegion *ram = g_new(MemoryRegion, 1);
PCIBus *pci_bus;
CPUPPCState *env = NULL;
uint64_t elf_entry;
uint64_t elf_lowaddr;
hwaddr entry=0;
hwaddr loadaddr=UIMAGE_LOAD_BASE;
target_long kernel_size=0;
target_ulong dt_base = 0;
target_ulong initrd_base = 0;
target_long initrd_size = 0;
target_ulong cur_base = 0;
int i;
/* irq num for pin INTA, INTB, INTC and INTD is 1, 2, 3 and
* 4 respectively */
unsigned int pci_irq_nrs[PCI_NUM_PINS] = {1, 2, 3, 4};
qemu_irq **irqs, *mpic;
DeviceState *dev;
CPUPPCState *firstenv = NULL;
MemoryRegion *ccsr_addr_space;
SysBusDevice *s;
PPCE500CCSRState *ccsr;
/* Setup CPUs */
if (machine->cpu_model == NULL) {
machine->cpu_model = "e500v2_v30";
}
irqs = g_malloc0(smp_cpus * sizeof(qemu_irq *));
irqs[0] = g_malloc0(smp_cpus * sizeof(qemu_irq) * OPENPIC_OUTPUT_NB);
for (i = 0; i < smp_cpus; i++) {
PowerPCCPU *cpu;
CPUState *cs;
qemu_irq *input;
cpu = cpu_ppc_init(machine->cpu_model);
if (cpu == NULL) {
fprintf(stderr, "Unable to initialize CPU!\n");
exit(1);
}
env = &cpu->env;
cs = CPU(cpu);
if (!firstenv) {
firstenv = env;
}
irqs[i] = irqs[0] + (i * OPENPIC_OUTPUT_NB);
input = (qemu_irq *)env->irq_inputs;
irqs[i][OPENPIC_OUTPUT_INT] = input[PPCE500_INPUT_INT];
irqs[i][OPENPIC_OUTPUT_CINT] = input[PPCE500_INPUT_CINT];
env->spr_cb[SPR_BOOKE_PIR].default_value = cs->cpu_index = i;
env->mpic_iack = MPC8544_CCSRBAR_BASE +
MPC8544_MPIC_REGS_OFFSET + 0xa0;
ppc_booke_timers_init(cpu, 400000000, PPC_TIMER_E500);
/* Register reset handler */
if (!i) {
/* Primary CPU */
struct boot_info *boot_info;
boot_info = g_malloc0(sizeof(struct boot_info));
qemu_register_reset(ppce500_cpu_reset, cpu);
env->load_info = boot_info;
} else {
/* Secondary CPUs */
qemu_register_reset(ppce500_cpu_reset_sec, cpu);
}
}
env = firstenv;
/* Fixup Memory size on a alignment boundary */
ram_size &= ~(RAM_SIZES_ALIGN - 1);
machine->ram_size = ram_size;
/* Register Memory */
memory_region_init_ram(ram, NULL, "mpc8544ds.ram", ram_size);
vmstate_register_ram_global(ram);
memory_region_add_subregion(address_space_mem, 0, ram);
dev = qdev_create(NULL, "e500-ccsr");
object_property_add_child(qdev_get_machine(), "e500-ccsr",
OBJECT(dev), NULL);
qdev_init_nofail(dev);
ccsr = CCSR(dev);
ccsr_addr_space = &ccsr->ccsr_space;
memory_region_add_subregion(address_space_mem, MPC8544_CCSRBAR_BASE,
ccsr_addr_space);
mpic = ppce500_init_mpic(params, ccsr_addr_space, irqs);
/* Serial */
if (serial_hds[0]) {
serial_mm_init(ccsr_addr_space, MPC8544_SERIAL0_REGS_OFFSET,
0, mpic[42], 399193,
serial_hds[0], DEVICE_BIG_ENDIAN);
}
if (serial_hds[1]) {
serial_mm_init(ccsr_addr_space, MPC8544_SERIAL1_REGS_OFFSET,
0, mpic[42], 399193,
serial_hds[1], DEVICE_BIG_ENDIAN);
}
/* General Utility device */
dev = qdev_create(NULL, "mpc8544-guts");
qdev_init_nofail(dev);
s = SYS_BUS_DEVICE(dev);
memory_region_add_subregion(ccsr_addr_space, MPC8544_UTIL_OFFSET,
sysbus_mmio_get_region(s, 0));
/* PCI */
dev = qdev_create(NULL, "e500-pcihost");
qdev_prop_set_uint32(dev, "first_slot", params->pci_first_slot);
qdev_prop_set_uint32(dev, "first_pin_irq", pci_irq_nrs[0]);
qdev_init_nofail(dev);
s = SYS_BUS_DEVICE(dev);
for (i = 0; i < PCI_NUM_PINS; i++) {
sysbus_connect_irq(s, i, mpic[pci_irq_nrs[i]]);
}
memory_region_add_subregion(ccsr_addr_space, MPC8544_PCI_REGS_OFFSET,
sysbus_mmio_get_region(s, 0));
pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci.0");
if (!pci_bus)
printf("couldn't create PCI controller!\n");
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, MPC8544_PCI_IO);
if (pci_bus) {
/* Register network interfaces. */
for (i = 0; i < nb_nics; i++) {
pci_nic_init_nofail(&nd_table[i], pci_bus, "virtio", NULL);
}
}
/* Register spinning region */
sysbus_create_simple("e500-spin", MPC8544_SPIN_BASE, NULL);
/* Load kernel. */
if (machine->kernel_filename) {
kernel_size = load_uimage(machine->kernel_filename, &entry,
&loadaddr, NULL);
if (kernel_size < 0) {
kernel_size = load_elf(machine->kernel_filename, NULL, NULL,
&elf_entry, &elf_lowaddr, NULL, 1,
ELF_MACHINE, 0);
entry = elf_entry;
loadaddr = elf_lowaddr;
}
/* XXX try again as binary */
if (kernel_size < 0) {
fprintf(stderr, "qemu: could not load kernel '%s'\n",
machine->kernel_filename);
exit(1);
}
cur_base = loadaddr + kernel_size;
/* Reserve space for dtb */
dt_base = (cur_base + DTC_LOAD_PAD) & ~DTC_PAD_MASK;
cur_base += DTB_MAX_SIZE;
}
/* Load initrd. */
if (machine->initrd_filename) {
initrd_base = (cur_base + INITRD_LOAD_PAD) & ~INITRD_PAD_MASK;
initrd_size = load_image_targphys(machine->initrd_filename, initrd_base,
ram_size - initrd_base);
if (initrd_size < 0) {
fprintf(stderr, "qemu: could not load initial ram disk '%s'\n",
machine->initrd_filename);
exit(1);
}
cur_base = initrd_base + initrd_size;
}
/* If we're loading a kernel directly, we must load the device tree too. */
if (machine->kernel_filename) {
struct boot_info *boot_info;
int dt_size;
dt_size = ppce500_prep_device_tree(machine, params, dt_base,
initrd_base, initrd_size);
if (dt_size < 0) {
fprintf(stderr, "couldn't load device tree\n");
exit(1);
}
assert(dt_size < DTB_MAX_SIZE);
boot_info = env->load_info;
boot_info->entry = entry;
boot_info->dt_base = dt_base;
boot_info->dt_size = dt_size;
}
if (kvm_enabled()) {
kvmppc_init();
}
}
| false |
qemu
|
903585dec63ee83bd8149006e31f92ea789b38e3
|
void ppce500_init(MachineState *machine, PPCE500Params *params)
{
MemoryRegion *address_space_mem = get_system_memory();
MemoryRegion *ram = g_new(MemoryRegion, 1);
PCIBus *pci_bus;
CPUPPCState *env = NULL;
uint64_t elf_entry;
uint64_t elf_lowaddr;
hwaddr entry=0;
hwaddr loadaddr=UIMAGE_LOAD_BASE;
target_long kernel_size=0;
target_ulong dt_base = 0;
target_ulong initrd_base = 0;
target_long initrd_size = 0;
target_ulong cur_base = 0;
int i;
unsigned int pci_irq_nrs[PCI_NUM_PINS] = {1, 2, 3, 4};
qemu_irq **irqs, *mpic;
DeviceState *dev;
CPUPPCState *firstenv = NULL;
MemoryRegion *ccsr_addr_space;
SysBusDevice *s;
PPCE500CCSRState *ccsr;
if (machine->cpu_model == NULL) {
machine->cpu_model = "e500v2_v30";
}
irqs = g_malloc0(smp_cpus * sizeof(qemu_irq *));
irqs[0] = g_malloc0(smp_cpus * sizeof(qemu_irq) * OPENPIC_OUTPUT_NB);
for (i = 0; i < smp_cpus; i++) {
PowerPCCPU *cpu;
CPUState *cs;
qemu_irq *input;
cpu = cpu_ppc_init(machine->cpu_model);
if (cpu == NULL) {
fprintf(stderr, "Unable to initialize CPU!\n");
exit(1);
}
env = &cpu->env;
cs = CPU(cpu);
if (!firstenv) {
firstenv = env;
}
irqs[i] = irqs[0] + (i * OPENPIC_OUTPUT_NB);
input = (qemu_irq *)env->irq_inputs;
irqs[i][OPENPIC_OUTPUT_INT] = input[PPCE500_INPUT_INT];
irqs[i][OPENPIC_OUTPUT_CINT] = input[PPCE500_INPUT_CINT];
env->spr_cb[SPR_BOOKE_PIR].default_value = cs->cpu_index = i;
env->mpic_iack = MPC8544_CCSRBAR_BASE +
MPC8544_MPIC_REGS_OFFSET + 0xa0;
ppc_booke_timers_init(cpu, 400000000, PPC_TIMER_E500);
if (!i) {
struct boot_info *boot_info;
boot_info = g_malloc0(sizeof(struct boot_info));
qemu_register_reset(ppce500_cpu_reset, cpu);
env->load_info = boot_info;
} else {
qemu_register_reset(ppce500_cpu_reset_sec, cpu);
}
}
env = firstenv;
ram_size &= ~(RAM_SIZES_ALIGN - 1);
machine->ram_size = ram_size;
memory_region_init_ram(ram, NULL, "mpc8544ds.ram", ram_size);
vmstate_register_ram_global(ram);
memory_region_add_subregion(address_space_mem, 0, ram);
dev = qdev_create(NULL, "e500-ccsr");
object_property_add_child(qdev_get_machine(), "e500-ccsr",
OBJECT(dev), NULL);
qdev_init_nofail(dev);
ccsr = CCSR(dev);
ccsr_addr_space = &ccsr->ccsr_space;
memory_region_add_subregion(address_space_mem, MPC8544_CCSRBAR_BASE,
ccsr_addr_space);
mpic = ppce500_init_mpic(params, ccsr_addr_space, irqs);
if (serial_hds[0]) {
serial_mm_init(ccsr_addr_space, MPC8544_SERIAL0_REGS_OFFSET,
0, mpic[42], 399193,
serial_hds[0], DEVICE_BIG_ENDIAN);
}
if (serial_hds[1]) {
serial_mm_init(ccsr_addr_space, MPC8544_SERIAL1_REGS_OFFSET,
0, mpic[42], 399193,
serial_hds[1], DEVICE_BIG_ENDIAN);
}
dev = qdev_create(NULL, "mpc8544-guts");
qdev_init_nofail(dev);
s = SYS_BUS_DEVICE(dev);
memory_region_add_subregion(ccsr_addr_space, MPC8544_UTIL_OFFSET,
sysbus_mmio_get_region(s, 0));
dev = qdev_create(NULL, "e500-pcihost");
qdev_prop_set_uint32(dev, "first_slot", params->pci_first_slot);
qdev_prop_set_uint32(dev, "first_pin_irq", pci_irq_nrs[0]);
qdev_init_nofail(dev);
s = SYS_BUS_DEVICE(dev);
for (i = 0; i < PCI_NUM_PINS; i++) {
sysbus_connect_irq(s, i, mpic[pci_irq_nrs[i]]);
}
memory_region_add_subregion(ccsr_addr_space, MPC8544_PCI_REGS_OFFSET,
sysbus_mmio_get_region(s, 0));
pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci.0");
if (!pci_bus)
printf("couldn't create PCI controller!\n");
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, MPC8544_PCI_IO);
if (pci_bus) {
for (i = 0; i < nb_nics; i++) {
pci_nic_init_nofail(&nd_table[i], pci_bus, "virtio", NULL);
}
}
sysbus_create_simple("e500-spin", MPC8544_SPIN_BASE, NULL);
if (machine->kernel_filename) {
kernel_size = load_uimage(machine->kernel_filename, &entry,
&loadaddr, NULL);
if (kernel_size < 0) {
kernel_size = load_elf(machine->kernel_filename, NULL, NULL,
&elf_entry, &elf_lowaddr, NULL, 1,
ELF_MACHINE, 0);
entry = elf_entry;
loadaddr = elf_lowaddr;
}
if (kernel_size < 0) {
fprintf(stderr, "qemu: could not load kernel '%s'\n",
machine->kernel_filename);
exit(1);
}
cur_base = loadaddr + kernel_size;
dt_base = (cur_base + DTC_LOAD_PAD) & ~DTC_PAD_MASK;
cur_base += DTB_MAX_SIZE;
}
if (machine->initrd_filename) {
initrd_base = (cur_base + INITRD_LOAD_PAD) & ~INITRD_PAD_MASK;
initrd_size = load_image_targphys(machine->initrd_filename, initrd_base,
ram_size - initrd_base);
if (initrd_size < 0) {
fprintf(stderr, "qemu: could not load initial ram disk '%s'\n",
machine->initrd_filename);
exit(1);
}
cur_base = initrd_base + initrd_size;
}
if (machine->kernel_filename) {
struct boot_info *boot_info;
int dt_size;
dt_size = ppce500_prep_device_tree(machine, params, dt_base,
initrd_base, initrd_size);
if (dt_size < 0) {
fprintf(stderr, "couldn't load device tree\n");
exit(1);
}
assert(dt_size < DTB_MAX_SIZE);
boot_info = env->load_info;
boot_info->entry = entry;
boot_info->dt_base = dt_base;
boot_info->dt_size = dt_size;
}
if (kvm_enabled()) {
kvmppc_init();
}
}
|
{
"code": [],
"line_no": []
}
|
void FUNC_0(MachineState *VAR_0, PPCE500Params *VAR_1)
{
MemoryRegion *address_space_mem = get_system_memory();
MemoryRegion *ram = g_new(MemoryRegion, 1);
PCIBus *pci_bus;
CPUPPCState *env = NULL;
uint64_t elf_entry;
uint64_t elf_lowaddr;
hwaddr entry=0;
hwaddr loadaddr=UIMAGE_LOAD_BASE;
target_long kernel_size=0;
target_ulong dt_base = 0;
target_ulong initrd_base = 0;
target_long initrd_size = 0;
target_ulong cur_base = 0;
int VAR_2;
unsigned int VAR_3[PCI_NUM_PINS] = {1, 2, 3, 4};
qemu_irq **irqs, *mpic;
DeviceState *dev;
CPUPPCState *firstenv = NULL;
MemoryRegion *ccsr_addr_space;
SysBusDevice *s;
PPCE500CCSRState *ccsr;
if (VAR_0->cpu_model == NULL) {
VAR_0->cpu_model = "e500v2_v30";
}
irqs = g_malloc0(smp_cpus * sizeof(qemu_irq *));
irqs[0] = g_malloc0(smp_cpus * sizeof(qemu_irq) * OPENPIC_OUTPUT_NB);
for (VAR_2 = 0; VAR_2 < smp_cpus; VAR_2++) {
PowerPCCPU *cpu;
CPUState *cs;
qemu_irq *input;
cpu = cpu_ppc_init(VAR_0->cpu_model);
if (cpu == NULL) {
fprintf(stderr, "Unable to initialize CPU!\n");
exit(1);
}
env = &cpu->env;
cs = CPU(cpu);
if (!firstenv) {
firstenv = env;
}
irqs[VAR_2] = irqs[0] + (VAR_2 * OPENPIC_OUTPUT_NB);
input = (qemu_irq *)env->irq_inputs;
irqs[VAR_2][OPENPIC_OUTPUT_INT] = input[PPCE500_INPUT_INT];
irqs[VAR_2][OPENPIC_OUTPUT_CINT] = input[PPCE500_INPUT_CINT];
env->spr_cb[SPR_BOOKE_PIR].default_value = cs->cpu_index = VAR_2;
env->mpic_iack = MPC8544_CCSRBAR_BASE +
MPC8544_MPIC_REGS_OFFSET + 0xa0;
ppc_booke_timers_init(cpu, 400000000, PPC_TIMER_E500);
if (!VAR_2) {
struct VAR_4 *VAR_4;
VAR_4 = g_malloc0(sizeof(struct VAR_4));
qemu_register_reset(ppce500_cpu_reset, cpu);
env->load_info = VAR_4;
} else {
qemu_register_reset(ppce500_cpu_reset_sec, cpu);
}
}
env = firstenv;
ram_size &= ~(RAM_SIZES_ALIGN - 1);
VAR_0->ram_size = ram_size;
memory_region_init_ram(ram, NULL, "mpc8544ds.ram", ram_size);
vmstate_register_ram_global(ram);
memory_region_add_subregion(address_space_mem, 0, ram);
dev = qdev_create(NULL, "e500-ccsr");
object_property_add_child(qdev_get_machine(), "e500-ccsr",
OBJECT(dev), NULL);
qdev_init_nofail(dev);
ccsr = CCSR(dev);
ccsr_addr_space = &ccsr->ccsr_space;
memory_region_add_subregion(address_space_mem, MPC8544_CCSRBAR_BASE,
ccsr_addr_space);
mpic = ppce500_init_mpic(VAR_1, ccsr_addr_space, irqs);
if (serial_hds[0]) {
serial_mm_init(ccsr_addr_space, MPC8544_SERIAL0_REGS_OFFSET,
0, mpic[42], 399193,
serial_hds[0], DEVICE_BIG_ENDIAN);
}
if (serial_hds[1]) {
serial_mm_init(ccsr_addr_space, MPC8544_SERIAL1_REGS_OFFSET,
0, mpic[42], 399193,
serial_hds[1], DEVICE_BIG_ENDIAN);
}
dev = qdev_create(NULL, "mpc8544-guts");
qdev_init_nofail(dev);
s = SYS_BUS_DEVICE(dev);
memory_region_add_subregion(ccsr_addr_space, MPC8544_UTIL_OFFSET,
sysbus_mmio_get_region(s, 0));
dev = qdev_create(NULL, "e500-pcihost");
qdev_prop_set_uint32(dev, "first_slot", VAR_1->pci_first_slot);
qdev_prop_set_uint32(dev, "first_pin_irq", VAR_3[0]);
qdev_init_nofail(dev);
s = SYS_BUS_DEVICE(dev);
for (VAR_2 = 0; VAR_2 < PCI_NUM_PINS; VAR_2++) {
sysbus_connect_irq(s, VAR_2, mpic[VAR_3[VAR_2]]);
}
memory_region_add_subregion(ccsr_addr_space, MPC8544_PCI_REGS_OFFSET,
sysbus_mmio_get_region(s, 0));
pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci.0");
if (!pci_bus)
printf("couldn't create PCI controller!\n");
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, MPC8544_PCI_IO);
if (pci_bus) {
for (VAR_2 = 0; VAR_2 < nb_nics; VAR_2++) {
pci_nic_init_nofail(&nd_table[VAR_2], pci_bus, "virtio", NULL);
}
}
sysbus_create_simple("e500-spin", MPC8544_SPIN_BASE, NULL);
if (VAR_0->kernel_filename) {
kernel_size = load_uimage(VAR_0->kernel_filename, &entry,
&loadaddr, NULL);
if (kernel_size < 0) {
kernel_size = load_elf(VAR_0->kernel_filename, NULL, NULL,
&elf_entry, &elf_lowaddr, NULL, 1,
ELF_MACHINE, 0);
entry = elf_entry;
loadaddr = elf_lowaddr;
}
if (kernel_size < 0) {
fprintf(stderr, "qemu: could not load kernel '%s'\n",
VAR_0->kernel_filename);
exit(1);
}
cur_base = loadaddr + kernel_size;
dt_base = (cur_base + DTC_LOAD_PAD) & ~DTC_PAD_MASK;
cur_base += DTB_MAX_SIZE;
}
if (VAR_0->initrd_filename) {
initrd_base = (cur_base + INITRD_LOAD_PAD) & ~INITRD_PAD_MASK;
initrd_size = load_image_targphys(VAR_0->initrd_filename, initrd_base,
ram_size - initrd_base);
if (initrd_size < 0) {
fprintf(stderr, "qemu: could not load initial ram disk '%s'\n",
VAR_0->initrd_filename);
exit(1);
}
cur_base = initrd_base + initrd_size;
}
if (VAR_0->kernel_filename) {
struct VAR_4 *VAR_4;
int VAR_5;
VAR_5 = ppce500_prep_device_tree(VAR_0, VAR_1, dt_base,
initrd_base, initrd_size);
if (VAR_5 < 0) {
fprintf(stderr, "couldn't load device tree\n");
exit(1);
}
assert(VAR_5 < DTB_MAX_SIZE);
VAR_4 = env->load_info;
VAR_4->entry = entry;
VAR_4->dt_base = dt_base;
VAR_4->VAR_5 = VAR_5;
}
if (kvm_enabled()) {
kvmppc_init();
}
}
|
[
"void FUNC_0(MachineState *VAR_0, PPCE500Params *VAR_1)\n{",
"MemoryRegion *address_space_mem = get_system_memory();",
"MemoryRegion *ram = g_new(MemoryRegion, 1);",
"PCIBus *pci_bus;",
"CPUPPCState *env = NULL;",
"uint64_t elf_entry;",
"uint64_t elf_lowaddr;",
"hwaddr entry=0;",
"hwaddr loadaddr=UIMAGE_LOAD_BASE;",
"target_long kernel_size=0;",
"target_ulong dt_base = 0;",
"target_ulong initrd_base = 0;",
"target_long initrd_size = 0;",
"target_ulong cur_base = 0;",
"int VAR_2;",
"unsigned int VAR_3[PCI_NUM_PINS] = {1, 2, 3, 4};",
"qemu_irq **irqs, *mpic;",
"DeviceState *dev;",
"CPUPPCState *firstenv = NULL;",
"MemoryRegion *ccsr_addr_space;",
"SysBusDevice *s;",
"PPCE500CCSRState *ccsr;",
"if (VAR_0->cpu_model == NULL) {",
"VAR_0->cpu_model = \"e500v2_v30\";",
"}",
"irqs = g_malloc0(smp_cpus * sizeof(qemu_irq *));",
"irqs[0] = g_malloc0(smp_cpus * sizeof(qemu_irq) * OPENPIC_OUTPUT_NB);",
"for (VAR_2 = 0; VAR_2 < smp_cpus; VAR_2++) {",
"PowerPCCPU *cpu;",
"CPUState *cs;",
"qemu_irq *input;",
"cpu = cpu_ppc_init(VAR_0->cpu_model);",
"if (cpu == NULL) {",
"fprintf(stderr, \"Unable to initialize CPU!\\n\");",
"exit(1);",
"}",
"env = &cpu->env;",
"cs = CPU(cpu);",
"if (!firstenv) {",
"firstenv = env;",
"}",
"irqs[VAR_2] = irqs[0] + (VAR_2 * OPENPIC_OUTPUT_NB);",
"input = (qemu_irq *)env->irq_inputs;",
"irqs[VAR_2][OPENPIC_OUTPUT_INT] = input[PPCE500_INPUT_INT];",
"irqs[VAR_2][OPENPIC_OUTPUT_CINT] = input[PPCE500_INPUT_CINT];",
"env->spr_cb[SPR_BOOKE_PIR].default_value = cs->cpu_index = VAR_2;",
"env->mpic_iack = MPC8544_CCSRBAR_BASE +\nMPC8544_MPIC_REGS_OFFSET + 0xa0;",
"ppc_booke_timers_init(cpu, 400000000, PPC_TIMER_E500);",
"if (!VAR_2) {",
"struct VAR_4 *VAR_4;",
"VAR_4 = g_malloc0(sizeof(struct VAR_4));",
"qemu_register_reset(ppce500_cpu_reset, cpu);",
"env->load_info = VAR_4;",
"} else {",
"qemu_register_reset(ppce500_cpu_reset_sec, cpu);",
"}",
"}",
"env = firstenv;",
"ram_size &= ~(RAM_SIZES_ALIGN - 1);",
"VAR_0->ram_size = ram_size;",
"memory_region_init_ram(ram, NULL, \"mpc8544ds.ram\", ram_size);",
"vmstate_register_ram_global(ram);",
"memory_region_add_subregion(address_space_mem, 0, ram);",
"dev = qdev_create(NULL, \"e500-ccsr\");",
"object_property_add_child(qdev_get_machine(), \"e500-ccsr\",\nOBJECT(dev), NULL);",
"qdev_init_nofail(dev);",
"ccsr = CCSR(dev);",
"ccsr_addr_space = &ccsr->ccsr_space;",
"memory_region_add_subregion(address_space_mem, MPC8544_CCSRBAR_BASE,\nccsr_addr_space);",
"mpic = ppce500_init_mpic(VAR_1, ccsr_addr_space, irqs);",
"if (serial_hds[0]) {",
"serial_mm_init(ccsr_addr_space, MPC8544_SERIAL0_REGS_OFFSET,\n0, mpic[42], 399193,\nserial_hds[0], DEVICE_BIG_ENDIAN);",
"}",
"if (serial_hds[1]) {",
"serial_mm_init(ccsr_addr_space, MPC8544_SERIAL1_REGS_OFFSET,\n0, mpic[42], 399193,\nserial_hds[1], DEVICE_BIG_ENDIAN);",
"}",
"dev = qdev_create(NULL, \"mpc8544-guts\");",
"qdev_init_nofail(dev);",
"s = SYS_BUS_DEVICE(dev);",
"memory_region_add_subregion(ccsr_addr_space, MPC8544_UTIL_OFFSET,\nsysbus_mmio_get_region(s, 0));",
"dev = qdev_create(NULL, \"e500-pcihost\");",
"qdev_prop_set_uint32(dev, \"first_slot\", VAR_1->pci_first_slot);",
"qdev_prop_set_uint32(dev, \"first_pin_irq\", VAR_3[0]);",
"qdev_init_nofail(dev);",
"s = SYS_BUS_DEVICE(dev);",
"for (VAR_2 = 0; VAR_2 < PCI_NUM_PINS; VAR_2++) {",
"sysbus_connect_irq(s, VAR_2, mpic[VAR_3[VAR_2]]);",
"}",
"memory_region_add_subregion(ccsr_addr_space, MPC8544_PCI_REGS_OFFSET,\nsysbus_mmio_get_region(s, 0));",
"pci_bus = (PCIBus *)qdev_get_child_bus(dev, \"pci.0\");",
"if (!pci_bus)\nprintf(\"couldn't create PCI controller!\\n\");",
"sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, MPC8544_PCI_IO);",
"if (pci_bus) {",
"for (VAR_2 = 0; VAR_2 < nb_nics; VAR_2++) {",
"pci_nic_init_nofail(&nd_table[VAR_2], pci_bus, \"virtio\", NULL);",
"}",
"}",
"sysbus_create_simple(\"e500-spin\", MPC8544_SPIN_BASE, NULL);",
"if (VAR_0->kernel_filename) {",
"kernel_size = load_uimage(VAR_0->kernel_filename, &entry,\n&loadaddr, NULL);",
"if (kernel_size < 0) {",
"kernel_size = load_elf(VAR_0->kernel_filename, NULL, NULL,\n&elf_entry, &elf_lowaddr, NULL, 1,\nELF_MACHINE, 0);",
"entry = elf_entry;",
"loadaddr = elf_lowaddr;",
"}",
"if (kernel_size < 0) {",
"fprintf(stderr, \"qemu: could not load kernel '%s'\\n\",\nVAR_0->kernel_filename);",
"exit(1);",
"}",
"cur_base = loadaddr + kernel_size;",
"dt_base = (cur_base + DTC_LOAD_PAD) & ~DTC_PAD_MASK;",
"cur_base += DTB_MAX_SIZE;",
"}",
"if (VAR_0->initrd_filename) {",
"initrd_base = (cur_base + INITRD_LOAD_PAD) & ~INITRD_PAD_MASK;",
"initrd_size = load_image_targphys(VAR_0->initrd_filename, initrd_base,\nram_size - initrd_base);",
"if (initrd_size < 0) {",
"fprintf(stderr, \"qemu: could not load initial ram disk '%s'\\n\",\nVAR_0->initrd_filename);",
"exit(1);",
"}",
"cur_base = initrd_base + initrd_size;",
"}",
"if (VAR_0->kernel_filename) {",
"struct VAR_4 *VAR_4;",
"int VAR_5;",
"VAR_5 = ppce500_prep_device_tree(VAR_0, VAR_1, dt_base,\ninitrd_base, initrd_size);",
"if (VAR_5 < 0) {",
"fprintf(stderr, \"couldn't load device tree\\n\");",
"exit(1);",
"}",
"assert(VAR_5 < DTB_MAX_SIZE);",
"VAR_4 = env->load_info;",
"VAR_4->entry = entry;",
"VAR_4->dt_base = dt_base;",
"VAR_4->VAR_5 = VAR_5;",
"}",
"if (kvm_enabled()) {",
"kvmppc_init();",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
55
],
[
57
],
[
59
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
93
],
[
95
],
[
97
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111,
113
],
[
117
],
[
123
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
139
],
[
141
],
[
143
],
[
147
],
[
153
],
[
155
],
[
161
],
[
163
],
[
165
],
[
169
],
[
171,
173
],
[
175
],
[
177
],
[
179
],
[
181,
183
],
[
187
],
[
193
],
[
195,
197,
199
],
[
201
],
[
205
],
[
207,
209,
211
],
[
213
],
[
219
],
[
221
],
[
223
],
[
225,
227
],
[
233
],
[
235
],
[
237
],
[
239
],
[
241
],
[
243
],
[
245
],
[
247
],
[
251,
253
],
[
257
],
[
259,
261
],
[
265
],
[
269
],
[
273
],
[
275
],
[
277
],
[
279
],
[
285
],
[
291
],
[
293,
295
],
[
297
],
[
299,
301,
303
],
[
305
],
[
307
],
[
309
],
[
313
],
[
315,
317
],
[
319
],
[
321
],
[
325
],
[
331
],
[
333
],
[
335
],
[
341
],
[
343
],
[
345,
347
],
[
351
],
[
353,
355
],
[
357
],
[
359
],
[
363
],
[
365
],
[
371
],
[
373
],
[
375
],
[
379,
381
],
[
383
],
[
385
],
[
387
],
[
389
],
[
391
],
[
395
],
[
397
],
[
399
],
[
401
],
[
403
],
[
407
],
[
409
],
[
411
],
[
413
]
] |
9,682 |
static void virtio_net_set_mrg_rx_bufs(VirtIONet *n, int mergeable_rx_bufs)
{
int i;
NetClientState *nc;
n->mergeable_rx_bufs = mergeable_rx_bufs;
n->guest_hdr_len = n->mergeable_rx_bufs ?
sizeof(struct virtio_net_hdr_mrg_rxbuf) : sizeof(struct virtio_net_hdr);
for (i = 0; i < n->max_queues; i++) {
nc = qemu_get_subqueue(n->nic, i);
if (peer_has_vnet_hdr(n) &&
tap_has_vnet_hdr_len(nc->peer, n->guest_hdr_len)) {
tap_set_vnet_hdr_len(nc->peer, n->guest_hdr_len);
n->host_hdr_len = n->guest_hdr_len;
}
}
}
| false |
qemu
|
cf528b89580797050b8cf60fee6247f35531a675
|
static void virtio_net_set_mrg_rx_bufs(VirtIONet *n, int mergeable_rx_bufs)
{
int i;
NetClientState *nc;
n->mergeable_rx_bufs = mergeable_rx_bufs;
n->guest_hdr_len = n->mergeable_rx_bufs ?
sizeof(struct virtio_net_hdr_mrg_rxbuf) : sizeof(struct virtio_net_hdr);
for (i = 0; i < n->max_queues; i++) {
nc = qemu_get_subqueue(n->nic, i);
if (peer_has_vnet_hdr(n) &&
tap_has_vnet_hdr_len(nc->peer, n->guest_hdr_len)) {
tap_set_vnet_hdr_len(nc->peer, n->guest_hdr_len);
n->host_hdr_len = n->guest_hdr_len;
}
}
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(VirtIONet *VAR_0, int VAR_1)
{
int VAR_2;
NetClientState *nc;
VAR_0->VAR_1 = VAR_1;
VAR_0->guest_hdr_len = VAR_0->VAR_1 ?
sizeof(struct virtio_net_hdr_mrg_rxbuf) : sizeof(struct virtio_net_hdr);
for (VAR_2 = 0; VAR_2 < VAR_0->max_queues; VAR_2++) {
nc = qemu_get_subqueue(VAR_0->nic, VAR_2);
if (peer_has_vnet_hdr(VAR_0) &&
tap_has_vnet_hdr_len(nc->peer, VAR_0->guest_hdr_len)) {
tap_set_vnet_hdr_len(nc->peer, VAR_0->guest_hdr_len);
VAR_0->host_hdr_len = VAR_0->guest_hdr_len;
}
}
}
|
[
"static void FUNC_0(VirtIONet *VAR_0, int VAR_1)\n{",
"int VAR_2;",
"NetClientState *nc;",
"VAR_0->VAR_1 = VAR_1;",
"VAR_0->guest_hdr_len = VAR_0->VAR_1 ?\nsizeof(struct virtio_net_hdr_mrg_rxbuf) : sizeof(struct virtio_net_hdr);",
"for (VAR_2 = 0; VAR_2 < VAR_0->max_queues; VAR_2++) {",
"nc = qemu_get_subqueue(VAR_0->nic, VAR_2);",
"if (peer_has_vnet_hdr(VAR_0) &&\ntap_has_vnet_hdr_len(nc->peer, VAR_0->guest_hdr_len)) {",
"tap_set_vnet_hdr_len(nc->peer, VAR_0->guest_hdr_len);",
"VAR_0->host_hdr_len = VAR_0->guest_hdr_len;",
"}",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
15,
17
],
[
21
],
[
23
],
[
27,
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
]
] |
9,684 |
void qemu_acl_reset(qemu_acl *acl)
{
qemu_acl_entry *entry;
/* Put back to deny by default, so there is no window
* of "open access" while the user re-initializes the
* access control list */
acl->defaultDeny = 1;
TAILQ_FOREACH(entry, &acl->entries, next) {
TAILQ_REMOVE(&acl->entries, entry, next);
free(entry->match);
free(entry);
}
acl->nentries = 0;
}
| false |
qemu
|
72cf2d4f0e181d0d3a3122e04129c58a95da713e
|
void qemu_acl_reset(qemu_acl *acl)
{
qemu_acl_entry *entry;
acl->defaultDeny = 1;
TAILQ_FOREACH(entry, &acl->entries, next) {
TAILQ_REMOVE(&acl->entries, entry, next);
free(entry->match);
free(entry);
}
acl->nentries = 0;
}
|
{
"code": [],
"line_no": []
}
|
void FUNC_0(qemu_acl *VAR_0)
{
qemu_acl_entry *entry;
VAR_0->defaultDeny = 1;
TAILQ_FOREACH(entry, &VAR_0->entries, next) {
TAILQ_REMOVE(&VAR_0->entries, entry, next);
free(entry->match);
free(entry);
}
VAR_0->nentries = 0;
}
|
[
"void FUNC_0(qemu_acl *VAR_0)\n{",
"qemu_acl_entry *entry;",
"VAR_0->defaultDeny = 1;",
"TAILQ_FOREACH(entry, &VAR_0->entries, next) {",
"TAILQ_REMOVE(&VAR_0->entries, entry, next);",
"free(entry->match);",
"free(entry);",
"}",
"VAR_0->nentries = 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
]
] |
9,685 |
static void mov_fix_index(MOVContext *mov, AVStream *st)
{
MOVStreamContext *msc = st->priv_data;
AVIndexEntry *e_old = st->index_entries;
int nb_old = st->nb_index_entries;
const AVIndexEntry *e_old_end = e_old + nb_old;
const AVIndexEntry *current = NULL;
MOVStts *ctts_data_old = msc->ctts_data;
int64_t ctts_index_old = 0;
int64_t ctts_sample_old = 0;
int64_t ctts_count_old = msc->ctts_count;
int64_t edit_list_media_time = 0;
int64_t edit_list_duration = 0;
int64_t frame_duration = 0;
int64_t edit_list_dts_counter = 0;
int64_t edit_list_dts_entry_end = 0;
int64_t edit_list_start_ctts_sample = 0;
int64_t curr_cts;
int64_t edit_list_index = 0;
int64_t index;
int64_t index_ctts_count;
int flags;
unsigned int ctts_allocated_size = 0;
int64_t start_dts = 0;
int64_t edit_list_media_time_dts = 0;
int64_t edit_list_start_encountered = 0;
int64_t search_timestamp = 0;
int64_t* frame_duration_buffer = NULL;
int num_discarded_begin = 0;
int first_non_zero_audio_edit = -1;
int packet_skip_samples = 0;
MOVIndexRange *current_index_range;
if (!msc->elst_data || msc->elst_count <= 0 || nb_old <= 0) {
return;
}
// allocate the index ranges array
msc->index_ranges = av_malloc((msc->elst_count + 1) * sizeof(msc->index_ranges[0]));
if (!msc->index_ranges) {
av_log(mov->fc, AV_LOG_ERROR, "Cannot allocate index ranges buffer\n");
return;
}
msc->current_index_range = msc->index_ranges;
current_index_range = msc->index_ranges - 1;
// Clean AVStream from traces of old index
st->index_entries = NULL;
st->index_entries_allocated_size = 0;
st->nb_index_entries = 0;
// Clean ctts fields of MOVStreamContext
msc->ctts_data = NULL;
msc->ctts_count = 0;
msc->ctts_index = 0;
msc->ctts_sample = 0;
// If the dts_shift is positive (in case of negative ctts values in mov),
// then negate the DTS by dts_shift
if (msc->dts_shift > 0)
edit_list_dts_entry_end -= msc->dts_shift;
// Offset the DTS by ctts[0] to make the PTS of the first frame 0
if (ctts_data_old && ctts_count_old > 0) {
edit_list_dts_entry_end -= ctts_data_old[0].duration;
av_log(mov->fc, AV_LOG_DEBUG, "Offset DTS by ctts[%d].duration: %d\n", 0, ctts_data_old[0].duration);
}
start_dts = edit_list_dts_entry_end;
while (get_edit_list_entry(mov, msc, edit_list_index, &edit_list_media_time,
&edit_list_duration, mov->time_scale)) {
av_log(mov->fc, AV_LOG_DEBUG, "Processing st: %d, edit list %"PRId64" - media time: %"PRId64", duration: %"PRId64"\n",
st->index, edit_list_index, edit_list_media_time, edit_list_duration);
edit_list_index++;
edit_list_dts_counter = edit_list_dts_entry_end;
edit_list_dts_entry_end += edit_list_duration;
num_discarded_begin = 0;
if (edit_list_media_time == -1) {
continue;
}
// If we encounter a non-negative edit list reset the skip_samples/start_pad fields and set them
// according to the edit list below.
if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
if (first_non_zero_audio_edit < 0) {
first_non_zero_audio_edit = 1;
} else {
first_non_zero_audio_edit = 0;
}
if (first_non_zero_audio_edit > 0)
st->skip_samples = msc->start_pad = 0;
}
//find closest previous key frame
edit_list_media_time_dts = edit_list_media_time;
if (msc->dts_shift > 0) {
edit_list_media_time_dts -= msc->dts_shift;
}
// While reordering frame index according to edit list we must handle properly
// the scenario when edit list entry starts from none key frame.
// We find closest previous key frame and preserve it and consequent frames in index.
// All frames which are outside edit list entry time boundaries will be dropped after decoding.
search_timestamp = edit_list_media_time_dts;
if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
// Audio decoders like AAC need need a decoder delay samples previous to the current sample,
// to correctly decode this frame. Hence for audio we seek to a frame 1 sec. before the
// edit_list_media_time to cover the decoder delay.
search_timestamp = FFMAX(search_timestamp - msc->time_scale, e_old[0].timestamp);
}
index = find_prev_closest_index(st, e_old, nb_old, search_timestamp, 0);
if (index == -1) {
av_log(mov->fc, AV_LOG_WARNING,
"st: %d edit list: %"PRId64" Missing key frame while searching for timestamp: %"PRId64"\n",
st->index, edit_list_index, search_timestamp);
index = find_prev_closest_index(st, e_old, nb_old, search_timestamp, AVSEEK_FLAG_ANY);
if (index == -1) {
av_log(mov->fc, AV_LOG_WARNING,
"st: %d edit list %"PRId64" Cannot find an index entry before timestamp: %"PRId64".\n"
"Rounding edit list media time to zero.\n",
st->index, edit_list_index, search_timestamp);
index = 0;
edit_list_media_time = 0;
}
}
current = e_old + index;
ctts_index_old = 0;
ctts_sample_old = 0;
// set ctts_index properly for the found key frame
for (index_ctts_count = 0; index_ctts_count < index; index_ctts_count++) {
if (ctts_data_old && ctts_index_old < ctts_count_old) {
ctts_sample_old++;
if (ctts_data_old[ctts_index_old].count == ctts_sample_old) {
ctts_index_old++;
ctts_sample_old = 0;
}
}
}
edit_list_start_ctts_sample = ctts_sample_old;
// Iterate over index and arrange it according to edit list
edit_list_start_encountered = 0;
for (; current < e_old_end; current++, index++) {
// check if frame outside edit list mark it for discard
frame_duration = (current + 1 < e_old_end) ?
((current + 1)->timestamp - current->timestamp) : edit_list_duration;
flags = current->flags;
// frames (pts) before or after edit list
curr_cts = current->timestamp + msc->dts_shift;
if (ctts_data_old && ctts_index_old < ctts_count_old) {
av_log(mov->fc, AV_LOG_DEBUG, "shifted frame pts, curr_cts: %"PRId64" @ %"PRId64", ctts: %d, ctts_count: %"PRId64"\n",
curr_cts, ctts_index_old, ctts_data_old[ctts_index_old].duration, ctts_count_old);
curr_cts += ctts_data_old[ctts_index_old].duration;
ctts_sample_old++;
if (ctts_sample_old == ctts_data_old[ctts_index_old].count) {
if (add_ctts_entry(&msc->ctts_data, &msc->ctts_count,
&ctts_allocated_size,
ctts_data_old[ctts_index_old].count - edit_list_start_ctts_sample,
ctts_data_old[ctts_index_old].duration) == -1) {
av_log(mov->fc, AV_LOG_ERROR, "Cannot add CTTS entry %"PRId64" - {%"PRId64", %d}\n",
ctts_index_old,
ctts_data_old[ctts_index_old].count - edit_list_start_ctts_sample,
ctts_data_old[ctts_index_old].duration);
break;
}
ctts_index_old++;
ctts_sample_old = 0;
edit_list_start_ctts_sample = 0;
}
}
if (curr_cts < edit_list_media_time || curr_cts >= (edit_list_duration + edit_list_media_time)) {
if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && st->codecpar->codec_id != AV_CODEC_ID_VORBIS &&
curr_cts < edit_list_media_time && curr_cts + frame_duration > edit_list_media_time &&
first_non_zero_audio_edit > 0) {
packet_skip_samples = edit_list_media_time - curr_cts;
st->skip_samples += packet_skip_samples;
// Shift the index entry timestamp by packet_skip_samples to be correct.
edit_list_dts_counter -= packet_skip_samples;
if (edit_list_start_encountered == 0) {
edit_list_start_encountered = 1;
// Make timestamps strictly monotonically increasing for audio, by rewriting timestamps for
// discarded packets.
if (frame_duration_buffer) {
fix_index_entry_timestamps(st, st->nb_index_entries, edit_list_dts_counter,
frame_duration_buffer, num_discarded_begin);
av_freep(&frame_duration_buffer);
}
}
av_log(mov->fc, AV_LOG_DEBUG, "skip %d audio samples from curr_cts: %"PRId64"\n", packet_skip_samples, curr_cts);
} else {
flags |= AVINDEX_DISCARD_FRAME;
av_log(mov->fc, AV_LOG_DEBUG, "drop a frame at curr_cts: %"PRId64" @ %"PRId64"\n", curr_cts, index);
if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && edit_list_start_encountered == 0) {
num_discarded_begin++;
frame_duration_buffer = av_realloc(frame_duration_buffer,
num_discarded_begin * sizeof(int64_t));
if (!frame_duration_buffer) {
av_log(mov->fc, AV_LOG_ERROR, "Cannot reallocate frame duration buffer\n");
break;
}
frame_duration_buffer[num_discarded_begin - 1] = frame_duration;
// Increment skip_samples for the first non-zero audio edit list
if (first_non_zero_audio_edit > 0 && st->codecpar->codec_id != AV_CODEC_ID_VORBIS) {
st->skip_samples += frame_duration;
msc->start_pad = st->skip_samples;
}
}
}
} else if (edit_list_start_encountered == 0) {
edit_list_start_encountered = 1;
// Make timestamps strictly monotonically increasing for audio, by rewriting timestamps for
// discarded packets.
if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && frame_duration_buffer) {
fix_index_entry_timestamps(st, st->nb_index_entries, edit_list_dts_counter,
frame_duration_buffer, num_discarded_begin);
av_freep(&frame_duration_buffer);
}
}
if (add_index_entry(st, current->pos, edit_list_dts_counter, current->size,
current->min_distance, flags) == -1) {
av_log(mov->fc, AV_LOG_ERROR, "Cannot add index entry\n");
break;
}
// Update the index ranges array
if (current_index_range < msc->index_ranges || index != current_index_range->end) {
current_index_range++;
current_index_range->start = index;
}
current_index_range->end = index + 1;
// Only start incrementing DTS in frame_duration amounts, when we encounter a frame in edit list.
if (edit_list_start_encountered > 0) {
edit_list_dts_counter = edit_list_dts_counter + frame_duration;
}
// Break when found first key frame after edit entry completion
if (((curr_cts + frame_duration) >= (edit_list_duration + edit_list_media_time)) &&
((flags & AVINDEX_KEYFRAME) || ((st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)))) {
if (ctts_data_old && ctts_sample_old != 0) {
if (add_ctts_entry(&msc->ctts_data, &msc->ctts_count,
&ctts_allocated_size,
ctts_sample_old - edit_list_start_ctts_sample,
ctts_data_old[ctts_index_old].duration) == -1) {
av_log(mov->fc, AV_LOG_ERROR, "Cannot add CTTS entry %"PRId64" - {%"PRId64", %d}\n",
ctts_index_old, ctts_sample_old - edit_list_start_ctts_sample,
ctts_data_old[ctts_index_old].duration);
break;
}
}
break;
}
}
}
// Update av stream length
st->duration = edit_list_dts_entry_end - start_dts;
// Free the old index and the old CTTS structures
av_free(e_old);
av_free(ctts_data_old);
// Null terminate the index ranges array
current_index_range++;
current_index_range->start = 0;
current_index_range->end = 0;
msc->current_index = msc->index_ranges[0].start;
}
| false |
FFmpeg
|
93db5e3fc41ac0242acab86c3e4ce3a3dfb80075
|
static void mov_fix_index(MOVContext *mov, AVStream *st)
{
MOVStreamContext *msc = st->priv_data;
AVIndexEntry *e_old = st->index_entries;
int nb_old = st->nb_index_entries;
const AVIndexEntry *e_old_end = e_old + nb_old;
const AVIndexEntry *current = NULL;
MOVStts *ctts_data_old = msc->ctts_data;
int64_t ctts_index_old = 0;
int64_t ctts_sample_old = 0;
int64_t ctts_count_old = msc->ctts_count;
int64_t edit_list_media_time = 0;
int64_t edit_list_duration = 0;
int64_t frame_duration = 0;
int64_t edit_list_dts_counter = 0;
int64_t edit_list_dts_entry_end = 0;
int64_t edit_list_start_ctts_sample = 0;
int64_t curr_cts;
int64_t edit_list_index = 0;
int64_t index;
int64_t index_ctts_count;
int flags;
unsigned int ctts_allocated_size = 0;
int64_t start_dts = 0;
int64_t edit_list_media_time_dts = 0;
int64_t edit_list_start_encountered = 0;
int64_t search_timestamp = 0;
int64_t* frame_duration_buffer = NULL;
int num_discarded_begin = 0;
int first_non_zero_audio_edit = -1;
int packet_skip_samples = 0;
MOVIndexRange *current_index_range;
if (!msc->elst_data || msc->elst_count <= 0 || nb_old <= 0) {
return;
}
msc->index_ranges = av_malloc((msc->elst_count + 1) * sizeof(msc->index_ranges[0]));
if (!msc->index_ranges) {
av_log(mov->fc, AV_LOG_ERROR, "Cannot allocate index ranges buffer\n");
return;
}
msc->current_index_range = msc->index_ranges;
current_index_range = msc->index_ranges - 1;
st->index_entries = NULL;
st->index_entries_allocated_size = 0;
st->nb_index_entries = 0;
msc->ctts_data = NULL;
msc->ctts_count = 0;
msc->ctts_index = 0;
msc->ctts_sample = 0;
if (msc->dts_shift > 0)
edit_list_dts_entry_end -= msc->dts_shift;
if (ctts_data_old && ctts_count_old > 0) {
edit_list_dts_entry_end -= ctts_data_old[0].duration;
av_log(mov->fc, AV_LOG_DEBUG, "Offset DTS by ctts[%d].duration: %d\n", 0, ctts_data_old[0].duration);
}
start_dts = edit_list_dts_entry_end;
while (get_edit_list_entry(mov, msc, edit_list_index, &edit_list_media_time,
&edit_list_duration, mov->time_scale)) {
av_log(mov->fc, AV_LOG_DEBUG, "Processing st: %d, edit list %"PRId64" - media time: %"PRId64", duration: %"PRId64"\n",
st->index, edit_list_index, edit_list_media_time, edit_list_duration);
edit_list_index++;
edit_list_dts_counter = edit_list_dts_entry_end;
edit_list_dts_entry_end += edit_list_duration;
num_discarded_begin = 0;
if (edit_list_media_time == -1) {
continue;
}
if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
if (first_non_zero_audio_edit < 0) {
first_non_zero_audio_edit = 1;
} else {
first_non_zero_audio_edit = 0;
}
if (first_non_zero_audio_edit > 0)
st->skip_samples = msc->start_pad = 0;
}
edit_list_media_time_dts = edit_list_media_time;
if (msc->dts_shift > 0) {
edit_list_media_time_dts -= msc->dts_shift;
}
search_timestamp = edit_list_media_time_dts;
if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
search_timestamp = FFMAX(search_timestamp - msc->time_scale, e_old[0].timestamp);
}
index = find_prev_closest_index(st, e_old, nb_old, search_timestamp, 0);
if (index == -1) {
av_log(mov->fc, AV_LOG_WARNING,
"st: %d edit list: %"PRId64" Missing key frame while searching for timestamp: %"PRId64"\n",
st->index, edit_list_index, search_timestamp);
index = find_prev_closest_index(st, e_old, nb_old, search_timestamp, AVSEEK_FLAG_ANY);
if (index == -1) {
av_log(mov->fc, AV_LOG_WARNING,
"st: %d edit list %"PRId64" Cannot find an index entry before timestamp: %"PRId64".\n"
"Rounding edit list media time to zero.\n",
st->index, edit_list_index, search_timestamp);
index = 0;
edit_list_media_time = 0;
}
}
current = e_old + index;
ctts_index_old = 0;
ctts_sample_old = 0;
for (index_ctts_count = 0; index_ctts_count < index; index_ctts_count++) {
if (ctts_data_old && ctts_index_old < ctts_count_old) {
ctts_sample_old++;
if (ctts_data_old[ctts_index_old].count == ctts_sample_old) {
ctts_index_old++;
ctts_sample_old = 0;
}
}
}
edit_list_start_ctts_sample = ctts_sample_old;
edit_list_start_encountered = 0;
for (; current < e_old_end; current++, index++) {
frame_duration = (current + 1 < e_old_end) ?
((current + 1)->timestamp - current->timestamp) : edit_list_duration;
flags = current->flags;
curr_cts = current->timestamp + msc->dts_shift;
if (ctts_data_old && ctts_index_old < ctts_count_old) {
av_log(mov->fc, AV_LOG_DEBUG, "shifted frame pts, curr_cts: %"PRId64" @ %"PRId64", ctts: %d, ctts_count: %"PRId64"\n",
curr_cts, ctts_index_old, ctts_data_old[ctts_index_old].duration, ctts_count_old);
curr_cts += ctts_data_old[ctts_index_old].duration;
ctts_sample_old++;
if (ctts_sample_old == ctts_data_old[ctts_index_old].count) {
if (add_ctts_entry(&msc->ctts_data, &msc->ctts_count,
&ctts_allocated_size,
ctts_data_old[ctts_index_old].count - edit_list_start_ctts_sample,
ctts_data_old[ctts_index_old].duration) == -1) {
av_log(mov->fc, AV_LOG_ERROR, "Cannot add CTTS entry %"PRId64" - {%"PRId64", %d}\n",
ctts_index_old,
ctts_data_old[ctts_index_old].count - edit_list_start_ctts_sample,
ctts_data_old[ctts_index_old].duration);
break;
}
ctts_index_old++;
ctts_sample_old = 0;
edit_list_start_ctts_sample = 0;
}
}
if (curr_cts < edit_list_media_time || curr_cts >= (edit_list_duration + edit_list_media_time)) {
if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && st->codecpar->codec_id != AV_CODEC_ID_VORBIS &&
curr_cts < edit_list_media_time && curr_cts + frame_duration > edit_list_media_time &&
first_non_zero_audio_edit > 0) {
packet_skip_samples = edit_list_media_time - curr_cts;
st->skip_samples += packet_skip_samples;
edit_list_dts_counter -= packet_skip_samples;
if (edit_list_start_encountered == 0) {
edit_list_start_encountered = 1;
if (frame_duration_buffer) {
fix_index_entry_timestamps(st, st->nb_index_entries, edit_list_dts_counter,
frame_duration_buffer, num_discarded_begin);
av_freep(&frame_duration_buffer);
}
}
av_log(mov->fc, AV_LOG_DEBUG, "skip %d audio samples from curr_cts: %"PRId64"\n", packet_skip_samples, curr_cts);
} else {
flags |= AVINDEX_DISCARD_FRAME;
av_log(mov->fc, AV_LOG_DEBUG, "drop a frame at curr_cts: %"PRId64" @ %"PRId64"\n", curr_cts, index);
if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && edit_list_start_encountered == 0) {
num_discarded_begin++;
frame_duration_buffer = av_realloc(frame_duration_buffer,
num_discarded_begin * sizeof(int64_t));
if (!frame_duration_buffer) {
av_log(mov->fc, AV_LOG_ERROR, "Cannot reallocate frame duration buffer\n");
break;
}
frame_duration_buffer[num_discarded_begin - 1] = frame_duration;
if (first_non_zero_audio_edit > 0 && st->codecpar->codec_id != AV_CODEC_ID_VORBIS) {
st->skip_samples += frame_duration;
msc->start_pad = st->skip_samples;
}
}
}
} else if (edit_list_start_encountered == 0) {
edit_list_start_encountered = 1;
if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && frame_duration_buffer) {
fix_index_entry_timestamps(st, st->nb_index_entries, edit_list_dts_counter,
frame_duration_buffer, num_discarded_begin);
av_freep(&frame_duration_buffer);
}
}
if (add_index_entry(st, current->pos, edit_list_dts_counter, current->size,
current->min_distance, flags) == -1) {
av_log(mov->fc, AV_LOG_ERROR, "Cannot add index entry\n");
break;
}
if (current_index_range < msc->index_ranges || index != current_index_range->end) {
current_index_range++;
current_index_range->start = index;
}
current_index_range->end = index + 1;
if (edit_list_start_encountered > 0) {
edit_list_dts_counter = edit_list_dts_counter + frame_duration;
}
if (((curr_cts + frame_duration) >= (edit_list_duration + edit_list_media_time)) &&
((flags & AVINDEX_KEYFRAME) || ((st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)))) {
if (ctts_data_old && ctts_sample_old != 0) {
if (add_ctts_entry(&msc->ctts_data, &msc->ctts_count,
&ctts_allocated_size,
ctts_sample_old - edit_list_start_ctts_sample,
ctts_data_old[ctts_index_old].duration) == -1) {
av_log(mov->fc, AV_LOG_ERROR, "Cannot add CTTS entry %"PRId64" - {%"PRId64", %d}\n",
ctts_index_old, ctts_sample_old - edit_list_start_ctts_sample,
ctts_data_old[ctts_index_old].duration);
break;
}
}
break;
}
}
}
st->duration = edit_list_dts_entry_end - start_dts;
av_free(e_old);
av_free(ctts_data_old);
current_index_range++;
current_index_range->start = 0;
current_index_range->end = 0;
msc->current_index = msc->index_ranges[0].start;
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(MOVContext *VAR_0, AVStream *VAR_1)
{
MOVStreamContext *msc = VAR_1->priv_data;
AVIndexEntry *e_old = VAR_1->index_entries;
int VAR_2 = VAR_1->nb_index_entries;
const AVIndexEntry *VAR_3 = e_old + VAR_2;
const AVIndexEntry *VAR_4 = NULL;
MOVStts *ctts_data_old = msc->ctts_data;
int64_t ctts_index_old = 0;
int64_t ctts_sample_old = 0;
int64_t ctts_count_old = msc->ctts_count;
int64_t edit_list_media_time = 0;
int64_t edit_list_duration = 0;
int64_t frame_duration = 0;
int64_t edit_list_dts_counter = 0;
int64_t edit_list_dts_entry_end = 0;
int64_t edit_list_start_ctts_sample = 0;
int64_t curr_cts;
int64_t edit_list_index = 0;
int64_t index;
int64_t index_ctts_count;
int VAR_5;
unsigned int VAR_6 = 0;
int64_t start_dts = 0;
int64_t edit_list_media_time_dts = 0;
int64_t edit_list_start_encountered = 0;
int64_t search_timestamp = 0;
int64_t* frame_duration_buffer = NULL;
int VAR_7 = 0;
int VAR_8 = -1;
int VAR_9 = 0;
MOVIndexRange *current_index_range;
if (!msc->elst_data || msc->elst_count <= 0 || VAR_2 <= 0) {
return;
}
msc->index_ranges = av_malloc((msc->elst_count + 1) * sizeof(msc->index_ranges[0]));
if (!msc->index_ranges) {
av_log(VAR_0->fc, AV_LOG_ERROR, "Cannot allocate index ranges buffer\n");
return;
}
msc->current_index_range = msc->index_ranges;
current_index_range = msc->index_ranges - 1;
VAR_1->index_entries = NULL;
VAR_1->index_entries_allocated_size = 0;
VAR_1->nb_index_entries = 0;
msc->ctts_data = NULL;
msc->ctts_count = 0;
msc->ctts_index = 0;
msc->ctts_sample = 0;
if (msc->dts_shift > 0)
edit_list_dts_entry_end -= msc->dts_shift;
if (ctts_data_old && ctts_count_old > 0) {
edit_list_dts_entry_end -= ctts_data_old[0].duration;
av_log(VAR_0->fc, AV_LOG_DEBUG, "Offset DTS by ctts[%d].duration: %d\n", 0, ctts_data_old[0].duration);
}
start_dts = edit_list_dts_entry_end;
while (get_edit_list_entry(VAR_0, msc, edit_list_index, &edit_list_media_time,
&edit_list_duration, VAR_0->time_scale)) {
av_log(VAR_0->fc, AV_LOG_DEBUG, "Processing VAR_1: %d, edit list %"PRId64" - media time: %"PRId64", duration: %"PRId64"\n",
VAR_1->index, edit_list_index, edit_list_media_time, edit_list_duration);
edit_list_index++;
edit_list_dts_counter = edit_list_dts_entry_end;
edit_list_dts_entry_end += edit_list_duration;
VAR_7 = 0;
if (edit_list_media_time == -1) {
continue;
}
if (VAR_1->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
if (VAR_8 < 0) {
VAR_8 = 1;
} else {
VAR_8 = 0;
}
if (VAR_8 > 0)
VAR_1->skip_samples = msc->start_pad = 0;
}
edit_list_media_time_dts = edit_list_media_time;
if (msc->dts_shift > 0) {
edit_list_media_time_dts -= msc->dts_shift;
}
search_timestamp = edit_list_media_time_dts;
if (VAR_1->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
search_timestamp = FFMAX(search_timestamp - msc->time_scale, e_old[0].timestamp);
}
index = find_prev_closest_index(VAR_1, e_old, VAR_2, search_timestamp, 0);
if (index == -1) {
av_log(VAR_0->fc, AV_LOG_WARNING,
"VAR_1: %d edit list: %"PRId64" Missing key frame while searching for timestamp: %"PRId64"\n",
VAR_1->index, edit_list_index, search_timestamp);
index = find_prev_closest_index(VAR_1, e_old, VAR_2, search_timestamp, AVSEEK_FLAG_ANY);
if (index == -1) {
av_log(VAR_0->fc, AV_LOG_WARNING,
"VAR_1: %d edit list %"PRId64" Cannot find an index entry before timestamp: %"PRId64".\n"
"Rounding edit list media time to zero.\n",
VAR_1->index, edit_list_index, search_timestamp);
index = 0;
edit_list_media_time = 0;
}
}
VAR_4 = e_old + index;
ctts_index_old = 0;
ctts_sample_old = 0;
for (index_ctts_count = 0; index_ctts_count < index; index_ctts_count++) {
if (ctts_data_old && ctts_index_old < ctts_count_old) {
ctts_sample_old++;
if (ctts_data_old[ctts_index_old].count == ctts_sample_old) {
ctts_index_old++;
ctts_sample_old = 0;
}
}
}
edit_list_start_ctts_sample = ctts_sample_old;
edit_list_start_encountered = 0;
for (; VAR_4 < VAR_3; VAR_4++, index++) {
frame_duration = (VAR_4 + 1 < VAR_3) ?
((VAR_4 + 1)->timestamp - VAR_4->timestamp) : edit_list_duration;
VAR_5 = VAR_4->VAR_5;
curr_cts = VAR_4->timestamp + msc->dts_shift;
if (ctts_data_old && ctts_index_old < ctts_count_old) {
av_log(VAR_0->fc, AV_LOG_DEBUG, "shifted frame pts, curr_cts: %"PRId64" @ %"PRId64", ctts: %d, ctts_count: %"PRId64"\n",
curr_cts, ctts_index_old, ctts_data_old[ctts_index_old].duration, ctts_count_old);
curr_cts += ctts_data_old[ctts_index_old].duration;
ctts_sample_old++;
if (ctts_sample_old == ctts_data_old[ctts_index_old].count) {
if (add_ctts_entry(&msc->ctts_data, &msc->ctts_count,
&VAR_6,
ctts_data_old[ctts_index_old].count - edit_list_start_ctts_sample,
ctts_data_old[ctts_index_old].duration) == -1) {
av_log(VAR_0->fc, AV_LOG_ERROR, "Cannot add CTTS entry %"PRId64" - {%"PRId64", %d}\n",
ctts_index_old,
ctts_data_old[ctts_index_old].count - edit_list_start_ctts_sample,
ctts_data_old[ctts_index_old].duration);
break;
}
ctts_index_old++;
ctts_sample_old = 0;
edit_list_start_ctts_sample = 0;
}
}
if (curr_cts < edit_list_media_time || curr_cts >= (edit_list_duration + edit_list_media_time)) {
if (VAR_1->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && VAR_1->codecpar->codec_id != AV_CODEC_ID_VORBIS &&
curr_cts < edit_list_media_time && curr_cts + frame_duration > edit_list_media_time &&
VAR_8 > 0) {
VAR_9 = edit_list_media_time - curr_cts;
VAR_1->skip_samples += VAR_9;
edit_list_dts_counter -= VAR_9;
if (edit_list_start_encountered == 0) {
edit_list_start_encountered = 1;
if (frame_duration_buffer) {
fix_index_entry_timestamps(VAR_1, VAR_1->nb_index_entries, edit_list_dts_counter,
frame_duration_buffer, VAR_7);
av_freep(&frame_duration_buffer);
}
}
av_log(VAR_0->fc, AV_LOG_DEBUG, "skip %d audio samples from curr_cts: %"PRId64"\n", VAR_9, curr_cts);
} else {
VAR_5 |= AVINDEX_DISCARD_FRAME;
av_log(VAR_0->fc, AV_LOG_DEBUG, "drop a frame at curr_cts: %"PRId64" @ %"PRId64"\n", curr_cts, index);
if (VAR_1->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && edit_list_start_encountered == 0) {
VAR_7++;
frame_duration_buffer = av_realloc(frame_duration_buffer,
VAR_7 * sizeof(int64_t));
if (!frame_duration_buffer) {
av_log(VAR_0->fc, AV_LOG_ERROR, "Cannot reallocate frame duration buffer\n");
break;
}
frame_duration_buffer[VAR_7 - 1] = frame_duration;
if (VAR_8 > 0 && VAR_1->codecpar->codec_id != AV_CODEC_ID_VORBIS) {
VAR_1->skip_samples += frame_duration;
msc->start_pad = VAR_1->skip_samples;
}
}
}
} else if (edit_list_start_encountered == 0) {
edit_list_start_encountered = 1;
if (VAR_1->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && frame_duration_buffer) {
fix_index_entry_timestamps(VAR_1, VAR_1->nb_index_entries, edit_list_dts_counter,
frame_duration_buffer, VAR_7);
av_freep(&frame_duration_buffer);
}
}
if (add_index_entry(VAR_1, VAR_4->pos, edit_list_dts_counter, VAR_4->size,
VAR_4->min_distance, VAR_5) == -1) {
av_log(VAR_0->fc, AV_LOG_ERROR, "Cannot add index entry\n");
break;
}
if (current_index_range < msc->index_ranges || index != current_index_range->end) {
current_index_range++;
current_index_range->start = index;
}
current_index_range->end = index + 1;
if (edit_list_start_encountered > 0) {
edit_list_dts_counter = edit_list_dts_counter + frame_duration;
}
if (((curr_cts + frame_duration) >= (edit_list_duration + edit_list_media_time)) &&
((VAR_5 & AVINDEX_KEYFRAME) || ((VAR_1->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)))) {
if (ctts_data_old && ctts_sample_old != 0) {
if (add_ctts_entry(&msc->ctts_data, &msc->ctts_count,
&VAR_6,
ctts_sample_old - edit_list_start_ctts_sample,
ctts_data_old[ctts_index_old].duration) == -1) {
av_log(VAR_0->fc, AV_LOG_ERROR, "Cannot add CTTS entry %"PRId64" - {%"PRId64", %d}\n",
ctts_index_old, ctts_sample_old - edit_list_start_ctts_sample,
ctts_data_old[ctts_index_old].duration);
break;
}
}
break;
}
}
}
VAR_1->duration = edit_list_dts_entry_end - start_dts;
av_free(e_old);
av_free(ctts_data_old);
current_index_range++;
current_index_range->start = 0;
current_index_range->end = 0;
msc->current_index = msc->index_ranges[0].start;
}
|
[
"static void FUNC_0(MOVContext *VAR_0, AVStream *VAR_1)\n{",
"MOVStreamContext *msc = VAR_1->priv_data;",
"AVIndexEntry *e_old = VAR_1->index_entries;",
"int VAR_2 = VAR_1->nb_index_entries;",
"const AVIndexEntry *VAR_3 = e_old + VAR_2;",
"const AVIndexEntry *VAR_4 = NULL;",
"MOVStts *ctts_data_old = msc->ctts_data;",
"int64_t ctts_index_old = 0;",
"int64_t ctts_sample_old = 0;",
"int64_t ctts_count_old = msc->ctts_count;",
"int64_t edit_list_media_time = 0;",
"int64_t edit_list_duration = 0;",
"int64_t frame_duration = 0;",
"int64_t edit_list_dts_counter = 0;",
"int64_t edit_list_dts_entry_end = 0;",
"int64_t edit_list_start_ctts_sample = 0;",
"int64_t curr_cts;",
"int64_t edit_list_index = 0;",
"int64_t index;",
"int64_t index_ctts_count;",
"int VAR_5;",
"unsigned int VAR_6 = 0;",
"int64_t start_dts = 0;",
"int64_t edit_list_media_time_dts = 0;",
"int64_t edit_list_start_encountered = 0;",
"int64_t search_timestamp = 0;",
"int64_t* frame_duration_buffer = NULL;",
"int VAR_7 = 0;",
"int VAR_8 = -1;",
"int VAR_9 = 0;",
"MOVIndexRange *current_index_range;",
"if (!msc->elst_data || msc->elst_count <= 0 || VAR_2 <= 0) {",
"return;",
"}",
"msc->index_ranges = av_malloc((msc->elst_count + 1) * sizeof(msc->index_ranges[0]));",
"if (!msc->index_ranges) {",
"av_log(VAR_0->fc, AV_LOG_ERROR, \"Cannot allocate index ranges buffer\\n\");",
"return;",
"}",
"msc->current_index_range = msc->index_ranges;",
"current_index_range = msc->index_ranges - 1;",
"VAR_1->index_entries = NULL;",
"VAR_1->index_entries_allocated_size = 0;",
"VAR_1->nb_index_entries = 0;",
"msc->ctts_data = NULL;",
"msc->ctts_count = 0;",
"msc->ctts_index = 0;",
"msc->ctts_sample = 0;",
"if (msc->dts_shift > 0)\nedit_list_dts_entry_end -= msc->dts_shift;",
"if (ctts_data_old && ctts_count_old > 0) {",
"edit_list_dts_entry_end -= ctts_data_old[0].duration;",
"av_log(VAR_0->fc, AV_LOG_DEBUG, \"Offset DTS by ctts[%d].duration: %d\\n\", 0, ctts_data_old[0].duration);",
"}",
"start_dts = edit_list_dts_entry_end;",
"while (get_edit_list_entry(VAR_0, msc, edit_list_index, &edit_list_media_time,\n&edit_list_duration, VAR_0->time_scale)) {",
"av_log(VAR_0->fc, AV_LOG_DEBUG, \"Processing VAR_1: %d, edit list %\"PRId64\" - media time: %\"PRId64\", duration: %\"PRId64\"\\n\",\nVAR_1->index, edit_list_index, edit_list_media_time, edit_list_duration);",
"edit_list_index++;",
"edit_list_dts_counter = edit_list_dts_entry_end;",
"edit_list_dts_entry_end += edit_list_duration;",
"VAR_7 = 0;",
"if (edit_list_media_time == -1) {",
"continue;",
"}",
"if (VAR_1->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {",
"if (VAR_8 < 0) {",
"VAR_8 = 1;",
"} else {",
"VAR_8 = 0;",
"}",
"if (VAR_8 > 0)\nVAR_1->skip_samples = msc->start_pad = 0;",
"}",
"edit_list_media_time_dts = edit_list_media_time;",
"if (msc->dts_shift > 0) {",
"edit_list_media_time_dts -= msc->dts_shift;",
"}",
"search_timestamp = edit_list_media_time_dts;",
"if (VAR_1->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {",
"search_timestamp = FFMAX(search_timestamp - msc->time_scale, e_old[0].timestamp);",
"}",
"index = find_prev_closest_index(VAR_1, e_old, VAR_2, search_timestamp, 0);",
"if (index == -1) {",
"av_log(VAR_0->fc, AV_LOG_WARNING,\n\"VAR_1: %d edit list: %\"PRId64\" Missing key frame while searching for timestamp: %\"PRId64\"\\n\",\nVAR_1->index, edit_list_index, search_timestamp);",
"index = find_prev_closest_index(VAR_1, e_old, VAR_2, search_timestamp, AVSEEK_FLAG_ANY);",
"if (index == -1) {",
"av_log(VAR_0->fc, AV_LOG_WARNING,\n\"VAR_1: %d edit list %\"PRId64\" Cannot find an index entry before timestamp: %\"PRId64\".\\n\"\n\"Rounding edit list media time to zero.\\n\",\nVAR_1->index, edit_list_index, search_timestamp);",
"index = 0;",
"edit_list_media_time = 0;",
"}",
"}",
"VAR_4 = e_old + index;",
"ctts_index_old = 0;",
"ctts_sample_old = 0;",
"for (index_ctts_count = 0; index_ctts_count < index; index_ctts_count++) {",
"if (ctts_data_old && ctts_index_old < ctts_count_old) {",
"ctts_sample_old++;",
"if (ctts_data_old[ctts_index_old].count == ctts_sample_old) {",
"ctts_index_old++;",
"ctts_sample_old = 0;",
"}",
"}",
"}",
"edit_list_start_ctts_sample = ctts_sample_old;",
"edit_list_start_encountered = 0;",
"for (; VAR_4 < VAR_3; VAR_4++, index++) {",
"frame_duration = (VAR_4 + 1 < VAR_3) ?\n((VAR_4 + 1)->timestamp - VAR_4->timestamp) : edit_list_duration;",
"VAR_5 = VAR_4->VAR_5;",
"curr_cts = VAR_4->timestamp + msc->dts_shift;",
"if (ctts_data_old && ctts_index_old < ctts_count_old) {",
"av_log(VAR_0->fc, AV_LOG_DEBUG, \"shifted frame pts, curr_cts: %\"PRId64\" @ %\"PRId64\", ctts: %d, ctts_count: %\"PRId64\"\\n\",\ncurr_cts, ctts_index_old, ctts_data_old[ctts_index_old].duration, ctts_count_old);",
"curr_cts += ctts_data_old[ctts_index_old].duration;",
"ctts_sample_old++;",
"if (ctts_sample_old == ctts_data_old[ctts_index_old].count) {",
"if (add_ctts_entry(&msc->ctts_data, &msc->ctts_count,\n&VAR_6,\nctts_data_old[ctts_index_old].count - edit_list_start_ctts_sample,\nctts_data_old[ctts_index_old].duration) == -1) {",
"av_log(VAR_0->fc, AV_LOG_ERROR, \"Cannot add CTTS entry %\"PRId64\" - {%\"PRId64\", %d}\\n\",",
"ctts_index_old,\nctts_data_old[ctts_index_old].count - edit_list_start_ctts_sample,\nctts_data_old[ctts_index_old].duration);",
"break;",
"}",
"ctts_index_old++;",
"ctts_sample_old = 0;",
"edit_list_start_ctts_sample = 0;",
"}",
"}",
"if (curr_cts < edit_list_media_time || curr_cts >= (edit_list_duration + edit_list_media_time)) {",
"if (VAR_1->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && VAR_1->codecpar->codec_id != AV_CODEC_ID_VORBIS &&\ncurr_cts < edit_list_media_time && curr_cts + frame_duration > edit_list_media_time &&\nVAR_8 > 0) {",
"VAR_9 = edit_list_media_time - curr_cts;",
"VAR_1->skip_samples += VAR_9;",
"edit_list_dts_counter -= VAR_9;",
"if (edit_list_start_encountered == 0) {",
"edit_list_start_encountered = 1;",
"if (frame_duration_buffer) {",
"fix_index_entry_timestamps(VAR_1, VAR_1->nb_index_entries, edit_list_dts_counter,\nframe_duration_buffer, VAR_7);",
"av_freep(&frame_duration_buffer);",
"}",
"}",
"av_log(VAR_0->fc, AV_LOG_DEBUG, \"skip %d audio samples from curr_cts: %\"PRId64\"\\n\", VAR_9, curr_cts);",
"} else {",
"VAR_5 |= AVINDEX_DISCARD_FRAME;",
"av_log(VAR_0->fc, AV_LOG_DEBUG, \"drop a frame at curr_cts: %\"PRId64\" @ %\"PRId64\"\\n\", curr_cts, index);",
"if (VAR_1->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && edit_list_start_encountered == 0) {",
"VAR_7++;",
"frame_duration_buffer = av_realloc(frame_duration_buffer,\nVAR_7 * sizeof(int64_t));",
"if (!frame_duration_buffer) {",
"av_log(VAR_0->fc, AV_LOG_ERROR, \"Cannot reallocate frame duration buffer\\n\");",
"break;",
"}",
"frame_duration_buffer[VAR_7 - 1] = frame_duration;",
"if (VAR_8 > 0 && VAR_1->codecpar->codec_id != AV_CODEC_ID_VORBIS) {",
"VAR_1->skip_samples += frame_duration;",
"msc->start_pad = VAR_1->skip_samples;",
"}",
"}",
"}",
"} else if (edit_list_start_encountered == 0) {",
"edit_list_start_encountered = 1;",
"if (VAR_1->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && frame_duration_buffer) {",
"fix_index_entry_timestamps(VAR_1, VAR_1->nb_index_entries, edit_list_dts_counter,\nframe_duration_buffer, VAR_7);",
"av_freep(&frame_duration_buffer);",
"}",
"}",
"if (add_index_entry(VAR_1, VAR_4->pos, edit_list_dts_counter, VAR_4->size,\nVAR_4->min_distance, VAR_5) == -1) {",
"av_log(VAR_0->fc, AV_LOG_ERROR, \"Cannot add index entry\\n\");",
"break;",
"}",
"if (current_index_range < msc->index_ranges || index != current_index_range->end) {",
"current_index_range++;",
"current_index_range->start = index;",
"}",
"current_index_range->end = index + 1;",
"if (edit_list_start_encountered > 0) {",
"edit_list_dts_counter = edit_list_dts_counter + frame_duration;",
"}",
"if (((curr_cts + frame_duration) >= (edit_list_duration + edit_list_media_time)) &&\n((VAR_5 & AVINDEX_KEYFRAME) || ((VAR_1->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)))) {",
"if (ctts_data_old && ctts_sample_old != 0) {",
"if (add_ctts_entry(&msc->ctts_data, &msc->ctts_count,\n&VAR_6,\nctts_sample_old - edit_list_start_ctts_sample,\nctts_data_old[ctts_index_old].duration) == -1) {",
"av_log(VAR_0->fc, AV_LOG_ERROR, \"Cannot add CTTS entry %\"PRId64\" - {%\"PRId64\", %d}\\n\",",
"ctts_index_old, ctts_sample_old - edit_list_start_ctts_sample,\nctts_data_old[ctts_index_old].duration);",
"break;",
"}",
"}",
"break;",
"}",
"}",
"}",
"VAR_1->duration = edit_list_dts_entry_end - start_dts;",
"av_free(e_old);",
"av_free(ctts_data_old);",
"current_index_range++;",
"current_index_range->start = 0;",
"current_index_range->end = 0;",
"msc->current_index = msc->index_ranges[0].start;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
67
],
[
69
],
[
71
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
95
],
[
97
],
[
99
],
[
105
],
[
107
],
[
109
],
[
111
],
[
119,
121
],
[
127
],
[
129
],
[
131
],
[
133
],
[
137
],
[
141,
143
],
[
145,
147
],
[
149
],
[
151
],
[
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
169
],
[
171
],
[
173
],
[
175
],
[
177
],
[
179
],
[
183,
185
],
[
187
],
[
193
],
[
195
],
[
197
],
[
199
],
[
211
],
[
213
],
[
221
],
[
223
],
[
227
],
[
229
],
[
231,
233,
235
],
[
237
],
[
241
],
[
243,
245,
247,
249
],
[
251
],
[
253
],
[
255
],
[
257
],
[
259
],
[
263
],
[
265
],
[
271
],
[
273
],
[
275
],
[
277
],
[
279
],
[
281
],
[
283
],
[
285
],
[
287
],
[
291
],
[
297
],
[
299
],
[
303,
305
],
[
309
],
[
315
],
[
319
],
[
321,
323
],
[
325
],
[
327
],
[
329
],
[
331,
333,
335,
337
],
[
339
],
[
341,
343,
345
],
[
347
],
[
349
],
[
351
],
[
353
],
[
355
],
[
357
],
[
359
],
[
363
],
[
365,
367,
369
],
[
371
],
[
373
],
[
379
],
[
381
],
[
383
],
[
389
],
[
391,
393
],
[
395
],
[
397
],
[
399
],
[
403
],
[
405
],
[
407
],
[
409
],
[
413
],
[
415
],
[
417,
419
],
[
421
],
[
423
],
[
425
],
[
427
],
[
429
],
[
435
],
[
437
],
[
439
],
[
441
],
[
443
],
[
445
],
[
447
],
[
449
],
[
455
],
[
457,
459
],
[
461
],
[
463
],
[
465
],
[
469,
471
],
[
473
],
[
475
],
[
477
],
[
483
],
[
485
],
[
487
],
[
489
],
[
491
],
[
497
],
[
499
],
[
501
],
[
507,
509
],
[
513
],
[
515,
517,
519,
521
],
[
523
],
[
525,
527
],
[
529
],
[
531
],
[
533
],
[
535
],
[
537
],
[
539
],
[
541
],
[
545
],
[
551
],
[
553
],
[
559
],
[
561
],
[
563
],
[
565
],
[
567
]
] |
9,686 |
int scsi_bus_legacy_handle_cmdline(SCSIBus *bus)
{
Location loc;
DriveInfo *dinfo;
int res = 0, unit;
loc_push_none(&loc);
for (unit = 0; unit < MAX_SCSI_DEVS; unit++) {
dinfo = drive_get(IF_SCSI, bus->busnr, unit);
if (dinfo == NULL) {
continue;
}
qemu_opts_loc_restore(dinfo->opts);
if (!scsi_bus_legacy_add_drive(bus, dinfo->bdrv, unit)) {
res = -1;
break;
}
}
loc_pop(&loc);
return res;
}
| false |
qemu
|
622b520fb4ca50b5028485f1d225317ece0a42b9
|
int scsi_bus_legacy_handle_cmdline(SCSIBus *bus)
{
Location loc;
DriveInfo *dinfo;
int res = 0, unit;
loc_push_none(&loc);
for (unit = 0; unit < MAX_SCSI_DEVS; unit++) {
dinfo = drive_get(IF_SCSI, bus->busnr, unit);
if (dinfo == NULL) {
continue;
}
qemu_opts_loc_restore(dinfo->opts);
if (!scsi_bus_legacy_add_drive(bus, dinfo->bdrv, unit)) {
res = -1;
break;
}
}
loc_pop(&loc);
return res;
}
|
{
"code": [],
"line_no": []
}
|
int FUNC_0(SCSIBus *VAR_0)
{
Location loc;
DriveInfo *dinfo;
int VAR_1 = 0, VAR_2;
loc_push_none(&loc);
for (VAR_2 = 0; VAR_2 < MAX_SCSI_DEVS; VAR_2++) {
dinfo = drive_get(IF_SCSI, VAR_0->busnr, VAR_2);
if (dinfo == NULL) {
continue;
}
qemu_opts_loc_restore(dinfo->opts);
if (!scsi_bus_legacy_add_drive(VAR_0, dinfo->bdrv, VAR_2)) {
VAR_1 = -1;
break;
}
}
loc_pop(&loc);
return VAR_1;
}
|
[
"int FUNC_0(SCSIBus *VAR_0)\n{",
"Location loc;",
"DriveInfo *dinfo;",
"int VAR_1 = 0, VAR_2;",
"loc_push_none(&loc);",
"for (VAR_2 = 0; VAR_2 < MAX_SCSI_DEVS; VAR_2++) {",
"dinfo = drive_get(IF_SCSI, VAR_0->busnr, VAR_2);",
"if (dinfo == NULL) {",
"continue;",
"}",
"qemu_opts_loc_restore(dinfo->opts);",
"if (!scsi_bus_legacy_add_drive(VAR_0, dinfo->bdrv, VAR_2)) {",
"VAR_1 = -1;",
"break;",
"}",
"}",
"loc_pop(&loc);",
"return VAR_1;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
]
] |
9,687 |
static void hda_codec_device_class_init(ObjectClass *klass, void *data)
{
DeviceClass *k = DEVICE_CLASS(klass);
k->realize = hda_codec_dev_realize;
k->exit = hda_codec_dev_exit;
set_bit(DEVICE_CATEGORY_SOUND, k->categories);
k->bus_type = TYPE_HDA_BUS;
k->props = hda_props;
}
| false |
qemu
|
8ac55351459055f2faee585d9ba2f84707741815
|
static void hda_codec_device_class_init(ObjectClass *klass, void *data)
{
DeviceClass *k = DEVICE_CLASS(klass);
k->realize = hda_codec_dev_realize;
k->exit = hda_codec_dev_exit;
set_bit(DEVICE_CATEGORY_SOUND, k->categories);
k->bus_type = TYPE_HDA_BUS;
k->props = hda_props;
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)
{
DeviceClass *k = DEVICE_CLASS(VAR_0);
k->realize = hda_codec_dev_realize;
k->exit = hda_codec_dev_exit;
set_bit(DEVICE_CATEGORY_SOUND, k->categories);
k->bus_type = TYPE_HDA_BUS;
k->props = hda_props;
}
|
[
"static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{",
"DeviceClass *k = DEVICE_CLASS(VAR_0);",
"k->realize = hda_codec_dev_realize;",
"k->exit = hda_codec_dev_exit;",
"set_bit(DEVICE_CATEGORY_SOUND, k->categories);",
"k->bus_type = TYPE_HDA_BUS;",
"k->props = hda_props;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
]
] |
9,690 |
static inline void downmix_stereo_to_mono(float *samples)
{
int i;
for (i = 0; i < 256; i++) {
samples[i] += samples[i + 256];
samples[i + 256] = 0;
}
}
| false |
FFmpeg
|
0058584580b87feb47898e60e4b80c7f425882ad
|
static inline void downmix_stereo_to_mono(float *samples)
{
int i;
for (i = 0; i < 256; i++) {
samples[i] += samples[i + 256];
samples[i + 256] = 0;
}
}
|
{
"code": [],
"line_no": []
}
|
static inline void FUNC_0(float *VAR_0)
{
int VAR_1;
for (VAR_1 = 0; VAR_1 < 256; VAR_1++) {
VAR_0[VAR_1] += VAR_0[VAR_1 + 256];
VAR_0[VAR_1 + 256] = 0;
}
}
|
[
"static inline void FUNC_0(float *VAR_0)\n{",
"int VAR_1;",
"for (VAR_1 = 0; VAR_1 < 256; VAR_1++) {",
"VAR_0[VAR_1] += VAR_0[VAR_1 + 256];",
"VAR_0[VAR_1 + 256] = 0;",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
]
] |
9,691 |
static int thread_execute2(AVCodecContext *avctx, action_func2* func2, void *arg, int *ret, int job_count)
{
ThreadContext *c= avctx->thread_opaque;
c->func2 = func2;
return thread_execute(avctx, NULL, arg, ret, job_count, 0);
}
| false |
FFmpeg
|
daa7a1d4431b6acf1f93c4a98b3de123abf4ca18
|
static int thread_execute2(AVCodecContext *avctx, action_func2* func2, void *arg, int *ret, int job_count)
{
ThreadContext *c= avctx->thread_opaque;
c->func2 = func2;
return thread_execute(avctx, NULL, arg, ret, job_count, 0);
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(AVCodecContext *VAR_0, action_func2* VAR_1, void *VAR_2, int *VAR_3, int VAR_4)
{
ThreadContext *c= VAR_0->thread_opaque;
c->VAR_1 = VAR_1;
return thread_execute(VAR_0, NULL, VAR_2, VAR_3, VAR_4, 0);
}
|
[
"static int FUNC_0(AVCodecContext *VAR_0, action_func2* VAR_1, void *VAR_2, int *VAR_3, int VAR_4)\n{",
"ThreadContext *c= VAR_0->thread_opaque;",
"c->VAR_1 = VAR_1;",
"return thread_execute(VAR_0, NULL, VAR_2, VAR_3, VAR_4, 0);",
"}"
] |
[
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
]
] |
9,692 |
static void flat_print_section_header(WriterContext *wctx)
{
FlatContext *flat = wctx->priv;
AVBPrint *buf = &flat->section_header[wctx->level];
int i;
/* build section header */
av_bprint_clear(buf);
for (i = 1; i <= wctx->level; i++) {
if (flat->hierarchical ||
!(wctx->section[i]->flags & (SECTION_FLAG_IS_ARRAY|SECTION_FLAG_IS_WRAPPER)))
av_bprintf(buf, "%s%s", wctx->section[i]->name, flat->sep_str);
}
}
| false |
FFmpeg
|
01e4537f66c6d054f8c7bdbdd5b3cfb4220d12fe
|
static void flat_print_section_header(WriterContext *wctx)
{
FlatContext *flat = wctx->priv;
AVBPrint *buf = &flat->section_header[wctx->level];
int i;
av_bprint_clear(buf);
for (i = 1; i <= wctx->level; i++) {
if (flat->hierarchical ||
!(wctx->section[i]->flags & (SECTION_FLAG_IS_ARRAY|SECTION_FLAG_IS_WRAPPER)))
av_bprintf(buf, "%s%s", wctx->section[i]->name, flat->sep_str);
}
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(WriterContext *VAR_0)
{
FlatContext *flat = VAR_0->priv;
AVBPrint *buf = &flat->section_header[VAR_0->level];
int VAR_1;
av_bprint_clear(buf);
for (VAR_1 = 1; VAR_1 <= VAR_0->level; VAR_1++) {
if (flat->hierarchical ||
!(VAR_0->section[VAR_1]->flags & (SECTION_FLAG_IS_ARRAY|SECTION_FLAG_IS_WRAPPER)))
av_bprintf(buf, "%s%s", VAR_0->section[VAR_1]->name, flat->sep_str);
}
}
|
[
"static void FUNC_0(WriterContext *VAR_0)\n{",
"FlatContext *flat = VAR_0->priv;",
"AVBPrint *buf = &flat->section_header[VAR_0->level];",
"int VAR_1;",
"av_bprint_clear(buf);",
"for (VAR_1 = 1; VAR_1 <= VAR_0->level; VAR_1++) {",
"if (flat->hierarchical ||\n!(VAR_0->section[VAR_1]->flags & (SECTION_FLAG_IS_ARRAY|SECTION_FLAG_IS_WRAPPER)))\nav_bprintf(buf, \"%s%s\", VAR_0->section[VAR_1]->name, flat->sep_str);",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
15
],
[
17
],
[
19,
21,
23
],
[
25
],
[
27
]
] |
9,693 |
static int write_header(AVFormatContext *s)
{
AVCodecContext *codec = s->streams[0]->codec;
if (s->nb_streams > 1) {
av_log(s, AV_LOG_ERROR, "only one stream is supported\n");
return AVERROR(EINVAL);
}
if (codec->codec_id != AV_CODEC_ID_WAVPACK) {
av_log(s, AV_LOG_ERROR, "unsupported codec\n");
return AVERROR(EINVAL);
}
if (codec->extradata_size > 0) {
avpriv_report_missing_feature(s, "remuxing from matroska container");
return AVERROR_PATCHWELCOME;
}
avpriv_set_pts_info(s->streams[0], 64, 1, codec->sample_rate);
return 0;
}
| false |
FFmpeg
|
269fc8e04906ffd965aa19425ca90980b23c6508
|
static int write_header(AVFormatContext *s)
{
AVCodecContext *codec = s->streams[0]->codec;
if (s->nb_streams > 1) {
av_log(s, AV_LOG_ERROR, "only one stream is supported\n");
return AVERROR(EINVAL);
}
if (codec->codec_id != AV_CODEC_ID_WAVPACK) {
av_log(s, AV_LOG_ERROR, "unsupported codec\n");
return AVERROR(EINVAL);
}
if (codec->extradata_size > 0) {
avpriv_report_missing_feature(s, "remuxing from matroska container");
return AVERROR_PATCHWELCOME;
}
avpriv_set_pts_info(s->streams[0], 64, 1, codec->sample_rate);
return 0;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(AVFormatContext *VAR_0)
{
AVCodecContext *codec = VAR_0->streams[0]->codec;
if (VAR_0->nb_streams > 1) {
av_log(VAR_0, AV_LOG_ERROR, "only one stream is supported\n");
return AVERROR(EINVAL);
}
if (codec->codec_id != AV_CODEC_ID_WAVPACK) {
av_log(VAR_0, AV_LOG_ERROR, "unsupported codec\n");
return AVERROR(EINVAL);
}
if (codec->extradata_size > 0) {
avpriv_report_missing_feature(VAR_0, "remuxing from matroska container");
return AVERROR_PATCHWELCOME;
}
avpriv_set_pts_info(VAR_0->streams[0], 64, 1, codec->sample_rate);
return 0;
}
|
[
"static int FUNC_0(AVFormatContext *VAR_0)\n{",
"AVCodecContext *codec = VAR_0->streams[0]->codec;",
"if (VAR_0->nb_streams > 1) {",
"av_log(VAR_0, AV_LOG_ERROR, \"only one stream is supported\\n\");",
"return AVERROR(EINVAL);",
"}",
"if (codec->codec_id != AV_CODEC_ID_WAVPACK) {",
"av_log(VAR_0, AV_LOG_ERROR, \"unsupported codec\\n\");",
"return AVERROR(EINVAL);",
"}",
"if (codec->extradata_size > 0) {",
"avpriv_report_missing_feature(VAR_0, \"remuxing from matroska container\");",
"return AVERROR_PATCHWELCOME;",
"}",
"avpriv_set_pts_info(VAR_0->streams[0], 64, 1, codec->sample_rate);",
"return 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
],
[
33
],
[
37
],
[
39
]
] |
9,694 |
static int default_start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
{
AVFilterLink *outlink = NULL;
if (inlink->dst->nb_outputs)
outlink = inlink->dst->outputs[0];
if (outlink) {
outlink->out_buf = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
if (!outlink->out_buf)
return AVERROR(ENOMEM);
avfilter_copy_buffer_ref_props(outlink->out_buf, picref);
return ff_start_frame(outlink, avfilter_ref_buffer(outlink->out_buf, ~0));
}
return 0;
}
| false |
FFmpeg
|
1dc42050185d63c1de5d16146fbaee92640af187
|
static int default_start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
{
AVFilterLink *outlink = NULL;
if (inlink->dst->nb_outputs)
outlink = inlink->dst->outputs[0];
if (outlink) {
outlink->out_buf = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
if (!outlink->out_buf)
return AVERROR(ENOMEM);
avfilter_copy_buffer_ref_props(outlink->out_buf, picref);
return ff_start_frame(outlink, avfilter_ref_buffer(outlink->out_buf, ~0));
}
return 0;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(AVFilterLink *VAR_0, AVFilterBufferRef *VAR_1)
{
AVFilterLink *outlink = NULL;
if (VAR_0->dst->nb_outputs)
outlink = VAR_0->dst->outputs[0];
if (outlink) {
outlink->out_buf = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
if (!outlink->out_buf)
return AVERROR(ENOMEM);
avfilter_copy_buffer_ref_props(outlink->out_buf, VAR_1);
return ff_start_frame(outlink, avfilter_ref_buffer(outlink->out_buf, ~0));
}
return 0;
}
|
[
"static int FUNC_0(AVFilterLink *VAR_0, AVFilterBufferRef *VAR_1)\n{",
"AVFilterLink *outlink = NULL;",
"if (VAR_0->dst->nb_outputs)\noutlink = VAR_0->dst->outputs[0];",
"if (outlink) {",
"outlink->out_buf = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);",
"if (!outlink->out_buf)\nreturn AVERROR(ENOMEM);",
"avfilter_copy_buffer_ref_props(outlink->out_buf, VAR_1);",
"return ff_start_frame(outlink, avfilter_ref_buffer(outlink->out_buf, ~0));",
"}",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
9,
11
],
[
15
],
[
17
],
[
19,
21
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
]
] |
9,695 |
static uint64_t ivshmem_io_read(void *opaque, target_phys_addr_t addr,
unsigned size)
{
IVShmemState *s = opaque;
uint32_t ret;
switch (addr)
{
case INTRMASK:
ret = ivshmem_IntrMask_read(s);
break;
case INTRSTATUS:
ret = ivshmem_IntrStatus_read(s);
break;
case IVPOSITION:
/* return my VM ID if the memory is mapped */
if (s->shm_fd > 0) {
ret = s->vm_id;
} else {
ret = -1;
}
break;
default:
IVSHMEM_DPRINTF("why are we reading " TARGET_FMT_plx "\n", addr);
ret = 0;
}
return ret;
}
| false |
qemu
|
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
|
static uint64_t ivshmem_io_read(void *opaque, target_phys_addr_t addr,
unsigned size)
{
IVShmemState *s = opaque;
uint32_t ret;
switch (addr)
{
case INTRMASK:
ret = ivshmem_IntrMask_read(s);
break;
case INTRSTATUS:
ret = ivshmem_IntrStatus_read(s);
break;
case IVPOSITION:
if (s->shm_fd > 0) {
ret = s->vm_id;
} else {
ret = -1;
}
break;
default:
IVSHMEM_DPRINTF("why are we reading " TARGET_FMT_plx "\n", addr);
ret = 0;
}
return ret;
}
|
{
"code": [],
"line_no": []
}
|
static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr,
unsigned size)
{
IVShmemState *s = opaque;
uint32_t ret;
switch (addr)
{
case INTRMASK:
ret = ivshmem_IntrMask_read(s);
break;
case INTRSTATUS:
ret = ivshmem_IntrStatus_read(s);
break;
case IVPOSITION:
if (s->shm_fd > 0) {
ret = s->vm_id;
} else {
ret = -1;
}
break;
default:
IVSHMEM_DPRINTF("why are we reading " TARGET_FMT_plx "\n", addr);
ret = 0;
}
return ret;
}
|
[
"static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr,\nunsigned size)\n{",
"IVShmemState *s = opaque;",
"uint32_t ret;",
"switch (addr)\n{",
"case INTRMASK:\nret = ivshmem_IntrMask_read(s);",
"break;",
"case INTRSTATUS:\nret = ivshmem_IntrStatus_read(s);",
"break;",
"case IVPOSITION:\nif (s->shm_fd > 0) {",
"ret = s->vm_id;",
"} else {",
"ret = -1;",
"}",
"break;",
"default:\nIVSHMEM_DPRINTF(\"why are we reading \" TARGET_FMT_plx \"\\n\", addr);",
"ret = 0;",
"}",
"return ret;",
"}"
] |
[
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
],
[
27,
29
],
[
31
],
[
35,
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
53,
55
],
[
57
],
[
59
],
[
63
],
[
65
]
] |
9,696 |
static void omap_os_timer_write(void *opaque, target_phys_addr_t addr,
uint64_t value, unsigned size)
{
struct omap_32khz_timer_s *s = (struct omap_32khz_timer_s *) opaque;
int offset = addr & OMAP_MPUI_REG_MASK;
if (size != 4) {
return omap_badwidth_write32(opaque, addr, value);
}
switch (offset) {
case 0x00: /* TVR */
s->timer.reset_val = value & 0x00ffffff;
break;
case 0x04: /* TCR */
OMAP_RO_REG(addr);
break;
case 0x08: /* CR */
s->timer.ar = (value >> 3) & 1;
s->timer.it_ena = (value >> 2) & 1;
if (s->timer.st != (value & 1) || (value & 2)) {
omap_timer_sync(&s->timer);
s->timer.enable = value & 1;
s->timer.st = value & 1;
omap_timer_update(&s->timer);
}
break;
default:
OMAP_BAD_REG(addr);
}
}
| false |
qemu
|
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
|
static void omap_os_timer_write(void *opaque, target_phys_addr_t addr,
uint64_t value, unsigned size)
{
struct omap_32khz_timer_s *s = (struct omap_32khz_timer_s *) opaque;
int offset = addr & OMAP_MPUI_REG_MASK;
if (size != 4) {
return omap_badwidth_write32(opaque, addr, value);
}
switch (offset) {
case 0x00:
s->timer.reset_val = value & 0x00ffffff;
break;
case 0x04:
OMAP_RO_REG(addr);
break;
case 0x08:
s->timer.ar = (value >> 3) & 1;
s->timer.it_ena = (value >> 2) & 1;
if (s->timer.st != (value & 1) || (value & 2)) {
omap_timer_sync(&s->timer);
s->timer.enable = value & 1;
s->timer.st = value & 1;
omap_timer_update(&s->timer);
}
break;
default:
OMAP_BAD_REG(addr);
}
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,
uint64_t VAR_2, unsigned VAR_3)
{
struct omap_32khz_timer_s *VAR_4 = (struct omap_32khz_timer_s *) VAR_0;
int VAR_5 = VAR_1 & OMAP_MPUI_REG_MASK;
if (VAR_3 != 4) {
return omap_badwidth_write32(VAR_0, VAR_1, VAR_2);
}
switch (VAR_5) {
case 0x00:
VAR_4->timer.reset_val = VAR_2 & 0x00ffffff;
break;
case 0x04:
OMAP_RO_REG(VAR_1);
break;
case 0x08:
VAR_4->timer.ar = (VAR_2 >> 3) & 1;
VAR_4->timer.it_ena = (VAR_2 >> 2) & 1;
if (VAR_4->timer.st != (VAR_2 & 1) || (VAR_2 & 2)) {
omap_timer_sync(&VAR_4->timer);
VAR_4->timer.enable = VAR_2 & 1;
VAR_4->timer.st = VAR_2 & 1;
omap_timer_update(&VAR_4->timer);
}
break;
default:
OMAP_BAD_REG(VAR_1);
}
}
|
[
"static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{",
"struct omap_32khz_timer_s *VAR_4 = (struct omap_32khz_timer_s *) VAR_0;",
"int VAR_5 = VAR_1 & OMAP_MPUI_REG_MASK;",
"if (VAR_3 != 4) {",
"return omap_badwidth_write32(VAR_0, VAR_1, VAR_2);",
"}",
"switch (VAR_5) {",
"case 0x00:\nVAR_4->timer.reset_val = VAR_2 & 0x00ffffff;",
"break;",
"case 0x04:\nOMAP_RO_REG(VAR_1);",
"break;",
"case 0x08:\nVAR_4->timer.ar = (VAR_2 >> 3) & 1;",
"VAR_4->timer.it_ena = (VAR_2 >> 2) & 1;",
"if (VAR_4->timer.st != (VAR_2 & 1) || (VAR_2 & 2)) {",
"omap_timer_sync(&VAR_4->timer);",
"VAR_4->timer.enable = VAR_2 & 1;",
"VAR_4->timer.st = VAR_2 & 1;",
"omap_timer_update(&VAR_4->timer);",
"}",
"break;",
"default:\nOMAP_BAD_REG(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
],
[
13
],
[
15
],
[
17
],
[
21
],
[
23,
25
],
[
27
],
[
31,
33
],
[
35
],
[
39,
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
61,
63
],
[
65
],
[
67
]
] |
9,698 |
static void tcg_out_setcond(TCGContext *s, TCGType type, TCGCond cond,
TCGArg arg0, TCGArg arg1, TCGArg arg2,
int const_arg2)
{
int crop, sh;
assert(TCG_TARGET_REG_BITS == 64 || type == TCG_TYPE_I32);
/* Ignore high bits of a potential constant arg2. */
if (type == TCG_TYPE_I32) {
arg2 = (uint32_t)arg2;
}
/* Handle common and trivial cases before handling anything else. */
if (arg2 == 0) {
switch (cond) {
case TCG_COND_EQ:
tcg_out_setcond_eq0(s, type, arg0, arg1);
return;
case TCG_COND_NE:
if (TCG_TARGET_REG_BITS == 64 && type == TCG_TYPE_I32) {
tcg_out_ext32u(s, TCG_REG_R0, arg1);
arg1 = TCG_REG_R0;
}
tcg_out_setcond_ne0(s, arg0, arg1);
return;
case TCG_COND_GE:
tcg_out32(s, NOR | SAB(arg1, arg0, arg1));
arg1 = arg0;
/* FALLTHRU */
case TCG_COND_LT:
/* Extract the sign bit. */
if (type == TCG_TYPE_I32) {
tcg_out_shri32(s, arg0, arg1, 31);
} else {
tcg_out_shri64(s, arg0, arg1, 63);
}
return;
default:
break;
}
}
/* If we have ISEL, we can implement everything with 3 or 4 insns.
All other cases below are also at least 3 insns, so speed up the
code generator by not considering them and always using ISEL. */
if (HAVE_ISEL) {
int isel, tab;
tcg_out_cmp(s, cond, arg1, arg2, const_arg2, 7, type);
isel = tcg_to_isel[cond];
tcg_out_movi(s, type, arg0, 1);
if (isel & 1) {
/* arg0 = (bc ? 0 : 1) */
tab = TAB(arg0, 0, arg0);
isel &= ~1;
} else {
/* arg0 = (bc ? 1 : 0) */
tcg_out_movi(s, type, TCG_REG_R0, 0);
tab = TAB(arg0, arg0, TCG_REG_R0);
}
tcg_out32(s, isel | tab);
return;
}
switch (cond) {
case TCG_COND_EQ:
arg1 = tcg_gen_setcond_xor(s, arg1, arg2, const_arg2);
tcg_out_setcond_eq0(s, type, arg0, arg1);
return;
case TCG_COND_NE:
arg1 = tcg_gen_setcond_xor(s, arg1, arg2, const_arg2);
/* Discard the high bits only once, rather than both inputs. */
if (TCG_TARGET_REG_BITS == 64 && type == TCG_TYPE_I32) {
tcg_out_ext32u(s, TCG_REG_R0, arg1);
arg1 = TCG_REG_R0;
}
tcg_out_setcond_ne0(s, arg0, arg1);
return;
case TCG_COND_GT:
case TCG_COND_GTU:
sh = 30;
crop = 0;
goto crtest;
case TCG_COND_LT:
case TCG_COND_LTU:
sh = 29;
crop = 0;
goto crtest;
case TCG_COND_GE:
case TCG_COND_GEU:
sh = 31;
crop = CRNOR | BT(7, CR_EQ) | BA(7, CR_LT) | BB(7, CR_LT);
goto crtest;
case TCG_COND_LE:
case TCG_COND_LEU:
sh = 31;
crop = CRNOR | BT(7, CR_EQ) | BA(7, CR_GT) | BB(7, CR_GT);
crtest:
tcg_out_cmp(s, cond, arg1, arg2, const_arg2, 7, type);
if (crop) {
tcg_out32(s, crop);
}
tcg_out32(s, MFOCRF | RT(TCG_REG_R0) | FXM(7));
tcg_out_rlw(s, RLWINM, arg0, TCG_REG_R0, sh, 31, 31);
break;
default:
tcg_abort();
}
}
| false |
qemu
|
eabb7b91b36b202b4dac2df2d59d698e3aff197a
|
static void tcg_out_setcond(TCGContext *s, TCGType type, TCGCond cond,
TCGArg arg0, TCGArg arg1, TCGArg arg2,
int const_arg2)
{
int crop, sh;
assert(TCG_TARGET_REG_BITS == 64 || type == TCG_TYPE_I32);
if (type == TCG_TYPE_I32) {
arg2 = (uint32_t)arg2;
}
if (arg2 == 0) {
switch (cond) {
case TCG_COND_EQ:
tcg_out_setcond_eq0(s, type, arg0, arg1);
return;
case TCG_COND_NE:
if (TCG_TARGET_REG_BITS == 64 && type == TCG_TYPE_I32) {
tcg_out_ext32u(s, TCG_REG_R0, arg1);
arg1 = TCG_REG_R0;
}
tcg_out_setcond_ne0(s, arg0, arg1);
return;
case TCG_COND_GE:
tcg_out32(s, NOR | SAB(arg1, arg0, arg1));
arg1 = arg0;
case TCG_COND_LT:
if (type == TCG_TYPE_I32) {
tcg_out_shri32(s, arg0, arg1, 31);
} else {
tcg_out_shri64(s, arg0, arg1, 63);
}
return;
default:
break;
}
}
if (HAVE_ISEL) {
int isel, tab;
tcg_out_cmp(s, cond, arg1, arg2, const_arg2, 7, type);
isel = tcg_to_isel[cond];
tcg_out_movi(s, type, arg0, 1);
if (isel & 1) {
tab = TAB(arg0, 0, arg0);
isel &= ~1;
} else {
tcg_out_movi(s, type, TCG_REG_R0, 0);
tab = TAB(arg0, arg0, TCG_REG_R0);
}
tcg_out32(s, isel | tab);
return;
}
switch (cond) {
case TCG_COND_EQ:
arg1 = tcg_gen_setcond_xor(s, arg1, arg2, const_arg2);
tcg_out_setcond_eq0(s, type, arg0, arg1);
return;
case TCG_COND_NE:
arg1 = tcg_gen_setcond_xor(s, arg1, arg2, const_arg2);
if (TCG_TARGET_REG_BITS == 64 && type == TCG_TYPE_I32) {
tcg_out_ext32u(s, TCG_REG_R0, arg1);
arg1 = TCG_REG_R0;
}
tcg_out_setcond_ne0(s, arg0, arg1);
return;
case TCG_COND_GT:
case TCG_COND_GTU:
sh = 30;
crop = 0;
goto crtest;
case TCG_COND_LT:
case TCG_COND_LTU:
sh = 29;
crop = 0;
goto crtest;
case TCG_COND_GE:
case TCG_COND_GEU:
sh = 31;
crop = CRNOR | BT(7, CR_EQ) | BA(7, CR_LT) | BB(7, CR_LT);
goto crtest;
case TCG_COND_LE:
case TCG_COND_LEU:
sh = 31;
crop = CRNOR | BT(7, CR_EQ) | BA(7, CR_GT) | BB(7, CR_GT);
crtest:
tcg_out_cmp(s, cond, arg1, arg2, const_arg2, 7, type);
if (crop) {
tcg_out32(s, crop);
}
tcg_out32(s, MFOCRF | RT(TCG_REG_R0) | FXM(7));
tcg_out_rlw(s, RLWINM, arg0, TCG_REG_R0, sh, 31, 31);
break;
default:
tcg_abort();
}
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(TCGContext *VAR_0, TCGType VAR_1, TCGCond VAR_2,
TCGArg VAR_3, TCGArg VAR_4, TCGArg VAR_5,
int VAR_6)
{
int VAR_7, VAR_8;
assert(TCG_TARGET_REG_BITS == 64 || VAR_1 == TCG_TYPE_I32);
if (VAR_1 == TCG_TYPE_I32) {
VAR_5 = (uint32_t)VAR_5;
}
if (VAR_5 == 0) {
switch (VAR_2) {
case TCG_COND_EQ:
tcg_out_setcond_eq0(VAR_0, VAR_1, VAR_3, VAR_4);
return;
case TCG_COND_NE:
if (TCG_TARGET_REG_BITS == 64 && VAR_1 == TCG_TYPE_I32) {
tcg_out_ext32u(VAR_0, TCG_REG_R0, VAR_4);
VAR_4 = TCG_REG_R0;
}
tcg_out_setcond_ne0(VAR_0, VAR_3, VAR_4);
return;
case TCG_COND_GE:
tcg_out32(VAR_0, NOR | SAB(VAR_4, VAR_3, VAR_4));
VAR_4 = VAR_3;
case TCG_COND_LT:
if (VAR_1 == TCG_TYPE_I32) {
tcg_out_shri32(VAR_0, VAR_3, VAR_4, 31);
} else {
tcg_out_shri64(VAR_0, VAR_3, VAR_4, 63);
}
return;
default:
break;
}
}
if (HAVE_ISEL) {
int VAR_9, VAR_10;
tcg_out_cmp(VAR_0, VAR_2, VAR_4, VAR_5, VAR_6, 7, VAR_1);
VAR_9 = tcg_to_isel[VAR_2];
tcg_out_movi(VAR_0, VAR_1, VAR_3, 1);
if (VAR_9 & 1) {
VAR_10 = TAB(VAR_3, 0, VAR_3);
VAR_9 &= ~1;
} else {
tcg_out_movi(VAR_0, VAR_1, TCG_REG_R0, 0);
VAR_10 = TAB(VAR_3, VAR_3, TCG_REG_R0);
}
tcg_out32(VAR_0, VAR_9 | VAR_10);
return;
}
switch (VAR_2) {
case TCG_COND_EQ:
VAR_4 = tcg_gen_setcond_xor(VAR_0, VAR_4, VAR_5, VAR_6);
tcg_out_setcond_eq0(VAR_0, VAR_1, VAR_3, VAR_4);
return;
case TCG_COND_NE:
VAR_4 = tcg_gen_setcond_xor(VAR_0, VAR_4, VAR_5, VAR_6);
if (TCG_TARGET_REG_BITS == 64 && VAR_1 == TCG_TYPE_I32) {
tcg_out_ext32u(VAR_0, TCG_REG_R0, VAR_4);
VAR_4 = TCG_REG_R0;
}
tcg_out_setcond_ne0(VAR_0, VAR_3, VAR_4);
return;
case TCG_COND_GT:
case TCG_COND_GTU:
VAR_8 = 30;
VAR_7 = 0;
goto crtest;
case TCG_COND_LT:
case TCG_COND_LTU:
VAR_8 = 29;
VAR_7 = 0;
goto crtest;
case TCG_COND_GE:
case TCG_COND_GEU:
VAR_8 = 31;
VAR_7 = CRNOR | BT(7, CR_EQ) | BA(7, CR_LT) | BB(7, CR_LT);
goto crtest;
case TCG_COND_LE:
case TCG_COND_LEU:
VAR_8 = 31;
VAR_7 = CRNOR | BT(7, CR_EQ) | BA(7, CR_GT) | BB(7, CR_GT);
crtest:
tcg_out_cmp(VAR_0, VAR_2, VAR_4, VAR_5, VAR_6, 7, VAR_1);
if (VAR_7) {
tcg_out32(VAR_0, VAR_7);
}
tcg_out32(VAR_0, MFOCRF | RT(TCG_REG_R0) | FXM(7));
tcg_out_rlw(VAR_0, RLWINM, VAR_3, TCG_REG_R0, VAR_8, 31, 31);
break;
default:
tcg_abort();
}
}
|
[
"static void FUNC_0(TCGContext *VAR_0, TCGType VAR_1, TCGCond VAR_2,\nTCGArg VAR_3, TCGArg VAR_4, TCGArg VAR_5,\nint VAR_6)\n{",
"int VAR_7, VAR_8;",
"assert(TCG_TARGET_REG_BITS == 64 || VAR_1 == TCG_TYPE_I32);",
"if (VAR_1 == TCG_TYPE_I32) {",
"VAR_5 = (uint32_t)VAR_5;",
"}",
"if (VAR_5 == 0) {",
"switch (VAR_2) {",
"case TCG_COND_EQ:\ntcg_out_setcond_eq0(VAR_0, VAR_1, VAR_3, VAR_4);",
"return;",
"case TCG_COND_NE:\nif (TCG_TARGET_REG_BITS == 64 && VAR_1 == TCG_TYPE_I32) {",
"tcg_out_ext32u(VAR_0, TCG_REG_R0, VAR_4);",
"VAR_4 = TCG_REG_R0;",
"}",
"tcg_out_setcond_ne0(VAR_0, VAR_3, VAR_4);",
"return;",
"case TCG_COND_GE:\ntcg_out32(VAR_0, NOR | SAB(VAR_4, VAR_3, VAR_4));",
"VAR_4 = VAR_3;",
"case TCG_COND_LT:\nif (VAR_1 == TCG_TYPE_I32) {",
"tcg_out_shri32(VAR_0, VAR_3, VAR_4, 31);",
"} else {",
"tcg_out_shri64(VAR_0, VAR_3, VAR_4, 63);",
"}",
"return;",
"default:\nbreak;",
"}",
"}",
"if (HAVE_ISEL) {",
"int VAR_9, VAR_10;",
"tcg_out_cmp(VAR_0, VAR_2, VAR_4, VAR_5, VAR_6, 7, VAR_1);",
"VAR_9 = tcg_to_isel[VAR_2];",
"tcg_out_movi(VAR_0, VAR_1, VAR_3, 1);",
"if (VAR_9 & 1) {",
"VAR_10 = TAB(VAR_3, 0, VAR_3);",
"VAR_9 &= ~1;",
"} else {",
"tcg_out_movi(VAR_0, VAR_1, TCG_REG_R0, 0);",
"VAR_10 = TAB(VAR_3, VAR_3, TCG_REG_R0);",
"}",
"tcg_out32(VAR_0, VAR_9 | VAR_10);",
"return;",
"}",
"switch (VAR_2) {",
"case TCG_COND_EQ:\nVAR_4 = tcg_gen_setcond_xor(VAR_0, VAR_4, VAR_5, VAR_6);",
"tcg_out_setcond_eq0(VAR_0, VAR_1, VAR_3, VAR_4);",
"return;",
"case TCG_COND_NE:\nVAR_4 = tcg_gen_setcond_xor(VAR_0, VAR_4, VAR_5, VAR_6);",
"if (TCG_TARGET_REG_BITS == 64 && VAR_1 == TCG_TYPE_I32) {",
"tcg_out_ext32u(VAR_0, TCG_REG_R0, VAR_4);",
"VAR_4 = TCG_REG_R0;",
"}",
"tcg_out_setcond_ne0(VAR_0, VAR_3, VAR_4);",
"return;",
"case TCG_COND_GT:\ncase TCG_COND_GTU:\nVAR_8 = 30;",
"VAR_7 = 0;",
"goto crtest;",
"case TCG_COND_LT:\ncase TCG_COND_LTU:\nVAR_8 = 29;",
"VAR_7 = 0;",
"goto crtest;",
"case TCG_COND_GE:\ncase TCG_COND_GEU:\nVAR_8 = 31;",
"VAR_7 = CRNOR | BT(7, CR_EQ) | BA(7, CR_LT) | BB(7, CR_LT);",
"goto crtest;",
"case TCG_COND_LE:\ncase TCG_COND_LEU:\nVAR_8 = 31;",
"VAR_7 = CRNOR | BT(7, CR_EQ) | BA(7, CR_GT) | BB(7, CR_GT);",
"crtest:\ntcg_out_cmp(VAR_0, VAR_2, VAR_4, VAR_5, VAR_6, 7, VAR_1);",
"if (VAR_7) {",
"tcg_out32(VAR_0, VAR_7);",
"}",
"tcg_out32(VAR_0, MFOCRF | RT(TCG_REG_R0) | FXM(7));",
"tcg_out_rlw(VAR_0, RLWINM, VAR_3, TCG_REG_R0, VAR_8, 31, 31);",
"break;",
"default:\ntcg_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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5,
7
],
[
9
],
[
13
],
[
19
],
[
21
],
[
23
],
[
29
],
[
31
],
[
33,
35
],
[
37
],
[
39,
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53,
55
],
[
57
],
[
61,
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77,
79
],
[
81
],
[
83
],
[
93
],
[
95
],
[
99
],
[
103
],
[
107
],
[
109
],
[
113
],
[
115
],
[
117
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
135
],
[
137,
139
],
[
141
],
[
143
],
[
147,
149
],
[
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
167,
169,
171
],
[
173
],
[
175
],
[
179,
181,
183
],
[
185
],
[
187
],
[
191,
193,
195
],
[
197
],
[
199
],
[
203,
205,
207
],
[
209
],
[
211,
213
],
[
215
],
[
217
],
[
219
],
[
221
],
[
223
],
[
225
],
[
229,
231
],
[
233
],
[
235
]
] |
9,702 |
static void qmp_input_optional(Visitor *v, const char *name, bool *present)
{
QmpInputVisitor *qiv = to_qiv(v);
QObject *qobj = qmp_input_get_object(qiv, name, false, NULL);
if (!qobj) {
*present = false;
return;
}
*present = true;
}
| false |
qemu
|
09e68369a88d7de0f988972bf28eec1b80cc47f9
|
static void qmp_input_optional(Visitor *v, const char *name, bool *present)
{
QmpInputVisitor *qiv = to_qiv(v);
QObject *qobj = qmp_input_get_object(qiv, name, false, NULL);
if (!qobj) {
*present = false;
return;
}
*present = true;
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(Visitor *VAR_0, const char *VAR_1, bool *VAR_2)
{
QmpInputVisitor *qiv = to_qiv(VAR_0);
QObject *qobj = qmp_input_get_object(qiv, VAR_1, false, NULL);
if (!qobj) {
*VAR_2 = false;
return;
}
*VAR_2 = true;
}
|
[
"static void FUNC_0(Visitor *VAR_0, const char *VAR_1, bool *VAR_2)\n{",
"QmpInputVisitor *qiv = to_qiv(VAR_0);",
"QObject *qobj = qmp_input_get_object(qiv, VAR_1, false, NULL);",
"if (!qobj) {",
"*VAR_2 = false;",
"return;",
"}",
"*VAR_2 = true;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
15
],
[
17
],
[
21
],
[
23
]
] |
9,703 |
static int intel_hda_send_command(IntelHDAState *d, uint32_t verb)
{
uint32_t cad, nid, data;
HDACodecDevice *codec;
HDACodecDeviceClass *cdc;
cad = (verb >> 28) & 0x0f;
if (verb & (1 << 27)) {
/* indirect node addressing, not specified in HDA 1.0 */
dprint(d, 1, "%s: indirect node addressing (guest bug?)\n", __FUNCTION__);
return -1;
}
nid = (verb >> 20) & 0x7f;
data = verb & 0xfffff;
codec = hda_codec_find(&d->codecs, cad);
if (codec == NULL) {
dprint(d, 1, "%s: addressed non-existing codec\n", __FUNCTION__);
return -1;
}
cdc = HDA_CODEC_DEVICE_GET_CLASS(codec);
cdc->command(codec, nid, data);
return 0;
}
| false |
qemu
|
a89f364ae8740dfc31b321eed9ee454e996dc3c1
|
static int intel_hda_send_command(IntelHDAState *d, uint32_t verb)
{
uint32_t cad, nid, data;
HDACodecDevice *codec;
HDACodecDeviceClass *cdc;
cad = (verb >> 28) & 0x0f;
if (verb & (1 << 27)) {
dprint(d, 1, "%s: indirect node addressing (guest bug?)\n", __FUNCTION__);
return -1;
}
nid = (verb >> 20) & 0x7f;
data = verb & 0xfffff;
codec = hda_codec_find(&d->codecs, cad);
if (codec == NULL) {
dprint(d, 1, "%s: addressed non-existing codec\n", __FUNCTION__);
return -1;
}
cdc = HDA_CODEC_DEVICE_GET_CLASS(codec);
cdc->command(codec, nid, data);
return 0;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(IntelHDAState *VAR_0, uint32_t VAR_1)
{
uint32_t cad, nid, data;
HDACodecDevice *codec;
HDACodecDeviceClass *cdc;
cad = (VAR_1 >> 28) & 0x0f;
if (VAR_1 & (1 << 27)) {
dprint(VAR_0, 1, "%s: indirect node addressing (guest bug?)\n", __FUNCTION__);
return -1;
}
nid = (VAR_1 >> 20) & 0x7f;
data = VAR_1 & 0xfffff;
codec = hda_codec_find(&VAR_0->codecs, cad);
if (codec == NULL) {
dprint(VAR_0, 1, "%s: addressed non-existing codec\n", __FUNCTION__);
return -1;
}
cdc = HDA_CODEC_DEVICE_GET_CLASS(codec);
cdc->command(codec, nid, data);
return 0;
}
|
[
"static int FUNC_0(IntelHDAState *VAR_0, uint32_t VAR_1)\n{",
"uint32_t cad, nid, data;",
"HDACodecDevice *codec;",
"HDACodecDeviceClass *cdc;",
"cad = (VAR_1 >> 28) & 0x0f;",
"if (VAR_1 & (1 << 27)) {",
"dprint(VAR_0, 1, \"%s: indirect node addressing (guest bug?)\\n\", __FUNCTION__);",
"return -1;",
"}",
"nid = (VAR_1 >> 20) & 0x7f;",
"data = VAR_1 & 0xfffff;",
"codec = hda_codec_find(&VAR_0->codecs, cad);",
"if (codec == NULL) {",
"dprint(VAR_0, 1, \"%s: addressed non-existing codec\\n\", __FUNCTION__);",
"return -1;",
"}",
"cdc = HDA_CODEC_DEVICE_GET_CLASS(codec);",
"cdc->command(codec, nid, data);",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
]
] |
9,704 |
static void timerblock_write(void *opaque, target_phys_addr_t addr,
uint64_t value, unsigned size)
{
timerblock *tb = (timerblock *)opaque;
int64_t old;
switch (addr) {
case 0: /* Load */
tb->load = value;
/* Fall through. */
case 4: /* Counter. */
if ((tb->control & 1) && tb->count) {
/* Cancel the previous timer. */
qemu_del_timer(tb->timer);
}
tb->count = value;
if (tb->control & 1) {
timerblock_reload(tb, 1);
}
break;
case 8: /* Control. */
old = tb->control;
tb->control = value;
if (((old & 1) == 0) && (value & 1)) {
if (tb->count == 0 && (tb->control & 2)) {
tb->count = tb->load;
}
timerblock_reload(tb, 1);
}
break;
case 12: /* Interrupt status. */
tb->status &= ~value;
timerblock_update_irq(tb);
break;
}
}
| false |
qemu
|
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
|
static void timerblock_write(void *opaque, target_phys_addr_t addr,
uint64_t value, unsigned size)
{
timerblock *tb = (timerblock *)opaque;
int64_t old;
switch (addr) {
case 0:
tb->load = value;
case 4:
if ((tb->control & 1) && tb->count) {
qemu_del_timer(tb->timer);
}
tb->count = value;
if (tb->control & 1) {
timerblock_reload(tb, 1);
}
break;
case 8:
old = tb->control;
tb->control = value;
if (((old & 1) == 0) && (value & 1)) {
if (tb->count == 0 && (tb->control & 2)) {
tb->count = tb->load;
}
timerblock_reload(tb, 1);
}
break;
case 12:
tb->status &= ~value;
timerblock_update_irq(tb);
break;
}
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,
uint64_t VAR_2, unsigned VAR_3)
{
timerblock *tb = (timerblock *)VAR_0;
int64_t old;
switch (VAR_1) {
case 0:
tb->load = VAR_2;
case 4:
if ((tb->control & 1) && tb->count) {
qemu_del_timer(tb->timer);
}
tb->count = VAR_2;
if (tb->control & 1) {
timerblock_reload(tb, 1);
}
break;
case 8:
old = tb->control;
tb->control = VAR_2;
if (((old & 1) == 0) && (VAR_2 & 1)) {
if (tb->count == 0 && (tb->control & 2)) {
tb->count = tb->load;
}
timerblock_reload(tb, 1);
}
break;
case 12:
tb->status &= ~VAR_2;
timerblock_update_irq(tb);
break;
}
}
|
[
"static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{",
"timerblock *tb = (timerblock *)VAR_0;",
"int64_t old;",
"switch (VAR_1) {",
"case 0:\ntb->load = VAR_2;",
"case 4:\nif ((tb->control & 1) && tb->count) {",
"qemu_del_timer(tb->timer);",
"}",
"tb->count = VAR_2;",
"if (tb->control & 1) {",
"timerblock_reload(tb, 1);",
"}",
"break;",
"case 8:\nold = tb->control;",
"tb->control = VAR_2;",
"if (((old & 1) == 0) && (VAR_2 & 1)) {",
"if (tb->count == 0 && (tb->control & 2)) {",
"tb->count = tb->load;",
"}",
"timerblock_reload(tb, 1);",
"}",
"break;",
"case 12:\ntb->status &= ~VAR_2;",
"timerblock_update_irq(tb);",
"break;",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13,
15
],
[
19,
21
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39,
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59,
61
],
[
63
],
[
65
],
[
67
],
[
69
]
] |
9,705 |
int av_find_best_stream(AVFormatContext *ic,
enum AVMediaType type,
int wanted_stream_nb,
int related_stream,
AVCodec **decoder_ret,
int flags)
{
int i, nb_streams = ic->nb_streams, stream_number = 0;
int ret = AVERROR_STREAM_NOT_FOUND, best_count = -1;
unsigned *program = NULL;
AVCodec *decoder = NULL, *best_decoder = NULL;
if (related_stream >= 0 && wanted_stream_nb < 0) {
AVProgram *p = find_program_from_stream(ic, related_stream);
if (p) {
program = p->stream_index;
nb_streams = p->nb_stream_indexes;
}
}
for (i = 0; i < nb_streams; i++) {
AVStream *st = ic->streams[program ? program[i] : i];
AVCodecContext *avctx = st->codec;
if (avctx->codec_type != type)
continue;
if (wanted_stream_nb >= 0 && stream_number++ != wanted_stream_nb)
continue;
if (st->disposition & (AV_DISPOSITION_HEARING_IMPAIRED|AV_DISPOSITION_VISUAL_IMPAIRED))
continue;
if (decoder_ret) {
decoder = avcodec_find_decoder(st->codec->codec_id);
if (!decoder) {
if (ret < 0)
ret = AVERROR_DECODER_NOT_FOUND;
continue;
}
}
if (best_count >= st->codec_info_nb_frames)
continue;
best_count = st->codec_info_nb_frames;
ret = program ? program[i] : i;
best_decoder = decoder;
if (program && i == nb_streams - 1 && ret < 0) {
program = NULL;
nb_streams = ic->nb_streams;
i = 0; /* no related stream found, try again with everything */
}
}
if (decoder_ret)
*decoder_ret = best_decoder;
return ret;
}
| false |
FFmpeg
|
2c7158169859eb2dd49a72337f9f3f28347da77a
|
int av_find_best_stream(AVFormatContext *ic,
enum AVMediaType type,
int wanted_stream_nb,
int related_stream,
AVCodec **decoder_ret,
int flags)
{
int i, nb_streams = ic->nb_streams, stream_number = 0;
int ret = AVERROR_STREAM_NOT_FOUND, best_count = -1;
unsigned *program = NULL;
AVCodec *decoder = NULL, *best_decoder = NULL;
if (related_stream >= 0 && wanted_stream_nb < 0) {
AVProgram *p = find_program_from_stream(ic, related_stream);
if (p) {
program = p->stream_index;
nb_streams = p->nb_stream_indexes;
}
}
for (i = 0; i < nb_streams; i++) {
AVStream *st = ic->streams[program ? program[i] : i];
AVCodecContext *avctx = st->codec;
if (avctx->codec_type != type)
continue;
if (wanted_stream_nb >= 0 && stream_number++ != wanted_stream_nb)
continue;
if (st->disposition & (AV_DISPOSITION_HEARING_IMPAIRED|AV_DISPOSITION_VISUAL_IMPAIRED))
continue;
if (decoder_ret) {
decoder = avcodec_find_decoder(st->codec->codec_id);
if (!decoder) {
if (ret < 0)
ret = AVERROR_DECODER_NOT_FOUND;
continue;
}
}
if (best_count >= st->codec_info_nb_frames)
continue;
best_count = st->codec_info_nb_frames;
ret = program ? program[i] : i;
best_decoder = decoder;
if (program && i == nb_streams - 1 && ret < 0) {
program = NULL;
nb_streams = ic->nb_streams;
i = 0;
}
}
if (decoder_ret)
*decoder_ret = best_decoder;
return ret;
}
|
{
"code": [],
"line_no": []
}
|
int FUNC_0(AVFormatContext *VAR_0,
enum AVMediaType VAR_1,
int VAR_2,
int VAR_3,
AVCodec **VAR_4,
int VAR_5)
{
int VAR_6, VAR_7 = VAR_0->VAR_7, VAR_8 = 0;
int VAR_9 = AVERROR_STREAM_NOT_FOUND, VAR_10 = -1;
unsigned *VAR_11 = NULL;
AVCodec *decoder = NULL, *best_decoder = NULL;
if (VAR_3 >= 0 && VAR_2 < 0) {
AVProgram *p = find_program_from_stream(VAR_0, VAR_3);
if (p) {
VAR_11 = p->stream_index;
VAR_7 = p->nb_stream_indexes;
}
}
for (VAR_6 = 0; VAR_6 < VAR_7; VAR_6++) {
AVStream *st = VAR_0->streams[VAR_11 ? VAR_11[VAR_6] : VAR_6];
AVCodecContext *avctx = st->codec;
if (avctx->codec_type != VAR_1)
continue;
if (VAR_2 >= 0 && VAR_8++ != VAR_2)
continue;
if (st->disposition & (AV_DISPOSITION_HEARING_IMPAIRED|AV_DISPOSITION_VISUAL_IMPAIRED))
continue;
if (VAR_4) {
decoder = avcodec_find_decoder(st->codec->codec_id);
if (!decoder) {
if (VAR_9 < 0)
VAR_9 = AVERROR_DECODER_NOT_FOUND;
continue;
}
}
if (VAR_10 >= st->codec_info_nb_frames)
continue;
VAR_10 = st->codec_info_nb_frames;
VAR_9 = VAR_11 ? VAR_11[VAR_6] : VAR_6;
best_decoder = decoder;
if (VAR_11 && VAR_6 == VAR_7 - 1 && VAR_9 < 0) {
VAR_11 = NULL;
VAR_7 = VAR_0->VAR_7;
VAR_6 = 0;
}
}
if (VAR_4)
*VAR_4 = best_decoder;
return VAR_9;
}
|
[
"int FUNC_0(AVFormatContext *VAR_0,\nenum AVMediaType VAR_1,\nint VAR_2,\nint VAR_3,\nAVCodec **VAR_4,\nint VAR_5)\n{",
"int VAR_6, VAR_7 = VAR_0->VAR_7, VAR_8 = 0;",
"int VAR_9 = AVERROR_STREAM_NOT_FOUND, VAR_10 = -1;",
"unsigned *VAR_11 = NULL;",
"AVCodec *decoder = NULL, *best_decoder = NULL;",
"if (VAR_3 >= 0 && VAR_2 < 0) {",
"AVProgram *p = find_program_from_stream(VAR_0, VAR_3);",
"if (p) {",
"VAR_11 = p->stream_index;",
"VAR_7 = p->nb_stream_indexes;",
"}",
"}",
"for (VAR_6 = 0; VAR_6 < VAR_7; VAR_6++) {",
"AVStream *st = VAR_0->streams[VAR_11 ? VAR_11[VAR_6] : VAR_6];",
"AVCodecContext *avctx = st->codec;",
"if (avctx->codec_type != VAR_1)\ncontinue;",
"if (VAR_2 >= 0 && VAR_8++ != VAR_2)\ncontinue;",
"if (st->disposition & (AV_DISPOSITION_HEARING_IMPAIRED|AV_DISPOSITION_VISUAL_IMPAIRED))\ncontinue;",
"if (VAR_4) {",
"decoder = avcodec_find_decoder(st->codec->codec_id);",
"if (!decoder) {",
"if (VAR_9 < 0)\nVAR_9 = AVERROR_DECODER_NOT_FOUND;",
"continue;",
"}",
"}",
"if (VAR_10 >= st->codec_info_nb_frames)\ncontinue;",
"VAR_10 = st->codec_info_nb_frames;",
"VAR_9 = VAR_11 ? VAR_11[VAR_6] : VAR_6;",
"best_decoder = decoder;",
"if (VAR_11 && VAR_6 == VAR_7 - 1 && VAR_9 < 0) {",
"VAR_11 = NULL;",
"VAR_7 = VAR_0->VAR_7;",
"VAR_6 = 0;",
"}",
"}",
"if (VAR_4)\n*VAR_4 = best_decoder;",
"return VAR_9;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5,
7,
9,
11,
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
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
]
] |
9,708 |
BlockDriverState *bdrv_new(const char *device_name, Error **errp)
{
BlockDriverState *bs;
int i;
if (*device_name && !bdrv_is_valid_name(device_name)) {
error_setg(errp, "Invalid device name");
return NULL;
}
if (bdrv_find(device_name)) {
error_setg(errp, "Device with id '%s' already exists",
device_name);
return NULL;
}
if (bdrv_find_node(device_name)) {
error_setg(errp,
"Device name '%s' conflicts with an existing node name",
device_name);
return NULL;
}
bs = g_new0(BlockDriverState, 1);
QLIST_INIT(&bs->dirty_bitmaps);
pstrcpy(bs->device_name, sizeof(bs->device_name), device_name);
if (device_name[0] != '\0') {
QTAILQ_INSERT_TAIL(&bdrv_states, bs, device_list);
}
for (i = 0; i < BLOCK_OP_TYPE_MAX; i++) {
QLIST_INIT(&bs->op_blockers[i]);
}
bdrv_iostatus_disable(bs);
notifier_list_init(&bs->close_notifiers);
notifier_with_return_list_init(&bs->before_write_notifiers);
qemu_co_queue_init(&bs->throttled_reqs[0]);
qemu_co_queue_init(&bs->throttled_reqs[1]);
bs->refcnt = 1;
bs->aio_context = qemu_get_aio_context();
return bs;
}
| false |
qemu
|
f5bebbbb28dc7a149a891f0f1e112fb50bb72664
|
BlockDriverState *bdrv_new(const char *device_name, Error **errp)
{
BlockDriverState *bs;
int i;
if (*device_name && !bdrv_is_valid_name(device_name)) {
error_setg(errp, "Invalid device name");
return NULL;
}
if (bdrv_find(device_name)) {
error_setg(errp, "Device with id '%s' already exists",
device_name);
return NULL;
}
if (bdrv_find_node(device_name)) {
error_setg(errp,
"Device name '%s' conflicts with an existing node name",
device_name);
return NULL;
}
bs = g_new0(BlockDriverState, 1);
QLIST_INIT(&bs->dirty_bitmaps);
pstrcpy(bs->device_name, sizeof(bs->device_name), device_name);
if (device_name[0] != '\0') {
QTAILQ_INSERT_TAIL(&bdrv_states, bs, device_list);
}
for (i = 0; i < BLOCK_OP_TYPE_MAX; i++) {
QLIST_INIT(&bs->op_blockers[i]);
}
bdrv_iostatus_disable(bs);
notifier_list_init(&bs->close_notifiers);
notifier_with_return_list_init(&bs->before_write_notifiers);
qemu_co_queue_init(&bs->throttled_reqs[0]);
qemu_co_queue_init(&bs->throttled_reqs[1]);
bs->refcnt = 1;
bs->aio_context = qemu_get_aio_context();
return bs;
}
|
{
"code": [],
"line_no": []
}
|
BlockDriverState *FUNC_0(const char *device_name, Error **errp)
{
BlockDriverState *bs;
int VAR_0;
if (*device_name && !bdrv_is_valid_name(device_name)) {
error_setg(errp, "Invalid device name");
return NULL;
}
if (bdrv_find(device_name)) {
error_setg(errp, "Device with id '%s' already exists",
device_name);
return NULL;
}
if (bdrv_find_node(device_name)) {
error_setg(errp,
"Device name '%s' conflicts with an existing node name",
device_name);
return NULL;
}
bs = g_new0(BlockDriverState, 1);
QLIST_INIT(&bs->dirty_bitmaps);
pstrcpy(bs->device_name, sizeof(bs->device_name), device_name);
if (device_name[0] != '\0') {
QTAILQ_INSERT_TAIL(&bdrv_states, bs, device_list);
}
for (VAR_0 = 0; VAR_0 < BLOCK_OP_TYPE_MAX; VAR_0++) {
QLIST_INIT(&bs->op_blockers[VAR_0]);
}
bdrv_iostatus_disable(bs);
notifier_list_init(&bs->close_notifiers);
notifier_with_return_list_init(&bs->before_write_notifiers);
qemu_co_queue_init(&bs->throttled_reqs[0]);
qemu_co_queue_init(&bs->throttled_reqs[1]);
bs->refcnt = 1;
bs->aio_context = qemu_get_aio_context();
return bs;
}
|
[
"BlockDriverState *FUNC_0(const char *device_name, Error **errp)\n{",
"BlockDriverState *bs;",
"int VAR_0;",
"if (*device_name && !bdrv_is_valid_name(device_name)) {",
"error_setg(errp, \"Invalid device name\");",
"return NULL;",
"}",
"if (bdrv_find(device_name)) {",
"error_setg(errp, \"Device with id '%s' already exists\",\ndevice_name);",
"return NULL;",
"}",
"if (bdrv_find_node(device_name)) {",
"error_setg(errp,\n\"Device name '%s' conflicts with an existing node name\",\ndevice_name);",
"return NULL;",
"}",
"bs = g_new0(BlockDriverState, 1);",
"QLIST_INIT(&bs->dirty_bitmaps);",
"pstrcpy(bs->device_name, sizeof(bs->device_name), device_name);",
"if (device_name[0] != '\\0') {",
"QTAILQ_INSERT_TAIL(&bdrv_states, bs, device_list);",
"}",
"for (VAR_0 = 0; VAR_0 < BLOCK_OP_TYPE_MAX; VAR_0++) {",
"QLIST_INIT(&bs->op_blockers[VAR_0]);",
"}",
"bdrv_iostatus_disable(bs);",
"notifier_list_init(&bs->close_notifiers);",
"notifier_with_return_list_init(&bs->before_write_notifiers);",
"qemu_co_queue_init(&bs->throttled_reqs[0]);",
"qemu_co_queue_init(&bs->throttled_reqs[1]);",
"bs->refcnt = 1;",
"bs->aio_context = qemu_get_aio_context();",
"return bs;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
15
],
[
17
],
[
21
],
[
23,
25
],
[
27
],
[
29
],
[
31
],
[
33,
35,
37
],
[
39
],
[
41
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
79
],
[
81
]
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.