id
int32
0
27.3k
func
stringlengths
26
142k
target
bool
2 classes
project
stringclasses
2 values
commit_id
stringlengths
40
40
func_clean
stringlengths
26
131k
vul_lines
dict
normalized_func
stringlengths
24
132k
lines
sequencelengths
1
2.8k
label
sequencelengths
1
2.8k
line_no
sequencelengths
1
2.8k
2,076
void laio_attach_aio_context(LinuxAioState *s, AioContext *new_context) { s->aio_context = new_context; s->completion_bh = aio_bh_new(new_context, qemu_laio_completion_bh, s); aio_set_event_notifier(new_context, &s->e, false, qemu_laio_completion_cb, NULL); }
false
qemu
ee68697551cd81186c5b12eba10c158350cf1165
void laio_attach_aio_context(LinuxAioState *s, AioContext *new_context) { s->aio_context = new_context; s->completion_bh = aio_bh_new(new_context, qemu_laio_completion_bh, s); aio_set_event_notifier(new_context, &s->e, false, qemu_laio_completion_cb, NULL); }
{ "code": [], "line_no": [] }
void FUNC_0(LinuxAioState *VAR_0, AioContext *VAR_1) { VAR_0->aio_context = VAR_1; VAR_0->completion_bh = aio_bh_new(VAR_1, qemu_laio_completion_bh, VAR_0); aio_set_event_notifier(VAR_1, &VAR_0->e, false, qemu_laio_completion_cb, NULL); }
[ "void FUNC_0(LinuxAioState *VAR_0, AioContext *VAR_1)\n{", "VAR_0->aio_context = VAR_1;", "VAR_0->completion_bh = aio_bh_new(VAR_1, qemu_laio_completion_bh, VAR_0);", "aio_set_event_notifier(VAR_1, &VAR_0->e, false,\nqemu_laio_completion_cb, NULL);", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11 ], [ 13 ] ]
2,077
process_tx_desc(E1000State *s, struct e1000_tx_desc *dp) { PCIDevice *d = PCI_DEVICE(s); uint32_t txd_lower = le32_to_cpu(dp->lower.data); uint32_t dtype = txd_lower & (E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D); unsigned int split_size = txd_lower & 0xffff, bytes, sz; unsigned int msh = 0xfffff; uint64_t addr; struct e1000_context_desc *xp = (struct e1000_context_desc *)dp; struct e1000_tx *tp = &s->tx; s->mit_ide |= (txd_lower & E1000_TXD_CMD_IDE); if (dtype == E1000_TXD_CMD_DEXT) { /* context descriptor */ e1000x_read_tx_ctx_descr(xp, &tp->props); tp->tso_frames = 0; if (tp->props.tucso == 0) { /* this is probably wrong */ DBGOUT(TXSUM, "TCP/UDP: cso 0!\n"); tp->props.tucso = tp->props.tucss + (tp->props.tcp ? 16 : 6); } return; } else if (dtype == (E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D)) { // data descriptor if (tp->size == 0) { tp->props.sum_needed = le32_to_cpu(dp->upper.data) >> 8; } tp->props.cptse = (txd_lower & E1000_TXD_CMD_TSE) ? 1 : 0; } else { // legacy descriptor tp->props.cptse = 0; } if (e1000x_vlan_enabled(s->mac_reg) && e1000x_is_vlan_txd(txd_lower) && (tp->props.cptse || txd_lower & E1000_TXD_CMD_EOP)) { tp->vlan_needed = 1; stw_be_p(tp->vlan_header, le16_to_cpu(s->mac_reg[VET])); stw_be_p(tp->vlan_header + 2, le16_to_cpu(dp->upper.fields.special)); } addr = le64_to_cpu(dp->buffer_addr); if (tp->props.tse && tp->props.cptse) { msh = tp->props.hdr_len + tp->props.mss; do { bytes = split_size; if (tp->size + bytes > msh) bytes = msh - tp->size; bytes = MIN(sizeof(tp->data) - tp->size, bytes); pci_dma_read(d, addr, tp->data + tp->size, bytes); sz = tp->size + bytes; if (sz >= tp->props.hdr_len && tp->size < tp->props.hdr_len) { memmove(tp->header, tp->data, tp->props.hdr_len); } tp->size = sz; addr += bytes; if (sz == msh) { xmit_seg(s); memmove(tp->data, tp->header, tp->props.hdr_len); tp->size = tp->props.hdr_len; } split_size -= bytes; } while (bytes && split_size); } else if (!tp->props.tse && tp->props.cptse) { // context descriptor TSE is not set, while data descriptor TSE is set DBGOUT(TXERR, "TCP segmentation error\n"); } else { split_size = MIN(sizeof(tp->data) - tp->size, split_size); pci_dma_read(d, addr, tp->data + tp->size, split_size); tp->size += split_size; } if (!(txd_lower & E1000_TXD_CMD_EOP)) return; if (!(tp->props.tse && tp->props.cptse && tp->size < tp->props.hdr_len)) { xmit_seg(s); } tp->tso_frames = 0; tp->props.sum_needed = 0; tp->vlan_needed = 0; tp->size = 0; tp->props.cptse = 0; }
false
qemu
7d08c73e7bdc39b10e5f2f5acdce700f17ffe962
process_tx_desc(E1000State *s, struct e1000_tx_desc *dp) { PCIDevice *d = PCI_DEVICE(s); uint32_t txd_lower = le32_to_cpu(dp->lower.data); uint32_t dtype = txd_lower & (E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D); unsigned int split_size = txd_lower & 0xffff, bytes, sz; unsigned int msh = 0xfffff; uint64_t addr; struct e1000_context_desc *xp = (struct e1000_context_desc *)dp; struct e1000_tx *tp = &s->tx; s->mit_ide |= (txd_lower & E1000_TXD_CMD_IDE); if (dtype == E1000_TXD_CMD_DEXT) { e1000x_read_tx_ctx_descr(xp, &tp->props); tp->tso_frames = 0; if (tp->props.tucso == 0) { DBGOUT(TXSUM, "TCP/UDP: cso 0!\n"); tp->props.tucso = tp->props.tucss + (tp->props.tcp ? 16 : 6); } return; } else if (dtype == (E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D)) { if (tp->size == 0) { tp->props.sum_needed = le32_to_cpu(dp->upper.data) >> 8; } tp->props.cptse = (txd_lower & E1000_TXD_CMD_TSE) ? 1 : 0; } else { tp->props.cptse = 0; } if (e1000x_vlan_enabled(s->mac_reg) && e1000x_is_vlan_txd(txd_lower) && (tp->props.cptse || txd_lower & E1000_TXD_CMD_EOP)) { tp->vlan_needed = 1; stw_be_p(tp->vlan_header, le16_to_cpu(s->mac_reg[VET])); stw_be_p(tp->vlan_header + 2, le16_to_cpu(dp->upper.fields.special)); } addr = le64_to_cpu(dp->buffer_addr); if (tp->props.tse && tp->props.cptse) { msh = tp->props.hdr_len + tp->props.mss; do { bytes = split_size; if (tp->size + bytes > msh) bytes = msh - tp->size; bytes = MIN(sizeof(tp->data) - tp->size, bytes); pci_dma_read(d, addr, tp->data + tp->size, bytes); sz = tp->size + bytes; if (sz >= tp->props.hdr_len && tp->size < tp->props.hdr_len) { memmove(tp->header, tp->data, tp->props.hdr_len); } tp->size = sz; addr += bytes; if (sz == msh) { xmit_seg(s); memmove(tp->data, tp->header, tp->props.hdr_len); tp->size = tp->props.hdr_len; } split_size -= bytes; } while (bytes && split_size); } else if (!tp->props.tse && tp->props.cptse) { DBGOUT(TXERR, "TCP segmentation error\n"); } else { split_size = MIN(sizeof(tp->data) - tp->size, split_size); pci_dma_read(d, addr, tp->data + tp->size, split_size); tp->size += split_size; } if (!(txd_lower & E1000_TXD_CMD_EOP)) return; if (!(tp->props.tse && tp->props.cptse && tp->size < tp->props.hdr_len)) { xmit_seg(s); } tp->tso_frames = 0; tp->props.sum_needed = 0; tp->vlan_needed = 0; tp->size = 0; tp->props.cptse = 0; }
{ "code": [], "line_no": [] }
FUNC_0(E1000State *VAR_0, struct e1000_tx_desc *VAR_1) { PCIDevice *d = PCI_DEVICE(VAR_0); uint32_t txd_lower = le32_to_cpu(VAR_1->lower.data); uint32_t dtype = txd_lower & (E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D); unsigned int VAR_2 = txd_lower & 0xffff, VAR_3, VAR_4; unsigned int VAR_5 = 0xfffff; uint64_t addr; struct e1000_context_desc *VAR_6 = (struct e1000_context_desc *)VAR_1; struct e1000_tx *VAR_7 = &VAR_0->tx; VAR_0->mit_ide |= (txd_lower & E1000_TXD_CMD_IDE); if (dtype == E1000_TXD_CMD_DEXT) { e1000x_read_tx_ctx_descr(VAR_6, &VAR_7->props); VAR_7->tso_frames = 0; if (VAR_7->props.tucso == 0) { DBGOUT(TXSUM, "TCP/UDP: cso 0!\n"); VAR_7->props.tucso = VAR_7->props.tucss + (VAR_7->props.tcp ? 16 : 6); } return; } else if (dtype == (E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D)) { if (VAR_7->size == 0) { VAR_7->props.sum_needed = le32_to_cpu(VAR_1->upper.data) >> 8; } VAR_7->props.cptse = (txd_lower & E1000_TXD_CMD_TSE) ? 1 : 0; } else { VAR_7->props.cptse = 0; } if (e1000x_vlan_enabled(VAR_0->mac_reg) && e1000x_is_vlan_txd(txd_lower) && (VAR_7->props.cptse || txd_lower & E1000_TXD_CMD_EOP)) { VAR_7->vlan_needed = 1; stw_be_p(VAR_7->vlan_header, le16_to_cpu(VAR_0->mac_reg[VET])); stw_be_p(VAR_7->vlan_header + 2, le16_to_cpu(VAR_1->upper.fields.special)); } addr = le64_to_cpu(VAR_1->buffer_addr); if (VAR_7->props.tse && VAR_7->props.cptse) { VAR_5 = VAR_7->props.hdr_len + VAR_7->props.mss; do { VAR_3 = VAR_2; if (VAR_7->size + VAR_3 > VAR_5) VAR_3 = VAR_5 - VAR_7->size; VAR_3 = MIN(sizeof(VAR_7->data) - VAR_7->size, VAR_3); pci_dma_read(d, addr, VAR_7->data + VAR_7->size, VAR_3); VAR_4 = VAR_7->size + VAR_3; if (VAR_4 >= VAR_7->props.hdr_len && VAR_7->size < VAR_7->props.hdr_len) { memmove(VAR_7->header, VAR_7->data, VAR_7->props.hdr_len); } VAR_7->size = VAR_4; addr += VAR_3; if (VAR_4 == VAR_5) { xmit_seg(VAR_0); memmove(VAR_7->data, VAR_7->header, VAR_7->props.hdr_len); VAR_7->size = VAR_7->props.hdr_len; } VAR_2 -= VAR_3; } while (VAR_3 && VAR_2); } else if (!VAR_7->props.tse && VAR_7->props.cptse) { DBGOUT(TXERR, "TCP segmentation error\n"); } else { VAR_2 = MIN(sizeof(VAR_7->data) - VAR_7->size, VAR_2); pci_dma_read(d, addr, VAR_7->data + VAR_7->size, VAR_2); VAR_7->size += VAR_2; } if (!(txd_lower & E1000_TXD_CMD_EOP)) return; if (!(VAR_7->props.tse && VAR_7->props.cptse && VAR_7->size < VAR_7->props.hdr_len)) { xmit_seg(VAR_0); } VAR_7->tso_frames = 0; VAR_7->props.sum_needed = 0; VAR_7->vlan_needed = 0; VAR_7->size = 0; VAR_7->props.cptse = 0; }
[ "FUNC_0(E1000State *VAR_0, struct e1000_tx_desc *VAR_1)\n{", "PCIDevice *d = PCI_DEVICE(VAR_0);", "uint32_t txd_lower = le32_to_cpu(VAR_1->lower.data);", "uint32_t dtype = txd_lower & (E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D);", "unsigned int VAR_2 = txd_lower & 0xffff, VAR_3, VAR_4;", "unsigned int VAR_5 = 0xfffff;", "uint64_t addr;", "struct e1000_context_desc *VAR_6 = (struct e1000_context_desc *)VAR_1;", "struct e1000_tx *VAR_7 = &VAR_0->tx;", "VAR_0->mit_ide |= (txd_lower & E1000_TXD_CMD_IDE);", "if (dtype == E1000_TXD_CMD_DEXT) {", "e1000x_read_tx_ctx_descr(VAR_6, &VAR_7->props);", "VAR_7->tso_frames = 0;", "if (VAR_7->props.tucso == 0) {", "DBGOUT(TXSUM, \"TCP/UDP: cso 0!\\n\");", "VAR_7->props.tucso = VAR_7->props.tucss + (VAR_7->props.tcp ? 16 : 6);", "}", "return;", "} else if (dtype == (E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D)) {", "if (VAR_7->size == 0) {", "VAR_7->props.sum_needed = le32_to_cpu(VAR_1->upper.data) >> 8;", "}", "VAR_7->props.cptse = (txd_lower & E1000_TXD_CMD_TSE) ? 1 : 0;", "} else {", "VAR_7->props.cptse = 0;", "}", "if (e1000x_vlan_enabled(VAR_0->mac_reg) &&\ne1000x_is_vlan_txd(txd_lower) &&\n(VAR_7->props.cptse || txd_lower & E1000_TXD_CMD_EOP)) {", "VAR_7->vlan_needed = 1;", "stw_be_p(VAR_7->vlan_header,\nle16_to_cpu(VAR_0->mac_reg[VET]));", "stw_be_p(VAR_7->vlan_header + 2,\nle16_to_cpu(VAR_1->upper.fields.special));", "}", "addr = le64_to_cpu(VAR_1->buffer_addr);", "if (VAR_7->props.tse && VAR_7->props.cptse) {", "VAR_5 = VAR_7->props.hdr_len + VAR_7->props.mss;", "do {", "VAR_3 = VAR_2;", "if (VAR_7->size + VAR_3 > VAR_5)\nVAR_3 = VAR_5 - VAR_7->size;", "VAR_3 = MIN(sizeof(VAR_7->data) - VAR_7->size, VAR_3);", "pci_dma_read(d, addr, VAR_7->data + VAR_7->size, VAR_3);", "VAR_4 = VAR_7->size + VAR_3;", "if (VAR_4 >= VAR_7->props.hdr_len && VAR_7->size < VAR_7->props.hdr_len) {", "memmove(VAR_7->header, VAR_7->data, VAR_7->props.hdr_len);", "}", "VAR_7->size = VAR_4;", "addr += VAR_3;", "if (VAR_4 == VAR_5) {", "xmit_seg(VAR_0);", "memmove(VAR_7->data, VAR_7->header, VAR_7->props.hdr_len);", "VAR_7->size = VAR_7->props.hdr_len;", "}", "VAR_2 -= VAR_3;", "} while (VAR_3 && VAR_2);", "} else if (!VAR_7->props.tse && VAR_7->props.cptse) {", "DBGOUT(TXERR, \"TCP segmentation error\\n\");", "} else {", "VAR_2 = MIN(sizeof(VAR_7->data) - VAR_7->size, VAR_2);", "pci_dma_read(d, addr, VAR_7->data + VAR_7->size, VAR_2);", "VAR_7->size += VAR_2;", "}", "if (!(txd_lower & E1000_TXD_CMD_EOP))\nreturn;", "if (!(VAR_7->props.tse && VAR_7->props.cptse && VAR_7->size < VAR_7->props.hdr_len)) {", "xmit_seg(VAR_0);", "}", "VAR_7->tso_frames = 0;", "VAR_7->props.sum_needed = 0;", "VAR_7->vlan_needed = 0;", "VAR_7->size = 0;", "VAR_7->props.cptse = 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 63, 65, 67 ], [ 69 ], [ 71, 73 ], [ 75, 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 147, 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ] ]
2,078
int unix_socket_outgoing(const char *path) { Error *local_err = NULL; int fd = unix_connect(path, &local_err); if (local_err != NULL) { qerror_report_err(local_err); error_free(local_err); } return fd; }
false
qemu
537b41f5013e1951fa15e8f18855b18d76124ce4
int unix_socket_outgoing(const char *path) { Error *local_err = NULL; int fd = unix_connect(path, &local_err); if (local_err != NULL) { qerror_report_err(local_err); error_free(local_err); } return fd; }
{ "code": [], "line_no": [] }
int FUNC_0(const char *VAR_0) { Error *local_err = NULL; int VAR_1 = unix_connect(VAR_0, &local_err); if (local_err != NULL) { qerror_report_err(local_err); error_free(local_err); } return VAR_1; }
[ "int FUNC_0(const char *VAR_0)\n{", "Error *local_err = NULL;", "int VAR_1 = unix_connect(VAR_0, &local_err);", "if (local_err != NULL) {", "qerror_report_err(local_err);", "error_free(local_err);", "}", "return VAR_1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
2,079
static ssize_t nbd_receive_request(int csock, struct nbd_request *request) { uint8_t buf[4 + 4 + 8 + 8 + 4]; uint32_t magic; if (read_sync(csock, buf, sizeof(buf)) != sizeof(buf)) { LOG("read failed"); errno = EINVAL; return -1; } /* Request [ 0 .. 3] magic (NBD_REQUEST_MAGIC) [ 4 .. 7] type (0 == READ, 1 == WRITE) [ 8 .. 15] handle [16 .. 23] from [24 .. 27] len */ magic = be32_to_cpup((uint32_t*)buf); request->type = be32_to_cpup((uint32_t*)(buf + 4)); request->handle = be64_to_cpup((uint64_t*)(buf + 8)); request->from = be64_to_cpup((uint64_t*)(buf + 16)); request->len = be32_to_cpup((uint32_t*)(buf + 24)); TRACE("Got request: " "{ magic = 0x%x, .type = %d, from = %" PRIu64" , len = %u }", magic, request->type, request->from, request->len); if (magic != NBD_REQUEST_MAGIC) { LOG("invalid magic (got 0x%x)", magic); errno = EINVAL; return -1; } return 0; }
false
qemu
185b43386ad999c80bdc58e41b87f05e5b3e8463
static ssize_t nbd_receive_request(int csock, struct nbd_request *request) { uint8_t buf[4 + 4 + 8 + 8 + 4]; uint32_t magic; if (read_sync(csock, buf, sizeof(buf)) != sizeof(buf)) { LOG("read failed"); errno = EINVAL; return -1; } magic = be32_to_cpup((uint32_t*)buf); request->type = be32_to_cpup((uint32_t*)(buf + 4)); request->handle = be64_to_cpup((uint64_t*)(buf + 8)); request->from = be64_to_cpup((uint64_t*)(buf + 16)); request->len = be32_to_cpup((uint32_t*)(buf + 24)); TRACE("Got request: " "{ magic = 0x%x, .type = %d, from = %" PRIu64" , len = %u }", magic, request->type, request->from, request->len); if (magic != NBD_REQUEST_MAGIC) { LOG("invalid magic (got 0x%x)", magic); errno = EINVAL; return -1; } return 0; }
{ "code": [], "line_no": [] }
static ssize_t FUNC_0(int csock, struct nbd_request *request) { uint8_t buf[4 + 4 + 8 + 8 + 4]; uint32_t magic; if (read_sync(csock, buf, sizeof(buf)) != sizeof(buf)) { LOG("read failed"); errno = EINVAL; return -1; } magic = be32_to_cpup((uint32_t*)buf); request->type = be32_to_cpup((uint32_t*)(buf + 4)); request->handle = be64_to_cpup((uint64_t*)(buf + 8)); request->from = be64_to_cpup((uint64_t*)(buf + 16)); request->len = be32_to_cpup((uint32_t*)(buf + 24)); TRACE("Got request: " "{ magic = 0x%x, .type = %d, from = %" PRIu64" , len = %u }", magic, request->type, request->from, request->len); if (magic != NBD_REQUEST_MAGIC) { LOG("invalid magic (got 0x%x)", magic); errno = EINVAL; return -1; } return 0; }
[ "static ssize_t FUNC_0(int csock, struct nbd_request *request)\n{", "uint8_t buf[4 + 4 + 8 + 8 + 4];", "uint32_t magic;", "if (read_sync(csock, buf, sizeof(buf)) != sizeof(buf)) {", "LOG(\"read failed\");", "errno = EINVAL;", "return -1;", "}", "magic = be32_to_cpup((uint32_t*)buf);", "request->type = be32_to_cpup((uint32_t*)(buf + 4));", "request->handle = be64_to_cpup((uint64_t*)(buf + 8));", "request->from = be64_to_cpup((uint64_t*)(buf + 16));", "request->len = be32_to_cpup((uint32_t*)(buf + 24));", "TRACE(\"Got request: \"\n\"{ magic = 0x%x, .type = %d, from = %\" PRIu64\" , len = %u }\",", "magic, request->type, request->from, request->len);", "if (magic != NBD_REQUEST_MAGIC) {", "LOG(\"invalid magic (got 0x%x)\", magic);", "errno = EINVAL;", "return -1;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51, 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ] ]
2,080
static void raw_close_fd_pool(BDRVRawState *s) { int i; for (i = 0; i < RAW_FD_POOL_SIZE; i++) { if (s->fd_pool[i] != -1) { close(s->fd_pool[i]); s->fd_pool[i] = -1; } } }
false
qemu
3c529d935923a70519557d420db1d5a09a65086a
static void raw_close_fd_pool(BDRVRawState *s) { int i; for (i = 0; i < RAW_FD_POOL_SIZE; i++) { if (s->fd_pool[i] != -1) { close(s->fd_pool[i]); s->fd_pool[i] = -1; } } }
{ "code": [], "line_no": [] }
static void FUNC_0(BDRVRawState *VAR_0) { int VAR_1; for (VAR_1 = 0; VAR_1 < RAW_FD_POOL_SIZE; VAR_1++) { if (VAR_0->fd_pool[VAR_1] != -1) { close(VAR_0->fd_pool[VAR_1]); VAR_0->fd_pool[VAR_1] = -1; } } }
[ "static void FUNC_0(BDRVRawState *VAR_0)\n{", "int VAR_1;", "for (VAR_1 = 0; VAR_1 < RAW_FD_POOL_SIZE; VAR_1++) {", "if (VAR_0->fd_pool[VAR_1] != -1) {", "close(VAR_0->fd_pool[VAR_1]);", "VAR_0->fd_pool[VAR_1] = -1;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
2,081
static UHCIAsync *uhci_async_alloc(UHCIState *s) { UHCIAsync *async = g_malloc(sizeof(UHCIAsync)); memset(&async->packet, 0, sizeof(async->packet)); async->uhci = s; async->valid = 0; async->td = 0; async->token = 0; async->done = 0; async->isoc = 0; usb_packet_init(&async->packet); qemu_sglist_init(&async->sgl, 1); return async; }
false
qemu
fff23ee9a5de74ab111b3cea9eec56782e7d7c50
static UHCIAsync *uhci_async_alloc(UHCIState *s) { UHCIAsync *async = g_malloc(sizeof(UHCIAsync)); memset(&async->packet, 0, sizeof(async->packet)); async->uhci = s; async->valid = 0; async->td = 0; async->token = 0; async->done = 0; async->isoc = 0; usb_packet_init(&async->packet); qemu_sglist_init(&async->sgl, 1); return async; }
{ "code": [], "line_no": [] }
static UHCIAsync *FUNC_0(UHCIState *s) { UHCIAsync *async = g_malloc(sizeof(UHCIAsync)); memset(&async->packet, 0, sizeof(async->packet)); async->uhci = s; async->valid = 0; async->td = 0; async->token = 0; async->done = 0; async->isoc = 0; usb_packet_init(&async->packet); qemu_sglist_init(&async->sgl, 1); return async; }
[ "static UHCIAsync *FUNC_0(UHCIState *s)\n{", "UHCIAsync *async = g_malloc(sizeof(UHCIAsync));", "memset(&async->packet, 0, sizeof(async->packet));", "async->uhci = s;", "async->valid = 0;", "async->td = 0;", "async->token = 0;", "async->done = 0;", "async->isoc = 0;", "usb_packet_init(&async->packet);", "qemu_sglist_init(&async->sgl, 1);", "return async;", "}" ]
[ 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 ], [ 29 ], [ 31 ] ]
2,085
static void apic_startup(APICState *s, int vector_num) { CPUState *env = s->cpu_env; if (!env->halted) return; env->eip = 0; cpu_x86_load_seg_cache(env, R_CS, vector_num << 8, vector_num << 12, 0xffff, 0); env->halted = 0; }
false
qemu
b09ea7d55cfab5a75912bb56ed1fcd757604a759
static void apic_startup(APICState *s, int vector_num) { CPUState *env = s->cpu_env; if (!env->halted) return; env->eip = 0; cpu_x86_load_seg_cache(env, R_CS, vector_num << 8, vector_num << 12, 0xffff, 0); env->halted = 0; }
{ "code": [], "line_no": [] }
static void FUNC_0(APICState *VAR_0, int VAR_1) { CPUState *env = VAR_0->cpu_env; if (!env->halted) return; env->eip = 0; cpu_x86_load_seg_cache(env, R_CS, VAR_1 << 8, VAR_1 << 12, 0xffff, 0); env->halted = 0; }
[ "static void FUNC_0(APICState *VAR_0, int VAR_1)\n{", "CPUState *env = VAR_0->cpu_env;", "if (!env->halted)\nreturn;", "env->eip = 0;", "cpu_x86_load_seg_cache(env, R_CS, VAR_1 << 8, VAR_1 << 12,\n0xffff, 0);", "env->halted = 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ] ]
2,086
void kvm_s390_virtio_irq(S390CPU *cpu, int config_change, uint64_t token) { kvm_s390_interrupt_internal(cpu, KVM_S390_INT_VIRTIO, config_change, token, 1); }
false
qemu
de13d2161473d02ae97ec0f8e4503147554892dd
void kvm_s390_virtio_irq(S390CPU *cpu, int config_change, uint64_t token) { kvm_s390_interrupt_internal(cpu, KVM_S390_INT_VIRTIO, config_change, token, 1); }
{ "code": [], "line_no": [] }
void FUNC_0(S390CPU *VAR_0, int VAR_1, uint64_t VAR_2) { kvm_s390_interrupt_internal(VAR_0, KVM_S390_INT_VIRTIO, VAR_1, VAR_2, 1); }
[ "void FUNC_0(S390CPU *VAR_0, int VAR_1, uint64_t VAR_2)\n{", "kvm_s390_interrupt_internal(VAR_0, KVM_S390_INT_VIRTIO, VAR_1,\nVAR_2, 1);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ] ]
2,087
static void bdrv_io_limits_intercept(BlockDriverState *bs, unsigned int bytes, bool is_write) { /* does this io must wait */ bool must_wait = throttle_schedule_timer(&bs->throttle_state, is_write); /* if must wait or any request of this type throttled queue the IO */ if (must_wait || !qemu_co_queue_empty(&bs->throttled_reqs[is_write])) { qemu_co_queue_wait(&bs->throttled_reqs[is_write]); } /* the IO will be executed, do the accounting */ throttle_account(&bs->throttle_state, is_write, bytes); /* if the next request must wait -> do nothing */ if (throttle_schedule_timer(&bs->throttle_state, is_write)) { return; } /* else queue next request for execution */ qemu_co_queue_next(&bs->throttled_reqs[is_write]); }
false
qemu
61007b316cd71ee7333ff7a0a749a8949527575f
static void bdrv_io_limits_intercept(BlockDriverState *bs, unsigned int bytes, bool is_write) { bool must_wait = throttle_schedule_timer(&bs->throttle_state, is_write); if (must_wait || !qemu_co_queue_empty(&bs->throttled_reqs[is_write])) { qemu_co_queue_wait(&bs->throttled_reqs[is_write]); } throttle_account(&bs->throttle_state, is_write, bytes); if (throttle_schedule_timer(&bs->throttle_state, is_write)) { return; } qemu_co_queue_next(&bs->throttled_reqs[is_write]); }
{ "code": [], "line_no": [] }
static void FUNC_0(BlockDriverState *VAR_0, unsigned int VAR_1, bool VAR_2) { bool must_wait = throttle_schedule_timer(&VAR_0->throttle_state, VAR_2); if (must_wait || !qemu_co_queue_empty(&VAR_0->throttled_reqs[VAR_2])) { qemu_co_queue_wait(&VAR_0->throttled_reqs[VAR_2]); } throttle_account(&VAR_0->throttle_state, VAR_2, VAR_1); if (throttle_schedule_timer(&VAR_0->throttle_state, VAR_2)) { return; } qemu_co_queue_next(&VAR_0->throttled_reqs[VAR_2]); }
[ "static void FUNC_0(BlockDriverState *VAR_0,\nunsigned int VAR_1,\nbool VAR_2)\n{", "bool must_wait = throttle_schedule_timer(&VAR_0->throttle_state, VAR_2);", "if (must_wait ||\n!qemu_co_queue_empty(&VAR_0->throttled_reqs[VAR_2])) {", "qemu_co_queue_wait(&VAR_0->throttled_reqs[VAR_2]);", "}", "throttle_account(&VAR_0->throttle_state, VAR_2, VAR_1);", "if (throttle_schedule_timer(&VAR_0->throttle_state, VAR_2)) {", "return;", "}", "qemu_co_queue_next(&VAR_0->throttled_reqs[VAR_2]);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 11 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 29 ], [ 37 ], [ 39 ], [ 41 ], [ 47 ], [ 49 ] ]
2,088
static int parse_bintree(Indeo3DecodeContext *ctx, AVCodecContext *avctx, Plane *plane, int code, Cell *ref_cell, const int depth, const int strip_width) { Cell curr_cell; int bytes_used; if (depth <= 0) { av_log(avctx, AV_LOG_ERROR, "Stack overflow (corrupted binary tree)!\n"); return AVERROR_INVALIDDATA; // unwind recursion } curr_cell = *ref_cell; // clone parent cell if (code == H_SPLIT) { SPLIT_CELL(ref_cell->height, curr_cell.height); ref_cell->ypos += curr_cell.height; ref_cell->height -= curr_cell.height; } else if (code == V_SPLIT) { if (curr_cell.width > strip_width) { /* split strip */ curr_cell.width = (curr_cell.width <= (strip_width << 1) ? 1 : 2) * strip_width; } else SPLIT_CELL(ref_cell->width, curr_cell.width); ref_cell->xpos += curr_cell.width; ref_cell->width -= curr_cell.width; } while (1) { /* loop until return */ RESYNC_BITSTREAM; switch (code = get_bits(&ctx->gb, 2)) { case H_SPLIT: case V_SPLIT: if (parse_bintree(ctx, avctx, plane, code, &curr_cell, depth - 1, strip_width)) return AVERROR_INVALIDDATA; break; case INTRA_NULL: if (!curr_cell.tree) { /* MC tree INTRA code */ curr_cell.mv_ptr = 0; /* mark the current strip as INTRA */ curr_cell.tree = 1; /* enter the VQ tree */ } else { /* VQ tree NULL code */ RESYNC_BITSTREAM; code = get_bits(&ctx->gb, 2); if (code >= 2) { av_log(avctx, AV_LOG_ERROR, "Invalid VQ_NULL code: %d\n", code); return AVERROR_INVALIDDATA; } if (code == 1) av_log(avctx, AV_LOG_ERROR, "SkipCell procedure not implemented yet!\n"); CHECK_CELL copy_cell(ctx, plane, &curr_cell); return 0; } break; case INTER_DATA: if (!curr_cell.tree) { /* MC tree INTER code */ /* get motion vector index and setup the pointer to the mv set */ if (!ctx->need_resync) ctx->next_cell_data = &ctx->gb.buffer[(get_bits_count(&ctx->gb) + 7) >> 3]; curr_cell.mv_ptr = &ctx->mc_vectors[*(ctx->next_cell_data++) << 1]; curr_cell.tree = 1; /* enter the VQ tree */ UPDATE_BITPOS(8); } else { /* VQ tree DATA code */ if (!ctx->need_resync) ctx->next_cell_data = &ctx->gb.buffer[(get_bits_count(&ctx->gb) + 7) >> 3]; CHECK_CELL bytes_used = decode_cell(ctx, avctx, plane, &curr_cell, ctx->next_cell_data, ctx->last_byte); if (bytes_used < 0) return AVERROR_INVALIDDATA; UPDATE_BITPOS(bytes_used << 3); ctx->next_cell_data += bytes_used; return 0; } break; } }//while return 0; }
false
FFmpeg
e9e642cbfbf36285f60d1dba00103f068b077940
static int parse_bintree(Indeo3DecodeContext *ctx, AVCodecContext *avctx, Plane *plane, int code, Cell *ref_cell, const int depth, const int strip_width) { Cell curr_cell; int bytes_used; if (depth <= 0) { av_log(avctx, AV_LOG_ERROR, "Stack overflow (corrupted binary tree)!\n"); return AVERROR_INVALIDDATA; } curr_cell = *ref_cell; if (code == H_SPLIT) { SPLIT_CELL(ref_cell->height, curr_cell.height); ref_cell->ypos += curr_cell.height; ref_cell->height -= curr_cell.height; } else if (code == V_SPLIT) { if (curr_cell.width > strip_width) { curr_cell.width = (curr_cell.width <= (strip_width << 1) ? 1 : 2) * strip_width; } else SPLIT_CELL(ref_cell->width, curr_cell.width); ref_cell->xpos += curr_cell.width; ref_cell->width -= curr_cell.width; } while (1) { RESYNC_BITSTREAM; switch (code = get_bits(&ctx->gb, 2)) { case H_SPLIT: case V_SPLIT: if (parse_bintree(ctx, avctx, plane, code, &curr_cell, depth - 1, strip_width)) return AVERROR_INVALIDDATA; break; case INTRA_NULL: if (!curr_cell.tree) { curr_cell.mv_ptr = 0; curr_cell.tree = 1; } else { RESYNC_BITSTREAM; code = get_bits(&ctx->gb, 2); if (code >= 2) { av_log(avctx, AV_LOG_ERROR, "Invalid VQ_NULL code: %d\n", code); return AVERROR_INVALIDDATA; } if (code == 1) av_log(avctx, AV_LOG_ERROR, "SkipCell procedure not implemented yet!\n"); CHECK_CELL copy_cell(ctx, plane, &curr_cell); return 0; } break; case INTER_DATA: if (!curr_cell.tree) { if (!ctx->need_resync) ctx->next_cell_data = &ctx->gb.buffer[(get_bits_count(&ctx->gb) + 7) >> 3]; curr_cell.mv_ptr = &ctx->mc_vectors[*(ctx->next_cell_data++) << 1]; curr_cell.tree = 1; UPDATE_BITPOS(8); } else { if (!ctx->need_resync) ctx->next_cell_data = &ctx->gb.buffer[(get_bits_count(&ctx->gb) + 7) >> 3]; CHECK_CELL bytes_used = decode_cell(ctx, avctx, plane, &curr_cell, ctx->next_cell_data, ctx->last_byte); if (bytes_used < 0) return AVERROR_INVALIDDATA; UPDATE_BITPOS(bytes_used << 3); ctx->next_cell_data += bytes_used; return 0; } break; } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(Indeo3DecodeContext *VAR_0, AVCodecContext *VAR_1, Plane *VAR_2, int VAR_3, Cell *VAR_4, const int VAR_5, const int VAR_6) { Cell curr_cell; int VAR_7; if (VAR_5 <= 0) { av_log(VAR_1, AV_LOG_ERROR, "Stack overflow (corrupted binary tree)!\n"); return AVERROR_INVALIDDATA; } curr_cell = *VAR_4; if (VAR_3 == H_SPLIT) { SPLIT_CELL(VAR_4->height, curr_cell.height); VAR_4->ypos += curr_cell.height; VAR_4->height -= curr_cell.height; } else if (VAR_3 == V_SPLIT) { if (curr_cell.width > VAR_6) { curr_cell.width = (curr_cell.width <= (VAR_6 << 1) ? 1 : 2) * VAR_6; } else SPLIT_CELL(VAR_4->width, curr_cell.width); VAR_4->xpos += curr_cell.width; VAR_4->width -= curr_cell.width; } while (1) { RESYNC_BITSTREAM; switch (VAR_3 = get_bits(&VAR_0->gb, 2)) { case H_SPLIT: case V_SPLIT: if (FUNC_0(VAR_0, VAR_1, VAR_2, VAR_3, &curr_cell, VAR_5 - 1, VAR_6)) return AVERROR_INVALIDDATA; break; case INTRA_NULL: if (!curr_cell.tree) { curr_cell.mv_ptr = 0; curr_cell.tree = 1; } else { RESYNC_BITSTREAM; VAR_3 = get_bits(&VAR_0->gb, 2); if (VAR_3 >= 2) { av_log(VAR_1, AV_LOG_ERROR, "Invalid VQ_NULL VAR_3: %d\n", VAR_3); return AVERROR_INVALIDDATA; } if (VAR_3 == 1) av_log(VAR_1, AV_LOG_ERROR, "SkipCell procedure not implemented yet!\n"); CHECK_CELL copy_cell(VAR_0, VAR_2, &curr_cell); return 0; } break; case INTER_DATA: if (!curr_cell.tree) { if (!VAR_0->need_resync) VAR_0->next_cell_data = &VAR_0->gb.buffer[(get_bits_count(&VAR_0->gb) + 7) >> 3]; curr_cell.mv_ptr = &VAR_0->mc_vectors[*(VAR_0->next_cell_data++) << 1]; curr_cell.tree = 1; UPDATE_BITPOS(8); } else { if (!VAR_0->need_resync) VAR_0->next_cell_data = &VAR_0->gb.buffer[(get_bits_count(&VAR_0->gb) + 7) >> 3]; CHECK_CELL VAR_7 = decode_cell(VAR_0, VAR_1, VAR_2, &curr_cell, VAR_0->next_cell_data, VAR_0->last_byte); if (VAR_7 < 0) return AVERROR_INVALIDDATA; UPDATE_BITPOS(VAR_7 << 3); VAR_0->next_cell_data += VAR_7; return 0; } break; } } return 0; }
[ "static int FUNC_0(Indeo3DecodeContext *VAR_0, AVCodecContext *VAR_1,\nPlane *VAR_2, int VAR_3, Cell *VAR_4,\nconst int VAR_5, const int VAR_6)\n{", "Cell curr_cell;", "int VAR_7;", "if (VAR_5 <= 0) {", "av_log(VAR_1, AV_LOG_ERROR, \"Stack overflow (corrupted binary tree)!\\n\");", "return AVERROR_INVALIDDATA;", "}", "curr_cell = *VAR_4;", "if (VAR_3 == H_SPLIT) {", "SPLIT_CELL(VAR_4->height, curr_cell.height);", "VAR_4->ypos += curr_cell.height;", "VAR_4->height -= curr_cell.height;", "} else if (VAR_3 == V_SPLIT) {", "if (curr_cell.width > VAR_6) {", "curr_cell.width = (curr_cell.width <= (VAR_6 << 1) ? 1 : 2) * VAR_6;", "} else", "SPLIT_CELL(VAR_4->width, curr_cell.width);", "VAR_4->xpos += curr_cell.width;", "VAR_4->width -= curr_cell.width;", "}", "while (1) {", "RESYNC_BITSTREAM;", "switch (VAR_3 = get_bits(&VAR_0->gb, 2)) {", "case H_SPLIT:\ncase V_SPLIT:\nif (FUNC_0(VAR_0, VAR_1, VAR_2, VAR_3, &curr_cell, VAR_5 - 1, VAR_6))\nreturn AVERROR_INVALIDDATA;", "break;", "case INTRA_NULL:\nif (!curr_cell.tree) {", "curr_cell.mv_ptr = 0;", "curr_cell.tree = 1;", "} else {", "RESYNC_BITSTREAM;", "VAR_3 = get_bits(&VAR_0->gb, 2);", "if (VAR_3 >= 2) {", "av_log(VAR_1, AV_LOG_ERROR, \"Invalid VQ_NULL VAR_3: %d\\n\", VAR_3);", "return AVERROR_INVALIDDATA;", "}", "if (VAR_3 == 1)\nav_log(VAR_1, AV_LOG_ERROR, \"SkipCell procedure not implemented yet!\\n\");", "CHECK_CELL\ncopy_cell(VAR_0, VAR_2, &curr_cell);", "return 0;", "}", "break;", "case INTER_DATA:\nif (!curr_cell.tree) {", "if (!VAR_0->need_resync)\nVAR_0->next_cell_data = &VAR_0->gb.buffer[(get_bits_count(&VAR_0->gb) + 7) >> 3];", "curr_cell.mv_ptr = &VAR_0->mc_vectors[*(VAR_0->next_cell_data++) << 1];", "curr_cell.tree = 1;", "UPDATE_BITPOS(8);", "} else {", "if (!VAR_0->need_resync)\nVAR_0->next_cell_data = &VAR_0->gb.buffer[(get_bits_count(&VAR_0->gb) + 7) >> 3];", "CHECK_CELL\nVAR_7 = decode_cell(VAR_0, VAR_1, VAR_2, &curr_cell,\nVAR_0->next_cell_data, VAR_0->last_byte);", "if (VAR_7 < 0)\nreturn AVERROR_INVALIDDATA;", "UPDATE_BITPOS(VAR_7 << 3);", "VAR_0->next_cell_data += VAR_7;", "return 0;", "}", "break;", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63, 65, 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109, 111 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127, 129 ], [ 133, 135, 137 ], [ 139, 141 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ] ]
2,089
int64_t swr_next_pts(struct SwrContext *s, int64_t pts){ if(pts == INT64_MIN) return s->outpts; if(s->min_compensation >= FLT_MAX) { return (s->outpts = pts - swr_get_delay(s, s->in_sample_rate * (int64_t)s->out_sample_rate)); } else { int64_t delta = pts - swr_get_delay(s, s->in_sample_rate * (int64_t)s->out_sample_rate) - s->outpts; double fdelta = delta /(double)(s->in_sample_rate * (int64_t)s->out_sample_rate); if(fabs(fdelta) > s->min_compensation) { if(!s->outpts || fabs(fdelta) > s->min_hard_compensation){ int ret; if(delta > 0) ret = swr_inject_silence(s, delta / s->out_sample_rate); else ret = swr_drop_output (s, -delta / s-> in_sample_rate); if(ret<0){ av_log(s, AV_LOG_ERROR, "Failed to compensate for timestamp delta of %f\n", fdelta); } } else if(s->soft_compensation_duration && s->max_soft_compensation) { int duration = s->out_sample_rate * s->soft_compensation_duration; double max_soft_compensation = s->max_soft_compensation / (s->max_soft_compensation < 0 ? -s->in_sample_rate : 1); int comp = av_clipf(fdelta, -max_soft_compensation, max_soft_compensation) * duration ; av_log(s, AV_LOG_VERBOSE, "compensating audio timestamp drift:%f compensation:%d in:%d\n", fdelta, comp, duration); swr_set_compensation(s, comp, duration); } } return s->outpts; } }
false
FFmpeg
d676598f879ba01ddb62f9abe8e17b2e94cb91cd
int64_t swr_next_pts(struct SwrContext *s, int64_t pts){ if(pts == INT64_MIN) return s->outpts; if(s->min_compensation >= FLT_MAX) { return (s->outpts = pts - swr_get_delay(s, s->in_sample_rate * (int64_t)s->out_sample_rate)); } else { int64_t delta = pts - swr_get_delay(s, s->in_sample_rate * (int64_t)s->out_sample_rate) - s->outpts; double fdelta = delta /(double)(s->in_sample_rate * (int64_t)s->out_sample_rate); if(fabs(fdelta) > s->min_compensation) { if(!s->outpts || fabs(fdelta) > s->min_hard_compensation){ int ret; if(delta > 0) ret = swr_inject_silence(s, delta / s->out_sample_rate); else ret = swr_drop_output (s, -delta / s-> in_sample_rate); if(ret<0){ av_log(s, AV_LOG_ERROR, "Failed to compensate for timestamp delta of %f\n", fdelta); } } else if(s->soft_compensation_duration && s->max_soft_compensation) { int duration = s->out_sample_rate * s->soft_compensation_duration; double max_soft_compensation = s->max_soft_compensation / (s->max_soft_compensation < 0 ? -s->in_sample_rate : 1); int comp = av_clipf(fdelta, -max_soft_compensation, max_soft_compensation) * duration ; av_log(s, AV_LOG_VERBOSE, "compensating audio timestamp drift:%f compensation:%d in:%d\n", fdelta, comp, duration); swr_set_compensation(s, comp, duration); } } return s->outpts; } }
{ "code": [], "line_no": [] }
int64_t FUNC_0(struct SwrContext *s, int64_t pts){ if(pts == INT64_MIN) return s->outpts; if(s->min_compensation >= FLT_MAX) { return (s->outpts = pts - swr_get_delay(s, s->in_sample_rate * (int64_t)s->out_sample_rate)); } else { int64_t delta = pts - swr_get_delay(s, s->in_sample_rate * (int64_t)s->out_sample_rate) - s->outpts; double VAR_0 = delta /(double)(s->in_sample_rate * (int64_t)s->out_sample_rate); if(fabs(VAR_0) > s->min_compensation) { if(!s->outpts || fabs(VAR_0) > s->min_hard_compensation){ int VAR_1; if(delta > 0) VAR_1 = swr_inject_silence(s, delta / s->out_sample_rate); else VAR_1 = swr_drop_output (s, -delta / s-> in_sample_rate); if(VAR_1<0){ av_log(s, AV_LOG_ERROR, "Failed to compensate for timestamp delta of %f\n", VAR_0); } } else if(s->soft_compensation_duration && s->VAR_3) { int VAR_2 = s->out_sample_rate * s->soft_compensation_duration; double VAR_3 = s->VAR_3 / (s->VAR_3 < 0 ? -s->in_sample_rate : 1); int VAR_4 = av_clipf(VAR_0, -VAR_3, VAR_3) * VAR_2 ; av_log(s, AV_LOG_VERBOSE, "compensating audio timestamp drift:%f compensation:%d in:%d\n", VAR_0, VAR_4, VAR_2); swr_set_compensation(s, VAR_4, VAR_2); } } return s->outpts; } }
[ "int64_t FUNC_0(struct SwrContext *s, int64_t pts){", "if(pts == INT64_MIN)\nreturn s->outpts;", "if(s->min_compensation >= FLT_MAX) {", "return (s->outpts = pts - swr_get_delay(s, s->in_sample_rate * (int64_t)s->out_sample_rate));", "} else {", "int64_t delta = pts - swr_get_delay(s, s->in_sample_rate * (int64_t)s->out_sample_rate) - s->outpts;", "double VAR_0 = delta /(double)(s->in_sample_rate * (int64_t)s->out_sample_rate);", "if(fabs(VAR_0) > s->min_compensation) {", "if(!s->outpts || fabs(VAR_0) > s->min_hard_compensation){", "int VAR_1;", "if(delta > 0) VAR_1 = swr_inject_silence(s, delta / s->out_sample_rate);", "else VAR_1 = swr_drop_output (s, -delta / s-> in_sample_rate);", "if(VAR_1<0){", "av_log(s, AV_LOG_ERROR, \"Failed to compensate for timestamp delta of %f\\n\", VAR_0);", "}", "} else if(s->soft_compensation_duration && s->VAR_3) {", "int VAR_2 = s->out_sample_rate * s->soft_compensation_duration;", "double VAR_3 = s->VAR_3 / (s->VAR_3 < 0 ? -s->in_sample_rate : 1);", "int VAR_4 = av_clipf(VAR_0, -VAR_3, VAR_3) * VAR_2 ;", "av_log(s, AV_LOG_VERBOSE, \"compensating audio timestamp drift:%f compensation:%d in:%d\\n\", VAR_0, VAR_4, VAR_2);", "swr_set_compensation(s, VAR_4, VAR_2);", "}", "}", "return s->outpts;", "}", "}" ]
[ 0, 0, 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 ], [ 53 ], [ 55 ], [ 57 ] ]
2,090
int av_utf8_decode(int32_t *codep, const uint8_t **bufp, const uint8_t *buf_end, unsigned int flags) { const uint8_t *p = *bufp; uint32_t top; uint64_t code; int ret = 0; if (p >= buf_end) return 0; code = *p++; /* first sequence byte starts with 10, or is 1111-1110 or 1111-1111, which is not admitted */ if ((code & 0xc0) == 0x80 || code >= 0xFE) { ret = AVERROR(EILSEQ); goto end; } top = (code & 128) >> 1; while (code & top) { int tmp; if (p >= buf_end) { (*bufp) ++; return AVERROR(EILSEQ); /* incomplete sequence */ } /* we assume the byte to be in the form 10xx-xxxx */ tmp = *p++ - 128; /* strip leading 1 */ if (tmp>>6) { (*bufp) ++; return AVERROR(EILSEQ); } code = (code<<6) + tmp; top <<= 5; } code &= (top << 1) - 1; if (code >= 1<<31) { ret = AVERROR(EILSEQ); /* out-of-range value */ goto end; } *codep = code; if (code > 0x10FFFF && !(flags & AV_UTF8_FLAG_ACCEPT_INVALID_BIG_CODES)) ret = AVERROR(EILSEQ); if (code < 0x20 && code != 0x9 && code != 0xA && code != 0xD && flags & AV_UTF8_FLAG_EXCLUDE_XML_INVALID_CONTROL_CODES) ret = AVERROR(EILSEQ); if (code >= 0xD800 && code <= 0xDFFF && !(flags & AV_UTF8_FLAG_ACCEPT_SURROGATES)) ret = AVERROR(EILSEQ); if ((code == 0xFFFE || code == 0xFFFF) && !(flags & AV_UTF8_FLAG_ACCEPT_NON_CHARACTERS)) ret = AVERROR(EILSEQ); end: *bufp = p; return ret; }
false
FFmpeg
d4ec07dfe7dbc86e8f6403781c511b9463a526d2
int av_utf8_decode(int32_t *codep, const uint8_t **bufp, const uint8_t *buf_end, unsigned int flags) { const uint8_t *p = *bufp; uint32_t top; uint64_t code; int ret = 0; if (p >= buf_end) return 0; code = *p++; if ((code & 0xc0) == 0x80 || code >= 0xFE) { ret = AVERROR(EILSEQ); goto end; } top = (code & 128) >> 1; while (code & top) { int tmp; if (p >= buf_end) { (*bufp) ++; return AVERROR(EILSEQ); } tmp = *p++ - 128; if (tmp>>6) { (*bufp) ++; return AVERROR(EILSEQ); } code = (code<<6) + tmp; top <<= 5; } code &= (top << 1) - 1; if (code >= 1<<31) { ret = AVERROR(EILSEQ); goto end; } *codep = code; if (code > 0x10FFFF && !(flags & AV_UTF8_FLAG_ACCEPT_INVALID_BIG_CODES)) ret = AVERROR(EILSEQ); if (code < 0x20 && code != 0x9 && code != 0xA && code != 0xD && flags & AV_UTF8_FLAG_EXCLUDE_XML_INVALID_CONTROL_CODES) ret = AVERROR(EILSEQ); if (code >= 0xD800 && code <= 0xDFFF && !(flags & AV_UTF8_FLAG_ACCEPT_SURROGATES)) ret = AVERROR(EILSEQ); if ((code == 0xFFFE || code == 0xFFFF) && !(flags & AV_UTF8_FLAG_ACCEPT_NON_CHARACTERS)) ret = AVERROR(EILSEQ); end: *bufp = p; return ret; }
{ "code": [], "line_no": [] }
int FUNC_0(int32_t *VAR_0, const uint8_t **VAR_1, const uint8_t *VAR_2, unsigned int VAR_3) { const uint8_t *VAR_4 = *VAR_1; uint32_t top; uint64_t code; int VAR_5 = 0; if (VAR_4 >= VAR_2) return 0; code = *VAR_4++; if ((code & 0xc0) == 0x80 || code >= 0xFE) { VAR_5 = AVERROR(EILSEQ); goto end; } top = (code & 128) >> 1; while (code & top) { int VAR_6; if (VAR_4 >= VAR_2) { (*VAR_1) ++; return AVERROR(EILSEQ); } VAR_6 = *VAR_4++ - 128; if (VAR_6>>6) { (*VAR_1) ++; return AVERROR(EILSEQ); } code = (code<<6) + VAR_6; top <<= 5; } code &= (top << 1) - 1; if (code >= 1<<31) { VAR_5 = AVERROR(EILSEQ); goto end; } *VAR_0 = code; if (code > 0x10FFFF && !(VAR_3 & AV_UTF8_FLAG_ACCEPT_INVALID_BIG_CODES)) VAR_5 = AVERROR(EILSEQ); if (code < 0x20 && code != 0x9 && code != 0xA && code != 0xD && VAR_3 & AV_UTF8_FLAG_EXCLUDE_XML_INVALID_CONTROL_CODES) VAR_5 = AVERROR(EILSEQ); if (code >= 0xD800 && code <= 0xDFFF && !(VAR_3 & AV_UTF8_FLAG_ACCEPT_SURROGATES)) VAR_5 = AVERROR(EILSEQ); if ((code == 0xFFFE || code == 0xFFFF) && !(VAR_3 & AV_UTF8_FLAG_ACCEPT_NON_CHARACTERS)) VAR_5 = AVERROR(EILSEQ); end: *VAR_1 = VAR_4; return VAR_5; }
[ "int FUNC_0(int32_t *VAR_0, const uint8_t **VAR_1, const uint8_t *VAR_2,\nunsigned int VAR_3)\n{", "const uint8_t *VAR_4 = *VAR_1;", "uint32_t top;", "uint64_t code;", "int VAR_5 = 0;", "if (VAR_4 >= VAR_2)\nreturn 0;", "code = *VAR_4++;", "if ((code & 0xc0) == 0x80 || code >= 0xFE) {", "VAR_5 = AVERROR(EILSEQ);", "goto end;", "}", "top = (code & 128) >> 1;", "while (code & top) {", "int VAR_6;", "if (VAR_4 >= VAR_2) {", "(*VAR_1) ++;", "return AVERROR(EILSEQ);", "}", "VAR_6 = *VAR_4++ - 128;", "if (VAR_6>>6) {", "(*VAR_1) ++;", "return AVERROR(EILSEQ);", "}", "code = (code<<6) + VAR_6;", "top <<= 5;", "}", "code &= (top << 1) - 1;", "if (code >= 1<<31) {", "VAR_5 = AVERROR(EILSEQ);", "goto end;", "}", "*VAR_0 = code;", "if (code > 0x10FFFF &&\n!(VAR_3 & AV_UTF8_FLAG_ACCEPT_INVALID_BIG_CODES))\nVAR_5 = AVERROR(EILSEQ);", "if (code < 0x20 && code != 0x9 && code != 0xA && code != 0xD &&\nVAR_3 & AV_UTF8_FLAG_EXCLUDE_XML_INVALID_CONTROL_CODES)\nVAR_5 = AVERROR(EILSEQ);", "if (code >= 0xD800 && code <= 0xDFFF &&\n!(VAR_3 & AV_UTF8_FLAG_ACCEPT_SURROGATES))\nVAR_5 = AVERROR(EILSEQ);", "if ((code == 0xFFFE || code == 0xFFFF) &&\n!(VAR_3 & AV_UTF8_FLAG_ACCEPT_NON_CHARACTERS))\nVAR_5 = AVERROR(EILSEQ);", "end:\n*VAR_1 = VAR_4;", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 23 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 93, 95, 97 ], [ 99, 101, 103 ], [ 105, 107, 109 ], [ 111, 113, 115 ], [ 119, 121 ], [ 123 ], [ 125 ] ]
2,092
static av_always_inline av_flatten void h264_loop_filter_luma_intra_c(uint8_t *pix, int xstride, int ystride, int alpha, int beta) { int d; for( d = 0; d < 16; d++ ) { const int p2 = pix[-3*xstride]; const int p1 = pix[-2*xstride]; const int p0 = pix[-1*xstride]; const int q0 = pix[ 0*xstride]; const int q1 = pix[ 1*xstride]; const int q2 = pix[ 2*xstride]; if( FFABS( p0 - q0 ) < alpha && FFABS( p1 - p0 ) < beta && FFABS( q1 - q0 ) < beta ) { if(FFABS( p0 - q0 ) < (( alpha >> 2 ) + 2 )){ if( FFABS( p2 - p0 ) < beta) { const int p3 = pix[-4*xstride]; /* p0', p1', p2' */ pix[-1*xstride] = ( p2 + 2*p1 + 2*p0 + 2*q0 + q1 + 4 ) >> 3; pix[-2*xstride] = ( p2 + p1 + p0 + q0 + 2 ) >> 2; pix[-3*xstride] = ( 2*p3 + 3*p2 + p1 + p0 + q0 + 4 ) >> 3; } else { /* p0' */ pix[-1*xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2; } if( FFABS( q2 - q0 ) < beta) { const int q3 = pix[3*xstride]; /* q0', q1', q2' */ pix[0*xstride] = ( p1 + 2*p0 + 2*q0 + 2*q1 + q2 + 4 ) >> 3; pix[1*xstride] = ( p0 + q0 + q1 + q2 + 2 ) >> 2; pix[2*xstride] = ( 2*q3 + 3*q2 + q1 + q0 + p0 + 4 ) >> 3; } else { /* q0' */ pix[0*xstride] = ( 2*q1 + q0 + p1 + 2 ) >> 2; } }else{ /* p0', q0' */ pix[-1*xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2; pix[ 0*xstride] = ( 2*q1 + q0 + p1 + 2 ) >> 2; } } pix += ystride; } }
false
FFmpeg
dd561441b1e849df7d8681c6f32af82d4088dafd
static av_always_inline av_flatten void h264_loop_filter_luma_intra_c(uint8_t *pix, int xstride, int ystride, int alpha, int beta) { int d; for( d = 0; d < 16; d++ ) { const int p2 = pix[-3*xstride]; const int p1 = pix[-2*xstride]; const int p0 = pix[-1*xstride]; const int q0 = pix[ 0*xstride]; const int q1 = pix[ 1*xstride]; const int q2 = pix[ 2*xstride]; if( FFABS( p0 - q0 ) < alpha && FFABS( p1 - p0 ) < beta && FFABS( q1 - q0 ) < beta ) { if(FFABS( p0 - q0 ) < (( alpha >> 2 ) + 2 )){ if( FFABS( p2 - p0 ) < beta) { const int p3 = pix[-4*xstride]; pix[-1*xstride] = ( p2 + 2*p1 + 2*p0 + 2*q0 + q1 + 4 ) >> 3; pix[-2*xstride] = ( p2 + p1 + p0 + q0 + 2 ) >> 2; pix[-3*xstride] = ( 2*p3 + 3*p2 + p1 + p0 + q0 + 4 ) >> 3; } else { pix[-1*xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2; } if( FFABS( q2 - q0 ) < beta) { const int q3 = pix[3*xstride]; pix[0*xstride] = ( p1 + 2*p0 + 2*q0 + 2*q1 + q2 + 4 ) >> 3; pix[1*xstride] = ( p0 + q0 + q1 + q2 + 2 ) >> 2; pix[2*xstride] = ( 2*q3 + 3*q2 + q1 + q0 + p0 + 4 ) >> 3; } else { pix[0*xstride] = ( 2*q1 + q0 + p1 + 2 ) >> 2; } }else{ pix[-1*xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2; pix[ 0*xstride] = ( 2*q1 + q0 + p1 + 2 ) >> 2; } } pix += ystride; } }
{ "code": [], "line_no": [] }
static av_always_inline VAR_0 void FUNC_0(uint8_t *VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5) { int VAR_6; for( VAR_6 = 0; VAR_6 < 16; VAR_6++ ) { const int VAR_7 = VAR_1[-3*VAR_2]; const int VAR_8 = VAR_1[-2*VAR_2]; const int VAR_9 = VAR_1[-1*VAR_2]; const int VAR_10 = VAR_1[ 0*VAR_2]; const int VAR_11 = VAR_1[ 1*VAR_2]; const int VAR_12 = VAR_1[ 2*VAR_2]; if( FFABS( VAR_9 - VAR_10 ) < VAR_4 && FFABS( VAR_8 - VAR_9 ) < VAR_5 && FFABS( VAR_11 - VAR_10 ) < VAR_5 ) { if(FFABS( VAR_9 - VAR_10 ) < (( VAR_4 >> 2 ) + 2 )){ if( FFABS( VAR_7 - VAR_9 ) < VAR_5) { const int VAR_13 = VAR_1[-4*VAR_2]; VAR_1[-1*VAR_2] = ( VAR_7 + 2*VAR_8 + 2*VAR_9 + 2*VAR_10 + VAR_11 + 4 ) >> 3; VAR_1[-2*VAR_2] = ( VAR_7 + VAR_8 + VAR_9 + VAR_10 + 2 ) >> 2; VAR_1[-3*VAR_2] = ( 2*VAR_13 + 3*VAR_7 + VAR_8 + VAR_9 + VAR_10 + 4 ) >> 3; } else { VAR_1[-1*VAR_2] = ( 2*VAR_8 + VAR_9 + VAR_11 + 2 ) >> 2; } if( FFABS( VAR_12 - VAR_10 ) < VAR_5) { const int VAR_14 = VAR_1[3*VAR_2]; VAR_1[0*VAR_2] = ( VAR_8 + 2*VAR_9 + 2*VAR_10 + 2*VAR_11 + VAR_12 + 4 ) >> 3; VAR_1[1*VAR_2] = ( VAR_9 + VAR_10 + VAR_11 + VAR_12 + 2 ) >> 2; VAR_1[2*VAR_2] = ( 2*VAR_14 + 3*VAR_12 + VAR_11 + VAR_10 + VAR_9 + 4 ) >> 3; } else { VAR_1[0*VAR_2] = ( 2*VAR_11 + VAR_10 + VAR_8 + 2 ) >> 2; } }else{ VAR_1[-1*VAR_2] = ( 2*VAR_8 + VAR_9 + VAR_11 + 2 ) >> 2; VAR_1[ 0*VAR_2] = ( 2*VAR_11 + VAR_10 + VAR_8 + 2 ) >> 2; } } VAR_1 += VAR_3; } }
[ "static av_always_inline VAR_0 void FUNC_0(uint8_t *VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5)\n{", "int VAR_6;", "for( VAR_6 = 0; VAR_6 < 16; VAR_6++ ) {", "const int VAR_7 = VAR_1[-3*VAR_2];", "const int VAR_8 = VAR_1[-2*VAR_2];", "const int VAR_9 = VAR_1[-1*VAR_2];", "const int VAR_10 = VAR_1[ 0*VAR_2];", "const int VAR_11 = VAR_1[ 1*VAR_2];", "const int VAR_12 = VAR_1[ 2*VAR_2];", "if( FFABS( VAR_9 - VAR_10 ) < VAR_4 &&\nFFABS( VAR_8 - VAR_9 ) < VAR_5 &&\nFFABS( VAR_11 - VAR_10 ) < VAR_5 ) {", "if(FFABS( VAR_9 - VAR_10 ) < (( VAR_4 >> 2 ) + 2 )){", "if( FFABS( VAR_7 - VAR_9 ) < VAR_5)\n{", "const int VAR_13 = VAR_1[-4*VAR_2];", "VAR_1[-1*VAR_2] = ( VAR_7 + 2*VAR_8 + 2*VAR_9 + 2*VAR_10 + VAR_11 + 4 ) >> 3;", "VAR_1[-2*VAR_2] = ( VAR_7 + VAR_8 + VAR_9 + VAR_10 + 2 ) >> 2;", "VAR_1[-3*VAR_2] = ( 2*VAR_13 + 3*VAR_7 + VAR_8 + VAR_9 + VAR_10 + 4 ) >> 3;", "} else {", "VAR_1[-1*VAR_2] = ( 2*VAR_8 + VAR_9 + VAR_11 + 2 ) >> 2;", "}", "if( FFABS( VAR_12 - VAR_10 ) < VAR_5)\n{", "const int VAR_14 = VAR_1[3*VAR_2];", "VAR_1[0*VAR_2] = ( VAR_8 + 2*VAR_9 + 2*VAR_10 + 2*VAR_11 + VAR_12 + 4 ) >> 3;", "VAR_1[1*VAR_2] = ( VAR_9 + VAR_10 + VAR_11 + VAR_12 + 2 ) >> 2;", "VAR_1[2*VAR_2] = ( 2*VAR_14 + 3*VAR_12 + VAR_11 + VAR_10 + VAR_9 + 4 ) >> 3;", "} else {", "VAR_1[0*VAR_2] = ( 2*VAR_11 + VAR_10 + VAR_8 + 2 ) >> 2;", "}", "}else{", "VAR_1[-1*VAR_2] = ( 2*VAR_8 + VAR_9 + VAR_11 + 2 ) >> 2;", "VAR_1[ 0*VAR_2] = ( 2*VAR_11 + VAR_10 + VAR_8 + 2 ) >> 2;", "}", "}", "VAR_1 += 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25, 27, 29 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ] ]
2,094
static void sigbus_handler(int signal) { siglongjmp(sigjump, 1); }
true
qemu
1e356fc14beaa3ece6c0e961bd479af58be3198b
static void sigbus_handler(int signal) { siglongjmp(sigjump, 1); }
{ "code": [ " siglongjmp(sigjump, 1);" ], "line_no": [ 5 ] }
static void FUNC_0(int VAR_0) { siglongjmp(sigjump, 1); }
[ "static void FUNC_0(int VAR_0)\n{", "siglongjmp(sigjump, 1);", "}" ]
[ 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
2,095
void fw_cfg_add_bytes(FWCfgState *s, uint16_t key, uint8_t *data, uint32_t len) { int arch = !!(key & FW_CFG_ARCH_LOCAL); key &= FW_CFG_ENTRY_MASK; assert(key < FW_CFG_MAX_ENTRY); s->entries[arch][key].data = data; s->entries[arch][key].len = len; }
true
qemu
089da572b956ef0f8f5b8d5917358e07892a77c2
void fw_cfg_add_bytes(FWCfgState *s, uint16_t key, uint8_t *data, uint32_t len) { int arch = !!(key & FW_CFG_ARCH_LOCAL); key &= FW_CFG_ENTRY_MASK; assert(key < FW_CFG_MAX_ENTRY); s->entries[arch][key].data = data; s->entries[arch][key].len = len; }
{ "code": [ "void fw_cfg_add_bytes(FWCfgState *s, uint16_t key, uint8_t *data, uint32_t len)", " assert(key < FW_CFG_MAX_ENTRY);", " s->entries[arch][key].len = len;", " s->entries[arch][key].len = len;" ], "line_no": [ 1, 13, 19, 19 ] }
void FUNC_0(FWCfgState *VAR_0, uint16_t VAR_1, uint8_t *VAR_2, uint32_t VAR_3) { int VAR_4 = !!(VAR_1 & FW_CFG_ARCH_LOCAL); VAR_1 &= FW_CFG_ENTRY_MASK; assert(VAR_1 < FW_CFG_MAX_ENTRY); VAR_0->entries[VAR_4][VAR_1].VAR_2 = VAR_2; VAR_0->entries[VAR_4][VAR_1].VAR_3 = VAR_3; }
[ "void FUNC_0(FWCfgState *VAR_0, uint16_t VAR_1, uint8_t *VAR_2, uint32_t VAR_3)\n{", "int VAR_4 = !!(VAR_1 & FW_CFG_ARCH_LOCAL);", "VAR_1 &= FW_CFG_ENTRY_MASK;", "assert(VAR_1 < FW_CFG_MAX_ENTRY);", "VAR_0->entries[VAR_4][VAR_1].VAR_2 = VAR_2;", "VAR_0->entries[VAR_4][VAR_1].VAR_3 = VAR_3;", "}" ]
[ 1, 0, 0, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ] ]
2,096
static void set_bmc_global_enables(IPMIBmcSim *ibs, uint8_t *cmd, unsigned int cmd_len, uint8_t *rsp, unsigned int *rsp_len, unsigned int max_rsp_len) { IPMI_CHECK_CMD_LEN(3); set_global_enables(ibs, cmd[2]); }
true
qemu
4f298a4b2957b7833bc607c951ca27c458d98d88
static void set_bmc_global_enables(IPMIBmcSim *ibs, uint8_t *cmd, unsigned int cmd_len, uint8_t *rsp, unsigned int *rsp_len, unsigned int max_rsp_len) { IPMI_CHECK_CMD_LEN(3); set_global_enables(ibs, cmd[2]); }
{ "code": [ " IPMI_CHECK_CMD_LEN(3);", " IPMI_CHECK_CMD_LEN(3);", " IPMI_CHECK_CMD_LEN(3);", " IPMI_CHECK_CMD_LEN(3);", " IPMI_CHECK_CMD_LEN(3);", " IPMI_CHECK_CMD_LEN(3);", " IPMI_CHECK_CMD_LEN(3);", " IPMI_CHECK_CMD_LEN(3);" ], "line_no": [ 11, 11, 11, 11, 11, 11, 11, 11 ] }
static void FUNC_0(IPMIBmcSim *VAR_0, uint8_t *VAR_1, unsigned int VAR_2, uint8_t *VAR_3, unsigned int *VAR_4, unsigned int VAR_5) { IPMI_CHECK_CMD_LEN(3); set_global_enables(VAR_0, VAR_1[2]); }
[ "static void FUNC_0(IPMIBmcSim *VAR_0,\nuint8_t *VAR_1, unsigned int VAR_2,\nuint8_t *VAR_3, unsigned int *VAR_4,\nunsigned int VAR_5)\n{", "IPMI_CHECK_CMD_LEN(3);", "set_global_enables(VAR_0, VAR_1[2]);", "}" ]
[ 0, 1, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ] ]
2,097
static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size, int parse_extradata) { AVCodecContext *const avctx = h->avctx; H264SliceContext *sl; int buf_index; unsigned context_count; int next_avc; int nals_needed = 0; ///< number of NALs that need decoding before the next frame thread starts int nal_index; int idr_cleared=0; int ret = 0; h->nal_unit_type= 0; if(!h->slice_context_count) h->slice_context_count= 1; h->max_contexts = h->slice_context_count; if (!(avctx->flags2 & AV_CODEC_FLAG2_CHUNKS)) { h->current_slice = 0; if (!h->first_field) h->cur_pic_ptr = NULL; ff_h264_reset_sei(h); if (h->nal_length_size == 4) { if (buf_size > 8 && AV_RB32(buf) == 1 && AV_RB32(buf+5) > (unsigned)buf_size) { h->is_avc = 0; }else if(buf_size > 3 && AV_RB32(buf) > 1 && AV_RB32(buf) <= (unsigned)buf_size) h->is_avc = 1; if (avctx->active_thread_type & FF_THREAD_FRAME) nals_needed = get_last_needed_nal(h, buf, buf_size); { buf_index = 0; context_count = 0; next_avc = h->is_avc ? 0 : buf_size; nal_index = 0; for (;;) { int consumed; int dst_length; int bit_length; const uint8_t *ptr; int nalsize = 0; int err; if (buf_index >= next_avc) { nalsize = get_avc_nalsize(h, buf, buf_size, &buf_index); if (nalsize < 0) break; next_avc = buf_index + nalsize; } else { buf_index = find_start_code(buf, buf_size, buf_index, next_avc); if (buf_index >= buf_size) break; if (buf_index >= next_avc) continue; sl = &h->slice_ctx[context_count]; ptr = ff_h264_decode_nal(h, sl, buf + buf_index, &dst_length, &consumed, next_avc - buf_index); if (!ptr || dst_length < 0) { ret = -1; goto end; bit_length = get_bit_length(h, buf, ptr, dst_length, buf_index + consumed, next_avc); if (h->avctx->debug & FF_DEBUG_STARTCODE) av_log(h->avctx, AV_LOG_DEBUG, "NAL %d/%d at %d/%d length %d\n", h->nal_unit_type, h->nal_ref_idc, buf_index, buf_size, dst_length); if (h->is_avc && (nalsize != consumed) && nalsize) av_log(h->avctx, AV_LOG_DEBUG, "AVC: Consumed only %d bytes instead of %d\n", consumed, nalsize); buf_index += consumed; nal_index++; if (avctx->skip_frame >= AVDISCARD_NONREF && h->nal_ref_idc == 0 && h->nal_unit_type != NAL_SEI) continue; again: /* Ignore per frame NAL unit type during extradata * parsing. Decoding slices is not possible in codec init * with frame-mt */ if (parse_extradata) { switch (h->nal_unit_type) { case NAL_IDR_SLICE: case NAL_SLICE: case NAL_DPA: case NAL_DPB: case NAL_DPC: av_log(h->avctx, AV_LOG_WARNING, "Ignoring NAL %d in global header/extradata\n", h->nal_unit_type); // fall through to next case case NAL_AUXILIARY_SLICE: h->nal_unit_type = NAL_FF_IGNORE; err = 0; switch (h->nal_unit_type) { case NAL_IDR_SLICE: if ((ptr[0] & 0xFC) == 0x98) { av_log(h->avctx, AV_LOG_ERROR, "Invalid inter IDR frame\n"); h->next_outputed_poc = INT_MIN; ret = -1; goto end; if (h->nal_unit_type != NAL_IDR_SLICE) { av_log(h->avctx, AV_LOG_ERROR, "Invalid mix of idr and non-idr slices\n"); ret = -1; goto end; if(!idr_cleared) { if (h->current_slice && (avctx->active_thread_type & FF_THREAD_SLICE)) { av_log(h, AV_LOG_ERROR, "invalid mixed IDR / non IDR frames cannot be decoded in slice multithreading mode\n"); ret = AVERROR_INVALIDDATA; goto end; idr(h); // FIXME ensure we don't lose some frames if there is reordering idr_cleared = 1; h->has_recovery_point = 1; case NAL_SLICE: init_get_bits(&sl->gb, ptr, bit_length); if ( nals_needed >= nal_index || (!(avctx->active_thread_type & FF_THREAD_FRAME) && !context_count)) h->au_pps_id = -1; if ((err = ff_h264_decode_slice_header(h, sl))) break; if (h->sei_recovery_frame_cnt >= 0) { if (h->frame_num != h->sei_recovery_frame_cnt || sl->slice_type_nos != AV_PICTURE_TYPE_I) h->valid_recovery_point = 1; if ( h->recovery_frame < 0 || av_mod_uintp2(h->recovery_frame - h->frame_num, h->sps.log2_max_frame_num) > h->sei_recovery_frame_cnt) { h->recovery_frame = av_mod_uintp2(h->frame_num + h->sei_recovery_frame_cnt, h->sps.log2_max_frame_num); if (!h->valid_recovery_point) h->recovery_frame = h->frame_num; h->cur_pic_ptr->f->key_frame |= (h->nal_unit_type == NAL_IDR_SLICE); if (h->nal_unit_type == NAL_IDR_SLICE || h->recovery_frame == h->frame_num) { h->recovery_frame = -1; h->cur_pic_ptr->recovered = 1; // If we have an IDR, all frames after it in decoded order are // "recovered". if (h->nal_unit_type == NAL_IDR_SLICE) h->frame_recovered |= FRAME_RECOVERED_IDR; #if 1 h->cur_pic_ptr->recovered |= h->frame_recovered; #else h->cur_pic_ptr->recovered |= !!(h->frame_recovered & FRAME_RECOVERED_IDR); #endif if (h->current_slice == 1) { if (!(avctx->flags2 & AV_CODEC_FLAG2_CHUNKS)) decode_postinit(h, nal_index >= nals_needed); if (h->avctx->hwaccel && (ret = h->avctx->hwaccel->start_frame(h->avctx, buf, buf_size)) < 0) goto end; #if FF_API_CAP_VDPAU if (CONFIG_H264_VDPAU_DECODER && h->avctx->codec->capabilities & AV_CODEC_CAP_HWACCEL_VDPAU) ff_vdpau_h264_picture_start(h); #endif if (sl->redundant_pic_count == 0) { if (avctx->hwaccel) { ret = avctx->hwaccel->decode_slice(avctx, &buf[buf_index - consumed], consumed); if (ret < 0) goto end; #if FF_API_CAP_VDPAU } else if (CONFIG_H264_VDPAU_DECODER && h->avctx->codec->capabilities & AV_CODEC_CAP_HWACCEL_VDPAU) { ff_vdpau_add_data_chunk(h->cur_pic_ptr->f->data[0], start_code, sizeof(start_code)); ff_vdpau_add_data_chunk(h->cur_pic_ptr->f->data[0], &buf[buf_index - consumed], consumed); #endif context_count++; break; case NAL_DPA: case NAL_DPB: case NAL_DPC: avpriv_request_sample(avctx, "data partitioning"); break; case NAL_SEI: init_get_bits(&h->gb, ptr, bit_length); ret = ff_h264_decode_sei(h); if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE)) goto end; break; case NAL_SPS: init_get_bits(&h->gb, ptr, bit_length); if (ff_h264_decode_seq_parameter_set(h, 0) >= 0) break; if (h->is_avc ? nalsize : 1) { av_log(h->avctx, AV_LOG_DEBUG, "SPS decoding failure, trying again with the complete NAL\n"); if (h->is_avc) av_assert0(next_avc - buf_index + consumed == nalsize); if ((next_avc - buf_index + consumed - 1) >= INT_MAX/8) break; init_get_bits(&h->gb, &buf[buf_index + 1 - consumed], 8*(next_avc - buf_index + consumed - 1)); if (ff_h264_decode_seq_parameter_set(h, 0) >= 0) break; init_get_bits(&h->gb, ptr, bit_length); ff_h264_decode_seq_parameter_set(h, 1); break; case NAL_PPS: init_get_bits(&h->gb, ptr, bit_length); ret = ff_h264_decode_picture_parameter_set(h, bit_length); if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE)) goto end; break; case NAL_AUD: case NAL_END_SEQUENCE: case NAL_END_STREAM: case NAL_FILLER_DATA: case NAL_SPS_EXT: case NAL_AUXILIARY_SLICE: break; case NAL_FF_IGNORE: break; default: av_log(avctx, AV_LOG_DEBUG, "Unknown NAL code: %d (%d bits)\n", h->nal_unit_type, bit_length); if (context_count == h->max_contexts) { ret = ff_h264_execute_decode_slices(h, context_count); if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE)) goto end; context_count = 0; if (err < 0 || err == SLICE_SKIPED) { if (err < 0) av_log(h->avctx, AV_LOG_ERROR, "decode_slice_header error\n"); sl->ref_count[0] = sl->ref_count[1] = sl->list_count = 0; } else if (err == SLICE_SINGLETHREAD) { if (context_count > 1) { ret = ff_h264_execute_decode_slices(h, context_count - 1); if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE)) goto end; context_count = 0; /* Slice could not be decoded in parallel mode, restart. Note * that rbsp_buffer is not transferred, but since we no longer * run in parallel mode this should not be an issue. */ sl = &h->slice_ctx[0]; goto again; if (context_count) { ret = ff_h264_execute_decode_slices(h, context_count); if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE)) goto end; ret = 0; end: /* clean up */ if (h->cur_pic_ptr && !h->droppable) { ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, h->picture_structure == PICT_BOTTOM_FIELD); return (ret < 0) ? ret : buf_index;
true
FFmpeg
98a0053d0f90e3309dc1038b1bae3a48bbd9067c
static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size, int parse_extradata) { AVCodecContext *const avctx = h->avctx; H264SliceContext *sl; int buf_index; unsigned context_count; int next_avc; int nals_needed = 0; int nal_index; int idr_cleared=0; int ret = 0; h->nal_unit_type= 0; if(!h->slice_context_count) h->slice_context_count= 1; h->max_contexts = h->slice_context_count; if (!(avctx->flags2 & AV_CODEC_FLAG2_CHUNKS)) { h->current_slice = 0; if (!h->first_field) h->cur_pic_ptr = NULL; ff_h264_reset_sei(h); if (h->nal_length_size == 4) { if (buf_size > 8 && AV_RB32(buf) == 1 && AV_RB32(buf+5) > (unsigned)buf_size) { h->is_avc = 0; }else if(buf_size > 3 && AV_RB32(buf) > 1 && AV_RB32(buf) <= (unsigned)buf_size) h->is_avc = 1; if (avctx->active_thread_type & FF_THREAD_FRAME) nals_needed = get_last_needed_nal(h, buf, buf_size); { buf_index = 0; context_count = 0; next_avc = h->is_avc ? 0 : buf_size; nal_index = 0; for (;;) { int consumed; int dst_length; int bit_length; const uint8_t *ptr; int nalsize = 0; int err; if (buf_index >= next_avc) { nalsize = get_avc_nalsize(h, buf, buf_size, &buf_index); if (nalsize < 0) break; next_avc = buf_index + nalsize; } else { buf_index = find_start_code(buf, buf_size, buf_index, next_avc); if (buf_index >= buf_size) break; if (buf_index >= next_avc) continue; sl = &h->slice_ctx[context_count]; ptr = ff_h264_decode_nal(h, sl, buf + buf_index, &dst_length, &consumed, next_avc - buf_index); if (!ptr || dst_length < 0) { ret = -1; goto end; bit_length = get_bit_length(h, buf, ptr, dst_length, buf_index + consumed, next_avc); if (h->avctx->debug & FF_DEBUG_STARTCODE) av_log(h->avctx, AV_LOG_DEBUG, "NAL %d/%d at %d/%d length %d\n", h->nal_unit_type, h->nal_ref_idc, buf_index, buf_size, dst_length); if (h->is_avc && (nalsize != consumed) && nalsize) av_log(h->avctx, AV_LOG_DEBUG, "AVC: Consumed only %d bytes instead of %d\n", consumed, nalsize); buf_index += consumed; nal_index++; if (avctx->skip_frame >= AVDISCARD_NONREF && h->nal_ref_idc == 0 && h->nal_unit_type != NAL_SEI) continue; again: if (parse_extradata) { switch (h->nal_unit_type) { case NAL_IDR_SLICE: case NAL_SLICE: case NAL_DPA: case NAL_DPB: case NAL_DPC: av_log(h->avctx, AV_LOG_WARNING, "Ignoring NAL %d in global header/extradata\n", h->nal_unit_type); case NAL_AUXILIARY_SLICE: h->nal_unit_type = NAL_FF_IGNORE; err = 0; switch (h->nal_unit_type) { case NAL_IDR_SLICE: if ((ptr[0] & 0xFC) == 0x98) { av_log(h->avctx, AV_LOG_ERROR, "Invalid inter IDR frame\n"); h->next_outputed_poc = INT_MIN; ret = -1; goto end; if (h->nal_unit_type != NAL_IDR_SLICE) { av_log(h->avctx, AV_LOG_ERROR, "Invalid mix of idr and non-idr slices\n"); ret = -1; goto end; if(!idr_cleared) { if (h->current_slice && (avctx->active_thread_type & FF_THREAD_SLICE)) { av_log(h, AV_LOG_ERROR, "invalid mixed IDR / non IDR frames cannot be decoded in slice multithreading mode\n"); ret = AVERROR_INVALIDDATA; goto end; idr(h); idr_cleared = 1; h->has_recovery_point = 1; case NAL_SLICE: init_get_bits(&sl->gb, ptr, bit_length); if ( nals_needed >= nal_index || (!(avctx->active_thread_type & FF_THREAD_FRAME) && !context_count)) h->au_pps_id = -1; if ((err = ff_h264_decode_slice_header(h, sl))) break; if (h->sei_recovery_frame_cnt >= 0) { if (h->frame_num != h->sei_recovery_frame_cnt || sl->slice_type_nos != AV_PICTURE_TYPE_I) h->valid_recovery_point = 1; if ( h->recovery_frame < 0 || av_mod_uintp2(h->recovery_frame - h->frame_num, h->sps.log2_max_frame_num) > h->sei_recovery_frame_cnt) { h->recovery_frame = av_mod_uintp2(h->frame_num + h->sei_recovery_frame_cnt, h->sps.log2_max_frame_num); if (!h->valid_recovery_point) h->recovery_frame = h->frame_num; h->cur_pic_ptr->f->key_frame |= (h->nal_unit_type == NAL_IDR_SLICE); if (h->nal_unit_type == NAL_IDR_SLICE || h->recovery_frame == h->frame_num) { h->recovery_frame = -1; h->cur_pic_ptr->recovered = 1; if (h->nal_unit_type == NAL_IDR_SLICE) h->frame_recovered |= FRAME_RECOVERED_IDR; #if 1 h->cur_pic_ptr->recovered |= h->frame_recovered; #else h->cur_pic_ptr->recovered |= !!(h->frame_recovered & FRAME_RECOVERED_IDR); #endif if (h->current_slice == 1) { if (!(avctx->flags2 & AV_CODEC_FLAG2_CHUNKS)) decode_postinit(h, nal_index >= nals_needed); if (h->avctx->hwaccel && (ret = h->avctx->hwaccel->start_frame(h->avctx, buf, buf_size)) < 0) goto end; #if FF_API_CAP_VDPAU if (CONFIG_H264_VDPAU_DECODER && h->avctx->codec->capabilities & AV_CODEC_CAP_HWACCEL_VDPAU) ff_vdpau_h264_picture_start(h); #endif if (sl->redundant_pic_count == 0) { if (avctx->hwaccel) { ret = avctx->hwaccel->decode_slice(avctx, &buf[buf_index - consumed], consumed); if (ret < 0) goto end; #if FF_API_CAP_VDPAU } else if (CONFIG_H264_VDPAU_DECODER && h->avctx->codec->capabilities & AV_CODEC_CAP_HWACCEL_VDPAU) { ff_vdpau_add_data_chunk(h->cur_pic_ptr->f->data[0], start_code, sizeof(start_code)); ff_vdpau_add_data_chunk(h->cur_pic_ptr->f->data[0], &buf[buf_index - consumed], consumed); #endif context_count++; break; case NAL_DPA: case NAL_DPB: case NAL_DPC: avpriv_request_sample(avctx, "data partitioning"); break; case NAL_SEI: init_get_bits(&h->gb, ptr, bit_length); ret = ff_h264_decode_sei(h); if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE)) goto end; break; case NAL_SPS: init_get_bits(&h->gb, ptr, bit_length); if (ff_h264_decode_seq_parameter_set(h, 0) >= 0) break; if (h->is_avc ? nalsize : 1) { av_log(h->avctx, AV_LOG_DEBUG, "SPS decoding failure, trying again with the complete NAL\n"); if (h->is_avc) av_assert0(next_avc - buf_index + consumed == nalsize); if ((next_avc - buf_index + consumed - 1) >= INT_MAX/8) break; init_get_bits(&h->gb, &buf[buf_index + 1 - consumed], 8*(next_avc - buf_index + consumed - 1)); if (ff_h264_decode_seq_parameter_set(h, 0) >= 0) break; init_get_bits(&h->gb, ptr, bit_length); ff_h264_decode_seq_parameter_set(h, 1); break; case NAL_PPS: init_get_bits(&h->gb, ptr, bit_length); ret = ff_h264_decode_picture_parameter_set(h, bit_length); if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE)) goto end; break; case NAL_AUD: case NAL_END_SEQUENCE: case NAL_END_STREAM: case NAL_FILLER_DATA: case NAL_SPS_EXT: case NAL_AUXILIARY_SLICE: break; case NAL_FF_IGNORE: break; default: av_log(avctx, AV_LOG_DEBUG, "Unknown NAL code: %d (%d bits)\n", h->nal_unit_type, bit_length); if (context_count == h->max_contexts) { ret = ff_h264_execute_decode_slices(h, context_count); if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE)) goto end; context_count = 0; if (err < 0 || err == SLICE_SKIPED) { if (err < 0) av_log(h->avctx, AV_LOG_ERROR, "decode_slice_header error\n"); sl->ref_count[0] = sl->ref_count[1] = sl->list_count = 0; } else if (err == SLICE_SINGLETHREAD) { if (context_count > 1) { ret = ff_h264_execute_decode_slices(h, context_count - 1); if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE)) goto end; context_count = 0; sl = &h->slice_ctx[0]; goto again; if (context_count) { ret = ff_h264_execute_decode_slices(h, context_count); if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE)) goto end; ret = 0; end: if (h->cur_pic_ptr && !h->droppable) { ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, h->picture_structure == PICT_BOTTOM_FIELD); return (ret < 0) ? ret : buf_index;
{ "code": [], "line_no": [] }
static int FUNC_0(H264Context *VAR_0, const uint8_t *VAR_1, int VAR_2, int VAR_3) { AVCodecContext *const avctx = VAR_0->avctx; H264SliceContext *sl; int VAR_4; unsigned VAR_5; int VAR_6; int VAR_7 = 0; int VAR_8; int VAR_9=0; int VAR_10 = 0; VAR_0->nal_unit_type= 0; if(!VAR_0->slice_context_count) VAR_0->slice_context_count= 1; VAR_0->max_contexts = VAR_0->slice_context_count; if (!(avctx->flags2 & AV_CODEC_FLAG2_CHUNKS)) { VAR_0->current_slice = 0; if (!VAR_0->first_field) VAR_0->cur_pic_ptr = NULL; ff_h264_reset_sei(VAR_0); if (VAR_0->nal_length_size == 4) { if (VAR_2 > 8 && AV_RB32(VAR_1) == 1 && AV_RB32(VAR_1+5) > (unsigned)VAR_2) { VAR_0->is_avc = 0; }else if(VAR_2 > 3 && AV_RB32(VAR_1) > 1 && AV_RB32(VAR_1) <= (unsigned)VAR_2) VAR_0->is_avc = 1; if (avctx->active_thread_type & FF_THREAD_FRAME) VAR_7 = get_last_needed_nal(VAR_0, VAR_1, VAR_2); { VAR_4 = 0; VAR_5 = 0; VAR_6 = VAR_0->is_avc ? 0 : VAR_2; VAR_8 = 0; for (;;) { int VAR_11; int VAR_12; int VAR_13; const uint8_t *VAR_14; int VAR_15 = 0; int VAR_16; if (VAR_4 >= VAR_6) { VAR_15 = get_avc_nalsize(VAR_0, VAR_1, VAR_2, &VAR_4); if (VAR_15 < 0) break; VAR_6 = VAR_4 + VAR_15; } else { VAR_4 = find_start_code(VAR_1, VAR_2, VAR_4, VAR_6); if (VAR_4 >= VAR_2) break; if (VAR_4 >= VAR_6) continue; sl = &VAR_0->slice_ctx[VAR_5]; VAR_14 = ff_h264_decode_nal(VAR_0, sl, VAR_1 + VAR_4, &VAR_12, &VAR_11, VAR_6 - VAR_4); if (!VAR_14 || VAR_12 < 0) { VAR_10 = -1; goto end; VAR_13 = get_bit_length(VAR_0, VAR_1, VAR_14, VAR_12, VAR_4 + VAR_11, VAR_6); if (VAR_0->avctx->debug & FF_DEBUG_STARTCODE) av_log(VAR_0->avctx, AV_LOG_DEBUG, "NAL %d/%d at %d/%d length %d\n", VAR_0->nal_unit_type, VAR_0->nal_ref_idc, VAR_4, VAR_2, VAR_12); if (VAR_0->is_avc && (VAR_15 != VAR_11) && VAR_15) av_log(VAR_0->avctx, AV_LOG_DEBUG, "AVC: Consumed only %d bytes instead of %d\n", VAR_11, VAR_15); VAR_4 += VAR_11; VAR_8++; if (avctx->skip_frame >= AVDISCARD_NONREF && VAR_0->nal_ref_idc == 0 && VAR_0->nal_unit_type != NAL_SEI) continue; again: if (VAR_3) { switch (VAR_0->nal_unit_type) { case NAL_IDR_SLICE: case NAL_SLICE: case NAL_DPA: case NAL_DPB: case NAL_DPC: av_log(VAR_0->avctx, AV_LOG_WARNING, "Ignoring NAL %d in global header/extradata\n", VAR_0->nal_unit_type); case NAL_AUXILIARY_SLICE: VAR_0->nal_unit_type = NAL_FF_IGNORE; VAR_16 = 0; switch (VAR_0->nal_unit_type) { case NAL_IDR_SLICE: if ((VAR_14[0] & 0xFC) == 0x98) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid inter IDR frame\n"); VAR_0->next_outputed_poc = INT_MIN; VAR_10 = -1; goto end; if (VAR_0->nal_unit_type != NAL_IDR_SLICE) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid mix of idr and non-idr slices\n"); VAR_10 = -1; goto end; if(!VAR_9) { if (VAR_0->current_slice && (avctx->active_thread_type & FF_THREAD_SLICE)) { av_log(VAR_0, AV_LOG_ERROR, "invalid mixed IDR / non IDR frames cannot be decoded in slice multithreading mode\n"); VAR_10 = AVERROR_INVALIDDATA; goto end; idr(VAR_0); VAR_9 = 1; VAR_0->has_recovery_point = 1; case NAL_SLICE: init_get_bits(&sl->gb, VAR_14, VAR_13); if ( VAR_7 >= VAR_8 || (!(avctx->active_thread_type & FF_THREAD_FRAME) && !VAR_5)) VAR_0->au_pps_id = -1; if ((VAR_16 = ff_h264_decode_slice_header(VAR_0, sl))) break; if (VAR_0->sei_recovery_frame_cnt >= 0) { if (VAR_0->frame_num != VAR_0->sei_recovery_frame_cnt || sl->slice_type_nos != AV_PICTURE_TYPE_I) VAR_0->valid_recovery_point = 1; if ( VAR_0->recovery_frame < 0 || av_mod_uintp2(VAR_0->recovery_frame - VAR_0->frame_num, VAR_0->sps.log2_max_frame_num) > VAR_0->sei_recovery_frame_cnt) { VAR_0->recovery_frame = av_mod_uintp2(VAR_0->frame_num + VAR_0->sei_recovery_frame_cnt, VAR_0->sps.log2_max_frame_num); if (!VAR_0->valid_recovery_point) VAR_0->recovery_frame = VAR_0->frame_num; VAR_0->cur_pic_ptr->f->key_frame |= (VAR_0->nal_unit_type == NAL_IDR_SLICE); if (VAR_0->nal_unit_type == NAL_IDR_SLICE || VAR_0->recovery_frame == VAR_0->frame_num) { VAR_0->recovery_frame = -1; VAR_0->cur_pic_ptr->recovered = 1; if (VAR_0->nal_unit_type == NAL_IDR_SLICE) VAR_0->frame_recovered |= FRAME_RECOVERED_IDR; #if 1 VAR_0->cur_pic_ptr->recovered |= VAR_0->frame_recovered; #else VAR_0->cur_pic_ptr->recovered |= !!(VAR_0->frame_recovered & FRAME_RECOVERED_IDR); #endif if (VAR_0->current_slice == 1) { if (!(avctx->flags2 & AV_CODEC_FLAG2_CHUNKS)) decode_postinit(VAR_0, VAR_8 >= VAR_7); if (VAR_0->avctx->hwaccel && (VAR_10 = VAR_0->avctx->hwaccel->start_frame(VAR_0->avctx, VAR_1, VAR_2)) < 0) goto end; #if FF_API_CAP_VDPAU if (CONFIG_H264_VDPAU_DECODER && VAR_0->avctx->codec->capabilities & AV_CODEC_CAP_HWACCEL_VDPAU) ff_vdpau_h264_picture_start(VAR_0); #endif if (sl->redundant_pic_count == 0) { if (avctx->hwaccel) { VAR_10 = avctx->hwaccel->decode_slice(avctx, &VAR_1[VAR_4 - VAR_11], VAR_11); if (VAR_10 < 0) goto end; #if FF_API_CAP_VDPAU } else if (CONFIG_H264_VDPAU_DECODER && VAR_0->avctx->codec->capabilities & AV_CODEC_CAP_HWACCEL_VDPAU) { ff_vdpau_add_data_chunk(VAR_0->cur_pic_ptr->f->data[0], start_code, sizeof(start_code)); ff_vdpau_add_data_chunk(VAR_0->cur_pic_ptr->f->data[0], &VAR_1[VAR_4 - VAR_11], VAR_11); #endif VAR_5++; break; case NAL_DPA: case NAL_DPB: case NAL_DPC: avpriv_request_sample(avctx, "data partitioning"); break; case NAL_SEI: init_get_bits(&VAR_0->gb, VAR_14, VAR_13); VAR_10 = ff_h264_decode_sei(VAR_0); if (VAR_10 < 0 && (VAR_0->avctx->err_recognition & AV_EF_EXPLODE)) goto end; break; case NAL_SPS: init_get_bits(&VAR_0->gb, VAR_14, VAR_13); if (ff_h264_decode_seq_parameter_set(VAR_0, 0) >= 0) break; if (VAR_0->is_avc ? VAR_15 : 1) { av_log(VAR_0->avctx, AV_LOG_DEBUG, "SPS decoding failure, trying again with the complete NAL\n"); if (VAR_0->is_avc) av_assert0(VAR_6 - VAR_4 + VAR_11 == VAR_15); if ((VAR_6 - VAR_4 + VAR_11 - 1) >= INT_MAX/8) break; init_get_bits(&VAR_0->gb, &VAR_1[VAR_4 + 1 - VAR_11], 8*(VAR_6 - VAR_4 + VAR_11 - 1)); if (ff_h264_decode_seq_parameter_set(VAR_0, 0) >= 0) break; init_get_bits(&VAR_0->gb, VAR_14, VAR_13); ff_h264_decode_seq_parameter_set(VAR_0, 1); break; case NAL_PPS: init_get_bits(&VAR_0->gb, VAR_14, VAR_13); VAR_10 = ff_h264_decode_picture_parameter_set(VAR_0, VAR_13); if (VAR_10 < 0 && (VAR_0->avctx->err_recognition & AV_EF_EXPLODE)) goto end; break; case NAL_AUD: case NAL_END_SEQUENCE: case NAL_END_STREAM: case NAL_FILLER_DATA: case NAL_SPS_EXT: case NAL_AUXILIARY_SLICE: break; case NAL_FF_IGNORE: break; default: av_log(avctx, AV_LOG_DEBUG, "Unknown NAL code: %d (%d bits)\n", VAR_0->nal_unit_type, VAR_13); if (VAR_5 == VAR_0->max_contexts) { VAR_10 = ff_h264_execute_decode_slices(VAR_0, VAR_5); if (VAR_10 < 0 && (VAR_0->avctx->err_recognition & AV_EF_EXPLODE)) goto end; VAR_5 = 0; if (VAR_16 < 0 || VAR_16 == SLICE_SKIPED) { if (VAR_16 < 0) av_log(VAR_0->avctx, AV_LOG_ERROR, "decode_slice_header error\n"); sl->ref_count[0] = sl->ref_count[1] = sl->list_count = 0; } else if (VAR_16 == SLICE_SINGLETHREAD) { if (VAR_5 > 1) { VAR_10 = ff_h264_execute_decode_slices(VAR_0, VAR_5 - 1); if (VAR_10 < 0 && (VAR_0->avctx->err_recognition & AV_EF_EXPLODE)) goto end; VAR_5 = 0; sl = &VAR_0->slice_ctx[0]; goto again; if (VAR_5) { VAR_10 = ff_h264_execute_decode_slices(VAR_0, VAR_5); if (VAR_10 < 0 && (VAR_0->avctx->err_recognition & AV_EF_EXPLODE)) goto end; VAR_10 = 0; end: if (VAR_0->cur_pic_ptr && !VAR_0->droppable) { ff_thread_report_progress(&VAR_0->cur_pic_ptr->tf, INT_MAX, VAR_0->picture_structure == PICT_BOTTOM_FIELD); return (VAR_10 < 0) ? VAR_10 : VAR_4;
[ "static int FUNC_0(H264Context *VAR_0, const uint8_t *VAR_1, int VAR_2,\nint VAR_3)\n{", "AVCodecContext *const avctx = VAR_0->avctx;", "H264SliceContext *sl;", "int VAR_4;", "unsigned VAR_5;", "int VAR_6;", "int VAR_7 = 0;", "int VAR_8;", "int VAR_9=0;", "int VAR_10 = 0;", "VAR_0->nal_unit_type= 0;", "if(!VAR_0->slice_context_count)\nVAR_0->slice_context_count= 1;", "VAR_0->max_contexts = VAR_0->slice_context_count;", "if (!(avctx->flags2 & AV_CODEC_FLAG2_CHUNKS)) {", "VAR_0->current_slice = 0;", "if (!VAR_0->first_field)\nVAR_0->cur_pic_ptr = NULL;", "ff_h264_reset_sei(VAR_0);", "if (VAR_0->nal_length_size == 4) {", "if (VAR_2 > 8 && AV_RB32(VAR_1) == 1 && AV_RB32(VAR_1+5) > (unsigned)VAR_2) {", "VAR_0->is_avc = 0;", "}else if(VAR_2 > 3 && AV_RB32(VAR_1) > 1 && AV_RB32(VAR_1) <= (unsigned)VAR_2)", "VAR_0->is_avc = 1;", "if (avctx->active_thread_type & FF_THREAD_FRAME)\nVAR_7 = get_last_needed_nal(VAR_0, VAR_1, VAR_2);", "{", "VAR_4 = 0;", "VAR_5 = 0;", "VAR_6 = VAR_0->is_avc ? 0 : VAR_2;", "VAR_8 = 0;", "for (;;) {", "int VAR_11;", "int VAR_12;", "int VAR_13;", "const uint8_t *VAR_14;", "int VAR_15 = 0;", "int VAR_16;", "if (VAR_4 >= VAR_6) {", "VAR_15 = get_avc_nalsize(VAR_0, VAR_1, VAR_2, &VAR_4);", "if (VAR_15 < 0)\nbreak;", "VAR_6 = VAR_4 + VAR_15;", "} else {", "VAR_4 = find_start_code(VAR_1, VAR_2, VAR_4, VAR_6);", "if (VAR_4 >= VAR_2)\nbreak;", "if (VAR_4 >= VAR_6)\ncontinue;", "sl = &VAR_0->slice_ctx[VAR_5];", "VAR_14 = ff_h264_decode_nal(VAR_0, sl, VAR_1 + VAR_4, &VAR_12,\n&VAR_11, VAR_6 - VAR_4);", "if (!VAR_14 || VAR_12 < 0) {", "VAR_10 = -1;", "goto end;", "VAR_13 = get_bit_length(VAR_0, VAR_1, VAR_14, VAR_12,\nVAR_4 + VAR_11, VAR_6);", "if (VAR_0->avctx->debug & FF_DEBUG_STARTCODE)\nav_log(VAR_0->avctx, AV_LOG_DEBUG,\n\"NAL %d/%d at %d/%d length %d\\n\",\nVAR_0->nal_unit_type, VAR_0->nal_ref_idc, VAR_4, VAR_2, VAR_12);", "if (VAR_0->is_avc && (VAR_15 != VAR_11) && VAR_15)\nav_log(VAR_0->avctx, AV_LOG_DEBUG,\n\"AVC: Consumed only %d bytes instead of %d\\n\",\nVAR_11, VAR_15);", "VAR_4 += VAR_11;", "VAR_8++;", "if (avctx->skip_frame >= AVDISCARD_NONREF &&\nVAR_0->nal_ref_idc == 0 &&\nVAR_0->nal_unit_type != NAL_SEI)\ncontinue;", "again:\nif (VAR_3) {", "switch (VAR_0->nal_unit_type) {", "case NAL_IDR_SLICE:\ncase NAL_SLICE:\ncase NAL_DPA:\ncase NAL_DPB:\ncase NAL_DPC:\nav_log(VAR_0->avctx, AV_LOG_WARNING,\n\"Ignoring NAL %d in global header/extradata\\n\",\nVAR_0->nal_unit_type);", "case NAL_AUXILIARY_SLICE:\nVAR_0->nal_unit_type = NAL_FF_IGNORE;", "VAR_16 = 0;", "switch (VAR_0->nal_unit_type) {", "case NAL_IDR_SLICE:\nif ((VAR_14[0] & 0xFC) == 0x98) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Invalid inter IDR frame\\n\");", "VAR_0->next_outputed_poc = INT_MIN;", "VAR_10 = -1;", "goto end;", "if (VAR_0->nal_unit_type != NAL_IDR_SLICE) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"Invalid mix of idr and non-idr slices\\n\");", "VAR_10 = -1;", "goto end;", "if(!VAR_9) {", "if (VAR_0->current_slice && (avctx->active_thread_type & FF_THREAD_SLICE)) {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid mixed IDR / non IDR frames cannot be decoded in slice multithreading mode\\n\");", "VAR_10 = AVERROR_INVALIDDATA;", "goto end;", "idr(VAR_0);", "VAR_9 = 1;", "VAR_0->has_recovery_point = 1;", "case NAL_SLICE:\ninit_get_bits(&sl->gb, VAR_14, VAR_13);", "if ( VAR_7 >= VAR_8\n|| (!(avctx->active_thread_type & FF_THREAD_FRAME) && !VAR_5))\nVAR_0->au_pps_id = -1;", "if ((VAR_16 = ff_h264_decode_slice_header(VAR_0, sl)))\nbreak;", "if (VAR_0->sei_recovery_frame_cnt >= 0) {", "if (VAR_0->frame_num != VAR_0->sei_recovery_frame_cnt || sl->slice_type_nos != AV_PICTURE_TYPE_I)\nVAR_0->valid_recovery_point = 1;", "if ( VAR_0->recovery_frame < 0\n|| av_mod_uintp2(VAR_0->recovery_frame - VAR_0->frame_num, VAR_0->sps.log2_max_frame_num) > VAR_0->sei_recovery_frame_cnt) {", "VAR_0->recovery_frame = av_mod_uintp2(VAR_0->frame_num + VAR_0->sei_recovery_frame_cnt, VAR_0->sps.log2_max_frame_num);", "if (!VAR_0->valid_recovery_point)\nVAR_0->recovery_frame = VAR_0->frame_num;", "VAR_0->cur_pic_ptr->f->key_frame |=\n(VAR_0->nal_unit_type == NAL_IDR_SLICE);", "if (VAR_0->nal_unit_type == NAL_IDR_SLICE ||\nVAR_0->recovery_frame == VAR_0->frame_num) {", "VAR_0->recovery_frame = -1;", "VAR_0->cur_pic_ptr->recovered = 1;", "if (VAR_0->nal_unit_type == NAL_IDR_SLICE)\nVAR_0->frame_recovered |= FRAME_RECOVERED_IDR;", "#if 1\nVAR_0->cur_pic_ptr->recovered |= VAR_0->frame_recovered;", "#else\nVAR_0->cur_pic_ptr->recovered |= !!(VAR_0->frame_recovered & FRAME_RECOVERED_IDR);", "#endif\nif (VAR_0->current_slice == 1) {", "if (!(avctx->flags2 & AV_CODEC_FLAG2_CHUNKS))\ndecode_postinit(VAR_0, VAR_8 >= VAR_7);", "if (VAR_0->avctx->hwaccel &&\n(VAR_10 = VAR_0->avctx->hwaccel->start_frame(VAR_0->avctx, VAR_1, VAR_2)) < 0)\ngoto end;", "#if FF_API_CAP_VDPAU\nif (CONFIG_H264_VDPAU_DECODER &&\nVAR_0->avctx->codec->capabilities & AV_CODEC_CAP_HWACCEL_VDPAU)\nff_vdpau_h264_picture_start(VAR_0);", "#endif\nif (sl->redundant_pic_count == 0) {", "if (avctx->hwaccel) {", "VAR_10 = avctx->hwaccel->decode_slice(avctx,\n&VAR_1[VAR_4 - VAR_11],\nVAR_11);", "if (VAR_10 < 0)\ngoto end;", "#if FF_API_CAP_VDPAU\n} else if (CONFIG_H264_VDPAU_DECODER &&", "VAR_0->avctx->codec->capabilities & AV_CODEC_CAP_HWACCEL_VDPAU) {", "ff_vdpau_add_data_chunk(VAR_0->cur_pic_ptr->f->data[0],\nstart_code,\nsizeof(start_code));", "ff_vdpau_add_data_chunk(VAR_0->cur_pic_ptr->f->data[0],\n&VAR_1[VAR_4 - VAR_11],\nVAR_11);", "#endif\nVAR_5++;", "break;", "case NAL_DPA:\ncase NAL_DPB:\ncase NAL_DPC:\navpriv_request_sample(avctx, \"data partitioning\");", "break;", "case NAL_SEI:\ninit_get_bits(&VAR_0->gb, VAR_14, VAR_13);", "VAR_10 = ff_h264_decode_sei(VAR_0);", "if (VAR_10 < 0 && (VAR_0->avctx->err_recognition & AV_EF_EXPLODE))\ngoto end;", "break;", "case NAL_SPS:\ninit_get_bits(&VAR_0->gb, VAR_14, VAR_13);", "if (ff_h264_decode_seq_parameter_set(VAR_0, 0) >= 0)\nbreak;", "if (VAR_0->is_avc ? VAR_15 : 1) {", "av_log(VAR_0->avctx, AV_LOG_DEBUG,\n\"SPS decoding failure, trying again with the complete NAL\\n\");", "if (VAR_0->is_avc)\nav_assert0(VAR_6 - VAR_4 + VAR_11 == VAR_15);", "if ((VAR_6 - VAR_4 + VAR_11 - 1) >= INT_MAX/8)\nbreak;", "init_get_bits(&VAR_0->gb, &VAR_1[VAR_4 + 1 - VAR_11],\n8*(VAR_6 - VAR_4 + VAR_11 - 1));", "if (ff_h264_decode_seq_parameter_set(VAR_0, 0) >= 0)\nbreak;", "init_get_bits(&VAR_0->gb, VAR_14, VAR_13);", "ff_h264_decode_seq_parameter_set(VAR_0, 1);", "break;", "case NAL_PPS:\ninit_get_bits(&VAR_0->gb, VAR_14, VAR_13);", "VAR_10 = ff_h264_decode_picture_parameter_set(VAR_0, VAR_13);", "if (VAR_10 < 0 && (VAR_0->avctx->err_recognition & AV_EF_EXPLODE))\ngoto end;", "break;", "case NAL_AUD:\ncase NAL_END_SEQUENCE:\ncase NAL_END_STREAM:\ncase NAL_FILLER_DATA:\ncase NAL_SPS_EXT:\ncase NAL_AUXILIARY_SLICE:\nbreak;", "case NAL_FF_IGNORE:\nbreak;", "default:\nav_log(avctx, AV_LOG_DEBUG, \"Unknown NAL code: %d (%d bits)\\n\",\nVAR_0->nal_unit_type, VAR_13);", "if (VAR_5 == VAR_0->max_contexts) {", "VAR_10 = ff_h264_execute_decode_slices(VAR_0, VAR_5);", "if (VAR_10 < 0 && (VAR_0->avctx->err_recognition & AV_EF_EXPLODE))\ngoto end;", "VAR_5 = 0;", "if (VAR_16 < 0 || VAR_16 == SLICE_SKIPED) {", "if (VAR_16 < 0)\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"decode_slice_header error\\n\");", "sl->ref_count[0] = sl->ref_count[1] = sl->list_count = 0;", "} else if (VAR_16 == SLICE_SINGLETHREAD) {", "if (VAR_5 > 1) {", "VAR_10 = ff_h264_execute_decode_slices(VAR_0, VAR_5 - 1);", "if (VAR_10 < 0 && (VAR_0->avctx->err_recognition & AV_EF_EXPLODE))\ngoto end;", "VAR_5 = 0;", "sl = &VAR_0->slice_ctx[0];", "goto again;", "if (VAR_5) {", "VAR_10 = ff_h264_execute_decode_slices(VAR_0, VAR_5);", "if (VAR_10 < 0 && (VAR_0->avctx->err_recognition & AV_EF_EXPLODE))\ngoto end;", "VAR_10 = 0;", "end:\nif (VAR_0->cur_pic_ptr && !VAR_0->droppable) {", "ff_thread_report_progress(&VAR_0->cur_pic_ptr->tf, INT_MAX,\nVAR_0->picture_structure == PICT_BOTTOM_FIELD);", "return (VAR_10 < 0) ? VAR_10 : VAR_4;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14, 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19, 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24 ], [ 25 ], [ 26 ], [ 27, 28 ], [ 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33 ], [ 34 ], [ 35 ], [ 36 ], [ 37 ], [ 38 ], [ 39 ], [ 40 ], [ 41 ], [ 42 ], [ 43, 44 ], [ 45 ], [ 46 ], [ 47 ], [ 48, 49 ], [ 50, 51 ], [ 52 ], [ 53, 54 ], [ 55 ], [ 56 ], [ 57 ], [ 58, 59 ], [ 60, 61, 62, 63 ], [ 64, 65, 66, 67 ], [ 68 ], [ 69 ], [ 70, 71, 72, 73 ], [ 74, 78 ], [ 79 ], [ 80, 81, 82, 83, 84, 85, 86, 87 ], [ 89, 90 ], [ 91 ], [ 92 ], [ 93, 94 ], [ 95 ], [ 96 ], [ 97 ], [ 98 ], [ 99 ], [ 100, 101 ], [ 102 ], [ 103 ], [ 104 ], [ 105 ], [ 106 ], [ 107 ], [ 108 ], [ 109 ], [ 110 ], [ 111 ], [ 112, 113 ], [ 114, 115, 116 ], [ 117, 118 ], [ 119 ], [ 120, 121 ], [ 122, 123 ], [ 124 ], [ 125, 126 ], [ 127, 128 ], [ 129, 130 ], [ 131 ], [ 132 ], [ 135, 136 ], [ 137, 138 ], [ 139, 140 ], [ 141, 142 ], [ 143, 144 ], [ 145, 146, 147 ], [ 148, 149, 150, 151 ], [ 152, 153 ], [ 154 ], [ 155, 156, 157 ], [ 158, 159 ], [ 160, 161 ], [ 162 ], [ 163, 164, 165 ], [ 166, 167, 168 ], [ 169, 170 ], [ 171 ], [ 172, 173, 174, 175 ], [ 176 ], [ 177, 178 ], [ 179 ], [ 180, 181 ], [ 182 ], [ 183, 184 ], [ 185, 186 ], [ 187 ], [ 188, 189 ], [ 190, 191 ], [ 192, 193 ], [ 194, 195 ], [ 196, 197 ], [ 198 ], [ 199 ], [ 200 ], [ 201, 202 ], [ 203 ], [ 204, 205 ], [ 206 ], [ 207, 208, 209, 210, 211, 212, 213 ], [ 214, 215 ], [ 216, 217, 218 ], [ 219 ], [ 220 ], [ 221, 222 ], [ 223 ], [ 224 ], [ 225, 226 ], [ 227 ], [ 228 ], [ 229 ], [ 230 ], [ 231, 232 ], [ 233 ], [ 237 ], [ 238 ], [ 239 ], [ 240 ], [ 241, 242 ], [ 243 ], [ 244, 246 ], [ 247, 248 ], [ 249 ] ]
2,098
int spapr_h_cas_compose_response(sPAPRMachineState *spapr, target_ulong addr, target_ulong size, sPAPROptionVector *ov5_updates) { void *fdt, *fdt_skel; sPAPRDeviceTreeUpdateHeader hdr = { .version_id = 1 }; size -= sizeof(hdr); /* Create sceleton */ fdt_skel = g_malloc0(size); _FDT((fdt_create(fdt_skel, size))); _FDT((fdt_begin_node(fdt_skel, ""))); _FDT((fdt_end_node(fdt_skel))); _FDT((fdt_finish(fdt_skel))); fdt = g_malloc0(size); _FDT((fdt_open_into(fdt_skel, fdt, size))); g_free(fdt_skel); /* Fixup cpu nodes */ _FDT((spapr_fixup_cpu_dt(fdt, spapr))); if (spapr_dt_cas_updates(spapr, fdt, ov5_updates)) { return -1; } /* Pack resulting tree */ _FDT((fdt_pack(fdt))); if (fdt_totalsize(fdt) + sizeof(hdr) > size) { trace_spapr_cas_failed(size); return -1; } cpu_physical_memory_write(addr, &hdr, sizeof(hdr)); cpu_physical_memory_write(addr + sizeof(hdr), fdt, fdt_totalsize(fdt)); trace_spapr_cas_continue(fdt_totalsize(fdt) + sizeof(hdr)); g_free(fdt); return 0; }
true
qemu
10f12e6450407b18b4d5a6b50d3852dcfd7fff75
int spapr_h_cas_compose_response(sPAPRMachineState *spapr, target_ulong addr, target_ulong size, sPAPROptionVector *ov5_updates) { void *fdt, *fdt_skel; sPAPRDeviceTreeUpdateHeader hdr = { .version_id = 1 }; size -= sizeof(hdr); fdt_skel = g_malloc0(size); _FDT((fdt_create(fdt_skel, size))); _FDT((fdt_begin_node(fdt_skel, ""))); _FDT((fdt_end_node(fdt_skel))); _FDT((fdt_finish(fdt_skel))); fdt = g_malloc0(size); _FDT((fdt_open_into(fdt_skel, fdt, size))); g_free(fdt_skel); _FDT((spapr_fixup_cpu_dt(fdt, spapr))); if (spapr_dt_cas_updates(spapr, fdt, ov5_updates)) { return -1; } _FDT((fdt_pack(fdt))); if (fdt_totalsize(fdt) + sizeof(hdr) > size) { trace_spapr_cas_failed(size); return -1; } cpu_physical_memory_write(addr, &hdr, sizeof(hdr)); cpu_physical_memory_write(addr + sizeof(hdr), fdt, fdt_totalsize(fdt)); trace_spapr_cas_continue(fdt_totalsize(fdt) + sizeof(hdr)); g_free(fdt); return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(sPAPRMachineState *VAR_0, target_ulong VAR_1, target_ulong VAR_2, sPAPROptionVector *VAR_3) { void *VAR_4, *VAR_5; sPAPRDeviceTreeUpdateHeader hdr = { .version_id = 1 }; VAR_2 -= sizeof(hdr); VAR_5 = g_malloc0(VAR_2); _FDT((fdt_create(VAR_5, VAR_2))); _FDT((fdt_begin_node(VAR_5, ""))); _FDT((fdt_end_node(VAR_5))); _FDT((fdt_finish(VAR_5))); VAR_4 = g_malloc0(VAR_2); _FDT((fdt_open_into(VAR_5, VAR_4, VAR_2))); g_free(VAR_5); _FDT((spapr_fixup_cpu_dt(VAR_4, VAR_0))); if (spapr_dt_cas_updates(VAR_0, VAR_4, VAR_3)) { return -1; } _FDT((fdt_pack(VAR_4))); if (fdt_totalsize(VAR_4) + sizeof(hdr) > VAR_2) { trace_spapr_cas_failed(VAR_2); return -1; } cpu_physical_memory_write(VAR_1, &hdr, sizeof(hdr)); cpu_physical_memory_write(VAR_1 + sizeof(hdr), VAR_4, fdt_totalsize(VAR_4)); trace_spapr_cas_continue(fdt_totalsize(VAR_4) + sizeof(hdr)); g_free(VAR_4); return 0; }
[ "int FUNC_0(sPAPRMachineState *VAR_0,\ntarget_ulong VAR_1, target_ulong VAR_2,\nsPAPROptionVector *VAR_3)\n{", "void *VAR_4, *VAR_5;", "sPAPRDeviceTreeUpdateHeader hdr = { .version_id = 1 };", "VAR_2 -= sizeof(hdr);", "VAR_5 = g_malloc0(VAR_2);", "_FDT((fdt_create(VAR_5, VAR_2)));", "_FDT((fdt_begin_node(VAR_5, \"\")));", "_FDT((fdt_end_node(VAR_5)));", "_FDT((fdt_finish(VAR_5)));", "VAR_4 = g_malloc0(VAR_2);", "_FDT((fdt_open_into(VAR_5, VAR_4, VAR_2)));", "g_free(VAR_5);", "_FDT((spapr_fixup_cpu_dt(VAR_4, VAR_0)));", "if (spapr_dt_cas_updates(VAR_0, VAR_4, VAR_3)) {", "return -1;", "}", "_FDT((fdt_pack(VAR_4)));", "if (fdt_totalsize(VAR_4) + sizeof(hdr) > VAR_2) {", "trace_spapr_cas_failed(VAR_2);", "return -1;", "}", "cpu_physical_memory_write(VAR_1, &hdr, sizeof(hdr));", "cpu_physical_memory_write(VAR_1 + sizeof(hdr), VAR_4, fdt_totalsize(VAR_4));", "trace_spapr_cas_continue(fdt_totalsize(VAR_4) + sizeof(hdr));", "g_free(VAR_4);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 15 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ] ]
2,099
static MatroskaLevel1Element *matroska_find_level1_elem(MatroskaDemuxContext *matroska, uint32_t id) { int i; MatroskaLevel1Element *elem; // Some files link to all clusters; useless. if (id == MATROSKA_ID_CLUSTER) // There can be multiple seekheads. if (id != MATROSKA_ID_SEEKHEAD) { for (i = 0; i < matroska->num_level1_elems; i++) { if (matroska->level1_elems[i].id == id) return &matroska->level1_elems[i]; } } // Only a completely broken file would have more elements. // It also provides a low-effort way to escape from circular seekheads // (every iteration will add a level1 entry). if (matroska->num_level1_elems >= FF_ARRAY_ELEMS(matroska->level1_elems)) { av_log(matroska->ctx, AV_LOG_ERROR, "Too many level1 elements or circular seekheads.\n"); } elem = &matroska->level1_elems[matroska->num_level1_elems++]; *elem = (MatroskaLevel1Element){.id = id}; return elem; }
true
FFmpeg
7e240f95818310ed721321e62130aa1c69f9cbe6
static MatroskaLevel1Element *matroska_find_level1_elem(MatroskaDemuxContext *matroska, uint32_t id) { int i; MatroskaLevel1Element *elem; if (id == MATROSKA_ID_CLUSTER) if (id != MATROSKA_ID_SEEKHEAD) { for (i = 0; i < matroska->num_level1_elems; i++) { if (matroska->level1_elems[i].id == id) return &matroska->level1_elems[i]; } } if (matroska->num_level1_elems >= FF_ARRAY_ELEMS(matroska->level1_elems)) { av_log(matroska->ctx, AV_LOG_ERROR, "Too many level1 elements or circular seekheads.\n"); } elem = &matroska->level1_elems[matroska->num_level1_elems++]; *elem = (MatroskaLevel1Element){.id = id}; return elem; }
{ "code": [], "line_no": [] }
static MatroskaLevel1Element *FUNC_0(MatroskaDemuxContext *matroska, uint32_t id) { int VAR_0; MatroskaLevel1Element *elem; if (id == MATROSKA_ID_CLUSTER) if (id != MATROSKA_ID_SEEKHEAD) { for (VAR_0 = 0; VAR_0 < matroska->num_level1_elems; VAR_0++) { if (matroska->level1_elems[VAR_0].id == id) return &matroska->level1_elems[VAR_0]; } } if (matroska->num_level1_elems >= FF_ARRAY_ELEMS(matroska->level1_elems)) { av_log(matroska->ctx, AV_LOG_ERROR, "Too many level1 elements or circular seekheads.\n"); } elem = &matroska->level1_elems[matroska->num_level1_elems++]; *elem = (MatroskaLevel1Element){.id = id}; return elem; }
[ "static MatroskaLevel1Element *FUNC_0(MatroskaDemuxContext *matroska,\nuint32_t id)\n{", "int VAR_0;", "MatroskaLevel1Element *elem;", "if (id == MATROSKA_ID_CLUSTER)\nif (id != MATROSKA_ID_SEEKHEAD) {", "for (VAR_0 = 0; VAR_0 < matroska->num_level1_elems; VAR_0++) {", "if (matroska->level1_elems[VAR_0].id == id)\nreturn &matroska->level1_elems[VAR_0];", "}", "}", "if (matroska->num_level1_elems >= FF_ARRAY_ELEMS(matroska->level1_elems)) {", "av_log(matroska->ctx, AV_LOG_ERROR, \"Too many level1 elements or circular seekheads.\\n\");", "}", "elem = &matroska->level1_elems[matroska->num_level1_elems++];", "*elem = (MatroskaLevel1Element){.id = id};", "return elem;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3 ], [ 4 ], [ 5 ], [ 7, 9 ], [ 10 ], [ 11, 12 ], [ 13 ], [ 14 ], [ 18 ], [ 19 ], [ 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24 ] ]
2,100
static int mp_dacl_removexattr(FsContext *ctx, const char *path, const char *name) { int ret; char *buffer; buffer = rpath(ctx, path); ret = lremovexattr(buffer, MAP_ACL_DEFAULT); if (ret == -1 && errno == ENODATA) { /* * We don't get ENODATA error when trying to remove a * posix acl that is not present. So don't throw the error * even in case of mapped security model */ errno = 0; ret = 0; } g_free(buffer); return ret; }
true
qemu
72f0d0bf51362011c4d841a89fb8f5cfb16e0bf3
static int mp_dacl_removexattr(FsContext *ctx, const char *path, const char *name) { int ret; char *buffer; buffer = rpath(ctx, path); ret = lremovexattr(buffer, MAP_ACL_DEFAULT); if (ret == -1 && errno == ENODATA) { errno = 0; ret = 0; } g_free(buffer); return ret; }
{ "code": [ " char *buffer;", " buffer = rpath(ctx, path);", " g_free(buffer);", " char *buffer;", " buffer = rpath(ctx, path);", " ret = lremovexattr(buffer, MAP_ACL_DEFAULT);", " g_free(buffer);", " char *buffer;", " int ret;", " buffer = rpath(ctx, path);", " g_free(buffer);", " return ret;", " char *buffer;", " buffer = rpath(ctx, path);", " g_free(buffer);" ], "line_no": [ 9, 13, 35, 9, 13, 15, 35, 9, 7, 13, 35, 37, 9, 13, 35 ] }
static int FUNC_0(FsContext *VAR_0, const char *VAR_1, const char *VAR_2) { int VAR_3; char *VAR_4; VAR_4 = rpath(VAR_0, VAR_1); VAR_3 = lremovexattr(VAR_4, MAP_ACL_DEFAULT); if (VAR_3 == -1 && errno == ENODATA) { errno = 0; VAR_3 = 0; } g_free(VAR_4); return VAR_3; }
[ "static int FUNC_0(FsContext *VAR_0,\nconst char *VAR_1, const char *VAR_2)\n{", "int VAR_3;", "char *VAR_4;", "VAR_4 = rpath(VAR_0, VAR_1);", "VAR_3 = lremovexattr(VAR_4, MAP_ACL_DEFAULT);", "if (VAR_3 == -1 && errno == ENODATA) {", "errno = 0;", "VAR_3 = 0;", "}", "g_free(VAR_4);", "return VAR_3;", "}" ]
[ 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ] ]
2,101
static void IRQ_local_pipe(OpenPICState *opp, int n_CPU, int n_IRQ) { IRQ_dst_t *dst; IRQ_src_t *src; int priority; dst = &opp->dst[n_CPU]; src = &opp->src[n_IRQ]; priority = IPVP_PRIORITY(src->ipvp); if (priority <= dst->pctp) { /* Too low priority */ DPRINTF("%s: IRQ %d has too low priority on CPU %d\n", __func__, n_IRQ, n_CPU); return; } if (IRQ_testbit(&dst->raised, n_IRQ)) { /* Interrupt miss */ DPRINTF("%s: IRQ %d was missed on CPU %d\n", __func__, n_IRQ, n_CPU); return; } src->ipvp |= IPVP_ACTIVITY_MASK; IRQ_setbit(&dst->raised, n_IRQ); if (priority < dst->raised.priority) { /* An higher priority IRQ is already raised */ DPRINTF("%s: IRQ %d is hidden by raised IRQ %d on CPU %d\n", __func__, n_IRQ, dst->raised.next, n_CPU); return; } IRQ_get_next(opp, &dst->raised); if (IRQ_get_next(opp, &dst->servicing) != -1 && priority <= dst->servicing.priority) { DPRINTF("%s: IRQ %d is hidden by servicing IRQ %d on CPU %d\n", __func__, n_IRQ, dst->servicing.next, n_CPU); /* Already servicing a higher priority IRQ */ return; } DPRINTF("Raise OpenPIC INT output cpu %d irq %d\n", n_CPU, n_IRQ); openpic_irq_raise(opp, n_CPU, src); }
true
qemu
af7e9e74c6a62a5bcd911726a9e88d28b61490e0
static void IRQ_local_pipe(OpenPICState *opp, int n_CPU, int n_IRQ) { IRQ_dst_t *dst; IRQ_src_t *src; int priority; dst = &opp->dst[n_CPU]; src = &opp->src[n_IRQ]; priority = IPVP_PRIORITY(src->ipvp); if (priority <= dst->pctp) { DPRINTF("%s: IRQ %d has too low priority on CPU %d\n", __func__, n_IRQ, n_CPU); return; } if (IRQ_testbit(&dst->raised, n_IRQ)) { DPRINTF("%s: IRQ %d was missed on CPU %d\n", __func__, n_IRQ, n_CPU); return; } src->ipvp |= IPVP_ACTIVITY_MASK; IRQ_setbit(&dst->raised, n_IRQ); if (priority < dst->raised.priority) { DPRINTF("%s: IRQ %d is hidden by raised IRQ %d on CPU %d\n", __func__, n_IRQ, dst->raised.next, n_CPU); return; } IRQ_get_next(opp, &dst->raised); if (IRQ_get_next(opp, &dst->servicing) != -1 && priority <= dst->servicing.priority) { DPRINTF("%s: IRQ %d is hidden by servicing IRQ %d on CPU %d\n", __func__, n_IRQ, dst->servicing.next, n_CPU); return; } DPRINTF("Raise OpenPIC INT output cpu %d irq %d\n", n_CPU, n_IRQ); openpic_irq_raise(opp, n_CPU, src); }
{ "code": [ " IRQ_dst_t *dst;", " IRQ_src_t *src;", " IRQ_src_t *src;", " IRQ_src_t *src;", " IRQ_dst_t *dst;", " IRQ_src_t *src;", " IRQ_dst_t *dst;", " IRQ_src_t *src;", " IRQ_dst_t *dst;" ], "line_no": [ 5, 7, 7, 7, 5, 7, 5, 7, 5 ] }
static void FUNC_0(OpenPICState *VAR_0, int VAR_1, int VAR_2) { IRQ_dst_t *dst; IRQ_src_t *src; int VAR_3; dst = &VAR_0->dst[VAR_1]; src = &VAR_0->src[VAR_2]; VAR_3 = IPVP_PRIORITY(src->ipvp); if (VAR_3 <= dst->pctp) { DPRINTF("%s: IRQ %d has too low VAR_3 on CPU %d\n", __func__, VAR_2, VAR_1); return; } if (IRQ_testbit(&dst->raised, VAR_2)) { DPRINTF("%s: IRQ %d was missed on CPU %d\n", __func__, VAR_2, VAR_1); return; } src->ipvp |= IPVP_ACTIVITY_MASK; IRQ_setbit(&dst->raised, VAR_2); if (VAR_3 < dst->raised.VAR_3) { DPRINTF("%s: IRQ %d is hidden by raised IRQ %d on CPU %d\n", __func__, VAR_2, dst->raised.next, VAR_1); return; } IRQ_get_next(VAR_0, &dst->raised); if (IRQ_get_next(VAR_0, &dst->servicing) != -1 && VAR_3 <= dst->servicing.VAR_3) { DPRINTF("%s: IRQ %d is hidden by servicing IRQ %d on CPU %d\n", __func__, VAR_2, dst->servicing.next, VAR_1); return; } DPRINTF("Raise OpenPIC INT output cpu %d irq %d\n", VAR_1, VAR_2); openpic_irq_raise(VAR_0, VAR_1, src); }
[ "static void FUNC_0(OpenPICState *VAR_0, int VAR_1, int VAR_2)\n{", "IRQ_dst_t *dst;", "IRQ_src_t *src;", "int VAR_3;", "dst = &VAR_0->dst[VAR_1];", "src = &VAR_0->src[VAR_2];", "VAR_3 = IPVP_PRIORITY(src->ipvp);", "if (VAR_3 <= dst->pctp) {", "DPRINTF(\"%s: IRQ %d has too low VAR_3 on CPU %d\\n\",\n__func__, VAR_2, VAR_1);", "return;", "}", "if (IRQ_testbit(&dst->raised, VAR_2)) {", "DPRINTF(\"%s: IRQ %d was missed on CPU %d\\n\",\n__func__, VAR_2, VAR_1);", "return;", "}", "src->ipvp |= IPVP_ACTIVITY_MASK;", "IRQ_setbit(&dst->raised, VAR_2);", "if (VAR_3 < dst->raised.VAR_3) {", "DPRINTF(\"%s: IRQ %d is hidden by raised IRQ %d on CPU %d\\n\",\n__func__, VAR_2, dst->raised.next, VAR_1);", "return;", "}", "IRQ_get_next(VAR_0, &dst->raised);", "if (IRQ_get_next(VAR_0, &dst->servicing) != -1 &&\nVAR_3 <= dst->servicing.VAR_3) {", "DPRINTF(\"%s: IRQ %d is hidden by servicing IRQ %d on CPU %d\\n\",\n__func__, VAR_2, dst->servicing.next, VAR_1);", "return;", "}", "DPRINTF(\"Raise OpenPIC INT output cpu %d irq %d\\n\", VAR_1, VAR_2);", "openpic_irq_raise(VAR_0, VAR_1, src);", "}" ]
[ 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65, 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ] ]
2,102
static void process_incoming_migration_bh(void *opaque) { Error *local_err = NULL; MigrationIncomingState *mis = opaque; /* Make sure all file formats flush their mutable metadata */ bdrv_invalidate_cache_all(&local_err); migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE, MIGRATION_STATUS_FAILED); error_report_err(local_err); migrate_decompress_threads_join(); exit(EXIT_FAILURE); /* * This must happen after all error conditions are dealt with and * we're sure the VM is going to be running on this host. */ qemu_announce_self(); /* If global state section was not received or we are in running state, we need to obey autostart. Any other state is set with runstate_set. */ if (!global_state_received() || global_state_get_runstate() == RUN_STATE_RUNNING) { if (autostart) { vm_start(); } else { runstate_set(RUN_STATE_PAUSED); } else { runstate_set(global_state_get_runstate()); migrate_decompress_threads_join(); /* * This must happen after any state changes since as soon as an external * observer sees this event they might start to prod at the VM assuming * it's ready to use. */ migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE, MIGRATION_STATUS_COMPLETED); qemu_bh_delete(mis->bh); migration_incoming_state_destroy();
true
qemu
d35ff5e6b3aa3a706b0aa3bcf11400fac945b67a
static void process_incoming_migration_bh(void *opaque) { Error *local_err = NULL; MigrationIncomingState *mis = opaque; bdrv_invalidate_cache_all(&local_err); migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE, MIGRATION_STATUS_FAILED); error_report_err(local_err); migrate_decompress_threads_join(); exit(EXIT_FAILURE); qemu_announce_self(); if (!global_state_received() || global_state_get_runstate() == RUN_STATE_RUNNING) { if (autostart) { vm_start(); } else { runstate_set(RUN_STATE_PAUSED); } else { runstate_set(global_state_get_runstate()); migrate_decompress_threads_join(); migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE, MIGRATION_STATUS_COMPLETED); qemu_bh_delete(mis->bh); migration_incoming_state_destroy();
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { Error *local_err = NULL; MigrationIncomingState *mis = VAR_0; bdrv_invalidate_cache_all(&local_err); migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE, MIGRATION_STATUS_FAILED); error_report_err(local_err); migrate_decompress_threads_join(); exit(EXIT_FAILURE); qemu_announce_self(); if (!global_state_received() || global_state_get_runstate() == RUN_STATE_RUNNING) { if (autostart) { vm_start(); } else { runstate_set(RUN_STATE_PAUSED); } else { runstate_set(global_state_get_runstate()); migrate_decompress_threads_join(); migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE, MIGRATION_STATUS_COMPLETED); qemu_bh_delete(mis->bh); migration_incoming_state_destroy();
[ "static void FUNC_0(void *VAR_0)\n{", "Error *local_err = NULL;", "MigrationIncomingState *mis = VAR_0;", "bdrv_invalidate_cache_all(&local_err);", "migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE,\nMIGRATION_STATUS_FAILED);", "error_report_err(local_err);", "migrate_decompress_threads_join();", "exit(EXIT_FAILURE);", "qemu_announce_self();", "if (!global_state_received() ||\nglobal_state_get_runstate() == RUN_STATE_RUNNING) {", "if (autostart) {", "vm_start();", "} else {", "runstate_set(RUN_STATE_PAUSED);", "} else {", "runstate_set(global_state_get_runstate());", "migrate_decompress_threads_join();", "migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE,\nMIGRATION_STATUS_COMPLETED);", "qemu_bh_delete(mis->bh);", "migration_incoming_state_destroy();" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 6 ], [ 7, 8 ], [ 9 ], [ 10 ], [ 11 ], [ 16 ], [ 20, 21 ], [ 22 ], [ 23 ], [ 24 ], [ 25 ], [ 26 ], [ 27 ], [ 28 ], [ 34, 35 ], [ 36 ], [ 37 ] ]
2,103
static int decode_phys_chunk(AVCodecContext *avctx, PNGDecContext *s) { if (s->state & PNG_IDAT) { av_log(avctx, AV_LOG_ERROR, "pHYs after IDAT\n"); return AVERROR_INVALIDDATA; } avctx->sample_aspect_ratio.num = bytestream2_get_be32(&s->gb); avctx->sample_aspect_ratio.den = bytestream2_get_be32(&s->gb); if (avctx->sample_aspect_ratio.num < 0 || avctx->sample_aspect_ratio.den < 0) avctx->sample_aspect_ratio = (AVRational){ 0, 1 }; bytestream2_skip(&s->gb, 1); /* unit specifier */ bytestream2_skip(&s->gb, 4); /* crc */ return 0; }
true
FFmpeg
478f1c3d5e5463a284ea7efecfc62d47ba3be11a
static int decode_phys_chunk(AVCodecContext *avctx, PNGDecContext *s) { if (s->state & PNG_IDAT) { av_log(avctx, AV_LOG_ERROR, "pHYs after IDAT\n"); return AVERROR_INVALIDDATA; } avctx->sample_aspect_ratio.num = bytestream2_get_be32(&s->gb); avctx->sample_aspect_ratio.den = bytestream2_get_be32(&s->gb); if (avctx->sample_aspect_ratio.num < 0 || avctx->sample_aspect_ratio.den < 0) avctx->sample_aspect_ratio = (AVRational){ 0, 1 }; bytestream2_skip(&s->gb, 1); bytestream2_skip(&s->gb, 4); return 0; }
{ "code": [ " if (s->state & PNG_IDAT) {", " if (s->state & PNG_IDAT) {", " if (s->state & PNG_IDAT) {" ], "line_no": [ 5, 5, 5 ] }
static int FUNC_0(AVCodecContext *VAR_0, PNGDecContext *VAR_1) { if (VAR_1->state & PNG_IDAT) { av_log(VAR_0, AV_LOG_ERROR, "pHYs after IDAT\n"); return AVERROR_INVALIDDATA; } VAR_0->sample_aspect_ratio.num = bytestream2_get_be32(&VAR_1->gb); VAR_0->sample_aspect_ratio.den = bytestream2_get_be32(&VAR_1->gb); if (VAR_0->sample_aspect_ratio.num < 0 || VAR_0->sample_aspect_ratio.den < 0) VAR_0->sample_aspect_ratio = (AVRational){ 0, 1 }; bytestream2_skip(&VAR_1->gb, 1); bytestream2_skip(&VAR_1->gb, 4); return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0, PNGDecContext *VAR_1)\n{", "if (VAR_1->state & PNG_IDAT) {", "av_log(VAR_0, AV_LOG_ERROR, \"pHYs after IDAT\\n\");", "return AVERROR_INVALIDDATA;", "}", "VAR_0->sample_aspect_ratio.num = bytestream2_get_be32(&VAR_1->gb);", "VAR_0->sample_aspect_ratio.den = bytestream2_get_be32(&VAR_1->gb);", "if (VAR_0->sample_aspect_ratio.num < 0 || VAR_0->sample_aspect_ratio.den < 0)\nVAR_0->sample_aspect_ratio = (AVRational){ 0, 1 };", "bytestream2_skip(&VAR_1->gb, 1);", "bytestream2_skip(&VAR_1->gb, 4);", "return 0;", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ] ]
2,104
static int xio3130_downstream_initfn(PCIDevice *d) { PCIEPort *p = PCIE_PORT(d); PCIESlot *s = PCIE_SLOT(d); int rc; pci_bridge_initfn(d, TYPE_PCIE_BUS); pcie_port_init_reg(d); rc = msi_init(d, XIO3130_MSI_OFFSET, XIO3130_MSI_NR_VECTOR, XIO3130_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_64BIT, XIO3130_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_MASKBIT); if (rc < 0) { goto err_bridge; } rc = pci_bridge_ssvid_init(d, XIO3130_SSVID_OFFSET, XIO3130_SSVID_SVID, XIO3130_SSVID_SSID); if (rc < 0) { goto err_bridge; } rc = pcie_cap_init(d, XIO3130_EXP_OFFSET, PCI_EXP_TYPE_DOWNSTREAM, p->port); if (rc < 0) { goto err_msi; } pcie_cap_flr_init(d); pcie_cap_deverr_init(d); pcie_cap_slot_init(d, s->slot); pcie_cap_arifwd_init(d); pcie_chassis_create(s->chassis); rc = pcie_chassis_add_slot(s); if (rc < 0) { goto err_pcie_cap; } rc = pcie_aer_init(d, XIO3130_AER_OFFSET, PCI_ERR_SIZEOF); if (rc < 0) { goto err; } return 0; err: pcie_chassis_del_slot(s); err_pcie_cap: pcie_cap_exit(d); err_msi: msi_uninit(d); err_bridge: pci_bridge_exitfn(d); return rc; }
true
qemu
1108b2f8a939fb5778d384149e2f1b99062a72da
static int xio3130_downstream_initfn(PCIDevice *d) { PCIEPort *p = PCIE_PORT(d); PCIESlot *s = PCIE_SLOT(d); int rc; pci_bridge_initfn(d, TYPE_PCIE_BUS); pcie_port_init_reg(d); rc = msi_init(d, XIO3130_MSI_OFFSET, XIO3130_MSI_NR_VECTOR, XIO3130_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_64BIT, XIO3130_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_MASKBIT); if (rc < 0) { goto err_bridge; } rc = pci_bridge_ssvid_init(d, XIO3130_SSVID_OFFSET, XIO3130_SSVID_SVID, XIO3130_SSVID_SSID); if (rc < 0) { goto err_bridge; } rc = pcie_cap_init(d, XIO3130_EXP_OFFSET, PCI_EXP_TYPE_DOWNSTREAM, p->port); if (rc < 0) { goto err_msi; } pcie_cap_flr_init(d); pcie_cap_deverr_init(d); pcie_cap_slot_init(d, s->slot); pcie_cap_arifwd_init(d); pcie_chassis_create(s->chassis); rc = pcie_chassis_add_slot(s); if (rc < 0) { goto err_pcie_cap; } rc = pcie_aer_init(d, XIO3130_AER_OFFSET, PCI_ERR_SIZEOF); if (rc < 0) { goto err; } return 0; err: pcie_chassis_del_slot(s); err_pcie_cap: pcie_cap_exit(d); err_msi: msi_uninit(d); err_bridge: pci_bridge_exitfn(d); return rc; }
{ "code": [ " XIO3130_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_MASKBIT);", " XIO3130_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_MASKBIT);" ], "line_no": [ 23, 23 ] }
static int FUNC_0(PCIDevice *VAR_0) { PCIEPort *p = PCIE_PORT(VAR_0); PCIESlot *s = PCIE_SLOT(VAR_0); int VAR_1; pci_bridge_initfn(VAR_0, TYPE_PCIE_BUS); pcie_port_init_reg(VAR_0); VAR_1 = msi_init(VAR_0, XIO3130_MSI_OFFSET, XIO3130_MSI_NR_VECTOR, XIO3130_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_64BIT, XIO3130_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_MASKBIT); if (VAR_1 < 0) { goto err_bridge; } VAR_1 = pci_bridge_ssvid_init(VAR_0, XIO3130_SSVID_OFFSET, XIO3130_SSVID_SVID, XIO3130_SSVID_SSID); if (VAR_1 < 0) { goto err_bridge; } VAR_1 = pcie_cap_init(VAR_0, XIO3130_EXP_OFFSET, PCI_EXP_TYPE_DOWNSTREAM, p->port); if (VAR_1 < 0) { goto err_msi; } pcie_cap_flr_init(VAR_0); pcie_cap_deverr_init(VAR_0); pcie_cap_slot_init(VAR_0, s->slot); pcie_cap_arifwd_init(VAR_0); pcie_chassis_create(s->chassis); VAR_1 = pcie_chassis_add_slot(s); if (VAR_1 < 0) { goto err_pcie_cap; } VAR_1 = pcie_aer_init(VAR_0, XIO3130_AER_OFFSET, PCI_ERR_SIZEOF); if (VAR_1 < 0) { goto err; } return 0; err: pcie_chassis_del_slot(s); err_pcie_cap: pcie_cap_exit(VAR_0); err_msi: msi_uninit(VAR_0); err_bridge: pci_bridge_exitfn(VAR_0); return VAR_1; }
[ "static int FUNC_0(PCIDevice *VAR_0)\n{", "PCIEPort *p = PCIE_PORT(VAR_0);", "PCIESlot *s = PCIE_SLOT(VAR_0);", "int VAR_1;", "pci_bridge_initfn(VAR_0, TYPE_PCIE_BUS);", "pcie_port_init_reg(VAR_0);", "VAR_1 = msi_init(VAR_0, XIO3130_MSI_OFFSET, XIO3130_MSI_NR_VECTOR,\nXIO3130_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_64BIT,\nXIO3130_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_MASKBIT);", "if (VAR_1 < 0) {", "goto err_bridge;", "}", "VAR_1 = pci_bridge_ssvid_init(VAR_0, XIO3130_SSVID_OFFSET,\nXIO3130_SSVID_SVID, XIO3130_SSVID_SSID);", "if (VAR_1 < 0) {", "goto err_bridge;", "}", "VAR_1 = pcie_cap_init(VAR_0, XIO3130_EXP_OFFSET, PCI_EXP_TYPE_DOWNSTREAM,\np->port);", "if (VAR_1 < 0) {", "goto err_msi;", "}", "pcie_cap_flr_init(VAR_0);", "pcie_cap_deverr_init(VAR_0);", "pcie_cap_slot_init(VAR_0, s->slot);", "pcie_cap_arifwd_init(VAR_0);", "pcie_chassis_create(s->chassis);", "VAR_1 = pcie_chassis_add_slot(s);", "if (VAR_1 < 0) {", "goto err_pcie_cap;", "}", "VAR_1 = pcie_aer_init(VAR_0, XIO3130_AER_OFFSET, PCI_ERR_SIZEOF);", "if (VAR_1 < 0) {", "goto err;", "}", "return 0;", "err:\npcie_chassis_del_slot(s);", "err_pcie_cap:\npcie_cap_exit(VAR_0);", "err_msi:\nmsi_uninit(VAR_0);", "err_bridge:\npci_bridge_exitfn(VAR_0);", "return VAR_1;", "}" ]
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19, 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 91, 93 ], [ 95, 97 ], [ 99, 101 ], [ 103, 105 ], [ 107 ], [ 109 ] ]
2,105
static av_cold int hevc_decode_free(AVCodecContext *avctx) { HEVCContext *s = avctx->priv_data; HEVCLocalContext *lc = s->HEVClc; int i; pic_arrays_free(s); av_freep(&s->md5_ctx); for(i=0; i < s->nals_allocated; i++) { av_freep(&s->skipped_bytes_pos_nal[i]); } av_freep(&s->skipped_bytes_pos_size_nal); av_freep(&s->skipped_bytes_nal); av_freep(&s->skipped_bytes_pos_nal); av_freep(&s->cabac_state); av_frame_free(&s->tmp_frame); av_frame_free(&s->output_frame); for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { ff_hevc_unref_frame(s, &s->DPB[i], ~0); av_frame_free(&s->DPB[i].frame); } for (i = 0; i < FF_ARRAY_ELEMS(s->vps_list); i++) av_buffer_unref(&s->vps_list[i]); for (i = 0; i < FF_ARRAY_ELEMS(s->sps_list); i++) av_buffer_unref(&s->sps_list[i]); for (i = 0; i < FF_ARRAY_ELEMS(s->pps_list); i++) av_buffer_unref(&s->pps_list[i]); s->sps = NULL; s->pps = NULL; s->vps = NULL; av_buffer_unref(&s->current_sps); av_freep(&s->sh.entry_point_offset); av_freep(&s->sh.offset); av_freep(&s->sh.size); for (i = 1; i < s->threads_number; i++) { lc = s->HEVClcList[i]; if (lc) { av_freep(&s->HEVClcList[i]); av_freep(&s->sList[i]); } } if (s->HEVClc == s->HEVClcList[0]) s->HEVClc = NULL; av_freep(&s->HEVClcList[0]); for (i = 0; i < s->nals_allocated; i++) av_freep(&s->nals[i].rbsp_buffer); av_freep(&s->nals); s->nals_allocated = 0; return 0; }
false
FFmpeg
3fa9692ae2324b8fcc1a8aa47b9a75826740b32e
static av_cold int hevc_decode_free(AVCodecContext *avctx) { HEVCContext *s = avctx->priv_data; HEVCLocalContext *lc = s->HEVClc; int i; pic_arrays_free(s); av_freep(&s->md5_ctx); for(i=0; i < s->nals_allocated; i++) { av_freep(&s->skipped_bytes_pos_nal[i]); } av_freep(&s->skipped_bytes_pos_size_nal); av_freep(&s->skipped_bytes_nal); av_freep(&s->skipped_bytes_pos_nal); av_freep(&s->cabac_state); av_frame_free(&s->tmp_frame); av_frame_free(&s->output_frame); for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { ff_hevc_unref_frame(s, &s->DPB[i], ~0); av_frame_free(&s->DPB[i].frame); } for (i = 0; i < FF_ARRAY_ELEMS(s->vps_list); i++) av_buffer_unref(&s->vps_list[i]); for (i = 0; i < FF_ARRAY_ELEMS(s->sps_list); i++) av_buffer_unref(&s->sps_list[i]); for (i = 0; i < FF_ARRAY_ELEMS(s->pps_list); i++) av_buffer_unref(&s->pps_list[i]); s->sps = NULL; s->pps = NULL; s->vps = NULL; av_buffer_unref(&s->current_sps); av_freep(&s->sh.entry_point_offset); av_freep(&s->sh.offset); av_freep(&s->sh.size); for (i = 1; i < s->threads_number; i++) { lc = s->HEVClcList[i]; if (lc) { av_freep(&s->HEVClcList[i]); av_freep(&s->sList[i]); } } if (s->HEVClc == s->HEVClcList[0]) s->HEVClc = NULL; av_freep(&s->HEVClcList[0]); for (i = 0; i < s->nals_allocated; i++) av_freep(&s->nals[i].rbsp_buffer); av_freep(&s->nals); s->nals_allocated = 0; return 0; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { HEVCContext *s = avctx->priv_data; HEVCLocalContext *lc = s->HEVClc; int VAR_0; pic_arrays_free(s); av_freep(&s->md5_ctx); for(VAR_0=0; VAR_0 < s->nals_allocated; VAR_0++) { av_freep(&s->skipped_bytes_pos_nal[VAR_0]); } av_freep(&s->skipped_bytes_pos_size_nal); av_freep(&s->skipped_bytes_nal); av_freep(&s->skipped_bytes_pos_nal); av_freep(&s->cabac_state); av_frame_free(&s->tmp_frame); av_frame_free(&s->output_frame); for (VAR_0 = 0; VAR_0 < FF_ARRAY_ELEMS(s->DPB); VAR_0++) { ff_hevc_unref_frame(s, &s->DPB[VAR_0], ~0); av_frame_free(&s->DPB[VAR_0].frame); } for (VAR_0 = 0; VAR_0 < FF_ARRAY_ELEMS(s->vps_list); VAR_0++) av_buffer_unref(&s->vps_list[VAR_0]); for (VAR_0 = 0; VAR_0 < FF_ARRAY_ELEMS(s->sps_list); VAR_0++) av_buffer_unref(&s->sps_list[VAR_0]); for (VAR_0 = 0; VAR_0 < FF_ARRAY_ELEMS(s->pps_list); VAR_0++) av_buffer_unref(&s->pps_list[VAR_0]); s->sps = NULL; s->pps = NULL; s->vps = NULL; av_buffer_unref(&s->current_sps); av_freep(&s->sh.entry_point_offset); av_freep(&s->sh.offset); av_freep(&s->sh.size); for (VAR_0 = 1; VAR_0 < s->threads_number; VAR_0++) { lc = s->HEVClcList[VAR_0]; if (lc) { av_freep(&s->HEVClcList[VAR_0]); av_freep(&s->sList[VAR_0]); } } if (s->HEVClc == s->HEVClcList[0]) s->HEVClc = NULL; av_freep(&s->HEVClcList[0]); for (VAR_0 = 0; VAR_0 < s->nals_allocated; VAR_0++) av_freep(&s->nals[VAR_0].rbsp_buffer); av_freep(&s->nals); s->nals_allocated = 0; return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "HEVCContext *s = avctx->priv_data;", "HEVCLocalContext *lc = s->HEVClc;", "int VAR_0;", "pic_arrays_free(s);", "av_freep(&s->md5_ctx);", "for(VAR_0=0; VAR_0 < s->nals_allocated; VAR_0++) {", "av_freep(&s->skipped_bytes_pos_nal[VAR_0]);", "}", "av_freep(&s->skipped_bytes_pos_size_nal);", "av_freep(&s->skipped_bytes_nal);", "av_freep(&s->skipped_bytes_pos_nal);", "av_freep(&s->cabac_state);", "av_frame_free(&s->tmp_frame);", "av_frame_free(&s->output_frame);", "for (VAR_0 = 0; VAR_0 < FF_ARRAY_ELEMS(s->DPB); VAR_0++) {", "ff_hevc_unref_frame(s, &s->DPB[VAR_0], ~0);", "av_frame_free(&s->DPB[VAR_0].frame);", "}", "for (VAR_0 = 0; VAR_0 < FF_ARRAY_ELEMS(s->vps_list); VAR_0++)", "av_buffer_unref(&s->vps_list[VAR_0]);", "for (VAR_0 = 0; VAR_0 < FF_ARRAY_ELEMS(s->sps_list); VAR_0++)", "av_buffer_unref(&s->sps_list[VAR_0]);", "for (VAR_0 = 0; VAR_0 < FF_ARRAY_ELEMS(s->pps_list); VAR_0++)", "av_buffer_unref(&s->pps_list[VAR_0]);", "s->sps = NULL;", "s->pps = NULL;", "s->vps = NULL;", "av_buffer_unref(&s->current_sps);", "av_freep(&s->sh.entry_point_offset);", "av_freep(&s->sh.offset);", "av_freep(&s->sh.size);", "for (VAR_0 = 1; VAR_0 < s->threads_number; VAR_0++) {", "lc = s->HEVClcList[VAR_0];", "if (lc) {", "av_freep(&s->HEVClcList[VAR_0]);", "av_freep(&s->sList[VAR_0]);", "}", "}", "if (s->HEVClc == s->HEVClcList[0])\ns->HEVClc = NULL;", "av_freep(&s->HEVClcList[0]);", "for (VAR_0 = 0; VAR_0 < s->nals_allocated; VAR_0++)", "av_freep(&s->nals[VAR_0].rbsp_buffer);", "av_freep(&s->nals);", "s->nals_allocated = 0;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121 ] ]
2,106
static av_cold int dct_init(MpegEncContext *s) { ff_blockdsp_init(&s->bdsp, s->avctx); ff_hpeldsp_init(&s->hdsp, s->avctx->flags); ff_me_cmp_init(&s->mecc, s->avctx); ff_mpegvideodsp_init(&s->mdsp); ff_videodsp_init(&s->vdsp, s->avctx->bits_per_raw_sample); s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_c; s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_c; s->dct_unquantize_mpeg1_intra = dct_unquantize_mpeg1_intra_c; s->dct_unquantize_mpeg1_inter = dct_unquantize_mpeg1_inter_c; s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_c; if (s->flags & CODEC_FLAG_BITEXACT) s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_bitexact; s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_c; if (HAVE_INTRINSICS_NEON) ff_mpv_common_init_neon(s); if (ARCH_ARM) ff_mpv_common_init_arm(s); if (ARCH_PPC) ff_mpv_common_init_ppc(s); if (ARCH_X86) ff_mpv_common_init_x86(s); return 0; }
false
FFmpeg
cf1e0786ed64e69614760bfb4ecd7adbde8e6094
static av_cold int dct_init(MpegEncContext *s) { ff_blockdsp_init(&s->bdsp, s->avctx); ff_hpeldsp_init(&s->hdsp, s->avctx->flags); ff_me_cmp_init(&s->mecc, s->avctx); ff_mpegvideodsp_init(&s->mdsp); ff_videodsp_init(&s->vdsp, s->avctx->bits_per_raw_sample); s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_c; s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_c; s->dct_unquantize_mpeg1_intra = dct_unquantize_mpeg1_intra_c; s->dct_unquantize_mpeg1_inter = dct_unquantize_mpeg1_inter_c; s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_c; if (s->flags & CODEC_FLAG_BITEXACT) s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_bitexact; s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_c; if (HAVE_INTRINSICS_NEON) ff_mpv_common_init_neon(s); if (ARCH_ARM) ff_mpv_common_init_arm(s); if (ARCH_PPC) ff_mpv_common_init_ppc(s); if (ARCH_X86) ff_mpv_common_init_x86(s); return 0; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(MpegEncContext *s) { ff_blockdsp_init(&s->bdsp, s->avctx); ff_hpeldsp_init(&s->hdsp, s->avctx->flags); ff_me_cmp_init(&s->mecc, s->avctx); ff_mpegvideodsp_init(&s->mdsp); ff_videodsp_init(&s->vdsp, s->avctx->bits_per_raw_sample); s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_c; s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_c; s->dct_unquantize_mpeg1_intra = dct_unquantize_mpeg1_intra_c; s->dct_unquantize_mpeg1_inter = dct_unquantize_mpeg1_inter_c; s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_c; if (s->flags & CODEC_FLAG_BITEXACT) s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_bitexact; s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_c; if (HAVE_INTRINSICS_NEON) ff_mpv_common_init_neon(s); if (ARCH_ARM) ff_mpv_common_init_arm(s); if (ARCH_PPC) ff_mpv_common_init_ppc(s); if (ARCH_X86) ff_mpv_common_init_x86(s); return 0; }
[ "static av_cold int FUNC_0(MpegEncContext *s)\n{", "ff_blockdsp_init(&s->bdsp, s->avctx);", "ff_hpeldsp_init(&s->hdsp, s->avctx->flags);", "ff_me_cmp_init(&s->mecc, s->avctx);", "ff_mpegvideodsp_init(&s->mdsp);", "ff_videodsp_init(&s->vdsp, s->avctx->bits_per_raw_sample);", "s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_c;", "s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_c;", "s->dct_unquantize_mpeg1_intra = dct_unquantize_mpeg1_intra_c;", "s->dct_unquantize_mpeg1_inter = dct_unquantize_mpeg1_inter_c;", "s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_c;", "if (s->flags & CODEC_FLAG_BITEXACT)\ns->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_bitexact;", "s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_c;", "if (HAVE_INTRINSICS_NEON)\nff_mpv_common_init_neon(s);", "if (ARCH_ARM)\nff_mpv_common_init_arm(s);", "if (ARCH_PPC)\nff_mpv_common_init_ppc(s);", "if (ARCH_X86)\nff_mpv_common_init_x86(s);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 35, 37 ], [ 41, 43 ], [ 45, 47 ], [ 49, 51 ], [ 55 ], [ 57 ] ]
2,107
static void filter_mb_edgeh( H264Context *h, uint8_t *pix, int stride, int bS[4], int qp ) { int i, d; const int index_a = clip( qp + h->slice_alpha_c0_offset, 0, 51 ); const int alpha = alpha_table[index_a]; const int beta = beta_table[clip( qp + h->slice_beta_offset, 0, 51 )]; const int pix_next = stride; for( i = 0; i < 4; i++ ) { if( bS[i] == 0 ) { pix += 4; continue; } /* 4px edge length */ for( d = 0; d < 4; d++ ) { const uint8_t p0 = pix[-1*pix_next]; const uint8_t p1 = pix[-2*pix_next]; const uint8_t p2 = pix[-3*pix_next]; const uint8_t q0 = pix[0]; const uint8_t q1 = pix[1*pix_next]; const uint8_t q2 = pix[2*pix_next]; if( abs( p0 - q0 ) >= alpha || abs( p1 - p0 ) >= beta || abs( q1 - q0 ) >= beta ) { pix++; continue; } if( bS[i] < 4 ) { const int tc0 = tc0_table[index_a][bS[i] - 1]; int tc = tc0; int i_delta; if( abs( p2 - p0 ) < beta ) { pix[-2*pix_next] = p1 + clip( ( p2 + ( ( p0 + q0 + 1 ) >> 1 ) - ( p1 << 1 ) ) >> 1, -tc0, tc0 ); tc++; } if( abs( q2 - q0 ) < beta ) { pix[pix_next] = q1 + clip( ( q2 + ( ( p0 + q0 + 1 ) >> 1 ) - ( q1 << 1 ) ) >> 1, -tc0, tc0 ); tc++; } i_delta = clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); pix[-pix_next] = clip( p0 + i_delta, 0, 255 ); /* p0' */ pix[0] = clip( q0 - i_delta, 0, 255 ); /* q0' */ } else { const uint8_t p3 = pix[-4*pix_next]; const uint8_t q3 = pix[ 3*pix_next]; const int c = abs( p0 - q0 ) < (( alpha >> 2 ) + 2 ); if( abs( p2 - p0 ) < beta && c ) { /* p0', p1', p2' */ pix[-1*pix_next] = ( p2 + 2*p1 + 2*p0 + 2*q0 + q1 + 4 ) >> 3; pix[-2*pix_next] = ( p2 + p1 + p0 + q0 + 2 ) >> 2; pix[-3*pix_next] = ( 2*p3 + 3*p2 + p1 + p0 + q0 + 4 ) >> 3; } else { /* p0' */ pix[-1*pix_next] = ( 2*p1 + p0 + q1 + 2 ) >> 2; } if( abs( q2 - q0 ) < beta && c ) { /* q0', q1', q2' */ pix[0*pix_next] = ( p1 + 2*p0 + 2*q0 + 2*q1 + q2 + 4 ) >> 3; pix[1*pix_next] = ( p0 + q0 + q1 + q2 + 2 ) >> 2; pix[2*pix_next] = ( 2*q3 + 3*q2 + q1 + q0 + p0 + 4 ) >> 3; } else { /* q0' */ pix[0*pix_next] = ( 2*q1 + q0 + p1 + 2 ) >> 2; } } pix++; } } }
false
FFmpeg
3ebc7e04dea6072400d91c1c90eb3911754cee06
static void filter_mb_edgeh( H264Context *h, uint8_t *pix, int stride, int bS[4], int qp ) { int i, d; const int index_a = clip( qp + h->slice_alpha_c0_offset, 0, 51 ); const int alpha = alpha_table[index_a]; const int beta = beta_table[clip( qp + h->slice_beta_offset, 0, 51 )]; const int pix_next = stride; for( i = 0; i < 4; i++ ) { if( bS[i] == 0 ) { pix += 4; continue; } for( d = 0; d < 4; d++ ) { const uint8_t p0 = pix[-1*pix_next]; const uint8_t p1 = pix[-2*pix_next]; const uint8_t p2 = pix[-3*pix_next]; const uint8_t q0 = pix[0]; const uint8_t q1 = pix[1*pix_next]; const uint8_t q2 = pix[2*pix_next]; if( abs( p0 - q0 ) >= alpha || abs( p1 - p0 ) >= beta || abs( q1 - q0 ) >= beta ) { pix++; continue; } if( bS[i] < 4 ) { const int tc0 = tc0_table[index_a][bS[i] - 1]; int tc = tc0; int i_delta; if( abs( p2 - p0 ) < beta ) { pix[-2*pix_next] = p1 + clip( ( p2 + ( ( p0 + q0 + 1 ) >> 1 ) - ( p1 << 1 ) ) >> 1, -tc0, tc0 ); tc++; } if( abs( q2 - q0 ) < beta ) { pix[pix_next] = q1 + clip( ( q2 + ( ( p0 + q0 + 1 ) >> 1 ) - ( q1 << 1 ) ) >> 1, -tc0, tc0 ); tc++; } i_delta = clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); pix[-pix_next] = clip( p0 + i_delta, 0, 255 ); pix[0] = clip( q0 - i_delta, 0, 255 ); } else { const uint8_t p3 = pix[-4*pix_next]; const uint8_t q3 = pix[ 3*pix_next]; const int c = abs( p0 - q0 ) < (( alpha >> 2 ) + 2 ); if( abs( p2 - p0 ) < beta && c ) { pix[-1*pix_next] = ( p2 + 2*p1 + 2*p0 + 2*q0 + q1 + 4 ) >> 3; pix[-2*pix_next] = ( p2 + p1 + p0 + q0 + 2 ) >> 2; pix[-3*pix_next] = ( 2*p3 + 3*p2 + p1 + p0 + q0 + 4 ) >> 3; } else { pix[-1*pix_next] = ( 2*p1 + p0 + q1 + 2 ) >> 2; } if( abs( q2 - q0 ) < beta && c ) { pix[0*pix_next] = ( p1 + 2*p0 + 2*q0 + 2*q1 + q2 + 4 ) >> 3; pix[1*pix_next] = ( p0 + q0 + q1 + q2 + 2 ) >> 2; pix[2*pix_next] = ( 2*q3 + 3*q2 + q1 + q0 + p0 + 4 ) >> 3; } else { pix[0*pix_next] = ( 2*q1 + q0 + p1 + 2 ) >> 2; } } pix++; } } }
{ "code": [], "line_no": [] }
static void FUNC_0( H264Context *VAR_0, uint8_t *VAR_1, int VAR_2, int VAR_3[4], int VAR_4 ) { int VAR_5, VAR_6; const int VAR_7 = clip( VAR_4 + VAR_0->slice_alpha_c0_offset, 0, 51 ); const int VAR_8 = alpha_table[VAR_7]; const int VAR_9 = beta_table[clip( VAR_4 + VAR_0->slice_beta_offset, 0, 51 )]; const int VAR_10 = VAR_2; for( VAR_5 = 0; VAR_5 < 4; VAR_5++ ) { if( VAR_3[VAR_5] == 0 ) { VAR_1 += 4; continue; } for( VAR_6 = 0; VAR_6 < 4; VAR_6++ ) { const uint8_t VAR_11 = VAR_1[-1*VAR_10]; const uint8_t VAR_12 = VAR_1[-2*VAR_10]; const uint8_t VAR_13 = VAR_1[-3*VAR_10]; const uint8_t VAR_14 = VAR_1[0]; const uint8_t VAR_15 = VAR_1[1*VAR_10]; const uint8_t VAR_16 = VAR_1[2*VAR_10]; if( abs( VAR_11 - VAR_14 ) >= VAR_8 || abs( VAR_12 - VAR_11 ) >= VAR_9 || abs( VAR_15 - VAR_14 ) >= VAR_9 ) { VAR_1++; continue; } if( VAR_3[VAR_5] < 4 ) { const int VAR_17 = tc0_table[VAR_7][VAR_3[VAR_5] - 1]; int VAR_18 = VAR_17; int VAR_19; if( abs( VAR_13 - VAR_11 ) < VAR_9 ) { VAR_1[-2*VAR_10] = VAR_12 + clip( ( VAR_13 + ( ( VAR_11 + VAR_14 + 1 ) >> 1 ) - ( VAR_12 << 1 ) ) >> 1, -VAR_17, VAR_17 ); VAR_18++; } if( abs( VAR_16 - VAR_14 ) < VAR_9 ) { VAR_1[VAR_10] = VAR_15 + clip( ( VAR_16 + ( ( VAR_11 + VAR_14 + 1 ) >> 1 ) - ( VAR_15 << 1 ) ) >> 1, -VAR_17, VAR_17 ); VAR_18++; } VAR_19 = clip( (((VAR_14 - VAR_11 ) << 2) + (VAR_12 - VAR_15) + 4) >> 3, -VAR_18, VAR_18 ); VAR_1[-VAR_10] = clip( VAR_11 + VAR_19, 0, 255 ); VAR_1[0] = clip( VAR_14 - VAR_19, 0, 255 ); } else { const uint8_t VAR_20 = VAR_1[-4*VAR_10]; const uint8_t VAR_21 = VAR_1[ 3*VAR_10]; const int VAR_22 = abs( VAR_11 - VAR_14 ) < (( VAR_8 >> 2 ) + 2 ); if( abs( VAR_13 - VAR_11 ) < VAR_9 && VAR_22 ) { VAR_1[-1*VAR_10] = ( VAR_13 + 2*VAR_12 + 2*VAR_11 + 2*VAR_14 + VAR_15 + 4 ) >> 3; VAR_1[-2*VAR_10] = ( VAR_13 + VAR_12 + VAR_11 + VAR_14 + 2 ) >> 2; VAR_1[-3*VAR_10] = ( 2*VAR_20 + 3*VAR_13 + VAR_12 + VAR_11 + VAR_14 + 4 ) >> 3; } else { VAR_1[-1*VAR_10] = ( 2*VAR_12 + VAR_11 + VAR_15 + 2 ) >> 2; } if( abs( VAR_16 - VAR_14 ) < VAR_9 && VAR_22 ) { VAR_1[0*VAR_10] = ( VAR_12 + 2*VAR_11 + 2*VAR_14 + 2*VAR_15 + VAR_16 + 4 ) >> 3; VAR_1[1*VAR_10] = ( VAR_11 + VAR_14 + VAR_15 + VAR_16 + 2 ) >> 2; VAR_1[2*VAR_10] = ( 2*VAR_21 + 3*VAR_16 + VAR_15 + VAR_14 + VAR_11 + 4 ) >> 3; } else { VAR_1[0*VAR_10] = ( 2*VAR_15 + VAR_14 + VAR_12 + 2 ) >> 2; } } VAR_1++; } } }
[ "static void FUNC_0( H264Context *VAR_0, uint8_t *VAR_1, int VAR_2, int VAR_3[4], int VAR_4 ) {", "int VAR_5, VAR_6;", "const int VAR_7 = clip( VAR_4 + VAR_0->slice_alpha_c0_offset, 0, 51 );", "const int VAR_8 = alpha_table[VAR_7];", "const int VAR_9 = beta_table[clip( VAR_4 + VAR_0->slice_beta_offset, 0, 51 )];", "const int VAR_10 = VAR_2;", "for( VAR_5 = 0; VAR_5 < 4; VAR_5++ ) {", "if( VAR_3[VAR_5] == 0 ) {", "VAR_1 += 4;", "continue;", "}", "for( VAR_6 = 0; VAR_6 < 4; VAR_6++ ) {", "const uint8_t VAR_11 = VAR_1[-1*VAR_10];", "const uint8_t VAR_12 = VAR_1[-2*VAR_10];", "const uint8_t VAR_13 = VAR_1[-3*VAR_10];", "const uint8_t VAR_14 = VAR_1[0];", "const uint8_t VAR_15 = VAR_1[1*VAR_10];", "const uint8_t VAR_16 = VAR_1[2*VAR_10];", "if( abs( VAR_11 - VAR_14 ) >= VAR_8 ||\nabs( VAR_12 - VAR_11 ) >= VAR_9 ||\nabs( VAR_15 - VAR_14 ) >= VAR_9 ) {", "VAR_1++;", "continue;", "}", "if( VAR_3[VAR_5] < 4 ) {", "const int VAR_17 = tc0_table[VAR_7][VAR_3[VAR_5] - 1];", "int VAR_18 = VAR_17;", "int VAR_19;", "if( abs( VAR_13 - VAR_11 ) < VAR_9 ) {", "VAR_1[-2*VAR_10] = VAR_12 + clip( ( VAR_13 + ( ( VAR_11 + VAR_14 + 1 ) >> 1 ) - ( VAR_12 << 1 ) ) >> 1, -VAR_17, VAR_17 );", "VAR_18++;", "}", "if( abs( VAR_16 - VAR_14 ) < VAR_9 ) {", "VAR_1[VAR_10] = VAR_15 + clip( ( VAR_16 + ( ( VAR_11 + VAR_14 + 1 ) >> 1 ) - ( VAR_15 << 1 ) ) >> 1, -VAR_17, VAR_17 );", "VAR_18++;", "}", "VAR_19 = clip( (((VAR_14 - VAR_11 ) << 2) + (VAR_12 - VAR_15) + 4) >> 3, -VAR_18, VAR_18 );", "VAR_1[-VAR_10] = clip( VAR_11 + VAR_19, 0, 255 );", "VAR_1[0] = clip( VAR_14 - VAR_19, 0, 255 );", "}", "else\n{", "const uint8_t VAR_20 = VAR_1[-4*VAR_10];", "const uint8_t VAR_21 = VAR_1[ 3*VAR_10];", "const int VAR_22 = abs( VAR_11 - VAR_14 ) < (( VAR_8 >> 2 ) + 2 );", "if( abs( VAR_13 - VAR_11 ) < VAR_9 && VAR_22 ) {", "VAR_1[-1*VAR_10] = ( VAR_13 + 2*VAR_12 + 2*VAR_11 + 2*VAR_14 + VAR_15 + 4 ) >> 3;", "VAR_1[-2*VAR_10] = ( VAR_13 + VAR_12 + VAR_11 + VAR_14 + 2 ) >> 2;", "VAR_1[-3*VAR_10] = ( 2*VAR_20 + 3*VAR_13 + VAR_12 + VAR_11 + VAR_14 + 4 ) >> 3;", "} else {", "VAR_1[-1*VAR_10] = ( 2*VAR_12 + VAR_11 + VAR_15 + 2 ) >> 2;", "}", "if( abs( VAR_16 - VAR_14 ) < VAR_9 && VAR_22 ) {", "VAR_1[0*VAR_10] = ( VAR_12 + 2*VAR_11 + 2*VAR_14 + 2*VAR_15 + VAR_16 + 4 ) >> 3;", "VAR_1[1*VAR_10] = ( VAR_11 + VAR_14 + VAR_15 + VAR_16 + 2 ) >> 2;", "VAR_1[2*VAR_10] = ( 2*VAR_21 + 3*VAR_16 + VAR_15 + VAR_14 + VAR_11 + 4 ) >> 3;", "} else {", "VAR_1[0*VAR_10] = ( 2*VAR_15 + VAR_14 + VAR_12 + 2 ) >> 2;", "}", "}", "VAR_1++;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45, 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ] ]
2,108
static void aflat(WaveformContext *s, AVFrame *in, AVFrame *out, int component, int intensity, int offset, int column) { const int plane = s->desc->comp[component].plane; const int mirror = s->mirror; const int c0_linesize = in->linesize[ plane + 0 ]; const int c1_linesize = in->linesize[(plane + 1) % s->ncomp]; const int c2_linesize = in->linesize[(plane + 2) % s->ncomp]; const int d0_linesize = out->linesize[ plane + 0 ]; const int d1_linesize = out->linesize[(plane + 1) % s->ncomp]; const int d2_linesize = out->linesize[(plane + 2) % s->ncomp]; const int max = 255 - intensity; const int src_h = in->height; const int src_w = in->width; int x, y; if (column) { const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1); const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1); const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1); for (x = 0; x < src_w; x++) { const uint8_t *c0_data = in->data[plane + 0]; const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp]; const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp]; uint8_t *d0_data = out->data[plane] + offset * d0_linesize; uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + offset * d1_linesize; uint8_t *d2_data = out->data[(plane + 2) % s->ncomp] + offset * d2_linesize; uint8_t * const d0_bottom_line = d0_data + d0_linesize * (s->size - 1); uint8_t * const d0 = (mirror ? d0_bottom_line : d0_data); uint8_t * const d1_bottom_line = d1_data + d1_linesize * (s->size - 1); uint8_t * const d1 = (mirror ? d1_bottom_line : d1_data); uint8_t * const d2_bottom_line = d2_data + d2_linesize * (s->size - 1); uint8_t * const d2 = (mirror ? d2_bottom_line : d2_data); for (y = 0; y < src_h; y++) { const int c0 = c0_data[x] + 128; const int c1 = c1_data[x] - 128; const int c2 = c2_data[x] - 128; uint8_t *target; int p; target = d0 + x + d0_signed_linesize * c0; update(target, max, intensity); for (p = c0 + c1; p < c0; p++) { target = d1 + x + d1_signed_linesize * p; update(target, max, 1); } for (p = c0 + c1 - 1; p > c0; p--) { target = d1 + x + d1_signed_linesize * p; update(target, max, 1); } for (p = c0 + c2; p < c0; p++) { target = d2 + x + d2_signed_linesize * p; update(target, max, 1); } for (p = c0 + c2 - 1; p > c0; p--) { target = d2 + x + d2_signed_linesize * p; update(target, max, 1); } c0_data += c0_linesize; c1_data += c1_linesize; c2_data += c2_linesize; d0_data += d0_linesize; d1_data += d1_linesize; d2_data += d2_linesize; } } } else { const uint8_t *c0_data = in->data[plane]; const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp]; const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp]; uint8_t *d0_data = out->data[plane] + offset; uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + offset; uint8_t *d2_data = out->data[(plane + 2) % s->ncomp] + offset; if (mirror) { d0_data += s->size - 1; d1_data += s->size - 1; d2_data += s->size - 1; } for (y = 0; y < src_h; y++) { for (x = 0; x < src_w; x++) { const int c0 = c0_data[x] + 128; const int c1 = c1_data[x] - 128; const int c2 = c2_data[x] - 128; uint8_t *target; int p; if (mirror) target = d0_data - c0; else target = d0_data + c0; update(target, max, intensity); for (p = c0 + c1; p < c0; p++) { if (mirror) target = d1_data - p; else target = d1_data + p; update(target, max, 1); } for (p = c0 + 1; p < c0 + c1; p++) { if (mirror) target = d1_data - p; else target = d1_data + p; update(target, max, 1); } for (p = c0 + c2; p < c0; p++) { if (mirror) target = d2_data - p; else target = d2_data + p; update(target, max, 1); } for (p = c0 + 1; p < c0 + c2; p++) { if (mirror) target = d2_data - p; else target = d2_data + p; update(target, max, 1); } } c0_data += c0_linesize; c1_data += c1_linesize; c2_data += c2_linesize; d0_data += d0_linesize; d1_data += d1_linesize; d2_data += d2_linesize; } } envelope(s, out, plane, (plane + 0) % s->ncomp); envelope(s, out, plane, (plane + 1) % s->ncomp); envelope(s, out, plane, (plane + 2) % s->ncomp); }
false
FFmpeg
5b349c8d7cc5dd26b3fbbce6e3883ce02861eeb7
static void aflat(WaveformContext *s, AVFrame *in, AVFrame *out, int component, int intensity, int offset, int column) { const int plane = s->desc->comp[component].plane; const int mirror = s->mirror; const int c0_linesize = in->linesize[ plane + 0 ]; const int c1_linesize = in->linesize[(plane + 1) % s->ncomp]; const int c2_linesize = in->linesize[(plane + 2) % s->ncomp]; const int d0_linesize = out->linesize[ plane + 0 ]; const int d1_linesize = out->linesize[(plane + 1) % s->ncomp]; const int d2_linesize = out->linesize[(plane + 2) % s->ncomp]; const int max = 255 - intensity; const int src_h = in->height; const int src_w = in->width; int x, y; if (column) { const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1); const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1); const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1); for (x = 0; x < src_w; x++) { const uint8_t *c0_data = in->data[plane + 0]; const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp]; const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp]; uint8_t *d0_data = out->data[plane] + offset * d0_linesize; uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + offset * d1_linesize; uint8_t *d2_data = out->data[(plane + 2) % s->ncomp] + offset * d2_linesize; uint8_t * const d0_bottom_line = d0_data + d0_linesize * (s->size - 1); uint8_t * const d0 = (mirror ? d0_bottom_line : d0_data); uint8_t * const d1_bottom_line = d1_data + d1_linesize * (s->size - 1); uint8_t * const d1 = (mirror ? d1_bottom_line : d1_data); uint8_t * const d2_bottom_line = d2_data + d2_linesize * (s->size - 1); uint8_t * const d2 = (mirror ? d2_bottom_line : d2_data); for (y = 0; y < src_h; y++) { const int c0 = c0_data[x] + 128; const int c1 = c1_data[x] - 128; const int c2 = c2_data[x] - 128; uint8_t *target; int p; target = d0 + x + d0_signed_linesize * c0; update(target, max, intensity); for (p = c0 + c1; p < c0; p++) { target = d1 + x + d1_signed_linesize * p; update(target, max, 1); } for (p = c0 + c1 - 1; p > c0; p--) { target = d1 + x + d1_signed_linesize * p; update(target, max, 1); } for (p = c0 + c2; p < c0; p++) { target = d2 + x + d2_signed_linesize * p; update(target, max, 1); } for (p = c0 + c2 - 1; p > c0; p--) { target = d2 + x + d2_signed_linesize * p; update(target, max, 1); } c0_data += c0_linesize; c1_data += c1_linesize; c2_data += c2_linesize; d0_data += d0_linesize; d1_data += d1_linesize; d2_data += d2_linesize; } } } else { const uint8_t *c0_data = in->data[plane]; const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp]; const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp]; uint8_t *d0_data = out->data[plane] + offset; uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + offset; uint8_t *d2_data = out->data[(plane + 2) % s->ncomp] + offset; if (mirror) { d0_data += s->size - 1; d1_data += s->size - 1; d2_data += s->size - 1; } for (y = 0; y < src_h; y++) { for (x = 0; x < src_w; x++) { const int c0 = c0_data[x] + 128; const int c1 = c1_data[x] - 128; const int c2 = c2_data[x] - 128; uint8_t *target; int p; if (mirror) target = d0_data - c0; else target = d0_data + c0; update(target, max, intensity); for (p = c0 + c1; p < c0; p++) { if (mirror) target = d1_data - p; else target = d1_data + p; update(target, max, 1); } for (p = c0 + 1; p < c0 + c1; p++) { if (mirror) target = d1_data - p; else target = d1_data + p; update(target, max, 1); } for (p = c0 + c2; p < c0; p++) { if (mirror) target = d2_data - p; else target = d2_data + p; update(target, max, 1); } for (p = c0 + 1; p < c0 + c2; p++) { if (mirror) target = d2_data - p; else target = d2_data + p; update(target, max, 1); } } c0_data += c0_linesize; c1_data += c1_linesize; c2_data += c2_linesize; d0_data += d0_linesize; d1_data += d1_linesize; d2_data += d2_linesize; } } envelope(s, out, plane, (plane + 0) % s->ncomp); envelope(s, out, plane, (plane + 1) % s->ncomp); envelope(s, out, plane, (plane + 2) % s->ncomp); }
{ "code": [], "line_no": [] }
static void FUNC_0(WaveformContext *VAR_0, AVFrame *VAR_1, AVFrame *VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6) { const int VAR_7 = VAR_0->desc->comp[VAR_3].VAR_7; const int VAR_8 = VAR_0->VAR_8; const int VAR_9 = VAR_1->linesize[ VAR_7 + 0 ]; const int VAR_10 = VAR_1->linesize[(VAR_7 + 1) % VAR_0->ncomp]; const int VAR_11 = VAR_1->linesize[(VAR_7 + 2) % VAR_0->ncomp]; const int VAR_12 = VAR_2->linesize[ VAR_7 + 0 ]; const int VAR_13 = VAR_2->linesize[(VAR_7 + 1) % VAR_0->ncomp]; const int VAR_14 = VAR_2->linesize[(VAR_7 + 2) % VAR_0->ncomp]; const int VAR_15 = 255 - VAR_4; const int VAR_16 = VAR_1->height; const int VAR_17 = VAR_1->width; int VAR_18, VAR_19; if (VAR_6) { const int VAR_20 = VAR_12 * (VAR_8 == 1 ? -1 : 1); const int VAR_21 = VAR_13 * (VAR_8 == 1 ? -1 : 1); const int VAR_22 = VAR_14 * (VAR_8 == 1 ? -1 : 1); for (VAR_18 = 0; VAR_18 < VAR_17; VAR_18++) { const uint8_t *VAR_30 = VAR_1->data[VAR_7 + 0]; const uint8_t *VAR_30 = VAR_1->data[(VAR_7 + 1) % VAR_0->ncomp]; const uint8_t *VAR_30 = VAR_1->data[(VAR_7 + 2) % VAR_0->ncomp]; uint8_t *d0_data = VAR_2->data[VAR_7] + VAR_5 * VAR_12; uint8_t *d1_data = VAR_2->data[(VAR_7 + 1) % VAR_0->ncomp] + VAR_5 * VAR_13; uint8_t *d2_data = VAR_2->data[(VAR_7 + 2) % VAR_0->ncomp] + VAR_5 * VAR_14; uint8_t * const d0_bottom_line = d0_data + VAR_12 * (VAR_0->size - 1); uint8_t * const d0 = (VAR_8 ? d0_bottom_line : d0_data); uint8_t * const d1_bottom_line = d1_data + VAR_13 * (VAR_0->size - 1); uint8_t * const d1 = (VAR_8 ? d1_bottom_line : d1_data); uint8_t * const d2_bottom_line = d2_data + VAR_14 * (VAR_0->size - 1); uint8_t * const d2 = (VAR_8 ? d2_bottom_line : d2_data); for (VAR_19 = 0; VAR_19 < VAR_16; VAR_19++) { const int VAR_30 = VAR_30[VAR_18] + 128; const int VAR_30 = VAR_30[VAR_18] - 128; const int VAR_30 = VAR_30[VAR_18] - 128; uint8_t *target; int VAR_30; target = d0 + VAR_18 + VAR_20 * VAR_30; update(target, VAR_15, VAR_4); for (VAR_30 = VAR_30 + VAR_30; VAR_30 < VAR_30; VAR_30++) { target = d1 + VAR_18 + VAR_21 * VAR_30; update(target, VAR_15, 1); } for (VAR_30 = VAR_30 + VAR_30 - 1; VAR_30 > VAR_30; VAR_30--) { target = d1 + VAR_18 + VAR_21 * VAR_30; update(target, VAR_15, 1); } for (VAR_30 = VAR_30 + VAR_30; VAR_30 < VAR_30; VAR_30++) { target = d2 + VAR_18 + VAR_22 * VAR_30; update(target, VAR_15, 1); } for (VAR_30 = VAR_30 + VAR_30 - 1; VAR_30 > VAR_30; VAR_30--) { target = d2 + VAR_18 + VAR_22 * VAR_30; update(target, VAR_15, 1); } VAR_30 += VAR_9; VAR_30 += VAR_10; VAR_30 += VAR_11; d0_data += VAR_12; d1_data += VAR_13; d2_data += VAR_14; } } } else { const uint8_t *VAR_30 = VAR_1->data[VAR_7]; const uint8_t *VAR_30 = VAR_1->data[(VAR_7 + 1) % VAR_0->ncomp]; const uint8_t *VAR_30 = VAR_1->data[(VAR_7 + 2) % VAR_0->ncomp]; uint8_t *d0_data = VAR_2->data[VAR_7] + VAR_5; uint8_t *d1_data = VAR_2->data[(VAR_7 + 1) % VAR_0->ncomp] + VAR_5; uint8_t *d2_data = VAR_2->data[(VAR_7 + 2) % VAR_0->ncomp] + VAR_5; if (VAR_8) { d0_data += VAR_0->size - 1; d1_data += VAR_0->size - 1; d2_data += VAR_0->size - 1; } for (VAR_19 = 0; VAR_19 < VAR_16; VAR_19++) { for (VAR_18 = 0; VAR_18 < VAR_17; VAR_18++) { const int VAR_30 = VAR_30[VAR_18] + 128; const int VAR_30 = VAR_30[VAR_18] - 128; const int VAR_30 = VAR_30[VAR_18] - 128; uint8_t *target; int VAR_30; if (VAR_8) target = d0_data - VAR_30; else target = d0_data + VAR_30; update(target, VAR_15, VAR_4); for (VAR_30 = VAR_30 + VAR_30; VAR_30 < VAR_30; VAR_30++) { if (VAR_8) target = d1_data - VAR_30; else target = d1_data + VAR_30; update(target, VAR_15, 1); } for (VAR_30 = VAR_30 + 1; VAR_30 < VAR_30 + VAR_30; VAR_30++) { if (VAR_8) target = d1_data - VAR_30; else target = d1_data + VAR_30; update(target, VAR_15, 1); } for (VAR_30 = VAR_30 + VAR_30; VAR_30 < VAR_30; VAR_30++) { if (VAR_8) target = d2_data - VAR_30; else target = d2_data + VAR_30; update(target, VAR_15, 1); } for (VAR_30 = VAR_30 + 1; VAR_30 < VAR_30 + VAR_30; VAR_30++) { if (VAR_8) target = d2_data - VAR_30; else target = d2_data + VAR_30; update(target, VAR_15, 1); } } VAR_30 += VAR_9; VAR_30 += VAR_10; VAR_30 += VAR_11; d0_data += VAR_12; d1_data += VAR_13; d2_data += VAR_14; } } envelope(VAR_0, VAR_2, VAR_7, (VAR_7 + 0) % VAR_0->ncomp); envelope(VAR_0, VAR_2, VAR_7, (VAR_7 + 1) % VAR_0->ncomp); envelope(VAR_0, VAR_2, VAR_7, (VAR_7 + 2) % VAR_0->ncomp); }
[ "static void FUNC_0(WaveformContext *VAR_0, AVFrame *VAR_1, AVFrame *VAR_2,\nint VAR_3, int VAR_4, int VAR_5, int VAR_6)\n{", "const int VAR_7 = VAR_0->desc->comp[VAR_3].VAR_7;", "const int VAR_8 = VAR_0->VAR_8;", "const int VAR_9 = VAR_1->linesize[ VAR_7 + 0 ];", "const int VAR_10 = VAR_1->linesize[(VAR_7 + 1) % VAR_0->ncomp];", "const int VAR_11 = VAR_1->linesize[(VAR_7 + 2) % VAR_0->ncomp];", "const int VAR_12 = VAR_2->linesize[ VAR_7 + 0 ];", "const int VAR_13 = VAR_2->linesize[(VAR_7 + 1) % VAR_0->ncomp];", "const int VAR_14 = VAR_2->linesize[(VAR_7 + 2) % VAR_0->ncomp];", "const int VAR_15 = 255 - VAR_4;", "const int VAR_16 = VAR_1->height;", "const int VAR_17 = VAR_1->width;", "int VAR_18, VAR_19;", "if (VAR_6) {", "const int VAR_20 = VAR_12 * (VAR_8 == 1 ? -1 : 1);", "const int VAR_21 = VAR_13 * (VAR_8 == 1 ? -1 : 1);", "const int VAR_22 = VAR_14 * (VAR_8 == 1 ? -1 : 1);", "for (VAR_18 = 0; VAR_18 < VAR_17; VAR_18++) {", "const uint8_t *VAR_30 = VAR_1->data[VAR_7 + 0];", "const uint8_t *VAR_30 = VAR_1->data[(VAR_7 + 1) % VAR_0->ncomp];", "const uint8_t *VAR_30 = VAR_1->data[(VAR_7 + 2) % VAR_0->ncomp];", "uint8_t *d0_data = VAR_2->data[VAR_7] + VAR_5 * VAR_12;", "uint8_t *d1_data = VAR_2->data[(VAR_7 + 1) % VAR_0->ncomp] + VAR_5 * VAR_13;", "uint8_t *d2_data = VAR_2->data[(VAR_7 + 2) % VAR_0->ncomp] + VAR_5 * VAR_14;", "uint8_t * const d0_bottom_line = d0_data + VAR_12 * (VAR_0->size - 1);", "uint8_t * const d0 = (VAR_8 ? d0_bottom_line : d0_data);", "uint8_t * const d1_bottom_line = d1_data + VAR_13 * (VAR_0->size - 1);", "uint8_t * const d1 = (VAR_8 ? d1_bottom_line : d1_data);", "uint8_t * const d2_bottom_line = d2_data + VAR_14 * (VAR_0->size - 1);", "uint8_t * const d2 = (VAR_8 ? d2_bottom_line : d2_data);", "for (VAR_19 = 0; VAR_19 < VAR_16; VAR_19++) {", "const int VAR_30 = VAR_30[VAR_18] + 128;", "const int VAR_30 = VAR_30[VAR_18] - 128;", "const int VAR_30 = VAR_30[VAR_18] - 128;", "uint8_t *target;", "int VAR_30;", "target = d0 + VAR_18 + VAR_20 * VAR_30;", "update(target, VAR_15, VAR_4);", "for (VAR_30 = VAR_30 + VAR_30; VAR_30 < VAR_30; VAR_30++) {", "target = d1 + VAR_18 + VAR_21 * VAR_30;", "update(target, VAR_15, 1);", "}", "for (VAR_30 = VAR_30 + VAR_30 - 1; VAR_30 > VAR_30; VAR_30--) {", "target = d1 + VAR_18 + VAR_21 * VAR_30;", "update(target, VAR_15, 1);", "}", "for (VAR_30 = VAR_30 + VAR_30; VAR_30 < VAR_30; VAR_30++) {", "target = d2 + VAR_18 + VAR_22 * VAR_30;", "update(target, VAR_15, 1);", "}", "for (VAR_30 = VAR_30 + VAR_30 - 1; VAR_30 > VAR_30; VAR_30--) {", "target = d2 + VAR_18 + VAR_22 * VAR_30;", "update(target, VAR_15, 1);", "}", "VAR_30 += VAR_9;", "VAR_30 += VAR_10;", "VAR_30 += VAR_11;", "d0_data += VAR_12;", "d1_data += VAR_13;", "d2_data += VAR_14;", "}", "}", "} else {", "const uint8_t *VAR_30 = VAR_1->data[VAR_7];", "const uint8_t *VAR_30 = VAR_1->data[(VAR_7 + 1) % VAR_0->ncomp];", "const uint8_t *VAR_30 = VAR_1->data[(VAR_7 + 2) % VAR_0->ncomp];", "uint8_t *d0_data = VAR_2->data[VAR_7] + VAR_5;", "uint8_t *d1_data = VAR_2->data[(VAR_7 + 1) % VAR_0->ncomp] + VAR_5;", "uint8_t *d2_data = VAR_2->data[(VAR_7 + 2) % VAR_0->ncomp] + VAR_5;", "if (VAR_8) {", "d0_data += VAR_0->size - 1;", "d1_data += VAR_0->size - 1;", "d2_data += VAR_0->size - 1;", "}", "for (VAR_19 = 0; VAR_19 < VAR_16; VAR_19++) {", "for (VAR_18 = 0; VAR_18 < VAR_17; VAR_18++) {", "const int VAR_30 = VAR_30[VAR_18] + 128;", "const int VAR_30 = VAR_30[VAR_18] - 128;", "const int VAR_30 = VAR_30[VAR_18] - 128;", "uint8_t *target;", "int VAR_30;", "if (VAR_8)\ntarget = d0_data - VAR_30;", "else\ntarget = d0_data + VAR_30;", "update(target, VAR_15, VAR_4);", "for (VAR_30 = VAR_30 + VAR_30; VAR_30 < VAR_30; VAR_30++) {", "if (VAR_8)\ntarget = d1_data - VAR_30;", "else\ntarget = d1_data + VAR_30;", "update(target, VAR_15, 1);", "}", "for (VAR_30 = VAR_30 + 1; VAR_30 < VAR_30 + VAR_30; VAR_30++) {", "if (VAR_8)\ntarget = d1_data - VAR_30;", "else\ntarget = d1_data + VAR_30;", "update(target, VAR_15, 1);", "}", "for (VAR_30 = VAR_30 + VAR_30; VAR_30 < VAR_30; VAR_30++) {", "if (VAR_8)\ntarget = d2_data - VAR_30;", "else\ntarget = d2_data + VAR_30;", "update(target, VAR_15, 1);", "}", "for (VAR_30 = VAR_30 + 1; VAR_30 < VAR_30 + VAR_30; VAR_30++) {", "if (VAR_8)\ntarget = d2_data - VAR_30;", "else\ntarget = d2_data + VAR_30;", "update(target, VAR_15, 1);", "}", "}", "VAR_30 += VAR_9;", "VAR_30 += VAR_10;", "VAR_30 += VAR_11;", "d0_data += VAR_12;", "d1_data += VAR_13;", "d2_data += VAR_14;", "}", "}", "envelope(VAR_0, VAR_2, VAR_7, (VAR_7 + 0) % VAR_0->ncomp);", "envelope(VAR_0, VAR_2, VAR_7, (VAR_7 + 1) % VAR_0->ncomp);", "envelope(VAR_0, VAR_2, VAR_7, (VAR_7 + 2) % VAR_0->ncomp);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 191, 193 ], [ 195, 197 ], [ 201 ], [ 205 ], [ 207, 209 ], [ 211, 213 ], [ 217 ], [ 219 ], [ 223 ], [ 225, 227 ], [ 229, 231 ], [ 235 ], [ 237 ], [ 241 ], [ 243, 245 ], [ 247, 249 ], [ 253 ], [ 255 ], [ 259 ], [ 261, 263 ], [ 265, 267 ], [ 271 ], [ 273 ], [ 275 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ] ]
2,109
int ff_dirac_golomb_read_32bit(DiracGolombLUT *lut_ctx, const uint8_t *buf, int bytes, uint8_t *_dst, int coeffs) { int i, b, c_idx = 0; int32_t *dst = (int32_t *)_dst; DiracGolombLUT *future[4], *l = &lut_ctx[2*LUT_SIZE + buf[0]]; INIT_RESIDUE(res); for (b = 1; b <= bytes; b++) { future[0] = &lut_ctx[buf[b]]; future[1] = future[0] + 1*LUT_SIZE; future[2] = future[0] + 2*LUT_SIZE; future[3] = future[0] + 3*LUT_SIZE; if ((c_idx + 1) > coeffs) return c_idx; /* res_bits is a hint for better branch prediction */ if (res_bits && l->sign) { int32_t coeff = 1; APPEND_RESIDUE(res, l->preamble); for (i = 0; i < (res_bits >> 1) - 1; i++) { coeff <<= 1; coeff |= (res >> (RSIZE_BITS - 2*i - 2)) & 1; } dst[c_idx++] = l->sign * (coeff - 1); SET_RESIDUE(res, 0, 0); } memcpy(&dst[c_idx], l->ready, LUT_BITS*sizeof(int32_t)); c_idx += l->ready_num; APPEND_RESIDUE(res, l->leftover); l = future[l->need_s ? 3 : !res_bits ? 2 : res_bits & 1]; } return c_idx; }
false
FFmpeg
f41e37b84f3d57c29d4a2a21f9337159135b981d
int ff_dirac_golomb_read_32bit(DiracGolombLUT *lut_ctx, const uint8_t *buf, int bytes, uint8_t *_dst, int coeffs) { int i, b, c_idx = 0; int32_t *dst = (int32_t *)_dst; DiracGolombLUT *future[4], *l = &lut_ctx[2*LUT_SIZE + buf[0]]; INIT_RESIDUE(res); for (b = 1; b <= bytes; b++) { future[0] = &lut_ctx[buf[b]]; future[1] = future[0] + 1*LUT_SIZE; future[2] = future[0] + 2*LUT_SIZE; future[3] = future[0] + 3*LUT_SIZE; if ((c_idx + 1) > coeffs) return c_idx; if (res_bits && l->sign) { int32_t coeff = 1; APPEND_RESIDUE(res, l->preamble); for (i = 0; i < (res_bits >> 1) - 1; i++) { coeff <<= 1; coeff |= (res >> (RSIZE_BITS - 2*i - 2)) & 1; } dst[c_idx++] = l->sign * (coeff - 1); SET_RESIDUE(res, 0, 0); } memcpy(&dst[c_idx], l->ready, LUT_BITS*sizeof(int32_t)); c_idx += l->ready_num; APPEND_RESIDUE(res, l->leftover); l = future[l->need_s ? 3 : !res_bits ? 2 : res_bits & 1]; } return c_idx; }
{ "code": [], "line_no": [] }
int FUNC_0(DiracGolombLUT *VAR_0, const uint8_t *VAR_1, int VAR_2, uint8_t *VAR_3, int VAR_4) { int VAR_5, VAR_6, VAR_7 = 0; int32_t *dst = (int32_t *)VAR_3; DiracGolombLUT *future[4], *l = &VAR_0[2*LUT_SIZE + VAR_1[0]]; INIT_RESIDUE(res); for (VAR_6 = 1; VAR_6 <= VAR_2; VAR_6++) { future[0] = &VAR_0[VAR_1[VAR_6]]; future[1] = future[0] + 1*LUT_SIZE; future[2] = future[0] + 2*LUT_SIZE; future[3] = future[0] + 3*LUT_SIZE; if ((VAR_7 + 1) > VAR_4) return VAR_7; if (res_bits && l->sign) { int32_t coeff = 1; APPEND_RESIDUE(res, l->preamble); for (VAR_5 = 0; VAR_5 < (res_bits >> 1) - 1; VAR_5++) { coeff <<= 1; coeff |= (res >> (RSIZE_BITS - 2*VAR_5 - 2)) & 1; } dst[VAR_7++] = l->sign * (coeff - 1); SET_RESIDUE(res, 0, 0); } memcpy(&dst[VAR_7], l->ready, LUT_BITS*sizeof(int32_t)); VAR_7 += l->ready_num; APPEND_RESIDUE(res, l->leftover); l = future[l->need_s ? 3 : !res_bits ? 2 : res_bits & 1]; } return VAR_7; }
[ "int FUNC_0(DiracGolombLUT *VAR_0, const uint8_t *VAR_1,\nint VAR_2, uint8_t *VAR_3, int VAR_4)\n{", "int VAR_5, VAR_6, VAR_7 = 0;", "int32_t *dst = (int32_t *)VAR_3;", "DiracGolombLUT *future[4], *l = &VAR_0[2*LUT_SIZE + VAR_1[0]];", "INIT_RESIDUE(res);", "for (VAR_6 = 1; VAR_6 <= VAR_2; VAR_6++) {", "future[0] = &VAR_0[VAR_1[VAR_6]];", "future[1] = future[0] + 1*LUT_SIZE;", "future[2] = future[0] + 2*LUT_SIZE;", "future[3] = future[0] + 3*LUT_SIZE;", "if ((VAR_7 + 1) > VAR_4)\nreturn VAR_7;", "if (res_bits && l->sign) {", "int32_t coeff = 1;", "APPEND_RESIDUE(res, l->preamble);", "for (VAR_5 = 0; VAR_5 < (res_bits >> 1) - 1; VAR_5++) {", "coeff <<= 1;", "coeff |= (res >> (RSIZE_BITS - 2*VAR_5 - 2)) & 1;", "}", "dst[VAR_7++] = l->sign * (coeff - 1);", "SET_RESIDUE(res, 0, 0);", "}", "memcpy(&dst[VAR_7], l->ready, LUT_BITS*sizeof(int32_t));", "VAR_7 += l->ready_num;", "APPEND_RESIDUE(res, l->leftover);", "l = future[l->need_s ? 3 : !res_bits ? 2 : res_bits & 1];", "}", "return VAR_7;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29, 31 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 65 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ] ]
2,111
static int decode_i_frame(FourXContext *f, const uint8_t *buf, int length){ int x, y; const int width= f->avctx->width; const int height= f->avctx->height; uint16_t *dst= (uint16_t*)f->current_picture.data[0]; const int stride= f->current_picture.linesize[0]>>1; const unsigned int bitstream_size= AV_RL32(buf); const int token_count av_unused = AV_RL32(buf + bitstream_size + 8); unsigned int prestream_size= 4*AV_RL32(buf + bitstream_size + 4); const uint8_t *prestream= buf + bitstream_size + 12; if(prestream_size + bitstream_size + 12 != length || bitstream_size > (1<<26) || prestream_size > (1<<26)){ av_log(f->avctx, AV_LOG_ERROR, "size mismatch %d %d %d\n", prestream_size, bitstream_size, length); return -1; } prestream= read_huffman_tables(f, prestream); init_get_bits(&f->gb, buf + 4, 8*bitstream_size); prestream_size= length + buf - prestream; av_fast_malloc(&f->bitstream_buffer, &f->bitstream_buffer_size, prestream_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!f->bitstream_buffer) return AVERROR(ENOMEM); f->dsp.bswap_buf(f->bitstream_buffer, (const uint32_t*)prestream, prestream_size/4); memset((uint8_t*)f->bitstream_buffer + prestream_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); init_get_bits(&f->pre_gb, f->bitstream_buffer, 8*prestream_size); f->last_dc= 0*128*8*8; for(y=0; y<height; y+=16){ for(x=0; x<width; x+=16){ if(decode_i_mb(f) < 0) return -1; idct_put(f, x, y); } dst += 16*stride; } if(get_vlc2(&f->pre_gb, f->pre_vlc.table, ACDC_VLC_BITS, 3) != 256) av_log(f->avctx, AV_LOG_ERROR, "end mismatch\n"); return 0; }
true
FFmpeg
9c661e952fbcbf044709f9a7031c68cc4860336b
static int decode_i_frame(FourXContext *f, const uint8_t *buf, int length){ int x, y; const int width= f->avctx->width; const int height= f->avctx->height; uint16_t *dst= (uint16_t*)f->current_picture.data[0]; const int stride= f->current_picture.linesize[0]>>1; const unsigned int bitstream_size= AV_RL32(buf); const int token_count av_unused = AV_RL32(buf + bitstream_size + 8); unsigned int prestream_size= 4*AV_RL32(buf + bitstream_size + 4); const uint8_t *prestream= buf + bitstream_size + 12; if(prestream_size + bitstream_size + 12 != length || bitstream_size > (1<<26) || prestream_size > (1<<26)){ av_log(f->avctx, AV_LOG_ERROR, "size mismatch %d %d %d\n", prestream_size, bitstream_size, length); return -1; } prestream= read_huffman_tables(f, prestream); init_get_bits(&f->gb, buf + 4, 8*bitstream_size); prestream_size= length + buf - prestream; av_fast_malloc(&f->bitstream_buffer, &f->bitstream_buffer_size, prestream_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!f->bitstream_buffer) return AVERROR(ENOMEM); f->dsp.bswap_buf(f->bitstream_buffer, (const uint32_t*)prestream, prestream_size/4); memset((uint8_t*)f->bitstream_buffer + prestream_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); init_get_bits(&f->pre_gb, f->bitstream_buffer, 8*prestream_size); f->last_dc= 0*128*8*8; for(y=0; y<height; y+=16){ for(x=0; x<width; x+=16){ if(decode_i_mb(f) < 0) return -1; idct_put(f, x, y); } dst += 16*stride; } if(get_vlc2(&f->pre_gb, f->pre_vlc.table, ACDC_VLC_BITS, 3) != 256) av_log(f->avctx, AV_LOG_ERROR, "end mismatch\n"); return 0; }
{ "code": [ " const int token_count av_unused = AV_RL32(buf + bitstream_size + 8);", " unsigned int prestream_size= 4*AV_RL32(buf + bitstream_size + 4);", " const uint8_t *prestream= buf + bitstream_size + 12;", " if(prestream_size + bitstream_size + 12 != length", " || bitstream_size > (1<<26)", " || prestream_size > (1<<26)){", " prestream= read_huffman_tables(f, prestream);" ], "line_no": [ 15, 17, 19, 23, 25, 27, 37 ] }
static int FUNC_0(FourXContext *VAR_0, const uint8_t *VAR_1, int VAR_2){ int VAR_3, VAR_4; const int VAR_5= VAR_0->avctx->VAR_5; const int VAR_6= VAR_0->avctx->VAR_6; uint16_t *dst= (uint16_t*)VAR_0->current_picture.data[0]; const int VAR_7= VAR_0->current_picture.linesize[0]>>1; const unsigned int VAR_8= AV_RL32(VAR_1); const int VAR_9 av_unused = AV_RL32(VAR_1 + VAR_8 + 8); unsigned int VAR_10= 4*AV_RL32(VAR_1 + VAR_8 + 4); const uint8_t *VAR_11= VAR_1 + VAR_8 + 12; if(VAR_10 + VAR_8 + 12 != VAR_2 || VAR_8 > (1<<26) || VAR_10 > (1<<26)){ av_log(VAR_0->avctx, AV_LOG_ERROR, "size mismatch %d %d %d\n", VAR_10, VAR_8, VAR_2); return -1; } VAR_11= read_huffman_tables(VAR_0, VAR_11); init_get_bits(&VAR_0->gb, VAR_1 + 4, 8*VAR_8); VAR_10= VAR_2 + VAR_1 - VAR_11; av_fast_malloc(&VAR_0->bitstream_buffer, &VAR_0->bitstream_buffer_size, VAR_10 + FF_INPUT_BUFFER_PADDING_SIZE); if (!VAR_0->bitstream_buffer) return AVERROR(ENOMEM); VAR_0->dsp.bswap_buf(VAR_0->bitstream_buffer, (const uint32_t*)VAR_11, VAR_10/4); memset((uint8_t*)VAR_0->bitstream_buffer + VAR_10, 0, FF_INPUT_BUFFER_PADDING_SIZE); init_get_bits(&VAR_0->pre_gb, VAR_0->bitstream_buffer, 8*VAR_10); VAR_0->last_dc= 0*128*8*8; for(VAR_4=0; VAR_4<VAR_6; VAR_4+=16){ for(VAR_3=0; VAR_3<VAR_5; VAR_3+=16){ if(decode_i_mb(VAR_0) < 0) return -1; idct_put(VAR_0, VAR_3, VAR_4); } dst += 16*VAR_7; } if(get_vlc2(&VAR_0->pre_gb, VAR_0->pre_vlc.table, ACDC_VLC_BITS, 3) != 256) av_log(VAR_0->avctx, AV_LOG_ERROR, "end mismatch\n"); return 0; }
[ "static int FUNC_0(FourXContext *VAR_0, const uint8_t *VAR_1, int VAR_2){", "int VAR_3, VAR_4;", "const int VAR_5= VAR_0->avctx->VAR_5;", "const int VAR_6= VAR_0->avctx->VAR_6;", "uint16_t *dst= (uint16_t*)VAR_0->current_picture.data[0];", "const int VAR_7= VAR_0->current_picture.linesize[0]>>1;", "const unsigned int VAR_8= AV_RL32(VAR_1);", "const int VAR_9 av_unused = AV_RL32(VAR_1 + VAR_8 + 8);", "unsigned int VAR_10= 4*AV_RL32(VAR_1 + VAR_8 + 4);", "const uint8_t *VAR_11= VAR_1 + VAR_8 + 12;", "if(VAR_10 + VAR_8 + 12 != VAR_2\n|| VAR_8 > (1<<26)\n|| VAR_10 > (1<<26)){", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"size mismatch %d %d %d\\n\", VAR_10, VAR_8, VAR_2);", "return -1;", "}", "VAR_11= read_huffman_tables(VAR_0, VAR_11);", "init_get_bits(&VAR_0->gb, VAR_1 + 4, 8*VAR_8);", "VAR_10= VAR_2 + VAR_1 - VAR_11;", "av_fast_malloc(&VAR_0->bitstream_buffer, &VAR_0->bitstream_buffer_size, VAR_10 + FF_INPUT_BUFFER_PADDING_SIZE);", "if (!VAR_0->bitstream_buffer)\nreturn AVERROR(ENOMEM);", "VAR_0->dsp.bswap_buf(VAR_0->bitstream_buffer, (const uint32_t*)VAR_11, VAR_10/4);", "memset((uint8_t*)VAR_0->bitstream_buffer + VAR_10, 0, FF_INPUT_BUFFER_PADDING_SIZE);", "init_get_bits(&VAR_0->pre_gb, VAR_0->bitstream_buffer, 8*VAR_10);", "VAR_0->last_dc= 0*128*8*8;", "for(VAR_4=0; VAR_4<VAR_6; VAR_4+=16){", "for(VAR_3=0; VAR_3<VAR_5; VAR_3+=16){", "if(decode_i_mb(VAR_0) < 0)\nreturn -1;", "idct_put(VAR_0, VAR_3, VAR_4);", "}", "dst += 16*VAR_7;", "}", "if(get_vlc2(&VAR_0->pre_gb, VAR_0->pre_vlc.table, ACDC_VLC_BITS, 3) != 256)\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"end mismatch\\n\");", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23, 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 41 ], [ 45 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87, 89 ], [ 93 ], [ 95 ] ]
2,112
static int pci_pcnet_init(PCIDevice *pci_dev) { PCIPCNetState *d = PCI_PCNET(pci_dev); PCNetState *s = &d->state; uint8_t *pci_conf; #if 0 printf("sizeof(RMD)=%d, sizeof(TMD)=%d\n", sizeof(struct pcnet_RMD), sizeof(struct pcnet_TMD)); #endif pci_conf = pci_dev->config; pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_FAST_BACK | PCI_STATUS_DEVSEL_MEDIUM); pci_set_word(pci_conf + PCI_SUBSYSTEM_VENDOR_ID, 0x0); pci_set_word(pci_conf + PCI_SUBSYSTEM_ID, 0x0); pci_conf[PCI_INTERRUPT_PIN] = 1; /* interrupt pin A */ pci_conf[PCI_MIN_GNT] = 0x06; pci_conf[PCI_MAX_LAT] = 0xff; /* Handler for memory-mapped I/O */ memory_region_init_io(&d->state.mmio, OBJECT(d), &pcnet_mmio_ops, s, "pcnet-mmio", PCNET_PNPMMIO_SIZE); memory_region_init_io(&d->io_bar, OBJECT(d), &pcnet_io_ops, s, "pcnet-io", PCNET_IOPORT_SIZE); pci_register_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &d->io_bar); pci_register_bar(pci_dev, 1, 0, &s->mmio); s->irq = pci_allocate_irq(pci_dev); s->phys_mem_read = pci_physical_memory_read; s->phys_mem_write = pci_physical_memory_write; s->dma_opaque = pci_dev; return pcnet_common_init(DEVICE(pci_dev), s, &net_pci_pcnet_info); }
true
qemu
4c3b22459d3589cf84d1ccadc6b09e586497820d
static int pci_pcnet_init(PCIDevice *pci_dev) { PCIPCNetState *d = PCI_PCNET(pci_dev); PCNetState *s = &d->state; uint8_t *pci_conf; #if 0 printf("sizeof(RMD)=%d, sizeof(TMD)=%d\n", sizeof(struct pcnet_RMD), sizeof(struct pcnet_TMD)); #endif pci_conf = pci_dev->config; pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_FAST_BACK | PCI_STATUS_DEVSEL_MEDIUM); pci_set_word(pci_conf + PCI_SUBSYSTEM_VENDOR_ID, 0x0); pci_set_word(pci_conf + PCI_SUBSYSTEM_ID, 0x0); pci_conf[PCI_INTERRUPT_PIN] = 1; pci_conf[PCI_MIN_GNT] = 0x06; pci_conf[PCI_MAX_LAT] = 0xff; memory_region_init_io(&d->state.mmio, OBJECT(d), &pcnet_mmio_ops, s, "pcnet-mmio", PCNET_PNPMMIO_SIZE); memory_region_init_io(&d->io_bar, OBJECT(d), &pcnet_io_ops, s, "pcnet-io", PCNET_IOPORT_SIZE); pci_register_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &d->io_bar); pci_register_bar(pci_dev, 1, 0, &s->mmio); s->irq = pci_allocate_irq(pci_dev); s->phys_mem_read = pci_physical_memory_read; s->phys_mem_write = pci_physical_memory_write; s->dma_opaque = pci_dev; return pcnet_common_init(DEVICE(pci_dev), s, &net_pci_pcnet_info); }
{ "code": [ " return pcnet_common_init(DEVICE(pci_dev), s, &net_pci_pcnet_info);" ], "line_no": [ 77 ] }
static int FUNC_0(PCIDevice *VAR_0) { PCIPCNetState *d = PCI_PCNET(VAR_0); PCNetState *s = &d->state; uint8_t *pci_conf; #if 0 printf("sizeof(RMD)=%d, sizeof(TMD)=%d\n", sizeof(struct pcnet_RMD), sizeof(struct pcnet_TMD)); #endif pci_conf = VAR_0->config; pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_FAST_BACK | PCI_STATUS_DEVSEL_MEDIUM); pci_set_word(pci_conf + PCI_SUBSYSTEM_VENDOR_ID, 0x0); pci_set_word(pci_conf + PCI_SUBSYSTEM_ID, 0x0); pci_conf[PCI_INTERRUPT_PIN] = 1; pci_conf[PCI_MIN_GNT] = 0x06; pci_conf[PCI_MAX_LAT] = 0xff; memory_region_init_io(&d->state.mmio, OBJECT(d), &pcnet_mmio_ops, s, "pcnet-mmio", PCNET_PNPMMIO_SIZE); memory_region_init_io(&d->io_bar, OBJECT(d), &pcnet_io_ops, s, "pcnet-io", PCNET_IOPORT_SIZE); pci_register_bar(VAR_0, 0, PCI_BASE_ADDRESS_SPACE_IO, &d->io_bar); pci_register_bar(VAR_0, 1, 0, &s->mmio); s->irq = pci_allocate_irq(VAR_0); s->phys_mem_read = pci_physical_memory_read; s->phys_mem_write = pci_physical_memory_write; s->dma_opaque = VAR_0; return pcnet_common_init(DEVICE(VAR_0), s, &net_pci_pcnet_info); }
[ "static int FUNC_0(PCIDevice *VAR_0)\n{", "PCIPCNetState *d = PCI_PCNET(VAR_0);", "PCNetState *s = &d->state;", "uint8_t *pci_conf;", "#if 0\nprintf(\"sizeof(RMD)=%d, sizeof(TMD)=%d\\n\",\nsizeof(struct pcnet_RMD), sizeof(struct pcnet_TMD));", "#endif\npci_conf = VAR_0->config;", "pci_set_word(pci_conf + PCI_STATUS,\nPCI_STATUS_FAST_BACK | PCI_STATUS_DEVSEL_MEDIUM);", "pci_set_word(pci_conf + PCI_SUBSYSTEM_VENDOR_ID, 0x0);", "pci_set_word(pci_conf + PCI_SUBSYSTEM_ID, 0x0);", "pci_conf[PCI_INTERRUPT_PIN] = 1;", "pci_conf[PCI_MIN_GNT] = 0x06;", "pci_conf[PCI_MAX_LAT] = 0xff;", "memory_region_init_io(&d->state.mmio, OBJECT(d), &pcnet_mmio_ops, s,\n\"pcnet-mmio\", PCNET_PNPMMIO_SIZE);", "memory_region_init_io(&d->io_bar, OBJECT(d), &pcnet_io_ops, s, \"pcnet-io\",\nPCNET_IOPORT_SIZE);", "pci_register_bar(VAR_0, 0, PCI_BASE_ADDRESS_SPACE_IO, &d->io_bar);", "pci_register_bar(VAR_0, 1, 0, &s->mmio);", "s->irq = pci_allocate_irq(VAR_0);", "s->phys_mem_read = pci_physical_memory_read;", "s->phys_mem_write = pci_physical_memory_write;", "s->dma_opaque = VAR_0;", "return pcnet_common_init(DEVICE(VAR_0), s, &net_pci_pcnet_info);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15, 17 ], [ 19, 23 ], [ 27, 29 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 49, 51 ], [ 55, 57 ], [ 59 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ] ]
2,113
void OPPROTO op_fdiv_STN_ST0(void) { ST(PARAM1) /= ST0; }
true
qemu
2ee73ac3a855fb0cfba3db91fdd1ecebdbc6f971
void OPPROTO op_fdiv_STN_ST0(void) { ST(PARAM1) /= ST0; }
{ "code": [ " ST(PARAM1) /= ST0;" ], "line_no": [ 5 ] }
void VAR_0 op_fdiv_STN_ST0(void) { ST(PARAM1) /= ST0; }
[ "void VAR_0 op_fdiv_STN_ST0(void)\n{", "ST(PARAM1) /= ST0;", "}" ]
[ 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
2,114
static int open_file(AVFormatContext *avf, unsigned fileno) { ConcatContext *cat = avf->priv_data; ConcatFile *file = &cat->files[fileno]; int ret; if (cat->avf) avformat_close_input(&cat->avf); cat->avf = avformat_alloc_context(); if (!cat->avf) return AVERROR(ENOMEM); cat->avf->flags |= avf->flags; cat->avf->interrupt_callback = avf->interrupt_callback; if ((ret = ff_copy_whiteblacklists(cat->avf, avf)) < 0) return ret; if ((ret = avformat_open_input(&cat->avf, file->url, NULL, NULL)) < 0 || (ret = avformat_find_stream_info(cat->avf, NULL)) < 0) { av_log(avf, AV_LOG_ERROR, "Impossible to open '%s'\n", file->url); avformat_close_input(&cat->avf); return ret; } cat->cur_file = file; if (file->start_time == AV_NOPTS_VALUE) file->start_time = !fileno ? 0 : cat->files[fileno - 1].start_time + cat->files[fileno - 1].duration; file->file_start_time = (cat->avf->start_time == AV_NOPTS_VALUE) ? 0 : cat->avf->start_time; file->file_inpoint = (file->inpoint == AV_NOPTS_VALUE) ? file->file_start_time : file->inpoint; if (file->duration == AV_NOPTS_VALUE && file->outpoint != AV_NOPTS_VALUE) file->duration = file->outpoint - file->file_inpoint; if (cat->segment_time_metadata) { av_dict_set_int(&file->metadata, "lavf.concatdec.start_time", file->start_time, 0); if (file->duration != AV_NOPTS_VALUE) av_dict_set_int(&file->metadata, "lavf.concatdec.duration", file->duration, 0); } if ((ret = match_streams(avf)) < 0) return ret; if (file->inpoint != AV_NOPTS_VALUE) { if ((ret = avformat_seek_file(cat->avf, -1, INT64_MIN, file->inpoint, file->inpoint, 0)) < 0) return ret; } return 0; }
true
FFmpeg
0dcac9c3f0f8f32009098edb704fac4b08bac951
static int open_file(AVFormatContext *avf, unsigned fileno) { ConcatContext *cat = avf->priv_data; ConcatFile *file = &cat->files[fileno]; int ret; if (cat->avf) avformat_close_input(&cat->avf); cat->avf = avformat_alloc_context(); if (!cat->avf) return AVERROR(ENOMEM); cat->avf->flags |= avf->flags; cat->avf->interrupt_callback = avf->interrupt_callback; if ((ret = ff_copy_whiteblacklists(cat->avf, avf)) < 0) return ret; if ((ret = avformat_open_input(&cat->avf, file->url, NULL, NULL)) < 0 || (ret = avformat_find_stream_info(cat->avf, NULL)) < 0) { av_log(avf, AV_LOG_ERROR, "Impossible to open '%s'\n", file->url); avformat_close_input(&cat->avf); return ret; } cat->cur_file = file; if (file->start_time == AV_NOPTS_VALUE) file->start_time = !fileno ? 0 : cat->files[fileno - 1].start_time + cat->files[fileno - 1].duration; file->file_start_time = (cat->avf->start_time == AV_NOPTS_VALUE) ? 0 : cat->avf->start_time; file->file_inpoint = (file->inpoint == AV_NOPTS_VALUE) ? file->file_start_time : file->inpoint; if (file->duration == AV_NOPTS_VALUE && file->outpoint != AV_NOPTS_VALUE) file->duration = file->outpoint - file->file_inpoint; if (cat->segment_time_metadata) { av_dict_set_int(&file->metadata, "lavf.concatdec.start_time", file->start_time, 0); if (file->duration != AV_NOPTS_VALUE) av_dict_set_int(&file->metadata, "lavf.concatdec.duration", file->duration, 0); } if ((ret = match_streams(avf)) < 0) return ret; if (file->inpoint != AV_NOPTS_VALUE) { if ((ret = avformat_seek_file(cat->avf, -1, INT64_MIN, file->inpoint, file->inpoint, 0)) < 0) return ret; } return 0; }
{ "code": [ " cat->avf->flags |= avf->flags;" ], "line_no": [ 27 ] }
static int FUNC_0(AVFormatContext *VAR_0, unsigned VAR_1) { ConcatContext *cat = VAR_0->priv_data; ConcatFile *file = &cat->files[VAR_1]; int VAR_2; if (cat->VAR_0) avformat_close_input(&cat->VAR_0); cat->VAR_0 = avformat_alloc_context(); if (!cat->VAR_0) return AVERROR(ENOMEM); cat->VAR_0->flags |= VAR_0->flags; cat->VAR_0->interrupt_callback = VAR_0->interrupt_callback; if ((VAR_2 = ff_copy_whiteblacklists(cat->VAR_0, VAR_0)) < 0) return VAR_2; if ((VAR_2 = avformat_open_input(&cat->VAR_0, file->url, NULL, NULL)) < 0 || (VAR_2 = avformat_find_stream_info(cat->VAR_0, NULL)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "Impossible to open '%s'\n", file->url); avformat_close_input(&cat->VAR_0); return VAR_2; } cat->cur_file = file; if (file->start_time == AV_NOPTS_VALUE) file->start_time = !VAR_1 ? 0 : cat->files[VAR_1 - 1].start_time + cat->files[VAR_1 - 1].duration; file->file_start_time = (cat->VAR_0->start_time == AV_NOPTS_VALUE) ? 0 : cat->VAR_0->start_time; file->file_inpoint = (file->inpoint == AV_NOPTS_VALUE) ? file->file_start_time : file->inpoint; if (file->duration == AV_NOPTS_VALUE && file->outpoint != AV_NOPTS_VALUE) file->duration = file->outpoint - file->file_inpoint; if (cat->segment_time_metadata) { av_dict_set_int(&file->metadata, "lavf.concatdec.start_time", file->start_time, 0); if (file->duration != AV_NOPTS_VALUE) av_dict_set_int(&file->metadata, "lavf.concatdec.duration", file->duration, 0); } if ((VAR_2 = match_streams(VAR_0)) < 0) return VAR_2; if (file->inpoint != AV_NOPTS_VALUE) { if ((VAR_2 = avformat_seek_file(cat->VAR_0, -1, INT64_MIN, file->inpoint, file->inpoint, 0)) < 0) return VAR_2; } return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0, unsigned VAR_1)\n{", "ConcatContext *cat = VAR_0->priv_data;", "ConcatFile *file = &cat->files[VAR_1];", "int VAR_2;", "if (cat->VAR_0)\navformat_close_input(&cat->VAR_0);", "cat->VAR_0 = avformat_alloc_context();", "if (!cat->VAR_0)\nreturn AVERROR(ENOMEM);", "cat->VAR_0->flags |= VAR_0->flags;", "cat->VAR_0->interrupt_callback = VAR_0->interrupt_callback;", "if ((VAR_2 = ff_copy_whiteblacklists(cat->VAR_0, VAR_0)) < 0)\nreturn VAR_2;", "if ((VAR_2 = avformat_open_input(&cat->VAR_0, file->url, NULL, NULL)) < 0 ||\n(VAR_2 = avformat_find_stream_info(cat->VAR_0, NULL)) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"Impossible to open '%s'\\n\", file->url);", "avformat_close_input(&cat->VAR_0);", "return VAR_2;", "}", "cat->cur_file = file;", "if (file->start_time == AV_NOPTS_VALUE)\nfile->start_time = !VAR_1 ? 0 :\ncat->files[VAR_1 - 1].start_time +\ncat->files[VAR_1 - 1].duration;", "file->file_start_time = (cat->VAR_0->start_time == AV_NOPTS_VALUE) ? 0 : cat->VAR_0->start_time;", "file->file_inpoint = (file->inpoint == AV_NOPTS_VALUE) ? file->file_start_time : file->inpoint;", "if (file->duration == AV_NOPTS_VALUE && file->outpoint != AV_NOPTS_VALUE)\nfile->duration = file->outpoint - file->file_inpoint;", "if (cat->segment_time_metadata) {", "av_dict_set_int(&file->metadata, \"lavf.concatdec.start_time\", file->start_time, 0);", "if (file->duration != AV_NOPTS_VALUE)\nav_dict_set_int(&file->metadata, \"lavf.concatdec.duration\", file->duration, 0);", "}", "if ((VAR_2 = match_streams(VAR_0)) < 0)\nreturn VAR_2;", "if (file->inpoint != AV_NOPTS_VALUE) {", "if ((VAR_2 = avformat_seek_file(cat->VAR_0, -1, INT64_MIN, file->inpoint, file->inpoint, 0)) < 0)\nreturn VAR_2;", "}", "return 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 ], [ 13, 15 ], [ 19 ], [ 21, 23 ], [ 27 ], [ 29 ], [ 33, 35 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55, 57, 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 83, 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97 ] ]
2,116
BlockDirtyInfoList *bdrv_query_dirty_bitmaps(BlockDriverState *bs) { BdrvDirtyBitmap *bm; BlockDirtyInfoList *list = NULL; BlockDirtyInfoList **plist = &list; QLIST_FOREACH(bm, &bs->dirty_bitmaps, list) { BlockDirtyInfo *info = g_malloc0(sizeof(BlockDirtyInfo)); BlockDirtyInfoList *entry = g_malloc0(sizeof(BlockDirtyInfoList)); info->count = bdrv_get_dirty_count(bs, bm); info->granularity = ((int64_t) BDRV_SECTOR_SIZE << hbitmap_granularity(bm->bitmap)); entry->value = info; *plist = entry; plist = &entry->next; } return list; }
true
qemu
5839e53bbc0fec56021d758aab7610df421ed8c8
BlockDirtyInfoList *bdrv_query_dirty_bitmaps(BlockDriverState *bs) { BdrvDirtyBitmap *bm; BlockDirtyInfoList *list = NULL; BlockDirtyInfoList **plist = &list; QLIST_FOREACH(bm, &bs->dirty_bitmaps, list) { BlockDirtyInfo *info = g_malloc0(sizeof(BlockDirtyInfo)); BlockDirtyInfoList *entry = g_malloc0(sizeof(BlockDirtyInfoList)); info->count = bdrv_get_dirty_count(bs, bm); info->granularity = ((int64_t) BDRV_SECTOR_SIZE << hbitmap_granularity(bm->bitmap)); entry->value = info; *plist = entry; plist = &entry->next; } return list; }
{ "code": [ " BlockDirtyInfo *info = g_malloc0(sizeof(BlockDirtyInfo));", " BlockDirtyInfoList *entry = g_malloc0(sizeof(BlockDirtyInfoList));" ], "line_no": [ 15, 17 ] }
BlockDirtyInfoList *FUNC_0(BlockDriverState *bs) { BdrvDirtyBitmap *bm; BlockDirtyInfoList *list = NULL; BlockDirtyInfoList **plist = &list; QLIST_FOREACH(bm, &bs->dirty_bitmaps, list) { BlockDirtyInfo *info = g_malloc0(sizeof(BlockDirtyInfo)); BlockDirtyInfoList *entry = g_malloc0(sizeof(BlockDirtyInfoList)); info->count = bdrv_get_dirty_count(bs, bm); info->granularity = ((int64_t) BDRV_SECTOR_SIZE << hbitmap_granularity(bm->bitmap)); entry->value = info; *plist = entry; plist = &entry->next; } return list; }
[ "BlockDirtyInfoList *FUNC_0(BlockDriverState *bs)\n{", "BdrvDirtyBitmap *bm;", "BlockDirtyInfoList *list = NULL;", "BlockDirtyInfoList **plist = &list;", "QLIST_FOREACH(bm, &bs->dirty_bitmaps, list) {", "BlockDirtyInfo *info = g_malloc0(sizeof(BlockDirtyInfo));", "BlockDirtyInfoList *entry = g_malloc0(sizeof(BlockDirtyInfoList));", "info->count = bdrv_get_dirty_count(bs, bm);", "info->granularity =\n((int64_t) BDRV_SECTOR_SIZE << hbitmap_granularity(bm->bitmap));", "entry->value = info;", "*plist = entry;", "plist = &entry->next;", "}", "return list;", "}" ]
[ 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ] ]
2,117
void register_displaychangelistener(DisplayChangeListener *dcl) { QemuConsole *con; trace_displaychangelistener_register(dcl, dcl->ops->dpy_name); dcl->ds = get_alloc_displaystate(); QLIST_INSERT_HEAD(&dcl->ds->listeners, dcl, next); gui_setup_refresh(dcl->ds); if (dcl->con) { dcl->con->dcls++; con = dcl->con; } else { con = active_console; } if (dcl->ops->dpy_gfx_switch && con) { dcl->ops->dpy_gfx_switch(dcl, con->surface); } }
true
qemu
d3002b0463727bf8110833b9d1a6efaa28990c28
void register_displaychangelistener(DisplayChangeListener *dcl) { QemuConsole *con; trace_displaychangelistener_register(dcl, dcl->ops->dpy_name); dcl->ds = get_alloc_displaystate(); QLIST_INSERT_HEAD(&dcl->ds->listeners, dcl, next); gui_setup_refresh(dcl->ds); if (dcl->con) { dcl->con->dcls++; con = dcl->con; } else { con = active_console; } if (dcl->ops->dpy_gfx_switch && con) { dcl->ops->dpy_gfx_switch(dcl, con->surface); } }
{ "code": [ " if (dcl->ops->dpy_gfx_switch && con) {", " dcl->ops->dpy_gfx_switch(dcl, con->surface);" ], "line_no": [ 29, 31 ] }
void FUNC_0(DisplayChangeListener *VAR_0) { QemuConsole *con; trace_displaychangelistener_register(VAR_0, VAR_0->ops->dpy_name); VAR_0->ds = get_alloc_displaystate(); QLIST_INSERT_HEAD(&VAR_0->ds->listeners, VAR_0, next); gui_setup_refresh(VAR_0->ds); if (VAR_0->con) { VAR_0->con->dcls++; con = VAR_0->con; } else { con = active_console; } if (VAR_0->ops->dpy_gfx_switch && con) { VAR_0->ops->dpy_gfx_switch(VAR_0, con->surface); } }
[ "void FUNC_0(DisplayChangeListener *VAR_0)\n{", "QemuConsole *con;", "trace_displaychangelistener_register(VAR_0, VAR_0->ops->dpy_name);", "VAR_0->ds = get_alloc_displaystate();", "QLIST_INSERT_HEAD(&VAR_0->ds->listeners, VAR_0, next);", "gui_setup_refresh(VAR_0->ds);", "if (VAR_0->con) {", "VAR_0->con->dcls++;", "con = VAR_0->con;", "} else {", "con = active_console;", "}", "if (VAR_0->ops->dpy_gfx_switch && con) {", "VAR_0->ops->dpy_gfx_switch(VAR_0, con->surface);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
2,118
static void cpu_ioreq_move(ioreq_t *req) { int i, sign; sign = req->df ? -1 : 1; if (!req->data_is_ptr) { if (req->dir == IOREQ_READ) { for (i = 0; i < req->count; i++) { cpu_physical_memory_read( req->addr + (sign * i * (int64_t)req->size), (uint8_t *) &req->data, req->size); } } else if (req->dir == IOREQ_WRITE) { for (i = 0; i < req->count; i++) { cpu_physical_memory_write( req->addr + (sign * i * (int64_t)req->size), (uint8_t *) &req->data, req->size); } } } else { uint64_t tmp; if (req->dir == IOREQ_READ) { for (i = 0; i < req->count; i++) { cpu_physical_memory_read( req->addr + (sign * i * (int64_t)req->size), (uint8_t*) &tmp, req->size); cpu_physical_memory_write( req->data + (sign * i * (int64_t)req->size), (uint8_t*) &tmp, req->size); } } else if (req->dir == IOREQ_WRITE) { for (i = 0; i < req->count; i++) { cpu_physical_memory_read( req->data + (sign * i * (int64_t)req->size), (uint8_t*) &tmp, req->size); cpu_physical_memory_write( req->addr + (sign * i * (int64_t)req->size), (uint8_t*) &tmp, req->size); } } } }
true
qemu
a38648290ee277c7cb8a53eabdcdb08bb7a9f23f
static void cpu_ioreq_move(ioreq_t *req) { int i, sign; sign = req->df ? -1 : 1; if (!req->data_is_ptr) { if (req->dir == IOREQ_READ) { for (i = 0; i < req->count; i++) { cpu_physical_memory_read( req->addr + (sign * i * (int64_t)req->size), (uint8_t *) &req->data, req->size); } } else if (req->dir == IOREQ_WRITE) { for (i = 0; i < req->count; i++) { cpu_physical_memory_write( req->addr + (sign * i * (int64_t)req->size), (uint8_t *) &req->data, req->size); } } } else { uint64_t tmp; if (req->dir == IOREQ_READ) { for (i = 0; i < req->count; i++) { cpu_physical_memory_read( req->addr + (sign * i * (int64_t)req->size), (uint8_t*) &tmp, req->size); cpu_physical_memory_write( req->data + (sign * i * (int64_t)req->size), (uint8_t*) &tmp, req->size); } } else if (req->dir == IOREQ_WRITE) { for (i = 0; i < req->count; i++) { cpu_physical_memory_read( req->data + (sign * i * (int64_t)req->size), (uint8_t*) &tmp, req->size); cpu_physical_memory_write( req->addr + (sign * i * (int64_t)req->size), (uint8_t*) &tmp, req->size); } } } }
{ "code": [ " int i, sign;", " sign = req->df ? -1 : 1;", " cpu_physical_memory_write(", " req->data + (sign * i * (int64_t)req->size),", " cpu_physical_memory_read(", " req->data + (sign * i * (int64_t)req->size),", " (uint8_t*) &tmp, req->size);", " int i, sign;", " sign = req->df ? -1 : 1;", " cpu_physical_memory_read(", " req->addr + (sign * i * (int64_t)req->size),", " (uint8_t *) &req->data, req->size);", " cpu_physical_memory_write(", " req->addr + (sign * i * (int64_t)req->size),", " (uint8_t *) &req->data, req->size);", " cpu_physical_memory_read(", " req->addr + (sign * i * (int64_t)req->size),", " (uint8_t*) &tmp, req->size);", " cpu_physical_memory_write(", " req->data + (sign * i * (int64_t)req->size),", " (uint8_t*) &tmp, req->size);", " cpu_physical_memory_read(", " req->data + (sign * i * (int64_t)req->size),", " (uint8_t*) &tmp, req->size);", " cpu_physical_memory_write(", " req->addr + (sign * i * (int64_t)req->size),", " (uint8_t*) &tmp, req->size);" ], "line_no": [ 5, 9, 31, 59, 19, 59, 55, 5, 9, 19, 21, 23, 31, 21, 23, 19, 21, 55, 31, 59, 55, 19, 59, 55, 31, 21, 55 ] }
static void FUNC_0(ioreq_t *VAR_0) { int VAR_1, VAR_2; VAR_2 = VAR_0->df ? -1 : 1; if (!VAR_0->data_is_ptr) { if (VAR_0->dir == IOREQ_READ) { for (VAR_1 = 0; VAR_1 < VAR_0->count; VAR_1++) { cpu_physical_memory_read( VAR_0->addr + (VAR_2 * VAR_1 * (int64_t)VAR_0->size), (uint8_t *) &VAR_0->data, VAR_0->size); } } else if (VAR_0->dir == IOREQ_WRITE) { for (VAR_1 = 0; VAR_1 < VAR_0->count; VAR_1++) { cpu_physical_memory_write( VAR_0->addr + (VAR_2 * VAR_1 * (int64_t)VAR_0->size), (uint8_t *) &VAR_0->data, VAR_0->size); } } } else { uint64_t tmp; if (VAR_0->dir == IOREQ_READ) { for (VAR_1 = 0; VAR_1 < VAR_0->count; VAR_1++) { cpu_physical_memory_read( VAR_0->addr + (VAR_2 * VAR_1 * (int64_t)VAR_0->size), (uint8_t*) &tmp, VAR_0->size); cpu_physical_memory_write( VAR_0->data + (VAR_2 * VAR_1 * (int64_t)VAR_0->size), (uint8_t*) &tmp, VAR_0->size); } } else if (VAR_0->dir == IOREQ_WRITE) { for (VAR_1 = 0; VAR_1 < VAR_0->count; VAR_1++) { cpu_physical_memory_read( VAR_0->data + (VAR_2 * VAR_1 * (int64_t)VAR_0->size), (uint8_t*) &tmp, VAR_0->size); cpu_physical_memory_write( VAR_0->addr + (VAR_2 * VAR_1 * (int64_t)VAR_0->size), (uint8_t*) &tmp, VAR_0->size); } } } }
[ "static void FUNC_0(ioreq_t *VAR_0)\n{", "int VAR_1, VAR_2;", "VAR_2 = VAR_0->df ? -1 : 1;", "if (!VAR_0->data_is_ptr) {", "if (VAR_0->dir == IOREQ_READ) {", "for (VAR_1 = 0; VAR_1 < VAR_0->count; VAR_1++) {", "cpu_physical_memory_read(\nVAR_0->addr + (VAR_2 * VAR_1 * (int64_t)VAR_0->size),\n(uint8_t *) &VAR_0->data, VAR_0->size);", "}", "} else if (VAR_0->dir == IOREQ_WRITE) {", "for (VAR_1 = 0; VAR_1 < VAR_0->count; VAR_1++) {", "cpu_physical_memory_write(\nVAR_0->addr + (VAR_2 * VAR_1 * (int64_t)VAR_0->size),\n(uint8_t *) &VAR_0->data, VAR_0->size);", "}", "}", "} else {", "uint64_t tmp;", "if (VAR_0->dir == IOREQ_READ) {", "for (VAR_1 = 0; VAR_1 < VAR_0->count; VAR_1++) {", "cpu_physical_memory_read(\nVAR_0->addr + (VAR_2 * VAR_1 * (int64_t)VAR_0->size),\n(uint8_t*) &tmp, VAR_0->size);", "cpu_physical_memory_write(\nVAR_0->data + (VAR_2 * VAR_1 * (int64_t)VAR_0->size),\n(uint8_t*) &tmp, VAR_0->size);", "}", "} else if (VAR_0->dir == IOREQ_WRITE) {", "for (VAR_1 = 0; VAR_1 < VAR_0->count; VAR_1++) {", "cpu_physical_memory_read(\nVAR_0->data + (VAR_2 * VAR_1 * (int64_t)VAR_0->size),\n(uint8_t*) &tmp, VAR_0->size);", "cpu_physical_memory_write(\nVAR_0->addr + (VAR_2 * VAR_1 * (int64_t)VAR_0->size),\n(uint8_t*) &tmp, VAR_0->size);", "}", "}", "}", "}" ]
[ 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51, 53, 55 ], [ 57, 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71, 73 ], [ 75, 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ] ]
2,119
static void imc_get_coeffs(AVCodecContext *avctx, IMCContext *q, IMCChannel *chctx) { int i, j, cw_len, cw; for (i = 0; i < BANDS; i++) { if (!chctx->sumLenArr[i]) continue; if (chctx->bandFlagsBuf[i] || chctx->bandWidthT[i]) { for (j = band_tab[i]; j < band_tab[i + 1]; j++) { cw_len = chctx->CWlengthT[j]; cw = 0; if (get_bits_count(&q->gb) + cw_len > 512) { av_log(avctx, AV_LOG_WARNING, "Potential problem on band %i, coefficient %i" ": cw_len=%i\n", i, j, cw_len); } if (cw_len && (!chctx->bandFlagsBuf[i] || !chctx->skipFlags[j])) cw = get_bits(&q->gb, cw_len); chctx->codewords[j] = cw; } } } }
false
FFmpeg
cbf09545f250a4bd12c50c3a96fe481098ab2d49
static void imc_get_coeffs(AVCodecContext *avctx, IMCContext *q, IMCChannel *chctx) { int i, j, cw_len, cw; for (i = 0; i < BANDS; i++) { if (!chctx->sumLenArr[i]) continue; if (chctx->bandFlagsBuf[i] || chctx->bandWidthT[i]) { for (j = band_tab[i]; j < band_tab[i + 1]; j++) { cw_len = chctx->CWlengthT[j]; cw = 0; if (get_bits_count(&q->gb) + cw_len > 512) { av_log(avctx, AV_LOG_WARNING, "Potential problem on band %i, coefficient %i" ": cw_len=%i\n", i, j, cw_len); } if (cw_len && (!chctx->bandFlagsBuf[i] || !chctx->skipFlags[j])) cw = get_bits(&q->gb, cw_len); chctx->codewords[j] = cw; } } } }
{ "code": [], "line_no": [] }
static void FUNC_0(AVCodecContext *VAR_0, IMCContext *VAR_1, IMCChannel *VAR_2) { int VAR_3, VAR_4, VAR_5, VAR_6; for (VAR_3 = 0; VAR_3 < BANDS; VAR_3++) { if (!VAR_2->sumLenArr[VAR_3]) continue; if (VAR_2->bandFlagsBuf[VAR_3] || VAR_2->bandWidthT[VAR_3]) { for (VAR_4 = band_tab[VAR_3]; VAR_4 < band_tab[VAR_3 + 1]; VAR_4++) { VAR_5 = VAR_2->CWlengthT[VAR_4]; VAR_6 = 0; if (get_bits_count(&VAR_1->gb) + VAR_5 > 512) { av_log(VAR_0, AV_LOG_WARNING, "Potential problem on band %VAR_3, coefficient %VAR_3" ": VAR_5=%VAR_3\n", VAR_3, VAR_4, VAR_5); } if (VAR_5 && (!VAR_2->bandFlagsBuf[VAR_3] || !VAR_2->skipFlags[VAR_4])) VAR_6 = get_bits(&VAR_1->gb, VAR_5); VAR_2->codewords[VAR_4] = VAR_6; } } } }
[ "static void FUNC_0(AVCodecContext *VAR_0,\nIMCContext *VAR_1, IMCChannel *VAR_2)\n{", "int VAR_3, VAR_4, VAR_5, VAR_6;", "for (VAR_3 = 0; VAR_3 < BANDS; VAR_3++) {", "if (!VAR_2->sumLenArr[VAR_3])\ncontinue;", "if (VAR_2->bandFlagsBuf[VAR_3] || VAR_2->bandWidthT[VAR_3]) {", "for (VAR_4 = band_tab[VAR_3]; VAR_4 < band_tab[VAR_3 + 1]; VAR_4++) {", "VAR_5 = VAR_2->CWlengthT[VAR_4];", "VAR_6 = 0;", "if (get_bits_count(&VAR_1->gb) + VAR_5 > 512) {", "av_log(VAR_0, AV_LOG_WARNING,\n\"Potential problem on band %VAR_3, coefficient %VAR_3\"\n\": VAR_5=%VAR_3\\n\", VAR_3, VAR_4, VAR_5);", "}", "if (VAR_5 && (!VAR_2->bandFlagsBuf[VAR_3] || !VAR_2->skipFlags[VAR_4]))\nVAR_6 = get_bits(&VAR_1->gb, VAR_5);", "VAR_2->codewords[VAR_4] = VAR_6;", "}", "}", "}", "}" ]
[ 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 ], [ 27 ], [ 29, 31, 33 ], [ 35 ], [ 39, 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ] ]
2,121
void ff_generate_sliding_window_mmcos(H264Context *h, int first_slice) { MpegEncContext * const s = &h->s; MMCO mmco_temp[MAX_MMCO_COUNT], *mmco = first_slice ? h->mmco : mmco_temp; int mmco_index = 0, i; assert(h->long_ref_count + h->short_ref_count <= h->sps.ref_frame_count); if (h->short_ref_count && h->long_ref_count + h->short_ref_count == h->sps.ref_frame_count && !(FIELD_PICTURE && !s->first_field && s->current_picture_ptr->f.reference)) { mmco[0].opcode = MMCO_SHORT2UNUSED; mmco[0].short_pic_num = h->short_ref[h->short_ref_count - 1]->frame_num; mmco_index = 1; if (FIELD_PICTURE) { mmco[0].short_pic_num *= 2; mmco[1].opcode = MMCO_SHORT2UNUSED; mmco[1].short_pic_num = mmco[0].short_pic_num + 1; mmco_index = 2; } } if (first_slice) { h->mmco_index = mmco_index; } else if (!first_slice && mmco_index >= 0 && (mmco_index != h->mmco_index || (i = check_opcodes(h->mmco, mmco_temp, mmco_index)))) { av_log(h->s.avctx, AV_LOG_ERROR, "Inconsistent MMCO state between slices [%d, %d, %d]\n", mmco_index, h->mmco_index, i); return AVERROR_INVALIDDATA; } }
false
FFmpeg
ea382767ad2191acbe97e90624059723e15f0e4b
void ff_generate_sliding_window_mmcos(H264Context *h, int first_slice) { MpegEncContext * const s = &h->s; MMCO mmco_temp[MAX_MMCO_COUNT], *mmco = first_slice ? h->mmco : mmco_temp; int mmco_index = 0, i; assert(h->long_ref_count + h->short_ref_count <= h->sps.ref_frame_count); if (h->short_ref_count && h->long_ref_count + h->short_ref_count == h->sps.ref_frame_count && !(FIELD_PICTURE && !s->first_field && s->current_picture_ptr->f.reference)) { mmco[0].opcode = MMCO_SHORT2UNUSED; mmco[0].short_pic_num = h->short_ref[h->short_ref_count - 1]->frame_num; mmco_index = 1; if (FIELD_PICTURE) { mmco[0].short_pic_num *= 2; mmco[1].opcode = MMCO_SHORT2UNUSED; mmco[1].short_pic_num = mmco[0].short_pic_num + 1; mmco_index = 2; } } if (first_slice) { h->mmco_index = mmco_index; } else if (!first_slice && mmco_index >= 0 && (mmco_index != h->mmco_index || (i = check_opcodes(h->mmco, mmco_temp, mmco_index)))) { av_log(h->s.avctx, AV_LOG_ERROR, "Inconsistent MMCO state between slices [%d, %d, %d]\n", mmco_index, h->mmco_index, i); return AVERROR_INVALIDDATA; } }
{ "code": [], "line_no": [] }
void FUNC_0(H264Context *VAR_0, int VAR_1) { MpegEncContext * const s = &VAR_0->s; MMCO mmco_temp[MAX_MMCO_COUNT], *mmco = VAR_1 ? VAR_0->mmco : mmco_temp; int VAR_2 = 0, VAR_3; assert(VAR_0->long_ref_count + VAR_0->short_ref_count <= VAR_0->sps.ref_frame_count); if (VAR_0->short_ref_count && VAR_0->long_ref_count + VAR_0->short_ref_count == VAR_0->sps.ref_frame_count && !(FIELD_PICTURE && !s->first_field && s->current_picture_ptr->f.reference)) { mmco[0].opcode = MMCO_SHORT2UNUSED; mmco[0].short_pic_num = VAR_0->short_ref[VAR_0->short_ref_count - 1]->frame_num; VAR_2 = 1; if (FIELD_PICTURE) { mmco[0].short_pic_num *= 2; mmco[1].opcode = MMCO_SHORT2UNUSED; mmco[1].short_pic_num = mmco[0].short_pic_num + 1; VAR_2 = 2; } } if (VAR_1) { VAR_0->VAR_2 = VAR_2; } else if (!VAR_1 && VAR_2 >= 0 && (VAR_2 != VAR_0->VAR_2 || (VAR_3 = check_opcodes(VAR_0->mmco, mmco_temp, VAR_2)))) { av_log(VAR_0->s.avctx, AV_LOG_ERROR, "Inconsistent MMCO state between slices [%d, %d, %d]\n", VAR_2, VAR_0->VAR_2, VAR_3); return AVERROR_INVALIDDATA; } }
[ "void FUNC_0(H264Context *VAR_0, int VAR_1)\n{", "MpegEncContext * const s = &VAR_0->s;", "MMCO mmco_temp[MAX_MMCO_COUNT], *mmco = VAR_1 ? VAR_0->mmco : mmco_temp;", "int VAR_2 = 0, VAR_3;", "assert(VAR_0->long_ref_count + VAR_0->short_ref_count <= VAR_0->sps.ref_frame_count);", "if (VAR_0->short_ref_count &&\nVAR_0->long_ref_count + VAR_0->short_ref_count == VAR_0->sps.ref_frame_count &&\n!(FIELD_PICTURE && !s->first_field &&\ns->current_picture_ptr->f.reference)) {", "mmco[0].opcode = MMCO_SHORT2UNUSED;", "mmco[0].short_pic_num = VAR_0->short_ref[VAR_0->short_ref_count - 1]->frame_num;", "VAR_2 = 1;", "if (FIELD_PICTURE) {", "mmco[0].short_pic_num *= 2;", "mmco[1].opcode = MMCO_SHORT2UNUSED;", "mmco[1].short_pic_num = mmco[0].short_pic_num + 1;", "VAR_2 = 2;", "}", "}", "if (VAR_1) {", "VAR_0->VAR_2 = VAR_2;", "} else if (!VAR_1 && VAR_2 >= 0 &&", "(VAR_2 != VAR_0->VAR_2 ||\n(VAR_3 = check_opcodes(VAR_0->mmco, mmco_temp, VAR_2)))) {", "av_log(VAR_0->s.avctx, AV_LOG_ERROR,\n\"Inconsistent MMCO state between slices [%d, %d, %d]\\n\",\nVAR_2, VAR_0->VAR_2, VAR_3);", "return AVERROR_INVALIDDATA;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 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 ] ]
2,122
void virtio_blk_handle_request(VirtIOBlockReq *req, MultiReqBuffer *mrb) { uint32_t type; struct iovec *in_iov = req->elem->in_sg; struct iovec *iov = req->elem->out_sg; unsigned in_num = req->elem->in_num; unsigned out_num = req->elem->out_num; if (req->elem->out_num < 1 || req->elem->in_num < 1) { error_report("virtio-blk missing headers"); exit(1); } if (unlikely(iov_to_buf(iov, out_num, 0, &req->out, sizeof(req->out)) != sizeof(req->out))) { error_report("virtio-blk request outhdr too short"); exit(1); } iov_discard_front(&iov, &out_num, sizeof(req->out)); if (in_num < 1 || in_iov[in_num - 1].iov_len < sizeof(struct virtio_blk_inhdr)) { error_report("virtio-blk request inhdr too short"); exit(1); } req->in = (void *)in_iov[in_num - 1].iov_base + in_iov[in_num - 1].iov_len - sizeof(struct virtio_blk_inhdr); iov_discard_back(in_iov, &in_num, sizeof(struct virtio_blk_inhdr)); type = virtio_ldl_p(VIRTIO_DEVICE(req->dev), &req->out.type); if (type & VIRTIO_BLK_T_FLUSH) { virtio_blk_handle_flush(req, mrb); } else if (type & VIRTIO_BLK_T_SCSI_CMD) { virtio_blk_handle_scsi(req); } else if (type & VIRTIO_BLK_T_GET_ID) { VirtIOBlock *s = req->dev; /* * NB: per existing s/n string convention the string is * terminated by '\0' only when shorter than buffer. */ strncpy(req->elem->in_sg[0].iov_base, s->blk.serial ? s->blk.serial : "", MIN(req->elem->in_sg[0].iov_len, VIRTIO_BLK_ID_BYTES)); virtio_blk_req_complete(req, VIRTIO_BLK_S_OK); virtio_blk_free_request(req); } else if (type & VIRTIO_BLK_T_OUT) { qemu_iovec_init_external(&req->qiov, &req->elem->out_sg[1], req->elem->out_num - 1); virtio_blk_handle_write(req, mrb); } else if (type == VIRTIO_BLK_T_IN || type == VIRTIO_BLK_T_BARRIER) { /* VIRTIO_BLK_T_IN is 0, so we can't just & it. */ qemu_iovec_init_external(&req->qiov, &req->elem->in_sg[0], req->elem->in_num - 1); virtio_blk_handle_read(req); } else { virtio_blk_req_complete(req, VIRTIO_BLK_S_UNSUPP); virtio_blk_free_request(req); } }
true
qemu
f897bf751fbd95e4015b95d202c706548586813a
void virtio_blk_handle_request(VirtIOBlockReq *req, MultiReqBuffer *mrb) { uint32_t type; struct iovec *in_iov = req->elem->in_sg; struct iovec *iov = req->elem->out_sg; unsigned in_num = req->elem->in_num; unsigned out_num = req->elem->out_num; if (req->elem->out_num < 1 || req->elem->in_num < 1) { error_report("virtio-blk missing headers"); exit(1); } if (unlikely(iov_to_buf(iov, out_num, 0, &req->out, sizeof(req->out)) != sizeof(req->out))) { error_report("virtio-blk request outhdr too short"); exit(1); } iov_discard_front(&iov, &out_num, sizeof(req->out)); if (in_num < 1 || in_iov[in_num - 1].iov_len < sizeof(struct virtio_blk_inhdr)) { error_report("virtio-blk request inhdr too short"); exit(1); } req->in = (void *)in_iov[in_num - 1].iov_base + in_iov[in_num - 1].iov_len - sizeof(struct virtio_blk_inhdr); iov_discard_back(in_iov, &in_num, sizeof(struct virtio_blk_inhdr)); type = virtio_ldl_p(VIRTIO_DEVICE(req->dev), &req->out.type); if (type & VIRTIO_BLK_T_FLUSH) { virtio_blk_handle_flush(req, mrb); } else if (type & VIRTIO_BLK_T_SCSI_CMD) { virtio_blk_handle_scsi(req); } else if (type & VIRTIO_BLK_T_GET_ID) { VirtIOBlock *s = req->dev; strncpy(req->elem->in_sg[0].iov_base, s->blk.serial ? s->blk.serial : "", MIN(req->elem->in_sg[0].iov_len, VIRTIO_BLK_ID_BYTES)); virtio_blk_req_complete(req, VIRTIO_BLK_S_OK); virtio_blk_free_request(req); } else if (type & VIRTIO_BLK_T_OUT) { qemu_iovec_init_external(&req->qiov, &req->elem->out_sg[1], req->elem->out_num - 1); virtio_blk_handle_write(req, mrb); } else if (type == VIRTIO_BLK_T_IN || type == VIRTIO_BLK_T_BARRIER) { qemu_iovec_init_external(&req->qiov, &req->elem->in_sg[0], req->elem->in_num - 1); virtio_blk_handle_read(req); } else { virtio_blk_req_complete(req, VIRTIO_BLK_S_UNSUPP); virtio_blk_free_request(req); } }
{ "code": [ " struct iovec *in_iov = req->elem->in_sg;", " struct iovec *iov = req->elem->out_sg;", " unsigned in_num = req->elem->in_num;", " unsigned out_num = req->elem->out_num;", " if (req->elem->out_num < 1 || req->elem->in_num < 1) {", " strncpy(req->elem->in_sg[0].iov_base,", " MIN(req->elem->in_sg[0].iov_len, VIRTIO_BLK_ID_BYTES));", " qemu_iovec_init_external(&req->qiov, &req->elem->out_sg[1],", " req->elem->out_num - 1);", " qemu_iovec_init_external(&req->qiov, &req->elem->in_sg[0],", " req->elem->in_num - 1);" ], "line_no": [ 7, 9, 11, 13, 17, 91, 95, 103, 105, 113, 115 ] }
void FUNC_0(VirtIOBlockReq *VAR_0, MultiReqBuffer *VAR_1) { uint32_t type; struct iovec *VAR_2 = VAR_0->elem->in_sg; struct iovec *VAR_3 = VAR_0->elem->out_sg; unsigned VAR_4 = VAR_0->elem->VAR_4; unsigned VAR_5 = VAR_0->elem->VAR_5; if (VAR_0->elem->VAR_5 < 1 || VAR_0->elem->VAR_4 < 1) { error_report("virtio-blk missing headers"); exit(1); } if (unlikely(iov_to_buf(VAR_3, VAR_5, 0, &VAR_0->out, sizeof(VAR_0->out)) != sizeof(VAR_0->out))) { error_report("virtio-blk request outhdr too short"); exit(1); } iov_discard_front(&VAR_3, &VAR_5, sizeof(VAR_0->out)); if (VAR_4 < 1 || VAR_2[VAR_4 - 1].iov_len < sizeof(struct virtio_blk_inhdr)) { error_report("virtio-blk request inhdr too short"); exit(1); } VAR_0->in = (void *)VAR_2[VAR_4 - 1].iov_base + VAR_2[VAR_4 - 1].iov_len - sizeof(struct virtio_blk_inhdr); iov_discard_back(VAR_2, &VAR_4, sizeof(struct virtio_blk_inhdr)); type = virtio_ldl_p(VIRTIO_DEVICE(VAR_0->dev), &VAR_0->out.type); if (type & VIRTIO_BLK_T_FLUSH) { virtio_blk_handle_flush(VAR_0, VAR_1); } else if (type & VIRTIO_BLK_T_SCSI_CMD) { virtio_blk_handle_scsi(VAR_0); } else if (type & VIRTIO_BLK_T_GET_ID) { VirtIOBlock *s = VAR_0->dev; strncpy(VAR_0->elem->in_sg[0].iov_base, s->blk.serial ? s->blk.serial : "", MIN(VAR_0->elem->in_sg[0].iov_len, VIRTIO_BLK_ID_BYTES)); virtio_blk_req_complete(VAR_0, VIRTIO_BLK_S_OK); virtio_blk_free_request(VAR_0); } else if (type & VIRTIO_BLK_T_OUT) { qemu_iovec_init_external(&VAR_0->qiov, &VAR_0->elem->out_sg[1], VAR_0->elem->VAR_5 - 1); virtio_blk_handle_write(VAR_0, VAR_1); } else if (type == VIRTIO_BLK_T_IN || type == VIRTIO_BLK_T_BARRIER) { qemu_iovec_init_external(&VAR_0->qiov, &VAR_0->elem->in_sg[0], VAR_0->elem->VAR_4 - 1); virtio_blk_handle_read(VAR_0); } else { virtio_blk_req_complete(VAR_0, VIRTIO_BLK_S_UNSUPP); virtio_blk_free_request(VAR_0); } }
[ "void FUNC_0(VirtIOBlockReq *VAR_0, MultiReqBuffer *VAR_1)\n{", "uint32_t type;", "struct iovec *VAR_2 = VAR_0->elem->in_sg;", "struct iovec *VAR_3 = VAR_0->elem->out_sg;", "unsigned VAR_4 = VAR_0->elem->VAR_4;", "unsigned VAR_5 = VAR_0->elem->VAR_5;", "if (VAR_0->elem->VAR_5 < 1 || VAR_0->elem->VAR_4 < 1) {", "error_report(\"virtio-blk missing headers\");", "exit(1);", "}", "if (unlikely(iov_to_buf(VAR_3, VAR_5, 0, &VAR_0->out,\nsizeof(VAR_0->out)) != sizeof(VAR_0->out))) {", "error_report(\"virtio-blk request outhdr too short\");", "exit(1);", "}", "iov_discard_front(&VAR_3, &VAR_5, sizeof(VAR_0->out));", "if (VAR_4 < 1 ||\nVAR_2[VAR_4 - 1].iov_len < sizeof(struct virtio_blk_inhdr)) {", "error_report(\"virtio-blk request inhdr too short\");", "exit(1);", "}", "VAR_0->in = (void *)VAR_2[VAR_4 - 1].iov_base\n+ VAR_2[VAR_4 - 1].iov_len\n- sizeof(struct virtio_blk_inhdr);", "iov_discard_back(VAR_2, &VAR_4, sizeof(struct virtio_blk_inhdr));", "type = virtio_ldl_p(VIRTIO_DEVICE(VAR_0->dev), &VAR_0->out.type);", "if (type & VIRTIO_BLK_T_FLUSH) {", "virtio_blk_handle_flush(VAR_0, VAR_1);", "} else if (type & VIRTIO_BLK_T_SCSI_CMD) {", "virtio_blk_handle_scsi(VAR_0);", "} else if (type & VIRTIO_BLK_T_GET_ID) {", "VirtIOBlock *s = VAR_0->dev;", "strncpy(VAR_0->elem->in_sg[0].iov_base,\ns->blk.serial ? s->blk.serial : \"\",\nMIN(VAR_0->elem->in_sg[0].iov_len, VIRTIO_BLK_ID_BYTES));", "virtio_blk_req_complete(VAR_0, VIRTIO_BLK_S_OK);", "virtio_blk_free_request(VAR_0);", "} else if (type & VIRTIO_BLK_T_OUT) {", "qemu_iovec_init_external(&VAR_0->qiov, &VAR_0->elem->out_sg[1],\nVAR_0->elem->VAR_5 - 1);", "virtio_blk_handle_write(VAR_0, VAR_1);", "} else if (type == VIRTIO_BLK_T_IN || type == VIRTIO_BLK_T_BARRIER) {", "qemu_iovec_init_external(&VAR_0->qiov, &VAR_0->elem->in_sg[0],\nVAR_0->elem->VAR_4 - 1);", "virtio_blk_handle_read(VAR_0);", "} else {", "virtio_blk_req_complete(VAR_0, VIRTIO_BLK_S_UNSUPP);", "virtio_blk_free_request(VAR_0);", "}", "}" ]
[ 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55, 57, 59 ], [ 61 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 91, 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 113, 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ] ]
2,123
void OPPROTO op_sdiv_T1_T0(void) { int64_t x0; int32_t x1; x0 = T0 | ((int64_t) (env->y) << 32); x1 = T1; x0 = x0 / x1; if ((int32_t) x0 != x0) { T0 = x0 < 0? 0x80000000: 0x7fffffff; T1 = 1; } else { T0 = x0; T1 = 0; FORCE_RET();
true
qemu
9bb234b3b170299c39c9e88cfe7da5434a92d99d
void OPPROTO op_sdiv_T1_T0(void) { int64_t x0; int32_t x1; x0 = T0 | ((int64_t) (env->y) << 32); x1 = T1; x0 = x0 / x1; if ((int32_t) x0 != x0) { T0 = x0 < 0? 0x80000000: 0x7fffffff; T1 = 1; } else { T0 = x0; T1 = 0; FORCE_RET();
{ "code": [], "line_no": [] }
void VAR_0 op_sdiv_T1_T0(void) { int64_t x0; int32_t x1; x0 = T0 | ((int64_t) (env->y) << 32); x1 = T1; x0 = x0 / x1; if ((int32_t) x0 != x0) { T0 = x0 < 0? 0x80000000: 0x7fffffff; T1 = 1; } else { T0 = x0; T1 = 0; FORCE_RET();
[ "void VAR_0 op_sdiv_T1_T0(void)\n{", "int64_t x0;", "int32_t x1;", "x0 = T0 | ((int64_t) (env->y) << 32);", "x1 = T1;", "x0 = x0 / x1;", "if ((int32_t) x0 != x0) {", "T0 = x0 < 0? 0x80000000: 0x7fffffff;", "T1 = 1;", "} else {", "T0 = x0;", "T1 = 0;", "FORCE_RET();" ]
[ 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 ] ]
2,125
static void spapr_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(oc); FWPathProviderClass *fwc = FW_PATH_PROVIDER_CLASS(oc); NMIClass *nc = NMI_CLASS(oc); HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc); mc->desc = "pSeries Logical Partition (PAPR compliant)"; /* * We set up the default / latest behaviour here. The class_init * functions for the specific versioned machine types can override * these details for backwards compatibility */ mc->init = ppc_spapr_init; mc->reset = ppc_spapr_reset; mc->block_default_type = IF_SCSI; mc->max_cpus = MAX_CPUMASK_BITS; mc->no_parallel = 1; mc->default_boot_order = ""; mc->default_ram_size = 512 * M_BYTE; mc->kvm_type = spapr_kvm_type; mc->has_dynamic_sysbus = true; mc->pci_allow_0_address = true; mc->get_hotplug_handler = spapr_get_hotpug_handler; hc->pre_plug = spapr_machine_device_pre_plug; hc->plug = spapr_machine_device_plug; hc->unplug = spapr_machine_device_unplug; mc->cpu_index_to_socket_id = spapr_cpu_index_to_socket_id; mc->query_hotpluggable_cpus = spapr_query_hotpluggable_cpus; smc->dr_lmb_enabled = true; smc->dr_cpu_enabled = true; fwc->get_dev_path = spapr_get_fw_dev_path; nc->nmi_monitor_handler = spapr_nmi; }
true
qemu
c8721d35994fd3731e592f81ba2f9c08e7dc8c31
static void spapr_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(oc); FWPathProviderClass *fwc = FW_PATH_PROVIDER_CLASS(oc); NMIClass *nc = NMI_CLASS(oc); HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc); mc->desc = "pSeries Logical Partition (PAPR compliant)"; mc->init = ppc_spapr_init; mc->reset = ppc_spapr_reset; mc->block_default_type = IF_SCSI; mc->max_cpus = MAX_CPUMASK_BITS; mc->no_parallel = 1; mc->default_boot_order = ""; mc->default_ram_size = 512 * M_BYTE; mc->kvm_type = spapr_kvm_type; mc->has_dynamic_sysbus = true; mc->pci_allow_0_address = true; mc->get_hotplug_handler = spapr_get_hotpug_handler; hc->pre_plug = spapr_machine_device_pre_plug; hc->plug = spapr_machine_device_plug; hc->unplug = spapr_machine_device_unplug; mc->cpu_index_to_socket_id = spapr_cpu_index_to_socket_id; mc->query_hotpluggable_cpus = spapr_query_hotpluggable_cpus; smc->dr_lmb_enabled = true; smc->dr_cpu_enabled = true; fwc->get_dev_path = spapr_get_fw_dev_path; nc->nmi_monitor_handler = spapr_nmi; }
{ "code": [ " mc->query_hotpluggable_cpus = spapr_query_hotpluggable_cpus;" ], "line_no": [ 61 ] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { MachineClass *mc = MACHINE_CLASS(VAR_0); sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(VAR_0); FWPathProviderClass *fwc = FW_PATH_PROVIDER_CLASS(VAR_0); NMIClass *nc = NMI_CLASS(VAR_0); HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(VAR_0); mc->desc = "pSeries Logical Partition (PAPR compliant)"; mc->init = ppc_spapr_init; mc->reset = ppc_spapr_reset; mc->block_default_type = IF_SCSI; mc->max_cpus = MAX_CPUMASK_BITS; mc->no_parallel = 1; mc->default_boot_order = ""; mc->default_ram_size = 512 * M_BYTE; mc->kvm_type = spapr_kvm_type; mc->has_dynamic_sysbus = true; mc->pci_allow_0_address = true; mc->get_hotplug_handler = spapr_get_hotpug_handler; hc->pre_plug = spapr_machine_device_pre_plug; hc->plug = spapr_machine_device_plug; hc->unplug = spapr_machine_device_unplug; mc->cpu_index_to_socket_id = spapr_cpu_index_to_socket_id; mc->query_hotpluggable_cpus = spapr_query_hotpluggable_cpus; smc->dr_lmb_enabled = true; smc->dr_cpu_enabled = true; fwc->get_dev_path = spapr_get_fw_dev_path; nc->nmi_monitor_handler = spapr_nmi; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "MachineClass *mc = MACHINE_CLASS(VAR_0);", "sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(VAR_0);", "FWPathProviderClass *fwc = FW_PATH_PROVIDER_CLASS(VAR_0);", "NMIClass *nc = NMI_CLASS(VAR_0);", "HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(VAR_0);", "mc->desc = \"pSeries Logical Partition (PAPR compliant)\";", "mc->init = ppc_spapr_init;", "mc->reset = ppc_spapr_reset;", "mc->block_default_type = IF_SCSI;", "mc->max_cpus = MAX_CPUMASK_BITS;", "mc->no_parallel = 1;", "mc->default_boot_order = \"\";", "mc->default_ram_size = 512 * M_BYTE;", "mc->kvm_type = spapr_kvm_type;", "mc->has_dynamic_sysbus = true;", "mc->pci_allow_0_address = true;", "mc->get_hotplug_handler = spapr_get_hotpug_handler;", "hc->pre_plug = spapr_machine_device_pre_plug;", "hc->plug = spapr_machine_device_plug;", "hc->unplug = spapr_machine_device_unplug;", "mc->cpu_index_to_socket_id = spapr_cpu_index_to_socket_id;", "mc->query_hotpluggable_cpus = spapr_query_hotpluggable_cpus;", "smc->dr_lmb_enabled = true;", "smc->dr_cpu_enabled = true;", "fwc->get_dev_path = spapr_get_fw_dev_path;", "nc->nmi_monitor_handler = spapr_nmi;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ] ]
2,126
static int ram_decompress_open(RamDecompressState *s, QEMUFile *f) { int ret; memset(s, 0, sizeof(*s)); s->f = f; ret = inflateInit(&s->zstream); if (ret != Z_OK) return -1; return 0; }
true
qemu
94fb0909645de18481cc726ee0ec9b5afa861394
static int ram_decompress_open(RamDecompressState *s, QEMUFile *f) { int ret; memset(s, 0, sizeof(*s)); s->f = f; ret = inflateInit(&s->zstream); if (ret != Z_OK) return -1; return 0; }
{ "code": [ "static int ram_decompress_open(RamDecompressState *s, QEMUFile *f)", " int ret;", " memset(s, 0, sizeof(*s));", " s->f = f;", " ret = inflateInit(&s->zstream);", " if (ret != Z_OK)", " return -1;", " return 0;", " return 0;", " return 0;" ], "line_no": [ 1, 5, 7, 9, 11, 13, 15, 17, 17, 17 ] }
static int FUNC_0(RamDecompressState *VAR_0, QEMUFile *VAR_1) { int VAR_2; memset(VAR_0, 0, sizeof(*VAR_0)); VAR_0->VAR_1 = VAR_1; VAR_2 = inflateInit(&VAR_0->zstream); if (VAR_2 != Z_OK) return -1; return 0; }
[ "static int FUNC_0(RamDecompressState *VAR_0, QEMUFile *VAR_1)\n{", "int VAR_2;", "memset(VAR_0, 0, sizeof(*VAR_0));", "VAR_0->VAR_1 = VAR_1;", "VAR_2 = inflateInit(&VAR_0->zstream);", "if (VAR_2 != Z_OK)\nreturn -1;", "return 0;", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ] ]
2,127
static int virtio_scsi_vring_init(VirtIOSCSI *s, VirtQueue *vq, int n) { BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s))); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); int rc; /* Set up virtqueue notify */ rc = k->set_host_notifier(qbus->parent, n, true); if (rc != 0) { fprintf(stderr, "virtio-scsi: Failed to set host notifier (%d)\n", rc); s->dataplane_fenced = true; return rc; } virtio_queue_aio_set_host_notifier_handler(vq, s->ctx, true, true); return 0; }
true
qemu
a8f2e5c8fffbaf7fbd4f0efc8efbeebade78008f
static int virtio_scsi_vring_init(VirtIOSCSI *s, VirtQueue *vq, int n) { BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s))); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); int rc; rc = k->set_host_notifier(qbus->parent, n, true); if (rc != 0) { fprintf(stderr, "virtio-scsi: Failed to set host notifier (%d)\n", rc); s->dataplane_fenced = true; return rc; } virtio_queue_aio_set_host_notifier_handler(vq, s->ctx, true, true); return 0; }
{ "code": [ "static int virtio_scsi_vring_init(VirtIOSCSI *s, VirtQueue *vq, int n)" ], "line_no": [ 1 ] }
static int FUNC_0(VirtIOSCSI *VAR_0, VirtQueue *VAR_1, int VAR_2) { BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(VAR_0))); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); int VAR_3; VAR_3 = k->set_host_notifier(qbus->parent, VAR_2, true); if (VAR_3 != 0) { fprintf(stderr, "virtio-scsi: Failed to set host notifier (%d)\VAR_2", VAR_3); VAR_0->dataplane_fenced = true; return VAR_3; } virtio_queue_aio_set_host_notifier_handler(VAR_1, VAR_0->ctx, true, true); return 0; }
[ "static int FUNC_0(VirtIOSCSI *VAR_0, VirtQueue *VAR_1, int VAR_2)\n{", "BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(VAR_0)));", "VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);", "int VAR_3;", "VAR_3 = k->set_host_notifier(qbus->parent, VAR_2, true);", "if (VAR_3 != 0) {", "fprintf(stderr, \"virtio-scsi: Failed to set host notifier (%d)\\VAR_2\",\nVAR_3);", "VAR_0->dataplane_fenced = true;", "return VAR_3;", "}", "virtio_queue_aio_set_host_notifier_handler(VAR_1, VAR_0->ctx, true, true);", "return 0;", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ] ]
2,128
void qemu_get_guest_memory_mapping(MemoryMappingList *list, Error **errp) { CPUState *cpu, *first_paging_enabled_cpu; RAMBlock *block; ram_addr_t offset, length; first_paging_enabled_cpu = find_paging_enabled_cpu(first_cpu); if (first_paging_enabled_cpu) { for (cpu = first_paging_enabled_cpu; cpu != NULL; cpu = cpu->next_cpu) { Error *err = NULL; cpu_get_memory_mapping(cpu, list, &err); if (err) { error_propagate(errp, err); return; } } return; } /* * If the guest doesn't use paging, the virtual address is equal to physical * address. */ QTAILQ_FOREACH(block, &ram_list.blocks, next) { offset = block->offset; length = block->length; create_new_memory_mapping(list, offset, offset, length); } }
true
qemu
56c4bfb3f07f3107894c00281276aea4f5e8834d
void qemu_get_guest_memory_mapping(MemoryMappingList *list, Error **errp) { CPUState *cpu, *first_paging_enabled_cpu; RAMBlock *block; ram_addr_t offset, length; first_paging_enabled_cpu = find_paging_enabled_cpu(first_cpu); if (first_paging_enabled_cpu) { for (cpu = first_paging_enabled_cpu; cpu != NULL; cpu = cpu->next_cpu) { Error *err = NULL; cpu_get_memory_mapping(cpu, list, &err); if (err) { error_propagate(errp, err); return; } } return; } QTAILQ_FOREACH(block, &ram_list.blocks, next) { offset = block->offset; length = block->length; create_new_memory_mapping(list, offset, offset, length); } }
{ "code": [ " RAMBlock *block;", " RAMBlock *block;", " QTAILQ_FOREACH(block, &ram_list.blocks, next) {", " RAMBlock *block;", " RAMBlock *block;", " QTAILQ_FOREACH(block, &ram_list.blocks, next) {", "void qemu_get_guest_memory_mapping(MemoryMappingList *list, Error **errp)", " RAMBlock *block;", " QTAILQ_FOREACH(block, &ram_list.blocks, next) {", " offset = block->offset;", " length = block->length;", " RAMBlock *block;", " QTAILQ_FOREACH(block, &ram_list.blocks, next) {", " RAMBlock *block;" ], "line_no": [ 7, 7, 47, 7, 7, 47, 1, 7, 47, 49, 51, 7, 47, 7 ] }
void FUNC_0(MemoryMappingList *VAR_0, Error **VAR_1) { CPUState *cpu, *first_paging_enabled_cpu; RAMBlock *block; ram_addr_t offset, length; first_paging_enabled_cpu = find_paging_enabled_cpu(first_cpu); if (first_paging_enabled_cpu) { for (cpu = first_paging_enabled_cpu; cpu != NULL; cpu = cpu->next_cpu) { Error *err = NULL; cpu_get_memory_mapping(cpu, VAR_0, &err); if (err) { error_propagate(VAR_1, err); return; } } return; } QTAILQ_FOREACH(block, &ram_list.blocks, next) { offset = block->offset; length = block->length; create_new_memory_mapping(VAR_0, offset, offset, length); } }
[ "void FUNC_0(MemoryMappingList *VAR_0, Error **VAR_1)\n{", "CPUState *cpu, *first_paging_enabled_cpu;", "RAMBlock *block;", "ram_addr_t offset, length;", "first_paging_enabled_cpu = find_paging_enabled_cpu(first_cpu);", "if (first_paging_enabled_cpu) {", "for (cpu = first_paging_enabled_cpu; cpu != NULL; cpu = cpu->next_cpu) {", "Error *err = NULL;", "cpu_get_memory_mapping(cpu, VAR_0, &err);", "if (err) {", "error_propagate(VAR_1, err);", "return;", "}", "}", "return;", "}", "QTAILQ_FOREACH(block, &ram_list.blocks, next) {", "offset = block->offset;", "length = block->length;", "create_new_memory_mapping(VAR_0, offset, offset, length);", "}", "}" ]
[ 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ] ]
2,129
static inline void RENAME(rgb24tobgr32)(const uint8_t *src, uint8_t *dst, int src_size) { uint8_t *dest = dst; const uint8_t *s = src; const uint8_t *end; const uint8_t *mm_end; end = s + src_size; __asm__ volatile(PREFETCH" %0"::"m"(*s):"memory"); mm_end = end - 23; __asm__ volatile("movq %0, %%mm7"::"m"(mask32a):"memory"); while (s < mm_end) { __asm__ volatile( PREFETCH" 32%1 \n\t" "movd %1, %%mm0 \n\t" "punpckldq 3%1, %%mm0 \n\t" "movd 6%1, %%mm1 \n\t" "punpckldq 9%1, %%mm1 \n\t" "movd 12%1, %%mm2 \n\t" "punpckldq 15%1, %%mm2 \n\t" "movd 18%1, %%mm3 \n\t" "punpckldq 21%1, %%mm3 \n\t" "por %%mm7, %%mm0 \n\t" "por %%mm7, %%mm1 \n\t" "por %%mm7, %%mm2 \n\t" "por %%mm7, %%mm3 \n\t" MOVNTQ" %%mm0, %0 \n\t" MOVNTQ" %%mm1, 8%0 \n\t" MOVNTQ" %%mm2, 16%0 \n\t" MOVNTQ" %%mm3, 24%0" :"=m"(*dest) :"m"(*s) :"memory"); dest += 32; s += 24; } __asm__ volatile(SFENCE:::"memory"); __asm__ volatile(EMMS:::"memory"); while (s < end) { *dest++ = *s++; *dest++ = *s++; *dest++ = *s++; *dest++ = 255; } }
true
FFmpeg
90540c2d5ace46a1e9789c75fde0b1f7dbb12a9b
static inline void RENAME(rgb24tobgr32)(const uint8_t *src, uint8_t *dst, int src_size) { uint8_t *dest = dst; const uint8_t *s = src; const uint8_t *end; const uint8_t *mm_end; end = s + src_size; __asm__ volatile(PREFETCH" %0"::"m"(*s):"memory"); mm_end = end - 23; __asm__ volatile("movq %0, %%mm7"::"m"(mask32a):"memory"); while (s < mm_end) { __asm__ volatile( PREFETCH" 32%1 \n\t" "movd %1, %%mm0 \n\t" "punpckldq 3%1, %%mm0 \n\t" "movd 6%1, %%mm1 \n\t" "punpckldq 9%1, %%mm1 \n\t" "movd 12%1, %%mm2 \n\t" "punpckldq 15%1, %%mm2 \n\t" "movd 18%1, %%mm3 \n\t" "punpckldq 21%1, %%mm3 \n\t" "por %%mm7, %%mm0 \n\t" "por %%mm7, %%mm1 \n\t" "por %%mm7, %%mm2 \n\t" "por %%mm7, %%mm3 \n\t" MOVNTQ" %%mm0, %0 \n\t" MOVNTQ" %%mm1, 8%0 \n\t" MOVNTQ" %%mm2, 16%0 \n\t" MOVNTQ" %%mm3, 24%0" :"=m"(*dest) :"m"(*s) :"memory"); dest += 32; s += 24; } __asm__ volatile(SFENCE:::"memory"); __asm__ volatile(EMMS:::"memory"); while (s < end) { *dest++ = *s++; *dest++ = *s++; *dest++ = *s++; *dest++ = 255; } }
{ "code": [ " PREFETCH\" 32%1 \\n\\t\"", " \"movd %1, %%mm0 \\n\\t\"", " \"punpckldq 3%1, %%mm0 \\n\\t\"", " \"movd 6%1, %%mm1 \\n\\t\"", " \"punpckldq 9%1, %%mm1 \\n\\t\"", " \"movd 12%1, %%mm2 \\n\\t\"", " \"punpckldq 15%1, %%mm2 \\n\\t\"", " \"movd 18%1, %%mm3 \\n\\t\"", " \"punpckldq 21%1, %%mm3 \\n\\t\"", " MOVNTQ\" %%mm0, %0 \\n\\t\"", " MOVNTQ\" %%mm1, 8%0 \\n\\t\"", " MOVNTQ\" %%mm2, 16%0 \\n\\t\"", " MOVNTQ\" %%mm3, 24%0\"", " :\"=m\"(*dest)", " :\"m\"(*s)", " PREFETCH\" 32%1 \\n\\t\"", " :\"=m\"(*dest)", " :\"m\"(*s)", " :\"m\"(*s)", " :\"m\"(*s)", " PREFETCH\" 32%1 \\n\\t\"", " \"movd %1, %%mm0 \\n\\t\"", " PREFETCH\" 32%1 \\n\\t\"", " \"movd %1, %%mm0 \\n\\t\"", " PREFETCH\" 32%1 \\n\\t\"", " \"movd %1, %%mm0 \\n\\t\"", " PREFETCH\" 32%1 \\n\\t\"", " \"movd %1, %%mm0 \\n\\t\"", " PREFETCH\" 32%1 \\n\\t\"", " \"movd %1, %%mm0 \\n\\t\"", " PREFETCH\" 32%1 \\n\\t\"", " :\"m\"(*s)", " PREFETCH\" 32%1 \\n\\t\"", " :\"m\"(*s)", " PREFETCH\" 32%1 \\n\\t\"", " PREFETCH\" 32%1 \\n\\t\"" ], "line_no": [ 25, 27, 29, 31, 33, 35, 37, 39, 41, 51, 53, 55, 57, 59, 61, 25, 59, 61, 61, 61, 25, 27, 25, 27, 25, 27, 25, 27, 25, 27, 25, 61, 25, 61, 25, 25 ] }
static inline void FUNC_0(rgb24tobgr32)(const uint8_t *src, uint8_t *dst, int src_size) { uint8_t *dest = dst; const uint8_t *VAR_0 = src; const uint8_t *VAR_1; const uint8_t *VAR_2; VAR_1 = VAR_0 + src_size; __asm__ volatile(PREFETCH" %0"::"m"(*VAR_0):"memory"); VAR_2 = VAR_1 - 23; __asm__ volatile("movq %0, %%mm7"::"m"(mask32a):"memory"); while (VAR_0 < VAR_2) { __asm__ volatile( PREFETCH" 32%1 \n\t" "movd %1, %%mm0 \n\t" "punpckldq 3%1, %%mm0 \n\t" "movd 6%1, %%mm1 \n\t" "punpckldq 9%1, %%mm1 \n\t" "movd 12%1, %%mm2 \n\t" "punpckldq 15%1, %%mm2 \n\t" "movd 18%1, %%mm3 \n\t" "punpckldq 21%1, %%mm3 \n\t" "por %%mm7, %%mm0 \n\t" "por %%mm7, %%mm1 \n\t" "por %%mm7, %%mm2 \n\t" "por %%mm7, %%mm3 \n\t" MOVNTQ" %%mm0, %0 \n\t" MOVNTQ" %%mm1, 8%0 \n\t" MOVNTQ" %%mm2, 16%0 \n\t" MOVNTQ" %%mm3, 24%0" :"=m"(*dest) :"m"(*VAR_0) :"memory"); dest += 32; VAR_0 += 24; } __asm__ volatile(SFENCE:::"memory"); __asm__ volatile(EMMS:::"memory"); while (VAR_0 < VAR_1) { *dest++ = *VAR_0++; *dest++ = *VAR_0++; *dest++ = *VAR_0++; *dest++ = 255; } }
[ "static inline void FUNC_0(rgb24tobgr32)(const uint8_t *src, uint8_t *dst, int src_size)\n{", "uint8_t *dest = dst;", "const uint8_t *VAR_0 = src;", "const uint8_t *VAR_1;", "const uint8_t *VAR_2;", "VAR_1 = VAR_0 + src_size;", "__asm__ volatile(PREFETCH\" %0\"::\"m\"(*VAR_0):\"memory\");", "VAR_2 = VAR_1 - 23;", "__asm__ volatile(\"movq %0, %%mm7\"::\"m\"(mask32a):\"memory\");", "while (VAR_0 < VAR_2) {", "__asm__ volatile(\nPREFETCH\" 32%1 \\n\\t\"\n\"movd %1, %%mm0 \\n\\t\"\n\"punpckldq 3%1, %%mm0 \\n\\t\"\n\"movd 6%1, %%mm1 \\n\\t\"\n\"punpckldq 9%1, %%mm1 \\n\\t\"\n\"movd 12%1, %%mm2 \\n\\t\"\n\"punpckldq 15%1, %%mm2 \\n\\t\"\n\"movd 18%1, %%mm3 \\n\\t\"\n\"punpckldq 21%1, %%mm3 \\n\\t\"\n\"por %%mm7, %%mm0 \\n\\t\"\n\"por %%mm7, %%mm1 \\n\\t\"\n\"por %%mm7, %%mm2 \\n\\t\"\n\"por %%mm7, %%mm3 \\n\\t\"\nMOVNTQ\" %%mm0, %0 \\n\\t\"\nMOVNTQ\" %%mm1, 8%0 \\n\\t\"\nMOVNTQ\" %%mm2, 16%0 \\n\\t\"\nMOVNTQ\" %%mm3, 24%0\"\n:\"=m\"(*dest)\n:\"m\"(*VAR_0)\n:\"memory\");", "dest += 32;", "VAR_0 += 24;", "}", "__asm__ volatile(SFENCE:::\"memory\");", "__asm__ volatile(EMMS:::\"memory\");", "while (VAR_0 < VAR_1) {", "*dest++ = *VAR_0++;", "*dest++ = *VAR_0++;", "*dest++ = *VAR_0++;", "*dest++ = 255;", "}", "}" ]
[ 0, 0, 0, 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 ], [ 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 ] ]
2,131
int bdrv_open2(BlockDriverState *bs, const char *filename, int flags, BlockDriver *drv) { int ret, open_flags; char tmp_filename[PATH_MAX]; char backing_filename[PATH_MAX]; bs->read_only = 0; bs->is_temporary = 0; bs->encrypted = 0; if (flags & BDRV_O_SNAPSHOT) { BlockDriverState *bs1; int64_t total_size; /* 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(""); if (!bs1) { return -ENOMEM; } if (bdrv_open(bs1, filename, 0) < 0) { bdrv_delete(bs1); return -1; } total_size = bdrv_getlength(bs1) >> SECTOR_BITS; bdrv_delete(bs1); get_tmp_filename(tmp_filename, sizeof(tmp_filename)); realpath(filename, backing_filename); if (bdrv_create(&bdrv_qcow2, tmp_filename, total_size, backing_filename, 0) < 0) { return -1; } filename = tmp_filename; bs->is_temporary = 1; } pstrcpy(bs->filename, sizeof(bs->filename), filename); if (flags & BDRV_O_FILE) { drv = find_protocol(filename); if (!drv) return -ENOENT; } else { if (!drv) { drv = find_image_format(filename); if (!drv) return -1; } } bs->drv = drv; bs->opaque = qemu_mallocz(drv->instance_size); bs->total_sectors = 0; /* driver will set if it does not do getlength */ if (bs->opaque == NULL && drv->instance_size > 0) return -1; /* Note: for compatibility, we open disk image files as RDWR, and RDONLY as fallback */ if (!(flags & BDRV_O_FILE)) open_flags = BDRV_O_RDWR | (flags & BDRV_O_DIRECT); else open_flags = flags & ~(BDRV_O_FILE | BDRV_O_SNAPSHOT); ret = drv->bdrv_open(bs, filename, open_flags); if (ret == -EACCES && !(flags & BDRV_O_FILE)) { ret = drv->bdrv_open(bs, filename, BDRV_O_RDONLY); bs->read_only = 1; } if (ret < 0) { qemu_free(bs->opaque); bs->opaque = NULL; bs->drv = NULL; return ret; } if (drv->bdrv_getlength) { bs->total_sectors = bdrv_getlength(bs) >> SECTOR_BITS; } #ifndef _WIN32 if (bs->is_temporary) { unlink(filename); } #endif if (bs->backing_file[0] != '\0') { /* if there is a backing file, use it */ bs->backing_hd = bdrv_new(""); if (!bs->backing_hd) { fail: bdrv_close(bs); return -ENOMEM; } path_combine(backing_filename, sizeof(backing_filename), filename, bs->backing_file); if (bdrv_open(bs->backing_hd, backing_filename, 0) < 0) goto fail; } /* call the change callback */ bs->media_changed = 1; if (bs->change_cb) bs->change_cb(bs->change_opaque); return 0; }
true
qemu
902b27d0b8d5bfa840eaf389d7cbcc28b57e3fbe
int bdrv_open2(BlockDriverState *bs, const char *filename, int flags, BlockDriver *drv) { int ret, open_flags; char tmp_filename[PATH_MAX]; char backing_filename[PATH_MAX]; bs->read_only = 0; bs->is_temporary = 0; bs->encrypted = 0; if (flags & BDRV_O_SNAPSHOT) { BlockDriverState *bs1; int64_t total_size; bs1 = bdrv_new(""); if (!bs1) { return -ENOMEM; } if (bdrv_open(bs1, filename, 0) < 0) { bdrv_delete(bs1); return -1; } total_size = bdrv_getlength(bs1) >> SECTOR_BITS; bdrv_delete(bs1); get_tmp_filename(tmp_filename, sizeof(tmp_filename)); realpath(filename, backing_filename); if (bdrv_create(&bdrv_qcow2, tmp_filename, total_size, backing_filename, 0) < 0) { return -1; } filename = tmp_filename; bs->is_temporary = 1; } pstrcpy(bs->filename, sizeof(bs->filename), filename); if (flags & BDRV_O_FILE) { drv = find_protocol(filename); if (!drv) return -ENOENT; } else { if (!drv) { drv = find_image_format(filename); if (!drv) return -1; } } bs->drv = drv; bs->opaque = qemu_mallocz(drv->instance_size); bs->total_sectors = 0; if (bs->opaque == NULL && drv->instance_size > 0) return -1; if (!(flags & BDRV_O_FILE)) open_flags = BDRV_O_RDWR | (flags & BDRV_O_DIRECT); else open_flags = flags & ~(BDRV_O_FILE | BDRV_O_SNAPSHOT); ret = drv->bdrv_open(bs, filename, open_flags); if (ret == -EACCES && !(flags & BDRV_O_FILE)) { ret = drv->bdrv_open(bs, filename, BDRV_O_RDONLY); bs->read_only = 1; } if (ret < 0) { qemu_free(bs->opaque); bs->opaque = NULL; bs->drv = NULL; return ret; } if (drv->bdrv_getlength) { bs->total_sectors = bdrv_getlength(bs) >> SECTOR_BITS; } #ifndef _WIN32 if (bs->is_temporary) { unlink(filename); } #endif if (bs->backing_file[0] != '\0') { bs->backing_hd = bdrv_new(""); if (!bs->backing_hd) { fail: bdrv_close(bs); return -ENOMEM; } path_combine(backing_filename, sizeof(backing_filename), filename, bs->backing_file); if (bdrv_open(bs->backing_hd, backing_filename, 0) < 0) goto fail; } bs->media_changed = 1; if (bs->change_cb) bs->change_cb(bs->change_opaque); return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(BlockDriverState *VAR_0, const char *VAR_1, int VAR_2, BlockDriver *VAR_3) { int VAR_4, VAR_5; char VAR_6[PATH_MAX]; char VAR_7[PATH_MAX]; VAR_0->read_only = 0; VAR_0->is_temporary = 0; VAR_0->encrypted = 0; if (VAR_2 & BDRV_O_SNAPSHOT) { BlockDriverState *bs1; int64_t total_size; bs1 = bdrv_new(""); if (!bs1) { return -ENOMEM; } if (bdrv_open(bs1, VAR_1, 0) < 0) { bdrv_delete(bs1); return -1; } total_size = bdrv_getlength(bs1) >> SECTOR_BITS; bdrv_delete(bs1); get_tmp_filename(VAR_6, sizeof(VAR_6)); realpath(VAR_1, VAR_7); if (bdrv_create(&bdrv_qcow2, VAR_6, total_size, VAR_7, 0) < 0) { return -1; } VAR_1 = VAR_6; VAR_0->is_temporary = 1; } pstrcpy(VAR_0->VAR_1, sizeof(VAR_0->VAR_1), VAR_1); if (VAR_2 & BDRV_O_FILE) { VAR_3 = find_protocol(VAR_1); if (!VAR_3) return -ENOENT; } else { if (!VAR_3) { VAR_3 = find_image_format(VAR_1); if (!VAR_3) return -1; } } VAR_0->VAR_3 = VAR_3; VAR_0->opaque = qemu_mallocz(VAR_3->instance_size); VAR_0->total_sectors = 0; if (VAR_0->opaque == NULL && VAR_3->instance_size > 0) return -1; if (!(VAR_2 & BDRV_O_FILE)) VAR_5 = BDRV_O_RDWR | (VAR_2 & BDRV_O_DIRECT); else VAR_5 = VAR_2 & ~(BDRV_O_FILE | BDRV_O_SNAPSHOT); VAR_4 = VAR_3->bdrv_open(VAR_0, VAR_1, VAR_5); if (VAR_4 == -EACCES && !(VAR_2 & BDRV_O_FILE)) { VAR_4 = VAR_3->bdrv_open(VAR_0, VAR_1, BDRV_O_RDONLY); VAR_0->read_only = 1; } if (VAR_4 < 0) { qemu_free(VAR_0->opaque); VAR_0->opaque = NULL; VAR_0->VAR_3 = NULL; return VAR_4; } if (VAR_3->bdrv_getlength) { VAR_0->total_sectors = bdrv_getlength(VAR_0) >> SECTOR_BITS; } #ifndef _WIN32 if (VAR_0->is_temporary) { unlink(VAR_1); } #endif if (VAR_0->backing_file[0] != '\0') { VAR_0->backing_hd = bdrv_new(""); if (!VAR_0->backing_hd) { fail: bdrv_close(VAR_0); return -ENOMEM; } path_combine(VAR_7, sizeof(VAR_7), VAR_1, VAR_0->backing_file); if (bdrv_open(VAR_0->backing_hd, VAR_7, 0) < 0) goto fail; } VAR_0->media_changed = 1; if (VAR_0->change_cb) VAR_0->change_cb(VAR_0->change_opaque); return 0; }
[ "int FUNC_0(BlockDriverState *VAR_0, const char *VAR_1, int VAR_2,\nBlockDriver *VAR_3)\n{", "int VAR_4, VAR_5;", "char VAR_6[PATH_MAX];", "char VAR_7[PATH_MAX];", "VAR_0->read_only = 0;", "VAR_0->is_temporary = 0;", "VAR_0->encrypted = 0;", "if (VAR_2 & BDRV_O_SNAPSHOT) {", "BlockDriverState *bs1;", "int64_t total_size;", "bs1 = bdrv_new(\"\");", "if (!bs1) {", "return -ENOMEM;", "}", "if (bdrv_open(bs1, VAR_1, 0) < 0) {", "bdrv_delete(bs1);", "return -1;", "}", "total_size = bdrv_getlength(bs1) >> SECTOR_BITS;", "bdrv_delete(bs1);", "get_tmp_filename(VAR_6, sizeof(VAR_6));", "realpath(VAR_1, VAR_7);", "if (bdrv_create(&bdrv_qcow2, VAR_6,\ntotal_size, VAR_7, 0) < 0) {", "return -1;", "}", "VAR_1 = VAR_6;", "VAR_0->is_temporary = 1;", "}", "pstrcpy(VAR_0->VAR_1, sizeof(VAR_0->VAR_1), VAR_1);", "if (VAR_2 & BDRV_O_FILE) {", "VAR_3 = find_protocol(VAR_1);", "if (!VAR_3)\nreturn -ENOENT;", "} else {", "if (!VAR_3) {", "VAR_3 = find_image_format(VAR_1);", "if (!VAR_3)\nreturn -1;", "}", "}", "VAR_0->VAR_3 = VAR_3;", "VAR_0->opaque = qemu_mallocz(VAR_3->instance_size);", "VAR_0->total_sectors = 0;", "if (VAR_0->opaque == NULL && VAR_3->instance_size > 0)\nreturn -1;", "if (!(VAR_2 & BDRV_O_FILE))\nVAR_5 = BDRV_O_RDWR | (VAR_2 & BDRV_O_DIRECT);", "else\nVAR_5 = VAR_2 & ~(BDRV_O_FILE | BDRV_O_SNAPSHOT);", "VAR_4 = VAR_3->bdrv_open(VAR_0, VAR_1, VAR_5);", "if (VAR_4 == -EACCES && !(VAR_2 & BDRV_O_FILE)) {", "VAR_4 = VAR_3->bdrv_open(VAR_0, VAR_1, BDRV_O_RDONLY);", "VAR_0->read_only = 1;", "}", "if (VAR_4 < 0) {", "qemu_free(VAR_0->opaque);", "VAR_0->opaque = NULL;", "VAR_0->VAR_3 = NULL;", "return VAR_4;", "}", "if (VAR_3->bdrv_getlength) {", "VAR_0->total_sectors = bdrv_getlength(VAR_0) >> SECTOR_BITS;", "}", "#ifndef _WIN32\nif (VAR_0->is_temporary) {", "unlink(VAR_1);", "}", "#endif\nif (VAR_0->backing_file[0] != '\\0') {", "VAR_0->backing_hd = bdrv_new(\"\");", "if (!VAR_0->backing_hd) {", "fail:\nbdrv_close(VAR_0);", "return -ENOMEM;", "}", "path_combine(VAR_7, sizeof(VAR_7),\nVAR_1, VAR_0->backing_file);", "if (bdrv_open(VAR_0->backing_hd, VAR_7, 0) < 0)\ngoto fail;", "}", "VAR_0->media_changed = 1;", "if (VAR_0->change_cb)\nVAR_0->change_cb(VAR_0->change_opaque);", "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 ]
[ [ 1, 2, 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 16 ], [ 17 ], [ 18 ], [ 19 ], [ 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24 ], [ 25 ], [ 26 ], [ 27 ], [ 28, 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33 ], [ 34 ], [ 35 ], [ 36 ], [ 37 ], [ 38, 39 ], [ 40 ], [ 41 ], [ 42 ], [ 43, 44 ], [ 45 ], [ 46 ], [ 47 ], [ 48 ], [ 49 ], [ 50, 51 ], [ 54, 55 ], [ 56, 57 ], [ 58 ], [ 59 ], [ 60 ], [ 61 ], [ 62 ], [ 63 ], [ 64 ], [ 65 ], [ 66 ], [ 67 ], [ 68 ], [ 69 ], [ 70 ], [ 71 ], [ 72, 73 ], [ 74 ], [ 75 ], [ 76, 77 ], [ 79 ], [ 80 ], [ 81, 82 ], [ 83 ], [ 84 ], [ 85, 86 ], [ 87, 88 ], [ 89 ], [ 91 ], [ 92, 93 ], [ 94 ], [ 95 ] ]
2,132
static int wma_decode_superframe(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; WMACodecContext *s = avctx->priv_data; int nb_frames, bit_offset, i, pos, len, ret; uint8_t *q; int16_t *samples; tprintf(avctx, "***decode_superframe:\n"); if(buf_size==0){ s->last_superframe_len = 0; return 0; } if (buf_size < s->block_align) return 0; buf_size = s->block_align; init_get_bits(&s->gb, buf, buf_size*8); if (s->use_bit_reservoir) { /* read super frame header */ skip_bits(&s->gb, 4); /* super frame index */ nb_frames = get_bits(&s->gb, 4) - (s->last_superframe_len <= 0); } else { nb_frames = 1; } /* get output buffer */ s->frame.nb_samples = nb_frames * s->frame_len; if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } samples = (int16_t *)s->frame.data[0]; if (s->use_bit_reservoir) { bit_offset = get_bits(&s->gb, s->byte_offset_bits + 3); if (s->last_superframe_len > 0) { // printf("skip=%d\n", s->last_bitoffset); /* add bit_offset bits to last frame */ if ((s->last_superframe_len + ((bit_offset + 7) >> 3)) > MAX_CODED_SUPERFRAME_SIZE) goto fail; q = s->last_superframe + s->last_superframe_len; len = bit_offset; while (len > 7) { *q++ = (get_bits)(&s->gb, 8); len -= 8; } if (len > 0) { *q++ = (get_bits)(&s->gb, len) << (8 - len); } /* XXX: bit_offset bits into last frame */ init_get_bits(&s->gb, s->last_superframe, MAX_CODED_SUPERFRAME_SIZE*8); /* skip unused bits */ if (s->last_bitoffset > 0) skip_bits(&s->gb, s->last_bitoffset); /* this frame is stored in the last superframe and in the current one */ if (wma_decode_frame(s, samples) < 0) goto fail; samples += s->nb_channels * s->frame_len; nb_frames--; } /* read each frame starting from bit_offset */ pos = bit_offset + 4 + 4 + s->byte_offset_bits + 3; init_get_bits(&s->gb, buf + (pos >> 3), (MAX_CODED_SUPERFRAME_SIZE - (pos >> 3))*8); len = pos & 7; if (len > 0) skip_bits(&s->gb, len); s->reset_block_lengths = 1; for(i=0;i<nb_frames;i++) { if (wma_decode_frame(s, samples) < 0) goto fail; samples += s->nb_channels * s->frame_len; } /* we copy the end of the frame in the last frame buffer */ pos = get_bits_count(&s->gb) + ((bit_offset + 4 + 4 + s->byte_offset_bits + 3) & ~7); s->last_bitoffset = pos & 7; pos >>= 3; len = buf_size - pos; if (len > MAX_CODED_SUPERFRAME_SIZE || len < 0) { av_log(s->avctx, AV_LOG_ERROR, "len %d invalid\n", len); goto fail; } s->last_superframe_len = len; memcpy(s->last_superframe, buf + pos, len); } else { /* single frame decode */ if (wma_decode_frame(s, samples) < 0) goto fail; samples += s->nb_channels * s->frame_len; } //av_log(NULL, AV_LOG_ERROR, "%d %d %d %d outbytes:%d eaten:%d\n", s->frame_len_bits, s->block_len_bits, s->frame_len, s->block_len, (int8_t *)samples - (int8_t *)data, s->block_align); *got_frame_ptr = 1; *(AVFrame *)data = s->frame; return s->block_align; fail: /* when error, we reset the bit reservoir */ s->last_superframe_len = 0; return -1; }
true
FFmpeg
48f1e5212c90b511c90fa0449655abb06a9edda2
static int wma_decode_superframe(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; WMACodecContext *s = avctx->priv_data; int nb_frames, bit_offset, i, pos, len, ret; uint8_t *q; int16_t *samples; tprintf(avctx, "***decode_superframe:\n"); if(buf_size==0){ s->last_superframe_len = 0; return 0; } if (buf_size < s->block_align) return 0; buf_size = s->block_align; init_get_bits(&s->gb, buf, buf_size*8); if (s->use_bit_reservoir) { skip_bits(&s->gb, 4); nb_frames = get_bits(&s->gb, 4) - (s->last_superframe_len <= 0); } else { nb_frames = 1; } s->frame.nb_samples = nb_frames * s->frame_len; if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } samples = (int16_t *)s->frame.data[0]; if (s->use_bit_reservoir) { bit_offset = get_bits(&s->gb, s->byte_offset_bits + 3); if (s->last_superframe_len > 0) { if ((s->last_superframe_len + ((bit_offset + 7) >> 3)) > MAX_CODED_SUPERFRAME_SIZE) goto fail; q = s->last_superframe + s->last_superframe_len; len = bit_offset; while (len > 7) { *q++ = (get_bits)(&s->gb, 8); len -= 8; } if (len > 0) { *q++ = (get_bits)(&s->gb, len) << (8 - len); } init_get_bits(&s->gb, s->last_superframe, MAX_CODED_SUPERFRAME_SIZE*8); if (s->last_bitoffset > 0) skip_bits(&s->gb, s->last_bitoffset); if (wma_decode_frame(s, samples) < 0) goto fail; samples += s->nb_channels * s->frame_len; nb_frames--; } pos = bit_offset + 4 + 4 + s->byte_offset_bits + 3; init_get_bits(&s->gb, buf + (pos >> 3), (MAX_CODED_SUPERFRAME_SIZE - (pos >> 3))*8); len = pos & 7; if (len > 0) skip_bits(&s->gb, len); s->reset_block_lengths = 1; for(i=0;i<nb_frames;i++) { if (wma_decode_frame(s, samples) < 0) goto fail; samples += s->nb_channels * s->frame_len; } pos = get_bits_count(&s->gb) + ((bit_offset + 4 + 4 + s->byte_offset_bits + 3) & ~7); s->last_bitoffset = pos & 7; pos >>= 3; len = buf_size - pos; if (len > MAX_CODED_SUPERFRAME_SIZE || len < 0) { av_log(s->avctx, AV_LOG_ERROR, "len %d invalid\n", len); goto fail; } s->last_superframe_len = len; memcpy(s->last_superframe, buf + pos, len); } else { if (wma_decode_frame(s, samples) < 0) goto fail; samples += s->nb_channels * s->frame_len; } *got_frame_ptr = 1; *(AVFrame *)data = s->frame; return s->block_align; fail: s->last_superframe_len = 0; return -1; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; WMACodecContext *s = VAR_0->priv_data; int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11; uint8_t *q; int16_t *samples; tprintf(VAR_0, "***decode_superframe:\n"); if(VAR_5==0){ s->last_superframe_len = 0; return 0; } if (VAR_5 < s->block_align) return 0; VAR_5 = s->block_align; init_get_bits(&s->gb, VAR_4, VAR_5*8); if (s->use_bit_reservoir) { skip_bits(&s->gb, 4); VAR_6 = get_bits(&s->gb, 4) - (s->last_superframe_len <= 0); } else { VAR_6 = 1; } s->frame.nb_samples = VAR_6 * s->frame_len; if ((VAR_11 = VAR_0->get_buffer(VAR_0, &s->frame)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\n"); return VAR_11; } samples = (int16_t *)s->frame.VAR_1[0]; if (s->use_bit_reservoir) { VAR_7 = get_bits(&s->gb, s->byte_offset_bits + 3); if (s->last_superframe_len > 0) { if ((s->last_superframe_len + ((VAR_7 + 7) >> 3)) > MAX_CODED_SUPERFRAME_SIZE) goto fail; q = s->last_superframe + s->last_superframe_len; VAR_10 = VAR_7; while (VAR_10 > 7) { *q++ = (get_bits)(&s->gb, 8); VAR_10 -= 8; } if (VAR_10 > 0) { *q++ = (get_bits)(&s->gb, VAR_10) << (8 - VAR_10); } init_get_bits(&s->gb, s->last_superframe, MAX_CODED_SUPERFRAME_SIZE*8); if (s->last_bitoffset > 0) skip_bits(&s->gb, s->last_bitoffset); if (wma_decode_frame(s, samples) < 0) goto fail; samples += s->nb_channels * s->frame_len; VAR_6--; } VAR_9 = VAR_7 + 4 + 4 + s->byte_offset_bits + 3; init_get_bits(&s->gb, VAR_4 + (VAR_9 >> 3), (MAX_CODED_SUPERFRAME_SIZE - (VAR_9 >> 3))*8); VAR_10 = VAR_9 & 7; if (VAR_10 > 0) skip_bits(&s->gb, VAR_10); s->reset_block_lengths = 1; for(VAR_8=0;VAR_8<VAR_6;VAR_8++) { if (wma_decode_frame(s, samples) < 0) goto fail; samples += s->nb_channels * s->frame_len; } VAR_9 = get_bits_count(&s->gb) + ((VAR_7 + 4 + 4 + s->byte_offset_bits + 3) & ~7); s->last_bitoffset = VAR_9 & 7; VAR_9 >>= 3; VAR_10 = VAR_5 - VAR_9; if (VAR_10 > MAX_CODED_SUPERFRAME_SIZE || VAR_10 < 0) { av_log(s->VAR_0, AV_LOG_ERROR, "VAR_10 %d invalid\n", VAR_10); goto fail; } s->last_superframe_len = VAR_10; memcpy(s->last_superframe, VAR_4 + VAR_9, VAR_10); } else { if (wma_decode_frame(s, samples) < 0) goto fail; samples += s->nb_channels * s->frame_len; } *VAR_2 = 1; *(AVFrame *)VAR_1 = s->frame; return s->block_align; fail: s->last_superframe_len = 0; return -1; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "WMACodecContext *s = VAR_0->priv_data;", "int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11;", "uint8_t *q;", "int16_t *samples;", "tprintf(VAR_0, \"***decode_superframe:\\n\");", "if(VAR_5==0){", "s->last_superframe_len = 0;", "return 0;", "}", "if (VAR_5 < s->block_align)\nreturn 0;", "VAR_5 = s->block_align;", "init_get_bits(&s->gb, VAR_4, VAR_5*8);", "if (s->use_bit_reservoir) {", "skip_bits(&s->gb, 4);", "VAR_6 = get_bits(&s->gb, 4) - (s->last_superframe_len <= 0);", "} else {", "VAR_6 = 1;", "}", "s->frame.nb_samples = VAR_6 * s->frame_len;", "if ((VAR_11 = VAR_0->get_buffer(VAR_0, &s->frame)) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"get_buffer() failed\\n\");", "return VAR_11;", "}", "samples = (int16_t *)s->frame.VAR_1[0];", "if (s->use_bit_reservoir) {", "VAR_7 = get_bits(&s->gb, s->byte_offset_bits + 3);", "if (s->last_superframe_len > 0) {", "if ((s->last_superframe_len + ((VAR_7 + 7) >> 3)) >\nMAX_CODED_SUPERFRAME_SIZE)\ngoto fail;", "q = s->last_superframe + s->last_superframe_len;", "VAR_10 = VAR_7;", "while (VAR_10 > 7) {", "*q++ = (get_bits)(&s->gb, 8);", "VAR_10 -= 8;", "}", "if (VAR_10 > 0) {", "*q++ = (get_bits)(&s->gb, VAR_10) << (8 - VAR_10);", "}", "init_get_bits(&s->gb, s->last_superframe, MAX_CODED_SUPERFRAME_SIZE*8);", "if (s->last_bitoffset > 0)\nskip_bits(&s->gb, s->last_bitoffset);", "if (wma_decode_frame(s, samples) < 0)\ngoto fail;", "samples += s->nb_channels * s->frame_len;", "VAR_6--;", "}", "VAR_9 = VAR_7 + 4 + 4 + s->byte_offset_bits + 3;", "init_get_bits(&s->gb, VAR_4 + (VAR_9 >> 3), (MAX_CODED_SUPERFRAME_SIZE - (VAR_9 >> 3))*8);", "VAR_10 = VAR_9 & 7;", "if (VAR_10 > 0)\nskip_bits(&s->gb, VAR_10);", "s->reset_block_lengths = 1;", "for(VAR_8=0;VAR_8<VAR_6;VAR_8++) {", "if (wma_decode_frame(s, samples) < 0)\ngoto fail;", "samples += s->nb_channels * s->frame_len;", "}", "VAR_9 = get_bits_count(&s->gb) + ((VAR_7 + 4 + 4 + s->byte_offset_bits + 3) & ~7);", "s->last_bitoffset = VAR_9 & 7;", "VAR_9 >>= 3;", "VAR_10 = VAR_5 - VAR_9;", "if (VAR_10 > MAX_CODED_SUPERFRAME_SIZE || VAR_10 < 0) {", "av_log(s->VAR_0, AV_LOG_ERROR, \"VAR_10 %d invalid\\n\", VAR_10);", "goto fail;", "}", "s->last_superframe_len = VAR_10;", "memcpy(s->last_superframe, VAR_4 + VAR_9, VAR_10);", "} else {", "if (wma_decode_frame(s, samples) < 0)\ngoto fail;", "samples += s->nb_channels * s->frame_len;", "}", "*VAR_2 = 1;", "*(AVFrame *)VAR_1 = s->frame;", "return s->block_align;", "fail:\ns->last_superframe_len = 0;", "return -1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 41 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 83 ], [ 89, 91, 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 117 ], [ 121, 123 ], [ 129, 131 ], [ 133 ], [ 135 ], [ 137 ], [ 143 ], [ 147 ], [ 149 ], [ 151, 153 ], [ 157 ], [ 159 ], [ 161, 163 ], [ 165 ], [ 167 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 197, 199 ], [ 201 ], [ 203 ], [ 211 ], [ 213 ], [ 217 ], [ 219, 223 ], [ 225 ], [ 227 ] ]
2,134
static int vc1_decode_p_mb(VC1Context *v) { MpegEncContext *s = &v->s; GetBitContext *gb = &s->gb; int i, j; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; int cbp; /* cbp decoding stuff */ int mqdiff, mquant; /* MB quantization */ int ttmb = v->ttfrm; /* MB Transform type */ int mb_has_coeffs = 1; /* last_flag */ int dmv_x, dmv_y; /* Differential MV components */ int index, index1; /* LUT indexes */ int val, sign; /* temp values */ int first_block = 1; int dst_idx, off; int skipped, fourmv; int block_cbp = 0, pat, block_tt = 0, block_intra = 0; mquant = v->pq; /* lossy initialization */ if (v->mv_type_is_raw) fourmv = get_bits1(gb); else fourmv = v->mv_type_mb_plane[mb_pos]; if (v->skip_is_raw) skipped = get_bits1(gb); else skipped = v->s.mbskip_table[mb_pos]; if (!fourmv) { /* 1MV mode */ if (!skipped) { GET_MVDATA(dmv_x, dmv_y); if (s->mb_intra) { s->current_picture.motion_val[1][s->block_index[0]][0] = 0; s->current_picture.motion_val[1][s->block_index[0]][1] = 0; } s->current_picture.mb_type[mb_pos] = s->mb_intra ? MB_TYPE_INTRA : MB_TYPE_16x16; vc1_pred_mv(v, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0], 0, 0); /* FIXME Set DC val for inter block ? */ if (s->mb_intra && !mb_has_coeffs) { GET_MQUANT(); s->ac_pred = get_bits1(gb); cbp = 0; } else if (mb_has_coeffs) { if (s->mb_intra) s->ac_pred = get_bits1(gb); cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); GET_MQUANT(); } else { mquant = v->pq; cbp = 0; } s->current_picture.qscale_table[mb_pos] = mquant; if (!v->ttmbf && !s->mb_intra && mb_has_coeffs) ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); if (!s->mb_intra) vc1_mc_1mv(v, 0); dst_idx = 0; for (i = 0; i < 6; i++) { s->dc_val[0][s->block_index[i]] = 0; dst_idx += i >> 2; val = ((cbp >> (5 - i)) & 1); off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); v->mb_type[0][s->block_index[i]] = s->mb_intra; if (s->mb_intra) { /* check if prediction blocks A and C are available */ v->a_avail = v->c_avail = 0; if (i == 2 || i == 3 || !s->first_slice_line) v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]]; if (i == 1 || i == 3 || s->mb_x) v->c_avail = v->mb_type[0][s->block_index[i] - 1]; vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i & 4) ? v->codingset2 : v->codingset); if ((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); if (v->rangeredfrm) for (j = 0; j < 64; j++) s->block[i][j] <<= 1; s->idsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); if (v->pq >= 9 && v->overlap) { if (v->c_avail) v->vc1dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); if (v->a_avail) v->vc1dsp.vc1_v_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); } block_cbp |= 0xF << (i << 2); block_intra |= 1 << i; } else if (val) { pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize, (i & 4) && (s->flags & CODEC_FLAG_GRAY), &block_tt); block_cbp |= pat << (i << 2); if (!v->ttmbf && ttmb < 8) ttmb = -1; first_block = 0; } } } else { // skipped s->mb_intra = 0; for (i = 0; i < 6; i++) { v->mb_type[0][s->block_index[i]] = 0; s->dc_val[0][s->block_index[i]] = 0; } s->current_picture.mb_type[mb_pos] = MB_TYPE_SKIP; s->current_picture.qscale_table[mb_pos] = 0; vc1_pred_mv(v, 0, 0, 0, 1, v->range_x, v->range_y, v->mb_type[0], 0, 0); vc1_mc_1mv(v, 0); } } else { // 4MV mode if (!skipped /* unskipped MB */) { int intra_count = 0, coded_inter = 0; int is_intra[6], is_coded[6]; /* Get CBPCY */ cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); for (i = 0; i < 6; i++) { val = ((cbp >> (5 - i)) & 1); s->dc_val[0][s->block_index[i]] = 0; s->mb_intra = 0; if (i < 4) { dmv_x = dmv_y = 0; s->mb_intra = 0; mb_has_coeffs = 0; if (val) { GET_MVDATA(dmv_x, dmv_y); } vc1_pred_mv(v, i, dmv_x, dmv_y, 0, v->range_x, v->range_y, v->mb_type[0], 0, 0); if (!s->mb_intra) vc1_mc_4mv_luma(v, i, 0, 0); intra_count += s->mb_intra; is_intra[i] = s->mb_intra; is_coded[i] = mb_has_coeffs; } if (i & 4) { is_intra[i] = (intra_count >= 3); is_coded[i] = val; } if (i == 4) vc1_mc_4mv_chroma(v, 0); v->mb_type[0][s->block_index[i]] = is_intra[i]; if (!coded_inter) coded_inter = !is_intra[i] && is_coded[i]; } // if there are no coded blocks then don't do anything more dst_idx = 0; if (!intra_count && !coded_inter) goto end; GET_MQUANT(); s->current_picture.qscale_table[mb_pos] = mquant; /* test if block is intra and has pred */ { int intrapred = 0; for (i = 0; i < 6; i++) if (is_intra[i]) { if (((!s->first_slice_line || (i == 2 || i == 3)) && v->mb_type[0][s->block_index[i] - s->block_wrap[i]]) || ((s->mb_x || (i == 1 || i == 3)) && v->mb_type[0][s->block_index[i] - 1])) { intrapred = 1; break; } } if (intrapred) s->ac_pred = get_bits1(gb); else s->ac_pred = 0; } if (!v->ttmbf && coded_inter) ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); for (i = 0; i < 6; i++) { dst_idx += i >> 2; off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); s->mb_intra = is_intra[i]; if (is_intra[i]) { /* check if prediction blocks A and C are available */ v->a_avail = v->c_avail = 0; if (i == 2 || i == 3 || !s->first_slice_line) v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]]; if (i == 1 || i == 3 || s->mb_x) v->c_avail = v->mb_type[0][s->block_index[i] - 1]; vc1_decode_intra_block(v, s->block[i], i, is_coded[i], mquant, (i & 4) ? v->codingset2 : v->codingset); if ((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); if (v->rangeredfrm) for (j = 0; j < 64; j++) s->block[i][j] <<= 1; s->idsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize); if (v->pq >= 9 && v->overlap) { if (v->c_avail) v->vc1dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); if (v->a_avail) v->vc1dsp.vc1_v_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); } block_cbp |= 0xF << (i << 2); block_intra |= 1 << i; } else if (is_coded[i]) { pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize, (i & 4) && (s->flags & CODEC_FLAG_GRAY), &block_tt); block_cbp |= pat << (i << 2); if (!v->ttmbf && ttmb < 8) ttmb = -1; first_block = 0; } } } else { // skipped MB s->mb_intra = 0; s->current_picture.qscale_table[mb_pos] = 0; for (i = 0; i < 6; i++) { v->mb_type[0][s->block_index[i]] = 0; s->dc_val[0][s->block_index[i]] = 0; } for (i = 0; i < 4; i++) { vc1_pred_mv(v, i, 0, 0, 0, v->range_x, v->range_y, v->mb_type[0], 0, 0); vc1_mc_4mv_luma(v, i, 0, 0); } vc1_mc_4mv_chroma(v, 0); s->current_picture.qscale_table[mb_pos] = 0; } } end: v->cbp[s->mb_x] = block_cbp; v->ttblk[s->mb_x] = block_tt; v->is_intra[s->mb_x] = block_intra; return 0; }
true
FFmpeg
a52f443714b5c2a40ed272d8445f4c39220a4b69
static int vc1_decode_p_mb(VC1Context *v) { MpegEncContext *s = &v->s; GetBitContext *gb = &s->gb; int i, j; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; int cbp; int mqdiff, mquant; int ttmb = v->ttfrm; int mb_has_coeffs = 1; int dmv_x, dmv_y; int index, index1; int val, sign; int first_block = 1; int dst_idx, off; int skipped, fourmv; int block_cbp = 0, pat, block_tt = 0, block_intra = 0; mquant = v->pq; if (v->mv_type_is_raw) fourmv = get_bits1(gb); else fourmv = v->mv_type_mb_plane[mb_pos]; if (v->skip_is_raw) skipped = get_bits1(gb); else skipped = v->s.mbskip_table[mb_pos]; if (!fourmv) { if (!skipped) { GET_MVDATA(dmv_x, dmv_y); if (s->mb_intra) { s->current_picture.motion_val[1][s->block_index[0]][0] = 0; s->current_picture.motion_val[1][s->block_index[0]][1] = 0; } s->current_picture.mb_type[mb_pos] = s->mb_intra ? MB_TYPE_INTRA : MB_TYPE_16x16; vc1_pred_mv(v, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0], 0, 0); if (s->mb_intra && !mb_has_coeffs) { GET_MQUANT(); s->ac_pred = get_bits1(gb); cbp = 0; } else if (mb_has_coeffs) { if (s->mb_intra) s->ac_pred = get_bits1(gb); cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); GET_MQUANT(); } else { mquant = v->pq; cbp = 0; } s->current_picture.qscale_table[mb_pos] = mquant; if (!v->ttmbf && !s->mb_intra && mb_has_coeffs) ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); if (!s->mb_intra) vc1_mc_1mv(v, 0); dst_idx = 0; for (i = 0; i < 6; i++) { s->dc_val[0][s->block_index[i]] = 0; dst_idx += i >> 2; val = ((cbp >> (5 - i)) & 1); off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); v->mb_type[0][s->block_index[i]] = s->mb_intra; if (s->mb_intra) { v->a_avail = v->c_avail = 0; if (i == 2 || i == 3 || !s->first_slice_line) v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]]; if (i == 1 || i == 3 || s->mb_x) v->c_avail = v->mb_type[0][s->block_index[i] - 1]; vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i & 4) ? v->codingset2 : v->codingset); if ((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); if (v->rangeredfrm) for (j = 0; j < 64; j++) s->block[i][j] <<= 1; s->idsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); if (v->pq >= 9 && v->overlap) { if (v->c_avail) v->vc1dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); if (v->a_avail) v->vc1dsp.vc1_v_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); } block_cbp |= 0xF << (i << 2); block_intra |= 1 << i; } else if (val) { pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize, (i & 4) && (s->flags & CODEC_FLAG_GRAY), &block_tt); block_cbp |= pat << (i << 2); if (!v->ttmbf && ttmb < 8) ttmb = -1; first_block = 0; } } } else { s->mb_intra = 0; for (i = 0; i < 6; i++) { v->mb_type[0][s->block_index[i]] = 0; s->dc_val[0][s->block_index[i]] = 0; } s->current_picture.mb_type[mb_pos] = MB_TYPE_SKIP; s->current_picture.qscale_table[mb_pos] = 0; vc1_pred_mv(v, 0, 0, 0, 1, v->range_x, v->range_y, v->mb_type[0], 0, 0); vc1_mc_1mv(v, 0); } } else { if (!skipped ) { int intra_count = 0, coded_inter = 0; int is_intra[6], is_coded[6]; cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); for (i = 0; i < 6; i++) { val = ((cbp >> (5 - i)) & 1); s->dc_val[0][s->block_index[i]] = 0; s->mb_intra = 0; if (i < 4) { dmv_x = dmv_y = 0; s->mb_intra = 0; mb_has_coeffs = 0; if (val) { GET_MVDATA(dmv_x, dmv_y); } vc1_pred_mv(v, i, dmv_x, dmv_y, 0, v->range_x, v->range_y, v->mb_type[0], 0, 0); if (!s->mb_intra) vc1_mc_4mv_luma(v, i, 0, 0); intra_count += s->mb_intra; is_intra[i] = s->mb_intra; is_coded[i] = mb_has_coeffs; } if (i & 4) { is_intra[i] = (intra_count >= 3); is_coded[i] = val; } if (i == 4) vc1_mc_4mv_chroma(v, 0); v->mb_type[0][s->block_index[i]] = is_intra[i]; if (!coded_inter) coded_inter = !is_intra[i] && is_coded[i]; } dst_idx = 0; if (!intra_count && !coded_inter) goto end; GET_MQUANT(); s->current_picture.qscale_table[mb_pos] = mquant; { int intrapred = 0; for (i = 0; i < 6; i++) if (is_intra[i]) { if (((!s->first_slice_line || (i == 2 || i == 3)) && v->mb_type[0][s->block_index[i] - s->block_wrap[i]]) || ((s->mb_x || (i == 1 || i == 3)) && v->mb_type[0][s->block_index[i] - 1])) { intrapred = 1; break; } } if (intrapred) s->ac_pred = get_bits1(gb); else s->ac_pred = 0; } if (!v->ttmbf && coded_inter) ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); for (i = 0; i < 6; i++) { dst_idx += i >> 2; off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); s->mb_intra = is_intra[i]; if (is_intra[i]) { v->a_avail = v->c_avail = 0; if (i == 2 || i == 3 || !s->first_slice_line) v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]]; if (i == 1 || i == 3 || s->mb_x) v->c_avail = v->mb_type[0][s->block_index[i] - 1]; vc1_decode_intra_block(v, s->block[i], i, is_coded[i], mquant, (i & 4) ? v->codingset2 : v->codingset); if ((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); if (v->rangeredfrm) for (j = 0; j < 64; j++) s->block[i][j] <<= 1; s->idsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize); if (v->pq >= 9 && v->overlap) { if (v->c_avail) v->vc1dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); if (v->a_avail) v->vc1dsp.vc1_v_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); } block_cbp |= 0xF << (i << 2); block_intra |= 1 << i; } else if (is_coded[i]) { pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize, (i & 4) && (s->flags & CODEC_FLAG_GRAY), &block_tt); block_cbp |= pat << (i << 2); if (!v->ttmbf && ttmb < 8) ttmb = -1; first_block = 0; } } } else { MB s->mb_intra = 0; s->current_picture.qscale_table[mb_pos] = 0; for (i = 0; i < 6; i++) { v->mb_type[0][s->block_index[i]] = 0; s->dc_val[0][s->block_index[i]] = 0; } for (i = 0; i < 4; i++) { vc1_pred_mv(v, i, 0, 0, 0, v->range_x, v->range_y, v->mb_type[0], 0, 0); vc1_mc_4mv_luma(v, i, 0, 0); } vc1_mc_4mv_chroma(v, 0); s->current_picture.qscale_table[mb_pos] = 0; } } end: v->cbp[s->mb_x] = block_cbp; v->ttblk[s->mb_x] = block_tt; v->is_intra[s->mb_x] = block_intra; return 0; }
{ "code": [ " block_intra |= 1 << i;", " block_intra |= 1 << i;" ], "line_no": [ 191, 191 ] }
static int FUNC_0(VC1Context *VAR_0) { MpegEncContext *s = &VAR_0->s; GetBitContext *gb = &s->gb; int VAR_1, VAR_2; int VAR_3 = s->mb_x + s->mb_y * s->mb_stride; int VAR_4; int VAR_5, VAR_6; int VAR_7 = VAR_0->ttfrm; int VAR_8 = 1; int VAR_9, VAR_10; int VAR_11, VAR_12; int VAR_13, VAR_14; int VAR_15 = 1; int VAR_16, VAR_17; int VAR_18, VAR_19; int VAR_20 = 0, VAR_21, VAR_22 = 0, VAR_23 = 0; VAR_6 = VAR_0->pq; if (VAR_0->mv_type_is_raw) VAR_19 = get_bits1(gb); else VAR_19 = VAR_0->mv_type_mb_plane[VAR_3]; if (VAR_0->skip_is_raw) VAR_18 = get_bits1(gb); else VAR_18 = VAR_0->s.mbskip_table[VAR_3]; if (!VAR_19) { if (!VAR_18) { GET_MVDATA(VAR_9, VAR_10); if (s->mb_intra) { s->current_picture.motion_val[1][s->block_index[0]][0] = 0; s->current_picture.motion_val[1][s->block_index[0]][1] = 0; } s->current_picture.mb_type[VAR_3] = s->mb_intra ? MB_TYPE_INTRA : MB_TYPE_16x16; vc1_pred_mv(VAR_0, 0, VAR_9, VAR_10, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], 0, 0); if (s->mb_intra && !VAR_8) { GET_MQUANT(); s->ac_pred = get_bits1(gb); VAR_4 = 0; } else if (VAR_8) { if (s->mb_intra) s->ac_pred = get_bits1(gb); VAR_4 = get_vlc2(&VAR_0->s.gb, VAR_0->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); GET_MQUANT(); } else { VAR_6 = VAR_0->pq; VAR_4 = 0; } s->current_picture.qscale_table[VAR_3] = VAR_6; if (!VAR_0->ttmbf && !s->mb_intra && VAR_8) VAR_7 = get_vlc2(gb, ff_vc1_ttmb_vlc[VAR_0->tt_index].table, VC1_TTMB_VLC_BITS, 2); if (!s->mb_intra) vc1_mc_1mv(VAR_0, 0); VAR_16 = 0; for (VAR_1 = 0; VAR_1 < 6; VAR_1++) { s->dc_val[0][s->block_index[VAR_1]] = 0; VAR_16 += VAR_1 >> 2; VAR_13 = ((VAR_4 >> (5 - VAR_1)) & 1); VAR_17 = (VAR_1 & 4) ? 0 : ((VAR_1 & 1) * 8 + (VAR_1 & 2) * 4 * s->linesize); VAR_0->mb_type[0][s->block_index[VAR_1]] = s->mb_intra; if (s->mb_intra) { VAR_0->a_avail = VAR_0->c_avail = 0; if (VAR_1 == 2 || VAR_1 == 3 || !s->first_slice_line) VAR_0->a_avail = VAR_0->mb_type[0][s->block_index[VAR_1] - s->block_wrap[VAR_1]]; if (VAR_1 == 1 || VAR_1 == 3 || s->mb_x) VAR_0->c_avail = VAR_0->mb_type[0][s->block_index[VAR_1] - 1]; vc1_decode_intra_block(VAR_0, s->block[VAR_1], VAR_1, VAR_13, VAR_6, (VAR_1 & 4) ? VAR_0->codingset2 : VAR_0->codingset); if ((VAR_1>3) && (s->flags & CODEC_FLAG_GRAY)) continue; VAR_0->vc1dsp.vc1_inv_trans_8x8(s->block[VAR_1]); if (VAR_0->rangeredfrm) for (VAR_2 = 0; VAR_2 < 64; VAR_2++) s->block[VAR_1][VAR_2] <<= 1; s->idsp.put_signed_pixels_clamped(s->block[VAR_1], s->dest[VAR_16] + VAR_17, VAR_1 & 4 ? s->uvlinesize : s->linesize); if (VAR_0->pq >= 9 && VAR_0->overlap) { if (VAR_0->c_avail) VAR_0->vc1dsp.vc1_h_overlap(s->dest[VAR_16] + VAR_17, VAR_1 & 4 ? s->uvlinesize : s->linesize); if (VAR_0->a_avail) VAR_0->vc1dsp.vc1_v_overlap(s->dest[VAR_16] + VAR_17, VAR_1 & 4 ? s->uvlinesize : s->linesize); } VAR_20 |= 0xF << (VAR_1 << 2); VAR_23 |= 1 << VAR_1; } else if (VAR_13) { VAR_21 = vc1_decode_p_block(VAR_0, s->block[VAR_1], VAR_1, VAR_6, VAR_7, VAR_15, s->dest[VAR_16] + VAR_17, (VAR_1 & 4) ? s->uvlinesize : s->linesize, (VAR_1 & 4) && (s->flags & CODEC_FLAG_GRAY), &VAR_22); VAR_20 |= VAR_21 << (VAR_1 << 2); if (!VAR_0->ttmbf && VAR_7 < 8) VAR_7 = -1; VAR_15 = 0; } } } else { s->mb_intra = 0; for (VAR_1 = 0; VAR_1 < 6; VAR_1++) { VAR_0->mb_type[0][s->block_index[VAR_1]] = 0; s->dc_val[0][s->block_index[VAR_1]] = 0; } s->current_picture.mb_type[VAR_3] = MB_TYPE_SKIP; s->current_picture.qscale_table[VAR_3] = 0; vc1_pred_mv(VAR_0, 0, 0, 0, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], 0, 0); vc1_mc_1mv(VAR_0, 0); } } else { if (!VAR_18 ) { int VAR_24 = 0, VAR_25 = 0; int VAR_26[6], VAR_27[6]; VAR_4 = get_vlc2(&VAR_0->s.gb, VAR_0->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); for (VAR_1 = 0; VAR_1 < 6; VAR_1++) { VAR_13 = ((VAR_4 >> (5 - VAR_1)) & 1); s->dc_val[0][s->block_index[VAR_1]] = 0; s->mb_intra = 0; if (VAR_1 < 4) { VAR_9 = VAR_10 = 0; s->mb_intra = 0; VAR_8 = 0; if (VAR_13) { GET_MVDATA(VAR_9, VAR_10); } vc1_pred_mv(VAR_0, VAR_1, VAR_9, VAR_10, 0, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], 0, 0); if (!s->mb_intra) vc1_mc_4mv_luma(VAR_0, VAR_1, 0, 0); VAR_24 += s->mb_intra; VAR_26[VAR_1] = s->mb_intra; VAR_27[VAR_1] = VAR_8; } if (VAR_1 & 4) { VAR_26[VAR_1] = (VAR_24 >= 3); VAR_27[VAR_1] = VAR_13; } if (VAR_1 == 4) vc1_mc_4mv_chroma(VAR_0, 0); VAR_0->mb_type[0][s->block_index[VAR_1]] = VAR_26[VAR_1]; if (!VAR_25) VAR_25 = !VAR_26[VAR_1] && VAR_27[VAR_1]; } VAR_16 = 0; if (!VAR_24 && !VAR_25) goto end; GET_MQUANT(); s->current_picture.qscale_table[VAR_3] = VAR_6; { int VAR_28 = 0; for (VAR_1 = 0; VAR_1 < 6; VAR_1++) if (VAR_26[VAR_1]) { if (((!s->first_slice_line || (VAR_1 == 2 || VAR_1 == 3)) && VAR_0->mb_type[0][s->block_index[VAR_1] - s->block_wrap[VAR_1]]) || ((s->mb_x || (VAR_1 == 1 || VAR_1 == 3)) && VAR_0->mb_type[0][s->block_index[VAR_1] - 1])) { VAR_28 = 1; break; } } if (VAR_28) s->ac_pred = get_bits1(gb); else s->ac_pred = 0; } if (!VAR_0->ttmbf && VAR_25) VAR_7 = get_vlc2(gb, ff_vc1_ttmb_vlc[VAR_0->tt_index].table, VC1_TTMB_VLC_BITS, 2); for (VAR_1 = 0; VAR_1 < 6; VAR_1++) { VAR_16 += VAR_1 >> 2; VAR_17 = (VAR_1 & 4) ? 0 : ((VAR_1 & 1) * 8 + (VAR_1 & 2) * 4 * s->linesize); s->mb_intra = VAR_26[VAR_1]; if (VAR_26[VAR_1]) { VAR_0->a_avail = VAR_0->c_avail = 0; if (VAR_1 == 2 || VAR_1 == 3 || !s->first_slice_line) VAR_0->a_avail = VAR_0->mb_type[0][s->block_index[VAR_1] - s->block_wrap[VAR_1]]; if (VAR_1 == 1 || VAR_1 == 3 || s->mb_x) VAR_0->c_avail = VAR_0->mb_type[0][s->block_index[VAR_1] - 1]; vc1_decode_intra_block(VAR_0, s->block[VAR_1], VAR_1, VAR_27[VAR_1], VAR_6, (VAR_1 & 4) ? VAR_0->codingset2 : VAR_0->codingset); if ((VAR_1>3) && (s->flags & CODEC_FLAG_GRAY)) continue; VAR_0->vc1dsp.vc1_inv_trans_8x8(s->block[VAR_1]); if (VAR_0->rangeredfrm) for (VAR_2 = 0; VAR_2 < 64; VAR_2++) s->block[VAR_1][VAR_2] <<= 1; s->idsp.put_signed_pixels_clamped(s->block[VAR_1], s->dest[VAR_16] + VAR_17, (VAR_1 & 4) ? s->uvlinesize : s->linesize); if (VAR_0->pq >= 9 && VAR_0->overlap) { if (VAR_0->c_avail) VAR_0->vc1dsp.vc1_h_overlap(s->dest[VAR_16] + VAR_17, VAR_1 & 4 ? s->uvlinesize : s->linesize); if (VAR_0->a_avail) VAR_0->vc1dsp.vc1_v_overlap(s->dest[VAR_16] + VAR_17, VAR_1 & 4 ? s->uvlinesize : s->linesize); } VAR_20 |= 0xF << (VAR_1 << 2); VAR_23 |= 1 << VAR_1; } else if (VAR_27[VAR_1]) { VAR_21 = vc1_decode_p_block(VAR_0, s->block[VAR_1], VAR_1, VAR_6, VAR_7, VAR_15, s->dest[VAR_16] + VAR_17, (VAR_1 & 4) ? s->uvlinesize : s->linesize, (VAR_1 & 4) && (s->flags & CODEC_FLAG_GRAY), &VAR_22); VAR_20 |= VAR_21 << (VAR_1 << 2); if (!VAR_0->ttmbf && VAR_7 < 8) VAR_7 = -1; VAR_15 = 0; } } } else { MB s->mb_intra = 0; s->current_picture.qscale_table[VAR_3] = 0; for (VAR_1 = 0; VAR_1 < 6; VAR_1++) { VAR_0->mb_type[0][s->block_index[VAR_1]] = 0; s->dc_val[0][s->block_index[VAR_1]] = 0; } for (VAR_1 = 0; VAR_1 < 4; VAR_1++) { vc1_pred_mv(VAR_0, VAR_1, 0, 0, 0, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], 0, 0); vc1_mc_4mv_luma(VAR_0, VAR_1, 0, 0); } vc1_mc_4mv_chroma(VAR_0, 0); s->current_picture.qscale_table[VAR_3] = 0; } } end: VAR_0->VAR_4[s->mb_x] = VAR_20; VAR_0->ttblk[s->mb_x] = VAR_22; VAR_0->VAR_26[s->mb_x] = VAR_23; return 0; }
[ "static int FUNC_0(VC1Context *VAR_0)\n{", "MpegEncContext *s = &VAR_0->s;", "GetBitContext *gb = &s->gb;", "int VAR_1, VAR_2;", "int VAR_3 = s->mb_x + s->mb_y * s->mb_stride;", "int VAR_4;", "int VAR_5, VAR_6;", "int VAR_7 = VAR_0->ttfrm;", "int VAR_8 = 1;", "int VAR_9, VAR_10;", "int VAR_11, VAR_12;", "int VAR_13, VAR_14;", "int VAR_15 = 1;", "int VAR_16, VAR_17;", "int VAR_18, VAR_19;", "int VAR_20 = 0, VAR_21, VAR_22 = 0, VAR_23 = 0;", "VAR_6 = VAR_0->pq;", "if (VAR_0->mv_type_is_raw)\nVAR_19 = get_bits1(gb);", "else\nVAR_19 = VAR_0->mv_type_mb_plane[VAR_3];", "if (VAR_0->skip_is_raw)\nVAR_18 = get_bits1(gb);", "else\nVAR_18 = VAR_0->s.mbskip_table[VAR_3];", "if (!VAR_19) {", "if (!VAR_18) {", "GET_MVDATA(VAR_9, VAR_10);", "if (s->mb_intra) {", "s->current_picture.motion_val[1][s->block_index[0]][0] = 0;", "s->current_picture.motion_val[1][s->block_index[0]][1] = 0;", "}", "s->current_picture.mb_type[VAR_3] = s->mb_intra ? MB_TYPE_INTRA : MB_TYPE_16x16;", "vc1_pred_mv(VAR_0, 0, VAR_9, VAR_10, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], 0, 0);", "if (s->mb_intra && !VAR_8) {", "GET_MQUANT();", "s->ac_pred = get_bits1(gb);", "VAR_4 = 0;", "} else if (VAR_8) {", "if (s->mb_intra)\ns->ac_pred = get_bits1(gb);", "VAR_4 = get_vlc2(&VAR_0->s.gb, VAR_0->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);", "GET_MQUANT();", "} else {", "VAR_6 = VAR_0->pq;", "VAR_4 = 0;", "}", "s->current_picture.qscale_table[VAR_3] = VAR_6;", "if (!VAR_0->ttmbf && !s->mb_intra && VAR_8)\nVAR_7 = get_vlc2(gb, ff_vc1_ttmb_vlc[VAR_0->tt_index].table,\nVC1_TTMB_VLC_BITS, 2);", "if (!s->mb_intra) vc1_mc_1mv(VAR_0, 0);", "VAR_16 = 0;", "for (VAR_1 = 0; VAR_1 < 6; VAR_1++) {", "s->dc_val[0][s->block_index[VAR_1]] = 0;", "VAR_16 += VAR_1 >> 2;", "VAR_13 = ((VAR_4 >> (5 - VAR_1)) & 1);", "VAR_17 = (VAR_1 & 4) ? 0 : ((VAR_1 & 1) * 8 + (VAR_1 & 2) * 4 * s->linesize);", "VAR_0->mb_type[0][s->block_index[VAR_1]] = s->mb_intra;", "if (s->mb_intra) {", "VAR_0->a_avail = VAR_0->c_avail = 0;", "if (VAR_1 == 2 || VAR_1 == 3 || !s->first_slice_line)\nVAR_0->a_avail = VAR_0->mb_type[0][s->block_index[VAR_1] - s->block_wrap[VAR_1]];", "if (VAR_1 == 1 || VAR_1 == 3 || s->mb_x)\nVAR_0->c_avail = VAR_0->mb_type[0][s->block_index[VAR_1] - 1];", "vc1_decode_intra_block(VAR_0, s->block[VAR_1], VAR_1, VAR_13, VAR_6,\n(VAR_1 & 4) ? VAR_0->codingset2 : VAR_0->codingset);", "if ((VAR_1>3) && (s->flags & CODEC_FLAG_GRAY))\ncontinue;", "VAR_0->vc1dsp.vc1_inv_trans_8x8(s->block[VAR_1]);", "if (VAR_0->rangeredfrm)\nfor (VAR_2 = 0; VAR_2 < 64; VAR_2++)", "s->block[VAR_1][VAR_2] <<= 1;", "s->idsp.put_signed_pixels_clamped(s->block[VAR_1],\ns->dest[VAR_16] + VAR_17,\nVAR_1 & 4 ? s->uvlinesize\n: s->linesize);", "if (VAR_0->pq >= 9 && VAR_0->overlap) {", "if (VAR_0->c_avail)\nVAR_0->vc1dsp.vc1_h_overlap(s->dest[VAR_16] + VAR_17, VAR_1 & 4 ? s->uvlinesize : s->linesize);", "if (VAR_0->a_avail)\nVAR_0->vc1dsp.vc1_v_overlap(s->dest[VAR_16] + VAR_17, VAR_1 & 4 ? s->uvlinesize : s->linesize);", "}", "VAR_20 |= 0xF << (VAR_1 << 2);", "VAR_23 |= 1 << VAR_1;", "} else if (VAR_13) {", "VAR_21 = vc1_decode_p_block(VAR_0, s->block[VAR_1], VAR_1, VAR_6, VAR_7, VAR_15,\ns->dest[VAR_16] + VAR_17, (VAR_1 & 4) ? s->uvlinesize : s->linesize,\n(VAR_1 & 4) && (s->flags & CODEC_FLAG_GRAY), &VAR_22);", "VAR_20 |= VAR_21 << (VAR_1 << 2);", "if (!VAR_0->ttmbf && VAR_7 < 8)\nVAR_7 = -1;", "VAR_15 = 0;", "}", "}", "} else {", "s->mb_intra = 0;", "for (VAR_1 = 0; VAR_1 < 6; VAR_1++) {", "VAR_0->mb_type[0][s->block_index[VAR_1]] = 0;", "s->dc_val[0][s->block_index[VAR_1]] = 0;", "}", "s->current_picture.mb_type[VAR_3] = MB_TYPE_SKIP;", "s->current_picture.qscale_table[VAR_3] = 0;", "vc1_pred_mv(VAR_0, 0, 0, 0, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], 0, 0);", "vc1_mc_1mv(VAR_0, 0);", "}", "} else {", "if (!VAR_18 ) {", "int VAR_24 = 0, VAR_25 = 0;", "int VAR_26[6], VAR_27[6];", "VAR_4 = get_vlc2(&VAR_0->s.gb, VAR_0->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);", "for (VAR_1 = 0; VAR_1 < 6; VAR_1++) {", "VAR_13 = ((VAR_4 >> (5 - VAR_1)) & 1);", "s->dc_val[0][s->block_index[VAR_1]] = 0;", "s->mb_intra = 0;", "if (VAR_1 < 4) {", "VAR_9 = VAR_10 = 0;", "s->mb_intra = 0;", "VAR_8 = 0;", "if (VAR_13) {", "GET_MVDATA(VAR_9, VAR_10);", "}", "vc1_pred_mv(VAR_0, VAR_1, VAR_9, VAR_10, 0, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], 0, 0);", "if (!s->mb_intra)\nvc1_mc_4mv_luma(VAR_0, VAR_1, 0, 0);", "VAR_24 += s->mb_intra;", "VAR_26[VAR_1] = s->mb_intra;", "VAR_27[VAR_1] = VAR_8;", "}", "if (VAR_1 & 4) {", "VAR_26[VAR_1] = (VAR_24 >= 3);", "VAR_27[VAR_1] = VAR_13;", "}", "if (VAR_1 == 4)\nvc1_mc_4mv_chroma(VAR_0, 0);", "VAR_0->mb_type[0][s->block_index[VAR_1]] = VAR_26[VAR_1];", "if (!VAR_25)\nVAR_25 = !VAR_26[VAR_1] && VAR_27[VAR_1];", "}", "VAR_16 = 0;", "if (!VAR_24 && !VAR_25)\ngoto end;", "GET_MQUANT();", "s->current_picture.qscale_table[VAR_3] = VAR_6;", "{", "int VAR_28 = 0;", "for (VAR_1 = 0; VAR_1 < 6; VAR_1++)", "if (VAR_26[VAR_1]) {", "if (((!s->first_slice_line || (VAR_1 == 2 || VAR_1 == 3)) && VAR_0->mb_type[0][s->block_index[VAR_1] - s->block_wrap[VAR_1]])\n|| ((s->mb_x || (VAR_1 == 1 || VAR_1 == 3)) && VAR_0->mb_type[0][s->block_index[VAR_1] - 1])) {", "VAR_28 = 1;", "break;", "}", "}", "if (VAR_28)\ns->ac_pred = get_bits1(gb);", "else\ns->ac_pred = 0;", "}", "if (!VAR_0->ttmbf && VAR_25)\nVAR_7 = get_vlc2(gb, ff_vc1_ttmb_vlc[VAR_0->tt_index].table, VC1_TTMB_VLC_BITS, 2);", "for (VAR_1 = 0; VAR_1 < 6; VAR_1++) {", "VAR_16 += VAR_1 >> 2;", "VAR_17 = (VAR_1 & 4) ? 0 : ((VAR_1 & 1) * 8 + (VAR_1 & 2) * 4 * s->linesize);", "s->mb_intra = VAR_26[VAR_1];", "if (VAR_26[VAR_1]) {", "VAR_0->a_avail = VAR_0->c_avail = 0;", "if (VAR_1 == 2 || VAR_1 == 3 || !s->first_slice_line)\nVAR_0->a_avail = VAR_0->mb_type[0][s->block_index[VAR_1] - s->block_wrap[VAR_1]];", "if (VAR_1 == 1 || VAR_1 == 3 || s->mb_x)\nVAR_0->c_avail = VAR_0->mb_type[0][s->block_index[VAR_1] - 1];", "vc1_decode_intra_block(VAR_0, s->block[VAR_1], VAR_1, VAR_27[VAR_1], VAR_6,\n(VAR_1 & 4) ? VAR_0->codingset2 : VAR_0->codingset);", "if ((VAR_1>3) && (s->flags & CODEC_FLAG_GRAY))\ncontinue;", "VAR_0->vc1dsp.vc1_inv_trans_8x8(s->block[VAR_1]);", "if (VAR_0->rangeredfrm)\nfor (VAR_2 = 0; VAR_2 < 64; VAR_2++)", "s->block[VAR_1][VAR_2] <<= 1;", "s->idsp.put_signed_pixels_clamped(s->block[VAR_1],\ns->dest[VAR_16] + VAR_17,\n(VAR_1 & 4) ? s->uvlinesize\n: s->linesize);", "if (VAR_0->pq >= 9 && VAR_0->overlap) {", "if (VAR_0->c_avail)\nVAR_0->vc1dsp.vc1_h_overlap(s->dest[VAR_16] + VAR_17, VAR_1 & 4 ? s->uvlinesize : s->linesize);", "if (VAR_0->a_avail)\nVAR_0->vc1dsp.vc1_v_overlap(s->dest[VAR_16] + VAR_17, VAR_1 & 4 ? s->uvlinesize : s->linesize);", "}", "VAR_20 |= 0xF << (VAR_1 << 2);", "VAR_23 |= 1 << VAR_1;", "} else if (VAR_27[VAR_1]) {", "VAR_21 = vc1_decode_p_block(VAR_0, s->block[VAR_1], VAR_1, VAR_6, VAR_7,\nVAR_15, s->dest[VAR_16] + VAR_17,\n(VAR_1 & 4) ? s->uvlinesize : s->linesize,\n(VAR_1 & 4) && (s->flags & CODEC_FLAG_GRAY),\n&VAR_22);", "VAR_20 |= VAR_21 << (VAR_1 << 2);", "if (!VAR_0->ttmbf && VAR_7 < 8)\nVAR_7 = -1;", "VAR_15 = 0;", "}", "}", "} else { MB", "s->mb_intra = 0;", "s->current_picture.qscale_table[VAR_3] = 0;", "for (VAR_1 = 0; VAR_1 < 6; VAR_1++) {", "VAR_0->mb_type[0][s->block_index[VAR_1]] = 0;", "s->dc_val[0][s->block_index[VAR_1]] = 0;", "}", "for (VAR_1 = 0; VAR_1 < 4; VAR_1++) {", "vc1_pred_mv(VAR_0, VAR_1, 0, 0, 0, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], 0, 0);", "vc1_mc_4mv_luma(VAR_0, VAR_1, 0, 0);", "}", "vc1_mc_4mv_chroma(VAR_0, 0);", "s->current_picture.qscale_table[VAR_3] = 0;", "}", "}", "end:\nVAR_0->VAR_4[s->mb_x] = VAR_20;", "VAR_0->ttblk[s->mb_x] = VAR_22;", "VAR_0->VAR_26[s->mb_x] = VAR_23;", "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, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 43, 45 ], [ 47, 49 ], [ 51, 53 ], [ 55, 57 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115, 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 141 ], [ 143, 145 ], [ 147, 149 ], [ 153, 155 ], [ 157, 159 ], [ 161 ], [ 163, 165 ], [ 167 ], [ 169, 171, 173, 175 ], [ 177 ], [ 179, 181 ], [ 183, 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195, 197, 199 ], [ 201 ], [ 203, 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271, 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291, 293 ], [ 295 ], [ 297, 299 ], [ 301 ], [ 305 ], [ 307, 309 ], [ 311 ], [ 313 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325, 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337, 339 ], [ 341, 343 ], [ 345 ], [ 347, 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 363 ], [ 365, 367 ], [ 369, 371 ], [ 375, 377 ], [ 379, 381 ], [ 383 ], [ 385, 387 ], [ 389 ], [ 391, 393, 395, 397 ], [ 399 ], [ 401, 403 ], [ 405, 407 ], [ 409 ], [ 411 ], [ 413 ], [ 415 ], [ 417, 419, 421, 423, 425 ], [ 427 ], [ 429, 431 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443 ], [ 445 ], [ 447 ], [ 449 ], [ 451 ], [ 453 ], [ 455 ], [ 457 ], [ 459 ], [ 461 ], [ 463 ], [ 465 ], [ 467 ], [ 469, 471 ], [ 473 ], [ 475 ], [ 479 ], [ 481 ] ]
2,135
int qdev_build_hotpluggable_device_list(Object *obj, void *opaque) { GSList **list = opaque; DeviceState *dev = DEVICE(obj); if (dev->realized && object_property_get_bool(obj, "hotpluggable", NULL)) { *list = g_slist_append(*list, dev); } object_child_foreach(obj, qdev_build_hotpluggable_device_list, opaque); return 0; }
true
qemu
4cae4d5acaea23f3def84c8dc67ef5106323e5cb
int qdev_build_hotpluggable_device_list(Object *obj, void *opaque) { GSList **list = opaque; DeviceState *dev = DEVICE(obj); if (dev->realized && object_property_get_bool(obj, "hotpluggable", NULL)) { *list = g_slist_append(*list, dev); } object_child_foreach(obj, qdev_build_hotpluggable_device_list, opaque); return 0; }
{ "code": [ "int qdev_build_hotpluggable_device_list(Object *obj, void *opaque)", " object_child_foreach(obj, qdev_build_hotpluggable_device_list, opaque);" ], "line_no": [ 1, 19 ] }
int FUNC_0(Object *VAR_0, void *VAR_1) { GSList **list = VAR_1; DeviceState *dev = DEVICE(VAR_0); if (dev->realized && object_property_get_bool(VAR_0, "hotpluggable", NULL)) { *list = g_slist_append(*list, dev); } object_child_foreach(VAR_0, FUNC_0, VAR_1); return 0; }
[ "int FUNC_0(Object *VAR_0, void *VAR_1)\n{", "GSList **list = VAR_1;", "DeviceState *dev = DEVICE(VAR_0);", "if (dev->realized && object_property_get_bool(VAR_0, \"hotpluggable\", NULL)) {", "*list = g_slist_append(*list, dev);", "}", "object_child_foreach(VAR_0, FUNC_0, VAR_1);", "return 0;", "}" ]
[ 1, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ] ]
2,136
static void test_qemu_strtoul_max(void) { const char *str = g_strdup_printf("%lu", ULONG_MAX); char f = 'X'; const char *endptr = &f; unsigned long res = 999; int err; err = qemu_strtoul(str, &endptr, 0, &res); g_assert_cmpint(err, ==, 0); g_assert_cmpint(res, ==, ULONG_MAX); g_assert(endptr == str + strlen(str)); }
true
qemu
d6f723b513a0c3c4e58343b7c52a2f9850861fa0
static void test_qemu_strtoul_max(void) { const char *str = g_strdup_printf("%lu", ULONG_MAX); char f = 'X'; const char *endptr = &f; unsigned long res = 999; int err; err = qemu_strtoul(str, &endptr, 0, &res); g_assert_cmpint(err, ==, 0); g_assert_cmpint(res, ==, ULONG_MAX); g_assert(endptr == str + strlen(str)); }
{ "code": [ " const char *str = g_strdup_printf(\"%lu\", ULONG_MAX);", " const char *str = g_strdup_printf(\"%lu\", ULONG_MAX);" ], "line_no": [ 5, 5 ] }
static void FUNC_0(void) { const char *VAR_0 = g_strdup_printf("%lu", ULONG_MAX); char VAR_1 = 'X'; const char *VAR_2 = &VAR_1; unsigned long VAR_3 = 999; int VAR_4; VAR_4 = qemu_strtoul(VAR_0, &VAR_2, 0, &VAR_3); g_assert_cmpint(VAR_4, ==, 0); g_assert_cmpint(VAR_3, ==, ULONG_MAX); g_assert(VAR_2 == VAR_0 + strlen(VAR_0)); }
[ "static void FUNC_0(void)\n{", "const char *VAR_0 = g_strdup_printf(\"%lu\", ULONG_MAX);", "char VAR_1 = 'X';", "const char *VAR_2 = &VAR_1;", "unsigned long VAR_3 = 999;", "int VAR_4;", "VAR_4 = qemu_strtoul(VAR_0, &VAR_2, 0, &VAR_3);", "g_assert_cmpint(VAR_4, ==, 0);", "g_assert_cmpint(VAR_3, ==, ULONG_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 ] ]
2,137
static int usb_msd_initfn(USBDevice *dev) { MSDState *s = DO_UPCAST(MSDState, dev, dev); if (!s->conf.dinfo || !s->conf.dinfo->bdrv) { error_report("usb-msd: drive property not set"); s->dev.speed = USB_SPEED_FULL; scsi_bus_new(&s->bus, &s->dev.qdev, 0, 1, usb_msd_command_complete); s->scsi_dev = scsi_bus_legacy_add_drive(&s->bus, s->conf.dinfo, 0); s->bus.qbus.allow_hotplug = 0; usb_msd_handle_reset(dev); if (bdrv_key_required(s->conf.dinfo->bdrv)) { if (cur_mon) { monitor_read_bdrv_key_start(cur_mon, s->conf.dinfo->bdrv, usb_msd_password_cb, s); s->dev.auto_attach = 0; } else { autostart = 0; return 0;
true
qemu
fa66b909f382619da15f8c7e323145adfa94fdac
static int usb_msd_initfn(USBDevice *dev) { MSDState *s = DO_UPCAST(MSDState, dev, dev); if (!s->conf.dinfo || !s->conf.dinfo->bdrv) { error_report("usb-msd: drive property not set"); s->dev.speed = USB_SPEED_FULL; scsi_bus_new(&s->bus, &s->dev.qdev, 0, 1, usb_msd_command_complete); s->scsi_dev = scsi_bus_legacy_add_drive(&s->bus, s->conf.dinfo, 0); s->bus.qbus.allow_hotplug = 0; usb_msd_handle_reset(dev); if (bdrv_key_required(s->conf.dinfo->bdrv)) { if (cur_mon) { monitor_read_bdrv_key_start(cur_mon, s->conf.dinfo->bdrv, usb_msd_password_cb, s); s->dev.auto_attach = 0; } else { autostart = 0; return 0;
{ "code": [ " return 0;" ], "line_no": [ 50 ] }
static int FUNC_0(USBDevice *VAR_0) { MSDState *s = DO_UPCAST(MSDState, VAR_0, VAR_0); if (!s->conf.dinfo || !s->conf.dinfo->bdrv) { error_report("usb-msd: drive property not set"); s->VAR_0.speed = USB_SPEED_FULL; scsi_bus_new(&s->bus, &s->VAR_0.qdev, 0, 1, usb_msd_command_complete); s->scsi_dev = scsi_bus_legacy_add_drive(&s->bus, s->conf.dinfo, 0); s->bus.qbus.allow_hotplug = 0; usb_msd_handle_reset(VAR_0); if (bdrv_key_required(s->conf.dinfo->bdrv)) { if (cur_mon) { monitor_read_bdrv_key_start(cur_mon, s->conf.dinfo->bdrv, usb_msd_password_cb, s); s->VAR_0.auto_attach = 0; } else { autostart = 0; return 0;
[ "static int FUNC_0(USBDevice *VAR_0)\n{", "MSDState *s = DO_UPCAST(MSDState, VAR_0, VAR_0);", "if (!s->conf.dinfo || !s->conf.dinfo->bdrv) {", "error_report(\"usb-msd: drive property not set\");", "s->VAR_0.speed = USB_SPEED_FULL;", "scsi_bus_new(&s->bus, &s->VAR_0.qdev, 0, 1, usb_msd_command_complete);", "s->scsi_dev = scsi_bus_legacy_add_drive(&s->bus, s->conf.dinfo, 0);", "s->bus.qbus.allow_hotplug = 0;", "usb_msd_handle_reset(VAR_0);", "if (bdrv_key_required(s->conf.dinfo->bdrv)) {", "if (cur_mon) {", "monitor_read_bdrv_key_start(cur_mon, s->conf.dinfo->bdrv,\nusb_msd_password_cb, s);", "s->VAR_0.auto_attach = 0;", "} else {", "autostart = 0;", "return 0;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 17 ], [ 19 ], [ 21 ], [ 26 ], [ 28 ], [ 32 ], [ 34 ], [ 36, 38 ], [ 40 ], [ 42 ], [ 44 ], [ 50 ] ]
2,138
static int net_slirp_init(NetClientState *peer, const char *model, const char *name, int restricted, bool ipv4, const char *vnetwork, const char *vhost, bool ipv6, const char *vprefix6, int vprefix6_len, const char *vhost6, const char *vhostname, const char *tftp_export, const char *bootfile, const char *vdhcp_start, const char *vnameserver, const char *vnameserver6, const char *smb_export, const char *vsmbserver, const char **dnssearch) { /* default settings according to historic slirp */ struct in_addr net = { .s_addr = htonl(0x0a000200) }; /* 10.0.2.0 */ struct in_addr mask = { .s_addr = htonl(0xffffff00) }; /* 255.255.255.0 */ struct in_addr host = { .s_addr = htonl(0x0a000202) }; /* 10.0.2.2 */ struct in_addr dhcp = { .s_addr = htonl(0x0a00020f) }; /* 10.0.2.15 */ struct in_addr dns = { .s_addr = htonl(0x0a000203) }; /* 10.0.2.3 */ struct in6_addr ip6_prefix; struct in6_addr ip6_host; struct in6_addr ip6_dns; #ifndef _WIN32 struct in_addr smbsrv = { .s_addr = 0 }; #endif NetClientState *nc; SlirpState *s; char buf[20]; uint32_t addr; int shift; char *end; struct slirp_config_str *config; if (!ipv4 && (vnetwork || vhost || vnameserver)) { return -1; } if (!ipv6 && (vprefix6 || vhost6 || vnameserver6)) { return -1; } if (!ipv4 && !ipv6) { /* It doesn't make sense to disable both */ return -1; } if (!tftp_export) { tftp_export = legacy_tftp_prefix; } if (!bootfile) { bootfile = legacy_bootp_filename; } if (vnetwork) { if (get_str_sep(buf, sizeof(buf), &vnetwork, '/') < 0) { if (!inet_aton(vnetwork, &net)) { return -1; } addr = ntohl(net.s_addr); if (!(addr & 0x80000000)) { mask.s_addr = htonl(0xff000000); /* class A */ } else if ((addr & 0xfff00000) == 0xac100000) { mask.s_addr = htonl(0xfff00000); /* priv. 172.16.0.0/12 */ } else if ((addr & 0xc0000000) == 0x80000000) { mask.s_addr = htonl(0xffff0000); /* class B */ } else if ((addr & 0xffff0000) == 0xc0a80000) { mask.s_addr = htonl(0xffff0000); /* priv. 192.168.0.0/16 */ } else if ((addr & 0xffff0000) == 0xc6120000) { mask.s_addr = htonl(0xfffe0000); /* tests 198.18.0.0/15 */ } else if ((addr & 0xe0000000) == 0xe0000000) { mask.s_addr = htonl(0xffffff00); /* class C */ } else { mask.s_addr = htonl(0xfffffff0); /* multicast/reserved */ } } else { if (!inet_aton(buf, &net)) { return -1; } shift = strtol(vnetwork, &end, 10); if (*end != '\0') { if (!inet_aton(vnetwork, &mask)) { return -1; } } else if (shift < 4 || shift > 32) { return -1; } else { mask.s_addr = htonl(0xffffffff << (32 - shift)); } } net.s_addr &= mask.s_addr; host.s_addr = net.s_addr | (htonl(0x0202) & ~mask.s_addr); dhcp.s_addr = net.s_addr | (htonl(0x020f) & ~mask.s_addr); dns.s_addr = net.s_addr | (htonl(0x0203) & ~mask.s_addr); } if (vhost && !inet_aton(vhost, &host)) { return -1; } if ((host.s_addr & mask.s_addr) != net.s_addr) { return -1; } if (vnameserver && !inet_aton(vnameserver, &dns)) { return -1; } if ((dns.s_addr & mask.s_addr) != net.s_addr || dns.s_addr == host.s_addr) { return -1; } if (vdhcp_start && !inet_aton(vdhcp_start, &dhcp)) { return -1; } if ((dhcp.s_addr & mask.s_addr) != net.s_addr || dhcp.s_addr == host.s_addr || dhcp.s_addr == dns.s_addr) { return -1; } #ifndef _WIN32 if (vsmbserver && !inet_aton(vsmbserver, &smbsrv)) { return -1; } #endif #if defined(_WIN32) && (_WIN32_WINNT < 0x0600) /* No inet_pton helper before Vista... */ if (vprefix6) { /* Unsupported */ return -1; } memset(&ip6_prefix, 0, sizeof(ip6_prefix)); ip6_prefix.s6_addr[0] = 0xfe; ip6_prefix.s6_addr[1] = 0xc0; #else if (!vprefix6) { vprefix6 = "fec0::"; } if (!inet_pton(AF_INET6, vprefix6, &ip6_prefix)) { return -1; } #endif if (!vprefix6_len) { vprefix6_len = 64; } if (vprefix6_len < 0 || vprefix6_len > 126) { return -1; } if (vhost6) { #if defined(_WIN32) && (_WIN32_WINNT < 0x0600) return -1; #else if (!inet_pton(AF_INET6, vhost6, &ip6_host)) { return -1; } if (!in6_equal_net(&ip6_prefix, &ip6_host, vprefix6_len)) { return -1; } #endif } else { ip6_host = ip6_prefix; ip6_host.s6_addr[15] |= 2; } if (vnameserver6) { #if defined(_WIN32) && (_WIN32_WINNT < 0x0600) return -1; #else if (!inet_pton(AF_INET6, vnameserver6, &ip6_dns)) { return -1; } if (!in6_equal_net(&ip6_prefix, &ip6_dns, vprefix6_len)) { return -1; } #endif } else { ip6_dns = ip6_prefix; ip6_dns.s6_addr[15] |= 3; } nc = qemu_new_net_client(&net_slirp_info, peer, model, name); snprintf(nc->info_str, sizeof(nc->info_str), "net=%s,restrict=%s", inet_ntoa(net), restricted ? "on" : "off"); s = DO_UPCAST(SlirpState, nc, nc); s->slirp = slirp_init(restricted, ipv4, net, mask, host, ipv6, ip6_prefix, vprefix6_len, ip6_host, vhostname, tftp_export, bootfile, dhcp, dns, ip6_dns, dnssearch, s); QTAILQ_INSERT_TAIL(&slirp_stacks, s, entry); for (config = slirp_configs; config; config = config->next) { if (config->flags & SLIRP_CFG_HOSTFWD) { if (slirp_hostfwd(s, config->str, config->flags & SLIRP_CFG_LEGACY) < 0) goto error; } else { if (slirp_guestfwd(s, config->str, config->flags & SLIRP_CFG_LEGACY) < 0) goto error; } } #ifndef _WIN32 if (!smb_export) { smb_export = legacy_smb_export; } if (smb_export) { if (slirp_smb(s, smb_export, smbsrv) < 0) goto error; } #endif s->exit_notifier.notify = slirp_smb_exit; qemu_add_exit_notifier(&s->exit_notifier); return 0; error: qemu_del_net_client(nc); return -1; }
true
qemu
5c843af22604edecda10d4bb89d4eede9e1bd3d0
static int net_slirp_init(NetClientState *peer, const char *model, const char *name, int restricted, bool ipv4, const char *vnetwork, const char *vhost, bool ipv6, const char *vprefix6, int vprefix6_len, const char *vhost6, const char *vhostname, const char *tftp_export, const char *bootfile, const char *vdhcp_start, const char *vnameserver, const char *vnameserver6, const char *smb_export, const char *vsmbserver, const char **dnssearch) { struct in_addr net = { .s_addr = htonl(0x0a000200) }; struct in_addr mask = { .s_addr = htonl(0xffffff00) }; struct in_addr host = { .s_addr = htonl(0x0a000202) }; struct in_addr dhcp = { .s_addr = htonl(0x0a00020f) }; struct in_addr dns = { .s_addr = htonl(0x0a000203) }; struct in6_addr ip6_prefix; struct in6_addr ip6_host; struct in6_addr ip6_dns; #ifndef _WIN32 struct in_addr smbsrv = { .s_addr = 0 }; #endif NetClientState *nc; SlirpState *s; char buf[20]; uint32_t addr; int shift; char *end; struct slirp_config_str *config; if (!ipv4 && (vnetwork || vhost || vnameserver)) { return -1; } if (!ipv6 && (vprefix6 || vhost6 || vnameserver6)) { return -1; } if (!ipv4 && !ipv6) { return -1; } if (!tftp_export) { tftp_export = legacy_tftp_prefix; } if (!bootfile) { bootfile = legacy_bootp_filename; } if (vnetwork) { if (get_str_sep(buf, sizeof(buf), &vnetwork, '/') < 0) { if (!inet_aton(vnetwork, &net)) { return -1; } addr = ntohl(net.s_addr); if (!(addr & 0x80000000)) { mask.s_addr = htonl(0xff000000); } else if ((addr & 0xfff00000) == 0xac100000) { mask.s_addr = htonl(0xfff00000); } else if ((addr & 0xc0000000) == 0x80000000) { mask.s_addr = htonl(0xffff0000); } else if ((addr & 0xffff0000) == 0xc0a80000) { mask.s_addr = htonl(0xffff0000); } else if ((addr & 0xffff0000) == 0xc6120000) { mask.s_addr = htonl(0xfffe0000); } else if ((addr & 0xe0000000) == 0xe0000000) { mask.s_addr = htonl(0xffffff00); } else { mask.s_addr = htonl(0xfffffff0); } } else { if (!inet_aton(buf, &net)) { return -1; } shift = strtol(vnetwork, &end, 10); if (*end != '\0') { if (!inet_aton(vnetwork, &mask)) { return -1; } } else if (shift < 4 || shift > 32) { return -1; } else { mask.s_addr = htonl(0xffffffff << (32 - shift)); } } net.s_addr &= mask.s_addr; host.s_addr = net.s_addr | (htonl(0x0202) & ~mask.s_addr); dhcp.s_addr = net.s_addr | (htonl(0x020f) & ~mask.s_addr); dns.s_addr = net.s_addr | (htonl(0x0203) & ~mask.s_addr); } if (vhost && !inet_aton(vhost, &host)) { return -1; } if ((host.s_addr & mask.s_addr) != net.s_addr) { return -1; } if (vnameserver && !inet_aton(vnameserver, &dns)) { return -1; } if ((dns.s_addr & mask.s_addr) != net.s_addr || dns.s_addr == host.s_addr) { return -1; } if (vdhcp_start && !inet_aton(vdhcp_start, &dhcp)) { return -1; } if ((dhcp.s_addr & mask.s_addr) != net.s_addr || dhcp.s_addr == host.s_addr || dhcp.s_addr == dns.s_addr) { return -1; } #ifndef _WIN32 if (vsmbserver && !inet_aton(vsmbserver, &smbsrv)) { return -1; } #endif #if defined(_WIN32) && (_WIN32_WINNT < 0x0600) if (vprefix6) { return -1; } memset(&ip6_prefix, 0, sizeof(ip6_prefix)); ip6_prefix.s6_addr[0] = 0xfe; ip6_prefix.s6_addr[1] = 0xc0; #else if (!vprefix6) { vprefix6 = "fec0::"; } if (!inet_pton(AF_INET6, vprefix6, &ip6_prefix)) { return -1; } #endif if (!vprefix6_len) { vprefix6_len = 64; } if (vprefix6_len < 0 || vprefix6_len > 126) { return -1; } if (vhost6) { #if defined(_WIN32) && (_WIN32_WINNT < 0x0600) return -1; #else if (!inet_pton(AF_INET6, vhost6, &ip6_host)) { return -1; } if (!in6_equal_net(&ip6_prefix, &ip6_host, vprefix6_len)) { return -1; } #endif } else { ip6_host = ip6_prefix; ip6_host.s6_addr[15] |= 2; } if (vnameserver6) { #if defined(_WIN32) && (_WIN32_WINNT < 0x0600) return -1; #else if (!inet_pton(AF_INET6, vnameserver6, &ip6_dns)) { return -1; } if (!in6_equal_net(&ip6_prefix, &ip6_dns, vprefix6_len)) { return -1; } #endif } else { ip6_dns = ip6_prefix; ip6_dns.s6_addr[15] |= 3; } nc = qemu_new_net_client(&net_slirp_info, peer, model, name); snprintf(nc->info_str, sizeof(nc->info_str), "net=%s,restrict=%s", inet_ntoa(net), restricted ? "on" : "off"); s = DO_UPCAST(SlirpState, nc, nc); s->slirp = slirp_init(restricted, ipv4, net, mask, host, ipv6, ip6_prefix, vprefix6_len, ip6_host, vhostname, tftp_export, bootfile, dhcp, dns, ip6_dns, dnssearch, s); QTAILQ_INSERT_TAIL(&slirp_stacks, s, entry); for (config = slirp_configs; config; config = config->next) { if (config->flags & SLIRP_CFG_HOSTFWD) { if (slirp_hostfwd(s, config->str, config->flags & SLIRP_CFG_LEGACY) < 0) goto error; } else { if (slirp_guestfwd(s, config->str, config->flags & SLIRP_CFG_LEGACY) < 0) goto error; } } #ifndef _WIN32 if (!smb_export) { smb_export = legacy_smb_export; } if (smb_export) { if (slirp_smb(s, smb_export, smbsrv) < 0) goto error; } #endif s->exit_notifier.notify = slirp_smb_exit; qemu_add_exit_notifier(&s->exit_notifier); return 0; error: qemu_del_net_client(nc); return -1; }
{ "code": [ " const char **dnssearch)", " if ((dns.s_addr & mask.s_addr) != net.s_addr ||", " dns.s_addr == host.s_addr) {", " if ((dhcp.s_addr & mask.s_addr) != net.s_addr ||", " dhcp.s_addr == host.s_addr || dhcp.s_addr == dns.s_addr) {", " config->flags & SLIRP_CFG_LEGACY) < 0)", " config->flags & SLIRP_CFG_LEGACY) < 0)", " if (slirp_smb(s, smb_export, smbsrv) < 0)" ], "line_no": [ 19, 207, 209, 223, 225, 395, 403, 421 ] }
static int FUNC_0(NetClientState *VAR_0, const char *VAR_1, const char *VAR_2, int VAR_3, bool VAR_4, const char *VAR_5, const char *VAR_6, bool VAR_7, const char *VAR_8, int VAR_9, const char *VAR_10, const char *VAR_11, const char *VAR_12, const char *VAR_13, const char *VAR_14, const char *VAR_15, const char *VAR_16, const char *VAR_17, const char *VAR_18, const char **VAR_19) { struct in_addr VAR_20 = { .s_addr = htonl(0x0a000200) }; struct in_addr VAR_21 = { .s_addr = htonl(0xffffff00) }; struct in_addr VAR_22 = { .s_addr = htonl(0x0a000202) }; struct in_addr VAR_23 = { .s_addr = htonl(0x0a00020f) }; struct in_addr VAR_24 = { .s_addr = htonl(0x0a000203) }; struct in6_addr VAR_25; struct in6_addr VAR_26; struct in6_addr VAR_27; #ifndef _WIN32 struct in_addr VAR_28 = { .s_addr = 0 }; #endif NetClientState *nc; SlirpState *s; char VAR_29[20]; uint32_t addr; int VAR_30; char *VAR_31; struct slirp_config_str *VAR_32; if (!VAR_4 && (VAR_5 || VAR_6 || VAR_15)) { return -1; } if (!VAR_7 && (VAR_8 || VAR_10 || VAR_16)) { return -1; } if (!VAR_4 && !VAR_7) { return -1; } if (!VAR_12) { VAR_12 = legacy_tftp_prefix; } if (!VAR_13) { VAR_13 = legacy_bootp_filename; } if (VAR_5) { if (get_str_sep(VAR_29, sizeof(VAR_29), &VAR_5, '/') < 0) { if (!inet_aton(VAR_5, &VAR_20)) { return -1; } addr = ntohl(VAR_20.s_addr); if (!(addr & 0x80000000)) { VAR_21.s_addr = htonl(0xff000000); } else if ((addr & 0xfff00000) == 0xac100000) { VAR_21.s_addr = htonl(0xfff00000); } else if ((addr & 0xc0000000) == 0x80000000) { VAR_21.s_addr = htonl(0xffff0000); } else if ((addr & 0xffff0000) == 0xc0a80000) { VAR_21.s_addr = htonl(0xffff0000); } else if ((addr & 0xffff0000) == 0xc6120000) { VAR_21.s_addr = htonl(0xfffe0000); } else if ((addr & 0xe0000000) == 0xe0000000) { VAR_21.s_addr = htonl(0xffffff00); } else { VAR_21.s_addr = htonl(0xfffffff0); } } else { if (!inet_aton(VAR_29, &VAR_20)) { return -1; } VAR_30 = strtol(VAR_5, &VAR_31, 10); if (*VAR_31 != '\0') { if (!inet_aton(VAR_5, &VAR_21)) { return -1; } } else if (VAR_30 < 4 || VAR_30 > 32) { return -1; } else { VAR_21.s_addr = htonl(0xffffffff << (32 - VAR_30)); } } VAR_20.s_addr &= VAR_21.s_addr; VAR_22.s_addr = VAR_20.s_addr | (htonl(0x0202) & ~VAR_21.s_addr); VAR_23.s_addr = VAR_20.s_addr | (htonl(0x020f) & ~VAR_21.s_addr); VAR_24.s_addr = VAR_20.s_addr | (htonl(0x0203) & ~VAR_21.s_addr); } if (VAR_6 && !inet_aton(VAR_6, &VAR_22)) { return -1; } if ((VAR_22.s_addr & VAR_21.s_addr) != VAR_20.s_addr) { return -1; } if (VAR_15 && !inet_aton(VAR_15, &VAR_24)) { return -1; } if ((VAR_24.s_addr & VAR_21.s_addr) != VAR_20.s_addr || VAR_24.s_addr == VAR_22.s_addr) { return -1; } if (VAR_14 && !inet_aton(VAR_14, &VAR_23)) { return -1; } if ((VAR_23.s_addr & VAR_21.s_addr) != VAR_20.s_addr || VAR_23.s_addr == VAR_22.s_addr || VAR_23.s_addr == VAR_24.s_addr) { return -1; } #ifndef _WIN32 if (VAR_18 && !inet_aton(VAR_18, &VAR_28)) { return -1; } #endif #if defined(_WIN32) && (_WIN32_WINNT < 0x0600) if (VAR_8) { return -1; } memset(&VAR_25, 0, sizeof(VAR_25)); VAR_25.s6_addr[0] = 0xfe; VAR_25.s6_addr[1] = 0xc0; #else if (!VAR_8) { VAR_8 = "fec0::"; } if (!inet_pton(AF_INET6, VAR_8, &VAR_25)) { return -1; } #endif if (!VAR_9) { VAR_9 = 64; } if (VAR_9 < 0 || VAR_9 > 126) { return -1; } if (VAR_10) { #if defined(_WIN32) && (_WIN32_WINNT < 0x0600) return -1; #else if (!inet_pton(AF_INET6, VAR_10, &VAR_26)) { return -1; } if (!in6_equal_net(&VAR_25, &VAR_26, VAR_9)) { return -1; } #endif } else { VAR_26 = VAR_25; VAR_26.s6_addr[15] |= 2; } if (VAR_16) { #if defined(_WIN32) && (_WIN32_WINNT < 0x0600) return -1; #else if (!inet_pton(AF_INET6, VAR_16, &VAR_27)) { return -1; } if (!in6_equal_net(&VAR_25, &VAR_27, VAR_9)) { return -1; } #endif } else { VAR_27 = VAR_25; VAR_27.s6_addr[15] |= 3; } nc = qemu_new_net_client(&net_slirp_info, VAR_0, VAR_1, VAR_2); snprintf(nc->info_str, sizeof(nc->info_str), "VAR_20=%s,restrict=%s", inet_ntoa(VAR_20), VAR_3 ? "on" : "off"); s = DO_UPCAST(SlirpState, nc, nc); s->slirp = slirp_init(VAR_3, VAR_4, VAR_20, VAR_21, VAR_22, VAR_7, VAR_25, VAR_9, VAR_26, VAR_11, VAR_12, VAR_13, VAR_23, VAR_24, VAR_27, VAR_19, s); QTAILQ_INSERT_TAIL(&slirp_stacks, s, entry); for (VAR_32 = slirp_configs; VAR_32; VAR_32 = VAR_32->next) { if (VAR_32->flags & SLIRP_CFG_HOSTFWD) { if (slirp_hostfwd(s, VAR_32->str, VAR_32->flags & SLIRP_CFG_LEGACY) < 0) goto error; } else { if (slirp_guestfwd(s, VAR_32->str, VAR_32->flags & SLIRP_CFG_LEGACY) < 0) goto error; } } #ifndef _WIN32 if (!VAR_17) { VAR_17 = legacy_smb_export; } if (VAR_17) { if (slirp_smb(s, VAR_17, VAR_28) < 0) goto error; } #endif s->exit_notifier.notify = slirp_smb_exit; qemu_add_exit_notifier(&s->exit_notifier); return 0; error: qemu_del_net_client(nc); return -1; }
[ "static int FUNC_0(NetClientState *VAR_0, const char *VAR_1,\nconst char *VAR_2, int VAR_3,\nbool VAR_4, const char *VAR_5, const char *VAR_6,\nbool VAR_7, const char *VAR_8, int VAR_9,\nconst char *VAR_10,\nconst char *VAR_11, const char *VAR_12,\nconst char *VAR_13, const char *VAR_14,\nconst char *VAR_15, const char *VAR_16,\nconst char *VAR_17, const char *VAR_18,\nconst char **VAR_19)\n{", "struct in_addr VAR_20 = { .s_addr = htonl(0x0a000200) };", "struct in_addr VAR_21 = { .s_addr = htonl(0xffffff00) };", "struct in_addr VAR_22 = { .s_addr = htonl(0x0a000202) };", "struct in_addr VAR_23 = { .s_addr = htonl(0x0a00020f) };", "struct in_addr VAR_24 = { .s_addr = htonl(0x0a000203) };", "struct in6_addr VAR_25;", "struct in6_addr VAR_26;", "struct in6_addr VAR_27;", "#ifndef _WIN32\nstruct in_addr VAR_28 = { .s_addr = 0 };", "#endif\nNetClientState *nc;", "SlirpState *s;", "char VAR_29[20];", "uint32_t addr;", "int VAR_30;", "char *VAR_31;", "struct slirp_config_str *VAR_32;", "if (!VAR_4 && (VAR_5 || VAR_6 || VAR_15)) {", "return -1;", "}", "if (!VAR_7 && (VAR_8 || VAR_10 || VAR_16)) {", "return -1;", "}", "if (!VAR_4 && !VAR_7) {", "return -1;", "}", "if (!VAR_12) {", "VAR_12 = legacy_tftp_prefix;", "}", "if (!VAR_13) {", "VAR_13 = legacy_bootp_filename;", "}", "if (VAR_5) {", "if (get_str_sep(VAR_29, sizeof(VAR_29), &VAR_5, '/') < 0) {", "if (!inet_aton(VAR_5, &VAR_20)) {", "return -1;", "}", "addr = ntohl(VAR_20.s_addr);", "if (!(addr & 0x80000000)) {", "VAR_21.s_addr = htonl(0xff000000);", "} else if ((addr & 0xfff00000) == 0xac100000) {", "VAR_21.s_addr = htonl(0xfff00000);", "} else if ((addr & 0xc0000000) == 0x80000000) {", "VAR_21.s_addr = htonl(0xffff0000);", "} else if ((addr & 0xffff0000) == 0xc0a80000) {", "VAR_21.s_addr = htonl(0xffff0000);", "} else if ((addr & 0xffff0000) == 0xc6120000) {", "VAR_21.s_addr = htonl(0xfffe0000);", "} else if ((addr & 0xe0000000) == 0xe0000000) {", "VAR_21.s_addr = htonl(0xffffff00);", "} else {", "VAR_21.s_addr = htonl(0xfffffff0);", "}", "} else {", "if (!inet_aton(VAR_29, &VAR_20)) {", "return -1;", "}", "VAR_30 = strtol(VAR_5, &VAR_31, 10);", "if (*VAR_31 != '\\0') {", "if (!inet_aton(VAR_5, &VAR_21)) {", "return -1;", "}", "} else if (VAR_30 < 4 || VAR_30 > 32) {", "return -1;", "} else {", "VAR_21.s_addr = htonl(0xffffffff << (32 - VAR_30));", "}", "}", "VAR_20.s_addr &= VAR_21.s_addr;", "VAR_22.s_addr = VAR_20.s_addr | (htonl(0x0202) & ~VAR_21.s_addr);", "VAR_23.s_addr = VAR_20.s_addr | (htonl(0x020f) & ~VAR_21.s_addr);", "VAR_24.s_addr = VAR_20.s_addr | (htonl(0x0203) & ~VAR_21.s_addr);", "}", "if (VAR_6 && !inet_aton(VAR_6, &VAR_22)) {", "return -1;", "}", "if ((VAR_22.s_addr & VAR_21.s_addr) != VAR_20.s_addr) {", "return -1;", "}", "if (VAR_15 && !inet_aton(VAR_15, &VAR_24)) {", "return -1;", "}", "if ((VAR_24.s_addr & VAR_21.s_addr) != VAR_20.s_addr ||\nVAR_24.s_addr == VAR_22.s_addr) {", "return -1;", "}", "if (VAR_14 && !inet_aton(VAR_14, &VAR_23)) {", "return -1;", "}", "if ((VAR_23.s_addr & VAR_21.s_addr) != VAR_20.s_addr ||\nVAR_23.s_addr == VAR_22.s_addr || VAR_23.s_addr == VAR_24.s_addr) {", "return -1;", "}", "#ifndef _WIN32\nif (VAR_18 && !inet_aton(VAR_18, &VAR_28)) {", "return -1;", "}", "#endif\n#if defined(_WIN32) && (_WIN32_WINNT < 0x0600)\nif (VAR_8) {", "return -1;", "}", "memset(&VAR_25, 0, sizeof(VAR_25));", "VAR_25.s6_addr[0] = 0xfe;", "VAR_25.s6_addr[1] = 0xc0;", "#else\nif (!VAR_8) {", "VAR_8 = \"fec0::\";", "}", "if (!inet_pton(AF_INET6, VAR_8, &VAR_25)) {", "return -1;", "}", "#endif\nif (!VAR_9) {", "VAR_9 = 64;", "}", "if (VAR_9 < 0 || VAR_9 > 126) {", "return -1;", "}", "if (VAR_10) {", "#if defined(_WIN32) && (_WIN32_WINNT < 0x0600)\nreturn -1;", "#else\nif (!inet_pton(AF_INET6, VAR_10, &VAR_26)) {", "return -1;", "}", "if (!in6_equal_net(&VAR_25, &VAR_26, VAR_9)) {", "return -1;", "}", "#endif\n} else {", "VAR_26 = VAR_25;", "VAR_26.s6_addr[15] |= 2;", "}", "if (VAR_16) {", "#if defined(_WIN32) && (_WIN32_WINNT < 0x0600)\nreturn -1;", "#else\nif (!inet_pton(AF_INET6, VAR_16, &VAR_27)) {", "return -1;", "}", "if (!in6_equal_net(&VAR_25, &VAR_27, VAR_9)) {", "return -1;", "}", "#endif\n} else {", "VAR_27 = VAR_25;", "VAR_27.s6_addr[15] |= 3;", "}", "nc = qemu_new_net_client(&net_slirp_info, VAR_0, VAR_1, VAR_2);", "snprintf(nc->info_str, sizeof(nc->info_str),\n\"VAR_20=%s,restrict=%s\", inet_ntoa(VAR_20),\nVAR_3 ? \"on\" : \"off\");", "s = DO_UPCAST(SlirpState, nc, nc);", "s->slirp = slirp_init(VAR_3, VAR_4, VAR_20, VAR_21, VAR_22,\nVAR_7, VAR_25, VAR_9, VAR_26,\nVAR_11, VAR_12, VAR_13, VAR_23,\nVAR_24, VAR_27, VAR_19, s);", "QTAILQ_INSERT_TAIL(&slirp_stacks, s, entry);", "for (VAR_32 = slirp_configs; VAR_32; VAR_32 = VAR_32->next) {", "if (VAR_32->flags & SLIRP_CFG_HOSTFWD) {", "if (slirp_hostfwd(s, VAR_32->str,\nVAR_32->flags & SLIRP_CFG_LEGACY) < 0)\ngoto error;", "} else {", "if (slirp_guestfwd(s, VAR_32->str,\nVAR_32->flags & SLIRP_CFG_LEGACY) < 0)\ngoto error;", "}", "}", "#ifndef _WIN32\nif (!VAR_17) {", "VAR_17 = legacy_smb_export;", "}", "if (VAR_17) {", "if (slirp_smb(s, VAR_17, VAR_28) < 0)\ngoto error;", "}", "#endif\ns->exit_notifier.notify = slirp_smb_exit;", "qemu_add_exit_notifier(&s->exit_notifier);", "return 0;", "error:\nqemu_del_net_client(nc);", "return -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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 201 ], [ 203 ], [ 205 ], [ 207, 209 ], [ 211 ], [ 213 ], [ 217 ], [ 219 ], [ 221 ], [ 223, 225 ], [ 227 ], [ 229 ], [ 233, 235 ], [ 237 ], [ 239 ], [ 241, 245, 249 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263, 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277, 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 295 ], [ 297, 299 ], [ 301, 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315, 317 ], [ 319 ], [ 321 ], [ 323 ], [ 327 ], [ 329, 331 ], [ 333, 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347, 349 ], [ 351 ], [ 353 ], [ 355 ], [ 361 ], [ 365, 367, 369 ], [ 373 ], [ 377, 379, 381, 383 ], [ 385 ], [ 389 ], [ 391 ], [ 393, 395, 397 ], [ 399 ], [ 401, 403, 405 ], [ 407 ], [ 409 ], [ 411, 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421, 423 ], [ 425 ], [ 427, 431 ], [ 433 ], [ 435 ], [ 439, 441 ], [ 443 ], [ 445 ] ]
2,139
size_t qemu_fd_getpagesize(int fd) { #ifdef CONFIG_LINUX struct statfs fs; int ret; if (fd != -1) { do { ret = fstatfs(fd, &fs); } while (ret != 0 && errno == EINTR); if (ret == 0 && fs.f_type == HUGETLBFS_MAGIC) { return fs.f_bsize; } } return getpagesize(); }
true
qemu
57d1f6d7ce23e79a8ebe4a57bd2363b269b4664b
size_t qemu_fd_getpagesize(int fd) { #ifdef CONFIG_LINUX struct statfs fs; int ret; if (fd != -1) { do { ret = fstatfs(fd, &fs); } while (ret != 0 && errno == EINTR); if (ret == 0 && fs.f_type == HUGETLBFS_MAGIC) { return fs.f_bsize; } } return getpagesize(); }
{ "code": [], "line_no": [] }
size_t FUNC_0(int fd) { #ifdef CONFIG_LINUX struct statfs fs; int ret; if (fd != -1) { do { ret = fstatfs(fd, &fs); } while (ret != 0 && errno == EINTR); if (ret == 0 && fs.f_type == HUGETLBFS_MAGIC) { return fs.f_bsize; } } return getpagesize(); }
[ "size_t FUNC_0(int fd)\n{", "#ifdef CONFIG_LINUX\nstruct statfs fs;", "int ret;", "if (fd != -1) {", "do {", "ret = fstatfs(fd, &fs);", "} while (ret != 0 && errno == EINTR);", "if (ret == 0 && fs.f_type == HUGETLBFS_MAGIC) {", "return fs.f_bsize;", "}", "}", "return getpagesize();", "}" ]
[ 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 ], [ 38 ], [ 40 ] ]
2,140
static int cpudef_setfield(const char *name, const char *str, void *opaque) { x86_def_t *def = opaque; int err = 0; if (!strcmp(name, "name")) { def->name = g_strdup(str); } else if (!strcmp(name, "model_id")) { strncpy(def->model_id, str, sizeof (def->model_id)); } else if (!strcmp(name, "level")) { setscalar(&def->level, str, &err) } else if (!strcmp(name, "vendor")) { cpyid(&str[0], &def->vendor1); cpyid(&str[4], &def->vendor2); cpyid(&str[8], &def->vendor3); } else if (!strcmp(name, "family")) { setscalar(&def->family, str, &err) } else if (!strcmp(name, "model")) { setscalar(&def->model, str, &err) } else if (!strcmp(name, "stepping")) { setscalar(&def->stepping, str, &err) } else if (!strcmp(name, "feature_edx")) { setfeatures(&def->features, str, feature_name, &err); } else if (!strcmp(name, "feature_ecx")) { setfeatures(&def->ext_features, str, ext_feature_name, &err); } else if (!strcmp(name, "extfeature_edx")) { setfeatures(&def->ext2_features, str, ext2_feature_name, &err); } else if (!strcmp(name, "extfeature_ecx")) { setfeatures(&def->ext3_features, str, ext3_feature_name, &err); } else if (!strcmp(name, "xlevel")) { setscalar(&def->xlevel, str, &err) } else { fprintf(stderr, "error: unknown option [%s = %s]\n", name, str); return (1); } if (err) { fprintf(stderr, "error: bad option value [%s = %s]\n", name, str); return (1); } return (0); }
true
qemu
99e1dec06f343cefecae9baeec0aae2f99f552d5
static int cpudef_setfield(const char *name, const char *str, void *opaque) { x86_def_t *def = opaque; int err = 0; if (!strcmp(name, "name")) { def->name = g_strdup(str); } else if (!strcmp(name, "model_id")) { strncpy(def->model_id, str, sizeof (def->model_id)); } else if (!strcmp(name, "level")) { setscalar(&def->level, str, &err) } else if (!strcmp(name, "vendor")) { cpyid(&str[0], &def->vendor1); cpyid(&str[4], &def->vendor2); cpyid(&str[8], &def->vendor3); } else if (!strcmp(name, "family")) { setscalar(&def->family, str, &err) } else if (!strcmp(name, "model")) { setscalar(&def->model, str, &err) } else if (!strcmp(name, "stepping")) { setscalar(&def->stepping, str, &err) } else if (!strcmp(name, "feature_edx")) { setfeatures(&def->features, str, feature_name, &err); } else if (!strcmp(name, "feature_ecx")) { setfeatures(&def->ext_features, str, ext_feature_name, &err); } else if (!strcmp(name, "extfeature_edx")) { setfeatures(&def->ext2_features, str, ext2_feature_name, &err); } else if (!strcmp(name, "extfeature_ecx")) { setfeatures(&def->ext3_features, str, ext3_feature_name, &err); } else if (!strcmp(name, "xlevel")) { setscalar(&def->xlevel, str, &err) } else { fprintf(stderr, "error: unknown option [%s = %s]\n", name, str); return (1); } if (err) { fprintf(stderr, "error: bad option value [%s = %s]\n", name, str); return (1); } return (0); }
{ "code": [], "line_no": [] }
static int FUNC_0(const char *VAR_0, const char *VAR_1, void *VAR_2) { x86_def_t *def = VAR_2; int VAR_3 = 0; if (!strcmp(VAR_0, "VAR_0")) { def->VAR_0 = g_strdup(VAR_1); } else if (!strcmp(VAR_0, "model_id")) { strncpy(def->model_id, VAR_1, sizeof (def->model_id)); } else if (!strcmp(VAR_0, "level")) { setscalar(&def->level, VAR_1, &VAR_3) } else if (!strcmp(VAR_0, "vendor")) { cpyid(&VAR_1[0], &def->vendor1); cpyid(&VAR_1[4], &def->vendor2); cpyid(&VAR_1[8], &def->vendor3); } else if (!strcmp(VAR_0, "family")) { setscalar(&def->family, VAR_1, &VAR_3) } else if (!strcmp(VAR_0, "model")) { setscalar(&def->model, VAR_1, &VAR_3) } else if (!strcmp(VAR_0, "stepping")) { setscalar(&def->stepping, VAR_1, &VAR_3) } else if (!strcmp(VAR_0, "feature_edx")) { setfeatures(&def->features, VAR_1, feature_name, &VAR_3); } else if (!strcmp(VAR_0, "feature_ecx")) { setfeatures(&def->ext_features, VAR_1, ext_feature_name, &VAR_3); } else if (!strcmp(VAR_0, "extfeature_edx")) { setfeatures(&def->ext2_features, VAR_1, ext2_feature_name, &VAR_3); } else if (!strcmp(VAR_0, "extfeature_ecx")) { setfeatures(&def->ext3_features, VAR_1, ext3_feature_name, &VAR_3); } else if (!strcmp(VAR_0, "xlevel")) { setscalar(&def->xlevel, VAR_1, &VAR_3) } else { fprintf(stderr, "error: unknown option [%s = %s]\n", VAR_0, VAR_1); return (1); } if (VAR_3) { fprintf(stderr, "error: bad option value [%s = %s]\n", VAR_0, VAR_1); return (1); } return (0); }
[ "static int FUNC_0(const char *VAR_0, const char *VAR_1, void *VAR_2)\n{", "x86_def_t *def = VAR_2;", "int VAR_3 = 0;", "if (!strcmp(VAR_0, \"VAR_0\")) {", "def->VAR_0 = g_strdup(VAR_1);", "} else if (!strcmp(VAR_0, \"model_id\")) {", "strncpy(def->model_id, VAR_1, sizeof (def->model_id));", "} else if (!strcmp(VAR_0, \"level\")) {", "setscalar(&def->level, VAR_1, &VAR_3)\n} else if (!strcmp(VAR_0, \"vendor\")) {", "cpyid(&VAR_1[0], &def->vendor1);", "cpyid(&VAR_1[4], &def->vendor2);", "cpyid(&VAR_1[8], &def->vendor3);", "} else if (!strcmp(VAR_0, \"family\")) {", "setscalar(&def->family, VAR_1, &VAR_3)\n} else if (!strcmp(VAR_0, \"model\")) {", "setscalar(&def->model, VAR_1, &VAR_3)\n} else if (!strcmp(VAR_0, \"stepping\")) {", "setscalar(&def->stepping, VAR_1, &VAR_3)\n} else if (!strcmp(VAR_0, \"feature_edx\")) {", "setfeatures(&def->features, VAR_1, feature_name, &VAR_3);", "} else if (!strcmp(VAR_0, \"feature_ecx\")) {", "setfeatures(&def->ext_features, VAR_1, ext_feature_name, &VAR_3);", "} else if (!strcmp(VAR_0, \"extfeature_edx\")) {", "setfeatures(&def->ext2_features, VAR_1, ext2_feature_name, &VAR_3);", "} else if (!strcmp(VAR_0, \"extfeature_ecx\")) {", "setfeatures(&def->ext3_features, VAR_1, ext3_feature_name, &VAR_3);", "} else if (!strcmp(VAR_0, \"xlevel\")) {", "setscalar(&def->xlevel, VAR_1, &VAR_3)\n} else {", "fprintf(stderr, \"error: unknown option [%s = %s]\\n\", VAR_0, VAR_1);", "return (1);", "}", "if (VAR_3) {", "fprintf(stderr, \"error: bad option value [%s = %s]\\n\", VAR_0, VAR_1);", "return (1);", "}", "return (0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 14 ], [ 16 ], [ 18 ], [ 20 ], [ 22, 24 ], [ 26 ], [ 28 ], [ 30 ], [ 32 ], [ 34, 36 ], [ 38, 40 ], [ 42, 44 ], [ 46 ], [ 48 ], [ 50 ], [ 52 ], [ 54 ], [ 56 ], [ 58 ], [ 60 ], [ 62, 64 ], [ 66 ], [ 68 ], [ 70 ], [ 72 ], [ 74 ], [ 76 ], [ 78 ], [ 80 ], [ 82 ] ]
2,141
static inline int onenand_prog_spare(OneNANDState *s, int sec, int secn, void *src) { int result = 0; if (secn > 0) { const uint8_t *sp = (const uint8_t *)src; uint8_t *dp = 0, *dpp = 0; if (s->blk_cur) { dp = g_malloc(512); if (!dp || blk_read(s->blk_cur, s->secs_cur + (sec >> 5), dp, 1) < 0) { result = 1; } else { dpp = dp + ((sec & 31) << 4); } } else { if (sec + secn > s->secs_cur) { result = 1; } else { dpp = s->current + (s->secs_cur << 9) + (sec << 4); } } if (!result) { uint32_t i; for (i = 0; i < (secn << 4); i++) { dpp[i] &= sp[i]; } if (s->blk_cur) { result = blk_write(s->blk_cur, s->secs_cur + (sec >> 5), dp, 1) < 0; } } g_free(dp); } return result; }
true
qemu
441692ddd8321d5e0f09b163e86410e578d87236
static inline int onenand_prog_spare(OneNANDState *s, int sec, int secn, void *src) { int result = 0; if (secn > 0) { const uint8_t *sp = (const uint8_t *)src; uint8_t *dp = 0, *dpp = 0; if (s->blk_cur) { dp = g_malloc(512); if (!dp || blk_read(s->blk_cur, s->secs_cur + (sec >> 5), dp, 1) < 0) { result = 1; } else { dpp = dp + ((sec & 31) << 4); } } else { if (sec + secn > s->secs_cur) { result = 1; } else { dpp = s->current + (s->secs_cur << 9) + (sec << 4); } } if (!result) { uint32_t i; for (i = 0; i < (secn << 4); i++) { dpp[i] &= sp[i]; } if (s->blk_cur) { result = blk_write(s->blk_cur, s->secs_cur + (sec >> 5), dp, 1) < 0; } } g_free(dp); } return result; }
{ "code": [ " || blk_read(s->blk_cur, s->secs_cur + (sec >> 5), dp, 1) < 0) {", " result = blk_write(s->blk_cur, s->secs_cur + (sec >> 5),", " dp, 1) < 0;" ], "line_no": [ 21, 57, 59 ] }
static inline int FUNC_0(OneNANDState *VAR_0, int VAR_1, int VAR_2, void *VAR_3) { int VAR_4 = 0; if (VAR_2 > 0) { const uint8_t *VAR_5 = (const uint8_t *)VAR_3; uint8_t *dp = 0, *dpp = 0; if (VAR_0->blk_cur) { dp = g_malloc(512); if (!dp || blk_read(VAR_0->blk_cur, VAR_0->secs_cur + (VAR_1 >> 5), dp, 1) < 0) { VAR_4 = 1; } else { dpp = dp + ((VAR_1 & 31) << 4); } } else { if (VAR_1 + VAR_2 > VAR_0->secs_cur) { VAR_4 = 1; } else { dpp = VAR_0->current + (VAR_0->secs_cur << 9) + (VAR_1 << 4); } } if (!VAR_4) { uint32_t i; for (i = 0; i < (VAR_2 << 4); i++) { dpp[i] &= VAR_5[i]; } if (VAR_0->blk_cur) { VAR_4 = blk_write(VAR_0->blk_cur, VAR_0->secs_cur + (VAR_1 >> 5), dp, 1) < 0; } } g_free(dp); } return VAR_4; }
[ "static inline int FUNC_0(OneNANDState *VAR_0, int VAR_1, int VAR_2,\nvoid *VAR_3)\n{", "int VAR_4 = 0;", "if (VAR_2 > 0) {", "const uint8_t *VAR_5 = (const uint8_t *)VAR_3;", "uint8_t *dp = 0, *dpp = 0;", "if (VAR_0->blk_cur) {", "dp = g_malloc(512);", "if (!dp\n|| blk_read(VAR_0->blk_cur, VAR_0->secs_cur + (VAR_1 >> 5), dp, 1) < 0) {", "VAR_4 = 1;", "} else {", "dpp = dp + ((VAR_1 & 31) << 4);", "}", "} else {", "if (VAR_1 + VAR_2 > VAR_0->secs_cur) {", "VAR_4 = 1;", "} else {", "dpp = VAR_0->current + (VAR_0->secs_cur << 9) + (VAR_1 << 4);", "}", "}", "if (!VAR_4) {", "uint32_t i;", "for (i = 0; i < (VAR_2 << 4); i++) {", "dpp[i] &= VAR_5[i];", "}", "if (VAR_0->blk_cur) {", "VAR_4 = blk_write(VAR_0->blk_cur, VAR_0->secs_cur + (VAR_1 >> 5),\ndp, 1) < 0;", "}", "}", "g_free(dp);", "}", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ] ]
2,144
static int ircam_read_header(AVFormatContext *s) { uint32_t magic, sample_rate, channels, tag; const AVCodecTag *tags; int le = -1, i; AVStream *st; magic = avio_rl32(s->pb); for (i = 0; i < 7; i++) { if (magic == table[i].magic) { le = table[i].is_le; break; } } if (le == 1) { sample_rate = av_int2float(avio_rl32(s->pb)); channels = avio_rl32(s->pb); tag = avio_rl32(s->pb); tags = ff_codec_ircam_le_tags; } else if (le == 0) { sample_rate = av_int2float(avio_rb32(s->pb)); channels = avio_rb32(s->pb); tag = avio_rb32(s->pb); tags = ff_codec_ircam_be_tags; } else { return AVERROR_INVALIDDATA; } if (!channels || !sample_rate) return AVERROR_INVALIDDATA; st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->channels = channels; st->codecpar->sample_rate = sample_rate; st->codecpar->codec_id = ff_codec_get_id(tags, tag); if (st->codecpar->codec_id == AV_CODEC_ID_NONE) { av_log(s, AV_LOG_ERROR, "unknown tag %X\n", tag); return AVERROR_INVALIDDATA; } st->codecpar->bits_per_coded_sample = av_get_bits_per_sample(st->codecpar->codec_id); st->codecpar->block_align = st->codecpar->bits_per_coded_sample * st->codecpar->channels / 8; avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); avio_skip(s->pb, 1008); return 0; }
true
FFmpeg
3d673078a03a3819df9dba7667f9e5d59b8487d0
static int ircam_read_header(AVFormatContext *s) { uint32_t magic, sample_rate, channels, tag; const AVCodecTag *tags; int le = -1, i; AVStream *st; magic = avio_rl32(s->pb); for (i = 0; i < 7; i++) { if (magic == table[i].magic) { le = table[i].is_le; break; } } if (le == 1) { sample_rate = av_int2float(avio_rl32(s->pb)); channels = avio_rl32(s->pb); tag = avio_rl32(s->pb); tags = ff_codec_ircam_le_tags; } else if (le == 0) { sample_rate = av_int2float(avio_rb32(s->pb)); channels = avio_rb32(s->pb); tag = avio_rb32(s->pb); tags = ff_codec_ircam_be_tags; } else { return AVERROR_INVALIDDATA; } if (!channels || !sample_rate) return AVERROR_INVALIDDATA; st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->channels = channels; st->codecpar->sample_rate = sample_rate; st->codecpar->codec_id = ff_codec_get_id(tags, tag); if (st->codecpar->codec_id == AV_CODEC_ID_NONE) { av_log(s, AV_LOG_ERROR, "unknown tag %X\n", tag); return AVERROR_INVALIDDATA; } st->codecpar->bits_per_coded_sample = av_get_bits_per_sample(st->codecpar->codec_id); st->codecpar->block_align = st->codecpar->bits_per_coded_sample * st->codecpar->channels / 8; avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); avio_skip(s->pb, 1008); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0) { uint32_t magic, sample_rate, channels, tag; const AVCodecTag *VAR_1; int VAR_2 = -1, VAR_3; AVStream *st; magic = avio_rl32(VAR_0->pb); for (VAR_3 = 0; VAR_3 < 7; VAR_3++) { if (magic == table[VAR_3].magic) { VAR_2 = table[VAR_3].is_le; break; } } if (VAR_2 == 1) { sample_rate = av_int2float(avio_rl32(VAR_0->pb)); channels = avio_rl32(VAR_0->pb); tag = avio_rl32(VAR_0->pb); VAR_1 = ff_codec_ircam_le_tags; } else if (VAR_2 == 0) { sample_rate = av_int2float(avio_rb32(VAR_0->pb)); channels = avio_rb32(VAR_0->pb); tag = avio_rb32(VAR_0->pb); VAR_1 = ff_codec_ircam_be_tags; } else { return AVERROR_INVALIDDATA; } if (!channels || !sample_rate) return AVERROR_INVALIDDATA; st = avformat_new_stream(VAR_0, NULL); if (!st) return AVERROR(ENOMEM); st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->channels = channels; st->codecpar->sample_rate = sample_rate; st->codecpar->codec_id = ff_codec_get_id(VAR_1, tag); if (st->codecpar->codec_id == AV_CODEC_ID_NONE) { av_log(VAR_0, AV_LOG_ERROR, "unknown tag %X\n", tag); return AVERROR_INVALIDDATA; } st->codecpar->bits_per_coded_sample = av_get_bits_per_sample(st->codecpar->codec_id); st->codecpar->block_align = st->codecpar->bits_per_coded_sample * st->codecpar->channels / 8; avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); avio_skip(VAR_0->pb, 1008); return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "uint32_t magic, sample_rate, channels, tag;", "const AVCodecTag *VAR_1;", "int VAR_2 = -1, VAR_3;", "AVStream *st;", "magic = avio_rl32(VAR_0->pb);", "for (VAR_3 = 0; VAR_3 < 7; VAR_3++) {", "if (magic == table[VAR_3].magic) {", "VAR_2 = table[VAR_3].is_le;", "break;", "}", "}", "if (VAR_2 == 1) {", "sample_rate = av_int2float(avio_rl32(VAR_0->pb));", "channels = avio_rl32(VAR_0->pb);", "tag = avio_rl32(VAR_0->pb);", "VAR_1 = ff_codec_ircam_le_tags;", "} else if (VAR_2 == 0) {", "sample_rate = av_int2float(avio_rb32(VAR_0->pb));", "channels = avio_rb32(VAR_0->pb);", "tag = avio_rb32(VAR_0->pb);", "VAR_1 = ff_codec_ircam_be_tags;", "} else {", "return AVERROR_INVALIDDATA;", "}", "if (!channels || !sample_rate)\nreturn AVERROR_INVALIDDATA;", "st = avformat_new_stream(VAR_0, NULL);", "if (!st)\nreturn AVERROR(ENOMEM);", "st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;", "st->codecpar->channels = channels;", "st->codecpar->sample_rate = sample_rate;", "st->codecpar->codec_id = ff_codec_get_id(VAR_1, tag);", "if (st->codecpar->codec_id == AV_CODEC_ID_NONE) {", "av_log(VAR_0, AV_LOG_ERROR, \"unknown tag %X\\n\", tag);", "return AVERROR_INVALIDDATA;", "}", "st->codecpar->bits_per_coded_sample = av_get_bits_per_sample(st->codecpar->codec_id);", "st->codecpar->block_align = st->codecpar->bits_per_coded_sample * st->codecpar->channels / 8;", "avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);", "avio_skip(VAR_0->pb, 1008);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59, 61 ], [ 65 ], [ 67, 69 ], [ 73 ], [ 75 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ] ]
2,145
static void pc_init_pci_1_6(QEMUMachineInitArgs *args) { has_pci_info = false; pc_init_pci(args); }
true
qemu
04920fc0faa4760f9c4fc0e73b992b768099be70
static void pc_init_pci_1_6(QEMUMachineInitArgs *args) { has_pci_info = false; pc_init_pci(args); }
{ "code": [], "line_no": [] }
static void FUNC_0(QEMUMachineInitArgs *VAR_0) { has_pci_info = false; pc_init_pci(VAR_0); }
[ "static void FUNC_0(QEMUMachineInitArgs *VAR_0)\n{", "has_pci_info = false;", "pc_init_pci(VAR_0);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 8 ], [ 10 ] ]
2,146
static char **breakline(char *input, int *count) { int c = 0; char *p; char **rval = g_malloc0(sizeof(char *)); char **tmp; while (rval && (p = qemu_strsep(&input, " ")) != NULL) { if (!*p) { continue; } c++; tmp = g_realloc(rval, sizeof(*rval) * (c + 1)); if (!tmp) { g_free(rval); rval = NULL; c = 0; break; } else { rval = tmp; } rval[c - 1] = p; rval[c] = NULL; } *count = c; return rval; }
true
qemu
5839e53bbc0fec56021d758aab7610df421ed8c8
static char **breakline(char *input, int *count) { int c = 0; char *p; char **rval = g_malloc0(sizeof(char *)); char **tmp; while (rval && (p = qemu_strsep(&input, " ")) != NULL) { if (!*p) { continue; } c++; tmp = g_realloc(rval, sizeof(*rval) * (c + 1)); if (!tmp) { g_free(rval); rval = NULL; c = 0; break; } else { rval = tmp; } rval[c - 1] = p; rval[c] = NULL; } *count = c; return rval; }
{ "code": [ " char **rval = g_malloc0(sizeof(char *));" ], "line_no": [ 9 ] }
static char **FUNC_0(char *VAR_0, int *VAR_1) { int VAR_2 = 0; char *VAR_3; char **VAR_4 = g_malloc0(sizeof(char *)); char **VAR_5; while (VAR_4 && (VAR_3 = qemu_strsep(&VAR_0, " ")) != NULL) { if (!*VAR_3) { continue; } VAR_2++; VAR_5 = g_realloc(VAR_4, sizeof(*VAR_4) * (VAR_2 + 1)); if (!VAR_5) { g_free(VAR_4); VAR_4 = NULL; VAR_2 = 0; break; } else { VAR_4 = VAR_5; } VAR_4[VAR_2 - 1] = VAR_3; VAR_4[VAR_2] = NULL; } *VAR_1 = VAR_2; return VAR_4; }
[ "static char **FUNC_0(char *VAR_0, int *VAR_1)\n{", "int VAR_2 = 0;", "char *VAR_3;", "char **VAR_4 = g_malloc0(sizeof(char *));", "char **VAR_5;", "while (VAR_4 && (VAR_3 = qemu_strsep(&VAR_0, \" \")) != NULL) {", "if (!*VAR_3) {", "continue;", "}", "VAR_2++;", "VAR_5 = g_realloc(VAR_4, sizeof(*VAR_4) * (VAR_2 + 1));", "if (!VAR_5) {", "g_free(VAR_4);", "VAR_4 = NULL;", "VAR_2 = 0;", "break;", "} else {", "VAR_4 = VAR_5;", "}", "VAR_4[VAR_2 - 1] = VAR_3;", "VAR_4[VAR_2] = NULL;", "}", "*VAR_1 = VAR_2;", "return VAR_4;", "}" ]
[ 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 ]
[ [ 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 ] ]
2,149
int kvm_arch_release_virq_post(int virq) { MSIRouteEntry *entry, *next; QLIST_FOREACH_SAFE(entry, &msi_route_list, list, next) { if (entry->virq == virq) { trace_kvm_x86_remove_msi_route(virq); QLIST_REMOVE(entry, list); break; } } return 0; }
true
qemu
01960e6d21dcfbfc8a03d8fd6284c448cf75865b
int kvm_arch_release_virq_post(int virq) { MSIRouteEntry *entry, *next; QLIST_FOREACH_SAFE(entry, &msi_route_list, list, next) { if (entry->virq == virq) { trace_kvm_x86_remove_msi_route(virq); QLIST_REMOVE(entry, list); break; } } return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(int VAR_0) { MSIRouteEntry *entry, *next; QLIST_FOREACH_SAFE(entry, &msi_route_list, list, next) { if (entry->VAR_0 == VAR_0) { trace_kvm_x86_remove_msi_route(VAR_0); QLIST_REMOVE(entry, list); break; } } return 0; }
[ "int FUNC_0(int VAR_0)\n{", "MSIRouteEntry *entry, *next;", "QLIST_FOREACH_SAFE(entry, &msi_route_list, list, next) {", "if (entry->VAR_0 == VAR_0) {", "trace_kvm_x86_remove_msi_route(VAR_0);", "QLIST_REMOVE(entry, list);", "break;", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 16 ], [ 18 ], [ 20 ], [ 22 ], [ 24 ] ]
2,150
monitor_qapi_event_queue(QAPIEvent event, QDict *qdict, Error **errp) { MonitorQAPIEventConf *evconf; MonitorQAPIEventState *evstate; assert(event < QAPI_EVENT__MAX); evconf = &monitor_qapi_event_conf[event]; trace_monitor_protocol_event_queue(event, qdict, evconf->rate); qemu_mutex_lock(&monitor_lock); if (!evconf->rate) { /* Unthrottled event */ monitor_qapi_event_emit(event, qdict); } else { QDict *data = qobject_to_qdict(qdict_get(qdict, "data")); MonitorQAPIEventState key = { .event = event, .data = data }; evstate = g_hash_table_lookup(monitor_qapi_event_state, &key); assert(!evstate || timer_pending(evstate->timer)); if (evstate) { /* * Timer is pending for (at least) evconf->rate ns after * last send. Store event for sending when timer fires, * replacing a prior stored event if any. */ QDECREF(evstate->qdict); evstate->qdict = qdict; QINCREF(evstate->qdict); } else { /* * Last send was (at least) evconf->rate ns ago. * Send immediately, and arm the timer to call * monitor_qapi_event_handler() in evconf->rate ns. Any * events arriving before then will be delayed until then. */ int64_t now = qemu_clock_get_ns(QEMU_CLOCK_REALTIME); monitor_qapi_event_emit(event, qdict); evstate = g_new(MonitorQAPIEventState, 1); evstate->event = event; evstate->data = data; QINCREF(evstate->data); evstate->qdict = NULL; evstate->timer = timer_new_ns(QEMU_CLOCK_REALTIME, monitor_qapi_event_handler, evstate); g_hash_table_add(monitor_qapi_event_state, evstate); timer_mod_ns(evstate->timer, now + evconf->rate); } } qemu_mutex_unlock(&monitor_lock); }
true
qemu
dc5999787181f6d090217f45570067e55333835b
monitor_qapi_event_queue(QAPIEvent event, QDict *qdict, Error **errp) { MonitorQAPIEventConf *evconf; MonitorQAPIEventState *evstate; assert(event < QAPI_EVENT__MAX); evconf = &monitor_qapi_event_conf[event]; trace_monitor_protocol_event_queue(event, qdict, evconf->rate); qemu_mutex_lock(&monitor_lock); if (!evconf->rate) { monitor_qapi_event_emit(event, qdict); } else { QDict *data = qobject_to_qdict(qdict_get(qdict, "data")); MonitorQAPIEventState key = { .event = event, .data = data }; evstate = g_hash_table_lookup(monitor_qapi_event_state, &key); assert(!evstate || timer_pending(evstate->timer)); if (evstate) { QDECREF(evstate->qdict); evstate->qdict = qdict; QINCREF(evstate->qdict); } else { int64_t now = qemu_clock_get_ns(QEMU_CLOCK_REALTIME); monitor_qapi_event_emit(event, qdict); evstate = g_new(MonitorQAPIEventState, 1); evstate->event = event; evstate->data = data; QINCREF(evstate->data); evstate->qdict = NULL; evstate->timer = timer_new_ns(QEMU_CLOCK_REALTIME, monitor_qapi_event_handler, evstate); g_hash_table_add(monitor_qapi_event_state, evstate); timer_mod_ns(evstate->timer, now + evconf->rate); } } qemu_mutex_unlock(&monitor_lock); }
{ "code": [ " int64_t now = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);", " evstate->timer = timer_new_ns(QEMU_CLOCK_REALTIME," ], "line_no": [ 75, 93 ] }
FUNC_0(QAPIEvent VAR_0, QDict *VAR_1, Error **VAR_2) { MonitorQAPIEventConf *evconf; MonitorQAPIEventState *evstate; assert(VAR_0 < QAPI_EVENT__MAX); evconf = &monitor_qapi_event_conf[VAR_0]; trace_monitor_protocol_event_queue(VAR_0, VAR_1, evconf->rate); qemu_mutex_lock(&monitor_lock); if (!evconf->rate) { monitor_qapi_event_emit(VAR_0, VAR_1); } else { QDict *data = qobject_to_qdict(qdict_get(VAR_1, "data")); MonitorQAPIEventState key = { .VAR_0 = VAR_0, .data = data }; evstate = g_hash_table_lookup(monitor_qapi_event_state, &key); assert(!evstate || timer_pending(evstate->timer)); if (evstate) { QDECREF(evstate->VAR_1); evstate->VAR_1 = VAR_1; QINCREF(evstate->VAR_1); } else { int64_t now = qemu_clock_get_ns(QEMU_CLOCK_REALTIME); monitor_qapi_event_emit(VAR_0, VAR_1); evstate = g_new(MonitorQAPIEventState, 1); evstate->VAR_0 = VAR_0; evstate->data = data; QINCREF(evstate->data); evstate->VAR_1 = NULL; evstate->timer = timer_new_ns(QEMU_CLOCK_REALTIME, monitor_qapi_event_handler, evstate); g_hash_table_add(monitor_qapi_event_state, evstate); timer_mod_ns(evstate->timer, now + evconf->rate); } } qemu_mutex_unlock(&monitor_lock); }
[ "FUNC_0(QAPIEvent VAR_0, QDict *VAR_1, Error **VAR_2)\n{", "MonitorQAPIEventConf *evconf;", "MonitorQAPIEventState *evstate;", "assert(VAR_0 < QAPI_EVENT__MAX);", "evconf = &monitor_qapi_event_conf[VAR_0];", "trace_monitor_protocol_event_queue(VAR_0, VAR_1, evconf->rate);", "qemu_mutex_lock(&monitor_lock);", "if (!evconf->rate) {", "monitor_qapi_event_emit(VAR_0, VAR_1);", "} else {", "QDict *data = qobject_to_qdict(qdict_get(VAR_1, \"data\"));", "MonitorQAPIEventState key = { .VAR_0 = VAR_0, .data = data };", "evstate = g_hash_table_lookup(monitor_qapi_event_state, &key);", "assert(!evstate || timer_pending(evstate->timer));", "if (evstate) {", "QDECREF(evstate->VAR_1);", "evstate->VAR_1 = VAR_1;", "QINCREF(evstate->VAR_1);", "} else {", "int64_t now = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);", "monitor_qapi_event_emit(VAR_0, VAR_1);", "evstate = g_new(MonitorQAPIEventState, 1);", "evstate->VAR_0 = VAR_0;", "evstate->data = data;", "QINCREF(evstate->data);", "evstate->VAR_1 = NULL;", "evstate->timer = timer_new_ns(QEMU_CLOCK_REALTIME,\nmonitor_qapi_event_handler,\nevstate);", "g_hash_table_add(monitor_qapi_event_state, evstate);", "timer_mod_ns(evstate->timer, now + evconf->rate);", "}", "}", "qemu_mutex_unlock(&monitor_lock);", "}" ]
[ 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, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 43 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 75 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93, 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ] ]
2,151
void pdu_submit(V9fsPDU *pdu) { Coroutine *co; CoroutineEntry *handler; V9fsState *s = pdu->s; if (pdu->id >= ARRAY_SIZE(pdu_co_handlers) || (pdu_co_handlers[pdu->id] == NULL)) { handler = v9fs_op_not_supp; } else { handler = pdu_co_handlers[pdu->id]; } if (is_ro_export(&s->ctx) && !is_read_only_op(pdu)) { handler = v9fs_fs_ro; } co = qemu_coroutine_create(handler); qemu_coroutine_enter(co, pdu); }
true
qemu
0b8b8753e4d94901627b3e86431230f2319215c4
void pdu_submit(V9fsPDU *pdu) { Coroutine *co; CoroutineEntry *handler; V9fsState *s = pdu->s; if (pdu->id >= ARRAY_SIZE(pdu_co_handlers) || (pdu_co_handlers[pdu->id] == NULL)) { handler = v9fs_op_not_supp; } else { handler = pdu_co_handlers[pdu->id]; } if (is_ro_export(&s->ctx) && !is_read_only_op(pdu)) { handler = v9fs_fs_ro; } co = qemu_coroutine_create(handler); qemu_coroutine_enter(co, pdu); }
{ "code": [ " co = qemu_coroutine_create(handler);", " qemu_coroutine_enter(co, pdu);" ], "line_no": [ 33, 35 ] }
void FUNC_0(V9fsPDU *VAR_0) { Coroutine *co; CoroutineEntry *handler; V9fsState *s = VAR_0->s; if (VAR_0->id >= ARRAY_SIZE(pdu_co_handlers) || (pdu_co_handlers[VAR_0->id] == NULL)) { handler = v9fs_op_not_supp; } else { handler = pdu_co_handlers[VAR_0->id]; } if (is_ro_export(&s->ctx) && !is_read_only_op(VAR_0)) { handler = v9fs_fs_ro; } co = qemu_coroutine_create(handler); qemu_coroutine_enter(co, VAR_0); }
[ "void FUNC_0(V9fsPDU *VAR_0)\n{", "Coroutine *co;", "CoroutineEntry *handler;", "V9fsState *s = VAR_0->s;", "if (VAR_0->id >= ARRAY_SIZE(pdu_co_handlers) ||\n(pdu_co_handlers[VAR_0->id] == NULL)) {", "handler = v9fs_op_not_supp;", "} else {", "handler = pdu_co_handlers[VAR_0->id];", "}", "if (is_ro_export(&s->ctx) && !is_read_only_op(VAR_0)) {", "handler = v9fs_fs_ro;", "}", "co = qemu_coroutine_create(handler);", "qemu_coroutine_enter(co, VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]
2,152
static ssize_t socket_writev_buffer(void *opaque, struct iovec *iov, int iovcnt, int64_t pos) { QEMUFileSocket *s = opaque; ssize_t len; ssize_t size = iov_size(iov, iovcnt); len = iov_send(s->fd, iov, iovcnt, 0, size); if (len < size) { len = -socket_error(); } return len; }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
static ssize_t socket_writev_buffer(void *opaque, struct iovec *iov, int iovcnt, int64_t pos) { QEMUFileSocket *s = opaque; ssize_t len; ssize_t size = iov_size(iov, iovcnt); len = iov_send(s->fd, iov, iovcnt, 0, size); if (len < size) { len = -socket_error(); } return len; }
{ "code": [], "line_no": [] }
static ssize_t FUNC_0(void *opaque, struct iovec *iov, int iovcnt, int64_t pos) { QEMUFileSocket *s = opaque; ssize_t len; ssize_t size = iov_size(iov, iovcnt); len = iov_send(s->fd, iov, iovcnt, 0, size); if (len < size) { len = -socket_error(); } return len; }
[ "static ssize_t FUNC_0(void *opaque, struct iovec *iov, int iovcnt,\nint64_t pos)\n{", "QEMUFileSocket *s = opaque;", "ssize_t len;", "ssize_t size = iov_size(iov, iovcnt);", "len = iov_send(s->fd, iov, iovcnt, 0, size);", "if (len < size) {", "len = -socket_error();", "}", "return len;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
2,153
static void assign_storage(SCLPDevice *sclp, SCCB *sccb) { MemoryRegion *mr = NULL; uint64_t this_subregion_size; AssignStorage *assign_info = (AssignStorage *) sccb; sclpMemoryHotplugDev *mhd = get_sclp_memory_hotplug_dev(); ram_addr_t assign_addr; MemoryRegion *sysmem = get_system_memory(); if (!mhd) { sccb->h.response_code = cpu_to_be16(SCLP_RC_INVALID_SCLP_COMMAND); return; } assign_addr = (assign_info->rn - 1) * mhd->rzm; if ((assign_addr % MEM_SECTION_SIZE == 0) && (assign_addr >= mhd->padded_ram_size)) { /* Re-use existing memory region if found */ mr = memory_region_find(sysmem, assign_addr, 1).mr; memory_region_unref(mr); if (!mr) { MemoryRegion *standby_ram = g_new(MemoryRegion, 1); /* offset to align to standby_subregion_size for allocation */ ram_addr_t offset = assign_addr - (assign_addr - mhd->padded_ram_size) % mhd->standby_subregion_size; /* strlen("standby.ram") + 4 (Max of KVM_MEMORY_SLOTS) + NULL */ char id[16]; snprintf(id, 16, "standby.ram%d", (int)((offset - mhd->padded_ram_size) / mhd->standby_subregion_size) + 1); /* Allocate a subregion of the calculated standby_subregion_size */ if (offset + mhd->standby_subregion_size > mhd->padded_ram_size + mhd->standby_mem_size) { this_subregion_size = mhd->padded_ram_size + mhd->standby_mem_size - offset; } else { this_subregion_size = mhd->standby_subregion_size; } memory_region_init_ram(standby_ram, NULL, id, this_subregion_size, &error_abort); /* This is a hack to make memory hotunplug work again. Once we have * subdevices, we have to unparent them when unassigning memory, * instead of doing it via the ref count of the MemoryRegion. */ object_ref(OBJECT(standby_ram)); object_unparent(OBJECT(standby_ram)); vmstate_register_ram_global(standby_ram); memory_region_add_subregion(sysmem, offset, standby_ram); } /* The specified subregion is no longer in standby */ mhd->standby_state_map[(assign_addr - mhd->padded_ram_size) / MEM_SECTION_SIZE] = 1; } sccb->h.response_code = cpu_to_be16(SCLP_RC_NORMAL_COMPLETION); }
true
qemu
f8ed85ac992c48814d916d5df4d44f9a971c5de4
static void assign_storage(SCLPDevice *sclp, SCCB *sccb) { MemoryRegion *mr = NULL; uint64_t this_subregion_size; AssignStorage *assign_info = (AssignStorage *) sccb; sclpMemoryHotplugDev *mhd = get_sclp_memory_hotplug_dev(); ram_addr_t assign_addr; MemoryRegion *sysmem = get_system_memory(); if (!mhd) { sccb->h.response_code = cpu_to_be16(SCLP_RC_INVALID_SCLP_COMMAND); return; } assign_addr = (assign_info->rn - 1) * mhd->rzm; if ((assign_addr % MEM_SECTION_SIZE == 0) && (assign_addr >= mhd->padded_ram_size)) { mr = memory_region_find(sysmem, assign_addr, 1).mr; memory_region_unref(mr); if (!mr) { MemoryRegion *standby_ram = g_new(MemoryRegion, 1); ram_addr_t offset = assign_addr - (assign_addr - mhd->padded_ram_size) % mhd->standby_subregion_size; char id[16]; snprintf(id, 16, "standby.ram%d", (int)((offset - mhd->padded_ram_size) / mhd->standby_subregion_size) + 1); if (offset + mhd->standby_subregion_size > mhd->padded_ram_size + mhd->standby_mem_size) { this_subregion_size = mhd->padded_ram_size + mhd->standby_mem_size - offset; } else { this_subregion_size = mhd->standby_subregion_size; } memory_region_init_ram(standby_ram, NULL, id, this_subregion_size, &error_abort); object_ref(OBJECT(standby_ram)); object_unparent(OBJECT(standby_ram)); vmstate_register_ram_global(standby_ram); memory_region_add_subregion(sysmem, offset, standby_ram); } mhd->standby_state_map[(assign_addr - mhd->padded_ram_size) / MEM_SECTION_SIZE] = 1; } sccb->h.response_code = cpu_to_be16(SCLP_RC_NORMAL_COMPLETION); }
{ "code": [ " memory_region_init_ram(standby_ram, NULL, id, this_subregion_size, &error_abort);" ], "line_no": [ 89 ] }
static void FUNC_0(SCLPDevice *VAR_0, SCCB *VAR_1) { MemoryRegion *mr = NULL; uint64_t this_subregion_size; AssignStorage *assign_info = (AssignStorage *) VAR_1; sclpMemoryHotplugDev *mhd = get_sclp_memory_hotplug_dev(); ram_addr_t assign_addr; MemoryRegion *sysmem = get_system_memory(); if (!mhd) { VAR_1->h.response_code = cpu_to_be16(SCLP_RC_INVALID_SCLP_COMMAND); return; } assign_addr = (assign_info->rn - 1) * mhd->rzm; if ((assign_addr % MEM_SECTION_SIZE == 0) && (assign_addr >= mhd->padded_ram_size)) { mr = memory_region_find(sysmem, assign_addr, 1).mr; memory_region_unref(mr); if (!mr) { MemoryRegion *standby_ram = g_new(MemoryRegion, 1); ram_addr_t offset = assign_addr - (assign_addr - mhd->padded_ram_size) % mhd->standby_subregion_size; char VAR_2[16]; snprintf(VAR_2, 16, "standby.ram%d", (int)((offset - mhd->padded_ram_size) / mhd->standby_subregion_size) + 1); if (offset + mhd->standby_subregion_size > mhd->padded_ram_size + mhd->standby_mem_size) { this_subregion_size = mhd->padded_ram_size + mhd->standby_mem_size - offset; } else { this_subregion_size = mhd->standby_subregion_size; } memory_region_init_ram(standby_ram, NULL, VAR_2, this_subregion_size, &error_abort); object_ref(OBJECT(standby_ram)); object_unparent(OBJECT(standby_ram)); vmstate_register_ram_global(standby_ram); memory_region_add_subregion(sysmem, offset, standby_ram); } mhd->standby_state_map[(assign_addr - mhd->padded_ram_size) / MEM_SECTION_SIZE] = 1; } VAR_1->h.response_code = cpu_to_be16(SCLP_RC_NORMAL_COMPLETION); }
[ "static void FUNC_0(SCLPDevice *VAR_0, SCCB *VAR_1)\n{", "MemoryRegion *mr = NULL;", "uint64_t this_subregion_size;", "AssignStorage *assign_info = (AssignStorage *) VAR_1;", "sclpMemoryHotplugDev *mhd = get_sclp_memory_hotplug_dev();", "ram_addr_t assign_addr;", "MemoryRegion *sysmem = get_system_memory();", "if (!mhd) {", "VAR_1->h.response_code = cpu_to_be16(SCLP_RC_INVALID_SCLP_COMMAND);", "return;", "}", "assign_addr = (assign_info->rn - 1) * mhd->rzm;", "if ((assign_addr % MEM_SECTION_SIZE == 0) &&\n(assign_addr >= mhd->padded_ram_size)) {", "mr = memory_region_find(sysmem, assign_addr, 1).mr;", "memory_region_unref(mr);", "if (!mr) {", "MemoryRegion *standby_ram = g_new(MemoryRegion, 1);", "ram_addr_t offset = assign_addr -\n(assign_addr - mhd->padded_ram_size)\n% mhd->standby_subregion_size;", "char VAR_2[16];", "snprintf(VAR_2, 16, \"standby.ram%d\",\n(int)((offset - mhd->padded_ram_size) /\nmhd->standby_subregion_size) + 1);", "if (offset + mhd->standby_subregion_size >\nmhd->padded_ram_size + mhd->standby_mem_size) {", "this_subregion_size = mhd->padded_ram_size +\nmhd->standby_mem_size - offset;", "} else {", "this_subregion_size = mhd->standby_subregion_size;", "}", "memory_region_init_ram(standby_ram, NULL, VAR_2, this_subregion_size, &error_abort);", "object_ref(OBJECT(standby_ram));", "object_unparent(OBJECT(standby_ram));", "vmstate_register_ram_global(standby_ram);", "memory_region_add_subregion(sysmem, offset, standby_ram);", "}", "mhd->standby_state_map[(assign_addr - mhd->padded_ram_size)\n/ MEM_SECTION_SIZE] = 1;", "}", "VAR_1->h.response_code = cpu_to_be16(SCLP_RC_NORMAL_COMPLETION);", "}" ]
[ 0, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31, 33 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 51, 53, 55 ], [ 61 ], [ 63, 65, 67 ], [ 73, 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117 ] ]
2,154
static int curl_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVCURLState *s = bs->opaque; CURLState *state = NULL; QemuOpts *opts; Error *local_err = NULL; const char *file; const char *cookie; const char *cookie_secret; double d; const char *secretid; const char *protocol_delimiter; static int inited = 0; if (flags & BDRV_O_RDWR) { error_setg(errp, "curl block device does not support writes"); return -EROFS; } qemu_mutex_init(&s->mutex); opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, options, &local_err); if (local_err) { error_propagate(errp, local_err); goto out_noclean; } s->readahead_size = qemu_opt_get_size(opts, CURL_BLOCK_OPT_READAHEAD, READ_AHEAD_DEFAULT); if ((s->readahead_size & 0x1ff) != 0) { error_setg(errp, "HTTP_READAHEAD_SIZE %zd is not a multiple of 512", s->readahead_size); goto out_noclean; } s->timeout = qemu_opt_get_number(opts, CURL_BLOCK_OPT_TIMEOUT, CURL_TIMEOUT_DEFAULT); if (s->timeout > CURL_TIMEOUT_MAX) { error_setg(errp, "timeout parameter is too large or negative"); goto out_noclean; } s->sslverify = qemu_opt_get_bool(opts, CURL_BLOCK_OPT_SSLVERIFY, true); cookie = qemu_opt_get(opts, CURL_BLOCK_OPT_COOKIE); cookie_secret = qemu_opt_get(opts, CURL_BLOCK_OPT_COOKIE_SECRET); if (cookie && cookie_secret) { error_setg(errp, "curl driver cannot handle both cookie and cookie secret"); goto out_noclean; } if (cookie_secret) { s->cookie = qcrypto_secret_lookup_as_utf8(cookie_secret, errp); if (!s->cookie) { goto out_noclean; } } else { s->cookie = g_strdup(cookie); } file = qemu_opt_get(opts, CURL_BLOCK_OPT_URL); if (file == NULL) { error_setg(errp, "curl block driver requires an 'url' option"); goto out_noclean; } if (!strstart(file, bs->drv->protocol_name, &protocol_delimiter) || !strstart(protocol_delimiter, "://", NULL)) { error_setg(errp, "%s curl driver cannot handle the URL '%s' (does not " "start with '%s://')", bs->drv->protocol_name, file, bs->drv->protocol_name); goto out_noclean; } s->username = g_strdup(qemu_opt_get(opts, CURL_BLOCK_OPT_USERNAME)); secretid = qemu_opt_get(opts, CURL_BLOCK_OPT_PASSWORD_SECRET); if (secretid) { s->password = qcrypto_secret_lookup_as_utf8(secretid, errp); if (!s->password) { goto out_noclean; } } s->proxyusername = g_strdup( qemu_opt_get(opts, CURL_BLOCK_OPT_PROXY_USERNAME)); secretid = qemu_opt_get(opts, CURL_BLOCK_OPT_PROXY_PASSWORD_SECRET); if (secretid) { s->proxypassword = qcrypto_secret_lookup_as_utf8(secretid, errp); if (!s->proxypassword) { goto out_noclean; } } if (!inited) { curl_global_init(CURL_GLOBAL_ALL); inited = 1; } DPRINTF("CURL: Opening %s\n", file); QSIMPLEQ_INIT(&s->free_state_waitq); s->aio_context = bdrv_get_aio_context(bs); s->url = g_strdup(file); qemu_mutex_lock(&s->mutex); state = curl_find_state(s); qemu_mutex_unlock(&s->mutex); if (!state) { goto out_noclean; } // Get file size if (curl_init_state(s, state) < 0) { goto out; } s->accept_range = false; curl_easy_setopt(state->curl, CURLOPT_NOBODY, 1); curl_easy_setopt(state->curl, CURLOPT_HEADERFUNCTION, curl_header_cb); curl_easy_setopt(state->curl, CURLOPT_HEADERDATA, s); if (curl_easy_perform(state->curl)) goto out; if (curl_easy_getinfo(state->curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &d)) { goto out; } /* Prior CURL 7.19.4 return value of 0 could mean that the file size is not * know or the size is zero. From 7.19.4 CURL returns -1 if size is not * known and zero if it is realy zero-length file. */ #if LIBCURL_VERSION_NUM >= 0x071304 if (d < 0) { pstrcpy(state->errmsg, CURL_ERROR_SIZE, "Server didn't report file size."); goto out; } #else if (d <= 0) { pstrcpy(state->errmsg, CURL_ERROR_SIZE, "Unknown file size or zero-length file."); goto out; } #endif s->len = d; if ((!strncasecmp(s->url, "http://", strlen("http://")) || !strncasecmp(s->url, "https://", strlen("https://"))) && !s->accept_range) { pstrcpy(state->errmsg, CURL_ERROR_SIZE, "Server does not support 'range' (byte ranges)."); goto out; } DPRINTF("CURL: Size = %" PRIu64 "\n", s->len); qemu_mutex_lock(&s->mutex); curl_clean_state(state); qemu_mutex_unlock(&s->mutex); curl_easy_cleanup(state->curl); state->curl = NULL; curl_attach_aio_context(bs, bdrv_get_aio_context(bs)); qemu_opts_del(opts); return 0; out: error_setg(errp, "CURL: Error opening file: %s", state->errmsg); curl_easy_cleanup(state->curl); state->curl = NULL; out_noclean: qemu_mutex_destroy(&s->mutex); g_free(s->cookie); g_free(s->url); qemu_opts_del(opts); return -EINVAL; }
true
qemu
2d25964d1831c99d54981e8b615eba5dd6a63e36
static int curl_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVCURLState *s = bs->opaque; CURLState *state = NULL; QemuOpts *opts; Error *local_err = NULL; const char *file; const char *cookie; const char *cookie_secret; double d; const char *secretid; const char *protocol_delimiter; static int inited = 0; if (flags & BDRV_O_RDWR) { error_setg(errp, "curl block device does not support writes"); return -EROFS; } qemu_mutex_init(&s->mutex); opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, options, &local_err); if (local_err) { error_propagate(errp, local_err); goto out_noclean; } s->readahead_size = qemu_opt_get_size(opts, CURL_BLOCK_OPT_READAHEAD, READ_AHEAD_DEFAULT); if ((s->readahead_size & 0x1ff) != 0) { error_setg(errp, "HTTP_READAHEAD_SIZE %zd is not a multiple of 512", s->readahead_size); goto out_noclean; } s->timeout = qemu_opt_get_number(opts, CURL_BLOCK_OPT_TIMEOUT, CURL_TIMEOUT_DEFAULT); if (s->timeout > CURL_TIMEOUT_MAX) { error_setg(errp, "timeout parameter is too large or negative"); goto out_noclean; } s->sslverify = qemu_opt_get_bool(opts, CURL_BLOCK_OPT_SSLVERIFY, true); cookie = qemu_opt_get(opts, CURL_BLOCK_OPT_COOKIE); cookie_secret = qemu_opt_get(opts, CURL_BLOCK_OPT_COOKIE_SECRET); if (cookie && cookie_secret) { error_setg(errp, "curl driver cannot handle both cookie and cookie secret"); goto out_noclean; } if (cookie_secret) { s->cookie = qcrypto_secret_lookup_as_utf8(cookie_secret, errp); if (!s->cookie) { goto out_noclean; } } else { s->cookie = g_strdup(cookie); } file = qemu_opt_get(opts, CURL_BLOCK_OPT_URL); if (file == NULL) { error_setg(errp, "curl block driver requires an 'url' option"); goto out_noclean; } if (!strstart(file, bs->drv->protocol_name, &protocol_delimiter) || !strstart(protocol_delimiter, ": { error_setg(errp, "%s curl driver cannot handle the URL '%s' (does not " "start with '%s: bs->drv->protocol_name); goto out_noclean; } s->username = g_strdup(qemu_opt_get(opts, CURL_BLOCK_OPT_USERNAME)); secretid = qemu_opt_get(opts, CURL_BLOCK_OPT_PASSWORD_SECRET); if (secretid) { s->password = qcrypto_secret_lookup_as_utf8(secretid, errp); if (!s->password) { goto out_noclean; } } s->proxyusername = g_strdup( qemu_opt_get(opts, CURL_BLOCK_OPT_PROXY_USERNAME)); secretid = qemu_opt_get(opts, CURL_BLOCK_OPT_PROXY_PASSWORD_SECRET); if (secretid) { s->proxypassword = qcrypto_secret_lookup_as_utf8(secretid, errp); if (!s->proxypassword) { goto out_noclean; } } if (!inited) { curl_global_init(CURL_GLOBAL_ALL); inited = 1; } DPRINTF("CURL: Opening %s\n", file); QSIMPLEQ_INIT(&s->free_state_waitq); s->aio_context = bdrv_get_aio_context(bs); s->url = g_strdup(file); qemu_mutex_lock(&s->mutex); state = curl_find_state(s); qemu_mutex_unlock(&s->mutex); if (!state) { goto out_noclean; } if (curl_init_state(s, state) < 0) { goto out; } s->accept_range = false; curl_easy_setopt(state->curl, CURLOPT_NOBODY, 1); curl_easy_setopt(state->curl, CURLOPT_HEADERFUNCTION, curl_header_cb); curl_easy_setopt(state->curl, CURLOPT_HEADERDATA, s); if (curl_easy_perform(state->curl)) goto out; if (curl_easy_getinfo(state->curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &d)) { goto out; } #if LIBCURL_VERSION_NUM >= 0x071304 if (d < 0) { pstrcpy(state->errmsg, CURL_ERROR_SIZE, "Server didn't report file size."); goto out; } #else if (d <= 0) { pstrcpy(state->errmsg, CURL_ERROR_SIZE, "Unknown file size or zero-length file."); goto out; } #endif s->len = d; if ((!strncasecmp(s->url, "http: || !strncasecmp(s->url, "https: && !s->accept_range) { pstrcpy(state->errmsg, CURL_ERROR_SIZE, "Server does not support 'range' (byte ranges)."); goto out; } DPRINTF("CURL: Size = %" PRIu64 "\n", s->len); qemu_mutex_lock(&s->mutex); curl_clean_state(state); qemu_mutex_unlock(&s->mutex); curl_easy_cleanup(state->curl); state->curl = NULL; curl_attach_aio_context(bs, bdrv_get_aio_context(bs)); qemu_opts_del(opts); return 0; out: error_setg(errp, "CURL: Error opening file: %s", state->errmsg); curl_easy_cleanup(state->curl); state->curl = NULL; out_noclean: qemu_mutex_destroy(&s->mutex); g_free(s->cookie); g_free(s->url); qemu_opts_del(opts); return -EINVAL; }
{ "code": [ " static int inited = 0;", " if (!inited) {", " curl_global_init(CURL_GLOBAL_ALL);", " inited = 1;" ], "line_no": [ 29, 199, 201, 203 ] }
static int FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1, int VAR_2, Error **VAR_3) { BDRVCURLState *s = VAR_0->opaque; CURLState *state = NULL; QemuOpts *opts; Error *local_err = NULL; const char *VAR_4; const char *VAR_5; const char *VAR_6; double VAR_7; const char *VAR_8; const char *VAR_9; static int VAR_10 = 0; if (VAR_2 & BDRV_O_RDWR) { error_setg(VAR_3, "curl block device does not support writes"); return -EROFS; } qemu_mutex_init(&s->mutex); opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, VAR_1, &local_err); if (local_err) { error_propagate(VAR_3, local_err); goto out_noclean; } s->readahead_size = qemu_opt_get_size(opts, CURL_BLOCK_OPT_READAHEAD, READ_AHEAD_DEFAULT); if ((s->readahead_size & 0x1ff) != 0) { error_setg(VAR_3, "HTTP_READAHEAD_SIZE %zd is not a multiple of 512", s->readahead_size); goto out_noclean; } s->timeout = qemu_opt_get_number(opts, CURL_BLOCK_OPT_TIMEOUT, CURL_TIMEOUT_DEFAULT); if (s->timeout > CURL_TIMEOUT_MAX) { error_setg(VAR_3, "timeout parameter is too large or negative"); goto out_noclean; } s->sslverify = qemu_opt_get_bool(opts, CURL_BLOCK_OPT_SSLVERIFY, true); VAR_5 = qemu_opt_get(opts, CURL_BLOCK_OPT_COOKIE); VAR_6 = qemu_opt_get(opts, CURL_BLOCK_OPT_COOKIE_SECRET); if (VAR_5 && VAR_6) { error_setg(VAR_3, "curl driver cannot handle both VAR_5 and VAR_5 secret"); goto out_noclean; } if (VAR_6) { s->VAR_5 = qcrypto_secret_lookup_as_utf8(VAR_6, VAR_3); if (!s->VAR_5) { goto out_noclean; } } else { s->VAR_5 = g_strdup(VAR_5); } VAR_4 = qemu_opt_get(opts, CURL_BLOCK_OPT_URL); if (VAR_4 == NULL) { error_setg(VAR_3, "curl block driver requires an 'url' option"); goto out_noclean; } if (!strstart(VAR_4, VAR_0->drv->protocol_name, &VAR_9) || !strstart(VAR_9, ": { error_setg(VAR_3, "%s curl driver cannot handle the URL '%s' (does not " "start with '%s: VAR_0->drv->protocol_name); goto out_noclean; } s->username = g_strdup(qemu_opt_get(opts, CURL_BLOCK_OPT_USERNAME)); VAR_8 = qemu_opt_get(opts, CURL_BLOCK_OPT_PASSWORD_SECRET); if (VAR_8) { s->password = qcrypto_secret_lookup_as_utf8(VAR_8, VAR_3); if (!s->password) { goto out_noclean; } } s->proxyusername = g_strdup( qemu_opt_get(opts, CURL_BLOCK_OPT_PROXY_USERNAME)); VAR_8 = qemu_opt_get(opts, CURL_BLOCK_OPT_PROXY_PASSWORD_SECRET); if (VAR_8) { s->proxypassword = qcrypto_secret_lookup_as_utf8(VAR_8, VAR_3); if (!s->proxypassword) { goto out_noclean; } } if (!VAR_10) { curl_global_init(CURL_GLOBAL_ALL); VAR_10 = 1; } DPRINTF("CURL: Opening %s\n", VAR_4); QSIMPLEQ_INIT(&s->free_state_waitq); s->aio_context = bdrv_get_aio_context(VAR_0); s->url = g_strdup(VAR_4); qemu_mutex_lock(&s->mutex); state = curl_find_state(s); qemu_mutex_unlock(&s->mutex); if (!state) { goto out_noclean; } if (curl_init_state(s, state) < 0) { goto out; } s->accept_range = false; curl_easy_setopt(state->curl, CURLOPT_NOBODY, 1); curl_easy_setopt(state->curl, CURLOPT_HEADERFUNCTION, curl_header_cb); curl_easy_setopt(state->curl, CURLOPT_HEADERDATA, s); if (curl_easy_perform(state->curl)) goto out; if (curl_easy_getinfo(state->curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &VAR_7)) { goto out; } #if LIBCURL_VERSION_NUM >= 0x071304 if (VAR_7 < 0) { pstrcpy(state->errmsg, CURL_ERROR_SIZE, "Server didn't report VAR_4 size."); goto out; } #else if (VAR_7 <= 0) { pstrcpy(state->errmsg, CURL_ERROR_SIZE, "Unknown VAR_4 size or zero-length VAR_4."); goto out; } #endif s->len = VAR_7; if ((!strncasecmp(s->url, "http: || !strncasecmp(s->url, "https: && !s->accept_range) { pstrcpy(state->errmsg, CURL_ERROR_SIZE, "Server does not support 'range' (byte ranges)."); goto out; } DPRINTF("CURL: Size = %" PRIu64 "\n", s->len); qemu_mutex_lock(&s->mutex); curl_clean_state(state); qemu_mutex_unlock(&s->mutex); curl_easy_cleanup(state->curl); state->curl = NULL; curl_attach_aio_context(VAR_0, bdrv_get_aio_context(VAR_0)); qemu_opts_del(opts); return 0; out: error_setg(VAR_3, "CURL: Error opening VAR_4: %s", state->errmsg); curl_easy_cleanup(state->curl); state->curl = NULL; out_noclean: qemu_mutex_destroy(&s->mutex); g_free(s->VAR_5); g_free(s->url); qemu_opts_del(opts); return -EINVAL; }
[ "static int FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1, int VAR_2,\nError **VAR_3)\n{", "BDRVCURLState *s = VAR_0->opaque;", "CURLState *state = NULL;", "QemuOpts *opts;", "Error *local_err = NULL;", "const char *VAR_4;", "const char *VAR_5;", "const char *VAR_6;", "double VAR_7;", "const char *VAR_8;", "const char *VAR_9;", "static int VAR_10 = 0;", "if (VAR_2 & BDRV_O_RDWR) {", "error_setg(VAR_3, \"curl block device does not support writes\");", "return -EROFS;", "}", "qemu_mutex_init(&s->mutex);", "opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);", "qemu_opts_absorb_qdict(opts, VAR_1, &local_err);", "if (local_err) {", "error_propagate(VAR_3, local_err);", "goto out_noclean;", "}", "s->readahead_size = qemu_opt_get_size(opts, CURL_BLOCK_OPT_READAHEAD,\nREAD_AHEAD_DEFAULT);", "if ((s->readahead_size & 0x1ff) != 0) {", "error_setg(VAR_3, \"HTTP_READAHEAD_SIZE %zd is not a multiple of 512\",\ns->readahead_size);", "goto out_noclean;", "}", "s->timeout = qemu_opt_get_number(opts, CURL_BLOCK_OPT_TIMEOUT,\nCURL_TIMEOUT_DEFAULT);", "if (s->timeout > CURL_TIMEOUT_MAX) {", "error_setg(VAR_3, \"timeout parameter is too large or negative\");", "goto out_noclean;", "}", "s->sslverify = qemu_opt_get_bool(opts, CURL_BLOCK_OPT_SSLVERIFY, true);", "VAR_5 = qemu_opt_get(opts, CURL_BLOCK_OPT_COOKIE);", "VAR_6 = qemu_opt_get(opts, CURL_BLOCK_OPT_COOKIE_SECRET);", "if (VAR_5 && VAR_6) {", "error_setg(VAR_3,\n\"curl driver cannot handle both VAR_5 and VAR_5 secret\");", "goto out_noclean;", "}", "if (VAR_6) {", "s->VAR_5 = qcrypto_secret_lookup_as_utf8(VAR_6, VAR_3);", "if (!s->VAR_5) {", "goto out_noclean;", "}", "} else {", "s->VAR_5 = g_strdup(VAR_5);", "}", "VAR_4 = qemu_opt_get(opts, CURL_BLOCK_OPT_URL);", "if (VAR_4 == NULL) {", "error_setg(VAR_3, \"curl block driver requires an 'url' option\");", "goto out_noclean;", "}", "if (!strstart(VAR_4, VAR_0->drv->protocol_name, &VAR_9) ||\n!strstart(VAR_9, \":\n{", "error_setg(VAR_3, \"%s curl driver cannot handle the URL '%s' (does not \"\n\"start with '%s:\nVAR_0->drv->protocol_name);", "goto out_noclean;", "}", "s->username = g_strdup(qemu_opt_get(opts, CURL_BLOCK_OPT_USERNAME));", "VAR_8 = qemu_opt_get(opts, CURL_BLOCK_OPT_PASSWORD_SECRET);", "if (VAR_8) {", "s->password = qcrypto_secret_lookup_as_utf8(VAR_8, VAR_3);", "if (!s->password) {", "goto out_noclean;", "}", "}", "s->proxyusername = g_strdup(\nqemu_opt_get(opts, CURL_BLOCK_OPT_PROXY_USERNAME));", "VAR_8 = qemu_opt_get(opts, CURL_BLOCK_OPT_PROXY_PASSWORD_SECRET);", "if (VAR_8) {", "s->proxypassword = qcrypto_secret_lookup_as_utf8(VAR_8, VAR_3);", "if (!s->proxypassword) {", "goto out_noclean;", "}", "}", "if (!VAR_10) {", "curl_global_init(CURL_GLOBAL_ALL);", "VAR_10 = 1;", "}", "DPRINTF(\"CURL: Opening %s\\n\", VAR_4);", "QSIMPLEQ_INIT(&s->free_state_waitq);", "s->aio_context = bdrv_get_aio_context(VAR_0);", "s->url = g_strdup(VAR_4);", "qemu_mutex_lock(&s->mutex);", "state = curl_find_state(s);", "qemu_mutex_unlock(&s->mutex);", "if (!state) {", "goto out_noclean;", "}", "if (curl_init_state(s, state) < 0) {", "goto out;", "}", "s->accept_range = false;", "curl_easy_setopt(state->curl, CURLOPT_NOBODY, 1);", "curl_easy_setopt(state->curl, CURLOPT_HEADERFUNCTION,\ncurl_header_cb);", "curl_easy_setopt(state->curl, CURLOPT_HEADERDATA, s);", "if (curl_easy_perform(state->curl))\ngoto out;", "if (curl_easy_getinfo(state->curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &VAR_7)) {", "goto out;", "}", "#if LIBCURL_VERSION_NUM >= 0x071304\nif (VAR_7 < 0) {", "pstrcpy(state->errmsg, CURL_ERROR_SIZE,\n\"Server didn't report VAR_4 size.\");", "goto out;", "}", "#else\nif (VAR_7 <= 0) {", "pstrcpy(state->errmsg, CURL_ERROR_SIZE,\n\"Unknown VAR_4 size or zero-length VAR_4.\");", "goto out;", "}", "#endif\ns->len = VAR_7;", "if ((!strncasecmp(s->url, \"http:\n|| !strncasecmp(s->url, \"https:\n&& !s->accept_range) {", "pstrcpy(state->errmsg, CURL_ERROR_SIZE,\n\"Server does not support 'range' (byte ranges).\");", "goto out;", "}", "DPRINTF(\"CURL: Size = %\" PRIu64 \"\\n\", s->len);", "qemu_mutex_lock(&s->mutex);", "curl_clean_state(state);", "qemu_mutex_unlock(&s->mutex);", "curl_easy_cleanup(state->curl);", "state->curl = NULL;", "curl_attach_aio_context(VAR_0, bdrv_get_aio_context(VAR_0));", "qemu_opts_del(opts);", "return 0;", "out:\nerror_setg(VAR_3, \"CURL: Error opening VAR_4: %s\", state->errmsg);", "curl_easy_cleanup(state->curl);", "state->curl = NULL;", "out_noclean:\nqemu_mutex_destroy(&s->mutex);", "g_free(s->VAR_5);", "g_free(s->url);", "qemu_opts_del(opts);", "return -EINVAL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59, 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 93 ], [ 95 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 141, 143, 145 ], [ 147, 149, 151 ], [ 153 ], [ 155 ], [ 159 ], [ 161 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 179, 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 235 ], [ 237 ], [ 239 ], [ 243 ], [ 245 ], [ 247, 249 ], [ 251 ], [ 253, 255 ], [ 257 ], [ 259 ], [ 261 ], [ 269, 271 ], [ 273, 275 ], [ 277 ], [ 279 ], [ 281, 283 ], [ 285, 287 ], [ 289 ], [ 291 ], [ 293, 297 ], [ 301, 303, 305 ], [ 307, 309 ], [ 311 ], [ 313 ], [ 315 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 331 ], [ 335 ], [ 337 ], [ 341, 343 ], [ 345 ], [ 347 ], [ 349, 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ] ]
2,155
static void mp3_write_xing(AVFormatContext *s) { MP3Context *mp3 = s->priv_data; AVCodecContext *codec = s->streams[mp3->audio_stream_idx]->codec; int32_t header; MPADecodeHeader mpah; int srate_idx, i, channels; int bitrate_idx; int best_bitrate_idx; int best_bitrate_error = INT_MAX; int xing_offset; int ver = 0; int lsf, bytes_needed; if (!s->pb->seekable || !mp3->write_xing) return; for (i = 0; i < FF_ARRAY_ELEMS(avpriv_mpa_freq_tab); i++) { const uint16_t base_freq = avpriv_mpa_freq_tab[i]; if (codec->sample_rate == base_freq) ver = 0x3; // MPEG 1 else if (codec->sample_rate == base_freq / 2) ver = 0x2; // MPEG 2 else if (codec->sample_rate == base_freq / 4) ver = 0x0; // MPEG 2.5 else continue; srate_idx = i; break; } if (i == FF_ARRAY_ELEMS(avpriv_mpa_freq_tab)) { av_log(s, AV_LOG_WARNING, "Unsupported sample rate, not writing Xing " "header.\n"); return; } switch (codec->channels) { case 1: channels = MPA_MONO; break; case 2: channels = MPA_STEREO; break; default: av_log(s, AV_LOG_WARNING, "Unsupported number of channels, " "not writing Xing header.\n"); return; } /* dummy MPEG audio header */ header = 0xff << 24; // sync header |= (0x7 << 5 | ver << 3 | 0x1 << 1 | 0x1) << 16; // sync/audio-version/layer 3/no crc*/ header |= (srate_idx << 2) << 8; header |= channels << 6; lsf = !((header & (1 << 20) && header & (1 << 19))); xing_offset = xing_offtbl[ver != 3][channels == 1]; bytes_needed = 4 // header + xing_offset + 4 // xing tag + 4 // frames/size/toc flags + 4 // frames + 4 // size + XING_TOC_SIZE; // toc for (bitrate_idx = 1; bitrate_idx < 15; bitrate_idx++) { int bit_rate = 1000 * avpriv_mpa_bitrate_tab[lsf][3 - 1][bitrate_idx]; int error = FFABS(bit_rate - codec->bit_rate); if (error < best_bitrate_error){ best_bitrate_error = error; best_bitrate_idx = bitrate_idx; } } for (bitrate_idx = best_bitrate_idx; bitrate_idx < 15; bitrate_idx++) { int32_t mask = bitrate_idx << (4 + 8); header |= mask; avpriv_mpegaudio_decode_header(&mpah, header); if (bytes_needed <= mpah.frame_size) break; header &= ~mask; } avio_wb32(s->pb, header); avpriv_mpegaudio_decode_header(&mpah, header); av_assert0(mpah.frame_size >= XING_MAX_SIZE); ffio_fill(s->pb, 0, xing_offset); mp3->xing_offset = avio_tell(s->pb); ffio_wfourcc(s->pb, "Xing"); avio_wb32(s->pb, 0x01 | 0x02 | 0x04); // frames / size / TOC mp3->size = mpah.frame_size; mp3->want = 1; avio_wb32(s->pb, 0); // frames avio_wb32(s->pb, 0); // size // TOC for (i = 0; i < XING_TOC_SIZE; i++) avio_w8(s->pb, 255 * i / XING_TOC_SIZE); ffio_fill(s->pb, 0, mpah.frame_size - bytes_needed); }
false
FFmpeg
ef363ebd596da18f889a7d4845023a23dfac84c9
static void mp3_write_xing(AVFormatContext *s) { MP3Context *mp3 = s->priv_data; AVCodecContext *codec = s->streams[mp3->audio_stream_idx]->codec; int32_t header; MPADecodeHeader mpah; int srate_idx, i, channels; int bitrate_idx; int best_bitrate_idx; int best_bitrate_error = INT_MAX; int xing_offset; int ver = 0; int lsf, bytes_needed; if (!s->pb->seekable || !mp3->write_xing) return; for (i = 0; i < FF_ARRAY_ELEMS(avpriv_mpa_freq_tab); i++) { const uint16_t base_freq = avpriv_mpa_freq_tab[i]; if (codec->sample_rate == base_freq) ver = 0x3; else if (codec->sample_rate == base_freq / 2) ver = 0x2; else if (codec->sample_rate == base_freq / 4) ver = 0x0; .5 else continue; srate_idx = i; break; } if (i == FF_ARRAY_ELEMS(avpriv_mpa_freq_tab)) { av_log(s, AV_LOG_WARNING, "Unsupported sample rate, not writing Xing " "header.\n"); return; } switch (codec->channels) { case 1: channels = MPA_MONO; break; case 2: channels = MPA_STEREO; break; default: av_log(s, AV_LOG_WARNING, "Unsupported number of channels, " "not writing Xing header.\n"); return; } header = 0xff << 24; header |= (0x7 << 5 | ver << 3 | 0x1 << 1 | 0x1) << 16; /audio-version/layer 3/no crc*/ header |= (srate_idx << 2) << 8; header |= channels << 6; lsf = !((header & (1 << 20) && header & (1 << 19))); xing_offset = xing_offtbl[ver != 3][channels == 1]; bytes_needed = 4 + xing_offset + 4 + 4 + 4 + 4 + XING_TOC_SIZE; for (bitrate_idx = 1; bitrate_idx < 15; bitrate_idx++) { int bit_rate = 1000 * avpriv_mpa_bitrate_tab[lsf][3 - 1][bitrate_idx]; int error = FFABS(bit_rate - codec->bit_rate); if (error < best_bitrate_error){ best_bitrate_error = error; best_bitrate_idx = bitrate_idx; } } for (bitrate_idx = best_bitrate_idx; bitrate_idx < 15; bitrate_idx++) { int32_t mask = bitrate_idx << (4 + 8); header |= mask; avpriv_mpegaudio_decode_header(&mpah, header); if (bytes_needed <= mpah.frame_size) break; header &= ~mask; } avio_wb32(s->pb, header); avpriv_mpegaudio_decode_header(&mpah, header); av_assert0(mpah.frame_size >= XING_MAX_SIZE); ffio_fill(s->pb, 0, xing_offset); mp3->xing_offset = avio_tell(s->pb); ffio_wfourcc(s->pb, "Xing"); avio_wb32(s->pb, 0x01 | 0x02 | 0x04); / size / TOC mp3->size = mpah.frame_size; mp3->want = 1; avio_wb32(s->pb, 0); avio_wb32(s->pb, 0); for (i = 0; i < XING_TOC_SIZE; i++) avio_w8(s->pb, 255 * i / XING_TOC_SIZE); ffio_fill(s->pb, 0, mpah.frame_size - bytes_needed); }
{ "code": [], "line_no": [] }
static void FUNC_0(AVFormatContext *VAR_0) { MP3Context *mp3 = VAR_0->priv_data; AVCodecContext *codec = VAR_0->streams[mp3->audio_stream_idx]->codec; int32_t header; MPADecodeHeader mpah; int VAR_1, VAR_2, VAR_3; int VAR_4; int VAR_5; int VAR_6 = INT_MAX; int VAR_7; int VAR_8 = 0; int VAR_9, VAR_10; if (!VAR_0->pb->seekable || !mp3->write_xing) return; for (VAR_2 = 0; VAR_2 < FF_ARRAY_ELEMS(avpriv_mpa_freq_tab); VAR_2++) { const uint16_t base_freq = avpriv_mpa_freq_tab[VAR_2]; if (codec->sample_rate == base_freq) VAR_8 = 0x3; else if (codec->sample_rate == base_freq / 2) VAR_8 = 0x2; else if (codec->sample_rate == base_freq / 4) VAR_8 = 0x0; .5 else continue; VAR_1 = VAR_2; break; } if (VAR_2 == FF_ARRAY_ELEMS(avpriv_mpa_freq_tab)) { av_log(VAR_0, AV_LOG_WARNING, "Unsupported sample rate, not writing Xing " "header.\n"); return; } switch (codec->VAR_3) { case 1: VAR_3 = MPA_MONO; break; case 2: VAR_3 = MPA_STEREO; break; default: av_log(VAR_0, AV_LOG_WARNING, "Unsupported number of VAR_3, " "not writing Xing header.\n"); return; } header = 0xff << 24; header |= (0x7 << 5 | VAR_8 << 3 | 0x1 << 1 | 0x1) << 16; /audio-version/layer 3/no crc*/ header |= (VAR_1 << 2) << 8; header |= VAR_3 << 6; VAR_9 = !((header & (1 << 20) && header & (1 << 19))); VAR_7 = xing_offtbl[VAR_8 != 3][VAR_3 == 1]; VAR_10 = 4 + VAR_7 + 4 + 4 + 4 + 4 + XING_TOC_SIZE; for (VAR_4 = 1; VAR_4 < 15; VAR_4++) { int VAR_11 = 1000 * avpriv_mpa_bitrate_tab[VAR_9][3 - 1][VAR_4]; int VAR_12 = FFABS(VAR_11 - codec->VAR_11); if (VAR_12 < VAR_6){ VAR_6 = VAR_12; VAR_5 = VAR_4; } } for (VAR_4 = VAR_5; VAR_4 < 15; VAR_4++) { int32_t mask = VAR_4 << (4 + 8); header |= mask; avpriv_mpegaudio_decode_header(&mpah, header); if (VAR_10 <= mpah.frame_size) break; header &= ~mask; } avio_wb32(VAR_0->pb, header); avpriv_mpegaudio_decode_header(&mpah, header); av_assert0(mpah.frame_size >= XING_MAX_SIZE); ffio_fill(VAR_0->pb, 0, VAR_7); mp3->VAR_7 = avio_tell(VAR_0->pb); ffio_wfourcc(VAR_0->pb, "Xing"); avio_wb32(VAR_0->pb, 0x01 | 0x02 | 0x04); / size / TOC mp3->size = mpah.frame_size; mp3->want = 1; avio_wb32(VAR_0->pb, 0); avio_wb32(VAR_0->pb, 0); for (VAR_2 = 0; VAR_2 < XING_TOC_SIZE; VAR_2++) avio_w8(VAR_0->pb, 255 * VAR_2 / XING_TOC_SIZE); ffio_fill(VAR_0->pb, 0, mpah.frame_size - VAR_10); }
[ "static void FUNC_0(AVFormatContext *VAR_0)\n{", "MP3Context *mp3 = VAR_0->priv_data;", "AVCodecContext *codec = VAR_0->streams[mp3->audio_stream_idx]->codec;", "int32_t header;", "MPADecodeHeader mpah;", "int VAR_1, VAR_2, VAR_3;", "int VAR_4;", "int VAR_5;", "int VAR_6 = INT_MAX;", "int VAR_7;", "int VAR_8 = 0;", "int VAR_9, VAR_10;", "if (!VAR_0->pb->seekable || !mp3->write_xing)\nreturn;", "for (VAR_2 = 0; VAR_2 < FF_ARRAY_ELEMS(avpriv_mpa_freq_tab); VAR_2++) {", "const uint16_t base_freq = avpriv_mpa_freq_tab[VAR_2];", "if (codec->sample_rate == base_freq) VAR_8 = 0x3;", "else if (codec->sample_rate == base_freq / 2) VAR_8 = 0x2;", "else if (codec->sample_rate == base_freq / 4) VAR_8 = 0x0; .5", "else continue;", "VAR_1 = VAR_2;", "break;", "}", "if (VAR_2 == FF_ARRAY_ELEMS(avpriv_mpa_freq_tab)) {", "av_log(VAR_0, AV_LOG_WARNING, \"Unsupported sample rate, not writing Xing \"\n\"header.\\n\");", "return;", "}", "switch (codec->VAR_3) {", "case 1: VAR_3 = MPA_MONO; break;", "case 2: VAR_3 = MPA_STEREO; break;", "default: av_log(VAR_0, AV_LOG_WARNING, \"Unsupported number of VAR_3, \"\n\"not writing Xing header.\\n\");", "return;", "}", "header = 0xff << 24;", "header |= (0x7 << 5 | VAR_8 << 3 | 0x1 << 1 | 0x1) << 16; /audio-version/layer 3/no crc*/", "header |= (VAR_1 << 2) << 8;", "header |= VAR_3 << 6;", "VAR_9 = !((header & (1 << 20) && header & (1 << 19)));", "VAR_7 = xing_offtbl[VAR_8 != 3][VAR_3 == 1];", "VAR_10 = 4\n+ VAR_7\n+ 4\n+ 4\n+ 4\n+ 4\n+ XING_TOC_SIZE;", "for (VAR_4 = 1; VAR_4 < 15; VAR_4++) {", "int VAR_11 = 1000 * avpriv_mpa_bitrate_tab[VAR_9][3 - 1][VAR_4];", "int VAR_12 = FFABS(VAR_11 - codec->VAR_11);", "if (VAR_12 < VAR_6){", "VAR_6 = VAR_12;", "VAR_5 = VAR_4;", "}", "}", "for (VAR_4 = VAR_5; VAR_4 < 15; VAR_4++) {", "int32_t mask = VAR_4 << (4 + 8);", "header |= mask;", "avpriv_mpegaudio_decode_header(&mpah, header);", "if (VAR_10 <= mpah.frame_size)\nbreak;", "header &= ~mask;", "}", "avio_wb32(VAR_0->pb, header);", "avpriv_mpegaudio_decode_header(&mpah, header);", "av_assert0(mpah.frame_size >= XING_MAX_SIZE);", "ffio_fill(VAR_0->pb, 0, VAR_7);", "mp3->VAR_7 = avio_tell(VAR_0->pb);", "ffio_wfourcc(VAR_0->pb, \"Xing\");", "avio_wb32(VAR_0->pb, 0x01 | 0x02 | 0x04); / size / TOC", "mp3->size = mpah.frame_size;", "mp3->want = 1;", "avio_wb32(VAR_0->pb, 0);", "avio_wb32(VAR_0->pb, 0);", "for (VAR_2 = 0; VAR_2 < XING_TOC_SIZE; VAR_2++)", "avio_w8(VAR_0->pb, 255 * VAR_2 / XING_TOC_SIZE);", "ffio_fill(VAR_0->pb, 0, mpah.frame_size - VAR_10);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29, 31 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 101 ], [ 103, 105, 107, 109, 111, 113, 115 ], [ 119 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 147 ], [ 151, 153 ], [ 157 ], [ 159 ], [ 163 ], [ 167 ], [ 171 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 185 ], [ 187 ], [ 191 ], [ 193 ], [ 199 ], [ 201 ], [ 205 ], [ 207 ] ]
2,156
static int flashsv_encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf_size, void *data) { FlashSVContext * const s = avctx->priv_data; AVFrame *pict = data; AVFrame * const p = &s->frame; int res; int I_frame = 0; int opt_w, opt_h; *p = *pict; /* First frame needs to be a keyframe */ if (avctx->frame_number == 0) { s->previous_frame = av_mallocz(p->linesize[0]*s->image_height); if (!s->previous_frame) { av_log(avctx, AV_LOG_ERROR, "Memory allocation failed.\n"); return -1; } I_frame = 1; } /* Check the placement of keyframes */ if (avctx->gop_size > 0) { if (avctx->frame_number >= s->last_key_frame + avctx->gop_size) { I_frame = 1; } } #if 0 int w, h; int optim_sizes[16][16]; int smallest_size; //Try all possible combinations and store the encoded frame sizes for (w=1 ; w<17 ; w++) { for (h=1 ; h<17 ; h++) { optim_sizes[w-1][h-1] = encode_bitstream(s, p, s->encbuffer, s->image_width*s->image_height*4, w*16, h*16, s->previous_frame); //av_log(avctx, AV_LOG_ERROR, "[%d][%d]size = %d\n",w,h,optim_sizes[w-1][h-1]); } } //Search for the smallest framesize and encode the frame with those parameters smallest_size=optim_sizes[0][0]; opt_w = 0; opt_h = 0; for (w=0 ; w<16 ; w++) { for (h=0 ; h<16 ; h++) { if (optim_sizes[w][h] < smallest_size) { smallest_size = optim_sizes[w][h]; opt_w = w; opt_h = h; } } } res = encode_bitstream(s, p, buf, buf_size, (opt_w+1)*16, (opt_h+1)*16, s->previous_frame); av_log(avctx, AV_LOG_ERROR, "[%d][%d]optimal size = %d, res = %d|\n", opt_w, opt_h, smallest_size, res); if (buf_size < res) av_log(avctx, AV_LOG_ERROR, "buf_size %d < res %d\n", buf_size, res); #else opt_w=1; opt_h=1; if (buf_size < s->image_width*s->image_height*3) { //Conservative upper bound check for compressed data av_log(avctx, AV_LOG_ERROR, "buf_size %d < %d\n", buf_size, s->image_width*s->image_height*3); return -1; } res = encode_bitstream(s, p, buf, buf_size, opt_w*16, opt_h*16, s->previous_frame, &I_frame); #endif //save the current frame memcpy(s->previous_frame, p->data[0], s->image_height*p->linesize[0]); //mark the frame type so the muxer can mux it correctly if (I_frame) { p->pict_type = FF_I_TYPE; p->key_frame = 1; s->last_key_frame = avctx->frame_number; av_log(avctx, AV_LOG_DEBUG, "Inserting key frame at frame %d\n",avctx->frame_number); } else { p->pict_type = FF_P_TYPE; p->key_frame = 0; } avctx->coded_frame = p; return res; }
false
FFmpeg
d2bc04738b842169b6e32160ffa81db9c868eec4
static int flashsv_encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf_size, void *data) { FlashSVContext * const s = avctx->priv_data; AVFrame *pict = data; AVFrame * const p = &s->frame; int res; int I_frame = 0; int opt_w, opt_h; *p = *pict; if (avctx->frame_number == 0) { s->previous_frame = av_mallocz(p->linesize[0]*s->image_height); if (!s->previous_frame) { av_log(avctx, AV_LOG_ERROR, "Memory allocation failed.\n"); return -1; } I_frame = 1; } if (avctx->gop_size > 0) { if (avctx->frame_number >= s->last_key_frame + avctx->gop_size) { I_frame = 1; } } #if 0 int w, h; int optim_sizes[16][16]; int smallest_size; for (w=1 ; w<17 ; w++) { for (h=1 ; h<17 ; h++) { optim_sizes[w-1][h-1] = encode_bitstream(s, p, s->encbuffer, s->image_width*s->image_height*4, w*16, h*16, s->previous_frame); } } smallest_size=optim_sizes[0][0]; opt_w = 0; opt_h = 0; for (w=0 ; w<16 ; w++) { for (h=0 ; h<16 ; h++) { if (optim_sizes[w][h] < smallest_size) { smallest_size = optim_sizes[w][h]; opt_w = w; opt_h = h; } } } res = encode_bitstream(s, p, buf, buf_size, (opt_w+1)*16, (opt_h+1)*16, s->previous_frame); av_log(avctx, AV_LOG_ERROR, "[%d][%d]optimal size = %d, res = %d|\n", opt_w, opt_h, smallest_size, res); if (buf_size < res) av_log(avctx, AV_LOG_ERROR, "buf_size %d < res %d\n", buf_size, res); #else opt_w=1; opt_h=1; if (buf_size < s->image_width*s->image_height*3) { av_log(avctx, AV_LOG_ERROR, "buf_size %d < %d\n", buf_size, s->image_width*s->image_height*3); return -1; } res = encode_bitstream(s, p, buf, buf_size, opt_w*16, opt_h*16, s->previous_frame, &I_frame); #endif memcpy(s->previous_frame, p->data[0], s->image_height*p->linesize[0]); if (I_frame) { p->pict_type = FF_I_TYPE; p->key_frame = 1; s->last_key_frame = avctx->frame_number; av_log(avctx, AV_LOG_DEBUG, "Inserting key frame at frame %d\n",avctx->frame_number); } else { p->pict_type = FF_P_TYPE; p->key_frame = 0; } avctx->coded_frame = p; return res; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, uint8_t *VAR_1, int VAR_2, void *VAR_3) { FlashSVContext * const s = VAR_0->priv_data; AVFrame *pict = VAR_3; AVFrame * const p = &s->frame; int VAR_4; int VAR_5 = 0; int VAR_6, VAR_7; *p = *pict; if (VAR_0->frame_number == 0) { s->previous_frame = av_mallocz(p->linesize[0]*s->image_height); if (!s->previous_frame) { av_log(VAR_0, AV_LOG_ERROR, "Memory allocation failed.\n"); return -1; } VAR_5 = 1; } if (VAR_0->gop_size > 0) { if (VAR_0->frame_number >= s->last_key_frame + VAR_0->gop_size) { VAR_5 = 1; } } #if 0 int w, h; int optim_sizes[16][16]; int smallest_size; for (w=1 ; w<17 ; w++) { for (h=1 ; h<17 ; h++) { optim_sizes[w-1][h-1] = encode_bitstream(s, p, s->encbuffer, s->image_width*s->image_height*4, w*16, h*16, s->previous_frame); } } smallest_size=optim_sizes[0][0]; VAR_6 = 0; VAR_7 = 0; for (w=0 ; w<16 ; w++) { for (h=0 ; h<16 ; h++) { if (optim_sizes[w][h] < smallest_size) { smallest_size = optim_sizes[w][h]; VAR_6 = w; VAR_7 = h; } } } VAR_4 = encode_bitstream(s, p, VAR_1, VAR_2, (VAR_6+1)*16, (VAR_7+1)*16, s->previous_frame); av_log(VAR_0, AV_LOG_ERROR, "[%d][%d]optimal size = %d, VAR_4 = %d|\n", VAR_6, VAR_7, smallest_size, VAR_4); if (VAR_2 < VAR_4) av_log(VAR_0, AV_LOG_ERROR, "VAR_2 %d < VAR_4 %d\n", VAR_2, VAR_4); #else VAR_6=1; VAR_7=1; if (VAR_2 < s->image_width*s->image_height*3) { av_log(VAR_0, AV_LOG_ERROR, "VAR_2 %d < %d\n", VAR_2, s->image_width*s->image_height*3); return -1; } VAR_4 = encode_bitstream(s, p, VAR_1, VAR_2, VAR_6*16, VAR_7*16, s->previous_frame, &VAR_5); #endif memcpy(s->previous_frame, p->VAR_3[0], s->image_height*p->linesize[0]); if (VAR_5) { p->pict_type = FF_I_TYPE; p->key_frame = 1; s->last_key_frame = VAR_0->frame_number; av_log(VAR_0, AV_LOG_DEBUG, "Inserting key frame at frame %d\n",VAR_0->frame_number); } else { p->pict_type = FF_P_TYPE; p->key_frame = 0; } VAR_0->coded_frame = p; return VAR_4; }
[ "static int FUNC_0(AVCodecContext *VAR_0, uint8_t *VAR_1, int VAR_2, void *VAR_3)\n{", "FlashSVContext * const s = VAR_0->priv_data;", "AVFrame *pict = VAR_3;", "AVFrame * const p = &s->frame;", "int VAR_4;", "int VAR_5 = 0;", "int VAR_6, VAR_7;", "*p = *pict;", "if (VAR_0->frame_number == 0) {", "s->previous_frame = av_mallocz(p->linesize[0]*s->image_height);", "if (!s->previous_frame) {", "av_log(VAR_0, AV_LOG_ERROR, \"Memory allocation failed.\\n\");", "return -1;", "}", "VAR_5 = 1;", "}", "if (VAR_0->gop_size > 0) {", "if (VAR_0->frame_number >= s->last_key_frame + VAR_0->gop_size) {", "VAR_5 = 1;", "}", "}", "#if 0\nint w, h;", "int optim_sizes[16][16];", "int smallest_size;", "for (w=1 ; w<17 ; w++) {", "for (h=1 ; h<17 ; h++) {", "optim_sizes[w-1][h-1] = encode_bitstream(s, p, s->encbuffer, s->image_width*s->image_height*4, w*16, h*16, s->previous_frame);", "}", "}", "smallest_size=optim_sizes[0][0];", "VAR_6 = 0;", "VAR_7 = 0;", "for (w=0 ; w<16 ; w++) {", "for (h=0 ; h<16 ; h++) {", "if (optim_sizes[w][h] < smallest_size) {", "smallest_size = optim_sizes[w][h];", "VAR_6 = w;", "VAR_7 = h;", "}", "}", "}", "VAR_4 = encode_bitstream(s, p, VAR_1, VAR_2, (VAR_6+1)*16, (VAR_7+1)*16, s->previous_frame);", "av_log(VAR_0, AV_LOG_ERROR, \"[%d][%d]optimal size = %d, VAR_4 = %d|\\n\", VAR_6, VAR_7, smallest_size, VAR_4);", "if (VAR_2 < VAR_4)\nav_log(VAR_0, AV_LOG_ERROR, \"VAR_2 %d < VAR_4 %d\\n\", VAR_2, VAR_4);", "#else\nVAR_6=1;", "VAR_7=1;", "if (VAR_2 < s->image_width*s->image_height*3) {", "av_log(VAR_0, AV_LOG_ERROR, \"VAR_2 %d < %d\\n\", VAR_2, s->image_width*s->image_height*3);", "return -1;", "}", "VAR_4 = encode_bitstream(s, p, VAR_1, VAR_2, VAR_6*16, VAR_7*16, s->previous_frame, &VAR_5);", "#endif\nmemcpy(s->previous_frame, p->VAR_3[0], s->image_height*p->linesize[0]);", "if (VAR_5) {", "p->pict_type = FF_I_TYPE;", "p->key_frame = 1;", "s->last_key_frame = VAR_0->frame_number;", "av_log(VAR_0, AV_LOG_DEBUG, \"Inserting key frame at frame %d\\n\",VAR_0->frame_number);", "} else {", "p->pict_type = FF_P_TYPE;", "p->key_frame = 0;", "}", "VAR_0->coded_frame = p;", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113, 115 ], [ 119, 121 ], [ 123 ], [ 127 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141, 145 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 171 ], [ 175 ], [ 177 ] ]
2,159
static void draw_bar(TestSourceContext *test, const uint8_t color[4], int x, int y, int w, int h, AVFrame *frame) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format); uint8_t *p, *p0; int plane; x = FFMIN(x, test->w - 1); y = FFMIN(y, test->h - 1); w = FFMIN(w, test->w - x); h = FFMIN(h, test->h - y); av_assert0(x + w <= test->w); av_assert0(y + h <= test->h); for (plane = 0; frame->data[plane]; plane++) { const int c = color[plane]; const int linesize = frame->linesize[plane]; int i, px, py, pw, ph; if (plane == 1 || plane == 2) { px = x >> desc->log2_chroma_w; pw = AV_CEIL_RSHIFT(w, desc->log2_chroma_w); py = y >> desc->log2_chroma_h; ph = AV_CEIL_RSHIFT(h, desc->log2_chroma_h); } else { px = x; pw = w; py = y; ph = h; } p0 = p = frame->data[plane] + py * linesize + px; memset(p, c, pw); p += linesize; for (i = 1; i < ph; i++, p += linesize) memcpy(p, p0, pw); } }
false
FFmpeg
745f4bcc2c1deaa562cce01fa52e38b0220aed31
static void draw_bar(TestSourceContext *test, const uint8_t color[4], int x, int y, int w, int h, AVFrame *frame) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format); uint8_t *p, *p0; int plane; x = FFMIN(x, test->w - 1); y = FFMIN(y, test->h - 1); w = FFMIN(w, test->w - x); h = FFMIN(h, test->h - y); av_assert0(x + w <= test->w); av_assert0(y + h <= test->h); for (plane = 0; frame->data[plane]; plane++) { const int c = color[plane]; const int linesize = frame->linesize[plane]; int i, px, py, pw, ph; if (plane == 1 || plane == 2) { px = x >> desc->log2_chroma_w; pw = AV_CEIL_RSHIFT(w, desc->log2_chroma_w); py = y >> desc->log2_chroma_h; ph = AV_CEIL_RSHIFT(h, desc->log2_chroma_h); } else { px = x; pw = w; py = y; ph = h; } p0 = p = frame->data[plane] + py * linesize + px; memset(p, c, pw); p += linesize; for (i = 1; i < ph; i++, p += linesize) memcpy(p, p0, pw); } }
{ "code": [], "line_no": [] }
static void FUNC_0(TestSourceContext *VAR_0, const uint8_t VAR_1[4], int VAR_2, int VAR_3, int VAR_4, int VAR_5, AVFrame *VAR_6) { const AVPixFmtDescriptor *VAR_7 = av_pix_fmt_desc_get(VAR_6->format); uint8_t *p, *p0; int VAR_8; VAR_2 = FFMIN(VAR_2, VAR_0->VAR_4 - 1); VAR_3 = FFMIN(VAR_3, VAR_0->VAR_5 - 1); VAR_4 = FFMIN(VAR_4, VAR_0->VAR_4 - VAR_2); VAR_5 = FFMIN(VAR_5, VAR_0->VAR_5 - VAR_3); av_assert0(VAR_2 + VAR_4 <= VAR_0->VAR_4); av_assert0(VAR_3 + VAR_5 <= VAR_0->VAR_5); for (VAR_8 = 0; VAR_6->data[VAR_8]; VAR_8++) { const int c = VAR_1[VAR_8]; const int linesize = VAR_6->linesize[VAR_8]; int i, px, py, pw, ph; if (VAR_8 == 1 || VAR_8 == 2) { px = VAR_2 >> VAR_7->log2_chroma_w; pw = AV_CEIL_RSHIFT(VAR_4, VAR_7->log2_chroma_w); py = VAR_3 >> VAR_7->log2_chroma_h; ph = AV_CEIL_RSHIFT(VAR_5, VAR_7->log2_chroma_h); } else { px = VAR_2; pw = VAR_4; py = VAR_3; ph = VAR_5; } p0 = p = VAR_6->data[VAR_8] + py * linesize + px; memset(p, c, pw); p += linesize; for (i = 1; i < ph; i++, p += linesize) memcpy(p, p0, pw); } }
[ "static void FUNC_0(TestSourceContext *VAR_0, const uint8_t VAR_1[4],\nint VAR_2, int VAR_3, int VAR_4, int VAR_5,\nAVFrame *VAR_6)\n{", "const AVPixFmtDescriptor *VAR_7 = av_pix_fmt_desc_get(VAR_6->format);", "uint8_t *p, *p0;", "int VAR_8;", "VAR_2 = FFMIN(VAR_2, VAR_0->VAR_4 - 1);", "VAR_3 = FFMIN(VAR_3, VAR_0->VAR_5 - 1);", "VAR_4 = FFMIN(VAR_4, VAR_0->VAR_4 - VAR_2);", "VAR_5 = FFMIN(VAR_5, VAR_0->VAR_5 - VAR_3);", "av_assert0(VAR_2 + VAR_4 <= VAR_0->VAR_4);", "av_assert0(VAR_3 + VAR_5 <= VAR_0->VAR_5);", "for (VAR_8 = 0; VAR_6->data[VAR_8]; VAR_8++) {", "const int c = VAR_1[VAR_8];", "const int linesize = VAR_6->linesize[VAR_8];", "int i, px, py, pw, ph;", "if (VAR_8 == 1 || VAR_8 == 2) {", "px = VAR_2 >> VAR_7->log2_chroma_w;", "pw = AV_CEIL_RSHIFT(VAR_4, VAR_7->log2_chroma_w);", "py = VAR_3 >> VAR_7->log2_chroma_h;", "ph = AV_CEIL_RSHIFT(VAR_5, VAR_7->log2_chroma_h);", "} else {", "px = VAR_2;", "pw = VAR_4;", "py = VAR_3;", "ph = VAR_5;", "}", "p0 = p = VAR_6->data[VAR_8] + py * linesize + px;", "memset(p, c, pw);", "p += linesize;", "for (i = 1; i < ph; i++, p += linesize)", "memcpy(p, p0, pw);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ] ]
2,161
static void set_kernel_args_old(const struct arm_boot_info *info) { target_phys_addr_t p; const char *s; int initrd_size = info->initrd_size; target_phys_addr_t base = info->loader_start; /* see linux/include/asm-arm/setup.h */ p = base + KERNEL_ARGS_ADDR; /* page_size */ WRITE_WORD(p, 4096); /* nr_pages */ WRITE_WORD(p, info->ram_size / 4096); /* ramdisk_size */ WRITE_WORD(p, 0); #define FLAG_READONLY 1 #define FLAG_RDLOAD 4 #define FLAG_RDPROMPT 8 /* flags */ WRITE_WORD(p, FLAG_READONLY | FLAG_RDLOAD | FLAG_RDPROMPT); /* rootdev */ WRITE_WORD(p, (31 << 8) | 0); /* /dev/mtdblock0 */ /* video_num_cols */ WRITE_WORD(p, 0); /* video_num_rows */ WRITE_WORD(p, 0); /* video_x */ WRITE_WORD(p, 0); /* video_y */ WRITE_WORD(p, 0); /* memc_control_reg */ WRITE_WORD(p, 0); /* unsigned char sounddefault */ /* unsigned char adfsdrives */ /* unsigned char bytes_per_char_h */ /* unsigned char bytes_per_char_v */ WRITE_WORD(p, 0); /* pages_in_bank[4] */ WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); /* pages_in_vram */ WRITE_WORD(p, 0); /* initrd_start */ if (initrd_size) WRITE_WORD(p, info->loader_start + INITRD_LOAD_ADDR); else WRITE_WORD(p, 0); /* initrd_size */ WRITE_WORD(p, initrd_size); /* rd_start */ WRITE_WORD(p, 0); /* system_rev */ WRITE_WORD(p, 0); /* system_serial_low */ WRITE_WORD(p, 0); /* system_serial_high */ WRITE_WORD(p, 0); /* mem_fclk_21285 */ WRITE_WORD(p, 0); /* zero unused fields */ while (p < base + KERNEL_ARGS_ADDR + 256 + 1024) { WRITE_WORD(p, 0); } s = info->kernel_cmdline; if (s) { cpu_physical_memory_write(p, (void *)s, strlen(s) + 1); } else { WRITE_WORD(p, 0); } }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void set_kernel_args_old(const struct arm_boot_info *info) { target_phys_addr_t p; const char *s; int initrd_size = info->initrd_size; target_phys_addr_t base = info->loader_start; p = base + KERNEL_ARGS_ADDR; WRITE_WORD(p, 4096); WRITE_WORD(p, info->ram_size / 4096); WRITE_WORD(p, 0); #define FLAG_READONLY 1 #define FLAG_RDLOAD 4 #define FLAG_RDPROMPT 8 WRITE_WORD(p, FLAG_READONLY | FLAG_RDLOAD | FLAG_RDPROMPT); WRITE_WORD(p, (31 << 8) | 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); if (initrd_size) WRITE_WORD(p, info->loader_start + INITRD_LOAD_ADDR); else WRITE_WORD(p, 0); WRITE_WORD(p, initrd_size); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); while (p < base + KERNEL_ARGS_ADDR + 256 + 1024) { WRITE_WORD(p, 0); } s = info->kernel_cmdline; if (s) { cpu_physical_memory_write(p, (void *)s, strlen(s) + 1); } else { WRITE_WORD(p, 0); } }
{ "code": [], "line_no": [] }
static void FUNC_0(const struct arm_boot_info *VAR_0) { target_phys_addr_t p; const char *VAR_1; int VAR_2 = VAR_0->VAR_2; target_phys_addr_t base = VAR_0->loader_start; p = base + KERNEL_ARGS_ADDR; WRITE_WORD(p, 4096); WRITE_WORD(p, VAR_0->ram_size / 4096); WRITE_WORD(p, 0); #define FLAG_READONLY 1 #define FLAG_RDLOAD 4 #define FLAG_RDPROMPT 8 WRITE_WORD(p, FLAG_READONLY | FLAG_RDLOAD | FLAG_RDPROMPT); WRITE_WORD(p, (31 << 8) | 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); if (VAR_2) WRITE_WORD(p, VAR_0->loader_start + INITRD_LOAD_ADDR); else WRITE_WORD(p, 0); WRITE_WORD(p, VAR_2); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); while (p < base + KERNEL_ARGS_ADDR + 256 + 1024) { WRITE_WORD(p, 0); } VAR_1 = VAR_0->kernel_cmdline; if (VAR_1) { cpu_physical_memory_write(p, (void *)VAR_1, strlen(VAR_1) + 1); } else { WRITE_WORD(p, 0); } }
[ "static void FUNC_0(const struct arm_boot_info *VAR_0)\n{", "target_phys_addr_t p;", "const char *VAR_1;", "int VAR_2 = VAR_0->VAR_2;", "target_phys_addr_t base = VAR_0->loader_start;", "p = base + KERNEL_ARGS_ADDR;", "WRITE_WORD(p, 4096);", "WRITE_WORD(p, VAR_0->ram_size / 4096);", "WRITE_WORD(p, 0);", "#define FLAG_READONLY\t1\n#define FLAG_RDLOAD\t4\n#define FLAG_RDPROMPT\t8\nWRITE_WORD(p, FLAG_READONLY | FLAG_RDLOAD | FLAG_RDPROMPT);", "WRITE_WORD(p, (31 << 8) | 0);", "WRITE_WORD(p, 0);", "WRITE_WORD(p, 0);", "WRITE_WORD(p, 0);", "WRITE_WORD(p, 0);", "WRITE_WORD(p, 0);", "WRITE_WORD(p, 0);", "WRITE_WORD(p, 0);", "WRITE_WORD(p, 0);", "WRITE_WORD(p, 0);", "WRITE_WORD(p, 0);", "WRITE_WORD(p, 0);", "if (VAR_2)\nWRITE_WORD(p, VAR_0->loader_start + INITRD_LOAD_ADDR);", "else\nWRITE_WORD(p, 0);", "WRITE_WORD(p, VAR_2);", "WRITE_WORD(p, 0);", "WRITE_WORD(p, 0);", "WRITE_WORD(p, 0);", "WRITE_WORD(p, 0);", "WRITE_WORD(p, 0);", "while (p < base + KERNEL_ARGS_ADDR + 256 + 1024) {", "WRITE_WORD(p, 0);", "}", "VAR_1 = VAR_0->kernel_cmdline;", "if (VAR_1) {", "cpu_physical_memory_write(p, (void *)VAR_1, strlen(VAR_1) + 1);", "} else {", "WRITE_WORD(p, 0);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 17 ], [ 21 ], [ 25 ], [ 29 ], [ 31, 33, 35, 39 ], [ 43 ], [ 47 ], [ 51 ], [ 55 ], [ 59 ], [ 63 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 91, 93 ], [ 95, 97 ], [ 101 ], [ 105 ], [ 109 ], [ 113 ], [ 117 ], [ 121 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ] ]
2,162
static void virtio_ccw_net_realize(VirtioCcwDevice *ccw_dev, Error **errp) { DeviceState *qdev = DEVICE(ccw_dev); VirtIONetCcw *dev = VIRTIO_NET_CCW(ccw_dev); DeviceState *vdev = DEVICE(&dev->vdev); Error *err = NULL; virtio_net_set_netclient_name(&dev->vdev, qdev->id, object_get_typename(OBJECT(qdev))); qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus)); object_property_set_bool(OBJECT(vdev), true, "realized", &err); if (err) { error_propagate(errp, err); } }
false
qemu
621ff94d5074d88253a5818c6b9c4db718fbfc65
static void virtio_ccw_net_realize(VirtioCcwDevice *ccw_dev, Error **errp) { DeviceState *qdev = DEVICE(ccw_dev); VirtIONetCcw *dev = VIRTIO_NET_CCW(ccw_dev); DeviceState *vdev = DEVICE(&dev->vdev); Error *err = NULL; virtio_net_set_netclient_name(&dev->vdev, qdev->id, object_get_typename(OBJECT(qdev))); qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus)); object_property_set_bool(OBJECT(vdev), true, "realized", &err); if (err) { error_propagate(errp, err); } }
{ "code": [], "line_no": [] }
static void FUNC_0(VirtioCcwDevice *VAR_0, Error **VAR_1) { DeviceState *qdev = DEVICE(VAR_0); VirtIONetCcw *dev = VIRTIO_NET_CCW(VAR_0); DeviceState *vdev = DEVICE(&dev->vdev); Error *err = NULL; virtio_net_set_netclient_name(&dev->vdev, qdev->id, object_get_typename(OBJECT(qdev))); qdev_set_parent_bus(vdev, BUS(&VAR_0->bus)); object_property_set_bool(OBJECT(vdev), true, "realized", &err); if (err) { error_propagate(VAR_1, err); } }
[ "static void FUNC_0(VirtioCcwDevice *VAR_0, Error **VAR_1)\n{", "DeviceState *qdev = DEVICE(VAR_0);", "VirtIONetCcw *dev = VIRTIO_NET_CCW(VAR_0);", "DeviceState *vdev = DEVICE(&dev->vdev);", "Error *err = NULL;", "virtio_net_set_netclient_name(&dev->vdev, qdev->id,\nobject_get_typename(OBJECT(qdev)));", "qdev_set_parent_bus(vdev, BUS(&VAR_0->bus));", "object_property_set_bool(OBJECT(vdev), true, \"realized\", &err);", "if (err) {", "error_propagate(VAR_1, err);", "}", "}" ]
[ 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 ] ]
2,163
uint8_t cpu_inb(CPUState *env, pio_addr_t addr) { uint8_t val; val = ioport_read(0, addr); LOG_IOPORT("inb : %04"FMT_pioaddr" %02"PRIx8"\n", addr, val); #ifdef CONFIG_KQEMU if (env) env->last_io_time = cpu_get_time_fast(); #endif return val; }
false
qemu
4a1418e07bdcfaa3177739e04707ecaec75d89e1
uint8_t cpu_inb(CPUState *env, pio_addr_t addr) { uint8_t val; val = ioport_read(0, addr); LOG_IOPORT("inb : %04"FMT_pioaddr" %02"PRIx8"\n", addr, val); #ifdef CONFIG_KQEMU if (env) env->last_io_time = cpu_get_time_fast(); #endif return val; }
{ "code": [], "line_no": [] }
uint8_t FUNC_0(CPUState *env, pio_addr_t addr) { uint8_t val; val = ioport_read(0, addr); LOG_IOPORT("inb : %04"FMT_pioaddr" %02"PRIx8"\n", addr, val); #ifdef CONFIG_KQEMU if (env) env->last_io_time = cpu_get_time_fast(); #endif return val; }
[ "uint8_t FUNC_0(CPUState *env, pio_addr_t addr)\n{", "uint8_t val;", "val = ioport_read(0, addr);", "LOG_IOPORT(\"inb : %04\"FMT_pioaddr\" %02\"PRIx8\"\\n\", addr, val);", "#ifdef CONFIG_KQEMU\nif (env)\nenv->last_io_time = cpu_get_time_fast();", "#endif\nreturn val;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11, 13, 15 ], [ 17, 19 ], [ 21 ] ]
2,164
static void zynq_init(QEMUMachineInitArgs *args) { ram_addr_t ram_size = args->ram_size; const char *cpu_model = args->cpu_model; const char *kernel_filename = args->kernel_filename; const char *kernel_cmdline = args->kernel_cmdline; const char *initrd_filename = args->initrd_filename; ObjectClass *cpu_oc; ARMCPU *cpu; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *ext_ram = g_new(MemoryRegion, 1); MemoryRegion *ocm_ram = g_new(MemoryRegion, 1); DeviceState *dev; SysBusDevice *busdev; qemu_irq pic[64]; NICInfo *nd; Error *err = NULL; int n; if (!cpu_model) { cpu_model = "cortex-a9"; } cpu_oc = cpu_class_by_name(TYPE_ARM_CPU, cpu_model); cpu = ARM_CPU(object_new(object_class_get_name(cpu_oc))); object_property_set_int(OBJECT(cpu), MPCORE_PERIPHBASE, "reset-cbar", &err); if (err) { error_report("%s", error_get_pretty(err)); exit(1); } object_property_set_bool(OBJECT(cpu), true, "realized", &err); if (err) { error_report("%s", error_get_pretty(err)); exit(1); } /* max 2GB ram */ if (ram_size > 0x80000000) { ram_size = 0x80000000; } /* DDR remapped to address zero. */ memory_region_init_ram(ext_ram, NULL, "zynq.ext_ram", ram_size); vmstate_register_ram_global(ext_ram); memory_region_add_subregion(address_space_mem, 0, ext_ram); /* 256K of on-chip memory */ memory_region_init_ram(ocm_ram, NULL, "zynq.ocm_ram", 256 << 10); vmstate_register_ram_global(ocm_ram); memory_region_add_subregion(address_space_mem, 0xFFFC0000, ocm_ram); DriveInfo *dinfo = drive_get(IF_PFLASH, 0, 0); /* AMD */ pflash_cfi02_register(0xe2000000, NULL, "zynq.pflash", FLASH_SIZE, dinfo ? dinfo->bdrv : NULL, FLASH_SECTOR_SIZE, FLASH_SIZE/FLASH_SECTOR_SIZE, 1, 1, 0x0066, 0x0022, 0x0000, 0x0000, 0x0555, 0x2aa, 0); dev = qdev_create(NULL, "xilinx,zynq_slcr"); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xF8000000); dev = qdev_create(NULL, "a9mpcore_priv"); qdev_prop_set_uint32(dev, "num-cpu", 1); qdev_init_nofail(dev); busdev = SYS_BUS_DEVICE(dev); sysbus_mmio_map(busdev, 0, MPCORE_PERIPHBASE); sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ)); for (n = 0; n < 64; n++) { pic[n] = qdev_get_gpio_in(dev, n); } zynq_init_spi_flashes(0xE0006000, pic[58-IRQ_OFFSET], false); zynq_init_spi_flashes(0xE0007000, pic[81-IRQ_OFFSET], false); zynq_init_spi_flashes(0xE000D000, pic[51-IRQ_OFFSET], true); sysbus_create_simple("xlnx,ps7-usb", 0xE0002000, pic[53-IRQ_OFFSET]); sysbus_create_simple("xlnx,ps7-usb", 0xE0003000, pic[76-IRQ_OFFSET]); sysbus_create_simple("cadence_uart", 0xE0000000, pic[59-IRQ_OFFSET]); sysbus_create_simple("cadence_uart", 0xE0001000, pic[82-IRQ_OFFSET]); sysbus_create_varargs("cadence_ttc", 0xF8001000, pic[42-IRQ_OFFSET], pic[43-IRQ_OFFSET], pic[44-IRQ_OFFSET], NULL); sysbus_create_varargs("cadence_ttc", 0xF8002000, pic[69-IRQ_OFFSET], pic[70-IRQ_OFFSET], pic[71-IRQ_OFFSET], NULL); for (n = 0; n < nb_nics; n++) { nd = &nd_table[n]; if (n == 0) { gem_init(nd, 0xE000B000, pic[54-IRQ_OFFSET]); } else if (n == 1) { gem_init(nd, 0xE000C000, pic[77-IRQ_OFFSET]); } } dev = qdev_create(NULL, "generic-sdhci"); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xE0100000); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[56-IRQ_OFFSET]); dev = qdev_create(NULL, "generic-sdhci"); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xE0101000); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[79-IRQ_OFFSET]); dev = qdev_create(NULL, "pl330"); qdev_prop_set_uint8(dev, "num_chnls", 8); qdev_prop_set_uint8(dev, "num_periph_req", 4); qdev_prop_set_uint8(dev, "num_events", 16); qdev_prop_set_uint8(dev, "data_width", 64); qdev_prop_set_uint8(dev, "wr_cap", 8); qdev_prop_set_uint8(dev, "wr_q_dep", 16); qdev_prop_set_uint8(dev, "rd_cap", 8); qdev_prop_set_uint8(dev, "rd_q_dep", 16); qdev_prop_set_uint16(dev, "data_buffer_dep", 256); qdev_init_nofail(dev); busdev = SYS_BUS_DEVICE(dev); sysbus_mmio_map(busdev, 0, 0xF8003000); sysbus_connect_irq(busdev, 0, pic[45-IRQ_OFFSET]); /* abort irq line */ for (n = 0; n < 8; ++n) { /* event irqs */ sysbus_connect_irq(busdev, n + 1, pic[dma_irqs[n] - IRQ_OFFSET]); } zynq_binfo.ram_size = ram_size; zynq_binfo.kernel_filename = kernel_filename; zynq_binfo.kernel_cmdline = kernel_cmdline; zynq_binfo.initrd_filename = initrd_filename; zynq_binfo.nb_cpus = 1; zynq_binfo.board_id = 0xd32; zynq_binfo.loader_start = 0; arm_load_kernel(ARM_CPU(first_cpu), &zynq_binfo); }
false
qemu
ec0e68ef1da316b3ead1943d8f607cc68b13e0d1
static void zynq_init(QEMUMachineInitArgs *args) { ram_addr_t ram_size = args->ram_size; const char *cpu_model = args->cpu_model; const char *kernel_filename = args->kernel_filename; const char *kernel_cmdline = args->kernel_cmdline; const char *initrd_filename = args->initrd_filename; ObjectClass *cpu_oc; ARMCPU *cpu; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *ext_ram = g_new(MemoryRegion, 1); MemoryRegion *ocm_ram = g_new(MemoryRegion, 1); DeviceState *dev; SysBusDevice *busdev; qemu_irq pic[64]; NICInfo *nd; Error *err = NULL; int n; if (!cpu_model) { cpu_model = "cortex-a9"; } cpu_oc = cpu_class_by_name(TYPE_ARM_CPU, cpu_model); cpu = ARM_CPU(object_new(object_class_get_name(cpu_oc))); object_property_set_int(OBJECT(cpu), MPCORE_PERIPHBASE, "reset-cbar", &err); if (err) { error_report("%s", error_get_pretty(err)); exit(1); } object_property_set_bool(OBJECT(cpu), true, "realized", &err); if (err) { error_report("%s", error_get_pretty(err)); exit(1); } if (ram_size > 0x80000000) { ram_size = 0x80000000; } memory_region_init_ram(ext_ram, NULL, "zynq.ext_ram", ram_size); vmstate_register_ram_global(ext_ram); memory_region_add_subregion(address_space_mem, 0, ext_ram); memory_region_init_ram(ocm_ram, NULL, "zynq.ocm_ram", 256 << 10); vmstate_register_ram_global(ocm_ram); memory_region_add_subregion(address_space_mem, 0xFFFC0000, ocm_ram); DriveInfo *dinfo = drive_get(IF_PFLASH, 0, 0); pflash_cfi02_register(0xe2000000, NULL, "zynq.pflash", FLASH_SIZE, dinfo ? dinfo->bdrv : NULL, FLASH_SECTOR_SIZE, FLASH_SIZE/FLASH_SECTOR_SIZE, 1, 1, 0x0066, 0x0022, 0x0000, 0x0000, 0x0555, 0x2aa, 0); dev = qdev_create(NULL, "xilinx,zynq_slcr"); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xF8000000); dev = qdev_create(NULL, "a9mpcore_priv"); qdev_prop_set_uint32(dev, "num-cpu", 1); qdev_init_nofail(dev); busdev = SYS_BUS_DEVICE(dev); sysbus_mmio_map(busdev, 0, MPCORE_PERIPHBASE); sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ)); for (n = 0; n < 64; n++) { pic[n] = qdev_get_gpio_in(dev, n); } zynq_init_spi_flashes(0xE0006000, pic[58-IRQ_OFFSET], false); zynq_init_spi_flashes(0xE0007000, pic[81-IRQ_OFFSET], false); zynq_init_spi_flashes(0xE000D000, pic[51-IRQ_OFFSET], true); sysbus_create_simple("xlnx,ps7-usb", 0xE0002000, pic[53-IRQ_OFFSET]); sysbus_create_simple("xlnx,ps7-usb", 0xE0003000, pic[76-IRQ_OFFSET]); sysbus_create_simple("cadence_uart", 0xE0000000, pic[59-IRQ_OFFSET]); sysbus_create_simple("cadence_uart", 0xE0001000, pic[82-IRQ_OFFSET]); sysbus_create_varargs("cadence_ttc", 0xF8001000, pic[42-IRQ_OFFSET], pic[43-IRQ_OFFSET], pic[44-IRQ_OFFSET], NULL); sysbus_create_varargs("cadence_ttc", 0xF8002000, pic[69-IRQ_OFFSET], pic[70-IRQ_OFFSET], pic[71-IRQ_OFFSET], NULL); for (n = 0; n < nb_nics; n++) { nd = &nd_table[n]; if (n == 0) { gem_init(nd, 0xE000B000, pic[54-IRQ_OFFSET]); } else if (n == 1) { gem_init(nd, 0xE000C000, pic[77-IRQ_OFFSET]); } } dev = qdev_create(NULL, "generic-sdhci"); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xE0100000); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[56-IRQ_OFFSET]); dev = qdev_create(NULL, "generic-sdhci"); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xE0101000); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[79-IRQ_OFFSET]); dev = qdev_create(NULL, "pl330"); qdev_prop_set_uint8(dev, "num_chnls", 8); qdev_prop_set_uint8(dev, "num_periph_req", 4); qdev_prop_set_uint8(dev, "num_events", 16); qdev_prop_set_uint8(dev, "data_width", 64); qdev_prop_set_uint8(dev, "wr_cap", 8); qdev_prop_set_uint8(dev, "wr_q_dep", 16); qdev_prop_set_uint8(dev, "rd_cap", 8); qdev_prop_set_uint8(dev, "rd_q_dep", 16); qdev_prop_set_uint16(dev, "data_buffer_dep", 256); qdev_init_nofail(dev); busdev = SYS_BUS_DEVICE(dev); sysbus_mmio_map(busdev, 0, 0xF8003000); sysbus_connect_irq(busdev, 0, pic[45-IRQ_OFFSET]); for (n = 0; n < 8; ++n) { sysbus_connect_irq(busdev, n + 1, pic[dma_irqs[n] - IRQ_OFFSET]); } zynq_binfo.ram_size = ram_size; zynq_binfo.kernel_filename = kernel_filename; zynq_binfo.kernel_cmdline = kernel_cmdline; zynq_binfo.initrd_filename = initrd_filename; zynq_binfo.nb_cpus = 1; zynq_binfo.board_id = 0xd32; zynq_binfo.loader_start = 0; arm_load_kernel(ARM_CPU(first_cpu), &zynq_binfo); }
{ "code": [], "line_no": [] }
static void FUNC_0(QEMUMachineInitArgs *VAR_0) { ram_addr_t ram_size = VAR_0->ram_size; const char *VAR_1 = VAR_0->VAR_1; const char *VAR_2 = VAR_0->VAR_2; const char *VAR_3 = VAR_0->VAR_3; const char *VAR_4 = VAR_0->VAR_4; ObjectClass *cpu_oc; ARMCPU *cpu; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *ext_ram = g_new(MemoryRegion, 1); MemoryRegion *ocm_ram = g_new(MemoryRegion, 1); DeviceState *dev; SysBusDevice *busdev; qemu_irq pic[64]; NICInfo *nd; Error *err = NULL; int VAR_5; if (!VAR_1) { VAR_1 = "cortex-a9"; } cpu_oc = cpu_class_by_name(TYPE_ARM_CPU, VAR_1); cpu = ARM_CPU(object_new(object_class_get_name(cpu_oc))); object_property_set_int(OBJECT(cpu), MPCORE_PERIPHBASE, "reset-cbar", &err); if (err) { error_report("%s", error_get_pretty(err)); exit(1); } object_property_set_bool(OBJECT(cpu), true, "realized", &err); if (err) { error_report("%s", error_get_pretty(err)); exit(1); } if (ram_size > 0x80000000) { ram_size = 0x80000000; } memory_region_init_ram(ext_ram, NULL, "zynq.ext_ram", ram_size); vmstate_register_ram_global(ext_ram); memory_region_add_subregion(address_space_mem, 0, ext_ram); memory_region_init_ram(ocm_ram, NULL, "zynq.ocm_ram", 256 << 10); vmstate_register_ram_global(ocm_ram); memory_region_add_subregion(address_space_mem, 0xFFFC0000, ocm_ram); DriveInfo *dinfo = drive_get(IF_PFLASH, 0, 0); pflash_cfi02_register(0xe2000000, NULL, "zynq.pflash", FLASH_SIZE, dinfo ? dinfo->bdrv : NULL, FLASH_SECTOR_SIZE, FLASH_SIZE/FLASH_SECTOR_SIZE, 1, 1, 0x0066, 0x0022, 0x0000, 0x0000, 0x0555, 0x2aa, 0); dev = qdev_create(NULL, "xilinx,zynq_slcr"); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xF8000000); dev = qdev_create(NULL, "a9mpcore_priv"); qdev_prop_set_uint32(dev, "num-cpu", 1); qdev_init_nofail(dev); busdev = SYS_BUS_DEVICE(dev); sysbus_mmio_map(busdev, 0, MPCORE_PERIPHBASE); sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ)); for (VAR_5 = 0; VAR_5 < 64; VAR_5++) { pic[VAR_5] = qdev_get_gpio_in(dev, VAR_5); } zynq_init_spi_flashes(0xE0006000, pic[58-IRQ_OFFSET], false); zynq_init_spi_flashes(0xE0007000, pic[81-IRQ_OFFSET], false); zynq_init_spi_flashes(0xE000D000, pic[51-IRQ_OFFSET], true); sysbus_create_simple("xlnx,ps7-usb", 0xE0002000, pic[53-IRQ_OFFSET]); sysbus_create_simple("xlnx,ps7-usb", 0xE0003000, pic[76-IRQ_OFFSET]); sysbus_create_simple("cadence_uart", 0xE0000000, pic[59-IRQ_OFFSET]); sysbus_create_simple("cadence_uart", 0xE0001000, pic[82-IRQ_OFFSET]); sysbus_create_varargs("cadence_ttc", 0xF8001000, pic[42-IRQ_OFFSET], pic[43-IRQ_OFFSET], pic[44-IRQ_OFFSET], NULL); sysbus_create_varargs("cadence_ttc", 0xF8002000, pic[69-IRQ_OFFSET], pic[70-IRQ_OFFSET], pic[71-IRQ_OFFSET], NULL); for (VAR_5 = 0; VAR_5 < nb_nics; VAR_5++) { nd = &nd_table[VAR_5]; if (VAR_5 == 0) { gem_init(nd, 0xE000B000, pic[54-IRQ_OFFSET]); } else if (VAR_5 == 1) { gem_init(nd, 0xE000C000, pic[77-IRQ_OFFSET]); } } dev = qdev_create(NULL, "generic-sdhci"); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xE0100000); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[56-IRQ_OFFSET]); dev = qdev_create(NULL, "generic-sdhci"); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xE0101000); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[79-IRQ_OFFSET]); dev = qdev_create(NULL, "pl330"); qdev_prop_set_uint8(dev, "num_chnls", 8); qdev_prop_set_uint8(dev, "num_periph_req", 4); qdev_prop_set_uint8(dev, "num_events", 16); qdev_prop_set_uint8(dev, "data_width", 64); qdev_prop_set_uint8(dev, "wr_cap", 8); qdev_prop_set_uint8(dev, "wr_q_dep", 16); qdev_prop_set_uint8(dev, "rd_cap", 8); qdev_prop_set_uint8(dev, "rd_q_dep", 16); qdev_prop_set_uint16(dev, "data_buffer_dep", 256); qdev_init_nofail(dev); busdev = SYS_BUS_DEVICE(dev); sysbus_mmio_map(busdev, 0, 0xF8003000); sysbus_connect_irq(busdev, 0, pic[45-IRQ_OFFSET]); for (VAR_5 = 0; VAR_5 < 8; ++VAR_5) { sysbus_connect_irq(busdev, VAR_5 + 1, pic[dma_irqs[VAR_5] - IRQ_OFFSET]); } zynq_binfo.ram_size = ram_size; zynq_binfo.VAR_2 = VAR_2; zynq_binfo.VAR_3 = VAR_3; zynq_binfo.VAR_4 = VAR_4; zynq_binfo.nb_cpus = 1; zynq_binfo.board_id = 0xd32; zynq_binfo.loader_start = 0; arm_load_kernel(ARM_CPU(first_cpu), &zynq_binfo); }
[ "static void FUNC_0(QEMUMachineInitArgs *VAR_0)\n{", "ram_addr_t ram_size = VAR_0->ram_size;", "const char *VAR_1 = VAR_0->VAR_1;", "const char *VAR_2 = VAR_0->VAR_2;", "const char *VAR_3 = VAR_0->VAR_3;", "const char *VAR_4 = VAR_0->VAR_4;", "ObjectClass *cpu_oc;", "ARMCPU *cpu;", "MemoryRegion *address_space_mem = get_system_memory();", "MemoryRegion *ext_ram = g_new(MemoryRegion, 1);", "MemoryRegion *ocm_ram = g_new(MemoryRegion, 1);", "DeviceState *dev;", "SysBusDevice *busdev;", "qemu_irq pic[64];", "NICInfo *nd;", "Error *err = NULL;", "int VAR_5;", "if (!VAR_1) {", "VAR_1 = \"cortex-a9\";", "}", "cpu_oc = cpu_class_by_name(TYPE_ARM_CPU, VAR_1);", "cpu = ARM_CPU(object_new(object_class_get_name(cpu_oc)));", "object_property_set_int(OBJECT(cpu), MPCORE_PERIPHBASE, \"reset-cbar\", &err);", "if (err) {", "error_report(\"%s\", error_get_pretty(err));", "exit(1);", "}", "object_property_set_bool(OBJECT(cpu), true, \"realized\", &err);", "if (err) {", "error_report(\"%s\", error_get_pretty(err));", "exit(1);", "}", "if (ram_size > 0x80000000) {", "ram_size = 0x80000000;", "}", "memory_region_init_ram(ext_ram, NULL, \"zynq.ext_ram\", ram_size);", "vmstate_register_ram_global(ext_ram);", "memory_region_add_subregion(address_space_mem, 0, ext_ram);", "memory_region_init_ram(ocm_ram, NULL, \"zynq.ocm_ram\", 256 << 10);", "vmstate_register_ram_global(ocm_ram);", "memory_region_add_subregion(address_space_mem, 0xFFFC0000, ocm_ram);", "DriveInfo *dinfo = drive_get(IF_PFLASH, 0, 0);", "pflash_cfi02_register(0xe2000000, NULL, \"zynq.pflash\", FLASH_SIZE,\ndinfo ? dinfo->bdrv : NULL, FLASH_SECTOR_SIZE,\nFLASH_SIZE/FLASH_SECTOR_SIZE, 1,\n1, 0x0066, 0x0022, 0x0000, 0x0000, 0x0555, 0x2aa,\n0);", "dev = qdev_create(NULL, \"xilinx,zynq_slcr\");", "qdev_init_nofail(dev);", "sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xF8000000);", "dev = qdev_create(NULL, \"a9mpcore_priv\");", "qdev_prop_set_uint32(dev, \"num-cpu\", 1);", "qdev_init_nofail(dev);", "busdev = SYS_BUS_DEVICE(dev);", "sysbus_mmio_map(busdev, 0, MPCORE_PERIPHBASE);", "sysbus_connect_irq(busdev, 0,\nqdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ));", "for (VAR_5 = 0; VAR_5 < 64; VAR_5++) {", "pic[VAR_5] = qdev_get_gpio_in(dev, VAR_5);", "}", "zynq_init_spi_flashes(0xE0006000, pic[58-IRQ_OFFSET], false);", "zynq_init_spi_flashes(0xE0007000, pic[81-IRQ_OFFSET], false);", "zynq_init_spi_flashes(0xE000D000, pic[51-IRQ_OFFSET], true);", "sysbus_create_simple(\"xlnx,ps7-usb\", 0xE0002000, pic[53-IRQ_OFFSET]);", "sysbus_create_simple(\"xlnx,ps7-usb\", 0xE0003000, pic[76-IRQ_OFFSET]);", "sysbus_create_simple(\"cadence_uart\", 0xE0000000, pic[59-IRQ_OFFSET]);", "sysbus_create_simple(\"cadence_uart\", 0xE0001000, pic[82-IRQ_OFFSET]);", "sysbus_create_varargs(\"cadence_ttc\", 0xF8001000,\npic[42-IRQ_OFFSET], pic[43-IRQ_OFFSET], pic[44-IRQ_OFFSET], NULL);", "sysbus_create_varargs(\"cadence_ttc\", 0xF8002000,\npic[69-IRQ_OFFSET], pic[70-IRQ_OFFSET], pic[71-IRQ_OFFSET], NULL);", "for (VAR_5 = 0; VAR_5 < nb_nics; VAR_5++) {", "nd = &nd_table[VAR_5];", "if (VAR_5 == 0) {", "gem_init(nd, 0xE000B000, pic[54-IRQ_OFFSET]);", "} else if (VAR_5 == 1) {", "gem_init(nd, 0xE000C000, pic[77-IRQ_OFFSET]);", "}", "}", "dev = qdev_create(NULL, \"generic-sdhci\");", "qdev_init_nofail(dev);", "sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xE0100000);", "sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[56-IRQ_OFFSET]);", "dev = qdev_create(NULL, \"generic-sdhci\");", "qdev_init_nofail(dev);", "sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xE0101000);", "sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[79-IRQ_OFFSET]);", "dev = qdev_create(NULL, \"pl330\");", "qdev_prop_set_uint8(dev, \"num_chnls\", 8);", "qdev_prop_set_uint8(dev, \"num_periph_req\", 4);", "qdev_prop_set_uint8(dev, \"num_events\", 16);", "qdev_prop_set_uint8(dev, \"data_width\", 64);", "qdev_prop_set_uint8(dev, \"wr_cap\", 8);", "qdev_prop_set_uint8(dev, \"wr_q_dep\", 16);", "qdev_prop_set_uint8(dev, \"rd_cap\", 8);", "qdev_prop_set_uint8(dev, \"rd_q_dep\", 16);", "qdev_prop_set_uint16(dev, \"data_buffer_dep\", 256);", "qdev_init_nofail(dev);", "busdev = SYS_BUS_DEVICE(dev);", "sysbus_mmio_map(busdev, 0, 0xF8003000);", "sysbus_connect_irq(busdev, 0, pic[45-IRQ_OFFSET]);", "for (VAR_5 = 0; VAR_5 < 8; ++VAR_5) {", "sysbus_connect_irq(busdev, VAR_5 + 1, pic[dma_irqs[VAR_5] - IRQ_OFFSET]);", "}", "zynq_binfo.ram_size = ram_size;", "zynq_binfo.VAR_2 = VAR_2;", "zynq_binfo.VAR_3 = VAR_3;", "zynq_binfo.VAR_4 = VAR_4;", "zynq_binfo.nb_cpus = 1;", "zynq_binfo.board_id = 0xd32;", "zynq_binfo.loader_start = 0;", "arm_load_kernel(ARM_CPU(first_cpu), &zynq_binfo);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 77 ], [ 79 ], [ 81 ], [ 87 ], [ 89 ], [ 91 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 111, 113, 115, 117, 119 ], [ 123 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141, 143 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157 ], [ 159 ], [ 163 ], [ 165 ], [ 169 ], [ 171 ], [ 175, 177 ], [ 179, 181 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ] ]
2,165
static void avc_wgt_16width_msa(uint8_t *data, int32_t stride, int32_t height, int32_t log2_denom, int32_t src_weight, int32_t offset_in) { uint8_t cnt; v16u8 zero = { 0 }; v16u8 src0, src1, src2, src3; v16u8 dst0, dst1, dst2, dst3; v8u16 src0_l, src1_l, src2_l, src3_l; v8u16 src0_r, src1_r, src2_r, src3_r; v8u16 temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7; v8u16 wgt, denom, offset; offset_in <<= (log2_denom); if (log2_denom) { offset_in += (1 << (log2_denom - 1)); } wgt = (v8u16) __msa_fill_h(src_weight); offset = (v8u16) __msa_fill_h(offset_in); denom = (v8u16) __msa_fill_h(log2_denom); for (cnt = height / 4; cnt--;) { LOAD_4VECS_UB(data, stride, src0, src1, src2, src3); ILV_B_LRLR_UH(src0, zero, src1, zero, src0_l, src0_r, src1_l, src1_r); ILV_B_LRLR_UH(src2, zero, src3, zero, src2_l, src2_r, src3_l, src3_r); temp0 = wgt * src0_r; temp1 = wgt * src0_l; temp2 = wgt * src1_r; temp3 = wgt * src1_l; temp4 = wgt * src2_r; temp5 = wgt * src2_l; temp6 = wgt * src3_r; temp7 = wgt * src3_l; ADDS_S_H_4VECS_UH(temp0, offset, temp1, offset, temp2, offset, temp3, offset, temp0, temp1, temp2, temp3); ADDS_S_H_4VECS_UH(temp4, offset, temp5, offset, temp6, offset, temp7, offset, temp4, temp5, temp6, temp7); MAXI_S_H_4VECS_UH(temp0, temp1, temp2, temp3, 0); MAXI_S_H_4VECS_UH(temp4, temp5, temp6, temp7, 0); SRL_H_4VECS_UH(temp0, temp1, temp2, temp3, temp0, temp1, temp2, temp3, denom); SRL_H_4VECS_UH(temp4, temp5, temp6, temp7, temp4, temp5, temp6, temp7, denom); SAT_U_H_4VECS_UH(temp0, temp1, temp2, temp3, 7); SAT_U_H_4VECS_UH(temp4, temp5, temp6, temp7, 7); PCKEV_B_4VECS_UB(temp1, temp3, temp5, temp7, temp0, temp2, temp4, temp6, dst0, dst1, dst2, dst3); STORE_4VECS_UB(data, stride, dst0, dst1, dst2, dst3); data += 4 * stride; } }
false
FFmpeg
bcd7bf7eeb09a395cc01698842d1b8be9af483fc
static void avc_wgt_16width_msa(uint8_t *data, int32_t stride, int32_t height, int32_t log2_denom, int32_t src_weight, int32_t offset_in) { uint8_t cnt; v16u8 zero = { 0 }; v16u8 src0, src1, src2, src3; v16u8 dst0, dst1, dst2, dst3; v8u16 src0_l, src1_l, src2_l, src3_l; v8u16 src0_r, src1_r, src2_r, src3_r; v8u16 temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7; v8u16 wgt, denom, offset; offset_in <<= (log2_denom); if (log2_denom) { offset_in += (1 << (log2_denom - 1)); } wgt = (v8u16) __msa_fill_h(src_weight); offset = (v8u16) __msa_fill_h(offset_in); denom = (v8u16) __msa_fill_h(log2_denom); for (cnt = height / 4; cnt--;) { LOAD_4VECS_UB(data, stride, src0, src1, src2, src3); ILV_B_LRLR_UH(src0, zero, src1, zero, src0_l, src0_r, src1_l, src1_r); ILV_B_LRLR_UH(src2, zero, src3, zero, src2_l, src2_r, src3_l, src3_r); temp0 = wgt * src0_r; temp1 = wgt * src0_l; temp2 = wgt * src1_r; temp3 = wgt * src1_l; temp4 = wgt * src2_r; temp5 = wgt * src2_l; temp6 = wgt * src3_r; temp7 = wgt * src3_l; ADDS_S_H_4VECS_UH(temp0, offset, temp1, offset, temp2, offset, temp3, offset, temp0, temp1, temp2, temp3); ADDS_S_H_4VECS_UH(temp4, offset, temp5, offset, temp6, offset, temp7, offset, temp4, temp5, temp6, temp7); MAXI_S_H_4VECS_UH(temp0, temp1, temp2, temp3, 0); MAXI_S_H_4VECS_UH(temp4, temp5, temp6, temp7, 0); SRL_H_4VECS_UH(temp0, temp1, temp2, temp3, temp0, temp1, temp2, temp3, denom); SRL_H_4VECS_UH(temp4, temp5, temp6, temp7, temp4, temp5, temp6, temp7, denom); SAT_U_H_4VECS_UH(temp0, temp1, temp2, temp3, 7); SAT_U_H_4VECS_UH(temp4, temp5, temp6, temp7, 7); PCKEV_B_4VECS_UB(temp1, temp3, temp5, temp7, temp0, temp2, temp4, temp6, dst0, dst1, dst2, dst3); STORE_4VECS_UB(data, stride, dst0, dst1, dst2, dst3); data += 4 * stride; } }
{ "code": [], "line_no": [] }
static void FUNC_0(uint8_t *VAR_0, int32_t VAR_1, int32_t VAR_2, int32_t VAR_3, int32_t VAR_4, int32_t VAR_5) { uint8_t cnt; v16u8 zero = { 0 }; v16u8 src0, src1, src2, src3; v16u8 dst0, dst1, dst2, dst3; v8u16 src0_l, src1_l, src2_l, src3_l; v8u16 src0_r, src1_r, src2_r, src3_r; v8u16 temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7; v8u16 wgt, denom, offset; VAR_5 <<= (VAR_3); if (VAR_3) { VAR_5 += (1 << (VAR_3 - 1)); } wgt = (v8u16) __msa_fill_h(VAR_4); offset = (v8u16) __msa_fill_h(VAR_5); denom = (v8u16) __msa_fill_h(VAR_3); for (cnt = VAR_2 / 4; cnt--;) { LOAD_4VECS_UB(VAR_0, VAR_1, src0, src1, src2, src3); ILV_B_LRLR_UH(src0, zero, src1, zero, src0_l, src0_r, src1_l, src1_r); ILV_B_LRLR_UH(src2, zero, src3, zero, src2_l, src2_r, src3_l, src3_r); temp0 = wgt * src0_r; temp1 = wgt * src0_l; temp2 = wgt * src1_r; temp3 = wgt * src1_l; temp4 = wgt * src2_r; temp5 = wgt * src2_l; temp6 = wgt * src3_r; temp7 = wgt * src3_l; ADDS_S_H_4VECS_UH(temp0, offset, temp1, offset, temp2, offset, temp3, offset, temp0, temp1, temp2, temp3); ADDS_S_H_4VECS_UH(temp4, offset, temp5, offset, temp6, offset, temp7, offset, temp4, temp5, temp6, temp7); MAXI_S_H_4VECS_UH(temp0, temp1, temp2, temp3, 0); MAXI_S_H_4VECS_UH(temp4, temp5, temp6, temp7, 0); SRL_H_4VECS_UH(temp0, temp1, temp2, temp3, temp0, temp1, temp2, temp3, denom); SRL_H_4VECS_UH(temp4, temp5, temp6, temp7, temp4, temp5, temp6, temp7, denom); SAT_U_H_4VECS_UH(temp0, temp1, temp2, temp3, 7); SAT_U_H_4VECS_UH(temp4, temp5, temp6, temp7, 7); PCKEV_B_4VECS_UB(temp1, temp3, temp5, temp7, temp0, temp2, temp4, temp6, dst0, dst1, dst2, dst3); STORE_4VECS_UB(VAR_0, VAR_1, dst0, dst1, dst2, dst3); VAR_0 += 4 * VAR_1; } }
[ "static void FUNC_0(uint8_t *VAR_0,\nint32_t VAR_1,\nint32_t VAR_2,\nint32_t VAR_3,\nint32_t VAR_4,\nint32_t VAR_5)\n{", "uint8_t cnt;", "v16u8 zero = { 0 };", "v16u8 src0, src1, src2, src3;", "v16u8 dst0, dst1, dst2, dst3;", "v8u16 src0_l, src1_l, src2_l, src3_l;", "v8u16 src0_r, src1_r, src2_r, src3_r;", "v8u16 temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7;", "v8u16 wgt, denom, offset;", "VAR_5 <<= (VAR_3);", "if (VAR_3) {", "VAR_5 += (1 << (VAR_3 - 1));", "}", "wgt = (v8u16) __msa_fill_h(VAR_4);", "offset = (v8u16) __msa_fill_h(VAR_5);", "denom = (v8u16) __msa_fill_h(VAR_3);", "for (cnt = VAR_2 / 4; cnt--;) {", "LOAD_4VECS_UB(VAR_0, VAR_1, src0, src1, src2, src3);", "ILV_B_LRLR_UH(src0, zero, src1, zero, src0_l, src0_r, src1_l, src1_r);", "ILV_B_LRLR_UH(src2, zero, src3, zero, src2_l, src2_r, src3_l, src3_r);", "temp0 = wgt * src0_r;", "temp1 = wgt * src0_l;", "temp2 = wgt * src1_r;", "temp3 = wgt * src1_l;", "temp4 = wgt * src2_r;", "temp5 = wgt * src2_l;", "temp6 = wgt * src3_r;", "temp7 = wgt * src3_l;", "ADDS_S_H_4VECS_UH(temp0, offset, temp1, offset,\ntemp2, offset, temp3, offset,\ntemp0, temp1, temp2, temp3);", "ADDS_S_H_4VECS_UH(temp4, offset, temp5, offset,\ntemp6, offset, temp7, offset,\ntemp4, temp5, temp6, temp7);", "MAXI_S_H_4VECS_UH(temp0, temp1, temp2, temp3, 0);", "MAXI_S_H_4VECS_UH(temp4, temp5, temp6, temp7, 0);", "SRL_H_4VECS_UH(temp0, temp1, temp2, temp3,\ntemp0, temp1, temp2, temp3, denom);", "SRL_H_4VECS_UH(temp4, temp5, temp6, temp7,\ntemp4, temp5, temp6, temp7, denom);", "SAT_U_H_4VECS_UH(temp0, temp1, temp2, temp3, 7);", "SAT_U_H_4VECS_UH(temp4, temp5, temp6, temp7, 7);", "PCKEV_B_4VECS_UB(temp1, temp3, temp5, temp7, temp0, temp2, temp4, temp6,\ndst0, dst1, dst2, dst3);", "STORE_4VECS_UB(VAR_0, VAR_1, dst0, dst1, dst2, dst3);", "VAR_0 += 4 * VAR_1;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83, 85, 87 ], [ 91, 93, 95 ], [ 99 ], [ 101 ], [ 105, 107 ], [ 111, 113 ], [ 117 ], [ 119 ], [ 123, 125 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ] ]
2,166
static void mem_info_pae32(Monitor *mon, CPUState *env) { unsigned int l1, l2, l3; int prot, last_prot; uint64_t pdpe, pde, pte; uint64_t pdp_addr, pd_addr, pt_addr; target_phys_addr_t start, end; pdp_addr = env->cr[3] & ~0x1f; last_prot = 0; start = -1; for (l1 = 0; l1 < 4; l1++) { cpu_physical_memory_read(pdp_addr + l1 * 8, &pdpe, 8); pdpe = le64_to_cpu(pdpe); end = l1 << 30; if (pdpe & PG_PRESENT_MASK) { pd_addr = pdpe & 0x3fffffffff000ULL; for (l2 = 0; l2 < 512; l2++) { cpu_physical_memory_read(pd_addr + l2 * 8, &pde, 8); pde = le64_to_cpu(pde); end = (l1 << 30) + (l2 << 21); if (pde & PG_PRESENT_MASK) { if (pde & PG_PSE_MASK) { prot = pde & (PG_USER_MASK | PG_RW_MASK | PG_PRESENT_MASK); mem_print(mon, &start, &last_prot, end, prot); } else { pt_addr = pde & 0x3fffffffff000ULL; for (l3 = 0; l3 < 512; l3++) { cpu_physical_memory_read(pt_addr + l3 * 8, &pte, 8); pte = le64_to_cpu(pte); end = (l1 << 30) + (l2 << 21) + (l3 << 12); if (pte & PG_PRESENT_MASK) { prot = pte & (PG_USER_MASK | PG_RW_MASK | PG_PRESENT_MASK); } else { prot = 0; } mem_print(mon, &start, &last_prot, end, prot); } } } else { prot = 0; mem_print(mon, &start, &last_prot, end, prot); } } } else { prot = 0; mem_print(mon, &start, &last_prot, end, prot); } } /* Flush last range */ mem_print(mon, &start, &last_prot, (target_phys_addr_t)1 << 32, 0); }
false
qemu
c76c8416be5631dfdbd13799d3c67ad670637155
static void mem_info_pae32(Monitor *mon, CPUState *env) { unsigned int l1, l2, l3; int prot, last_prot; uint64_t pdpe, pde, pte; uint64_t pdp_addr, pd_addr, pt_addr; target_phys_addr_t start, end; pdp_addr = env->cr[3] & ~0x1f; last_prot = 0; start = -1; for (l1 = 0; l1 < 4; l1++) { cpu_physical_memory_read(pdp_addr + l1 * 8, &pdpe, 8); pdpe = le64_to_cpu(pdpe); end = l1 << 30; if (pdpe & PG_PRESENT_MASK) { pd_addr = pdpe & 0x3fffffffff000ULL; for (l2 = 0; l2 < 512; l2++) { cpu_physical_memory_read(pd_addr + l2 * 8, &pde, 8); pde = le64_to_cpu(pde); end = (l1 << 30) + (l2 << 21); if (pde & PG_PRESENT_MASK) { if (pde & PG_PSE_MASK) { prot = pde & (PG_USER_MASK | PG_RW_MASK | PG_PRESENT_MASK); mem_print(mon, &start, &last_prot, end, prot); } else { pt_addr = pde & 0x3fffffffff000ULL; for (l3 = 0; l3 < 512; l3++) { cpu_physical_memory_read(pt_addr + l3 * 8, &pte, 8); pte = le64_to_cpu(pte); end = (l1 << 30) + (l2 << 21) + (l3 << 12); if (pte & PG_PRESENT_MASK) { prot = pte & (PG_USER_MASK | PG_RW_MASK | PG_PRESENT_MASK); } else { prot = 0; } mem_print(mon, &start, &last_prot, end, prot); } } } else { prot = 0; mem_print(mon, &start, &last_prot, end, prot); } } } else { prot = 0; mem_print(mon, &start, &last_prot, end, prot); } } mem_print(mon, &start, &last_prot, (target_phys_addr_t)1 << 32, 0); }
{ "code": [], "line_no": [] }
static void FUNC_0(Monitor *VAR_0, CPUState *VAR_1) { unsigned int VAR_2, VAR_3, VAR_4; int VAR_5, VAR_6; uint64_t pdpe, pde, pte; uint64_t pdp_addr, pd_addr, pt_addr; target_phys_addr_t start, end; pdp_addr = VAR_1->cr[3] & ~0x1f; VAR_6 = 0; start = -1; for (VAR_2 = 0; VAR_2 < 4; VAR_2++) { cpu_physical_memory_read(pdp_addr + VAR_2 * 8, &pdpe, 8); pdpe = le64_to_cpu(pdpe); end = VAR_2 << 30; if (pdpe & PG_PRESENT_MASK) { pd_addr = pdpe & 0x3fffffffff000ULL; for (VAR_3 = 0; VAR_3 < 512; VAR_3++) { cpu_physical_memory_read(pd_addr + VAR_3 * 8, &pde, 8); pde = le64_to_cpu(pde); end = (VAR_2 << 30) + (VAR_3 << 21); if (pde & PG_PRESENT_MASK) { if (pde & PG_PSE_MASK) { VAR_5 = pde & (PG_USER_MASK | PG_RW_MASK | PG_PRESENT_MASK); mem_print(VAR_0, &start, &VAR_6, end, VAR_5); } else { pt_addr = pde & 0x3fffffffff000ULL; for (VAR_4 = 0; VAR_4 < 512; VAR_4++) { cpu_physical_memory_read(pt_addr + VAR_4 * 8, &pte, 8); pte = le64_to_cpu(pte); end = (VAR_2 << 30) + (VAR_3 << 21) + (VAR_4 << 12); if (pte & PG_PRESENT_MASK) { VAR_5 = pte & (PG_USER_MASK | PG_RW_MASK | PG_PRESENT_MASK); } else { VAR_5 = 0; } mem_print(VAR_0, &start, &VAR_6, end, VAR_5); } } } else { VAR_5 = 0; mem_print(VAR_0, &start, &VAR_6, end, VAR_5); } } } else { VAR_5 = 0; mem_print(VAR_0, &start, &VAR_6, end, VAR_5); } } mem_print(VAR_0, &start, &VAR_6, (target_phys_addr_t)1 << 32, 0); }
[ "static void FUNC_0(Monitor *VAR_0, CPUState *VAR_1)\n{", "unsigned int VAR_2, VAR_3, VAR_4;", "int VAR_5, VAR_6;", "uint64_t pdpe, pde, pte;", "uint64_t pdp_addr, pd_addr, pt_addr;", "target_phys_addr_t start, end;", "pdp_addr = VAR_1->cr[3] & ~0x1f;", "VAR_6 = 0;", "start = -1;", "for (VAR_2 = 0; VAR_2 < 4; VAR_2++) {", "cpu_physical_memory_read(pdp_addr + VAR_2 * 8, &pdpe, 8);", "pdpe = le64_to_cpu(pdpe);", "end = VAR_2 << 30;", "if (pdpe & PG_PRESENT_MASK) {", "pd_addr = pdpe & 0x3fffffffff000ULL;", "for (VAR_3 = 0; VAR_3 < 512; VAR_3++) {", "cpu_physical_memory_read(pd_addr + VAR_3 * 8, &pde, 8);", "pde = le64_to_cpu(pde);", "end = (VAR_2 << 30) + (VAR_3 << 21);", "if (pde & PG_PRESENT_MASK) {", "if (pde & PG_PSE_MASK) {", "VAR_5 = pde & (PG_USER_MASK | PG_RW_MASK |\nPG_PRESENT_MASK);", "mem_print(VAR_0, &start, &VAR_6, end, VAR_5);", "} else {", "pt_addr = pde & 0x3fffffffff000ULL;", "for (VAR_4 = 0; VAR_4 < 512; VAR_4++) {", "cpu_physical_memory_read(pt_addr + VAR_4 * 8, &pte, 8);", "pte = le64_to_cpu(pte);", "end = (VAR_2 << 30) + (VAR_3 << 21) + (VAR_4 << 12);", "if (pte & PG_PRESENT_MASK) {", "VAR_5 = pte & (PG_USER_MASK | PG_RW_MASK |\nPG_PRESENT_MASK);", "} else {", "VAR_5 = 0;", "}", "mem_print(VAR_0, &start, &VAR_6, end, VAR_5);", "}", "}", "} else {", "VAR_5 = 0;", "mem_print(VAR_0, &start, &VAR_6, end, VAR_5);", "}", "}", "} else {", "VAR_5 = 0;", "mem_print(VAR_0, &start, &VAR_6, end, VAR_5);", "}", "}", "mem_print(VAR_0, &start, &VAR_6, (target_phys_addr_t)1 << 32, 0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ] ]
2,167
int64_t helper_fdtox(CPUSPARCState *env, float64 src) { int64_t ret; clear_float_exceptions(env); ret = float64_to_int64_round_to_zero(src, &env->fp_status); check_ieee_exceptions(env); return ret; }
false
qemu
7385aed20db5d83979f683b9d0048674411e963c
int64_t helper_fdtox(CPUSPARCState *env, float64 src) { int64_t ret; clear_float_exceptions(env); ret = float64_to_int64_round_to_zero(src, &env->fp_status); check_ieee_exceptions(env); return ret; }
{ "code": [], "line_no": [] }
int64_t FUNC_0(CPUSPARCState *env, float64 src) { int64_t ret; clear_float_exceptions(env); ret = float64_to_int64_round_to_zero(src, &env->fp_status); check_ieee_exceptions(env); return ret; }
[ "int64_t FUNC_0(CPUSPARCState *env, float64 src)\n{", "int64_t ret;", "clear_float_exceptions(env);", "ret = float64_to_int64_round_to_zero(src, &env->fp_status);", "check_ieee_exceptions(env);", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
2,168
static inline void gen_op_jz_ecx(TCGMemOp size, int label1) { tcg_gen_mov_tl(cpu_tmp0, cpu_regs[R_ECX]); gen_extu(size, cpu_tmp0); tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_tmp0, 0, label1); }
false
qemu
42a268c241183877192c376d03bd9b6d527407c7
static inline void gen_op_jz_ecx(TCGMemOp size, int label1) { tcg_gen_mov_tl(cpu_tmp0, cpu_regs[R_ECX]); gen_extu(size, cpu_tmp0); tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_tmp0, 0, label1); }
{ "code": [], "line_no": [] }
static inline void FUNC_0(TCGMemOp VAR_0, int VAR_1) { tcg_gen_mov_tl(cpu_tmp0, cpu_regs[R_ECX]); gen_extu(VAR_0, cpu_tmp0); tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_tmp0, 0, VAR_1); }
[ "static inline void FUNC_0(TCGMemOp VAR_0, int VAR_1)\n{", "tcg_gen_mov_tl(cpu_tmp0, cpu_regs[R_ECX]);", "gen_extu(VAR_0, cpu_tmp0);", "tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_tmp0, 0, VAR_1);", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
2,169
void qemu_ram_foreach_block(RAMBlockIterFunc func, void *opaque) { RAMBlock *block; rcu_read_lock(); QLIST_FOREACH_RCU(block, &ram_list.blocks, next) { func(block->host, block->offset, block->used_length, opaque); } rcu_read_unlock(); }
false
qemu
e3807054e20fb3b94d18cb751c437ee2f43b6fac
void qemu_ram_foreach_block(RAMBlockIterFunc func, void *opaque) { RAMBlock *block; rcu_read_lock(); QLIST_FOREACH_RCU(block, &ram_list.blocks, next) { func(block->host, block->offset, block->used_length, opaque); } rcu_read_unlock(); }
{ "code": [], "line_no": [] }
void FUNC_0(RAMBlockIterFunc VAR_0, void *VAR_1) { RAMBlock *block; rcu_read_lock(); QLIST_FOREACH_RCU(block, &ram_list.blocks, next) { VAR_0(block->host, block->offset, block->used_length, VAR_1); } rcu_read_unlock(); }
[ "void FUNC_0(RAMBlockIterFunc VAR_0, void *VAR_1)\n{", "RAMBlock *block;", "rcu_read_lock();", "QLIST_FOREACH_RCU(block, &ram_list.blocks, next) {", "VAR_0(block->host, block->offset, block->used_length, VAR_1);", "}", "rcu_read_unlock();", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
2,170
static uint64_t exynos4210_pwm_read(void *opaque, target_phys_addr_t offset, unsigned size) { Exynos4210PWMState *s = (Exynos4210PWMState *)opaque; uint32_t value = 0; int index; switch (offset) { case TCFG0: case TCFG1: index = (offset - TCFG0) >> 2; value = s->reg_tcfg[index]; break; case TCON: value = s->reg_tcon; break; case TCNTB0: case TCNTB1: case TCNTB2: case TCNTB3: case TCNTB4: index = (offset - TCNTB0) / 0xC; value = s->timer[index].reg_tcntb; break; case TCMPB0: case TCMPB1: case TCMPB2: case TCMPB3: index = (offset - TCMPB0) / 0xC; value = s->timer[index].reg_tcmpb; break; case TCNTO0: case TCNTO1: case TCNTO2: case TCNTO3: case TCNTO4: index = (offset == TCNTO4) ? 4 : (offset - TCNTO0) / 0xC; value = ptimer_get_count(s->timer[index].ptimer); break; case TINT_CSTAT: value = s->reg_tint_cstat; break; default: fprintf(stderr, "[exynos4210.pwm: bad read offset " TARGET_FMT_plx "]\n", offset); break; } return value; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint64_t exynos4210_pwm_read(void *opaque, target_phys_addr_t offset, unsigned size) { Exynos4210PWMState *s = (Exynos4210PWMState *)opaque; uint32_t value = 0; int index; switch (offset) { case TCFG0: case TCFG1: index = (offset - TCFG0) >> 2; value = s->reg_tcfg[index]; break; case TCON: value = s->reg_tcon; break; case TCNTB0: case TCNTB1: case TCNTB2: case TCNTB3: case TCNTB4: index = (offset - TCNTB0) / 0xC; value = s->timer[index].reg_tcntb; break; case TCMPB0: case TCMPB1: case TCMPB2: case TCMPB3: index = (offset - TCMPB0) / 0xC; value = s->timer[index].reg_tcmpb; break; case TCNTO0: case TCNTO1: case TCNTO2: case TCNTO3: case TCNTO4: index = (offset == TCNTO4) ? 4 : (offset - TCNTO0) / 0xC; value = ptimer_get_count(s->timer[index].ptimer); break; case TINT_CSTAT: value = s->reg_tint_cstat; break; default: fprintf(stderr, "[exynos4210.pwm: bad read offset " TARGET_FMT_plx "]\n", offset); break; } return value; }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(void *opaque, target_phys_addr_t offset, unsigned size) { Exynos4210PWMState *s = (Exynos4210PWMState *)opaque; uint32_t value = 0; int VAR_0; switch (offset) { case TCFG0: case TCFG1: VAR_0 = (offset - TCFG0) >> 2; value = s->reg_tcfg[VAR_0]; break; case TCON: value = s->reg_tcon; break; case TCNTB0: case TCNTB1: case TCNTB2: case TCNTB3: case TCNTB4: VAR_0 = (offset - TCNTB0) / 0xC; value = s->timer[VAR_0].reg_tcntb; break; case TCMPB0: case TCMPB1: case TCMPB2: case TCMPB3: VAR_0 = (offset - TCMPB0) / 0xC; value = s->timer[VAR_0].reg_tcmpb; break; case TCNTO0: case TCNTO1: case TCNTO2: case TCNTO3: case TCNTO4: VAR_0 = (offset == TCNTO4) ? 4 : (offset - TCNTO0) / 0xC; value = ptimer_get_count(s->timer[VAR_0].ptimer); break; case TINT_CSTAT: value = s->reg_tint_cstat; break; default: fprintf(stderr, "[exynos4210.pwm: bad read offset " TARGET_FMT_plx "]\n", offset); break; } return value; }
[ "static uint64_t FUNC_0(void *opaque, target_phys_addr_t offset,\nunsigned size)\n{", "Exynos4210PWMState *s = (Exynos4210PWMState *)opaque;", "uint32_t value = 0;", "int VAR_0;", "switch (offset) {", "case TCFG0: case TCFG1:\nVAR_0 = (offset - TCFG0) >> 2;", "value = s->reg_tcfg[VAR_0];", "break;", "case TCON:\nvalue = s->reg_tcon;", "break;", "case TCNTB0: case TCNTB1:\ncase TCNTB2: case TCNTB3: case TCNTB4:\nVAR_0 = (offset - TCNTB0) / 0xC;", "value = s->timer[VAR_0].reg_tcntb;", "break;", "case TCMPB0: case TCMPB1:\ncase TCMPB2: case TCMPB3:\nVAR_0 = (offset - TCMPB0) / 0xC;", "value = s->timer[VAR_0].reg_tcmpb;", "break;", "case TCNTO0: case TCNTO1:\ncase TCNTO2: case TCNTO3: case TCNTO4:\nVAR_0 = (offset == TCNTO4) ? 4 : (offset - TCNTO0) / 0xC;", "value = ptimer_get_count(s->timer[VAR_0].ptimer);", "break;", "case TINT_CSTAT:\nvalue = s->reg_tint_cstat;", "break;", "default:\nfprintf(stderr,\n\"[exynos4210.pwm: bad read offset \" TARGET_FMT_plx \"]\\n\",\noffset);", "break;", "}", "return value;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 27, 29 ], [ 31 ], [ 35, 37, 39 ], [ 41 ], [ 43 ], [ 47, 49, 51 ], [ 53 ], [ 55 ], [ 59, 61, 63 ], [ 65 ], [ 67 ], [ 71, 73 ], [ 75 ], [ 79, 81, 83, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ] ]
2,171
static void apic_init_ipi(APICState *s) { int i; s->tpr = 0; s->spurious_vec = 0xff; s->log_dest = 0; s->dest_mode = 0xf; memset(s->isr, 0, sizeof(s->isr)); memset(s->tmr, 0, sizeof(s->tmr)); memset(s->irr, 0, sizeof(s->irr)); for(i = 0; i < APIC_LVT_NB; i++) s->lvt[i] = 1 << 16; /* mask LVT */ s->esr = 0; memset(s->icr, 0, sizeof(s->icr)); s->divide_conf = 0; s->count_shift = 0; s->initial_count = 0; s->initial_count_load_time = 0; s->next_time = 0; cpu_reset(s->cpu_env); s->cpu_env->halted = !(s->apicbase & MSR_IA32_APICBASE_BSP); }
false
qemu
b09ea7d55cfab5a75912bb56ed1fcd757604a759
static void apic_init_ipi(APICState *s) { int i; s->tpr = 0; s->spurious_vec = 0xff; s->log_dest = 0; s->dest_mode = 0xf; memset(s->isr, 0, sizeof(s->isr)); memset(s->tmr, 0, sizeof(s->tmr)); memset(s->irr, 0, sizeof(s->irr)); for(i = 0; i < APIC_LVT_NB; i++) s->lvt[i] = 1 << 16; s->esr = 0; memset(s->icr, 0, sizeof(s->icr)); s->divide_conf = 0; s->count_shift = 0; s->initial_count = 0; s->initial_count_load_time = 0; s->next_time = 0; cpu_reset(s->cpu_env); s->cpu_env->halted = !(s->apicbase & MSR_IA32_APICBASE_BSP); }
{ "code": [], "line_no": [] }
static void FUNC_0(APICState *VAR_0) { int VAR_1; VAR_0->tpr = 0; VAR_0->spurious_vec = 0xff; VAR_0->log_dest = 0; VAR_0->dest_mode = 0xf; memset(VAR_0->isr, 0, sizeof(VAR_0->isr)); memset(VAR_0->tmr, 0, sizeof(VAR_0->tmr)); memset(VAR_0->irr, 0, sizeof(VAR_0->irr)); for(VAR_1 = 0; VAR_1 < APIC_LVT_NB; VAR_1++) VAR_0->lvt[VAR_1] = 1 << 16; VAR_0->esr = 0; memset(VAR_0->icr, 0, sizeof(VAR_0->icr)); VAR_0->divide_conf = 0; VAR_0->count_shift = 0; VAR_0->initial_count = 0; VAR_0->initial_count_load_time = 0; VAR_0->next_time = 0; cpu_reset(VAR_0->cpu_env); VAR_0->cpu_env->halted = !(VAR_0->apicbase & MSR_IA32_APICBASE_BSP); }
[ "static void FUNC_0(APICState *VAR_0)\n{", "int VAR_1;", "VAR_0->tpr = 0;", "VAR_0->spurious_vec = 0xff;", "VAR_0->log_dest = 0;", "VAR_0->dest_mode = 0xf;", "memset(VAR_0->isr, 0, sizeof(VAR_0->isr));", "memset(VAR_0->tmr, 0, sizeof(VAR_0->tmr));", "memset(VAR_0->irr, 0, sizeof(VAR_0->irr));", "for(VAR_1 = 0; VAR_1 < APIC_LVT_NB; VAR_1++)", "VAR_0->lvt[VAR_1] = 1 << 16;", "VAR_0->esr = 0;", "memset(VAR_0->icr, 0, sizeof(VAR_0->icr));", "VAR_0->divide_conf = 0;", "VAR_0->count_shift = 0;", "VAR_0->initial_count = 0;", "VAR_0->initial_count_load_time = 0;", "VAR_0->next_time = 0;", "cpu_reset(VAR_0->cpu_env);", "VAR_0->cpu_env->halted = !(VAR_0->apicbase & MSR_IA32_APICBASE_BSP);", "}" ]
[ 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 ], [ 43 ], [ 47 ], [ 49 ] ]
2,172
static void init_ppc_proc(PowerPCCPU *cpu) { PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu); CPUPPCState *env = &cpu->env; #if !defined(CONFIG_USER_ONLY) int i; env->irq_inputs = NULL; /* Set all exception vectors to an invalid address */ for (i = 0; i < POWERPC_EXCP_NB; i++) env->excp_vectors[i] = (target_ulong)(-1ULL); env->ivor_mask = 0x00000000; env->ivpr_mask = 0x00000000; /* Default MMU definitions */ env->nb_BATs = 0; env->nb_tlb = 0; env->nb_ways = 0; env->tlb_type = TLB_NONE; #endif /* Register SPR common to all PowerPC implementations */ gen_spr_generic(env); spr_register(env, SPR_PVR, "PVR", /* Linux permits userspace to read PVR */ #if defined(CONFIG_LINUX_USER) &spr_read_generic, #else SPR_NOACCESS, #endif SPR_NOACCESS, &spr_read_generic, SPR_NOACCESS, pcc->pvr); /* Register SVR if it's defined to anything else than POWERPC_SVR_NONE */ if (pcc->svr != POWERPC_SVR_NONE) { if (pcc->svr & POWERPC_SVR_E500) { spr_register(env, SPR_E500_SVR, "SVR", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, SPR_NOACCESS, pcc->svr & ~POWERPC_SVR_E500); } else { spr_register(env, SPR_SVR, "SVR", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, SPR_NOACCESS, pcc->svr); } } /* PowerPC implementation specific initialisations (SPRs, timers, ...) */ (*pcc->init_proc)(env); /* MSR bits & flags consistency checks */ if (env->msr_mask & (1 << 25)) { switch (env->flags & (POWERPC_FLAG_SPE | POWERPC_FLAG_VRE)) { case POWERPC_FLAG_SPE: case POWERPC_FLAG_VRE: break; default: fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should define POWERPC_FLAG_SPE or POWERPC_FLAG_VRE\n"); exit(1); } } else if (env->flags & (POWERPC_FLAG_SPE | POWERPC_FLAG_VRE)) { fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should not define POWERPC_FLAG_SPE nor POWERPC_FLAG_VRE\n"); exit(1); } if (env->msr_mask & (1 << 17)) { switch (env->flags & (POWERPC_FLAG_TGPR | POWERPC_FLAG_CE)) { case POWERPC_FLAG_TGPR: case POWERPC_FLAG_CE: break; default: fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should define POWERPC_FLAG_TGPR or POWERPC_FLAG_CE\n"); exit(1); } } else if (env->flags & (POWERPC_FLAG_TGPR | POWERPC_FLAG_CE)) { fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should not define POWERPC_FLAG_TGPR nor POWERPC_FLAG_CE\n"); exit(1); } if (env->msr_mask & (1 << 10)) { switch (env->flags & (POWERPC_FLAG_SE | POWERPC_FLAG_DWE | POWERPC_FLAG_UBLE)) { case POWERPC_FLAG_SE: case POWERPC_FLAG_DWE: case POWERPC_FLAG_UBLE: break; default: fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should define POWERPC_FLAG_SE or POWERPC_FLAG_DWE or " "POWERPC_FLAG_UBLE\n"); exit(1); } } else if (env->flags & (POWERPC_FLAG_SE | POWERPC_FLAG_DWE | POWERPC_FLAG_UBLE)) { fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should not define POWERPC_FLAG_SE nor POWERPC_FLAG_DWE nor " "POWERPC_FLAG_UBLE\n"); exit(1); } if (env->msr_mask & (1 << 9)) { switch (env->flags & (POWERPC_FLAG_BE | POWERPC_FLAG_DE)) { case POWERPC_FLAG_BE: case POWERPC_FLAG_DE: break; default: fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should define POWERPC_FLAG_BE or POWERPC_FLAG_DE\n"); exit(1); } } else if (env->flags & (POWERPC_FLAG_BE | POWERPC_FLAG_DE)) { fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should not define POWERPC_FLAG_BE nor POWERPC_FLAG_DE\n"); exit(1); } if (env->msr_mask & (1 << 2)) { switch (env->flags & (POWERPC_FLAG_PX | POWERPC_FLAG_PMM)) { case POWERPC_FLAG_PX: case POWERPC_FLAG_PMM: break; default: fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should define POWERPC_FLAG_PX or POWERPC_FLAG_PMM\n"); exit(1); } } else if (env->flags & (POWERPC_FLAG_PX | POWERPC_FLAG_PMM)) { fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should not define POWERPC_FLAG_PX nor POWERPC_FLAG_PMM\n"); exit(1); } if ((env->flags & (POWERPC_FLAG_RTC_CLK | POWERPC_FLAG_BUS_CLK)) == 0) { fprintf(stderr, "PowerPC flags inconsistency\n" "Should define the time-base and decrementer clock source\n"); exit(1); } /* Allocate TLBs buffer when needed */ #if !defined(CONFIG_USER_ONLY) if (env->nb_tlb != 0) { int nb_tlb = env->nb_tlb; if (env->id_tlbs != 0) nb_tlb *= 2; switch (env->tlb_type) { case TLB_6XX: env->tlb.tlb6 = g_malloc0(nb_tlb * sizeof(ppc6xx_tlb_t)); break; case TLB_EMB: env->tlb.tlbe = g_malloc0(nb_tlb * sizeof(ppcemb_tlb_t)); break; case TLB_MAS: env->tlb.tlbm = g_malloc0(nb_tlb * sizeof(ppcmas_tlb_t)); break; } /* Pre-compute some useful values */ env->tlb_per_way = env->nb_tlb / env->nb_ways; } if (env->irq_inputs == NULL) { fprintf(stderr, "WARNING: no internal IRQ controller registered.\n" " Attempt QEMU to crash very soon !\n"); } #endif if (env->check_pow == NULL) { fprintf(stderr, "WARNING: no power management check handler " "registered.\n" " Attempt QEMU to crash very soon !\n"); } }
false
qemu
8297be80f7cf71e09617669a8bd8b2836dcfd4c3
static void init_ppc_proc(PowerPCCPU *cpu) { PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu); CPUPPCState *env = &cpu->env; #if !defined(CONFIG_USER_ONLY) int i; env->irq_inputs = NULL; for (i = 0; i < POWERPC_EXCP_NB; i++) env->excp_vectors[i] = (target_ulong)(-1ULL); env->ivor_mask = 0x00000000; env->ivpr_mask = 0x00000000; env->nb_BATs = 0; env->nb_tlb = 0; env->nb_ways = 0; env->tlb_type = TLB_NONE; #endif gen_spr_generic(env); spr_register(env, SPR_PVR, "PVR", #if defined(CONFIG_LINUX_USER) &spr_read_generic, #else SPR_NOACCESS, #endif SPR_NOACCESS, &spr_read_generic, SPR_NOACCESS, pcc->pvr); if (pcc->svr != POWERPC_SVR_NONE) { if (pcc->svr & POWERPC_SVR_E500) { spr_register(env, SPR_E500_SVR, "SVR", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, SPR_NOACCESS, pcc->svr & ~POWERPC_SVR_E500); } else { spr_register(env, SPR_SVR, "SVR", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, SPR_NOACCESS, pcc->svr); } } (*pcc->init_proc)(env); if (env->msr_mask & (1 << 25)) { switch (env->flags & (POWERPC_FLAG_SPE | POWERPC_FLAG_VRE)) { case POWERPC_FLAG_SPE: case POWERPC_FLAG_VRE: break; default: fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should define POWERPC_FLAG_SPE or POWERPC_FLAG_VRE\n"); exit(1); } } else if (env->flags & (POWERPC_FLAG_SPE | POWERPC_FLAG_VRE)) { fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should not define POWERPC_FLAG_SPE nor POWERPC_FLAG_VRE\n"); exit(1); } if (env->msr_mask & (1 << 17)) { switch (env->flags & (POWERPC_FLAG_TGPR | POWERPC_FLAG_CE)) { case POWERPC_FLAG_TGPR: case POWERPC_FLAG_CE: break; default: fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should define POWERPC_FLAG_TGPR or POWERPC_FLAG_CE\n"); exit(1); } } else if (env->flags & (POWERPC_FLAG_TGPR | POWERPC_FLAG_CE)) { fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should not define POWERPC_FLAG_TGPR nor POWERPC_FLAG_CE\n"); exit(1); } if (env->msr_mask & (1 << 10)) { switch (env->flags & (POWERPC_FLAG_SE | POWERPC_FLAG_DWE | POWERPC_FLAG_UBLE)) { case POWERPC_FLAG_SE: case POWERPC_FLAG_DWE: case POWERPC_FLAG_UBLE: break; default: fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should define POWERPC_FLAG_SE or POWERPC_FLAG_DWE or " "POWERPC_FLAG_UBLE\n"); exit(1); } } else if (env->flags & (POWERPC_FLAG_SE | POWERPC_FLAG_DWE | POWERPC_FLAG_UBLE)) { fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should not define POWERPC_FLAG_SE nor POWERPC_FLAG_DWE nor " "POWERPC_FLAG_UBLE\n"); exit(1); } if (env->msr_mask & (1 << 9)) { switch (env->flags & (POWERPC_FLAG_BE | POWERPC_FLAG_DE)) { case POWERPC_FLAG_BE: case POWERPC_FLAG_DE: break; default: fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should define POWERPC_FLAG_BE or POWERPC_FLAG_DE\n"); exit(1); } } else if (env->flags & (POWERPC_FLAG_BE | POWERPC_FLAG_DE)) { fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should not define POWERPC_FLAG_BE nor POWERPC_FLAG_DE\n"); exit(1); } if (env->msr_mask & (1 << 2)) { switch (env->flags & (POWERPC_FLAG_PX | POWERPC_FLAG_PMM)) { case POWERPC_FLAG_PX: case POWERPC_FLAG_PMM: break; default: fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should define POWERPC_FLAG_PX or POWERPC_FLAG_PMM\n"); exit(1); } } else if (env->flags & (POWERPC_FLAG_PX | POWERPC_FLAG_PMM)) { fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should not define POWERPC_FLAG_PX nor POWERPC_FLAG_PMM\n"); exit(1); } if ((env->flags & (POWERPC_FLAG_RTC_CLK | POWERPC_FLAG_BUS_CLK)) == 0) { fprintf(stderr, "PowerPC flags inconsistency\n" "Should define the time-base and decrementer clock source\n"); exit(1); } #if !defined(CONFIG_USER_ONLY) if (env->nb_tlb != 0) { int nb_tlb = env->nb_tlb; if (env->id_tlbs != 0) nb_tlb *= 2; switch (env->tlb_type) { case TLB_6XX: env->tlb.tlb6 = g_malloc0(nb_tlb * sizeof(ppc6xx_tlb_t)); break; case TLB_EMB: env->tlb.tlbe = g_malloc0(nb_tlb * sizeof(ppcemb_tlb_t)); break; case TLB_MAS: env->tlb.tlbm = g_malloc0(nb_tlb * sizeof(ppcmas_tlb_t)); break; } env->tlb_per_way = env->nb_tlb / env->nb_ways; } if (env->irq_inputs == NULL) { fprintf(stderr, "WARNING: no internal IRQ controller registered.\n" " Attempt QEMU to crash very soon !\n"); } #endif if (env->check_pow == NULL) { fprintf(stderr, "WARNING: no power management check handler " "registered.\n" " Attempt QEMU to crash very soon !\n"); } }
{ "code": [], "line_no": [] }
static void FUNC_0(PowerPCCPU *VAR_0) { PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(VAR_0); CPUPPCState *env = &VAR_0->env; #if !defined(CONFIG_USER_ONLY) int VAR_1; env->irq_inputs = NULL; for (VAR_1 = 0; VAR_1 < POWERPC_EXCP_NB; VAR_1++) env->excp_vectors[VAR_1] = (target_ulong)(-1ULL); env->ivor_mask = 0x00000000; env->ivpr_mask = 0x00000000; env->nb_BATs = 0; env->VAR_2 = 0; env->nb_ways = 0; env->tlb_type = TLB_NONE; #endif gen_spr_generic(env); spr_register(env, SPR_PVR, "PVR", #if defined(CONFIG_LINUX_USER) &spr_read_generic, #else SPR_NOACCESS, #endif SPR_NOACCESS, &spr_read_generic, SPR_NOACCESS, pcc->pvr); if (pcc->svr != POWERPC_SVR_NONE) { if (pcc->svr & POWERPC_SVR_E500) { spr_register(env, SPR_E500_SVR, "SVR", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, SPR_NOACCESS, pcc->svr & ~POWERPC_SVR_E500); } else { spr_register(env, SPR_SVR, "SVR", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, SPR_NOACCESS, pcc->svr); } } (*pcc->init_proc)(env); if (env->msr_mask & (1 << 25)) { switch (env->flags & (POWERPC_FLAG_SPE | POWERPC_FLAG_VRE)) { case POWERPC_FLAG_SPE: case POWERPC_FLAG_VRE: break; default: fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should define POWERPC_FLAG_SPE or POWERPC_FLAG_VRE\n"); exit(1); } } else if (env->flags & (POWERPC_FLAG_SPE | POWERPC_FLAG_VRE)) { fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should not define POWERPC_FLAG_SPE nor POWERPC_FLAG_VRE\n"); exit(1); } if (env->msr_mask & (1 << 17)) { switch (env->flags & (POWERPC_FLAG_TGPR | POWERPC_FLAG_CE)) { case POWERPC_FLAG_TGPR: case POWERPC_FLAG_CE: break; default: fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should define POWERPC_FLAG_TGPR or POWERPC_FLAG_CE\n"); exit(1); } } else if (env->flags & (POWERPC_FLAG_TGPR | POWERPC_FLAG_CE)) { fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should not define POWERPC_FLAG_TGPR nor POWERPC_FLAG_CE\n"); exit(1); } if (env->msr_mask & (1 << 10)) { switch (env->flags & (POWERPC_FLAG_SE | POWERPC_FLAG_DWE | POWERPC_FLAG_UBLE)) { case POWERPC_FLAG_SE: case POWERPC_FLAG_DWE: case POWERPC_FLAG_UBLE: break; default: fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should define POWERPC_FLAG_SE or POWERPC_FLAG_DWE or " "POWERPC_FLAG_UBLE\n"); exit(1); } } else if (env->flags & (POWERPC_FLAG_SE | POWERPC_FLAG_DWE | POWERPC_FLAG_UBLE)) { fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should not define POWERPC_FLAG_SE nor POWERPC_FLAG_DWE nor " "POWERPC_FLAG_UBLE\n"); exit(1); } if (env->msr_mask & (1 << 9)) { switch (env->flags & (POWERPC_FLAG_BE | POWERPC_FLAG_DE)) { case POWERPC_FLAG_BE: case POWERPC_FLAG_DE: break; default: fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should define POWERPC_FLAG_BE or POWERPC_FLAG_DE\n"); exit(1); } } else if (env->flags & (POWERPC_FLAG_BE | POWERPC_FLAG_DE)) { fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should not define POWERPC_FLAG_BE nor POWERPC_FLAG_DE\n"); exit(1); } if (env->msr_mask & (1 << 2)) { switch (env->flags & (POWERPC_FLAG_PX | POWERPC_FLAG_PMM)) { case POWERPC_FLAG_PX: case POWERPC_FLAG_PMM: break; default: fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should define POWERPC_FLAG_PX or POWERPC_FLAG_PMM\n"); exit(1); } } else if (env->flags & (POWERPC_FLAG_PX | POWERPC_FLAG_PMM)) { fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should not define POWERPC_FLAG_PX nor POWERPC_FLAG_PMM\n"); exit(1); } if ((env->flags & (POWERPC_FLAG_RTC_CLK | POWERPC_FLAG_BUS_CLK)) == 0) { fprintf(stderr, "PowerPC flags inconsistency\n" "Should define the time-base and decrementer clock source\n"); exit(1); } #if !defined(CONFIG_USER_ONLY) if (env->VAR_2 != 0) { int VAR_2 = env->VAR_2; if (env->id_tlbs != 0) VAR_2 *= 2; switch (env->tlb_type) { case TLB_6XX: env->tlb.tlb6 = g_malloc0(VAR_2 * sizeof(ppc6xx_tlb_t)); break; case TLB_EMB: env->tlb.tlbe = g_malloc0(VAR_2 * sizeof(ppcemb_tlb_t)); break; case TLB_MAS: env->tlb.tlbm = g_malloc0(VAR_2 * sizeof(ppcmas_tlb_t)); break; } env->tlb_per_way = env->VAR_2 / env->nb_ways; } if (env->irq_inputs == NULL) { fprintf(stderr, "WARNING: no internal IRQ controller registered.\n" " Attempt QEMU to crash very soon !\n"); } #endif if (env->check_pow == NULL) { fprintf(stderr, "WARNING: no power management check handler " "registered.\n" " Attempt QEMU to crash very soon !\n"); } }
[ "static void FUNC_0(PowerPCCPU *VAR_0)\n{", "PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(VAR_0);", "CPUPPCState *env = &VAR_0->env;", "#if !defined(CONFIG_USER_ONLY)\nint VAR_1;", "env->irq_inputs = NULL;", "for (VAR_1 = 0; VAR_1 < POWERPC_EXCP_NB; VAR_1++)", "env->excp_vectors[VAR_1] = (target_ulong)(-1ULL);", "env->ivor_mask = 0x00000000;", "env->ivpr_mask = 0x00000000;", "env->nb_BATs = 0;", "env->VAR_2 = 0;", "env->nb_ways = 0;", "env->tlb_type = TLB_NONE;", "#endif\ngen_spr_generic(env);", "spr_register(env, SPR_PVR, \"PVR\",\n#if defined(CONFIG_LINUX_USER)\n&spr_read_generic,\n#else\nSPR_NOACCESS,\n#endif\nSPR_NOACCESS,\n&spr_read_generic, SPR_NOACCESS,\npcc->pvr);", "if (pcc->svr != POWERPC_SVR_NONE) {", "if (pcc->svr & POWERPC_SVR_E500) {", "spr_register(env, SPR_E500_SVR, \"SVR\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, SPR_NOACCESS,\npcc->svr & ~POWERPC_SVR_E500);", "} else {", "spr_register(env, SPR_SVR, \"SVR\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, SPR_NOACCESS,\npcc->svr);", "}", "}", "(*pcc->init_proc)(env);", "if (env->msr_mask & (1 << 25)) {", "switch (env->flags & (POWERPC_FLAG_SPE | POWERPC_FLAG_VRE)) {", "case POWERPC_FLAG_SPE:\ncase POWERPC_FLAG_VRE:\nbreak;", "default:\nfprintf(stderr, \"PowerPC MSR definition inconsistency\\n\"\n\"Should define POWERPC_FLAG_SPE or POWERPC_FLAG_VRE\\n\");", "exit(1);", "}", "} else if (env->flags & (POWERPC_FLAG_SPE | POWERPC_FLAG_VRE)) {", "fprintf(stderr, \"PowerPC MSR definition inconsistency\\n\"\n\"Should not define POWERPC_FLAG_SPE nor POWERPC_FLAG_VRE\\n\");", "exit(1);", "}", "if (env->msr_mask & (1 << 17)) {", "switch (env->flags & (POWERPC_FLAG_TGPR | POWERPC_FLAG_CE)) {", "case POWERPC_FLAG_TGPR:\ncase POWERPC_FLAG_CE:\nbreak;", "default:\nfprintf(stderr, \"PowerPC MSR definition inconsistency\\n\"\n\"Should define POWERPC_FLAG_TGPR or POWERPC_FLAG_CE\\n\");", "exit(1);", "}", "} else if (env->flags & (POWERPC_FLAG_TGPR | POWERPC_FLAG_CE)) {", "fprintf(stderr, \"PowerPC MSR definition inconsistency\\n\"\n\"Should not define POWERPC_FLAG_TGPR nor POWERPC_FLAG_CE\\n\");", "exit(1);", "}", "if (env->msr_mask & (1 << 10)) {", "switch (env->flags & (POWERPC_FLAG_SE | POWERPC_FLAG_DWE |\nPOWERPC_FLAG_UBLE)) {", "case POWERPC_FLAG_SE:\ncase POWERPC_FLAG_DWE:\ncase POWERPC_FLAG_UBLE:\nbreak;", "default:\nfprintf(stderr, \"PowerPC MSR definition inconsistency\\n\"\n\"Should define POWERPC_FLAG_SE or POWERPC_FLAG_DWE or \"\n\"POWERPC_FLAG_UBLE\\n\");", "exit(1);", "}", "} else if (env->flags & (POWERPC_FLAG_SE | POWERPC_FLAG_DWE |", "POWERPC_FLAG_UBLE)) {", "fprintf(stderr, \"PowerPC MSR definition inconsistency\\n\"\n\"Should not define POWERPC_FLAG_SE nor POWERPC_FLAG_DWE nor \"\n\"POWERPC_FLAG_UBLE\\n\");", "exit(1);", "}", "if (env->msr_mask & (1 << 9)) {", "switch (env->flags & (POWERPC_FLAG_BE | POWERPC_FLAG_DE)) {", "case POWERPC_FLAG_BE:\ncase POWERPC_FLAG_DE:\nbreak;", "default:\nfprintf(stderr, \"PowerPC MSR definition inconsistency\\n\"\n\"Should define POWERPC_FLAG_BE or POWERPC_FLAG_DE\\n\");", "exit(1);", "}", "} else if (env->flags & (POWERPC_FLAG_BE | POWERPC_FLAG_DE)) {", "fprintf(stderr, \"PowerPC MSR definition inconsistency\\n\"\n\"Should not define POWERPC_FLAG_BE nor POWERPC_FLAG_DE\\n\");", "exit(1);", "}", "if (env->msr_mask & (1 << 2)) {", "switch (env->flags & (POWERPC_FLAG_PX | POWERPC_FLAG_PMM)) {", "case POWERPC_FLAG_PX:\ncase POWERPC_FLAG_PMM:\nbreak;", "default:\nfprintf(stderr, \"PowerPC MSR definition inconsistency\\n\"\n\"Should define POWERPC_FLAG_PX or POWERPC_FLAG_PMM\\n\");", "exit(1);", "}", "} else if (env->flags & (POWERPC_FLAG_PX | POWERPC_FLAG_PMM)) {", "fprintf(stderr, \"PowerPC MSR definition inconsistency\\n\"\n\"Should not define POWERPC_FLAG_PX nor POWERPC_FLAG_PMM\\n\");", "exit(1);", "}", "if ((env->flags & (POWERPC_FLAG_RTC_CLK | POWERPC_FLAG_BUS_CLK)) == 0) {", "fprintf(stderr, \"PowerPC flags inconsistency\\n\"\n\"Should define the time-base and decrementer clock source\\n\");", "exit(1);", "}", "#if !defined(CONFIG_USER_ONLY)\nif (env->VAR_2 != 0) {", "int VAR_2 = env->VAR_2;", "if (env->id_tlbs != 0)\nVAR_2 *= 2;", "switch (env->tlb_type) {", "case TLB_6XX:\nenv->tlb.tlb6 = g_malloc0(VAR_2 * sizeof(ppc6xx_tlb_t));", "break;", "case TLB_EMB:\nenv->tlb.tlbe = g_malloc0(VAR_2 * sizeof(ppcemb_tlb_t));", "break;", "case TLB_MAS:\nenv->tlb.tlbm = g_malloc0(VAR_2 * sizeof(ppcmas_tlb_t));", "break;", "}", "env->tlb_per_way = env->VAR_2 / env->nb_ways;", "}", "if (env->irq_inputs == NULL) {", "fprintf(stderr, \"WARNING: no internal IRQ controller registered.\\n\"\n\" Attempt QEMU to crash very soon !\\n\");", "}", "#endif\nif (env->check_pow == NULL) {", "fprintf(stderr, \"WARNING: no power management check handler \"\n\"registered.\\n\"\n\" Attempt QEMU to crash very soon !\\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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 41 ], [ 43, 47, 49, 51, 53, 55, 57, 59, 61 ], [ 65 ], [ 67 ], [ 69, 71, 73, 75 ], [ 77 ], [ 79, 81, 83, 85 ], [ 87 ], [ 89 ], [ 93 ], [ 99 ], [ 101 ], [ 103, 105, 107 ], [ 109, 111, 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133, 135, 137 ], [ 139, 141, 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151, 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161, 163 ], [ 165, 167, 169, 171 ], [ 173, 175, 177, 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189, 191, 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203, 205, 207 ], [ 209, 211, 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221, 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233, 235, 237 ], [ 239, 241, 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251, 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261, 263 ], [ 265 ], [ 267 ], [ 271, 273 ], [ 275 ], [ 277, 279 ], [ 281 ], [ 283, 285 ], [ 287 ], [ 289, 291 ], [ 293 ], [ 295, 297 ], [ 299 ], [ 301 ], [ 305 ], [ 307 ], [ 309 ], [ 311, 313 ], [ 315 ], [ 317, 319 ], [ 321, 323, 325 ], [ 327 ], [ 329 ] ]
2,173
static int set_boot_dev(ISADevice *s, const char *boot_device) { #define PC_MAX_BOOT_DEVICES 3 int nbds, bds[3] = { 0, }; int i; nbds = strlen(boot_device); if (nbds > PC_MAX_BOOT_DEVICES) { error_report("Too many boot devices for PC"); return(1); } for (i = 0; i < nbds; i++) { bds[i] = boot_device2nibble(boot_device[i]); if (bds[i] == 0) { error_report("Invalid boot device for PC: '%c'", boot_device[i]); return(1); } } rtc_set_memory(s, 0x3d, (bds[1] << 4) | bds[0]); rtc_set_memory(s, 0x38, (bds[2] << 4) | (fd_bootchk ? 0x0 : 0x1)); return(0); }
false
qemu
ddcd55316fb2851e144e719171621ad2816487dc
static int set_boot_dev(ISADevice *s, const char *boot_device) { #define PC_MAX_BOOT_DEVICES 3 int nbds, bds[3] = { 0, }; int i; nbds = strlen(boot_device); if (nbds > PC_MAX_BOOT_DEVICES) { error_report("Too many boot devices for PC"); return(1); } for (i = 0; i < nbds; i++) { bds[i] = boot_device2nibble(boot_device[i]); if (bds[i] == 0) { error_report("Invalid boot device for PC: '%c'", boot_device[i]); return(1); } } rtc_set_memory(s, 0x3d, (bds[1] << 4) | bds[0]); rtc_set_memory(s, 0x38, (bds[2] << 4) | (fd_bootchk ? 0x0 : 0x1)); return(0); }
{ "code": [], "line_no": [] }
static int FUNC_0(ISADevice *VAR_0, const char *VAR_1) { #define PC_MAX_BOOT_DEVICES 3 int VAR_2, VAR_3[3] = { 0, }; int VAR_4; VAR_2 = strlen(VAR_1); if (VAR_2 > PC_MAX_BOOT_DEVICES) { error_report("Too many boot devices for PC"); return(1); } for (VAR_4 = 0; VAR_4 < VAR_2; VAR_4++) { VAR_3[VAR_4] = boot_device2nibble(VAR_1[VAR_4]); if (VAR_3[VAR_4] == 0) { error_report("Invalid boot device for PC: '%c'", VAR_1[VAR_4]); return(1); } } rtc_set_memory(VAR_0, 0x3d, (VAR_3[1] << 4) | VAR_3[0]); rtc_set_memory(VAR_0, 0x38, (VAR_3[2] << 4) | (fd_bootchk ? 0x0 : 0x1)); return(0); }
[ "static int FUNC_0(ISADevice *VAR_0, const char *VAR_1)\n{", "#define PC_MAX_BOOT_DEVICES 3\nint VAR_2, VAR_3[3] = { 0, };", "int VAR_4;", "VAR_2 = strlen(VAR_1);", "if (VAR_2 > PC_MAX_BOOT_DEVICES) {", "error_report(\"Too many boot devices for PC\");", "return(1);", "}", "for (VAR_4 = 0; VAR_4 < VAR_2; VAR_4++) {", "VAR_3[VAR_4] = boot_device2nibble(VAR_1[VAR_4]);", "if (VAR_3[VAR_4] == 0) {", "error_report(\"Invalid boot device for PC: '%c'\",\nVAR_1[VAR_4]);", "return(1);", "}", "}", "rtc_set_memory(VAR_0, 0x3d, (VAR_3[1] << 4) | VAR_3[0]);", "rtc_set_memory(VAR_0, 0x38, (VAR_3[2] << 4) | (fd_bootchk ? 0x0 : 0x1));", "return(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 ] ]
2,174
static int64_t load_kernel (void) { int64_t kernel_entry, kernel_high; long initrd_size; ram_addr_t initrd_offset; int big_endian; uint32_t *prom_buf; long prom_size; int prom_index = 0; #ifdef TARGET_WORDS_BIGENDIAN big_endian = 1; #else big_endian = 0; #endif if (load_elf(loaderparams.kernel_filename, cpu_mips_kseg0_to_phys, NULL, (uint64_t *)&kernel_entry, NULL, (uint64_t *)&kernel_high, big_endian, ELF_MACHINE, 1) < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", loaderparams.kernel_filename); exit(1); } /* load initrd */ initrd_size = 0; initrd_offset = 0; if (loaderparams.initrd_filename) { initrd_size = get_image_size (loaderparams.initrd_filename); if (initrd_size > 0) { initrd_offset = (kernel_high + ~INITRD_PAGE_MASK) & INITRD_PAGE_MASK; if (initrd_offset + initrd_size > ram_size) { fprintf(stderr, "qemu: memory too small for initial ram disk '%s'\n", loaderparams.initrd_filename); exit(1); } initrd_size = load_image_targphys(loaderparams.initrd_filename, initrd_offset, ram_size - initrd_offset); } if (initrd_size == (target_ulong) -1) { fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", loaderparams.initrd_filename); exit(1); } } /* Setup prom parameters. */ prom_size = ENVP_NB_ENTRIES * (sizeof(int32_t) + ENVP_ENTRY_SIZE); prom_buf = g_malloc(prom_size); prom_set(prom_buf, prom_index++, "%s", loaderparams.kernel_filename); if (initrd_size > 0) { prom_set(prom_buf, prom_index++, "rd_start=0x%" PRIx64 " rd_size=%li %s", cpu_mips_phys_to_kseg0(NULL, initrd_offset), initrd_size, loaderparams.kernel_cmdline); } else { prom_set(prom_buf, prom_index++, "%s", loaderparams.kernel_cmdline); } prom_set(prom_buf, prom_index++, "memsize"); prom_set(prom_buf, prom_index++, "%i", loaderparams.ram_size); prom_set(prom_buf, prom_index++, "modetty0"); prom_set(prom_buf, prom_index++, "38400n8r"); prom_set(prom_buf, prom_index++, NULL); rom_add_blob_fixed("prom", prom_buf, prom_size, cpu_mips_kseg0_to_phys(NULL, ENVP_ADDR)); return kernel_entry; }
false
qemu
94c2b6aff43cdfcfdfb552773a6b6b973a72ef0b
static int64_t load_kernel (void) { int64_t kernel_entry, kernel_high; long initrd_size; ram_addr_t initrd_offset; int big_endian; uint32_t *prom_buf; long prom_size; int prom_index = 0; #ifdef TARGET_WORDS_BIGENDIAN big_endian = 1; #else big_endian = 0; #endif if (load_elf(loaderparams.kernel_filename, cpu_mips_kseg0_to_phys, NULL, (uint64_t *)&kernel_entry, NULL, (uint64_t *)&kernel_high, big_endian, ELF_MACHINE, 1) < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", loaderparams.kernel_filename); exit(1); } initrd_size = 0; initrd_offset = 0; if (loaderparams.initrd_filename) { initrd_size = get_image_size (loaderparams.initrd_filename); if (initrd_size > 0) { initrd_offset = (kernel_high + ~INITRD_PAGE_MASK) & INITRD_PAGE_MASK; if (initrd_offset + initrd_size > ram_size) { fprintf(stderr, "qemu: memory too small for initial ram disk '%s'\n", loaderparams.initrd_filename); exit(1); } initrd_size = load_image_targphys(loaderparams.initrd_filename, initrd_offset, ram_size - initrd_offset); } if (initrd_size == (target_ulong) -1) { fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", loaderparams.initrd_filename); exit(1); } } prom_size = ENVP_NB_ENTRIES * (sizeof(int32_t) + ENVP_ENTRY_SIZE); prom_buf = g_malloc(prom_size); prom_set(prom_buf, prom_index++, "%s", loaderparams.kernel_filename); if (initrd_size > 0) { prom_set(prom_buf, prom_index++, "rd_start=0x%" PRIx64 " rd_size=%li %s", cpu_mips_phys_to_kseg0(NULL, initrd_offset), initrd_size, loaderparams.kernel_cmdline); } else { prom_set(prom_buf, prom_index++, "%s", loaderparams.kernel_cmdline); } prom_set(prom_buf, prom_index++, "memsize"); prom_set(prom_buf, prom_index++, "%i", loaderparams.ram_size); prom_set(prom_buf, prom_index++, "modetty0"); prom_set(prom_buf, prom_index++, "38400n8r"); prom_set(prom_buf, prom_index++, NULL); rom_add_blob_fixed("prom", prom_buf, prom_size, cpu_mips_kseg0_to_phys(NULL, ENVP_ADDR)); return kernel_entry; }
{ "code": [], "line_no": [] }
static int64_t FUNC_0 (void) { int64_t kernel_entry, kernel_high; long VAR_0; ram_addr_t initrd_offset; int VAR_1; uint32_t *prom_buf; long VAR_2; int VAR_3 = 0; #ifdef TARGET_WORDS_BIGENDIAN VAR_1 = 1; #else VAR_1 = 0; #endif if (load_elf(loaderparams.kernel_filename, cpu_mips_kseg0_to_phys, NULL, (uint64_t *)&kernel_entry, NULL, (uint64_t *)&kernel_high, VAR_1, ELF_MACHINE, 1) < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", loaderparams.kernel_filename); exit(1); } VAR_0 = 0; initrd_offset = 0; if (loaderparams.initrd_filename) { VAR_0 = get_image_size (loaderparams.initrd_filename); if (VAR_0 > 0) { initrd_offset = (kernel_high + ~INITRD_PAGE_MASK) & INITRD_PAGE_MASK; if (initrd_offset + VAR_0 > ram_size) { fprintf(stderr, "qemu: memory too small for initial ram disk '%s'\n", loaderparams.initrd_filename); exit(1); } VAR_0 = load_image_targphys(loaderparams.initrd_filename, initrd_offset, ram_size - initrd_offset); } if (VAR_0 == (target_ulong) -1) { fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", loaderparams.initrd_filename); exit(1); } } VAR_2 = ENVP_NB_ENTRIES * (sizeof(int32_t) + ENVP_ENTRY_SIZE); prom_buf = g_malloc(VAR_2); prom_set(prom_buf, VAR_3++, "%s", loaderparams.kernel_filename); if (VAR_0 > 0) { prom_set(prom_buf, VAR_3++, "rd_start=0x%" PRIx64 " rd_size=%li %s", cpu_mips_phys_to_kseg0(NULL, initrd_offset), VAR_0, loaderparams.kernel_cmdline); } else { prom_set(prom_buf, VAR_3++, "%s", loaderparams.kernel_cmdline); } prom_set(prom_buf, VAR_3++, "memsize"); prom_set(prom_buf, VAR_3++, "%i", loaderparams.ram_size); prom_set(prom_buf, VAR_3++, "modetty0"); prom_set(prom_buf, VAR_3++, "38400n8r"); prom_set(prom_buf, VAR_3++, NULL); rom_add_blob_fixed("prom", prom_buf, VAR_2, cpu_mips_kseg0_to_phys(NULL, ENVP_ADDR)); return kernel_entry; }
[ "static int64_t FUNC_0 (void)\n{", "int64_t kernel_entry, kernel_high;", "long VAR_0;", "ram_addr_t initrd_offset;", "int VAR_1;", "uint32_t *prom_buf;", "long VAR_2;", "int VAR_3 = 0;", "#ifdef TARGET_WORDS_BIGENDIAN\nVAR_1 = 1;", "#else\nVAR_1 = 0;", "#endif\nif (load_elf(loaderparams.kernel_filename, cpu_mips_kseg0_to_phys, NULL,\n(uint64_t *)&kernel_entry, NULL, (uint64_t *)&kernel_high,\nVAR_1, ELF_MACHINE, 1) < 0) {", "fprintf(stderr, \"qemu: could not load kernel '%s'\\n\",\nloaderparams.kernel_filename);", "exit(1);", "}", "VAR_0 = 0;", "initrd_offset = 0;", "if (loaderparams.initrd_filename) {", "VAR_0 = get_image_size (loaderparams.initrd_filename);", "if (VAR_0 > 0) {", "initrd_offset = (kernel_high + ~INITRD_PAGE_MASK) & INITRD_PAGE_MASK;", "if (initrd_offset + VAR_0 > ram_size) {", "fprintf(stderr,\n\"qemu: memory too small for initial ram disk '%s'\\n\",\nloaderparams.initrd_filename);", "exit(1);", "}", "VAR_0 = load_image_targphys(loaderparams.initrd_filename,\ninitrd_offset,\nram_size - initrd_offset);", "}", "if (VAR_0 == (target_ulong) -1) {", "fprintf(stderr, \"qemu: could not load initial ram disk '%s'\\n\",\nloaderparams.initrd_filename);", "exit(1);", "}", "}", "VAR_2 = ENVP_NB_ENTRIES * (sizeof(int32_t) + ENVP_ENTRY_SIZE);", "prom_buf = g_malloc(VAR_2);", "prom_set(prom_buf, VAR_3++, \"%s\", loaderparams.kernel_filename);", "if (VAR_0 > 0) {", "prom_set(prom_buf, VAR_3++, \"rd_start=0x%\" PRIx64 \" rd_size=%li %s\",\ncpu_mips_phys_to_kseg0(NULL, initrd_offset), VAR_0,\nloaderparams.kernel_cmdline);", "} else {", "prom_set(prom_buf, VAR_3++, \"%s\", loaderparams.kernel_cmdline);", "}", "prom_set(prom_buf, VAR_3++, \"memsize\");", "prom_set(prom_buf, VAR_3++, \"%i\", loaderparams.ram_size);", "prom_set(prom_buf, VAR_3++, \"modetty0\");", "prom_set(prom_buf, VAR_3++, \"38400n8r\");", "prom_set(prom_buf, VAR_3++, NULL);", "rom_add_blob_fixed(\"prom\", prom_buf, VAR_2,\ncpu_mips_kseg0_to_phys(NULL, ENVP_ADDR));", "return kernel_entry;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 25, 27 ], [ 29, 33, 35, 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67, 69 ], [ 71 ], [ 73 ], [ 75, 77, 79 ], [ 81 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109, 111, 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135, 137 ], [ 141 ], [ 143 ] ]
2,175
static int nbd_co_receive_reply(NBDClientSession *s, NBDRequest *request, QEMUIOVector *qiov) { int ret; int i = HANDLE_TO_INDEX(s, request->handle); /* Wait until we're woken up by nbd_read_reply_entry. */ s->requests[i].receiving = true; qemu_coroutine_yield(); s->requests[i].receiving = false; if (s->reply.handle != request->handle || !s->ioc || s->quit) { ret = -EIO; } else { ret = -s->reply.error; if (qiov && s->reply.error == 0) { assert(request->len == iov_size(qiov->iov, qiov->niov)); if (qio_channel_readv_all(s->ioc, qiov->iov, qiov->niov, NULL) < 0) { ret = -EIO; s->quit = true; } } /* Tell the read handler to read another header. */ s->reply.handle = 0; } s->requests[i].coroutine = NULL; /* Kick the read_reply_co to get the next reply. */ if (s->read_reply_co) { aio_co_wake(s->read_reply_co); } qemu_co_mutex_lock(&s->send_mutex); s->in_flight--; qemu_co_queue_next(&s->free_sema); qemu_co_mutex_unlock(&s->send_mutex); return ret; }
false
qemu
93970672210ca1ee45fdebbc11e1fd97916c7c8e
static int nbd_co_receive_reply(NBDClientSession *s, NBDRequest *request, QEMUIOVector *qiov) { int ret; int i = HANDLE_TO_INDEX(s, request->handle); s->requests[i].receiving = true; qemu_coroutine_yield(); s->requests[i].receiving = false; if (s->reply.handle != request->handle || !s->ioc || s->quit) { ret = -EIO; } else { ret = -s->reply.error; if (qiov && s->reply.error == 0) { assert(request->len == iov_size(qiov->iov, qiov->niov)); if (qio_channel_readv_all(s->ioc, qiov->iov, qiov->niov, NULL) < 0) { ret = -EIO; s->quit = true; } } s->reply.handle = 0; } s->requests[i].coroutine = NULL; if (s->read_reply_co) { aio_co_wake(s->read_reply_co); } qemu_co_mutex_lock(&s->send_mutex); s->in_flight--; qemu_co_queue_next(&s->free_sema); qemu_co_mutex_unlock(&s->send_mutex); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(NBDClientSession *VAR_0, NBDRequest *VAR_1, QEMUIOVector *VAR_2) { int VAR_3; int VAR_4 = HANDLE_TO_INDEX(VAR_0, VAR_1->handle); VAR_0->requests[VAR_4].receiving = true; qemu_coroutine_yield(); VAR_0->requests[VAR_4].receiving = false; if (VAR_0->reply.handle != VAR_1->handle || !VAR_0->ioc || VAR_0->quit) { VAR_3 = -EIO; } else { VAR_3 = -VAR_0->reply.error; if (VAR_2 && VAR_0->reply.error == 0) { assert(VAR_1->len == iov_size(VAR_2->iov, VAR_2->niov)); if (qio_channel_readv_all(VAR_0->ioc, VAR_2->iov, VAR_2->niov, NULL) < 0) { VAR_3 = -EIO; VAR_0->quit = true; } } VAR_0->reply.handle = 0; } VAR_0->requests[VAR_4].coroutine = NULL; if (VAR_0->read_reply_co) { aio_co_wake(VAR_0->read_reply_co); } qemu_co_mutex_lock(&VAR_0->send_mutex); VAR_0->in_flight--; qemu_co_queue_next(&VAR_0->free_sema); qemu_co_mutex_unlock(&VAR_0->send_mutex); return VAR_3; }
[ "static int FUNC_0(NBDClientSession *VAR_0,\nNBDRequest *VAR_1,\nQEMUIOVector *VAR_2)\n{", "int VAR_3;", "int VAR_4 = HANDLE_TO_INDEX(VAR_0, VAR_1->handle);", "VAR_0->requests[VAR_4].receiving = true;", "qemu_coroutine_yield();", "VAR_0->requests[VAR_4].receiving = false;", "if (VAR_0->reply.handle != VAR_1->handle || !VAR_0->ioc || VAR_0->quit) {", "VAR_3 = -EIO;", "} else {", "VAR_3 = -VAR_0->reply.error;", "if (VAR_2 && VAR_0->reply.error == 0) {", "assert(VAR_1->len == iov_size(VAR_2->iov, VAR_2->niov));", "if (qio_channel_readv_all(VAR_0->ioc, VAR_2->iov, VAR_2->niov,\nNULL) < 0) {", "VAR_3 = -EIO;", "VAR_0->quit = true;", "}", "}", "VAR_0->reply.handle = 0;", "}", "VAR_0->requests[VAR_4].coroutine = NULL;", "if (VAR_0->read_reply_co) {", "aio_co_wake(VAR_0->read_reply_co);", "}", "qemu_co_mutex_lock(&VAR_0->send_mutex);", "VAR_0->in_flight--;", "qemu_co_queue_next(&VAR_0->free_sema);", "qemu_co_mutex_unlock(&VAR_0->send_mutex);", "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 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 51 ], [ 53 ], [ 57 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ] ]
2,176
void ff_h264_init_cabac_states(const H264Context *h, H264SliceContext *sl) { int i; const int8_t (*tab)[2]; const int slice_qp = av_clip(sl->qscale - 6*(h->sps.bit_depth_luma-8), 0, 51); if (sl->slice_type_nos == AV_PICTURE_TYPE_I) tab = cabac_context_init_I; else tab = cabac_context_init_PB[sl->cabac_init_idc]; /* calculate pre-state */ for( i= 0; i < 1024; i++ ) { int pre = 2*(((tab[i][0] * slice_qp) >>4 ) + tab[i][1]) - 127; pre^= pre>>31; if(pre > 124) pre= 124 + (pre&1); sl->cabac_state[i] = pre; } }
false
FFmpeg
3176217c60ca7828712985092d9102d331ea4f3d
void ff_h264_init_cabac_states(const H264Context *h, H264SliceContext *sl) { int i; const int8_t (*tab)[2]; const int slice_qp = av_clip(sl->qscale - 6*(h->sps.bit_depth_luma-8), 0, 51); if (sl->slice_type_nos == AV_PICTURE_TYPE_I) tab = cabac_context_init_I; else tab = cabac_context_init_PB[sl->cabac_init_idc]; for( i= 0; i < 1024; i++ ) { int pre = 2*(((tab[i][0] * slice_qp) >>4 ) + tab[i][1]) - 127; pre^= pre>>31; if(pre > 124) pre= 124 + (pre&1); sl->cabac_state[i] = pre; } }
{ "code": [], "line_no": [] }
void FUNC_0(const H264Context *VAR_0, H264SliceContext *VAR_1) { int VAR_2; const FUNC_1 (*tab)[2]; const int VAR_3 = av_clip(VAR_1->qscale - 6*(VAR_0->sps.bit_depth_luma-8), 0, 51); if (VAR_1->slice_type_nos == AV_PICTURE_TYPE_I) tab = cabac_context_init_I; else tab = cabac_context_init_PB[VAR_1->cabac_init_idc]; for( VAR_2= 0; VAR_2 < 1024; VAR_2++ ) { int VAR_4 = 2*(((tab[VAR_2][0] * VAR_3) >>4 ) + tab[VAR_2][1]) - 127; VAR_4^= VAR_4>>31; if(VAR_4 > 124) VAR_4= 124 + (VAR_4&1); VAR_1->cabac_state[VAR_2] = VAR_4; } }
[ "void FUNC_0(const H264Context *VAR_0, H264SliceContext *VAR_1)\n{", "int VAR_2;", "const FUNC_1 (*tab)[2];", "const int VAR_3 = av_clip(VAR_1->qscale - 6*(VAR_0->sps.bit_depth_luma-8), 0, 51);", "if (VAR_1->slice_type_nos == AV_PICTURE_TYPE_I) tab = cabac_context_init_I;", "else tab = cabac_context_init_PB[VAR_1->cabac_init_idc];", "for( VAR_2= 0; VAR_2 < 1024; VAR_2++ ) {", "int VAR_4 = 2*(((tab[VAR_2][0] * VAR_3) >>4 ) + tab[VAR_2][1]) - 127;", "VAR_4^= VAR_4>>31;", "if(VAR_4 > 124)\nVAR_4= 124 + (VAR_4&1);", "VAR_1->cabac_state[VAR_2] = VAR_4;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 21 ], [ 23 ], [ 27 ], [ 29, 31 ], [ 35 ], [ 37 ], [ 39 ] ]
2,177
static int mov_read_udta(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) { uint64_t end = url_ftell(pb) + atom.size; while (url_ftell(pb) + 8 < end) { uint32_t tag_size = get_be32(pb); uint32_t tag = get_le32(pb); uint64_t next = url_ftell(pb) + tag_size - 8; if (next > end) // stop if tag_size is wrong break; switch (tag) { case MKTAG(0xa9,'n','a','m'): mov_parse_udta_string(pb, c->fc->title, sizeof(c->fc->title)); break; case MKTAG(0xa9,'w','r','t'): mov_parse_udta_string(pb, c->fc->author, sizeof(c->fc->author)); break; case MKTAG(0xa9,'c','p','y'): mov_parse_udta_string(pb, c->fc->copyright, sizeof(c->fc->copyright)); break; case MKTAG(0xa9,'i','n','f'): mov_parse_udta_string(pb, c->fc->comment, sizeof(c->fc->comment)); break; default: break; } url_fseek(pb, next, SEEK_SET); } return 0; }
false
FFmpeg
4e240985d8b856e62e4e0377283138cf51cc398e
static int mov_read_udta(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) { uint64_t end = url_ftell(pb) + atom.size; while (url_ftell(pb) + 8 < end) { uint32_t tag_size = get_be32(pb); uint32_t tag = get_le32(pb); uint64_t next = url_ftell(pb) + tag_size - 8; if (next > end) break; switch (tag) { case MKTAG(0xa9,'n','a','m'): mov_parse_udta_string(pb, c->fc->title, sizeof(c->fc->title)); break; case MKTAG(0xa9,'w','r','t'): mov_parse_udta_string(pb, c->fc->author, sizeof(c->fc->author)); break; case MKTAG(0xa9,'c','p','y'): mov_parse_udta_string(pb, c->fc->copyright, sizeof(c->fc->copyright)); break; case MKTAG(0xa9,'i','n','f'): mov_parse_udta_string(pb, c->fc->comment, sizeof(c->fc->comment)); break; default: break; } url_fseek(pb, next, SEEK_SET); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOV_atom_t VAR_2) { uint64_t end = url_ftell(VAR_1) + VAR_2.size; while (url_ftell(VAR_1) + 8 < end) { uint32_t tag_size = get_be32(VAR_1); uint32_t tag = get_le32(VAR_1); uint64_t next = url_ftell(VAR_1) + tag_size - 8; if (next > end) break; switch (tag) { case MKTAG(0xa9,'n','a','m'): mov_parse_udta_string(VAR_1, VAR_0->fc->title, sizeof(VAR_0->fc->title)); break; case MKTAG(0xa9,'w','r','t'): mov_parse_udta_string(VAR_1, VAR_0->fc->author, sizeof(VAR_0->fc->author)); break; case MKTAG(0xa9,'VAR_0','p','y'): mov_parse_udta_string(VAR_1, VAR_0->fc->copyright, sizeof(VAR_0->fc->copyright)); break; case MKTAG(0xa9,'i','n','f'): mov_parse_udta_string(VAR_1, VAR_0->fc->comment, sizeof(VAR_0->fc->comment)); break; default: break; } url_fseek(VAR_1, next, SEEK_SET); } return 0; }
[ "static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOV_atom_t VAR_2)\n{", "uint64_t end = url_ftell(VAR_1) + VAR_2.size;", "while (url_ftell(VAR_1) + 8 < end) {", "uint32_t tag_size = get_be32(VAR_1);", "uint32_t tag = get_le32(VAR_1);", "uint64_t next = url_ftell(VAR_1) + tag_size - 8;", "if (next > end)\nbreak;", "switch (tag) {", "case MKTAG(0xa9,'n','a','m'):\nmov_parse_udta_string(VAR_1, VAR_0->fc->title, sizeof(VAR_0->fc->title));", "break;", "case MKTAG(0xa9,'w','r','t'):\nmov_parse_udta_string(VAR_1, VAR_0->fc->author, sizeof(VAR_0->fc->author));", "break;", "case MKTAG(0xa9,'VAR_0','p','y'):\nmov_parse_udta_string(VAR_1, VAR_0->fc->copyright, sizeof(VAR_0->fc->copyright));", "break;", "case MKTAG(0xa9,'i','n','f'):\nmov_parse_udta_string(VAR_1, VAR_0->fc->comment, sizeof(VAR_0->fc->comment));", "break;", "default:\nbreak;", "}", "url_fseek(VAR_1, next, 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 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ] ]
2,178
static int usb_host_auto_scan(void *opaque, int bus_num, int addr, char *port, int class_id, int vendor_id, int product_id, const char *product_name, int speed) { struct USBAutoFilter *f; struct USBHostDevice *s; /* Ignore hubs */ if (class_id == 9) return 0; QTAILQ_FOREACH(s, &hostdevs, next) { f = &s->match; if (f->bus_num > 0 && f->bus_num != bus_num) { continue; } if (f->addr > 0 && f->addr != addr) { continue; } if (f->port != NULL && (port == NULL || strcmp(f->port, port) != 0)) { continue; } if (f->vendor_id > 0 && f->vendor_id != vendor_id) { continue; } if (f->product_id > 0 && f->product_id != product_id) { continue; } /* We got a match */ /* Already attached ? */ if (s->fd != -1) { return 0; } DPRINTF("husb: auto open: bus_num %d addr %d\n", bus_num, addr); usb_host_open(s, bus_num, addr, port, product_name, speed); break; } return 0; }
false
qemu
3ee886c5ba77a65d6b2c2a372a091d6796ed502b
static int usb_host_auto_scan(void *opaque, int bus_num, int addr, char *port, int class_id, int vendor_id, int product_id, const char *product_name, int speed) { struct USBAutoFilter *f; struct USBHostDevice *s; if (class_id == 9) return 0; QTAILQ_FOREACH(s, &hostdevs, next) { f = &s->match; if (f->bus_num > 0 && f->bus_num != bus_num) { continue; } if (f->addr > 0 && f->addr != addr) { continue; } if (f->port != NULL && (port == NULL || strcmp(f->port, port) != 0)) { continue; } if (f->vendor_id > 0 && f->vendor_id != vendor_id) { continue; } if (f->product_id > 0 && f->product_id != product_id) { continue; } if (s->fd != -1) { return 0; } DPRINTF("husb: auto open: bus_num %d addr %d\n", bus_num, addr); usb_host_open(s, bus_num, addr, port, product_name, speed); break; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(void *VAR_0, int VAR_1, int VAR_2, char *VAR_3, int VAR_4, int VAR_5, int VAR_6, const char *VAR_7, int VAR_8) { struct USBAutoFilter *VAR_9; struct USBHostDevice *VAR_10; if (VAR_4 == 9) return 0; QTAILQ_FOREACH(VAR_10, &hostdevs, next) { VAR_9 = &VAR_10->match; if (VAR_9->VAR_1 > 0 && VAR_9->VAR_1 != VAR_1) { continue; } if (VAR_9->VAR_2 > 0 && VAR_9->VAR_2 != VAR_2) { continue; } if (VAR_9->VAR_3 != NULL && (VAR_3 == NULL || strcmp(VAR_9->VAR_3, VAR_3) != 0)) { continue; } if (VAR_9->VAR_5 > 0 && VAR_9->VAR_5 != VAR_5) { continue; } if (VAR_9->VAR_6 > 0 && VAR_9->VAR_6 != VAR_6) { continue; } if (VAR_10->fd != -1) { return 0; } DPRINTF("husb: auto open: VAR_1 %d VAR_2 %d\n", VAR_1, VAR_2); usb_host_open(VAR_10, VAR_1, VAR_2, VAR_3, VAR_7, VAR_8); break; } return 0; }
[ "static int FUNC_0(void *VAR_0, int VAR_1, int VAR_2, char *VAR_3,\nint VAR_4, int VAR_5, int VAR_6,\nconst char *VAR_7, int VAR_8)\n{", "struct USBAutoFilter *VAR_9;", "struct USBHostDevice *VAR_10;", "if (VAR_4 == 9)\nreturn 0;", "QTAILQ_FOREACH(VAR_10, &hostdevs, next) {", "VAR_9 = &VAR_10->match;", "if (VAR_9->VAR_1 > 0 && VAR_9->VAR_1 != VAR_1) {", "continue;", "}", "if (VAR_9->VAR_2 > 0 && VAR_9->VAR_2 != VAR_2) {", "continue;", "}", "if (VAR_9->VAR_3 != NULL && (VAR_3 == NULL || strcmp(VAR_9->VAR_3, VAR_3) != 0)) {", "continue;", "}", "if (VAR_9->VAR_5 > 0 && VAR_9->VAR_5 != VAR_5) {", "continue;", "}", "if (VAR_9->VAR_6 > 0 && VAR_9->VAR_6 != VAR_6) {", "continue;", "}", "if (VAR_10->fd != -1) {", "return 0;", "}", "DPRINTF(\"husb: auto open: VAR_1 %d VAR_2 %d\\n\", VAR_1, VAR_2);", "usb_host_open(VAR_10, VAR_1, VAR_2, VAR_3, VAR_7, VAR_8);", "break;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 17, 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ] ]
2,179
static int disas_coproc_insn(DisasContext *s, uint32_t insn) { int cpnum, is64, crn, crm, opc1, opc2, isread, rt, rt2; const ARMCPRegInfo *ri; cpnum = (insn >> 8) & 0xf; /* First check for coprocessor space used for XScale/iwMMXt insns */ if (arm_dc_feature(s, ARM_FEATURE_XSCALE) && (cpnum < 2)) { if (extract32(s->c15_cpar, cpnum, 1) == 0) { return 1; } if (arm_dc_feature(s, ARM_FEATURE_IWMMXT)) { return disas_iwmmxt_insn(s, insn); } else if (arm_dc_feature(s, ARM_FEATURE_XSCALE)) { return disas_dsp_insn(s, insn); } return 1; } /* Otherwise treat as a generic register access */ is64 = (insn & (1 << 25)) == 0; if (!is64 && ((insn & (1 << 4)) == 0)) { /* cdp */ return 1; } crm = insn & 0xf; if (is64) { crn = 0; opc1 = (insn >> 4) & 0xf; opc2 = 0; rt2 = (insn >> 16) & 0xf; } else { crn = (insn >> 16) & 0xf; opc1 = (insn >> 21) & 7; opc2 = (insn >> 5) & 7; rt2 = 0; } isread = (insn >> 20) & 1; rt = (insn >> 12) & 0xf; ri = get_arm_cp_reginfo(s->cp_regs, ENCODE_CP_REG(cpnum, is64, s->ns, crn, crm, opc1, opc2)); if (ri) { /* Check access permissions */ if (!cp_access_ok(s->current_el, ri, isread)) { return 1; } if (ri->accessfn || (arm_dc_feature(s, ARM_FEATURE_XSCALE) && cpnum < 14)) { /* Emit code to perform further access permissions checks at * runtime; this may result in an exception. * Note that on XScale all cp0..c13 registers do an access check * call in order to handle c15_cpar. */ TCGv_ptr tmpptr; TCGv_i32 tcg_syn; uint32_t syndrome; /* Note that since we are an implementation which takes an * exception on a trapped conditional instruction only if the * instruction passes its condition code check, we can take * advantage of the clause in the ARM ARM that allows us to set * the COND field in the instruction to 0xE in all cases. * We could fish the actual condition out of the insn (ARM) * or the condexec bits (Thumb) but it isn't necessary. */ switch (cpnum) { case 14: if (is64) { syndrome = syn_cp14_rrt_trap(1, 0xe, opc1, crm, rt, rt2, isread, s->thumb); } else { syndrome = syn_cp14_rt_trap(1, 0xe, opc1, opc2, crn, crm, rt, isread, s->thumb); } break; case 15: if (is64) { syndrome = syn_cp15_rrt_trap(1, 0xe, opc1, crm, rt, rt2, isread, s->thumb); } else { syndrome = syn_cp15_rt_trap(1, 0xe, opc1, opc2, crn, crm, rt, isread, s->thumb); } break; default: /* ARMv8 defines that only coprocessors 14 and 15 exist, * so this can only happen if this is an ARMv7 or earlier CPU, * in which case the syndrome information won't actually be * guest visible. */ assert(!arm_dc_feature(s, ARM_FEATURE_V8)); syndrome = syn_uncategorized(); break; } gen_set_pc_im(s, s->pc); tmpptr = tcg_const_ptr(ri); tcg_syn = tcg_const_i32(syndrome); gen_helper_access_check_cp_reg(cpu_env, tmpptr, tcg_syn); tcg_temp_free_ptr(tmpptr); tcg_temp_free_i32(tcg_syn); } /* Handle special cases first */ switch (ri->type & ~(ARM_CP_FLAG_MASK & ~ARM_CP_SPECIAL)) { case ARM_CP_NOP: return 0; case ARM_CP_WFI: if (isread) { return 1; } gen_set_pc_im(s, s->pc); s->is_jmp = DISAS_WFI; return 0; default: break; } if (use_icount && (ri->type & ARM_CP_IO)) { gen_io_start(); } if (isread) { /* Read */ if (is64) { TCGv_i64 tmp64; TCGv_i32 tmp; if (ri->type & ARM_CP_CONST) { tmp64 = tcg_const_i64(ri->resetvalue); } else if (ri->readfn) { TCGv_ptr tmpptr; tmp64 = tcg_temp_new_i64(); tmpptr = tcg_const_ptr(ri); gen_helper_get_cp_reg64(tmp64, cpu_env, tmpptr); tcg_temp_free_ptr(tmpptr); } else { tmp64 = tcg_temp_new_i64(); tcg_gen_ld_i64(tmp64, cpu_env, ri->fieldoffset); } tmp = tcg_temp_new_i32(); tcg_gen_trunc_i64_i32(tmp, tmp64); store_reg(s, rt, tmp); tcg_gen_shri_i64(tmp64, tmp64, 32); tmp = tcg_temp_new_i32(); tcg_gen_trunc_i64_i32(tmp, tmp64); tcg_temp_free_i64(tmp64); store_reg(s, rt2, tmp); } else { TCGv_i32 tmp; if (ri->type & ARM_CP_CONST) { tmp = tcg_const_i32(ri->resetvalue); } else if (ri->readfn) { TCGv_ptr tmpptr; tmp = tcg_temp_new_i32(); tmpptr = tcg_const_ptr(ri); gen_helper_get_cp_reg(tmp, cpu_env, tmpptr); tcg_temp_free_ptr(tmpptr); } else { tmp = load_cpu_offset(ri->fieldoffset); } if (rt == 15) { /* Destination register of r15 for 32 bit loads sets * the condition codes from the high 4 bits of the value */ gen_set_nzcv(tmp); tcg_temp_free_i32(tmp); } else { store_reg(s, rt, tmp); } } } else { /* Write */ if (ri->type & ARM_CP_CONST) { /* If not forbidden by access permissions, treat as WI */ return 0; } if (is64) { TCGv_i32 tmplo, tmphi; TCGv_i64 tmp64 = tcg_temp_new_i64(); tmplo = load_reg(s, rt); tmphi = load_reg(s, rt2); tcg_gen_concat_i32_i64(tmp64, tmplo, tmphi); tcg_temp_free_i32(tmplo); tcg_temp_free_i32(tmphi); if (ri->writefn) { TCGv_ptr tmpptr = tcg_const_ptr(ri); gen_helper_set_cp_reg64(cpu_env, tmpptr, tmp64); tcg_temp_free_ptr(tmpptr); } else { tcg_gen_st_i64(tmp64, cpu_env, ri->fieldoffset); } tcg_temp_free_i64(tmp64); } else { if (ri->writefn) { TCGv_i32 tmp; TCGv_ptr tmpptr; tmp = load_reg(s, rt); tmpptr = tcg_const_ptr(ri); gen_helper_set_cp_reg(cpu_env, tmpptr, tmp); tcg_temp_free_ptr(tmpptr); tcg_temp_free_i32(tmp); } else { TCGv_i32 tmp = load_reg(s, rt); store_cpu_offset(tmp, ri->fieldoffset); } } } if (use_icount && (ri->type & ARM_CP_IO)) { /* I/O operations must end the TB here (whether read or write) */ gen_io_end(); gen_lookup_tb(s); } else if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) { /* We default to ending the TB on a coprocessor register write, * but allow this to be suppressed by the register definition * (usually only necessary to work around guest bugs). */ gen_lookup_tb(s); } return 0; } /* Unknown register; this might be a guest error or a QEMU * unimplemented feature. */ if (is64) { qemu_log_mask(LOG_UNIMP, "%s access to unsupported AArch32 " "64 bit system register cp:%d opc1: %d crm:%d " "(%s)\n", isread ? "read" : "write", cpnum, opc1, crm, s->ns ? "non-secure" : "secure"); } else { qemu_log_mask(LOG_UNIMP, "%s access to unsupported AArch32 " "system register cp:%d opc1:%d crn:%d crm:%d opc2:%d " "(%s)\n", isread ? "read" : "write", cpnum, opc1, crn, crm, opc2, s->ns ? "non-secure" : "secure"); } return 1; }
false
qemu
bd79255d2571a3c68820117caf94ea9afe1d527e
static int disas_coproc_insn(DisasContext *s, uint32_t insn) { int cpnum, is64, crn, crm, opc1, opc2, isread, rt, rt2; const ARMCPRegInfo *ri; cpnum = (insn >> 8) & 0xf; if (arm_dc_feature(s, ARM_FEATURE_XSCALE) && (cpnum < 2)) { if (extract32(s->c15_cpar, cpnum, 1) == 0) { return 1; } if (arm_dc_feature(s, ARM_FEATURE_IWMMXT)) { return disas_iwmmxt_insn(s, insn); } else if (arm_dc_feature(s, ARM_FEATURE_XSCALE)) { return disas_dsp_insn(s, insn); } return 1; } is64 = (insn & (1 << 25)) == 0; if (!is64 && ((insn & (1 << 4)) == 0)) { return 1; } crm = insn & 0xf; if (is64) { crn = 0; opc1 = (insn >> 4) & 0xf; opc2 = 0; rt2 = (insn >> 16) & 0xf; } else { crn = (insn >> 16) & 0xf; opc1 = (insn >> 21) & 7; opc2 = (insn >> 5) & 7; rt2 = 0; } isread = (insn >> 20) & 1; rt = (insn >> 12) & 0xf; ri = get_arm_cp_reginfo(s->cp_regs, ENCODE_CP_REG(cpnum, is64, s->ns, crn, crm, opc1, opc2)); if (ri) { if (!cp_access_ok(s->current_el, ri, isread)) { return 1; } if (ri->accessfn || (arm_dc_feature(s, ARM_FEATURE_XSCALE) && cpnum < 14)) { TCGv_ptr tmpptr; TCGv_i32 tcg_syn; uint32_t syndrome; switch (cpnum) { case 14: if (is64) { syndrome = syn_cp14_rrt_trap(1, 0xe, opc1, crm, rt, rt2, isread, s->thumb); } else { syndrome = syn_cp14_rt_trap(1, 0xe, opc1, opc2, crn, crm, rt, isread, s->thumb); } break; case 15: if (is64) { syndrome = syn_cp15_rrt_trap(1, 0xe, opc1, crm, rt, rt2, isread, s->thumb); } else { syndrome = syn_cp15_rt_trap(1, 0xe, opc1, opc2, crn, crm, rt, isread, s->thumb); } break; default: assert(!arm_dc_feature(s, ARM_FEATURE_V8)); syndrome = syn_uncategorized(); break; } gen_set_pc_im(s, s->pc); tmpptr = tcg_const_ptr(ri); tcg_syn = tcg_const_i32(syndrome); gen_helper_access_check_cp_reg(cpu_env, tmpptr, tcg_syn); tcg_temp_free_ptr(tmpptr); tcg_temp_free_i32(tcg_syn); } switch (ri->type & ~(ARM_CP_FLAG_MASK & ~ARM_CP_SPECIAL)) { case ARM_CP_NOP: return 0; case ARM_CP_WFI: if (isread) { return 1; } gen_set_pc_im(s, s->pc); s->is_jmp = DISAS_WFI; return 0; default: break; } if (use_icount && (ri->type & ARM_CP_IO)) { gen_io_start(); } if (isread) { if (is64) { TCGv_i64 tmp64; TCGv_i32 tmp; if (ri->type & ARM_CP_CONST) { tmp64 = tcg_const_i64(ri->resetvalue); } else if (ri->readfn) { TCGv_ptr tmpptr; tmp64 = tcg_temp_new_i64(); tmpptr = tcg_const_ptr(ri); gen_helper_get_cp_reg64(tmp64, cpu_env, tmpptr); tcg_temp_free_ptr(tmpptr); } else { tmp64 = tcg_temp_new_i64(); tcg_gen_ld_i64(tmp64, cpu_env, ri->fieldoffset); } tmp = tcg_temp_new_i32(); tcg_gen_trunc_i64_i32(tmp, tmp64); store_reg(s, rt, tmp); tcg_gen_shri_i64(tmp64, tmp64, 32); tmp = tcg_temp_new_i32(); tcg_gen_trunc_i64_i32(tmp, tmp64); tcg_temp_free_i64(tmp64); store_reg(s, rt2, tmp); } else { TCGv_i32 tmp; if (ri->type & ARM_CP_CONST) { tmp = tcg_const_i32(ri->resetvalue); } else if (ri->readfn) { TCGv_ptr tmpptr; tmp = tcg_temp_new_i32(); tmpptr = tcg_const_ptr(ri); gen_helper_get_cp_reg(tmp, cpu_env, tmpptr); tcg_temp_free_ptr(tmpptr); } else { tmp = load_cpu_offset(ri->fieldoffset); } if (rt == 15) { gen_set_nzcv(tmp); tcg_temp_free_i32(tmp); } else { store_reg(s, rt, tmp); } } } else { if (ri->type & ARM_CP_CONST) { return 0; } if (is64) { TCGv_i32 tmplo, tmphi; TCGv_i64 tmp64 = tcg_temp_new_i64(); tmplo = load_reg(s, rt); tmphi = load_reg(s, rt2); tcg_gen_concat_i32_i64(tmp64, tmplo, tmphi); tcg_temp_free_i32(tmplo); tcg_temp_free_i32(tmphi); if (ri->writefn) { TCGv_ptr tmpptr = tcg_const_ptr(ri); gen_helper_set_cp_reg64(cpu_env, tmpptr, tmp64); tcg_temp_free_ptr(tmpptr); } else { tcg_gen_st_i64(tmp64, cpu_env, ri->fieldoffset); } tcg_temp_free_i64(tmp64); } else { if (ri->writefn) { TCGv_i32 tmp; TCGv_ptr tmpptr; tmp = load_reg(s, rt); tmpptr = tcg_const_ptr(ri); gen_helper_set_cp_reg(cpu_env, tmpptr, tmp); tcg_temp_free_ptr(tmpptr); tcg_temp_free_i32(tmp); } else { TCGv_i32 tmp = load_reg(s, rt); store_cpu_offset(tmp, ri->fieldoffset); } } } if (use_icount && (ri->type & ARM_CP_IO)) { gen_io_end(); gen_lookup_tb(s); } else if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) { gen_lookup_tb(s); } return 0; } if (is64) { qemu_log_mask(LOG_UNIMP, "%s access to unsupported AArch32 " "64 bit system register cp:%d opc1: %d crm:%d " "(%s)\n", isread ? "read" : "write", cpnum, opc1, crm, s->ns ? "non-secure" : "secure"); } else { qemu_log_mask(LOG_UNIMP, "%s access to unsupported AArch32 " "system register cp:%d opc1:%d crn:%d crm:%d opc2:%d " "(%s)\n", isread ? "read" : "write", cpnum, opc1, crn, crm, opc2, s->ns ? "non-secure" : "secure"); } return 1; }
{ "code": [], "line_no": [] }
static int FUNC_0(DisasContext *VAR_0, uint32_t VAR_1) { int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10; const ARMCPRegInfo *VAR_11; VAR_2 = (VAR_1 >> 8) & 0xf; if (arm_dc_feature(VAR_0, ARM_FEATURE_XSCALE) && (VAR_2 < 2)) { if (extract32(VAR_0->c15_cpar, VAR_2, 1) == 0) { return 1; } if (arm_dc_feature(VAR_0, ARM_FEATURE_IWMMXT)) { return disas_iwmmxt_insn(VAR_0, VAR_1); } else if (arm_dc_feature(VAR_0, ARM_FEATURE_XSCALE)) { return disas_dsp_insn(VAR_0, VAR_1); } return 1; } VAR_3 = (VAR_1 & (1 << 25)) == 0; if (!VAR_3 && ((VAR_1 & (1 << 4)) == 0)) { return 1; } VAR_5 = VAR_1 & 0xf; if (VAR_3) { VAR_4 = 0; VAR_6 = (VAR_1 >> 4) & 0xf; VAR_7 = 0; VAR_10 = (VAR_1 >> 16) & 0xf; } else { VAR_4 = (VAR_1 >> 16) & 0xf; VAR_6 = (VAR_1 >> 21) & 7; VAR_7 = (VAR_1 >> 5) & 7; VAR_10 = 0; } VAR_8 = (VAR_1 >> 20) & 1; VAR_9 = (VAR_1 >> 12) & 0xf; VAR_11 = get_arm_cp_reginfo(VAR_0->cp_regs, ENCODE_CP_REG(VAR_2, VAR_3, VAR_0->ns, VAR_4, VAR_5, VAR_6, VAR_7)); if (VAR_11) { if (!cp_access_ok(VAR_0->current_el, VAR_11, VAR_8)) { return 1; } if (VAR_11->accessfn || (arm_dc_feature(VAR_0, ARM_FEATURE_XSCALE) && VAR_2 < 14)) { TCGv_ptr tmpptr; TCGv_i32 tcg_syn; uint32_t syndrome; switch (VAR_2) { case 14: if (VAR_3) { syndrome = syn_cp14_rrt_trap(1, 0xe, VAR_6, VAR_5, VAR_9, VAR_10, VAR_8, VAR_0->thumb); } else { syndrome = syn_cp14_rt_trap(1, 0xe, VAR_6, VAR_7, VAR_4, VAR_5, VAR_9, VAR_8, VAR_0->thumb); } break; case 15: if (VAR_3) { syndrome = syn_cp15_rrt_trap(1, 0xe, VAR_6, VAR_5, VAR_9, VAR_10, VAR_8, VAR_0->thumb); } else { syndrome = syn_cp15_rt_trap(1, 0xe, VAR_6, VAR_7, VAR_4, VAR_5, VAR_9, VAR_8, VAR_0->thumb); } break; default: assert(!arm_dc_feature(VAR_0, ARM_FEATURE_V8)); syndrome = syn_uncategorized(); break; } gen_set_pc_im(VAR_0, VAR_0->pc); tmpptr = tcg_const_ptr(VAR_11); tcg_syn = tcg_const_i32(syndrome); gen_helper_access_check_cp_reg(cpu_env, tmpptr, tcg_syn); tcg_temp_free_ptr(tmpptr); tcg_temp_free_i32(tcg_syn); } switch (VAR_11->type & ~(ARM_CP_FLAG_MASK & ~ARM_CP_SPECIAL)) { case ARM_CP_NOP: return 0; case ARM_CP_WFI: if (VAR_8) { return 1; } gen_set_pc_im(VAR_0, VAR_0->pc); VAR_0->is_jmp = DISAS_WFI; return 0; default: break; } if (use_icount && (VAR_11->type & ARM_CP_IO)) { gen_io_start(); } if (VAR_8) { if (VAR_3) { TCGv_i64 tmp64; TCGv_i32 tmp; if (VAR_11->type & ARM_CP_CONST) { tmp64 = tcg_const_i64(VAR_11->resetvalue); } else if (VAR_11->readfn) { TCGv_ptr tmpptr; tmp64 = tcg_temp_new_i64(); tmpptr = tcg_const_ptr(VAR_11); gen_helper_get_cp_reg64(tmp64, cpu_env, tmpptr); tcg_temp_free_ptr(tmpptr); } else { tmp64 = tcg_temp_new_i64(); tcg_gen_ld_i64(tmp64, cpu_env, VAR_11->fieldoffset); } tmp = tcg_temp_new_i32(); tcg_gen_trunc_i64_i32(tmp, tmp64); store_reg(VAR_0, VAR_9, tmp); tcg_gen_shri_i64(tmp64, tmp64, 32); tmp = tcg_temp_new_i32(); tcg_gen_trunc_i64_i32(tmp, tmp64); tcg_temp_free_i64(tmp64); store_reg(VAR_0, VAR_10, tmp); } else { TCGv_i32 tmp; if (VAR_11->type & ARM_CP_CONST) { tmp = tcg_const_i32(VAR_11->resetvalue); } else if (VAR_11->readfn) { TCGv_ptr tmpptr; tmp = tcg_temp_new_i32(); tmpptr = tcg_const_ptr(VAR_11); gen_helper_get_cp_reg(tmp, cpu_env, tmpptr); tcg_temp_free_ptr(tmpptr); } else { tmp = load_cpu_offset(VAR_11->fieldoffset); } if (VAR_9 == 15) { gen_set_nzcv(tmp); tcg_temp_free_i32(tmp); } else { store_reg(VAR_0, VAR_9, tmp); } } } else { if (VAR_11->type & ARM_CP_CONST) { return 0; } if (VAR_3) { TCGv_i32 tmplo, tmphi; TCGv_i64 tmp64 = tcg_temp_new_i64(); tmplo = load_reg(VAR_0, VAR_9); tmphi = load_reg(VAR_0, VAR_10); tcg_gen_concat_i32_i64(tmp64, tmplo, tmphi); tcg_temp_free_i32(tmplo); tcg_temp_free_i32(tmphi); if (VAR_11->writefn) { TCGv_ptr tmpptr = tcg_const_ptr(VAR_11); gen_helper_set_cp_reg64(cpu_env, tmpptr, tmp64); tcg_temp_free_ptr(tmpptr); } else { tcg_gen_st_i64(tmp64, cpu_env, VAR_11->fieldoffset); } tcg_temp_free_i64(tmp64); } else { if (VAR_11->writefn) { TCGv_i32 tmp; TCGv_ptr tmpptr; tmp = load_reg(VAR_0, VAR_9); tmpptr = tcg_const_ptr(VAR_11); gen_helper_set_cp_reg(cpu_env, tmpptr, tmp); tcg_temp_free_ptr(tmpptr); tcg_temp_free_i32(tmp); } else { TCGv_i32 tmp = load_reg(VAR_0, VAR_9); store_cpu_offset(tmp, VAR_11->fieldoffset); } } } if (use_icount && (VAR_11->type & ARM_CP_IO)) { gen_io_end(); gen_lookup_tb(VAR_0); } else if (!VAR_8 && !(VAR_11->type & ARM_CP_SUPPRESS_TB_END)) { gen_lookup_tb(VAR_0); } return 0; } if (VAR_3) { qemu_log_mask(LOG_UNIMP, "%VAR_0 access to unsupported AArch32 " "64 bit system register cp:%d VAR_6: %d VAR_5:%d " "(%VAR_0)\n", VAR_8 ? "read" : "write", VAR_2, VAR_6, VAR_5, VAR_0->ns ? "non-secure" : "secure"); } else { qemu_log_mask(LOG_UNIMP, "%VAR_0 access to unsupported AArch32 " "system register cp:%d VAR_6:%d VAR_4:%d VAR_5:%d VAR_7:%d " "(%VAR_0)\n", VAR_8 ? "read" : "write", VAR_2, VAR_6, VAR_4, VAR_5, VAR_7, VAR_0->ns ? "non-secure" : "secure"); } return 1; }
[ "static int FUNC_0(DisasContext *VAR_0, uint32_t VAR_1)\n{", "int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;", "const ARMCPRegInfo *VAR_11;", "VAR_2 = (VAR_1 >> 8) & 0xf;", "if (arm_dc_feature(VAR_0, ARM_FEATURE_XSCALE) && (VAR_2 < 2)) {", "if (extract32(VAR_0->c15_cpar, VAR_2, 1) == 0) {", "return 1;", "}", "if (arm_dc_feature(VAR_0, ARM_FEATURE_IWMMXT)) {", "return disas_iwmmxt_insn(VAR_0, VAR_1);", "} else if (arm_dc_feature(VAR_0, ARM_FEATURE_XSCALE)) {", "return disas_dsp_insn(VAR_0, VAR_1);", "}", "return 1;", "}", "VAR_3 = (VAR_1 & (1 << 25)) == 0;", "if (!VAR_3 && ((VAR_1 & (1 << 4)) == 0)) {", "return 1;", "}", "VAR_5 = VAR_1 & 0xf;", "if (VAR_3) {", "VAR_4 = 0;", "VAR_6 = (VAR_1 >> 4) & 0xf;", "VAR_7 = 0;", "VAR_10 = (VAR_1 >> 16) & 0xf;", "} else {", "VAR_4 = (VAR_1 >> 16) & 0xf;", "VAR_6 = (VAR_1 >> 21) & 7;", "VAR_7 = (VAR_1 >> 5) & 7;", "VAR_10 = 0;", "}", "VAR_8 = (VAR_1 >> 20) & 1;", "VAR_9 = (VAR_1 >> 12) & 0xf;", "VAR_11 = get_arm_cp_reginfo(VAR_0->cp_regs,\nENCODE_CP_REG(VAR_2, VAR_3, VAR_0->ns, VAR_4, VAR_5, VAR_6, VAR_7));", "if (VAR_11) {", "if (!cp_access_ok(VAR_0->current_el, VAR_11, VAR_8)) {", "return 1;", "}", "if (VAR_11->accessfn ||\n(arm_dc_feature(VAR_0, ARM_FEATURE_XSCALE) && VAR_2 < 14)) {", "TCGv_ptr tmpptr;", "TCGv_i32 tcg_syn;", "uint32_t syndrome;", "switch (VAR_2) {", "case 14:\nif (VAR_3) {", "syndrome = syn_cp14_rrt_trap(1, 0xe, VAR_6, VAR_5, VAR_9, VAR_10,\nVAR_8, VAR_0->thumb);", "} else {", "syndrome = syn_cp14_rt_trap(1, 0xe, VAR_6, VAR_7, VAR_4, VAR_5,\nVAR_9, VAR_8, VAR_0->thumb);", "}", "break;", "case 15:\nif (VAR_3) {", "syndrome = syn_cp15_rrt_trap(1, 0xe, VAR_6, VAR_5, VAR_9, VAR_10,\nVAR_8, VAR_0->thumb);", "} else {", "syndrome = syn_cp15_rt_trap(1, 0xe, VAR_6, VAR_7, VAR_4, VAR_5,\nVAR_9, VAR_8, VAR_0->thumb);", "}", "break;", "default:\nassert(!arm_dc_feature(VAR_0, ARM_FEATURE_V8));", "syndrome = syn_uncategorized();", "break;", "}", "gen_set_pc_im(VAR_0, VAR_0->pc);", "tmpptr = tcg_const_ptr(VAR_11);", "tcg_syn = tcg_const_i32(syndrome);", "gen_helper_access_check_cp_reg(cpu_env, tmpptr, tcg_syn);", "tcg_temp_free_ptr(tmpptr);", "tcg_temp_free_i32(tcg_syn);", "}", "switch (VAR_11->type & ~(ARM_CP_FLAG_MASK & ~ARM_CP_SPECIAL)) {", "case ARM_CP_NOP:\nreturn 0;", "case ARM_CP_WFI:\nif (VAR_8) {", "return 1;", "}", "gen_set_pc_im(VAR_0, VAR_0->pc);", "VAR_0->is_jmp = DISAS_WFI;", "return 0;", "default:\nbreak;", "}", "if (use_icount && (VAR_11->type & ARM_CP_IO)) {", "gen_io_start();", "}", "if (VAR_8) {", "if (VAR_3) {", "TCGv_i64 tmp64;", "TCGv_i32 tmp;", "if (VAR_11->type & ARM_CP_CONST) {", "tmp64 = tcg_const_i64(VAR_11->resetvalue);", "} else if (VAR_11->readfn) {", "TCGv_ptr tmpptr;", "tmp64 = tcg_temp_new_i64();", "tmpptr = tcg_const_ptr(VAR_11);", "gen_helper_get_cp_reg64(tmp64, cpu_env, tmpptr);", "tcg_temp_free_ptr(tmpptr);", "} else {", "tmp64 = tcg_temp_new_i64();", "tcg_gen_ld_i64(tmp64, cpu_env, VAR_11->fieldoffset);", "}", "tmp = tcg_temp_new_i32();", "tcg_gen_trunc_i64_i32(tmp, tmp64);", "store_reg(VAR_0, VAR_9, tmp);", "tcg_gen_shri_i64(tmp64, tmp64, 32);", "tmp = tcg_temp_new_i32();", "tcg_gen_trunc_i64_i32(tmp, tmp64);", "tcg_temp_free_i64(tmp64);", "store_reg(VAR_0, VAR_10, tmp);", "} else {", "TCGv_i32 tmp;", "if (VAR_11->type & ARM_CP_CONST) {", "tmp = tcg_const_i32(VAR_11->resetvalue);", "} else if (VAR_11->readfn) {", "TCGv_ptr tmpptr;", "tmp = tcg_temp_new_i32();", "tmpptr = tcg_const_ptr(VAR_11);", "gen_helper_get_cp_reg(tmp, cpu_env, tmpptr);", "tcg_temp_free_ptr(tmpptr);", "} else {", "tmp = load_cpu_offset(VAR_11->fieldoffset);", "}", "if (VAR_9 == 15) {", "gen_set_nzcv(tmp);", "tcg_temp_free_i32(tmp);", "} else {", "store_reg(VAR_0, VAR_9, tmp);", "}", "}", "} else {", "if (VAR_11->type & ARM_CP_CONST) {", "return 0;", "}", "if (VAR_3) {", "TCGv_i32 tmplo, tmphi;", "TCGv_i64 tmp64 = tcg_temp_new_i64();", "tmplo = load_reg(VAR_0, VAR_9);", "tmphi = load_reg(VAR_0, VAR_10);", "tcg_gen_concat_i32_i64(tmp64, tmplo, tmphi);", "tcg_temp_free_i32(tmplo);", "tcg_temp_free_i32(tmphi);", "if (VAR_11->writefn) {", "TCGv_ptr tmpptr = tcg_const_ptr(VAR_11);", "gen_helper_set_cp_reg64(cpu_env, tmpptr, tmp64);", "tcg_temp_free_ptr(tmpptr);", "} else {", "tcg_gen_st_i64(tmp64, cpu_env, VAR_11->fieldoffset);", "}", "tcg_temp_free_i64(tmp64);", "} else {", "if (VAR_11->writefn) {", "TCGv_i32 tmp;", "TCGv_ptr tmpptr;", "tmp = load_reg(VAR_0, VAR_9);", "tmpptr = tcg_const_ptr(VAR_11);", "gen_helper_set_cp_reg(cpu_env, tmpptr, tmp);", "tcg_temp_free_ptr(tmpptr);", "tcg_temp_free_i32(tmp);", "} else {", "TCGv_i32 tmp = load_reg(VAR_0, VAR_9);", "store_cpu_offset(tmp, VAR_11->fieldoffset);", "}", "}", "}", "if (use_icount && (VAR_11->type & ARM_CP_IO)) {", "gen_io_end();", "gen_lookup_tb(VAR_0);", "} else if (!VAR_8 && !(VAR_11->type & ARM_CP_SUPPRESS_TB_END)) {", "gen_lookup_tb(VAR_0);", "}", "return 0;", "}", "if (VAR_3) {", "qemu_log_mask(LOG_UNIMP, \"%VAR_0 access to unsupported AArch32 \"\n\"64 bit system register cp:%d VAR_6: %d VAR_5:%d \"\n\"(%VAR_0)\\n\",\nVAR_8 ? \"read\" : \"write\", VAR_2, VAR_6, VAR_5,\nVAR_0->ns ? \"non-secure\" : \"secure\");", "} else {", "qemu_log_mask(LOG_UNIMP, \"%VAR_0 access to unsupported AArch32 \"\n\"system register cp:%d VAR_6:%d VAR_4:%d VAR_5:%d VAR_7:%d \"\n\"(%VAR_0)\\n\",\nVAR_8 ? \"read\" : \"write\", VAR_2, VAR_6, VAR_4, VAR_5, VAR_7,\nVAR_0->ns ? \"non-secure\" : \"secure\");", "}", "return 1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85, 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 101, 103 ], [ 115 ], [ 117 ], [ 119 ], [ 139 ], [ 141, 143 ], [ 145, 147 ], [ 149 ], [ 151, 153 ], [ 155 ], [ 157 ], [ 159, 161 ], [ 163, 165 ], [ 167 ], [ 169, 171 ], [ 173 ], [ 175 ], [ 177, 189 ], [ 191 ], [ 193 ], [ 195 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 217 ], [ 219, 221 ], [ 223, 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237, 239 ], [ 241 ], [ 245 ], [ 247 ], [ 249 ], [ 253 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 353 ], [ 357 ], [ 359 ], [ 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 ], [ 427 ], [ 431 ], [ 433 ], [ 435 ], [ 445 ], [ 447 ], [ 451 ], [ 453 ], [ 463 ], [ 465, 467, 469, 471, 473 ], [ 475 ], [ 477, 479, 481, 483, 485 ], [ 487 ], [ 491 ], [ 493 ] ]
2,180
e1000_mmio_write(void *opaque, target_phys_addr_t addr, uint64_t val, unsigned size) { E1000State *s = opaque; unsigned int index = (addr & 0x1ffff) >> 2; if (index < NWRITEOPS && macreg_writeops[index]) { macreg_writeops[index](s, index, val); } else if (index < NREADOPS && macreg_readops[index]) { DBGOUT(MMIO, "e1000_mmio_writel RO %x: 0x%04"PRIx64"\n", index<<2, val); } else { DBGOUT(UNKNOWN, "MMIO unknown write addr=0x%08x,val=0x%08"PRIx64"\n", index<<2, val); } }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
e1000_mmio_write(void *opaque, target_phys_addr_t addr, uint64_t val, unsigned size) { E1000State *s = opaque; unsigned int index = (addr & 0x1ffff) >> 2; if (index < NWRITEOPS && macreg_writeops[index]) { macreg_writeops[index](s, index, val); } else if (index < NREADOPS && macreg_readops[index]) { DBGOUT(MMIO, "e1000_mmio_writel RO %x: 0x%04"PRIx64"\n", index<<2, val); } else { DBGOUT(UNKNOWN, "MMIO unknown write addr=0x%08x,val=0x%08"PRIx64"\n", index<<2, val); } }
{ "code": [], "line_no": [] }
FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint64_t VAR_2, unsigned VAR_3) { E1000State *s = VAR_0; unsigned int VAR_4 = (VAR_1 & 0x1ffff) >> 2; if (VAR_4 < NWRITEOPS && macreg_writeops[VAR_4]) { macreg_writeops[VAR_4](s, VAR_4, VAR_2); } else if (VAR_4 < NREADOPS && macreg_readops[VAR_4]) { DBGOUT(MMIO, "e1000_mmio_writel RO %x: 0x%04"PRIx64"\n", VAR_4<<2, VAR_2); } else { DBGOUT(UNKNOWN, "MMIO unknown write VAR_1=0x%08x,VAR_2=0x%08"PRIx64"\n", VAR_4<<2, VAR_2); } }
[ "FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint64_t VAR_2,\nunsigned VAR_3)\n{", "E1000State *s = VAR_0;", "unsigned int VAR_4 = (VAR_1 & 0x1ffff) >> 2;", "if (VAR_4 < NWRITEOPS && macreg_writeops[VAR_4]) {", "macreg_writeops[VAR_4](s, VAR_4, VAR_2);", "} else if (VAR_4 < NREADOPS && macreg_readops[VAR_4]) {", "DBGOUT(MMIO, \"e1000_mmio_writel RO %x: 0x%04\"PRIx64\"\\n\", VAR_4<<2, VAR_2);", "} else {", "DBGOUT(UNKNOWN, \"MMIO unknown write VAR_1=0x%08x,VAR_2=0x%08\"PRIx64\"\\n\",\nVAR_4<<2, VAR_2);", "}", "}" ]
[ 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 ] ]
2,181
socket_sockaddr_to_address_unix(struct sockaddr_storage *sa, socklen_t salen, Error **errp) { SocketAddress *addr; struct sockaddr_un *su = (struct sockaddr_un *)sa; addr = g_new0(SocketAddress, 1); addr->type = SOCKET_ADDRESS_KIND_UNIX; addr->u.q_unix = g_new0(UnixSocketAddress, 1); if (su->sun_path[0]) { addr->u.q_unix->path = g_strndup(su->sun_path, sizeof(su->sun_path)); } return addr; }
false
qemu
32bafa8fdd098d52fbf1102d5a5e48d29398c0aa
socket_sockaddr_to_address_unix(struct sockaddr_storage *sa, socklen_t salen, Error **errp) { SocketAddress *addr; struct sockaddr_un *su = (struct sockaddr_un *)sa; addr = g_new0(SocketAddress, 1); addr->type = SOCKET_ADDRESS_KIND_UNIX; addr->u.q_unix = g_new0(UnixSocketAddress, 1); if (su->sun_path[0]) { addr->u.q_unix->path = g_strndup(su->sun_path, sizeof(su->sun_path)); } return addr; }
{ "code": [], "line_no": [] }
FUNC_0(struct sockaddr_storage *VAR_0, socklen_t VAR_1, Error **VAR_2) { SocketAddress *addr; struct sockaddr_un *VAR_3 = (struct sockaddr_un *)VAR_0; addr = g_new0(SocketAddress, 1); addr->type = SOCKET_ADDRESS_KIND_UNIX; addr->u.q_unix = g_new0(UnixSocketAddress, 1); if (VAR_3->sun_path[0]) { addr->u.q_unix->path = g_strndup(VAR_3->sun_path, sizeof(VAR_3->sun_path)); } return addr; }
[ "FUNC_0(struct sockaddr_storage *VAR_0,\nsocklen_t VAR_1,\nError **VAR_2)\n{", "SocketAddress *addr;", "struct sockaddr_un *VAR_3 = (struct sockaddr_un *)VAR_0;", "addr = g_new0(SocketAddress, 1);", "addr->type = SOCKET_ADDRESS_KIND_UNIX;", "addr->u.q_unix = g_new0(UnixSocketAddress, 1);", "if (VAR_3->sun_path[0]) {", "addr->u.q_unix->path = g_strndup(VAR_3->sun_path,\nsizeof(VAR_3->sun_path));", "}", "return addr;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 31 ], [ 33 ] ]
2,184
static int fetch_active_ports_list(QEMUFile *f, int version_id, VirtIOSerial *s, uint32_t nr_active_ports) { uint32_t i; s->post_load = g_malloc0(sizeof(*s->post_load)); s->post_load->nr_active_ports = nr_active_ports; s->post_load->connected = g_malloc0(sizeof(*s->post_load->connected) * nr_active_ports); s->post_load->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, virtio_serial_post_load_timer_cb, s); /* Items in struct VirtIOSerialPort */ for (i = 0; i < nr_active_ports; i++) { VirtIOSerialPort *port; uint32_t id; id = qemu_get_be32(f); port = find_port_by_id(s, id); if (!port) { return -EINVAL; } port->guest_connected = qemu_get_byte(f); s->post_load->connected[i].port = port; s->post_load->connected[i].host_connected = qemu_get_byte(f); if (version_id > 2) { uint32_t elem_popped; qemu_get_be32s(f, &elem_popped); if (elem_popped) { qemu_get_be32s(f, &port->iov_idx); qemu_get_be64s(f, &port->iov_offset); qemu_get_buffer(f, (unsigned char *)&port->elem, sizeof(port->elem)); virtqueue_map(&port->elem); /* * Port was throttled on source machine. Let's * unthrottle it here so data starts flowing again. */ virtio_serial_throttle_port(port, false); } } } timer_mod(s->post_load->timer, 1); return 0; }
false
qemu
51b19ebe4320f3dcd93cea71235c1219318ddfd2
static int fetch_active_ports_list(QEMUFile *f, int version_id, VirtIOSerial *s, uint32_t nr_active_ports) { uint32_t i; s->post_load = g_malloc0(sizeof(*s->post_load)); s->post_load->nr_active_ports = nr_active_ports; s->post_load->connected = g_malloc0(sizeof(*s->post_load->connected) * nr_active_ports); s->post_load->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, virtio_serial_post_load_timer_cb, s); for (i = 0; i < nr_active_ports; i++) { VirtIOSerialPort *port; uint32_t id; id = qemu_get_be32(f); port = find_port_by_id(s, id); if (!port) { return -EINVAL; } port->guest_connected = qemu_get_byte(f); s->post_load->connected[i].port = port; s->post_load->connected[i].host_connected = qemu_get_byte(f); if (version_id > 2) { uint32_t elem_popped; qemu_get_be32s(f, &elem_popped); if (elem_popped) { qemu_get_be32s(f, &port->iov_idx); qemu_get_be64s(f, &port->iov_offset); qemu_get_buffer(f, (unsigned char *)&port->elem, sizeof(port->elem)); virtqueue_map(&port->elem); virtio_serial_throttle_port(port, false); } } } timer_mod(s->post_load->timer, 1); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(QEMUFile *VAR_0, int VAR_1, VirtIOSerial *VAR_2, uint32_t VAR_3) { uint32_t i; VAR_2->post_load = g_malloc0(sizeof(*VAR_2->post_load)); VAR_2->post_load->VAR_3 = VAR_3; VAR_2->post_load->connected = g_malloc0(sizeof(*VAR_2->post_load->connected) * VAR_3); VAR_2->post_load->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, virtio_serial_post_load_timer_cb, VAR_2); for (i = 0; i < VAR_3; i++) { VirtIOSerialPort *port; uint32_t id; id = qemu_get_be32(VAR_0); port = find_port_by_id(VAR_2, id); if (!port) { return -EINVAL; } port->guest_connected = qemu_get_byte(VAR_0); VAR_2->post_load->connected[i].port = port; VAR_2->post_load->connected[i].host_connected = qemu_get_byte(VAR_0); if (VAR_1 > 2) { uint32_t elem_popped; qemu_get_be32s(VAR_0, &elem_popped); if (elem_popped) { qemu_get_be32s(VAR_0, &port->iov_idx); qemu_get_be64s(VAR_0, &port->iov_offset); qemu_get_buffer(VAR_0, (unsigned char *)&port->elem, sizeof(port->elem)); virtqueue_map(&port->elem); virtio_serial_throttle_port(port, false); } } } timer_mod(VAR_2->post_load->timer, 1); return 0; }
[ "static int FUNC_0(QEMUFile *VAR_0, int VAR_1,\nVirtIOSerial *VAR_2, uint32_t VAR_3)\n{", "uint32_t i;", "VAR_2->post_load = g_malloc0(sizeof(*VAR_2->post_load));", "VAR_2->post_load->VAR_3 = VAR_3;", "VAR_2->post_load->connected =\ng_malloc0(sizeof(*VAR_2->post_load->connected) * VAR_3);", "VAR_2->post_load->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL,\nvirtio_serial_post_load_timer_cb,\nVAR_2);", "for (i = 0; i < VAR_3; i++) {", "VirtIOSerialPort *port;", "uint32_t id;", "id = qemu_get_be32(VAR_0);", "port = find_port_by_id(VAR_2, id);", "if (!port) {", "return -EINVAL;", "}", "port->guest_connected = qemu_get_byte(VAR_0);", "VAR_2->post_load->connected[i].port = port;", "VAR_2->post_load->connected[i].host_connected = qemu_get_byte(VAR_0);", "if (VAR_1 > 2) {", "uint32_t elem_popped;", "qemu_get_be32s(VAR_0, &elem_popped);", "if (elem_popped) {", "qemu_get_be32s(VAR_0, &port->iov_idx);", "qemu_get_be64s(VAR_0, &port->iov_offset);", "qemu_get_buffer(VAR_0, (unsigned char *)&port->elem,\nsizeof(port->elem));", "virtqueue_map(&port->elem);", "virtio_serial_throttle_port(port, false);", "}", "}", "}", "timer_mod(VAR_2->post_load->timer, 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15, 17 ], [ 21, 23, 25 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75, 77 ], [ 79 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ] ]
2,185
void qdev_prop_set_globals_for_type(DeviceState *dev, const char *typename, Error **errp) { GlobalProperty *prop; QTAILQ_FOREACH(prop, &global_props, next) { Error *err = NULL; if (strcmp(typename, prop->driver) != 0) { continue; } prop->not_used = false; object_property_parse(OBJECT(dev), prop->value, prop->property, &err); if (err != NULL) { error_propagate(errp, err); return; } } }
false
qemu
b3ce84fea466f3bca2ff85d158744f00c0f429bd
void qdev_prop_set_globals_for_type(DeviceState *dev, const char *typename, Error **errp) { GlobalProperty *prop; QTAILQ_FOREACH(prop, &global_props, next) { Error *err = NULL; if (strcmp(typename, prop->driver) != 0) { continue; } prop->not_used = false; object_property_parse(OBJECT(dev), prop->value, prop->property, &err); if (err != NULL) { error_propagate(errp, err); return; } } }
{ "code": [], "line_no": [] }
void FUNC_0(DeviceState *VAR_0, const char *VAR_1, Error **VAR_2) { GlobalProperty *prop; QTAILQ_FOREACH(prop, &global_props, next) { Error *err = NULL; if (strcmp(VAR_1, prop->driver) != 0) { continue; } prop->not_used = false; object_property_parse(OBJECT(VAR_0), prop->value, prop->property, &err); if (err != NULL) { error_propagate(VAR_2, err); return; } } }
[ "void FUNC_0(DeviceState *VAR_0, const char *VAR_1,\nError **VAR_2)\n{", "GlobalProperty *prop;", "QTAILQ_FOREACH(prop, &global_props, next) {", "Error *err = NULL;", "if (strcmp(VAR_1, prop->driver) != 0) {", "continue;", "}", "prop->not_used = false;", "object_property_parse(OBJECT(VAR_0), prop->value, prop->property, &err);", "if (err != NULL) {", "error_propagate(VAR_2, err);", "return;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]
2,186
void bdrv_set_in_use(BlockDriverState *bs, int in_use) { assert(bs->in_use != in_use); bs->in_use = in_use; }
false
qemu
3718d8ab65f68de2acccbe6a315907805f54e3cc
void bdrv_set_in_use(BlockDriverState *bs, int in_use) { assert(bs->in_use != in_use); bs->in_use = in_use; }
{ "code": [], "line_no": [] }
void FUNC_0(BlockDriverState *VAR_0, int VAR_1) { assert(VAR_0->VAR_1 != VAR_1); VAR_0->VAR_1 = VAR_1; }
[ "void FUNC_0(BlockDriverState *VAR_0, int VAR_1)\n{", "assert(VAR_0->VAR_1 != VAR_1);", "VAR_0->VAR_1 = VAR_1;", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
2,189
static void qvirtio_scsi_stop(void) { qtest_end(); }
false
qemu
a980f7f2c2f4d7e9a1eba4f804cd66dbd458b6d4
static void qvirtio_scsi_stop(void) { qtest_end(); }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { qtest_end(); }
[ "static void FUNC_0(void)\n{", "qtest_end();", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
2,191
int qemu_aio_set_fd_handler(int fd, IOHandler *io_read, IOHandler *io_write, AioFlushHandler *io_flush, void *opaque) { AioHandler *node; node = find_aio_handler(fd); /* Are we deleting the fd handler? */ if (!io_read && !io_write) { if (node) { /* If the lock is held, just mark the node as deleted */ if (walking_handlers) node->deleted = 1; else { /* Otherwise, delete it for real. We can't just mark it as * deleted because deleted nodes are only cleaned up after * releasing the walking_handlers lock. */ LIST_REMOVE(node, node); qemu_free(node); } } } else { if (node == NULL) { /* Alloc and insert if it's not already there */ node = qemu_mallocz(sizeof(AioHandler)); node->fd = fd; LIST_INSERT_HEAD(&aio_handlers, node, node); } /* Update handler with latest information */ node->io_read = io_read; node->io_write = io_write; node->io_flush = io_flush; node->opaque = opaque; } qemu_set_fd_handler2(fd, NULL, io_read, io_write, opaque); return 0; }
false
qemu
72cf2d4f0e181d0d3a3122e04129c58a95da713e
int qemu_aio_set_fd_handler(int fd, IOHandler *io_read, IOHandler *io_write, AioFlushHandler *io_flush, void *opaque) { AioHandler *node; node = find_aio_handler(fd); if (!io_read && !io_write) { if (node) { if (walking_handlers) node->deleted = 1; else { LIST_REMOVE(node, node); qemu_free(node); } } } else { if (node == NULL) { node = qemu_mallocz(sizeof(AioHandler)); node->fd = fd; LIST_INSERT_HEAD(&aio_handlers, node, node); } node->io_read = io_read; node->io_write = io_write; node->io_flush = io_flush; node->opaque = opaque; } qemu_set_fd_handler2(fd, NULL, io_read, io_write, opaque); return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(int VAR_0, IOHandler *VAR_1, IOHandler *VAR_2, AioFlushHandler *VAR_3, void *VAR_4) { AioHandler *node; node = find_aio_handler(VAR_0); if (!VAR_1 && !VAR_2) { if (node) { if (walking_handlers) node->deleted = 1; else { LIST_REMOVE(node, node); qemu_free(node); } } } else { if (node == NULL) { node = qemu_mallocz(sizeof(AioHandler)); node->VAR_0 = VAR_0; LIST_INSERT_HEAD(&aio_handlers, node, node); } node->VAR_1 = VAR_1; node->VAR_2 = VAR_2; node->VAR_3 = VAR_3; node->VAR_4 = VAR_4; } qemu_set_fd_handler2(VAR_0, NULL, VAR_1, VAR_2, VAR_4); return 0; }
[ "int FUNC_0(int VAR_0,\nIOHandler *VAR_1,\nIOHandler *VAR_2,\nAioFlushHandler *VAR_3,\nvoid *VAR_4)\n{", "AioHandler *node;", "node = find_aio_handler(VAR_0);", "if (!VAR_1 && !VAR_2) {", "if (node) {", "if (walking_handlers)\nnode->deleted = 1;", "else {", "LIST_REMOVE(node, node);", "qemu_free(node);", "}", "}", "} else {", "if (node == NULL) {", "node = qemu_mallocz(sizeof(AioHandler));", "node->VAR_0 = VAR_0;", "LIST_INSERT_HEAD(&aio_handlers, node, node);", "}", "node->VAR_1 = VAR_1;", "node->VAR_2 = VAR_2;", "node->VAR_3 = VAR_3;", "node->VAR_4 = VAR_4;", "}", "qemu_set_fd_handler2(VAR_0, NULL, VAR_1, VAR_2, VAR_4);", "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, 9, 11 ], [ 13 ], [ 17 ], [ 23 ], [ 25 ], [ 29, 31 ], [ 33 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 83 ], [ 85 ] ]
2,192
static pcibus_t pci_bar_address(PCIDevice *d, int reg, uint8_t type, pcibus_t size) { pcibus_t new_addr, last_addr; int bar = pci_bar(d, reg); uint16_t cmd = pci_get_word(d->config + PCI_COMMAND); if (type & PCI_BASE_ADDRESS_SPACE_IO) { if (!(cmd & PCI_COMMAND_IO)) { return PCI_BAR_UNMAPPED; } new_addr = pci_get_long(d->config + bar) & ~(size - 1); last_addr = new_addr + size - 1; /* Check if 32 bit BAR wraps around explicitly. * TODO: make priorities correct and remove this work around. */ if (last_addr <= new_addr || new_addr == 0 || last_addr >= UINT32_MAX) { return PCI_BAR_UNMAPPED; } return new_addr; } if (!(cmd & PCI_COMMAND_MEMORY)) { return PCI_BAR_UNMAPPED; } if (type & PCI_BASE_ADDRESS_MEM_TYPE_64) { new_addr = pci_get_quad(d->config + bar); } else { new_addr = pci_get_long(d->config + bar); } /* the ROM slot has a specific enable bit */ if (reg == PCI_ROM_SLOT && !(new_addr & PCI_ROM_ADDRESS_ENABLE)) { return PCI_BAR_UNMAPPED; } new_addr &= ~(size - 1); last_addr = new_addr + size - 1; /* NOTE: we do not support wrapping */ /* XXX: as we cannot support really dynamic mappings, we handle specific values as invalid mappings. */ if (last_addr <= new_addr || new_addr == 0 || last_addr == PCI_BAR_UNMAPPED) { return PCI_BAR_UNMAPPED; } /* Now pcibus_t is 64bit. * Check if 32 bit BAR wraps around explicitly. * Without this, PC ide doesn't work well. * TODO: remove this work around. */ if (!(type & PCI_BASE_ADDRESS_MEM_TYPE_64) && last_addr >= UINT32_MAX) { return PCI_BAR_UNMAPPED; } /* * OS is allowed to set BAR beyond its addressable * bits. For example, 32 bit OS can set 64bit bar * to >4G. Check it. TODO: we might need to support * it in the future for e.g. PAE. */ if (last_addr >= HWADDR_MAX) { return PCI_BAR_UNMAPPED; } return new_addr; }
false
qemu
e402463073ae51d00dc6cf98556e2f5c4b008a31
static pcibus_t pci_bar_address(PCIDevice *d, int reg, uint8_t type, pcibus_t size) { pcibus_t new_addr, last_addr; int bar = pci_bar(d, reg); uint16_t cmd = pci_get_word(d->config + PCI_COMMAND); if (type & PCI_BASE_ADDRESS_SPACE_IO) { if (!(cmd & PCI_COMMAND_IO)) { return PCI_BAR_UNMAPPED; } new_addr = pci_get_long(d->config + bar) & ~(size - 1); last_addr = new_addr + size - 1; if (last_addr <= new_addr || new_addr == 0 || last_addr >= UINT32_MAX) { return PCI_BAR_UNMAPPED; } return new_addr; } if (!(cmd & PCI_COMMAND_MEMORY)) { return PCI_BAR_UNMAPPED; } if (type & PCI_BASE_ADDRESS_MEM_TYPE_64) { new_addr = pci_get_quad(d->config + bar); } else { new_addr = pci_get_long(d->config + bar); } if (reg == PCI_ROM_SLOT && !(new_addr & PCI_ROM_ADDRESS_ENABLE)) { return PCI_BAR_UNMAPPED; } new_addr &= ~(size - 1); last_addr = new_addr + size - 1; if (last_addr <= new_addr || new_addr == 0 || last_addr == PCI_BAR_UNMAPPED) { return PCI_BAR_UNMAPPED; } if (!(type & PCI_BASE_ADDRESS_MEM_TYPE_64) && last_addr >= UINT32_MAX) { return PCI_BAR_UNMAPPED; } if (last_addr >= HWADDR_MAX) { return PCI_BAR_UNMAPPED; } return new_addr; }
{ "code": [], "line_no": [] }
static pcibus_t FUNC_0(PCIDevice *d, int reg, uint8_t type, pcibus_t size) { pcibus_t new_addr, last_addr; int VAR_0 = pci_bar(d, reg); uint16_t cmd = pci_get_word(d->config + PCI_COMMAND); if (type & PCI_BASE_ADDRESS_SPACE_IO) { if (!(cmd & PCI_COMMAND_IO)) { return PCI_BAR_UNMAPPED; } new_addr = pci_get_long(d->config + VAR_0) & ~(size - 1); last_addr = new_addr + size - 1; if (last_addr <= new_addr || new_addr == 0 || last_addr >= UINT32_MAX) { return PCI_BAR_UNMAPPED; } return new_addr; } if (!(cmd & PCI_COMMAND_MEMORY)) { return PCI_BAR_UNMAPPED; } if (type & PCI_BASE_ADDRESS_MEM_TYPE_64) { new_addr = pci_get_quad(d->config + VAR_0); } else { new_addr = pci_get_long(d->config + VAR_0); } if (reg == PCI_ROM_SLOT && !(new_addr & PCI_ROM_ADDRESS_ENABLE)) { return PCI_BAR_UNMAPPED; } new_addr &= ~(size - 1); last_addr = new_addr + size - 1; if (last_addr <= new_addr || new_addr == 0 || last_addr == PCI_BAR_UNMAPPED) { return PCI_BAR_UNMAPPED; } if (!(type & PCI_BASE_ADDRESS_MEM_TYPE_64) && last_addr >= UINT32_MAX) { return PCI_BAR_UNMAPPED; } if (last_addr >= HWADDR_MAX) { return PCI_BAR_UNMAPPED; } return new_addr; }
[ "static pcibus_t FUNC_0(PCIDevice *d,\nint reg, uint8_t type, pcibus_t size)\n{", "pcibus_t new_addr, last_addr;", "int VAR_0 = pci_bar(d, reg);", "uint16_t cmd = pci_get_word(d->config + PCI_COMMAND);", "if (type & PCI_BASE_ADDRESS_SPACE_IO) {", "if (!(cmd & PCI_COMMAND_IO)) {", "return PCI_BAR_UNMAPPED;", "}", "new_addr = pci_get_long(d->config + VAR_0) & ~(size - 1);", "last_addr = new_addr + size - 1;", "if (last_addr <= new_addr || new_addr == 0 || last_addr >= UINT32_MAX) {", "return PCI_BAR_UNMAPPED;", "}", "return new_addr;", "}", "if (!(cmd & PCI_COMMAND_MEMORY)) {", "return PCI_BAR_UNMAPPED;", "}", "if (type & PCI_BASE_ADDRESS_MEM_TYPE_64) {", "new_addr = pci_get_quad(d->config + VAR_0);", "} else {", "new_addr = pci_get_long(d->config + VAR_0);", "}", "if (reg == PCI_ROM_SLOT && !(new_addr & PCI_ROM_ADDRESS_ENABLE)) {", "return PCI_BAR_UNMAPPED;", "}", "new_addr &= ~(size - 1);", "last_addr = new_addr + size - 1;", "if (last_addr <= new_addr || new_addr == 0 ||\nlast_addr == PCI_BAR_UNMAPPED) {", "return PCI_BAR_UNMAPPED;", "}", "if (!(type & PCI_BASE_ADDRESS_MEM_TYPE_64) && last_addr >= UINT32_MAX) {", "return PCI_BAR_UNMAPPED;", "}", "if (last_addr >= HWADDR_MAX) {", "return PCI_BAR_UNMAPPED;", "}", "return new_addr;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 101 ], [ 103 ], [ 105 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ] ]
2,193
static void pc_dimm_check_memdev_is_busy(Object *obj, const char *name, Object *val, Error **errp) { MemoryRegion *mr; Error *local_err = NULL; mr = host_memory_backend_get_memory(MEMORY_BACKEND(val), &local_err); if (local_err) { goto out; } if (memory_region_is_mapped(mr)) { char *path = object_get_canonical_path_component(val); error_setg(&local_err, "can't use already busy memdev: %s", path); g_free(path); } else { qdev_prop_allow_set_link_before_realize(obj, name, val, &local_err); } out: error_propagate(errp, local_err); }
false
qemu
2aece63c8a9d2c3a8ff41d2febc4cdeff2633331
static void pc_dimm_check_memdev_is_busy(Object *obj, const char *name, Object *val, Error **errp) { MemoryRegion *mr; Error *local_err = NULL; mr = host_memory_backend_get_memory(MEMORY_BACKEND(val), &local_err); if (local_err) { goto out; } if (memory_region_is_mapped(mr)) { char *path = object_get_canonical_path_component(val); error_setg(&local_err, "can't use already busy memdev: %s", path); g_free(path); } else { qdev_prop_allow_set_link_before_realize(obj, name, val, &local_err); } out: error_propagate(errp, local_err); }
{ "code": [], "line_no": [] }
static void FUNC_0(Object *VAR_0, const char *VAR_1, Object *VAR_2, Error **VAR_3) { MemoryRegion *mr; Error *local_err = NULL; mr = host_memory_backend_get_memory(MEMORY_BACKEND(VAR_2), &local_err); if (local_err) { goto out; } if (memory_region_is_mapped(mr)) { char *VAR_4 = object_get_canonical_path_component(VAR_2); error_setg(&local_err, "can't use already busy memdev: %s", VAR_4); g_free(VAR_4); } else { qdev_prop_allow_set_link_before_realize(VAR_0, VAR_1, VAR_2, &local_err); } out: error_propagate(VAR_3, local_err); }
[ "static void FUNC_0(Object *VAR_0, const char *VAR_1,\nObject *VAR_2, Error **VAR_3)\n{", "MemoryRegion *mr;", "Error *local_err = NULL;", "mr = host_memory_backend_get_memory(MEMORY_BACKEND(VAR_2), &local_err);", "if (local_err) {", "goto out;", "}", "if (memory_region_is_mapped(mr)) {", "char *VAR_4 = object_get_canonical_path_component(VAR_2);", "error_setg(&local_err, \"can't use already busy memdev: %s\", VAR_4);", "g_free(VAR_4);", "} else {", "qdev_prop_allow_set_link_before_realize(VAR_0, VAR_1, VAR_2, &local_err);", "}", "out:\nerror_propagate(VAR_3, local_err);", "}" ]
[ 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 ], [ 37, 39 ], [ 41 ] ]
2,194
static int vhdx_parse_log(BlockDriverState *bs, BDRVVHDXState *s) { int ret = 0; int i; VHDXHeader *hdr; hdr = s->headers[s->curr_header]; /* either the log guid, or log length is zero, * then a replay log is present */ for (i = 0; i < sizeof(hdr->log_guid.data4); i++) { ret |= hdr->log_guid.data4[i]; } if (hdr->log_guid.data1 == 0 && hdr->log_guid.data2 == 0 && hdr->log_guid.data3 == 0 && ret == 0) { goto exit; } /* per spec, only log version of 0 is supported */ if (hdr->log_version != 0) { ret = -EINVAL; goto exit; } if (hdr->log_length == 0) { goto exit; } /* We currently do not support images with logs to replay */ ret = -ENOTSUP; exit: return ret; }
false
qemu
0a43a1b5d7c33208120eeb2d98ebb9ab15dc2c87
static int vhdx_parse_log(BlockDriverState *bs, BDRVVHDXState *s) { int ret = 0; int i; VHDXHeader *hdr; hdr = s->headers[s->curr_header]; for (i = 0; i < sizeof(hdr->log_guid.data4); i++) { ret |= hdr->log_guid.data4[i]; } if (hdr->log_guid.data1 == 0 && hdr->log_guid.data2 == 0 && hdr->log_guid.data3 == 0 && ret == 0) { goto exit; } if (hdr->log_version != 0) { ret = -EINVAL; goto exit; } if (hdr->log_length == 0) { goto exit; } ret = -ENOTSUP; exit: return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockDriverState *VAR_0, BDRVVHDXState *VAR_1) { int VAR_2 = 0; int VAR_3; VHDXHeader *hdr; hdr = VAR_1->headers[VAR_1->curr_header]; for (VAR_3 = 0; VAR_3 < sizeof(hdr->log_guid.data4); VAR_3++) { VAR_2 |= hdr->log_guid.data4[VAR_3]; } if (hdr->log_guid.data1 == 0 && hdr->log_guid.data2 == 0 && hdr->log_guid.data3 == 0 && VAR_2 == 0) { goto exit; } if (hdr->log_version != 0) { VAR_2 = -EINVAL; goto exit; } if (hdr->log_length == 0) { goto exit; } VAR_2 = -ENOTSUP; exit: return VAR_2; }
[ "static int FUNC_0(BlockDriverState *VAR_0, BDRVVHDXState *VAR_1)\n{", "int VAR_2 = 0;", "int VAR_3;", "VHDXHeader *hdr;", "hdr = VAR_1->headers[VAR_1->curr_header];", "for (VAR_3 = 0; VAR_3 < sizeof(hdr->log_guid.data4); VAR_3++) {", "VAR_2 |= hdr->log_guid.data4[VAR_3];", "}", "if (hdr->log_guid.data1 == 0 &&\nhdr->log_guid.data2 == 0 &&\nhdr->log_guid.data3 == 0 &&\nVAR_2 == 0) {", "goto exit;", "}", "if (hdr->log_version != 0) {", "VAR_2 = -EINVAL;", "goto exit;", "}", "if (hdr->log_length == 0) {", "goto exit;", "}", "VAR_2 = -ENOTSUP;", "exit:\nreturn 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 ], [ 13 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29, 31, 33 ], [ 35 ], [ 37 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 63 ], [ 67, 69 ], [ 71 ] ]
2,196
static void vfio_unmap_bar(VFIOPCIDevice *vdev, int nr) { VFIOBAR *bar = &vdev->bars[nr]; if (!bar->region.size) { return; } vfio_bar_quirk_teardown(vdev, nr); memory_region_del_subregion(&bar->region.mem, &bar->region.mmap_mem); munmap(bar->region.mmap, memory_region_size(&bar->region.mmap_mem)); if (vdev->msix && vdev->msix->table_bar == nr) { memory_region_del_subregion(&bar->region.mem, &vdev->msix->mmap_mem); munmap(vdev->msix->mmap, memory_region_size(&vdev->msix->mmap_mem)); } }
false
qemu
ba5e6bfa1aee29a8f72c5538c565dfb9889cf273
static void vfio_unmap_bar(VFIOPCIDevice *vdev, int nr) { VFIOBAR *bar = &vdev->bars[nr]; if (!bar->region.size) { return; } vfio_bar_quirk_teardown(vdev, nr); memory_region_del_subregion(&bar->region.mem, &bar->region.mmap_mem); munmap(bar->region.mmap, memory_region_size(&bar->region.mmap_mem)); if (vdev->msix && vdev->msix->table_bar == nr) { memory_region_del_subregion(&bar->region.mem, &vdev->msix->mmap_mem); munmap(vdev->msix->mmap, memory_region_size(&vdev->msix->mmap_mem)); } }
{ "code": [], "line_no": [] }
static void FUNC_0(VFIOPCIDevice *VAR_0, int VAR_1) { VFIOBAR *bar = &VAR_0->bars[VAR_1]; if (!bar->region.size) { return; } vfio_bar_quirk_teardown(VAR_0, VAR_1); memory_region_del_subregion(&bar->region.mem, &bar->region.mmap_mem); munmap(bar->region.mmap, memory_region_size(&bar->region.mmap_mem)); if (VAR_0->msix && VAR_0->msix->table_bar == VAR_1) { memory_region_del_subregion(&bar->region.mem, &VAR_0->msix->mmap_mem); munmap(VAR_0->msix->mmap, memory_region_size(&VAR_0->msix->mmap_mem)); } }
[ "static void FUNC_0(VFIOPCIDevice *VAR_0, int VAR_1)\n{", "VFIOBAR *bar = &VAR_0->bars[VAR_1];", "if (!bar->region.size) {", "return;", "}", "vfio_bar_quirk_teardown(VAR_0, VAR_1);", "memory_region_del_subregion(&bar->region.mem, &bar->region.mmap_mem);", "munmap(bar->region.mmap, memory_region_size(&bar->region.mmap_mem));", "if (VAR_0->msix && VAR_0->msix->table_bar == VAR_1) {", "memory_region_del_subregion(&bar->region.mem, &VAR_0->msix->mmap_mem);", "munmap(VAR_0->msix->mmap, memory_region_size(&VAR_0->msix->mmap_mem));", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
2,197
static void pmac_ide_writeb (void *opaque, target_phys_addr_t addr, uint32_t val) { MACIOIDEState *d = opaque; addr = (addr & 0xFFF) >> 4; switch (addr) { case 1 ... 7: ide_ioport_write(&d->bus, addr, val); break; case 8: case 22: ide_cmd_write(&d->bus, 0, val); break; default: break; } }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void pmac_ide_writeb (void *opaque, target_phys_addr_t addr, uint32_t val) { MACIOIDEState *d = opaque; addr = (addr & 0xFFF) >> 4; switch (addr) { case 1 ... 7: ide_ioport_write(&d->bus, addr, val); break; case 8: case 22: ide_cmd_write(&d->bus, 0, val); break; default: break; } }
{ "code": [], "line_no": [] }
static void FUNC_0 (void *VAR_0, target_phys_addr_t VAR_1, uint32_t VAR_2) { MACIOIDEState *d = VAR_0; VAR_1 = (VAR_1 & 0xFFF) >> 4; switch (VAR_1) { case 1 ... 7: ide_ioport_write(&d->bus, VAR_1, VAR_2); break; case 8: case 22: ide_cmd_write(&d->bus, 0, VAR_2); break; default: break; } }
[ "static void FUNC_0 (void *VAR_0,\ntarget_phys_addr_t VAR_1, uint32_t VAR_2)\n{", "MACIOIDEState *d = VAR_0;", "VAR_1 = (VAR_1 & 0xFFF) >> 4;", "switch (VAR_1) {", "case 1 ... 7:\nide_ioport_write(&d->bus, VAR_1, VAR_2);", "break;", "case 8:\ncase 22:\nide_cmd_write(&d->bus, 0, VAR_2);", "break;", "default:\nbreak;", "}", "}" ]
[ 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 ] ]
2,198
static int MPA_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { MpegAudioContext *s = avctx->priv_data; const int16_t *samples = (const int16_t *)frame->data[0]; short smr[MPA_MAX_CHANNELS][SBLIMIT]; unsigned char bit_alloc[MPA_MAX_CHANNELS][SBLIMIT]; int padding, i, ret; for(i=0;i<s->nb_channels;i++) { filter(s, i, samples + i, s->nb_channels); } for(i=0;i<s->nb_channels;i++) { compute_scale_factors(s, s->scale_code[i], s->scale_factors[i], s->sb_samples[i], s->sblimit); } for(i=0;i<s->nb_channels;i++) { psycho_acoustic_model(s, smr[i]); } compute_bit_allocation(s, smr, bit_alloc, &padding); if ((ret = ff_alloc_packet(avpkt, MPA_MAX_CODED_FRAME_SIZE))) { av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n"); return ret; } init_put_bits(&s->pb, avpkt->data, avpkt->size); encode_frame(s, bit_alloc, padding); if (frame->pts != AV_NOPTS_VALUE) avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->delay); avpkt->size = put_bits_count(&s->pb) / 8; *got_packet_ptr = 1; return 0; }
false
FFmpeg
2df0c32ea12ddfa72ba88309812bfb13b674130f
static int MPA_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { MpegAudioContext *s = avctx->priv_data; const int16_t *samples = (const int16_t *)frame->data[0]; short smr[MPA_MAX_CHANNELS][SBLIMIT]; unsigned char bit_alloc[MPA_MAX_CHANNELS][SBLIMIT]; int padding, i, ret; for(i=0;i<s->nb_channels;i++) { filter(s, i, samples + i, s->nb_channels); } for(i=0;i<s->nb_channels;i++) { compute_scale_factors(s, s->scale_code[i], s->scale_factors[i], s->sb_samples[i], s->sblimit); } for(i=0;i<s->nb_channels;i++) { psycho_acoustic_model(s, smr[i]); } compute_bit_allocation(s, smr, bit_alloc, &padding); if ((ret = ff_alloc_packet(avpkt, MPA_MAX_CODED_FRAME_SIZE))) { av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n"); return ret; } init_put_bits(&s->pb, avpkt->data, avpkt->size); encode_frame(s, bit_alloc, padding); if (frame->pts != AV_NOPTS_VALUE) avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->delay); avpkt->size = put_bits_count(&s->pb) / 8; *got_packet_ptr = 1; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1, const AVFrame *VAR_2, int *VAR_3) { MpegAudioContext *s = VAR_0->priv_data; const int16_t *VAR_4 = (const int16_t *)VAR_2->data[0]; short VAR_5[MPA_MAX_CHANNELS][SBLIMIT]; unsigned char VAR_6[MPA_MAX_CHANNELS][SBLIMIT]; int VAR_7, VAR_8, VAR_9; for(VAR_8=0;VAR_8<s->nb_channels;VAR_8++) { filter(s, VAR_8, VAR_4 + VAR_8, s->nb_channels); } for(VAR_8=0;VAR_8<s->nb_channels;VAR_8++) { compute_scale_factors(s, s->scale_code[VAR_8], s->scale_factors[VAR_8], s->sb_samples[VAR_8], s->sblimit); } for(VAR_8=0;VAR_8<s->nb_channels;VAR_8++) { psycho_acoustic_model(s, VAR_5[VAR_8]); } compute_bit_allocation(s, VAR_5, VAR_6, &VAR_7); if ((VAR_9 = ff_alloc_packet(VAR_1, MPA_MAX_CODED_FRAME_SIZE))) { av_log(VAR_0, AV_LOG_ERROR, "Error getting output packet\n"); return VAR_9; } init_put_bits(&s->pb, VAR_1->data, VAR_1->size); encode_frame(s, VAR_6, VAR_7); if (VAR_2->pts != AV_NOPTS_VALUE) VAR_1->pts = VAR_2->pts - ff_samples_to_time_base(VAR_0, VAR_0->delay); VAR_1->size = put_bits_count(&s->pb) / 8; *VAR_3 = 1; return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1,\nconst AVFrame *VAR_2, int *VAR_3)\n{", "MpegAudioContext *s = VAR_0->priv_data;", "const int16_t *VAR_4 = (const int16_t *)VAR_2->data[0];", "short VAR_5[MPA_MAX_CHANNELS][SBLIMIT];", "unsigned char VAR_6[MPA_MAX_CHANNELS][SBLIMIT];", "int VAR_7, VAR_8, VAR_9;", "for(VAR_8=0;VAR_8<s->nb_channels;VAR_8++) {", "filter(s, VAR_8, VAR_4 + VAR_8, s->nb_channels);", "}", "for(VAR_8=0;VAR_8<s->nb_channels;VAR_8++) {", "compute_scale_factors(s, s->scale_code[VAR_8], s->scale_factors[VAR_8],\ns->sb_samples[VAR_8], s->sblimit);", "}", "for(VAR_8=0;VAR_8<s->nb_channels;VAR_8++) {", "psycho_acoustic_model(s, VAR_5[VAR_8]);", "}", "compute_bit_allocation(s, VAR_5, VAR_6, &VAR_7);", "if ((VAR_9 = ff_alloc_packet(VAR_1, MPA_MAX_CODED_FRAME_SIZE))) {", "av_log(VAR_0, AV_LOG_ERROR, \"Error getting output packet\\n\");", "return VAR_9;", "}", "init_put_bits(&s->pb, VAR_1->data, VAR_1->size);", "encode_frame(s, VAR_6, VAR_7);", "if (VAR_2->pts != AV_NOPTS_VALUE)\nVAR_1->pts = VAR_2->pts - ff_samples_to_time_base(VAR_0, VAR_0->delay);", "VAR_1->size = put_bits_count(&s->pb) / 8;", "*VAR_3 = 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 59 ], [ 63, 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ] ]
2,199
int vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitContext *gb) { av_log(avctx, AV_LOG_DEBUG, "Header: %0X\n", show_bits(gb, 32)); v->profile = get_bits(gb, 2); if (v->profile == PROFILE_COMPLEX) { av_log(avctx, AV_LOG_WARNING, "WMV3 Complex Profile is not fully supported\n"); } if (v->profile == PROFILE_ADVANCED) { v->zz_8x4 = ff_vc1_adv_progressive_8x4_zz; v->zz_4x8 = ff_vc1_adv_progressive_4x8_zz; return decode_sequence_header_adv(v, gb); } else { v->zz_8x4 = wmv2_scantableA; v->zz_4x8 = wmv2_scantableB; v->res_y411 = get_bits1(gb); v->res_sprite = get_bits1(gb); if (v->res_y411) { av_log(avctx, AV_LOG_ERROR, "Old interlaced mode is not supported\n"); return -1; } if (v->res_sprite) { av_log(avctx, AV_LOG_ERROR, "WMVP is not fully supported\n"); } } // (fps-2)/4 (->30) v->frmrtq_postproc = get_bits(gb, 3); //common // (bitrate-32kbps)/64kbps v->bitrtq_postproc = get_bits(gb, 5); //common v->s.loop_filter = get_bits1(gb); //common if(v->s.loop_filter == 1 && v->profile == PROFILE_SIMPLE) { av_log(avctx, AV_LOG_ERROR, "LOOPFILTER shall not be enabled in Simple Profile\n"); } if(v->s.avctx->skip_loop_filter >= AVDISCARD_ALL) v->s.loop_filter = 0; v->res_x8 = get_bits1(gb); //reserved v->multires = get_bits1(gb); v->res_fasttx = get_bits1(gb); if (!v->res_fasttx) { v->vc1dsp.vc1_inv_trans_8x8 = ff_simple_idct; v->vc1dsp.vc1_inv_trans_8x4 = ff_simple_idct84_add; v->vc1dsp.vc1_inv_trans_4x8 = ff_simple_idct48_add; v->vc1dsp.vc1_inv_trans_4x4 = ff_simple_idct44_add; v->vc1dsp.vc1_inv_trans_8x8_dc = ff_simple_idct_add; v->vc1dsp.vc1_inv_trans_8x4_dc = ff_simple_idct84_add; v->vc1dsp.vc1_inv_trans_4x8_dc = ff_simple_idct48_add; v->vc1dsp.vc1_inv_trans_4x4_dc = ff_simple_idct44_add; } v->fastuvmc = get_bits1(gb); //common if (!v->profile && !v->fastuvmc) { av_log(avctx, AV_LOG_ERROR, "FASTUVMC unavailable in Simple Profile\n"); return -1; } v->extended_mv = get_bits1(gb); //common if (!v->profile && v->extended_mv) { av_log(avctx, AV_LOG_ERROR, "Extended MVs unavailable in Simple Profile\n"); return -1; } v->dquant = get_bits(gb, 2); //common v->vstransform = get_bits1(gb); //common v->res_transtab = get_bits1(gb); if (v->res_transtab) { av_log(avctx, AV_LOG_ERROR, "1 for reserved RES_TRANSTAB is forbidden\n"); return -1; } v->overlap = get_bits1(gb); //common v->s.resync_marker = get_bits1(gb); v->rangered = get_bits1(gb); if (v->rangered && v->profile == PROFILE_SIMPLE) { av_log(avctx, AV_LOG_INFO, "RANGERED should be set to 0 in Simple Profile\n"); } v->s.max_b_frames = avctx->max_b_frames = get_bits(gb, 3); //common v->quantizer_mode = get_bits(gb, 2); //common v->finterpflag = get_bits1(gb); //common if (v->res_sprite) { v->s.avctx->width = v->s.avctx->coded_width = get_bits(gb, 11); v->s.avctx->height = v->s.avctx->coded_height = get_bits(gb, 11); skip_bits(gb, 5); //frame rate v->res_x8 = get_bits1(gb); if (get_bits1(gb)) { // something to do with DC VLC selection av_log(avctx, AV_LOG_ERROR, "Unsupported sprite feature\n"); return -1; } skip_bits(gb, 3); //slice code v->res_rtm_flag = 0; } else { v->res_rtm_flag = get_bits1(gb); //reserved } if (!v->res_rtm_flag) { // av_log(avctx, AV_LOG_ERROR, // "0 for reserved RES_RTM_FLAG is forbidden\n"); av_log(avctx, AV_LOG_ERROR, "Old WMV3 version detected, some frames may be decoded incorrectly\n"); //return -1; } //TODO: figure out what they mean (always 0x402F) if(!v->res_fasttx) skip_bits(gb, 16); av_log(avctx, AV_LOG_DEBUG, "Profile %i:\nfrmrtq_postproc=%i, bitrtq_postproc=%i\n" "LoopFilter=%i, MultiRes=%i, FastUVMC=%i, Extended MV=%i\n" "Rangered=%i, VSTransform=%i, Overlap=%i, SyncMarker=%i\n" "DQuant=%i, Quantizer mode=%i, Max B frames=%i\n", v->profile, v->frmrtq_postproc, v->bitrtq_postproc, v->s.loop_filter, v->multires, v->fastuvmc, v->extended_mv, v->rangered, v->vstransform, v->overlap, v->s.resync_marker, v->dquant, v->quantizer_mode, avctx->max_b_frames ); return 0; }
false
FFmpeg
f8bed30d8b176fa030f6737765338bb4a2bcabc9
int vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitContext *gb) { av_log(avctx, AV_LOG_DEBUG, "Header: %0X\n", show_bits(gb, 32)); v->profile = get_bits(gb, 2); if (v->profile == PROFILE_COMPLEX) { av_log(avctx, AV_LOG_WARNING, "WMV3 Complex Profile is not fully supported\n"); } if (v->profile == PROFILE_ADVANCED) { v->zz_8x4 = ff_vc1_adv_progressive_8x4_zz; v->zz_4x8 = ff_vc1_adv_progressive_4x8_zz; return decode_sequence_header_adv(v, gb); } else { v->zz_8x4 = wmv2_scantableA; v->zz_4x8 = wmv2_scantableB; v->res_y411 = get_bits1(gb); v->res_sprite = get_bits1(gb); if (v->res_y411) { av_log(avctx, AV_LOG_ERROR, "Old interlaced mode is not supported\n"); return -1; } if (v->res_sprite) { av_log(avctx, AV_LOG_ERROR, "WMVP is not fully supported\n"); } } v->frmrtq_postproc = get_bits(gb, 3); v->bitrtq_postproc = get_bits(gb, 5); v->s.loop_filter = get_bits1(gb); if(v->s.loop_filter == 1 && v->profile == PROFILE_SIMPLE) { av_log(avctx, AV_LOG_ERROR, "LOOPFILTER shall not be enabled in Simple Profile\n"); } if(v->s.avctx->skip_loop_filter >= AVDISCARD_ALL) v->s.loop_filter = 0; v->res_x8 = get_bits1(gb); v->multires = get_bits1(gb); v->res_fasttx = get_bits1(gb); if (!v->res_fasttx) { v->vc1dsp.vc1_inv_trans_8x8 = ff_simple_idct; v->vc1dsp.vc1_inv_trans_8x4 = ff_simple_idct84_add; v->vc1dsp.vc1_inv_trans_4x8 = ff_simple_idct48_add; v->vc1dsp.vc1_inv_trans_4x4 = ff_simple_idct44_add; v->vc1dsp.vc1_inv_trans_8x8_dc = ff_simple_idct_add; v->vc1dsp.vc1_inv_trans_8x4_dc = ff_simple_idct84_add; v->vc1dsp.vc1_inv_trans_4x8_dc = ff_simple_idct48_add; v->vc1dsp.vc1_inv_trans_4x4_dc = ff_simple_idct44_add; } v->fastuvmc = get_bits1(gb); if (!v->profile && !v->fastuvmc) { av_log(avctx, AV_LOG_ERROR, "FASTUVMC unavailable in Simple Profile\n"); return -1; } v->extended_mv = get_bits1(gb); if (!v->profile && v->extended_mv) { av_log(avctx, AV_LOG_ERROR, "Extended MVs unavailable in Simple Profile\n"); return -1; } v->dquant = get_bits(gb, 2); v->vstransform = get_bits1(gb); v->res_transtab = get_bits1(gb); if (v->res_transtab) { av_log(avctx, AV_LOG_ERROR, "1 for reserved RES_TRANSTAB is forbidden\n"); return -1; } v->overlap = get_bits1(gb); v->s.resync_marker = get_bits1(gb); v->rangered = get_bits1(gb); if (v->rangered && v->profile == PROFILE_SIMPLE) { av_log(avctx, AV_LOG_INFO, "RANGERED should be set to 0 in Simple Profile\n"); } v->s.max_b_frames = avctx->max_b_frames = get_bits(gb, 3); v->quantizer_mode = get_bits(gb, 2); v->finterpflag = get_bits1(gb); if (v->res_sprite) { v->s.avctx->width = v->s.avctx->coded_width = get_bits(gb, 11); v->s.avctx->height = v->s.avctx->coded_height = get_bits(gb, 11); skip_bits(gb, 5); v->res_x8 = get_bits1(gb); if (get_bits1(gb)) { av_log(avctx, AV_LOG_ERROR, "Unsupported sprite feature\n"); return -1; } skip_bits(gb, 3); v->res_rtm_flag = 0; } else { v->res_rtm_flag = get_bits1(gb); } if (!v->res_rtm_flag) { av_log(avctx, AV_LOG_ERROR, "Old WMV3 version detected, some frames may be decoded incorrectly\n"); } if(!v->res_fasttx) skip_bits(gb, 16); av_log(avctx, AV_LOG_DEBUG, "Profile %i:\nfrmrtq_postproc=%i, bitrtq_postproc=%i\n" "LoopFilter=%i, MultiRes=%i, FastUVMC=%i, Extended MV=%i\n" "Rangered=%i, VSTransform=%i, Overlap=%i, SyncMarker=%i\n" "DQuant=%i, Quantizer mode=%i, Max B frames=%i\n", v->profile, v->frmrtq_postproc, v->bitrtq_postproc, v->s.loop_filter, v->multires, v->fastuvmc, v->extended_mv, v->rangered, v->vstransform, v->overlap, v->s.resync_marker, v->dquant, v->quantizer_mode, avctx->max_b_frames ); return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(AVCodecContext *VAR_0, VC1Context *VAR_1, GetBitContext *VAR_2) { av_log(VAR_0, AV_LOG_DEBUG, "Header: %0X\n", show_bits(VAR_2, 32)); VAR_1->profile = get_bits(VAR_2, 2); if (VAR_1->profile == PROFILE_COMPLEX) { av_log(VAR_0, AV_LOG_WARNING, "WMV3 Complex Profile is not fully supported\n"); } if (VAR_1->profile == PROFILE_ADVANCED) { VAR_1->zz_8x4 = ff_vc1_adv_progressive_8x4_zz; VAR_1->zz_4x8 = ff_vc1_adv_progressive_4x8_zz; return decode_sequence_header_adv(VAR_1, VAR_2); } else { VAR_1->zz_8x4 = wmv2_scantableA; VAR_1->zz_4x8 = wmv2_scantableB; VAR_1->res_y411 = get_bits1(VAR_2); VAR_1->res_sprite = get_bits1(VAR_2); if (VAR_1->res_y411) { av_log(VAR_0, AV_LOG_ERROR, "Old interlaced mode is not supported\n"); return -1; } if (VAR_1->res_sprite) { av_log(VAR_0, AV_LOG_ERROR, "WMVP is not fully supported\n"); } } VAR_1->frmrtq_postproc = get_bits(VAR_2, 3); VAR_1->bitrtq_postproc = get_bits(VAR_2, 5); VAR_1->s.loop_filter = get_bits1(VAR_2); if(VAR_1->s.loop_filter == 1 && VAR_1->profile == PROFILE_SIMPLE) { av_log(VAR_0, AV_LOG_ERROR, "LOOPFILTER shall not be enabled in Simple Profile\n"); } if(VAR_1->s.VAR_0->skip_loop_filter >= AVDISCARD_ALL) VAR_1->s.loop_filter = 0; VAR_1->res_x8 = get_bits1(VAR_2); VAR_1->multires = get_bits1(VAR_2); VAR_1->res_fasttx = get_bits1(VAR_2); if (!VAR_1->res_fasttx) { VAR_1->vc1dsp.vc1_inv_trans_8x8 = ff_simple_idct; VAR_1->vc1dsp.vc1_inv_trans_8x4 = ff_simple_idct84_add; VAR_1->vc1dsp.vc1_inv_trans_4x8 = ff_simple_idct48_add; VAR_1->vc1dsp.vc1_inv_trans_4x4 = ff_simple_idct44_add; VAR_1->vc1dsp.vc1_inv_trans_8x8_dc = ff_simple_idct_add; VAR_1->vc1dsp.vc1_inv_trans_8x4_dc = ff_simple_idct84_add; VAR_1->vc1dsp.vc1_inv_trans_4x8_dc = ff_simple_idct48_add; VAR_1->vc1dsp.vc1_inv_trans_4x4_dc = ff_simple_idct44_add; } VAR_1->fastuvmc = get_bits1(VAR_2); if (!VAR_1->profile && !VAR_1->fastuvmc) { av_log(VAR_0, AV_LOG_ERROR, "FASTUVMC unavailable in Simple Profile\n"); return -1; } VAR_1->extended_mv = get_bits1(VAR_2); if (!VAR_1->profile && VAR_1->extended_mv) { av_log(VAR_0, AV_LOG_ERROR, "Extended MVs unavailable in Simple Profile\n"); return -1; } VAR_1->dquant = get_bits(VAR_2, 2); VAR_1->vstransform = get_bits1(VAR_2); VAR_1->res_transtab = get_bits1(VAR_2); if (VAR_1->res_transtab) { av_log(VAR_0, AV_LOG_ERROR, "1 for reserved RES_TRANSTAB is forbidden\n"); return -1; } VAR_1->overlap = get_bits1(VAR_2); VAR_1->s.resync_marker = get_bits1(VAR_2); VAR_1->rangered = get_bits1(VAR_2); if (VAR_1->rangered && VAR_1->profile == PROFILE_SIMPLE) { av_log(VAR_0, AV_LOG_INFO, "RANGERED should be set to 0 in Simple Profile\n"); } VAR_1->s.max_b_frames = VAR_0->max_b_frames = get_bits(VAR_2, 3); VAR_1->quantizer_mode = get_bits(VAR_2, 2); VAR_1->finterpflag = get_bits1(VAR_2); if (VAR_1->res_sprite) { VAR_1->s.VAR_0->width = VAR_1->s.VAR_0->coded_width = get_bits(VAR_2, 11); VAR_1->s.VAR_0->height = VAR_1->s.VAR_0->coded_height = get_bits(VAR_2, 11); skip_bits(VAR_2, 5); VAR_1->res_x8 = get_bits1(VAR_2); if (get_bits1(VAR_2)) { av_log(VAR_0, AV_LOG_ERROR, "Unsupported sprite feature\n"); return -1; } skip_bits(VAR_2, 3); VAR_1->res_rtm_flag = 0; } else { VAR_1->res_rtm_flag = get_bits1(VAR_2); } if (!VAR_1->res_rtm_flag) { av_log(VAR_0, AV_LOG_ERROR, "Old WMV3 version detected, some frames may be decoded incorrectly\n"); } if(!VAR_1->res_fasttx) skip_bits(VAR_2, 16); av_log(VAR_0, AV_LOG_DEBUG, "Profile %i:\nfrmrtq_postproc=%i, bitrtq_postproc=%i\n" "LoopFilter=%i, MultiRes=%i, FastUVMC=%i, Extended MV=%i\n" "Rangered=%i, VSTransform=%i, Overlap=%i, SyncMarker=%i\n" "DQuant=%i, Quantizer mode=%i, Max B frames=%i\n", VAR_1->profile, VAR_1->frmrtq_postproc, VAR_1->bitrtq_postproc, VAR_1->s.loop_filter, VAR_1->multires, VAR_1->fastuvmc, VAR_1->extended_mv, VAR_1->rangered, VAR_1->vstransform, VAR_1->overlap, VAR_1->s.resync_marker, VAR_1->dquant, VAR_1->quantizer_mode, VAR_0->max_b_frames ); return 0; }
[ "int FUNC_0(AVCodecContext *VAR_0, VC1Context *VAR_1, GetBitContext *VAR_2)\n{", "av_log(VAR_0, AV_LOG_DEBUG, \"Header: %0X\\n\", show_bits(VAR_2, 32));", "VAR_1->profile = get_bits(VAR_2, 2);", "if (VAR_1->profile == PROFILE_COMPLEX)\n{", "av_log(VAR_0, AV_LOG_WARNING, \"WMV3 Complex Profile is not fully supported\\n\");", "}", "if (VAR_1->profile == PROFILE_ADVANCED)\n{", "VAR_1->zz_8x4 = ff_vc1_adv_progressive_8x4_zz;", "VAR_1->zz_4x8 = ff_vc1_adv_progressive_4x8_zz;", "return decode_sequence_header_adv(VAR_1, VAR_2);", "}", "else\n{", "VAR_1->zz_8x4 = wmv2_scantableA;", "VAR_1->zz_4x8 = wmv2_scantableB;", "VAR_1->res_y411 = get_bits1(VAR_2);", "VAR_1->res_sprite = get_bits1(VAR_2);", "if (VAR_1->res_y411)\n{", "av_log(VAR_0, AV_LOG_ERROR,\n\"Old interlaced mode is not supported\\n\");", "return -1;", "}", "if (VAR_1->res_sprite) {", "av_log(VAR_0, AV_LOG_ERROR, \"WMVP is not fully supported\\n\");", "}", "}", "VAR_1->frmrtq_postproc = get_bits(VAR_2, 3);", "VAR_1->bitrtq_postproc = get_bits(VAR_2, 5);", "VAR_1->s.loop_filter = get_bits1(VAR_2);", "if(VAR_1->s.loop_filter == 1 && VAR_1->profile == PROFILE_SIMPLE)\n{", "av_log(VAR_0, AV_LOG_ERROR,\n\"LOOPFILTER shall not be enabled in Simple Profile\\n\");", "}", "if(VAR_1->s.VAR_0->skip_loop_filter >= AVDISCARD_ALL)\nVAR_1->s.loop_filter = 0;", "VAR_1->res_x8 = get_bits1(VAR_2);", "VAR_1->multires = get_bits1(VAR_2);", "VAR_1->res_fasttx = get_bits1(VAR_2);", "if (!VAR_1->res_fasttx)\n{", "VAR_1->vc1dsp.vc1_inv_trans_8x8 = ff_simple_idct;", "VAR_1->vc1dsp.vc1_inv_trans_8x4 = ff_simple_idct84_add;", "VAR_1->vc1dsp.vc1_inv_trans_4x8 = ff_simple_idct48_add;", "VAR_1->vc1dsp.vc1_inv_trans_4x4 = ff_simple_idct44_add;", "VAR_1->vc1dsp.vc1_inv_trans_8x8_dc = ff_simple_idct_add;", "VAR_1->vc1dsp.vc1_inv_trans_8x4_dc = ff_simple_idct84_add;", "VAR_1->vc1dsp.vc1_inv_trans_4x8_dc = ff_simple_idct48_add;", "VAR_1->vc1dsp.vc1_inv_trans_4x4_dc = ff_simple_idct44_add;", "}", "VAR_1->fastuvmc = get_bits1(VAR_2);", "if (!VAR_1->profile && !VAR_1->fastuvmc)\n{", "av_log(VAR_0, AV_LOG_ERROR,\n\"FASTUVMC unavailable in Simple Profile\\n\");", "return -1;", "}", "VAR_1->extended_mv = get_bits1(VAR_2);", "if (!VAR_1->profile && VAR_1->extended_mv)\n{", "av_log(VAR_0, AV_LOG_ERROR,\n\"Extended MVs unavailable in Simple Profile\\n\");", "return -1;", "}", "VAR_1->dquant = get_bits(VAR_2, 2);", "VAR_1->vstransform = get_bits1(VAR_2);", "VAR_1->res_transtab = get_bits1(VAR_2);", "if (VAR_1->res_transtab)\n{", "av_log(VAR_0, AV_LOG_ERROR,\n\"1 for reserved RES_TRANSTAB is forbidden\\n\");", "return -1;", "}", "VAR_1->overlap = get_bits1(VAR_2);", "VAR_1->s.resync_marker = get_bits1(VAR_2);", "VAR_1->rangered = get_bits1(VAR_2);", "if (VAR_1->rangered && VAR_1->profile == PROFILE_SIMPLE)\n{", "av_log(VAR_0, AV_LOG_INFO,\n\"RANGERED should be set to 0 in Simple Profile\\n\");", "}", "VAR_1->s.max_b_frames = VAR_0->max_b_frames = get_bits(VAR_2, 3);", "VAR_1->quantizer_mode = get_bits(VAR_2, 2);", "VAR_1->finterpflag = get_bits1(VAR_2);", "if (VAR_1->res_sprite) {", "VAR_1->s.VAR_0->width = VAR_1->s.VAR_0->coded_width = get_bits(VAR_2, 11);", "VAR_1->s.VAR_0->height = VAR_1->s.VAR_0->coded_height = get_bits(VAR_2, 11);", "skip_bits(VAR_2, 5);", "VAR_1->res_x8 = get_bits1(VAR_2);", "if (get_bits1(VAR_2)) {", "av_log(VAR_0, AV_LOG_ERROR, \"Unsupported sprite feature\\n\");", "return -1;", "}", "skip_bits(VAR_2, 3);", "VAR_1->res_rtm_flag = 0;", "} else {", "VAR_1->res_rtm_flag = get_bits1(VAR_2);", "}", "if (!VAR_1->res_rtm_flag)\n{", "av_log(VAR_0, AV_LOG_ERROR,\n\"Old WMV3 version detected, some frames may be decoded incorrectly\\n\");", "}", "if(!VAR_1->res_fasttx) skip_bits(VAR_2, 16);", "av_log(VAR_0, AV_LOG_DEBUG,\n\"Profile %i:\\nfrmrtq_postproc=%i, bitrtq_postproc=%i\\n\"\n\"LoopFilter=%i, MultiRes=%i, FastUVMC=%i, Extended MV=%i\\n\"\n\"Rangered=%i, VSTransform=%i, Overlap=%i, SyncMarker=%i\\n\"\n\"DQuant=%i, Quantizer mode=%i, Max B frames=%i\\n\",\nVAR_1->profile, VAR_1->frmrtq_postproc, VAR_1->bitrtq_postproc,\nVAR_1->s.loop_filter, VAR_1->multires, VAR_1->fastuvmc, VAR_1->extended_mv,\nVAR_1->rangered, VAR_1->vstransform, VAR_1->overlap, VAR_1->s.resync_marker,\nVAR_1->dquant, VAR_1->quantizer_mode, VAR_0->max_b_frames\n);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 67 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79, 81 ], [ 83 ], [ 85, 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123, 125 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137, 139 ], [ 141, 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157, 159 ], [ 161, 163 ], [ 165 ], [ 167 ], [ 171 ], [ 175 ], [ 177 ], [ 179, 181 ], [ 183, 185 ], [ 187 ], [ 191 ], [ 193 ], [ 197 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229, 231 ], [ 237, 239 ], [ 243 ], [ 247 ], [ 249, 251, 253, 255, 257, 259, 261, 263, 265, 267 ], [ 269 ], [ 271 ] ]