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
|
---|---|---|---|---|---|---|---|---|---|---|
6,333 |
MemoryRegionSection memory_region_find(MemoryRegion *mr,
hwaddr addr, uint64_t size)
{
MemoryRegionSection ret = { .mr = NULL };
MemoryRegion *root;
AddressSpace *as;
AddrRange range;
FlatView *view;
FlatRange *fr;
addr += mr->addr;
for (root = mr; root->container; ) {
root = root->container;
addr += root->addr;
}
as = memory_region_to_address_space(root);
if (!as) {
return ret;
}
range = addrrange_make(int128_make64(addr), int128_make64(size));
rcu_read_lock();
view = atomic_rcu_read(&as->current_map);
fr = flatview_lookup(view, range);
if (!fr) {
goto out;
}
while (fr > view->ranges && addrrange_intersects(fr[-1].addr, range)) {
--fr;
}
ret.mr = fr->mr;
ret.address_space = as;
range = addrrange_intersection(range, fr->addr);
ret.offset_within_region = fr->offset_in_region;
ret.offset_within_region += int128_get64(int128_sub(range.start,
fr->addr.start));
ret.size = range.size;
ret.offset_within_address_space = int128_get64(range.start);
ret.readonly = fr->readonly;
memory_region_ref(ret.mr);
out:
rcu_read_unlock();
return ret;
}
| true |
qemu
|
c6742b14fe7352059cd4954a356a8105757af31b
|
MemoryRegionSection memory_region_find(MemoryRegion *mr,
hwaddr addr, uint64_t size)
{
MemoryRegionSection ret = { .mr = NULL };
MemoryRegion *root;
AddressSpace *as;
AddrRange range;
FlatView *view;
FlatRange *fr;
addr += mr->addr;
for (root = mr; root->container; ) {
root = root->container;
addr += root->addr;
}
as = memory_region_to_address_space(root);
if (!as) {
return ret;
}
range = addrrange_make(int128_make64(addr), int128_make64(size));
rcu_read_lock();
view = atomic_rcu_read(&as->current_map);
fr = flatview_lookup(view, range);
if (!fr) {
goto out;
}
while (fr > view->ranges && addrrange_intersects(fr[-1].addr, range)) {
--fr;
}
ret.mr = fr->mr;
ret.address_space = as;
range = addrrange_intersection(range, fr->addr);
ret.offset_within_region = fr->offset_in_region;
ret.offset_within_region += int128_get64(int128_sub(range.start,
fr->addr.start));
ret.size = range.size;
ret.offset_within_address_space = int128_get64(range.start);
ret.readonly = fr->readonly;
memory_region_ref(ret.mr);
out:
rcu_read_unlock();
return ret;
}
|
{
"code": [
"MemoryRegionSection memory_region_find(MemoryRegion *mr,",
" hwaddr addr, uint64_t size)",
" rcu_read_lock();",
" goto out;",
" memory_region_ref(ret.mr);",
"out:"
],
"line_no": [
1,
3,
45,
53,
85,
87
]
}
|
MemoryRegionSection FUNC_0(MemoryRegion *mr,
hwaddr addr, uint64_t size)
{
MemoryRegionSection ret = { .mr = NULL };
MemoryRegion *root;
AddressSpace *as;
AddrRange range;
FlatView *view;
FlatRange *fr;
addr += mr->addr;
for (root = mr; root->container; ) {
root = root->container;
addr += root->addr;
}
as = memory_region_to_address_space(root);
if (!as) {
return ret;
}
range = addrrange_make(int128_make64(addr), int128_make64(size));
rcu_read_lock();
view = atomic_rcu_read(&as->current_map);
fr = flatview_lookup(view, range);
if (!fr) {
goto out;
}
while (fr > view->ranges && addrrange_intersects(fr[-1].addr, range)) {
--fr;
}
ret.mr = fr->mr;
ret.address_space = as;
range = addrrange_intersection(range, fr->addr);
ret.offset_within_region = fr->offset_in_region;
ret.offset_within_region += int128_get64(int128_sub(range.start,
fr->addr.start));
ret.size = range.size;
ret.offset_within_address_space = int128_get64(range.start);
ret.readonly = fr->readonly;
memory_region_ref(ret.mr);
out:
rcu_read_unlock();
return ret;
}
|
[
"MemoryRegionSection FUNC_0(MemoryRegion *mr,\nhwaddr addr, uint64_t size)\n{",
"MemoryRegionSection ret = { .mr = NULL };",
"MemoryRegion *root;",
"AddressSpace *as;",
"AddrRange range;",
"FlatView *view;",
"FlatRange *fr;",
"addr += mr->addr;",
"for (root = mr; root->container; ) {",
"root = root->container;",
"addr += root->addr;",
"}",
"as = memory_region_to_address_space(root);",
"if (!as) {",
"return ret;",
"}",
"range = addrrange_make(int128_make64(addr), int128_make64(size));",
"rcu_read_lock();",
"view = atomic_rcu_read(&as->current_map);",
"fr = flatview_lookup(view, range);",
"if (!fr) {",
"goto out;",
"}",
"while (fr > view->ranges && addrrange_intersects(fr[-1].addr, range)) {",
"--fr;",
"}",
"ret.mr = fr->mr;",
"ret.address_space = as;",
"range = addrrange_intersection(range, fr->addr);",
"ret.offset_within_region = fr->offset_in_region;",
"ret.offset_within_region += int128_get64(int128_sub(range.start,\nfr->addr.start));",
"ret.size = range.size;",
"ret.offset_within_address_space = int128_get64(range.start);",
"ret.readonly = fr->readonly;",
"memory_region_ref(ret.mr);",
"out:\nrcu_read_unlock();",
"return ret;",
"}"
] |
[
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
59
],
[
61
],
[
63
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75,
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87,
89
],
[
91
],
[
93
]
] |
6,334 |
static void vnc_colordepth(DisplayState *ds)
{
int host_big_endian_flag;
struct VncState *vs = ds->opaque;
#ifdef WORDS_BIGENDIAN
host_big_endian_flag = 1;
#else
host_big_endian_flag = 0;
#endif
switch (ds_get_bits_per_pixel(ds)) {
case 8:
vs->depth = 1;
vs->server_red_max = 7;
vs->server_green_max = 7;
vs->server_blue_max = 3;
vs->server_red_shift = 5;
vs->server_green_shift = 2;
vs->server_blue_shift = 0;
break;
case 16:
vs->depth = 2;
vs->server_red_max = 31;
vs->server_green_max = 63;
vs->server_blue_max = 31;
vs->server_red_shift = 11;
vs->server_green_shift = 5;
vs->server_blue_shift = 0;
break;
case 32:
vs->depth = 4;
vs->server_red_max = 255;
vs->server_green_max = 255;
vs->server_blue_max = 255;
vs->server_red_shift = 16;
vs->server_green_shift = 8;
vs->server_blue_shift = 0;
break;
default:
return;
}
if (vs->csock != -1 && vs->has_WMVi) {
/* Sending a WMVi message to notify the client*/
vnc_write_u8(vs, 0); /* msg id */
vnc_write_u8(vs, 0);
vnc_write_u16(vs, 1); /* number of rects */
vnc_framebuffer_update(vs, 0, 0, ds_get_width(ds), ds_get_height(ds), 0x574D5669);
pixel_format_message(vs);
vnc_flush(vs);
} else {
if (vs->pix_bpp == 4 && vs->depth == 4 &&
host_big_endian_flag == vs->pix_big_endian &&
vs->client_red_max == 0xff && vs->client_green_max == 0xff && vs->client_blue_max == 0xff &&
vs->client_red_shift == 16 && vs->client_green_shift == 8 && vs->client_blue_shift == 0) {
vs->write_pixels = vnc_write_pixels_copy;
vs->send_hextile_tile = send_hextile_tile_32;
} else if (vs->pix_bpp == 2 && vs->depth == 2 &&
host_big_endian_flag == vs->pix_big_endian &&
vs->client_red_max == 31 && vs->client_green_max == 63 && vs->client_blue_max == 31 &&
vs->client_red_shift == 11 && vs->client_green_shift == 5 && vs->client_blue_shift == 0) {
vs->write_pixels = vnc_write_pixels_copy;
vs->send_hextile_tile = send_hextile_tile_16;
} else if (vs->pix_bpp == 1 && vs->depth == 1 &&
host_big_endian_flag == vs->pix_big_endian &&
vs->client_red_max == 7 && vs->client_green_max == 7 && vs->client_blue_max == 3 &&
vs->client_red_shift == 5 && vs->client_green_shift == 2 && vs->client_blue_shift == 0) {
vs->write_pixels = vnc_write_pixels_copy;
vs->send_hextile_tile = send_hextile_tile_8;
} else {
if (vs->depth == 4) {
vs->send_hextile_tile = send_hextile_tile_generic_32;
} else if (vs->depth == 2) {
vs->send_hextile_tile = send_hextile_tile_generic_16;
} else {
vs->send_hextile_tile = send_hextile_tile_generic_8;
}
vs->write_pixels = vnc_write_pixels_generic;
}
}
}
| true |
qemu
|
6cec5487990bf3f1f22b3fcb871978255e92ae0d
|
static void vnc_colordepth(DisplayState *ds)
{
int host_big_endian_flag;
struct VncState *vs = ds->opaque;
#ifdef WORDS_BIGENDIAN
host_big_endian_flag = 1;
#else
host_big_endian_flag = 0;
#endif
switch (ds_get_bits_per_pixel(ds)) {
case 8:
vs->depth = 1;
vs->server_red_max = 7;
vs->server_green_max = 7;
vs->server_blue_max = 3;
vs->server_red_shift = 5;
vs->server_green_shift = 2;
vs->server_blue_shift = 0;
break;
case 16:
vs->depth = 2;
vs->server_red_max = 31;
vs->server_green_max = 63;
vs->server_blue_max = 31;
vs->server_red_shift = 11;
vs->server_green_shift = 5;
vs->server_blue_shift = 0;
break;
case 32:
vs->depth = 4;
vs->server_red_max = 255;
vs->server_green_max = 255;
vs->server_blue_max = 255;
vs->server_red_shift = 16;
vs->server_green_shift = 8;
vs->server_blue_shift = 0;
break;
default:
return;
}
if (vs->csock != -1 && vs->has_WMVi) {
vnc_write_u8(vs, 0);
vnc_write_u8(vs, 0);
vnc_write_u16(vs, 1);
vnc_framebuffer_update(vs, 0, 0, ds_get_width(ds), ds_get_height(ds), 0x574D5669);
pixel_format_message(vs);
vnc_flush(vs);
} else {
if (vs->pix_bpp == 4 && vs->depth == 4 &&
host_big_endian_flag == vs->pix_big_endian &&
vs->client_red_max == 0xff && vs->client_green_max == 0xff && vs->client_blue_max == 0xff &&
vs->client_red_shift == 16 && vs->client_green_shift == 8 && vs->client_blue_shift == 0) {
vs->write_pixels = vnc_write_pixels_copy;
vs->send_hextile_tile = send_hextile_tile_32;
} else if (vs->pix_bpp == 2 && vs->depth == 2 &&
host_big_endian_flag == vs->pix_big_endian &&
vs->client_red_max == 31 && vs->client_green_max == 63 && vs->client_blue_max == 31 &&
vs->client_red_shift == 11 && vs->client_green_shift == 5 && vs->client_blue_shift == 0) {
vs->write_pixels = vnc_write_pixels_copy;
vs->send_hextile_tile = send_hextile_tile_16;
} else if (vs->pix_bpp == 1 && vs->depth == 1 &&
host_big_endian_flag == vs->pix_big_endian &&
vs->client_red_max == 7 && vs->client_green_max == 7 && vs->client_blue_max == 3 &&
vs->client_red_shift == 5 && vs->client_green_shift == 2 && vs->client_blue_shift == 0) {
vs->write_pixels = vnc_write_pixels_copy;
vs->send_hextile_tile = send_hextile_tile_8;
} else {
if (vs->depth == 4) {
vs->send_hextile_tile = send_hextile_tile_generic_32;
} else if (vs->depth == 2) {
vs->send_hextile_tile = send_hextile_tile_generic_16;
} else {
vs->send_hextile_tile = send_hextile_tile_generic_8;
}
vs->write_pixels = vnc_write_pixels_generic;
}
}
}
|
{
"code": [
" int host_big_endian_flag;",
"#ifdef WORDS_BIGENDIAN",
" host_big_endian_flag = 1;",
"#else",
" host_big_endian_flag = 0;",
" } else {",
" int host_big_endian_flag;",
"#ifdef WORDS_BIGENDIAN",
" host_big_endian_flag = 1;",
"#else",
" host_big_endian_flag = 0;",
"#endif ",
" switch (ds_get_bits_per_pixel(ds)) {",
" case 8:",
" vs->depth = 1;",
" vs->server_red_max = 7;",
" vs->server_green_max = 7;",
" vs->server_blue_max = 3;",
" vs->server_red_shift = 5;",
" vs->server_green_shift = 2;",
" vs->server_blue_shift = 0;",
" break;",
" case 16:",
" vs->depth = 2;",
" vs->server_red_max = 31;",
" vs->server_green_max = 63;",
" vs->server_blue_max = 31;",
" vs->server_red_shift = 11;",
" vs->server_green_shift = 5;",
" vs->server_blue_shift = 0;",
" break;",
" case 32:",
" vs->depth = 4;",
" vs->server_red_max = 255;",
" vs->server_green_max = 255;",
" vs->server_blue_max = 255;",
" vs->server_red_shift = 16;",
" vs->server_green_shift = 8;",
" vs->server_blue_shift = 0;",
" break;",
" default:",
" if (vs->pix_bpp == 4 && vs->depth == 4 &&",
" host_big_endian_flag == vs->pix_big_endian &&",
" vs->client_red_max == 0xff && vs->client_green_max == 0xff && vs->client_blue_max == 0xff &&",
" vs->client_red_shift == 16 && vs->client_green_shift == 8 && vs->client_blue_shift == 0) {",
" vs->write_pixels = vnc_write_pixels_copy;",
" vs->send_hextile_tile = send_hextile_tile_32;",
" } else if (vs->pix_bpp == 2 && vs->depth == 2 &&",
" host_big_endian_flag == vs->pix_big_endian &&",
" vs->client_red_max == 31 && vs->client_green_max == 63 && vs->client_blue_max == 31 &&",
" vs->client_red_shift == 11 && vs->client_green_shift == 5 && vs->client_blue_shift == 0) {",
" vs->write_pixels = vnc_write_pixels_copy;",
" vs->send_hextile_tile = send_hextile_tile_16;",
" } else if (vs->pix_bpp == 1 && vs->depth == 1 &&",
" host_big_endian_flag == vs->pix_big_endian &&",
" vs->client_red_max == 7 && vs->client_green_max == 7 && vs->client_blue_max == 3 &&",
" vs->client_red_shift == 5 && vs->client_green_shift == 2 && vs->client_blue_shift == 0) {",
" vs->write_pixels = vnc_write_pixels_copy;",
" vs->send_hextile_tile = send_hextile_tile_8;",
" } else {",
" if (vs->depth == 4) {",
" vs->send_hextile_tile = send_hextile_tile_generic_32;",
" } else if (vs->depth == 2) {",
" vs->send_hextile_tile = send_hextile_tile_generic_16;",
" } else {",
" vs->send_hextile_tile = send_hextile_tile_generic_8;",
" vs->write_pixels = vnc_write_pixels_generic;"
],
"line_no": [
5,
11,
13,
15,
17,
141,
5,
11,
13,
15,
17,
19,
23,
25,
27,
29,
31,
33,
35,
37,
39,
41,
43,
45,
47,
49,
51,
53,
55,
39,
41,
61,
63,
65,
67,
69,
71,
73,
39,
41,
79,
105,
107,
109,
111,
113,
115,
117,
107,
121,
123,
113,
127,
129,
107,
133,
135,
113,
139,
141,
143,
145,
147,
149,
151,
153,
157
]
}
|
static void FUNC_0(DisplayState *VAR_0)
{
int VAR_1;
struct VncState *VAR_2 = VAR_0->opaque;
#ifdef WORDS_BIGENDIAN
VAR_1 = 1;
#else
VAR_1 = 0;
#endif
switch (ds_get_bits_per_pixel(VAR_0)) {
case 8:
VAR_2->depth = 1;
VAR_2->server_red_max = 7;
VAR_2->server_green_max = 7;
VAR_2->server_blue_max = 3;
VAR_2->server_red_shift = 5;
VAR_2->server_green_shift = 2;
VAR_2->server_blue_shift = 0;
break;
case 16:
VAR_2->depth = 2;
VAR_2->server_red_max = 31;
VAR_2->server_green_max = 63;
VAR_2->server_blue_max = 31;
VAR_2->server_red_shift = 11;
VAR_2->server_green_shift = 5;
VAR_2->server_blue_shift = 0;
break;
case 32:
VAR_2->depth = 4;
VAR_2->server_red_max = 255;
VAR_2->server_green_max = 255;
VAR_2->server_blue_max = 255;
VAR_2->server_red_shift = 16;
VAR_2->server_green_shift = 8;
VAR_2->server_blue_shift = 0;
break;
default:
return;
}
if (VAR_2->csock != -1 && VAR_2->has_WMVi) {
vnc_write_u8(VAR_2, 0);
vnc_write_u8(VAR_2, 0);
vnc_write_u16(VAR_2, 1);
vnc_framebuffer_update(VAR_2, 0, 0, ds_get_width(VAR_0), ds_get_height(VAR_0), 0x574D5669);
pixel_format_message(VAR_2);
vnc_flush(VAR_2);
} else {
if (VAR_2->pix_bpp == 4 && VAR_2->depth == 4 &&
VAR_1 == VAR_2->pix_big_endian &&
VAR_2->client_red_max == 0xff && VAR_2->client_green_max == 0xff && VAR_2->client_blue_max == 0xff &&
VAR_2->client_red_shift == 16 && VAR_2->client_green_shift == 8 && VAR_2->client_blue_shift == 0) {
VAR_2->write_pixels = vnc_write_pixels_copy;
VAR_2->send_hextile_tile = send_hextile_tile_32;
} else if (VAR_2->pix_bpp == 2 && VAR_2->depth == 2 &&
VAR_1 == VAR_2->pix_big_endian &&
VAR_2->client_red_max == 31 && VAR_2->client_green_max == 63 && VAR_2->client_blue_max == 31 &&
VAR_2->client_red_shift == 11 && VAR_2->client_green_shift == 5 && VAR_2->client_blue_shift == 0) {
VAR_2->write_pixels = vnc_write_pixels_copy;
VAR_2->send_hextile_tile = send_hextile_tile_16;
} else if (VAR_2->pix_bpp == 1 && VAR_2->depth == 1 &&
VAR_1 == VAR_2->pix_big_endian &&
VAR_2->client_red_max == 7 && VAR_2->client_green_max == 7 && VAR_2->client_blue_max == 3 &&
VAR_2->client_red_shift == 5 && VAR_2->client_green_shift == 2 && VAR_2->client_blue_shift == 0) {
VAR_2->write_pixels = vnc_write_pixels_copy;
VAR_2->send_hextile_tile = send_hextile_tile_8;
} else {
if (VAR_2->depth == 4) {
VAR_2->send_hextile_tile = send_hextile_tile_generic_32;
} else if (VAR_2->depth == 2) {
VAR_2->send_hextile_tile = send_hextile_tile_generic_16;
} else {
VAR_2->send_hextile_tile = send_hextile_tile_generic_8;
}
VAR_2->write_pixels = vnc_write_pixels_generic;
}
}
}
|
[
"static void FUNC_0(DisplayState *VAR_0)\n{",
"int VAR_1;",
"struct VncState *VAR_2 = VAR_0->opaque;",
"#ifdef WORDS_BIGENDIAN\nVAR_1 = 1;",
"#else\nVAR_1 = 0;",
"#endif\nswitch (ds_get_bits_per_pixel(VAR_0)) {",
"case 8:\nVAR_2->depth = 1;",
"VAR_2->server_red_max = 7;",
"VAR_2->server_green_max = 7;",
"VAR_2->server_blue_max = 3;",
"VAR_2->server_red_shift = 5;",
"VAR_2->server_green_shift = 2;",
"VAR_2->server_blue_shift = 0;",
"break;",
"case 16:\nVAR_2->depth = 2;",
"VAR_2->server_red_max = 31;",
"VAR_2->server_green_max = 63;",
"VAR_2->server_blue_max = 31;",
"VAR_2->server_red_shift = 11;",
"VAR_2->server_green_shift = 5;",
"VAR_2->server_blue_shift = 0;",
"break;",
"case 32:\nVAR_2->depth = 4;",
"VAR_2->server_red_max = 255;",
"VAR_2->server_green_max = 255;",
"VAR_2->server_blue_max = 255;",
"VAR_2->server_red_shift = 16;",
"VAR_2->server_green_shift = 8;",
"VAR_2->server_blue_shift = 0;",
"break;",
"default:\nreturn;",
"}",
"if (VAR_2->csock != -1 && VAR_2->has_WMVi) {",
"vnc_write_u8(VAR_2, 0);",
"vnc_write_u8(VAR_2, 0);",
"vnc_write_u16(VAR_2, 1);",
"vnc_framebuffer_update(VAR_2, 0, 0, ds_get_width(VAR_0), ds_get_height(VAR_0), 0x574D5669);",
"pixel_format_message(VAR_2);",
"vnc_flush(VAR_2);",
"} else {",
"if (VAR_2->pix_bpp == 4 && VAR_2->depth == 4 &&\nVAR_1 == VAR_2->pix_big_endian &&\nVAR_2->client_red_max == 0xff && VAR_2->client_green_max == 0xff && VAR_2->client_blue_max == 0xff &&\nVAR_2->client_red_shift == 16 && VAR_2->client_green_shift == 8 && VAR_2->client_blue_shift == 0) {",
"VAR_2->write_pixels = vnc_write_pixels_copy;",
"VAR_2->send_hextile_tile = send_hextile_tile_32;",
"} else if (VAR_2->pix_bpp == 2 && VAR_2->depth == 2 &&",
"VAR_1 == VAR_2->pix_big_endian &&\nVAR_2->client_red_max == 31 && VAR_2->client_green_max == 63 && VAR_2->client_blue_max == 31 &&\nVAR_2->client_red_shift == 11 && VAR_2->client_green_shift == 5 && VAR_2->client_blue_shift == 0) {",
"VAR_2->write_pixels = vnc_write_pixels_copy;",
"VAR_2->send_hextile_tile = send_hextile_tile_16;",
"} else if (VAR_2->pix_bpp == 1 && VAR_2->depth == 1 &&",
"VAR_1 == VAR_2->pix_big_endian &&\nVAR_2->client_red_max == 7 && VAR_2->client_green_max == 7 && VAR_2->client_blue_max == 3 &&\nVAR_2->client_red_shift == 5 && VAR_2->client_green_shift == 2 && VAR_2->client_blue_shift == 0) {",
"VAR_2->write_pixels = vnc_write_pixels_copy;",
"VAR_2->send_hextile_tile = send_hextile_tile_8;",
"} else {",
"if (VAR_2->depth == 4) {",
"VAR_2->send_hextile_tile = send_hextile_tile_generic_32;",
"} else if (VAR_2->depth == 2) {",
"VAR_2->send_hextile_tile = send_hextile_tile_generic_16;",
"} else {",
"VAR_2->send_hextile_tile = send_hextile_tile_generic_8;",
"}",
"VAR_2->write_pixels = vnc_write_pixels_generic;",
"}",
"}",
"}"
] |
[
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
1,
1,
1,
1,
1,
1,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
1,
1,
1,
0,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
0,
1,
0,
1,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
11,
13
],
[
15,
17
],
[
19,
23
],
[
25,
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43,
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61,
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79,
81
],
[
83
],
[
87
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105,
107,
109,
111
],
[
113
],
[
115
],
[
117
],
[
119,
121,
123
],
[
125
],
[
127
],
[
129
],
[
131,
133,
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149
],
[
151
],
[
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163
]
] |
6,336 |
int ff_rv34_decode_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
{
RV34DecContext *r = dst->priv_data, *r1 = src->priv_data;
MpegEncContext * const s = &r->s, * const s1 = &r1->s;
int err;
if (dst == src || !s1->context_initialized)
return 0;
if (s->height != s1->height || s->width != s1->width) {
ff_MPV_common_end(s);
s->height = s1->height;
s->width = s1->width;
if ((err = ff_MPV_common_init(s)) < 0)
return err;
if ((err = rv34_decoder_realloc(r)) < 0)
return err;
}
if ((err = ff_mpeg_update_thread_context(dst, src)))
return err;
r->cur_pts = r1->cur_pts;
r->last_pts = r1->last_pts;
r->next_pts = r1->next_pts;
memset(&r->si, 0, sizeof(r->si));
/* necessary since it is it the condition checked for in decode_slice
* to call ff_MPV_frame_start. cmp. comment at the end of decode_frame */
s->current_picture_ptr = NULL;
return 0;
}
| true |
FFmpeg
|
73ad4471a48bd02b2c2a55de116161b87e061023
|
int ff_rv34_decode_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
{
RV34DecContext *r = dst->priv_data, *r1 = src->priv_data;
MpegEncContext * const s = &r->s, * const s1 = &r1->s;
int err;
if (dst == src || !s1->context_initialized)
return 0;
if (s->height != s1->height || s->width != s1->width) {
ff_MPV_common_end(s);
s->height = s1->height;
s->width = s1->width;
if ((err = ff_MPV_common_init(s)) < 0)
return err;
if ((err = rv34_decoder_realloc(r)) < 0)
return err;
}
if ((err = ff_mpeg_update_thread_context(dst, src)))
return err;
r->cur_pts = r1->cur_pts;
r->last_pts = r1->last_pts;
r->next_pts = r1->next_pts;
memset(&r->si, 0, sizeof(r->si));
s->current_picture_ptr = NULL;
return 0;
}
|
{
"code": [
" s->current_picture_ptr = NULL;"
],
"line_no": [
61
]
}
|
int FUNC_0(AVCodecContext *VAR_0, const AVCodecContext *VAR_1)
{
RV34DecContext *r = VAR_0->priv_data, *r1 = VAR_1->priv_data;
MpegEncContext * const s = &r->s, * const s1 = &r1->s;
int VAR_2;
if (VAR_0 == VAR_1 || !s1->context_initialized)
return 0;
if (s->height != s1->height || s->width != s1->width) {
ff_MPV_common_end(s);
s->height = s1->height;
s->width = s1->width;
if ((VAR_2 = ff_MPV_common_init(s)) < 0)
return VAR_2;
if ((VAR_2 = rv34_decoder_realloc(r)) < 0)
return VAR_2;
}
if ((VAR_2 = ff_mpeg_update_thread_context(VAR_0, VAR_1)))
return VAR_2;
r->cur_pts = r1->cur_pts;
r->last_pts = r1->last_pts;
r->next_pts = r1->next_pts;
memset(&r->si, 0, sizeof(r->si));
s->current_picture_ptr = NULL;
return 0;
}
|
[
"int FUNC_0(AVCodecContext *VAR_0, const AVCodecContext *VAR_1)\n{",
"RV34DecContext *r = VAR_0->priv_data, *r1 = VAR_1->priv_data;",
"MpegEncContext * const s = &r->s, * const s1 = &r1->s;",
"int VAR_2;",
"if (VAR_0 == VAR_1 || !s1->context_initialized)\nreturn 0;",
"if (s->height != s1->height || s->width != s1->width) {",
"ff_MPV_common_end(s);",
"s->height = s1->height;",
"s->width = s1->width;",
"if ((VAR_2 = ff_MPV_common_init(s)) < 0)\nreturn VAR_2;",
"if ((VAR_2 = rv34_decoder_realloc(r)) < 0)\nreturn VAR_2;",
"}",
"if ((VAR_2 = ff_mpeg_update_thread_context(VAR_0, VAR_1)))\nreturn VAR_2;",
"r->cur_pts = r1->cur_pts;",
"r->last_pts = r1->last_pts;",
"r->next_pts = r1->next_pts;",
"memset(&r->si, 0, sizeof(r->si));",
"s->current_picture_ptr = NULL;",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13,
15
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27,
29
],
[
31,
33
],
[
35
],
[
39,
41
],
[
45
],
[
47
],
[
49
],
[
53
],
[
61
],
[
65
],
[
67
]
] |
6,337 |
static av_cold int flac_encode_init(AVCodecContext *avctx)
{
int freq = avctx->sample_rate;
int channels = avctx->channels;
FlacEncodeContext *s = avctx->priv_data;
int i, level;
uint8_t *streaminfo;
s->avctx = avctx;
dsputil_init(&s->dsp, avctx);
if (avctx->sample_fmt != SAMPLE_FMT_S16)
return -1;
if (channels < 1 || channels > FLAC_MAX_CHANNELS)
return -1;
s->channels = channels;
/* find samplerate in table */
if (freq < 1)
return -1;
for (i = 4; i < 12; i++) {
if (freq == ff_flac_sample_rate_table[i]) {
s->samplerate = ff_flac_sample_rate_table[i];
s->sr_code[0] = i;
s->sr_code[1] = 0;
break;
}
}
/* if not in table, samplerate is non-standard */
if (i == 12) {
if (freq % 1000 == 0 && freq < 255000) {
s->sr_code[0] = 12;
s->sr_code[1] = freq / 1000;
} else if (freq % 10 == 0 && freq < 655350) {
s->sr_code[0] = 14;
s->sr_code[1] = freq / 10;
} else if (freq < 65535) {
s->sr_code[0] = 13;
s->sr_code[1] = freq;
} else {
return -1;
}
s->samplerate = freq;
}
/* set compression option defaults based on avctx->compression_level */
if (avctx->compression_level < 0)
s->options.compression_level = 5;
else
s->options.compression_level = avctx->compression_level;
av_log(avctx, AV_LOG_DEBUG, " compression: %d\n", s->options.compression_level);
level = s->options.compression_level;
if (level > 12) {
av_log(avctx, AV_LOG_ERROR, "invalid compression level: %d\n",
s->options.compression_level);
return -1;
}
s->options.block_time_ms = ((int[]){ 27, 27, 27,105,105,105,105,105,105,105,105,105,105})[level];
s->options.lpc_type = ((int[]){ AV_LPC_TYPE_FIXED, AV_LPC_TYPE_FIXED, AV_LPC_TYPE_FIXED,
AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON,
AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON,
AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON,
AV_LPC_TYPE_LEVINSON})[level];
s->options.min_prediction_order = ((int[]){ 2, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1})[level];
s->options.max_prediction_order = ((int[]){ 3, 4, 4, 6, 8, 8, 8, 8, 12, 12, 12, 32, 32})[level];
s->options.prediction_order_method = ((int[]){ ORDER_METHOD_EST, ORDER_METHOD_EST, ORDER_METHOD_EST,
ORDER_METHOD_EST, ORDER_METHOD_EST, ORDER_METHOD_EST,
ORDER_METHOD_4LEVEL, ORDER_METHOD_LOG, ORDER_METHOD_4LEVEL,
ORDER_METHOD_LOG, ORDER_METHOD_SEARCH, ORDER_METHOD_LOG,
ORDER_METHOD_SEARCH})[level];
s->options.min_partition_order = ((int[]){ 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})[level];
s->options.max_partition_order = ((int[]){ 2, 2, 3, 3, 3, 8, 8, 8, 8, 8, 8, 8, 8})[level];
/* set compression option overrides from AVCodecContext */
#if LIBAVCODEC_VERSION_MAJOR < 53
/* for compatibility with deprecated AVCodecContext.use_lpc */
if (avctx->use_lpc == 0) {
s->options.lpc_type = AV_LPC_TYPE_FIXED;
} else if (avctx->use_lpc == 1) {
s->options.lpc_type = AV_LPC_TYPE_LEVINSON;
} else if (avctx->use_lpc > 1) {
s->options.lpc_type = AV_LPC_TYPE_CHOLESKY;
s->options.lpc_passes = avctx->use_lpc - 1;
}
#endif
if (avctx->lpc_type > AV_LPC_TYPE_DEFAULT) {
if (avctx->lpc_type > AV_LPC_TYPE_CHOLESKY) {
av_log(avctx, AV_LOG_ERROR, "unknown lpc type: %d\n", avctx->lpc_type);
return -1;
}
s->options.lpc_type = avctx->lpc_type;
if (s->options.lpc_type == AV_LPC_TYPE_CHOLESKY) {
if (avctx->lpc_passes < 0) {
// default number of passes for Cholesky
s->options.lpc_passes = 2;
} else if (avctx->lpc_passes == 0) {
av_log(avctx, AV_LOG_ERROR, "invalid number of lpc passes: %d\n",
avctx->lpc_passes);
return -1;
} else {
s->options.lpc_passes = avctx->lpc_passes;
}
}
}
switch (s->options.lpc_type) {
case AV_LPC_TYPE_NONE:
av_log(avctx, AV_LOG_DEBUG, " lpc type: None\n");
break;
case AV_LPC_TYPE_FIXED:
av_log(avctx, AV_LOG_DEBUG, " lpc type: Fixed pre-defined coefficients\n");
break;
case AV_LPC_TYPE_LEVINSON:
av_log(avctx, AV_LOG_DEBUG, " lpc type: Levinson-Durbin recursion with Welch window\n");
break;
case AV_LPC_TYPE_CHOLESKY:
av_log(avctx, AV_LOG_DEBUG, " lpc type: Cholesky factorization, %d pass%s\n",
s->options.lpc_passes, s->options.lpc_passes==1?"":"es");
break;
}
if (s->options.lpc_type == AV_LPC_TYPE_NONE) {
s->options.min_prediction_order = 0;
} else if (avctx->min_prediction_order >= 0) {
if (s->options.lpc_type == AV_LPC_TYPE_FIXED) {
if (avctx->min_prediction_order > MAX_FIXED_ORDER) {
av_log(avctx, AV_LOG_ERROR, "invalid min prediction order: %d\n",
avctx->min_prediction_order);
return -1;
}
} else if (avctx->min_prediction_order < MIN_LPC_ORDER ||
avctx->min_prediction_order > MAX_LPC_ORDER) {
av_log(avctx, AV_LOG_ERROR, "invalid min prediction order: %d\n",
avctx->min_prediction_order);
return -1;
}
s->options.min_prediction_order = avctx->min_prediction_order;
}
if (s->options.lpc_type == AV_LPC_TYPE_NONE) {
s->options.max_prediction_order = 0;
} else if (avctx->max_prediction_order >= 0) {
if (s->options.lpc_type == AV_LPC_TYPE_FIXED) {
if (avctx->max_prediction_order > MAX_FIXED_ORDER) {
av_log(avctx, AV_LOG_ERROR, "invalid max prediction order: %d\n",
avctx->max_prediction_order);
return -1;
}
} else if (avctx->max_prediction_order < MIN_LPC_ORDER ||
avctx->max_prediction_order > MAX_LPC_ORDER) {
av_log(avctx, AV_LOG_ERROR, "invalid max prediction order: %d\n",
avctx->max_prediction_order);
return -1;
}
s->options.max_prediction_order = avctx->max_prediction_order;
}
if (s->options.max_prediction_order < s->options.min_prediction_order) {
av_log(avctx, AV_LOG_ERROR, "invalid prediction orders: min=%d max=%d\n",
s->options.min_prediction_order, s->options.max_prediction_order);
return -1;
}
av_log(avctx, AV_LOG_DEBUG, " prediction order: %d, %d\n",
s->options.min_prediction_order, s->options.max_prediction_order);
if (avctx->prediction_order_method >= 0) {
if (avctx->prediction_order_method > ORDER_METHOD_LOG) {
av_log(avctx, AV_LOG_ERROR, "invalid prediction order method: %d\n",
avctx->prediction_order_method);
return -1;
}
s->options.prediction_order_method = avctx->prediction_order_method;
}
switch (s->options.prediction_order_method) {
case ORDER_METHOD_EST: av_log(avctx, AV_LOG_DEBUG, " order method: %s\n",
"estimate"); break;
case ORDER_METHOD_2LEVEL: av_log(avctx, AV_LOG_DEBUG, " order method: %s\n",
"2-level"); break;
case ORDER_METHOD_4LEVEL: av_log(avctx, AV_LOG_DEBUG, " order method: %s\n",
"4-level"); break;
case ORDER_METHOD_8LEVEL: av_log(avctx, AV_LOG_DEBUG, " order method: %s\n",
"8-level"); break;
case ORDER_METHOD_SEARCH: av_log(avctx, AV_LOG_DEBUG, " order method: %s\n",
"full search"); break;
case ORDER_METHOD_LOG: av_log(avctx, AV_LOG_DEBUG, " order method: %s\n",
"log search"); break;
}
if (avctx->min_partition_order >= 0) {
if (avctx->min_partition_order > MAX_PARTITION_ORDER) {
av_log(avctx, AV_LOG_ERROR, "invalid min partition order: %d\n",
avctx->min_partition_order);
return -1;
}
s->options.min_partition_order = avctx->min_partition_order;
}
if (avctx->max_partition_order >= 0) {
if (avctx->max_partition_order > MAX_PARTITION_ORDER) {
av_log(avctx, AV_LOG_ERROR, "invalid max partition order: %d\n",
avctx->max_partition_order);
return -1;
}
s->options.max_partition_order = avctx->max_partition_order;
}
if (s->options.max_partition_order < s->options.min_partition_order) {
av_log(avctx, AV_LOG_ERROR, "invalid partition orders: min=%d max=%d\n",
s->options.min_partition_order, s->options.max_partition_order);
return -1;
}
av_log(avctx, AV_LOG_DEBUG, " partition order: %d, %d\n",
s->options.min_partition_order, s->options.max_partition_order);
if (avctx->frame_size > 0) {
if (avctx->frame_size < FLAC_MIN_BLOCKSIZE ||
avctx->frame_size > FLAC_MAX_BLOCKSIZE) {
av_log(avctx, AV_LOG_ERROR, "invalid block size: %d\n",
avctx->frame_size);
return -1;
}
} else {
s->avctx->frame_size = select_blocksize(s->samplerate, s->options.block_time_ms);
}
s->max_blocksize = s->avctx->frame_size;
av_log(avctx, AV_LOG_DEBUG, " block size: %d\n", s->avctx->frame_size);
/* set LPC precision */
if (avctx->lpc_coeff_precision > 0) {
if (avctx->lpc_coeff_precision > MAX_LPC_PRECISION) {
av_log(avctx, AV_LOG_ERROR, "invalid lpc coeff precision: %d\n",
avctx->lpc_coeff_precision);
return -1;
}
s->options.lpc_coeff_precision = avctx->lpc_coeff_precision;
} else {
/* default LPC precision */
s->options.lpc_coeff_precision = 15;
}
av_log(avctx, AV_LOG_DEBUG, " lpc precision: %d\n",
s->options.lpc_coeff_precision);
/* set maximum encoded frame size in verbatim mode */
s->max_framesize = ff_flac_get_max_frame_size(s->avctx->frame_size,
s->channels, 16);
/* initialize MD5 context */
s->md5ctx = av_malloc(av_md5_size);
if (!s->md5ctx)
av_md5_init(s->md5ctx);
streaminfo = av_malloc(FLAC_STREAMINFO_SIZE);
if (!streaminfo)
write_streaminfo(s, streaminfo);
avctx->extradata = streaminfo;
avctx->extradata_size = FLAC_STREAMINFO_SIZE;
s->frame_count = 0;
s->min_framesize = s->max_framesize;
avctx->coded_frame = avcodec_alloc_frame();
avctx->coded_frame->key_frame = 1;
return 0;
}
| true |
FFmpeg
|
e08ec714801a8f8e72eeee57c2df48b8fbaf2e12
|
static av_cold int flac_encode_init(AVCodecContext *avctx)
{
int freq = avctx->sample_rate;
int channels = avctx->channels;
FlacEncodeContext *s = avctx->priv_data;
int i, level;
uint8_t *streaminfo;
s->avctx = avctx;
dsputil_init(&s->dsp, avctx);
if (avctx->sample_fmt != SAMPLE_FMT_S16)
return -1;
if (channels < 1 || channels > FLAC_MAX_CHANNELS)
return -1;
s->channels = channels;
if (freq < 1)
return -1;
for (i = 4; i < 12; i++) {
if (freq == ff_flac_sample_rate_table[i]) {
s->samplerate = ff_flac_sample_rate_table[i];
s->sr_code[0] = i;
s->sr_code[1] = 0;
break;
}
}
if (i == 12) {
if (freq % 1000 == 0 && freq < 255000) {
s->sr_code[0] = 12;
s->sr_code[1] = freq / 1000;
} else if (freq % 10 == 0 && freq < 655350) {
s->sr_code[0] = 14;
s->sr_code[1] = freq / 10;
} else if (freq < 65535) {
s->sr_code[0] = 13;
s->sr_code[1] = freq;
} else {
return -1;
}
s->samplerate = freq;
}
if (avctx->compression_level < 0)
s->options.compression_level = 5;
else
s->options.compression_level = avctx->compression_level;
av_log(avctx, AV_LOG_DEBUG, " compression: %d\n", s->options.compression_level);
level = s->options.compression_level;
if (level > 12) {
av_log(avctx, AV_LOG_ERROR, "invalid compression level: %d\n",
s->options.compression_level);
return -1;
}
s->options.block_time_ms = ((int[]){ 27, 27, 27,105,105,105,105,105,105,105,105,105,105})[level];
s->options.lpc_type = ((int[]){ AV_LPC_TYPE_FIXED, AV_LPC_TYPE_FIXED, AV_LPC_TYPE_FIXED,
AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON,
AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON,
AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON,
AV_LPC_TYPE_LEVINSON})[level];
s->options.min_prediction_order = ((int[]){ 2, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1})[level];
s->options.max_prediction_order = ((int[]){ 3, 4, 4, 6, 8, 8, 8, 8, 12, 12, 12, 32, 32})[level];
s->options.prediction_order_method = ((int[]){ ORDER_METHOD_EST, ORDER_METHOD_EST, ORDER_METHOD_EST,
ORDER_METHOD_EST, ORDER_METHOD_EST, ORDER_METHOD_EST,
ORDER_METHOD_4LEVEL, ORDER_METHOD_LOG, ORDER_METHOD_4LEVEL,
ORDER_METHOD_LOG, ORDER_METHOD_SEARCH, ORDER_METHOD_LOG,
ORDER_METHOD_SEARCH})[level];
s->options.min_partition_order = ((int[]){ 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})[level];
s->options.max_partition_order = ((int[]){ 2, 2, 3, 3, 3, 8, 8, 8, 8, 8, 8, 8, 8})[level];
#if LIBAVCODEC_VERSION_MAJOR < 53
if (avctx->use_lpc == 0) {
s->options.lpc_type = AV_LPC_TYPE_FIXED;
} else if (avctx->use_lpc == 1) {
s->options.lpc_type = AV_LPC_TYPE_LEVINSON;
} else if (avctx->use_lpc > 1) {
s->options.lpc_type = AV_LPC_TYPE_CHOLESKY;
s->options.lpc_passes = avctx->use_lpc - 1;
}
#endif
if (avctx->lpc_type > AV_LPC_TYPE_DEFAULT) {
if (avctx->lpc_type > AV_LPC_TYPE_CHOLESKY) {
av_log(avctx, AV_LOG_ERROR, "unknown lpc type: %d\n", avctx->lpc_type);
return -1;
}
s->options.lpc_type = avctx->lpc_type;
if (s->options.lpc_type == AV_LPC_TYPE_CHOLESKY) {
if (avctx->lpc_passes < 0) {
s->options.lpc_passes = 2;
} else if (avctx->lpc_passes == 0) {
av_log(avctx, AV_LOG_ERROR, "invalid number of lpc passes: %d\n",
avctx->lpc_passes);
return -1;
} else {
s->options.lpc_passes = avctx->lpc_passes;
}
}
}
switch (s->options.lpc_type) {
case AV_LPC_TYPE_NONE:
av_log(avctx, AV_LOG_DEBUG, " lpc type: None\n");
break;
case AV_LPC_TYPE_FIXED:
av_log(avctx, AV_LOG_DEBUG, " lpc type: Fixed pre-defined coefficients\n");
break;
case AV_LPC_TYPE_LEVINSON:
av_log(avctx, AV_LOG_DEBUG, " lpc type: Levinson-Durbin recursion with Welch window\n");
break;
case AV_LPC_TYPE_CHOLESKY:
av_log(avctx, AV_LOG_DEBUG, " lpc type: Cholesky factorization, %d pass%s\n",
s->options.lpc_passes, s->options.lpc_passes==1?"":"es");
break;
}
if (s->options.lpc_type == AV_LPC_TYPE_NONE) {
s->options.min_prediction_order = 0;
} else if (avctx->min_prediction_order >= 0) {
if (s->options.lpc_type == AV_LPC_TYPE_FIXED) {
if (avctx->min_prediction_order > MAX_FIXED_ORDER) {
av_log(avctx, AV_LOG_ERROR, "invalid min prediction order: %d\n",
avctx->min_prediction_order);
return -1;
}
} else if (avctx->min_prediction_order < MIN_LPC_ORDER ||
avctx->min_prediction_order > MAX_LPC_ORDER) {
av_log(avctx, AV_LOG_ERROR, "invalid min prediction order: %d\n",
avctx->min_prediction_order);
return -1;
}
s->options.min_prediction_order = avctx->min_prediction_order;
}
if (s->options.lpc_type == AV_LPC_TYPE_NONE) {
s->options.max_prediction_order = 0;
} else if (avctx->max_prediction_order >= 0) {
if (s->options.lpc_type == AV_LPC_TYPE_FIXED) {
if (avctx->max_prediction_order > MAX_FIXED_ORDER) {
av_log(avctx, AV_LOG_ERROR, "invalid max prediction order: %d\n",
avctx->max_prediction_order);
return -1;
}
} else if (avctx->max_prediction_order < MIN_LPC_ORDER ||
avctx->max_prediction_order > MAX_LPC_ORDER) {
av_log(avctx, AV_LOG_ERROR, "invalid max prediction order: %d\n",
avctx->max_prediction_order);
return -1;
}
s->options.max_prediction_order = avctx->max_prediction_order;
}
if (s->options.max_prediction_order < s->options.min_prediction_order) {
av_log(avctx, AV_LOG_ERROR, "invalid prediction orders: min=%d max=%d\n",
s->options.min_prediction_order, s->options.max_prediction_order);
return -1;
}
av_log(avctx, AV_LOG_DEBUG, " prediction order: %d, %d\n",
s->options.min_prediction_order, s->options.max_prediction_order);
if (avctx->prediction_order_method >= 0) {
if (avctx->prediction_order_method > ORDER_METHOD_LOG) {
av_log(avctx, AV_LOG_ERROR, "invalid prediction order method: %d\n",
avctx->prediction_order_method);
return -1;
}
s->options.prediction_order_method = avctx->prediction_order_method;
}
switch (s->options.prediction_order_method) {
case ORDER_METHOD_EST: av_log(avctx, AV_LOG_DEBUG, " order method: %s\n",
"estimate"); break;
case ORDER_METHOD_2LEVEL: av_log(avctx, AV_LOG_DEBUG, " order method: %s\n",
"2-level"); break;
case ORDER_METHOD_4LEVEL: av_log(avctx, AV_LOG_DEBUG, " order method: %s\n",
"4-level"); break;
case ORDER_METHOD_8LEVEL: av_log(avctx, AV_LOG_DEBUG, " order method: %s\n",
"8-level"); break;
case ORDER_METHOD_SEARCH: av_log(avctx, AV_LOG_DEBUG, " order method: %s\n",
"full search"); break;
case ORDER_METHOD_LOG: av_log(avctx, AV_LOG_DEBUG, " order method: %s\n",
"log search"); break;
}
if (avctx->min_partition_order >= 0) {
if (avctx->min_partition_order > MAX_PARTITION_ORDER) {
av_log(avctx, AV_LOG_ERROR, "invalid min partition order: %d\n",
avctx->min_partition_order);
return -1;
}
s->options.min_partition_order = avctx->min_partition_order;
}
if (avctx->max_partition_order >= 0) {
if (avctx->max_partition_order > MAX_PARTITION_ORDER) {
av_log(avctx, AV_LOG_ERROR, "invalid max partition order: %d\n",
avctx->max_partition_order);
return -1;
}
s->options.max_partition_order = avctx->max_partition_order;
}
if (s->options.max_partition_order < s->options.min_partition_order) {
av_log(avctx, AV_LOG_ERROR, "invalid partition orders: min=%d max=%d\n",
s->options.min_partition_order, s->options.max_partition_order);
return -1;
}
av_log(avctx, AV_LOG_DEBUG, " partition order: %d, %d\n",
s->options.min_partition_order, s->options.max_partition_order);
if (avctx->frame_size > 0) {
if (avctx->frame_size < FLAC_MIN_BLOCKSIZE ||
avctx->frame_size > FLAC_MAX_BLOCKSIZE) {
av_log(avctx, AV_LOG_ERROR, "invalid block size: %d\n",
avctx->frame_size);
return -1;
}
} else {
s->avctx->frame_size = select_blocksize(s->samplerate, s->options.block_time_ms);
}
s->max_blocksize = s->avctx->frame_size;
av_log(avctx, AV_LOG_DEBUG, " block size: %d\n", s->avctx->frame_size);
if (avctx->lpc_coeff_precision > 0) {
if (avctx->lpc_coeff_precision > MAX_LPC_PRECISION) {
av_log(avctx, AV_LOG_ERROR, "invalid lpc coeff precision: %d\n",
avctx->lpc_coeff_precision);
return -1;
}
s->options.lpc_coeff_precision = avctx->lpc_coeff_precision;
} else {
s->options.lpc_coeff_precision = 15;
}
av_log(avctx, AV_LOG_DEBUG, " lpc precision: %d\n",
s->options.lpc_coeff_precision);
s->max_framesize = ff_flac_get_max_frame_size(s->avctx->frame_size,
s->channels, 16);
s->md5ctx = av_malloc(av_md5_size);
if (!s->md5ctx)
av_md5_init(s->md5ctx);
streaminfo = av_malloc(FLAC_STREAMINFO_SIZE);
if (!streaminfo)
write_streaminfo(s, streaminfo);
avctx->extradata = streaminfo;
avctx->extradata_size = FLAC_STREAMINFO_SIZE;
s->frame_count = 0;
s->min_framesize = s->max_framesize;
avctx->coded_frame = avcodec_alloc_frame();
avctx->coded_frame->key_frame = 1;
return 0;
}
|
{
"code": [],
"line_no": []
}
|
static av_cold int FUNC_0(AVCodecContext *avctx)
{
int VAR_0 = avctx->sample_rate;
int VAR_1 = avctx->VAR_1;
FlacEncodeContext *s = avctx->priv_data;
int VAR_2, VAR_3;
uint8_t *streaminfo;
s->avctx = avctx;
dsputil_init(&s->dsp, avctx);
if (avctx->sample_fmt != SAMPLE_FMT_S16)
return -1;
if (VAR_1 < 1 || VAR_1 > FLAC_MAX_CHANNELS)
return -1;
s->VAR_1 = VAR_1;
if (VAR_0 < 1)
return -1;
for (VAR_2 = 4; VAR_2 < 12; VAR_2++) {
if (VAR_0 == ff_flac_sample_rate_table[VAR_2]) {
s->samplerate = ff_flac_sample_rate_table[VAR_2];
s->sr_code[0] = VAR_2;
s->sr_code[1] = 0;
break;
}
}
if (VAR_2 == 12) {
if (VAR_0 % 1000 == 0 && VAR_0 < 255000) {
s->sr_code[0] = 12;
s->sr_code[1] = VAR_0 / 1000;
} else if (VAR_0 % 10 == 0 && VAR_0 < 655350) {
s->sr_code[0] = 14;
s->sr_code[1] = VAR_0 / 10;
} else if (VAR_0 < 65535) {
s->sr_code[0] = 13;
s->sr_code[1] = VAR_0;
} else {
return -1;
}
s->samplerate = VAR_0;
}
if (avctx->compression_level < 0)
s->options.compression_level = 5;
else
s->options.compression_level = avctx->compression_level;
av_log(avctx, AV_LOG_DEBUG, " compression: %d\n", s->options.compression_level);
VAR_3 = s->options.compression_level;
if (VAR_3 > 12) {
av_log(avctx, AV_LOG_ERROR, "invalid compression VAR_3: %d\n",
s->options.compression_level);
return -1;
}
s->options.block_time_ms = ((int[]){ 27, 27, 27,105,105,105,105,105,105,105,105,105,105})[VAR_3];
s->options.lpc_type = ((int[]){ AV_LPC_TYPE_FIXED, AV_LPC_TYPE_FIXED, AV_LPC_TYPE_FIXED,
AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON,
AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON,
AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON,
AV_LPC_TYPE_LEVINSON})[VAR_3];
s->options.min_prediction_order = ((int[]){ 2, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1})[VAR_3];
s->options.max_prediction_order = ((int[]){ 3, 4, 4, 6, 8, 8, 8, 8, 12, 12, 12, 32, 32})[VAR_3];
s->options.prediction_order_method = ((int[]){ ORDER_METHOD_EST, ORDER_METHOD_EST, ORDER_METHOD_EST,
ORDER_METHOD_EST, ORDER_METHOD_EST, ORDER_METHOD_EST,
ORDER_METHOD_4LEVEL, ORDER_METHOD_LOG, ORDER_METHOD_4LEVEL,
ORDER_METHOD_LOG, ORDER_METHOD_SEARCH, ORDER_METHOD_LOG,
ORDER_METHOD_SEARCH})[VAR_3];
s->options.min_partition_order = ((int[]){ 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})[VAR_3];
s->options.max_partition_order = ((int[]){ 2, 2, 3, 3, 3, 8, 8, 8, 8, 8, 8, 8, 8})[VAR_3];
#if LIBAVCODEC_VERSION_MAJOR < 53
if (avctx->use_lpc == 0) {
s->options.lpc_type = AV_LPC_TYPE_FIXED;
} else if (avctx->use_lpc == 1) {
s->options.lpc_type = AV_LPC_TYPE_LEVINSON;
} else if (avctx->use_lpc > 1) {
s->options.lpc_type = AV_LPC_TYPE_CHOLESKY;
s->options.lpc_passes = avctx->use_lpc - 1;
}
#endif
if (avctx->lpc_type > AV_LPC_TYPE_DEFAULT) {
if (avctx->lpc_type > AV_LPC_TYPE_CHOLESKY) {
av_log(avctx, AV_LOG_ERROR, "unknown lpc type: %d\n", avctx->lpc_type);
return -1;
}
s->options.lpc_type = avctx->lpc_type;
if (s->options.lpc_type == AV_LPC_TYPE_CHOLESKY) {
if (avctx->lpc_passes < 0) {
s->options.lpc_passes = 2;
} else if (avctx->lpc_passes == 0) {
av_log(avctx, AV_LOG_ERROR, "invalid number of lpc passes: %d\n",
avctx->lpc_passes);
return -1;
} else {
s->options.lpc_passes = avctx->lpc_passes;
}
}
}
switch (s->options.lpc_type) {
case AV_LPC_TYPE_NONE:
av_log(avctx, AV_LOG_DEBUG, " lpc type: None\n");
break;
case AV_LPC_TYPE_FIXED:
av_log(avctx, AV_LOG_DEBUG, " lpc type: Fixed pre-defined coefficients\n");
break;
case AV_LPC_TYPE_LEVINSON:
av_log(avctx, AV_LOG_DEBUG, " lpc type: Levinson-Durbin recursion with Welch window\n");
break;
case AV_LPC_TYPE_CHOLESKY:
av_log(avctx, AV_LOG_DEBUG, " lpc type: Cholesky factorization, %d pass%s\n",
s->options.lpc_passes, s->options.lpc_passes==1?"":"es");
break;
}
if (s->options.lpc_type == AV_LPC_TYPE_NONE) {
s->options.min_prediction_order = 0;
} else if (avctx->min_prediction_order >= 0) {
if (s->options.lpc_type == AV_LPC_TYPE_FIXED) {
if (avctx->min_prediction_order > MAX_FIXED_ORDER) {
av_log(avctx, AV_LOG_ERROR, "invalid min prediction order: %d\n",
avctx->min_prediction_order);
return -1;
}
} else if (avctx->min_prediction_order < MIN_LPC_ORDER ||
avctx->min_prediction_order > MAX_LPC_ORDER) {
av_log(avctx, AV_LOG_ERROR, "invalid min prediction order: %d\n",
avctx->min_prediction_order);
return -1;
}
s->options.min_prediction_order = avctx->min_prediction_order;
}
if (s->options.lpc_type == AV_LPC_TYPE_NONE) {
s->options.max_prediction_order = 0;
} else if (avctx->max_prediction_order >= 0) {
if (s->options.lpc_type == AV_LPC_TYPE_FIXED) {
if (avctx->max_prediction_order > MAX_FIXED_ORDER) {
av_log(avctx, AV_LOG_ERROR, "invalid max prediction order: %d\n",
avctx->max_prediction_order);
return -1;
}
} else if (avctx->max_prediction_order < MIN_LPC_ORDER ||
avctx->max_prediction_order > MAX_LPC_ORDER) {
av_log(avctx, AV_LOG_ERROR, "invalid max prediction order: %d\n",
avctx->max_prediction_order);
return -1;
}
s->options.max_prediction_order = avctx->max_prediction_order;
}
if (s->options.max_prediction_order < s->options.min_prediction_order) {
av_log(avctx, AV_LOG_ERROR, "invalid prediction orders: min=%d max=%d\n",
s->options.min_prediction_order, s->options.max_prediction_order);
return -1;
}
av_log(avctx, AV_LOG_DEBUG, " prediction order: %d, %d\n",
s->options.min_prediction_order, s->options.max_prediction_order);
if (avctx->prediction_order_method >= 0) {
if (avctx->prediction_order_method > ORDER_METHOD_LOG) {
av_log(avctx, AV_LOG_ERROR, "invalid prediction order method: %d\n",
avctx->prediction_order_method);
return -1;
}
s->options.prediction_order_method = avctx->prediction_order_method;
}
switch (s->options.prediction_order_method) {
case ORDER_METHOD_EST: av_log(avctx, AV_LOG_DEBUG, " order method: %s\n",
"estimate"); break;
case ORDER_METHOD_2LEVEL: av_log(avctx, AV_LOG_DEBUG, " order method: %s\n",
"2-VAR_3"); break;
case ORDER_METHOD_4LEVEL: av_log(avctx, AV_LOG_DEBUG, " order method: %s\n",
"4-VAR_3"); break;
case ORDER_METHOD_8LEVEL: av_log(avctx, AV_LOG_DEBUG, " order method: %s\n",
"8-VAR_3"); break;
case ORDER_METHOD_SEARCH: av_log(avctx, AV_LOG_DEBUG, " order method: %s\n",
"full search"); break;
case ORDER_METHOD_LOG: av_log(avctx, AV_LOG_DEBUG, " order method: %s\n",
"log search"); break;
}
if (avctx->min_partition_order >= 0) {
if (avctx->min_partition_order > MAX_PARTITION_ORDER) {
av_log(avctx, AV_LOG_ERROR, "invalid min partition order: %d\n",
avctx->min_partition_order);
return -1;
}
s->options.min_partition_order = avctx->min_partition_order;
}
if (avctx->max_partition_order >= 0) {
if (avctx->max_partition_order > MAX_PARTITION_ORDER) {
av_log(avctx, AV_LOG_ERROR, "invalid max partition order: %d\n",
avctx->max_partition_order);
return -1;
}
s->options.max_partition_order = avctx->max_partition_order;
}
if (s->options.max_partition_order < s->options.min_partition_order) {
av_log(avctx, AV_LOG_ERROR, "invalid partition orders: min=%d max=%d\n",
s->options.min_partition_order, s->options.max_partition_order);
return -1;
}
av_log(avctx, AV_LOG_DEBUG, " partition order: %d, %d\n",
s->options.min_partition_order, s->options.max_partition_order);
if (avctx->frame_size > 0) {
if (avctx->frame_size < FLAC_MIN_BLOCKSIZE ||
avctx->frame_size > FLAC_MAX_BLOCKSIZE) {
av_log(avctx, AV_LOG_ERROR, "invalid block size: %d\n",
avctx->frame_size);
return -1;
}
} else {
s->avctx->frame_size = select_blocksize(s->samplerate, s->options.block_time_ms);
}
s->max_blocksize = s->avctx->frame_size;
av_log(avctx, AV_LOG_DEBUG, " block size: %d\n", s->avctx->frame_size);
if (avctx->lpc_coeff_precision > 0) {
if (avctx->lpc_coeff_precision > MAX_LPC_PRECISION) {
av_log(avctx, AV_LOG_ERROR, "invalid lpc coeff precision: %d\n",
avctx->lpc_coeff_precision);
return -1;
}
s->options.lpc_coeff_precision = avctx->lpc_coeff_precision;
} else {
s->options.lpc_coeff_precision = 15;
}
av_log(avctx, AV_LOG_DEBUG, " lpc precision: %d\n",
s->options.lpc_coeff_precision);
s->max_framesize = ff_flac_get_max_frame_size(s->avctx->frame_size,
s->VAR_1, 16);
s->md5ctx = av_malloc(av_md5_size);
if (!s->md5ctx)
av_md5_init(s->md5ctx);
streaminfo = av_malloc(FLAC_STREAMINFO_SIZE);
if (!streaminfo)
write_streaminfo(s, streaminfo);
avctx->extradata = streaminfo;
avctx->extradata_size = FLAC_STREAMINFO_SIZE;
s->frame_count = 0;
s->min_framesize = s->max_framesize;
avctx->coded_frame = avcodec_alloc_frame();
avctx->coded_frame->key_frame = 1;
return 0;
}
|
[
"static av_cold int FUNC_0(AVCodecContext *avctx)\n{",
"int VAR_0 = avctx->sample_rate;",
"int VAR_1 = avctx->VAR_1;",
"FlacEncodeContext *s = avctx->priv_data;",
"int VAR_2, VAR_3;",
"uint8_t *streaminfo;",
"s->avctx = avctx;",
"dsputil_init(&s->dsp, avctx);",
"if (avctx->sample_fmt != SAMPLE_FMT_S16)\nreturn -1;",
"if (VAR_1 < 1 || VAR_1 > FLAC_MAX_CHANNELS)\nreturn -1;",
"s->VAR_1 = VAR_1;",
"if (VAR_0 < 1)\nreturn -1;",
"for (VAR_2 = 4; VAR_2 < 12; VAR_2++) {",
"if (VAR_0 == ff_flac_sample_rate_table[VAR_2]) {",
"s->samplerate = ff_flac_sample_rate_table[VAR_2];",
"s->sr_code[0] = VAR_2;",
"s->sr_code[1] = 0;",
"break;",
"}",
"}",
"if (VAR_2 == 12) {",
"if (VAR_0 % 1000 == 0 && VAR_0 < 255000) {",
"s->sr_code[0] = 12;",
"s->sr_code[1] = VAR_0 / 1000;",
"} else if (VAR_0 % 10 == 0 && VAR_0 < 655350) {",
"s->sr_code[0] = 14;",
"s->sr_code[1] = VAR_0 / 10;",
"} else if (VAR_0 < 65535) {",
"s->sr_code[0] = 13;",
"s->sr_code[1] = VAR_0;",
"} else {",
"return -1;",
"}",
"s->samplerate = VAR_0;",
"}",
"if (avctx->compression_level < 0)\ns->options.compression_level = 5;",
"else\ns->options.compression_level = avctx->compression_level;",
"av_log(avctx, AV_LOG_DEBUG, \" compression: %d\\n\", s->options.compression_level);",
"VAR_3 = s->options.compression_level;",
"if (VAR_3 > 12) {",
"av_log(avctx, AV_LOG_ERROR, \"invalid compression VAR_3: %d\\n\",\ns->options.compression_level);",
"return -1;",
"}",
"s->options.block_time_ms = ((int[]){ 27, 27, 27,105,105,105,105,105,105,105,105,105,105})[VAR_3];",
"s->options.lpc_type = ((int[]){ AV_LPC_TYPE_FIXED, AV_LPC_TYPE_FIXED, AV_LPC_TYPE_FIXED,",
"AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON,\nAV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON,\nAV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON, AV_LPC_TYPE_LEVINSON,\nAV_LPC_TYPE_LEVINSON})[VAR_3];",
"s->options.min_prediction_order = ((int[]){ 2, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1})[VAR_3];",
"s->options.max_prediction_order = ((int[]){ 3, 4, 4, 6, 8, 8, 8, 8, 12, 12, 12, 32, 32})[VAR_3];",
"s->options.prediction_order_method = ((int[]){ ORDER_METHOD_EST, ORDER_METHOD_EST, ORDER_METHOD_EST,",
"ORDER_METHOD_EST, ORDER_METHOD_EST, ORDER_METHOD_EST,\nORDER_METHOD_4LEVEL, ORDER_METHOD_LOG, ORDER_METHOD_4LEVEL,\nORDER_METHOD_LOG, ORDER_METHOD_SEARCH, ORDER_METHOD_LOG,\nORDER_METHOD_SEARCH})[VAR_3];",
"s->options.min_partition_order = ((int[]){ 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})[VAR_3];",
"s->options.max_partition_order = ((int[]){ 2, 2, 3, 3, 3, 8, 8, 8, 8, 8, 8, 8, 8})[VAR_3];",
"#if LIBAVCODEC_VERSION_MAJOR < 53\nif (avctx->use_lpc == 0) {",
"s->options.lpc_type = AV_LPC_TYPE_FIXED;",
"} else if (avctx->use_lpc == 1) {",
"s->options.lpc_type = AV_LPC_TYPE_LEVINSON;",
"} else if (avctx->use_lpc > 1) {",
"s->options.lpc_type = AV_LPC_TYPE_CHOLESKY;",
"s->options.lpc_passes = avctx->use_lpc - 1;",
"}",
"#endif\nif (avctx->lpc_type > AV_LPC_TYPE_DEFAULT) {",
"if (avctx->lpc_type > AV_LPC_TYPE_CHOLESKY) {",
"av_log(avctx, AV_LOG_ERROR, \"unknown lpc type: %d\\n\", avctx->lpc_type);",
"return -1;",
"}",
"s->options.lpc_type = avctx->lpc_type;",
"if (s->options.lpc_type == AV_LPC_TYPE_CHOLESKY) {",
"if (avctx->lpc_passes < 0) {",
"s->options.lpc_passes = 2;",
"} else if (avctx->lpc_passes == 0) {",
"av_log(avctx, AV_LOG_ERROR, \"invalid number of lpc passes: %d\\n\",\navctx->lpc_passes);",
"return -1;",
"} else {",
"s->options.lpc_passes = avctx->lpc_passes;",
"}",
"}",
"}",
"switch (s->options.lpc_type) {",
"case AV_LPC_TYPE_NONE:\nav_log(avctx, AV_LOG_DEBUG, \" lpc type: None\\n\");",
"break;",
"case AV_LPC_TYPE_FIXED:\nav_log(avctx, AV_LOG_DEBUG, \" lpc type: Fixed pre-defined coefficients\\n\");",
"break;",
"case AV_LPC_TYPE_LEVINSON:\nav_log(avctx, AV_LOG_DEBUG, \" lpc type: Levinson-Durbin recursion with Welch window\\n\");",
"break;",
"case AV_LPC_TYPE_CHOLESKY:\nav_log(avctx, AV_LOG_DEBUG, \" lpc type: Cholesky factorization, %d pass%s\\n\",\ns->options.lpc_passes, s->options.lpc_passes==1?\"\":\"es\");",
"break;",
"}",
"if (s->options.lpc_type == AV_LPC_TYPE_NONE) {",
"s->options.min_prediction_order = 0;",
"} else if (avctx->min_prediction_order >= 0) {",
"if (s->options.lpc_type == AV_LPC_TYPE_FIXED) {",
"if (avctx->min_prediction_order > MAX_FIXED_ORDER) {",
"av_log(avctx, AV_LOG_ERROR, \"invalid min prediction order: %d\\n\",\navctx->min_prediction_order);",
"return -1;",
"}",
"} else if (avctx->min_prediction_order < MIN_LPC_ORDER ||",
"avctx->min_prediction_order > MAX_LPC_ORDER) {",
"av_log(avctx, AV_LOG_ERROR, \"invalid min prediction order: %d\\n\",\navctx->min_prediction_order);",
"return -1;",
"}",
"s->options.min_prediction_order = avctx->min_prediction_order;",
"}",
"if (s->options.lpc_type == AV_LPC_TYPE_NONE) {",
"s->options.max_prediction_order = 0;",
"} else if (avctx->max_prediction_order >= 0) {",
"if (s->options.lpc_type == AV_LPC_TYPE_FIXED) {",
"if (avctx->max_prediction_order > MAX_FIXED_ORDER) {",
"av_log(avctx, AV_LOG_ERROR, \"invalid max prediction order: %d\\n\",\navctx->max_prediction_order);",
"return -1;",
"}",
"} else if (avctx->max_prediction_order < MIN_LPC_ORDER ||",
"avctx->max_prediction_order > MAX_LPC_ORDER) {",
"av_log(avctx, AV_LOG_ERROR, \"invalid max prediction order: %d\\n\",\navctx->max_prediction_order);",
"return -1;",
"}",
"s->options.max_prediction_order = avctx->max_prediction_order;",
"}",
"if (s->options.max_prediction_order < s->options.min_prediction_order) {",
"av_log(avctx, AV_LOG_ERROR, \"invalid prediction orders: min=%d max=%d\\n\",\ns->options.min_prediction_order, s->options.max_prediction_order);",
"return -1;",
"}",
"av_log(avctx, AV_LOG_DEBUG, \" prediction order: %d, %d\\n\",\ns->options.min_prediction_order, s->options.max_prediction_order);",
"if (avctx->prediction_order_method >= 0) {",
"if (avctx->prediction_order_method > ORDER_METHOD_LOG) {",
"av_log(avctx, AV_LOG_ERROR, \"invalid prediction order method: %d\\n\",\navctx->prediction_order_method);",
"return -1;",
"}",
"s->options.prediction_order_method = avctx->prediction_order_method;",
"}",
"switch (s->options.prediction_order_method) {",
"case ORDER_METHOD_EST: av_log(avctx, AV_LOG_DEBUG, \" order method: %s\\n\",\n\"estimate\"); break;",
"case ORDER_METHOD_2LEVEL: av_log(avctx, AV_LOG_DEBUG, \" order method: %s\\n\",\n\"2-VAR_3\"); break;",
"case ORDER_METHOD_4LEVEL: av_log(avctx, AV_LOG_DEBUG, \" order method: %s\\n\",\n\"4-VAR_3\"); break;",
"case ORDER_METHOD_8LEVEL: av_log(avctx, AV_LOG_DEBUG, \" order method: %s\\n\",\n\"8-VAR_3\"); break;",
"case ORDER_METHOD_SEARCH: av_log(avctx, AV_LOG_DEBUG, \" order method: %s\\n\",\n\"full search\"); break;",
"case ORDER_METHOD_LOG: av_log(avctx, AV_LOG_DEBUG, \" order method: %s\\n\",\n\"log search\"); break;",
"}",
"if (avctx->min_partition_order >= 0) {",
"if (avctx->min_partition_order > MAX_PARTITION_ORDER) {",
"av_log(avctx, AV_LOG_ERROR, \"invalid min partition order: %d\\n\",\navctx->min_partition_order);",
"return -1;",
"}",
"s->options.min_partition_order = avctx->min_partition_order;",
"}",
"if (avctx->max_partition_order >= 0) {",
"if (avctx->max_partition_order > MAX_PARTITION_ORDER) {",
"av_log(avctx, AV_LOG_ERROR, \"invalid max partition order: %d\\n\",\navctx->max_partition_order);",
"return -1;",
"}",
"s->options.max_partition_order = avctx->max_partition_order;",
"}",
"if (s->options.max_partition_order < s->options.min_partition_order) {",
"av_log(avctx, AV_LOG_ERROR, \"invalid partition orders: min=%d max=%d\\n\",\ns->options.min_partition_order, s->options.max_partition_order);",
"return -1;",
"}",
"av_log(avctx, AV_LOG_DEBUG, \" partition order: %d, %d\\n\",\ns->options.min_partition_order, s->options.max_partition_order);",
"if (avctx->frame_size > 0) {",
"if (avctx->frame_size < FLAC_MIN_BLOCKSIZE ||\navctx->frame_size > FLAC_MAX_BLOCKSIZE) {",
"av_log(avctx, AV_LOG_ERROR, \"invalid block size: %d\\n\",\navctx->frame_size);",
"return -1;",
"}",
"} else {",
"s->avctx->frame_size = select_blocksize(s->samplerate, s->options.block_time_ms);",
"}",
"s->max_blocksize = s->avctx->frame_size;",
"av_log(avctx, AV_LOG_DEBUG, \" block size: %d\\n\", s->avctx->frame_size);",
"if (avctx->lpc_coeff_precision > 0) {",
"if (avctx->lpc_coeff_precision > MAX_LPC_PRECISION) {",
"av_log(avctx, AV_LOG_ERROR, \"invalid lpc coeff precision: %d\\n\",\navctx->lpc_coeff_precision);",
"return -1;",
"}",
"s->options.lpc_coeff_precision = avctx->lpc_coeff_precision;",
"} else {",
"s->options.lpc_coeff_precision = 15;",
"}",
"av_log(avctx, AV_LOG_DEBUG, \" lpc precision: %d\\n\",\ns->options.lpc_coeff_precision);",
"s->max_framesize = ff_flac_get_max_frame_size(s->avctx->frame_size,\ns->VAR_1, 16);",
"s->md5ctx = av_malloc(av_md5_size);",
"if (!s->md5ctx)\nav_md5_init(s->md5ctx);",
"streaminfo = av_malloc(FLAC_STREAMINFO_SIZE);",
"if (!streaminfo)\nwrite_streaminfo(s, streaminfo);",
"avctx->extradata = streaminfo;",
"avctx->extradata_size = FLAC_STREAMINFO_SIZE;",
"s->frame_count = 0;",
"s->min_framesize = s->max_framesize;",
"avctx->coded_frame = avcodec_alloc_frame();",
"avctx->coded_frame->key_frame = 1;",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
21
],
[
25,
27
],
[
31,
33
],
[
35
],
[
41,
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
97,
99
],
[
101,
103
],
[
105
],
[
109
],
[
111
],
[
113,
115
],
[
117
],
[
119
],
[
123
],
[
127
],
[
129,
131,
133,
135
],
[
139
],
[
141
],
[
145
],
[
147,
149,
151,
153
],
[
157
],
[
159
],
[
165,
169
],
[
171
],
[
173
],
[
175
],
[
177
],
[
179
],
[
181
],
[
183
],
[
185,
187
],
[
189
],
[
191
],
[
193
],
[
195
],
[
197
],
[
199
],
[
201
],
[
205
],
[
207
],
[
209,
211
],
[
213
],
[
215
],
[
217
],
[
219
],
[
221
],
[
223
],
[
225
],
[
227,
229
],
[
231
],
[
233,
235
],
[
237
],
[
239,
241
],
[
243
],
[
245,
247,
249
],
[
251
],
[
253
],
[
257
],
[
259
],
[
261
],
[
263
],
[
265
],
[
267,
269
],
[
271
],
[
273
],
[
275
],
[
277
],
[
279,
281
],
[
283
],
[
285
],
[
287
],
[
289
],
[
291
],
[
293
],
[
295
],
[
297
],
[
299
],
[
301,
303
],
[
305
],
[
307
],
[
309
],
[
311
],
[
313,
315
],
[
317
],
[
319
],
[
321
],
[
323
],
[
325
],
[
327,
329
],
[
331
],
[
333
],
[
335,
337
],
[
341
],
[
343
],
[
345,
347
],
[
349
],
[
351
],
[
353
],
[
355
],
[
357
],
[
359,
361
],
[
363,
365
],
[
367,
369
],
[
371,
373
],
[
375,
377
],
[
379,
381
],
[
383
],
[
387
],
[
389
],
[
391,
393
],
[
395
],
[
397
],
[
399
],
[
401
],
[
403
],
[
405
],
[
407,
409
],
[
411
],
[
413
],
[
415
],
[
417
],
[
419
],
[
421,
423
],
[
425
],
[
427
],
[
429,
431
],
[
435
],
[
437,
439
],
[
441,
443
],
[
445
],
[
447
],
[
449
],
[
451
],
[
453
],
[
455
],
[
457
],
[
463
],
[
465
],
[
467,
469
],
[
471
],
[
473
],
[
475
],
[
477
],
[
481
],
[
483
],
[
485,
487
],
[
493,
495
],
[
501
],
[
503,
506
],
[
510
],
[
512,
515
],
[
517
],
[
519
],
[
523
],
[
525
],
[
529
],
[
533
],
[
537
],
[
539
]
] |
6,338 |
static void init_mbr(BDRVVVFATState* s)
{
/* TODO: if the files mbr.img and bootsect.img exist, use them */
mbr_t* real_mbr=(mbr_t*)s->first_sectors;
partition_t* partition = &(real_mbr->partition[0]);
int lba;
memset(s->first_sectors,0,512);
/* Win NT Disk Signature */
real_mbr->nt_id= cpu_to_le32(0xbe1afdfa);
partition->attributes=0x80; /* bootable */
/* LBA is used when partition is outside the CHS geometry */
lba = sector2CHS(s->bs, &partition->start_CHS, s->first_sectors_number-1);
lba|= sector2CHS(s->bs, &partition->end_CHS, s->sector_count);
/*LBA partitions are identified only by start/length_sector_long not by CHS*/
partition->start_sector_long =cpu_to_le32(s->first_sectors_number-1);
partition->length_sector_long=cpu_to_le32(s->sector_count - s->first_sectors_number+1);
/* FAT12/FAT16/FAT32 */
/* DOS uses different types when partition is LBA,
probably to prevent older versions from using CHS on them */
partition->fs_type= s->fat_type==12 ? 0x1:
s->fat_type==16 ? (lba?0xe:0x06):
/*fat_tyoe==32*/ (lba?0xc:0x0b);
real_mbr->magic[0]=0x55; real_mbr->magic[1]=0xaa;
}
| true |
qemu
|
f91cbefe2d0eb3f7b5071bcb1fd3a02970f1a776
|
static void init_mbr(BDRVVVFATState* s)
{
mbr_t* real_mbr=(mbr_t*)s->first_sectors;
partition_t* partition = &(real_mbr->partition[0]);
int lba;
memset(s->first_sectors,0,512);
real_mbr->nt_id= cpu_to_le32(0xbe1afdfa);
partition->attributes=0x80;
lba = sector2CHS(s->bs, &partition->start_CHS, s->first_sectors_number-1);
lba|= sector2CHS(s->bs, &partition->end_CHS, s->sector_count);
partition->start_sector_long =cpu_to_le32(s->first_sectors_number-1);
partition->length_sector_long=cpu_to_le32(s->sector_count - s->first_sectors_number+1);
partition->fs_type= s->fat_type==12 ? 0x1:
s->fat_type==16 ? (lba?0xe:0x06):
(lba?0xc:0x0b);
real_mbr->magic[0]=0x55; real_mbr->magic[1]=0xaa;
}
|
{
"code": [
" lba|= sector2CHS(s->bs, &partition->end_CHS, s->sector_count);",
" partition->start_sector_long =cpu_to_le32(s->first_sectors_number-1);",
" partition->length_sector_long=cpu_to_le32(s->sector_count - s->first_sectors_number+1);"
],
"line_no": [
33,
39,
41
]
}
|
static void FUNC_0(BDRVVVFATState* VAR_0)
{
mbr_t* real_mbr=(mbr_t*)VAR_0->first_sectors;
partition_t* partition = &(real_mbr->partition[0]);
int VAR_1;
memset(VAR_0->first_sectors,0,512);
real_mbr->nt_id= cpu_to_le32(0xbe1afdfa);
partition->attributes=0x80;
VAR_1 = sector2CHS(VAR_0->bs, &partition->start_CHS, VAR_0->first_sectors_number-1);
VAR_1|= sector2CHS(VAR_0->bs, &partition->end_CHS, VAR_0->sector_count);
partition->start_sector_long =cpu_to_le32(VAR_0->first_sectors_number-1);
partition->length_sector_long=cpu_to_le32(VAR_0->sector_count - VAR_0->first_sectors_number+1);
partition->fs_type= VAR_0->fat_type==12 ? 0x1:
VAR_0->fat_type==16 ? (VAR_1?0xe:0x06):
(VAR_1?0xc:0x0b);
real_mbr->magic[0]=0x55; real_mbr->magic[1]=0xaa;
}
|
[
"static void FUNC_0(BDRVVVFATState* VAR_0)\n{",
"mbr_t* real_mbr=(mbr_t*)VAR_0->first_sectors;",
"partition_t* partition = &(real_mbr->partition[0]);",
"int VAR_1;",
"memset(VAR_0->first_sectors,0,512);",
"real_mbr->nt_id= cpu_to_le32(0xbe1afdfa);",
"partition->attributes=0x80;",
"VAR_1 = sector2CHS(VAR_0->bs, &partition->start_CHS, VAR_0->first_sectors_number-1);",
"VAR_1|= sector2CHS(VAR_0->bs, &partition->end_CHS, VAR_0->sector_count);",
"partition->start_sector_long =cpu_to_le32(VAR_0->first_sectors_number-1);",
"partition->length_sector_long=cpu_to_le32(VAR_0->sector_count - VAR_0->first_sectors_number+1);",
"partition->fs_type= VAR_0->fat_type==12 ? 0x1:\nVAR_0->fat_type==16 ? (VAR_1?0xe:0x06):\n(VAR_1?0xc:0x0b);",
"real_mbr->magic[0]=0x55; real_mbr->magic[1]=0xaa;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
1,
0,
0,
0
] |
[
[
1,
3
],
[
7
],
[
9
],
[
11
],
[
15
],
[
21
],
[
25
],
[
31
],
[
33
],
[
39
],
[
41
],
[
51,
53,
55
],
[
59
],
[
61
]
] |
6,340 |
static void set_year_20xx(void)
{
/* Set BCD mode */
cmos_write(RTC_REG_B, cmos_read(RTC_REG_B) & ~REG_B_DM);
cmos_write(RTC_REG_A, 0x76);
cmos_write(RTC_YEAR, 0x11);
cmos_write(RTC_CENTURY, 0x20);
cmos_write(RTC_MONTH, 0x02);
cmos_write(RTC_DAY_OF_MONTH, 0x02);
cmos_write(RTC_HOURS, 0x02);
cmos_write(RTC_MINUTES, 0x04);
cmos_write(RTC_SECONDS, 0x58);
cmos_write(RTC_REG_A, 0x26);
g_assert_cmpint(cmos_read(RTC_HOURS), ==, 0x02);
g_assert_cmpint(cmos_read(RTC_MINUTES), ==, 0x04);
g_assert_cmpint(cmos_read(RTC_SECONDS), >=, 0x58);
g_assert_cmpint(cmos_read(RTC_DAY_OF_MONTH), ==, 0x02);
g_assert_cmpint(cmos_read(RTC_MONTH), ==, 0x02);
g_assert_cmpint(cmos_read(RTC_YEAR), ==, 0x11);
g_assert_cmpint(cmos_read(RTC_CENTURY), ==, 0x20);
/* Set a date in 2080 to ensure there is no year-2038 overflow. */
cmos_write(RTC_REG_A, 0x76);
cmos_write(RTC_YEAR, 0x80);
cmos_write(RTC_REG_A, 0x26);
g_assert_cmpint(cmos_read(RTC_HOURS), ==, 0x02);
g_assert_cmpint(cmos_read(RTC_MINUTES), ==, 0x04);
g_assert_cmpint(cmos_read(RTC_SECONDS), >=, 0x58);
g_assert_cmpint(cmos_read(RTC_DAY_OF_MONTH), ==, 0x02);
g_assert_cmpint(cmos_read(RTC_MONTH), ==, 0x02);
g_assert_cmpint(cmos_read(RTC_YEAR), ==, 0x80);
g_assert_cmpint(cmos_read(RTC_CENTURY), ==, 0x20);
cmos_write(RTC_REG_A, 0x76);
cmos_write(RTC_YEAR, 0x11);
cmos_write(RTC_REG_A, 0x26);
g_assert_cmpint(cmos_read(RTC_HOURS), ==, 0x02);
g_assert_cmpint(cmos_read(RTC_MINUTES), ==, 0x04);
g_assert_cmpint(cmos_read(RTC_SECONDS), >=, 0x58);
g_assert_cmpint(cmos_read(RTC_DAY_OF_MONTH), ==, 0x02);
g_assert_cmpint(cmos_read(RTC_MONTH), ==, 0x02);
g_assert_cmpint(cmos_read(RTC_YEAR), ==, 0x11);
g_assert_cmpint(cmos_read(RTC_CENTURY), ==, 0x20);
| true |
qemu
|
4e45deedf57c6cc7113b588282d0c16f89298aff
|
static void set_year_20xx(void)
{
cmos_write(RTC_REG_B, cmos_read(RTC_REG_B) & ~REG_B_DM);
cmos_write(RTC_REG_A, 0x76);
cmos_write(RTC_YEAR, 0x11);
cmos_write(RTC_CENTURY, 0x20);
cmos_write(RTC_MONTH, 0x02);
cmos_write(RTC_DAY_OF_MONTH, 0x02);
cmos_write(RTC_HOURS, 0x02);
cmos_write(RTC_MINUTES, 0x04);
cmos_write(RTC_SECONDS, 0x58);
cmos_write(RTC_REG_A, 0x26);
g_assert_cmpint(cmos_read(RTC_HOURS), ==, 0x02);
g_assert_cmpint(cmos_read(RTC_MINUTES), ==, 0x04);
g_assert_cmpint(cmos_read(RTC_SECONDS), >=, 0x58);
g_assert_cmpint(cmos_read(RTC_DAY_OF_MONTH), ==, 0x02);
g_assert_cmpint(cmos_read(RTC_MONTH), ==, 0x02);
g_assert_cmpint(cmos_read(RTC_YEAR), ==, 0x11);
g_assert_cmpint(cmos_read(RTC_CENTURY), ==, 0x20);
cmos_write(RTC_REG_A, 0x76);
cmos_write(RTC_YEAR, 0x80);
cmos_write(RTC_REG_A, 0x26);
g_assert_cmpint(cmos_read(RTC_HOURS), ==, 0x02);
g_assert_cmpint(cmos_read(RTC_MINUTES), ==, 0x04);
g_assert_cmpint(cmos_read(RTC_SECONDS), >=, 0x58);
g_assert_cmpint(cmos_read(RTC_DAY_OF_MONTH), ==, 0x02);
g_assert_cmpint(cmos_read(RTC_MONTH), ==, 0x02);
g_assert_cmpint(cmos_read(RTC_YEAR), ==, 0x80);
g_assert_cmpint(cmos_read(RTC_CENTURY), ==, 0x20);
cmos_write(RTC_REG_A, 0x76);
cmos_write(RTC_YEAR, 0x11);
cmos_write(RTC_REG_A, 0x26);
g_assert_cmpint(cmos_read(RTC_HOURS), ==, 0x02);
g_assert_cmpint(cmos_read(RTC_MINUTES), ==, 0x04);
g_assert_cmpint(cmos_read(RTC_SECONDS), >=, 0x58);
g_assert_cmpint(cmos_read(RTC_DAY_OF_MONTH), ==, 0x02);
g_assert_cmpint(cmos_read(RTC_MONTH), ==, 0x02);
g_assert_cmpint(cmos_read(RTC_YEAR), ==, 0x11);
g_assert_cmpint(cmos_read(RTC_CENTURY), ==, 0x20);
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(void)
{
cmos_write(RTC_REG_B, cmos_read(RTC_REG_B) & ~REG_B_DM);
cmos_write(RTC_REG_A, 0x76);
cmos_write(RTC_YEAR, 0x11);
cmos_write(RTC_CENTURY, 0x20);
cmos_write(RTC_MONTH, 0x02);
cmos_write(RTC_DAY_OF_MONTH, 0x02);
cmos_write(RTC_HOURS, 0x02);
cmos_write(RTC_MINUTES, 0x04);
cmos_write(RTC_SECONDS, 0x58);
cmos_write(RTC_REG_A, 0x26);
g_assert_cmpint(cmos_read(RTC_HOURS), ==, 0x02);
g_assert_cmpint(cmos_read(RTC_MINUTES), ==, 0x04);
g_assert_cmpint(cmos_read(RTC_SECONDS), >=, 0x58);
g_assert_cmpint(cmos_read(RTC_DAY_OF_MONTH), ==, 0x02);
g_assert_cmpint(cmos_read(RTC_MONTH), ==, 0x02);
g_assert_cmpint(cmos_read(RTC_YEAR), ==, 0x11);
g_assert_cmpint(cmos_read(RTC_CENTURY), ==, 0x20);
cmos_write(RTC_REG_A, 0x76);
cmos_write(RTC_YEAR, 0x80);
cmos_write(RTC_REG_A, 0x26);
g_assert_cmpint(cmos_read(RTC_HOURS), ==, 0x02);
g_assert_cmpint(cmos_read(RTC_MINUTES), ==, 0x04);
g_assert_cmpint(cmos_read(RTC_SECONDS), >=, 0x58);
g_assert_cmpint(cmos_read(RTC_DAY_OF_MONTH), ==, 0x02);
g_assert_cmpint(cmos_read(RTC_MONTH), ==, 0x02);
g_assert_cmpint(cmos_read(RTC_YEAR), ==, 0x80);
g_assert_cmpint(cmos_read(RTC_CENTURY), ==, 0x20);
cmos_write(RTC_REG_A, 0x76);
cmos_write(RTC_YEAR, 0x11);
cmos_write(RTC_REG_A, 0x26);
g_assert_cmpint(cmos_read(RTC_HOURS), ==, 0x02);
g_assert_cmpint(cmos_read(RTC_MINUTES), ==, 0x04);
g_assert_cmpint(cmos_read(RTC_SECONDS), >=, 0x58);
g_assert_cmpint(cmos_read(RTC_DAY_OF_MONTH), ==, 0x02);
g_assert_cmpint(cmos_read(RTC_MONTH), ==, 0x02);
g_assert_cmpint(cmos_read(RTC_YEAR), ==, 0x11);
g_assert_cmpint(cmos_read(RTC_CENTURY), ==, 0x20);
|
[
"static void FUNC_0(void)\n{",
"cmos_write(RTC_REG_B, cmos_read(RTC_REG_B) & ~REG_B_DM);",
"cmos_write(RTC_REG_A, 0x76);",
"cmos_write(RTC_YEAR, 0x11);",
"cmos_write(RTC_CENTURY, 0x20);",
"cmos_write(RTC_MONTH, 0x02);",
"cmos_write(RTC_DAY_OF_MONTH, 0x02);",
"cmos_write(RTC_HOURS, 0x02);",
"cmos_write(RTC_MINUTES, 0x04);",
"cmos_write(RTC_SECONDS, 0x58);",
"cmos_write(RTC_REG_A, 0x26);",
"g_assert_cmpint(cmos_read(RTC_HOURS), ==, 0x02);",
"g_assert_cmpint(cmos_read(RTC_MINUTES), ==, 0x04);",
"g_assert_cmpint(cmos_read(RTC_SECONDS), >=, 0x58);",
"g_assert_cmpint(cmos_read(RTC_DAY_OF_MONTH), ==, 0x02);",
"g_assert_cmpint(cmos_read(RTC_MONTH), ==, 0x02);",
"g_assert_cmpint(cmos_read(RTC_YEAR), ==, 0x11);",
"g_assert_cmpint(cmos_read(RTC_CENTURY), ==, 0x20);",
"cmos_write(RTC_REG_A, 0x76);",
"cmos_write(RTC_YEAR, 0x80);",
"cmos_write(RTC_REG_A, 0x26);",
"g_assert_cmpint(cmos_read(RTC_HOURS), ==, 0x02);",
"g_assert_cmpint(cmos_read(RTC_MINUTES), ==, 0x04);",
"g_assert_cmpint(cmos_read(RTC_SECONDS), >=, 0x58);",
"g_assert_cmpint(cmos_read(RTC_DAY_OF_MONTH), ==, 0x02);",
"g_assert_cmpint(cmos_read(RTC_MONTH), ==, 0x02);",
"g_assert_cmpint(cmos_read(RTC_YEAR), ==, 0x80);",
"g_assert_cmpint(cmos_read(RTC_CENTURY), ==, 0x20);",
"cmos_write(RTC_REG_A, 0x76);",
"cmos_write(RTC_YEAR, 0x11);",
"cmos_write(RTC_REG_A, 0x26);",
"g_assert_cmpint(cmos_read(RTC_HOURS), ==, 0x02);",
"g_assert_cmpint(cmos_read(RTC_MINUTES), ==, 0x04);",
"g_assert_cmpint(cmos_read(RTC_SECONDS), >=, 0x58);",
"g_assert_cmpint(cmos_read(RTC_DAY_OF_MONTH), ==, 0x02);",
"g_assert_cmpint(cmos_read(RTC_MONTH), ==, 0x02);",
"g_assert_cmpint(cmos_read(RTC_YEAR), ==, 0x11);",
"g_assert_cmpint(cmos_read(RTC_CENTURY), ==, 0x20);"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
4
],
[
5
],
[
6
],
[
7
],
[
8
],
[
9
],
[
10
],
[
11
],
[
12
],
[
13
],
[
14
],
[
15
],
[
16
],
[
17
],
[
18
],
[
19
],
[
20
],
[
22
],
[
23
],
[
24
],
[
25
],
[
26
],
[
27
],
[
28
],
[
29
],
[
30
],
[
31
],
[
32
],
[
33
],
[
34
],
[
35
],
[
36
],
[
37
],
[
38
],
[
39
],
[
40
],
[
41
]
] |
6,341 |
void avfilter_destroy(AVFilterContext *filter)
{
int i;
if(filter->filter->uninit)
filter->filter->uninit(filter);
for(i = 0; i < filter->input_count; i ++) {
if(filter->inputs[i]) {
filter->inputs[i]->src->outputs[filter->inputs[i]->srcpad] = NULL;
avfilter_formats_unref(&filter->inputs[i]->in_formats);
avfilter_formats_unref(&filter->inputs[i]->out_formats);
}
av_freep(&filter->inputs[i]);
}
for(i = 0; i < filter->output_count; i ++) {
if(filter->outputs[i]) {
if (filter->outputs[i]->dst)
filter->outputs[i]->dst->inputs[filter->outputs[i]->dstpad] = NULL;
avfilter_formats_unref(&filter->outputs[i]->in_formats);
avfilter_formats_unref(&filter->outputs[i]->out_formats);
}
av_freep(&filter->outputs[i]);
}
av_freep(&filter->name);
av_freep(&filter->input_pads);
av_freep(&filter->output_pads);
av_freep(&filter->inputs);
av_freep(&filter->outputs);
av_freep(&filter->priv);
av_free(filter);
}
| true |
FFmpeg
|
0bb7408e557f5d5ee3f8c1d001012e5c204c20b4
|
void avfilter_destroy(AVFilterContext *filter)
{
int i;
if(filter->filter->uninit)
filter->filter->uninit(filter);
for(i = 0; i < filter->input_count; i ++) {
if(filter->inputs[i]) {
filter->inputs[i]->src->outputs[filter->inputs[i]->srcpad] = NULL;
avfilter_formats_unref(&filter->inputs[i]->in_formats);
avfilter_formats_unref(&filter->inputs[i]->out_formats);
}
av_freep(&filter->inputs[i]);
}
for(i = 0; i < filter->output_count; i ++) {
if(filter->outputs[i]) {
if (filter->outputs[i]->dst)
filter->outputs[i]->dst->inputs[filter->outputs[i]->dstpad] = NULL;
avfilter_formats_unref(&filter->outputs[i]->in_formats);
avfilter_formats_unref(&filter->outputs[i]->out_formats);
}
av_freep(&filter->outputs[i]);
}
av_freep(&filter->name);
av_freep(&filter->input_pads);
av_freep(&filter->output_pads);
av_freep(&filter->inputs);
av_freep(&filter->outputs);
av_freep(&filter->priv);
av_free(filter);
}
|
{
"code": [],
"line_no": []
}
|
void FUNC_0(AVFilterContext *VAR_0)
{
int VAR_1;
if(VAR_0->VAR_0->uninit)
VAR_0->VAR_0->uninit(VAR_0);
for(VAR_1 = 0; VAR_1 < VAR_0->input_count; VAR_1 ++) {
if(VAR_0->inputs[VAR_1]) {
VAR_0->inputs[VAR_1]->src->outputs[VAR_0->inputs[VAR_1]->srcpad] = NULL;
avfilter_formats_unref(&VAR_0->inputs[VAR_1]->in_formats);
avfilter_formats_unref(&VAR_0->inputs[VAR_1]->out_formats);
}
av_freep(&VAR_0->inputs[VAR_1]);
}
for(VAR_1 = 0; VAR_1 < VAR_0->output_count; VAR_1 ++) {
if(VAR_0->outputs[VAR_1]) {
if (VAR_0->outputs[VAR_1]->dst)
VAR_0->outputs[VAR_1]->dst->inputs[VAR_0->outputs[VAR_1]->dstpad] = NULL;
avfilter_formats_unref(&VAR_0->outputs[VAR_1]->in_formats);
avfilter_formats_unref(&VAR_0->outputs[VAR_1]->out_formats);
}
av_freep(&VAR_0->outputs[VAR_1]);
}
av_freep(&VAR_0->name);
av_freep(&VAR_0->input_pads);
av_freep(&VAR_0->output_pads);
av_freep(&VAR_0->inputs);
av_freep(&VAR_0->outputs);
av_freep(&VAR_0->priv);
av_free(VAR_0);
}
|
[
"void FUNC_0(AVFilterContext *VAR_0)\n{",
"int VAR_1;",
"if(VAR_0->VAR_0->uninit)\nVAR_0->VAR_0->uninit(VAR_0);",
"for(VAR_1 = 0; VAR_1 < VAR_0->input_count; VAR_1 ++) {",
"if(VAR_0->inputs[VAR_1]) {",
"VAR_0->inputs[VAR_1]->src->outputs[VAR_0->inputs[VAR_1]->srcpad] = NULL;",
"avfilter_formats_unref(&VAR_0->inputs[VAR_1]->in_formats);",
"avfilter_formats_unref(&VAR_0->inputs[VAR_1]->out_formats);",
"}",
"av_freep(&VAR_0->inputs[VAR_1]);",
"}",
"for(VAR_1 = 0; VAR_1 < VAR_0->output_count; VAR_1 ++) {",
"if(VAR_0->outputs[VAR_1]) {",
"if (VAR_0->outputs[VAR_1]->dst)\nVAR_0->outputs[VAR_1]->dst->inputs[VAR_0->outputs[VAR_1]->dstpad] = NULL;",
"avfilter_formats_unref(&VAR_0->outputs[VAR_1]->in_formats);",
"avfilter_formats_unref(&VAR_0->outputs[VAR_1]->out_formats);",
"}",
"av_freep(&VAR_0->outputs[VAR_1]);",
"}",
"av_freep(&VAR_0->name);",
"av_freep(&VAR_0->input_pads);",
"av_freep(&VAR_0->output_pads);",
"av_freep(&VAR_0->inputs);",
"av_freep(&VAR_0->outputs);",
"av_freep(&VAR_0->priv);",
"av_free(VAR_0);",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
9,
11
],
[
15
],
[
17
],
[
20
],
[
22
],
[
24
],
[
26
],
[
28
],
[
30
],
[
32
],
[
34
],
[
36,
38
],
[
40
],
[
42
],
[
44
],
[
46
],
[
48
],
[
52
],
[
54
],
[
56
],
[
58
],
[
60
],
[
62
],
[
64
],
[
66
]
] |
6,342 |
void usb_desc_create_serial(USBDevice *dev)
{
DeviceState *hcd = dev->qdev.parent_bus->parent;
const USBDesc *desc = usb_device_get_usb_desc(dev);
int index = desc->id.iSerialNumber;
char serial[64];
char *path;
int dst;
if (dev->serial) {
/* 'serial' usb bus property has priority if present */
usb_desc_set_string(dev, index, dev->serial);
return;
}
assert(index != 0 && desc->str[index] != NULL);
dst = snprintf(serial, sizeof(serial), "%s", desc->str[index]);
path = qdev_get_dev_path(hcd);
if (path) {
dst += snprintf(serial+dst, sizeof(serial)-dst, "-%s", path);
}
dst += snprintf(serial+dst, sizeof(serial)-dst, "-%s", dev->port->path);
usb_desc_set_string(dev, index, serial);
}
| true |
qemu
|
9ef617246b629109e2779835b9a3a8400029484d
|
void usb_desc_create_serial(USBDevice *dev)
{
DeviceState *hcd = dev->qdev.parent_bus->parent;
const USBDesc *desc = usb_device_get_usb_desc(dev);
int index = desc->id.iSerialNumber;
char serial[64];
char *path;
int dst;
if (dev->serial) {
usb_desc_set_string(dev, index, dev->serial);
return;
}
assert(index != 0 && desc->str[index] != NULL);
dst = snprintf(serial, sizeof(serial), "%s", desc->str[index]);
path = qdev_get_dev_path(hcd);
if (path) {
dst += snprintf(serial+dst, sizeof(serial)-dst, "-%s", path);
}
dst += snprintf(serial+dst, sizeof(serial)-dst, "-%s", dev->port->path);
usb_desc_set_string(dev, index, serial);
}
|
{
"code": [],
"line_no": []
}
|
void FUNC_0(USBDevice *VAR_0)
{
DeviceState *hcd = VAR_0->qdev.parent_bus->parent;
const USBDesc *VAR_1 = usb_device_get_usb_desc(VAR_0);
int VAR_2 = VAR_1->id.iSerialNumber;
char VAR_3[64];
char *VAR_4;
int VAR_5;
if (VAR_0->VAR_3) {
usb_desc_set_string(VAR_0, VAR_2, VAR_0->VAR_3);
return;
}
assert(VAR_2 != 0 && VAR_1->str[VAR_2] != NULL);
VAR_5 = snprintf(VAR_3, sizeof(VAR_3), "%s", VAR_1->str[VAR_2]);
VAR_4 = qdev_get_dev_path(hcd);
if (VAR_4) {
VAR_5 += snprintf(VAR_3+VAR_5, sizeof(VAR_3)-VAR_5, "-%s", VAR_4);
}
VAR_5 += snprintf(VAR_3+VAR_5, sizeof(VAR_3)-VAR_5, "-%s", VAR_0->port->VAR_4);
usb_desc_set_string(VAR_0, VAR_2, VAR_3);
}
|
[
"void FUNC_0(USBDevice *VAR_0)\n{",
"DeviceState *hcd = VAR_0->qdev.parent_bus->parent;",
"const USBDesc *VAR_1 = usb_device_get_usb_desc(VAR_0);",
"int VAR_2 = VAR_1->id.iSerialNumber;",
"char VAR_3[64];",
"char *VAR_4;",
"int VAR_5;",
"if (VAR_0->VAR_3) {",
"usb_desc_set_string(VAR_0, VAR_2, VAR_0->VAR_3);",
"return;",
"}",
"assert(VAR_2 != 0 && VAR_1->str[VAR_2] != NULL);",
"VAR_5 = snprintf(VAR_3, sizeof(VAR_3), \"%s\", VAR_1->str[VAR_2]);",
"VAR_4 = qdev_get_dev_path(hcd);",
"if (VAR_4) {",
"VAR_5 += snprintf(VAR_3+VAR_5, sizeof(VAR_3)-VAR_5, \"-%s\", VAR_4);",
"}",
"VAR_5 += snprintf(VAR_3+VAR_5, sizeof(VAR_3)-VAR_5, \"-%s\", VAR_0->port->VAR_4);",
"usb_desc_set_string(VAR_0, VAR_2, VAR_3);",
"}"
] |
[
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
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
48
]
] |
6,343 |
const char *qdict_get_str(const QDict *qdict, const char *key)
{
QObject *obj = qdict_get_obj(qdict, key, QTYPE_QSTRING);
return qstring_get_str(qobject_to_qstring(obj));
}
| true |
qemu
|
7f0278435df1fa845b3bd9556942f89296d4246b
|
const char *qdict_get_str(const QDict *qdict, const char *key)
{
QObject *obj = qdict_get_obj(qdict, key, QTYPE_QSTRING);
return qstring_get_str(qobject_to_qstring(obj));
}
|
{
"code": [
" QObject *obj = qdict_get_obj(qdict, key, QTYPE_QSTRING);",
" return qstring_get_str(qobject_to_qstring(obj));",
" return qstring_get_str(qobject_to_qstring(obj));"
],
"line_no": [
5,
7,
7
]
}
|
const char *FUNC_0(const QDict *VAR_0, const char *VAR_1)
{
QObject *obj = qdict_get_obj(VAR_0, VAR_1, QTYPE_QSTRING);
return qstring_get_str(qobject_to_qstring(obj));
}
|
[
"const char *FUNC_0(const QDict *VAR_0, const char *VAR_1)\n{",
"QObject *obj = qdict_get_obj(VAR_0, VAR_1, QTYPE_QSTRING);",
"return qstring_get_str(qobject_to_qstring(obj));",
"}"
] |
[
0,
1,
1,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
]
] |
6,344 |
static int get_coc(J2kDecoderContext *s, J2kCodingStyle *c, uint8_t *properties)
{
int compno;
if (s->buf_end - s->buf < 2)
return AVERROR(EINVAL);
compno = bytestream_get_byte(&s->buf);
c += compno;
c->csty = bytestream_get_byte(&s->buf);
get_cox(s, c);
properties[compno] |= HAD_COC;
return 0;
}
| true |
FFmpeg
|
ddfa3751c092feaf1e080f66587024689dfe603c
|
static int get_coc(J2kDecoderContext *s, J2kCodingStyle *c, uint8_t *properties)
{
int compno;
if (s->buf_end - s->buf < 2)
return AVERROR(EINVAL);
compno = bytestream_get_byte(&s->buf);
c += compno;
c->csty = bytestream_get_byte(&s->buf);
get_cox(s, c);
properties[compno] |= HAD_COC;
return 0;
}
|
{
"code": [
" return AVERROR(EINVAL);",
" if (s->buf_end - s->buf < 2)",
" compno = bytestream_get_byte(&s->buf);",
" c->csty = bytestream_get_byte(&s->buf);",
" compno = bytestream_get_byte(&s->buf);"
],
"line_no": [
11,
9,
15,
21,
15
]
}
|
static int FUNC_0(J2kDecoderContext *VAR_0, J2kCodingStyle *VAR_1, uint8_t *VAR_2)
{
int VAR_3;
if (VAR_0->buf_end - VAR_0->buf < 2)
return AVERROR(EINVAL);
VAR_3 = bytestream_get_byte(&VAR_0->buf);
VAR_1 += VAR_3;
VAR_1->csty = bytestream_get_byte(&VAR_0->buf);
get_cox(VAR_0, VAR_1);
VAR_2[VAR_3] |= HAD_COC;
return 0;
}
|
[
"static int FUNC_0(J2kDecoderContext *VAR_0, J2kCodingStyle *VAR_1, uint8_t *VAR_2)\n{",
"int VAR_3;",
"if (VAR_0->buf_end - VAR_0->buf < 2)\nreturn AVERROR(EINVAL);",
"VAR_3 = bytestream_get_byte(&VAR_0->buf);",
"VAR_1 += VAR_3;",
"VAR_1->csty = bytestream_get_byte(&VAR_0->buf);",
"get_cox(VAR_0, VAR_1);",
"VAR_2[VAR_3] |= HAD_COC;",
"return 0;",
"}"
] |
[
0,
0,
1,
1,
0,
1,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
9,
11
],
[
15
],
[
19
],
[
21
],
[
23
],
[
27
],
[
29
],
[
31
]
] |
6,345 |
static void FUNC(put_hevc_qpel_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;
const int8_t *filter;
pixel *src = (pixel*)_src;
ptrdiff_t srcstride = _srcstride / sizeof(pixel);
pixel *dst = (pixel *)_dst;
ptrdiff_t dststride = _dststride / sizeof(pixel);
int16_t tmp_array[(MAX_PB_SIZE + QPEL_EXTRA) * MAX_PB_SIZE];
int16_t *tmp = tmp_array;
int shift = 14 + 1 - BIT_DEPTH;
int log2Wd = denom + shift - 1;
src -= QPEL_EXTRA_BEFORE * srcstride;
filter = ff_hevc_qpel_filters[mx - 1];
for (y = 0; y < height + QPEL_EXTRA; y++) {
for (x = 0; x < width; x++)
tmp[x] = QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8);
src += srcstride;
tmp += MAX_PB_SIZE;
}
tmp = tmp_array + QPEL_EXTRA_BEFORE * MAX_PB_SIZE;
filter = ff_hevc_qpel_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(((QPEL_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
|
439fbb9c8b2a90e97c44c7c57245e01ca84c865d
|
static void FUNC(put_hevc_qpel_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;
const int8_t *filter;
pixel *src = (pixel*)_src;
ptrdiff_t srcstride = _srcstride / sizeof(pixel);
pixel *dst = (pixel *)_dst;
ptrdiff_t dststride = _dststride / sizeof(pixel);
int16_t tmp_array[(MAX_PB_SIZE + QPEL_EXTRA) * MAX_PB_SIZE];
int16_t *tmp = tmp_array;
int shift = 14 + 1 - BIT_DEPTH;
int log2Wd = denom + shift - 1;
src -= QPEL_EXTRA_BEFORE * srcstride;
filter = ff_hevc_qpel_filters[mx - 1];
for (y = 0; y < height + QPEL_EXTRA; y++) {
for (x = 0; x < width; x++)
tmp[x] = QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8);
src += srcstride;
tmp += MAX_PB_SIZE;
}
tmp = tmp_array + QPEL_EXTRA_BEFORE * MAX_PB_SIZE;
filter = ff_hevc_qpel_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(((QPEL_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_qpel_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;
const int8_t *VAR_2;
pixel *src = (pixel*)_src;
ptrdiff_t srcstride = _srcstride / sizeof(pixel);
pixel *dst = (pixel *)_dst;
ptrdiff_t dststride = _dststride / sizeof(pixel);
int16_t tmp_array[(MAX_PB_SIZE + QPEL_EXTRA) * MAX_PB_SIZE];
int16_t *tmp = tmp_array;
int VAR_3 = 14 + 1 - BIT_DEPTH;
int VAR_4 = denom + VAR_3 - 1;
src -= QPEL_EXTRA_BEFORE * srcstride;
VAR_2 = ff_hevc_qpel_filters[mx - 1];
for (VAR_1 = 0; VAR_1 < height + QPEL_EXTRA; VAR_1++) {
for (VAR_0 = 0; VAR_0 < width; VAR_0++)
tmp[VAR_0] = QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8);
src += srcstride;
tmp += MAX_PB_SIZE;
}
tmp = tmp_array + QPEL_EXTRA_BEFORE * MAX_PB_SIZE;
VAR_2 = ff_hevc_qpel_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(((QPEL_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_qpel_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;",
"const int8_t *VAR_2;",
"pixel *src = (pixel*)_src;",
"ptrdiff_t srcstride = _srcstride / sizeof(pixel);",
"pixel *dst = (pixel *)_dst;",
"ptrdiff_t dststride = _dststride / sizeof(pixel);",
"int16_t tmp_array[(MAX_PB_SIZE + QPEL_EXTRA) * MAX_PB_SIZE];",
"int16_t *tmp = tmp_array;",
"int VAR_3 = 14 + 1 - BIT_DEPTH;",
"int VAR_4 = denom + VAR_3 - 1;",
"src -= QPEL_EXTRA_BEFORE * srcstride;",
"VAR_2 = ff_hevc_qpel_filters[mx - 1];",
"for (VAR_1 = 0; VAR_1 < height + QPEL_EXTRA; VAR_1++) {",
"for (VAR_0 = 0; VAR_0 < width; VAR_0++)",
"tmp[VAR_0] = QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8);",
"src += srcstride;",
"tmp += MAX_PB_SIZE;",
"}",
"tmp = tmp_array + QPEL_EXTRA_BEFORE * MAX_PB_SIZE;",
"VAR_2 = ff_hevc_qpel_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(((QPEL_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,
0,
1,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5,
7,
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
51
],
[
53
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65,
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
]
] |
6,347 |
int bdrv_flush(BlockDriverState *bs)
{
Coroutine *co;
FlushCo flush_co = {
.bs = bs,
.ret = NOT_DONE,
};
if (qemu_in_coroutine()) {
/* Fast-path if already in coroutine context */
bdrv_flush_co_entry(&flush_co);
} else {
co = qemu_coroutine_create(bdrv_flush_co_entry, &flush_co);
qemu_coroutine_enter(co);
BDRV_POLL_WHILE(bs, flush_co.ret == NOT_DONE);
}
return flush_co.ret;
}
| true |
qemu
|
e92f0e1910f0655a0edd8d87c5a7262d36517a89
|
int bdrv_flush(BlockDriverState *bs)
{
Coroutine *co;
FlushCo flush_co = {
.bs = bs,
.ret = NOT_DONE,
};
if (qemu_in_coroutine()) {
bdrv_flush_co_entry(&flush_co);
} else {
co = qemu_coroutine_create(bdrv_flush_co_entry, &flush_co);
qemu_coroutine_enter(co);
BDRV_POLL_WHILE(bs, flush_co.ret == NOT_DONE);
}
return flush_co.ret;
}
|
{
"code": [
" qemu_coroutine_enter(co);",
" qemu_coroutine_enter(co);",
" qemu_coroutine_enter(co);",
" qemu_coroutine_enter(co);",
" qemu_coroutine_enter(co);",
" qemu_coroutine_enter(co);"
],
"line_no": [
27,
27,
27,
27,
27,
27
]
}
|
int FUNC_0(BlockDriverState *VAR_0)
{
Coroutine *co;
FlushCo flush_co = {
.VAR_0 = VAR_0,
.ret = NOT_DONE,
};
if (qemu_in_coroutine()) {
bdrv_flush_co_entry(&flush_co);
} else {
co = qemu_coroutine_create(bdrv_flush_co_entry, &flush_co);
qemu_coroutine_enter(co);
BDRV_POLL_WHILE(VAR_0, flush_co.ret == NOT_DONE);
}
return flush_co.ret;
}
|
[
"int FUNC_0(BlockDriverState *VAR_0)\n{",
"Coroutine *co;",
"FlushCo flush_co = {",
".VAR_0 = VAR_0,\n.ret = NOT_DONE,\n};",
"if (qemu_in_coroutine()) {",
"bdrv_flush_co_entry(&flush_co);",
"} else {",
"co = qemu_coroutine_create(bdrv_flush_co_entry, &flush_co);",
"qemu_coroutine_enter(co);",
"BDRV_POLL_WHILE(VAR_0, flush_co.ret == NOT_DONE);",
"}",
"return flush_co.ret;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9,
11,
13
],
[
17
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
35
],
[
37
]
] |
6,348 |
void scsi_req_complete(SCSIRequest *req)
{
assert(req->status != -1);
scsi_req_ref(req);
scsi_req_dequeue(req);
req->bus->ops->complete(req->bus, SCSI_REASON_DONE,
req->tag,
req->status);
scsi_req_unref(req);
}
| true |
qemu
|
5c6c0e513600ba57c3e73b7151d3c0664438f7b5
|
void scsi_req_complete(SCSIRequest *req)
{
assert(req->status != -1);
scsi_req_ref(req);
scsi_req_dequeue(req);
req->bus->ops->complete(req->bus, SCSI_REASON_DONE,
req->tag,
req->status);
scsi_req_unref(req);
}
|
{
"code": [
" req->bus->ops->complete(req->bus, SCSI_REASON_DONE,",
" req->tag,",
" req->status);"
],
"line_no": [
11,
13,
15
]
}
|
void FUNC_0(SCSIRequest *VAR_0)
{
assert(VAR_0->status != -1);
scsi_req_ref(VAR_0);
scsi_req_dequeue(VAR_0);
VAR_0->bus->ops->complete(VAR_0->bus, SCSI_REASON_DONE,
VAR_0->tag,
VAR_0->status);
scsi_req_unref(VAR_0);
}
|
[
"void FUNC_0(SCSIRequest *VAR_0)\n{",
"assert(VAR_0->status != -1);",
"scsi_req_ref(VAR_0);",
"scsi_req_dequeue(VAR_0);",
"VAR_0->bus->ops->complete(VAR_0->bus, SCSI_REASON_DONE,\nVAR_0->tag,\nVAR_0->status);",
"scsi_req_unref(VAR_0);",
"}"
] |
[
0,
0,
0,
0,
1,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11,
13,
15
],
[
17
],
[
19
]
] |
6,349 |
static void iv_Decode_Chunk(Indeo3DecodeContext *s,
uint8_t *cur, uint8_t *ref, int width, int height,
const uint8_t *buf1, long cb_offset, const uint8_t *hdr,
const uint8_t *buf2, int min_width_160)
{
uint8_t bit_buf;
unsigned long bit_pos, lv, lv1, lv2;
long *width_tbl, width_tbl_arr[10];
const signed char *ref_vectors;
uint8_t *cur_frm_pos, *ref_frm_pos, *cp, *cp2;
uint32_t *cur_lp, *ref_lp;
const uint32_t *correction_lp[2], *correctionloworder_lp[2], *correctionhighorder_lp[2];
uint8_t *correction_type_sp[2];
struct ustr strip_tbl[20], *strip;
int i, j, k, lp1, lp2, flag1, cmd, blks_width, blks_height, region_160_width,
rle_v1, rle_v2, rle_v3;
unsigned short res;
bit_buf = 0;
ref_vectors = NULL;
width_tbl = width_tbl_arr + 1;
i = (width < 0 ? width + 3 : width)/4;
for(j = -1; j < 8; j++)
width_tbl[j] = i * j;
strip = strip_tbl;
for(region_160_width = 0; region_160_width < (width - min_width_160); region_160_width += min_width_160);
strip->ypos = strip->xpos = 0;
for(strip->width = min_width_160; width > strip->width; strip->width *= 2);
strip->height = height;
strip->split_direction = 0;
strip->split_flag = 0;
strip->usl7 = 0;
bit_pos = 0;
rle_v1 = rle_v2 = rle_v3 = 0;
while(strip >= strip_tbl) {
if(bit_pos <= 0) {
bit_pos = 8;
bit_buf = *buf1++;
bit_pos -= 2;
cmd = (bit_buf >> bit_pos) & 0x03;
if(cmd == 0) {
strip++;
memcpy(strip, strip-1, sizeof(*strip));
strip->split_flag = 1;
strip->split_direction = 0;
strip->height = (strip->height > 8 ? ((strip->height+8)>>4)<<3 : 4);
continue;
} else if(cmd == 1) {
strip++;
memcpy(strip, strip-1, sizeof(*strip));
strip->split_flag = 1;
strip->split_direction = 1;
strip->width = (strip->width > 8 ? ((strip->width+8)>>4)<<3 : 4);
continue;
} else if(cmd == 2) {
if(strip->usl7 == 0) {
strip->usl7 = 1;
ref_vectors = NULL;
continue;
} else if(cmd == 3) {
if(strip->usl7 == 0) {
strip->usl7 = 1;
ref_vectors = (const signed char*)buf2 + (*buf1 * 2);
buf1++;
continue;
cur_frm_pos = cur + width * strip->ypos + strip->xpos;
if((blks_width = strip->width) < 0)
blks_width += 3;
blks_width >>= 2;
blks_height = strip->height;
if(ref_vectors != NULL) {
ref_frm_pos = ref + (ref_vectors[0] + strip->ypos) * width +
ref_vectors[1] + strip->xpos;
} else
ref_frm_pos = cur_frm_pos - width_tbl[4];
if(cmd == 2) {
if(bit_pos <= 0) {
bit_pos = 8;
bit_buf = *buf1++;
bit_pos -= 2;
cmd = (bit_buf >> bit_pos) & 0x03;
if(cmd == 0 || ref_vectors != NULL) {
for(lp1 = 0; lp1 < blks_width; lp1++) {
for(i = 0, j = 0; i < blks_height; i++, j += width_tbl[1])
((uint32_t *)cur_frm_pos)[j] = ((uint32_t *)ref_frm_pos)[j];
cur_frm_pos += 4;
ref_frm_pos += 4;
} else if(cmd != 1)
return;
} else {
k = *buf1 >> 4;
j = *buf1 & 0x0f;
buf1++;
lv = j + cb_offset;
if((lv - 8) <= 7 && (k == 0 || k == 3 || k == 10)) {
cp2 = s->ModPred + ((lv - 8) << 7);
cp = ref_frm_pos;
for(i = 0; i < blks_width << 2; i++) {
int v = *cp >> 1;
*(cp++) = cp2[v];
if(k == 1 || k == 4) {
lv = (hdr[j] & 0xf) + cb_offset;
correction_type_sp[0] = s->corrector_type + (lv << 8);
correction_lp[0] = correction + (lv << 8);
lv = (hdr[j] >> 4) + cb_offset;
correction_lp[1] = correction + (lv << 8);
correction_type_sp[1] = s->corrector_type + (lv << 8);
} else {
correctionloworder_lp[0] = correctionloworder_lp[1] = correctionloworder + (lv << 8);
correctionhighorder_lp[0] = correctionhighorder_lp[1] = correctionhighorder + (lv << 8);
correction_type_sp[0] = correction_type_sp[1] = s->corrector_type + (lv << 8);
correction_lp[0] = correction_lp[1] = correction + (lv << 8);
switch(k) {
case 1:
case 0: /********** CASE 0 **********/
for( ; blks_height > 0; blks_height -= 4) {
for(lp1 = 0; lp1 < blks_width; lp1++) {
for(lp2 = 0; lp2 < 4; ) {
k = *buf1++;
cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2];
ref_lp = ((uint32_t *)ref_frm_pos) + width_tbl[lp2];
switch(correction_type_sp[0][k]) {
case 0:
*cur_lp = le2me_32(((le2me_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
lp2++;
case 1:
res = ((le2me_16(((unsigned short *)(ref_lp))[0]) >> 1) + correction_lp[lp2 & 0x01][*buf1]) << 1;
((unsigned short *)cur_lp)[0] = le2me_16(res);
res = ((le2me_16(((unsigned short *)(ref_lp))[1]) >> 1) + correction_lp[lp2 & 0x01][k]) << 1;
((unsigned short *)cur_lp)[1] = le2me_16(res);
buf1++;
lp2++;
case 2:
if(lp2 == 0) {
for(i = 0, j = 0; i < 2; i++, j += width_tbl[1])
cur_lp[j] = ref_lp[j];
lp2 += 2;
case 3:
if(lp2 < 2) {
for(i = 0, j = 0; i < (3 - lp2); i++, j += width_tbl[1])
cur_lp[j] = ref_lp[j];
lp2 = 3;
case 8:
if(lp2 == 0) {
RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
if(rle_v1 == 1 || ref_vectors != NULL) {
for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
cur_lp[j] = ref_lp[j];
RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
} else {
rle_v1 = 1;
rle_v2 = *buf1 - 1;
case 5:
LP2_CHECK(buf1,rle_v3,lp2)
case 4:
for(i = 0, j = 0; i < (4 - lp2); i++, j += width_tbl[1])
cur_lp[j] = ref_lp[j];
lp2 = 4;
case 7:
if(rle_v3 != 0)
rle_v3 = 0;
else {
buf1--;
rle_v3 = 1;
case 6:
if(ref_vectors != NULL) {
for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
cur_lp[j] = ref_lp[j];
lp2 = 4;
case 9:
lv1 = *buf1++;
lv = (lv1 & 0x7F) << 1;
lv += (lv << 8);
lv += (lv << 16);
for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
cur_lp[j] = lv;
LV1_CHECK(buf1,rle_v3,lv1,lp2)
default:
return;
cur_frm_pos += 4;
ref_frm_pos += 4;
cur_frm_pos += ((width - blks_width) * 4);
ref_frm_pos += ((width - blks_width) * 4);
case 4:
case 3: /********** CASE 3 **********/
if(ref_vectors != NULL)
return;
flag1 = 1;
for( ; blks_height > 0; blks_height -= 8) {
for(lp1 = 0; lp1 < blks_width; lp1++) {
for(lp2 = 0; lp2 < 4; ) {
k = *buf1++;
cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2 * 2];
ref_lp = ((uint32_t *)cur_frm_pos) + width_tbl[(lp2 * 2) - 1];
switch(correction_type_sp[lp2 & 0x01][k]) {
case 0:
cur_lp[width_tbl[1]] = le2me_32(((le2me_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
if(lp2 > 0 || flag1 == 0 || strip->ypos != 0)
cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
else
cur_lp[0] = le2me_32(((le2me_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
lp2++;
case 1:
res = ((le2me_16(((unsigned short *)ref_lp)[0]) >> 1) + correction_lp[lp2 & 0x01][*buf1]) << 1;
((unsigned short *)cur_lp)[width_tbl[2]] = le2me_16(res);
res = ((le2me_16(((unsigned short *)ref_lp)[1]) >> 1) + correction_lp[lp2 & 0x01][k]) << 1;
((unsigned short *)cur_lp)[width_tbl[2]+1] = le2me_16(res);
if(lp2 > 0 || flag1 == 0 || strip->ypos != 0)
cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
else
cur_lp[0] = cur_lp[width_tbl[1]];
buf1++;
lp2++;
case 2:
if(lp2 == 0) {
for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
cur_lp[j] = *ref_lp;
lp2 += 2;
case 3:
if(lp2 < 2) {
for(i = 0, j = 0; i < 6 - (lp2 * 2); i++, j += width_tbl[1])
cur_lp[j] = *ref_lp;
lp2 = 3;
case 6:
lp2 = 4;
case 7:
if(rle_v3 != 0)
rle_v3 = 0;
else {
buf1--;
rle_v3 = 1;
lp2 = 4;
case 8:
if(lp2 == 0) {
RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
if(rle_v1 == 1) {
for(i = 0, j = 0; i < 8; i++, j += width_tbl[1])
cur_lp[j] = ref_lp[j];
RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
} else {
rle_v2 = (*buf1) - 1;
rle_v1 = 1;
case 5:
LP2_CHECK(buf1,rle_v3,lp2)
case 4:
for(i = 0, j = 0; i < 8 - (lp2 * 2); i++, j += width_tbl[1])
cur_lp[j] = *ref_lp;
lp2 = 4;
case 9:
av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
lv1 = *buf1++;
lv = (lv1 & 0x7F) << 1;
lv += (lv << 8);
lv += (lv << 16);
for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
cur_lp[j] = lv;
LV1_CHECK(buf1,rle_v3,lv1,lp2)
default:
return;
cur_frm_pos += 4;
cur_frm_pos += (((width * 2) - blks_width) * 4);
flag1 = 0;
case 10: /********** CASE 10 **********/
if(ref_vectors == NULL) {
flag1 = 1;
for( ; blks_height > 0; blks_height -= 8) {
for(lp1 = 0; lp1 < blks_width; lp1 += 2) {
for(lp2 = 0; lp2 < 4; ) {
k = *buf1++;
cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2 * 2];
ref_lp = ((uint32_t *)cur_frm_pos) + width_tbl[(lp2 * 2) - 1];
lv1 = ref_lp[0];
lv2 = ref_lp[1];
if(lp2 == 0 && flag1 != 0) {
#ifdef WORDS_BIGENDIAN
lv1 = lv1 & 0xFF00FF00;
lv1 = (lv1 >> 8) | lv1;
lv2 = lv2 & 0xFF00FF00;
lv2 = (lv2 >> 8) | lv2;
#else
lv1 = lv1 & 0x00FF00FF;
lv1 = (lv1 << 8) | lv1;
lv2 = lv2 & 0x00FF00FF;
lv2 = (lv2 << 8) | lv2;
#endif
switch(correction_type_sp[lp2 & 0x01][k]) {
case 0:
cur_lp[width_tbl[1]] = le2me_32(((le2me_32(lv1) >> 1) + correctionloworder_lp[lp2 & 0x01][k]) << 1);
cur_lp[width_tbl[1]+1] = le2me_32(((le2me_32(lv2) >> 1) + correctionhighorder_lp[lp2 & 0x01][k]) << 1);
if(lp2 > 0 || strip->ypos != 0 || flag1 == 0) {
cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
} else {
cur_lp[0] = cur_lp[width_tbl[1]];
cur_lp[1] = cur_lp[width_tbl[1]+1];
lp2++;
case 1:
cur_lp[width_tbl[1]] = le2me_32(((le2me_32(lv1) >> 1) + correctionloworder_lp[lp2 & 0x01][*buf1]) << 1);
cur_lp[width_tbl[1]+1] = le2me_32(((le2me_32(lv2) >> 1) + correctionloworder_lp[lp2 & 0x01][k]) << 1);
if(lp2 > 0 || strip->ypos != 0 || flag1 == 0) {
cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
} else {
cur_lp[0] = cur_lp[width_tbl[1]];
cur_lp[1] = cur_lp[width_tbl[1]+1];
buf1++;
lp2++;
case 2:
if(lp2 == 0) {
if(flag1 != 0) {
for(i = 0, j = width_tbl[1]; i < 3; i++, j += width_tbl[1]) {
cur_lp[j] = lv1;
cur_lp[j+1] = lv2;
cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
} else {
for(i = 0, j = 0; i < 4; i++, j += width_tbl[1]) {
cur_lp[j] = lv1;
cur_lp[j+1] = lv2;
lp2 += 2;
case 3:
if(lp2 < 2) {
if(lp2 == 0 && flag1 != 0) {
for(i = 0, j = width_tbl[1]; i < 5; i++, j += width_tbl[1]) {
cur_lp[j] = lv1;
cur_lp[j+1] = lv2;
cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
} else {
for(i = 0, j = 0; i < 6 - (lp2 * 2); i++, j += width_tbl[1]) {
cur_lp[j] = lv1;
cur_lp[j+1] = lv2;
lp2 = 3;
case 8:
if(lp2 == 0) {
RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
if(rle_v1 == 1) {
if(flag1 != 0) {
for(i = 0, j = width_tbl[1]; i < 7; i++, j += width_tbl[1]) {
cur_lp[j] = lv1;
cur_lp[j+1] = lv2;
cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
} else {
for(i = 0, j = 0; i < 8; i++, j += width_tbl[1]) {
cur_lp[j] = lv1;
cur_lp[j+1] = lv2;
RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
} else {
rle_v1 = 1;
rle_v2 = (*buf1) - 1;
case 5:
LP2_CHECK(buf1,rle_v3,lp2)
case 4:
if(lp2 == 0 && flag1 != 0) {
for(i = 0, j = width_tbl[1]; i < 7; i++, j += width_tbl[1]) {
cur_lp[j] = lv1;
cur_lp[j+1] = lv2;
cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
} else {
for(i = 0, j = 0; i < 8 - (lp2 * 2); i++, j += width_tbl[1]) {
cur_lp[j] = lv1;
cur_lp[j+1] = lv2;
lp2 = 4;
case 6:
lp2 = 4;
case 7:
if(lp2 == 0) {
if(rle_v3 != 0)
rle_v3 = 0;
else {
buf1--;
rle_v3 = 1;
lp2 = 4;
case 9:
av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
lv1 = *buf1;
lv = (lv1 & 0x7F) << 1;
lv += (lv << 8);
lv += (lv << 16);
for(i = 0, j = 0; i < 8; i++, j += width_tbl[1])
cur_lp[j] = lv;
LV1_CHECK(buf1,rle_v3,lv1,lp2)
default:
return;
cur_frm_pos += 8;
cur_frm_pos += (((width * 2) - blks_width) * 4);
flag1 = 0;
} else {
for( ; blks_height > 0; blks_height -= 8) {
for(lp1 = 0; lp1 < blks_width; lp1 += 2) {
for(lp2 = 0; lp2 < 4; ) {
k = *buf1++;
cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2 * 2];
ref_lp = ((uint32_t *)ref_frm_pos) + width_tbl[lp2 * 2];
switch(correction_type_sp[lp2 & 0x01][k]) {
case 0:
lv1 = correctionloworder_lp[lp2 & 0x01][k];
lv2 = correctionhighorder_lp[lp2 & 0x01][k];
cur_lp[0] = le2me_32(((le2me_32(ref_lp[0]) >> 1) + lv1) << 1);
cur_lp[1] = le2me_32(((le2me_32(ref_lp[1]) >> 1) + lv2) << 1);
cur_lp[width_tbl[1]] = le2me_32(((le2me_32(ref_lp[width_tbl[1]]) >> 1) + lv1) << 1);
cur_lp[width_tbl[1]+1] = le2me_32(((le2me_32(ref_lp[width_tbl[1]+1]) >> 1) + lv2) << 1);
lp2++;
case 1:
lv1 = correctionloworder_lp[lp2 & 0x01][*buf1++];
lv2 = correctionloworder_lp[lp2 & 0x01][k];
cur_lp[0] = le2me_32(((le2me_32(ref_lp[0]) >> 1) + lv1) << 1);
cur_lp[1] = le2me_32(((le2me_32(ref_lp[1]) >> 1) + lv2) << 1);
cur_lp[width_tbl[1]] = le2me_32(((le2me_32(ref_lp[width_tbl[1]]) >> 1) + lv1) << 1);
cur_lp[width_tbl[1]+1] = le2me_32(((le2me_32(ref_lp[width_tbl[1]+1]) >> 1) + lv2) << 1);
lp2++;
case 2:
if(lp2 == 0) {
for(i = 0, j = 0; i < 4; i++, j += width_tbl[1]) {
cur_lp[j] = ref_lp[j];
cur_lp[j+1] = ref_lp[j+1];
lp2 += 2;
case 3:
if(lp2 < 2) {
for(i = 0, j = 0; i < 6 - (lp2 * 2); i++, j += width_tbl[1]) {
cur_lp[j] = ref_lp[j];
cur_lp[j+1] = ref_lp[j+1];
lp2 = 3;
case 8:
if(lp2 == 0) {
RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
for(i = 0, j = 0; i < 8; i++, j += width_tbl[1]) {
((uint32_t *)cur_frm_pos)[j] = ((uint32_t *)ref_frm_pos)[j];
((uint32_t *)cur_frm_pos)[j+1] = ((uint32_t *)ref_frm_pos)[j+1];
RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
} else {
rle_v1 = 1;
rle_v2 = (*buf1) - 1;
case 5:
case 7:
LP2_CHECK(buf1,rle_v3,lp2)
case 6:
case 4:
for(i = 0, j = 0; i < 8 - (lp2 * 2); i++, j += width_tbl[1]) {
cur_lp[j] = ref_lp[j];
cur_lp[j+1] = ref_lp[j+1];
lp2 = 4;
case 9:
av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
lv1 = *buf1;
lv = (lv1 & 0x7F) << 1;
lv += (lv << 8);
lv += (lv << 16);
for(i = 0, j = 0; i < 8; i++, j += width_tbl[1])
((uint32_t *)cur_frm_pos)[j] = ((uint32_t *)cur_frm_pos)[j+1] = lv;
LV1_CHECK(buf1,rle_v3,lv1,lp2)
default:
return;
cur_frm_pos += 8;
ref_frm_pos += 8;
cur_frm_pos += (((width * 2) - blks_width) * 4);
ref_frm_pos += (((width * 2) - blks_width) * 4);
case 11: /********** CASE 11 **********/
if(ref_vectors == NULL)
return;
for( ; blks_height > 0; blks_height -= 8) {
for(lp1 = 0; lp1 < blks_width; lp1++) {
for(lp2 = 0; lp2 < 4; ) {
k = *buf1++;
cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2 * 2];
ref_lp = ((uint32_t *)ref_frm_pos) + width_tbl[lp2 * 2];
switch(correction_type_sp[lp2 & 0x01][k]) {
case 0:
cur_lp[0] = le2me_32(((le2me_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
cur_lp[width_tbl[1]] = le2me_32(((le2me_32(ref_lp[width_tbl[1]]) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
lp2++;
case 1:
lv1 = (unsigned short)(correction_lp[lp2 & 0x01][*buf1++]);
lv2 = (unsigned short)(correction_lp[lp2 & 0x01][k]);
res = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[0]) >> 1) + lv1) << 1);
((unsigned short *)cur_lp)[0] = le2me_16(res);
res = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[1]) >> 1) + lv2) << 1);
((unsigned short *)cur_lp)[1] = le2me_16(res);
res = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[width_tbl[2]]) >> 1) + lv1) << 1);
((unsigned short *)cur_lp)[width_tbl[2]] = le2me_16(res);
res = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[width_tbl[2]+1]) >> 1) + lv2) << 1);
((unsigned short *)cur_lp)[width_tbl[2]+1] = le2me_16(res);
lp2++;
case 2:
if(lp2 == 0) {
for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
cur_lp[j] = ref_lp[j];
lp2 += 2;
case 3:
if(lp2 < 2) {
for(i = 0, j = 0; i < 6 - (lp2 * 2); i++, j += width_tbl[1])
cur_lp[j] = ref_lp[j];
lp2 = 3;
case 8:
if(lp2 == 0) {
RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
for(i = 0, j = 0; i < 8; i++, j += width_tbl[1])
cur_lp[j] = ref_lp[j];
RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
} else {
rle_v1 = 1;
rle_v2 = (*buf1) - 1;
case 5:
case 7:
LP2_CHECK(buf1,rle_v3,lp2)
case 4:
case 6:
for(i = 0, j = 0; i < 8 - (lp2 * 2); i++, j += width_tbl[1])
cur_lp[j] = ref_lp[j];
lp2 = 4;
case 9:
av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
lv1 = *buf1++;
lv = (lv1 & 0x7F) << 1;
lv += (lv << 8);
lv += (lv << 16);
for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
cur_lp[j] = lv;
LV1_CHECK(buf1,rle_v3,lv1,lp2)
default:
return;
cur_frm_pos += 4;
ref_frm_pos += 4;
cur_frm_pos += (((width * 2) - blks_width) * 4);
ref_frm_pos += (((width * 2) - blks_width) * 4);
default:
return;
if(strip < strip_tbl)
return;
for( ; strip >= strip_tbl; strip--) {
if(strip->split_flag != 0) {
strip->split_flag = 0;
strip->usl7 = (strip-1)->usl7;
if(strip->split_direction) {
strip->xpos += strip->width;
strip->width = (strip-1)->width - strip->width;
if(region_160_width <= strip->xpos && width < strip->width + strip->xpos)
strip->width = width - strip->xpos;
} else {
strip->ypos += strip->height;
strip->height = (strip-1)->height - strip->height;
| true |
FFmpeg
|
a44cb89b0f53d55dd1814138ba6526ecaf985f12
|
static void iv_Decode_Chunk(Indeo3DecodeContext *s,
uint8_t *cur, uint8_t *ref, int width, int height,
const uint8_t *buf1, long cb_offset, const uint8_t *hdr,
const uint8_t *buf2, int min_width_160)
{
uint8_t bit_buf;
unsigned long bit_pos, lv, lv1, lv2;
long *width_tbl, width_tbl_arr[10];
const signed char *ref_vectors;
uint8_t *cur_frm_pos, *ref_frm_pos, *cp, *cp2;
uint32_t *cur_lp, *ref_lp;
const uint32_t *correction_lp[2], *correctionloworder_lp[2], *correctionhighorder_lp[2];
uint8_t *correction_type_sp[2];
struct ustr strip_tbl[20], *strip;
int i, j, k, lp1, lp2, flag1, cmd, blks_width, blks_height, region_160_width,
rle_v1, rle_v2, rle_v3;
unsigned short res;
bit_buf = 0;
ref_vectors = NULL;
width_tbl = width_tbl_arr + 1;
i = (width < 0 ? width + 3 : width)/4;
for(j = -1; j < 8; j++)
width_tbl[j] = i * j;
strip = strip_tbl;
for(region_160_width = 0; region_160_width < (width - min_width_160); region_160_width += min_width_160);
strip->ypos = strip->xpos = 0;
for(strip->width = min_width_160; width > strip->width; strip->width *= 2);
strip->height = height;
strip->split_direction = 0;
strip->split_flag = 0;
strip->usl7 = 0;
bit_pos = 0;
rle_v1 = rle_v2 = rle_v3 = 0;
while(strip >= strip_tbl) {
if(bit_pos <= 0) {
bit_pos = 8;
bit_buf = *buf1++;
bit_pos -= 2;
cmd = (bit_buf >> bit_pos) & 0x03;
if(cmd == 0) {
strip++;
memcpy(strip, strip-1, sizeof(*strip));
strip->split_flag = 1;
strip->split_direction = 0;
strip->height = (strip->height > 8 ? ((strip->height+8)>>4)<<3 : 4);
continue;
} else if(cmd == 1) {
strip++;
memcpy(strip, strip-1, sizeof(*strip));
strip->split_flag = 1;
strip->split_direction = 1;
strip->width = (strip->width > 8 ? ((strip->width+8)>>4)<<3 : 4);
continue;
} else if(cmd == 2) {
if(strip->usl7 == 0) {
strip->usl7 = 1;
ref_vectors = NULL;
continue;
} else if(cmd == 3) {
if(strip->usl7 == 0) {
strip->usl7 = 1;
ref_vectors = (const signed char*)buf2 + (*buf1 * 2);
buf1++;
continue;
cur_frm_pos = cur + width * strip->ypos + strip->xpos;
if((blks_width = strip->width) < 0)
blks_width += 3;
blks_width >>= 2;
blks_height = strip->height;
if(ref_vectors != NULL) {
ref_frm_pos = ref + (ref_vectors[0] + strip->ypos) * width +
ref_vectors[1] + strip->xpos;
} else
ref_frm_pos = cur_frm_pos - width_tbl[4];
if(cmd == 2) {
if(bit_pos <= 0) {
bit_pos = 8;
bit_buf = *buf1++;
bit_pos -= 2;
cmd = (bit_buf >> bit_pos) & 0x03;
if(cmd == 0 || ref_vectors != NULL) {
for(lp1 = 0; lp1 < blks_width; lp1++) {
for(i = 0, j = 0; i < blks_height; i++, j += width_tbl[1])
((uint32_t *)cur_frm_pos)[j] = ((uint32_t *)ref_frm_pos)[j];
cur_frm_pos += 4;
ref_frm_pos += 4;
} else if(cmd != 1)
return;
} else {
k = *buf1 >> 4;
j = *buf1 & 0x0f;
buf1++;
lv = j + cb_offset;
if((lv - 8) <= 7 && (k == 0 || k == 3 || k == 10)) {
cp2 = s->ModPred + ((lv - 8) << 7);
cp = ref_frm_pos;
for(i = 0; i < blks_width << 2; i++) {
int v = *cp >> 1;
*(cp++) = cp2[v];
if(k == 1 || k == 4) {
lv = (hdr[j] & 0xf) + cb_offset;
correction_type_sp[0] = s->corrector_type + (lv << 8);
correction_lp[0] = correction + (lv << 8);
lv = (hdr[j] >> 4) + cb_offset;
correction_lp[1] = correction + (lv << 8);
correction_type_sp[1] = s->corrector_type + (lv << 8);
} else {
correctionloworder_lp[0] = correctionloworder_lp[1] = correctionloworder + (lv << 8);
correctionhighorder_lp[0] = correctionhighorder_lp[1] = correctionhighorder + (lv << 8);
correction_type_sp[0] = correction_type_sp[1] = s->corrector_type + (lv << 8);
correction_lp[0] = correction_lp[1] = correction + (lv << 8);
switch(k) {
case 1:
case 0:
for( ; blks_height > 0; blks_height -= 4) {
for(lp1 = 0; lp1 < blks_width; lp1++) {
for(lp2 = 0; lp2 < 4; ) {
k = *buf1++;
cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2];
ref_lp = ((uint32_t *)ref_frm_pos) + width_tbl[lp2];
switch(correction_type_sp[0][k]) {
case 0:
*cur_lp = le2me_32(((le2me_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
lp2++;
case 1:
res = ((le2me_16(((unsigned short *)(ref_lp))[0]) >> 1) + correction_lp[lp2 & 0x01][*buf1]) << 1;
((unsigned short *)cur_lp)[0] = le2me_16(res);
res = ((le2me_16(((unsigned short *)(ref_lp))[1]) >> 1) + correction_lp[lp2 & 0x01][k]) << 1;
((unsigned short *)cur_lp)[1] = le2me_16(res);
buf1++;
lp2++;
case 2:
if(lp2 == 0) {
for(i = 0, j = 0; i < 2; i++, j += width_tbl[1])
cur_lp[j] = ref_lp[j];
lp2 += 2;
case 3:
if(lp2 < 2) {
for(i = 0, j = 0; i < (3 - lp2); i++, j += width_tbl[1])
cur_lp[j] = ref_lp[j];
lp2 = 3;
case 8:
if(lp2 == 0) {
RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
if(rle_v1 == 1 || ref_vectors != NULL) {
for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
cur_lp[j] = ref_lp[j];
RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
} else {
rle_v1 = 1;
rle_v2 = *buf1 - 1;
case 5:
LP2_CHECK(buf1,rle_v3,lp2)
case 4:
for(i = 0, j = 0; i < (4 - lp2); i++, j += width_tbl[1])
cur_lp[j] = ref_lp[j];
lp2 = 4;
case 7:
if(rle_v3 != 0)
rle_v3 = 0;
else {
buf1--;
rle_v3 = 1;
case 6:
if(ref_vectors != NULL) {
for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
cur_lp[j] = ref_lp[j];
lp2 = 4;
case 9:
lv1 = *buf1++;
lv = (lv1 & 0x7F) << 1;
lv += (lv << 8);
lv += (lv << 16);
for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
cur_lp[j] = lv;
LV1_CHECK(buf1,rle_v3,lv1,lp2)
default:
return;
cur_frm_pos += 4;
ref_frm_pos += 4;
cur_frm_pos += ((width - blks_width) * 4);
ref_frm_pos += ((width - blks_width) * 4);
case 4:
case 3:
if(ref_vectors != NULL)
return;
flag1 = 1;
for( ; blks_height > 0; blks_height -= 8) {
for(lp1 = 0; lp1 < blks_width; lp1++) {
for(lp2 = 0; lp2 < 4; ) {
k = *buf1++;
cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2 * 2];
ref_lp = ((uint32_t *)cur_frm_pos) + width_tbl[(lp2 * 2) - 1];
switch(correction_type_sp[lp2 & 0x01][k]) {
case 0:
cur_lp[width_tbl[1]] = le2me_32(((le2me_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
if(lp2 > 0 || flag1 == 0 || strip->ypos != 0)
cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
else
cur_lp[0] = le2me_32(((le2me_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
lp2++;
case 1:
res = ((le2me_16(((unsigned short *)ref_lp)[0]) >> 1) + correction_lp[lp2 & 0x01][*buf1]) << 1;
((unsigned short *)cur_lp)[width_tbl[2]] = le2me_16(res);
res = ((le2me_16(((unsigned short *)ref_lp)[1]) >> 1) + correction_lp[lp2 & 0x01][k]) << 1;
((unsigned short *)cur_lp)[width_tbl[2]+1] = le2me_16(res);
if(lp2 > 0 || flag1 == 0 || strip->ypos != 0)
cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
else
cur_lp[0] = cur_lp[width_tbl[1]];
buf1++;
lp2++;
case 2:
if(lp2 == 0) {
for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
cur_lp[j] = *ref_lp;
lp2 += 2;
case 3:
if(lp2 < 2) {
for(i = 0, j = 0; i < 6 - (lp2 * 2); i++, j += width_tbl[1])
cur_lp[j] = *ref_lp;
lp2 = 3;
case 6:
lp2 = 4;
case 7:
if(rle_v3 != 0)
rle_v3 = 0;
else {
buf1--;
rle_v3 = 1;
lp2 = 4;
case 8:
if(lp2 == 0) {
RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
if(rle_v1 == 1) {
for(i = 0, j = 0; i < 8; i++, j += width_tbl[1])
cur_lp[j] = ref_lp[j];
RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
} else {
rle_v2 = (*buf1) - 1;
rle_v1 = 1;
case 5:
LP2_CHECK(buf1,rle_v3,lp2)
case 4:
for(i = 0, j = 0; i < 8 - (lp2 * 2); i++, j += width_tbl[1])
cur_lp[j] = *ref_lp;
lp2 = 4;
case 9:
av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
lv1 = *buf1++;
lv = (lv1 & 0x7F) << 1;
lv += (lv << 8);
lv += (lv << 16);
for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
cur_lp[j] = lv;
LV1_CHECK(buf1,rle_v3,lv1,lp2)
default:
return;
cur_frm_pos += 4;
cur_frm_pos += (((width * 2) - blks_width) * 4);
flag1 = 0;
case 10:
if(ref_vectors == NULL) {
flag1 = 1;
for( ; blks_height > 0; blks_height -= 8) {
for(lp1 = 0; lp1 < blks_width; lp1 += 2) {
for(lp2 = 0; lp2 < 4; ) {
k = *buf1++;
cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2 * 2];
ref_lp = ((uint32_t *)cur_frm_pos) + width_tbl[(lp2 * 2) - 1];
lv1 = ref_lp[0];
lv2 = ref_lp[1];
if(lp2 == 0 && flag1 != 0) {
#ifdef WORDS_BIGENDIAN
lv1 = lv1 & 0xFF00FF00;
lv1 = (lv1 >> 8) | lv1;
lv2 = lv2 & 0xFF00FF00;
lv2 = (lv2 >> 8) | lv2;
#else
lv1 = lv1 & 0x00FF00FF;
lv1 = (lv1 << 8) | lv1;
lv2 = lv2 & 0x00FF00FF;
lv2 = (lv2 << 8) | lv2;
#endif
switch(correction_type_sp[lp2 & 0x01][k]) {
case 0:
cur_lp[width_tbl[1]] = le2me_32(((le2me_32(lv1) >> 1) + correctionloworder_lp[lp2 & 0x01][k]) << 1);
cur_lp[width_tbl[1]+1] = le2me_32(((le2me_32(lv2) >> 1) + correctionhighorder_lp[lp2 & 0x01][k]) << 1);
if(lp2 > 0 || strip->ypos != 0 || flag1 == 0) {
cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
} else {
cur_lp[0] = cur_lp[width_tbl[1]];
cur_lp[1] = cur_lp[width_tbl[1]+1];
lp2++;
case 1:
cur_lp[width_tbl[1]] = le2me_32(((le2me_32(lv1) >> 1) + correctionloworder_lp[lp2 & 0x01][*buf1]) << 1);
cur_lp[width_tbl[1]+1] = le2me_32(((le2me_32(lv2) >> 1) + correctionloworder_lp[lp2 & 0x01][k]) << 1);
if(lp2 > 0 || strip->ypos != 0 || flag1 == 0) {
cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
} else {
cur_lp[0] = cur_lp[width_tbl[1]];
cur_lp[1] = cur_lp[width_tbl[1]+1];
buf1++;
lp2++;
case 2:
if(lp2 == 0) {
if(flag1 != 0) {
for(i = 0, j = width_tbl[1]; i < 3; i++, j += width_tbl[1]) {
cur_lp[j] = lv1;
cur_lp[j+1] = lv2;
cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
} else {
for(i = 0, j = 0; i < 4; i++, j += width_tbl[1]) {
cur_lp[j] = lv1;
cur_lp[j+1] = lv2;
lp2 += 2;
case 3:
if(lp2 < 2) {
if(lp2 == 0 && flag1 != 0) {
for(i = 0, j = width_tbl[1]; i < 5; i++, j += width_tbl[1]) {
cur_lp[j] = lv1;
cur_lp[j+1] = lv2;
cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
} else {
for(i = 0, j = 0; i < 6 - (lp2 * 2); i++, j += width_tbl[1]) {
cur_lp[j] = lv1;
cur_lp[j+1] = lv2;
lp2 = 3;
case 8:
if(lp2 == 0) {
RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
if(rle_v1 == 1) {
if(flag1 != 0) {
for(i = 0, j = width_tbl[1]; i < 7; i++, j += width_tbl[1]) {
cur_lp[j] = lv1;
cur_lp[j+1] = lv2;
cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
} else {
for(i = 0, j = 0; i < 8; i++, j += width_tbl[1]) {
cur_lp[j] = lv1;
cur_lp[j+1] = lv2;
RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
} else {
rle_v1 = 1;
rle_v2 = (*buf1) - 1;
case 5:
LP2_CHECK(buf1,rle_v3,lp2)
case 4:
if(lp2 == 0 && flag1 != 0) {
for(i = 0, j = width_tbl[1]; i < 7; i++, j += width_tbl[1]) {
cur_lp[j] = lv1;
cur_lp[j+1] = lv2;
cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
} else {
for(i = 0, j = 0; i < 8 - (lp2 * 2); i++, j += width_tbl[1]) {
cur_lp[j] = lv1;
cur_lp[j+1] = lv2;
lp2 = 4;
case 6:
lp2 = 4;
case 7:
if(lp2 == 0) {
if(rle_v3 != 0)
rle_v3 = 0;
else {
buf1--;
rle_v3 = 1;
lp2 = 4;
case 9:
av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
lv1 = *buf1;
lv = (lv1 & 0x7F) << 1;
lv += (lv << 8);
lv += (lv << 16);
for(i = 0, j = 0; i < 8; i++, j += width_tbl[1])
cur_lp[j] = lv;
LV1_CHECK(buf1,rle_v3,lv1,lp2)
default:
return;
cur_frm_pos += 8;
cur_frm_pos += (((width * 2) - blks_width) * 4);
flag1 = 0;
} else {
for( ; blks_height > 0; blks_height -= 8) {
for(lp1 = 0; lp1 < blks_width; lp1 += 2) {
for(lp2 = 0; lp2 < 4; ) {
k = *buf1++;
cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2 * 2];
ref_lp = ((uint32_t *)ref_frm_pos) + width_tbl[lp2 * 2];
switch(correction_type_sp[lp2 & 0x01][k]) {
case 0:
lv1 = correctionloworder_lp[lp2 & 0x01][k];
lv2 = correctionhighorder_lp[lp2 & 0x01][k];
cur_lp[0] = le2me_32(((le2me_32(ref_lp[0]) >> 1) + lv1) << 1);
cur_lp[1] = le2me_32(((le2me_32(ref_lp[1]) >> 1) + lv2) << 1);
cur_lp[width_tbl[1]] = le2me_32(((le2me_32(ref_lp[width_tbl[1]]) >> 1) + lv1) << 1);
cur_lp[width_tbl[1]+1] = le2me_32(((le2me_32(ref_lp[width_tbl[1]+1]) >> 1) + lv2) << 1);
lp2++;
case 1:
lv1 = correctionloworder_lp[lp2 & 0x01][*buf1++];
lv2 = correctionloworder_lp[lp2 & 0x01][k];
cur_lp[0] = le2me_32(((le2me_32(ref_lp[0]) >> 1) + lv1) << 1);
cur_lp[1] = le2me_32(((le2me_32(ref_lp[1]) >> 1) + lv2) << 1);
cur_lp[width_tbl[1]] = le2me_32(((le2me_32(ref_lp[width_tbl[1]]) >> 1) + lv1) << 1);
cur_lp[width_tbl[1]+1] = le2me_32(((le2me_32(ref_lp[width_tbl[1]+1]) >> 1) + lv2) << 1);
lp2++;
case 2:
if(lp2 == 0) {
for(i = 0, j = 0; i < 4; i++, j += width_tbl[1]) {
cur_lp[j] = ref_lp[j];
cur_lp[j+1] = ref_lp[j+1];
lp2 += 2;
case 3:
if(lp2 < 2) {
for(i = 0, j = 0; i < 6 - (lp2 * 2); i++, j += width_tbl[1]) {
cur_lp[j] = ref_lp[j];
cur_lp[j+1] = ref_lp[j+1];
lp2 = 3;
case 8:
if(lp2 == 0) {
RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
for(i = 0, j = 0; i < 8; i++, j += width_tbl[1]) {
((uint32_t *)cur_frm_pos)[j] = ((uint32_t *)ref_frm_pos)[j];
((uint32_t *)cur_frm_pos)[j+1] = ((uint32_t *)ref_frm_pos)[j+1];
RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
} else {
rle_v1 = 1;
rle_v2 = (*buf1) - 1;
case 5:
case 7:
LP2_CHECK(buf1,rle_v3,lp2)
case 6:
case 4:
for(i = 0, j = 0; i < 8 - (lp2 * 2); i++, j += width_tbl[1]) {
cur_lp[j] = ref_lp[j];
cur_lp[j+1] = ref_lp[j+1];
lp2 = 4;
case 9:
av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
lv1 = *buf1;
lv = (lv1 & 0x7F) << 1;
lv += (lv << 8);
lv += (lv << 16);
for(i = 0, j = 0; i < 8; i++, j += width_tbl[1])
((uint32_t *)cur_frm_pos)[j] = ((uint32_t *)cur_frm_pos)[j+1] = lv;
LV1_CHECK(buf1,rle_v3,lv1,lp2)
default:
return;
cur_frm_pos += 8;
ref_frm_pos += 8;
cur_frm_pos += (((width * 2) - blks_width) * 4);
ref_frm_pos += (((width * 2) - blks_width) * 4);
case 11:
if(ref_vectors == NULL)
return;
for( ; blks_height > 0; blks_height -= 8) {
for(lp1 = 0; lp1 < blks_width; lp1++) {
for(lp2 = 0; lp2 < 4; ) {
k = *buf1++;
cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2 * 2];
ref_lp = ((uint32_t *)ref_frm_pos) + width_tbl[lp2 * 2];
switch(correction_type_sp[lp2 & 0x01][k]) {
case 0:
cur_lp[0] = le2me_32(((le2me_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
cur_lp[width_tbl[1]] = le2me_32(((le2me_32(ref_lp[width_tbl[1]]) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
lp2++;
case 1:
lv1 = (unsigned short)(correction_lp[lp2 & 0x01][*buf1++]);
lv2 = (unsigned short)(correction_lp[lp2 & 0x01][k]);
res = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[0]) >> 1) + lv1) << 1);
((unsigned short *)cur_lp)[0] = le2me_16(res);
res = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[1]) >> 1) + lv2) << 1);
((unsigned short *)cur_lp)[1] = le2me_16(res);
res = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[width_tbl[2]]) >> 1) + lv1) << 1);
((unsigned short *)cur_lp)[width_tbl[2]] = le2me_16(res);
res = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[width_tbl[2]+1]) >> 1) + lv2) << 1);
((unsigned short *)cur_lp)[width_tbl[2]+1] = le2me_16(res);
lp2++;
case 2:
if(lp2 == 0) {
for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
cur_lp[j] = ref_lp[j];
lp2 += 2;
case 3:
if(lp2 < 2) {
for(i = 0, j = 0; i < 6 - (lp2 * 2); i++, j += width_tbl[1])
cur_lp[j] = ref_lp[j];
lp2 = 3;
case 8:
if(lp2 == 0) {
RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
for(i = 0, j = 0; i < 8; i++, j += width_tbl[1])
cur_lp[j] = ref_lp[j];
RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
} else {
rle_v1 = 1;
rle_v2 = (*buf1) - 1;
case 5:
case 7:
LP2_CHECK(buf1,rle_v3,lp2)
case 4:
case 6:
for(i = 0, j = 0; i < 8 - (lp2 * 2); i++, j += width_tbl[1])
cur_lp[j] = ref_lp[j];
lp2 = 4;
case 9:
av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
lv1 = *buf1++;
lv = (lv1 & 0x7F) << 1;
lv += (lv << 8);
lv += (lv << 16);
for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
cur_lp[j] = lv;
LV1_CHECK(buf1,rle_v3,lv1,lp2)
default:
return;
cur_frm_pos += 4;
ref_frm_pos += 4;
cur_frm_pos += (((width * 2) - blks_width) * 4);
ref_frm_pos += (((width * 2) - blks_width) * 4);
default:
return;
if(strip < strip_tbl)
return;
for( ; strip >= strip_tbl; strip--) {
if(strip->split_flag != 0) {
strip->split_flag = 0;
strip->usl7 = (strip-1)->usl7;
if(strip->split_direction) {
strip->xpos += strip->width;
strip->width = (strip-1)->width - strip->width;
if(region_160_width <= strip->xpos && width < strip->width + strip->xpos)
strip->width = width - strip->xpos;
} else {
strip->ypos += strip->height;
strip->height = (strip-1)->height - strip->height;
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(Indeo3DecodeContext *VAR_0,
uint8_t *VAR_1, uint8_t *VAR_2, int VAR_3, int VAR_4,
const uint8_t *VAR_5, long VAR_6, const uint8_t *VAR_7,
const uint8_t *VAR_8, int VAR_9)
{
uint8_t bit_buf;
unsigned long VAR_10, VAR_11, VAR_12, VAR_13;
long *VAR_14, VAR_15[10];
const signed char *VAR_16;
uint8_t *cur_frm_pos, *ref_frm_pos, *cp, *cp2;
uint32_t *cur_lp, *ref_lp;
const uint32_t *VAR_17[2], *correctionloworder_lp[2], *correctionhighorder_lp[2];
uint8_t *correction_type_sp[2];
struct ustr VAR_18[20], *strip;
int VAR_19, VAR_20, VAR_21, VAR_22, VAR_23, VAR_24, VAR_25, VAR_26, VAR_27, VAR_28,
VAR_29, VAR_30, VAR_31;
unsigned short VAR_32;
bit_buf = 0;
VAR_16 = NULL;
VAR_14 = VAR_15 + 1;
VAR_19 = (VAR_3 < 0 ? VAR_3 + 3 : VAR_3)/4;
for(VAR_20 = -1; VAR_20 < 8; VAR_20++)
VAR_14[VAR_20] = VAR_19 * VAR_20;
strip = VAR_18;
for(VAR_28 = 0; VAR_28 < (VAR_3 - VAR_9); VAR_28 += VAR_9);
strip->ypos = strip->xpos = 0;
for(strip->VAR_3 = VAR_9; VAR_3 > strip->VAR_3; strip->VAR_3 *= 2);
strip->VAR_4 = VAR_4;
strip->split_direction = 0;
strip->split_flag = 0;
strip->usl7 = 0;
VAR_10 = 0;
VAR_29 = VAR_30 = VAR_31 = 0;
while(strip >= VAR_18) {
if(VAR_10 <= 0) {
VAR_10 = 8;
bit_buf = *VAR_5++;
VAR_10 -= 2;
VAR_25 = (bit_buf >> VAR_10) & 0x03;
if(VAR_25 == 0) {
strip++;
memcpy(strip, strip-1, sizeof(*strip));
strip->split_flag = 1;
strip->split_direction = 0;
strip->VAR_4 = (strip->VAR_4 > 8 ? ((strip->VAR_4+8)>>4)<<3 : 4);
continue;
} else if(VAR_25 == 1) {
strip++;
memcpy(strip, strip-1, sizeof(*strip));
strip->split_flag = 1;
strip->split_direction = 1;
strip->VAR_3 = (strip->VAR_3 > 8 ? ((strip->VAR_3+8)>>4)<<3 : 4);
continue;
} else if(VAR_25 == 2) {
if(strip->usl7 == 0) {
strip->usl7 = 1;
VAR_16 = NULL;
continue;
} else if(VAR_25 == 3) {
if(strip->usl7 == 0) {
strip->usl7 = 1;
VAR_16 = (const signed char*)VAR_8 + (*VAR_5 * 2);
VAR_5++;
continue;
cur_frm_pos = VAR_1 + VAR_3 * strip->ypos + strip->xpos;
if((VAR_26 = strip->VAR_3) < 0)
VAR_26 += 3;
VAR_26 >>= 2;
VAR_27 = strip->VAR_4;
if(VAR_16 != NULL) {
ref_frm_pos = VAR_2 + (VAR_16[0] + strip->ypos) * VAR_3 +
VAR_16[1] + strip->xpos;
} else
ref_frm_pos = cur_frm_pos - VAR_14[4];
if(VAR_25 == 2) {
if(VAR_10 <= 0) {
VAR_10 = 8;
bit_buf = *VAR_5++;
VAR_10 -= 2;
VAR_25 = (bit_buf >> VAR_10) & 0x03;
if(VAR_25 == 0 || VAR_16 != NULL) {
for(VAR_22 = 0; VAR_22 < VAR_26; VAR_22++) {
for(VAR_19 = 0, VAR_20 = 0; VAR_19 < VAR_27; VAR_19++, VAR_20 += VAR_14[1])
((uint32_t *)cur_frm_pos)[VAR_20] = ((uint32_t *)ref_frm_pos)[VAR_20];
cur_frm_pos += 4;
ref_frm_pos += 4;
} else if(VAR_25 != 1)
return;
} else {
VAR_21 = *VAR_5 >> 4;
VAR_20 = *VAR_5 & 0x0f;
VAR_5++;
VAR_11 = VAR_20 + VAR_6;
if((VAR_11 - 8) <= 7 && (VAR_21 == 0 || VAR_21 == 3 || VAR_21 == 10)) {
cp2 = VAR_0->ModPred + ((VAR_11 - 8) << 7);
cp = ref_frm_pos;
for(VAR_19 = 0; VAR_19 < VAR_26 << 2; VAR_19++) {
int VAR_33 = *cp >> 1;
*(cp++) = cp2[VAR_33];
if(VAR_21 == 1 || VAR_21 == 4) {
VAR_11 = (VAR_7[VAR_20] & 0xf) + VAR_6;
correction_type_sp[0] = VAR_0->corrector_type + (VAR_11 << 8);
VAR_17[0] = correction + (VAR_11 << 8);
VAR_11 = (VAR_7[VAR_20] >> 4) + VAR_6;
VAR_17[1] = correction + (VAR_11 << 8);
correction_type_sp[1] = VAR_0->corrector_type + (VAR_11 << 8);
} else {
correctionloworder_lp[0] = correctionloworder_lp[1] = correctionloworder + (VAR_11 << 8);
correctionhighorder_lp[0] = correctionhighorder_lp[1] = correctionhighorder + (VAR_11 << 8);
correction_type_sp[0] = correction_type_sp[1] = VAR_0->corrector_type + (VAR_11 << 8);
VAR_17[0] = VAR_17[1] = correction + (VAR_11 << 8);
switch(VAR_21) {
case 1:
case 0:
for( ; VAR_27 > 0; VAR_27 -= 4) {
for(VAR_22 = 0; VAR_22 < VAR_26; VAR_22++) {
for(VAR_23 = 0; VAR_23 < 4; ) {
VAR_21 = *VAR_5++;
cur_lp = ((uint32_t *)cur_frm_pos) + VAR_14[VAR_23];
ref_lp = ((uint32_t *)ref_frm_pos) + VAR_14[VAR_23];
switch(correction_type_sp[0][VAR_21]) {
case 0:
*cur_lp = le2me_32(((le2me_32(*ref_lp) >> 1) + VAR_17[VAR_23 & 0x01][VAR_21]) << 1);
VAR_23++;
case 1:
VAR_32 = ((le2me_16(((unsigned short *)(ref_lp))[0]) >> 1) + VAR_17[VAR_23 & 0x01][*VAR_5]) << 1;
((unsigned short *)cur_lp)[0] = le2me_16(VAR_32);
VAR_32 = ((le2me_16(((unsigned short *)(ref_lp))[1]) >> 1) + VAR_17[VAR_23 & 0x01][VAR_21]) << 1;
((unsigned short *)cur_lp)[1] = le2me_16(VAR_32);
VAR_5++;
VAR_23++;
case 2:
if(VAR_23 == 0) {
for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 2; VAR_19++, VAR_20 += VAR_14[1])
cur_lp[VAR_20] = ref_lp[VAR_20];
VAR_23 += 2;
case 3:
if(VAR_23 < 2) {
for(VAR_19 = 0, VAR_20 = 0; VAR_19 < (3 - VAR_23); VAR_19++, VAR_20 += VAR_14[1])
cur_lp[VAR_20] = ref_lp[VAR_20];
VAR_23 = 3;
case 8:
if(VAR_23 == 0) {
RLE_V3_CHECK(VAR_5,VAR_29,VAR_30,VAR_31)
if(VAR_29 == 1 || VAR_16 != NULL) {
for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 4; VAR_19++, VAR_20 += VAR_14[1])
cur_lp[VAR_20] = ref_lp[VAR_20];
RLE_V2_CHECK(VAR_5,VAR_30, VAR_31,VAR_23)
} else {
VAR_29 = 1;
VAR_30 = *VAR_5 - 1;
case 5:
LP2_CHECK(VAR_5,VAR_31,VAR_23)
case 4:
for(VAR_19 = 0, VAR_20 = 0; VAR_19 < (4 - VAR_23); VAR_19++, VAR_20 += VAR_14[1])
cur_lp[VAR_20] = ref_lp[VAR_20];
VAR_23 = 4;
case 7:
if(VAR_31 != 0)
VAR_31 = 0;
else {
VAR_5--;
VAR_31 = 1;
case 6:
if(VAR_16 != NULL) {
for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 4; VAR_19++, VAR_20 += VAR_14[1])
cur_lp[VAR_20] = ref_lp[VAR_20];
VAR_23 = 4;
case 9:
VAR_12 = *VAR_5++;
VAR_11 = (VAR_12 & 0x7F) << 1;
VAR_11 += (VAR_11 << 8);
VAR_11 += (VAR_11 << 16);
for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 4; VAR_19++, VAR_20 += VAR_14[1])
cur_lp[VAR_20] = VAR_11;
LV1_CHECK(VAR_5,VAR_31,VAR_12,VAR_23)
default:
return;
cur_frm_pos += 4;
ref_frm_pos += 4;
cur_frm_pos += ((VAR_3 - VAR_26) * 4);
ref_frm_pos += ((VAR_3 - VAR_26) * 4);
case 4:
case 3:
if(VAR_16 != NULL)
return;
VAR_24 = 1;
for( ; VAR_27 > 0; VAR_27 -= 8) {
for(VAR_22 = 0; VAR_22 < VAR_26; VAR_22++) {
for(VAR_23 = 0; VAR_23 < 4; ) {
VAR_21 = *VAR_5++;
cur_lp = ((uint32_t *)cur_frm_pos) + VAR_14[VAR_23 * 2];
ref_lp = ((uint32_t *)cur_frm_pos) + VAR_14[(VAR_23 * 2) - 1];
switch(correction_type_sp[VAR_23 & 0x01][VAR_21]) {
case 0:
cur_lp[VAR_14[1]] = le2me_32(((le2me_32(*ref_lp) >> 1) + VAR_17[VAR_23 & 0x01][VAR_21]) << 1);
if(VAR_23 > 0 || VAR_24 == 0 || strip->ypos != 0)
cur_lp[0] = ((cur_lp[-VAR_14[1]] >> 1) + (cur_lp[VAR_14[1]] >> 1)) & 0xFEFEFEFE;
else
cur_lp[0] = le2me_32(((le2me_32(*ref_lp) >> 1) + VAR_17[VAR_23 & 0x01][VAR_21]) << 1);
VAR_23++;
case 1:
VAR_32 = ((le2me_16(((unsigned short *)ref_lp)[0]) >> 1) + VAR_17[VAR_23 & 0x01][*VAR_5]) << 1;
((unsigned short *)cur_lp)[VAR_14[2]] = le2me_16(VAR_32);
VAR_32 = ((le2me_16(((unsigned short *)ref_lp)[1]) >> 1) + VAR_17[VAR_23 & 0x01][VAR_21]) << 1;
((unsigned short *)cur_lp)[VAR_14[2]+1] = le2me_16(VAR_32);
if(VAR_23 > 0 || VAR_24 == 0 || strip->ypos != 0)
cur_lp[0] = ((cur_lp[-VAR_14[1]] >> 1) + (cur_lp[VAR_14[1]] >> 1)) & 0xFEFEFEFE;
else
cur_lp[0] = cur_lp[VAR_14[1]];
VAR_5++;
VAR_23++;
case 2:
if(VAR_23 == 0) {
for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 4; VAR_19++, VAR_20 += VAR_14[1])
cur_lp[VAR_20] = *ref_lp;
VAR_23 += 2;
case 3:
if(VAR_23 < 2) {
for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 6 - (VAR_23 * 2); VAR_19++, VAR_20 += VAR_14[1])
cur_lp[VAR_20] = *ref_lp;
VAR_23 = 3;
case 6:
VAR_23 = 4;
case 7:
if(VAR_31 != 0)
VAR_31 = 0;
else {
VAR_5--;
VAR_31 = 1;
VAR_23 = 4;
case 8:
if(VAR_23 == 0) {
RLE_V3_CHECK(VAR_5,VAR_29,VAR_30,VAR_31)
if(VAR_29 == 1) {
for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 8; VAR_19++, VAR_20 += VAR_14[1])
cur_lp[VAR_20] = ref_lp[VAR_20];
RLE_V2_CHECK(VAR_5,VAR_30, VAR_31,VAR_23)
} else {
VAR_30 = (*VAR_5) - 1;
VAR_29 = 1;
case 5:
LP2_CHECK(VAR_5,VAR_31,VAR_23)
case 4:
for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 8 - (VAR_23 * 2); VAR_19++, VAR_20 += VAR_14[1])
cur_lp[VAR_20] = *ref_lp;
VAR_23 = 4;
case 9:
av_log(VAR_0->avctx, AV_LOG_ERROR, "UNTESTED.\n");
VAR_12 = *VAR_5++;
VAR_11 = (VAR_12 & 0x7F) << 1;
VAR_11 += (VAR_11 << 8);
VAR_11 += (VAR_11 << 16);
for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 4; VAR_19++, VAR_20 += VAR_14[1])
cur_lp[VAR_20] = VAR_11;
LV1_CHECK(VAR_5,VAR_31,VAR_12,VAR_23)
default:
return;
cur_frm_pos += 4;
cur_frm_pos += (((VAR_3 * 2) - VAR_26) * 4);
VAR_24 = 0;
case 10:
if(VAR_16 == NULL) {
VAR_24 = 1;
for( ; VAR_27 > 0; VAR_27 -= 8) {
for(VAR_22 = 0; VAR_22 < VAR_26; VAR_22 += 2) {
for(VAR_23 = 0; VAR_23 < 4; ) {
VAR_21 = *VAR_5++;
cur_lp = ((uint32_t *)cur_frm_pos) + VAR_14[VAR_23 * 2];
ref_lp = ((uint32_t *)cur_frm_pos) + VAR_14[(VAR_23 * 2) - 1];
VAR_12 = ref_lp[0];
VAR_13 = ref_lp[1];
if(VAR_23 == 0 && VAR_24 != 0) {
#ifdef WORDS_BIGENDIAN
VAR_12 = VAR_12 & 0xFF00FF00;
VAR_12 = (VAR_12 >> 8) | VAR_12;
VAR_13 = VAR_13 & 0xFF00FF00;
VAR_13 = (VAR_13 >> 8) | VAR_13;
#else
VAR_12 = VAR_12 & 0x00FF00FF;
VAR_12 = (VAR_12 << 8) | VAR_12;
VAR_13 = VAR_13 & 0x00FF00FF;
VAR_13 = (VAR_13 << 8) | VAR_13;
#endif
switch(correction_type_sp[VAR_23 & 0x01][VAR_21]) {
case 0:
cur_lp[VAR_14[1]] = le2me_32(((le2me_32(VAR_12) >> 1) + correctionloworder_lp[VAR_23 & 0x01][VAR_21]) << 1);
cur_lp[VAR_14[1]+1] = le2me_32(((le2me_32(VAR_13) >> 1) + correctionhighorder_lp[VAR_23 & 0x01][VAR_21]) << 1);
if(VAR_23 > 0 || strip->ypos != 0 || VAR_24 == 0) {
cur_lp[0] = ((cur_lp[-VAR_14[1]] >> 1) + (cur_lp[VAR_14[1]] >> 1)) & 0xFEFEFEFE;
cur_lp[1] = ((cur_lp[-VAR_14[1]+1] >> 1) + (cur_lp[VAR_14[1]+1] >> 1)) & 0xFEFEFEFE;
} else {
cur_lp[0] = cur_lp[VAR_14[1]];
cur_lp[1] = cur_lp[VAR_14[1]+1];
VAR_23++;
case 1:
cur_lp[VAR_14[1]] = le2me_32(((le2me_32(VAR_12) >> 1) + correctionloworder_lp[VAR_23 & 0x01][*VAR_5]) << 1);
cur_lp[VAR_14[1]+1] = le2me_32(((le2me_32(VAR_13) >> 1) + correctionloworder_lp[VAR_23 & 0x01][VAR_21]) << 1);
if(VAR_23 > 0 || strip->ypos != 0 || VAR_24 == 0) {
cur_lp[0] = ((cur_lp[-VAR_14[1]] >> 1) + (cur_lp[VAR_14[1]] >> 1)) & 0xFEFEFEFE;
cur_lp[1] = ((cur_lp[-VAR_14[1]+1] >> 1) + (cur_lp[VAR_14[1]+1] >> 1)) & 0xFEFEFEFE;
} else {
cur_lp[0] = cur_lp[VAR_14[1]];
cur_lp[1] = cur_lp[VAR_14[1]+1];
VAR_5++;
VAR_23++;
case 2:
if(VAR_23 == 0) {
if(VAR_24 != 0) {
for(VAR_19 = 0, VAR_20 = VAR_14[1]; VAR_19 < 3; VAR_19++, VAR_20 += VAR_14[1]) {
cur_lp[VAR_20] = VAR_12;
cur_lp[VAR_20+1] = VAR_13;
cur_lp[0] = ((cur_lp[-VAR_14[1]] >> 1) + (cur_lp[VAR_14[1]] >> 1)) & 0xFEFEFEFE;
cur_lp[1] = ((cur_lp[-VAR_14[1]+1] >> 1) + (cur_lp[VAR_14[1]+1] >> 1)) & 0xFEFEFEFE;
} else {
for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 4; VAR_19++, VAR_20 += VAR_14[1]) {
cur_lp[VAR_20] = VAR_12;
cur_lp[VAR_20+1] = VAR_13;
VAR_23 += 2;
case 3:
if(VAR_23 < 2) {
if(VAR_23 == 0 && VAR_24 != 0) {
for(VAR_19 = 0, VAR_20 = VAR_14[1]; VAR_19 < 5; VAR_19++, VAR_20 += VAR_14[1]) {
cur_lp[VAR_20] = VAR_12;
cur_lp[VAR_20+1] = VAR_13;
cur_lp[0] = ((cur_lp[-VAR_14[1]] >> 1) + (cur_lp[VAR_14[1]] >> 1)) & 0xFEFEFEFE;
cur_lp[1] = ((cur_lp[-VAR_14[1]+1] >> 1) + (cur_lp[VAR_14[1]+1] >> 1)) & 0xFEFEFEFE;
} else {
for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 6 - (VAR_23 * 2); VAR_19++, VAR_20 += VAR_14[1]) {
cur_lp[VAR_20] = VAR_12;
cur_lp[VAR_20+1] = VAR_13;
VAR_23 = 3;
case 8:
if(VAR_23 == 0) {
RLE_V3_CHECK(VAR_5,VAR_29,VAR_30,VAR_31)
if(VAR_29 == 1) {
if(VAR_24 != 0) {
for(VAR_19 = 0, VAR_20 = VAR_14[1]; VAR_19 < 7; VAR_19++, VAR_20 += VAR_14[1]) {
cur_lp[VAR_20] = VAR_12;
cur_lp[VAR_20+1] = VAR_13;
cur_lp[0] = ((cur_lp[-VAR_14[1]] >> 1) + (cur_lp[VAR_14[1]] >> 1)) & 0xFEFEFEFE;
cur_lp[1] = ((cur_lp[-VAR_14[1]+1] >> 1) + (cur_lp[VAR_14[1]+1] >> 1)) & 0xFEFEFEFE;
} else {
for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 8; VAR_19++, VAR_20 += VAR_14[1]) {
cur_lp[VAR_20] = VAR_12;
cur_lp[VAR_20+1] = VAR_13;
RLE_V2_CHECK(VAR_5,VAR_30, VAR_31,VAR_23)
} else {
VAR_29 = 1;
VAR_30 = (*VAR_5) - 1;
case 5:
LP2_CHECK(VAR_5,VAR_31,VAR_23)
case 4:
if(VAR_23 == 0 && VAR_24 != 0) {
for(VAR_19 = 0, VAR_20 = VAR_14[1]; VAR_19 < 7; VAR_19++, VAR_20 += VAR_14[1]) {
cur_lp[VAR_20] = VAR_12;
cur_lp[VAR_20+1] = VAR_13;
cur_lp[0] = ((cur_lp[-VAR_14[1]] >> 1) + (cur_lp[VAR_14[1]] >> 1)) & 0xFEFEFEFE;
cur_lp[1] = ((cur_lp[-VAR_14[1]+1] >> 1) + (cur_lp[VAR_14[1]+1] >> 1)) & 0xFEFEFEFE;
} else {
for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 8 - (VAR_23 * 2); VAR_19++, VAR_20 += VAR_14[1]) {
cur_lp[VAR_20] = VAR_12;
cur_lp[VAR_20+1] = VAR_13;
VAR_23 = 4;
case 6:
VAR_23 = 4;
case 7:
if(VAR_23 == 0) {
if(VAR_31 != 0)
VAR_31 = 0;
else {
VAR_5--;
VAR_31 = 1;
VAR_23 = 4;
case 9:
av_log(VAR_0->avctx, AV_LOG_ERROR, "UNTESTED.\n");
VAR_12 = *VAR_5;
VAR_11 = (VAR_12 & 0x7F) << 1;
VAR_11 += (VAR_11 << 8);
VAR_11 += (VAR_11 << 16);
for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 8; VAR_19++, VAR_20 += VAR_14[1])
cur_lp[VAR_20] = VAR_11;
LV1_CHECK(VAR_5,VAR_31,VAR_12,VAR_23)
default:
return;
cur_frm_pos += 8;
cur_frm_pos += (((VAR_3 * 2) - VAR_26) * 4);
VAR_24 = 0;
} else {
for( ; VAR_27 > 0; VAR_27 -= 8) {
for(VAR_22 = 0; VAR_22 < VAR_26; VAR_22 += 2) {
for(VAR_23 = 0; VAR_23 < 4; ) {
VAR_21 = *VAR_5++;
cur_lp = ((uint32_t *)cur_frm_pos) + VAR_14[VAR_23 * 2];
ref_lp = ((uint32_t *)ref_frm_pos) + VAR_14[VAR_23 * 2];
switch(correction_type_sp[VAR_23 & 0x01][VAR_21]) {
case 0:
VAR_12 = correctionloworder_lp[VAR_23 & 0x01][VAR_21];
VAR_13 = correctionhighorder_lp[VAR_23 & 0x01][VAR_21];
cur_lp[0] = le2me_32(((le2me_32(ref_lp[0]) >> 1) + VAR_12) << 1);
cur_lp[1] = le2me_32(((le2me_32(ref_lp[1]) >> 1) + VAR_13) << 1);
cur_lp[VAR_14[1]] = le2me_32(((le2me_32(ref_lp[VAR_14[1]]) >> 1) + VAR_12) << 1);
cur_lp[VAR_14[1]+1] = le2me_32(((le2me_32(ref_lp[VAR_14[1]+1]) >> 1) + VAR_13) << 1);
VAR_23++;
case 1:
VAR_12 = correctionloworder_lp[VAR_23 & 0x01][*VAR_5++];
VAR_13 = correctionloworder_lp[VAR_23 & 0x01][VAR_21];
cur_lp[0] = le2me_32(((le2me_32(ref_lp[0]) >> 1) + VAR_12) << 1);
cur_lp[1] = le2me_32(((le2me_32(ref_lp[1]) >> 1) + VAR_13) << 1);
cur_lp[VAR_14[1]] = le2me_32(((le2me_32(ref_lp[VAR_14[1]]) >> 1) + VAR_12) << 1);
cur_lp[VAR_14[1]+1] = le2me_32(((le2me_32(ref_lp[VAR_14[1]+1]) >> 1) + VAR_13) << 1);
VAR_23++;
case 2:
if(VAR_23 == 0) {
for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 4; VAR_19++, VAR_20 += VAR_14[1]) {
cur_lp[VAR_20] = ref_lp[VAR_20];
cur_lp[VAR_20+1] = ref_lp[VAR_20+1];
VAR_23 += 2;
case 3:
if(VAR_23 < 2) {
for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 6 - (VAR_23 * 2); VAR_19++, VAR_20 += VAR_14[1]) {
cur_lp[VAR_20] = ref_lp[VAR_20];
cur_lp[VAR_20+1] = ref_lp[VAR_20+1];
VAR_23 = 3;
case 8:
if(VAR_23 == 0) {
RLE_V3_CHECK(VAR_5,VAR_29,VAR_30,VAR_31)
for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 8; VAR_19++, VAR_20 += VAR_14[1]) {
((uint32_t *)cur_frm_pos)[VAR_20] = ((uint32_t *)ref_frm_pos)[VAR_20];
((uint32_t *)cur_frm_pos)[VAR_20+1] = ((uint32_t *)ref_frm_pos)[VAR_20+1];
RLE_V2_CHECK(VAR_5,VAR_30, VAR_31,VAR_23)
} else {
VAR_29 = 1;
VAR_30 = (*VAR_5) - 1;
case 5:
case 7:
LP2_CHECK(VAR_5,VAR_31,VAR_23)
case 6:
case 4:
for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 8 - (VAR_23 * 2); VAR_19++, VAR_20 += VAR_14[1]) {
cur_lp[VAR_20] = ref_lp[VAR_20];
cur_lp[VAR_20+1] = ref_lp[VAR_20+1];
VAR_23 = 4;
case 9:
av_log(VAR_0->avctx, AV_LOG_ERROR, "UNTESTED.\n");
VAR_12 = *VAR_5;
VAR_11 = (VAR_12 & 0x7F) << 1;
VAR_11 += (VAR_11 << 8);
VAR_11 += (VAR_11 << 16);
for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 8; VAR_19++, VAR_20 += VAR_14[1])
((uint32_t *)cur_frm_pos)[VAR_20] = ((uint32_t *)cur_frm_pos)[VAR_20+1] = VAR_11;
LV1_CHECK(VAR_5,VAR_31,VAR_12,VAR_23)
default:
return;
cur_frm_pos += 8;
ref_frm_pos += 8;
cur_frm_pos += (((VAR_3 * 2) - VAR_26) * 4);
ref_frm_pos += (((VAR_3 * 2) - VAR_26) * 4);
case 11:
if(VAR_16 == NULL)
return;
for( ; VAR_27 > 0; VAR_27 -= 8) {
for(VAR_22 = 0; VAR_22 < VAR_26; VAR_22++) {
for(VAR_23 = 0; VAR_23 < 4; ) {
VAR_21 = *VAR_5++;
cur_lp = ((uint32_t *)cur_frm_pos) + VAR_14[VAR_23 * 2];
ref_lp = ((uint32_t *)ref_frm_pos) + VAR_14[VAR_23 * 2];
switch(correction_type_sp[VAR_23 & 0x01][VAR_21]) {
case 0:
cur_lp[0] = le2me_32(((le2me_32(*ref_lp) >> 1) + VAR_17[VAR_23 & 0x01][VAR_21]) << 1);
cur_lp[VAR_14[1]] = le2me_32(((le2me_32(ref_lp[VAR_14[1]]) >> 1) + VAR_17[VAR_23 & 0x01][VAR_21]) << 1);
VAR_23++;
case 1:
VAR_12 = (unsigned short)(VAR_17[VAR_23 & 0x01][*VAR_5++]);
VAR_13 = (unsigned short)(VAR_17[VAR_23 & 0x01][VAR_21]);
VAR_32 = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[0]) >> 1) + VAR_12) << 1);
((unsigned short *)cur_lp)[0] = le2me_16(VAR_32);
VAR_32 = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[1]) >> 1) + VAR_13) << 1);
((unsigned short *)cur_lp)[1] = le2me_16(VAR_32);
VAR_32 = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[VAR_14[2]]) >> 1) + VAR_12) << 1);
((unsigned short *)cur_lp)[VAR_14[2]] = le2me_16(VAR_32);
VAR_32 = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[VAR_14[2]+1]) >> 1) + VAR_13) << 1);
((unsigned short *)cur_lp)[VAR_14[2]+1] = le2me_16(VAR_32);
VAR_23++;
case 2:
if(VAR_23 == 0) {
for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 4; VAR_19++, VAR_20 += VAR_14[1])
cur_lp[VAR_20] = ref_lp[VAR_20];
VAR_23 += 2;
case 3:
if(VAR_23 < 2) {
for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 6 - (VAR_23 * 2); VAR_19++, VAR_20 += VAR_14[1])
cur_lp[VAR_20] = ref_lp[VAR_20];
VAR_23 = 3;
case 8:
if(VAR_23 == 0) {
RLE_V3_CHECK(VAR_5,VAR_29,VAR_30,VAR_31)
for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 8; VAR_19++, VAR_20 += VAR_14[1])
cur_lp[VAR_20] = ref_lp[VAR_20];
RLE_V2_CHECK(VAR_5,VAR_30, VAR_31,VAR_23)
} else {
VAR_29 = 1;
VAR_30 = (*VAR_5) - 1;
case 5:
case 7:
LP2_CHECK(VAR_5,VAR_31,VAR_23)
case 4:
case 6:
for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 8 - (VAR_23 * 2); VAR_19++, VAR_20 += VAR_14[1])
cur_lp[VAR_20] = ref_lp[VAR_20];
VAR_23 = 4;
case 9:
av_log(VAR_0->avctx, AV_LOG_ERROR, "UNTESTED.\n");
VAR_12 = *VAR_5++;
VAR_11 = (VAR_12 & 0x7F) << 1;
VAR_11 += (VAR_11 << 8);
VAR_11 += (VAR_11 << 16);
for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 4; VAR_19++, VAR_20 += VAR_14[1])
cur_lp[VAR_20] = VAR_11;
LV1_CHECK(VAR_5,VAR_31,VAR_12,VAR_23)
default:
return;
cur_frm_pos += 4;
ref_frm_pos += 4;
cur_frm_pos += (((VAR_3 * 2) - VAR_26) * 4);
ref_frm_pos += (((VAR_3 * 2) - VAR_26) * 4);
default:
return;
if(strip < VAR_18)
return;
for( ; strip >= VAR_18; strip--) {
if(strip->split_flag != 0) {
strip->split_flag = 0;
strip->usl7 = (strip-1)->usl7;
if(strip->split_direction) {
strip->xpos += strip->VAR_3;
strip->VAR_3 = (strip-1)->VAR_3 - strip->VAR_3;
if(VAR_28 <= strip->xpos && VAR_3 < strip->VAR_3 + strip->xpos)
strip->VAR_3 = VAR_3 - strip->xpos;
} else {
strip->ypos += strip->VAR_4;
strip->VAR_4 = (strip-1)->VAR_4 - strip->VAR_4;
|
[
"static void FUNC_0(Indeo3DecodeContext *VAR_0,\nuint8_t *VAR_1, uint8_t *VAR_2, int VAR_3, int VAR_4,\nconst uint8_t *VAR_5, long VAR_6, const uint8_t *VAR_7,\nconst uint8_t *VAR_8, int VAR_9)\n{",
"uint8_t bit_buf;",
"unsigned long VAR_10, VAR_11, VAR_12, VAR_13;",
"long *VAR_14, VAR_15[10];",
"const signed char *VAR_16;",
"uint8_t *cur_frm_pos, *ref_frm_pos, *cp, *cp2;",
"uint32_t *cur_lp, *ref_lp;",
"const uint32_t *VAR_17[2], *correctionloworder_lp[2], *correctionhighorder_lp[2];",
"uint8_t *correction_type_sp[2];",
"struct ustr VAR_18[20], *strip;",
"int VAR_19, VAR_20, VAR_21, VAR_22, VAR_23, VAR_24, VAR_25, VAR_26, VAR_27, VAR_28,\nVAR_29, VAR_30, VAR_31;",
"unsigned short VAR_32;",
"bit_buf = 0;",
"VAR_16 = NULL;",
"VAR_14 = VAR_15 + 1;",
"VAR_19 = (VAR_3 < 0 ? VAR_3 + 3 : VAR_3)/4;",
"for(VAR_20 = -1; VAR_20 < 8; VAR_20++)",
"VAR_14[VAR_20] = VAR_19 * VAR_20;",
"strip = VAR_18;",
"for(VAR_28 = 0; VAR_28 < (VAR_3 - VAR_9); VAR_28 += VAR_9);",
"strip->ypos = strip->xpos = 0;",
"for(strip->VAR_3 = VAR_9; VAR_3 > strip->VAR_3; strip->VAR_3 *= 2);",
"strip->VAR_4 = VAR_4;",
"strip->split_direction = 0;",
"strip->split_flag = 0;",
"strip->usl7 = 0;",
"VAR_10 = 0;",
"VAR_29 = VAR_30 = VAR_31 = 0;",
"while(strip >= VAR_18) {",
"if(VAR_10 <= 0) {",
"VAR_10 = 8;",
"bit_buf = *VAR_5++;",
"VAR_10 -= 2;",
"VAR_25 = (bit_buf >> VAR_10) & 0x03;",
"if(VAR_25 == 0) {",
"strip++;",
"memcpy(strip, strip-1, sizeof(*strip));",
"strip->split_flag = 1;",
"strip->split_direction = 0;",
"strip->VAR_4 = (strip->VAR_4 > 8 ? ((strip->VAR_4+8)>>4)<<3 : 4);",
"continue;",
"} else if(VAR_25 == 1) {",
"strip++;",
"memcpy(strip, strip-1, sizeof(*strip));",
"strip->split_flag = 1;",
"strip->split_direction = 1;",
"strip->VAR_3 = (strip->VAR_3 > 8 ? ((strip->VAR_3+8)>>4)<<3 : 4);",
"continue;",
"} else if(VAR_25 == 2) {",
"if(strip->usl7 == 0) {",
"strip->usl7 = 1;",
"VAR_16 = NULL;",
"continue;",
"} else if(VAR_25 == 3) {",
"if(strip->usl7 == 0) {",
"strip->usl7 = 1;",
"VAR_16 = (const signed char*)VAR_8 + (*VAR_5 * 2);",
"VAR_5++;",
"continue;",
"cur_frm_pos = VAR_1 + VAR_3 * strip->ypos + strip->xpos;",
"if((VAR_26 = strip->VAR_3) < 0)\nVAR_26 += 3;",
"VAR_26 >>= 2;",
"VAR_27 = strip->VAR_4;",
"if(VAR_16 != NULL) {",
"ref_frm_pos = VAR_2 + (VAR_16[0] + strip->ypos) * VAR_3 +\nVAR_16[1] + strip->xpos;",
"} else",
"ref_frm_pos = cur_frm_pos - VAR_14[4];",
"if(VAR_25 == 2) {",
"if(VAR_10 <= 0) {",
"VAR_10 = 8;",
"bit_buf = *VAR_5++;",
"VAR_10 -= 2;",
"VAR_25 = (bit_buf >> VAR_10) & 0x03;",
"if(VAR_25 == 0 || VAR_16 != NULL) {",
"for(VAR_22 = 0; VAR_22 < VAR_26; VAR_22++) {",
"for(VAR_19 = 0, VAR_20 = 0; VAR_19 < VAR_27; VAR_19++, VAR_20 += VAR_14[1])",
"((uint32_t *)cur_frm_pos)[VAR_20] = ((uint32_t *)ref_frm_pos)[VAR_20];",
"cur_frm_pos += 4;",
"ref_frm_pos += 4;",
"} else if(VAR_25 != 1)",
"return;",
"} else {",
"VAR_21 = *VAR_5 >> 4;",
"VAR_20 = *VAR_5 & 0x0f;",
"VAR_5++;",
"VAR_11 = VAR_20 + VAR_6;",
"if((VAR_11 - 8) <= 7 && (VAR_21 == 0 || VAR_21 == 3 || VAR_21 == 10)) {",
"cp2 = VAR_0->ModPred + ((VAR_11 - 8) << 7);",
"cp = ref_frm_pos;",
"for(VAR_19 = 0; VAR_19 < VAR_26 << 2; VAR_19++) {",
"int VAR_33 = *cp >> 1;",
"*(cp++) = cp2[VAR_33];",
"if(VAR_21 == 1 || VAR_21 == 4) {",
"VAR_11 = (VAR_7[VAR_20] & 0xf) + VAR_6;",
"correction_type_sp[0] = VAR_0->corrector_type + (VAR_11 << 8);",
"VAR_17[0] = correction + (VAR_11 << 8);",
"VAR_11 = (VAR_7[VAR_20] >> 4) + VAR_6;",
"VAR_17[1] = correction + (VAR_11 << 8);",
"correction_type_sp[1] = VAR_0->corrector_type + (VAR_11 << 8);",
"} else {",
"correctionloworder_lp[0] = correctionloworder_lp[1] = correctionloworder + (VAR_11 << 8);",
"correctionhighorder_lp[0] = correctionhighorder_lp[1] = correctionhighorder + (VAR_11 << 8);",
"correction_type_sp[0] = correction_type_sp[1] = VAR_0->corrector_type + (VAR_11 << 8);",
"VAR_17[0] = VAR_17[1] = correction + (VAR_11 << 8);",
"switch(VAR_21) {",
"case 1:\ncase 0:\nfor( ; VAR_27 > 0; VAR_27 -= 4) {",
"for(VAR_22 = 0; VAR_22 < VAR_26; VAR_22++) {",
"for(VAR_23 = 0; VAR_23 < 4; ) {",
"VAR_21 = *VAR_5++;",
"cur_lp = ((uint32_t *)cur_frm_pos) + VAR_14[VAR_23];",
"ref_lp = ((uint32_t *)ref_frm_pos) + VAR_14[VAR_23];",
"switch(correction_type_sp[0][VAR_21]) {",
"case 0:\n*cur_lp = le2me_32(((le2me_32(*ref_lp) >> 1) + VAR_17[VAR_23 & 0x01][VAR_21]) << 1);",
"VAR_23++;",
"case 1:\nVAR_32 = ((le2me_16(((unsigned short *)(ref_lp))[0]) >> 1) + VAR_17[VAR_23 & 0x01][*VAR_5]) << 1;",
"((unsigned short *)cur_lp)[0] = le2me_16(VAR_32);",
"VAR_32 = ((le2me_16(((unsigned short *)(ref_lp))[1]) >> 1) + VAR_17[VAR_23 & 0x01][VAR_21]) << 1;",
"((unsigned short *)cur_lp)[1] = le2me_16(VAR_32);",
"VAR_5++;",
"VAR_23++;",
"case 2:\nif(VAR_23 == 0) {",
"for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 2; VAR_19++, VAR_20 += VAR_14[1])",
"cur_lp[VAR_20] = ref_lp[VAR_20];",
"VAR_23 += 2;",
"case 3:\nif(VAR_23 < 2) {",
"for(VAR_19 = 0, VAR_20 = 0; VAR_19 < (3 - VAR_23); VAR_19++, VAR_20 += VAR_14[1])",
"cur_lp[VAR_20] = ref_lp[VAR_20];",
"VAR_23 = 3;",
"case 8:\nif(VAR_23 == 0) {",
"RLE_V3_CHECK(VAR_5,VAR_29,VAR_30,VAR_31)\nif(VAR_29 == 1 || VAR_16 != NULL) {",
"for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 4; VAR_19++, VAR_20 += VAR_14[1])",
"cur_lp[VAR_20] = ref_lp[VAR_20];",
"RLE_V2_CHECK(VAR_5,VAR_30, VAR_31,VAR_23)\n} else {",
"VAR_29 = 1;",
"VAR_30 = *VAR_5 - 1;",
"case 5:\nLP2_CHECK(VAR_5,VAR_31,VAR_23)\ncase 4:\nfor(VAR_19 = 0, VAR_20 = 0; VAR_19 < (4 - VAR_23); VAR_19++, VAR_20 += VAR_14[1])",
"cur_lp[VAR_20] = ref_lp[VAR_20];",
"VAR_23 = 4;",
"case 7:\nif(VAR_31 != 0)\nVAR_31 = 0;",
"else {",
"VAR_5--;",
"VAR_31 = 1;",
"case 6:\nif(VAR_16 != NULL) {",
"for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 4; VAR_19++, VAR_20 += VAR_14[1])",
"cur_lp[VAR_20] = ref_lp[VAR_20];",
"VAR_23 = 4;",
"case 9:\nVAR_12 = *VAR_5++;",
"VAR_11 = (VAR_12 & 0x7F) << 1;",
"VAR_11 += (VAR_11 << 8);",
"VAR_11 += (VAR_11 << 16);",
"for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 4; VAR_19++, VAR_20 += VAR_14[1])",
"cur_lp[VAR_20] = VAR_11;",
"LV1_CHECK(VAR_5,VAR_31,VAR_12,VAR_23)\ndefault:\nreturn;",
"cur_frm_pos += 4;",
"ref_frm_pos += 4;",
"cur_frm_pos += ((VAR_3 - VAR_26) * 4);",
"ref_frm_pos += ((VAR_3 - VAR_26) * 4);",
"case 4:\ncase 3:\nif(VAR_16 != NULL)\nreturn;",
"VAR_24 = 1;",
"for( ; VAR_27 > 0; VAR_27 -= 8) {",
"for(VAR_22 = 0; VAR_22 < VAR_26; VAR_22++) {",
"for(VAR_23 = 0; VAR_23 < 4; ) {",
"VAR_21 = *VAR_5++;",
"cur_lp = ((uint32_t *)cur_frm_pos) + VAR_14[VAR_23 * 2];",
"ref_lp = ((uint32_t *)cur_frm_pos) + VAR_14[(VAR_23 * 2) - 1];",
"switch(correction_type_sp[VAR_23 & 0x01][VAR_21]) {",
"case 0:\ncur_lp[VAR_14[1]] = le2me_32(((le2me_32(*ref_lp) >> 1) + VAR_17[VAR_23 & 0x01][VAR_21]) << 1);",
"if(VAR_23 > 0 || VAR_24 == 0 || strip->ypos != 0)\ncur_lp[0] = ((cur_lp[-VAR_14[1]] >> 1) + (cur_lp[VAR_14[1]] >> 1)) & 0xFEFEFEFE;",
"else\ncur_lp[0] = le2me_32(((le2me_32(*ref_lp) >> 1) + VAR_17[VAR_23 & 0x01][VAR_21]) << 1);",
"VAR_23++;",
"case 1:\nVAR_32 = ((le2me_16(((unsigned short *)ref_lp)[0]) >> 1) + VAR_17[VAR_23 & 0x01][*VAR_5]) << 1;",
"((unsigned short *)cur_lp)[VAR_14[2]] = le2me_16(VAR_32);",
"VAR_32 = ((le2me_16(((unsigned short *)ref_lp)[1]) >> 1) + VAR_17[VAR_23 & 0x01][VAR_21]) << 1;",
"((unsigned short *)cur_lp)[VAR_14[2]+1] = le2me_16(VAR_32);",
"if(VAR_23 > 0 || VAR_24 == 0 || strip->ypos != 0)\ncur_lp[0] = ((cur_lp[-VAR_14[1]] >> 1) + (cur_lp[VAR_14[1]] >> 1)) & 0xFEFEFEFE;",
"else\ncur_lp[0] = cur_lp[VAR_14[1]];",
"VAR_5++;",
"VAR_23++;",
"case 2:\nif(VAR_23 == 0) {",
"for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 4; VAR_19++, VAR_20 += VAR_14[1])",
"cur_lp[VAR_20] = *ref_lp;",
"VAR_23 += 2;",
"case 3:\nif(VAR_23 < 2) {",
"for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 6 - (VAR_23 * 2); VAR_19++, VAR_20 += VAR_14[1])",
"cur_lp[VAR_20] = *ref_lp;",
"VAR_23 = 3;",
"case 6:\nVAR_23 = 4;",
"case 7:\nif(VAR_31 != 0)\nVAR_31 = 0;",
"else {",
"VAR_5--;",
"VAR_31 = 1;",
"VAR_23 = 4;",
"case 8:\nif(VAR_23 == 0) {",
"RLE_V3_CHECK(VAR_5,VAR_29,VAR_30,VAR_31)\nif(VAR_29 == 1) {",
"for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 8; VAR_19++, VAR_20 += VAR_14[1])",
"cur_lp[VAR_20] = ref_lp[VAR_20];",
"RLE_V2_CHECK(VAR_5,VAR_30, VAR_31,VAR_23)\n} else {",
"VAR_30 = (*VAR_5) - 1;",
"VAR_29 = 1;",
"case 5:\nLP2_CHECK(VAR_5,VAR_31,VAR_23)\ncase 4:\nfor(VAR_19 = 0, VAR_20 = 0; VAR_19 < 8 - (VAR_23 * 2); VAR_19++, VAR_20 += VAR_14[1])",
"cur_lp[VAR_20] = *ref_lp;",
"VAR_23 = 4;",
"case 9:\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"UNTESTED.\\n\");",
"VAR_12 = *VAR_5++;",
"VAR_11 = (VAR_12 & 0x7F) << 1;",
"VAR_11 += (VAR_11 << 8);",
"VAR_11 += (VAR_11 << 16);",
"for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 4; VAR_19++, VAR_20 += VAR_14[1])",
"cur_lp[VAR_20] = VAR_11;",
"LV1_CHECK(VAR_5,VAR_31,VAR_12,VAR_23)\ndefault:\nreturn;",
"cur_frm_pos += 4;",
"cur_frm_pos += (((VAR_3 * 2) - VAR_26) * 4);",
"VAR_24 = 0;",
"case 10:\nif(VAR_16 == NULL) {",
"VAR_24 = 1;",
"for( ; VAR_27 > 0; VAR_27 -= 8) {",
"for(VAR_22 = 0; VAR_22 < VAR_26; VAR_22 += 2) {",
"for(VAR_23 = 0; VAR_23 < 4; ) {",
"VAR_21 = *VAR_5++;",
"cur_lp = ((uint32_t *)cur_frm_pos) + VAR_14[VAR_23 * 2];",
"ref_lp = ((uint32_t *)cur_frm_pos) + VAR_14[(VAR_23 * 2) - 1];",
"VAR_12 = ref_lp[0];",
"VAR_13 = ref_lp[1];",
"if(VAR_23 == 0 && VAR_24 != 0) {",
"#ifdef WORDS_BIGENDIAN\nVAR_12 = VAR_12 & 0xFF00FF00;",
"VAR_12 = (VAR_12 >> 8) | VAR_12;",
"VAR_13 = VAR_13 & 0xFF00FF00;",
"VAR_13 = (VAR_13 >> 8) | VAR_13;",
"#else\nVAR_12 = VAR_12 & 0x00FF00FF;",
"VAR_12 = (VAR_12 << 8) | VAR_12;",
"VAR_13 = VAR_13 & 0x00FF00FF;",
"VAR_13 = (VAR_13 << 8) | VAR_13;",
"#endif\nswitch(correction_type_sp[VAR_23 & 0x01][VAR_21]) {",
"case 0:\ncur_lp[VAR_14[1]] = le2me_32(((le2me_32(VAR_12) >> 1) + correctionloworder_lp[VAR_23 & 0x01][VAR_21]) << 1);",
"cur_lp[VAR_14[1]+1] = le2me_32(((le2me_32(VAR_13) >> 1) + correctionhighorder_lp[VAR_23 & 0x01][VAR_21]) << 1);",
"if(VAR_23 > 0 || strip->ypos != 0 || VAR_24 == 0) {",
"cur_lp[0] = ((cur_lp[-VAR_14[1]] >> 1) + (cur_lp[VAR_14[1]] >> 1)) & 0xFEFEFEFE;",
"cur_lp[1] = ((cur_lp[-VAR_14[1]+1] >> 1) + (cur_lp[VAR_14[1]+1] >> 1)) & 0xFEFEFEFE;",
"} else {",
"cur_lp[0] = cur_lp[VAR_14[1]];",
"cur_lp[1] = cur_lp[VAR_14[1]+1];",
"VAR_23++;",
"case 1:\ncur_lp[VAR_14[1]] = le2me_32(((le2me_32(VAR_12) >> 1) + correctionloworder_lp[VAR_23 & 0x01][*VAR_5]) << 1);",
"cur_lp[VAR_14[1]+1] = le2me_32(((le2me_32(VAR_13) >> 1) + correctionloworder_lp[VAR_23 & 0x01][VAR_21]) << 1);",
"if(VAR_23 > 0 || strip->ypos != 0 || VAR_24 == 0) {",
"cur_lp[0] = ((cur_lp[-VAR_14[1]] >> 1) + (cur_lp[VAR_14[1]] >> 1)) & 0xFEFEFEFE;",
"cur_lp[1] = ((cur_lp[-VAR_14[1]+1] >> 1) + (cur_lp[VAR_14[1]+1] >> 1)) & 0xFEFEFEFE;",
"} else {",
"cur_lp[0] = cur_lp[VAR_14[1]];",
"cur_lp[1] = cur_lp[VAR_14[1]+1];",
"VAR_5++;",
"VAR_23++;",
"case 2:\nif(VAR_23 == 0) {",
"if(VAR_24 != 0) {",
"for(VAR_19 = 0, VAR_20 = VAR_14[1]; VAR_19 < 3; VAR_19++, VAR_20 += VAR_14[1]) {",
"cur_lp[VAR_20] = VAR_12;",
"cur_lp[VAR_20+1] = VAR_13;",
"cur_lp[0] = ((cur_lp[-VAR_14[1]] >> 1) + (cur_lp[VAR_14[1]] >> 1)) & 0xFEFEFEFE;",
"cur_lp[1] = ((cur_lp[-VAR_14[1]+1] >> 1) + (cur_lp[VAR_14[1]+1] >> 1)) & 0xFEFEFEFE;",
"} else {",
"for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 4; VAR_19++, VAR_20 += VAR_14[1]) {",
"cur_lp[VAR_20] = VAR_12;",
"cur_lp[VAR_20+1] = VAR_13;",
"VAR_23 += 2;",
"case 3:\nif(VAR_23 < 2) {",
"if(VAR_23 == 0 && VAR_24 != 0) {",
"for(VAR_19 = 0, VAR_20 = VAR_14[1]; VAR_19 < 5; VAR_19++, VAR_20 += VAR_14[1]) {",
"cur_lp[VAR_20] = VAR_12;",
"cur_lp[VAR_20+1] = VAR_13;",
"cur_lp[0] = ((cur_lp[-VAR_14[1]] >> 1) + (cur_lp[VAR_14[1]] >> 1)) & 0xFEFEFEFE;",
"cur_lp[1] = ((cur_lp[-VAR_14[1]+1] >> 1) + (cur_lp[VAR_14[1]+1] >> 1)) & 0xFEFEFEFE;",
"} else {",
"for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 6 - (VAR_23 * 2); VAR_19++, VAR_20 += VAR_14[1]) {",
"cur_lp[VAR_20] = VAR_12;",
"cur_lp[VAR_20+1] = VAR_13;",
"VAR_23 = 3;",
"case 8:\nif(VAR_23 == 0) {",
"RLE_V3_CHECK(VAR_5,VAR_29,VAR_30,VAR_31)\nif(VAR_29 == 1) {",
"if(VAR_24 != 0) {",
"for(VAR_19 = 0, VAR_20 = VAR_14[1]; VAR_19 < 7; VAR_19++, VAR_20 += VAR_14[1]) {",
"cur_lp[VAR_20] = VAR_12;",
"cur_lp[VAR_20+1] = VAR_13;",
"cur_lp[0] = ((cur_lp[-VAR_14[1]] >> 1) + (cur_lp[VAR_14[1]] >> 1)) & 0xFEFEFEFE;",
"cur_lp[1] = ((cur_lp[-VAR_14[1]+1] >> 1) + (cur_lp[VAR_14[1]+1] >> 1)) & 0xFEFEFEFE;",
"} else {",
"for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 8; VAR_19++, VAR_20 += VAR_14[1]) {",
"cur_lp[VAR_20] = VAR_12;",
"cur_lp[VAR_20+1] = VAR_13;",
"RLE_V2_CHECK(VAR_5,VAR_30, VAR_31,VAR_23)\n} else {",
"VAR_29 = 1;",
"VAR_30 = (*VAR_5) - 1;",
"case 5:\nLP2_CHECK(VAR_5,VAR_31,VAR_23)\ncase 4:\nif(VAR_23 == 0 && VAR_24 != 0) {",
"for(VAR_19 = 0, VAR_20 = VAR_14[1]; VAR_19 < 7; VAR_19++, VAR_20 += VAR_14[1]) {",
"cur_lp[VAR_20] = VAR_12;",
"cur_lp[VAR_20+1] = VAR_13;",
"cur_lp[0] = ((cur_lp[-VAR_14[1]] >> 1) + (cur_lp[VAR_14[1]] >> 1)) & 0xFEFEFEFE;",
"cur_lp[1] = ((cur_lp[-VAR_14[1]+1] >> 1) + (cur_lp[VAR_14[1]+1] >> 1)) & 0xFEFEFEFE;",
"} else {",
"for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 8 - (VAR_23 * 2); VAR_19++, VAR_20 += VAR_14[1]) {",
"cur_lp[VAR_20] = VAR_12;",
"cur_lp[VAR_20+1] = VAR_13;",
"VAR_23 = 4;",
"case 6:\nVAR_23 = 4;",
"case 7:\nif(VAR_23 == 0) {",
"if(VAR_31 != 0)\nVAR_31 = 0;",
"else {",
"VAR_5--;",
"VAR_31 = 1;",
"VAR_23 = 4;",
"case 9:\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"UNTESTED.\\n\");",
"VAR_12 = *VAR_5;",
"VAR_11 = (VAR_12 & 0x7F) << 1;",
"VAR_11 += (VAR_11 << 8);",
"VAR_11 += (VAR_11 << 16);",
"for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 8; VAR_19++, VAR_20 += VAR_14[1])",
"cur_lp[VAR_20] = VAR_11;",
"LV1_CHECK(VAR_5,VAR_31,VAR_12,VAR_23)\ndefault:\nreturn;",
"cur_frm_pos += 8;",
"cur_frm_pos += (((VAR_3 * 2) - VAR_26) * 4);",
"VAR_24 = 0;",
"} else {",
"for( ; VAR_27 > 0; VAR_27 -= 8) {",
"for(VAR_22 = 0; VAR_22 < VAR_26; VAR_22 += 2) {",
"for(VAR_23 = 0; VAR_23 < 4; ) {",
"VAR_21 = *VAR_5++;",
"cur_lp = ((uint32_t *)cur_frm_pos) + VAR_14[VAR_23 * 2];",
"ref_lp = ((uint32_t *)ref_frm_pos) + VAR_14[VAR_23 * 2];",
"switch(correction_type_sp[VAR_23 & 0x01][VAR_21]) {",
"case 0:\nVAR_12 = correctionloworder_lp[VAR_23 & 0x01][VAR_21];",
"VAR_13 = correctionhighorder_lp[VAR_23 & 0x01][VAR_21];",
"cur_lp[0] = le2me_32(((le2me_32(ref_lp[0]) >> 1) + VAR_12) << 1);",
"cur_lp[1] = le2me_32(((le2me_32(ref_lp[1]) >> 1) + VAR_13) << 1);",
"cur_lp[VAR_14[1]] = le2me_32(((le2me_32(ref_lp[VAR_14[1]]) >> 1) + VAR_12) << 1);",
"cur_lp[VAR_14[1]+1] = le2me_32(((le2me_32(ref_lp[VAR_14[1]+1]) >> 1) + VAR_13) << 1);",
"VAR_23++;",
"case 1:\nVAR_12 = correctionloworder_lp[VAR_23 & 0x01][*VAR_5++];",
"VAR_13 = correctionloworder_lp[VAR_23 & 0x01][VAR_21];",
"cur_lp[0] = le2me_32(((le2me_32(ref_lp[0]) >> 1) + VAR_12) << 1);",
"cur_lp[1] = le2me_32(((le2me_32(ref_lp[1]) >> 1) + VAR_13) << 1);",
"cur_lp[VAR_14[1]] = le2me_32(((le2me_32(ref_lp[VAR_14[1]]) >> 1) + VAR_12) << 1);",
"cur_lp[VAR_14[1]+1] = le2me_32(((le2me_32(ref_lp[VAR_14[1]+1]) >> 1) + VAR_13) << 1);",
"VAR_23++;",
"case 2:\nif(VAR_23 == 0) {",
"for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 4; VAR_19++, VAR_20 += VAR_14[1]) {",
"cur_lp[VAR_20] = ref_lp[VAR_20];",
"cur_lp[VAR_20+1] = ref_lp[VAR_20+1];",
"VAR_23 += 2;",
"case 3:\nif(VAR_23 < 2) {",
"for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 6 - (VAR_23 * 2); VAR_19++, VAR_20 += VAR_14[1]) {",
"cur_lp[VAR_20] = ref_lp[VAR_20];",
"cur_lp[VAR_20+1] = ref_lp[VAR_20+1];",
"VAR_23 = 3;",
"case 8:\nif(VAR_23 == 0) {",
"RLE_V3_CHECK(VAR_5,VAR_29,VAR_30,VAR_31)\nfor(VAR_19 = 0, VAR_20 = 0; VAR_19 < 8; VAR_19++, VAR_20 += VAR_14[1]) {",
"((uint32_t *)cur_frm_pos)[VAR_20] = ((uint32_t *)ref_frm_pos)[VAR_20];",
"((uint32_t *)cur_frm_pos)[VAR_20+1] = ((uint32_t *)ref_frm_pos)[VAR_20+1];",
"RLE_V2_CHECK(VAR_5,VAR_30, VAR_31,VAR_23)\n} else {",
"VAR_29 = 1;",
"VAR_30 = (*VAR_5) - 1;",
"case 5:\ncase 7:\nLP2_CHECK(VAR_5,VAR_31,VAR_23)\ncase 6:\ncase 4:\nfor(VAR_19 = 0, VAR_20 = 0; VAR_19 < 8 - (VAR_23 * 2); VAR_19++, VAR_20 += VAR_14[1]) {",
"cur_lp[VAR_20] = ref_lp[VAR_20];",
"cur_lp[VAR_20+1] = ref_lp[VAR_20+1];",
"VAR_23 = 4;",
"case 9:\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"UNTESTED.\\n\");",
"VAR_12 = *VAR_5;",
"VAR_11 = (VAR_12 & 0x7F) << 1;",
"VAR_11 += (VAR_11 << 8);",
"VAR_11 += (VAR_11 << 16);",
"for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 8; VAR_19++, VAR_20 += VAR_14[1])",
"((uint32_t *)cur_frm_pos)[VAR_20] = ((uint32_t *)cur_frm_pos)[VAR_20+1] = VAR_11;",
"LV1_CHECK(VAR_5,VAR_31,VAR_12,VAR_23)\ndefault:\nreturn;",
"cur_frm_pos += 8;",
"ref_frm_pos += 8;",
"cur_frm_pos += (((VAR_3 * 2) - VAR_26) * 4);",
"ref_frm_pos += (((VAR_3 * 2) - VAR_26) * 4);",
"case 11:\nif(VAR_16 == NULL)\nreturn;",
"for( ; VAR_27 > 0; VAR_27 -= 8) {",
"for(VAR_22 = 0; VAR_22 < VAR_26; VAR_22++) {",
"for(VAR_23 = 0; VAR_23 < 4; ) {",
"VAR_21 = *VAR_5++;",
"cur_lp = ((uint32_t *)cur_frm_pos) + VAR_14[VAR_23 * 2];",
"ref_lp = ((uint32_t *)ref_frm_pos) + VAR_14[VAR_23 * 2];",
"switch(correction_type_sp[VAR_23 & 0x01][VAR_21]) {",
"case 0:\ncur_lp[0] = le2me_32(((le2me_32(*ref_lp) >> 1) + VAR_17[VAR_23 & 0x01][VAR_21]) << 1);",
"cur_lp[VAR_14[1]] = le2me_32(((le2me_32(ref_lp[VAR_14[1]]) >> 1) + VAR_17[VAR_23 & 0x01][VAR_21]) << 1);",
"VAR_23++;",
"case 1:\nVAR_12 = (unsigned short)(VAR_17[VAR_23 & 0x01][*VAR_5++]);",
"VAR_13 = (unsigned short)(VAR_17[VAR_23 & 0x01][VAR_21]);",
"VAR_32 = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[0]) >> 1) + VAR_12) << 1);",
"((unsigned short *)cur_lp)[0] = le2me_16(VAR_32);",
"VAR_32 = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[1]) >> 1) + VAR_13) << 1);",
"((unsigned short *)cur_lp)[1] = le2me_16(VAR_32);",
"VAR_32 = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[VAR_14[2]]) >> 1) + VAR_12) << 1);",
"((unsigned short *)cur_lp)[VAR_14[2]] = le2me_16(VAR_32);",
"VAR_32 = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[VAR_14[2]+1]) >> 1) + VAR_13) << 1);",
"((unsigned short *)cur_lp)[VAR_14[2]+1] = le2me_16(VAR_32);",
"VAR_23++;",
"case 2:\nif(VAR_23 == 0) {",
"for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 4; VAR_19++, VAR_20 += VAR_14[1])",
"cur_lp[VAR_20] = ref_lp[VAR_20];",
"VAR_23 += 2;",
"case 3:\nif(VAR_23 < 2) {",
"for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 6 - (VAR_23 * 2); VAR_19++, VAR_20 += VAR_14[1])",
"cur_lp[VAR_20] = ref_lp[VAR_20];",
"VAR_23 = 3;",
"case 8:\nif(VAR_23 == 0) {",
"RLE_V3_CHECK(VAR_5,VAR_29,VAR_30,VAR_31)\nfor(VAR_19 = 0, VAR_20 = 0; VAR_19 < 8; VAR_19++, VAR_20 += VAR_14[1])",
"cur_lp[VAR_20] = ref_lp[VAR_20];",
"RLE_V2_CHECK(VAR_5,VAR_30, VAR_31,VAR_23)\n} else {",
"VAR_29 = 1;",
"VAR_30 = (*VAR_5) - 1;",
"case 5:\ncase 7:\nLP2_CHECK(VAR_5,VAR_31,VAR_23)\ncase 4:\ncase 6:\nfor(VAR_19 = 0, VAR_20 = 0; VAR_19 < 8 - (VAR_23 * 2); VAR_19++, VAR_20 += VAR_14[1])",
"cur_lp[VAR_20] = ref_lp[VAR_20];",
"VAR_23 = 4;",
"case 9:\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"UNTESTED.\\n\");",
"VAR_12 = *VAR_5++;",
"VAR_11 = (VAR_12 & 0x7F) << 1;",
"VAR_11 += (VAR_11 << 8);",
"VAR_11 += (VAR_11 << 16);",
"for(VAR_19 = 0, VAR_20 = 0; VAR_19 < 4; VAR_19++, VAR_20 += VAR_14[1])",
"cur_lp[VAR_20] = VAR_11;",
"LV1_CHECK(VAR_5,VAR_31,VAR_12,VAR_23)\ndefault:\nreturn;",
"cur_frm_pos += 4;",
"ref_frm_pos += 4;",
"cur_frm_pos += (((VAR_3 * 2) - VAR_26) * 4);",
"ref_frm_pos += (((VAR_3 * 2) - VAR_26) * 4);",
"default:\nreturn;",
"if(strip < VAR_18)\nreturn;",
"for( ; strip >= VAR_18; strip--) {",
"if(strip->split_flag != 0) {",
"strip->split_flag = 0;",
"strip->usl7 = (strip-1)->usl7;",
"if(strip->split_direction) {",
"strip->xpos += strip->VAR_3;",
"strip->VAR_3 = (strip-1)->VAR_3 - strip->VAR_3;",
"if(VAR_28 <= strip->xpos && VAR_3 < strip->VAR_3 + strip->xpos)\nstrip->VAR_3 = VAR_3 - strip->xpos;",
"} else {",
"strip->ypos += strip->VAR_4;",
"strip->VAR_4 = (strip-1)->VAR_4 - strip->VAR_4;"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
37
],
[
39
],
[
43
],
[
45
],
[
47
],
[
49
],
[
53
],
[
57
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
75
],
[
79
],
[
83
],
[
85
],
[
87
],
[
89
],
[
94
],
[
96
],
[
100
],
[
102
],
[
108
],
[
110
],
[
112
],
[
114
],
[
116
],
[
118
],
[
120
],
[
126
],
[
128
],
[
130
],
[
132
],
[
134
],
[
136
],
[
138
],
[
140
],
[
142
],
[
144
],
[
147
],
[
149
],
[
151
],
[
153
],
[
155
],
[
157
],
[
163
],
[
167,
169
],
[
171
],
[
173
],
[
177
],
[
179,
181
],
[
183
],
[
185
],
[
189
],
[
191
],
[
193
],
[
195
],
[
200
],
[
202
],
[
206
],
[
208
],
[
210
],
[
212
],
[
214
],
[
216
],
[
219
],
[
221
],
[
223
],
[
225
],
[
227
],
[
229
],
[
231
],
[
235
],
[
237
],
[
239
],
[
241
],
[
243
],
[
245
],
[
251
],
[
253
],
[
255
],
[
257
],
[
259
],
[
261
],
[
263
],
[
265
],
[
267
],
[
269
],
[
271
],
[
273
],
[
278
],
[
280,
282,
284
],
[
286
],
[
288
],
[
290
],
[
292
],
[
294
],
[
298
],
[
300,
302
],
[
304
],
[
307,
309
],
[
311
],
[
313
],
[
315
],
[
317
],
[
319
],
[
322,
324
],
[
326
],
[
328
],
[
330
],
[
334,
336
],
[
338
],
[
340
],
[
342
],
[
346,
348
],
[
350,
354
],
[
356
],
[
358
],
[
363,
366
],
[
368
],
[
370
],
[
373,
375,
377,
379
],
[
381
],
[
383
],
[
388,
390,
392
],
[
394
],
[
396
],
[
398
],
[
401,
403
],
[
405
],
[
407
],
[
410
],
[
415,
417
],
[
419
],
[
421
],
[
423
],
[
425
],
[
427
],
[
431,
434,
436
],
[
442
],
[
444
],
[
449
],
[
451
],
[
457,
459,
461,
463
],
[
465
],
[
469
],
[
471
],
[
473
],
[
475
],
[
479
],
[
481
],
[
485
],
[
487,
489
],
[
491,
493
],
[
495,
497
],
[
499
],
[
504,
506
],
[
508
],
[
510
],
[
512
],
[
516,
518
],
[
520,
522
],
[
524
],
[
526
],
[
531,
533
],
[
535
],
[
537
],
[
539
],
[
545,
547
],
[
549
],
[
551
],
[
553
],
[
559,
561
],
[
566,
568,
570
],
[
572
],
[
574
],
[
576
],
[
579
],
[
584,
586
],
[
588,
592
],
[
594
],
[
596
],
[
601,
604
],
[
606
],
[
608
],
[
611,
613,
615,
617
],
[
619
],
[
621
],
[
626,
628
],
[
630
],
[
632
],
[
634
],
[
636
],
[
640
],
[
642
],
[
646,
651,
653
],
[
659
],
[
664
],
[
666
],
[
672,
674
],
[
676
],
[
680
],
[
682
],
[
684
],
[
686
],
[
688
],
[
690
],
[
692
],
[
694
],
[
696
],
[
698,
700
],
[
702
],
[
704
],
[
706
],
[
708,
710
],
[
712
],
[
714
],
[
716
],
[
718,
723
],
[
725,
727
],
[
729
],
[
731
],
[
733
],
[
735
],
[
737
],
[
739
],
[
741
],
[
744
],
[
749,
751
],
[
753
],
[
755
],
[
757
],
[
759
],
[
761
],
[
763
],
[
765
],
[
768
],
[
770
],
[
775,
777
],
[
779
],
[
781
],
[
783
],
[
785
],
[
788
],
[
790
],
[
792
],
[
794
],
[
796
],
[
798
],
[
802
],
[
808,
810
],
[
812
],
[
814
],
[
816
],
[
818
],
[
821
],
[
823
],
[
825
],
[
827
],
[
829
],
[
831
],
[
835
],
[
841,
843
],
[
845,
847
],
[
849
],
[
851
],
[
853
],
[
855
],
[
858
],
[
860
],
[
862
],
[
864
],
[
866
],
[
868
],
[
873,
876
],
[
878
],
[
880
],
[
883,
885,
887,
889
],
[
891
],
[
893
],
[
895
],
[
898
],
[
900
],
[
902
],
[
904
],
[
906
],
[
908
],
[
912
],
[
917,
919
],
[
924,
926
],
[
928,
930
],
[
932
],
[
934
],
[
936
],
[
939
],
[
945,
947
],
[
949
],
[
951
],
[
953
],
[
955
],
[
957
],
[
959
],
[
961,
966,
968
],
[
974
],
[
979
],
[
981
],
[
984
],
[
986
],
[
988
],
[
990
],
[
992
],
[
994
],
[
996
],
[
1000
],
[
1002,
1004
],
[
1006
],
[
1008
],
[
1010
],
[
1012
],
[
1014
],
[
1016
],
[
1021,
1023
],
[
1025
],
[
1027
],
[
1029
],
[
1031
],
[
1033
],
[
1035
],
[
1040,
1042
],
[
1044
],
[
1046
],
[
1048
],
[
1051
],
[
1057,
1059
],
[
1061
],
[
1063
],
[
1065
],
[
1068
],
[
1074,
1076
],
[
1078,
1080
],
[
1082
],
[
1084
],
[
1087,
1090
],
[
1092
],
[
1094
],
[
1097,
1099,
1101,
1103,
1105,
1107
],
[
1109
],
[
1111
],
[
1114
],
[
1119,
1121
],
[
1123
],
[
1125
],
[
1127
],
[
1129
],
[
1131
],
[
1133
],
[
1135,
1140,
1142
],
[
1148
],
[
1150
],
[
1155
],
[
1157
],
[
1164,
1166,
1168
],
[
1172
],
[
1174
],
[
1176
],
[
1178
],
[
1180
],
[
1182
],
[
1186
],
[
1188,
1190
],
[
1192
],
[
1194
],
[
1199,
1201
],
[
1203
],
[
1205
],
[
1207
],
[
1209
],
[
1211
],
[
1213
],
[
1215
],
[
1217
],
[
1219
],
[
1221
],
[
1226,
1228
],
[
1230
],
[
1232
],
[
1234
],
[
1240,
1242
],
[
1244
],
[
1246
],
[
1248
],
[
1254,
1256
],
[
1258,
1262
],
[
1264
],
[
1268,
1271
],
[
1273
],
[
1275
],
[
1278,
1280,
1282,
1284,
1286,
1288
],
[
1290
],
[
1292
],
[
1297,
1299
],
[
1301
],
[
1303
],
[
1305
],
[
1307
],
[
1309
],
[
1311
],
[
1313,
1318,
1320
],
[
1326
],
[
1328
],
[
1333
],
[
1335
],
[
1341,
1343
],
[
1349,
1351
],
[
1355
],
[
1357
],
[
1359
],
[
1361
],
[
1365
],
[
1367
],
[
1369
],
[
1371,
1373
],
[
1375
],
[
1377
],
[
1379
]
] |
6,350 |
static av_always_inline void get_mvdata_interlaced(VC1Context *v, int *dmv_x,
int *dmv_y, int *pred_flag)
{
int index, index1;
int extend_x = 0, extend_y = 0;
GetBitContext *gb = &v->s.gb;
int bits, esc;
int val, sign;
const int* offs_tab;
if (v->numref) {
bits = VC1_2REF_MVDATA_VLC_BITS;
esc = 125;
} else {
bits = VC1_1REF_MVDATA_VLC_BITS;
esc = 71;
}
switch (v->dmvrange) {
case 1:
extend_x = 1;
break;
case 2:
extend_y = 1;
break;
case 3:
extend_x = extend_y = 1;
break;
}
index = get_vlc2(gb, v->imv_vlc->table, bits, 3);
if (index == esc) {
*dmv_x = get_bits(gb, v->k_x);
*dmv_y = get_bits(gb, v->k_y);
if (v->numref) {
*pred_flag = *dmv_y & 1;
*dmv_y = (*dmv_y + *pred_flag) >> 1;
}
}
else {
if (extend_x)
offs_tab = offset_table2;
else
offs_tab = offset_table1;
index1 = (index + 1) % 9;
if (index1 != 0) {
val = get_bits(gb, index1 + extend_x);
sign = 0 -(val & 1);
*dmv_x = (sign ^ ((val >> 1) + offs_tab[index1])) - sign;
} else
*dmv_x = 0;
if (extend_y)
offs_tab = offset_table2;
else
offs_tab = offset_table1;
index1 = (index + 1) / 9;
if (index1 > v->numref) {
val = get_bits(gb, (index1 + (extend_y << v->numref)) >> v->numref);
sign = 0 - (val & 1);
*dmv_y = (sign ^ ((val >> 1) + offs_tab[index1 >> v->numref])) - sign;
} else
*dmv_y = 0;
if (v->numref)
*pred_flag = index1 & 1;
}
}
| true |
FFmpeg
|
7b8c5b263bc680eff5710bee5994de39d47fc15e
|
static av_always_inline void get_mvdata_interlaced(VC1Context *v, int *dmv_x,
int *dmv_y, int *pred_flag)
{
int index, index1;
int extend_x = 0, extend_y = 0;
GetBitContext *gb = &v->s.gb;
int bits, esc;
int val, sign;
const int* offs_tab;
if (v->numref) {
bits = VC1_2REF_MVDATA_VLC_BITS;
esc = 125;
} else {
bits = VC1_1REF_MVDATA_VLC_BITS;
esc = 71;
}
switch (v->dmvrange) {
case 1:
extend_x = 1;
break;
case 2:
extend_y = 1;
break;
case 3:
extend_x = extend_y = 1;
break;
}
index = get_vlc2(gb, v->imv_vlc->table, bits, 3);
if (index == esc) {
*dmv_x = get_bits(gb, v->k_x);
*dmv_y = get_bits(gb, v->k_y);
if (v->numref) {
*pred_flag = *dmv_y & 1;
*dmv_y = (*dmv_y + *pred_flag) >> 1;
}
}
else {
if (extend_x)
offs_tab = offset_table2;
else
offs_tab = offset_table1;
index1 = (index + 1) % 9;
if (index1 != 0) {
val = get_bits(gb, index1 + extend_x);
sign = 0 -(val & 1);
*dmv_x = (sign ^ ((val >> 1) + offs_tab[index1])) - sign;
} else
*dmv_x = 0;
if (extend_y)
offs_tab = offset_table2;
else
offs_tab = offset_table1;
index1 = (index + 1) / 9;
if (index1 > v->numref) {
val = get_bits(gb, (index1 + (extend_y << v->numref)) >> v->numref);
sign = 0 - (val & 1);
*dmv_y = (sign ^ ((val >> 1) + offs_tab[index1 >> v->numref])) - sign;
} else
*dmv_y = 0;
if (v->numref)
*pred_flag = index1 & 1;
}
}
|
{
"code": [
" *pred_flag = *dmv_y & 1;",
" *dmv_y = (*dmv_y + *pred_flag) >> 1;",
" if (v->numref)"
],
"line_no": [
67,
69,
121
]
}
|
static av_always_inline void FUNC_0(VC1Context *v, int *dmv_x,
int *dmv_y, int *pred_flag)
{
int VAR_0, VAR_1;
int VAR_2 = 0, VAR_3 = 0;
GetBitContext *gb = &v->s.gb;
int VAR_4, VAR_5;
int VAR_6, VAR_7;
const int* VAR_8;
if (v->numref) {
VAR_4 = VC1_2REF_MVDATA_VLC_BITS;
VAR_5 = 125;
} else {
VAR_4 = VC1_1REF_MVDATA_VLC_BITS;
VAR_5 = 71;
}
switch (v->dmvrange) {
case 1:
VAR_2 = 1;
break;
case 2:
VAR_3 = 1;
break;
case 3:
VAR_2 = VAR_3 = 1;
break;
}
VAR_0 = get_vlc2(gb, v->imv_vlc->table, VAR_4, 3);
if (VAR_0 == VAR_5) {
*dmv_x = get_bits(gb, v->k_x);
*dmv_y = get_bits(gb, v->k_y);
if (v->numref) {
*pred_flag = *dmv_y & 1;
*dmv_y = (*dmv_y + *pred_flag) >> 1;
}
}
else {
if (VAR_2)
VAR_8 = offset_table2;
else
VAR_8 = offset_table1;
VAR_1 = (VAR_0 + 1) % 9;
if (VAR_1 != 0) {
VAR_6 = get_bits(gb, VAR_1 + VAR_2);
VAR_7 = 0 -(VAR_6 & 1);
*dmv_x = (VAR_7 ^ ((VAR_6 >> 1) + VAR_8[VAR_1])) - VAR_7;
} else
*dmv_x = 0;
if (VAR_3)
VAR_8 = offset_table2;
else
VAR_8 = offset_table1;
VAR_1 = (VAR_0 + 1) / 9;
if (VAR_1 > v->numref) {
VAR_6 = get_bits(gb, (VAR_1 + (VAR_3 << v->numref)) >> v->numref);
VAR_7 = 0 - (VAR_6 & 1);
*dmv_y = (VAR_7 ^ ((VAR_6 >> 1) + VAR_8[VAR_1 >> v->numref])) - VAR_7;
} else
*dmv_y = 0;
if (v->numref)
*pred_flag = VAR_1 & 1;
}
}
|
[
"static av_always_inline void FUNC_0(VC1Context *v, int *dmv_x,\nint *dmv_y, int *pred_flag)\n{",
"int VAR_0, VAR_1;",
"int VAR_2 = 0, VAR_3 = 0;",
"GetBitContext *gb = &v->s.gb;",
"int VAR_4, VAR_5;",
"int VAR_6, VAR_7;",
"const int* VAR_8;",
"if (v->numref) {",
"VAR_4 = VC1_2REF_MVDATA_VLC_BITS;",
"VAR_5 = 125;",
"} else {",
"VAR_4 = VC1_1REF_MVDATA_VLC_BITS;",
"VAR_5 = 71;",
"}",
"switch (v->dmvrange) {",
"case 1:\nVAR_2 = 1;",
"break;",
"case 2:\nVAR_3 = 1;",
"break;",
"case 3:\nVAR_2 = VAR_3 = 1;",
"break;",
"}",
"VAR_0 = get_vlc2(gb, v->imv_vlc->table, VAR_4, 3);",
"if (VAR_0 == VAR_5) {",
"*dmv_x = get_bits(gb, v->k_x);",
"*dmv_y = get_bits(gb, v->k_y);",
"if (v->numref) {",
"*pred_flag = *dmv_y & 1;",
"*dmv_y = (*dmv_y + *pred_flag) >> 1;",
"}",
"}",
"else {",
"if (VAR_2)\nVAR_8 = offset_table2;",
"else\nVAR_8 = offset_table1;",
"VAR_1 = (VAR_0 + 1) % 9;",
"if (VAR_1 != 0) {",
"VAR_6 = get_bits(gb, VAR_1 + VAR_2);",
"VAR_7 = 0 -(VAR_6 & 1);",
"*dmv_x = (VAR_7 ^ ((VAR_6 >> 1) + VAR_8[VAR_1])) - VAR_7;",
"} else",
"*dmv_x = 0;",
"if (VAR_3)\nVAR_8 = offset_table2;",
"else\nVAR_8 = offset_table1;",
"VAR_1 = (VAR_0 + 1) / 9;",
"if (VAR_1 > v->numref) {",
"VAR_6 = get_bits(gb, (VAR_1 + (VAR_3 << v->numref)) >> v->numref);",
"VAR_7 = 0 - (VAR_6 & 1);",
"*dmv_y = (VAR_7 ^ ((VAR_6 >> 1) + VAR_8[VAR_1 >> v->numref])) - VAR_7;",
"} else",
"*dmv_y = 0;",
"if (v->numref)\n*pred_flag = VAR_1 & 1;",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
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,
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77,
79
],
[
81,
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99,
101
],
[
103,
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121,
123
],
[
125
],
[
127
]
] |
6,351 |
static int alloc_buffers(AVCodecContext *avctx)
{
CFHDContext *s = avctx->priv_data;
int i, j, k, ret, planes;
if ((ret = ff_set_dimensions(avctx, s->coded_width, s->coded_height)) < 0)
return ret;
avctx->pix_fmt = s->coded_format;
avcodec_get_chroma_sub_sample(avctx->pix_fmt, &s->chroma_x_shift, &s->chroma_y_shift);
planes = av_pix_fmt_count_planes(avctx->pix_fmt);
for (i = 0; i < planes; i++) {
int width = i ? avctx->width >> s->chroma_x_shift : avctx->width;
int height = i ? avctx->height >> s->chroma_y_shift : avctx->height;
int stride = FFALIGN(width / 8, 8) * 8;
int w8, h8, w4, h4, w2, h2;
height = FFALIGN(height / 8, 2) * 8;
s->plane[i].width = width;
s->plane[i].height = height;
s->plane[i].stride = stride;
w8 = FFALIGN(s->plane[i].width / 8, 8);
h8 = FFALIGN(s->plane[i].height / 8, 2);
w4 = w8 * 2;
h4 = h8 * 2;
w2 = w4 * 2;
h2 = h4 * 2;
s->plane[i].idwt_buf = av_malloc_array(height * stride, sizeof(*s->plane[i].idwt_buf));
s->plane[i].idwt_tmp = av_malloc_array(height * stride, sizeof(*s->plane[i].idwt_tmp));
if (!s->plane[i].idwt_buf || !s->plane[i].idwt_tmp) {
return AVERROR(ENOMEM);
}
s->plane[i].subband[0] = s->plane[i].idwt_buf;
s->plane[i].subband[1] = s->plane[i].idwt_buf + 2 * w8 * h8;
s->plane[i].subband[2] = s->plane[i].idwt_buf + 1 * w8 * h8;
s->plane[i].subband[3] = s->plane[i].idwt_buf + 3 * w8 * h8;
s->plane[i].subband[4] = s->plane[i].idwt_buf + 2 * w4 * h4;
s->plane[i].subband[5] = s->plane[i].idwt_buf + 1 * w4 * h4;
s->plane[i].subband[6] = s->plane[i].idwt_buf + 3 * w4 * h4;
s->plane[i].subband[7] = s->plane[i].idwt_buf + 2 * w2 * h2;
s->plane[i].subband[8] = s->plane[i].idwt_buf + 1 * w2 * h2;
s->plane[i].subband[9] = s->plane[i].idwt_buf + 3 * w2 * h2;
for (j = 0; j < DWT_LEVELS; j++) {
for(k = 0; k < 4; k++) {
s->plane[i].band[j][k].a_width = w8 << j;
s->plane[i].band[j][k].a_height = h8 << j;
}
}
/* ll2 and ll1 commented out because they are done in-place */
s->plane[i].l_h[0] = s->plane[i].idwt_tmp;
s->plane[i].l_h[1] = s->plane[i].idwt_tmp + 2 * w8 * h8;
//s->plane[i].l_h[2] = ll2;
s->plane[i].l_h[3] = s->plane[i].idwt_tmp;
s->plane[i].l_h[4] = s->plane[i].idwt_tmp + 2 * w4 * h4;
//s->plane[i].l_h[5] = ll1;
s->plane[i].l_h[6] = s->plane[i].idwt_tmp;
s->plane[i].l_h[7] = s->plane[i].idwt_tmp + 2 * w2 * h2;
}
s->a_height = s->coded_height;
s->a_width = s->coded_width;
s->a_format = s->coded_format;
return 0;
}
| true |
FFmpeg
|
5fb6e39dd1c3add4dc5bd7c7f0d8100d5aadad46
|
static int alloc_buffers(AVCodecContext *avctx)
{
CFHDContext *s = avctx->priv_data;
int i, j, k, ret, planes;
if ((ret = ff_set_dimensions(avctx, s->coded_width, s->coded_height)) < 0)
return ret;
avctx->pix_fmt = s->coded_format;
avcodec_get_chroma_sub_sample(avctx->pix_fmt, &s->chroma_x_shift, &s->chroma_y_shift);
planes = av_pix_fmt_count_planes(avctx->pix_fmt);
for (i = 0; i < planes; i++) {
int width = i ? avctx->width >> s->chroma_x_shift : avctx->width;
int height = i ? avctx->height >> s->chroma_y_shift : avctx->height;
int stride = FFALIGN(width / 8, 8) * 8;
int w8, h8, w4, h4, w2, h2;
height = FFALIGN(height / 8, 2) * 8;
s->plane[i].width = width;
s->plane[i].height = height;
s->plane[i].stride = stride;
w8 = FFALIGN(s->plane[i].width / 8, 8);
h8 = FFALIGN(s->plane[i].height / 8, 2);
w4 = w8 * 2;
h4 = h8 * 2;
w2 = w4 * 2;
h2 = h4 * 2;
s->plane[i].idwt_buf = av_malloc_array(height * stride, sizeof(*s->plane[i].idwt_buf));
s->plane[i].idwt_tmp = av_malloc_array(height * stride, sizeof(*s->plane[i].idwt_tmp));
if (!s->plane[i].idwt_buf || !s->plane[i].idwt_tmp) {
return AVERROR(ENOMEM);
}
s->plane[i].subband[0] = s->plane[i].idwt_buf;
s->plane[i].subband[1] = s->plane[i].idwt_buf + 2 * w8 * h8;
s->plane[i].subband[2] = s->plane[i].idwt_buf + 1 * w8 * h8;
s->plane[i].subband[3] = s->plane[i].idwt_buf + 3 * w8 * h8;
s->plane[i].subband[4] = s->plane[i].idwt_buf + 2 * w4 * h4;
s->plane[i].subband[5] = s->plane[i].idwt_buf + 1 * w4 * h4;
s->plane[i].subband[6] = s->plane[i].idwt_buf + 3 * w4 * h4;
s->plane[i].subband[7] = s->plane[i].idwt_buf + 2 * w2 * h2;
s->plane[i].subband[8] = s->plane[i].idwt_buf + 1 * w2 * h2;
s->plane[i].subband[9] = s->plane[i].idwt_buf + 3 * w2 * h2;
for (j = 0; j < DWT_LEVELS; j++) {
for(k = 0; k < 4; k++) {
s->plane[i].band[j][k].a_width = w8 << j;
s->plane[i].band[j][k].a_height = h8 << j;
}
}
s->plane[i].l_h[0] = s->plane[i].idwt_tmp;
s->plane[i].l_h[1] = s->plane[i].idwt_tmp + 2 * w8 * h8;
s->plane[i].l_h[3] = s->plane[i].idwt_tmp;
s->plane[i].l_h[4] = s->plane[i].idwt_tmp + 2 * w4 * h4;
s->plane[i].l_h[6] = s->plane[i].idwt_tmp;
s->plane[i].l_h[7] = s->plane[i].idwt_tmp + 2 * w2 * h2;
}
s->a_height = s->coded_height;
s->a_width = s->coded_width;
s->a_format = s->coded_format;
return 0;
}
|
{
"code": [
" s->plane[i].idwt_buf = av_malloc_array(height * stride, sizeof(*s->plane[i].idwt_buf));"
],
"line_no": [
59
]
}
|
static int FUNC_0(AVCodecContext *VAR_0)
{
CFHDContext *s = VAR_0->priv_data;
int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5;
if ((VAR_4 = ff_set_dimensions(VAR_0, s->coded_width, s->coded_height)) < 0)
return VAR_4;
VAR_0->pix_fmt = s->coded_format;
avcodec_get_chroma_sub_sample(VAR_0->pix_fmt, &s->chroma_x_shift, &s->chroma_y_shift);
VAR_5 = av_pix_fmt_count_planes(VAR_0->pix_fmt);
for (VAR_1 = 0; VAR_1 < VAR_5; VAR_1++) {
int VAR_6 = VAR_1 ? VAR_0->VAR_6 >> s->chroma_x_shift : VAR_0->VAR_6;
int VAR_7 = VAR_1 ? VAR_0->VAR_7 >> s->chroma_y_shift : VAR_0->VAR_7;
int VAR_8 = FFALIGN(VAR_6 / 8, 8) * 8;
int VAR_9, VAR_10, VAR_11, VAR_12, VAR_13, VAR_14;
VAR_7 = FFALIGN(VAR_7 / 8, 2) * 8;
s->plane[VAR_1].VAR_6 = VAR_6;
s->plane[VAR_1].VAR_7 = VAR_7;
s->plane[VAR_1].VAR_8 = VAR_8;
VAR_9 = FFALIGN(s->plane[VAR_1].VAR_6 / 8, 8);
VAR_10 = FFALIGN(s->plane[VAR_1].VAR_7 / 8, 2);
VAR_11 = VAR_9 * 2;
VAR_12 = VAR_10 * 2;
VAR_13 = VAR_11 * 2;
VAR_14 = VAR_12 * 2;
s->plane[VAR_1].idwt_buf = av_malloc_array(VAR_7 * VAR_8, sizeof(*s->plane[VAR_1].idwt_buf));
s->plane[VAR_1].idwt_tmp = av_malloc_array(VAR_7 * VAR_8, sizeof(*s->plane[VAR_1].idwt_tmp));
if (!s->plane[VAR_1].idwt_buf || !s->plane[VAR_1].idwt_tmp) {
return AVERROR(ENOMEM);
}
s->plane[VAR_1].subband[0] = s->plane[VAR_1].idwt_buf;
s->plane[VAR_1].subband[1] = s->plane[VAR_1].idwt_buf + 2 * VAR_9 * VAR_10;
s->plane[VAR_1].subband[2] = s->plane[VAR_1].idwt_buf + 1 * VAR_9 * VAR_10;
s->plane[VAR_1].subband[3] = s->plane[VAR_1].idwt_buf + 3 * VAR_9 * VAR_10;
s->plane[VAR_1].subband[4] = s->plane[VAR_1].idwt_buf + 2 * VAR_11 * VAR_12;
s->plane[VAR_1].subband[5] = s->plane[VAR_1].idwt_buf + 1 * VAR_11 * VAR_12;
s->plane[VAR_1].subband[6] = s->plane[VAR_1].idwt_buf + 3 * VAR_11 * VAR_12;
s->plane[VAR_1].subband[7] = s->plane[VAR_1].idwt_buf + 2 * VAR_13 * VAR_14;
s->plane[VAR_1].subband[8] = s->plane[VAR_1].idwt_buf + 1 * VAR_13 * VAR_14;
s->plane[VAR_1].subband[9] = s->plane[VAR_1].idwt_buf + 3 * VAR_13 * VAR_14;
for (VAR_2 = 0; VAR_2 < DWT_LEVELS; VAR_2++) {
for(VAR_3 = 0; VAR_3 < 4; VAR_3++) {
s->plane[VAR_1].band[VAR_2][VAR_3].a_width = VAR_9 << VAR_2;
s->plane[VAR_1].band[VAR_2][VAR_3].a_height = VAR_10 << VAR_2;
}
}
s->plane[VAR_1].l_h[0] = s->plane[VAR_1].idwt_tmp;
s->plane[VAR_1].l_h[1] = s->plane[VAR_1].idwt_tmp + 2 * VAR_9 * VAR_10;
s->plane[VAR_1].l_h[3] = s->plane[VAR_1].idwt_tmp;
s->plane[VAR_1].l_h[4] = s->plane[VAR_1].idwt_tmp + 2 * VAR_11 * VAR_12;
s->plane[VAR_1].l_h[6] = s->plane[VAR_1].idwt_tmp;
s->plane[VAR_1].l_h[7] = s->plane[VAR_1].idwt_tmp + 2 * VAR_13 * VAR_14;
}
s->a_height = s->coded_height;
s->a_width = s->coded_width;
s->a_format = s->coded_format;
return 0;
}
|
[
"static int FUNC_0(AVCodecContext *VAR_0)\n{",
"CFHDContext *s = VAR_0->priv_data;",
"int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5;",
"if ((VAR_4 = ff_set_dimensions(VAR_0, s->coded_width, s->coded_height)) < 0)\nreturn VAR_4;",
"VAR_0->pix_fmt = s->coded_format;",
"avcodec_get_chroma_sub_sample(VAR_0->pix_fmt, &s->chroma_x_shift, &s->chroma_y_shift);",
"VAR_5 = av_pix_fmt_count_planes(VAR_0->pix_fmt);",
"for (VAR_1 = 0; VAR_1 < VAR_5; VAR_1++) {",
"int VAR_6 = VAR_1 ? VAR_0->VAR_6 >> s->chroma_x_shift : VAR_0->VAR_6;",
"int VAR_7 = VAR_1 ? VAR_0->VAR_7 >> s->chroma_y_shift : VAR_0->VAR_7;",
"int VAR_8 = FFALIGN(VAR_6 / 8, 8) * 8;",
"int VAR_9, VAR_10, VAR_11, VAR_12, VAR_13, VAR_14;",
"VAR_7 = FFALIGN(VAR_7 / 8, 2) * 8;",
"s->plane[VAR_1].VAR_6 = VAR_6;",
"s->plane[VAR_1].VAR_7 = VAR_7;",
"s->plane[VAR_1].VAR_8 = VAR_8;",
"VAR_9 = FFALIGN(s->plane[VAR_1].VAR_6 / 8, 8);",
"VAR_10 = FFALIGN(s->plane[VAR_1].VAR_7 / 8, 2);",
"VAR_11 = VAR_9 * 2;",
"VAR_12 = VAR_10 * 2;",
"VAR_13 = VAR_11 * 2;",
"VAR_14 = VAR_12 * 2;",
"s->plane[VAR_1].idwt_buf = av_malloc_array(VAR_7 * VAR_8, sizeof(*s->plane[VAR_1].idwt_buf));",
"s->plane[VAR_1].idwt_tmp = av_malloc_array(VAR_7 * VAR_8, sizeof(*s->plane[VAR_1].idwt_tmp));",
"if (!s->plane[VAR_1].idwt_buf || !s->plane[VAR_1].idwt_tmp) {",
"return AVERROR(ENOMEM);",
"}",
"s->plane[VAR_1].subband[0] = s->plane[VAR_1].idwt_buf;",
"s->plane[VAR_1].subband[1] = s->plane[VAR_1].idwt_buf + 2 * VAR_9 * VAR_10;",
"s->plane[VAR_1].subband[2] = s->plane[VAR_1].idwt_buf + 1 * VAR_9 * VAR_10;",
"s->plane[VAR_1].subband[3] = s->plane[VAR_1].idwt_buf + 3 * VAR_9 * VAR_10;",
"s->plane[VAR_1].subband[4] = s->plane[VAR_1].idwt_buf + 2 * VAR_11 * VAR_12;",
"s->plane[VAR_1].subband[5] = s->plane[VAR_1].idwt_buf + 1 * VAR_11 * VAR_12;",
"s->plane[VAR_1].subband[6] = s->plane[VAR_1].idwt_buf + 3 * VAR_11 * VAR_12;",
"s->plane[VAR_1].subband[7] = s->plane[VAR_1].idwt_buf + 2 * VAR_13 * VAR_14;",
"s->plane[VAR_1].subband[8] = s->plane[VAR_1].idwt_buf + 1 * VAR_13 * VAR_14;",
"s->plane[VAR_1].subband[9] = s->plane[VAR_1].idwt_buf + 3 * VAR_13 * VAR_14;",
"for (VAR_2 = 0; VAR_2 < DWT_LEVELS; VAR_2++) {",
"for(VAR_3 = 0; VAR_3 < 4; VAR_3++) {",
"s->plane[VAR_1].band[VAR_2][VAR_3].a_width = VAR_9 << VAR_2;",
"s->plane[VAR_1].band[VAR_2][VAR_3].a_height = VAR_10 << VAR_2;",
"}",
"}",
"s->plane[VAR_1].l_h[0] = s->plane[VAR_1].idwt_tmp;",
"s->plane[VAR_1].l_h[1] = s->plane[VAR_1].idwt_tmp + 2 * VAR_9 * VAR_10;",
"s->plane[VAR_1].l_h[3] = s->plane[VAR_1].idwt_tmp;",
"s->plane[VAR_1].l_h[4] = s->plane[VAR_1].idwt_tmp + 2 * VAR_11 * VAR_12;",
"s->plane[VAR_1].l_h[6] = s->plane[VAR_1].idwt_tmp;",
"s->plane[VAR_1].l_h[7] = s->plane[VAR_1].idwt_tmp + 2 * VAR_13 * VAR_14;",
"}",
"s->a_height = s->coded_height;",
"s->a_width = s->coded_width;",
"s->a_format = s->coded_format;",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
19
],
[
21
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
109
],
[
111
],
[
115
],
[
117
],
[
121
],
[
123
],
[
125
],
[
129
],
[
131
],
[
133
],
[
137
],
[
139
]
] |
6,353 |
static int frame_start(MpegEncContext *s)
{
int ret;
/* mark & release old frames */
if (s->pict_type != AV_PICTURE_TYPE_B && s->last_picture_ptr &&
s->last_picture_ptr != s->next_picture_ptr &&
s->last_picture_ptr->f.buf[0]) {
ff_mpeg_unref_picture(s, s->last_picture_ptr);
}
s->current_picture_ptr->f.pict_type = s->pict_type;
s->current_picture_ptr->f.key_frame = s->pict_type == AV_PICTURE_TYPE_I;
ff_mpeg_unref_picture(s, &s->current_picture);
if ((ret = ff_mpeg_ref_picture(s, &s->current_picture,
s->current_picture_ptr)) < 0)
return ret;
if (s->pict_type != AV_PICTURE_TYPE_B) {
s->last_picture_ptr = s->next_picture_ptr;
if (!s->droppable)
s->next_picture_ptr = s->current_picture_ptr;
}
if (s->last_picture_ptr) {
ff_mpeg_unref_picture(s, &s->last_picture);
if (s->last_picture_ptr->f.buf[0] &&
(ret = ff_mpeg_ref_picture(s, &s->last_picture,
s->last_picture_ptr)) < 0)
return ret;
}
if (s->next_picture_ptr) {
ff_mpeg_unref_picture(s, &s->next_picture);
if (s->next_picture_ptr->f.buf[0] &&
(ret = ff_mpeg_ref_picture(s, &s->next_picture,
s->next_picture_ptr)) < 0)
return ret;
}
if (s->picture_structure!= PICT_FRAME) {
int i;
for (i = 0; i < 4; i++) {
if (s->picture_structure == PICT_BOTTOM_FIELD) {
s->current_picture.f.data[i] +=
s->current_picture.f.linesize[i];
}
s->current_picture.f.linesize[i] *= 2;
s->last_picture.f.linesize[i] *= 2;
s->next_picture.f.linesize[i] *= 2;
}
}
if (s->mpeg_quant || s->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
s->dct_unquantize_intra = s->dct_unquantize_mpeg2_intra;
s->dct_unquantize_inter = s->dct_unquantize_mpeg2_inter;
} else if (s->out_format == FMT_H263 || s->out_format == FMT_H261) {
s->dct_unquantize_intra = s->dct_unquantize_h263_intra;
s->dct_unquantize_inter = s->dct_unquantize_h263_inter;
} else {
s->dct_unquantize_intra = s->dct_unquantize_mpeg1_intra;
s->dct_unquantize_inter = s->dct_unquantize_mpeg1_inter;
}
if (s->dct_error_sum) {
assert(s->avctx->noise_reduction && s->encoding);
update_noise_reduction(s);
}
return 0;
}
| true |
FFmpeg
|
f6774f905fb3cfdc319523ac640be30b14c1bc55
|
static int frame_start(MpegEncContext *s)
{
int ret;
if (s->pict_type != AV_PICTURE_TYPE_B && s->last_picture_ptr &&
s->last_picture_ptr != s->next_picture_ptr &&
s->last_picture_ptr->f.buf[0]) {
ff_mpeg_unref_picture(s, s->last_picture_ptr);
}
s->current_picture_ptr->f.pict_type = s->pict_type;
s->current_picture_ptr->f.key_frame = s->pict_type == AV_PICTURE_TYPE_I;
ff_mpeg_unref_picture(s, &s->current_picture);
if ((ret = ff_mpeg_ref_picture(s, &s->current_picture,
s->current_picture_ptr)) < 0)
return ret;
if (s->pict_type != AV_PICTURE_TYPE_B) {
s->last_picture_ptr = s->next_picture_ptr;
if (!s->droppable)
s->next_picture_ptr = s->current_picture_ptr;
}
if (s->last_picture_ptr) {
ff_mpeg_unref_picture(s, &s->last_picture);
if (s->last_picture_ptr->f.buf[0] &&
(ret = ff_mpeg_ref_picture(s, &s->last_picture,
s->last_picture_ptr)) < 0)
return ret;
}
if (s->next_picture_ptr) {
ff_mpeg_unref_picture(s, &s->next_picture);
if (s->next_picture_ptr->f.buf[0] &&
(ret = ff_mpeg_ref_picture(s, &s->next_picture,
s->next_picture_ptr)) < 0)
return ret;
}
if (s->picture_structure!= PICT_FRAME) {
int i;
for (i = 0; i < 4; i++) {
if (s->picture_structure == PICT_BOTTOM_FIELD) {
s->current_picture.f.data[i] +=
s->current_picture.f.linesize[i];
}
s->current_picture.f.linesize[i] *= 2;
s->last_picture.f.linesize[i] *= 2;
s->next_picture.f.linesize[i] *= 2;
}
}
if (s->mpeg_quant || s->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
s->dct_unquantize_intra = s->dct_unquantize_mpeg2_intra;
s->dct_unquantize_inter = s->dct_unquantize_mpeg2_inter;
} else if (s->out_format == FMT_H263 || s->out_format == FMT_H261) {
s->dct_unquantize_intra = s->dct_unquantize_h263_intra;
s->dct_unquantize_inter = s->dct_unquantize_h263_inter;
} else {
s->dct_unquantize_intra = s->dct_unquantize_mpeg1_intra;
s->dct_unquantize_inter = s->dct_unquantize_mpeg1_inter;
}
if (s->dct_error_sum) {
assert(s->avctx->noise_reduction && s->encoding);
update_noise_reduction(s);
}
return 0;
}
|
{
"code": [
" s->current_picture.f.data[i] +=",
" s->last_picture_ptr->f.buf[0]) {",
" s->current_picture_ptr->f.pict_type = s->pict_type;",
" s->current_picture_ptr->f.key_frame = s->pict_type == AV_PICTURE_TYPE_I;",
" if (s->last_picture_ptr->f.buf[0] &&",
" if (s->next_picture_ptr->f.buf[0] &&",
" s->current_picture.f.data[i] +=",
" s->current_picture.f.linesize[i];",
" s->current_picture.f.linesize[i] *= 2;",
" s->last_picture.f.linesize[i] *= 2;",
" s->next_picture.f.linesize[i] *= 2;",
" s->last_picture_ptr->f.buf[0]) {",
" s->current_picture_ptr->f.pict_type = s->pict_type;",
" s->current_picture_ptr->f.key_frame = s->pict_type == AV_PICTURE_TYPE_I;",
" if (s->last_picture_ptr->f.buf[0] &&",
" if (s->next_picture_ptr->f.buf[0] &&",
" s->current_picture.f.data[i] +=",
" s->current_picture.f.linesize[i];",
" s->current_picture.f.linesize[i] *= 2;",
" s->last_picture.f.linesize[i] *= 2;",
" s->next_picture.f.linesize[i] *= 2;"
],
"line_no": [
89,
15,
23,
25,
55,
69,
89,
91,
95,
97,
99,
15,
23,
25,
55,
69,
89,
91,
95,
97,
99
]
}
|
static int FUNC_0(MpegEncContext *VAR_0)
{
int VAR_1;
if (VAR_0->pict_type != AV_PICTURE_TYPE_B && VAR_0->last_picture_ptr &&
VAR_0->last_picture_ptr != VAR_0->next_picture_ptr &&
VAR_0->last_picture_ptr->f.buf[0]) {
ff_mpeg_unref_picture(VAR_0, VAR_0->last_picture_ptr);
}
VAR_0->current_picture_ptr->f.pict_type = VAR_0->pict_type;
VAR_0->current_picture_ptr->f.key_frame = VAR_0->pict_type == AV_PICTURE_TYPE_I;
ff_mpeg_unref_picture(VAR_0, &VAR_0->current_picture);
if ((VAR_1 = ff_mpeg_ref_picture(VAR_0, &VAR_0->current_picture,
VAR_0->current_picture_ptr)) < 0)
return VAR_1;
if (VAR_0->pict_type != AV_PICTURE_TYPE_B) {
VAR_0->last_picture_ptr = VAR_0->next_picture_ptr;
if (!VAR_0->droppable)
VAR_0->next_picture_ptr = VAR_0->current_picture_ptr;
}
if (VAR_0->last_picture_ptr) {
ff_mpeg_unref_picture(VAR_0, &VAR_0->last_picture);
if (VAR_0->last_picture_ptr->f.buf[0] &&
(VAR_1 = ff_mpeg_ref_picture(VAR_0, &VAR_0->last_picture,
VAR_0->last_picture_ptr)) < 0)
return VAR_1;
}
if (VAR_0->next_picture_ptr) {
ff_mpeg_unref_picture(VAR_0, &VAR_0->next_picture);
if (VAR_0->next_picture_ptr->f.buf[0] &&
(VAR_1 = ff_mpeg_ref_picture(VAR_0, &VAR_0->next_picture,
VAR_0->next_picture_ptr)) < 0)
return VAR_1;
}
if (VAR_0->picture_structure!= PICT_FRAME) {
int VAR_2;
for (VAR_2 = 0; VAR_2 < 4; VAR_2++) {
if (VAR_0->picture_structure == PICT_BOTTOM_FIELD) {
VAR_0->current_picture.f.data[VAR_2] +=
VAR_0->current_picture.f.linesize[VAR_2];
}
VAR_0->current_picture.f.linesize[VAR_2] *= 2;
VAR_0->last_picture.f.linesize[VAR_2] *= 2;
VAR_0->next_picture.f.linesize[VAR_2] *= 2;
}
}
if (VAR_0->mpeg_quant || VAR_0->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
VAR_0->dct_unquantize_intra = VAR_0->dct_unquantize_mpeg2_intra;
VAR_0->dct_unquantize_inter = VAR_0->dct_unquantize_mpeg2_inter;
} else if (VAR_0->out_format == FMT_H263 || VAR_0->out_format == FMT_H261) {
VAR_0->dct_unquantize_intra = VAR_0->dct_unquantize_h263_intra;
VAR_0->dct_unquantize_inter = VAR_0->dct_unquantize_h263_inter;
} else {
VAR_0->dct_unquantize_intra = VAR_0->dct_unquantize_mpeg1_intra;
VAR_0->dct_unquantize_inter = VAR_0->dct_unquantize_mpeg1_inter;
}
if (VAR_0->dct_error_sum) {
assert(VAR_0->avctx->noise_reduction && VAR_0->encoding);
update_noise_reduction(VAR_0);
}
return 0;
}
|
[
"static int FUNC_0(MpegEncContext *VAR_0)\n{",
"int VAR_1;",
"if (VAR_0->pict_type != AV_PICTURE_TYPE_B && VAR_0->last_picture_ptr &&\nVAR_0->last_picture_ptr != VAR_0->next_picture_ptr &&\nVAR_0->last_picture_ptr->f.buf[0]) {",
"ff_mpeg_unref_picture(VAR_0, VAR_0->last_picture_ptr);",
"}",
"VAR_0->current_picture_ptr->f.pict_type = VAR_0->pict_type;",
"VAR_0->current_picture_ptr->f.key_frame = VAR_0->pict_type == AV_PICTURE_TYPE_I;",
"ff_mpeg_unref_picture(VAR_0, &VAR_0->current_picture);",
"if ((VAR_1 = ff_mpeg_ref_picture(VAR_0, &VAR_0->current_picture,\nVAR_0->current_picture_ptr)) < 0)\nreturn VAR_1;",
"if (VAR_0->pict_type != AV_PICTURE_TYPE_B) {",
"VAR_0->last_picture_ptr = VAR_0->next_picture_ptr;",
"if (!VAR_0->droppable)\nVAR_0->next_picture_ptr = VAR_0->current_picture_ptr;",
"}",
"if (VAR_0->last_picture_ptr) {",
"ff_mpeg_unref_picture(VAR_0, &VAR_0->last_picture);",
"if (VAR_0->last_picture_ptr->f.buf[0] &&\n(VAR_1 = ff_mpeg_ref_picture(VAR_0, &VAR_0->last_picture,\nVAR_0->last_picture_ptr)) < 0)\nreturn VAR_1;",
"}",
"if (VAR_0->next_picture_ptr) {",
"ff_mpeg_unref_picture(VAR_0, &VAR_0->next_picture);",
"if (VAR_0->next_picture_ptr->f.buf[0] &&\n(VAR_1 = ff_mpeg_ref_picture(VAR_0, &VAR_0->next_picture,\nVAR_0->next_picture_ptr)) < 0)\nreturn VAR_1;",
"}",
"if (VAR_0->picture_structure!= PICT_FRAME) {",
"int VAR_2;",
"for (VAR_2 = 0; VAR_2 < 4; VAR_2++) {",
"if (VAR_0->picture_structure == PICT_BOTTOM_FIELD) {",
"VAR_0->current_picture.f.data[VAR_2] +=\nVAR_0->current_picture.f.linesize[VAR_2];",
"}",
"VAR_0->current_picture.f.linesize[VAR_2] *= 2;",
"VAR_0->last_picture.f.linesize[VAR_2] *= 2;",
"VAR_0->next_picture.f.linesize[VAR_2] *= 2;",
"}",
"}",
"if (VAR_0->mpeg_quant || VAR_0->codec_id == AV_CODEC_ID_MPEG2VIDEO) {",
"VAR_0->dct_unquantize_intra = VAR_0->dct_unquantize_mpeg2_intra;",
"VAR_0->dct_unquantize_inter = VAR_0->dct_unquantize_mpeg2_inter;",
"} else if (VAR_0->out_format == FMT_H263 || VAR_0->out_format == FMT_H261) {",
"VAR_0->dct_unquantize_intra = VAR_0->dct_unquantize_h263_intra;",
"VAR_0->dct_unquantize_inter = VAR_0->dct_unquantize_h263_inter;",
"} else {",
"VAR_0->dct_unquantize_intra = VAR_0->dct_unquantize_mpeg1_intra;",
"VAR_0->dct_unquantize_inter = VAR_0->dct_unquantize_mpeg1_inter;",
"}",
"if (VAR_0->dct_error_sum) {",
"assert(VAR_0->avctx->noise_reduction && VAR_0->encoding);",
"update_noise_reduction(VAR_0);",
"}",
"return 0;",
"}"
] |
[
0,
0,
1,
0,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
1,
0,
0,
0,
0,
0,
1,
0,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
11,
13,
15
],
[
17
],
[
19
],
[
23
],
[
25
],
[
29
],
[
31,
33,
35
],
[
39
],
[
41
],
[
43,
45
],
[
47
],
[
51
],
[
53
],
[
55,
57,
59,
61
],
[
63
],
[
65
],
[
67
],
[
69,
71,
73,
75
],
[
77
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89,
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
129
],
[
131
],
[
133
],
[
135
],
[
139
],
[
141
]
] |
6,354 |
static always_inline void mpeg_motion(MpegEncContext *s,
uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
int field_based, int bottom_field, int field_select,
uint8_t **ref_picture, op_pixels_func (*pix_op)[4],
int motion_x, int motion_y, int h)
{
uint8_t *ptr_y, *ptr_cb, *ptr_cr;
int dxy, uvdxy, mx, my, src_x, src_y, uvsrc_x, uvsrc_y, v_edge_pos, uvlinesize, linesize;
#if 0
if(s->quarter_sample)
{
motion_x>>=1;
motion_y>>=1;
#endif
v_edge_pos = s->v_edge_pos >> field_based;
linesize = s->current_picture.linesize[0] << field_based;
uvlinesize = s->current_picture.linesize[1] << field_based;
dxy = ((motion_y & 1) << 1) | (motion_x & 1);
src_x = s->mb_x* 16 + (motion_x >> 1);
src_y =(s->mb_y<<(4-field_based)) + (motion_y >> 1);
if (s->out_format == FMT_H263) {
if((s->workaround_bugs & FF_BUG_HPEL_CHROMA) && field_based){
mx = (motion_x>>1)|(motion_x&1);
my = motion_y >>1;
uvdxy = ((my & 1) << 1) | (mx & 1);
uvsrc_x = s->mb_x* 8 + (mx >> 1);
uvsrc_y = (s->mb_y<<(3-field_based)) + (my >> 1);
}else{
uvdxy = dxy | (motion_y & 2) | ((motion_x & 2) >> 1);
uvsrc_x = src_x>>1;
uvsrc_y = src_y>>1;
}else if(s->out_format == FMT_H261){//even chroma mv's are full pel in H261
mx = motion_x / 4;
my = motion_y / 4;
uvdxy = 0;
uvsrc_x = s->mb_x*8 + mx;
uvsrc_y = s->mb_y*8 + my;
} else {
if(s->chroma_y_shift){
mx = motion_x / 2;
my = motion_y / 2;
uvdxy = ((my & 1) << 1) | (mx & 1);
uvsrc_x = s->mb_x* 8 + (mx >> 1);
uvsrc_y = (s->mb_y<<(3-field_based)) + (my >> 1);
} else {
if(s->chroma_x_shift){
//Chroma422
mx = motion_x / 2;
uvdxy = ((motion_y & 1) << 1) | (mx & 1);
uvsrc_x = s->mb_x* 8 + (mx >> 1);
uvsrc_y = src_y;
} else {
//Chroma444
uvdxy = dxy;
uvsrc_x = src_x;
uvsrc_y = src_y;
ptr_y = ref_picture[0] + src_y * linesize + src_x;
ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
if( (unsigned)src_x > s->h_edge_pos - (motion_x&1) - 16
|| (unsigned)src_y > v_edge_pos - (motion_y&1) - h){
if(s->codec_id == CODEC_ID_MPEG2VIDEO ||
s->codec_id == CODEC_ID_MPEG1VIDEO){
av_log(s->avctx,AV_LOG_DEBUG,"MPEG motion vector out of boundary\n");
return ;
ff_emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, 17, 17+field_based,
src_x, src_y<<field_based, s->h_edge_pos, s->v_edge_pos);
ptr_y = s->edge_emu_buffer;
if(!(s->flags&CODEC_FLAG_GRAY)){
uint8_t *uvbuf= s->edge_emu_buffer+18*s->linesize;
ff_emulated_edge_mc(uvbuf , ptr_cb, s->uvlinesize, 9, 9+field_based,
uvsrc_x, uvsrc_y<<field_based, s->h_edge_pos>>1, s->v_edge_pos>>1);
ff_emulated_edge_mc(uvbuf+16, ptr_cr, s->uvlinesize, 9, 9+field_based,
uvsrc_x, uvsrc_y<<field_based, s->h_edge_pos>>1, s->v_edge_pos>>1);
ptr_cb= uvbuf;
ptr_cr= uvbuf+16;
if(bottom_field){ //FIXME use this for field pix too instead of the obnoxious hack which changes picture.data
dest_y += s->linesize;
dest_cb+= s->uvlinesize;
dest_cr+= s->uvlinesize;
if(field_select){
ptr_y += s->linesize;
ptr_cb+= s->uvlinesize;
ptr_cr+= s->uvlinesize;
pix_op[0][dxy](dest_y, ptr_y, linesize, h);
if(!(s->flags&CODEC_FLAG_GRAY)){
pix_op[s->chroma_x_shift][uvdxy](dest_cb, ptr_cb, uvlinesize, h >> s->chroma_y_shift);
pix_op[s->chroma_x_shift][uvdxy](dest_cr, ptr_cr, uvlinesize, h >> s->chroma_y_shift);
| true |
FFmpeg
|
5f6c92d40c2003471b005cc05430ec8488000867
|
static always_inline void mpeg_motion(MpegEncContext *s,
uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
int field_based, int bottom_field, int field_select,
uint8_t **ref_picture, op_pixels_func (*pix_op)[4],
int motion_x, int motion_y, int h)
{
uint8_t *ptr_y, *ptr_cb, *ptr_cr;
int dxy, uvdxy, mx, my, src_x, src_y, uvsrc_x, uvsrc_y, v_edge_pos, uvlinesize, linesize;
#if 0
if(s->quarter_sample)
{
motion_x>>=1;
motion_y>>=1;
#endif
v_edge_pos = s->v_edge_pos >> field_based;
linesize = s->current_picture.linesize[0] << field_based;
uvlinesize = s->current_picture.linesize[1] << field_based;
dxy = ((motion_y & 1) << 1) | (motion_x & 1);
src_x = s->mb_x* 16 + (motion_x >> 1);
src_y =(s->mb_y<<(4-field_based)) + (motion_y >> 1);
if (s->out_format == FMT_H263) {
if((s->workaround_bugs & FF_BUG_HPEL_CHROMA) && field_based){
mx = (motion_x>>1)|(motion_x&1);
my = motion_y >>1;
uvdxy = ((my & 1) << 1) | (mx & 1);
uvsrc_x = s->mb_x* 8 + (mx >> 1);
uvsrc_y = (s->mb_y<<(3-field_based)) + (my >> 1);
}else{
uvdxy = dxy | (motion_y & 2) | ((motion_x & 2) >> 1);
uvsrc_x = src_x>>1;
uvsrc_y = src_y>>1;
}else if(s->out_format == FMT_H261){
mx = motion_x / 4;
my = motion_y / 4;
uvdxy = 0;
uvsrc_x = s->mb_x*8 + mx;
uvsrc_y = s->mb_y*8 + my;
} else {
if(s->chroma_y_shift){
mx = motion_x / 2;
my = motion_y / 2;
uvdxy = ((my & 1) << 1) | (mx & 1);
uvsrc_x = s->mb_x* 8 + (mx >> 1);
uvsrc_y = (s->mb_y<<(3-field_based)) + (my >> 1);
} else {
if(s->chroma_x_shift){
mx = motion_x / 2;
uvdxy = ((motion_y & 1) << 1) | (mx & 1);
uvsrc_x = s->mb_x* 8 + (mx >> 1);
uvsrc_y = src_y;
} else {
uvdxy = dxy;
uvsrc_x = src_x;
uvsrc_y = src_y;
ptr_y = ref_picture[0] + src_y * linesize + src_x;
ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
if( (unsigned)src_x > s->h_edge_pos - (motion_x&1) - 16
|| (unsigned)src_y > v_edge_pos - (motion_y&1) - h){
if(s->codec_id == CODEC_ID_MPEG2VIDEO ||
s->codec_id == CODEC_ID_MPEG1VIDEO){
av_log(s->avctx,AV_LOG_DEBUG,"MPEG motion vector out of boundary\n");
return ;
ff_emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, 17, 17+field_based,
src_x, src_y<<field_based, s->h_edge_pos, s->v_edge_pos);
ptr_y = s->edge_emu_buffer;
if(!(s->flags&CODEC_FLAG_GRAY)){
uint8_t *uvbuf= s->edge_emu_buffer+18*s->linesize;
ff_emulated_edge_mc(uvbuf , ptr_cb, s->uvlinesize, 9, 9+field_based,
uvsrc_x, uvsrc_y<<field_based, s->h_edge_pos>>1, s->v_edge_pos>>1);
ff_emulated_edge_mc(uvbuf+16, ptr_cr, s->uvlinesize, 9, 9+field_based,
uvsrc_x, uvsrc_y<<field_based, s->h_edge_pos>>1, s->v_edge_pos>>1);
ptr_cb= uvbuf;
ptr_cr= uvbuf+16;
if(bottom_field){
dest_y += s->linesize;
dest_cb+= s->uvlinesize;
dest_cr+= s->uvlinesize;
if(field_select){
ptr_y += s->linesize;
ptr_cb+= s->uvlinesize;
ptr_cr+= s->uvlinesize;
pix_op[0][dxy](dest_y, ptr_y, linesize, h);
if(!(s->flags&CODEC_FLAG_GRAY)){
pix_op[s->chroma_x_shift][uvdxy](dest_cb, ptr_cb, uvlinesize, h >> s->chroma_y_shift);
pix_op[s->chroma_x_shift][uvdxy](dest_cr, ptr_cr, uvlinesize, h >> s->chroma_y_shift);
|
{
"code": [],
"line_no": []
}
|
static always_inline void FUNC_0(MpegEncContext *s,
uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
int field_based, int bottom_field, int field_select,
uint8_t **ref_picture, op_pixels_func (*pix_op)[4],
int motion_x, int motion_y, int h)
{
uint8_t *ptr_y, *ptr_cb, *ptr_cr;
int VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;
#if 0
if(s->quarter_sample)
{
motion_x>>=1;
motion_y>>=1;
#endif
VAR_8 = s->VAR_8 >> field_based;
VAR_10 = s->current_picture.VAR_10[0] << field_based;
VAR_9 = s->current_picture.VAR_10[1] << field_based;
VAR_0 = ((motion_y & 1) << 1) | (motion_x & 1);
VAR_4 = s->mb_x* 16 + (motion_x >> 1);
VAR_5 =(s->mb_y<<(4-field_based)) + (motion_y >> 1);
if (s->out_format == FMT_H263) {
if((s->workaround_bugs & FF_BUG_HPEL_CHROMA) && field_based){
VAR_2 = (motion_x>>1)|(motion_x&1);
VAR_3 = motion_y >>1;
VAR_1 = ((VAR_3 & 1) << 1) | (VAR_2 & 1);
VAR_6 = s->mb_x* 8 + (VAR_2 >> 1);
VAR_7 = (s->mb_y<<(3-field_based)) + (VAR_3 >> 1);
}else{
VAR_1 = VAR_0 | (motion_y & 2) | ((motion_x & 2) >> 1);
VAR_6 = VAR_4>>1;
VAR_7 = VAR_5>>1;
}else if(s->out_format == FMT_H261){
VAR_2 = motion_x / 4;
VAR_3 = motion_y / 4;
VAR_1 = 0;
VAR_6 = s->mb_x*8 + VAR_2;
VAR_7 = s->mb_y*8 + VAR_3;
} else {
if(s->chroma_y_shift){
VAR_2 = motion_x / 2;
VAR_3 = motion_y / 2;
VAR_1 = ((VAR_3 & 1) << 1) | (VAR_2 & 1);
VAR_6 = s->mb_x* 8 + (VAR_2 >> 1);
VAR_7 = (s->mb_y<<(3-field_based)) + (VAR_3 >> 1);
} else {
if(s->chroma_x_shift){
VAR_2 = motion_x / 2;
VAR_1 = ((motion_y & 1) << 1) | (VAR_2 & 1);
VAR_6 = s->mb_x* 8 + (VAR_2 >> 1);
VAR_7 = VAR_5;
} else {
VAR_1 = VAR_0;
VAR_6 = VAR_4;
VAR_7 = VAR_5;
ptr_y = ref_picture[0] + VAR_5 * VAR_10 + VAR_4;
ptr_cb = ref_picture[1] + VAR_7 * VAR_9 + VAR_6;
ptr_cr = ref_picture[2] + VAR_7 * VAR_9 + VAR_6;
if( (unsigned)VAR_4 > s->h_edge_pos - (motion_x&1) - 16
|| (unsigned)VAR_5 > VAR_8 - (motion_y&1) - h){
if(s->codec_id == CODEC_ID_MPEG2VIDEO ||
s->codec_id == CODEC_ID_MPEG1VIDEO){
av_log(s->avctx,AV_LOG_DEBUG,"MPEG motion vector out of boundary\n");
return ;
ff_emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->VAR_10, 17, 17+field_based,
VAR_4, VAR_5<<field_based, s->h_edge_pos, s->VAR_8);
ptr_y = s->edge_emu_buffer;
if(!(s->flags&CODEC_FLAG_GRAY)){
uint8_t *uvbuf= s->edge_emu_buffer+18*s->VAR_10;
ff_emulated_edge_mc(uvbuf , ptr_cb, s->VAR_9, 9, 9+field_based,
VAR_6, VAR_7<<field_based, s->h_edge_pos>>1, s->VAR_8>>1);
ff_emulated_edge_mc(uvbuf+16, ptr_cr, s->VAR_9, 9, 9+field_based,
VAR_6, VAR_7<<field_based, s->h_edge_pos>>1, s->VAR_8>>1);
ptr_cb= uvbuf;
ptr_cr= uvbuf+16;
if(bottom_field){
dest_y += s->VAR_10;
dest_cb+= s->VAR_9;
dest_cr+= s->VAR_9;
if(field_select){
ptr_y += s->VAR_10;
ptr_cb+= s->VAR_9;
ptr_cr+= s->VAR_9;
pix_op[0][VAR_0](dest_y, ptr_y, VAR_10, h);
if(!(s->flags&CODEC_FLAG_GRAY)){
pix_op[s->chroma_x_shift][VAR_1](dest_cb, ptr_cb, VAR_9, h >> s->chroma_y_shift);
pix_op[s->chroma_x_shift][VAR_1](dest_cr, ptr_cr, VAR_9, h >> s->chroma_y_shift);
|
[
"static always_inline void FUNC_0(MpegEncContext *s,\nuint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,\nint field_based, int bottom_field, int field_select,\nuint8_t **ref_picture, op_pixels_func (*pix_op)[4],\nint motion_x, int motion_y, int h)\n{",
"uint8_t *ptr_y, *ptr_cb, *ptr_cr;",
"int VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;",
"#if 0\nif(s->quarter_sample)\n{",
"motion_x>>=1;",
"motion_y>>=1;",
"#endif\nVAR_8 = s->VAR_8 >> field_based;",
"VAR_10 = s->current_picture.VAR_10[0] << field_based;",
"VAR_9 = s->current_picture.VAR_10[1] << field_based;",
"VAR_0 = ((motion_y & 1) << 1) | (motion_x & 1);",
"VAR_4 = s->mb_x* 16 + (motion_x >> 1);",
"VAR_5 =(s->mb_y<<(4-field_based)) + (motion_y >> 1);",
"if (s->out_format == FMT_H263) {",
"if((s->workaround_bugs & FF_BUG_HPEL_CHROMA) && field_based){",
"VAR_2 = (motion_x>>1)|(motion_x&1);",
"VAR_3 = motion_y >>1;",
"VAR_1 = ((VAR_3 & 1) << 1) | (VAR_2 & 1);",
"VAR_6 = s->mb_x* 8 + (VAR_2 >> 1);",
"VAR_7 = (s->mb_y<<(3-field_based)) + (VAR_3 >> 1);",
"}else{",
"VAR_1 = VAR_0 | (motion_y & 2) | ((motion_x & 2) >> 1);",
"VAR_6 = VAR_4>>1;",
"VAR_7 = VAR_5>>1;",
"}else if(s->out_format == FMT_H261){",
"VAR_2 = motion_x / 4;",
"VAR_3 = motion_y / 4;",
"VAR_1 = 0;",
"VAR_6 = s->mb_x*8 + VAR_2;",
"VAR_7 = s->mb_y*8 + VAR_3;",
"} else {",
"if(s->chroma_y_shift){",
"VAR_2 = motion_x / 2;",
"VAR_3 = motion_y / 2;",
"VAR_1 = ((VAR_3 & 1) << 1) | (VAR_2 & 1);",
"VAR_6 = s->mb_x* 8 + (VAR_2 >> 1);",
"VAR_7 = (s->mb_y<<(3-field_based)) + (VAR_3 >> 1);",
"} else {",
"if(s->chroma_x_shift){",
"VAR_2 = motion_x / 2;",
"VAR_1 = ((motion_y & 1) << 1) | (VAR_2 & 1);",
"VAR_6 = s->mb_x* 8 + (VAR_2 >> 1);",
"VAR_7 = VAR_5;",
"} else {",
"VAR_1 = VAR_0;",
"VAR_6 = VAR_4;",
"VAR_7 = VAR_5;",
"ptr_y = ref_picture[0] + VAR_5 * VAR_10 + VAR_4;",
"ptr_cb = ref_picture[1] + VAR_7 * VAR_9 + VAR_6;",
"ptr_cr = ref_picture[2] + VAR_7 * VAR_9 + VAR_6;",
"if( (unsigned)VAR_4 > s->h_edge_pos - (motion_x&1) - 16\n|| (unsigned)VAR_5 > VAR_8 - (motion_y&1) - h){",
"if(s->codec_id == CODEC_ID_MPEG2VIDEO ||\ns->codec_id == CODEC_ID_MPEG1VIDEO){",
"av_log(s->avctx,AV_LOG_DEBUG,\"MPEG motion vector out of boundary\\n\");",
"return ;",
"ff_emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->VAR_10, 17, 17+field_based,\nVAR_4, VAR_5<<field_based, s->h_edge_pos, s->VAR_8);",
"ptr_y = s->edge_emu_buffer;",
"if(!(s->flags&CODEC_FLAG_GRAY)){",
"uint8_t *uvbuf= s->edge_emu_buffer+18*s->VAR_10;",
"ff_emulated_edge_mc(uvbuf , ptr_cb, s->VAR_9, 9, 9+field_based,\nVAR_6, VAR_7<<field_based, s->h_edge_pos>>1, s->VAR_8>>1);",
"ff_emulated_edge_mc(uvbuf+16, ptr_cr, s->VAR_9, 9, 9+field_based,\nVAR_6, VAR_7<<field_based, s->h_edge_pos>>1, s->VAR_8>>1);",
"ptr_cb= uvbuf;",
"ptr_cr= uvbuf+16;",
"if(bottom_field){",
"dest_y += s->VAR_10;",
"dest_cb+= s->VAR_9;",
"dest_cr+= s->VAR_9;",
"if(field_select){",
"ptr_y += s->VAR_10;",
"ptr_cb+= s->VAR_9;",
"ptr_cr+= s->VAR_9;",
"pix_op[0][VAR_0](dest_y, ptr_y, VAR_10, h);",
"if(!(s->flags&CODEC_FLAG_GRAY)){",
"pix_op[s->chroma_x_shift][VAR_1](dest_cb, ptr_cb, VAR_9, h >> s->chroma_y_shift);",
"pix_op[s->chroma_x_shift][VAR_1](dest_cr, ptr_cr, VAR_9, h >> s->chroma_y_shift);"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5,
7,
9,
11
],
[
13
],
[
15
],
[
19,
21,
23
],
[
25
],
[
27
],
[
30,
34
],
[
36
],
[
38
],
[
42
],
[
44
],
[
46
],
[
50
],
[
52
],
[
54
],
[
56
],
[
58
],
[
60
],
[
62
],
[
64
],
[
66
],
[
68
],
[
70
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
117
],
[
119
],
[
121
],
[
128
],
[
130
],
[
132
],
[
136,
138
],
[
140,
142
],
[
144
],
[
146
],
[
149,
151
],
[
153
],
[
155
],
[
157
],
[
159,
161
],
[
163,
165
],
[
167
],
[
169
],
[
175
],
[
177
],
[
179
],
[
181
],
[
186
],
[
188
],
[
190
],
[
192
],
[
197
],
[
201
],
[
203
],
[
205
]
] |
6,355 |
static int decode_user_data(MpegEncContext *s, GetBitContext *gb){
char buf[256];
int i;
int e;
int ver, build, ver2, ver3;
char last;
for(i=0; i<255; i++){
if(show_bits(gb, 23) == 0) break;
buf[i]= get_bits(gb, 8);
}
buf[i]=0;
/* divx detection */
e=sscanf(buf, "DivX%dBuild%d%c", &ver, &build, &last);
if(e<2)
e=sscanf(buf, "DivX%db%d%c", &ver, &build, &last);
if(e>=2){
s->divx_version= ver;
s->divx_build= build;
s->divx_packed= e==3 && last=='p';
}
/* ffmpeg detection */
e=sscanf(buf, "FFmpe%*[^b]b%d", &build)+3;
if(e!=4)
e=sscanf(buf, "FFmpeg v%d.%d.%d / libavcodec build: %d", &ver, &ver2, &ver3, &build);
if(e!=4){
e=sscanf(buf, "Lavc%d.%d.%d", &ver, &ver2, &ver3)+1;
build= (ver<<16) + (ver2<<8) + ver3;
}
if(e!=4){
if(strcmp(buf, "ffmpeg")==0){
s->lavc_build= 4600;
}
}
if(e==4){
s->lavc_build= build;
}
/* xvid detection */
e=sscanf(buf, "XviD%d", &build);
if(e==1){
s->xvid_build= build;
}
//printf("User Data: %s\n", buf);
return 0;
}
| true |
FFmpeg
|
63d33cf4390a9280b1ba42ee722f3140cf1cad3e
|
static int decode_user_data(MpegEncContext *s, GetBitContext *gb){
char buf[256];
int i;
int e;
int ver, build, ver2, ver3;
char last;
for(i=0; i<255; i++){
if(show_bits(gb, 23) == 0) break;
buf[i]= get_bits(gb, 8);
}
buf[i]=0;
e=sscanf(buf, "DivX%dBuild%d%c", &ver, &build, &last);
if(e<2)
e=sscanf(buf, "DivX%db%d%c", &ver, &build, &last);
if(e>=2){
s->divx_version= ver;
s->divx_build= build;
s->divx_packed= e==3 && last=='p';
}
e=sscanf(buf, "FFmpe%*[^b]b%d", &build)+3;
if(e!=4)
e=sscanf(buf, "FFmpeg v%d.%d.%d / libavcodec build: %d", &ver, &ver2, &ver3, &build);
if(e!=4){
e=sscanf(buf, "Lavc%d.%d.%d", &ver, &ver2, &ver3)+1;
build= (ver<<16) + (ver2<<8) + ver3;
}
if(e!=4){
if(strcmp(buf, "ffmpeg")==0){
s->lavc_build= 4600;
}
}
if(e==4){
s->lavc_build= build;
}
e=sscanf(buf, "XviD%d", &build);
if(e==1){
s->xvid_build= build;
}
return 0;
}
|
{
"code": [
" int ver, build, ver2, ver3;",
" for(i=0; i<255; i++){",
" build= (ver<<16) + (ver2<<8) + ver3;"
],
"line_no": [
9,
15,
59
]
}
|
static int FUNC_0(MpegEncContext *VAR_0, GetBitContext *VAR_1){
char VAR_2[256];
int VAR_3;
int VAR_4;
int VAR_5, VAR_6, VAR_7, VAR_8;
char VAR_9;
for(VAR_3=0; VAR_3<255; VAR_3++){
if(show_bits(VAR_1, 23) == 0) break;
VAR_2[VAR_3]= get_bits(VAR_1, 8);
}
VAR_2[VAR_3]=0;
VAR_4=sscanf(VAR_2, "DivX%dBuild%d%c", &VAR_5, &VAR_6, &VAR_9);
if(VAR_4<2)
VAR_4=sscanf(VAR_2, "DivX%db%d%c", &VAR_5, &VAR_6, &VAR_9);
if(VAR_4>=2){
VAR_0->divx_version= VAR_5;
VAR_0->divx_build= VAR_6;
VAR_0->divx_packed= VAR_4==3 && VAR_9=='p';
}
VAR_4=sscanf(VAR_2, "FFmpe%*[^b]b%d", &VAR_6)+3;
if(VAR_4!=4)
VAR_4=sscanf(VAR_2, "FFmpeg v%d.%d.%d / libavcodec VAR_6: %d", &VAR_5, &VAR_7, &VAR_8, &VAR_6);
if(VAR_4!=4){
VAR_4=sscanf(VAR_2, "Lavc%d.%d.%d", &VAR_5, &VAR_7, &VAR_8)+1;
VAR_6= (VAR_5<<16) + (VAR_7<<8) + VAR_8;
}
if(VAR_4!=4){
if(strcmp(VAR_2, "ffmpeg")==0){
VAR_0->lavc_build= 4600;
}
}
if(VAR_4==4){
VAR_0->lavc_build= VAR_6;
}
VAR_4=sscanf(VAR_2, "XviD%d", &VAR_6);
if(VAR_4==1){
VAR_0->xvid_build= VAR_6;
}
return 0;
}
|
[
"static int FUNC_0(MpegEncContext *VAR_0, GetBitContext *VAR_1){",
"char VAR_2[256];",
"int VAR_3;",
"int VAR_4;",
"int VAR_5, VAR_6, VAR_7, VAR_8;",
"char VAR_9;",
"for(VAR_3=0; VAR_3<255; VAR_3++){",
"if(show_bits(VAR_1, 23) == 0) break;",
"VAR_2[VAR_3]= get_bits(VAR_1, 8);",
"}",
"VAR_2[VAR_3]=0;",
"VAR_4=sscanf(VAR_2, \"DivX%dBuild%d%c\", &VAR_5, &VAR_6, &VAR_9);",
"if(VAR_4<2)\nVAR_4=sscanf(VAR_2, \"DivX%db%d%c\", &VAR_5, &VAR_6, &VAR_9);",
"if(VAR_4>=2){",
"VAR_0->divx_version= VAR_5;",
"VAR_0->divx_build= VAR_6;",
"VAR_0->divx_packed= VAR_4==3 && VAR_9=='p';",
"}",
"VAR_4=sscanf(VAR_2, \"FFmpe%*[^b]b%d\", &VAR_6)+3;",
"if(VAR_4!=4)\nVAR_4=sscanf(VAR_2, \"FFmpeg v%d.%d.%d / libavcodec VAR_6: %d\", &VAR_5, &VAR_7, &VAR_8, &VAR_6);",
"if(VAR_4!=4){",
"VAR_4=sscanf(VAR_2, \"Lavc%d.%d.%d\", &VAR_5, &VAR_7, &VAR_8)+1;",
"VAR_6= (VAR_5<<16) + (VAR_7<<8) + VAR_8;",
"}",
"if(VAR_4!=4){",
"if(strcmp(VAR_2, \"ffmpeg\")==0){",
"VAR_0->lavc_build= 4600;",
"}",
"}",
"if(VAR_4==4){",
"VAR_0->lavc_build= VAR_6;",
"}",
"VAR_4=sscanf(VAR_2, \"XviD%d\", &VAR_6);",
"if(VAR_4==1){",
"VAR_0->xvid_build= VAR_6;",
"}",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
1,
0,
1,
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
] |
[
[
1
],
[
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
29
],
[
31,
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
49
],
[
51,
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
83
],
[
85
],
[
87
],
[
89
],
[
95
],
[
97
]
] |
6,356 |
static void do_adaptive_prediction(struct G722Band *band, const int cur_diff)
{
int sg[2], limit, cur_qtzd_reconst;
const int cur_part_reconst = band->s_zero + cur_diff < 0;
sg[0] = sign_lookup[cur_part_reconst != band->part_reconst_mem[0]];
sg[1] = sign_lookup[cur_part_reconst == band->part_reconst_mem[1]];
band->part_reconst_mem[1] = band->part_reconst_mem[0];
band->part_reconst_mem[0] = cur_part_reconst;
band->pole_mem[1] = av_clip((sg[0] * av_clip(band->pole_mem[0], -8191, 8191) >> 5) +
(sg[1] << 7) + (band->pole_mem[1] * 127 >> 7), -12288, 12288);
limit = 15360 - band->pole_mem[1];
band->pole_mem[0] = av_clip(-192 * sg[0] + (band->pole_mem[0] * 255 >> 8), -limit, limit);
s_zero(cur_diff, band);
cur_qtzd_reconst = av_clip_int16((band->s_predictor + cur_diff) << 1);
band->s_predictor = av_clip_int16(band->s_zero +
(band->pole_mem[0] * cur_qtzd_reconst >> 15) +
(band->pole_mem[1] * band->prev_qtzd_reconst >> 15));
band->prev_qtzd_reconst = cur_qtzd_reconst;
}
| true |
FFmpeg
|
f55df62998681c7702f008ce7c12a00b15e33f53
|
static void do_adaptive_prediction(struct G722Band *band, const int cur_diff)
{
int sg[2], limit, cur_qtzd_reconst;
const int cur_part_reconst = band->s_zero + cur_diff < 0;
sg[0] = sign_lookup[cur_part_reconst != band->part_reconst_mem[0]];
sg[1] = sign_lookup[cur_part_reconst == band->part_reconst_mem[1]];
band->part_reconst_mem[1] = band->part_reconst_mem[0];
band->part_reconst_mem[0] = cur_part_reconst;
band->pole_mem[1] = av_clip((sg[0] * av_clip(band->pole_mem[0], -8191, 8191) >> 5) +
(sg[1] << 7) + (band->pole_mem[1] * 127 >> 7), -12288, 12288);
limit = 15360 - band->pole_mem[1];
band->pole_mem[0] = av_clip(-192 * sg[0] + (band->pole_mem[0] * 255 >> 8), -limit, limit);
s_zero(cur_diff, band);
cur_qtzd_reconst = av_clip_int16((band->s_predictor + cur_diff) << 1);
band->s_predictor = av_clip_int16(band->s_zero +
(band->pole_mem[0] * cur_qtzd_reconst >> 15) +
(band->pole_mem[1] * band->prev_qtzd_reconst >> 15));
band->prev_qtzd_reconst = cur_qtzd_reconst;
}
|
{
"code": [
" (sg[1] << 7) + (band->pole_mem[1] * 127 >> 7), -12288, 12288);",
" cur_qtzd_reconst = av_clip_int16((band->s_predictor + cur_diff) << 1);"
],
"line_no": [
25,
39
]
}
|
static void FUNC_0(struct G722Band *VAR_0, const int VAR_1)
{
int VAR_2[2], VAR_3, VAR_4;
const int VAR_5 = VAR_0->s_zero + VAR_1 < 0;
VAR_2[0] = sign_lookup[VAR_5 != VAR_0->part_reconst_mem[0]];
VAR_2[1] = sign_lookup[VAR_5 == VAR_0->part_reconst_mem[1]];
VAR_0->part_reconst_mem[1] = VAR_0->part_reconst_mem[0];
VAR_0->part_reconst_mem[0] = VAR_5;
VAR_0->pole_mem[1] = av_clip((VAR_2[0] * av_clip(VAR_0->pole_mem[0], -8191, 8191) >> 5) +
(VAR_2[1] << 7) + (VAR_0->pole_mem[1] * 127 >> 7), -12288, 12288);
VAR_3 = 15360 - VAR_0->pole_mem[1];
VAR_0->pole_mem[0] = av_clip(-192 * VAR_2[0] + (VAR_0->pole_mem[0] * 255 >> 8), -VAR_3, VAR_3);
s_zero(VAR_1, VAR_0);
VAR_4 = av_clip_int16((VAR_0->s_predictor + VAR_1) << 1);
VAR_0->s_predictor = av_clip_int16(VAR_0->s_zero +
(VAR_0->pole_mem[0] * VAR_4 >> 15) +
(VAR_0->pole_mem[1] * VAR_0->prev_qtzd_reconst >> 15));
VAR_0->prev_qtzd_reconst = VAR_4;
}
|
[
"static void FUNC_0(struct G722Band *VAR_0, const int VAR_1)\n{",
"int VAR_2[2], VAR_3, VAR_4;",
"const int VAR_5 = VAR_0->s_zero + VAR_1 < 0;",
"VAR_2[0] = sign_lookup[VAR_5 != VAR_0->part_reconst_mem[0]];",
"VAR_2[1] = sign_lookup[VAR_5 == VAR_0->part_reconst_mem[1]];",
"VAR_0->part_reconst_mem[1] = VAR_0->part_reconst_mem[0];",
"VAR_0->part_reconst_mem[0] = VAR_5;",
"VAR_0->pole_mem[1] = av_clip((VAR_2[0] * av_clip(VAR_0->pole_mem[0], -8191, 8191) >> 5) +\n(VAR_2[1] << 7) + (VAR_0->pole_mem[1] * 127 >> 7), -12288, 12288);",
"VAR_3 = 15360 - VAR_0->pole_mem[1];",
"VAR_0->pole_mem[0] = av_clip(-192 * VAR_2[0] + (VAR_0->pole_mem[0] * 255 >> 8), -VAR_3, VAR_3);",
"s_zero(VAR_1, VAR_0);",
"VAR_4 = av_clip_int16((VAR_0->s_predictor + VAR_1) << 1);",
"VAR_0->s_predictor = av_clip_int16(VAR_0->s_zero +\n(VAR_0->pole_mem[0] * VAR_4 >> 15) +\n(VAR_0->pole_mem[1] * VAR_0->prev_qtzd_reconst >> 15));",
"VAR_0->prev_qtzd_reconst = VAR_4;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
1,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
9
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23,
25
],
[
29
],
[
31
],
[
35
],
[
39
],
[
41,
43,
45
],
[
47
],
[
49
]
] |
6,357 |
void helper_done(void)
{
env->pc = env->tsptr->tpc;
env->npc = env->tsptr->tnpc + 4;
PUT_CCR(env, env->tsptr->tstate >> 32);
env->asi = (env->tsptr->tstate >> 24) & 0xff;
change_pstate((env->tsptr->tstate >> 8) & 0xf3f);
PUT_CWP64(env, env->tsptr->tstate & 0xff);
env->tl--;
env->tsptr = &env->ts[env->tl & MAXTL_MASK];
}
| true |
qemu
|
8194f35a0c71a3bf169459bf715bea53b7bbc904
|
void helper_done(void)
{
env->pc = env->tsptr->tpc;
env->npc = env->tsptr->tnpc + 4;
PUT_CCR(env, env->tsptr->tstate >> 32);
env->asi = (env->tsptr->tstate >> 24) & 0xff;
change_pstate((env->tsptr->tstate >> 8) & 0xf3f);
PUT_CWP64(env, env->tsptr->tstate & 0xff);
env->tl--;
env->tsptr = &env->ts[env->tl & MAXTL_MASK];
}
|
{
"code": [
" env->tsptr = &env->ts[env->tl & MAXTL_MASK];",
" env->tsptr = &env->ts[env->tl & MAXTL_MASK];",
" env->pc = env->tsptr->tpc;",
" env->npc = env->tsptr->tnpc + 4;",
" PUT_CCR(env, env->tsptr->tstate >> 32);",
" env->asi = (env->tsptr->tstate >> 24) & 0xff;",
" change_pstate((env->tsptr->tstate >> 8) & 0xf3f);",
" PUT_CWP64(env, env->tsptr->tstate & 0xff);",
" env->tsptr = &env->ts[env->tl & MAXTL_MASK];",
" env->pc = env->tsptr->tpc;",
" PUT_CCR(env, env->tsptr->tstate >> 32);",
" env->asi = (env->tsptr->tstate >> 24) & 0xff;",
" change_pstate((env->tsptr->tstate >> 8) & 0xf3f);",
" PUT_CWP64(env, env->tsptr->tstate & 0xff);",
" env->tsptr = &env->ts[env->tl & MAXTL_MASK];",
" env->tsptr = &env->ts[env->tl & MAXTL_MASK];"
],
"line_no": [
19,
19,
5,
7,
9,
11,
13,
15,
19,
5,
9,
11,
13,
15,
19,
19
]
}
|
void FUNC_0(void)
{
env->pc = env->tsptr->tpc;
env->npc = env->tsptr->tnpc + 4;
PUT_CCR(env, env->tsptr->tstate >> 32);
env->asi = (env->tsptr->tstate >> 24) & 0xff;
change_pstate((env->tsptr->tstate >> 8) & 0xf3f);
PUT_CWP64(env, env->tsptr->tstate & 0xff);
env->tl--;
env->tsptr = &env->ts[env->tl & MAXTL_MASK];
}
|
[
"void FUNC_0(void)\n{",
"env->pc = env->tsptr->tpc;",
"env->npc = env->tsptr->tnpc + 4;",
"PUT_CCR(env, env->tsptr->tstate >> 32);",
"env->asi = (env->tsptr->tstate >> 24) & 0xff;",
"change_pstate((env->tsptr->tstate >> 8) & 0xf3f);",
"PUT_CWP64(env, env->tsptr->tstate & 0xff);",
"env->tl--;",
"env->tsptr = &env->ts[env->tl & MAXTL_MASK];",
"}"
] |
[
0,
1,
1,
1,
1,
1,
1,
0,
1,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
]
] |
6,358 |
static const AVClass *ff_avio_child_class_next(const AVClass *prev)
{
return prev ? NULL : &ffurl_context_class;
}
| true |
FFmpeg
|
ec4c48397641dbaf4ae8df36c32aaa5a311a11bf
|
static const AVClass *ff_avio_child_class_next(const AVClass *prev)
{
return prev ? NULL : &ffurl_context_class;
}
|
{
"code": [
" return prev ? NULL : &ffurl_context_class;"
],
"line_no": [
5
]
}
|
static const AVClass *FUNC_0(const AVClass *prev)
{
return prev ? NULL : &ffurl_context_class;
}
|
[
"static const AVClass *FUNC_0(const AVClass *prev)\n{",
"return prev ? NULL : &ffurl_context_class;",
"}"
] |
[
0,
1,
0
] |
[
[
1,
3
],
[
5
],
[
7
]
] |
6,359 |
static int decode_band(IVI5DecContext *ctx, int plane_num,
IVIBandDesc *band, AVCodecContext *avctx)
{
int result, i, t, idx1, idx2;
IVITile *tile;
uint16_t chksum;
band->buf = band->bufs[ctx->dst_buf];
band->ref_buf = band->bufs[ctx->ref_buf];
band->data_ptr = ctx->frame_data + (get_bits_count(&ctx->gb) >> 3);
result = decode_band_hdr(ctx, band, avctx);
if (result) {
av_log(avctx, AV_LOG_ERROR, "Error while decoding band header: %d\n",
result);
return -1;
}
if (band->is_empty) {
av_log(avctx, AV_LOG_ERROR, "Empty band encountered!\n");
return -1;
}
band->rv_map = &ctx->rvmap_tabs[band->rvmap_sel];
/* apply corrections to the selected rvmap table if present */
for (i = 0; i < band->num_corr; i++) {
idx1 = band->corr[i*2];
idx2 = band->corr[i*2+1];
FFSWAP(uint8_t, band->rv_map->runtab[idx1], band->rv_map->runtab[idx2]);
FFSWAP(int16_t, band->rv_map->valtab[idx1], band->rv_map->valtab[idx2]);
}
for (t = 0; t < band->num_tiles; t++) {
tile = &band->tiles[t];
tile->is_empty = get_bits1(&ctx->gb);
if (tile->is_empty) {
ff_ivi_process_empty_tile(avctx, band, tile,
(ctx->planes[0].bands[0].mb_size >> 3) - (band->mb_size >> 3));
align_get_bits(&ctx->gb);
} else {
tile->data_size = ff_ivi_dec_tile_data_size(&ctx->gb);
result = decode_mb_info(ctx, band, tile, avctx);
if (result < 0)
break;
if (band->blk_size == 8) {
band->intra_base = &ivi5_base_quant_8x8_intra[band->quant_mat][0];
band->inter_base = &ivi5_base_quant_8x8_inter[band->quant_mat][0];
band->intra_scale = &ivi5_scale_quant_8x8_intra[band->quant_mat][0];
band->inter_scale = &ivi5_scale_quant_8x8_inter[band->quant_mat][0];
} else {
band->intra_base = ivi5_base_quant_4x4_intra;
band->inter_base = ivi5_base_quant_4x4_inter;
band->intra_scale = ivi5_scale_quant_4x4_intra;
band->inter_scale = ivi5_scale_quant_4x4_inter;
}
result = ff_ivi_decode_blocks(&ctx->gb, band, tile);
if (result < 0) {
av_log(avctx, AV_LOG_ERROR, "Corrupted blocks data encountered!\n");
break;
}
}
}
/* restore the selected rvmap table by applying its corrections in reverse order */
for (i = band->num_corr-1; i >= 0; i--) {
idx1 = band->corr[i*2];
idx2 = band->corr[i*2+1];
FFSWAP(uint8_t, band->rv_map->runtab[idx1], band->rv_map->runtab[idx2]);
FFSWAP(int16_t, band->rv_map->valtab[idx1], band->rv_map->valtab[idx2]);
}
if (IVI_DEBUG && band->checksum_present) {
chksum = ivi_calc_band_checksum(band);
if (chksum != band->checksum) {
av_log(avctx, AV_LOG_ERROR,
"Band checksum mismatch! Plane %d, band %d, received: %x, calculated: %x\n",
band->plane, band->band_num, band->checksum, chksum);
}
}
return result;
}
| true |
FFmpeg
|
f7d649185b62a83ab58514207151f2a8059090fb
|
static int decode_band(IVI5DecContext *ctx, int plane_num,
IVIBandDesc *band, AVCodecContext *avctx)
{
int result, i, t, idx1, idx2;
IVITile *tile;
uint16_t chksum;
band->buf = band->bufs[ctx->dst_buf];
band->ref_buf = band->bufs[ctx->ref_buf];
band->data_ptr = ctx->frame_data + (get_bits_count(&ctx->gb) >> 3);
result = decode_band_hdr(ctx, band, avctx);
if (result) {
av_log(avctx, AV_LOG_ERROR, "Error while decoding band header: %d\n",
result);
return -1;
}
if (band->is_empty) {
av_log(avctx, AV_LOG_ERROR, "Empty band encountered!\n");
return -1;
}
band->rv_map = &ctx->rvmap_tabs[band->rvmap_sel];
for (i = 0; i < band->num_corr; i++) {
idx1 = band->corr[i*2];
idx2 = band->corr[i*2+1];
FFSWAP(uint8_t, band->rv_map->runtab[idx1], band->rv_map->runtab[idx2]);
FFSWAP(int16_t, band->rv_map->valtab[idx1], band->rv_map->valtab[idx2]);
}
for (t = 0; t < band->num_tiles; t++) {
tile = &band->tiles[t];
tile->is_empty = get_bits1(&ctx->gb);
if (tile->is_empty) {
ff_ivi_process_empty_tile(avctx, band, tile,
(ctx->planes[0].bands[0].mb_size >> 3) - (band->mb_size >> 3));
align_get_bits(&ctx->gb);
} else {
tile->data_size = ff_ivi_dec_tile_data_size(&ctx->gb);
result = decode_mb_info(ctx, band, tile, avctx);
if (result < 0)
break;
if (band->blk_size == 8) {
band->intra_base = &ivi5_base_quant_8x8_intra[band->quant_mat][0];
band->inter_base = &ivi5_base_quant_8x8_inter[band->quant_mat][0];
band->intra_scale = &ivi5_scale_quant_8x8_intra[band->quant_mat][0];
band->inter_scale = &ivi5_scale_quant_8x8_inter[band->quant_mat][0];
} else {
band->intra_base = ivi5_base_quant_4x4_intra;
band->inter_base = ivi5_base_quant_4x4_inter;
band->intra_scale = ivi5_scale_quant_4x4_intra;
band->inter_scale = ivi5_scale_quant_4x4_inter;
}
result = ff_ivi_decode_blocks(&ctx->gb, band, tile);
if (result < 0) {
av_log(avctx, AV_LOG_ERROR, "Corrupted blocks data encountered!\n");
break;
}
}
}
for (i = band->num_corr-1; i >= 0; i--) {
idx1 = band->corr[i*2];
idx2 = band->corr[i*2+1];
FFSWAP(uint8_t, band->rv_map->runtab[idx1], band->rv_map->runtab[idx2]);
FFSWAP(int16_t, band->rv_map->valtab[idx1], band->rv_map->valtab[idx2]);
}
if (IVI_DEBUG && band->checksum_present) {
chksum = ivi_calc_band_checksum(band);
if (chksum != band->checksum) {
av_log(avctx, AV_LOG_ERROR,
"Band checksum mismatch! Plane %d, band %d, received: %x, calculated: %x\n",
band->plane, band->band_num, band->checksum, chksum);
}
}
return result;
}
|
{
"code": [
" if (IVI_DEBUG && band->checksum_present) {"
],
"line_no": [
153
]
}
|
static int FUNC_0(IVI5DecContext *VAR_0, int VAR_1,
IVIBandDesc *VAR_2, AVCodecContext *VAR_3)
{
int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8;
IVITile *tile;
uint16_t chksum;
VAR_2->buf = VAR_2->bufs[VAR_0->dst_buf];
VAR_2->ref_buf = VAR_2->bufs[VAR_0->ref_buf];
VAR_2->data_ptr = VAR_0->frame_data + (get_bits_count(&VAR_0->gb) >> 3);
VAR_4 = decode_band_hdr(VAR_0, VAR_2, VAR_3);
if (VAR_4) {
av_log(VAR_3, AV_LOG_ERROR, "Error while decoding VAR_2 header: %d\n",
VAR_4);
return -1;
}
if (VAR_2->is_empty) {
av_log(VAR_3, AV_LOG_ERROR, "Empty VAR_2 encountered!\n");
return -1;
}
VAR_2->rv_map = &VAR_0->rvmap_tabs[VAR_2->rvmap_sel];
for (VAR_5 = 0; VAR_5 < VAR_2->num_corr; VAR_5++) {
VAR_7 = VAR_2->corr[VAR_5*2];
VAR_8 = VAR_2->corr[VAR_5*2+1];
FFSWAP(uint8_t, VAR_2->rv_map->runtab[VAR_7], VAR_2->rv_map->runtab[VAR_8]);
FFSWAP(int16_t, VAR_2->rv_map->valtab[VAR_7], VAR_2->rv_map->valtab[VAR_8]);
}
for (VAR_6 = 0; VAR_6 < VAR_2->num_tiles; VAR_6++) {
tile = &VAR_2->tiles[VAR_6];
tile->is_empty = get_bits1(&VAR_0->gb);
if (tile->is_empty) {
ff_ivi_process_empty_tile(VAR_3, VAR_2, tile,
(VAR_0->planes[0].bands[0].mb_size >> 3) - (VAR_2->mb_size >> 3));
align_get_bits(&VAR_0->gb);
} else {
tile->data_size = ff_ivi_dec_tile_data_size(&VAR_0->gb);
VAR_4 = decode_mb_info(VAR_0, VAR_2, tile, VAR_3);
if (VAR_4 < 0)
break;
if (VAR_2->blk_size == 8) {
VAR_2->intra_base = &ivi5_base_quant_8x8_intra[VAR_2->quant_mat][0];
VAR_2->inter_base = &ivi5_base_quant_8x8_inter[VAR_2->quant_mat][0];
VAR_2->intra_scale = &ivi5_scale_quant_8x8_intra[VAR_2->quant_mat][0];
VAR_2->inter_scale = &ivi5_scale_quant_8x8_inter[VAR_2->quant_mat][0];
} else {
VAR_2->intra_base = ivi5_base_quant_4x4_intra;
VAR_2->inter_base = ivi5_base_quant_4x4_inter;
VAR_2->intra_scale = ivi5_scale_quant_4x4_intra;
VAR_2->inter_scale = ivi5_scale_quant_4x4_inter;
}
VAR_4 = ff_ivi_decode_blocks(&VAR_0->gb, VAR_2, tile);
if (VAR_4 < 0) {
av_log(VAR_3, AV_LOG_ERROR, "Corrupted blocks data encountered!\n");
break;
}
}
}
for (VAR_5 = VAR_2->num_corr-1; VAR_5 >= 0; VAR_5--) {
VAR_7 = VAR_2->corr[VAR_5*2];
VAR_8 = VAR_2->corr[VAR_5*2+1];
FFSWAP(uint8_t, VAR_2->rv_map->runtab[VAR_7], VAR_2->rv_map->runtab[VAR_8]);
FFSWAP(int16_t, VAR_2->rv_map->valtab[VAR_7], VAR_2->rv_map->valtab[VAR_8]);
}
if (IVI_DEBUG && VAR_2->checksum_present) {
chksum = ivi_calc_band_checksum(VAR_2);
if (chksum != VAR_2->checksum) {
av_log(VAR_3, AV_LOG_ERROR,
"Band checksum mismatch! Plane %d, VAR_2 %d, received: %x, calculated: %x\n",
VAR_2->plane, VAR_2->band_num, VAR_2->checksum, chksum);
}
}
return VAR_4;
}
|
[
"static int FUNC_0(IVI5DecContext *VAR_0, int VAR_1,\nIVIBandDesc *VAR_2, AVCodecContext *VAR_3)\n{",
"int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8;",
"IVITile *tile;",
"uint16_t chksum;",
"VAR_2->buf = VAR_2->bufs[VAR_0->dst_buf];",
"VAR_2->ref_buf = VAR_2->bufs[VAR_0->ref_buf];",
"VAR_2->data_ptr = VAR_0->frame_data + (get_bits_count(&VAR_0->gb) >> 3);",
"VAR_4 = decode_band_hdr(VAR_0, VAR_2, VAR_3);",
"if (VAR_4) {",
"av_log(VAR_3, AV_LOG_ERROR, \"Error while decoding VAR_2 header: %d\\n\",\nVAR_4);",
"return -1;",
"}",
"if (VAR_2->is_empty) {",
"av_log(VAR_3, AV_LOG_ERROR, \"Empty VAR_2 encountered!\\n\");",
"return -1;",
"}",
"VAR_2->rv_map = &VAR_0->rvmap_tabs[VAR_2->rvmap_sel];",
"for (VAR_5 = 0; VAR_5 < VAR_2->num_corr; VAR_5++) {",
"VAR_7 = VAR_2->corr[VAR_5*2];",
"VAR_8 = VAR_2->corr[VAR_5*2+1];",
"FFSWAP(uint8_t, VAR_2->rv_map->runtab[VAR_7], VAR_2->rv_map->runtab[VAR_8]);",
"FFSWAP(int16_t, VAR_2->rv_map->valtab[VAR_7], VAR_2->rv_map->valtab[VAR_8]);",
"}",
"for (VAR_6 = 0; VAR_6 < VAR_2->num_tiles; VAR_6++) {",
"tile = &VAR_2->tiles[VAR_6];",
"tile->is_empty = get_bits1(&VAR_0->gb);",
"if (tile->is_empty) {",
"ff_ivi_process_empty_tile(VAR_3, VAR_2, tile,\n(VAR_0->planes[0].bands[0].mb_size >> 3) - (VAR_2->mb_size >> 3));",
"align_get_bits(&VAR_0->gb);",
"} else {",
"tile->data_size = ff_ivi_dec_tile_data_size(&VAR_0->gb);",
"VAR_4 = decode_mb_info(VAR_0, VAR_2, tile, VAR_3);",
"if (VAR_4 < 0)\nbreak;",
"if (VAR_2->blk_size == 8) {",
"VAR_2->intra_base = &ivi5_base_quant_8x8_intra[VAR_2->quant_mat][0];",
"VAR_2->inter_base = &ivi5_base_quant_8x8_inter[VAR_2->quant_mat][0];",
"VAR_2->intra_scale = &ivi5_scale_quant_8x8_intra[VAR_2->quant_mat][0];",
"VAR_2->inter_scale = &ivi5_scale_quant_8x8_inter[VAR_2->quant_mat][0];",
"} else {",
"VAR_2->intra_base = ivi5_base_quant_4x4_intra;",
"VAR_2->inter_base = ivi5_base_quant_4x4_inter;",
"VAR_2->intra_scale = ivi5_scale_quant_4x4_intra;",
"VAR_2->inter_scale = ivi5_scale_quant_4x4_inter;",
"}",
"VAR_4 = ff_ivi_decode_blocks(&VAR_0->gb, VAR_2, tile);",
"if (VAR_4 < 0) {",
"av_log(VAR_3, AV_LOG_ERROR, \"Corrupted blocks data encountered!\\n\");",
"break;",
"}",
"}",
"}",
"for (VAR_5 = VAR_2->num_corr-1; VAR_5 >= 0; VAR_5--) {",
"VAR_7 = VAR_2->corr[VAR_5*2];",
"VAR_8 = VAR_2->corr[VAR_5*2+1];",
"FFSWAP(uint8_t, VAR_2->rv_map->runtab[VAR_7], VAR_2->rv_map->runtab[VAR_8]);",
"FFSWAP(int16_t, VAR_2->rv_map->valtab[VAR_7], VAR_2->rv_map->valtab[VAR_8]);",
"}",
"if (IVI_DEBUG && VAR_2->checksum_present) {",
"chksum = ivi_calc_band_checksum(VAR_2);",
"if (chksum != VAR_2->checksum) {",
"av_log(VAR_3, AV_LOG_ERROR,\n\"Band checksum mismatch! Plane %d, VAR_2 %d, received: %x, calculated: %x\\n\",\nVAR_2->plane, VAR_2->band_num, VAR_2->checksum, chksum);",
"}",
"}",
"return VAR_4;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25
],
[
27,
29
],
[
31
],
[
33
],
[
37
],
[
39
],
[
41
],
[
43
],
[
47
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
67
],
[
69
],
[
73
],
[
75
],
[
77,
79
],
[
81
],
[
83
],
[
85
],
[
89
],
[
91,
93
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149
],
[
153
],
[
155
],
[
157
],
[
159,
161,
163
],
[
165
],
[
167
],
[
171
],
[
173
]
] |
6,360 |
static void test_interface_impl(const char *type)
{
Object *obj = object_new(type);
TestIf *iobj = TEST_IF(obj);
TestIfClass *ioc = TEST_IF_GET_CLASS(iobj);
g_assert(iobj);
g_assert(ioc->test == PATTERN);
}
| true |
qemu
|
265804b5d755502438b4d42a3682f54e03ea4d32
|
static void test_interface_impl(const char *type)
{
Object *obj = object_new(type);
TestIf *iobj = TEST_IF(obj);
TestIfClass *ioc = TEST_IF_GET_CLASS(iobj);
g_assert(iobj);
g_assert(ioc->test == PATTERN);
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(const char *VAR_0)
{
Object *obj = object_new(VAR_0);
TestIf *iobj = TEST_IF(obj);
TestIfClass *ioc = TEST_IF_GET_CLASS(iobj);
g_assert(iobj);
g_assert(ioc->test == PATTERN);
}
|
[
"static void FUNC_0(const char *VAR_0)\n{",
"Object *obj = object_new(VAR_0);",
"TestIf *iobj = TEST_IF(obj);",
"TestIfClass *ioc = TEST_IF_GET_CLASS(iobj);",
"g_assert(iobj);",
"g_assert(ioc->test == PATTERN);",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
18
]
] |
6,362 |
uint32_t HELPER(shl_cc)(CPUM68KState *env, uint32_t val, uint32_t shift)
{
uint64_t result;
shift &= 63;
result = (uint64_t)val << shift;
env->cc_c = (result >> 32) & 1;
env->cc_n = result;
env->cc_z = result;
env->cc_v = 0;
env->cc_x = shift ? env->cc_c : env->cc_x;
return result;
}
| true |
qemu
|
367790cce8e14131426f5190dfd7d1bdbf656e4d
|
uint32_t HELPER(shl_cc)(CPUM68KState *env, uint32_t val, uint32_t shift)
{
uint64_t result;
shift &= 63;
result = (uint64_t)val << shift;
env->cc_c = (result >> 32) & 1;
env->cc_n = result;
env->cc_z = result;
env->cc_v = 0;
env->cc_x = shift ? env->cc_c : env->cc_x;
return result;
}
|
{
"code": [
"uint32_t HELPER(shl_cc)(CPUM68KState *env, uint32_t val, uint32_t shift)",
" uint64_t result;",
" shift &= 63;",
" result = (uint64_t)val << shift;",
" env->cc_c = (result >> 32) & 1;",
" env->cc_n = result;",
" env->cc_z = result;",
" env->cc_v = 0;",
" env->cc_x = shift ? env->cc_c : env->cc_x;",
" return result;",
" shift &= 63;",
" env->cc_n = result;",
" env->cc_z = result;",
" env->cc_v = 0;",
" env->cc_x = shift ? env->cc_c : env->cc_x;",
" return result;",
" shift &= 63;",
" env->cc_n = result;",
" env->cc_z = result;",
" env->cc_x = shift ? env->cc_c : env->cc_x;",
" return result;"
],
"line_no": [
1,
5,
9,
11,
15,
17,
19,
21,
23,
27,
9,
17,
19,
21,
23,
27,
9,
17,
19,
23,
27
]
}
|
uint32_t FUNC_0(shl_cc)(CPUM68KState *env, uint32_t val, uint32_t shift)
{
uint64_t result;
shift &= 63;
result = (uint64_t)val << shift;
env->cc_c = (result >> 32) & 1;
env->cc_n = result;
env->cc_z = result;
env->cc_v = 0;
env->cc_x = shift ? env->cc_c : env->cc_x;
return result;
}
|
[
"uint32_t FUNC_0(shl_cc)(CPUM68KState *env, uint32_t val, uint32_t shift)\n{",
"uint64_t result;",
"shift &= 63;",
"result = (uint64_t)val << shift;",
"env->cc_c = (result >> 32) & 1;",
"env->cc_n = result;",
"env->cc_z = result;",
"env->cc_v = 0;",
"env->cc_x = shift ? env->cc_c : env->cc_x;",
"return result;",
"}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0
] |
[
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
27
],
[
29
]
] |
6,363 |
static int inc_refcounts(BlockDriverState *bs,
BdrvCheckResult *res,
uint16_t **refcount_table,
int64_t *refcount_table_size,
int64_t offset, int64_t size)
{
BDRVQcowState *s = bs->opaque;
uint64_t start, last, cluster_offset, k;
int ret;
if (size <= 0) {
return 0;
}
start = start_of_cluster(s, offset);
last = start_of_cluster(s, offset + size - 1);
for(cluster_offset = start; cluster_offset <= last;
cluster_offset += s->cluster_size) {
k = cluster_offset >> s->cluster_bits;
if (k >= *refcount_table_size) {
ret = realloc_refcount_array(s, refcount_table,
refcount_table_size, k + 1);
if (ret < 0) {
res->check_errors++;
return ret;
}
}
if (++(*refcount_table)[k] == 0) {
fprintf(stderr, "ERROR: overflow cluster offset=0x%" PRIx64
"\n", cluster_offset);
res->corruptions++;
}
}
return 0;
}
| true |
qemu
|
7453c96b78c2b09aa72924f933bb9616e5474194
|
static int inc_refcounts(BlockDriverState *bs,
BdrvCheckResult *res,
uint16_t **refcount_table,
int64_t *refcount_table_size,
int64_t offset, int64_t size)
{
BDRVQcowState *s = bs->opaque;
uint64_t start, last, cluster_offset, k;
int ret;
if (size <= 0) {
return 0;
}
start = start_of_cluster(s, offset);
last = start_of_cluster(s, offset + size - 1);
for(cluster_offset = start; cluster_offset <= last;
cluster_offset += s->cluster_size) {
k = cluster_offset >> s->cluster_bits;
if (k >= *refcount_table_size) {
ret = realloc_refcount_array(s, refcount_table,
refcount_table_size, k + 1);
if (ret < 0) {
res->check_errors++;
return ret;
}
}
if (++(*refcount_table)[k] == 0) {
fprintf(stderr, "ERROR: overflow cluster offset=0x%" PRIx64
"\n", cluster_offset);
res->corruptions++;
}
}
return 0;
}
|
{
"code": [
" uint16_t **refcount_table,",
" uint64_t start, last, cluster_offset, k;",
" if (++(*refcount_table)[k] == 0) {"
],
"line_no": [
5,
15,
57
]
}
|
static int FUNC_0(BlockDriverState *VAR_0,
BdrvCheckResult *VAR_1,
uint16_t **VAR_2,
int64_t *VAR_3,
int64_t VAR_4, int64_t VAR_5)
{
BDRVQcowState *s = VAR_0->opaque;
uint64_t start, last, cluster_offset, k;
int VAR_6;
if (VAR_5 <= 0) {
return 0;
}
start = start_of_cluster(s, VAR_4);
last = start_of_cluster(s, VAR_4 + VAR_5 - 1);
for(cluster_offset = start; cluster_offset <= last;
cluster_offset += s->cluster_size) {
k = cluster_offset >> s->cluster_bits;
if (k >= *VAR_3) {
VAR_6 = realloc_refcount_array(s, VAR_2,
VAR_3, k + 1);
if (VAR_6 < 0) {
VAR_1->check_errors++;
return VAR_6;
}
}
if (++(*VAR_2)[k] == 0) {
fprintf(stderr, "ERROR: overflow cluster VAR_4=0x%" PRIx64
"\n", cluster_offset);
VAR_1->corruptions++;
}
}
return 0;
}
|
[
"static int FUNC_0(BlockDriverState *VAR_0,\nBdrvCheckResult *VAR_1,\nuint16_t **VAR_2,\nint64_t *VAR_3,\nint64_t VAR_4, int64_t VAR_5)\n{",
"BDRVQcowState *s = VAR_0->opaque;",
"uint64_t start, last, cluster_offset, k;",
"int VAR_6;",
"if (VAR_5 <= 0) {",
"return 0;",
"}",
"start = start_of_cluster(s, VAR_4);",
"last = start_of_cluster(s, VAR_4 + VAR_5 - 1);",
"for(cluster_offset = start; cluster_offset <= last;",
"cluster_offset += s->cluster_size) {",
"k = cluster_offset >> s->cluster_bits;",
"if (k >= *VAR_3) {",
"VAR_6 = realloc_refcount_array(s, VAR_2,\nVAR_3, k + 1);",
"if (VAR_6 < 0) {",
"VAR_1->check_errors++;",
"return VAR_6;",
"}",
"}",
"if (++(*VAR_2)[k] == 0) {",
"fprintf(stderr, \"ERROR: overflow cluster VAR_4=0x%\" PRIx64\n\"\\n\", cluster_offset);",
"VAR_1->corruptions++;",
"}",
"}",
"return 0;",
"}"
] |
[
1,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5,
7,
9,
11
],
[
13
],
[
15
],
[
17
],
[
21
],
[
23
],
[
25
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41,
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
57
],
[
59,
61
],
[
63
],
[
65
],
[
67
],
[
71
],
[
73
]
] |
6,364 |
static void test_server_free(TestServer *server)
{
int i;
qemu_chr_delete(server->chr);
for (i = 0; i < server->fds_num; i++) {
close(server->fds[i]);
}
if (server->log_fd != -1) {
close(server->log_fd);
}
unlink(server->socket_path);
g_free(server->socket_path);
g_free(server->chr_name);
g_free(server);
}
| true |
qemu
|
9732baf67850dac57dfc7dc8980bf408889a8973
|
static void test_server_free(TestServer *server)
{
int i;
qemu_chr_delete(server->chr);
for (i = 0; i < server->fds_num; i++) {
close(server->fds[i]);
}
if (server->log_fd != -1) {
close(server->log_fd);
}
unlink(server->socket_path);
g_free(server->socket_path);
g_free(server->chr_name);
g_free(server);
}
|
{
"code": [
"static void test_server_free(TestServer *server)"
],
"line_no": [
1
]
}
|
static void FUNC_0(TestServer *VAR_0)
{
int VAR_1;
qemu_chr_delete(VAR_0->chr);
for (VAR_1 = 0; VAR_1 < VAR_0->fds_num; VAR_1++) {
close(VAR_0->fds[VAR_1]);
}
if (VAR_0->log_fd != -1) {
close(VAR_0->log_fd);
}
unlink(VAR_0->socket_path);
g_free(VAR_0->socket_path);
g_free(VAR_0->chr_name);
g_free(VAR_0);
}
|
[
"static void FUNC_0(TestServer *VAR_0)\n{",
"int VAR_1;",
"qemu_chr_delete(VAR_0->chr);",
"for (VAR_1 = 0; VAR_1 < VAR_0->fds_num; VAR_1++) {",
"close(VAR_0->fds[VAR_1]);",
"}",
"if (VAR_0->log_fd != -1) {",
"close(VAR_0->log_fd);",
"}",
"unlink(VAR_0->socket_path);",
"g_free(VAR_0->socket_path);",
"g_free(VAR_0->chr_name);",
"g_free(VAR_0);",
"}"
] |
[
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
9
],
[
13
],
[
15
],
[
17
],
[
21
],
[
23
],
[
25
],
[
29
],
[
31
],
[
37
],
[
39
],
[
41
]
] |
6,365 |
int qcow2_discard_clusters(BlockDriverState *bs, uint64_t offset,
int nb_sectors, enum qcow2_discard_type type, bool full_discard)
{
BDRVQcow2State *s = bs->opaque;
uint64_t end_offset;
uint64_t nb_clusters;
int ret;
end_offset = offset + (nb_sectors << BDRV_SECTOR_BITS);
/* Round start up and end down */
offset = align_offset(offset, s->cluster_size);
end_offset = start_of_cluster(s, end_offset);
if (offset > end_offset) {
return 0;
}
nb_clusters = size_to_clusters(s, end_offset - offset);
s->cache_discards = true;
/* Each L2 table is handled by its own loop iteration */
while (nb_clusters > 0) {
ret = discard_single_l2(bs, offset, nb_clusters, type, full_discard);
if (ret < 0) {
goto fail;
}
nb_clusters -= ret;
offset += (ret * s->cluster_size);
}
ret = 0;
fail:
s->cache_discards = false;
qcow2_process_discards(bs, ret);
return ret;
}
| true |
qemu
|
0c1bd4692f9a19fb4d4bb3afe45439a09c37ab4c
|
int qcow2_discard_clusters(BlockDriverState *bs, uint64_t offset,
int nb_sectors, enum qcow2_discard_type type, bool full_discard)
{
BDRVQcow2State *s = bs->opaque;
uint64_t end_offset;
uint64_t nb_clusters;
int ret;
end_offset = offset + (nb_sectors << BDRV_SECTOR_BITS);
offset = align_offset(offset, s->cluster_size);
end_offset = start_of_cluster(s, end_offset);
if (offset > end_offset) {
return 0;
}
nb_clusters = size_to_clusters(s, end_offset - offset);
s->cache_discards = true;
while (nb_clusters > 0) {
ret = discard_single_l2(bs, offset, nb_clusters, type, full_discard);
if (ret < 0) {
goto fail;
}
nb_clusters -= ret;
offset += (ret * s->cluster_size);
}
ret = 0;
fail:
s->cache_discards = false;
qcow2_process_discards(bs, ret);
return ret;
}
|
{
"code": [
" offset = align_offset(offset, s->cluster_size);",
" end_offset = start_of_cluster(s, end_offset);",
" if (offset > end_offset) {",
" return 0;"
],
"line_no": [
23,
25,
29,
31
]
}
|
int FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1,
int VAR_2, enum qcow2_discard_type VAR_3, bool VAR_4)
{
BDRVQcow2State *s = VAR_0->opaque;
uint64_t end_offset;
uint64_t nb_clusters;
int VAR_5;
end_offset = VAR_1 + (VAR_2 << BDRV_SECTOR_BITS);
VAR_1 = align_offset(VAR_1, s->cluster_size);
end_offset = start_of_cluster(s, end_offset);
if (VAR_1 > end_offset) {
return 0;
}
nb_clusters = size_to_clusters(s, end_offset - VAR_1);
s->cache_discards = true;
while (nb_clusters > 0) {
VAR_5 = discard_single_l2(VAR_0, VAR_1, nb_clusters, VAR_3, VAR_4);
if (VAR_5 < 0) {
goto fail;
}
nb_clusters -= VAR_5;
VAR_1 += (VAR_5 * s->cluster_size);
}
VAR_5 = 0;
fail:
s->cache_discards = false;
qcow2_process_discards(VAR_0, VAR_5);
return VAR_5;
}
|
[
"int FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1,\nint VAR_2, enum qcow2_discard_type VAR_3, bool VAR_4)\n{",
"BDRVQcow2State *s = VAR_0->opaque;",
"uint64_t end_offset;",
"uint64_t nb_clusters;",
"int VAR_5;",
"end_offset = VAR_1 + (VAR_2 << BDRV_SECTOR_BITS);",
"VAR_1 = align_offset(VAR_1, s->cluster_size);",
"end_offset = start_of_cluster(s, end_offset);",
"if (VAR_1 > end_offset) {",
"return 0;",
"}",
"nb_clusters = size_to_clusters(s, end_offset - VAR_1);",
"s->cache_discards = true;",
"while (nb_clusters > 0) {",
"VAR_5 = discard_single_l2(VAR_0, VAR_1, nb_clusters, VAR_3, VAR_4);",
"if (VAR_5 < 0) {",
"goto fail;",
"}",
"nb_clusters -= VAR_5;",
"VAR_1 += (VAR_5 * s->cluster_size);",
"}",
"VAR_5 = 0;",
"fail:\ns->cache_discards = false;",
"qcow2_process_discards(VAR_0, VAR_5);",
"return VAR_5;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
1,
1,
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
],
[
17
],
[
23
],
[
25
],
[
29
],
[
31
],
[
33
],
[
37
],
[
41
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
59
],
[
61
],
[
63
],
[
67
],
[
69,
71
],
[
73
],
[
77
],
[
79
]
] |
6,366 |
static void audio_init(qemu_irq *pic)
{
struct soundhw *c;
int audio_enabled = 0;
for (c = soundhw; !audio_enabled && c->name; ++c) {
audio_enabled = c->enabled;
}
if (audio_enabled) {
AudioState *s;
s = AUD_init();
if (s) {
for (c = soundhw; c->name; ++c) {
if (c->enabled) {
if (c->isa) {
c->init.init_isa(s, pic);
}
}
}
}
}
}
| true |
qemu
|
0d9acba8fddbf970c7353083e6a60b47017ce3e4
|
static void audio_init(qemu_irq *pic)
{
struct soundhw *c;
int audio_enabled = 0;
for (c = soundhw; !audio_enabled && c->name; ++c) {
audio_enabled = c->enabled;
}
if (audio_enabled) {
AudioState *s;
s = AUD_init();
if (s) {
for (c = soundhw; c->name; ++c) {
if (c->enabled) {
if (c->isa) {
c->init.init_isa(s, pic);
}
}
}
}
}
}
|
{
"code": [
" if (s) {",
" for (c = soundhw; c->name; ++c) {",
" if (c->enabled) {",
" if (c->isa) {",
" c->init.init_isa(s, pic);",
" if (s) {",
" for (c = soundhw; c->name; ++c) {",
" if (s) {",
" for (c = soundhw; c->name; ++c) {",
" if (c->enabled) {",
" if (c->isa) {"
],
"line_no": [
27,
29,
31,
33,
35,
27,
29,
27,
29,
31,
33
]
}
|
static void FUNC_0(qemu_irq *VAR_0)
{
struct soundhw *VAR_1;
int VAR_2 = 0;
for (VAR_1 = soundhw; !VAR_2 && VAR_1->name; ++VAR_1) {
VAR_2 = VAR_1->enabled;
}
if (VAR_2) {
AudioState *s;
s = AUD_init();
if (s) {
for (VAR_1 = soundhw; VAR_1->name; ++VAR_1) {
if (VAR_1->enabled) {
if (VAR_1->isa) {
VAR_1->init.init_isa(s, VAR_0);
}
}
}
}
}
}
|
[
"static void FUNC_0(qemu_irq *VAR_0)\n{",
"struct soundhw *VAR_1;",
"int VAR_2 = 0;",
"for (VAR_1 = soundhw; !VAR_2 && VAR_1->name; ++VAR_1) {",
"VAR_2 = VAR_1->enabled;",
"}",
"if (VAR_2) {",
"AudioState *s;",
"s = AUD_init();",
"if (s) {",
"for (VAR_1 = soundhw; VAR_1->name; ++VAR_1) {",
"if (VAR_1->enabled) {",
"if (VAR_1->isa) {",
"VAR_1->init.init_isa(s, VAR_0);",
"}",
"}",
"}",
"}",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
]
] |
6,367 |
static int gif_image_write_image(ByteIOContext *pb,
int x1, int y1, int width, int height,
const uint8_t *buf, int linesize, int pix_fmt)
{
PutBitContext p;
uint8_t buffer[200]; /* 100 * 9 / 8 = 113 */
int i, left, w, v;
const uint8_t *ptr;
/* image block */
put_byte(pb, 0x2c);
put_le16(pb, x1);
put_le16(pb, y1);
put_le16(pb, width);
put_le16(pb, height);
put_byte(pb, 0x00); /* flags */
/* no local clut */
put_byte(pb, 0x08);
left= width * height;
init_put_bits(&p, buffer, 130);
/*
* the thing here is the bitstream is written as little packets, with a size byte before
* but it's still the same bitstream between packets (no flush !)
*/
ptr = buf;
w = width;
while(left>0) {
gif_put_bits_rev(&p, 9, 0x0100); /* clear code */
for(i=0;i<GIF_CHUNKS;i++) {
if (pix_fmt == PIX_FMT_RGB24) {
v = gif_clut_index(ptr[0], ptr[1], ptr[2]);
ptr+=3;
} else {
v = *ptr++;
}
gif_put_bits_rev(&p, 9, v);
if (--w == 0) {
w = width;
buf += linesize;
ptr = buf;
}
}
if(left<=GIF_CHUNKS) {
gif_put_bits_rev(&p, 9, 0x101); /* end of stream */
gif_flush_put_bits_rev(&p);
}
if(pbBufPtr(&p) - p.buf > 0) {
put_byte(pb, pbBufPtr(&p) - p.buf); /* byte count of the packet */
put_buffer(pb, p.buf, pbBufPtr(&p) - p.buf); /* the actual buffer */
p.buf_ptr = p.buf; /* dequeue the bytes off the bitstream */
}
if(left<=GIF_CHUNKS) {
put_byte(pb, 0x00); /* end of image block */
}
left-=GIF_CHUNKS;
}
return 0;
}
| true |
FFmpeg
|
f5fc28d23c46d334c809c11d62651d0080f1c325
|
static int gif_image_write_image(ByteIOContext *pb,
int x1, int y1, int width, int height,
const uint8_t *buf, int linesize, int pix_fmt)
{
PutBitContext p;
uint8_t buffer[200];
int i, left, w, v;
const uint8_t *ptr;
put_byte(pb, 0x2c);
put_le16(pb, x1);
put_le16(pb, y1);
put_le16(pb, width);
put_le16(pb, height);
put_byte(pb, 0x00);
put_byte(pb, 0x08);
left= width * height;
init_put_bits(&p, buffer, 130);
ptr = buf;
w = width;
while(left>0) {
gif_put_bits_rev(&p, 9, 0x0100);
for(i=0;i<GIF_CHUNKS;i++) {
if (pix_fmt == PIX_FMT_RGB24) {
v = gif_clut_index(ptr[0], ptr[1], ptr[2]);
ptr+=3;
} else {
v = *ptr++;
}
gif_put_bits_rev(&p, 9, v);
if (--w == 0) {
w = width;
buf += linesize;
ptr = buf;
}
}
if(left<=GIF_CHUNKS) {
gif_put_bits_rev(&p, 9, 0x101);
gif_flush_put_bits_rev(&p);
}
if(pbBufPtr(&p) - p.buf > 0) {
put_byte(pb, pbBufPtr(&p) - p.buf);
put_buffer(pb, p.buf, pbBufPtr(&p) - p.buf);
p.buf_ptr = p.buf;
}
if(left<=GIF_CHUNKS) {
put_byte(pb, 0x00);
}
left-=GIF_CHUNKS;
}
return 0;
}
|
{
"code": [
" for(i=0;i<GIF_CHUNKS;i++) {",
" if(left<=GIF_CHUNKS) {"
],
"line_no": [
69,
99
]
}
|
static int FUNC_0(ByteIOContext *VAR_0,
int VAR_1, int VAR_2, int VAR_3, int VAR_4,
const uint8_t *VAR_5, int VAR_6, int VAR_7)
{
PutBitContext p;
uint8_t buffer[200];
int VAR_8, VAR_9, VAR_10, VAR_11;
const uint8_t *VAR_12;
put_byte(VAR_0, 0x2c);
put_le16(VAR_0, VAR_1);
put_le16(VAR_0, VAR_2);
put_le16(VAR_0, VAR_3);
put_le16(VAR_0, VAR_4);
put_byte(VAR_0, 0x00);
put_byte(VAR_0, 0x08);
VAR_9= VAR_3 * VAR_4;
init_put_bits(&p, buffer, 130);
VAR_12 = VAR_5;
VAR_10 = VAR_3;
while(VAR_9>0) {
gif_put_bits_rev(&p, 9, 0x0100);
for(VAR_8=0;VAR_8<GIF_CHUNKS;VAR_8++) {
if (VAR_7 == PIX_FMT_RGB24) {
VAR_11 = gif_clut_index(VAR_12[0], VAR_12[1], VAR_12[2]);
VAR_12+=3;
} else {
VAR_11 = *VAR_12++;
}
gif_put_bits_rev(&p, 9, VAR_11);
if (--VAR_10 == 0) {
VAR_10 = VAR_3;
VAR_5 += VAR_6;
VAR_12 = VAR_5;
}
}
if(VAR_9<=GIF_CHUNKS) {
gif_put_bits_rev(&p, 9, 0x101);
gif_flush_put_bits_rev(&p);
}
if(pbBufPtr(&p) - p.VAR_5 > 0) {
put_byte(VAR_0, pbBufPtr(&p) - p.VAR_5);
put_buffer(VAR_0, p.VAR_5, pbBufPtr(&p) - p.VAR_5);
p.buf_ptr = p.VAR_5;
}
if(VAR_9<=GIF_CHUNKS) {
put_byte(VAR_0, 0x00);
}
VAR_9-=GIF_CHUNKS;
}
return 0;
}
|
[
"static int FUNC_0(ByteIOContext *VAR_0,\nint VAR_1, int VAR_2, int VAR_3, int VAR_4,\nconst uint8_t *VAR_5, int VAR_6, int VAR_7)\n{",
"PutBitContext p;",
"uint8_t buffer[200];",
"int VAR_8, VAR_9, VAR_10, VAR_11;",
"const uint8_t *VAR_12;",
"put_byte(VAR_0, 0x2c);",
"put_le16(VAR_0, VAR_1);",
"put_le16(VAR_0, VAR_2);",
"put_le16(VAR_0, VAR_3);",
"put_le16(VAR_0, VAR_4);",
"put_byte(VAR_0, 0x00);",
"put_byte(VAR_0, 0x08);",
"VAR_9= VAR_3 * VAR_4;",
"init_put_bits(&p, buffer, 130);",
"VAR_12 = VAR_5;",
"VAR_10 = VAR_3;",
"while(VAR_9>0) {",
"gif_put_bits_rev(&p, 9, 0x0100);",
"for(VAR_8=0;VAR_8<GIF_CHUNKS;VAR_8++) {",
"if (VAR_7 == PIX_FMT_RGB24) {",
"VAR_11 = gif_clut_index(VAR_12[0], VAR_12[1], VAR_12[2]);",
"VAR_12+=3;",
"} else {",
"VAR_11 = *VAR_12++;",
"}",
"gif_put_bits_rev(&p, 9, VAR_11);",
"if (--VAR_10 == 0) {",
"VAR_10 = VAR_3;",
"VAR_5 += VAR_6;",
"VAR_12 = VAR_5;",
"}",
"}",
"if(VAR_9<=GIF_CHUNKS) {",
"gif_put_bits_rev(&p, 9, 0x101);",
"gif_flush_put_bits_rev(&p);",
"}",
"if(pbBufPtr(&p) - p.VAR_5 > 0) {",
"put_byte(VAR_0, pbBufPtr(&p) - p.VAR_5);",
"put_buffer(VAR_0, p.VAR_5, pbBufPtr(&p) - p.VAR_5);",
"p.buf_ptr = p.VAR_5;",
"}",
"if(VAR_9<=GIF_CHUNKS) {",
"put_byte(VAR_0, 0x00);",
"}",
"VAR_9-=GIF_CHUNKS;",
"}",
"return 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,
1,
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
],
[
37
],
[
41
],
[
45
],
[
57
],
[
59
],
[
61
],
[
65
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
125
],
[
127
],
[
129
],
[
131
]
] |
6,368 |
int64_t qmp_guest_file_open(const char *path, bool has_mode, const char *mode, Error **err)
{
FILE *fh;
int fd;
int64_t ret = -1, handle;
if (!has_mode) {
mode = "r";
}
slog("guest-file-open called, filepath: %s, mode: %s", path, mode);
fh = fopen(path, mode);
if (!fh) {
error_setg_errno(err, errno, "failed to open file '%s' (mode: '%s')",
path, mode);
return -1;
}
/* set fd non-blocking to avoid common use cases (like reading from a
* named pipe) from hanging the agent
*/
fd = fileno(fh);
ret = fcntl(fd, F_GETFL);
ret = fcntl(fd, F_SETFL, ret | O_NONBLOCK);
if (ret == -1) {
error_setg_errno(err, errno, "failed to make file '%s' non-blocking",
path);
fclose(fh);
return -1;
}
handle = guest_file_handle_add(fh, err);
if (error_is_set(err)) {
fclose(fh);
return -1;
}
slog("guest-file-open, handle: %d", handle);
return handle;
}
| true |
qemu
|
c689b4f1bac352dcfd6ecb9a1d45337de0f1de67
|
int64_t qmp_guest_file_open(const char *path, bool has_mode, const char *mode, Error **err)
{
FILE *fh;
int fd;
int64_t ret = -1, handle;
if (!has_mode) {
mode = "r";
}
slog("guest-file-open called, filepath: %s, mode: %s", path, mode);
fh = fopen(path, mode);
if (!fh) {
error_setg_errno(err, errno, "failed to open file '%s' (mode: '%s')",
path, mode);
return -1;
}
fd = fileno(fh);
ret = fcntl(fd, F_GETFL);
ret = fcntl(fd, F_SETFL, ret | O_NONBLOCK);
if (ret == -1) {
error_setg_errno(err, errno, "failed to make file '%s' non-blocking",
path);
fclose(fh);
return -1;
}
handle = guest_file_handle_add(fh, err);
if (error_is_set(err)) {
fclose(fh);
return -1;
}
slog("guest-file-open, handle: %d", handle);
return handle;
}
|
{
"code": [
" fh = fopen(path, mode);",
" if (!fh) {",
" error_setg_errno(err, errno, \"failed to open file '%s' (mode: '%s')\",",
" path, mode);"
],
"line_no": [
21,
23,
25,
27
]
}
|
int64_t FUNC_0(const char *path, bool has_mode, const char *mode, Error **err)
{
FILE *fh;
int VAR_0;
int64_t ret = -1, handle;
if (!has_mode) {
mode = "r";
}
slog("guest-file-open called, filepath: %s, mode: %s", path, mode);
fh = fopen(path, mode);
if (!fh) {
error_setg_errno(err, errno, "failed to open file '%s' (mode: '%s')",
path, mode);
return -1;
}
VAR_0 = fileno(fh);
ret = fcntl(VAR_0, F_GETFL);
ret = fcntl(VAR_0, F_SETFL, ret | O_NONBLOCK);
if (ret == -1) {
error_setg_errno(err, errno, "failed to make file '%s' non-blocking",
path);
fclose(fh);
return -1;
}
handle = guest_file_handle_add(fh, err);
if (error_is_set(err)) {
fclose(fh);
return -1;
}
slog("guest-file-open, handle: %d", handle);
return handle;
}
|
[
"int64_t FUNC_0(const char *path, bool has_mode, const char *mode, Error **err)\n{",
"FILE *fh;",
"int VAR_0;",
"int64_t ret = -1, handle;",
"if (!has_mode) {",
"mode = \"r\";",
"}",
"slog(\"guest-file-open called, filepath: %s, mode: %s\", path, mode);",
"fh = fopen(path, mode);",
"if (!fh) {",
"error_setg_errno(err, errno, \"failed to open file '%s' (mode: '%s')\",\npath, mode);",
"return -1;",
"}",
"VAR_0 = fileno(fh);",
"ret = fcntl(VAR_0, F_GETFL);",
"ret = fcntl(VAR_0, F_SETFL, ret | O_NONBLOCK);",
"if (ret == -1) {",
"error_setg_errno(err, errno, \"failed to make file '%s' non-blocking\",\npath);",
"fclose(fh);",
"return -1;",
"}",
"handle = guest_file_handle_add(fh, err);",
"if (error_is_set(err)) {",
"fclose(fh);",
"return -1;",
"}",
"slog(\"guest-file-open, handle: %d\", handle);",
"return handle;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25,
27
],
[
29
],
[
31
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49,
51
],
[
53
],
[
55
],
[
57
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
73
],
[
75
],
[
77
]
] |
6,369 |
static void vp5_parse_coeff_models(VP56Context *s)
{
VP56RangeCoder *c = &s->c;
VP56Model *model = s->modelp;
uint8_t def_prob[11];
int node, cg, ctx;
int ct; /* code type */
int pt; /* plane type (0 for Y, 1 for U or V) */
memset(def_prob, 0x80, sizeof(def_prob));
for (pt=0; pt<2; pt++)
for (node=0; node<11; node++)
if (vp56_rac_get_prob(c, vp5_dccv_pct[pt][node])) {
def_prob[node] = vp56_rac_gets_nn(c, 7);
model->coeff_dccv[pt][node] = def_prob[node];
} else if (s->framep[VP56_FRAME_CURRENT]->key_frame) {
model->coeff_dccv[pt][node] = def_prob[node];
}
for (ct=0; ct<3; ct++)
for (pt=0; pt<2; pt++)
for (cg=0; cg<6; cg++)
for (node=0; node<11; node++)
if (vp56_rac_get_prob(c, vp5_ract_pct[ct][pt][cg][node])) {
def_prob[node] = vp56_rac_gets_nn(c, 7);
model->coeff_ract[pt][ct][cg][node] = def_prob[node];
} else if (s->framep[VP56_FRAME_CURRENT]->key_frame) {
model->coeff_ract[pt][ct][cg][node] = def_prob[node];
}
/* coeff_dcct is a linear combination of coeff_dccv */
for (pt=0; pt<2; pt++)
for (ctx=0; ctx<36; ctx++)
for (node=0; node<5; node++)
model->coeff_dcct[pt][ctx][node] = av_clip(((model->coeff_dccv[pt][node] * vp5_dccv_lc[node][ctx][0] + 128) >> 8) + vp5_dccv_lc[node][ctx][1], 1, 254);
/* coeff_acct is a linear combination of coeff_ract */
for (ct=0; ct<3; ct++)
for (pt=0; pt<2; pt++)
for (cg=0; cg<3; cg++)
for (ctx=0; ctx<6; ctx++)
for (node=0; node<5; node++)
model->coeff_acct[pt][ct][cg][ctx][node] = av_clip(((model->coeff_ract[pt][ct][cg][node] * vp5_ract_lc[ct][cg][node][ctx][0] + 128) >> 8) + vp5_ract_lc[ct][cg][node][ctx][1], 1, 254);
}
| false |
FFmpeg
|
7c249d4fbaf4431b20a90a3c942f3370c0039d9e
|
static void vp5_parse_coeff_models(VP56Context *s)
{
VP56RangeCoder *c = &s->c;
VP56Model *model = s->modelp;
uint8_t def_prob[11];
int node, cg, ctx;
int ct;
int pt;
memset(def_prob, 0x80, sizeof(def_prob));
for (pt=0; pt<2; pt++)
for (node=0; node<11; node++)
if (vp56_rac_get_prob(c, vp5_dccv_pct[pt][node])) {
def_prob[node] = vp56_rac_gets_nn(c, 7);
model->coeff_dccv[pt][node] = def_prob[node];
} else if (s->framep[VP56_FRAME_CURRENT]->key_frame) {
model->coeff_dccv[pt][node] = def_prob[node];
}
for (ct=0; ct<3; ct++)
for (pt=0; pt<2; pt++)
for (cg=0; cg<6; cg++)
for (node=0; node<11; node++)
if (vp56_rac_get_prob(c, vp5_ract_pct[ct][pt][cg][node])) {
def_prob[node] = vp56_rac_gets_nn(c, 7);
model->coeff_ract[pt][ct][cg][node] = def_prob[node];
} else if (s->framep[VP56_FRAME_CURRENT]->key_frame) {
model->coeff_ract[pt][ct][cg][node] = def_prob[node];
}
for (pt=0; pt<2; pt++)
for (ctx=0; ctx<36; ctx++)
for (node=0; node<5; node++)
model->coeff_dcct[pt][ctx][node] = av_clip(((model->coeff_dccv[pt][node] * vp5_dccv_lc[node][ctx][0] + 128) >> 8) + vp5_dccv_lc[node][ctx][1], 1, 254);
for (ct=0; ct<3; ct++)
for (pt=0; pt<2; pt++)
for (cg=0; cg<3; cg++)
for (ctx=0; ctx<6; ctx++)
for (node=0; node<5; node++)
model->coeff_acct[pt][ct][cg][ctx][node] = av_clip(((model->coeff_ract[pt][ct][cg][node] * vp5_ract_lc[ct][cg][node][ctx][0] + 128) >> 8) + vp5_ract_lc[ct][cg][node][ctx][1], 1, 254);
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(VP56Context *VAR_0)
{
VP56RangeCoder *c = &VAR_0->c;
VP56Model *model = VAR_0->modelp;
uint8_t def_prob[11];
int VAR_1, VAR_2, VAR_3;
int VAR_4;
int VAR_5;
memset(def_prob, 0x80, sizeof(def_prob));
for (VAR_5=0; VAR_5<2; VAR_5++)
for (VAR_1=0; VAR_1<11; VAR_1++)
if (vp56_rac_get_prob(c, vp5_dccv_pct[VAR_5][VAR_1])) {
def_prob[VAR_1] = vp56_rac_gets_nn(c, 7);
model->coeff_dccv[VAR_5][VAR_1] = def_prob[VAR_1];
} else if (VAR_0->framep[VP56_FRAME_CURRENT]->key_frame) {
model->coeff_dccv[VAR_5][VAR_1] = def_prob[VAR_1];
}
for (VAR_4=0; VAR_4<3; VAR_4++)
for (VAR_5=0; VAR_5<2; VAR_5++)
for (VAR_2=0; VAR_2<6; VAR_2++)
for (VAR_1=0; VAR_1<11; VAR_1++)
if (vp56_rac_get_prob(c, vp5_ract_pct[VAR_4][VAR_5][VAR_2][VAR_1])) {
def_prob[VAR_1] = vp56_rac_gets_nn(c, 7);
model->coeff_ract[VAR_5][VAR_4][VAR_2][VAR_1] = def_prob[VAR_1];
} else if (VAR_0->framep[VP56_FRAME_CURRENT]->key_frame) {
model->coeff_ract[VAR_5][VAR_4][VAR_2][VAR_1] = def_prob[VAR_1];
}
for (VAR_5=0; VAR_5<2; VAR_5++)
for (VAR_3=0; VAR_3<36; VAR_3++)
for (VAR_1=0; VAR_1<5; VAR_1++)
model->coeff_dcct[VAR_5][VAR_3][VAR_1] = av_clip(((model->coeff_dccv[VAR_5][VAR_1] * vp5_dccv_lc[VAR_1][VAR_3][0] + 128) >> 8) + vp5_dccv_lc[VAR_1][VAR_3][1], 1, 254);
for (VAR_4=0; VAR_4<3; VAR_4++)
for (VAR_5=0; VAR_5<2; VAR_5++)
for (VAR_2=0; VAR_2<3; VAR_2++)
for (VAR_3=0; VAR_3<6; VAR_3++)
for (VAR_1=0; VAR_1<5; VAR_1++)
model->coeff_acct[VAR_5][VAR_4][VAR_2][VAR_3][VAR_1] = av_clip(((model->coeff_ract[VAR_5][VAR_4][VAR_2][VAR_1] * vp5_ract_lc[VAR_4][VAR_2][VAR_1][VAR_3][0] + 128) >> 8) + vp5_ract_lc[VAR_4][VAR_2][VAR_1][VAR_3][1], 1, 254);
}
|
[
"static void FUNC_0(VP56Context *VAR_0)\n{",
"VP56RangeCoder *c = &VAR_0->c;",
"VP56Model *model = VAR_0->modelp;",
"uint8_t def_prob[11];",
"int VAR_1, VAR_2, VAR_3;",
"int VAR_4;",
"int VAR_5;",
"memset(def_prob, 0x80, sizeof(def_prob));",
"for (VAR_5=0; VAR_5<2; VAR_5++)",
"for (VAR_1=0; VAR_1<11; VAR_1++)",
"if (vp56_rac_get_prob(c, vp5_dccv_pct[VAR_5][VAR_1])) {",
"def_prob[VAR_1] = vp56_rac_gets_nn(c, 7);",
"model->coeff_dccv[VAR_5][VAR_1] = def_prob[VAR_1];",
"} else if (VAR_0->framep[VP56_FRAME_CURRENT]->key_frame) {",
"model->coeff_dccv[VAR_5][VAR_1] = def_prob[VAR_1];",
"}",
"for (VAR_4=0; VAR_4<3; VAR_4++)",
"for (VAR_5=0; VAR_5<2; VAR_5++)",
"for (VAR_2=0; VAR_2<6; VAR_2++)",
"for (VAR_1=0; VAR_1<11; VAR_1++)",
"if (vp56_rac_get_prob(c, vp5_ract_pct[VAR_4][VAR_5][VAR_2][VAR_1])) {",
"def_prob[VAR_1] = vp56_rac_gets_nn(c, 7);",
"model->coeff_ract[VAR_5][VAR_4][VAR_2][VAR_1] = def_prob[VAR_1];",
"} else if (VAR_0->framep[VP56_FRAME_CURRENT]->key_frame) {",
"model->coeff_ract[VAR_5][VAR_4][VAR_2][VAR_1] = def_prob[VAR_1];",
"}",
"for (VAR_5=0; VAR_5<2; VAR_5++)",
"for (VAR_3=0; VAR_3<36; VAR_3++)",
"for (VAR_1=0; VAR_1<5; VAR_1++)",
"model->coeff_dcct[VAR_5][VAR_3][VAR_1] = av_clip(((model->coeff_dccv[VAR_5][VAR_1] * vp5_dccv_lc[VAR_1][VAR_3][0] + 128) >> 8) + vp5_dccv_lc[VAR_1][VAR_3][1], 1, 254);",
"for (VAR_4=0; VAR_4<3; VAR_4++)",
"for (VAR_5=0; VAR_5<2; VAR_5++)",
"for (VAR_2=0; VAR_2<3; VAR_2++)",
"for (VAR_3=0; VAR_3<6; VAR_3++)",
"for (VAR_1=0; VAR_1<5; VAR_1++)",
"model->coeff_acct[VAR_5][VAR_4][VAR_2][VAR_3][VAR_1] = av_clip(((model->coeff_ract[VAR_5][VAR_4][VAR_2][VAR_1] * vp5_ract_lc[VAR_4][VAR_2][VAR_1][VAR_3][0] + 128) >> 8) + vp5_ract_lc[VAR_4][VAR_2][VAR_1][VAR_3][1], 1, 254);",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
65
],
[
67
],
[
69
],
[
71
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
]
] |
6,370 |
static void qmp_input_get_next_type(Visitor *v, int *kind, const int *qobjects,
const char *name, Error **errp)
{
QmpInputVisitor *qiv = to_qiv(v);
QObject *qobj = qmp_input_get_object(qiv, name, false);
if (!qobj) {
error_setg(errp, QERR_MISSING_PARAMETER, name ? name : "null");
return;
}
*kind = qobjects[qobject_type(qobj)];
}
| true |
qemu
|
0426d53c6530606bf7641b83f2b755fe61c280ee
|
static void qmp_input_get_next_type(Visitor *v, int *kind, const int *qobjects,
const char *name, Error **errp)
{
QmpInputVisitor *qiv = to_qiv(v);
QObject *qobj = qmp_input_get_object(qiv, name, false);
if (!qobj) {
error_setg(errp, QERR_MISSING_PARAMETER, name ? name : "null");
return;
}
*kind = qobjects[qobject_type(qobj)];
}
|
{
"code": [
"static void qmp_input_get_next_type(Visitor *v, int *kind, const int *qobjects,",
" *kind = qobjects[qobject_type(qobj)];"
],
"line_no": [
1,
21
]
}
|
static void FUNC_0(Visitor *VAR_0, int *VAR_1, const int *VAR_2,
const char *VAR_3, Error **VAR_4)
{
QmpInputVisitor *qiv = to_qiv(VAR_0);
QObject *qobj = qmp_input_get_object(qiv, VAR_3, false);
if (!qobj) {
error_setg(VAR_4, QERR_MISSING_PARAMETER, VAR_3 ? VAR_3 : "null");
return;
}
*VAR_1 = VAR_2[qobject_type(qobj)];
}
|
[
"static void FUNC_0(Visitor *VAR_0, int *VAR_1, const int *VAR_2,\nconst char *VAR_3, Error **VAR_4)\n{",
"QmpInputVisitor *qiv = to_qiv(VAR_0);",
"QObject *qobj = qmp_input_get_object(qiv, VAR_3, false);",
"if (!qobj) {",
"error_setg(VAR_4, QERR_MISSING_PARAMETER, VAR_3 ? VAR_3 : \"null\");",
"return;",
"}",
"*VAR_1 = VAR_2[qobject_type(qobj)];",
"}"
] |
[
1,
0,
0,
0,
0,
0,
0,
1,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
]
] |
6,371 |
static void breakpoint_invalidate(CPUArchState *env, target_ulong pc)
{
tb_invalidate_phys_addr(cpu_get_phys_page_debug(env, pc));
}
| true |
qemu
|
9d70c4b7b8a580959cc4f739e7c9a04964d00d46
|
static void breakpoint_invalidate(CPUArchState *env, target_ulong pc)
{
tb_invalidate_phys_addr(cpu_get_phys_page_debug(env, pc));
}
|
{
"code": [
" tb_invalidate_phys_addr(cpu_get_phys_page_debug(env, pc));"
],
"line_no": [
5
]
}
|
static void FUNC_0(CPUArchState *VAR_0, target_ulong VAR_1)
{
tb_invalidate_phys_addr(cpu_get_phys_page_debug(VAR_0, VAR_1));
}
|
[
"static void FUNC_0(CPUArchState *VAR_0, target_ulong VAR_1)\n{",
"tb_invalidate_phys_addr(cpu_get_phys_page_debug(VAR_0, VAR_1));",
"}"
] |
[
0,
1,
0
] |
[
[
1,
3
],
[
5
],
[
7
]
] |
6,372 |
static void dump_data(const uint8_t *data, int len) {}
| true |
qemu
|
4f4321c11ff6e98583846bfd6f0e81954924b003
|
static void dump_data(const uint8_t *data, int len) {}
|
{
"code": [
"static void dump_data(const uint8_t *data, int len) {}"
],
"line_no": [
1
]
}
|
static void FUNC_0(const uint8_t *VAR_0, int VAR_1) {}
|
[
"static void FUNC_0(const uint8_t *VAR_0, int VAR_1) {}"
] |
[
1
] |
[
[
1
]
] |
6,373 |
static void vc1_inv_trans_8x4_c(uint8_t *dest, int linesize, DCTELEM *block)
{
int i;
register int t1,t2,t3,t4,t5,t6,t7,t8;
DCTELEM *src, *dst;
const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
src = block;
dst = block;
for(i = 0; i < 4; i++){
t1 = 12 * (src[0] + src[4]) + 4;
t2 = 12 * (src[0] - src[4]) + 4;
t3 = 16 * src[2] + 6 * src[6];
t4 = 6 * src[2] - 16 * src[6];
t5 = t1 + t3;
t6 = t2 + t4;
t7 = t2 - t4;
t8 = t1 - t3;
t1 = 16 * src[1] + 15 * src[3] + 9 * src[5] + 4 * src[7];
t2 = 15 * src[1] - 4 * src[3] - 16 * src[5] - 9 * src[7];
t3 = 9 * src[1] - 16 * src[3] + 4 * src[5] + 15 * src[7];
t4 = 4 * src[1] - 9 * src[3] + 15 * src[5] - 16 * src[7];
dst[0] = (t5 + t1) >> 3;
dst[1] = (t6 + t2) >> 3;
dst[2] = (t7 + t3) >> 3;
dst[3] = (t8 + t4) >> 3;
dst[4] = (t8 - t4) >> 3;
dst[5] = (t7 - t3) >> 3;
dst[6] = (t6 - t2) >> 3;
dst[7] = (t5 - t1) >> 3;
src += 8;
dst += 8;
}
src = block;
for(i = 0; i < 8; i++){
t1 = 17 * (src[ 0] + src[16]) + 64;
t2 = 17 * (src[ 0] - src[16]) + 64;
t3 = 22 * src[ 8] + 10 * src[24];
t4 = 22 * src[24] - 10 * src[ 8];
dest[0*linesize] = cm[dest[0*linesize] + ((t1 + t3) >> 7)];
dest[1*linesize] = cm[dest[1*linesize] + ((t2 - t4) >> 7)];
dest[2*linesize] = cm[dest[2*linesize] + ((t2 + t4) >> 7)];
dest[3*linesize] = cm[dest[3*linesize] + ((t1 - t3) >> 7)];
src ++;
dest++;
}
}
| true |
FFmpeg
|
c23acbaed40101c677dfcfbbfe0d2c230a8e8f44
|
static void vc1_inv_trans_8x4_c(uint8_t *dest, int linesize, DCTELEM *block)
{
int i;
register int t1,t2,t3,t4,t5,t6,t7,t8;
DCTELEM *src, *dst;
const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
src = block;
dst = block;
for(i = 0; i < 4; i++){
t1 = 12 * (src[0] + src[4]) + 4;
t2 = 12 * (src[0] - src[4]) + 4;
t3 = 16 * src[2] + 6 * src[6];
t4 = 6 * src[2] - 16 * src[6];
t5 = t1 + t3;
t6 = t2 + t4;
t7 = t2 - t4;
t8 = t1 - t3;
t1 = 16 * src[1] + 15 * src[3] + 9 * src[5] + 4 * src[7];
t2 = 15 * src[1] - 4 * src[3] - 16 * src[5] - 9 * src[7];
t3 = 9 * src[1] - 16 * src[3] + 4 * src[5] + 15 * src[7];
t4 = 4 * src[1] - 9 * src[3] + 15 * src[5] - 16 * src[7];
dst[0] = (t5 + t1) >> 3;
dst[1] = (t6 + t2) >> 3;
dst[2] = (t7 + t3) >> 3;
dst[3] = (t8 + t4) >> 3;
dst[4] = (t8 - t4) >> 3;
dst[5] = (t7 - t3) >> 3;
dst[6] = (t6 - t2) >> 3;
dst[7] = (t5 - t1) >> 3;
src += 8;
dst += 8;
}
src = block;
for(i = 0; i < 8; i++){
t1 = 17 * (src[ 0] + src[16]) + 64;
t2 = 17 * (src[ 0] - src[16]) + 64;
t3 = 22 * src[ 8] + 10 * src[24];
t4 = 22 * src[24] - 10 * src[ 8];
dest[0*linesize] = cm[dest[0*linesize] + ((t1 + t3) >> 7)];
dest[1*linesize] = cm[dest[1*linesize] + ((t2 - t4) >> 7)];
dest[2*linesize] = cm[dest[2*linesize] + ((t2 + t4) >> 7)];
dest[3*linesize] = cm[dest[3*linesize] + ((t1 - t3) >> 7)];
src ++;
dest++;
}
}
|
{
"code": [
" const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;",
" const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;",
" const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;",
" const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;",
" dest[0*linesize] = cm[dest[0*linesize] + ((t1 + t3) >> 7)];",
" dest[1*linesize] = cm[dest[1*linesize] + ((t2 - t4) >> 7)];",
" dest[2*linesize] = cm[dest[2*linesize] + ((t2 + t4) >> 7)];",
" dest[3*linesize] = cm[dest[3*linesize] + ((t1 - t3) >> 7)];",
" const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;",
" const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;",
" dest[0*linesize] = cm[dest[0*linesize] + ((t1 + t3) >> 7)];",
" dest[1*linesize] = cm[dest[1*linesize] + ((t2 - t4) >> 7)];",
" dest[2*linesize] = cm[dest[2*linesize] + ((t2 + t4) >> 7)];",
" dest[3*linesize] = cm[dest[3*linesize] + ((t1 - t3) >> 7)];"
],
"line_no": [
11,
11,
11,
11,
91,
93,
95,
97,
11,
11,
91,
93,
95,
97
]
}
|
static void FUNC_0(uint8_t *VAR_0, int VAR_1, DCTELEM *VAR_2)
{
int VAR_3;
register int VAR_4,VAR_5,VAR_6,VAR_7,VAR_8,VAR_9,VAR_10,VAR_11;
DCTELEM *src, *dst;
const uint8_t *VAR_12 = ff_cropTbl + MAX_NEG_CROP;
src = VAR_2;
dst = VAR_2;
for(VAR_3 = 0; VAR_3 < 4; VAR_3++){
VAR_4 = 12 * (src[0] + src[4]) + 4;
VAR_5 = 12 * (src[0] - src[4]) + 4;
VAR_6 = 16 * src[2] + 6 * src[6];
VAR_7 = 6 * src[2] - 16 * src[6];
VAR_8 = VAR_4 + VAR_6;
VAR_9 = VAR_5 + VAR_7;
VAR_10 = VAR_5 - VAR_7;
VAR_11 = VAR_4 - VAR_6;
VAR_4 = 16 * src[1] + 15 * src[3] + 9 * src[5] + 4 * src[7];
VAR_5 = 15 * src[1] - 4 * src[3] - 16 * src[5] - 9 * src[7];
VAR_6 = 9 * src[1] - 16 * src[3] + 4 * src[5] + 15 * src[7];
VAR_7 = 4 * src[1] - 9 * src[3] + 15 * src[5] - 16 * src[7];
dst[0] = (VAR_8 + VAR_4) >> 3;
dst[1] = (VAR_9 + VAR_5) >> 3;
dst[2] = (VAR_10 + VAR_6) >> 3;
dst[3] = (VAR_11 + VAR_7) >> 3;
dst[4] = (VAR_11 - VAR_7) >> 3;
dst[5] = (VAR_10 - VAR_6) >> 3;
dst[6] = (VAR_9 - VAR_5) >> 3;
dst[7] = (VAR_8 - VAR_4) >> 3;
src += 8;
dst += 8;
}
src = VAR_2;
for(VAR_3 = 0; VAR_3 < 8; VAR_3++){
VAR_4 = 17 * (src[ 0] + src[16]) + 64;
VAR_5 = 17 * (src[ 0] - src[16]) + 64;
VAR_6 = 22 * src[ 8] + 10 * src[24];
VAR_7 = 22 * src[24] - 10 * src[ 8];
VAR_0[0*VAR_1] = VAR_12[VAR_0[0*VAR_1] + ((VAR_4 + VAR_6) >> 7)];
VAR_0[1*VAR_1] = VAR_12[VAR_0[1*VAR_1] + ((VAR_5 - VAR_7) >> 7)];
VAR_0[2*VAR_1] = VAR_12[VAR_0[2*VAR_1] + ((VAR_5 + VAR_7) >> 7)];
VAR_0[3*VAR_1] = VAR_12[VAR_0[3*VAR_1] + ((VAR_4 - VAR_6) >> 7)];
src ++;
VAR_0++;
}
}
|
[
"static void FUNC_0(uint8_t *VAR_0, int VAR_1, DCTELEM *VAR_2)\n{",
"int VAR_3;",
"register int VAR_4,VAR_5,VAR_6,VAR_7,VAR_8,VAR_9,VAR_10,VAR_11;",
"DCTELEM *src, *dst;",
"const uint8_t *VAR_12 = ff_cropTbl + MAX_NEG_CROP;",
"src = VAR_2;",
"dst = VAR_2;",
"for(VAR_3 = 0; VAR_3 < 4; VAR_3++){",
"VAR_4 = 12 * (src[0] + src[4]) + 4;",
"VAR_5 = 12 * (src[0] - src[4]) + 4;",
"VAR_6 = 16 * src[2] + 6 * src[6];",
"VAR_7 = 6 * src[2] - 16 * src[6];",
"VAR_8 = VAR_4 + VAR_6;",
"VAR_9 = VAR_5 + VAR_7;",
"VAR_10 = VAR_5 - VAR_7;",
"VAR_11 = VAR_4 - VAR_6;",
"VAR_4 = 16 * src[1] + 15 * src[3] + 9 * src[5] + 4 * src[7];",
"VAR_5 = 15 * src[1] - 4 * src[3] - 16 * src[5] - 9 * src[7];",
"VAR_6 = 9 * src[1] - 16 * src[3] + 4 * src[5] + 15 * src[7];",
"VAR_7 = 4 * src[1] - 9 * src[3] + 15 * src[5] - 16 * src[7];",
"dst[0] = (VAR_8 + VAR_4) >> 3;",
"dst[1] = (VAR_9 + VAR_5) >> 3;",
"dst[2] = (VAR_10 + VAR_6) >> 3;",
"dst[3] = (VAR_11 + VAR_7) >> 3;",
"dst[4] = (VAR_11 - VAR_7) >> 3;",
"dst[5] = (VAR_10 - VAR_6) >> 3;",
"dst[6] = (VAR_9 - VAR_5) >> 3;",
"dst[7] = (VAR_8 - VAR_4) >> 3;",
"src += 8;",
"dst += 8;",
"}",
"src = VAR_2;",
"for(VAR_3 = 0; VAR_3 < 8; VAR_3++){",
"VAR_4 = 17 * (src[ 0] + src[16]) + 64;",
"VAR_5 = 17 * (src[ 0] - src[16]) + 64;",
"VAR_6 = 22 * src[ 8] + 10 * src[24];",
"VAR_7 = 22 * src[24] - 10 * src[ 8];",
"VAR_0[0*VAR_1] = VAR_12[VAR_0[0*VAR_1] + ((VAR_4 + VAR_6) >> 7)];",
"VAR_0[1*VAR_1] = VAR_12[VAR_0[1*VAR_1] + ((VAR_5 - VAR_7) >> 7)];",
"VAR_0[2*VAR_1] = VAR_12[VAR_0[2*VAR_1] + ((VAR_5 + VAR_7) >> 7)];",
"VAR_0[3*VAR_1] = VAR_12[VAR_0[3*VAR_1] + ((VAR_4 - VAR_6) >> 7)];",
"src ++;",
"VAR_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,
1,
1,
1,
1,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
31
],
[
33
],
[
35
],
[
37
],
[
41
],
[
43
],
[
45
],
[
47
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
69
],
[
71
],
[
73
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
91
],
[
93
],
[
95
],
[
97
],
[
101
],
[
103
],
[
105
],
[
107
]
] |
6,375 |
void kvm_arch_update_guest_debug(CPUState *env, struct kvm_guest_debug *dbg)
{
const uint8_t type_code[] = {
[GDB_BREAKPOINT_HW] = 0x0,
[GDB_WATCHPOINT_WRITE] = 0x1,
[GDB_WATCHPOINT_ACCESS] = 0x3
};
const uint8_t len_code[] = {
[1] = 0x0, [2] = 0x1, [4] = 0x3, [8] = 0x2
};
int n;
if (kvm_sw_breakpoints_active(env))
dbg->control |= KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_SW_BP;
if (nb_hw_breakpoint > 0) {
dbg->control |= KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_HW_BP;
dbg->arch.debugreg[7] = 0x0600;
for (n = 0; n < nb_hw_breakpoint; n++) {
dbg->arch.debugreg[n] = hw_breakpoint[n].addr;
dbg->arch.debugreg[7] |= (2 << (n * 2)) |
(type_code[hw_breakpoint[n].type] << (16 + n*4)) |
(len_code[hw_breakpoint[n].len] << (18 + n*4));
}
}
/* Legal xcr0 for loading */
env->xcr0 = 1;
}
| true |
qemu
|
95c077c91900c1420cd4f0be996ffeea6fb6cec8
|
void kvm_arch_update_guest_debug(CPUState *env, struct kvm_guest_debug *dbg)
{
const uint8_t type_code[] = {
[GDB_BREAKPOINT_HW] = 0x0,
[GDB_WATCHPOINT_WRITE] = 0x1,
[GDB_WATCHPOINT_ACCESS] = 0x3
};
const uint8_t len_code[] = {
[1] = 0x0, [2] = 0x1, [4] = 0x3, [8] = 0x2
};
int n;
if (kvm_sw_breakpoints_active(env))
dbg->control |= KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_SW_BP;
if (nb_hw_breakpoint > 0) {
dbg->control |= KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_HW_BP;
dbg->arch.debugreg[7] = 0x0600;
for (n = 0; n < nb_hw_breakpoint; n++) {
dbg->arch.debugreg[n] = hw_breakpoint[n].addr;
dbg->arch.debugreg[7] |= (2 << (n * 2)) |
(type_code[hw_breakpoint[n].type] << (16 + n*4)) |
(len_code[hw_breakpoint[n].len] << (18 + n*4));
}
}
env->xcr0 = 1;
}
|
{
"code": [
" (len_code[hw_breakpoint[n].len] << (18 + n*4));"
],
"line_no": [
45
]
}
|
void FUNC_0(CPUState *VAR_0, struct kvm_guest_debug *VAR_1)
{
const uint8_t VAR_2[] = {
[GDB_BREAKPOINT_HW] = 0x0,
[GDB_WATCHPOINT_WRITE] = 0x1,
[GDB_WATCHPOINT_ACCESS] = 0x3
};
const uint8_t VAR_3[] = {
[1] = 0x0, [2] = 0x1, [4] = 0x3, [8] = 0x2
};
int VAR_4;
if (kvm_sw_breakpoints_active(VAR_0))
VAR_1->control |= KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_SW_BP;
if (nb_hw_breakpoint > 0) {
VAR_1->control |= KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_HW_BP;
VAR_1->arch.debugreg[7] = 0x0600;
for (VAR_4 = 0; VAR_4 < nb_hw_breakpoint; VAR_4++) {
VAR_1->arch.debugreg[VAR_4] = hw_breakpoint[VAR_4].addr;
VAR_1->arch.debugreg[7] |= (2 << (VAR_4 * 2)) |
(VAR_2[hw_breakpoint[VAR_4].type] << (16 + VAR_4*4)) |
(VAR_3[hw_breakpoint[VAR_4].len] << (18 + VAR_4*4));
}
}
VAR_0->xcr0 = 1;
}
|
[
"void FUNC_0(CPUState *VAR_0, struct kvm_guest_debug *VAR_1)\n{",
"const uint8_t VAR_2[] = {",
"[GDB_BREAKPOINT_HW] = 0x0,\n[GDB_WATCHPOINT_WRITE] = 0x1,\n[GDB_WATCHPOINT_ACCESS] = 0x3\n};",
"const uint8_t VAR_3[] = {",
"[1] = 0x0, [2] = 0x1, [4] = 0x3, [8] = 0x2\n};",
"int VAR_4;",
"if (kvm_sw_breakpoints_active(VAR_0))\nVAR_1->control |= KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_SW_BP;",
"if (nb_hw_breakpoint > 0) {",
"VAR_1->control |= KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_HW_BP;",
"VAR_1->arch.debugreg[7] = 0x0600;",
"for (VAR_4 = 0; VAR_4 < nb_hw_breakpoint; VAR_4++) {",
"VAR_1->arch.debugreg[VAR_4] = hw_breakpoint[VAR_4].addr;",
"VAR_1->arch.debugreg[7] |= (2 << (VAR_4 * 2)) |\n(VAR_2[hw_breakpoint[VAR_4].type] << (16 + VAR_4*4)) |\n(VAR_3[hw_breakpoint[VAR_4].len] << (18 + VAR_4*4));",
"}",
"}",
"VAR_0->xcr0 = 1;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7,
9,
11,
13
],
[
15
],
[
17,
19
],
[
21
],
[
25,
27
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41,
43,
45
],
[
47
],
[
49
],
[
53
],
[
55
]
] |
6,376 |
static inline int cris_swap(const int mode, int x)
{
switch (mode)
{
case N: asm ("swapn\t%0\n" : "+r" (x) : "0" (x)); break;
case W: asm ("swapw\t%0\n" : "+r" (x) : "0" (x)); break;
case B: asm ("swapb\t%0\n" : "+r" (x) : "0" (x)); break;
case R: asm ("swapr\t%0\n" : "+r" (x) : "0" (x)); break;
case B|R: asm ("swapbr\t%0\n" : "+r" (x) : "0" (x)); break;
case W|R: asm ("swapwr\t%0\n" : "+r" (x) : "0" (x)); break;
case W|B: asm ("swapwb\t%0\n" : "+r" (x) : "0" (x)); break;
case W|B|R: asm ("swapwbr\t%0\n" : "+r" (x) : "0" (x)); break;
case N|R: asm ("swapnr\t%0\n" : "+r" (x) : "0" (x)); break;
case N|B: asm ("swapnb\t%0\n" : "+r" (x) : "0" (x)); break;
case N|B|R: asm ("swapnbr\t%0\n" : "+r" (x) : "0" (x)); break;
case N|W: asm ("swapnw\t%0\n" : "+r" (x) : "0" (x)); break;
default:
err();
break;
}
return x;
}
| true |
qemu
|
21ce148c7ec71ee32834061355a5ecfd1a11f90f
|
static inline int cris_swap(const int mode, int x)
{
switch (mode)
{
case N: asm ("swapn\t%0\n" : "+r" (x) : "0" (x)); break;
case W: asm ("swapw\t%0\n" : "+r" (x) : "0" (x)); break;
case B: asm ("swapb\t%0\n" : "+r" (x) : "0" (x)); break;
case R: asm ("swapr\t%0\n" : "+r" (x) : "0" (x)); break;
case B|R: asm ("swapbr\t%0\n" : "+r" (x) : "0" (x)); break;
case W|R: asm ("swapwr\t%0\n" : "+r" (x) : "0" (x)); break;
case W|B: asm ("swapwb\t%0\n" : "+r" (x) : "0" (x)); break;
case W|B|R: asm ("swapwbr\t%0\n" : "+r" (x) : "0" (x)); break;
case N|R: asm ("swapnr\t%0\n" : "+r" (x) : "0" (x)); break;
case N|B: asm ("swapnb\t%0\n" : "+r" (x) : "0" (x)); break;
case N|B|R: asm ("swapnbr\t%0\n" : "+r" (x) : "0" (x)); break;
case N|W: asm ("swapnw\t%0\n" : "+r" (x) : "0" (x)); break;
default:
err();
break;
}
return x;
}
|
{
"code": [
"static inline int cris_swap(const int mode, int x)"
],
"line_no": [
1
]
}
|
static inline int FUNC_0(const int VAR_0, int VAR_1)
{
switch (VAR_0)
{
case N: asm ("swapn\t%0\n" : "+r" (VAR_1) : "0" (VAR_1)); break;
case W: asm ("swapw\t%0\n" : "+r" (VAR_1) : "0" (VAR_1)); break;
case B: asm ("swapb\t%0\n" : "+r" (VAR_1) : "0" (VAR_1)); break;
case R: asm ("swapr\t%0\n" : "+r" (VAR_1) : "0" (VAR_1)); break;
case B|R: asm ("swapbr\t%0\n" : "+r" (VAR_1) : "0" (VAR_1)); break;
case W|R: asm ("swapwr\t%0\n" : "+r" (VAR_1) : "0" (VAR_1)); break;
case W|B: asm ("swapwb\t%0\n" : "+r" (VAR_1) : "0" (VAR_1)); break;
case W|B|R: asm ("swapwbr\t%0\n" : "+r" (VAR_1) : "0" (VAR_1)); break;
case N|R: asm ("swapnr\t%0\n" : "+r" (VAR_1) : "0" (VAR_1)); break;
case N|B: asm ("swapnb\t%0\n" : "+r" (VAR_1) : "0" (VAR_1)); break;
case N|B|R: asm ("swapnbr\t%0\n" : "+r" (VAR_1) : "0" (VAR_1)); break;
case N|W: asm ("swapnw\t%0\n" : "+r" (VAR_1) : "0" (VAR_1)); break;
default:
err();
break;
}
return VAR_1;
}
|
[
"static inline int FUNC_0(const int VAR_0, int VAR_1)\n{",
"switch (VAR_0)\n{",
"case N: asm (\"swapn\\t%0\\n\" : \"+r\" (VAR_1) : \"0\" (VAR_1)); break;",
"case W: asm (\"swapw\\t%0\\n\" : \"+r\" (VAR_1) : \"0\" (VAR_1)); break;",
"case B: asm (\"swapb\\t%0\\n\" : \"+r\" (VAR_1) : \"0\" (VAR_1)); break;",
"case R: asm (\"swapr\\t%0\\n\" : \"+r\" (VAR_1) : \"0\" (VAR_1)); break;",
"case B|R: asm (\"swapbr\\t%0\\n\" : \"+r\" (VAR_1) : \"0\" (VAR_1)); break;",
"case W|R: asm (\"swapwr\\t%0\\n\" : \"+r\" (VAR_1) : \"0\" (VAR_1)); break;",
"case W|B: asm (\"swapwb\\t%0\\n\" : \"+r\" (VAR_1) : \"0\" (VAR_1)); break;",
"case W|B|R: asm (\"swapwbr\\t%0\\n\" : \"+r\" (VAR_1) : \"0\" (VAR_1)); break;",
"case N|R: asm (\"swapnr\\t%0\\n\" : \"+r\" (VAR_1) : \"0\" (VAR_1)); break;",
"case N|B: asm (\"swapnb\\t%0\\n\" : \"+r\" (VAR_1) : \"0\" (VAR_1)); break;",
"case N|B|R: asm (\"swapnbr\\t%0\\n\" : \"+r\" (VAR_1) : \"0\" (VAR_1)); break;",
"case N|W: asm (\"swapnw\\t%0\\n\" : \"+r\" (VAR_1) : \"0\" (VAR_1)); break;",
"default:\nerr();",
"break;",
"}",
"return VAR_1;",
"}"
] |
[
1,
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
]
] |
6,378 |
static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
int *outFilterSize, int xInc, int srcW,
int dstW, int filterAlign, int one,
int flags, int cpu_flags,
SwsVector *srcFilter, SwsVector *dstFilter,
double param[2], int srcPos, int dstPos)
{
int i;
int filterSize;
int filter2Size;
int minFilterSize;
int64_t *filter = NULL;
int64_t *filter2 = NULL;
const int64_t fone = 1LL << (54 - FFMIN(av_log2(srcW/dstW), 8));
int ret = -1;
emms_c(); // FIXME should not be required but IS (even for non-MMX versions)
// NOTE: the +3 is for the MMX(+1) / SSE(+3) scaler which reads over the end
FF_ALLOC_OR_GOTO(NULL, *filterPos, (dstW + 3) * sizeof(**filterPos), fail);
if (FFABS(xInc - 0x10000) < 10 && srcPos == dstPos) { // unscaled
int i;
filterSize = 1;
FF_ALLOCZ_OR_GOTO(NULL, filter,
dstW * sizeof(*filter) * filterSize, fail);
for (i = 0; i < dstW; i++) {
filter[i * filterSize] = fone;
(*filterPos)[i] = i;
} else if (flags & SWS_POINT) { // lame looking point sampling mode
int i;
int64_t xDstInSrc;
filterSize = 1;
FF_ALLOC_OR_GOTO(NULL, filter,
dstW * sizeof(*filter) * filterSize, fail);
xDstInSrc = ((dstPos*(int64_t)xInc)>>8) - ((srcPos*0x8000LL)>>7);
for (i = 0; i < dstW; i++) {
int xx = (xDstInSrc - ((filterSize - 1) << 15) + (1 << 15)) >> 16;
(*filterPos)[i] = xx;
filter[i] = fone;
xDstInSrc += xInc;
} else if ((xInc <= (1 << 16) && (flags & SWS_AREA)) ||
(flags & SWS_FAST_BILINEAR)) { // bilinear upscale
int i;
int64_t xDstInSrc;
filterSize = 2;
FF_ALLOC_OR_GOTO(NULL, filter,
dstW * sizeof(*filter) * filterSize, fail);
xDstInSrc = ((dstPos*(int64_t)xInc)>>8) - ((srcPos*0x8000LL)>>7);
for (i = 0; i < dstW; i++) {
int xx = (xDstInSrc - ((filterSize - 1) << 15) + (1 << 15)) >> 16;
int j;
(*filterPos)[i] = xx;
// bilinear upscale / linear interpolate / area averaging
for (j = 0; j < filterSize; j++) {
int64_t coeff= fone - FFABS(((int64_t)xx<<16) - xDstInSrc)*(fone>>16);
if (coeff < 0)
coeff = 0;
filter[i * filterSize + j] = coeff;
xx++;
xDstInSrc += xInc;
} else {
int64_t xDstInSrc;
int sizeFactor;
if (flags & SWS_BICUBIC)
sizeFactor = 4;
else if (flags & SWS_X)
sizeFactor = 8;
else if (flags & SWS_AREA)
sizeFactor = 1; // downscale only, for upscale it is bilinear
else if (flags & SWS_GAUSS)
sizeFactor = 8; // infinite ;)
else if (flags & SWS_LANCZOS)
sizeFactor = param[0] != SWS_PARAM_DEFAULT ? ceil(2 * param[0]) : 6;
else if (flags & SWS_SINC)
sizeFactor = 20; // infinite ;)
else if (flags & SWS_SPLINE)
sizeFactor = 20; // infinite ;)
else if (flags & SWS_BILINEAR)
sizeFactor = 2;
else {
av_assert0(0);
if (xInc <= 1 << 16)
filterSize = 1 + sizeFactor; // upscale
else
filterSize = 1 + (sizeFactor * srcW + dstW - 1) / dstW;
filterSize = FFMIN(filterSize, srcW - 2);
filterSize = FFMAX(filterSize, 1);
FF_ALLOC_OR_GOTO(NULL, filter,
dstW * sizeof(*filter) * filterSize, fail);
xDstInSrc = ((dstPos*(int64_t)xInc)>>7) - ((srcPos*0x10000LL)>>7);
for (i = 0; i < dstW; i++) {
int xx = (xDstInSrc - ((filterSize - 2) << 16)) / (1 << 17);
int j;
(*filterPos)[i] = xx;
for (j = 0; j < filterSize; j++) {
int64_t d = (FFABS(((int64_t)xx << 17) - xDstInSrc)) << 13;
double floatd;
int64_t coeff;
if (xInc > 1 << 16)
d = d * dstW / srcW;
floatd = d * (1.0 / (1 << 30));
if (flags & SWS_BICUBIC) {
int64_t B = (param[0] != SWS_PARAM_DEFAULT ? param[0] : 0) * (1 << 24);
int64_t C = (param[1] != SWS_PARAM_DEFAULT ? param[1] : 0.6) * (1 << 24);
if (d >= 1LL << 31) {
coeff = 0.0;
} else {
int64_t dd = (d * d) >> 30;
int64_t ddd = (dd * d) >> 30;
if (d < 1LL << 30)
coeff = (12 * (1 << 24) - 9 * B - 6 * C) * ddd +
(-18 * (1 << 24) + 12 * B + 6 * C) * dd +
(6 * (1 << 24) - 2 * B) * (1 << 30);
else
coeff = (-B - 6 * C) * ddd +
(6 * B + 30 * C) * dd +
(-12 * B - 48 * C) * d +
(8 * B + 24 * C) * (1 << 30);
coeff /= (1LL<<54)/fone;
#if 0
else if (flags & SWS_X) {
double p = param ? param * 0.01 : 0.3;
coeff = d ? sin(d * M_PI) / (d * M_PI) : 1.0;
coeff *= pow(2.0, -p * d * d);
#endif
else if (flags & SWS_X) {
double A = param[0] != SWS_PARAM_DEFAULT ? param[0] : 1.0;
double c;
if (floatd < 1.0)
c = cos(floatd * M_PI);
else
c = -1.0;
if (c < 0.0)
c = -pow(-c, A);
else
c = pow(c, A);
coeff = (c * 0.5 + 0.5) * fone;
} else if (flags & SWS_AREA) {
int64_t d2 = d - (1 << 29);
if (d2 * xInc < -(1LL << (29 + 16)))
coeff = 1.0 * (1LL << (30 + 16));
else if (d2 * xInc < (1LL << (29 + 16)))
coeff = -d2 * xInc + (1LL << (29 + 16));
else
coeff = 0.0;
coeff *= fone >> (30 + 16);
} else if (flags & SWS_GAUSS) {
double p = param[0] != SWS_PARAM_DEFAULT ? param[0] : 3.0;
coeff = (pow(2.0, -p * floatd * floatd)) * fone;
} else if (flags & SWS_SINC) {
coeff = (d ? sin(floatd * M_PI) / (floatd * M_PI) : 1.0) * fone;
} else if (flags & SWS_LANCZOS) {
double p = param[0] != SWS_PARAM_DEFAULT ? param[0] : 3.0;
coeff = (d ? sin(floatd * M_PI) * sin(floatd * M_PI / p) /
(floatd * floatd * M_PI * M_PI / p) : 1.0) * fone;
if (floatd > p)
coeff = 0;
} else if (flags & SWS_BILINEAR) {
coeff = (1 << 30) - d;
if (coeff < 0)
coeff = 0;
coeff *= fone >> 30;
} else if (flags & SWS_SPLINE) {
double p = -2.196152422706632;
coeff = getSplineCoeff(1.0, 0.0, p, -p - 1.0, floatd) * fone;
} else {
av_assert0(0);
filter[i * filterSize + j] = coeff;
xx++;
xDstInSrc += 2 * xInc;
/* apply src & dst Filter to filter -> filter2
* av_free(filter);
*/
av_assert0(filterSize > 0);
filter2Size = filterSize;
if (srcFilter)
filter2Size += srcFilter->length - 1;
if (dstFilter)
filter2Size += dstFilter->length - 1;
av_assert0(filter2Size > 0);
FF_ALLOCZ_OR_GOTO(NULL, filter2, filter2Size * dstW * sizeof(*filter2), fail);
for (i = 0; i < dstW; i++) {
int j, k;
if (srcFilter) {
for (k = 0; k < srcFilter->length; k++) {
for (j = 0; j < filterSize; j++)
filter2[i * filter2Size + k + j] +=
srcFilter->coeff[k] * filter[i * filterSize + j];
} else {
for (j = 0; j < filterSize; j++)
filter2[i * filter2Size + j] = filter[i * filterSize + j];
// FIXME dstFilter
(*filterPos)[i] += (filterSize - 1) / 2 - (filter2Size - 1) / 2;
av_freep(&filter);
/* try to reduce the filter-size (step1 find size and shift left) */
// Assume it is near normalized (*0.5 or *2.0 is OK but * 0.001 is not).
minFilterSize = 0;
for (i = dstW - 1; i >= 0; i--) {
int min = filter2Size;
int j;
int64_t cutOff = 0.0;
/* get rid of near zero elements on the left by shifting left */
for (j = 0; j < filter2Size; j++) {
int k;
cutOff += FFABS(filter2[i * filter2Size]);
if (cutOff > SWS_MAX_REDUCE_CUTOFF * fone)
break;
/* preserve monotonicity because the core can't handle the
* filter otherwise */
if (i < dstW - 1 && (*filterPos)[i] >= (*filterPos)[i + 1])
break;
// move filter coefficients left
for (k = 1; k < filter2Size; k++)
filter2[i * filter2Size + k - 1] = filter2[i * filter2Size + k];
filter2[i * filter2Size + k - 1] = 0;
(*filterPos)[i]++;
cutOff = 0;
/* count near zeros on the right */
for (j = filter2Size - 1; j > 0; j--) {
cutOff += FFABS(filter2[i * filter2Size + j]);
if (cutOff > SWS_MAX_REDUCE_CUTOFF * fone)
break;
min--;
if (min > minFilterSize)
minFilterSize = min;
if (PPC_ALTIVEC(cpu_flags)) {
// we can handle the special case 4, so we don't want to go the full 8
if (minFilterSize < 5)
filterAlign = 4;
/* We really don't want to waste our time doing useless computation, so
* fall back on the scalar C code for very small filters.
* Vectorizing is worth it only if you have a decent-sized vector. */
if (minFilterSize < 3)
filterAlign = 1;
if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) {
// special case for unscaled vertical filtering
if (minFilterSize == 1 && filterAlign == 2)
filterAlign = 1;
av_assert0(minFilterSize > 0);
filterSize = (minFilterSize + (filterAlign - 1)) & (~(filterAlign - 1));
av_assert0(filterSize > 0);
filter = av_malloc(filterSize * dstW * sizeof(*filter));
if (filterSize >= MAX_FILTER_SIZE * 16 /
((flags & SWS_ACCURATE_RND) ? APCK_SIZE : 16) || !filter) {
av_log(NULL, AV_LOG_ERROR, "sws: filterSize %d is too large, try less extreem scaling or increase MAX_FILTER_SIZE and recompile\n", filterSize);
goto fail;
*outFilterSize = filterSize;
if (flags & SWS_PRINT_INFO)
av_log(NULL, AV_LOG_VERBOSE,
"SwScaler: reducing / aligning filtersize %d -> %d\n",
filter2Size, filterSize);
/* try to reduce the filter-size (step2 reduce it) */
for (i = 0; i < dstW; i++) {
int j;
for (j = 0; j < filterSize; j++) {
if (j >= filter2Size)
filter[i * filterSize + j] = 0;
else
filter[i * filterSize + j] = filter2[i * filter2Size + j];
if ((flags & SWS_BITEXACT) && j >= minFilterSize)
filter[i * filterSize + j] = 0;
// FIXME try to align filterPos if possible
// fix borders
for (i = 0; i < dstW; i++) {
int j;
if ((*filterPos)[i] < 0) {
// move filter coefficients left to compensate for filterPos
for (j = 1; j < filterSize; j++) {
int left = FFMAX(j + (*filterPos)[i], 0);
filter[i * filterSize + left] += filter[i * filterSize + j];
filter[i * filterSize + j] = 0;
(*filterPos)[i]= 0;
if ((*filterPos)[i] + filterSize > srcW) {
int shift = (*filterPos)[i] + filterSize - srcW;
// move filter coefficients right to compensate for filterPos
for (j = filterSize - 2; j >= 0; j--) {
int right = FFMIN(j + shift, filterSize - 1);
filter[i * filterSize + right] += filter[i * filterSize + j];
filter[i * filterSize + j] = 0;
(*filterPos)[i]= srcW - filterSize;
// Note the +1 is for the MMX scaler which reads over the end
/* align at 16 for AltiVec (needed by hScale_altivec_real) */
FF_ALLOCZ_OR_GOTO(NULL, *outFilter,
*outFilterSize * (dstW + 3) * sizeof(int16_t), fail);
/* normalize & store in outFilter */
for (i = 0; i < dstW; i++) {
int j;
int64_t error = 0;
int64_t sum = 0;
for (j = 0; j < filterSize; j++) {
sum += filter[i * filterSize + j];
sum = (sum + one / 2) / one;
for (j = 0; j < *outFilterSize; j++) {
int64_t v = filter[i * filterSize + j] + error;
int intV = ROUNDED_DIV(v, sum);
(*outFilter)[i * (*outFilterSize) + j] = intV;
error = v - intV * sum;
(*filterPos)[dstW + 0] =
(*filterPos)[dstW + 1] =
(*filterPos)[dstW + 2] = (*filterPos)[dstW - 1]; /* the MMX/SSE scaler will
* read over the end */
for (i = 0; i < *outFilterSize; i++) {
int k = (dstW - 1) * (*outFilterSize) + i;
(*outFilter)[k + 1 * (*outFilterSize)] =
(*outFilter)[k + 2 * (*outFilterSize)] =
(*outFilter)[k + 3 * (*outFilterSize)] = (*outFilter)[k];
ret = 0;
fail:
if(ret < 0)
av_log(NULL, AV_LOG_ERROR, "sws: initFilter failed\n");
av_free(filter);
av_free(filter2);
return ret;
| true |
FFmpeg
|
2e2a2d8801b045b3dd58a4e49e8e040b559bc84a
|
static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
int *outFilterSize, int xInc, int srcW,
int dstW, int filterAlign, int one,
int flags, int cpu_flags,
SwsVector *srcFilter, SwsVector *dstFilter,
double param[2], int srcPos, int dstPos)
{
int i;
int filterSize;
int filter2Size;
int minFilterSize;
int64_t *filter = NULL;
int64_t *filter2 = NULL;
const int64_t fone = 1LL << (54 - FFMIN(av_log2(srcW/dstW), 8));
int ret = -1;
emms_c();
FF_ALLOC_OR_GOTO(NULL, *filterPos, (dstW + 3) * sizeof(**filterPos), fail);
if (FFABS(xInc - 0x10000) < 10 && srcPos == dstPos) {
int i;
filterSize = 1;
FF_ALLOCZ_OR_GOTO(NULL, filter,
dstW * sizeof(*filter) * filterSize, fail);
for (i = 0; i < dstW; i++) {
filter[i * filterSize] = fone;
(*filterPos)[i] = i;
} else if (flags & SWS_POINT) {
int i;
int64_t xDstInSrc;
filterSize = 1;
FF_ALLOC_OR_GOTO(NULL, filter,
dstW * sizeof(*filter) * filterSize, fail);
xDstInSrc = ((dstPos*(int64_t)xInc)>>8) - ((srcPos*0x8000LL)>>7);
for (i = 0; i < dstW; i++) {
int xx = (xDstInSrc - ((filterSize - 1) << 15) + (1 << 15)) >> 16;
(*filterPos)[i] = xx;
filter[i] = fone;
xDstInSrc += xInc;
} else if ((xInc <= (1 << 16) && (flags & SWS_AREA)) ||
(flags & SWS_FAST_BILINEAR)) {
int i;
int64_t xDstInSrc;
filterSize = 2;
FF_ALLOC_OR_GOTO(NULL, filter,
dstW * sizeof(*filter) * filterSize, fail);
xDstInSrc = ((dstPos*(int64_t)xInc)>>8) - ((srcPos*0x8000LL)>>7);
for (i = 0; i < dstW; i++) {
int xx = (xDstInSrc - ((filterSize - 1) << 15) + (1 << 15)) >> 16;
int j;
(*filterPos)[i] = xx;
/ linear interpolate / area averaging
for (j = 0; j < filterSize; j++) {
int64_t coeff= fone - FFABS(((int64_t)xx<<16) - xDstInSrc)*(fone>>16);
if (coeff < 0)
coeff = 0;
filter[i * filterSize + j] = coeff;
xx++;
xDstInSrc += xInc;
} else {
int64_t xDstInSrc;
int sizeFactor;
if (flags & SWS_BICUBIC)
sizeFactor = 4;
else if (flags & SWS_X)
sizeFactor = 8;
else if (flags & SWS_AREA)
sizeFactor = 1;
else if (flags & SWS_GAUSS)
sizeFactor = 8;
else if (flags & SWS_LANCZOS)
sizeFactor = param[0] != SWS_PARAM_DEFAULT ? ceil(2 * param[0]) : 6;
else if (flags & SWS_SINC)
sizeFactor = 20;
else if (flags & SWS_SPLINE)
sizeFactor = 20;
else if (flags & SWS_BILINEAR)
sizeFactor = 2;
else {
av_assert0(0);
if (xInc <= 1 << 16)
filterSize = 1 + sizeFactor;
else
filterSize = 1 + (sizeFactor * srcW + dstW - 1) / dstW;
filterSize = FFMIN(filterSize, srcW - 2);
filterSize = FFMAX(filterSize, 1);
FF_ALLOC_OR_GOTO(NULL, filter,
dstW * sizeof(*filter) * filterSize, fail);
xDstInSrc = ((dstPos*(int64_t)xInc)>>7) - ((srcPos*0x10000LL)>>7);
for (i = 0; i < dstW; i++) {
int xx = (xDstInSrc - ((filterSize - 2) << 16)) / (1 << 17);
int j;
(*filterPos)[i] = xx;
for (j = 0; j < filterSize; j++) {
int64_t d = (FFABS(((int64_t)xx << 17) - xDstInSrc)) << 13;
double floatd;
int64_t coeff;
if (xInc > 1 << 16)
d = d * dstW / srcW;
floatd = d * (1.0 / (1 << 30));
if (flags & SWS_BICUBIC) {
int64_t B = (param[0] != SWS_PARAM_DEFAULT ? param[0] : 0) * (1 << 24);
int64_t C = (param[1] != SWS_PARAM_DEFAULT ? param[1] : 0.6) * (1 << 24);
if (d >= 1LL << 31) {
coeff = 0.0;
} else {
int64_t dd = (d * d) >> 30;
int64_t ddd = (dd * d) >> 30;
if (d < 1LL << 30)
coeff = (12 * (1 << 24) - 9 * B - 6 * C) * ddd +
(-18 * (1 << 24) + 12 * B + 6 * C) * dd +
(6 * (1 << 24) - 2 * B) * (1 << 30);
else
coeff = (-B - 6 * C) * ddd +
(6 * B + 30 * C) * dd +
(-12 * B - 48 * C) * d +
(8 * B + 24 * C) * (1 << 30);
coeff /= (1LL<<54)/fone;
#if 0
else if (flags & SWS_X) {
double p = param ? param * 0.01 : 0.3;
coeff = d ? sin(d * M_PI) / (d * M_PI) : 1.0;
coeff *= pow(2.0, -p * d * d);
#endif
else if (flags & SWS_X) {
double A = param[0] != SWS_PARAM_DEFAULT ? param[0] : 1.0;
double c;
if (floatd < 1.0)
c = cos(floatd * M_PI);
else
c = -1.0;
if (c < 0.0)
c = -pow(-c, A);
else
c = pow(c, A);
coeff = (c * 0.5 + 0.5) * fone;
} else if (flags & SWS_AREA) {
int64_t d2 = d - (1 << 29);
if (d2 * xInc < -(1LL << (29 + 16)))
coeff = 1.0 * (1LL << (30 + 16));
else if (d2 * xInc < (1LL << (29 + 16)))
coeff = -d2 * xInc + (1LL << (29 + 16));
else
coeff = 0.0;
coeff *= fone >> (30 + 16);
} else if (flags & SWS_GAUSS) {
double p = param[0] != SWS_PARAM_DEFAULT ? param[0] : 3.0;
coeff = (pow(2.0, -p * floatd * floatd)) * fone;
} else if (flags & SWS_SINC) {
coeff = (d ? sin(floatd * M_PI) / (floatd * M_PI) : 1.0) * fone;
} else if (flags & SWS_LANCZOS) {
double p = param[0] != SWS_PARAM_DEFAULT ? param[0] : 3.0;
coeff = (d ? sin(floatd * M_PI) * sin(floatd * M_PI / p) /
(floatd * floatd * M_PI * M_PI / p) : 1.0) * fone;
if (floatd > p)
coeff = 0;
} else if (flags & SWS_BILINEAR) {
coeff = (1 << 30) - d;
if (coeff < 0)
coeff = 0;
coeff *= fone >> 30;
} else if (flags & SWS_SPLINE) {
double p = -2.196152422706632;
coeff = getSplineCoeff(1.0, 0.0, p, -p - 1.0, floatd) * fone;
} else {
av_assert0(0);
filter[i * filterSize + j] = coeff;
xx++;
xDstInSrc += 2 * xInc;
av_assert0(filterSize > 0);
filter2Size = filterSize;
if (srcFilter)
filter2Size += srcFilter->length - 1;
if (dstFilter)
filter2Size += dstFilter->length - 1;
av_assert0(filter2Size > 0);
FF_ALLOCZ_OR_GOTO(NULL, filter2, filter2Size * dstW * sizeof(*filter2), fail);
for (i = 0; i < dstW; i++) {
int j, k;
if (srcFilter) {
for (k = 0; k < srcFilter->length; k++) {
for (j = 0; j < filterSize; j++)
filter2[i * filter2Size + k + j] +=
srcFilter->coeff[k] * filter[i * filterSize + j];
} else {
for (j = 0; j < filterSize; j++)
filter2[i * filter2Size + j] = filter[i * filterSize + j];
(*filterPos)[i] += (filterSize - 1) / 2 - (filter2Size - 1) / 2;
av_freep(&filter);
minFilterSize = 0;
for (i = dstW - 1; i >= 0; i--) {
int min = filter2Size;
int j;
int64_t cutOff = 0.0;
for (j = 0; j < filter2Size; j++) {
int k;
cutOff += FFABS(filter2[i * filter2Size]);
if (cutOff > SWS_MAX_REDUCE_CUTOFF * fone)
break;
if (i < dstW - 1 && (*filterPos)[i] >= (*filterPos)[i + 1])
break;
for (k = 1; k < filter2Size; k++)
filter2[i * filter2Size + k - 1] = filter2[i * filter2Size + k];
filter2[i * filter2Size + k - 1] = 0;
(*filterPos)[i]++;
cutOff = 0;
for (j = filter2Size - 1; j > 0; j--) {
cutOff += FFABS(filter2[i * filter2Size + j]);
if (cutOff > SWS_MAX_REDUCE_CUTOFF * fone)
break;
min--;
if (min > minFilterSize)
minFilterSize = min;
if (PPC_ALTIVEC(cpu_flags)) {
if (minFilterSize < 5)
filterAlign = 4;
if (minFilterSize < 3)
filterAlign = 1;
if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) {
if (minFilterSize == 1 && filterAlign == 2)
filterAlign = 1;
av_assert0(minFilterSize > 0);
filterSize = (minFilterSize + (filterAlign - 1)) & (~(filterAlign - 1));
av_assert0(filterSize > 0);
filter = av_malloc(filterSize * dstW * sizeof(*filter));
if (filterSize >= MAX_FILTER_SIZE * 16 /
((flags & SWS_ACCURATE_RND) ? APCK_SIZE : 16) || !filter) {
av_log(NULL, AV_LOG_ERROR, "sws: filterSize %d is too large, try less extreem scaling or increase MAX_FILTER_SIZE and recompile\n", filterSize);
goto fail;
*outFilterSize = filterSize;
if (flags & SWS_PRINT_INFO)
av_log(NULL, AV_LOG_VERBOSE,
"SwScaler: reducing / aligning filtersize %d -> %d\n",
filter2Size, filterSize);
for (i = 0; i < dstW; i++) {
int j;
for (j = 0; j < filterSize; j++) {
if (j >= filter2Size)
filter[i * filterSize + j] = 0;
else
filter[i * filterSize + j] = filter2[i * filter2Size + j];
if ((flags & SWS_BITEXACT) && j >= minFilterSize)
filter[i * filterSize + j] = 0;
for (i = 0; i < dstW; i++) {
int j;
if ((*filterPos)[i] < 0) {
to compensate for filterPos
for (j = 1; j < filterSize; j++) {
int left = FFMAX(j + (*filterPos)[i], 0);
filter[i * filterSize + left] += filter[i * filterSize + j];
filter[i * filterSize + j] = 0;
(*filterPos)[i]= 0;
if ((*filterPos)[i] + filterSize > srcW) {
int shift = (*filterPos)[i] + filterSize - srcW;
for (j = filterSize - 2; j >= 0; j--) {
int right = FFMIN(j + shift, filterSize - 1);
filter[i * filterSize + right] += filter[i * filterSize + j];
filter[i * filterSize + j] = 0;
(*filterPos)[i]= srcW - filterSize;
FF_ALLOCZ_OR_GOTO(NULL, *outFilter,
*outFilterSize * (dstW + 3) * sizeof(int16_t), fail);
for (i = 0; i < dstW; i++) {
int j;
int64_t error = 0;
int64_t sum = 0;
for (j = 0; j < filterSize; j++) {
sum += filter[i * filterSize + j];
sum = (sum + one / 2) / one;
for (j = 0; j < *outFilterSize; j++) {
int64_t v = filter[i * filterSize + j] + error;
int intV = ROUNDED_DIV(v, sum);
(*outFilter)[i * (*outFilterSize) + j] = intV;
error = v - intV * sum;
(*filterPos)[dstW + 0] =
(*filterPos)[dstW + 1] =
(*filterPos)[dstW + 2] = (*filterPos)[dstW - 1];
for (i = 0; i < *outFilterSize; i++) {
int k = (dstW - 1) * (*outFilterSize) + i;
(*outFilter)[k + 1 * (*outFilterSize)] =
(*outFilter)[k + 2 * (*outFilterSize)] =
(*outFilter)[k + 3 * (*outFilterSize)] = (*outFilter)[k];
ret = 0;
fail:
if(ret < 0)
av_log(NULL, AV_LOG_ERROR, "sws: initFilter failed\n");
av_free(filter);
av_free(filter2);
return ret;
|
{
"code": [],
"line_no": []
}
|
static av_cold int FUNC_0(int16_t **outFilter, int32_t **filterPos,
int *outFilterSize, int xInc, int srcW,
int dstW, int filterAlign, int one,
int flags, int cpu_flags,
SwsVector *srcFilter, SwsVector *dstFilter,
double param[2], int srcPos, int dstPos)
{
int VAR_6;
int VAR_1;
int VAR_2;
int VAR_3;
int64_t *filter = NULL;
int64_t *filter2 = NULL;
const int64_t VAR_4 = 1LL << (54 - FFMIN(av_log2(srcW/dstW), 8));
int VAR_5 = -1;
emms_c();
FF_ALLOC_OR_GOTO(NULL, *filterPos, (dstW + 3) * sizeof(**filterPos), fail);
if (FFABS(xInc - 0x10000) < 10 && srcPos == dstPos) {
int VAR_6;
VAR_1 = 1;
FF_ALLOCZ_OR_GOTO(NULL, filter,
dstW * sizeof(*filter) * VAR_1, fail);
for (VAR_6 = 0; VAR_6 < dstW; VAR_6++) {
filter[VAR_6 * VAR_1] = VAR_4;
(*filterPos)[VAR_6] = VAR_6;
} else if (flags & SWS_POINT) {
int VAR_6;
int64_t xDstInSrc;
VAR_1 = 1;
FF_ALLOC_OR_GOTO(NULL, filter,
dstW * sizeof(*filter) * VAR_1, fail);
xDstInSrc = ((dstPos*(int64_t)xInc)>>8) - ((srcPos*0x8000LL)>>7);
for (VAR_6 = 0; VAR_6 < dstW; VAR_6++) {
int xx = (xDstInSrc - ((VAR_1 - 1) << 15) + (1 << 15)) >> 16;
(*filterPos)[VAR_6] = xx;
filter[VAR_6] = VAR_4;
xDstInSrc += xInc;
} else if ((xInc <= (1 << 16) && (flags & SWS_AREA)) ||
(flags & SWS_FAST_BILINEAR)) {
int VAR_6;
int64_t xDstInSrc;
VAR_1 = 2;
FF_ALLOC_OR_GOTO(NULL, filter,
dstW * sizeof(*filter) * VAR_1, fail);
xDstInSrc = ((dstPos*(int64_t)xInc)>>8) - ((srcPos*0x8000LL)>>7);
for (VAR_6 = 0; VAR_6 < dstW; VAR_6++) {
int xx = (xDstInSrc - ((VAR_1 - 1) << 15) + (1 << 15)) >> 16;
int j;
(*filterPos)[VAR_6] = xx;
/ linear interpolate / area averaging
for (j = 0; j < VAR_1; j++) {
int64_t coeff= VAR_4 - FFABS(((int64_t)xx<<16) - xDstInSrc)*(VAR_4>>16);
if (coeff < 0)
coeff = 0;
filter[VAR_6 * VAR_1 + j] = coeff;
xx++;
xDstInSrc += xInc;
} else {
int64_t xDstInSrc;
int sizeFactor;
if (flags & SWS_BICUBIC)
sizeFactor = 4;
else if (flags & SWS_X)
sizeFactor = 8;
else if (flags & SWS_AREA)
sizeFactor = 1;
else if (flags & SWS_GAUSS)
sizeFactor = 8;
else if (flags & SWS_LANCZOS)
sizeFactor = param[0] != SWS_PARAM_DEFAULT ? ceil(2 * param[0]) : 6;
else if (flags & SWS_SINC)
sizeFactor = 20;
else if (flags & SWS_SPLINE)
sizeFactor = 20;
else if (flags & SWS_BILINEAR)
sizeFactor = 2;
else {
av_assert0(0);
if (xInc <= 1 << 16)
VAR_1 = 1 + sizeFactor;
else
VAR_1 = 1 + (sizeFactor * srcW + dstW - 1) / dstW;
VAR_1 = FFMIN(VAR_1, srcW - 2);
VAR_1 = FFMAX(VAR_1, 1);
FF_ALLOC_OR_GOTO(NULL, filter,
dstW * sizeof(*filter) * VAR_1, fail);
xDstInSrc = ((dstPos*(int64_t)xInc)>>7) - ((srcPos*0x10000LL)>>7);
for (VAR_6 = 0; VAR_6 < dstW; VAR_6++) {
int xx = (xDstInSrc - ((VAR_1 - 2) << 16)) / (1 << 17);
int j;
(*filterPos)[VAR_6] = xx;
for (j = 0; j < VAR_1; j++) {
int64_t d = (FFABS(((int64_t)xx << 17) - xDstInSrc)) << 13;
double floatd;
int64_t coeff;
if (xInc > 1 << 16)
d = d * dstW / srcW;
floatd = d * (1.0 / (1 << 30));
if (flags & SWS_BICUBIC) {
int64_t B = (param[0] != SWS_PARAM_DEFAULT ? param[0] : 0) * (1 << 24);
int64_t C = (param[1] != SWS_PARAM_DEFAULT ? param[1] : 0.6) * (1 << 24);
if (d >= 1LL << 31) {
coeff = 0.0;
} else {
int64_t dd = (d * d) >> 30;
int64_t ddd = (dd * d) >> 30;
if (d < 1LL << 30)
coeff = (12 * (1 << 24) - 9 * B - 6 * C) * ddd +
(-18 * (1 << 24) + 12 * B + 6 * C) * dd +
(6 * (1 << 24) - 2 * B) * (1 << 30);
else
coeff = (-B - 6 * C) * ddd +
(6 * B + 30 * C) * dd +
(-12 * B - 48 * C) * d +
(8 * B + 24 * C) * (1 << 30);
coeff /= (1LL<<54)/VAR_4;
#if 0
else if (flags & SWS_X) {
double p = param ? param * 0.01 : 0.3;
coeff = d ? sin(d * M_PI) / (d * M_PI) : 1.0;
coeff *= pow(2.0, -p * d * d);
#endif
else if (flags & SWS_X) {
double A = param[0] != SWS_PARAM_DEFAULT ? param[0] : 1.0;
double c;
if (floatd < 1.0)
c = cos(floatd * M_PI);
else
c = -1.0;
if (c < 0.0)
c = -pow(-c, A);
else
c = pow(c, A);
coeff = (c * 0.5 + 0.5) * VAR_4;
} else if (flags & SWS_AREA) {
int64_t d2 = d - (1 << 29);
if (d2 * xInc < -(1LL << (29 + 16)))
coeff = 1.0 * (1LL << (30 + 16));
else if (d2 * xInc < (1LL << (29 + 16)))
coeff = -d2 * xInc + (1LL << (29 + 16));
else
coeff = 0.0;
coeff *= VAR_4 >> (30 + 16);
} else if (flags & SWS_GAUSS) {
double p = param[0] != SWS_PARAM_DEFAULT ? param[0] : 3.0;
coeff = (pow(2.0, -p * floatd * floatd)) * VAR_4;
} else if (flags & SWS_SINC) {
coeff = (d ? sin(floatd * M_PI) / (floatd * M_PI) : 1.0) * VAR_4;
} else if (flags & SWS_LANCZOS) {
double p = param[0] != SWS_PARAM_DEFAULT ? param[0] : 3.0;
coeff = (d ? sin(floatd * M_PI) * sin(floatd * M_PI / p) /
(floatd * floatd * M_PI * M_PI / p) : 1.0) * VAR_4;
if (floatd > p)
coeff = 0;
} else if (flags & SWS_BILINEAR) {
coeff = (1 << 30) - d;
if (coeff < 0)
coeff = 0;
coeff *= VAR_4 >> 30;
} else if (flags & SWS_SPLINE) {
double p = -2.196152422706632;
coeff = getSplineCoeff(1.0, 0.0, p, -p - 1.0, floatd) * VAR_4;
} else {
av_assert0(0);
filter[VAR_6 * VAR_1 + j] = coeff;
xx++;
xDstInSrc += 2 * xInc;
av_assert0(VAR_1 > 0);
VAR_2 = VAR_1;
if (srcFilter)
VAR_2 += srcFilter->length - 1;
if (dstFilter)
VAR_2 += dstFilter->length - 1;
av_assert0(VAR_2 > 0);
FF_ALLOCZ_OR_GOTO(NULL, filter2, VAR_2 * dstW * sizeof(*filter2), fail);
for (VAR_6 = 0; VAR_6 < dstW; VAR_6++) {
int j, k;
if (srcFilter) {
for (k = 0; k < srcFilter->length; k++) {
for (j = 0; j < VAR_1; j++)
filter2[VAR_6 * VAR_2 + k + j] +=
srcFilter->coeff[k] * filter[VAR_6 * VAR_1 + j];
} else {
for (j = 0; j < VAR_1; j++)
filter2[VAR_6 * VAR_2 + j] = filter[VAR_6 * VAR_1 + j];
(*filterPos)[VAR_6] += (VAR_1 - 1) / 2 - (VAR_2 - 1) / 2;
av_freep(&filter);
VAR_3 = 0;
for (VAR_6 = dstW - 1; VAR_6 >= 0; VAR_6--) {
int min = VAR_2;
int j;
int64_t cutOff = 0.0;
for (j = 0; j < VAR_2; j++) {
int k;
cutOff += FFABS(filter2[VAR_6 * VAR_2]);
if (cutOff > SWS_MAX_REDUCE_CUTOFF * VAR_4)
break;
if (VAR_6 < dstW - 1 && (*filterPos)[VAR_6] >= (*filterPos)[VAR_6 + 1])
break;
for (k = 1; k < VAR_2; k++)
filter2[VAR_6 * VAR_2 + k - 1] = filter2[VAR_6 * VAR_2 + k];
filter2[VAR_6 * VAR_2 + k - 1] = 0;
(*filterPos)[VAR_6]++;
cutOff = 0;
for (j = VAR_2 - 1; j > 0; j--) {
cutOff += FFABS(filter2[VAR_6 * VAR_2 + j]);
if (cutOff > SWS_MAX_REDUCE_CUTOFF * VAR_4)
break;
min--;
if (min > VAR_3)
VAR_3 = min;
if (PPC_ALTIVEC(cpu_flags)) {
if (VAR_3 < 5)
filterAlign = 4;
if (VAR_3 < 3)
filterAlign = 1;
if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) {
if (VAR_3 == 1 && filterAlign == 2)
filterAlign = 1;
av_assert0(VAR_3 > 0);
VAR_1 = (VAR_3 + (filterAlign - 1)) & (~(filterAlign - 1));
av_assert0(VAR_1 > 0);
filter = av_malloc(VAR_1 * dstW * sizeof(*filter));
if (VAR_1 >= MAX_FILTER_SIZE * 16 /
((flags & SWS_ACCURATE_RND) ? APCK_SIZE : 16) || !filter) {
av_log(NULL, AV_LOG_ERROR, "sws: VAR_1 %d is too large, try less extreem scaling or increase MAX_FILTER_SIZE and recompile\n", VAR_1);
goto fail;
*outFilterSize = VAR_1;
if (flags & SWS_PRINT_INFO)
av_log(NULL, AV_LOG_VERBOSE,
"SwScaler: reducing / aligning filtersize %d -> %d\n",
VAR_2, VAR_1);
for (VAR_6 = 0; VAR_6 < dstW; VAR_6++) {
int j;
for (j = 0; j < VAR_1; j++) {
if (j >= VAR_2)
filter[VAR_6 * VAR_1 + j] = 0;
else
filter[VAR_6 * VAR_1 + j] = filter2[VAR_6 * VAR_2 + j];
if ((flags & SWS_BITEXACT) && j >= VAR_3)
filter[VAR_6 * VAR_1 + j] = 0;
for (VAR_6 = 0; VAR_6 < dstW; VAR_6++) {
int j;
if ((*filterPos)[VAR_6] < 0) {
to compensate for filterPos
for (j = 1; j < VAR_1; j++) {
int left = FFMAX(j + (*filterPos)[VAR_6], 0);
filter[VAR_6 * VAR_1 + left] += filter[VAR_6 * VAR_1 + j];
filter[VAR_6 * VAR_1 + j] = 0;
(*filterPos)[VAR_6]= 0;
if ((*filterPos)[VAR_6] + VAR_1 > srcW) {
int shift = (*filterPos)[VAR_6] + VAR_1 - srcW;
for (j = VAR_1 - 2; j >= 0; j--) {
int right = FFMIN(j + shift, VAR_1 - 1);
filter[VAR_6 * VAR_1 + right] += filter[VAR_6 * VAR_1 + j];
filter[VAR_6 * VAR_1 + j] = 0;
(*filterPos)[VAR_6]= srcW - VAR_1;
FF_ALLOCZ_OR_GOTO(NULL, *outFilter,
*outFilterSize * (dstW + 3) * sizeof(int16_t), fail);
for (VAR_6 = 0; VAR_6 < dstW; VAR_6++) {
int j;
int64_t error = 0;
int64_t sum = 0;
for (j = 0; j < VAR_1; j++) {
sum += filter[VAR_6 * VAR_1 + j];
sum = (sum + one / 2) / one;
for (j = 0; j < *outFilterSize; j++) {
int64_t v = filter[VAR_6 * VAR_1 + j] + error;
int intV = ROUNDED_DIV(v, sum);
(*outFilter)[VAR_6 * (*outFilterSize) + j] = intV;
error = v - intV * sum;
(*filterPos)[dstW + 0] =
(*filterPos)[dstW + 1] =
(*filterPos)[dstW + 2] = (*filterPos)[dstW - 1];
for (VAR_6 = 0; VAR_6 < *outFilterSize; VAR_6++) {
int k = (dstW - 1) * (*outFilterSize) + VAR_6;
(*outFilter)[k + 1 * (*outFilterSize)] =
(*outFilter)[k + 2 * (*outFilterSize)] =
(*outFilter)[k + 3 * (*outFilterSize)] = (*outFilter)[k];
VAR_5 = 0;
fail:
if(VAR_5 < 0)
av_log(NULL, AV_LOG_ERROR, "sws: FUNC_0 failed\n");
av_free(filter);
av_free(filter2);
return VAR_5;
|
[
"static av_cold int FUNC_0(int16_t **outFilter, int32_t **filterPos,\nint *outFilterSize, int xInc, int srcW,\nint dstW, int filterAlign, int one,\nint flags, int cpu_flags,\nSwsVector *srcFilter, SwsVector *dstFilter,\ndouble param[2], int srcPos, int dstPos)\n{",
"int VAR_6;",
"int VAR_1;",
"int VAR_2;",
"int VAR_3;",
"int64_t *filter = NULL;",
"int64_t *filter2 = NULL;",
"const int64_t VAR_4 = 1LL << (54 - FFMIN(av_log2(srcW/dstW), 8));",
"int VAR_5 = -1;",
"emms_c();",
"FF_ALLOC_OR_GOTO(NULL, *filterPos, (dstW + 3) * sizeof(**filterPos), fail);",
"if (FFABS(xInc - 0x10000) < 10 && srcPos == dstPos) {",
"int VAR_6;",
"VAR_1 = 1;",
"FF_ALLOCZ_OR_GOTO(NULL, filter,\ndstW * sizeof(*filter) * VAR_1, fail);",
"for (VAR_6 = 0; VAR_6 < dstW; VAR_6++) {",
"filter[VAR_6 * VAR_1] = VAR_4;",
"(*filterPos)[VAR_6] = VAR_6;",
"} else if (flags & SWS_POINT) {",
"int VAR_6;",
"int64_t xDstInSrc;",
"VAR_1 = 1;",
"FF_ALLOC_OR_GOTO(NULL, filter,\ndstW * sizeof(*filter) * VAR_1, fail);",
"xDstInSrc = ((dstPos*(int64_t)xInc)>>8) - ((srcPos*0x8000LL)>>7);",
"for (VAR_6 = 0; VAR_6 < dstW; VAR_6++) {",
"int xx = (xDstInSrc - ((VAR_1 - 1) << 15) + (1 << 15)) >> 16;",
"(*filterPos)[VAR_6] = xx;",
"filter[VAR_6] = VAR_4;",
"xDstInSrc += xInc;",
"} else if ((xInc <= (1 << 16) && (flags & SWS_AREA)) ||",
"(flags & SWS_FAST_BILINEAR)) {",
"int VAR_6;",
"int64_t xDstInSrc;",
"VAR_1 = 2;",
"FF_ALLOC_OR_GOTO(NULL, filter,\ndstW * sizeof(*filter) * VAR_1, fail);",
"xDstInSrc = ((dstPos*(int64_t)xInc)>>8) - ((srcPos*0x8000LL)>>7);",
"for (VAR_6 = 0; VAR_6 < dstW; VAR_6++) {",
"int xx = (xDstInSrc - ((VAR_1 - 1) << 15) + (1 << 15)) >> 16;",
"int j;",
"(*filterPos)[VAR_6] = xx;",
"/ linear interpolate / area averaging\nfor (j = 0; j < VAR_1; j++) {",
"int64_t coeff= VAR_4 - FFABS(((int64_t)xx<<16) - xDstInSrc)*(VAR_4>>16);",
"if (coeff < 0)\ncoeff = 0;",
"filter[VAR_6 * VAR_1 + j] = coeff;",
"xx++;",
"xDstInSrc += xInc;",
"} else {",
"int64_t xDstInSrc;",
"int sizeFactor;",
"if (flags & SWS_BICUBIC)\nsizeFactor = 4;",
"else if (flags & SWS_X)\nsizeFactor = 8;",
"else if (flags & SWS_AREA)\nsizeFactor = 1;",
"else if (flags & SWS_GAUSS)\nsizeFactor = 8;",
"else if (flags & SWS_LANCZOS)\nsizeFactor = param[0] != SWS_PARAM_DEFAULT ? ceil(2 * param[0]) : 6;",
"else if (flags & SWS_SINC)\nsizeFactor = 20;",
"else if (flags & SWS_SPLINE)\nsizeFactor = 20;",
"else if (flags & SWS_BILINEAR)\nsizeFactor = 2;",
"else {",
"av_assert0(0);",
"if (xInc <= 1 << 16)\nVAR_1 = 1 + sizeFactor;",
"else\nVAR_1 = 1 + (sizeFactor * srcW + dstW - 1) / dstW;",
"VAR_1 = FFMIN(VAR_1, srcW - 2);",
"VAR_1 = FFMAX(VAR_1, 1);",
"FF_ALLOC_OR_GOTO(NULL, filter,\ndstW * sizeof(*filter) * VAR_1, fail);",
"xDstInSrc = ((dstPos*(int64_t)xInc)>>7) - ((srcPos*0x10000LL)>>7);",
"for (VAR_6 = 0; VAR_6 < dstW; VAR_6++) {",
"int xx = (xDstInSrc - ((VAR_1 - 2) << 16)) / (1 << 17);",
"int j;",
"(*filterPos)[VAR_6] = xx;",
"for (j = 0; j < VAR_1; j++) {",
"int64_t d = (FFABS(((int64_t)xx << 17) - xDstInSrc)) << 13;",
"double floatd;",
"int64_t coeff;",
"if (xInc > 1 << 16)\nd = d * dstW / srcW;",
"floatd = d * (1.0 / (1 << 30));",
"if (flags & SWS_BICUBIC) {",
"int64_t B = (param[0] != SWS_PARAM_DEFAULT ? param[0] : 0) * (1 << 24);",
"int64_t C = (param[1] != SWS_PARAM_DEFAULT ? param[1] : 0.6) * (1 << 24);",
"if (d >= 1LL << 31) {",
"coeff = 0.0;",
"} else {",
"int64_t dd = (d * d) >> 30;",
"int64_t ddd = (dd * d) >> 30;",
"if (d < 1LL << 30)\ncoeff = (12 * (1 << 24) - 9 * B - 6 * C) * ddd +\n(-18 * (1 << 24) + 12 * B + 6 * C) * dd +\n(6 * (1 << 24) - 2 * B) * (1 << 30);",
"else\ncoeff = (-B - 6 * C) * ddd +\n(6 * B + 30 * C) * dd +\n(-12 * B - 48 * C) * d +\n(8 * B + 24 * C) * (1 << 30);",
"coeff /= (1LL<<54)/VAR_4;",
"#if 0\nelse if (flags & SWS_X) {",
"double p = param ? param * 0.01 : 0.3;",
"coeff = d ? sin(d * M_PI) / (d * M_PI) : 1.0;",
"coeff *= pow(2.0, -p * d * d);",
"#endif\nelse if (flags & SWS_X) {",
"double A = param[0] != SWS_PARAM_DEFAULT ? param[0] : 1.0;",
"double c;",
"if (floatd < 1.0)\nc = cos(floatd * M_PI);",
"else\nc = -1.0;",
"if (c < 0.0)\nc = -pow(-c, A);",
"else\nc = pow(c, A);",
"coeff = (c * 0.5 + 0.5) * VAR_4;",
"} else if (flags & SWS_AREA) {",
"int64_t d2 = d - (1 << 29);",
"if (d2 * xInc < -(1LL << (29 + 16)))\ncoeff = 1.0 * (1LL << (30 + 16));",
"else if (d2 * xInc < (1LL << (29 + 16)))\ncoeff = -d2 * xInc + (1LL << (29 + 16));",
"else\ncoeff = 0.0;",
"coeff *= VAR_4 >> (30 + 16);",
"} else if (flags & SWS_GAUSS) {",
"double p = param[0] != SWS_PARAM_DEFAULT ? param[0] : 3.0;",
"coeff = (pow(2.0, -p * floatd * floatd)) * VAR_4;",
"} else if (flags & SWS_SINC) {",
"coeff = (d ? sin(floatd * M_PI) / (floatd * M_PI) : 1.0) * VAR_4;",
"} else if (flags & SWS_LANCZOS) {",
"double p = param[0] != SWS_PARAM_DEFAULT ? param[0] : 3.0;",
"coeff = (d ? sin(floatd * M_PI) * sin(floatd * M_PI / p) /\n(floatd * floatd * M_PI * M_PI / p) : 1.0) * VAR_4;",
"if (floatd > p)\ncoeff = 0;",
"} else if (flags & SWS_BILINEAR) {",
"coeff = (1 << 30) - d;",
"if (coeff < 0)\ncoeff = 0;",
"coeff *= VAR_4 >> 30;",
"} else if (flags & SWS_SPLINE) {",
"double p = -2.196152422706632;",
"coeff = getSplineCoeff(1.0, 0.0, p, -p - 1.0, floatd) * VAR_4;",
"} else {",
"av_assert0(0);",
"filter[VAR_6 * VAR_1 + j] = coeff;",
"xx++;",
"xDstInSrc += 2 * xInc;",
"av_assert0(VAR_1 > 0);",
"VAR_2 = VAR_1;",
"if (srcFilter)\nVAR_2 += srcFilter->length - 1;",
"if (dstFilter)\nVAR_2 += dstFilter->length - 1;",
"av_assert0(VAR_2 > 0);",
"FF_ALLOCZ_OR_GOTO(NULL, filter2, VAR_2 * dstW * sizeof(*filter2), fail);",
"for (VAR_6 = 0; VAR_6 < dstW; VAR_6++) {",
"int j, k;",
"if (srcFilter) {",
"for (k = 0; k < srcFilter->length; k++) {",
"for (j = 0; j < VAR_1; j++)",
"filter2[VAR_6 * VAR_2 + k + j] +=\nsrcFilter->coeff[k] * filter[VAR_6 * VAR_1 + j];",
"} else {",
"for (j = 0; j < VAR_1; j++)",
"filter2[VAR_6 * VAR_2 + j] = filter[VAR_6 * VAR_1 + j];",
"(*filterPos)[VAR_6] += (VAR_1 - 1) / 2 - (VAR_2 - 1) / 2;",
"av_freep(&filter);",
"VAR_3 = 0;",
"for (VAR_6 = dstW - 1; VAR_6 >= 0; VAR_6--) {",
"int min = VAR_2;",
"int j;",
"int64_t cutOff = 0.0;",
"for (j = 0; j < VAR_2; j++) {",
"int k;",
"cutOff += FFABS(filter2[VAR_6 * VAR_2]);",
"if (cutOff > SWS_MAX_REDUCE_CUTOFF * VAR_4)\nbreak;",
"if (VAR_6 < dstW - 1 && (*filterPos)[VAR_6] >= (*filterPos)[VAR_6 + 1])\nbreak;",
"for (k = 1; k < VAR_2; k++)",
"filter2[VAR_6 * VAR_2 + k - 1] = filter2[VAR_6 * VAR_2 + k];",
"filter2[VAR_6 * VAR_2 + k - 1] = 0;",
"(*filterPos)[VAR_6]++;",
"cutOff = 0;",
"for (j = VAR_2 - 1; j > 0; j--) {",
"cutOff += FFABS(filter2[VAR_6 * VAR_2 + j]);",
"if (cutOff > SWS_MAX_REDUCE_CUTOFF * VAR_4)\nbreak;",
"min--;",
"if (min > VAR_3)\nVAR_3 = min;",
"if (PPC_ALTIVEC(cpu_flags)) {",
"if (VAR_3 < 5)\nfilterAlign = 4;",
"if (VAR_3 < 3)\nfilterAlign = 1;",
"if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) {",
"if (VAR_3 == 1 && filterAlign == 2)\nfilterAlign = 1;",
"av_assert0(VAR_3 > 0);",
"VAR_1 = (VAR_3 + (filterAlign - 1)) & (~(filterAlign - 1));",
"av_assert0(VAR_1 > 0);",
"filter = av_malloc(VAR_1 * dstW * sizeof(*filter));",
"if (VAR_1 >= MAX_FILTER_SIZE * 16 /\n((flags & SWS_ACCURATE_RND) ? APCK_SIZE : 16) || !filter) {",
"av_log(NULL, AV_LOG_ERROR, \"sws: VAR_1 %d is too large, try less extreem scaling or increase MAX_FILTER_SIZE and recompile\\n\", VAR_1);",
"goto fail;",
"*outFilterSize = VAR_1;",
"if (flags & SWS_PRINT_INFO)\nav_log(NULL, AV_LOG_VERBOSE,\n\"SwScaler: reducing / aligning filtersize %d -> %d\\n\",\nVAR_2, VAR_1);",
"for (VAR_6 = 0; VAR_6 < dstW; VAR_6++) {",
"int j;",
"for (j = 0; j < VAR_1; j++) {",
"if (j >= VAR_2)\nfilter[VAR_6 * VAR_1 + j] = 0;",
"else\nfilter[VAR_6 * VAR_1 + j] = filter2[VAR_6 * VAR_2 + j];",
"if ((flags & SWS_BITEXACT) && j >= VAR_3)\nfilter[VAR_6 * VAR_1 + j] = 0;",
"for (VAR_6 = 0; VAR_6 < dstW; VAR_6++) {",
"int j;",
"if ((*filterPos)[VAR_6] < 0) {",
"to compensate for filterPos\nfor (j = 1; j < VAR_1; j++) {",
"int left = FFMAX(j + (*filterPos)[VAR_6], 0);",
"filter[VAR_6 * VAR_1 + left] += filter[VAR_6 * VAR_1 + j];",
"filter[VAR_6 * VAR_1 + j] = 0;",
"(*filterPos)[VAR_6]= 0;",
"if ((*filterPos)[VAR_6] + VAR_1 > srcW) {",
"int shift = (*filterPos)[VAR_6] + VAR_1 - srcW;",
"for (j = VAR_1 - 2; j >= 0; j--) {",
"int right = FFMIN(j + shift, VAR_1 - 1);",
"filter[VAR_6 * VAR_1 + right] += filter[VAR_6 * VAR_1 + j];",
"filter[VAR_6 * VAR_1 + j] = 0;",
"(*filterPos)[VAR_6]= srcW - VAR_1;",
"FF_ALLOCZ_OR_GOTO(NULL, *outFilter,\n*outFilterSize * (dstW + 3) * sizeof(int16_t), fail);",
"for (VAR_6 = 0; VAR_6 < dstW; VAR_6++) {",
"int j;",
"int64_t error = 0;",
"int64_t sum = 0;",
"for (j = 0; j < VAR_1; j++) {",
"sum += filter[VAR_6 * VAR_1 + j];",
"sum = (sum + one / 2) / one;",
"for (j = 0; j < *outFilterSize; j++) {",
"int64_t v = filter[VAR_6 * VAR_1 + j] + error;",
"int intV = ROUNDED_DIV(v, sum);",
"(*outFilter)[VAR_6 * (*outFilterSize) + j] = intV;",
"error = v - intV * sum;",
"(*filterPos)[dstW + 0] =\n(*filterPos)[dstW + 1] =\n(*filterPos)[dstW + 2] = (*filterPos)[dstW - 1];",
"for (VAR_6 = 0; VAR_6 < *outFilterSize; VAR_6++) {",
"int k = (dstW - 1) * (*outFilterSize) + VAR_6;",
"(*outFilter)[k + 1 * (*outFilterSize)] =\n(*outFilter)[k + 2 * (*outFilterSize)] =\n(*outFilter)[k + 3 * (*outFilterSize)] = (*outFilter)[k];",
"VAR_5 = 0;",
"fail:\nif(VAR_5 < 0)\nav_log(NULL, AV_LOG_ERROR, \"sws: FUNC_0 failed\\n\");",
"av_free(filter);",
"av_free(filter2);",
"return VAR_5;"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5,
7,
9,
11,
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
39
],
[
43
],
[
45
],
[
47
],
[
49,
51
],
[
55
],
[
57
],
[
59
],
[
62
],
[
64
],
[
66
],
[
68
],
[
70,
72
],
[
76
],
[
78
],
[
80
],
[
84
],
[
86
],
[
88
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101,
103
],
[
107
],
[
109
],
[
111
],
[
113
],
[
117
],
[
119,
121
],
[
123
],
[
125,
127
],
[
129
],
[
131
],
[
134
],
[
137
],
[
139
],
[
141
],
[
145,
147
],
[
149,
151
],
[
153,
155
],
[
157,
159
],
[
161,
163
],
[
165,
167
],
[
169,
171
],
[
173,
175
],
[
177
],
[
179
],
[
184,
186
],
[
188,
190
],
[
194
],
[
196
],
[
200,
202
],
[
206
],
[
208
],
[
210
],
[
212
],
[
214
],
[
216
],
[
218
],
[
220
],
[
222
],
[
226,
228
],
[
230
],
[
234
],
[
236
],
[
238
],
[
242
],
[
244
],
[
246
],
[
248
],
[
250
],
[
254,
256,
258,
260
],
[
262,
264,
266,
268,
270
],
[
273
],
[
276,
278
],
[
280
],
[
282
],
[
284
],
[
287,
289
],
[
291
],
[
293
],
[
297,
299
],
[
301,
303
],
[
305,
307
],
[
309,
311
],
[
313
],
[
315
],
[
317
],
[
319,
321
],
[
323,
325
],
[
327,
329
],
[
331
],
[
333
],
[
335
],
[
337
],
[
339
],
[
341
],
[
343
],
[
345
],
[
347,
349
],
[
351,
353
],
[
355
],
[
357
],
[
359,
361
],
[
363
],
[
365
],
[
367
],
[
369
],
[
371
],
[
373
],
[
378
],
[
380
],
[
383
],
[
395
],
[
397
],
[
399,
401
],
[
403,
405
],
[
407
],
[
409
],
[
413
],
[
415
],
[
419
],
[
421
],
[
423
],
[
425,
427
],
[
430
],
[
432
],
[
434
],
[
441
],
[
444
],
[
452
],
[
454
],
[
456
],
[
458
],
[
460
],
[
466
],
[
468
],
[
470
],
[
474,
476
],
[
484,
486
],
[
492
],
[
494
],
[
496
],
[
498
],
[
503
],
[
507
],
[
509
],
[
513,
515
],
[
517
],
[
522,
524
],
[
529
],
[
533,
535
],
[
545,
547
],
[
552
],
[
556,
558
],
[
563
],
[
565
],
[
567
],
[
569
],
[
571,
573
],
[
575
],
[
577
],
[
580
],
[
584,
586,
588,
590
],
[
594
],
[
596
],
[
600
],
[
602,
604
],
[
606,
608
],
[
610,
612
],
[
624
],
[
626
],
[
628
],
[
630,
632
],
[
634
],
[
636
],
[
638
],
[
641
],
[
646
],
[
648
],
[
652
],
[
654
],
[
656
],
[
658
],
[
661
],
[
671,
673
],
[
679
],
[
681
],
[
683
],
[
685
],
[
689
],
[
691
],
[
694
],
[
700
],
[
702
],
[
704
],
[
706
],
[
708
],
[
714,
716,
718
],
[
722
],
[
724
],
[
726,
728,
730
],
[
735
],
[
739,
741,
743
],
[
745
],
[
747
],
[
749
]
] |
6,379 |
static uint64_t hb_count_between(HBitmap *hb, uint64_t start, uint64_t last)
{
HBitmapIter hbi;
uint64_t count = 0;
uint64_t end = last + 1;
unsigned long cur;
size_t pos;
hbitmap_iter_init(&hbi, hb, start << hb->granularity);
for (;;) {
pos = hbitmap_iter_next_word(&hbi, &cur);
if (pos >= (end >> BITS_PER_LEVEL)) {
break;
}
count += popcountl(cur);
}
if (pos == (end >> BITS_PER_LEVEL)) {
/* Drop bits representing the END-th and subsequent items. */
int bit = end & (BITS_PER_LONG - 1);
cur &= (1UL << bit) - 1;
count += popcountl(cur);
}
return count;
}
| true |
qemu
|
591b320ad046b2780c1b2841b836b50ba8192f02
|
static uint64_t hb_count_between(HBitmap *hb, uint64_t start, uint64_t last)
{
HBitmapIter hbi;
uint64_t count = 0;
uint64_t end = last + 1;
unsigned long cur;
size_t pos;
hbitmap_iter_init(&hbi, hb, start << hb->granularity);
for (;;) {
pos = hbitmap_iter_next_word(&hbi, &cur);
if (pos >= (end >> BITS_PER_LEVEL)) {
break;
}
count += popcountl(cur);
}
if (pos == (end >> BITS_PER_LEVEL)) {
int bit = end & (BITS_PER_LONG - 1);
cur &= (1UL << bit) - 1;
count += popcountl(cur);
}
return count;
}
|
{
"code": [
" count += popcountl(cur);",
" count += popcountl(cur);"
],
"line_no": [
29,
29
]
}
|
static uint64_t FUNC_0(HBitmap *hb, uint64_t start, uint64_t last)
{
HBitmapIter hbi;
uint64_t count = 0;
uint64_t end = last + 1;
unsigned long VAR_0;
size_t pos;
hbitmap_iter_init(&hbi, hb, start << hb->granularity);
for (;;) {
pos = hbitmap_iter_next_word(&hbi, &VAR_0);
if (pos >= (end >> BITS_PER_LEVEL)) {
break;
}
count += popcountl(VAR_0);
}
if (pos == (end >> BITS_PER_LEVEL)) {
int VAR_1 = end & (BITS_PER_LONG - 1);
VAR_0 &= (1UL << VAR_1) - 1;
count += popcountl(VAR_0);
}
return count;
}
|
[
"static uint64_t FUNC_0(HBitmap *hb, uint64_t start, uint64_t last)\n{",
"HBitmapIter hbi;",
"uint64_t count = 0;",
"uint64_t end = last + 1;",
"unsigned long VAR_0;",
"size_t pos;",
"hbitmap_iter_init(&hbi, hb, start << hb->granularity);",
"for (;;) {",
"pos = hbitmap_iter_next_word(&hbi, &VAR_0);",
"if (pos >= (end >> BITS_PER_LEVEL)) {",
"break;",
"}",
"count += popcountl(VAR_0);",
"}",
"if (pos == (end >> BITS_PER_LEVEL)) {",
"int VAR_1 = end & (BITS_PER_LONG - 1);",
"VAR_0 &= (1UL << VAR_1) - 1;",
"count += popcountl(VAR_0);",
"}",
"return count;",
"}"
] |
[
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
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
35
],
[
39
],
[
41
],
[
43
],
[
45
],
[
49
],
[
51
]
] |
6,380 |
static int img_convert(int argc, char **argv)
{
int c, ret = 0, n, n1, bs_n, bs_i, compress, cluster_size, cluster_sectors;
int progress = 0, flags;
const char *fmt, *out_fmt, *cache, *out_baseimg, *out_filename;
BlockDriver *drv, *proto_drv;
BlockDriverState **bs = NULL, *out_bs = NULL;
int64_t total_sectors, nb_sectors, sector_num, bs_offset;
uint64_t bs_sectors;
uint8_t * buf = NULL;
const uint8_t *buf1;
BlockDriverInfo bdi;
QEMUOptionParameter *param = NULL, *create_options = NULL;
QEMUOptionParameter *out_baseimg_param;
char *options = NULL;
const char *snapshot_name = NULL;
float local_progress;
int min_sparse = 8; /* Need at least 4k of zeros for sparse detection */
fmt = NULL;
out_fmt = "raw";
cache = "unsafe";
out_baseimg = NULL;
compress = 0;
for(;;) {
c = getopt(argc, argv, "f:O:B:s:hce6o:pS:t:");
if (c == -1) {
break;
}
switch(c) {
case '?':
case 'h':
help();
break;
case 'f':
fmt = optarg;
break;
case 'O':
out_fmt = optarg;
break;
case 'B':
out_baseimg = optarg;
break;
case 'c':
compress = 1;
break;
case 'e':
error_report("option -e is deprecated, please use \'-o "
"encryption\' instead!");
return 1;
case '6':
error_report("option -6 is deprecated, please use \'-o "
"compat6\' instead!");
return 1;
case 'o':
options = optarg;
break;
case 's':
snapshot_name = optarg;
break;
case 'S':
{
int64_t sval;
char *end;
sval = strtosz_suffix(optarg, &end, STRTOSZ_DEFSUFFIX_B);
if (sval < 0 || *end) {
error_report("Invalid minimum zero buffer size for sparse output specified");
return 1;
}
min_sparse = sval / BDRV_SECTOR_SIZE;
break;
}
case 'p':
progress = 1;
break;
case 't':
cache = optarg;
break;
}
}
bs_n = argc - optind - 1;
if (bs_n < 1) {
help();
}
out_filename = argv[argc - 1];
/* Initialize before goto out */
qemu_progress_init(progress, 2.0);
if (options && !strcmp(options, "?")) {
ret = print_block_option_help(out_filename, out_fmt);
goto out;
}
if (bs_n > 1 && out_baseimg) {
error_report("-B makes no sense when concatenating multiple input "
"images");
ret = -1;
goto out;
}
qemu_progress_print(0, 100);
bs = g_malloc0(bs_n * sizeof(BlockDriverState *));
total_sectors = 0;
for (bs_i = 0; bs_i < bs_n; bs_i++) {
bs[bs_i] = bdrv_new_open(argv[optind + bs_i], fmt, BDRV_O_FLAGS);
if (!bs[bs_i]) {
error_report("Could not open '%s'", argv[optind + bs_i]);
ret = -1;
goto out;
}
bdrv_get_geometry(bs[bs_i], &bs_sectors);
total_sectors += bs_sectors;
}
if (snapshot_name != NULL) {
if (bs_n > 1) {
error_report("No support for concatenating multiple snapshot");
ret = -1;
goto out;
}
if (bdrv_snapshot_load_tmp(bs[0], snapshot_name) < 0) {
error_report("Failed to load snapshot");
ret = -1;
goto out;
}
}
/* Find driver and parse its options */
drv = bdrv_find_format(out_fmt);
if (!drv) {
error_report("Unknown file format '%s'", out_fmt);
ret = -1;
goto out;
}
proto_drv = bdrv_find_protocol(out_filename);
if (!proto_drv) {
error_report("Unknown protocol '%s'", out_filename);
ret = -1;
goto out;
}
create_options = append_option_parameters(create_options,
drv->create_options);
create_options = append_option_parameters(create_options,
proto_drv->create_options);
if (options) {
param = parse_option_parameters(options, create_options, param);
if (param == NULL) {
error_report("Invalid options for file format '%s'.", out_fmt);
ret = -1;
goto out;
}
} else {
param = parse_option_parameters("", create_options, param);
}
set_option_parameter_int(param, BLOCK_OPT_SIZE, total_sectors * 512);
ret = add_old_style_options(out_fmt, param, out_baseimg, NULL);
if (ret < 0) {
goto out;
}
/* Get backing file name if -o backing_file was used */
out_baseimg_param = get_option_parameter(param, BLOCK_OPT_BACKING_FILE);
if (out_baseimg_param) {
out_baseimg = out_baseimg_param->value.s;
}
/* Check if compression is supported */
if (compress) {
QEMUOptionParameter *encryption =
get_option_parameter(param, BLOCK_OPT_ENCRYPT);
QEMUOptionParameter *preallocation =
get_option_parameter(param, BLOCK_OPT_PREALLOC);
if (!drv->bdrv_write_compressed) {
error_report("Compression not supported for this file format");
ret = -1;
goto out;
}
if (encryption && encryption->value.n) {
error_report("Compression and encryption not supported at "
"the same time");
ret = -1;
goto out;
}
if (preallocation && preallocation->value.s
&& strcmp(preallocation->value.s, "off"))
{
error_report("Compression and preallocation not supported at "
"the same time");
ret = -1;
goto out;
}
}
/* Create the new image */
ret = bdrv_create(drv, out_filename, param);
if (ret < 0) {
if (ret == -ENOTSUP) {
error_report("Formatting not supported for file format '%s'",
out_fmt);
} else if (ret == -EFBIG) {
error_report("The image size is too large for file format '%s'",
out_fmt);
} else {
error_report("%s: error while converting %s: %s",
out_filename, out_fmt, strerror(-ret));
}
goto out;
}
flags = BDRV_O_RDWR;
ret = bdrv_parse_cache_flags(cache, &flags);
if (ret < 0) {
error_report("Invalid cache option: %s", cache);
return -1;
}
out_bs = bdrv_new_open(out_filename, out_fmt, flags);
if (!out_bs) {
ret = -1;
goto out;
}
bs_i = 0;
bs_offset = 0;
bdrv_get_geometry(bs[0], &bs_sectors);
buf = qemu_blockalign(out_bs, IO_BUF_SIZE);
if (compress) {
ret = bdrv_get_info(out_bs, &bdi);
if (ret < 0) {
error_report("could not get block driver info");
goto out;
}
cluster_size = bdi.cluster_size;
if (cluster_size <= 0 || cluster_size > IO_BUF_SIZE) {
error_report("invalid cluster size");
ret = -1;
goto out;
}
cluster_sectors = cluster_size >> 9;
sector_num = 0;
nb_sectors = total_sectors;
local_progress = (float)100 /
(nb_sectors / MIN(nb_sectors, cluster_sectors));
for(;;) {
int64_t bs_num;
int remainder;
uint8_t *buf2;
nb_sectors = total_sectors - sector_num;
if (nb_sectors <= 0)
break;
if (nb_sectors >= cluster_sectors)
n = cluster_sectors;
else
n = nb_sectors;
bs_num = sector_num - bs_offset;
assert (bs_num >= 0);
remainder = n;
buf2 = buf;
while (remainder > 0) {
int nlow;
while (bs_num == bs_sectors) {
bs_i++;
assert (bs_i < bs_n);
bs_offset += bs_sectors;
bdrv_get_geometry(bs[bs_i], &bs_sectors);
bs_num = 0;
/* printf("changing part: sector_num=%" PRId64 ", "
"bs_i=%d, bs_offset=%" PRId64 ", bs_sectors=%" PRId64
"\n", sector_num, bs_i, bs_offset, bs_sectors); */
}
assert (bs_num < bs_sectors);
nlow = (remainder > bs_sectors - bs_num) ? bs_sectors - bs_num : remainder;
ret = bdrv_read(bs[bs_i], bs_num, buf2, nlow);
if (ret < 0) {
error_report("error while reading sector %" PRId64 ": %s",
bs_num, strerror(-ret));
goto out;
}
buf2 += nlow * 512;
bs_num += nlow;
remainder -= nlow;
}
assert (remainder == 0);
if (n < cluster_sectors) {
memset(buf + n * 512, 0, cluster_size - n * 512);
}
if (!buffer_is_zero(buf, cluster_size)) {
ret = bdrv_write_compressed(out_bs, sector_num, buf,
cluster_sectors);
if (ret != 0) {
error_report("error while compressing sector %" PRId64
": %s", sector_num, strerror(-ret));
goto out;
}
}
sector_num += n;
qemu_progress_print(local_progress, 100);
}
/* signal EOF to align */
bdrv_write_compressed(out_bs, 0, NULL, 0);
} else {
int has_zero_init = bdrv_has_zero_init(out_bs);
sector_num = 0; // total number of sectors converted so far
nb_sectors = total_sectors - sector_num;
local_progress = (float)100 /
(nb_sectors / MIN(nb_sectors, IO_BUF_SIZE / 512));
for(;;) {
nb_sectors = total_sectors - sector_num;
if (nb_sectors <= 0) {
break;
}
if (nb_sectors >= (IO_BUF_SIZE / 512)) {
n = (IO_BUF_SIZE / 512);
} else {
n = nb_sectors;
}
while (sector_num - bs_offset >= bs_sectors) {
bs_i ++;
assert (bs_i < bs_n);
bs_offset += bs_sectors;
bdrv_get_geometry(bs[bs_i], &bs_sectors);
/* printf("changing part: sector_num=%" PRId64 ", bs_i=%d, "
"bs_offset=%" PRId64 ", bs_sectors=%" PRId64 "\n",
sector_num, bs_i, bs_offset, bs_sectors); */
}
if (n > bs_offset + bs_sectors - sector_num) {
n = bs_offset + bs_sectors - sector_num;
}
if (has_zero_init) {
/* If the output image is being created as a copy on write image,
assume that sectors which are unallocated in the input image
are present in both the output's and input's base images (no
need to copy them). */
if (out_baseimg) {
if (!bdrv_is_allocated(bs[bs_i], sector_num - bs_offset,
n, &n1)) {
sector_num += n1;
continue;
}
/* The next 'n1' sectors are allocated in the input image. Copy
only those as they may be followed by unallocated sectors. */
n = n1;
}
} else {
n1 = n;
}
ret = bdrv_read(bs[bs_i], sector_num - bs_offset, buf, n);
if (ret < 0) {
error_report("error while reading sector %" PRId64 ": %s",
sector_num - bs_offset, strerror(-ret));
goto out;
}
/* NOTE: at the same time we convert, we do not write zero
sectors to have a chance to compress the image. Ideally, we
should add a specific call to have the info to go faster */
buf1 = buf;
while (n > 0) {
/* If the output image is being created as a copy on write image,
copy all sectors even the ones containing only NUL bytes,
because they may differ from the sectors in the base image.
If the output is to a host device, we also write out
sectors that are entirely 0, since whatever data was
already there is garbage, not 0s. */
if (!has_zero_init || out_baseimg ||
is_allocated_sectors_min(buf1, n, &n1, min_sparse)) {
ret = bdrv_write(out_bs, sector_num, buf1, n1);
if (ret < 0) {
error_report("error while writing sector %" PRId64
": %s", sector_num, strerror(-ret));
goto out;
}
}
sector_num += n1;
n -= n1;
buf1 += n1 * 512;
}
qemu_progress_print(local_progress, 100);
}
}
out:
qemu_progress_end();
free_option_parameters(create_options);
free_option_parameters(param);
qemu_vfree(buf);
if (out_bs) {
bdrv_delete(out_bs);
}
if (bs) {
for (bs_i = 0; bs_i < bs_n; bs_i++) {
if (bs[bs_i]) {
bdrv_delete(bs[bs_i]);
}
}
g_free(bs);
}
if (ret) {
return 1;
}
return 0;
}
| true |
qemu
|
c8057f951d64de93bfd01569c0a725baa9f94372
|
static int img_convert(int argc, char **argv)
{
int c, ret = 0, n, n1, bs_n, bs_i, compress, cluster_size, cluster_sectors;
int progress = 0, flags;
const char *fmt, *out_fmt, *cache, *out_baseimg, *out_filename;
BlockDriver *drv, *proto_drv;
BlockDriverState **bs = NULL, *out_bs = NULL;
int64_t total_sectors, nb_sectors, sector_num, bs_offset;
uint64_t bs_sectors;
uint8_t * buf = NULL;
const uint8_t *buf1;
BlockDriverInfo bdi;
QEMUOptionParameter *param = NULL, *create_options = NULL;
QEMUOptionParameter *out_baseimg_param;
char *options = NULL;
const char *snapshot_name = NULL;
float local_progress;
int min_sparse = 8;
fmt = NULL;
out_fmt = "raw";
cache = "unsafe";
out_baseimg = NULL;
compress = 0;
for(;;) {
c = getopt(argc, argv, "f:O:B:s:hce6o:pS:t:");
if (c == -1) {
break;
}
switch(c) {
case '?':
case 'h':
help();
break;
case 'f':
fmt = optarg;
break;
case 'O':
out_fmt = optarg;
break;
case 'B':
out_baseimg = optarg;
break;
case 'c':
compress = 1;
break;
case 'e':
error_report("option -e is deprecated, please use \'-o "
"encryption\' instead!");
return 1;
case '6':
error_report("option -6 is deprecated, please use \'-o "
"compat6\' instead!");
return 1;
case 'o':
options = optarg;
break;
case 's':
snapshot_name = optarg;
break;
case 'S':
{
int64_t sval;
char *end;
sval = strtosz_suffix(optarg, &end, STRTOSZ_DEFSUFFIX_B);
if (sval < 0 || *end) {
error_report("Invalid minimum zero buffer size for sparse output specified");
return 1;
}
min_sparse = sval / BDRV_SECTOR_SIZE;
break;
}
case 'p':
progress = 1;
break;
case 't':
cache = optarg;
break;
}
}
bs_n = argc - optind - 1;
if (bs_n < 1) {
help();
}
out_filename = argv[argc - 1];
qemu_progress_init(progress, 2.0);
if (options && !strcmp(options, "?")) {
ret = print_block_option_help(out_filename, out_fmt);
goto out;
}
if (bs_n > 1 && out_baseimg) {
error_report("-B makes no sense when concatenating multiple input "
"images");
ret = -1;
goto out;
}
qemu_progress_print(0, 100);
bs = g_malloc0(bs_n * sizeof(BlockDriverState *));
total_sectors = 0;
for (bs_i = 0; bs_i < bs_n; bs_i++) {
bs[bs_i] = bdrv_new_open(argv[optind + bs_i], fmt, BDRV_O_FLAGS);
if (!bs[bs_i]) {
error_report("Could not open '%s'", argv[optind + bs_i]);
ret = -1;
goto out;
}
bdrv_get_geometry(bs[bs_i], &bs_sectors);
total_sectors += bs_sectors;
}
if (snapshot_name != NULL) {
if (bs_n > 1) {
error_report("No support for concatenating multiple snapshot");
ret = -1;
goto out;
}
if (bdrv_snapshot_load_tmp(bs[0], snapshot_name) < 0) {
error_report("Failed to load snapshot");
ret = -1;
goto out;
}
}
drv = bdrv_find_format(out_fmt);
if (!drv) {
error_report("Unknown file format '%s'", out_fmt);
ret = -1;
goto out;
}
proto_drv = bdrv_find_protocol(out_filename);
if (!proto_drv) {
error_report("Unknown protocol '%s'", out_filename);
ret = -1;
goto out;
}
create_options = append_option_parameters(create_options,
drv->create_options);
create_options = append_option_parameters(create_options,
proto_drv->create_options);
if (options) {
param = parse_option_parameters(options, create_options, param);
if (param == NULL) {
error_report("Invalid options for file format '%s'.", out_fmt);
ret = -1;
goto out;
}
} else {
param = parse_option_parameters("", create_options, param);
}
set_option_parameter_int(param, BLOCK_OPT_SIZE, total_sectors * 512);
ret = add_old_style_options(out_fmt, param, out_baseimg, NULL);
if (ret < 0) {
goto out;
}
out_baseimg_param = get_option_parameter(param, BLOCK_OPT_BACKING_FILE);
if (out_baseimg_param) {
out_baseimg = out_baseimg_param->value.s;
}
if (compress) {
QEMUOptionParameter *encryption =
get_option_parameter(param, BLOCK_OPT_ENCRYPT);
QEMUOptionParameter *preallocation =
get_option_parameter(param, BLOCK_OPT_PREALLOC);
if (!drv->bdrv_write_compressed) {
error_report("Compression not supported for this file format");
ret = -1;
goto out;
}
if (encryption && encryption->value.n) {
error_report("Compression and encryption not supported at "
"the same time");
ret = -1;
goto out;
}
if (preallocation && preallocation->value.s
&& strcmp(preallocation->value.s, "off"))
{
error_report("Compression and preallocation not supported at "
"the same time");
ret = -1;
goto out;
}
}
ret = bdrv_create(drv, out_filename, param);
if (ret < 0) {
if (ret == -ENOTSUP) {
error_report("Formatting not supported for file format '%s'",
out_fmt);
} else if (ret == -EFBIG) {
error_report("The image size is too large for file format '%s'",
out_fmt);
} else {
error_report("%s: error while converting %s: %s",
out_filename, out_fmt, strerror(-ret));
}
goto out;
}
flags = BDRV_O_RDWR;
ret = bdrv_parse_cache_flags(cache, &flags);
if (ret < 0) {
error_report("Invalid cache option: %s", cache);
return -1;
}
out_bs = bdrv_new_open(out_filename, out_fmt, flags);
if (!out_bs) {
ret = -1;
goto out;
}
bs_i = 0;
bs_offset = 0;
bdrv_get_geometry(bs[0], &bs_sectors);
buf = qemu_blockalign(out_bs, IO_BUF_SIZE);
if (compress) {
ret = bdrv_get_info(out_bs, &bdi);
if (ret < 0) {
error_report("could not get block driver info");
goto out;
}
cluster_size = bdi.cluster_size;
if (cluster_size <= 0 || cluster_size > IO_BUF_SIZE) {
error_report("invalid cluster size");
ret = -1;
goto out;
}
cluster_sectors = cluster_size >> 9;
sector_num = 0;
nb_sectors = total_sectors;
local_progress = (float)100 /
(nb_sectors / MIN(nb_sectors, cluster_sectors));
for(;;) {
int64_t bs_num;
int remainder;
uint8_t *buf2;
nb_sectors = total_sectors - sector_num;
if (nb_sectors <= 0)
break;
if (nb_sectors >= cluster_sectors)
n = cluster_sectors;
else
n = nb_sectors;
bs_num = sector_num - bs_offset;
assert (bs_num >= 0);
remainder = n;
buf2 = buf;
while (remainder > 0) {
int nlow;
while (bs_num == bs_sectors) {
bs_i++;
assert (bs_i < bs_n);
bs_offset += bs_sectors;
bdrv_get_geometry(bs[bs_i], &bs_sectors);
bs_num = 0;
}
assert (bs_num < bs_sectors);
nlow = (remainder > bs_sectors - bs_num) ? bs_sectors - bs_num : remainder;
ret = bdrv_read(bs[bs_i], bs_num, buf2, nlow);
if (ret < 0) {
error_report("error while reading sector %" PRId64 ": %s",
bs_num, strerror(-ret));
goto out;
}
buf2 += nlow * 512;
bs_num += nlow;
remainder -= nlow;
}
assert (remainder == 0);
if (n < cluster_sectors) {
memset(buf + n * 512, 0, cluster_size - n * 512);
}
if (!buffer_is_zero(buf, cluster_size)) {
ret = bdrv_write_compressed(out_bs, sector_num, buf,
cluster_sectors);
if (ret != 0) {
error_report("error while compressing sector %" PRId64
": %s", sector_num, strerror(-ret));
goto out;
}
}
sector_num += n;
qemu_progress_print(local_progress, 100);
}
bdrv_write_compressed(out_bs, 0, NULL, 0);
} else {
int has_zero_init = bdrv_has_zero_init(out_bs);
sector_num = 0;
nb_sectors = total_sectors - sector_num;
local_progress = (float)100 /
(nb_sectors / MIN(nb_sectors, IO_BUF_SIZE / 512));
for(;;) {
nb_sectors = total_sectors - sector_num;
if (nb_sectors <= 0) {
break;
}
if (nb_sectors >= (IO_BUF_SIZE / 512)) {
n = (IO_BUF_SIZE / 512);
} else {
n = nb_sectors;
}
while (sector_num - bs_offset >= bs_sectors) {
bs_i ++;
assert (bs_i < bs_n);
bs_offset += bs_sectors;
bdrv_get_geometry(bs[bs_i], &bs_sectors);
}
if (n > bs_offset + bs_sectors - sector_num) {
n = bs_offset + bs_sectors - sector_num;
}
if (has_zero_init) {
if (out_baseimg) {
if (!bdrv_is_allocated(bs[bs_i], sector_num - bs_offset,
n, &n1)) {
sector_num += n1;
continue;
}
n = n1;
}
} else {
n1 = n;
}
ret = bdrv_read(bs[bs_i], sector_num - bs_offset, buf, n);
if (ret < 0) {
error_report("error while reading sector %" PRId64 ": %s",
sector_num - bs_offset, strerror(-ret));
goto out;
}
buf1 = buf;
while (n > 0) {
if (!has_zero_init || out_baseimg ||
is_allocated_sectors_min(buf1, n, &n1, min_sparse)) {
ret = bdrv_write(out_bs, sector_num, buf1, n1);
if (ret < 0) {
error_report("error while writing sector %" PRId64
": %s", sector_num, strerror(-ret));
goto out;
}
}
sector_num += n1;
n -= n1;
buf1 += n1 * 512;
}
qemu_progress_print(local_progress, 100);
}
}
out:
qemu_progress_end();
free_option_parameters(create_options);
free_option_parameters(param);
qemu_vfree(buf);
if (out_bs) {
bdrv_delete(out_bs);
}
if (bs) {
for (bs_i = 0; bs_i < bs_n; bs_i++) {
if (bs[bs_i]) {
bdrv_delete(bs[bs_i]);
}
}
g_free(bs);
}
if (ret) {
return 1;
}
return 0;
}
|
{
"code": [
" if (options && !strcmp(options, \"?\")) {",
" if (options && !strcmp(options, \"?\")) {"
],
"line_no": [
185,
185
]
}
|
static int FUNC_0(int VAR_0, char **VAR_1)
{
int VAR_2, VAR_3 = 0, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;
int VAR_11 = 0, VAR_12;
const char *VAR_13, *VAR_14, *VAR_15, *VAR_16, *VAR_17;
BlockDriver *drv, *proto_drv;
BlockDriverState **bs = NULL, *out_bs = NULL;
int64_t total_sectors, nb_sectors, sector_num, bs_offset;
uint64_t bs_sectors;
uint8_t * buf = NULL;
const uint8_t *VAR_18;
BlockDriverInfo bdi;
QEMUOptionParameter *param = NULL, *create_options = NULL;
QEMUOptionParameter *out_baseimg_param;
char *VAR_19 = NULL;
const char *VAR_20 = NULL;
float VAR_21;
int VAR_22 = 8;
VAR_13 = NULL;
VAR_14 = "raw";
VAR_15 = "unsafe";
VAR_16 = NULL;
VAR_8 = 0;
for(;;) {
VAR_2 = getopt(VAR_0, VAR_1, "f:O:B:s:hce6o:pS:t:");
if (VAR_2 == -1) {
break;
}
switch(VAR_2) {
case '?':
case 'h':
help();
break;
case 'f':
VAR_13 = optarg;
break;
case 'O':
VAR_14 = optarg;
break;
case 'B':
VAR_16 = optarg;
break;
case 'VAR_2':
VAR_8 = 1;
break;
case 'e':
error_report("option -e is deprecated, please use \'-o "
"encryption\' instead!");
return 1;
case '6':
error_report("option -6 is deprecated, please use \'-o "
"compat6\' instead!");
return 1;
case 'o':
VAR_19 = optarg;
break;
case 's':
VAR_20 = optarg;
break;
case 'S':
{
int64_t sval;
char *VAR_23;
sval = strtosz_suffix(optarg, &VAR_23, STRTOSZ_DEFSUFFIX_B);
if (sval < 0 || *VAR_23) {
error_report("Invalid minimum zero buffer size for sparse output specified");
return 1;
}
VAR_22 = sval / BDRV_SECTOR_SIZE;
break;
}
case 'p':
VAR_11 = 1;
break;
case 't':
VAR_15 = optarg;
break;
}
}
VAR_6 = VAR_0 - optind - 1;
if (VAR_6 < 1) {
help();
}
VAR_17 = VAR_1[VAR_0 - 1];
qemu_progress_init(VAR_11, 2.0);
if (VAR_19 && !strcmp(VAR_19, "?")) {
VAR_3 = print_block_option_help(VAR_17, VAR_14);
goto out;
}
if (VAR_6 > 1 && VAR_16) {
error_report("-B makes no sense when concatenating multiple input "
"images");
VAR_3 = -1;
goto out;
}
qemu_progress_print(0, 100);
bs = g_malloc0(VAR_6 * sizeof(BlockDriverState *));
total_sectors = 0;
for (VAR_7 = 0; VAR_7 < VAR_6; VAR_7++) {
bs[VAR_7] = bdrv_new_open(VAR_1[optind + VAR_7], VAR_13, BDRV_O_FLAGS);
if (!bs[VAR_7]) {
error_report("Could not open '%s'", VAR_1[optind + VAR_7]);
VAR_3 = -1;
goto out;
}
bdrv_get_geometry(bs[VAR_7], &bs_sectors);
total_sectors += bs_sectors;
}
if (VAR_20 != NULL) {
if (VAR_6 > 1) {
error_report("No support for concatenating multiple snapshot");
VAR_3 = -1;
goto out;
}
if (bdrv_snapshot_load_tmp(bs[0], VAR_20) < 0) {
error_report("Failed to load snapshot");
VAR_3 = -1;
goto out;
}
}
drv = bdrv_find_format(VAR_14);
if (!drv) {
error_report("Unknown file format '%s'", VAR_14);
VAR_3 = -1;
goto out;
}
proto_drv = bdrv_find_protocol(VAR_17);
if (!proto_drv) {
error_report("Unknown protocol '%s'", VAR_17);
VAR_3 = -1;
goto out;
}
create_options = append_option_parameters(create_options,
drv->create_options);
create_options = append_option_parameters(create_options,
proto_drv->create_options);
if (VAR_19) {
param = parse_option_parameters(VAR_19, create_options, param);
if (param == NULL) {
error_report("Invalid VAR_19 for file format '%s'.", VAR_14);
VAR_3 = -1;
goto out;
}
} else {
param = parse_option_parameters("", create_options, param);
}
set_option_parameter_int(param, BLOCK_OPT_SIZE, total_sectors * 512);
VAR_3 = add_old_style_options(VAR_14, param, VAR_16, NULL);
if (VAR_3 < 0) {
goto out;
}
out_baseimg_param = get_option_parameter(param, BLOCK_OPT_BACKING_FILE);
if (out_baseimg_param) {
VAR_16 = out_baseimg_param->value.s;
}
if (VAR_8) {
QEMUOptionParameter *encryption =
get_option_parameter(param, BLOCK_OPT_ENCRYPT);
QEMUOptionParameter *preallocation =
get_option_parameter(param, BLOCK_OPT_PREALLOC);
if (!drv->bdrv_write_compressed) {
error_report("Compression not supported for this file format");
VAR_3 = -1;
goto out;
}
if (encryption && encryption->value.VAR_4) {
error_report("Compression and encryption not supported at "
"the same time");
VAR_3 = -1;
goto out;
}
if (preallocation && preallocation->value.s
&& strcmp(preallocation->value.s, "off"))
{
error_report("Compression and preallocation not supported at "
"the same time");
VAR_3 = -1;
goto out;
}
}
VAR_3 = bdrv_create(drv, VAR_17, param);
if (VAR_3 < 0) {
if (VAR_3 == -ENOTSUP) {
error_report("Formatting not supported for file format '%s'",
VAR_14);
} else if (VAR_3 == -EFBIG) {
error_report("The image size is too large for file format '%s'",
VAR_14);
} else {
error_report("%s: error while converting %s: %s",
VAR_17, VAR_14, strerror(-VAR_3));
}
goto out;
}
VAR_12 = BDRV_O_RDWR;
VAR_3 = bdrv_parse_cache_flags(VAR_15, &VAR_12);
if (VAR_3 < 0) {
error_report("Invalid VAR_15 option: %s", VAR_15);
return -1;
}
out_bs = bdrv_new_open(VAR_17, VAR_14, VAR_12);
if (!out_bs) {
VAR_3 = -1;
goto out;
}
VAR_7 = 0;
bs_offset = 0;
bdrv_get_geometry(bs[0], &bs_sectors);
buf = qemu_blockalign(out_bs, IO_BUF_SIZE);
if (VAR_8) {
VAR_3 = bdrv_get_info(out_bs, &bdi);
if (VAR_3 < 0) {
error_report("could not get block driver info");
goto out;
}
VAR_9 = bdi.VAR_9;
if (VAR_9 <= 0 || VAR_9 > IO_BUF_SIZE) {
error_report("invalid cluster size");
VAR_3 = -1;
goto out;
}
VAR_10 = VAR_9 >> 9;
sector_num = 0;
nb_sectors = total_sectors;
VAR_21 = (float)100 /
(nb_sectors / MIN(nb_sectors, VAR_10));
for(;;) {
int64_t bs_num;
int VAR_24;
uint8_t *buf2;
nb_sectors = total_sectors - sector_num;
if (nb_sectors <= 0)
break;
if (nb_sectors >= VAR_10)
VAR_4 = VAR_10;
else
VAR_4 = nb_sectors;
bs_num = sector_num - bs_offset;
assert (bs_num >= 0);
VAR_24 = VAR_4;
buf2 = buf;
while (VAR_24 > 0) {
int VAR_25;
while (bs_num == bs_sectors) {
VAR_7++;
assert (VAR_7 < VAR_6);
bs_offset += bs_sectors;
bdrv_get_geometry(bs[VAR_7], &bs_sectors);
bs_num = 0;
}
assert (bs_num < bs_sectors);
VAR_25 = (VAR_24 > bs_sectors - bs_num) ? bs_sectors - bs_num : VAR_24;
VAR_3 = bdrv_read(bs[VAR_7], bs_num, buf2, VAR_25);
if (VAR_3 < 0) {
error_report("error while reading sector %" PRId64 ": %s",
bs_num, strerror(-VAR_3));
goto out;
}
buf2 += VAR_25 * 512;
bs_num += VAR_25;
VAR_24 -= VAR_25;
}
assert (VAR_24 == 0);
if (VAR_4 < VAR_10) {
memset(buf + VAR_4 * 512, 0, VAR_9 - VAR_4 * 512);
}
if (!buffer_is_zero(buf, VAR_9)) {
VAR_3 = bdrv_write_compressed(out_bs, sector_num, buf,
VAR_10);
if (VAR_3 != 0) {
error_report("error while compressing sector %" PRId64
": %s", sector_num, strerror(-VAR_3));
goto out;
}
}
sector_num += VAR_4;
qemu_progress_print(VAR_21, 100);
}
bdrv_write_compressed(out_bs, 0, NULL, 0);
} else {
int VAR_26 = bdrv_has_zero_init(out_bs);
sector_num = 0;
nb_sectors = total_sectors - sector_num;
VAR_21 = (float)100 /
(nb_sectors / MIN(nb_sectors, IO_BUF_SIZE / 512));
for(;;) {
nb_sectors = total_sectors - sector_num;
if (nb_sectors <= 0) {
break;
}
if (nb_sectors >= (IO_BUF_SIZE / 512)) {
VAR_4 = (IO_BUF_SIZE / 512);
} else {
VAR_4 = nb_sectors;
}
while (sector_num - bs_offset >= bs_sectors) {
VAR_7 ++;
assert (VAR_7 < VAR_6);
bs_offset += bs_sectors;
bdrv_get_geometry(bs[VAR_7], &bs_sectors);
}
if (VAR_4 > bs_offset + bs_sectors - sector_num) {
VAR_4 = bs_offset + bs_sectors - sector_num;
}
if (VAR_26) {
if (VAR_16) {
if (!bdrv_is_allocated(bs[VAR_7], sector_num - bs_offset,
VAR_4, &VAR_5)) {
sector_num += VAR_5;
continue;
}
VAR_4 = VAR_5;
}
} else {
VAR_5 = VAR_4;
}
VAR_3 = bdrv_read(bs[VAR_7], sector_num - bs_offset, buf, VAR_4);
if (VAR_3 < 0) {
error_report("error while reading sector %" PRId64 ": %s",
sector_num - bs_offset, strerror(-VAR_3));
goto out;
}
VAR_18 = buf;
while (VAR_4 > 0) {
if (!VAR_26 || VAR_16 ||
is_allocated_sectors_min(VAR_18, VAR_4, &VAR_5, VAR_22)) {
VAR_3 = bdrv_write(out_bs, sector_num, VAR_18, VAR_5);
if (VAR_3 < 0) {
error_report("error while writing sector %" PRId64
": %s", sector_num, strerror(-VAR_3));
goto out;
}
}
sector_num += VAR_5;
VAR_4 -= VAR_5;
VAR_18 += VAR_5 * 512;
}
qemu_progress_print(VAR_21, 100);
}
}
out:
qemu_progress_end();
free_option_parameters(create_options);
free_option_parameters(param);
qemu_vfree(buf);
if (out_bs) {
bdrv_delete(out_bs);
}
if (bs) {
for (VAR_7 = 0; VAR_7 < VAR_6; VAR_7++) {
if (bs[VAR_7]) {
bdrv_delete(bs[VAR_7]);
}
}
g_free(bs);
}
if (VAR_3) {
return 1;
}
return 0;
}
|
[
"static int FUNC_0(int VAR_0, char **VAR_1)\n{",
"int VAR_2, VAR_3 = 0, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;",
"int VAR_11 = 0, VAR_12;",
"const char *VAR_13, *VAR_14, *VAR_15, *VAR_16, *VAR_17;",
"BlockDriver *drv, *proto_drv;",
"BlockDriverState **bs = NULL, *out_bs = NULL;",
"int64_t total_sectors, nb_sectors, sector_num, bs_offset;",
"uint64_t bs_sectors;",
"uint8_t * buf = NULL;",
"const uint8_t *VAR_18;",
"BlockDriverInfo bdi;",
"QEMUOptionParameter *param = NULL, *create_options = NULL;",
"QEMUOptionParameter *out_baseimg_param;",
"char *VAR_19 = NULL;",
"const char *VAR_20 = NULL;",
"float VAR_21;",
"int VAR_22 = 8;",
"VAR_13 = NULL;",
"VAR_14 = \"raw\";",
"VAR_15 = \"unsafe\";",
"VAR_16 = NULL;",
"VAR_8 = 0;",
"for(;;) {",
"VAR_2 = getopt(VAR_0, VAR_1, \"f:O:B:s:hce6o:pS:t:\");",
"if (VAR_2 == -1) {",
"break;",
"}",
"switch(VAR_2) {",
"case '?':\ncase 'h':\nhelp();",
"break;",
"case 'f':\nVAR_13 = optarg;",
"break;",
"case 'O':\nVAR_14 = optarg;",
"break;",
"case 'B':\nVAR_16 = optarg;",
"break;",
"case 'VAR_2':\nVAR_8 = 1;",
"break;",
"case 'e':\nerror_report(\"option -e is deprecated, please use \\'-o \"\n\"encryption\\' instead!\");",
"return 1;",
"case '6':\nerror_report(\"option -6 is deprecated, please use \\'-o \"\n\"compat6\\' instead!\");",
"return 1;",
"case 'o':\nVAR_19 = optarg;",
"break;",
"case 's':\nVAR_20 = optarg;",
"break;",
"case 'S':\n{",
"int64_t sval;",
"char *VAR_23;",
"sval = strtosz_suffix(optarg, &VAR_23, STRTOSZ_DEFSUFFIX_B);",
"if (sval < 0 || *VAR_23) {",
"error_report(\"Invalid minimum zero buffer size for sparse output specified\");",
"return 1;",
"}",
"VAR_22 = sval / BDRV_SECTOR_SIZE;",
"break;",
"}",
"case 'p':\nVAR_11 = 1;",
"break;",
"case 't':\nVAR_15 = optarg;",
"break;",
"}",
"}",
"VAR_6 = VAR_0 - optind - 1;",
"if (VAR_6 < 1) {",
"help();",
"}",
"VAR_17 = VAR_1[VAR_0 - 1];",
"qemu_progress_init(VAR_11, 2.0);",
"if (VAR_19 && !strcmp(VAR_19, \"?\")) {",
"VAR_3 = print_block_option_help(VAR_17, VAR_14);",
"goto out;",
"}",
"if (VAR_6 > 1 && VAR_16) {",
"error_report(\"-B makes no sense when concatenating multiple input \"\n\"images\");",
"VAR_3 = -1;",
"goto out;",
"}",
"qemu_progress_print(0, 100);",
"bs = g_malloc0(VAR_6 * sizeof(BlockDriverState *));",
"total_sectors = 0;",
"for (VAR_7 = 0; VAR_7 < VAR_6; VAR_7++) {",
"bs[VAR_7] = bdrv_new_open(VAR_1[optind + VAR_7], VAR_13, BDRV_O_FLAGS);",
"if (!bs[VAR_7]) {",
"error_report(\"Could not open '%s'\", VAR_1[optind + VAR_7]);",
"VAR_3 = -1;",
"goto out;",
"}",
"bdrv_get_geometry(bs[VAR_7], &bs_sectors);",
"total_sectors += bs_sectors;",
"}",
"if (VAR_20 != NULL) {",
"if (VAR_6 > 1) {",
"error_report(\"No support for concatenating multiple snapshot\");",
"VAR_3 = -1;",
"goto out;",
"}",
"if (bdrv_snapshot_load_tmp(bs[0], VAR_20) < 0) {",
"error_report(\"Failed to load snapshot\");",
"VAR_3 = -1;",
"goto out;",
"}",
"}",
"drv = bdrv_find_format(VAR_14);",
"if (!drv) {",
"error_report(\"Unknown file format '%s'\", VAR_14);",
"VAR_3 = -1;",
"goto out;",
"}",
"proto_drv = bdrv_find_protocol(VAR_17);",
"if (!proto_drv) {",
"error_report(\"Unknown protocol '%s'\", VAR_17);",
"VAR_3 = -1;",
"goto out;",
"}",
"create_options = append_option_parameters(create_options,\ndrv->create_options);",
"create_options = append_option_parameters(create_options,\nproto_drv->create_options);",
"if (VAR_19) {",
"param = parse_option_parameters(VAR_19, create_options, param);",
"if (param == NULL) {",
"error_report(\"Invalid VAR_19 for file format '%s'.\", VAR_14);",
"VAR_3 = -1;",
"goto out;",
"}",
"} else {",
"param = parse_option_parameters(\"\", create_options, param);",
"}",
"set_option_parameter_int(param, BLOCK_OPT_SIZE, total_sectors * 512);",
"VAR_3 = add_old_style_options(VAR_14, param, VAR_16, NULL);",
"if (VAR_3 < 0) {",
"goto out;",
"}",
"out_baseimg_param = get_option_parameter(param, BLOCK_OPT_BACKING_FILE);",
"if (out_baseimg_param) {",
"VAR_16 = out_baseimg_param->value.s;",
"}",
"if (VAR_8) {",
"QEMUOptionParameter *encryption =\nget_option_parameter(param, BLOCK_OPT_ENCRYPT);",
"QEMUOptionParameter *preallocation =\nget_option_parameter(param, BLOCK_OPT_PREALLOC);",
"if (!drv->bdrv_write_compressed) {",
"error_report(\"Compression not supported for this file format\");",
"VAR_3 = -1;",
"goto out;",
"}",
"if (encryption && encryption->value.VAR_4) {",
"error_report(\"Compression and encryption not supported at \"\n\"the same time\");",
"VAR_3 = -1;",
"goto out;",
"}",
"if (preallocation && preallocation->value.s\n&& strcmp(preallocation->value.s, \"off\"))\n{",
"error_report(\"Compression and preallocation not supported at \"\n\"the same time\");",
"VAR_3 = -1;",
"goto out;",
"}",
"}",
"VAR_3 = bdrv_create(drv, VAR_17, param);",
"if (VAR_3 < 0) {",
"if (VAR_3 == -ENOTSUP) {",
"error_report(\"Formatting not supported for file format '%s'\",\nVAR_14);",
"} else if (VAR_3 == -EFBIG) {",
"error_report(\"The image size is too large for file format '%s'\",\nVAR_14);",
"} else {",
"error_report(\"%s: error while converting %s: %s\",\nVAR_17, VAR_14, strerror(-VAR_3));",
"}",
"goto out;",
"}",
"VAR_12 = BDRV_O_RDWR;",
"VAR_3 = bdrv_parse_cache_flags(VAR_15, &VAR_12);",
"if (VAR_3 < 0) {",
"error_report(\"Invalid VAR_15 option: %s\", VAR_15);",
"return -1;",
"}",
"out_bs = bdrv_new_open(VAR_17, VAR_14, VAR_12);",
"if (!out_bs) {",
"VAR_3 = -1;",
"goto out;",
"}",
"VAR_7 = 0;",
"bs_offset = 0;",
"bdrv_get_geometry(bs[0], &bs_sectors);",
"buf = qemu_blockalign(out_bs, IO_BUF_SIZE);",
"if (VAR_8) {",
"VAR_3 = bdrv_get_info(out_bs, &bdi);",
"if (VAR_3 < 0) {",
"error_report(\"could not get block driver info\");",
"goto out;",
"}",
"VAR_9 = bdi.VAR_9;",
"if (VAR_9 <= 0 || VAR_9 > IO_BUF_SIZE) {",
"error_report(\"invalid cluster size\");",
"VAR_3 = -1;",
"goto out;",
"}",
"VAR_10 = VAR_9 >> 9;",
"sector_num = 0;",
"nb_sectors = total_sectors;",
"VAR_21 = (float)100 /\n(nb_sectors / MIN(nb_sectors, VAR_10));",
"for(;;) {",
"int64_t bs_num;",
"int VAR_24;",
"uint8_t *buf2;",
"nb_sectors = total_sectors - sector_num;",
"if (nb_sectors <= 0)\nbreak;",
"if (nb_sectors >= VAR_10)\nVAR_4 = VAR_10;",
"else\nVAR_4 = nb_sectors;",
"bs_num = sector_num - bs_offset;",
"assert (bs_num >= 0);",
"VAR_24 = VAR_4;",
"buf2 = buf;",
"while (VAR_24 > 0) {",
"int VAR_25;",
"while (bs_num == bs_sectors) {",
"VAR_7++;",
"assert (VAR_7 < VAR_6);",
"bs_offset += bs_sectors;",
"bdrv_get_geometry(bs[VAR_7], &bs_sectors);",
"bs_num = 0;",
"}",
"assert (bs_num < bs_sectors);",
"VAR_25 = (VAR_24 > bs_sectors - bs_num) ? bs_sectors - bs_num : VAR_24;",
"VAR_3 = bdrv_read(bs[VAR_7], bs_num, buf2, VAR_25);",
"if (VAR_3 < 0) {",
"error_report(\"error while reading sector %\" PRId64 \": %s\",\nbs_num, strerror(-VAR_3));",
"goto out;",
"}",
"buf2 += VAR_25 * 512;",
"bs_num += VAR_25;",
"VAR_24 -= VAR_25;",
"}",
"assert (VAR_24 == 0);",
"if (VAR_4 < VAR_10) {",
"memset(buf + VAR_4 * 512, 0, VAR_9 - VAR_4 * 512);",
"}",
"if (!buffer_is_zero(buf, VAR_9)) {",
"VAR_3 = bdrv_write_compressed(out_bs, sector_num, buf,\nVAR_10);",
"if (VAR_3 != 0) {",
"error_report(\"error while compressing sector %\" PRId64\n\": %s\", sector_num, strerror(-VAR_3));",
"goto out;",
"}",
"}",
"sector_num += VAR_4;",
"qemu_progress_print(VAR_21, 100);",
"}",
"bdrv_write_compressed(out_bs, 0, NULL, 0);",
"} else {",
"int VAR_26 = bdrv_has_zero_init(out_bs);",
"sector_num = 0;",
"nb_sectors = total_sectors - sector_num;",
"VAR_21 = (float)100 /\n(nb_sectors / MIN(nb_sectors, IO_BUF_SIZE / 512));",
"for(;;) {",
"nb_sectors = total_sectors - sector_num;",
"if (nb_sectors <= 0) {",
"break;",
"}",
"if (nb_sectors >= (IO_BUF_SIZE / 512)) {",
"VAR_4 = (IO_BUF_SIZE / 512);",
"} else {",
"VAR_4 = nb_sectors;",
"}",
"while (sector_num - bs_offset >= bs_sectors) {",
"VAR_7 ++;",
"assert (VAR_7 < VAR_6);",
"bs_offset += bs_sectors;",
"bdrv_get_geometry(bs[VAR_7], &bs_sectors);",
"}",
"if (VAR_4 > bs_offset + bs_sectors - sector_num) {",
"VAR_4 = bs_offset + bs_sectors - sector_num;",
"}",
"if (VAR_26) {",
"if (VAR_16) {",
"if (!bdrv_is_allocated(bs[VAR_7], sector_num - bs_offset,\nVAR_4, &VAR_5)) {",
"sector_num += VAR_5;",
"continue;",
"}",
"VAR_4 = VAR_5;",
"}",
"} else {",
"VAR_5 = VAR_4;",
"}",
"VAR_3 = bdrv_read(bs[VAR_7], sector_num - bs_offset, buf, VAR_4);",
"if (VAR_3 < 0) {",
"error_report(\"error while reading sector %\" PRId64 \": %s\",\nsector_num - bs_offset, strerror(-VAR_3));",
"goto out;",
"}",
"VAR_18 = buf;",
"while (VAR_4 > 0) {",
"if (!VAR_26 || VAR_16 ||\nis_allocated_sectors_min(VAR_18, VAR_4, &VAR_5, VAR_22)) {",
"VAR_3 = bdrv_write(out_bs, sector_num, VAR_18, VAR_5);",
"if (VAR_3 < 0) {",
"error_report(\"error while writing sector %\" PRId64\n\": %s\", sector_num, strerror(-VAR_3));",
"goto out;",
"}",
"}",
"sector_num += VAR_5;",
"VAR_4 -= VAR_5;",
"VAR_18 += VAR_5 * 512;",
"}",
"qemu_progress_print(VAR_21, 100);",
"}",
"}",
"out:\nqemu_progress_end();",
"free_option_parameters(create_options);",
"free_option_parameters(param);",
"qemu_vfree(buf);",
"if (out_bs) {",
"bdrv_delete(out_bs);",
"}",
"if (bs) {",
"for (VAR_7 = 0; VAR_7 < VAR_6; VAR_7++) {",
"if (bs[VAR_7]) {",
"bdrv_delete(bs[VAR_7]);",
"}",
"}",
"g_free(bs);",
"}",
"if (VAR_3) {",
"return 1;",
"}",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61,
63,
65
],
[
67
],
[
69,
71
],
[
73
],
[
75,
77
],
[
79
],
[
81,
83
],
[
85
],
[
87,
89
],
[
91
],
[
93,
95,
97
],
[
99
],
[
101,
103,
105
],
[
107
],
[
109,
111
],
[
113
],
[
115,
117
],
[
119
],
[
121,
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
141
],
[
143
],
[
145
],
[
147,
149
],
[
151
],
[
153,
155
],
[
157
],
[
159
],
[
161
],
[
165
],
[
167
],
[
169
],
[
171
],
[
175
],
[
181
],
[
185
],
[
187
],
[
189
],
[
191
],
[
195
],
[
197,
199
],
[
201
],
[
203
],
[
205
],
[
209
],
[
213
],
[
217
],
[
219
],
[
221
],
[
223
],
[
225
],
[
227
],
[
229
],
[
231
],
[
233
],
[
235
],
[
237
],
[
241
],
[
243
],
[
245
],
[
247
],
[
249
],
[
251
],
[
253
],
[
255
],
[
257
],
[
259
],
[
261
],
[
263
],
[
269
],
[
271
],
[
273
],
[
275
],
[
277
],
[
279
],
[
283
],
[
285
],
[
287
],
[
289
],
[
291
],
[
293
],
[
297,
299
],
[
301,
303
],
[
307
],
[
309
],
[
311
],
[
313
],
[
315
],
[
317
],
[
319
],
[
321
],
[
323
],
[
325
],
[
329
],
[
331
],
[
333
],
[
335
],
[
337
],
[
343
],
[
345
],
[
347
],
[
349
],
[
355
],
[
357,
359
],
[
361,
363
],
[
367
],
[
369
],
[
371
],
[
373
],
[
375
],
[
379
],
[
381,
383
],
[
385
],
[
387
],
[
389
],
[
393,
395,
397
],
[
399,
401
],
[
403
],
[
405
],
[
407
],
[
409
],
[
415
],
[
417
],
[
419
],
[
421,
423
],
[
425
],
[
427,
429
],
[
431
],
[
433,
435
],
[
437
],
[
439
],
[
441
],
[
445
],
[
447
],
[
449
],
[
451
],
[
453
],
[
455
],
[
459
],
[
461
],
[
463
],
[
465
],
[
467
],
[
471
],
[
473
],
[
475
],
[
477
],
[
481
],
[
483
],
[
485
],
[
487
],
[
489
],
[
491
],
[
493
],
[
495
],
[
497
],
[
499
],
[
501
],
[
503
],
[
505
],
[
507
],
[
511
],
[
513,
515
],
[
519
],
[
521
],
[
523
],
[
525
],
[
529
],
[
531,
533
],
[
535,
537
],
[
539,
541
],
[
545
],
[
547
],
[
549
],
[
551
],
[
553
],
[
555
],
[
557
],
[
559
],
[
561
],
[
563
],
[
565
],
[
567
],
[
575
],
[
577
],
[
581
],
[
585
],
[
587
],
[
589,
591
],
[
593
],
[
595
],
[
599
],
[
601
],
[
605
],
[
607
],
[
609
],
[
613
],
[
615
],
[
617
],
[
619
],
[
621,
623
],
[
625
],
[
627,
629
],
[
631
],
[
633
],
[
635
],
[
637
],
[
639
],
[
641
],
[
645
],
[
647
],
[
649
],
[
653
],
[
655
],
[
657,
659
],
[
663
],
[
665
],
[
667
],
[
669
],
[
671
],
[
673
],
[
675
],
[
677
],
[
679
],
[
681
],
[
685
],
[
687
],
[
689
],
[
691
],
[
693
],
[
701
],
[
705
],
[
707
],
[
709
],
[
713
],
[
723
],
[
725,
727
],
[
729
],
[
731
],
[
733
],
[
739
],
[
741
],
[
743
],
[
745
],
[
747
],
[
751
],
[
753
],
[
755,
757
],
[
759
],
[
761
],
[
769
],
[
771
],
[
787,
789
],
[
791
],
[
793
],
[
795,
797
],
[
799
],
[
801
],
[
803
],
[
805
],
[
807
],
[
809
],
[
811
],
[
813
],
[
815
],
[
817
],
[
819,
821
],
[
823
],
[
825
],
[
827
],
[
829
],
[
831
],
[
833
],
[
835
],
[
837
],
[
839
],
[
841
],
[
843
],
[
845
],
[
847
],
[
849
],
[
851
],
[
853
],
[
855
],
[
857
],
[
859
]
] |
6,381 |
static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
AVIContext *avi = s->priv_data;
ByteIOContext *pb = &s->pb;
uint32_t tag, tag1, handler;
int codec_type, stream_index, frame_period, bit_rate, scale, rate;
unsigned int size, nb_frames;
int i, n;
AVStream *st;
AVIStream *ast;
int xan_video = 0; /* hack to support Xan A/V */
if (get_riff(avi, pb) < 0)
return -1;
/* first list tag */
stream_index = -1;
codec_type = -1;
frame_period = 0;
for(;;) {
if (url_feof(pb))
goto fail;
tag = get_le32(pb);
size = get_le32(pb);
#ifdef DEBUG
print_tag("tag", tag, size);
#endif
switch(tag) {
case MKTAG('L', 'I', 'S', 'T'):
/* ignored, except when start of video packets */
tag1 = get_le32(pb);
#ifdef DEBUG
print_tag("list", tag1, 0);
#endif
if (tag1 == MKTAG('m', 'o', 'v', 'i')) {
avi->movi_list = url_ftell(pb) - 4;
if(size) avi->movi_end = avi->movi_list + size;
else avi->movi_end = url_filesize(url_fileno(pb));
#ifdef DEBUG
printf("movi end=%Lx\n", avi->movi_end);
#endif
goto end_of_header;
}
break;
case MKTAG('d', 'm', 'l', 'h'):
avi->is_odml = 1;
url_fskip(pb, size + (size & 1));
break;
case MKTAG('a', 'v', 'i', 'h'):
/* avi header */
/* using frame_period is bad idea */
frame_period = get_le32(pb);
bit_rate = get_le32(pb) * 8;
url_fskip(pb, 4 * 4);
n = get_le32(pb);
for(i=0;i<n;i++) {
AVIStream *ast;
st = av_new_stream(s, i);
if (!st)
goto fail;
ast = av_mallocz(sizeof(AVIStream));
if (!ast)
goto fail;
st->priv_data = ast;
}
url_fskip(pb, size - 7 * 4);
break;
case MKTAG('s', 't', 'r', 'h'):
/* stream header */
stream_index++;
tag1 = get_le32(pb);
handler = get_le32(pb); /* codec tag */
#ifdef DEBUG
print_tag("strh", tag1, -1);
#endif
switch(tag1) {
case MKTAG('i', 'a', 'v', 's'):
case MKTAG('i', 'v', 'a', 's'):
/*
* After some consideration -- I don't think we
* have to support anything but DV in a type1 AVIs.
*/
if (s->nb_streams != 1)
goto fail;
if (handler != MKTAG('d', 'v', 's', 'd') &&
handler != MKTAG('d', 'v', 'h', 'd') &&
handler != MKTAG('d', 'v', 's', 'l'))
goto fail;
ast = s->streams[0]->priv_data;
av_freep(&s->streams[0]->codec.extradata);
av_freep(&s->streams[0]);
s->nb_streams = 0;
avi->dv_demux = dv_init_demux(s);
if (!avi->dv_demux)
goto fail;
s->streams[0]->priv_data = ast;
url_fskip(pb, 3 * 4);
ast->scale = get_le32(pb);
ast->rate = get_le32(pb);
stream_index = s->nb_streams - 1;
url_fskip(pb, size - 7*4);
break;
case MKTAG('v', 'i', 'd', 's'):
codec_type = CODEC_TYPE_VIDEO;
if (stream_index >= s->nb_streams) {
url_fskip(pb, size - 8);
break;
}
st = s->streams[stream_index];
ast = st->priv_data;
st->codec.stream_codec_tag= handler;
get_le32(pb); /* flags */
get_le16(pb); /* priority */
get_le16(pb); /* language */
get_le32(pb); /* XXX: initial frame ? */
scale = get_le32(pb); /* scale */
rate = get_le32(pb); /* rate */
if(scale && rate){
}else if(frame_period){
rate = 1000000;
scale = frame_period;
}else{
rate = 25;
scale = 1;
}
ast->rate = rate;
ast->scale = scale;
av_set_pts_info(st, 64, scale, rate);
st->codec.frame_rate = rate;
st->codec.frame_rate_base = scale;
get_le32(pb); /* start */
nb_frames = get_le32(pb);
st->start_time = 0;
st->duration = av_rescale(nb_frames,
st->codec.frame_rate_base * AV_TIME_BASE,
st->codec.frame_rate);
url_fskip(pb, size - 9 * 4);
break;
case MKTAG('a', 'u', 'd', 's'):
{
unsigned int length;
codec_type = CODEC_TYPE_AUDIO;
if (stream_index >= s->nb_streams) {
url_fskip(pb, size - 8);
break;
}
st = s->streams[stream_index];
ast = st->priv_data;
get_le32(pb); /* flags */
get_le16(pb); /* priority */
get_le16(pb); /* language */
get_le32(pb); /* initial frame */
ast->scale = get_le32(pb); /* scale */
ast->rate = get_le32(pb);
if(!ast->rate)
ast->rate= 1; //wrong but better then 1/0
if(!ast->scale)
ast->scale= 1; //wrong but better then 1/0
av_set_pts_info(st, 64, ast->scale, ast->rate);
ast->start= get_le32(pb); /* start */
length = get_le32(pb); /* length, in samples or bytes */
get_le32(pb); /* buffer size */
get_le32(pb); /* quality */
ast->sample_size = get_le32(pb); /* sample ssize */
//av_log(NULL, AV_LOG_DEBUG, "%d %d %d %d\n", ast->scale, ast->rate, ast->sample_size, ast->start);
st->start_time = 0;
if (ast->rate != 0)
st->duration = (int64_t)length * AV_TIME_BASE / ast->rate;
url_fskip(pb, size - 12 * 4);
}
break;
case MKTAG('t', 'x', 't', 's'):
//FIXME
codec_type = CODEC_TYPE_DATA; //CODEC_TYPE_SUB ? FIXME
url_fskip(pb, size - 8);
break;
case MKTAG('p', 'a', 'd', 's'):
codec_type = CODEC_TYPE_UNKNOWN;
url_fskip(pb, size - 8);
stream_index--;
break;
default:
av_log(s, AV_LOG_ERROR, "unknown stream type %X\n", tag1);
goto fail;
}
break;
case MKTAG('s', 't', 'r', 'f'):
/* stream header */
if (stream_index >= s->nb_streams || avi->dv_demux) {
url_fskip(pb, size);
} else {
st = s->streams[stream_index];
switch(codec_type) {
case CODEC_TYPE_VIDEO:
get_le32(pb); /* size */
st->codec.width = get_le32(pb);
st->codec.height = get_le32(pb);
get_le16(pb); /* panes */
st->codec.bits_per_sample= get_le16(pb); /* depth */
tag1 = get_le32(pb);
get_le32(pb); /* ImageSize */
get_le32(pb); /* XPelsPerMeter */
get_le32(pb); /* YPelsPerMeter */
get_le32(pb); /* ClrUsed */
get_le32(pb); /* ClrImportant */
if(size > 10*4 && size<(1<<30)){
st->codec.extradata_size= size - 10*4;
st->codec.extradata= av_malloc(st->codec.extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
get_buffer(pb, st->codec.extradata, st->codec.extradata_size);
}
if(st->codec.extradata_size & 1) //FIXME check if the encoder really did this correctly
get_byte(pb);
/* Extract palette from extradata if bpp <= 8 */
/* This code assumes that extradata contains only palette */
/* This is true for all paletted codecs implemented in ffmpeg */
if (st->codec.extradata_size && (st->codec.bits_per_sample <= 8)) {
st->codec.palctrl = av_mallocz(sizeof(AVPaletteControl));
#ifdef WORDS_BIGENDIAN
for (i = 0; i < FFMIN(st->codec.extradata_size, AVPALETTE_SIZE)/4; i++)
st->codec.palctrl->palette[i] = bswap_32(((uint32_t*)st->codec.extradata)[i]);
#else
memcpy(st->codec.palctrl->palette, st->codec.extradata,
FFMIN(st->codec.extradata_size, AVPALETTE_SIZE));
#endif
st->codec.palctrl->palette_changed = 1;
}
#ifdef DEBUG
print_tag("video", tag1, 0);
#endif
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec.codec_tag = tag1;
st->codec.codec_id = codec_get_id(codec_bmp_tags, tag1);
if (st->codec.codec_id == CODEC_ID_XAN_WC4)
xan_video = 1;
// url_fskip(pb, size - 5 * 4);
break;
case CODEC_TYPE_AUDIO:
get_wav_header(pb, &st->codec, size);
if (size%2) /* 2-aligned (fix for Stargate SG-1 - 3x18 - Shades of Grey.avi) */
url_fskip(pb, 1);
/* special case time: To support Xan DPCM, hardcode
* the format if Xxan is the video codec */
st->need_parsing = 1;
/* force parsing as several audio frames can be in
one packet */
if (xan_video)
st->codec.codec_id = CODEC_ID_XAN_DPCM;
break;
default:
st->codec.codec_type = CODEC_TYPE_DATA;
st->codec.codec_id= CODEC_ID_NONE;
st->codec.codec_tag= 0;
url_fskip(pb, size);
break;
}
}
break;
default:
/* skip tag */
size += (size & 1);
url_fskip(pb, size);
break;
}
}
end_of_header:
/* check stream number */
if (stream_index != s->nb_streams - 1) {
fail:
for(i=0;i<s->nb_streams;i++) {
av_freep(&s->streams[i]->codec.extradata);
av_freep(&s->streams[i]);
}
return -1;
}
assert(!avi->index_loaded);
avi_load_index(s);
avi->index_loaded = 1;
return 0;
}
| true |
FFmpeg
|
8d65750ef1089561f0257fa1719b3094f341d16f
|
static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
AVIContext *avi = s->priv_data;
ByteIOContext *pb = &s->pb;
uint32_t tag, tag1, handler;
int codec_type, stream_index, frame_period, bit_rate, scale, rate;
unsigned int size, nb_frames;
int i, n;
AVStream *st;
AVIStream *ast;
int xan_video = 0;
if (get_riff(avi, pb) < 0)
return -1;
stream_index = -1;
codec_type = -1;
frame_period = 0;
for(;;) {
if (url_feof(pb))
goto fail;
tag = get_le32(pb);
size = get_le32(pb);
#ifdef DEBUG
print_tag("tag", tag, size);
#endif
switch(tag) {
case MKTAG('L', 'I', 'S', 'T'):
tag1 = get_le32(pb);
#ifdef DEBUG
print_tag("list", tag1, 0);
#endif
if (tag1 == MKTAG('m', 'o', 'v', 'i')) {
avi->movi_list = url_ftell(pb) - 4;
if(size) avi->movi_end = avi->movi_list + size;
else avi->movi_end = url_filesize(url_fileno(pb));
#ifdef DEBUG
printf("movi end=%Lx\n", avi->movi_end);
#endif
goto end_of_header;
}
break;
case MKTAG('d', 'm', 'l', 'h'):
avi->is_odml = 1;
url_fskip(pb, size + (size & 1));
break;
case MKTAG('a', 'v', 'i', 'h'):
frame_period = get_le32(pb);
bit_rate = get_le32(pb) * 8;
url_fskip(pb, 4 * 4);
n = get_le32(pb);
for(i=0;i<n;i++) {
AVIStream *ast;
st = av_new_stream(s, i);
if (!st)
goto fail;
ast = av_mallocz(sizeof(AVIStream));
if (!ast)
goto fail;
st->priv_data = ast;
}
url_fskip(pb, size - 7 * 4);
break;
case MKTAG('s', 't', 'r', 'h'):
stream_index++;
tag1 = get_le32(pb);
handler = get_le32(pb);
#ifdef DEBUG
print_tag("strh", tag1, -1);
#endif
switch(tag1) {
case MKTAG('i', 'a', 'v', 's'):
case MKTAG('i', 'v', 'a', 's'):
if (s->nb_streams != 1)
goto fail;
if (handler != MKTAG('d', 'v', 's', 'd') &&
handler != MKTAG('d', 'v', 'h', 'd') &&
handler != MKTAG('d', 'v', 's', 'l'))
goto fail;
ast = s->streams[0]->priv_data;
av_freep(&s->streams[0]->codec.extradata);
av_freep(&s->streams[0]);
s->nb_streams = 0;
avi->dv_demux = dv_init_demux(s);
if (!avi->dv_demux)
goto fail;
s->streams[0]->priv_data = ast;
url_fskip(pb, 3 * 4);
ast->scale = get_le32(pb);
ast->rate = get_le32(pb);
stream_index = s->nb_streams - 1;
url_fskip(pb, size - 7*4);
break;
case MKTAG('v', 'i', 'd', 's'):
codec_type = CODEC_TYPE_VIDEO;
if (stream_index >= s->nb_streams) {
url_fskip(pb, size - 8);
break;
}
st = s->streams[stream_index];
ast = st->priv_data;
st->codec.stream_codec_tag= handler;
get_le32(pb);
get_le16(pb);
get_le16(pb);
get_le32(pb);
scale = get_le32(pb);
rate = get_le32(pb);
if(scale && rate){
}else if(frame_period){
rate = 1000000;
scale = frame_period;
}else{
rate = 25;
scale = 1;
}
ast->rate = rate;
ast->scale = scale;
av_set_pts_info(st, 64, scale, rate);
st->codec.frame_rate = rate;
st->codec.frame_rate_base = scale;
get_le32(pb);
nb_frames = get_le32(pb);
st->start_time = 0;
st->duration = av_rescale(nb_frames,
st->codec.frame_rate_base * AV_TIME_BASE,
st->codec.frame_rate);
url_fskip(pb, size - 9 * 4);
break;
case MKTAG('a', 'u', 'd', 's'):
{
unsigned int length;
codec_type = CODEC_TYPE_AUDIO;
if (stream_index >= s->nb_streams) {
url_fskip(pb, size - 8);
break;
}
st = s->streams[stream_index];
ast = st->priv_data;
get_le32(pb);
get_le16(pb);
get_le16(pb);
get_le32(pb);
ast->scale = get_le32(pb);
ast->rate = get_le32(pb);
if(!ast->rate)
ast->rate= 1;
if(!ast->scale)
ast->scale= 1;
av_set_pts_info(st, 64, ast->scale, ast->rate);
ast->start= get_le32(pb);
length = get_le32(pb);
get_le32(pb);
get_le32(pb);
ast->sample_size = get_le32(pb);
st->start_time = 0;
if (ast->rate != 0)
st->duration = (int64_t)length * AV_TIME_BASE / ast->rate;
url_fskip(pb, size - 12 * 4);
}
break;
case MKTAG('t', 'x', 't', 's'):
codec_type = CODEC_TYPE_DATA;
url_fskip(pb, size - 8);
break;
case MKTAG('p', 'a', 'd', 's'):
codec_type = CODEC_TYPE_UNKNOWN;
url_fskip(pb, size - 8);
stream_index--;
break;
default:
av_log(s, AV_LOG_ERROR, "unknown stream type %X\n", tag1);
goto fail;
}
break;
case MKTAG('s', 't', 'r', 'f'):
if (stream_index >= s->nb_streams || avi->dv_demux) {
url_fskip(pb, size);
} else {
st = s->streams[stream_index];
switch(codec_type) {
case CODEC_TYPE_VIDEO:
get_le32(pb);
st->codec.width = get_le32(pb);
st->codec.height = get_le32(pb);
get_le16(pb);
st->codec.bits_per_sample= get_le16(pb);
tag1 = get_le32(pb);
get_le32(pb);
get_le32(pb);
get_le32(pb);
get_le32(pb);
get_le32(pb);
if(size > 10*4 && size<(1<<30)){
st->codec.extradata_size= size - 10*4;
st->codec.extradata= av_malloc(st->codec.extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
get_buffer(pb, st->codec.extradata, st->codec.extradata_size);
}
if(st->codec.extradata_size & 1) check if the encoder really did this correctly
get_byte(pb);
if (st->codec.extradata_size && (st->codec.bits_per_sample <= 8)) {
st->codec.palctrl = av_mallocz(sizeof(AVPaletteControl));
#ifdef WORDS_BIGENDIAN
for (i = 0; i < FFMIN(st->codec.extradata_size, AVPALETTE_SIZE)/4; i++)
st->codec.palctrl->palette[i] = bswap_32(((uint32_t*)st->codec.extradata)[i]);
#else
memcpy(st->codec.palctrl->palette, st->codec.extradata,
FFMIN(st->codec.extradata_size, AVPALETTE_SIZE));
#endif
st->codec.palctrl->palette_changed = 1;
}
#ifdef DEBUG
print_tag("video", tag1, 0);
#endif
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec.codec_tag = tag1;
st->codec.codec_id = codec_get_id(codec_bmp_tags, tag1);
if (st->codec.codec_id == CODEC_ID_XAN_WC4)
xan_video = 1;
break;
case CODEC_TYPE_AUDIO:
get_wav_header(pb, &st->codec, size);
if (size%2)
url_fskip(pb, 1);
st->need_parsing = 1;
if (xan_video)
st->codec.codec_id = CODEC_ID_XAN_DPCM;
break;
default:
st->codec.codec_type = CODEC_TYPE_DATA;
st->codec.codec_id= CODEC_ID_NONE;
st->codec.codec_tag= 0;
url_fskip(pb, size);
break;
}
}
break;
default:
size += (size & 1);
url_fskip(pb, size);
break;
}
}
end_of_header:
if (stream_index != s->nb_streams - 1) {
fail:
for(i=0;i<s->nb_streams;i++) {
av_freep(&s->streams[i]->codec.extradata);
av_freep(&s->streams[i]);
}
return -1;
}
assert(!avi->index_loaded);
avi_load_index(s);
avi->index_loaded = 1;
return 0;
}
|
{
"code": [
" st->codec.frame_rate_base * AV_TIME_BASE,"
],
"line_no": [
285
]
}
|
static int FUNC_0(AVFormatContext *VAR_0, AVFormatParameters *VAR_1)
{
AVIContext *avi = VAR_0->priv_data;
ByteIOContext *pb = &VAR_0->pb;
uint32_t tag, tag1, handler;
int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7;
unsigned int VAR_8, VAR_9;
int VAR_10, VAR_11;
AVStream *st;
AVIStream *ast;
int VAR_12 = 0;
if (get_riff(avi, pb) < 0)
return -1;
VAR_3 = -1;
VAR_2 = -1;
VAR_4 = 0;
for(;;) {
if (url_feof(pb))
goto fail;
tag = get_le32(pb);
VAR_8 = get_le32(pb);
#ifdef DEBUG
print_tag("tag", tag, VAR_8);
#endif
switch(tag) {
case MKTAG('L', 'I', 'S', 'T'):
tag1 = get_le32(pb);
#ifdef DEBUG
print_tag("list", tag1, 0);
#endif
if (tag1 == MKTAG('m', 'o', 'v', 'VAR_10')) {
avi->movi_list = url_ftell(pb) - 4;
if(VAR_8) avi->movi_end = avi->movi_list + VAR_8;
else avi->movi_end = url_filesize(url_fileno(pb));
#ifdef DEBUG
printf("movi end=%Lx\VAR_11", avi->movi_end);
#endif
goto end_of_header;
}
break;
case MKTAG('d', 'm', 'l', 'h'):
avi->is_odml = 1;
url_fskip(pb, VAR_8 + (VAR_8 & 1));
break;
case MKTAG('a', 'v', 'VAR_10', 'h'):
VAR_4 = get_le32(pb);
VAR_5 = get_le32(pb) * 8;
url_fskip(pb, 4 * 4);
VAR_11 = get_le32(pb);
for(VAR_10=0;VAR_10<VAR_11;VAR_10++) {
AVIStream *ast;
st = av_new_stream(VAR_0, VAR_10);
if (!st)
goto fail;
ast = av_mallocz(sizeof(AVIStream));
if (!ast)
goto fail;
st->priv_data = ast;
}
url_fskip(pb, VAR_8 - 7 * 4);
break;
case MKTAG('VAR_0', 't', 'r', 'h'):
VAR_3++;
tag1 = get_le32(pb);
handler = get_le32(pb);
#ifdef DEBUG
print_tag("strh", tag1, -1);
#endif
switch(tag1) {
case MKTAG('VAR_10', 'a', 'v', 'VAR_0'):
case MKTAG('VAR_10', 'v', 'a', 'VAR_0'):
if (VAR_0->nb_streams != 1)
goto fail;
if (handler != MKTAG('d', 'v', 'VAR_0', 'd') &&
handler != MKTAG('d', 'v', 'h', 'd') &&
handler != MKTAG('d', 'v', 'VAR_0', 'l'))
goto fail;
ast = VAR_0->streams[0]->priv_data;
av_freep(&VAR_0->streams[0]->codec.extradata);
av_freep(&VAR_0->streams[0]);
VAR_0->nb_streams = 0;
avi->dv_demux = dv_init_demux(VAR_0);
if (!avi->dv_demux)
goto fail;
VAR_0->streams[0]->priv_data = ast;
url_fskip(pb, 3 * 4);
ast->VAR_6 = get_le32(pb);
ast->VAR_7 = get_le32(pb);
VAR_3 = VAR_0->nb_streams - 1;
url_fskip(pb, VAR_8 - 7*4);
break;
case MKTAG('v', 'VAR_10', 'd', 'VAR_0'):
VAR_2 = CODEC_TYPE_VIDEO;
if (VAR_3 >= VAR_0->nb_streams) {
url_fskip(pb, VAR_8 - 8);
break;
}
st = VAR_0->streams[VAR_3];
ast = st->priv_data;
st->codec.stream_codec_tag= handler;
get_le32(pb);
get_le16(pb);
get_le16(pb);
get_le32(pb);
VAR_6 = get_le32(pb);
VAR_7 = get_le32(pb);
if(VAR_6 && VAR_7){
}else if(VAR_4){
VAR_7 = 1000000;
VAR_6 = VAR_4;
}else{
VAR_7 = 25;
VAR_6 = 1;
}
ast->VAR_7 = VAR_7;
ast->VAR_6 = VAR_6;
av_set_pts_info(st, 64, VAR_6, VAR_7);
st->codec.frame_rate = VAR_7;
st->codec.frame_rate_base = VAR_6;
get_le32(pb);
VAR_9 = get_le32(pb);
st->start_time = 0;
st->duration = av_rescale(VAR_9,
st->codec.frame_rate_base * AV_TIME_BASE,
st->codec.frame_rate);
url_fskip(pb, VAR_8 - 9 * 4);
break;
case MKTAG('a', 'u', 'd', 'VAR_0'):
{
unsigned int VAR_13;
VAR_2 = CODEC_TYPE_AUDIO;
if (VAR_3 >= VAR_0->nb_streams) {
url_fskip(pb, VAR_8 - 8);
break;
}
st = VAR_0->streams[VAR_3];
ast = st->priv_data;
get_le32(pb);
get_le16(pb);
get_le16(pb);
get_le32(pb);
ast->VAR_6 = get_le32(pb);
ast->VAR_7 = get_le32(pb);
if(!ast->VAR_7)
ast->VAR_7= 1;
if(!ast->VAR_6)
ast->VAR_6= 1;
av_set_pts_info(st, 64, ast->VAR_6, ast->VAR_7);
ast->start= get_le32(pb);
VAR_13 = get_le32(pb);
get_le32(pb);
get_le32(pb);
ast->sample_size = get_le32(pb);
st->start_time = 0;
if (ast->VAR_7 != 0)
st->duration = (int64_t)VAR_13 * AV_TIME_BASE / ast->VAR_7;
url_fskip(pb, VAR_8 - 12 * 4);
}
break;
case MKTAG('t', 'x', 't', 'VAR_0'):
VAR_2 = CODEC_TYPE_DATA;
url_fskip(pb, VAR_8 - 8);
break;
case MKTAG('p', 'a', 'd', 'VAR_0'):
VAR_2 = CODEC_TYPE_UNKNOWN;
url_fskip(pb, VAR_8 - 8);
VAR_3--;
break;
default:
av_log(VAR_0, AV_LOG_ERROR, "unknown stream type %X\VAR_11", tag1);
goto fail;
}
break;
case MKTAG('VAR_0', 't', 'r', 'f'):
if (VAR_3 >= VAR_0->nb_streams || avi->dv_demux) {
url_fskip(pb, VAR_8);
} else {
st = VAR_0->streams[VAR_3];
switch(VAR_2) {
case CODEC_TYPE_VIDEO:
get_le32(pb);
st->codec.width = get_le32(pb);
st->codec.height = get_le32(pb);
get_le16(pb);
st->codec.bits_per_sample= get_le16(pb);
tag1 = get_le32(pb);
get_le32(pb);
get_le32(pb);
get_le32(pb);
get_le32(pb);
get_le32(pb);
if(VAR_8 > 10*4 && VAR_8<(1<<30)){
st->codec.extradata_size= VAR_8 - 10*4;
st->codec.extradata= av_malloc(st->codec.extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
get_buffer(pb, st->codec.extradata, st->codec.extradata_size);
}
if(st->codec.extradata_size & 1) check if the encoder really did this correctly
get_byte(pb);
if (st->codec.extradata_size && (st->codec.bits_per_sample <= 8)) {
st->codec.palctrl = av_mallocz(sizeof(AVPaletteControl));
#ifdef WORDS_BIGENDIAN
for (VAR_10 = 0; VAR_10 < FFMIN(st->codec.extradata_size, AVPALETTE_SIZE)/4; VAR_10++)
st->codec.palctrl->palette[VAR_10] = bswap_32(((uint32_t*)st->codec.extradata)[VAR_10]);
#else
memcpy(st->codec.palctrl->palette, st->codec.extradata,
FFMIN(st->codec.extradata_size, AVPALETTE_SIZE));
#endif
st->codec.palctrl->palette_changed = 1;
}
#ifdef DEBUG
print_tag("video", tag1, 0);
#endif
st->codec.VAR_2 = CODEC_TYPE_VIDEO;
st->codec.codec_tag = tag1;
st->codec.codec_id = codec_get_id(codec_bmp_tags, tag1);
if (st->codec.codec_id == CODEC_ID_XAN_WC4)
VAR_12 = 1;
break;
case CODEC_TYPE_AUDIO:
get_wav_header(pb, &st->codec, VAR_8);
if (VAR_8%2)
url_fskip(pb, 1);
st->need_parsing = 1;
if (VAR_12)
st->codec.codec_id = CODEC_ID_XAN_DPCM;
break;
default:
st->codec.VAR_2 = CODEC_TYPE_DATA;
st->codec.codec_id= CODEC_ID_NONE;
st->codec.codec_tag= 0;
url_fskip(pb, VAR_8);
break;
}
}
break;
default:
VAR_8 += (VAR_8 & 1);
url_fskip(pb, VAR_8);
break;
}
}
end_of_header:
if (VAR_3 != VAR_0->nb_streams - 1) {
fail:
for(VAR_10=0;VAR_10<VAR_0->nb_streams;VAR_10++) {
av_freep(&VAR_0->streams[VAR_10]->codec.extradata);
av_freep(&VAR_0->streams[VAR_10]);
}
return -1;
}
assert(!avi->index_loaded);
avi_load_index(VAR_0);
avi->index_loaded = 1;
return 0;
}
|
[
"static int FUNC_0(AVFormatContext *VAR_0, AVFormatParameters *VAR_1)\n{",
"AVIContext *avi = VAR_0->priv_data;",
"ByteIOContext *pb = &VAR_0->pb;",
"uint32_t tag, tag1, handler;",
"int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7;",
"unsigned int VAR_8, VAR_9;",
"int VAR_10, VAR_11;",
"AVStream *st;",
"AVIStream *ast;",
"int VAR_12 = 0;",
"if (get_riff(avi, pb) < 0)\nreturn -1;",
"VAR_3 = -1;",
"VAR_2 = -1;",
"VAR_4 = 0;",
"for(;;) {",
"if (url_feof(pb))\ngoto fail;",
"tag = get_le32(pb);",
"VAR_8 = get_le32(pb);",
"#ifdef DEBUG\nprint_tag(\"tag\", tag, VAR_8);",
"#endif\nswitch(tag) {",
"case MKTAG('L', 'I', 'S', 'T'):\ntag1 = get_le32(pb);",
"#ifdef DEBUG\nprint_tag(\"list\", tag1, 0);",
"#endif\nif (tag1 == MKTAG('m', 'o', 'v', 'VAR_10')) {",
"avi->movi_list = url_ftell(pb) - 4;",
"if(VAR_8) avi->movi_end = avi->movi_list + VAR_8;",
"else avi->movi_end = url_filesize(url_fileno(pb));",
"#ifdef DEBUG\nprintf(\"movi end=%Lx\\VAR_11\", avi->movi_end);",
"#endif\ngoto end_of_header;",
"}",
"break;",
"case MKTAG('d', 'm', 'l', 'h'):\navi->is_odml = 1;",
"url_fskip(pb, VAR_8 + (VAR_8 & 1));",
"break;",
"case MKTAG('a', 'v', 'VAR_10', 'h'):\nVAR_4 = get_le32(pb);",
"VAR_5 = get_le32(pb) * 8;",
"url_fskip(pb, 4 * 4);",
"VAR_11 = get_le32(pb);",
"for(VAR_10=0;VAR_10<VAR_11;VAR_10++) {",
"AVIStream *ast;",
"st = av_new_stream(VAR_0, VAR_10);",
"if (!st)\ngoto fail;",
"ast = av_mallocz(sizeof(AVIStream));",
"if (!ast)\ngoto fail;",
"st->priv_data = ast;",
"}",
"url_fskip(pb, VAR_8 - 7 * 4);",
"break;",
"case MKTAG('VAR_0', 't', 'r', 'h'):\nVAR_3++;",
"tag1 = get_le32(pb);",
"handler = get_le32(pb);",
"#ifdef DEBUG\nprint_tag(\"strh\", tag1, -1);",
"#endif\nswitch(tag1) {",
"case MKTAG('VAR_10', 'a', 'v', 'VAR_0'):\ncase MKTAG('VAR_10', 'v', 'a', 'VAR_0'):\nif (VAR_0->nb_streams != 1)\ngoto fail;",
"if (handler != MKTAG('d', 'v', 'VAR_0', 'd') &&\nhandler != MKTAG('d', 'v', 'h', 'd') &&\nhandler != MKTAG('d', 'v', 'VAR_0', 'l'))\ngoto fail;",
"ast = VAR_0->streams[0]->priv_data;",
"av_freep(&VAR_0->streams[0]->codec.extradata);",
"av_freep(&VAR_0->streams[0]);",
"VAR_0->nb_streams = 0;",
"avi->dv_demux = dv_init_demux(VAR_0);",
"if (!avi->dv_demux)\ngoto fail;",
"VAR_0->streams[0]->priv_data = ast;",
"url_fskip(pb, 3 * 4);",
"ast->VAR_6 = get_le32(pb);",
"ast->VAR_7 = get_le32(pb);",
"VAR_3 = VAR_0->nb_streams - 1;",
"url_fskip(pb, VAR_8 - 7*4);",
"break;",
"case MKTAG('v', 'VAR_10', 'd', 'VAR_0'):\nVAR_2 = CODEC_TYPE_VIDEO;",
"if (VAR_3 >= VAR_0->nb_streams) {",
"url_fskip(pb, VAR_8 - 8);",
"break;",
"}",
"st = VAR_0->streams[VAR_3];",
"ast = st->priv_data;",
"st->codec.stream_codec_tag= handler;",
"get_le32(pb);",
"get_le16(pb);",
"get_le16(pb);",
"get_le32(pb);",
"VAR_6 = get_le32(pb);",
"VAR_7 = get_le32(pb);",
"if(VAR_6 && VAR_7){",
"}else if(VAR_4){",
"VAR_7 = 1000000;",
"VAR_6 = VAR_4;",
"}else{",
"VAR_7 = 25;",
"VAR_6 = 1;",
"}",
"ast->VAR_7 = VAR_7;",
"ast->VAR_6 = VAR_6;",
"av_set_pts_info(st, 64, VAR_6, VAR_7);",
"st->codec.frame_rate = VAR_7;",
"st->codec.frame_rate_base = VAR_6;",
"get_le32(pb);",
"VAR_9 = get_le32(pb);",
"st->start_time = 0;",
"st->duration = av_rescale(VAR_9,\nst->codec.frame_rate_base * AV_TIME_BASE,\nst->codec.frame_rate);",
"url_fskip(pb, VAR_8 - 9 * 4);",
"break;",
"case MKTAG('a', 'u', 'd', 'VAR_0'):\n{",
"unsigned int VAR_13;",
"VAR_2 = CODEC_TYPE_AUDIO;",
"if (VAR_3 >= VAR_0->nb_streams) {",
"url_fskip(pb, VAR_8 - 8);",
"break;",
"}",
"st = VAR_0->streams[VAR_3];",
"ast = st->priv_data;",
"get_le32(pb);",
"get_le16(pb);",
"get_le16(pb);",
"get_le32(pb);",
"ast->VAR_6 = get_le32(pb);",
"ast->VAR_7 = get_le32(pb);",
"if(!ast->VAR_7)\nast->VAR_7= 1;",
"if(!ast->VAR_6)\nast->VAR_6= 1;",
"av_set_pts_info(st, 64, ast->VAR_6, ast->VAR_7);",
"ast->start= get_le32(pb);",
"VAR_13 = get_le32(pb);",
"get_le32(pb);",
"get_le32(pb);",
"ast->sample_size = get_le32(pb);",
"st->start_time = 0;",
"if (ast->VAR_7 != 0)\nst->duration = (int64_t)VAR_13 * AV_TIME_BASE / ast->VAR_7;",
"url_fskip(pb, VAR_8 - 12 * 4);",
"}",
"break;",
"case MKTAG('t', 'x', 't', 'VAR_0'):\nVAR_2 = CODEC_TYPE_DATA;",
"url_fskip(pb, VAR_8 - 8);",
"break;",
"case MKTAG('p', 'a', 'd', 'VAR_0'):\nVAR_2 = CODEC_TYPE_UNKNOWN;",
"url_fskip(pb, VAR_8 - 8);",
"VAR_3--;",
"break;",
"default:\nav_log(VAR_0, AV_LOG_ERROR, \"unknown stream type %X\\VAR_11\", tag1);",
"goto fail;",
"}",
"break;",
"case MKTAG('VAR_0', 't', 'r', 'f'):\nif (VAR_3 >= VAR_0->nb_streams || avi->dv_demux) {",
"url_fskip(pb, VAR_8);",
"} else {",
"st = VAR_0->streams[VAR_3];",
"switch(VAR_2) {",
"case CODEC_TYPE_VIDEO:\nget_le32(pb);",
"st->codec.width = get_le32(pb);",
"st->codec.height = get_le32(pb);",
"get_le16(pb);",
"st->codec.bits_per_sample= get_le16(pb);",
"tag1 = get_le32(pb);",
"get_le32(pb);",
"get_le32(pb);",
"get_le32(pb);",
"get_le32(pb);",
"get_le32(pb);",
"if(VAR_8 > 10*4 && VAR_8<(1<<30)){",
"st->codec.extradata_size= VAR_8 - 10*4;",
"st->codec.extradata= av_malloc(st->codec.extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);",
"get_buffer(pb, st->codec.extradata, st->codec.extradata_size);",
"}",
"if(st->codec.extradata_size & 1) check if the encoder really did this correctly\nget_byte(pb);",
"if (st->codec.extradata_size && (st->codec.bits_per_sample <= 8)) {",
"st->codec.palctrl = av_mallocz(sizeof(AVPaletteControl));",
"#ifdef WORDS_BIGENDIAN\nfor (VAR_10 = 0; VAR_10 < FFMIN(st->codec.extradata_size, AVPALETTE_SIZE)/4; VAR_10++)",
"st->codec.palctrl->palette[VAR_10] = bswap_32(((uint32_t*)st->codec.extradata)[VAR_10]);",
"#else\nmemcpy(st->codec.palctrl->palette, st->codec.extradata,\nFFMIN(st->codec.extradata_size, AVPALETTE_SIZE));",
"#endif\nst->codec.palctrl->palette_changed = 1;",
"}",
"#ifdef DEBUG\nprint_tag(\"video\", tag1, 0);",
"#endif\nst->codec.VAR_2 = CODEC_TYPE_VIDEO;",
"st->codec.codec_tag = tag1;",
"st->codec.codec_id = codec_get_id(codec_bmp_tags, tag1);",
"if (st->codec.codec_id == CODEC_ID_XAN_WC4)\nVAR_12 = 1;",
"break;",
"case CODEC_TYPE_AUDIO:\nget_wav_header(pb, &st->codec, VAR_8);",
"if (VAR_8%2)\nurl_fskip(pb, 1);",
"st->need_parsing = 1;",
"if (VAR_12)\nst->codec.codec_id = CODEC_ID_XAN_DPCM;",
"break;",
"default:\nst->codec.VAR_2 = CODEC_TYPE_DATA;",
"st->codec.codec_id= CODEC_ID_NONE;",
"st->codec.codec_tag= 0;",
"url_fskip(pb, VAR_8);",
"break;",
"}",
"}",
"break;",
"default:\nVAR_8 += (VAR_8 & 1);",
"url_fskip(pb, VAR_8);",
"break;",
"}",
"}",
"end_of_header:\nif (VAR_3 != VAR_0->nb_streams - 1) {",
"fail:\nfor(VAR_10=0;VAR_10<VAR_0->nb_streams;VAR_10++) {",
"av_freep(&VAR_0->streams[VAR_10]->codec.extradata);",
"av_freep(&VAR_0->streams[VAR_10]);",
"}",
"return -1;",
"}",
"assert(!avi->index_loaded);",
"avi_load_index(VAR_0);",
"avi->index_loaded = 1;",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
25,
27
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41,
43
],
[
45
],
[
47
],
[
49,
51
],
[
53,
57
],
[
59,
63
],
[
65,
67
],
[
69,
71
],
[
73
],
[
75
],
[
77
],
[
79,
81
],
[
83,
85
],
[
87
],
[
89
],
[
91,
93
],
[
95
],
[
97
],
[
99,
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119,
121
],
[
125
],
[
127,
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139,
143
],
[
145
],
[
147
],
[
149,
151
],
[
153,
155
],
[
157,
159,
169,
171
],
[
175,
177,
179,
181
],
[
185
],
[
187
],
[
189
],
[
191
],
[
193
],
[
195,
197
],
[
199
],
[
201
],
[
203
],
[
205
],
[
207
],
[
209
],
[
211
],
[
213,
215
],
[
219
],
[
221
],
[
223
],
[
225
],
[
229
],
[
231
],
[
233
],
[
237
],
[
239
],
[
241
],
[
243
],
[
245
],
[
247
],
[
251
],
[
253
],
[
255
],
[
257
],
[
259
],
[
261
],
[
263
],
[
265
],
[
267
],
[
269
],
[
271
],
[
273
],
[
275
],
[
277
],
[
279
],
[
281
],
[
283,
285,
287
],
[
289
],
[
291
],
[
293,
295
],
[
297
],
[
301
],
[
305
],
[
307
],
[
309
],
[
311
],
[
313
],
[
315
],
[
319
],
[
321
],
[
323
],
[
325
],
[
327
],
[
329
],
[
331,
333
],
[
335,
337
],
[
339
],
[
341
],
[
343
],
[
345
],
[
347
],
[
349
],
[
353
],
[
355,
357
],
[
359
],
[
361
],
[
363
],
[
365,
369
],
[
371
],
[
373
],
[
375,
377
],
[
379
],
[
381
],
[
383
],
[
385,
387
],
[
389
],
[
391
],
[
393
],
[
395,
399
],
[
401
],
[
403
],
[
405
],
[
407
],
[
409,
411
],
[
413
],
[
415
],
[
417
],
[
419
],
[
421
],
[
423
],
[
425
],
[
427
],
[
429
],
[
431
],
[
435
],
[
437
],
[
439
],
[
441
],
[
443
],
[
447,
449
],
[
459
],
[
461
],
[
463,
465
],
[
467
],
[
469,
471,
473
],
[
475,
477
],
[
479
],
[
483,
485
],
[
487,
489
],
[
491
],
[
493
],
[
495,
497
],
[
501
],
[
503,
505
],
[
507,
509
],
[
515
],
[
521,
523
],
[
525
],
[
527,
529
],
[
531
],
[
533
],
[
535
],
[
537
],
[
539
],
[
541
],
[
543
],
[
545,
549
],
[
551
],
[
553
],
[
555
],
[
557
],
[
559,
563
],
[
565,
567
],
[
569
],
[
571
],
[
573
],
[
575
],
[
577
],
[
581
],
[
583
],
[
585
],
[
589
],
[
591
]
] |
6,382 |
static void test_io(void)
{
#ifndef _WIN32
/* socketpair(PF_UNIX) which does not exist on windows */
int sv[2];
int r;
unsigned i, j, k, s, t;
fd_set fds;
unsigned niov;
struct iovec *iov, *siov;
unsigned char *buf;
size_t sz;
iov_random(&iov, &niov);
sz = iov_size(iov, niov);
buf = g_malloc(sz);
for (i = 0; i < sz; ++i) {
buf[i] = i & 255;
}
iov_from_buf(iov, niov, 0, buf, sz);
siov = g_malloc(sizeof(*iov) * niov);
memcpy(siov, iov, sizeof(*iov) * niov);
if (socketpair(PF_UNIX, SOCK_STREAM, 0, sv) < 0) {
perror("socketpair");
exit(1);
}
FD_ZERO(&fds);
t = 0;
if (fork() == 0) {
/* writer */
close(sv[0]);
FD_SET(sv[1], &fds);
fcntl(sv[1], F_SETFL, O_RDWR|O_NONBLOCK);
r = g_test_rand_int_range(sz / 2, sz);
setsockopt(sv[1], SOL_SOCKET, SO_SNDBUF, &r, sizeof(r));
for (i = 0; i <= sz; ++i) {
for (j = i; j <= sz; ++j) {
k = i;
do {
s = g_test_rand_int_range(0, j - k + 1);
r = iov_send(sv[1], iov, niov, k, s);
g_assert(memcmp(iov, siov, sizeof(*iov)*niov) == 0);
if (r >= 0) {
k += r;
t += r;
usleep(g_test_rand_int_range(0, 30));
} else if (errno == EAGAIN) {
select(sv[1]+1, NULL, &fds, NULL, NULL);
continue;
} else {
perror("send");
exit(1);
}
} while(k < j);
}
}
exit(0);
} else {
/* reader & verifier */
close(sv[1]);
FD_SET(sv[0], &fds);
fcntl(sv[0], F_SETFL, O_RDWR|O_NONBLOCK);
r = g_test_rand_int_range(sz / 2, sz);
setsockopt(sv[0], SOL_SOCKET, SO_RCVBUF, &r, sizeof(r));
usleep(500000);
for (i = 0; i <= sz; ++i) {
for (j = i; j <= sz; ++j) {
k = i;
iov_memset(iov, niov, 0, 0xff, -1);
do {
s = g_test_rand_int_range(0, j - k + 1);
r = iov_recv(sv[0], iov, niov, k, s);
g_assert(memcmp(iov, siov, sizeof(*iov)*niov) == 0);
if (r > 0) {
k += r;
t += r;
} else if (!r) {
if (s) {
break;
}
} else if (errno == EAGAIN) {
select(sv[0]+1, &fds, NULL, NULL, NULL);
continue;
} else {
perror("recv");
exit(1);
}
} while(k < j);
test_iov_bytes(iov, niov, i, j - i);
}
}
}
#endif
}
| true |
qemu
|
d55f295b2b5477528da601dba57880b0d5f24cb1
|
static void test_io(void)
{
#ifndef _WIN32
int sv[2];
int r;
unsigned i, j, k, s, t;
fd_set fds;
unsigned niov;
struct iovec *iov, *siov;
unsigned char *buf;
size_t sz;
iov_random(&iov, &niov);
sz = iov_size(iov, niov);
buf = g_malloc(sz);
for (i = 0; i < sz; ++i) {
buf[i] = i & 255;
}
iov_from_buf(iov, niov, 0, buf, sz);
siov = g_malloc(sizeof(*iov) * niov);
memcpy(siov, iov, sizeof(*iov) * niov);
if (socketpair(PF_UNIX, SOCK_STREAM, 0, sv) < 0) {
perror("socketpair");
exit(1);
}
FD_ZERO(&fds);
t = 0;
if (fork() == 0) {
close(sv[0]);
FD_SET(sv[1], &fds);
fcntl(sv[1], F_SETFL, O_RDWR|O_NONBLOCK);
r = g_test_rand_int_range(sz / 2, sz);
setsockopt(sv[1], SOL_SOCKET, SO_SNDBUF, &r, sizeof(r));
for (i = 0; i <= sz; ++i) {
for (j = i; j <= sz; ++j) {
k = i;
do {
s = g_test_rand_int_range(0, j - k + 1);
r = iov_send(sv[1], iov, niov, k, s);
g_assert(memcmp(iov, siov, sizeof(*iov)*niov) == 0);
if (r >= 0) {
k += r;
t += r;
usleep(g_test_rand_int_range(0, 30));
} else if (errno == EAGAIN) {
select(sv[1]+1, NULL, &fds, NULL, NULL);
continue;
} else {
perror("send");
exit(1);
}
} while(k < j);
}
}
exit(0);
} else {
close(sv[1]);
FD_SET(sv[0], &fds);
fcntl(sv[0], F_SETFL, O_RDWR|O_NONBLOCK);
r = g_test_rand_int_range(sz / 2, sz);
setsockopt(sv[0], SOL_SOCKET, SO_RCVBUF, &r, sizeof(r));
usleep(500000);
for (i = 0; i <= sz; ++i) {
for (j = i; j <= sz; ++j) {
k = i;
iov_memset(iov, niov, 0, 0xff, -1);
do {
s = g_test_rand_int_range(0, j - k + 1);
r = iov_recv(sv[0], iov, niov, k, s);
g_assert(memcmp(iov, siov, sizeof(*iov)*niov) == 0);
if (r > 0) {
k += r;
t += r;
} else if (!r) {
if (s) {
break;
}
} else if (errno == EAGAIN) {
select(sv[0]+1, &fds, NULL, NULL, NULL);
continue;
} else {
perror("recv");
exit(1);
}
} while(k < j);
test_iov_bytes(iov, niov, i, j - i);
}
}
}
#endif
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(void)
{
#ifndef _WIN32
int VAR_0[2];
int VAR_1;
unsigned VAR_2, VAR_3, VAR_4, VAR_5, VAR_6;
fd_set fds;
unsigned VAR_7;
struct iovec *VAR_8, *VAR_9;
unsigned char *VAR_10;
size_t sz;
iov_random(&VAR_8, &VAR_7);
sz = iov_size(VAR_8, VAR_7);
VAR_10 = g_malloc(sz);
for (VAR_2 = 0; VAR_2 < sz; ++VAR_2) {
VAR_10[VAR_2] = VAR_2 & 255;
}
iov_from_buf(VAR_8, VAR_7, 0, VAR_10, sz);
VAR_9 = g_malloc(sizeof(*VAR_8) * VAR_7);
memcpy(VAR_9, VAR_8, sizeof(*VAR_8) * VAR_7);
if (socketpair(PF_UNIX, SOCK_STREAM, 0, VAR_0) < 0) {
perror("socketpair");
exit(1);
}
FD_ZERO(&fds);
VAR_6 = 0;
if (fork() == 0) {
close(VAR_0[0]);
FD_SET(VAR_0[1], &fds);
fcntl(VAR_0[1], F_SETFL, O_RDWR|O_NONBLOCK);
VAR_1 = g_test_rand_int_range(sz / 2, sz);
setsockopt(VAR_0[1], SOL_SOCKET, SO_SNDBUF, &VAR_1, sizeof(VAR_1));
for (VAR_2 = 0; VAR_2 <= sz; ++VAR_2) {
for (VAR_3 = VAR_2; VAR_3 <= sz; ++VAR_3) {
VAR_4 = VAR_2;
do {
VAR_5 = g_test_rand_int_range(0, VAR_3 - VAR_4 + 1);
VAR_1 = iov_send(VAR_0[1], VAR_8, VAR_7, VAR_4, VAR_5);
g_assert(memcmp(VAR_8, VAR_9, sizeof(*VAR_8)*VAR_7) == 0);
if (VAR_1 >= 0) {
VAR_4 += VAR_1;
VAR_6 += VAR_1;
usleep(g_test_rand_int_range(0, 30));
} else if (errno == EAGAIN) {
select(VAR_0[1]+1, NULL, &fds, NULL, NULL);
continue;
} else {
perror("send");
exit(1);
}
} while(VAR_4 < VAR_3);
}
}
exit(0);
} else {
close(VAR_0[1]);
FD_SET(VAR_0[0], &fds);
fcntl(VAR_0[0], F_SETFL, O_RDWR|O_NONBLOCK);
VAR_1 = g_test_rand_int_range(sz / 2, sz);
setsockopt(VAR_0[0], SOL_SOCKET, SO_RCVBUF, &VAR_1, sizeof(VAR_1));
usleep(500000);
for (VAR_2 = 0; VAR_2 <= sz; ++VAR_2) {
for (VAR_3 = VAR_2; VAR_3 <= sz; ++VAR_3) {
VAR_4 = VAR_2;
iov_memset(VAR_8, VAR_7, 0, 0xff, -1);
do {
VAR_5 = g_test_rand_int_range(0, VAR_3 - VAR_4 + 1);
VAR_1 = iov_recv(VAR_0[0], VAR_8, VAR_7, VAR_4, VAR_5);
g_assert(memcmp(VAR_8, VAR_9, sizeof(*VAR_8)*VAR_7) == 0);
if (VAR_1 > 0) {
VAR_4 += VAR_1;
VAR_6 += VAR_1;
} else if (!VAR_1) {
if (VAR_5) {
break;
}
} else if (errno == EAGAIN) {
select(VAR_0[0]+1, &fds, NULL, NULL, NULL);
continue;
} else {
perror("recv");
exit(1);
}
} while(VAR_4 < VAR_3);
test_iov_bytes(VAR_8, VAR_7, VAR_2, VAR_3 - VAR_2);
}
}
}
#endif
}
|
[
"static void FUNC_0(void)\n{",
"#ifndef _WIN32\nint VAR_0[2];",
"int VAR_1;",
"unsigned VAR_2, VAR_3, VAR_4, VAR_5, VAR_6;",
"fd_set fds;",
"unsigned VAR_7;",
"struct iovec *VAR_8, *VAR_9;",
"unsigned char *VAR_10;",
"size_t sz;",
"iov_random(&VAR_8, &VAR_7);",
"sz = iov_size(VAR_8, VAR_7);",
"VAR_10 = g_malloc(sz);",
"for (VAR_2 = 0; VAR_2 < sz; ++VAR_2) {",
"VAR_10[VAR_2] = VAR_2 & 255;",
"}",
"iov_from_buf(VAR_8, VAR_7, 0, VAR_10, sz);",
"VAR_9 = g_malloc(sizeof(*VAR_8) * VAR_7);",
"memcpy(VAR_9, VAR_8, sizeof(*VAR_8) * VAR_7);",
"if (socketpair(PF_UNIX, SOCK_STREAM, 0, VAR_0) < 0) {",
"perror(\"socketpair\");",
"exit(1);",
"}",
"FD_ZERO(&fds);",
"VAR_6 = 0;",
"if (fork() == 0) {",
"close(VAR_0[0]);",
"FD_SET(VAR_0[1], &fds);",
"fcntl(VAR_0[1], F_SETFL, O_RDWR|O_NONBLOCK);",
"VAR_1 = g_test_rand_int_range(sz / 2, sz);",
"setsockopt(VAR_0[1], SOL_SOCKET, SO_SNDBUF, &VAR_1, sizeof(VAR_1));",
"for (VAR_2 = 0; VAR_2 <= sz; ++VAR_2) {",
"for (VAR_3 = VAR_2; VAR_3 <= sz; ++VAR_3) {",
"VAR_4 = VAR_2;",
"do {",
"VAR_5 = g_test_rand_int_range(0, VAR_3 - VAR_4 + 1);",
"VAR_1 = iov_send(VAR_0[1], VAR_8, VAR_7, VAR_4, VAR_5);",
"g_assert(memcmp(VAR_8, VAR_9, sizeof(*VAR_8)*VAR_7) == 0);",
"if (VAR_1 >= 0) {",
"VAR_4 += VAR_1;",
"VAR_6 += VAR_1;",
"usleep(g_test_rand_int_range(0, 30));",
"} else if (errno == EAGAIN) {",
"select(VAR_0[1]+1, NULL, &fds, NULL, NULL);",
"continue;",
"} else {",
"perror(\"send\");",
"exit(1);",
"}",
"} while(VAR_4 < VAR_3);",
"}",
"}",
"exit(0);",
"} else {",
"close(VAR_0[1]);",
"FD_SET(VAR_0[0], &fds);",
"fcntl(VAR_0[0], F_SETFL, O_RDWR|O_NONBLOCK);",
"VAR_1 = g_test_rand_int_range(sz / 2, sz);",
"setsockopt(VAR_0[0], SOL_SOCKET, SO_RCVBUF, &VAR_1, sizeof(VAR_1));",
"usleep(500000);",
"for (VAR_2 = 0; VAR_2 <= sz; ++VAR_2) {",
"for (VAR_3 = VAR_2; VAR_3 <= sz; ++VAR_3) {",
"VAR_4 = VAR_2;",
"iov_memset(VAR_8, VAR_7, 0, 0xff, -1);",
"do {",
"VAR_5 = g_test_rand_int_range(0, VAR_3 - VAR_4 + 1);",
"VAR_1 = iov_recv(VAR_0[0], VAR_8, VAR_7, VAR_4, VAR_5);",
"g_assert(memcmp(VAR_8, VAR_9, sizeof(*VAR_8)*VAR_7) == 0);",
"if (VAR_1 > 0) {",
"VAR_4 += VAR_1;",
"VAR_6 += VAR_1;",
"} else if (!VAR_1) {",
"if (VAR_5) {",
"break;",
"}",
"} else if (errno == EAGAIN) {",
"select(VAR_0[0]+1, &fds, NULL, NULL, NULL);",
"continue;",
"} else {",
"perror(\"recv\");",
"exit(1);",
"}",
"} while(VAR_4 < VAR_3);",
"test_iov_bytes(VAR_8, VAR_7, VAR_2, VAR_3 - VAR_2);",
"}",
"}",
"}",
"#endif\n}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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,
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
45
],
[
47
],
[
51
],
[
53
],
[
55
],
[
57
],
[
61
],
[
65
],
[
67
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
130
],
[
134
],
[
140
],
[
142
],
[
144
],
[
146
],
[
148
],
[
150
],
[
154
],
[
156
],
[
158
],
[
160
],
[
162
],
[
164
],
[
166
],
[
168
],
[
170
],
[
172
],
[
174
],
[
176
],
[
178
],
[
180
],
[
182
],
[
184
],
[
186
],
[
188
],
[
190
],
[
192
],
[
194
],
[
196
],
[
198
],
[
200
],
[
202
],
[
204
],
[
211
],
[
213,
215
]
] |
6,383 |
static int jpeg2000_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame, AVPacket *avpkt)
{
Jpeg2000DecoderContext *s = avctx->priv_data;
ThreadFrame frame = { .f = data };
AVFrame *picture = data;
int tileno, ret;
s->avctx = avctx;
s->buf = s->buf_start = avpkt->data;
s->buf_end = s->buf_start + avpkt->size;
s->curtileno = 0; // TODO: only one tile in DCI JP2K. to implement for more tiles
// reduction factor, i.e number of resolution levels to skip
s->reduction_factor = s->lowres;
if (s->buf_end - s->buf < 2)
return AVERROR_INVALIDDATA;
// check if the image is in jp2 format
if ((AV_RB32(s->buf) == 12) &&
(AV_RB32(s->buf + 4) == JP2_SIG_TYPE) &&
(AV_RB32(s->buf + 8) == JP2_SIG_VALUE)) {
if (!jp2_find_codestream(s)) {
av_log(avctx, AV_LOG_ERROR,
"Could not find Jpeg2000 codestream atom.\n");
return AVERROR_INVALIDDATA;
}
}
if (bytestream_get_be16(&s->buf) != JPEG2000_SOC) {
av_log(avctx, AV_LOG_ERROR, "SOC marker not present\n");
return AVERROR_INVALIDDATA;
}
if (ret = jpeg2000_read_main_headers(s))
goto end;
/* get picture buffer */
if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) {
av_log(avctx, AV_LOG_ERROR, "ff_thread_get_buffer() failed.\n");
goto end;
}
picture->pict_type = AV_PICTURE_TYPE_I;
picture->key_frame = 1;
if (ret = jpeg2000_read_bitstream_packets(s))
goto end;
for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++)
if (ret = jpeg2000_decode_tile(s, s->tile + tileno, picture))
goto end;
*got_frame = 1;
end:
jpeg2000_dec_cleanup(s);
return ret ? ret : s->buf - s->buf_start;
}
| true |
FFmpeg
|
1a3598aae768465a8efc8475b6df5a8261bc62fc
|
static int jpeg2000_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame, AVPacket *avpkt)
{
Jpeg2000DecoderContext *s = avctx->priv_data;
ThreadFrame frame = { .f = data };
AVFrame *picture = data;
int tileno, ret;
s->avctx = avctx;
s->buf = s->buf_start = avpkt->data;
s->buf_end = s->buf_start + avpkt->size;
s->curtileno = 0;
s->reduction_factor = s->lowres;
if (s->buf_end - s->buf < 2)
return AVERROR_INVALIDDATA;
if ((AV_RB32(s->buf) == 12) &&
(AV_RB32(s->buf + 4) == JP2_SIG_TYPE) &&
(AV_RB32(s->buf + 8) == JP2_SIG_VALUE)) {
if (!jp2_find_codestream(s)) {
av_log(avctx, AV_LOG_ERROR,
"Could not find Jpeg2000 codestream atom.\n");
return AVERROR_INVALIDDATA;
}
}
if (bytestream_get_be16(&s->buf) != JPEG2000_SOC) {
av_log(avctx, AV_LOG_ERROR, "SOC marker not present\n");
return AVERROR_INVALIDDATA;
}
if (ret = jpeg2000_read_main_headers(s))
goto end;
if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) {
av_log(avctx, AV_LOG_ERROR, "ff_thread_get_buffer() failed.\n");
goto end;
}
picture->pict_type = AV_PICTURE_TYPE_I;
picture->key_frame = 1;
if (ret = jpeg2000_read_bitstream_packets(s))
goto end;
for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++)
if (ret = jpeg2000_decode_tile(s, s->tile + tileno, picture))
goto end;
*got_frame = 1;
end:
jpeg2000_dec_cleanup(s);
return ret ? ret : s->buf - s->buf_start;
}
|
{
"code": [
" return AVERROR_INVALIDDATA;",
" if (s->buf_end - s->buf < 2)",
" s->buf = s->buf_start = avpkt->data;",
" s->buf_end = s->buf_start + avpkt->size;",
" if (s->buf_end - s->buf < 2)",
" if ((AV_RB32(s->buf) == 12) &&",
" (AV_RB32(s->buf + 4) == JP2_SIG_TYPE) &&",
" (AV_RB32(s->buf + 8) == JP2_SIG_VALUE)) {",
" if (bytestream_get_be16(&s->buf) != JPEG2000_SOC) {",
" return ret ? ret : s->buf - s->buf_start;"
],
"line_no": [
35,
33,
19,
21,
33,
41,
43,
45,
61,
111
]
}
|
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,
int *VAR_2, AVPacket *VAR_3)
{
Jpeg2000DecoderContext *s = VAR_0->priv_data;
ThreadFrame frame = { .f = VAR_1 };
AVFrame *picture = VAR_1;
int VAR_4, VAR_5;
s->VAR_0 = VAR_0;
s->buf = s->buf_start = VAR_3->VAR_1;
s->buf_end = s->buf_start + VAR_3->size;
s->curtileno = 0;
s->reduction_factor = s->lowres;
if (s->buf_end - s->buf < 2)
return AVERROR_INVALIDDATA;
if ((AV_RB32(s->buf) == 12) &&
(AV_RB32(s->buf + 4) == JP2_SIG_TYPE) &&
(AV_RB32(s->buf + 8) == JP2_SIG_VALUE)) {
if (!jp2_find_codestream(s)) {
av_log(VAR_0, AV_LOG_ERROR,
"Could not find Jpeg2000 codestream atom.\n");
return AVERROR_INVALIDDATA;
}
}
if (bytestream_get_be16(&s->buf) != JPEG2000_SOC) {
av_log(VAR_0, AV_LOG_ERROR, "SOC marker not present\n");
return AVERROR_INVALIDDATA;
}
if (VAR_5 = jpeg2000_read_main_headers(s))
goto end;
if ((VAR_5 = ff_thread_get_buffer(VAR_0, &frame, 0)) < 0) {
av_log(VAR_0, AV_LOG_ERROR, "ff_thread_get_buffer() failed.\n");
goto end;
}
picture->pict_type = AV_PICTURE_TYPE_I;
picture->key_frame = 1;
if (VAR_5 = jpeg2000_read_bitstream_packets(s))
goto end;
for (VAR_4 = 0; VAR_4 < s->numXtiles * s->numYtiles; VAR_4++)
if (VAR_5 = jpeg2000_decode_tile(s, s->tile + VAR_4, picture))
goto end;
*VAR_2 = 1;
end:
jpeg2000_dec_cleanup(s);
return VAR_5 ? VAR_5 : s->buf - s->buf_start;
}
|
[
"static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{",
"Jpeg2000DecoderContext *s = VAR_0->priv_data;",
"ThreadFrame frame = { .f = VAR_1 };",
"AVFrame *picture = VAR_1;",
"int VAR_4, VAR_5;",
"s->VAR_0 = VAR_0;",
"s->buf = s->buf_start = VAR_3->VAR_1;",
"s->buf_end = s->buf_start + VAR_3->size;",
"s->curtileno = 0;",
"s->reduction_factor = s->lowres;",
"if (s->buf_end - s->buf < 2)\nreturn AVERROR_INVALIDDATA;",
"if ((AV_RB32(s->buf) == 12) &&\n(AV_RB32(s->buf + 4) == JP2_SIG_TYPE) &&\n(AV_RB32(s->buf + 8) == JP2_SIG_VALUE)) {",
"if (!jp2_find_codestream(s)) {",
"av_log(VAR_0, AV_LOG_ERROR,\n\"Could not find Jpeg2000 codestream atom.\\n\");",
"return AVERROR_INVALIDDATA;",
"}",
"}",
"if (bytestream_get_be16(&s->buf) != JPEG2000_SOC) {",
"av_log(VAR_0, AV_LOG_ERROR, \"SOC marker not present\\n\");",
"return AVERROR_INVALIDDATA;",
"}",
"if (VAR_5 = jpeg2000_read_main_headers(s))\ngoto end;",
"if ((VAR_5 = ff_thread_get_buffer(VAR_0, &frame, 0)) < 0) {",
"av_log(VAR_0, AV_LOG_ERROR, \"ff_thread_get_buffer() failed.\\n\");",
"goto end;",
"}",
"picture->pict_type = AV_PICTURE_TYPE_I;",
"picture->key_frame = 1;",
"if (VAR_5 = jpeg2000_read_bitstream_packets(s))\ngoto end;",
"for (VAR_4 = 0; VAR_4 < s->numXtiles * s->numYtiles; VAR_4++)",
"if (VAR_5 = jpeg2000_decode_tile(s, s->tile + VAR_4, picture))\ngoto end;",
"*VAR_2 = 1;",
"end:\njpeg2000_dec_cleanup(s);",
"return VAR_5 ? VAR_5 : s->buf - s->buf_start;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
1,
1,
0,
0,
1,
1,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
19
],
[
21
],
[
23
],
[
29
],
[
33,
35
],
[
41,
43,
45
],
[
47
],
[
49,
51
],
[
53
],
[
55
],
[
57
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69,
71
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
91,
93
],
[
95
],
[
97,
99
],
[
103
],
[
107,
109
],
[
111
],
[
113
]
] |
6,384 |
static HotpluggableCPUList *spapr_query_hotpluggable_cpus(MachineState *machine)
{
int i;
HotpluggableCPUList *head = NULL;
sPAPRMachineState *spapr = SPAPR_MACHINE(machine);
sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine);
int spapr_max_cores = max_cpus / smp_threads;
g_assert(smc->dr_cpu_enabled);
for (i = 0; i < spapr_max_cores; i++) {
HotpluggableCPUList *list_item = g_new0(typeof(*list_item), 1);
HotpluggableCPU *cpu_item = g_new0(typeof(*cpu_item), 1);
CpuInstanceProperties *cpu_props = g_new0(typeof(*cpu_props), 1);
cpu_item->type = spapr_get_cpu_core_type(machine->cpu_model);
cpu_item->vcpus_count = smp_threads;
cpu_props->has_core_id = true;
cpu_props->core_id = i * smp_threads;
/* TODO: add 'has_node/node' here to describe
to which node core belongs */
cpu_item->props = cpu_props;
if (spapr->cores[i]) {
cpu_item->has_qom_path = true;
cpu_item->qom_path = object_get_canonical_path(spapr->cores[i]);
}
list_item->value = cpu_item;
list_item->next = head;
head = list_item;
}
return head;
}
| true |
qemu
|
3c0c47e3464f3c54bd3f1cc6d4da2cbf7465e295
|
static HotpluggableCPUList *spapr_query_hotpluggable_cpus(MachineState *machine)
{
int i;
HotpluggableCPUList *head = NULL;
sPAPRMachineState *spapr = SPAPR_MACHINE(machine);
sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine);
int spapr_max_cores = max_cpus / smp_threads;
g_assert(smc->dr_cpu_enabled);
for (i = 0; i < spapr_max_cores; i++) {
HotpluggableCPUList *list_item = g_new0(typeof(*list_item), 1);
HotpluggableCPU *cpu_item = g_new0(typeof(*cpu_item), 1);
CpuInstanceProperties *cpu_props = g_new0(typeof(*cpu_props), 1);
cpu_item->type = spapr_get_cpu_core_type(machine->cpu_model);
cpu_item->vcpus_count = smp_threads;
cpu_props->has_core_id = true;
cpu_props->core_id = i * smp_threads;
cpu_item->props = cpu_props;
if (spapr->cores[i]) {
cpu_item->has_qom_path = true;
cpu_item->qom_path = object_get_canonical_path(spapr->cores[i]);
}
list_item->value = cpu_item;
list_item->next = head;
head = list_item;
}
return head;
}
|
{
"code": [
" sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine);",
" g_assert(smc->dr_cpu_enabled);",
" g_assert(smc->dr_cpu_enabled);"
],
"line_no": [
11,
17,
17
]
}
|
static HotpluggableCPUList *FUNC_0(MachineState *machine)
{
int VAR_0;
HotpluggableCPUList *head = NULL;
sPAPRMachineState *spapr = SPAPR_MACHINE(machine);
sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine);
int VAR_1 = max_cpus / smp_threads;
g_assert(smc->dr_cpu_enabled);
for (VAR_0 = 0; VAR_0 < VAR_1; VAR_0++) {
HotpluggableCPUList *list_item = g_new0(typeof(*list_item), 1);
HotpluggableCPU *cpu_item = g_new0(typeof(*cpu_item), 1);
CpuInstanceProperties *cpu_props = g_new0(typeof(*cpu_props), 1);
cpu_item->type = spapr_get_cpu_core_type(machine->cpu_model);
cpu_item->vcpus_count = smp_threads;
cpu_props->has_core_id = true;
cpu_props->core_id = VAR_0 * smp_threads;
cpu_item->props = cpu_props;
if (spapr->cores[VAR_0]) {
cpu_item->has_qom_path = true;
cpu_item->qom_path = object_get_canonical_path(spapr->cores[VAR_0]);
}
list_item->value = cpu_item;
list_item->next = head;
head = list_item;
}
return head;
}
|
[
"static HotpluggableCPUList *FUNC_0(MachineState *machine)\n{",
"int VAR_0;",
"HotpluggableCPUList *head = NULL;",
"sPAPRMachineState *spapr = SPAPR_MACHINE(machine);",
"sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine);",
"int VAR_1 = max_cpus / smp_threads;",
"g_assert(smc->dr_cpu_enabled);",
"for (VAR_0 = 0; VAR_0 < VAR_1; VAR_0++) {",
"HotpluggableCPUList *list_item = g_new0(typeof(*list_item), 1);",
"HotpluggableCPU *cpu_item = g_new0(typeof(*cpu_item), 1);",
"CpuInstanceProperties *cpu_props = g_new0(typeof(*cpu_props), 1);",
"cpu_item->type = spapr_get_cpu_core_type(machine->cpu_model);",
"cpu_item->vcpus_count = smp_threads;",
"cpu_props->has_core_id = true;",
"cpu_props->core_id = VAR_0 * smp_threads;",
"cpu_item->props = cpu_props;",
"if (spapr->cores[VAR_0]) {",
"cpu_item->has_qom_path = true;",
"cpu_item->qom_path = object_get_canonical_path(spapr->cores[VAR_0]);",
"}",
"list_item->value = cpu_item;",
"list_item->next = head;",
"head = list_item;",
"}",
"return head;",
"}"
] |
[
0,
0,
0,
0,
1,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
21
],
[
23
],
[
25
],
[
27
],
[
31
],
[
33
],
[
35
],
[
37
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
]
] |
6,386 |
static int matroska_ebmlnum_uint(MatroskaDemuxContext *matroska,
uint8_t *data, uint32_t size, uint64_t *num)
{
ByteIOContext pb;
init_put_byte(&pb, data, size, 0, NULL, NULL, NULL, NULL);
return ebml_read_num(matroska, &pb, 8, num);
}
| true |
FFmpeg
|
465c28b6b43be2563e0b644ec22cf641fe374d8d
|
static int matroska_ebmlnum_uint(MatroskaDemuxContext *matroska,
uint8_t *data, uint32_t size, uint64_t *num)
{
ByteIOContext pb;
init_put_byte(&pb, data, size, 0, NULL, NULL, NULL, NULL);
return ebml_read_num(matroska, &pb, 8, num);
}
|
{
"code": [
" return ebml_read_num(matroska, &pb, 8, num);"
],
"line_no": [
11
]
}
|
static int FUNC_0(MatroskaDemuxContext *VAR_0,
uint8_t *VAR_1, uint32_t VAR_2, uint64_t *VAR_3)
{
ByteIOContext pb;
init_put_byte(&pb, VAR_1, VAR_2, 0, NULL, NULL, NULL, NULL);
return ebml_read_num(VAR_0, &pb, 8, VAR_3);
}
|
[
"static int FUNC_0(MatroskaDemuxContext *VAR_0,\nuint8_t *VAR_1, uint32_t VAR_2, uint64_t *VAR_3)\n{",
"ByteIOContext pb;",
"init_put_byte(&pb, VAR_1, VAR_2, 0, NULL, NULL, NULL, NULL);",
"return ebml_read_num(VAR_0, &pb, 8, VAR_3);",
"}"
] |
[
0,
0,
0,
1,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
]
] |
6,387 |
static int check(AVIOContext *pb, int64_t pos)
{
int64_t ret = avio_seek(pb, pos, SEEK_SET);
unsigned header;
MPADecodeHeader sd;
if (ret < 0)
return ret;
header = avio_rb32(pb);
if (ff_mpa_check_header(header) < 0)
return -1;
if (avpriv_mpegaudio_decode_header(&sd, header) == 1)
return -1;
return sd.frame_size;
}
| false |
FFmpeg
|
de1b1a7da9e6ddf42447271e519099a88b389e4a
|
static int check(AVIOContext *pb, int64_t pos)
{
int64_t ret = avio_seek(pb, pos, SEEK_SET);
unsigned header;
MPADecodeHeader sd;
if (ret < 0)
return ret;
header = avio_rb32(pb);
if (ff_mpa_check_header(header) < 0)
return -1;
if (avpriv_mpegaudio_decode_header(&sd, header) == 1)
return -1;
return sd.frame_size;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(AVIOContext *VAR_0, int64_t VAR_1)
{
int64_t ret = avio_seek(VAR_0, VAR_1, SEEK_SET);
unsigned VAR_2;
MPADecodeHeader sd;
if (ret < 0)
return ret;
VAR_2 = avio_rb32(VAR_0);
if (ff_mpa_check_header(VAR_2) < 0)
return -1;
if (avpriv_mpegaudio_decode_header(&sd, VAR_2) == 1)
return -1;
return sd.frame_size;
}
|
[
"static int FUNC_0(AVIOContext *VAR_0, int64_t VAR_1)\n{",
"int64_t ret = avio_seek(VAR_0, VAR_1, SEEK_SET);",
"unsigned VAR_2;",
"MPADecodeHeader sd;",
"if (ret < 0)\nreturn ret;",
"VAR_2 = avio_rb32(VAR_0);",
"if (ff_mpa_check_header(VAR_2) < 0)\nreturn -1;",
"if (avpriv_mpegaudio_decode_header(&sd, VAR_2) == 1)\nreturn -1;",
"return sd.frame_size;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11,
13
],
[
17
],
[
19,
21
],
[
23,
25
],
[
29
],
[
31
]
] |
6,388 |
static void slavio_timer_get_out(SLAVIO_TIMERState *s)
{
uint64_t count;
count = s->limit - PERIODS_TO_LIMIT(ptimer_get_count(s->timer));
DPRINTF("get_out: limit %" PRIx64 " count %x%08x\n", s->limit,
s->counthigh, s->count);
s->count = count & TIMER_COUNT_MASK32;
s->counthigh = count >> 32;
}
| false |
qemu
|
bd7e2875fe99ca9621c02666e11389602b512f4b
|
static void slavio_timer_get_out(SLAVIO_TIMERState *s)
{
uint64_t count;
count = s->limit - PERIODS_TO_LIMIT(ptimer_get_count(s->timer));
DPRINTF("get_out: limit %" PRIx64 " count %x%08x\n", s->limit,
s->counthigh, s->count);
s->count = count & TIMER_COUNT_MASK32;
s->counthigh = count >> 32;
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(SLAVIO_TIMERState *VAR_0)
{
uint64_t count;
count = VAR_0->limit - PERIODS_TO_LIMIT(ptimer_get_count(VAR_0->timer));
DPRINTF("get_out: limit %" PRIx64 " count %x%08x\n", VAR_0->limit,
VAR_0->counthigh, VAR_0->count);
VAR_0->count = count & TIMER_COUNT_MASK32;
VAR_0->counthigh = count >> 32;
}
|
[
"static void FUNC_0(SLAVIO_TIMERState *VAR_0)\n{",
"uint64_t count;",
"count = VAR_0->limit - PERIODS_TO_LIMIT(ptimer_get_count(VAR_0->timer));",
"DPRINTF(\"get_out: limit %\" PRIx64 \" count %x%08x\\n\", VAR_0->limit,\nVAR_0->counthigh, VAR_0->count);",
"VAR_0->count = count & TIMER_COUNT_MASK32;",
"VAR_0->counthigh = count >> 32;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
9
],
[
11,
13
],
[
15
],
[
17
],
[
19
]
] |
6,389 |
void acpi_pm1_cnt_reset(ACPIREGS *ar)
{
ar->pm1.cnt.cnt = 0;
if (ar->pm1.cnt.cmos_s3) {
qemu_irq_lower(ar->pm1.cnt.cmos_s3);
}
}
| false |
qemu
|
da98c8eb4c35225049cad8cf767647eb39788b5d
|
void acpi_pm1_cnt_reset(ACPIREGS *ar)
{
ar->pm1.cnt.cnt = 0;
if (ar->pm1.cnt.cmos_s3) {
qemu_irq_lower(ar->pm1.cnt.cmos_s3);
}
}
|
{
"code": [],
"line_no": []
}
|
void FUNC_0(ACPIREGS *VAR_0)
{
VAR_0->pm1.cnt.cnt = 0;
if (VAR_0->pm1.cnt.cmos_s3) {
qemu_irq_lower(VAR_0->pm1.cnt.cmos_s3);
}
}
|
[
"void FUNC_0(ACPIREGS *VAR_0)\n{",
"VAR_0->pm1.cnt.cnt = 0;",
"if (VAR_0->pm1.cnt.cmos_s3) {",
"qemu_irq_lower(VAR_0->pm1.cnt.cmos_s3);",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
]
] |
6,390 |
static uint16_t pci_req_id_cache_extract(PCIReqIDCache *cache)
{
uint8_t bus_n;
uint16_t result;
switch (cache->type) {
case PCI_REQ_ID_BDF:
result = pci_get_bdf(cache->dev);
break;
case PCI_REQ_ID_SECONDARY_BUS:
bus_n = pci_bus_num(cache->dev->bus);
result = PCI_BUILD_BDF(bus_n, 0);
break;
default:
error_printf("Invalid PCI requester ID cache type: %d\n",
cache->type);
exit(1);
break;
}
return result;
}
| false |
qemu
|
fd56e0612b6454a282fa6a953fdb09281a98c589
|
static uint16_t pci_req_id_cache_extract(PCIReqIDCache *cache)
{
uint8_t bus_n;
uint16_t result;
switch (cache->type) {
case PCI_REQ_ID_BDF:
result = pci_get_bdf(cache->dev);
break;
case PCI_REQ_ID_SECONDARY_BUS:
bus_n = pci_bus_num(cache->dev->bus);
result = PCI_BUILD_BDF(bus_n, 0);
break;
default:
error_printf("Invalid PCI requester ID cache type: %d\n",
cache->type);
exit(1);
break;
}
return result;
}
|
{
"code": [],
"line_no": []
}
|
static uint16_t FUNC_0(PCIReqIDCache *cache)
{
uint8_t bus_n;
uint16_t result;
switch (cache->type) {
case PCI_REQ_ID_BDF:
result = pci_get_bdf(cache->dev);
break;
case PCI_REQ_ID_SECONDARY_BUS:
bus_n = pci_bus_num(cache->dev->bus);
result = PCI_BUILD_BDF(bus_n, 0);
break;
default:
error_printf("Invalid PCI requester ID cache type: %d\n",
cache->type);
exit(1);
break;
}
return result;
}
|
[
"static uint16_t FUNC_0(PCIReqIDCache *cache)\n{",
"uint8_t bus_n;",
"uint16_t result;",
"switch (cache->type) {",
"case PCI_REQ_ID_BDF:\nresult = pci_get_bdf(cache->dev);",
"break;",
"case PCI_REQ_ID_SECONDARY_BUS:\nbus_n = pci_bus_num(cache->dev->bus);",
"result = PCI_BUILD_BDF(bus_n, 0);",
"break;",
"default:\nerror_printf(\"Invalid PCI requester ID cache type: %d\\n\",\ncache->type);",
"exit(1);",
"break;",
"}",
"return result;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13,
15
],
[
17
],
[
19,
21
],
[
23
],
[
25
],
[
27,
29,
31
],
[
33
],
[
35
],
[
37
],
[
41
],
[
43
]
] |
6,391 |
int qio_channel_readv_all(QIOChannel *ioc,
const struct iovec *iov,
size_t niov,
Error **errp)
{
int ret = -1;
struct iovec *local_iov = g_new(struct iovec, niov);
struct iovec *local_iov_head = local_iov;
unsigned int nlocal_iov = niov;
nlocal_iov = iov_copy(local_iov, nlocal_iov,
iov, niov,
0, iov_size(iov, niov));
while (nlocal_iov > 0) {
ssize_t len;
len = qio_channel_readv(ioc, local_iov, nlocal_iov, errp);
if (len == QIO_CHANNEL_ERR_BLOCK) {
qio_channel_wait(ioc, G_IO_IN);
continue;
} else if (len < 0) {
goto cleanup;
} else if (len == 0) {
error_setg(errp,
"Unexpected end-of-file before all bytes were read");
goto cleanup;
}
iov_discard_front(&local_iov, &nlocal_iov, len);
}
ret = 0;
cleanup:
g_free(local_iov_head);
return ret;
}
| false |
qemu
|
9ffb8270205a274a18ee4f8a735e2fccaf957246
|
int qio_channel_readv_all(QIOChannel *ioc,
const struct iovec *iov,
size_t niov,
Error **errp)
{
int ret = -1;
struct iovec *local_iov = g_new(struct iovec, niov);
struct iovec *local_iov_head = local_iov;
unsigned int nlocal_iov = niov;
nlocal_iov = iov_copy(local_iov, nlocal_iov,
iov, niov,
0, iov_size(iov, niov));
while (nlocal_iov > 0) {
ssize_t len;
len = qio_channel_readv(ioc, local_iov, nlocal_iov, errp);
if (len == QIO_CHANNEL_ERR_BLOCK) {
qio_channel_wait(ioc, G_IO_IN);
continue;
} else if (len < 0) {
goto cleanup;
} else if (len == 0) {
error_setg(errp,
"Unexpected end-of-file before all bytes were read");
goto cleanup;
}
iov_discard_front(&local_iov, &nlocal_iov, len);
}
ret = 0;
cleanup:
g_free(local_iov_head);
return ret;
}
|
{
"code": [],
"line_no": []
}
|
int FUNC_0(QIOChannel *VAR_0,
const struct iovec *VAR_1,
size_t VAR_2,
Error **VAR_3)
{
int VAR_4 = -1;
struct iovec *VAR_5 = g_new(struct iovec, VAR_2);
struct iovec *VAR_6 = VAR_5;
unsigned int VAR_7 = VAR_2;
VAR_7 = iov_copy(VAR_5, VAR_7,
VAR_1, VAR_2,
0, iov_size(VAR_1, VAR_2));
while (VAR_7 > 0) {
ssize_t len;
len = qio_channel_readv(VAR_0, VAR_5, VAR_7, VAR_3);
if (len == QIO_CHANNEL_ERR_BLOCK) {
qio_channel_wait(VAR_0, G_IO_IN);
continue;
} else if (len < 0) {
goto cleanup;
} else if (len == 0) {
error_setg(VAR_3,
"Unexpected end-of-file before all bytes were read");
goto cleanup;
}
iov_discard_front(&VAR_5, &VAR_7, len);
}
VAR_4 = 0;
cleanup:
g_free(VAR_6);
return VAR_4;
}
|
[
"int FUNC_0(QIOChannel *VAR_0,\nconst struct iovec *VAR_1,\nsize_t VAR_2,\nError **VAR_3)\n{",
"int VAR_4 = -1;",
"struct iovec *VAR_5 = g_new(struct iovec, VAR_2);",
"struct iovec *VAR_6 = VAR_5;",
"unsigned int VAR_7 = VAR_2;",
"VAR_7 = iov_copy(VAR_5, VAR_7,\nVAR_1, VAR_2,\n0, iov_size(VAR_1, VAR_2));",
"while (VAR_7 > 0) {",
"ssize_t len;",
"len = qio_channel_readv(VAR_0, VAR_5, VAR_7, VAR_3);",
"if (len == QIO_CHANNEL_ERR_BLOCK) {",
"qio_channel_wait(VAR_0, G_IO_IN);",
"continue;",
"} else if (len < 0) {",
"goto cleanup;",
"} else if (len == 0) {",
"error_setg(VAR_3,\n\"Unexpected end-of-file before all bytes were read\");",
"goto cleanup;",
"}",
"iov_discard_front(&VAR_5, &VAR_7, len);",
"}",
"VAR_4 = 0;",
"cleanup:\ng_free(VAR_6);",
"return VAR_4;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5,
7,
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
21,
23,
25
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47,
49
],
[
51
],
[
53
],
[
57
],
[
59
],
[
63
],
[
67,
69
],
[
71
],
[
73
]
] |
6,392 |
static void ioreq_unmap(struct ioreq *ioreq)
{
int gnt = ioreq->blkdev->xendev.gnttabdev;
int i;
if (ioreq->v.niov == 0) {
return;
}
if (batch_maps) {
if (!ioreq->pages) {
return;
}
if (xc_gnttab_munmap(gnt, ioreq->pages, ioreq->v.niov) != 0) {
xen_be_printf(&ioreq->blkdev->xendev, 0, "xc_gnttab_munmap failed: %s\n",
strerror(errno));
}
ioreq->blkdev->cnt_map -= ioreq->v.niov;
ioreq->pages = NULL;
} else {
for (i = 0; i < ioreq->v.niov; i++) {
if (!ioreq->page[i]) {
continue;
}
if (xc_gnttab_munmap(gnt, ioreq->page[i], 1) != 0) {
xen_be_printf(&ioreq->blkdev->xendev, 0, "xc_gnttab_munmap failed: %s\n",
strerror(errno));
}
ioreq->blkdev->cnt_map--;
ioreq->page[i] = NULL;
}
}
}
| false |
qemu
|
d5b93ddfefe63d5869a8eb97ea3474867d3b105b
|
static void ioreq_unmap(struct ioreq *ioreq)
{
int gnt = ioreq->blkdev->xendev.gnttabdev;
int i;
if (ioreq->v.niov == 0) {
return;
}
if (batch_maps) {
if (!ioreq->pages) {
return;
}
if (xc_gnttab_munmap(gnt, ioreq->pages, ioreq->v.niov) != 0) {
xen_be_printf(&ioreq->blkdev->xendev, 0, "xc_gnttab_munmap failed: %s\n",
strerror(errno));
}
ioreq->blkdev->cnt_map -= ioreq->v.niov;
ioreq->pages = NULL;
} else {
for (i = 0; i < ioreq->v.niov; i++) {
if (!ioreq->page[i]) {
continue;
}
if (xc_gnttab_munmap(gnt, ioreq->page[i], 1) != 0) {
xen_be_printf(&ioreq->blkdev->xendev, 0, "xc_gnttab_munmap failed: %s\n",
strerror(errno));
}
ioreq->blkdev->cnt_map--;
ioreq->page[i] = NULL;
}
}
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(struct VAR_0 *VAR_0)
{
int VAR_1 = VAR_0->blkdev->xendev.gnttabdev;
int VAR_2;
if (VAR_0->v.niov == 0) {
return;
}
if (batch_maps) {
if (!VAR_0->pages) {
return;
}
if (xc_gnttab_munmap(VAR_1, VAR_0->pages, VAR_0->v.niov) != 0) {
xen_be_printf(&VAR_0->blkdev->xendev, 0, "xc_gnttab_munmap failed: %s\n",
strerror(errno));
}
VAR_0->blkdev->cnt_map -= VAR_0->v.niov;
VAR_0->pages = NULL;
} else {
for (VAR_2 = 0; VAR_2 < VAR_0->v.niov; VAR_2++) {
if (!VAR_0->page[VAR_2]) {
continue;
}
if (xc_gnttab_munmap(VAR_1, VAR_0->page[VAR_2], 1) != 0) {
xen_be_printf(&VAR_0->blkdev->xendev, 0, "xc_gnttab_munmap failed: %s\n",
strerror(errno));
}
VAR_0->blkdev->cnt_map--;
VAR_0->page[VAR_2] = NULL;
}
}
}
|
[
"static void FUNC_0(struct VAR_0 *VAR_0)\n{",
"int VAR_1 = VAR_0->blkdev->xendev.gnttabdev;",
"int VAR_2;",
"if (VAR_0->v.niov == 0) {",
"return;",
"}",
"if (batch_maps) {",
"if (!VAR_0->pages) {",
"return;",
"}",
"if (xc_gnttab_munmap(VAR_1, VAR_0->pages, VAR_0->v.niov) != 0) {",
"xen_be_printf(&VAR_0->blkdev->xendev, 0, \"xc_gnttab_munmap failed: %s\\n\",\nstrerror(errno));",
"}",
"VAR_0->blkdev->cnt_map -= VAR_0->v.niov;",
"VAR_0->pages = NULL;",
"} else {",
"for (VAR_2 = 0; VAR_2 < VAR_0->v.niov; VAR_2++) {",
"if (!VAR_0->page[VAR_2]) {",
"continue;",
"}",
"if (xc_gnttab_munmap(VAR_1, VAR_0->page[VAR_2], 1) != 0) {",
"xen_be_printf(&VAR_0->blkdev->xendev, 0, \"xc_gnttab_munmap failed: %s\\n\",\nstrerror(errno));",
"}",
"VAR_0->blkdev->cnt_map--;",
"VAR_0->page[VAR_2] = NULL;",
"}",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27,
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49,
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
]
] |
6,393 |
static struct omap_mpuio_s *omap_mpuio_init(MemoryRegion *memory,
target_phys_addr_t base,
qemu_irq kbd_int, qemu_irq gpio_int, qemu_irq wakeup,
omap_clk clk)
{
struct omap_mpuio_s *s = (struct omap_mpuio_s *)
g_malloc0(sizeof(struct omap_mpuio_s));
s->irq = gpio_int;
s->kbd_irq = kbd_int;
s->wakeup = wakeup;
s->in = qemu_allocate_irqs(omap_mpuio_set, s, 16);
omap_mpuio_reset(s);
memory_region_init_io(&s->iomem, &omap_mpuio_ops, s,
"omap-mpuio", 0x800);
memory_region_add_subregion(memory, base, &s->iomem);
omap_clk_adduser(clk, qemu_allocate_irqs(omap_mpuio_onoff, s, 1)[0]);
return s;
}
| false |
qemu
|
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
|
static struct omap_mpuio_s *omap_mpuio_init(MemoryRegion *memory,
target_phys_addr_t base,
qemu_irq kbd_int, qemu_irq gpio_int, qemu_irq wakeup,
omap_clk clk)
{
struct omap_mpuio_s *s = (struct omap_mpuio_s *)
g_malloc0(sizeof(struct omap_mpuio_s));
s->irq = gpio_int;
s->kbd_irq = kbd_int;
s->wakeup = wakeup;
s->in = qemu_allocate_irqs(omap_mpuio_set, s, 16);
omap_mpuio_reset(s);
memory_region_init_io(&s->iomem, &omap_mpuio_ops, s,
"omap-mpuio", 0x800);
memory_region_add_subregion(memory, base, &s->iomem);
omap_clk_adduser(clk, qemu_allocate_irqs(omap_mpuio_onoff, s, 1)[0]);
return s;
}
|
{
"code": [],
"line_no": []
}
|
static struct omap_mpuio_s *FUNC_0(MemoryRegion *VAR_0,
target_phys_addr_t VAR_1,
qemu_irq VAR_2, qemu_irq VAR_3, qemu_irq VAR_4,
omap_clk VAR_5)
{
struct omap_mpuio_s *VAR_6 = (struct omap_mpuio_s *)
g_malloc0(sizeof(struct omap_mpuio_s));
VAR_6->irq = VAR_3;
VAR_6->kbd_irq = VAR_2;
VAR_6->VAR_4 = VAR_4;
VAR_6->in = qemu_allocate_irqs(omap_mpuio_set, VAR_6, 16);
omap_mpuio_reset(VAR_6);
memory_region_init_io(&VAR_6->iomem, &omap_mpuio_ops, VAR_6,
"omap-mpuio", 0x800);
memory_region_add_subregion(VAR_0, VAR_1, &VAR_6->iomem);
omap_clk_adduser(VAR_5, qemu_allocate_irqs(omap_mpuio_onoff, VAR_6, 1)[0]);
return VAR_6;
}
|
[
"static struct omap_mpuio_s *FUNC_0(MemoryRegion *VAR_0,\ntarget_phys_addr_t VAR_1,\nqemu_irq VAR_2, qemu_irq VAR_3, qemu_irq VAR_4,\nomap_clk VAR_5)\n{",
"struct omap_mpuio_s *VAR_6 = (struct omap_mpuio_s *)\ng_malloc0(sizeof(struct omap_mpuio_s));",
"VAR_6->irq = VAR_3;",
"VAR_6->kbd_irq = VAR_2;",
"VAR_6->VAR_4 = VAR_4;",
"VAR_6->in = qemu_allocate_irqs(omap_mpuio_set, VAR_6, 16);",
"omap_mpuio_reset(VAR_6);",
"memory_region_init_io(&VAR_6->iomem, &omap_mpuio_ops, VAR_6,\n\"omap-mpuio\", 0x800);",
"memory_region_add_subregion(VAR_0, VAR_1, &VAR_6->iomem);",
"omap_clk_adduser(VAR_5, qemu_allocate_irqs(omap_mpuio_onoff, VAR_6, 1)[0]);",
"return VAR_6;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5,
7,
9
],
[
11,
13
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
29,
31
],
[
33
],
[
37
],
[
41
],
[
43
]
] |
6,394 |
static target_ulong h_read(PowerPCCPU *cpu, sPAPRMachineState *spapr,
target_ulong opcode, target_ulong *args)
{
CPUPPCState *env = &cpu->env;
target_ulong flags = args[0];
target_ulong ptex = args[1];
uint8_t *hpte;
int i, ridx, n_entries = 1;
if (!valid_ptex(cpu, ptex)) {
return H_PARAMETER;
}
if (flags & H_READ_4) {
/* Clear the two low order bits */
ptex &= ~(3ULL);
n_entries = 4;
}
hpte = env->external_htab + (ptex * HASH_PTE_SIZE_64);
for (i = 0, ridx = 0; i < n_entries; i++) {
args[ridx++] = ldq_p(hpte);
args[ridx++] = ldq_p(hpte + (HASH_PTE_SIZE_64/2));
hpte += HASH_PTE_SIZE_64;
}
return H_SUCCESS;
}
| false |
qemu
|
e57ca75ce3b2bd33102573a8c0555d62e1bcfceb
|
static target_ulong h_read(PowerPCCPU *cpu, sPAPRMachineState *spapr,
target_ulong opcode, target_ulong *args)
{
CPUPPCState *env = &cpu->env;
target_ulong flags = args[0];
target_ulong ptex = args[1];
uint8_t *hpte;
int i, ridx, n_entries = 1;
if (!valid_ptex(cpu, ptex)) {
return H_PARAMETER;
}
if (flags & H_READ_4) {
ptex &= ~(3ULL);
n_entries = 4;
}
hpte = env->external_htab + (ptex * HASH_PTE_SIZE_64);
for (i = 0, ridx = 0; i < n_entries; i++) {
args[ridx++] = ldq_p(hpte);
args[ridx++] = ldq_p(hpte + (HASH_PTE_SIZE_64/2));
hpte += HASH_PTE_SIZE_64;
}
return H_SUCCESS;
}
|
{
"code": [],
"line_no": []
}
|
static target_ulong FUNC_0(PowerPCCPU *cpu, sPAPRMachineState *spapr,
target_ulong opcode, target_ulong *args)
{
CPUPPCState *env = &cpu->env;
target_ulong flags = args[0];
target_ulong ptex = args[1];
uint8_t *hpte;
int VAR_0, VAR_1, VAR_2 = 1;
if (!valid_ptex(cpu, ptex)) {
return H_PARAMETER;
}
if (flags & H_READ_4) {
ptex &= ~(3ULL);
VAR_2 = 4;
}
hpte = env->external_htab + (ptex * HASH_PTE_SIZE_64);
for (VAR_0 = 0, VAR_1 = 0; VAR_0 < VAR_2; VAR_0++) {
args[VAR_1++] = ldq_p(hpte);
args[VAR_1++] = ldq_p(hpte + (HASH_PTE_SIZE_64/2));
hpte += HASH_PTE_SIZE_64;
}
return H_SUCCESS;
}
|
[
"static target_ulong FUNC_0(PowerPCCPU *cpu, sPAPRMachineState *spapr,\ntarget_ulong opcode, target_ulong *args)\n{",
"CPUPPCState *env = &cpu->env;",
"target_ulong flags = args[0];",
"target_ulong ptex = args[1];",
"uint8_t *hpte;",
"int VAR_0, VAR_1, VAR_2 = 1;",
"if (!valid_ptex(cpu, ptex)) {",
"return H_PARAMETER;",
"}",
"if (flags & H_READ_4) {",
"ptex &= ~(3ULL);",
"VAR_2 = 4;",
"}",
"hpte = env->external_htab + (ptex * HASH_PTE_SIZE_64);",
"for (VAR_0 = 0, VAR_1 = 0; VAR_0 < VAR_2; VAR_0++) {",
"args[VAR_1++] = ldq_p(hpte);",
"args[VAR_1++] = ldq_p(hpte + (HASH_PTE_SIZE_64/2));",
"hpte += HASH_PTE_SIZE_64;",
"}",
"return H_SUCCESS;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23
],
[
27
],
[
31
],
[
33
],
[
35
],
[
39
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
55
],
[
57
]
] |
6,395 |
static void dec_pattern(DisasContext *dc)
{
unsigned int mode;
int l1;
if ((dc->tb_flags & MSR_EE_FLAG)
&& !(dc->env->pvr.regs[2] & PVR2_ILL_OPCODE_EXC_MASK)
&& !((dc->env->pvr.regs[2] & PVR2_USE_PCMP_INSTR))) {
tcg_gen_movi_tl(cpu_SR[SR_ESR], ESR_EC_ILLEGAL_OP);
t_gen_raise_exception(dc, EXCP_HW_EXCP);
}
mode = dc->opcode & 3;
switch (mode) {
case 0:
/* pcmpbf. */
LOG_DIS("pcmpbf r%d r%d r%d\n", dc->rd, dc->ra, dc->rb);
if (dc->rd)
gen_helper_pcmpbf(cpu_R[dc->rd], cpu_R[dc->ra], cpu_R[dc->rb]);
break;
case 2:
LOG_DIS("pcmpeq r%d r%d r%d\n", dc->rd, dc->ra, dc->rb);
if (dc->rd) {
TCGv t0 = tcg_temp_local_new();
l1 = gen_new_label();
tcg_gen_movi_tl(t0, 1);
tcg_gen_brcond_tl(TCG_COND_EQ,
cpu_R[dc->ra], cpu_R[dc->rb], l1);
tcg_gen_movi_tl(t0, 0);
gen_set_label(l1);
tcg_gen_mov_tl(cpu_R[dc->rd], t0);
tcg_temp_free(t0);
}
break;
case 3:
LOG_DIS("pcmpne r%d r%d r%d\n", dc->rd, dc->ra, dc->rb);
l1 = gen_new_label();
if (dc->rd) {
TCGv t0 = tcg_temp_local_new();
tcg_gen_movi_tl(t0, 1);
tcg_gen_brcond_tl(TCG_COND_NE,
cpu_R[dc->ra], cpu_R[dc->rb], l1);
tcg_gen_movi_tl(t0, 0);
gen_set_label(l1);
tcg_gen_mov_tl(cpu_R[dc->rd], t0);
tcg_temp_free(t0);
}
break;
default:
cpu_abort(dc->env,
"unsupported pattern insn opcode=%x\n", dc->opcode);
break;
}
}
| false |
qemu
|
97f90cbfe810bb153fc44bde732d9639610783bb
|
static void dec_pattern(DisasContext *dc)
{
unsigned int mode;
int l1;
if ((dc->tb_flags & MSR_EE_FLAG)
&& !(dc->env->pvr.regs[2] & PVR2_ILL_OPCODE_EXC_MASK)
&& !((dc->env->pvr.regs[2] & PVR2_USE_PCMP_INSTR))) {
tcg_gen_movi_tl(cpu_SR[SR_ESR], ESR_EC_ILLEGAL_OP);
t_gen_raise_exception(dc, EXCP_HW_EXCP);
}
mode = dc->opcode & 3;
switch (mode) {
case 0:
LOG_DIS("pcmpbf r%d r%d r%d\n", dc->rd, dc->ra, dc->rb);
if (dc->rd)
gen_helper_pcmpbf(cpu_R[dc->rd], cpu_R[dc->ra], cpu_R[dc->rb]);
break;
case 2:
LOG_DIS("pcmpeq r%d r%d r%d\n", dc->rd, dc->ra, dc->rb);
if (dc->rd) {
TCGv t0 = tcg_temp_local_new();
l1 = gen_new_label();
tcg_gen_movi_tl(t0, 1);
tcg_gen_brcond_tl(TCG_COND_EQ,
cpu_R[dc->ra], cpu_R[dc->rb], l1);
tcg_gen_movi_tl(t0, 0);
gen_set_label(l1);
tcg_gen_mov_tl(cpu_R[dc->rd], t0);
tcg_temp_free(t0);
}
break;
case 3:
LOG_DIS("pcmpne r%d r%d r%d\n", dc->rd, dc->ra, dc->rb);
l1 = gen_new_label();
if (dc->rd) {
TCGv t0 = tcg_temp_local_new();
tcg_gen_movi_tl(t0, 1);
tcg_gen_brcond_tl(TCG_COND_NE,
cpu_R[dc->ra], cpu_R[dc->rb], l1);
tcg_gen_movi_tl(t0, 0);
gen_set_label(l1);
tcg_gen_mov_tl(cpu_R[dc->rd], t0);
tcg_temp_free(t0);
}
break;
default:
cpu_abort(dc->env,
"unsupported pattern insn opcode=%x\n", dc->opcode);
break;
}
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(DisasContext *VAR_0)
{
unsigned int VAR_1;
int VAR_2;
if ((VAR_0->tb_flags & MSR_EE_FLAG)
&& !(VAR_0->env->pvr.regs[2] & PVR2_ILL_OPCODE_EXC_MASK)
&& !((VAR_0->env->pvr.regs[2] & PVR2_USE_PCMP_INSTR))) {
tcg_gen_movi_tl(cpu_SR[SR_ESR], ESR_EC_ILLEGAL_OP);
t_gen_raise_exception(VAR_0, EXCP_HW_EXCP);
}
VAR_1 = VAR_0->opcode & 3;
switch (VAR_1) {
case 0:
LOG_DIS("pcmpbf r%d r%d r%d\n", VAR_0->rd, VAR_0->ra, VAR_0->rb);
if (VAR_0->rd)
gen_helper_pcmpbf(cpu_R[VAR_0->rd], cpu_R[VAR_0->ra], cpu_R[VAR_0->rb]);
break;
case 2:
LOG_DIS("pcmpeq r%d r%d r%d\n", VAR_0->rd, VAR_0->ra, VAR_0->rb);
if (VAR_0->rd) {
TCGv t0 = tcg_temp_local_new();
VAR_2 = gen_new_label();
tcg_gen_movi_tl(t0, 1);
tcg_gen_brcond_tl(TCG_COND_EQ,
cpu_R[VAR_0->ra], cpu_R[VAR_0->rb], VAR_2);
tcg_gen_movi_tl(t0, 0);
gen_set_label(VAR_2);
tcg_gen_mov_tl(cpu_R[VAR_0->rd], t0);
tcg_temp_free(t0);
}
break;
case 3:
LOG_DIS("pcmpne r%d r%d r%d\n", VAR_0->rd, VAR_0->ra, VAR_0->rb);
VAR_2 = gen_new_label();
if (VAR_0->rd) {
TCGv t0 = tcg_temp_local_new();
tcg_gen_movi_tl(t0, 1);
tcg_gen_brcond_tl(TCG_COND_NE,
cpu_R[VAR_0->ra], cpu_R[VAR_0->rb], VAR_2);
tcg_gen_movi_tl(t0, 0);
gen_set_label(VAR_2);
tcg_gen_mov_tl(cpu_R[VAR_0->rd], t0);
tcg_temp_free(t0);
}
break;
default:
cpu_abort(VAR_0->env,
"unsupported pattern insn opcode=%x\n", VAR_0->opcode);
break;
}
}
|
[
"static void FUNC_0(DisasContext *VAR_0)\n{",
"unsigned int VAR_1;",
"int VAR_2;",
"if ((VAR_0->tb_flags & MSR_EE_FLAG)\n&& !(VAR_0->env->pvr.regs[2] & PVR2_ILL_OPCODE_EXC_MASK)\n&& !((VAR_0->env->pvr.regs[2] & PVR2_USE_PCMP_INSTR))) {",
"tcg_gen_movi_tl(cpu_SR[SR_ESR], ESR_EC_ILLEGAL_OP);",
"t_gen_raise_exception(VAR_0, EXCP_HW_EXCP);",
"}",
"VAR_1 = VAR_0->opcode & 3;",
"switch (VAR_1) {",
"case 0:\nLOG_DIS(\"pcmpbf r%d r%d r%d\\n\", VAR_0->rd, VAR_0->ra, VAR_0->rb);",
"if (VAR_0->rd)\ngen_helper_pcmpbf(cpu_R[VAR_0->rd], cpu_R[VAR_0->ra], cpu_R[VAR_0->rb]);",
"break;",
"case 2:\nLOG_DIS(\"pcmpeq r%d r%d r%d\\n\", VAR_0->rd, VAR_0->ra, VAR_0->rb);",
"if (VAR_0->rd) {",
"TCGv t0 = tcg_temp_local_new();",
"VAR_2 = gen_new_label();",
"tcg_gen_movi_tl(t0, 1);",
"tcg_gen_brcond_tl(TCG_COND_EQ,\ncpu_R[VAR_0->ra], cpu_R[VAR_0->rb], VAR_2);",
"tcg_gen_movi_tl(t0, 0);",
"gen_set_label(VAR_2);",
"tcg_gen_mov_tl(cpu_R[VAR_0->rd], t0);",
"tcg_temp_free(t0);",
"}",
"break;",
"case 3:\nLOG_DIS(\"pcmpne r%d r%d r%d\\n\", VAR_0->rd, VAR_0->ra, VAR_0->rb);",
"VAR_2 = gen_new_label();",
"if (VAR_0->rd) {",
"TCGv t0 = tcg_temp_local_new();",
"tcg_gen_movi_tl(t0, 1);",
"tcg_gen_brcond_tl(TCG_COND_NE,\ncpu_R[VAR_0->ra], cpu_R[VAR_0->rb], VAR_2);",
"tcg_gen_movi_tl(t0, 0);",
"gen_set_label(VAR_2);",
"tcg_gen_mov_tl(cpu_R[VAR_0->rd], t0);",
"tcg_temp_free(t0);",
"}",
"break;",
"default:\ncpu_abort(VAR_0->env,\n\"unsupported pattern insn opcode=%x\\n\", VAR_0->opcode);",
"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
] |
[
[
1,
3
],
[
5
],
[
7
],
[
11,
13,
15
],
[
17
],
[
19
],
[
21
],
[
25
],
[
27
],
[
29,
33
],
[
35,
37
],
[
39
],
[
41,
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53,
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69,
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81,
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97,
99,
101
],
[
103
],
[
105
],
[
107
]
] |
6,396 |
static MemoryRegionSection phys_page_find(target_phys_addr_t index)
{
uint16_t *p = phys_page_find_alloc(index, 0);
uint16_t s_index = phys_section_unassigned;
MemoryRegionSection section;
target_phys_addr_t delta;
if (p) {
s_index = *p;
}
section = phys_sections[s_index];
index <<= TARGET_PAGE_BITS;
assert(section.offset_within_address_space <= index
&& index <= section.offset_within_address_space + section.size-1);
delta = index - section.offset_within_address_space;
section.offset_within_address_space += delta;
section.offset_within_region += delta;
section.size -= delta;
return section;
}
| false |
qemu
|
31ab2b4a46eb9761feae9457387eb5ee523f5afd
|
static MemoryRegionSection phys_page_find(target_phys_addr_t index)
{
uint16_t *p = phys_page_find_alloc(index, 0);
uint16_t s_index = phys_section_unassigned;
MemoryRegionSection section;
target_phys_addr_t delta;
if (p) {
s_index = *p;
}
section = phys_sections[s_index];
index <<= TARGET_PAGE_BITS;
assert(section.offset_within_address_space <= index
&& index <= section.offset_within_address_space + section.size-1);
delta = index - section.offset_within_address_space;
section.offset_within_address_space += delta;
section.offset_within_region += delta;
section.size -= delta;
return section;
}
|
{
"code": [],
"line_no": []
}
|
static MemoryRegionSection FUNC_0(target_phys_addr_t index)
{
uint16_t *p = phys_page_find_alloc(index, 0);
uint16_t s_index = phys_section_unassigned;
MemoryRegionSection section;
target_phys_addr_t delta;
if (p) {
s_index = *p;
}
section = phys_sections[s_index];
index <<= TARGET_PAGE_BITS;
assert(section.offset_within_address_space <= index
&& index <= section.offset_within_address_space + section.size-1);
delta = index - section.offset_within_address_space;
section.offset_within_address_space += delta;
section.offset_within_region += delta;
section.size -= delta;
return section;
}
|
[
"static MemoryRegionSection FUNC_0(target_phys_addr_t index)\n{",
"uint16_t *p = phys_page_find_alloc(index, 0);",
"uint16_t s_index = phys_section_unassigned;",
"MemoryRegionSection section;",
"target_phys_addr_t delta;",
"if (p) {",
"s_index = *p;",
"}",
"section = phys_sections[s_index];",
"index <<= TARGET_PAGE_BITS;",
"assert(section.offset_within_address_space <= index\n&& index <= section.offset_within_address_space + section.size-1);",
"delta = index - section.offset_within_address_space;",
"section.offset_within_address_space += delta;",
"section.offset_within_region += delta;",
"section.size -= delta;",
"return section;",
"}"
] |
[
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
]
] |
6,397 |
static void qmp_output_end_struct(Visitor *v, Error **errp)
{
QmpOutputVisitor *qov = to_qov(v);
qmp_output_pop(qov);
}
| false |
qemu
|
56a6f02b8ce1fe41a2a9077593e46eca7d98267d
|
static void qmp_output_end_struct(Visitor *v, Error **errp)
{
QmpOutputVisitor *qov = to_qov(v);
qmp_output_pop(qov);
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(Visitor *VAR_0, Error **VAR_1)
{
QmpOutputVisitor *qov = to_qov(VAR_0);
qmp_output_pop(qov);
}
|
[
"static void FUNC_0(Visitor *VAR_0, Error **VAR_1)\n{",
"QmpOutputVisitor *qov = to_qov(VAR_0);",
"qmp_output_pop(qov);",
"}"
] |
[
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
]
] |
6,398 |
static av_cold int MP3lame_encode_init(AVCodecContext *avctx)
{
Mp3AudioContext *s = avctx->priv_data;
if (avctx->channels > 2)
return -1;
s->stereo = avctx->channels > 1 ? 1 : 0;
if ((s->gfp = lame_init()) == NULL)
goto err;
lame_set_in_samplerate(s->gfp, avctx->sample_rate);
lame_set_out_samplerate(s->gfp, avctx->sample_rate);
lame_set_num_channels(s->gfp, avctx->channels);
if(avctx->compression_level == FF_COMPRESSION_DEFAULT) {
lame_set_quality(s->gfp, 5);
} else {
lame_set_quality(s->gfp, avctx->compression_level);
}
lame_set_mode(s->gfp, s->stereo ? JOINT_STEREO : MONO);
lame_set_brate(s->gfp, avctx->bit_rate/1000);
if(avctx->flags & CODEC_FLAG_QSCALE) {
lame_set_brate(s->gfp, 0);
lame_set_VBR(s->gfp, vbr_default);
lame_set_VBR_quality(s->gfp, avctx->global_quality/(float)FF_QP2LAMBDA);
}
lame_set_bWriteVbrTag(s->gfp,0);
#if FF_API_LAME_GLOBAL_OPTS
s->reservoir = avctx->flags2 & CODEC_FLAG2_BIT_RESERVOIR;
#endif
lame_set_disable_reservoir(s->gfp, !s->reservoir);
if (lame_init_params(s->gfp) < 0)
goto err_close;
avctx->frame_size = lame_get_framesize(s->gfp);
if(!(avctx->coded_frame= avcodec_alloc_frame())) {
lame_close(s->gfp);
return AVERROR(ENOMEM);
}
avctx->coded_frame->key_frame= 1;
if(AV_SAMPLE_FMT_S32 == avctx->sample_fmt && s->stereo) {
int nelem = 2 * avctx->frame_size;
if(! (s->s32_data.left = av_malloc(nelem * sizeof(int)))) {
av_freep(&avctx->coded_frame);
lame_close(s->gfp);
return AVERROR(ENOMEM);
}
s->s32_data.right = s->s32_data.left + avctx->frame_size;
}
return 0;
err_close:
lame_close(s->gfp);
err:
return -1;
}
| false |
FFmpeg
|
5b1a06b1c9c596b3c406ea632a252dcccbee25ed
|
static av_cold int MP3lame_encode_init(AVCodecContext *avctx)
{
Mp3AudioContext *s = avctx->priv_data;
if (avctx->channels > 2)
return -1;
s->stereo = avctx->channels > 1 ? 1 : 0;
if ((s->gfp = lame_init()) == NULL)
goto err;
lame_set_in_samplerate(s->gfp, avctx->sample_rate);
lame_set_out_samplerate(s->gfp, avctx->sample_rate);
lame_set_num_channels(s->gfp, avctx->channels);
if(avctx->compression_level == FF_COMPRESSION_DEFAULT) {
lame_set_quality(s->gfp, 5);
} else {
lame_set_quality(s->gfp, avctx->compression_level);
}
lame_set_mode(s->gfp, s->stereo ? JOINT_STEREO : MONO);
lame_set_brate(s->gfp, avctx->bit_rate/1000);
if(avctx->flags & CODEC_FLAG_QSCALE) {
lame_set_brate(s->gfp, 0);
lame_set_VBR(s->gfp, vbr_default);
lame_set_VBR_quality(s->gfp, avctx->global_quality/(float)FF_QP2LAMBDA);
}
lame_set_bWriteVbrTag(s->gfp,0);
#if FF_API_LAME_GLOBAL_OPTS
s->reservoir = avctx->flags2 & CODEC_FLAG2_BIT_RESERVOIR;
#endif
lame_set_disable_reservoir(s->gfp, !s->reservoir);
if (lame_init_params(s->gfp) < 0)
goto err_close;
avctx->frame_size = lame_get_framesize(s->gfp);
if(!(avctx->coded_frame= avcodec_alloc_frame())) {
lame_close(s->gfp);
return AVERROR(ENOMEM);
}
avctx->coded_frame->key_frame= 1;
if(AV_SAMPLE_FMT_S32 == avctx->sample_fmt && s->stereo) {
int nelem = 2 * avctx->frame_size;
if(! (s->s32_data.left = av_malloc(nelem * sizeof(int)))) {
av_freep(&avctx->coded_frame);
lame_close(s->gfp);
return AVERROR(ENOMEM);
}
s->s32_data.right = s->s32_data.left + avctx->frame_size;
}
return 0;
err_close:
lame_close(s->gfp);
err:
return -1;
}
|
{
"code": [],
"line_no": []
}
|
static av_cold int FUNC_0(AVCodecContext *avctx)
{
Mp3AudioContext *s = avctx->priv_data;
if (avctx->channels > 2)
return -1;
s->stereo = avctx->channels > 1 ? 1 : 0;
if ((s->gfp = lame_init()) == NULL)
goto err;
lame_set_in_samplerate(s->gfp, avctx->sample_rate);
lame_set_out_samplerate(s->gfp, avctx->sample_rate);
lame_set_num_channels(s->gfp, avctx->channels);
if(avctx->compression_level == FF_COMPRESSION_DEFAULT) {
lame_set_quality(s->gfp, 5);
} else {
lame_set_quality(s->gfp, avctx->compression_level);
}
lame_set_mode(s->gfp, s->stereo ? JOINT_STEREO : MONO);
lame_set_brate(s->gfp, avctx->bit_rate/1000);
if(avctx->flags & CODEC_FLAG_QSCALE) {
lame_set_brate(s->gfp, 0);
lame_set_VBR(s->gfp, vbr_default);
lame_set_VBR_quality(s->gfp, avctx->global_quality/(float)FF_QP2LAMBDA);
}
lame_set_bWriteVbrTag(s->gfp,0);
#if FF_API_LAME_GLOBAL_OPTS
s->reservoir = avctx->flags2 & CODEC_FLAG2_BIT_RESERVOIR;
#endif
lame_set_disable_reservoir(s->gfp, !s->reservoir);
if (lame_init_params(s->gfp) < 0)
goto err_close;
avctx->frame_size = lame_get_framesize(s->gfp);
if(!(avctx->coded_frame= avcodec_alloc_frame())) {
lame_close(s->gfp);
return AVERROR(ENOMEM);
}
avctx->coded_frame->key_frame= 1;
if(AV_SAMPLE_FMT_S32 == avctx->sample_fmt && s->stereo) {
int VAR_0 = 2 * avctx->frame_size;
if(! (s->s32_data.left = av_malloc(VAR_0 * sizeof(int)))) {
av_freep(&avctx->coded_frame);
lame_close(s->gfp);
return AVERROR(ENOMEM);
}
s->s32_data.right = s->s32_data.left + avctx->frame_size;
}
return 0;
err_close:
lame_close(s->gfp);
err:
return -1;
}
|
[
"static av_cold int FUNC_0(AVCodecContext *avctx)\n{",
"Mp3AudioContext *s = avctx->priv_data;",
"if (avctx->channels > 2)\nreturn -1;",
"s->stereo = avctx->channels > 1 ? 1 : 0;",
"if ((s->gfp = lame_init()) == NULL)\ngoto err;",
"lame_set_in_samplerate(s->gfp, avctx->sample_rate);",
"lame_set_out_samplerate(s->gfp, avctx->sample_rate);",
"lame_set_num_channels(s->gfp, avctx->channels);",
"if(avctx->compression_level == FF_COMPRESSION_DEFAULT) {",
"lame_set_quality(s->gfp, 5);",
"} else {",
"lame_set_quality(s->gfp, avctx->compression_level);",
"}",
"lame_set_mode(s->gfp, s->stereo ? JOINT_STEREO : MONO);",
"lame_set_brate(s->gfp, avctx->bit_rate/1000);",
"if(avctx->flags & CODEC_FLAG_QSCALE) {",
"lame_set_brate(s->gfp, 0);",
"lame_set_VBR(s->gfp, vbr_default);",
"lame_set_VBR_quality(s->gfp, avctx->global_quality/(float)FF_QP2LAMBDA);",
"}",
"lame_set_bWriteVbrTag(s->gfp,0);",
"#if FF_API_LAME_GLOBAL_OPTS\ns->reservoir = avctx->flags2 & CODEC_FLAG2_BIT_RESERVOIR;",
"#endif\nlame_set_disable_reservoir(s->gfp, !s->reservoir);",
"if (lame_init_params(s->gfp) < 0)\ngoto err_close;",
"avctx->frame_size = lame_get_framesize(s->gfp);",
"if(!(avctx->coded_frame= avcodec_alloc_frame())) {",
"lame_close(s->gfp);",
"return AVERROR(ENOMEM);",
"}",
"avctx->coded_frame->key_frame= 1;",
"if(AV_SAMPLE_FMT_S32 == avctx->sample_fmt && s->stereo) {",
"int VAR_0 = 2 * avctx->frame_size;",
"if(! (s->s32_data.left = av_malloc(VAR_0 * sizeof(int)))) {",
"av_freep(&avctx->coded_frame);",
"lame_close(s->gfp);",
"return AVERROR(ENOMEM);",
"}",
"s->s32_data.right = s->s32_data.left + avctx->frame_size;",
"}",
"return 0;",
"err_close:\nlame_close(s->gfp);",
"err:\nreturn -1;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
9,
11
],
[
15
],
[
19,
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55,
57
],
[
59,
61
],
[
63,
65
],
[
69
],
[
73
],
[
75
],
[
79
],
[
81
],
[
83
],
[
87
],
[
89
],
[
93
],
[
95
],
[
97
],
[
101
],
[
103
],
[
107
],
[
109
],
[
113
],
[
117,
119
],
[
121,
123
],
[
125
]
] |
6,399 |
static void string_cleanup(void *datap)
{
StringSerializeData *d = datap;
visit_free(string_output_get_visitor(d->sov));
visit_free(d->siv);
g_free(d->string);
g_free(d);
}
| false |
qemu
|
3b098d56979d2f7fd707c5be85555d114353a28d
|
static void string_cleanup(void *datap)
{
StringSerializeData *d = datap;
visit_free(string_output_get_visitor(d->sov));
visit_free(d->siv);
g_free(d->string);
g_free(d);
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(void *VAR_0)
{
StringSerializeData *d = VAR_0;
visit_free(string_output_get_visitor(d->sov));
visit_free(d->siv);
g_free(d->string);
g_free(d);
}
|
[
"static void FUNC_0(void *VAR_0)\n{",
"StringSerializeData *d = VAR_0;",
"visit_free(string_output_get_visitor(d->sov));",
"visit_free(d->siv);",
"g_free(d->string);",
"g_free(d);",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
]
] |
6,400 |
static int n8x0_atag_setup(void *p, int model)
{
uint8_t *b;
uint16_t *w;
uint32_t *l;
struct omap_gpiosw_info_s *gpiosw;
struct omap_partition_info_s *partition;
const char *tag;
w = p;
stw_p(w++, OMAP_TAG_UART); /* u16 tag */
stw_p(w++, 4); /* u16 len */
stw_p(w++, (1 << 2) | (1 << 1) | (1 << 0)); /* uint enabled_uarts */
w++;
#if 0
stw_p(w++, OMAP_TAG_SERIAL_CONSOLE); /* u16 tag */
stw_p(w++, 4); /* u16 len */
stw_p(w++, XLDR_LL_UART + 1); /* u8 console_uart */
stw_p(w++, 115200); /* u32 console_speed */
#endif
stw_p(w++, OMAP_TAG_LCD); /* u16 tag */
stw_p(w++, 36); /* u16 len */
strcpy((void *) w, "QEMU LCD panel"); /* char panel_name[16] */
w += 8;
strcpy((void *) w, "blizzard"); /* char ctrl_name[16] */
w += 8;
stw_p(w++, N810_BLIZZARD_RESET_GPIO); /* TODO: n800 s16 nreset_gpio */
stw_p(w++, 24); /* u8 data_lines */
stw_p(w++, OMAP_TAG_CBUS); /* u16 tag */
stw_p(w++, 8); /* u16 len */
stw_p(w++, N8X0_CBUS_CLK_GPIO); /* s16 clk_gpio */
stw_p(w++, N8X0_CBUS_DAT_GPIO); /* s16 dat_gpio */
stw_p(w++, N8X0_CBUS_SEL_GPIO); /* s16 sel_gpio */
w++;
stw_p(w++, OMAP_TAG_EM_ASIC_BB5); /* u16 tag */
stw_p(w++, 4); /* u16 len */
stw_p(w++, N8X0_RETU_GPIO); /* s16 retu_irq_gpio */
stw_p(w++, N8X0_TAHVO_GPIO); /* s16 tahvo_irq_gpio */
gpiosw = (model == 810) ? n810_gpiosw_info : n800_gpiosw_info;
for (; gpiosw->name; gpiosw++) {
stw_p(w++, OMAP_TAG_GPIO_SWITCH); /* u16 tag */
stw_p(w++, 20); /* u16 len */
strcpy((void *) w, gpiosw->name); /* char name[12] */
w += 6;
stw_p(w++, gpiosw->line); /* u16 gpio */
stw_p(w++, gpiosw->type);
stw_p(w++, 0);
stw_p(w++, 0);
}
stw_p(w++, OMAP_TAG_NOKIA_BT); /* u16 tag */
stw_p(w++, 12); /* u16 len */
b = (void *) w;
stb_p(b++, 0x01); /* u8 chip_type (CSR) */
stb_p(b++, N8X0_BT_WKUP_GPIO); /* u8 bt_wakeup_gpio */
stb_p(b++, N8X0_BT_HOST_WKUP_GPIO); /* u8 host_wakeup_gpio */
stb_p(b++, N8X0_BT_RESET_GPIO); /* u8 reset_gpio */
stb_p(b++, BT_UART + 1); /* u8 bt_uart */
memcpy(b, &n8x0_bd_addr, 6); /* u8 bd_addr[6] */
b += 6;
stb_p(b++, 0x02); /* u8 bt_sysclk (38.4) */
w = (void *) b;
stw_p(w++, OMAP_TAG_WLAN_CX3110X); /* u16 tag */
stw_p(w++, 8); /* u16 len */
stw_p(w++, 0x25); /* u8 chip_type */
stw_p(w++, N8X0_WLAN_PWR_GPIO); /* s16 power_gpio */
stw_p(w++, N8X0_WLAN_IRQ_GPIO); /* s16 irq_gpio */
stw_p(w++, -1); /* s16 spi_cs_gpio */
stw_p(w++, OMAP_TAG_MMC); /* u16 tag */
stw_p(w++, 16); /* u16 len */
if (model == 810) {
stw_p(w++, 0x23f); /* unsigned flags */
stw_p(w++, -1); /* s16 power_pin */
stw_p(w++, -1); /* s16 switch_pin */
stw_p(w++, -1); /* s16 wp_pin */
stw_p(w++, 0x240); /* unsigned flags */
stw_p(w++, 0xc000); /* s16 power_pin */
stw_p(w++, 0x0248); /* s16 switch_pin */
stw_p(w++, 0xc000); /* s16 wp_pin */
} else {
stw_p(w++, 0xf); /* unsigned flags */
stw_p(w++, -1); /* s16 power_pin */
stw_p(w++, -1); /* s16 switch_pin */
stw_p(w++, -1); /* s16 wp_pin */
stw_p(w++, 0); /* unsigned flags */
stw_p(w++, 0); /* s16 power_pin */
stw_p(w++, 0); /* s16 switch_pin */
stw_p(w++, 0); /* s16 wp_pin */
}
stw_p(w++, OMAP_TAG_TEA5761); /* u16 tag */
stw_p(w++, 4); /* u16 len */
stw_p(w++, N8X0_TEA5761_CS_GPIO); /* u16 enable_gpio */
w++;
partition = (model == 810) ? n810_part_info : n800_part_info;
for (; partition->name; partition++) {
stw_p(w++, OMAP_TAG_PARTITION); /* u16 tag */
stw_p(w++, 28); /* u16 len */
strcpy((void *) w, partition->name); /* char name[16] */
l = (void *) (w + 8);
stl_p(l++, partition->size); /* unsigned int size */
stl_p(l++, partition->offset); /* unsigned int offset */
stl_p(l++, partition->mask); /* unsigned int mask_flags */
w = (void *) l;
}
stw_p(w++, OMAP_TAG_BOOT_REASON); /* u16 tag */
stw_p(w++, 12); /* u16 len */
#if 0
strcpy((void *) w, "por"); /* char reason_str[12] */
strcpy((void *) w, "charger"); /* char reason_str[12] */
strcpy((void *) w, "32wd_to"); /* char reason_str[12] */
strcpy((void *) w, "sw_rst"); /* char reason_str[12] */
strcpy((void *) w, "mbus"); /* char reason_str[12] */
strcpy((void *) w, "unknown"); /* char reason_str[12] */
strcpy((void *) w, "swdg_to"); /* char reason_str[12] */
strcpy((void *) w, "sec_vio"); /* char reason_str[12] */
strcpy((void *) w, "pwr_key"); /* char reason_str[12] */
strcpy((void *) w, "rtc_alarm"); /* char reason_str[12] */
#else
strcpy((void *) w, "pwr_key"); /* char reason_str[12] */
#endif
w += 6;
tag = (model == 810) ? "RX-44" : "RX-34";
stw_p(w++, OMAP_TAG_VERSION_STR); /* u16 tag */
stw_p(w++, 24); /* u16 len */
strcpy((void *) w, "product"); /* char component[12] */
w += 6;
strcpy((void *) w, tag); /* char version[12] */
w += 6;
stw_p(w++, OMAP_TAG_VERSION_STR); /* u16 tag */
stw_p(w++, 24); /* u16 len */
strcpy((void *) w, "hw-build"); /* char component[12] */
w += 6;
strcpy((void *) w, "QEMU ");
pstrcat((void *) w, 12, qemu_get_version()); /* char version[12] */
w += 6;
tag = (model == 810) ? "1.1.10-qemu" : "1.1.6-qemu";
stw_p(w++, OMAP_TAG_VERSION_STR); /* u16 tag */
stw_p(w++, 24); /* u16 len */
strcpy((void *) w, "nolo"); /* char component[12] */
w += 6;
strcpy((void *) w, tag); /* char version[12] */
w += 6;
return (void *) w - p;
}
| false |
qemu
|
35c2c8dc8c0899882a8e0d349d93bd657772f1e7
|
static int n8x0_atag_setup(void *p, int model)
{
uint8_t *b;
uint16_t *w;
uint32_t *l;
struct omap_gpiosw_info_s *gpiosw;
struct omap_partition_info_s *partition;
const char *tag;
w = p;
stw_p(w++, OMAP_TAG_UART);
stw_p(w++, 4);
stw_p(w++, (1 << 2) | (1 << 1) | (1 << 0));
w++;
#if 0
stw_p(w++, OMAP_TAG_SERIAL_CONSOLE);
stw_p(w++, 4);
stw_p(w++, XLDR_LL_UART + 1);
stw_p(w++, 115200);
#endif
stw_p(w++, OMAP_TAG_LCD);
stw_p(w++, 36);
strcpy((void *) w, "QEMU LCD panel");
w += 8;
strcpy((void *) w, "blizzard");
w += 8;
stw_p(w++, N810_BLIZZARD_RESET_GPIO);
stw_p(w++, 24);
stw_p(w++, OMAP_TAG_CBUS);
stw_p(w++, 8);
stw_p(w++, N8X0_CBUS_CLK_GPIO);
stw_p(w++, N8X0_CBUS_DAT_GPIO);
stw_p(w++, N8X0_CBUS_SEL_GPIO);
w++;
stw_p(w++, OMAP_TAG_EM_ASIC_BB5);
stw_p(w++, 4);
stw_p(w++, N8X0_RETU_GPIO);
stw_p(w++, N8X0_TAHVO_GPIO);
gpiosw = (model == 810) ? n810_gpiosw_info : n800_gpiosw_info;
for (; gpiosw->name; gpiosw++) {
stw_p(w++, OMAP_TAG_GPIO_SWITCH);
stw_p(w++, 20);
strcpy((void *) w, gpiosw->name);
w += 6;
stw_p(w++, gpiosw->line);
stw_p(w++, gpiosw->type);
stw_p(w++, 0);
stw_p(w++, 0);
}
stw_p(w++, OMAP_TAG_NOKIA_BT);
stw_p(w++, 12);
b = (void *) w;
stb_p(b++, 0x01);
stb_p(b++, N8X0_BT_WKUP_GPIO);
stb_p(b++, N8X0_BT_HOST_WKUP_GPIO);
stb_p(b++, N8X0_BT_RESET_GPIO);
stb_p(b++, BT_UART + 1);
memcpy(b, &n8x0_bd_addr, 6);
b += 6;
stb_p(b++, 0x02);
w = (void *) b;
stw_p(w++, OMAP_TAG_WLAN_CX3110X);
stw_p(w++, 8);
stw_p(w++, 0x25);
stw_p(w++, N8X0_WLAN_PWR_GPIO);
stw_p(w++, N8X0_WLAN_IRQ_GPIO);
stw_p(w++, -1);
stw_p(w++, OMAP_TAG_MMC);
stw_p(w++, 16);
if (model == 810) {
stw_p(w++, 0x23f);
stw_p(w++, -1);
stw_p(w++, -1);
stw_p(w++, -1);
stw_p(w++, 0x240);
stw_p(w++, 0xc000);
stw_p(w++, 0x0248);
stw_p(w++, 0xc000);
} else {
stw_p(w++, 0xf);
stw_p(w++, -1);
stw_p(w++, -1);
stw_p(w++, -1);
stw_p(w++, 0);
stw_p(w++, 0);
stw_p(w++, 0);
stw_p(w++, 0);
}
stw_p(w++, OMAP_TAG_TEA5761);
stw_p(w++, 4);
stw_p(w++, N8X0_TEA5761_CS_GPIO);
w++;
partition = (model == 810) ? n810_part_info : n800_part_info;
for (; partition->name; partition++) {
stw_p(w++, OMAP_TAG_PARTITION);
stw_p(w++, 28);
strcpy((void *) w, partition->name);
l = (void *) (w + 8);
stl_p(l++, partition->size);
stl_p(l++, partition->offset);
stl_p(l++, partition->mask);
w = (void *) l;
}
stw_p(w++, OMAP_TAG_BOOT_REASON);
stw_p(w++, 12);
#if 0
strcpy((void *) w, "por");
strcpy((void *) w, "charger");
strcpy((void *) w, "32wd_to");
strcpy((void *) w, "sw_rst");
strcpy((void *) w, "mbus");
strcpy((void *) w, "unknown");
strcpy((void *) w, "swdg_to");
strcpy((void *) w, "sec_vio");
strcpy((void *) w, "pwr_key");
strcpy((void *) w, "rtc_alarm");
#else
strcpy((void *) w, "pwr_key");
#endif
w += 6;
tag = (model == 810) ? "RX-44" : "RX-34";
stw_p(w++, OMAP_TAG_VERSION_STR);
stw_p(w++, 24);
strcpy((void *) w, "product");
w += 6;
strcpy((void *) w, tag);
w += 6;
stw_p(w++, OMAP_TAG_VERSION_STR);
stw_p(w++, 24);
strcpy((void *) w, "hw-build");
w += 6;
strcpy((void *) w, "QEMU ");
pstrcat((void *) w, 12, qemu_get_version());
w += 6;
tag = (model == 810) ? "1.1.10-qemu" : "1.1.6-qemu";
stw_p(w++, OMAP_TAG_VERSION_STR);
stw_p(w++, 24);
strcpy((void *) w, "nolo");
w += 6;
strcpy((void *) w, tag);
w += 6;
return (void *) w - p;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(void *VAR_0, int VAR_1)
{
uint8_t *b;
uint16_t *w;
uint32_t *l;
struct omap_gpiosw_info_s *VAR_2;
struct omap_partition_info_s *VAR_3;
const char *VAR_4;
w = VAR_0;
stw_p(w++, OMAP_TAG_UART);
stw_p(w++, 4);
stw_p(w++, (1 << 2) | (1 << 1) | (1 << 0));
w++;
#if 0
stw_p(w++, OMAP_TAG_SERIAL_CONSOLE);
stw_p(w++, 4);
stw_p(w++, XLDR_LL_UART + 1);
stw_p(w++, 115200);
#endif
stw_p(w++, OMAP_TAG_LCD);
stw_p(w++, 36);
strcpy((void *) w, "QEMU LCD panel");
w += 8;
strcpy((void *) w, "blizzard");
w += 8;
stw_p(w++, N810_BLIZZARD_RESET_GPIO);
stw_p(w++, 24);
stw_p(w++, OMAP_TAG_CBUS);
stw_p(w++, 8);
stw_p(w++, N8X0_CBUS_CLK_GPIO);
stw_p(w++, N8X0_CBUS_DAT_GPIO);
stw_p(w++, N8X0_CBUS_SEL_GPIO);
w++;
stw_p(w++, OMAP_TAG_EM_ASIC_BB5);
stw_p(w++, 4);
stw_p(w++, N8X0_RETU_GPIO);
stw_p(w++, N8X0_TAHVO_GPIO);
VAR_2 = (VAR_1 == 810) ? n810_gpiosw_info : n800_gpiosw_info;
for (; VAR_2->name; VAR_2++) {
stw_p(w++, OMAP_TAG_GPIO_SWITCH);
stw_p(w++, 20);
strcpy((void *) w, VAR_2->name);
w += 6;
stw_p(w++, VAR_2->line);
stw_p(w++, VAR_2->type);
stw_p(w++, 0);
stw_p(w++, 0);
}
stw_p(w++, OMAP_TAG_NOKIA_BT);
stw_p(w++, 12);
b = (void *) w;
stb_p(b++, 0x01);
stb_p(b++, N8X0_BT_WKUP_GPIO);
stb_p(b++, N8X0_BT_HOST_WKUP_GPIO);
stb_p(b++, N8X0_BT_RESET_GPIO);
stb_p(b++, BT_UART + 1);
memcpy(b, &n8x0_bd_addr, 6);
b += 6;
stb_p(b++, 0x02);
w = (void *) b;
stw_p(w++, OMAP_TAG_WLAN_CX3110X);
stw_p(w++, 8);
stw_p(w++, 0x25);
stw_p(w++, N8X0_WLAN_PWR_GPIO);
stw_p(w++, N8X0_WLAN_IRQ_GPIO);
stw_p(w++, -1);
stw_p(w++, OMAP_TAG_MMC);
stw_p(w++, 16);
if (VAR_1 == 810) {
stw_p(w++, 0x23f);
stw_p(w++, -1);
stw_p(w++, -1);
stw_p(w++, -1);
stw_p(w++, 0x240);
stw_p(w++, 0xc000);
stw_p(w++, 0x0248);
stw_p(w++, 0xc000);
} else {
stw_p(w++, 0xf);
stw_p(w++, -1);
stw_p(w++, -1);
stw_p(w++, -1);
stw_p(w++, 0);
stw_p(w++, 0);
stw_p(w++, 0);
stw_p(w++, 0);
}
stw_p(w++, OMAP_TAG_TEA5761);
stw_p(w++, 4);
stw_p(w++, N8X0_TEA5761_CS_GPIO);
w++;
VAR_3 = (VAR_1 == 810) ? n810_part_info : n800_part_info;
for (; VAR_3->name; VAR_3++) {
stw_p(w++, OMAP_TAG_PARTITION);
stw_p(w++, 28);
strcpy((void *) w, VAR_3->name);
l = (void *) (w + 8);
stl_p(l++, VAR_3->size);
stl_p(l++, VAR_3->offset);
stl_p(l++, VAR_3->mask);
w = (void *) l;
}
stw_p(w++, OMAP_TAG_BOOT_REASON);
stw_p(w++, 12);
#if 0
strcpy((void *) w, "por");
strcpy((void *) w, "charger");
strcpy((void *) w, "32wd_to");
strcpy((void *) w, "sw_rst");
strcpy((void *) w, "mbus");
strcpy((void *) w, "unknown");
strcpy((void *) w, "swdg_to");
strcpy((void *) w, "sec_vio");
strcpy((void *) w, "pwr_key");
strcpy((void *) w, "rtc_alarm");
#else
strcpy((void *) w, "pwr_key");
#endif
w += 6;
VAR_4 = (VAR_1 == 810) ? "RX-44" : "RX-34";
stw_p(w++, OMAP_TAG_VERSION_STR);
stw_p(w++, 24);
strcpy((void *) w, "product");
w += 6;
strcpy((void *) w, VAR_4);
w += 6;
stw_p(w++, OMAP_TAG_VERSION_STR);
stw_p(w++, 24);
strcpy((void *) w, "hw-build");
w += 6;
strcpy((void *) w, "QEMU ");
pstrcat((void *) w, 12, qemu_get_version());
w += 6;
VAR_4 = (VAR_1 == 810) ? "1.1.10-qemu" : "1.1.6-qemu";
stw_p(w++, OMAP_TAG_VERSION_STR);
stw_p(w++, 24);
strcpy((void *) w, "nolo");
w += 6;
strcpy((void *) w, VAR_4);
w += 6;
return (void *) w - VAR_0;
}
|
[
"static int FUNC_0(void *VAR_0, int VAR_1)\n{",
"uint8_t *b;",
"uint16_t *w;",
"uint32_t *l;",
"struct omap_gpiosw_info_s *VAR_2;",
"struct omap_partition_info_s *VAR_3;",
"const char *VAR_4;",
"w = VAR_0;",
"stw_p(w++, OMAP_TAG_UART);",
"stw_p(w++, 4);",
"stw_p(w++, (1 << 2) | (1 << 1) | (1 << 0));",
"w++;",
"#if 0\nstw_p(w++, OMAP_TAG_SERIAL_CONSOLE);",
"stw_p(w++, 4);",
"stw_p(w++, XLDR_LL_UART + 1);",
"stw_p(w++, 115200);",
"#endif\nstw_p(w++, OMAP_TAG_LCD);",
"stw_p(w++, 36);",
"strcpy((void *) w, \"QEMU LCD panel\");",
"w += 8;",
"strcpy((void *) w, \"blizzard\");",
"w += 8;",
"stw_p(w++, N810_BLIZZARD_RESET_GPIO);",
"stw_p(w++, 24);",
"stw_p(w++, OMAP_TAG_CBUS);",
"stw_p(w++, 8);",
"stw_p(w++, N8X0_CBUS_CLK_GPIO);",
"stw_p(w++, N8X0_CBUS_DAT_GPIO);",
"stw_p(w++, N8X0_CBUS_SEL_GPIO);",
"w++;",
"stw_p(w++, OMAP_TAG_EM_ASIC_BB5);",
"stw_p(w++, 4);",
"stw_p(w++, N8X0_RETU_GPIO);",
"stw_p(w++, N8X0_TAHVO_GPIO);",
"VAR_2 = (VAR_1 == 810) ? n810_gpiosw_info : n800_gpiosw_info;",
"for (; VAR_2->name; VAR_2++) {",
"stw_p(w++, OMAP_TAG_GPIO_SWITCH);",
"stw_p(w++, 20);",
"strcpy((void *) w, VAR_2->name);",
"w += 6;",
"stw_p(w++, VAR_2->line);",
"stw_p(w++, VAR_2->type);",
"stw_p(w++, 0);",
"stw_p(w++, 0);",
"}",
"stw_p(w++, OMAP_TAG_NOKIA_BT);",
"stw_p(w++, 12);",
"b = (void *) w;",
"stb_p(b++, 0x01);",
"stb_p(b++, N8X0_BT_WKUP_GPIO);",
"stb_p(b++, N8X0_BT_HOST_WKUP_GPIO);",
"stb_p(b++, N8X0_BT_RESET_GPIO);",
"stb_p(b++, BT_UART + 1);",
"memcpy(b, &n8x0_bd_addr, 6);",
"b += 6;",
"stb_p(b++, 0x02);",
"w = (void *) b;",
"stw_p(w++, OMAP_TAG_WLAN_CX3110X);",
"stw_p(w++, 8);",
"stw_p(w++, 0x25);",
"stw_p(w++, N8X0_WLAN_PWR_GPIO);",
"stw_p(w++, N8X0_WLAN_IRQ_GPIO);",
"stw_p(w++, -1);",
"stw_p(w++, OMAP_TAG_MMC);",
"stw_p(w++, 16);",
"if (VAR_1 == 810) {",
"stw_p(w++, 0x23f);",
"stw_p(w++, -1);",
"stw_p(w++, -1);",
"stw_p(w++, -1);",
"stw_p(w++, 0x240);",
"stw_p(w++, 0xc000);",
"stw_p(w++, 0x0248);",
"stw_p(w++, 0xc000);",
"} else {",
"stw_p(w++, 0xf);",
"stw_p(w++, -1);",
"stw_p(w++, -1);",
"stw_p(w++, -1);",
"stw_p(w++, 0);",
"stw_p(w++, 0);",
"stw_p(w++, 0);",
"stw_p(w++, 0);",
"}",
"stw_p(w++, OMAP_TAG_TEA5761);",
"stw_p(w++, 4);",
"stw_p(w++, N8X0_TEA5761_CS_GPIO);",
"w++;",
"VAR_3 = (VAR_1 == 810) ? n810_part_info : n800_part_info;",
"for (; VAR_3->name; VAR_3++) {",
"stw_p(w++, OMAP_TAG_PARTITION);",
"stw_p(w++, 28);",
"strcpy((void *) w, VAR_3->name);",
"l = (void *) (w + 8);",
"stl_p(l++, VAR_3->size);",
"stl_p(l++, VAR_3->offset);",
"stl_p(l++, VAR_3->mask);",
"w = (void *) l;",
"}",
"stw_p(w++, OMAP_TAG_BOOT_REASON);",
"stw_p(w++, 12);",
"#if 0\nstrcpy((void *) w, \"por\");",
"strcpy((void *) w, \"charger\");",
"strcpy((void *) w, \"32wd_to\");",
"strcpy((void *) w, \"sw_rst\");",
"strcpy((void *) w, \"mbus\");",
"strcpy((void *) w, \"unknown\");",
"strcpy((void *) w, \"swdg_to\");",
"strcpy((void *) w, \"sec_vio\");",
"strcpy((void *) w, \"pwr_key\");",
"strcpy((void *) w, \"rtc_alarm\");",
"#else\nstrcpy((void *) w, \"pwr_key\");",
"#endif\nw += 6;",
"VAR_4 = (VAR_1 == 810) ? \"RX-44\" : \"RX-34\";",
"stw_p(w++, OMAP_TAG_VERSION_STR);",
"stw_p(w++, 24);",
"strcpy((void *) w, \"product\");",
"w += 6;",
"strcpy((void *) w, VAR_4);",
"w += 6;",
"stw_p(w++, OMAP_TAG_VERSION_STR);",
"stw_p(w++, 24);",
"strcpy((void *) w, \"hw-build\");",
"w += 6;",
"strcpy((void *) w, \"QEMU \");",
"pstrcat((void *) w, 12, qemu_get_version());",
"w += 6;",
"VAR_4 = (VAR_1 == 810) ? \"1.1.10-qemu\" : \"1.1.6-qemu\";",
"stw_p(w++, OMAP_TAG_VERSION_STR);",
"stw_p(w++, 24);",
"strcpy((void *) w, \"nolo\");",
"w += 6;",
"strcpy((void *) w, VAR_4);",
"w += 6;",
"return (void *) w - VAR_0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
33,
35
],
[
37
],
[
39
],
[
41
],
[
43,
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
79
],
[
81
],
[
83
],
[
85
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149
],
[
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
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
],
[
219
],
[
221
],
[
223
],
[
225
],
[
227
],
[
231
],
[
233
],
[
235,
237
],
[
239
],
[
241
],
[
243
],
[
245
],
[
247
],
[
249
],
[
251
],
[
253
],
[
255
],
[
257,
259
],
[
261,
263
],
[
267
],
[
269
],
[
271
],
[
273
],
[
275
],
[
277
],
[
279
],
[
283
],
[
285
],
[
287
],
[
289
],
[
291
],
[
293
],
[
295
],
[
299
],
[
301
],
[
303
],
[
305
],
[
307
],
[
309
],
[
311
],
[
315
],
[
317
]
] |
6,402 |
vdi_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes,
QEMUIOVector *qiov, int flags)
{
BDRVVdiState *s = bs->opaque;
QEMUIOVector local_qiov;
uint32_t bmap_entry;
uint32_t block_index;
uint32_t offset_in_block;
uint32_t n_bytes;
uint64_t bytes_done = 0;
int ret = 0;
logout("\n");
qemu_iovec_init(&local_qiov, qiov->niov);
while (ret >= 0 && bytes > 0) {
block_index = offset / s->block_size;
offset_in_block = offset % s->block_size;
n_bytes = MIN(bytes, s->block_size - offset_in_block);
logout("will read %u bytes starting at offset %" PRIu64 "\n",
n_bytes, offset);
/* prepare next AIO request */
bmap_entry = le32_to_cpu(s->bmap[block_index]);
if (!VDI_IS_ALLOCATED(bmap_entry)) {
/* Block not allocated, return zeros, no need to wait. */
qemu_iovec_memset(qiov, bytes_done, 0, n_bytes);
ret = 0;
} else {
uint64_t data_offset = s->header.offset_data +
(uint64_t)bmap_entry * s->block_size +
offset_in_block;
qemu_iovec_reset(&local_qiov);
qemu_iovec_concat(&local_qiov, qiov, bytes_done, n_bytes);
ret = bdrv_co_preadv(bs->file->bs, data_offset, n_bytes,
&local_qiov, 0);
}
logout("%u bytes read\n", n_bytes);
bytes -= n_bytes;
offset += n_bytes;
bytes_done += n_bytes;
}
qemu_iovec_destroy(&local_qiov);
return ret;
}
| false |
qemu
|
a03ef88f77af045a2eb9629b5ce774a3fb973c5e
|
vdi_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes,
QEMUIOVector *qiov, int flags)
{
BDRVVdiState *s = bs->opaque;
QEMUIOVector local_qiov;
uint32_t bmap_entry;
uint32_t block_index;
uint32_t offset_in_block;
uint32_t n_bytes;
uint64_t bytes_done = 0;
int ret = 0;
logout("\n");
qemu_iovec_init(&local_qiov, qiov->niov);
while (ret >= 0 && bytes > 0) {
block_index = offset / s->block_size;
offset_in_block = offset % s->block_size;
n_bytes = MIN(bytes, s->block_size - offset_in_block);
logout("will read %u bytes starting at offset %" PRIu64 "\n",
n_bytes, offset);
bmap_entry = le32_to_cpu(s->bmap[block_index]);
if (!VDI_IS_ALLOCATED(bmap_entry)) {
qemu_iovec_memset(qiov, bytes_done, 0, n_bytes);
ret = 0;
} else {
uint64_t data_offset = s->header.offset_data +
(uint64_t)bmap_entry * s->block_size +
offset_in_block;
qemu_iovec_reset(&local_qiov);
qemu_iovec_concat(&local_qiov, qiov, bytes_done, n_bytes);
ret = bdrv_co_preadv(bs->file->bs, data_offset, n_bytes,
&local_qiov, 0);
}
logout("%u bytes read\n", n_bytes);
bytes -= n_bytes;
offset += n_bytes;
bytes_done += n_bytes;
}
qemu_iovec_destroy(&local_qiov);
return ret;
}
|
{
"code": [],
"line_no": []
}
|
FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1, uint64_t VAR_2,
QEMUIOVector *VAR_3, int VAR_4)
{
BDRVVdiState *s = VAR_0->opaque;
QEMUIOVector local_qiov;
uint32_t bmap_entry;
uint32_t block_index;
uint32_t offset_in_block;
uint32_t n_bytes;
uint64_t bytes_done = 0;
int VAR_5 = 0;
logout("\n");
qemu_iovec_init(&local_qiov, VAR_3->niov);
while (VAR_5 >= 0 && VAR_2 > 0) {
block_index = VAR_1 / s->block_size;
offset_in_block = VAR_1 % s->block_size;
n_bytes = MIN(VAR_2, s->block_size - offset_in_block);
logout("will read %u VAR_2 starting at VAR_1 %" PRIu64 "\n",
n_bytes, VAR_1);
bmap_entry = le32_to_cpu(s->bmap[block_index]);
if (!VDI_IS_ALLOCATED(bmap_entry)) {
qemu_iovec_memset(VAR_3, bytes_done, 0, n_bytes);
VAR_5 = 0;
} else {
uint64_t data_offset = s->header.offset_data +
(uint64_t)bmap_entry * s->block_size +
offset_in_block;
qemu_iovec_reset(&local_qiov);
qemu_iovec_concat(&local_qiov, VAR_3, bytes_done, n_bytes);
VAR_5 = bdrv_co_preadv(VAR_0->file->VAR_0, data_offset, n_bytes,
&local_qiov, 0);
}
logout("%u VAR_2 read\n", n_bytes);
VAR_2 -= n_bytes;
VAR_1 += n_bytes;
bytes_done += n_bytes;
}
qemu_iovec_destroy(&local_qiov);
return VAR_5;
}
|
[
"FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1, uint64_t VAR_2,\nQEMUIOVector *VAR_3, int VAR_4)\n{",
"BDRVVdiState *s = VAR_0->opaque;",
"QEMUIOVector local_qiov;",
"uint32_t bmap_entry;",
"uint32_t block_index;",
"uint32_t offset_in_block;",
"uint32_t n_bytes;",
"uint64_t bytes_done = 0;",
"int VAR_5 = 0;",
"logout(\"\\n\");",
"qemu_iovec_init(&local_qiov, VAR_3->niov);",
"while (VAR_5 >= 0 && VAR_2 > 0) {",
"block_index = VAR_1 / s->block_size;",
"offset_in_block = VAR_1 % s->block_size;",
"n_bytes = MIN(VAR_2, s->block_size - offset_in_block);",
"logout(\"will read %u VAR_2 starting at VAR_1 %\" PRIu64 \"\\n\",\nn_bytes, VAR_1);",
"bmap_entry = le32_to_cpu(s->bmap[block_index]);",
"if (!VDI_IS_ALLOCATED(bmap_entry)) {",
"qemu_iovec_memset(VAR_3, bytes_done, 0, n_bytes);",
"VAR_5 = 0;",
"} else {",
"uint64_t data_offset = s->header.offset_data +\n(uint64_t)bmap_entry * s->block_size +\noffset_in_block;",
"qemu_iovec_reset(&local_qiov);",
"qemu_iovec_concat(&local_qiov, VAR_3, bytes_done, n_bytes);",
"VAR_5 = bdrv_co_preadv(VAR_0->file->VAR_0, data_offset, n_bytes,\n&local_qiov, 0);",
"}",
"logout(\"%u VAR_2 read\\n\", n_bytes);",
"VAR_2 -= n_bytes;",
"VAR_1 += n_bytes;",
"bytes_done += n_bytes;",
"}",
"qemu_iovec_destroy(&local_qiov);",
"return VAR_5;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
25
],
[
29
],
[
33
],
[
35
],
[
37
],
[
39
],
[
43,
45
],
[
51
],
[
53
],
[
57
],
[
59
],
[
61
],
[
63,
65,
67
],
[
71
],
[
73
],
[
77,
79
],
[
81
],
[
83
],
[
87
],
[
89
],
[
91
],
[
93
],
[
97
],
[
101
],
[
103
]
] |
6,403 |
static void spapr_core_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
Error **errp)
{
sPAPRMachineState *spapr = SPAPR_MACHINE(OBJECT(hotplug_dev));
MachineClass *mc = MACHINE_GET_CLASS(spapr);
sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
sPAPRCPUCore *core = SPAPR_CPU_CORE(OBJECT(dev));
CPUCore *cc = CPU_CORE(dev);
CPUState *cs = CPU(core->threads);
sPAPRDRConnector *drc;
Error *local_err = NULL;
void *fdt = NULL;
int fdt_offset = 0;
int smt = kvmppc_smt_threads();
CPUArchId *core_slot;
int index;
core_slot = spapr_find_cpu_slot(MACHINE(hotplug_dev), cc->core_id, &index);
if (!core_slot) {
error_setg(errp, "Unable to find CPU core with core-id: %d",
cc->core_id);
return;
}
drc = spapr_drc_by_id(TYPE_SPAPR_DRC_CPU, index * smt);
g_assert(drc || !mc->has_hotpluggable_cpus);
/*
* Setup CPU DT entries only for hotplugged CPUs. For boot time or
* coldplugged CPUs DT entries are setup in spapr_build_fdt().
*/
if (dev->hotplugged) {
fdt = spapr_populate_hotplug_cpu_dt(cs, &fdt_offset, spapr);
}
if (drc) {
spapr_drc_attach(drc, dev, fdt, fdt_offset, !dev->hotplugged,
&local_err);
if (local_err) {
g_free(fdt);
error_propagate(errp, local_err);
return;
}
}
if (dev->hotplugged) {
/*
* Send hotplug notification interrupt to the guest only in case
* of hotplugged CPUs.
*/
spapr_hotplug_req_add_by_index(drc);
} else {
/*
* Set the right DRC states for cold plugged CPU.
*/
if (drc) {
sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);
drck->set_allocation_state(drc, SPAPR_DR_ALLOCATION_STATE_USABLE);
drck->set_isolation_state(drc, SPAPR_DR_ISOLATION_STATE_UNISOLATED);
}
}
core_slot->cpu = OBJECT(dev);
if (smc->pre_2_10_has_unused_icps) {
sPAPRCPUCoreClass *scc = SPAPR_CPU_CORE_GET_CLASS(OBJECT(cc));
const char *typename = object_class_get_name(scc->cpu_class);
size_t size = object_type_get_instance_size(typename);
int i;
for (i = 0; i < cc->nr_threads; i++) {
sPAPRCPUCore *sc = SPAPR_CPU_CORE(dev);
void *obj = sc->threads + i * size;
cs = CPU(obj);
pre_2_10_vmstate_unregister_dummy_icp(cs->cpu_index);
}
}
}
| false |
qemu
|
4f9242fc931ab5e5b1b753c8e5a76c50c0b0612e
|
static void spapr_core_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
Error **errp)
{
sPAPRMachineState *spapr = SPAPR_MACHINE(OBJECT(hotplug_dev));
MachineClass *mc = MACHINE_GET_CLASS(spapr);
sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
sPAPRCPUCore *core = SPAPR_CPU_CORE(OBJECT(dev));
CPUCore *cc = CPU_CORE(dev);
CPUState *cs = CPU(core->threads);
sPAPRDRConnector *drc;
Error *local_err = NULL;
void *fdt = NULL;
int fdt_offset = 0;
int smt = kvmppc_smt_threads();
CPUArchId *core_slot;
int index;
core_slot = spapr_find_cpu_slot(MACHINE(hotplug_dev), cc->core_id, &index);
if (!core_slot) {
error_setg(errp, "Unable to find CPU core with core-id: %d",
cc->core_id);
return;
}
drc = spapr_drc_by_id(TYPE_SPAPR_DRC_CPU, index * smt);
g_assert(drc || !mc->has_hotpluggable_cpus);
if (dev->hotplugged) {
fdt = spapr_populate_hotplug_cpu_dt(cs, &fdt_offset, spapr);
}
if (drc) {
spapr_drc_attach(drc, dev, fdt, fdt_offset, !dev->hotplugged,
&local_err);
if (local_err) {
g_free(fdt);
error_propagate(errp, local_err);
return;
}
}
if (dev->hotplugged) {
spapr_hotplug_req_add_by_index(drc);
} else {
if (drc) {
sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);
drck->set_allocation_state(drc, SPAPR_DR_ALLOCATION_STATE_USABLE);
drck->set_isolation_state(drc, SPAPR_DR_ISOLATION_STATE_UNISOLATED);
}
}
core_slot->cpu = OBJECT(dev);
if (smc->pre_2_10_has_unused_icps) {
sPAPRCPUCoreClass *scc = SPAPR_CPU_CORE_GET_CLASS(OBJECT(cc));
const char *typename = object_class_get_name(scc->cpu_class);
size_t size = object_type_get_instance_size(typename);
int i;
for (i = 0; i < cc->nr_threads; i++) {
sPAPRCPUCore *sc = SPAPR_CPU_CORE(dev);
void *obj = sc->threads + i * size;
cs = CPU(obj);
pre_2_10_vmstate_unregister_dummy_icp(cs->cpu_index);
}
}
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(HotplugHandler *VAR_0, DeviceState *VAR_1,
Error **VAR_2)
{
sPAPRMachineState *spapr = SPAPR_MACHINE(OBJECT(VAR_0));
MachineClass *mc = MACHINE_GET_CLASS(spapr);
sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
sPAPRCPUCore *core = SPAPR_CPU_CORE(OBJECT(VAR_1));
CPUCore *cc = CPU_CORE(VAR_1);
CPUState *cs = CPU(core->threads);
sPAPRDRConnector *drc;
Error *local_err = NULL;
void *VAR_3 = NULL;
int VAR_4 = 0;
int VAR_5 = kvmppc_smt_threads();
CPUArchId *core_slot;
int VAR_6;
core_slot = spapr_find_cpu_slot(MACHINE(VAR_0), cc->core_id, &VAR_6);
if (!core_slot) {
error_setg(VAR_2, "Unable to find CPU core with core-id: %d",
cc->core_id);
return;
}
drc = spapr_drc_by_id(TYPE_SPAPR_DRC_CPU, VAR_6 * VAR_5);
g_assert(drc || !mc->has_hotpluggable_cpus);
if (VAR_1->hotplugged) {
VAR_3 = spapr_populate_hotplug_cpu_dt(cs, &VAR_4, spapr);
}
if (drc) {
spapr_drc_attach(drc, VAR_1, VAR_3, VAR_4, !VAR_1->hotplugged,
&local_err);
if (local_err) {
g_free(VAR_3);
error_propagate(VAR_2, local_err);
return;
}
}
if (VAR_1->hotplugged) {
spapr_hotplug_req_add_by_index(drc);
} else {
if (drc) {
sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);
drck->set_allocation_state(drc, SPAPR_DR_ALLOCATION_STATE_USABLE);
drck->set_isolation_state(drc, SPAPR_DR_ISOLATION_STATE_UNISOLATED);
}
}
core_slot->cpu = OBJECT(VAR_1);
if (smc->pre_2_10_has_unused_icps) {
sPAPRCPUCoreClass *scc = SPAPR_CPU_CORE_GET_CLASS(OBJECT(cc));
const char *VAR_7 = object_class_get_name(scc->cpu_class);
size_t size = object_type_get_instance_size(VAR_7);
int VAR_8;
for (VAR_8 = 0; VAR_8 < cc->nr_threads; VAR_8++) {
sPAPRCPUCore *sc = SPAPR_CPU_CORE(VAR_1);
void *obj = sc->threads + VAR_8 * size;
cs = CPU(obj);
pre_2_10_vmstate_unregister_dummy_icp(cs->cpu_index);
}
}
}
|
[
"static void FUNC_0(HotplugHandler *VAR_0, DeviceState *VAR_1,\nError **VAR_2)\n{",
"sPAPRMachineState *spapr = SPAPR_MACHINE(OBJECT(VAR_0));",
"MachineClass *mc = MACHINE_GET_CLASS(spapr);",
"sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);",
"sPAPRCPUCore *core = SPAPR_CPU_CORE(OBJECT(VAR_1));",
"CPUCore *cc = CPU_CORE(VAR_1);",
"CPUState *cs = CPU(core->threads);",
"sPAPRDRConnector *drc;",
"Error *local_err = NULL;",
"void *VAR_3 = NULL;",
"int VAR_4 = 0;",
"int VAR_5 = kvmppc_smt_threads();",
"CPUArchId *core_slot;",
"int VAR_6;",
"core_slot = spapr_find_cpu_slot(MACHINE(VAR_0), cc->core_id, &VAR_6);",
"if (!core_slot) {",
"error_setg(VAR_2, \"Unable to find CPU core with core-id: %d\",\ncc->core_id);",
"return;",
"}",
"drc = spapr_drc_by_id(TYPE_SPAPR_DRC_CPU, VAR_6 * VAR_5);",
"g_assert(drc || !mc->has_hotpluggable_cpus);",
"if (VAR_1->hotplugged) {",
"VAR_3 = spapr_populate_hotplug_cpu_dt(cs, &VAR_4, spapr);",
"}",
"if (drc) {",
"spapr_drc_attach(drc, VAR_1, VAR_3, VAR_4, !VAR_1->hotplugged,\n&local_err);",
"if (local_err) {",
"g_free(VAR_3);",
"error_propagate(VAR_2, local_err);",
"return;",
"}",
"}",
"if (VAR_1->hotplugged) {",
"spapr_hotplug_req_add_by_index(drc);",
"} else {",
"if (drc) {",
"sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);",
"drck->set_allocation_state(drc, SPAPR_DR_ALLOCATION_STATE_USABLE);",
"drck->set_isolation_state(drc, SPAPR_DR_ISOLATION_STATE_UNISOLATED);",
"}",
"}",
"core_slot->cpu = OBJECT(VAR_1);",
"if (smc->pre_2_10_has_unused_icps) {",
"sPAPRCPUCoreClass *scc = SPAPR_CPU_CORE_GET_CLASS(OBJECT(cc));",
"const char *VAR_7 = object_class_get_name(scc->cpu_class);",
"size_t size = object_type_get_instance_size(VAR_7);",
"int VAR_8;",
"for (VAR_8 = 0; VAR_8 < cc->nr_threads; VAR_8++) {",
"sPAPRCPUCore *sc = SPAPR_CPU_CORE(VAR_1);",
"void *obj = sc->threads + VAR_8 * size;",
"cs = CPU(obj);",
"pre_2_10_vmstate_unregister_dummy_icp(cs->cpu_index);",
"}",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
35
],
[
37
],
[
39,
41
],
[
43
],
[
45
],
[
47
],
[
51
],
[
63
],
[
65
],
[
67
],
[
71
],
[
73,
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
91
],
[
101
],
[
103
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
139
],
[
141
],
[
143
],
[
147
],
[
149
],
[
151
],
[
153
],
[
155
]
] |
6,405 |
static void bt_dummy_lmp_acl_resp(struct bt_link_s *link,
const uint8_t *data, int start, int len)
{
fprintf(stderr, "%s: stray ACL response PDU, fixme\n", __FUNCTION__);
exit(-1);
}
| false |
qemu
|
a89f364ae8740dfc31b321eed9ee454e996dc3c1
|
static void bt_dummy_lmp_acl_resp(struct bt_link_s *link,
const uint8_t *data, int start, int len)
{
fprintf(stderr, "%s: stray ACL response PDU, fixme\n", __FUNCTION__);
exit(-1);
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(struct bt_link_s *VAR_0,
const uint8_t *VAR_1, int VAR_2, int VAR_3)
{
fprintf(stderr, "%s: stray ACL response PDU, fixme\n", __FUNCTION__);
exit(-1);
}
|
[
"static void FUNC_0(struct bt_link_s *VAR_0,\nconst uint8_t *VAR_1, int VAR_2, int VAR_3)\n{",
"fprintf(stderr, \"%s: stray ACL response PDU, fixme\\n\", __FUNCTION__);",
"exit(-1);",
"}"
] |
[
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
]
] |
6,406 |
static bool msix_vector_masked(PCIDevice *dev, int vector, bool fmask)
{
unsigned offset = vector * PCI_MSIX_ENTRY_SIZE + PCI_MSIX_ENTRY_VECTOR_CTRL;
return fmask || dev->msix_table[offset] & PCI_MSIX_ENTRY_CTRL_MASKBIT;
}
| false |
qemu
|
70f8ee395afda6d96b15cb9a5b311af7720dded0
|
static bool msix_vector_masked(PCIDevice *dev, int vector, bool fmask)
{
unsigned offset = vector * PCI_MSIX_ENTRY_SIZE + PCI_MSIX_ENTRY_VECTOR_CTRL;
return fmask || dev->msix_table[offset] & PCI_MSIX_ENTRY_CTRL_MASKBIT;
}
|
{
"code": [],
"line_no": []
}
|
static bool FUNC_0(PCIDevice *dev, int vector, bool fmask)
{
unsigned VAR_0 = vector * PCI_MSIX_ENTRY_SIZE + PCI_MSIX_ENTRY_VECTOR_CTRL;
return fmask || dev->msix_table[VAR_0] & PCI_MSIX_ENTRY_CTRL_MASKBIT;
}
|
[
"static bool FUNC_0(PCIDevice *dev, int vector, bool fmask)\n{",
"unsigned VAR_0 = vector * PCI_MSIX_ENTRY_SIZE + PCI_MSIX_ENTRY_VECTOR_CTRL;",
"return fmask || dev->msix_table[VAR_0] & PCI_MSIX_ENTRY_CTRL_MASKBIT;",
"}"
] |
[
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
]
] |
6,407 |
static void virtio_blk_dma_restart_bh(void *opaque)
{
VirtIOBlock *s = opaque;
VirtIOBlockReq *req = s->rq;
MultiReqBuffer mrb = {
.num_writes = 0,
};
qemu_bh_delete(s->bh);
s->bh = NULL;
s->rq = NULL;
while (req) {
virtio_blk_handle_request(req, &mrb);
req = req->next;
}
if (mrb.num_writes > 0) {
do_multiwrite(s->bs, mrb.blkreq, mrb.num_writes);
}
}
| false |
qemu
|
c20fd872257fb9abd2ce99741937c0f65aa162b7
|
static void virtio_blk_dma_restart_bh(void *opaque)
{
VirtIOBlock *s = opaque;
VirtIOBlockReq *req = s->rq;
MultiReqBuffer mrb = {
.num_writes = 0,
};
qemu_bh_delete(s->bh);
s->bh = NULL;
s->rq = NULL;
while (req) {
virtio_blk_handle_request(req, &mrb);
req = req->next;
}
if (mrb.num_writes > 0) {
do_multiwrite(s->bs, mrb.blkreq, mrb.num_writes);
}
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(void *VAR_0)
{
VirtIOBlock *s = VAR_0;
VirtIOBlockReq *req = s->rq;
MultiReqBuffer mrb = {
.num_writes = 0,
};
qemu_bh_delete(s->bh);
s->bh = NULL;
s->rq = NULL;
while (req) {
virtio_blk_handle_request(req, &mrb);
req = req->next;
}
if (mrb.num_writes > 0) {
do_multiwrite(s->bs, mrb.blkreq, mrb.num_writes);
}
}
|
[
"static void FUNC_0(void *VAR_0)\n{",
"VirtIOBlock *s = VAR_0;",
"VirtIOBlockReq *req = s->rq;",
"MultiReqBuffer mrb = {",
".num_writes = 0,\n};",
"qemu_bh_delete(s->bh);",
"s->bh = NULL;",
"s->rq = NULL;",
"while (req) {",
"virtio_blk_handle_request(req, &mrb);",
"req = req->next;",
"}",
"if (mrb.num_writes > 0) {",
"do_multiwrite(s->bs, mrb.blkreq, mrb.num_writes);",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11,
13
],
[
17
],
[
19
],
[
23
],
[
27
],
[
29
],
[
31
],
[
33
],
[
37
],
[
39
],
[
41
],
[
43
]
] |
6,410 |
iscsi_aio_readv(BlockDriverState *bs, int64_t sector_num,
QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb,
void *opaque)
{
IscsiLun *iscsilun = bs->opaque;
struct iscsi_context *iscsi = iscsilun->iscsi;
IscsiAIOCB *acb;
size_t qemu_read_size;
int i;
uint64_t lba;
uint32_t num_sectors;
qemu_read_size = BDRV_SECTOR_SIZE * (size_t)nb_sectors;
acb = qemu_aio_get(&iscsi_aiocb_info, bs, cb, opaque);
trace_iscsi_aio_readv(iscsi, sector_num, nb_sectors, opaque, acb);
acb->iscsilun = iscsilun;
acb->qiov = qiov;
acb->canceled = 0;
acb->bh = NULL;
acb->status = -EINPROGRESS;
acb->read_size = qemu_read_size;
acb->buf = NULL;
/* If LUN blocksize is bigger than BDRV_BLOCK_SIZE a read from QEMU
* may be misaligned to the LUN, so we may need to read some extra
* data.
*/
acb->read_offset = 0;
if (iscsilun->block_size > BDRV_SECTOR_SIZE) {
uint64_t bdrv_offset = BDRV_SECTOR_SIZE * sector_num;
acb->read_offset = bdrv_offset % iscsilun->block_size;
}
num_sectors = (qemu_read_size + iscsilun->block_size
+ acb->read_offset - 1)
/ iscsilun->block_size;
acb->task = malloc(sizeof(struct scsi_task));
if (acb->task == NULL) {
error_report("iSCSI: Failed to allocate task for scsi READ16 "
"command. %s", iscsi_get_error(iscsi));
qemu_aio_release(acb);
return NULL;
}
memset(acb->task, 0, sizeof(struct scsi_task));
acb->task->xfer_dir = SCSI_XFER_READ;
lba = sector_qemu2lun(sector_num, iscsilun);
acb->task->expxferlen = qemu_read_size;
switch (iscsilun->type) {
case TYPE_DISK:
acb->task->cdb_size = 16;
acb->task->cdb[0] = 0x88;
*(uint32_t *)&acb->task->cdb[2] = htonl(lba >> 32);
*(uint32_t *)&acb->task->cdb[6] = htonl(lba & 0xffffffff);
*(uint32_t *)&acb->task->cdb[10] = htonl(num_sectors);
break;
default:
acb->task->cdb_size = 10;
acb->task->cdb[0] = 0x28;
*(uint32_t *)&acb->task->cdb[2] = htonl(lba);
*(uint16_t *)&acb->task->cdb[7] = htons(num_sectors);
break;
}
if (iscsi_scsi_command_async(iscsi, iscsilun->lun, acb->task,
iscsi_aio_read16_cb,
NULL,
acb) != 0) {
scsi_free_scsi_task(acb->task);
qemu_aio_release(acb);
return NULL;
}
for (i = 0; i < acb->qiov->niov; i++) {
scsi_task_add_data_in_buffer(acb->task,
acb->qiov->iov[i].iov_len,
acb->qiov->iov[i].iov_base);
}
iscsi_set_events(iscsilun);
return &acb->common;
}
| true |
qemu
|
e829b0bb054ed3389e5b22dad61875e51674e629
|
iscsi_aio_readv(BlockDriverState *bs, int64_t sector_num,
QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb,
void *opaque)
{
IscsiLun *iscsilun = bs->opaque;
struct iscsi_context *iscsi = iscsilun->iscsi;
IscsiAIOCB *acb;
size_t qemu_read_size;
int i;
uint64_t lba;
uint32_t num_sectors;
qemu_read_size = BDRV_SECTOR_SIZE * (size_t)nb_sectors;
acb = qemu_aio_get(&iscsi_aiocb_info, bs, cb, opaque);
trace_iscsi_aio_readv(iscsi, sector_num, nb_sectors, opaque, acb);
acb->iscsilun = iscsilun;
acb->qiov = qiov;
acb->canceled = 0;
acb->bh = NULL;
acb->status = -EINPROGRESS;
acb->read_size = qemu_read_size;
acb->buf = NULL;
acb->read_offset = 0;
if (iscsilun->block_size > BDRV_SECTOR_SIZE) {
uint64_t bdrv_offset = BDRV_SECTOR_SIZE * sector_num;
acb->read_offset = bdrv_offset % iscsilun->block_size;
}
num_sectors = (qemu_read_size + iscsilun->block_size
+ acb->read_offset - 1)
/ iscsilun->block_size;
acb->task = malloc(sizeof(struct scsi_task));
if (acb->task == NULL) {
error_report("iSCSI: Failed to allocate task for scsi READ16 "
"command. %s", iscsi_get_error(iscsi));
qemu_aio_release(acb);
return NULL;
}
memset(acb->task, 0, sizeof(struct scsi_task));
acb->task->xfer_dir = SCSI_XFER_READ;
lba = sector_qemu2lun(sector_num, iscsilun);
acb->task->expxferlen = qemu_read_size;
switch (iscsilun->type) {
case TYPE_DISK:
acb->task->cdb_size = 16;
acb->task->cdb[0] = 0x88;
*(uint32_t *)&acb->task->cdb[2] = htonl(lba >> 32);
*(uint32_t *)&acb->task->cdb[6] = htonl(lba & 0xffffffff);
*(uint32_t *)&acb->task->cdb[10] = htonl(num_sectors);
break;
default:
acb->task->cdb_size = 10;
acb->task->cdb[0] = 0x28;
*(uint32_t *)&acb->task->cdb[2] = htonl(lba);
*(uint16_t *)&acb->task->cdb[7] = htons(num_sectors);
break;
}
if (iscsi_scsi_command_async(iscsi, iscsilun->lun, acb->task,
iscsi_aio_read16_cb,
NULL,
acb) != 0) {
scsi_free_scsi_task(acb->task);
qemu_aio_release(acb);
return NULL;
}
for (i = 0; i < acb->qiov->niov; i++) {
scsi_task_add_data_in_buffer(acb->task,
acb->qiov->iov[i].iov_len,
acb->qiov->iov[i].iov_base);
}
iscsi_set_events(iscsilun);
return &acb->common;
}
|
{
"code": [
" case TYPE_DISK:",
" break;",
" break;",
" default:"
],
"line_no": [
113,
125,
125,
127
]
}
|
FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1,
QEMUIOVector *VAR_2, int VAR_3,
BlockDriverCompletionFunc *VAR_4,
void *VAR_5)
{
IscsiLun *iscsilun = VAR_0->VAR_5;
struct iscsi_context *VAR_6 = iscsilun->VAR_6;
IscsiAIOCB *acb;
size_t qemu_read_size;
int VAR_7;
uint64_t lba;
uint32_t num_sectors;
qemu_read_size = BDRV_SECTOR_SIZE * (size_t)VAR_3;
acb = qemu_aio_get(&iscsi_aiocb_info, VAR_0, VAR_4, VAR_5);
trace_iscsi_aio_readv(VAR_6, VAR_1, VAR_3, VAR_5, acb);
acb->iscsilun = iscsilun;
acb->VAR_2 = VAR_2;
acb->canceled = 0;
acb->bh = NULL;
acb->status = -EINPROGRESS;
acb->read_size = qemu_read_size;
acb->buf = NULL;
acb->read_offset = 0;
if (iscsilun->block_size > BDRV_SECTOR_SIZE) {
uint64_t bdrv_offset = BDRV_SECTOR_SIZE * VAR_1;
acb->read_offset = bdrv_offset % iscsilun->block_size;
}
num_sectors = (qemu_read_size + iscsilun->block_size
+ acb->read_offset - 1)
/ iscsilun->block_size;
acb->task = malloc(sizeof(struct scsi_task));
if (acb->task == NULL) {
error_report("iSCSI: Failed to allocate task for scsi READ16 "
"command. %s", iscsi_get_error(VAR_6));
qemu_aio_release(acb);
return NULL;
}
memset(acb->task, 0, sizeof(struct scsi_task));
acb->task->xfer_dir = SCSI_XFER_READ;
lba = sector_qemu2lun(VAR_1, iscsilun);
acb->task->expxferlen = qemu_read_size;
switch (iscsilun->type) {
case TYPE_DISK:
acb->task->cdb_size = 16;
acb->task->cdb[0] = 0x88;
*(uint32_t *)&acb->task->cdb[2] = htonl(lba >> 32);
*(uint32_t *)&acb->task->cdb[6] = htonl(lba & 0xffffffff);
*(uint32_t *)&acb->task->cdb[10] = htonl(num_sectors);
break;
default:
acb->task->cdb_size = 10;
acb->task->cdb[0] = 0x28;
*(uint32_t *)&acb->task->cdb[2] = htonl(lba);
*(uint16_t *)&acb->task->cdb[7] = htons(num_sectors);
break;
}
if (iscsi_scsi_command_async(VAR_6, iscsilun->lun, acb->task,
iscsi_aio_read16_cb,
NULL,
acb) != 0) {
scsi_free_scsi_task(acb->task);
qemu_aio_release(acb);
return NULL;
}
for (VAR_7 = 0; VAR_7 < acb->VAR_2->niov; VAR_7++) {
scsi_task_add_data_in_buffer(acb->task,
acb->VAR_2->iov[VAR_7].iov_len,
acb->VAR_2->iov[VAR_7].iov_base);
}
iscsi_set_events(iscsilun);
return &acb->common;
}
|
[
"FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1,\nQEMUIOVector *VAR_2, int VAR_3,\nBlockDriverCompletionFunc *VAR_4,\nvoid *VAR_5)\n{",
"IscsiLun *iscsilun = VAR_0->VAR_5;",
"struct iscsi_context *VAR_6 = iscsilun->VAR_6;",
"IscsiAIOCB *acb;",
"size_t qemu_read_size;",
"int VAR_7;",
"uint64_t lba;",
"uint32_t num_sectors;",
"qemu_read_size = BDRV_SECTOR_SIZE * (size_t)VAR_3;",
"acb = qemu_aio_get(&iscsi_aiocb_info, VAR_0, VAR_4, VAR_5);",
"trace_iscsi_aio_readv(VAR_6, VAR_1, VAR_3, VAR_5, acb);",
"acb->iscsilun = iscsilun;",
"acb->VAR_2 = VAR_2;",
"acb->canceled = 0;",
"acb->bh = NULL;",
"acb->status = -EINPROGRESS;",
"acb->read_size = qemu_read_size;",
"acb->buf = NULL;",
"acb->read_offset = 0;",
"if (iscsilun->block_size > BDRV_SECTOR_SIZE) {",
"uint64_t bdrv_offset = BDRV_SECTOR_SIZE * VAR_1;",
"acb->read_offset = bdrv_offset % iscsilun->block_size;",
"}",
"num_sectors = (qemu_read_size + iscsilun->block_size\n+ acb->read_offset - 1)\n/ iscsilun->block_size;",
"acb->task = malloc(sizeof(struct scsi_task));",
"if (acb->task == NULL) {",
"error_report(\"iSCSI: Failed to allocate task for scsi READ16 \"\n\"command. %s\", iscsi_get_error(VAR_6));",
"qemu_aio_release(acb);",
"return NULL;",
"}",
"memset(acb->task, 0, sizeof(struct scsi_task));",
"acb->task->xfer_dir = SCSI_XFER_READ;",
"lba = sector_qemu2lun(VAR_1, iscsilun);",
"acb->task->expxferlen = qemu_read_size;",
"switch (iscsilun->type) {",
"case TYPE_DISK:\nacb->task->cdb_size = 16;",
"acb->task->cdb[0] = 0x88;",
"*(uint32_t *)&acb->task->cdb[2] = htonl(lba >> 32);",
"*(uint32_t *)&acb->task->cdb[6] = htonl(lba & 0xffffffff);",
"*(uint32_t *)&acb->task->cdb[10] = htonl(num_sectors);",
"break;",
"default:\nacb->task->cdb_size = 10;",
"acb->task->cdb[0] = 0x28;",
"*(uint32_t *)&acb->task->cdb[2] = htonl(lba);",
"*(uint16_t *)&acb->task->cdb[7] = htons(num_sectors);",
"break;",
"}",
"if (iscsi_scsi_command_async(VAR_6, iscsilun->lun, acb->task,\niscsi_aio_read16_cb,\nNULL,\nacb) != 0) {",
"scsi_free_scsi_task(acb->task);",
"qemu_aio_release(acb);",
"return NULL;",
"}",
"for (VAR_7 = 0; VAR_7 < acb->VAR_2->niov; VAR_7++) {",
"scsi_task_add_data_in_buffer(acb->task,\nacb->VAR_2->iov[VAR_7].iov_len,\nacb->VAR_2->iov[VAR_7].iov_base);",
"}",
"iscsi_set_events(iscsilun);",
"return &acb->common;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5,
7,
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
27
],
[
31
],
[
33
],
[
37
],
[
39
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
63
],
[
65
],
[
67
],
[
71
],
[
73
],
[
77,
79,
81
],
[
85
],
[
87
],
[
89,
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
103
],
[
105
],
[
107
],
[
111
],
[
113,
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127,
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
143,
145,
147,
149
],
[
151
],
[
153
],
[
155
],
[
157
],
[
161
],
[
163,
165,
167
],
[
169
],
[
173
],
[
177
],
[
179
]
] |
6,411 |
static void vmsvga_reset(struct vmsvga_state_s *s)
{
s->index = 0;
s->enable = 0;
s->config = 0;
s->width = -1;
s->height = -1;
s->svgaid = SVGA_ID;
s->depth = 24;
s->bypp = (s->depth + 7) >> 3;
s->cursor.on = 0;
s->redraw_fifo_first = 0;
s->redraw_fifo_last = 0;
switch (s->depth) {
case 8:
s->wred = 0x00000007;
s->wgreen = 0x00000038;
s->wblue = 0x000000c0;
break;
case 15:
s->wred = 0x0000001f;
s->wgreen = 0x000003e0;
s->wblue = 0x00007c00;
break;
case 16:
s->wred = 0x0000001f;
s->wgreen = 0x000007e0;
s->wblue = 0x0000f800;
break;
case 24:
s->wred = 0x00ff0000;
s->wgreen = 0x0000ff00;
s->wblue = 0x000000ff;
break;
case 32:
s->wred = 0x00ff0000;
s->wgreen = 0x0000ff00;
s->wblue = 0x000000ff;
break;
}
s->syncing = 0;
}
| true |
qemu
|
a6109ff1b5d7184a9d490c4ff94f175940232ebd
|
static void vmsvga_reset(struct vmsvga_state_s *s)
{
s->index = 0;
s->enable = 0;
s->config = 0;
s->width = -1;
s->height = -1;
s->svgaid = SVGA_ID;
s->depth = 24;
s->bypp = (s->depth + 7) >> 3;
s->cursor.on = 0;
s->redraw_fifo_first = 0;
s->redraw_fifo_last = 0;
switch (s->depth) {
case 8:
s->wred = 0x00000007;
s->wgreen = 0x00000038;
s->wblue = 0x000000c0;
break;
case 15:
s->wred = 0x0000001f;
s->wgreen = 0x000003e0;
s->wblue = 0x00007c00;
break;
case 16:
s->wred = 0x0000001f;
s->wgreen = 0x000007e0;
s->wblue = 0x0000f800;
break;
case 24:
s->wred = 0x00ff0000;
s->wgreen = 0x0000ff00;
s->wblue = 0x000000ff;
break;
case 32:
s->wred = 0x00ff0000;
s->wgreen = 0x0000ff00;
s->wblue = 0x000000ff;
break;
}
s->syncing = 0;
}
|
{
"code": [
" s->depth = 24;",
" s->bypp = (s->depth + 7) >> 3;"
],
"line_no": [
17,
19
]
}
|
static void FUNC_0(struct vmsvga_state_s *VAR_0)
{
VAR_0->index = 0;
VAR_0->enable = 0;
VAR_0->config = 0;
VAR_0->width = -1;
VAR_0->height = -1;
VAR_0->svgaid = SVGA_ID;
VAR_0->depth = 24;
VAR_0->bypp = (VAR_0->depth + 7) >> 3;
VAR_0->cursor.on = 0;
VAR_0->redraw_fifo_first = 0;
VAR_0->redraw_fifo_last = 0;
switch (VAR_0->depth) {
case 8:
VAR_0->wred = 0x00000007;
VAR_0->wgreen = 0x00000038;
VAR_0->wblue = 0x000000c0;
break;
case 15:
VAR_0->wred = 0x0000001f;
VAR_0->wgreen = 0x000003e0;
VAR_0->wblue = 0x00007c00;
break;
case 16:
VAR_0->wred = 0x0000001f;
VAR_0->wgreen = 0x000007e0;
VAR_0->wblue = 0x0000f800;
break;
case 24:
VAR_0->wred = 0x00ff0000;
VAR_0->wgreen = 0x0000ff00;
VAR_0->wblue = 0x000000ff;
break;
case 32:
VAR_0->wred = 0x00ff0000;
VAR_0->wgreen = 0x0000ff00;
VAR_0->wblue = 0x000000ff;
break;
}
VAR_0->syncing = 0;
}
|
[
"static void FUNC_0(struct vmsvga_state_s *VAR_0)\n{",
"VAR_0->index = 0;",
"VAR_0->enable = 0;",
"VAR_0->config = 0;",
"VAR_0->width = -1;",
"VAR_0->height = -1;",
"VAR_0->svgaid = SVGA_ID;",
"VAR_0->depth = 24;",
"VAR_0->bypp = (VAR_0->depth + 7) >> 3;",
"VAR_0->cursor.on = 0;",
"VAR_0->redraw_fifo_first = 0;",
"VAR_0->redraw_fifo_last = 0;",
"switch (VAR_0->depth) {",
"case 8:\nVAR_0->wred = 0x00000007;",
"VAR_0->wgreen = 0x00000038;",
"VAR_0->wblue = 0x000000c0;",
"break;",
"case 15:\nVAR_0->wred = 0x0000001f;",
"VAR_0->wgreen = 0x000003e0;",
"VAR_0->wblue = 0x00007c00;",
"break;",
"case 16:\nVAR_0->wred = 0x0000001f;",
"VAR_0->wgreen = 0x000007e0;",
"VAR_0->wblue = 0x0000f800;",
"break;",
"case 24:\nVAR_0->wred = 0x00ff0000;",
"VAR_0->wgreen = 0x0000ff00;",
"VAR_0->wblue = 0x000000ff;",
"break;",
"case 32:\nVAR_0->wred = 0x00ff0000;",
"VAR_0->wgreen = 0x0000ff00;",
"VAR_0->wblue = 0x000000ff;",
"break;",
"}",
"VAR_0->syncing = 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
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
]
] |
6,412 |
static MpegTSService *mpegts_add_service(MpegTSWrite *ts, int sid,
const char *provider_name,
const char *name)
{
MpegTSService *service;
service = av_mallocz(sizeof(MpegTSService));
if (!service)
return NULL;
service->pmt.pid = ts->pmt_start_pid + ts->nb_services;
service->sid = sid;
service->provider_name = av_strdup(provider_name);
service->name = av_strdup(name);
service->pcr_pid = 0x1fff;
dynarray_add(&ts->services, &ts->nb_services, service);
return service;
}
| true |
FFmpeg
|
5b220e1e19c17b202d83d9be0868d152109ae8f0
|
static MpegTSService *mpegts_add_service(MpegTSWrite *ts, int sid,
const char *provider_name,
const char *name)
{
MpegTSService *service;
service = av_mallocz(sizeof(MpegTSService));
if (!service)
return NULL;
service->pmt.pid = ts->pmt_start_pid + ts->nb_services;
service->sid = sid;
service->provider_name = av_strdup(provider_name);
service->name = av_strdup(name);
service->pcr_pid = 0x1fff;
dynarray_add(&ts->services, &ts->nb_services, service);
return service;
}
|
{
"code": [
" service->pcr_pid = 0x1fff;"
],
"line_no": [
27
]
}
|
static MpegTSService *FUNC_0(MpegTSWrite *ts, int sid,
const char *provider_name,
const char *name)
{
MpegTSService *service;
service = av_mallocz(sizeof(MpegTSService));
if (!service)
return NULL;
service->pmt.pid = ts->pmt_start_pid + ts->nb_services;
service->sid = sid;
service->provider_name = av_strdup(provider_name);
service->name = av_strdup(name);
service->pcr_pid = 0x1fff;
dynarray_add(&ts->services, &ts->nb_services, service);
return service;
}
|
[
"static MpegTSService *FUNC_0(MpegTSWrite *ts, int sid,\nconst char *provider_name,\nconst char *name)\n{",
"MpegTSService *service;",
"service = av_mallocz(sizeof(MpegTSService));",
"if (!service)\nreturn NULL;",
"service->pmt.pid = ts->pmt_start_pid + ts->nb_services;",
"service->sid = sid;",
"service->provider_name = av_strdup(provider_name);",
"service->name = av_strdup(name);",
"service->pcr_pid = 0x1fff;",
"dynarray_add(&ts->services, &ts->nb_services, service);",
"return service;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0
] |
[
[
1,
3,
5,
7
],
[
9
],
[
13
],
[
15,
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
]
] |
6,413 |
static const uint8_t *read_huffman_tables(FourXContext *f,
const uint8_t * const buf, int buf_size)
{
int frequency[512] = { 0 };
uint8_t flag[512];
int up[512];
uint8_t len_tab[257];
int bits_tab[257];
int start, end;
const uint8_t *ptr = buf;
const uint8_t *ptr_end = buf + buf_size;
int j;
memset(up, -1, sizeof(up));
start = *ptr++;
end = *ptr++;
for (;;) {
int i;
if (start <= end && ptr_end - ptr < end - start + 1 + 1)
return NULL;
for (i = start; i <= end; i++)
frequency[i] = *ptr++;
start = *ptr++;
if (start == 0)
break;
end = *ptr++;
}
frequency[256] = 1;
while ((ptr - buf) & 3)
ptr++; // 4byte align
for (j = 257; j < 512; j++) {
int min_freq[2] = { 256 * 256, 256 * 256 };
int smallest[2] = { 0, 0 };
int i;
for (i = 0; i < j; i++) {
if (frequency[i] == 0)
continue;
if (frequency[i] < min_freq[1]) {
if (frequency[i] < min_freq[0]) {
min_freq[1] = min_freq[0];
smallest[1] = smallest[0];
min_freq[0] = frequency[i];
smallest[0] = i;
} else {
min_freq[1] = frequency[i];
smallest[1] = i;
}
}
}
if (min_freq[1] == 256 * 256)
break;
frequency[j] = min_freq[0] + min_freq[1];
flag[smallest[0]] = 0;
flag[smallest[1]] = 1;
up[smallest[0]] =
up[smallest[1]] = j;
frequency[smallest[0]] = frequency[smallest[1]] = 0;
}
for (j = 0; j < 257; j++) {
int node, len = 0, bits = 0;
for (node = j; up[node] != -1; node = up[node]) {
bits += flag[node] << len;
len++;
if (len > 31)
// can this happen at all ?
av_log(f->avctx, AV_LOG_ERROR,
"vlc length overflow\n");
}
bits_tab[j] = bits;
len_tab[j] = len;
}
if (init_vlc(&f->pre_vlc, ACDC_VLC_BITS, 257, len_tab, 1, 1,
bits_tab, 4, 4, 0))
return NULL;
return ptr;
}
| true |
FFmpeg
|
53a3fdbfc56da54b2c0a44eb1f956ec9d67d1425
|
static const uint8_t *read_huffman_tables(FourXContext *f,
const uint8_t * const buf, int buf_size)
{
int frequency[512] = { 0 };
uint8_t flag[512];
int up[512];
uint8_t len_tab[257];
int bits_tab[257];
int start, end;
const uint8_t *ptr = buf;
const uint8_t *ptr_end = buf + buf_size;
int j;
memset(up, -1, sizeof(up));
start = *ptr++;
end = *ptr++;
for (;;) {
int i;
if (start <= end && ptr_end - ptr < end - start + 1 + 1)
return NULL;
for (i = start; i <= end; i++)
frequency[i] = *ptr++;
start = *ptr++;
if (start == 0)
break;
end = *ptr++;
}
frequency[256] = 1;
while ((ptr - buf) & 3)
ptr++;
for (j = 257; j < 512; j++) {
int min_freq[2] = { 256 * 256, 256 * 256 };
int smallest[2] = { 0, 0 };
int i;
for (i = 0; i < j; i++) {
if (frequency[i] == 0)
continue;
if (frequency[i] < min_freq[1]) {
if (frequency[i] < min_freq[0]) {
min_freq[1] = min_freq[0];
smallest[1] = smallest[0];
min_freq[0] = frequency[i];
smallest[0] = i;
} else {
min_freq[1] = frequency[i];
smallest[1] = i;
}
}
}
if (min_freq[1] == 256 * 256)
break;
frequency[j] = min_freq[0] + min_freq[1];
flag[smallest[0]] = 0;
flag[smallest[1]] = 1;
up[smallest[0]] =
up[smallest[1]] = j;
frequency[smallest[0]] = frequency[smallest[1]] = 0;
}
for (j = 0; j < 257; j++) {
int node, len = 0, bits = 0;
for (node = j; up[node] != -1; node = up[node]) {
bits += flag[node] << len;
len++;
if (len > 31)
av_log(f->avctx, AV_LOG_ERROR,
"vlc length overflow\n");
}
bits_tab[j] = bits;
len_tab[j] = len;
}
if (init_vlc(&f->pre_vlc, ACDC_VLC_BITS, 257, len_tab, 1, 1,
bits_tab, 4, 4, 0))
return NULL;
return ptr;
}
|
{
"code": [
" if (start <= end && ptr_end - ptr < end - start + 1 + 1)"
],
"line_no": [
41
]
}
|
static const uint8_t *FUNC_0(FourXContext *f,
const uint8_t * const buf, int buf_size)
{
int VAR_0[512] = { 0 };
uint8_t flag[512];
int VAR_1[512];
uint8_t len_tab[257];
int VAR_2[257];
int VAR_3, VAR_4;
const uint8_t *VAR_5 = buf;
const uint8_t *VAR_6 = buf + buf_size;
int VAR_7;
memset(VAR_1, -1, sizeof(VAR_1));
VAR_3 = *VAR_5++;
VAR_4 = *VAR_5++;
for (;;) {
int VAR_11;
if (VAR_3 <= VAR_4 && VAR_6 - VAR_5 < VAR_4 - VAR_3 + 1 + 1)
return NULL;
for (VAR_11 = VAR_3; VAR_11 <= VAR_4; VAR_11++)
VAR_0[VAR_11] = *VAR_5++;
VAR_3 = *VAR_5++;
if (VAR_3 == 0)
break;
VAR_4 = *VAR_5++;
}
VAR_0[256] = 1;
while ((VAR_5 - buf) & 3)
VAR_5++;
for (VAR_7 = 257; VAR_7 < 512; VAR_7++) {
int VAR_9[2] = { 256 * 256, 256 * 256 };
int VAR_10[2] = { 0, 0 };
int VAR_11;
for (VAR_11 = 0; VAR_11 < VAR_7; VAR_11++) {
if (VAR_0[VAR_11] == 0)
continue;
if (VAR_0[VAR_11] < VAR_9[1]) {
if (VAR_0[VAR_11] < VAR_9[0]) {
VAR_9[1] = VAR_9[0];
VAR_10[1] = VAR_10[0];
VAR_9[0] = VAR_0[VAR_11];
VAR_10[0] = VAR_11;
} else {
VAR_9[1] = VAR_0[VAR_11];
VAR_10[1] = VAR_11;
}
}
}
if (VAR_9[1] == 256 * 256)
break;
VAR_0[VAR_7] = VAR_9[0] + VAR_9[1];
flag[VAR_10[0]] = 0;
flag[VAR_10[1]] = 1;
VAR_1[VAR_10[0]] =
VAR_1[VAR_10[1]] = VAR_7;
VAR_0[VAR_10[0]] = VAR_0[VAR_10[1]] = 0;
}
for (VAR_7 = 0; VAR_7 < 257; VAR_7++) {
int VAR_11, VAR_12 = 0, VAR_13 = 0;
for (VAR_11 = VAR_7; VAR_1[VAR_11] != -1; VAR_11 = VAR_1[VAR_11]) {
VAR_13 += flag[VAR_11] << VAR_12;
VAR_12++;
if (VAR_12 > 31)
av_log(f->avctx, AV_LOG_ERROR,
"vlc length overflow\n");
}
VAR_2[VAR_7] = VAR_13;
len_tab[VAR_7] = VAR_12;
}
if (init_vlc(&f->pre_vlc, ACDC_VLC_BITS, 257, len_tab, 1, 1,
VAR_2, 4, 4, 0))
return NULL;
return VAR_5;
}
|
[
"static const uint8_t *FUNC_0(FourXContext *f,\nconst uint8_t * const buf, int buf_size)\n{",
"int VAR_0[512] = { 0 };",
"uint8_t flag[512];",
"int VAR_1[512];",
"uint8_t len_tab[257];",
"int VAR_2[257];",
"int VAR_3, VAR_4;",
"const uint8_t *VAR_5 = buf;",
"const uint8_t *VAR_6 = buf + buf_size;",
"int VAR_7;",
"memset(VAR_1, -1, sizeof(VAR_1));",
"VAR_3 = *VAR_5++;",
"VAR_4 = *VAR_5++;",
"for (;;) {",
"int VAR_11;",
"if (VAR_3 <= VAR_4 && VAR_6 - VAR_5 < VAR_4 - VAR_3 + 1 + 1)\nreturn NULL;",
"for (VAR_11 = VAR_3; VAR_11 <= VAR_4; VAR_11++)",
"VAR_0[VAR_11] = *VAR_5++;",
"VAR_3 = *VAR_5++;",
"if (VAR_3 == 0)\nbreak;",
"VAR_4 = *VAR_5++;",
"}",
"VAR_0[256] = 1;",
"while ((VAR_5 - buf) & 3)\nVAR_5++;",
"for (VAR_7 = 257; VAR_7 < 512; VAR_7++) {",
"int VAR_9[2] = { 256 * 256, 256 * 256 };",
"int VAR_10[2] = { 0, 0 };",
"int VAR_11;",
"for (VAR_11 = 0; VAR_11 < VAR_7; VAR_11++) {",
"if (VAR_0[VAR_11] == 0)\ncontinue;",
"if (VAR_0[VAR_11] < VAR_9[1]) {",
"if (VAR_0[VAR_11] < VAR_9[0]) {",
"VAR_9[1] = VAR_9[0];",
"VAR_10[1] = VAR_10[0];",
"VAR_9[0] = VAR_0[VAR_11];",
"VAR_10[0] = VAR_11;",
"} else {",
"VAR_9[1] = VAR_0[VAR_11];",
"VAR_10[1] = VAR_11;",
"}",
"}",
"}",
"if (VAR_9[1] == 256 * 256)\nbreak;",
"VAR_0[VAR_7] = VAR_9[0] + VAR_9[1];",
"flag[VAR_10[0]] = 0;",
"flag[VAR_10[1]] = 1;",
"VAR_1[VAR_10[0]] =\nVAR_1[VAR_10[1]] = VAR_7;",
"VAR_0[VAR_10[0]] = VAR_0[VAR_10[1]] = 0;",
"}",
"for (VAR_7 = 0; VAR_7 < 257; VAR_7++) {",
"int VAR_11, VAR_12 = 0, VAR_13 = 0;",
"for (VAR_11 = VAR_7; VAR_1[VAR_11] != -1; VAR_11 = VAR_1[VAR_11]) {",
"VAR_13 += flag[VAR_11] << VAR_12;",
"VAR_12++;",
"if (VAR_12 > 31)\nav_log(f->avctx, AV_LOG_ERROR,\n\"vlc length overflow\\n\");",
"}",
"VAR_2[VAR_7] = VAR_13;",
"len_tab[VAR_7] = VAR_12;",
"}",
"if (init_vlc(&f->pre_vlc, ACDC_VLC_BITS, 257, len_tab, 1, 1,\nVAR_2, 4, 4, 0))\nreturn NULL;",
"return VAR_5;",
"}"
] |
[
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
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
27
],
[
31
],
[
33
],
[
35
],
[
37
],
[
41,
43
],
[
45
],
[
47
],
[
49
],
[
51,
53
],
[
57
],
[
59
],
[
61
],
[
65,
67
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81,
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109,
111
],
[
115
],
[
117
],
[
119
],
[
121,
123
],
[
125
],
[
127
],
[
131
],
[
133
],
[
137
],
[
139
],
[
141
],
[
143,
147,
149
],
[
151
],
[
155
],
[
157
],
[
159
],
[
163,
165,
167
],
[
171
],
[
173
]
] |
6,414 |
static const uint8_t *parse_opus_ts_header(const uint8_t *start, int *payload_len, int buf_len)
{
const uint8_t *buf = start + 1;
int start_trim_flag, end_trim_flag, control_extension_flag, control_extension_length;
uint8_t flags;
GetByteContext gb;
bytestream2_init(&gb, buf, buf_len);
flags = bytestream2_get_byte(&gb);
start_trim_flag = (flags >> 4) & 1;
end_trim_flag = (flags >> 3) & 1;
control_extension_flag = (flags >> 2) & 1;
*payload_len = 0;
while (bytestream2_peek_byte(&gb) == 0xff)
*payload_len += bytestream2_get_byte(&gb);
*payload_len += bytestream2_get_byte(&gb);
if (start_trim_flag)
bytestream2_skip(&gb, 2);
if (end_trim_flag)
bytestream2_skip(&gb, 2);
if (control_extension_flag) {
control_extension_length = bytestream2_get_byte(&gb);
bytestream2_skip(&gb, control_extension_length);
}
return buf + bytestream2_tell(&gb);
}
| true |
FFmpeg
|
1bcd7fefcb3c1ec47978fdc64a9e8dfb9512ae62
|
static const uint8_t *parse_opus_ts_header(const uint8_t *start, int *payload_len, int buf_len)
{
const uint8_t *buf = start + 1;
int start_trim_flag, end_trim_flag, control_extension_flag, control_extension_length;
uint8_t flags;
GetByteContext gb;
bytestream2_init(&gb, buf, buf_len);
flags = bytestream2_get_byte(&gb);
start_trim_flag = (flags >> 4) & 1;
end_trim_flag = (flags >> 3) & 1;
control_extension_flag = (flags >> 2) & 1;
*payload_len = 0;
while (bytestream2_peek_byte(&gb) == 0xff)
*payload_len += bytestream2_get_byte(&gb);
*payload_len += bytestream2_get_byte(&gb);
if (start_trim_flag)
bytestream2_skip(&gb, 2);
if (end_trim_flag)
bytestream2_skip(&gb, 2);
if (control_extension_flag) {
control_extension_length = bytestream2_get_byte(&gb);
bytestream2_skip(&gb, control_extension_length);
}
return buf + bytestream2_tell(&gb);
}
|
{
"code": [
" *payload_len = 0;",
" *payload_len += bytestream2_get_byte(&gb);",
" *payload_len += bytestream2_get_byte(&gb);"
],
"line_no": [
29,
33,
37
]
}
|
static const uint8_t *FUNC_0(const uint8_t *start, int *payload_len, int buf_len)
{
const uint8_t *VAR_0 = start + 1;
int VAR_1, VAR_2, VAR_3, VAR_4;
uint8_t flags;
GetByteContext gb;
bytestream2_init(&gb, VAR_0, buf_len);
flags = bytestream2_get_byte(&gb);
VAR_1 = (flags >> 4) & 1;
VAR_2 = (flags >> 3) & 1;
VAR_3 = (flags >> 2) & 1;
*payload_len = 0;
while (bytestream2_peek_byte(&gb) == 0xff)
*payload_len += bytestream2_get_byte(&gb);
*payload_len += bytestream2_get_byte(&gb);
if (VAR_1)
bytestream2_skip(&gb, 2);
if (VAR_2)
bytestream2_skip(&gb, 2);
if (VAR_3) {
VAR_4 = bytestream2_get_byte(&gb);
bytestream2_skip(&gb, VAR_4);
}
return VAR_0 + bytestream2_tell(&gb);
}
|
[
"static const uint8_t *FUNC_0(const uint8_t *start, int *payload_len, int buf_len)\n{",
"const uint8_t *VAR_0 = start + 1;",
"int VAR_1, VAR_2, VAR_3, VAR_4;",
"uint8_t flags;",
"GetByteContext gb;",
"bytestream2_init(&gb, VAR_0, buf_len);",
"flags = bytestream2_get_byte(&gb);",
"VAR_1 = (flags >> 4) & 1;",
"VAR_2 = (flags >> 3) & 1;",
"VAR_3 = (flags >> 2) & 1;",
"*payload_len = 0;",
"while (bytestream2_peek_byte(&gb) == 0xff)\n*payload_len += bytestream2_get_byte(&gb);",
"*payload_len += bytestream2_get_byte(&gb);",
"if (VAR_1)\nbytestream2_skip(&gb, 2);",
"if (VAR_2)\nbytestream2_skip(&gb, 2);",
"if (VAR_3) {",
"VAR_4 = bytestream2_get_byte(&gb);",
"bytestream2_skip(&gb, VAR_4);",
"}",
"return VAR_0 + bytestream2_tell(&gb);",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23
],
[
25
],
[
29
],
[
31,
33
],
[
37
],
[
41,
43
],
[
45,
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
59
],
[
61
]
] |
6,415 |
void qemu_cpu_kick(void *env)
{
}
| true |
qemu
|
12d4536f7d911b6d87a766ad7300482ea663cea2
|
void qemu_cpu_kick(void *env)
{
}
|
{
"code": [
"void qemu_cpu_kick(void *env)"
],
"line_no": [
1
]
}
|
void FUNC_0(void *VAR_0)
{
}
|
[
"void FUNC_0(void *VAR_0)\n{",
"}"
] |
[
1,
0
] |
[
[
1,
3
],
[
5
]
] |
6,416 |
int qemu_file_rate_limit(QEMUFile *f)
{
if (qemu_file_get_error(f)) {
return 1;
}
if (f->xfer_limit > 0 && f->bytes_xfer > f->xfer_limit) {
return 1;
}
return 0;
}
| true |
qemu
|
60fe637bf0e4d7989e21e50f52526444765c63b4
|
int qemu_file_rate_limit(QEMUFile *f)
{
if (qemu_file_get_error(f)) {
return 1;
}
if (f->xfer_limit > 0 && f->bytes_xfer > f->xfer_limit) {
return 1;
}
return 0;
}
|
{
"code": [],
"line_no": []
}
|
int FUNC_0(QEMUFile *VAR_0)
{
if (qemu_file_get_error(VAR_0)) {
return 1;
}
if (VAR_0->xfer_limit > 0 && VAR_0->bytes_xfer > VAR_0->xfer_limit) {
return 1;
}
return 0;
}
|
[
"int FUNC_0(QEMUFile *VAR_0)\n{",
"if (qemu_file_get_error(VAR_0)) {",
"return 1;",
"}",
"if (VAR_0->xfer_limit > 0 && VAR_0->bytes_xfer > VAR_0->xfer_limit) {",
"return 1;",
"}",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
]
] |
6,417 |
GenericList *visit_next_list(Visitor *v, GenericList **list, Error **errp)
{
if (!error_is_set(errp)) {
return v->next_list(v, list, errp);
}
return 0;
}
| true |
qemu
|
297a3646c2947ee64a6d42ca264039732c6218e0
|
GenericList *visit_next_list(Visitor *v, GenericList **list, Error **errp)
{
if (!error_is_set(errp)) {
return v->next_list(v, list, errp);
}
return 0;
}
|
{
"code": [
" if (!error_is_set(errp)) {",
" if (!error_is_set(errp)) {",
" if (!error_is_set(errp)) {",
" return v->next_list(v, list, errp);",
" return 0;",
" if (!error_is_set(errp)) {",
" if (!error_is_set(errp)) {",
" if (!error_is_set(errp)) {",
" if (!error_is_set(errp)) {",
" if (!error_is_set(errp)) {",
" if (!error_is_set(errp)) {",
" if (!error_is_set(errp)) {",
" if (!error_is_set(errp)) {",
" if (!error_is_set(errp)) {",
" if (!error_is_set(errp)) {",
" if (!error_is_set(errp)) {",
" if (!error_is_set(errp)) {",
" if (!error_is_set(errp)) {",
" if (!error_is_set(errp)) {",
" if (!error_is_set(errp)) {",
" if (!error_is_set(errp)) {",
" if (!error_is_set(errp)) {",
" if (!error_is_set(errp)) {"
],
"line_no": [
5,
5,
5,
7,
13,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5
]
}
|
GenericList *FUNC_0(Visitor *v, GenericList **list, Error **errp)
{
if (!error_is_set(errp)) {
return v->next_list(v, list, errp);
}
return 0;
}
|
[
"GenericList *FUNC_0(Visitor *v, GenericList **list, Error **errp)\n{",
"if (!error_is_set(errp)) {",
"return v->next_list(v, list, errp);",
"}",
"return 0;",
"}"
] |
[
0,
1,
1,
0,
1,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15
]
] |
6,418 |
static int handle_ping(URLContext *s, RTMPPacket *pkt)
{
RTMPContext *rt = s->priv_data;
int t, ret;
if (pkt->data_size < 2) {
av_log(s, AV_LOG_ERROR, "Too short ping packet (%d)\n",
pkt->data_size);
return AVERROR_INVALIDDATA;
t = AV_RB16(pkt->data);
if (t == 6) {
if ((ret = gen_pong(s, rt, pkt)) < 0)
return 0;
| true |
FFmpeg
|
635ac8e1be91e941908f85642e4bbb609e48193f
|
static int handle_ping(URLContext *s, RTMPPacket *pkt)
{
RTMPContext *rt = s->priv_data;
int t, ret;
if (pkt->data_size < 2) {
av_log(s, AV_LOG_ERROR, "Too short ping packet (%d)\n",
pkt->data_size);
return AVERROR_INVALIDDATA;
t = AV_RB16(pkt->data);
if (t == 6) {
if ((ret = gen_pong(s, rt, pkt)) < 0)
return 0;
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(URLContext *VAR_0, RTMPPacket *VAR_1)
{
RTMPContext *rt = VAR_0->priv_data;
int VAR_2, VAR_3;
if (VAR_1->data_size < 2) {
av_log(VAR_0, AV_LOG_ERROR, "Too short ping packet (%d)\n",
VAR_1->data_size);
return AVERROR_INVALIDDATA;
VAR_2 = AV_RB16(VAR_1->data);
if (VAR_2 == 6) {
if ((VAR_3 = gen_pong(VAR_0, rt, VAR_1)) < 0)
return 0;
|
[
"static int FUNC_0(URLContext *VAR_0, RTMPPacket *VAR_1)\n{",
"RTMPContext *rt = VAR_0->priv_data;",
"int VAR_2, VAR_3;",
"if (VAR_1->data_size < 2) {",
"av_log(VAR_0, AV_LOG_ERROR, \"Too short ping packet (%d)\\n\",\nVAR_1->data_size);",
"return AVERROR_INVALIDDATA;",
"VAR_2 = AV_RB16(VAR_1->data);",
"if (VAR_2 == 6) {",
"if ((VAR_3 = gen_pong(VAR_0, rt, VAR_1)) < 0)\nreturn 0;"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13,
15
],
[
17
],
[
22
],
[
24
],
[
26,
39
]
] |
6,419 |
static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
{
AVFilterContext *ctx = inlink->dst;
AVFilterLink *outlink = ctx->outputs[0];
AVFilterBufferRef *outpicref = outlink->out_buf;
OverlayContext *over = ctx->priv;
if (over->overpicref &&
!(over->x >= outpicref->video->w || over->y >= outpicref->video->h ||
y+h < over->y || y >= over->y + over->overpicref->video->h)) {
blend_slice(ctx, outpicref, over->overpicref, over->x, over->y,
over->overpicref->video->w, over->overpicref->video->h,
y, outpicref->video->w, h);
}
avfilter_draw_slice(outlink, y, h, slice_dir);
}
| true |
FFmpeg
|
06bf6d3bc04979bd39ecdc7311d0daf8aee7e10f
|
static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
{
AVFilterContext *ctx = inlink->dst;
AVFilterLink *outlink = ctx->outputs[0];
AVFilterBufferRef *outpicref = outlink->out_buf;
OverlayContext *over = ctx->priv;
if (over->overpicref &&
!(over->x >= outpicref->video->w || over->y >= outpicref->video->h ||
y+h < over->y || y >= over->y + over->overpicref->video->h)) {
blend_slice(ctx, outpicref, over->overpicref, over->x, over->y,
over->overpicref->video->w, over->overpicref->video->h,
y, outpicref->video->w, h);
}
avfilter_draw_slice(outlink, y, h, slice_dir);
}
|
{
"code": [
" AVFilterContext *ctx = inlink->dst;",
" OverlayContext *over = ctx->priv;",
" AVFilterContext *ctx = inlink->dst;",
" OverlayContext *over = ctx->priv;",
"static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)",
" AVFilterContext *ctx = inlink->dst;",
" !(over->x >= outpicref->video->w || over->y >= outpicref->video->h ||",
" y+h < over->y || y >= over->y + over->overpicref->video->h)) {"
],
"line_no": [
5,
11,
5,
11,
1,
5,
17,
19
]
}
|
static void FUNC_0(AVFilterLink *VAR_0, int VAR_1, int VAR_2, int VAR_3)
{
AVFilterContext *ctx = VAR_0->dst;
AVFilterLink *outlink = ctx->outputs[0];
AVFilterBufferRef *outpicref = outlink->out_buf;
OverlayContext *over = ctx->priv;
if (over->overpicref &&
!(over->x >= outpicref->video->w || over->VAR_1 >= outpicref->video->VAR_2 ||
VAR_1+VAR_2 < over->VAR_1 || VAR_1 >= over->VAR_1 + over->overpicref->video->VAR_2)) {
blend_slice(ctx, outpicref, over->overpicref, over->x, over->VAR_1,
over->overpicref->video->w, over->overpicref->video->VAR_2,
VAR_1, outpicref->video->w, VAR_2);
}
avfilter_draw_slice(outlink, VAR_1, VAR_2, VAR_3);
}
|
[
"static void FUNC_0(AVFilterLink *VAR_0, int VAR_1, int VAR_2, int VAR_3)\n{",
"AVFilterContext *ctx = VAR_0->dst;",
"AVFilterLink *outlink = ctx->outputs[0];",
"AVFilterBufferRef *outpicref = outlink->out_buf;",
"OverlayContext *over = ctx->priv;",
"if (over->overpicref &&\n!(over->x >= outpicref->video->w || over->VAR_1 >= outpicref->video->VAR_2 ||\nVAR_1+VAR_2 < over->VAR_1 || VAR_1 >= over->VAR_1 + over->overpicref->video->VAR_2)) {",
"blend_slice(ctx, outpicref, over->overpicref, over->x, over->VAR_1,\nover->overpicref->video->w, over->overpicref->video->VAR_2,\nVAR_1, outpicref->video->w, VAR_2);",
"}",
"avfilter_draw_slice(outlink, VAR_1, VAR_2, VAR_3);",
"}"
] |
[
1,
1,
0,
0,
1,
1,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15,
17,
19
],
[
21,
23,
25
],
[
27
],
[
29
],
[
31
]
] |
6,420 |
static void handle_sys(DisasContext *s, uint32_t insn, bool isread,
unsigned int op0, unsigned int op1, unsigned int op2,
unsigned int crn, unsigned int crm, unsigned int rt)
{
const ARMCPRegInfo *ri;
TCGv_i64 tcg_rt;
ri = get_arm_cp_reginfo(s->cp_regs,
ENCODE_AA64_CP_REG(CP_REG_ARM64_SYSREG_CP,
crn, crm, op0, op1, op2));
if (!ri) {
/* Unknown register; this might be a guest error or a QEMU
* unimplemented feature.
qemu_log_mask(LOG_UNIMP, "%s access to unsupported AArch64 "
"system register op0:%d op1:%d crn:%d crm:%d op2:%d\n",
isread ? "read" : "write", op0, op1, crn, crm, op2);
unallocated_encoding(s);
return;
/* Check access permissions */
if (!cp_access_ok(s->current_pl, ri, isread)) {
unallocated_encoding(s);
return;
/* Handle special cases first */
switch (ri->type & ~(ARM_CP_FLAG_MASK & ~ARM_CP_SPECIAL)) {
case ARM_CP_NOP:
return;
case ARM_CP_NZCV:
tcg_rt = cpu_reg(s, rt);
if (isread) {
gen_get_nzcv(tcg_rt);
} else {
gen_set_nzcv(tcg_rt);
return;
default:
break;
if (use_icount && (ri->type & ARM_CP_IO)) {
gen_io_start();
tcg_rt = cpu_reg(s, rt);
if (isread) {
if (ri->type & ARM_CP_CONST) {
tcg_gen_movi_i64(tcg_rt, ri->resetvalue);
} else if (ri->readfn) {
gen_helper_get_cp_reg64(tcg_rt, cpu_env, tmpptr);
} else {
tcg_gen_ld_i64(tcg_rt, cpu_env, ri->fieldoffset);
} else {
if (ri->type & ARM_CP_CONST) {
/* If not forbidden by access permissions, treat as WI */
return;
} else if (ri->writefn) {
gen_helper_set_cp_reg64(cpu_env, tmpptr, tcg_rt);
} else {
tcg_gen_st_i64(tcg_rt, cpu_env, ri->fieldoffset);
if (use_icount && (ri->type & ARM_CP_IO)) {
/* I/O operations must end the TB here (whether read or write) */
gen_io_end();
s->is_jmp = DISAS_UPDATE;
} else if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) {
/* We default to ending the TB on a coprocessor register write,
* but allow this to be suppressed by the register definition
* (usually only necessary to work around guest bugs).
s->is_jmp = DISAS_UPDATE;
| true |
qemu
|
f59df3f2354982ee0381b87d1ce561f1eb0ed505
|
static void handle_sys(DisasContext *s, uint32_t insn, bool isread,
unsigned int op0, unsigned int op1, unsigned int op2,
unsigned int crn, unsigned int crm, unsigned int rt)
{
const ARMCPRegInfo *ri;
TCGv_i64 tcg_rt;
ri = get_arm_cp_reginfo(s->cp_regs,
ENCODE_AA64_CP_REG(CP_REG_ARM64_SYSREG_CP,
crn, crm, op0, op1, op2));
if (!ri) {
if (!cp_access_ok(s->current_pl, ri, isread)) {
unallocated_encoding(s);
return;
switch (ri->type & ~(ARM_CP_FLAG_MASK & ~ARM_CP_SPECIAL)) {
case ARM_CP_NOP:
return;
case ARM_CP_NZCV:
tcg_rt = cpu_reg(s, rt);
if (isread) {
gen_get_nzcv(tcg_rt);
} else {
gen_set_nzcv(tcg_rt);
return;
default:
break;
if (use_icount && (ri->type & ARM_CP_IO)) {
gen_io_start();
tcg_rt = cpu_reg(s, rt);
if (isread) {
if (ri->type & ARM_CP_CONST) {
tcg_gen_movi_i64(tcg_rt, ri->resetvalue);
} else if (ri->readfn) {
gen_helper_get_cp_reg64(tcg_rt, cpu_env, tmpptr);
} else {
tcg_gen_ld_i64(tcg_rt, cpu_env, ri->fieldoffset);
} else {
if (ri->type & ARM_CP_CONST) {
return;
} else if (ri->writefn) {
gen_helper_set_cp_reg64(cpu_env, tmpptr, tcg_rt);
} else {
tcg_gen_st_i64(tcg_rt, cpu_env, ri->fieldoffset);
if (use_icount && (ri->type & ARM_CP_IO)) {
gen_io_end();
s->is_jmp = DISAS_UPDATE;
} else if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) {
/* We default to ending the TB on a coprocessor register write,
* but allow this to be suppressed by the register definition
* (usually only necessary to work around guest bugs).
s->is_jmp = DISAS_UPDATE;
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(DisasContext *VAR_0, uint32_t VAR_1, bool VAR_2,
unsigned int VAR_3, unsigned int VAR_4, unsigned int VAR_5,
unsigned int VAR_6, unsigned int VAR_7, unsigned int VAR_8)
{
const ARMCPRegInfo *VAR_9;
TCGv_i64 tcg_rt;
VAR_9 = get_arm_cp_reginfo(VAR_0->cp_regs,
ENCODE_AA64_CP_REG(CP_REG_ARM64_SYSREG_CP,
VAR_6, VAR_7, VAR_3, VAR_4, VAR_5));
if (!VAR_9) {
if (!cp_access_ok(VAR_0->current_pl, VAR_9, VAR_2)) {
unallocated_encoding(VAR_0);
return;
switch (VAR_9->type & ~(ARM_CP_FLAG_MASK & ~ARM_CP_SPECIAL)) {
case ARM_CP_NOP:
return;
case ARM_CP_NZCV:
tcg_rt = cpu_reg(VAR_0, VAR_8);
if (VAR_2) {
gen_get_nzcv(tcg_rt);
} else {
gen_set_nzcv(tcg_rt);
return;
default:
break;
if (use_icount && (VAR_9->type & ARM_CP_IO)) {
gen_io_start();
tcg_rt = cpu_reg(VAR_0, VAR_8);
if (VAR_2) {
if (VAR_9->type & ARM_CP_CONST) {
tcg_gen_movi_i64(tcg_rt, VAR_9->resetvalue);
} else if (VAR_9->readfn) {
gen_helper_get_cp_reg64(tcg_rt, cpu_env, tmpptr);
} else {
tcg_gen_ld_i64(tcg_rt, cpu_env, VAR_9->fieldoffset);
} else {
if (VAR_9->type & ARM_CP_CONST) {
return;
} else if (VAR_9->writefn) {
gen_helper_set_cp_reg64(cpu_env, tmpptr, tcg_rt);
} else {
tcg_gen_st_i64(tcg_rt, cpu_env, VAR_9->fieldoffset);
if (use_icount && (VAR_9->type & ARM_CP_IO)) {
gen_io_end();
VAR_0->is_jmp = DISAS_UPDATE;
} else if (!VAR_2 && !(VAR_9->type & ARM_CP_SUPPRESS_TB_END)) {
/* We default to ending the TB on a coprocessor register write,
* but allow this to be suppressed by the register definition
* (usually only necessary to work around guest bugs).
VAR_0->is_jmp = DISAS_UPDATE;
|
[
"static void FUNC_0(DisasContext *VAR_0, uint32_t VAR_1, bool VAR_2,\nunsigned int VAR_3, unsigned int VAR_4, unsigned int VAR_5,\nunsigned int VAR_6, unsigned int VAR_7, unsigned int VAR_8)\n{",
"const ARMCPRegInfo *VAR_9;",
"TCGv_i64 tcg_rt;",
"VAR_9 = get_arm_cp_reginfo(VAR_0->cp_regs,\nENCODE_AA64_CP_REG(CP_REG_ARM64_SYSREG_CP,\nVAR_6, VAR_7, VAR_3, VAR_4, VAR_5));",
"if (!VAR_9) {",
"if (!cp_access_ok(VAR_0->current_pl, VAR_9, VAR_2)) {",
"unallocated_encoding(VAR_0);",
"return;",
"switch (VAR_9->type & ~(ARM_CP_FLAG_MASK & ~ARM_CP_SPECIAL)) {",
"case ARM_CP_NOP:\nreturn;",
"case ARM_CP_NZCV:\ntcg_rt = cpu_reg(VAR_0, VAR_8);",
"if (VAR_2) {",
"gen_get_nzcv(tcg_rt);",
"} else {",
"gen_set_nzcv(tcg_rt);",
"return;",
"default:\nbreak;",
"if (use_icount && (VAR_9->type & ARM_CP_IO)) {",
"gen_io_start();",
"tcg_rt = cpu_reg(VAR_0, VAR_8);",
"if (VAR_2) {",
"if (VAR_9->type & ARM_CP_CONST) {",
"tcg_gen_movi_i64(tcg_rt, VAR_9->resetvalue);",
"} else if (VAR_9->readfn) {",
"gen_helper_get_cp_reg64(tcg_rt, cpu_env, tmpptr);",
"} else {",
"tcg_gen_ld_i64(tcg_rt, cpu_env, VAR_9->fieldoffset);",
"} else {",
"if (VAR_9->type & ARM_CP_CONST) {",
"return;",
"} else if (VAR_9->writefn) {",
"gen_helper_set_cp_reg64(cpu_env, tmpptr, tcg_rt);",
"} else {",
"tcg_gen_st_i64(tcg_rt, cpu_env, VAR_9->fieldoffset);",
"if (use_icount && (VAR_9->type & ARM_CP_IO)) {",
"gen_io_end();",
"VAR_0->is_jmp = DISAS_UPDATE;",
"} else if (!VAR_2 && !(VAR_9->type & ARM_CP_SUPPRESS_TB_END)) {",
"/* We default to ending the TB on a coprocessor register write,\n* but allow this to be suppressed by the register definition\n* (usually only necessary to work around guest bugs).\nVAR_0->is_jmp = DISAS_UPDATE;"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
2,
3,
4
],
[
5
],
[
6
],
[
7,
8,
9
],
[
10
],
[
19
],
[
20
],
[
21
],
[
23
],
[
24,
25
],
[
26,
27
],
[
28
],
[
29
],
[
30
],
[
31
],
[
32
],
[
33,
34
],
[
35
],
[
36
],
[
37
],
[
38
],
[
39
],
[
40
],
[
41
],
[
42
],
[
43
],
[
44
],
[
45
],
[
46
],
[
48
],
[
49
],
[
50
],
[
51
],
[
52
],
[
53
],
[
55
],
[
56
],
[
57
],
[
58,
59,
60,
61
]
] |
6,421 |
static void gic_cpu_write(gic_state *s, int cpu, int offset, uint32_t value)
{
switch (offset) {
case 0x00: /* Control */
s->cpu_enabled[cpu] = (value & 1);
DPRINTF("CPU %d %sabled\n", cpu, s->cpu_enabled ? "En" : "Dis");
break;
case 0x04: /* Priority mask */
s->priority_mask[cpu] = (value & 0xff);
break;
case 0x08: /* Binary Point */
/* ??? Not implemented. */
break;
case 0x10: /* End Of Interrupt */
return gic_complete_irq(s, cpu, value & 0x3ff);
default:
hw_error("gic_cpu_write: Bad offset %x\n", (int)offset);
return;
}
gic_update(s);
}
| true |
qemu
|
9ab1b6053f03d58ba8e7accc8f19c882fbffb66f
|
static void gic_cpu_write(gic_state *s, int cpu, int offset, uint32_t value)
{
switch (offset) {
case 0x00:
s->cpu_enabled[cpu] = (value & 1);
DPRINTF("CPU %d %sabled\n", cpu, s->cpu_enabled ? "En" : "Dis");
break;
case 0x04:
s->priority_mask[cpu] = (value & 0xff);
break;
case 0x08:
break;
case 0x10:
return gic_complete_irq(s, cpu, value & 0x3ff);
default:
hw_error("gic_cpu_write: Bad offset %x\n", (int)offset);
return;
}
gic_update(s);
}
|
{
"code": [
" DPRINTF(\"CPU %d %sabled\\n\", cpu, s->cpu_enabled ? \"En\" : \"Dis\");"
],
"line_no": [
11
]
}
|
static void FUNC_0(gic_state *VAR_0, int VAR_1, int VAR_2, uint32_t VAR_3)
{
switch (VAR_2) {
case 0x00:
VAR_0->cpu_enabled[VAR_1] = (VAR_3 & 1);
DPRINTF("CPU %d %sabled\n", VAR_1, VAR_0->cpu_enabled ? "En" : "Dis");
break;
case 0x04:
VAR_0->priority_mask[VAR_1] = (VAR_3 & 0xff);
break;
case 0x08:
break;
case 0x10:
return gic_complete_irq(VAR_0, VAR_1, VAR_3 & 0x3ff);
default:
hw_error("FUNC_0: Bad VAR_2 %x\n", (int)VAR_2);
return;
}
gic_update(VAR_0);
}
|
[
"static void FUNC_0(gic_state *VAR_0, int VAR_1, int VAR_2, uint32_t VAR_3)\n{",
"switch (VAR_2) {",
"case 0x00:\nVAR_0->cpu_enabled[VAR_1] = (VAR_3 & 1);",
"DPRINTF(\"CPU %d %sabled\\n\", VAR_1, VAR_0->cpu_enabled ? \"En\" : \"Dis\");",
"break;",
"case 0x04:\nVAR_0->priority_mask[VAR_1] = (VAR_3 & 0xff);",
"break;",
"case 0x08:\nbreak;",
"case 0x10:\nreturn gic_complete_irq(VAR_0, VAR_1, VAR_3 & 0x3ff);",
"default:\nhw_error(\"FUNC_0: Bad VAR_2 %x\\n\", (int)VAR_2);",
"return;",
"}",
"gic_update(VAR_0);",
"}"
] |
[
0,
0,
0,
1,
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
]
] |
6,422 |
int avpicture_get_size(enum PixelFormat pix_fmt, int width, int height)
{
AVPicture dummy_pict;
if(av_image_check_size(width, height, 0, NULL))
return -1;
switch (pix_fmt) {
case PIX_FMT_RGB8:
case PIX_FMT_BGR8:
case PIX_FMT_RGB4_BYTE:
case PIX_FMT_BGR4_BYTE:
case PIX_FMT_GRAY8:
// do not include palette for these pseudo-paletted formats
return width * height;
}
return avpicture_fill(&dummy_pict, NULL, pix_fmt, width, height);
}
| true |
FFmpeg
|
38d553322891c8e47182f05199d19888422167dc
|
int avpicture_get_size(enum PixelFormat pix_fmt, int width, int height)
{
AVPicture dummy_pict;
if(av_image_check_size(width, height, 0, NULL))
return -1;
switch (pix_fmt) {
case PIX_FMT_RGB8:
case PIX_FMT_BGR8:
case PIX_FMT_RGB4_BYTE:
case PIX_FMT_BGR4_BYTE:
case PIX_FMT_GRAY8:
return width * height;
}
return avpicture_fill(&dummy_pict, NULL, pix_fmt, width, height);
}
|
{
"code": [
" switch (pix_fmt) {",
" case PIX_FMT_RGB8:",
" case PIX_FMT_BGR8:",
" case PIX_FMT_RGB4_BYTE:",
" case PIX_FMT_BGR4_BYTE:",
" case PIX_FMT_GRAY8:"
],
"line_no": [
11,
13,
15,
17,
19,
21
]
}
|
int FUNC_0(enum PixelFormat VAR_0, int VAR_1, int VAR_2)
{
AVPicture dummy_pict;
if(av_image_check_size(VAR_1, VAR_2, 0, NULL))
return -1;
switch (VAR_0) {
case PIX_FMT_RGB8:
case PIX_FMT_BGR8:
case PIX_FMT_RGB4_BYTE:
case PIX_FMT_BGR4_BYTE:
case PIX_FMT_GRAY8:
return VAR_1 * VAR_2;
}
return avpicture_fill(&dummy_pict, NULL, VAR_0, VAR_1, VAR_2);
}
|
[
"int FUNC_0(enum PixelFormat VAR_0, int VAR_1, int VAR_2)\n{",
"AVPicture dummy_pict;",
"if(av_image_check_size(VAR_1, VAR_2, 0, NULL))\nreturn -1;",
"switch (VAR_0) {",
"case PIX_FMT_RGB8:\ncase PIX_FMT_BGR8:\ncase PIX_FMT_RGB4_BYTE:\ncase PIX_FMT_BGR4_BYTE:\ncase PIX_FMT_GRAY8:\nreturn VAR_1 * VAR_2;",
"}",
"return avpicture_fill(&dummy_pict, NULL, VAR_0, VAR_1, VAR_2);",
"}"
] |
[
0,
0,
0,
1,
1,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7,
9
],
[
11
],
[
13,
15,
17,
19,
21,
25
],
[
27
],
[
29
],
[
31
]
] |
6,423 |
static void qemu_rdma_cleanup(RDMAContext *rdma)
{
struct rdma_cm_event *cm_event;
int ret, idx;
if (rdma->cm_id && rdma->connected) {
if (rdma->error_state) {
RDMAControlHeader head = { .len = 0,
.type = RDMA_CONTROL_ERROR,
.repeat = 1,
};
error_report("Early error. Sending error.");
qemu_rdma_post_send_control(rdma, NULL, &head);
}
ret = rdma_disconnect(rdma->cm_id);
if (!ret) {
trace_qemu_rdma_cleanup_waiting_for_disconnect();
ret = rdma_get_cm_event(rdma->channel, &cm_event);
if (!ret) {
rdma_ack_cm_event(cm_event);
}
}
trace_qemu_rdma_cleanup_disconnect();
rdma->connected = false;
}
g_free(rdma->block);
rdma->block = NULL;
for (idx = 0; idx < RDMA_WRID_MAX; idx++) {
if (rdma->wr_data[idx].control_mr) {
rdma->total_registrations--;
ibv_dereg_mr(rdma->wr_data[idx].control_mr);
}
rdma->wr_data[idx].control_mr = NULL;
}
if (rdma->local_ram_blocks.block) {
while (rdma->local_ram_blocks.nb_blocks) {
rdma_delete_block(rdma, rdma->local_ram_blocks.block->offset);
}
}
if (rdma->cq) {
ibv_destroy_cq(rdma->cq);
rdma->cq = NULL;
}
if (rdma->comp_channel) {
ibv_destroy_comp_channel(rdma->comp_channel);
rdma->comp_channel = NULL;
}
if (rdma->pd) {
ibv_dealloc_pd(rdma->pd);
rdma->pd = NULL;
}
if (rdma->listen_id) {
rdma_destroy_id(rdma->listen_id);
rdma->listen_id = NULL;
}
if (rdma->cm_id) {
if (rdma->qp) {
rdma_destroy_qp(rdma->cm_id);
rdma->qp = NULL;
}
rdma_destroy_id(rdma->cm_id);
rdma->cm_id = NULL;
}
if (rdma->channel) {
rdma_destroy_event_channel(rdma->channel);
rdma->channel = NULL;
}
g_free(rdma->host);
rdma->host = NULL;
}
| true |
qemu
|
80b262e1439a22708e1c535b75363d4b90c3b41d
|
static void qemu_rdma_cleanup(RDMAContext *rdma)
{
struct rdma_cm_event *cm_event;
int ret, idx;
if (rdma->cm_id && rdma->connected) {
if (rdma->error_state) {
RDMAControlHeader head = { .len = 0,
.type = RDMA_CONTROL_ERROR,
.repeat = 1,
};
error_report("Early error. Sending error.");
qemu_rdma_post_send_control(rdma, NULL, &head);
}
ret = rdma_disconnect(rdma->cm_id);
if (!ret) {
trace_qemu_rdma_cleanup_waiting_for_disconnect();
ret = rdma_get_cm_event(rdma->channel, &cm_event);
if (!ret) {
rdma_ack_cm_event(cm_event);
}
}
trace_qemu_rdma_cleanup_disconnect();
rdma->connected = false;
}
g_free(rdma->block);
rdma->block = NULL;
for (idx = 0; idx < RDMA_WRID_MAX; idx++) {
if (rdma->wr_data[idx].control_mr) {
rdma->total_registrations--;
ibv_dereg_mr(rdma->wr_data[idx].control_mr);
}
rdma->wr_data[idx].control_mr = NULL;
}
if (rdma->local_ram_blocks.block) {
while (rdma->local_ram_blocks.nb_blocks) {
rdma_delete_block(rdma, rdma->local_ram_blocks.block->offset);
}
}
if (rdma->cq) {
ibv_destroy_cq(rdma->cq);
rdma->cq = NULL;
}
if (rdma->comp_channel) {
ibv_destroy_comp_channel(rdma->comp_channel);
rdma->comp_channel = NULL;
}
if (rdma->pd) {
ibv_dealloc_pd(rdma->pd);
rdma->pd = NULL;
}
if (rdma->listen_id) {
rdma_destroy_id(rdma->listen_id);
rdma->listen_id = NULL;
}
if (rdma->cm_id) {
if (rdma->qp) {
rdma_destroy_qp(rdma->cm_id);
rdma->qp = NULL;
}
rdma_destroy_id(rdma->cm_id);
rdma->cm_id = NULL;
}
if (rdma->channel) {
rdma_destroy_event_channel(rdma->channel);
rdma->channel = NULL;
}
g_free(rdma->host);
rdma->host = NULL;
}
|
{
"code": [
" if (rdma->listen_id) {",
" rdma_destroy_id(rdma->listen_id);",
" rdma->listen_id = NULL;",
" if (rdma->qp) {",
" rdma_destroy_qp(rdma->cm_id);",
" rdma->qp = NULL;",
" rdma_destroy_id(rdma->cm_id);",
" rdma->cm_id = NULL;",
" rdma_destroy_id(rdma->cm_id);",
" rdma->cm_id = NULL;",
" rdma_destroy_id(rdma->cm_id);",
" rdma->cm_id = NULL;"
],
"line_no": [
113,
115,
117,
123,
125,
127,
131,
133,
131,
133,
131,
133
]
}
|
static void FUNC_0(RDMAContext *VAR_0)
{
struct rdma_cm_event *VAR_1;
int VAR_2, VAR_3;
if (VAR_0->cm_id && VAR_0->connected) {
if (VAR_0->error_state) {
RDMAControlHeader head = { .len = 0,
.type = RDMA_CONTROL_ERROR,
.repeat = 1,
};
error_report("Early error. Sending error.");
qemu_rdma_post_send_control(VAR_0, NULL, &head);
}
VAR_2 = rdma_disconnect(VAR_0->cm_id);
if (!VAR_2) {
trace_qemu_rdma_cleanup_waiting_for_disconnect();
VAR_2 = rdma_get_cm_event(VAR_0->channel, &VAR_1);
if (!VAR_2) {
rdma_ack_cm_event(VAR_1);
}
}
trace_qemu_rdma_cleanup_disconnect();
VAR_0->connected = false;
}
g_free(VAR_0->block);
VAR_0->block = NULL;
for (VAR_3 = 0; VAR_3 < RDMA_WRID_MAX; VAR_3++) {
if (VAR_0->wr_data[VAR_3].control_mr) {
VAR_0->total_registrations--;
ibv_dereg_mr(VAR_0->wr_data[VAR_3].control_mr);
}
VAR_0->wr_data[VAR_3].control_mr = NULL;
}
if (VAR_0->local_ram_blocks.block) {
while (VAR_0->local_ram_blocks.nb_blocks) {
rdma_delete_block(VAR_0, VAR_0->local_ram_blocks.block->offset);
}
}
if (VAR_0->cq) {
ibv_destroy_cq(VAR_0->cq);
VAR_0->cq = NULL;
}
if (VAR_0->comp_channel) {
ibv_destroy_comp_channel(VAR_0->comp_channel);
VAR_0->comp_channel = NULL;
}
if (VAR_0->pd) {
ibv_dealloc_pd(VAR_0->pd);
VAR_0->pd = NULL;
}
if (VAR_0->listen_id) {
rdma_destroy_id(VAR_0->listen_id);
VAR_0->listen_id = NULL;
}
if (VAR_0->cm_id) {
if (VAR_0->qp) {
rdma_destroy_qp(VAR_0->cm_id);
VAR_0->qp = NULL;
}
rdma_destroy_id(VAR_0->cm_id);
VAR_0->cm_id = NULL;
}
if (VAR_0->channel) {
rdma_destroy_event_channel(VAR_0->channel);
VAR_0->channel = NULL;
}
g_free(VAR_0->host);
VAR_0->host = NULL;
}
|
[
"static void FUNC_0(RDMAContext *VAR_0)\n{",
"struct rdma_cm_event *VAR_1;",
"int VAR_2, VAR_3;",
"if (VAR_0->cm_id && VAR_0->connected) {",
"if (VAR_0->error_state) {",
"RDMAControlHeader head = { .len = 0,",
".type = RDMA_CONTROL_ERROR,\n.repeat = 1,\n};",
"error_report(\"Early error. Sending error.\");",
"qemu_rdma_post_send_control(VAR_0, NULL, &head);",
"}",
"VAR_2 = rdma_disconnect(VAR_0->cm_id);",
"if (!VAR_2) {",
"trace_qemu_rdma_cleanup_waiting_for_disconnect();",
"VAR_2 = rdma_get_cm_event(VAR_0->channel, &VAR_1);",
"if (!VAR_2) {",
"rdma_ack_cm_event(VAR_1);",
"}",
"}",
"trace_qemu_rdma_cleanup_disconnect();",
"VAR_0->connected = false;",
"}",
"g_free(VAR_0->block);",
"VAR_0->block = NULL;",
"for (VAR_3 = 0; VAR_3 < RDMA_WRID_MAX; VAR_3++) {",
"if (VAR_0->wr_data[VAR_3].control_mr) {",
"VAR_0->total_registrations--;",
"ibv_dereg_mr(VAR_0->wr_data[VAR_3].control_mr);",
"}",
"VAR_0->wr_data[VAR_3].control_mr = NULL;",
"}",
"if (VAR_0->local_ram_blocks.block) {",
"while (VAR_0->local_ram_blocks.nb_blocks) {",
"rdma_delete_block(VAR_0, VAR_0->local_ram_blocks.block->offset);",
"}",
"}",
"if (VAR_0->cq) {",
"ibv_destroy_cq(VAR_0->cq);",
"VAR_0->cq = NULL;",
"}",
"if (VAR_0->comp_channel) {",
"ibv_destroy_comp_channel(VAR_0->comp_channel);",
"VAR_0->comp_channel = NULL;",
"}",
"if (VAR_0->pd) {",
"ibv_dealloc_pd(VAR_0->pd);",
"VAR_0->pd = NULL;",
"}",
"if (VAR_0->listen_id) {",
"rdma_destroy_id(VAR_0->listen_id);",
"VAR_0->listen_id = NULL;",
"}",
"if (VAR_0->cm_id) {",
"if (VAR_0->qp) {",
"rdma_destroy_qp(VAR_0->cm_id);",
"VAR_0->qp = NULL;",
"}",
"rdma_destroy_id(VAR_0->cm_id);",
"VAR_0->cm_id = NULL;",
"}",
"if (VAR_0->channel) {",
"rdma_destroy_event_channel(VAR_0->channel);",
"VAR_0->channel = NULL;",
"}",
"g_free(VAR_0->host);",
"VAR_0->host = 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,
1,
1,
1,
0,
0,
1,
1,
1,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
15
],
[
17,
19,
21
],
[
23
],
[
25
],
[
27
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
55
],
[
57
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
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
]
] |
6,424 |
static void write_picture(AVFormatContext *s, int index, AVPicture *picture,
int pix_fmt, int w, int h)
{
UINT8 *buf, *src, *dest;
int size, j, i;
size = avpicture_get_size(pix_fmt, w, h);
buf = malloc(size);
if (!buf)
return;
/* XXX: not efficient, should add test if we can take
directly the AVPicture */
switch(pix_fmt) {
case PIX_FMT_YUV420P:
dest = buf;
for(i=0;i<3;i++) {
if (i == 1) {
w >>= 1;
h >>= 1;
}
src = picture->data[i];
for(j=0;j<h;j++) {
memcpy(dest, src, w);
dest += w;
src += picture->linesize[i];
}
}
break;
case PIX_FMT_YUV422P:
size = (w * h) * 2;
buf = malloc(size);
dest = buf;
for(i=0;i<3;i++) {
if (i == 1) {
w >>= 1;
}
src = picture->data[i];
for(j=0;j<h;j++) {
memcpy(dest, src, w);
dest += w;
src += picture->linesize[i];
}
}
break;
case PIX_FMT_YUV444P:
size = (w * h) * 3;
buf = malloc(size);
dest = buf;
for(i=0;i<3;i++) {
src = picture->data[i];
for(j=0;j<h;j++) {
memcpy(dest, src, w);
dest += w;
src += picture->linesize[i];
}
}
break;
case PIX_FMT_YUV422:
size = (w * h) * 2;
buf = malloc(size);
dest = buf;
src = picture->data[0];
for(j=0;j<h;j++) {
memcpy(dest, src, w * 2);
dest += w * 2;
src += picture->linesize[0];
}
break;
case PIX_FMT_RGB24:
case PIX_FMT_BGR24:
size = (w * h) * 3;
buf = malloc(size);
dest = buf;
src = picture->data[0];
for(j=0;j<h;j++) {
memcpy(dest, src, w * 3);
dest += w * 3;
src += picture->linesize[0];
}
break;
default:
return;
}
s->format->write_packet(s, index, buf, size);
free(buf);
}
| true |
FFmpeg
|
5b0ad91b996506632708dcefc22d2835d04a4dba
|
static void write_picture(AVFormatContext *s, int index, AVPicture *picture,
int pix_fmt, int w, int h)
{
UINT8 *buf, *src, *dest;
int size, j, i;
size = avpicture_get_size(pix_fmt, w, h);
buf = malloc(size);
if (!buf)
return;
switch(pix_fmt) {
case PIX_FMT_YUV420P:
dest = buf;
for(i=0;i<3;i++) {
if (i == 1) {
w >>= 1;
h >>= 1;
}
src = picture->data[i];
for(j=0;j<h;j++) {
memcpy(dest, src, w);
dest += w;
src += picture->linesize[i];
}
}
break;
case PIX_FMT_YUV422P:
size = (w * h) * 2;
buf = malloc(size);
dest = buf;
for(i=0;i<3;i++) {
if (i == 1) {
w >>= 1;
}
src = picture->data[i];
for(j=0;j<h;j++) {
memcpy(dest, src, w);
dest += w;
src += picture->linesize[i];
}
}
break;
case PIX_FMT_YUV444P:
size = (w * h) * 3;
buf = malloc(size);
dest = buf;
for(i=0;i<3;i++) {
src = picture->data[i];
for(j=0;j<h;j++) {
memcpy(dest, src, w);
dest += w;
src += picture->linesize[i];
}
}
break;
case PIX_FMT_YUV422:
size = (w * h) * 2;
buf = malloc(size);
dest = buf;
src = picture->data[0];
for(j=0;j<h;j++) {
memcpy(dest, src, w * 2);
dest += w * 2;
src += picture->linesize[0];
}
break;
case PIX_FMT_RGB24:
case PIX_FMT_BGR24:
size = (w * h) * 3;
buf = malloc(size);
dest = buf;
src = picture->data[0];
for(j=0;j<h;j++) {
memcpy(dest, src, w * 3);
dest += w * 3;
src += picture->linesize[0];
}
break;
default:
return;
}
s->format->write_packet(s, index, buf, size);
free(buf);
}
|
{
"code": [
" size = avpicture_get_size(pix_fmt, w, h);",
" buf = malloc(size);",
" if (!buf)"
],
"line_no": [
13,
15,
17
]
}
|
static void FUNC_0(AVFormatContext *VAR_0, int VAR_1, AVPicture *VAR_2,
int VAR_3, int VAR_4, int VAR_5)
{
UINT8 *buf, *src, *dest;
int VAR_6, VAR_7, VAR_8;
VAR_6 = avpicture_get_size(VAR_3, VAR_4, VAR_5);
buf = malloc(VAR_6);
if (!buf)
return;
switch(VAR_3) {
case PIX_FMT_YUV420P:
dest = buf;
for(VAR_8=0;VAR_8<3;VAR_8++) {
if (VAR_8 == 1) {
VAR_4 >>= 1;
VAR_5 >>= 1;
}
src = VAR_2->data[VAR_8];
for(VAR_7=0;VAR_7<VAR_5;VAR_7++) {
memcpy(dest, src, VAR_4);
dest += VAR_4;
src += VAR_2->linesize[VAR_8];
}
}
break;
case PIX_FMT_YUV422P:
VAR_6 = (VAR_4 * VAR_5) * 2;
buf = malloc(VAR_6);
dest = buf;
for(VAR_8=0;VAR_8<3;VAR_8++) {
if (VAR_8 == 1) {
VAR_4 >>= 1;
}
src = VAR_2->data[VAR_8];
for(VAR_7=0;VAR_7<VAR_5;VAR_7++) {
memcpy(dest, src, VAR_4);
dest += VAR_4;
src += VAR_2->linesize[VAR_8];
}
}
break;
case PIX_FMT_YUV444P:
VAR_6 = (VAR_4 * VAR_5) * 3;
buf = malloc(VAR_6);
dest = buf;
for(VAR_8=0;VAR_8<3;VAR_8++) {
src = VAR_2->data[VAR_8];
for(VAR_7=0;VAR_7<VAR_5;VAR_7++) {
memcpy(dest, src, VAR_4);
dest += VAR_4;
src += VAR_2->linesize[VAR_8];
}
}
break;
case PIX_FMT_YUV422:
VAR_6 = (VAR_4 * VAR_5) * 2;
buf = malloc(VAR_6);
dest = buf;
src = VAR_2->data[0];
for(VAR_7=0;VAR_7<VAR_5;VAR_7++) {
memcpy(dest, src, VAR_4 * 2);
dest += VAR_4 * 2;
src += VAR_2->linesize[0];
}
break;
case PIX_FMT_RGB24:
case PIX_FMT_BGR24:
VAR_6 = (VAR_4 * VAR_5) * 3;
buf = malloc(VAR_6);
dest = buf;
src = VAR_2->data[0];
for(VAR_7=0;VAR_7<VAR_5;VAR_7++) {
memcpy(dest, src, VAR_4 * 3);
dest += VAR_4 * 3;
src += VAR_2->linesize[0];
}
break;
default:
return;
}
VAR_0->format->write_packet(VAR_0, VAR_1, buf, VAR_6);
free(buf);
}
|
[
"static void FUNC_0(AVFormatContext *VAR_0, int VAR_1, AVPicture *VAR_2,\nint VAR_3, int VAR_4, int VAR_5)\n{",
"UINT8 *buf, *src, *dest;",
"int VAR_6, VAR_7, VAR_8;",
"VAR_6 = avpicture_get_size(VAR_3, VAR_4, VAR_5);",
"buf = malloc(VAR_6);",
"if (!buf)\nreturn;",
"switch(VAR_3) {",
"case PIX_FMT_YUV420P:\ndest = buf;",
"for(VAR_8=0;VAR_8<3;VAR_8++) {",
"if (VAR_8 == 1) {",
"VAR_4 >>= 1;",
"VAR_5 >>= 1;",
"}",
"src = VAR_2->data[VAR_8];",
"for(VAR_7=0;VAR_7<VAR_5;VAR_7++) {",
"memcpy(dest, src, VAR_4);",
"dest += VAR_4;",
"src += VAR_2->linesize[VAR_8];",
"}",
"}",
"break;",
"case PIX_FMT_YUV422P:\nVAR_6 = (VAR_4 * VAR_5) * 2;",
"buf = malloc(VAR_6);",
"dest = buf;",
"for(VAR_8=0;VAR_8<3;VAR_8++) {",
"if (VAR_8 == 1) {",
"VAR_4 >>= 1;",
"}",
"src = VAR_2->data[VAR_8];",
"for(VAR_7=0;VAR_7<VAR_5;VAR_7++) {",
"memcpy(dest, src, VAR_4);",
"dest += VAR_4;",
"src += VAR_2->linesize[VAR_8];",
"}",
"}",
"break;",
"case PIX_FMT_YUV444P:\nVAR_6 = (VAR_4 * VAR_5) * 3;",
"buf = malloc(VAR_6);",
"dest = buf;",
"for(VAR_8=0;VAR_8<3;VAR_8++) {",
"src = VAR_2->data[VAR_8];",
"for(VAR_7=0;VAR_7<VAR_5;VAR_7++) {",
"memcpy(dest, src, VAR_4);",
"dest += VAR_4;",
"src += VAR_2->linesize[VAR_8];",
"}",
"}",
"break;",
"case PIX_FMT_YUV422:\nVAR_6 = (VAR_4 * VAR_5) * 2;",
"buf = malloc(VAR_6);",
"dest = buf;",
"src = VAR_2->data[0];",
"for(VAR_7=0;VAR_7<VAR_5;VAR_7++) {",
"memcpy(dest, src, VAR_4 * 2);",
"dest += VAR_4 * 2;",
"src += VAR_2->linesize[0];",
"}",
"break;",
"case PIX_FMT_RGB24:\ncase PIX_FMT_BGR24:\nVAR_6 = (VAR_4 * VAR_5) * 3;",
"buf = malloc(VAR_6);",
"dest = buf;",
"src = VAR_2->data[0];",
"for(VAR_7=0;VAR_7<VAR_5;VAR_7++) {",
"memcpy(dest, src, VAR_4 * 3);",
"dest += VAR_4 * 3;",
"src += VAR_2->linesize[0];",
"}",
"break;",
"default:\nreturn;",
"}",
"VAR_0->format->write_packet(VAR_0, VAR_1, buf, VAR_6);",
"free(buf);",
"}"
] |
[
0,
0,
0,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
27
],
[
29,
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59,
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91,
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117,
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139,
141,
143
],
[
145
],
[
147
],
[
149
],
[
151
],
[
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163,
165
],
[
167
],
[
169
],
[
171
],
[
173
]
] |
6,426 |
static int drawgrid_filter_frame(AVFilterLink *inlink, AVFrame *frame)
{
DrawBoxContext *drawgrid = inlink->dst->priv;
int plane, x, y;
uint8_t *row[4];
if (drawgrid->have_alpha) {
for (y = 0; y < frame->height; y++) {
row[0] = frame->data[0] + y * frame->linesize[0];
row[3] = frame->data[3] + y * frame->linesize[3];
for (plane = 1; plane < 3; plane++)
row[plane] = frame->data[plane] +
frame->linesize[plane] * (y >> drawgrid->vsub);
if (drawgrid->invert_color) {
for (x = 0; x < frame->width; x++)
if (pixel_belongs_to_grid(drawgrid, x, y))
row[0][x] = 0xff - row[0][x];
} else {
for (x = 0; x < frame->width; x++) {
if (pixel_belongs_to_grid(drawgrid, x, y)) {
row[0][x ] = drawgrid->yuv_color[Y];
row[1][x >> drawgrid->hsub] = drawgrid->yuv_color[U];
row[2][x >> drawgrid->hsub] = drawgrid->yuv_color[V];
row[3][x ] = drawgrid->yuv_color[A];
}
}
}
}
} else {
for (y = 0; y < frame->height; y++) {
row[0] = frame->data[0] + y * frame->linesize[0];
for (plane = 1; plane < 3; plane++)
row[plane] = frame->data[plane] +
frame->linesize[plane] * (y >> drawgrid->vsub);
if (drawgrid->invert_color) {
for (x = 0; x < frame->width; x++)
if (pixel_belongs_to_grid(drawgrid, x, y))
row[0][x] = 0xff - row[0][x];
} else {
for (x = 0; x < frame->width; x++) {
double alpha = (double)drawgrid->yuv_color[A] / 255;
if (pixel_belongs_to_grid(drawgrid, x, y)) {
row[0][x ] = (1 - alpha) * row[0][x ] + alpha * drawgrid->yuv_color[Y];
row[1][x >> drawgrid->hsub] = (1 - alpha) * row[1][x >> drawgrid->hsub] + alpha * drawgrid->yuv_color[U];
row[2][x >> drawgrid->hsub] = (1 - alpha) * row[2][x >> drawgrid->hsub] + alpha * drawgrid->yuv_color[V];
}
}
}
}
}
return ff_filter_frame(inlink->dst->outputs[0], frame);
}
| true |
FFmpeg
|
1c76134fe37ac20695627e3f5ce1f2bbf1245fcc
|
static int drawgrid_filter_frame(AVFilterLink *inlink, AVFrame *frame)
{
DrawBoxContext *drawgrid = inlink->dst->priv;
int plane, x, y;
uint8_t *row[4];
if (drawgrid->have_alpha) {
for (y = 0; y < frame->height; y++) {
row[0] = frame->data[0] + y * frame->linesize[0];
row[3] = frame->data[3] + y * frame->linesize[3];
for (plane = 1; plane < 3; plane++)
row[plane] = frame->data[plane] +
frame->linesize[plane] * (y >> drawgrid->vsub);
if (drawgrid->invert_color) {
for (x = 0; x < frame->width; x++)
if (pixel_belongs_to_grid(drawgrid, x, y))
row[0][x] = 0xff - row[0][x];
} else {
for (x = 0; x < frame->width; x++) {
if (pixel_belongs_to_grid(drawgrid, x, y)) {
row[0][x ] = drawgrid->yuv_color[Y];
row[1][x >> drawgrid->hsub] = drawgrid->yuv_color[U];
row[2][x >> drawgrid->hsub] = drawgrid->yuv_color[V];
row[3][x ] = drawgrid->yuv_color[A];
}
}
}
}
} else {
for (y = 0; y < frame->height; y++) {
row[0] = frame->data[0] + y * frame->linesize[0];
for (plane = 1; plane < 3; plane++)
row[plane] = frame->data[plane] +
frame->linesize[plane] * (y >> drawgrid->vsub);
if (drawgrid->invert_color) {
for (x = 0; x < frame->width; x++)
if (pixel_belongs_to_grid(drawgrid, x, y))
row[0][x] = 0xff - row[0][x];
} else {
for (x = 0; x < frame->width; x++) {
double alpha = (double)drawgrid->yuv_color[A] / 255;
if (pixel_belongs_to_grid(drawgrid, x, y)) {
row[0][x ] = (1 - alpha) * row[0][x ] + alpha * drawgrid->yuv_color[Y];
row[1][x >> drawgrid->hsub] = (1 - alpha) * row[1][x >> drawgrid->hsub] + alpha * drawgrid->yuv_color[U];
row[2][x >> drawgrid->hsub] = (1 - alpha) * row[2][x >> drawgrid->hsub] + alpha * drawgrid->yuv_color[V];
}
}
}
}
}
return ff_filter_frame(inlink->dst->outputs[0], frame);
}
|
{
"code": [
" if (drawgrid->have_alpha) {"
],
"line_no": [
13
]
}
|
static int FUNC_0(AVFilterLink *VAR_0, AVFrame *VAR_1)
{
DrawBoxContext *drawgrid = VAR_0->dst->priv;
int VAR_2, VAR_3, VAR_4;
uint8_t *row[4];
if (drawgrid->have_alpha) {
for (VAR_4 = 0; VAR_4 < VAR_1->height; VAR_4++) {
row[0] = VAR_1->data[0] + VAR_4 * VAR_1->linesize[0];
row[3] = VAR_1->data[3] + VAR_4 * VAR_1->linesize[3];
for (VAR_2 = 1; VAR_2 < 3; VAR_2++)
row[VAR_2] = VAR_1->data[VAR_2] +
VAR_1->linesize[VAR_2] * (VAR_4 >> drawgrid->vsub);
if (drawgrid->invert_color) {
for (VAR_3 = 0; VAR_3 < VAR_1->width; VAR_3++)
if (pixel_belongs_to_grid(drawgrid, VAR_3, VAR_4))
row[0][VAR_3] = 0xff - row[0][VAR_3];
} else {
for (VAR_3 = 0; VAR_3 < VAR_1->width; VAR_3++) {
if (pixel_belongs_to_grid(drawgrid, VAR_3, VAR_4)) {
row[0][VAR_3 ] = drawgrid->yuv_color[Y];
row[1][VAR_3 >> drawgrid->hsub] = drawgrid->yuv_color[U];
row[2][VAR_3 >> drawgrid->hsub] = drawgrid->yuv_color[V];
row[3][VAR_3 ] = drawgrid->yuv_color[A];
}
}
}
}
} else {
for (VAR_4 = 0; VAR_4 < VAR_1->height; VAR_4++) {
row[0] = VAR_1->data[0] + VAR_4 * VAR_1->linesize[0];
for (VAR_2 = 1; VAR_2 < 3; VAR_2++)
row[VAR_2] = VAR_1->data[VAR_2] +
VAR_1->linesize[VAR_2] * (VAR_4 >> drawgrid->vsub);
if (drawgrid->invert_color) {
for (VAR_3 = 0; VAR_3 < VAR_1->width; VAR_3++)
if (pixel_belongs_to_grid(drawgrid, VAR_3, VAR_4))
row[0][VAR_3] = 0xff - row[0][VAR_3];
} else {
for (VAR_3 = 0; VAR_3 < VAR_1->width; VAR_3++) {
double alpha = (double)drawgrid->yuv_color[A] / 255;
if (pixel_belongs_to_grid(drawgrid, VAR_3, VAR_4)) {
row[0][VAR_3 ] = (1 - alpha) * row[0][VAR_3 ] + alpha * drawgrid->yuv_color[Y];
row[1][VAR_3 >> drawgrid->hsub] = (1 - alpha) * row[1][VAR_3 >> drawgrid->hsub] + alpha * drawgrid->yuv_color[U];
row[2][VAR_3 >> drawgrid->hsub] = (1 - alpha) * row[2][VAR_3 >> drawgrid->hsub] + alpha * drawgrid->yuv_color[V];
}
}
}
}
}
return ff_filter_frame(VAR_0->dst->outputs[0], VAR_1);
}
|
[
"static int FUNC_0(AVFilterLink *VAR_0, AVFrame *VAR_1)\n{",
"DrawBoxContext *drawgrid = VAR_0->dst->priv;",
"int VAR_2, VAR_3, VAR_4;",
"uint8_t *row[4];",
"if (drawgrid->have_alpha) {",
"for (VAR_4 = 0; VAR_4 < VAR_1->height; VAR_4++) {",
"row[0] = VAR_1->data[0] + VAR_4 * VAR_1->linesize[0];",
"row[3] = VAR_1->data[3] + VAR_4 * VAR_1->linesize[3];",
"for (VAR_2 = 1; VAR_2 < 3; VAR_2++)",
"row[VAR_2] = VAR_1->data[VAR_2] +\nVAR_1->linesize[VAR_2] * (VAR_4 >> drawgrid->vsub);",
"if (drawgrid->invert_color) {",
"for (VAR_3 = 0; VAR_3 < VAR_1->width; VAR_3++)",
"if (pixel_belongs_to_grid(drawgrid, VAR_3, VAR_4))\nrow[0][VAR_3] = 0xff - row[0][VAR_3];",
"} else {",
"for (VAR_3 = 0; VAR_3 < VAR_1->width; VAR_3++) {",
"if (pixel_belongs_to_grid(drawgrid, VAR_3, VAR_4)) {",
"row[0][VAR_3 ] = drawgrid->yuv_color[Y];",
"row[1][VAR_3 >> drawgrid->hsub] = drawgrid->yuv_color[U];",
"row[2][VAR_3 >> drawgrid->hsub] = drawgrid->yuv_color[V];",
"row[3][VAR_3 ] = drawgrid->yuv_color[A];",
"}",
"}",
"}",
"}",
"} else {",
"for (VAR_4 = 0; VAR_4 < VAR_1->height; VAR_4++) {",
"row[0] = VAR_1->data[0] + VAR_4 * VAR_1->linesize[0];",
"for (VAR_2 = 1; VAR_2 < 3; VAR_2++)",
"row[VAR_2] = VAR_1->data[VAR_2] +\nVAR_1->linesize[VAR_2] * (VAR_4 >> drawgrid->vsub);",
"if (drawgrid->invert_color) {",
"for (VAR_3 = 0; VAR_3 < VAR_1->width; VAR_3++)",
"if (pixel_belongs_to_grid(drawgrid, VAR_3, VAR_4))\nrow[0][VAR_3] = 0xff - row[0][VAR_3];",
"} else {",
"for (VAR_3 = 0; VAR_3 < VAR_1->width; VAR_3++) {",
"double alpha = (double)drawgrid->yuv_color[A] / 255;",
"if (pixel_belongs_to_grid(drawgrid, VAR_3, VAR_4)) {",
"row[0][VAR_3 ] = (1 - alpha) * row[0][VAR_3 ] + alpha * drawgrid->yuv_color[Y];",
"row[1][VAR_3 >> drawgrid->hsub] = (1 - alpha) * row[1][VAR_3 >> drawgrid->hsub] + alpha * drawgrid->yuv_color[U];",
"row[2][VAR_3 >> drawgrid->hsub] = (1 - alpha) * row[2][VAR_3 >> drawgrid->hsub] + alpha * drawgrid->yuv_color[V];",
"}",
"}",
"}",
"}",
"}",
"return ff_filter_frame(VAR_0->dst->outputs[0], VAR_1);",
"}"
] |
[
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25,
27
],
[
31
],
[
33
],
[
35,
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
69
],
[
71,
73
],
[
77
],
[
79
],
[
81,
83
],
[
85
],
[
87
],
[
89
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
113
],
[
115
]
] |
6,427 |
void backup_start(const char *job_id, BlockDriverState *bs,
BlockDriverState *target, int64_t speed,
MirrorSyncMode sync_mode, BdrvDirtyBitmap *sync_bitmap,
BlockdevOnError on_source_error,
BlockdevOnError on_target_error,
BlockCompletionFunc *cb, void *opaque,
BlockJobTxn *txn, Error **errp)
{
int64_t len;
BlockDriverInfo bdi;
BackupBlockJob *job = NULL;
int ret;
assert(bs);
assert(target);
if (bs == target) {
error_setg(errp, "Source and target cannot be the same");
return;
}
if (!bdrv_is_inserted(bs)) {
error_setg(errp, "Device is not inserted: %s",
bdrv_get_device_name(bs));
return;
}
if (!bdrv_is_inserted(target)) {
error_setg(errp, "Device is not inserted: %s",
bdrv_get_device_name(target));
return;
}
if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_BACKUP_SOURCE, errp)) {
return;
}
if (bdrv_op_is_blocked(target, BLOCK_OP_TYPE_BACKUP_TARGET, errp)) {
return;
}
if (sync_mode == MIRROR_SYNC_MODE_INCREMENTAL) {
if (!sync_bitmap) {
error_setg(errp, "must provide a valid bitmap name for "
"\"incremental\" sync mode");
return;
}
/* Create a new bitmap, and freeze/disable this one. */
if (bdrv_dirty_bitmap_create_successor(bs, sync_bitmap, errp) < 0) {
return;
}
} else if (sync_bitmap) {
error_setg(errp,
"a sync_bitmap was provided to backup_run, "
"but received an incompatible sync_mode (%s)",
MirrorSyncMode_lookup[sync_mode]);
return;
}
len = bdrv_getlength(bs);
if (len < 0) {
error_setg_errno(errp, -len, "unable to get length for '%s'",
bdrv_get_device_name(bs));
goto error;
}
job = block_job_create(job_id, &backup_job_driver, bs, speed,
cb, opaque, errp);
if (!job) {
goto error;
}
job->target = blk_new();
blk_insert_bs(job->target, target);
job->on_source_error = on_source_error;
job->on_target_error = on_target_error;
job->sync_mode = sync_mode;
job->sync_bitmap = sync_mode == MIRROR_SYNC_MODE_INCREMENTAL ?
sync_bitmap : NULL;
/* If there is no backing file on the target, we cannot rely on COW if our
* backup cluster size is smaller than the target cluster size. Even for
* targets with a backing file, try to avoid COW if possible. */
ret = bdrv_get_info(target, &bdi);
if (ret < 0 && !target->backing) {
error_setg_errno(errp, -ret,
"Couldn't determine the cluster size of the target image, "
"which has no backing file");
error_append_hint(errp,
"Aborting, since this may create an unusable destination image\n");
goto error;
} else if (ret < 0 && target->backing) {
/* Not fatal; just trudge on ahead. */
job->cluster_size = BACKUP_CLUSTER_SIZE_DEFAULT;
} else {
job->cluster_size = MAX(BACKUP_CLUSTER_SIZE_DEFAULT, bdi.cluster_size);
}
bdrv_op_block_all(target, job->common.blocker);
job->common.len = len;
job->common.co = qemu_coroutine_create(backup_run);
block_job_txn_add_job(txn, &job->common);
qemu_coroutine_enter(job->common.co, job);
return;
error:
if (sync_bitmap) {
bdrv_reclaim_dirty_bitmap(bs, sync_bitmap, NULL);
}
if (job) {
blk_unref(job->target);
block_job_unref(&job->common);
}
}
| true |
qemu
|
0b8b8753e4d94901627b3e86431230f2319215c4
|
void backup_start(const char *job_id, BlockDriverState *bs,
BlockDriverState *target, int64_t speed,
MirrorSyncMode sync_mode, BdrvDirtyBitmap *sync_bitmap,
BlockdevOnError on_source_error,
BlockdevOnError on_target_error,
BlockCompletionFunc *cb, void *opaque,
BlockJobTxn *txn, Error **errp)
{
int64_t len;
BlockDriverInfo bdi;
BackupBlockJob *job = NULL;
int ret;
assert(bs);
assert(target);
if (bs == target) {
error_setg(errp, "Source and target cannot be the same");
return;
}
if (!bdrv_is_inserted(bs)) {
error_setg(errp, "Device is not inserted: %s",
bdrv_get_device_name(bs));
return;
}
if (!bdrv_is_inserted(target)) {
error_setg(errp, "Device is not inserted: %s",
bdrv_get_device_name(target));
return;
}
if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_BACKUP_SOURCE, errp)) {
return;
}
if (bdrv_op_is_blocked(target, BLOCK_OP_TYPE_BACKUP_TARGET, errp)) {
return;
}
if (sync_mode == MIRROR_SYNC_MODE_INCREMENTAL) {
if (!sync_bitmap) {
error_setg(errp, "must provide a valid bitmap name for "
"\"incremental\" sync mode");
return;
}
if (bdrv_dirty_bitmap_create_successor(bs, sync_bitmap, errp) < 0) {
return;
}
} else if (sync_bitmap) {
error_setg(errp,
"a sync_bitmap was provided to backup_run, "
"but received an incompatible sync_mode (%s)",
MirrorSyncMode_lookup[sync_mode]);
return;
}
len = bdrv_getlength(bs);
if (len < 0) {
error_setg_errno(errp, -len, "unable to get length for '%s'",
bdrv_get_device_name(bs));
goto error;
}
job = block_job_create(job_id, &backup_job_driver, bs, speed,
cb, opaque, errp);
if (!job) {
goto error;
}
job->target = blk_new();
blk_insert_bs(job->target, target);
job->on_source_error = on_source_error;
job->on_target_error = on_target_error;
job->sync_mode = sync_mode;
job->sync_bitmap = sync_mode == MIRROR_SYNC_MODE_INCREMENTAL ?
sync_bitmap : NULL;
ret = bdrv_get_info(target, &bdi);
if (ret < 0 && !target->backing) {
error_setg_errno(errp, -ret,
"Couldn't determine the cluster size of the target image, "
"which has no backing file");
error_append_hint(errp,
"Aborting, since this may create an unusable destination image\n");
goto error;
} else if (ret < 0 && target->backing) {
job->cluster_size = BACKUP_CLUSTER_SIZE_DEFAULT;
} else {
job->cluster_size = MAX(BACKUP_CLUSTER_SIZE_DEFAULT, bdi.cluster_size);
}
bdrv_op_block_all(target, job->common.blocker);
job->common.len = len;
job->common.co = qemu_coroutine_create(backup_run);
block_job_txn_add_job(txn, &job->common);
qemu_coroutine_enter(job->common.co, job);
return;
error:
if (sync_bitmap) {
bdrv_reclaim_dirty_bitmap(bs, sync_bitmap, NULL);
}
if (job) {
blk_unref(job->target);
block_job_unref(&job->common);
}
}
|
{
"code": [
" job->common.co = qemu_coroutine_create(backup_run);",
" qemu_coroutine_enter(job->common.co, job);"
],
"line_no": [
205,
209
]
}
|
void FUNC_0(const char *VAR_0, BlockDriverState *VAR_1,
BlockDriverState *VAR_2, int64_t VAR_3,
MirrorSyncMode VAR_4, BdrvDirtyBitmap *VAR_5,
BlockdevOnError VAR_6,
BlockdevOnError VAR_7,
BlockCompletionFunc *VAR_8, void *VAR_9,
BlockJobTxn *VAR_10, Error **VAR_11)
{
int64_t len;
BlockDriverInfo bdi;
BackupBlockJob *job = NULL;
int VAR_12;
assert(VAR_1);
assert(VAR_2);
if (VAR_1 == VAR_2) {
error_setg(VAR_11, "Source and VAR_2 cannot be the same");
return;
}
if (!bdrv_is_inserted(VAR_1)) {
error_setg(VAR_11, "Device is not inserted: %s",
bdrv_get_device_name(VAR_1));
return;
}
if (!bdrv_is_inserted(VAR_2)) {
error_setg(VAR_11, "Device is not inserted: %s",
bdrv_get_device_name(VAR_2));
return;
}
if (bdrv_op_is_blocked(VAR_1, BLOCK_OP_TYPE_BACKUP_SOURCE, VAR_11)) {
return;
}
if (bdrv_op_is_blocked(VAR_2, BLOCK_OP_TYPE_BACKUP_TARGET, VAR_11)) {
return;
}
if (VAR_4 == MIRROR_SYNC_MODE_INCREMENTAL) {
if (!VAR_5) {
error_setg(VAR_11, "must provide a valid bitmap name for "
"\"incremental\" sync mode");
return;
}
if (bdrv_dirty_bitmap_create_successor(VAR_1, VAR_5, VAR_11) < 0) {
return;
}
} else if (VAR_5) {
error_setg(VAR_11,
"a VAR_5 was provided to backup_run, "
"but received an incompatible VAR_4 (%s)",
MirrorSyncMode_lookup[VAR_4]);
return;
}
len = bdrv_getlength(VAR_1);
if (len < 0) {
error_setg_errno(VAR_11, -len, "unable to get length for '%s'",
bdrv_get_device_name(VAR_1));
goto error;
}
job = block_job_create(VAR_0, &backup_job_driver, VAR_1, VAR_3,
VAR_8, VAR_9, VAR_11);
if (!job) {
goto error;
}
job->VAR_2 = blk_new();
blk_insert_bs(job->VAR_2, VAR_2);
job->VAR_6 = VAR_6;
job->VAR_7 = VAR_7;
job->VAR_4 = VAR_4;
job->VAR_5 = VAR_4 == MIRROR_SYNC_MODE_INCREMENTAL ?
VAR_5 : NULL;
VAR_12 = bdrv_get_info(VAR_2, &bdi);
if (VAR_12 < 0 && !VAR_2->backing) {
error_setg_errno(VAR_11, -VAR_12,
"Couldn't determine the cluster size of the VAR_2 image, "
"which has no backing file");
error_append_hint(VAR_11,
"Aborting, since this may create an unusable destination image\n");
goto error;
} else if (VAR_12 < 0 && VAR_2->backing) {
job->cluster_size = BACKUP_CLUSTER_SIZE_DEFAULT;
} else {
job->cluster_size = MAX(BACKUP_CLUSTER_SIZE_DEFAULT, bdi.cluster_size);
}
bdrv_op_block_all(VAR_2, job->common.blocker);
job->common.len = len;
job->common.co = qemu_coroutine_create(backup_run);
block_job_txn_add_job(VAR_10, &job->common);
qemu_coroutine_enter(job->common.co, job);
return;
error:
if (VAR_5) {
bdrv_reclaim_dirty_bitmap(VAR_1, VAR_5, NULL);
}
if (job) {
blk_unref(job->VAR_2);
block_job_unref(&job->common);
}
}
|
[
"void FUNC_0(const char *VAR_0, BlockDriverState *VAR_1,\nBlockDriverState *VAR_2, int64_t VAR_3,\nMirrorSyncMode VAR_4, BdrvDirtyBitmap *VAR_5,\nBlockdevOnError VAR_6,\nBlockdevOnError VAR_7,\nBlockCompletionFunc *VAR_8, void *VAR_9,\nBlockJobTxn *VAR_10, Error **VAR_11)\n{",
"int64_t len;",
"BlockDriverInfo bdi;",
"BackupBlockJob *job = NULL;",
"int VAR_12;",
"assert(VAR_1);",
"assert(VAR_2);",
"if (VAR_1 == VAR_2) {",
"error_setg(VAR_11, \"Source and VAR_2 cannot be the same\");",
"return;",
"}",
"if (!bdrv_is_inserted(VAR_1)) {",
"error_setg(VAR_11, \"Device is not inserted: %s\",\nbdrv_get_device_name(VAR_1));",
"return;",
"}",
"if (!bdrv_is_inserted(VAR_2)) {",
"error_setg(VAR_11, \"Device is not inserted: %s\",\nbdrv_get_device_name(VAR_2));",
"return;",
"}",
"if (bdrv_op_is_blocked(VAR_1, BLOCK_OP_TYPE_BACKUP_SOURCE, VAR_11)) {",
"return;",
"}",
"if (bdrv_op_is_blocked(VAR_2, BLOCK_OP_TYPE_BACKUP_TARGET, VAR_11)) {",
"return;",
"}",
"if (VAR_4 == MIRROR_SYNC_MODE_INCREMENTAL) {",
"if (!VAR_5) {",
"error_setg(VAR_11, \"must provide a valid bitmap name for \"\n\"\\\"incremental\\\" sync mode\");",
"return;",
"}",
"if (bdrv_dirty_bitmap_create_successor(VAR_1, VAR_5, VAR_11) < 0) {",
"return;",
"}",
"} else if (VAR_5) {",
"error_setg(VAR_11,\n\"a VAR_5 was provided to backup_run, \"\n\"but received an incompatible VAR_4 (%s)\",\nMirrorSyncMode_lookup[VAR_4]);",
"return;",
"}",
"len = bdrv_getlength(VAR_1);",
"if (len < 0) {",
"error_setg_errno(VAR_11, -len, \"unable to get length for '%s'\",\nbdrv_get_device_name(VAR_1));",
"goto error;",
"}",
"job = block_job_create(VAR_0, &backup_job_driver, VAR_1, VAR_3,\nVAR_8, VAR_9, VAR_11);",
"if (!job) {",
"goto error;",
"}",
"job->VAR_2 = blk_new();",
"blk_insert_bs(job->VAR_2, VAR_2);",
"job->VAR_6 = VAR_6;",
"job->VAR_7 = VAR_7;",
"job->VAR_4 = VAR_4;",
"job->VAR_5 = VAR_4 == MIRROR_SYNC_MODE_INCREMENTAL ?\nVAR_5 : NULL;",
"VAR_12 = bdrv_get_info(VAR_2, &bdi);",
"if (VAR_12 < 0 && !VAR_2->backing) {",
"error_setg_errno(VAR_11, -VAR_12,\n\"Couldn't determine the cluster size of the VAR_2 image, \"\n\"which has no backing file\");",
"error_append_hint(VAR_11,\n\"Aborting, since this may create an unusable destination image\\n\");",
"goto error;",
"} else if (VAR_12 < 0 && VAR_2->backing) {",
"job->cluster_size = BACKUP_CLUSTER_SIZE_DEFAULT;",
"} else {",
"job->cluster_size = MAX(BACKUP_CLUSTER_SIZE_DEFAULT, bdi.cluster_size);",
"}",
"bdrv_op_block_all(VAR_2, job->common.blocker);",
"job->common.len = len;",
"job->common.co = qemu_coroutine_create(backup_run);",
"block_job_txn_add_job(VAR_10, &job->common);",
"qemu_coroutine_enter(job->common.co, job);",
"return;",
"error:\nif (VAR_5) {",
"bdrv_reclaim_dirty_bitmap(VAR_1, VAR_5, NULL);",
"}",
"if (job) {",
"blk_unref(job->VAR_2);",
"block_job_unref(&job->common);",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5,
7,
9,
11,
13,
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
27
],
[
29
],
[
33
],
[
35
],
[
37
],
[
39
],
[
43
],
[
45,
47
],
[
49
],
[
51
],
[
55
],
[
57,
59
],
[
61
],
[
63
],
[
67
],
[
69
],
[
71
],
[
75
],
[
77
],
[
79
],
[
83
],
[
85
],
[
87,
89
],
[
91
],
[
93
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107,
109,
111,
113
],
[
115
],
[
117
],
[
121
],
[
123
],
[
125,
127
],
[
129
],
[
131
],
[
135,
137
],
[
139
],
[
141
],
[
143
],
[
147
],
[
149
],
[
153
],
[
155
],
[
157
],
[
159,
161
],
[
171
],
[
173
],
[
175,
177,
179
],
[
181,
183
],
[
185
],
[
187
],
[
191
],
[
193
],
[
195
],
[
197
],
[
201
],
[
203
],
[
205
],
[
207
],
[
209
],
[
211
],
[
215,
217
],
[
219
],
[
221
],
[
223
],
[
225
],
[
227
],
[
229
],
[
231
]
] |
6,428 |
void OPPROTO op_POWER_srea (void)
{
T1 &= 0x1FUL;
env->spr[SPR_MQ] = T0 >> T1;
T0 = Ts0 >> T1;
RETURN();
}
| true |
qemu
|
d9bce9d99f4656ae0b0127f7472db9067b8f84ab
|
void OPPROTO op_POWER_srea (void)
{
T1 &= 0x1FUL;
env->spr[SPR_MQ] = T0 >> T1;
T0 = Ts0 >> T1;
RETURN();
}
|
{
"code": [
" RETURN();",
" T0 = Ts0 >> T1;",
" T0 = Ts0 >> T1;",
" RETURN();"
],
"line_no": [
11,
9,
9,
11
]
}
|
void VAR_0 op_POWER_srea (void)
{
T1 &= 0x1FUL;
env->spr[SPR_MQ] = T0 >> T1;
T0 = Ts0 >> T1;
RETURN();
}
|
[
"void VAR_0 op_POWER_srea (void)\n{",
"T1 &= 0x1FUL;",
"env->spr[SPR_MQ] = T0 >> T1;",
"T0 = Ts0 >> T1;",
"RETURN();",
"}"
] |
[
0,
0,
0,
1,
1,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
]
] |
6,429 |
void qmp_memchar_write(const char *device, const char *data,
bool has_format, enum DataFormat format,
Error **errp)
{
CharDriverState *chr;
const uint8_t *write_data;
int ret;
size_t write_count;
chr = qemu_chr_find(device);
if (!chr) {
error_setg(errp, "Device '%s' not found", device);
return;
if (qemu_is_chr(chr, "memory")) {
error_setg(errp,"%s is not memory char device", device);
return;
if (has_format && (format == DATA_FORMAT_BASE64)) {
write_data = g_base64_decode(data, &write_count);
} else {
write_data = (uint8_t *)data;
write_count = strlen(data);
ret = cirmem_chr_write(chr, write_data, write_count);
if (ret < 0) {
error_setg(errp, "Failed to write to device %s", device);
return;
| true |
qemu
|
13289fb5a716e06fb06febb880e5e116d485f82b
|
void qmp_memchar_write(const char *device, const char *data,
bool has_format, enum DataFormat format,
Error **errp)
{
CharDriverState *chr;
const uint8_t *write_data;
int ret;
size_t write_count;
chr = qemu_chr_find(device);
if (!chr) {
error_setg(errp, "Device '%s' not found", device);
return;
if (qemu_is_chr(chr, "memory")) {
error_setg(errp,"%s is not memory char device", device);
return;
if (has_format && (format == DATA_FORMAT_BASE64)) {
write_data = g_base64_decode(data, &write_count);
} else {
write_data = (uint8_t *)data;
write_count = strlen(data);
ret = cirmem_chr_write(chr, write_data, write_count);
if (ret < 0) {
error_setg(errp, "Failed to write to device %s", device);
return;
|
{
"code": [],
"line_no": []
}
|
void FUNC_0(const char *VAR_0, const char *VAR_1,
bool VAR_2, enum DataFormat VAR_3,
Error **VAR_4)
{
CharDriverState *chr;
const uint8_t *VAR_5;
int VAR_6;
size_t write_count;
chr = qemu_chr_find(VAR_0);
if (!chr) {
error_setg(VAR_4, "Device '%s' not found", VAR_0);
return;
if (qemu_is_chr(chr, "memory")) {
error_setg(VAR_4,"%s is not memory char VAR_0", VAR_0);
return;
if (VAR_2 && (VAR_3 == DATA_FORMAT_BASE64)) {
VAR_5 = g_base64_decode(VAR_1, &write_count);
} else {
VAR_5 = (uint8_t *)VAR_1;
write_count = strlen(VAR_1);
VAR_6 = cirmem_chr_write(chr, VAR_5, write_count);
if (VAR_6 < 0) {
error_setg(VAR_4, "Failed to write to VAR_0 %s", VAR_0);
return;
|
[
"void FUNC_0(const char *VAR_0, const char *VAR_1,\nbool VAR_2, enum DataFormat VAR_3,\nError **VAR_4)\n{",
"CharDriverState *chr;",
"const uint8_t *VAR_5;",
"int VAR_6;",
"size_t write_count;",
"chr = qemu_chr_find(VAR_0);",
"if (!chr) {",
"error_setg(VAR_4, \"Device '%s' not found\", VAR_0);",
"return;",
"if (qemu_is_chr(chr, \"memory\")) {",
"error_setg(VAR_4,\"%s is not memory char VAR_0\", VAR_0);",
"return;",
"if (VAR_2 && (VAR_3 == DATA_FORMAT_BASE64)) {",
"VAR_5 = g_base64_decode(VAR_1, &write_count);",
"} else {",
"VAR_5 = (uint8_t *)VAR_1;",
"write_count = strlen(VAR_1);",
"VAR_6 = cirmem_chr_write(chr, VAR_5, write_count);",
"if (VAR_6 < 0) {",
"error_setg(VAR_4, \"Failed to write to VAR_0 %s\", VAR_0);",
"return;"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
2,
3,
4
],
[
5
],
[
6
],
[
7
],
[
8
],
[
9
],
[
10
],
[
11
],
[
12
],
[
13
],
[
14
],
[
15
],
[
16
],
[
17
],
[
18
],
[
19
],
[
20
],
[
21
],
[
22
],
[
23
],
[
24
]
] |
6,430 |
static void avc_biwgt_16width_msa(uint8_t *src, int32_t src_stride,
uint8_t *dst, int32_t dst_stride,
int32_t height, int32_t log2_denom,
int32_t src_weight, int32_t dst_weight,
int32_t offset_in)
{
uint8_t cnt;
v16i8 src_wgt, dst_wgt, wgt;
v16i8 src0, src1, src2, src3;
v16i8 dst0, dst1, dst2, dst3;
v16i8 vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7;
v8i16 temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7;
v8i16 denom, offset, add_val;
int32_t val = 128 * (src_weight + dst_weight);
offset_in = ((offset_in + 1) | 1) << log2_denom;
src_wgt = __msa_fill_b(src_weight);
dst_wgt = __msa_fill_b(dst_weight);
offset = __msa_fill_h(offset_in);
denom = __msa_fill_h(log2_denom + 1);
add_val = __msa_fill_h(val);
offset += add_val;
wgt = __msa_ilvev_b(dst_wgt, src_wgt);
for (cnt = height / 4; cnt--;) {
LOAD_4VECS_SB(src, src_stride, src0, src1, src2, src3);
src += (4 * src_stride);
LOAD_4VECS_SB(dst, dst_stride, dst0, dst1, dst2, dst3);
XORI_B_4VECS_SB(src0, src1, src2, src3, src0, src1, src2, src3, 128);
XORI_B_4VECS_SB(dst0, dst1, dst2, dst3, dst0, dst1, dst2, dst3, 128);
ILV_B_LRLR_SB(src0, dst0, src1, dst1, vec1, vec0, vec3, vec2);
ILV_B_LRLR_SB(src2, dst2, src3, dst3, vec5, vec4, vec7, vec6);
temp0 = __msa_dpadd_s_h(offset, wgt, vec0);
temp1 = __msa_dpadd_s_h(offset, wgt, vec1);
temp2 = __msa_dpadd_s_h(offset, wgt, vec2);
temp3 = __msa_dpadd_s_h(offset, wgt, vec3);
temp4 = __msa_dpadd_s_h(offset, wgt, vec4);
temp5 = __msa_dpadd_s_h(offset, wgt, vec5);
temp6 = __msa_dpadd_s_h(offset, wgt, vec6);
temp7 = __msa_dpadd_s_h(offset, wgt, vec7);
SRA_4VECS(temp0, temp1, temp2, temp3,
temp0, temp1, temp2, temp3, denom);
SRA_4VECS(temp4, temp5, temp6, temp7,
temp4, temp5, temp6, temp7, denom);
temp0 = CLIP_UNSIGNED_CHAR_H(temp0);
temp1 = CLIP_UNSIGNED_CHAR_H(temp1);
temp2 = CLIP_UNSIGNED_CHAR_H(temp2);
temp3 = CLIP_UNSIGNED_CHAR_H(temp3);
temp4 = CLIP_UNSIGNED_CHAR_H(temp4);
temp5 = CLIP_UNSIGNED_CHAR_H(temp5);
temp6 = CLIP_UNSIGNED_CHAR_H(temp6);
temp7 = CLIP_UNSIGNED_CHAR_H(temp7);
PCKEV_B_4VECS_SB(temp1, temp3, temp5, temp7, temp0, temp2, temp4, temp6,
dst0, dst1, dst2, dst3);
STORE_4VECS_SB(dst, dst_stride, dst0, dst1, dst2, dst3);
dst += 4 * dst_stride;
}
}
| false |
FFmpeg
|
bcd7bf7eeb09a395cc01698842d1b8be9af483fc
|
static void avc_biwgt_16width_msa(uint8_t *src, int32_t src_stride,
uint8_t *dst, int32_t dst_stride,
int32_t height, int32_t log2_denom,
int32_t src_weight, int32_t dst_weight,
int32_t offset_in)
{
uint8_t cnt;
v16i8 src_wgt, dst_wgt, wgt;
v16i8 src0, src1, src2, src3;
v16i8 dst0, dst1, dst2, dst3;
v16i8 vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7;
v8i16 temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7;
v8i16 denom, offset, add_val;
int32_t val = 128 * (src_weight + dst_weight);
offset_in = ((offset_in + 1) | 1) << log2_denom;
src_wgt = __msa_fill_b(src_weight);
dst_wgt = __msa_fill_b(dst_weight);
offset = __msa_fill_h(offset_in);
denom = __msa_fill_h(log2_denom + 1);
add_val = __msa_fill_h(val);
offset += add_val;
wgt = __msa_ilvev_b(dst_wgt, src_wgt);
for (cnt = height / 4; cnt--;) {
LOAD_4VECS_SB(src, src_stride, src0, src1, src2, src3);
src += (4 * src_stride);
LOAD_4VECS_SB(dst, dst_stride, dst0, dst1, dst2, dst3);
XORI_B_4VECS_SB(src0, src1, src2, src3, src0, src1, src2, src3, 128);
XORI_B_4VECS_SB(dst0, dst1, dst2, dst3, dst0, dst1, dst2, dst3, 128);
ILV_B_LRLR_SB(src0, dst0, src1, dst1, vec1, vec0, vec3, vec2);
ILV_B_LRLR_SB(src2, dst2, src3, dst3, vec5, vec4, vec7, vec6);
temp0 = __msa_dpadd_s_h(offset, wgt, vec0);
temp1 = __msa_dpadd_s_h(offset, wgt, vec1);
temp2 = __msa_dpadd_s_h(offset, wgt, vec2);
temp3 = __msa_dpadd_s_h(offset, wgt, vec3);
temp4 = __msa_dpadd_s_h(offset, wgt, vec4);
temp5 = __msa_dpadd_s_h(offset, wgt, vec5);
temp6 = __msa_dpadd_s_h(offset, wgt, vec6);
temp7 = __msa_dpadd_s_h(offset, wgt, vec7);
SRA_4VECS(temp0, temp1, temp2, temp3,
temp0, temp1, temp2, temp3, denom);
SRA_4VECS(temp4, temp5, temp6, temp7,
temp4, temp5, temp6, temp7, denom);
temp0 = CLIP_UNSIGNED_CHAR_H(temp0);
temp1 = CLIP_UNSIGNED_CHAR_H(temp1);
temp2 = CLIP_UNSIGNED_CHAR_H(temp2);
temp3 = CLIP_UNSIGNED_CHAR_H(temp3);
temp4 = CLIP_UNSIGNED_CHAR_H(temp4);
temp5 = CLIP_UNSIGNED_CHAR_H(temp5);
temp6 = CLIP_UNSIGNED_CHAR_H(temp6);
temp7 = CLIP_UNSIGNED_CHAR_H(temp7);
PCKEV_B_4VECS_SB(temp1, temp3, temp5, temp7, temp0, temp2, temp4, temp6,
dst0, dst1, dst2, dst3);
STORE_4VECS_SB(dst, dst_stride, dst0, dst1, dst2, dst3);
dst += 4 * dst_stride;
}
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(uint8_t *VAR_0, int32_t VAR_1,
uint8_t *VAR_2, int32_t VAR_3,
int32_t VAR_4, int32_t VAR_5,
int32_t VAR_6, int32_t VAR_7,
int32_t VAR_8)
{
uint8_t cnt;
v16i8 src_wgt, dst_wgt, wgt;
v16i8 src0, src1, src2, src3;
v16i8 dst0, dst1, dst2, dst3;
v16i8 vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7;
v8i16 temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7;
v8i16 denom, offset, add_val;
int32_t val = 128 * (VAR_6 + VAR_7);
VAR_8 = ((VAR_8 + 1) | 1) << VAR_5;
src_wgt = __msa_fill_b(VAR_6);
dst_wgt = __msa_fill_b(VAR_7);
offset = __msa_fill_h(VAR_8);
denom = __msa_fill_h(VAR_5 + 1);
add_val = __msa_fill_h(val);
offset += add_val;
wgt = __msa_ilvev_b(dst_wgt, src_wgt);
for (cnt = VAR_4 / 4; cnt--;) {
LOAD_4VECS_SB(VAR_0, VAR_1, src0, src1, src2, src3);
VAR_0 += (4 * VAR_1);
LOAD_4VECS_SB(VAR_2, VAR_3, dst0, dst1, dst2, dst3);
XORI_B_4VECS_SB(src0, src1, src2, src3, src0, src1, src2, src3, 128);
XORI_B_4VECS_SB(dst0, dst1, dst2, dst3, dst0, dst1, dst2, dst3, 128);
ILV_B_LRLR_SB(src0, dst0, src1, dst1, vec1, vec0, vec3, vec2);
ILV_B_LRLR_SB(src2, dst2, src3, dst3, vec5, vec4, vec7, vec6);
temp0 = __msa_dpadd_s_h(offset, wgt, vec0);
temp1 = __msa_dpadd_s_h(offset, wgt, vec1);
temp2 = __msa_dpadd_s_h(offset, wgt, vec2);
temp3 = __msa_dpadd_s_h(offset, wgt, vec3);
temp4 = __msa_dpadd_s_h(offset, wgt, vec4);
temp5 = __msa_dpadd_s_h(offset, wgt, vec5);
temp6 = __msa_dpadd_s_h(offset, wgt, vec6);
temp7 = __msa_dpadd_s_h(offset, wgt, vec7);
SRA_4VECS(temp0, temp1, temp2, temp3,
temp0, temp1, temp2, temp3, denom);
SRA_4VECS(temp4, temp5, temp6, temp7,
temp4, temp5, temp6, temp7, denom);
temp0 = CLIP_UNSIGNED_CHAR_H(temp0);
temp1 = CLIP_UNSIGNED_CHAR_H(temp1);
temp2 = CLIP_UNSIGNED_CHAR_H(temp2);
temp3 = CLIP_UNSIGNED_CHAR_H(temp3);
temp4 = CLIP_UNSIGNED_CHAR_H(temp4);
temp5 = CLIP_UNSIGNED_CHAR_H(temp5);
temp6 = CLIP_UNSIGNED_CHAR_H(temp6);
temp7 = CLIP_UNSIGNED_CHAR_H(temp7);
PCKEV_B_4VECS_SB(temp1, temp3, temp5, temp7, temp0, temp2, temp4, temp6,
dst0, dst1, dst2, dst3);
STORE_4VECS_SB(VAR_2, VAR_3, dst0, dst1, dst2, dst3);
VAR_2 += 4 * VAR_3;
}
}
|
[
"static void FUNC_0(uint8_t *VAR_0, int32_t VAR_1,\nuint8_t *VAR_2, int32_t VAR_3,\nint32_t VAR_4, int32_t VAR_5,\nint32_t VAR_6, int32_t VAR_7,\nint32_t VAR_8)\n{",
"uint8_t cnt;",
"v16i8 src_wgt, dst_wgt, wgt;",
"v16i8 src0, src1, src2, src3;",
"v16i8 dst0, dst1, dst2, dst3;",
"v16i8 vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7;",
"v8i16 temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7;",
"v8i16 denom, offset, add_val;",
"int32_t val = 128 * (VAR_6 + VAR_7);",
"VAR_8 = ((VAR_8 + 1) | 1) << VAR_5;",
"src_wgt = __msa_fill_b(VAR_6);",
"dst_wgt = __msa_fill_b(VAR_7);",
"offset = __msa_fill_h(VAR_8);",
"denom = __msa_fill_h(VAR_5 + 1);",
"add_val = __msa_fill_h(val);",
"offset += add_val;",
"wgt = __msa_ilvev_b(dst_wgt, src_wgt);",
"for (cnt = VAR_4 / 4; cnt--;) {",
"LOAD_4VECS_SB(VAR_0, VAR_1, src0, src1, src2, src3);",
"VAR_0 += (4 * VAR_1);",
"LOAD_4VECS_SB(VAR_2, VAR_3, dst0, dst1, dst2, dst3);",
"XORI_B_4VECS_SB(src0, src1, src2, src3, src0, src1, src2, src3, 128);",
"XORI_B_4VECS_SB(dst0, dst1, dst2, dst3, dst0, dst1, dst2, dst3, 128);",
"ILV_B_LRLR_SB(src0, dst0, src1, dst1, vec1, vec0, vec3, vec2);",
"ILV_B_LRLR_SB(src2, dst2, src3, dst3, vec5, vec4, vec7, vec6);",
"temp0 = __msa_dpadd_s_h(offset, wgt, vec0);",
"temp1 = __msa_dpadd_s_h(offset, wgt, vec1);",
"temp2 = __msa_dpadd_s_h(offset, wgt, vec2);",
"temp3 = __msa_dpadd_s_h(offset, wgt, vec3);",
"temp4 = __msa_dpadd_s_h(offset, wgt, vec4);",
"temp5 = __msa_dpadd_s_h(offset, wgt, vec5);",
"temp6 = __msa_dpadd_s_h(offset, wgt, vec6);",
"temp7 = __msa_dpadd_s_h(offset, wgt, vec7);",
"SRA_4VECS(temp0, temp1, temp2, temp3,\ntemp0, temp1, temp2, temp3, denom);",
"SRA_4VECS(temp4, temp5, temp6, temp7,\ntemp4, temp5, temp6, temp7, denom);",
"temp0 = CLIP_UNSIGNED_CHAR_H(temp0);",
"temp1 = CLIP_UNSIGNED_CHAR_H(temp1);",
"temp2 = CLIP_UNSIGNED_CHAR_H(temp2);",
"temp3 = CLIP_UNSIGNED_CHAR_H(temp3);",
"temp4 = CLIP_UNSIGNED_CHAR_H(temp4);",
"temp5 = CLIP_UNSIGNED_CHAR_H(temp5);",
"temp6 = CLIP_UNSIGNED_CHAR_H(temp6);",
"temp7 = CLIP_UNSIGNED_CHAR_H(temp7);",
"PCKEV_B_4VECS_SB(temp1, temp3, temp5, temp7, temp0, temp2, temp4, temp6,\ndst0, dst1, dst2, dst3);",
"STORE_4VECS_SB(VAR_2, VAR_3, dst0, dst1, dst2, dst3);",
"VAR_2 += 4 * VAR_3;",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5,
7,
9,
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
31
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
49
],
[
53
],
[
55
],
[
57
],
[
61
],
[
65
],
[
69
],
[
73
],
[
75
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
97,
99
],
[
101,
103
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
125,
127
],
[
131
],
[
133
],
[
135
],
[
137
]
] |
6,433 |
int net_init_dump(const NetClientOptions *opts, const char *name,
NetClientState *peer, Error **errp)
{
/* FIXME error_setg(errp, ...) on failure */
int len;
const char *file;
char def_file[128];
const NetdevDumpOptions *dump;
assert(opts->kind == NET_CLIENT_OPTIONS_KIND_DUMP);
dump = opts->dump;
assert(peer);
if (dump->has_file) {
file = dump->file;
} else {
int id;
int ret;
ret = net_hub_id_for_client(peer, &id);
assert(ret == 0); /* peer must be on a hub */
snprintf(def_file, sizeof(def_file), "qemu-vlan%d.pcap", id);
file = def_file;
}
if (dump->has_len) {
if (dump->len > INT_MAX) {
error_report("invalid length: %"PRIu64, dump->len);
return -1;
}
len = dump->len;
} else {
len = 65536;
}
return net_dump_init(peer, "dump", name, file, len);
}
| true |
qemu
|
3791f83ca999edc2d11eb2006ccc1091cd712c15
|
int net_init_dump(const NetClientOptions *opts, const char *name,
NetClientState *peer, Error **errp)
{
int len;
const char *file;
char def_file[128];
const NetdevDumpOptions *dump;
assert(opts->kind == NET_CLIENT_OPTIONS_KIND_DUMP);
dump = opts->dump;
assert(peer);
if (dump->has_file) {
file = dump->file;
} else {
int id;
int ret;
ret = net_hub_id_for_client(peer, &id);
assert(ret == 0);
snprintf(def_file, sizeof(def_file), "qemu-vlan%d.pcap", id);
file = def_file;
}
if (dump->has_len) {
if (dump->len > INT_MAX) {
error_report("invalid length: %"PRIu64, dump->len);
return -1;
}
len = dump->len;
} else {
len = 65536;
}
return net_dump_init(peer, "dump", name, file, len);
}
|
{
"code": [
" error_report(\"invalid length: %\"PRIu64, dump->len);",
" return net_dump_init(peer, \"dump\", name, file, len);"
],
"line_no": [
59,
75
]
}
|
int FUNC_0(const NetClientOptions *VAR_0, const char *VAR_1,
NetClientState *VAR_2, Error **VAR_3)
{
int VAR_4;
const char *VAR_5;
char VAR_6[128];
const NetdevDumpOptions *VAR_7;
assert(VAR_0->kind == NET_CLIENT_OPTIONS_KIND_DUMP);
VAR_7 = VAR_0->VAR_7;
assert(VAR_2);
if (VAR_7->has_file) {
VAR_5 = VAR_7->VAR_5;
} else {
int VAR_8;
int VAR_9;
VAR_9 = net_hub_id_for_client(VAR_2, &VAR_8);
assert(VAR_9 == 0);
snprintf(VAR_6, sizeof(VAR_6), "qemu-vlan%d.pcap", VAR_8);
VAR_5 = VAR_6;
}
if (VAR_7->has_len) {
if (VAR_7->VAR_4 > INT_MAX) {
error_report("invalid length: %"PRIu64, VAR_7->VAR_4);
return -1;
}
VAR_4 = VAR_7->VAR_4;
} else {
VAR_4 = 65536;
}
return net_dump_init(VAR_2, "VAR_7", VAR_1, VAR_5, VAR_4);
}
|
[
"int FUNC_0(const NetClientOptions *VAR_0, const char *VAR_1,\nNetClientState *VAR_2, Error **VAR_3)\n{",
"int VAR_4;",
"const char *VAR_5;",
"char VAR_6[128];",
"const NetdevDumpOptions *VAR_7;",
"assert(VAR_0->kind == NET_CLIENT_OPTIONS_KIND_DUMP);",
"VAR_7 = VAR_0->VAR_7;",
"assert(VAR_2);",
"if (VAR_7->has_file) {",
"VAR_5 = VAR_7->VAR_5;",
"} else {",
"int VAR_8;",
"int VAR_9;",
"VAR_9 = net_hub_id_for_client(VAR_2, &VAR_8);",
"assert(VAR_9 == 0);",
"snprintf(VAR_6, sizeof(VAR_6), \"qemu-vlan%d.pcap\", VAR_8);",
"VAR_5 = VAR_6;",
"}",
"if (VAR_7->has_len) {",
"if (VAR_7->VAR_4 > INT_MAX) {",
"error_report(\"invalid length: %\"PRIu64, VAR_7->VAR_4);",
"return -1;",
"}",
"VAR_4 = VAR_7->VAR_4;",
"} else {",
"VAR_4 = 65536;",
"}",
"return net_dump_init(VAR_2, \"VAR_7\", VAR_1, VAR_5, VAR_4);",
"}"
] |
[
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,
1,
0
] |
[
[
1,
3,
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
25
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
41
],
[
43
],
[
47
],
[
49
],
[
51
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
75
],
[
77
]
] |
6,434 |
int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
{
if (*spec <= '9' && *spec >= '0') /* opt:index */
return strtol(spec, NULL, 0) == st->index;
else if (*spec == 'v' || *spec == 'a' || *spec == 's' || *spec == 'd' ||
*spec == 't') { /* opt:[vasdt] */
enum AVMediaType type;
switch (*spec++) {
case 'v': type = AVMEDIA_TYPE_VIDEO; break;
case 'a': type = AVMEDIA_TYPE_AUDIO; break;
case 's': type = AVMEDIA_TYPE_SUBTITLE; break;
case 'd': type = AVMEDIA_TYPE_DATA; break;
case 't': type = AVMEDIA_TYPE_ATTACHMENT; break;
}
if (type != st->codec->codec_type)
return 0;
if (*spec++ == ':') { /* possibly followed by :index */
int i, index = strtol(spec, NULL, 0);
for (i = 0; i < s->nb_streams; i++)
if (s->streams[i]->codec->codec_type == type && index-- == 0)
return i == st->index;
return 0;
}
return 1;
} else if (*spec == 'p' && *(spec + 1) == ':') {
int prog_id, i, j;
char *endptr;
spec += 2;
prog_id = strtol(spec, &endptr, 0);
for (i = 0; i < s->nb_programs; i++) {
if (s->programs[i]->id != prog_id)
continue;
if (*endptr++ == ':') {
int stream_idx = strtol(endptr, NULL, 0);
return stream_idx >= 0 &&
stream_idx < s->programs[i]->nb_stream_indexes &&
st->index == s->programs[i]->stream_index[stream_idx];
}
for (j = 0; j < s->programs[i]->nb_stream_indexes; j++)
if (st->index == s->programs[i]->stream_index[j])
return 1;
}
return 0;
} else if (!*spec) /* empty specifier, matches everything */
return 1;
av_log(s, AV_LOG_ERROR, "Invalid stream specifier: %s.\n", spec);
return AVERROR(EINVAL);
}
| true |
FFmpeg
|
7cf78b3476d77888caa059398078640fb821170e
|
int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
{
if (*spec <= '9' && *spec >= '0')
return strtol(spec, NULL, 0) == st->index;
else if (*spec == 'v' || *spec == 'a' || *spec == 's' || *spec == 'd' ||
*spec == 't') {
enum AVMediaType type;
switch (*spec++) {
case 'v': type = AVMEDIA_TYPE_VIDEO; break;
case 'a': type = AVMEDIA_TYPE_AUDIO; break;
case 's': type = AVMEDIA_TYPE_SUBTITLE; break;
case 'd': type = AVMEDIA_TYPE_DATA; break;
case 't': type = AVMEDIA_TYPE_ATTACHMENT; break;
}
if (type != st->codec->codec_type)
return 0;
if (*spec++ == ':') {
int i, index = strtol(spec, NULL, 0);
for (i = 0; i < s->nb_streams; i++)
if (s->streams[i]->codec->codec_type == type && index-- == 0)
return i == st->index;
return 0;
}
return 1;
} else if (*spec == 'p' && *(spec + 1) == ':') {
int prog_id, i, j;
char *endptr;
spec += 2;
prog_id = strtol(spec, &endptr, 0);
for (i = 0; i < s->nb_programs; i++) {
if (s->programs[i]->id != prog_id)
continue;
if (*endptr++ == ':') {
int stream_idx = strtol(endptr, NULL, 0);
return stream_idx >= 0 &&
stream_idx < s->programs[i]->nb_stream_indexes &&
st->index == s->programs[i]->stream_index[stream_idx];
}
for (j = 0; j < s->programs[i]->nb_stream_indexes; j++)
if (st->index == s->programs[i]->stream_index[j])
return 1;
}
return 0;
} else if (!*spec)
return 1;
av_log(s, AV_LOG_ERROR, "Invalid stream specifier: %s.\n", spec);
return AVERROR(EINVAL);
}
|
{
"code": [],
"line_no": []
}
|
int FUNC_0(AVFormatContext *VAR_0, AVStream *VAR_1, const char *VAR_2)
{
if (*VAR_2 <= '9' && *VAR_2 >= '0')
return strtol(VAR_2, NULL, 0) == VAR_1->VAR_5;
else if (*VAR_2 == 'v' || *VAR_2 == 'a' || *VAR_2 == 'VAR_0' || *VAR_2 == 'd' ||
*VAR_2 == 't') {
enum AVMediaType VAR_3;
switch (*VAR_2++) {
case 'v': VAR_3 = AVMEDIA_TYPE_VIDEO; break;
case 'a': VAR_3 = AVMEDIA_TYPE_AUDIO; break;
case 'VAR_0': VAR_3 = AVMEDIA_TYPE_SUBTITLE; break;
case 'd': VAR_3 = AVMEDIA_TYPE_DATA; break;
case 't': VAR_3 = AVMEDIA_TYPE_ATTACHMENT; break;
}
if (VAR_3 != VAR_1->codec->codec_type)
return 0;
if (*VAR_2++ == ':') {
int VAR_7, VAR_5 = strtol(VAR_2, NULL, 0);
for (VAR_7 = 0; VAR_7 < VAR_0->nb_streams; VAR_7++)
if (VAR_0->streams[VAR_7]->codec->codec_type == VAR_3 && VAR_5-- == 0)
return VAR_7 == VAR_1->VAR_5;
return 0;
}
return 1;
} else if (*VAR_2 == 'p' && *(VAR_2 + 1) == ':') {
int VAR_6, VAR_7, VAR_7;
char *VAR_8;
VAR_2 += 2;
VAR_6 = strtol(VAR_2, &VAR_8, 0);
for (VAR_7 = 0; VAR_7 < VAR_0->nb_programs; VAR_7++) {
if (VAR_0->programs[VAR_7]->id != VAR_6)
continue;
if (*VAR_8++ == ':') {
int stream_idx = strtol(VAR_8, NULL, 0);
return stream_idx >= 0 &&
stream_idx < VAR_0->programs[VAR_7]->nb_stream_indexes &&
VAR_1->VAR_5 == VAR_0->programs[VAR_7]->stream_index[stream_idx];
}
for (VAR_7 = 0; VAR_7 < VAR_0->programs[VAR_7]->nb_stream_indexes; VAR_7++)
if (VAR_1->VAR_5 == VAR_0->programs[VAR_7]->stream_index[VAR_7])
return 1;
}
return 0;
} else if (!*VAR_2)
return 1;
av_log(VAR_0, AV_LOG_ERROR, "Invalid stream specifier: %VAR_0.\n", VAR_2);
return AVERROR(EINVAL);
}
|
[
"int FUNC_0(AVFormatContext *VAR_0, AVStream *VAR_1, const char *VAR_2)\n{",
"if (*VAR_2 <= '9' && *VAR_2 >= '0')\nreturn strtol(VAR_2, NULL, 0) == VAR_1->VAR_5;",
"else if (*VAR_2 == 'v' || *VAR_2 == 'a' || *VAR_2 == 'VAR_0' || *VAR_2 == 'd' ||\n*VAR_2 == 't') {",
"enum AVMediaType VAR_3;",
"switch (*VAR_2++) {",
"case 'v': VAR_3 = AVMEDIA_TYPE_VIDEO; break;",
"case 'a': VAR_3 = AVMEDIA_TYPE_AUDIO; break;",
"case 'VAR_0': VAR_3 = AVMEDIA_TYPE_SUBTITLE; break;",
"case 'd': VAR_3 = AVMEDIA_TYPE_DATA; break;",
"case 't': VAR_3 = AVMEDIA_TYPE_ATTACHMENT; break;",
"}",
"if (VAR_3 != VAR_1->codec->codec_type)\nreturn 0;",
"if (*VAR_2++ == ':') {",
"int VAR_7, VAR_5 = strtol(VAR_2, NULL, 0);",
"for (VAR_7 = 0; VAR_7 < VAR_0->nb_streams; VAR_7++)",
"if (VAR_0->streams[VAR_7]->codec->codec_type == VAR_3 && VAR_5-- == 0)\nreturn VAR_7 == VAR_1->VAR_5;",
"return 0;",
"}",
"return 1;",
"} else if (*VAR_2 == 'p' && *(VAR_2 + 1) == ':') {",
"int VAR_6, VAR_7, VAR_7;",
"char *VAR_8;",
"VAR_2 += 2;",
"VAR_6 = strtol(VAR_2, &VAR_8, 0);",
"for (VAR_7 = 0; VAR_7 < VAR_0->nb_programs; VAR_7++) {",
"if (VAR_0->programs[VAR_7]->id != VAR_6)\ncontinue;",
"if (*VAR_8++ == ':') {",
"int stream_idx = strtol(VAR_8, NULL, 0);",
"return stream_idx >= 0 &&\nstream_idx < VAR_0->programs[VAR_7]->nb_stream_indexes &&\nVAR_1->VAR_5 == VAR_0->programs[VAR_7]->stream_index[stream_idx];",
"}",
"for (VAR_7 = 0; VAR_7 < VAR_0->programs[VAR_7]->nb_stream_indexes; VAR_7++)",
"if (VAR_1->VAR_5 == VAR_0->programs[VAR_7]->stream_index[VAR_7])\nreturn 1;",
"}",
"return 0;",
"} else if (!*VAR_2)",
"return 1;",
"av_log(VAR_0, AV_LOG_ERROR, \"Invalid stream specifier: %VAR_0.\\n\", VAR_2);",
"return AVERROR(EINVAL);",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
30
],
[
32,
34
],
[
36
],
[
38
],
[
40
],
[
42,
44
],
[
46
],
[
48
],
[
50
],
[
52
],
[
54
],
[
56
],
[
58
],
[
60
],
[
62
],
[
64,
66
],
[
70
],
[
72
],
[
74,
76,
78
],
[
80
],
[
84
],
[
86,
88
],
[
90
],
[
92
],
[
94
],
[
96
],
[
100
],
[
102
],
[
104
]
] |
6,435 |
static void rm_read_metadata(AVFormatContext *s, int wide)
{
char buf[1024];
int i;
for (i=0; i<FF_ARRAY_ELEMS(ff_rm_metadata); i++) {
int len = wide ? avio_rb16(s->pb) : avio_r8(s->pb);
get_strl(s->pb, buf, sizeof(buf), len);
av_dict_set(&s->metadata, ff_rm_metadata[i], buf, 0);
}
}
| true |
FFmpeg
|
bf87908cd8da31e8f8fe75c06577170928ea70a8
|
static void rm_read_metadata(AVFormatContext *s, int wide)
{
char buf[1024];
int i;
for (i=0; i<FF_ARRAY_ELEMS(ff_rm_metadata); i++) {
int len = wide ? avio_rb16(s->pb) : avio_r8(s->pb);
get_strl(s->pb, buf, sizeof(buf), len);
av_dict_set(&s->metadata, ff_rm_metadata[i], buf, 0);
}
}
|
{
"code": [
"static void rm_read_metadata(AVFormatContext *s, int wide)",
" int len = wide ? avio_rb16(s->pb) : avio_r8(s->pb);",
" get_strl(s->pb, buf, sizeof(buf), len);"
],
"line_no": [
1,
11,
13
]
}
|
static void FUNC_0(AVFormatContext *VAR_0, int VAR_1)
{
char VAR_2[1024];
int VAR_3;
for (VAR_3=0; VAR_3<FF_ARRAY_ELEMS(ff_rm_metadata); VAR_3++) {
int len = VAR_1 ? avio_rb16(VAR_0->pb) : avio_r8(VAR_0->pb);
get_strl(VAR_0->pb, VAR_2, sizeof(VAR_2), len);
av_dict_set(&VAR_0->metadata, ff_rm_metadata[VAR_3], VAR_2, 0);
}
}
|
[
"static void FUNC_0(AVFormatContext *VAR_0, int VAR_1)\n{",
"char VAR_2[1024];",
"int VAR_3;",
"for (VAR_3=0; VAR_3<FF_ARRAY_ELEMS(ff_rm_metadata); VAR_3++) {",
"int len = VAR_1 ? avio_rb16(VAR_0->pb) : avio_r8(VAR_0->pb);",
"get_strl(VAR_0->pb, VAR_2, sizeof(VAR_2), len);",
"av_dict_set(&VAR_0->metadata, ff_rm_metadata[VAR_3], VAR_2, 0);",
"}",
"}"
] |
[
1,
0,
0,
0,
1,
1,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
]
] |
6,436 |
void qmp_migrate(const char *uri, bool has_blk, bool blk,
bool has_inc, bool inc, bool has_detach, bool detach,
Error **errp)
{
Error *local_err = NULL;
MigrationState *s = migrate_get_current();
MigrationParams params;
const char *p;
params.blk = has_blk && blk;
params.shared = has_inc && inc;
if (s->state == MIG_STATE_ACTIVE || s->state == MIG_STATE_SETUP ||
s->state == MIG_STATE_CANCELLING) {
error_set(errp, QERR_MIGRATION_ACTIVE);
if (qemu_savevm_state_blocked(errp)) {
if (migration_blockers) {
*errp = error_copy(migration_blockers->data);
s = migrate_init(¶ms);
if (strstart(uri, "tcp:", &p)) {
tcp_start_outgoing_migration(s, p, &local_err);
#ifdef CONFIG_RDMA
} else if (strstart(uri, "rdma:", &p)) {
rdma_start_outgoing_migration(s, p, &local_err);
#endif
#if !defined(WIN32)
} else if (strstart(uri, "exec:", &p)) {
exec_start_outgoing_migration(s, p, &local_err);
} else if (strstart(uri, "unix:", &p)) {
unix_start_outgoing_migration(s, p, &local_err);
} else if (strstart(uri, "fd:", &p)) {
fd_start_outgoing_migration(s, p, &local_err);
#endif
} else {
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "uri", "a valid migration protocol");
s->state = MIG_STATE_ERROR;
if (local_err) {
migrate_fd_error(s);
error_propagate(errp, local_err);
| true |
qemu
|
ca99993adc9205c905dba5dc1bb819959ada7200
|
void qmp_migrate(const char *uri, bool has_blk, bool blk,
bool has_inc, bool inc, bool has_detach, bool detach,
Error **errp)
{
Error *local_err = NULL;
MigrationState *s = migrate_get_current();
MigrationParams params;
const char *p;
params.blk = has_blk && blk;
params.shared = has_inc && inc;
if (s->state == MIG_STATE_ACTIVE || s->state == MIG_STATE_SETUP ||
s->state == MIG_STATE_CANCELLING) {
error_set(errp, QERR_MIGRATION_ACTIVE);
if (qemu_savevm_state_blocked(errp)) {
if (migration_blockers) {
*errp = error_copy(migration_blockers->data);
s = migrate_init(¶ms);
if (strstart(uri, "tcp:", &p)) {
tcp_start_outgoing_migration(s, p, &local_err);
#ifdef CONFIG_RDMA
} else if (strstart(uri, "rdma:", &p)) {
rdma_start_outgoing_migration(s, p, &local_err);
#endif
#if !defined(WIN32)
} else if (strstart(uri, "exec:", &p)) {
exec_start_outgoing_migration(s, p, &local_err);
} else if (strstart(uri, "unix:", &p)) {
unix_start_outgoing_migration(s, p, &local_err);
} else if (strstart(uri, "fd:", &p)) {
fd_start_outgoing_migration(s, p, &local_err);
#endif
} else {
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "uri", "a valid migration protocol");
s->state = MIG_STATE_ERROR;
if (local_err) {
migrate_fd_error(s);
error_propagate(errp, local_err);
|
{
"code": [],
"line_no": []
}
|
void FUNC_0(const char *VAR_0, bool VAR_1, bool VAR_2,
bool VAR_3, bool VAR_4, bool VAR_5, bool VAR_6,
Error **VAR_7)
{
Error *local_err = NULL;
MigrationState *s = migrate_get_current();
MigrationParams params;
const char *VAR_8;
params.VAR_2 = VAR_1 && VAR_2;
params.shared = VAR_3 && VAR_4;
if (s->state == MIG_STATE_ACTIVE || s->state == MIG_STATE_SETUP ||
s->state == MIG_STATE_CANCELLING) {
error_set(VAR_7, QERR_MIGRATION_ACTIVE);
if (qemu_savevm_state_blocked(VAR_7)) {
if (migration_blockers) {
*VAR_7 = error_copy(migration_blockers->data);
s = migrate_init(¶ms);
if (strstart(VAR_0, "tcp:", &VAR_8)) {
tcp_start_outgoing_migration(s, VAR_8, &local_err);
#ifdef CONFIG_RDMA
} else if (strstart(VAR_0, "rdma:", &VAR_8)) {
rdma_start_outgoing_migration(s, VAR_8, &local_err);
#endif
#if !defined(WIN32)
} else if (strstart(VAR_0, "exec:", &VAR_8)) {
exec_start_outgoing_migration(s, VAR_8, &local_err);
} else if (strstart(VAR_0, "unix:", &VAR_8)) {
unix_start_outgoing_migration(s, VAR_8, &local_err);
} else if (strstart(VAR_0, "fd:", &VAR_8)) {
fd_start_outgoing_migration(s, VAR_8, &local_err);
#endif
} else {
error_set(VAR_7, QERR_INVALID_PARAMETER_VALUE, "VAR_0", "a valid migration protocol");
s->state = MIG_STATE_ERROR;
if (local_err) {
migrate_fd_error(s);
error_propagate(VAR_7, local_err);
|
[
"void FUNC_0(const char *VAR_0, bool VAR_1, bool VAR_2,\nbool VAR_3, bool VAR_4, bool VAR_5, bool VAR_6,\nError **VAR_7)\n{",
"Error *local_err = NULL;",
"MigrationState *s = migrate_get_current();",
"MigrationParams params;",
"const char *VAR_8;",
"params.VAR_2 = VAR_1 && VAR_2;",
"params.shared = VAR_3 && VAR_4;",
"if (s->state == MIG_STATE_ACTIVE || s->state == MIG_STATE_SETUP ||\ns->state == MIG_STATE_CANCELLING) {",
"error_set(VAR_7, QERR_MIGRATION_ACTIVE);",
"if (qemu_savevm_state_blocked(VAR_7)) {",
"if (migration_blockers) {",
"*VAR_7 = error_copy(migration_blockers->data);",
"s = migrate_init(¶ms);",
"if (strstart(VAR_0, \"tcp:\", &VAR_8)) {",
"tcp_start_outgoing_migration(s, VAR_8, &local_err);",
"#ifdef CONFIG_RDMA\n} else if (strstart(VAR_0, \"rdma:\", &VAR_8)) {",
"rdma_start_outgoing_migration(s, VAR_8, &local_err);",
"#endif\n#if !defined(WIN32)\n} else if (strstart(VAR_0, \"exec:\", &VAR_8)) {",
"exec_start_outgoing_migration(s, VAR_8, &local_err);",
"} else if (strstart(VAR_0, \"unix:\", &VAR_8)) {",
"unix_start_outgoing_migration(s, VAR_8, &local_err);",
"} else if (strstart(VAR_0, \"fd:\", &VAR_8)) {",
"fd_start_outgoing_migration(s, VAR_8, &local_err);",
"#endif\n} else {",
"error_set(VAR_7, QERR_INVALID_PARAMETER_VALUE, \"VAR_0\", \"a valid migration protocol\");",
"s->state = MIG_STATE_ERROR;",
"if (local_err) {",
"migrate_fd_error(s);",
"error_propagate(VAR_7, local_err);"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
2,
3,
4
],
[
5
],
[
6
],
[
7
],
[
8
],
[
9
],
[
10
],
[
11,
12
],
[
13
],
[
14
],
[
15
],
[
16
],
[
17
],
[
18
],
[
19
],
[
20,
21
],
[
22
],
[
23,
24,
25
],
[
26
],
[
27
],
[
28
],
[
29
],
[
30
],
[
31,
32
],
[
33
],
[
34
],
[
35
],
[
36
],
[
37
]
] |
6,437 |
static void stm32f2xx_timer_write(void *opaque, hwaddr offset,
uint64_t val64, unsigned size)
{
STM32F2XXTimerState *s = opaque;
uint32_t value = val64;
int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
uint32_t timer_val = 0;
DB_PRINT("Write 0x%x, 0x%"HWADDR_PRIx"\n", value, offset);
switch (offset) {
case TIM_CR1:
s->tim_cr1 = value;
return;
case TIM_CR2:
s->tim_cr2 = value;
return;
case TIM_SMCR:
s->tim_smcr = value;
return;
case TIM_DIER:
s->tim_dier = value;
return;
case TIM_SR:
/* This is set by hardware and cleared by software */
s->tim_sr &= value;
return;
case TIM_EGR:
s->tim_egr = value;
if (s->tim_egr & TIM_EGR_UG) {
timer_val = 0;
break;
}
return;
case TIM_CCMR1:
s->tim_ccmr1 = value;
return;
case TIM_CCMR2:
s->tim_ccmr2 = value;
return;
case TIM_CCER:
s->tim_ccer = value;
return;
case TIM_PSC:
timer_val = stm32f2xx_ns_to_ticks(s, now) - s->tick_offset;
s->tim_psc = value;
value = timer_val;
break;
case TIM_CNT:
timer_val = value;
break;
case TIM_ARR:
s->tim_arr = value;
stm32f2xx_timer_set_alarm(s, now);
return;
case TIM_CCR1:
s->tim_ccr1 = value;
return;
case TIM_CCR2:
s->tim_ccr2 = value;
return;
case TIM_CCR3:
s->tim_ccr3 = value;
return;
case TIM_CCR4:
s->tim_ccr4 = value;
return;
case TIM_DCR:
s->tim_dcr = value;
return;
case TIM_DMAR:
s->tim_dmar = value;
return;
case TIM_OR:
s->tim_or = value;
return;
default:
qemu_log_mask(LOG_GUEST_ERROR,
"%s: Bad offset 0x%"HWADDR_PRIx"\n", __func__, offset);
return;
}
/* This means that a register write has affected the timer in a way that
* requires a refresh of both tick_offset and the alarm.
*/
s->tick_offset = stm32f2xx_ns_to_ticks(s, now) - timer_val;
stm32f2xx_timer_set_alarm(s, now);
}
| true |
qemu
|
84da15169b45f7080e4b1b32f70e68e726e02740
|
static void stm32f2xx_timer_write(void *opaque, hwaddr offset,
uint64_t val64, unsigned size)
{
STM32F2XXTimerState *s = opaque;
uint32_t value = val64;
int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
uint32_t timer_val = 0;
DB_PRINT("Write 0x%x, 0x%"HWADDR_PRIx"\n", value, offset);
switch (offset) {
case TIM_CR1:
s->tim_cr1 = value;
return;
case TIM_CR2:
s->tim_cr2 = value;
return;
case TIM_SMCR:
s->tim_smcr = value;
return;
case TIM_DIER:
s->tim_dier = value;
return;
case TIM_SR:
s->tim_sr &= value;
return;
case TIM_EGR:
s->tim_egr = value;
if (s->tim_egr & TIM_EGR_UG) {
timer_val = 0;
break;
}
return;
case TIM_CCMR1:
s->tim_ccmr1 = value;
return;
case TIM_CCMR2:
s->tim_ccmr2 = value;
return;
case TIM_CCER:
s->tim_ccer = value;
return;
case TIM_PSC:
timer_val = stm32f2xx_ns_to_ticks(s, now) - s->tick_offset;
s->tim_psc = value;
value = timer_val;
break;
case TIM_CNT:
timer_val = value;
break;
case TIM_ARR:
s->tim_arr = value;
stm32f2xx_timer_set_alarm(s, now);
return;
case TIM_CCR1:
s->tim_ccr1 = value;
return;
case TIM_CCR2:
s->tim_ccr2 = value;
return;
case TIM_CCR3:
s->tim_ccr3 = value;
return;
case TIM_CCR4:
s->tim_ccr4 = value;
return;
case TIM_DCR:
s->tim_dcr = value;
return;
case TIM_DMAR:
s->tim_dmar = value;
return;
case TIM_OR:
s->tim_or = value;
return;
default:
qemu_log_mask(LOG_GUEST_ERROR,
"%s: Bad offset 0x%"HWADDR_PRIx"\n", __func__, offset);
return;
}
s->tick_offset = stm32f2xx_ns_to_ticks(s, now) - timer_val;
stm32f2xx_timer_set_alarm(s, now);
}
|
{
"code": [
" s->tim_psc = value;"
],
"line_no": [
91
]
}
|
static void FUNC_0(void *VAR_0, hwaddr VAR_1,
uint64_t VAR_2, unsigned VAR_3)
{
STM32F2XXTimerState *s = VAR_0;
uint32_t value = VAR_2;
int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
uint32_t timer_val = 0;
DB_PRINT("Write 0x%x, 0x%"HWADDR_PRIx"\n", value, VAR_1);
switch (VAR_1) {
case TIM_CR1:
s->tim_cr1 = value;
return;
case TIM_CR2:
s->tim_cr2 = value;
return;
case TIM_SMCR:
s->tim_smcr = value;
return;
case TIM_DIER:
s->tim_dier = value;
return;
case TIM_SR:
s->tim_sr &= value;
return;
case TIM_EGR:
s->tim_egr = value;
if (s->tim_egr & TIM_EGR_UG) {
timer_val = 0;
break;
}
return;
case TIM_CCMR1:
s->tim_ccmr1 = value;
return;
case TIM_CCMR2:
s->tim_ccmr2 = value;
return;
case TIM_CCER:
s->tim_ccer = value;
return;
case TIM_PSC:
timer_val = stm32f2xx_ns_to_ticks(s, now) - s->tick_offset;
s->tim_psc = value;
value = timer_val;
break;
case TIM_CNT:
timer_val = value;
break;
case TIM_ARR:
s->tim_arr = value;
stm32f2xx_timer_set_alarm(s, now);
return;
case TIM_CCR1:
s->tim_ccr1 = value;
return;
case TIM_CCR2:
s->tim_ccr2 = value;
return;
case TIM_CCR3:
s->tim_ccr3 = value;
return;
case TIM_CCR4:
s->tim_ccr4 = value;
return;
case TIM_DCR:
s->tim_dcr = value;
return;
case TIM_DMAR:
s->tim_dmar = value;
return;
case TIM_OR:
s->tim_or = value;
return;
default:
qemu_log_mask(LOG_GUEST_ERROR,
"%s: Bad VAR_1 0x%"HWADDR_PRIx"\n", __func__, VAR_1);
return;
}
s->tick_offset = stm32f2xx_ns_to_ticks(s, now) - timer_val;
stm32f2xx_timer_set_alarm(s, now);
}
|
[
"static void FUNC_0(void *VAR_0, hwaddr VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{",
"STM32F2XXTimerState *s = VAR_0;",
"uint32_t value = VAR_2;",
"int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);",
"uint32_t timer_val = 0;",
"DB_PRINT(\"Write 0x%x, 0x%\"HWADDR_PRIx\"\\n\", value, VAR_1);",
"switch (VAR_1) {",
"case TIM_CR1:\ns->tim_cr1 = value;",
"return;",
"case TIM_CR2:\ns->tim_cr2 = value;",
"return;",
"case TIM_SMCR:\ns->tim_smcr = value;",
"return;",
"case TIM_DIER:\ns->tim_dier = value;",
"return;",
"case TIM_SR:\ns->tim_sr &= value;",
"return;",
"case TIM_EGR:\ns->tim_egr = value;",
"if (s->tim_egr & TIM_EGR_UG) {",
"timer_val = 0;",
"break;",
"}",
"return;",
"case TIM_CCMR1:\ns->tim_ccmr1 = value;",
"return;",
"case TIM_CCMR2:\ns->tim_ccmr2 = value;",
"return;",
"case TIM_CCER:\ns->tim_ccer = value;",
"return;",
"case TIM_PSC:\ntimer_val = stm32f2xx_ns_to_ticks(s, now) - s->tick_offset;",
"s->tim_psc = value;",
"value = timer_val;",
"break;",
"case TIM_CNT:\ntimer_val = value;",
"break;",
"case TIM_ARR:\ns->tim_arr = value;",
"stm32f2xx_timer_set_alarm(s, now);",
"return;",
"case TIM_CCR1:\ns->tim_ccr1 = value;",
"return;",
"case TIM_CCR2:\ns->tim_ccr2 = value;",
"return;",
"case TIM_CCR3:\ns->tim_ccr3 = value;",
"return;",
"case TIM_CCR4:\ns->tim_ccr4 = value;",
"return;",
"case TIM_DCR:\ns->tim_dcr = value;",
"return;",
"case TIM_DMAR:\ns->tim_dmar = value;",
"return;",
"case TIM_OR:\ns->tim_or = value;",
"return;",
"default:\nqemu_log_mask(LOG_GUEST_ERROR,\n\"%s: Bad VAR_1 0x%\"HWADDR_PRIx\"\\n\", __func__, VAR_1);",
"return;",
"}",
"s->tick_offset = stm32f2xx_ns_to_ticks(s, now) - timer_val;",
"stm32f2xx_timer_set_alarm(s, now);",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
21
],
[
23,
25
],
[
27
],
[
29,
31
],
[
33
],
[
35,
37
],
[
39
],
[
41,
43
],
[
45
],
[
47,
51
],
[
53
],
[
55,
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69,
71
],
[
73
],
[
75,
77
],
[
79
],
[
81,
83
],
[
85
],
[
87,
89
],
[
91
],
[
93
],
[
95
],
[
97,
99
],
[
101
],
[
103,
105
],
[
107
],
[
109
],
[
111,
113
],
[
115
],
[
117,
119
],
[
121
],
[
123,
125
],
[
127
],
[
129,
131
],
[
133
],
[
135,
137
],
[
139
],
[
141,
143
],
[
145
],
[
147,
149
],
[
151
],
[
153,
155,
157
],
[
159
],
[
161
],
[
171
],
[
173
],
[
175
]
] |
6,438 |
av_cold void ff_vp8dsp_init(VP8DSPContext *dsp)
{
dsp->vp8_luma_dc_wht = vp8_luma_dc_wht_c;
dsp->vp8_luma_dc_wht_dc = vp8_luma_dc_wht_dc_c;
dsp->vp8_idct_add = vp8_idct_add_c;
dsp->vp8_idct_dc_add = vp8_idct_dc_add_c;
dsp->vp8_idct_dc_add4y = vp8_idct_dc_add4y_c;
dsp->vp8_idct_dc_add4uv = vp8_idct_dc_add4uv_c;
dsp->vp8_v_loop_filter16y = vp8_v_loop_filter16_c;
dsp->vp8_h_loop_filter16y = vp8_h_loop_filter16_c;
dsp->vp8_v_loop_filter8uv = vp8_v_loop_filter8uv_c;
dsp->vp8_h_loop_filter8uv = vp8_h_loop_filter8uv_c;
dsp->vp8_v_loop_filter16y_inner = vp8_v_loop_filter16_inner_c;
dsp->vp8_h_loop_filter16y_inner = vp8_h_loop_filter16_inner_c;
dsp->vp8_v_loop_filter8uv_inner = vp8_v_loop_filter8uv_inner_c;
dsp->vp8_h_loop_filter8uv_inner = vp8_h_loop_filter8uv_inner_c;
dsp->vp8_v_loop_filter_simple = vp8_v_loop_filter_simple_c;
dsp->vp8_h_loop_filter_simple = vp8_h_loop_filter_simple_c;
VP8_MC_FUNC(0, 16);
VP8_MC_FUNC(1, 8);
VP8_MC_FUNC(2, 4);
VP8_BILINEAR_MC_FUNC(0, 16);
VP8_BILINEAR_MC_FUNC(1, 8);
VP8_BILINEAR_MC_FUNC(2, 4);
if (ARCH_ARM)
ff_vp8dsp_init_arm(dsp);
if (ARCH_PPC)
ff_vp8dsp_init_ppc(dsp);
if (ARCH_X86)
ff_vp8dsp_init_x86(dsp);
}
| true |
FFmpeg
|
ac4b32df71bd932838043a4838b86d11e169707f
|
av_cold void ff_vp8dsp_init(VP8DSPContext *dsp)
{
dsp->vp8_luma_dc_wht = vp8_luma_dc_wht_c;
dsp->vp8_luma_dc_wht_dc = vp8_luma_dc_wht_dc_c;
dsp->vp8_idct_add = vp8_idct_add_c;
dsp->vp8_idct_dc_add = vp8_idct_dc_add_c;
dsp->vp8_idct_dc_add4y = vp8_idct_dc_add4y_c;
dsp->vp8_idct_dc_add4uv = vp8_idct_dc_add4uv_c;
dsp->vp8_v_loop_filter16y = vp8_v_loop_filter16_c;
dsp->vp8_h_loop_filter16y = vp8_h_loop_filter16_c;
dsp->vp8_v_loop_filter8uv = vp8_v_loop_filter8uv_c;
dsp->vp8_h_loop_filter8uv = vp8_h_loop_filter8uv_c;
dsp->vp8_v_loop_filter16y_inner = vp8_v_loop_filter16_inner_c;
dsp->vp8_h_loop_filter16y_inner = vp8_h_loop_filter16_inner_c;
dsp->vp8_v_loop_filter8uv_inner = vp8_v_loop_filter8uv_inner_c;
dsp->vp8_h_loop_filter8uv_inner = vp8_h_loop_filter8uv_inner_c;
dsp->vp8_v_loop_filter_simple = vp8_v_loop_filter_simple_c;
dsp->vp8_h_loop_filter_simple = vp8_h_loop_filter_simple_c;
VP8_MC_FUNC(0, 16);
VP8_MC_FUNC(1, 8);
VP8_MC_FUNC(2, 4);
VP8_BILINEAR_MC_FUNC(0, 16);
VP8_BILINEAR_MC_FUNC(1, 8);
VP8_BILINEAR_MC_FUNC(2, 4);
if (ARCH_ARM)
ff_vp8dsp_init_arm(dsp);
if (ARCH_PPC)
ff_vp8dsp_init_ppc(dsp);
if (ARCH_X86)
ff_vp8dsp_init_x86(dsp);
}
|
{
"code": [
" VP8_MC_FUNC(0, 16);",
" VP8_MC_FUNC(1, 8);",
" VP8_MC_FUNC(2, 4);",
" VP8_BILINEAR_MC_FUNC(0, 16);",
" VP8_BILINEAR_MC_FUNC(1, 8);",
" VP8_BILINEAR_MC_FUNC(2, 4);",
" if (ARCH_PPC)",
" ff_vp8dsp_init_ppc(dsp);"
],
"line_no": [
45,
47,
49,
53,
55,
57,
65,
67
]
}
|
av_cold void FUNC_0(VP8DSPContext *dsp)
{
dsp->vp8_luma_dc_wht = vp8_luma_dc_wht_c;
dsp->vp8_luma_dc_wht_dc = vp8_luma_dc_wht_dc_c;
dsp->vp8_idct_add = vp8_idct_add_c;
dsp->vp8_idct_dc_add = vp8_idct_dc_add_c;
dsp->vp8_idct_dc_add4y = vp8_idct_dc_add4y_c;
dsp->vp8_idct_dc_add4uv = vp8_idct_dc_add4uv_c;
dsp->vp8_v_loop_filter16y = vp8_v_loop_filter16_c;
dsp->vp8_h_loop_filter16y = vp8_h_loop_filter16_c;
dsp->vp8_v_loop_filter8uv = vp8_v_loop_filter8uv_c;
dsp->vp8_h_loop_filter8uv = vp8_h_loop_filter8uv_c;
dsp->vp8_v_loop_filter16y_inner = vp8_v_loop_filter16_inner_c;
dsp->vp8_h_loop_filter16y_inner = vp8_h_loop_filter16_inner_c;
dsp->vp8_v_loop_filter8uv_inner = vp8_v_loop_filter8uv_inner_c;
dsp->vp8_h_loop_filter8uv_inner = vp8_h_loop_filter8uv_inner_c;
dsp->vp8_v_loop_filter_simple = vp8_v_loop_filter_simple_c;
dsp->vp8_h_loop_filter_simple = vp8_h_loop_filter_simple_c;
VP8_MC_FUNC(0, 16);
VP8_MC_FUNC(1, 8);
VP8_MC_FUNC(2, 4);
VP8_BILINEAR_MC_FUNC(0, 16);
VP8_BILINEAR_MC_FUNC(1, 8);
VP8_BILINEAR_MC_FUNC(2, 4);
if (ARCH_ARM)
ff_vp8dsp_init_arm(dsp);
if (ARCH_PPC)
ff_vp8dsp_init_ppc(dsp);
if (ARCH_X86)
ff_vp8dsp_init_x86(dsp);
}
|
[
"av_cold void FUNC_0(VP8DSPContext *dsp)\n{",
"dsp->vp8_luma_dc_wht = vp8_luma_dc_wht_c;",
"dsp->vp8_luma_dc_wht_dc = vp8_luma_dc_wht_dc_c;",
"dsp->vp8_idct_add = vp8_idct_add_c;",
"dsp->vp8_idct_dc_add = vp8_idct_dc_add_c;",
"dsp->vp8_idct_dc_add4y = vp8_idct_dc_add4y_c;",
"dsp->vp8_idct_dc_add4uv = vp8_idct_dc_add4uv_c;",
"dsp->vp8_v_loop_filter16y = vp8_v_loop_filter16_c;",
"dsp->vp8_h_loop_filter16y = vp8_h_loop_filter16_c;",
"dsp->vp8_v_loop_filter8uv = vp8_v_loop_filter8uv_c;",
"dsp->vp8_h_loop_filter8uv = vp8_h_loop_filter8uv_c;",
"dsp->vp8_v_loop_filter16y_inner = vp8_v_loop_filter16_inner_c;",
"dsp->vp8_h_loop_filter16y_inner = vp8_h_loop_filter16_inner_c;",
"dsp->vp8_v_loop_filter8uv_inner = vp8_v_loop_filter8uv_inner_c;",
"dsp->vp8_h_loop_filter8uv_inner = vp8_h_loop_filter8uv_inner_c;",
"dsp->vp8_v_loop_filter_simple = vp8_v_loop_filter_simple_c;",
"dsp->vp8_h_loop_filter_simple = vp8_h_loop_filter_simple_c;",
"VP8_MC_FUNC(0, 16);",
"VP8_MC_FUNC(1, 8);",
"VP8_MC_FUNC(2, 4);",
"VP8_BILINEAR_MC_FUNC(0, 16);",
"VP8_BILINEAR_MC_FUNC(1, 8);",
"VP8_BILINEAR_MC_FUNC(2, 4);",
"if (ARCH_ARM)\nff_vp8dsp_init_arm(dsp);",
"if (ARCH_PPC)\nff_vp8dsp_init_ppc(dsp);",
"if (ARCH_X86)\nff_vp8dsp_init_x86(dsp);",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
1,
1,
1,
1,
0,
1,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23
],
[
25
],
[
29
],
[
31
],
[
33
],
[
35
],
[
39
],
[
41
],
[
45
],
[
47
],
[
49
],
[
53
],
[
55
],
[
57
],
[
61,
63
],
[
65,
67
],
[
69,
71
],
[
73
]
] |
6,439 |
static void test_qga_file_ops(gconstpointer fix)
{
const TestFixture *fixture = fix;
const unsigned char helloworld[] = "Hello World!\n";
const char *b64;
gchar *cmd, *path, *enc;
unsigned char *dec;
QDict *ret, *val;
int64_t id, eof;
gsize count;
FILE *f;
char tmp[100];
/* open */
ret = qmp_fd(fixture->fd, "{'execute': 'guest-file-open',"
" 'arguments': { 'path': 'foo', 'mode': 'w+' } }");
g_assert_nonnull(ret);
qmp_assert_no_error(ret);
id = qdict_get_int(ret, "return");
QDECREF(ret);
enc = g_base64_encode(helloworld, sizeof(helloworld));
/* write */
cmd = g_strdup_printf("{'execute': 'guest-file-write',"
" 'arguments': { 'handle': %" PRId64 ","
" 'buf-b64': '%s' } }", id, enc);
ret = qmp_fd(fixture->fd, cmd);
g_assert_nonnull(ret);
qmp_assert_no_error(ret);
val = qdict_get_qdict(ret, "return");
count = qdict_get_int(val, "count");
eof = qdict_get_bool(val, "eof");
g_assert_cmpint(count, ==, sizeof(helloworld));
g_assert_cmpint(eof, ==, 0);
QDECREF(ret);
g_free(cmd);
/* flush */
cmd = g_strdup_printf("{'execute': 'guest-file-flush',"
" 'arguments': {'handle': %" PRId64 "} }",
id);
ret = qmp_fd(fixture->fd, cmd);
QDECREF(ret);
g_free(cmd);
/* close */
cmd = g_strdup_printf("{'execute': 'guest-file-close',"
" 'arguments': {'handle': %" PRId64 "} }",
id);
ret = qmp_fd(fixture->fd, cmd);
QDECREF(ret);
g_free(cmd);
/* check content */
path = g_build_filename(fixture->test_dir, "foo", NULL);
f = fopen(path, "r");
g_assert_nonnull(f);
count = fread(tmp, 1, sizeof(tmp), f);
g_assert_cmpint(count, ==, sizeof(helloworld));
tmp[count] = 0;
g_assert_cmpstr(tmp, ==, (char *)helloworld);
fclose(f);
/* open */
ret = qmp_fd(fixture->fd, "{'execute': 'guest-file-open',"
" 'arguments': { 'path': 'foo', 'mode': 'r' } }");
g_assert_nonnull(ret);
qmp_assert_no_error(ret);
id = qdict_get_int(ret, "return");
QDECREF(ret);
/* read */
cmd = g_strdup_printf("{'execute': 'guest-file-read',"
" 'arguments': { 'handle': %" PRId64 "} }",
id);
ret = qmp_fd(fixture->fd, cmd);
val = qdict_get_qdict(ret, "return");
count = qdict_get_int(val, "count");
eof = qdict_get_bool(val, "eof");
b64 = qdict_get_str(val, "buf-b64");
g_assert_cmpint(count, ==, sizeof(helloworld));
g_assert(eof);
g_assert_cmpstr(b64, ==, enc);
QDECREF(ret);
g_free(cmd);
g_free(enc);
/* read eof */
cmd = g_strdup_printf("{'execute': 'guest-file-read',"
" 'arguments': { 'handle': %" PRId64 "} }",
id);
ret = qmp_fd(fixture->fd, cmd);
val = qdict_get_qdict(ret, "return");
count = qdict_get_int(val, "count");
eof = qdict_get_bool(val, "eof");
b64 = qdict_get_str(val, "buf-b64");
g_assert_cmpint(count, ==, 0);
g_assert(eof);
g_assert_cmpstr(b64, ==, "");
QDECREF(ret);
g_free(cmd);
/* seek */
cmd = g_strdup_printf("{'execute': 'guest-file-seek',"
" 'arguments': { 'handle': %" PRId64 ", "
" 'offset': %d, 'whence': '%s' } }",
id, 6, "set");
ret = qmp_fd(fixture->fd, cmd);
qmp_assert_no_error(ret);
val = qdict_get_qdict(ret, "return");
count = qdict_get_int(val, "position");
eof = qdict_get_bool(val, "eof");
g_assert_cmpint(count, ==, 6);
g_assert(!eof);
QDECREF(ret);
g_free(cmd);
/* partial read */
cmd = g_strdup_printf("{'execute': 'guest-file-read',"
" 'arguments': { 'handle': %" PRId64 "} }",
id);
ret = qmp_fd(fixture->fd, cmd);
val = qdict_get_qdict(ret, "return");
count = qdict_get_int(val, "count");
eof = qdict_get_bool(val, "eof");
b64 = qdict_get_str(val, "buf-b64");
g_assert_cmpint(count, ==, sizeof(helloworld) - 6);
g_assert(eof);
dec = g_base64_decode(b64, &count);
g_assert_cmpint(count, ==, sizeof(helloworld) - 6);
g_assert_cmpmem(dec, count, helloworld + 6, sizeof(helloworld) - 6);
g_free(dec);
QDECREF(ret);
g_free(cmd);
/* close */
cmd = g_strdup_printf("{'execute': 'guest-file-close',"
" 'arguments': {'handle': %" PRId64 "} }",
id);
ret = qmp_fd(fixture->fd, cmd);
QDECREF(ret);
g_free(cmd);
}
| true |
qemu
|
1e2713384c58037ad44f716c31c08daca18862c5
|
static void test_qga_file_ops(gconstpointer fix)
{
const TestFixture *fixture = fix;
const unsigned char helloworld[] = "Hello World!\n";
const char *b64;
gchar *cmd, *path, *enc;
unsigned char *dec;
QDict *ret, *val;
int64_t id, eof;
gsize count;
FILE *f;
char tmp[100];
ret = qmp_fd(fixture->fd, "{'execute': 'guest-file-open',"
" 'arguments': { 'path': 'foo', 'mode': 'w+' } }");
g_assert_nonnull(ret);
qmp_assert_no_error(ret);
id = qdict_get_int(ret, "return");
QDECREF(ret);
enc = g_base64_encode(helloworld, sizeof(helloworld));
cmd = g_strdup_printf("{'execute': 'guest-file-write',"
" 'arguments': { 'handle': %" PRId64 ","
" 'buf-b64': '%s' } }", id, enc);
ret = qmp_fd(fixture->fd, cmd);
g_assert_nonnull(ret);
qmp_assert_no_error(ret);
val = qdict_get_qdict(ret, "return");
count = qdict_get_int(val, "count");
eof = qdict_get_bool(val, "eof");
g_assert_cmpint(count, ==, sizeof(helloworld));
g_assert_cmpint(eof, ==, 0);
QDECREF(ret);
g_free(cmd);
cmd = g_strdup_printf("{'execute': 'guest-file-flush',"
" 'arguments': {'handle': %" PRId64 "} }",
id);
ret = qmp_fd(fixture->fd, cmd);
QDECREF(ret);
g_free(cmd);
cmd = g_strdup_printf("{'execute': 'guest-file-close',"
" 'arguments': {'handle': %" PRId64 "} }",
id);
ret = qmp_fd(fixture->fd, cmd);
QDECREF(ret);
g_free(cmd);
path = g_build_filename(fixture->test_dir, "foo", NULL);
f = fopen(path, "r");
g_assert_nonnull(f);
count = fread(tmp, 1, sizeof(tmp), f);
g_assert_cmpint(count, ==, sizeof(helloworld));
tmp[count] = 0;
g_assert_cmpstr(tmp, ==, (char *)helloworld);
fclose(f);
ret = qmp_fd(fixture->fd, "{'execute': 'guest-file-open',"
" 'arguments': { 'path': 'foo', 'mode': 'r' } }");
g_assert_nonnull(ret);
qmp_assert_no_error(ret);
id = qdict_get_int(ret, "return");
QDECREF(ret);
cmd = g_strdup_printf("{'execute': 'guest-file-read',"
" 'arguments': { 'handle': %" PRId64 "} }",
id);
ret = qmp_fd(fixture->fd, cmd);
val = qdict_get_qdict(ret, "return");
count = qdict_get_int(val, "count");
eof = qdict_get_bool(val, "eof");
b64 = qdict_get_str(val, "buf-b64");
g_assert_cmpint(count, ==, sizeof(helloworld));
g_assert(eof);
g_assert_cmpstr(b64, ==, enc);
QDECREF(ret);
g_free(cmd);
g_free(enc);
cmd = g_strdup_printf("{'execute': 'guest-file-read',"
" 'arguments': { 'handle': %" PRId64 "} }",
id);
ret = qmp_fd(fixture->fd, cmd);
val = qdict_get_qdict(ret, "return");
count = qdict_get_int(val, "count");
eof = qdict_get_bool(val, "eof");
b64 = qdict_get_str(val, "buf-b64");
g_assert_cmpint(count, ==, 0);
g_assert(eof);
g_assert_cmpstr(b64, ==, "");
QDECREF(ret);
g_free(cmd);
cmd = g_strdup_printf("{'execute': 'guest-file-seek',"
" 'arguments': { 'handle': %" PRId64 ", "
" 'offset': %d, 'whence': '%s' } }",
id, 6, "set");
ret = qmp_fd(fixture->fd, cmd);
qmp_assert_no_error(ret);
val = qdict_get_qdict(ret, "return");
count = qdict_get_int(val, "position");
eof = qdict_get_bool(val, "eof");
g_assert_cmpint(count, ==, 6);
g_assert(!eof);
QDECREF(ret);
g_free(cmd);
cmd = g_strdup_printf("{'execute': 'guest-file-read',"
" 'arguments': { 'handle': %" PRId64 "} }",
id);
ret = qmp_fd(fixture->fd, cmd);
val = qdict_get_qdict(ret, "return");
count = qdict_get_int(val, "count");
eof = qdict_get_bool(val, "eof");
b64 = qdict_get_str(val, "buf-b64");
g_assert_cmpint(count, ==, sizeof(helloworld) - 6);
g_assert(eof);
dec = g_base64_decode(b64, &count);
g_assert_cmpint(count, ==, sizeof(helloworld) - 6);
g_assert_cmpmem(dec, count, helloworld + 6, sizeof(helloworld) - 6);
g_free(dec);
QDECREF(ret);
g_free(cmd);
cmd = g_strdup_printf("{'execute': 'guest-file-close',"
" 'arguments': {'handle': %" PRId64 "} }",
id);
ret = qmp_fd(fixture->fd, cmd);
QDECREF(ret);
g_free(cmd);
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(gconstpointer VAR_0)
{
const TestFixture *VAR_1 = VAR_0;
const unsigned char VAR_2[] = "Hello World!\n";
const char *VAR_3;
gchar *cmd, *path, *enc;
unsigned char *VAR_4;
QDict *ret, *val;
int64_t id, eof;
gsize count;
FILE *f;
char VAR_5[100];
ret = qmp_fd(VAR_1->fd, "{'execute': 'guest-file-open',"
" 'arguments': { 'path': 'foo', 'mode': 'w+' } }");
g_assert_nonnull(ret);
qmp_assert_no_error(ret);
id = qdict_get_int(ret, "return");
QDECREF(ret);
enc = g_base64_encode(VAR_2, sizeof(VAR_2));
cmd = g_strdup_printf("{'execute': 'guest-file-write',"
" 'arguments': { 'handle': %" PRId64 ","
" 'buf-VAR_3': '%s' } }", id, enc);
ret = qmp_fd(VAR_1->fd, cmd);
g_assert_nonnull(ret);
qmp_assert_no_error(ret);
val = qdict_get_qdict(ret, "return");
count = qdict_get_int(val, "count");
eof = qdict_get_bool(val, "eof");
g_assert_cmpint(count, ==, sizeof(VAR_2));
g_assert_cmpint(eof, ==, 0);
QDECREF(ret);
g_free(cmd);
cmd = g_strdup_printf("{'execute': 'guest-file-flush',"
" 'arguments': {'handle': %" PRId64 "} }",
id);
ret = qmp_fd(VAR_1->fd, cmd);
QDECREF(ret);
g_free(cmd);
cmd = g_strdup_printf("{'execute': 'guest-file-close',"
" 'arguments': {'handle': %" PRId64 "} }",
id);
ret = qmp_fd(VAR_1->fd, cmd);
QDECREF(ret);
g_free(cmd);
path = g_build_filename(VAR_1->test_dir, "foo", NULL);
f = fopen(path, "r");
g_assert_nonnull(f);
count = fread(VAR_5, 1, sizeof(VAR_5), f);
g_assert_cmpint(count, ==, sizeof(VAR_2));
VAR_5[count] = 0;
g_assert_cmpstr(VAR_5, ==, (char *)VAR_2);
fclose(f);
ret = qmp_fd(VAR_1->fd, "{'execute': 'guest-file-open',"
" 'arguments': { 'path': 'foo', 'mode': 'r' } }");
g_assert_nonnull(ret);
qmp_assert_no_error(ret);
id = qdict_get_int(ret, "return");
QDECREF(ret);
cmd = g_strdup_printf("{'execute': 'guest-file-read',"
" 'arguments': { 'handle': %" PRId64 "} }",
id);
ret = qmp_fd(VAR_1->fd, cmd);
val = qdict_get_qdict(ret, "return");
count = qdict_get_int(val, "count");
eof = qdict_get_bool(val, "eof");
VAR_3 = qdict_get_str(val, "buf-VAR_3");
g_assert_cmpint(count, ==, sizeof(VAR_2));
g_assert(eof);
g_assert_cmpstr(VAR_3, ==, enc);
QDECREF(ret);
g_free(cmd);
g_free(enc);
cmd = g_strdup_printf("{'execute': 'guest-file-read',"
" 'arguments': { 'handle': %" PRId64 "} }",
id);
ret = qmp_fd(VAR_1->fd, cmd);
val = qdict_get_qdict(ret, "return");
count = qdict_get_int(val, "count");
eof = qdict_get_bool(val, "eof");
VAR_3 = qdict_get_str(val, "buf-VAR_3");
g_assert_cmpint(count, ==, 0);
g_assert(eof);
g_assert_cmpstr(VAR_3, ==, "");
QDECREF(ret);
g_free(cmd);
cmd = g_strdup_printf("{'execute': 'guest-file-seek',"
" 'arguments': { 'handle': %" PRId64 ", "
" 'offset': %d, 'whence': '%s' } }",
id, 6, "set");
ret = qmp_fd(VAR_1->fd, cmd);
qmp_assert_no_error(ret);
val = qdict_get_qdict(ret, "return");
count = qdict_get_int(val, "position");
eof = qdict_get_bool(val, "eof");
g_assert_cmpint(count, ==, 6);
g_assert(!eof);
QDECREF(ret);
g_free(cmd);
cmd = g_strdup_printf("{'execute': 'guest-file-read',"
" 'arguments': { 'handle': %" PRId64 "} }",
id);
ret = qmp_fd(VAR_1->fd, cmd);
val = qdict_get_qdict(ret, "return");
count = qdict_get_int(val, "count");
eof = qdict_get_bool(val, "eof");
VAR_3 = qdict_get_str(val, "buf-VAR_3");
g_assert_cmpint(count, ==, sizeof(VAR_2) - 6);
g_assert(eof);
VAR_4 = g_base64_decode(VAR_3, &count);
g_assert_cmpint(count, ==, sizeof(VAR_2) - 6);
g_assert_cmpmem(VAR_4, count, VAR_2 + 6, sizeof(VAR_2) - 6);
g_free(VAR_4);
QDECREF(ret);
g_free(cmd);
cmd = g_strdup_printf("{'execute': 'guest-file-close',"
" 'arguments': {'handle': %" PRId64 "} }",
id);
ret = qmp_fd(VAR_1->fd, cmd);
QDECREF(ret);
g_free(cmd);
}
|
[
"static void FUNC_0(gconstpointer VAR_0)\n{",
"const TestFixture *VAR_1 = VAR_0;",
"const unsigned char VAR_2[] = \"Hello World!\\n\";",
"const char *VAR_3;",
"gchar *cmd, *path, *enc;",
"unsigned char *VAR_4;",
"QDict *ret, *val;",
"int64_t id, eof;",
"gsize count;",
"FILE *f;",
"char VAR_5[100];",
"ret = qmp_fd(VAR_1->fd, \"{'execute': 'guest-file-open',\"",
"\" 'arguments': { 'path': 'foo', 'mode': 'w+' } }\");",
"g_assert_nonnull(ret);",
"qmp_assert_no_error(ret);",
"id = qdict_get_int(ret, \"return\");",
"QDECREF(ret);",
"enc = g_base64_encode(VAR_2, sizeof(VAR_2));",
"cmd = g_strdup_printf(\"{'execute': 'guest-file-write',\"",
"\" 'arguments': { 'handle': %\" PRId64 \",\"",
"\" 'buf-VAR_3': '%s' } }\", id, enc);",
"ret = qmp_fd(VAR_1->fd, cmd);",
"g_assert_nonnull(ret);",
"qmp_assert_no_error(ret);",
"val = qdict_get_qdict(ret, \"return\");",
"count = qdict_get_int(val, \"count\");",
"eof = qdict_get_bool(val, \"eof\");",
"g_assert_cmpint(count, ==, sizeof(VAR_2));",
"g_assert_cmpint(eof, ==, 0);",
"QDECREF(ret);",
"g_free(cmd);",
"cmd = g_strdup_printf(\"{'execute': 'guest-file-flush',\"",
"\" 'arguments': {'handle': %\" PRId64 \"} }\",",
"id);",
"ret = qmp_fd(VAR_1->fd, cmd);",
"QDECREF(ret);",
"g_free(cmd);",
"cmd = g_strdup_printf(\"{'execute': 'guest-file-close',\"",
"\" 'arguments': {'handle': %\" PRId64 \"} }\",",
"id);",
"ret = qmp_fd(VAR_1->fd, cmd);",
"QDECREF(ret);",
"g_free(cmd);",
"path = g_build_filename(VAR_1->test_dir, \"foo\", NULL);",
"f = fopen(path, \"r\");",
"g_assert_nonnull(f);",
"count = fread(VAR_5, 1, sizeof(VAR_5), f);",
"g_assert_cmpint(count, ==, sizeof(VAR_2));",
"VAR_5[count] = 0;",
"g_assert_cmpstr(VAR_5, ==, (char *)VAR_2);",
"fclose(f);",
"ret = qmp_fd(VAR_1->fd, \"{'execute': 'guest-file-open',\"",
"\" 'arguments': { 'path': 'foo', 'mode': 'r' } }\");",
"g_assert_nonnull(ret);",
"qmp_assert_no_error(ret);",
"id = qdict_get_int(ret, \"return\");",
"QDECREF(ret);",
"cmd = g_strdup_printf(\"{'execute': 'guest-file-read',\"",
"\" 'arguments': { 'handle': %\" PRId64 \"} }\",",
"id);",
"ret = qmp_fd(VAR_1->fd, cmd);",
"val = qdict_get_qdict(ret, \"return\");",
"count = qdict_get_int(val, \"count\");",
"eof = qdict_get_bool(val, \"eof\");",
"VAR_3 = qdict_get_str(val, \"buf-VAR_3\");",
"g_assert_cmpint(count, ==, sizeof(VAR_2));",
"g_assert(eof);",
"g_assert_cmpstr(VAR_3, ==, enc);",
"QDECREF(ret);",
"g_free(cmd);",
"g_free(enc);",
"cmd = g_strdup_printf(\"{'execute': 'guest-file-read',\"",
"\" 'arguments': { 'handle': %\" PRId64 \"} }\",",
"id);",
"ret = qmp_fd(VAR_1->fd, cmd);",
"val = qdict_get_qdict(ret, \"return\");",
"count = qdict_get_int(val, \"count\");",
"eof = qdict_get_bool(val, \"eof\");",
"VAR_3 = qdict_get_str(val, \"buf-VAR_3\");",
"g_assert_cmpint(count, ==, 0);",
"g_assert(eof);",
"g_assert_cmpstr(VAR_3, ==, \"\");",
"QDECREF(ret);",
"g_free(cmd);",
"cmd = g_strdup_printf(\"{'execute': 'guest-file-seek',\"",
"\" 'arguments': { 'handle': %\" PRId64 \", \"",
"\" 'offset': %d, 'whence': '%s' } }\",",
"id, 6, \"set\");",
"ret = qmp_fd(VAR_1->fd, cmd);",
"qmp_assert_no_error(ret);",
"val = qdict_get_qdict(ret, \"return\");",
"count = qdict_get_int(val, \"position\");",
"eof = qdict_get_bool(val, \"eof\");",
"g_assert_cmpint(count, ==, 6);",
"g_assert(!eof);",
"QDECREF(ret);",
"g_free(cmd);",
"cmd = g_strdup_printf(\"{'execute': 'guest-file-read',\"",
"\" 'arguments': { 'handle': %\" PRId64 \"} }\",",
"id);",
"ret = qmp_fd(VAR_1->fd, cmd);",
"val = qdict_get_qdict(ret, \"return\");",
"count = qdict_get_int(val, \"count\");",
"eof = qdict_get_bool(val, \"eof\");",
"VAR_3 = qdict_get_str(val, \"buf-VAR_3\");",
"g_assert_cmpint(count, ==, sizeof(VAR_2) - 6);",
"g_assert(eof);",
"VAR_4 = g_base64_decode(VAR_3, &count);",
"g_assert_cmpint(count, ==, sizeof(VAR_2) - 6);",
"g_assert_cmpmem(VAR_4, count, VAR_2 + 6, sizeof(VAR_2) - 6);",
"g_free(VAR_4);",
"QDECREF(ret);",
"g_free(cmd);",
"cmd = g_strdup_printf(\"{'execute': 'guest-file-close',\"",
"\" 'arguments': {'handle': %\" PRId64 \"} }\",",
"id);",
"ret = qmp_fd(VAR_1->fd, cmd);",
"QDECREF(ret);",
"g_free(cmd);",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
43
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
111
],
[
113
],
[
116
],
[
118
],
[
120
],
[
122
],
[
124
],
[
126
],
[
132
],
[
134
],
[
136
],
[
138
],
[
140
],
[
142
],
[
148
],
[
150
],
[
152
],
[
154
],
[
156
],
[
158
],
[
160
],
[
162
],
[
164
],
[
166
],
[
168
],
[
172
],
[
174
],
[
176
],
[
182
],
[
184
],
[
186
],
[
188
],
[
190
],
[
192
],
[
194
],
[
196
],
[
198
],
[
200
],
[
202
],
[
204
],
[
206
],
[
212
],
[
214
],
[
216
],
[
218
],
[
220
],
[
222
],
[
224
],
[
226
],
[
228
],
[
230
],
[
232
],
[
234
],
[
236
],
[
242
],
[
244
],
[
246
],
[
248
],
[
250
],
[
252
],
[
254
],
[
256
],
[
258
],
[
260
],
[
262
],
[
264
],
[
266
],
[
268
],
[
272
],
[
274
],
[
280
],
[
282
],
[
284
],
[
286
],
[
288
],
[
290
],
[
292
]
] |
6,441 |
static bool vexpress_cfgctrl_write(arm_sysctl_state *s, unsigned int dcc,
unsigned int function, unsigned int site,
unsigned int position, unsigned int device,
uint32_t val)
{
/* We don't support anything other than DCC 0, board stack position 0
* or sites other than motherboard/daughterboard:
*/
if (dcc != 0 || position != 0 ||
(site != SYS_CFG_SITE_MB && site != SYS_CFG_SITE_DB1)) {
goto cfgctrl_unimp;
}
switch (function) {
case SYS_CFG_OSC:
if (site == SYS_CFG_SITE_MB && device < sizeof(s->mb_clock)) {
/* motherboard clock */
s->mb_clock[device] = val;
return true;
}
if (site == SYS_CFG_SITE_DB1 && device < s->db_num_clocks) {
/* daughterboard clock */
s->db_clock[device] = val;
return true;
}
break;
case SYS_CFG_MUXFPGA:
if (site == SYS_CFG_SITE_MB && device == 0) {
/* Select whether video output comes from motherboard
* or daughterboard: log and ignore as QEMU doesn't
* support this.
*/
qemu_log_mask(LOG_UNIMP, "arm_sysctl: selection of video output "
"not supported, ignoring\n");
return true;
}
break;
case SYS_CFG_SHUTDOWN:
if (site == SYS_CFG_SITE_MB && device == 0) {
qemu_system_shutdown_request();
return true;
}
break;
case SYS_CFG_REBOOT:
if (site == SYS_CFG_SITE_MB && device == 0) {
qemu_system_reset_request();
return true;
}
break;
case SYS_CFG_DVIMODE:
if (site == SYS_CFG_SITE_MB && device == 0) {
/* Selecting DVI mode is meaningless for QEMU: we will
* always display the output correctly according to the
* pixel height/width programmed into the CLCD controller.
*/
return true;
}
default:
break;
}
cfgctrl_unimp:
qemu_log_mask(LOG_UNIMP,
"arm_sysctl: Unimplemented SYS_CFGCTRL write of function "
"0x%x DCC 0x%x site 0x%x position 0x%x device 0x%x\n",
function, dcc, site, position, device);
return false;
}
| true |
qemu
|
ec1efab95767312ff4afb816d0d4b548e093b031
|
static bool vexpress_cfgctrl_write(arm_sysctl_state *s, unsigned int dcc,
unsigned int function, unsigned int site,
unsigned int position, unsigned int device,
uint32_t val)
{
if (dcc != 0 || position != 0 ||
(site != SYS_CFG_SITE_MB && site != SYS_CFG_SITE_DB1)) {
goto cfgctrl_unimp;
}
switch (function) {
case SYS_CFG_OSC:
if (site == SYS_CFG_SITE_MB && device < sizeof(s->mb_clock)) {
s->mb_clock[device] = val;
return true;
}
if (site == SYS_CFG_SITE_DB1 && device < s->db_num_clocks) {
s->db_clock[device] = val;
return true;
}
break;
case SYS_CFG_MUXFPGA:
if (site == SYS_CFG_SITE_MB && device == 0) {
qemu_log_mask(LOG_UNIMP, "arm_sysctl: selection of video output "
"not supported, ignoring\n");
return true;
}
break;
case SYS_CFG_SHUTDOWN:
if (site == SYS_CFG_SITE_MB && device == 0) {
qemu_system_shutdown_request();
return true;
}
break;
case SYS_CFG_REBOOT:
if (site == SYS_CFG_SITE_MB && device == 0) {
qemu_system_reset_request();
return true;
}
break;
case SYS_CFG_DVIMODE:
if (site == SYS_CFG_SITE_MB && device == 0) {
return true;
}
default:
break;
}
cfgctrl_unimp:
qemu_log_mask(LOG_UNIMP,
"arm_sysctl: Unimplemented SYS_CFGCTRL write of function "
"0x%x DCC 0x%x site 0x%x position 0x%x device 0x%x\n",
function, dcc, site, position, device);
return false;
}
|
{
"code": [
" if (site == SYS_CFG_SITE_MB && device < sizeof(s->mb_clock)) {",
" if (site == SYS_CFG_SITE_MB && device < sizeof(s->mb_clock)) {"
],
"line_no": [
31,
31
]
}
|
static bool FUNC_0(arm_sysctl_state *s, unsigned int dcc,
unsigned int function, unsigned int site,
unsigned int position, unsigned int device,
uint32_t val)
{
if (dcc != 0 || position != 0 ||
(site != SYS_CFG_SITE_MB && site != SYS_CFG_SITE_DB1)) {
goto cfgctrl_unimp;
}
switch (function) {
case SYS_CFG_OSC:
if (site == SYS_CFG_SITE_MB && device < sizeof(s->mb_clock)) {
s->mb_clock[device] = val;
return true;
}
if (site == SYS_CFG_SITE_DB1 && device < s->db_num_clocks) {
s->db_clock[device] = val;
return true;
}
break;
case SYS_CFG_MUXFPGA:
if (site == SYS_CFG_SITE_MB && device == 0) {
qemu_log_mask(LOG_UNIMP, "arm_sysctl: selection of video output "
"not supported, ignoring\n");
return true;
}
break;
case SYS_CFG_SHUTDOWN:
if (site == SYS_CFG_SITE_MB && device == 0) {
qemu_system_shutdown_request();
return true;
}
break;
case SYS_CFG_REBOOT:
if (site == SYS_CFG_SITE_MB && device == 0) {
qemu_system_reset_request();
return true;
}
break;
case SYS_CFG_DVIMODE:
if (site == SYS_CFG_SITE_MB && device == 0) {
return true;
}
default:
break;
}
cfgctrl_unimp:
qemu_log_mask(LOG_UNIMP,
"arm_sysctl: Unimplemented SYS_CFGCTRL write of function "
"0x%x DCC 0x%x site 0x%x position 0x%x device 0x%x\n",
function, dcc, site, position, device);
return false;
}
|
[
"static bool FUNC_0(arm_sysctl_state *s, unsigned int dcc,\nunsigned int function, unsigned int site,\nunsigned int position, unsigned int device,\nuint32_t val)\n{",
"if (dcc != 0 || position != 0 ||\n(site != SYS_CFG_SITE_MB && site != SYS_CFG_SITE_DB1)) {",
"goto cfgctrl_unimp;",
"}",
"switch (function) {",
"case SYS_CFG_OSC:\nif (site == SYS_CFG_SITE_MB && device < sizeof(s->mb_clock)) {",
"s->mb_clock[device] = val;",
"return true;",
"}",
"if (site == SYS_CFG_SITE_DB1 && device < s->db_num_clocks) {",
"s->db_clock[device] = val;",
"return true;",
"}",
"break;",
"case SYS_CFG_MUXFPGA:\nif (site == SYS_CFG_SITE_MB && device == 0) {",
"qemu_log_mask(LOG_UNIMP, \"arm_sysctl: selection of video output \"\n\"not supported, ignoring\\n\");",
"return true;",
"}",
"break;",
"case SYS_CFG_SHUTDOWN:\nif (site == SYS_CFG_SITE_MB && device == 0) {",
"qemu_system_shutdown_request();",
"return true;",
"}",
"break;",
"case SYS_CFG_REBOOT:\nif (site == SYS_CFG_SITE_MB && device == 0) {",
"qemu_system_reset_request();",
"return true;",
"}",
"break;",
"case SYS_CFG_DVIMODE:\nif (site == SYS_CFG_SITE_MB && device == 0) {",
"return true;",
"}",
"default:\nbreak;",
"}",
"cfgctrl_unimp:\nqemu_log_mask(LOG_UNIMP,\n\"arm_sysctl: Unimplemented SYS_CFGCTRL write of function \"\n\"0x%x DCC 0x%x site 0x%x position 0x%x device 0x%x\\n\",\nfunction, dcc, site, position, device);",
"return false;",
"}"
] |
[
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
] |
[
[
1,
3,
5,
7,
9
],
[
17,
19
],
[
21
],
[
23
],
[
27
],
[
29,
31
],
[
35
],
[
37
],
[
39
],
[
41
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53,
55
],
[
65,
67
],
[
69
],
[
71
],
[
73
],
[
75,
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87,
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99,
101
],
[
111
],
[
113
],
[
115,
117
],
[
119
],
[
123,
125,
127,
129,
131
],
[
133
],
[
135
]
] |
6,442 |
pci_ebus_init1(PCIDevice *s)
{
isa_bus_new(&s->qdev);
s->config[0x04] = 0x06; // command = bus master, pci mem
s->config[0x05] = 0x00;
s->config[0x06] = 0xa0; // status = fast back-to-back, 66MHz, no error
s->config[0x07] = 0x03; // status = medium devsel
s->config[0x09] = 0x00; // programming i/f
s->config[0x0D] = 0x0a; // latency_timer
pci_register_bar(s, 0, 0x1000000, PCI_BASE_ADDRESS_SPACE_MEMORY,
ebus_mmio_mapfunc);
pci_register_bar(s, 1, 0x800000, PCI_BASE_ADDRESS_SPACE_MEMORY,
ebus_mmio_mapfunc);
return 0;
}
| true |
qemu
|
c5e6fb7e4ac6e7083682e7f45d27d1e73b3a1a97
|
pci_ebus_init1(PCIDevice *s)
{
isa_bus_new(&s->qdev);
s->config[0x04] = 0x06;
s->config[0x05] = 0x00;
s->config[0x06] = 0xa0;
s->config[0x07] = 0x03;
s->config[0x09] = 0x00;
s->config[0x0D] = 0x0a;
pci_register_bar(s, 0, 0x1000000, PCI_BASE_ADDRESS_SPACE_MEMORY,
ebus_mmio_mapfunc);
pci_register_bar(s, 1, 0x800000, PCI_BASE_ADDRESS_SPACE_MEMORY,
ebus_mmio_mapfunc);
return 0;
}
|
{
"code": [
"pci_ebus_init1(PCIDevice *s)",
" isa_bus_new(&s->qdev);",
" s->config[0x05] = 0x00;",
" pci_register_bar(s, 0, 0x1000000, PCI_BASE_ADDRESS_SPACE_MEMORY,",
" ebus_mmio_mapfunc);",
" pci_register_bar(s, 1, 0x800000, PCI_BASE_ADDRESS_SPACE_MEMORY,",
" ebus_mmio_mapfunc);"
],
"line_no": [
1,
5,
11,
23,
25,
27,
25
]
}
|
FUNC_0(PCIDevice *VAR_0)
{
isa_bus_new(&VAR_0->qdev);
VAR_0->config[0x04] = 0x06;
VAR_0->config[0x05] = 0x00;
VAR_0->config[0x06] = 0xa0;
VAR_0->config[0x07] = 0x03;
VAR_0->config[0x09] = 0x00;
VAR_0->config[0x0D] = 0x0a;
pci_register_bar(VAR_0, 0, 0x1000000, PCI_BASE_ADDRESS_SPACE_MEMORY,
ebus_mmio_mapfunc);
pci_register_bar(VAR_0, 1, 0x800000, PCI_BASE_ADDRESS_SPACE_MEMORY,
ebus_mmio_mapfunc);
return 0;
}
|
[
"FUNC_0(PCIDevice *VAR_0)\n{",
"isa_bus_new(&VAR_0->qdev);",
"VAR_0->config[0x04] = 0x06;",
"VAR_0->config[0x05] = 0x00;",
"VAR_0->config[0x06] = 0xa0;",
"VAR_0->config[0x07] = 0x03;",
"VAR_0->config[0x09] = 0x00;",
"VAR_0->config[0x0D] = 0x0a;",
"pci_register_bar(VAR_0, 0, 0x1000000, PCI_BASE_ADDRESS_SPACE_MEMORY,\nebus_mmio_mapfunc);",
"pci_register_bar(VAR_0, 1, 0x800000, PCI_BASE_ADDRESS_SPACE_MEMORY,\nebus_mmio_mapfunc);",
"return 0;",
"}"
] |
[
1,
1,
0,
1,
0,
0,
0,
0,
1,
1,
0,
0
] |
[
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23,
25
],
[
27,
29
],
[
31
],
[
33
]
] |
6,443 |
void ff_jpeg2000_set_significance(Jpeg2000T1Context *t1, int x, int y,
int negative)
{
x++;
y++;
t1->flags[y][x] |= JPEG2000_T1_SIG;
if (negative) {
t1->flags[y][x + 1] |= JPEG2000_T1_SIG_W | JPEG2000_T1_SGN_W;
t1->flags[y][x - 1] |= JPEG2000_T1_SIG_E | JPEG2000_T1_SGN_E;
t1->flags[y + 1][x] |= JPEG2000_T1_SIG_N | JPEG2000_T1_SGN_N;
t1->flags[y - 1][x] |= JPEG2000_T1_SIG_S | JPEG2000_T1_SGN_S;
} else {
t1->flags[y][x + 1] |= JPEG2000_T1_SIG_W;
t1->flags[y][x - 1] |= JPEG2000_T1_SIG_E;
t1->flags[y + 1][x] |= JPEG2000_T1_SIG_N;
t1->flags[y - 1][x] |= JPEG2000_T1_SIG_S;
}
t1->flags[y + 1][x + 1] |= JPEG2000_T1_SIG_NW;
t1->flags[y + 1][x - 1] |= JPEG2000_T1_SIG_NE;
t1->flags[y - 1][x + 1] |= JPEG2000_T1_SIG_SW;
t1->flags[y - 1][x - 1] |= JPEG2000_T1_SIG_SE;
}
| false |
FFmpeg
|
f1e173049ecc9de03817385ba8962d14cba779db
|
void ff_jpeg2000_set_significance(Jpeg2000T1Context *t1, int x, int y,
int negative)
{
x++;
y++;
t1->flags[y][x] |= JPEG2000_T1_SIG;
if (negative) {
t1->flags[y][x + 1] |= JPEG2000_T1_SIG_W | JPEG2000_T1_SGN_W;
t1->flags[y][x - 1] |= JPEG2000_T1_SIG_E | JPEG2000_T1_SGN_E;
t1->flags[y + 1][x] |= JPEG2000_T1_SIG_N | JPEG2000_T1_SGN_N;
t1->flags[y - 1][x] |= JPEG2000_T1_SIG_S | JPEG2000_T1_SGN_S;
} else {
t1->flags[y][x + 1] |= JPEG2000_T1_SIG_W;
t1->flags[y][x - 1] |= JPEG2000_T1_SIG_E;
t1->flags[y + 1][x] |= JPEG2000_T1_SIG_N;
t1->flags[y - 1][x] |= JPEG2000_T1_SIG_S;
}
t1->flags[y + 1][x + 1] |= JPEG2000_T1_SIG_NW;
t1->flags[y + 1][x - 1] |= JPEG2000_T1_SIG_NE;
t1->flags[y - 1][x + 1] |= JPEG2000_T1_SIG_SW;
t1->flags[y - 1][x - 1] |= JPEG2000_T1_SIG_SE;
}
|
{
"code": [],
"line_no": []
}
|
void FUNC_0(Jpeg2000T1Context *VAR_0, int VAR_1, int VAR_2,
int VAR_3)
{
VAR_1++;
VAR_2++;
VAR_0->flags[VAR_2][VAR_1] |= JPEG2000_T1_SIG;
if (VAR_3) {
VAR_0->flags[VAR_2][VAR_1 + 1] |= JPEG2000_T1_SIG_W | JPEG2000_T1_SGN_W;
VAR_0->flags[VAR_2][VAR_1 - 1] |= JPEG2000_T1_SIG_E | JPEG2000_T1_SGN_E;
VAR_0->flags[VAR_2 + 1][VAR_1] |= JPEG2000_T1_SIG_N | JPEG2000_T1_SGN_N;
VAR_0->flags[VAR_2 - 1][VAR_1] |= JPEG2000_T1_SIG_S | JPEG2000_T1_SGN_S;
} else {
VAR_0->flags[VAR_2][VAR_1 + 1] |= JPEG2000_T1_SIG_W;
VAR_0->flags[VAR_2][VAR_1 - 1] |= JPEG2000_T1_SIG_E;
VAR_0->flags[VAR_2 + 1][VAR_1] |= JPEG2000_T1_SIG_N;
VAR_0->flags[VAR_2 - 1][VAR_1] |= JPEG2000_T1_SIG_S;
}
VAR_0->flags[VAR_2 + 1][VAR_1 + 1] |= JPEG2000_T1_SIG_NW;
VAR_0->flags[VAR_2 + 1][VAR_1 - 1] |= JPEG2000_T1_SIG_NE;
VAR_0->flags[VAR_2 - 1][VAR_1 + 1] |= JPEG2000_T1_SIG_SW;
VAR_0->flags[VAR_2 - 1][VAR_1 - 1] |= JPEG2000_T1_SIG_SE;
}
|
[
"void FUNC_0(Jpeg2000T1Context *VAR_0, int VAR_1, int VAR_2,\nint VAR_3)\n{",
"VAR_1++;",
"VAR_2++;",
"VAR_0->flags[VAR_2][VAR_1] |= JPEG2000_T1_SIG;",
"if (VAR_3) {",
"VAR_0->flags[VAR_2][VAR_1 + 1] |= JPEG2000_T1_SIG_W | JPEG2000_T1_SGN_W;",
"VAR_0->flags[VAR_2][VAR_1 - 1] |= JPEG2000_T1_SIG_E | JPEG2000_T1_SGN_E;",
"VAR_0->flags[VAR_2 + 1][VAR_1] |= JPEG2000_T1_SIG_N | JPEG2000_T1_SGN_N;",
"VAR_0->flags[VAR_2 - 1][VAR_1] |= JPEG2000_T1_SIG_S | JPEG2000_T1_SGN_S;",
"} else {",
"VAR_0->flags[VAR_2][VAR_1 + 1] |= JPEG2000_T1_SIG_W;",
"VAR_0->flags[VAR_2][VAR_1 - 1] |= JPEG2000_T1_SIG_E;",
"VAR_0->flags[VAR_2 + 1][VAR_1] |= JPEG2000_T1_SIG_N;",
"VAR_0->flags[VAR_2 - 1][VAR_1] |= JPEG2000_T1_SIG_S;",
"}",
"VAR_0->flags[VAR_2 + 1][VAR_1 + 1] |= JPEG2000_T1_SIG_NW;",
"VAR_0->flags[VAR_2 + 1][VAR_1 - 1] |= JPEG2000_T1_SIG_NE;",
"VAR_0->flags[VAR_2 - 1][VAR_1 + 1] |= JPEG2000_T1_SIG_SW;",
"VAR_0->flags[VAR_2 - 1][VAR_1 - 1] |= JPEG2000_T1_SIG_SE;",
"}"
] |
[
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
]
] |
6,444 |
static int print_uint32(DeviceState *dev, Property *prop, char *dest, size_t len)
{
uint32_t *ptr = qdev_get_prop_ptr(dev, prop);
return snprintf(dest, len, "%" PRIu32, *ptr);
}
| true |
qemu
|
5cb9b56acfc0b50acf7ccd2d044ab4991c47fdde
|
static int print_uint32(DeviceState *dev, Property *prop, char *dest, size_t len)
{
uint32_t *ptr = qdev_get_prop_ptr(dev, prop);
return snprintf(dest, len, "%" PRIu32, *ptr);
}
|
{
"code": [
" uint32_t *ptr = qdev_get_prop_ptr(dev, prop);",
"static int print_uint32(DeviceState *dev, Property *prop, char *dest, size_t len)",
" uint32_t *ptr = qdev_get_prop_ptr(dev, prop);",
" return snprintf(dest, len, \"%\" PRIu32, *ptr);"
],
"line_no": [
5,
1,
5,
7
]
}
|
static int FUNC_0(DeviceState *VAR_0, Property *VAR_1, char *VAR_2, size_t VAR_3)
{
uint32_t *ptr = qdev_get_prop_ptr(VAR_0, VAR_1);
return snprintf(VAR_2, VAR_3, "%" PRIu32, *ptr);
}
|
[
"static int FUNC_0(DeviceState *VAR_0, Property *VAR_1, char *VAR_2, size_t VAR_3)\n{",
"uint32_t *ptr = qdev_get_prop_ptr(VAR_0, VAR_1);",
"return snprintf(VAR_2, VAR_3, \"%\" PRIu32, *ptr);",
"}"
] |
[
1,
1,
1,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
]
] |
6,446 |
static inline int pic_is_unused(H264Context *h, Picture *pic)
{
if (pic->f.data[0] == NULL)
return 1;
if (pic->needs_realloc && !(pic->reference & DELAYED_PIC_REF))
return 1;
return 0;
}
| false |
FFmpeg
|
a553c6a347d3d28d7ee44c3df3d5c4ee780dba23
|
static inline int pic_is_unused(H264Context *h, Picture *pic)
{
if (pic->f.data[0] == NULL)
return 1;
if (pic->needs_realloc && !(pic->reference & DELAYED_PIC_REF))
return 1;
return 0;
}
|
{
"code": [],
"line_no": []
}
|
static inline int FUNC_0(H264Context *VAR_0, Picture *VAR_1)
{
if (VAR_1->f.data[0] == NULL)
return 1;
if (VAR_1->needs_realloc && !(VAR_1->reference & DELAYED_PIC_REF))
return 1;
return 0;
}
|
[
"static inline int FUNC_0(H264Context *VAR_0, Picture *VAR_1)\n{",
"if (VAR_1->f.data[0] == NULL)\nreturn 1;",
"if (VAR_1->needs_realloc && !(VAR_1->reference & DELAYED_PIC_REF))\nreturn 1;",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5,
7
],
[
9,
11
],
[
13
],
[
15
]
] |
6,447 |
static int vdpau_alloc(AVCodecContext *s)
{
InputStream *ist = s->opaque;
int loglevel = (ist->hwaccel_id == HWACCEL_AUTO) ? AV_LOG_VERBOSE : AV_LOG_ERROR;
AVVDPAUContext *vdpau_ctx;
VDPAUContext *ctx;
const char *display, *vendor;
VdpStatus err;
int i;
ctx = av_mallocz(sizeof(*ctx));
if (!ctx)
return AVERROR(ENOMEM);
ist->hwaccel_ctx = ctx;
ist->hwaccel_uninit = vdpau_uninit;
ist->hwaccel_get_buffer = vdpau_get_buffer;
ist->hwaccel_retrieve_data = vdpau_retrieve_data;
ctx->tmp_frame = av_frame_alloc();
if (!ctx->tmp_frame)
goto fail;
ctx->dpy = XOpenDisplay(ist->hwaccel_device);
if (!ctx->dpy) {
av_log(NULL, loglevel, "Cannot open the X11 display %s.\n",
XDisplayName(ist->hwaccel_device));
goto fail;
}
display = XDisplayString(ctx->dpy);
err = vdp_device_create_x11(ctx->dpy, XDefaultScreen(ctx->dpy), &ctx->device,
&ctx->get_proc_address);
if (err != VDP_STATUS_OK) {
av_log(NULL, loglevel, "VDPAU device creation on X11 display %s failed.\n",
display);
goto fail;
}
#define GET_CALLBACK(id, result) \
do { \
void *tmp; \
err = ctx->get_proc_address(ctx->device, id, &tmp); \
if (err != VDP_STATUS_OK) { \
av_log(NULL, loglevel, "Error getting the " #id " callback.\n"); \
goto fail; \
} \
ctx->result = tmp; \
} while (0)
GET_CALLBACK(VDP_FUNC_ID_GET_ERROR_STRING, get_error_string);
GET_CALLBACK(VDP_FUNC_ID_GET_INFORMATION_STRING, get_information_string);
GET_CALLBACK(VDP_FUNC_ID_DEVICE_DESTROY, device_destroy);
if (vdpau_api_ver == 1) {
GET_CALLBACK(VDP_FUNC_ID_DECODER_CREATE, decoder_create);
GET_CALLBACK(VDP_FUNC_ID_DECODER_DESTROY, decoder_destroy);
GET_CALLBACK(VDP_FUNC_ID_DECODER_RENDER, decoder_render);
}
GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_CREATE, video_surface_create);
GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_DESTROY, video_surface_destroy);
GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_GET_BITS_Y_CB_CR, video_surface_get_bits);
GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_GET_PARAMETERS, video_surface_get_parameters);
GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_QUERY_GET_PUT_BITS_Y_CB_CR_CAPABILITIES,
video_surface_query);
for (i = 0; i < FF_ARRAY_ELEMS(vdpau_formats); i++) {
VdpBool supported;
err = ctx->video_surface_query(ctx->device, VDP_CHROMA_TYPE_420,
vdpau_formats[i][0], &supported);
if (err != VDP_STATUS_OK) {
av_log(NULL, loglevel,
"Error querying VDPAU surface capabilities: %s\n",
ctx->get_error_string(err));
goto fail;
}
if (supported)
break;
}
if (i == FF_ARRAY_ELEMS(vdpau_formats)) {
av_log(NULL, loglevel,
"No supported VDPAU format for retrieving the data.\n");
return AVERROR(EINVAL);
}
ctx->vdpau_format = vdpau_formats[i][0];
ctx->pix_fmt = vdpau_formats[i][1];
if (vdpau_api_ver == 1) {
vdpau_ctx = av_vdpau_alloc_context();
if (!vdpau_ctx)
goto fail;
vdpau_ctx->render = ctx->decoder_render;
s->hwaccel_context = vdpau_ctx;
} else
if (av_vdpau_bind_context(s, ctx->device, ctx->get_proc_address, 0))
goto fail;
ctx->get_information_string(&vendor);
av_log(NULL, AV_LOG_VERBOSE, "Using VDPAU -- %s -- on X11 display %s, "
"to decode input stream #%d:%d.\n", vendor,
display, ist->file_index, ist->st->index);
return 0;
fail:
av_log(NULL, loglevel, "VDPAU init failed for stream #%d:%d.\n",
ist->file_index, ist->st->index);
vdpau_uninit(s);
return AVERROR(EINVAL);
}
| false |
FFmpeg
|
d3eb317b862c3f5653f0ae8dfcb22edf1713ab5b
|
static int vdpau_alloc(AVCodecContext *s)
{
InputStream *ist = s->opaque;
int loglevel = (ist->hwaccel_id == HWACCEL_AUTO) ? AV_LOG_VERBOSE : AV_LOG_ERROR;
AVVDPAUContext *vdpau_ctx;
VDPAUContext *ctx;
const char *display, *vendor;
VdpStatus err;
int i;
ctx = av_mallocz(sizeof(*ctx));
if (!ctx)
return AVERROR(ENOMEM);
ist->hwaccel_ctx = ctx;
ist->hwaccel_uninit = vdpau_uninit;
ist->hwaccel_get_buffer = vdpau_get_buffer;
ist->hwaccel_retrieve_data = vdpau_retrieve_data;
ctx->tmp_frame = av_frame_alloc();
if (!ctx->tmp_frame)
goto fail;
ctx->dpy = XOpenDisplay(ist->hwaccel_device);
if (!ctx->dpy) {
av_log(NULL, loglevel, "Cannot open the X11 display %s.\n",
XDisplayName(ist->hwaccel_device));
goto fail;
}
display = XDisplayString(ctx->dpy);
err = vdp_device_create_x11(ctx->dpy, XDefaultScreen(ctx->dpy), &ctx->device,
&ctx->get_proc_address);
if (err != VDP_STATUS_OK) {
av_log(NULL, loglevel, "VDPAU device creation on X11 display %s failed.\n",
display);
goto fail;
}
#define GET_CALLBACK(id, result) \
do { \
void *tmp; \
err = ctx->get_proc_address(ctx->device, id, &tmp); \
if (err != VDP_STATUS_OK) { \
av_log(NULL, loglevel, "Error getting the " #id " callback.\n"); \
goto fail; \
} \
ctx->result = tmp; \
} while (0)
GET_CALLBACK(VDP_FUNC_ID_GET_ERROR_STRING, get_error_string);
GET_CALLBACK(VDP_FUNC_ID_GET_INFORMATION_STRING, get_information_string);
GET_CALLBACK(VDP_FUNC_ID_DEVICE_DESTROY, device_destroy);
if (vdpau_api_ver == 1) {
GET_CALLBACK(VDP_FUNC_ID_DECODER_CREATE, decoder_create);
GET_CALLBACK(VDP_FUNC_ID_DECODER_DESTROY, decoder_destroy);
GET_CALLBACK(VDP_FUNC_ID_DECODER_RENDER, decoder_render);
}
GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_CREATE, video_surface_create);
GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_DESTROY, video_surface_destroy);
GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_GET_BITS_Y_CB_CR, video_surface_get_bits);
GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_GET_PARAMETERS, video_surface_get_parameters);
GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_QUERY_GET_PUT_BITS_Y_CB_CR_CAPABILITIES,
video_surface_query);
for (i = 0; i < FF_ARRAY_ELEMS(vdpau_formats); i++) {
VdpBool supported;
err = ctx->video_surface_query(ctx->device, VDP_CHROMA_TYPE_420,
vdpau_formats[i][0], &supported);
if (err != VDP_STATUS_OK) {
av_log(NULL, loglevel,
"Error querying VDPAU surface capabilities: %s\n",
ctx->get_error_string(err));
goto fail;
}
if (supported)
break;
}
if (i == FF_ARRAY_ELEMS(vdpau_formats)) {
av_log(NULL, loglevel,
"No supported VDPAU format for retrieving the data.\n");
return AVERROR(EINVAL);
}
ctx->vdpau_format = vdpau_formats[i][0];
ctx->pix_fmt = vdpau_formats[i][1];
if (vdpau_api_ver == 1) {
vdpau_ctx = av_vdpau_alloc_context();
if (!vdpau_ctx)
goto fail;
vdpau_ctx->render = ctx->decoder_render;
s->hwaccel_context = vdpau_ctx;
} else
if (av_vdpau_bind_context(s, ctx->device, ctx->get_proc_address, 0))
goto fail;
ctx->get_information_string(&vendor);
av_log(NULL, AV_LOG_VERBOSE, "Using VDPAU -- %s -- on X11 display %s, "
"to decode input stream #%d:%d.\n", vendor,
display, ist->file_index, ist->st->index);
return 0;
fail:
av_log(NULL, loglevel, "VDPAU init failed for stream #%d:%d.\n",
ist->file_index, ist->st->index);
vdpau_uninit(s);
return AVERROR(EINVAL);
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(AVCodecContext *VAR_0)
{
InputStream *ist = VAR_0->opaque;
int VAR_1 = (ist->hwaccel_id == HWACCEL_AUTO) ? AV_LOG_VERBOSE : AV_LOG_ERROR;
AVVDPAUContext *vdpau_ctx;
VDPAUContext *ctx;
const char *VAR_2, *VAR_3;
VdpStatus err;
int VAR_4;
ctx = av_mallocz(sizeof(*ctx));
if (!ctx)
return AVERROR(ENOMEM);
ist->hwaccel_ctx = ctx;
ist->hwaccel_uninit = vdpau_uninit;
ist->hwaccel_get_buffer = vdpau_get_buffer;
ist->hwaccel_retrieve_data = vdpau_retrieve_data;
ctx->tmp_frame = av_frame_alloc();
if (!ctx->tmp_frame)
goto fail;
ctx->dpy = XOpenDisplay(ist->hwaccel_device);
if (!ctx->dpy) {
av_log(NULL, VAR_1, "Cannot open the X11 VAR_2 %VAR_0.\n",
XDisplayName(ist->hwaccel_device));
goto fail;
}
VAR_2 = XDisplayString(ctx->dpy);
err = vdp_device_create_x11(ctx->dpy, XDefaultScreen(ctx->dpy), &ctx->device,
&ctx->get_proc_address);
if (err != VDP_STATUS_OK) {
av_log(NULL, VAR_1, "VDPAU device creation on X11 VAR_2 %VAR_0 failed.\n",
VAR_2);
goto fail;
}
#define GET_CALLBACK(id, result) \
do { \
void *VAR_5; \
err = ctx->get_proc_address(ctx->device, id, &VAR_5); \
if (err != VDP_STATUS_OK) { \
av_log(NULL, VAR_1, "Error getting the " #id " callback.\n"); \
goto fail; \
} \
ctx->result = VAR_5; \
} while (0)
GET_CALLBACK(VDP_FUNC_ID_GET_ERROR_STRING, get_error_string);
GET_CALLBACK(VDP_FUNC_ID_GET_INFORMATION_STRING, get_information_string);
GET_CALLBACK(VDP_FUNC_ID_DEVICE_DESTROY, device_destroy);
if (vdpau_api_ver == 1) {
GET_CALLBACK(VDP_FUNC_ID_DECODER_CREATE, decoder_create);
GET_CALLBACK(VDP_FUNC_ID_DECODER_DESTROY, decoder_destroy);
GET_CALLBACK(VDP_FUNC_ID_DECODER_RENDER, decoder_render);
}
GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_CREATE, video_surface_create);
GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_DESTROY, video_surface_destroy);
GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_GET_BITS_Y_CB_CR, video_surface_get_bits);
GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_GET_PARAMETERS, video_surface_get_parameters);
GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_QUERY_GET_PUT_BITS_Y_CB_CR_CAPABILITIES,
video_surface_query);
for (VAR_4 = 0; VAR_4 < FF_ARRAY_ELEMS(vdpau_formats); VAR_4++) {
VdpBool supported;
err = ctx->video_surface_query(ctx->device, VDP_CHROMA_TYPE_420,
vdpau_formats[VAR_4][0], &supported);
if (err != VDP_STATUS_OK) {
av_log(NULL, VAR_1,
"Error querying VDPAU surface capabilities: %VAR_0\n",
ctx->get_error_string(err));
goto fail;
}
if (supported)
break;
}
if (VAR_4 == FF_ARRAY_ELEMS(vdpau_formats)) {
av_log(NULL, VAR_1,
"No supported VDPAU format for retrieving the data.\n");
return AVERROR(EINVAL);
}
ctx->vdpau_format = vdpau_formats[VAR_4][0];
ctx->pix_fmt = vdpau_formats[VAR_4][1];
if (vdpau_api_ver == 1) {
vdpau_ctx = av_vdpau_alloc_context();
if (!vdpau_ctx)
goto fail;
vdpau_ctx->render = ctx->decoder_render;
VAR_0->hwaccel_context = vdpau_ctx;
} else
if (av_vdpau_bind_context(VAR_0, ctx->device, ctx->get_proc_address, 0))
goto fail;
ctx->get_information_string(&VAR_3);
av_log(NULL, AV_LOG_VERBOSE, "Using VDPAU -- %VAR_0 -- on X11 VAR_2 %VAR_0, "
"to decode input stream #%d:%d.\n", VAR_3,
VAR_2, ist->file_index, ist->st->index);
return 0;
fail:
av_log(NULL, VAR_1, "VDPAU init failed for stream #%d:%d.\n",
ist->file_index, ist->st->index);
vdpau_uninit(VAR_0);
return AVERROR(EINVAL);
}
|
[
"static int FUNC_0(AVCodecContext *VAR_0)\n{",
"InputStream *ist = VAR_0->opaque;",
"int VAR_1 = (ist->hwaccel_id == HWACCEL_AUTO) ? AV_LOG_VERBOSE : AV_LOG_ERROR;",
"AVVDPAUContext *vdpau_ctx;",
"VDPAUContext *ctx;",
"const char *VAR_2, *VAR_3;",
"VdpStatus err;",
"int VAR_4;",
"ctx = av_mallocz(sizeof(*ctx));",
"if (!ctx)\nreturn AVERROR(ENOMEM);",
"ist->hwaccel_ctx = ctx;",
"ist->hwaccel_uninit = vdpau_uninit;",
"ist->hwaccel_get_buffer = vdpau_get_buffer;",
"ist->hwaccel_retrieve_data = vdpau_retrieve_data;",
"ctx->tmp_frame = av_frame_alloc();",
"if (!ctx->tmp_frame)\ngoto fail;",
"ctx->dpy = XOpenDisplay(ist->hwaccel_device);",
"if (!ctx->dpy) {",
"av_log(NULL, VAR_1, \"Cannot open the X11 VAR_2 %VAR_0.\\n\",\nXDisplayName(ist->hwaccel_device));",
"goto fail;",
"}",
"VAR_2 = XDisplayString(ctx->dpy);",
"err = vdp_device_create_x11(ctx->dpy, XDefaultScreen(ctx->dpy), &ctx->device,\n&ctx->get_proc_address);",
"if (err != VDP_STATUS_OK) {",
"av_log(NULL, VAR_1, \"VDPAU device creation on X11 VAR_2 %VAR_0 failed.\\n\",\nVAR_2);",
"goto fail;",
"}",
"#define GET_CALLBACK(id, result) \\\ndo { \\",
"void *VAR_5; \\",
"err = ctx->get_proc_address(ctx->device, id, &VAR_5); \\",
"if (err != VDP_STATUS_OK) { \\",
"av_log(NULL, VAR_1, \"Error getting the \" #id \" callback.\\n\"); \\",
"goto fail; \\",
"} \\",
"ctx->result = VAR_5; \\",
"} while (0)",
"GET_CALLBACK(VDP_FUNC_ID_GET_ERROR_STRING, get_error_string);",
"GET_CALLBACK(VDP_FUNC_ID_GET_INFORMATION_STRING, get_information_string);",
"GET_CALLBACK(VDP_FUNC_ID_DEVICE_DESTROY, device_destroy);",
"if (vdpau_api_ver == 1) {",
"GET_CALLBACK(VDP_FUNC_ID_DECODER_CREATE, decoder_create);",
"GET_CALLBACK(VDP_FUNC_ID_DECODER_DESTROY, decoder_destroy);",
"GET_CALLBACK(VDP_FUNC_ID_DECODER_RENDER, decoder_render);",
"}",
"GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_CREATE, video_surface_create);",
"GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_DESTROY, video_surface_destroy);",
"GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_GET_BITS_Y_CB_CR, video_surface_get_bits);",
"GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_GET_PARAMETERS, video_surface_get_parameters);",
"GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_QUERY_GET_PUT_BITS_Y_CB_CR_CAPABILITIES,\nvideo_surface_query);",
"for (VAR_4 = 0; VAR_4 < FF_ARRAY_ELEMS(vdpau_formats); VAR_4++) {",
"VdpBool supported;",
"err = ctx->video_surface_query(ctx->device, VDP_CHROMA_TYPE_420,\nvdpau_formats[VAR_4][0], &supported);",
"if (err != VDP_STATUS_OK) {",
"av_log(NULL, VAR_1,\n\"Error querying VDPAU surface capabilities: %VAR_0\\n\",\nctx->get_error_string(err));",
"goto fail;",
"}",
"if (supported)\nbreak;",
"}",
"if (VAR_4 == FF_ARRAY_ELEMS(vdpau_formats)) {",
"av_log(NULL, VAR_1,\n\"No supported VDPAU format for retrieving the data.\\n\");",
"return AVERROR(EINVAL);",
"}",
"ctx->vdpau_format = vdpau_formats[VAR_4][0];",
"ctx->pix_fmt = vdpau_formats[VAR_4][1];",
"if (vdpau_api_ver == 1) {",
"vdpau_ctx = av_vdpau_alloc_context();",
"if (!vdpau_ctx)\ngoto fail;",
"vdpau_ctx->render = ctx->decoder_render;",
"VAR_0->hwaccel_context = vdpau_ctx;",
"} else",
"if (av_vdpau_bind_context(VAR_0, ctx->device, ctx->get_proc_address, 0))\ngoto fail;",
"ctx->get_information_string(&VAR_3);",
"av_log(NULL, AV_LOG_VERBOSE, \"Using VDPAU -- %VAR_0 -- on X11 VAR_2 %VAR_0, \"\n\"to decode input stream #%d:%d.\\n\", VAR_3,\nVAR_2, ist->file_index, ist->st->index);",
"return 0;",
"fail:\nav_log(NULL, VAR_1, \"VDPAU init failed for stream #%d:%d.\\n\",\nist->file_index, ist->st->index);",
"vdpau_uninit(VAR_0);",
"return AVERROR(EINVAL);",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
29
],
[
31
],
[
33
],
[
35
],
[
39
],
[
41,
43
],
[
47
],
[
49
],
[
51,
53
],
[
55
],
[
57
],
[
59
],
[
63,
65
],
[
67
],
[
69,
71
],
[
73
],
[
75
],
[
79,
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125,
127
],
[
131
],
[
133
],
[
135,
137
],
[
139
],
[
141,
143,
145
],
[
147
],
[
149
],
[
151,
153
],
[
155
],
[
157
],
[
159,
161
],
[
163
],
[
165
],
[
167
],
[
169
],
[
173
],
[
175
],
[
177,
179
],
[
181
],
[
185
],
[
187
],
[
189,
191
],
[
195
],
[
197,
199,
201
],
[
205
],
[
209,
211,
213
],
[
215
],
[
217
],
[
219
]
] |
6,448 |
void ff_h263_encode_mb(MpegEncContext * s,
int16_t block[6][64],
int motion_x, int motion_y)
{
int cbpc, cbpy, i, cbp, pred_x, pred_y;
int16_t pred_dc;
int16_t rec_intradc[6];
int16_t *dc_ptr[6];
const int interleaved_stats= (s->flags&CODEC_FLAG_PASS1);
if (!s->mb_intra) {
/* compute cbp */
cbp= get_p_cbp(s, block, motion_x, motion_y);
if ((cbp | motion_x | motion_y | s->dquant | (s->mv_type - MV_TYPE_16X16)) == 0) {
/* skip macroblock */
put_bits(&s->pb, 1, 1);
if(interleaved_stats){
s->misc_bits++;
s->last_bits++;
}
s->skip_count++;
return;
}
put_bits(&s->pb, 1, 0); /* mb coded */
cbpc = cbp & 3;
cbpy = cbp >> 2;
if(s->alt_inter_vlc==0 || cbpc!=3)
cbpy ^= 0xF;
if(s->dquant) cbpc+= 8;
if(s->mv_type==MV_TYPE_16X16){
put_bits(&s->pb,
ff_h263_inter_MCBPC_bits[cbpc],
ff_h263_inter_MCBPC_code[cbpc]);
put_bits(&s->pb, ff_h263_cbpy_tab[cbpy][1], ff_h263_cbpy_tab[cbpy][0]);
if(s->dquant)
put_bits(&s->pb, 2, dquant_code[s->dquant+2]);
if(interleaved_stats){
s->misc_bits+= get_bits_diff(s);
}
/* motion vectors: 16x16 mode */
ff_h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
if (!s->umvplus) {
ff_h263_encode_motion_vector(s, motion_x - pred_x,
motion_y - pred_y, 1);
}
else {
h263p_encode_umotion(s, motion_x - pred_x);
h263p_encode_umotion(s, motion_y - pred_y);
if (((motion_x - pred_x) == 1) && ((motion_y - pred_y) == 1))
/* To prevent Start Code emulation */
put_bits(&s->pb,1,1);
}
}else{
put_bits(&s->pb,
ff_h263_inter_MCBPC_bits[cbpc+16],
ff_h263_inter_MCBPC_code[cbpc+16]);
put_bits(&s->pb, ff_h263_cbpy_tab[cbpy][1], ff_h263_cbpy_tab[cbpy][0]);
if(s->dquant)
put_bits(&s->pb, 2, dquant_code[s->dquant+2]);
if(interleaved_stats){
s->misc_bits+= get_bits_diff(s);
}
for(i=0; i<4; i++){
/* motion vectors: 8x8 mode*/
ff_h263_pred_motion(s, i, 0, &pred_x, &pred_y);
motion_x = s->current_picture.motion_val[0][s->block_index[i]][0];
motion_y = s->current_picture.motion_val[0][s->block_index[i]][1];
if (!s->umvplus) {
ff_h263_encode_motion_vector(s, motion_x - pred_x,
motion_y - pred_y, 1);
}
else {
h263p_encode_umotion(s, motion_x - pred_x);
h263p_encode_umotion(s, motion_y - pred_y);
if (((motion_x - pred_x) == 1) && ((motion_y - pred_y) == 1))
/* To prevent Start Code emulation */
put_bits(&s->pb,1,1);
}
}
}
if(interleaved_stats){
s->mv_bits+= get_bits_diff(s);
}
} else {
assert(s->mb_intra);
cbp = 0;
if (s->h263_aic) {
/* Predict DC */
for(i=0; i<6; i++) {
int16_t level = block[i][0];
int scale;
if(i<4) scale= s->y_dc_scale;
else scale= s->c_dc_scale;
pred_dc = ff_h263_pred_dc(s, i, &dc_ptr[i]);
level -= pred_dc;
/* Quant */
if (level >= 0)
level = (level + (scale>>1))/scale;
else
level = (level - (scale>>1))/scale;
/* AIC can change CBP */
if (level == 0 && s->block_last_index[i] == 0)
s->block_last_index[i] = -1;
if(!s->modified_quant){
if (level < -127)
level = -127;
else if (level > 127)
level = 127;
}
block[i][0] = level;
/* Reconstruction */
rec_intradc[i] = scale*level + pred_dc;
/* Oddify */
rec_intradc[i] |= 1;
//if ((rec_intradc[i] % 2) == 0)
// rec_intradc[i]++;
/* Clipping */
if (rec_intradc[i] < 0)
rec_intradc[i] = 0;
else if (rec_intradc[i] > 2047)
rec_intradc[i] = 2047;
/* Update AC/DC tables */
*dc_ptr[i] = rec_intradc[i];
if (s->block_last_index[i] >= 0)
cbp |= 1 << (5 - i);
}
}else{
for(i=0; i<6; i++) {
/* compute cbp */
if (s->block_last_index[i] >= 1)
cbp |= 1 << (5 - i);
}
}
cbpc = cbp & 3;
if (s->pict_type == AV_PICTURE_TYPE_I) {
if(s->dquant) cbpc+=4;
put_bits(&s->pb,
ff_h263_intra_MCBPC_bits[cbpc],
ff_h263_intra_MCBPC_code[cbpc]);
} else {
if(s->dquant) cbpc+=8;
put_bits(&s->pb, 1, 0); /* mb coded */
put_bits(&s->pb,
ff_h263_inter_MCBPC_bits[cbpc + 4],
ff_h263_inter_MCBPC_code[cbpc + 4]);
}
if (s->h263_aic) {
/* XXX: currently, we do not try to use ac prediction */
put_bits(&s->pb, 1, 0); /* no AC prediction */
}
cbpy = cbp >> 2;
put_bits(&s->pb, ff_h263_cbpy_tab[cbpy][1], ff_h263_cbpy_tab[cbpy][0]);
if(s->dquant)
put_bits(&s->pb, 2, dquant_code[s->dquant+2]);
if(interleaved_stats){
s->misc_bits+= get_bits_diff(s);
}
}
for(i=0; i<6; i++) {
/* encode each block */
h263_encode_block(s, block[i], i);
/* Update INTRADC for decoding */
if (s->h263_aic && s->mb_intra) {
block[i][0] = rec_intradc[i];
}
}
if(interleaved_stats){
if (!s->mb_intra) {
s->p_tex_bits+= get_bits_diff(s);
s->f_count++;
}else{
s->i_tex_bits+= get_bits_diff(s);
s->i_count++;
}
}
}
| false |
FFmpeg
|
cd62c04d009b3baf7582556866a7029291b54573
|
void ff_h263_encode_mb(MpegEncContext * s,
int16_t block[6][64],
int motion_x, int motion_y)
{
int cbpc, cbpy, i, cbp, pred_x, pred_y;
int16_t pred_dc;
int16_t rec_intradc[6];
int16_t *dc_ptr[6];
const int interleaved_stats= (s->flags&CODEC_FLAG_PASS1);
if (!s->mb_intra) {
cbp= get_p_cbp(s, block, motion_x, motion_y);
if ((cbp | motion_x | motion_y | s->dquant | (s->mv_type - MV_TYPE_16X16)) == 0) {
put_bits(&s->pb, 1, 1);
if(interleaved_stats){
s->misc_bits++;
s->last_bits++;
}
s->skip_count++;
return;
}
put_bits(&s->pb, 1, 0);
cbpc = cbp & 3;
cbpy = cbp >> 2;
if(s->alt_inter_vlc==0 || cbpc!=3)
cbpy ^= 0xF;
if(s->dquant) cbpc+= 8;
if(s->mv_type==MV_TYPE_16X16){
put_bits(&s->pb,
ff_h263_inter_MCBPC_bits[cbpc],
ff_h263_inter_MCBPC_code[cbpc]);
put_bits(&s->pb, ff_h263_cbpy_tab[cbpy][1], ff_h263_cbpy_tab[cbpy][0]);
if(s->dquant)
put_bits(&s->pb, 2, dquant_code[s->dquant+2]);
if(interleaved_stats){
s->misc_bits+= get_bits_diff(s);
}
ff_h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
if (!s->umvplus) {
ff_h263_encode_motion_vector(s, motion_x - pred_x,
motion_y - pred_y, 1);
}
else {
h263p_encode_umotion(s, motion_x - pred_x);
h263p_encode_umotion(s, motion_y - pred_y);
if (((motion_x - pred_x) == 1) && ((motion_y - pred_y) == 1))
put_bits(&s->pb,1,1);
}
}else{
put_bits(&s->pb,
ff_h263_inter_MCBPC_bits[cbpc+16],
ff_h263_inter_MCBPC_code[cbpc+16]);
put_bits(&s->pb, ff_h263_cbpy_tab[cbpy][1], ff_h263_cbpy_tab[cbpy][0]);
if(s->dquant)
put_bits(&s->pb, 2, dquant_code[s->dquant+2]);
if(interleaved_stats){
s->misc_bits+= get_bits_diff(s);
}
for(i=0; i<4; i++){
ff_h263_pred_motion(s, i, 0, &pred_x, &pred_y);
motion_x = s->current_picture.motion_val[0][s->block_index[i]][0];
motion_y = s->current_picture.motion_val[0][s->block_index[i]][1];
if (!s->umvplus) {
ff_h263_encode_motion_vector(s, motion_x - pred_x,
motion_y - pred_y, 1);
}
else {
h263p_encode_umotion(s, motion_x - pred_x);
h263p_encode_umotion(s, motion_y - pred_y);
if (((motion_x - pred_x) == 1) && ((motion_y - pred_y) == 1))
put_bits(&s->pb,1,1);
}
}
}
if(interleaved_stats){
s->mv_bits+= get_bits_diff(s);
}
} else {
assert(s->mb_intra);
cbp = 0;
if (s->h263_aic) {
for(i=0; i<6; i++) {
int16_t level = block[i][0];
int scale;
if(i<4) scale= s->y_dc_scale;
else scale= s->c_dc_scale;
pred_dc = ff_h263_pred_dc(s, i, &dc_ptr[i]);
level -= pred_dc;
if (level >= 0)
level = (level + (scale>>1))/scale;
else
level = (level - (scale>>1))/scale;
if (level == 0 && s->block_last_index[i] == 0)
s->block_last_index[i] = -1;
if(!s->modified_quant){
if (level < -127)
level = -127;
else if (level > 127)
level = 127;
}
block[i][0] = level;
rec_intradc[i] = scale*level + pred_dc;
rec_intradc[i] |= 1;
if (rec_intradc[i] < 0)
rec_intradc[i] = 0;
else if (rec_intradc[i] > 2047)
rec_intradc[i] = 2047;
*dc_ptr[i] = rec_intradc[i];
if (s->block_last_index[i] >= 0)
cbp |= 1 << (5 - i);
}
}else{
for(i=0; i<6; i++) {
if (s->block_last_index[i] >= 1)
cbp |= 1 << (5 - i);
}
}
cbpc = cbp & 3;
if (s->pict_type == AV_PICTURE_TYPE_I) {
if(s->dquant) cbpc+=4;
put_bits(&s->pb,
ff_h263_intra_MCBPC_bits[cbpc],
ff_h263_intra_MCBPC_code[cbpc]);
} else {
if(s->dquant) cbpc+=8;
put_bits(&s->pb, 1, 0);
put_bits(&s->pb,
ff_h263_inter_MCBPC_bits[cbpc + 4],
ff_h263_inter_MCBPC_code[cbpc + 4]);
}
if (s->h263_aic) {
put_bits(&s->pb, 1, 0);
}
cbpy = cbp >> 2;
put_bits(&s->pb, ff_h263_cbpy_tab[cbpy][1], ff_h263_cbpy_tab[cbpy][0]);
if(s->dquant)
put_bits(&s->pb, 2, dquant_code[s->dquant+2]);
if(interleaved_stats){
s->misc_bits+= get_bits_diff(s);
}
}
for(i=0; i<6; i++) {
h263_encode_block(s, block[i], i);
if (s->h263_aic && s->mb_intra) {
block[i][0] = rec_intradc[i];
}
}
if(interleaved_stats){
if (!s->mb_intra) {
s->p_tex_bits+= get_bits_diff(s);
s->f_count++;
}else{
s->i_tex_bits+= get_bits_diff(s);
s->i_count++;
}
}
}
|
{
"code": [],
"line_no": []
}
|
void FUNC_0(MpegEncContext * VAR_0,
int16_t VAR_1[6][64],
int VAR_2, int VAR_3)
{
int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;
int16_t pred_dc;
int16_t rec_intradc[6];
int16_t *dc_ptr[6];
const int VAR_10= (VAR_0->flags&CODEC_FLAG_PASS1);
if (!VAR_0->mb_intra) {
VAR_7= get_p_cbp(VAR_0, VAR_1, VAR_2, VAR_3);
if ((VAR_7 | VAR_2 | VAR_3 | VAR_0->dquant | (VAR_0->mv_type - MV_TYPE_16X16)) == 0) {
put_bits(&VAR_0->pb, 1, 1);
if(VAR_10){
VAR_0->misc_bits++;
VAR_0->last_bits++;
}
VAR_0->skip_count++;
return;
}
put_bits(&VAR_0->pb, 1, 0);
VAR_4 = VAR_7 & 3;
VAR_5 = VAR_7 >> 2;
if(VAR_0->alt_inter_vlc==0 || VAR_4!=3)
VAR_5 ^= 0xF;
if(VAR_0->dquant) VAR_4+= 8;
if(VAR_0->mv_type==MV_TYPE_16X16){
put_bits(&VAR_0->pb,
ff_h263_inter_MCBPC_bits[VAR_4],
ff_h263_inter_MCBPC_code[VAR_4]);
put_bits(&VAR_0->pb, ff_h263_cbpy_tab[VAR_5][1], ff_h263_cbpy_tab[VAR_5][0]);
if(VAR_0->dquant)
put_bits(&VAR_0->pb, 2, dquant_code[VAR_0->dquant+2]);
if(VAR_10){
VAR_0->misc_bits+= get_bits_diff(VAR_0);
}
ff_h263_pred_motion(VAR_0, 0, 0, &VAR_8, &VAR_9);
if (!VAR_0->umvplus) {
ff_h263_encode_motion_vector(VAR_0, VAR_2 - VAR_8,
VAR_3 - VAR_9, 1);
}
else {
h263p_encode_umotion(VAR_0, VAR_2 - VAR_8);
h263p_encode_umotion(VAR_0, VAR_3 - VAR_9);
if (((VAR_2 - VAR_8) == 1) && ((VAR_3 - VAR_9) == 1))
put_bits(&VAR_0->pb,1,1);
}
}else{
put_bits(&VAR_0->pb,
ff_h263_inter_MCBPC_bits[VAR_4+16],
ff_h263_inter_MCBPC_code[VAR_4+16]);
put_bits(&VAR_0->pb, ff_h263_cbpy_tab[VAR_5][1], ff_h263_cbpy_tab[VAR_5][0]);
if(VAR_0->dquant)
put_bits(&VAR_0->pb, 2, dquant_code[VAR_0->dquant+2]);
if(VAR_10){
VAR_0->misc_bits+= get_bits_diff(VAR_0);
}
for(VAR_6=0; VAR_6<4; VAR_6++){
ff_h263_pred_motion(VAR_0, VAR_6, 0, &VAR_8, &VAR_9);
VAR_2 = VAR_0->current_picture.motion_val[0][VAR_0->block_index[VAR_6]][0];
VAR_3 = VAR_0->current_picture.motion_val[0][VAR_0->block_index[VAR_6]][1];
if (!VAR_0->umvplus) {
ff_h263_encode_motion_vector(VAR_0, VAR_2 - VAR_8,
VAR_3 - VAR_9, 1);
}
else {
h263p_encode_umotion(VAR_0, VAR_2 - VAR_8);
h263p_encode_umotion(VAR_0, VAR_3 - VAR_9);
if (((VAR_2 - VAR_8) == 1) && ((VAR_3 - VAR_9) == 1))
put_bits(&VAR_0->pb,1,1);
}
}
}
if(VAR_10){
VAR_0->mv_bits+= get_bits_diff(VAR_0);
}
} else {
assert(VAR_0->mb_intra);
VAR_7 = 0;
if (VAR_0->h263_aic) {
for(VAR_6=0; VAR_6<6; VAR_6++) {
int16_t level = VAR_1[VAR_6][0];
int VAR_11;
if(VAR_6<4) VAR_11= VAR_0->y_dc_scale;
else VAR_11= VAR_0->c_dc_scale;
pred_dc = ff_h263_pred_dc(VAR_0, VAR_6, &dc_ptr[VAR_6]);
level -= pred_dc;
if (level >= 0)
level = (level + (VAR_11>>1))/VAR_11;
else
level = (level - (VAR_11>>1))/VAR_11;
if (level == 0 && VAR_0->block_last_index[VAR_6] == 0)
VAR_0->block_last_index[VAR_6] = -1;
if(!VAR_0->modified_quant){
if (level < -127)
level = -127;
else if (level > 127)
level = 127;
}
VAR_1[VAR_6][0] = level;
rec_intradc[VAR_6] = VAR_11*level + pred_dc;
rec_intradc[VAR_6] |= 1;
if (rec_intradc[VAR_6] < 0)
rec_intradc[VAR_6] = 0;
else if (rec_intradc[VAR_6] > 2047)
rec_intradc[VAR_6] = 2047;
*dc_ptr[VAR_6] = rec_intradc[VAR_6];
if (VAR_0->block_last_index[VAR_6] >= 0)
VAR_7 |= 1 << (5 - VAR_6);
}
}else{
for(VAR_6=0; VAR_6<6; VAR_6++) {
if (VAR_0->block_last_index[VAR_6] >= 1)
VAR_7 |= 1 << (5 - VAR_6);
}
}
VAR_4 = VAR_7 & 3;
if (VAR_0->pict_type == AV_PICTURE_TYPE_I) {
if(VAR_0->dquant) VAR_4+=4;
put_bits(&VAR_0->pb,
ff_h263_intra_MCBPC_bits[VAR_4],
ff_h263_intra_MCBPC_code[VAR_4]);
} else {
if(VAR_0->dquant) VAR_4+=8;
put_bits(&VAR_0->pb, 1, 0);
put_bits(&VAR_0->pb,
ff_h263_inter_MCBPC_bits[VAR_4 + 4],
ff_h263_inter_MCBPC_code[VAR_4 + 4]);
}
if (VAR_0->h263_aic) {
put_bits(&VAR_0->pb, 1, 0);
}
VAR_5 = VAR_7 >> 2;
put_bits(&VAR_0->pb, ff_h263_cbpy_tab[VAR_5][1], ff_h263_cbpy_tab[VAR_5][0]);
if(VAR_0->dquant)
put_bits(&VAR_0->pb, 2, dquant_code[VAR_0->dquant+2]);
if(VAR_10){
VAR_0->misc_bits+= get_bits_diff(VAR_0);
}
}
for(VAR_6=0; VAR_6<6; VAR_6++) {
h263_encode_block(VAR_0, VAR_1[VAR_6], VAR_6);
if (VAR_0->h263_aic && VAR_0->mb_intra) {
VAR_1[VAR_6][0] = rec_intradc[VAR_6];
}
}
if(VAR_10){
if (!VAR_0->mb_intra) {
VAR_0->p_tex_bits+= get_bits_diff(VAR_0);
VAR_0->f_count++;
}else{
VAR_0->i_tex_bits+= get_bits_diff(VAR_0);
VAR_0->i_count++;
}
}
}
|
[
"void FUNC_0(MpegEncContext * VAR_0,\nint16_t VAR_1[6][64],\nint VAR_2, int VAR_3)\n{",
"int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;",
"int16_t pred_dc;",
"int16_t rec_intradc[6];",
"int16_t *dc_ptr[6];",
"const int VAR_10= (VAR_0->flags&CODEC_FLAG_PASS1);",
"if (!VAR_0->mb_intra) {",
"VAR_7= get_p_cbp(VAR_0, VAR_1, VAR_2, VAR_3);",
"if ((VAR_7 | VAR_2 | VAR_3 | VAR_0->dquant | (VAR_0->mv_type - MV_TYPE_16X16)) == 0) {",
"put_bits(&VAR_0->pb, 1, 1);",
"if(VAR_10){",
"VAR_0->misc_bits++;",
"VAR_0->last_bits++;",
"}",
"VAR_0->skip_count++;",
"return;",
"}",
"put_bits(&VAR_0->pb, 1, 0);",
"VAR_4 = VAR_7 & 3;",
"VAR_5 = VAR_7 >> 2;",
"if(VAR_0->alt_inter_vlc==0 || VAR_4!=3)\nVAR_5 ^= 0xF;",
"if(VAR_0->dquant) VAR_4+= 8;",
"if(VAR_0->mv_type==MV_TYPE_16X16){",
"put_bits(&VAR_0->pb,\nff_h263_inter_MCBPC_bits[VAR_4],\nff_h263_inter_MCBPC_code[VAR_4]);",
"put_bits(&VAR_0->pb, ff_h263_cbpy_tab[VAR_5][1], ff_h263_cbpy_tab[VAR_5][0]);",
"if(VAR_0->dquant)\nput_bits(&VAR_0->pb, 2, dquant_code[VAR_0->dquant+2]);",
"if(VAR_10){",
"VAR_0->misc_bits+= get_bits_diff(VAR_0);",
"}",
"ff_h263_pred_motion(VAR_0, 0, 0, &VAR_8, &VAR_9);",
"if (!VAR_0->umvplus) {",
"ff_h263_encode_motion_vector(VAR_0, VAR_2 - VAR_8,\nVAR_3 - VAR_9, 1);",
"}",
"else {",
"h263p_encode_umotion(VAR_0, VAR_2 - VAR_8);",
"h263p_encode_umotion(VAR_0, VAR_3 - VAR_9);",
"if (((VAR_2 - VAR_8) == 1) && ((VAR_3 - VAR_9) == 1))\nput_bits(&VAR_0->pb,1,1);",
"}",
"}else{",
"put_bits(&VAR_0->pb,\nff_h263_inter_MCBPC_bits[VAR_4+16],\nff_h263_inter_MCBPC_code[VAR_4+16]);",
"put_bits(&VAR_0->pb, ff_h263_cbpy_tab[VAR_5][1], ff_h263_cbpy_tab[VAR_5][0]);",
"if(VAR_0->dquant)\nput_bits(&VAR_0->pb, 2, dquant_code[VAR_0->dquant+2]);",
"if(VAR_10){",
"VAR_0->misc_bits+= get_bits_diff(VAR_0);",
"}",
"for(VAR_6=0; VAR_6<4; VAR_6++){",
"ff_h263_pred_motion(VAR_0, VAR_6, 0, &VAR_8, &VAR_9);",
"VAR_2 = VAR_0->current_picture.motion_val[0][VAR_0->block_index[VAR_6]][0];",
"VAR_3 = VAR_0->current_picture.motion_val[0][VAR_0->block_index[VAR_6]][1];",
"if (!VAR_0->umvplus) {",
"ff_h263_encode_motion_vector(VAR_0, VAR_2 - VAR_8,\nVAR_3 - VAR_9, 1);",
"}",
"else {",
"h263p_encode_umotion(VAR_0, VAR_2 - VAR_8);",
"h263p_encode_umotion(VAR_0, VAR_3 - VAR_9);",
"if (((VAR_2 - VAR_8) == 1) && ((VAR_3 - VAR_9) == 1))\nput_bits(&VAR_0->pb,1,1);",
"}",
"}",
"}",
"if(VAR_10){",
"VAR_0->mv_bits+= get_bits_diff(VAR_0);",
"}",
"} else {",
"assert(VAR_0->mb_intra);",
"VAR_7 = 0;",
"if (VAR_0->h263_aic) {",
"for(VAR_6=0; VAR_6<6; VAR_6++) {",
"int16_t level = VAR_1[VAR_6][0];",
"int VAR_11;",
"if(VAR_6<4) VAR_11= VAR_0->y_dc_scale;",
"else VAR_11= VAR_0->c_dc_scale;",
"pred_dc = ff_h263_pred_dc(VAR_0, VAR_6, &dc_ptr[VAR_6]);",
"level -= pred_dc;",
"if (level >= 0)\nlevel = (level + (VAR_11>>1))/VAR_11;",
"else\nlevel = (level - (VAR_11>>1))/VAR_11;",
"if (level == 0 && VAR_0->block_last_index[VAR_6] == 0)\nVAR_0->block_last_index[VAR_6] = -1;",
"if(!VAR_0->modified_quant){",
"if (level < -127)\nlevel = -127;",
"else if (level > 127)\nlevel = 127;",
"}",
"VAR_1[VAR_6][0] = level;",
"rec_intradc[VAR_6] = VAR_11*level + pred_dc;",
"rec_intradc[VAR_6] |= 1;",
"if (rec_intradc[VAR_6] < 0)\nrec_intradc[VAR_6] = 0;",
"else if (rec_intradc[VAR_6] > 2047)\nrec_intradc[VAR_6] = 2047;",
"*dc_ptr[VAR_6] = rec_intradc[VAR_6];",
"if (VAR_0->block_last_index[VAR_6] >= 0)\nVAR_7 |= 1 << (5 - VAR_6);",
"}",
"}else{",
"for(VAR_6=0; VAR_6<6; VAR_6++) {",
"if (VAR_0->block_last_index[VAR_6] >= 1)\nVAR_7 |= 1 << (5 - VAR_6);",
"}",
"}",
"VAR_4 = VAR_7 & 3;",
"if (VAR_0->pict_type == AV_PICTURE_TYPE_I) {",
"if(VAR_0->dquant) VAR_4+=4;",
"put_bits(&VAR_0->pb,\nff_h263_intra_MCBPC_bits[VAR_4],\nff_h263_intra_MCBPC_code[VAR_4]);",
"} else {",
"if(VAR_0->dquant) VAR_4+=8;",
"put_bits(&VAR_0->pb, 1, 0);",
"put_bits(&VAR_0->pb,\nff_h263_inter_MCBPC_bits[VAR_4 + 4],\nff_h263_inter_MCBPC_code[VAR_4 + 4]);",
"}",
"if (VAR_0->h263_aic) {",
"put_bits(&VAR_0->pb, 1, 0);",
"}",
"VAR_5 = VAR_7 >> 2;",
"put_bits(&VAR_0->pb, ff_h263_cbpy_tab[VAR_5][1], ff_h263_cbpy_tab[VAR_5][0]);",
"if(VAR_0->dquant)\nput_bits(&VAR_0->pb, 2, dquant_code[VAR_0->dquant+2]);",
"if(VAR_10){",
"VAR_0->misc_bits+= get_bits_diff(VAR_0);",
"}",
"}",
"for(VAR_6=0; VAR_6<6; VAR_6++) {",
"h263_encode_block(VAR_0, VAR_1[VAR_6], VAR_6);",
"if (VAR_0->h263_aic && VAR_0->mb_intra) {",
"VAR_1[VAR_6][0] = rec_intradc[VAR_6];",
"}",
"}",
"if(VAR_10){",
"if (!VAR_0->mb_intra) {",
"VAR_0->p_tex_bits+= get_bits_diff(VAR_0);",
"VAR_0->f_count++;",
"}else{",
"VAR_0->i_tex_bits+= get_bits_diff(VAR_0);",
"VAR_0->i_count++;",
"}",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
25
],
[
29
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
47
],
[
49
],
[
51
],
[
55
],
[
57
],
[
59,
61
],
[
63
],
[
65
],
[
67,
69,
71
],
[
75
],
[
77,
79
],
[
83
],
[
85
],
[
87
],
[
93
],
[
97
],
[
99,
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111,
115
],
[
117
],
[
119
],
[
121,
123,
125
],
[
127
],
[
129,
131
],
[
135
],
[
137
],
[
139
],
[
143
],
[
147
],
[
151
],
[
153
],
[
155
],
[
157,
159
],
[
161
],
[
163
],
[
165
],
[
167
],
[
169,
173
],
[
175
],
[
177
],
[
179
],
[
183
],
[
185
],
[
187
],
[
189
],
[
191
],
[
195
],
[
197
],
[
201
],
[
203
],
[
205
],
[
209
],
[
211
],
[
215
],
[
217
],
[
221,
223
],
[
225,
227
],
[
233,
235
],
[
239
],
[
241,
243
],
[
245,
247
],
[
249
],
[
253
],
[
257
],
[
261
],
[
269,
271
],
[
273,
275
],
[
281
],
[
283,
285
],
[
287
],
[
289
],
[
291
],
[
295,
297
],
[
299
],
[
301
],
[
305
],
[
307
],
[
309
],
[
311,
313,
315
],
[
317
],
[
319
],
[
321
],
[
323,
325,
327
],
[
329
],
[
331
],
[
335
],
[
337
],
[
339
],
[
341
],
[
343,
345
],
[
349
],
[
351
],
[
353
],
[
355
],
[
359
],
[
363
],
[
369
],
[
371
],
[
375
],
[
377
],
[
381
],
[
383
],
[
385
],
[
387
],
[
389
],
[
391
],
[
393
],
[
395
],
[
397
],
[
399
]
] |
6,449 |
static int hls_mux_init(AVFormatContext *s)
{
HLSContext *hls = s->priv_data;
AVFormatContext *oc;
AVFormatContext *vtt_oc;
int i, ret;
ret = avformat_alloc_output_context2(&hls->avf, hls->oformat, NULL, NULL);
if (ret < 0)
return ret;
oc = hls->avf;
oc->oformat = hls->oformat;
oc->interrupt_callback = s->interrupt_callback;
oc->max_delay = s->max_delay;
av_dict_copy(&oc->metadata, s->metadata, 0);
if(hls->vtt_oformat) {
ret = avformat_alloc_output_context2(&hls->vtt_avf, hls->vtt_oformat, NULL, NULL);
if (ret < 0)
return ret;
vtt_oc = hls->vtt_avf;
vtt_oc->oformat = hls->vtt_oformat;
av_dict_copy(&vtt_oc->metadata, s->metadata, 0);
}
for (i = 0; i < s->nb_streams; i++) {
AVStream *st;
AVFormatContext *loc;
if (s->streams[i]->codec->codec_type == AVMEDIA_TYPE_SUBTITLE)
loc = vtt_oc;
else
loc = oc;
if (!(st = avformat_new_stream(loc, NULL)))
return AVERROR(ENOMEM);
avcodec_copy_context(st->codec, s->streams[i]->codec);
st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio;
st->time_base = s->streams[i]->time_base;
}
hls->start_pos = 0;
return 0;
}
| false |
FFmpeg
|
e3d8504fd043bdc2535525128b158fbc1fb18c67
|
static int hls_mux_init(AVFormatContext *s)
{
HLSContext *hls = s->priv_data;
AVFormatContext *oc;
AVFormatContext *vtt_oc;
int i, ret;
ret = avformat_alloc_output_context2(&hls->avf, hls->oformat, NULL, NULL);
if (ret < 0)
return ret;
oc = hls->avf;
oc->oformat = hls->oformat;
oc->interrupt_callback = s->interrupt_callback;
oc->max_delay = s->max_delay;
av_dict_copy(&oc->metadata, s->metadata, 0);
if(hls->vtt_oformat) {
ret = avformat_alloc_output_context2(&hls->vtt_avf, hls->vtt_oformat, NULL, NULL);
if (ret < 0)
return ret;
vtt_oc = hls->vtt_avf;
vtt_oc->oformat = hls->vtt_oformat;
av_dict_copy(&vtt_oc->metadata, s->metadata, 0);
}
for (i = 0; i < s->nb_streams; i++) {
AVStream *st;
AVFormatContext *loc;
if (s->streams[i]->codec->codec_type == AVMEDIA_TYPE_SUBTITLE)
loc = vtt_oc;
else
loc = oc;
if (!(st = avformat_new_stream(loc, NULL)))
return AVERROR(ENOMEM);
avcodec_copy_context(st->codec, s->streams[i]->codec);
st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio;
st->time_base = s->streams[i]->time_base;
}
hls->start_pos = 0;
return 0;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(AVFormatContext *VAR_0)
{
HLSContext *hls = VAR_0->priv_data;
AVFormatContext *oc;
AVFormatContext *vtt_oc;
int VAR_1, VAR_2;
VAR_2 = avformat_alloc_output_context2(&hls->avf, hls->oformat, NULL, NULL);
if (VAR_2 < 0)
return VAR_2;
oc = hls->avf;
oc->oformat = hls->oformat;
oc->interrupt_callback = VAR_0->interrupt_callback;
oc->max_delay = VAR_0->max_delay;
av_dict_copy(&oc->metadata, VAR_0->metadata, 0);
if(hls->vtt_oformat) {
VAR_2 = avformat_alloc_output_context2(&hls->vtt_avf, hls->vtt_oformat, NULL, NULL);
if (VAR_2 < 0)
return VAR_2;
vtt_oc = hls->vtt_avf;
vtt_oc->oformat = hls->vtt_oformat;
av_dict_copy(&vtt_oc->metadata, VAR_0->metadata, 0);
}
for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) {
AVStream *st;
AVFormatContext *loc;
if (VAR_0->streams[VAR_1]->codec->codec_type == AVMEDIA_TYPE_SUBTITLE)
loc = vtt_oc;
else
loc = oc;
if (!(st = avformat_new_stream(loc, NULL)))
return AVERROR(ENOMEM);
avcodec_copy_context(st->codec, VAR_0->streams[VAR_1]->codec);
st->sample_aspect_ratio = VAR_0->streams[VAR_1]->sample_aspect_ratio;
st->time_base = VAR_0->streams[VAR_1]->time_base;
}
hls->start_pos = 0;
return 0;
}
|
[
"static int FUNC_0(AVFormatContext *VAR_0)\n{",
"HLSContext *hls = VAR_0->priv_data;",
"AVFormatContext *oc;",
"AVFormatContext *vtt_oc;",
"int VAR_1, VAR_2;",
"VAR_2 = avformat_alloc_output_context2(&hls->avf, hls->oformat, NULL, NULL);",
"if (VAR_2 < 0)\nreturn VAR_2;",
"oc = hls->avf;",
"oc->oformat = hls->oformat;",
"oc->interrupt_callback = VAR_0->interrupt_callback;",
"oc->max_delay = VAR_0->max_delay;",
"av_dict_copy(&oc->metadata, VAR_0->metadata, 0);",
"if(hls->vtt_oformat) {",
"VAR_2 = avformat_alloc_output_context2(&hls->vtt_avf, hls->vtt_oformat, NULL, NULL);",
"if (VAR_2 < 0)\nreturn VAR_2;",
"vtt_oc = hls->vtt_avf;",
"vtt_oc->oformat = hls->vtt_oformat;",
"av_dict_copy(&vtt_oc->metadata, VAR_0->metadata, 0);",
"}",
"for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) {",
"AVStream *st;",
"AVFormatContext *loc;",
"if (VAR_0->streams[VAR_1]->codec->codec_type == AVMEDIA_TYPE_SUBTITLE)\nloc = vtt_oc;",
"else\nloc = oc;",
"if (!(st = avformat_new_stream(loc, NULL)))\nreturn AVERROR(ENOMEM);",
"avcodec_copy_context(st->codec, VAR_0->streams[VAR_1]->codec);",
"st->sample_aspect_ratio = VAR_0->streams[VAR_1]->sample_aspect_ratio;",
"st->time_base = VAR_0->streams[VAR_1]->time_base;",
"}",
"hls->start_pos = 0;",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17,
19
],
[
21
],
[
25
],
[
27
],
[
29
],
[
31
],
[
35
],
[
37
],
[
39,
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
53
],
[
55
],
[
57
],
[
59,
61
],
[
63,
65
],
[
69,
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
85
],
[
87
]
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.