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
|
---|---|---|---|---|---|---|---|---|---|---|
7,210 |
void os_mem_prealloc(int fd, char *area, size_t memory)
{
int ret;
struct sigaction act, oldact;
sigset_t set, oldset;
memset(&act, 0, sizeof(act));
act.sa_handler = &sigbus_handler;
act.sa_flags = 0;
ret = sigaction(SIGBUS, &act, &oldact);
if (ret) {
perror("os_mem_prealloc: failed to install signal handler");
exit(1);
}
/* unblock SIGBUS */
sigemptyset(&set);
sigaddset(&set, SIGBUS);
pthread_sigmask(SIG_UNBLOCK, &set, &oldset);
if (sigsetjmp(sigjump, 1)) {
fprintf(stderr, "os_mem_prealloc: Insufficient free host memory "
"pages available to allocate guest RAM\n");
exit(1);
} else {
int i;
size_t hpagesize = fd_getpagesize(fd);
size_t numpages = DIV_ROUND_UP(memory, hpagesize);
/* MAP_POPULATE silently ignores failures */
for (i = 0; i < numpages; i++) {
memset(area + (hpagesize * i), 0, 1);
}
ret = sigaction(SIGBUS, &oldact, NULL);
if (ret) {
perror("os_mem_prealloc: failed to reinstall signal handler");
exit(1);
}
pthread_sigmask(SIG_SETMASK, &oldset, NULL);
}
}
| false |
qemu
|
7197fb4058bcb68986bae2bb2c04d6370f3e7218
|
void os_mem_prealloc(int fd, char *area, size_t memory)
{
int ret;
struct sigaction act, oldact;
sigset_t set, oldset;
memset(&act, 0, sizeof(act));
act.sa_handler = &sigbus_handler;
act.sa_flags = 0;
ret = sigaction(SIGBUS, &act, &oldact);
if (ret) {
perror("os_mem_prealloc: failed to install signal handler");
exit(1);
}
sigemptyset(&set);
sigaddset(&set, SIGBUS);
pthread_sigmask(SIG_UNBLOCK, &set, &oldset);
if (sigsetjmp(sigjump, 1)) {
fprintf(stderr, "os_mem_prealloc: Insufficient free host memory "
"pages available to allocate guest RAM\n");
exit(1);
} else {
int i;
size_t hpagesize = fd_getpagesize(fd);
size_t numpages = DIV_ROUND_UP(memory, hpagesize);
for (i = 0; i < numpages; i++) {
memset(area + (hpagesize * i), 0, 1);
}
ret = sigaction(SIGBUS, &oldact, NULL);
if (ret) {
perror("os_mem_prealloc: failed to reinstall signal handler");
exit(1);
}
pthread_sigmask(SIG_SETMASK, &oldset, NULL);
}
}
|
{
"code": [],
"line_no": []
}
|
void FUNC_0(int VAR_0, char *VAR_1, size_t VAR_2)
{
int VAR_3;
struct sigaction VAR_4, VAR_5;
sigset_t set, oldset;
memset(&VAR_4, 0, sizeof(VAR_4));
VAR_4.sa_handler = &sigbus_handler;
VAR_4.sa_flags = 0;
VAR_3 = sigaction(SIGBUS, &VAR_4, &VAR_5);
if (VAR_3) {
perror("FUNC_0: failed to install signal handler");
exit(1);
}
sigemptyset(&set);
sigaddset(&set, SIGBUS);
pthread_sigmask(SIG_UNBLOCK, &set, &oldset);
if (sigsetjmp(sigjump, 1)) {
fprintf(stderr, "FUNC_0: Insufficient free host VAR_2 "
"pages available to allocate guest RAM\n");
exit(1);
} else {
int VAR_6;
size_t hpagesize = fd_getpagesize(VAR_0);
size_t numpages = DIV_ROUND_UP(VAR_2, hpagesize);
for (VAR_6 = 0; VAR_6 < numpages; VAR_6++) {
memset(VAR_1 + (hpagesize * VAR_6), 0, 1);
}
VAR_3 = sigaction(SIGBUS, &VAR_5, NULL);
if (VAR_3) {
perror("FUNC_0: failed to reinstall signal handler");
exit(1);
}
pthread_sigmask(SIG_SETMASK, &oldset, NULL);
}
}
|
[
"void FUNC_0(int VAR_0, char *VAR_1, size_t VAR_2)\n{",
"int VAR_3;",
"struct sigaction VAR_4, VAR_5;",
"sigset_t set, oldset;",
"memset(&VAR_4, 0, sizeof(VAR_4));",
"VAR_4.sa_handler = &sigbus_handler;",
"VAR_4.sa_flags = 0;",
"VAR_3 = sigaction(SIGBUS, &VAR_4, &VAR_5);",
"if (VAR_3) {",
"perror(\"FUNC_0: failed to install signal handler\");",
"exit(1);",
"}",
"sigemptyset(&set);",
"sigaddset(&set, SIGBUS);",
"pthread_sigmask(SIG_UNBLOCK, &set, &oldset);",
"if (sigsetjmp(sigjump, 1)) {",
"fprintf(stderr, \"FUNC_0: Insufficient free host VAR_2 \"\n\"pages available to allocate guest RAM\\n\");",
"exit(1);",
"} else {",
"int VAR_6;",
"size_t hpagesize = fd_getpagesize(VAR_0);",
"size_t numpages = DIV_ROUND_UP(VAR_2, hpagesize);",
"for (VAR_6 = 0; VAR_6 < numpages; VAR_6++) {",
"memset(VAR_1 + (hpagesize * VAR_6), 0, 1);",
"}",
"VAR_3 = sigaction(SIGBUS, &VAR_5, NULL);",
"if (VAR_3) {",
"perror(\"FUNC_0: failed to reinstall signal handler\");",
"exit(1);",
"}",
"pthread_sigmask(SIG_SETMASK, &oldset, 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
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
17
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
35
],
[
37
],
[
39
],
[
43
],
[
45,
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
63
],
[
65
],
[
67
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
83
],
[
85
],
[
87
]
] |
7,212 |
int usb_handle_packet(USBDevice *dev, USBPacket *p)
{
int ret;
if (dev == NULL) {
return USB_RET_NODEV;
}
assert(dev->addr == p->devaddr);
assert(dev->state == USB_STATE_DEFAULT);
assert(p->state == USB_PACKET_SETUP);
if (p->devep == 0) {
/* control pipe */
switch (p->pid) {
case USB_TOKEN_SETUP:
ret = do_token_setup(dev, p);
break;
case USB_TOKEN_IN:
ret = do_token_in(dev, p);
break;
case USB_TOKEN_OUT:
ret = do_token_out(dev, p);
break;
default:
ret = USB_RET_STALL;
break;
}
} else {
/* data pipe */
ret = usb_device_handle_data(dev, p);
}
if (ret == USB_RET_ASYNC) {
p->ep = usb_ep_get(dev, p->pid, p->devep);
p->state = USB_PACKET_ASYNC;
}
return ret;
}
| false |
qemu
|
079d0b7f1eedcc634c371fe05b617fdc55c8b762
|
int usb_handle_packet(USBDevice *dev, USBPacket *p)
{
int ret;
if (dev == NULL) {
return USB_RET_NODEV;
}
assert(dev->addr == p->devaddr);
assert(dev->state == USB_STATE_DEFAULT);
assert(p->state == USB_PACKET_SETUP);
if (p->devep == 0) {
switch (p->pid) {
case USB_TOKEN_SETUP:
ret = do_token_setup(dev, p);
break;
case USB_TOKEN_IN:
ret = do_token_in(dev, p);
break;
case USB_TOKEN_OUT:
ret = do_token_out(dev, p);
break;
default:
ret = USB_RET_STALL;
break;
}
} else {
ret = usb_device_handle_data(dev, p);
}
if (ret == USB_RET_ASYNC) {
p->ep = usb_ep_get(dev, p->pid, p->devep);
p->state = USB_PACKET_ASYNC;
}
return ret;
}
|
{
"code": [],
"line_no": []
}
|
int FUNC_0(USBDevice *VAR_0, USBPacket *VAR_1)
{
int VAR_2;
if (VAR_0 == NULL) {
return USB_RET_NODEV;
}
assert(VAR_0->addr == VAR_1->devaddr);
assert(VAR_0->state == USB_STATE_DEFAULT);
assert(VAR_1->state == USB_PACKET_SETUP);
if (VAR_1->devep == 0) {
switch (VAR_1->pid) {
case USB_TOKEN_SETUP:
VAR_2 = do_token_setup(VAR_0, VAR_1);
break;
case USB_TOKEN_IN:
VAR_2 = do_token_in(VAR_0, VAR_1);
break;
case USB_TOKEN_OUT:
VAR_2 = do_token_out(VAR_0, VAR_1);
break;
default:
VAR_2 = USB_RET_STALL;
break;
}
} else {
VAR_2 = usb_device_handle_data(VAR_0, VAR_1);
}
if (VAR_2 == USB_RET_ASYNC) {
VAR_1->ep = usb_ep_get(VAR_0, VAR_1->pid, VAR_1->devep);
VAR_1->state = USB_PACKET_ASYNC;
}
return VAR_2;
}
|
[
"int FUNC_0(USBDevice *VAR_0, USBPacket *VAR_1)\n{",
"int VAR_2;",
"if (VAR_0 == NULL) {",
"return USB_RET_NODEV;",
"}",
"assert(VAR_0->addr == VAR_1->devaddr);",
"assert(VAR_0->state == USB_STATE_DEFAULT);",
"assert(VAR_1->state == USB_PACKET_SETUP);",
"if (VAR_1->devep == 0) {",
"switch (VAR_1->pid) {",
"case USB_TOKEN_SETUP:\nVAR_2 = do_token_setup(VAR_0, VAR_1);",
"break;",
"case USB_TOKEN_IN:\nVAR_2 = do_token_in(VAR_0, VAR_1);",
"break;",
"case USB_TOKEN_OUT:\nVAR_2 = do_token_out(VAR_0, VAR_1);",
"break;",
"default:\nVAR_2 = USB_RET_STALL;",
"break;",
"}",
"} else {",
"VAR_2 = usb_device_handle_data(VAR_0, VAR_1);",
"}",
"if (VAR_2 == USB_RET_ASYNC) {",
"VAR_1->ep = usb_ep_get(VAR_0, VAR_1->pid, VAR_1->devep);",
"VAR_1->state = USB_PACKET_ASYNC;",
"}",
"return VAR_2;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
27
],
[
29,
31
],
[
33
],
[
35,
37
],
[
39
],
[
41,
43
],
[
45
],
[
47,
49
],
[
51
],
[
53
],
[
55
],
[
59
],
[
61
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
]
] |
7,214 |
build_rsdp(GArray *rsdp_table, BIOSLinker *linker, unsigned rsdt_tbl_offset)
{
AcpiRsdpDescriptor *rsdp = acpi_data_push(rsdp_table, sizeof *rsdp);
unsigned rsdt_pa_size = sizeof(rsdp->rsdt_physical_address);
unsigned rsdt_pa_offset =
(char *)&rsdp->rsdt_physical_address - rsdp_table->data;
bios_linker_loader_alloc(linker, ACPI_BUILD_RSDP_FILE, rsdp_table, 16,
true /* fseg memory */);
memcpy(&rsdp->signature, "RSD PTR ", sizeof(rsdp->signature));
memcpy(rsdp->oem_id, ACPI_BUILD_APPNAME6, sizeof(rsdp->oem_id));
rsdp->length = cpu_to_le32(sizeof(*rsdp));
rsdp->revision = 0x02;
/* Address to be filled by Guest linker */
bios_linker_loader_add_pointer(linker,
ACPI_BUILD_RSDP_FILE, rsdt_pa_offset, rsdt_pa_size,
ACPI_BUILD_TABLE_FILE, rsdt_tbl_offset);
rsdp->checksum = 0;
/* Checksum to be filled by Guest linker */
bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE,
rsdp, sizeof *rsdp,
&rsdp->checksum);
return rsdp_table;
}
| false |
qemu
|
28213cb6a61a724e2cb1e3a76d2bb17aa0ce9b36
|
build_rsdp(GArray *rsdp_table, BIOSLinker *linker, unsigned rsdt_tbl_offset)
{
AcpiRsdpDescriptor *rsdp = acpi_data_push(rsdp_table, sizeof *rsdp);
unsigned rsdt_pa_size = sizeof(rsdp->rsdt_physical_address);
unsigned rsdt_pa_offset =
(char *)&rsdp->rsdt_physical_address - rsdp_table->data;
bios_linker_loader_alloc(linker, ACPI_BUILD_RSDP_FILE, rsdp_table, 16,
true );
memcpy(&rsdp->signature, "RSD PTR ", sizeof(rsdp->signature));
memcpy(rsdp->oem_id, ACPI_BUILD_APPNAME6, sizeof(rsdp->oem_id));
rsdp->length = cpu_to_le32(sizeof(*rsdp));
rsdp->revision = 0x02;
bios_linker_loader_add_pointer(linker,
ACPI_BUILD_RSDP_FILE, rsdt_pa_offset, rsdt_pa_size,
ACPI_BUILD_TABLE_FILE, rsdt_tbl_offset);
rsdp->checksum = 0;
bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE,
rsdp, sizeof *rsdp,
&rsdp->checksum);
return rsdp_table;
}
|
{
"code": [],
"line_no": []
}
|
FUNC_0(GArray *VAR_0, BIOSLinker *VAR_1, unsigned VAR_2)
{
AcpiRsdpDescriptor *rsdp = acpi_data_push(VAR_0, sizeof *rsdp);
unsigned VAR_3 = sizeof(rsdp->rsdt_physical_address);
unsigned VAR_4 =
(char *)&rsdp->rsdt_physical_address - VAR_0->data;
bios_linker_loader_alloc(VAR_1, ACPI_BUILD_RSDP_FILE, VAR_0, 16,
true );
memcpy(&rsdp->signature, "RSD PTR ", sizeof(rsdp->signature));
memcpy(rsdp->oem_id, ACPI_BUILD_APPNAME6, sizeof(rsdp->oem_id));
rsdp->length = cpu_to_le32(sizeof(*rsdp));
rsdp->revision = 0x02;
bios_linker_loader_add_pointer(VAR_1,
ACPI_BUILD_RSDP_FILE, VAR_4, VAR_3,
ACPI_BUILD_TABLE_FILE, VAR_2);
rsdp->checksum = 0;
bios_linker_loader_add_checksum(VAR_1, ACPI_BUILD_RSDP_FILE,
rsdp, sizeof *rsdp,
&rsdp->checksum);
return VAR_0;
}
|
[
"FUNC_0(GArray *VAR_0, BIOSLinker *VAR_1, unsigned VAR_2)\n{",
"AcpiRsdpDescriptor *rsdp = acpi_data_push(VAR_0, sizeof *rsdp);",
"unsigned VAR_3 = sizeof(rsdp->rsdt_physical_address);",
"unsigned VAR_4 =\n(char *)&rsdp->rsdt_physical_address - VAR_0->data;",
"bios_linker_loader_alloc(VAR_1, ACPI_BUILD_RSDP_FILE, VAR_0, 16,\ntrue );",
"memcpy(&rsdp->signature, \"RSD PTR \", sizeof(rsdp->signature));",
"memcpy(rsdp->oem_id, ACPI_BUILD_APPNAME6, sizeof(rsdp->oem_id));",
"rsdp->length = cpu_to_le32(sizeof(*rsdp));",
"rsdp->revision = 0x02;",
"bios_linker_loader_add_pointer(VAR_1,\nACPI_BUILD_RSDP_FILE, VAR_4, VAR_3,\nACPI_BUILD_TABLE_FILE, VAR_2);",
"rsdp->checksum = 0;",
"bios_linker_loader_add_checksum(VAR_1, ACPI_BUILD_RSDP_FILE,\nrsdp, sizeof *rsdp,\n&rsdp->checksum);",
"return VAR_0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9,
11
],
[
15,
17
],
[
21
],
[
23
],
[
25
],
[
27
],
[
33,
35,
37
],
[
41
],
[
45,
47,
49
],
[
53
],
[
55
]
] |
7,215 |
static inline uint32_t vmsvga_fifo_read_raw(struct vmsvga_state_s *s)
{
uint32_t cmd = s->fifo[CMD(stop) >> 2];
s->cmd->stop = cpu_to_le32(CMD(stop) + 4);
if (CMD(stop) >= CMD(max))
s->cmd->stop = s->cmd->min;
return cmd;
}
| false |
qemu
|
0d7937974cd0504f30ad483c3368b21da426ddf9
|
static inline uint32_t vmsvga_fifo_read_raw(struct vmsvga_state_s *s)
{
uint32_t cmd = s->fifo[CMD(stop) >> 2];
s->cmd->stop = cpu_to_le32(CMD(stop) + 4);
if (CMD(stop) >= CMD(max))
s->cmd->stop = s->cmd->min;
return cmd;
}
|
{
"code": [],
"line_no": []
}
|
static inline uint32_t FUNC_0(struct vmsvga_state_s *s)
{
uint32_t cmd = s->fifo[CMD(stop) >> 2];
s->cmd->stop = cpu_to_le32(CMD(stop) + 4);
if (CMD(stop) >= CMD(max))
s->cmd->stop = s->cmd->min;
return cmd;
}
|
[
"static inline uint32_t FUNC_0(struct vmsvga_state_s *s)\n{",
"uint32_t cmd = s->fifo[CMD(stop) >> 2];",
"s->cmd->stop = cpu_to_le32(CMD(stop) + 4);",
"if (CMD(stop) >= CMD(max))\ns->cmd->stop = s->cmd->min;",
"return cmd;",
"}"
] |
[
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9,
11
],
[
13
],
[
15
]
] |
7,216 |
static void rv40_loop_filter(RV34DecContext *r, int row)
{
MpegEncContext *s = &r->s;
int mb_pos, mb_x;
int i, j, k;
uint8_t *Y, *C;
int alpha, beta, betaY, betaC;
int q;
int mbtype[4]; ///< current macroblock and its neighbours types
/**
* flags indicating that macroblock can be filtered with strong filter
* it is set only for intra coded MB and MB with DCs coded separately
*/
int mb_strong[4];
int clip[4]; ///< MB filter clipping value calculated from filtering strength
/**
* coded block patterns for luma part of current macroblock and its neighbours
* Format:
* LSB corresponds to the top left block,
* each nibble represents one row of subblocks.
*/
int cbp[4];
/**
* coded block patterns for chroma part of current macroblock and its neighbours
* Format is the same as for luma with two subblocks in a row.
*/
int uvcbp[4][2];
/**
* This mask represents the pattern of luma subblocks that should be filtered
* in addition to the coded ones because because they lie at the edge of
* 8x8 block with different enough motion vectors
*/
int mvmasks[4];
mb_pos = row * s->mb_stride;
for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){
int mbtype = s->current_picture_ptr->f.mb_type[mb_pos];
if(IS_INTRA(mbtype) || IS_SEPARATE_DC(mbtype))
r->cbp_luma [mb_pos] = r->deblock_coefs[mb_pos] = 0xFFFF;
if(IS_INTRA(mbtype))
r->cbp_chroma[mb_pos] = 0xFF;
}
mb_pos = row * s->mb_stride;
for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){
int y_h_deblock, y_v_deblock;
int c_v_deblock[2], c_h_deblock[2];
int clip_left;
int avail[4];
int y_to_deblock, c_to_deblock[2];
q = s->current_picture_ptr->f.qscale_table[mb_pos];
alpha = rv40_alpha_tab[q];
beta = rv40_beta_tab [q];
betaY = betaC = beta * 3;
if(s->width * s->height <= 176*144)
betaY += beta;
avail[0] = 1;
avail[1] = row;
avail[2] = mb_x;
avail[3] = row < s->mb_height - 1;
for(i = 0; i < 4; i++){
if(avail[i]){
int pos = mb_pos + neighbour_offs_x[i] + neighbour_offs_y[i]*s->mb_stride;
mvmasks[i] = r->deblock_coefs[pos];
mbtype [i] = s->current_picture_ptr->f.mb_type[pos];
cbp [i] = r->cbp_luma[pos];
uvcbp[i][0] = r->cbp_chroma[pos] & 0xF;
uvcbp[i][1] = r->cbp_chroma[pos] >> 4;
}else{
mvmasks[i] = 0;
mbtype [i] = mbtype[0];
cbp [i] = 0;
uvcbp[i][0] = uvcbp[i][1] = 0;
}
mb_strong[i] = IS_INTRA(mbtype[i]) || IS_SEPARATE_DC(mbtype[i]);
clip[i] = rv40_filter_clip_tbl[mb_strong[i] + 1][q];
}
y_to_deblock = mvmasks[POS_CUR]
| (mvmasks[POS_BOTTOM] << 16);
/* This pattern contains bits signalling that horizontal edges of
* the current block can be filtered.
* That happens when either of adjacent subblocks is coded or lies on
* the edge of 8x8 blocks with motion vectors differing by more than
* 3/4 pel in any component (any edge orientation for some reason).
*/
y_h_deblock = y_to_deblock
| ((cbp[POS_CUR] << 4) & ~MASK_Y_TOP_ROW)
| ((cbp[POS_TOP] & MASK_Y_LAST_ROW) >> 12);
/* This pattern contains bits signalling that vertical edges of
* the current block can be filtered.
* That happens when either of adjacent subblocks is coded or lies on
* the edge of 8x8 blocks with motion vectors differing by more than
* 3/4 pel in any component (any edge orientation for some reason).
*/
y_v_deblock = y_to_deblock
| ((cbp[POS_CUR] << 1) & ~MASK_Y_LEFT_COL)
| ((cbp[POS_LEFT] & MASK_Y_RIGHT_COL) >> 3);
if(!mb_x)
y_v_deblock &= ~MASK_Y_LEFT_COL;
if(!row)
y_h_deblock &= ~MASK_Y_TOP_ROW;
if(row == s->mb_height - 1 || (mb_strong[POS_CUR] || mb_strong[POS_BOTTOM]))
y_h_deblock &= ~(MASK_Y_TOP_ROW << 16);
/* Calculating chroma patterns is similar and easier since there is
* no motion vector pattern for them.
*/
for(i = 0; i < 2; i++){
c_to_deblock[i] = (uvcbp[POS_BOTTOM][i] << 4) | uvcbp[POS_CUR][i];
c_v_deblock[i] = c_to_deblock[i]
| ((uvcbp[POS_CUR] [i] << 1) & ~MASK_C_LEFT_COL)
| ((uvcbp[POS_LEFT][i] & MASK_C_RIGHT_COL) >> 1);
c_h_deblock[i] = c_to_deblock[i]
| ((uvcbp[POS_TOP][i] & MASK_C_LAST_ROW) >> 2)
| (uvcbp[POS_CUR][i] << 2);
if(!mb_x)
c_v_deblock[i] &= ~MASK_C_LEFT_COL;
if(!row)
c_h_deblock[i] &= ~MASK_C_TOP_ROW;
if(row == s->mb_height - 1 || mb_strong[POS_CUR] || mb_strong[POS_BOTTOM])
c_h_deblock[i] &= ~(MASK_C_TOP_ROW << 4);
}
for(j = 0; j < 16; j += 4){
Y = s->current_picture_ptr->f.data[0] + mb_x*16 + (row*16 + j) * s->linesize;
for(i = 0; i < 4; i++, Y += 4){
int ij = i + j;
int clip_cur = y_to_deblock & (MASK_CUR << ij) ? clip[POS_CUR] : 0;
int dither = j ? ij : i*4;
// if bottom block is coded then we can filter its top edge
// (or bottom edge of this block, which is the same)
if(y_h_deblock & (MASK_BOTTOM << ij)){
r->rdsp.rv40_h_loop_filter(Y+4*s->linesize, s->linesize, dither,
y_to_deblock & (MASK_BOTTOM << ij) ? clip[POS_CUR] : 0,
clip_cur,
alpha, beta, betaY, 0, 0);
}
// filter left block edge in ordinary mode (with low filtering strength)
if(y_v_deblock & (MASK_CUR << ij) && (i || !(mb_strong[POS_CUR] || mb_strong[POS_LEFT]))){
if(!i)
clip_left = mvmasks[POS_LEFT] & (MASK_RIGHT << j) ? clip[POS_LEFT] : 0;
else
clip_left = y_to_deblock & (MASK_CUR << (ij-1)) ? clip[POS_CUR] : 0;
r->rdsp.rv40_v_loop_filter(Y, s->linesize, dither,
clip_cur,
clip_left,
alpha, beta, betaY, 0, 0);
}
// filter top edge of the current macroblock when filtering strength is high
if(!j && y_h_deblock & (MASK_CUR << i) && (mb_strong[POS_CUR] || mb_strong[POS_TOP])){
r->rdsp.rv40_h_loop_filter(Y, s->linesize, dither,
clip_cur,
mvmasks[POS_TOP] & (MASK_TOP << i) ? clip[POS_TOP] : 0,
alpha, beta, betaY, 0, 1);
}
// filter left block edge in edge mode (with high filtering strength)
if(y_v_deblock & (MASK_CUR << ij) && !i && (mb_strong[POS_CUR] || mb_strong[POS_LEFT])){
clip_left = mvmasks[POS_LEFT] & (MASK_RIGHT << j) ? clip[POS_LEFT] : 0;
r->rdsp.rv40_v_loop_filter(Y, s->linesize, dither,
clip_cur,
clip_left,
alpha, beta, betaY, 0, 1);
}
}
}
for(k = 0; k < 2; k++){
for(j = 0; j < 2; j++){
C = s->current_picture_ptr->f.data[k + 1] + mb_x*8 + (row*8 + j*4) * s->uvlinesize;
for(i = 0; i < 2; i++, C += 4){
int ij = i + j*2;
int clip_cur = c_to_deblock[k] & (MASK_CUR << ij) ? clip[POS_CUR] : 0;
if(c_h_deblock[k] & (MASK_CUR << (ij+2))){
int clip_bot = c_to_deblock[k] & (MASK_CUR << (ij+2)) ? clip[POS_CUR] : 0;
r->rdsp.rv40_h_loop_filter(C+4*s->uvlinesize, s->uvlinesize, i*8,
clip_bot,
clip_cur,
alpha, beta, betaC, 1, 0);
}
if((c_v_deblock[k] & (MASK_CUR << ij)) && (i || !(mb_strong[POS_CUR] || mb_strong[POS_LEFT]))){
if(!i)
clip_left = uvcbp[POS_LEFT][k] & (MASK_CUR << (2*j+1)) ? clip[POS_LEFT] : 0;
else
clip_left = c_to_deblock[k] & (MASK_CUR << (ij-1)) ? clip[POS_CUR] : 0;
r->rdsp.rv40_v_loop_filter(C, s->uvlinesize, j*8,
clip_cur,
clip_left,
alpha, beta, betaC, 1, 0);
}
if(!j && c_h_deblock[k] & (MASK_CUR << ij) && (mb_strong[POS_CUR] || mb_strong[POS_TOP])){
int clip_top = uvcbp[POS_TOP][k] & (MASK_CUR << (ij+2)) ? clip[POS_TOP] : 0;
r->rdsp.rv40_h_loop_filter(C, s->uvlinesize, i*8,
clip_cur,
clip_top,
alpha, beta, betaC, 1, 1);
}
if(c_v_deblock[k] & (MASK_CUR << ij) && !i && (mb_strong[POS_CUR] || mb_strong[POS_LEFT])){
clip_left = uvcbp[POS_LEFT][k] & (MASK_CUR << (2*j+1)) ? clip[POS_LEFT] : 0;
r->rdsp.rv40_v_loop_filter(C, s->uvlinesize, j*8,
clip_cur,
clip_left,
alpha, beta, betaC, 1, 1);
}
}
}
}
}
}
| false |
FFmpeg
|
d8edf1b515ae9fbcea2103305241d130c16e1003
|
static void rv40_loop_filter(RV34DecContext *r, int row)
{
MpegEncContext *s = &r->s;
int mb_pos, mb_x;
int i, j, k;
uint8_t *Y, *C;
int alpha, beta, betaY, betaC;
int q;
int mbtype[4];
int mb_strong[4];
int clip[4];
int cbp[4];
int uvcbp[4][2];
int mvmasks[4];
mb_pos = row * s->mb_stride;
for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){
int mbtype = s->current_picture_ptr->f.mb_type[mb_pos];
if(IS_INTRA(mbtype) || IS_SEPARATE_DC(mbtype))
r->cbp_luma [mb_pos] = r->deblock_coefs[mb_pos] = 0xFFFF;
if(IS_INTRA(mbtype))
r->cbp_chroma[mb_pos] = 0xFF;
}
mb_pos = row * s->mb_stride;
for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){
int y_h_deblock, y_v_deblock;
int c_v_deblock[2], c_h_deblock[2];
int clip_left;
int avail[4];
int y_to_deblock, c_to_deblock[2];
q = s->current_picture_ptr->f.qscale_table[mb_pos];
alpha = rv40_alpha_tab[q];
beta = rv40_beta_tab [q];
betaY = betaC = beta * 3;
if(s->width * s->height <= 176*144)
betaY += beta;
avail[0] = 1;
avail[1] = row;
avail[2] = mb_x;
avail[3] = row < s->mb_height - 1;
for(i = 0; i < 4; i++){
if(avail[i]){
int pos = mb_pos + neighbour_offs_x[i] + neighbour_offs_y[i]*s->mb_stride;
mvmasks[i] = r->deblock_coefs[pos];
mbtype [i] = s->current_picture_ptr->f.mb_type[pos];
cbp [i] = r->cbp_luma[pos];
uvcbp[i][0] = r->cbp_chroma[pos] & 0xF;
uvcbp[i][1] = r->cbp_chroma[pos] >> 4;
}else{
mvmasks[i] = 0;
mbtype [i] = mbtype[0];
cbp [i] = 0;
uvcbp[i][0] = uvcbp[i][1] = 0;
}
mb_strong[i] = IS_INTRA(mbtype[i]) || IS_SEPARATE_DC(mbtype[i]);
clip[i] = rv40_filter_clip_tbl[mb_strong[i] + 1][q];
}
y_to_deblock = mvmasks[POS_CUR]
| (mvmasks[POS_BOTTOM] << 16);
y_h_deblock = y_to_deblock
| ((cbp[POS_CUR] << 4) & ~MASK_Y_TOP_ROW)
| ((cbp[POS_TOP] & MASK_Y_LAST_ROW) >> 12);
y_v_deblock = y_to_deblock
| ((cbp[POS_CUR] << 1) & ~MASK_Y_LEFT_COL)
| ((cbp[POS_LEFT] & MASK_Y_RIGHT_COL) >> 3);
if(!mb_x)
y_v_deblock &= ~MASK_Y_LEFT_COL;
if(!row)
y_h_deblock &= ~MASK_Y_TOP_ROW;
if(row == s->mb_height - 1 || (mb_strong[POS_CUR] || mb_strong[POS_BOTTOM]))
y_h_deblock &= ~(MASK_Y_TOP_ROW << 16);
for(i = 0; i < 2; i++){
c_to_deblock[i] = (uvcbp[POS_BOTTOM][i] << 4) | uvcbp[POS_CUR][i];
c_v_deblock[i] = c_to_deblock[i]
| ((uvcbp[POS_CUR] [i] << 1) & ~MASK_C_LEFT_COL)
| ((uvcbp[POS_LEFT][i] & MASK_C_RIGHT_COL) >> 1);
c_h_deblock[i] = c_to_deblock[i]
| ((uvcbp[POS_TOP][i] & MASK_C_LAST_ROW) >> 2)
| (uvcbp[POS_CUR][i] << 2);
if(!mb_x)
c_v_deblock[i] &= ~MASK_C_LEFT_COL;
if(!row)
c_h_deblock[i] &= ~MASK_C_TOP_ROW;
if(row == s->mb_height - 1 || mb_strong[POS_CUR] || mb_strong[POS_BOTTOM])
c_h_deblock[i] &= ~(MASK_C_TOP_ROW << 4);
}
for(j = 0; j < 16; j += 4){
Y = s->current_picture_ptr->f.data[0] + mb_x*16 + (row*16 + j) * s->linesize;
for(i = 0; i < 4; i++, Y += 4){
int ij = i + j;
int clip_cur = y_to_deblock & (MASK_CUR << ij) ? clip[POS_CUR] : 0;
int dither = j ? ij : i*4;
if(y_h_deblock & (MASK_BOTTOM << ij)){
r->rdsp.rv40_h_loop_filter(Y+4*s->linesize, s->linesize, dither,
y_to_deblock & (MASK_BOTTOM << ij) ? clip[POS_CUR] : 0,
clip_cur,
alpha, beta, betaY, 0, 0);
}
if(y_v_deblock & (MASK_CUR << ij) && (i || !(mb_strong[POS_CUR] || mb_strong[POS_LEFT]))){
if(!i)
clip_left = mvmasks[POS_LEFT] & (MASK_RIGHT << j) ? clip[POS_LEFT] : 0;
else
clip_left = y_to_deblock & (MASK_CUR << (ij-1)) ? clip[POS_CUR] : 0;
r->rdsp.rv40_v_loop_filter(Y, s->linesize, dither,
clip_cur,
clip_left,
alpha, beta, betaY, 0, 0);
}
if(!j && y_h_deblock & (MASK_CUR << i) && (mb_strong[POS_CUR] || mb_strong[POS_TOP])){
r->rdsp.rv40_h_loop_filter(Y, s->linesize, dither,
clip_cur,
mvmasks[POS_TOP] & (MASK_TOP << i) ? clip[POS_TOP] : 0,
alpha, beta, betaY, 0, 1);
}
if(y_v_deblock & (MASK_CUR << ij) && !i && (mb_strong[POS_CUR] || mb_strong[POS_LEFT])){
clip_left = mvmasks[POS_LEFT] & (MASK_RIGHT << j) ? clip[POS_LEFT] : 0;
r->rdsp.rv40_v_loop_filter(Y, s->linesize, dither,
clip_cur,
clip_left,
alpha, beta, betaY, 0, 1);
}
}
}
for(k = 0; k < 2; k++){
for(j = 0; j < 2; j++){
C = s->current_picture_ptr->f.data[k + 1] + mb_x*8 + (row*8 + j*4) * s->uvlinesize;
for(i = 0; i < 2; i++, C += 4){
int ij = i + j*2;
int clip_cur = c_to_deblock[k] & (MASK_CUR << ij) ? clip[POS_CUR] : 0;
if(c_h_deblock[k] & (MASK_CUR << (ij+2))){
int clip_bot = c_to_deblock[k] & (MASK_CUR << (ij+2)) ? clip[POS_CUR] : 0;
r->rdsp.rv40_h_loop_filter(C+4*s->uvlinesize, s->uvlinesize, i*8,
clip_bot,
clip_cur,
alpha, beta, betaC, 1, 0);
}
if((c_v_deblock[k] & (MASK_CUR << ij)) && (i || !(mb_strong[POS_CUR] || mb_strong[POS_LEFT]))){
if(!i)
clip_left = uvcbp[POS_LEFT][k] & (MASK_CUR << (2*j+1)) ? clip[POS_LEFT] : 0;
else
clip_left = c_to_deblock[k] & (MASK_CUR << (ij-1)) ? clip[POS_CUR] : 0;
r->rdsp.rv40_v_loop_filter(C, s->uvlinesize, j*8,
clip_cur,
clip_left,
alpha, beta, betaC, 1, 0);
}
if(!j && c_h_deblock[k] & (MASK_CUR << ij) && (mb_strong[POS_CUR] || mb_strong[POS_TOP])){
int clip_top = uvcbp[POS_TOP][k] & (MASK_CUR << (ij+2)) ? clip[POS_TOP] : 0;
r->rdsp.rv40_h_loop_filter(C, s->uvlinesize, i*8,
clip_cur,
clip_top,
alpha, beta, betaC, 1, 1);
}
if(c_v_deblock[k] & (MASK_CUR << ij) && !i && (mb_strong[POS_CUR] || mb_strong[POS_LEFT])){
clip_left = uvcbp[POS_LEFT][k] & (MASK_CUR << (2*j+1)) ? clip[POS_LEFT] : 0;
r->rdsp.rv40_v_loop_filter(C, s->uvlinesize, j*8,
clip_cur,
clip_left,
alpha, beta, betaC, 1, 1);
}
}
}
}
}
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(RV34DecContext *VAR_0, int VAR_1)
{
MpegEncContext *s = &VAR_0->s;
int VAR_2, VAR_3;
int VAR_4, VAR_5, VAR_6;
uint8_t *Y, *C;
int VAR_7, VAR_8, VAR_9, VAR_10;
int VAR_11;
int VAR_12[4];
int VAR_13[4];
int VAR_14[4];
int VAR_15[4];
int VAR_16[4][2];
int VAR_17[4];
VAR_2 = VAR_1 * s->mb_stride;
for(VAR_3 = 0; VAR_3 < s->mb_width; VAR_3++, VAR_2++){
int VAR_12 = s->current_picture_ptr->f.mb_type[VAR_2];
if(IS_INTRA(VAR_12) || IS_SEPARATE_DC(VAR_12))
VAR_0->cbp_luma [VAR_2] = VAR_0->deblock_coefs[VAR_2] = 0xFFFF;
if(IS_INTRA(VAR_12))
VAR_0->cbp_chroma[VAR_2] = 0xFF;
}
VAR_2 = VAR_1 * s->mb_stride;
for(VAR_3 = 0; VAR_3 < s->mb_width; VAR_3++, VAR_2++){
int y_h_deblock, y_v_deblock;
int c_v_deblock[2], c_h_deblock[2];
int clip_left;
int avail[4];
int y_to_deblock, c_to_deblock[2];
VAR_11 = s->current_picture_ptr->f.qscale_table[VAR_2];
VAR_7 = rv40_alpha_tab[VAR_11];
VAR_8 = rv40_beta_tab [VAR_11];
VAR_9 = VAR_10 = VAR_8 * 3;
if(s->width * s->height <= 176*144)
VAR_9 += VAR_8;
avail[0] = 1;
avail[1] = VAR_1;
avail[2] = VAR_3;
avail[3] = VAR_1 < s->mb_height - 1;
for(VAR_4 = 0; VAR_4 < 4; VAR_4++){
if(avail[VAR_4]){
int pos = VAR_2 + neighbour_offs_x[VAR_4] + neighbour_offs_y[VAR_4]*s->mb_stride;
VAR_17[VAR_4] = VAR_0->deblock_coefs[pos];
VAR_12 [VAR_4] = s->current_picture_ptr->f.mb_type[pos];
VAR_15 [VAR_4] = VAR_0->cbp_luma[pos];
VAR_16[VAR_4][0] = VAR_0->cbp_chroma[pos] & 0xF;
VAR_16[VAR_4][1] = VAR_0->cbp_chroma[pos] >> 4;
}else{
VAR_17[VAR_4] = 0;
VAR_12 [VAR_4] = VAR_12[0];
VAR_15 [VAR_4] = 0;
VAR_16[VAR_4][0] = VAR_16[VAR_4][1] = 0;
}
VAR_13[VAR_4] = IS_INTRA(VAR_12[VAR_4]) || IS_SEPARATE_DC(VAR_12[VAR_4]);
VAR_14[VAR_4] = rv40_filter_clip_tbl[VAR_13[VAR_4] + 1][VAR_11];
}
y_to_deblock = VAR_17[POS_CUR]
| (VAR_17[POS_BOTTOM] << 16);
y_h_deblock = y_to_deblock
| ((VAR_15[POS_CUR] << 4) & ~MASK_Y_TOP_ROW)
| ((VAR_15[POS_TOP] & MASK_Y_LAST_ROW) >> 12);
y_v_deblock = y_to_deblock
| ((VAR_15[POS_CUR] << 1) & ~MASK_Y_LEFT_COL)
| ((VAR_15[POS_LEFT] & MASK_Y_RIGHT_COL) >> 3);
if(!VAR_3)
y_v_deblock &= ~MASK_Y_LEFT_COL;
if(!VAR_1)
y_h_deblock &= ~MASK_Y_TOP_ROW;
if(VAR_1 == s->mb_height - 1 || (VAR_13[POS_CUR] || VAR_13[POS_BOTTOM]))
y_h_deblock &= ~(MASK_Y_TOP_ROW << 16);
for(VAR_4 = 0; VAR_4 < 2; VAR_4++){
c_to_deblock[VAR_4] = (VAR_16[POS_BOTTOM][VAR_4] << 4) | VAR_16[POS_CUR][VAR_4];
c_v_deblock[VAR_4] = c_to_deblock[VAR_4]
| ((VAR_16[POS_CUR] [VAR_4] << 1) & ~MASK_C_LEFT_COL)
| ((VAR_16[POS_LEFT][VAR_4] & MASK_C_RIGHT_COL) >> 1);
c_h_deblock[VAR_4] = c_to_deblock[VAR_4]
| ((VAR_16[POS_TOP][VAR_4] & MASK_C_LAST_ROW) >> 2)
| (VAR_16[POS_CUR][VAR_4] << 2);
if(!VAR_3)
c_v_deblock[VAR_4] &= ~MASK_C_LEFT_COL;
if(!VAR_1)
c_h_deblock[VAR_4] &= ~MASK_C_TOP_ROW;
if(VAR_1 == s->mb_height - 1 || VAR_13[POS_CUR] || VAR_13[POS_BOTTOM])
c_h_deblock[VAR_4] &= ~(MASK_C_TOP_ROW << 4);
}
for(VAR_5 = 0; VAR_5 < 16; VAR_5 += 4){
Y = s->current_picture_ptr->f.data[0] + VAR_3*16 + (VAR_1*16 + VAR_5) * s->linesize;
for(VAR_4 = 0; VAR_4 < 4; VAR_4++, Y += 4){
int ij = VAR_4 + VAR_5;
int clip_cur = y_to_deblock & (MASK_CUR << ij) ? VAR_14[POS_CUR] : 0;
int dither = VAR_5 ? ij : VAR_4*4;
if(y_h_deblock & (MASK_BOTTOM << ij)){
VAR_0->rdsp.rv40_h_loop_filter(Y+4*s->linesize, s->linesize, dither,
y_to_deblock & (MASK_BOTTOM << ij) ? VAR_14[POS_CUR] : 0,
clip_cur,
VAR_7, VAR_8, VAR_9, 0, 0);
}
if(y_v_deblock & (MASK_CUR << ij) && (VAR_4 || !(VAR_13[POS_CUR] || VAR_13[POS_LEFT]))){
if(!VAR_4)
clip_left = VAR_17[POS_LEFT] & (MASK_RIGHT << VAR_5) ? VAR_14[POS_LEFT] : 0;
else
clip_left = y_to_deblock & (MASK_CUR << (ij-1)) ? VAR_14[POS_CUR] : 0;
VAR_0->rdsp.rv40_v_loop_filter(Y, s->linesize, dither,
clip_cur,
clip_left,
VAR_7, VAR_8, VAR_9, 0, 0);
}
if(!VAR_5 && y_h_deblock & (MASK_CUR << VAR_4) && (VAR_13[POS_CUR] || VAR_13[POS_TOP])){
VAR_0->rdsp.rv40_h_loop_filter(Y, s->linesize, dither,
clip_cur,
VAR_17[POS_TOP] & (MASK_TOP << VAR_4) ? VAR_14[POS_TOP] : 0,
VAR_7, VAR_8, VAR_9, 0, 1);
}
if(y_v_deblock & (MASK_CUR << ij) && !VAR_4 && (VAR_13[POS_CUR] || VAR_13[POS_LEFT])){
clip_left = VAR_17[POS_LEFT] & (MASK_RIGHT << VAR_5) ? VAR_14[POS_LEFT] : 0;
VAR_0->rdsp.rv40_v_loop_filter(Y, s->linesize, dither,
clip_cur,
clip_left,
VAR_7, VAR_8, VAR_9, 0, 1);
}
}
}
for(VAR_6 = 0; VAR_6 < 2; VAR_6++){
for(VAR_5 = 0; VAR_5 < 2; VAR_5++){
C = s->current_picture_ptr->f.data[VAR_6 + 1] + VAR_3*8 + (VAR_1*8 + VAR_5*4) * s->uvlinesize;
for(VAR_4 = 0; VAR_4 < 2; VAR_4++, C += 4){
int ij = VAR_4 + VAR_5*2;
int clip_cur = c_to_deblock[VAR_6] & (MASK_CUR << ij) ? VAR_14[POS_CUR] : 0;
if(c_h_deblock[VAR_6] & (MASK_CUR << (ij+2))){
int clip_bot = c_to_deblock[VAR_6] & (MASK_CUR << (ij+2)) ? VAR_14[POS_CUR] : 0;
VAR_0->rdsp.rv40_h_loop_filter(C+4*s->uvlinesize, s->uvlinesize, VAR_4*8,
clip_bot,
clip_cur,
VAR_7, VAR_8, VAR_10, 1, 0);
}
if((c_v_deblock[VAR_6] & (MASK_CUR << ij)) && (VAR_4 || !(VAR_13[POS_CUR] || VAR_13[POS_LEFT]))){
if(!VAR_4)
clip_left = VAR_16[POS_LEFT][VAR_6] & (MASK_CUR << (2*VAR_5+1)) ? VAR_14[POS_LEFT] : 0;
else
clip_left = c_to_deblock[VAR_6] & (MASK_CUR << (ij-1)) ? VAR_14[POS_CUR] : 0;
VAR_0->rdsp.rv40_v_loop_filter(C, s->uvlinesize, VAR_5*8,
clip_cur,
clip_left,
VAR_7, VAR_8, VAR_10, 1, 0);
}
if(!VAR_5 && c_h_deblock[VAR_6] & (MASK_CUR << ij) && (VAR_13[POS_CUR] || VAR_13[POS_TOP])){
int clip_top = VAR_16[POS_TOP][VAR_6] & (MASK_CUR << (ij+2)) ? VAR_14[POS_TOP] : 0;
VAR_0->rdsp.rv40_h_loop_filter(C, s->uvlinesize, VAR_4*8,
clip_cur,
clip_top,
VAR_7, VAR_8, VAR_10, 1, 1);
}
if(c_v_deblock[VAR_6] & (MASK_CUR << ij) && !VAR_4 && (VAR_13[POS_CUR] || VAR_13[POS_LEFT])){
clip_left = VAR_16[POS_LEFT][VAR_6] & (MASK_CUR << (2*VAR_5+1)) ? VAR_14[POS_LEFT] : 0;
VAR_0->rdsp.rv40_v_loop_filter(C, s->uvlinesize, VAR_5*8,
clip_cur,
clip_left,
VAR_7, VAR_8, VAR_10, 1, 1);
}
}
}
}
}
}
|
[
"static void FUNC_0(RV34DecContext *VAR_0, int VAR_1)\n{",
"MpegEncContext *s = &VAR_0->s;",
"int VAR_2, VAR_3;",
"int VAR_4, VAR_5, VAR_6;",
"uint8_t *Y, *C;",
"int VAR_7, VAR_8, VAR_9, VAR_10;",
"int VAR_11;",
"int VAR_12[4];",
"int VAR_13[4];",
"int VAR_14[4];",
"int VAR_15[4];",
"int VAR_16[4][2];",
"int VAR_17[4];",
"VAR_2 = VAR_1 * s->mb_stride;",
"for(VAR_3 = 0; VAR_3 < s->mb_width; VAR_3++, VAR_2++){",
"int VAR_12 = s->current_picture_ptr->f.mb_type[VAR_2];",
"if(IS_INTRA(VAR_12) || IS_SEPARATE_DC(VAR_12))\nVAR_0->cbp_luma [VAR_2] = VAR_0->deblock_coefs[VAR_2] = 0xFFFF;",
"if(IS_INTRA(VAR_12))\nVAR_0->cbp_chroma[VAR_2] = 0xFF;",
"}",
"VAR_2 = VAR_1 * s->mb_stride;",
"for(VAR_3 = 0; VAR_3 < s->mb_width; VAR_3++, VAR_2++){",
"int y_h_deblock, y_v_deblock;",
"int c_v_deblock[2], c_h_deblock[2];",
"int clip_left;",
"int avail[4];",
"int y_to_deblock, c_to_deblock[2];",
"VAR_11 = s->current_picture_ptr->f.qscale_table[VAR_2];",
"VAR_7 = rv40_alpha_tab[VAR_11];",
"VAR_8 = rv40_beta_tab [VAR_11];",
"VAR_9 = VAR_10 = VAR_8 * 3;",
"if(s->width * s->height <= 176*144)\nVAR_9 += VAR_8;",
"avail[0] = 1;",
"avail[1] = VAR_1;",
"avail[2] = VAR_3;",
"avail[3] = VAR_1 < s->mb_height - 1;",
"for(VAR_4 = 0; VAR_4 < 4; VAR_4++){",
"if(avail[VAR_4]){",
"int pos = VAR_2 + neighbour_offs_x[VAR_4] + neighbour_offs_y[VAR_4]*s->mb_stride;",
"VAR_17[VAR_4] = VAR_0->deblock_coefs[pos];",
"VAR_12 [VAR_4] = s->current_picture_ptr->f.mb_type[pos];",
"VAR_15 [VAR_4] = VAR_0->cbp_luma[pos];",
"VAR_16[VAR_4][0] = VAR_0->cbp_chroma[pos] & 0xF;",
"VAR_16[VAR_4][1] = VAR_0->cbp_chroma[pos] >> 4;",
"}else{",
"VAR_17[VAR_4] = 0;",
"VAR_12 [VAR_4] = VAR_12[0];",
"VAR_15 [VAR_4] = 0;",
"VAR_16[VAR_4][0] = VAR_16[VAR_4][1] = 0;",
"}",
"VAR_13[VAR_4] = IS_INTRA(VAR_12[VAR_4]) || IS_SEPARATE_DC(VAR_12[VAR_4]);",
"VAR_14[VAR_4] = rv40_filter_clip_tbl[VAR_13[VAR_4] + 1][VAR_11];",
"}",
"y_to_deblock = VAR_17[POS_CUR]\n| (VAR_17[POS_BOTTOM] << 16);",
"y_h_deblock = y_to_deblock\n| ((VAR_15[POS_CUR] << 4) & ~MASK_Y_TOP_ROW)\n| ((VAR_15[POS_TOP] & MASK_Y_LAST_ROW) >> 12);",
"y_v_deblock = y_to_deblock\n| ((VAR_15[POS_CUR] << 1) & ~MASK_Y_LEFT_COL)\n| ((VAR_15[POS_LEFT] & MASK_Y_RIGHT_COL) >> 3);",
"if(!VAR_3)\ny_v_deblock &= ~MASK_Y_LEFT_COL;",
"if(!VAR_1)\ny_h_deblock &= ~MASK_Y_TOP_ROW;",
"if(VAR_1 == s->mb_height - 1 || (VAR_13[POS_CUR] || VAR_13[POS_BOTTOM]))\ny_h_deblock &= ~(MASK_Y_TOP_ROW << 16);",
"for(VAR_4 = 0; VAR_4 < 2; VAR_4++){",
"c_to_deblock[VAR_4] = (VAR_16[POS_BOTTOM][VAR_4] << 4) | VAR_16[POS_CUR][VAR_4];",
"c_v_deblock[VAR_4] = c_to_deblock[VAR_4]\n| ((VAR_16[POS_CUR] [VAR_4] << 1) & ~MASK_C_LEFT_COL)\n| ((VAR_16[POS_LEFT][VAR_4] & MASK_C_RIGHT_COL) >> 1);",
"c_h_deblock[VAR_4] = c_to_deblock[VAR_4]\n| ((VAR_16[POS_TOP][VAR_4] & MASK_C_LAST_ROW) >> 2)\n| (VAR_16[POS_CUR][VAR_4] << 2);",
"if(!VAR_3)\nc_v_deblock[VAR_4] &= ~MASK_C_LEFT_COL;",
"if(!VAR_1)\nc_h_deblock[VAR_4] &= ~MASK_C_TOP_ROW;",
"if(VAR_1 == s->mb_height - 1 || VAR_13[POS_CUR] || VAR_13[POS_BOTTOM])\nc_h_deblock[VAR_4] &= ~(MASK_C_TOP_ROW << 4);",
"}",
"for(VAR_5 = 0; VAR_5 < 16; VAR_5 += 4){",
"Y = s->current_picture_ptr->f.data[0] + VAR_3*16 + (VAR_1*16 + VAR_5) * s->linesize;",
"for(VAR_4 = 0; VAR_4 < 4; VAR_4++, Y += 4){",
"int ij = VAR_4 + VAR_5;",
"int clip_cur = y_to_deblock & (MASK_CUR << ij) ? VAR_14[POS_CUR] : 0;",
"int dither = VAR_5 ? ij : VAR_4*4;",
"if(y_h_deblock & (MASK_BOTTOM << ij)){",
"VAR_0->rdsp.rv40_h_loop_filter(Y+4*s->linesize, s->linesize, dither,\ny_to_deblock & (MASK_BOTTOM << ij) ? VAR_14[POS_CUR] : 0,\nclip_cur,\nVAR_7, VAR_8, VAR_9, 0, 0);",
"}",
"if(y_v_deblock & (MASK_CUR << ij) && (VAR_4 || !(VAR_13[POS_CUR] || VAR_13[POS_LEFT]))){",
"if(!VAR_4)\nclip_left = VAR_17[POS_LEFT] & (MASK_RIGHT << VAR_5) ? VAR_14[POS_LEFT] : 0;",
"else\nclip_left = y_to_deblock & (MASK_CUR << (ij-1)) ? VAR_14[POS_CUR] : 0;",
"VAR_0->rdsp.rv40_v_loop_filter(Y, s->linesize, dither,\nclip_cur,\nclip_left,\nVAR_7, VAR_8, VAR_9, 0, 0);",
"}",
"if(!VAR_5 && y_h_deblock & (MASK_CUR << VAR_4) && (VAR_13[POS_CUR] || VAR_13[POS_TOP])){",
"VAR_0->rdsp.rv40_h_loop_filter(Y, s->linesize, dither,\nclip_cur,\nVAR_17[POS_TOP] & (MASK_TOP << VAR_4) ? VAR_14[POS_TOP] : 0,\nVAR_7, VAR_8, VAR_9, 0, 1);",
"}",
"if(y_v_deblock & (MASK_CUR << ij) && !VAR_4 && (VAR_13[POS_CUR] || VAR_13[POS_LEFT])){",
"clip_left = VAR_17[POS_LEFT] & (MASK_RIGHT << VAR_5) ? VAR_14[POS_LEFT] : 0;",
"VAR_0->rdsp.rv40_v_loop_filter(Y, s->linesize, dither,\nclip_cur,\nclip_left,\nVAR_7, VAR_8, VAR_9, 0, 1);",
"}",
"}",
"}",
"for(VAR_6 = 0; VAR_6 < 2; VAR_6++){",
"for(VAR_5 = 0; VAR_5 < 2; VAR_5++){",
"C = s->current_picture_ptr->f.data[VAR_6 + 1] + VAR_3*8 + (VAR_1*8 + VAR_5*4) * s->uvlinesize;",
"for(VAR_4 = 0; VAR_4 < 2; VAR_4++, C += 4){",
"int ij = VAR_4 + VAR_5*2;",
"int clip_cur = c_to_deblock[VAR_6] & (MASK_CUR << ij) ? VAR_14[POS_CUR] : 0;",
"if(c_h_deblock[VAR_6] & (MASK_CUR << (ij+2))){",
"int clip_bot = c_to_deblock[VAR_6] & (MASK_CUR << (ij+2)) ? VAR_14[POS_CUR] : 0;",
"VAR_0->rdsp.rv40_h_loop_filter(C+4*s->uvlinesize, s->uvlinesize, VAR_4*8,\nclip_bot,\nclip_cur,\nVAR_7, VAR_8, VAR_10, 1, 0);",
"}",
"if((c_v_deblock[VAR_6] & (MASK_CUR << ij)) && (VAR_4 || !(VAR_13[POS_CUR] || VAR_13[POS_LEFT]))){",
"if(!VAR_4)\nclip_left = VAR_16[POS_LEFT][VAR_6] & (MASK_CUR << (2*VAR_5+1)) ? VAR_14[POS_LEFT] : 0;",
"else\nclip_left = c_to_deblock[VAR_6] & (MASK_CUR << (ij-1)) ? VAR_14[POS_CUR] : 0;",
"VAR_0->rdsp.rv40_v_loop_filter(C, s->uvlinesize, VAR_5*8,\nclip_cur,\nclip_left,\nVAR_7, VAR_8, VAR_10, 1, 0);",
"}",
"if(!VAR_5 && c_h_deblock[VAR_6] & (MASK_CUR << ij) && (VAR_13[POS_CUR] || VAR_13[POS_TOP])){",
"int clip_top = VAR_16[POS_TOP][VAR_6] & (MASK_CUR << (ij+2)) ? VAR_14[POS_TOP] : 0;",
"VAR_0->rdsp.rv40_h_loop_filter(C, s->uvlinesize, VAR_4*8,\nclip_cur,\nclip_top,\nVAR_7, VAR_8, VAR_10, 1, 1);",
"}",
"if(c_v_deblock[VAR_6] & (MASK_CUR << ij) && !VAR_4 && (VAR_13[POS_CUR] || VAR_13[POS_LEFT])){",
"clip_left = VAR_16[POS_LEFT][VAR_6] & (MASK_CUR << (2*VAR_5+1)) ? VAR_14[POS_LEFT] : 0;",
"VAR_0->rdsp.rv40_v_loop_filter(C, s->uvlinesize, VAR_5*8,\nclip_cur,\nclip_left,\nVAR_7, VAR_8, VAR_10, 1, 1);",
"}",
"}",
"}",
"}",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
27
],
[
29
],
[
43
],
[
53
],
[
65
],
[
69
],
[
71
],
[
73
],
[
75,
77
],
[
79,
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109,
111
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149
],
[
151
],
[
153
],
[
155
],
[
157,
159
],
[
173,
175,
177
],
[
191,
193,
195
],
[
197,
199
],
[
201,
203
],
[
205,
207
],
[
215
],
[
217
],
[
219,
221,
223
],
[
225,
227,
229
],
[
231,
233
],
[
235,
237
],
[
239,
241
],
[
243
],
[
247
],
[
249
],
[
251
],
[
253
],
[
255
],
[
257
],
[
265
],
[
267,
269,
271,
273
],
[
275
],
[
279
],
[
281,
283
],
[
285,
287
],
[
289,
291,
293,
295
],
[
297
],
[
301
],
[
303,
305,
307,
309
],
[
311
],
[
315
],
[
317
],
[
319,
321,
323,
325
],
[
327
],
[
329
],
[
331
],
[
333
],
[
335
],
[
337
],
[
339
],
[
341
],
[
343
],
[
345
],
[
347
],
[
349,
351,
353,
355
],
[
357
],
[
359
],
[
361,
363
],
[
365,
367
],
[
369,
371,
373,
375
],
[
377
],
[
379
],
[
381
],
[
383,
385,
387,
389
],
[
391
],
[
393
],
[
395
],
[
397,
399,
401,
403
],
[
405
],
[
407
],
[
409
],
[
411
],
[
413
],
[
415
]
] |
7,217 |
static void bdrv_replace_child(BdrvChild *child, BlockDriverState *new_bs)
{
BlockDriverState *old_bs = child->bs;
if (old_bs) {
if (old_bs->quiesce_counter && child->role->drained_end) {
child->role->drained_end(child);
}
QLIST_REMOVE(child, next_parent);
}
child->bs = new_bs;
if (new_bs) {
QLIST_INSERT_HEAD(&new_bs->parents, child, next_parent);
if (new_bs->quiesce_counter && child->role->drained_begin) {
child->role->drained_begin(child);
}
}
}
| false |
qemu
|
33a610c398603efafd954c706ba07850835a5098
|
static void bdrv_replace_child(BdrvChild *child, BlockDriverState *new_bs)
{
BlockDriverState *old_bs = child->bs;
if (old_bs) {
if (old_bs->quiesce_counter && child->role->drained_end) {
child->role->drained_end(child);
}
QLIST_REMOVE(child, next_parent);
}
child->bs = new_bs;
if (new_bs) {
QLIST_INSERT_HEAD(&new_bs->parents, child, next_parent);
if (new_bs->quiesce_counter && child->role->drained_begin) {
child->role->drained_begin(child);
}
}
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(BdrvChild *VAR_0, BlockDriverState *VAR_1)
{
BlockDriverState *old_bs = VAR_0->bs;
if (old_bs) {
if (old_bs->quiesce_counter && VAR_0->role->drained_end) {
VAR_0->role->drained_end(VAR_0);
}
QLIST_REMOVE(VAR_0, next_parent);
}
VAR_0->bs = VAR_1;
if (VAR_1) {
QLIST_INSERT_HEAD(&VAR_1->parents, VAR_0, next_parent);
if (VAR_1->quiesce_counter && VAR_0->role->drained_begin) {
VAR_0->role->drained_begin(VAR_0);
}
}
}
|
[
"static void FUNC_0(BdrvChild *VAR_0, BlockDriverState *VAR_1)\n{",
"BlockDriverState *old_bs = VAR_0->bs;",
"if (old_bs) {",
"if (old_bs->quiesce_counter && VAR_0->role->drained_end) {",
"VAR_0->role->drained_end(VAR_0);",
"}",
"QLIST_REMOVE(VAR_0, next_parent);",
"}",
"VAR_0->bs = VAR_1;",
"if (VAR_1) {",
"QLIST_INSERT_HEAD(&VAR_1->parents, VAR_0, next_parent);",
"if (VAR_1->quiesce_counter && VAR_0->role->drained_begin) {",
"VAR_0->role->drained_begin(VAR_0);",
"}",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
]
] |
7,219 |
void qemu_ram_free(ram_addr_t addr)
{
RAMBlock *block;
/* This assumes the iothread lock is taken here too. */
qemu_mutex_lock_ramlist();
QTAILQ_FOREACH(block, &ram_list.blocks, next) {
if (addr == block->offset) {
QTAILQ_REMOVE(&ram_list.blocks, block, next);
ram_list.mru_block = NULL;
ram_list.version++;
if (block->flags & RAM_PREALLOC_MASK) {
;
} else if (xen_enabled()) {
xen_invalidate_map_cache_entry(block->host);
} else if (mem_path) {
#if defined (__linux__) && !defined(TARGET_S390X)
if (block->fd) {
munmap(block->host, block->length);
close(block->fd);
} else {
qemu_anon_ram_free(block->host, block->length);
}
#else
abort();
#endif
} else {
qemu_anon_ram_free(block->host, block->length);
}
g_free(block);
break;
}
}
qemu_mutex_unlock_ramlist();
}
| false |
qemu
|
3435f39513a104294b5e3bbf3612047028d25cfc
|
void qemu_ram_free(ram_addr_t addr)
{
RAMBlock *block;
qemu_mutex_lock_ramlist();
QTAILQ_FOREACH(block, &ram_list.blocks, next) {
if (addr == block->offset) {
QTAILQ_REMOVE(&ram_list.blocks, block, next);
ram_list.mru_block = NULL;
ram_list.version++;
if (block->flags & RAM_PREALLOC_MASK) {
;
} else if (xen_enabled()) {
xen_invalidate_map_cache_entry(block->host);
} else if (mem_path) {
#if defined (__linux__) && !defined(TARGET_S390X)
if (block->fd) {
munmap(block->host, block->length);
close(block->fd);
} else {
qemu_anon_ram_free(block->host, block->length);
}
#else
abort();
#endif
} else {
qemu_anon_ram_free(block->host, block->length);
}
g_free(block);
break;
}
}
qemu_mutex_unlock_ramlist();
}
|
{
"code": [],
"line_no": []
}
|
void FUNC_0(ram_addr_t VAR_0)
{
RAMBlock *block;
qemu_mutex_lock_ramlist();
QTAILQ_FOREACH(block, &ram_list.blocks, next) {
if (VAR_0 == block->offset) {
QTAILQ_REMOVE(&ram_list.blocks, block, next);
ram_list.mru_block = NULL;
ram_list.version++;
if (block->flags & RAM_PREALLOC_MASK) {
;
} else if (xen_enabled()) {
xen_invalidate_map_cache_entry(block->host);
} else if (mem_path) {
#if defined (__linux__) && !defined(TARGET_S390X)
if (block->fd) {
munmap(block->host, block->length);
close(block->fd);
} else {
qemu_anon_ram_free(block->host, block->length);
}
#else
abort();
#endif
} else {
qemu_anon_ram_free(block->host, block->length);
}
g_free(block);
break;
}
}
qemu_mutex_unlock_ramlist();
}
|
[
"void FUNC_0(ram_addr_t VAR_0)\n{",
"RAMBlock *block;",
"qemu_mutex_lock_ramlist();",
"QTAILQ_FOREACH(block, &ram_list.blocks, next) {",
"if (VAR_0 == block->offset) {",
"QTAILQ_REMOVE(&ram_list.blocks, block, next);",
"ram_list.mru_block = NULL;",
"ram_list.version++;",
"if (block->flags & RAM_PREALLOC_MASK) {",
";",
"} else if (xen_enabled()) {",
"xen_invalidate_map_cache_entry(block->host);",
"} else if (mem_path) {",
"#if defined (__linux__) && !defined(TARGET_S390X)\nif (block->fd) {",
"munmap(block->host, block->length);",
"close(block->fd);",
"} else {",
"qemu_anon_ram_free(block->host, block->length);",
"}",
"#else\nabort();",
"#endif\n} else {",
"qemu_anon_ram_free(block->host, block->length);",
"}",
"g_free(block);",
"break;",
"}",
"}",
"qemu_mutex_unlock_ramlist();",
"}"
] |
[
0,
0,
0,
0,
0,
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
],
[
27
],
[
29
],
[
31
],
[
33,
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47,
49
],
[
51,
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
71
]
] |
7,220 |
static int block_job_finish_sync(BlockJob *job,
void (*finish)(BlockJob *, Error **errp),
Error **errp)
{
BlockDriverState *bs = job->bs;
Error *local_err = NULL;
int ret;
assert(bs->job == job);
block_job_ref(job);
finish(job, &local_err);
if (local_err) {
error_propagate(errp, local_err);
block_job_unref(job);
return -EBUSY;
}
while (!job->completed) {
aio_poll(bdrv_get_aio_context(bs), true);
}
ret = (job->cancelled && job->ret == 0) ? -ECANCELED : job->ret;
block_job_unref(job);
return ret;
}
| false |
qemu
|
794f01414f9f4c4d0c6f1961154674961941c197
|
static int block_job_finish_sync(BlockJob *job,
void (*finish)(BlockJob *, Error **errp),
Error **errp)
{
BlockDriverState *bs = job->bs;
Error *local_err = NULL;
int ret;
assert(bs->job == job);
block_job_ref(job);
finish(job, &local_err);
if (local_err) {
error_propagate(errp, local_err);
block_job_unref(job);
return -EBUSY;
}
while (!job->completed) {
aio_poll(bdrv_get_aio_context(bs), true);
}
ret = (job->cancelled && job->ret == 0) ? -ECANCELED : job->ret;
block_job_unref(job);
return ret;
}
|
{
"code": [],
"line_no": []
}
|
VAR_2staticVAR_2 VAR_2intVAR_2 VAR_2block_job_finish_syncVAR_2(VAR_2BlockJobVAR_2 *VAR_2VAR_0VAR_2,
VAR_2voidVAR_2 (*VAR_2VAR_1VAR_2)(VAR_2BlockJobVAR_2 *, VAR_2ErrorVAR_2 **VAR_2errpVAR_2),
VAR_2ErrorVAR_2 **VAR_2errpVAR_2)
{
VAR_2BlockDriverStateVAR_2 *VAR_2bsVAR_2 = VAR_2VAR_0VAR_2->VAR_2bsVAR_2;
VAR_2ErrorVAR_2 *VAR_2local_errVAR_2 = VAR_2NULLVAR_2;
VAR_2intVAR_2 VAR_2retVAR_2;
VAR_2assertVAR_2(VAR_2bsVAR_2->VAR_2VAR_0VAR_2 == VAR_2VAR_0VAR_2);
VAR_2block_job_refVAR_2(VAR_2VAR_0VAR_2);
VAR_2VAR_1VAR_2(VAR_2VAR_0VAR_2, &VAR_2local_errVAR_2);
VAR_2ifVAR_2 (VAR_2local_errVAR_2) {
VAR_2error_propagateVAR_2(VAR_2errpVAR_2, VAR_2local_errVAR_2);
VAR_2block_job_unrefVAR_2(VAR_2VAR_0VAR_2);
VAR_2returnVAR_2 -VAR_2EBUSYVAR_2;
}
VAR_2whileVAR_2 (!VAR_2VAR_0VAR_2->VAR_2completedVAR_2) {
VAR_2aio_pollVAR_2(VAR_2bdrv_get_aio_contextVAR_2(VAR_2bsVAR_2), VAR_2trueVAR_2);
}
VAR_2retVAR_2 = (VAR_2VAR_0VAR_2->VAR_2cancelledVAR_2 && VAR_2VAR_0VAR_2->VAR_2retVAR_2 == VAR_20VAR_2) ? -VAR_2ECANCELEDVAR_2 : VAR_2VAR_0VAR_2->VAR_2retVAR_2;
VAR_2block_job_unrefVAR_2(VAR_2VAR_0VAR_2);
VAR_2returnVAR_2 VAR_2retVAR_2;
}
|
[
"VAR_2staticVAR_2 VAR_2intVAR_2 VAR_2block_job_finish_syncVAR_2(VAR_2BlockJobVAR_2 *VAR_2VAR_0VAR_2,\nVAR_2voidVAR_2 (*VAR_2VAR_1VAR_2)(VAR_2BlockJobVAR_2 *, VAR_2ErrorVAR_2 **VAR_2errpVAR_2),\nVAR_2ErrorVAR_2 **VAR_2errpVAR_2)\n{",
"VAR_2BlockDriverStateVAR_2 *VAR_2bsVAR_2 = VAR_2VAR_0VAR_2->VAR_2bsVAR_2;",
"VAR_2ErrorVAR_2 *VAR_2local_errVAR_2 = VAR_2NULLVAR_2;",
"VAR_2intVAR_2 VAR_2retVAR_2;",
"VAR_2assertVAR_2(VAR_2bsVAR_2->VAR_2VAR_0VAR_2 == VAR_2VAR_0VAR_2);",
"VAR_2block_job_refVAR_2(VAR_2VAR_0VAR_2);",
"VAR_2VAR_1VAR_2(VAR_2VAR_0VAR_2, &VAR_2local_errVAR_2);",
"VAR_2ifVAR_2 (VAR_2local_errVAR_2) {",
"VAR_2error_propagateVAR_2(VAR_2errpVAR_2, VAR_2local_errVAR_2);",
"VAR_2block_job_unrefVAR_2(VAR_2VAR_0VAR_2);",
"VAR_2returnVAR_2 -VAR_2EBUSYVAR_2;",
"}",
"VAR_2whileVAR_2 (!VAR_2VAR_0VAR_2->VAR_2completedVAR_2) {",
"VAR_2aio_pollVAR_2(VAR_2bdrv_get_aio_contextVAR_2(VAR_2bsVAR_2), VAR_2trueVAR_2);",
"}",
"VAR_2retVAR_2 = (VAR_2VAR_0VAR_2->VAR_2cancelledVAR_2 && VAR_2VAR_0VAR_2->VAR_2retVAR_2 == VAR_20VAR_2) ? -VAR_2ECANCELEDVAR_2 : VAR_2VAR_0VAR_2->VAR_2retVAR_2;",
"VAR_2block_job_unrefVAR_2(VAR_2VAR_0VAR_2);",
"VAR_2returnVAR_2 VAR_2retVAR_2;",
"}"
] |
[
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
]
] |
7,221 |
static uint32_t vmdk_read_cid(BlockDriverState *bs, int parent)
{
char desc[DESC_SIZE];
uint32_t cid;
const char *p_name, *cid_str;
size_t cid_str_size;
BDRVVmdkState *s = bs->opaque;
if (bdrv_pread(bs->file, s->desc_offset, desc, DESC_SIZE) != DESC_SIZE) {
return 0;
}
if (parent) {
cid_str = "parentCID";
cid_str_size = sizeof("parentCID");
} else {
cid_str = "CID";
cid_str_size = sizeof("CID");
}
if ((p_name = strstr(desc,cid_str)) != NULL) {
p_name += cid_str_size;
sscanf(p_name,"%x",&cid);
}
return cid;
}
| false |
qemu
|
ae261c86aaed62e7acddafab8262a2bf286d40b7
|
static uint32_t vmdk_read_cid(BlockDriverState *bs, int parent)
{
char desc[DESC_SIZE];
uint32_t cid;
const char *p_name, *cid_str;
size_t cid_str_size;
BDRVVmdkState *s = bs->opaque;
if (bdrv_pread(bs->file, s->desc_offset, desc, DESC_SIZE) != DESC_SIZE) {
return 0;
}
if (parent) {
cid_str = "parentCID";
cid_str_size = sizeof("parentCID");
} else {
cid_str = "CID";
cid_str_size = sizeof("CID");
}
if ((p_name = strstr(desc,cid_str)) != NULL) {
p_name += cid_str_size;
sscanf(p_name,"%x",&cid);
}
return cid;
}
|
{
"code": [],
"line_no": []
}
|
static uint32_t FUNC_0(BlockDriverState *bs, int parent)
{
char VAR_0[DESC_SIZE];
uint32_t cid;
const char *VAR_1, *VAR_2;
size_t cid_str_size;
BDRVVmdkState *s = bs->opaque;
if (bdrv_pread(bs->file, s->desc_offset, VAR_0, DESC_SIZE) != DESC_SIZE) {
return 0;
}
if (parent) {
VAR_2 = "parentCID";
cid_str_size = sizeof("parentCID");
} else {
VAR_2 = "CID";
cid_str_size = sizeof("CID");
}
if ((VAR_1 = strstr(VAR_0,VAR_2)) != NULL) {
VAR_1 += cid_str_size;
sscanf(VAR_1,"%x",&cid);
}
return cid;
}
|
[
"static uint32_t FUNC_0(BlockDriverState *bs, int parent)\n{",
"char VAR_0[DESC_SIZE];",
"uint32_t cid;",
"const char *VAR_1, *VAR_2;",
"size_t cid_str_size;",
"BDRVVmdkState *s = bs->opaque;",
"if (bdrv_pread(bs->file, s->desc_offset, VAR_0, DESC_SIZE) != DESC_SIZE) {",
"return 0;",
"}",
"if (parent) {",
"VAR_2 = \"parentCID\";",
"cid_str_size = sizeof(\"parentCID\");",
"} else {",
"VAR_2 = \"CID\";",
"cid_str_size = sizeof(\"CID\");",
"}",
"if ((VAR_1 = strstr(VAR_0,VAR_2)) != NULL) {",
"VAR_1 += cid_str_size;",
"sscanf(VAR_1,\"%x\",&cid);",
"}",
"return cid;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
19
],
[
21
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
41
],
[
43
],
[
45
],
[
47
],
[
51
],
[
53
]
] |
7,223 |
int qemu_chr_fe_ioctl(CharDriverState *s, int cmd, void *arg)
{
if (!s->chr_ioctl)
return -ENOTSUP;
return s->chr_ioctl(s, cmd, arg);
}
| false |
qemu
|
33577b47c64435fcc2a1bc01c7e82534256f1fc3
|
int qemu_chr_fe_ioctl(CharDriverState *s, int cmd, void *arg)
{
if (!s->chr_ioctl)
return -ENOTSUP;
return s->chr_ioctl(s, cmd, arg);
}
|
{
"code": [],
"line_no": []
}
|
int FUNC_0(CharDriverState *VAR_0, int VAR_1, void *VAR_2)
{
if (!VAR_0->chr_ioctl)
return -ENOTSUP;
return VAR_0->chr_ioctl(VAR_0, VAR_1, VAR_2);
}
|
[
"int FUNC_0(CharDriverState *VAR_0, int VAR_1, void *VAR_2)\n{",
"if (!VAR_0->chr_ioctl)\nreturn -ENOTSUP;",
"return VAR_0->chr_ioctl(VAR_0, VAR_1, VAR_2);",
"}"
] |
[
0,
0,
0,
0
] |
[
[
1,
3
],
[
5,
7
],
[
9
],
[
11
]
] |
7,224 |
static void e1000_pre_save(void *opaque)
{
E1000State *s = opaque;
NetClientState *nc = qemu_get_queue(s->nic);
/* If the mitigation timer is active, emulate a timeout now. */
if (s->mit_timer_on) {
e1000_mit_timer(s);
}
/*
* If link is down and auto-negotiation is supported and ongoing,
* complete auto-negotiation immediately. This allows us to look
* at MII_SR_AUTONEG_COMPLETE to infer link status on load.
*/
if (nc->link_down &&
s->compat_flags & E1000_FLAG_AUTONEG &&
s->phy_reg[PHY_CTRL] & MII_CR_AUTO_NEG_EN &&
s->phy_reg[PHY_CTRL] & MII_CR_RESTART_AUTO_NEG) {
s->phy_reg[PHY_STATUS] |= MII_SR_AUTONEG_COMPLETE;
}
}
| false |
qemu
|
d7a4155265416a1c8f3067b59e68bf5fda1d6215
|
static void e1000_pre_save(void *opaque)
{
E1000State *s = opaque;
NetClientState *nc = qemu_get_queue(s->nic);
if (s->mit_timer_on) {
e1000_mit_timer(s);
}
if (nc->link_down &&
s->compat_flags & E1000_FLAG_AUTONEG &&
s->phy_reg[PHY_CTRL] & MII_CR_AUTO_NEG_EN &&
s->phy_reg[PHY_CTRL] & MII_CR_RESTART_AUTO_NEG) {
s->phy_reg[PHY_STATUS] |= MII_SR_AUTONEG_COMPLETE;
}
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(void *VAR_0)
{
E1000State *s = VAR_0;
NetClientState *nc = qemu_get_queue(s->nic);
if (s->mit_timer_on) {
e1000_mit_timer(s);
}
if (nc->link_down &&
s->compat_flags & E1000_FLAG_AUTONEG &&
s->phy_reg[PHY_CTRL] & MII_CR_AUTO_NEG_EN &&
s->phy_reg[PHY_CTRL] & MII_CR_RESTART_AUTO_NEG) {
s->phy_reg[PHY_STATUS] |= MII_SR_AUTONEG_COMPLETE;
}
}
|
[
"static void FUNC_0(void *VAR_0)\n{",
"E1000State *s = VAR_0;",
"NetClientState *nc = qemu_get_queue(s->nic);",
"if (s->mit_timer_on) {",
"e1000_mit_timer(s);",
"}",
"if (nc->link_down &&\ns->compat_flags & E1000_FLAG_AUTONEG &&\ns->phy_reg[PHY_CTRL] & MII_CR_AUTO_NEG_EN &&\ns->phy_reg[PHY_CTRL] & MII_CR_RESTART_AUTO_NEG) {",
"s->phy_reg[PHY_STATUS] |= MII_SR_AUTONEG_COMPLETE;",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
13
],
[
15
],
[
17
],
[
31,
33,
35,
37
],
[
39
],
[
41
],
[
43
]
] |
7,225 |
START_TEST(invalid_array_comma)
{
QObject *obj = qobject_from_json("[32,}");
fail_unless(obj == NULL);
}
| false |
qemu
|
ef76dc59fa5203d146a2acf85a0ad5a5971a4824
|
START_TEST(invalid_array_comma)
{
QObject *obj = qobject_from_json("[32,}");
fail_unless(obj == NULL);
}
|
{
"code": [],
"line_no": []
}
|
FUNC_0(VAR_0)
{
QObject *obj = qobject_from_json("[32,}");
fail_unless(obj == NULL);
}
|
[
"FUNC_0(VAR_0)\n{",
"QObject *obj = qobject_from_json(\"[32,}\");",
"fail_unless(obj == NULL);",
"}"
] |
[
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
]
] |
7,226 |
static void handle_control_message(VirtIOSerial *vser, void *buf, size_t len)
{
struct VirtIOSerialPort *port;
struct virtio_console_control cpkt, *gcpkt;
uint8_t *buffer;
size_t buffer_len;
gcpkt = buf;
if (len < sizeof(cpkt)) {
/* The guest sent an invalid control packet */
return;
}
cpkt.event = lduw_p(&gcpkt->event);
cpkt.value = lduw_p(&gcpkt->value);
port = find_port_by_id(vser, ldl_p(&gcpkt->id));
if (!port && cpkt.event != VIRTIO_CONSOLE_DEVICE_READY)
return;
switch(cpkt.event) {
case VIRTIO_CONSOLE_DEVICE_READY:
if (!cpkt.value) {
error_report("virtio-serial-bus: Guest failure in adding device %s\n",
vser->bus.qbus.name);
break;
}
/*
* The device is up, we can now tell the device about all the
* ports we have here.
*/
QTAILQ_FOREACH(port, &vser->ports, next) {
send_control_event(port, VIRTIO_CONSOLE_PORT_ADD, 1);
}
break;
case VIRTIO_CONSOLE_PORT_READY:
if (!cpkt.value) {
error_report("virtio-serial-bus: Guest failure in adding port %u for device %s\n",
port->id, vser->bus.qbus.name);
break;
}
/*
* Now that we know the guest asked for the port name, we're
* sure the guest has initialised whatever state is necessary
* for this port. Now's a good time to let the guest know if
* this port is a console port so that the guest can hook it
* up to hvc.
*/
if (port->is_console) {
send_control_event(port, VIRTIO_CONSOLE_CONSOLE_PORT, 1);
}
if (port->name) {
stw_p(&cpkt.event, VIRTIO_CONSOLE_PORT_NAME);
stw_p(&cpkt.value, 1);
buffer_len = sizeof(cpkt) + strlen(port->name) + 1;
buffer = qemu_malloc(buffer_len);
memcpy(buffer, &cpkt, sizeof(cpkt));
memcpy(buffer + sizeof(cpkt), port->name, strlen(port->name));
buffer[buffer_len - 1] = 0;
send_control_msg(port, buffer, buffer_len);
qemu_free(buffer);
}
if (port->host_connected) {
send_control_event(port, VIRTIO_CONSOLE_PORT_OPEN, 1);
}
/*
* When the guest has asked us for this information it means
* the guest is all setup and has its virtqueues
* initialised. If some app is interested in knowing about
* this event, let it know.
*/
if (port->info->guest_ready) {
port->info->guest_ready(port);
}
break;
case VIRTIO_CONSOLE_PORT_OPEN:
port->guest_connected = cpkt.value;
if (cpkt.value && port->info->guest_open) {
/* Send the guest opened notification if an app is interested */
port->info->guest_open(port);
}
if (!cpkt.value && port->info->guest_close) {
/* Send the guest closed notification if an app is interested */
port->info->guest_close(port);
}
break;
}
}
| false |
qemu
|
2a3d57ce4278dfd898d8b5639ace21fa4a4fb9bd
|
static void handle_control_message(VirtIOSerial *vser, void *buf, size_t len)
{
struct VirtIOSerialPort *port;
struct virtio_console_control cpkt, *gcpkt;
uint8_t *buffer;
size_t buffer_len;
gcpkt = buf;
if (len < sizeof(cpkt)) {
return;
}
cpkt.event = lduw_p(&gcpkt->event);
cpkt.value = lduw_p(&gcpkt->value);
port = find_port_by_id(vser, ldl_p(&gcpkt->id));
if (!port && cpkt.event != VIRTIO_CONSOLE_DEVICE_READY)
return;
switch(cpkt.event) {
case VIRTIO_CONSOLE_DEVICE_READY:
if (!cpkt.value) {
error_report("virtio-serial-bus: Guest failure in adding device %s\n",
vser->bus.qbus.name);
break;
}
QTAILQ_FOREACH(port, &vser->ports, next) {
send_control_event(port, VIRTIO_CONSOLE_PORT_ADD, 1);
}
break;
case VIRTIO_CONSOLE_PORT_READY:
if (!cpkt.value) {
error_report("virtio-serial-bus: Guest failure in adding port %u for device %s\n",
port->id, vser->bus.qbus.name);
break;
}
if (port->is_console) {
send_control_event(port, VIRTIO_CONSOLE_CONSOLE_PORT, 1);
}
if (port->name) {
stw_p(&cpkt.event, VIRTIO_CONSOLE_PORT_NAME);
stw_p(&cpkt.value, 1);
buffer_len = sizeof(cpkt) + strlen(port->name) + 1;
buffer = qemu_malloc(buffer_len);
memcpy(buffer, &cpkt, sizeof(cpkt));
memcpy(buffer + sizeof(cpkt), port->name, strlen(port->name));
buffer[buffer_len - 1] = 0;
send_control_msg(port, buffer, buffer_len);
qemu_free(buffer);
}
if (port->host_connected) {
send_control_event(port, VIRTIO_CONSOLE_PORT_OPEN, 1);
}
if (port->info->guest_ready) {
port->info->guest_ready(port);
}
break;
case VIRTIO_CONSOLE_PORT_OPEN:
port->guest_connected = cpkt.value;
if (cpkt.value && port->info->guest_open) {
port->info->guest_open(port);
}
if (!cpkt.value && port->info->guest_close) {
port->info->guest_close(port);
}
break;
}
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(VirtIOSerial *VAR_0, void *VAR_1, size_t VAR_2)
{
struct VirtIOSerialPort *VAR_3;
struct virtio_console_control VAR_4, *VAR_5;
uint8_t *buffer;
size_t buffer_len;
VAR_5 = VAR_1;
if (VAR_2 < sizeof(VAR_4)) {
return;
}
VAR_4.event = lduw_p(&VAR_5->event);
VAR_4.value = lduw_p(&VAR_5->value);
VAR_3 = find_port_by_id(VAR_0, ldl_p(&VAR_5->id));
if (!VAR_3 && VAR_4.event != VIRTIO_CONSOLE_DEVICE_READY)
return;
switch(VAR_4.event) {
case VIRTIO_CONSOLE_DEVICE_READY:
if (!VAR_4.value) {
error_report("virtio-serial-bus: Guest failure in adding device %s\n",
VAR_0->bus.qbus.name);
break;
}
QTAILQ_FOREACH(VAR_3, &VAR_0->ports, next) {
send_control_event(VAR_3, VIRTIO_CONSOLE_PORT_ADD, 1);
}
break;
case VIRTIO_CONSOLE_PORT_READY:
if (!VAR_4.value) {
error_report("virtio-serial-bus: Guest failure in adding VAR_3 %u for device %s\n",
VAR_3->id, VAR_0->bus.qbus.name);
break;
}
if (VAR_3->is_console) {
send_control_event(VAR_3, VIRTIO_CONSOLE_CONSOLE_PORT, 1);
}
if (VAR_3->name) {
stw_p(&VAR_4.event, VIRTIO_CONSOLE_PORT_NAME);
stw_p(&VAR_4.value, 1);
buffer_len = sizeof(VAR_4) + strlen(VAR_3->name) + 1;
buffer = qemu_malloc(buffer_len);
memcpy(buffer, &VAR_4, sizeof(VAR_4));
memcpy(buffer + sizeof(VAR_4), VAR_3->name, strlen(VAR_3->name));
buffer[buffer_len - 1] = 0;
send_control_msg(VAR_3, buffer, buffer_len);
qemu_free(buffer);
}
if (VAR_3->host_connected) {
send_control_event(VAR_3, VIRTIO_CONSOLE_PORT_OPEN, 1);
}
if (VAR_3->info->guest_ready) {
VAR_3->info->guest_ready(VAR_3);
}
break;
case VIRTIO_CONSOLE_PORT_OPEN:
VAR_3->guest_connected = VAR_4.value;
if (VAR_4.value && VAR_3->info->guest_open) {
VAR_3->info->guest_open(VAR_3);
}
if (!VAR_4.value && VAR_3->info->guest_close) {
VAR_3->info->guest_close(VAR_3);
}
break;
}
}
|
[
"static void FUNC_0(VirtIOSerial *VAR_0, void *VAR_1, size_t VAR_2)\n{",
"struct VirtIOSerialPort *VAR_3;",
"struct virtio_console_control VAR_4, *VAR_5;",
"uint8_t *buffer;",
"size_t buffer_len;",
"VAR_5 = VAR_1;",
"if (VAR_2 < sizeof(VAR_4)) {",
"return;",
"}",
"VAR_4.event = lduw_p(&VAR_5->event);",
"VAR_4.value = lduw_p(&VAR_5->value);",
"VAR_3 = find_port_by_id(VAR_0, ldl_p(&VAR_5->id));",
"if (!VAR_3 && VAR_4.event != VIRTIO_CONSOLE_DEVICE_READY)\nreturn;",
"switch(VAR_4.event) {",
"case VIRTIO_CONSOLE_DEVICE_READY:\nif (!VAR_4.value) {",
"error_report(\"virtio-serial-bus: Guest failure in adding device %s\\n\",\nVAR_0->bus.qbus.name);",
"break;",
"}",
"QTAILQ_FOREACH(VAR_3, &VAR_0->ports, next) {",
"send_control_event(VAR_3, VIRTIO_CONSOLE_PORT_ADD, 1);",
"}",
"break;",
"case VIRTIO_CONSOLE_PORT_READY:\nif (!VAR_4.value) {",
"error_report(\"virtio-serial-bus: Guest failure in adding VAR_3 %u for device %s\\n\",\nVAR_3->id, VAR_0->bus.qbus.name);",
"break;",
"}",
"if (VAR_3->is_console) {",
"send_control_event(VAR_3, VIRTIO_CONSOLE_CONSOLE_PORT, 1);",
"}",
"if (VAR_3->name) {",
"stw_p(&VAR_4.event, VIRTIO_CONSOLE_PORT_NAME);",
"stw_p(&VAR_4.value, 1);",
"buffer_len = sizeof(VAR_4) + strlen(VAR_3->name) + 1;",
"buffer = qemu_malloc(buffer_len);",
"memcpy(buffer, &VAR_4, sizeof(VAR_4));",
"memcpy(buffer + sizeof(VAR_4), VAR_3->name, strlen(VAR_3->name));",
"buffer[buffer_len - 1] = 0;",
"send_control_msg(VAR_3, buffer, buffer_len);",
"qemu_free(buffer);",
"}",
"if (VAR_3->host_connected) {",
"send_control_event(VAR_3, VIRTIO_CONSOLE_PORT_OPEN, 1);",
"}",
"if (VAR_3->info->guest_ready) {",
"VAR_3->info->guest_ready(VAR_3);",
"}",
"break;",
"case VIRTIO_CONSOLE_PORT_OPEN:\nVAR_3->guest_connected = VAR_4.value;",
"if (VAR_4.value && VAR_3->info->guest_open) {",
"VAR_3->info->guest_open(VAR_3);",
"}",
"if (!VAR_4.value && VAR_3->info->guest_close) {",
"VAR_3->info->guest_close(VAR_3);",
"}",
"break;",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
19
],
[
23
],
[
25
],
[
29
],
[
31
],
[
35
],
[
37,
39
],
[
43
],
[
45,
47
],
[
49,
51
],
[
53
],
[
55
],
[
65
],
[
67
],
[
69
],
[
71
],
[
75,
77
],
[
79,
81
],
[
83
],
[
85
],
[
101
],
[
103
],
[
105
],
[
109
],
[
111
],
[
113
],
[
117
],
[
119
],
[
123
],
[
125
],
[
127
],
[
131
],
[
133
],
[
135
],
[
139
],
[
141
],
[
143
],
[
159
],
[
161
],
[
163
],
[
165
],
[
169,
171
],
[
173
],
[
177
],
[
179
],
[
183
],
[
187
],
[
189
],
[
191
],
[
193
],
[
195
]
] |
7,227 |
static int mov_write_stbl_tag(ByteIOContext *pb, MOVTrack* track)
{
offset_t pos = url_ftell(pb);
put_be32(pb, 0); /* size */
put_tag(pb, "stbl");
mov_write_stsd_tag(pb, track);
mov_write_stts_tag(pb, track);
if (track->enc->codec_type == CODEC_TYPE_VIDEO &&
track->hasKeyframes < track->entry)
mov_write_stss_tag(pb, track);
if (track->enc->codec_type == CODEC_TYPE_VIDEO &&
track->hasBframes)
mov_write_ctts_tag(pb, track);
mov_write_stsc_tag(pb, track);
mov_write_stsz_tag(pb, track);
mov_write_stco_tag(pb, track);
return updateSize(pb, pos);
}
| false |
FFmpeg
|
b371539a3d9be9b05cb9ea8065e8e3617a45b02f
|
static int mov_write_stbl_tag(ByteIOContext *pb, MOVTrack* track)
{
offset_t pos = url_ftell(pb);
put_be32(pb, 0);
put_tag(pb, "stbl");
mov_write_stsd_tag(pb, track);
mov_write_stts_tag(pb, track);
if (track->enc->codec_type == CODEC_TYPE_VIDEO &&
track->hasKeyframes < track->entry)
mov_write_stss_tag(pb, track);
if (track->enc->codec_type == CODEC_TYPE_VIDEO &&
track->hasBframes)
mov_write_ctts_tag(pb, track);
mov_write_stsc_tag(pb, track);
mov_write_stsz_tag(pb, track);
mov_write_stco_tag(pb, track);
return updateSize(pb, pos);
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(ByteIOContext *VAR_0, MOVTrack* VAR_1)
{
offset_t pos = url_ftell(VAR_0);
put_be32(VAR_0, 0);
put_tag(VAR_0, "stbl");
mov_write_stsd_tag(VAR_0, VAR_1);
mov_write_stts_tag(VAR_0, VAR_1);
if (VAR_1->enc->codec_type == CODEC_TYPE_VIDEO &&
VAR_1->hasKeyframes < VAR_1->entry)
mov_write_stss_tag(VAR_0, VAR_1);
if (VAR_1->enc->codec_type == CODEC_TYPE_VIDEO &&
VAR_1->hasBframes)
mov_write_ctts_tag(VAR_0, VAR_1);
mov_write_stsc_tag(VAR_0, VAR_1);
mov_write_stsz_tag(VAR_0, VAR_1);
mov_write_stco_tag(VAR_0, VAR_1);
return updateSize(VAR_0, pos);
}
|
[
"static int FUNC_0(ByteIOContext *VAR_0, MOVTrack* VAR_1)\n{",
"offset_t pos = url_ftell(VAR_0);",
"put_be32(VAR_0, 0);",
"put_tag(VAR_0, \"stbl\");",
"mov_write_stsd_tag(VAR_0, VAR_1);",
"mov_write_stts_tag(VAR_0, VAR_1);",
"if (VAR_1->enc->codec_type == CODEC_TYPE_VIDEO &&\nVAR_1->hasKeyframes < VAR_1->entry)\nmov_write_stss_tag(VAR_0, VAR_1);",
"if (VAR_1->enc->codec_type == CODEC_TYPE_VIDEO &&\nVAR_1->hasBframes)\nmov_write_ctts_tag(VAR_0, VAR_1);",
"mov_write_stsc_tag(VAR_0, VAR_1);",
"mov_write_stsz_tag(VAR_0, VAR_1);",
"mov_write_stco_tag(VAR_0, VAR_1);",
"return updateSize(VAR_0, pos);",
"}"
] |
[
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
]
] |
7,228 |
static void gen_mtpr(int rb, int regno)
{
TCGv tmp;
int data;
if (rb == 31) {
tmp = tcg_const_i64(0);
} else {
tmp = cpu_ir[rb];
}
/* The basic registers are data only, and unknown registers
are read-zero, write-ignore. */
data = cpu_pr_data(regno);
if (data != 0) {
if (data & PR_BYTE) {
tcg_gen_st8_i64(tmp, cpu_env, data & ~PR_BYTE);
} else if (data & PR_LONG) {
tcg_gen_st32_i64(tmp, cpu_env, data & ~PR_LONG);
} else {
tcg_gen_st_i64(tmp, cpu_env, data);
}
}
if (rb == 31) {
tcg_temp_free(tmp);
}
}
| false |
qemu
|
3b4fefd6e65a7bdb994d10a9fa36c19b5749b502
|
static void gen_mtpr(int rb, int regno)
{
TCGv tmp;
int data;
if (rb == 31) {
tmp = tcg_const_i64(0);
} else {
tmp = cpu_ir[rb];
}
data = cpu_pr_data(regno);
if (data != 0) {
if (data & PR_BYTE) {
tcg_gen_st8_i64(tmp, cpu_env, data & ~PR_BYTE);
} else if (data & PR_LONG) {
tcg_gen_st32_i64(tmp, cpu_env, data & ~PR_LONG);
} else {
tcg_gen_st_i64(tmp, cpu_env, data);
}
}
if (rb == 31) {
tcg_temp_free(tmp);
}
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(int VAR_0, int VAR_1)
{
TCGv tmp;
int VAR_2;
if (VAR_0 == 31) {
tmp = tcg_const_i64(0);
} else {
tmp = cpu_ir[VAR_0];
}
VAR_2 = cpu_pr_data(VAR_1);
if (VAR_2 != 0) {
if (VAR_2 & PR_BYTE) {
tcg_gen_st8_i64(tmp, cpu_env, VAR_2 & ~PR_BYTE);
} else if (VAR_2 & PR_LONG) {
tcg_gen_st32_i64(tmp, cpu_env, VAR_2 & ~PR_LONG);
} else {
tcg_gen_st_i64(tmp, cpu_env, VAR_2);
}
}
if (VAR_0 == 31) {
tcg_temp_free(tmp);
}
}
|
[
"static void FUNC_0(int VAR_0, int VAR_1)\n{",
"TCGv tmp;",
"int VAR_2;",
"if (VAR_0 == 31) {",
"tmp = tcg_const_i64(0);",
"} else {",
"tmp = cpu_ir[VAR_0];",
"}",
"VAR_2 = cpu_pr_data(VAR_1);",
"if (VAR_2 != 0) {",
"if (VAR_2 & PR_BYTE) {",
"tcg_gen_st8_i64(tmp, cpu_env, VAR_2 & ~PR_BYTE);",
"} else if (VAR_2 & PR_LONG) {",
"tcg_gen_st32_i64(tmp, cpu_env, VAR_2 & ~PR_LONG);",
"} else {",
"tcg_gen_st_i64(tmp, cpu_env, VAR_2);",
"}",
"}",
"if (VAR_0 == 31) {",
"tcg_temp_free(tmp);",
"}",
"}"
] |
[
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
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
49
],
[
51
],
[
53
],
[
55
]
] |
7,229 |
void qemu_unregister_reset(QEMUResetHandler *func, void *opaque)
{
QEMUResetEntry *re;
TAILQ_FOREACH(re, &reset_handlers, entry) {
if (re->func == func && re->opaque == opaque) {
TAILQ_REMOVE(&reset_handlers, re, entry);
qemu_free(re);
return;
}
}
}
| false |
qemu
|
72cf2d4f0e181d0d3a3122e04129c58a95da713e
|
void qemu_unregister_reset(QEMUResetHandler *func, void *opaque)
{
QEMUResetEntry *re;
TAILQ_FOREACH(re, &reset_handlers, entry) {
if (re->func == func && re->opaque == opaque) {
TAILQ_REMOVE(&reset_handlers, re, entry);
qemu_free(re);
return;
}
}
}
|
{
"code": [],
"line_no": []
}
|
void FUNC_0(QEMUResetHandler *VAR_0, void *VAR_1)
{
QEMUResetEntry *re;
TAILQ_FOREACH(re, &reset_handlers, entry) {
if (re->VAR_0 == VAR_0 && re->VAR_1 == VAR_1) {
TAILQ_REMOVE(&reset_handlers, re, entry);
qemu_free(re);
return;
}
}
}
|
[
"void FUNC_0(QEMUResetHandler *VAR_0, void *VAR_1)\n{",
"QEMUResetEntry *re;",
"TAILQ_FOREACH(re, &reset_handlers, entry) {",
"if (re->VAR_0 == VAR_0 && re->VAR_1 == VAR_1) {",
"TAILQ_REMOVE(&reset_handlers, re, entry);",
"qemu_free(re);",
"return;",
"}",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
]
] |
7,230 |
static void blizzard_reg_write(void *opaque, uint8_t reg, uint16_t value)
{
BlizzardState *s = (BlizzardState *) opaque;
switch (reg) {
case 0x04: /* PLL M-Divider */
s->pll = (value & 0x3f) + 1;
break;
case 0x06: /* PLL Lock Range Control */
s->pll_range = value & 3;
break;
case 0x08: /* PLL Lock Synthesis Control 0 */
s->pll_ctrl &= 0xf00;
s->pll_ctrl |= (value << 0) & 0x0ff;
break;
case 0x0a: /* PLL Lock Synthesis Control 1 */
s->pll_ctrl &= 0x0ff;
s->pll_ctrl |= (value << 8) & 0xf00;
break;
case 0x0c: /* PLL Mode Control 0 */
s->pll_mode = value & 0x77;
if ((value & 3) == 0 || (value & 3) == 3)
fprintf(stderr, "%s: wrong PLL Control bits (%i)\n",
__FUNCTION__, value & 3);
break;
case 0x0e: /* Clock-Source Select */
s->clksel = value & 0xff;
break;
case 0x10: /* Memory Controller Activate */
s->memenable = value & 1;
break;
case 0x14: /* Memory Controller Bank 0 Status Flag */
break;
case 0x18: /* Auto-Refresh Interval Setting 0 */
s->memrefresh &= 0xf00;
s->memrefresh |= (value << 0) & 0x0ff;
break;
case 0x1a: /* Auto-Refresh Interval Setting 1 */
s->memrefresh &= 0x0ff;
s->memrefresh |= (value << 8) & 0xf00;
break;
case 0x1c: /* Power-On Sequence Timing Control */
s->timing[0] = value & 0x7f;
break;
case 0x1e: /* Timing Control 0 */
s->timing[1] = value & 0x17;
break;
case 0x20: /* Timing Control 1 */
s->timing[2] = value & 0x35;
break;
case 0x24: /* Arbitration Priority Control */
s->priority = value & 1;
break;
case 0x28: /* LCD Panel Configuration */
s->lcd_config = value & 0xff;
if (value & (1 << 7))
fprintf(stderr, "%s: data swap not supported!\n", __FUNCTION__);
break;
case 0x2a: /* LCD Horizontal Display Width */
s->x = value << 3;
break;
case 0x2c: /* LCD Horizontal Non-display Period */
s->hndp = value & 0xff;
break;
case 0x2e: /* LCD Vertical Display Height 0 */
s->y &= 0x300;
s->y |= (value << 0) & 0x0ff;
break;
case 0x30: /* LCD Vertical Display Height 1 */
s->y &= 0x0ff;
s->y |= (value << 8) & 0x300;
break;
case 0x32: /* LCD Vertical Non-display Period */
s->vndp = value & 0xff;
break;
case 0x34: /* LCD HS Pulse-width */
s->hsync = value & 0xff;
break;
case 0x36: /* LCD HS Pulse Start Position */
s->skipx = value & 0xff;
break;
case 0x38: /* LCD VS Pulse-width */
s->vsync = value & 0xbf;
break;
case 0x3a: /* LCD VS Pulse Start Position */
s->skipy = value & 0xff;
break;
case 0x3c: /* PCLK Polarity */
s->pclk = value & 0x82;
/* Affects calculation of s->hndp, s->hsync and s->skipx. */
break;
case 0x3e: /* High-speed Serial Interface Tx Configuration Port 0 */
s->hssi_config[0] = value;
break;
case 0x40: /* High-speed Serial Interface Tx Configuration Port 1 */
s->hssi_config[1] = value;
if (((value >> 4) & 3) == 3)
fprintf(stderr, "%s: Illegal active-data-links value\n",
__FUNCTION__);
break;
case 0x42: /* High-speed Serial Interface Tx Mode */
s->hssi_config[2] = value & 0xbd;
break;
case 0x44: /* TV Display Configuration */
s->tv_config = value & 0xfe;
break;
case 0x46 ... 0x4c: /* TV Vertical Blanking Interval Data bits 0 */
s->tv_timing[(reg - 0x46) >> 1] = value;
break;
case 0x4e: /* VBI: Closed Caption / XDS Control / Status */
s->vbi = value;
break;
case 0x50: /* TV Horizontal Start Position */
s->tv_x = value;
break;
case 0x52: /* TV Vertical Start Position */
s->tv_y = value & 0x7f;
break;
case 0x54: /* TV Test Pattern Setting */
s->tv_test = value;
break;
case 0x56: /* TV Filter Setting */
s->tv_filter_config = value & 0xbf;
break;
case 0x58: /* TV Filter Coefficient Index */
s->tv_filter_idx = value & 0x1f;
break;
case 0x5a: /* TV Filter Coefficient Data */
if (s->tv_filter_idx < 0x20)
s->tv_filter_coeff[s->tv_filter_idx ++] = value;
break;
case 0x60: /* Input YUV/RGB Translate Mode 0 */
s->yrc[0] = value & 0xb0;
break;
case 0x62: /* Input YUV/RGB Translate Mode 1 */
s->yrc[1] = value & 0x30;
break;
case 0x64: /* U Data Fix */
s->u = value & 0xff;
break;
case 0x66: /* V Data Fix */
s->v = value & 0xff;
break;
case 0x68: /* Display Mode */
if ((s->mode ^ value) & 3)
s->invalidate = 1;
s->mode = value & 0xb7;
s->enable = value & 1;
s->blank = (value >> 1) & 1;
if (value & (1 << 4))
fprintf(stderr, "%s: Macrovision enable attempt!\n", __FUNCTION__);
break;
case 0x6a: /* Special Effects */
s->effect = value & 0xfb;
break;
case 0x6c: /* Input Window X Start Position 0 */
s->ix[0] &= 0x300;
s->ix[0] |= (value << 0) & 0x0ff;
break;
case 0x6e: /* Input Window X Start Position 1 */
s->ix[0] &= 0x0ff;
s->ix[0] |= (value << 8) & 0x300;
break;
case 0x70: /* Input Window Y Start Position 0 */
s->iy[0] &= 0x300;
s->iy[0] |= (value << 0) & 0x0ff;
break;
case 0x72: /* Input Window Y Start Position 1 */
s->iy[0] &= 0x0ff;
s->iy[0] |= (value << 8) & 0x300;
break;
case 0x74: /* Input Window X End Position 0 */
s->ix[1] &= 0x300;
s->ix[1] |= (value << 0) & 0x0ff;
break;
case 0x76: /* Input Window X End Position 1 */
s->ix[1] &= 0x0ff;
s->ix[1] |= (value << 8) & 0x300;
break;
case 0x78: /* Input Window Y End Position 0 */
s->iy[1] &= 0x300;
s->iy[1] |= (value << 0) & 0x0ff;
break;
case 0x7a: /* Input Window Y End Position 1 */
s->iy[1] &= 0x0ff;
s->iy[1] |= (value << 8) & 0x300;
break;
case 0x7c: /* Output Window X Start Position 0 */
s->ox[0] &= 0x300;
s->ox[0] |= (value << 0) & 0x0ff;
break;
case 0x7e: /* Output Window X Start Position 1 */
s->ox[0] &= 0x0ff;
s->ox[0] |= (value << 8) & 0x300;
break;
case 0x80: /* Output Window Y Start Position 0 */
s->oy[0] &= 0x300;
s->oy[0] |= (value << 0) & 0x0ff;
break;
case 0x82: /* Output Window Y Start Position 1 */
s->oy[0] &= 0x0ff;
s->oy[0] |= (value << 8) & 0x300;
break;
case 0x84: /* Output Window X End Position 0 */
s->ox[1] &= 0x300;
s->ox[1] |= (value << 0) & 0x0ff;
break;
case 0x86: /* Output Window X End Position 1 */
s->ox[1] &= 0x0ff;
s->ox[1] |= (value << 8) & 0x300;
break;
case 0x88: /* Output Window Y End Position 0 */
s->oy[1] &= 0x300;
s->oy[1] |= (value << 0) & 0x0ff;
break;
case 0x8a: /* Output Window Y End Position 1 */
s->oy[1] &= 0x0ff;
s->oy[1] |= (value << 8) & 0x300;
break;
case 0x8c: /* Input Data Format */
s->iformat = value & 0xf;
s->bpp = blizzard_iformat_bpp[s->iformat];
if (!s->bpp)
fprintf(stderr, "%s: Illegal or unsupported input format %x\n",
__FUNCTION__, s->iformat);
break;
case 0x8e: /* Data Source Select */
s->source = value & 7;
/* Currently all windows will be "destructive overlays". */
if ((!(s->effect & (1 << 3)) && (s->ix[0] != s->ox[0] ||
s->iy[0] != s->oy[0] ||
s->ix[1] != s->ox[1] ||
s->iy[1] != s->oy[1])) ||
!((s->ix[1] - s->ix[0]) & (s->iy[1] - s->iy[0]) &
(s->ox[1] - s->ox[0]) & (s->oy[1] - s->oy[0]) & 1))
fprintf(stderr, "%s: Illegal input/output window positions\n",
__FUNCTION__);
blizzard_transfer_setup(s);
break;
case 0x90: /* Display Memory Data Port */
if (!s->data.len && !blizzard_transfer_setup(s))
break;
*s->data.ptr ++ = value;
if (-- s->data.len == 0)
blizzard_window(s);
break;
case 0xa8: /* Border Color 0 */
s->border_r = value;
break;
case 0xaa: /* Border Color 1 */
s->border_g = value;
break;
case 0xac: /* Border Color 2 */
s->border_b = value;
break;
case 0xb4: /* Gamma Correction Enable */
s->gamma_config = value & 0x87;
break;
case 0xb6: /* Gamma Correction Table Index */
s->gamma_idx = value;
break;
case 0xb8: /* Gamma Correction Table Data */
s->gamma_lut[s->gamma_idx ++] = value;
break;
case 0xba: /* 3x3 Matrix Enable */
s->matrix_ena = value & 1;
break;
case 0xbc ... 0xde: /* Coefficient Registers */
s->matrix_coeff[(reg - 0xbc) >> 1] = value & ((reg & 2) ? 0x80 : 0xff);
break;
case 0xe0: /* 3x3 Matrix Red Offset */
s->matrix_r = value;
break;
case 0xe2: /* 3x3 Matrix Green Offset */
s->matrix_g = value;
break;
case 0xe4: /* 3x3 Matrix Blue Offset */
s->matrix_b = value;
break;
case 0xe6: /* Power-save */
s->pm = value & 0x83;
if (value & s->mode & 1)
fprintf(stderr, "%s: The display must be disabled before entering "
"Standby Mode\n", __FUNCTION__);
break;
case 0xe8: /* Non-display Period Control / Status */
s->status = value & 0x1b;
break;
case 0xea: /* RGB Interface Control */
s->rgbgpio_dir = value & 0x8f;
break;
case 0xec: /* RGB Interface Status */
s->rgbgpio = value & 0xcf;
break;
case 0xee: /* General-purpose IO Pins Configuration */
s->gpio_dir = value;
break;
case 0xf0: /* General-purpose IO Pins Status / Control */
s->gpio = value;
break;
case 0xf2: /* GPIO Positive Edge Interrupt Trigger */
s->gpio_edge[0] = value;
break;
case 0xf4: /* GPIO Negative Edge Interrupt Trigger */
s->gpio_edge[1] = value;
break;
case 0xf6: /* GPIO Interrupt Status */
s->gpio_irq &= value;
break;
case 0xf8: /* GPIO Pull-down Control */
s->gpio_pdown = value;
break;
default:
fprintf(stderr, "%s: unknown register %02x\n", __FUNCTION__, reg);
break;
}
}
| false |
qemu
|
a89f364ae8740dfc31b321eed9ee454e996dc3c1
|
static void blizzard_reg_write(void *opaque, uint8_t reg, uint16_t value)
{
BlizzardState *s = (BlizzardState *) opaque;
switch (reg) {
case 0x04:
s->pll = (value & 0x3f) + 1;
break;
case 0x06:
s->pll_range = value & 3;
break;
case 0x08:
s->pll_ctrl &= 0xf00;
s->pll_ctrl |= (value << 0) & 0x0ff;
break;
case 0x0a:
s->pll_ctrl &= 0x0ff;
s->pll_ctrl |= (value << 8) & 0xf00;
break;
case 0x0c:
s->pll_mode = value & 0x77;
if ((value & 3) == 0 || (value & 3) == 3)
fprintf(stderr, "%s: wrong PLL Control bits (%i)\n",
__FUNCTION__, value & 3);
break;
case 0x0e:
s->clksel = value & 0xff;
break;
case 0x10:
s->memenable = value & 1;
break;
case 0x14:
break;
case 0x18:
s->memrefresh &= 0xf00;
s->memrefresh |= (value << 0) & 0x0ff;
break;
case 0x1a:
s->memrefresh &= 0x0ff;
s->memrefresh |= (value << 8) & 0xf00;
break;
case 0x1c:
s->timing[0] = value & 0x7f;
break;
case 0x1e:
s->timing[1] = value & 0x17;
break;
case 0x20:
s->timing[2] = value & 0x35;
break;
case 0x24:
s->priority = value & 1;
break;
case 0x28:
s->lcd_config = value & 0xff;
if (value & (1 << 7))
fprintf(stderr, "%s: data swap not supported!\n", __FUNCTION__);
break;
case 0x2a:
s->x = value << 3;
break;
case 0x2c:
s->hndp = value & 0xff;
break;
case 0x2e:
s->y &= 0x300;
s->y |= (value << 0) & 0x0ff;
break;
case 0x30:
s->y &= 0x0ff;
s->y |= (value << 8) & 0x300;
break;
case 0x32:
s->vndp = value & 0xff;
break;
case 0x34:
s->hsync = value & 0xff;
break;
case 0x36:
s->skipx = value & 0xff;
break;
case 0x38:
s->vsync = value & 0xbf;
break;
case 0x3a:
s->skipy = value & 0xff;
break;
case 0x3c:
s->pclk = value & 0x82;
break;
case 0x3e:
s->hssi_config[0] = value;
break;
case 0x40:
s->hssi_config[1] = value;
if (((value >> 4) & 3) == 3)
fprintf(stderr, "%s: Illegal active-data-links value\n",
__FUNCTION__);
break;
case 0x42:
s->hssi_config[2] = value & 0xbd;
break;
case 0x44:
s->tv_config = value & 0xfe;
break;
case 0x46 ... 0x4c:
s->tv_timing[(reg - 0x46) >> 1] = value;
break;
case 0x4e:
s->vbi = value;
break;
case 0x50:
s->tv_x = value;
break;
case 0x52:
s->tv_y = value & 0x7f;
break;
case 0x54:
s->tv_test = value;
break;
case 0x56:
s->tv_filter_config = value & 0xbf;
break;
case 0x58:
s->tv_filter_idx = value & 0x1f;
break;
case 0x5a:
if (s->tv_filter_idx < 0x20)
s->tv_filter_coeff[s->tv_filter_idx ++] = value;
break;
case 0x60:
s->yrc[0] = value & 0xb0;
break;
case 0x62:
s->yrc[1] = value & 0x30;
break;
case 0x64:
s->u = value & 0xff;
break;
case 0x66:
s->v = value & 0xff;
break;
case 0x68:
if ((s->mode ^ value) & 3)
s->invalidate = 1;
s->mode = value & 0xb7;
s->enable = value & 1;
s->blank = (value >> 1) & 1;
if (value & (1 << 4))
fprintf(stderr, "%s: Macrovision enable attempt!\n", __FUNCTION__);
break;
case 0x6a:
s->effect = value & 0xfb;
break;
case 0x6c:
s->ix[0] &= 0x300;
s->ix[0] |= (value << 0) & 0x0ff;
break;
case 0x6e:
s->ix[0] &= 0x0ff;
s->ix[0] |= (value << 8) & 0x300;
break;
case 0x70:
s->iy[0] &= 0x300;
s->iy[0] |= (value << 0) & 0x0ff;
break;
case 0x72:
s->iy[0] &= 0x0ff;
s->iy[0] |= (value << 8) & 0x300;
break;
case 0x74:
s->ix[1] &= 0x300;
s->ix[1] |= (value << 0) & 0x0ff;
break;
case 0x76:
s->ix[1] &= 0x0ff;
s->ix[1] |= (value << 8) & 0x300;
break;
case 0x78:
s->iy[1] &= 0x300;
s->iy[1] |= (value << 0) & 0x0ff;
break;
case 0x7a:
s->iy[1] &= 0x0ff;
s->iy[1] |= (value << 8) & 0x300;
break;
case 0x7c:
s->ox[0] &= 0x300;
s->ox[0] |= (value << 0) & 0x0ff;
break;
case 0x7e:
s->ox[0] &= 0x0ff;
s->ox[0] |= (value << 8) & 0x300;
break;
case 0x80:
s->oy[0] &= 0x300;
s->oy[0] |= (value << 0) & 0x0ff;
break;
case 0x82:
s->oy[0] &= 0x0ff;
s->oy[0] |= (value << 8) & 0x300;
break;
case 0x84:
s->ox[1] &= 0x300;
s->ox[1] |= (value << 0) & 0x0ff;
break;
case 0x86:
s->ox[1] &= 0x0ff;
s->ox[1] |= (value << 8) & 0x300;
break;
case 0x88:
s->oy[1] &= 0x300;
s->oy[1] |= (value << 0) & 0x0ff;
break;
case 0x8a:
s->oy[1] &= 0x0ff;
s->oy[1] |= (value << 8) & 0x300;
break;
case 0x8c:
s->iformat = value & 0xf;
s->bpp = blizzard_iformat_bpp[s->iformat];
if (!s->bpp)
fprintf(stderr, "%s: Illegal or unsupported input format %x\n",
__FUNCTION__, s->iformat);
break;
case 0x8e:
s->source = value & 7;
if ((!(s->effect & (1 << 3)) && (s->ix[0] != s->ox[0] ||
s->iy[0] != s->oy[0] ||
s->ix[1] != s->ox[1] ||
s->iy[1] != s->oy[1])) ||
!((s->ix[1] - s->ix[0]) & (s->iy[1] - s->iy[0]) &
(s->ox[1] - s->ox[0]) & (s->oy[1] - s->oy[0]) & 1))
fprintf(stderr, "%s: Illegal input/output window positions\n",
__FUNCTION__);
blizzard_transfer_setup(s);
break;
case 0x90:
if (!s->data.len && !blizzard_transfer_setup(s))
break;
*s->data.ptr ++ = value;
if (-- s->data.len == 0)
blizzard_window(s);
break;
case 0xa8:
s->border_r = value;
break;
case 0xaa:
s->border_g = value;
break;
case 0xac:
s->border_b = value;
break;
case 0xb4:
s->gamma_config = value & 0x87;
break;
case 0xb6:
s->gamma_idx = value;
break;
case 0xb8:
s->gamma_lut[s->gamma_idx ++] = value;
break;
case 0xba:
s->matrix_ena = value & 1;
break;
case 0xbc ... 0xde:
s->matrix_coeff[(reg - 0xbc) >> 1] = value & ((reg & 2) ? 0x80 : 0xff);
break;
case 0xe0:
s->matrix_r = value;
break;
case 0xe2:
s->matrix_g = value;
break;
case 0xe4:
s->matrix_b = value;
break;
case 0xe6:
s->pm = value & 0x83;
if (value & s->mode & 1)
fprintf(stderr, "%s: The display must be disabled before entering "
"Standby Mode\n", __FUNCTION__);
break;
case 0xe8:
s->status = value & 0x1b;
break;
case 0xea:
s->rgbgpio_dir = value & 0x8f;
break;
case 0xec:
s->rgbgpio = value & 0xcf;
break;
case 0xee:
s->gpio_dir = value;
break;
case 0xf0:
s->gpio = value;
break;
case 0xf2:
s->gpio_edge[0] = value;
break;
case 0xf4:
s->gpio_edge[1] = value;
break;
case 0xf6:
s->gpio_irq &= value;
break;
case 0xf8:
s->gpio_pdown = value;
break;
default:
fprintf(stderr, "%s: unknown register %02x\n", __FUNCTION__, reg);
break;
}
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(void *VAR_0, uint8_t VAR_1, uint16_t VAR_2)
{
BlizzardState *s = (BlizzardState *) VAR_0;
switch (VAR_1) {
case 0x04:
s->pll = (VAR_2 & 0x3f) + 1;
break;
case 0x06:
s->pll_range = VAR_2 & 3;
break;
case 0x08:
s->pll_ctrl &= 0xf00;
s->pll_ctrl |= (VAR_2 << 0) & 0x0ff;
break;
case 0x0a:
s->pll_ctrl &= 0x0ff;
s->pll_ctrl |= (VAR_2 << 8) & 0xf00;
break;
case 0x0c:
s->pll_mode = VAR_2 & 0x77;
if ((VAR_2 & 3) == 0 || (VAR_2 & 3) == 3)
fprintf(stderr, "%s: wrong PLL Control bits (%i)\n",
__FUNCTION__, VAR_2 & 3);
break;
case 0x0e:
s->clksel = VAR_2 & 0xff;
break;
case 0x10:
s->memenable = VAR_2 & 1;
break;
case 0x14:
break;
case 0x18:
s->memrefresh &= 0xf00;
s->memrefresh |= (VAR_2 << 0) & 0x0ff;
break;
case 0x1a:
s->memrefresh &= 0x0ff;
s->memrefresh |= (VAR_2 << 8) & 0xf00;
break;
case 0x1c:
s->timing[0] = VAR_2 & 0x7f;
break;
case 0x1e:
s->timing[1] = VAR_2 & 0x17;
break;
case 0x20:
s->timing[2] = VAR_2 & 0x35;
break;
case 0x24:
s->priority = VAR_2 & 1;
break;
case 0x28:
s->lcd_config = VAR_2 & 0xff;
if (VAR_2 & (1 << 7))
fprintf(stderr, "%s: data swap not supported!\n", __FUNCTION__);
break;
case 0x2a:
s->x = VAR_2 << 3;
break;
case 0x2c:
s->hndp = VAR_2 & 0xff;
break;
case 0x2e:
s->y &= 0x300;
s->y |= (VAR_2 << 0) & 0x0ff;
break;
case 0x30:
s->y &= 0x0ff;
s->y |= (VAR_2 << 8) & 0x300;
break;
case 0x32:
s->vndp = VAR_2 & 0xff;
break;
case 0x34:
s->hsync = VAR_2 & 0xff;
break;
case 0x36:
s->skipx = VAR_2 & 0xff;
break;
case 0x38:
s->vsync = VAR_2 & 0xbf;
break;
case 0x3a:
s->skipy = VAR_2 & 0xff;
break;
case 0x3c:
s->pclk = VAR_2 & 0x82;
break;
case 0x3e:
s->hssi_config[0] = VAR_2;
break;
case 0x40:
s->hssi_config[1] = VAR_2;
if (((VAR_2 >> 4) & 3) == 3)
fprintf(stderr, "%s: Illegal active-data-links VAR_2\n",
__FUNCTION__);
break;
case 0x42:
s->hssi_config[2] = VAR_2 & 0xbd;
break;
case 0x44:
s->tv_config = VAR_2 & 0xfe;
break;
case 0x46 ... 0x4c:
s->tv_timing[(VAR_1 - 0x46) >> 1] = VAR_2;
break;
case 0x4e:
s->vbi = VAR_2;
break;
case 0x50:
s->tv_x = VAR_2;
break;
case 0x52:
s->tv_y = VAR_2 & 0x7f;
break;
case 0x54:
s->tv_test = VAR_2;
break;
case 0x56:
s->tv_filter_config = VAR_2 & 0xbf;
break;
case 0x58:
s->tv_filter_idx = VAR_2 & 0x1f;
break;
case 0x5a:
if (s->tv_filter_idx < 0x20)
s->tv_filter_coeff[s->tv_filter_idx ++] = VAR_2;
break;
case 0x60:
s->yrc[0] = VAR_2 & 0xb0;
break;
case 0x62:
s->yrc[1] = VAR_2 & 0x30;
break;
case 0x64:
s->u = VAR_2 & 0xff;
break;
case 0x66:
s->v = VAR_2 & 0xff;
break;
case 0x68:
if ((s->mode ^ VAR_2) & 3)
s->invalidate = 1;
s->mode = VAR_2 & 0xb7;
s->enable = VAR_2 & 1;
s->blank = (VAR_2 >> 1) & 1;
if (VAR_2 & (1 << 4))
fprintf(stderr, "%s: Macrovision enable attempt!\n", __FUNCTION__);
break;
case 0x6a:
s->effect = VAR_2 & 0xfb;
break;
case 0x6c:
s->ix[0] &= 0x300;
s->ix[0] |= (VAR_2 << 0) & 0x0ff;
break;
case 0x6e:
s->ix[0] &= 0x0ff;
s->ix[0] |= (VAR_2 << 8) & 0x300;
break;
case 0x70:
s->iy[0] &= 0x300;
s->iy[0] |= (VAR_2 << 0) & 0x0ff;
break;
case 0x72:
s->iy[0] &= 0x0ff;
s->iy[0] |= (VAR_2 << 8) & 0x300;
break;
case 0x74:
s->ix[1] &= 0x300;
s->ix[1] |= (VAR_2 << 0) & 0x0ff;
break;
case 0x76:
s->ix[1] &= 0x0ff;
s->ix[1] |= (VAR_2 << 8) & 0x300;
break;
case 0x78:
s->iy[1] &= 0x300;
s->iy[1] |= (VAR_2 << 0) & 0x0ff;
break;
case 0x7a:
s->iy[1] &= 0x0ff;
s->iy[1] |= (VAR_2 << 8) & 0x300;
break;
case 0x7c:
s->ox[0] &= 0x300;
s->ox[0] |= (VAR_2 << 0) & 0x0ff;
break;
case 0x7e:
s->ox[0] &= 0x0ff;
s->ox[0] |= (VAR_2 << 8) & 0x300;
break;
case 0x80:
s->oy[0] &= 0x300;
s->oy[0] |= (VAR_2 << 0) & 0x0ff;
break;
case 0x82:
s->oy[0] &= 0x0ff;
s->oy[0] |= (VAR_2 << 8) & 0x300;
break;
case 0x84:
s->ox[1] &= 0x300;
s->ox[1] |= (VAR_2 << 0) & 0x0ff;
break;
case 0x86:
s->ox[1] &= 0x0ff;
s->ox[1] |= (VAR_2 << 8) & 0x300;
break;
case 0x88:
s->oy[1] &= 0x300;
s->oy[1] |= (VAR_2 << 0) & 0x0ff;
break;
case 0x8a:
s->oy[1] &= 0x0ff;
s->oy[1] |= (VAR_2 << 8) & 0x300;
break;
case 0x8c:
s->iformat = VAR_2 & 0xf;
s->bpp = blizzard_iformat_bpp[s->iformat];
if (!s->bpp)
fprintf(stderr, "%s: Illegal or unsupported input format %x\n",
__FUNCTION__, s->iformat);
break;
case 0x8e:
s->source = VAR_2 & 7;
if ((!(s->effect & (1 << 3)) && (s->ix[0] != s->ox[0] ||
s->iy[0] != s->oy[0] ||
s->ix[1] != s->ox[1] ||
s->iy[1] != s->oy[1])) ||
!((s->ix[1] - s->ix[0]) & (s->iy[1] - s->iy[0]) &
(s->ox[1] - s->ox[0]) & (s->oy[1] - s->oy[0]) & 1))
fprintf(stderr, "%s: Illegal input/output window positions\n",
__FUNCTION__);
blizzard_transfer_setup(s);
break;
case 0x90:
if (!s->data.len && !blizzard_transfer_setup(s))
break;
*s->data.ptr ++ = VAR_2;
if (-- s->data.len == 0)
blizzard_window(s);
break;
case 0xa8:
s->border_r = VAR_2;
break;
case 0xaa:
s->border_g = VAR_2;
break;
case 0xac:
s->border_b = VAR_2;
break;
case 0xb4:
s->gamma_config = VAR_2 & 0x87;
break;
case 0xb6:
s->gamma_idx = VAR_2;
break;
case 0xb8:
s->gamma_lut[s->gamma_idx ++] = VAR_2;
break;
case 0xba:
s->matrix_ena = VAR_2 & 1;
break;
case 0xbc ... 0xde:
s->matrix_coeff[(VAR_1 - 0xbc) >> 1] = VAR_2 & ((VAR_1 & 2) ? 0x80 : 0xff);
break;
case 0xe0:
s->matrix_r = VAR_2;
break;
case 0xe2:
s->matrix_g = VAR_2;
break;
case 0xe4:
s->matrix_b = VAR_2;
break;
case 0xe6:
s->pm = VAR_2 & 0x83;
if (VAR_2 & s->mode & 1)
fprintf(stderr, "%s: The display must be disabled before entering "
"Standby Mode\n", __FUNCTION__);
break;
case 0xe8:
s->status = VAR_2 & 0x1b;
break;
case 0xea:
s->rgbgpio_dir = VAR_2 & 0x8f;
break;
case 0xec:
s->rgbgpio = VAR_2 & 0xcf;
break;
case 0xee:
s->gpio_dir = VAR_2;
break;
case 0xf0:
s->gpio = VAR_2;
break;
case 0xf2:
s->gpio_edge[0] = VAR_2;
break;
case 0xf4:
s->gpio_edge[1] = VAR_2;
break;
case 0xf6:
s->gpio_irq &= VAR_2;
break;
case 0xf8:
s->gpio_pdown = VAR_2;
break;
default:
fprintf(stderr, "%s: unknown register %02x\n", __FUNCTION__, VAR_1);
break;
}
}
|
[
"static void FUNC_0(void *VAR_0, uint8_t VAR_1, uint16_t VAR_2)\n{",
"BlizzardState *s = (BlizzardState *) VAR_0;",
"switch (VAR_1) {",
"case 0x04:\ns->pll = (VAR_2 & 0x3f) + 1;",
"break;",
"case 0x06:\ns->pll_range = VAR_2 & 3;",
"break;",
"case 0x08:\ns->pll_ctrl &= 0xf00;",
"s->pll_ctrl |= (VAR_2 << 0) & 0x0ff;",
"break;",
"case 0x0a:\ns->pll_ctrl &= 0x0ff;",
"s->pll_ctrl |= (VAR_2 << 8) & 0xf00;",
"break;",
"case 0x0c:\ns->pll_mode = VAR_2 & 0x77;",
"if ((VAR_2 & 3) == 0 || (VAR_2 & 3) == 3)\nfprintf(stderr, \"%s: wrong PLL Control bits (%i)\\n\",\n__FUNCTION__, VAR_2 & 3);",
"break;",
"case 0x0e:\ns->clksel = VAR_2 & 0xff;",
"break;",
"case 0x10:\ns->memenable = VAR_2 & 1;",
"break;",
"case 0x14:\nbreak;",
"case 0x18:\ns->memrefresh &= 0xf00;",
"s->memrefresh |= (VAR_2 << 0) & 0x0ff;",
"break;",
"case 0x1a:\ns->memrefresh &= 0x0ff;",
"s->memrefresh |= (VAR_2 << 8) & 0xf00;",
"break;",
"case 0x1c:\ns->timing[0] = VAR_2 & 0x7f;",
"break;",
"case 0x1e:\ns->timing[1] = VAR_2 & 0x17;",
"break;",
"case 0x20:\ns->timing[2] = VAR_2 & 0x35;",
"break;",
"case 0x24:\ns->priority = VAR_2 & 1;",
"break;",
"case 0x28:\ns->lcd_config = VAR_2 & 0xff;",
"if (VAR_2 & (1 << 7))\nfprintf(stderr, \"%s: data swap not supported!\\n\", __FUNCTION__);",
"break;",
"case 0x2a:\ns->x = VAR_2 << 3;",
"break;",
"case 0x2c:\ns->hndp = VAR_2 & 0xff;",
"break;",
"case 0x2e:\ns->y &= 0x300;",
"s->y |= (VAR_2 << 0) & 0x0ff;",
"break;",
"case 0x30:\ns->y &= 0x0ff;",
"s->y |= (VAR_2 << 8) & 0x300;",
"break;",
"case 0x32:\ns->vndp = VAR_2 & 0xff;",
"break;",
"case 0x34:\ns->hsync = VAR_2 & 0xff;",
"break;",
"case 0x36:\ns->skipx = VAR_2 & 0xff;",
"break;",
"case 0x38:\ns->vsync = VAR_2 & 0xbf;",
"break;",
"case 0x3a:\ns->skipy = VAR_2 & 0xff;",
"break;",
"case 0x3c:\ns->pclk = VAR_2 & 0x82;",
"break;",
"case 0x3e:\ns->hssi_config[0] = VAR_2;",
"break;",
"case 0x40:\ns->hssi_config[1] = VAR_2;",
"if (((VAR_2 >> 4) & 3) == 3)\nfprintf(stderr, \"%s: Illegal active-data-links VAR_2\\n\",\n__FUNCTION__);",
"break;",
"case 0x42:\ns->hssi_config[2] = VAR_2 & 0xbd;",
"break;",
"case 0x44:\ns->tv_config = VAR_2 & 0xfe;",
"break;",
"case 0x46 ... 0x4c:\ns->tv_timing[(VAR_1 - 0x46) >> 1] = VAR_2;",
"break;",
"case 0x4e:\ns->vbi = VAR_2;",
"break;",
"case 0x50:\ns->tv_x = VAR_2;",
"break;",
"case 0x52:\ns->tv_y = VAR_2 & 0x7f;",
"break;",
"case 0x54:\ns->tv_test = VAR_2;",
"break;",
"case 0x56:\ns->tv_filter_config = VAR_2 & 0xbf;",
"break;",
"case 0x58:\ns->tv_filter_idx = VAR_2 & 0x1f;",
"break;",
"case 0x5a:\nif (s->tv_filter_idx < 0x20)\ns->tv_filter_coeff[s->tv_filter_idx ++] = VAR_2;",
"break;",
"case 0x60:\ns->yrc[0] = VAR_2 & 0xb0;",
"break;",
"case 0x62:\ns->yrc[1] = VAR_2 & 0x30;",
"break;",
"case 0x64:\ns->u = VAR_2 & 0xff;",
"break;",
"case 0x66:\ns->v = VAR_2 & 0xff;",
"break;",
"case 0x68:\nif ((s->mode ^ VAR_2) & 3)\ns->invalidate = 1;",
"s->mode = VAR_2 & 0xb7;",
"s->enable = VAR_2 & 1;",
"s->blank = (VAR_2 >> 1) & 1;",
"if (VAR_2 & (1 << 4))\nfprintf(stderr, \"%s: Macrovision enable attempt!\\n\", __FUNCTION__);",
"break;",
"case 0x6a:\ns->effect = VAR_2 & 0xfb;",
"break;",
"case 0x6c:\ns->ix[0] &= 0x300;",
"s->ix[0] |= (VAR_2 << 0) & 0x0ff;",
"break;",
"case 0x6e:\ns->ix[0] &= 0x0ff;",
"s->ix[0] |= (VAR_2 << 8) & 0x300;",
"break;",
"case 0x70:\ns->iy[0] &= 0x300;",
"s->iy[0] |= (VAR_2 << 0) & 0x0ff;",
"break;",
"case 0x72:\ns->iy[0] &= 0x0ff;",
"s->iy[0] |= (VAR_2 << 8) & 0x300;",
"break;",
"case 0x74:\ns->ix[1] &= 0x300;",
"s->ix[1] |= (VAR_2 << 0) & 0x0ff;",
"break;",
"case 0x76:\ns->ix[1] &= 0x0ff;",
"s->ix[1] |= (VAR_2 << 8) & 0x300;",
"break;",
"case 0x78:\ns->iy[1] &= 0x300;",
"s->iy[1] |= (VAR_2 << 0) & 0x0ff;",
"break;",
"case 0x7a:\ns->iy[1] &= 0x0ff;",
"s->iy[1] |= (VAR_2 << 8) & 0x300;",
"break;",
"case 0x7c:\ns->ox[0] &= 0x300;",
"s->ox[0] |= (VAR_2 << 0) & 0x0ff;",
"break;",
"case 0x7e:\ns->ox[0] &= 0x0ff;",
"s->ox[0] |= (VAR_2 << 8) & 0x300;",
"break;",
"case 0x80:\ns->oy[0] &= 0x300;",
"s->oy[0] |= (VAR_2 << 0) & 0x0ff;",
"break;",
"case 0x82:\ns->oy[0] &= 0x0ff;",
"s->oy[0] |= (VAR_2 << 8) & 0x300;",
"break;",
"case 0x84:\ns->ox[1] &= 0x300;",
"s->ox[1] |= (VAR_2 << 0) & 0x0ff;",
"break;",
"case 0x86:\ns->ox[1] &= 0x0ff;",
"s->ox[1] |= (VAR_2 << 8) & 0x300;",
"break;",
"case 0x88:\ns->oy[1] &= 0x300;",
"s->oy[1] |= (VAR_2 << 0) & 0x0ff;",
"break;",
"case 0x8a:\ns->oy[1] &= 0x0ff;",
"s->oy[1] |= (VAR_2 << 8) & 0x300;",
"break;",
"case 0x8c:\ns->iformat = VAR_2 & 0xf;",
"s->bpp = blizzard_iformat_bpp[s->iformat];",
"if (!s->bpp)\nfprintf(stderr, \"%s: Illegal or unsupported input format %x\\n\",\n__FUNCTION__, s->iformat);",
"break;",
"case 0x8e:\ns->source = VAR_2 & 7;",
"if ((!(s->effect & (1 << 3)) && (s->ix[0] != s->ox[0] ||\ns->iy[0] != s->oy[0] ||\ns->ix[1] != s->ox[1] ||\ns->iy[1] != s->oy[1])) ||\n!((s->ix[1] - s->ix[0]) & (s->iy[1] - s->iy[0]) &\n(s->ox[1] - s->ox[0]) & (s->oy[1] - s->oy[0]) & 1))\nfprintf(stderr, \"%s: Illegal input/output window positions\\n\",\n__FUNCTION__);",
"blizzard_transfer_setup(s);",
"break;",
"case 0x90:\nif (!s->data.len && !blizzard_transfer_setup(s))\nbreak;",
"*s->data.ptr ++ = VAR_2;",
"if (-- s->data.len == 0)\nblizzard_window(s);",
"break;",
"case 0xa8:\ns->border_r = VAR_2;",
"break;",
"case 0xaa:\ns->border_g = VAR_2;",
"break;",
"case 0xac:\ns->border_b = VAR_2;",
"break;",
"case 0xb4:\ns->gamma_config = VAR_2 & 0x87;",
"break;",
"case 0xb6:\ns->gamma_idx = VAR_2;",
"break;",
"case 0xb8:\ns->gamma_lut[s->gamma_idx ++] = VAR_2;",
"break;",
"case 0xba:\ns->matrix_ena = VAR_2 & 1;",
"break;",
"case 0xbc ... 0xde:\ns->matrix_coeff[(VAR_1 - 0xbc) >> 1] = VAR_2 & ((VAR_1 & 2) ? 0x80 : 0xff);",
"break;",
"case 0xe0:\ns->matrix_r = VAR_2;",
"break;",
"case 0xe2:\ns->matrix_g = VAR_2;",
"break;",
"case 0xe4:\ns->matrix_b = VAR_2;",
"break;",
"case 0xe6:\ns->pm = VAR_2 & 0x83;",
"if (VAR_2 & s->mode & 1)\nfprintf(stderr, \"%s: The display must be disabled before entering \"\n\"Standby Mode\\n\", __FUNCTION__);",
"break;",
"case 0xe8:\ns->status = VAR_2 & 0x1b;",
"break;",
"case 0xea:\ns->rgbgpio_dir = VAR_2 & 0x8f;",
"break;",
"case 0xec:\ns->rgbgpio = VAR_2 & 0xcf;",
"break;",
"case 0xee:\ns->gpio_dir = VAR_2;",
"break;",
"case 0xf0:\ns->gpio = VAR_2;",
"break;",
"case 0xf2:\ns->gpio_edge[0] = VAR_2;",
"break;",
"case 0xf4:\ns->gpio_edge[1] = VAR_2;",
"break;",
"case 0xf6:\ns->gpio_irq &= VAR_2;",
"break;",
"case 0xf8:\ns->gpio_pdown = VAR_2;",
"break;",
"default:\nfprintf(stderr, \"%s: unknown register %02x\\n\", __FUNCTION__, VAR_1);",
"break;",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
9
],
[
11,
13
],
[
15
],
[
17,
19
],
[
21
],
[
23,
25
],
[
27
],
[
29
],
[
31,
33
],
[
35
],
[
37
],
[
39,
41
],
[
43,
45,
47
],
[
49
],
[
53,
55
],
[
57
],
[
61,
63
],
[
65
],
[
67,
69
],
[
73,
75
],
[
77
],
[
79
],
[
81,
83
],
[
85
],
[
87
],
[
91,
93
],
[
95
],
[
97,
99
],
[
101
],
[
103,
105
],
[
107
],
[
111,
113
],
[
115
],
[
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
],
[
171,
173
],
[
175
],
[
177,
179
],
[
181
],
[
183,
185
],
[
187
],
[
191,
193
],
[
197
],
[
201,
203
],
[
205
],
[
207,
209
],
[
211,
213,
215
],
[
217
],
[
219,
221
],
[
223
],
[
227,
229
],
[
231
],
[
233,
235
],
[
237
],
[
239,
241
],
[
243
],
[
245,
247
],
[
249
],
[
251,
253
],
[
255
],
[
257,
259
],
[
261
],
[
263,
265
],
[
267
],
[
269,
271
],
[
273
],
[
275,
277,
279
],
[
281
],
[
285,
287
],
[
289
],
[
291,
293
],
[
295
],
[
297,
299
],
[
301
],
[
303,
305
],
[
307
],
[
311,
313,
315
],
[
317
],
[
319
],
[
321
],
[
323,
325
],
[
327
],
[
331,
333
],
[
335
],
[
339,
341
],
[
343
],
[
345
],
[
347,
349
],
[
351
],
[
353
],
[
355,
357
],
[
359
],
[
361
],
[
363,
365
],
[
367
],
[
369
],
[
371,
373
],
[
375
],
[
377
],
[
379,
381
],
[
383
],
[
385
],
[
387,
389
],
[
391
],
[
393
],
[
395,
397
],
[
399
],
[
401
],
[
403,
405
],
[
407
],
[
409
],
[
411,
413
],
[
415
],
[
417
],
[
419,
421
],
[
423
],
[
425
],
[
427,
429
],
[
431
],
[
433
],
[
435,
437
],
[
439
],
[
441
],
[
443,
445
],
[
447
],
[
449
],
[
451,
453
],
[
455
],
[
457
],
[
459,
461
],
[
463
],
[
465
],
[
469,
471
],
[
473
],
[
475,
477,
479
],
[
481
],
[
483,
485
],
[
489,
491,
493,
495,
497,
499,
501,
503
],
[
507
],
[
509
],
[
513,
515,
517
],
[
521
],
[
523,
525
],
[
527
],
[
531,
533
],
[
535
],
[
537,
539
],
[
541
],
[
543,
545
],
[
547
],
[
551,
553
],
[
555
],
[
557,
559
],
[
561
],
[
563,
565
],
[
567
],
[
571,
573
],
[
575
],
[
577,
579
],
[
581
],
[
583,
585
],
[
587
],
[
589,
591
],
[
593
],
[
595,
597
],
[
599
],
[
603,
605
],
[
607,
609,
611
],
[
613
],
[
615,
617
],
[
619
],
[
621,
623
],
[
625
],
[
627,
629
],
[
631
],
[
633,
635
],
[
637
],
[
639,
641
],
[
643
],
[
645,
647
],
[
649
],
[
651,
653
],
[
655
],
[
657,
659
],
[
661
],
[
663,
665
],
[
667
],
[
671,
673
],
[
675
],
[
677
],
[
679
]
] |
7,232 |
uint64_t qcrypto_pbkdf2_count_iters(QCryptoHashAlgorithm hash,
const uint8_t *key, size_t nkey,
const uint8_t *salt, size_t nsalt,
Error **errp)
{
uint8_t out[32];
uint64_t iterations = (1 << 15);
unsigned long long delta_ms, start_ms, end_ms;
while (1) {
if (qcrypto_pbkdf2_get_thread_cpu(&start_ms, errp) < 0) {
return -1;
}
if (qcrypto_pbkdf2(hash,
key, nkey,
salt, nsalt,
iterations,
out, sizeof(out),
errp) < 0) {
return -1;
}
if (qcrypto_pbkdf2_get_thread_cpu(&end_ms, errp) < 0) {
return -1;
}
delta_ms = end_ms - start_ms;
if (delta_ms > 500) {
break;
} else if (delta_ms < 100) {
iterations = iterations * 10;
} else {
iterations = (iterations * 1000 / delta_ms);
}
}
iterations = iterations * 1000 / delta_ms;
return iterations;
}
| false |
qemu
|
8813800b7d995d8b54ef0a1e16d41fc13d8b5f3a
|
uint64_t qcrypto_pbkdf2_count_iters(QCryptoHashAlgorithm hash,
const uint8_t *key, size_t nkey,
const uint8_t *salt, size_t nsalt,
Error **errp)
{
uint8_t out[32];
uint64_t iterations = (1 << 15);
unsigned long long delta_ms, start_ms, end_ms;
while (1) {
if (qcrypto_pbkdf2_get_thread_cpu(&start_ms, errp) < 0) {
return -1;
}
if (qcrypto_pbkdf2(hash,
key, nkey,
salt, nsalt,
iterations,
out, sizeof(out),
errp) < 0) {
return -1;
}
if (qcrypto_pbkdf2_get_thread_cpu(&end_ms, errp) < 0) {
return -1;
}
delta_ms = end_ms - start_ms;
if (delta_ms > 500) {
break;
} else if (delta_ms < 100) {
iterations = iterations * 10;
} else {
iterations = (iterations * 1000 / delta_ms);
}
}
iterations = iterations * 1000 / delta_ms;
return iterations;
}
|
{
"code": [],
"line_no": []
}
|
uint64_t FUNC_0(QCryptoHashAlgorithm hash,
const uint8_t *key, size_t nkey,
const uint8_t *salt, size_t nsalt,
Error **errp)
{
uint8_t out[32];
uint64_t iterations = (1 << 15);
unsigned long long VAR_0, VAR_1, VAR_2;
while (1) {
if (qcrypto_pbkdf2_get_thread_cpu(&VAR_1, errp) < 0) {
return -1;
}
if (qcrypto_pbkdf2(hash,
key, nkey,
salt, nsalt,
iterations,
out, sizeof(out),
errp) < 0) {
return -1;
}
if (qcrypto_pbkdf2_get_thread_cpu(&VAR_2, errp) < 0) {
return -1;
}
VAR_0 = VAR_2 - VAR_1;
if (VAR_0 > 500) {
break;
} else if (VAR_0 < 100) {
iterations = iterations * 10;
} else {
iterations = (iterations * 1000 / VAR_0);
}
}
iterations = iterations * 1000 / VAR_0;
return iterations;
}
|
[
"uint64_t FUNC_0(QCryptoHashAlgorithm hash,\nconst uint8_t *key, size_t nkey,\nconst uint8_t *salt, size_t nsalt,\nError **errp)\n{",
"uint8_t out[32];",
"uint64_t iterations = (1 << 15);",
"unsigned long long VAR_0, VAR_1, VAR_2;",
"while (1) {",
"if (qcrypto_pbkdf2_get_thread_cpu(&VAR_1, errp) < 0) {",
"return -1;",
"}",
"if (qcrypto_pbkdf2(hash,\nkey, nkey,\nsalt, nsalt,\niterations,\nout, sizeof(out),\nerrp) < 0) {",
"return -1;",
"}",
"if (qcrypto_pbkdf2_get_thread_cpu(&VAR_2, errp) < 0) {",
"return -1;",
"}",
"VAR_0 = VAR_2 - VAR_1;",
"if (VAR_0 > 500) {",
"break;",
"} else if (VAR_0 < 100) {",
"iterations = iterations * 10;",
"} else {",
"iterations = (iterations * 1000 / VAR_0);",
"}",
"}",
"iterations = iterations * 1000 / VAR_0;",
"return iterations;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5,
7,
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27,
29,
31,
33,
35,
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
51
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
73
],
[
77
],
[
79
]
] |
7,233 |
static int pci_device_hot_remove(Monitor *mon, const char *pci_addr)
{
PCIDevice *d;
int dom, bus;
unsigned slot;
Error *local_err = NULL;
if (pci_read_devaddr(mon, pci_addr, &dom, &bus, &slot)) {
return -1;
}
d = pci_find_device(pci_find_root_bus(dom), bus, PCI_DEVFN(slot, 0));
if (!d) {
monitor_printf(mon, "slot %d empty\n", slot);
return -1;
}
qdev_unplug(&d->qdev, &local_err);
if (error_is_set(&local_err)) {
monitor_printf(mon, "%s\n", error_get_pretty(local_err));
error_free(local_err);
return -1;
}
return 0;
}
| false |
qemu
|
79ca616f291124d166ca173e512c4ace1c2fe8b2
|
static int pci_device_hot_remove(Monitor *mon, const char *pci_addr)
{
PCIDevice *d;
int dom, bus;
unsigned slot;
Error *local_err = NULL;
if (pci_read_devaddr(mon, pci_addr, &dom, &bus, &slot)) {
return -1;
}
d = pci_find_device(pci_find_root_bus(dom), bus, PCI_DEVFN(slot, 0));
if (!d) {
monitor_printf(mon, "slot %d empty\n", slot);
return -1;
}
qdev_unplug(&d->qdev, &local_err);
if (error_is_set(&local_err)) {
monitor_printf(mon, "%s\n", error_get_pretty(local_err));
error_free(local_err);
return -1;
}
return 0;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(Monitor *VAR_0, const char *VAR_1)
{
PCIDevice *d;
int VAR_2, VAR_3;
unsigned VAR_4;
Error *local_err = NULL;
if (pci_read_devaddr(VAR_0, VAR_1, &VAR_2, &VAR_3, &VAR_4)) {
return -1;
}
d = pci_find_device(pci_find_root_bus(VAR_2), VAR_3, PCI_DEVFN(VAR_4, 0));
if (!d) {
monitor_printf(VAR_0, "VAR_4 %d empty\n", VAR_4);
return -1;
}
qdev_unplug(&d->qdev, &local_err);
if (error_is_set(&local_err)) {
monitor_printf(VAR_0, "%s\n", error_get_pretty(local_err));
error_free(local_err);
return -1;
}
return 0;
}
|
[
"static int FUNC_0(Monitor *VAR_0, const char *VAR_1)\n{",
"PCIDevice *d;",
"int VAR_2, VAR_3;",
"unsigned VAR_4;",
"Error *local_err = NULL;",
"if (pci_read_devaddr(VAR_0, VAR_1, &VAR_2, &VAR_3, &VAR_4)) {",
"return -1;",
"}",
"d = pci_find_device(pci_find_root_bus(VAR_2), VAR_3, PCI_DEVFN(VAR_4, 0));",
"if (!d) {",
"monitor_printf(VAR_0, \"VAR_4 %d empty\\n\", VAR_4);",
"return -1;",
"}",
"qdev_unplug(&d->qdev, &local_err);",
"if (error_is_set(&local_err)) {",
"monitor_printf(VAR_0, \"%s\\n\", error_get_pretty(local_err));",
"error_free(local_err);",
"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
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
49
],
[
51
]
] |
7,234 |
void hmp_info_memdev(Monitor *mon, const QDict *qdict)
{
Error *err = NULL;
MemdevList *memdev_list = qmp_query_memdev(&err);
MemdevList *m = memdev_list;
StringOutputVisitor *ov;
char *str;
int i = 0;
while (m) {
ov = string_output_visitor_new(false);
visit_type_uint16List(string_output_get_visitor(ov), NULL,
&m->value->host_nodes, NULL);
monitor_printf(mon, "memory backend: %d\n", i);
monitor_printf(mon, " size: %" PRId64 "\n", m->value->size);
monitor_printf(mon, " merge: %s\n",
m->value->merge ? "true" : "false");
monitor_printf(mon, " dump: %s\n",
m->value->dump ? "true" : "false");
monitor_printf(mon, " prealloc: %s\n",
m->value->prealloc ? "true" : "false");
monitor_printf(mon, " policy: %s\n",
HostMemPolicy_lookup[m->value->policy]);
str = string_output_get_string(ov);
monitor_printf(mon, " host nodes: %s\n", str);
g_free(str);
string_output_visitor_cleanup(ov);
m = m->next;
i++;
}
monitor_printf(mon, "\n");
qapi_free_MemdevList(memdev_list);
}
| false |
qemu
|
e7ca56562990991bc614a43b9351ee0737f3045d
|
void hmp_info_memdev(Monitor *mon, const QDict *qdict)
{
Error *err = NULL;
MemdevList *memdev_list = qmp_query_memdev(&err);
MemdevList *m = memdev_list;
StringOutputVisitor *ov;
char *str;
int i = 0;
while (m) {
ov = string_output_visitor_new(false);
visit_type_uint16List(string_output_get_visitor(ov), NULL,
&m->value->host_nodes, NULL);
monitor_printf(mon, "memory backend: %d\n", i);
monitor_printf(mon, " size: %" PRId64 "\n", m->value->size);
monitor_printf(mon, " merge: %s\n",
m->value->merge ? "true" : "false");
monitor_printf(mon, " dump: %s\n",
m->value->dump ? "true" : "false");
monitor_printf(mon, " prealloc: %s\n",
m->value->prealloc ? "true" : "false");
monitor_printf(mon, " policy: %s\n",
HostMemPolicy_lookup[m->value->policy]);
str = string_output_get_string(ov);
monitor_printf(mon, " host nodes: %s\n", str);
g_free(str);
string_output_visitor_cleanup(ov);
m = m->next;
i++;
}
monitor_printf(mon, "\n");
qapi_free_MemdevList(memdev_list);
}
|
{
"code": [],
"line_no": []
}
|
void FUNC_0(Monitor *VAR_0, const QDict *VAR_1)
{
Error *err = NULL;
MemdevList *memdev_list = qmp_query_memdev(&err);
MemdevList *m = memdev_list;
StringOutputVisitor *ov;
char *VAR_2;
int VAR_3 = 0;
while (m) {
ov = string_output_visitor_new(false);
visit_type_uint16List(string_output_get_visitor(ov), NULL,
&m->value->host_nodes, NULL);
monitor_printf(VAR_0, "memory backend: %d\n", VAR_3);
monitor_printf(VAR_0, " size: %" PRId64 "\n", m->value->size);
monitor_printf(VAR_0, " merge: %s\n",
m->value->merge ? "true" : "false");
monitor_printf(VAR_0, " dump: %s\n",
m->value->dump ? "true" : "false");
monitor_printf(VAR_0, " prealloc: %s\n",
m->value->prealloc ? "true" : "false");
monitor_printf(VAR_0, " policy: %s\n",
HostMemPolicy_lookup[m->value->policy]);
VAR_2 = string_output_get_string(ov);
monitor_printf(VAR_0, " host nodes: %s\n", VAR_2);
g_free(VAR_2);
string_output_visitor_cleanup(ov);
m = m->next;
VAR_3++;
}
monitor_printf(VAR_0, "\n");
qapi_free_MemdevList(memdev_list);
}
|
[
"void FUNC_0(Monitor *VAR_0, const QDict *VAR_1)\n{",
"Error *err = NULL;",
"MemdevList *memdev_list = qmp_query_memdev(&err);",
"MemdevList *m = memdev_list;",
"StringOutputVisitor *ov;",
"char *VAR_2;",
"int VAR_3 = 0;",
"while (m) {",
"ov = string_output_visitor_new(false);",
"visit_type_uint16List(string_output_get_visitor(ov), NULL,\n&m->value->host_nodes, NULL);",
"monitor_printf(VAR_0, \"memory backend: %d\\n\", VAR_3);",
"monitor_printf(VAR_0, \" size: %\" PRId64 \"\\n\", m->value->size);",
"monitor_printf(VAR_0, \" merge: %s\\n\",\nm->value->merge ? \"true\" : \"false\");",
"monitor_printf(VAR_0, \" dump: %s\\n\",\nm->value->dump ? \"true\" : \"false\");",
"monitor_printf(VAR_0, \" prealloc: %s\\n\",\nm->value->prealloc ? \"true\" : \"false\");",
"monitor_printf(VAR_0, \" policy: %s\\n\",\nHostMemPolicy_lookup[m->value->policy]);",
"VAR_2 = string_output_get_string(ov);",
"monitor_printf(VAR_0, \" host nodes: %s\\n\", VAR_2);",
"g_free(VAR_2);",
"string_output_visitor_cleanup(ov);",
"m = m->next;",
"VAR_3++;",
"}",
"monitor_printf(VAR_0, \"\\n\");",
"qapi_free_MemdevList(memdev_list);",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
21
],
[
23
],
[
25,
27
],
[
29
],
[
31
],
[
33,
35
],
[
37,
39
],
[
41,
43
],
[
45,
47
],
[
49
],
[
51
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
67
],
[
71
],
[
73
]
] |
7,235 |
static void apply_motion_8x8(RoqContext *ri, int x, int y,
unsigned char mv, signed char mean_x, signed char mean_y)
{
int mx, my, i, j, hw;
unsigned char *pa, *pb;
mx = x + 8 - (mv >> 4) - mean_x;
my = y + 8 - (mv & 0xf) - mean_y;
pa = ri->current_frame.data[0] + (y * ri->y_stride) + x;
pb = ri->last_frame.data[0] + (my * ri->y_stride) + mx;
for(i = 0; i < 8; i++) {
pa[0] = pb[0];
pa[1] = pb[1];
pa[2] = pb[2];
pa[3] = pb[3];
pa[4] = pb[4];
pa[5] = pb[5];
pa[6] = pb[6];
pa[7] = pb[7];
pa += ri->y_stride;
pb += ri->y_stride;
}
#if 0
pa = ri->current_frame.data[1] + (y/2) * (ri->c_stride) + x/2;
pb = ri->last_frame.data[1] + (my/2) * (ri->c_stride) + (mx + 1)/2;
for(i = 0; i < 4; i++) {
pa[0] = pb[0];
pa[1] = pb[1];
pa[2] = pb[2];
pa[3] = pb[3];
pa += ri->c_stride;
pb += ri->c_stride;
}
pa = ri->current_frame.data[2] + (y/2) * (ri->c_stride) + x/2;
pb = ri->last_frame.data[2] + (my/2) * (ri->c_stride) + (mx + 1)/2;
for(i = 0; i < 4; i++) {
pa[0] = pb[0];
pa[1] = pb[1];
pa[2] = pb[2];
pa[3] = pb[3];
pa += ri->c_stride;
pb += ri->c_stride;
}
#else
hw = ri->c_stride;
pa = ri->current_frame.data[1] + (y * ri->y_stride)/4 + x/2;
pb = ri->last_frame.data[1] + (my/2) * (ri->y_stride/2) + (mx + 1)/2;
for(j = 0; j < 2; j++) {
for(i = 0; i < 4; i++) {
switch(((my & 0x01) << 1) | (mx & 0x01)) {
case 0:
pa[0] = pb[0];
pa[1] = pb[1];
pa[2] = pb[2];
pa[3] = pb[3];
break;
case 1:
pa[0] = avg2(pb[0], pb[1]);
pa[1] = avg2(pb[1], pb[2]);
pa[2] = avg2(pb[2], pb[3]);
pa[3] = avg2(pb[3], pb[4]);
break;
case 2:
pa[0] = avg2(pb[0], pb[hw]);
pa[1] = avg2(pb[1], pb[hw+1]);
pa[2] = avg2(pb[2], pb[hw+2]);
pa[3] = avg2(pb[3], pb[hw+3]);
break;
case 3:
pa[0] = avg4(pb[0], pb[1], pb[hw], pb[hw+1]);
pa[1] = avg4(pb[1], pb[2], pb[hw+1], pb[hw+2]);
pa[2] = avg4(pb[2], pb[3], pb[hw+2], pb[hw+3]);
pa[3] = avg4(pb[3], pb[4], pb[hw+3], pb[hw+4]);
break;
}
pa += ri->c_stride;
pb += ri->c_stride;
}
pa = ri->current_frame.data[2] + (y * ri->y_stride)/4 + x/2;
pb = ri->last_frame.data[2] + (my/2) * (ri->y_stride/2) + (mx + 1)/2;
}
#endif
}
| false |
FFmpeg
|
b9029997d4694b6533556480fe0ab1f3f9779a56
|
static void apply_motion_8x8(RoqContext *ri, int x, int y,
unsigned char mv, signed char mean_x, signed char mean_y)
{
int mx, my, i, j, hw;
unsigned char *pa, *pb;
mx = x + 8 - (mv >> 4) - mean_x;
my = y + 8 - (mv & 0xf) - mean_y;
pa = ri->current_frame.data[0] + (y * ri->y_stride) + x;
pb = ri->last_frame.data[0] + (my * ri->y_stride) + mx;
for(i = 0; i < 8; i++) {
pa[0] = pb[0];
pa[1] = pb[1];
pa[2] = pb[2];
pa[3] = pb[3];
pa[4] = pb[4];
pa[5] = pb[5];
pa[6] = pb[6];
pa[7] = pb[7];
pa += ri->y_stride;
pb += ri->y_stride;
}
#if 0
pa = ri->current_frame.data[1] + (y/2) * (ri->c_stride) + x/2;
pb = ri->last_frame.data[1] + (my/2) * (ri->c_stride) + (mx + 1)/2;
for(i = 0; i < 4; i++) {
pa[0] = pb[0];
pa[1] = pb[1];
pa[2] = pb[2];
pa[3] = pb[3];
pa += ri->c_stride;
pb += ri->c_stride;
}
pa = ri->current_frame.data[2] + (y/2) * (ri->c_stride) + x/2;
pb = ri->last_frame.data[2] + (my/2) * (ri->c_stride) + (mx + 1)/2;
for(i = 0; i < 4; i++) {
pa[0] = pb[0];
pa[1] = pb[1];
pa[2] = pb[2];
pa[3] = pb[3];
pa += ri->c_stride;
pb += ri->c_stride;
}
#else
hw = ri->c_stride;
pa = ri->current_frame.data[1] + (y * ri->y_stride)/4 + x/2;
pb = ri->last_frame.data[1] + (my/2) * (ri->y_stride/2) + (mx + 1)/2;
for(j = 0; j < 2; j++) {
for(i = 0; i < 4; i++) {
switch(((my & 0x01) << 1) | (mx & 0x01)) {
case 0:
pa[0] = pb[0];
pa[1] = pb[1];
pa[2] = pb[2];
pa[3] = pb[3];
break;
case 1:
pa[0] = avg2(pb[0], pb[1]);
pa[1] = avg2(pb[1], pb[2]);
pa[2] = avg2(pb[2], pb[3]);
pa[3] = avg2(pb[3], pb[4]);
break;
case 2:
pa[0] = avg2(pb[0], pb[hw]);
pa[1] = avg2(pb[1], pb[hw+1]);
pa[2] = avg2(pb[2], pb[hw+2]);
pa[3] = avg2(pb[3], pb[hw+3]);
break;
case 3:
pa[0] = avg4(pb[0], pb[1], pb[hw], pb[hw+1]);
pa[1] = avg4(pb[1], pb[2], pb[hw+1], pb[hw+2]);
pa[2] = avg4(pb[2], pb[3], pb[hw+2], pb[hw+3]);
pa[3] = avg4(pb[3], pb[4], pb[hw+3], pb[hw+4]);
break;
}
pa += ri->c_stride;
pb += ri->c_stride;
}
pa = ri->current_frame.data[2] + (y * ri->y_stride)/4 + x/2;
pb = ri->last_frame.data[2] + (my/2) * (ri->y_stride/2) + (mx + 1)/2;
}
#endif
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(RoqContext *VAR_0, int VAR_1, int VAR_2,
unsigned char VAR_3, signed char VAR_4, signed char VAR_5)
{
int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;
unsigned char *VAR_11, *VAR_12;
VAR_6 = VAR_1 + 8 - (VAR_3 >> 4) - VAR_4;
VAR_7 = VAR_2 + 8 - (VAR_3 & 0xf) - VAR_5;
VAR_11 = VAR_0->current_frame.data[0] + (VAR_2 * VAR_0->y_stride) + VAR_1;
VAR_12 = VAR_0->last_frame.data[0] + (VAR_7 * VAR_0->y_stride) + VAR_6;
for(VAR_8 = 0; VAR_8 < 8; VAR_8++) {
VAR_11[0] = VAR_12[0];
VAR_11[1] = VAR_12[1];
VAR_11[2] = VAR_12[2];
VAR_11[3] = VAR_12[3];
VAR_11[4] = VAR_12[4];
VAR_11[5] = VAR_12[5];
VAR_11[6] = VAR_12[6];
VAR_11[7] = VAR_12[7];
VAR_11 += VAR_0->y_stride;
VAR_12 += VAR_0->y_stride;
}
#if 0
VAR_11 = VAR_0->current_frame.data[1] + (VAR_2/2) * (VAR_0->c_stride) + VAR_1/2;
VAR_12 = VAR_0->last_frame.data[1] + (VAR_7/2) * (VAR_0->c_stride) + (VAR_6 + 1)/2;
for(VAR_8 = 0; VAR_8 < 4; VAR_8++) {
VAR_11[0] = VAR_12[0];
VAR_11[1] = VAR_12[1];
VAR_11[2] = VAR_12[2];
VAR_11[3] = VAR_12[3];
VAR_11 += VAR_0->c_stride;
VAR_12 += VAR_0->c_stride;
}
VAR_11 = VAR_0->current_frame.data[2] + (VAR_2/2) * (VAR_0->c_stride) + VAR_1/2;
VAR_12 = VAR_0->last_frame.data[2] + (VAR_7/2) * (VAR_0->c_stride) + (VAR_6 + 1)/2;
for(VAR_8 = 0; VAR_8 < 4; VAR_8++) {
VAR_11[0] = VAR_12[0];
VAR_11[1] = VAR_12[1];
VAR_11[2] = VAR_12[2];
VAR_11[3] = VAR_12[3];
VAR_11 += VAR_0->c_stride;
VAR_12 += VAR_0->c_stride;
}
#else
VAR_10 = VAR_0->c_stride;
VAR_11 = VAR_0->current_frame.data[1] + (VAR_2 * VAR_0->y_stride)/4 + VAR_1/2;
VAR_12 = VAR_0->last_frame.data[1] + (VAR_7/2) * (VAR_0->y_stride/2) + (VAR_6 + 1)/2;
for(VAR_9 = 0; VAR_9 < 2; VAR_9++) {
for(VAR_8 = 0; VAR_8 < 4; VAR_8++) {
switch(((VAR_7 & 0x01) << 1) | (VAR_6 & 0x01)) {
case 0:
VAR_11[0] = VAR_12[0];
VAR_11[1] = VAR_12[1];
VAR_11[2] = VAR_12[2];
VAR_11[3] = VAR_12[3];
break;
case 1:
VAR_11[0] = avg2(VAR_12[0], VAR_12[1]);
VAR_11[1] = avg2(VAR_12[1], VAR_12[2]);
VAR_11[2] = avg2(VAR_12[2], VAR_12[3]);
VAR_11[3] = avg2(VAR_12[3], VAR_12[4]);
break;
case 2:
VAR_11[0] = avg2(VAR_12[0], VAR_12[VAR_10]);
VAR_11[1] = avg2(VAR_12[1], VAR_12[VAR_10+1]);
VAR_11[2] = avg2(VAR_12[2], VAR_12[VAR_10+2]);
VAR_11[3] = avg2(VAR_12[3], VAR_12[VAR_10+3]);
break;
case 3:
VAR_11[0] = avg4(VAR_12[0], VAR_12[1], VAR_12[VAR_10], VAR_12[VAR_10+1]);
VAR_11[1] = avg4(VAR_12[1], VAR_12[2], VAR_12[VAR_10+1], VAR_12[VAR_10+2]);
VAR_11[2] = avg4(VAR_12[2], VAR_12[3], VAR_12[VAR_10+2], VAR_12[VAR_10+3]);
VAR_11[3] = avg4(VAR_12[3], VAR_12[4], VAR_12[VAR_10+3], VAR_12[VAR_10+4]);
break;
}
VAR_11 += VAR_0->c_stride;
VAR_12 += VAR_0->c_stride;
}
VAR_11 = VAR_0->current_frame.data[2] + (VAR_2 * VAR_0->y_stride)/4 + VAR_1/2;
VAR_12 = VAR_0->last_frame.data[2] + (VAR_7/2) * (VAR_0->y_stride/2) + (VAR_6 + 1)/2;
}
#endif
}
|
[
"static void FUNC_0(RoqContext *VAR_0, int VAR_1, int VAR_2,\nunsigned char VAR_3, signed char VAR_4, signed char VAR_5)\n{",
"int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;",
"unsigned char *VAR_11, *VAR_12;",
"VAR_6 = VAR_1 + 8 - (VAR_3 >> 4) - VAR_4;",
"VAR_7 = VAR_2 + 8 - (VAR_3 & 0xf) - VAR_5;",
"VAR_11 = VAR_0->current_frame.data[0] + (VAR_2 * VAR_0->y_stride) + VAR_1;",
"VAR_12 = VAR_0->last_frame.data[0] + (VAR_7 * VAR_0->y_stride) + VAR_6;",
"for(VAR_8 = 0; VAR_8 < 8; VAR_8++) {",
"VAR_11[0] = VAR_12[0];",
"VAR_11[1] = VAR_12[1];",
"VAR_11[2] = VAR_12[2];",
"VAR_11[3] = VAR_12[3];",
"VAR_11[4] = VAR_12[4];",
"VAR_11[5] = VAR_12[5];",
"VAR_11[6] = VAR_12[6];",
"VAR_11[7] = VAR_12[7];",
"VAR_11 += VAR_0->y_stride;",
"VAR_12 += VAR_0->y_stride;",
"}",
"#if 0\nVAR_11 = VAR_0->current_frame.data[1] + (VAR_2/2) * (VAR_0->c_stride) + VAR_1/2;",
"VAR_12 = VAR_0->last_frame.data[1] + (VAR_7/2) * (VAR_0->c_stride) + (VAR_6 + 1)/2;",
"for(VAR_8 = 0; VAR_8 < 4; VAR_8++) {",
"VAR_11[0] = VAR_12[0];",
"VAR_11[1] = VAR_12[1];",
"VAR_11[2] = VAR_12[2];",
"VAR_11[3] = VAR_12[3];",
"VAR_11 += VAR_0->c_stride;",
"VAR_12 += VAR_0->c_stride;",
"}",
"VAR_11 = VAR_0->current_frame.data[2] + (VAR_2/2) * (VAR_0->c_stride) + VAR_1/2;",
"VAR_12 = VAR_0->last_frame.data[2] + (VAR_7/2) * (VAR_0->c_stride) + (VAR_6 + 1)/2;",
"for(VAR_8 = 0; VAR_8 < 4; VAR_8++) {",
"VAR_11[0] = VAR_12[0];",
"VAR_11[1] = VAR_12[1];",
"VAR_11[2] = VAR_12[2];",
"VAR_11[3] = VAR_12[3];",
"VAR_11 += VAR_0->c_stride;",
"VAR_12 += VAR_0->c_stride;",
"}",
"#else\nVAR_10 = VAR_0->c_stride;",
"VAR_11 = VAR_0->current_frame.data[1] + (VAR_2 * VAR_0->y_stride)/4 + VAR_1/2;",
"VAR_12 = VAR_0->last_frame.data[1] + (VAR_7/2) * (VAR_0->y_stride/2) + (VAR_6 + 1)/2;",
"for(VAR_9 = 0; VAR_9 < 2; VAR_9++) {",
"for(VAR_8 = 0; VAR_8 < 4; VAR_8++) {",
"switch(((VAR_7 & 0x01) << 1) | (VAR_6 & 0x01)) {",
"case 0:\nVAR_11[0] = VAR_12[0];",
"VAR_11[1] = VAR_12[1];",
"VAR_11[2] = VAR_12[2];",
"VAR_11[3] = VAR_12[3];",
"break;",
"case 1:\nVAR_11[0] = avg2(VAR_12[0], VAR_12[1]);",
"VAR_11[1] = avg2(VAR_12[1], VAR_12[2]);",
"VAR_11[2] = avg2(VAR_12[2], VAR_12[3]);",
"VAR_11[3] = avg2(VAR_12[3], VAR_12[4]);",
"break;",
"case 2:\nVAR_11[0] = avg2(VAR_12[0], VAR_12[VAR_10]);",
"VAR_11[1] = avg2(VAR_12[1], VAR_12[VAR_10+1]);",
"VAR_11[2] = avg2(VAR_12[2], VAR_12[VAR_10+2]);",
"VAR_11[3] = avg2(VAR_12[3], VAR_12[VAR_10+3]);",
"break;",
"case 3:\nVAR_11[0] = avg4(VAR_12[0], VAR_12[1], VAR_12[VAR_10], VAR_12[VAR_10+1]);",
"VAR_11[1] = avg4(VAR_12[1], VAR_12[2], VAR_12[VAR_10+1], VAR_12[VAR_10+2]);",
"VAR_11[2] = avg4(VAR_12[2], VAR_12[3], VAR_12[VAR_10+2], VAR_12[VAR_10+3]);",
"VAR_11[3] = avg4(VAR_12[3], VAR_12[4], VAR_12[VAR_10+3], VAR_12[VAR_10+4]);",
"break;",
"}",
"VAR_11 += VAR_0->c_stride;",
"VAR_12 += VAR_0->c_stride;",
"}",
"VAR_11 = VAR_0->current_frame.data[2] + (VAR_2 * VAR_0->y_stride)/4 + VAR_1/2;",
"VAR_12 = VAR_0->last_frame.data[2] + (VAR_7/2) * (VAR_0->y_stride/2) + (VAR_6 + 1)/2;",
"}",
"#endif\n}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
49,
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93,
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
109,
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
123,
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
137,
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
151,
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165
],
[
167
],
[
169
],
[
173
],
[
175
],
[
177
],
[
179,
181
]
] |
7,236 |
void ff_avg_dirac_pixels16_sse2(uint8_t *dst, const uint8_t *src[5], int stride, int h)
{
if (h&3)
ff_avg_dirac_pixels16_c(dst, src, stride, h);
else
ff_avg_pixels16_sse2(dst, src[0], stride, h);
}
| false |
FFmpeg
|
6a4832caaede15e3d918b1408ff83fe30324507b
|
void ff_avg_dirac_pixels16_sse2(uint8_t *dst, const uint8_t *src[5], int stride, int h)
{
if (h&3)
ff_avg_dirac_pixels16_c(dst, src, stride, h);
else
ff_avg_pixels16_sse2(dst, src[0], stride, h);
}
|
{
"code": [],
"line_no": []
}
|
void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1[5], int VAR_2, int VAR_3)
{
if (VAR_3&3)
ff_avg_dirac_pixels16_c(VAR_0, VAR_1, VAR_2, VAR_3);
else
ff_avg_pixels16_sse2(VAR_0, VAR_1[0], VAR_2, VAR_3);
}
|
[
"void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1[5], int VAR_2, int VAR_3)\n{",
"if (VAR_3&3)\nff_avg_dirac_pixels16_c(VAR_0, VAR_1, VAR_2, VAR_3);",
"else\nff_avg_pixels16_sse2(VAR_0, VAR_1[0], VAR_2, VAR_3);",
"}"
] |
[
0,
0,
0,
0
] |
[
[
1,
3
],
[
5,
7
],
[
9,
11
],
[
13
]
] |
7,237 |
int ff_ape_write_tag(AVFormatContext *s)
{
AVDictionaryEntry *e = NULL;
int64_t start, end;
int size, count = 0;
if (!s->pb->seekable)
return 0;
start = avio_tell(s->pb);
// header
avio_write(s->pb, "APETAGEX", 8); // id
avio_wl32 (s->pb, APE_TAG_VERSION); // version
avio_wl32(s->pb, 0); // reserve space for size
avio_wl32(s->pb, 0); // reserve space for tag count
// flags
avio_wl32(s->pb, APE_TAG_FLAG_CONTAINS_HEADER | APE_TAG_FLAG_CONTAINS_FOOTER |
APE_TAG_FLAG_IS_HEADER);
ffio_fill(s->pb, 0, 8); // reserved
while ((e = av_dict_get(s->metadata, "", e, AV_DICT_IGNORE_SUFFIX))) {
int val_len = strlen(e->value);
avio_wl32(s->pb, val_len); // value length
avio_wl32(s->pb, 0); // item flags
avio_put_str(s->pb, e->key); // key
avio_write(s->pb, e->value, val_len); // value
count++;
}
size = avio_tell(s->pb) - start;
// footer
avio_write(s->pb, "APETAGEX", 8); // id
avio_wl32 (s->pb, APE_TAG_VERSION); // version
avio_wl32(s->pb, size); // size
avio_wl32(s->pb, count); // tag count
// flags
avio_wl32(s->pb, APE_TAG_FLAG_CONTAINS_HEADER | APE_TAG_FLAG_CONTAINS_FOOTER);
ffio_fill(s->pb, 0, 8); // reserved
// update values in the header
end = avio_tell(s->pb);
avio_seek(s->pb, start + 12, SEEK_SET);
avio_wl32(s->pb, size);
avio_wl32(s->pb, count);
avio_seek(s->pb, end, SEEK_SET);
return 0;
}
| false |
FFmpeg
|
83548fe894cdb455cc127f754d09905b6d23c173
|
int ff_ape_write_tag(AVFormatContext *s)
{
AVDictionaryEntry *e = NULL;
int64_t start, end;
int size, count = 0;
if (!s->pb->seekable)
return 0;
start = avio_tell(s->pb);
avio_write(s->pb, "APETAGEX", 8);
avio_wl32 (s->pb, APE_TAG_VERSION);
avio_wl32(s->pb, 0);
avio_wl32(s->pb, 0);
avio_wl32(s->pb, APE_TAG_FLAG_CONTAINS_HEADER | APE_TAG_FLAG_CONTAINS_FOOTER |
APE_TAG_FLAG_IS_HEADER);
ffio_fill(s->pb, 0, 8);
while ((e = av_dict_get(s->metadata, "", e, AV_DICT_IGNORE_SUFFIX))) {
int val_len = strlen(e->value);
avio_wl32(s->pb, val_len);
avio_wl32(s->pb, 0);
avio_put_str(s->pb, e->key);
avio_write(s->pb, e->value, val_len);
count++;
}
size = avio_tell(s->pb) - start;
avio_write(s->pb, "APETAGEX", 8);
avio_wl32 (s->pb, APE_TAG_VERSION);
avio_wl32(s->pb, size);
avio_wl32(s->pb, count);
avio_wl32(s->pb, APE_TAG_FLAG_CONTAINS_HEADER | APE_TAG_FLAG_CONTAINS_FOOTER);
ffio_fill(s->pb, 0, 8);
end = avio_tell(s->pb);
avio_seek(s->pb, start + 12, SEEK_SET);
avio_wl32(s->pb, size);
avio_wl32(s->pb, count);
avio_seek(s->pb, end, SEEK_SET);
return 0;
}
|
{
"code": [],
"line_no": []
}
|
int FUNC_0(AVFormatContext *VAR_0)
{
AVDictionaryEntry *e = NULL;
int64_t start, end;
int VAR_1, VAR_2 = 0;
if (!VAR_0->pb->seekable)
return 0;
start = avio_tell(VAR_0->pb);
avio_write(VAR_0->pb, "APETAGEX", 8);
avio_wl32 (VAR_0->pb, APE_TAG_VERSION);
avio_wl32(VAR_0->pb, 0);
avio_wl32(VAR_0->pb, 0);
avio_wl32(VAR_0->pb, APE_TAG_FLAG_CONTAINS_HEADER | APE_TAG_FLAG_CONTAINS_FOOTER |
APE_TAG_FLAG_IS_HEADER);
ffio_fill(VAR_0->pb, 0, 8);
while ((e = av_dict_get(VAR_0->metadata, "", e, AV_DICT_IGNORE_SUFFIX))) {
int VAR_3 = strlen(e->value);
avio_wl32(VAR_0->pb, VAR_3);
avio_wl32(VAR_0->pb, 0);
avio_put_str(VAR_0->pb, e->key);
avio_write(VAR_0->pb, e->value, VAR_3);
VAR_2++;
}
VAR_1 = avio_tell(VAR_0->pb) - start;
avio_write(VAR_0->pb, "APETAGEX", 8);
avio_wl32 (VAR_0->pb, APE_TAG_VERSION);
avio_wl32(VAR_0->pb, VAR_1);
avio_wl32(VAR_0->pb, VAR_2);
avio_wl32(VAR_0->pb, APE_TAG_FLAG_CONTAINS_HEADER | APE_TAG_FLAG_CONTAINS_FOOTER);
ffio_fill(VAR_0->pb, 0, 8);
end = avio_tell(VAR_0->pb);
avio_seek(VAR_0->pb, start + 12, SEEK_SET);
avio_wl32(VAR_0->pb, VAR_1);
avio_wl32(VAR_0->pb, VAR_2);
avio_seek(VAR_0->pb, end, SEEK_SET);
return 0;
}
|
[
"int FUNC_0(AVFormatContext *VAR_0)\n{",
"AVDictionaryEntry *e = NULL;",
"int64_t start, end;",
"int VAR_1, VAR_2 = 0;",
"if (!VAR_0->pb->seekable)\nreturn 0;",
"start = avio_tell(VAR_0->pb);",
"avio_write(VAR_0->pb, \"APETAGEX\", 8);",
"avio_wl32 (VAR_0->pb, APE_TAG_VERSION);",
"avio_wl32(VAR_0->pb, 0);",
"avio_wl32(VAR_0->pb, 0);",
"avio_wl32(VAR_0->pb, APE_TAG_FLAG_CONTAINS_HEADER | APE_TAG_FLAG_CONTAINS_FOOTER |\nAPE_TAG_FLAG_IS_HEADER);",
"ffio_fill(VAR_0->pb, 0, 8);",
"while ((e = av_dict_get(VAR_0->metadata, \"\", e, AV_DICT_IGNORE_SUFFIX))) {",
"int VAR_3 = strlen(e->value);",
"avio_wl32(VAR_0->pb, VAR_3);",
"avio_wl32(VAR_0->pb, 0);",
"avio_put_str(VAR_0->pb, e->key);",
"avio_write(VAR_0->pb, e->value, VAR_3);",
"VAR_2++;",
"}",
"VAR_1 = avio_tell(VAR_0->pb) - start;",
"avio_write(VAR_0->pb, \"APETAGEX\", 8);",
"avio_wl32 (VAR_0->pb, APE_TAG_VERSION);",
"avio_wl32(VAR_0->pb, VAR_1);",
"avio_wl32(VAR_0->pb, VAR_2);",
"avio_wl32(VAR_0->pb, APE_TAG_FLAG_CONTAINS_HEADER | APE_TAG_FLAG_CONTAINS_FOOTER);",
"ffio_fill(VAR_0->pb, 0, 8);",
"end = avio_tell(VAR_0->pb);",
"avio_seek(VAR_0->pb, start + 12, SEEK_SET);",
"avio_wl32(VAR_0->pb, VAR_1);",
"avio_wl32(VAR_0->pb, VAR_2);",
"avio_seek(VAR_0->pb, end, SEEK_SET);",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13,
15
],
[
19
],
[
25
],
[
27
],
[
29
],
[
31
],
[
37,
39
],
[
41
],
[
45
],
[
47
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
65
],
[
71
],
[
73
],
[
75
],
[
77
],
[
83
],
[
85
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
103
],
[
105
]
] |
7,238 |
static void gen_cp0 (CPUMIPSState *env, DisasContext *ctx, uint32_t opc, int rt, int rd)
{
const char *opn = "ldst";
switch (opc) {
case OPC_MFC0:
if (rt == 0) {
/* Treat as NOP. */
return;
}
gen_mfc0(env, ctx, cpu_gpr[rt], rd, ctx->opcode & 0x7);
opn = "mfc0";
break;
case OPC_MTC0:
{
TCGv t0 = tcg_temp_new();
gen_load_gpr(t0, rt);
gen_mtc0(env, ctx, t0, rd, ctx->opcode & 0x7);
tcg_temp_free(t0);
}
opn = "mtc0";
break;
#if defined(TARGET_MIPS64)
case OPC_DMFC0:
check_insn(env, ctx, ISA_MIPS3);
if (rt == 0) {
/* Treat as NOP. */
return;
}
gen_dmfc0(env, ctx, cpu_gpr[rt], rd, ctx->opcode & 0x7);
opn = "dmfc0";
break;
case OPC_DMTC0:
check_insn(env, ctx, ISA_MIPS3);
{
TCGv t0 = tcg_temp_new();
gen_load_gpr(t0, rt);
gen_dmtc0(env, ctx, t0, rd, ctx->opcode & 0x7);
tcg_temp_free(t0);
}
opn = "dmtc0";
break;
#endif
case OPC_MFTR:
check_insn(env, ctx, ASE_MT);
if (rd == 0) {
/* Treat as NOP. */
return;
}
gen_mftr(env, ctx, rt, rd, (ctx->opcode >> 5) & 1,
ctx->opcode & 0x7, (ctx->opcode >> 4) & 1);
opn = "mftr";
break;
case OPC_MTTR:
check_insn(env, ctx, ASE_MT);
gen_mttr(env, ctx, rd, rt, (ctx->opcode >> 5) & 1,
ctx->opcode & 0x7, (ctx->opcode >> 4) & 1);
opn = "mttr";
break;
case OPC_TLBWI:
opn = "tlbwi";
if (!env->tlb->helper_tlbwi)
goto die;
gen_helper_tlbwi();
break;
case OPC_TLBWR:
opn = "tlbwr";
if (!env->tlb->helper_tlbwr)
goto die;
gen_helper_tlbwr();
break;
case OPC_TLBP:
opn = "tlbp";
if (!env->tlb->helper_tlbp)
goto die;
gen_helper_tlbp();
break;
case OPC_TLBR:
opn = "tlbr";
if (!env->tlb->helper_tlbr)
goto die;
gen_helper_tlbr();
break;
case OPC_ERET:
opn = "eret";
check_insn(env, ctx, ISA_MIPS2);
gen_helper_eret();
ctx->bstate = BS_EXCP;
break;
case OPC_DERET:
opn = "deret";
check_insn(env, ctx, ISA_MIPS32);
if (!(ctx->hflags & MIPS_HFLAG_DM)) {
MIPS_INVAL(opn);
generate_exception(ctx, EXCP_RI);
} else {
gen_helper_deret();
ctx->bstate = BS_EXCP;
}
break;
case OPC_WAIT:
opn = "wait";
check_insn(env, ctx, ISA_MIPS3 | ISA_MIPS32);
/* If we get an exception, we want to restart at next instruction */
ctx->pc += 4;
save_cpu_state(ctx, 1);
ctx->pc -= 4;
gen_helper_wait();
ctx->bstate = BS_EXCP;
break;
default:
die:
MIPS_INVAL(opn);
generate_exception(ctx, EXCP_RI);
return;
}
(void)opn; /* avoid a compiler warning */
MIPS_DEBUG("%s %s %d", opn, regnames[rt], rd);
}
| true |
qemu
|
2e15497c5b8d0d172dece0cf56e2d2e977a6b679
|
static void gen_cp0 (CPUMIPSState *env, DisasContext *ctx, uint32_t opc, int rt, int rd)
{
const char *opn = "ldst";
switch (opc) {
case OPC_MFC0:
if (rt == 0) {
return;
}
gen_mfc0(env, ctx, cpu_gpr[rt], rd, ctx->opcode & 0x7);
opn = "mfc0";
break;
case OPC_MTC0:
{
TCGv t0 = tcg_temp_new();
gen_load_gpr(t0, rt);
gen_mtc0(env, ctx, t0, rd, ctx->opcode & 0x7);
tcg_temp_free(t0);
}
opn = "mtc0";
break;
#if defined(TARGET_MIPS64)
case OPC_DMFC0:
check_insn(env, ctx, ISA_MIPS3);
if (rt == 0) {
return;
}
gen_dmfc0(env, ctx, cpu_gpr[rt], rd, ctx->opcode & 0x7);
opn = "dmfc0";
break;
case OPC_DMTC0:
check_insn(env, ctx, ISA_MIPS3);
{
TCGv t0 = tcg_temp_new();
gen_load_gpr(t0, rt);
gen_dmtc0(env, ctx, t0, rd, ctx->opcode & 0x7);
tcg_temp_free(t0);
}
opn = "dmtc0";
break;
#endif
case OPC_MFTR:
check_insn(env, ctx, ASE_MT);
if (rd == 0) {
return;
}
gen_mftr(env, ctx, rt, rd, (ctx->opcode >> 5) & 1,
ctx->opcode & 0x7, (ctx->opcode >> 4) & 1);
opn = "mftr";
break;
case OPC_MTTR:
check_insn(env, ctx, ASE_MT);
gen_mttr(env, ctx, rd, rt, (ctx->opcode >> 5) & 1,
ctx->opcode & 0x7, (ctx->opcode >> 4) & 1);
opn = "mttr";
break;
case OPC_TLBWI:
opn = "tlbwi";
if (!env->tlb->helper_tlbwi)
goto die;
gen_helper_tlbwi();
break;
case OPC_TLBWR:
opn = "tlbwr";
if (!env->tlb->helper_tlbwr)
goto die;
gen_helper_tlbwr();
break;
case OPC_TLBP:
opn = "tlbp";
if (!env->tlb->helper_tlbp)
goto die;
gen_helper_tlbp();
break;
case OPC_TLBR:
opn = "tlbr";
if (!env->tlb->helper_tlbr)
goto die;
gen_helper_tlbr();
break;
case OPC_ERET:
opn = "eret";
check_insn(env, ctx, ISA_MIPS2);
gen_helper_eret();
ctx->bstate = BS_EXCP;
break;
case OPC_DERET:
opn = "deret";
check_insn(env, ctx, ISA_MIPS32);
if (!(ctx->hflags & MIPS_HFLAG_DM)) {
MIPS_INVAL(opn);
generate_exception(ctx, EXCP_RI);
} else {
gen_helper_deret();
ctx->bstate = BS_EXCP;
}
break;
case OPC_WAIT:
opn = "wait";
check_insn(env, ctx, ISA_MIPS3 | ISA_MIPS32);
ctx->pc += 4;
save_cpu_state(ctx, 1);
ctx->pc -= 4;
gen_helper_wait();
ctx->bstate = BS_EXCP;
break;
default:
die:
MIPS_INVAL(opn);
generate_exception(ctx, EXCP_RI);
return;
}
(void)opn;
MIPS_DEBUG("%s %s %d", opn, regnames[rt], rd);
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0 (CPUMIPSState *VAR_0, DisasContext *VAR_1, uint32_t VAR_2, int VAR_3, int VAR_4)
{
const char *VAR_5 = "ldst";
switch (VAR_2) {
case OPC_MFC0:
if (VAR_3 == 0) {
return;
}
gen_mfc0(VAR_0, VAR_1, cpu_gpr[VAR_3], VAR_4, VAR_1->opcode & 0x7);
VAR_5 = "mfc0";
break;
case OPC_MTC0:
{
TCGv t0 = tcg_temp_new();
gen_load_gpr(t0, VAR_3);
gen_mtc0(VAR_0, VAR_1, t0, VAR_4, VAR_1->opcode & 0x7);
tcg_temp_free(t0);
}
VAR_5 = "mtc0";
break;
#if defined(TARGET_MIPS64)
case OPC_DMFC0:
check_insn(VAR_0, VAR_1, ISA_MIPS3);
if (VAR_3 == 0) {
return;
}
gen_dmfc0(VAR_0, VAR_1, cpu_gpr[VAR_3], VAR_4, VAR_1->opcode & 0x7);
VAR_5 = "dmfc0";
break;
case OPC_DMTC0:
check_insn(VAR_0, VAR_1, ISA_MIPS3);
{
TCGv t0 = tcg_temp_new();
gen_load_gpr(t0, VAR_3);
gen_dmtc0(VAR_0, VAR_1, t0, VAR_4, VAR_1->opcode & 0x7);
tcg_temp_free(t0);
}
VAR_5 = "dmtc0";
break;
#endif
case OPC_MFTR:
check_insn(VAR_0, VAR_1, ASE_MT);
if (VAR_4 == 0) {
return;
}
gen_mftr(VAR_0, VAR_1, VAR_3, VAR_4, (VAR_1->opcode >> 5) & 1,
VAR_1->opcode & 0x7, (VAR_1->opcode >> 4) & 1);
VAR_5 = "mftr";
break;
case OPC_MTTR:
check_insn(VAR_0, VAR_1, ASE_MT);
gen_mttr(VAR_0, VAR_1, VAR_4, VAR_3, (VAR_1->opcode >> 5) & 1,
VAR_1->opcode & 0x7, (VAR_1->opcode >> 4) & 1);
VAR_5 = "mttr";
break;
case OPC_TLBWI:
VAR_5 = "tlbwi";
if (!VAR_0->tlb->helper_tlbwi)
goto die;
gen_helper_tlbwi();
break;
case OPC_TLBWR:
VAR_5 = "tlbwr";
if (!VAR_0->tlb->helper_tlbwr)
goto die;
gen_helper_tlbwr();
break;
case OPC_TLBP:
VAR_5 = "tlbp";
if (!VAR_0->tlb->helper_tlbp)
goto die;
gen_helper_tlbp();
break;
case OPC_TLBR:
VAR_5 = "tlbr";
if (!VAR_0->tlb->helper_tlbr)
goto die;
gen_helper_tlbr();
break;
case OPC_ERET:
VAR_5 = "eret";
check_insn(VAR_0, VAR_1, ISA_MIPS2);
gen_helper_eret();
VAR_1->bstate = BS_EXCP;
break;
case OPC_DERET:
VAR_5 = "deret";
check_insn(VAR_0, VAR_1, ISA_MIPS32);
if (!(VAR_1->hflags & MIPS_HFLAG_DM)) {
MIPS_INVAL(VAR_5);
generate_exception(VAR_1, EXCP_RI);
} else {
gen_helper_deret();
VAR_1->bstate = BS_EXCP;
}
break;
case OPC_WAIT:
VAR_5 = "wait";
check_insn(VAR_0, VAR_1, ISA_MIPS3 | ISA_MIPS32);
VAR_1->pc += 4;
save_cpu_state(VAR_1, 1);
VAR_1->pc -= 4;
gen_helper_wait();
VAR_1->bstate = BS_EXCP;
break;
default:
die:
MIPS_INVAL(VAR_5);
generate_exception(VAR_1, EXCP_RI);
return;
}
(void)VAR_5;
MIPS_DEBUG("%s %s %d", VAR_5, regnames[VAR_3], VAR_4);
}
|
[
"static void FUNC_0 (CPUMIPSState *VAR_0, DisasContext *VAR_1, uint32_t VAR_2, int VAR_3, int VAR_4)\n{",
"const char *VAR_5 = \"ldst\";",
"switch (VAR_2) {",
"case OPC_MFC0:\nif (VAR_3 == 0) {",
"return;",
"}",
"gen_mfc0(VAR_0, VAR_1, cpu_gpr[VAR_3], VAR_4, VAR_1->opcode & 0x7);",
"VAR_5 = \"mfc0\";",
"break;",
"case OPC_MTC0:\n{",
"TCGv t0 = tcg_temp_new();",
"gen_load_gpr(t0, VAR_3);",
"gen_mtc0(VAR_0, VAR_1, t0, VAR_4, VAR_1->opcode & 0x7);",
"tcg_temp_free(t0);",
"}",
"VAR_5 = \"mtc0\";",
"break;",
"#if defined(TARGET_MIPS64)\ncase OPC_DMFC0:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS3);",
"if (VAR_3 == 0) {",
"return;",
"}",
"gen_dmfc0(VAR_0, VAR_1, cpu_gpr[VAR_3], VAR_4, VAR_1->opcode & 0x7);",
"VAR_5 = \"dmfc0\";",
"break;",
"case OPC_DMTC0:\ncheck_insn(VAR_0, VAR_1, ISA_MIPS3);",
"{",
"TCGv t0 = tcg_temp_new();",
"gen_load_gpr(t0, VAR_3);",
"gen_dmtc0(VAR_0, VAR_1, t0, VAR_4, VAR_1->opcode & 0x7);",
"tcg_temp_free(t0);",
"}",
"VAR_5 = \"dmtc0\";",
"break;",
"#endif\ncase OPC_MFTR:\ncheck_insn(VAR_0, VAR_1, ASE_MT);",
"if (VAR_4 == 0) {",
"return;",
"}",
"gen_mftr(VAR_0, VAR_1, VAR_3, VAR_4, (VAR_1->opcode >> 5) & 1,\nVAR_1->opcode & 0x7, (VAR_1->opcode >> 4) & 1);",
"VAR_5 = \"mftr\";",
"break;",
"case OPC_MTTR:\ncheck_insn(VAR_0, VAR_1, ASE_MT);",
"gen_mttr(VAR_0, VAR_1, VAR_4, VAR_3, (VAR_1->opcode >> 5) & 1,\nVAR_1->opcode & 0x7, (VAR_1->opcode >> 4) & 1);",
"VAR_5 = \"mttr\";",
"break;",
"case OPC_TLBWI:\nVAR_5 = \"tlbwi\";",
"if (!VAR_0->tlb->helper_tlbwi)\ngoto die;",
"gen_helper_tlbwi();",
"break;",
"case OPC_TLBWR:\nVAR_5 = \"tlbwr\";",
"if (!VAR_0->tlb->helper_tlbwr)\ngoto die;",
"gen_helper_tlbwr();",
"break;",
"case OPC_TLBP:\nVAR_5 = \"tlbp\";",
"if (!VAR_0->tlb->helper_tlbp)\ngoto die;",
"gen_helper_tlbp();",
"break;",
"case OPC_TLBR:\nVAR_5 = \"tlbr\";",
"if (!VAR_0->tlb->helper_tlbr)\ngoto die;",
"gen_helper_tlbr();",
"break;",
"case OPC_ERET:\nVAR_5 = \"eret\";",
"check_insn(VAR_0, VAR_1, ISA_MIPS2);",
"gen_helper_eret();",
"VAR_1->bstate = BS_EXCP;",
"break;",
"case OPC_DERET:\nVAR_5 = \"deret\";",
"check_insn(VAR_0, VAR_1, ISA_MIPS32);",
"if (!(VAR_1->hflags & MIPS_HFLAG_DM)) {",
"MIPS_INVAL(VAR_5);",
"generate_exception(VAR_1, EXCP_RI);",
"} else {",
"gen_helper_deret();",
"VAR_1->bstate = BS_EXCP;",
"}",
"break;",
"case OPC_WAIT:\nVAR_5 = \"wait\";",
"check_insn(VAR_0, VAR_1, ISA_MIPS3 | ISA_MIPS32);",
"VAR_1->pc += 4;",
"save_cpu_state(VAR_1, 1);",
"VAR_1->pc -= 4;",
"gen_helper_wait();",
"VAR_1->bstate = BS_EXCP;",
"break;",
"default:\ndie:\nMIPS_INVAL(VAR_5);",
"generate_exception(VAR_1, EXCP_RI);",
"return;",
"}",
"(void)VAR_5;",
"MIPS_DEBUG(\"%s %s %d\", VAR_5, regnames[VAR_3], 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
] |
[
[
1,
3
],
[
5
],
[
10
],
[
12,
14
],
[
18
],
[
20
],
[
22
],
[
24
],
[
26
],
[
28,
30
],
[
32
],
[
36
],
[
38
],
[
40
],
[
42
],
[
44
],
[
46
],
[
48,
50,
52
],
[
54
],
[
58
],
[
60
],
[
62
],
[
64
],
[
66
],
[
68,
70
],
[
72
],
[
74
],
[
78
],
[
80
],
[
82
],
[
84
],
[
86
],
[
88
],
[
90,
92,
94
],
[
96
],
[
100
],
[
102
],
[
104,
106
],
[
108
],
[
110
],
[
112,
114
],
[
116,
118
],
[
120
],
[
122
],
[
124,
126
],
[
128,
130
],
[
132
],
[
134
],
[
136,
138
],
[
140,
142
],
[
144
],
[
146
],
[
148,
150
],
[
152,
154
],
[
156
],
[
158
],
[
160,
162
],
[
164,
166
],
[
168
],
[
170
],
[
172,
174
],
[
176
],
[
178
],
[
180
],
[
182
],
[
184,
186
],
[
188
],
[
190
],
[
192
],
[
194
],
[
196
],
[
198
],
[
200
],
[
202
],
[
204
],
[
206,
208
],
[
210
],
[
214
],
[
216
],
[
218
],
[
220
],
[
222
],
[
224
],
[
226,
228,
230
],
[
232
],
[
234
],
[
236
],
[
238
],
[
240
],
[
242
]
] |
7,239 |
static inline uint64_t v4l2_get_pts(V4L2Buffer *avbuf)
{
V4L2m2mContext *s = buf_to_m2mctx(avbuf);
AVRational v4l2_timebase = { 1, USEC_PER_SEC };
int64_t v4l2_pts;
/* convert pts back to encoder timebase */
v4l2_pts = avbuf->buf.timestamp.tv_sec * USEC_PER_SEC + avbuf->buf.timestamp.tv_usec;
return av_rescale_q(v4l2_pts, v4l2_timebase, s->avctx->time_base);
}
| true |
FFmpeg
|
2e96f5278095d44f090a4d89507e62d27cccf3b9
|
static inline uint64_t v4l2_get_pts(V4L2Buffer *avbuf)
{
V4L2m2mContext *s = buf_to_m2mctx(avbuf);
AVRational v4l2_timebase = { 1, USEC_PER_SEC };
int64_t v4l2_pts;
v4l2_pts = avbuf->buf.timestamp.tv_sec * USEC_PER_SEC + avbuf->buf.timestamp.tv_usec;
return av_rescale_q(v4l2_pts, v4l2_timebase, s->avctx->time_base);
}
|
{
"code": [
" v4l2_pts = avbuf->buf.timestamp.tv_sec * USEC_PER_SEC + avbuf->buf.timestamp.tv_usec;"
],
"line_no": [
15
]
}
|
static inline uint64_t FUNC_0(V4L2Buffer *avbuf)
{
V4L2m2mContext *s = buf_to_m2mctx(avbuf);
AVRational v4l2_timebase = { 1, USEC_PER_SEC };
int64_t v4l2_pts;
v4l2_pts = avbuf->buf.timestamp.tv_sec * USEC_PER_SEC + avbuf->buf.timestamp.tv_usec;
return av_rescale_q(v4l2_pts, v4l2_timebase, s->avctx->time_base);
}
|
[
"static inline uint64_t FUNC_0(V4L2Buffer *avbuf)\n{",
"V4L2m2mContext *s = buf_to_m2mctx(avbuf);",
"AVRational v4l2_timebase = { 1, USEC_PER_SEC };",
"int64_t v4l2_pts;",
"v4l2_pts = avbuf->buf.timestamp.tv_sec * USEC_PER_SEC + avbuf->buf.timestamp.tv_usec;",
"return av_rescale_q(v4l2_pts, v4l2_timebase, s->avctx->time_base);",
"}"
] |
[
0,
0,
0,
0,
1,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
15
],
[
19
],
[
21
]
] |
7,240 |
static int parallels_create(const char *filename, QemuOpts *opts, Error **errp)
{
int64_t total_size, cl_size;
uint8_t tmp[BDRV_SECTOR_SIZE];
Error *local_err = NULL;
BlockBackend *file;
uint32_t bat_entries, bat_sectors;
ParallelsHeader header;
int ret;
total_size = ROUND_UP(qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0),
BDRV_SECTOR_SIZE);
cl_size = ROUND_UP(qemu_opt_get_size_del(opts, BLOCK_OPT_CLUSTER_SIZE,
DEFAULT_CLUSTER_SIZE), BDRV_SECTOR_SIZE);
ret = bdrv_create_file(filename, opts, &local_err);
if (ret < 0) {
return ret;
file = blk_new_open(filename, NULL, NULL,
BDRV_O_RDWR | BDRV_O_PROTOCOL, &local_err);
if (file == NULL) {
return -EIO;
blk_set_allow_write_beyond_eof(file, true);
ret = blk_truncate(file, 0);
if (ret < 0) {
goto exit;
bat_entries = DIV_ROUND_UP(total_size, cl_size);
bat_sectors = DIV_ROUND_UP(bat_entry_off(bat_entries), cl_size);
bat_sectors = (bat_sectors * cl_size) >> BDRV_SECTOR_BITS;
memset(&header, 0, sizeof(header));
memcpy(header.magic, HEADER_MAGIC2, sizeof(header.magic));
header.version = cpu_to_le32(HEADER_VERSION);
/* don't care much about geometry, it is not used on image level */
header.heads = cpu_to_le32(16);
header.cylinders = cpu_to_le32(total_size / BDRV_SECTOR_SIZE / 16 / 32);
header.tracks = cpu_to_le32(cl_size >> BDRV_SECTOR_BITS);
header.bat_entries = cpu_to_le32(bat_entries);
header.nb_sectors = cpu_to_le64(DIV_ROUND_UP(total_size, BDRV_SECTOR_SIZE));
header.data_off = cpu_to_le32(bat_sectors);
/* write all the data */
memset(tmp, 0, sizeof(tmp));
memcpy(tmp, &header, sizeof(header));
ret = blk_pwrite(file, 0, tmp, BDRV_SECTOR_SIZE, 0);
if (ret < 0) {
goto exit;
ret = blk_pwrite_zeroes(file, BDRV_SECTOR_SIZE,
(bat_sectors - 1) << BDRV_SECTOR_BITS, 0);
if (ret < 0) {
goto exit;
ret = 0;
done:
blk_unref(file);
return ret;
exit:
error_setg_errno(errp, -ret, "Failed to create Parallels image");
goto done;
| true |
qemu
|
555a608c5d5dcc44e45a483ca09b449d8db519d1
|
static int parallels_create(const char *filename, QemuOpts *opts, Error **errp)
{
int64_t total_size, cl_size;
uint8_t tmp[BDRV_SECTOR_SIZE];
Error *local_err = NULL;
BlockBackend *file;
uint32_t bat_entries, bat_sectors;
ParallelsHeader header;
int ret;
total_size = ROUND_UP(qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0),
BDRV_SECTOR_SIZE);
cl_size = ROUND_UP(qemu_opt_get_size_del(opts, BLOCK_OPT_CLUSTER_SIZE,
DEFAULT_CLUSTER_SIZE), BDRV_SECTOR_SIZE);
ret = bdrv_create_file(filename, opts, &local_err);
if (ret < 0) {
return ret;
file = blk_new_open(filename, NULL, NULL,
BDRV_O_RDWR | BDRV_O_PROTOCOL, &local_err);
if (file == NULL) {
return -EIO;
blk_set_allow_write_beyond_eof(file, true);
ret = blk_truncate(file, 0);
if (ret < 0) {
goto exit;
bat_entries = DIV_ROUND_UP(total_size, cl_size);
bat_sectors = DIV_ROUND_UP(bat_entry_off(bat_entries), cl_size);
bat_sectors = (bat_sectors * cl_size) >> BDRV_SECTOR_BITS;
memset(&header, 0, sizeof(header));
memcpy(header.magic, HEADER_MAGIC2, sizeof(header.magic));
header.version = cpu_to_le32(HEADER_VERSION);
header.heads = cpu_to_le32(16);
header.cylinders = cpu_to_le32(total_size / BDRV_SECTOR_SIZE / 16 / 32);
header.tracks = cpu_to_le32(cl_size >> BDRV_SECTOR_BITS);
header.bat_entries = cpu_to_le32(bat_entries);
header.nb_sectors = cpu_to_le64(DIV_ROUND_UP(total_size, BDRV_SECTOR_SIZE));
header.data_off = cpu_to_le32(bat_sectors);
memset(tmp, 0, sizeof(tmp));
memcpy(tmp, &header, sizeof(header));
ret = blk_pwrite(file, 0, tmp, BDRV_SECTOR_SIZE, 0);
if (ret < 0) {
goto exit;
ret = blk_pwrite_zeroes(file, BDRV_SECTOR_SIZE,
(bat_sectors - 1) << BDRV_SECTOR_BITS, 0);
if (ret < 0) {
goto exit;
ret = 0;
done:
blk_unref(file);
return ret;
exit:
error_setg_errno(errp, -ret, "Failed to create Parallels image");
goto done;
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(const char *VAR_0, QemuOpts *VAR_1, Error **VAR_2)
{
int64_t total_size, cl_size;
uint8_t tmp[BDRV_SECTOR_SIZE];
Error *local_err = NULL;
BlockBackend *file;
uint32_t bat_entries, bat_sectors;
ParallelsHeader header;
int VAR_3;
total_size = ROUND_UP(qemu_opt_get_size_del(VAR_1, BLOCK_OPT_SIZE, 0),
BDRV_SECTOR_SIZE);
cl_size = ROUND_UP(qemu_opt_get_size_del(VAR_1, BLOCK_OPT_CLUSTER_SIZE,
DEFAULT_CLUSTER_SIZE), BDRV_SECTOR_SIZE);
VAR_3 = bdrv_create_file(VAR_0, VAR_1, &local_err);
if (VAR_3 < 0) {
return VAR_3;
file = blk_new_open(VAR_0, NULL, NULL,
BDRV_O_RDWR | BDRV_O_PROTOCOL, &local_err);
if (file == NULL) {
return -EIO;
blk_set_allow_write_beyond_eof(file, true);
VAR_3 = blk_truncate(file, 0);
if (VAR_3 < 0) {
goto exit;
bat_entries = DIV_ROUND_UP(total_size, cl_size);
bat_sectors = DIV_ROUND_UP(bat_entry_off(bat_entries), cl_size);
bat_sectors = (bat_sectors * cl_size) >> BDRV_SECTOR_BITS;
memset(&header, 0, sizeof(header));
memcpy(header.magic, HEADER_MAGIC2, sizeof(header.magic));
header.version = cpu_to_le32(HEADER_VERSION);
header.heads = cpu_to_le32(16);
header.cylinders = cpu_to_le32(total_size / BDRV_SECTOR_SIZE / 16 / 32);
header.tracks = cpu_to_le32(cl_size >> BDRV_SECTOR_BITS);
header.bat_entries = cpu_to_le32(bat_entries);
header.nb_sectors = cpu_to_le64(DIV_ROUND_UP(total_size, BDRV_SECTOR_SIZE));
header.data_off = cpu_to_le32(bat_sectors);
memset(tmp, 0, sizeof(tmp));
memcpy(tmp, &header, sizeof(header));
VAR_3 = blk_pwrite(file, 0, tmp, BDRV_SECTOR_SIZE, 0);
if (VAR_3 < 0) {
goto exit;
VAR_3 = blk_pwrite_zeroes(file, BDRV_SECTOR_SIZE,
(bat_sectors - 1) << BDRV_SECTOR_BITS, 0);
if (VAR_3 < 0) {
goto exit;
VAR_3 = 0;
done:
blk_unref(file);
return VAR_3;
exit:
error_setg_errno(VAR_2, -VAR_3, "Failed to create Parallels image");
goto done;
|
[
"static int FUNC_0(const char *VAR_0, QemuOpts *VAR_1, Error **VAR_2)\n{",
"int64_t total_size, cl_size;",
"uint8_t tmp[BDRV_SECTOR_SIZE];",
"Error *local_err = NULL;",
"BlockBackend *file;",
"uint32_t bat_entries, bat_sectors;",
"ParallelsHeader header;",
"int VAR_3;",
"total_size = ROUND_UP(qemu_opt_get_size_del(VAR_1, BLOCK_OPT_SIZE, 0),\nBDRV_SECTOR_SIZE);",
"cl_size = ROUND_UP(qemu_opt_get_size_del(VAR_1, BLOCK_OPT_CLUSTER_SIZE,\nDEFAULT_CLUSTER_SIZE), BDRV_SECTOR_SIZE);",
"VAR_3 = bdrv_create_file(VAR_0, VAR_1, &local_err);",
"if (VAR_3 < 0) {",
"return VAR_3;",
"file = blk_new_open(VAR_0, NULL, NULL,\nBDRV_O_RDWR | BDRV_O_PROTOCOL, &local_err);",
"if (file == NULL) {",
"return -EIO;",
"blk_set_allow_write_beyond_eof(file, true);",
"VAR_3 = blk_truncate(file, 0);",
"if (VAR_3 < 0) {",
"goto exit;",
"bat_entries = DIV_ROUND_UP(total_size, cl_size);",
"bat_sectors = DIV_ROUND_UP(bat_entry_off(bat_entries), cl_size);",
"bat_sectors = (bat_sectors * cl_size) >> BDRV_SECTOR_BITS;",
"memset(&header, 0, sizeof(header));",
"memcpy(header.magic, HEADER_MAGIC2, sizeof(header.magic));",
"header.version = cpu_to_le32(HEADER_VERSION);",
"header.heads = cpu_to_le32(16);",
"header.cylinders = cpu_to_le32(total_size / BDRV_SECTOR_SIZE / 16 / 32);",
"header.tracks = cpu_to_le32(cl_size >> BDRV_SECTOR_BITS);",
"header.bat_entries = cpu_to_le32(bat_entries);",
"header.nb_sectors = cpu_to_le64(DIV_ROUND_UP(total_size, BDRV_SECTOR_SIZE));",
"header.data_off = cpu_to_le32(bat_sectors);",
"memset(tmp, 0, sizeof(tmp));",
"memcpy(tmp, &header, sizeof(header));",
"VAR_3 = blk_pwrite(file, 0, tmp, BDRV_SECTOR_SIZE, 0);",
"if (VAR_3 < 0) {",
"goto exit;",
"VAR_3 = blk_pwrite_zeroes(file, BDRV_SECTOR_SIZE,\n(bat_sectors - 1) << BDRV_SECTOR_BITS, 0);",
"if (VAR_3 < 0) {",
"goto exit;",
"VAR_3 = 0;",
"done:\nblk_unref(file);",
"return VAR_3;",
"exit:\nerror_setg_errno(VAR_2, -VAR_3, \"Failed to create Parallels image\");",
"goto done;"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
21,
23
],
[
25,
27
],
[
35
],
[
37
],
[
40
],
[
45,
47
],
[
49
],
[
52
],
[
57
],
[
61
],
[
63
],
[
65
],
[
70
],
[
72
],
[
74
],
[
78
],
[
80
],
[
82
],
[
86
],
[
88
],
[
90
],
[
92
],
[
94
],
[
96
],
[
102
],
[
104
],
[
108
],
[
110
],
[
112
],
[
115,
117
],
[
119
],
[
121
],
[
124
],
[
128,
130
],
[
132
],
[
136,
138
],
[
140
]
] |
7,241 |
static int stdio_put_buffer(void *opaque, const uint8_t *buf, int64_t pos,
int size)
{
QEMUFileStdio *s = opaque;
return fwrite(buf, 1, size, s->stdio_file);
}
| true |
qemu
|
aded6539d983280212e08d09f14157b1cb4d58cc
|
static int stdio_put_buffer(void *opaque, const uint8_t *buf, int64_t pos,
int size)
{
QEMUFileStdio *s = opaque;
return fwrite(buf, 1, size, s->stdio_file);
}
|
{
"code": [
" return fwrite(buf, 1, size, s->stdio_file);"
],
"line_no": [
9
]
}
|
static int FUNC_0(void *VAR_0, const uint8_t *VAR_1, int64_t VAR_2,
int VAR_3)
{
QEMUFileStdio *s = VAR_0;
return fwrite(VAR_1, 1, VAR_3, s->stdio_file);
}
|
[
"static int FUNC_0(void *VAR_0, const uint8_t *VAR_1, int64_t VAR_2,\nint VAR_3)\n{",
"QEMUFileStdio *s = VAR_0;",
"return fwrite(VAR_1, 1, VAR_3, s->stdio_file);",
"}"
] |
[
0,
0,
1,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
]
] |
7,242 |
void *address_space_map(AddressSpace *as,
hwaddr addr,
hwaddr *plen,
bool is_write)
{
hwaddr len = *plen;
hwaddr done = 0;
hwaddr l, xlat, base;
MemoryRegion *mr, *this_mr;
ram_addr_t raddr;
if (len == 0) {
return NULL;
}
l = len;
mr = address_space_translate(as, addr, &xlat, &l, is_write);
if (!memory_access_is_direct(mr, is_write)) {
if (bounce.buffer) {
return NULL;
}
/* Avoid unbounded allocations */
l = MIN(l, TARGET_PAGE_SIZE);
bounce.buffer = qemu_memalign(TARGET_PAGE_SIZE, l);
bounce.addr = addr;
bounce.len = l;
memory_region_ref(mr);
bounce.mr = mr;
if (!is_write) {
address_space_read(as, addr, bounce.buffer, l);
}
*plen = l;
return bounce.buffer;
}
base = xlat;
raddr = memory_region_get_ram_addr(mr);
for (;;) {
len -= l;
addr += l;
done += l;
if (len == 0) {
break;
}
l = len;
this_mr = address_space_translate(as, addr, &xlat, &l, is_write);
if (this_mr != mr || xlat != base + done) {
break;
}
}
memory_region_ref(mr);
*plen = done;
return qemu_ram_ptr_length(raddr + base, plen);
}
| true |
qemu
|
c2cba0ffe495b60c4cc58080281e99c7a6580d4b
|
void *address_space_map(AddressSpace *as,
hwaddr addr,
hwaddr *plen,
bool is_write)
{
hwaddr len = *plen;
hwaddr done = 0;
hwaddr l, xlat, base;
MemoryRegion *mr, *this_mr;
ram_addr_t raddr;
if (len == 0) {
return NULL;
}
l = len;
mr = address_space_translate(as, addr, &xlat, &l, is_write);
if (!memory_access_is_direct(mr, is_write)) {
if (bounce.buffer) {
return NULL;
}
l = MIN(l, TARGET_PAGE_SIZE);
bounce.buffer = qemu_memalign(TARGET_PAGE_SIZE, l);
bounce.addr = addr;
bounce.len = l;
memory_region_ref(mr);
bounce.mr = mr;
if (!is_write) {
address_space_read(as, addr, bounce.buffer, l);
}
*plen = l;
return bounce.buffer;
}
base = xlat;
raddr = memory_region_get_ram_addr(mr);
for (;;) {
len -= l;
addr += l;
done += l;
if (len == 0) {
break;
}
l = len;
this_mr = address_space_translate(as, addr, &xlat, &l, is_write);
if (this_mr != mr || xlat != base + done) {
break;
}
}
memory_region_ref(mr);
*plen = done;
return qemu_ram_ptr_length(raddr + base, plen);
}
|
{
"code": [
" if (bounce.buffer) {"
],
"line_no": [
37
]
}
|
void *FUNC_0(AddressSpace *VAR_0,
hwaddr VAR_1,
hwaddr *VAR_2,
bool VAR_3)
{
hwaddr len = *VAR_2;
hwaddr done = 0;
hwaddr l, xlat, base;
MemoryRegion *mr, *this_mr;
ram_addr_t raddr;
if (len == 0) {
return NULL;
}
l = len;
mr = address_space_translate(VAR_0, VAR_1, &xlat, &l, VAR_3);
if (!memory_access_is_direct(mr, VAR_3)) {
if (bounce.buffer) {
return NULL;
}
l = MIN(l, TARGET_PAGE_SIZE);
bounce.buffer = qemu_memalign(TARGET_PAGE_SIZE, l);
bounce.VAR_1 = VAR_1;
bounce.len = l;
memory_region_ref(mr);
bounce.mr = mr;
if (!VAR_3) {
address_space_read(VAR_0, VAR_1, bounce.buffer, l);
}
*VAR_2 = l;
return bounce.buffer;
}
base = xlat;
raddr = memory_region_get_ram_addr(mr);
for (;;) {
len -= l;
VAR_1 += l;
done += l;
if (len == 0) {
break;
}
l = len;
this_mr = address_space_translate(VAR_0, VAR_1, &xlat, &l, VAR_3);
if (this_mr != mr || xlat != base + done) {
break;
}
}
memory_region_ref(mr);
*VAR_2 = done;
return qemu_ram_ptr_length(raddr + base, VAR_2);
}
|
[
"void *FUNC_0(AddressSpace *VAR_0,\nhwaddr VAR_1,\nhwaddr *VAR_2,\nbool VAR_3)\n{",
"hwaddr len = *VAR_2;",
"hwaddr done = 0;",
"hwaddr l, xlat, base;",
"MemoryRegion *mr, *this_mr;",
"ram_addr_t raddr;",
"if (len == 0) {",
"return NULL;",
"}",
"l = len;",
"mr = address_space_translate(VAR_0, VAR_1, &xlat, &l, VAR_3);",
"if (!memory_access_is_direct(mr, VAR_3)) {",
"if (bounce.buffer) {",
"return NULL;",
"}",
"l = MIN(l, TARGET_PAGE_SIZE);",
"bounce.buffer = qemu_memalign(TARGET_PAGE_SIZE, l);",
"bounce.VAR_1 = VAR_1;",
"bounce.len = l;",
"memory_region_ref(mr);",
"bounce.mr = mr;",
"if (!VAR_3) {",
"address_space_read(VAR_0, VAR_1, bounce.buffer, l);",
"}",
"*VAR_2 = l;",
"return bounce.buffer;",
"}",
"base = xlat;",
"raddr = memory_region_get_ram_addr(mr);",
"for (;;) {",
"len -= l;",
"VAR_1 += l;",
"done += l;",
"if (len == 0) {",
"break;",
"}",
"l = len;",
"this_mr = address_space_translate(VAR_0, VAR_1, &xlat, &l, VAR_3);",
"if (this_mr != mr || xlat != base + done) {",
"break;",
"}",
"}",
"memory_region_ref(mr);",
"*VAR_2 = done;",
"return qemu_ram_ptr_length(raddr + base, VAR_2);",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5,
7,
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25
],
[
27
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
45
],
[
47
],
[
49
],
[
51
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
67
],
[
69
],
[
71
],
[
75
],
[
77
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
111
],
[
113
],
[
115
],
[
117
]
] |
7,244 |
void ff_aac_search_for_pred(AACEncContext *s, SingleChannelElement *sce)
{
int sfb, i, count = 0, cost_coeffs = 0, cost_pred = 0;
const int pmax = FFMIN(sce->ics.max_sfb, ff_aac_pred_sfb_max[s->samplerate_index]);
float *O34 = &s->scoefs[128*0], *P34 = &s->scoefs[128*1];
float *SENT = &s->scoefs[128*2], *S34 = &s->scoefs[128*3];
float *QERR = &s->scoefs[128*4];
if (sce->ics.window_sequence[0] == EIGHT_SHORT_SEQUENCE) {
sce->ics.predictor_present = 0;
return;
}
if (!sce->ics.predictor_initialized) {
reset_all_predictors(sce->predictor_state);
sce->ics.predictor_initialized = 1;
memcpy(sce->prcoeffs, sce->coeffs, 1024*sizeof(float));
for (i = 1; i < 31; i++)
sce->ics.predictor_reset_count[i] = i;
}
update_pred_resets(sce);
memcpy(sce->band_alt, sce->band_type, sizeof(sce->band_type));
for (sfb = PRED_SFB_START; sfb < pmax; sfb++) {
int cost1, cost2, cb_p;
float dist1, dist2, dist_spec_err = 0.0f;
const int cb_n = sce->band_type[sfb];
const int start_coef = sce->ics.swb_offset[sfb];
const int num_coeffs = sce->ics.swb_offset[sfb + 1] - start_coef;
const FFPsyBand *band = &s->psy.ch[s->cur_channel].psy_bands[sfb];
if (start_coef + num_coeffs > MAX_PREDICTORS ||
(s->cur_channel && sce->band_type[sfb] >= INTENSITY_BT2) ||
sce->band_type[sfb] == NOISE_BT)
continue;
/* Normal coefficients */
abs_pow34_v(O34, &sce->coeffs[start_coef], num_coeffs);
dist1 = quantize_and_encode_band_cost(s, NULL, &sce->coeffs[start_coef], NULL,
O34, num_coeffs, sce->sf_idx[sfb],
cb_n, s->lambda / band->threshold, INFINITY, &cost1, 0);
cost_coeffs += cost1;
/* Encoded coefficients - needed for #bits, band type and quant. error */
for (i = 0; i < num_coeffs; i++)
SENT[i] = sce->coeffs[start_coef + i] - sce->prcoeffs[start_coef + i];
abs_pow34_v(S34, SENT, num_coeffs);
if (cb_n < RESERVED_BT)
cb_p = find_min_book(find_max_val(1, num_coeffs, S34), sce->sf_idx[sfb]);
else
cb_p = cb_n;
quantize_and_encode_band_cost(s, NULL, SENT, QERR, S34, num_coeffs,
sce->sf_idx[sfb], cb_p, s->lambda / band->threshold, INFINITY,
&cost2, 0);
/* Reconstructed coefficients - needed for distortion measurements */
for (i = 0; i < num_coeffs; i++)
sce->prcoeffs[start_coef + i] += QERR[i] != 0.0f ? (sce->prcoeffs[start_coef + i] - QERR[i]) : 0.0f;
abs_pow34_v(P34, &sce->prcoeffs[start_coef], num_coeffs);
if (cb_n < RESERVED_BT)
cb_p = find_min_book(find_max_val(1, num_coeffs, P34), sce->sf_idx[sfb]);
else
cb_p = cb_n;
dist2 = quantize_and_encode_band_cost(s, NULL, &sce->prcoeffs[start_coef], NULL,
P34, num_coeffs, sce->sf_idx[sfb],
cb_p, s->lambda / band->threshold, INFINITY, NULL, 0);
for (i = 0; i < num_coeffs; i++)
dist_spec_err += (O34[i] - P34[i])*(O34[i] - P34[i]);
dist_spec_err *= s->lambda / band->threshold;
dist2 += dist_spec_err;
if (dist2 <= dist1 && cb_p <= cb_n) {
cost_pred += cost2;
sce->ics.prediction_used[sfb] = 1;
sce->band_alt[sfb] = cb_n;
sce->band_type[sfb] = cb_p;
count++;
} else {
cost_pred += cost1;
sce->band_alt[sfb] = cb_p;
}
}
if (count && cost_coeffs < cost_pred) {
count = 0;
for (sfb = PRED_SFB_START; sfb < pmax; sfb++)
RESTORE_PRED(sce, sfb);
memset(&sce->ics.prediction_used, 0, sizeof(sce->ics.prediction_used));
}
sce->ics.predictor_present = !!count;
}
| true |
FFmpeg
|
01ecb7172b684f1c4b3e748f95c5a9a494ca36ec
|
void ff_aac_search_for_pred(AACEncContext *s, SingleChannelElement *sce)
{
int sfb, i, count = 0, cost_coeffs = 0, cost_pred = 0;
const int pmax = FFMIN(sce->ics.max_sfb, ff_aac_pred_sfb_max[s->samplerate_index]);
float *O34 = &s->scoefs[128*0], *P34 = &s->scoefs[128*1];
float *SENT = &s->scoefs[128*2], *S34 = &s->scoefs[128*3];
float *QERR = &s->scoefs[128*4];
if (sce->ics.window_sequence[0] == EIGHT_SHORT_SEQUENCE) {
sce->ics.predictor_present = 0;
return;
}
if (!sce->ics.predictor_initialized) {
reset_all_predictors(sce->predictor_state);
sce->ics.predictor_initialized = 1;
memcpy(sce->prcoeffs, sce->coeffs, 1024*sizeof(float));
for (i = 1; i < 31; i++)
sce->ics.predictor_reset_count[i] = i;
}
update_pred_resets(sce);
memcpy(sce->band_alt, sce->band_type, sizeof(sce->band_type));
for (sfb = PRED_SFB_START; sfb < pmax; sfb++) {
int cost1, cost2, cb_p;
float dist1, dist2, dist_spec_err = 0.0f;
const int cb_n = sce->band_type[sfb];
const int start_coef = sce->ics.swb_offset[sfb];
const int num_coeffs = sce->ics.swb_offset[sfb + 1] - start_coef;
const FFPsyBand *band = &s->psy.ch[s->cur_channel].psy_bands[sfb];
if (start_coef + num_coeffs > MAX_PREDICTORS ||
(s->cur_channel && sce->band_type[sfb] >= INTENSITY_BT2) ||
sce->band_type[sfb] == NOISE_BT)
continue;
abs_pow34_v(O34, &sce->coeffs[start_coef], num_coeffs);
dist1 = quantize_and_encode_band_cost(s, NULL, &sce->coeffs[start_coef], NULL,
O34, num_coeffs, sce->sf_idx[sfb],
cb_n, s->lambda / band->threshold, INFINITY, &cost1, 0);
cost_coeffs += cost1;
for (i = 0; i < num_coeffs; i++)
SENT[i] = sce->coeffs[start_coef + i] - sce->prcoeffs[start_coef + i];
abs_pow34_v(S34, SENT, num_coeffs);
if (cb_n < RESERVED_BT)
cb_p = find_min_book(find_max_val(1, num_coeffs, S34), sce->sf_idx[sfb]);
else
cb_p = cb_n;
quantize_and_encode_band_cost(s, NULL, SENT, QERR, S34, num_coeffs,
sce->sf_idx[sfb], cb_p, s->lambda / band->threshold, INFINITY,
&cost2, 0);
for (i = 0; i < num_coeffs; i++)
sce->prcoeffs[start_coef + i] += QERR[i] != 0.0f ? (sce->prcoeffs[start_coef + i] - QERR[i]) : 0.0f;
abs_pow34_v(P34, &sce->prcoeffs[start_coef], num_coeffs);
if (cb_n < RESERVED_BT)
cb_p = find_min_book(find_max_val(1, num_coeffs, P34), sce->sf_idx[sfb]);
else
cb_p = cb_n;
dist2 = quantize_and_encode_band_cost(s, NULL, &sce->prcoeffs[start_coef], NULL,
P34, num_coeffs, sce->sf_idx[sfb],
cb_p, s->lambda / band->threshold, INFINITY, NULL, 0);
for (i = 0; i < num_coeffs; i++)
dist_spec_err += (O34[i] - P34[i])*(O34[i] - P34[i]);
dist_spec_err *= s->lambda / band->threshold;
dist2 += dist_spec_err;
if (dist2 <= dist1 && cb_p <= cb_n) {
cost_pred += cost2;
sce->ics.prediction_used[sfb] = 1;
sce->band_alt[sfb] = cb_n;
sce->band_type[sfb] = cb_p;
count++;
} else {
cost_pred += cost1;
sce->band_alt[sfb] = cb_p;
}
}
if (count && cost_coeffs < cost_pred) {
count = 0;
for (sfb = PRED_SFB_START; sfb < pmax; sfb++)
RESTORE_PRED(sce, sfb);
memset(&sce->ics.prediction_used, 0, sizeof(sce->ics.prediction_used));
}
sce->ics.predictor_present = !!count;
}
|
{
"code": [
" cb_n, s->lambda / band->threshold, INFINITY, &cost1, 0);",
" &cost2, 0);",
" cb_p, s->lambda / band->threshold, INFINITY, NULL, 0);"
],
"line_no": [
83,
109,
133
]
}
|
void FUNC_0(AACEncContext *VAR_0, SingleChannelElement *VAR_1)
{
int VAR_2, VAR_3, VAR_4 = 0, VAR_5 = 0, VAR_6 = 0;
const int VAR_7 = FFMIN(VAR_1->ics.max_sfb, ff_aac_pred_sfb_max[VAR_0->samplerate_index]);
float *VAR_8 = &VAR_0->scoefs[128*0], *VAR_9 = &VAR_0->scoefs[128*1];
float *VAR_10 = &VAR_0->scoefs[128*2], *VAR_11 = &VAR_0->scoefs[128*3];
float *VAR_12 = &VAR_0->scoefs[128*4];
if (VAR_1->ics.window_sequence[0] == EIGHT_SHORT_SEQUENCE) {
VAR_1->ics.predictor_present = 0;
return;
}
if (!VAR_1->ics.predictor_initialized) {
reset_all_predictors(VAR_1->predictor_state);
VAR_1->ics.predictor_initialized = 1;
memcpy(VAR_1->prcoeffs, VAR_1->coeffs, 1024*sizeof(float));
for (VAR_3 = 1; VAR_3 < 31; VAR_3++)
VAR_1->ics.predictor_reset_count[VAR_3] = VAR_3;
}
update_pred_resets(VAR_1);
memcpy(VAR_1->band_alt, VAR_1->band_type, sizeof(VAR_1->band_type));
for (VAR_2 = PRED_SFB_START; VAR_2 < VAR_7; VAR_2++) {
int VAR_13, VAR_14, VAR_15;
float VAR_16, VAR_17, VAR_18 = 0.0f;
const int VAR_19 = VAR_1->band_type[VAR_2];
const int VAR_20 = VAR_1->ics.swb_offset[VAR_2];
const int VAR_21 = VAR_1->ics.swb_offset[VAR_2 + 1] - VAR_20;
const FFPsyBand *VAR_22 = &VAR_0->psy.ch[VAR_0->cur_channel].psy_bands[VAR_2];
if (VAR_20 + VAR_21 > MAX_PREDICTORS ||
(VAR_0->cur_channel && VAR_1->band_type[VAR_2] >= INTENSITY_BT2) ||
VAR_1->band_type[VAR_2] == NOISE_BT)
continue;
abs_pow34_v(VAR_8, &VAR_1->coeffs[VAR_20], VAR_21);
VAR_16 = quantize_and_encode_band_cost(VAR_0, NULL, &VAR_1->coeffs[VAR_20], NULL,
VAR_8, VAR_21, VAR_1->sf_idx[VAR_2],
VAR_19, VAR_0->lambda / VAR_22->threshold, INFINITY, &VAR_13, 0);
VAR_5 += VAR_13;
for (VAR_3 = 0; VAR_3 < VAR_21; VAR_3++)
VAR_10[VAR_3] = VAR_1->coeffs[VAR_20 + VAR_3] - VAR_1->prcoeffs[VAR_20 + VAR_3];
abs_pow34_v(VAR_11, VAR_10, VAR_21);
if (VAR_19 < RESERVED_BT)
VAR_15 = find_min_book(find_max_val(1, VAR_21, VAR_11), VAR_1->sf_idx[VAR_2]);
else
VAR_15 = VAR_19;
quantize_and_encode_band_cost(VAR_0, NULL, VAR_10, VAR_12, VAR_11, VAR_21,
VAR_1->sf_idx[VAR_2], VAR_15, VAR_0->lambda / VAR_22->threshold, INFINITY,
&VAR_14, 0);
for (VAR_3 = 0; VAR_3 < VAR_21; VAR_3++)
VAR_1->prcoeffs[VAR_20 + VAR_3] += VAR_12[VAR_3] != 0.0f ? (VAR_1->prcoeffs[VAR_20 + VAR_3] - VAR_12[VAR_3]) : 0.0f;
abs_pow34_v(VAR_9, &VAR_1->prcoeffs[VAR_20], VAR_21);
if (VAR_19 < RESERVED_BT)
VAR_15 = find_min_book(find_max_val(1, VAR_21, VAR_9), VAR_1->sf_idx[VAR_2]);
else
VAR_15 = VAR_19;
VAR_17 = quantize_and_encode_band_cost(VAR_0, NULL, &VAR_1->prcoeffs[VAR_20], NULL,
VAR_9, VAR_21, VAR_1->sf_idx[VAR_2],
VAR_15, VAR_0->lambda / VAR_22->threshold, INFINITY, NULL, 0);
for (VAR_3 = 0; VAR_3 < VAR_21; VAR_3++)
VAR_18 += (VAR_8[VAR_3] - VAR_9[VAR_3])*(VAR_8[VAR_3] - VAR_9[VAR_3]);
VAR_18 *= VAR_0->lambda / VAR_22->threshold;
VAR_17 += VAR_18;
if (VAR_17 <= VAR_16 && VAR_15 <= VAR_19) {
VAR_6 += VAR_14;
VAR_1->ics.prediction_used[VAR_2] = 1;
VAR_1->band_alt[VAR_2] = VAR_19;
VAR_1->band_type[VAR_2] = VAR_15;
VAR_4++;
} else {
VAR_6 += VAR_13;
VAR_1->band_alt[VAR_2] = VAR_15;
}
}
if (VAR_4 && VAR_5 < VAR_6) {
VAR_4 = 0;
for (VAR_2 = PRED_SFB_START; VAR_2 < VAR_7; VAR_2++)
RESTORE_PRED(VAR_1, VAR_2);
memset(&VAR_1->ics.prediction_used, 0, sizeof(VAR_1->ics.prediction_used));
}
VAR_1->ics.predictor_present = !!VAR_4;
}
|
[
"void FUNC_0(AACEncContext *VAR_0, SingleChannelElement *VAR_1)\n{",
"int VAR_2, VAR_3, VAR_4 = 0, VAR_5 = 0, VAR_6 = 0;",
"const int VAR_7 = FFMIN(VAR_1->ics.max_sfb, ff_aac_pred_sfb_max[VAR_0->samplerate_index]);",
"float *VAR_8 = &VAR_0->scoefs[128*0], *VAR_9 = &VAR_0->scoefs[128*1];",
"float *VAR_10 = &VAR_0->scoefs[128*2], *VAR_11 = &VAR_0->scoefs[128*3];",
"float *VAR_12 = &VAR_0->scoefs[128*4];",
"if (VAR_1->ics.window_sequence[0] == EIGHT_SHORT_SEQUENCE) {",
"VAR_1->ics.predictor_present = 0;",
"return;",
"}",
"if (!VAR_1->ics.predictor_initialized) {",
"reset_all_predictors(VAR_1->predictor_state);",
"VAR_1->ics.predictor_initialized = 1;",
"memcpy(VAR_1->prcoeffs, VAR_1->coeffs, 1024*sizeof(float));",
"for (VAR_3 = 1; VAR_3 < 31; VAR_3++)",
"VAR_1->ics.predictor_reset_count[VAR_3] = VAR_3;",
"}",
"update_pred_resets(VAR_1);",
"memcpy(VAR_1->band_alt, VAR_1->band_type, sizeof(VAR_1->band_type));",
"for (VAR_2 = PRED_SFB_START; VAR_2 < VAR_7; VAR_2++) {",
"int VAR_13, VAR_14, VAR_15;",
"float VAR_16, VAR_17, VAR_18 = 0.0f;",
"const int VAR_19 = VAR_1->band_type[VAR_2];",
"const int VAR_20 = VAR_1->ics.swb_offset[VAR_2];",
"const int VAR_21 = VAR_1->ics.swb_offset[VAR_2 + 1] - VAR_20;",
"const FFPsyBand *VAR_22 = &VAR_0->psy.ch[VAR_0->cur_channel].psy_bands[VAR_2];",
"if (VAR_20 + VAR_21 > MAX_PREDICTORS ||\n(VAR_0->cur_channel && VAR_1->band_type[VAR_2] >= INTENSITY_BT2) ||\nVAR_1->band_type[VAR_2] == NOISE_BT)\ncontinue;",
"abs_pow34_v(VAR_8, &VAR_1->coeffs[VAR_20], VAR_21);",
"VAR_16 = quantize_and_encode_band_cost(VAR_0, NULL, &VAR_1->coeffs[VAR_20], NULL,\nVAR_8, VAR_21, VAR_1->sf_idx[VAR_2],\nVAR_19, VAR_0->lambda / VAR_22->threshold, INFINITY, &VAR_13, 0);",
"VAR_5 += VAR_13;",
"for (VAR_3 = 0; VAR_3 < VAR_21; VAR_3++)",
"VAR_10[VAR_3] = VAR_1->coeffs[VAR_20 + VAR_3] - VAR_1->prcoeffs[VAR_20 + VAR_3];",
"abs_pow34_v(VAR_11, VAR_10, VAR_21);",
"if (VAR_19 < RESERVED_BT)\nVAR_15 = find_min_book(find_max_val(1, VAR_21, VAR_11), VAR_1->sf_idx[VAR_2]);",
"else\nVAR_15 = VAR_19;",
"quantize_and_encode_band_cost(VAR_0, NULL, VAR_10, VAR_12, VAR_11, VAR_21,\nVAR_1->sf_idx[VAR_2], VAR_15, VAR_0->lambda / VAR_22->threshold, INFINITY,\n&VAR_14, 0);",
"for (VAR_3 = 0; VAR_3 < VAR_21; VAR_3++)",
"VAR_1->prcoeffs[VAR_20 + VAR_3] += VAR_12[VAR_3] != 0.0f ? (VAR_1->prcoeffs[VAR_20 + VAR_3] - VAR_12[VAR_3]) : 0.0f;",
"abs_pow34_v(VAR_9, &VAR_1->prcoeffs[VAR_20], VAR_21);",
"if (VAR_19 < RESERVED_BT)\nVAR_15 = find_min_book(find_max_val(1, VAR_21, VAR_9), VAR_1->sf_idx[VAR_2]);",
"else\nVAR_15 = VAR_19;",
"VAR_17 = quantize_and_encode_band_cost(VAR_0, NULL, &VAR_1->prcoeffs[VAR_20], NULL,\nVAR_9, VAR_21, VAR_1->sf_idx[VAR_2],\nVAR_15, VAR_0->lambda / VAR_22->threshold, INFINITY, NULL, 0);",
"for (VAR_3 = 0; VAR_3 < VAR_21; VAR_3++)",
"VAR_18 += (VAR_8[VAR_3] - VAR_9[VAR_3])*(VAR_8[VAR_3] - VAR_9[VAR_3]);",
"VAR_18 *= VAR_0->lambda / VAR_22->threshold;",
"VAR_17 += VAR_18;",
"if (VAR_17 <= VAR_16 && VAR_15 <= VAR_19) {",
"VAR_6 += VAR_14;",
"VAR_1->ics.prediction_used[VAR_2] = 1;",
"VAR_1->band_alt[VAR_2] = VAR_19;",
"VAR_1->band_type[VAR_2] = VAR_15;",
"VAR_4++;",
"} else {",
"VAR_6 += VAR_13;",
"VAR_1->band_alt[VAR_2] = VAR_15;",
"}",
"}",
"if (VAR_4 && VAR_5 < VAR_6) {",
"VAR_4 = 0;",
"for (VAR_2 = PRED_SFB_START; VAR_2 < VAR_7; VAR_2++)",
"RESTORE_PRED(VAR_1, VAR_2);",
"memset(&VAR_1->ics.prediction_used, 0, sizeof(VAR_1->ics.prediction_used));",
"}",
"VAR_1->ics.predictor_present = !!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,
1,
0,
0,
0,
0,
0,
0,
1,
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
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
19
],
[
21
],
[
23
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
43
],
[
45
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
65,
67,
69,
71
],
[
77
],
[
79,
81,
83
],
[
85
],
[
91
],
[
93
],
[
95
],
[
97,
99
],
[
101,
103
],
[
105,
107,
109
],
[
115
],
[
117
],
[
119
],
[
121,
123
],
[
125,
127
],
[
129,
131,
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
145
],
[
147
],
[
149
],
[
151
],
[
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165
],
[
169
],
[
171
],
[
173
],
[
175
],
[
177
],
[
179
],
[
183
],
[
185
]
] |
7,245 |
static void new_subtitle_stream(AVFormatContext *oc, int file_idx)
{
AVStream *st;
OutputStream *ost;
AVCodec *codec=NULL;
AVCodecContext *subtitle_enc;
enum CodecID codec_id = CODEC_ID_NONE;
if(!subtitle_stream_copy){
if (subtitle_codec_name) {
codec_id = find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 1,
avcodec_opts[AVMEDIA_TYPE_SUBTITLE]->strict_std_compliance);
codec = avcodec_find_encoder_by_name(subtitle_codec_name);
} else {
codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_SUBTITLE);
codec = avcodec_find_encoder(codec_id);
}
}
ost = new_output_stream(oc, file_idx, codec);
st = ost->st;
subtitle_enc = st->codec;
ost->bitstream_filters = subtitle_bitstream_filters;
subtitle_bitstream_filters= NULL;
subtitle_enc->codec_type = AVMEDIA_TYPE_SUBTITLE;
if(subtitle_codec_tag)
subtitle_enc->codec_tag= subtitle_codec_tag;
if (oc->oformat->flags & AVFMT_GLOBALHEADER) {
subtitle_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
}
if (subtitle_stream_copy) {
st->stream_copy = 1;
} else {
subtitle_enc->codec_id = codec_id;
set_context_opts(avcodec_opts[AVMEDIA_TYPE_SUBTITLE], subtitle_enc, AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM, codec);
}
if (subtitle_language) {
av_dict_set(&st->metadata, "language", subtitle_language, 0);
av_freep(&subtitle_language);
}
subtitle_disable = 0;
av_freep(&subtitle_codec_name);
subtitle_stream_copy = 0;
}
| false |
FFmpeg
|
a9eb4f0899de04a3093a04f461611c6f0664398e
|
static void new_subtitle_stream(AVFormatContext *oc, int file_idx)
{
AVStream *st;
OutputStream *ost;
AVCodec *codec=NULL;
AVCodecContext *subtitle_enc;
enum CodecID codec_id = CODEC_ID_NONE;
if(!subtitle_stream_copy){
if (subtitle_codec_name) {
codec_id = find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 1,
avcodec_opts[AVMEDIA_TYPE_SUBTITLE]->strict_std_compliance);
codec = avcodec_find_encoder_by_name(subtitle_codec_name);
} else {
codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_SUBTITLE);
codec = avcodec_find_encoder(codec_id);
}
}
ost = new_output_stream(oc, file_idx, codec);
st = ost->st;
subtitle_enc = st->codec;
ost->bitstream_filters = subtitle_bitstream_filters;
subtitle_bitstream_filters= NULL;
subtitle_enc->codec_type = AVMEDIA_TYPE_SUBTITLE;
if(subtitle_codec_tag)
subtitle_enc->codec_tag= subtitle_codec_tag;
if (oc->oformat->flags & AVFMT_GLOBALHEADER) {
subtitle_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
}
if (subtitle_stream_copy) {
st->stream_copy = 1;
} else {
subtitle_enc->codec_id = codec_id;
set_context_opts(avcodec_opts[AVMEDIA_TYPE_SUBTITLE], subtitle_enc, AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM, codec);
}
if (subtitle_language) {
av_dict_set(&st->metadata, "language", subtitle_language, 0);
av_freep(&subtitle_language);
}
subtitle_disable = 0;
av_freep(&subtitle_codec_name);
subtitle_stream_copy = 0;
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(AVFormatContext *VAR_0, int VAR_1)
{
AVStream *st;
OutputStream *ost;
AVCodec *codec=NULL;
AVCodecContext *subtitle_enc;
enum CodecID VAR_2 = CODEC_ID_NONE;
if(!subtitle_stream_copy){
if (subtitle_codec_name) {
VAR_2 = find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 1,
avcodec_opts[AVMEDIA_TYPE_SUBTITLE]->strict_std_compliance);
codec = avcodec_find_encoder_by_name(subtitle_codec_name);
} else {
VAR_2 = av_guess_codec(VAR_0->oformat, NULL, VAR_0->filename, NULL, AVMEDIA_TYPE_SUBTITLE);
codec = avcodec_find_encoder(VAR_2);
}
}
ost = new_output_stream(VAR_0, VAR_1, codec);
st = ost->st;
subtitle_enc = st->codec;
ost->bitstream_filters = subtitle_bitstream_filters;
subtitle_bitstream_filters= NULL;
subtitle_enc->codec_type = AVMEDIA_TYPE_SUBTITLE;
if(subtitle_codec_tag)
subtitle_enc->codec_tag= subtitle_codec_tag;
if (VAR_0->oformat->flags & AVFMT_GLOBALHEADER) {
subtitle_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
}
if (subtitle_stream_copy) {
st->stream_copy = 1;
} else {
subtitle_enc->VAR_2 = VAR_2;
set_context_opts(avcodec_opts[AVMEDIA_TYPE_SUBTITLE], subtitle_enc, AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM, codec);
}
if (subtitle_language) {
av_dict_set(&st->metadata, "language", subtitle_language, 0);
av_freep(&subtitle_language);
}
subtitle_disable = 0;
av_freep(&subtitle_codec_name);
subtitle_stream_copy = 0;
}
|
[
"static void FUNC_0(AVFormatContext *VAR_0, int VAR_1)\n{",
"AVStream *st;",
"OutputStream *ost;",
"AVCodec *codec=NULL;",
"AVCodecContext *subtitle_enc;",
"enum CodecID VAR_2 = CODEC_ID_NONE;",
"if(!subtitle_stream_copy){",
"if (subtitle_codec_name) {",
"VAR_2 = find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 1,\navcodec_opts[AVMEDIA_TYPE_SUBTITLE]->strict_std_compliance);",
"codec = avcodec_find_encoder_by_name(subtitle_codec_name);",
"} else {",
"VAR_2 = av_guess_codec(VAR_0->oformat, NULL, VAR_0->filename, NULL, AVMEDIA_TYPE_SUBTITLE);",
"codec = avcodec_find_encoder(VAR_2);",
"}",
"}",
"ost = new_output_stream(VAR_0, VAR_1, codec);",
"st = ost->st;",
"subtitle_enc = st->codec;",
"ost->bitstream_filters = subtitle_bitstream_filters;",
"subtitle_bitstream_filters= NULL;",
"subtitle_enc->codec_type = AVMEDIA_TYPE_SUBTITLE;",
"if(subtitle_codec_tag)\nsubtitle_enc->codec_tag= subtitle_codec_tag;",
"if (VAR_0->oformat->flags & AVFMT_GLOBALHEADER) {",
"subtitle_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;",
"}",
"if (subtitle_stream_copy) {",
"st->stream_copy = 1;",
"} else {",
"subtitle_enc->VAR_2 = VAR_2;",
"set_context_opts(avcodec_opts[AVMEDIA_TYPE_SUBTITLE], subtitle_enc, AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM, codec);",
"}",
"if (subtitle_language) {",
"av_dict_set(&st->metadata, \"language\", subtitle_language, 0);",
"av_freep(&subtitle_language);",
"}",
"subtitle_disable = 0;",
"av_freep(&subtitle_codec_name);",
"subtitle_stream_copy = 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
19
],
[
21,
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
45
],
[
47
],
[
51
],
[
55,
57
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
81
],
[
83
],
[
85
],
[
87
],
[
91
],
[
93
],
[
95
],
[
97
]
] |
7,246 |
static int compile_kernel_file(GPUEnv *gpu_env, const char *build_options)
{
cl_int status;
char *temp, *source_str = NULL;
size_t source_str_len = 0;
int i, ret = 0;
for (i = 0; i < gpu_env->kernel_code_count; i++) {
if (!gpu_env->kernel_code[i].is_compiled)
source_str_len += strlen(gpu_env->kernel_code[i].kernel_string);
}
if (!source_str_len) {
return 0;
}
source_str = av_mallocz(source_str_len + 1);
if (!source_str) {
return AVERROR(ENOMEM);
}
temp = source_str;
for (i = 0; i < gpu_env->kernel_code_count; i++) {
if (!gpu_env->kernel_code[i].is_compiled) {
memcpy(temp, gpu_env->kernel_code[i].kernel_string,
strlen(gpu_env->kernel_code[i].kernel_string));
gpu_env->kernel_code[i].is_compiled = 1;
temp += strlen(gpu_env->kernel_code[i].kernel_string);
}
}
/* create a CL program using the kernel source */
gpu_env->programs[gpu_env->program_count] = clCreateProgramWithSource(gpu_env->context,
1, (const char **)(&source_str),
&source_str_len, &status);
if(status != CL_SUCCESS) {
av_log(&openclutils, AV_LOG_ERROR, "Could not create OpenCL program with source code: %s\n",
opencl_errstr(status));
ret = AVERROR_EXTERNAL;
goto end;
}
if (!gpu_env->programs[gpu_env->program_count]) {
av_log(&openclutils, AV_LOG_ERROR, "Created program is NULL\n");
ret = AVERROR_EXTERNAL;
goto end;
}
i = 0;
if (gpu_env->usr_spec_dev_info.dev_idx >= 0)
i = gpu_env->usr_spec_dev_info.dev_idx;
/* create a cl program executable for all the devices specified */
if (!gpu_env->is_user_created)
status = clBuildProgram(gpu_env->programs[gpu_env->program_count], 1, &gpu_env->device_ids[i],
build_options, NULL, NULL);
else
status = clBuildProgram(gpu_env->programs[gpu_env->program_count], 1, &(gpu_env->device_id),
build_options, NULL, NULL);
if (status != CL_SUCCESS) {
av_log(&openclutils, AV_LOG_ERROR, "Could not compile OpenCL kernel: %s\n", opencl_errstr(status));
ret = AVERROR_EXTERNAL;
goto end;
}
gpu_env->program_count++;
end:
av_free(source_str);
return ret;
}
| false |
FFmpeg
|
57d77b3963ce1023eaf5ada8cba58b9379405cc8
|
static int compile_kernel_file(GPUEnv *gpu_env, const char *build_options)
{
cl_int status;
char *temp, *source_str = NULL;
size_t source_str_len = 0;
int i, ret = 0;
for (i = 0; i < gpu_env->kernel_code_count; i++) {
if (!gpu_env->kernel_code[i].is_compiled)
source_str_len += strlen(gpu_env->kernel_code[i].kernel_string);
}
if (!source_str_len) {
return 0;
}
source_str = av_mallocz(source_str_len + 1);
if (!source_str) {
return AVERROR(ENOMEM);
}
temp = source_str;
for (i = 0; i < gpu_env->kernel_code_count; i++) {
if (!gpu_env->kernel_code[i].is_compiled) {
memcpy(temp, gpu_env->kernel_code[i].kernel_string,
strlen(gpu_env->kernel_code[i].kernel_string));
gpu_env->kernel_code[i].is_compiled = 1;
temp += strlen(gpu_env->kernel_code[i].kernel_string);
}
}
gpu_env->programs[gpu_env->program_count] = clCreateProgramWithSource(gpu_env->context,
1, (const char **)(&source_str),
&source_str_len, &status);
if(status != CL_SUCCESS) {
av_log(&openclutils, AV_LOG_ERROR, "Could not create OpenCL program with source code: %s\n",
opencl_errstr(status));
ret = AVERROR_EXTERNAL;
goto end;
}
if (!gpu_env->programs[gpu_env->program_count]) {
av_log(&openclutils, AV_LOG_ERROR, "Created program is NULL\n");
ret = AVERROR_EXTERNAL;
goto end;
}
i = 0;
if (gpu_env->usr_spec_dev_info.dev_idx >= 0)
i = gpu_env->usr_spec_dev_info.dev_idx;
if (!gpu_env->is_user_created)
status = clBuildProgram(gpu_env->programs[gpu_env->program_count], 1, &gpu_env->device_ids[i],
build_options, NULL, NULL);
else
status = clBuildProgram(gpu_env->programs[gpu_env->program_count], 1, &(gpu_env->device_id),
build_options, NULL, NULL);
if (status != CL_SUCCESS) {
av_log(&openclutils, AV_LOG_ERROR, "Could not compile OpenCL kernel: %s\n", opencl_errstr(status));
ret = AVERROR_EXTERNAL;
goto end;
}
gpu_env->program_count++;
end:
av_free(source_str);
return ret;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(GPUEnv *VAR_0, const char *VAR_1)
{
cl_int status;
char *VAR_2, *VAR_3 = NULL;
size_t source_str_len = 0;
int VAR_4, VAR_5 = 0;
for (VAR_4 = 0; VAR_4 < VAR_0->kernel_code_count; VAR_4++) {
if (!VAR_0->kernel_code[VAR_4].is_compiled)
source_str_len += strlen(VAR_0->kernel_code[VAR_4].kernel_string);
}
if (!source_str_len) {
return 0;
}
VAR_3 = av_mallocz(source_str_len + 1);
if (!VAR_3) {
return AVERROR(ENOMEM);
}
VAR_2 = VAR_3;
for (VAR_4 = 0; VAR_4 < VAR_0->kernel_code_count; VAR_4++) {
if (!VAR_0->kernel_code[VAR_4].is_compiled) {
memcpy(VAR_2, VAR_0->kernel_code[VAR_4].kernel_string,
strlen(VAR_0->kernel_code[VAR_4].kernel_string));
VAR_0->kernel_code[VAR_4].is_compiled = 1;
VAR_2 += strlen(VAR_0->kernel_code[VAR_4].kernel_string);
}
}
VAR_0->programs[VAR_0->program_count] = clCreateProgramWithSource(VAR_0->context,
1, (const char **)(&VAR_3),
&source_str_len, &status);
if(status != CL_SUCCESS) {
av_log(&openclutils, AV_LOG_ERROR, "Could not create OpenCL program with source code: %s\n",
opencl_errstr(status));
VAR_5 = AVERROR_EXTERNAL;
goto end;
}
if (!VAR_0->programs[VAR_0->program_count]) {
av_log(&openclutils, AV_LOG_ERROR, "Created program is NULL\n");
VAR_5 = AVERROR_EXTERNAL;
goto end;
}
VAR_4 = 0;
if (VAR_0->usr_spec_dev_info.dev_idx >= 0)
VAR_4 = VAR_0->usr_spec_dev_info.dev_idx;
if (!VAR_0->is_user_created)
status = clBuildProgram(VAR_0->programs[VAR_0->program_count], 1, &VAR_0->device_ids[VAR_4],
VAR_1, NULL, NULL);
else
status = clBuildProgram(VAR_0->programs[VAR_0->program_count], 1, &(VAR_0->device_id),
VAR_1, NULL, NULL);
if (status != CL_SUCCESS) {
av_log(&openclutils, AV_LOG_ERROR, "Could not compile OpenCL kernel: %s\n", opencl_errstr(status));
VAR_5 = AVERROR_EXTERNAL;
goto end;
}
VAR_0->program_count++;
end:
av_free(VAR_3);
return VAR_5;
}
|
[
"static int FUNC_0(GPUEnv *VAR_0, const char *VAR_1)\n{",
"cl_int status;",
"char *VAR_2, *VAR_3 = NULL;",
"size_t source_str_len = 0;",
"int VAR_4, VAR_5 = 0;",
"for (VAR_4 = 0; VAR_4 < VAR_0->kernel_code_count; VAR_4++) {",
"if (!VAR_0->kernel_code[VAR_4].is_compiled)\nsource_str_len += strlen(VAR_0->kernel_code[VAR_4].kernel_string);",
"}",
"if (!source_str_len) {",
"return 0;",
"}",
"VAR_3 = av_mallocz(source_str_len + 1);",
"if (!VAR_3) {",
"return AVERROR(ENOMEM);",
"}",
"VAR_2 = VAR_3;",
"for (VAR_4 = 0; VAR_4 < VAR_0->kernel_code_count; VAR_4++) {",
"if (!VAR_0->kernel_code[VAR_4].is_compiled) {",
"memcpy(VAR_2, VAR_0->kernel_code[VAR_4].kernel_string,\nstrlen(VAR_0->kernel_code[VAR_4].kernel_string));",
"VAR_0->kernel_code[VAR_4].is_compiled = 1;",
"VAR_2 += strlen(VAR_0->kernel_code[VAR_4].kernel_string);",
"}",
"}",
"VAR_0->programs[VAR_0->program_count] = clCreateProgramWithSource(VAR_0->context,\n1, (const char **)(&VAR_3),\n&source_str_len, &status);",
"if(status != CL_SUCCESS) {",
"av_log(&openclutils, AV_LOG_ERROR, \"Could not create OpenCL program with source code: %s\\n\",\nopencl_errstr(status));",
"VAR_5 = AVERROR_EXTERNAL;",
"goto end;",
"}",
"if (!VAR_0->programs[VAR_0->program_count]) {",
"av_log(&openclutils, AV_LOG_ERROR, \"Created program is NULL\\n\");",
"VAR_5 = AVERROR_EXTERNAL;",
"goto end;",
"}",
"VAR_4 = 0;",
"if (VAR_0->usr_spec_dev_info.dev_idx >= 0)\nVAR_4 = VAR_0->usr_spec_dev_info.dev_idx;",
"if (!VAR_0->is_user_created)\nstatus = clBuildProgram(VAR_0->programs[VAR_0->program_count], 1, &VAR_0->device_ids[VAR_4],\nVAR_1, NULL, NULL);",
"else\nstatus = clBuildProgram(VAR_0->programs[VAR_0->program_count], 1, &(VAR_0->device_id),\nVAR_1, NULL, NULL);",
"if (status != CL_SUCCESS) {",
"av_log(&openclutils, AV_LOG_ERROR, \"Could not compile OpenCL kernel: %s\\n\", opencl_errstr(status));",
"VAR_5 = AVERROR_EXTERNAL;",
"goto end;",
"}",
"VAR_0->program_count++;",
"end:\nav_free(VAR_3);",
"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
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17,
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43,
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
57,
59,
61
],
[
63
],
[
65,
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87,
89
],
[
93,
95,
97
],
[
99,
101,
103
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119,
121
],
[
123
],
[
125
]
] |
7,247 |
static void read_ttag(AVFormatContext *s, int taglen, const char *key)
{
char *q, dst[512];
int len, dstlen = sizeof(dst) - 1;
unsigned genre;
dst[0] = 0;
if (taglen < 1)
return;
taglen--; /* account for encoding type byte */
switch (get_byte(s->pb)) { /* encoding type */
case 0: /* ISO-8859-1 (0 - 255 maps directly into unicode) */
q = dst;
while (taglen--) {
uint8_t tmp;
PUT_UTF8(get_byte(s->pb), tmp, if (q - dst < dstlen - 1) *q++ = tmp;)
}
*q = '\0';
break;
case 3: /* UTF-8 */
len = FFMIN(taglen, dstlen - 1);
get_buffer(s->pb, dst, len);
dst[len] = 0;
break;
}
if (!strcmp(key, "genre")
&& (sscanf(dst, "(%d)", &genre) == 1 || sscanf(dst, "%d", &genre) == 1)
&& genre <= ID3v1_GENRE_MAX)
av_strlcpy(dst, ff_id3v1_genre_str[genre], sizeof(dst));
if (*dst)
av_metadata_set(&s->metadata, key, dst);
}
| false |
FFmpeg
|
787f8fad00c66fc225662f7defb90e79c112ed40
|
static void read_ttag(AVFormatContext *s, int taglen, const char *key)
{
char *q, dst[512];
int len, dstlen = sizeof(dst) - 1;
unsigned genre;
dst[0] = 0;
if (taglen < 1)
return;
taglen--;
switch (get_byte(s->pb)) {
case 0:
q = dst;
while (taglen--) {
uint8_t tmp;
PUT_UTF8(get_byte(s->pb), tmp, if (q - dst < dstlen - 1) *q++ = tmp;)
}
*q = '\0';
break;
case 3:
len = FFMIN(taglen, dstlen - 1);
get_buffer(s->pb, dst, len);
dst[len] = 0;
break;
}
if (!strcmp(key, "genre")
&& (sscanf(dst, "(%d)", &genre) == 1 || sscanf(dst, "%d", &genre) == 1)
&& genre <= ID3v1_GENRE_MAX)
av_strlcpy(dst, ff_id3v1_genre_str[genre], sizeof(dst));
if (*dst)
av_metadata_set(&s->metadata, key, dst);
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(AVFormatContext *VAR_0, int VAR_1, const char *VAR_2)
{
char *VAR_3, VAR_4[512];
int VAR_5, VAR_6 = sizeof(VAR_4) - 1;
unsigned VAR_7;
VAR_4[0] = 0;
if (VAR_1 < 1)
return;
VAR_1--;
switch (get_byte(VAR_0->pb)) {
case 0:
VAR_3 = VAR_4;
while (VAR_1--) {
uint8_t tmp;
PUT_UTF8(get_byte(VAR_0->pb), tmp, if (VAR_3 - VAR_4 < VAR_6 - 1) *VAR_3++ = tmp;)
}
*VAR_3 = '\0';
break;
case 3:
VAR_5 = FFMIN(VAR_1, VAR_6 - 1);
get_buffer(VAR_0->pb, VAR_4, VAR_5);
VAR_4[VAR_5] = 0;
break;
}
if (!strcmp(VAR_2, "VAR_7")
&& (sscanf(VAR_4, "(%d)", &VAR_7) == 1 || sscanf(VAR_4, "%d", &VAR_7) == 1)
&& VAR_7 <= ID3v1_GENRE_MAX)
av_strlcpy(VAR_4, ff_id3v1_genre_str[VAR_7], sizeof(VAR_4));
if (*VAR_4)
av_metadata_set(&VAR_0->metadata, VAR_2, VAR_4);
}
|
[
"static void FUNC_0(AVFormatContext *VAR_0, int VAR_1, const char *VAR_2)\n{",
"char *VAR_3, VAR_4[512];",
"int VAR_5, VAR_6 = sizeof(VAR_4) - 1;",
"unsigned VAR_7;",
"VAR_4[0] = 0;",
"if (VAR_1 < 1)\nreturn;",
"VAR_1--;",
"switch (get_byte(VAR_0->pb)) {",
"case 0:\nVAR_3 = VAR_4;",
"while (VAR_1--) {",
"uint8_t tmp;",
"PUT_UTF8(get_byte(VAR_0->pb), tmp, if (VAR_3 - VAR_4 < VAR_6 - 1) *VAR_3++ = tmp;)",
"}",
"*VAR_3 = '\\0';",
"break;",
"case 3:\nVAR_5 = FFMIN(VAR_1, VAR_6 - 1);",
"get_buffer(VAR_0->pb, VAR_4, VAR_5);",
"VAR_4[VAR_5] = 0;",
"break;",
"}",
"if (!strcmp(VAR_2, \"VAR_7\")\n&& (sscanf(VAR_4, \"(%d)\", &VAR_7) == 1 || sscanf(VAR_4, \"%d\", &VAR_7) == 1)\n&& VAR_7 <= ID3v1_GENRE_MAX)\nav_strlcpy(VAR_4, ff_id3v1_genre_str[VAR_7], sizeof(VAR_4));",
"if (*VAR_4)\nav_metadata_set(&VAR_0->metadata, VAR_2, VAR_4);",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15,
17
],
[
21
],
[
25
],
[
29,
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
47,
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
61,
63,
65,
67
],
[
71,
73
],
[
75
]
] |
7,248 |
static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
{
Jpeg2000CodingStyle *codsty = s->codsty;
Jpeg2000QuantStyle *qntsty = s->qntsty;
uint8_t *properties = s->properties;
for (;;) {
int len, ret = 0;
uint16_t marker;
int oldpos;
if (bytestream2_get_bytes_left(&s->g) < 2) {
av_log(s->avctx, AV_LOG_ERROR, "Missing EOC\n");
break;
}
marker = bytestream2_get_be16u(&s->g);
oldpos = bytestream2_tell(&s->g);
if (marker == JPEG2000_SOD) {
Jpeg2000Tile *tile = s->tile + s->curtileno;
Jpeg2000TilePart *tp = tile->tile_part + tile->tp_idx;
bytestream2_init(&tp->tpg, s->g.buffer, tp->tp_end - s->g.buffer);
bytestream2_skip(&s->g, tp->tp_end - s->g.buffer);
continue;
}
if (marker == JPEG2000_EOC)
break;
if (bytestream2_get_bytes_left(&s->g) < 2)
return AVERROR(EINVAL);
len = bytestream2_get_be16u(&s->g);
switch (marker) {
case JPEG2000_SIZ:
ret = get_siz(s);
if (!s->tile)
s->numXtiles = s->numYtiles = 0;
break;
case JPEG2000_COC:
ret = get_coc(s, codsty, properties);
break;
case JPEG2000_COD:
ret = get_cod(s, codsty, properties);
break;
case JPEG2000_QCC:
ret = get_qcc(s, len, qntsty, properties);
break;
case JPEG2000_QCD:
ret = get_qcd(s, len, qntsty, properties);
break;
case JPEG2000_SOT:
if (!(ret = get_sot(s, len))) {
av_assert1(s->curtileno >= 0);
codsty = s->tile[s->curtileno].codsty;
qntsty = s->tile[s->curtileno].qntsty;
properties = s->tile[s->curtileno].properties;
}
break;
case JPEG2000_COM:
// the comment is ignored
bytestream2_skip(&s->g, len - 2);
break;
case JPEG2000_TLM:
// Tile-part lengths
ret = get_tlm(s, len);
break;
default:
av_log(s->avctx, AV_LOG_ERROR,
"unsupported marker 0x%.4X at pos 0x%X\n",
marker, bytestream2_tell(&s->g) - 4);
bytestream2_skip(&s->g, len - 2);
break;
}
if (bytestream2_tell(&s->g) - oldpos != len || ret) {
av_log(s->avctx, AV_LOG_ERROR,
"error during processing marker segment %.4x\n", marker);
return ret ? ret : -1;
}
}
return 0;
}
| false |
FFmpeg
|
b26bcd08e670b90740f7253f21adddafb9d8c478
|
static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
{
Jpeg2000CodingStyle *codsty = s->codsty;
Jpeg2000QuantStyle *qntsty = s->qntsty;
uint8_t *properties = s->properties;
for (;;) {
int len, ret = 0;
uint16_t marker;
int oldpos;
if (bytestream2_get_bytes_left(&s->g) < 2) {
av_log(s->avctx, AV_LOG_ERROR, "Missing EOC\n");
break;
}
marker = bytestream2_get_be16u(&s->g);
oldpos = bytestream2_tell(&s->g);
if (marker == JPEG2000_SOD) {
Jpeg2000Tile *tile = s->tile + s->curtileno;
Jpeg2000TilePart *tp = tile->tile_part + tile->tp_idx;
bytestream2_init(&tp->tpg, s->g.buffer, tp->tp_end - s->g.buffer);
bytestream2_skip(&s->g, tp->tp_end - s->g.buffer);
continue;
}
if (marker == JPEG2000_EOC)
break;
if (bytestream2_get_bytes_left(&s->g) < 2)
return AVERROR(EINVAL);
len = bytestream2_get_be16u(&s->g);
switch (marker) {
case JPEG2000_SIZ:
ret = get_siz(s);
if (!s->tile)
s->numXtiles = s->numYtiles = 0;
break;
case JPEG2000_COC:
ret = get_coc(s, codsty, properties);
break;
case JPEG2000_COD:
ret = get_cod(s, codsty, properties);
break;
case JPEG2000_QCC:
ret = get_qcc(s, len, qntsty, properties);
break;
case JPEG2000_QCD:
ret = get_qcd(s, len, qntsty, properties);
break;
case JPEG2000_SOT:
if (!(ret = get_sot(s, len))) {
av_assert1(s->curtileno >= 0);
codsty = s->tile[s->curtileno].codsty;
qntsty = s->tile[s->curtileno].qntsty;
properties = s->tile[s->curtileno].properties;
}
break;
case JPEG2000_COM:
bytestream2_skip(&s->g, len - 2);
break;
case JPEG2000_TLM:
ret = get_tlm(s, len);
break;
default:
av_log(s->avctx, AV_LOG_ERROR,
"unsupported marker 0x%.4X at pos 0x%X\n",
marker, bytestream2_tell(&s->g) - 4);
bytestream2_skip(&s->g, len - 2);
break;
}
if (bytestream2_tell(&s->g) - oldpos != len || ret) {
av_log(s->avctx, AV_LOG_ERROR,
"error during processing marker segment %.4x\n", marker);
return ret ? ret : -1;
}
}
return 0;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(Jpeg2000DecoderContext *VAR_0)
{
Jpeg2000CodingStyle *codsty = VAR_0->codsty;
Jpeg2000QuantStyle *qntsty = VAR_0->qntsty;
uint8_t *properties = VAR_0->properties;
for (;;) {
int VAR_1, VAR_2 = 0;
uint16_t marker;
int VAR_3;
if (bytestream2_get_bytes_left(&VAR_0->g) < 2) {
av_log(VAR_0->avctx, AV_LOG_ERROR, "Missing EOC\n");
break;
}
marker = bytestream2_get_be16u(&VAR_0->g);
VAR_3 = bytestream2_tell(&VAR_0->g);
if (marker == JPEG2000_SOD) {
Jpeg2000Tile *tile = VAR_0->tile + VAR_0->curtileno;
Jpeg2000TilePart *tp = tile->tile_part + tile->tp_idx;
bytestream2_init(&tp->tpg, VAR_0->g.buffer, tp->tp_end - VAR_0->g.buffer);
bytestream2_skip(&VAR_0->g, tp->tp_end - VAR_0->g.buffer);
continue;
}
if (marker == JPEG2000_EOC)
break;
if (bytestream2_get_bytes_left(&VAR_0->g) < 2)
return AVERROR(EINVAL);
VAR_1 = bytestream2_get_be16u(&VAR_0->g);
switch (marker) {
case JPEG2000_SIZ:
VAR_2 = get_siz(VAR_0);
if (!VAR_0->tile)
VAR_0->numXtiles = VAR_0->numYtiles = 0;
break;
case JPEG2000_COC:
VAR_2 = get_coc(VAR_0, codsty, properties);
break;
case JPEG2000_COD:
VAR_2 = get_cod(VAR_0, codsty, properties);
break;
case JPEG2000_QCC:
VAR_2 = get_qcc(VAR_0, VAR_1, qntsty, properties);
break;
case JPEG2000_QCD:
VAR_2 = get_qcd(VAR_0, VAR_1, qntsty, properties);
break;
case JPEG2000_SOT:
if (!(VAR_2 = get_sot(VAR_0, VAR_1))) {
av_assert1(VAR_0->curtileno >= 0);
codsty = VAR_0->tile[VAR_0->curtileno].codsty;
qntsty = VAR_0->tile[VAR_0->curtileno].qntsty;
properties = VAR_0->tile[VAR_0->curtileno].properties;
}
break;
case JPEG2000_COM:
bytestream2_skip(&VAR_0->g, VAR_1 - 2);
break;
case JPEG2000_TLM:
VAR_2 = get_tlm(VAR_0, VAR_1);
break;
default:
av_log(VAR_0->avctx, AV_LOG_ERROR,
"unsupported marker 0x%.4X at pos 0x%X\n",
marker, bytestream2_tell(&VAR_0->g) - 4);
bytestream2_skip(&VAR_0->g, VAR_1 - 2);
break;
}
if (bytestream2_tell(&VAR_0->g) - VAR_3 != VAR_1 || VAR_2) {
av_log(VAR_0->avctx, AV_LOG_ERROR,
"error during processing marker segment %.4x\n", marker);
return VAR_2 ? VAR_2 : -1;
}
}
return 0;
}
|
[
"static int FUNC_0(Jpeg2000DecoderContext *VAR_0)\n{",
"Jpeg2000CodingStyle *codsty = VAR_0->codsty;",
"Jpeg2000QuantStyle *qntsty = VAR_0->qntsty;",
"uint8_t *properties = VAR_0->properties;",
"for (;;) {",
"int VAR_1, VAR_2 = 0;",
"uint16_t marker;",
"int VAR_3;",
"if (bytestream2_get_bytes_left(&VAR_0->g) < 2) {",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"Missing EOC\\n\");",
"break;",
"}",
"marker = bytestream2_get_be16u(&VAR_0->g);",
"VAR_3 = bytestream2_tell(&VAR_0->g);",
"if (marker == JPEG2000_SOD) {",
"Jpeg2000Tile *tile = VAR_0->tile + VAR_0->curtileno;",
"Jpeg2000TilePart *tp = tile->tile_part + tile->tp_idx;",
"bytestream2_init(&tp->tpg, VAR_0->g.buffer, tp->tp_end - VAR_0->g.buffer);",
"bytestream2_skip(&VAR_0->g, tp->tp_end - VAR_0->g.buffer);",
"continue;",
"}",
"if (marker == JPEG2000_EOC)\nbreak;",
"if (bytestream2_get_bytes_left(&VAR_0->g) < 2)\nreturn AVERROR(EINVAL);",
"VAR_1 = bytestream2_get_be16u(&VAR_0->g);",
"switch (marker) {",
"case JPEG2000_SIZ:\nVAR_2 = get_siz(VAR_0);",
"if (!VAR_0->tile)\nVAR_0->numXtiles = VAR_0->numYtiles = 0;",
"break;",
"case JPEG2000_COC:\nVAR_2 = get_coc(VAR_0, codsty, properties);",
"break;",
"case JPEG2000_COD:\nVAR_2 = get_cod(VAR_0, codsty, properties);",
"break;",
"case JPEG2000_QCC:\nVAR_2 = get_qcc(VAR_0, VAR_1, qntsty, properties);",
"break;",
"case JPEG2000_QCD:\nVAR_2 = get_qcd(VAR_0, VAR_1, qntsty, properties);",
"break;",
"case JPEG2000_SOT:\nif (!(VAR_2 = get_sot(VAR_0, VAR_1))) {",
"av_assert1(VAR_0->curtileno >= 0);",
"codsty = VAR_0->tile[VAR_0->curtileno].codsty;",
"qntsty = VAR_0->tile[VAR_0->curtileno].qntsty;",
"properties = VAR_0->tile[VAR_0->curtileno].properties;",
"}",
"break;",
"case JPEG2000_COM:\nbytestream2_skip(&VAR_0->g, VAR_1 - 2);",
"break;",
"case JPEG2000_TLM:\nVAR_2 = get_tlm(VAR_0, VAR_1);",
"break;",
"default:\nav_log(VAR_0->avctx, AV_LOG_ERROR,\n\"unsupported marker 0x%.4X at pos 0x%X\\n\",\nmarker, bytestream2_tell(&VAR_0->g) - 4);",
"bytestream2_skip(&VAR_0->g, VAR_1 - 2);",
"break;",
"}",
"if (bytestream2_tell(&VAR_0->g) - VAR_3 != VAR_1 || VAR_2) {",
"av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"error during processing marker segment %.4x\\n\", marker);",
"return VAR_2 ? VAR_2 : -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
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
],
[
39
],
[
41
],
[
43
],
[
47
],
[
49
],
[
53
],
[
55
],
[
57,
59
],
[
63,
65
],
[
67
],
[
69
],
[
71,
73
],
[
75,
77
],
[
79
],
[
81,
83
],
[
85
],
[
87,
89
],
[
91
],
[
93,
95
],
[
97
],
[
99,
101
],
[
103
],
[
105,
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121,
125
],
[
127
],
[
129,
133
],
[
135
],
[
137,
139,
141,
143
],
[
145
],
[
147
],
[
149
],
[
151
],
[
153,
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165
]
] |
7,249 |
static int unpack_block_qpis(Vp3DecodeContext *s, GetBitContext *gb)
{
int qpi, i, j, bit, run_length, blocks_decoded, num_blocks_at_qpi;
int num_blocks = s->coded_fragment_list_index;
for (qpi = 0; qpi < s->nqps-1 && num_blocks > 0; qpi++) {
i = blocks_decoded = num_blocks_at_qpi = 0;
bit = get_bits1(gb);
do {
run_length = get_vlc2(gb, s->superblock_run_length_vlc.table, 6, 2) + 1;
if (run_length == 34)
run_length += get_bits(gb, 12);
blocks_decoded += run_length;
if (!bit)
num_blocks_at_qpi += run_length;
for (j = 0; j < run_length; i++) {
if (i > s->coded_fragment_list_index)
return -1;
if (s->all_fragments[s->coded_fragment_list[i]].qpi == qpi) {
s->all_fragments[s->coded_fragment_list[i]].qpi += bit;
j++;
}
}
if (run_length == 4129)
bit = get_bits1(gb);
else
bit ^= 1;
} while (blocks_decoded < num_blocks);
num_blocks -= num_blocks_at_qpi;
}
return 0;
}
| false |
FFmpeg
|
310afddfe0c31ffd844eb640bdf2b3f052286dbe
|
static int unpack_block_qpis(Vp3DecodeContext *s, GetBitContext *gb)
{
int qpi, i, j, bit, run_length, blocks_decoded, num_blocks_at_qpi;
int num_blocks = s->coded_fragment_list_index;
for (qpi = 0; qpi < s->nqps-1 && num_blocks > 0; qpi++) {
i = blocks_decoded = num_blocks_at_qpi = 0;
bit = get_bits1(gb);
do {
run_length = get_vlc2(gb, s->superblock_run_length_vlc.table, 6, 2) + 1;
if (run_length == 34)
run_length += get_bits(gb, 12);
blocks_decoded += run_length;
if (!bit)
num_blocks_at_qpi += run_length;
for (j = 0; j < run_length; i++) {
if (i > s->coded_fragment_list_index)
return -1;
if (s->all_fragments[s->coded_fragment_list[i]].qpi == qpi) {
s->all_fragments[s->coded_fragment_list[i]].qpi += bit;
j++;
}
}
if (run_length == 4129)
bit = get_bits1(gb);
else
bit ^= 1;
} while (blocks_decoded < num_blocks);
num_blocks -= num_blocks_at_qpi;
}
return 0;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(Vp3DecodeContext *VAR_0, GetBitContext *VAR_1)
{
int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8;
int VAR_9 = VAR_0->coded_fragment_list_index;
for (VAR_2 = 0; VAR_2 < VAR_0->nqps-1 && VAR_9 > 0; VAR_2++) {
VAR_3 = VAR_7 = VAR_8 = 0;
VAR_5 = get_bits1(VAR_1);
do {
VAR_6 = get_vlc2(VAR_1, VAR_0->superblock_run_length_vlc.table, 6, 2) + 1;
if (VAR_6 == 34)
VAR_6 += get_bits(VAR_1, 12);
VAR_7 += VAR_6;
if (!VAR_5)
VAR_8 += VAR_6;
for (VAR_4 = 0; VAR_4 < VAR_6; VAR_3++) {
if (VAR_3 > VAR_0->coded_fragment_list_index)
return -1;
if (VAR_0->all_fragments[VAR_0->coded_fragment_list[VAR_3]].VAR_2 == VAR_2) {
VAR_0->all_fragments[VAR_0->coded_fragment_list[VAR_3]].VAR_2 += VAR_5;
VAR_4++;
}
}
if (VAR_6 == 4129)
VAR_5 = get_bits1(VAR_1);
else
VAR_5 ^= 1;
} while (VAR_7 < VAR_9);
VAR_9 -= VAR_8;
}
return 0;
}
|
[
"static int FUNC_0(Vp3DecodeContext *VAR_0, GetBitContext *VAR_1)\n{",
"int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8;",
"int VAR_9 = VAR_0->coded_fragment_list_index;",
"for (VAR_2 = 0; VAR_2 < VAR_0->nqps-1 && VAR_9 > 0; VAR_2++) {",
"VAR_3 = VAR_7 = VAR_8 = 0;",
"VAR_5 = get_bits1(VAR_1);",
"do {",
"VAR_6 = get_vlc2(VAR_1, VAR_0->superblock_run_length_vlc.table, 6, 2) + 1;",
"if (VAR_6 == 34)\nVAR_6 += get_bits(VAR_1, 12);",
"VAR_7 += VAR_6;",
"if (!VAR_5)\nVAR_8 += VAR_6;",
"for (VAR_4 = 0; VAR_4 < VAR_6; VAR_3++) {",
"if (VAR_3 > VAR_0->coded_fragment_list_index)\nreturn -1;",
"if (VAR_0->all_fragments[VAR_0->coded_fragment_list[VAR_3]].VAR_2 == VAR_2) {",
"VAR_0->all_fragments[VAR_0->coded_fragment_list[VAR_3]].VAR_2 += VAR_5;",
"VAR_4++;",
"}",
"}",
"if (VAR_6 == 4129)\nVAR_5 = get_bits1(VAR_1);",
"else\nVAR_5 ^= 1;",
"} while (VAR_7 < VAR_9);",
"VAR_9 -= VAR_8;",
"}",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
17
],
[
21
],
[
23
],
[
25,
27
],
[
29
],
[
33,
35
],
[
39
],
[
41,
43
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
59,
61
],
[
63,
65
],
[
67
],
[
71
],
[
73
],
[
77
],
[
79
]
] |
7,251 |
static void v9fs_mkdir(void *opaque)
{
V9fsPDU *pdu = opaque;
size_t offset = 7;
int32_t fid;
struct stat stbuf;
V9fsQID qid;
V9fsString name;
V9fsFidState *fidp;
gid_t gid;
int mode;
int err = 0;
v9fs_string_init(&name);
err = pdu_unmarshal(pdu, offset, "dsdd", &fid, &name, &mode, &gid);
if (err < 0) {
trace_v9fs_mkdir(pdu->tag, pdu->id, fid, name.data, mode, gid);
fidp = get_fid(pdu, fid);
if (fidp == NULL) {
err = v9fs_co_mkdir(pdu, fidp, &name, mode, fidp->uid, gid, &stbuf);
if (err < 0) {
goto out;
stat_to_qid(&stbuf, &qid);
err = pdu_marshal(pdu, offset, "Q", &qid);
if (err < 0) {
goto out;
err += offset;
trace_v9fs_mkdir_return(pdu->tag, pdu->id,
qid.type, qid.version, qid.path, err);
out:
put_fid(pdu, fidp);
out_nofid:
pdu_complete(pdu, err);
v9fs_string_free(&name);
| true |
qemu
|
fff39a7ad09da07ef490de05c92c91f22f8002f2
|
static void v9fs_mkdir(void *opaque)
{
V9fsPDU *pdu = opaque;
size_t offset = 7;
int32_t fid;
struct stat stbuf;
V9fsQID qid;
V9fsString name;
V9fsFidState *fidp;
gid_t gid;
int mode;
int err = 0;
v9fs_string_init(&name);
err = pdu_unmarshal(pdu, offset, "dsdd", &fid, &name, &mode, &gid);
if (err < 0) {
trace_v9fs_mkdir(pdu->tag, pdu->id, fid, name.data, mode, gid);
fidp = get_fid(pdu, fid);
if (fidp == NULL) {
err = v9fs_co_mkdir(pdu, fidp, &name, mode, fidp->uid, gid, &stbuf);
if (err < 0) {
goto out;
stat_to_qid(&stbuf, &qid);
err = pdu_marshal(pdu, offset, "Q", &qid);
if (err < 0) {
goto out;
err += offset;
trace_v9fs_mkdir_return(pdu->tag, pdu->id,
qid.type, qid.version, qid.path, err);
out:
put_fid(pdu, fidp);
out_nofid:
pdu_complete(pdu, err);
v9fs_string_free(&name);
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(void *VAR_0)
{
V9fsPDU *pdu = VAR_0;
size_t offset = 7;
int32_t fid;
struct stat VAR_1;
V9fsQID qid;
V9fsString name;
V9fsFidState *fidp;
gid_t gid;
int VAR_2;
int VAR_3 = 0;
v9fs_string_init(&name);
VAR_3 = pdu_unmarshal(pdu, offset, "dsdd", &fid, &name, &VAR_2, &gid);
if (VAR_3 < 0) {
trace_v9fs_mkdir(pdu->tag, pdu->id, fid, name.data, VAR_2, gid);
fidp = get_fid(pdu, fid);
if (fidp == NULL) {
VAR_3 = v9fs_co_mkdir(pdu, fidp, &name, VAR_2, fidp->uid, gid, &VAR_1);
if (VAR_3 < 0) {
goto out;
stat_to_qid(&VAR_1, &qid);
VAR_3 = pdu_marshal(pdu, offset, "Q", &qid);
if (VAR_3 < 0) {
goto out;
VAR_3 += offset;
trace_v9fs_mkdir_return(pdu->tag, pdu->id,
qid.type, qid.version, qid.path, VAR_3);
out:
put_fid(pdu, fidp);
out_nofid:
pdu_complete(pdu, VAR_3);
v9fs_string_free(&name);
|
[
"static void FUNC_0(void *VAR_0)\n{",
"V9fsPDU *pdu = VAR_0;",
"size_t offset = 7;",
"int32_t fid;",
"struct stat VAR_1;",
"V9fsQID qid;",
"V9fsString name;",
"V9fsFidState *fidp;",
"gid_t gid;",
"int VAR_2;",
"int VAR_3 = 0;",
"v9fs_string_init(&name);",
"VAR_3 = pdu_unmarshal(pdu, offset, \"dsdd\", &fid, &name, &VAR_2, &gid);",
"if (VAR_3 < 0) {",
"trace_v9fs_mkdir(pdu->tag, pdu->id, fid, name.data, VAR_2, gid);",
"fidp = get_fid(pdu, fid);",
"if (fidp == NULL) {",
"VAR_3 = v9fs_co_mkdir(pdu, fidp, &name, VAR_2, fidp->uid, gid, &VAR_1);",
"if (VAR_3 < 0) {",
"goto out;",
"stat_to_qid(&VAR_1, &qid);",
"VAR_3 = pdu_marshal(pdu, offset, \"Q\", &qid);",
"if (VAR_3 < 0) {",
"goto out;",
"VAR_3 += offset;",
"trace_v9fs_mkdir_return(pdu->tag, pdu->id,\nqid.type, qid.version, qid.path, VAR_3);",
"out:\nput_fid(pdu, fidp);",
"out_nofid:\npdu_complete(pdu, VAR_3);",
"v9fs_string_free(&name);"
] |
[
0,
0,
0,
0,
0,
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
]
] |
7,252 |
static void kvmppc_host_cpu_class_init(ObjectClass *oc, void *data)
{
PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
uint32_t vmx = kvmppc_get_vmx();
uint32_t dfp = kvmppc_get_dfp();
/* Now fix up the class with information we can query from the host */
if (vmx != -1) {
/* Only override when we know what the host supports */
alter_insns(&pcc->insns_flags, PPC_ALTIVEC, vmx > 0);
alter_insns(&pcc->insns_flags2, PPC2_VSX, vmx > 1);
}
if (dfp != -1) {
/* Only override when we know what the host supports */
alter_insns(&pcc->insns_flags2, PPC2_DFP, dfp);
}
if (dcache_size != -1) {
pcc->l1_dcache_size = dcache_size;
}
if (icache_size != -1) {
pcc->l1_icache_size = icache_size;
}
}
| true |
qemu
|
0cbad81f70546b58f08de3225f1eca7a8b869b09
|
static void kvmppc_host_cpu_class_init(ObjectClass *oc, void *data)
{
PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
uint32_t vmx = kvmppc_get_vmx();
uint32_t dfp = kvmppc_get_dfp();
if (vmx != -1) {
alter_insns(&pcc->insns_flags, PPC_ALTIVEC, vmx > 0);
alter_insns(&pcc->insns_flags2, PPC2_VSX, vmx > 1);
}
if (dfp != -1) {
alter_insns(&pcc->insns_flags2, PPC2_DFP, dfp);
}
if (dcache_size != -1) {
pcc->l1_dcache_size = dcache_size;
}
if (icache_size != -1) {
pcc->l1_icache_size = icache_size;
}
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)
{
PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(VAR_0);
uint32_t vmx = kvmppc_get_vmx();
uint32_t dfp = kvmppc_get_dfp();
if (vmx != -1) {
alter_insns(&pcc->insns_flags, PPC_ALTIVEC, vmx > 0);
alter_insns(&pcc->insns_flags2, PPC2_VSX, vmx > 1);
}
if (dfp != -1) {
alter_insns(&pcc->insns_flags2, PPC2_DFP, dfp);
}
if (dcache_size != -1) {
pcc->l1_dcache_size = dcache_size;
}
if (icache_size != -1) {
pcc->l1_icache_size = icache_size;
}
}
|
[
"static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{",
"PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(VAR_0);",
"uint32_t vmx = kvmppc_get_vmx();",
"uint32_t dfp = kvmppc_get_dfp();",
"if (vmx != -1) {",
"alter_insns(&pcc->insns_flags, PPC_ALTIVEC, vmx > 0);",
"alter_insns(&pcc->insns_flags2, PPC2_VSX, vmx > 1);",
"}",
"if (dfp != -1) {",
"alter_insns(&pcc->insns_flags2, PPC2_DFP, dfp);",
"}",
"if (dcache_size != -1) {",
"pcc->l1_dcache_size = dcache_size;",
"}",
"if (icache_size != -1) {",
"pcc->l1_icache_size = icache_size;",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
19
],
[
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
],
[
39
],
[
41
],
[
43
],
[
47
],
[
49
],
[
51
],
[
53
]
] |
7,253 |
static BlockDriverAIOCB *raw_aio_writev(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque)
{
const uint8_t *first_buf;
int first_buf_index = 0, i;
/* This is probably being paranoid, but handle cases of zero size
vectors. */
for (i = 0; i < qiov->niov; i++) {
if (qiov->iov[i].iov_len) {
assert(qiov->iov[i].iov_len >= 512);
first_buf_index = i;
break;
}
}
first_buf = qiov->iov[first_buf_index].iov_base;
if (check_write_unsafe(bs, sector_num, first_buf, nb_sectors)) {
RawScrubberBounce *b;
int ret;
/* write the first sector using sync I/O */
ret = raw_write_scrubbed_bootsect(bs, first_buf);
if (ret < 0) {
return NULL;
}
/* adjust request to be everything but first sector */
b = qemu_malloc(sizeof(*b));
b->cb = cb;
b->opaque = opaque;
qemu_iovec_init(&b->qiov, qiov->nalloc);
qemu_iovec_concat(&b->qiov, qiov, qiov->size);
b->qiov.size -= 512;
b->qiov.iov[first_buf_index].iov_base += 512;
b->qiov.iov[first_buf_index].iov_len -= 512;
return bdrv_aio_writev(bs->file, sector_num + 1, &b->qiov,
nb_sectors - 1, raw_aio_writev_scrubbed, b);
}
return bdrv_aio_writev(bs->file, sector_num, qiov, nb_sectors, cb, opaque);
}
| true |
qemu
|
8b33d9eeba91422ee2d73b6936ad57262d18cf5a
|
static BlockDriverAIOCB *raw_aio_writev(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque)
{
const uint8_t *first_buf;
int first_buf_index = 0, i;
for (i = 0; i < qiov->niov; i++) {
if (qiov->iov[i].iov_len) {
assert(qiov->iov[i].iov_len >= 512);
first_buf_index = i;
break;
}
}
first_buf = qiov->iov[first_buf_index].iov_base;
if (check_write_unsafe(bs, sector_num, first_buf, nb_sectors)) {
RawScrubberBounce *b;
int ret;
ret = raw_write_scrubbed_bootsect(bs, first_buf);
if (ret < 0) {
return NULL;
}
b = qemu_malloc(sizeof(*b));
b->cb = cb;
b->opaque = opaque;
qemu_iovec_init(&b->qiov, qiov->nalloc);
qemu_iovec_concat(&b->qiov, qiov, qiov->size);
b->qiov.size -= 512;
b->qiov.iov[first_buf_index].iov_base += 512;
b->qiov.iov[first_buf_index].iov_len -= 512;
return bdrv_aio_writev(bs->file, sector_num + 1, &b->qiov,
nb_sectors - 1, raw_aio_writev_scrubbed, b);
}
return bdrv_aio_writev(bs->file, sector_num, qiov, nb_sectors, cb, opaque);
}
|
{
"code": [
" int ret;",
" if (ret < 0) {",
" if (ret < 0) {",
" const uint8_t *first_buf;",
" int first_buf_index = 0, i;",
" for (i = 0; i < qiov->niov; i++) {",
" if (qiov->iov[i].iov_len) {",
" assert(qiov->iov[i].iov_len >= 512);",
" first_buf_index = i;",
" break;",
" first_buf = qiov->iov[first_buf_index].iov_base;",
" if (check_write_unsafe(bs, sector_num, first_buf, nb_sectors)) {",
" RawScrubberBounce *b;",
" int ret;",
" ret = raw_write_scrubbed_bootsect(bs, first_buf);",
" if (ret < 0) {",
" return NULL;",
" b = qemu_malloc(sizeof(*b));",
" b->cb = cb;",
" b->opaque = opaque;",
" qemu_iovec_init(&b->qiov, qiov->nalloc);",
" qemu_iovec_concat(&b->qiov, qiov, qiov->size);",
" b->qiov.size -= 512;",
" b->qiov.iov[first_buf_index].iov_base += 512;",
" b->qiov.iov[first_buf_index].iov_len -= 512;",
" return bdrv_aio_writev(bs->file, sector_num + 1, &b->qiov,",
" nb_sectors - 1, raw_aio_writev_scrubbed, b);"
],
"line_no": [
43,
51,
51,
9,
11,
19,
21,
23,
25,
27,
35,
39,
41,
43,
49,
51,
53,
63,
65,
67,
71,
73,
77,
79,
81,
85,
87
]
}
|
static BlockDriverAIOCB *FUNC_0(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque)
{
const uint8_t *VAR_0;
int VAR_1 = 0, VAR_2;
for (VAR_2 = 0; VAR_2 < qiov->niov; VAR_2++) {
if (qiov->iov[VAR_2].iov_len) {
assert(qiov->iov[VAR_2].iov_len >= 512);
VAR_1 = VAR_2;
break;
}
}
VAR_0 = qiov->iov[VAR_1].iov_base;
if (check_write_unsafe(bs, sector_num, VAR_0, nb_sectors)) {
RawScrubberBounce *b;
int VAR_3;
VAR_3 = raw_write_scrubbed_bootsect(bs, VAR_0);
if (VAR_3 < 0) {
return NULL;
}
b = qemu_malloc(sizeof(*b));
b->cb = cb;
b->opaque = opaque;
qemu_iovec_init(&b->qiov, qiov->nalloc);
qemu_iovec_concat(&b->qiov, qiov, qiov->size);
b->qiov.size -= 512;
b->qiov.iov[VAR_1].iov_base += 512;
b->qiov.iov[VAR_1].iov_len -= 512;
return bdrv_aio_writev(bs->file, sector_num + 1, &b->qiov,
nb_sectors - 1, raw_aio_writev_scrubbed, b);
}
return bdrv_aio_writev(bs->file, sector_num, qiov, nb_sectors, cb, opaque);
}
|
[
"static BlockDriverAIOCB *FUNC_0(BlockDriverState *bs,\nint64_t sector_num, QEMUIOVector *qiov, int nb_sectors,\nBlockDriverCompletionFunc *cb, void *opaque)\n{",
"const uint8_t *VAR_0;",
"int VAR_1 = 0, VAR_2;",
"for (VAR_2 = 0; VAR_2 < qiov->niov; VAR_2++) {",
"if (qiov->iov[VAR_2].iov_len) {",
"assert(qiov->iov[VAR_2].iov_len >= 512);",
"VAR_1 = VAR_2;",
"break;",
"}",
"}",
"VAR_0 = qiov->iov[VAR_1].iov_base;",
"if (check_write_unsafe(bs, sector_num, VAR_0, nb_sectors)) {",
"RawScrubberBounce *b;",
"int VAR_3;",
"VAR_3 = raw_write_scrubbed_bootsect(bs, VAR_0);",
"if (VAR_3 < 0) {",
"return NULL;",
"}",
"b = qemu_malloc(sizeof(*b));",
"b->cb = cb;",
"b->opaque = opaque;",
"qemu_iovec_init(&b->qiov, qiov->nalloc);",
"qemu_iovec_concat(&b->qiov, qiov, qiov->size);",
"b->qiov.size -= 512;",
"b->qiov.iov[VAR_1].iov_base += 512;",
"b->qiov.iov[VAR_1].iov_len -= 512;",
"return bdrv_aio_writev(bs->file, sector_num + 1, &b->qiov,\nnb_sectors - 1, raw_aio_writev_scrubbed, b);",
"}",
"return bdrv_aio_writev(bs->file, sector_num, qiov, nb_sectors, cb, opaque);",
"}"
] |
[
0,
1,
1,
1,
1,
1,
1,
1,
0,
0,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0
] |
[
[
1,
3,
5,
7
],
[
9
],
[
11
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
35
],
[
39
],
[
41
],
[
43
],
[
49
],
[
51
],
[
53
],
[
55
],
[
63
],
[
65
],
[
67
],
[
71
],
[
73
],
[
77
],
[
79
],
[
81
],
[
85,
87
],
[
89
],
[
93
],
[
95
]
] |
7,254 |
void ppc_slb_invalidate_all (CPUPPCState *env)
{
target_phys_addr_t sr_base;
uint64_t tmp64;
int n, do_invalidate;
do_invalidate = 0;
sr_base = env->spr[SPR_ASR];
for (n = 0; n < env->slb_nr; n++) {
tmp64 = ldq_phys(sr_base);
if (slb_is_valid(tmp64)) {
slb_invalidate(&tmp64);
stq_phys(sr_base, tmp64);
/* XXX: given the fact that segment size is 256 MB or 1TB,
* and we still don't have a tlb_flush_mask(env, n, mask)
* in Qemu, we just invalidate all TLBs
*/
do_invalidate = 1;
}
sr_base += 12;
}
if (do_invalidate)
tlb_flush(env, 1);
}
| true |
qemu
|
2c1ee068b469ef5dcd8ea8f9220256a737e2b810
|
void ppc_slb_invalidate_all (CPUPPCState *env)
{
target_phys_addr_t sr_base;
uint64_t tmp64;
int n, do_invalidate;
do_invalidate = 0;
sr_base = env->spr[SPR_ASR];
for (n = 0; n < env->slb_nr; n++) {
tmp64 = ldq_phys(sr_base);
if (slb_is_valid(tmp64)) {
slb_invalidate(&tmp64);
stq_phys(sr_base, tmp64);
do_invalidate = 1;
}
sr_base += 12;
}
if (do_invalidate)
tlb_flush(env, 1);
}
|
{
"code": [
" for (n = 0; n < env->slb_nr; n++) {"
],
"line_no": [
17
]
}
|
void FUNC_0 (CPUPPCState *VAR_0)
{
target_phys_addr_t sr_base;
uint64_t tmp64;
int VAR_1, VAR_2;
VAR_2 = 0;
sr_base = VAR_0->spr[SPR_ASR];
for (VAR_1 = 0; VAR_1 < VAR_0->slb_nr; VAR_1++) {
tmp64 = ldq_phys(sr_base);
if (slb_is_valid(tmp64)) {
slb_invalidate(&tmp64);
stq_phys(sr_base, tmp64);
VAR_2 = 1;
}
sr_base += 12;
}
if (VAR_2)
tlb_flush(VAR_0, 1);
}
|
[
"void FUNC_0 (CPUPPCState *VAR_0)\n{",
"target_phys_addr_t sr_base;",
"uint64_t tmp64;",
"int VAR_1, VAR_2;",
"VAR_2 = 0;",
"sr_base = VAR_0->spr[SPR_ASR];",
"for (VAR_1 = 0; VAR_1 < VAR_0->slb_nr; VAR_1++) {",
"tmp64 = ldq_phys(sr_base);",
"if (slb_is_valid(tmp64)) {",
"slb_invalidate(&tmp64);",
"stq_phys(sr_base, tmp64);",
"VAR_2 = 1;",
"}",
"sr_base += 12;",
"}",
"if (VAR_2)\ntlb_flush(VAR_0, 1);",
"}"
] |
[
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43,
45
],
[
47
]
] |
7,255 |
static int dirac_header(AVFormatContext *s, int idx)
{
struct ogg *ogg = s->priv_data;
struct ogg_stream *os = ogg->streams + idx;
AVStream *st = s->streams[idx];
dirac_source_params source;
GetBitContext gb;
// already parsed the header
if (st->codec->codec_id == AV_CODEC_ID_DIRAC)
return 0;
init_get_bits(&gb, os->buf + os->pstart + 13, (os->psize - 13) * 8);
if (avpriv_dirac_parse_sequence_header(st->codec, &gb, &source) < 0)
return -1;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = AV_CODEC_ID_DIRAC;
// dirac in ogg always stores timestamps as though the video were interlaced
avpriv_set_pts_info(st, 64, st->codec->framerate.den, 2*st->codec->framerate.num);
return 1;
}
| true |
FFmpeg
|
4f5c2e651a95b950f6a3fb36f2342cbc32515f17
|
static int dirac_header(AVFormatContext *s, int idx)
{
struct ogg *ogg = s->priv_data;
struct ogg_stream *os = ogg->streams + idx;
AVStream *st = s->streams[idx];
dirac_source_params source;
GetBitContext gb;
if (st->codec->codec_id == AV_CODEC_ID_DIRAC)
return 0;
init_get_bits(&gb, os->buf + os->pstart + 13, (os->psize - 13) * 8);
if (avpriv_dirac_parse_sequence_header(st->codec, &gb, &source) < 0)
return -1;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = AV_CODEC_ID_DIRAC;
avpriv_set_pts_info(st, 64, st->codec->framerate.den, 2*st->codec->framerate.num);
return 1;
}
|
{
"code": [
" init_get_bits(&gb, os->buf + os->pstart + 13, (os->psize - 13) * 8);",
" if (avpriv_dirac_parse_sequence_header(st->codec, &gb, &source) < 0)",
" return -1;"
],
"line_no": [
25,
27,
29
]
}
|
static int FUNC_0(AVFormatContext *VAR_0, int VAR_1)
{
struct VAR_2 *VAR_2 = VAR_0->priv_data;
struct ogg_stream *VAR_3 = VAR_2->streams + VAR_1;
AVStream *st = VAR_0->streams[VAR_1];
dirac_source_params source;
GetBitContext gb;
if (st->codec->codec_id == AV_CODEC_ID_DIRAC)
return 0;
init_get_bits(&gb, VAR_3->buf + VAR_3->pstart + 13, (VAR_3->psize - 13) * 8);
if (avpriv_dirac_parse_sequence_header(st->codec, &gb, &source) < 0)
return -1;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = AV_CODEC_ID_DIRAC;
avpriv_set_pts_info(st, 64, st->codec->framerate.den, 2*st->codec->framerate.num);
return 1;
}
|
[
"static int FUNC_0(AVFormatContext *VAR_0, int VAR_1)\n{",
"struct VAR_2 *VAR_2 = VAR_0->priv_data;",
"struct ogg_stream *VAR_3 = VAR_2->streams + VAR_1;",
"AVStream *st = VAR_0->streams[VAR_1];",
"dirac_source_params source;",
"GetBitContext gb;",
"if (st->codec->codec_id == AV_CODEC_ID_DIRAC)\nreturn 0;",
"init_get_bits(&gb, VAR_3->buf + VAR_3->pstart + 13, (VAR_3->psize - 13) * 8);",
"if (avpriv_dirac_parse_sequence_header(st->codec, &gb, &source) < 0)\nreturn -1;",
"st->codec->codec_type = AVMEDIA_TYPE_VIDEO;",
"st->codec->codec_id = AV_CODEC_ID_DIRAC;",
"avpriv_set_pts_info(st, 64, st->codec->framerate.den, 2*st->codec->framerate.num);",
"return 1;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
1,
1,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
19,
21
],
[
25
],
[
27,
29
],
[
33
],
[
35
],
[
39
],
[
41
],
[
43
]
] |
7,257 |
static int targa_encode_frame(AVCodecContext *avctx,
unsigned char *outbuf,
int buf_size, void *data){
AVFrame *p = data;
int bpp, picsize, datasize;
uint8_t *out;
if(avctx->width > 0xffff || avctx->height > 0xffff) {
av_log(avctx, AV_LOG_ERROR, "image dimensions too large\n");
return -1;
}
picsize = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
if(buf_size < picsize + 45) {
av_log(avctx, AV_LOG_ERROR, "encoded frame too large\n");
return -1;
}
p->pict_type= FF_I_TYPE;
p->key_frame= 1;
/* zero out the header and only set applicable fields */
memset(outbuf, 0, 11);
AV_WL16(outbuf+12, avctx->width);
AV_WL16(outbuf+14, avctx->height);
outbuf[17] = 0x20; /* origin is top-left. no alpha */
/* TODO: support alpha channel */
switch(avctx->pix_fmt) {
case PIX_FMT_GRAY8:
outbuf[2] = 3; /* uncompressed grayscale image */
outbuf[16] = 8; /* bpp */
break;
case PIX_FMT_RGB555:
outbuf[2] = 2; /* uncompresses true-color image */
outbuf[16] = 16; /* bpp */
break;
case PIX_FMT_BGR24:
outbuf[2] = 2; /* uncompressed true-color image */
outbuf[16] = 24; /* bpp */
break;
default:
return -1;
}
bpp = outbuf[16] >> 3;
out = outbuf + 18; /* skip past the header we just output */
/* try RLE compression */
datasize = targa_encode_rle(out, picsize, p, bpp, avctx->width, avctx->height);
/* if that worked well, mark the picture as RLE compressed */
if(datasize >= 0)
outbuf[2] |= 8;
/* if RLE didn't make it smaller, go back to no compression */
else datasize = targa_encode_normal(out, p, bpp, avctx->width, avctx->height);
out += datasize;
/* The standard recommends including this section, even if we don't use
* any of the features it affords. TODO: take advantage of the pixel
* aspect ratio and encoder ID fields available? */
memcpy(out, "\0\0\0\0\0\0\0\0TRUEVISION-XFILE.", 26);
return out + 26 - outbuf;
}
| false |
FFmpeg
|
d010a2d5befcde4782c4498134bb380e9fb24af6
|
static int targa_encode_frame(AVCodecContext *avctx,
unsigned char *outbuf,
int buf_size, void *data){
AVFrame *p = data;
int bpp, picsize, datasize;
uint8_t *out;
if(avctx->width > 0xffff || avctx->height > 0xffff) {
av_log(avctx, AV_LOG_ERROR, "image dimensions too large\n");
return -1;
}
picsize = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
if(buf_size < picsize + 45) {
av_log(avctx, AV_LOG_ERROR, "encoded frame too large\n");
return -1;
}
p->pict_type= FF_I_TYPE;
p->key_frame= 1;
memset(outbuf, 0, 11);
AV_WL16(outbuf+12, avctx->width);
AV_WL16(outbuf+14, avctx->height);
outbuf[17] = 0x20;
switch(avctx->pix_fmt) {
case PIX_FMT_GRAY8:
outbuf[2] = 3;
outbuf[16] = 8;
break;
case PIX_FMT_RGB555:
outbuf[2] = 2;
outbuf[16] = 16;
break;
case PIX_FMT_BGR24:
outbuf[2] = 2;
outbuf[16] = 24;
break;
default:
return -1;
}
bpp = outbuf[16] >> 3;
out = outbuf + 18;
datasize = targa_encode_rle(out, picsize, p, bpp, avctx->width, avctx->height);
if(datasize >= 0)
outbuf[2] |= 8;
else datasize = targa_encode_normal(out, p, bpp, avctx->width, avctx->height);
out += datasize;
memcpy(out, "\0\0\0\0\0\0\0\0TRUEVISION-XFILE.", 26);
return out + 26 - outbuf;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(AVCodecContext *VAR_0,
unsigned char *VAR_1,
int VAR_2, void *VAR_3){
AVFrame *p = VAR_3;
int VAR_4, VAR_5, VAR_6;
uint8_t *out;
if(VAR_0->width > 0xffff || VAR_0->height > 0xffff) {
av_log(VAR_0, AV_LOG_ERROR, "image dimensions too large\n");
return -1;
}
VAR_5 = avpicture_get_size(VAR_0->pix_fmt, VAR_0->width, VAR_0->height);
if(VAR_2 < VAR_5 + 45) {
av_log(VAR_0, AV_LOG_ERROR, "encoded frame too large\n");
return -1;
}
p->pict_type= FF_I_TYPE;
p->key_frame= 1;
memset(VAR_1, 0, 11);
AV_WL16(VAR_1+12, VAR_0->width);
AV_WL16(VAR_1+14, VAR_0->height);
VAR_1[17] = 0x20;
switch(VAR_0->pix_fmt) {
case PIX_FMT_GRAY8:
VAR_1[2] = 3;
VAR_1[16] = 8;
break;
case PIX_FMT_RGB555:
VAR_1[2] = 2;
VAR_1[16] = 16;
break;
case PIX_FMT_BGR24:
VAR_1[2] = 2;
VAR_1[16] = 24;
break;
default:
return -1;
}
VAR_4 = VAR_1[16] >> 3;
out = VAR_1 + 18;
VAR_6 = targa_encode_rle(out, VAR_5, p, VAR_4, VAR_0->width, VAR_0->height);
if(VAR_6 >= 0)
VAR_1[2] |= 8;
else VAR_6 = targa_encode_normal(out, p, VAR_4, VAR_0->width, VAR_0->height);
out += VAR_6;
memcpy(out, "\0\0\0\0\0\0\0\0TRUEVISION-XFILE.", 26);
return out + 26 - VAR_1;
}
|
[
"static int FUNC_0(AVCodecContext *VAR_0,\nunsigned char *VAR_1,\nint VAR_2, void *VAR_3){",
"AVFrame *p = VAR_3;",
"int VAR_4, VAR_5, VAR_6;",
"uint8_t *out;",
"if(VAR_0->width > 0xffff || VAR_0->height > 0xffff) {",
"av_log(VAR_0, AV_LOG_ERROR, \"image dimensions too large\\n\");",
"return -1;",
"}",
"VAR_5 = avpicture_get_size(VAR_0->pix_fmt, VAR_0->width, VAR_0->height);",
"if(VAR_2 < VAR_5 + 45) {",
"av_log(VAR_0, AV_LOG_ERROR, \"encoded frame too large\\n\");",
"return -1;",
"}",
"p->pict_type= FF_I_TYPE;",
"p->key_frame= 1;",
"memset(VAR_1, 0, 11);",
"AV_WL16(VAR_1+12, VAR_0->width);",
"AV_WL16(VAR_1+14, VAR_0->height);",
"VAR_1[17] = 0x20;",
"switch(VAR_0->pix_fmt) {",
"case PIX_FMT_GRAY8:\nVAR_1[2] = 3;",
"VAR_1[16] = 8;",
"break;",
"case PIX_FMT_RGB555:\nVAR_1[2] = 2;",
"VAR_1[16] = 16;",
"break;",
"case PIX_FMT_BGR24:\nVAR_1[2] = 2;",
"VAR_1[16] = 24;",
"break;",
"default:\nreturn -1;",
"}",
"VAR_4 = VAR_1[16] >> 3;",
"out = VAR_1 + 18;",
"VAR_6 = targa_encode_rle(out, VAR_5, p, VAR_4, VAR_0->width, VAR_0->height);",
"if(VAR_6 >= 0)\nVAR_1[2] |= 8;",
"else VAR_6 = targa_encode_normal(out, p, VAR_4, VAR_0->width, VAR_0->height);",
"out += VAR_6;",
"memcpy(out, \"\\0\\0\\0\\0\\0\\0\\0\\0TRUEVISION-XFILE.\", 26);",
"return out + 26 - VAR_1;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
35
],
[
37
],
[
43
],
[
45
],
[
47
],
[
49
],
[
55
],
[
57,
59
],
[
61
],
[
63
],
[
65,
67
],
[
69
],
[
71
],
[
73,
75
],
[
77
],
[
79
],
[
81,
83
],
[
85
],
[
87
],
[
91
],
[
97
],
[
103,
105
],
[
111
],
[
115
],
[
125
],
[
129
],
[
131
]
] |
7,258 |
static void sdp_parse_fmtp(AVStream *st, const char *p)
{
char attr[256];
/* Vorbis setup headers can be up to 12KB and are sent base64
* encoded, giving a 12KB * (4/3) = 16KB FMTP line. */
char value[16384];
int i;
RTSPStream *rtsp_st = st->priv_data;
AVCodecContext *codec = st->codec;
RTPPayloadData *rtp_payload_data = &rtsp_st->rtp_payload_data;
/* loop on each attribute */
while(rtsp_next_attr_and_value(&p, attr, sizeof(attr), value, sizeof(value)))
{
/* grab the codec extra_data from the config parameter of the fmtp line */
sdp_parse_fmtp_config(codec, rtsp_st->dynamic_protocol_context,
attr, value);
/* Looking for a known attribute */
for (i = 0; attr_names[i].str; ++i) {
if (!strcasecmp(attr, attr_names[i].str)) {
if (attr_names[i].type == ATTR_NAME_TYPE_INT)
*(int *)((char *)rtp_payload_data + attr_names[i].offset) = atoi(value);
else if (attr_names[i].type == ATTR_NAME_TYPE_STR)
*(char **)((char *)rtp_payload_data + attr_names[i].offset) = av_strdup(value);
}
}
}
}
| false |
FFmpeg
|
c89658008705d949c319df3fa6f400c481ad73e1
|
static void sdp_parse_fmtp(AVStream *st, const char *p)
{
char attr[256];
char value[16384];
int i;
RTSPStream *rtsp_st = st->priv_data;
AVCodecContext *codec = st->codec;
RTPPayloadData *rtp_payload_data = &rtsp_st->rtp_payload_data;
while(rtsp_next_attr_and_value(&p, attr, sizeof(attr), value, sizeof(value)))
{
sdp_parse_fmtp_config(codec, rtsp_st->dynamic_protocol_context,
attr, value);
for (i = 0; attr_names[i].str; ++i) {
if (!strcasecmp(attr, attr_names[i].str)) {
if (attr_names[i].type == ATTR_NAME_TYPE_INT)
*(int *)((char *)rtp_payload_data + attr_names[i].offset) = atoi(value);
else if (attr_names[i].type == ATTR_NAME_TYPE_STR)
*(char **)((char *)rtp_payload_data + attr_names[i].offset) = av_strdup(value);
}
}
}
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(AVStream *VAR_0, const char *VAR_1)
{
char VAR_2[256];
char VAR_3[16384];
int VAR_4;
RTSPStream *rtsp_st = VAR_0->priv_data;
AVCodecContext *codec = VAR_0->codec;
RTPPayloadData *rtp_payload_data = &rtsp_st->rtp_payload_data;
while(rtsp_next_attr_and_value(&VAR_1, VAR_2, sizeof(VAR_2), VAR_3, sizeof(VAR_3)))
{
sdp_parse_fmtp_config(codec, rtsp_st->dynamic_protocol_context,
VAR_2, VAR_3);
for (VAR_4 = 0; attr_names[VAR_4].str; ++VAR_4) {
if (!strcasecmp(VAR_2, attr_names[VAR_4].str)) {
if (attr_names[VAR_4].type == ATTR_NAME_TYPE_INT)
*(int *)((char *)rtp_payload_data + attr_names[VAR_4].offset) = atoi(VAR_3);
else if (attr_names[VAR_4].type == ATTR_NAME_TYPE_STR)
*(char **)((char *)rtp_payload_data + attr_names[VAR_4].offset) = av_strdup(VAR_3);
}
}
}
}
|
[
"static void FUNC_0(AVStream *VAR_0, const char *VAR_1)\n{",
"char VAR_2[256];",
"char VAR_3[16384];",
"int VAR_4;",
"RTSPStream *rtsp_st = VAR_0->priv_data;",
"AVCodecContext *codec = VAR_0->codec;",
"RTPPayloadData *rtp_payload_data = &rtsp_st->rtp_payload_data;",
"while(rtsp_next_attr_and_value(&VAR_1, VAR_2, sizeof(VAR_2), VAR_3, sizeof(VAR_3)))\n{",
"sdp_parse_fmtp_config(codec, rtsp_st->dynamic_protocol_context,\nVAR_2, VAR_3);",
"for (VAR_4 = 0; attr_names[VAR_4].str; ++VAR_4) {",
"if (!strcasecmp(VAR_2, attr_names[VAR_4].str)) {",
"if (attr_names[VAR_4].type == ATTR_NAME_TYPE_INT)\n*(int *)((char *)rtp_payload_data + attr_names[VAR_4].offset) = atoi(VAR_3);",
"else if (attr_names[VAR_4].type == ATTR_NAME_TYPE_STR)\n*(char **)((char *)rtp_payload_data + attr_names[VAR_4].offset) = av_strdup(VAR_3);",
"}",
"}",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
11
],
[
13
],
[
17
],
[
19
],
[
21
],
[
27,
29
],
[
33,
35
],
[
39
],
[
41
],
[
43,
45
],
[
47,
49
],
[
51
],
[
53
],
[
55
],
[
57
]
] |
7,259 |
static int h261_decode_gob(H261Context *h){
MpegEncContext * const s = &h->s;
int v;
ff_set_qscale(s, s->qscale);
/* check for empty gob */
v= show_bits(&s->gb, 15);
if(get_bits_count(&s->gb) + 15 > s->gb.size_in_bits){
v>>= get_bits_count(&s->gb) + 15 - s->gb.size_in_bits;
}
if(v==0){
h261_decode_mb_skipped(h, 0, 33);
return 0;
}
/* decode mb's */
while(h->current_mba <= MAX_MBA)
{
int ret;
/* DCT & quantize */
ret= h261_decode_mb(h, s->block);
if(ret<0){
const int xy= s->mb_x + s->mb_y*s->mb_stride;
if(ret==SLICE_END){
MPV_decode_mb(s, s->block);
if(h->loop_filter){
ff_h261_loop_filter(h);
}
h->loop_filter = 0;
h261_decode_mb_skipped(h, h->current_mba-h->mba_diff, h->current_mba-1);
h261_decode_mb_skipped(h, h->current_mba, 33);
return 0;
}else if(ret==SLICE_NOEND){
av_log(s->avctx, AV_LOG_ERROR, "Slice mismatch at MB: %d\n", xy);
return -1;
}
av_log(s->avctx, AV_LOG_ERROR, "Error at MB: %d\n", xy);
return -1;
}
MPV_decode_mb(s, s->block);
if(h->loop_filter){
ff_h261_loop_filter(h);
}
h->loop_filter = 0;
h261_decode_mb_skipped(h, h->current_mba-h->mba_diff, h->current_mba-1);
}
return -1;
}
| true |
FFmpeg
|
49e5dcbce5f9e08ec375fd54c413148beb81f1d7
|
static int h261_decode_gob(H261Context *h){
MpegEncContext * const s = &h->s;
int v;
ff_set_qscale(s, s->qscale);
v= show_bits(&s->gb, 15);
if(get_bits_count(&s->gb) + 15 > s->gb.size_in_bits){
v>>= get_bits_count(&s->gb) + 15 - s->gb.size_in_bits;
}
if(v==0){
h261_decode_mb_skipped(h, 0, 33);
return 0;
}
while(h->current_mba <= MAX_MBA)
{
int ret;
ret= h261_decode_mb(h, s->block);
if(ret<0){
const int xy= s->mb_x + s->mb_y*s->mb_stride;
if(ret==SLICE_END){
MPV_decode_mb(s, s->block);
if(h->loop_filter){
ff_h261_loop_filter(h);
}
h->loop_filter = 0;
h261_decode_mb_skipped(h, h->current_mba-h->mba_diff, h->current_mba-1);
h261_decode_mb_skipped(h, h->current_mba, 33);
return 0;
}else if(ret==SLICE_NOEND){
av_log(s->avctx, AV_LOG_ERROR, "Slice mismatch at MB: %d\n", xy);
return -1;
}
av_log(s->avctx, AV_LOG_ERROR, "Error at MB: %d\n", xy);
return -1;
}
MPV_decode_mb(s, s->block);
if(h->loop_filter){
ff_h261_loop_filter(h);
}
h->loop_filter = 0;
h261_decode_mb_skipped(h, h->current_mba-h->mba_diff, h->current_mba-1);
}
return -1;
}
|
{
"code": [
" return -1;",
" int v;",
" v= show_bits(&s->gb, 15);",
" if(get_bits_count(&s->gb) + 15 > s->gb.size_in_bits){",
" v>>= get_bits_count(&s->gb) + 15 - s->gb.size_in_bits;",
" if(v==0){",
" h261_decode_mb_skipped(h, 0, 33);",
" return 0;",
" while(h->current_mba <= MAX_MBA)",
" ret= h261_decode_mb(h, s->block);",
" const int xy= s->mb_x + s->mb_y*s->mb_stride;",
" MPV_decode_mb(s, s->block);",
" if(h->loop_filter){",
" ff_h261_loop_filter(h);",
" h->loop_filter = 0;",
" h261_decode_mb_skipped(h, h->current_mba-h->mba_diff, h->current_mba-1);",
" }else if(ret==SLICE_NOEND){",
" av_log(s->avctx, AV_LOG_ERROR, \"Slice mismatch at MB: %d\\n\", xy);",
" return -1;",
" av_log(s->avctx, AV_LOG_ERROR, \"Error at MB: %d\\n\", xy);",
" MPV_decode_mb(s, s->block);",
" if(h->loop_filter){",
" ff_h261_loop_filter(h);",
" h->loop_filter = 0;"
],
"line_no": [
75,
5,
15,
19,
21,
27,
29,
31,
39,
47,
51,
55,
57,
59,
63,
65,
71,
73,
75,
79,
85,
87,
89,
95
]
}
|
static int FUNC_0(H261Context *VAR_0){
MpegEncContext * const s = &VAR_0->s;
int VAR_1;
ff_set_qscale(s, s->qscale);
VAR_1= show_bits(&s->gb, 15);
if(get_bits_count(&s->gb) + 15 > s->gb.size_in_bits){
VAR_1>>= get_bits_count(&s->gb) + 15 - s->gb.size_in_bits;
}
if(VAR_1==0){
h261_decode_mb_skipped(VAR_0, 0, 33);
return 0;
}
while(VAR_0->current_mba <= MAX_MBA)
{
int VAR_2;
VAR_2= h261_decode_mb(VAR_0, s->block);
if(VAR_2<0){
const int VAR_3= s->mb_x + s->mb_y*s->mb_stride;
if(VAR_2==SLICE_END){
MPV_decode_mb(s, s->block);
if(VAR_0->loop_filter){
ff_h261_loop_filter(VAR_0);
}
VAR_0->loop_filter = 0;
h261_decode_mb_skipped(VAR_0, VAR_0->current_mba-VAR_0->mba_diff, VAR_0->current_mba-1);
h261_decode_mb_skipped(VAR_0, VAR_0->current_mba, 33);
return 0;
}else if(VAR_2==SLICE_NOEND){
av_log(s->avctx, AV_LOG_ERROR, "Slice mismatch at MB: %d\n", VAR_3);
return -1;
}
av_log(s->avctx, AV_LOG_ERROR, "Error at MB: %d\n", VAR_3);
return -1;
}
MPV_decode_mb(s, s->block);
if(VAR_0->loop_filter){
ff_h261_loop_filter(VAR_0);
}
VAR_0->loop_filter = 0;
h261_decode_mb_skipped(VAR_0, VAR_0->current_mba-VAR_0->mba_diff, VAR_0->current_mba-1);
}
return -1;
}
|
[
"static int FUNC_0(H261Context *VAR_0){",
"MpegEncContext * const s = &VAR_0->s;",
"int VAR_1;",
"ff_set_qscale(s, s->qscale);",
"VAR_1= show_bits(&s->gb, 15);",
"if(get_bits_count(&s->gb) + 15 > s->gb.size_in_bits){",
"VAR_1>>= get_bits_count(&s->gb) + 15 - s->gb.size_in_bits;",
"}",
"if(VAR_1==0){",
"h261_decode_mb_skipped(VAR_0, 0, 33);",
"return 0;",
"}",
"while(VAR_0->current_mba <= MAX_MBA)\n{",
"int VAR_2;",
"VAR_2= h261_decode_mb(VAR_0, s->block);",
"if(VAR_2<0){",
"const int VAR_3= s->mb_x + s->mb_y*s->mb_stride;",
"if(VAR_2==SLICE_END){",
"MPV_decode_mb(s, s->block);",
"if(VAR_0->loop_filter){",
"ff_h261_loop_filter(VAR_0);",
"}",
"VAR_0->loop_filter = 0;",
"h261_decode_mb_skipped(VAR_0, VAR_0->current_mba-VAR_0->mba_diff, VAR_0->current_mba-1);",
"h261_decode_mb_skipped(VAR_0, VAR_0->current_mba, 33);",
"return 0;",
"}else if(VAR_2==SLICE_NOEND){",
"av_log(s->avctx, AV_LOG_ERROR, \"Slice mismatch at MB: %d\\n\", VAR_3);",
"return -1;",
"}",
"av_log(s->avctx, AV_LOG_ERROR, \"Error at MB: %d\\n\", VAR_3);",
"return -1;",
"}",
"MPV_decode_mb(s, s->block);",
"if(VAR_0->loop_filter){",
"ff_h261_loop_filter(VAR_0);",
"}",
"VAR_0->loop_filter = 0;",
"h261_decode_mb_skipped(VAR_0, VAR_0->current_mba-VAR_0->mba_diff, VAR_0->current_mba-1);",
"}",
"return -1;",
"}"
] |
[
0,
0,
1,
0,
1,
1,
1,
0,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
1,
0,
1,
1,
0,
0,
1,
1,
1,
0,
1,
0,
0,
1,
1,
1,
0,
1,
0,
0,
0,
0
] |
[
[
1
],
[
3
],
[
5
],
[
9
],
[
15
],
[
19
],
[
21
],
[
23
],
[
27
],
[
29
],
[
31
],
[
33
],
[
39,
41
],
[
43
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
95
],
[
97
],
[
99
],
[
103
],
[
105
]
] |
7,260 |
static int parse_playlist(URLContext *h, const char *url)
{
HLSContext *s = h->priv_data;
AVIOContext *in;
int ret = 0, is_segment = 0, is_variant = 0, bandwidth = 0;
int64_t duration = 0;
char line[1024];
const char *ptr;
if ((ret = avio_open2(&in, url, AVIO_FLAG_READ,
&h->interrupt_callback, NULL)) < 0)
return ret;
read_chomp_line(in, line, sizeof(line));
if (strcmp(line, "#EXTM3U"))
return AVERROR_INVALIDDATA;
free_segment_list(s);
s->finished = 0;
while (!in->eof_reached) {
read_chomp_line(in, line, sizeof(line));
if (av_strstart(line, "#EXT-X-STREAM-INF:", &ptr)) {
struct variant_info info = {{0}};
is_variant = 1;
ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_variant_args,
&info);
bandwidth = atoi(info.bandwidth);
} else if (av_strstart(line, "#EXT-X-TARGETDURATION:", &ptr)) {
s->target_duration = atoi(ptr) * AV_TIME_BASE;
} else if (av_strstart(line, "#EXT-X-MEDIA-SEQUENCE:", &ptr)) {
s->start_seq_no = atoi(ptr);
} else if (av_strstart(line, "#EXT-X-ENDLIST", &ptr)) {
s->finished = 1;
} else if (av_strstart(line, "#EXTINF:", &ptr)) {
is_segment = 1;
duration = atof(ptr) * AV_TIME_BASE;
} else if (av_strstart(line, "#", NULL)) {
continue;
} else if (line[0]) {
if (is_segment) {
struct segment *seg = av_malloc(sizeof(struct segment));
if (!seg) {
ret = AVERROR(ENOMEM);
goto fail;
}
seg->duration = duration;
ff_make_absolute_url(seg->url, sizeof(seg->url), url, line);
dynarray_add(&s->segments, &s->n_segments, seg);
is_segment = 0;
} else if (is_variant) {
struct variant *var = av_malloc(sizeof(struct variant));
if (!var) {
ret = AVERROR(ENOMEM);
goto fail;
}
var->bandwidth = bandwidth;
ff_make_absolute_url(var->url, sizeof(var->url), url, line);
dynarray_add(&s->variants, &s->n_variants, var);
is_variant = 0;
}
}
}
s->last_load_time = av_gettime_relative();
fail:
avio_close(in);
return ret;
}
| true |
FFmpeg
|
7915e6741dbe1cf3a8781cead3e68a7666de14f4
|
static int parse_playlist(URLContext *h, const char *url)
{
HLSContext *s = h->priv_data;
AVIOContext *in;
int ret = 0, is_segment = 0, is_variant = 0, bandwidth = 0;
int64_t duration = 0;
char line[1024];
const char *ptr;
if ((ret = avio_open2(&in, url, AVIO_FLAG_READ,
&h->interrupt_callback, NULL)) < 0)
return ret;
read_chomp_line(in, line, sizeof(line));
if (strcmp(line, "#EXTM3U"))
return AVERROR_INVALIDDATA;
free_segment_list(s);
s->finished = 0;
while (!in->eof_reached) {
read_chomp_line(in, line, sizeof(line));
if (av_strstart(line, "#EXT-X-STREAM-INF:", &ptr)) {
struct variant_info info = {{0}};
is_variant = 1;
ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_variant_args,
&info);
bandwidth = atoi(info.bandwidth);
} else if (av_strstart(line, "#EXT-X-TARGETDURATION:", &ptr)) {
s->target_duration = atoi(ptr) * AV_TIME_BASE;
} else if (av_strstart(line, "#EXT-X-MEDIA-SEQUENCE:", &ptr)) {
s->start_seq_no = atoi(ptr);
} else if (av_strstart(line, "#EXT-X-ENDLIST", &ptr)) {
s->finished = 1;
} else if (av_strstart(line, "#EXTINF:", &ptr)) {
is_segment = 1;
duration = atof(ptr) * AV_TIME_BASE;
} else if (av_strstart(line, "#", NULL)) {
continue;
} else if (line[0]) {
if (is_segment) {
struct segment *seg = av_malloc(sizeof(struct segment));
if (!seg) {
ret = AVERROR(ENOMEM);
goto fail;
}
seg->duration = duration;
ff_make_absolute_url(seg->url, sizeof(seg->url), url, line);
dynarray_add(&s->segments, &s->n_segments, seg);
is_segment = 0;
} else if (is_variant) {
struct variant *var = av_malloc(sizeof(struct variant));
if (!var) {
ret = AVERROR(ENOMEM);
goto fail;
}
var->bandwidth = bandwidth;
ff_make_absolute_url(var->url, sizeof(var->url), url, line);
dynarray_add(&s->variants, &s->n_variants, var);
is_variant = 0;
}
}
}
s->last_load_time = av_gettime_relative();
fail:
avio_close(in);
return ret;
}
|
{
"code": [
" if (strcmp(line, \"#EXTM3U\"))",
" return AVERROR_INVALIDDATA;"
],
"line_no": [
29,
31
]
}
|
static int FUNC_0(URLContext *VAR_0, const char *VAR_1)
{
HLSContext *s = VAR_0->priv_data;
AVIOContext *in;
int VAR_2 = 0, VAR_3 = 0, VAR_4 = 0, VAR_5 = 0;
int64_t duration = 0;
char VAR_6[1024];
const char *VAR_7;
if ((VAR_2 = avio_open2(&in, VAR_1, AVIO_FLAG_READ,
&VAR_0->interrupt_callback, NULL)) < 0)
return VAR_2;
read_chomp_line(in, VAR_6, sizeof(VAR_6));
if (strcmp(VAR_6, "#EXTM3U"))
return AVERROR_INVALIDDATA;
free_segment_list(s);
s->finished = 0;
while (!in->eof_reached) {
read_chomp_line(in, VAR_6, sizeof(VAR_6));
if (av_strstart(VAR_6, "#EXT-X-STREAM-INF:", &VAR_7)) {
struct variant_info VAR_8 = {{0}};
VAR_4 = 1;
ff_parse_key_value(VAR_7, (ff_parse_key_val_cb) handle_variant_args,
&VAR_8);
VAR_5 = atoi(VAR_8.VAR_5);
} else if (av_strstart(VAR_6, "#EXT-X-TARGETDURATION:", &VAR_7)) {
s->target_duration = atoi(VAR_7) * AV_TIME_BASE;
} else if (av_strstart(VAR_6, "#EXT-X-MEDIA-SEQUENCE:", &VAR_7)) {
s->start_seq_no = atoi(VAR_7);
} else if (av_strstart(VAR_6, "#EXT-X-ENDLIST", &VAR_7)) {
s->finished = 1;
} else if (av_strstart(VAR_6, "#EXTINF:", &VAR_7)) {
VAR_3 = 1;
duration = atof(VAR_7) * AV_TIME_BASE;
} else if (av_strstart(VAR_6, "#", NULL)) {
continue;
} else if (VAR_6[0]) {
if (VAR_3) {
struct segment *VAR_9 = av_malloc(sizeof(struct segment));
if (!VAR_9) {
VAR_2 = AVERROR(ENOMEM);
goto fail;
}
VAR_9->duration = duration;
ff_make_absolute_url(VAR_9->VAR_1, sizeof(VAR_9->VAR_1), VAR_1, VAR_6);
dynarray_add(&s->segments, &s->n_segments, VAR_9);
VAR_3 = 0;
} else if (VAR_4) {
struct variant *VAR_10 = av_malloc(sizeof(struct variant));
if (!VAR_10) {
VAR_2 = AVERROR(ENOMEM);
goto fail;
}
VAR_10->VAR_5 = VAR_5;
ff_make_absolute_url(VAR_10->VAR_1, sizeof(VAR_10->VAR_1), VAR_1, VAR_6);
dynarray_add(&s->variants, &s->n_variants, VAR_10);
VAR_4 = 0;
}
}
}
s->last_load_time = av_gettime_relative();
fail:
avio_close(in);
return VAR_2;
}
|
[
"static int FUNC_0(URLContext *VAR_0, const char *VAR_1)\n{",
"HLSContext *s = VAR_0->priv_data;",
"AVIOContext *in;",
"int VAR_2 = 0, VAR_3 = 0, VAR_4 = 0, VAR_5 = 0;",
"int64_t duration = 0;",
"char VAR_6[1024];",
"const char *VAR_7;",
"if ((VAR_2 = avio_open2(&in, VAR_1, AVIO_FLAG_READ,\n&VAR_0->interrupt_callback, NULL)) < 0)\nreturn VAR_2;",
"read_chomp_line(in, VAR_6, sizeof(VAR_6));",
"if (strcmp(VAR_6, \"#EXTM3U\"))\nreturn AVERROR_INVALIDDATA;",
"free_segment_list(s);",
"s->finished = 0;",
"while (!in->eof_reached) {",
"read_chomp_line(in, VAR_6, sizeof(VAR_6));",
"if (av_strstart(VAR_6, \"#EXT-X-STREAM-INF:\", &VAR_7)) {",
"struct variant_info VAR_8 = {{0}};",
"VAR_4 = 1;",
"ff_parse_key_value(VAR_7, (ff_parse_key_val_cb) handle_variant_args,\n&VAR_8);",
"VAR_5 = atoi(VAR_8.VAR_5);",
"} else if (av_strstart(VAR_6, \"#EXT-X-TARGETDURATION:\", &VAR_7)) {",
"s->target_duration = atoi(VAR_7) * AV_TIME_BASE;",
"} else if (av_strstart(VAR_6, \"#EXT-X-MEDIA-SEQUENCE:\", &VAR_7)) {",
"s->start_seq_no = atoi(VAR_7);",
"} else if (av_strstart(VAR_6, \"#EXT-X-ENDLIST\", &VAR_7)) {",
"s->finished = 1;",
"} else if (av_strstart(VAR_6, \"#EXTINF:\", &VAR_7)) {",
"VAR_3 = 1;",
"duration = atof(VAR_7) * AV_TIME_BASE;",
"} else if (av_strstart(VAR_6, \"#\", NULL)) {",
"continue;",
"} else if (VAR_6[0]) {",
"if (VAR_3) {",
"struct segment *VAR_9 = av_malloc(sizeof(struct segment));",
"if (!VAR_9) {",
"VAR_2 = AVERROR(ENOMEM);",
"goto fail;",
"}",
"VAR_9->duration = duration;",
"ff_make_absolute_url(VAR_9->VAR_1, sizeof(VAR_9->VAR_1), VAR_1, VAR_6);",
"dynarray_add(&s->segments, &s->n_segments, VAR_9);",
"VAR_3 = 0;",
"} else if (VAR_4) {",
"struct variant *VAR_10 = av_malloc(sizeof(struct variant));",
"if (!VAR_10) {",
"VAR_2 = AVERROR(ENOMEM);",
"goto fail;",
"}",
"VAR_10->VAR_5 = VAR_5;",
"ff_make_absolute_url(VAR_10->VAR_1, sizeof(VAR_10->VAR_1), VAR_1, VAR_6);",
"dynarray_add(&s->variants, &s->n_variants, VAR_10);",
"VAR_4 = 0;",
"}",
"}",
"}",
"s->last_load_time = av_gettime_relative();",
"fail:\navio_close(in);",
"return VAR_2;",
"}"
] |
[
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
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19,
21,
23
],
[
27
],
[
29,
31
],
[
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
],
[
129,
131
],
[
133
],
[
135
]
] |
7,261 |
static int dc1394_read_header(AVFormatContext *c, AVFormatParameters * ap)
{
dc1394_data* dc1394 = c->priv_data;
AVStream* vst;
nodeid_t* camera_nodes;
int res;
struct dc1394_frame_format *fmt;
struct dc1394_frame_rate *fps;
for (fmt = dc1394_frame_formats; fmt->width; fmt++)
if (fmt->pix_fmt == ap->pix_fmt && fmt->width == ap->width && fmt->height == ap->height)
break;
for (fps = dc1394_frame_rates; fps->frame_rate; fps++)
if (fps->frame_rate == av_rescale(1000, ap->time_base.den, ap->time_base.num))
break;
/* create a video stream */
vst = av_new_stream(c, 0);
if (!vst)
return -1;
av_set_pts_info(vst, 64, 1, 1000);
vst->codec->codec_type = CODEC_TYPE_VIDEO;
vst->codec->codec_id = CODEC_ID_RAWVIDEO;
vst->codec->time_base.den = fps->frame_rate;
vst->codec->time_base.num = 1000;
vst->codec->width = fmt->width;
vst->codec->height = fmt->height;
vst->codec->pix_fmt = fmt->pix_fmt;
/* packet init */
av_init_packet(&dc1394->packet);
dc1394->packet.size = avpicture_get_size(fmt->pix_fmt, fmt->width, fmt->height);
dc1394->packet.stream_index = vst->index;
dc1394->packet.flags |= PKT_FLAG_KEY;
dc1394->current_frame = 0;
dc1394->fps = fps->frame_rate;
vst->codec->bit_rate = av_rescale(dc1394->packet.size * 8, fps->frame_rate, 1000);
/* Now lets prep the hardware */
dc1394->handle = dc1394_create_handle(0); /* FIXME: gotta have ap->port */
if (!dc1394->handle) {
av_log(c, AV_LOG_ERROR, "Can't acquire dc1394 handle on port %d\n", 0 /* ap->port */);
goto out;
}
camera_nodes = dc1394_get_camera_nodes(dc1394->handle, &res, 1);
if (!camera_nodes || camera_nodes[ap->channel] == DC1394_NO_CAMERA) {
av_log(c, AV_LOG_ERROR, "There's no IIDC camera on the channel %d\n", ap->channel);
goto out_handle;
}
res = dc1394_dma_setup_capture(dc1394->handle, camera_nodes[ap->channel],
0,
FORMAT_VGA_NONCOMPRESSED,
fmt->frame_size_id,
SPEED_400,
fps->frame_rate_id, 8, 1,
c->filename,
&dc1394->camera);
dc1394_free_camera_nodes(camera_nodes);
if (res != DC1394_SUCCESS) {
av_log(c, AV_LOG_ERROR, "Can't prepare camera for the DMA capture\n");
goto out_handle;
}
res = dc1394_start_iso_transmission(dc1394->handle, dc1394->camera.node);
if (res != DC1394_SUCCESS) {
av_log(c, AV_LOG_ERROR, "Can't start isochronous transmission\n");
goto out_handle_dma;
}
return 0;
out_handle_dma:
dc1394_dma_unlisten(dc1394->handle, &dc1394->camera);
dc1394_dma_release_camera(dc1394->handle, &dc1394->camera);
out_handle:
dc1394_destroy_handle(dc1394->handle);
out:
return -1;
}
| true |
FFmpeg
|
43d1a1c05a51dfa340c95319be2608df98e6c3f4
|
static int dc1394_read_header(AVFormatContext *c, AVFormatParameters * ap)
{
dc1394_data* dc1394 = c->priv_data;
AVStream* vst;
nodeid_t* camera_nodes;
int res;
struct dc1394_frame_format *fmt;
struct dc1394_frame_rate *fps;
for (fmt = dc1394_frame_formats; fmt->width; fmt++)
if (fmt->pix_fmt == ap->pix_fmt && fmt->width == ap->width && fmt->height == ap->height)
break;
for (fps = dc1394_frame_rates; fps->frame_rate; fps++)
if (fps->frame_rate == av_rescale(1000, ap->time_base.den, ap->time_base.num))
break;
vst = av_new_stream(c, 0);
if (!vst)
return -1;
av_set_pts_info(vst, 64, 1, 1000);
vst->codec->codec_type = CODEC_TYPE_VIDEO;
vst->codec->codec_id = CODEC_ID_RAWVIDEO;
vst->codec->time_base.den = fps->frame_rate;
vst->codec->time_base.num = 1000;
vst->codec->width = fmt->width;
vst->codec->height = fmt->height;
vst->codec->pix_fmt = fmt->pix_fmt;
av_init_packet(&dc1394->packet);
dc1394->packet.size = avpicture_get_size(fmt->pix_fmt, fmt->width, fmt->height);
dc1394->packet.stream_index = vst->index;
dc1394->packet.flags |= PKT_FLAG_KEY;
dc1394->current_frame = 0;
dc1394->fps = fps->frame_rate;
vst->codec->bit_rate = av_rescale(dc1394->packet.size * 8, fps->frame_rate, 1000);
dc1394->handle = dc1394_create_handle(0);
if (!dc1394->handle) {
av_log(c, AV_LOG_ERROR, "Can't acquire dc1394 handle on port %d\n", 0 );
goto out;
}
camera_nodes = dc1394_get_camera_nodes(dc1394->handle, &res, 1);
if (!camera_nodes || camera_nodes[ap->channel] == DC1394_NO_CAMERA) {
av_log(c, AV_LOG_ERROR, "There's no IIDC camera on the channel %d\n", ap->channel);
goto out_handle;
}
res = dc1394_dma_setup_capture(dc1394->handle, camera_nodes[ap->channel],
0,
FORMAT_VGA_NONCOMPRESSED,
fmt->frame_size_id,
SPEED_400,
fps->frame_rate_id, 8, 1,
c->filename,
&dc1394->camera);
dc1394_free_camera_nodes(camera_nodes);
if (res != DC1394_SUCCESS) {
av_log(c, AV_LOG_ERROR, "Can't prepare camera for the DMA capture\n");
goto out_handle;
}
res = dc1394_start_iso_transmission(dc1394->handle, dc1394->camera.node);
if (res != DC1394_SUCCESS) {
av_log(c, AV_LOG_ERROR, "Can't start isochronous transmission\n");
goto out_handle_dma;
}
return 0;
out_handle_dma:
dc1394_dma_unlisten(dc1394->handle, &dc1394->camera);
dc1394_dma_release_camera(dc1394->handle, &dc1394->camera);
out_handle:
dc1394_destroy_handle(dc1394->handle);
out:
return -1;
}
|
{
"code": [
" if (fmt->pix_fmt == ap->pix_fmt && fmt->width == ap->width && fmt->height == ap->height)",
" if (fps->frame_rate == av_rescale(1000, ap->time_base.den, ap->time_base.num))"
],
"line_no": [
21,
29
]
}
|
static int FUNC_0(AVFormatContext *VAR_0, AVFormatParameters * VAR_1)
{
dc1394_data* dc1394 = VAR_0->priv_data;
AVStream* vst;
nodeid_t* camera_nodes;
int VAR_2;
struct dc1394_frame_format *VAR_3;
struct dc1394_frame_rate *VAR_4;
for (VAR_3 = dc1394_frame_formats; VAR_3->width; VAR_3++)
if (VAR_3->pix_fmt == VAR_1->pix_fmt && VAR_3->width == VAR_1->width && VAR_3->height == VAR_1->height)
break;
for (VAR_4 = dc1394_frame_rates; VAR_4->frame_rate; VAR_4++)
if (VAR_4->frame_rate == av_rescale(1000, VAR_1->time_base.den, VAR_1->time_base.num))
break;
vst = av_new_stream(VAR_0, 0);
if (!vst)
return -1;
av_set_pts_info(vst, 64, 1, 1000);
vst->codec->codec_type = CODEC_TYPE_VIDEO;
vst->codec->codec_id = CODEC_ID_RAWVIDEO;
vst->codec->time_base.den = VAR_4->frame_rate;
vst->codec->time_base.num = 1000;
vst->codec->width = VAR_3->width;
vst->codec->height = VAR_3->height;
vst->codec->pix_fmt = VAR_3->pix_fmt;
av_init_packet(&dc1394->packet);
dc1394->packet.size = avpicture_get_size(VAR_3->pix_fmt, VAR_3->width, VAR_3->height);
dc1394->packet.stream_index = vst->index;
dc1394->packet.flags |= PKT_FLAG_KEY;
dc1394->current_frame = 0;
dc1394->VAR_4 = VAR_4->frame_rate;
vst->codec->bit_rate = av_rescale(dc1394->packet.size * 8, VAR_4->frame_rate, 1000);
dc1394->handle = dc1394_create_handle(0);
if (!dc1394->handle) {
av_log(VAR_0, AV_LOG_ERROR, "Can't acquire dc1394 handle on port %d\n", 0 );
goto out;
}
camera_nodes = dc1394_get_camera_nodes(dc1394->handle, &VAR_2, 1);
if (!camera_nodes || camera_nodes[VAR_1->channel] == DC1394_NO_CAMERA) {
av_log(VAR_0, AV_LOG_ERROR, "There's no IIDC camera on the channel %d\n", VAR_1->channel);
goto out_handle;
}
VAR_2 = dc1394_dma_setup_capture(dc1394->handle, camera_nodes[VAR_1->channel],
0,
FORMAT_VGA_NONCOMPRESSED,
VAR_3->frame_size_id,
SPEED_400,
VAR_4->frame_rate_id, 8, 1,
VAR_0->filename,
&dc1394->camera);
dc1394_free_camera_nodes(camera_nodes);
if (VAR_2 != DC1394_SUCCESS) {
av_log(VAR_0, AV_LOG_ERROR, "Can't prepare camera for the DMA capture\n");
goto out_handle;
}
VAR_2 = dc1394_start_iso_transmission(dc1394->handle, dc1394->camera.node);
if (VAR_2 != DC1394_SUCCESS) {
av_log(VAR_0, AV_LOG_ERROR, "Can't start isochronous transmission\n");
goto out_handle_dma;
}
return 0;
out_handle_dma:
dc1394_dma_unlisten(dc1394->handle, &dc1394->camera);
dc1394_dma_release_camera(dc1394->handle, &dc1394->camera);
out_handle:
dc1394_destroy_handle(dc1394->handle);
out:
return -1;
}
|
[
"static int FUNC_0(AVFormatContext *VAR_0, AVFormatParameters * VAR_1)\n{",
"dc1394_data* dc1394 = VAR_0->priv_data;",
"AVStream* vst;",
"nodeid_t* camera_nodes;",
"int VAR_2;",
"struct dc1394_frame_format *VAR_3;",
"struct dc1394_frame_rate *VAR_4;",
"for (VAR_3 = dc1394_frame_formats; VAR_3->width; VAR_3++)",
"if (VAR_3->pix_fmt == VAR_1->pix_fmt && VAR_3->width == VAR_1->width && VAR_3->height == VAR_1->height)\nbreak;",
"for (VAR_4 = dc1394_frame_rates; VAR_4->frame_rate; VAR_4++)",
"if (VAR_4->frame_rate == av_rescale(1000, VAR_1->time_base.den, VAR_1->time_base.num))\nbreak;",
"vst = av_new_stream(VAR_0, 0);",
"if (!vst)\nreturn -1;",
"av_set_pts_info(vst, 64, 1, 1000);",
"vst->codec->codec_type = CODEC_TYPE_VIDEO;",
"vst->codec->codec_id = CODEC_ID_RAWVIDEO;",
"vst->codec->time_base.den = VAR_4->frame_rate;",
"vst->codec->time_base.num = 1000;",
"vst->codec->width = VAR_3->width;",
"vst->codec->height = VAR_3->height;",
"vst->codec->pix_fmt = VAR_3->pix_fmt;",
"av_init_packet(&dc1394->packet);",
"dc1394->packet.size = avpicture_get_size(VAR_3->pix_fmt, VAR_3->width, VAR_3->height);",
"dc1394->packet.stream_index = vst->index;",
"dc1394->packet.flags |= PKT_FLAG_KEY;",
"dc1394->current_frame = 0;",
"dc1394->VAR_4 = VAR_4->frame_rate;",
"vst->codec->bit_rate = av_rescale(dc1394->packet.size * 8, VAR_4->frame_rate, 1000);",
"dc1394->handle = dc1394_create_handle(0);",
"if (!dc1394->handle) {",
"av_log(VAR_0, AV_LOG_ERROR, \"Can't acquire dc1394 handle on port %d\\n\", 0 );",
"goto out;",
"}",
"camera_nodes = dc1394_get_camera_nodes(dc1394->handle, &VAR_2, 1);",
"if (!camera_nodes || camera_nodes[VAR_1->channel] == DC1394_NO_CAMERA) {",
"av_log(VAR_0, AV_LOG_ERROR, \"There's no IIDC camera on the channel %d\\n\", VAR_1->channel);",
"goto out_handle;",
"}",
"VAR_2 = dc1394_dma_setup_capture(dc1394->handle, camera_nodes[VAR_1->channel],\n0,\nFORMAT_VGA_NONCOMPRESSED,\nVAR_3->frame_size_id,\nSPEED_400,\nVAR_4->frame_rate_id, 8, 1,\nVAR_0->filename,\n&dc1394->camera);",
"dc1394_free_camera_nodes(camera_nodes);",
"if (VAR_2 != DC1394_SUCCESS) {",
"av_log(VAR_0, AV_LOG_ERROR, \"Can't prepare camera for the DMA capture\\n\");",
"goto out_handle;",
"}",
"VAR_2 = dc1394_start_iso_transmission(dc1394->handle, dc1394->camera.node);",
"if (VAR_2 != DC1394_SUCCESS) {",
"av_log(VAR_0, AV_LOG_ERROR, \"Can't start isochronous transmission\\n\");",
"goto out_handle_dma;",
"}",
"return 0;",
"out_handle_dma:\ndc1394_dma_unlisten(dc1394->handle, &dc1394->camera);",
"dc1394_dma_release_camera(dc1394->handle, &dc1394->camera);",
"out_handle:\ndc1394_destroy_handle(dc1394->handle);",
"out:\nreturn -1;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21,
23
],
[
27
],
[
29,
31
],
[
37
],
[
39,
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
63
],
[
65
],
[
67
],
[
69
],
[
73
],
[
75
],
[
79
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105,
107,
109,
111,
113,
115,
117,
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
145
],
[
149,
151
],
[
153
],
[
155,
157
],
[
159,
161
],
[
163
]
] |
7,262 |
static void bdrv_aio_bh_cb(void *opaque)
{
BlockDriverAIOCBSync *acb = opaque;
if (!acb->is_write)
qemu_iovec_from_buf(acb->qiov, 0, acb->bounce, acb->qiov->size);
qemu_vfree(acb->bounce);
acb->common.cb(acb->common.opaque, acb->ret);
qemu_bh_delete(acb->bh);
acb->bh = NULL;
qemu_aio_release(acb);
}
| true |
qemu
|
857d4f46c31d2f4d57d2f0fad9dfb584262bf9b9
|
static void bdrv_aio_bh_cb(void *opaque)
{
BlockDriverAIOCBSync *acb = opaque;
if (!acb->is_write)
qemu_iovec_from_buf(acb->qiov, 0, acb->bounce, acb->qiov->size);
qemu_vfree(acb->bounce);
acb->common.cb(acb->common.opaque, acb->ret);
qemu_bh_delete(acb->bh);
acb->bh = NULL;
qemu_aio_release(acb);
}
|
{
"code": [
" if (!acb->is_write)"
],
"line_no": [
9
]
}
|
static void FUNC_0(void *VAR_0)
{
BlockDriverAIOCBSync *acb = VAR_0;
if (!acb->is_write)
qemu_iovec_from_buf(acb->qiov, 0, acb->bounce, acb->qiov->size);
qemu_vfree(acb->bounce);
acb->common.cb(acb->common.VAR_0, acb->ret);
qemu_bh_delete(acb->bh);
acb->bh = NULL;
qemu_aio_release(acb);
}
|
[
"static void FUNC_0(void *VAR_0)\n{",
"BlockDriverAIOCBSync *acb = VAR_0;",
"if (!acb->is_write)\nqemu_iovec_from_buf(acb->qiov, 0, acb->bounce, acb->qiov->size);",
"qemu_vfree(acb->bounce);",
"acb->common.cb(acb->common.VAR_0, acb->ret);",
"qemu_bh_delete(acb->bh);",
"acb->bh = NULL;",
"qemu_aio_release(acb);",
"}"
] |
[
0,
0,
1,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
9,
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
]
] |
7,264 |
static int send_sub_rect_jpeg(VncState *vs, int x, int y, int w, int h,
int bg, int fg, int colors,
VncPalette *palette)
{
int ret;
if (colors == 0) {
if (tight_detect_smooth_image(vs, w, h)) {
int quality = tight_conf[vs->tight.quality].jpeg_quality;
ret = send_jpeg_rect(vs, x, y, w, h, quality);
ret = send_full_color_rect(vs, x, y, w, h);
}
} else if (colors == 1) {
ret = send_solid_rect(vs);
} else if (colors == 2) {
ret = send_mono_rect(vs, x, y, w, h, bg, fg);
} else if (colors <= 256) {
if (colors > 96 &&
tight_detect_smooth_image(vs, w, h)) {
int quality = tight_conf[vs->tight.quality].jpeg_quality;
ret = send_jpeg_rect(vs, x, y, w, h, quality);
ret = send_palette_rect(vs, x, y, w, h, palette);
}
}
return ret;
}
| true |
qemu
|
ad7ee4ad6c3a5388acf94dd532d291ea6d3a5972
|
static int send_sub_rect_jpeg(VncState *vs, int x, int y, int w, int h,
int bg, int fg, int colors,
VncPalette *palette)
{
int ret;
if (colors == 0) {
if (tight_detect_smooth_image(vs, w, h)) {
int quality = tight_conf[vs->tight.quality].jpeg_quality;
ret = send_jpeg_rect(vs, x, y, w, h, quality);
ret = send_full_color_rect(vs, x, y, w, h);
}
} else if (colors == 1) {
ret = send_solid_rect(vs);
} else if (colors == 2) {
ret = send_mono_rect(vs, x, y, w, h, bg, fg);
} else if (colors <= 256) {
if (colors > 96 &&
tight_detect_smooth_image(vs, w, h)) {
int quality = tight_conf[vs->tight.quality].jpeg_quality;
ret = send_jpeg_rect(vs, x, y, w, h, quality);
ret = send_palette_rect(vs, x, y, w, h, palette);
}
}
return ret;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(VncState *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4,
int VAR_5, int VAR_6, int VAR_7,
VncPalette *VAR_8)
{
int VAR_9;
if (VAR_7 == 0) {
if (tight_detect_smooth_image(VAR_0, VAR_3, VAR_4)) {
int VAR_11 = tight_conf[VAR_0->tight.VAR_11].jpeg_quality;
VAR_9 = send_jpeg_rect(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_11);
VAR_9 = send_full_color_rect(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4);
}
} else if (VAR_7 == 1) {
VAR_9 = send_solid_rect(VAR_0);
} else if (VAR_7 == 2) {
VAR_9 = send_mono_rect(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6);
} else if (VAR_7 <= 256) {
if (VAR_7 > 96 &&
tight_detect_smooth_image(VAR_0, VAR_3, VAR_4)) {
int VAR_11 = tight_conf[VAR_0->tight.VAR_11].jpeg_quality;
VAR_9 = send_jpeg_rect(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_11);
VAR_9 = send_palette_rect(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_8);
}
}
return VAR_9;
}
|
[
"static int FUNC_0(VncState *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4,\nint VAR_5, int VAR_6, int VAR_7,\nVncPalette *VAR_8)\n{",
"int VAR_9;",
"if (VAR_7 == 0) {",
"if (tight_detect_smooth_image(VAR_0, VAR_3, VAR_4)) {",
"int VAR_11 = tight_conf[VAR_0->tight.VAR_11].jpeg_quality;",
"VAR_9 = send_jpeg_rect(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_11);",
"VAR_9 = send_full_color_rect(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4);",
"}",
"} else if (VAR_7 == 1) {",
"VAR_9 = send_solid_rect(VAR_0);",
"} else if (VAR_7 == 2) {",
"VAR_9 = send_mono_rect(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6);",
"} else if (VAR_7 <= 256) {",
"if (VAR_7 > 96 &&\ntight_detect_smooth_image(VAR_0, VAR_3, VAR_4)) {",
"int VAR_11 = tight_conf[VAR_0->tight.VAR_11].jpeg_quality;",
"VAR_9 = send_jpeg_rect(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_11);",
"VAR_9 = send_palette_rect(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_8);",
"}",
"}",
"return VAR_9;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5,
7
],
[
9
],
[
13
],
[
15
],
[
17
],
[
21
],
[
24
],
[
26
],
[
28
],
[
30
],
[
32
],
[
34
],
[
36
],
[
38,
40
],
[
42
],
[
46
],
[
49
],
[
51
],
[
55
],
[
57
],
[
59
]
] |
7,265 |
static uint64_t htonll(uint64_t v)
{
union { uint32_t lv[2]; uint64_t llv; } u;
u.lv[0] = htonl(v >> 32);
u.lv[1] = htonl(v & 0xFFFFFFFFULL);
return u.llv;
}
| true |
qemu
|
60fe637bf0e4d7989e21e50f52526444765c63b4
|
static uint64_t htonll(uint64_t v)
{
union { uint32_t lv[2]; uint64_t llv; } u;
u.lv[0] = htonl(v >> 32);
u.lv[1] = htonl(v & 0xFFFFFFFFULL);
return u.llv;
}
|
{
"code": [],
"line_no": []
}
|
static uint64_t FUNC_0(uint64_t v)
{
union { uint32_t lv[2]; uint64_t llv; } VAR_0;
VAR_0.lv[0] = htonl(v >> 32);
VAR_0.lv[1] = htonl(v & 0xFFFFFFFFULL);
return VAR_0.llv;
}
|
[
"static uint64_t FUNC_0(uint64_t v)\n{",
"union { uint32_t lv[2]; uint64_t llv; } VAR_0;",
"VAR_0.lv[0] = htonl(v >> 32);",
"VAR_0.lv[1] = htonl(v & 0xFFFFFFFFULL);",
"return VAR_0.llv;",
"}"
] |
[
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
]
] |
7,266 |
void op_addo (void)
{
target_ulong tmp;
tmp = T0;
T0 += T1;
if ((T0 >> 31) ^ (T1 >> 31) ^ (tmp >> 31)) {
CALL_FROM_TB1(do_raise_exception_direct, EXCP_OVERFLOW);
}
RETURN();
}
| true |
qemu
|
76e050c2e62995f1d6905e28674dea3a7fcff1a5
|
void op_addo (void)
{
target_ulong tmp;
tmp = T0;
T0 += T1;
if ((T0 >> 31) ^ (T1 >> 31) ^ (tmp >> 31)) {
CALL_FROM_TB1(do_raise_exception_direct, EXCP_OVERFLOW);
}
RETURN();
}
|
{
"code": [
" if ((T0 >> 31) ^ (T1 >> 31) ^ (tmp >> 31)) {"
],
"line_no": [
13
]
}
|
void FUNC_0 (void)
{
target_ulong tmp;
tmp = T0;
T0 += T1;
if ((T0 >> 31) ^ (T1 >> 31) ^ (tmp >> 31)) {
CALL_FROM_TB1(do_raise_exception_direct, EXCP_OVERFLOW);
}
RETURN();
}
|
[
"void FUNC_0 (void)\n{",
"target_ulong tmp;",
"tmp = T0;",
"T0 += T1;",
"if ((T0 >> 31) ^ (T1 >> 31) ^ (tmp >> 31)) {",
"CALL_FROM_TB1(do_raise_exception_direct, EXCP_OVERFLOW);",
"}",
"RETURN();",
"}"
] |
[
0,
0,
0,
0,
1,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
]
] |
7,268 |
static av_cold int adpcm_decode_init(AVCodecContext * avctx)
{
ADPCMDecodeContext *c = avctx->priv_data;
unsigned int max_channels = 2;
switch(avctx->codec->id) {
case CODEC_ID_ADPCM_EA_R1:
case CODEC_ID_ADPCM_EA_R2:
case CODEC_ID_ADPCM_EA_R3:
case CODEC_ID_ADPCM_EA_XAS:
max_channels = 6;
break;
}
if(avctx->channels > max_channels){
return -1;
}
switch(avctx->codec->id) {
case CODEC_ID_ADPCM_CT:
c->status[0].step = c->status[1].step = 511;
break;
case CODEC_ID_ADPCM_IMA_WAV:
if (avctx->bits_per_coded_sample != 4) {
av_log(avctx, AV_LOG_ERROR, "Only 4-bit ADPCM IMA WAV files are supported\n");
return -1;
}
break;
case CODEC_ID_ADPCM_IMA_WS:
if (avctx->extradata && avctx->extradata_size == 2 * 4) {
c->status[0].predictor = AV_RL32(avctx->extradata);
c->status[1].predictor = AV_RL32(avctx->extradata + 4);
}
break;
default:
break;
}
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
avcodec_get_frame_defaults(&c->frame);
avctx->coded_frame = &c->frame;
return 0;
}
| true |
FFmpeg
|
e614fac2e6e185a247d722d4e92368b3c3bc4bdb
|
static av_cold int adpcm_decode_init(AVCodecContext * avctx)
{
ADPCMDecodeContext *c = avctx->priv_data;
unsigned int max_channels = 2;
switch(avctx->codec->id) {
case CODEC_ID_ADPCM_EA_R1:
case CODEC_ID_ADPCM_EA_R2:
case CODEC_ID_ADPCM_EA_R3:
case CODEC_ID_ADPCM_EA_XAS:
max_channels = 6;
break;
}
if(avctx->channels > max_channels){
return -1;
}
switch(avctx->codec->id) {
case CODEC_ID_ADPCM_CT:
c->status[0].step = c->status[1].step = 511;
break;
case CODEC_ID_ADPCM_IMA_WAV:
if (avctx->bits_per_coded_sample != 4) {
av_log(avctx, AV_LOG_ERROR, "Only 4-bit ADPCM IMA WAV files are supported\n");
return -1;
}
break;
case CODEC_ID_ADPCM_IMA_WS:
if (avctx->extradata && avctx->extradata_size == 2 * 4) {
c->status[0].predictor = AV_RL32(avctx->extradata);
c->status[1].predictor = AV_RL32(avctx->extradata + 4);
}
break;
default:
break;
}
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
avcodec_get_frame_defaults(&c->frame);
avctx->coded_frame = &c->frame;
return 0;
}
|
{
"code": [
" if(avctx->channels > max_channels){",
" return -1;"
],
"line_no": [
27,
29
]
}
|
static av_cold int FUNC_0(AVCodecContext * avctx)
{
ADPCMDecodeContext *c = avctx->priv_data;
unsigned int VAR_0 = 2;
switch(avctx->codec->id) {
case CODEC_ID_ADPCM_EA_R1:
case CODEC_ID_ADPCM_EA_R2:
case CODEC_ID_ADPCM_EA_R3:
case CODEC_ID_ADPCM_EA_XAS:
VAR_0 = 6;
break;
}
if(avctx->channels > VAR_0){
return -1;
}
switch(avctx->codec->id) {
case CODEC_ID_ADPCM_CT:
c->status[0].step = c->status[1].step = 511;
break;
case CODEC_ID_ADPCM_IMA_WAV:
if (avctx->bits_per_coded_sample != 4) {
av_log(avctx, AV_LOG_ERROR, "Only 4-bit ADPCM IMA WAV files are supported\n");
return -1;
}
break;
case CODEC_ID_ADPCM_IMA_WS:
if (avctx->extradata && avctx->extradata_size == 2 * 4) {
c->status[0].predictor = AV_RL32(avctx->extradata);
c->status[1].predictor = AV_RL32(avctx->extradata + 4);
}
break;
default:
break;
}
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
avcodec_get_frame_defaults(&c->frame);
avctx->coded_frame = &c->frame;
return 0;
}
|
[
"static av_cold int FUNC_0(AVCodecContext * avctx)\n{",
"ADPCMDecodeContext *c = avctx->priv_data;",
"unsigned int VAR_0 = 2;",
"switch(avctx->codec->id) {",
"case CODEC_ID_ADPCM_EA_R1:\ncase CODEC_ID_ADPCM_EA_R2:\ncase CODEC_ID_ADPCM_EA_R3:\ncase CODEC_ID_ADPCM_EA_XAS:\nVAR_0 = 6;",
"break;",
"}",
"if(avctx->channels > VAR_0){",
"return -1;",
"}",
"switch(avctx->codec->id) {",
"case CODEC_ID_ADPCM_CT:\nc->status[0].step = c->status[1].step = 511;",
"break;",
"case CODEC_ID_ADPCM_IMA_WAV:\nif (avctx->bits_per_coded_sample != 4) {",
"av_log(avctx, AV_LOG_ERROR, \"Only 4-bit ADPCM IMA WAV files are supported\\n\");",
"return -1;",
"}",
"break;",
"case CODEC_ID_ADPCM_IMA_WS:\nif (avctx->extradata && avctx->extradata_size == 2 * 4) {",
"c->status[0].predictor = AV_RL32(avctx->extradata);",
"c->status[1].predictor = AV_RL32(avctx->extradata + 4);",
"}",
"break;",
"default:\nbreak;",
"}",
"avctx->sample_fmt = AV_SAMPLE_FMT_S16;",
"avcodec_get_frame_defaults(&c->frame);",
"avctx->coded_frame = &c->frame;",
"return 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,
3
],
[
5
],
[
7
],
[
11
],
[
13,
15,
17,
19,
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
35
],
[
37,
39
],
[
41
],
[
43,
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55,
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67,
69
],
[
71
],
[
73
],
[
77
],
[
79
],
[
83
],
[
85
]
] |
7,270 |
static void test_qemu_strtol_max(void)
{
const char *str = g_strdup_printf("%ld", LONG_MAX);
char f = 'X';
const char *endptr = &f;
long res = 999;
int err;
err = qemu_strtol(str, &endptr, 0, &res);
g_assert_cmpint(err, ==, 0);
g_assert_cmpint(res, ==, LONG_MAX);
g_assert(endptr == str + strlen(str));
}
| true |
qemu
|
d6f723b513a0c3c4e58343b7c52a2f9850861fa0
|
static void test_qemu_strtol_max(void)
{
const char *str = g_strdup_printf("%ld", LONG_MAX);
char f = 'X';
const char *endptr = &f;
long res = 999;
int err;
err = qemu_strtol(str, &endptr, 0, &res);
g_assert_cmpint(err, ==, 0);
g_assert_cmpint(res, ==, LONG_MAX);
g_assert(endptr == str + strlen(str));
}
|
{
"code": [
" const char *str = g_strdup_printf(\"%ld\", LONG_MAX);",
" const char *str = g_strdup_printf(\"%ld\", LONG_MAX);"
],
"line_no": [
5,
5
]
}
|
static void FUNC_0(void)
{
const char *VAR_0 = g_strdup_printf("%ld", LONG_MAX);
char VAR_1 = 'X';
const char *VAR_2 = &VAR_1;
long VAR_3 = 999;
int VAR_4;
VAR_4 = qemu_strtol(VAR_0, &VAR_2, 0, &VAR_3);
g_assert_cmpint(VAR_4, ==, 0);
g_assert_cmpint(VAR_3, ==, LONG_MAX);
g_assert(VAR_2 == VAR_0 + strlen(VAR_0));
}
|
[
"static void FUNC_0(void)\n{",
"const char *VAR_0 = g_strdup_printf(\"%ld\", LONG_MAX);",
"char VAR_1 = 'X';",
"const char *VAR_2 = &VAR_1;",
"long VAR_3 = 999;",
"int VAR_4;",
"VAR_4 = qemu_strtol(VAR_0, &VAR_2, 0, &VAR_3);",
"g_assert_cmpint(VAR_4, ==, 0);",
"g_assert_cmpint(VAR_3, ==, LONG_MAX);",
"g_assert(VAR_2 == VAR_0 + strlen(VAR_0));",
"}"
] |
[
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
21
],
[
23
],
[
25
],
[
27
]
] |
7,271 |
static int build_vlc(AVCodecContext *avctx, VLC *vlc, const uint32_t *table)
{
Node nodes[512];
uint32_t bits[256];
int16_t lens[256];
uint8_t xlat[256];
int cur_node, i, j, pos = 0;
ff_free_vlc(vlc);
for (i = 0; i < 256; i++) {
nodes[i].count = table[i];
nodes[i].sym = i;
nodes[i].n0 = -2;
nodes[i].l = i;
nodes[i].r = i;
}
cur_node = 256;
j = 0;
do {
for (i = 0; ; i++) {
int new_node = j;
int first_node = cur_node;
int second_node = cur_node;
int nd, st;
nodes[cur_node].count = -1;
do {
int val = nodes[new_node].count;
if (val && (val < nodes[first_node].count)) {
if (val >= nodes[second_node].count) {
first_node = new_node;
} else {
first_node = second_node;
second_node = new_node;
}
}
new_node += 1;
} while (new_node != cur_node);
if (first_node == cur_node)
break;
nd = nodes[second_node].count;
st = nodes[first_node].count;
nodes[second_node].count = 0;
nodes[first_node].count = 0;
nodes[cur_node].count = nd + st;
nodes[cur_node].sym = -1;
nodes[cur_node].n0 = cur_node;
nodes[cur_node].l = first_node;
nodes[cur_node].r = second_node;
cur_node++;
}
j++;
} while (cur_node - 256 == j);
get_tree_codes(bits, lens, xlat, nodes, cur_node - 1, 0, 0, &pos);
return ff_init_vlc_sparse(vlc, 10, pos, lens, 2, 2, bits, 4, 4, xlat, 1, 1, 0);
}
| true |
FFmpeg
|
67b30decf7793523f7fdaef6fdf7f1179ef42b18
|
static int build_vlc(AVCodecContext *avctx, VLC *vlc, const uint32_t *table)
{
Node nodes[512];
uint32_t bits[256];
int16_t lens[256];
uint8_t xlat[256];
int cur_node, i, j, pos = 0;
ff_free_vlc(vlc);
for (i = 0; i < 256; i++) {
nodes[i].count = table[i];
nodes[i].sym = i;
nodes[i].n0 = -2;
nodes[i].l = i;
nodes[i].r = i;
}
cur_node = 256;
j = 0;
do {
for (i = 0; ; i++) {
int new_node = j;
int first_node = cur_node;
int second_node = cur_node;
int nd, st;
nodes[cur_node].count = -1;
do {
int val = nodes[new_node].count;
if (val && (val < nodes[first_node].count)) {
if (val >= nodes[second_node].count) {
first_node = new_node;
} else {
first_node = second_node;
second_node = new_node;
}
}
new_node += 1;
} while (new_node != cur_node);
if (first_node == cur_node)
break;
nd = nodes[second_node].count;
st = nodes[first_node].count;
nodes[second_node].count = 0;
nodes[first_node].count = 0;
nodes[cur_node].count = nd + st;
nodes[cur_node].sym = -1;
nodes[cur_node].n0 = cur_node;
nodes[cur_node].l = first_node;
nodes[cur_node].r = second_node;
cur_node++;
}
j++;
} while (cur_node - 256 == j);
get_tree_codes(bits, lens, xlat, nodes, cur_node - 1, 0, 0, &pos);
return ff_init_vlc_sparse(vlc, 10, pos, lens, 2, 2, bits, 4, 4, xlat, 1, 1, 0);
}
|
{
"code": [
" int nd, st;"
],
"line_no": [
51
]
}
|
static int FUNC_0(AVCodecContext *VAR_0, VLC *VAR_1, const uint32_t *VAR_2)
{
Node nodes[512];
uint32_t bits[256];
int16_t lens[256];
uint8_t xlat[256];
int VAR_3, VAR_4, VAR_5, VAR_6 = 0;
ff_free_vlc(VAR_1);
for (VAR_4 = 0; VAR_4 < 256; VAR_4++) {
nodes[VAR_4].count = VAR_2[VAR_4];
nodes[VAR_4].sym = VAR_4;
nodes[VAR_4].n0 = -2;
nodes[VAR_4].l = VAR_4;
nodes[VAR_4].r = VAR_4;
}
VAR_3 = 256;
VAR_5 = 0;
do {
for (VAR_4 = 0; ; VAR_4++) {
int VAR_7 = VAR_5;
int VAR_8 = VAR_3;
int VAR_9 = VAR_3;
int VAR_10, VAR_11;
nodes[VAR_3].count = -1;
do {
int VAR_12 = nodes[VAR_7].count;
if (VAR_12 && (VAR_12 < nodes[VAR_8].count)) {
if (VAR_12 >= nodes[VAR_9].count) {
VAR_8 = VAR_7;
} else {
VAR_8 = VAR_9;
VAR_9 = VAR_7;
}
}
VAR_7 += 1;
} while (VAR_7 != VAR_3);
if (VAR_8 == VAR_3)
break;
VAR_10 = nodes[VAR_9].count;
VAR_11 = nodes[VAR_8].count;
nodes[VAR_9].count = 0;
nodes[VAR_8].count = 0;
nodes[VAR_3].count = VAR_10 + VAR_11;
nodes[VAR_3].sym = -1;
nodes[VAR_3].n0 = VAR_3;
nodes[VAR_3].l = VAR_8;
nodes[VAR_3].r = VAR_9;
VAR_3++;
}
VAR_5++;
} while (VAR_3 - 256 == VAR_5);
get_tree_codes(bits, lens, xlat, nodes, VAR_3 - 1, 0, 0, &VAR_6);
return ff_init_vlc_sparse(VAR_1, 10, VAR_6, lens, 2, 2, bits, 4, 4, xlat, 1, 1, 0);
}
|
[
"static int FUNC_0(AVCodecContext *VAR_0, VLC *VAR_1, const uint32_t *VAR_2)\n{",
"Node nodes[512];",
"uint32_t bits[256];",
"int16_t lens[256];",
"uint8_t xlat[256];",
"int VAR_3, VAR_4, VAR_5, VAR_6 = 0;",
"ff_free_vlc(VAR_1);",
"for (VAR_4 = 0; VAR_4 < 256; VAR_4++) {",
"nodes[VAR_4].count = VAR_2[VAR_4];",
"nodes[VAR_4].sym = VAR_4;",
"nodes[VAR_4].n0 = -2;",
"nodes[VAR_4].l = VAR_4;",
"nodes[VAR_4].r = VAR_4;",
"}",
"VAR_3 = 256;",
"VAR_5 = 0;",
"do {",
"for (VAR_4 = 0; ; VAR_4++) {",
"int VAR_7 = VAR_5;",
"int VAR_8 = VAR_3;",
"int VAR_9 = VAR_3;",
"int VAR_10, VAR_11;",
"nodes[VAR_3].count = -1;",
"do {",
"int VAR_12 = nodes[VAR_7].count;",
"if (VAR_12 && (VAR_12 < nodes[VAR_8].count)) {",
"if (VAR_12 >= nodes[VAR_9].count) {",
"VAR_8 = VAR_7;",
"} else {",
"VAR_8 = VAR_9;",
"VAR_9 = VAR_7;",
"}",
"}",
"VAR_7 += 1;",
"} while (VAR_7 != VAR_3);",
"if (VAR_8 == VAR_3)\nbreak;",
"VAR_10 = nodes[VAR_9].count;",
"VAR_11 = nodes[VAR_8].count;",
"nodes[VAR_9].count = 0;",
"nodes[VAR_8].count = 0;",
"nodes[VAR_3].count = VAR_10 + VAR_11;",
"nodes[VAR_3].sym = -1;",
"nodes[VAR_3].n0 = VAR_3;",
"nodes[VAR_3].l = VAR_8;",
"nodes[VAR_3].r = VAR_9;",
"VAR_3++;",
"}",
"VAR_5++;",
"} while (VAR_3 - 256 == VAR_5);",
"get_tree_codes(bits, lens, xlat, nodes, VAR_3 - 1, 0, 0, &VAR_6);",
"return ff_init_vlc_sparse(VAR_1, 10, VAR_6, lens, 2, 2, bits, 4, 4, xlat, 1, 1, 0);",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
55
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
85,
87
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
119
],
[
123
],
[
125
]
] |
7,272 |
static inline void dv_guess_qnos(EncBlockInfo* blks, int* qnos)
{
int size[5];
int i, j, k, a, prev, a2;
EncBlockInfo* b;
size[0] = size[1] = size[2] = size[3] = size[4] = 1<<24;
do {
b = blks;
for (i=0; i<5; i++) {
if (!qnos[i])
continue;
qnos[i]--;
size[i] = 0;
for (j=0; j<6; j++, b++) {
for (a=0; a<4; a++) {
if (b->area_q[a] != dv_quant_shifts[qnos[i] + dv_quant_offset[b->cno]][a]) {
b->bit_size[a] = 1; // 4 areas 4 bits for EOB :)
b->area_q[a]++;
prev= b->prev[a];
for (k= b->next[prev] ; k<mb_area_start[a+1]; k= b->next[k]) {
b->mb[k] >>= 1;
if (b->mb[k]) {
b->bit_size[a] += dv_rl2vlc_size(k - prev - 1, b->mb[k]);
prev= k;
} else {
if(b->next[k] >= mb_area_start[a+1] && b->next[k]<64){
for(a2=a+1; b->next[k] >= mb_area_start[a2+1]; a2++)
b->prev[a2] = prev;
assert(a2<4);
assert(b->mb[b->next[k]]);
b->bit_size[a2] += dv_rl2vlc_size(b->next[k] - prev - 1, b->mb[b->next[k]])
-dv_rl2vlc_size(b->next[k] - k - 1, b->mb[b->next[k]]);
for(; (b->prev[a2]==k) && (a2<4); a2++)
b->prev[a2] = prev;
}
b->next[prev] = b->next[k];
}
}
b->prev[a+1]= prev;
}
size[i] += b->bit_size[a];
}
}
if(vs_total_ac_bits >= size[0] + size[1] + size[2] + size[3] + size[4])
return;
}
} while (qnos[0]|qnos[1]|qnos[2]|qnos[3]|qnos[4]);
for(a=2; a==2 || vs_total_ac_bits < size[0]; a+=a){
b = blks;
size[0] = 5*6*4; //EOB
for (j=0; j<6*5; j++, b++) {
prev= b->prev[0];
for (k= b->next[prev]; k<64; k= b->next[k]) {
if(b->mb[k] < a && b->mb[k] > -a){
b->next[prev] = b->next[k];
}else{
size[0] += dv_rl2vlc_size(k - prev - 1, b->mb[k]);
prev= k;
}
}
}
}
}
| false |
FFmpeg
|
d676478c8d29a48f67526afef44c323b74946488
|
static inline void dv_guess_qnos(EncBlockInfo* blks, int* qnos)
{
int size[5];
int i, j, k, a, prev, a2;
EncBlockInfo* b;
size[0] = size[1] = size[2] = size[3] = size[4] = 1<<24;
do {
b = blks;
for (i=0; i<5; i++) {
if (!qnos[i])
continue;
qnos[i]--;
size[i] = 0;
for (j=0; j<6; j++, b++) {
for (a=0; a<4; a++) {
if (b->area_q[a] != dv_quant_shifts[qnos[i] + dv_quant_offset[b->cno]][a]) {
b->bit_size[a] = 1;
b->area_q[a]++;
prev= b->prev[a];
for (k= b->next[prev] ; k<mb_area_start[a+1]; k= b->next[k]) {
b->mb[k] >>= 1;
if (b->mb[k]) {
b->bit_size[a] += dv_rl2vlc_size(k - prev - 1, b->mb[k]);
prev= k;
} else {
if(b->next[k] >= mb_area_start[a+1] && b->next[k]<64){
for(a2=a+1; b->next[k] >= mb_area_start[a2+1]; a2++)
b->prev[a2] = prev;
assert(a2<4);
assert(b->mb[b->next[k]]);
b->bit_size[a2] += dv_rl2vlc_size(b->next[k] - prev - 1, b->mb[b->next[k]])
-dv_rl2vlc_size(b->next[k] - k - 1, b->mb[b->next[k]]);
for(; (b->prev[a2]==k) && (a2<4); a2++)
b->prev[a2] = prev;
}
b->next[prev] = b->next[k];
}
}
b->prev[a+1]= prev;
}
size[i] += b->bit_size[a];
}
}
if(vs_total_ac_bits >= size[0] + size[1] + size[2] + size[3] + size[4])
return;
}
} while (qnos[0]|qnos[1]|qnos[2]|qnos[3]|qnos[4]);
for(a=2; a==2 || vs_total_ac_bits < size[0]; a+=a){
b = blks;
size[0] = 5*6*4;
for (j=0; j<6*5; j++, b++) {
prev= b->prev[0];
for (k= b->next[prev]; k<64; k= b->next[k]) {
if(b->mb[k] < a && b->mb[k] > -a){
b->next[prev] = b->next[k];
}else{
size[0] += dv_rl2vlc_size(k - prev - 1, b->mb[k]);
prev= k;
}
}
}
}
}
|
{
"code": [],
"line_no": []
}
|
static inline void FUNC_0(EncBlockInfo* VAR_0, int* VAR_1)
{
int VAR_2[5];
int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8;
EncBlockInfo* b;
VAR_2[0] = VAR_2[1] = VAR_2[2] = VAR_2[3] = VAR_2[4] = 1<<24;
do {
b = VAR_0;
for (VAR_3=0; VAR_3<5; VAR_3++) {
if (!VAR_1[VAR_3])
continue;
VAR_1[VAR_3]--;
VAR_2[VAR_3] = 0;
for (VAR_4=0; VAR_4<6; VAR_4++, b++) {
for (VAR_6=0; VAR_6<4; VAR_6++) {
if (b->area_q[VAR_6] != dv_quant_shifts[VAR_1[VAR_3] + dv_quant_offset[b->cno]][VAR_6]) {
b->bit_size[VAR_6] = 1;
b->area_q[VAR_6]++;
VAR_7= b->VAR_7[VAR_6];
for (VAR_5= b->next[VAR_7] ; VAR_5<mb_area_start[VAR_6+1]; VAR_5= b->next[VAR_5]) {
b->mb[VAR_5] >>= 1;
if (b->mb[VAR_5]) {
b->bit_size[VAR_6] += dv_rl2vlc_size(VAR_5 - VAR_7 - 1, b->mb[VAR_5]);
VAR_7= VAR_5;
} else {
if(b->next[VAR_5] >= mb_area_start[VAR_6+1] && b->next[VAR_5]<64){
for(VAR_8=VAR_6+1; b->next[VAR_5] >= mb_area_start[VAR_8+1]; VAR_8++)
b->VAR_7[VAR_8] = VAR_7;
assert(VAR_8<4);
assert(b->mb[b->next[VAR_5]]);
b->bit_size[VAR_8] += dv_rl2vlc_size(b->next[VAR_5] - VAR_7 - 1, b->mb[b->next[VAR_5]])
-dv_rl2vlc_size(b->next[VAR_5] - VAR_5 - 1, b->mb[b->next[VAR_5]]);
for(; (b->VAR_7[VAR_8]==VAR_5) && (VAR_8<4); VAR_8++)
b->VAR_7[VAR_8] = VAR_7;
}
b->next[VAR_7] = b->next[VAR_5];
}
}
b->VAR_7[VAR_6+1]= VAR_7;
}
VAR_2[VAR_3] += b->bit_size[VAR_6];
}
}
if(vs_total_ac_bits >= VAR_2[0] + VAR_2[1] + VAR_2[2] + VAR_2[3] + VAR_2[4])
return;
}
} while (VAR_1[0]|VAR_1[1]|VAR_1[2]|VAR_1[3]|VAR_1[4]);
for(VAR_6=2; VAR_6==2 || vs_total_ac_bits < VAR_2[0]; VAR_6+=VAR_6){
b = VAR_0;
VAR_2[0] = 5*6*4;
for (VAR_4=0; VAR_4<6*5; VAR_4++, b++) {
VAR_7= b->VAR_7[0];
for (VAR_5= b->next[VAR_7]; VAR_5<64; VAR_5= b->next[VAR_5]) {
if(b->mb[VAR_5] < VAR_6 && b->mb[VAR_5] > -VAR_6){
b->next[VAR_7] = b->next[VAR_5];
}else{
VAR_2[0] += dv_rl2vlc_size(VAR_5 - VAR_7 - 1, b->mb[VAR_5]);
VAR_7= VAR_5;
}
}
}
}
}
|
[
"static inline void FUNC_0(EncBlockInfo* VAR_0, int* VAR_1)\n{",
"int VAR_2[5];",
"int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8;",
"EncBlockInfo* b;",
"VAR_2[0] = VAR_2[1] = VAR_2[2] = VAR_2[3] = VAR_2[4] = 1<<24;",
"do {",
"b = VAR_0;",
"for (VAR_3=0; VAR_3<5; VAR_3++) {",
"if (!VAR_1[VAR_3])\ncontinue;",
"VAR_1[VAR_3]--;",
"VAR_2[VAR_3] = 0;",
"for (VAR_4=0; VAR_4<6; VAR_4++, b++) {",
"for (VAR_6=0; VAR_6<4; VAR_6++) {",
"if (b->area_q[VAR_6] != dv_quant_shifts[VAR_1[VAR_3] + dv_quant_offset[b->cno]][VAR_6]) {",
"b->bit_size[VAR_6] = 1;",
"b->area_q[VAR_6]++;",
"VAR_7= b->VAR_7[VAR_6];",
"for (VAR_5= b->next[VAR_7] ; VAR_5<mb_area_start[VAR_6+1]; VAR_5= b->next[VAR_5]) {",
"b->mb[VAR_5] >>= 1;",
"if (b->mb[VAR_5]) {",
"b->bit_size[VAR_6] += dv_rl2vlc_size(VAR_5 - VAR_7 - 1, b->mb[VAR_5]);",
"VAR_7= VAR_5;",
"} else {",
"if(b->next[VAR_5] >= mb_area_start[VAR_6+1] && b->next[VAR_5]<64){",
"for(VAR_8=VAR_6+1; b->next[VAR_5] >= mb_area_start[VAR_8+1]; VAR_8++)",
"b->VAR_7[VAR_8] = VAR_7;",
"assert(VAR_8<4);",
"assert(b->mb[b->next[VAR_5]]);",
"b->bit_size[VAR_8] += dv_rl2vlc_size(b->next[VAR_5] - VAR_7 - 1, b->mb[b->next[VAR_5]])\n-dv_rl2vlc_size(b->next[VAR_5] - VAR_5 - 1, b->mb[b->next[VAR_5]]);",
"for(; (b->VAR_7[VAR_8]==VAR_5) && (VAR_8<4); VAR_8++)",
"b->VAR_7[VAR_8] = VAR_7;",
"}",
"b->next[VAR_7] = b->next[VAR_5];",
"}",
"}",
"b->VAR_7[VAR_6+1]= VAR_7;",
"}",
"VAR_2[VAR_3] += b->bit_size[VAR_6];",
"}",
"}",
"if(vs_total_ac_bits >= VAR_2[0] + VAR_2[1] + VAR_2[2] + VAR_2[3] + VAR_2[4])\nreturn;",
"}",
"} while (VAR_1[0]|VAR_1[1]|VAR_1[2]|VAR_1[3]|VAR_1[4]);",
"for(VAR_6=2; VAR_6==2 || vs_total_ac_bits < VAR_2[0]; VAR_6+=VAR_6){",
"b = VAR_0;",
"VAR_2[0] = 5*6*4;",
"for (VAR_4=0; VAR_4<6*5; VAR_4++, b++) {",
"VAR_7= b->VAR_7[0];",
"for (VAR_5= b->next[VAR_7]; VAR_5<64; VAR_5= b->next[VAR_5]) {",
"if(b->mb[VAR_5] < VAR_6 && b->mb[VAR_5] > -VAR_6){",
"b->next[VAR_7] = b->next[VAR_5];",
"}else{",
"VAR_2[0] += dv_rl2vlc_size(VAR_5 - VAR_7 - 1, b->mb[VAR_5]);",
"VAR_7= 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
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21,
23
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65,
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91,
93
],
[
95
],
[
97
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
]
] |
7,273 |
static int vtenc_cm_to_avpacket(
AVCodecContext *avctx,
CMSampleBufferRef sample_buffer,
AVPacket *pkt,
ExtraSEI *sei)
{
VTEncContext *vtctx = avctx->priv_data;
int status;
bool is_key_frame;
bool add_header;
size_t length_code_size;
size_t header_size = 0;
size_t in_buf_size;
size_t out_buf_size;
size_t sei_nalu_size = 0;
int64_t dts_delta;
int64_t time_base_num;
int nalu_count;
CMTime pts;
CMTime dts;
CMVideoFormatDescriptionRef vid_fmt;
vtenc_get_frame_info(sample_buffer, &is_key_frame);
status = get_length_code_size(avctx, sample_buffer, &length_code_size);
if (status) return status;
add_header = is_key_frame && !(avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER);
if (add_header) {
vid_fmt = CMSampleBufferGetFormatDescription(sample_buffer);
if (!vid_fmt) {
av_log(avctx, AV_LOG_ERROR, "Cannot get format description.\n");
return AVERROR_EXTERNAL;
}
int status = get_params_size(avctx, vid_fmt, &header_size);
if (status) return status;
}
status = count_nalus(length_code_size, sample_buffer, &nalu_count);
if(status)
return status;
if (sei) {
sei_nalu_size = sizeof(start_code) + 3 + sei->size + 1;
}
in_buf_size = CMSampleBufferGetTotalSampleSize(sample_buffer);
out_buf_size = header_size +
in_buf_size +
sei_nalu_size +
nalu_count * ((int)sizeof(start_code) - (int)length_code_size);
status = ff_alloc_packet2(avctx, pkt, out_buf_size, out_buf_size);
if (status < 0)
return status;
if (add_header) {
status = copy_param_sets(avctx, vid_fmt, pkt->data, out_buf_size);
if(status) return status;
}
status = copy_replace_length_codes(
avctx,
length_code_size,
sample_buffer,
pkt->data + header_size,
pkt->size - header_size - sei_nalu_size
);
if (status) {
av_log(avctx, AV_LOG_ERROR, "Error copying packet data: %d", status);
return status;
}
if (sei_nalu_size > 0) {
uint8_t *sei_nalu = pkt->data + pkt->size - sei_nalu_size;
memcpy(sei_nalu, start_code, sizeof(start_code));
sei_nalu += sizeof(start_code);
sei_nalu[0] = H264_NAL_SEI;
sei_nalu[1] = SEI_TYPE_USER_DATA_REGISTERED;
sei_nalu[2] = sei->size;
sei_nalu += 3;
memcpy(sei_nalu, sei->data, sei->size);
sei_nalu += sei->size;
sei_nalu[0] = 1; // RBSP
}
if (is_key_frame) {
pkt->flags |= AV_PKT_FLAG_KEY;
}
pts = CMSampleBufferGetPresentationTimeStamp(sample_buffer);
dts = CMSampleBufferGetDecodeTimeStamp (sample_buffer);
if (CMTIME_IS_INVALID(dts)) {
if (!vtctx->has_b_frames) {
dts = pts;
} else {
av_log(avctx, AV_LOG_ERROR, "DTS is invalid.\n");
return AVERROR_EXTERNAL;
}
}
dts_delta = vtctx->dts_delta >= 0 ? vtctx->dts_delta : 0;
time_base_num = avctx->time_base.num;
pkt->pts = pts.value / time_base_num;
pkt->dts = dts.value / time_base_num - dts_delta;
pkt->size = out_buf_size;
return 0;
}
| false |
FFmpeg
|
9875695e2ceec413f072ac2ef7e8fbc6a4980294
|
static int vtenc_cm_to_avpacket(
AVCodecContext *avctx,
CMSampleBufferRef sample_buffer,
AVPacket *pkt,
ExtraSEI *sei)
{
VTEncContext *vtctx = avctx->priv_data;
int status;
bool is_key_frame;
bool add_header;
size_t length_code_size;
size_t header_size = 0;
size_t in_buf_size;
size_t out_buf_size;
size_t sei_nalu_size = 0;
int64_t dts_delta;
int64_t time_base_num;
int nalu_count;
CMTime pts;
CMTime dts;
CMVideoFormatDescriptionRef vid_fmt;
vtenc_get_frame_info(sample_buffer, &is_key_frame);
status = get_length_code_size(avctx, sample_buffer, &length_code_size);
if (status) return status;
add_header = is_key_frame && !(avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER);
if (add_header) {
vid_fmt = CMSampleBufferGetFormatDescription(sample_buffer);
if (!vid_fmt) {
av_log(avctx, AV_LOG_ERROR, "Cannot get format description.\n");
return AVERROR_EXTERNAL;
}
int status = get_params_size(avctx, vid_fmt, &header_size);
if (status) return status;
}
status = count_nalus(length_code_size, sample_buffer, &nalu_count);
if(status)
return status;
if (sei) {
sei_nalu_size = sizeof(start_code) + 3 + sei->size + 1;
}
in_buf_size = CMSampleBufferGetTotalSampleSize(sample_buffer);
out_buf_size = header_size +
in_buf_size +
sei_nalu_size +
nalu_count * ((int)sizeof(start_code) - (int)length_code_size);
status = ff_alloc_packet2(avctx, pkt, out_buf_size, out_buf_size);
if (status < 0)
return status;
if (add_header) {
status = copy_param_sets(avctx, vid_fmt, pkt->data, out_buf_size);
if(status) return status;
}
status = copy_replace_length_codes(
avctx,
length_code_size,
sample_buffer,
pkt->data + header_size,
pkt->size - header_size - sei_nalu_size
);
if (status) {
av_log(avctx, AV_LOG_ERROR, "Error copying packet data: %d", status);
return status;
}
if (sei_nalu_size > 0) {
uint8_t *sei_nalu = pkt->data + pkt->size - sei_nalu_size;
memcpy(sei_nalu, start_code, sizeof(start_code));
sei_nalu += sizeof(start_code);
sei_nalu[0] = H264_NAL_SEI;
sei_nalu[1] = SEI_TYPE_USER_DATA_REGISTERED;
sei_nalu[2] = sei->size;
sei_nalu += 3;
memcpy(sei_nalu, sei->data, sei->size);
sei_nalu += sei->size;
sei_nalu[0] = 1;
}
if (is_key_frame) {
pkt->flags |= AV_PKT_FLAG_KEY;
}
pts = CMSampleBufferGetPresentationTimeStamp(sample_buffer);
dts = CMSampleBufferGetDecodeTimeStamp (sample_buffer);
if (CMTIME_IS_INVALID(dts)) {
if (!vtctx->has_b_frames) {
dts = pts;
} else {
av_log(avctx, AV_LOG_ERROR, "DTS is invalid.\n");
return AVERROR_EXTERNAL;
}
}
dts_delta = vtctx->dts_delta >= 0 ? vtctx->dts_delta : 0;
time_base_num = avctx->time_base.num;
pkt->pts = pts.value / time_base_num;
pkt->dts = dts.value / time_base_num - dts_delta;
pkt->size = out_buf_size;
return 0;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(
AVCodecContext *VAR_0,
CMSampleBufferRef VAR_1,
AVPacket *VAR_2,
ExtraSEI *VAR_3)
{
VTEncContext *vtctx = VAR_0->priv_data;
int VAR_6;
bool is_key_frame;
bool add_header;
size_t length_code_size;
size_t header_size = 0;
size_t in_buf_size;
size_t out_buf_size;
size_t sei_nalu_size = 0;
int64_t dts_delta;
int64_t time_base_num;
int VAR_5;
CMTime pts;
CMTime dts;
CMVideoFormatDescriptionRef vid_fmt;
vtenc_get_frame_info(VAR_1, &is_key_frame);
VAR_6 = get_length_code_size(VAR_0, VAR_1, &length_code_size);
if (VAR_6) return VAR_6;
add_header = is_key_frame && !(VAR_0->flags & AV_CODEC_FLAG_GLOBAL_HEADER);
if (add_header) {
vid_fmt = CMSampleBufferGetFormatDescription(VAR_1);
if (!vid_fmt) {
av_log(VAR_0, AV_LOG_ERROR, "Cannot get format description.\n");
return AVERROR_EXTERNAL;
}
int VAR_6 = get_params_size(VAR_0, vid_fmt, &header_size);
if (VAR_6) return VAR_6;
}
VAR_6 = count_nalus(length_code_size, VAR_1, &VAR_5);
if(VAR_6)
return VAR_6;
if (VAR_3) {
sei_nalu_size = sizeof(start_code) + 3 + VAR_3->size + 1;
}
in_buf_size = CMSampleBufferGetTotalSampleSize(VAR_1);
out_buf_size = header_size +
in_buf_size +
sei_nalu_size +
VAR_5 * ((int)sizeof(start_code) - (int)length_code_size);
VAR_6 = ff_alloc_packet2(VAR_0, VAR_2, out_buf_size, out_buf_size);
if (VAR_6 < 0)
return VAR_6;
if (add_header) {
VAR_6 = copy_param_sets(VAR_0, vid_fmt, VAR_2->data, out_buf_size);
if(VAR_6) return VAR_6;
}
VAR_6 = copy_replace_length_codes(
VAR_0,
length_code_size,
VAR_1,
VAR_2->data + header_size,
VAR_2->size - header_size - sei_nalu_size
);
if (VAR_6) {
av_log(VAR_0, AV_LOG_ERROR, "Error copying packet data: %d", VAR_6);
return VAR_6;
}
if (sei_nalu_size > 0) {
uint8_t *sei_nalu = VAR_2->data + VAR_2->size - sei_nalu_size;
memcpy(sei_nalu, start_code, sizeof(start_code));
sei_nalu += sizeof(start_code);
sei_nalu[0] = H264_NAL_SEI;
sei_nalu[1] = SEI_TYPE_USER_DATA_REGISTERED;
sei_nalu[2] = VAR_3->size;
sei_nalu += 3;
memcpy(sei_nalu, VAR_3->data, VAR_3->size);
sei_nalu += VAR_3->size;
sei_nalu[0] = 1;
}
if (is_key_frame) {
VAR_2->flags |= AV_PKT_FLAG_KEY;
}
pts = CMSampleBufferGetPresentationTimeStamp(VAR_1);
dts = CMSampleBufferGetDecodeTimeStamp (VAR_1);
if (CMTIME_IS_INVALID(dts)) {
if (!vtctx->has_b_frames) {
dts = pts;
} else {
av_log(VAR_0, AV_LOG_ERROR, "DTS is invalid.\n");
return AVERROR_EXTERNAL;
}
}
dts_delta = vtctx->dts_delta >= 0 ? vtctx->dts_delta : 0;
time_base_num = VAR_0->time_base.num;
VAR_2->pts = pts.value / time_base_num;
VAR_2->dts = dts.value / time_base_num - dts_delta;
VAR_2->size = out_buf_size;
return 0;
}
|
[
"static int FUNC_0(\nAVCodecContext *VAR_0,\nCMSampleBufferRef VAR_1,\nAVPacket *VAR_2,\nExtraSEI *VAR_3)\n{",
"VTEncContext *vtctx = VAR_0->priv_data;",
"int VAR_6;",
"bool is_key_frame;",
"bool add_header;",
"size_t length_code_size;",
"size_t header_size = 0;",
"size_t in_buf_size;",
"size_t out_buf_size;",
"size_t sei_nalu_size = 0;",
"int64_t dts_delta;",
"int64_t time_base_num;",
"int VAR_5;",
"CMTime pts;",
"CMTime dts;",
"CMVideoFormatDescriptionRef vid_fmt;",
"vtenc_get_frame_info(VAR_1, &is_key_frame);",
"VAR_6 = get_length_code_size(VAR_0, VAR_1, &length_code_size);",
"if (VAR_6) return VAR_6;",
"add_header = is_key_frame && !(VAR_0->flags & AV_CODEC_FLAG_GLOBAL_HEADER);",
"if (add_header) {",
"vid_fmt = CMSampleBufferGetFormatDescription(VAR_1);",
"if (!vid_fmt) {",
"av_log(VAR_0, AV_LOG_ERROR, \"Cannot get format description.\\n\");",
"return AVERROR_EXTERNAL;",
"}",
"int VAR_6 = get_params_size(VAR_0, vid_fmt, &header_size);",
"if (VAR_6) return VAR_6;",
"}",
"VAR_6 = count_nalus(length_code_size, VAR_1, &VAR_5);",
"if(VAR_6)\nreturn VAR_6;",
"if (VAR_3) {",
"sei_nalu_size = sizeof(start_code) + 3 + VAR_3->size + 1;",
"}",
"in_buf_size = CMSampleBufferGetTotalSampleSize(VAR_1);",
"out_buf_size = header_size +\nin_buf_size +\nsei_nalu_size +\nVAR_5 * ((int)sizeof(start_code) - (int)length_code_size);",
"VAR_6 = ff_alloc_packet2(VAR_0, VAR_2, out_buf_size, out_buf_size);",
"if (VAR_6 < 0)\nreturn VAR_6;",
"if (add_header) {",
"VAR_6 = copy_param_sets(VAR_0, vid_fmt, VAR_2->data, out_buf_size);",
"if(VAR_6) return VAR_6;",
"}",
"VAR_6 = copy_replace_length_codes(\nVAR_0,\nlength_code_size,\nVAR_1,\nVAR_2->data + header_size,\nVAR_2->size - header_size - sei_nalu_size\n);",
"if (VAR_6) {",
"av_log(VAR_0, AV_LOG_ERROR, \"Error copying packet data: %d\", VAR_6);",
"return VAR_6;",
"}",
"if (sei_nalu_size > 0) {",
"uint8_t *sei_nalu = VAR_2->data + VAR_2->size - sei_nalu_size;",
"memcpy(sei_nalu, start_code, sizeof(start_code));",
"sei_nalu += sizeof(start_code);",
"sei_nalu[0] = H264_NAL_SEI;",
"sei_nalu[1] = SEI_TYPE_USER_DATA_REGISTERED;",
"sei_nalu[2] = VAR_3->size;",
"sei_nalu += 3;",
"memcpy(sei_nalu, VAR_3->data, VAR_3->size);",
"sei_nalu += VAR_3->size;",
"sei_nalu[0] = 1;",
"}",
"if (is_key_frame) {",
"VAR_2->flags |= AV_PKT_FLAG_KEY;",
"}",
"pts = CMSampleBufferGetPresentationTimeStamp(VAR_1);",
"dts = CMSampleBufferGetDecodeTimeStamp (VAR_1);",
"if (CMTIME_IS_INVALID(dts)) {",
"if (!vtctx->has_b_frames) {",
"dts = pts;",
"} else {",
"av_log(VAR_0, AV_LOG_ERROR, \"DTS is invalid.\\n\");",
"return AVERROR_EXTERNAL;",
"}",
"}",
"dts_delta = vtctx->dts_delta >= 0 ? vtctx->dts_delta : 0;",
"time_base_num = VAR_0->time_base.num;",
"VAR_2->pts = pts.value / time_base_num;",
"VAR_2->dts = dts.value / time_base_num - dts_delta;",
"VAR_2->size = out_buf_size;",
"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
] |
[
[
1,
3,
5,
7,
9,
11
],
[
13
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
49
],
[
51
],
[
53
],
[
57
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
75
],
[
77
],
[
79
],
[
83
],
[
85,
87
],
[
91
],
[
93
],
[
95
],
[
99
],
[
101,
103,
105,
107
],
[
111
],
[
113,
115
],
[
119
],
[
121
],
[
123
],
[
125
],
[
129,
131,
133,
135,
137,
139,
141
],
[
145
],
[
147
],
[
149
],
[
151
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165
],
[
167
],
[
169
],
[
171
],
[
173
],
[
175
],
[
177
],
[
181
],
[
183
],
[
185
],
[
189
],
[
191
],
[
195
],
[
197
],
[
199
],
[
201
],
[
203
],
[
205
],
[
207
],
[
209
],
[
213
],
[
215
],
[
217
],
[
219
],
[
221
],
[
225
],
[
227
]
] |
7,274 |
AVFormatContext *avformat_alloc_context(void)
{
AVFormatContext *ic;
ic = av_malloc(sizeof(AVFormatContext));
if (!ic) return ic;
avformat_get_context_defaults(ic);
ic->av_class = &av_format_context_class;
return ic;
}
| false |
FFmpeg
|
9ac1bf88c00dbe7eb2191e2d5325fb104b9d8341
|
AVFormatContext *avformat_alloc_context(void)
{
AVFormatContext *ic;
ic = av_malloc(sizeof(AVFormatContext));
if (!ic) return ic;
avformat_get_context_defaults(ic);
ic->av_class = &av_format_context_class;
return ic;
}
|
{
"code": [],
"line_no": []
}
|
AVFormatContext *FUNC_0(void)
{
AVFormatContext *ic;
ic = av_malloc(sizeof(AVFormatContext));
if (!ic) return ic;
avformat_get_context_defaults(ic);
ic->av_class = &av_format_context_class;
return ic;
}
|
[
"AVFormatContext *FUNC_0(void)\n{",
"AVFormatContext *ic;",
"ic = av_malloc(sizeof(AVFormatContext));",
"if (!ic) return ic;",
"avformat_get_context_defaults(ic);",
"ic->av_class = &av_format_context_class;",
"return ic;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
]
] |
7,275 |
offset_t url_filesize(URLContext *h)
{
offset_t pos, size;
size= url_seek(h, 0, AVSEEK_SIZE);
if(size<0){
pos = url_seek(h, 0, SEEK_CUR);
size = url_seek(h, -1, SEEK_END)+1;
url_seek(h, pos, SEEK_SET);
}
return size;
}
| false |
FFmpeg
|
eabbae730cf732afeb7c2a085e0e5c1e7b1b8614
|
offset_t url_filesize(URLContext *h)
{
offset_t pos, size;
size= url_seek(h, 0, AVSEEK_SIZE);
if(size<0){
pos = url_seek(h, 0, SEEK_CUR);
size = url_seek(h, -1, SEEK_END)+1;
url_seek(h, pos, SEEK_SET);
}
return size;
}
|
{
"code": [],
"line_no": []
}
|
offset_t FUNC_0(URLContext *h)
{
offset_t pos, size;
size= url_seek(h, 0, AVSEEK_SIZE);
if(size<0){
pos = url_seek(h, 0, SEEK_CUR);
size = url_seek(h, -1, SEEK_END)+1;
url_seek(h, pos, SEEK_SET);
}
return size;
}
|
[
"offset_t FUNC_0(URLContext *h)\n{",
"offset_t pos, size;",
"size= url_seek(h, 0, AVSEEK_SIZE);",
"if(size<0){",
"pos = url_seek(h, 0, SEEK_CUR);",
"size = url_seek(h, -1, SEEK_END)+1;",
"url_seek(h, pos, SEEK_SET);",
"}",
"return size;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
]
] |
7,276 |
static av_noinline void FUNC(hl_decode_mb)(const H264Context *h, H264SliceContext *sl)
{
const int mb_x = sl->mb_x;
const int mb_y = sl->mb_y;
const int mb_xy = sl->mb_xy;
const int mb_type = h->cur_pic.mb_type[mb_xy];
uint8_t *dest_y, *dest_cb, *dest_cr;
int linesize, uvlinesize /*dct_offset*/;
int i, j;
const int *block_offset = &h->block_offset[0];
const int transform_bypass = !SIMPLE && (sl->qscale == 0 && h->sps.transform_bypass);
void (*idct_add)(uint8_t *dst, int16_t *block, int stride);
const int block_h = 16 >> h->chroma_y_shift;
const int chroma422 = CHROMA422(h);
dest_y = h->cur_pic.f->data[0] + ((mb_x << PIXEL_SHIFT) + mb_y * sl->linesize) * 16;
dest_cb = h->cur_pic.f->data[1] + (mb_x << PIXEL_SHIFT) * 8 + mb_y * sl->uvlinesize * block_h;
dest_cr = h->cur_pic.f->data[2] + (mb_x << PIXEL_SHIFT) * 8 + mb_y * sl->uvlinesize * block_h;
h->vdsp.prefetch(dest_y + (sl->mb_x & 3) * 4 * sl->linesize + (64 << PIXEL_SHIFT), sl->linesize, 4);
h->vdsp.prefetch(dest_cb + (sl->mb_x & 7) * sl->uvlinesize + (64 << PIXEL_SHIFT), dest_cr - dest_cb, 2);
h->list_counts[mb_xy] = sl->list_count;
if (!SIMPLE && MB_FIELD(sl)) {
linesize = sl->mb_linesize = sl->linesize * 2;
uvlinesize = sl->mb_uvlinesize = sl->uvlinesize * 2;
block_offset = &h->block_offset[48];
if (mb_y & 1) { // FIXME move out of this function?
dest_y -= sl->linesize * 15;
dest_cb -= sl->uvlinesize * (block_h - 1);
dest_cr -= sl->uvlinesize * (block_h - 1);
}
if (FRAME_MBAFF(h)) {
int list;
for (list = 0; list < sl->list_count; list++) {
if (!USES_LIST(mb_type, list))
continue;
if (IS_16X16(mb_type)) {
int8_t *ref = &sl->ref_cache[list][scan8[0]];
fill_rectangle(ref, 4, 4, 8, (16 + *ref) ^ (sl->mb_y & 1), 1);
} else {
for (i = 0; i < 16; i += 4) {
int ref = sl->ref_cache[list][scan8[i]];
if (ref >= 0)
fill_rectangle(&sl->ref_cache[list][scan8[i]], 2, 2,
8, (16 + ref) ^ (sl->mb_y & 1), 1);
}
}
}
}
} else {
linesize = sl->mb_linesize = sl->linesize;
uvlinesize = sl->mb_uvlinesize = sl->uvlinesize;
// dct_offset = s->linesize * 16;
}
if (!SIMPLE && IS_INTRA_PCM(mb_type)) {
if (PIXEL_SHIFT) {
const int bit_depth = h->sps.bit_depth_luma;
int j;
GetBitContext gb;
init_get_bits(&gb, sl->intra_pcm_ptr,
ff_h264_mb_sizes[h->sps.chroma_format_idc] * bit_depth);
for (i = 0; i < 16; i++) {
uint16_t *tmp_y = (uint16_t *)(dest_y + i * linesize);
for (j = 0; j < 16; j++)
tmp_y[j] = get_bits(&gb, bit_depth);
}
if (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) {
if (!h->sps.chroma_format_idc) {
for (i = 0; i < block_h; i++) {
uint16_t *tmp_cb = (uint16_t *)(dest_cb + i * uvlinesize);
for (j = 0; j < 8; j++)
tmp_cb[j] = 1 << (bit_depth - 1);
}
for (i = 0; i < block_h; i++) {
uint16_t *tmp_cr = (uint16_t *)(dest_cr + i * uvlinesize);
for (j = 0; j < 8; j++)
tmp_cr[j] = 1 << (bit_depth - 1);
}
} else {
for (i = 0; i < block_h; i++) {
uint16_t *tmp_cb = (uint16_t *)(dest_cb + i * uvlinesize);
for (j = 0; j < 8; j++)
tmp_cb[j] = get_bits(&gb, bit_depth);
}
for (i = 0; i < block_h; i++) {
uint16_t *tmp_cr = (uint16_t *)(dest_cr + i * uvlinesize);
for (j = 0; j < 8; j++)
tmp_cr[j] = get_bits(&gb, bit_depth);
}
}
}
} else {
for (i = 0; i < 16; i++)
memcpy(dest_y + i * linesize, sl->intra_pcm_ptr + i * 16, 16);
if (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) {
if (!h->sps.chroma_format_idc) {
for (i = 0; i < block_h; i++) {
memset(dest_cb + i * uvlinesize, 128, 8);
memset(dest_cr + i * uvlinesize, 128, 8);
}
} else {
const uint8_t *src_cb = sl->intra_pcm_ptr + 256;
const uint8_t *src_cr = sl->intra_pcm_ptr + 256 + block_h * 8;
for (i = 0; i < block_h; i++) {
memcpy(dest_cb + i * uvlinesize, src_cb + i * 8, 8);
memcpy(dest_cr + i * uvlinesize, src_cr + i * 8, 8);
}
}
}
}
} else {
if (IS_INTRA(mb_type)) {
if (sl->deblocking_filter)
xchg_mb_border(h, sl, dest_y, dest_cb, dest_cr, linesize,
uvlinesize, 1, 0, SIMPLE, PIXEL_SHIFT);
if (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) {
h->hpc.pred8x8[sl->chroma_pred_mode](dest_cb, uvlinesize);
h->hpc.pred8x8[sl->chroma_pred_mode](dest_cr, uvlinesize);
}
hl_decode_mb_predict_luma(h, sl, mb_type, SIMPLE,
transform_bypass, PIXEL_SHIFT,
block_offset, linesize, dest_y, 0);
if (sl->deblocking_filter)
xchg_mb_border(h, sl, dest_y, dest_cb, dest_cr, linesize,
uvlinesize, 0, 0, SIMPLE, PIXEL_SHIFT);
} else {
if (chroma422) {
FUNC(hl_motion_422)(h, sl, dest_y, dest_cb, dest_cr,
h->qpel_put, h->h264chroma.put_h264_chroma_pixels_tab,
h->qpel_avg, h->h264chroma.avg_h264_chroma_pixels_tab,
h->h264dsp.weight_h264_pixels_tab,
h->h264dsp.biweight_h264_pixels_tab);
} else {
FUNC(hl_motion_420)(h, sl, dest_y, dest_cb, dest_cr,
h->qpel_put, h->h264chroma.put_h264_chroma_pixels_tab,
h->qpel_avg, h->h264chroma.avg_h264_chroma_pixels_tab,
h->h264dsp.weight_h264_pixels_tab,
h->h264dsp.biweight_h264_pixels_tab);
}
}
hl_decode_mb_idct_luma(h, sl, mb_type, SIMPLE, transform_bypass,
PIXEL_SHIFT, block_offset, linesize, dest_y, 0);
if ((SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) &&
(sl->cbp & 0x30)) {
uint8_t *dest[2] = { dest_cb, dest_cr };
if (transform_bypass) {
if (IS_INTRA(mb_type) && h->sps.profile_idc == 244 &&
(sl->chroma_pred_mode == VERT_PRED8x8 ||
sl->chroma_pred_mode == HOR_PRED8x8)) {
h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[0],
block_offset + 16,
sl->mb + (16 * 16 * 1 << PIXEL_SHIFT),
uvlinesize);
h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[1],
block_offset + 32,
sl->mb + (16 * 16 * 2 << PIXEL_SHIFT),
uvlinesize);
} else {
idct_add = h->h264dsp.h264_add_pixels4_clear;
for (j = 1; j < 3; j++) {
for (i = j * 16; i < j * 16 + 4; i++)
if (sl->non_zero_count_cache[scan8[i]] ||
dctcoef_get(sl->mb, PIXEL_SHIFT, i * 16))
idct_add(dest[j - 1] + block_offset[i],
sl->mb + (i * 16 << PIXEL_SHIFT),
uvlinesize);
if (chroma422) {
for (i = j * 16 + 4; i < j * 16 + 8; i++)
if (sl->non_zero_count_cache[scan8[i + 4]] ||
dctcoef_get(sl->mb, PIXEL_SHIFT, i * 16))
idct_add(dest[j - 1] + block_offset[i + 4],
sl->mb + (i * 16 << PIXEL_SHIFT),
uvlinesize);
}
}
}
} else {
int qp[2];
if (chroma422) {
qp[0] = sl->chroma_qp[0] + 3;
qp[1] = sl->chroma_qp[1] + 3;
} else {
qp[0] = sl->chroma_qp[0];
qp[1] = sl->chroma_qp[1];
}
if (sl->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 0]])
h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + (16 * 16 * 1 << PIXEL_SHIFT),
h->dequant4_coeff[IS_INTRA(mb_type) ? 1 : 4][qp[0]][0]);
if (sl->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 1]])
h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + (16 * 16 * 2 << PIXEL_SHIFT),
h->dequant4_coeff[IS_INTRA(mb_type) ? 2 : 5][qp[1]][0]);
h->h264dsp.h264_idct_add8(dest, block_offset,
sl->mb, uvlinesize,
sl->non_zero_count_cache);
}
}
}
}
| false |
FFmpeg
|
3176217c60ca7828712985092d9102d331ea4f3d
|
static av_noinline void FUNC(hl_decode_mb)(const H264Context *h, H264SliceContext *sl)
{
const int mb_x = sl->mb_x;
const int mb_y = sl->mb_y;
const int mb_xy = sl->mb_xy;
const int mb_type = h->cur_pic.mb_type[mb_xy];
uint8_t *dest_y, *dest_cb, *dest_cr;
int linesize, uvlinesize ;
int i, j;
const int *block_offset = &h->block_offset[0];
const int transform_bypass = !SIMPLE && (sl->qscale == 0 && h->sps.transform_bypass);
void (*idct_add)(uint8_t *dst, int16_t *block, int stride);
const int block_h = 16 >> h->chroma_y_shift;
const int chroma422 = CHROMA422(h);
dest_y = h->cur_pic.f->data[0] + ((mb_x << PIXEL_SHIFT) + mb_y * sl->linesize) * 16;
dest_cb = h->cur_pic.f->data[1] + (mb_x << PIXEL_SHIFT) * 8 + mb_y * sl->uvlinesize * block_h;
dest_cr = h->cur_pic.f->data[2] + (mb_x << PIXEL_SHIFT) * 8 + mb_y * sl->uvlinesize * block_h;
h->vdsp.prefetch(dest_y + (sl->mb_x & 3) * 4 * sl->linesize + (64 << PIXEL_SHIFT), sl->linesize, 4);
h->vdsp.prefetch(dest_cb + (sl->mb_x & 7) * sl->uvlinesize + (64 << PIXEL_SHIFT), dest_cr - dest_cb, 2);
h->list_counts[mb_xy] = sl->list_count;
if (!SIMPLE && MB_FIELD(sl)) {
linesize = sl->mb_linesize = sl->linesize * 2;
uvlinesize = sl->mb_uvlinesize = sl->uvlinesize * 2;
block_offset = &h->block_offset[48];
if (mb_y & 1) {
dest_y -= sl->linesize * 15;
dest_cb -= sl->uvlinesize * (block_h - 1);
dest_cr -= sl->uvlinesize * (block_h - 1);
}
if (FRAME_MBAFF(h)) {
int list;
for (list = 0; list < sl->list_count; list++) {
if (!USES_LIST(mb_type, list))
continue;
if (IS_16X16(mb_type)) {
int8_t *ref = &sl->ref_cache[list][scan8[0]];
fill_rectangle(ref, 4, 4, 8, (16 + *ref) ^ (sl->mb_y & 1), 1);
} else {
for (i = 0; i < 16; i += 4) {
int ref = sl->ref_cache[list][scan8[i]];
if (ref >= 0)
fill_rectangle(&sl->ref_cache[list][scan8[i]], 2, 2,
8, (16 + ref) ^ (sl->mb_y & 1), 1);
}
}
}
}
} else {
linesize = sl->mb_linesize = sl->linesize;
uvlinesize = sl->mb_uvlinesize = sl->uvlinesize;
}
if (!SIMPLE && IS_INTRA_PCM(mb_type)) {
if (PIXEL_SHIFT) {
const int bit_depth = h->sps.bit_depth_luma;
int j;
GetBitContext gb;
init_get_bits(&gb, sl->intra_pcm_ptr,
ff_h264_mb_sizes[h->sps.chroma_format_idc] * bit_depth);
for (i = 0; i < 16; i++) {
uint16_t *tmp_y = (uint16_t *)(dest_y + i * linesize);
for (j = 0; j < 16; j++)
tmp_y[j] = get_bits(&gb, bit_depth);
}
if (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) {
if (!h->sps.chroma_format_idc) {
for (i = 0; i < block_h; i++) {
uint16_t *tmp_cb = (uint16_t *)(dest_cb + i * uvlinesize);
for (j = 0; j < 8; j++)
tmp_cb[j] = 1 << (bit_depth - 1);
}
for (i = 0; i < block_h; i++) {
uint16_t *tmp_cr = (uint16_t *)(dest_cr + i * uvlinesize);
for (j = 0; j < 8; j++)
tmp_cr[j] = 1 << (bit_depth - 1);
}
} else {
for (i = 0; i < block_h; i++) {
uint16_t *tmp_cb = (uint16_t *)(dest_cb + i * uvlinesize);
for (j = 0; j < 8; j++)
tmp_cb[j] = get_bits(&gb, bit_depth);
}
for (i = 0; i < block_h; i++) {
uint16_t *tmp_cr = (uint16_t *)(dest_cr + i * uvlinesize);
for (j = 0; j < 8; j++)
tmp_cr[j] = get_bits(&gb, bit_depth);
}
}
}
} else {
for (i = 0; i < 16; i++)
memcpy(dest_y + i * linesize, sl->intra_pcm_ptr + i * 16, 16);
if (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) {
if (!h->sps.chroma_format_idc) {
for (i = 0; i < block_h; i++) {
memset(dest_cb + i * uvlinesize, 128, 8);
memset(dest_cr + i * uvlinesize, 128, 8);
}
} else {
const uint8_t *src_cb = sl->intra_pcm_ptr + 256;
const uint8_t *src_cr = sl->intra_pcm_ptr + 256 + block_h * 8;
for (i = 0; i < block_h; i++) {
memcpy(dest_cb + i * uvlinesize, src_cb + i * 8, 8);
memcpy(dest_cr + i * uvlinesize, src_cr + i * 8, 8);
}
}
}
}
} else {
if (IS_INTRA(mb_type)) {
if (sl->deblocking_filter)
xchg_mb_border(h, sl, dest_y, dest_cb, dest_cr, linesize,
uvlinesize, 1, 0, SIMPLE, PIXEL_SHIFT);
if (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) {
h->hpc.pred8x8[sl->chroma_pred_mode](dest_cb, uvlinesize);
h->hpc.pred8x8[sl->chroma_pred_mode](dest_cr, uvlinesize);
}
hl_decode_mb_predict_luma(h, sl, mb_type, SIMPLE,
transform_bypass, PIXEL_SHIFT,
block_offset, linesize, dest_y, 0);
if (sl->deblocking_filter)
xchg_mb_border(h, sl, dest_y, dest_cb, dest_cr, linesize,
uvlinesize, 0, 0, SIMPLE, PIXEL_SHIFT);
} else {
if (chroma422) {
FUNC(hl_motion_422)(h, sl, dest_y, dest_cb, dest_cr,
h->qpel_put, h->h264chroma.put_h264_chroma_pixels_tab,
h->qpel_avg, h->h264chroma.avg_h264_chroma_pixels_tab,
h->h264dsp.weight_h264_pixels_tab,
h->h264dsp.biweight_h264_pixels_tab);
} else {
FUNC(hl_motion_420)(h, sl, dest_y, dest_cb, dest_cr,
h->qpel_put, h->h264chroma.put_h264_chroma_pixels_tab,
h->qpel_avg, h->h264chroma.avg_h264_chroma_pixels_tab,
h->h264dsp.weight_h264_pixels_tab,
h->h264dsp.biweight_h264_pixels_tab);
}
}
hl_decode_mb_idct_luma(h, sl, mb_type, SIMPLE, transform_bypass,
PIXEL_SHIFT, block_offset, linesize, dest_y, 0);
if ((SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) &&
(sl->cbp & 0x30)) {
uint8_t *dest[2] = { dest_cb, dest_cr };
if (transform_bypass) {
if (IS_INTRA(mb_type) && h->sps.profile_idc == 244 &&
(sl->chroma_pred_mode == VERT_PRED8x8 ||
sl->chroma_pred_mode == HOR_PRED8x8)) {
h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[0],
block_offset + 16,
sl->mb + (16 * 16 * 1 << PIXEL_SHIFT),
uvlinesize);
h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[1],
block_offset + 32,
sl->mb + (16 * 16 * 2 << PIXEL_SHIFT),
uvlinesize);
} else {
idct_add = h->h264dsp.h264_add_pixels4_clear;
for (j = 1; j < 3; j++) {
for (i = j * 16; i < j * 16 + 4; i++)
if (sl->non_zero_count_cache[scan8[i]] ||
dctcoef_get(sl->mb, PIXEL_SHIFT, i * 16))
idct_add(dest[j - 1] + block_offset[i],
sl->mb + (i * 16 << PIXEL_SHIFT),
uvlinesize);
if (chroma422) {
for (i = j * 16 + 4; i < j * 16 + 8; i++)
if (sl->non_zero_count_cache[scan8[i + 4]] ||
dctcoef_get(sl->mb, PIXEL_SHIFT, i * 16))
idct_add(dest[j - 1] + block_offset[i + 4],
sl->mb + (i * 16 << PIXEL_SHIFT),
uvlinesize);
}
}
}
} else {
int qp[2];
if (chroma422) {
qp[0] = sl->chroma_qp[0] + 3;
qp[1] = sl->chroma_qp[1] + 3;
} else {
qp[0] = sl->chroma_qp[0];
qp[1] = sl->chroma_qp[1];
}
if (sl->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 0]])
h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + (16 * 16 * 1 << PIXEL_SHIFT),
h->dequant4_coeff[IS_INTRA(mb_type) ? 1 : 4][qp[0]][0]);
if (sl->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 1]])
h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + (16 * 16 * 2 << PIXEL_SHIFT),
h->dequant4_coeff[IS_INTRA(mb_type) ? 2 : 5][qp[1]][0]);
h->h264dsp.h264_idct_add8(dest, block_offset,
sl->mb, uvlinesize,
sl->non_zero_count_cache);
}
}
}
}
|
{
"code": [],
"line_no": []
}
|
static av_noinline void FUNC_0(hl_decode_mb)(const H264Context *h, H264SliceContext *sl)
{
const int VAR_0 = sl->VAR_0;
const int VAR_1 = sl->VAR_1;
const int VAR_2 = sl->VAR_2;
const int VAR_3 = h->cur_pic.VAR_3[VAR_2];
uint8_t *dest_y, *dest_cb, *dest_cr;
int VAR_4, VAR_5 ;
int VAR_6, VAR_18;
const int *VAR_8 = &h->VAR_8[0];
const int VAR_9 = !SIMPLE && (sl->qscale == 0 && h->sps.VAR_9);
void (*VAR_10)(uint8_t *VAR_11, int16_t *VAR_12, int VAR_13);
const int VAR_14 = 16 >> h->chroma_y_shift;
const int VAR_15 = CHROMA422(h);
dest_y = h->cur_pic.f->data[0] + ((VAR_0 << PIXEL_SHIFT) + VAR_1 * sl->VAR_4) * 16;
dest_cb = h->cur_pic.f->data[1] + (VAR_0 << PIXEL_SHIFT) * 8 + VAR_1 * sl->VAR_5 * VAR_14;
dest_cr = h->cur_pic.f->data[2] + (VAR_0 << PIXEL_SHIFT) * 8 + VAR_1 * sl->VAR_5 * VAR_14;
h->vdsp.prefetch(dest_y + (sl->VAR_0 & 3) * 4 * sl->VAR_4 + (64 << PIXEL_SHIFT), sl->VAR_4, 4);
h->vdsp.prefetch(dest_cb + (sl->VAR_0 & 7) * sl->VAR_5 + (64 << PIXEL_SHIFT), dest_cr - dest_cb, 2);
h->list_counts[VAR_2] = sl->list_count;
if (!SIMPLE && MB_FIELD(sl)) {
VAR_4 = sl->mb_linesize = sl->VAR_4 * 2;
VAR_5 = sl->mb_uvlinesize = sl->VAR_5 * 2;
VAR_8 = &h->VAR_8[48];
if (VAR_1 & 1) {
dest_y -= sl->VAR_4 * 15;
dest_cb -= sl->VAR_5 * (VAR_14 - 1);
dest_cr -= sl->VAR_5 * (VAR_14 - 1);
}
if (FRAME_MBAFF(h)) {
int VAR_16;
for (VAR_16 = 0; VAR_16 < sl->list_count; VAR_16++) {
if (!USES_LIST(VAR_3, VAR_16))
continue;
if (IS_16X16(VAR_3)) {
int8_t *ref = &sl->ref_cache[VAR_16][scan8[0]];
fill_rectangle(ref, 4, 4, 8, (16 + *ref) ^ (sl->VAR_1 & 1), 1);
} else {
for (VAR_6 = 0; VAR_6 < 16; VAR_6 += 4) {
int ref = sl->ref_cache[VAR_16][scan8[VAR_6]];
if (ref >= 0)
fill_rectangle(&sl->ref_cache[VAR_16][scan8[VAR_6]], 2, 2,
8, (16 + ref) ^ (sl->VAR_1 & 1), 1);
}
}
}
}
} else {
VAR_4 = sl->mb_linesize = sl->VAR_4;
VAR_5 = sl->mb_uvlinesize = sl->VAR_5;
}
if (!SIMPLE && IS_INTRA_PCM(VAR_3)) {
if (PIXEL_SHIFT) {
const int VAR_17 = h->sps.bit_depth_luma;
int VAR_18;
GetBitContext gb;
init_get_bits(&gb, sl->intra_pcm_ptr,
ff_h264_mb_sizes[h->sps.chroma_format_idc] * VAR_17);
for (VAR_6 = 0; VAR_6 < 16; VAR_6++) {
uint16_t *tmp_y = (uint16_t *)(dest_y + VAR_6 * VAR_4);
for (VAR_18 = 0; VAR_18 < 16; VAR_18++)
tmp_y[VAR_18] = get_bits(&gb, VAR_17);
}
if (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) {
if (!h->sps.chroma_format_idc) {
for (VAR_6 = 0; VAR_6 < VAR_14; VAR_6++) {
uint16_t *tmp_cb = (uint16_t *)(dest_cb + VAR_6 * VAR_5);
for (VAR_18 = 0; VAR_18 < 8; VAR_18++)
tmp_cb[VAR_18] = 1 << (VAR_17 - 1);
}
for (VAR_6 = 0; VAR_6 < VAR_14; VAR_6++) {
uint16_t *tmp_cr = (uint16_t *)(dest_cr + VAR_6 * VAR_5);
for (VAR_18 = 0; VAR_18 < 8; VAR_18++)
tmp_cr[VAR_18] = 1 << (VAR_17 - 1);
}
} else {
for (VAR_6 = 0; VAR_6 < VAR_14; VAR_6++) {
uint16_t *tmp_cb = (uint16_t *)(dest_cb + VAR_6 * VAR_5);
for (VAR_18 = 0; VAR_18 < 8; VAR_18++)
tmp_cb[VAR_18] = get_bits(&gb, VAR_17);
}
for (VAR_6 = 0; VAR_6 < VAR_14; VAR_6++) {
uint16_t *tmp_cr = (uint16_t *)(dest_cr + VAR_6 * VAR_5);
for (VAR_18 = 0; VAR_18 < 8; VAR_18++)
tmp_cr[VAR_18] = get_bits(&gb, VAR_17);
}
}
}
} else {
for (VAR_6 = 0; VAR_6 < 16; VAR_6++)
memcpy(dest_y + VAR_6 * VAR_4, sl->intra_pcm_ptr + VAR_6 * 16, 16);
if (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) {
if (!h->sps.chroma_format_idc) {
for (VAR_6 = 0; VAR_6 < VAR_14; VAR_6++) {
memset(dest_cb + VAR_6 * VAR_5, 128, 8);
memset(dest_cr + VAR_6 * VAR_5, 128, 8);
}
} else {
const uint8_t *VAR_18 = sl->intra_pcm_ptr + 256;
const uint8_t *VAR_19 = sl->intra_pcm_ptr + 256 + VAR_14 * 8;
for (VAR_6 = 0; VAR_6 < VAR_14; VAR_6++) {
memcpy(dest_cb + VAR_6 * VAR_5, VAR_18 + VAR_6 * 8, 8);
memcpy(dest_cr + VAR_6 * VAR_5, VAR_19 + VAR_6 * 8, 8);
}
}
}
}
} else {
if (IS_INTRA(VAR_3)) {
if (sl->deblocking_filter)
xchg_mb_border(h, sl, dest_y, dest_cb, dest_cr, VAR_4,
VAR_5, 1, 0, SIMPLE, PIXEL_SHIFT);
if (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) {
h->hpc.pred8x8[sl->chroma_pred_mode](dest_cb, VAR_5);
h->hpc.pred8x8[sl->chroma_pred_mode](dest_cr, VAR_5);
}
hl_decode_mb_predict_luma(h, sl, VAR_3, SIMPLE,
VAR_9, PIXEL_SHIFT,
VAR_8, VAR_4, dest_y, 0);
if (sl->deblocking_filter)
xchg_mb_border(h, sl, dest_y, dest_cb, dest_cr, VAR_4,
VAR_5, 0, 0, SIMPLE, PIXEL_SHIFT);
} else {
if (VAR_15) {
FUNC_0(hl_motion_422)(h, sl, dest_y, dest_cb, dest_cr,
h->qpel_put, h->h264chroma.put_h264_chroma_pixels_tab,
h->qpel_avg, h->h264chroma.avg_h264_chroma_pixels_tab,
h->h264dsp.weight_h264_pixels_tab,
h->h264dsp.biweight_h264_pixels_tab);
} else {
FUNC_0(hl_motion_420)(h, sl, dest_y, dest_cb, dest_cr,
h->qpel_put, h->h264chroma.put_h264_chroma_pixels_tab,
h->qpel_avg, h->h264chroma.avg_h264_chroma_pixels_tab,
h->h264dsp.weight_h264_pixels_tab,
h->h264dsp.biweight_h264_pixels_tab);
}
}
hl_decode_mb_idct_luma(h, sl, VAR_3, SIMPLE, VAR_9,
PIXEL_SHIFT, VAR_8, VAR_4, dest_y, 0);
if ((SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) &&
(sl->cbp & 0x30)) {
uint8_t *dest[2] = { dest_cb, dest_cr };
if (VAR_9) {
if (IS_INTRA(VAR_3) && h->sps.profile_idc == 244 &&
(sl->chroma_pred_mode == VERT_PRED8x8 ||
sl->chroma_pred_mode == HOR_PRED8x8)) {
h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[0],
VAR_8 + 16,
sl->mb + (16 * 16 * 1 << PIXEL_SHIFT),
VAR_5);
h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[1],
VAR_8 + 32,
sl->mb + (16 * 16 * 2 << PIXEL_SHIFT),
VAR_5);
} else {
VAR_10 = h->h264dsp.h264_add_pixels4_clear;
for (VAR_18 = 1; VAR_18 < 3; VAR_18++) {
for (VAR_6 = VAR_18 * 16; VAR_6 < VAR_18 * 16 + 4; VAR_6++)
if (sl->non_zero_count_cache[scan8[VAR_6]] ||
dctcoef_get(sl->mb, PIXEL_SHIFT, VAR_6 * 16))
VAR_10(dest[VAR_18 - 1] + VAR_8[VAR_6],
sl->mb + (VAR_6 * 16 << PIXEL_SHIFT),
VAR_5);
if (VAR_15) {
for (VAR_6 = VAR_18 * 16 + 4; VAR_6 < VAR_18 * 16 + 8; VAR_6++)
if (sl->non_zero_count_cache[scan8[VAR_6 + 4]] ||
dctcoef_get(sl->mb, PIXEL_SHIFT, VAR_6 * 16))
VAR_10(dest[VAR_18 - 1] + VAR_8[VAR_6 + 4],
sl->mb + (VAR_6 * 16 << PIXEL_SHIFT),
VAR_5);
}
}
}
} else {
int VAR_20[2];
if (VAR_15) {
VAR_20[0] = sl->chroma_qp[0] + 3;
VAR_20[1] = sl->chroma_qp[1] + 3;
} else {
VAR_20[0] = sl->chroma_qp[0];
VAR_20[1] = sl->chroma_qp[1];
}
if (sl->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 0]])
h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + (16 * 16 * 1 << PIXEL_SHIFT),
h->dequant4_coeff[IS_INTRA(VAR_3) ? 1 : 4][VAR_20[0]][0]);
if (sl->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 1]])
h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + (16 * 16 * 2 << PIXEL_SHIFT),
h->dequant4_coeff[IS_INTRA(VAR_3) ? 2 : 5][VAR_20[1]][0]);
h->h264dsp.h264_idct_add8(dest, VAR_8,
sl->mb, VAR_5,
sl->non_zero_count_cache);
}
}
}
}
|
[
"static av_noinline void FUNC_0(hl_decode_mb)(const H264Context *h, H264SliceContext *sl)\n{",
"const int VAR_0 = sl->VAR_0;",
"const int VAR_1 = sl->VAR_1;",
"const int VAR_2 = sl->VAR_2;",
"const int VAR_3 = h->cur_pic.VAR_3[VAR_2];",
"uint8_t *dest_y, *dest_cb, *dest_cr;",
"int VAR_4, VAR_5 ;",
"int VAR_6, VAR_18;",
"const int *VAR_8 = &h->VAR_8[0];",
"const int VAR_9 = !SIMPLE && (sl->qscale == 0 && h->sps.VAR_9);",
"void (*VAR_10)(uint8_t *VAR_11, int16_t *VAR_12, int VAR_13);",
"const int VAR_14 = 16 >> h->chroma_y_shift;",
"const int VAR_15 = CHROMA422(h);",
"dest_y = h->cur_pic.f->data[0] + ((VAR_0 << PIXEL_SHIFT) + VAR_1 * sl->VAR_4) * 16;",
"dest_cb = h->cur_pic.f->data[1] + (VAR_0 << PIXEL_SHIFT) * 8 + VAR_1 * sl->VAR_5 * VAR_14;",
"dest_cr = h->cur_pic.f->data[2] + (VAR_0 << PIXEL_SHIFT) * 8 + VAR_1 * sl->VAR_5 * VAR_14;",
"h->vdsp.prefetch(dest_y + (sl->VAR_0 & 3) * 4 * sl->VAR_4 + (64 << PIXEL_SHIFT), sl->VAR_4, 4);",
"h->vdsp.prefetch(dest_cb + (sl->VAR_0 & 7) * sl->VAR_5 + (64 << PIXEL_SHIFT), dest_cr - dest_cb, 2);",
"h->list_counts[VAR_2] = sl->list_count;",
"if (!SIMPLE && MB_FIELD(sl)) {",
"VAR_4 = sl->mb_linesize = sl->VAR_4 * 2;",
"VAR_5 = sl->mb_uvlinesize = sl->VAR_5 * 2;",
"VAR_8 = &h->VAR_8[48];",
"if (VAR_1 & 1) {",
"dest_y -= sl->VAR_4 * 15;",
"dest_cb -= sl->VAR_5 * (VAR_14 - 1);",
"dest_cr -= sl->VAR_5 * (VAR_14 - 1);",
"}",
"if (FRAME_MBAFF(h)) {",
"int VAR_16;",
"for (VAR_16 = 0; VAR_16 < sl->list_count; VAR_16++) {",
"if (!USES_LIST(VAR_3, VAR_16))\ncontinue;",
"if (IS_16X16(VAR_3)) {",
"int8_t *ref = &sl->ref_cache[VAR_16][scan8[0]];",
"fill_rectangle(ref, 4, 4, 8, (16 + *ref) ^ (sl->VAR_1 & 1), 1);",
"} else {",
"for (VAR_6 = 0; VAR_6 < 16; VAR_6 += 4) {",
"int ref = sl->ref_cache[VAR_16][scan8[VAR_6]];",
"if (ref >= 0)\nfill_rectangle(&sl->ref_cache[VAR_16][scan8[VAR_6]], 2, 2,\n8, (16 + ref) ^ (sl->VAR_1 & 1), 1);",
"}",
"}",
"}",
"}",
"} else {",
"VAR_4 = sl->mb_linesize = sl->VAR_4;",
"VAR_5 = sl->mb_uvlinesize = sl->VAR_5;",
"}",
"if (!SIMPLE && IS_INTRA_PCM(VAR_3)) {",
"if (PIXEL_SHIFT) {",
"const int VAR_17 = h->sps.bit_depth_luma;",
"int VAR_18;",
"GetBitContext gb;",
"init_get_bits(&gb, sl->intra_pcm_ptr,\nff_h264_mb_sizes[h->sps.chroma_format_idc] * VAR_17);",
"for (VAR_6 = 0; VAR_6 < 16; VAR_6++) {",
"uint16_t *tmp_y = (uint16_t *)(dest_y + VAR_6 * VAR_4);",
"for (VAR_18 = 0; VAR_18 < 16; VAR_18++)",
"tmp_y[VAR_18] = get_bits(&gb, VAR_17);",
"}",
"if (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) {",
"if (!h->sps.chroma_format_idc) {",
"for (VAR_6 = 0; VAR_6 < VAR_14; VAR_6++) {",
"uint16_t *tmp_cb = (uint16_t *)(dest_cb + VAR_6 * VAR_5);",
"for (VAR_18 = 0; VAR_18 < 8; VAR_18++)",
"tmp_cb[VAR_18] = 1 << (VAR_17 - 1);",
"}",
"for (VAR_6 = 0; VAR_6 < VAR_14; VAR_6++) {",
"uint16_t *tmp_cr = (uint16_t *)(dest_cr + VAR_6 * VAR_5);",
"for (VAR_18 = 0; VAR_18 < 8; VAR_18++)",
"tmp_cr[VAR_18] = 1 << (VAR_17 - 1);",
"}",
"} else {",
"for (VAR_6 = 0; VAR_6 < VAR_14; VAR_6++) {",
"uint16_t *tmp_cb = (uint16_t *)(dest_cb + VAR_6 * VAR_5);",
"for (VAR_18 = 0; VAR_18 < 8; VAR_18++)",
"tmp_cb[VAR_18] = get_bits(&gb, VAR_17);",
"}",
"for (VAR_6 = 0; VAR_6 < VAR_14; VAR_6++) {",
"uint16_t *tmp_cr = (uint16_t *)(dest_cr + VAR_6 * VAR_5);",
"for (VAR_18 = 0; VAR_18 < 8; VAR_18++)",
"tmp_cr[VAR_18] = get_bits(&gb, VAR_17);",
"}",
"}",
"}",
"} else {",
"for (VAR_6 = 0; VAR_6 < 16; VAR_6++)",
"memcpy(dest_y + VAR_6 * VAR_4, sl->intra_pcm_ptr + VAR_6 * 16, 16);",
"if (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) {",
"if (!h->sps.chroma_format_idc) {",
"for (VAR_6 = 0; VAR_6 < VAR_14; VAR_6++) {",
"memset(dest_cb + VAR_6 * VAR_5, 128, 8);",
"memset(dest_cr + VAR_6 * VAR_5, 128, 8);",
"}",
"} else {",
"const uint8_t *VAR_18 = sl->intra_pcm_ptr + 256;",
"const uint8_t *VAR_19 = sl->intra_pcm_ptr + 256 + VAR_14 * 8;",
"for (VAR_6 = 0; VAR_6 < VAR_14; VAR_6++) {",
"memcpy(dest_cb + VAR_6 * VAR_5, VAR_18 + VAR_6 * 8, 8);",
"memcpy(dest_cr + VAR_6 * VAR_5, VAR_19 + VAR_6 * 8, 8);",
"}",
"}",
"}",
"}",
"} else {",
"if (IS_INTRA(VAR_3)) {",
"if (sl->deblocking_filter)\nxchg_mb_border(h, sl, dest_y, dest_cb, dest_cr, VAR_4,\nVAR_5, 1, 0, SIMPLE, PIXEL_SHIFT);",
"if (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) {",
"h->hpc.pred8x8[sl->chroma_pred_mode](dest_cb, VAR_5);",
"h->hpc.pred8x8[sl->chroma_pred_mode](dest_cr, VAR_5);",
"}",
"hl_decode_mb_predict_luma(h, sl, VAR_3, SIMPLE,\nVAR_9, PIXEL_SHIFT,\nVAR_8, VAR_4, dest_y, 0);",
"if (sl->deblocking_filter)\nxchg_mb_border(h, sl, dest_y, dest_cb, dest_cr, VAR_4,\nVAR_5, 0, 0, SIMPLE, PIXEL_SHIFT);",
"} else {",
"if (VAR_15) {",
"FUNC_0(hl_motion_422)(h, sl, dest_y, dest_cb, dest_cr,\nh->qpel_put, h->h264chroma.put_h264_chroma_pixels_tab,\nh->qpel_avg, h->h264chroma.avg_h264_chroma_pixels_tab,\nh->h264dsp.weight_h264_pixels_tab,\nh->h264dsp.biweight_h264_pixels_tab);",
"} else {",
"FUNC_0(hl_motion_420)(h, sl, dest_y, dest_cb, dest_cr,\nh->qpel_put, h->h264chroma.put_h264_chroma_pixels_tab,\nh->qpel_avg, h->h264chroma.avg_h264_chroma_pixels_tab,\nh->h264dsp.weight_h264_pixels_tab,\nh->h264dsp.biweight_h264_pixels_tab);",
"}",
"}",
"hl_decode_mb_idct_luma(h, sl, VAR_3, SIMPLE, VAR_9,\nPIXEL_SHIFT, VAR_8, VAR_4, dest_y, 0);",
"if ((SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) &&\n(sl->cbp & 0x30)) {",
"uint8_t *dest[2] = { dest_cb, dest_cr };",
"if (VAR_9) {",
"if (IS_INTRA(VAR_3) && h->sps.profile_idc == 244 &&\n(sl->chroma_pred_mode == VERT_PRED8x8 ||\nsl->chroma_pred_mode == HOR_PRED8x8)) {",
"h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[0],\nVAR_8 + 16,\nsl->mb + (16 * 16 * 1 << PIXEL_SHIFT),\nVAR_5);",
"h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[1],\nVAR_8 + 32,\nsl->mb + (16 * 16 * 2 << PIXEL_SHIFT),\nVAR_5);",
"} else {",
"VAR_10 = h->h264dsp.h264_add_pixels4_clear;",
"for (VAR_18 = 1; VAR_18 < 3; VAR_18++) {",
"for (VAR_6 = VAR_18 * 16; VAR_6 < VAR_18 * 16 + 4; VAR_6++)",
"if (sl->non_zero_count_cache[scan8[VAR_6]] ||\ndctcoef_get(sl->mb, PIXEL_SHIFT, VAR_6 * 16))\nVAR_10(dest[VAR_18 - 1] + VAR_8[VAR_6],\nsl->mb + (VAR_6 * 16 << PIXEL_SHIFT),\nVAR_5);",
"if (VAR_15) {",
"for (VAR_6 = VAR_18 * 16 + 4; VAR_6 < VAR_18 * 16 + 8; VAR_6++)",
"if (sl->non_zero_count_cache[scan8[VAR_6 + 4]] ||\ndctcoef_get(sl->mb, PIXEL_SHIFT, VAR_6 * 16))\nVAR_10(dest[VAR_18 - 1] + VAR_8[VAR_6 + 4],\nsl->mb + (VAR_6 * 16 << PIXEL_SHIFT),\nVAR_5);",
"}",
"}",
"}",
"} else {",
"int VAR_20[2];",
"if (VAR_15) {",
"VAR_20[0] = sl->chroma_qp[0] + 3;",
"VAR_20[1] = sl->chroma_qp[1] + 3;",
"} else {",
"VAR_20[0] = sl->chroma_qp[0];",
"VAR_20[1] = sl->chroma_qp[1];",
"}",
"if (sl->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 0]])\nh->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + (16 * 16 * 1 << PIXEL_SHIFT),\nh->dequant4_coeff[IS_INTRA(VAR_3) ? 1 : 4][VAR_20[0]][0]);",
"if (sl->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 1]])\nh->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + (16 * 16 * 2 << PIXEL_SHIFT),\nh->dequant4_coeff[IS_INTRA(VAR_3) ? 2 : 5][VAR_20[1]][0]);",
"h->h264dsp.h264_idct_add8(dest, VAR_8,\nsl->mb, VAR_5,\nsl->non_zero_count_cache);",
"}",
"}",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
31
],
[
33
],
[
35
],
[
39
],
[
41
],
[
45
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73,
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89,
91,
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
111
],
[
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
],
[
171
],
[
173
],
[
175
],
[
177
],
[
179
],
[
181
],
[
183
],
[
185
],
[
187
],
[
189
],
[
191
],
[
193
],
[
195
],
[
197
],
[
199
],
[
201
],
[
203
],
[
205
],
[
207
],
[
209
],
[
211
],
[
213
],
[
215
],
[
217
],
[
219
],
[
221
],
[
223
],
[
225
],
[
227
],
[
229
],
[
231
],
[
233,
235,
237
],
[
241
],
[
243
],
[
245
],
[
247
],
[
251,
253,
255
],
[
259,
261,
263
],
[
265
],
[
267
],
[
269,
271,
273,
275,
277
],
[
279
],
[
281,
283,
285,
287,
289
],
[
291
],
[
293
],
[
297,
299
],
[
303,
305
],
[
307
],
[
309
],
[
311,
313,
315
],
[
317,
319,
321,
323
],
[
325,
327,
329,
331
],
[
333
],
[
335
],
[
337
],
[
339
],
[
341,
343,
345,
347,
349
],
[
351
],
[
353
],
[
355,
357,
359,
361,
363
],
[
365
],
[
367
],
[
369
],
[
371
],
[
373
],
[
375
],
[
377
],
[
379
],
[
381
],
[
383
],
[
385
],
[
387
],
[
389,
391,
393
],
[
395,
397,
399
],
[
401,
403,
405
],
[
407
],
[
409
],
[
411
],
[
413
]
] |
7,277 |
static int rtp_read(URLContext *h, uint8_t *buf, int size)
{
RTPContext *s = h->priv_data;
struct sockaddr_storage from;
socklen_t from_len;
int len, fd_max, n;
fd_set rfds;
struct timeval tv;
#if 0
for(;;) {
from_len = sizeof(from);
len = recvfrom (s->rtp_fd, buf, size, 0,
(struct sockaddr *)&from, &from_len);
if (len < 0) {
if (ff_neterrno() == FF_NETERROR(EAGAIN) ||
ff_neterrno() == FF_NETERROR(EINTR))
continue;
return AVERROR(EIO);
}
break;
}
#else
for(;;) {
if (url_interrupt_cb())
return AVERROR(EINTR);
/* build fdset to listen to RTP and RTCP packets */
FD_ZERO(&rfds);
fd_max = s->rtp_fd;
FD_SET(s->rtp_fd, &rfds);
if (s->rtcp_fd > fd_max)
fd_max = s->rtcp_fd;
FD_SET(s->rtcp_fd, &rfds);
tv.tv_sec = 0;
tv.tv_usec = 100 * 1000;
n = select(fd_max + 1, &rfds, NULL, NULL, &tv);
if (n > 0) {
/* first try RTCP */
if (FD_ISSET(s->rtcp_fd, &rfds)) {
from_len = sizeof(from);
len = recvfrom (s->rtcp_fd, buf, size, 0,
(struct sockaddr *)&from, &from_len);
if (len < 0) {
if (ff_neterrno() == FF_NETERROR(EAGAIN) ||
ff_neterrno() == FF_NETERROR(EINTR))
continue;
return AVERROR(EIO);
}
break;
}
/* then RTP */
if (FD_ISSET(s->rtp_fd, &rfds)) {
from_len = sizeof(from);
len = recvfrom (s->rtp_fd, buf, size, 0,
(struct sockaddr *)&from, &from_len);
if (len < 0) {
if (ff_neterrno() == FF_NETERROR(EAGAIN) ||
ff_neterrno() == FF_NETERROR(EINTR))
continue;
return AVERROR(EIO);
}
break;
}
} else if (n < 0) {
if (ff_neterrno() == FF_NETERROR(EINTR))
continue;
return AVERROR(EIO);
}
}
#endif
return len;
}
| false |
FFmpeg
|
d0eb91ad0451cdb6c062b2d4760bfa7f8bb4db6b
|
static int rtp_read(URLContext *h, uint8_t *buf, int size)
{
RTPContext *s = h->priv_data;
struct sockaddr_storage from;
socklen_t from_len;
int len, fd_max, n;
fd_set rfds;
struct timeval tv;
#if 0
for(;;) {
from_len = sizeof(from);
len = recvfrom (s->rtp_fd, buf, size, 0,
(struct sockaddr *)&from, &from_len);
if (len < 0) {
if (ff_neterrno() == FF_NETERROR(EAGAIN) ||
ff_neterrno() == FF_NETERROR(EINTR))
continue;
return AVERROR(EIO);
}
break;
}
#else
for(;;) {
if (url_interrupt_cb())
return AVERROR(EINTR);
FD_ZERO(&rfds);
fd_max = s->rtp_fd;
FD_SET(s->rtp_fd, &rfds);
if (s->rtcp_fd > fd_max)
fd_max = s->rtcp_fd;
FD_SET(s->rtcp_fd, &rfds);
tv.tv_sec = 0;
tv.tv_usec = 100 * 1000;
n = select(fd_max + 1, &rfds, NULL, NULL, &tv);
if (n > 0) {
if (FD_ISSET(s->rtcp_fd, &rfds)) {
from_len = sizeof(from);
len = recvfrom (s->rtcp_fd, buf, size, 0,
(struct sockaddr *)&from, &from_len);
if (len < 0) {
if (ff_neterrno() == FF_NETERROR(EAGAIN) ||
ff_neterrno() == FF_NETERROR(EINTR))
continue;
return AVERROR(EIO);
}
break;
}
if (FD_ISSET(s->rtp_fd, &rfds)) {
from_len = sizeof(from);
len = recvfrom (s->rtp_fd, buf, size, 0,
(struct sockaddr *)&from, &from_len);
if (len < 0) {
if (ff_neterrno() == FF_NETERROR(EAGAIN) ||
ff_neterrno() == FF_NETERROR(EINTR))
continue;
return AVERROR(EIO);
}
break;
}
} else if (n < 0) {
if (ff_neterrno() == FF_NETERROR(EINTR))
continue;
return AVERROR(EIO);
}
}
#endif
return len;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(URLContext *VAR_0, uint8_t *VAR_1, int VAR_2)
{
RTPContext *s = VAR_0->priv_data;
struct sockaddr_storage VAR_3;
socklen_t from_len;
int VAR_4, VAR_5, VAR_6;
fd_set rfds;
struct timeval VAR_7;
#if 0
for(;;) {
from_len = sizeof(VAR_3);
VAR_4 = recvfrom (s->rtp_fd, VAR_1, VAR_2, 0,
(struct sockaddr *)&VAR_3, &from_len);
if (VAR_4 < 0) {
if (ff_neterrno() == FF_NETERROR(EAGAIN) ||
ff_neterrno() == FF_NETERROR(EINTR))
continue;
return AVERROR(EIO);
}
break;
}
#else
for(;;) {
if (url_interrupt_cb())
return AVERROR(EINTR);
FD_ZERO(&rfds);
VAR_5 = s->rtp_fd;
FD_SET(s->rtp_fd, &rfds);
if (s->rtcp_fd > VAR_5)
VAR_5 = s->rtcp_fd;
FD_SET(s->rtcp_fd, &rfds);
VAR_7.tv_sec = 0;
VAR_7.tv_usec = 100 * 1000;
VAR_6 = select(VAR_5 + 1, &rfds, NULL, NULL, &VAR_7);
if (VAR_6 > 0) {
if (FD_ISSET(s->rtcp_fd, &rfds)) {
from_len = sizeof(VAR_3);
VAR_4 = recvfrom (s->rtcp_fd, VAR_1, VAR_2, 0,
(struct sockaddr *)&VAR_3, &from_len);
if (VAR_4 < 0) {
if (ff_neterrno() == FF_NETERROR(EAGAIN) ||
ff_neterrno() == FF_NETERROR(EINTR))
continue;
return AVERROR(EIO);
}
break;
}
if (FD_ISSET(s->rtp_fd, &rfds)) {
from_len = sizeof(VAR_3);
VAR_4 = recvfrom (s->rtp_fd, VAR_1, VAR_2, 0,
(struct sockaddr *)&VAR_3, &from_len);
if (VAR_4 < 0) {
if (ff_neterrno() == FF_NETERROR(EAGAIN) ||
ff_neterrno() == FF_NETERROR(EINTR))
continue;
return AVERROR(EIO);
}
break;
}
} else if (VAR_6 < 0) {
if (ff_neterrno() == FF_NETERROR(EINTR))
continue;
return AVERROR(EIO);
}
}
#endif
return VAR_4;
}
|
[
"static int FUNC_0(URLContext *VAR_0, uint8_t *VAR_1, int VAR_2)\n{",
"RTPContext *s = VAR_0->priv_data;",
"struct sockaddr_storage VAR_3;",
"socklen_t from_len;",
"int VAR_4, VAR_5, VAR_6;",
"fd_set rfds;",
"struct timeval VAR_7;",
"#if 0\nfor(;;) {",
"from_len = sizeof(VAR_3);",
"VAR_4 = recvfrom (s->rtp_fd, VAR_1, VAR_2, 0,\n(struct sockaddr *)&VAR_3, &from_len);",
"if (VAR_4 < 0) {",
"if (ff_neterrno() == FF_NETERROR(EAGAIN) ||\nff_neterrno() == FF_NETERROR(EINTR))\ncontinue;",
"return AVERROR(EIO);",
"}",
"break;",
"}",
"#else\nfor(;;) {",
"if (url_interrupt_cb())\nreturn AVERROR(EINTR);",
"FD_ZERO(&rfds);",
"VAR_5 = s->rtp_fd;",
"FD_SET(s->rtp_fd, &rfds);",
"if (s->rtcp_fd > VAR_5)\nVAR_5 = s->rtcp_fd;",
"FD_SET(s->rtcp_fd, &rfds);",
"VAR_7.tv_sec = 0;",
"VAR_7.tv_usec = 100 * 1000;",
"VAR_6 = select(VAR_5 + 1, &rfds, NULL, NULL, &VAR_7);",
"if (VAR_6 > 0) {",
"if (FD_ISSET(s->rtcp_fd, &rfds)) {",
"from_len = sizeof(VAR_3);",
"VAR_4 = recvfrom (s->rtcp_fd, VAR_1, VAR_2, 0,\n(struct sockaddr *)&VAR_3, &from_len);",
"if (VAR_4 < 0) {",
"if (ff_neterrno() == FF_NETERROR(EAGAIN) ||\nff_neterrno() == FF_NETERROR(EINTR))\ncontinue;",
"return AVERROR(EIO);",
"}",
"break;",
"}",
"if (FD_ISSET(s->rtp_fd, &rfds)) {",
"from_len = sizeof(VAR_3);",
"VAR_4 = recvfrom (s->rtp_fd, VAR_1, VAR_2, 0,\n(struct sockaddr *)&VAR_3, &from_len);",
"if (VAR_4 < 0) {",
"if (ff_neterrno() == FF_NETERROR(EAGAIN) ||\nff_neterrno() == FF_NETERROR(EINTR))\ncontinue;",
"return AVERROR(EIO);",
"}",
"break;",
"}",
"} else if (VAR_6 < 0) {",
"if (ff_neterrno() == FF_NETERROR(EINTR))\ncontinue;",
"return AVERROR(EIO);",
"}",
"}",
"#endif\nreturn 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
] |
[
[
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
],
[
53
],
[
55
],
[
57
],
[
59,
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
75
],
[
77
],
[
79,
81
],
[
83
],
[
85,
87,
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
101
],
[
103
],
[
105,
107
],
[
109
],
[
111,
113,
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127,
129
],
[
131
],
[
133
],
[
135
],
[
137,
139
],
[
141
]
] |
7,278 |
static int load_apply_palette(FFFrameSync *fs)
{
AVFilterContext *ctx = fs->parent;
AVFilterLink *inlink = ctx->inputs[0];
PaletteUseContext *s = ctx->priv;
AVFrame *master, *second, *out;
int ret;
// writable for error diffusal dithering
ret = ff_framesync_dualinput_get_writable(fs, &master, &second);
if (ret < 0)
return ret;
if (!master || !second) {
ret = AVERROR_BUG;
goto error;
}
if (!s->palette_loaded) {
load_palette(s, second);
}
out = apply_palette(inlink, master);
return ff_filter_frame(ctx->outputs[0], out);
error:
av_frame_free(&master);
av_frame_free(&second);
return ret;
}
| false |
FFmpeg
|
6470abc740367cc881c181db866891f8dd1d342f
|
static int load_apply_palette(FFFrameSync *fs)
{
AVFilterContext *ctx = fs->parent;
AVFilterLink *inlink = ctx->inputs[0];
PaletteUseContext *s = ctx->priv;
AVFrame *master, *second, *out;
int ret;
ret = ff_framesync_dualinput_get_writable(fs, &master, &second);
if (ret < 0)
return ret;
if (!master || !second) {
ret = AVERROR_BUG;
goto error;
}
if (!s->palette_loaded) {
load_palette(s, second);
}
out = apply_palette(inlink, master);
return ff_filter_frame(ctx->outputs[0], out);
error:
av_frame_free(&master);
av_frame_free(&second);
return ret;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(FFFrameSync *VAR_0)
{
AVFilterContext *ctx = VAR_0->parent;
AVFilterLink *inlink = ctx->inputs[0];
PaletteUseContext *s = ctx->priv;
AVFrame *master, *second, *out;
int VAR_1;
VAR_1 = ff_framesync_dualinput_get_writable(VAR_0, &master, &second);
if (VAR_1 < 0)
return VAR_1;
if (!master || !second) {
VAR_1 = AVERROR_BUG;
goto error;
}
if (!s->palette_loaded) {
load_palette(s, second);
}
out = apply_palette(inlink, master);
return ff_filter_frame(ctx->outputs[0], out);
error:
av_frame_free(&master);
av_frame_free(&second);
return VAR_1;
}
|
[
"static int FUNC_0(FFFrameSync *VAR_0)\n{",
"AVFilterContext *ctx = VAR_0->parent;",
"AVFilterLink *inlink = ctx->inputs[0];",
"PaletteUseContext *s = ctx->priv;",
"AVFrame *master, *second, *out;",
"int VAR_1;",
"VAR_1 = ff_framesync_dualinput_get_writable(VAR_0, &master, &second);",
"if (VAR_1 < 0)\nreturn VAR_1;",
"if (!master || !second) {",
"VAR_1 = AVERROR_BUG;",
"goto error;",
"}",
"if (!s->palette_loaded) {",
"load_palette(s, second);",
"}",
"out = apply_palette(inlink, master);",
"return ff_filter_frame(ctx->outputs[0], out);",
"error:\nav_frame_free(&master);",
"av_frame_free(&second);",
"return VAR_1;",
"}"
] |
[
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
],
[
19
],
[
21,
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
45,
47
],
[
49
],
[
51
],
[
53
]
] |
7,279 |
static void test_parse_invalid_path(void)
{
g_test_trap_subprocess ("/logging/parse_invalid_path/subprocess", 0, 0);
g_test_trap_assert_passed();
g_test_trap_assert_stdout("");
g_test_trap_assert_stderr("Bad logfile format: /tmp/qemu-%d%d.log\n");
}
| true |
qemu
|
daa76aa416b1e18ab1fac650ff53d966d8f21f68
|
static void test_parse_invalid_path(void)
{
g_test_trap_subprocess ("/logging/parse_invalid_path/subprocess", 0, 0);
g_test_trap_assert_passed();
g_test_trap_assert_stdout("");
g_test_trap_assert_stderr("Bad logfile format: /tmp/qemu-%d%d.log\n");
}
|
{
"code": [
" g_test_trap_assert_passed();",
" g_test_trap_assert_stdout(\"\");",
"static void test_parse_invalid_path(void)",
" g_test_trap_subprocess (\"/logging/parse_invalid_path/subprocess\", 0, 0);",
" g_test_trap_assert_passed();",
" g_test_trap_assert_stdout(\"\");",
" g_test_trap_assert_stderr(\"Bad logfile format: /tmp/qemu-%d%d.log\\n\");"
],
"line_no": [
7,
9,
1,
5,
7,
9,
11
]
}
|
static void FUNC_0(void)
{
g_test_trap_subprocess ("/logging/parse_invalid_path/subprocess", 0, 0);
g_test_trap_assert_passed();
g_test_trap_assert_stdout("");
g_test_trap_assert_stderr("Bad logfile format: /tmp/qemu-%d%d.log\n");
}
|
[
"static void FUNC_0(void)\n{",
"g_test_trap_subprocess (\"/logging/parse_invalid_path/subprocess\", 0, 0);",
"g_test_trap_assert_passed();",
"g_test_trap_assert_stdout(\"\");",
"g_test_trap_assert_stderr(\"Bad logfile format: /tmp/qemu-%d%d.log\\n\");",
"}"
] |
[
1,
1,
1,
1,
1,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
]
] |
7,280 |
void bdrv_iterate_format(void (*it)(void *opaque, const char *name),
void *opaque)
{
BlockDriver *drv;
int count = 0;
const char **formats = NULL;
QLIST_FOREACH(drv, &bdrv_drivers, list) {
if (drv->format_name) {
bool found = false;
int i = count;
while (formats && i && !found) {
found = !strcmp(formats[--i], drv->format_name);
}
if (!found) {
formats = g_realloc(formats, (count + 1) * sizeof(char *));
formats[count++] = drv->format_name;
it(opaque, drv->format_name);
}
}
}
g_free(formats);
}
| true |
qemu
|
5839e53bbc0fec56021d758aab7610df421ed8c8
|
void bdrv_iterate_format(void (*it)(void *opaque, const char *name),
void *opaque)
{
BlockDriver *drv;
int count = 0;
const char **formats = NULL;
QLIST_FOREACH(drv, &bdrv_drivers, list) {
if (drv->format_name) {
bool found = false;
int i = count;
while (formats && i && !found) {
found = !strcmp(formats[--i], drv->format_name);
}
if (!found) {
formats = g_realloc(formats, (count + 1) * sizeof(char *));
formats[count++] = drv->format_name;
it(opaque, drv->format_name);
}
}
}
g_free(formats);
}
|
{
"code": [
" formats = g_realloc(formats, (count + 1) * sizeof(char *));"
],
"line_no": [
33
]
}
|
void FUNC_0(void (*VAR_0)(void *VAR_3, const char *VAR_2),
void *VAR_3)
{
BlockDriver *drv;
int VAR_3 = 0;
const char **VAR_4 = NULL;
QLIST_FOREACH(drv, &bdrv_drivers, list) {
if (drv->format_name) {
bool found = false;
int i = VAR_3;
while (VAR_4 && i && !found) {
found = !strcmp(VAR_4[--i], drv->format_name);
}
if (!found) {
VAR_4 = g_realloc(VAR_4, (VAR_3 + 1) * sizeof(char *));
VAR_4[VAR_3++] = drv->format_name;
VAR_0(VAR_3, drv->format_name);
}
}
}
g_free(VAR_4);
}
|
[
"void FUNC_0(void (*VAR_0)(void *VAR_3, const char *VAR_2),\nvoid *VAR_3)\n{",
"BlockDriver *drv;",
"int VAR_3 = 0;",
"const char **VAR_4 = NULL;",
"QLIST_FOREACH(drv, &bdrv_drivers, list) {",
"if (drv->format_name) {",
"bool found = false;",
"int i = VAR_3;",
"while (VAR_4 && i && !found) {",
"found = !strcmp(VAR_4[--i], drv->format_name);",
"}",
"if (!found) {",
"VAR_4 = g_realloc(VAR_4, (VAR_3 + 1) * sizeof(char *));",
"VAR_4[VAR_3++] = drv->format_name;",
"VAR_0(VAR_3, drv->format_name);",
"}",
"}",
"}",
"g_free(VAR_4);",
"}"
] |
[
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
],
[
21
],
[
23
],
[
25
],
[
27
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
]
] |
7,281 |
static int ea_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
EaDemuxContext *ea = s->priv_data;
AVStream *st;
if (!process_ea_header(s))
return AVERROR(EIO);
if (ea->video_codec) {
/* initialize the video decoder stream */
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
ea->video_stream_index = st->index;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = ea->video_codec;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->time_base = ea->time_base;
st->codec->width = ea->width;
st->codec->height = ea->height;
if (ea->audio_codec) {
if (ea->num_channels <= 0) {
av_log(s, AV_LOG_WARNING, "Unsupported number of channels: %d\n", ea->num_channels);
ea->audio_codec = 0;
if (ea->sample_rate <= 0) {
av_log(s, AV_LOG_ERROR, "Unsupported sample rate: %d\n", ea->sample_rate);
ea->audio_codec = 0;
/* initialize the audio decoder stream */
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
avpriv_set_pts_info(st, 33, 1, ea->sample_rate);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = ea->audio_codec;
st->codec->codec_tag = 0; /* no tag */
st->codec->channels = ea->num_channels;
st->codec->sample_rate = ea->sample_rate;
st->codec->bits_per_coded_sample = ea->bytes * 8;
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
st->codec->bits_per_coded_sample / 4;
st->codec->block_align = st->codec->channels*st->codec->bits_per_coded_sample;
ea->audio_stream_index = st->index;
ea->audio_frame_counter = 0;
| true |
FFmpeg
|
73b16198b6cab1cdafa46143aae7a69e10e130fd
|
static int ea_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
EaDemuxContext *ea = s->priv_data;
AVStream *st;
if (!process_ea_header(s))
return AVERROR(EIO);
if (ea->video_codec) {
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
ea->video_stream_index = st->index;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = ea->video_codec;
st->codec->codec_tag = 0;
st->codec->time_base = ea->time_base;
st->codec->width = ea->width;
st->codec->height = ea->height;
if (ea->audio_codec) {
if (ea->num_channels <= 0) {
av_log(s, AV_LOG_WARNING, "Unsupported number of channels: %d\n", ea->num_channels);
ea->audio_codec = 0;
if (ea->sample_rate <= 0) {
av_log(s, AV_LOG_ERROR, "Unsupported sample rate: %d\n", ea->sample_rate);
ea->audio_codec = 0;
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
avpriv_set_pts_info(st, 33, 1, ea->sample_rate);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = ea->audio_codec;
st->codec->codec_tag = 0;
st->codec->channels = ea->num_channels;
st->codec->sample_rate = ea->sample_rate;
st->codec->bits_per_coded_sample = ea->bytes * 8;
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
st->codec->bits_per_coded_sample / 4;
st->codec->block_align = st->codec->channels*st->codec->bits_per_coded_sample;
ea->audio_stream_index = st->index;
ea->audio_frame_counter = 0;
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(AVFormatContext *VAR_0,
AVFormatParameters *VAR_1)
{
EaDemuxContext *ea = VAR_0->priv_data;
AVStream *st;
if (!process_ea_header(VAR_0))
return AVERROR(EIO);
if (ea->video_codec) {
st = avformat_new_stream(VAR_0, NULL);
if (!st)
return AVERROR(ENOMEM);
ea->video_stream_index = st->index;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = ea->video_codec;
st->codec->codec_tag = 0;
st->codec->time_base = ea->time_base;
st->codec->width = ea->width;
st->codec->height = ea->height;
if (ea->audio_codec) {
if (ea->num_channels <= 0) {
av_log(VAR_0, AV_LOG_WARNING, "Unsupported number of channels: %d\n", ea->num_channels);
ea->audio_codec = 0;
if (ea->sample_rate <= 0) {
av_log(VAR_0, AV_LOG_ERROR, "Unsupported sample rate: %d\n", ea->sample_rate);
ea->audio_codec = 0;
st = avformat_new_stream(VAR_0, NULL);
if (!st)
return AVERROR(ENOMEM);
avpriv_set_pts_info(st, 33, 1, ea->sample_rate);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = ea->audio_codec;
st->codec->codec_tag = 0;
st->codec->channels = ea->num_channels;
st->codec->sample_rate = ea->sample_rate;
st->codec->bits_per_coded_sample = ea->bytes * 8;
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
st->codec->bits_per_coded_sample / 4;
st->codec->block_align = st->codec->channels*st->codec->bits_per_coded_sample;
ea->audio_stream_index = st->index;
ea->audio_frame_counter = 0;
|
[
"static int FUNC_0(AVFormatContext *VAR_0,\nAVFormatParameters *VAR_1)\n{",
"EaDemuxContext *ea = VAR_0->priv_data;",
"AVStream *st;",
"if (!process_ea_header(VAR_0))\nreturn AVERROR(EIO);",
"if (ea->video_codec) {",
"st = avformat_new_stream(VAR_0, NULL);",
"if (!st)\nreturn AVERROR(ENOMEM);",
"ea->video_stream_index = st->index;",
"st->codec->codec_type = AVMEDIA_TYPE_VIDEO;",
"st->codec->codec_id = ea->video_codec;",
"st->codec->codec_tag = 0;",
"st->codec->time_base = ea->time_base;",
"st->codec->width = ea->width;",
"st->codec->height = ea->height;",
"if (ea->audio_codec) {",
"if (ea->num_channels <= 0) {",
"av_log(VAR_0, AV_LOG_WARNING, \"Unsupported number of channels: %d\\n\", ea->num_channels);",
"ea->audio_codec = 0;",
"if (ea->sample_rate <= 0) {",
"av_log(VAR_0, AV_LOG_ERROR, \"Unsupported sample rate: %d\\n\", ea->sample_rate);",
"ea->audio_codec = 0;",
"st = avformat_new_stream(VAR_0, NULL);",
"if (!st)\nreturn AVERROR(ENOMEM);",
"avpriv_set_pts_info(st, 33, 1, ea->sample_rate);",
"st->codec->codec_type = AVMEDIA_TYPE_AUDIO;",
"st->codec->codec_id = ea->audio_codec;",
"st->codec->codec_tag = 0;",
"st->codec->channels = ea->num_channels;",
"st->codec->sample_rate = ea->sample_rate;",
"st->codec->bits_per_coded_sample = ea->bytes * 8;",
"st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *\nst->codec->bits_per_coded_sample / 4;",
"st->codec->block_align = st->codec->channels*st->codec->bits_per_coded_sample;",
"ea->audio_stream_index = st->index;",
"ea->audio_frame_counter = 0;"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
13,
15
],
[
19
],
[
23
],
[
25,
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
46
],
[
48
],
[
50
],
[
52
],
[
56
],
[
58
],
[
60
],
[
73
],
[
75,
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93,
95
],
[
97
],
[
99
],
[
101
]
] |
7,282 |
static int ac3_encode_frame(AVCodecContext *avctx, unsigned char *frame,
int buf_size, void *data)
{
AC3EncodeContext *s = avctx->priv_data;
const SampleType *samples = data;
int ret;
if (s->bit_alloc.sr_code == 1)
adjust_frame_size(s);
deinterleave_input_samples(s, samples);
apply_mdct(s);
compute_rematrixing_strategy(s);
scale_coefficients(s);
apply_rematrixing(s);
process_exponents(s);
ret = compute_bit_allocation(s);
if (ret) {
av_log(avctx, AV_LOG_ERROR, "Bit allocation failed. Try increasing the bitrate.\n");
return ret;
}
quantize_mantissas(s);
output_frame(s, frame);
return s->frame_size;
}
| true |
FFmpeg
|
323e6fead07c75f418e4b60704a4f437bb3483b2
|
static int ac3_encode_frame(AVCodecContext *avctx, unsigned char *frame,
int buf_size, void *data)
{
AC3EncodeContext *s = avctx->priv_data;
const SampleType *samples = data;
int ret;
if (s->bit_alloc.sr_code == 1)
adjust_frame_size(s);
deinterleave_input_samples(s, samples);
apply_mdct(s);
compute_rematrixing_strategy(s);
scale_coefficients(s);
apply_rematrixing(s);
process_exponents(s);
ret = compute_bit_allocation(s);
if (ret) {
av_log(avctx, AV_LOG_ERROR, "Bit allocation failed. Try increasing the bitrate.\n");
return ret;
}
quantize_mantissas(s);
output_frame(s, frame);
return s->frame_size;
}
|
{
"code": [
" compute_rematrixing_strategy(s);"
],
"line_no": [
29
]
}
|
static int FUNC_0(AVCodecContext *VAR_0, unsigned char *VAR_1,
int VAR_2, void *VAR_3)
{
AC3EncodeContext *s = VAR_0->priv_data;
const SampleType *VAR_4 = VAR_3;
int VAR_5;
if (s->bit_alloc.sr_code == 1)
adjust_frame_size(s);
deinterleave_input_samples(s, VAR_4);
apply_mdct(s);
compute_rematrixing_strategy(s);
scale_coefficients(s);
apply_rematrixing(s);
process_exponents(s);
VAR_5 = compute_bit_allocation(s);
if (VAR_5) {
av_log(VAR_0, AV_LOG_ERROR, "Bit allocation failed. Try increasing the bitrate.\n");
return VAR_5;
}
quantize_mantissas(s);
output_frame(s, VAR_1);
return s->frame_size;
}
|
[
"static int FUNC_0(AVCodecContext *VAR_0, unsigned char *VAR_1,\nint VAR_2, void *VAR_3)\n{",
"AC3EncodeContext *s = VAR_0->priv_data;",
"const SampleType *VAR_4 = VAR_3;",
"int VAR_5;",
"if (s->bit_alloc.sr_code == 1)\nadjust_frame_size(s);",
"deinterleave_input_samples(s, VAR_4);",
"apply_mdct(s);",
"compute_rematrixing_strategy(s);",
"scale_coefficients(s);",
"apply_rematrixing(s);",
"process_exponents(s);",
"VAR_5 = compute_bit_allocation(s);",
"if (VAR_5) {",
"av_log(VAR_0, AV_LOG_ERROR, \"Bit allocation failed. Try increasing the bitrate.\\n\");",
"return VAR_5;",
"}",
"quantize_mantissas(s);",
"output_frame(s, VAR_1);",
"return s->frame_size;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
15,
17
],
[
21
],
[
25
],
[
29
],
[
33
],
[
37
],
[
41
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
57
],
[
61
],
[
65
],
[
67
]
] |
7,283 |
static void rm_read_audio_stream_info(AVFormatContext *s, AVStream *st,
int read_all)
{
RMContext *rm = s->priv_data;
ByteIOContext *pb = &s->pb;
char buf[256];
uint32_t version;
int i;
/* ra type header */
version = get_be32(pb); /* version */
if (((version >> 16) & 0xff) == 3) {
int64_t startpos = url_ftell(pb);
/* very old version */
for(i = 0; i < 14; i++)
get_byte(pb);
get_str8(pb, s->title, sizeof(s->title));
get_str8(pb, s->author, sizeof(s->author));
get_str8(pb, s->copyright, sizeof(s->copyright));
get_str8(pb, s->comment, sizeof(s->comment));
if ((startpos + (version & 0xffff)) >= url_ftell(pb) + 2) {
// fourcc (should always be "lpcJ")
get_byte(pb);
get_str8(pb, buf, sizeof(buf));
}
// Skip extra header crap (this should never happen)
if ((startpos + (version & 0xffff)) > url_ftell(pb))
url_fskip(pb, (version & 0xffff) + startpos - url_ftell(pb));
st->codec->sample_rate = 8000;
st->codec->channels = 1;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_RA_144;
} else {
int flavor, sub_packet_h, coded_framesize, sub_packet_size;
/* old version (4) */
get_be32(pb); /* .ra4 */
get_be32(pb); /* data size */
get_be16(pb); /* version2 */
get_be32(pb); /* header size */
flavor= get_be16(pb); /* add codec info / flavor */
rm->coded_framesize = coded_framesize = get_be32(pb); /* coded frame size */
get_be32(pb); /* ??? */
get_be32(pb); /* ??? */
get_be32(pb); /* ??? */
rm->sub_packet_h = sub_packet_h = get_be16(pb); /* 1 */
st->codec->block_align= get_be16(pb); /* frame size */
rm->sub_packet_size = sub_packet_size = get_be16(pb); /* sub packet size */
get_be16(pb); /* ??? */
if (((version >> 16) & 0xff) == 5) {
get_be16(pb); get_be16(pb); get_be16(pb); }
st->codec->sample_rate = get_be16(pb);
get_be32(pb);
st->codec->channels = get_be16(pb);
if (((version >> 16) & 0xff) == 5) {
get_be32(pb);
buf[0] = get_byte(pb);
buf[1] = get_byte(pb);
buf[2] = get_byte(pb);
buf[3] = get_byte(pb);
buf[4] = 0;
} else {
get_str8(pb, buf, sizeof(buf)); /* desc */
get_str8(pb, buf, sizeof(buf)); /* desc */
}
st->codec->codec_type = CODEC_TYPE_AUDIO;
if (!strcmp(buf, "dnet")) {
st->codec->codec_id = CODEC_ID_AC3;
} else if (!strcmp(buf, "28_8")) {
st->codec->codec_id = CODEC_ID_RA_288;
st->codec->extradata_size= 0;
rm->audio_framesize = st->codec->block_align;
st->codec->block_align = coded_framesize;
if(rm->audio_framesize >= UINT_MAX / sub_packet_h){
av_log(s, AV_LOG_ERROR, "rm->audio_framesize * sub_packet_h too large\n");
return -1;
}
rm->audiobuf = av_malloc(rm->audio_framesize * sub_packet_h);
} else if (!strcmp(buf, "cook")) {
int codecdata_length, i;
get_be16(pb); get_byte(pb);
if (((version >> 16) & 0xff) == 5)
get_byte(pb);
codecdata_length = get_be32(pb);
if(codecdata_length + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){
av_log(s, AV_LOG_ERROR, "codecdata_length too large\n");
return -1;
}
st->codec->codec_id = CODEC_ID_COOK;
st->codec->extradata_size= codecdata_length;
st->codec->extradata= av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
for(i = 0; i < codecdata_length; i++)
((uint8_t*)st->codec->extradata)[i] = get_byte(pb);
rm->audio_framesize = st->codec->block_align;
st->codec->block_align = rm->sub_packet_size;
if(rm->audio_framesize >= UINT_MAX / sub_packet_h){
av_log(s, AV_LOG_ERROR, "rm->audio_framesize * sub_packet_h too large\n");
return -1;
}
rm->audiobuf = av_malloc(rm->audio_framesize * sub_packet_h);
} else if (!strcmp(buf, "raac") || !strcmp(buf, "racp")) {
int codecdata_length, i;
get_be16(pb); get_byte(pb);
if (((version >> 16) & 0xff) == 5)
get_byte(pb);
st->codec->codec_id = CODEC_ID_AAC;
codecdata_length = get_be32(pb);
if (codecdata_length >= 1) {
st->codec->extradata_size = codecdata_length - 1;
st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
get_byte(pb);
for(i = 0; i < st->codec->extradata_size; i++)
((uint8_t*)st->codec->extradata)[i] = get_byte(pb);
}
} else {
st->codec->codec_id = CODEC_ID_NONE;
pstrcpy(st->codec->codec_name, sizeof(st->codec->codec_name),
buf);
}
if (read_all) {
get_byte(pb);
get_byte(pb);
get_byte(pb);
get_str8(pb, s->title, sizeof(s->title));
get_str8(pb, s->author, sizeof(s->author));
get_str8(pb, s->copyright, sizeof(s->copyright));
get_str8(pb, s->comment, sizeof(s->comment));
}
}
}
| true |
FFmpeg
|
a9d4a6ef3437d316450c2e30b9ed6a8fd4df4804
|
static void rm_read_audio_stream_info(AVFormatContext *s, AVStream *st,
int read_all)
{
RMContext *rm = s->priv_data;
ByteIOContext *pb = &s->pb;
char buf[256];
uint32_t version;
int i;
version = get_be32(pb);
if (((version >> 16) & 0xff) == 3) {
int64_t startpos = url_ftell(pb);
for(i = 0; i < 14; i++)
get_byte(pb);
get_str8(pb, s->title, sizeof(s->title));
get_str8(pb, s->author, sizeof(s->author));
get_str8(pb, s->copyright, sizeof(s->copyright));
get_str8(pb, s->comment, sizeof(s->comment));
if ((startpos + (version & 0xffff)) >= url_ftell(pb) + 2) {
get_byte(pb);
get_str8(pb, buf, sizeof(buf));
}
if ((startpos + (version & 0xffff)) > url_ftell(pb))
url_fskip(pb, (version & 0xffff) + startpos - url_ftell(pb));
st->codec->sample_rate = 8000;
st->codec->channels = 1;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_RA_144;
} else {
int flavor, sub_packet_h, coded_framesize, sub_packet_size;
get_be32(pb);
get_be32(pb);
get_be16(pb);
get_be32(pb);
flavor= get_be16(pb);
rm->coded_framesize = coded_framesize = get_be32(pb);
get_be32(pb);
get_be32(pb);
get_be32(pb);
rm->sub_packet_h = sub_packet_h = get_be16(pb);
st->codec->block_align= get_be16(pb);
rm->sub_packet_size = sub_packet_size = get_be16(pb);
get_be16(pb);
if (((version >> 16) & 0xff) == 5) {
get_be16(pb); get_be16(pb); get_be16(pb); }
st->codec->sample_rate = get_be16(pb);
get_be32(pb);
st->codec->channels = get_be16(pb);
if (((version >> 16) & 0xff) == 5) {
get_be32(pb);
buf[0] = get_byte(pb);
buf[1] = get_byte(pb);
buf[2] = get_byte(pb);
buf[3] = get_byte(pb);
buf[4] = 0;
} else {
get_str8(pb, buf, sizeof(buf));
get_str8(pb, buf, sizeof(buf));
}
st->codec->codec_type = CODEC_TYPE_AUDIO;
if (!strcmp(buf, "dnet")) {
st->codec->codec_id = CODEC_ID_AC3;
} else if (!strcmp(buf, "28_8")) {
st->codec->codec_id = CODEC_ID_RA_288;
st->codec->extradata_size= 0;
rm->audio_framesize = st->codec->block_align;
st->codec->block_align = coded_framesize;
if(rm->audio_framesize >= UINT_MAX / sub_packet_h){
av_log(s, AV_LOG_ERROR, "rm->audio_framesize * sub_packet_h too large\n");
return -1;
}
rm->audiobuf = av_malloc(rm->audio_framesize * sub_packet_h);
} else if (!strcmp(buf, "cook")) {
int codecdata_length, i;
get_be16(pb); get_byte(pb);
if (((version >> 16) & 0xff) == 5)
get_byte(pb);
codecdata_length = get_be32(pb);
if(codecdata_length + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){
av_log(s, AV_LOG_ERROR, "codecdata_length too large\n");
return -1;
}
st->codec->codec_id = CODEC_ID_COOK;
st->codec->extradata_size= codecdata_length;
st->codec->extradata= av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
for(i = 0; i < codecdata_length; i++)
((uint8_t*)st->codec->extradata)[i] = get_byte(pb);
rm->audio_framesize = st->codec->block_align;
st->codec->block_align = rm->sub_packet_size;
if(rm->audio_framesize >= UINT_MAX / sub_packet_h){
av_log(s, AV_LOG_ERROR, "rm->audio_framesize * sub_packet_h too large\n");
return -1;
}
rm->audiobuf = av_malloc(rm->audio_framesize * sub_packet_h);
} else if (!strcmp(buf, "raac") || !strcmp(buf, "racp")) {
int codecdata_length, i;
get_be16(pb); get_byte(pb);
if (((version >> 16) & 0xff) == 5)
get_byte(pb);
st->codec->codec_id = CODEC_ID_AAC;
codecdata_length = get_be32(pb);
if (codecdata_length >= 1) {
st->codec->extradata_size = codecdata_length - 1;
st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
get_byte(pb);
for(i = 0; i < st->codec->extradata_size; i++)
((uint8_t*)st->codec->extradata)[i] = get_byte(pb);
}
} else {
st->codec->codec_id = CODEC_ID_NONE;
pstrcpy(st->codec->codec_name, sizeof(st->codec->codec_name),
buf);
}
if (read_all) {
get_byte(pb);
get_byte(pb);
get_byte(pb);
get_str8(pb, s->title, sizeof(s->title));
get_str8(pb, s->author, sizeof(s->author));
get_str8(pb, s->copyright, sizeof(s->copyright));
get_str8(pb, s->comment, sizeof(s->comment));
}
}
}
|
{
"code": [
"static void rm_read_audio_stream_info(AVFormatContext *s, AVStream *st,"
],
"line_no": [
1
]
}
|
static void FUNC_0(AVFormatContext *VAR_0, AVStream *VAR_1,
int VAR_2)
{
RMContext *rm = VAR_0->priv_data;
ByteIOContext *pb = &VAR_0->pb;
char VAR_3[256];
uint32_t version;
int VAR_10;
version = get_be32(pb);
if (((version >> 16) & 0xff) == 3) {
int64_t startpos = url_ftell(pb);
for(VAR_10 = 0; VAR_10 < 14; VAR_10++)
get_byte(pb);
get_str8(pb, VAR_0->title, sizeof(VAR_0->title));
get_str8(pb, VAR_0->author, sizeof(VAR_0->author));
get_str8(pb, VAR_0->copyright, sizeof(VAR_0->copyright));
get_str8(pb, VAR_0->comment, sizeof(VAR_0->comment));
if ((startpos + (version & 0xffff)) >= url_ftell(pb) + 2) {
get_byte(pb);
get_str8(pb, VAR_3, sizeof(VAR_3));
}
if ((startpos + (version & 0xffff)) > url_ftell(pb))
url_fskip(pb, (version & 0xffff) + startpos - url_ftell(pb));
VAR_1->codec->sample_rate = 8000;
VAR_1->codec->channels = 1;
VAR_1->codec->codec_type = CODEC_TYPE_AUDIO;
VAR_1->codec->codec_id = CODEC_ID_RA_144;
} else {
int VAR_5, VAR_6, VAR_7, VAR_8;
get_be32(pb);
get_be32(pb);
get_be16(pb);
get_be32(pb);
VAR_5= get_be16(pb);
rm->VAR_7 = VAR_7 = get_be32(pb);
get_be32(pb);
get_be32(pb);
get_be32(pb);
rm->VAR_6 = VAR_6 = get_be16(pb);
VAR_1->codec->block_align= get_be16(pb);
rm->VAR_8 = VAR_8 = get_be16(pb);
get_be16(pb);
if (((version >> 16) & 0xff) == 5) {
get_be16(pb); get_be16(pb); get_be16(pb); }
VAR_1->codec->sample_rate = get_be16(pb);
get_be32(pb);
VAR_1->codec->channels = get_be16(pb);
if (((version >> 16) & 0xff) == 5) {
get_be32(pb);
VAR_3[0] = get_byte(pb);
VAR_3[1] = get_byte(pb);
VAR_3[2] = get_byte(pb);
VAR_3[3] = get_byte(pb);
VAR_3[4] = 0;
} else {
get_str8(pb, VAR_3, sizeof(VAR_3));
get_str8(pb, VAR_3, sizeof(VAR_3));
}
VAR_1->codec->codec_type = CODEC_TYPE_AUDIO;
if (!strcmp(VAR_3, "dnet")) {
VAR_1->codec->codec_id = CODEC_ID_AC3;
} else if (!strcmp(VAR_3, "28_8")) {
VAR_1->codec->codec_id = CODEC_ID_RA_288;
VAR_1->codec->extradata_size= 0;
rm->audio_framesize = VAR_1->codec->block_align;
VAR_1->codec->block_align = VAR_7;
if(rm->audio_framesize >= UINT_MAX / VAR_6){
av_log(VAR_0, AV_LOG_ERROR, "rm->audio_framesize * VAR_6 too large\n");
return -1;
}
rm->audiobuf = av_malloc(rm->audio_framesize * VAR_6);
} else if (!strcmp(VAR_3, "cook")) {
int VAR_10, VAR_10;
get_be16(pb); get_byte(pb);
if (((version >> 16) & 0xff) == 5)
get_byte(pb);
VAR_10 = get_be32(pb);
if(VAR_10 + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)VAR_10){
av_log(VAR_0, AV_LOG_ERROR, "VAR_10 too large\n");
return -1;
}
VAR_1->codec->codec_id = CODEC_ID_COOK;
VAR_1->codec->extradata_size= VAR_10;
VAR_1->codec->extradata= av_mallocz(VAR_1->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
for(VAR_10 = 0; VAR_10 < VAR_10; VAR_10++)
((uint8_t*)VAR_1->codec->extradata)[VAR_10] = get_byte(pb);
rm->audio_framesize = VAR_1->codec->block_align;
VAR_1->codec->block_align = rm->VAR_8;
if(rm->audio_framesize >= UINT_MAX / VAR_6){
av_log(VAR_0, AV_LOG_ERROR, "rm->audio_framesize * VAR_6 too large\n");
return -1;
}
rm->audiobuf = av_malloc(rm->audio_framesize * VAR_6);
} else if (!strcmp(VAR_3, "raac") || !strcmp(VAR_3, "racp")) {
int VAR_10, VAR_10;
get_be16(pb); get_byte(pb);
if (((version >> 16) & 0xff) == 5)
get_byte(pb);
VAR_1->codec->codec_id = CODEC_ID_AAC;
VAR_10 = get_be32(pb);
if (VAR_10 >= 1) {
VAR_1->codec->extradata_size = VAR_10 - 1;
VAR_1->codec->extradata = av_mallocz(VAR_1->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
get_byte(pb);
for(VAR_10 = 0; VAR_10 < VAR_1->codec->extradata_size; VAR_10++)
((uint8_t*)VAR_1->codec->extradata)[VAR_10] = get_byte(pb);
}
} else {
VAR_1->codec->codec_id = CODEC_ID_NONE;
pstrcpy(VAR_1->codec->codec_name, sizeof(VAR_1->codec->codec_name),
VAR_3);
}
if (VAR_2) {
get_byte(pb);
get_byte(pb);
get_byte(pb);
get_str8(pb, VAR_0->title, sizeof(VAR_0->title));
get_str8(pb, VAR_0->author, sizeof(VAR_0->author));
get_str8(pb, VAR_0->copyright, sizeof(VAR_0->copyright));
get_str8(pb, VAR_0->comment, sizeof(VAR_0->comment));
}
}
}
|
[
"static void FUNC_0(AVFormatContext *VAR_0, AVStream *VAR_1,\nint VAR_2)\n{",
"RMContext *rm = VAR_0->priv_data;",
"ByteIOContext *pb = &VAR_0->pb;",
"char VAR_3[256];",
"uint32_t version;",
"int VAR_10;",
"version = get_be32(pb);",
"if (((version >> 16) & 0xff) == 3) {",
"int64_t startpos = url_ftell(pb);",
"for(VAR_10 = 0; VAR_10 < 14; VAR_10++)",
"get_byte(pb);",
"get_str8(pb, VAR_0->title, sizeof(VAR_0->title));",
"get_str8(pb, VAR_0->author, sizeof(VAR_0->author));",
"get_str8(pb, VAR_0->copyright, sizeof(VAR_0->copyright));",
"get_str8(pb, VAR_0->comment, sizeof(VAR_0->comment));",
"if ((startpos + (version & 0xffff)) >= url_ftell(pb) + 2) {",
"get_byte(pb);",
"get_str8(pb, VAR_3, sizeof(VAR_3));",
"}",
"if ((startpos + (version & 0xffff)) > url_ftell(pb))\nurl_fskip(pb, (version & 0xffff) + startpos - url_ftell(pb));",
"VAR_1->codec->sample_rate = 8000;",
"VAR_1->codec->channels = 1;",
"VAR_1->codec->codec_type = CODEC_TYPE_AUDIO;",
"VAR_1->codec->codec_id = CODEC_ID_RA_144;",
"} else {",
"int VAR_5, VAR_6, VAR_7, VAR_8;",
"get_be32(pb);",
"get_be32(pb);",
"get_be16(pb);",
"get_be32(pb);",
"VAR_5= get_be16(pb);",
"rm->VAR_7 = VAR_7 = get_be32(pb);",
"get_be32(pb);",
"get_be32(pb);",
"get_be32(pb);",
"rm->VAR_6 = VAR_6 = get_be16(pb);",
"VAR_1->codec->block_align= get_be16(pb);",
"rm->VAR_8 = VAR_8 = get_be16(pb);",
"get_be16(pb);",
"if (((version >> 16) & 0xff) == 5) {",
"get_be16(pb); get_be16(pb); get_be16(pb); }",
"VAR_1->codec->sample_rate = get_be16(pb);",
"get_be32(pb);",
"VAR_1->codec->channels = get_be16(pb);",
"if (((version >> 16) & 0xff) == 5) {",
"get_be32(pb);",
"VAR_3[0] = get_byte(pb);",
"VAR_3[1] = get_byte(pb);",
"VAR_3[2] = get_byte(pb);",
"VAR_3[3] = get_byte(pb);",
"VAR_3[4] = 0;",
"} else {",
"get_str8(pb, VAR_3, sizeof(VAR_3));",
"get_str8(pb, VAR_3, sizeof(VAR_3));",
"}",
"VAR_1->codec->codec_type = CODEC_TYPE_AUDIO;",
"if (!strcmp(VAR_3, \"dnet\")) {",
"VAR_1->codec->codec_id = CODEC_ID_AC3;",
"} else if (!strcmp(VAR_3, \"28_8\")) {",
"VAR_1->codec->codec_id = CODEC_ID_RA_288;",
"VAR_1->codec->extradata_size= 0;",
"rm->audio_framesize = VAR_1->codec->block_align;",
"VAR_1->codec->block_align = VAR_7;",
"if(rm->audio_framesize >= UINT_MAX / VAR_6){",
"av_log(VAR_0, AV_LOG_ERROR, \"rm->audio_framesize * VAR_6 too large\\n\");",
"return -1;",
"}",
"rm->audiobuf = av_malloc(rm->audio_framesize * VAR_6);",
"} else if (!strcmp(VAR_3, \"cook\")) {",
"int VAR_10, VAR_10;",
"get_be16(pb); get_byte(pb);",
"if (((version >> 16) & 0xff) == 5)\nget_byte(pb);",
"VAR_10 = get_be32(pb);",
"if(VAR_10 + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)VAR_10){",
"av_log(VAR_0, AV_LOG_ERROR, \"VAR_10 too large\\n\");",
"return -1;",
"}",
"VAR_1->codec->codec_id = CODEC_ID_COOK;",
"VAR_1->codec->extradata_size= VAR_10;",
"VAR_1->codec->extradata= av_mallocz(VAR_1->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);",
"for(VAR_10 = 0; VAR_10 < VAR_10; VAR_10++)",
"((uint8_t*)VAR_1->codec->extradata)[VAR_10] = get_byte(pb);",
"rm->audio_framesize = VAR_1->codec->block_align;",
"VAR_1->codec->block_align = rm->VAR_8;",
"if(rm->audio_framesize >= UINT_MAX / VAR_6){",
"av_log(VAR_0, AV_LOG_ERROR, \"rm->audio_framesize * VAR_6 too large\\n\");",
"return -1;",
"}",
"rm->audiobuf = av_malloc(rm->audio_framesize * VAR_6);",
"} else if (!strcmp(VAR_3, \"raac\") || !strcmp(VAR_3, \"racp\")) {",
"int VAR_10, VAR_10;",
"get_be16(pb); get_byte(pb);",
"if (((version >> 16) & 0xff) == 5)\nget_byte(pb);",
"VAR_1->codec->codec_id = CODEC_ID_AAC;",
"VAR_10 = get_be32(pb);",
"if (VAR_10 >= 1) {",
"VAR_1->codec->extradata_size = VAR_10 - 1;",
"VAR_1->codec->extradata = av_mallocz(VAR_1->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);",
"get_byte(pb);",
"for(VAR_10 = 0; VAR_10 < VAR_1->codec->extradata_size; VAR_10++)",
"((uint8_t*)VAR_1->codec->extradata)[VAR_10] = get_byte(pb);",
"}",
"} else {",
"VAR_1->codec->codec_id = CODEC_ID_NONE;",
"pstrcpy(VAR_1->codec->codec_name, sizeof(VAR_1->codec->codec_name),\nVAR_3);",
"}",
"if (VAR_2) {",
"get_byte(pb);",
"get_byte(pb);",
"get_byte(pb);",
"get_str8(pb, VAR_0->title, sizeof(VAR_0->title));",
"get_str8(pb, VAR_0->author, sizeof(VAR_0->author));",
"get_str8(pb, VAR_0->copyright, sizeof(VAR_0->copyright));",
"get_str8(pb, VAR_0->comment, sizeof(VAR_0->comment));",
"}",
"}",
"}"
] |
[
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
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
21
],
[
23
],
[
25
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
45
],
[
47
],
[
49
],
[
53,
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
147
],
[
149
],
[
151
],
[
153
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165,
167
],
[
169
],
[
171
],
[
173
],
[
175
],
[
177
],
[
181
],
[
183
],
[
185
],
[
187
],
[
189
],
[
191
],
[
193
],
[
197
],
[
199
],
[
201
],
[
203
],
[
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
]
] |
7,284 |
static void term_init(void)
{
#if HAVE_TERMIOS_H
if(!run_as_daemon){
struct termios tty;
tcgetattr (0, &tty);
oldtty = tty;
atexit(term_exit);
tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
|INLCR|IGNCR|ICRNL|IXON);
tty.c_oflag |= OPOST;
tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN);
tty.c_cflag &= ~(CSIZE|PARENB);
tty.c_cflag |= CS8;
tty.c_cc[VMIN] = 1;
tty.c_cc[VTIME] = 0;
tcsetattr (0, TCSANOW, &tty);
signal(SIGQUIT, sigterm_handler); /* Quit (POSIX). */
}
#endif
avformat_network_deinit();
signal(SIGINT , sigterm_handler); /* Interrupt (ANSI). */
signal(SIGTERM, sigterm_handler); /* Termination (ANSI). */
#ifdef SIGXCPU
signal(SIGXCPU, sigterm_handler);
#endif
}
| true |
FFmpeg
|
71a2c9b26567e2294b54eedafeb23aee08563de7
|
static void term_init(void)
{
#if HAVE_TERMIOS_H
if(!run_as_daemon){
struct termios tty;
tcgetattr (0, &tty);
oldtty = tty;
atexit(term_exit);
tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
|INLCR|IGNCR|ICRNL|IXON);
tty.c_oflag |= OPOST;
tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN);
tty.c_cflag &= ~(CSIZE|PARENB);
tty.c_cflag |= CS8;
tty.c_cc[VMIN] = 1;
tty.c_cc[VTIME] = 0;
tcsetattr (0, TCSANOW, &tty);
signal(SIGQUIT, sigterm_handler);
}
#endif
avformat_network_deinit();
signal(SIGINT , sigterm_handler);
signal(SIGTERM, sigterm_handler);
#ifdef SIGXCPU
signal(SIGXCPU, sigterm_handler);
#endif
}
|
{
"code": [
" tcgetattr (0, &tty);"
],
"line_no": [
13
]
}
|
static void FUNC_0(void)
{
#if HAVE_TERMIOS_H
if(!run_as_daemon){
struct termios tty;
tcgetattr (0, &tty);
oldtty = tty;
atexit(term_exit);
tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
|INLCR|IGNCR|ICRNL|IXON);
tty.c_oflag |= OPOST;
tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN);
tty.c_cflag &= ~(CSIZE|PARENB);
tty.c_cflag |= CS8;
tty.c_cc[VMIN] = 1;
tty.c_cc[VTIME] = 0;
tcsetattr (0, TCSANOW, &tty);
signal(SIGQUIT, sigterm_handler);
}
#endif
avformat_network_deinit();
signal(SIGINT , sigterm_handler);
signal(SIGTERM, sigterm_handler);
#ifdef SIGXCPU
signal(SIGXCPU, sigterm_handler);
#endif
}
|
[
"static void FUNC_0(void)\n{",
"#if HAVE_TERMIOS_H\nif(!run_as_daemon){",
"struct termios tty;",
"tcgetattr (0, &tty);",
"oldtty = tty;",
"atexit(term_exit);",
"tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP\n|INLCR|IGNCR|ICRNL|IXON);",
"tty.c_oflag |= OPOST;",
"tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN);",
"tty.c_cflag &= ~(CSIZE|PARENB);",
"tty.c_cflag |= CS8;",
"tty.c_cc[VMIN] = 1;",
"tty.c_cc[VTIME] = 0;",
"tcsetattr (0, TCSANOW, &tty);",
"signal(SIGQUIT, sigterm_handler);",
"}",
"#endif\navformat_network_deinit();",
"signal(SIGINT , sigterm_handler);",
"signal(SIGTERM, sigterm_handler);",
"#ifdef SIGXCPU\nsignal(SIGXCPU, sigterm_handler);",
"#endif\n}"
] |
[
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5,
7
],
[
9
],
[
13
],
[
15
],
[
17
],
[
21,
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
39
],
[
41
],
[
43
],
[
45,
47
],
[
51
],
[
53
],
[
55,
57
],
[
59,
61
]
] |
7,285 |
static int tcp_write_packet(AVFormatContext *s, RTSPStream *rtsp_st)
{
RTSPState *rt = s->priv_data;
AVFormatContext *rtpctx = rtsp_st->transport_priv;
uint8_t *buf, *ptr;
int size;
uint8_t *interleave_header, *interleaved_packet;
size = avio_close_dyn_buf(rtpctx->pb, &buf);
ptr = buf;
while (size > 4) {
uint32_t packet_len = AV_RB32(ptr);
int id;
/* The interleaving header is exactly 4 bytes, which happens to be
* the same size as the packet length header from
* ffio_open_dyn_packet_buf. So by writing the interleaving header
* over these bytes, we get a consecutive interleaved packet
* that can be written in one call. */
interleaved_packet = interleave_header = ptr;
ptr += 4;
size -= 4;
if (packet_len > size || packet_len < 2)
break;
if (RTP_PT_IS_RTCP(ptr[1]))
id = rtsp_st->interleaved_max; /* RTCP */
else
id = rtsp_st->interleaved_min; /* RTP */
interleave_header[0] = '$';
interleave_header[1] = id;
AV_WB16(interleave_header + 2, packet_len);
ffurl_write(rt->rtsp_hd_out, interleaved_packet, 4 + packet_len);
ptr += packet_len;
size -= packet_len;
}
av_free(buf);
ffio_open_dyn_packet_buf(&rtpctx->pb, RTSP_TCP_MAX_PACKET_SIZE);
return 0;
}
| true |
FFmpeg
|
f542dedf72091af8e6f32a12bd64289c58857c21
|
static int tcp_write_packet(AVFormatContext *s, RTSPStream *rtsp_st)
{
RTSPState *rt = s->priv_data;
AVFormatContext *rtpctx = rtsp_st->transport_priv;
uint8_t *buf, *ptr;
int size;
uint8_t *interleave_header, *interleaved_packet;
size = avio_close_dyn_buf(rtpctx->pb, &buf);
ptr = buf;
while (size > 4) {
uint32_t packet_len = AV_RB32(ptr);
int id;
interleaved_packet = interleave_header = ptr;
ptr += 4;
size -= 4;
if (packet_len > size || packet_len < 2)
break;
if (RTP_PT_IS_RTCP(ptr[1]))
id = rtsp_st->interleaved_max;
else
id = rtsp_st->interleaved_min;
interleave_header[0] = '$';
interleave_header[1] = id;
AV_WB16(interleave_header + 2, packet_len);
ffurl_write(rt->rtsp_hd_out, interleaved_packet, 4 + packet_len);
ptr += packet_len;
size -= packet_len;
}
av_free(buf);
ffio_open_dyn_packet_buf(&rtpctx->pb, RTSP_TCP_MAX_PACKET_SIZE);
return 0;
}
|
{
"code": [
" ffio_open_dyn_packet_buf(&rtpctx->pb, RTSP_TCP_MAX_PACKET_SIZE);",
" return 0;"
],
"line_no": [
71,
73
]
}
|
static int FUNC_0(AVFormatContext *VAR_0, RTSPStream *VAR_1)
{
RTSPState *rt = VAR_0->priv_data;
AVFormatContext *rtpctx = VAR_1->transport_priv;
uint8_t *buf, *ptr;
int VAR_2;
uint8_t *interleave_header, *interleaved_packet;
VAR_2 = avio_close_dyn_buf(rtpctx->pb, &buf);
ptr = buf;
while (VAR_2 > 4) {
uint32_t packet_len = AV_RB32(ptr);
int VAR_3;
interleaved_packet = interleave_header = ptr;
ptr += 4;
VAR_2 -= 4;
if (packet_len > VAR_2 || packet_len < 2)
break;
if (RTP_PT_IS_RTCP(ptr[1]))
VAR_3 = VAR_1->interleaved_max;
else
VAR_3 = VAR_1->interleaved_min;
interleave_header[0] = '$';
interleave_header[1] = VAR_3;
AV_WB16(interleave_header + 2, packet_len);
ffurl_write(rt->rtsp_hd_out, interleaved_packet, 4 + packet_len);
ptr += packet_len;
VAR_2 -= packet_len;
}
av_free(buf);
ffio_open_dyn_packet_buf(&rtpctx->pb, RTSP_TCP_MAX_PACKET_SIZE);
return 0;
}
|
[
"static int FUNC_0(AVFormatContext *VAR_0, RTSPStream *VAR_1)\n{",
"RTSPState *rt = VAR_0->priv_data;",
"AVFormatContext *rtpctx = VAR_1->transport_priv;",
"uint8_t *buf, *ptr;",
"int VAR_2;",
"uint8_t *interleave_header, *interleaved_packet;",
"VAR_2 = avio_close_dyn_buf(rtpctx->pb, &buf);",
"ptr = buf;",
"while (VAR_2 > 4) {",
"uint32_t packet_len = AV_RB32(ptr);",
"int VAR_3;",
"interleaved_packet = interleave_header = ptr;",
"ptr += 4;",
"VAR_2 -= 4;",
"if (packet_len > VAR_2 || packet_len < 2)\nbreak;",
"if (RTP_PT_IS_RTCP(ptr[1]))\nVAR_3 = VAR_1->interleaved_max;",
"else\nVAR_3 = VAR_1->interleaved_min;",
"interleave_header[0] = '$';",
"interleave_header[1] = VAR_3;",
"AV_WB16(interleave_header + 2, packet_len);",
"ffurl_write(rt->rtsp_hd_out, interleaved_packet, 4 + packet_len);",
"ptr += packet_len;",
"VAR_2 -= packet_len;",
"}",
"av_free(buf);",
"ffio_open_dyn_packet_buf(&rtpctx->pb, RTSP_TCP_MAX_PACKET_SIZE);",
"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,
1,
1,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
37
],
[
39
],
[
41
],
[
43,
45
],
[
47,
49
],
[
51,
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
]
] |
7,286 |
static int virtio_blk_load(QEMUFile *f, void *opaque, int version_id)
{
VirtIOBlock *s = opaque;
if (version_id != 2)
return -EINVAL;
virtio_load(&s->vdev, f);
while (qemu_get_sbyte(f)) {
VirtIOBlockReq *req = virtio_blk_alloc_request(s);
qemu_get_buffer(f, (unsigned char*)&req->elem, sizeof(req->elem));
req->next = s->rq;
s->rq = req;
virtqueue_map_sg(req->elem.in_sg, req->elem.in_addr,
req->elem.in_num, 1);
virtqueue_map_sg(req->elem.out_sg, req->elem.out_addr,
req->elem.out_num, 0);
}
return 0;
}
| true |
qemu
|
2a633c461e96cb9a856292c46917653bd43959c8
|
static int virtio_blk_load(QEMUFile *f, void *opaque, int version_id)
{
VirtIOBlock *s = opaque;
if (version_id != 2)
return -EINVAL;
virtio_load(&s->vdev, f);
while (qemu_get_sbyte(f)) {
VirtIOBlockReq *req = virtio_blk_alloc_request(s);
qemu_get_buffer(f, (unsigned char*)&req->elem, sizeof(req->elem));
req->next = s->rq;
s->rq = req;
virtqueue_map_sg(req->elem.in_sg, req->elem.in_addr,
req->elem.in_num, 1);
virtqueue_map_sg(req->elem.out_sg, req->elem.out_addr,
req->elem.out_num, 0);
}
return 0;
}
|
{
"code": [
" virtio_load(&s->vdev, f);",
" virtio_load(&s->vdev, f);",
" virtio_load(&s->vdev, f);",
" virtio_load(&s->vdev, f);"
],
"line_no": [
15,
15,
15,
15
]
}
|
static int FUNC_0(QEMUFile *VAR_0, void *VAR_1, int VAR_2)
{
VirtIOBlock *s = VAR_1;
if (VAR_2 != 2)
return -EINVAL;
virtio_load(&s->vdev, VAR_0);
while (qemu_get_sbyte(VAR_0)) {
VirtIOBlockReq *req = virtio_blk_alloc_request(s);
qemu_get_buffer(VAR_0, (unsigned char*)&req->elem, sizeof(req->elem));
req->next = s->rq;
s->rq = req;
virtqueue_map_sg(req->elem.in_sg, req->elem.in_addr,
req->elem.in_num, 1);
virtqueue_map_sg(req->elem.out_sg, req->elem.out_addr,
req->elem.out_num, 0);
}
return 0;
}
|
[
"static int FUNC_0(QEMUFile *VAR_0, void *VAR_1, int VAR_2)\n{",
"VirtIOBlock *s = VAR_1;",
"if (VAR_2 != 2)\nreturn -EINVAL;",
"virtio_load(&s->vdev, VAR_0);",
"while (qemu_get_sbyte(VAR_0)) {",
"VirtIOBlockReq *req = virtio_blk_alloc_request(s);",
"qemu_get_buffer(VAR_0, (unsigned char*)&req->elem, sizeof(req->elem));",
"req->next = s->rq;",
"s->rq = req;",
"virtqueue_map_sg(req->elem.in_sg, req->elem.in_addr,\nreq->elem.in_num, 1);",
"virtqueue_map_sg(req->elem.out_sg, req->elem.out_addr,\nreq->elem.out_num, 0);",
"}",
"return 0;",
"}"
] |
[
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
9,
11
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
29,
31
],
[
33,
35
],
[
37
],
[
41
],
[
43
]
] |
7,287 |
static TRBCCode xhci_disable_ep(XHCIState *xhci, unsigned int slotid,
unsigned int epid)
{
XHCISlot *slot;
XHCIEPContext *epctx;
int i;
trace_usb_xhci_ep_disable(slotid, epid);
assert(slotid >= 1 && slotid <= xhci->numslots);
assert(epid >= 1 && epid <= 31);
slot = &xhci->slots[slotid-1];
if (!slot->eps[epid-1]) {
DPRINTF("xhci: slot %d ep %d already disabled\n", slotid, epid);
return CC_SUCCESS;
}
xhci_ep_nuke_xfers(xhci, slotid, epid, 0);
epctx = slot->eps[epid-1];
if (epctx->nr_pstreams) {
xhci_free_streams(epctx);
}
for (i = 0; i < ARRAY_SIZE(epctx->transfers); i++) {
usb_packet_cleanup(&epctx->transfers[i].packet);
}
xhci_set_ep_state(xhci, epctx, NULL, EP_DISABLED);
timer_free(epctx->kick_timer);
g_free(epctx);
slot->eps[epid-1] = NULL;
return CC_SUCCESS;
}
| true |
qemu
|
491d68d9382dbb588f2ff5132ee3d87ce2f1b230
|
static TRBCCode xhci_disable_ep(XHCIState *xhci, unsigned int slotid,
unsigned int epid)
{
XHCISlot *slot;
XHCIEPContext *epctx;
int i;
trace_usb_xhci_ep_disable(slotid, epid);
assert(slotid >= 1 && slotid <= xhci->numslots);
assert(epid >= 1 && epid <= 31);
slot = &xhci->slots[slotid-1];
if (!slot->eps[epid-1]) {
DPRINTF("xhci: slot %d ep %d already disabled\n", slotid, epid);
return CC_SUCCESS;
}
xhci_ep_nuke_xfers(xhci, slotid, epid, 0);
epctx = slot->eps[epid-1];
if (epctx->nr_pstreams) {
xhci_free_streams(epctx);
}
for (i = 0; i < ARRAY_SIZE(epctx->transfers); i++) {
usb_packet_cleanup(&epctx->transfers[i].packet);
}
xhci_set_ep_state(xhci, epctx, NULL, EP_DISABLED);
timer_free(epctx->kick_timer);
g_free(epctx);
slot->eps[epid-1] = NULL;
return CC_SUCCESS;
}
|
{
"code": [
" xhci_set_ep_state(xhci, epctx, NULL, EP_DISABLED);"
],
"line_no": [
61
]
}
|
static TRBCCode FUNC_0(XHCIState *xhci, unsigned int slotid,
unsigned int epid)
{
XHCISlot *slot;
XHCIEPContext *epctx;
int VAR_0;
trace_usb_xhci_ep_disable(slotid, epid);
assert(slotid >= 1 && slotid <= xhci->numslots);
assert(epid >= 1 && epid <= 31);
slot = &xhci->slots[slotid-1];
if (!slot->eps[epid-1]) {
DPRINTF("xhci: slot %d ep %d already disabled\n", slotid, epid);
return CC_SUCCESS;
}
xhci_ep_nuke_xfers(xhci, slotid, epid, 0);
epctx = slot->eps[epid-1];
if (epctx->nr_pstreams) {
xhci_free_streams(epctx);
}
for (VAR_0 = 0; VAR_0 < ARRAY_SIZE(epctx->transfers); VAR_0++) {
usb_packet_cleanup(&epctx->transfers[VAR_0].packet);
}
xhci_set_ep_state(xhci, epctx, NULL, EP_DISABLED);
timer_free(epctx->kick_timer);
g_free(epctx);
slot->eps[epid-1] = NULL;
return CC_SUCCESS;
}
|
[
"static TRBCCode FUNC_0(XHCIState *xhci, unsigned int slotid,\nunsigned int epid)\n{",
"XHCISlot *slot;",
"XHCIEPContext *epctx;",
"int VAR_0;",
"trace_usb_xhci_ep_disable(slotid, epid);",
"assert(slotid >= 1 && slotid <= xhci->numslots);",
"assert(epid >= 1 && epid <= 31);",
"slot = &xhci->slots[slotid-1];",
"if (!slot->eps[epid-1]) {",
"DPRINTF(\"xhci: slot %d ep %d already disabled\\n\", slotid, epid);",
"return CC_SUCCESS;",
"}",
"xhci_ep_nuke_xfers(xhci, slotid, epid, 0);",
"epctx = slot->eps[epid-1];",
"if (epctx->nr_pstreams) {",
"xhci_free_streams(epctx);",
"}",
"for (VAR_0 = 0; VAR_0 < ARRAY_SIZE(epctx->transfers); VAR_0++) {",
"usb_packet_cleanup(&epctx->transfers[VAR_0].packet);",
"}",
"xhci_set_ep_state(xhci, epctx, NULL, EP_DISABLED);",
"timer_free(epctx->kick_timer);",
"g_free(epctx);",
"slot->eps[epid-1] = NULL;",
"return CC_SUCCESS;",
"}"
] |
[
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
],
[
15
],
[
17
],
[
19
],
[
23
],
[
27
],
[
29
],
[
31
],
[
33
],
[
37
],
[
41
],
[
45
],
[
47
],
[
49
],
[
53
],
[
55
],
[
57
],
[
61
],
[
65
],
[
67
],
[
69
],
[
73
],
[
75
]
] |
7,289 |
static void parse_mb_skip(Wmv2Context *w)
{
int mb_x, mb_y;
MpegEncContext *const s = &w->s;
uint32_t *const mb_type = s->current_picture_ptr->mb_type;
w->skip_type = get_bits(&s->gb, 2);
switch (w->skip_type) {
case SKIP_TYPE_NONE:
for (mb_y = 0; mb_y < s->mb_height; mb_y++)
for (mb_x = 0; mb_x < s->mb_width; mb_x++)
mb_type[mb_y * s->mb_stride + mb_x] =
MB_TYPE_16x16 | MB_TYPE_L0;
break;
case SKIP_TYPE_MPEG:
for (mb_y = 0; mb_y < s->mb_height; mb_y++)
for (mb_x = 0; mb_x < s->mb_width; mb_x++)
mb_type[mb_y * s->mb_stride + mb_x] =
(get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0;
break;
case SKIP_TYPE_ROW:
for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
if (get_bits1(&s->gb)) {
for (mb_x = 0; mb_x < s->mb_width; mb_x++)
mb_type[mb_y * s->mb_stride + mb_x] =
MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
} else {
for (mb_x = 0; mb_x < s->mb_width; mb_x++)
mb_type[mb_y * s->mb_stride + mb_x] =
(get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0;
}
}
break;
case SKIP_TYPE_COL:
for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
if (get_bits1(&s->gb)) {
for (mb_y = 0; mb_y < s->mb_height; mb_y++)
mb_type[mb_y * s->mb_stride + mb_x] =
MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
} else {
for (mb_y = 0; mb_y < s->mb_height; mb_y++)
mb_type[mb_y * s->mb_stride + mb_x] =
(get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0;
}
}
break;
}
}
| true |
FFmpeg
|
65e0a7c473f23f1833538ffecf53c81fe500b5e4
|
static void parse_mb_skip(Wmv2Context *w)
{
int mb_x, mb_y;
MpegEncContext *const s = &w->s;
uint32_t *const mb_type = s->current_picture_ptr->mb_type;
w->skip_type = get_bits(&s->gb, 2);
switch (w->skip_type) {
case SKIP_TYPE_NONE:
for (mb_y = 0; mb_y < s->mb_height; mb_y++)
for (mb_x = 0; mb_x < s->mb_width; mb_x++)
mb_type[mb_y * s->mb_stride + mb_x] =
MB_TYPE_16x16 | MB_TYPE_L0;
break;
case SKIP_TYPE_MPEG:
for (mb_y = 0; mb_y < s->mb_height; mb_y++)
for (mb_x = 0; mb_x < s->mb_width; mb_x++)
mb_type[mb_y * s->mb_stride + mb_x] =
(get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0;
break;
case SKIP_TYPE_ROW:
for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
if (get_bits1(&s->gb)) {
for (mb_x = 0; mb_x < s->mb_width; mb_x++)
mb_type[mb_y * s->mb_stride + mb_x] =
MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
} else {
for (mb_x = 0; mb_x < s->mb_width; mb_x++)
mb_type[mb_y * s->mb_stride + mb_x] =
(get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0;
}
}
break;
case SKIP_TYPE_COL:
for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
if (get_bits1(&s->gb)) {
for (mb_y = 0; mb_y < s->mb_height; mb_y++)
mb_type[mb_y * s->mb_stride + mb_x] =
MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
} else {
for (mb_y = 0; mb_y < s->mb_height; mb_y++)
mb_type[mb_y * s->mb_stride + mb_x] =
(get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0;
}
}
break;
}
}
|
{
"code": [
"static void parse_mb_skip(Wmv2Context *w)"
],
"line_no": [
1
]
}
|
static void FUNC_0(Wmv2Context *VAR_0)
{
int VAR_1, VAR_2;
MpegEncContext *const s = &VAR_0->s;
uint32_t *const mb_type = s->current_picture_ptr->mb_type;
VAR_0->skip_type = get_bits(&s->gb, 2);
switch (VAR_0->skip_type) {
case SKIP_TYPE_NONE:
for (VAR_2 = 0; VAR_2 < s->mb_height; VAR_2++)
for (VAR_1 = 0; VAR_1 < s->mb_width; VAR_1++)
mb_type[VAR_2 * s->mb_stride + VAR_1] =
MB_TYPE_16x16 | MB_TYPE_L0;
break;
case SKIP_TYPE_MPEG:
for (VAR_2 = 0; VAR_2 < s->mb_height; VAR_2++)
for (VAR_1 = 0; VAR_1 < s->mb_width; VAR_1++)
mb_type[VAR_2 * s->mb_stride + VAR_1] =
(get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0;
break;
case SKIP_TYPE_ROW:
for (VAR_2 = 0; VAR_2 < s->mb_height; VAR_2++) {
if (get_bits1(&s->gb)) {
for (VAR_1 = 0; VAR_1 < s->mb_width; VAR_1++)
mb_type[VAR_2 * s->mb_stride + VAR_1] =
MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
} else {
for (VAR_1 = 0; VAR_1 < s->mb_width; VAR_1++)
mb_type[VAR_2 * s->mb_stride + VAR_1] =
(get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0;
}
}
break;
case SKIP_TYPE_COL:
for (VAR_1 = 0; VAR_1 < s->mb_width; VAR_1++) {
if (get_bits1(&s->gb)) {
for (VAR_2 = 0; VAR_2 < s->mb_height; VAR_2++)
mb_type[VAR_2 * s->mb_stride + VAR_1] =
MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
} else {
for (VAR_2 = 0; VAR_2 < s->mb_height; VAR_2++)
mb_type[VAR_2 * s->mb_stride + VAR_1] =
(get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0;
}
}
break;
}
}
|
[
"static void FUNC_0(Wmv2Context *VAR_0)\n{",
"int VAR_1, VAR_2;",
"MpegEncContext *const s = &VAR_0->s;",
"uint32_t *const mb_type = s->current_picture_ptr->mb_type;",
"VAR_0->skip_type = get_bits(&s->gb, 2);",
"switch (VAR_0->skip_type) {",
"case SKIP_TYPE_NONE:\nfor (VAR_2 = 0; VAR_2 < s->mb_height; VAR_2++)",
"for (VAR_1 = 0; VAR_1 < s->mb_width; VAR_1++)",
"mb_type[VAR_2 * s->mb_stride + VAR_1] =\nMB_TYPE_16x16 | MB_TYPE_L0;",
"break;",
"case SKIP_TYPE_MPEG:\nfor (VAR_2 = 0; VAR_2 < s->mb_height; VAR_2++)",
"for (VAR_1 = 0; VAR_1 < s->mb_width; VAR_1++)",
"mb_type[VAR_2 * s->mb_stride + VAR_1] =\n(get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0;",
"break;",
"case SKIP_TYPE_ROW:\nfor (VAR_2 = 0; VAR_2 < s->mb_height; VAR_2++) {",
"if (get_bits1(&s->gb)) {",
"for (VAR_1 = 0; VAR_1 < s->mb_width; VAR_1++)",
"mb_type[VAR_2 * s->mb_stride + VAR_1] =\nMB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;",
"} else {",
"for (VAR_1 = 0; VAR_1 < s->mb_width; VAR_1++)",
"mb_type[VAR_2 * s->mb_stride + VAR_1] =\n(get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0;",
"}",
"}",
"break;",
"case SKIP_TYPE_COL:\nfor (VAR_1 = 0; VAR_1 < s->mb_width; VAR_1++) {",
"if (get_bits1(&s->gb)) {",
"for (VAR_2 = 0; VAR_2 < s->mb_height; VAR_2++)",
"mb_type[VAR_2 * s->mb_stride + VAR_1] =\nMB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;",
"} else {",
"for (VAR_2 = 0; VAR_2 < s->mb_height; VAR_2++)",
"mb_type[VAR_2 * s->mb_stride + VAR_1] =\n(get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0;",
"}",
"}",
"break;",
"}",
"}"
] |
[
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
17,
19
],
[
21
],
[
23,
25
],
[
27
],
[
29,
31
],
[
33
],
[
35,
37
],
[
39
],
[
41,
43
],
[
45
],
[
47
],
[
49,
51
],
[
53
],
[
55
],
[
57,
59
],
[
61
],
[
63
],
[
65
],
[
67,
69
],
[
71
],
[
73
],
[
75,
77
],
[
79
],
[
81
],
[
83,
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
]
] |
7,290 |
static void qemu_chr_free_common(CharDriverState *chr)
{
g_free(chr->filename);
g_free(chr->label);
if (chr->logfd != -1) {
close(chr->logfd);
qemu_mutex_destroy(&chr->chr_write_lock);
g_free(chr);
| true |
qemu
|
94a40fc56036b5058b0b194d9e372a22e65ce7be
|
static void qemu_chr_free_common(CharDriverState *chr)
{
g_free(chr->filename);
g_free(chr->label);
if (chr->logfd != -1) {
close(chr->logfd);
qemu_mutex_destroy(&chr->chr_write_lock);
g_free(chr);
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(CharDriverState *VAR_0)
{
g_free(VAR_0->filename);
g_free(VAR_0->label);
if (VAR_0->logfd != -1) {
close(VAR_0->logfd);
qemu_mutex_destroy(&VAR_0->chr_write_lock);
g_free(VAR_0);
|
[
"static void FUNC_0(CharDriverState *VAR_0)\n{",
"g_free(VAR_0->filename);",
"g_free(VAR_0->label);",
"if (VAR_0->logfd != -1) {",
"close(VAR_0->logfd);",
"qemu_mutex_destroy(&VAR_0->chr_write_lock);",
"g_free(VAR_0);"
] |
[
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
8
],
[
10
],
[
12
],
[
14
],
[
17
],
[
19
]
] |
7,291 |
void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,
int is_asi, int size)
{
CPUState *saved_env;
int fault_type;
/* XXX: hack to restore env in all cases, even if not called from
generated code */
saved_env = env;
env = cpu_single_env;
#ifdef DEBUG_UNASSIGNED
if (is_asi)
printf("Unassigned mem %s access of %d byte%s to " TARGET_FMT_plx
" asi 0x%02x from " TARGET_FMT_lx "\n",
is_exec ? "exec" : is_write ? "write" : "read", size,
size == 1 ? "" : "s", addr, is_asi, env->pc);
else
printf("Unassigned mem %s access of %d byte%s to " TARGET_FMT_plx
" from " TARGET_FMT_lx "\n",
is_exec ? "exec" : is_write ? "write" : "read", size,
size == 1 ? "" : "s", addr, env->pc);
#endif
/* Don't overwrite translation and access faults */
fault_type = (env->mmuregs[3] & 0x1c) >> 2;
if ((fault_type > 4) || (fault_type == 0)) {
env->mmuregs[3] = 0; /* Fault status register */
if (is_asi)
env->mmuregs[3] |= 1 << 16;
if (env->psrs)
env->mmuregs[3] |= 1 << 5;
if (is_exec)
env->mmuregs[3] |= 1 << 6;
if (is_write)
env->mmuregs[3] |= 1 << 7;
env->mmuregs[3] |= (5 << 2) | 2;
/* SuperSPARC will never place instruction fault addresses in the FAR */
if (!is_exec) {
env->mmuregs[4] = addr; /* Fault address register */
}
}
/* overflow (same type fault was not read before another fault) */
if (fault_type == ((env->mmuregs[3] & 0x1c)) >> 2) {
env->mmuregs[3] |= 1;
}
if ((env->mmuregs[0] & MMU_E) && !(env->mmuregs[0] & MMU_NF)) {
if (is_exec)
raise_exception(TT_CODE_ACCESS);
else
raise_exception(TT_DATA_ACCESS);
}
/* flush neverland mappings created during no-fault mode,
so the sequential MMU faults report proper fault types */
if (env->mmuregs[0] & MMU_NF) {
tlb_flush(env, 1);
}
env = saved_env;
}
| true |
qemu
|
b14ef7c9ab41ea824c3ccadb070ad95567cca84e
|
void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,
int is_asi, int size)
{
CPUState *saved_env;
int fault_type;
saved_env = env;
env = cpu_single_env;
#ifdef DEBUG_UNASSIGNED
if (is_asi)
printf("Unassigned mem %s access of %d byte%s to " TARGET_FMT_plx
" asi 0x%02x from " TARGET_FMT_lx "\n",
is_exec ? "exec" : is_write ? "write" : "read", size,
size == 1 ? "" : "s", addr, is_asi, env->pc);
else
printf("Unassigned mem %s access of %d byte%s to " TARGET_FMT_plx
" from " TARGET_FMT_lx "\n",
is_exec ? "exec" : is_write ? "write" : "read", size,
size == 1 ? "" : "s", addr, env->pc);
#endif
fault_type = (env->mmuregs[3] & 0x1c) >> 2;
if ((fault_type > 4) || (fault_type == 0)) {
env->mmuregs[3] = 0;
if (is_asi)
env->mmuregs[3] |= 1 << 16;
if (env->psrs)
env->mmuregs[3] |= 1 << 5;
if (is_exec)
env->mmuregs[3] |= 1 << 6;
if (is_write)
env->mmuregs[3] |= 1 << 7;
env->mmuregs[3] |= (5 << 2) | 2;
if (!is_exec) {
env->mmuregs[4] = addr;
}
}
if (fault_type == ((env->mmuregs[3] & 0x1c)) >> 2) {
env->mmuregs[3] |= 1;
}
if ((env->mmuregs[0] & MMU_E) && !(env->mmuregs[0] & MMU_NF)) {
if (is_exec)
raise_exception(TT_CODE_ACCESS);
else
raise_exception(TT_DATA_ACCESS);
}
if (env->mmuregs[0] & MMU_NF) {
tlb_flush(env, 1);
}
env = saved_env;
}
|
{
"code": [
"void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,",
"void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,",
" int is_asi, int size)",
" env = cpu_single_env;",
"void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,",
"void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,",
"void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,",
"void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,",
" int is_asi, int size)",
"void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,",
" int is_asi, int size)"
],
"line_no": [
1,
1,
3,
19,
1,
1,
1,
1,
3,
1,
3
]
}
|
void FUNC_0(target_phys_addr_t VAR_0, int VAR_1, int VAR_2,
int VAR_3, int VAR_4)
{
CPUState *saved_env;
int VAR_5;
saved_env = env;
env = cpu_single_env;
#ifdef DEBUG_UNASSIGNED
if (VAR_3)
printf("Unassigned mem %s access of %d byte%s to " TARGET_FMT_plx
" asi 0x%02x from " TARGET_FMT_lx "\n",
VAR_2 ? "exec" : VAR_1 ? "write" : "read", VAR_4,
VAR_4 == 1 ? "" : "s", VAR_0, VAR_3, env->pc);
else
printf("Unassigned mem %s access of %d byte%s to " TARGET_FMT_plx
" from " TARGET_FMT_lx "\n",
VAR_2 ? "exec" : VAR_1 ? "write" : "read", VAR_4,
VAR_4 == 1 ? "" : "s", VAR_0, env->pc);
#endif
VAR_5 = (env->mmuregs[3] & 0x1c) >> 2;
if ((VAR_5 > 4) || (VAR_5 == 0)) {
env->mmuregs[3] = 0;
if (VAR_3)
env->mmuregs[3] |= 1 << 16;
if (env->psrs)
env->mmuregs[3] |= 1 << 5;
if (VAR_2)
env->mmuregs[3] |= 1 << 6;
if (VAR_1)
env->mmuregs[3] |= 1 << 7;
env->mmuregs[3] |= (5 << 2) | 2;
if (!VAR_2) {
env->mmuregs[4] = VAR_0;
}
}
if (VAR_5 == ((env->mmuregs[3] & 0x1c)) >> 2) {
env->mmuregs[3] |= 1;
}
if ((env->mmuregs[0] & MMU_E) && !(env->mmuregs[0] & MMU_NF)) {
if (VAR_2)
raise_exception(TT_CODE_ACCESS);
else
raise_exception(TT_DATA_ACCESS);
}
if (env->mmuregs[0] & MMU_NF) {
tlb_flush(env, 1);
}
env = saved_env;
}
|
[
"void FUNC_0(target_phys_addr_t VAR_0, int VAR_1, int VAR_2,\nint VAR_3, int VAR_4)\n{",
"CPUState *saved_env;",
"int VAR_5;",
"saved_env = env;",
"env = cpu_single_env;",
"#ifdef DEBUG_UNASSIGNED\nif (VAR_3)\nprintf(\"Unassigned mem %s access of %d byte%s to \" TARGET_FMT_plx\n\" asi 0x%02x from \" TARGET_FMT_lx \"\\n\",\nVAR_2 ? \"exec\" : VAR_1 ? \"write\" : \"read\", VAR_4,\nVAR_4 == 1 ? \"\" : \"s\", VAR_0, VAR_3, env->pc);",
"else\nprintf(\"Unassigned mem %s access of %d byte%s to \" TARGET_FMT_plx\n\" from \" TARGET_FMT_lx \"\\n\",\nVAR_2 ? \"exec\" : VAR_1 ? \"write\" : \"read\", VAR_4,\nVAR_4 == 1 ? \"\" : \"s\", VAR_0, env->pc);",
"#endif\nVAR_5 = (env->mmuregs[3] & 0x1c) >> 2;",
"if ((VAR_5 > 4) || (VAR_5 == 0)) {",
"env->mmuregs[3] = 0;",
"if (VAR_3)\nenv->mmuregs[3] |= 1 << 16;",
"if (env->psrs)\nenv->mmuregs[3] |= 1 << 5;",
"if (VAR_2)\nenv->mmuregs[3] |= 1 << 6;",
"if (VAR_1)\nenv->mmuregs[3] |= 1 << 7;",
"env->mmuregs[3] |= (5 << 2) | 2;",
"if (!VAR_2) {",
"env->mmuregs[4] = VAR_0;",
"}",
"}",
"if (VAR_5 == ((env->mmuregs[3] & 0x1c)) >> 2) {",
"env->mmuregs[3] |= 1;",
"}",
"if ((env->mmuregs[0] & MMU_E) && !(env->mmuregs[0] & MMU_NF)) {",
"if (VAR_2)\nraise_exception(TT_CODE_ACCESS);",
"else\nraise_exception(TT_DATA_ACCESS);",
"}",
"if (env->mmuregs[0] & MMU_NF) {",
"tlb_flush(env, 1);",
"}",
"env = saved_env;",
"}"
] |
[
1,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
17
],
[
19
],
[
21,
23,
25,
27,
29,
31
],
[
33,
35,
37,
39,
41
],
[
43,
47
],
[
49
],
[
51
],
[
53,
55
],
[
57,
59
],
[
61,
63
],
[
65,
67
],
[
69
],
[
73
],
[
75
],
[
77
],
[
79
],
[
83
],
[
85
],
[
87
],
[
91
],
[
93,
95
],
[
97,
99
],
[
101
],
[
109
],
[
111
],
[
113
],
[
117
],
[
119
]
] |
7,292 |
int coroutine_fn bdrv_co_flush(BlockDriverState *bs)
{
int ret;
BdrvTrackedRequest req;
if (!bs || !bdrv_is_inserted(bs) || bdrv_is_read_only(bs) ||
bdrv_is_sg(bs)) {
return 0;
}
tracked_request_begin(&req, bs, 0, 0, BDRV_TRACKED_FLUSH);
int current_gen = bs->write_gen;
/* Wait until any previous flushes are completed */
while (bs->flush_started_gen != bs->flushed_gen) {
qemu_co_queue_wait(&bs->flush_queue);
}
bs->flush_started_gen = current_gen;
/* Write back all layers by calling one driver function */
if (bs->drv->bdrv_co_flush) {
ret = bs->drv->bdrv_co_flush(bs);
goto out;
}
/* Write back cached data to the OS even with cache=unsafe */
BLKDBG_EVENT(bs->file, BLKDBG_FLUSH_TO_OS);
if (bs->drv->bdrv_co_flush_to_os) {
ret = bs->drv->bdrv_co_flush_to_os(bs);
if (ret < 0) {
goto out;
}
}
/* But don't actually force it to the disk with cache=unsafe */
if (bs->open_flags & BDRV_O_NO_FLUSH) {
goto flush_parent;
}
/* Check if we really need to flush anything */
if (bs->flushed_gen == current_gen) {
goto flush_parent;
}
BLKDBG_EVENT(bs->file, BLKDBG_FLUSH_TO_DISK);
if (bs->drv->bdrv_co_flush_to_disk) {
ret = bs->drv->bdrv_co_flush_to_disk(bs);
} else if (bs->drv->bdrv_aio_flush) {
BlockAIOCB *acb;
CoroutineIOCompletion co = {
.coroutine = qemu_coroutine_self(),
};
acb = bs->drv->bdrv_aio_flush(bs, bdrv_co_io_em_complete, &co);
if (acb == NULL) {
ret = -EIO;
} else {
qemu_coroutine_yield();
ret = co.ret;
}
} else {
/*
* Some block drivers always operate in either writethrough or unsafe
* mode and don't support bdrv_flush therefore. Usually qemu doesn't
* know how the server works (because the behaviour is hardcoded or
* depends on server-side configuration), so we can't ensure that
* everything is safe on disk. Returning an error doesn't work because
* that would break guests even if the server operates in writethrough
* mode.
*
* Let's hope the user knows what he's doing.
*/
ret = 0;
}
if (ret < 0) {
goto out;
}
/* Now flush the underlying protocol. It will also have BDRV_O_NO_FLUSH
* in the case of cache=unsafe, so there are no useless flushes.
*/
flush_parent:
ret = bs->file ? bdrv_co_flush(bs->file->bs) : 0;
out:
/* Notify any pending flushes that we have completed */
bs->flushed_gen = current_gen;
qemu_co_queue_restart_all(&bs->flush_queue);
tracked_request_end(&req);
return ret;
}
| true |
qemu
|
3ff2f67a7c24183fcbcfe1332e5223ac6f96438c
|
int coroutine_fn bdrv_co_flush(BlockDriverState *bs)
{
int ret;
BdrvTrackedRequest req;
if (!bs || !bdrv_is_inserted(bs) || bdrv_is_read_only(bs) ||
bdrv_is_sg(bs)) {
return 0;
}
tracked_request_begin(&req, bs, 0, 0, BDRV_TRACKED_FLUSH);
int current_gen = bs->write_gen;
while (bs->flush_started_gen != bs->flushed_gen) {
qemu_co_queue_wait(&bs->flush_queue);
}
bs->flush_started_gen = current_gen;
if (bs->drv->bdrv_co_flush) {
ret = bs->drv->bdrv_co_flush(bs);
goto out;
}
BLKDBG_EVENT(bs->file, BLKDBG_FLUSH_TO_OS);
if (bs->drv->bdrv_co_flush_to_os) {
ret = bs->drv->bdrv_co_flush_to_os(bs);
if (ret < 0) {
goto out;
}
}
if (bs->open_flags & BDRV_O_NO_FLUSH) {
goto flush_parent;
}
if (bs->flushed_gen == current_gen) {
goto flush_parent;
}
BLKDBG_EVENT(bs->file, BLKDBG_FLUSH_TO_DISK);
if (bs->drv->bdrv_co_flush_to_disk) {
ret = bs->drv->bdrv_co_flush_to_disk(bs);
} else if (bs->drv->bdrv_aio_flush) {
BlockAIOCB *acb;
CoroutineIOCompletion co = {
.coroutine = qemu_coroutine_self(),
};
acb = bs->drv->bdrv_aio_flush(bs, bdrv_co_io_em_complete, &co);
if (acb == NULL) {
ret = -EIO;
} else {
qemu_coroutine_yield();
ret = co.ret;
}
} else {
ret = 0;
}
if (ret < 0) {
goto out;
}
flush_parent:
ret = bs->file ? bdrv_co_flush(bs->file->bs) : 0;
out:
bs->flushed_gen = current_gen;
qemu_co_queue_restart_all(&bs->flush_queue);
tracked_request_end(&req);
return ret;
}
|
{
"code": [],
"line_no": []
}
|
int VAR_0 bdrv_co_flush(BlockDriverState *bs)
{
int ret;
BdrvTrackedRequest req;
if (!bs || !bdrv_is_inserted(bs) || bdrv_is_read_only(bs) ||
bdrv_is_sg(bs)) {
return 0;
}
tracked_request_begin(&req, bs, 0, 0, BDRV_TRACKED_FLUSH);
int current_gen = bs->write_gen;
while (bs->flush_started_gen != bs->flushed_gen) {
qemu_co_queue_wait(&bs->flush_queue);
}
bs->flush_started_gen = current_gen;
if (bs->drv->bdrv_co_flush) {
ret = bs->drv->bdrv_co_flush(bs);
goto out;
}
BLKDBG_EVENT(bs->file, BLKDBG_FLUSH_TO_OS);
if (bs->drv->bdrv_co_flush_to_os) {
ret = bs->drv->bdrv_co_flush_to_os(bs);
if (ret < 0) {
goto out;
}
}
if (bs->open_flags & BDRV_O_NO_FLUSH) {
goto flush_parent;
}
if (bs->flushed_gen == current_gen) {
goto flush_parent;
}
BLKDBG_EVENT(bs->file, BLKDBG_FLUSH_TO_DISK);
if (bs->drv->bdrv_co_flush_to_disk) {
ret = bs->drv->bdrv_co_flush_to_disk(bs);
} else if (bs->drv->bdrv_aio_flush) {
BlockAIOCB *acb;
CoroutineIOCompletion co = {
.coroutine = qemu_coroutine_self(),
};
acb = bs->drv->bdrv_aio_flush(bs, bdrv_co_io_em_complete, &co);
if (acb == NULL) {
ret = -EIO;
} else {
qemu_coroutine_yield();
ret = co.ret;
}
} else {
ret = 0;
}
if (ret < 0) {
goto out;
}
flush_parent:
ret = bs->file ? bdrv_co_flush(bs->file->bs) : 0;
out:
bs->flushed_gen = current_gen;
qemu_co_queue_restart_all(&bs->flush_queue);
tracked_request_end(&req);
return ret;
}
|
[
"int VAR_0 bdrv_co_flush(BlockDriverState *bs)\n{",
"int ret;",
"BdrvTrackedRequest req;",
"if (!bs || !bdrv_is_inserted(bs) || bdrv_is_read_only(bs) ||\nbdrv_is_sg(bs)) {",
"return 0;",
"}",
"tracked_request_begin(&req, bs, 0, 0, BDRV_TRACKED_FLUSH);",
"int current_gen = bs->write_gen;",
"while (bs->flush_started_gen != bs->flushed_gen) {",
"qemu_co_queue_wait(&bs->flush_queue);",
"}",
"bs->flush_started_gen = current_gen;",
"if (bs->drv->bdrv_co_flush) {",
"ret = bs->drv->bdrv_co_flush(bs);",
"goto out;",
"}",
"BLKDBG_EVENT(bs->file, BLKDBG_FLUSH_TO_OS);",
"if (bs->drv->bdrv_co_flush_to_os) {",
"ret = bs->drv->bdrv_co_flush_to_os(bs);",
"if (ret < 0) {",
"goto out;",
"}",
"}",
"if (bs->open_flags & BDRV_O_NO_FLUSH) {",
"goto flush_parent;",
"}",
"if (bs->flushed_gen == current_gen) {",
"goto flush_parent;",
"}",
"BLKDBG_EVENT(bs->file, BLKDBG_FLUSH_TO_DISK);",
"if (bs->drv->bdrv_co_flush_to_disk) {",
"ret = bs->drv->bdrv_co_flush_to_disk(bs);",
"} else if (bs->drv->bdrv_aio_flush) {",
"BlockAIOCB *acb;",
"CoroutineIOCompletion co = {",
".coroutine = qemu_coroutine_self(),\n};",
"acb = bs->drv->bdrv_aio_flush(bs, bdrv_co_io_em_complete, &co);",
"if (acb == NULL) {",
"ret = -EIO;",
"} else {",
"qemu_coroutine_yield();",
"ret = co.ret;",
"}",
"} else {",
"ret = 0;",
"}",
"if (ret < 0) {",
"goto out;",
"}",
"flush_parent:\nret = bs->file ? bdrv_co_flush(bs->file->bs) : 0;",
"out:\nbs->flushed_gen = current_gen;",
"qemu_co_queue_restart_all(&bs->flush_queue);",
"tracked_request_end(&req);",
"return ret;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
2
],
[
3
],
[
4
],
[
5,
6
],
[
7
],
[
8
],
[
9
],
[
10
],
[
12
],
[
13
],
[
14
],
[
15
],
[
17
],
[
18
],
[
19
],
[
20
],
[
22
],
[
23
],
[
24
],
[
25
],
[
26
],
[
27
],
[
28
],
[
30
],
[
31
],
[
32
],
[
34
],
[
35
],
[
36
],
[
37
],
[
38
],
[
39
],
[
40
],
[
41
],
[
42
],
[
43,
44
],
[
45
],
[
46
],
[
47
],
[
48
],
[
49
],
[
50
],
[
51
],
[
52
],
[
64
],
[
65
],
[
66
],
[
67
],
[
68
],
[
72,
73
],
[
74,
76
],
[
77
],
[
78
],
[
79
],
[
80
]
] |
7,293 |
static int modify_current_stream(HTTPContext *c, char *rates)
{
int i;
FFStream *req = c->stream;
int action_required = 0;
for (i = 0; i < req->nb_streams; i++) {
AVCodecContext *codec = &req->streams[i]->codec;
switch(rates[i]) {
case 0:
c->switch_feed_streams[i] = req->feed_streams[i];
break;
case 1:
c->switch_feed_streams[i] = find_stream_in_feed(req->feed, codec, codec->bit_rate / 2);
break;
case 2:
/* Wants off or slow */
c->switch_feed_streams[i] = find_stream_in_feed(req->feed, codec, codec->bit_rate / 4);
#ifdef WANTS_OFF
/* This doesn't work well when it turns off the only stream! */
c->switch_feed_streams[i] = -2;
c->feed_streams[i] = -2;
#endif
break;
}
if (c->switch_feed_streams[i] >= 0 && c->switch_feed_streams[i] != c->feed_streams[i])
action_required = 1;
}
return action_required;
}
| true |
FFmpeg
|
001bcd29556b32c1afd686c03f6bdd65dd0e9a36
|
static int modify_current_stream(HTTPContext *c, char *rates)
{
int i;
FFStream *req = c->stream;
int action_required = 0;
for (i = 0; i < req->nb_streams; i++) {
AVCodecContext *codec = &req->streams[i]->codec;
switch(rates[i]) {
case 0:
c->switch_feed_streams[i] = req->feed_streams[i];
break;
case 1:
c->switch_feed_streams[i] = find_stream_in_feed(req->feed, codec, codec->bit_rate / 2);
break;
case 2:
c->switch_feed_streams[i] = find_stream_in_feed(req->feed, codec, codec->bit_rate / 4);
#ifdef WANTS_OFF
c->switch_feed_streams[i] = -2;
c->feed_streams[i] = -2;
#endif
break;
}
if (c->switch_feed_streams[i] >= 0 && c->switch_feed_streams[i] != c->feed_streams[i])
action_required = 1;
}
return action_required;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(HTTPContext *VAR_0, char *VAR_1)
{
int VAR_2;
FFStream *req = VAR_0->stream;
int VAR_3 = 0;
for (VAR_2 = 0; VAR_2 < req->nb_streams; VAR_2++) {
AVCodecContext *codec = &req->streams[VAR_2]->codec;
switch(VAR_1[VAR_2]) {
case 0:
VAR_0->switch_feed_streams[VAR_2] = req->feed_streams[VAR_2];
break;
case 1:
VAR_0->switch_feed_streams[VAR_2] = find_stream_in_feed(req->feed, codec, codec->bit_rate / 2);
break;
case 2:
VAR_0->switch_feed_streams[VAR_2] = find_stream_in_feed(req->feed, codec, codec->bit_rate / 4);
#ifdef WANTS_OFF
VAR_0->switch_feed_streams[VAR_2] = -2;
VAR_0->feed_streams[VAR_2] = -2;
#endif
break;
}
if (VAR_0->switch_feed_streams[VAR_2] >= 0 && VAR_0->switch_feed_streams[VAR_2] != VAR_0->feed_streams[VAR_2])
VAR_3 = 1;
}
return VAR_3;
}
|
[
"static int FUNC_0(HTTPContext *VAR_0, char *VAR_1)\n{",
"int VAR_2;",
"FFStream *req = VAR_0->stream;",
"int VAR_3 = 0;",
"for (VAR_2 = 0; VAR_2 < req->nb_streams; VAR_2++) {",
"AVCodecContext *codec = &req->streams[VAR_2]->codec;",
"switch(VAR_1[VAR_2]) {",
"case 0:\nVAR_0->switch_feed_streams[VAR_2] = req->feed_streams[VAR_2];",
"break;",
"case 1:\nVAR_0->switch_feed_streams[VAR_2] = find_stream_in_feed(req->feed, codec, codec->bit_rate / 2);",
"break;",
"case 2:\nVAR_0->switch_feed_streams[VAR_2] = find_stream_in_feed(req->feed, codec, codec->bit_rate / 4);",
"#ifdef WANTS_OFF\nVAR_0->switch_feed_streams[VAR_2] = -2;",
"VAR_0->feed_streams[VAR_2] = -2;",
"#endif\nbreak;",
"}",
"if (VAR_0->switch_feed_streams[VAR_2] >= 0 && VAR_0->switch_feed_streams[VAR_2] != VAR_0->feed_streams[VAR_2])\nVAR_3 = 1;",
"}",
"return VAR_3;",
"}"
] |
[
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,
17
],
[
18,
20
],
[
21
],
[
22,
23
],
[
24
],
[
25,
26
],
[
27
],
[
28
],
[
29
]
] |
7,294 |
static int cirrus_bitblt_cputovideo(CirrusVGAState * s)
{
int w;
if (blit_is_unsafe(s, true)) {
return 0;
}
s->cirrus_blt_mode &= ~CIRRUS_BLTMODE_MEMSYSSRC;
s->cirrus_srcptr = &s->cirrus_bltbuf[0];
s->cirrus_srcptr_end = &s->cirrus_bltbuf[0];
if (s->cirrus_blt_mode & CIRRUS_BLTMODE_PATTERNCOPY) {
if (s->cirrus_blt_mode & CIRRUS_BLTMODE_COLOREXPAND) {
s->cirrus_blt_srcpitch = 8;
} else {
/* XXX: check for 24 bpp */
s->cirrus_blt_srcpitch = 8 * 8 * s->cirrus_blt_pixelwidth;
}
s->cirrus_srccounter = s->cirrus_blt_srcpitch;
} else {
if (s->cirrus_blt_mode & CIRRUS_BLTMODE_COLOREXPAND) {
w = s->cirrus_blt_width / s->cirrus_blt_pixelwidth;
if (s->cirrus_blt_modeext & CIRRUS_BLTMODEEXT_DWORDGRANULARITY)
s->cirrus_blt_srcpitch = ((w + 31) >> 5);
else
s->cirrus_blt_srcpitch = ((w + 7) >> 3);
} else {
/* always align input size to 32 bits */
s->cirrus_blt_srcpitch = (s->cirrus_blt_width + 3) & ~3;
}
s->cirrus_srccounter = s->cirrus_blt_srcpitch * s->cirrus_blt_height;
}
s->cirrus_srcptr = s->cirrus_bltbuf;
s->cirrus_srcptr_end = s->cirrus_bltbuf + s->cirrus_blt_srcpitch;
cirrus_update_memory_access(s);
return 1;
}
| true |
qemu
|
92f2b88cea48c6aeba8de568a45f2ed958f3c298
|
static int cirrus_bitblt_cputovideo(CirrusVGAState * s)
{
int w;
if (blit_is_unsafe(s, true)) {
return 0;
}
s->cirrus_blt_mode &= ~CIRRUS_BLTMODE_MEMSYSSRC;
s->cirrus_srcptr = &s->cirrus_bltbuf[0];
s->cirrus_srcptr_end = &s->cirrus_bltbuf[0];
if (s->cirrus_blt_mode & CIRRUS_BLTMODE_PATTERNCOPY) {
if (s->cirrus_blt_mode & CIRRUS_BLTMODE_COLOREXPAND) {
s->cirrus_blt_srcpitch = 8;
} else {
s->cirrus_blt_srcpitch = 8 * 8 * s->cirrus_blt_pixelwidth;
}
s->cirrus_srccounter = s->cirrus_blt_srcpitch;
} else {
if (s->cirrus_blt_mode & CIRRUS_BLTMODE_COLOREXPAND) {
w = s->cirrus_blt_width / s->cirrus_blt_pixelwidth;
if (s->cirrus_blt_modeext & CIRRUS_BLTMODEEXT_DWORDGRANULARITY)
s->cirrus_blt_srcpitch = ((w + 31) >> 5);
else
s->cirrus_blt_srcpitch = ((w + 7) >> 3);
} else {
s->cirrus_blt_srcpitch = (s->cirrus_blt_width + 3) & ~3;
}
s->cirrus_srccounter = s->cirrus_blt_srcpitch * s->cirrus_blt_height;
}
s->cirrus_srcptr = s->cirrus_bltbuf;
s->cirrus_srcptr_end = s->cirrus_bltbuf + s->cirrus_blt_srcpitch;
cirrus_update_memory_access(s);
return 1;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(CirrusVGAState * VAR_0)
{
int VAR_1;
if (blit_is_unsafe(VAR_0, true)) {
return 0;
}
VAR_0->cirrus_blt_mode &= ~CIRRUS_BLTMODE_MEMSYSSRC;
VAR_0->cirrus_srcptr = &VAR_0->cirrus_bltbuf[0];
VAR_0->cirrus_srcptr_end = &VAR_0->cirrus_bltbuf[0];
if (VAR_0->cirrus_blt_mode & CIRRUS_BLTMODE_PATTERNCOPY) {
if (VAR_0->cirrus_blt_mode & CIRRUS_BLTMODE_COLOREXPAND) {
VAR_0->cirrus_blt_srcpitch = 8;
} else {
VAR_0->cirrus_blt_srcpitch = 8 * 8 * VAR_0->cirrus_blt_pixelwidth;
}
VAR_0->cirrus_srccounter = VAR_0->cirrus_blt_srcpitch;
} else {
if (VAR_0->cirrus_blt_mode & CIRRUS_BLTMODE_COLOREXPAND) {
VAR_1 = VAR_0->cirrus_blt_width / VAR_0->cirrus_blt_pixelwidth;
if (VAR_0->cirrus_blt_modeext & CIRRUS_BLTMODEEXT_DWORDGRANULARITY)
VAR_0->cirrus_blt_srcpitch = ((VAR_1 + 31) >> 5);
else
VAR_0->cirrus_blt_srcpitch = ((VAR_1 + 7) >> 3);
} else {
VAR_0->cirrus_blt_srcpitch = (VAR_0->cirrus_blt_width + 3) & ~3;
}
VAR_0->cirrus_srccounter = VAR_0->cirrus_blt_srcpitch * VAR_0->cirrus_blt_height;
}
VAR_0->cirrus_srcptr = VAR_0->cirrus_bltbuf;
VAR_0->cirrus_srcptr_end = VAR_0->cirrus_bltbuf + VAR_0->cirrus_blt_srcpitch;
cirrus_update_memory_access(VAR_0);
return 1;
}
|
[
"static int FUNC_0(CirrusVGAState * VAR_0)\n{",
"int VAR_1;",
"if (blit_is_unsafe(VAR_0, true)) {",
"return 0;",
"}",
"VAR_0->cirrus_blt_mode &= ~CIRRUS_BLTMODE_MEMSYSSRC;",
"VAR_0->cirrus_srcptr = &VAR_0->cirrus_bltbuf[0];",
"VAR_0->cirrus_srcptr_end = &VAR_0->cirrus_bltbuf[0];",
"if (VAR_0->cirrus_blt_mode & CIRRUS_BLTMODE_PATTERNCOPY) {",
"if (VAR_0->cirrus_blt_mode & CIRRUS_BLTMODE_COLOREXPAND) {",
"VAR_0->cirrus_blt_srcpitch = 8;",
"} else {",
"VAR_0->cirrus_blt_srcpitch = 8 * 8 * VAR_0->cirrus_blt_pixelwidth;",
"}",
"VAR_0->cirrus_srccounter = VAR_0->cirrus_blt_srcpitch;",
"} else {",
"if (VAR_0->cirrus_blt_mode & CIRRUS_BLTMODE_COLOREXPAND) {",
"VAR_1 = VAR_0->cirrus_blt_width / VAR_0->cirrus_blt_pixelwidth;",
"if (VAR_0->cirrus_blt_modeext & CIRRUS_BLTMODEEXT_DWORDGRANULARITY)\nVAR_0->cirrus_blt_srcpitch = ((VAR_1 + 31) >> 5);",
"else\nVAR_0->cirrus_blt_srcpitch = ((VAR_1 + 7) >> 3);",
"} else {",
"VAR_0->cirrus_blt_srcpitch = (VAR_0->cirrus_blt_width + 3) & ~3;",
"}",
"VAR_0->cirrus_srccounter = VAR_0->cirrus_blt_srcpitch * VAR_0->cirrus_blt_height;",
"}",
"VAR_0->cirrus_srcptr = VAR_0->cirrus_bltbuf;",
"VAR_0->cirrus_srcptr_end = VAR_0->cirrus_bltbuf + VAR_0->cirrus_blt_srcpitch;",
"cirrus_update_memory_access(VAR_0);",
"return 1;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
2
],
[
3
],
[
4
],
[
5
],
[
6
],
[
7
],
[
8
],
[
9
],
[
10
],
[
11
],
[
12
],
[
13
],
[
15
],
[
16
],
[
17
],
[
18
],
[
19
],
[
20
],
[
21,
22
],
[
23,
24
],
[
25
],
[
27
],
[
28
],
[
29
],
[
30
],
[
31
],
[
32
],
[
33
],
[
34
],
[
35
]
] |
7,296 |
static void vfio_amd_xgbe_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
VFIOAmdXgbeDeviceClass *vcxc =
VFIO_AMD_XGBE_DEVICE_CLASS(klass);
vcxc->parent_realize = dc->realize;
dc->realize = amd_xgbe_realize;
dc->desc = "VFIO AMD XGBE";
dc->vmsd = &vfio_platform_amd_xgbe_vmstate;
}
| true |
qemu
|
e4f4fb1eca795e36f363b4647724221e774523c1
|
static void vfio_amd_xgbe_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
VFIOAmdXgbeDeviceClass *vcxc =
VFIO_AMD_XGBE_DEVICE_CLASS(klass);
vcxc->parent_realize = dc->realize;
dc->realize = amd_xgbe_realize;
dc->desc = "VFIO AMD XGBE";
dc->vmsd = &vfio_platform_amd_xgbe_vmstate;
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)
{
DeviceClass *dc = DEVICE_CLASS(VAR_0);
VFIOAmdXgbeDeviceClass *vcxc =
VFIO_AMD_XGBE_DEVICE_CLASS(VAR_0);
vcxc->parent_realize = dc->realize;
dc->realize = amd_xgbe_realize;
dc->desc = "VFIO AMD XGBE";
dc->vmsd = &vfio_platform_amd_xgbe_vmstate;
}
|
[
"static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{",
"DeviceClass *dc = DEVICE_CLASS(VAR_0);",
"VFIOAmdXgbeDeviceClass *vcxc =\nVFIO_AMD_XGBE_DEVICE_CLASS(VAR_0);",
"vcxc->parent_realize = dc->realize;",
"dc->realize = amd_xgbe_realize;",
"dc->desc = \"VFIO AMD XGBE\";",
"dc->vmsd = &vfio_platform_amd_xgbe_vmstate;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7,
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
21
]
] |
7,297 |
static int hls_window(AVFormatContext *s, int last)
{
HLSContext *hls = s->priv_data;
HLSSegment *en;
int target_duration = 0;
int ret = 0;
AVIOContext *out = NULL;
AVIOContext *sub_out = NULL;
char temp_filename[1024];
int64_t sequence = FFMAX(hls->start_sequence, hls->sequence - hls->nb_entries);
int version = 3;
const char *proto = avio_find_protocol_name(s->filename);
int use_rename = proto && !strcmp(proto, "file");
static unsigned warned_non_file;
char *key_uri = NULL;
char *iv_string = NULL;
AVDictionary *options = NULL;
double prog_date_time = hls->initial_prog_date_time;
int byterange_mode = (hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size > 0);
if (byterange_mode) {
version = 4;
sequence = 0;
}
if (hls->segment_type == SEGMENT_TYPE_FMP4) {
version = 7;
}
if (!use_rename && !warned_non_file++)
av_log(s, AV_LOG_ERROR, "Cannot use rename on non file protocol, this may lead to races and temporary partial files\n");
set_http_options(s, &options, hls);
snprintf(temp_filename, sizeof(temp_filename), use_rename ? "%s.tmp" : "%s", s->filename);
if ((ret = s->io_open(s, &out, temp_filename, AVIO_FLAG_WRITE, &options)) < 0)
goto fail;
for (en = hls->segments; en; en = en->next) {
if (target_duration <= en->duration)
target_duration = get_int_from_double(en->duration);
}
hls->discontinuity_set = 0;
write_m3u8_head_block(hls, out, version, target_duration, sequence);
if (hls->pl_type == PLAYLIST_TYPE_EVENT) {
avio_printf(out, "#EXT-X-PLAYLIST-TYPE:EVENT\n");
} else if (hls->pl_type == PLAYLIST_TYPE_VOD) {
avio_printf(out, "#EXT-X-PLAYLIST-TYPE:VOD\n");
}
if((hls->flags & HLS_DISCONT_START) && sequence==hls->start_sequence && hls->discontinuity_set==0 ){
avio_printf(out, "#EXT-X-DISCONTINUITY\n");
hls->discontinuity_set = 1;
}
for (en = hls->segments; en; en = en->next) {
if ((hls->encrypt || hls->key_info_file) && (!key_uri || strcmp(en->key_uri, key_uri) ||
av_strcasecmp(en->iv_string, iv_string))) {
avio_printf(out, "#EXT-X-KEY:METHOD=AES-128,URI=\"%s\"", en->key_uri);
if (*en->iv_string)
avio_printf(out, ",IV=0x%s", en->iv_string);
avio_printf(out, "\n");
key_uri = en->key_uri;
iv_string = en->iv_string;
}
if (en->discont) {
avio_printf(out, "#EXT-X-DISCONTINUITY\n");
}
if ((hls->segment_type == SEGMENT_TYPE_FMP4) && (en == hls->segments)) {
avio_printf(out, "#EXT-X-MAP:URI=\"%s\"", hls->fmp4_init_filename);
if (hls->flags & HLS_SINGLE_FILE) {
avio_printf(out, ",BYTERANGE=\"%"PRId64"@%"PRId64"\"", en->size, en->pos);
}
avio_printf(out, "\n");
} else {
if (hls->flags & HLS_ROUND_DURATIONS)
avio_printf(out, "#EXTINF:%ld,\n", lrint(en->duration));
else
avio_printf(out, "#EXTINF:%f,\n", en->duration);
if (byterange_mode)
avio_printf(out, "#EXT-X-BYTERANGE:%"PRId64"@%"PRId64"\n",
en->size, en->pos);
}
if (hls->flags & HLS_PROGRAM_DATE_TIME) {
time_t tt, wrongsecs;
int milli;
struct tm *tm, tmpbuf;
char buf0[128], buf1[128];
tt = (int64_t)prog_date_time;
milli = av_clip(lrint(1000*(prog_date_time - tt)), 0, 999);
tm = localtime_r(&tt, &tmpbuf);
strftime(buf0, sizeof(buf0), "%Y-%m-%dT%H:%M:%S", tm);
if (!strftime(buf1, sizeof(buf1), "%z", tm) || buf1[1]<'0' ||buf1[1]>'2') {
int tz_min, dst = tm->tm_isdst;
tm = gmtime_r(&tt, &tmpbuf);
tm->tm_isdst = dst;
wrongsecs = mktime(tm);
tz_min = (abs(wrongsecs - tt) + 30) / 60;
snprintf(buf1, sizeof(buf1),
"%c%02d%02d",
wrongsecs <= tt ? '+' : '-',
tz_min / 60,
tz_min % 60);
}
avio_printf(out, "#EXT-X-PROGRAM-DATE-TIME:%s.%03d%s\n", buf0, milli, buf1);
prog_date_time += en->duration;
}
if (!((hls->segment_type == SEGMENT_TYPE_FMP4) && (en == hls->segments))) {
if (hls->baseurl)
avio_printf(out, "%s", hls->baseurl);
avio_printf(out, "%s\n", en->filename);
}
}
if (last && (hls->flags & HLS_OMIT_ENDLIST)==0)
avio_printf(out, "#EXT-X-ENDLIST\n");
if( hls->vtt_m3u8_name ) {
if ((ret = s->io_open(s, &sub_out, hls->vtt_m3u8_name, AVIO_FLAG_WRITE, &options)) < 0)
goto fail;
write_m3u8_head_block(hls, sub_out, version, target_duration, sequence);
for (en = hls->segments; en; en = en->next) {
avio_printf(sub_out, "#EXTINF:%f,\n", en->duration);
if (byterange_mode)
avio_printf(sub_out, "#EXT-X-BYTERANGE:%"PRIi64"@%"PRIi64"\n",
en->size, en->pos);
if (hls->baseurl)
avio_printf(sub_out, "%s", hls->baseurl);
avio_printf(sub_out, "%s\n", en->sub_filename);
}
if (last)
avio_printf(sub_out, "#EXT-X-ENDLIST\n");
}
fail:
av_dict_free(&options);
ff_format_io_close(s, &out);
ff_format_io_close(s, &sub_out);
if (ret >= 0 && use_rename)
ff_rename(temp_filename, s->filename, s);
return ret;
}
| true |
FFmpeg
|
c3e279e75227946046ccb447d355b557118a616c
|
static int hls_window(AVFormatContext *s, int last)
{
HLSContext *hls = s->priv_data;
HLSSegment *en;
int target_duration = 0;
int ret = 0;
AVIOContext *out = NULL;
AVIOContext *sub_out = NULL;
char temp_filename[1024];
int64_t sequence = FFMAX(hls->start_sequence, hls->sequence - hls->nb_entries);
int version = 3;
const char *proto = avio_find_protocol_name(s->filename);
int use_rename = proto && !strcmp(proto, "file");
static unsigned warned_non_file;
char *key_uri = NULL;
char *iv_string = NULL;
AVDictionary *options = NULL;
double prog_date_time = hls->initial_prog_date_time;
int byterange_mode = (hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size > 0);
if (byterange_mode) {
version = 4;
sequence = 0;
}
if (hls->segment_type == SEGMENT_TYPE_FMP4) {
version = 7;
}
if (!use_rename && !warned_non_file++)
av_log(s, AV_LOG_ERROR, "Cannot use rename on non file protocol, this may lead to races and temporary partial files\n");
set_http_options(s, &options, hls);
snprintf(temp_filename, sizeof(temp_filename), use_rename ? "%s.tmp" : "%s", s->filename);
if ((ret = s->io_open(s, &out, temp_filename, AVIO_FLAG_WRITE, &options)) < 0)
goto fail;
for (en = hls->segments; en; en = en->next) {
if (target_duration <= en->duration)
target_duration = get_int_from_double(en->duration);
}
hls->discontinuity_set = 0;
write_m3u8_head_block(hls, out, version, target_duration, sequence);
if (hls->pl_type == PLAYLIST_TYPE_EVENT) {
avio_printf(out, "#EXT-X-PLAYLIST-TYPE:EVENT\n");
} else if (hls->pl_type == PLAYLIST_TYPE_VOD) {
avio_printf(out, "#EXT-X-PLAYLIST-TYPE:VOD\n");
}
if((hls->flags & HLS_DISCONT_START) && sequence==hls->start_sequence && hls->discontinuity_set==0 ){
avio_printf(out, "#EXT-X-DISCONTINUITY\n");
hls->discontinuity_set = 1;
}
for (en = hls->segments; en; en = en->next) {
if ((hls->encrypt || hls->key_info_file) && (!key_uri || strcmp(en->key_uri, key_uri) ||
av_strcasecmp(en->iv_string, iv_string))) {
avio_printf(out, "#EXT-X-KEY:METHOD=AES-128,URI=\"%s\"", en->key_uri);
if (*en->iv_string)
avio_printf(out, ",IV=0x%s", en->iv_string);
avio_printf(out, "\n");
key_uri = en->key_uri;
iv_string = en->iv_string;
}
if (en->discont) {
avio_printf(out, "#EXT-X-DISCONTINUITY\n");
}
if ((hls->segment_type == SEGMENT_TYPE_FMP4) && (en == hls->segments)) {
avio_printf(out, "#EXT-X-MAP:URI=\"%s\"", hls->fmp4_init_filename);
if (hls->flags & HLS_SINGLE_FILE) {
avio_printf(out, ",BYTERANGE=\"%"PRId64"@%"PRId64"\"", en->size, en->pos);
}
avio_printf(out, "\n");
} else {
if (hls->flags & HLS_ROUND_DURATIONS)
avio_printf(out, "#EXTINF:%ld,\n", lrint(en->duration));
else
avio_printf(out, "#EXTINF:%f,\n", en->duration);
if (byterange_mode)
avio_printf(out, "#EXT-X-BYTERANGE:%"PRId64"@%"PRId64"\n",
en->size, en->pos);
}
if (hls->flags & HLS_PROGRAM_DATE_TIME) {
time_t tt, wrongsecs;
int milli;
struct tm *tm, tmpbuf;
char buf0[128], buf1[128];
tt = (int64_t)prog_date_time;
milli = av_clip(lrint(1000*(prog_date_time - tt)), 0, 999);
tm = localtime_r(&tt, &tmpbuf);
strftime(buf0, sizeof(buf0), "%Y-%m-%dT%H:%M:%S", tm);
if (!strftime(buf1, sizeof(buf1), "%z", tm) || buf1[1]<'0' ||buf1[1]>'2') {
int tz_min, dst = tm->tm_isdst;
tm = gmtime_r(&tt, &tmpbuf);
tm->tm_isdst = dst;
wrongsecs = mktime(tm);
tz_min = (abs(wrongsecs - tt) + 30) / 60;
snprintf(buf1, sizeof(buf1),
"%c%02d%02d",
wrongsecs <= tt ? '+' : '-',
tz_min / 60,
tz_min % 60);
}
avio_printf(out, "#EXT-X-PROGRAM-DATE-TIME:%s.%03d%s\n", buf0, milli, buf1);
prog_date_time += en->duration;
}
if (!((hls->segment_type == SEGMENT_TYPE_FMP4) && (en == hls->segments))) {
if (hls->baseurl)
avio_printf(out, "%s", hls->baseurl);
avio_printf(out, "%s\n", en->filename);
}
}
if (last && (hls->flags & HLS_OMIT_ENDLIST)==0)
avio_printf(out, "#EXT-X-ENDLIST\n");
if( hls->vtt_m3u8_name ) {
if ((ret = s->io_open(s, &sub_out, hls->vtt_m3u8_name, AVIO_FLAG_WRITE, &options)) < 0)
goto fail;
write_m3u8_head_block(hls, sub_out, version, target_duration, sequence);
for (en = hls->segments; en; en = en->next) {
avio_printf(sub_out, "#EXTINF:%f,\n", en->duration);
if (byterange_mode)
avio_printf(sub_out, "#EXT-X-BYTERANGE:%"PRIi64"@%"PRIi64"\n",
en->size, en->pos);
if (hls->baseurl)
avio_printf(sub_out, "%s", hls->baseurl);
avio_printf(sub_out, "%s\n", en->sub_filename);
}
if (last)
avio_printf(sub_out, "#EXT-X-ENDLIST\n");
}
fail:
av_dict_free(&options);
ff_format_io_close(s, &out);
ff_format_io_close(s, &sub_out);
if (ret >= 0 && use_rename)
ff_rename(temp_filename, s->filename, s);
return ret;
}
|
{
"code": [
" } else {",
" if (!((hls->segment_type == SEGMENT_TYPE_FMP4) && (en == hls->segments))) {"
],
"line_no": [
151,
217
]
}
|
static int FUNC_0(AVFormatContext *VAR_0, int VAR_1)
{
HLSContext *hls = VAR_0->priv_data;
HLSSegment *en;
int VAR_2 = 0;
int VAR_3 = 0;
AVIOContext *out = NULL;
AVIOContext *sub_out = NULL;
char VAR_4[1024];
int64_t sequence = FFMAX(hls->start_sequence, hls->sequence - hls->nb_entries);
int VAR_5 = 3;
const char *VAR_6 = avio_find_protocol_name(VAR_0->filename);
int VAR_7 = VAR_6 && !strcmp(VAR_6, "file");
static unsigned VAR_8;
char *VAR_9 = NULL;
char *VAR_10 = NULL;
AVDictionary *options = NULL;
double VAR_11 = hls->initial_prog_date_time;
int VAR_12 = (hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size > 0);
if (VAR_12) {
VAR_5 = 4;
sequence = 0;
}
if (hls->segment_type == SEGMENT_TYPE_FMP4) {
VAR_5 = 7;
}
if (!VAR_7 && !VAR_8++)
av_log(VAR_0, AV_LOG_ERROR, "Cannot use rename on non file protocol, this may lead to races and temporary partial files\n");
set_http_options(VAR_0, &options, hls);
snprintf(VAR_4, sizeof(VAR_4), VAR_7 ? "%VAR_0.tmp" : "%VAR_0", VAR_0->filename);
if ((VAR_3 = VAR_0->io_open(VAR_0, &out, VAR_4, AVIO_FLAG_WRITE, &options)) < 0)
goto fail;
for (en = hls->segments; en; en = en->next) {
if (VAR_2 <= en->duration)
VAR_2 = get_int_from_double(en->duration);
}
hls->discontinuity_set = 0;
write_m3u8_head_block(hls, out, VAR_5, VAR_2, sequence);
if (hls->pl_type == PLAYLIST_TYPE_EVENT) {
avio_printf(out, "#EXT-X-PLAYLIST-TYPE:EVENT\n");
} else if (hls->pl_type == PLAYLIST_TYPE_VOD) {
avio_printf(out, "#EXT-X-PLAYLIST-TYPE:VOD\n");
}
if((hls->flags & HLS_DISCONT_START) && sequence==hls->start_sequence && hls->discontinuity_set==0 ){
avio_printf(out, "#EXT-X-DISCONTINUITY\n");
hls->discontinuity_set = 1;
}
for (en = hls->segments; en; en = en->next) {
if ((hls->encrypt || hls->key_info_file) && (!VAR_9 || strcmp(en->VAR_9, VAR_9) ||
av_strcasecmp(en->VAR_10, VAR_10))) {
avio_printf(out, "#EXT-X-KEY:METHOD=AES-128,URI=\"%VAR_0\"", en->VAR_9);
if (*en->VAR_10)
avio_printf(out, ",IV=0x%VAR_0", en->VAR_10);
avio_printf(out, "\n");
VAR_9 = en->VAR_9;
VAR_10 = en->VAR_10;
}
if (en->discont) {
avio_printf(out, "#EXT-X-DISCONTINUITY\n");
}
if ((hls->segment_type == SEGMENT_TYPE_FMP4) && (en == hls->segments)) {
avio_printf(out, "#EXT-X-MAP:URI=\"%VAR_0\"", hls->fmp4_init_filename);
if (hls->flags & HLS_SINGLE_FILE) {
avio_printf(out, ",BYTERANGE=\"%"PRId64"@%"PRId64"\"", en->size, en->pos);
}
avio_printf(out, "\n");
} else {
if (hls->flags & HLS_ROUND_DURATIONS)
avio_printf(out, "#EXTINF:%ld,\n", lrint(en->duration));
else
avio_printf(out, "#EXTINF:%f,\n", en->duration);
if (VAR_12)
avio_printf(out, "#EXT-X-BYTERANGE:%"PRId64"@%"PRId64"\n",
en->size, en->pos);
}
if (hls->flags & HLS_PROGRAM_DATE_TIME) {
time_t tt, wrongsecs;
int milli;
struct tm *tm, tmpbuf;
char buf0[128], buf1[128];
tt = (int64_t)VAR_11;
milli = av_clip(lrint(1000*(VAR_11 - tt)), 0, 999);
tm = localtime_r(&tt, &tmpbuf);
strftime(buf0, sizeof(buf0), "%Y-%m-%dT%H:%M:%S", tm);
if (!strftime(buf1, sizeof(buf1), "%z", tm) || buf1[1]<'0' ||buf1[1]>'2') {
int tz_min, dst = tm->tm_isdst;
tm = gmtime_r(&tt, &tmpbuf);
tm->tm_isdst = dst;
wrongsecs = mktime(tm);
tz_min = (abs(wrongsecs - tt) + 30) / 60;
snprintf(buf1, sizeof(buf1),
"%c%02d%02d",
wrongsecs <= tt ? '+' : '-',
tz_min / 60,
tz_min % 60);
}
avio_printf(out, "#EXT-X-PROGRAM-DATE-TIME:%VAR_0.%03d%VAR_0\n", buf0, milli, buf1);
VAR_11 += en->duration;
}
if (!((hls->segment_type == SEGMENT_TYPE_FMP4) && (en == hls->segments))) {
if (hls->baseurl)
avio_printf(out, "%VAR_0", hls->baseurl);
avio_printf(out, "%VAR_0\n", en->filename);
}
}
if (VAR_1 && (hls->flags & HLS_OMIT_ENDLIST)==0)
avio_printf(out, "#EXT-X-ENDLIST\n");
if( hls->vtt_m3u8_name ) {
if ((VAR_3 = VAR_0->io_open(VAR_0, &sub_out, hls->vtt_m3u8_name, AVIO_FLAG_WRITE, &options)) < 0)
goto fail;
write_m3u8_head_block(hls, sub_out, VAR_5, VAR_2, sequence);
for (en = hls->segments; en; en = en->next) {
avio_printf(sub_out, "#EXTINF:%f,\n", en->duration);
if (VAR_12)
avio_printf(sub_out, "#EXT-X-BYTERANGE:%"PRIi64"@%"PRIi64"\n",
en->size, en->pos);
if (hls->baseurl)
avio_printf(sub_out, "%VAR_0", hls->baseurl);
avio_printf(sub_out, "%VAR_0\n", en->sub_filename);
}
if (VAR_1)
avio_printf(sub_out, "#EXT-X-ENDLIST\n");
}
fail:
av_dict_free(&options);
ff_format_io_close(VAR_0, &out);
ff_format_io_close(VAR_0, &sub_out);
if (VAR_3 >= 0 && VAR_7)
ff_rename(VAR_4, VAR_0->filename, VAR_0);
return VAR_3;
}
|
[
"static int FUNC_0(AVFormatContext *VAR_0, int VAR_1)\n{",
"HLSContext *hls = VAR_0->priv_data;",
"HLSSegment *en;",
"int VAR_2 = 0;",
"int VAR_3 = 0;",
"AVIOContext *out = NULL;",
"AVIOContext *sub_out = NULL;",
"char VAR_4[1024];",
"int64_t sequence = FFMAX(hls->start_sequence, hls->sequence - hls->nb_entries);",
"int VAR_5 = 3;",
"const char *VAR_6 = avio_find_protocol_name(VAR_0->filename);",
"int VAR_7 = VAR_6 && !strcmp(VAR_6, \"file\");",
"static unsigned VAR_8;",
"char *VAR_9 = NULL;",
"char *VAR_10 = NULL;",
"AVDictionary *options = NULL;",
"double VAR_11 = hls->initial_prog_date_time;",
"int VAR_12 = (hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size > 0);",
"if (VAR_12) {",
"VAR_5 = 4;",
"sequence = 0;",
"}",
"if (hls->segment_type == SEGMENT_TYPE_FMP4) {",
"VAR_5 = 7;",
"}",
"if (!VAR_7 && !VAR_8++)\nav_log(VAR_0, AV_LOG_ERROR, \"Cannot use rename on non file protocol, this may lead to races and temporary partial files\\n\");",
"set_http_options(VAR_0, &options, hls);",
"snprintf(VAR_4, sizeof(VAR_4), VAR_7 ? \"%VAR_0.tmp\" : \"%VAR_0\", VAR_0->filename);",
"if ((VAR_3 = VAR_0->io_open(VAR_0, &out, VAR_4, AVIO_FLAG_WRITE, &options)) < 0)\ngoto fail;",
"for (en = hls->segments; en; en = en->next) {",
"if (VAR_2 <= en->duration)\nVAR_2 = get_int_from_double(en->duration);",
"}",
"hls->discontinuity_set = 0;",
"write_m3u8_head_block(hls, out, VAR_5, VAR_2, sequence);",
"if (hls->pl_type == PLAYLIST_TYPE_EVENT) {",
"avio_printf(out, \"#EXT-X-PLAYLIST-TYPE:EVENT\\n\");",
"} else if (hls->pl_type == PLAYLIST_TYPE_VOD) {",
"avio_printf(out, \"#EXT-X-PLAYLIST-TYPE:VOD\\n\");",
"}",
"if((hls->flags & HLS_DISCONT_START) && sequence==hls->start_sequence && hls->discontinuity_set==0 ){",
"avio_printf(out, \"#EXT-X-DISCONTINUITY\\n\");",
"hls->discontinuity_set = 1;",
"}",
"for (en = hls->segments; en; en = en->next) {",
"if ((hls->encrypt || hls->key_info_file) && (!VAR_9 || strcmp(en->VAR_9, VAR_9) ||\nav_strcasecmp(en->VAR_10, VAR_10))) {",
"avio_printf(out, \"#EXT-X-KEY:METHOD=AES-128,URI=\\\"%VAR_0\\\"\", en->VAR_9);",
"if (*en->VAR_10)\navio_printf(out, \",IV=0x%VAR_0\", en->VAR_10);",
"avio_printf(out, \"\\n\");",
"VAR_9 = en->VAR_9;",
"VAR_10 = en->VAR_10;",
"}",
"if (en->discont) {",
"avio_printf(out, \"#EXT-X-DISCONTINUITY\\n\");",
"}",
"if ((hls->segment_type == SEGMENT_TYPE_FMP4) && (en == hls->segments)) {",
"avio_printf(out, \"#EXT-X-MAP:URI=\\\"%VAR_0\\\"\", hls->fmp4_init_filename);",
"if (hls->flags & HLS_SINGLE_FILE) {",
"avio_printf(out, \",BYTERANGE=\\\"%\"PRId64\"@%\"PRId64\"\\\"\", en->size, en->pos);",
"}",
"avio_printf(out, \"\\n\");",
"} else {",
"if (hls->flags & HLS_ROUND_DURATIONS)\navio_printf(out, \"#EXTINF:%ld,\\n\", lrint(en->duration));",
"else\navio_printf(out, \"#EXTINF:%f,\\n\", en->duration);",
"if (VAR_12)\navio_printf(out, \"#EXT-X-BYTERANGE:%\"PRId64\"@%\"PRId64\"\\n\",\nen->size, en->pos);",
"}",
"if (hls->flags & HLS_PROGRAM_DATE_TIME) {",
"time_t tt, wrongsecs;",
"int milli;",
"struct tm *tm, tmpbuf;",
"char buf0[128], buf1[128];",
"tt = (int64_t)VAR_11;",
"milli = av_clip(lrint(1000*(VAR_11 - tt)), 0, 999);",
"tm = localtime_r(&tt, &tmpbuf);",
"strftime(buf0, sizeof(buf0), \"%Y-%m-%dT%H:%M:%S\", tm);",
"if (!strftime(buf1, sizeof(buf1), \"%z\", tm) || buf1[1]<'0' ||buf1[1]>'2') {",
"int tz_min, dst = tm->tm_isdst;",
"tm = gmtime_r(&tt, &tmpbuf);",
"tm->tm_isdst = dst;",
"wrongsecs = mktime(tm);",
"tz_min = (abs(wrongsecs - tt) + 30) / 60;",
"snprintf(buf1, sizeof(buf1),\n\"%c%02d%02d\",\nwrongsecs <= tt ? '+' : '-',\ntz_min / 60,\ntz_min % 60);",
"}",
"avio_printf(out, \"#EXT-X-PROGRAM-DATE-TIME:%VAR_0.%03d%VAR_0\\n\", buf0, milli, buf1);",
"VAR_11 += en->duration;",
"}",
"if (!((hls->segment_type == SEGMENT_TYPE_FMP4) && (en == hls->segments))) {",
"if (hls->baseurl)\navio_printf(out, \"%VAR_0\", hls->baseurl);",
"avio_printf(out, \"%VAR_0\\n\", en->filename);",
"}",
"}",
"if (VAR_1 && (hls->flags & HLS_OMIT_ENDLIST)==0)\navio_printf(out, \"#EXT-X-ENDLIST\\n\");",
"if( hls->vtt_m3u8_name ) {",
"if ((VAR_3 = VAR_0->io_open(VAR_0, &sub_out, hls->vtt_m3u8_name, AVIO_FLAG_WRITE, &options)) < 0)\ngoto fail;",
"write_m3u8_head_block(hls, sub_out, VAR_5, VAR_2, sequence);",
"for (en = hls->segments; en; en = en->next) {",
"avio_printf(sub_out, \"#EXTINF:%f,\\n\", en->duration);",
"if (VAR_12)\navio_printf(sub_out, \"#EXT-X-BYTERANGE:%\"PRIi64\"@%\"PRIi64\"\\n\",\nen->size, en->pos);",
"if (hls->baseurl)\navio_printf(sub_out, \"%VAR_0\", hls->baseurl);",
"avio_printf(sub_out, \"%VAR_0\\n\", en->sub_filename);",
"}",
"if (VAR_1)\navio_printf(sub_out, \"#EXT-X-ENDLIST\\n\");",
"}",
"fail:\nav_dict_free(&options);",
"ff_format_io_close(VAR_0, &out);",
"ff_format_io_close(VAR_0, &sub_out);",
"if (VAR_3 >= 0 && VAR_7)\nff_rename(VAR_4, VAR_0->filename, VAR_0);",
"return VAR_3;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
41
],
[
43
],
[
45
],
[
47
],
[
51
],
[
53
],
[
55
],
[
59,
61
],
[
65
],
[
67
],
[
69,
71
],
[
75
],
[
77,
79
],
[
81
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111,
113
],
[
115
],
[
117,
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
131
],
[
133
],
[
135
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149
],
[
151
],
[
153,
155
],
[
157,
159
],
[
161,
163,
165
],
[
167
],
[
169
],
[
171
],
[
173
],
[
175
],
[
177
],
[
179
],
[
181
],
[
183
],
[
185
],
[
187
],
[
189
],
[
191
],
[
193
],
[
195
],
[
197
],
[
199,
201,
203,
205,
207
],
[
209
],
[
211
],
[
213
],
[
215
],
[
217
],
[
219,
221
],
[
223
],
[
225
],
[
227
],
[
231,
233
],
[
237
],
[
239,
241
],
[
243
],
[
247
],
[
249
],
[
251,
253,
255
],
[
257,
259
],
[
261
],
[
263
],
[
267,
269
],
[
273
],
[
277,
279
],
[
281
],
[
283
],
[
285,
287
],
[
289
],
[
291
]
] |
7,298 |
static inline void RENAME(nv12ToUV)(uint8_t *dstU, uint8_t *dstV,
const uint8_t *src1, const uint8_t *src2,
int width, uint32_t *unused)
{
RENAME(nvXXtoUV)(dstU, dstV, src1, width);
}
| true |
FFmpeg
|
c3ab0004ae4dffc32494ae84dd15cfaa909a7884
|
static inline void RENAME(nv12ToUV)(uint8_t *dstU, uint8_t *dstV,
const uint8_t *src1, const uint8_t *src2,
int width, uint32_t *unused)
{
RENAME(nvXXtoUV)(dstU, dstV, src1, width);
}
|
{
"code": [
" int width, uint32_t *unused)",
" int width, uint32_t *unused)"
],
"line_no": [
5,
5
]
}
|
static inline void FUNC_0(nv12ToUV)(uint8_t *dstU, uint8_t *dstV,
const uint8_t *src1, const uint8_t *src2,
int width, uint32_t *unused)
{
FUNC_0(nvXXtoUV)(dstU, dstV, src1, width);
}
|
[
"static inline void FUNC_0(nv12ToUV)(uint8_t *dstU, uint8_t *dstV,\nconst uint8_t *src1, const uint8_t *src2,\nint width, uint32_t *unused)\n{",
"FUNC_0(nvXXtoUV)(dstU, dstV, src1, width);",
"}"
] |
[
1,
0,
0
] |
[
[
1,
3,
5,
7
],
[
9
],
[
11
]
] |
7,299 |
void blk_eject(BlockBackend *blk, bool eject_flag)
{
BlockDriverState *bs = blk_bs(blk);
char *id;
/* blk_eject is only called by qdevified devices */
assert(!blk->legacy_dev);
if (bs) {
bdrv_eject(bs, eject_flag);
id = blk_get_attached_dev_id(blk);
qapi_event_send_device_tray_moved(blk_name(blk), id,
eject_flag, &error_abort);
g_free(id);
}
}
| true |
qemu
|
c47ee043dc2cc85da710e87524144a720598c096
|
void blk_eject(BlockBackend *blk, bool eject_flag)
{
BlockDriverState *bs = blk_bs(blk);
char *id;
assert(!blk->legacy_dev);
if (bs) {
bdrv_eject(bs, eject_flag);
id = blk_get_attached_dev_id(blk);
qapi_event_send_device_tray_moved(blk_name(blk), id,
eject_flag, &error_abort);
g_free(id);
}
}
|
{
"code": [
" id = blk_get_attached_dev_id(blk);",
" qapi_event_send_device_tray_moved(blk_name(blk), id,",
" eject_flag, &error_abort);",
" g_free(id);"
],
"line_no": [
23,
25,
27,
29
]
}
|
void FUNC_0(BlockBackend *VAR_0, bool VAR_1)
{
BlockDriverState *bs = blk_bs(VAR_0);
char *VAR_2;
assert(!VAR_0->legacy_dev);
if (bs) {
bdrv_eject(bs, VAR_1);
VAR_2 = blk_get_attached_dev_id(VAR_0);
qapi_event_send_device_tray_moved(blk_name(VAR_0), VAR_2,
VAR_1, &error_abort);
g_free(VAR_2);
}
}
|
[
"void FUNC_0(BlockBackend *VAR_0, bool VAR_1)\n{",
"BlockDriverState *bs = blk_bs(VAR_0);",
"char *VAR_2;",
"assert(!VAR_0->legacy_dev);",
"if (bs) {",
"bdrv_eject(bs, VAR_1);",
"VAR_2 = blk_get_attached_dev_id(VAR_0);",
"qapi_event_send_device_tray_moved(blk_name(VAR_0), VAR_2,\nVAR_1, &error_abort);",
"g_free(VAR_2);",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
1,
1,
1,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
13
],
[
17
],
[
19
],
[
23
],
[
25,
27
],
[
29
],
[
33
],
[
35
]
] |
7,300 |
static void megasas_scsi_realize(PCIDevice *dev, Error **errp)
{
DeviceState *d = DEVICE(dev);
MegasasState *s = MEGASAS(dev);
MegasasBaseClass *b = MEGASAS_DEVICE_GET_CLASS(s);
uint8_t *pci_conf;
int i, bar_type;
Error *err = NULL;
int ret;
pci_conf = dev->config;
/* PCI latency timer = 0 */
pci_conf[PCI_LATENCY_TIMER] = 0;
/* Interrupt pin 1 */
pci_conf[PCI_INTERRUPT_PIN] = 0x01;
if (s->msi != ON_OFF_AUTO_OFF) {
ret = msi_init(dev, 0x50, 1, true, false, &err);
/* Any error other than -ENOTSUP(board's MSI support is broken)
* is a programming error */
assert(!ret || ret == -ENOTSUP);
if (ret && s->msi == ON_OFF_AUTO_ON) {
/* Can't satisfy user's explicit msi=on request, fail */
error_append_hint(&err, "You have to use msi=auto (default) or "
"msi=off with this machine type.\n");
error_propagate(errp, err);
return;
} else if (ret) {
/* With msi=auto, we fall back to MSI off silently */
s->msi = ON_OFF_AUTO_OFF;
error_free(err);
}
}
memory_region_init_io(&s->mmio_io, OBJECT(s), &megasas_mmio_ops, s,
"megasas-mmio", 0x4000);
memory_region_init_io(&s->port_io, OBJECT(s), &megasas_port_ops, s,
"megasas-io", 256);
memory_region_init_io(&s->queue_io, OBJECT(s), &megasas_queue_ops, s,
"megasas-queue", 0x40000);
if (megasas_use_msix(s) &&
msix_init(dev, 15, &s->mmio_io, b->mmio_bar, 0x2000,
&s->mmio_io, b->mmio_bar, 0x3800, 0x68)) {
s->msix = ON_OFF_AUTO_OFF;
}
if (pci_is_express(dev)) {
pcie_endpoint_cap_init(dev, 0xa0);
}
bar_type = PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64;
pci_register_bar(dev, b->ioport_bar,
PCI_BASE_ADDRESS_SPACE_IO, &s->port_io);
pci_register_bar(dev, b->mmio_bar, bar_type, &s->mmio_io);
pci_register_bar(dev, 3, bar_type, &s->queue_io);
if (megasas_use_msix(s)) {
msix_vector_use(dev, 0);
}
s->fw_state = MFI_FWSTATE_READY;
if (!s->sas_addr) {
s->sas_addr = ((NAA_LOCALLY_ASSIGNED_ID << 24) |
IEEE_COMPANY_LOCALLY_ASSIGNED) << 36;
s->sas_addr |= (pci_bus_num(dev->bus) << 16);
s->sas_addr |= (PCI_SLOT(dev->devfn) << 8);
s->sas_addr |= PCI_FUNC(dev->devfn);
}
if (!s->hba_serial) {
s->hba_serial = g_strdup(MEGASAS_HBA_SERIAL);
}
if (s->fw_sge >= MEGASAS_MAX_SGE - MFI_PASS_FRAME_SIZE) {
s->fw_sge = MEGASAS_MAX_SGE - MFI_PASS_FRAME_SIZE;
} else if (s->fw_sge >= 128 - MFI_PASS_FRAME_SIZE) {
s->fw_sge = 128 - MFI_PASS_FRAME_SIZE;
} else {
s->fw_sge = 64 - MFI_PASS_FRAME_SIZE;
}
if (s->fw_cmds > MEGASAS_MAX_FRAMES) {
s->fw_cmds = MEGASAS_MAX_FRAMES;
}
trace_megasas_init(s->fw_sge, s->fw_cmds,
megasas_is_jbod(s) ? "jbod" : "raid");
if (megasas_is_jbod(s)) {
s->fw_luns = MFI_MAX_SYS_PDS;
} else {
s->fw_luns = MFI_MAX_LD;
}
s->producer_pa = 0;
s->consumer_pa = 0;
for (i = 0; i < s->fw_cmds; i++) {
s->frames[i].index = i;
s->frames[i].context = -1;
s->frames[i].pa = 0;
s->frames[i].state = s;
}
scsi_bus_new(&s->bus, sizeof(s->bus), DEVICE(dev),
&megasas_scsi_info, NULL);
if (!d->hotplugged) {
scsi_bus_legacy_handle_cmdline(&s->bus, errp);
}
}
| true |
qemu
|
ee640c625e190a0c0e6b8966adc0e4720fb75200
|
static void megasas_scsi_realize(PCIDevice *dev, Error **errp)
{
DeviceState *d = DEVICE(dev);
MegasasState *s = MEGASAS(dev);
MegasasBaseClass *b = MEGASAS_DEVICE_GET_CLASS(s);
uint8_t *pci_conf;
int i, bar_type;
Error *err = NULL;
int ret;
pci_conf = dev->config;
pci_conf[PCI_LATENCY_TIMER] = 0;
pci_conf[PCI_INTERRUPT_PIN] = 0x01;
if (s->msi != ON_OFF_AUTO_OFF) {
ret = msi_init(dev, 0x50, 1, true, false, &err);
assert(!ret || ret == -ENOTSUP);
if (ret && s->msi == ON_OFF_AUTO_ON) {
error_append_hint(&err, "You have to use msi=auto (default) or "
"msi=off with this machine type.\n");
error_propagate(errp, err);
return;
} else if (ret) {
s->msi = ON_OFF_AUTO_OFF;
error_free(err);
}
}
memory_region_init_io(&s->mmio_io, OBJECT(s), &megasas_mmio_ops, s,
"megasas-mmio", 0x4000);
memory_region_init_io(&s->port_io, OBJECT(s), &megasas_port_ops, s,
"megasas-io", 256);
memory_region_init_io(&s->queue_io, OBJECT(s), &megasas_queue_ops, s,
"megasas-queue", 0x40000);
if (megasas_use_msix(s) &&
msix_init(dev, 15, &s->mmio_io, b->mmio_bar, 0x2000,
&s->mmio_io, b->mmio_bar, 0x3800, 0x68)) {
s->msix = ON_OFF_AUTO_OFF;
}
if (pci_is_express(dev)) {
pcie_endpoint_cap_init(dev, 0xa0);
}
bar_type = PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64;
pci_register_bar(dev, b->ioport_bar,
PCI_BASE_ADDRESS_SPACE_IO, &s->port_io);
pci_register_bar(dev, b->mmio_bar, bar_type, &s->mmio_io);
pci_register_bar(dev, 3, bar_type, &s->queue_io);
if (megasas_use_msix(s)) {
msix_vector_use(dev, 0);
}
s->fw_state = MFI_FWSTATE_READY;
if (!s->sas_addr) {
s->sas_addr = ((NAA_LOCALLY_ASSIGNED_ID << 24) |
IEEE_COMPANY_LOCALLY_ASSIGNED) << 36;
s->sas_addr |= (pci_bus_num(dev->bus) << 16);
s->sas_addr |= (PCI_SLOT(dev->devfn) << 8);
s->sas_addr |= PCI_FUNC(dev->devfn);
}
if (!s->hba_serial) {
s->hba_serial = g_strdup(MEGASAS_HBA_SERIAL);
}
if (s->fw_sge >= MEGASAS_MAX_SGE - MFI_PASS_FRAME_SIZE) {
s->fw_sge = MEGASAS_MAX_SGE - MFI_PASS_FRAME_SIZE;
} else if (s->fw_sge >= 128 - MFI_PASS_FRAME_SIZE) {
s->fw_sge = 128 - MFI_PASS_FRAME_SIZE;
} else {
s->fw_sge = 64 - MFI_PASS_FRAME_SIZE;
}
if (s->fw_cmds > MEGASAS_MAX_FRAMES) {
s->fw_cmds = MEGASAS_MAX_FRAMES;
}
trace_megasas_init(s->fw_sge, s->fw_cmds,
megasas_is_jbod(s) ? "jbod" : "raid");
if (megasas_is_jbod(s)) {
s->fw_luns = MFI_MAX_SYS_PDS;
} else {
s->fw_luns = MFI_MAX_LD;
}
s->producer_pa = 0;
s->consumer_pa = 0;
for (i = 0; i < s->fw_cmds; i++) {
s->frames[i].index = i;
s->frames[i].context = -1;
s->frames[i].pa = 0;
s->frames[i].state = s;
}
scsi_bus_new(&s->bus, sizeof(s->bus), DEVICE(dev),
&megasas_scsi_info, NULL);
if (!d->hotplugged) {
scsi_bus_legacy_handle_cmdline(&s->bus, errp);
}
}
|
{
"code": [
" &s->mmio_io, b->mmio_bar, 0x3800, 0x68)) {"
],
"line_no": [
89
]
}
|
static void FUNC_0(PCIDevice *VAR_0, Error **VAR_1)
{
DeviceState *d = DEVICE(VAR_0);
MegasasState *s = MEGASAS(VAR_0);
MegasasBaseClass *b = MEGASAS_DEVICE_GET_CLASS(s);
uint8_t *pci_conf;
int VAR_2, VAR_3;
Error *err = NULL;
int VAR_4;
pci_conf = VAR_0->config;
pci_conf[PCI_LATENCY_TIMER] = 0;
pci_conf[PCI_INTERRUPT_PIN] = 0x01;
if (s->msi != ON_OFF_AUTO_OFF) {
VAR_4 = msi_init(VAR_0, 0x50, 1, true, false, &err);
assert(!VAR_4 || VAR_4 == -ENOTSUP);
if (VAR_4 && s->msi == ON_OFF_AUTO_ON) {
error_append_hint(&err, "You have to use msi=auto (default) or "
"msi=off with this machine type.\n");
error_propagate(VAR_1, err);
return;
} else if (VAR_4) {
s->msi = ON_OFF_AUTO_OFF;
error_free(err);
}
}
memory_region_init_io(&s->mmio_io, OBJECT(s), &megasas_mmio_ops, s,
"megasas-mmio", 0x4000);
memory_region_init_io(&s->port_io, OBJECT(s), &megasas_port_ops, s,
"megasas-io", 256);
memory_region_init_io(&s->queue_io, OBJECT(s), &megasas_queue_ops, s,
"megasas-queue", 0x40000);
if (megasas_use_msix(s) &&
msix_init(VAR_0, 15, &s->mmio_io, b->mmio_bar, 0x2000,
&s->mmio_io, b->mmio_bar, 0x3800, 0x68)) {
s->msix = ON_OFF_AUTO_OFF;
}
if (pci_is_express(VAR_0)) {
pcie_endpoint_cap_init(VAR_0, 0xa0);
}
VAR_3 = PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64;
pci_register_bar(VAR_0, b->ioport_bar,
PCI_BASE_ADDRESS_SPACE_IO, &s->port_io);
pci_register_bar(VAR_0, b->mmio_bar, VAR_3, &s->mmio_io);
pci_register_bar(VAR_0, 3, VAR_3, &s->queue_io);
if (megasas_use_msix(s)) {
msix_vector_use(VAR_0, 0);
}
s->fw_state = MFI_FWSTATE_READY;
if (!s->sas_addr) {
s->sas_addr = ((NAA_LOCALLY_ASSIGNED_ID << 24) |
IEEE_COMPANY_LOCALLY_ASSIGNED) << 36;
s->sas_addr |= (pci_bus_num(VAR_0->bus) << 16);
s->sas_addr |= (PCI_SLOT(VAR_0->devfn) << 8);
s->sas_addr |= PCI_FUNC(VAR_0->devfn);
}
if (!s->hba_serial) {
s->hba_serial = g_strdup(MEGASAS_HBA_SERIAL);
}
if (s->fw_sge >= MEGASAS_MAX_SGE - MFI_PASS_FRAME_SIZE) {
s->fw_sge = MEGASAS_MAX_SGE - MFI_PASS_FRAME_SIZE;
} else if (s->fw_sge >= 128 - MFI_PASS_FRAME_SIZE) {
s->fw_sge = 128 - MFI_PASS_FRAME_SIZE;
} else {
s->fw_sge = 64 - MFI_PASS_FRAME_SIZE;
}
if (s->fw_cmds > MEGASAS_MAX_FRAMES) {
s->fw_cmds = MEGASAS_MAX_FRAMES;
}
trace_megasas_init(s->fw_sge, s->fw_cmds,
megasas_is_jbod(s) ? "jbod" : "raid");
if (megasas_is_jbod(s)) {
s->fw_luns = MFI_MAX_SYS_PDS;
} else {
s->fw_luns = MFI_MAX_LD;
}
s->producer_pa = 0;
s->consumer_pa = 0;
for (VAR_2 = 0; VAR_2 < s->fw_cmds; VAR_2++) {
s->frames[VAR_2].index = VAR_2;
s->frames[VAR_2].context = -1;
s->frames[VAR_2].pa = 0;
s->frames[VAR_2].state = s;
}
scsi_bus_new(&s->bus, sizeof(s->bus), DEVICE(VAR_0),
&megasas_scsi_info, NULL);
if (!d->hotplugged) {
scsi_bus_legacy_handle_cmdline(&s->bus, VAR_1);
}
}
|
[
"static void FUNC_0(PCIDevice *VAR_0, Error **VAR_1)\n{",
"DeviceState *d = DEVICE(VAR_0);",
"MegasasState *s = MEGASAS(VAR_0);",
"MegasasBaseClass *b = MEGASAS_DEVICE_GET_CLASS(s);",
"uint8_t *pci_conf;",
"int VAR_2, VAR_3;",
"Error *err = NULL;",
"int VAR_4;",
"pci_conf = VAR_0->config;",
"pci_conf[PCI_LATENCY_TIMER] = 0;",
"pci_conf[PCI_INTERRUPT_PIN] = 0x01;",
"if (s->msi != ON_OFF_AUTO_OFF) {",
"VAR_4 = msi_init(VAR_0, 0x50, 1, true, false, &err);",
"assert(!VAR_4 || VAR_4 == -ENOTSUP);",
"if (VAR_4 && s->msi == ON_OFF_AUTO_ON) {",
"error_append_hint(&err, \"You have to use msi=auto (default) or \"\n\"msi=off with this machine type.\\n\");",
"error_propagate(VAR_1, err);",
"return;",
"} else if (VAR_4) {",
"s->msi = ON_OFF_AUTO_OFF;",
"error_free(err);",
"}",
"}",
"memory_region_init_io(&s->mmio_io, OBJECT(s), &megasas_mmio_ops, s,\n\"megasas-mmio\", 0x4000);",
"memory_region_init_io(&s->port_io, OBJECT(s), &megasas_port_ops, s,\n\"megasas-io\", 256);",
"memory_region_init_io(&s->queue_io, OBJECT(s), &megasas_queue_ops, s,\n\"megasas-queue\", 0x40000);",
"if (megasas_use_msix(s) &&\nmsix_init(VAR_0, 15, &s->mmio_io, b->mmio_bar, 0x2000,\n&s->mmio_io, b->mmio_bar, 0x3800, 0x68)) {",
"s->msix = ON_OFF_AUTO_OFF;",
"}",
"if (pci_is_express(VAR_0)) {",
"pcie_endpoint_cap_init(VAR_0, 0xa0);",
"}",
"VAR_3 = PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64;",
"pci_register_bar(VAR_0, b->ioport_bar,\nPCI_BASE_ADDRESS_SPACE_IO, &s->port_io);",
"pci_register_bar(VAR_0, b->mmio_bar, VAR_3, &s->mmio_io);",
"pci_register_bar(VAR_0, 3, VAR_3, &s->queue_io);",
"if (megasas_use_msix(s)) {",
"msix_vector_use(VAR_0, 0);",
"}",
"s->fw_state = MFI_FWSTATE_READY;",
"if (!s->sas_addr) {",
"s->sas_addr = ((NAA_LOCALLY_ASSIGNED_ID << 24) |\nIEEE_COMPANY_LOCALLY_ASSIGNED) << 36;",
"s->sas_addr |= (pci_bus_num(VAR_0->bus) << 16);",
"s->sas_addr |= (PCI_SLOT(VAR_0->devfn) << 8);",
"s->sas_addr |= PCI_FUNC(VAR_0->devfn);",
"}",
"if (!s->hba_serial) {",
"s->hba_serial = g_strdup(MEGASAS_HBA_SERIAL);",
"}",
"if (s->fw_sge >= MEGASAS_MAX_SGE - MFI_PASS_FRAME_SIZE) {",
"s->fw_sge = MEGASAS_MAX_SGE - MFI_PASS_FRAME_SIZE;",
"} else if (s->fw_sge >= 128 - MFI_PASS_FRAME_SIZE) {",
"s->fw_sge = 128 - MFI_PASS_FRAME_SIZE;",
"} else {",
"s->fw_sge = 64 - MFI_PASS_FRAME_SIZE;",
"}",
"if (s->fw_cmds > MEGASAS_MAX_FRAMES) {",
"s->fw_cmds = MEGASAS_MAX_FRAMES;",
"}",
"trace_megasas_init(s->fw_sge, s->fw_cmds,\nmegasas_is_jbod(s) ? \"jbod\" : \"raid\");",
"if (megasas_is_jbod(s)) {",
"s->fw_luns = MFI_MAX_SYS_PDS;",
"} else {",
"s->fw_luns = MFI_MAX_LD;",
"}",
"s->producer_pa = 0;",
"s->consumer_pa = 0;",
"for (VAR_2 = 0; VAR_2 < s->fw_cmds; VAR_2++) {",
"s->frames[VAR_2].index = VAR_2;",
"s->frames[VAR_2].context = -1;",
"s->frames[VAR_2].pa = 0;",
"s->frames[VAR_2].state = s;",
"}",
"scsi_bus_new(&s->bus, sizeof(s->bus), DEVICE(VAR_0),\n&megasas_scsi_info, NULL);",
"if (!d->hotplugged) {",
"scsi_bus_legacy_handle_cmdline(&s->bus, VAR_1);",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
21
],
[
27
],
[
31
],
[
35
],
[
37
],
[
43
],
[
45
],
[
49,
51
],
[
53
],
[
55
],
[
57
],
[
61
],
[
63
],
[
65
],
[
67
],
[
71,
73
],
[
75,
77
],
[
79,
81
],
[
85,
87,
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
103
],
[
105,
107
],
[
109
],
[
111
],
[
115
],
[
117
],
[
119
],
[
123
],
[
125
],
[
127,
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149
],
[
151
],
[
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165,
167
],
[
171
],
[
173
],
[
175
],
[
177
],
[
179
],
[
181
],
[
183
],
[
185
],
[
187
],
[
189
],
[
191
],
[
193
],
[
195
],
[
199,
201
],
[
203
],
[
205
],
[
207
],
[
209
]
] |
7,301 |
int kvm_arch_debug(struct kvm_debug_exit_arch *arch_info)
{
int handle = 0;
int n;
if (arch_info->exception == 1) {
if (arch_info->dr6 & (1 << 14)) {
if (cpu_single_env->singlestep_enabled)
handle = 1;
} else {
for (n = 0; n < 4; n++)
if (arch_info->dr6 & (1 << n))
switch ((arch_info->dr7 >> (16 + n*4)) & 0x3) {
case 0x0:
handle = 1;
break;
case 0x1:
handle = 1;
cpu_single_env->watchpoint_hit = &hw_watchpoint;
hw_watchpoint.vaddr = hw_breakpoint[n].addr;
hw_watchpoint.flags = BP_MEM_WRITE;
break;
case 0x3:
handle = 1;
cpu_single_env->watchpoint_hit = &hw_watchpoint;
hw_watchpoint.vaddr = hw_breakpoint[n].addr;
hw_watchpoint.flags = BP_MEM_ACCESS;
break;
}
}
} else if (kvm_find_sw_breakpoint(cpu_single_env, arch_info->pc))
handle = 1;
if (!handle)
kvm_update_guest_debug(cpu_single_env,
(arch_info->exception == 1) ?
KVM_GUESTDBG_INJECT_DB : KVM_GUESTDBG_INJECT_BP);
return handle;
}
| true |
qemu
|
b0b1d69079fcb9453f45aade9e9f6b71422147b0
|
int kvm_arch_debug(struct kvm_debug_exit_arch *arch_info)
{
int handle = 0;
int n;
if (arch_info->exception == 1) {
if (arch_info->dr6 & (1 << 14)) {
if (cpu_single_env->singlestep_enabled)
handle = 1;
} else {
for (n = 0; n < 4; n++)
if (arch_info->dr6 & (1 << n))
switch ((arch_info->dr7 >> (16 + n*4)) & 0x3) {
case 0x0:
handle = 1;
break;
case 0x1:
handle = 1;
cpu_single_env->watchpoint_hit = &hw_watchpoint;
hw_watchpoint.vaddr = hw_breakpoint[n].addr;
hw_watchpoint.flags = BP_MEM_WRITE;
break;
case 0x3:
handle = 1;
cpu_single_env->watchpoint_hit = &hw_watchpoint;
hw_watchpoint.vaddr = hw_breakpoint[n].addr;
hw_watchpoint.flags = BP_MEM_ACCESS;
break;
}
}
} else if (kvm_find_sw_breakpoint(cpu_single_env, arch_info->pc))
handle = 1;
if (!handle)
kvm_update_guest_debug(cpu_single_env,
(arch_info->exception == 1) ?
KVM_GUESTDBG_INJECT_DB : KVM_GUESTDBG_INJECT_BP);
return handle;
}
|
{
"code": [
" if (!handle)",
" kvm_update_guest_debug(cpu_single_env,",
" (arch_info->exception == 1) ?",
" KVM_GUESTDBG_INJECT_DB : KVM_GUESTDBG_INJECT_BP);"
],
"line_no": [
67,
69,
71,
73
]
}
|
int FUNC_0(struct kvm_debug_exit_arch *VAR_0)
{
int VAR_1 = 0;
int VAR_2;
if (VAR_0->exception == 1) {
if (VAR_0->dr6 & (1 << 14)) {
if (cpu_single_env->singlestep_enabled)
VAR_1 = 1;
} else {
for (VAR_2 = 0; VAR_2 < 4; VAR_2++)
if (VAR_0->dr6 & (1 << VAR_2))
switch ((VAR_0->dr7 >> (16 + VAR_2*4)) & 0x3) {
case 0x0:
VAR_1 = 1;
break;
case 0x1:
VAR_1 = 1;
cpu_single_env->watchpoint_hit = &hw_watchpoint;
hw_watchpoint.vaddr = hw_breakpoint[VAR_2].addr;
hw_watchpoint.flags = BP_MEM_WRITE;
break;
case 0x3:
VAR_1 = 1;
cpu_single_env->watchpoint_hit = &hw_watchpoint;
hw_watchpoint.vaddr = hw_breakpoint[VAR_2].addr;
hw_watchpoint.flags = BP_MEM_ACCESS;
break;
}
}
} else if (kvm_find_sw_breakpoint(cpu_single_env, VAR_0->pc))
VAR_1 = 1;
if (!VAR_1)
kvm_update_guest_debug(cpu_single_env,
(VAR_0->exception == 1) ?
KVM_GUESTDBG_INJECT_DB : KVM_GUESTDBG_INJECT_BP);
return VAR_1;
}
|
[
"int FUNC_0(struct kvm_debug_exit_arch *VAR_0)\n{",
"int VAR_1 = 0;",
"int VAR_2;",
"if (VAR_0->exception == 1) {",
"if (VAR_0->dr6 & (1 << 14)) {",
"if (cpu_single_env->singlestep_enabled)\nVAR_1 = 1;",
"} else {",
"for (VAR_2 = 0; VAR_2 < 4; VAR_2++)",
"if (VAR_0->dr6 & (1 << VAR_2))\nswitch ((VAR_0->dr7 >> (16 + VAR_2*4)) & 0x3) {",
"case 0x0:\nVAR_1 = 1;",
"break;",
"case 0x1:\nVAR_1 = 1;",
"cpu_single_env->watchpoint_hit = &hw_watchpoint;",
"hw_watchpoint.vaddr = hw_breakpoint[VAR_2].addr;",
"hw_watchpoint.flags = BP_MEM_WRITE;",
"break;",
"case 0x3:\nVAR_1 = 1;",
"cpu_single_env->watchpoint_hit = &hw_watchpoint;",
"hw_watchpoint.vaddr = hw_breakpoint[VAR_2].addr;",
"hw_watchpoint.flags = BP_MEM_ACCESS;",
"break;",
"}",
"}",
"} else if (kvm_find_sw_breakpoint(cpu_single_env, VAR_0->pc))",
"VAR_1 = 1;",
"if (!VAR_1)\nkvm_update_guest_debug(cpu_single_env,\n(VAR_0->exception == 1) ?\nKVM_GUESTDBG_INJECT_DB : KVM_GUESTDBG_INJECT_BP);",
"return VAR_1;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
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
],
[
67,
69,
71,
73
],
[
77
],
[
79
]
] |
7,302 |
static int mpegts_read_packet(AVFormatContext *s,
AVPacket *pkt)
{
MpegTSContext *ts = s->priv_data;
int ret, i;
ts->pkt = pkt;
ret = handle_packets(ts, 0);
if (ret < 0) {
/* flush pes data left */
for (i = 0; i < NB_PID_MAX; i++) {
if (ts->pids[i] && ts->pids[i]->type == MPEGTS_PES) {
PESContext *pes = ts->pids[i]->u.pes_filter.opaque;
if (pes->state == MPEGTS_PAYLOAD && pes->data_index > 0) {
new_pes_packet(pes, pkt);
pes->state = MPEGTS_SKIP;
ret = 0;
break;
}
}
}
}
if (!ret && pkt->size < 0)
ret = AVERROR(EINTR);
return ret;
}
| true |
FFmpeg
|
df8aa4598c7cc1c2f863f6fc6b2d4b3e6dc7345e
|
static int mpegts_read_packet(AVFormatContext *s,
AVPacket *pkt)
{
MpegTSContext *ts = s->priv_data;
int ret, i;
ts->pkt = pkt;
ret = handle_packets(ts, 0);
if (ret < 0) {
for (i = 0; i < NB_PID_MAX; i++) {
if (ts->pids[i] && ts->pids[i]->type == MPEGTS_PES) {
PESContext *pes = ts->pids[i]->u.pes_filter.opaque;
if (pes->state == MPEGTS_PAYLOAD && pes->data_index > 0) {
new_pes_packet(pes, pkt);
pes->state = MPEGTS_SKIP;
ret = 0;
break;
}
}
}
}
if (!ret && pkt->size < 0)
ret = AVERROR(EINTR);
return ret;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(AVFormatContext *VAR_0,
AVPacket *VAR_1)
{
MpegTSContext *ts = VAR_0->priv_data;
int VAR_2, VAR_3;
ts->VAR_1 = VAR_1;
VAR_2 = handle_packets(ts, 0);
if (VAR_2 < 0) {
for (VAR_3 = 0; VAR_3 < NB_PID_MAX; VAR_3++) {
if (ts->pids[VAR_3] && ts->pids[VAR_3]->type == MPEGTS_PES) {
PESContext *pes = ts->pids[VAR_3]->u.pes_filter.opaque;
if (pes->state == MPEGTS_PAYLOAD && pes->data_index > 0) {
new_pes_packet(pes, VAR_1);
pes->state = MPEGTS_SKIP;
VAR_2 = 0;
break;
}
}
}
}
if (!VAR_2 && VAR_1->size < 0)
VAR_2 = AVERROR(EINTR);
return VAR_2;
}
|
[
"static int FUNC_0(AVFormatContext *VAR_0,\nAVPacket *VAR_1)\n{",
"MpegTSContext *ts = VAR_0->priv_data;",
"int VAR_2, VAR_3;",
"ts->VAR_1 = VAR_1;",
"VAR_2 = handle_packets(ts, 0);",
"if (VAR_2 < 0) {",
"for (VAR_3 = 0; VAR_3 < NB_PID_MAX; VAR_3++) {",
"if (ts->pids[VAR_3] && ts->pids[VAR_3]->type == MPEGTS_PES) {",
"PESContext *pes = ts->pids[VAR_3]->u.pes_filter.opaque;",
"if (pes->state == MPEGTS_PAYLOAD && pes->data_index > 0) {",
"new_pes_packet(pes, VAR_1);",
"pes->state = MPEGTS_SKIP;",
"VAR_2 = 0;",
"break;",
"}",
"}",
"}",
"}",
"if (!VAR_2 && VAR_1->size < 0)\nVAR_2 = AVERROR(EINTR);",
"return VAR_2;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
14
],
[
16
],
[
18
],
[
22
],
[
24
],
[
26
],
[
28
],
[
30
],
[
32
],
[
34
],
[
36
],
[
38
],
[
40
],
[
42
],
[
44
],
[
48,
50
],
[
52
],
[
54
]
] |
7,303 |
static int qemu_savevm_state(QEMUFile *f)
{
SaveStateEntry *se;
int len, ret;
int64_t cur_pos, len_pos, total_len_pos;
qemu_put_be32(f, QEMU_VM_FILE_MAGIC);
qemu_put_be32(f, QEMU_VM_FILE_VERSION);
total_len_pos = qemu_ftell(f);
qemu_put_be64(f, 0); /* total size */
for(se = first_se; se != NULL; se = se->next) {
if (se->save_state == NULL)
/* this one has a loader only, for backwards compatibility */
continue;
/* ID string */
len = strlen(se->idstr);
qemu_put_byte(f, len);
qemu_put_buffer(f, (uint8_t *)se->idstr, len);
qemu_put_be32(f, se->instance_id);
qemu_put_be32(f, se->version_id);
/* record size: filled later */
len_pos = qemu_ftell(f);
qemu_put_be32(f, 0);
se->save_state(f, se->opaque);
/* fill record size */
cur_pos = qemu_ftell(f);
len = cur_pos - len_pos - 4;
qemu_fseek(f, len_pos, SEEK_SET);
qemu_put_be32(f, len);
qemu_fseek(f, cur_pos, SEEK_SET);
}
cur_pos = qemu_ftell(f);
qemu_fseek(f, total_len_pos, SEEK_SET);
qemu_put_be64(f, cur_pos - total_len_pos - 8);
qemu_fseek(f, cur_pos, SEEK_SET);
ret = 0;
return ret;
}
| true |
qemu
|
9366f4186025e1d8fc3bebd41fb714521c170b6f
|
static int qemu_savevm_state(QEMUFile *f)
{
SaveStateEntry *se;
int len, ret;
int64_t cur_pos, len_pos, total_len_pos;
qemu_put_be32(f, QEMU_VM_FILE_MAGIC);
qemu_put_be32(f, QEMU_VM_FILE_VERSION);
total_len_pos = qemu_ftell(f);
qemu_put_be64(f, 0);
for(se = first_se; se != NULL; se = se->next) {
if (se->save_state == NULL)
continue;
len = strlen(se->idstr);
qemu_put_byte(f, len);
qemu_put_buffer(f, (uint8_t *)se->idstr, len);
qemu_put_be32(f, se->instance_id);
qemu_put_be32(f, se->version_id);
len_pos = qemu_ftell(f);
qemu_put_be32(f, 0);
se->save_state(f, se->opaque);
cur_pos = qemu_ftell(f);
len = cur_pos - len_pos - 4;
qemu_fseek(f, len_pos, SEEK_SET);
qemu_put_be32(f, len);
qemu_fseek(f, cur_pos, SEEK_SET);
}
cur_pos = qemu_ftell(f);
qemu_fseek(f, total_len_pos, SEEK_SET);
qemu_put_be64(f, cur_pos - total_len_pos - 8);
qemu_fseek(f, cur_pos, SEEK_SET);
ret = 0;
return ret;
}
|
{
"code": [
"static int qemu_savevm_state(QEMUFile *f)",
" int len, ret;",
" int64_t cur_pos, len_pos, total_len_pos;",
" total_len_pos = qemu_ftell(f);",
" len_pos = qemu_ftell(f);",
" qemu_put_be32(f, 0);",
" cur_pos = qemu_ftell(f);",
" len = cur_pos - len_pos - 4;",
" qemu_fseek(f, len_pos, SEEK_SET);",
" qemu_put_be32(f, len);",
" qemu_fseek(f, cur_pos, SEEK_SET);",
" cur_pos = qemu_ftell(f);",
" qemu_fseek(f, total_len_pos, SEEK_SET);",
" qemu_put_be64(f, cur_pos - total_len_pos - 8);",
" qemu_fseek(f, cur_pos, SEEK_SET);",
" ret = 0;"
],
"line_no": [
1,
7,
9,
17,
51,
53,
61,
63,
65,
67,
69,
73,
75,
77,
79,
83
]
}
|
static int FUNC_0(QEMUFile *VAR_0)
{
SaveStateEntry *se;
int VAR_1, VAR_2;
int64_t cur_pos, len_pos, total_len_pos;
qemu_put_be32(VAR_0, QEMU_VM_FILE_MAGIC);
qemu_put_be32(VAR_0, QEMU_VM_FILE_VERSION);
total_len_pos = qemu_ftell(VAR_0);
qemu_put_be64(VAR_0, 0);
for(se = first_se; se != NULL; se = se->next) {
if (se->save_state == NULL)
continue;
VAR_1 = strlen(se->idstr);
qemu_put_byte(VAR_0, VAR_1);
qemu_put_buffer(VAR_0, (uint8_t *)se->idstr, VAR_1);
qemu_put_be32(VAR_0, se->instance_id);
qemu_put_be32(VAR_0, se->version_id);
len_pos = qemu_ftell(VAR_0);
qemu_put_be32(VAR_0, 0);
se->save_state(VAR_0, se->opaque);
cur_pos = qemu_ftell(VAR_0);
VAR_1 = cur_pos - len_pos - 4;
qemu_fseek(VAR_0, len_pos, SEEK_SET);
qemu_put_be32(VAR_0, VAR_1);
qemu_fseek(VAR_0, cur_pos, SEEK_SET);
}
cur_pos = qemu_ftell(VAR_0);
qemu_fseek(VAR_0, total_len_pos, SEEK_SET);
qemu_put_be64(VAR_0, cur_pos - total_len_pos - 8);
qemu_fseek(VAR_0, cur_pos, SEEK_SET);
VAR_2 = 0;
return VAR_2;
}
|
[
"static int FUNC_0(QEMUFile *VAR_0)\n{",
"SaveStateEntry *se;",
"int VAR_1, VAR_2;",
"int64_t cur_pos, len_pos, total_len_pos;",
"qemu_put_be32(VAR_0, QEMU_VM_FILE_MAGIC);",
"qemu_put_be32(VAR_0, QEMU_VM_FILE_VERSION);",
"total_len_pos = qemu_ftell(VAR_0);",
"qemu_put_be64(VAR_0, 0);",
"for(se = first_se; se != NULL; se = se->next) {",
"if (se->save_state == NULL)\ncontinue;",
"VAR_1 = strlen(se->idstr);",
"qemu_put_byte(VAR_0, VAR_1);",
"qemu_put_buffer(VAR_0, (uint8_t *)se->idstr, VAR_1);",
"qemu_put_be32(VAR_0, se->instance_id);",
"qemu_put_be32(VAR_0, se->version_id);",
"len_pos = qemu_ftell(VAR_0);",
"qemu_put_be32(VAR_0, 0);",
"se->save_state(VAR_0, se->opaque);",
"cur_pos = qemu_ftell(VAR_0);",
"VAR_1 = cur_pos - len_pos - 4;",
"qemu_fseek(VAR_0, len_pos, SEEK_SET);",
"qemu_put_be32(VAR_0, VAR_1);",
"qemu_fseek(VAR_0, cur_pos, SEEK_SET);",
"}",
"cur_pos = qemu_ftell(VAR_0);",
"qemu_fseek(VAR_0, total_len_pos, SEEK_SET);",
"qemu_put_be64(VAR_0, cur_pos - total_len_pos - 8);",
"qemu_fseek(VAR_0, cur_pos, SEEK_SET);",
"VAR_2 = 0;",
"return VAR_2;",
"}"
] |
[
1,
0,
1,
1,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
0,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25,
29
],
[
35
],
[
37
],
[
39
],
[
43
],
[
45
],
[
51
],
[
53
],
[
55
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
83
],
[
85
],
[
87
]
] |
7,304 |
static void cmv_decode_inter(CmvContext * s, const uint8_t *buf, const uint8_t *buf_end){
const uint8_t *raw = buf + (s->avctx->width*s->avctx->height/16);
int x,y,i;
i = 0;
for(y=0; y<s->avctx->height/4; y++)
for(x=0; x<s->avctx->width/4 && buf+i<buf_end; x++) {
if (buf[i]==0xFF) {
unsigned char *dst = s->frame.data[0] + (y*4)*s->frame.linesize[0] + x*4;
if (raw+16<buf_end && *raw==0xFF) { /* intra */
raw++;
memcpy(dst, raw, 4);
memcpy(dst+s->frame.linesize[0], raw+4, 4);
memcpy(dst+2*s->frame.linesize[0], raw+8, 4);
memcpy(dst+3*s->frame.linesize[0], raw+12, 4);
raw+=16;
}else if(raw<buf_end) { /* inter using second-last frame as reference */
int xoffset = (*raw & 0xF) - 7;
int yoffset = ((*raw >> 4)) - 7;
if (s->last2_frame.data[0])
cmv_motcomp(s->frame.data[0], s->frame.linesize[0],
s->last2_frame.data[0], s->last2_frame.linesize[0],
x*4, y*4, xoffset, yoffset, s->avctx->width, s->avctx->height);
raw++;
}
}else{ /* inter using last frame as reference */
int xoffset = (buf[i] & 0xF) - 7;
int yoffset = ((buf[i] >> 4)) - 7;
cmv_motcomp(s->frame.data[0], s->frame.linesize[0],
s->last_frame.data[0], s->last_frame.linesize[0],
x*4, y*4, xoffset, yoffset, s->avctx->width, s->avctx->height);
}
i++;
}
}
| true |
FFmpeg
|
e9064c9ce8ed18c3a3aab61e58e663b8f5b0c551
|
static void cmv_decode_inter(CmvContext * s, const uint8_t *buf, const uint8_t *buf_end){
const uint8_t *raw = buf + (s->avctx->width*s->avctx->height/16);
int x,y,i;
i = 0;
for(y=0; y<s->avctx->height/4; y++)
for(x=0; x<s->avctx->width/4 && buf+i<buf_end; x++) {
if (buf[i]==0xFF) {
unsigned char *dst = s->frame.data[0] + (y*4)*s->frame.linesize[0] + x*4;
if (raw+16<buf_end && *raw==0xFF) {
raw++;
memcpy(dst, raw, 4);
memcpy(dst+s->frame.linesize[0], raw+4, 4);
memcpy(dst+2*s->frame.linesize[0], raw+8, 4);
memcpy(dst+3*s->frame.linesize[0], raw+12, 4);
raw+=16;
}else if(raw<buf_end) {
int xoffset = (*raw & 0xF) - 7;
int yoffset = ((*raw >> 4)) - 7;
if (s->last2_frame.data[0])
cmv_motcomp(s->frame.data[0], s->frame.linesize[0],
s->last2_frame.data[0], s->last2_frame.linesize[0],
x*4, y*4, xoffset, yoffset, s->avctx->width, s->avctx->height);
raw++;
}
}else{
int xoffset = (buf[i] & 0xF) - 7;
int yoffset = ((buf[i] >> 4)) - 7;
cmv_motcomp(s->frame.data[0], s->frame.linesize[0],
s->last_frame.data[0], s->last_frame.linesize[0],
x*4, y*4, xoffset, yoffset, s->avctx->width, s->avctx->height);
}
i++;
}
}
|
{
"code": [
" for(x=0; x<s->avctx->width/4 && buf+i<buf_end; x++) {"
],
"line_no": [
13
]
}
|
static void FUNC_0(CmvContext * VAR_0, const uint8_t *VAR_1, const uint8_t *VAR_2){
const uint8_t *VAR_3 = VAR_1 + (VAR_0->avctx->width*VAR_0->avctx->height/16);
int VAR_4,VAR_5,VAR_6;
VAR_6 = 0;
for(VAR_5=0; VAR_5<VAR_0->avctx->height/4; VAR_5++)
for(VAR_4=0; VAR_4<VAR_0->avctx->width/4 && VAR_1+VAR_6<VAR_2; VAR_4++) {
if (VAR_1[VAR_6]==0xFF) {
unsigned char *dst = VAR_0->frame.data[0] + (VAR_5*4)*VAR_0->frame.linesize[0] + VAR_4*4;
if (VAR_3+16<VAR_2 && *VAR_3==0xFF) {
VAR_3++;
memcpy(dst, VAR_3, 4);
memcpy(dst+VAR_0->frame.linesize[0], VAR_3+4, 4);
memcpy(dst+2*VAR_0->frame.linesize[0], VAR_3+8, 4);
memcpy(dst+3*VAR_0->frame.linesize[0], VAR_3+12, 4);
VAR_3+=16;
}else if(VAR_3<VAR_2) {
int xoffset = (*VAR_3 & 0xF) - 7;
int yoffset = ((*VAR_3 >> 4)) - 7;
if (VAR_0->last2_frame.data[0])
cmv_motcomp(VAR_0->frame.data[0], VAR_0->frame.linesize[0],
VAR_0->last2_frame.data[0], VAR_0->last2_frame.linesize[0],
VAR_4*4, VAR_5*4, xoffset, yoffset, VAR_0->avctx->width, VAR_0->avctx->height);
VAR_3++;
}
}else{
int xoffset = (VAR_1[VAR_6] & 0xF) - 7;
int yoffset = ((VAR_1[VAR_6] >> 4)) - 7;
cmv_motcomp(VAR_0->frame.data[0], VAR_0->frame.linesize[0],
VAR_0->last_frame.data[0], VAR_0->last_frame.linesize[0],
VAR_4*4, VAR_5*4, xoffset, yoffset, VAR_0->avctx->width, VAR_0->avctx->height);
}
VAR_6++;
}
}
|
[
"static void FUNC_0(CmvContext * VAR_0, const uint8_t *VAR_1, const uint8_t *VAR_2){",
"const uint8_t *VAR_3 = VAR_1 + (VAR_0->avctx->width*VAR_0->avctx->height/16);",
"int VAR_4,VAR_5,VAR_6;",
"VAR_6 = 0;",
"for(VAR_5=0; VAR_5<VAR_0->avctx->height/4; VAR_5++)",
"for(VAR_4=0; VAR_4<VAR_0->avctx->width/4 && VAR_1+VAR_6<VAR_2; VAR_4++) {",
"if (VAR_1[VAR_6]==0xFF) {",
"unsigned char *dst = VAR_0->frame.data[0] + (VAR_5*4)*VAR_0->frame.linesize[0] + VAR_4*4;",
"if (VAR_3+16<VAR_2 && *VAR_3==0xFF) {",
"VAR_3++;",
"memcpy(dst, VAR_3, 4);",
"memcpy(dst+VAR_0->frame.linesize[0], VAR_3+4, 4);",
"memcpy(dst+2*VAR_0->frame.linesize[0], VAR_3+8, 4);",
"memcpy(dst+3*VAR_0->frame.linesize[0], VAR_3+12, 4);",
"VAR_3+=16;",
"}else if(VAR_3<VAR_2) {",
"int xoffset = (*VAR_3 & 0xF) - 7;",
"int yoffset = ((*VAR_3 >> 4)) - 7;",
"if (VAR_0->last2_frame.data[0])\ncmv_motcomp(VAR_0->frame.data[0], VAR_0->frame.linesize[0],\nVAR_0->last2_frame.data[0], VAR_0->last2_frame.linesize[0],\nVAR_4*4, VAR_5*4, xoffset, yoffset, VAR_0->avctx->width, VAR_0->avctx->height);",
"VAR_3++;",
"}",
"}else{",
"int xoffset = (VAR_1[VAR_6] & 0xF) - 7;",
"int yoffset = ((VAR_1[VAR_6] >> 4)) - 7;",
"cmv_motcomp(VAR_0->frame.data[0], VAR_0->frame.linesize[0],\nVAR_0->last_frame.data[0], VAR_0->last_frame.linesize[0],\nVAR_4*4, VAR_5*4, xoffset, yoffset, VAR_0->avctx->width, VAR_0->avctx->height);",
"}",
"VAR_6++;",
"}",
"}"
] |
[
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
] |
[
[
1
],
[
3
],
[
5
],
[
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
]
] |
7,305 |
int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options,
int flags, BlockDriver *drv, Error **errp)
{
int ret;
/* TODO: extra byte is a hack to ensure MAX_PATH space on Windows. */
char tmp_filename[PATH_MAX + 1];
BlockDriverState *file = NULL;
QDict *file_options = NULL;
const char *drvname;
Error *local_err = NULL;
/* NULL means an empty set of options */
if (options == NULL) {
options = qdict_new();
}
bs->options = options;
options = qdict_clone_shallow(options);
/* For snapshot=on, create a temporary qcow2 overlay */
if (flags & BDRV_O_SNAPSHOT) {
BlockDriverState *bs1;
int64_t total_size;
BlockDriver *bdrv_qcow2;
QEMUOptionParameter *create_options;
char backing_filename[PATH_MAX];
if (qdict_size(options) != 0) {
error_setg(errp, "Can't use snapshot=on with driver-specific options");
ret = -EINVAL;
goto fail;
}
assert(filename != NULL);
/* if snapshot, we create a temporary backing file and open it
instead of opening 'filename' directly */
/* if there is a backing file, use it */
bs1 = bdrv_new("");
ret = bdrv_open(bs1, filename, NULL, 0, drv, &local_err);
if (ret < 0) {
bdrv_unref(bs1);
goto fail;
}
total_size = bdrv_getlength(bs1) & BDRV_SECTOR_MASK;
bdrv_unref(bs1);
ret = get_tmp_filename(tmp_filename, sizeof(tmp_filename));
if (ret < 0) {
error_setg_errno(errp, -ret, "Could not get temporary filename");
goto fail;
}
/* Real path is meaningless for protocols */
if (path_has_protocol(filename)) {
snprintf(backing_filename, sizeof(backing_filename),
"%s", filename);
} else if (!realpath(filename, backing_filename)) {
error_setg_errno(errp, errno, "Could not resolve path '%s'", filename);
ret = -errno;
goto fail;
}
bdrv_qcow2 = bdrv_find_format("qcow2");
create_options = parse_option_parameters("", bdrv_qcow2->create_options,
NULL);
set_option_parameter_int(create_options, BLOCK_OPT_SIZE, total_size);
set_option_parameter(create_options, BLOCK_OPT_BACKING_FILE,
backing_filename);
if (drv) {
set_option_parameter(create_options, BLOCK_OPT_BACKING_FMT,
drv->format_name);
}
ret = bdrv_create(bdrv_qcow2, tmp_filename, create_options, &local_err);
free_option_parameters(create_options);
if (ret < 0) {
error_setg_errno(errp, -ret, "Could not create temporary overlay "
"'%s': %s", tmp_filename,
error_get_pretty(local_err));
error_free(local_err);
local_err = NULL;
goto fail;
}
filename = tmp_filename;
drv = bdrv_qcow2;
bs->is_temporary = 1;
}
/* Open image file without format layer */
if (flags & BDRV_O_RDWR) {
flags |= BDRV_O_ALLOW_RDWR;
}
qdict_extract_subqdict(options, &file_options, "file.");
ret = bdrv_file_open(&file, filename, file_options,
bdrv_open_flags(bs, flags | BDRV_O_UNMAP), &local_err);
if (ret < 0) {
goto fail;
}
/* Find the right image format driver */
drvname = qdict_get_try_str(options, "driver");
if (drvname) {
drv = bdrv_find_whitelisted_format(drvname, !(flags & BDRV_O_RDWR));
qdict_del(options, "driver");
}
if (!drv) {
ret = find_image_format(file, filename, &drv, &local_err);
}
if (!drv) {
goto unlink_and_fail;
}
/* Open the image */
ret = bdrv_open_common(bs, file, options, flags, drv, &local_err);
if (ret < 0) {
goto unlink_and_fail;
}
if (bs->file != file) {
bdrv_unref(file);
file = NULL;
}
/* If there is a backing file, use it */
if ((flags & BDRV_O_NO_BACKING) == 0) {
QDict *backing_options;
qdict_extract_subqdict(options, &backing_options, "backing.");
ret = bdrv_open_backing_file(bs, backing_options, &local_err);
if (ret < 0) {
goto close_and_fail;
}
}
/* Check if any unknown options were used */
if (qdict_size(options) != 0) {
const QDictEntry *entry = qdict_first(options);
error_setg(errp, "Block format '%s' used by device '%s' doesn't "
"support the option '%s'", drv->format_name, bs->device_name,
entry->key);
ret = -EINVAL;
goto close_and_fail;
}
QDECREF(options);
if (!bdrv_key_required(bs)) {
bdrv_dev_change_media_cb(bs, true);
}
return 0;
unlink_and_fail:
if (file != NULL) {
bdrv_unref(file);
}
if (bs->is_temporary) {
unlink(filename);
}
fail:
QDECREF(bs->options);
QDECREF(options);
bs->options = NULL;
if (error_is_set(&local_err)) {
error_propagate(errp, local_err);
}
return ret;
close_and_fail:
bdrv_close(bs);
QDECREF(options);
if (error_is_set(&local_err)) {
error_propagate(errp, local_err);
}
return ret;
}
| true |
qemu
|
8f94a6e40e46cbc8e8014da825d25824b1803b34
|
int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options,
int flags, BlockDriver *drv, Error **errp)
{
int ret;
char tmp_filename[PATH_MAX + 1];
BlockDriverState *file = NULL;
QDict *file_options = NULL;
const char *drvname;
Error *local_err = NULL;
if (options == NULL) {
options = qdict_new();
}
bs->options = options;
options = qdict_clone_shallow(options);
if (flags & BDRV_O_SNAPSHOT) {
BlockDriverState *bs1;
int64_t total_size;
BlockDriver *bdrv_qcow2;
QEMUOptionParameter *create_options;
char backing_filename[PATH_MAX];
if (qdict_size(options) != 0) {
error_setg(errp, "Can't use snapshot=on with driver-specific options");
ret = -EINVAL;
goto fail;
}
assert(filename != NULL);
bs1 = bdrv_new("");
ret = bdrv_open(bs1, filename, NULL, 0, drv, &local_err);
if (ret < 0) {
bdrv_unref(bs1);
goto fail;
}
total_size = bdrv_getlength(bs1) & BDRV_SECTOR_MASK;
bdrv_unref(bs1);
ret = get_tmp_filename(tmp_filename, sizeof(tmp_filename));
if (ret < 0) {
error_setg_errno(errp, -ret, "Could not get temporary filename");
goto fail;
}
if (path_has_protocol(filename)) {
snprintf(backing_filename, sizeof(backing_filename),
"%s", filename);
} else if (!realpath(filename, backing_filename)) {
error_setg_errno(errp, errno, "Could not resolve path '%s'", filename);
ret = -errno;
goto fail;
}
bdrv_qcow2 = bdrv_find_format("qcow2");
create_options = parse_option_parameters("", bdrv_qcow2->create_options,
NULL);
set_option_parameter_int(create_options, BLOCK_OPT_SIZE, total_size);
set_option_parameter(create_options, BLOCK_OPT_BACKING_FILE,
backing_filename);
if (drv) {
set_option_parameter(create_options, BLOCK_OPT_BACKING_FMT,
drv->format_name);
}
ret = bdrv_create(bdrv_qcow2, tmp_filename, create_options, &local_err);
free_option_parameters(create_options);
if (ret < 0) {
error_setg_errno(errp, -ret, "Could not create temporary overlay "
"'%s': %s", tmp_filename,
error_get_pretty(local_err));
error_free(local_err);
local_err = NULL;
goto fail;
}
filename = tmp_filename;
drv = bdrv_qcow2;
bs->is_temporary = 1;
}
if (flags & BDRV_O_RDWR) {
flags |= BDRV_O_ALLOW_RDWR;
}
qdict_extract_subqdict(options, &file_options, "file.");
ret = bdrv_file_open(&file, filename, file_options,
bdrv_open_flags(bs, flags | BDRV_O_UNMAP), &local_err);
if (ret < 0) {
goto fail;
}
drvname = qdict_get_try_str(options, "driver");
if (drvname) {
drv = bdrv_find_whitelisted_format(drvname, !(flags & BDRV_O_RDWR));
qdict_del(options, "driver");
}
if (!drv) {
ret = find_image_format(file, filename, &drv, &local_err);
}
if (!drv) {
goto unlink_and_fail;
}
ret = bdrv_open_common(bs, file, options, flags, drv, &local_err);
if (ret < 0) {
goto unlink_and_fail;
}
if (bs->file != file) {
bdrv_unref(file);
file = NULL;
}
if ((flags & BDRV_O_NO_BACKING) == 0) {
QDict *backing_options;
qdict_extract_subqdict(options, &backing_options, "backing.");
ret = bdrv_open_backing_file(bs, backing_options, &local_err);
if (ret < 0) {
goto close_and_fail;
}
}
if (qdict_size(options) != 0) {
const QDictEntry *entry = qdict_first(options);
error_setg(errp, "Block format '%s' used by device '%s' doesn't "
"support the option '%s'", drv->format_name, bs->device_name,
entry->key);
ret = -EINVAL;
goto close_and_fail;
}
QDECREF(options);
if (!bdrv_key_required(bs)) {
bdrv_dev_change_media_cb(bs, true);
}
return 0;
unlink_and_fail:
if (file != NULL) {
bdrv_unref(file);
}
if (bs->is_temporary) {
unlink(filename);
}
fail:
QDECREF(bs->options);
QDECREF(options);
bs->options = NULL;
if (error_is_set(&local_err)) {
error_propagate(errp, local_err);
}
return ret;
close_and_fail:
bdrv_close(bs);
QDECREF(options);
if (error_is_set(&local_err)) {
error_propagate(errp, local_err);
}
return ret;
}
|
{
"code": [
" drv = bdrv_find_whitelisted_format(drvname, !(flags & BDRV_O_RDWR));",
" drv = bdrv_find_whitelisted_format(drvname, !(flags & BDRV_O_RDWR));"
],
"line_no": [
217,
217
]
}
|
int FUNC_0(BlockDriverState *VAR_0, const char *VAR_1, QDict *VAR_2,
int VAR_3, BlockDriver *VAR_4, Error **VAR_5)
{
int VAR_6;
char VAR_7[PATH_MAX + 1];
BlockDriverState *file = NULL;
QDict *file_options = NULL;
const char *VAR_8;
Error *local_err = NULL;
if (VAR_2 == NULL) {
VAR_2 = qdict_new();
}
VAR_0->VAR_2 = VAR_2;
VAR_2 = qdict_clone_shallow(VAR_2);
if (VAR_3 & BDRV_O_SNAPSHOT) {
BlockDriverState *bs1;
int64_t total_size;
BlockDriver *bdrv_qcow2;
QEMUOptionParameter *create_options;
char VAR_9[PATH_MAX];
if (qdict_size(VAR_2) != 0) {
error_setg(VAR_5, "Can't use snapshot=on with driver-specific VAR_2");
VAR_6 = -EINVAL;
goto fail;
}
assert(VAR_1 != NULL);
bs1 = bdrv_new("");
VAR_6 = FUNC_0(bs1, VAR_1, NULL, 0, VAR_4, &local_err);
if (VAR_6 < 0) {
bdrv_unref(bs1);
goto fail;
}
total_size = bdrv_getlength(bs1) & BDRV_SECTOR_MASK;
bdrv_unref(bs1);
VAR_6 = get_tmp_filename(VAR_7, sizeof(VAR_7));
if (VAR_6 < 0) {
error_setg_errno(VAR_5, -VAR_6, "Could not get temporary VAR_1");
goto fail;
}
if (path_has_protocol(VAR_1)) {
snprintf(VAR_9, sizeof(VAR_9),
"%s", VAR_1);
} else if (!realpath(VAR_1, VAR_9)) {
error_setg_errno(VAR_5, errno, "Could not resolve path '%s'", VAR_1);
VAR_6 = -errno;
goto fail;
}
bdrv_qcow2 = bdrv_find_format("qcow2");
create_options = parse_option_parameters("", bdrv_qcow2->create_options,
NULL);
set_option_parameter_int(create_options, BLOCK_OPT_SIZE, total_size);
set_option_parameter(create_options, BLOCK_OPT_BACKING_FILE,
VAR_9);
if (VAR_4) {
set_option_parameter(create_options, BLOCK_OPT_BACKING_FMT,
VAR_4->format_name);
}
VAR_6 = bdrv_create(bdrv_qcow2, VAR_7, create_options, &local_err);
free_option_parameters(create_options);
if (VAR_6 < 0) {
error_setg_errno(VAR_5, -VAR_6, "Could not create temporary overlay "
"'%s': %s", VAR_7,
error_get_pretty(local_err));
error_free(local_err);
local_err = NULL;
goto fail;
}
VAR_1 = VAR_7;
VAR_4 = bdrv_qcow2;
VAR_0->is_temporary = 1;
}
if (VAR_3 & BDRV_O_RDWR) {
VAR_3 |= BDRV_O_ALLOW_RDWR;
}
qdict_extract_subqdict(VAR_2, &file_options, "file.");
VAR_6 = bdrv_file_open(&file, VAR_1, file_options,
bdrv_open_flags(VAR_0, VAR_3 | BDRV_O_UNMAP), &local_err);
if (VAR_6 < 0) {
goto fail;
}
VAR_8 = qdict_get_try_str(VAR_2, "driver");
if (VAR_8) {
VAR_4 = bdrv_find_whitelisted_format(VAR_8, !(VAR_3 & BDRV_O_RDWR));
qdict_del(VAR_2, "driver");
}
if (!VAR_4) {
VAR_6 = find_image_format(file, VAR_1, &VAR_4, &local_err);
}
if (!VAR_4) {
goto unlink_and_fail;
}
VAR_6 = bdrv_open_common(VAR_0, file, VAR_2, VAR_3, VAR_4, &local_err);
if (VAR_6 < 0) {
goto unlink_and_fail;
}
if (VAR_0->file != file) {
bdrv_unref(file);
file = NULL;
}
if ((VAR_3 & BDRV_O_NO_BACKING) == 0) {
QDict *backing_options;
qdict_extract_subqdict(VAR_2, &backing_options, "backing.");
VAR_6 = bdrv_open_backing_file(VAR_0, backing_options, &local_err);
if (VAR_6 < 0) {
goto close_and_fail;
}
}
if (qdict_size(VAR_2) != 0) {
const QDictEntry *VAR_10 = qdict_first(VAR_2);
error_setg(VAR_5, "Block format '%s' used by device '%s' doesn't "
"support the option '%s'", VAR_4->format_name, VAR_0->device_name,
VAR_10->key);
VAR_6 = -EINVAL;
goto close_and_fail;
}
QDECREF(VAR_2);
if (!bdrv_key_required(VAR_0)) {
bdrv_dev_change_media_cb(VAR_0, true);
}
return 0;
unlink_and_fail:
if (file != NULL) {
bdrv_unref(file);
}
if (VAR_0->is_temporary) {
unlink(VAR_1);
}
fail:
QDECREF(VAR_0->VAR_2);
QDECREF(VAR_2);
VAR_0->VAR_2 = NULL;
if (error_is_set(&local_err)) {
error_propagate(VAR_5, local_err);
}
return VAR_6;
close_and_fail:
bdrv_close(VAR_0);
QDECREF(VAR_2);
if (error_is_set(&local_err)) {
error_propagate(VAR_5, local_err);
}
return VAR_6;
}
|
[
"int FUNC_0(BlockDriverState *VAR_0, const char *VAR_1, QDict *VAR_2,\nint VAR_3, BlockDriver *VAR_4, Error **VAR_5)\n{",
"int VAR_6;",
"char VAR_7[PATH_MAX + 1];",
"BlockDriverState *file = NULL;",
"QDict *file_options = NULL;",
"const char *VAR_8;",
"Error *local_err = NULL;",
"if (VAR_2 == NULL) {",
"VAR_2 = qdict_new();",
"}",
"VAR_0->VAR_2 = VAR_2;",
"VAR_2 = qdict_clone_shallow(VAR_2);",
"if (VAR_3 & BDRV_O_SNAPSHOT) {",
"BlockDriverState *bs1;",
"int64_t total_size;",
"BlockDriver *bdrv_qcow2;",
"QEMUOptionParameter *create_options;",
"char VAR_9[PATH_MAX];",
"if (qdict_size(VAR_2) != 0) {",
"error_setg(VAR_5, \"Can't use snapshot=on with driver-specific VAR_2\");",
"VAR_6 = -EINVAL;",
"goto fail;",
"}",
"assert(VAR_1 != NULL);",
"bs1 = bdrv_new(\"\");",
"VAR_6 = FUNC_0(bs1, VAR_1, NULL, 0, VAR_4, &local_err);",
"if (VAR_6 < 0) {",
"bdrv_unref(bs1);",
"goto fail;",
"}",
"total_size = bdrv_getlength(bs1) & BDRV_SECTOR_MASK;",
"bdrv_unref(bs1);",
"VAR_6 = get_tmp_filename(VAR_7, sizeof(VAR_7));",
"if (VAR_6 < 0) {",
"error_setg_errno(VAR_5, -VAR_6, \"Could not get temporary VAR_1\");",
"goto fail;",
"}",
"if (path_has_protocol(VAR_1)) {",
"snprintf(VAR_9, sizeof(VAR_9),\n\"%s\", VAR_1);",
"} else if (!realpath(VAR_1, VAR_9)) {",
"error_setg_errno(VAR_5, errno, \"Could not resolve path '%s'\", VAR_1);",
"VAR_6 = -errno;",
"goto fail;",
"}",
"bdrv_qcow2 = bdrv_find_format(\"qcow2\");",
"create_options = parse_option_parameters(\"\", bdrv_qcow2->create_options,\nNULL);",
"set_option_parameter_int(create_options, BLOCK_OPT_SIZE, total_size);",
"set_option_parameter(create_options, BLOCK_OPT_BACKING_FILE,\nVAR_9);",
"if (VAR_4) {",
"set_option_parameter(create_options, BLOCK_OPT_BACKING_FMT,\nVAR_4->format_name);",
"}",
"VAR_6 = bdrv_create(bdrv_qcow2, VAR_7, create_options, &local_err);",
"free_option_parameters(create_options);",
"if (VAR_6 < 0) {",
"error_setg_errno(VAR_5, -VAR_6, \"Could not create temporary overlay \"\n\"'%s': %s\", VAR_7,\nerror_get_pretty(local_err));",
"error_free(local_err);",
"local_err = NULL;",
"goto fail;",
"}",
"VAR_1 = VAR_7;",
"VAR_4 = bdrv_qcow2;",
"VAR_0->is_temporary = 1;",
"}",
"if (VAR_3 & BDRV_O_RDWR) {",
"VAR_3 |= BDRV_O_ALLOW_RDWR;",
"}",
"qdict_extract_subqdict(VAR_2, &file_options, \"file.\");",
"VAR_6 = bdrv_file_open(&file, VAR_1, file_options,\nbdrv_open_flags(VAR_0, VAR_3 | BDRV_O_UNMAP), &local_err);",
"if (VAR_6 < 0) {",
"goto fail;",
"}",
"VAR_8 = qdict_get_try_str(VAR_2, \"driver\");",
"if (VAR_8) {",
"VAR_4 = bdrv_find_whitelisted_format(VAR_8, !(VAR_3 & BDRV_O_RDWR));",
"qdict_del(VAR_2, \"driver\");",
"}",
"if (!VAR_4) {",
"VAR_6 = find_image_format(file, VAR_1, &VAR_4, &local_err);",
"}",
"if (!VAR_4) {",
"goto unlink_and_fail;",
"}",
"VAR_6 = bdrv_open_common(VAR_0, file, VAR_2, VAR_3, VAR_4, &local_err);",
"if (VAR_6 < 0) {",
"goto unlink_and_fail;",
"}",
"if (VAR_0->file != file) {",
"bdrv_unref(file);",
"file = NULL;",
"}",
"if ((VAR_3 & BDRV_O_NO_BACKING) == 0) {",
"QDict *backing_options;",
"qdict_extract_subqdict(VAR_2, &backing_options, \"backing.\");",
"VAR_6 = bdrv_open_backing_file(VAR_0, backing_options, &local_err);",
"if (VAR_6 < 0) {",
"goto close_and_fail;",
"}",
"}",
"if (qdict_size(VAR_2) != 0) {",
"const QDictEntry *VAR_10 = qdict_first(VAR_2);",
"error_setg(VAR_5, \"Block format '%s' used by device '%s' doesn't \"\n\"support the option '%s'\", VAR_4->format_name, VAR_0->device_name,\nVAR_10->key);",
"VAR_6 = -EINVAL;",
"goto close_and_fail;",
"}",
"QDECREF(VAR_2);",
"if (!bdrv_key_required(VAR_0)) {",
"bdrv_dev_change_media_cb(VAR_0, true);",
"}",
"return 0;",
"unlink_and_fail:\nif (file != NULL) {",
"bdrv_unref(file);",
"}",
"if (VAR_0->is_temporary) {",
"unlink(VAR_1);",
"}",
"fail:\nQDECREF(VAR_0->VAR_2);",
"QDECREF(VAR_2);",
"VAR_0->VAR_2 = NULL;",
"if (error_is_set(&local_err)) {",
"error_propagate(VAR_5, local_err);",
"}",
"return VAR_6;",
"close_and_fail:\nbdrv_close(VAR_0);",
"QDECREF(VAR_2);",
"if (error_is_set(&local_err)) {",
"error_propagate(VAR_5, local_err);",
"}",
"return VAR_6;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
] |
[
[
1,
3,
5
],
[
7
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
93
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
111
],
[
113,
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
129
],
[
131,
133
],
[
137
],
[
139,
141
],
[
143
],
[
145,
147
],
[
149
],
[
153
],
[
155
],
[
157
],
[
159,
161,
163
],
[
165
],
[
167
],
[
169
],
[
171
],
[
175
],
[
177
],
[
179
],
[
181
],
[
187
],
[
189
],
[
191
],
[
195
],
[
199,
201
],
[
203
],
[
205
],
[
207
],
[
213
],
[
215
],
[
217
],
[
219
],
[
221
],
[
225
],
[
227
],
[
229
],
[
233
],
[
235
],
[
237
],
[
243
],
[
245
],
[
247
],
[
249
],
[
253
],
[
255
],
[
257
],
[
259
],
[
265
],
[
267
],
[
271
],
[
273
],
[
275
],
[
277
],
[
279
],
[
281
],
[
287
],
[
289
],
[
291,
293,
295
],
[
299
],
[
301
],
[
303
],
[
305
],
[
309
],
[
311
],
[
313
],
[
317
],
[
321,
323
],
[
325
],
[
327
],
[
329
],
[
331
],
[
333
],
[
335,
337
],
[
339
],
[
341
],
[
343
],
[
345
],
[
347
],
[
349
],
[
353,
355
],
[
357
],
[
359
],
[
361
],
[
363
],
[
365
],
[
367
]
] |
7,306 |
static int qdm2_parse_packet(AVFormatContext *s, PayloadContext *qdm,
AVStream *st, AVPacket *pkt,
uint32_t *timestamp,
const uint8_t *buf, int len, int flags)
{
int res = AVERROR_INVALIDDATA, n;
const uint8_t *end = buf + len, *p = buf;
if (len > 0) {
if (len < 2)
return AVERROR_INVALIDDATA;
/* configuration block */
if (*p == 0xff) {
if (qdm->n_pkts > 0) {
av_log(s, AV_LOG_WARNING,
"Out of sequence config - dropping queue\n");
qdm->n_pkts = 0;
memset(qdm->len, 0, sizeof(qdm->len));
}
if ((res = qdm2_parse_config(qdm, st, ++p, end)) < 0)
return res;
p += res;
/* We set codec_id to CODEC_ID_NONE initially to
* delay decoder initialization since extradata is
* carried within the RTP stream, not SDP. Here,
* by setting codec_id to CODEC_ID_QDM2, we are signalling
* to the decoder that it is OK to initialize. */
st->codec->codec_id = CODEC_ID_QDM2;
}
/* subpackets */
while (end - p >= 4) {
if ((res = qdm2_parse_subpacket(qdm, st, p, end)) < 0)
return res;
p += res;
}
qdm->timestamp = *timestamp;
if (++qdm->n_pkts < qdm->subpkts_per_block)
qdm->cache = 0;
for (n = 0; n < 0x80; n++)
if (qdm->len[n] > 0)
qdm->cache++;
}
/* output the subpackets into freshly created superblock structures */
if (!qdm->cache || (res = qdm2_restore_block(qdm, st, pkt)) < 0)
return res;
if (--qdm->cache == 0)
qdm->n_pkts = 0;
*timestamp = qdm->timestamp;
qdm->timestamp = RTP_NOTS_VALUE;
return (qdm->cache > 0) ? 1 : 0;
}
| true |
FFmpeg
|
552a99957f7c6f6ed13795caee7ab7b9deb5d76e
|
static int qdm2_parse_packet(AVFormatContext *s, PayloadContext *qdm,
AVStream *st, AVPacket *pkt,
uint32_t *timestamp,
const uint8_t *buf, int len, int flags)
{
int res = AVERROR_INVALIDDATA, n;
const uint8_t *end = buf + len, *p = buf;
if (len > 0) {
if (len < 2)
return AVERROR_INVALIDDATA;
if (*p == 0xff) {
if (qdm->n_pkts > 0) {
av_log(s, AV_LOG_WARNING,
"Out of sequence config - dropping queue\n");
qdm->n_pkts = 0;
memset(qdm->len, 0, sizeof(qdm->len));
}
if ((res = qdm2_parse_config(qdm, st, ++p, end)) < 0)
return res;
p += res;
st->codec->codec_id = CODEC_ID_QDM2;
}
while (end - p >= 4) {
if ((res = qdm2_parse_subpacket(qdm, st, p, end)) < 0)
return res;
p += res;
}
qdm->timestamp = *timestamp;
if (++qdm->n_pkts < qdm->subpkts_per_block)
qdm->cache = 0;
for (n = 0; n < 0x80; n++)
if (qdm->len[n] > 0)
qdm->cache++;
}
if (!qdm->cache || (res = qdm2_restore_block(qdm, st, pkt)) < 0)
return res;
if (--qdm->cache == 0)
qdm->n_pkts = 0;
*timestamp = qdm->timestamp;
qdm->timestamp = RTP_NOTS_VALUE;
return (qdm->cache > 0) ? 1 : 0;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(AVFormatContext *VAR_0, PayloadContext *VAR_1,
AVStream *VAR_2, AVPacket *VAR_3,
uint32_t *VAR_4,
const uint8_t *VAR_5, int VAR_6, int VAR_7)
{
int VAR_8 = AVERROR_INVALIDDATA, VAR_9;
const uint8_t *VAR_10 = VAR_5 + VAR_6, *p = VAR_5;
if (VAR_6 > 0) {
if (VAR_6 < 2)
return AVERROR_INVALIDDATA;
if (*p == 0xff) {
if (VAR_1->n_pkts > 0) {
av_log(VAR_0, AV_LOG_WARNING,
"Out of sequence config - dropping queue\VAR_9");
VAR_1->n_pkts = 0;
memset(VAR_1->VAR_6, 0, sizeof(VAR_1->VAR_6));
}
if ((VAR_8 = qdm2_parse_config(VAR_1, VAR_2, ++p, VAR_10)) < 0)
return VAR_8;
p += VAR_8;
VAR_2->codec->codec_id = CODEC_ID_QDM2;
}
while (VAR_10 - p >= 4) {
if ((VAR_8 = qdm2_parse_subpacket(VAR_1, VAR_2, p, VAR_10)) < 0)
return VAR_8;
p += VAR_8;
}
VAR_1->VAR_4 = *VAR_4;
if (++VAR_1->n_pkts < VAR_1->subpkts_per_block)
VAR_1->cache = 0;
for (VAR_9 = 0; VAR_9 < 0x80; VAR_9++)
if (VAR_1->VAR_6[VAR_9] > 0)
VAR_1->cache++;
}
if (!VAR_1->cache || (VAR_8 = qdm2_restore_block(VAR_1, VAR_2, VAR_3)) < 0)
return VAR_8;
if (--VAR_1->cache == 0)
VAR_1->n_pkts = 0;
*VAR_4 = VAR_1->VAR_4;
VAR_1->VAR_4 = RTP_NOTS_VALUE;
return (VAR_1->cache > 0) ? 1 : 0;
}
|
[
"static int FUNC_0(AVFormatContext *VAR_0, PayloadContext *VAR_1,\nAVStream *VAR_2, AVPacket *VAR_3,\nuint32_t *VAR_4,\nconst uint8_t *VAR_5, int VAR_6, int VAR_7)\n{",
"int VAR_8 = AVERROR_INVALIDDATA, VAR_9;",
"const uint8_t *VAR_10 = VAR_5 + VAR_6, *p = VAR_5;",
"if (VAR_6 > 0) {",
"if (VAR_6 < 2)\nreturn AVERROR_INVALIDDATA;",
"if (*p == 0xff) {",
"if (VAR_1->n_pkts > 0) {",
"av_log(VAR_0, AV_LOG_WARNING,\n\"Out of sequence config - dropping queue\\VAR_9\");",
"VAR_1->n_pkts = 0;",
"memset(VAR_1->VAR_6, 0, sizeof(VAR_1->VAR_6));",
"}",
"if ((VAR_8 = qdm2_parse_config(VAR_1, VAR_2, ++p, VAR_10)) < 0)\nreturn VAR_8;",
"p += VAR_8;",
"VAR_2->codec->codec_id = CODEC_ID_QDM2;",
"}",
"while (VAR_10 - p >= 4) {",
"if ((VAR_8 = qdm2_parse_subpacket(VAR_1, VAR_2, p, VAR_10)) < 0)\nreturn VAR_8;",
"p += VAR_8;",
"}",
"VAR_1->VAR_4 = *VAR_4;",
"if (++VAR_1->n_pkts < VAR_1->subpkts_per_block)\nVAR_1->cache = 0;",
"for (VAR_9 = 0; VAR_9 < 0x80; VAR_9++)",
"if (VAR_1->VAR_6[VAR_9] > 0)\nVAR_1->cache++;",
"}",
"if (!VAR_1->cache || (VAR_8 = qdm2_restore_block(VAR_1, VAR_2, VAR_3)) < 0)\nreturn VAR_8;",
"if (--VAR_1->cache == 0)\nVAR_1->n_pkts = 0;",
"*VAR_4 = VAR_1->VAR_4;",
"VAR_1->VAR_4 = RTP_NOTS_VALUE;",
"return (VAR_1->cache > 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
],
[
11
],
[
13
],
[
17
],
[
19,
21
],
[
27
],
[
29
],
[
31,
33
],
[
35
],
[
37
],
[
39
],
[
43,
45
],
[
47
],
[
61
],
[
63
],
[
71
],
[
73,
75
],
[
77
],
[
79
],
[
83
],
[
85,
88
],
[
90
],
[
92,
94
],
[
96
],
[
102,
104
],
[
106,
108
],
[
112
],
[
114
],
[
118
],
[
120
]
] |
7,307 |
av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact)
{
int mm_flags = av_get_cpu_flags();
if (EXTERNAL_MMX(mm_flags)) {
c->ac3_exponent_min = ff_ac3_exponent_min_mmx;
c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_mmx;
c->ac3_lshift_int16 = ff_ac3_lshift_int16_mmx;
c->ac3_rshift_int32 = ff_ac3_rshift_int32_mmx;
}
if (EXTERNAL_AMD3DNOW(mm_flags)) {
c->extract_exponents = ff_ac3_extract_exponents_3dnow;
if (!bit_exact) {
c->float_to_fixed24 = ff_float_to_fixed24_3dnow;
}
}
if (EXTERNAL_MMXEXT(mm_flags)) {
c->ac3_exponent_min = ff_ac3_exponent_min_mmxext;
c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_mmxext;
}
if (EXTERNAL_SSE(mm_flags)) {
c->float_to_fixed24 = ff_float_to_fixed24_sse;
}
if (EXTERNAL_SSE2(mm_flags)) {
c->ac3_exponent_min = ff_ac3_exponent_min_sse2;
c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_sse2;
c->float_to_fixed24 = ff_float_to_fixed24_sse2;
c->compute_mantissa_size = ff_ac3_compute_mantissa_size_sse2;
c->extract_exponents = ff_ac3_extract_exponents_sse2;
if (!(mm_flags & AV_CPU_FLAG_SSE2SLOW)) {
c->ac3_lshift_int16 = ff_ac3_lshift_int16_sse2;
c->ac3_rshift_int32 = ff_ac3_rshift_int32_sse2;
}
}
if (EXTERNAL_SSSE3(mm_flags)) {
c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_ssse3;
if (!(mm_flags & AV_CPU_FLAG_ATOM)) {
c->extract_exponents = ff_ac3_extract_exponents_ssse3;
}
}
#if HAVE_SSE_INLINE && HAVE_7REGS
if (INLINE_SSE(mm_flags)) {
c->downmix = ac3_downmix_sse;
}
#endif
}
| true |
FFmpeg
|
7c00e9d8aed8511c44281d7b05562578a3fcd4c8
|
av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact)
{
int mm_flags = av_get_cpu_flags();
if (EXTERNAL_MMX(mm_flags)) {
c->ac3_exponent_min = ff_ac3_exponent_min_mmx;
c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_mmx;
c->ac3_lshift_int16 = ff_ac3_lshift_int16_mmx;
c->ac3_rshift_int32 = ff_ac3_rshift_int32_mmx;
}
if (EXTERNAL_AMD3DNOW(mm_flags)) {
c->extract_exponents = ff_ac3_extract_exponents_3dnow;
if (!bit_exact) {
c->float_to_fixed24 = ff_float_to_fixed24_3dnow;
}
}
if (EXTERNAL_MMXEXT(mm_flags)) {
c->ac3_exponent_min = ff_ac3_exponent_min_mmxext;
c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_mmxext;
}
if (EXTERNAL_SSE(mm_flags)) {
c->float_to_fixed24 = ff_float_to_fixed24_sse;
}
if (EXTERNAL_SSE2(mm_flags)) {
c->ac3_exponent_min = ff_ac3_exponent_min_sse2;
c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_sse2;
c->float_to_fixed24 = ff_float_to_fixed24_sse2;
c->compute_mantissa_size = ff_ac3_compute_mantissa_size_sse2;
c->extract_exponents = ff_ac3_extract_exponents_sse2;
if (!(mm_flags & AV_CPU_FLAG_SSE2SLOW)) {
c->ac3_lshift_int16 = ff_ac3_lshift_int16_sse2;
c->ac3_rshift_int32 = ff_ac3_rshift_int32_sse2;
}
}
if (EXTERNAL_SSSE3(mm_flags)) {
c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_ssse3;
if (!(mm_flags & AV_CPU_FLAG_ATOM)) {
c->extract_exponents = ff_ac3_extract_exponents_ssse3;
}
}
#if HAVE_SSE_INLINE && HAVE_7REGS
if (INLINE_SSE(mm_flags)) {
c->downmix = ac3_downmix_sse;
}
#endif
}
|
{
"code": [
" c->extract_exponents = ff_ac3_extract_exponents_3dnow;"
],
"line_no": [
23
]
}
|
av_cold void FUNC_0(AC3DSPContext *c, int bit_exact)
{
int VAR_0 = av_get_cpu_flags();
if (EXTERNAL_MMX(VAR_0)) {
c->ac3_exponent_min = ff_ac3_exponent_min_mmx;
c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_mmx;
c->ac3_lshift_int16 = ff_ac3_lshift_int16_mmx;
c->ac3_rshift_int32 = ff_ac3_rshift_int32_mmx;
}
if (EXTERNAL_AMD3DNOW(VAR_0)) {
c->extract_exponents = ff_ac3_extract_exponents_3dnow;
if (!bit_exact) {
c->float_to_fixed24 = ff_float_to_fixed24_3dnow;
}
}
if (EXTERNAL_MMXEXT(VAR_0)) {
c->ac3_exponent_min = ff_ac3_exponent_min_mmxext;
c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_mmxext;
}
if (EXTERNAL_SSE(VAR_0)) {
c->float_to_fixed24 = ff_float_to_fixed24_sse;
}
if (EXTERNAL_SSE2(VAR_0)) {
c->ac3_exponent_min = ff_ac3_exponent_min_sse2;
c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_sse2;
c->float_to_fixed24 = ff_float_to_fixed24_sse2;
c->compute_mantissa_size = ff_ac3_compute_mantissa_size_sse2;
c->extract_exponents = ff_ac3_extract_exponents_sse2;
if (!(VAR_0 & AV_CPU_FLAG_SSE2SLOW)) {
c->ac3_lshift_int16 = ff_ac3_lshift_int16_sse2;
c->ac3_rshift_int32 = ff_ac3_rshift_int32_sse2;
}
}
if (EXTERNAL_SSSE3(VAR_0)) {
c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_ssse3;
if (!(VAR_0 & AV_CPU_FLAG_ATOM)) {
c->extract_exponents = ff_ac3_extract_exponents_ssse3;
}
}
#if HAVE_SSE_INLINE && HAVE_7REGS
if (INLINE_SSE(VAR_0)) {
c->downmix = ac3_downmix_sse;
}
#endif
}
|
[
"av_cold void FUNC_0(AC3DSPContext *c, int bit_exact)\n{",
"int VAR_0 = av_get_cpu_flags();",
"if (EXTERNAL_MMX(VAR_0)) {",
"c->ac3_exponent_min = ff_ac3_exponent_min_mmx;",
"c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_mmx;",
"c->ac3_lshift_int16 = ff_ac3_lshift_int16_mmx;",
"c->ac3_rshift_int32 = ff_ac3_rshift_int32_mmx;",
"}",
"if (EXTERNAL_AMD3DNOW(VAR_0)) {",
"c->extract_exponents = ff_ac3_extract_exponents_3dnow;",
"if (!bit_exact) {",
"c->float_to_fixed24 = ff_float_to_fixed24_3dnow;",
"}",
"}",
"if (EXTERNAL_MMXEXT(VAR_0)) {",
"c->ac3_exponent_min = ff_ac3_exponent_min_mmxext;",
"c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_mmxext;",
"}",
"if (EXTERNAL_SSE(VAR_0)) {",
"c->float_to_fixed24 = ff_float_to_fixed24_sse;",
"}",
"if (EXTERNAL_SSE2(VAR_0)) {",
"c->ac3_exponent_min = ff_ac3_exponent_min_sse2;",
"c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_sse2;",
"c->float_to_fixed24 = ff_float_to_fixed24_sse2;",
"c->compute_mantissa_size = ff_ac3_compute_mantissa_size_sse2;",
"c->extract_exponents = ff_ac3_extract_exponents_sse2;",
"if (!(VAR_0 & AV_CPU_FLAG_SSE2SLOW)) {",
"c->ac3_lshift_int16 = ff_ac3_lshift_int16_sse2;",
"c->ac3_rshift_int32 = ff_ac3_rshift_int32_sse2;",
"}",
"}",
"if (EXTERNAL_SSSE3(VAR_0)) {",
"c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_ssse3;",
"if (!(VAR_0 & AV_CPU_FLAG_ATOM)) {",
"c->extract_exponents = ff_ac3_extract_exponents_ssse3;",
"}",
"}",
"#if HAVE_SSE_INLINE && HAVE_7REGS\nif (INLINE_SSE(VAR_0)) {",
"c->downmix = ac3_downmix_sse;",
"}",
"#endif\n}"
] |
[
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
],
[
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
],
[
83,
85
],
[
87
],
[
89
],
[
91,
93
]
] |
7,310 |
void tcg_context_init(TCGContext *s)
{
int op, total_args, n;
TCGOpDef *def;
TCGArgConstraint *args_ct;
int *sorted_args;
memset(s, 0, sizeof(*s));
s->nb_globals = 0;
/* Count total number of arguments and allocate the corresponding
space */
total_args = 0;
for(op = 0; op < NB_OPS; op++) {
def = &tcg_op_defs[op];
n = def->nb_iargs + def->nb_oargs;
total_args += n;
}
args_ct = g_malloc(sizeof(TCGArgConstraint) * total_args);
sorted_args = g_malloc(sizeof(int) * total_args);
for(op = 0; op < NB_OPS; op++) {
def = &tcg_op_defs[op];
def->args_ct = args_ct;
def->sorted_args = sorted_args;
n = def->nb_iargs + def->nb_oargs;
sorted_args += n;
args_ct += n;
}
/* Register helpers. */
#define GEN_HELPER 2
#include "helper.h"
tcg_target_init(s);
}
| false |
qemu
|
100b5e0170e86661aaf830869be930a1a201ed08
|
void tcg_context_init(TCGContext *s)
{
int op, total_args, n;
TCGOpDef *def;
TCGArgConstraint *args_ct;
int *sorted_args;
memset(s, 0, sizeof(*s));
s->nb_globals = 0;
total_args = 0;
for(op = 0; op < NB_OPS; op++) {
def = &tcg_op_defs[op];
n = def->nb_iargs + def->nb_oargs;
total_args += n;
}
args_ct = g_malloc(sizeof(TCGArgConstraint) * total_args);
sorted_args = g_malloc(sizeof(int) * total_args);
for(op = 0; op < NB_OPS; op++) {
def = &tcg_op_defs[op];
def->args_ct = args_ct;
def->sorted_args = sorted_args;
n = def->nb_iargs + def->nb_oargs;
sorted_args += n;
args_ct += n;
}
#define GEN_HELPER 2
#include "helper.h"
tcg_target_init(s);
}
|
{
"code": [],
"line_no": []
}
|
void FUNC_0(TCGContext *VAR_0)
{
int VAR_1, VAR_2, VAR_3;
TCGOpDef *def;
TCGArgConstraint *args_ct;
int *VAR_4;
memset(VAR_0, 0, sizeof(*VAR_0));
VAR_0->nb_globals = 0;
VAR_2 = 0;
for(VAR_1 = 0; VAR_1 < NB_OPS; VAR_1++) {
def = &tcg_op_defs[VAR_1];
VAR_3 = def->nb_iargs + def->nb_oargs;
VAR_2 += VAR_3;
}
args_ct = g_malloc(sizeof(TCGArgConstraint) * VAR_2);
VAR_4 = g_malloc(sizeof(int) * VAR_2);
for(VAR_1 = 0; VAR_1 < NB_OPS; VAR_1++) {
def = &tcg_op_defs[VAR_1];
def->args_ct = args_ct;
def->VAR_4 = VAR_4;
VAR_3 = def->nb_iargs + def->nb_oargs;
VAR_4 += VAR_3;
args_ct += VAR_3;
}
#define GEN_HELPER 2
#include "helper.h"
tcg_target_init(VAR_0);
}
|
[
"void FUNC_0(TCGContext *VAR_0)\n{",
"int VAR_1, VAR_2, VAR_3;",
"TCGOpDef *def;",
"TCGArgConstraint *args_ct;",
"int *VAR_4;",
"memset(VAR_0, 0, sizeof(*VAR_0));",
"VAR_0->nb_globals = 0;",
"VAR_2 = 0;",
"for(VAR_1 = 0; VAR_1 < NB_OPS; VAR_1++) {",
"def = &tcg_op_defs[VAR_1];",
"VAR_3 = def->nb_iargs + def->nb_oargs;",
"VAR_2 += VAR_3;",
"}",
"args_ct = g_malloc(sizeof(TCGArgConstraint) * VAR_2);",
"VAR_4 = g_malloc(sizeof(int) * VAR_2);",
"for(VAR_1 = 0; VAR_1 < NB_OPS; VAR_1++) {",
"def = &tcg_op_defs[VAR_1];",
"def->args_ct = args_ct;",
"def->VAR_4 = VAR_4;",
"VAR_3 = def->nb_iargs + def->nb_oargs;",
"VAR_4 += VAR_3;",
"args_ct += VAR_3;",
"}",
"#define GEN_HELPER 2\n#include \"helper.h\"\ntcg_target_init(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
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
39
],
[
41
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
65,
67,
71
],
[
73
]
] |
7,311 |
void macio_nvram_setup_bar(MacIONVRAMState *s, MemoryRegion *bar,
target_phys_addr_t mem_base)
{
memory_region_add_subregion(bar, mem_base, &s->mem);
}
| false |
qemu
|
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
|
void macio_nvram_setup_bar(MacIONVRAMState *s, MemoryRegion *bar,
target_phys_addr_t mem_base)
{
memory_region_add_subregion(bar, mem_base, &s->mem);
}
|
{
"code": [],
"line_no": []
}
|
void FUNC_0(MacIONVRAMState *VAR_0, MemoryRegion *VAR_1,
target_phys_addr_t VAR_2)
{
memory_region_add_subregion(VAR_1, VAR_2, &VAR_0->mem);
}
|
[
"void FUNC_0(MacIONVRAMState *VAR_0, MemoryRegion *VAR_1,\ntarget_phys_addr_t VAR_2)\n{",
"memory_region_add_subregion(VAR_1, VAR_2, &VAR_0->mem);",
"}"
] |
[
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
]
] |
7,312 |
int qemu_input_key_value_to_scancode(const KeyValue *value, bool down,
int *codes)
{
int keycode = qemu_input_key_value_to_number(value);
int count = 0;
if (value->type == KEY_VALUE_KIND_QCODE &&
value->u.qcode == Q_KEY_CODE_PAUSE) {
/* specific case */
int v = down ? 0 : 0x80;
codes[count++] = 0xe1;
codes[count++] = 0x1d | v;
codes[count++] = 0x45 | v;
return count;
}
if (keycode & SCANCODE_GREY) {
codes[count++] = SCANCODE_EMUL0;
keycode &= ~SCANCODE_GREY;
}
if (!down) {
keycode |= SCANCODE_UP;
}
codes[count++] = keycode;
return count;
}
| false |
qemu
|
32bafa8fdd098d52fbf1102d5a5e48d29398c0aa
|
int qemu_input_key_value_to_scancode(const KeyValue *value, bool down,
int *codes)
{
int keycode = qemu_input_key_value_to_number(value);
int count = 0;
if (value->type == KEY_VALUE_KIND_QCODE &&
value->u.qcode == Q_KEY_CODE_PAUSE) {
int v = down ? 0 : 0x80;
codes[count++] = 0xe1;
codes[count++] = 0x1d | v;
codes[count++] = 0x45 | v;
return count;
}
if (keycode & SCANCODE_GREY) {
codes[count++] = SCANCODE_EMUL0;
keycode &= ~SCANCODE_GREY;
}
if (!down) {
keycode |= SCANCODE_UP;
}
codes[count++] = keycode;
return count;
}
|
{
"code": [],
"line_no": []
}
|
int FUNC_0(const KeyValue *VAR_0, bool VAR_1,
int *VAR_2)
{
int VAR_3 = qemu_input_key_value_to_number(VAR_0);
int VAR_4 = 0;
if (VAR_0->type == KEY_VALUE_KIND_QCODE &&
VAR_0->u.qcode == Q_KEY_CODE_PAUSE) {
int VAR_5 = VAR_1 ? 0 : 0x80;
VAR_2[VAR_4++] = 0xe1;
VAR_2[VAR_4++] = 0x1d | VAR_5;
VAR_2[VAR_4++] = 0x45 | VAR_5;
return VAR_4;
}
if (VAR_3 & SCANCODE_GREY) {
VAR_2[VAR_4++] = SCANCODE_EMUL0;
VAR_3 &= ~SCANCODE_GREY;
}
if (!VAR_1) {
VAR_3 |= SCANCODE_UP;
}
VAR_2[VAR_4++] = VAR_3;
return VAR_4;
}
|
[
"int FUNC_0(const KeyValue *VAR_0, bool VAR_1,\nint *VAR_2)\n{",
"int VAR_3 = qemu_input_key_value_to_number(VAR_0);",
"int VAR_4 = 0;",
"if (VAR_0->type == KEY_VALUE_KIND_QCODE &&\nVAR_0->u.qcode == Q_KEY_CODE_PAUSE) {",
"int VAR_5 = VAR_1 ? 0 : 0x80;",
"VAR_2[VAR_4++] = 0xe1;",
"VAR_2[VAR_4++] = 0x1d | VAR_5;",
"VAR_2[VAR_4++] = 0x45 | VAR_5;",
"return VAR_4;",
"}",
"if (VAR_3 & SCANCODE_GREY) {",
"VAR_2[VAR_4++] = SCANCODE_EMUL0;",
"VAR_3 &= ~SCANCODE_GREY;",
"}",
"if (!VAR_1) {",
"VAR_3 |= SCANCODE_UP;",
"}",
"VAR_2[VAR_4++] = VAR_3;",
"return VAR_4;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
13,
15
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
49
],
[
51
]
] |
7,313 |
static void coroutine_fn verify_self(void *opaque)
{
g_assert(qemu_coroutine_self() == opaque);
}
| false |
qemu
|
7e70cdba9f220bef3f3481c663c066c2b80469aa
|
static void coroutine_fn verify_self(void *opaque)
{
g_assert(qemu_coroutine_self() == opaque);
}
|
{
"code": [],
"line_no": []
}
|
static void VAR_0 verify_self(void *opaque)
{
g_assert(qemu_coroutine_self() == opaque);
}
|
[
"static void VAR_0 verify_self(void *opaque)\n{",
"g_assert(qemu_coroutine_self() == opaque);",
"}"
] |
[
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
]
] |
7,314 |
void net_set_boot_mask(int net_boot_mask)
{
int i;
/* Only the first four NICs may be bootable */
net_boot_mask = net_boot_mask & 0xF;
for (i = 0; i < nb_nics; i++) {
if (net_boot_mask & (1 << i)) {
net_boot_mask &= ~(1 << i);
}
}
if (net_boot_mask) {
fprintf(stderr, "Cannot boot from non-existent NIC\n");
exit(1);
}
}
| false |
qemu
|
da1fcfda59a6bcbdf58d49243fbced455f2bf78a
|
void net_set_boot_mask(int net_boot_mask)
{
int i;
net_boot_mask = net_boot_mask & 0xF;
for (i = 0; i < nb_nics; i++) {
if (net_boot_mask & (1 << i)) {
net_boot_mask &= ~(1 << i);
}
}
if (net_boot_mask) {
fprintf(stderr, "Cannot boot from non-existent NIC\n");
exit(1);
}
}
|
{
"code": [],
"line_no": []
}
|
void FUNC_0(int VAR_0)
{
int VAR_1;
VAR_0 = VAR_0 & 0xF;
for (VAR_1 = 0; VAR_1 < nb_nics; VAR_1++) {
if (VAR_0 & (1 << VAR_1)) {
VAR_0 &= ~(1 << VAR_1);
}
}
if (VAR_0) {
fprintf(stderr, "Cannot boot from non-existent NIC\n");
exit(1);
}
}
|
[
"void FUNC_0(int VAR_0)\n{",
"int VAR_1;",
"VAR_0 = VAR_0 & 0xF;",
"for (VAR_1 = 0; VAR_1 < nb_nics; VAR_1++) {",
"if (VAR_0 & (1 << VAR_1)) {",
"VAR_0 &= ~(1 << VAR_1);",
"}",
"}",
"if (VAR_0) {",
"fprintf(stderr, \"Cannot boot from non-existent NIC\\n\");",
"exit(1);",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
11
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
]
] |
7,317 |
void msix_reset(PCIDevice *dev)
{
if (!(dev->cap_present & QEMU_PCI_CAP_MSIX))
return;
msix_free_irq_entries(dev);
dev->config[dev->msix_cap + MSIX_CONTROL_OFFSET] &=
~dev->wmask[dev->msix_cap + MSIX_CONTROL_OFFSET];
memset(dev->msix_table_page, 0, MSIX_PAGE_SIZE);
msix_mask_all(dev, dev->msix_entries_nr);
}
| false |
qemu
|
44701ab71ad854e6be567a6294f4665f36651076
|
void msix_reset(PCIDevice *dev)
{
if (!(dev->cap_present & QEMU_PCI_CAP_MSIX))
return;
msix_free_irq_entries(dev);
dev->config[dev->msix_cap + MSIX_CONTROL_OFFSET] &=
~dev->wmask[dev->msix_cap + MSIX_CONTROL_OFFSET];
memset(dev->msix_table_page, 0, MSIX_PAGE_SIZE);
msix_mask_all(dev, dev->msix_entries_nr);
}
|
{
"code": [],
"line_no": []
}
|
void FUNC_0(PCIDevice *VAR_0)
{
if (!(VAR_0->cap_present & QEMU_PCI_CAP_MSIX))
return;
msix_free_irq_entries(VAR_0);
VAR_0->config[VAR_0->msix_cap + MSIX_CONTROL_OFFSET] &=
~VAR_0->wmask[VAR_0->msix_cap + MSIX_CONTROL_OFFSET];
memset(VAR_0->msix_table_page, 0, MSIX_PAGE_SIZE);
msix_mask_all(VAR_0, VAR_0->msix_entries_nr);
}
|
[
"void FUNC_0(PCIDevice *VAR_0)\n{",
"if (!(VAR_0->cap_present & QEMU_PCI_CAP_MSIX))\nreturn;",
"msix_free_irq_entries(VAR_0);",
"VAR_0->config[VAR_0->msix_cap + MSIX_CONTROL_OFFSET] &=\n~VAR_0->wmask[VAR_0->msix_cap + MSIX_CONTROL_OFFSET];",
"memset(VAR_0->msix_table_page, 0, MSIX_PAGE_SIZE);",
"msix_mask_all(VAR_0, VAR_0->msix_entries_nr);",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5,
7
],
[
9
],
[
11,
13
],
[
15
],
[
17
],
[
19
]
] |
7,318 |
static void pl110_write(void *opaque, hwaddr offset,
uint64_t val, unsigned size)
{
pl110_state *s = (pl110_state *)opaque;
int n;
/* For simplicity invalidate the display whenever a control register
is written to. */
s->invalidate = 1;
if (offset >= 0x200 && offset < 0x400) {
/* Palette. */
n = (offset - 0x200) >> 2;
s->raw_palette[(offset - 0x200) >> 2] = val;
pl110_update_palette(s, n);
return;
}
switch (offset >> 2) {
case 0: /* LCDTiming0 */
s->timing[0] = val;
n = ((val & 0xfc) + 4) * 4;
pl110_resize(s, n, s->rows);
break;
case 1: /* LCDTiming1 */
s->timing[1] = val;
n = (val & 0x3ff) + 1;
pl110_resize(s, s->cols, n);
break;
case 2: /* LCDTiming2 */
s->timing[2] = val;
break;
case 3: /* LCDTiming3 */
s->timing[3] = val;
break;
case 4: /* LCDUPBASE */
s->upbase = val;
break;
case 5: /* LCDLPBASE */
s->lpbase = val;
break;
case 6: /* LCDIMSC */
if (s->version != PL110) {
goto control;
}
imsc:
s->int_mask = val;
pl110_update(s);
break;
case 7: /* LCDControl */
if (s->version != PL110) {
goto imsc;
}
control:
s->cr = val;
s->bpp = (val >> 1) & 7;
if (pl110_enabled(s)) {
qemu_console_resize(s->ds, s->cols, s->rows);
}
break;
case 10: /* LCDICR */
s->int_status &= ~val;
pl110_update(s);
break;
default:
hw_error("pl110_write: Bad offset %x\n", (int)offset);
}
}
| false |
qemu
|
375cb560295484b88898262ebf400eff9a011206
|
static void pl110_write(void *opaque, hwaddr offset,
uint64_t val, unsigned size)
{
pl110_state *s = (pl110_state *)opaque;
int n;
s->invalidate = 1;
if (offset >= 0x200 && offset < 0x400) {
n = (offset - 0x200) >> 2;
s->raw_palette[(offset - 0x200) >> 2] = val;
pl110_update_palette(s, n);
return;
}
switch (offset >> 2) {
case 0:
s->timing[0] = val;
n = ((val & 0xfc) + 4) * 4;
pl110_resize(s, n, s->rows);
break;
case 1:
s->timing[1] = val;
n = (val & 0x3ff) + 1;
pl110_resize(s, s->cols, n);
break;
case 2:
s->timing[2] = val;
break;
case 3:
s->timing[3] = val;
break;
case 4:
s->upbase = val;
break;
case 5:
s->lpbase = val;
break;
case 6:
if (s->version != PL110) {
goto control;
}
imsc:
s->int_mask = val;
pl110_update(s);
break;
case 7:
if (s->version != PL110) {
goto imsc;
}
control:
s->cr = val;
s->bpp = (val >> 1) & 7;
if (pl110_enabled(s)) {
qemu_console_resize(s->ds, s->cols, s->rows);
}
break;
case 10:
s->int_status &= ~val;
pl110_update(s);
break;
default:
hw_error("pl110_write: Bad offset %x\n", (int)offset);
}
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(void *VAR_0, hwaddr VAR_1,
uint64_t VAR_2, unsigned VAR_3)
{
pl110_state *s = (pl110_state *)VAR_0;
int VAR_4;
s->invalidate = 1;
if (VAR_1 >= 0x200 && VAR_1 < 0x400) {
VAR_4 = (VAR_1 - 0x200) >> 2;
s->raw_palette[(VAR_1 - 0x200) >> 2] = VAR_2;
pl110_update_palette(s, VAR_4);
return;
}
switch (VAR_1 >> 2) {
case 0:
s->timing[0] = VAR_2;
VAR_4 = ((VAR_2 & 0xfc) + 4) * 4;
pl110_resize(s, VAR_4, s->rows);
break;
case 1:
s->timing[1] = VAR_2;
VAR_4 = (VAR_2 & 0x3ff) + 1;
pl110_resize(s, s->cols, VAR_4);
break;
case 2:
s->timing[2] = VAR_2;
break;
case 3:
s->timing[3] = VAR_2;
break;
case 4:
s->upbase = VAR_2;
break;
case 5:
s->lpbase = VAR_2;
break;
case 6:
if (s->version != PL110) {
goto control;
}
imsc:
s->int_mask = VAR_2;
pl110_update(s);
break;
case 7:
if (s->version != PL110) {
goto imsc;
}
control:
s->cr = VAR_2;
s->bpp = (VAR_2 >> 1) & 7;
if (pl110_enabled(s)) {
qemu_console_resize(s->ds, s->cols, s->rows);
}
break;
case 10:
s->int_status &= ~VAR_2;
pl110_update(s);
break;
default:
hw_error("FUNC_0: Bad VAR_1 %x\VAR_4", (int)VAR_1);
}
}
|
[
"static void FUNC_0(void *VAR_0, hwaddr VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{",
"pl110_state *s = (pl110_state *)VAR_0;",
"int VAR_4;",
"s->invalidate = 1;",
"if (VAR_1 >= 0x200 && VAR_1 < 0x400) {",
"VAR_4 = (VAR_1 - 0x200) >> 2;",
"s->raw_palette[(VAR_1 - 0x200) >> 2] = VAR_2;",
"pl110_update_palette(s, VAR_4);",
"return;",
"}",
"switch (VAR_1 >> 2) {",
"case 0:\ns->timing[0] = VAR_2;",
"VAR_4 = ((VAR_2 & 0xfc) + 4) * 4;",
"pl110_resize(s, VAR_4, s->rows);",
"break;",
"case 1:\ns->timing[1] = VAR_2;",
"VAR_4 = (VAR_2 & 0x3ff) + 1;",
"pl110_resize(s, s->cols, VAR_4);",
"break;",
"case 2:\ns->timing[2] = VAR_2;",
"break;",
"case 3:\ns->timing[3] = VAR_2;",
"break;",
"case 4:\ns->upbase = VAR_2;",
"break;",
"case 5:\ns->lpbase = VAR_2;",
"break;",
"case 6:\nif (s->version != PL110) {",
"goto control;",
"}",
"imsc:\ns->int_mask = VAR_2;",
"pl110_update(s);",
"break;",
"case 7:\nif (s->version != PL110) {",
"goto imsc;",
"}",
"control:\ns->cr = VAR_2;",
"s->bpp = (VAR_2 >> 1) & 7;",
"if (pl110_enabled(s)) {",
"qemu_console_resize(s->ds, s->cols, s->rows);",
"}",
"break;",
"case 10:\ns->int_status &= ~VAR_2;",
"pl110_update(s);",
"break;",
"default:\nhw_error(\"FUNC_0: Bad VAR_1 %x\\VAR_4\", (int)VAR_1);",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
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
],
[
85
],
[
87,
89
],
[
91
],
[
93
],
[
95,
97
],
[
99
],
[
101
],
[
103,
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117,
119
],
[
121
],
[
123
],
[
125,
127
],
[
129
],
[
131
]
] |
7,319 |
static int process_input(void)
{
InputFile *ifile;
AVFormatContext *is;
InputStream *ist;
AVPacket pkt;
int ret, i, j;
int file_index;
/* select the stream that we must read now */
file_index = select_input_file();
/* if none, if is finished */
if (file_index == -2) {
poll_filters() ;
return AVERROR(EAGAIN);
}
if (file_index < 0) {
if (got_eagain()) {
reset_eagain();
av_usleep(10000);
return AVERROR(EAGAIN);
}
av_log(NULL, AV_LOG_VERBOSE, "No more inputs to read from, finishing.\n");
return AVERROR_EOF;
}
ifile = input_files[file_index];
is = ifile->ctx;
ret = get_input_packet(ifile, &pkt);
if (ret == AVERROR(EAGAIN)) {
ifile->eagain = 1;
return ret;
}
if (ret < 0) {
if (ret != AVERROR_EOF) {
print_error(is->filename, ret);
if (exit_on_error)
exit_program(1);
}
ifile->eof_reached = 1;
for (i = 0; i < ifile->nb_streams; i++) {
ist = input_streams[ifile->ist_index + i];
if (ist->decoding_needed)
output_packet(ist, NULL);
poll_filters();
}
if (opt_shortest)
return AVERROR_EOF;
else
return AVERROR(EAGAIN);
}
reset_eagain();
if (do_pkt_dump) {
av_pkt_dump_log2(NULL, AV_LOG_DEBUG, &pkt, do_hex_dump,
is->streams[pkt.stream_index]);
}
/* the following test is needed in case new streams appear
dynamically in stream : we ignore them */
if (pkt.stream_index >= ifile->nb_streams) {
report_new_stream(file_index, &pkt);
goto discard_packet;
}
ist = input_streams[ifile->ist_index + pkt.stream_index];
if (ist->discard)
goto discard_packet;
if(!ist->wrap_correction_done && input_files[file_index]->ctx->start_time != AV_NOPTS_VALUE && ist->st->pts_wrap_bits < 64){
uint64_t stime = av_rescale_q(input_files[file_index]->ctx->start_time, AV_TIME_BASE_Q, ist->st->time_base);
uint64_t stime2= stime + (1LL<<ist->st->pts_wrap_bits);
ist->wrap_correction_done = 1;
if(pkt.dts != AV_NOPTS_VALUE && pkt.dts > stime && pkt.dts - stime > stime2 - pkt.dts) {
pkt.dts -= 1LL<<ist->st->pts_wrap_bits;
ist->wrap_correction_done = 0;
}
if(pkt.pts != AV_NOPTS_VALUE && pkt.pts > stime && pkt.pts - stime > stime2 - pkt.pts) {
pkt.pts -= 1LL<<ist->st->pts_wrap_bits;
ist->wrap_correction_done = 0;
}
}
if (pkt.dts != AV_NOPTS_VALUE)
pkt.dts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base);
if (pkt.pts != AV_NOPTS_VALUE)
pkt.pts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base);
if (pkt.pts != AV_NOPTS_VALUE)
pkt.pts *= ist->ts_scale;
if (pkt.dts != AV_NOPTS_VALUE)
pkt.dts *= ist->ts_scale;
if (debug_ts) {
av_log(NULL, AV_LOG_INFO, "demuxer -> ist_index:%d type:%s "
"next_dts:%s next_dts_time:%s next_pts:%s next_pts_time:%s pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s off:%"PRId64"\n",
ifile->ist_index + pkt.stream_index, av_get_media_type_string(ist->st->codec->codec_type),
av_ts2str(ist->next_dts), av_ts2timestr(ist->next_dts, &AV_TIME_BASE_Q),
av_ts2str(ist->next_pts), av_ts2timestr(ist->next_pts, &AV_TIME_BASE_Q),
av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &ist->st->time_base),
av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &ist->st->time_base),
input_files[ist->file_index]->ts_offset);
}
if (pkt.dts != AV_NOPTS_VALUE && ist->next_dts != AV_NOPTS_VALUE &&
!copy_ts) {
int64_t pkt_dts = av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q);
int64_t delta = pkt_dts - ist->next_dts;
if (is->iformat->flags & AVFMT_TS_DISCONT) {
if(delta < -1LL*dts_delta_threshold*AV_TIME_BASE ||
(delta > 1LL*dts_delta_threshold*AV_TIME_BASE &&
ist->st->codec->codec_type != AVMEDIA_TYPE_SUBTITLE) ||
pkt_dts+1<ist->pts){
ifile->ts_offset -= delta;
av_log(NULL, AV_LOG_DEBUG,
"timestamp discontinuity %"PRId64", new offset= %"PRId64"\n",
delta, ifile->ts_offset);
pkt.dts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);
if (pkt.pts != AV_NOPTS_VALUE)
pkt.pts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);
}
} else {
if ( delta < -1LL*dts_error_threshold*AV_TIME_BASE ||
(delta > 1LL*dts_error_threshold*AV_TIME_BASE && ist->st->codec->codec_type != AVMEDIA_TYPE_SUBTITLE) ||
pkt_dts+1<ist->pts){
av_log(NULL, AV_LOG_WARNING, "DTS %"PRId64", next:%"PRId64" st:%d invalid dropping\n", pkt.dts, ist->next_dts, pkt.stream_index);
pkt.dts = AV_NOPTS_VALUE;
}
if (pkt.pts != AV_NOPTS_VALUE){
int64_t pkt_pts = av_rescale_q(pkt.pts, ist->st->time_base, AV_TIME_BASE_Q);
delta = pkt_pts - ist->next_dts;
if ( delta < -1LL*dts_error_threshold*AV_TIME_BASE ||
(delta > 1LL*dts_error_threshold*AV_TIME_BASE && ist->st->codec->codec_type != AVMEDIA_TYPE_SUBTITLE) ||
pkt_pts+1<ist->pts) {
av_log(NULL, AV_LOG_WARNING, "PTS %"PRId64", next:%"PRId64" invalid dropping st:%d\n", pkt.pts, ist->next_dts, pkt.stream_index);
pkt.pts = AV_NOPTS_VALUE;
}
}
}
}
sub2video_heartbeat(ist, pkt.pts);
if ((ret = output_packet(ist, &pkt)) < 0 ||
((ret = poll_filters()) < 0 && ret != AVERROR_EOF)) {
char buf[128];
av_strerror(ret, buf, sizeof(buf));
av_log(NULL, AV_LOG_ERROR, "Error while decoding stream #%d:%d: %s\n",
ist->file_index, ist->st->index, buf);
if (exit_on_error)
exit_program(1);
av_free_packet(&pkt);
return AVERROR(EAGAIN);
}
discard_packet:
av_free_packet(&pkt);
return 0;
}
| false |
FFmpeg
|
c5ea3a009b15a3334ca469885303182e9f218836
|
static int process_input(void)
{
InputFile *ifile;
AVFormatContext *is;
InputStream *ist;
AVPacket pkt;
int ret, i, j;
int file_index;
file_index = select_input_file();
if (file_index == -2) {
poll_filters() ;
return AVERROR(EAGAIN);
}
if (file_index < 0) {
if (got_eagain()) {
reset_eagain();
av_usleep(10000);
return AVERROR(EAGAIN);
}
av_log(NULL, AV_LOG_VERBOSE, "No more inputs to read from, finishing.\n");
return AVERROR_EOF;
}
ifile = input_files[file_index];
is = ifile->ctx;
ret = get_input_packet(ifile, &pkt);
if (ret == AVERROR(EAGAIN)) {
ifile->eagain = 1;
return ret;
}
if (ret < 0) {
if (ret != AVERROR_EOF) {
print_error(is->filename, ret);
if (exit_on_error)
exit_program(1);
}
ifile->eof_reached = 1;
for (i = 0; i < ifile->nb_streams; i++) {
ist = input_streams[ifile->ist_index + i];
if (ist->decoding_needed)
output_packet(ist, NULL);
poll_filters();
}
if (opt_shortest)
return AVERROR_EOF;
else
return AVERROR(EAGAIN);
}
reset_eagain();
if (do_pkt_dump) {
av_pkt_dump_log2(NULL, AV_LOG_DEBUG, &pkt, do_hex_dump,
is->streams[pkt.stream_index]);
}
if (pkt.stream_index >= ifile->nb_streams) {
report_new_stream(file_index, &pkt);
goto discard_packet;
}
ist = input_streams[ifile->ist_index + pkt.stream_index];
if (ist->discard)
goto discard_packet;
if(!ist->wrap_correction_done && input_files[file_index]->ctx->start_time != AV_NOPTS_VALUE && ist->st->pts_wrap_bits < 64){
uint64_t stime = av_rescale_q(input_files[file_index]->ctx->start_time, AV_TIME_BASE_Q, ist->st->time_base);
uint64_t stime2= stime + (1LL<<ist->st->pts_wrap_bits);
ist->wrap_correction_done = 1;
if(pkt.dts != AV_NOPTS_VALUE && pkt.dts > stime && pkt.dts - stime > stime2 - pkt.dts) {
pkt.dts -= 1LL<<ist->st->pts_wrap_bits;
ist->wrap_correction_done = 0;
}
if(pkt.pts != AV_NOPTS_VALUE && pkt.pts > stime && pkt.pts - stime > stime2 - pkt.pts) {
pkt.pts -= 1LL<<ist->st->pts_wrap_bits;
ist->wrap_correction_done = 0;
}
}
if (pkt.dts != AV_NOPTS_VALUE)
pkt.dts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base);
if (pkt.pts != AV_NOPTS_VALUE)
pkt.pts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base);
if (pkt.pts != AV_NOPTS_VALUE)
pkt.pts *= ist->ts_scale;
if (pkt.dts != AV_NOPTS_VALUE)
pkt.dts *= ist->ts_scale;
if (debug_ts) {
av_log(NULL, AV_LOG_INFO, "demuxer -> ist_index:%d type:%s "
"next_dts:%s next_dts_time:%s next_pts:%s next_pts_time:%s pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s off:%"PRId64"\n",
ifile->ist_index + pkt.stream_index, av_get_media_type_string(ist->st->codec->codec_type),
av_ts2str(ist->next_dts), av_ts2timestr(ist->next_dts, &AV_TIME_BASE_Q),
av_ts2str(ist->next_pts), av_ts2timestr(ist->next_pts, &AV_TIME_BASE_Q),
av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &ist->st->time_base),
av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &ist->st->time_base),
input_files[ist->file_index]->ts_offset);
}
if (pkt.dts != AV_NOPTS_VALUE && ist->next_dts != AV_NOPTS_VALUE &&
!copy_ts) {
int64_t pkt_dts = av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q);
int64_t delta = pkt_dts - ist->next_dts;
if (is->iformat->flags & AVFMT_TS_DISCONT) {
if(delta < -1LL*dts_delta_threshold*AV_TIME_BASE ||
(delta > 1LL*dts_delta_threshold*AV_TIME_BASE &&
ist->st->codec->codec_type != AVMEDIA_TYPE_SUBTITLE) ||
pkt_dts+1<ist->pts){
ifile->ts_offset -= delta;
av_log(NULL, AV_LOG_DEBUG,
"timestamp discontinuity %"PRId64", new offset= %"PRId64"\n",
delta, ifile->ts_offset);
pkt.dts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);
if (pkt.pts != AV_NOPTS_VALUE)
pkt.pts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);
}
} else {
if ( delta < -1LL*dts_error_threshold*AV_TIME_BASE ||
(delta > 1LL*dts_error_threshold*AV_TIME_BASE && ist->st->codec->codec_type != AVMEDIA_TYPE_SUBTITLE) ||
pkt_dts+1<ist->pts){
av_log(NULL, AV_LOG_WARNING, "DTS %"PRId64", next:%"PRId64" st:%d invalid dropping\n", pkt.dts, ist->next_dts, pkt.stream_index);
pkt.dts = AV_NOPTS_VALUE;
}
if (pkt.pts != AV_NOPTS_VALUE){
int64_t pkt_pts = av_rescale_q(pkt.pts, ist->st->time_base, AV_TIME_BASE_Q);
delta = pkt_pts - ist->next_dts;
if ( delta < -1LL*dts_error_threshold*AV_TIME_BASE ||
(delta > 1LL*dts_error_threshold*AV_TIME_BASE && ist->st->codec->codec_type != AVMEDIA_TYPE_SUBTITLE) ||
pkt_pts+1<ist->pts) {
av_log(NULL, AV_LOG_WARNING, "PTS %"PRId64", next:%"PRId64" invalid dropping st:%d\n", pkt.pts, ist->next_dts, pkt.stream_index);
pkt.pts = AV_NOPTS_VALUE;
}
}
}
}
sub2video_heartbeat(ist, pkt.pts);
if ((ret = output_packet(ist, &pkt)) < 0 ||
((ret = poll_filters()) < 0 && ret != AVERROR_EOF)) {
char buf[128];
av_strerror(ret, buf, sizeof(buf));
av_log(NULL, AV_LOG_ERROR, "Error while decoding stream #%d:%d: %s\n",
ist->file_index, ist->st->index, buf);
if (exit_on_error)
exit_program(1);
av_free_packet(&pkt);
return AVERROR(EAGAIN);
}
discard_packet:
av_free_packet(&pkt);
return 0;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(void)
{
InputFile *ifile;
AVFormatContext *is;
InputStream *ist;
AVPacket pkt;
int VAR_0, VAR_1, VAR_2;
int VAR_3;
VAR_3 = select_input_file();
if (VAR_3 == -2) {
poll_filters() ;
return AVERROR(EAGAIN);
}
if (VAR_3 < 0) {
if (got_eagain()) {
reset_eagain();
av_usleep(10000);
return AVERROR(EAGAIN);
}
av_log(NULL, AV_LOG_VERBOSE, "No more inputs to read from, finishing.\n");
return AVERROR_EOF;
}
ifile = input_files[VAR_3];
is = ifile->ctx;
VAR_0 = get_input_packet(ifile, &pkt);
if (VAR_0 == AVERROR(EAGAIN)) {
ifile->eagain = 1;
return VAR_0;
}
if (VAR_0 < 0) {
if (VAR_0 != AVERROR_EOF) {
print_error(is->filename, VAR_0);
if (exit_on_error)
exit_program(1);
}
ifile->eof_reached = 1;
for (VAR_1 = 0; VAR_1 < ifile->nb_streams; VAR_1++) {
ist = input_streams[ifile->ist_index + VAR_1];
if (ist->decoding_needed)
output_packet(ist, NULL);
poll_filters();
}
if (opt_shortest)
return AVERROR_EOF;
else
return AVERROR(EAGAIN);
}
reset_eagain();
if (do_pkt_dump) {
av_pkt_dump_log2(NULL, AV_LOG_DEBUG, &pkt, do_hex_dump,
is->streams[pkt.stream_index]);
}
if (pkt.stream_index >= ifile->nb_streams) {
report_new_stream(VAR_3, &pkt);
goto discard_packet;
}
ist = input_streams[ifile->ist_index + pkt.stream_index];
if (ist->discard)
goto discard_packet;
if(!ist->wrap_correction_done && input_files[VAR_3]->ctx->start_time != AV_NOPTS_VALUE && ist->st->pts_wrap_bits < 64){
uint64_t stime = av_rescale_q(input_files[VAR_3]->ctx->start_time, AV_TIME_BASE_Q, ist->st->time_base);
uint64_t stime2= stime + (1LL<<ist->st->pts_wrap_bits);
ist->wrap_correction_done = 1;
if(pkt.dts != AV_NOPTS_VALUE && pkt.dts > stime && pkt.dts - stime > stime2 - pkt.dts) {
pkt.dts -= 1LL<<ist->st->pts_wrap_bits;
ist->wrap_correction_done = 0;
}
if(pkt.pts != AV_NOPTS_VALUE && pkt.pts > stime && pkt.pts - stime > stime2 - pkt.pts) {
pkt.pts -= 1LL<<ist->st->pts_wrap_bits;
ist->wrap_correction_done = 0;
}
}
if (pkt.dts != AV_NOPTS_VALUE)
pkt.dts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base);
if (pkt.pts != AV_NOPTS_VALUE)
pkt.pts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base);
if (pkt.pts != AV_NOPTS_VALUE)
pkt.pts *= ist->ts_scale;
if (pkt.dts != AV_NOPTS_VALUE)
pkt.dts *= ist->ts_scale;
if (debug_ts) {
av_log(NULL, AV_LOG_INFO, "demuxer -> ist_index:%d type:%s "
"next_dts:%s next_dts_time:%s next_pts:%s next_pts_time:%s pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s off:%"PRId64"\n",
ifile->ist_index + pkt.stream_index, av_get_media_type_string(ist->st->codec->codec_type),
av_ts2str(ist->next_dts), av_ts2timestr(ist->next_dts, &AV_TIME_BASE_Q),
av_ts2str(ist->next_pts), av_ts2timestr(ist->next_pts, &AV_TIME_BASE_Q),
av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &ist->st->time_base),
av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &ist->st->time_base),
input_files[ist->VAR_3]->ts_offset);
}
if (pkt.dts != AV_NOPTS_VALUE && ist->next_dts != AV_NOPTS_VALUE &&
!copy_ts) {
int64_t pkt_dts = av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q);
int64_t delta = pkt_dts - ist->next_dts;
if (is->iformat->flags & AVFMT_TS_DISCONT) {
if(delta < -1LL*dts_delta_threshold*AV_TIME_BASE ||
(delta > 1LL*dts_delta_threshold*AV_TIME_BASE &&
ist->st->codec->codec_type != AVMEDIA_TYPE_SUBTITLE) ||
pkt_dts+1<ist->pts){
ifile->ts_offset -= delta;
av_log(NULL, AV_LOG_DEBUG,
"timestamp discontinuity %"PRId64", new offset= %"PRId64"\n",
delta, ifile->ts_offset);
pkt.dts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);
if (pkt.pts != AV_NOPTS_VALUE)
pkt.pts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);
}
} else {
if ( delta < -1LL*dts_error_threshold*AV_TIME_BASE ||
(delta > 1LL*dts_error_threshold*AV_TIME_BASE && ist->st->codec->codec_type != AVMEDIA_TYPE_SUBTITLE) ||
pkt_dts+1<ist->pts){
av_log(NULL, AV_LOG_WARNING, "DTS %"PRId64", next:%"PRId64" st:%d invalid dropping\n", pkt.dts, ist->next_dts, pkt.stream_index);
pkt.dts = AV_NOPTS_VALUE;
}
if (pkt.pts != AV_NOPTS_VALUE){
int64_t pkt_pts = av_rescale_q(pkt.pts, ist->st->time_base, AV_TIME_BASE_Q);
delta = pkt_pts - ist->next_dts;
if ( delta < -1LL*dts_error_threshold*AV_TIME_BASE ||
(delta > 1LL*dts_error_threshold*AV_TIME_BASE && ist->st->codec->codec_type != AVMEDIA_TYPE_SUBTITLE) ||
pkt_pts+1<ist->pts) {
av_log(NULL, AV_LOG_WARNING, "PTS %"PRId64", next:%"PRId64" invalid dropping st:%d\n", pkt.pts, ist->next_dts, pkt.stream_index);
pkt.pts = AV_NOPTS_VALUE;
}
}
}
}
sub2video_heartbeat(ist, pkt.pts);
if ((VAR_0 = output_packet(ist, &pkt)) < 0 ||
((VAR_0 = poll_filters()) < 0 && VAR_0 != AVERROR_EOF)) {
char VAR_4[128];
av_strerror(VAR_0, VAR_4, sizeof(VAR_4));
av_log(NULL, AV_LOG_ERROR, "Error while decoding stream #%d:%d: %s\n",
ist->VAR_3, ist->st->index, VAR_4);
if (exit_on_error)
exit_program(1);
av_free_packet(&pkt);
return AVERROR(EAGAIN);
}
discard_packet:
av_free_packet(&pkt);
return 0;
}
|
[
"static int FUNC_0(void)\n{",
"InputFile *ifile;",
"AVFormatContext *is;",
"InputStream *ist;",
"AVPacket pkt;",
"int VAR_0, VAR_1, VAR_2;",
"int VAR_3;",
"VAR_3 = select_input_file();",
"if (VAR_3 == -2) {",
"poll_filters() ;",
"return AVERROR(EAGAIN);",
"}",
"if (VAR_3 < 0) {",
"if (got_eagain()) {",
"reset_eagain();",
"av_usleep(10000);",
"return AVERROR(EAGAIN);",
"}",
"av_log(NULL, AV_LOG_VERBOSE, \"No more inputs to read from, finishing.\\n\");",
"return AVERROR_EOF;",
"}",
"ifile = input_files[VAR_3];",
"is = ifile->ctx;",
"VAR_0 = get_input_packet(ifile, &pkt);",
"if (VAR_0 == AVERROR(EAGAIN)) {",
"ifile->eagain = 1;",
"return VAR_0;",
"}",
"if (VAR_0 < 0) {",
"if (VAR_0 != AVERROR_EOF) {",
"print_error(is->filename, VAR_0);",
"if (exit_on_error)\nexit_program(1);",
"}",
"ifile->eof_reached = 1;",
"for (VAR_1 = 0; VAR_1 < ifile->nb_streams; VAR_1++) {",
"ist = input_streams[ifile->ist_index + VAR_1];",
"if (ist->decoding_needed)\noutput_packet(ist, NULL);",
"poll_filters();",
"}",
"if (opt_shortest)\nreturn AVERROR_EOF;",
"else\nreturn AVERROR(EAGAIN);",
"}",
"reset_eagain();",
"if (do_pkt_dump) {",
"av_pkt_dump_log2(NULL, AV_LOG_DEBUG, &pkt, do_hex_dump,\nis->streams[pkt.stream_index]);",
"}",
"if (pkt.stream_index >= ifile->nb_streams) {",
"report_new_stream(VAR_3, &pkt);",
"goto discard_packet;",
"}",
"ist = input_streams[ifile->ist_index + pkt.stream_index];",
"if (ist->discard)\ngoto discard_packet;",
"if(!ist->wrap_correction_done && input_files[VAR_3]->ctx->start_time != AV_NOPTS_VALUE && ist->st->pts_wrap_bits < 64){",
"uint64_t stime = av_rescale_q(input_files[VAR_3]->ctx->start_time, AV_TIME_BASE_Q, ist->st->time_base);",
"uint64_t stime2= stime + (1LL<<ist->st->pts_wrap_bits);",
"ist->wrap_correction_done = 1;",
"if(pkt.dts != AV_NOPTS_VALUE && pkt.dts > stime && pkt.dts - stime > stime2 - pkt.dts) {",
"pkt.dts -= 1LL<<ist->st->pts_wrap_bits;",
"ist->wrap_correction_done = 0;",
"}",
"if(pkt.pts != AV_NOPTS_VALUE && pkt.pts > stime && pkt.pts - stime > stime2 - pkt.pts) {",
"pkt.pts -= 1LL<<ist->st->pts_wrap_bits;",
"ist->wrap_correction_done = 0;",
"}",
"}",
"if (pkt.dts != AV_NOPTS_VALUE)\npkt.dts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base);",
"if (pkt.pts != AV_NOPTS_VALUE)\npkt.pts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base);",
"if (pkt.pts != AV_NOPTS_VALUE)\npkt.pts *= ist->ts_scale;",
"if (pkt.dts != AV_NOPTS_VALUE)\npkt.dts *= ist->ts_scale;",
"if (debug_ts) {",
"av_log(NULL, AV_LOG_INFO, \"demuxer -> ist_index:%d type:%s \"\n\"next_dts:%s next_dts_time:%s next_pts:%s next_pts_time:%s pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s off:%\"PRId64\"\\n\",\nifile->ist_index + pkt.stream_index, av_get_media_type_string(ist->st->codec->codec_type),\nav_ts2str(ist->next_dts), av_ts2timestr(ist->next_dts, &AV_TIME_BASE_Q),\nav_ts2str(ist->next_pts), av_ts2timestr(ist->next_pts, &AV_TIME_BASE_Q),\nav_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &ist->st->time_base),\nav_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &ist->st->time_base),\ninput_files[ist->VAR_3]->ts_offset);",
"}",
"if (pkt.dts != AV_NOPTS_VALUE && ist->next_dts != AV_NOPTS_VALUE &&\n!copy_ts) {",
"int64_t pkt_dts = av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q);",
"int64_t delta = pkt_dts - ist->next_dts;",
"if (is->iformat->flags & AVFMT_TS_DISCONT) {",
"if(delta < -1LL*dts_delta_threshold*AV_TIME_BASE ||\n(delta > 1LL*dts_delta_threshold*AV_TIME_BASE &&\nist->st->codec->codec_type != AVMEDIA_TYPE_SUBTITLE) ||\npkt_dts+1<ist->pts){",
"ifile->ts_offset -= delta;",
"av_log(NULL, AV_LOG_DEBUG,\n\"timestamp discontinuity %\"PRId64\", new offset= %\"PRId64\"\\n\",\ndelta, ifile->ts_offset);",
"pkt.dts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);",
"if (pkt.pts != AV_NOPTS_VALUE)\npkt.pts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);",
"}",
"} else {",
"if ( delta < -1LL*dts_error_threshold*AV_TIME_BASE ||\n(delta > 1LL*dts_error_threshold*AV_TIME_BASE && ist->st->codec->codec_type != AVMEDIA_TYPE_SUBTITLE) ||\npkt_dts+1<ist->pts){",
"av_log(NULL, AV_LOG_WARNING, \"DTS %\"PRId64\", next:%\"PRId64\" st:%d invalid dropping\\n\", pkt.dts, ist->next_dts, pkt.stream_index);",
"pkt.dts = AV_NOPTS_VALUE;",
"}",
"if (pkt.pts != AV_NOPTS_VALUE){",
"int64_t pkt_pts = av_rescale_q(pkt.pts, ist->st->time_base, AV_TIME_BASE_Q);",
"delta = pkt_pts - ist->next_dts;",
"if ( delta < -1LL*dts_error_threshold*AV_TIME_BASE ||\n(delta > 1LL*dts_error_threshold*AV_TIME_BASE && ist->st->codec->codec_type != AVMEDIA_TYPE_SUBTITLE) ||\npkt_pts+1<ist->pts) {",
"av_log(NULL, AV_LOG_WARNING, \"PTS %\"PRId64\", next:%\"PRId64\" invalid dropping st:%d\\n\", pkt.pts, ist->next_dts, pkt.stream_index);",
"pkt.pts = AV_NOPTS_VALUE;",
"}",
"}",
"}",
"}",
"sub2video_heartbeat(ist, pkt.pts);",
"if ((VAR_0 = output_packet(ist, &pkt)) < 0 ||\n((VAR_0 = poll_filters()) < 0 && VAR_0 != AVERROR_EOF)) {",
"char VAR_4[128];",
"av_strerror(VAR_0, VAR_4, sizeof(VAR_4));",
"av_log(NULL, AV_LOG_ERROR, \"Error while decoding stream #%d:%d: %s\\n\",\nist->VAR_3, ist->st->index, VAR_4);",
"if (exit_on_error)\nexit_program(1);",
"av_free_packet(&pkt);",
"return AVERROR(EAGAIN);",
"}",
"discard_packet:\nav_free_packet(&pkt);",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
21
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
55
],
[
57
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75,
77
],
[
79
],
[
81
],
[
85
],
[
87
],
[
89,
91
],
[
93
],
[
95
],
[
99,
101
],
[
103,
105
],
[
107
],
[
111
],
[
115
],
[
117,
119
],
[
121
],
[
127
],
[
129
],
[
131
],
[
133
],
[
137
],
[
139,
141
],
[
145
],
[
147
],
[
149
],
[
151
],
[
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165
],
[
167
],
[
169
],
[
173,
175
],
[
177,
179
],
[
183,
185
],
[
187,
189
],
[
193
],
[
195,
197,
199,
201,
203,
205,
207,
209
],
[
211
],
[
215,
217
],
[
219
],
[
221
],
[
223
],
[
225,
227,
229,
231
],
[
233
],
[
235,
237,
239
],
[
241
],
[
243,
245
],
[
247
],
[
249
],
[
251,
253,
255
],
[
257
],
[
259
],
[
261
],
[
263
],
[
265
],
[
267
],
[
269,
271,
273
],
[
275
],
[
277
],
[
279
],
[
281
],
[
283
],
[
285
],
[
289
],
[
293,
295
],
[
297
],
[
299
],
[
301,
303
],
[
305,
307
],
[
309
],
[
311
],
[
313
],
[
317,
319
],
[
323
],
[
325
]
] |
7,320 |
static inline void gen_intermediate_code_internal(AlphaCPU *cpu,
TranslationBlock *tb,
bool search_pc)
{
CPUState *cs = CPU(cpu);
CPUAlphaState *env = &cpu->env;
DisasContext ctx, *ctxp = &ctx;
target_ulong pc_start;
target_ulong pc_mask;
uint32_t insn;
uint16_t *gen_opc_end;
CPUBreakpoint *bp;
int j, lj = -1;
ExitStatus ret;
int num_insns;
int max_insns;
pc_start = tb->pc;
gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;
ctx.tb = tb;
ctx.pc = pc_start;
ctx.mem_idx = cpu_mmu_index(env);
ctx.implver = env->implver;
ctx.singlestep_enabled = cs->singlestep_enabled;
/* ??? Every TB begins with unset rounding mode, to be initialized on
the first fp insn of the TB. Alternately we could define a proper
default for every TB (e.g. QUAL_RM_N or QUAL_RM_D) and make sure
to reset the FP_STATUS to that default at the end of any TB that
changes the default. We could even (gasp) dynamiclly figure out
what default would be most efficient given the running program. */
ctx.tb_rm = -1;
/* Similarly for flush-to-zero. */
ctx.tb_ftz = -1;
num_insns = 0;
max_insns = tb->cflags & CF_COUNT_MASK;
if (max_insns == 0) {
max_insns = CF_COUNT_MASK;
}
if (in_superpage(&ctx, pc_start)) {
pc_mask = (1ULL << 41) - 1;
} else {
pc_mask = ~TARGET_PAGE_MASK;
}
gen_tb_start();
do {
if (unlikely(!QTAILQ_EMPTY(&cs->breakpoints))) {
QTAILQ_FOREACH(bp, &cs->breakpoints, entry) {
if (bp->pc == ctx.pc) {
gen_excp(&ctx, EXCP_DEBUG, 0);
break;
}
}
}
if (search_pc) {
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
if (lj < j) {
lj++;
while (lj < j)
tcg_ctx.gen_opc_instr_start[lj++] = 0;
}
tcg_ctx.gen_opc_pc[lj] = ctx.pc;
tcg_ctx.gen_opc_instr_start[lj] = 1;
tcg_ctx.gen_opc_icount[lj] = num_insns;
}
if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO)) {
gen_io_start();
}
insn = cpu_ldl_code(env, ctx.pc);
num_insns++;
if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP | CPU_LOG_TB_OP_OPT))) {
tcg_gen_debug_insn_start(ctx.pc);
}
TCGV_UNUSED_I64(ctx.zero);
TCGV_UNUSED_I64(ctx.sink);
TCGV_UNUSED_I64(ctx.lit);
ctx.pc += 4;
ret = translate_one(ctxp, insn);
if (!TCGV_IS_UNUSED_I64(ctx.sink)) {
tcg_gen_discard_i64(ctx.sink);
tcg_temp_free(ctx.sink);
}
if (!TCGV_IS_UNUSED_I64(ctx.zero)) {
tcg_temp_free(ctx.zero);
}
if (!TCGV_IS_UNUSED_I64(ctx.lit)) {
tcg_temp_free(ctx.lit);
}
/* If we reach a page boundary, are single stepping,
or exhaust instruction count, stop generation. */
if (ret == NO_EXIT
&& ((ctx.pc & pc_mask) == 0
|| tcg_ctx.gen_opc_ptr >= gen_opc_end
|| num_insns >= max_insns
|| singlestep
|| ctx.singlestep_enabled)) {
ret = EXIT_PC_STALE;
}
} while (ret == NO_EXIT);
if (tb->cflags & CF_LAST_IO) {
gen_io_end();
}
switch (ret) {
case EXIT_GOTO_TB:
case EXIT_NORETURN:
break;
case EXIT_PC_STALE:
tcg_gen_movi_i64(cpu_pc, ctx.pc);
/* FALLTHRU */
case EXIT_PC_UPDATED:
if (ctx.singlestep_enabled) {
gen_excp_1(EXCP_DEBUG, 0);
} else {
tcg_gen_exit_tb(0);
}
break;
default:
abort();
}
gen_tb_end(tb, num_insns);
*tcg_ctx.gen_opc_ptr = INDEX_op_end;
if (search_pc) {
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
lj++;
while (lj <= j)
tcg_ctx.gen_opc_instr_start[lj++] = 0;
} else {
tb->size = ctx.pc - pc_start;
tb->icount = num_insns;
}
#ifdef DEBUG_DISAS
if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) {
qemu_log("IN: %s\n", lookup_symbol(pc_start));
log_target_disas(env, pc_start, ctx.pc - pc_start, 1);
qemu_log("\n");
}
#endif
}
| false |
qemu
|
cd42d5b23691ad73edfd6dbcfc935a960a9c5a65
|
static inline void gen_intermediate_code_internal(AlphaCPU *cpu,
TranslationBlock *tb,
bool search_pc)
{
CPUState *cs = CPU(cpu);
CPUAlphaState *env = &cpu->env;
DisasContext ctx, *ctxp = &ctx;
target_ulong pc_start;
target_ulong pc_mask;
uint32_t insn;
uint16_t *gen_opc_end;
CPUBreakpoint *bp;
int j, lj = -1;
ExitStatus ret;
int num_insns;
int max_insns;
pc_start = tb->pc;
gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;
ctx.tb = tb;
ctx.pc = pc_start;
ctx.mem_idx = cpu_mmu_index(env);
ctx.implver = env->implver;
ctx.singlestep_enabled = cs->singlestep_enabled;
ctx.tb_rm = -1;
ctx.tb_ftz = -1;
num_insns = 0;
max_insns = tb->cflags & CF_COUNT_MASK;
if (max_insns == 0) {
max_insns = CF_COUNT_MASK;
}
if (in_superpage(&ctx, pc_start)) {
pc_mask = (1ULL << 41) - 1;
} else {
pc_mask = ~TARGET_PAGE_MASK;
}
gen_tb_start();
do {
if (unlikely(!QTAILQ_EMPTY(&cs->breakpoints))) {
QTAILQ_FOREACH(bp, &cs->breakpoints, entry) {
if (bp->pc == ctx.pc) {
gen_excp(&ctx, EXCP_DEBUG, 0);
break;
}
}
}
if (search_pc) {
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
if (lj < j) {
lj++;
while (lj < j)
tcg_ctx.gen_opc_instr_start[lj++] = 0;
}
tcg_ctx.gen_opc_pc[lj] = ctx.pc;
tcg_ctx.gen_opc_instr_start[lj] = 1;
tcg_ctx.gen_opc_icount[lj] = num_insns;
}
if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO)) {
gen_io_start();
}
insn = cpu_ldl_code(env, ctx.pc);
num_insns++;
if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP | CPU_LOG_TB_OP_OPT))) {
tcg_gen_debug_insn_start(ctx.pc);
}
TCGV_UNUSED_I64(ctx.zero);
TCGV_UNUSED_I64(ctx.sink);
TCGV_UNUSED_I64(ctx.lit);
ctx.pc += 4;
ret = translate_one(ctxp, insn);
if (!TCGV_IS_UNUSED_I64(ctx.sink)) {
tcg_gen_discard_i64(ctx.sink);
tcg_temp_free(ctx.sink);
}
if (!TCGV_IS_UNUSED_I64(ctx.zero)) {
tcg_temp_free(ctx.zero);
}
if (!TCGV_IS_UNUSED_I64(ctx.lit)) {
tcg_temp_free(ctx.lit);
}
if (ret == NO_EXIT
&& ((ctx.pc & pc_mask) == 0
|| tcg_ctx.gen_opc_ptr >= gen_opc_end
|| num_insns >= max_insns
|| singlestep
|| ctx.singlestep_enabled)) {
ret = EXIT_PC_STALE;
}
} while (ret == NO_EXIT);
if (tb->cflags & CF_LAST_IO) {
gen_io_end();
}
switch (ret) {
case EXIT_GOTO_TB:
case EXIT_NORETURN:
break;
case EXIT_PC_STALE:
tcg_gen_movi_i64(cpu_pc, ctx.pc);
case EXIT_PC_UPDATED:
if (ctx.singlestep_enabled) {
gen_excp_1(EXCP_DEBUG, 0);
} else {
tcg_gen_exit_tb(0);
}
break;
default:
abort();
}
gen_tb_end(tb, num_insns);
*tcg_ctx.gen_opc_ptr = INDEX_op_end;
if (search_pc) {
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
lj++;
while (lj <= j)
tcg_ctx.gen_opc_instr_start[lj++] = 0;
} else {
tb->size = ctx.pc - pc_start;
tb->icount = num_insns;
}
#ifdef DEBUG_DISAS
if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) {
qemu_log("IN: %s\n", lookup_symbol(pc_start));
log_target_disas(env, pc_start, ctx.pc - pc_start, 1);
qemu_log("\n");
}
#endif
}
|
{
"code": [],
"line_no": []
}
|
static inline void FUNC_0(AlphaCPU *VAR_0,
TranslationBlock *VAR_1,
bool VAR_2)
{
CPUState *cs = CPU(VAR_0);
CPUAlphaState *env = &VAR_0->env;
DisasContext ctx, *ctxp = &ctx;
target_ulong pc_start;
target_ulong pc_mask;
uint32_t insn;
uint16_t *gen_opc_end;
CPUBreakpoint *bp;
int VAR_3, VAR_4 = -1;
ExitStatus ret;
int VAR_5;
int VAR_6;
pc_start = VAR_1->pc;
gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;
ctx.VAR_1 = VAR_1;
ctx.pc = pc_start;
ctx.mem_idx = cpu_mmu_index(env);
ctx.implver = env->implver;
ctx.singlestep_enabled = cs->singlestep_enabled;
ctx.tb_rm = -1;
ctx.tb_ftz = -1;
VAR_5 = 0;
VAR_6 = VAR_1->cflags & CF_COUNT_MASK;
if (VAR_6 == 0) {
VAR_6 = CF_COUNT_MASK;
}
if (in_superpage(&ctx, pc_start)) {
pc_mask = (1ULL << 41) - 1;
} else {
pc_mask = ~TARGET_PAGE_MASK;
}
gen_tb_start();
do {
if (unlikely(!QTAILQ_EMPTY(&cs->breakpoints))) {
QTAILQ_FOREACH(bp, &cs->breakpoints, entry) {
if (bp->pc == ctx.pc) {
gen_excp(&ctx, EXCP_DEBUG, 0);
break;
}
}
}
if (VAR_2) {
VAR_3 = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
if (VAR_4 < VAR_3) {
VAR_4++;
while (VAR_4 < VAR_3)
tcg_ctx.gen_opc_instr_start[VAR_4++] = 0;
}
tcg_ctx.gen_opc_pc[VAR_4] = ctx.pc;
tcg_ctx.gen_opc_instr_start[VAR_4] = 1;
tcg_ctx.gen_opc_icount[VAR_4] = VAR_5;
}
if (VAR_5 + 1 == VAR_6 && (VAR_1->cflags & CF_LAST_IO)) {
gen_io_start();
}
insn = cpu_ldl_code(env, ctx.pc);
VAR_5++;
if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP | CPU_LOG_TB_OP_OPT))) {
tcg_gen_debug_insn_start(ctx.pc);
}
TCGV_UNUSED_I64(ctx.zero);
TCGV_UNUSED_I64(ctx.sink);
TCGV_UNUSED_I64(ctx.lit);
ctx.pc += 4;
ret = translate_one(ctxp, insn);
if (!TCGV_IS_UNUSED_I64(ctx.sink)) {
tcg_gen_discard_i64(ctx.sink);
tcg_temp_free(ctx.sink);
}
if (!TCGV_IS_UNUSED_I64(ctx.zero)) {
tcg_temp_free(ctx.zero);
}
if (!TCGV_IS_UNUSED_I64(ctx.lit)) {
tcg_temp_free(ctx.lit);
}
if (ret == NO_EXIT
&& ((ctx.pc & pc_mask) == 0
|| tcg_ctx.gen_opc_ptr >= gen_opc_end
|| VAR_5 >= VAR_6
|| singlestep
|| ctx.singlestep_enabled)) {
ret = EXIT_PC_STALE;
}
} while (ret == NO_EXIT);
if (VAR_1->cflags & CF_LAST_IO) {
gen_io_end();
}
switch (ret) {
case EXIT_GOTO_TB:
case EXIT_NORETURN:
break;
case EXIT_PC_STALE:
tcg_gen_movi_i64(cpu_pc, ctx.pc);
case EXIT_PC_UPDATED:
if (ctx.singlestep_enabled) {
gen_excp_1(EXCP_DEBUG, 0);
} else {
tcg_gen_exit_tb(0);
}
break;
default:
abort();
}
gen_tb_end(VAR_1, VAR_5);
*tcg_ctx.gen_opc_ptr = INDEX_op_end;
if (VAR_2) {
VAR_3 = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
VAR_4++;
while (VAR_4 <= VAR_3)
tcg_ctx.gen_opc_instr_start[VAR_4++] = 0;
} else {
VAR_1->size = ctx.pc - pc_start;
VAR_1->icount = VAR_5;
}
#ifdef DEBUG_DISAS
if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) {
qemu_log("IN: %s\n", lookup_symbol(pc_start));
log_target_disas(env, pc_start, ctx.pc - pc_start, 1);
qemu_log("\n");
}
#endif
}
|
[
"static inline void FUNC_0(AlphaCPU *VAR_0,\nTranslationBlock *VAR_1,\nbool VAR_2)\n{",
"CPUState *cs = CPU(VAR_0);",
"CPUAlphaState *env = &VAR_0->env;",
"DisasContext ctx, *ctxp = &ctx;",
"target_ulong pc_start;",
"target_ulong pc_mask;",
"uint32_t insn;",
"uint16_t *gen_opc_end;",
"CPUBreakpoint *bp;",
"int VAR_3, VAR_4 = -1;",
"ExitStatus ret;",
"int VAR_5;",
"int VAR_6;",
"pc_start = VAR_1->pc;",
"gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;",
"ctx.VAR_1 = VAR_1;",
"ctx.pc = pc_start;",
"ctx.mem_idx = cpu_mmu_index(env);",
"ctx.implver = env->implver;",
"ctx.singlestep_enabled = cs->singlestep_enabled;",
"ctx.tb_rm = -1;",
"ctx.tb_ftz = -1;",
"VAR_5 = 0;",
"VAR_6 = VAR_1->cflags & CF_COUNT_MASK;",
"if (VAR_6 == 0) {",
"VAR_6 = CF_COUNT_MASK;",
"}",
"if (in_superpage(&ctx, pc_start)) {",
"pc_mask = (1ULL << 41) - 1;",
"} else {",
"pc_mask = ~TARGET_PAGE_MASK;",
"}",
"gen_tb_start();",
"do {",
"if (unlikely(!QTAILQ_EMPTY(&cs->breakpoints))) {",
"QTAILQ_FOREACH(bp, &cs->breakpoints, entry) {",
"if (bp->pc == ctx.pc) {",
"gen_excp(&ctx, EXCP_DEBUG, 0);",
"break;",
"}",
"}",
"}",
"if (VAR_2) {",
"VAR_3 = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;",
"if (VAR_4 < VAR_3) {",
"VAR_4++;",
"while (VAR_4 < VAR_3)\ntcg_ctx.gen_opc_instr_start[VAR_4++] = 0;",
"}",
"tcg_ctx.gen_opc_pc[VAR_4] = ctx.pc;",
"tcg_ctx.gen_opc_instr_start[VAR_4] = 1;",
"tcg_ctx.gen_opc_icount[VAR_4] = VAR_5;",
"}",
"if (VAR_5 + 1 == VAR_6 && (VAR_1->cflags & CF_LAST_IO)) {",
"gen_io_start();",
"}",
"insn = cpu_ldl_code(env, ctx.pc);",
"VAR_5++;",
"if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP | CPU_LOG_TB_OP_OPT))) {",
"tcg_gen_debug_insn_start(ctx.pc);",
"}",
"TCGV_UNUSED_I64(ctx.zero);",
"TCGV_UNUSED_I64(ctx.sink);",
"TCGV_UNUSED_I64(ctx.lit);",
"ctx.pc += 4;",
"ret = translate_one(ctxp, insn);",
"if (!TCGV_IS_UNUSED_I64(ctx.sink)) {",
"tcg_gen_discard_i64(ctx.sink);",
"tcg_temp_free(ctx.sink);",
"}",
"if (!TCGV_IS_UNUSED_I64(ctx.zero)) {",
"tcg_temp_free(ctx.zero);",
"}",
"if (!TCGV_IS_UNUSED_I64(ctx.lit)) {",
"tcg_temp_free(ctx.lit);",
"}",
"if (ret == NO_EXIT\n&& ((ctx.pc & pc_mask) == 0\n|| tcg_ctx.gen_opc_ptr >= gen_opc_end\n|| VAR_5 >= VAR_6\n|| singlestep\n|| ctx.singlestep_enabled)) {",
"ret = EXIT_PC_STALE;",
"}",
"} while (ret == NO_EXIT);",
"if (VAR_1->cflags & CF_LAST_IO) {",
"gen_io_end();",
"}",
"switch (ret) {",
"case EXIT_GOTO_TB:\ncase EXIT_NORETURN:\nbreak;",
"case EXIT_PC_STALE:\ntcg_gen_movi_i64(cpu_pc, ctx.pc);",
"case EXIT_PC_UPDATED:\nif (ctx.singlestep_enabled) {",
"gen_excp_1(EXCP_DEBUG, 0);",
"} else {",
"tcg_gen_exit_tb(0);",
"}",
"break;",
"default:\nabort();",
"}",
"gen_tb_end(VAR_1, VAR_5);",
"*tcg_ctx.gen_opc_ptr = INDEX_op_end;",
"if (VAR_2) {",
"VAR_3 = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;",
"VAR_4++;",
"while (VAR_4 <= VAR_3)\ntcg_ctx.gen_opc_instr_start[VAR_4++] = 0;",
"} else {",
"VAR_1->size = ctx.pc - pc_start;",
"VAR_1->icount = VAR_5;",
"}",
"#ifdef DEBUG_DISAS\nif (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) {",
"qemu_log(\"IN: %s\\n\", lookup_symbol(pc_start));",
"log_target_disas(env, pc_start, ctx.pc - pc_start, 1);",
"qemu_log(\"\\n\");",
"}",
"#endif\n}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5,
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
35
],
[
37
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
65
],
[
69
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125,
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
151
],
[
153
],
[
155
],
[
159
],
[
161
],
[
163
],
[
167
],
[
169
],
[
173
],
[
175
],
[
177
],
[
179
],
[
181
],
[
183
],
[
185
],
[
187
],
[
189
],
[
191
],
[
199,
201,
203,
205,
207,
209
],
[
211
],
[
213
],
[
215
],
[
219
],
[
221
],
[
223
],
[
227
],
[
229,
231,
233
],
[
235,
237
],
[
241,
243
],
[
245
],
[
247
],
[
249
],
[
251
],
[
253
],
[
255,
257
],
[
259
],
[
263
],
[
265
],
[
267
],
[
269
],
[
271
],
[
273,
275
],
[
277
],
[
279
],
[
281
],
[
283
],
[
287,
289
],
[
291
],
[
293
],
[
295
],
[
297
],
[
299,
301
]
] |
7,321 |
uint64_t helper_fctiwz(CPUPPCState *env, uint64_t arg)
{
CPU_DoubleU farg;
farg.ll = arg;
if (unlikely(float64_is_signaling_nan(farg.d))) {
/* sNaN conversion */
farg.ll = fload_invalid_op_excp(env, POWERPC_EXCP_FP_VXSNAN |
POWERPC_EXCP_FP_VXCVI);
} else if (unlikely(float64_is_quiet_nan(farg.d) ||
float64_is_infinity(farg.d))) {
/* qNan / infinity conversion */
farg.ll = fload_invalid_op_excp(env, POWERPC_EXCP_FP_VXCVI);
} else {
farg.ll = float64_to_int32_round_to_zero(farg.d, &env->fp_status);
/* XXX: higher bits are not supposed to be significant.
* to make tests easier, return the same as a real PowerPC 750
*/
farg.ll |= 0xFFF80000ULL << 32;
}
return farg.ll;
}
| false |
qemu
|
59800ec8e52bcfa271fa61fb0aae19205ef1b7f1
|
uint64_t helper_fctiwz(CPUPPCState *env, uint64_t arg)
{
CPU_DoubleU farg;
farg.ll = arg;
if (unlikely(float64_is_signaling_nan(farg.d))) {
farg.ll = fload_invalid_op_excp(env, POWERPC_EXCP_FP_VXSNAN |
POWERPC_EXCP_FP_VXCVI);
} else if (unlikely(float64_is_quiet_nan(farg.d) ||
float64_is_infinity(farg.d))) {
farg.ll = fload_invalid_op_excp(env, POWERPC_EXCP_FP_VXCVI);
} else {
farg.ll = float64_to_int32_round_to_zero(farg.d, &env->fp_status);
farg.ll |= 0xFFF80000ULL << 32;
}
return farg.ll;
}
|
{
"code": [],
"line_no": []
}
|
uint64_t FUNC_0(CPUPPCState *env, uint64_t arg)
{
CPU_DoubleU farg;
farg.ll = arg;
if (unlikely(float64_is_signaling_nan(farg.d))) {
farg.ll = fload_invalid_op_excp(env, POWERPC_EXCP_FP_VXSNAN |
POWERPC_EXCP_FP_VXCVI);
} else if (unlikely(float64_is_quiet_nan(farg.d) ||
float64_is_infinity(farg.d))) {
farg.ll = fload_invalid_op_excp(env, POWERPC_EXCP_FP_VXCVI);
} else {
farg.ll = float64_to_int32_round_to_zero(farg.d, &env->fp_status);
farg.ll |= 0xFFF80000ULL << 32;
}
return farg.ll;
}
|
[
"uint64_t FUNC_0(CPUPPCState *env, uint64_t arg)\n{",
"CPU_DoubleU farg;",
"farg.ll = arg;",
"if (unlikely(float64_is_signaling_nan(farg.d))) {",
"farg.ll = fload_invalid_op_excp(env, POWERPC_EXCP_FP_VXSNAN |\nPOWERPC_EXCP_FP_VXCVI);",
"} else if (unlikely(float64_is_quiet_nan(farg.d) ||",
"float64_is_infinity(farg.d))) {",
"farg.ll = fload_invalid_op_excp(env, POWERPC_EXCP_FP_VXCVI);",
"} else {",
"farg.ll = float64_to_int32_round_to_zero(farg.d, &env->fp_status);",
"farg.ll |= 0xFFF80000ULL << 32;",
"}",
"return farg.ll;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
9
],
[
13
],
[
17,
19
],
[
21
],
[
23
],
[
27
],
[
29
],
[
31
],
[
39
],
[
41
],
[
43
],
[
45
]
] |
7,323 |
POWERPC_FAMILY(POWER8E)(ObjectClass *oc, void *data)
{
DeviceClass *dc = DEVICE_CLASS(oc);
PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
dc->fw_name = "PowerPC,POWER8";
dc->desc = "POWER8E";
dc->props = powerpc_servercpu_properties;
pcc->pvr_match = ppc_pvr_match_power8;
pcc->pcr_mask = PCR_COMPAT_2_05 | PCR_COMPAT_2_06;
pcc->init_proc = init_proc_POWER8;
pcc->check_pow = check_pow_nocheck;
pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_STRING | PPC_MFTB |
PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
PPC_FLOAT_FRSQRTES |
PPC_FLOAT_STFIWX |
PPC_FLOAT_EXT |
PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
PPC_MEM_SYNC | PPC_MEM_EIEIO |
PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
PPC_64B | PPC_64BX | PPC_ALTIVEC |
PPC_SEGMENT_64B | PPC_SLBI |
PPC_POPCNTB | PPC_POPCNTWD;
pcc->insns_flags2 = PPC2_VSX | PPC2_VSX207 | PPC2_DFP | PPC2_DBRX |
PPC2_PERM_ISA206 | PPC2_DIVE_ISA206 |
PPC2_ATOMIC_ISA206 | PPC2_FP_CVT_ISA206 |
PPC2_FP_TST_ISA206 | PPC2_BCTAR_ISA207 |
PPC2_LSQ_ISA207 | PPC2_ALTIVEC_207 |
PPC2_ISA205 | PPC2_ISA207S;
pcc->msr_mask = (1ull << MSR_SF) |
(1ull << MSR_TM) |
(1ull << MSR_VR) |
(1ull << MSR_VSX) |
(1ull << MSR_EE) |
(1ull << MSR_PR) |
(1ull << MSR_FP) |
(1ull << MSR_ME) |
(1ull << MSR_FE0) |
(1ull << MSR_SE) |
(1ull << MSR_DE) |
(1ull << MSR_FE1) |
(1ull << MSR_IR) |
(1ull << MSR_DR) |
(1ull << MSR_PMM) |
(1ull << MSR_RI) |
(1ull << MSR_LE);
pcc->mmu_model = POWERPC_MMU_2_06;
#if defined(CONFIG_SOFTMMU)
pcc->handle_mmu_fault = ppc_hash64_handle_mmu_fault;
#endif
pcc->excp_model = POWERPC_EXCP_POWER7;
pcc->bus_model = PPC_FLAGS_INPUT_POWER7;
pcc->bfd_mach = bfd_mach_ppc64;
pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
POWERPC_FLAG_BUS_CLK | POWERPC_FLAG_CFAR |
POWERPC_FLAG_VSX;
pcc->l1_dcache_size = 0x8000;
pcc->l1_icache_size = 0x8000;
pcc->interrupts_big_endian = ppc_cpu_interrupts_big_endian_lpcr;
}
| false |
qemu
|
b60c60070c0df4ef01d5c727929fe0e93e6fdd09
|
POWERPC_FAMILY(POWER8E)(ObjectClass *oc, void *data)
{
DeviceClass *dc = DEVICE_CLASS(oc);
PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
dc->fw_name = "PowerPC,POWER8";
dc->desc = "POWER8E";
dc->props = powerpc_servercpu_properties;
pcc->pvr_match = ppc_pvr_match_power8;
pcc->pcr_mask = PCR_COMPAT_2_05 | PCR_COMPAT_2_06;
pcc->init_proc = init_proc_POWER8;
pcc->check_pow = check_pow_nocheck;
pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_STRING | PPC_MFTB |
PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
PPC_FLOAT_FRSQRTES |
PPC_FLOAT_STFIWX |
PPC_FLOAT_EXT |
PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
PPC_MEM_SYNC | PPC_MEM_EIEIO |
PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
PPC_64B | PPC_64BX | PPC_ALTIVEC |
PPC_SEGMENT_64B | PPC_SLBI |
PPC_POPCNTB | PPC_POPCNTWD;
pcc->insns_flags2 = PPC2_VSX | PPC2_VSX207 | PPC2_DFP | PPC2_DBRX |
PPC2_PERM_ISA206 | PPC2_DIVE_ISA206 |
PPC2_ATOMIC_ISA206 | PPC2_FP_CVT_ISA206 |
PPC2_FP_TST_ISA206 | PPC2_BCTAR_ISA207 |
PPC2_LSQ_ISA207 | PPC2_ALTIVEC_207 |
PPC2_ISA205 | PPC2_ISA207S;
pcc->msr_mask = (1ull << MSR_SF) |
(1ull << MSR_TM) |
(1ull << MSR_VR) |
(1ull << MSR_VSX) |
(1ull << MSR_EE) |
(1ull << MSR_PR) |
(1ull << MSR_FP) |
(1ull << MSR_ME) |
(1ull << MSR_FE0) |
(1ull << MSR_SE) |
(1ull << MSR_DE) |
(1ull << MSR_FE1) |
(1ull << MSR_IR) |
(1ull << MSR_DR) |
(1ull << MSR_PMM) |
(1ull << MSR_RI) |
(1ull << MSR_LE);
pcc->mmu_model = POWERPC_MMU_2_06;
#if defined(CONFIG_SOFTMMU)
pcc->handle_mmu_fault = ppc_hash64_handle_mmu_fault;
#endif
pcc->excp_model = POWERPC_EXCP_POWER7;
pcc->bus_model = PPC_FLAGS_INPUT_POWER7;
pcc->bfd_mach = bfd_mach_ppc64;
pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
POWERPC_FLAG_BUS_CLK | POWERPC_FLAG_CFAR |
POWERPC_FLAG_VSX;
pcc->l1_dcache_size = 0x8000;
pcc->l1_icache_size = 0x8000;
pcc->interrupts_big_endian = ppc_cpu_interrupts_big_endian_lpcr;
}
|
{
"code": [],
"line_no": []
}
|
FUNC_0(POWER8E)(ObjectClass *oc, void *data)
{
DeviceClass *dc = DEVICE_CLASS(oc);
PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
dc->fw_name = "PowerPC,POWER8";
dc->desc = "POWER8E";
dc->props = powerpc_servercpu_properties;
pcc->pvr_match = ppc_pvr_match_power8;
pcc->pcr_mask = PCR_COMPAT_2_05 | PCR_COMPAT_2_06;
pcc->init_proc = init_proc_POWER8;
pcc->check_pow = check_pow_nocheck;
pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_STRING | PPC_MFTB |
PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
PPC_FLOAT_FRSQRTES |
PPC_FLOAT_STFIWX |
PPC_FLOAT_EXT |
PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
PPC_MEM_SYNC | PPC_MEM_EIEIO |
PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
PPC_64B | PPC_64BX | PPC_ALTIVEC |
PPC_SEGMENT_64B | PPC_SLBI |
PPC_POPCNTB | PPC_POPCNTWD;
pcc->insns_flags2 = PPC2_VSX | PPC2_VSX207 | PPC2_DFP | PPC2_DBRX |
PPC2_PERM_ISA206 | PPC2_DIVE_ISA206 |
PPC2_ATOMIC_ISA206 | PPC2_FP_CVT_ISA206 |
PPC2_FP_TST_ISA206 | PPC2_BCTAR_ISA207 |
PPC2_LSQ_ISA207 | PPC2_ALTIVEC_207 |
PPC2_ISA205 | PPC2_ISA207S;
pcc->msr_mask = (1ull << MSR_SF) |
(1ull << MSR_TM) |
(1ull << MSR_VR) |
(1ull << MSR_VSX) |
(1ull << MSR_EE) |
(1ull << MSR_PR) |
(1ull << MSR_FP) |
(1ull << MSR_ME) |
(1ull << MSR_FE0) |
(1ull << MSR_SE) |
(1ull << MSR_DE) |
(1ull << MSR_FE1) |
(1ull << MSR_IR) |
(1ull << MSR_DR) |
(1ull << MSR_PMM) |
(1ull << MSR_RI) |
(1ull << MSR_LE);
pcc->mmu_model = POWERPC_MMU_2_06;
#if defined(CONFIG_SOFTMMU)
pcc->handle_mmu_fault = ppc_hash64_handle_mmu_fault;
#endif
pcc->excp_model = POWERPC_EXCP_POWER7;
pcc->bus_model = PPC_FLAGS_INPUT_POWER7;
pcc->bfd_mach = bfd_mach_ppc64;
pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
POWERPC_FLAG_BUS_CLK | POWERPC_FLAG_CFAR |
POWERPC_FLAG_VSX;
pcc->l1_dcache_size = 0x8000;
pcc->l1_icache_size = 0x8000;
pcc->interrupts_big_endian = ppc_cpu_interrupts_big_endian_lpcr;
}
|
[
"FUNC_0(POWER8E)(ObjectClass *oc, void *data)\n{",
"DeviceClass *dc = DEVICE_CLASS(oc);",
"PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);",
"dc->fw_name = \"PowerPC,POWER8\";",
"dc->desc = \"POWER8E\";",
"dc->props = powerpc_servercpu_properties;",
"pcc->pvr_match = ppc_pvr_match_power8;",
"pcc->pcr_mask = PCR_COMPAT_2_05 | PCR_COMPAT_2_06;",
"pcc->init_proc = init_proc_POWER8;",
"pcc->check_pow = check_pow_nocheck;",
"pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_STRING | PPC_MFTB |\nPPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |\nPPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |\nPPC_FLOAT_FRSQRTES |\nPPC_FLOAT_STFIWX |\nPPC_FLOAT_EXT |\nPPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |\nPPC_MEM_SYNC | PPC_MEM_EIEIO |\nPPC_MEM_TLBIE | PPC_MEM_TLBSYNC |\nPPC_64B | PPC_64BX | PPC_ALTIVEC |\nPPC_SEGMENT_64B | PPC_SLBI |\nPPC_POPCNTB | PPC_POPCNTWD;",
"pcc->insns_flags2 = PPC2_VSX | PPC2_VSX207 | PPC2_DFP | PPC2_DBRX |\nPPC2_PERM_ISA206 | PPC2_DIVE_ISA206 |\nPPC2_ATOMIC_ISA206 | PPC2_FP_CVT_ISA206 |\nPPC2_FP_TST_ISA206 | PPC2_BCTAR_ISA207 |\nPPC2_LSQ_ISA207 | PPC2_ALTIVEC_207 |\nPPC2_ISA205 | PPC2_ISA207S;",
"pcc->msr_mask = (1ull << MSR_SF) |\n(1ull << MSR_TM) |\n(1ull << MSR_VR) |\n(1ull << MSR_VSX) |\n(1ull << MSR_EE) |\n(1ull << MSR_PR) |\n(1ull << MSR_FP) |\n(1ull << MSR_ME) |\n(1ull << MSR_FE0) |\n(1ull << MSR_SE) |\n(1ull << MSR_DE) |\n(1ull << MSR_FE1) |\n(1ull << MSR_IR) |\n(1ull << MSR_DR) |\n(1ull << MSR_PMM) |\n(1ull << MSR_RI) |\n(1ull << MSR_LE);",
"pcc->mmu_model = POWERPC_MMU_2_06;",
"#if defined(CONFIG_SOFTMMU)\npcc->handle_mmu_fault = ppc_hash64_handle_mmu_fault;",
"#endif\npcc->excp_model = POWERPC_EXCP_POWER7;",
"pcc->bus_model = PPC_FLAGS_INPUT_POWER7;",
"pcc->bfd_mach = bfd_mach_ppc64;",
"pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |\nPOWERPC_FLAG_BE | POWERPC_FLAG_PMM |\nPOWERPC_FLAG_BUS_CLK | POWERPC_FLAG_CFAR |\nPOWERPC_FLAG_VSX;",
"pcc->l1_dcache_size = 0x8000;",
"pcc->l1_icache_size = 0x8000;",
"pcc->interrupts_big_endian = ppc_cpu_interrupts_big_endian_lpcr;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25,
27,
29,
31,
33,
35,
37,
39,
41,
43,
45,
47
],
[
49,
51,
53,
55,
57,
59
],
[
61,
63,
65,
67,
69,
71,
73,
75,
77,
79,
81,
83,
85,
87,
89,
91,
93
],
[
95
],
[
97,
99
],
[
101,
103
],
[
105
],
[
107
],
[
109,
111,
113,
115
],
[
117
],
[
119
],
[
121
],
[
123
]
] |
7,328 |
static void patch_instruction(VAPICROMState *s, CPUX86State *env, target_ulong ip)
{
target_phys_addr_t paddr;
VAPICHandlers *handlers;
uint8_t opcode[2];
uint32_t imm32;
if (smp_cpus == 1) {
handlers = &s->rom_state.up;
} else {
handlers = &s->rom_state.mp;
}
pause_all_vcpus();
cpu_memory_rw_debug(env, ip, opcode, sizeof(opcode), 0);
switch (opcode[0]) {
case 0x89: /* mov r32 to r/m32 */
patch_byte(env, ip, 0x50 + modrm_reg(opcode[1])); /* push reg */
patch_call(s, env, ip + 1, handlers->set_tpr);
break;
case 0x8b: /* mov r/m32 to r32 */
patch_byte(env, ip, 0x90);
patch_call(s, env, ip + 1, handlers->get_tpr[modrm_reg(opcode[1])]);
break;
case 0xa1: /* mov abs to eax */
patch_call(s, env, ip, handlers->get_tpr[0]);
break;
case 0xa3: /* mov eax to abs */
patch_call(s, env, ip, handlers->set_tpr_eax);
break;
case 0xc7: /* mov imm32, r/m32 (c7/0) */
patch_byte(env, ip, 0x68); /* push imm32 */
cpu_memory_rw_debug(env, ip + 6, (void *)&imm32, sizeof(imm32), 0);
cpu_memory_rw_debug(env, ip + 1, (void *)&imm32, sizeof(imm32), 1);
patch_call(s, env, ip + 5, handlers->set_tpr);
break;
case 0xff: /* push r/m32 */
patch_byte(env, ip, 0x50); /* push eax */
patch_call(s, env, ip + 1, handlers->get_tpr_stack);
break;
default:
abort();
}
resume_all_vcpus();
paddr = cpu_get_phys_page_debug(env, ip);
paddr += ip & ~TARGET_PAGE_MASK;
tb_invalidate_phys_page_range(paddr, paddr + 1, 1);
}
| false |
qemu
|
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
|
static void patch_instruction(VAPICROMState *s, CPUX86State *env, target_ulong ip)
{
target_phys_addr_t paddr;
VAPICHandlers *handlers;
uint8_t opcode[2];
uint32_t imm32;
if (smp_cpus == 1) {
handlers = &s->rom_state.up;
} else {
handlers = &s->rom_state.mp;
}
pause_all_vcpus();
cpu_memory_rw_debug(env, ip, opcode, sizeof(opcode), 0);
switch (opcode[0]) {
case 0x89:
patch_byte(env, ip, 0x50 + modrm_reg(opcode[1]));
patch_call(s, env, ip + 1, handlers->set_tpr);
break;
case 0x8b:
patch_byte(env, ip, 0x90);
patch_call(s, env, ip + 1, handlers->get_tpr[modrm_reg(opcode[1])]);
break;
case 0xa1:
patch_call(s, env, ip, handlers->get_tpr[0]);
break;
case 0xa3:
patch_call(s, env, ip, handlers->set_tpr_eax);
break;
case 0xc7:
patch_byte(env, ip, 0x68);
cpu_memory_rw_debug(env, ip + 6, (void *)&imm32, sizeof(imm32), 0);
cpu_memory_rw_debug(env, ip + 1, (void *)&imm32, sizeof(imm32), 1);
patch_call(s, env, ip + 5, handlers->set_tpr);
break;
case 0xff:
patch_byte(env, ip, 0x50);
patch_call(s, env, ip + 1, handlers->get_tpr_stack);
break;
default:
abort();
}
resume_all_vcpus();
paddr = cpu_get_phys_page_debug(env, ip);
paddr += ip & ~TARGET_PAGE_MASK;
tb_invalidate_phys_page_range(paddr, paddr + 1, 1);
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(VAPICROMState *VAR_0, CPUX86State *VAR_1, target_ulong VAR_2)
{
target_phys_addr_t paddr;
VAPICHandlers *handlers;
uint8_t opcode[2];
uint32_t imm32;
if (smp_cpus == 1) {
handlers = &VAR_0->rom_state.up;
} else {
handlers = &VAR_0->rom_state.mp;
}
pause_all_vcpus();
cpu_memory_rw_debug(VAR_1, VAR_2, opcode, sizeof(opcode), 0);
switch (opcode[0]) {
case 0x89:
patch_byte(VAR_1, VAR_2, 0x50 + modrm_reg(opcode[1]));
patch_call(VAR_0, VAR_1, VAR_2 + 1, handlers->set_tpr);
break;
case 0x8b:
patch_byte(VAR_1, VAR_2, 0x90);
patch_call(VAR_0, VAR_1, VAR_2 + 1, handlers->get_tpr[modrm_reg(opcode[1])]);
break;
case 0xa1:
patch_call(VAR_0, VAR_1, VAR_2, handlers->get_tpr[0]);
break;
case 0xa3:
patch_call(VAR_0, VAR_1, VAR_2, handlers->set_tpr_eax);
break;
case 0xc7:
patch_byte(VAR_1, VAR_2, 0x68);
cpu_memory_rw_debug(VAR_1, VAR_2 + 6, (void *)&imm32, sizeof(imm32), 0);
cpu_memory_rw_debug(VAR_1, VAR_2 + 1, (void *)&imm32, sizeof(imm32), 1);
patch_call(VAR_0, VAR_1, VAR_2 + 5, handlers->set_tpr);
break;
case 0xff:
patch_byte(VAR_1, VAR_2, 0x50);
patch_call(VAR_0, VAR_1, VAR_2 + 1, handlers->get_tpr_stack);
break;
default:
abort();
}
resume_all_vcpus();
paddr = cpu_get_phys_page_debug(VAR_1, VAR_2);
paddr += VAR_2 & ~TARGET_PAGE_MASK;
tb_invalidate_phys_page_range(paddr, paddr + 1, 1);
}
|
[
"static void FUNC_0(VAPICROMState *VAR_0, CPUX86State *VAR_1, target_ulong VAR_2)\n{",
"target_phys_addr_t paddr;",
"VAPICHandlers *handlers;",
"uint8_t opcode[2];",
"uint32_t imm32;",
"if (smp_cpus == 1) {",
"handlers = &VAR_0->rom_state.up;",
"} else {",
"handlers = &VAR_0->rom_state.mp;",
"}",
"pause_all_vcpus();",
"cpu_memory_rw_debug(VAR_1, VAR_2, opcode, sizeof(opcode), 0);",
"switch (opcode[0]) {",
"case 0x89:\npatch_byte(VAR_1, VAR_2, 0x50 + modrm_reg(opcode[1]));",
"patch_call(VAR_0, VAR_1, VAR_2 + 1, handlers->set_tpr);",
"break;",
"case 0x8b:\npatch_byte(VAR_1, VAR_2, 0x90);",
"patch_call(VAR_0, VAR_1, VAR_2 + 1, handlers->get_tpr[modrm_reg(opcode[1])]);",
"break;",
"case 0xa1:\npatch_call(VAR_0, VAR_1, VAR_2, handlers->get_tpr[0]);",
"break;",
"case 0xa3:\npatch_call(VAR_0, VAR_1, VAR_2, handlers->set_tpr_eax);",
"break;",
"case 0xc7:\npatch_byte(VAR_1, VAR_2, 0x68);",
"cpu_memory_rw_debug(VAR_1, VAR_2 + 6, (void *)&imm32, sizeof(imm32), 0);",
"cpu_memory_rw_debug(VAR_1, VAR_2 + 1, (void *)&imm32, sizeof(imm32), 1);",
"patch_call(VAR_0, VAR_1, VAR_2 + 5, handlers->set_tpr);",
"break;",
"case 0xff:\npatch_byte(VAR_1, VAR_2, 0x50);",
"patch_call(VAR_0, VAR_1, VAR_2 + 1, handlers->get_tpr_stack);",
"break;",
"default:\nabort();",
"}",
"resume_all_vcpus();",
"paddr = cpu_get_phys_page_debug(VAR_1, VAR_2);",
"paddr += VAR_2 & ~TARGET_PAGE_MASK;",
"tb_invalidate_phys_page_range(paddr, paddr + 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
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
27
],
[
31
],
[
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
],
[
93
],
[
97
],
[
99
],
[
101
],
[
103
]
] |
7,329 |
void tlb_fill(unsigned long addr, int is_write, int is_user, void *retaddr)
{
TranslationBlock *tb;
CPUState *saved_env;
unsigned long pc;
int ret;
/* XXX: hack to restore env in all cases, even if not called from
generated code */
saved_env = env;
env = cpu_single_env;
{
unsigned long tlb_addrr, tlb_addrw;
int index;
index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
tlb_addrr = env->tlb_read[is_user][index].address;
tlb_addrw = env->tlb_write[is_user][index].address;
#if 0
if (loglevel) {
fprintf(logfile,
"%s 1 %p %p idx=%d addr=0x%08lx tbl_addr=0x%08lx 0x%08lx "
"(0x%08lx 0x%08lx)\n", __func__, env,
&env->tlb_read[is_user][index], index, addr,
tlb_addrr, tlb_addrw, addr & TARGET_PAGE_MASK,
tlb_addrr & (TARGET_PAGE_MASK | TLB_INVALID_MASK));
}
#endif
}
ret = cpu_ppc_handle_mmu_fault(env, addr, is_write, is_user, 1);
if (ret) {
if (retaddr) {
/* now we have a real cpu fault */
pc = (unsigned long)retaddr;
tb = tb_find_pc(pc);
if (tb) {
/* the PC is inside the translated code. It means that we have
a virtual CPU fault */
cpu_restore_state(tb, env, pc, NULL);
}
}
do_raise_exception_err(env->exception_index, env->error_code);
}
{
unsigned long tlb_addrr, tlb_addrw;
int index;
index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
tlb_addrr = env->tlb_read[is_user][index].address;
tlb_addrw = env->tlb_write[is_user][index].address;
#if 0
printf("%s 2 %p %p idx=%d addr=0x%08lx tbl_addr=0x%08lx 0x%08lx "
"(0x%08lx 0x%08lx)\n", __func__, env,
&env->tlb_read[is_user][index], index, addr,
tlb_addrr, tlb_addrw, addr & TARGET_PAGE_MASK,
tlb_addrr & (TARGET_PAGE_MASK | TLB_INVALID_MASK));
#endif
}
env = saved_env;
}
| false |
qemu
|
b769d8fef6c06ddb39ef0337882a4f8872b9c2bc
|
void tlb_fill(unsigned long addr, int is_write, int is_user, void *retaddr)
{
TranslationBlock *tb;
CPUState *saved_env;
unsigned long pc;
int ret;
saved_env = env;
env = cpu_single_env;
{
unsigned long tlb_addrr, tlb_addrw;
int index;
index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
tlb_addrr = env->tlb_read[is_user][index].address;
tlb_addrw = env->tlb_write[is_user][index].address;
#if 0
if (loglevel) {
fprintf(logfile,
"%s 1 %p %p idx=%d addr=0x%08lx tbl_addr=0x%08lx 0x%08lx "
"(0x%08lx 0x%08lx)\n", __func__, env,
&env->tlb_read[is_user][index], index, addr,
tlb_addrr, tlb_addrw, addr & TARGET_PAGE_MASK,
tlb_addrr & (TARGET_PAGE_MASK | TLB_INVALID_MASK));
}
#endif
}
ret = cpu_ppc_handle_mmu_fault(env, addr, is_write, is_user, 1);
if (ret) {
if (retaddr) {
pc = (unsigned long)retaddr;
tb = tb_find_pc(pc);
if (tb) {
cpu_restore_state(tb, env, pc, NULL);
}
}
do_raise_exception_err(env->exception_index, env->error_code);
}
{
unsigned long tlb_addrr, tlb_addrw;
int index;
index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
tlb_addrr = env->tlb_read[is_user][index].address;
tlb_addrw = env->tlb_write[is_user][index].address;
#if 0
printf("%s 2 %p %p idx=%d addr=0x%08lx tbl_addr=0x%08lx 0x%08lx "
"(0x%08lx 0x%08lx)\n", __func__, env,
&env->tlb_read[is_user][index], index, addr,
tlb_addrr, tlb_addrw, addr & TARGET_PAGE_MASK,
tlb_addrr & (TARGET_PAGE_MASK | TLB_INVALID_MASK));
#endif
}
env = saved_env;
}
|
{
"code": [],
"line_no": []
}
|
void FUNC_0(unsigned long VAR_0, int VAR_1, int VAR_2, void *VAR_3)
{
TranslationBlock *tb;
CPUState *saved_env;
unsigned long VAR_4;
int VAR_5;
saved_env = env;
env = cpu_single_env;
{
unsigned long VAR_9, VAR_9;
int VAR_9;
VAR_9 = (VAR_0 >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
VAR_9 = env->tlb_read[VAR_2][VAR_9].address;
VAR_9 = env->tlb_write[VAR_2][VAR_9].address;
#if 0
if (loglevel) {
fprintf(logfile,
"%s 1 %p %p idx=%d VAR_0=0x%08lx tbl_addr=0x%08lx 0x%08lx "
"(0x%08lx 0x%08lx)\n", __func__, env,
&env->tlb_read[VAR_2][VAR_9], VAR_9, VAR_0,
VAR_9, VAR_9, VAR_0 & TARGET_PAGE_MASK,
VAR_9 & (TARGET_PAGE_MASK | TLB_INVALID_MASK));
}
#endif
}
VAR_5 = cpu_ppc_handle_mmu_fault(env, VAR_0, VAR_1, VAR_2, 1);
if (VAR_5) {
if (VAR_3) {
VAR_4 = (unsigned long)VAR_3;
tb = tb_find_pc(VAR_4);
if (tb) {
cpu_restore_state(tb, env, VAR_4, NULL);
}
}
do_raise_exception_err(env->exception_index, env->error_code);
}
{
unsigned long VAR_9, VAR_9;
int VAR_9;
VAR_9 = (VAR_0 >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
VAR_9 = env->tlb_read[VAR_2][VAR_9].address;
VAR_9 = env->tlb_write[VAR_2][VAR_9].address;
#if 0
printf("%s 2 %p %p idx=%d VAR_0=0x%08lx tbl_addr=0x%08lx 0x%08lx "
"(0x%08lx 0x%08lx)\n", __func__, env,
&env->tlb_read[VAR_2][VAR_9], VAR_9, VAR_0,
VAR_9, VAR_9, VAR_0 & TARGET_PAGE_MASK,
VAR_9 & (TARGET_PAGE_MASK | TLB_INVALID_MASK));
#endif
}
env = saved_env;
}
|
[
"void FUNC_0(unsigned long VAR_0, int VAR_1, int VAR_2, void *VAR_3)\n{",
"TranslationBlock *tb;",
"CPUState *saved_env;",
"unsigned long VAR_4;",
"int VAR_5;",
"saved_env = env;",
"env = cpu_single_env;",
"{",
"unsigned long VAR_9, VAR_9;",
"int VAR_9;",
"VAR_9 = (VAR_0 >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);",
"VAR_9 = env->tlb_read[VAR_2][VAR_9].address;",
"VAR_9 = env->tlb_write[VAR_2][VAR_9].address;",
"#if 0\nif (loglevel) {",
"fprintf(logfile,\n\"%s 1 %p %p idx=%d VAR_0=0x%08lx tbl_addr=0x%08lx 0x%08lx \"\n\"(0x%08lx 0x%08lx)\\n\", __func__, env,\n&env->tlb_read[VAR_2][VAR_9], VAR_9, VAR_0,\nVAR_9, VAR_9, VAR_0 & TARGET_PAGE_MASK,\nVAR_9 & (TARGET_PAGE_MASK | TLB_INVALID_MASK));",
"}",
"#endif\n}",
"VAR_5 = cpu_ppc_handle_mmu_fault(env, VAR_0, VAR_1, VAR_2, 1);",
"if (VAR_5) {",
"if (VAR_3) {",
"VAR_4 = (unsigned long)VAR_3;",
"tb = tb_find_pc(VAR_4);",
"if (tb) {",
"cpu_restore_state(tb, env, VAR_4, NULL);",
"}",
"}",
"do_raise_exception_err(env->exception_index, env->error_code);",
"}",
"{",
"unsigned long VAR_9, VAR_9;",
"int VAR_9;",
"VAR_9 = (VAR_0 >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);",
"VAR_9 = env->tlb_read[VAR_2][VAR_9].address;",
"VAR_9 = env->tlb_write[VAR_2][VAR_9].address;",
"#if 0\nprintf(\"%s 2 %p %p idx=%d VAR_0=0x%08lx tbl_addr=0x%08lx 0x%08lx \"\n\"(0x%08lx 0x%08lx)\\n\", __func__, env,\n&env->tlb_read[VAR_2][VAR_9], VAR_9, VAR_0,\nVAR_9, VAR_9, VAR_0 & TARGET_PAGE_MASK,\nVAR_9 & (TARGET_PAGE_MASK | TLB_INVALID_MASK));",
"#endif\n}",
"env = saved_env;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35,
37
],
[
39,
41,
43,
45,
47,
49
],
[
51
],
[
53,
55
],
[
57
],
[
59
],
[
61
],
[
65
],
[
67
],
[
69
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97,
99,
101,
103,
105,
107
],
[
109,
111
],
[
113
],
[
115
]
] |
7,330 |
static inline int get_cabac_cbf_ctx( H264Context *h, int cat, int idx ) {
int nza, nzb;
int ctx = 0;
if( cat == 0 ) {
nza = h->left_cbp&0x100;
nzb = h-> top_cbp&0x100;
} else if( cat == 1 || cat == 2 ) {
nza = h->non_zero_count_cache[scan8[idx] - 1];
nzb = h->non_zero_count_cache[scan8[idx] - 8];
} else if( cat == 3 ) {
nza = (h->left_cbp>>(6+idx))&0x01;
nzb = (h-> top_cbp>>(6+idx))&0x01;
} else {
assert(cat == 4);
nza = h->non_zero_count_cache[scan8[16+idx] - 1];
nzb = h->non_zero_count_cache[scan8[16+idx] - 8];
}
if( nza > 0 )
ctx++;
if( nzb > 0 )
ctx += 2;
return ctx + 4 * cat;
}
| false |
FFmpeg
|
9588ec340c3f33c7474b4cd2893046cfdaee42bf
|
static inline int get_cabac_cbf_ctx( H264Context *h, int cat, int idx ) {
int nza, nzb;
int ctx = 0;
if( cat == 0 ) {
nza = h->left_cbp&0x100;
nzb = h-> top_cbp&0x100;
} else if( cat == 1 || cat == 2 ) {
nza = h->non_zero_count_cache[scan8[idx] - 1];
nzb = h->non_zero_count_cache[scan8[idx] - 8];
} else if( cat == 3 ) {
nza = (h->left_cbp>>(6+idx))&0x01;
nzb = (h-> top_cbp>>(6+idx))&0x01;
} else {
assert(cat == 4);
nza = h->non_zero_count_cache[scan8[16+idx] - 1];
nzb = h->non_zero_count_cache[scan8[16+idx] - 8];
}
if( nza > 0 )
ctx++;
if( nzb > 0 )
ctx += 2;
return ctx + 4 * cat;
}
|
{
"code": [],
"line_no": []
}
|
static inline int FUNC_0( H264Context *VAR_0, int VAR_1, int VAR_2 ) {
int VAR_3, VAR_4;
int VAR_5 = 0;
if( VAR_1 == 0 ) {
VAR_3 = VAR_0->left_cbp&0x100;
VAR_4 = VAR_0-> top_cbp&0x100;
} else if( VAR_1 == 1 || VAR_1 == 2 ) {
VAR_3 = VAR_0->non_zero_count_cache[scan8[VAR_2] - 1];
VAR_4 = VAR_0->non_zero_count_cache[scan8[VAR_2] - 8];
} else if( VAR_1 == 3 ) {
VAR_3 = (VAR_0->left_cbp>>(6+VAR_2))&0x01;
VAR_4 = (VAR_0-> top_cbp>>(6+VAR_2))&0x01;
} else {
assert(VAR_1 == 4);
VAR_3 = VAR_0->non_zero_count_cache[scan8[16+VAR_2] - 1];
VAR_4 = VAR_0->non_zero_count_cache[scan8[16+VAR_2] - 8];
}
if( VAR_3 > 0 )
VAR_5++;
if( VAR_4 > 0 )
VAR_5 += 2;
return VAR_5 + 4 * VAR_1;
}
|
[
"static inline int FUNC_0( H264Context *VAR_0, int VAR_1, int VAR_2 ) {",
"int VAR_3, VAR_4;",
"int VAR_5 = 0;",
"if( VAR_1 == 0 ) {",
"VAR_3 = VAR_0->left_cbp&0x100;",
"VAR_4 = VAR_0-> top_cbp&0x100;",
"} else if( VAR_1 == 1 || VAR_1 == 2 ) {",
"VAR_3 = VAR_0->non_zero_count_cache[scan8[VAR_2] - 1];",
"VAR_4 = VAR_0->non_zero_count_cache[scan8[VAR_2] - 8];",
"} else if( VAR_1 == 3 ) {",
"VAR_3 = (VAR_0->left_cbp>>(6+VAR_2))&0x01;",
"VAR_4 = (VAR_0-> top_cbp>>(6+VAR_2))&0x01;",
"} else {",
"assert(VAR_1 == 4);",
"VAR_3 = VAR_0->non_zero_count_cache[scan8[16+VAR_2] - 1];",
"VAR_4 = VAR_0->non_zero_count_cache[scan8[16+VAR_2] - 8];",
"}",
"if( VAR_3 > 0 )\nVAR_5++;",
"if( VAR_4 > 0 )\nVAR_5 += 2;",
"return VAR_5 + 4 * VAR_1;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1
],
[
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
39,
41
],
[
45,
47
],
[
51
],
[
53
]
] |
7,333 |
static void add_flagname_to_bitmaps(const char *flagname, uint32_t *features,
uint32_t *ext_features,
uint32_t *ext2_features,
uint32_t *ext3_features,
uint32_t *kvm_features)
{
int i;
int found = 0;
for ( i = 0 ; i < 32 ; i++ )
if (feature_name[i] && !strcmp (flagname, feature_name[i])) {
*features |= 1 << i;
found = 1;
}
for ( i = 0 ; i < 32 ; i++ )
if (ext_feature_name[i] && !strcmp (flagname, ext_feature_name[i])) {
*ext_features |= 1 << i;
found = 1;
}
for ( i = 0 ; i < 32 ; i++ )
if (ext2_feature_name[i] && !strcmp (flagname, ext2_feature_name[i])) {
*ext2_features |= 1 << i;
found = 1;
}
for ( i = 0 ; i < 32 ; i++ )
if (ext3_feature_name[i] && !strcmp (flagname, ext3_feature_name[i])) {
*ext3_features |= 1 << i;
found = 1;
}
for ( i = 0 ; i < 32 ; i++ )
if (kvm_feature_name[i] && !strcmp (flagname, kvm_feature_name[i])) {
*kvm_features |= 1 << i;
found = 1;
}
if (!found) {
fprintf(stderr, "CPU feature %s not found\n", flagname);
}
}
| false |
qemu
|
b5ec5ce0e39d6e7ea707d5604a5f6d567dfd2f48
|
static void add_flagname_to_bitmaps(const char *flagname, uint32_t *features,
uint32_t *ext_features,
uint32_t *ext2_features,
uint32_t *ext3_features,
uint32_t *kvm_features)
{
int i;
int found = 0;
for ( i = 0 ; i < 32 ; i++ )
if (feature_name[i] && !strcmp (flagname, feature_name[i])) {
*features |= 1 << i;
found = 1;
}
for ( i = 0 ; i < 32 ; i++ )
if (ext_feature_name[i] && !strcmp (flagname, ext_feature_name[i])) {
*ext_features |= 1 << i;
found = 1;
}
for ( i = 0 ; i < 32 ; i++ )
if (ext2_feature_name[i] && !strcmp (flagname, ext2_feature_name[i])) {
*ext2_features |= 1 << i;
found = 1;
}
for ( i = 0 ; i < 32 ; i++ )
if (ext3_feature_name[i] && !strcmp (flagname, ext3_feature_name[i])) {
*ext3_features |= 1 << i;
found = 1;
}
for ( i = 0 ; i < 32 ; i++ )
if (kvm_feature_name[i] && !strcmp (flagname, kvm_feature_name[i])) {
*kvm_features |= 1 << i;
found = 1;
}
if (!found) {
fprintf(stderr, "CPU feature %s not found\n", flagname);
}
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(const char *VAR_0, uint32_t *VAR_1,
uint32_t *VAR_2,
uint32_t *VAR_3,
uint32_t *VAR_4,
uint32_t *VAR_5)
{
int VAR_6;
int VAR_7 = 0;
for ( VAR_6 = 0 ; VAR_6 < 32 ; VAR_6++ )
if (feature_name[VAR_6] && !strcmp (VAR_0, feature_name[VAR_6])) {
*VAR_1 |= 1 << VAR_6;
VAR_7 = 1;
}
for ( VAR_6 = 0 ; VAR_6 < 32 ; VAR_6++ )
if (ext_feature_name[VAR_6] && !strcmp (VAR_0, ext_feature_name[VAR_6])) {
*VAR_2 |= 1 << VAR_6;
VAR_7 = 1;
}
for ( VAR_6 = 0 ; VAR_6 < 32 ; VAR_6++ )
if (ext2_feature_name[VAR_6] && !strcmp (VAR_0, ext2_feature_name[VAR_6])) {
*VAR_3 |= 1 << VAR_6;
VAR_7 = 1;
}
for ( VAR_6 = 0 ; VAR_6 < 32 ; VAR_6++ )
if (ext3_feature_name[VAR_6] && !strcmp (VAR_0, ext3_feature_name[VAR_6])) {
*VAR_4 |= 1 << VAR_6;
VAR_7 = 1;
}
for ( VAR_6 = 0 ; VAR_6 < 32 ; VAR_6++ )
if (kvm_feature_name[VAR_6] && !strcmp (VAR_0, kvm_feature_name[VAR_6])) {
*VAR_5 |= 1 << VAR_6;
VAR_7 = 1;
}
if (!VAR_7) {
fprintf(stderr, "CPU feature %s not VAR_7\n", VAR_0);
}
}
|
[
"static void FUNC_0(const char *VAR_0, uint32_t *VAR_1,\nuint32_t *VAR_2,\nuint32_t *VAR_3,\nuint32_t *VAR_4,\nuint32_t *VAR_5)\n{",
"int VAR_6;",
"int VAR_7 = 0;",
"for ( VAR_6 = 0 ; VAR_6 < 32 ; VAR_6++ )",
"if (feature_name[VAR_6] && !strcmp (VAR_0, feature_name[VAR_6])) {",
"*VAR_1 |= 1 << VAR_6;",
"VAR_7 = 1;",
"}",
"for ( VAR_6 = 0 ; VAR_6 < 32 ; VAR_6++ )",
"if (ext_feature_name[VAR_6] && !strcmp (VAR_0, ext_feature_name[VAR_6])) {",
"*VAR_2 |= 1 << VAR_6;",
"VAR_7 = 1;",
"}",
"for ( VAR_6 = 0 ; VAR_6 < 32 ; VAR_6++ )",
"if (ext2_feature_name[VAR_6] && !strcmp (VAR_0, ext2_feature_name[VAR_6])) {",
"*VAR_3 |= 1 << VAR_6;",
"VAR_7 = 1;",
"}",
"for ( VAR_6 = 0 ; VAR_6 < 32 ; VAR_6++ )",
"if (ext3_feature_name[VAR_6] && !strcmp (VAR_0, ext3_feature_name[VAR_6])) {",
"*VAR_4 |= 1 << VAR_6;",
"VAR_7 = 1;",
"}",
"for ( VAR_6 = 0 ; VAR_6 < 32 ; VAR_6++ )",
"if (kvm_feature_name[VAR_6] && !strcmp (VAR_0, kvm_feature_name[VAR_6])) {",
"*VAR_5 |= 1 << VAR_6;",
"VAR_7 = 1;",
"}",
"if (!VAR_7) {",
"fprintf(stderr, \"CPU feature %s not VAR_7\\n\", 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
] |
[
[
1,
3,
5,
7,
9,
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
71
],
[
73
],
[
75
],
[
77
]
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.